From: support Date: Wed, 23 Mar 2022 09:09:30 +0000 (+0000) Subject: Built motion from commit bba6c809.|2.6.7 X-Git-Url: http://repos.xcallymotion.com/base/%22angular-material.themes.css//%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7B%20%20%20%20%2011license.mail?a=commitdiff_plain;h=ef0d0a87e0cbab222d87f2cc6f4a557dff70ea7f;p=motion2.git Built motion from commit bba6c809.|2.6.7 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index e2f6aed..c9fb332 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-03-22T15:58:35.841Z", + "time": "2022-03-23T09:01:48.645Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 0b82988..ee3700c 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-03-22T15:58:35.841Z", + "time": "2022-03-23T09:01:48.645Z", "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 3678d05..e888248 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 _0x48c4=['STRING','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','sequelize','exports','VIRTUAL','getDataValue','action','integration','jscripty','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'];(function(_0x4d9f3b,_0x4cc2d8){var _0x2c70c8=function(_0x221745){while(--_0x221745){_0x4d9f3b['push'](_0x4d9f3b['shift']());}};_0x2c70c8(++_0x4cc2d8);}(_0x48c4,0x134));var _0x448c=function(_0x2e693b,_0x452ee8){_0x2e693b=_0x2e693b-0x0;var _0x19220e=_0x48c4[_0x2e693b];return _0x19220e;};'use strict';var Sequelize=require(_0x448c('0x0'));module[_0x448c('0x1')]={'name':{'type':Sequelize[_0x448c('0x2')],'get':function(_0x5c7e51){return this[_0x448c('0x3')](_0x448c('0x4'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[['contactManager',_0x448c('0x5'),'motionbar',_0x448c('0x6'),_0x448c('0x7'),_0x448c('0x8'),_0x448c('0x9'),_0x448c('0xa')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0x448c('0xb')},'data1':{'type':Sequelize[_0x448c('0xc')](0x1000),'comment':_0x448c('0xd')},'data2':{'type':Sequelize[_0x448c('0xc')](0x1000),'comment':_0x448c('0xe')},'data3':{'type':Sequelize[_0x448c('0xc')](0x1000),'comment':_0x448c('0xf')},'data4':{'type':Sequelize[_0x448c('0xc')](0x1000),'comments':_0x448c('0x10')},'data5':{'type':Sequelize['STRING'](0x1000),'comments':'urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]'},'data6':{'type':Sequelize[_0x448c('0xc')],'comments':_0x448c('0x11')},'data7':{'type':Sequelize[_0x448c('0x12')],'comments':_0x448c('0x13')}}; \ No newline at end of file +var _0x3a14=['urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','urlForward[body]','sequelize','exports','VIRTUAL','action','STRING','integration','motionbar','urlForward','browser','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x3a14,0x69));var _0x43a1=function(_0x2fdbb7,_0x55a3cb){_0x2fdbb7=_0x2fdbb7-0x0;var _0x4613b8=_0x3a14[_0x2fdbb7];return _0x4613b8;};'use strict';var Sequelize=require(_0x43a1('0x0'));module[_0x43a1('0x1')]={'name':{'type':Sequelize[_0x43a1('0x2')],'get':function(_0x357b21){return this['getDataValue'](_0x43a1('0x3'));}},'action':{'type':Sequelize[_0x43a1('0x4')],'allowNull':![],'validate':{'isIn':{'args':[['contactManager',_0x43a1('0x5'),_0x43a1('0x6'),'jscripty',_0x43a1('0x7'),_0x43a1('0x8'),'bot',_0x43a1('0x9')]],'msg':_0x43a1('0xa')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize['STRING'](0x1000),'comment':'jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]'},'data2':{'type':Sequelize['STRING'](0x1000),'comment':_0x43a1('0xb')},'data3':{'type':Sequelize['STRING'](0x1000),'comment':_0x43a1('0xc')},'data4':{'type':Sequelize[_0x43a1('0x4')](0x1000),'comments':_0x43a1('0xd')},'data5':{'type':Sequelize['STRING'](0x1000),'comments':_0x43a1('0xe')},'data6':{'type':Sequelize[_0x43a1('0x4')],'comments':_0x43a1('0xf')},'data7':{'type':Sequelize['TEXT'],'comments':_0x43a1('0x10')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index f719a92..e764aeb 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 _0x656e=['path','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','then','destroy','end','stack','name','send','update','body','Action','find','params','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x4f9b81,_0x3dcabf){var _0x260cdf=function(_0x2f09bc){while(--_0x2f09bc){_0x4f9b81['push'](_0x4f9b81['shift']());}};_0x260cdf(++_0x3dcabf);}(_0x656e,0x1f1));var _0xe656=function(_0x5ea2f9,_0x320917){_0x5ea2f9=_0x5ea2f9-0x0;var _0x36e586=_0x656e[_0x5ea2f9];return _0x36e586;};'use strict';var emlformat=require(_0xe656('0x0'));var rimraf=require(_0xe656('0x1'));var zipdir=require(_0xe656('0x2'));var jsonpatch=require(_0xe656('0x3'));var rp=require(_0xe656('0x4'));var moment=require(_0xe656('0x5'));var BPromise=require(_0xe656('0x6'));var Mustache=require(_0xe656('0x7'));var util=require(_0xe656('0x8'));var path=require(_0xe656('0x9'));var sox=require('sox');var csv=require(_0xe656('0xa'));var ejs=require(_0xe656('0xb'));var fs=require('fs');var fs_extra=require(_0xe656('0xc'));var _=require(_0xe656('0xd'));var squel=require(_0xe656('0xe'));var crypto=require(_0xe656('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe656('0x10'));var Papa=require('papaparse');var Redis=require(_0xe656('0x11'));var authService=require(_0xe656('0x12'));var qs=require(_0xe656('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe656('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xe656('0x15'));var config=require(_0xe656('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe656('0x17'))['db'];function respondWithStatusCode(_0x5144cb,_0x25e3e1){_0x25e3e1=_0x25e3e1||0xcc;return function(_0x2fdd32){if(_0x2fdd32){return _0x5144cb['sendStatus'](_0x25e3e1);}return _0x5144cb[_0xe656('0x18')](_0x25e3e1)['end']();};}function respondWithResult(_0xde82ce,_0x448acb){_0x448acb=_0x448acb||0xc8;return function(_0xfce977){if(_0xfce977){return _0xde82ce[_0xe656('0x18')](_0x448acb)[_0xe656('0x19')](_0xfce977);}};}function respondWithFilteredResult(_0x5b7337,_0x215ef5){return function(_0x385e1b){if(_0x385e1b){var _0x4c2600=typeof _0x215ef5[_0xe656('0x1a')]==='undefined'&&typeof _0x215ef5['limit']===_0xe656('0x1b');var _0x5f7c45=_0x385e1b[_0xe656('0x1c')];var _0x60a4a0=_0x4c2600?0x0:_0x215ef5[_0xe656('0x1a')];var _0x32cd5e=_0x4c2600?_0x385e1b['count']:_0x215ef5[_0xe656('0x1a')]+_0x215ef5[_0xe656('0x1d')];var _0x2d8f33;if(_0x32cd5e>=_0x5f7c45){_0x32cd5e=_0x5f7c45;_0x2d8f33=0xc8;}else{_0x2d8f33=0xce;}_0x5b7337[_0xe656('0x18')](_0x2d8f33);return _0x5b7337[_0xe656('0x1e')](_0xe656('0x1f'),_0x60a4a0+'-'+_0x32cd5e+'/'+_0x5f7c45)[_0xe656('0x19')](_0x385e1b);}return null;};}function patchUpdates(_0x1f2f03){return function(_0x789ba9){try{jsonpatch['apply'](_0x789ba9,_0x1f2f03,!![]);}catch(_0xace569){return BPromise[_0xe656('0x20')](_0xace569);}return _0x789ba9[_0xe656('0x21')]();};}function saveUpdates(_0x5b1b2c,_0x2984d1){return function(_0x397d1a){if(_0x397d1a){return _0x397d1a['update'](_0x5b1b2c)[_0xe656('0x22')](function(_0x389ceb){return _0x389ceb;});}return null;};}function removeEntity(_0x3c4e9c,_0x19bad7){return function(_0x3f7e2a){if(_0x3f7e2a){return _0x3f7e2a[_0xe656('0x23')]()[_0xe656('0x22')](function(){_0x3c4e9c[_0xe656('0x18')](0xcc)[_0xe656('0x24')]();});}};}function handleEntityNotFound(_0x34d341,_0x5c5116){return function(_0x97b90f){if(!_0x97b90f){_0x34d341['sendStatus'](0x194);}return _0x97b90f;};}function handleError(_0x4f29be,_0x324784){_0x324784=_0x324784||0x1f4;return function(_0x38a1a5){logger['error'](_0x38a1a5[_0xe656('0x25')]);if(_0x38a1a5[_0xe656('0x26')]){delete _0x38a1a5[_0xe656('0x26')];}_0x4f29be[_0xe656('0x18')](_0x324784)[_0xe656('0x27')](_0x38a1a5);};}exports[_0xe656('0x28')]=function(_0x407435,_0x5089a6){if(_0x407435['body']['id']){delete _0x407435[_0xe656('0x29')]['id'];}return db[_0xe656('0x2a')][_0xe656('0x2b')]({'where':{'id':_0x407435[_0xe656('0x2c')]['id']}})[_0xe656('0x22')](handleEntityNotFound(_0x5089a6,null))['then'](saveUpdates(_0x407435[_0xe656('0x29')],null))['then'](respondWithResult(_0x5089a6,null))[_0xe656('0x2d')](handleError(_0x5089a6,null));};exports['destroy']=function(_0x4c5794,_0x5411a1){return db[_0xe656('0x2a')][_0xe656('0x2b')]({'where':{'id':_0x4c5794[_0xe656('0x2c')]['id']}})[_0xe656('0x22')](handleEntityNotFound(_0x5411a1,null))[_0xe656('0x22')](removeEntity(_0x5411a1,null))['catch'](handleError(_0x5411a1,null));}; \ No newline at end of file +var _0x78db=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','body','params','catch','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse'];(function(_0x15dbca,_0x1d7c3c){var _0x326533=function(_0x507ee2){while(--_0x507ee2){_0x15dbca['push'](_0x15dbca['shift']());}};_0x326533(++_0x1d7c3c);}(_0x78db,0x109));var _0xb78d=function(_0x1f9773,_0x4365fb){_0x1f9773=_0x1f9773-0x0;var _0x3fc947=_0x78db[_0x1f9773];return _0x3fc947;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb78d('0x0'));var zipdir=require(_0xb78d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb78d('0x2'));var moment=require(_0xb78d('0x3'));var BPromise=require(_0xb78d('0x4'));var Mustache=require(_0xb78d('0x5'));var util=require(_0xb78d('0x6'));var path=require(_0xb78d('0x7'));var sox=require(_0xb78d('0x8'));var csv=require(_0xb78d('0x9'));var ejs=require(_0xb78d('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb78d('0xb'));var squel=require(_0xb78d('0xc'));var crypto=require('crypto');var jsforce=require(_0xb78d('0xd'));var deskjs=require(_0xb78d('0xe'));var toCsv=require(_0xb78d('0x9'));var querystring=require(_0xb78d('0xf'));var Papa=require(_0xb78d('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb78d('0x11'));var as=require(_0xb78d('0x12'));var hardwareService=require(_0xb78d('0x13'));var logger=require(_0xb78d('0x14'))(_0xb78d('0x15'));var utils=require(_0xb78d('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xb78d('0x17'));var db=require(_0xb78d('0x18'))['db'];function respondWithStatusCode(_0x4dea84,_0x3102d2){_0x3102d2=_0x3102d2||0xcc;return function(_0x29374d){if(_0x29374d){return _0x4dea84[_0xb78d('0x19')](_0x3102d2);}return _0x4dea84[_0xb78d('0x1a')](_0x3102d2)[_0xb78d('0x1b')]();};}function respondWithResult(_0x3174f9,_0x86d9c6){_0x86d9c6=_0x86d9c6||0xc8;return function(_0x2af88a){if(_0x2af88a){return _0x3174f9[_0xb78d('0x1a')](_0x86d9c6)['json'](_0x2af88a);}};}function respondWithFilteredResult(_0x437aab,_0x4b8153){return function(_0x335e2d){if(_0x335e2d){var _0x2b1abd=typeof _0x4b8153[_0xb78d('0x1c')]===_0xb78d('0x1d')&&typeof _0x4b8153[_0xb78d('0x1e')]===_0xb78d('0x1d');var _0x2c3f81=_0x335e2d[_0xb78d('0x1f')];var _0x5d8ac1=_0x2b1abd?0x0:_0x4b8153[_0xb78d('0x1c')];var _0x26107b=_0x2b1abd?_0x335e2d[_0xb78d('0x1f')]:_0x4b8153[_0xb78d('0x1c')]+_0x4b8153[_0xb78d('0x1e')];var _0x5ebf39;if(_0x26107b>=_0x2c3f81){_0x26107b=_0x2c3f81;_0x5ebf39=0xc8;}else{_0x5ebf39=0xce;}_0x437aab[_0xb78d('0x1a')](_0x5ebf39);return _0x437aab[_0xb78d('0x20')](_0xb78d('0x21'),_0x5d8ac1+'-'+_0x26107b+'/'+_0x2c3f81)[_0xb78d('0x22')](_0x335e2d);}return null;};}function patchUpdates(_0x3b9400){return function(_0x1746e7){try{jsonpatch[_0xb78d('0x23')](_0x1746e7,_0x3b9400,!![]);}catch(_0x4d697e){return BPromise['reject'](_0x4d697e);}return _0x1746e7[_0xb78d('0x24')]();};}function saveUpdates(_0x5e33a0,_0x4b9acc){return function(_0x357738){if(_0x357738){return _0x357738[_0xb78d('0x25')](_0x5e33a0)[_0xb78d('0x26')](function(_0x572744){return _0x572744;});}return null;};}function removeEntity(_0x4fdbb5,_0x1ffe18){return function(_0x4d4bb6){if(_0x4d4bb6){return _0x4d4bb6[_0xb78d('0x27')]()[_0xb78d('0x26')](function(){_0x4fdbb5[_0xb78d('0x1a')](0xcc)[_0xb78d('0x1b')]();});}};}function handleEntityNotFound(_0x5da4a4,_0x10cd5b){return function(_0xb376ec){if(!_0xb376ec){_0x5da4a4['sendStatus'](0x194);}return _0xb376ec;};}function handleError(_0x1facf0,_0x40cb8b){_0x40cb8b=_0x40cb8b||0x1f4;return function(_0xa7e0b6){logger[_0xb78d('0x28')](_0xa7e0b6[_0xb78d('0x29')]);if(_0xa7e0b6[_0xb78d('0x2a')]){delete _0xa7e0b6[_0xb78d('0x2a')];}_0x1facf0[_0xb78d('0x1a')](_0x40cb8b)[_0xb78d('0x2b')](_0xa7e0b6);};}exports[_0xb78d('0x25')]=function(_0x169db7,_0x226f51){if(_0x169db7[_0xb78d('0x2c')]['id']){delete _0x169db7[_0xb78d('0x2c')]['id'];}return db['Action']['find']({'where':{'id':_0x169db7[_0xb78d('0x2d')]['id']}})[_0xb78d('0x26')](handleEntityNotFound(_0x226f51,null))[_0xb78d('0x26')](saveUpdates(_0x169db7[_0xb78d('0x2c')],null))['then'](respondWithResult(_0x226f51,null))[_0xb78d('0x2e')](handleError(_0x226f51,null));};exports[_0xb78d('0x27')]=function(_0x35e9d1,_0x51f4c1){return db['Action']['find']({'where':{'id':_0x35e9d1['params']['id']}})[_0xb78d('0x26')](handleEntityNotFound(_0x51f4c1,null))[_0xb78d('0x26')](removeEntity(_0x51f4c1,null))[_0xb78d('0x2e')](handleError(_0x51f4c1,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index faf7d79..bb21230 100644 --- a/server/api/action/action.model.js +++ b/server/api/action/action.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x25fd=['request-promise','rimraf','../../config/environment','exports','define','../../config/logger','api','bluebird'];(function(_0x2157ec,_0x3fc94f){var _0x4033e4=function(_0x207084){while(--_0x207084){_0x2157ec['push'](_0x2157ec['shift']());}};_0x4033e4(++_0x3fc94f);}(_0x25fd,0x16d));var _0xd25f=function(_0x1a681f,_0x574fb3){_0x1a681f=_0x1a681f-0x0;var _0x3d9241=_0x25fd[_0x1a681f];return _0x3d9241;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd25f('0x0'))(_0xd25f('0x1'));var moment=require('moment');var BPromise=require(_0xd25f('0x2'));var rp=require(_0xd25f('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd25f('0x4'));var config=require(_0xd25f('0x5'));var attributes=require('./action.attributes');module[_0xd25f('0x6')]=function(_0x4ad800,_0x2752d7){return _0x4ad800[_0xd25f('0x7')]('Action',attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x39bb=['exports','define','tools_actions','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./action.attributes'];(function(_0x3c2e5a,_0x97e5d3){var _0x4ccc31=function(_0x328df5){while(--_0x328df5){_0x3c2e5a['push'](_0x3c2e5a['shift']());}};_0x4ccc31(++_0x97e5d3);}(_0x39bb,0xe7));var _0xb39b=function(_0x18f82b,_0x3ea7a0){_0x18f82b=_0x18f82b-0x0;var _0x5d8128=_0x39bb[_0x18f82b];return _0x5d8128;};'use strict';var _=require('lodash');var util=require(_0xb39b('0x0'));var logger=require(_0xb39b('0x1'))(_0xb39b('0x2'));var moment=require(_0xb39b('0x3'));var BPromise=require(_0xb39b('0x4'));var rp=require(_0xb39b('0x5'));var fs=require('fs');var path=require(_0xb39b('0x6'));var rimraf=require(_0xb39b('0x7'));var config=require('../../config/environment');var attributes=require(_0xb39b('0x8'));module[_0xb39b('0x9')]=function(_0x340948,_0x24641b){return _0x340948[_0xb39b('0xa')]('Action',attributes,{'tableName':_0xb39b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index c363be8..e4f500e 100644 --- a/server/api/action/action.rpc.js +++ b/server/api/action/action.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1261=['then','info','Action,\x20%s,\x20%s','request\x20sent','Action,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x145318,_0x445c34){var _0x5c82d5=function(_0x5447ce){while(--_0x5447ce){_0x145318['push'](_0x145318['shift']());}};_0x5c82d5(++_0x445c34);}(_0x1261,0x144));var _0x1126=function(_0x3ef2d5,_0x423d46){_0x3ef2d5=_0x3ef2d5-0x0;var _0x2fefb2=_0x1261[_0x3ef2d5];return _0x2fefb2;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('Action,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file +var _0x5fab=['../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Action,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x486b00,_0x501df5){var _0x47ea82=function(_0x997782){while(--_0x997782){_0x486b00['push'](_0x486b00['shift']());}};_0x47ea82(++_0x501df5);}(_0x5fab,0x177));var _0xb5fa=function(_0x267d8d,_0xe90f65){_0x267d8d=_0x267d8d-0x0;var _0x11a98f=_0x5fab[_0x267d8d];return _0x11a98f;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var moment=require('moment');var BPromise=require(_0xb5fa('0x2'));var rs=require(_0xb5fa('0x3'));var fs=require('fs');var Redis=require(_0xb5fa('0x4'));var db=require(_0xb5fa('0x5'))['db'];var utils=require(_0xb5fa('0x6'));var logger=require(_0xb5fa('0x7'))(_0xb5fa('0x8'));var config=require(_0xb5fa('0x9'));var jayson=require(_0xb5fa('0xa'));var client=jayson[_0xb5fa('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d70f6,_0x2e3804,_0x1aec3e){return new BPromise(function(_0x9c7bce,_0x56d018){return client[_0xb5fa('0xc')](_0x5d70f6,_0x1aec3e)[_0xb5fa('0xd')](function(_0x2cf4a5){logger['info']('Action,\x20%s,\x20%s',_0x2e3804,_0xb5fa('0xe'));logger[_0xb5fa('0xf')](_0xb5fa('0x10'),_0x2e3804,_0xb5fa('0xe'),JSON[_0xb5fa('0x11')](_0x2cf4a5));if(_0x2cf4a5[_0xb5fa('0x12')]){if(_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x13')]===0x1f4){logger[_0xb5fa('0x12')]('Action,\x20%s,\x20%s',_0x2e3804,_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);return _0x56d018(_0x2cf4a5['error'][_0xb5fa('0x14')]);}logger['error'](_0xb5fa('0x15'),_0x2e3804,_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);return _0x9c7bce(_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);}else{logger['info']('Action,\x20%s,\x20%s',_0x2e3804,_0xb5fa('0xe'));_0x9c7bce(_0x2cf4a5[_0xb5fa('0x16')][_0xb5fa('0x14')]);}})[_0xb5fa('0x17')](function(_0x56fe10){logger['error'](_0xb5fa('0x15'),_0x2e3804,_0x56fe10);_0x56d018(_0x56fe10);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 422f8bd..63f4f4b 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 _0x445b=['path','Router','fs-extra','../../components/interaction/service','../../config/environment','./action.controller','put','/:id','update','delete','isAuthenticated','destroy','exports','multer','util'];(function(_0x4a4314,_0x49a980){var _0x83fca5=function(_0x19b25a){while(--_0x19b25a){_0x4a4314['push'](_0x4a4314['shift']());}};_0x83fca5(++_0x49a980);}(_0x445b,0xa3));var _0xb445=function(_0x45e9a2,_0x13d643){_0x45e9a2=_0x45e9a2-0x0;var _0x1a3247=_0x445b[_0x45e9a2];return _0x1a3247;};'use strict';var multer=require(_0xb445('0x0'));var util=require(_0xb445('0x1'));var path=require(_0xb445('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb445('0x3')]();var fs_extra=require(_0xb445('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xb445('0x5'));var config=require(_0xb445('0x6'));var controller=require(_0xb445('0x7'));router[_0xb445('0x8')](_0xb445('0x9'),auth['isAuthenticated'](),controller[_0xb445('0xa')]);router[_0xb445('0xb')](_0xb445('0x9'),auth[_0xb445('0xc')](),controller[_0xb445('0xd')]);module[_0xb445('0xe')]=router; \ No newline at end of file +var _0xe085=['put','/:id','update','delete','isAuthenticated','destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller'];(function(_0x16a9a0,_0x5e8414){var _0xc3657c=function(_0x4e037f){while(--_0x4e037f){_0x16a9a0['push'](_0x16a9a0['shift']());}};_0xc3657c(++_0x5e8414);}(_0xe085,0x132));var _0x5e08=function(_0x33a47c,_0x2ab830){_0x33a47c=_0x33a47c-0x0;var _0xa2f243=_0xe085[_0x33a47c];return _0xa2f243;};'use strict';var multer=require(_0x5e08('0x0'));var util=require(_0x5e08('0x1'));var path=require(_0x5e08('0x2'));var timeout=require('connect-timeout');var express=require(_0x5e08('0x3'));var router=express[_0x5e08('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x5e08('0x5'));var interaction=require(_0x5e08('0x6'));var config=require(_0x5e08('0x7'));var controller=require(_0x5e08('0x8'));router[_0x5e08('0x9')](_0x5e08('0xa'),auth['isAuthenticated'](),controller[_0x5e08('0xb')]);router[_0x5e08('0xc')](_0x5e08('0xa'),auth[_0x5e08('0xd')](),controller[_0x5e08('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 4a387bf..5a51884 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 _0xfdbd=['sequelize','exports','STRING','TEXT'];(function(_0x2afb44,_0x249a57){var _0x15ccc2=function(_0x180748){while(--_0x180748){_0x2afb44['push'](_0x2afb44['shift']());}};_0x15ccc2(++_0x249a57);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x1bd3ab,_0x352c42){_0x1bd3ab=_0x1bd3ab-0x0;var _0x37e394=_0xfdbd[_0x1bd3ab];return _0x37e394;};'use strict';var Sequelize=require(_0xdfdb('0x0'));module[_0xdfdb('0x1')]={'name':{'type':Sequelize[_0xdfdb('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xdfdb('0x2')]},'parent':{'type':Sequelize[_0xdfdb('0x2')]},'table':{'type':Sequelize[_0xdfdb('0x2')]},'conditions':{'type':Sequelize[_0xdfdb('0x3')]},'joins':{'type':Sequelize[_0xdfdb('0x3')]}}; \ No newline at end of file +var _0x326f=['STRING','TEXT','sequelize'];(function(_0x158b72,_0x4f6dcb){var _0x361d41=function(_0x2d3986){while(--_0x2d3986){_0x158b72['push'](_0x158b72['shift']());}};_0x361d41(++_0x4f6dcb);}(_0x326f,0xd1));var _0xf326=function(_0x4f520e,_0x4d5bd7){_0x4f520e=_0x4f520e-0x0;var _0x5f3929=_0x326f[_0x4f520e];return _0x5f3929;};'use strict';var Sequelize=require(_0xf326('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xf326('0x1')]},'parent':{'type':Sequelize[_0xf326('0x1')]},'table':{'type':Sequelize[_0xf326('0x1')]},'conditions':{'type':Sequelize[_0xf326('0x2')]},'joins':{'type':Sequelize[_0xf326('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 621bf29..9c30174 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 _0x0079=['DATE(%s)','HOUR(%s)','IS\x20NOT\x20EMPTY','keyBy','%s.%s\x20=\x20%s.%s','web','%s-%s.%s','generate','output','csv','custom','AnalyticExtractedReport','cdr','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','SELECT','run','runReport','Limited\x20Query:','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','dbH','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','get','CustomReports','UserProfileResource','error','stack','name','send','AnalyticCustomReport','rawAttributes','fieldName','type','key','map','keys','query','filters','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','intersection','include','options','find','create','body','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','select','from','table','MetricId','metric','replace','function','format','groupBy','orderBy','DESC','alias','joins','parse','foreignTable','foreignKey','parentKey','conditions','clone','debug','toString','sequelize','QueryTypes','left_join','right_join','COUNT(%s)','MAX(%s)'];(function(_0x287059,_0x499940){var _0x225c79=function(_0x3aa36e){while(--_0x3aa36e){_0x287059['push'](_0x287059['shift']());}};_0x225c79(++_0x499940);}(_0x0079,0x16c));var _0x9007=function(_0x10209b,_0x3a1b5c){_0x10209b=_0x10209b-0x0;var _0x49541a=_0x0079[_0x10209b];return _0x49541a;};'use strict';var emlformat=require(_0x9007('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9007('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9007('0x2'));var moment=require(_0x9007('0x3'));var BPromise=require(_0x9007('0x4'));var Mustache=require(_0x9007('0x5'));var util=require(_0x9007('0x6'));var path=require(_0x9007('0x7'));var sox=require(_0x9007('0x8'));var csv=require('to-csv');var ejs=require(_0x9007('0x9'));var fs=require('fs');var fs_extra=require(_0x9007('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9007('0xb'));var deskjs=require(_0x9007('0xc'));var toCsv=require(_0x9007('0xd'));var querystring=require(_0x9007('0xe'));var Papa=require(_0x9007('0xf'));var Redis=require('ioredis');var authService=require(_0x9007('0x10'));var qs=require(_0x9007('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9007('0x12'));var logger=require(_0x9007('0x13'))(_0x9007('0x14'));var utils=require(_0x9007('0x15'));var config=require(_0x9007('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x9007('0x17'))['db'];var dbH=require(_0x9007('0x17'))[_0x9007('0x18')];function respondWithStatusCode(_0x569e6c,_0x406463){_0x406463=_0x406463||0xcc;return function(_0x239e77){if(_0x239e77){return _0x569e6c[_0x9007('0x19')](_0x406463);}return _0x569e6c['status'](_0x406463)[_0x9007('0x1a')]();};}function respondWithResult(_0x17e13f,_0x254c44){_0x254c44=_0x254c44||0xc8;return function(_0x56f67d){if(_0x56f67d){return _0x17e13f[_0x9007('0x1b')](_0x254c44)[_0x9007('0x1c')](_0x56f67d);}};}function respondWithFilteredResult(_0x1ffcb0,_0x3f74bd){return function(_0x16962f){if(_0x16962f){var _0x590401=typeof _0x3f74bd[_0x9007('0x1d')]===_0x9007('0x1e')&&typeof _0x3f74bd[_0x9007('0x1f')]===_0x9007('0x1e');var _0x4a0dcb=_0x16962f[_0x9007('0x20')];var _0x1af394=_0x590401?0x0:_0x3f74bd[_0x9007('0x1d')];var _0x55f020=_0x590401?_0x16962f[_0x9007('0x20')]:_0x3f74bd[_0x9007('0x1d')]+_0x3f74bd[_0x9007('0x1f')];var _0x2a194e;if(_0x55f020>=_0x4a0dcb){_0x55f020=_0x4a0dcb;_0x2a194e=0xc8;}else{_0x2a194e=0xce;}_0x1ffcb0[_0x9007('0x1b')](_0x2a194e);return _0x1ffcb0[_0x9007('0x21')](_0x9007('0x22'),_0x1af394+'-'+_0x55f020+'/'+_0x4a0dcb)[_0x9007('0x1c')](_0x16962f);}return null;};}function patchUpdates(_0x527105){return function(_0x1ebf10){try{jsonpatch['apply'](_0x1ebf10,_0x527105,!![]);}catch(_0x344e8c){return BPromise[_0x9007('0x23')](_0x344e8c);}return _0x1ebf10[_0x9007('0x24')]();};}function saveUpdates(_0x35c60c,_0x9f2786){return function(_0x13bb50){if(_0x13bb50){return _0x13bb50[_0x9007('0x25')](_0x35c60c)[_0x9007('0x26')](function(_0x231fe7){return _0x231fe7;});}return null;};}function removeEntity(_0x3b3938,_0x4d7c44){return function(_0x1912ad){if(_0x1912ad){return _0x1912ad[_0x9007('0x27')]()['then'](function(){var _0x32dcf4=_0x1912ad[_0x9007('0x28')]({'plain':!![]});var _0x192040=_0x9007('0x29');return db[_0x9007('0x2a')][_0x9007('0x27')]({'where':{'type':_0x192040,'resourceId':_0x32dcf4['id']}})['then'](function(){return _0x1912ad;});})[_0x9007('0x26')](function(){_0x3b3938[_0x9007('0x1b')](0xcc)[_0x9007('0x1a')]();});}};}function handleEntityNotFound(_0x47ffef,_0x4d7a3f){return function(_0x334054){if(!_0x334054){_0x47ffef[_0x9007('0x19')](0x194);}return _0x334054;};}function handleError(_0x345a9d,_0x1b946c){_0x1b946c=_0x1b946c||0x1f4;return function(_0x1fbef6){logger[_0x9007('0x2b')](_0x1fbef6[_0x9007('0x2c')]);if(_0x1fbef6[_0x9007('0x2d')]){delete _0x1fbef6[_0x9007('0x2d')];}_0x345a9d['status'](_0x1b946c)[_0x9007('0x2e')](_0x1fbef6);};}exports['index']=function(_0x302f15,_0x11f550){var _0x477aef={},_0x2aa269={},_0x5b1958={'count':0x0,'rows':[]};var _0x43cff1=_['map'](db[_0x9007('0x2f')][_0x9007('0x30')],function(_0xa46fdf){return{'name':_0xa46fdf[_0x9007('0x31')],'type':_0xa46fdf[_0x9007('0x32')][_0x9007('0x33')]};});_0x2aa269['model']=_[_0x9007('0x34')](_0x43cff1,_0x9007('0x2d'));_0x2aa269['query']=_[_0x9007('0x35')](_0x302f15[_0x9007('0x36')]);_0x2aa269[_0x9007('0x37')]=_['intersection'](_0x2aa269[_0x9007('0x38')],_0x2aa269[_0x9007('0x36')]);_0x477aef['attributes']=_['intersection'](_0x2aa269[_0x9007('0x38')],qs[_0x9007('0x39')](_0x302f15[_0x9007('0x36')][_0x9007('0x39')]));_0x477aef[_0x9007('0x3a')]=_0x477aef[_0x9007('0x3a')][_0x9007('0x3b')]?_0x477aef[_0x9007('0x3a')]:_0x2aa269[_0x9007('0x38')];if(!_0x302f15[_0x9007('0x36')][_0x9007('0x3c')](_0x9007('0x3d'))){_0x477aef[_0x9007('0x1f')]=qs[_0x9007('0x1f')](_0x302f15[_0x9007('0x36')][_0x9007('0x1f')]);_0x477aef[_0x9007('0x1d')]=qs['offset'](_0x302f15[_0x9007('0x36')][_0x9007('0x1d')]);}_0x477aef[_0x9007('0x3e')]=qs[_0x9007('0x3f')](_0x302f15[_0x9007('0x36')]['sort']);_0x477aef[_0x9007('0x40')]=qs[_0x9007('0x37')](_[_0x9007('0x41')](_0x302f15['query'],_0x2aa269['filters']),_0x43cff1);if(_0x302f15[_0x9007('0x36')][_0x9007('0x42')]){_0x477aef['where']=_[_0x9007('0x43')](_0x477aef['where'],{'$or':_[_0x9007('0x34')](_0x43cff1,function(_0x4c5e28){if(_0x4c5e28[_0x9007('0x32')]!==_0x9007('0x44')){var _0x4e33aa={};_0x4e33aa[_0x4c5e28[_0x9007('0x2d')]]={'$like':'%'+_0x302f15[_0x9007('0x36')]['filter']+'%'};return _0x4e33aa;}})});}_0x477aef=_[_0x9007('0x43')]({},_0x477aef,_0x302f15['options']);var _0x11d7e4={'where':_0x477aef['where']};return db[_0x9007('0x2f')]['count'](_0x11d7e4)[_0x9007('0x26')](function(_0x5282a0){_0x5b1958['count']=_0x5282a0;if(_0x302f15['query'][_0x9007('0x45')]){_0x477aef['include']=[{'all':!![]}];}return db[_0x9007('0x2f')][_0x9007('0x46')](_0x477aef);})[_0x9007('0x26')](function(_0x3e6e4d){_0x5b1958[_0x9007('0x47')]=_0x3e6e4d;return _0x5b1958;})[_0x9007('0x26')](respondWithFilteredResult(_0x11f550,_0x477aef))[_0x9007('0x48')](handleError(_0x11f550,null));};exports[_0x9007('0x49')]=function(_0xa5be6a,_0x1cda38){var _0xb9b284={'raw':![],'where':{'id':_0xa5be6a[_0x9007('0x4a')]['id']}},_0x134934={};_0x134934[_0x9007('0x38')]=_[_0x9007('0x35')](db[_0x9007('0x2f')]['rawAttributes']);_0x134934['query']=_[_0x9007('0x35')](_0xa5be6a[_0x9007('0x36')]);_0x134934[_0x9007('0x37')]=_[_0x9007('0x4b')](_0x134934[_0x9007('0x38')],_0x134934[_0x9007('0x36')]);_0xb9b284['attributes']=_[_0x9007('0x4b')](_0x134934[_0x9007('0x38')],qs[_0x9007('0x39')](_0xa5be6a[_0x9007('0x36')][_0x9007('0x39')]));_0xb9b284['attributes']=_0xb9b284[_0x9007('0x3a')][_0x9007('0x3b')]?_0xb9b284['attributes']:_0x134934[_0x9007('0x38')];if(_0xa5be6a[_0x9007('0x36')]['includeAll']){_0xb9b284[_0x9007('0x4c')]=[{'all':!![]}];}_0xb9b284=_[_0x9007('0x43')]({},_0xb9b284,_0xa5be6a[_0x9007('0x4d')]);return db[_0x9007('0x2f')][_0x9007('0x4e')](_0xb9b284)['then'](handleEntityNotFound(_0x1cda38,null))[_0x9007('0x26')](respondWithResult(_0x1cda38,null))['catch'](handleError(_0x1cda38,null));};exports[_0x9007('0x4f')]=function(_0x503a6a,_0x2738f4){return db['AnalyticCustomReport'][_0x9007('0x4f')](_0x503a6a[_0x9007('0x50')],{})[_0x9007('0x26')](function(_0x38a4dd){var _0x2b3027=_0x503a6a['user'][_0x9007('0x28')]({'plain':!![]});if(!_0x2b3027)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2b3027[_0x9007('0x51')]===_0x9007('0x52')){var _0x48c0c4=_0x38a4dd['get']({'plain':!![]});var _0x36c479='Reports';return db[_0x9007('0x53')]['find']({'where':{'name':_0x36c479,'userProfileId':_0x2b3027[_0x9007('0x54')]},'raw':!![]})[_0x9007('0x26')](function(_0x2c04bc){if(_0x2c04bc&&_0x2c04bc[_0x9007('0x55')]===0x0){return db['UserProfileResource']['create']({'name':_0x48c0c4[_0x9007('0x2d')],'resourceId':_0x48c0c4['id'],'type':_0x9007('0x29'),'sectionId':_0x2c04bc['id']},{})[_0x9007('0x26')](function(){return _0x38a4dd;});}else{return _0x38a4dd;}})[_0x9007('0x48')](function(_0x20e176){logger[_0x9007('0x2b')](_0x9007('0x56'),_0x20e176);throw _0x20e176;});}return _0x38a4dd;})[_0x9007('0x26')](respondWithResult(_0x2738f4,0xc9))[_0x9007('0x48')](handleError(_0x2738f4,null));};exports[_0x9007('0x25')]=function(_0x2709bc,_0x4d1b8e){if(_0x2709bc['body']['id']){delete _0x2709bc[_0x9007('0x50')]['id'];}return db['AnalyticCustomReport'][_0x9007('0x4e')]({'where':{'id':_0x2709bc['params']['id']}})['then'](handleEntityNotFound(_0x4d1b8e,null))['then'](saveUpdates(_0x2709bc['body'],null))[_0x9007('0x26')](respondWithResult(_0x4d1b8e,null))[_0x9007('0x48')](handleError(_0x4d1b8e,null));};exports[_0x9007('0x27')]=function(_0x2fed69,_0x441da8){return db['AnalyticCustomReport'][_0x9007('0x4e')]({'where':{'id':_0x2fed69[_0x9007('0x4a')]['id']}})[_0x9007('0x26')](handleEntityNotFound(_0x441da8,null))[_0x9007('0x26')](removeEntity(_0x441da8,null))['catch'](handleError(_0x441da8,null));};exports[_0x9007('0x57')]=function(_0x1dbb8c,_0x1082d5){var _0x114185=0xa;var _0x100f56=[_0x9007('0x58'),'left_join','right_join',_0x9007('0x59')];var _0x4abae3={'SUM':_0x9007('0x5a'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x9007('0x5b'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0x9007('0x5c'),'GROUP_CONCAT':_0x9007('0x5d'),'GROUP_CONCAT ASC':_0x9007('0x5e'),'GROUP_CONCAT DESC':_0x9007('0x5f')};var _0x18d5c2={'SEC_TO_TIME':_0x9007('0x60'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x9007('0x61')};var _0x37676a=function(_0x3086bc){return!_[_0x9007('0x62')]([_0x9007('0x63'),_0x9007('0x64'),_0x9007('0x65'),'IS\x20NOT\x20EMPTY'],_0x3086bc);};var _0x5a158a=function(_0x4b4496){if(!_0x4b4496||!_0x4b4496[_0x9007('0x66')]['length']){return'';}for(var _0x133133='(',_0x5c7d01=0x0;_0x5c7d01<_0x4b4496[_0x9007('0x66')][_0x9007('0x3b')];_0x5c7d01+=0x1){_0x5c7d01>0x0&&(_0x133133+='\x20'+_0x4b4496[_0x9007('0x67')]+'\x20');_0x133133+=_0x4b4496[_0x9007('0x66')][_0x5c7d01][_0x9007('0x68')]?_0x5a158a(_0x4b4496['rules'][_0x5c7d01]['group']):_0x4b4496[_0x9007('0x66')][_0x5c7d01][_0x9007('0x69')]+'\x20'+_0x4b4496[_0x9007('0x66')][_0x5c7d01][_0x9007('0x6a')]+(_0x37676a(_0x4b4496[_0x9007('0x66')][_0x5c7d01][_0x9007('0x6a')])?'\x20'+_0x4b4496[_0x9007('0x66')][_0x5c7d01][_0x9007('0x6b')]:'');}return _0x133133+')';};var _0x11fa28={'where':{'id':_0x1dbb8c[_0x9007('0x4a')]['id']}},_0x1f8538,_0x56c58d,_0x301a69,_0x146990,_0x514b42;_0x11fa28=_[_0x9007('0x43')]({},_0x11fa28,_0x1dbb8c['options']);return db['AnalyticCustomReport']['find'](_0x11fa28)[_0x9007('0x26')](function(_0x263215){if(_0x263215){_0x1f8538=_0x263215;return _0x263215[_0x9007('0x6c')]();}return null;})[_0x9007('0x26')](function(_0x10272c){if(_0x10272c){if(!_0x10272c[_0x9007('0x3b')]){throw new db[(_0x9007('0x6d'))][(_0x9007('0x6e'))](_0x9007('0x6f'),0x193);}_0x56c58d=_0x10272c;return db[_0x9007('0x70')][_0x9007('0x46')]({'raw':!![]});}return null;})[_0x9007('0x26')](function(_0x3ed135){if(_0x3ed135){_0x301a69=_['keyBy'](_0x3ed135,'id');var _0x265574;var _0xf34d6a=squel[_0x9007('0x71')]();_0xf34d6a[_0x9007('0x72')](_0x1f8538[_0x9007('0x73')]);for(var _0x58c6ef=0x0;_0x58c6ef<_0x56c58d[_0x9007('0x3b')];_0x58c6ef+=0x1){_0x265574=_0x56c58d[_0x58c6ef][_0x9007('0x74')]?_0x301a69[_0x56c58d[_0x58c6ef][_0x9007('0x74')]][_0x9007('0x75')]:_0x56c58d[_0x58c6ef][_0x9007('0x69')];_0x265574=_0x56c58d[_0x58c6ef]['function']?_[_0x9007('0x76')](_0x4abae3[_0x56c58d[_0x58c6ef][_0x9007('0x77')]],'%s',_0x265574):_0x265574;_0x265574=_0x56c58d[_0x58c6ef][_0x9007('0x78')]?_[_0x9007('0x76')](_0x18d5c2[_0x56c58d[_0x58c6ef][_0x9007('0x78')]],'%s',_0x265574):_0x265574;if(_0x56c58d[_0x58c6ef][_0x9007('0x79')]){_0xf34d6a[_0x9007('0x68')](_0x265574);}_0x56c58d[_0x58c6ef]['orderBy']&&_0xf34d6a['order'](_0x265574,_0x56c58d[_0x58c6ef][_0x9007('0x7a')]===_0x9007('0x7b')?![]:!![]);_0xf34d6a['field'](_0x265574,_0x56c58d[_0x58c6ef][_0x9007('0x7c')]||_0x265574);}if(_0x1f8538[_0x9007('0x7d')]){_0x1f8538['joins']=JSON[_0x9007('0x7e')](_0x1f8538[_0x9007('0x7d')]);for(var _0x1dd92e=0x0;_0x1dd92e<_0x1f8538[_0x9007('0x7d')][_0x9007('0x3b')];_0x1dd92e+=0x1){if(_0x1f8538[_0x9007('0x7d')][_0x1dd92e][_0x9007('0x32')]&&_['includes'](_0x100f56,_0x1f8538[_0x9007('0x7d')][_0x1dd92e][_0x9007('0x32')])&&_0x1f8538[_0x9007('0x7d')][_0x1dd92e]['parentKey']&&_0x1f8538[_0x9007('0x7d')][_0x1dd92e][_0x9007('0x7f')]&&_0x1f8538[_0x9007('0x7d')][_0x1dd92e][_0x9007('0x80')]){_0xf34d6a[_0x1f8538[_0x9007('0x7d')][_0x1dd92e][_0x9007('0x32')]](_0x1f8538[_0x9007('0x7d')][_0x1dd92e][_0x9007('0x7f')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x1f8538[_0x9007('0x73')],_0x1f8538[_0x9007('0x7d')][_0x1dd92e][_0x9007('0x81')],_0x1f8538['joins'][_0x1dd92e][_0x9007('0x7f')],_0x1f8538['joins'][_0x1dd92e][_0x9007('0x80')]));}}}if(_0x1f8538[_0x9007('0x82')]){_0x1f8538[_0x9007('0x82')]=JSON[_0x9007('0x7e')](_0x1f8538['conditions']);_0xf34d6a[_0x9007('0x40')](_0x5a158a(_0x1f8538[_0x9007('0x82')][_0x9007('0x68')]));}_0x514b42=_0xf34d6a[_0x9007('0x83')]();_0xf34d6a[_0x9007('0x1f')](_0x114185);_0xf34d6a['offset'](0x0);logger[_0x9007('0x84')]('Limited\x20Query:',_0xf34d6a[_0x9007('0x85')]());return dbH['sequelize']['query'](_0xf34d6a[_0x9007('0x85')](),{'type':dbH[_0x9007('0x86')][_0x9007('0x87')]['SELECT']});}})[_0x9007('0x26')](respondWithResult(_0x1082d5,null))[_0x9007('0x48')](handleError(_0x1082d5,null));};function runReport(_0x31ca5e,_0x3dcbb4,_0xd41a59){var _0xa13a34=_0x3dcbb4[_0x9007('0x2d')];var _0x10e285=0xa;var _0x2d694c=[_0x9007('0x58'),_0x9007('0x88'),_0x9007('0x89'),_0x9007('0x59')];var _0x2ce573={'SUM':_0x9007('0x5a'),'COUNT':_0x9007('0x8a'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x9007('0x8b'),'MIN':'MIN(%s)','AVG':_0x9007('0x5c'),'GROUP_CONCAT':_0x9007('0x5d'),'GROUP_CONCAT ASC':_0x9007('0x5e'),'GROUP_CONCAT DESC':_0x9007('0x5f')};var _0xd9fe03={'SEC_TO_TIME':_0x9007('0x60'),'DATE':_0x9007('0x8c'),'HOUR':_0x9007('0x8d'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x9007('0x61')};var _0x38b7ac=function(_0x5c6a4b){return!_[_0x9007('0x62')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x9007('0x65'),_0x9007('0x8e')],_0x5c6a4b);};var _0x2d9d00=function(_0x23221b){if(!_0x23221b||!_0x23221b[_0x9007('0x66')][_0x9007('0x3b')]){return'';}for(var _0x284ac9='(',_0x36f069=0x0;_0x36f069<_0x23221b[_0x9007('0x66')][_0x9007('0x3b')];_0x36f069+=0x1){_0x36f069>0x0&&(_0x284ac9+='\x20'+_0x23221b[_0x9007('0x67')]+'\x20');_0x284ac9+=_0x23221b[_0x9007('0x66')][_0x36f069][_0x9007('0x68')]?_0x2d9d00(_0x23221b[_0x9007('0x66')][_0x36f069]['group']):_0x23221b[_0x9007('0x66')][_0x36f069][_0x9007('0x69')]+'\x20'+_0x23221b['rules'][_0x36f069][_0x9007('0x6a')]+(_0x38b7ac(_0x23221b[_0x9007('0x66')][_0x36f069][_0x9007('0x6a')])?'\x20'+_0x23221b['rules'][_0x36f069][_0x9007('0x6b')]:'');}return _0x284ac9+')';};var _0xc6637c={'where':{'id':_0x31ca5e['id']}},_0x8ee6b3,_0xbb4d15,_0x367db6,_0x4184f8,_0x48ee83;_0xc6637c=_[_0x9007('0x43')]({},_0xc6637c,_0xd41a59);return db[_0x9007('0x2f')][_0x9007('0x4e')](_0xc6637c)['then'](function(_0x5a3062){if(_0x5a3062){_0x8ee6b3=_0x5a3062;return _0x5a3062[_0x9007('0x6c')]();}return null;})[_0x9007('0x26')](function(_0xfaa9a8){if(_0xfaa9a8){if(!_0xfaa9a8[_0x9007('0x3b')]){throw new db[(_0x9007('0x6d'))][(_0x9007('0x6e'))](_0x9007('0x6f'),0x193);}_0xbb4d15=_0xfaa9a8;return db[_0x9007('0x70')][_0x9007('0x46')]({'raw':!![]});}return null;})[_0x9007('0x26')](function(_0x1a9f59){if(_0x1a9f59){_0x367db6=_[_0x9007('0x8f')](_0x1a9f59,'id');var _0x294315;var _0x422c93=squel['select']();_0x422c93[_0x9007('0x72')](_0x8ee6b3['table']);for(var _0x32840c=0x0;_0x32840c<_0xbb4d15[_0x9007('0x3b')];_0x32840c+=0x1){_0x294315=_0xbb4d15[_0x32840c][_0x9007('0x74')]?_0x367db6[_0xbb4d15[_0x32840c][_0x9007('0x74')]][_0x9007('0x75')]:_0xbb4d15[_0x32840c][_0x9007('0x69')];_0x294315=_0xbb4d15[_0x32840c][_0x9007('0x77')]?_[_0x9007('0x76')](_0x2ce573[_0xbb4d15[_0x32840c][_0x9007('0x77')]],'%s',_0x294315):_0x294315;_0x294315=_0xbb4d15[_0x32840c][_0x9007('0x78')]?_[_0x9007('0x76')](_0xd9fe03[_0xbb4d15[_0x32840c]['format']],'%s',_0x294315):_0x294315;if(_0xbb4d15[_0x32840c][_0x9007('0x79')]){_0x422c93[_0x9007('0x68')](_0x294315);}_0xbb4d15[_0x32840c][_0x9007('0x7a')]&&_0x422c93[_0x9007('0x3e')](_0x294315,_0xbb4d15[_0x32840c][_0x9007('0x7a')]===_0x9007('0x7b')?![]:!![]);_0x422c93[_0x9007('0x69')](_0x294315,_0xbb4d15[_0x32840c]['alias']||_0x294315);}if(_0x8ee6b3['joins']){_0x8ee6b3[_0x9007('0x7d')]=JSON['parse'](_0x8ee6b3[_0x9007('0x7d')]);for(var _0x37d7cb=0x0;_0x37d7cb<_0x8ee6b3[_0x9007('0x7d')][_0x9007('0x3b')];_0x37d7cb+=0x1){if(_0x8ee6b3['joins'][_0x37d7cb]['type']&&_[_0x9007('0x62')](_0x2d694c,_0x8ee6b3['joins'][_0x37d7cb][_0x9007('0x32')])&&_0x8ee6b3[_0x9007('0x7d')][_0x37d7cb][_0x9007('0x81')]&&_0x8ee6b3['joins'][_0x37d7cb][_0x9007('0x7f')]&&_0x8ee6b3['joins'][_0x37d7cb][_0x9007('0x80')]){_0x422c93[_0x8ee6b3['joins'][_0x37d7cb]['type']](_0x8ee6b3[_0x9007('0x7d')][_0x37d7cb][_0x9007('0x7f')],null,util[_0x9007('0x78')](_0x9007('0x90'),_0x8ee6b3[_0x9007('0x73')],_0x8ee6b3['joins'][_0x37d7cb][_0x9007('0x81')],_0x8ee6b3[_0x9007('0x7d')][_0x37d7cb][_0x9007('0x7f')],_0x8ee6b3['joins'][_0x37d7cb]['foreignKey']));}}}if(_0x8ee6b3[_0x9007('0x82')]){_0x8ee6b3[_0x9007('0x82')]=JSON[_0x9007('0x7e')](_0x8ee6b3['conditions']);_0x422c93[_0x9007('0x40')](_0x2d9d00(_0x8ee6b3[_0x9007('0x82')][_0x9007('0x68')]));}_0x48ee83=_0x422c93['clone']();_0x422c93[_0x9007('0x1f')](_0x10e285);_0x422c93[_0x9007('0x1d')](0x0);return;}})[_0x9007('0x26')](function(){if(_0x3dcbb4['output']===_0x9007('0x91')){return null;}var _0x4880a8=_[_0x9007('0x43')](_0x3dcbb4,{'name':_0x3dcbb4['fullPath']||_0x3dcbb4[_0x9007('0x2d')]||_0x8ee6b3['name'],'basename':_0xa13a34,'savename':util[_0x9007('0x78')](_0x9007('0x92'),_0x3dcbb4[_0x9007('0x2d')]||_0x8ee6b3[_0x9007('0x2d')],require('randomstring')[_0x9007('0x93')](0x4),_0x3dcbb4[_0x9007('0x94')]||_0x9007('0x95')),'reportId':_0x8ee6b3['id'],'reportType':_0x9007('0x96')});return db[_0x9007('0x97')][_0x9007('0x4f')](_0x4880a8,{'raw':!![]});})['then'](function(_0x247b0d){if(_0x8ee6b3['table']===_0x9007('0x98')){_0x48ee83['where'](_0x8ee6b3[_0x9007('0x73')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x3dcbb4[_0x9007('0x99')],_0x3dcbb4[_0x9007('0x9a')]);}else{_0x48ee83['where'](_0x8ee6b3['table']+_0x9007('0x9b'),_0x3dcbb4[_0x9007('0x99')],_0x3dcbb4['endDate']);}if(_0x247b0d){logger['info'](_0x9007('0x9c'),_0x48ee83[_0x9007('0x85')]());require(_0x9007('0x9d'))[_0x9007('0x9e')](path['join'](__dirname,_0x9007('0x9f'),_0x247b0d[_0x9007('0x94')]),[_0x247b0d['id'],_0x48ee83[_0x9007('0x85')](),path['join'](__dirname,_0x9007('0xa0'),_0x247b0d[_0x9007('0xa1')]),_0xa13a34]);return _0x247b0d;}else{var _0x2d6574=squel[_0x9007('0x71')]();_0x2d6574[_0x9007('0x72')]('('+_0x48ee83['toString']()+')',_0x9007('0xa2'));_0x2d6574['field'](_0x9007('0xa3'),_0x9007('0x20'));_0x48ee83['limit'](_0x3dcbb4[_0x9007('0x1f')]||_0x10e285);_0x48ee83['offset'](_0x3dcbb4[_0x9007('0x1d')]||0x0);return dbH['sequelize'][_0x9007('0x36')](_0x2d6574['toString'](),{'type':dbH[_0x9007('0x86')]['QueryTypes']['SELECT']})['then'](function(_0x22f87e){if(!_0x22f87e[_0x9007('0x3b')]){_0x4184f8=0x0;}else{_0x4184f8=_0x22f87e[0x0][_0x9007('0x20')]||0x0;}return dbH[_0x9007('0x86')][_0x9007('0x36')](_0x48ee83[_0x9007('0x85')](),{'type':dbH[_0x9007('0x86')][_0x9007('0x87')][_0x9007('0xa4')]});})[_0x9007('0x26')](function(_0x3bcafa){return{'rows':_0x3bcafa||[],'count':_0x4184f8};});}});}exports[_0x9007('0xa5')]=function(_0x2b6a84,_0x3befc6){return runReport(_0x2b6a84[_0x9007('0x4a')],_0x2b6a84[_0x9007('0x36')],_0x2b6a84[_0x9007('0x4d')])[_0x9007('0x26')](respondWithResult(_0x3befc6,null))[_0x9007('0x48')](handleError(_0x3befc6,null));};exports[_0x9007('0xa6')]=runReport;exports[_0x9007('0x36')]=function(_0x288986,_0x21df81){var _0x364f6b=0xa;var _0x4b9412=['join',_0x9007('0x88'),_0x9007('0x89'),_0x9007('0x59')];var _0x3cc46b={'SUM':_0x9007('0x5a'),'COUNT':_0x9007('0x8a'),'COUNT DISTINCT':_0x9007('0x5b'),'MAX':_0x9007('0x8b'),'MIN':'MIN(%s)','AVG':_0x9007('0x5c'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x9007('0x5e'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x280640={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0x9007('0x8d'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x9007('0x61')};var _0x2063f0=function(_0x3597fd){return!_[_0x9007('0x62')](['IS\x20NULL',_0x9007('0x64'),'IS\x20EMPTY',_0x9007('0x8e')],_0x3597fd);};var _0x18313a=function(_0xd35045){if(!_0xd35045||!_0xd35045[_0x9007('0x66')][_0x9007('0x3b')]){return'';}for(var _0x355a56='(',_0x148923=0x0;_0x148923<_0xd35045[_0x9007('0x66')][_0x9007('0x3b')];_0x148923+=0x1){_0x148923>0x0&&(_0x355a56+='\x20'+_0xd35045['operator']+'\x20');_0x355a56+=_0xd35045[_0x9007('0x66')][_0x148923][_0x9007('0x68')]?_0x18313a(_0xd35045[_0x9007('0x66')][_0x148923][_0x9007('0x68')]):_0xd35045[_0x9007('0x66')][_0x148923][_0x9007('0x69')]+'\x20'+_0xd35045['rules'][_0x148923][_0x9007('0x6a')]+(_0x2063f0(_0xd35045[_0x9007('0x66')][_0x148923][_0x9007('0x6a')])?'\x20'+_0xd35045['rules'][_0x148923]['value']:'');}return _0x355a56+')';};var _0x944976={'where':{'id':_0x288986[_0x9007('0x4a')]['id']}},_0x5ef233,_0xd688a1,_0x3d51b7,_0x5ba36c,_0x5e4087;_0x944976=_[_0x9007('0x43')]({},_0x944976,_0x288986[_0x9007('0x4d')]);return db['AnalyticCustomReport'][_0x9007('0x4e')](_0x944976)[_0x9007('0x26')](function(_0x3f78b2){if(_0x3f78b2){_0x5ef233=_0x3f78b2;return _0x3f78b2[_0x9007('0x6c')]();}return null;})[_0x9007('0x26')](function(_0x564172){if(_0x564172){if(!_0x564172[_0x9007('0x3b')]){throw new db[(_0x9007('0x6d'))][(_0x9007('0x6e'))](_0x9007('0x6f'),0x193);}_0xd688a1=_0x564172;return db[_0x9007('0x70')][_0x9007('0x46')]({'raw':!![]});}return null;})[_0x9007('0x26')](function(_0x4b43d5){if(_0x4b43d5){_0x3d51b7=_[_0x9007('0x8f')](_0x4b43d5,'id');var _0x375e91;var _0x26e0dd=squel['select']();_0x26e0dd[_0x9007('0x72')](_0x5ef233['table']);for(var _0x510728=0x0;_0x510728<_0xd688a1[_0x9007('0x3b')];_0x510728+=0x1){_0x375e91=_0xd688a1[_0x510728][_0x9007('0x74')]?_0x3d51b7[_0xd688a1[_0x510728][_0x9007('0x74')]][_0x9007('0x75')]:_0xd688a1[_0x510728][_0x9007('0x69')];_0x375e91=_0xd688a1[_0x510728][_0x9007('0x77')]?_[_0x9007('0x76')](_0x3cc46b[_0xd688a1[_0x510728][_0x9007('0x77')]],'%s',_0x375e91):_0x375e91;_0x375e91=_0xd688a1[_0x510728][_0x9007('0x78')]?_[_0x9007('0x76')](_0x280640[_0xd688a1[_0x510728]['format']],'%s',_0x375e91):_0x375e91;if(_0xd688a1[_0x510728][_0x9007('0x79')]){_0x26e0dd[_0x9007('0x68')](_0x375e91);}_0xd688a1[_0x510728][_0x9007('0x7a')]&&_0x26e0dd['order'](_0x375e91,_0xd688a1[_0x510728][_0x9007('0x7a')]===_0x9007('0x7b')?![]:!![]);_0x26e0dd[_0x9007('0x69')](_0x375e91,_0xd688a1[_0x510728]['alias']||_0x375e91);}if(_0x5ef233[_0x9007('0x7d')]){_0x5ef233[_0x9007('0x7d')]=JSON[_0x9007('0x7e')](_0x5ef233['joins']);for(var _0x4ae579=0x0;_0x4ae579<_0x5ef233[_0x9007('0x7d')][_0x9007('0x3b')];_0x4ae579+=0x1){if(_0x5ef233[_0x9007('0x7d')][_0x4ae579][_0x9007('0x32')]&&_[_0x9007('0x62')](_0x4b9412,_0x5ef233[_0x9007('0x7d')][_0x4ae579][_0x9007('0x32')])&&_0x5ef233['joins'][_0x4ae579][_0x9007('0x81')]&&_0x5ef233[_0x9007('0x7d')][_0x4ae579]['foreignTable']&&_0x5ef233[_0x9007('0x7d')][_0x4ae579][_0x9007('0x80')]){_0x26e0dd[_0x5ef233[_0x9007('0x7d')][_0x4ae579][_0x9007('0x32')]](_0x5ef233['joins'][_0x4ae579]['foreignTable'],null,util[_0x9007('0x78')](_0x9007('0x90'),_0x5ef233[_0x9007('0x73')],_0x5ef233[_0x9007('0x7d')][_0x4ae579][_0x9007('0x81')],_0x5ef233[_0x9007('0x7d')][_0x4ae579]['foreignTable'],_0x5ef233[_0x9007('0x7d')][_0x4ae579][_0x9007('0x80')]));}}}if(_0x5ef233[_0x9007('0x82')]){_0x5ef233[_0x9007('0x82')]=JSON[_0x9007('0x7e')](_0x5ef233[_0x9007('0x82')]);_0x26e0dd[_0x9007('0x40')](_0x18313a(_0x5ef233[_0x9007('0x82')][_0x9007('0x68')]));}_0x5e4087=_0x26e0dd[_0x9007('0x83')]();_0x26e0dd['limit'](_0x364f6b);_0x26e0dd[_0x9007('0x1d')](0x0);logger[_0x9007('0x84')](_0x9007('0xa7'),_0x26e0dd['toString']());return dbH['sequelize'][_0x9007('0x36')](_0x26e0dd['toString'](),{'type':dbH[_0x9007('0x86')][_0x9007('0x87')][_0x9007('0xa4')]});}})['then'](function(){return{'sql':_0x5e4087[_0x9007('0x85')]()};})[_0x9007('0x26')](respondWithResult(_0x21df81,null))['catch'](handleError(_0x21df81,null));}; \ No newline at end of file +var _0xafb7=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Reports','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','join','left_join','right_join','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','cross_join','SUM(%s)','COUNT(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','HOUR(%s)','getFields','Sequelize','parse','output','%s-%s.%s','randomstring','csv','custom','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','Run\x20Query:','child_process','fork','savename','countTable','runReport','debug','eml-format','rimraf','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','get','CustomReports','UserProfileResource','error','stack','name','send','index','AnalyticCustomReport','fieldName','type','model','map','query','keys','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','create','body'];(function(_0x5569ce,_0x2b9554){var _0x5a31a0=function(_0x2931ab){while(--_0x2931ab){_0x5569ce['push'](_0x5569ce['shift']());}};_0x5a31a0(++_0x2b9554);}(_0xafb7,0x19a));var _0x7afb=function(_0x3bad8e,_0x1105b8){_0x3bad8e=_0x3bad8e-0x0;var _0x182495=_0xafb7[_0x3bad8e];return _0x182495;};'use strict';var emlformat=require(_0x7afb('0x0'));var rimraf=require(_0x7afb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7afb('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7afb('0x3'));var util=require(_0x7afb('0x4'));var path=require(_0x7afb('0x5'));var sox=require(_0x7afb('0x6'));var csv=require(_0x7afb('0x7'));var ejs=require(_0x7afb('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7afb('0x9'));var squel=require('squel');var crypto=require(_0x7afb('0xa'));var jsforce=require(_0x7afb('0xb'));var deskjs=require(_0x7afb('0xc'));var toCsv=require(_0x7afb('0x7'));var querystring=require(_0x7afb('0xd'));var Papa=require(_0x7afb('0xe'));var Redis=require('ioredis');var authService=require(_0x7afb('0xf'));var qs=require(_0x7afb('0x10'));var as=require(_0x7afb('0x11'));var hardwareService=require(_0x7afb('0x12'));var logger=require('../../config/logger')(_0x7afb('0x13'));var utils=require(_0x7afb('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x7afb('0x15'));var db=require('../../mysqldb')['db'];var dbH=require(_0x7afb('0x16'))[_0x7afb('0x17')];function respondWithStatusCode(_0xa0cdff,_0x52fd36){_0x52fd36=_0x52fd36||0xcc;return function(_0x328139){if(_0x328139){return _0xa0cdff[_0x7afb('0x18')](_0x52fd36);}return _0xa0cdff[_0x7afb('0x19')](_0x52fd36)[_0x7afb('0x1a')]();};}function respondWithResult(_0x44505a,_0x1309b5){_0x1309b5=_0x1309b5||0xc8;return function(_0x4fd0b1){if(_0x4fd0b1){return _0x44505a['status'](_0x1309b5)[_0x7afb('0x1b')](_0x4fd0b1);}};}function respondWithFilteredResult(_0x3ff984,_0x19dea8){return function(_0x4a4f46){if(_0x4a4f46){var _0x4beddd=typeof _0x19dea8[_0x7afb('0x1c')]===_0x7afb('0x1d')&&typeof _0x19dea8[_0x7afb('0x1e')]===_0x7afb('0x1d');var _0x11a008=_0x4a4f46[_0x7afb('0x1f')];var _0x36c8b8=_0x4beddd?0x0:_0x19dea8[_0x7afb('0x1c')];var _0x33d162=_0x4beddd?_0x4a4f46[_0x7afb('0x1f')]:_0x19dea8[_0x7afb('0x1c')]+_0x19dea8['limit'];var _0x1830b9;if(_0x33d162>=_0x11a008){_0x33d162=_0x11a008;_0x1830b9=0xc8;}else{_0x1830b9=0xce;}_0x3ff984['status'](_0x1830b9);return _0x3ff984[_0x7afb('0x20')](_0x7afb('0x21'),_0x36c8b8+'-'+_0x33d162+'/'+_0x11a008)['json'](_0x4a4f46);}return null;};}function patchUpdates(_0x5554a6){return function(_0x5b075b){try{jsonpatch[_0x7afb('0x22')](_0x5b075b,_0x5554a6,!![]);}catch(_0x698ad5){return BPromise[_0x7afb('0x23')](_0x698ad5);}return _0x5b075b[_0x7afb('0x24')]();};}function saveUpdates(_0x35c039,_0x2bad55){return function(_0x479d5c){if(_0x479d5c){return _0x479d5c['update'](_0x35c039)['then'](function(_0x3f47b1){return _0x3f47b1;});}return null;};}function removeEntity(_0x2a0ab8,_0x224239){return function(_0x183483){if(_0x183483){return _0x183483[_0x7afb('0x25')]()[_0x7afb('0x26')](function(){var _0x3f46d8=_0x183483[_0x7afb('0x27')]({'plain':!![]});var _0x46acac=_0x7afb('0x28');return db[_0x7afb('0x29')]['destroy']({'where':{'type':_0x46acac,'resourceId':_0x3f46d8['id']}})['then'](function(){return _0x183483;});})[_0x7afb('0x26')](function(){_0x2a0ab8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x31c9bd,_0x227c2c){return function(_0x5e047c){if(!_0x5e047c){_0x31c9bd[_0x7afb('0x18')](0x194);}return _0x5e047c;};}function handleError(_0x119e22,_0x5339fa){_0x5339fa=_0x5339fa||0x1f4;return function(_0xe7c78e){logger[_0x7afb('0x2a')](_0xe7c78e[_0x7afb('0x2b')]);if(_0xe7c78e['name']){delete _0xe7c78e[_0x7afb('0x2c')];}_0x119e22[_0x7afb('0x19')](_0x5339fa)[_0x7afb('0x2d')](_0xe7c78e);};}exports[_0x7afb('0x2e')]=function(_0xda1d98,_0x2b2cfb){var _0xb39d07={},_0x12b378={},_0x24ce0e={'count':0x0,'rows':[]};var _0x3578d9=_['map'](db[_0x7afb('0x2f')]['rawAttributes'],function(_0x44e39c){return{'name':_0x44e39c[_0x7afb('0x30')],'type':_0x44e39c[_0x7afb('0x31')]['key']};});_0x12b378[_0x7afb('0x32')]=_[_0x7afb('0x33')](_0x3578d9,_0x7afb('0x2c'));_0x12b378[_0x7afb('0x34')]=_[_0x7afb('0x35')](_0xda1d98[_0x7afb('0x34')]);_0x12b378['filters']=_['intersection'](_0x12b378[_0x7afb('0x32')],_0x12b378['query']);_0xb39d07[_0x7afb('0x36')]=_[_0x7afb('0x37')](_0x12b378['model'],qs[_0x7afb('0x38')](_0xda1d98['query'][_0x7afb('0x38')]));_0xb39d07[_0x7afb('0x36')]=_0xb39d07[_0x7afb('0x36')][_0x7afb('0x39')]?_0xb39d07['attributes']:_0x12b378[_0x7afb('0x32')];if(!_0xda1d98[_0x7afb('0x34')][_0x7afb('0x3a')]('nolimit')){_0xb39d07['limit']=qs[_0x7afb('0x1e')](_0xda1d98[_0x7afb('0x34')][_0x7afb('0x1e')]);_0xb39d07['offset']=qs['offset'](_0xda1d98[_0x7afb('0x34')][_0x7afb('0x1c')]);}_0xb39d07[_0x7afb('0x3b')]=qs[_0x7afb('0x3c')](_0xda1d98[_0x7afb('0x34')]['sort']);_0xb39d07[_0x7afb('0x3d')]=qs[_0x7afb('0x3e')](_['pick'](_0xda1d98['query'],_0x12b378[_0x7afb('0x3e')]),_0x3578d9);if(_0xda1d98[_0x7afb('0x34')]['filter']){_0xb39d07['where']=_[_0x7afb('0x3f')](_0xb39d07[_0x7afb('0x3d')],{'$or':_[_0x7afb('0x33')](_0x3578d9,function(_0x1686dd){if(_0x1686dd['type']!==_0x7afb('0x40')){var _0x363ae6={};_0x363ae6[_0x1686dd[_0x7afb('0x2c')]]={'$like':'%'+_0xda1d98['query']['filter']+'%'};return _0x363ae6;}})});}_0xb39d07=_[_0x7afb('0x3f')]({},_0xb39d07,_0xda1d98['options']);var _0x5d5ce8={'where':_0xb39d07[_0x7afb('0x3d')]};return db['AnalyticCustomReport'][_0x7afb('0x1f')](_0x5d5ce8)['then'](function(_0x4baf45){_0x24ce0e[_0x7afb('0x1f')]=_0x4baf45;if(_0xda1d98[_0x7afb('0x34')][_0x7afb('0x41')]){_0xb39d07[_0x7afb('0x42')]=[{'all':!![]}];}return db['AnalyticCustomReport'][_0x7afb('0x43')](_0xb39d07);})['then'](function(_0x5d2765){_0x24ce0e[_0x7afb('0x44')]=_0x5d2765;return _0x24ce0e;})[_0x7afb('0x26')](respondWithFilteredResult(_0x2b2cfb,_0xb39d07))[_0x7afb('0x45')](handleError(_0x2b2cfb,null));};exports[_0x7afb('0x46')]=function(_0x1250d9,_0xdb3411){var _0x50c316={'raw':![],'where':{'id':_0x1250d9[_0x7afb('0x47')]['id']}},_0x3b3bec={};_0x3b3bec[_0x7afb('0x32')]=_[_0x7afb('0x35')](db[_0x7afb('0x2f')][_0x7afb('0x48')]);_0x3b3bec[_0x7afb('0x34')]=_['keys'](_0x1250d9[_0x7afb('0x34')]);_0x3b3bec[_0x7afb('0x3e')]=_[_0x7afb('0x37')](_0x3b3bec[_0x7afb('0x32')],_0x3b3bec['query']);_0x50c316['attributes']=_[_0x7afb('0x37')](_0x3b3bec[_0x7afb('0x32')],qs[_0x7afb('0x38')](_0x1250d9[_0x7afb('0x34')][_0x7afb('0x38')]));_0x50c316[_0x7afb('0x36')]=_0x50c316[_0x7afb('0x36')][_0x7afb('0x39')]?_0x50c316[_0x7afb('0x36')]:_0x3b3bec[_0x7afb('0x32')];if(_0x1250d9[_0x7afb('0x34')][_0x7afb('0x41')]){_0x50c316['include']=[{'all':!![]}];}_0x50c316=_[_0x7afb('0x3f')]({},_0x50c316,_0x1250d9[_0x7afb('0x49')]);return db[_0x7afb('0x2f')]['find'](_0x50c316)[_0x7afb('0x26')](handleEntityNotFound(_0xdb3411,null))[_0x7afb('0x26')](respondWithResult(_0xdb3411,null))['catch'](handleError(_0xdb3411,null));};exports['create']=function(_0x34185b,_0x25f7d4){return db['AnalyticCustomReport'][_0x7afb('0x4a')](_0x34185b[_0x7afb('0x4b')],{})[_0x7afb('0x26')](function(_0x3af4ff){var _0x434aac=_0x34185b['user'][_0x7afb('0x27')]({'plain':!![]});if(!_0x434aac)throw new Error(_0x7afb('0x4c'));if(_0x434aac[_0x7afb('0x4d')]===_0x7afb('0x4e')){var _0x1d2ff3=_0x3af4ff[_0x7afb('0x27')]({'plain':!![]});var _0xae136d=_0x7afb('0x4f');return db[_0x7afb('0x50')][_0x7afb('0x51')]({'where':{'name':_0xae136d,'userProfileId':_0x434aac[_0x7afb('0x52')]},'raw':!![]})[_0x7afb('0x26')](function(_0x163d10){if(_0x163d10&&_0x163d10[_0x7afb('0x53')]===0x0){return db[_0x7afb('0x29')][_0x7afb('0x4a')]({'name':_0x1d2ff3[_0x7afb('0x2c')],'resourceId':_0x1d2ff3['id'],'type':_0x7afb('0x28'),'sectionId':_0x163d10['id']},{})[_0x7afb('0x26')](function(){return _0x3af4ff;});}else{return _0x3af4ff;}})[_0x7afb('0x45')](function(_0xeb94f5){logger['error'](_0x7afb('0x54'),_0xeb94f5);throw _0xeb94f5;});}return _0x3af4ff;})[_0x7afb('0x26')](respondWithResult(_0x25f7d4,0xc9))[_0x7afb('0x45')](handleError(_0x25f7d4,null));};exports[_0x7afb('0x55')]=function(_0x3b37f4,_0x94a227){if(_0x3b37f4['body']['id']){delete _0x3b37f4[_0x7afb('0x4b')]['id'];}return db['AnalyticCustomReport'][_0x7afb('0x51')]({'where':{'id':_0x3b37f4['params']['id']}})[_0x7afb('0x26')](handleEntityNotFound(_0x94a227,null))['then'](saveUpdates(_0x3b37f4[_0x7afb('0x4b')],null))['then'](respondWithResult(_0x94a227,null))[_0x7afb('0x45')](handleError(_0x94a227,null));};exports['destroy']=function(_0x23faff,_0x2e907c){return db[_0x7afb('0x2f')][_0x7afb('0x51')]({'where':{'id':_0x23faff[_0x7afb('0x47')]['id']}})[_0x7afb('0x26')](handleEntityNotFound(_0x2e907c,null))[_0x7afb('0x26')](removeEntity(_0x2e907c,null))[_0x7afb('0x45')](handleError(_0x2e907c,null));};exports['preview']=function(_0x4b828d,_0x3a882e){var _0x514725=0xa;var _0x9df32e=[_0x7afb('0x56'),_0x7afb('0x57'),_0x7afb('0x58'),'cross_join'];var _0x2206ec={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x7afb('0x59'),'MAX':_0x7afb('0x5a'),'MIN':_0x7afb('0x5b'),'AVG':_0x7afb('0x5c'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x7afb('0x5d'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x38bde9={'SEC_TO_TIME':_0x7afb('0x5e'),'DATE':_0x7afb('0x5f'),'HOUR':'HOUR(%s)','ROUND':_0x7afb('0x60'),'UNIX_TIMESTAMP':_0x7afb('0x61')};var _0xa65cc7=function(_0x50ec09){return!_[_0x7afb('0x62')]([_0x7afb('0x63'),_0x7afb('0x64'),_0x7afb('0x65'),_0x7afb('0x66')],_0x50ec09);};var _0x44b4dc=function(_0x4c6139){if(!_0x4c6139||!_0x4c6139[_0x7afb('0x67')][_0x7afb('0x39')]){return'';}for(var _0x2fe5fc='(',_0xb6c167=0x0;_0xb6c167<_0x4c6139[_0x7afb('0x67')]['length'];_0xb6c167+=0x1){_0xb6c167>0x0&&(_0x2fe5fc+='\x20'+_0x4c6139[_0x7afb('0x68')]+'\x20');_0x2fe5fc+=_0x4c6139['rules'][_0xb6c167][_0x7afb('0x69')]?_0x44b4dc(_0x4c6139[_0x7afb('0x67')][_0xb6c167][_0x7afb('0x69')]):_0x4c6139[_0x7afb('0x67')][_0xb6c167][_0x7afb('0x6a')]+'\x20'+_0x4c6139[_0x7afb('0x67')][_0xb6c167][_0x7afb('0x6b')]+(_0xa65cc7(_0x4c6139[_0x7afb('0x67')][_0xb6c167]['condition'])?'\x20'+_0x4c6139['rules'][_0xb6c167][_0x7afb('0x6c')]:'');}return _0x2fe5fc+')';};var _0x47ba72={'where':{'id':_0x4b828d[_0x7afb('0x47')]['id']}},_0x548327,_0x1c7b06,_0x3168b0,_0x205982,_0x39030d;_0x47ba72=_['merge']({},_0x47ba72,_0x4b828d['options']);return db[_0x7afb('0x2f')][_0x7afb('0x51')](_0x47ba72)[_0x7afb('0x26')](function(_0x3f4bcd){if(_0x3f4bcd){_0x548327=_0x3f4bcd;return _0x3f4bcd['getFields']();}return null;})[_0x7afb('0x26')](function(_0x5383bc){if(_0x5383bc){if(!_0x5383bc[_0x7afb('0x39')]){throw new db['Sequelize'][(_0x7afb('0x6d'))](_0x7afb('0x6e'),0x193);}_0x1c7b06=_0x5383bc;return db[_0x7afb('0x6f')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x459132){if(_0x459132){_0x3168b0=_[_0x7afb('0x70')](_0x459132,'id');var _0x3f0498;var _0x39bd67=squel[_0x7afb('0x71')]();_0x39bd67[_0x7afb('0x72')](_0x548327[_0x7afb('0x73')]);for(var _0x2bcb74=0x0;_0x2bcb74<_0x1c7b06[_0x7afb('0x39')];_0x2bcb74+=0x1){_0x3f0498=_0x1c7b06[_0x2bcb74][_0x7afb('0x74')]?_0x3168b0[_0x1c7b06[_0x2bcb74][_0x7afb('0x74')]][_0x7afb('0x75')]:_0x1c7b06[_0x2bcb74]['field'];_0x3f0498=_0x1c7b06[_0x2bcb74][_0x7afb('0x76')]?_[_0x7afb('0x77')](_0x2206ec[_0x1c7b06[_0x2bcb74]['function']],'%s',_0x3f0498):_0x3f0498;_0x3f0498=_0x1c7b06[_0x2bcb74]['format']?_[_0x7afb('0x77')](_0x38bde9[_0x1c7b06[_0x2bcb74][_0x7afb('0x78')]],'%s',_0x3f0498):_0x3f0498;if(_0x1c7b06[_0x2bcb74][_0x7afb('0x79')]){_0x39bd67[_0x7afb('0x69')](_0x3f0498);}_0x1c7b06[_0x2bcb74][_0x7afb('0x7a')]&&_0x39bd67['order'](_0x3f0498,_0x1c7b06[_0x2bcb74][_0x7afb('0x7a')]===_0x7afb('0x7b')?![]:!![]);_0x39bd67[_0x7afb('0x6a')](_0x3f0498,_0x1c7b06[_0x2bcb74][_0x7afb('0x7c')]||_0x3f0498);}if(_0x548327[_0x7afb('0x7d')]){_0x548327[_0x7afb('0x7d')]=JSON['parse'](_0x548327['joins']);for(var _0x371bc8=0x0;_0x371bc8<_0x548327[_0x7afb('0x7d')][_0x7afb('0x39')];_0x371bc8+=0x1){if(_0x548327[_0x7afb('0x7d')][_0x371bc8][_0x7afb('0x31')]&&_['includes'](_0x9df32e,_0x548327[_0x7afb('0x7d')][_0x371bc8][_0x7afb('0x31')])&&_0x548327['joins'][_0x371bc8][_0x7afb('0x7e')]&&_0x548327[_0x7afb('0x7d')][_0x371bc8][_0x7afb('0x7f')]&&_0x548327[_0x7afb('0x7d')][_0x371bc8][_0x7afb('0x80')]){_0x39bd67[_0x548327[_0x7afb('0x7d')][_0x371bc8][_0x7afb('0x31')]](_0x548327['joins'][_0x371bc8][_0x7afb('0x7f')],null,util[_0x7afb('0x78')](_0x7afb('0x81'),_0x548327[_0x7afb('0x73')],_0x548327[_0x7afb('0x7d')][_0x371bc8][_0x7afb('0x7e')],_0x548327[_0x7afb('0x7d')][_0x371bc8][_0x7afb('0x7f')],_0x548327[_0x7afb('0x7d')][_0x371bc8][_0x7afb('0x80')]));}}}if(_0x548327[_0x7afb('0x82')]){_0x548327[_0x7afb('0x82')]=JSON['parse'](_0x548327[_0x7afb('0x82')]);_0x39bd67['where'](_0x44b4dc(_0x548327[_0x7afb('0x82')][_0x7afb('0x69')]));}_0x39030d=_0x39bd67[_0x7afb('0x83')]();_0x39bd67[_0x7afb('0x1e')](_0x514725);_0x39bd67[_0x7afb('0x1c')](0x0);logger['debug'](_0x7afb('0x84'),_0x39bd67[_0x7afb('0x85')]());return dbH[_0x7afb('0x86')][_0x7afb('0x34')](_0x39bd67[_0x7afb('0x85')](),{'type':dbH[_0x7afb('0x86')][_0x7afb('0x87')][_0x7afb('0x88')]});}})['then'](respondWithResult(_0x3a882e,null))[_0x7afb('0x45')](handleError(_0x3a882e,null));};function runReport(_0x1a58a7,_0x4025ec,_0x544ec2){var _0x1e1a13=_0x4025ec[_0x7afb('0x2c')];var _0x54d221=0xa;var _0x179a25=[_0x7afb('0x56'),'left_join',_0x7afb('0x58'),_0x7afb('0x89')];var _0x4e4a51={'SUM':_0x7afb('0x8a'),'COUNT':_0x7afb('0x8b'),'COUNT DISTINCT':_0x7afb('0x59'),'MAX':_0x7afb('0x5a'),'MIN':_0x7afb('0x5b'),'AVG':_0x7afb('0x5c'),'GROUP_CONCAT':_0x7afb('0x8c'),'GROUP_CONCAT ASC':_0x7afb('0x5d'),'GROUP_CONCAT DESC':_0x7afb('0x8d')};var _0x230724={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x7afb('0x5f'),'HOUR':_0x7afb('0x8e'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x7afb('0x61')};var _0x223407=function(_0x5f41de){return!_[_0x7afb('0x62')]([_0x7afb('0x63'),_0x7afb('0x64'),_0x7afb('0x65'),_0x7afb('0x66')],_0x5f41de);};var _0x343b57=function(_0x4c1dc8){if(!_0x4c1dc8||!_0x4c1dc8[_0x7afb('0x67')][_0x7afb('0x39')]){return'';}for(var _0x3d5efb='(',_0x14f281=0x0;_0x14f281<_0x4c1dc8['rules'][_0x7afb('0x39')];_0x14f281+=0x1){_0x14f281>0x0&&(_0x3d5efb+='\x20'+_0x4c1dc8[_0x7afb('0x68')]+'\x20');_0x3d5efb+=_0x4c1dc8[_0x7afb('0x67')][_0x14f281]['group']?_0x343b57(_0x4c1dc8[_0x7afb('0x67')][_0x14f281][_0x7afb('0x69')]):_0x4c1dc8[_0x7afb('0x67')][_0x14f281][_0x7afb('0x6a')]+'\x20'+_0x4c1dc8[_0x7afb('0x67')][_0x14f281]['condition']+(_0x223407(_0x4c1dc8['rules'][_0x14f281][_0x7afb('0x6b')])?'\x20'+_0x4c1dc8[_0x7afb('0x67')][_0x14f281][_0x7afb('0x6c')]:'');}return _0x3d5efb+')';};var _0x2a08ee={'where':{'id':_0x1a58a7['id']}},_0x40bb7f,_0x28c8ae,_0x91c490,_0x2af096,_0x1301f1;_0x2a08ee=_[_0x7afb('0x3f')]({},_0x2a08ee,_0x544ec2);return db['AnalyticCustomReport'][_0x7afb('0x51')](_0x2a08ee)[_0x7afb('0x26')](function(_0x36933a){if(_0x36933a){_0x40bb7f=_0x36933a;return _0x36933a[_0x7afb('0x8f')]();}return null;})[_0x7afb('0x26')](function(_0x2cba3a){if(_0x2cba3a){if(!_0x2cba3a[_0x7afb('0x39')]){throw new db[(_0x7afb('0x90'))][(_0x7afb('0x6d'))](_0x7afb('0x6e'),0x193);}_0x28c8ae=_0x2cba3a;return db['AnalyticMetric'][_0x7afb('0x43')]({'raw':!![]});}return null;})[_0x7afb('0x26')](function(_0x4b13ff){if(_0x4b13ff){_0x91c490=_[_0x7afb('0x70')](_0x4b13ff,'id');var _0x334bde;var _0x1114ab=squel[_0x7afb('0x71')]();_0x1114ab[_0x7afb('0x72')](_0x40bb7f[_0x7afb('0x73')]);for(var _0x43d333=0x0;_0x43d333<_0x28c8ae[_0x7afb('0x39')];_0x43d333+=0x1){_0x334bde=_0x28c8ae[_0x43d333][_0x7afb('0x74')]?_0x91c490[_0x28c8ae[_0x43d333][_0x7afb('0x74')]][_0x7afb('0x75')]:_0x28c8ae[_0x43d333][_0x7afb('0x6a')];_0x334bde=_0x28c8ae[_0x43d333]['function']?_[_0x7afb('0x77')](_0x4e4a51[_0x28c8ae[_0x43d333][_0x7afb('0x76')]],'%s',_0x334bde):_0x334bde;_0x334bde=_0x28c8ae[_0x43d333][_0x7afb('0x78')]?_['replace'](_0x230724[_0x28c8ae[_0x43d333][_0x7afb('0x78')]],'%s',_0x334bde):_0x334bde;if(_0x28c8ae[_0x43d333][_0x7afb('0x79')]){_0x1114ab['group'](_0x334bde);}_0x28c8ae[_0x43d333]['orderBy']&&_0x1114ab[_0x7afb('0x3b')](_0x334bde,_0x28c8ae[_0x43d333][_0x7afb('0x7a')]===_0x7afb('0x7b')?![]:!![]);_0x1114ab[_0x7afb('0x6a')](_0x334bde,_0x28c8ae[_0x43d333][_0x7afb('0x7c')]||_0x334bde);}if(_0x40bb7f['joins']){_0x40bb7f[_0x7afb('0x7d')]=JSON[_0x7afb('0x91')](_0x40bb7f[_0x7afb('0x7d')]);for(var _0x157980=0x0;_0x157980<_0x40bb7f['joins'][_0x7afb('0x39')];_0x157980+=0x1){if(_0x40bb7f[_0x7afb('0x7d')][_0x157980][_0x7afb('0x31')]&&_[_0x7afb('0x62')](_0x179a25,_0x40bb7f[_0x7afb('0x7d')][_0x157980][_0x7afb('0x31')])&&_0x40bb7f[_0x7afb('0x7d')][_0x157980][_0x7afb('0x7e')]&&_0x40bb7f[_0x7afb('0x7d')][_0x157980][_0x7afb('0x7f')]&&_0x40bb7f['joins'][_0x157980][_0x7afb('0x80')]){_0x1114ab[_0x40bb7f['joins'][_0x157980]['type']](_0x40bb7f[_0x7afb('0x7d')][_0x157980]['foreignTable'],null,util[_0x7afb('0x78')]('%s.%s\x20=\x20%s.%s',_0x40bb7f['table'],_0x40bb7f[_0x7afb('0x7d')][_0x157980][_0x7afb('0x7e')],_0x40bb7f[_0x7afb('0x7d')][_0x157980][_0x7afb('0x7f')],_0x40bb7f[_0x7afb('0x7d')][_0x157980][_0x7afb('0x80')]));}}}if(_0x40bb7f[_0x7afb('0x82')]){_0x40bb7f['conditions']=JSON[_0x7afb('0x91')](_0x40bb7f[_0x7afb('0x82')]);_0x1114ab[_0x7afb('0x3d')](_0x343b57(_0x40bb7f[_0x7afb('0x82')][_0x7afb('0x69')]));}_0x1301f1=_0x1114ab[_0x7afb('0x83')]();_0x1114ab[_0x7afb('0x1e')](_0x54d221);_0x1114ab[_0x7afb('0x1c')](0x0);return;}})[_0x7afb('0x26')](function(){if(_0x4025ec[_0x7afb('0x92')]==='web'){return null;}var _0x3a97f9=_[_0x7afb('0x3f')](_0x4025ec,{'name':_0x4025ec['fullPath']||_0x4025ec[_0x7afb('0x2c')]||_0x40bb7f[_0x7afb('0x2c')],'basename':_0x1e1a13,'savename':util[_0x7afb('0x78')](_0x7afb('0x93'),_0x4025ec[_0x7afb('0x2c')]||_0x40bb7f[_0x7afb('0x2c')],require(_0x7afb('0x94'))['generate'](0x4),_0x4025ec[_0x7afb('0x92')]||_0x7afb('0x95')),'reportId':_0x40bb7f['id'],'reportType':_0x7afb('0x96')});return db['AnalyticExtractedReport'][_0x7afb('0x4a')](_0x3a97f9,{'raw':!![]});})[_0x7afb('0x26')](function(_0x2cbfa8){if(_0x40bb7f['table']==='cdr'){_0x1301f1[_0x7afb('0x3d')](_0x40bb7f['table']+_0x7afb('0x97'),_0x4025ec[_0x7afb('0x98')],_0x4025ec['endDate']);}else{_0x1301f1['where'](_0x40bb7f[_0x7afb('0x73')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x4025ec['startDate'],_0x4025ec[_0x7afb('0x99')]);}if(_0x2cbfa8){logger[_0x7afb('0x9a')](_0x7afb('0x9b'),_0x1301f1[_0x7afb('0x85')]());require(_0x7afb('0x9c'))[_0x7afb('0x9d')](path[_0x7afb('0x56')](__dirname,'../../components/export/',_0x2cbfa8[_0x7afb('0x92')]),[_0x2cbfa8['id'],_0x1301f1[_0x7afb('0x85')](),path[_0x7afb('0x56')](__dirname,'../../files/reports',_0x2cbfa8[_0x7afb('0x9e')]),_0x1e1a13]);return _0x2cbfa8;}else{var _0x39f0ce=squel[_0x7afb('0x71')]();_0x39f0ce[_0x7afb('0x72')]('('+_0x1301f1[_0x7afb('0x85')]()+')',_0x7afb('0x9f'));_0x39f0ce[_0x7afb('0x6a')]('COUNT(*)','count');_0x1301f1[_0x7afb('0x1e')](_0x4025ec[_0x7afb('0x1e')]||_0x54d221);_0x1301f1[_0x7afb('0x1c')](_0x4025ec['offset']||0x0);return dbH['sequelize'][_0x7afb('0x34')](_0x39f0ce[_0x7afb('0x85')](),{'type':dbH[_0x7afb('0x86')][_0x7afb('0x87')][_0x7afb('0x88')]})[_0x7afb('0x26')](function(_0x4a136e){if(!_0x4a136e[_0x7afb('0x39')]){_0x2af096=0x0;}else{_0x2af096=_0x4a136e[0x0][_0x7afb('0x1f')]||0x0;}return dbH[_0x7afb('0x86')][_0x7afb('0x34')](_0x1301f1[_0x7afb('0x85')](),{'type':dbH[_0x7afb('0x86')][_0x7afb('0x87')]['SELECT']});})[_0x7afb('0x26')](function(_0x3898c5){return{'rows':_0x3898c5||[],'count':_0x2af096};});}});}exports['run']=function(_0xe723f4,_0x1d1699){return runReport(_0xe723f4[_0x7afb('0x47')],_0xe723f4['query'],_0xe723f4['options'])[_0x7afb('0x26')](respondWithResult(_0x1d1699,null))[_0x7afb('0x45')](handleError(_0x1d1699,null));};exports[_0x7afb('0xa0')]=runReport;exports[_0x7afb('0x34')]=function(_0x5dc5c9,_0x2e0fe5){var _0x15d3bf=0xa;var _0x563039=[_0x7afb('0x56'),'left_join',_0x7afb('0x58'),_0x7afb('0x89')];var _0x1d56d2={'SUM':'SUM(%s)','COUNT':_0x7afb('0x8b'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x7afb('0x5a'),'MIN':_0x7afb('0x5b'),'AVG':_0x7afb('0x5c'),'GROUP_CONCAT':_0x7afb('0x8c'),'GROUP_CONCAT ASC':_0x7afb('0x5d'),'GROUP_CONCAT DESC':_0x7afb('0x8d')};var _0x33123d={'SEC_TO_TIME':_0x7afb('0x5e'),'DATE':'DATE(%s)','HOUR':_0x7afb('0x8e'),'ROUND':_0x7afb('0x60'),'UNIX_TIMESTAMP':_0x7afb('0x61')};var _0x1290c1=function(_0x87bdfc){return!_['includes']([_0x7afb('0x63'),_0x7afb('0x64'),_0x7afb('0x65'),'IS\x20NOT\x20EMPTY'],_0x87bdfc);};var _0x2b31a4=function(_0x6379e9){if(!_0x6379e9||!_0x6379e9[_0x7afb('0x67')]['length']){return'';}for(var _0x1b0ed9='(',_0xd91650=0x0;_0xd91650<_0x6379e9['rules']['length'];_0xd91650+=0x1){_0xd91650>0x0&&(_0x1b0ed9+='\x20'+_0x6379e9[_0x7afb('0x68')]+'\x20');_0x1b0ed9+=_0x6379e9['rules'][_0xd91650][_0x7afb('0x69')]?_0x2b31a4(_0x6379e9['rules'][_0xd91650][_0x7afb('0x69')]):_0x6379e9[_0x7afb('0x67')][_0xd91650][_0x7afb('0x6a')]+'\x20'+_0x6379e9[_0x7afb('0x67')][_0xd91650][_0x7afb('0x6b')]+(_0x1290c1(_0x6379e9[_0x7afb('0x67')][_0xd91650]['condition'])?'\x20'+_0x6379e9['rules'][_0xd91650][_0x7afb('0x6c')]:'');}return _0x1b0ed9+')';};var _0x3f308e={'where':{'id':_0x5dc5c9['params']['id']}},_0x4503f8,_0x4675e6,_0x15779a,_0x31940d,_0x11c161;_0x3f308e=_['merge']({},_0x3f308e,_0x5dc5c9['options']);return db[_0x7afb('0x2f')][_0x7afb('0x51')](_0x3f308e)[_0x7afb('0x26')](function(_0x4d7083){if(_0x4d7083){_0x4503f8=_0x4d7083;return _0x4d7083[_0x7afb('0x8f')]();}return null;})[_0x7afb('0x26')](function(_0x2d8866){if(_0x2d8866){if(!_0x2d8866['length']){throw new db[(_0x7afb('0x90'))]['ValidationErrorItem'](_0x7afb('0x6e'),0x193);}_0x4675e6=_0x2d8866;return db[_0x7afb('0x6f')]['findAll']({'raw':!![]});}return null;})[_0x7afb('0x26')](function(_0x163baf){if(_0x163baf){_0x15779a=_[_0x7afb('0x70')](_0x163baf,'id');var _0x35b9af;var _0x55fee6=squel[_0x7afb('0x71')]();_0x55fee6[_0x7afb('0x72')](_0x4503f8[_0x7afb('0x73')]);for(var _0x18fd21=0x0;_0x18fd21<_0x4675e6[_0x7afb('0x39')];_0x18fd21+=0x1){_0x35b9af=_0x4675e6[_0x18fd21][_0x7afb('0x74')]?_0x15779a[_0x4675e6[_0x18fd21][_0x7afb('0x74')]][_0x7afb('0x75')]:_0x4675e6[_0x18fd21][_0x7afb('0x6a')];_0x35b9af=_0x4675e6[_0x18fd21][_0x7afb('0x76')]?_['replace'](_0x1d56d2[_0x4675e6[_0x18fd21]['function']],'%s',_0x35b9af):_0x35b9af;_0x35b9af=_0x4675e6[_0x18fd21][_0x7afb('0x78')]?_[_0x7afb('0x77')](_0x33123d[_0x4675e6[_0x18fd21][_0x7afb('0x78')]],'%s',_0x35b9af):_0x35b9af;if(_0x4675e6[_0x18fd21][_0x7afb('0x79')]){_0x55fee6['group'](_0x35b9af);}_0x4675e6[_0x18fd21][_0x7afb('0x7a')]&&_0x55fee6[_0x7afb('0x3b')](_0x35b9af,_0x4675e6[_0x18fd21][_0x7afb('0x7a')]===_0x7afb('0x7b')?![]:!![]);_0x55fee6[_0x7afb('0x6a')](_0x35b9af,_0x4675e6[_0x18fd21][_0x7afb('0x7c')]||_0x35b9af);}if(_0x4503f8[_0x7afb('0x7d')]){_0x4503f8['joins']=JSON[_0x7afb('0x91')](_0x4503f8[_0x7afb('0x7d')]);for(var _0x432e6f=0x0;_0x432e6f<_0x4503f8[_0x7afb('0x7d')]['length'];_0x432e6f+=0x1){if(_0x4503f8[_0x7afb('0x7d')][_0x432e6f][_0x7afb('0x31')]&&_[_0x7afb('0x62')](_0x563039,_0x4503f8[_0x7afb('0x7d')][_0x432e6f][_0x7afb('0x31')])&&_0x4503f8['joins'][_0x432e6f][_0x7afb('0x7e')]&&_0x4503f8['joins'][_0x432e6f][_0x7afb('0x7f')]&&_0x4503f8[_0x7afb('0x7d')][_0x432e6f][_0x7afb('0x80')]){_0x55fee6[_0x4503f8[_0x7afb('0x7d')][_0x432e6f]['type']](_0x4503f8[_0x7afb('0x7d')][_0x432e6f][_0x7afb('0x7f')],null,util[_0x7afb('0x78')](_0x7afb('0x81'),_0x4503f8[_0x7afb('0x73')],_0x4503f8['joins'][_0x432e6f]['parentKey'],_0x4503f8[_0x7afb('0x7d')][_0x432e6f]['foreignTable'],_0x4503f8[_0x7afb('0x7d')][_0x432e6f][_0x7afb('0x80')]));}}}if(_0x4503f8[_0x7afb('0x82')]){_0x4503f8[_0x7afb('0x82')]=JSON[_0x7afb('0x91')](_0x4503f8[_0x7afb('0x82')]);_0x55fee6['where'](_0x2b31a4(_0x4503f8[_0x7afb('0x82')][_0x7afb('0x69')]));}_0x11c161=_0x55fee6[_0x7afb('0x83')]();_0x55fee6[_0x7afb('0x1e')](_0x15d3bf);_0x55fee6[_0x7afb('0x1c')](0x0);logger[_0x7afb('0xa1')](_0x7afb('0x84'),_0x55fee6[_0x7afb('0x85')]());return dbH['sequelize'][_0x7afb('0x34')](_0x55fee6[_0x7afb('0x85')](),{'type':dbH[_0x7afb('0x86')]['QueryTypes'][_0x7afb('0x88')]});}})[_0x7afb('0x26')](function(){return{'sql':_0x11c161[_0x7afb('0x85')]()};})['then'](respondWithResult(_0x2e0fe5,null))[_0x7afb('0x45')](handleError(_0x2e0fe5,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 94a094f..3b31afa 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 _0x3cc9=['exports','define','AnalyticCustomReport','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticCustomReport.attributes'];(function(_0x108dad,_0xc3f315){var _0x6a1719=function(_0x39841e){while(--_0x39841e){_0x108dad['push'](_0x108dad['shift']());}};_0x6a1719(++_0xc3f315);}(_0x3cc9,0xac));var _0x93cc=function(_0x305752,_0x1a05e0){_0x305752=_0x305752-0x0;var _0x256745=_0x3cc9[_0x305752];return _0x256745;};'use strict';var _=require(_0x93cc('0x0'));var util=require(_0x93cc('0x1'));var logger=require(_0x93cc('0x2'))('api');var moment=require(_0x93cc('0x3'));var BPromise=require(_0x93cc('0x4'));var rp=require(_0x93cc('0x5'));var fs=require('fs');var path=require(_0x93cc('0x6'));var rimraf=require(_0x93cc('0x7'));var config=require(_0x93cc('0x8'));var attributes=require(_0x93cc('0x9'));module[_0x93cc('0xa')]=function(_0x473d9e,_0x1d31b5){return _0x473d9e[_0x93cc('0xb')](_0x93cc('0xc'),attributes,{'tableName':'analytics_custom_reports','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x34a1=['bluebird','request-promise','path','rimraf','../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','util','../../config/logger'];(function(_0x5495a6,_0x324a2f){var _0x88eab6=function(_0x13c12){while(--_0x13c12){_0x5495a6['push'](_0x5495a6['shift']());}};_0x88eab6(++_0x324a2f);}(_0x34a1,0xe7));var _0x134a=function(_0x3f3685,_0x1fe8ec){_0x3f3685=_0x3f3685-0x0;var _0x2f432d=_0x34a1[_0x3f3685];return _0x2f432d;};'use strict';var _=require(_0x134a('0x0'));var util=require(_0x134a('0x1'));var logger=require(_0x134a('0x2'))('api');var moment=require('moment');var BPromise=require(_0x134a('0x3'));var rp=require(_0x134a('0x4'));var fs=require('fs');var path=require(_0x134a('0x5'));var rimraf=require(_0x134a('0x6'));var config=require(_0x134a('0x7'));var attributes=require(_0x134a('0x8'));module[_0x134a('0x9')]=function(_0x1a1220,_0x818c01){return _0x1a1220[_0x134a('0xa')](_0x134a('0xb'),attributes,{'tableName':_0x134a('0xc'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index ee43a11..d9897ad 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 _0xffd1=['client','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x2adac1,_0x1439d0){var _0x5eb909=function(_0x17bcbe){while(--_0x17bcbe){_0x2adac1['push'](_0x2adac1['shift']());}};_0x5eb909(++_0x1439d0);}(_0xffd1,0x1f1));var _0x1ffd=function(_0x4a463a,_0x16dd8d){_0x4a463a=_0x4a463a-0x0;var _0x43d08d=_0xffd1[_0x4a463a];return _0x43d08d;};'use strict';var _=require('lodash');var util=require(_0x1ffd('0x0'));var moment=require('moment');var BPromise=require(_0x1ffd('0x1'));var rs=require(_0x1ffd('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1ffd('0x3'))['db'];var utils=require(_0x1ffd('0x4'));var logger=require(_0x1ffd('0x5'))(_0x1ffd('0x6'));var config=require(_0x1ffd('0x7'));var jayson=require(_0x1ffd('0x8'));var client=jayson[_0x1ffd('0x9')][_0x1ffd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x12edbb,_0x1b80ca,_0x39c9fd){return new BPromise(function(_0x3fccdd,_0x2f45c5){return client[_0x1ffd('0xb')](_0x12edbb,_0x39c9fd)[_0x1ffd('0xc')](function(_0x532bc){logger[_0x1ffd('0xd')](_0x1ffd('0xe'),_0x1b80ca,_0x1ffd('0xf'));logger[_0x1ffd('0x10')](_0x1ffd('0x11'),_0x1b80ca,_0x1ffd('0xf'),JSON[_0x1ffd('0x12')](_0x532bc));if(_0x532bc[_0x1ffd('0x13')]){if(_0x532bc[_0x1ffd('0x13')]['code']===0x1f4){logger[_0x1ffd('0x13')]('AnalyticCustomReport,\x20%s,\x20%s',_0x1b80ca,_0x532bc[_0x1ffd('0x13')][_0x1ffd('0x14')]);return _0x2f45c5(_0x532bc[_0x1ffd('0x13')][_0x1ffd('0x14')]);}logger[_0x1ffd('0x13')](_0x1ffd('0xe'),_0x1b80ca,_0x532bc['error']['message']);return _0x3fccdd(_0x532bc[_0x1ffd('0x13')][_0x1ffd('0x14')]);}else{logger[_0x1ffd('0xd')](_0x1ffd('0xe'),_0x1b80ca,_0x1ffd('0xf'));_0x3fccdd(_0x532bc[_0x1ffd('0x15')][_0x1ffd('0x14')]);}})['catch'](function(_0x28f343){logger[_0x1ffd('0x13')](_0x1ffd('0xe'),_0x1b80ca,_0x28f343);_0x2f45c5(_0x28f343);});});} \ No newline at end of file +var _0x03cb=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x1b5033,_0x1bf3ba){var _0xadb853=function(_0x1d1391){while(--_0x1d1391){_0x1b5033['push'](_0x1b5033['shift']());}};_0xadb853(++_0x1bf3ba);}(_0x03cb,0x1f2));var _0xb03c=function(_0x27973c,_0x2d8b16){_0x27973c=_0x27973c-0x0;var _0x2ef123=_0x03cb[_0x27973c];return _0x2ef123;};'use strict';var _=require(_0xb03c('0x0'));var util=require(_0xb03c('0x1'));var moment=require(_0xb03c('0x2'));var BPromise=require(_0xb03c('0x3'));var rs=require(_0xb03c('0x4'));var fs=require('fs');var Redis=require(_0xb03c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb03c('0x6'));var logger=require(_0xb03c('0x7'))('rpc');var config=require(_0xb03c('0x8'));var jayson=require(_0xb03c('0x9'));var client=jayson[_0xb03c('0xa')][_0xb03c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x209f9c,_0x24301f,_0x4916d4){return new BPromise(function(_0x2a77ba,_0xcb67bc){return client[_0xb03c('0xc')](_0x209f9c,_0x4916d4)[_0xb03c('0xd')](function(_0x1e7dc7){logger[_0xb03c('0xe')](_0xb03c('0xf'),_0x24301f,_0xb03c('0x10'));logger[_0xb03c('0x11')](_0xb03c('0x12'),_0x24301f,'request\x20sent',JSON[_0xb03c('0x13')](_0x1e7dc7));if(_0x1e7dc7[_0xb03c('0x14')]){if(_0x1e7dc7[_0xb03c('0x14')]['code']===0x1f4){logger[_0xb03c('0x14')](_0xb03c('0xf'),_0x24301f,_0x1e7dc7['error'][_0xb03c('0x15')]);return _0xcb67bc(_0x1e7dc7[_0xb03c('0x14')][_0xb03c('0x15')]);}logger[_0xb03c('0x14')](_0xb03c('0xf'),_0x24301f,_0x1e7dc7[_0xb03c('0x14')][_0xb03c('0x15')]);return _0x2a77ba(_0x1e7dc7[_0xb03c('0x14')][_0xb03c('0x15')]);}else{logger[_0xb03c('0xe')](_0xb03c('0xf'),_0x24301f,_0xb03c('0x10'));_0x2a77ba(_0x1e7dc7[_0xb03c('0x16')]['message']);}})[_0xb03c('0x17')](function(_0x166c8b){logger[_0xb03c('0x14')]('AnalyticCustomReport,\x20%s,\x20%s',_0x24301f,_0x166c8b);_0xcb67bc(_0x166c8b);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 97e1d54..ff76baa 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 _0xb5fb=['exports','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','/:id','preview','/:id/query','query','post','create','put','update'];(function(_0xe1b5f6,_0x210c09){var _0x44636e=function(_0x3a3212){while(--_0x3a3212){_0xe1b5f6['push'](_0xe1b5f6['shift']());}};_0x44636e(++_0x210c09);}(_0xb5fb,0x131));var _0xbb5f=function(_0x2abde0,_0x34c56e){_0x2abde0=_0x2abde0-0x0;var _0x33d1e6=_0xb5fb[_0x2abde0];return _0x33d1e6;};'use strict';var multer=require(_0xbb5f('0x0'));var util=require('util');var path=require(_0xbb5f('0x1'));var timeout=require('connect-timeout');var express=require(_0xbb5f('0x2'));var router=express['Router']();var fs_extra=require(_0xbb5f('0x3'));var auth=require(_0xbb5f('0x4'));var interaction=require(_0xbb5f('0x5'));var config=require(_0xbb5f('0x6'));var controller=require(_0xbb5f('0x7'));router[_0xbb5f('0x8')]('/',auth[_0xbb5f('0x9')](),controller['index']);router['get'](_0xbb5f('0xa'),auth[_0xbb5f('0x9')](),controller['show']);router['get']('/:id/preview',auth[_0xbb5f('0x9')](),controller[_0xbb5f('0xb')]);router[_0xbb5f('0x8')]('/:id/run',auth[_0xbb5f('0x9')](),controller['run']);router[_0xbb5f('0x8')](_0xbb5f('0xc'),auth[_0xbb5f('0x9')](),controller[_0xbb5f('0xd')]);router[_0xbb5f('0xe')]('/',auth[_0xbb5f('0x9')](),controller[_0xbb5f('0xf')]);router[_0xbb5f('0x10')](_0xbb5f('0xa'),auth[_0xbb5f('0x9')](),controller[_0xbb5f('0x11')]);router['delete']('/:id',auth[_0xbb5f('0x9')](),controller['destroy']);module[_0xbb5f('0x12')]=router; \ No newline at end of file +var _0xc526=['express','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/preview','preview','/:id/run','/:id/query','post','create','put','update','delete','exports','multer','connect-timeout'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0xc526,0xcf));var _0x6c52=function(_0x6f75f4,_0x2b7618){_0x6f75f4=_0x6f75f4-0x0;var _0x443f6f=_0xc526[_0x6f75f4];return _0x443f6f;};'use strict';var multer=require(_0x6c52('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6c52('0x1'));var express=require(_0x6c52('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6c52('0x3'));var config=require('../../config/environment');var controller=require('./analyticCustomReport.controller');router[_0x6c52('0x4')]('/',auth[_0x6c52('0x5')](),controller[_0x6c52('0x6')]);router['get'](_0x6c52('0x7'),auth[_0x6c52('0x5')](),controller[_0x6c52('0x8')]);router[_0x6c52('0x4')](_0x6c52('0x9'),auth[_0x6c52('0x5')](),controller[_0x6c52('0xa')]);router[_0x6c52('0x4')](_0x6c52('0xb'),auth['isAuthenticated'](),controller['run']);router['get'](_0x6c52('0xc'),auth[_0x6c52('0x5')](),controller['query']);router[_0x6c52('0xd')]('/',auth[_0x6c52('0x5')](),controller[_0x6c52('0xe')]);router[_0x6c52('0xf')](_0x6c52('0x7'),auth['isAuthenticated'](),controller[_0x6c52('0x10')]);router[_0x6c52('0x11')](_0x6c52('0x7'),auth['isAuthenticated'](),controller['destroy']);module[_0x6c52('0x12')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 419a15a..a20395b 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 _0x8ef6=['STRING','TEXT','sequelize','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8ef6,0xf2));var _0x68ef=function(_0x5214b3,_0x276ef3){_0x5214b3=_0x5214b3-0x0;var _0x383c8c=_0x8ef6[_0x5214b3];return _0x383c8c;};'use strict';var Sequelize=require(_0x68ef('0x0'));module[_0x68ef('0x1')]={'name':{'type':Sequelize[_0x68ef('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x68ef('0x2')]},'parent':{'type':Sequelize[_0x68ef('0x2')]},'table':{'type':Sequelize[_0x68ef('0x2')]},'conditions':{'type':Sequelize[_0x68ef('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x31f0=['sequelize','STRING','TEXT'];(function(_0xca0228,_0x58e40a){var _0x14fc84=function(_0xc08485){while(--_0xc08485){_0xca0228['push'](_0xca0228['shift']());}};_0x14fc84(++_0x58e40a);}(_0x31f0,0xb7));var _0x031f=function(_0x12bc03,_0x103449){_0x12bc03=_0x12bc03-0x0;var _0x18720a=_0x31f0[_0x12bc03];return _0x18720a;};'use strict';var Sequelize=require(_0x031f('0x0'));module['exports']={'name':{'type':Sequelize[_0x031f('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x031f('0x1')]},'table':{'type':Sequelize[_0x031f('0x1')]},'conditions':{'type':Sequelize[_0x031f('0x2')]},'joins':{'type':Sequelize[_0x031f('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 132a2b8..5fbd755 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 _0xc4aa=['Content-Range','apply','reject','save','update','then','destroy','get','DefaultReports','UserProfileResource','name','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','AnalyticDefaultReport','findAll','rows','catch','show','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20EMPTY','rules','operator','group','field','condition','getFields','Sequelize','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','format','orderBy','joins','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','parse','clone','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','COUNT(%s)','MAX(%s)','AVG(%s)','SEC_TO_TIME(%s)','IS\x20NOT\x20EMPTY','value','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','groupBy','alias','includes','foreignKey','output','web','fullPath','%s-%s.%s','randomstring','default','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','startDate','info','Run\x20Query:','child_process','fork','countTable','runReport','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','IS\x20NOT\x20NULL','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','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set'];(function(_0x4f3b2d,_0x3bbf46){var _0x3dddfa=function(_0xb8179a){while(--_0xb8179a){_0x4f3b2d['push'](_0x4f3b2d['shift']());}};_0x3dddfa(++_0x3bbf46);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0xc4aa[_0x2e4aa2];return _0x5e6092;};'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'];var dbH=require(_0xac4a('0x16'))['dbH'];function respondWithStatusCode(_0x21a79,_0x68424a){_0x68424a=_0x68424a||0xcc;return function(_0x247b78){if(_0x247b78){return _0x21a79[_0xac4a('0x17')](_0x68424a);}return _0x21a79[_0xac4a('0x18')](_0x68424a)[_0xac4a('0x19')]();};}function respondWithResult(_0x34bc01,_0x33c287){_0x33c287=_0x33c287||0xc8;return function(_0x190418){if(_0x190418){return _0x34bc01[_0xac4a('0x18')](_0x33c287)[_0xac4a('0x1a')](_0x190418);}};}function respondWithFilteredResult(_0x26dbb8,_0x4a2119){return function(_0x402fff){if(_0x402fff){var _0x34d797=typeof _0x4a2119[_0xac4a('0x1b')]===_0xac4a('0x1c')&&typeof _0x4a2119[_0xac4a('0x1d')]===_0xac4a('0x1c');var _0x28e304=_0x402fff[_0xac4a('0x1e')];var _0x546c5d=_0x34d797?0x0:_0x4a2119['offset'];var _0x21a729=_0x34d797?_0x402fff[_0xac4a('0x1e')]:_0x4a2119[_0xac4a('0x1b')]+_0x4a2119['limit'];var _0x39e83e;if(_0x21a729>=_0x28e304){_0x21a729=_0x28e304;_0x39e83e=0xc8;}else{_0x39e83e=0xce;}_0x26dbb8[_0xac4a('0x18')](_0x39e83e);return _0x26dbb8[_0xac4a('0x1f')](_0xac4a('0x20'),_0x546c5d+'-'+_0x21a729+'/'+_0x28e304)[_0xac4a('0x1a')](_0x402fff);}return null;};}function patchUpdates(_0x3e829c){return function(_0xe38996){try{jsonpatch[_0xac4a('0x21')](_0xe38996,_0x3e829c,!![]);}catch(_0x534092){return BPromise[_0xac4a('0x22')](_0x534092);}return _0xe38996[_0xac4a('0x23')]();};}function saveUpdates(_0x599787,_0x3d7ce0){return function(_0x4169c0){if(_0x4169c0){return _0x4169c0[_0xac4a('0x24')](_0x599787)[_0xac4a('0x25')](function(_0x4d2d6c){return _0x4d2d6c;});}return null;};}function removeEntity(_0x1b7998,_0x2503d8){return function(_0x15435c){if(_0x15435c){return _0x15435c[_0xac4a('0x26')]()[_0xac4a('0x25')](function(){var _0x2b0dc2=_0x15435c[_0xac4a('0x27')]({'plain':!![]});var _0x36054a=_0xac4a('0x28');return db[_0xac4a('0x29')][_0xac4a('0x26')]({'where':{'type':_0x36054a,'resourceId':_0x2b0dc2['id']}})[_0xac4a('0x25')](function(){return _0x15435c;});})[_0xac4a('0x25')](function(){_0x1b7998[_0xac4a('0x18')](0xcc)[_0xac4a('0x19')]();});}};}function handleEntityNotFound(_0x20202c,_0x4e17ce){return function(_0x23b061){if(!_0x23b061){_0x20202c[_0xac4a('0x17')](0x194);}return _0x23b061;};}function handleError(_0x42a33c,_0x2772fe){_0x2772fe=_0x2772fe||0x1f4;return function(_0x116700){logger['error'](_0x116700['stack']);if(_0x116700[_0xac4a('0x2a')]){delete _0x116700[_0xac4a('0x2a')];}_0x42a33c[_0xac4a('0x18')](_0x2772fe)['send'](_0x116700);};}exports['index']=function(_0x355755,_0x2896bc){var _0x228629={},_0x432066={},_0x17118e={'count':0x0,'rows':[]};var _0x53d3a5=_[_0xac4a('0x2b')](db['AnalyticDefaultReport'][_0xac4a('0x2c')],function(_0x57adcf){return{'name':_0x57adcf[_0xac4a('0x2d')],'type':_0x57adcf[_0xac4a('0x2e')][_0xac4a('0x2f')]};});_0x432066[_0xac4a('0x30')]=_[_0xac4a('0x2b')](_0x53d3a5,_0xac4a('0x2a'));_0x432066[_0xac4a('0x31')]=_[_0xac4a('0x32')](_0x355755[_0xac4a('0x31')]);_0x432066[_0xac4a('0x33')]=_[_0xac4a('0x34')](_0x432066[_0xac4a('0x30')],_0x432066[_0xac4a('0x31')]);_0x228629[_0xac4a('0x35')]=_['intersection'](_0x432066[_0xac4a('0x30')],qs[_0xac4a('0x36')](_0x355755['query'][_0xac4a('0x36')]));_0x228629[_0xac4a('0x35')]=_0x228629['attributes']['length']?_0x228629[_0xac4a('0x35')]:_0x432066[_0xac4a('0x30')];if(!_0x355755[_0xac4a('0x31')][_0xac4a('0x37')]('nolimit')){_0x228629[_0xac4a('0x1d')]=qs[_0xac4a('0x1d')](_0x355755['query'][_0xac4a('0x1d')]);_0x228629[_0xac4a('0x1b')]=qs[_0xac4a('0x1b')](_0x355755['query'][_0xac4a('0x1b')]);}_0x228629[_0xac4a('0x38')]=qs[_0xac4a('0x39')](_0x355755['query'][_0xac4a('0x39')]);_0x228629[_0xac4a('0x3a')]=qs['filters'](_['pick'](_0x355755[_0xac4a('0x31')],_0x432066['filters']),_0x53d3a5);if(_0x355755['query']['filter']){_0x228629['where']=_[_0xac4a('0x3b')](_0x228629[_0xac4a('0x3a')],{'$or':_[_0xac4a('0x2b')](_0x53d3a5,function(_0x472484){if(_0x472484[_0xac4a('0x2e')]!==_0xac4a('0x3c')){var _0x4220e2={};_0x4220e2[_0x472484[_0xac4a('0x2a')]]={'$like':'%'+_0x355755[_0xac4a('0x31')][_0xac4a('0x3d')]+'%'};return _0x4220e2;}})});}_0x228629=_[_0xac4a('0x3b')]({},_0x228629,_0x355755[_0xac4a('0x3e')]);var _0x4e4994={'where':_0x228629['where']};return db['AnalyticDefaultReport'][_0xac4a('0x1e')](_0x4e4994)[_0xac4a('0x25')](function(_0x14e80b){_0x17118e[_0xac4a('0x1e')]=_0x14e80b;if(_0x355755[_0xac4a('0x31')][_0xac4a('0x3f')]){_0x228629[_0xac4a('0x40')]=[{'all':!![]}];}return db[_0xac4a('0x41')][_0xac4a('0x42')](_0x228629);})[_0xac4a('0x25')](function(_0x561cb7){_0x17118e[_0xac4a('0x43')]=_0x561cb7;return _0x17118e;})[_0xac4a('0x25')](respondWithFilteredResult(_0x2896bc,_0x228629))[_0xac4a('0x44')](handleError(_0x2896bc,null));};exports[_0xac4a('0x45')]=function(_0x1a96cf,_0x57b879){var _0x8700b4={'raw':!![],'where':{'id':_0x1a96cf['params']['id']}},_0x1b77bb={};_0x1b77bb[_0xac4a('0x30')]=_['keys'](db[_0xac4a('0x41')][_0xac4a('0x2c')]);_0x1b77bb[_0xac4a('0x31')]=_[_0xac4a('0x32')](_0x1a96cf[_0xac4a('0x31')]);_0x1b77bb[_0xac4a('0x33')]=_[_0xac4a('0x34')](_0x1b77bb[_0xac4a('0x30')],_0x1b77bb[_0xac4a('0x31')]);_0x8700b4[_0xac4a('0x35')]=_[_0xac4a('0x34')](_0x1b77bb[_0xac4a('0x30')],qs['fields'](_0x1a96cf[_0xac4a('0x31')][_0xac4a('0x36')]));_0x8700b4[_0xac4a('0x35')]=_0x8700b4['attributes'][_0xac4a('0x46')]?_0x8700b4[_0xac4a('0x35')]:_0x1b77bb['model'];if(_0x1a96cf[_0xac4a('0x31')]['includeAll']){_0x8700b4[_0xac4a('0x40')]=[{'all':!![]}];}_0x8700b4=_[_0xac4a('0x3b')]({},_0x8700b4,_0x1a96cf[_0xac4a('0x3e')]);return db['AnalyticDefaultReport']['find'](_0x8700b4)[_0xac4a('0x25')](handleEntityNotFound(_0x57b879,null))['then'](respondWithResult(_0x57b879,null))[_0xac4a('0x44')](handleError(_0x57b879,null));};exports['create']=function(_0x3d2aaf,_0x530bbb){return db[_0xac4a('0x41')][_0xac4a('0x47')](_0x3d2aaf[_0xac4a('0x48')],{})[_0xac4a('0x25')](function(_0x54782f){var _0x31c794=_0x3d2aaf[_0xac4a('0x49')][_0xac4a('0x27')]({'plain':!![]});if(!_0x31c794)throw new Error(_0xac4a('0x4a'));if(_0x31c794[_0xac4a('0x4b')]===_0xac4a('0x49')){var _0x187306=_0x54782f['get']({'plain':!![]});var _0x35dee5=_0xac4a('0x4c');return db['UserProfileSection'][_0xac4a('0x4d')]({'where':{'name':_0x35dee5,'userProfileId':_0x31c794[_0xac4a('0x4e')]},'raw':!![]})[_0xac4a('0x25')](function(_0x3ac36e){if(_0x3ac36e&&_0x3ac36e['autoAssociation']===0x0){return db[_0xac4a('0x29')][_0xac4a('0x47')]({'name':_0x187306[_0xac4a('0x2a')],'resourceId':_0x187306['id'],'type':_0xac4a('0x28'),'sectionId':_0x3ac36e['id']},{})[_0xac4a('0x25')](function(){return _0x54782f;});}else{return _0x54782f;}})['catch'](function(_0x179373){logger['error'](_0xac4a('0x4f'),_0x179373);throw _0x179373;});}return _0x54782f;})[_0xac4a('0x25')](respondWithResult(_0x530bbb,0xc9))['catch'](handleError(_0x530bbb,null));};exports['update']=function(_0x437466,_0x70fdc3){if(_0x437466['body']['id']){delete _0x437466[_0xac4a('0x48')]['id'];}return db[_0xac4a('0x41')][_0xac4a('0x4d')]({'where':{'id':_0x437466[_0xac4a('0x50')]['id']}})['then'](handleEntityNotFound(_0x70fdc3,null))[_0xac4a('0x25')](saveUpdates(_0x437466[_0xac4a('0x48')],null))[_0xac4a('0x25')](respondWithResult(_0x70fdc3,null))[_0xac4a('0x44')](handleError(_0x70fdc3,null));};exports[_0xac4a('0x26')]=function(_0x411547,_0x36179a){return db['AnalyticDefaultReport'][_0xac4a('0x4d')]({'where':{'id':_0x411547[_0xac4a('0x50')]['id']}})[_0xac4a('0x25')](handleEntityNotFound(_0x36179a,null))[_0xac4a('0x25')](removeEntity(_0x36179a,null))[_0xac4a('0x44')](handleError(_0x36179a,null));};exports[_0xac4a('0x51')]=function(_0x213df2,_0x236f57){var _0x159e43=0xa;var _0x786d9=[_0xac4a('0x52'),_0xac4a('0x53'),_0xac4a('0x54'),_0xac4a('0x55')];var _0x5222f3={'SUM':_0xac4a('0x56'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xac4a('0x57'),'MAX':'MAX(%s)','MIN':_0xac4a('0x58'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xac4a('0x59'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xac4a('0x5a')};var _0x5cac9b={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xac4a('0x5b'),'HOUR':_0xac4a('0x5c'),'ROUND':_0xac4a('0x5d'),'UNIX_TIMESTAMP':_0xac4a('0x5e')};var _0x2f9940=function(_0xb7b884){return!_['includes']([_0xac4a('0x5f'),'IS\x20NOT\x20NULL',_0xac4a('0x60'),'IS\x20NOT\x20EMPTY'],_0xb7b884);};var _0x347880=function(_0x19ce2c){if(!_0x19ce2c||!_0x19ce2c[_0xac4a('0x61')][_0xac4a('0x46')]){return'';}for(var _0x429273='(',_0x2bc39a=0x0;_0x2bc39a<_0x19ce2c[_0xac4a('0x61')][_0xac4a('0x46')];_0x2bc39a+=0x1){_0x2bc39a>0x0&&(_0x429273+='\x20'+_0x19ce2c[_0xac4a('0x62')]+'\x20');_0x429273+=_0x19ce2c[_0xac4a('0x61')][_0x2bc39a][_0xac4a('0x63')]?_0x347880(_0x19ce2c[_0xac4a('0x61')][_0x2bc39a][_0xac4a('0x63')]):_0x19ce2c[_0xac4a('0x61')][_0x2bc39a][_0xac4a('0x64')]+'\x20'+_0x19ce2c[_0xac4a('0x61')][_0x2bc39a][_0xac4a('0x65')]+(_0x2f9940(_0x19ce2c['rules'][_0x2bc39a][_0xac4a('0x65')])?'\x20'+_0x19ce2c[_0xac4a('0x61')][_0x2bc39a]['value']:'');}return _0x429273+')';};var _0x3c3576={'where':{'id':_0x213df2['params']['id']}},_0x34bd1c,_0x2d24c7,_0x2b8562,_0x357cac,_0x4d1440;_0x3c3576=_[_0xac4a('0x3b')]({},_0x3c3576,_0x213df2[_0xac4a('0x3e')]);return db[_0xac4a('0x41')][_0xac4a('0x4d')](_0x3c3576)[_0xac4a('0x25')](function(_0x21ef8b){if(_0x21ef8b){_0x34bd1c=_0x21ef8b;return _0x21ef8b[_0xac4a('0x66')]();}return null;})[_0xac4a('0x25')](function(_0x44c60b){if(_0x44c60b){if(!_0x44c60b[_0xac4a('0x46')]){throw new db[(_0xac4a('0x67'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x2d24c7=_0x44c60b;return db[_0xac4a('0x68')][_0xac4a('0x42')]({'raw':!![]});}return null;})[_0xac4a('0x25')](function(_0x423f70){if(_0x423f70){_0x2b8562=_[_0xac4a('0x69')](_0x423f70,'id');var _0x283107;var _0x1d24bb=squel[_0xac4a('0x6a')]();_0x1d24bb[_0xac4a('0x6b')](_0x34bd1c[_0xac4a('0x6c')]);for(var _0xb09b89=0x0;_0xb09b89<_0x2d24c7[_0xac4a('0x46')];_0xb09b89+=0x1){_0x283107=_0x2d24c7[_0xb09b89]['MetricId']?_0x2b8562[_0x2d24c7[_0xb09b89][_0xac4a('0x6d')]][_0xac4a('0x6e')]:_0x2d24c7[_0xb09b89][_0xac4a('0x64')];_0x283107=_0x2d24c7[_0xb09b89][_0xac4a('0x6f')]?_['replace'](_0x5222f3[_0x2d24c7[_0xb09b89][_0xac4a('0x6f')]],'%s',_0x283107):_0x283107;_0x283107=_0x2d24c7[_0xb09b89]['format']?_[_0xac4a('0x70')](_0x5cac9b[_0x2d24c7[_0xb09b89][_0xac4a('0x71')]],'%s',_0x283107):_0x283107;if(_0x2d24c7[_0xb09b89]['groupBy']){_0x1d24bb['group'](_0x283107);}_0x2d24c7[_0xb09b89][_0xac4a('0x72')]&&_0x1d24bb[_0xac4a('0x38')](_0x283107,_0x2d24c7[_0xb09b89][_0xac4a('0x72')]==='DESC'?![]:!![]);_0x1d24bb[_0xac4a('0x64')](_0x283107,_0x2d24c7[_0xb09b89]['alias']||_0x283107);}if(_0x34bd1c[_0xac4a('0x73')]){_0x34bd1c['joins']=JSON['parse'](_0x34bd1c[_0xac4a('0x73')]);for(var _0x56ef2a=0x0;_0x56ef2a<_0x34bd1c[_0xac4a('0x73')]['length'];_0x56ef2a+=0x1){if(_0x34bd1c[_0xac4a('0x73')][_0x56ef2a][_0xac4a('0x2e')]&&_['includes'](_0x786d9,_0x34bd1c[_0xac4a('0x73')][_0x56ef2a]['type'])&&_0x34bd1c[_0xac4a('0x73')][_0x56ef2a][_0xac4a('0x74')]&&_0x34bd1c['joins'][_0x56ef2a][_0xac4a('0x75')]&&_0x34bd1c['joins'][_0x56ef2a]['foreignKey']){_0x1d24bb[_0x34bd1c[_0xac4a('0x73')][_0x56ef2a]['type']](_0x34bd1c[_0xac4a('0x73')][_0x56ef2a]['foreignTable'],null,util['format'](_0xac4a('0x76'),_0x34bd1c[_0xac4a('0x6c')],_0x34bd1c[_0xac4a('0x73')][_0x56ef2a]['parentKey'],_0x34bd1c['joins'][_0x56ef2a][_0xac4a('0x75')],_0x34bd1c[_0xac4a('0x73')][_0x56ef2a]['foreignKey']));}}}if(_0x34bd1c['conditions']){_0x34bd1c[_0xac4a('0x77')]=JSON[_0xac4a('0x78')](_0x34bd1c[_0xac4a('0x77')]);_0x1d24bb[_0xac4a('0x3a')](_0x347880(_0x34bd1c[_0xac4a('0x77')][_0xac4a('0x63')]));}_0x4d1440=_0x1d24bb[_0xac4a('0x79')]();_0x1d24bb[_0xac4a('0x1d')](_0x159e43);_0x1d24bb[_0xac4a('0x1b')](0x0);logger['debug'](_0xac4a('0x7a'),_0x1d24bb[_0xac4a('0x7b')]());return dbH[_0xac4a('0x7c')]['query'](_0x1d24bb[_0xac4a('0x7b')](),{'type':dbH[_0xac4a('0x7c')][_0xac4a('0x7d')][_0xac4a('0x7e')]});}})[_0xac4a('0x25')](respondWithResult(_0x236f57,null))['catch'](handleError(_0x236f57,null));};function runReport(_0x290a73,_0x19ce24,_0xc9d040){var _0x37e519=_0x19ce24[_0xac4a('0x2a')];var _0x451248=0xa;var _0xd7bdd6=['join',_0xac4a('0x53'),_0xac4a('0x54'),_0xac4a('0x55')];var _0x35a97c={'SUM':_0xac4a('0x56'),'COUNT':_0xac4a('0x7f'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xac4a('0x80'),'MIN':_0xac4a('0x58'),'AVG':_0xac4a('0x81'),'GROUP_CONCAT':_0xac4a('0x59'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xac4a('0x5a')};var _0x56a934={'SEC_TO_TIME':_0xac4a('0x82'),'DATE':_0xac4a('0x5b'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xac4a('0x5e')};var _0x212a22=function(_0x1fe86a){return!_['includes']([_0xac4a('0x5f'),'IS\x20NOT\x20NULL',_0xac4a('0x60'),_0xac4a('0x83')],_0x1fe86a);};var _0x406b64=function(_0x35328e){if(!_0x35328e||!_0x35328e[_0xac4a('0x61')]['length']){return'';}for(var _0x50f471='(',_0x31cda0=0x0;_0x31cda0<_0x35328e[_0xac4a('0x61')][_0xac4a('0x46')];_0x31cda0+=0x1){_0x31cda0>0x0&&(_0x50f471+='\x20'+_0x35328e[_0xac4a('0x62')]+'\x20');_0x50f471+=_0x35328e[_0xac4a('0x61')][_0x31cda0][_0xac4a('0x63')]?_0x406b64(_0x35328e[_0xac4a('0x61')][_0x31cda0][_0xac4a('0x63')]):_0x35328e['rules'][_0x31cda0]['field']+'\x20'+_0x35328e[_0xac4a('0x61')][_0x31cda0][_0xac4a('0x65')]+(_0x212a22(_0x35328e[_0xac4a('0x61')][_0x31cda0][_0xac4a('0x65')])?'\x20'+_0x35328e[_0xac4a('0x61')][_0x31cda0][_0xac4a('0x84')]:'');}return _0x50f471+')';};var _0xdaa2ef={'where':{'id':_0x290a73['id']}},_0x2e704b,_0x540d8e,_0x5e0be4,_0x32fd0c,_0x168f30;_0xdaa2ef=_[_0xac4a('0x3b')]({},_0xdaa2ef,_0xc9d040);return db[_0xac4a('0x41')][_0xac4a('0x4d')](_0xdaa2ef)[_0xac4a('0x25')](function(_0x338af3){if(_0x338af3){_0x2e704b=_0x338af3;return _0x338af3['getFields']();}return null;})[_0xac4a('0x25')](function(_0x1bacf2){if(_0x1bacf2){if(!_0x1bacf2[_0xac4a('0x46')]){throw new db['Sequelize'][(_0xac4a('0x85'))](_0xac4a('0x86'),0x193);}_0x540d8e=_0x1bacf2;return db[_0xac4a('0x68')][_0xac4a('0x42')]({'raw':!![]});}return null;})[_0xac4a('0x25')](function(_0x27d023){if(_0x27d023){_0x5e0be4=_[_0xac4a('0x69')](_0x27d023,'id');var _0x2ef42a;var _0x322465=squel['select']();_0x322465[_0xac4a('0x6b')](_0x2e704b['table']);for(var _0x203321=0x0;_0x203321<_0x540d8e[_0xac4a('0x46')];_0x203321+=0x1){_0x2ef42a=_0x540d8e[_0x203321][_0xac4a('0x6d')]?_0x5e0be4[_0x540d8e[_0x203321][_0xac4a('0x6d')]][_0xac4a('0x6e')]:_0x540d8e[_0x203321][_0xac4a('0x64')];_0x2ef42a=_0x540d8e[_0x203321][_0xac4a('0x6f')]?_['replace'](_0x35a97c[_0x540d8e[_0x203321][_0xac4a('0x6f')]],'%s',_0x2ef42a):_0x2ef42a;_0x2ef42a=_0x540d8e[_0x203321][_0xac4a('0x71')]?_[_0xac4a('0x70')](_0x56a934[_0x540d8e[_0x203321][_0xac4a('0x71')]],'%s',_0x2ef42a):_0x2ef42a;if(_0x540d8e[_0x203321][_0xac4a('0x87')]){_0x322465['group'](_0x2ef42a);}_0x540d8e[_0x203321][_0xac4a('0x72')]&&_0x322465[_0xac4a('0x38')](_0x2ef42a,_0x540d8e[_0x203321]['orderBy']==='DESC'?![]:!![]);_0x322465[_0xac4a('0x64')](_0x2ef42a,_0x540d8e[_0x203321][_0xac4a('0x88')]||_0x2ef42a);}if(_0x2e704b['joins']){_0x2e704b[_0xac4a('0x73')]=JSON[_0xac4a('0x78')](_0x2e704b[_0xac4a('0x73')]);for(var _0x37657e=0x0;_0x37657e<_0x2e704b[_0xac4a('0x73')][_0xac4a('0x46')];_0x37657e+=0x1){if(_0x2e704b['joins'][_0x37657e][_0xac4a('0x2e')]&&_[_0xac4a('0x89')](_0xd7bdd6,_0x2e704b[_0xac4a('0x73')][_0x37657e]['type'])&&_0x2e704b[_0xac4a('0x73')][_0x37657e][_0xac4a('0x74')]&&_0x2e704b[_0xac4a('0x73')][_0x37657e][_0xac4a('0x75')]&&_0x2e704b[_0xac4a('0x73')][_0x37657e][_0xac4a('0x8a')]){_0x322465[_0x2e704b['joins'][_0x37657e][_0xac4a('0x2e')]](_0x2e704b[_0xac4a('0x73')][_0x37657e]['foreignTable'],null,util[_0xac4a('0x71')]('%s.%s\x20=\x20%s.%s',_0x2e704b[_0xac4a('0x6c')],_0x2e704b[_0xac4a('0x73')][_0x37657e]['parentKey'],_0x2e704b[_0xac4a('0x73')][_0x37657e]['foreignTable'],_0x2e704b[_0xac4a('0x73')][_0x37657e]['foreignKey']));}}}if(_0x2e704b[_0xac4a('0x77')]){_0x2e704b[_0xac4a('0x77')]=JSON[_0xac4a('0x78')](_0x2e704b[_0xac4a('0x77')]);_0x322465[_0xac4a('0x3a')](_0x406b64(_0x2e704b[_0xac4a('0x77')][_0xac4a('0x63')]));}_0x168f30=_0x322465[_0xac4a('0x79')]();_0x322465[_0xac4a('0x1d')](_0x451248);_0x322465[_0xac4a('0x1b')](0x0);return;}})[_0xac4a('0x25')](function(){if(_0x19ce24[_0xac4a('0x8b')]===_0xac4a('0x8c')){return null;}var _0x4217df=_['merge'](_0x19ce24,{'name':_0x19ce24[_0xac4a('0x8d')]||_0x19ce24[_0xac4a('0x2a')]||_0x2e704b['name'],'basename':_0x37e519,'savename':util[_0xac4a('0x71')](_0xac4a('0x8e'),_0x19ce24[_0xac4a('0x2a')]||_0x2e704b[_0xac4a('0x2a')],require(_0xac4a('0x8f'))['generate'](0x4),_0x19ce24[_0xac4a('0x8b')]||'csv'),'reportId':_0x2e704b['id'],'reportType':_0xac4a('0x90')});return db[_0xac4a('0x91')][_0xac4a('0x47')](_0x4217df,{'raw':!![]});})[_0xac4a('0x25')](function(_0x53f23d){if(_0x2e704b[_0xac4a('0x6c')]==='cdr'){_0x168f30[_0xac4a('0x3a')](_0x2e704b[_0xac4a('0x6c')]+_0xac4a('0x92'),_0x19ce24['startDate'],_0x19ce24[_0xac4a('0x93')]);}else{_0x168f30[_0xac4a('0x3a')](_0x2e704b[_0xac4a('0x6c')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x19ce24[_0xac4a('0x94')],_0x19ce24[_0xac4a('0x93')]);}if(_0x53f23d){logger[_0xac4a('0x95')](_0xac4a('0x96'),_0x168f30[_0xac4a('0x7b')]());require(_0xac4a('0x97'))[_0xac4a('0x98')](path[_0xac4a('0x52')](__dirname,'../../components/export/',_0x53f23d[_0xac4a('0x8b')]),[_0x53f23d['id'],_0x168f30['toString'](),path['join'](__dirname,'../../files/reports',_0x53f23d['savename']),_0x37e519]);return _0x53f23d;}else{var _0x502275=squel[_0xac4a('0x6a')]();_0x502275[_0xac4a('0x6b')]('('+_0x168f30[_0xac4a('0x7b')]()+')',_0xac4a('0x99'));_0x502275[_0xac4a('0x64')]('COUNT(*)',_0xac4a('0x1e'));_0x168f30[_0xac4a('0x1d')](_0x19ce24[_0xac4a('0x1d')]||_0x451248);_0x168f30[_0xac4a('0x1b')](_0x19ce24[_0xac4a('0x1b')]||0x0);return dbH[_0xac4a('0x7c')][_0xac4a('0x31')](_0x502275[_0xac4a('0x7b')](),{'type':dbH['sequelize'][_0xac4a('0x7d')][_0xac4a('0x7e')]})[_0xac4a('0x25')](function(_0x25331f){if(!_0x25331f[_0xac4a('0x46')]){_0x32fd0c=0x0;}else{_0x32fd0c=_0x25331f[0x0][_0xac4a('0x1e')]||0x0;}return dbH[_0xac4a('0x7c')]['query'](_0x168f30['toString'](),{'type':dbH[_0xac4a('0x7c')][_0xac4a('0x7d')]['SELECT']});})[_0xac4a('0x25')](function(_0x366f5a){return{'rows':_0x366f5a||[],'count':_0x32fd0c};});}});}exports['run']=function(_0x5bd013,_0x2fe103){return runReport(_0x5bd013[_0xac4a('0x50')],_0x5bd013[_0xac4a('0x31')],_0x5bd013[_0xac4a('0x3e')])[_0xac4a('0x25')](respondWithResult(_0x2fe103,null))['catch'](handleError(_0x2fe103,null));};exports[_0xac4a('0x9a')]=runReport;exports['query']=function(_0x4f2d85,_0x538cfd){var _0x63c30=0xa;var _0x4301c3=[_0xac4a('0x52'),_0xac4a('0x53'),_0xac4a('0x54'),_0xac4a('0x55')];var _0xcad25d={'SUM':_0xac4a('0x56'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xac4a('0x58'),'AVG':_0xac4a('0x81'),'GROUP_CONCAT':_0xac4a('0x59'),'GROUP_CONCAT ASC':_0xac4a('0x9b'),'GROUP_CONCAT DESC':_0xac4a('0x5a')};var _0xcd140e={'SEC_TO_TIME':_0xac4a('0x82'),'DATE':_0xac4a('0x5b'),'HOUR':_0xac4a('0x5c'),'ROUND':_0xac4a('0x5d'),'UNIX_TIMESTAMP':_0xac4a('0x5e')};var _0x37cb49=function(_0xe0fd57){return!_[_0xac4a('0x89')]([_0xac4a('0x5f'),_0xac4a('0x9c'),_0xac4a('0x60'),_0xac4a('0x83')],_0xe0fd57);};var _0x41cdb5=function(_0x172d03){if(!_0x172d03||!_0x172d03[_0xac4a('0x61')][_0xac4a('0x46')]){return'';}for(var _0x3e2575='(',_0x4cc581=0x0;_0x4cc581<_0x172d03[_0xac4a('0x61')][_0xac4a('0x46')];_0x4cc581+=0x1){_0x4cc581>0x0&&(_0x3e2575+='\x20'+_0x172d03[_0xac4a('0x62')]+'\x20');_0x3e2575+=_0x172d03[_0xac4a('0x61')][_0x4cc581][_0xac4a('0x63')]?_0x41cdb5(_0x172d03[_0xac4a('0x61')][_0x4cc581][_0xac4a('0x63')]):_0x172d03[_0xac4a('0x61')][_0x4cc581]['field']+'\x20'+_0x172d03['rules'][_0x4cc581][_0xac4a('0x65')]+(_0x37cb49(_0x172d03[_0xac4a('0x61')][_0x4cc581][_0xac4a('0x65')])?'\x20'+_0x172d03['rules'][_0x4cc581]['value']:'');}return _0x3e2575+')';};var _0x5de198={'where':{'id':_0x4f2d85[_0xac4a('0x50')]['id']}},_0x2b6773,_0x52df82,_0x59e82c,_0x216055,_0x52963c;_0x5de198=_['merge']({},_0x5de198,_0x4f2d85[_0xac4a('0x3e')]);return db[_0xac4a('0x41')][_0xac4a('0x4d')](_0x5de198)[_0xac4a('0x25')](function(_0x403a16){if(_0x403a16){_0x2b6773=_0x403a16;return _0x403a16[_0xac4a('0x66')]();}return null;})['then'](function(_0x25bf23){if(_0x25bf23){if(!_0x25bf23[_0xac4a('0x46')]){throw new db[(_0xac4a('0x67'))]['ValidationErrorItem'](_0xac4a('0x86'),0x193);}_0x52df82=_0x25bf23;return db[_0xac4a('0x68')][_0xac4a('0x42')]({'raw':!![]});}return null;})[_0xac4a('0x25')](function(_0x5bb911){if(_0x5bb911){_0x59e82c=_[_0xac4a('0x69')](_0x5bb911,'id');var _0x403f5a;var _0x3eae2f=squel[_0xac4a('0x6a')]();_0x3eae2f[_0xac4a('0x6b')](_0x2b6773[_0xac4a('0x6c')]);for(var _0x4a0cd9=0x0;_0x4a0cd9<_0x52df82['length'];_0x4a0cd9+=0x1){_0x403f5a=_0x52df82[_0x4a0cd9][_0xac4a('0x6d')]?_0x59e82c[_0x52df82[_0x4a0cd9][_0xac4a('0x6d')]][_0xac4a('0x6e')]:_0x52df82[_0x4a0cd9][_0xac4a('0x64')];_0x403f5a=_0x52df82[_0x4a0cd9][_0xac4a('0x6f')]?_[_0xac4a('0x70')](_0xcad25d[_0x52df82[_0x4a0cd9]['function']],'%s',_0x403f5a):_0x403f5a;_0x403f5a=_0x52df82[_0x4a0cd9][_0xac4a('0x71')]?_['replace'](_0xcd140e[_0x52df82[_0x4a0cd9][_0xac4a('0x71')]],'%s',_0x403f5a):_0x403f5a;if(_0x52df82[_0x4a0cd9]['groupBy']){_0x3eae2f[_0xac4a('0x63')](_0x403f5a);}_0x52df82[_0x4a0cd9][_0xac4a('0x72')]&&_0x3eae2f[_0xac4a('0x38')](_0x403f5a,_0x52df82[_0x4a0cd9][_0xac4a('0x72')]==='DESC'?![]:!![]);_0x3eae2f[_0xac4a('0x64')](_0x403f5a,_0x52df82[_0x4a0cd9][_0xac4a('0x88')]||_0x403f5a);}if(_0x2b6773[_0xac4a('0x73')]){_0x2b6773[_0xac4a('0x73')]=JSON[_0xac4a('0x78')](_0x2b6773['joins']);for(var _0x3dd60a=0x0;_0x3dd60a<_0x2b6773[_0xac4a('0x73')][_0xac4a('0x46')];_0x3dd60a+=0x1){if(_0x2b6773[_0xac4a('0x73')][_0x3dd60a][_0xac4a('0x2e')]&&_['includes'](_0x4301c3,_0x2b6773[_0xac4a('0x73')][_0x3dd60a][_0xac4a('0x2e')])&&_0x2b6773[_0xac4a('0x73')][_0x3dd60a][_0xac4a('0x74')]&&_0x2b6773[_0xac4a('0x73')][_0x3dd60a]['foreignTable']&&_0x2b6773['joins'][_0x3dd60a]['foreignKey']){_0x3eae2f[_0x2b6773['joins'][_0x3dd60a][_0xac4a('0x2e')]](_0x2b6773[_0xac4a('0x73')][_0x3dd60a][_0xac4a('0x75')],null,util[_0xac4a('0x71')](_0xac4a('0x76'),_0x2b6773['table'],_0x2b6773[_0xac4a('0x73')][_0x3dd60a][_0xac4a('0x74')],_0x2b6773['joins'][_0x3dd60a][_0xac4a('0x75')],_0x2b6773[_0xac4a('0x73')][_0x3dd60a][_0xac4a('0x8a')]));}}}if(_0x2b6773['conditions']){_0x2b6773[_0xac4a('0x77')]=JSON[_0xac4a('0x78')](_0x2b6773[_0xac4a('0x77')]);_0x3eae2f[_0xac4a('0x3a')](_0x41cdb5(_0x2b6773[_0xac4a('0x77')][_0xac4a('0x63')]));}_0x52963c=_0x3eae2f[_0xac4a('0x79')]();_0x3eae2f[_0xac4a('0x1d')](_0x63c30);_0x3eae2f[_0xac4a('0x1b')](0x0);logger['debug'](_0xac4a('0x7a'),_0x3eae2f[_0xac4a('0x7b')]());return dbH['sequelize'][_0xac4a('0x31')](_0x3eae2f['toString'](),{'type':dbH[_0xac4a('0x7c')][_0xac4a('0x7d')]['SELECT']});}})[_0xac4a('0x25')](function(){return{'sql':_0x52963c[_0xac4a('0x7b')]()};})[_0xac4a('0x25')](respondWithResult(_0x538cfd,null))[_0xac4a('0x44')](handleError(_0x538cfd,null));}; \ No newline at end of file +var _0x5fab=['debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','COUNT(DISTINCT\x20%s)','from','function','order','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable','run','params','runReport','AVG(%s)','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','status','end','limit','undefined','count','offset','Content-Range','apply','save','update','then','destroy','get','DefaultReports','UserProfileResource','sendStatus','error','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','type','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','query','where','pick','filters','filter','VIRTUAL','merge','options','include','findAll','rows','catch','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','MAX(%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)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','table','MetricId','metric','replace','format','groupBy','orderBy','DESC','alias','joins','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','parse','clone'];(function(_0x29dc1f,_0x3ebbe8){var _0x442ad6=function(_0x4019a4){while(--_0x4019a4){_0x29dc1f['push'](_0x29dc1f['shift']());}};_0x442ad6(++_0x3ebbe8);}(_0x5fab,0x177));var _0xb5fa=function(_0x3407ee,_0xb2e716){_0x3407ee=_0x3407ee-0x0;var _0x1b0b35=_0x5fab[_0x3407ee];return _0x1b0b35;};'use strict';var emlformat=require(_0xb5fa('0x0'));var rimraf=require(_0xb5fa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb5fa('0x2'));var rp=require(_0xb5fa('0x3'));var moment=require(_0xb5fa('0x4'));var BPromise=require(_0xb5fa('0x5'));var Mustache=require(_0xb5fa('0x6'));var util=require(_0xb5fa('0x7'));var path=require(_0xb5fa('0x8'));var sox=require(_0xb5fa('0x9'));var csv=require(_0xb5fa('0xa'));var ejs=require(_0xb5fa('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb5fa('0xc'));var crypto=require(_0xb5fa('0xd'));var jsforce=require(_0xb5fa('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb5fa('0xa'));var querystring=require(_0xb5fa('0xf'));var Papa=require(_0xb5fa('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb5fa('0x11'));var as=require(_0xb5fa('0x12'));var hardwareService=require(_0xb5fa('0x13'));var logger=require(_0xb5fa('0x14'))(_0xb5fa('0x15'));var utils=require(_0xb5fa('0x16'));var config=require(_0xb5fa('0x17'));var licenseUtil=require(_0xb5fa('0x18'));var db=require(_0xb5fa('0x19'))['db'];var dbH=require('../../mysqldb')[_0xb5fa('0x1a')];function respondWithStatusCode(_0x3dad4d,_0x56e8b0){_0x56e8b0=_0x56e8b0||0xcc;return function(_0x116849){if(_0x116849){return _0x3dad4d['sendStatus'](_0x56e8b0);}return _0x3dad4d[_0xb5fa('0x1b')](_0x56e8b0)[_0xb5fa('0x1c')]();};}function respondWithResult(_0x40c914,_0xca8d82){_0xca8d82=_0xca8d82||0xc8;return function(_0x8e9d1c){if(_0x8e9d1c){return _0x40c914['status'](_0xca8d82)['json'](_0x8e9d1c);}};}function respondWithFilteredResult(_0x38e964,_0x587043){return function(_0x31f252){if(_0x31f252){var _0x27c8f7=typeof _0x587043['offset']==='undefined'&&typeof _0x587043[_0xb5fa('0x1d')]===_0xb5fa('0x1e');var _0x32e9e5=_0x31f252[_0xb5fa('0x1f')];var _0x324ba5=_0x27c8f7?0x0:_0x587043[_0xb5fa('0x20')];var _0x3b0f69=_0x27c8f7?_0x31f252[_0xb5fa('0x1f')]:_0x587043[_0xb5fa('0x20')]+_0x587043[_0xb5fa('0x1d')];var _0x3c8d53;if(_0x3b0f69>=_0x32e9e5){_0x3b0f69=_0x32e9e5;_0x3c8d53=0xc8;}else{_0x3c8d53=0xce;}_0x38e964[_0xb5fa('0x1b')](_0x3c8d53);return _0x38e964['set'](_0xb5fa('0x21'),_0x324ba5+'-'+_0x3b0f69+'/'+_0x32e9e5)['json'](_0x31f252);}return null;};}function patchUpdates(_0x37ae06){return function(_0x4a6c04){try{jsonpatch[_0xb5fa('0x22')](_0x4a6c04,_0x37ae06,!![]);}catch(_0x43c09f){return BPromise['reject'](_0x43c09f);}return _0x4a6c04[_0xb5fa('0x23')]();};}function saveUpdates(_0x3a2ab9,_0x283a56){return function(_0x47f71a){if(_0x47f71a){return _0x47f71a[_0xb5fa('0x24')](_0x3a2ab9)[_0xb5fa('0x25')](function(_0x444237){return _0x444237;});}return null;};}function removeEntity(_0x542348,_0x224ec8){return function(_0x5d55f7){if(_0x5d55f7){return _0x5d55f7[_0xb5fa('0x26')]()[_0xb5fa('0x25')](function(){var _0x11053a=_0x5d55f7[_0xb5fa('0x27')]({'plain':!![]});var _0x2dbd22=_0xb5fa('0x28');return db[_0xb5fa('0x29')][_0xb5fa('0x26')]({'where':{'type':_0x2dbd22,'resourceId':_0x11053a['id']}})['then'](function(){return _0x5d55f7;});})['then'](function(){_0x542348['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x28a350,_0x460b54){return function(_0x12c0d4){if(!_0x12c0d4){_0x28a350[_0xb5fa('0x2a')](0x194);}return _0x12c0d4;};}function handleError(_0x534884,_0x3506a4){_0x3506a4=_0x3506a4||0x1f4;return function(_0x358549){logger[_0xb5fa('0x2b')](_0x358549[_0xb5fa('0x2c')]);if(_0x358549[_0xb5fa('0x2d')]){delete _0x358549[_0xb5fa('0x2d')];}_0x534884[_0xb5fa('0x1b')](_0x3506a4)[_0xb5fa('0x2e')](_0x358549);};}exports[_0xb5fa('0x2f')]=function(_0xed02e,_0x116773){var _0x5a0152={},_0x3fd1fb={},_0x21fc7e={'count':0x0,'rows':[]};var _0x319c48=_[_0xb5fa('0x30')](db[_0xb5fa('0x31')][_0xb5fa('0x32')],function(_0x25fc7c){return{'name':_0x25fc7c['fieldName'],'type':_0x25fc7c[_0xb5fa('0x33')]['key']};});_0x3fd1fb['model']=_['map'](_0x319c48,_0xb5fa('0x2d'));_0x3fd1fb['query']=_[_0xb5fa('0x34')](_0xed02e['query']);_0x3fd1fb['filters']=_[_0xb5fa('0x35')](_0x3fd1fb[_0xb5fa('0x36')],_0x3fd1fb['query']);_0x5a0152['attributes']=_[_0xb5fa('0x35')](_0x3fd1fb[_0xb5fa('0x36')],qs[_0xb5fa('0x37')](_0xed02e['query'][_0xb5fa('0x37')]));_0x5a0152[_0xb5fa('0x38')]=_0x5a0152['attributes'][_0xb5fa('0x39')]?_0x5a0152[_0xb5fa('0x38')]:_0x3fd1fb[_0xb5fa('0x36')];if(!_0xed02e['query'][_0xb5fa('0x3a')](_0xb5fa('0x3b'))){_0x5a0152[_0xb5fa('0x1d')]=qs['limit'](_0xed02e[_0xb5fa('0x3c')][_0xb5fa('0x1d')]);_0x5a0152[_0xb5fa('0x20')]=qs[_0xb5fa('0x20')](_0xed02e['query']['offset']);}_0x5a0152['order']=qs['sort'](_0xed02e['query']['sort']);_0x5a0152[_0xb5fa('0x3d')]=qs['filters'](_[_0xb5fa('0x3e')](_0xed02e[_0xb5fa('0x3c')],_0x3fd1fb[_0xb5fa('0x3f')]),_0x319c48);if(_0xed02e[_0xb5fa('0x3c')][_0xb5fa('0x40')]){_0x5a0152[_0xb5fa('0x3d')]=_['merge'](_0x5a0152['where'],{'$or':_['map'](_0x319c48,function(_0x534b38){if(_0x534b38['type']!==_0xb5fa('0x41')){var _0x5addd5={};_0x5addd5[_0x534b38['name']]={'$like':'%'+_0xed02e[_0xb5fa('0x3c')][_0xb5fa('0x40')]+'%'};return _0x5addd5;}})});}_0x5a0152=_[_0xb5fa('0x42')]({},_0x5a0152,_0xed02e[_0xb5fa('0x43')]);var _0x5bc93f={'where':_0x5a0152[_0xb5fa('0x3d')]};return db[_0xb5fa('0x31')][_0xb5fa('0x1f')](_0x5bc93f)[_0xb5fa('0x25')](function(_0x402a68){_0x21fc7e['count']=_0x402a68;if(_0xed02e[_0xb5fa('0x3c')]['includeAll']){_0x5a0152[_0xb5fa('0x44')]=[{'all':!![]}];}return db[_0xb5fa('0x31')][_0xb5fa('0x45')](_0x5a0152);})[_0xb5fa('0x25')](function(_0x1c706b){_0x21fc7e[_0xb5fa('0x46')]=_0x1c706b;return _0x21fc7e;})[_0xb5fa('0x25')](respondWithFilteredResult(_0x116773,_0x5a0152))[_0xb5fa('0x47')](handleError(_0x116773,null));};exports['show']=function(_0x1c3c2c,_0xc03e44){var _0x59ae64={'raw':!![],'where':{'id':_0x1c3c2c['params']['id']}},_0x293c19={};_0x293c19[_0xb5fa('0x36')]=_[_0xb5fa('0x34')](db['AnalyticDefaultReport']['rawAttributes']);_0x293c19[_0xb5fa('0x3c')]=_[_0xb5fa('0x34')](_0x1c3c2c[_0xb5fa('0x3c')]);_0x293c19[_0xb5fa('0x3f')]=_[_0xb5fa('0x35')](_0x293c19[_0xb5fa('0x36')],_0x293c19[_0xb5fa('0x3c')]);_0x59ae64[_0xb5fa('0x38')]=_['intersection'](_0x293c19[_0xb5fa('0x36')],qs[_0xb5fa('0x37')](_0x1c3c2c['query'][_0xb5fa('0x37')]));_0x59ae64[_0xb5fa('0x38')]=_0x59ae64[_0xb5fa('0x38')][_0xb5fa('0x39')]?_0x59ae64[_0xb5fa('0x38')]:_0x293c19[_0xb5fa('0x36')];if(_0x1c3c2c[_0xb5fa('0x3c')][_0xb5fa('0x48')]){_0x59ae64[_0xb5fa('0x44')]=[{'all':!![]}];}_0x59ae64=_[_0xb5fa('0x42')]({},_0x59ae64,_0x1c3c2c[_0xb5fa('0x43')]);return db[_0xb5fa('0x31')][_0xb5fa('0x49')](_0x59ae64)[_0xb5fa('0x25')](handleEntityNotFound(_0xc03e44,null))[_0xb5fa('0x25')](respondWithResult(_0xc03e44,null))[_0xb5fa('0x47')](handleError(_0xc03e44,null));};exports['create']=function(_0x56dceb,_0x46194d){return db['AnalyticDefaultReport'][_0xb5fa('0x4a')](_0x56dceb[_0xb5fa('0x4b')],{})['then'](function(_0x4ef1d0){var _0x2931a7=_0x56dceb[_0xb5fa('0x4c')][_0xb5fa('0x27')]({'plain':!![]});if(!_0x2931a7)throw new Error(_0xb5fa('0x4d'));if(_0x2931a7[_0xb5fa('0x4e')]==='user'){var _0x27a651=_0x4ef1d0['get']({'plain':!![]});var _0x251d36=_0xb5fa('0x4f');return db[_0xb5fa('0x50')]['find']({'where':{'name':_0x251d36,'userProfileId':_0x2931a7[_0xb5fa('0x51')]},'raw':!![]})[_0xb5fa('0x25')](function(_0x4dea87){if(_0x4dea87&&_0x4dea87['autoAssociation']===0x0){return db[_0xb5fa('0x29')][_0xb5fa('0x4a')]({'name':_0x27a651[_0xb5fa('0x2d')],'resourceId':_0x27a651['id'],'type':_0xb5fa('0x28'),'sectionId':_0x4dea87['id']},{})[_0xb5fa('0x25')](function(){return _0x4ef1d0;});}else{return _0x4ef1d0;}})[_0xb5fa('0x47')](function(_0x31c91f){logger[_0xb5fa('0x2b')](_0xb5fa('0x52'),_0x31c91f);throw _0x31c91f;});}return _0x4ef1d0;})[_0xb5fa('0x25')](respondWithResult(_0x46194d,0xc9))[_0xb5fa('0x47')](handleError(_0x46194d,null));};exports[_0xb5fa('0x24')]=function(_0x3ccfd1,_0x2799e7){if(_0x3ccfd1[_0xb5fa('0x4b')]['id']){delete _0x3ccfd1[_0xb5fa('0x4b')]['id'];}return db[_0xb5fa('0x31')][_0xb5fa('0x49')]({'where':{'id':_0x3ccfd1['params']['id']}})[_0xb5fa('0x25')](handleEntityNotFound(_0x2799e7,null))[_0xb5fa('0x25')](saveUpdates(_0x3ccfd1[_0xb5fa('0x4b')],null))[_0xb5fa('0x25')](respondWithResult(_0x2799e7,null))[_0xb5fa('0x47')](handleError(_0x2799e7,null));};exports[_0xb5fa('0x26')]=function(_0x4224cf,_0x24117e){return db[_0xb5fa('0x31')][_0xb5fa('0x49')]({'where':{'id':_0x4224cf['params']['id']}})['then'](handleEntityNotFound(_0x24117e,null))[_0xb5fa('0x25')](removeEntity(_0x24117e,null))[_0xb5fa('0x47')](handleError(_0x24117e,null));};exports[_0xb5fa('0x53')]=function(_0x5caf84,_0x441c41){var _0x367f7a=0xa;var _0x1572fb=[_0xb5fa('0x54'),_0xb5fa('0x55'),_0xb5fa('0x56'),_0xb5fa('0x57')];var _0x4f82f0={'SUM':_0xb5fa('0x58'),'COUNT':_0xb5fa('0x59'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xb5fa('0x5a'),'MIN':_0xb5fa('0x5b'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xb5fa('0x5c'),'GROUP_CONCAT ASC':_0xb5fa('0x5d'),'GROUP_CONCAT DESC':_0xb5fa('0x5e')};var _0x2b9a45={'SEC_TO_TIME':_0xb5fa('0x5f'),'DATE':_0xb5fa('0x60'),'HOUR':_0xb5fa('0x61'),'ROUND':_0xb5fa('0x62'),'UNIX_TIMESTAMP':_0xb5fa('0x63')};var _0x1c24e3=function(_0xfb88cc){return!_[_0xb5fa('0x64')]([_0xb5fa('0x65'),_0xb5fa('0x66'),_0xb5fa('0x67'),_0xb5fa('0x68')],_0xfb88cc);};var _0x41cce9=function(_0x23fb01){if(!_0x23fb01||!_0x23fb01[_0xb5fa('0x69')][_0xb5fa('0x39')]){return'';}for(var _0x421a93='(',_0x36fc0f=0x0;_0x36fc0f<_0x23fb01['rules'][_0xb5fa('0x39')];_0x36fc0f+=0x1){_0x36fc0f>0x0&&(_0x421a93+='\x20'+_0x23fb01[_0xb5fa('0x6a')]+'\x20');_0x421a93+=_0x23fb01[_0xb5fa('0x69')][_0x36fc0f]['group']?_0x41cce9(_0x23fb01[_0xb5fa('0x69')][_0x36fc0f][_0xb5fa('0x6b')]):_0x23fb01['rules'][_0x36fc0f][_0xb5fa('0x6c')]+'\x20'+_0x23fb01[_0xb5fa('0x69')][_0x36fc0f][_0xb5fa('0x6d')]+(_0x1c24e3(_0x23fb01['rules'][_0x36fc0f]['condition'])?'\x20'+_0x23fb01[_0xb5fa('0x69')][_0x36fc0f][_0xb5fa('0x6e')]:'');}return _0x421a93+')';};var _0x432f04={'where':{'id':_0x5caf84['params']['id']}},_0x57d8b7,_0x597206,_0x30d53b,_0x199555,_0x12b0a2;_0x432f04=_['merge']({},_0x432f04,_0x5caf84['options']);return db[_0xb5fa('0x31')][_0xb5fa('0x49')](_0x432f04)[_0xb5fa('0x25')](function(_0x4ce1bd){if(_0x4ce1bd){_0x57d8b7=_0x4ce1bd;return _0x4ce1bd[_0xb5fa('0x6f')]();}return null;})[_0xb5fa('0x25')](function(_0x13ef3a){if(_0x13ef3a){if(!_0x13ef3a[_0xb5fa('0x39')]){throw new db[(_0xb5fa('0x70'))][(_0xb5fa('0x71'))](_0xb5fa('0x72'),0x193);}_0x597206=_0x13ef3a;return db[_0xb5fa('0x73')][_0xb5fa('0x45')]({'raw':!![]});}return null;})[_0xb5fa('0x25')](function(_0x3a1db9){if(_0x3a1db9){_0x30d53b=_[_0xb5fa('0x74')](_0x3a1db9,'id');var _0xecdff3;var _0x38faa6=squel[_0xb5fa('0x75')]();_0x38faa6['from'](_0x57d8b7[_0xb5fa('0x76')]);for(var _0x5a6f74=0x0;_0x5a6f74<_0x597206[_0xb5fa('0x39')];_0x5a6f74+=0x1){_0xecdff3=_0x597206[_0x5a6f74][_0xb5fa('0x77')]?_0x30d53b[_0x597206[_0x5a6f74][_0xb5fa('0x77')]][_0xb5fa('0x78')]:_0x597206[_0x5a6f74][_0xb5fa('0x6c')];_0xecdff3=_0x597206[_0x5a6f74]['function']?_[_0xb5fa('0x79')](_0x4f82f0[_0x597206[_0x5a6f74]['function']],'%s',_0xecdff3):_0xecdff3;_0xecdff3=_0x597206[_0x5a6f74][_0xb5fa('0x7a')]?_[_0xb5fa('0x79')](_0x2b9a45[_0x597206[_0x5a6f74][_0xb5fa('0x7a')]],'%s',_0xecdff3):_0xecdff3;if(_0x597206[_0x5a6f74][_0xb5fa('0x7b')]){_0x38faa6['group'](_0xecdff3);}_0x597206[_0x5a6f74]['orderBy']&&_0x38faa6['order'](_0xecdff3,_0x597206[_0x5a6f74][_0xb5fa('0x7c')]===_0xb5fa('0x7d')?![]:!![]);_0x38faa6[_0xb5fa('0x6c')](_0xecdff3,_0x597206[_0x5a6f74][_0xb5fa('0x7e')]||_0xecdff3);}if(_0x57d8b7[_0xb5fa('0x7f')]){_0x57d8b7[_0xb5fa('0x7f')]=JSON['parse'](_0x57d8b7[_0xb5fa('0x7f')]);for(var _0x5c08e1=0x0;_0x5c08e1<_0x57d8b7['joins'][_0xb5fa('0x39')];_0x5c08e1+=0x1){if(_0x57d8b7['joins'][_0x5c08e1]['type']&&_['includes'](_0x1572fb,_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1]['type'])&&_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1][_0xb5fa('0x80')]&&_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1]['foreignTable']&&_0x57d8b7['joins'][_0x5c08e1][_0xb5fa('0x81')]){_0x38faa6[_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1]['type']](_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1][_0xb5fa('0x82')],null,util[_0xb5fa('0x7a')](_0xb5fa('0x83'),_0x57d8b7['table'],_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1][_0xb5fa('0x80')],_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1][_0xb5fa('0x82')],_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1][_0xb5fa('0x81')]));}}}if(_0x57d8b7[_0xb5fa('0x84')]){_0x57d8b7['conditions']=JSON[_0xb5fa('0x85')](_0x57d8b7['conditions']);_0x38faa6[_0xb5fa('0x3d')](_0x41cce9(_0x57d8b7[_0xb5fa('0x84')]['group']));}_0x12b0a2=_0x38faa6[_0xb5fa('0x86')]();_0x38faa6[_0xb5fa('0x1d')](_0x367f7a);_0x38faa6[_0xb5fa('0x20')](0x0);logger[_0xb5fa('0x87')](_0xb5fa('0x88'),_0x38faa6[_0xb5fa('0x89')]());return dbH[_0xb5fa('0x8a')][_0xb5fa('0x3c')](_0x38faa6['toString'](),{'type':dbH[_0xb5fa('0x8a')][_0xb5fa('0x8b')][_0xb5fa('0x8c')]});}})[_0xb5fa('0x25')](respondWithResult(_0x441c41,null))['catch'](handleError(_0x441c41,null));};function runReport(_0x593386,_0x47d72b,_0x5557a3){var _0x1c60bd=_0x47d72b[_0xb5fa('0x2d')];var _0xff504d=0xa;var _0x188e66=['join','left_join',_0xb5fa('0x56'),'cross_join'];var _0x32eebd={'SUM':_0xb5fa('0x58'),'COUNT':_0xb5fa('0x59'),'COUNT DISTINCT':_0xb5fa('0x8d'),'MAX':'MAX(%s)','MIN':_0xb5fa('0x5b'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xb5fa('0x5c'),'GROUP_CONCAT ASC':_0xb5fa('0x5d'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x5e6852={'SEC_TO_TIME':_0xb5fa('0x5f'),'DATE':_0xb5fa('0x60'),'HOUR':_0xb5fa('0x61'),'ROUND':_0xb5fa('0x62'),'UNIX_TIMESTAMP':_0xb5fa('0x63')};var _0xa7fd3b=function(_0x42e210){return!_[_0xb5fa('0x64')]([_0xb5fa('0x65'),_0xb5fa('0x66'),_0xb5fa('0x67'),_0xb5fa('0x68')],_0x42e210);};var _0x86dfe9=function(_0x53c7b5){if(!_0x53c7b5||!_0x53c7b5['rules'][_0xb5fa('0x39')]){return'';}for(var _0x52384b='(',_0x1cb113=0x0;_0x1cb113<_0x53c7b5[_0xb5fa('0x69')]['length'];_0x1cb113+=0x1){_0x1cb113>0x0&&(_0x52384b+='\x20'+_0x53c7b5[_0xb5fa('0x6a')]+'\x20');_0x52384b+=_0x53c7b5[_0xb5fa('0x69')][_0x1cb113]['group']?_0x86dfe9(_0x53c7b5[_0xb5fa('0x69')][_0x1cb113][_0xb5fa('0x6b')]):_0x53c7b5['rules'][_0x1cb113][_0xb5fa('0x6c')]+'\x20'+_0x53c7b5[_0xb5fa('0x69')][_0x1cb113][_0xb5fa('0x6d')]+(_0xa7fd3b(_0x53c7b5['rules'][_0x1cb113]['condition'])?'\x20'+_0x53c7b5[_0xb5fa('0x69')][_0x1cb113][_0xb5fa('0x6e')]:'');}return _0x52384b+')';};var _0x3b5e1d={'where':{'id':_0x593386['id']}},_0x3d18a9,_0x397830,_0x234d9d,_0x10222c,_0x1eec65;_0x3b5e1d=_[_0xb5fa('0x42')]({},_0x3b5e1d,_0x5557a3);return db[_0xb5fa('0x31')]['find'](_0x3b5e1d)['then'](function(_0x3c5563){if(_0x3c5563){_0x3d18a9=_0x3c5563;return _0x3c5563[_0xb5fa('0x6f')]();}return null;})[_0xb5fa('0x25')](function(_0x18498d){if(_0x18498d){if(!_0x18498d['length']){throw new db[(_0xb5fa('0x70'))][(_0xb5fa('0x71'))](_0xb5fa('0x72'),0x193);}_0x397830=_0x18498d;return db['AnalyticMetric'][_0xb5fa('0x45')]({'raw':!![]});}return null;})[_0xb5fa('0x25')](function(_0x109dd9){if(_0x109dd9){_0x234d9d=_[_0xb5fa('0x74')](_0x109dd9,'id');var _0x5ba2e7;var _0x1175da=squel[_0xb5fa('0x75')]();_0x1175da[_0xb5fa('0x8e')](_0x3d18a9[_0xb5fa('0x76')]);for(var _0x19717a=0x0;_0x19717a<_0x397830[_0xb5fa('0x39')];_0x19717a+=0x1){_0x5ba2e7=_0x397830[_0x19717a][_0xb5fa('0x77')]?_0x234d9d[_0x397830[_0x19717a][_0xb5fa('0x77')]][_0xb5fa('0x78')]:_0x397830[_0x19717a][_0xb5fa('0x6c')];_0x5ba2e7=_0x397830[_0x19717a][_0xb5fa('0x8f')]?_[_0xb5fa('0x79')](_0x32eebd[_0x397830[_0x19717a][_0xb5fa('0x8f')]],'%s',_0x5ba2e7):_0x5ba2e7;_0x5ba2e7=_0x397830[_0x19717a][_0xb5fa('0x7a')]?_[_0xb5fa('0x79')](_0x5e6852[_0x397830[_0x19717a]['format']],'%s',_0x5ba2e7):_0x5ba2e7;if(_0x397830[_0x19717a][_0xb5fa('0x7b')]){_0x1175da[_0xb5fa('0x6b')](_0x5ba2e7);}_0x397830[_0x19717a][_0xb5fa('0x7c')]&&_0x1175da[_0xb5fa('0x90')](_0x5ba2e7,_0x397830[_0x19717a][_0xb5fa('0x7c')]===_0xb5fa('0x7d')?![]:!![]);_0x1175da[_0xb5fa('0x6c')](_0x5ba2e7,_0x397830[_0x19717a][_0xb5fa('0x7e')]||_0x5ba2e7);}if(_0x3d18a9['joins']){_0x3d18a9['joins']=JSON[_0xb5fa('0x85')](_0x3d18a9['joins']);for(var _0x5d0ca8=0x0;_0x5d0ca8<_0x3d18a9[_0xb5fa('0x7f')][_0xb5fa('0x39')];_0x5d0ca8+=0x1){if(_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8]['type']&&_[_0xb5fa('0x64')](_0x188e66,_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8][_0xb5fa('0x33')])&&_0x3d18a9['joins'][_0x5d0ca8][_0xb5fa('0x80')]&&_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8]['foreignTable']&&_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8][_0xb5fa('0x81')]){_0x1175da[_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8][_0xb5fa('0x33')]](_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8][_0xb5fa('0x82')],null,util[_0xb5fa('0x7a')]('%s.%s\x20=\x20%s.%s',_0x3d18a9[_0xb5fa('0x76')],_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8][_0xb5fa('0x80')],_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8]['foreignTable'],_0x3d18a9['joins'][_0x5d0ca8][_0xb5fa('0x81')]));}}}if(_0x3d18a9[_0xb5fa('0x84')]){_0x3d18a9[_0xb5fa('0x84')]=JSON[_0xb5fa('0x85')](_0x3d18a9['conditions']);_0x1175da['where'](_0x86dfe9(_0x3d18a9['conditions']['group']));}_0x1eec65=_0x1175da[_0xb5fa('0x86')]();_0x1175da[_0xb5fa('0x1d')](_0xff504d);_0x1175da[_0xb5fa('0x20')](0x0);return;}})[_0xb5fa('0x25')](function(){if(_0x47d72b[_0xb5fa('0x91')]===_0xb5fa('0x92')){return null;}var _0x3c36a8=_[_0xb5fa('0x42')](_0x47d72b,{'name':_0x47d72b[_0xb5fa('0x93')]||_0x47d72b[_0xb5fa('0x2d')]||_0x3d18a9[_0xb5fa('0x2d')],'basename':_0x1c60bd,'savename':util['format'](_0xb5fa('0x94'),_0x47d72b[_0xb5fa('0x2d')]||_0x3d18a9['name'],require(_0xb5fa('0x95'))[_0xb5fa('0x96')](0x4),_0x47d72b['output']||_0xb5fa('0x97')),'reportId':_0x3d18a9['id'],'reportType':_0xb5fa('0x98')});return db[_0xb5fa('0x99')][_0xb5fa('0x4a')](_0x3c36a8,{'raw':!![]});})[_0xb5fa('0x25')](function(_0x2b449a){if(_0x3d18a9[_0xb5fa('0x76')]===_0xb5fa('0x9a')){_0x1eec65[_0xb5fa('0x3d')](_0x3d18a9['table']+_0xb5fa('0x9b'),_0x47d72b[_0xb5fa('0x9c')],_0x47d72b[_0xb5fa('0x9d')]);}else{_0x1eec65[_0xb5fa('0x3d')](_0x3d18a9[_0xb5fa('0x76')]+_0xb5fa('0x9e'),_0x47d72b[_0xb5fa('0x9c')],_0x47d72b[_0xb5fa('0x9d')]);}if(_0x2b449a){logger['info'](_0xb5fa('0x9f'),_0x1eec65['toString']());require(_0xb5fa('0xa0'))[_0xb5fa('0xa1')](path[_0xb5fa('0x54')](__dirname,_0xb5fa('0xa2'),_0x2b449a[_0xb5fa('0x91')]),[_0x2b449a['id'],_0x1eec65[_0xb5fa('0x89')](),path[_0xb5fa('0x54')](__dirname,_0xb5fa('0xa3'),_0x2b449a[_0xb5fa('0xa4')]),_0x1c60bd]);return _0x2b449a;}else{var _0x4bb9b4=squel['select']();_0x4bb9b4[_0xb5fa('0x8e')]('('+_0x1eec65[_0xb5fa('0x89')]()+')',_0xb5fa('0xa5'));_0x4bb9b4[_0xb5fa('0x6c')]('COUNT(*)',_0xb5fa('0x1f'));_0x1eec65['limit'](_0x47d72b[_0xb5fa('0x1d')]||_0xff504d);_0x1eec65[_0xb5fa('0x20')](_0x47d72b['offset']||0x0);return dbH[_0xb5fa('0x8a')]['query'](_0x4bb9b4[_0xb5fa('0x89')](),{'type':dbH['sequelize'][_0xb5fa('0x8b')][_0xb5fa('0x8c')]})[_0xb5fa('0x25')](function(_0x70e4ae){if(!_0x70e4ae[_0xb5fa('0x39')]){_0x10222c=0x0;}else{_0x10222c=_0x70e4ae[0x0][_0xb5fa('0x1f')]||0x0;}return dbH[_0xb5fa('0x8a')][_0xb5fa('0x3c')](_0x1eec65[_0xb5fa('0x89')](),{'type':dbH[_0xb5fa('0x8a')][_0xb5fa('0x8b')]['SELECT']});})[_0xb5fa('0x25')](function(_0x284b34){return{'rows':_0x284b34||[],'count':_0x10222c};});}});}exports[_0xb5fa('0xa6')]=function(_0x497931,_0x2145d8){return runReport(_0x497931[_0xb5fa('0xa7')],_0x497931[_0xb5fa('0x3c')],_0x497931[_0xb5fa('0x43')])[_0xb5fa('0x25')](respondWithResult(_0x2145d8,null))[_0xb5fa('0x47')](handleError(_0x2145d8,null));};exports[_0xb5fa('0xa8')]=runReport;exports[_0xb5fa('0x3c')]=function(_0x59fd75,_0x245ee1){var _0x5c1e1f=0xa;var _0x3ba723=[_0xb5fa('0x54'),_0xb5fa('0x55'),_0xb5fa('0x56'),_0xb5fa('0x57')];var _0x105c0f={'SUM':_0xb5fa('0x58'),'COUNT':_0xb5fa('0x59'),'COUNT DISTINCT':_0xb5fa('0x8d'),'MAX':_0xb5fa('0x5a'),'MIN':_0xb5fa('0x5b'),'AVG':_0xb5fa('0xa9'),'GROUP_CONCAT':_0xb5fa('0x5c'),'GROUP_CONCAT ASC':_0xb5fa('0x5d'),'GROUP_CONCAT DESC':_0xb5fa('0x5e')};var _0x41e086={'SEC_TO_TIME':_0xb5fa('0x5f'),'DATE':'DATE(%s)','HOUR':_0xb5fa('0x61'),'ROUND':_0xb5fa('0x62'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0xd34c31=function(_0x2e614e){return!_['includes'](['IS\x20NULL','IS\x20NOT\x20NULL',_0xb5fa('0x67'),_0xb5fa('0x68')],_0x2e614e);};var _0x1aae82=function(_0x474bb){if(!_0x474bb||!_0x474bb[_0xb5fa('0x69')][_0xb5fa('0x39')]){return'';}for(var _0x17ae50='(',_0x51c9ba=0x0;_0x51c9ba<_0x474bb['rules']['length'];_0x51c9ba+=0x1){_0x51c9ba>0x0&&(_0x17ae50+='\x20'+_0x474bb[_0xb5fa('0x6a')]+'\x20');_0x17ae50+=_0x474bb['rules'][_0x51c9ba]['group']?_0x1aae82(_0x474bb[_0xb5fa('0x69')][_0x51c9ba]['group']):_0x474bb[_0xb5fa('0x69')][_0x51c9ba][_0xb5fa('0x6c')]+'\x20'+_0x474bb[_0xb5fa('0x69')][_0x51c9ba][_0xb5fa('0x6d')]+(_0xd34c31(_0x474bb[_0xb5fa('0x69')][_0x51c9ba]['condition'])?'\x20'+_0x474bb[_0xb5fa('0x69')][_0x51c9ba][_0xb5fa('0x6e')]:'');}return _0x17ae50+')';};var _0x2fe715={'where':{'id':_0x59fd75[_0xb5fa('0xa7')]['id']}},_0x3c5ac4,_0x23b70f,_0x488818,_0x15b228,_0x42fd84;_0x2fe715=_[_0xb5fa('0x42')]({},_0x2fe715,_0x59fd75[_0xb5fa('0x43')]);return db[_0xb5fa('0x31')]['find'](_0x2fe715)[_0xb5fa('0x25')](function(_0x390043){if(_0x390043){_0x3c5ac4=_0x390043;return _0x390043[_0xb5fa('0x6f')]();}return null;})[_0xb5fa('0x25')](function(_0x32c191){if(_0x32c191){if(!_0x32c191[_0xb5fa('0x39')]){throw new db[(_0xb5fa('0x70'))][(_0xb5fa('0x71'))](_0xb5fa('0x72'),0x193);}_0x23b70f=_0x32c191;return db[_0xb5fa('0x73')][_0xb5fa('0x45')]({'raw':!![]});}return null;})[_0xb5fa('0x25')](function(_0x1d307c){if(_0x1d307c){_0x488818=_[_0xb5fa('0x74')](_0x1d307c,'id');var _0x3347eb;var _0x349e0b=squel[_0xb5fa('0x75')]();_0x349e0b[_0xb5fa('0x8e')](_0x3c5ac4[_0xb5fa('0x76')]);for(var _0x2b1c3f=0x0;_0x2b1c3f<_0x23b70f[_0xb5fa('0x39')];_0x2b1c3f+=0x1){_0x3347eb=_0x23b70f[_0x2b1c3f][_0xb5fa('0x77')]?_0x488818[_0x23b70f[_0x2b1c3f]['MetricId']]['metric']:_0x23b70f[_0x2b1c3f][_0xb5fa('0x6c')];_0x3347eb=_0x23b70f[_0x2b1c3f][_0xb5fa('0x8f')]?_[_0xb5fa('0x79')](_0x105c0f[_0x23b70f[_0x2b1c3f][_0xb5fa('0x8f')]],'%s',_0x3347eb):_0x3347eb;_0x3347eb=_0x23b70f[_0x2b1c3f][_0xb5fa('0x7a')]?_[_0xb5fa('0x79')](_0x41e086[_0x23b70f[_0x2b1c3f]['format']],'%s',_0x3347eb):_0x3347eb;if(_0x23b70f[_0x2b1c3f]['groupBy']){_0x349e0b['group'](_0x3347eb);}_0x23b70f[_0x2b1c3f][_0xb5fa('0x7c')]&&_0x349e0b[_0xb5fa('0x90')](_0x3347eb,_0x23b70f[_0x2b1c3f]['orderBy']===_0xb5fa('0x7d')?![]:!![]);_0x349e0b[_0xb5fa('0x6c')](_0x3347eb,_0x23b70f[_0x2b1c3f]['alias']||_0x3347eb);}if(_0x3c5ac4[_0xb5fa('0x7f')]){_0x3c5ac4[_0xb5fa('0x7f')]=JSON[_0xb5fa('0x85')](_0x3c5ac4[_0xb5fa('0x7f')]);for(var _0x10dbdf=0x0;_0x10dbdf<_0x3c5ac4[_0xb5fa('0x7f')][_0xb5fa('0x39')];_0x10dbdf+=0x1){if(_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf]['type']&&_[_0xb5fa('0x64')](_0x3ba723,_0x3c5ac4['joins'][_0x10dbdf][_0xb5fa('0x33')])&&_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf][_0xb5fa('0x80')]&&_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf]['foreignTable']&&_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf][_0xb5fa('0x81')]){_0x349e0b[_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf][_0xb5fa('0x33')]](_0x3c5ac4['joins'][_0x10dbdf][_0xb5fa('0x82')],null,util[_0xb5fa('0x7a')](_0xb5fa('0x83'),_0x3c5ac4[_0xb5fa('0x76')],_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf][_0xb5fa('0x80')],_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf]['foreignTable'],_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf]['foreignKey']));}}}if(_0x3c5ac4[_0xb5fa('0x84')]){_0x3c5ac4[_0xb5fa('0x84')]=JSON[_0xb5fa('0x85')](_0x3c5ac4[_0xb5fa('0x84')]);_0x349e0b[_0xb5fa('0x3d')](_0x1aae82(_0x3c5ac4[_0xb5fa('0x84')][_0xb5fa('0x6b')]));}_0x42fd84=_0x349e0b['clone']();_0x349e0b['limit'](_0x5c1e1f);_0x349e0b[_0xb5fa('0x20')](0x0);logger[_0xb5fa('0x87')](_0xb5fa('0x88'),_0x349e0b[_0xb5fa('0x89')]());return dbH[_0xb5fa('0x8a')][_0xb5fa('0x3c')](_0x349e0b[_0xb5fa('0x89')](),{'type':dbH[_0xb5fa('0x8a')]['QueryTypes'][_0xb5fa('0x8c')]});}})[_0xb5fa('0x25')](function(){return{'sql':_0x42fd84[_0xb5fa('0x89')]()};})[_0xb5fa('0x25')](respondWithResult(_0x245ee1,null))[_0xb5fa('0x47')](handleError(_0x245ee1,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 5c18ea6..57d3aea 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 _0x6a90=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','AnalyticDefaultReport','analytics_default_reports'];(function(_0x264939,_0x3b0e5b){var _0x8db56e=function(_0x24a202){while(--_0x24a202){_0x264939['push'](_0x264939['shift']());}};_0x8db56e(++_0x3b0e5b);}(_0x6a90,0x111));var _0x06a9=function(_0x3ce3eb,_0x3e636a){_0x3ce3eb=_0x3ce3eb-0x0;var _0x10ee51=_0x6a90[_0x3ce3eb];return _0x10ee51;};'use strict';var _=require(_0x06a9('0x0'));var util=require(_0x06a9('0x1'));var logger=require(_0x06a9('0x2'))(_0x06a9('0x3'));var moment=require(_0x06a9('0x4'));var BPromise=require(_0x06a9('0x5'));var rp=require(_0x06a9('0x6'));var fs=require('fs');var path=require(_0x06a9('0x7'));var rimraf=require(_0x06a9('0x8'));var config=require(_0x06a9('0x9'));var attributes=require('./analyticDefaultReport.attributes');module[_0x06a9('0xa')]=function(_0x1cb8c3,_0x2933a1){return _0x1cb8c3['define'](_0x06a9('0xb'),attributes,{'tableName':_0x06a9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbe75=['path','rimraf','../../config/environment','analytics_default_reports','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2cbd8c,_0x4f5428){var _0xf554ad=function(_0x5a5883){while(--_0x5a5883){_0x2cbd8c['push'](_0x2cbd8c['shift']());}};_0xf554ad(++_0x4f5428);}(_0xbe75,0x185));var _0x5be7=function(_0xfe28fe,_0x2e1f7b){_0xfe28fe=_0xfe28fe-0x0;var _0xf007af=_0xbe75[_0xfe28fe];return _0xf007af;};'use strict';var _=require(_0x5be7('0x0'));var util=require(_0x5be7('0x1'));var logger=require(_0x5be7('0x2'))(_0x5be7('0x3'));var moment=require(_0x5be7('0x4'));var BPromise=require(_0x5be7('0x5'));var rp=require(_0x5be7('0x6'));var fs=require('fs');var path=require(_0x5be7('0x7'));var rimraf=require(_0x5be7('0x8'));var config=require(_0x5be7('0x9'));var attributes=require('./analyticDefaultReport.attributes');module['exports']=function(_0x2078f8,_0x14618e){return _0x2078f8['define']('AnalyticDefaultReport',attributes,{'tableName':_0x5be7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index a6e409b..92a8fbd 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 _0x8fec=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment'];(function(_0x5cce5a,_0x298d54){var _0x354e33=function(_0xb372cf){while(--_0xb372cf){_0x5cce5a['push'](_0x5cce5a['shift']());}};_0x354e33(++_0x298d54);}(_0x8fec,0x157));var _0xc8fe=function(_0x4bbd76,_0x4ab867){_0x4bbd76=_0x4bbd76-0x0;var _0x1b5170=_0x8fec[_0x4bbd76];return _0x1b5170;};'use strict';var _=require('lodash');var util=require(_0xc8fe('0x0'));var moment=require(_0xc8fe('0x1'));var BPromise=require(_0xc8fe('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc8fe('0x3'));var db=require(_0xc8fe('0x4'))['db'];var utils=require(_0xc8fe('0x5'));var logger=require(_0xc8fe('0x6'))(_0xc8fe('0x7'));var config=require(_0xc8fe('0x8'));var jayson=require(_0xc8fe('0x9'));var client=jayson[_0xc8fe('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x10a41e,_0x186345,_0x105ace){return new BPromise(function(_0x3be2c8,_0x1deb53){return client[_0xc8fe('0xb')](_0x10a41e,_0x105ace)[_0xc8fe('0xc')](function(_0x3c8dfe){logger[_0xc8fe('0xd')](_0xc8fe('0xe'),_0x186345,_0xc8fe('0xf'));logger[_0xc8fe('0x10')](_0xc8fe('0x11'),_0x186345,_0xc8fe('0xf'),JSON[_0xc8fe('0x12')](_0x3c8dfe));if(_0x3c8dfe[_0xc8fe('0x13')]){if(_0x3c8dfe[_0xc8fe('0x13')]['code']===0x1f4){logger[_0xc8fe('0x13')](_0xc8fe('0xe'),_0x186345,_0x3c8dfe['error'][_0xc8fe('0x14')]);return _0x1deb53(_0x3c8dfe[_0xc8fe('0x13')][_0xc8fe('0x14')]);}logger[_0xc8fe('0x13')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x186345,_0x3c8dfe[_0xc8fe('0x13')]['message']);return _0x3be2c8(_0x3c8dfe[_0xc8fe('0x13')][_0xc8fe('0x14')]);}else{logger[_0xc8fe('0xd')](_0xc8fe('0xe'),_0x186345,_0xc8fe('0xf'));_0x3be2c8(_0x3c8dfe[_0xc8fe('0x15')][_0xc8fe('0x14')]);}})[_0xc8fe('0x16')](function(_0x3dc234){logger['error'](_0xc8fe('0xe'),_0x186345,_0x3dc234);_0x1deb53(_0x3dc234);});});} \ No newline at end of file +var _0x3042=['../../config/logger','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','AnalyticDefaultReport,\x20%s,\x20%s','result','catch','lodash','moment','randomstring','../../mysqldb'];(function(_0x987fe6,_0x24ac32){var _0x4fb549=function(_0x14a3d0){while(--_0x14a3d0){_0x987fe6['push'](_0x987fe6['shift']());}};_0x4fb549(++_0x24ac32);}(_0x3042,0x137));var _0x2304=function(_0x368e09,_0x2c1517){_0x368e09=_0x368e09-0x0;var _0x14b7df=_0x3042[_0x368e09];return _0x14b7df;};'use strict';var _=require(_0x2304('0x0'));var util=require('util');var moment=require(_0x2304('0x1'));var BPromise=require('bluebird');var rs=require(_0x2304('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2304('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x2304('0x4'))('rpc');var config=require(_0x2304('0x5'));var jayson=require(_0x2304('0x6'));var client=jayson[_0x2304('0x7')][_0x2304('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4ada64,_0x2bb25e,_0x5cf342){return new BPromise(function(_0x2695c5,_0x5583ee){return client['request'](_0x4ada64,_0x5cf342)[_0x2304('0x9')](function(_0x3e6b6b){logger[_0x2304('0xa')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x2bb25e,_0x2304('0xb'));logger[_0x2304('0xc')](_0x2304('0xd'),_0x2bb25e,_0x2304('0xb'),JSON[_0x2304('0xe')](_0x3e6b6b));if(_0x3e6b6b['error']){if(_0x3e6b6b['error'][_0x2304('0xf')]===0x1f4){logger[_0x2304('0x10')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x2bb25e,_0x3e6b6b[_0x2304('0x10')][_0x2304('0x11')]);return _0x5583ee(_0x3e6b6b[_0x2304('0x10')][_0x2304('0x11')]);}logger[_0x2304('0x10')](_0x2304('0x12'),_0x2bb25e,_0x3e6b6b[_0x2304('0x10')][_0x2304('0x11')]);return _0x2695c5(_0x3e6b6b[_0x2304('0x10')][_0x2304('0x11')]);}else{logger[_0x2304('0xa')](_0x2304('0x12'),_0x2bb25e,_0x2304('0xb'));_0x2695c5(_0x3e6b6b[_0x2304('0x13')][_0x2304('0x11')]);}})[_0x2304('0x14')](function(_0x487bf6){logger['error'](_0x2304('0x12'),_0x2bb25e,_0x487bf6);_0x5583ee(_0x487bf6);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 63c2019..b24ce77 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 _0x03a6=['util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','preview','/:id/run','run','/:id/query','query','post','create','update','delete','destroy','exports','multer'];(function(_0x2cadf8,_0x4995a1){var _0x4b878d=function(_0x5b67df){while(--_0x5b67df){_0x2cadf8['push'](_0x2cadf8['shift']());}};_0x4b878d(++_0x4995a1);}(_0x03a6,0xcf));var _0x603a=function(_0x5332ed,_0x5c6196){_0x5332ed=_0x5332ed-0x0;var _0x4576ac=_0x03a6[_0x5332ed];return _0x4576ac;};'use strict';var multer=require(_0x603a('0x0'));var util=require(_0x603a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x603a('0x2'));var router=express[_0x603a('0x3')]();var fs_extra=require(_0x603a('0x4'));var auth=require(_0x603a('0x5'));var interaction=require(_0x603a('0x6'));var config=require(_0x603a('0x7'));var controller=require(_0x603a('0x8'));router[_0x603a('0x9')]('/',auth[_0x603a('0xa')](),controller[_0x603a('0xb')]);router[_0x603a('0x9')](_0x603a('0xc'),auth[_0x603a('0xa')](),controller[_0x603a('0xd')]);router['get'](_0x603a('0xe'),auth[_0x603a('0xa')](),controller[_0x603a('0xf')]);router[_0x603a('0x9')](_0x603a('0x10'),auth[_0x603a('0xa')](),controller[_0x603a('0x11')]);router[_0x603a('0x9')](_0x603a('0x12'),auth[_0x603a('0xa')](),controller[_0x603a('0x13')]);router[_0x603a('0x14')]('/',auth[_0x603a('0xa')](),controller[_0x603a('0x15')]);router['put'](_0x603a('0xc'),auth[_0x603a('0xa')](),controller[_0x603a('0x16')]);router[_0x603a('0x17')](_0x603a('0xc'),auth[_0x603a('0xa')](),controller[_0x603a('0x18')]);module[_0x603a('0x19')]=router; \ No newline at end of file +var _0xae93=['/:id/query','post','put','/:id','update','delete','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','show','/:id/preview','/:id/run','run'];(function(_0x45c48f,_0x4aa891){var _0xaf5037=function(_0x3e3c1f){while(--_0x3e3c1f){_0x45c48f['push'](_0x45c48f['shift']());}};_0xaf5037(++_0x4aa891);}(_0xae93,0x1be));var _0x3ae9=function(_0x453c9f,_0x563800){_0x453c9f=_0x453c9f-0x0;var _0x3b22d3=_0xae93[_0x453c9f];return _0x3b22d3;};'use strict';var multer=require(_0x3ae9('0x0'));var util=require(_0x3ae9('0x1'));var path=require('path');var timeout=require(_0x3ae9('0x2'));var express=require(_0x3ae9('0x3'));var router=express[_0x3ae9('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x3ae9('0x5'));var interaction=require(_0x3ae9('0x6'));var config=require(_0x3ae9('0x7'));var controller=require(_0x3ae9('0x8'));router[_0x3ae9('0x9')]('/',auth[_0x3ae9('0xa')](),controller[_0x3ae9('0xb')]);router[_0x3ae9('0x9')]('/:id',auth[_0x3ae9('0xa')](),controller[_0x3ae9('0xc')]);router[_0x3ae9('0x9')](_0x3ae9('0xd'),auth[_0x3ae9('0xa')](),controller['preview']);router[_0x3ae9('0x9')](_0x3ae9('0xe'),auth[_0x3ae9('0xa')](),controller[_0x3ae9('0xf')]);router[_0x3ae9('0x9')](_0x3ae9('0x10'),auth[_0x3ae9('0xa')](),controller['query']);router[_0x3ae9('0x11')]('/',auth[_0x3ae9('0xa')](),controller['create']);router[_0x3ae9('0x12')](_0x3ae9('0x13'),auth[_0x3ae9('0xa')](),controller[_0x3ae9('0x14')]);router[_0x3ae9('0x15')](_0x3ae9('0x13'),auth['isAuthenticated'](),controller['destroy']);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 38ef375..37e28a3 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 _0xedc4=['ENUM','csv','xlsx','Loading','scheduled','INTEGER','UNSIGNED','sequelize','moment','exports','STRING'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0xedc4,0x130));var _0x4edc=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xedc4[_0x21a9d9];return _0x46adce;};'use strict';var Sequelize=require(_0x4edc('0x0'));var moment=require(_0x4edc('0x1'));module[_0x4edc('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0x4edc('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0x4edc('0x4')](_0x4edc('0x5'),'pdf',_0x4edc('0x6')),'allowNull':![],'defaultValue':_0x4edc('0x5')},'savename':{'type':Sequelize[_0x4edc('0x3')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize[_0x4edc('0x3')],'defaultValue':_0x4edc('0x7')},'type':{'type':Sequelize[_0x4edc('0x4')]('manual',_0x4edc('0x8')),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize[_0x4edc('0x9')](0xb)[_0x4edc('0xa')]},'reportType':{'type':Sequelize[_0x4edc('0x3')]}}; \ No newline at end of file +var _0x697e=['pdf','xlsx','DATE','Loading','manual','scheduled','UNSIGNED','sequelize','moment','STRING','ENUM','csv'];(function(_0x256e69,_0xa87315){var _0xd5c0e4=function(_0x4a7ab9){while(--_0x4a7ab9){_0x256e69['push'](_0x256e69['shift']());}};_0xd5c0e4(++_0xa87315);}(_0x697e,0xa3));var _0xe697=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x697e[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xe697('0x0'));var moment=require(_0xe697('0x1'));module['exports']={'name':{'type':Sequelize[_0xe697('0x2')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0xe697('0x3')](_0xe697('0x4'),_0xe697('0x5'),_0xe697('0x6')),'allowNull':![],'defaultValue':_0xe697('0x4')},'savename':{'type':Sequelize[_0xe697('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0xe697('0x7')]},'endDate':{'type':Sequelize[_0xe697('0x7')]},'status':{'type':Sequelize[_0xe697('0x2')],'defaultValue':_0xe697('0x8')},'type':{'type':Sequelize[_0xe697('0x3')](_0xe697('0x9'),_0xe697('0xa')),'allowNull':![],'defaultValue':_0xe697('0x9')},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0xe697('0xb')]},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 27c1b2f..11b6f8b 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 _0x7a7c=['limit','set','Content-Range','apply','update','destroy','get','ExtractedReports','UserProfileResource','then','sendStatus','stack','name','send','index','AnalyticExtractedReport','rawAttributes','fieldName','model','map','query','filters','intersection','attributes','length','nolimit','sort','filter','where','type','VIRTUAL','count','includeAll','include','params','keys','fields','merge','options','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','basename','output','join','root','server/files/reports','ValidationError','exists','savename','format','toLowerCase','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','status','end','offset','undefined'];(function(_0x340e0a,_0x3eba67){var _0x41bb2a=function(_0x100c98){while(--_0x100c98){_0x340e0a['push'](_0x340e0a['shift']());}};_0x41bb2a(++_0x3eba67);}(_0x7a7c,0x1ef));var _0xc7a7=function(_0x196993,_0x1075aa){_0x196993=_0x196993-0x0;var _0xb20f05=_0x7a7c[_0x196993];return _0xb20f05;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc7a7('0x0'));var jsonpatch=require(_0xc7a7('0x1'));var rp=require(_0xc7a7('0x2'));var moment=require(_0xc7a7('0x3'));var BPromise=require(_0xc7a7('0x4'));var Mustache=require(_0xc7a7('0x5'));var util=require(_0xc7a7('0x6'));var path=require(_0xc7a7('0x7'));var sox=require(_0xc7a7('0x8'));var csv=require(_0xc7a7('0x9'));var ejs=require(_0xc7a7('0xa'));var fs=require('fs');var fs_extra=require(_0xc7a7('0xb'));var _=require(_0xc7a7('0xc'));var squel=require(_0xc7a7('0xd'));var crypto=require('crypto');var jsforce=require(_0xc7a7('0xe'));var deskjs=require(_0xc7a7('0xf'));var toCsv=require(_0xc7a7('0x9'));var querystring=require('querystring');var Papa=require(_0xc7a7('0x10'));var Redis=require(_0xc7a7('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc7a7('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc7a7('0x13'))(_0xc7a7('0x14'));var utils=require(_0xc7a7('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xc7a7('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xb9181,_0x3f3f3a){_0x3f3f3a=_0x3f3f3a||0xcc;return function(_0x5f2aaa){if(_0x5f2aaa){return _0xb9181['sendStatus'](_0x3f3f3a);}return _0xb9181[_0xc7a7('0x17')](_0x3f3f3a)[_0xc7a7('0x18')]();};}function respondWithResult(_0x12fd4e,_0x560516){_0x560516=_0x560516||0xc8;return function(_0x4b5104){if(_0x4b5104){return _0x12fd4e['status'](_0x560516)['json'](_0x4b5104);}};}function respondWithFilteredResult(_0x5bdeb4,_0x393332){return function(_0x280646){if(_0x280646){var _0x42070b=typeof _0x393332[_0xc7a7('0x19')]===_0xc7a7('0x1a')&&typeof _0x393332[_0xc7a7('0x1b')]===_0xc7a7('0x1a');var _0x2c101d=_0x280646['count'];var _0x1e7199=_0x42070b?0x0:_0x393332['offset'];var _0x139609=_0x42070b?_0x280646['count']:_0x393332['offset']+_0x393332[_0xc7a7('0x1b')];var _0x346978;if(_0x139609>=_0x2c101d){_0x139609=_0x2c101d;_0x346978=0xc8;}else{_0x346978=0xce;}_0x5bdeb4[_0xc7a7('0x17')](_0x346978);return _0x5bdeb4[_0xc7a7('0x1c')](_0xc7a7('0x1d'),_0x1e7199+'-'+_0x139609+'/'+_0x2c101d)['json'](_0x280646);}return null;};}function patchUpdates(_0x1708e8){return function(_0x4e8b85){try{jsonpatch[_0xc7a7('0x1e')](_0x4e8b85,_0x1708e8,!![]);}catch(_0x590c24){return BPromise['reject'](_0x590c24);}return _0x4e8b85['save']();};}function saveUpdates(_0x14cf18,_0x2893f4){return function(_0x21822c){if(_0x21822c){return _0x21822c[_0xc7a7('0x1f')](_0x14cf18)['then'](function(_0x43dd29){return _0x43dd29;});}return null;};}function removeEntity(_0x1914c2,_0x1a4afd){return function(_0x4f78eb){if(_0x4f78eb){return _0x4f78eb[_0xc7a7('0x20')]()['then'](function(){var _0x6eff14=_0x4f78eb[_0xc7a7('0x21')]({'plain':!![]});var _0x1ef960=_0xc7a7('0x22');return db[_0xc7a7('0x23')][_0xc7a7('0x20')]({'where':{'type':_0x1ef960,'resourceId':_0x6eff14['id']}})[_0xc7a7('0x24')](function(){return _0x4f78eb;});})[_0xc7a7('0x24')](function(){_0x1914c2['status'](0xcc)[_0xc7a7('0x18')]();});}};}function handleEntityNotFound(_0x33a186,_0x48767e){return function(_0x5b4559){if(!_0x5b4559){_0x33a186[_0xc7a7('0x25')](0x194);}return _0x5b4559;};}function handleError(_0xbb42bb,_0x834d0e){_0x834d0e=_0x834d0e||0x1f4;return function(_0x354d68){logger['error'](_0x354d68[_0xc7a7('0x26')]);if(_0x354d68[_0xc7a7('0x27')]){delete _0x354d68['name'];}_0xbb42bb[_0xc7a7('0x17')](_0x834d0e)[_0xc7a7('0x28')](_0x354d68);};}exports[_0xc7a7('0x29')]=function(_0x29e2b0,_0x26515b){var _0x194f1b={},_0x29e5c6={},_0x1087d9={'count':0x0,'rows':[]};var _0x1ca0f8=_['map'](db[_0xc7a7('0x2a')][_0xc7a7('0x2b')],function(_0x3a0e50){return{'name':_0x3a0e50[_0xc7a7('0x2c')],'type':_0x3a0e50['type']['key']};});_0x29e5c6[_0xc7a7('0x2d')]=_[_0xc7a7('0x2e')](_0x1ca0f8,_0xc7a7('0x27'));_0x29e5c6[_0xc7a7('0x2f')]=_['keys'](_0x29e2b0['query']);_0x29e5c6[_0xc7a7('0x30')]=_[_0xc7a7('0x31')](_0x29e5c6[_0xc7a7('0x2d')],_0x29e5c6[_0xc7a7('0x2f')]);_0x194f1b[_0xc7a7('0x32')]=_[_0xc7a7('0x31')](_0x29e5c6['model'],qs['fields'](_0x29e2b0[_0xc7a7('0x2f')]['fields']));_0x194f1b[_0xc7a7('0x32')]=_0x194f1b[_0xc7a7('0x32')][_0xc7a7('0x33')]?_0x194f1b[_0xc7a7('0x32')]:_0x29e5c6['model'];if(!_0x29e2b0['query']['hasOwnProperty'](_0xc7a7('0x34'))){_0x194f1b[_0xc7a7('0x1b')]=qs[_0xc7a7('0x1b')](_0x29e2b0[_0xc7a7('0x2f')]['limit']);_0x194f1b[_0xc7a7('0x19')]=qs[_0xc7a7('0x19')](_0x29e2b0['query'][_0xc7a7('0x19')]);}_0x194f1b['order']=qs[_0xc7a7('0x35')](_0x29e2b0['query'][_0xc7a7('0x35')]);_0x194f1b['where']=qs[_0xc7a7('0x30')](_['pick'](_0x29e2b0[_0xc7a7('0x2f')],_0x29e5c6[_0xc7a7('0x30')]),_0x1ca0f8);if(_0x29e2b0[_0xc7a7('0x2f')][_0xc7a7('0x36')]){_0x194f1b[_0xc7a7('0x37')]=_['merge'](_0x194f1b[_0xc7a7('0x37')],{'$or':_['map'](_0x1ca0f8,function(_0x29c13a){if(_0x29c13a[_0xc7a7('0x38')]!==_0xc7a7('0x39')){var _0xbdcae8={};_0xbdcae8[_0x29c13a[_0xc7a7('0x27')]]={'$like':'%'+_0x29e2b0['query'][_0xc7a7('0x36')]+'%'};return _0xbdcae8;}})});}_0x194f1b=_['merge']({},_0x194f1b,_0x29e2b0['options']);var _0x5885c6={'where':_0x194f1b[_0xc7a7('0x37')]};return db[_0xc7a7('0x2a')][_0xc7a7('0x3a')](_0x5885c6)[_0xc7a7('0x24')](function(_0x17c816){_0x1087d9[_0xc7a7('0x3a')]=_0x17c816;if(_0x29e2b0['query'][_0xc7a7('0x3b')]){_0x194f1b[_0xc7a7('0x3c')]=[{'all':!![]}];}return db['AnalyticExtractedReport']['findAll'](_0x194f1b);})[_0xc7a7('0x24')](function(_0x49eed5){_0x1087d9['rows']=_0x49eed5;return _0x1087d9;})['then'](respondWithFilteredResult(_0x26515b,_0x194f1b))['catch'](handleError(_0x26515b,null));};exports['show']=function(_0x31ea58,_0x38167e){var _0x4437a6={'raw':!![],'where':{'id':_0x31ea58[_0xc7a7('0x3d')]['id']}},_0x4b6e85={};_0x4b6e85['model']=_['keys'](db['AnalyticExtractedReport'][_0xc7a7('0x2b')]);_0x4b6e85['query']=_[_0xc7a7('0x3e')](_0x31ea58[_0xc7a7('0x2f')]);_0x4b6e85['filters']=_[_0xc7a7('0x31')](_0x4b6e85[_0xc7a7('0x2d')],_0x4b6e85[_0xc7a7('0x2f')]);_0x4437a6[_0xc7a7('0x32')]=_[_0xc7a7('0x31')](_0x4b6e85[_0xc7a7('0x2d')],qs[_0xc7a7('0x3f')](_0x31ea58['query']['fields']));_0x4437a6[_0xc7a7('0x32')]=_0x4437a6[_0xc7a7('0x32')]['length']?_0x4437a6[_0xc7a7('0x32')]:_0x4b6e85[_0xc7a7('0x2d')];if(_0x31ea58[_0xc7a7('0x2f')][_0xc7a7('0x3b')]){_0x4437a6[_0xc7a7('0x3c')]=[{'all':!![]}];}_0x4437a6=_[_0xc7a7('0x40')]({},_0x4437a6,_0x31ea58[_0xc7a7('0x41')]);return db[_0xc7a7('0x2a')]['find'](_0x4437a6)[_0xc7a7('0x24')](handleEntityNotFound(_0x38167e,null))[_0xc7a7('0x24')](respondWithResult(_0x38167e,null))[_0xc7a7('0x42')](handleError(_0x38167e,null));};exports[_0xc7a7('0x43')]=function(_0x3b0474,_0x438a0a){return db[_0xc7a7('0x2a')][_0xc7a7('0x43')](_0x3b0474[_0xc7a7('0x44')],{})['then'](function(_0x25aaf0){var _0xf09572=_0x3b0474[_0xc7a7('0x45')][_0xc7a7('0x21')]({'plain':!![]});if(!_0xf09572)throw new Error(_0xc7a7('0x46'));if(_0xf09572[_0xc7a7('0x47')]===_0xc7a7('0x45')){var _0x220755=_0x25aaf0[_0xc7a7('0x21')]({'plain':!![]});var _0x1b9c79=_0xc7a7('0x22');return db['UserProfileSection'][_0xc7a7('0x48')]({'where':{'name':_0x1b9c79,'userProfileId':_0xf09572['userProfileId']},'raw':!![]})[_0xc7a7('0x24')](function(_0x244fce){if(_0x244fce&&_0x244fce[_0xc7a7('0x49')]===0x0){return db['UserProfileResource'][_0xc7a7('0x43')]({'name':_0x220755[_0xc7a7('0x27')],'resourceId':_0x220755['id'],'type':_0x244fce[_0xc7a7('0x27')],'sectionId':_0x244fce['id']},{})[_0xc7a7('0x24')](function(){return _0x25aaf0;});}else{return _0x25aaf0;}})[_0xc7a7('0x42')](function(_0x4b54f0){logger[_0xc7a7('0x4a')](_0xc7a7('0x4b'),_0x4b54f0);throw _0x4b54f0;});}return _0x25aaf0;})[_0xc7a7('0x24')](respondWithResult(_0x438a0a,0xc9))['catch'](handleError(_0x438a0a,null));};exports[_0xc7a7('0x1f')]=function(_0x42c107,_0x231a5f){if(_0x42c107[_0xc7a7('0x44')]['id']){delete _0x42c107['body']['id'];}return db[_0xc7a7('0x2a')][_0xc7a7('0x48')]({'where':{'id':_0x42c107['params']['id']}})[_0xc7a7('0x24')](handleEntityNotFound(_0x231a5f,null))[_0xc7a7('0x24')](saveUpdates(_0x42c107['body'],null))[_0xc7a7('0x24')](respondWithResult(_0x231a5f,null))['catch'](handleError(_0x231a5f,null));};exports[_0xc7a7('0x20')]=function(_0x39ace1,_0x567d64){return db[_0xc7a7('0x2a')][_0xc7a7('0x48')]({'where':{'id':_0x39ace1['params']['id']}})[_0xc7a7('0x24')](handleEntityNotFound(_0x567d64,null))[_0xc7a7('0x24')](removeEntity(_0x567d64,null))['catch'](handleError(_0x567d64,null));};exports[_0xc7a7('0x4c')]=function(_0x46a03c,_0x493016,_0x53f2c5){return db[_0xc7a7('0x2a')][_0xc7a7('0x48')]({'where':{'id':_0x46a03c['params']['id']},'attributes':[_0xc7a7('0x27'),_0xc7a7('0x4d'),'savename',_0xc7a7('0x4e')],'raw':!![]})[_0xc7a7('0x24')](handleEntityNotFound(_0x493016,null))[_0xc7a7('0x24')](function(_0x50cace){if(_0x50cace){if(!fs['existsSync'](path[_0xc7a7('0x4f')](config[_0xc7a7('0x50')],_0xc7a7('0x51'),_0x50cace['savename']))){throw new db['Sequelize'][(_0xc7a7('0x52'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x46a03c[_0xc7a7('0x2f')][_0xc7a7('0x53')]){return _0x493016[_0xc7a7('0x25')](0xc8);}return _0x493016[_0xc7a7('0x4c')](path['join'](config[_0xc7a7('0x50')],_0xc7a7('0x51'),_0x50cace[_0xc7a7('0x54')]),util[_0xc7a7('0x55')]('%s.%s',_0x50cace[_0xc7a7('0x4d')]||_0x50cace[_0xc7a7('0x27')],_0x50cace[_0xc7a7('0x4e')][_0xc7a7('0x56')]()));}})[_0xc7a7('0x42')](handleError(_0x493016,null));}; \ No newline at end of file +var _0xb9cb=['output','existsSync','root','Sequelize','Report\x20not\x20found\x20or\x20empty','exists','join','server/files/reports','format','%s.%s','basename','toLowerCase','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','get','name','map','AnalyticExtractedReport','rawAttributes','fieldName','type','keys','query','filters','model','attributes','intersection','fields','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','params','length','includeAll','catch','create','body','user','role','ExtractedReports','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','download','savename'];(function(_0x2de590,_0x5c580d){var _0xe9c48d=function(_0x53a4f4){while(--_0x53a4f4){_0x2de590['push'](_0x2de590['shift']());}};_0xe9c48d(++_0x5c580d);}(_0xb9cb,0x123));var _0xbb9c=function(_0x1b02bb,_0x3d9fde){_0x1b02bb=_0x1b02bb-0x0;var _0x131245=_0xb9cb[_0x1b02bb];return _0x131245;};'use strict';var emlformat=require(_0xbb9c('0x0'));var rimraf=require(_0xbb9c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbb9c('0x2'));var rp=require(_0xbb9c('0x3'));var moment=require('moment');var BPromise=require(_0xbb9c('0x4'));var Mustache=require(_0xbb9c('0x5'));var util=require(_0xbb9c('0x6'));var path=require(_0xbb9c('0x7'));var sox=require('sox');var csv=require(_0xbb9c('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb9c('0x9'));var _=require('lodash');var squel=require(_0xbb9c('0xa'));var crypto=require(_0xbb9c('0xb'));var jsforce=require(_0xbb9c('0xc'));var deskjs=require(_0xbb9c('0xd'));var toCsv=require('to-csv');var querystring=require(_0xbb9c('0xe'));var Papa=require(_0xbb9c('0xf'));var Redis=require(_0xbb9c('0x10'));var authService=require(_0xbb9c('0x11'));var qs=require(_0xbb9c('0x12'));var as=require(_0xbb9c('0x13'));var hardwareService=require(_0xbb9c('0x14'));var logger=require('../../config/logger')(_0xbb9c('0x15'));var utils=require('../../config/utils');var config=require(_0xbb9c('0x16'));var licenseUtil=require(_0xbb9c('0x17'));var db=require(_0xbb9c('0x18'))['db'];function respondWithStatusCode(_0x35a7e6,_0x2af566){_0x2af566=_0x2af566||0xcc;return function(_0x36e417){if(_0x36e417){return _0x35a7e6[_0xbb9c('0x19')](_0x2af566);}return _0x35a7e6['status'](_0x2af566)[_0xbb9c('0x1a')]();};}function respondWithResult(_0x374ee7,_0x5a829a){_0x5a829a=_0x5a829a||0xc8;return function(_0x12afc9){if(_0x12afc9){return _0x374ee7[_0xbb9c('0x1b')](_0x5a829a)[_0xbb9c('0x1c')](_0x12afc9);}};}function respondWithFilteredResult(_0x40ef15,_0x720598){return function(_0x5daa44){if(_0x5daa44){var _0x1cbc59=typeof _0x720598[_0xbb9c('0x1d')]===_0xbb9c('0x1e')&&typeof _0x720598[_0xbb9c('0x1f')]===_0xbb9c('0x1e');var _0x2cbb0e=_0x5daa44[_0xbb9c('0x20')];var _0x5f309b=_0x1cbc59?0x0:_0x720598[_0xbb9c('0x1d')];var _0x38360d=_0x1cbc59?_0x5daa44[_0xbb9c('0x20')]:_0x720598[_0xbb9c('0x1d')]+_0x720598[_0xbb9c('0x1f')];var _0x3a77fa;if(_0x38360d>=_0x2cbb0e){_0x38360d=_0x2cbb0e;_0x3a77fa=0xc8;}else{_0x3a77fa=0xce;}_0x40ef15[_0xbb9c('0x1b')](_0x3a77fa);return _0x40ef15[_0xbb9c('0x21')](_0xbb9c('0x22'),_0x5f309b+'-'+_0x38360d+'/'+_0x2cbb0e)['json'](_0x5daa44);}return null;};}function patchUpdates(_0x40b367){return function(_0x377702){try{jsonpatch['apply'](_0x377702,_0x40b367,!![]);}catch(_0x4b3b8b){return BPromise[_0xbb9c('0x23')](_0x4b3b8b);}return _0x377702[_0xbb9c('0x24')]();};}function saveUpdates(_0x107188,_0x254bcc){return function(_0x39df4d){if(_0x39df4d){return _0x39df4d['update'](_0x107188)[_0xbb9c('0x25')](function(_0x2ba75c){return _0x2ba75c;});}return null;};}function removeEntity(_0x26a424,_0x43aac4){return function(_0x4291f0){if(_0x4291f0){return _0x4291f0[_0xbb9c('0x26')]()[_0xbb9c('0x25')](function(){var _0x449590=_0x4291f0[_0xbb9c('0x27')]({'plain':!![]});var _0x275b90='ExtractedReports';return db['UserProfileResource'][_0xbb9c('0x26')]({'where':{'type':_0x275b90,'resourceId':_0x449590['id']}})[_0xbb9c('0x25')](function(){return _0x4291f0;});})[_0xbb9c('0x25')](function(){_0x26a424[_0xbb9c('0x1b')](0xcc)[_0xbb9c('0x1a')]();});}};}function handleEntityNotFound(_0x562899,_0x42125e){return function(_0x194e7f){if(!_0x194e7f){_0x562899[_0xbb9c('0x19')](0x194);}return _0x194e7f;};}function handleError(_0x69e5f4,_0x28ce38){_0x28ce38=_0x28ce38||0x1f4;return function(_0x53aa34){logger['error'](_0x53aa34['stack']);if(_0x53aa34[_0xbb9c('0x28')]){delete _0x53aa34['name'];}_0x69e5f4[_0xbb9c('0x1b')](_0x28ce38)['send'](_0x53aa34);};}exports['index']=function(_0x1832dc,_0x3471d2){var _0xb07d51={},_0x400a9c={},_0x3e7444={'count':0x0,'rows':[]};var _0x58025c=_[_0xbb9c('0x29')](db[_0xbb9c('0x2a')][_0xbb9c('0x2b')],function(_0x12eeda){return{'name':_0x12eeda[_0xbb9c('0x2c')],'type':_0x12eeda[_0xbb9c('0x2d')]['key']};});_0x400a9c['model']=_['map'](_0x58025c,'name');_0x400a9c['query']=_[_0xbb9c('0x2e')](_0x1832dc[_0xbb9c('0x2f')]);_0x400a9c[_0xbb9c('0x30')]=_['intersection'](_0x400a9c[_0xbb9c('0x31')],_0x400a9c[_0xbb9c('0x2f')]);_0xb07d51[_0xbb9c('0x32')]=_[_0xbb9c('0x33')](_0x400a9c[_0xbb9c('0x31')],qs[_0xbb9c('0x34')](_0x1832dc['query'][_0xbb9c('0x34')]));_0xb07d51[_0xbb9c('0x32')]=_0xb07d51['attributes']['length']?_0xb07d51[_0xbb9c('0x32')]:_0x400a9c[_0xbb9c('0x31')];if(!_0x1832dc[_0xbb9c('0x2f')][_0xbb9c('0x35')]('nolimit')){_0xb07d51[_0xbb9c('0x1f')]=qs[_0xbb9c('0x1f')](_0x1832dc[_0xbb9c('0x2f')][_0xbb9c('0x1f')]);_0xb07d51[_0xbb9c('0x1d')]=qs['offset'](_0x1832dc[_0xbb9c('0x2f')][_0xbb9c('0x1d')]);}_0xb07d51[_0xbb9c('0x36')]=qs[_0xbb9c('0x37')](_0x1832dc['query']['sort']);_0xb07d51[_0xbb9c('0x38')]=qs[_0xbb9c('0x30')](_['pick'](_0x1832dc[_0xbb9c('0x2f')],_0x400a9c[_0xbb9c('0x30')]),_0x58025c);if(_0x1832dc[_0xbb9c('0x2f')][_0xbb9c('0x39')]){_0xb07d51[_0xbb9c('0x38')]=_[_0xbb9c('0x3a')](_0xb07d51[_0xbb9c('0x38')],{'$or':_['map'](_0x58025c,function(_0x294ba4){if(_0x294ba4[_0xbb9c('0x2d')]!==_0xbb9c('0x3b')){var _0x17ea59={};_0x17ea59[_0x294ba4[_0xbb9c('0x28')]]={'$like':'%'+_0x1832dc[_0xbb9c('0x2f')][_0xbb9c('0x39')]+'%'};return _0x17ea59;}})});}_0xb07d51=_[_0xbb9c('0x3a')]({},_0xb07d51,_0x1832dc[_0xbb9c('0x3c')]);var _0x121959={'where':_0xb07d51[_0xbb9c('0x38')]};return db[_0xbb9c('0x2a')][_0xbb9c('0x20')](_0x121959)[_0xbb9c('0x25')](function(_0x309739){_0x3e7444['count']=_0x309739;if(_0x1832dc[_0xbb9c('0x2f')]['includeAll']){_0xb07d51[_0xbb9c('0x3d')]=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0xbb9c('0x3e')](_0xb07d51);})[_0xbb9c('0x25')](function(_0x4bd460){_0x3e7444[_0xbb9c('0x3f')]=_0x4bd460;return _0x3e7444;})[_0xbb9c('0x25')](respondWithFilteredResult(_0x3471d2,_0xb07d51))['catch'](handleError(_0x3471d2,null));};exports['show']=function(_0x505046,_0x9272ec){var _0x2f01ee={'raw':!![],'where':{'id':_0x505046[_0xbb9c('0x40')]['id']}},_0x57cc99={};_0x57cc99['model']=_['keys'](db[_0xbb9c('0x2a')][_0xbb9c('0x2b')]);_0x57cc99['query']=_[_0xbb9c('0x2e')](_0x505046[_0xbb9c('0x2f')]);_0x57cc99[_0xbb9c('0x30')]=_[_0xbb9c('0x33')](_0x57cc99[_0xbb9c('0x31')],_0x57cc99[_0xbb9c('0x2f')]);_0x2f01ee['attributes']=_['intersection'](_0x57cc99[_0xbb9c('0x31')],qs[_0xbb9c('0x34')](_0x505046[_0xbb9c('0x2f')][_0xbb9c('0x34')]));_0x2f01ee['attributes']=_0x2f01ee['attributes'][_0xbb9c('0x41')]?_0x2f01ee['attributes']:_0x57cc99[_0xbb9c('0x31')];if(_0x505046[_0xbb9c('0x2f')][_0xbb9c('0x42')]){_0x2f01ee[_0xbb9c('0x3d')]=[{'all':!![]}];}_0x2f01ee=_[_0xbb9c('0x3a')]({},_0x2f01ee,_0x505046[_0xbb9c('0x3c')]);return db['AnalyticExtractedReport']['find'](_0x2f01ee)[_0xbb9c('0x25')](handleEntityNotFound(_0x9272ec,null))[_0xbb9c('0x25')](respondWithResult(_0x9272ec,null))[_0xbb9c('0x43')](handleError(_0x9272ec,null));};exports[_0xbb9c('0x44')]=function(_0x45741a,_0x1df444){return db[_0xbb9c('0x2a')]['create'](_0x45741a[_0xbb9c('0x45')],{})[_0xbb9c('0x25')](function(_0x1a7b36){var _0x2435b4=_0x45741a[_0xbb9c('0x46')][_0xbb9c('0x27')]({'plain':!![]});if(!_0x2435b4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2435b4[_0xbb9c('0x47')]==='user'){var _0x2a0da8=_0x1a7b36['get']({'plain':!![]});var _0x50f9dd=_0xbb9c('0x48');return db[_0xbb9c('0x49')][_0xbb9c('0x4a')]({'where':{'name':_0x50f9dd,'userProfileId':_0x2435b4[_0xbb9c('0x4b')]},'raw':!![]})['then'](function(_0x52b504){if(_0x52b504&&_0x52b504[_0xbb9c('0x4c')]===0x0){return db['UserProfileResource']['create']({'name':_0x2a0da8[_0xbb9c('0x28')],'resourceId':_0x2a0da8['id'],'type':_0x52b504['name'],'sectionId':_0x52b504['id']},{})[_0xbb9c('0x25')](function(){return _0x1a7b36;});}else{return _0x1a7b36;}})[_0xbb9c('0x43')](function(_0x39ca00){logger['error'](_0xbb9c('0x4d'),_0x39ca00);throw _0x39ca00;});}return _0x1a7b36;})[_0xbb9c('0x25')](respondWithResult(_0x1df444,0xc9))['catch'](handleError(_0x1df444,null));};exports[_0xbb9c('0x4e')]=function(_0x4db2b9,_0x5d80ed){if(_0x4db2b9['body']['id']){delete _0x4db2b9[_0xbb9c('0x45')]['id'];}return db[_0xbb9c('0x2a')]['find']({'where':{'id':_0x4db2b9[_0xbb9c('0x40')]['id']}})['then'](handleEntityNotFound(_0x5d80ed,null))[_0xbb9c('0x25')](saveUpdates(_0x4db2b9[_0xbb9c('0x45')],null))['then'](respondWithResult(_0x5d80ed,null))[_0xbb9c('0x43')](handleError(_0x5d80ed,null));};exports[_0xbb9c('0x26')]=function(_0x1a5ef4,_0x394a52){return db[_0xbb9c('0x2a')]['find']({'where':{'id':_0x1a5ef4['params']['id']}})['then'](handleEntityNotFound(_0x394a52,null))[_0xbb9c('0x25')](removeEntity(_0x394a52,null))['catch'](handleError(_0x394a52,null));};exports[_0xbb9c('0x4f')]=function(_0x85fcf9,_0x20063a,_0x3849b3){return db['AnalyticExtractedReport'][_0xbb9c('0x4a')]({'where':{'id':_0x85fcf9[_0xbb9c('0x40')]['id']},'attributes':[_0xbb9c('0x28'),'basename',_0xbb9c('0x50'),_0xbb9c('0x51')],'raw':!![]})[_0xbb9c('0x25')](handleEntityNotFound(_0x20063a,null))['then'](function(_0x5edc83){if(_0x5edc83){if(!fs[_0xbb9c('0x52')](path['join'](config[_0xbb9c('0x53')],'server/files/reports',_0x5edc83[_0xbb9c('0x50')]))){throw new db[(_0xbb9c('0x54'))]['ValidationError'](_0xbb9c('0x55'));}if(_0x85fcf9[_0xbb9c('0x2f')][_0xbb9c('0x56')]){return _0x20063a['sendStatus'](0xc8);}return _0x20063a['download'](path[_0xbb9c('0x57')](config[_0xbb9c('0x53')],_0xbb9c('0x58'),_0x5edc83[_0xbb9c('0x50')]),util[_0xbb9c('0x59')](_0xbb9c('0x5a'),_0x5edc83[_0xbb9c('0x5b')]||_0x5edc83[_0xbb9c('0x28')],_0x5edc83[_0xbb9c('0x51')][_0xbb9c('0x5c')]()));}})[_0xbb9c('0x43')](handleError(_0x20063a,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 6b42644..0eac923 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 _0x2db8=['analytics_extracted_reports','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./analyticExtractedReport.attributes','exports','AnalyticExtractedReport'];(function(_0x4cb763,_0x5f5169){var _0x4beb7c=function(_0x1c0d73){while(--_0x1c0d73){_0x4cb763['push'](_0x4cb763['shift']());}};_0x4beb7c(++_0x5f5169);}(_0x2db8,0x90));var _0x82db=function(_0x57a56d,_0x5a6b31){_0x57a56d=_0x57a56d-0x0;var _0x202b30=_0x2db8[_0x57a56d];return _0x202b30;};'use strict';var _=require('lodash');var util=require(_0x82db('0x0'));var logger=require(_0x82db('0x1'))(_0x82db('0x2'));var moment=require(_0x82db('0x3'));var BPromise=require(_0x82db('0x4'));var rp=require(_0x82db('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x82db('0x6'));var attributes=require(_0x82db('0x7'));module[_0x82db('0x8')]=function(_0x3ec653,_0x18885f){return _0x3ec653['define'](_0x82db('0x9'),attributes,{'tableName':_0x82db('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x94d1=['../../config/environment','./analyticExtractedReport.attributes','AnalyticExtractedReport','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x4deff,_0x42c328){var _0x440123=function(_0x2d7dde){while(--_0x2d7dde){_0x4deff['push'](_0x4deff['shift']());}};_0x440123(++_0x42c328);}(_0x94d1,0x137));var _0x194d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x94d1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x194d('0x0'));var util=require(_0x194d('0x1'));var logger=require('../../config/logger')(_0x194d('0x2'));var moment=require(_0x194d('0x3'));var BPromise=require(_0x194d('0x4'));var rp=require(_0x194d('0x5'));var fs=require('fs');var path=require(_0x194d('0x6'));var rimraf=require(_0x194d('0x7'));var config=require(_0x194d('0x8'));var attributes=require(_0x194d('0x9'));module['exports']=function(_0x1cf32e,_0x27ead2){return _0x1cf32e['define'](_0x194d('0xa'),attributes,{'tableName':'analytics_extracted_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index 6591d93..727d32e 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 _0x9656=['request\x20sent','error','code','message','info','AnalyticExtractedReport,\x20%s,\x20%s','result','catch','lodash','moment','bluebird','ioredis','rpc','jayson/promise','http','request','then','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0x9656,0x15e));var _0x6965=function(_0x442064,_0x3bb4d0){_0x442064=_0x442064-0x0;var _0x203a9b=_0x9656[_0x442064];return _0x203a9b;};'use strict';var _=require(_0x6965('0x0'));var util=require('util');var moment=require(_0x6965('0x1'));var BPromise=require(_0x6965('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6965('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6965('0x4'));var config=require('../../config/environment');var jayson=require(_0x6965('0x5'));var client=jayson['client'][_0x6965('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x5312fb,_0x9a46c7,_0x1a4e13){return new BPromise(function(_0x55a024,_0x5ae918){return client[_0x6965('0x7')](_0x5312fb,_0x1a4e13)[_0x6965('0x8')](function(_0x34a8f8){logger['info']('AnalyticExtractedReport,\x20%s,\x20%s',_0x9a46c7,'request\x20sent');logger[_0x6965('0x9')](_0x6965('0xa'),_0x9a46c7,_0x6965('0xb'),JSON['stringify'](_0x34a8f8));if(_0x34a8f8[_0x6965('0xc')]){if(_0x34a8f8[_0x6965('0xc')][_0x6965('0xd')]===0x1f4){logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x9a46c7,_0x34a8f8[_0x6965('0xc')]['message']);return _0x5ae918(_0x34a8f8[_0x6965('0xc')][_0x6965('0xe')]);}logger[_0x6965('0xc')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x9a46c7,_0x34a8f8[_0x6965('0xc')][_0x6965('0xe')]);return _0x55a024(_0x34a8f8[_0x6965('0xc')][_0x6965('0xe')]);}else{logger[_0x6965('0xf')](_0x6965('0x10'),_0x9a46c7,_0x6965('0xb'));_0x55a024(_0x34a8f8[_0x6965('0x11')][_0x6965('0xe')]);}})[_0x6965('0x12')](function(_0x40b316){logger['error'](_0x6965('0x10'),_0x9a46c7,_0x40b316);_0x5ae918(_0x40b316);});});} \ No newline at end of file +var _0x5d6f=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','AnalyticExtractedReport,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment'];(function(_0xa74e4c,_0x152094){var _0x5aceaa=function(_0x1ae205){while(--_0x1ae205){_0xa74e4c['push'](_0xa74e4c['shift']());}};_0x5aceaa(++_0x152094);}(_0x5d6f,0x1d8));var _0xf5d6=function(_0x376dba,_0x481693){_0x376dba=_0x376dba-0x0;var _0x3b1b75=_0x5d6f[_0x376dba];return _0x3b1b75;};'use strict';var _=require(_0xf5d6('0x0'));var util=require(_0xf5d6('0x1'));var moment=require(_0xf5d6('0x2'));var BPromise=require(_0xf5d6('0x3'));var rs=require(_0xf5d6('0x4'));var fs=require('fs');var Redis=require(_0xf5d6('0x5'));var db=require(_0xf5d6('0x6'))['db'];var utils=require(_0xf5d6('0x7'));var logger=require(_0xf5d6('0x8'))(_0xf5d6('0x9'));var config=require(_0xf5d6('0xa'));var jayson=require(_0xf5d6('0xb'));var client=jayson[_0xf5d6('0xc')][_0xf5d6('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x2759e4,_0x133140,_0x4b21bc){return new BPromise(function(_0x3ab16a,_0x21fae5){return client['request'](_0x2759e4,_0x4b21bc)[_0xf5d6('0xe')](function(_0x15343c){logger['info']('AnalyticExtractedReport,\x20%s,\x20%s',_0x133140,_0xf5d6('0xf'));logger[_0xf5d6('0x10')](_0xf5d6('0x11'),_0x133140,_0xf5d6('0xf'),JSON[_0xf5d6('0x12')](_0x15343c));if(_0x15343c['error']){if(_0x15343c['error']['code']===0x1f4){logger[_0xf5d6('0x13')](_0xf5d6('0x14'),_0x133140,_0x15343c[_0xf5d6('0x13')][_0xf5d6('0x15')]);return _0x21fae5(_0x15343c[_0xf5d6('0x13')][_0xf5d6('0x15')]);}logger[_0xf5d6('0x13')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x133140,_0x15343c[_0xf5d6('0x13')]['message']);return _0x3ab16a(_0x15343c[_0xf5d6('0x13')][_0xf5d6('0x15')]);}else{logger[_0xf5d6('0x16')](_0xf5d6('0x14'),_0x133140,_0xf5d6('0xf'));_0x3ab16a(_0x15343c[_0xf5d6('0x17')][_0xf5d6('0x15')]);}})[_0xf5d6('0x18')](function(_0x7e03b8){logger[_0xf5d6('0x13')](_0xf5d6('0x14'),_0x133140,_0x7e03b8);_0x21fae5(_0x7e03b8);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 5845954..3632e4e 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 _0xdfe5=['index','/:id','show','download','create','put','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','get','isAuthenticated'];(function(_0x36b863,_0x528d3f){var _0x2ef697=function(_0x5e647a){while(--_0x5e647a){_0x36b863['push'](_0x36b863['shift']());}};_0x2ef697(++_0x528d3f);}(_0xdfe5,0xab));var _0x5dfe=function(_0x416398,_0x44af07){_0x416398=_0x416398-0x0;var _0x1791ca=_0xdfe5[_0x416398];return _0x1791ca;};'use strict';var multer=require(_0x5dfe('0x0'));var util=require(_0x5dfe('0x1'));var path=require('path');var timeout=require(_0x5dfe('0x2'));var express=require(_0x5dfe('0x3'));var router=express[_0x5dfe('0x4')]();var fs_extra=require(_0x5dfe('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x5dfe('0x6'));var config=require('../../config/environment');var controller=require('./analyticExtractedReport.controller');router[_0x5dfe('0x7')]('/',auth[_0x5dfe('0x8')](),controller[_0x5dfe('0x9')]);router[_0x5dfe('0x7')](_0x5dfe('0xa'),auth[_0x5dfe('0x8')](),controller[_0x5dfe('0xb')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0x5dfe('0xc')]);router['post']('/',auth[_0x5dfe('0x8')](),controller[_0x5dfe('0xd')]);router[_0x5dfe('0xe')](_0x5dfe('0xa'),auth[_0x5dfe('0x8')](),controller[_0x5dfe('0xf')]);router[_0x5dfe('0x10')](_0x5dfe('0xa'),auth['isAuthenticated'](),controller[_0x5dfe('0x11')]);module['exports']=router; \ No newline at end of file +var _0x4d29=['get','isAuthenticated','show','/:id/download','download','put','/:id','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4d29,0x15f));var _0x94d2=function(_0x42f07d,_0x4e9bd3){_0x42f07d=_0x42f07d-0x0;var _0x1bf35c=_0x4d29[_0x42f07d];return _0x1bf35c;};'use strict';var multer=require(_0x94d2('0x0'));var util=require('util');var path=require(_0x94d2('0x1'));var timeout=require(_0x94d2('0x2'));var express=require(_0x94d2('0x3'));var router=express[_0x94d2('0x4')]();var fs_extra=require(_0x94d2('0x5'));var auth=require(_0x94d2('0x6'));var interaction=require(_0x94d2('0x7'));var config=require(_0x94d2('0x8'));var controller=require('./analyticExtractedReport.controller');router[_0x94d2('0x9')]('/',auth[_0x94d2('0xa')](),controller['index']);router['get']('/:id',auth[_0x94d2('0xa')](),controller[_0x94d2('0xb')]);router['get'](_0x94d2('0xc'),auth['isAuthenticated'](),controller[_0x94d2('0xd')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x94d2('0xe')]('/:id',auth[_0x94d2('0xa')](),controller['update']);router['delete'](_0x94d2('0xf'),auth[_0x94d2('0xa')](),controller[_0x94d2('0x10')]);module[_0x94d2('0x11')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 830d4fa..c0c2a7e 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 _0x658c=['BOOLEAN','sequelize','exports','TEXT','STRING'];(function(_0x6df205,_0x77b4cf){var _0x5933bd=function(_0x4c40f6){while(--_0x4c40f6){_0x6df205['push'](_0x6df205['shift']());}};_0x5933bd(++_0x77b4cf);}(_0x658c,0x132));var _0xc658=function(_0x335c1f,_0x532283){_0x335c1f=_0x335c1f-0x0;var _0x214c30=_0x658c[_0x335c1f];return _0x214c30;};'use strict';var Sequelize=require(_0xc658('0x0'));module[_0xc658('0x1')]={'field':{'type':Sequelize[_0xc658('0x2')]},'alias':{'type':Sequelize[_0xc658('0x3')]},'function':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0xc658('0x3')]},'groupBy':{'type':Sequelize[_0xc658('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xc658('0x3')]},'custom':{'type':Sequelize[_0xc658('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xfa1b=['STRING','BOOLEAN','sequelize','TEXT'];(function(_0x213568,_0x114a6e){var _0x4fc3ff=function(_0x12b418){while(--_0x12b418){_0x213568['push'](_0x213568['shift']());}};_0x4fc3ff(++_0x114a6e);}(_0xfa1b,0x19a));var _0xbfa1=function(_0x3b9f41,_0x55482b){_0x3b9f41=_0x3b9f41-0x0;var _0x32c03d=_0xfa1b[_0x3b9f41];return _0x32c03d;};'use strict';var Sequelize=require(_0xbfa1('0x0'));module['exports']={'field':{'type':Sequelize[_0xbfa1('0x1')]},'alias':{'type':Sequelize[_0xbfa1('0x2')]},'function':{'type':Sequelize[_0xbfa1('0x2')]},'format':{'type':Sequelize[_0xbfa1('0x2')]},'groupBy':{'type':Sequelize[_0xbfa1('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xbfa1('0x2')]},'custom':{'type':Sequelize[_0xbfa1('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 b458d01..a096cf6 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 _0xfaf3=['set','Content-Range','json','apply','reject','update','then','end','sendStatus','stack','name','send','map','AnalyticFieldReport','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','length','create','body','catch','bulkCreate','find','destroy','bulkDestroy','ids','AnalyticCustomReport','sequelize','CustomReportId','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','offset','undefined','limit','count'];(function(_0x591cfd,_0x501204){var _0x4d0100=function(_0xb9ff0c){while(--_0xb9ff0c){_0x591cfd['push'](_0x591cfd['shift']());}};_0x4d0100(++_0x501204);}(_0xfaf3,0x11f));var _0x3faf=function(_0x7edcc5,_0x25fee2){_0x7edcc5=_0x7edcc5-0x0;var _0x806f40=_0xfaf3[_0x7edcc5];return _0x806f40;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3faf('0x0'));var zipdir=require(_0x3faf('0x1'));var jsonpatch=require(_0x3faf('0x2'));var rp=require(_0x3faf('0x3'));var moment=require('moment');var BPromise=require(_0x3faf('0x4'));var Mustache=require(_0x3faf('0x5'));var util=require('util');var path=require(_0x3faf('0x6'));var sox=require(_0x3faf('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3faf('0x8'));var _=require('lodash');var squel=require(_0x3faf('0x9'));var crypto=require(_0x3faf('0xa'));var jsforce=require(_0x3faf('0xb'));var deskjs=require(_0x3faf('0xc'));var toCsv=require(_0x3faf('0xd'));var querystring=require(_0x3faf('0xe'));var Papa=require(_0x3faf('0xf'));var Redis=require(_0x3faf('0x10'));var authService=require(_0x3faf('0x11'));var qs=require(_0x3faf('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3faf('0x13'));var logger=require(_0x3faf('0x14'))(_0x3faf('0x15'));var utils=require(_0x3faf('0x16'));var config=require(_0x3faf('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x565a76,_0x213c96){_0x213c96=_0x213c96||0xcc;return function(_0x22ae10){if(_0x22ae10){return _0x565a76['sendStatus'](_0x213c96);}return _0x565a76[_0x3faf('0x18')](_0x213c96)['end']();};}function respondWithResult(_0x44b67c,_0x17e1bd){_0x17e1bd=_0x17e1bd||0xc8;return function(_0x1b161c){if(_0x1b161c){return _0x44b67c['status'](_0x17e1bd)['json'](_0x1b161c);}};}function respondWithFilteredResult(_0x56f4cf,_0x5832d8){return function(_0x2efcca){if(_0x2efcca){var _0x270dc5=typeof _0x5832d8[_0x3faf('0x19')]===_0x3faf('0x1a')&&typeof _0x5832d8[_0x3faf('0x1b')]===_0x3faf('0x1a');var _0x373c21=_0x2efcca[_0x3faf('0x1c')];var _0x1f74a5=_0x270dc5?0x0:_0x5832d8[_0x3faf('0x19')];var _0x1e7529=_0x270dc5?_0x2efcca[_0x3faf('0x1c')]:_0x5832d8['offset']+_0x5832d8['limit'];var _0x2618c4;if(_0x1e7529>=_0x373c21){_0x1e7529=_0x373c21;_0x2618c4=0xc8;}else{_0x2618c4=0xce;}_0x56f4cf['status'](_0x2618c4);return _0x56f4cf[_0x3faf('0x1d')](_0x3faf('0x1e'),_0x1f74a5+'-'+_0x1e7529+'/'+_0x373c21)[_0x3faf('0x1f')](_0x2efcca);}return null;};}function patchUpdates(_0x4367bc){return function(_0x4d62c9){try{jsonpatch[_0x3faf('0x20')](_0x4d62c9,_0x4367bc,!![]);}catch(_0x1a64c0){return BPromise[_0x3faf('0x21')](_0x1a64c0);}return _0x4d62c9['save']();};}function saveUpdates(_0x1e56ca,_0x41b10e){return function(_0x3cd555){if(_0x3cd555){return _0x3cd555[_0x3faf('0x22')](_0x1e56ca)[_0x3faf('0x23')](function(_0x12904c){return _0x12904c;});}return null;};}function removeEntity(_0xf9df9,_0x363b84){return function(_0xb38611){if(_0xb38611){return _0xb38611['destroy']()['then'](function(){_0xf9df9[_0x3faf('0x18')](0xcc)[_0x3faf('0x24')]();});}};}function handleEntityNotFound(_0x2c4538,_0x4b5424){return function(_0x21837d){if(!_0x21837d){_0x2c4538[_0x3faf('0x25')](0x194);}return _0x21837d;};}function handleError(_0x46fc41,_0x4d148c){_0x4d148c=_0x4d148c||0x1f4;return function(_0x397896){logger['error'](_0x397896[_0x3faf('0x26')]);if(_0x397896[_0x3faf('0x27')]){delete _0x397896[_0x3faf('0x27')];}_0x46fc41[_0x3faf('0x18')](_0x4d148c)[_0x3faf('0x28')](_0x397896);};}exports['index']=function(_0x3abb4b,_0x1122af){var _0x578485={},_0x1adfda={},_0x2d7143={'count':0x0,'rows':[]};var _0x14a90d=_[_0x3faf('0x29')](db[_0x3faf('0x2a')][_0x3faf('0x2b')],function(_0x16b9f8){return{'name':_0x16b9f8['fieldName'],'type':_0x16b9f8[_0x3faf('0x2c')][_0x3faf('0x2d')]};});_0x1adfda[_0x3faf('0x2e')]=_[_0x3faf('0x29')](_0x14a90d,_0x3faf('0x27'));_0x1adfda[_0x3faf('0x2f')]=_[_0x3faf('0x30')](_0x3abb4b[_0x3faf('0x2f')]);_0x1adfda[_0x3faf('0x31')]=_[_0x3faf('0x32')](_0x1adfda[_0x3faf('0x2e')],_0x1adfda[_0x3faf('0x2f')]);_0x578485['attributes']=_[_0x3faf('0x32')](_0x1adfda[_0x3faf('0x2e')],qs[_0x3faf('0x33')](_0x3abb4b['query'][_0x3faf('0x33')]));_0x578485['attributes']=_0x578485[_0x3faf('0x34')]['length']?_0x578485[_0x3faf('0x34')]:_0x1adfda['model'];if(!_0x3abb4b[_0x3faf('0x2f')]['hasOwnProperty'](_0x3faf('0x35'))){_0x578485[_0x3faf('0x1b')]=qs['limit'](_0x3abb4b[_0x3faf('0x2f')][_0x3faf('0x1b')]);_0x578485['offset']=qs['offset'](_0x3abb4b[_0x3faf('0x2f')][_0x3faf('0x19')]);}_0x578485[_0x3faf('0x36')]=qs[_0x3faf('0x37')](_0x3abb4b['query'][_0x3faf('0x37')]);_0x578485[_0x3faf('0x38')]=qs[_0x3faf('0x31')](_[_0x3faf('0x39')](_0x3abb4b['query'],_0x1adfda['filters']),_0x14a90d);if(_0x3abb4b[_0x3faf('0x2f')][_0x3faf('0x3a')]){_0x578485[_0x3faf('0x38')]=_[_0x3faf('0x3b')](_0x578485['where'],{'$or':_['map'](_0x14a90d,function(_0x4ee468){if(_0x4ee468[_0x3faf('0x2c')]!==_0x3faf('0x3c')){var _0x514aee={};_0x514aee[_0x4ee468[_0x3faf('0x27')]]={'$like':'%'+_0x3abb4b[_0x3faf('0x2f')][_0x3faf('0x3a')]+'%'};return _0x514aee;}})});}_0x578485=_[_0x3faf('0x3b')]({},_0x578485,_0x3abb4b[_0x3faf('0x3d')]);var _0x3654eb={'where':_0x578485['where']};return db[_0x3faf('0x2a')][_0x3faf('0x1c')](_0x3654eb)[_0x3faf('0x23')](function(_0x56308d){_0x2d7143[_0x3faf('0x1c')]=_0x56308d;if(_0x3abb4b[_0x3faf('0x2f')][_0x3faf('0x3e')]){_0x578485[_0x3faf('0x3f')]=[{'all':!![]}];}return db[_0x3faf('0x2a')][_0x3faf('0x40')](_0x578485);})['then'](function(_0x1f1b9a){_0x2d7143[_0x3faf('0x41')]=_0x1f1b9a;return _0x2d7143;})[_0x3faf('0x23')](respondWithFilteredResult(_0x1122af,_0x578485))['catch'](handleError(_0x1122af,null));};exports['show']=function(_0x46ec23,_0x226dda){var _0x992422={'raw':![],'where':{'id':_0x46ec23[_0x3faf('0x42')]['id']}},_0x59a1c6={};_0x59a1c6[_0x3faf('0x2e')]=_['keys'](db[_0x3faf('0x2a')][_0x3faf('0x2b')]);_0x59a1c6[_0x3faf('0x2f')]=_[_0x3faf('0x30')](_0x46ec23[_0x3faf('0x2f')]);_0x59a1c6[_0x3faf('0x31')]=_['intersection'](_0x59a1c6[_0x3faf('0x2e')],_0x59a1c6[_0x3faf('0x2f')]);_0x992422['attributes']=_[_0x3faf('0x32')](_0x59a1c6[_0x3faf('0x2e')],qs[_0x3faf('0x33')](_0x46ec23['query'][_0x3faf('0x33')]));_0x992422[_0x3faf('0x34')]=_0x992422[_0x3faf('0x34')][_0x3faf('0x43')]?_0x992422[_0x3faf('0x34')]:_0x59a1c6['model'];if(_0x46ec23[_0x3faf('0x2f')]['includeAll']){_0x992422['include']=[{'all':!![]}];}_0x992422=_[_0x3faf('0x3b')]({},_0x992422,_0x46ec23['options']);return db[_0x3faf('0x2a')]['find'](_0x992422)[_0x3faf('0x23')](handleEntityNotFound(_0x226dda,null))[_0x3faf('0x23')](respondWithResult(_0x226dda,null))['catch'](handleError(_0x226dda,null));};exports[_0x3faf('0x44')]=function(_0x4dddaf,_0xbfd948){return db[_0x3faf('0x2a')][_0x3faf('0x44')](_0x4dddaf[_0x3faf('0x45')],{})[_0x3faf('0x23')](respondWithResult(_0xbfd948,0xc9))[_0x3faf('0x46')](handleError(_0xbfd948,null));};exports['bulkCreate']=function(_0x423294,_0x454349){return db[_0x3faf('0x2a')][_0x3faf('0x47')](_0x423294[_0x3faf('0x45')],{'raw':![],'individualHooks':!![]})[_0x3faf('0x23')](respondWithResult(_0x454349,0xc9))[_0x3faf('0x46')](handleError(_0x454349,null));};exports[_0x3faf('0x22')]=function(_0x269172,_0x5d2885){if(_0x269172[_0x3faf('0x45')]['id']){delete _0x269172[_0x3faf('0x45')]['id'];}return db['AnalyticFieldReport'][_0x3faf('0x48')]({'where':{'id':_0x269172[_0x3faf('0x42')]['id']}})[_0x3faf('0x23')](handleEntityNotFound(_0x5d2885,null))[_0x3faf('0x23')](saveUpdates(_0x269172['body'],null))[_0x3faf('0x23')](respondWithResult(_0x5d2885,null))[_0x3faf('0x46')](handleError(_0x5d2885,null));};exports[_0x3faf('0x49')]=function(_0x336e7c,_0xd12b37){return db[_0x3faf('0x2a')]['find']({'where':{'id':_0x336e7c[_0x3faf('0x42')]['id']}})[_0x3faf('0x23')](handleEntityNotFound(_0xd12b37,null))[_0x3faf('0x23')](removeEntity(_0xd12b37,null))[_0x3faf('0x46')](handleError(_0xd12b37,null));};exports[_0x3faf('0x4a')]=function(_0x5096a8,_0x216448){return db['AnalyticFieldReport']['destroy']({'where':{'id':_0x5096a8[_0x3faf('0x2f')][_0x3faf('0x4b')]||[]},'raw':![],'individualHooks':!![]})[_0x3faf('0x23')](respondWithResult(_0x216448,0xcc))[_0x3faf('0x46')](handleError(_0x216448,null));};exports['addFields']=function(_0x4ebaf6,_0xaa72b0,_0x2ed6c0){return db[_0x3faf('0x4c')]['findOne']({'where':{'id':_0x4ebaf6[_0x3faf('0x42')]['id']}})[_0x3faf('0x23')](handleEntityNotFound(_0xaa72b0,null))[_0x3faf('0x23')](function(_0x23c45a){if(_0x23c45a){return db[_0x3faf('0x4d')]['transaction'](function(_0x221d1b){return db[_0x3faf('0x2a')][_0x3faf('0x49')]({'where':{'CustomReportId':_0x4ebaf6[_0x3faf('0x42')]['id']},'transaction':_0x221d1b})['then'](function(_0x43da8b){var _0x558ce0=_[_0x3faf('0x29')](_0x4ebaf6[_0x3faf('0x45')],function(_0x547b3b){delete _0x547b3b['id'];_0x547b3b[_0x3faf('0x4e')]=_0x4ebaf6[_0x3faf('0x42')]['id'];return _0x547b3b;});return db[_0x3faf('0x2a')][_0x3faf('0x47')](_0x558ce0,{'transaction':_0x221d1b});});})['then'](function(){return db[_0x3faf('0x2a')][_0x3faf('0x40')]({'where':{'CustomReportId':_0x4ebaf6['params']['id']}});});}})[_0x3faf('0x23')](respondWithResult(_0xaa72b0,null))[_0x3faf('0x46')](handleError(_0xaa72b0,null));}; \ No newline at end of file +var _0x0e05=['rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','merge','find','create','body','bulkCreate','update','bulkDestroy','addFields','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','limit','undefined','count','status','set','Content-Range','apply','reject','save','then','destroy','end','stack','name','send','AnalyticFieldReport'];(function(_0x52ea08,_0x15d935){var _0x28d546=function(_0x4a3aa7){while(--_0x4a3aa7){_0x52ea08['push'](_0x52ea08['shift']());}};_0x28d546(++_0x15d935);}(_0x0e05,0xd5));var _0x50e0=function(_0x551051,_0x5a4c89){_0x551051=_0x551051-0x0;var _0x25c40f=_0x0e05[_0x551051];return _0x25c40f;};'use strict';var emlformat=require(_0x50e0('0x0'));var rimraf=require(_0x50e0('0x1'));var zipdir=require(_0x50e0('0x2'));var jsonpatch=require(_0x50e0('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x50e0('0x4'));var Mustache=require(_0x50e0('0x5'));var util=require(_0x50e0('0x6'));var path=require(_0x50e0('0x7'));var sox=require('sox');var csv=require(_0x50e0('0x8'));var ejs=require(_0x50e0('0x9'));var fs=require('fs');var fs_extra=require(_0x50e0('0xa'));var _=require('lodash');var squel=require(_0x50e0('0xb'));var crypto=require('crypto');var jsforce=require(_0x50e0('0xc'));var deskjs=require(_0x50e0('0xd'));var toCsv=require(_0x50e0('0x8'));var querystring=require(_0x50e0('0xe'));var Papa=require(_0x50e0('0xf'));var Redis=require(_0x50e0('0x10'));var authService=require(_0x50e0('0x11'));var qs=require(_0x50e0('0x12'));var as=require(_0x50e0('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x50e0('0x14'))(_0x50e0('0x15'));var utils=require(_0x50e0('0x16'));var config=require(_0x50e0('0x17'));var licenseUtil=require(_0x50e0('0x18'));var db=require(_0x50e0('0x19'))['db'];function respondWithStatusCode(_0x30ce19,_0x3a6787){_0x3a6787=_0x3a6787||0xcc;return function(_0x4b338f){if(_0x4b338f){return _0x30ce19[_0x50e0('0x1a')](_0x3a6787);}return _0x30ce19['status'](_0x3a6787)['end']();};}function respondWithResult(_0x291e02,_0x52bd50){_0x52bd50=_0x52bd50||0xc8;return function(_0x3be40a){if(_0x3be40a){return _0x291e02['status'](_0x52bd50)[_0x50e0('0x1b')](_0x3be40a);}};}function respondWithFilteredResult(_0x4e8b95,_0x4055bb){return function(_0x1df9f8){if(_0x1df9f8){var _0x17c22c=typeof _0x4055bb[_0x50e0('0x1c')]==='undefined'&&typeof _0x4055bb[_0x50e0('0x1d')]===_0x50e0('0x1e');var _0x4e09a6=_0x1df9f8[_0x50e0('0x1f')];var _0x2cef02=_0x17c22c?0x0:_0x4055bb[_0x50e0('0x1c')];var _0x602d43=_0x17c22c?_0x1df9f8[_0x50e0('0x1f')]:_0x4055bb['offset']+_0x4055bb[_0x50e0('0x1d')];var _0xa3c120;if(_0x602d43>=_0x4e09a6){_0x602d43=_0x4e09a6;_0xa3c120=0xc8;}else{_0xa3c120=0xce;}_0x4e8b95[_0x50e0('0x20')](_0xa3c120);return _0x4e8b95[_0x50e0('0x21')](_0x50e0('0x22'),_0x2cef02+'-'+_0x602d43+'/'+_0x4e09a6)[_0x50e0('0x1b')](_0x1df9f8);}return null;};}function patchUpdates(_0x11f866){return function(_0x348e0a){try{jsonpatch[_0x50e0('0x23')](_0x348e0a,_0x11f866,!![]);}catch(_0x2eb5a7){return BPromise[_0x50e0('0x24')](_0x2eb5a7);}return _0x348e0a[_0x50e0('0x25')]();};}function saveUpdates(_0x47f118,_0x3c1183){return function(_0x1f26e7){if(_0x1f26e7){return _0x1f26e7['update'](_0x47f118)[_0x50e0('0x26')](function(_0x257229){return _0x257229;});}return null;};}function removeEntity(_0x221574,_0x20c81a){return function(_0x1bbb0c){if(_0x1bbb0c){return _0x1bbb0c[_0x50e0('0x27')]()[_0x50e0('0x26')](function(){_0x221574[_0x50e0('0x20')](0xcc)[_0x50e0('0x28')]();});}};}function handleEntityNotFound(_0x424559,_0x413582){return function(_0x2e6b48){if(!_0x2e6b48){_0x424559[_0x50e0('0x1a')](0x194);}return _0x2e6b48;};}function handleError(_0x38faab,_0x4d7f5c){_0x4d7f5c=_0x4d7f5c||0x1f4;return function(_0x4d081a){logger['error'](_0x4d081a[_0x50e0('0x29')]);if(_0x4d081a[_0x50e0('0x2a')]){delete _0x4d081a[_0x50e0('0x2a')];}_0x38faab['status'](_0x4d7f5c)[_0x50e0('0x2b')](_0x4d081a);};}exports['index']=function(_0x15102d,_0xee221d){var _0x27db42={},_0x4b04a8={},_0x1028b7={'count':0x0,'rows':[]};var _0x3c3de8=_['map'](db[_0x50e0('0x2c')][_0x50e0('0x2d')],function(_0x466f13){return{'name':_0x466f13[_0x50e0('0x2e')],'type':_0x466f13[_0x50e0('0x2f')][_0x50e0('0x30')]};});_0x4b04a8[_0x50e0('0x31')]=_[_0x50e0('0x32')](_0x3c3de8,_0x50e0('0x2a'));_0x4b04a8[_0x50e0('0x33')]=_[_0x50e0('0x34')](_0x15102d[_0x50e0('0x33')]);_0x4b04a8[_0x50e0('0x35')]=_[_0x50e0('0x36')](_0x4b04a8[_0x50e0('0x31')],_0x4b04a8[_0x50e0('0x33')]);_0x27db42['attributes']=_[_0x50e0('0x36')](_0x4b04a8['model'],qs[_0x50e0('0x37')](_0x15102d[_0x50e0('0x33')][_0x50e0('0x37')]));_0x27db42[_0x50e0('0x38')]=_0x27db42[_0x50e0('0x38')]['length']?_0x27db42['attributes']:_0x4b04a8[_0x50e0('0x31')];if(!_0x15102d[_0x50e0('0x33')][_0x50e0('0x39')](_0x50e0('0x3a'))){_0x27db42[_0x50e0('0x1d')]=qs[_0x50e0('0x1d')](_0x15102d[_0x50e0('0x33')][_0x50e0('0x1d')]);_0x27db42[_0x50e0('0x1c')]=qs[_0x50e0('0x1c')](_0x15102d[_0x50e0('0x33')][_0x50e0('0x1c')]);}_0x27db42[_0x50e0('0x3b')]=qs[_0x50e0('0x3c')](_0x15102d[_0x50e0('0x33')]['sort']);_0x27db42[_0x50e0('0x3d')]=qs[_0x50e0('0x35')](_['pick'](_0x15102d[_0x50e0('0x33')],_0x4b04a8[_0x50e0('0x35')]),_0x3c3de8);if(_0x15102d['query'][_0x50e0('0x3e')]){_0x27db42[_0x50e0('0x3d')]=_['merge'](_0x27db42['where'],{'$or':_[_0x50e0('0x32')](_0x3c3de8,function(_0x56433a){if(_0x56433a[_0x50e0('0x2f')]!==_0x50e0('0x3f')){var _0x25bd18={};_0x25bd18[_0x56433a[_0x50e0('0x2a')]]={'$like':'%'+_0x15102d[_0x50e0('0x33')]['filter']+'%'};return _0x25bd18;}})});}_0x27db42=_['merge']({},_0x27db42,_0x15102d[_0x50e0('0x40')]);var _0x3dc394={'where':_0x27db42[_0x50e0('0x3d')]};return db[_0x50e0('0x2c')][_0x50e0('0x1f')](_0x3dc394)[_0x50e0('0x26')](function(_0x4339ae){_0x1028b7[_0x50e0('0x1f')]=_0x4339ae;if(_0x15102d[_0x50e0('0x33')][_0x50e0('0x41')]){_0x27db42[_0x50e0('0x42')]=[{'all':!![]}];}return db[_0x50e0('0x2c')][_0x50e0('0x43')](_0x27db42);})['then'](function(_0x4cf733){_0x1028b7[_0x50e0('0x44')]=_0x4cf733;return _0x1028b7;})[_0x50e0('0x26')](respondWithFilteredResult(_0xee221d,_0x27db42))[_0x50e0('0x45')](handleError(_0xee221d,null));};exports[_0x50e0('0x46')]=function(_0x4b50c9,_0x1807a3){var _0x41b34b={'raw':![],'where':{'id':_0x4b50c9[_0x50e0('0x47')]['id']}},_0x160840={};_0x160840[_0x50e0('0x31')]=_['keys'](db[_0x50e0('0x2c')][_0x50e0('0x2d')]);_0x160840['query']=_[_0x50e0('0x34')](_0x4b50c9[_0x50e0('0x33')]);_0x160840[_0x50e0('0x35')]=_['intersection'](_0x160840[_0x50e0('0x31')],_0x160840['query']);_0x41b34b['attributes']=_[_0x50e0('0x36')](_0x160840[_0x50e0('0x31')],qs[_0x50e0('0x37')](_0x4b50c9[_0x50e0('0x33')][_0x50e0('0x37')]));_0x41b34b[_0x50e0('0x38')]=_0x41b34b[_0x50e0('0x38')][_0x50e0('0x48')]?_0x41b34b[_0x50e0('0x38')]:_0x160840['model'];if(_0x4b50c9[_0x50e0('0x33')]['includeAll']){_0x41b34b['include']=[{'all':!![]}];}_0x41b34b=_[_0x50e0('0x49')]({},_0x41b34b,_0x4b50c9[_0x50e0('0x40')]);return db['AnalyticFieldReport'][_0x50e0('0x4a')](_0x41b34b)[_0x50e0('0x26')](handleEntityNotFound(_0x1807a3,null))[_0x50e0('0x26')](respondWithResult(_0x1807a3,null))[_0x50e0('0x45')](handleError(_0x1807a3,null));};exports[_0x50e0('0x4b')]=function(_0x5bd924,_0x755a1){return db[_0x50e0('0x2c')][_0x50e0('0x4b')](_0x5bd924[_0x50e0('0x4c')],{})['then'](respondWithResult(_0x755a1,0xc9))[_0x50e0('0x45')](handleError(_0x755a1,null));};exports[_0x50e0('0x4d')]=function(_0x51ba18,_0x410b27){return db[_0x50e0('0x2c')][_0x50e0('0x4d')](_0x51ba18[_0x50e0('0x4c')],{'raw':![],'individualHooks':!![]})[_0x50e0('0x26')](respondWithResult(_0x410b27,0xc9))[_0x50e0('0x45')](handleError(_0x410b27,null));};exports[_0x50e0('0x4e')]=function(_0x23df4d,_0x519d9e){if(_0x23df4d[_0x50e0('0x4c')]['id']){delete _0x23df4d['body']['id'];}return db[_0x50e0('0x2c')][_0x50e0('0x4a')]({'where':{'id':_0x23df4d[_0x50e0('0x47')]['id']}})['then'](handleEntityNotFound(_0x519d9e,null))[_0x50e0('0x26')](saveUpdates(_0x23df4d['body'],null))['then'](respondWithResult(_0x519d9e,null))[_0x50e0('0x45')](handleError(_0x519d9e,null));};exports[_0x50e0('0x27')]=function(_0x184cb8,_0x1d3004){return db[_0x50e0('0x2c')][_0x50e0('0x4a')]({'where':{'id':_0x184cb8['params']['id']}})[_0x50e0('0x26')](handleEntityNotFound(_0x1d3004,null))[_0x50e0('0x26')](removeEntity(_0x1d3004,null))[_0x50e0('0x45')](handleError(_0x1d3004,null));};exports[_0x50e0('0x4f')]=function(_0xf490be,_0x5b466c){return db[_0x50e0('0x2c')][_0x50e0('0x27')]({'where':{'id':_0xf490be[_0x50e0('0x33')]['ids']||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x5b466c,0xcc))[_0x50e0('0x45')](handleError(_0x5b466c,null));};exports[_0x50e0('0x50')]=function(_0x3e93b8,_0x3c934d,_0xd7409a){return db[_0x50e0('0x51')][_0x50e0('0x52')]({'where':{'id':_0x3e93b8['params']['id']}})['then'](handleEntityNotFound(_0x3c934d,null))[_0x50e0('0x26')](function(_0xd712a){if(_0xd712a){return db[_0x50e0('0x53')][_0x50e0('0x54')](function(_0x541975){return db['AnalyticFieldReport']['destroy']({'where':{'CustomReportId':_0x3e93b8[_0x50e0('0x47')]['id']},'transaction':_0x541975})[_0x50e0('0x26')](function(_0x3073a1){var _0x1d8c50=_[_0x50e0('0x32')](_0x3e93b8[_0x50e0('0x4c')],function(_0x573183){delete _0x573183['id'];_0x573183[_0x50e0('0x55')]=_0x3e93b8[_0x50e0('0x47')]['id'];return _0x573183;});return db[_0x50e0('0x2c')][_0x50e0('0x4d')](_0x1d8c50,{'transaction':_0x541975});});})['then'](function(){return db['AnalyticFieldReport'][_0x50e0('0x43')]({'where':{'CustomReportId':_0x3e93b8[_0x50e0('0x47')]['id']}});});}})[_0x50e0('0x26')](respondWithResult(_0x3c934d,null))['catch'](handleError(_0x3c934d,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index aad369d..6b88944 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 _0x33ea=['api','moment','bluebird','path','./analyticFieldReport.attributes','exports','AnalyticFieldReport','analytics_report_fields','lodash','util'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x33ea,0x1c0));var _0xa33e=function(_0x20cd38,_0x3a9033){_0x20cd38=_0x20cd38-0x0;var _0x52246d=_0x33ea[_0x20cd38];return _0x52246d;};'use strict';var _=require(_0xa33e('0x0'));var util=require(_0xa33e('0x1'));var logger=require('../../config/logger')(_0xa33e('0x2'));var moment=require(_0xa33e('0x3'));var BPromise=require(_0xa33e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa33e('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa33e('0x6'));module[_0xa33e('0x7')]=function(_0x2775d5,_0x816e2d){return _0x2775d5['define'](_0xa33e('0x8'),attributes,{'tableName':_0xa33e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5f6d=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticFieldReport.attributes','define','AnalyticFieldReport','lodash','util'];(function(_0x1f56fd,_0x374605){var _0x517f3b=function(_0x2dd330){while(--_0x2dd330){_0x1f56fd['push'](_0x1f56fd['shift']());}};_0x517f3b(++_0x374605);}(_0x5f6d,0x16a));var _0xd5f6=function(_0xb9b0f7,_0x353fd5){_0xb9b0f7=_0xb9b0f7-0x0;var _0x15912d=_0x5f6d[_0xb9b0f7];return _0x15912d;};'use strict';var _=require(_0xd5f6('0x0'));var util=require(_0xd5f6('0x1'));var logger=require(_0xd5f6('0x2'))(_0xd5f6('0x3'));var moment=require(_0xd5f6('0x4'));var BPromise=require(_0xd5f6('0x5'));var rp=require(_0xd5f6('0x6'));var fs=require('fs');var path=require(_0xd5f6('0x7'));var rimraf=require(_0xd5f6('0x8'));var config=require(_0xd5f6('0x9'));var attributes=require(_0xd5f6('0xa'));module['exports']=function(_0x5066ae,_0x341d52){return _0x5066ae[_0xd5f6('0xb')](_0xd5f6('0xc'),attributes,{'tableName':'analytics_report_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index 78c265f..95d1db3 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 _0x2df7=['request','then','info','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','AnalyticFieldReport,\x20%s,\x20%s','message','result','catch','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x5031a7,_0x4078be){var _0x56bf3e=function(_0x1b46ab){while(--_0x1b46ab){_0x5031a7['push'](_0x5031a7['shift']());}};_0x56bf3e(++_0x4078be);}(_0x2df7,0x141));var _0x72df=function(_0x3c5524,_0x205d78){_0x3c5524=_0x3c5524-0x0;var _0x408950=_0x2df7[_0x3c5524];return _0x408950;};'use strict';var _=require(_0x72df('0x0'));var util=require(_0x72df('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x72df('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x72df('0x3'))['db'];var utils=require(_0x72df('0x4'));var logger=require(_0x72df('0x5'))(_0x72df('0x6'));var config=require('../../config/environment');var jayson=require(_0x72df('0x7'));var client=jayson[_0x72df('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x29ed2d,_0x3238af,_0x5558b7){return new BPromise(function(_0x3d7e53,_0x4feeba){return client[_0x72df('0x9')](_0x29ed2d,_0x5558b7)[_0x72df('0xa')](function(_0x296627){logger[_0x72df('0xb')]('AnalyticFieldReport,\x20%s,\x20%s',_0x3238af,'request\x20sent');logger[_0x72df('0xc')](_0x72df('0xd'),_0x3238af,_0x72df('0xe'),JSON[_0x72df('0xf')](_0x296627));if(_0x296627['error']){if(_0x296627[_0x72df('0x10')][_0x72df('0x11')]===0x1f4){logger['error'](_0x72df('0x12'),_0x3238af,_0x296627['error'][_0x72df('0x13')]);return _0x4feeba(_0x296627[_0x72df('0x10')][_0x72df('0x13')]);}logger[_0x72df('0x10')]('AnalyticFieldReport,\x20%s,\x20%s',_0x3238af,_0x296627['error'][_0x72df('0x13')]);return _0x3d7e53(_0x296627[_0x72df('0x10')][_0x72df('0x13')]);}else{logger[_0x72df('0xb')](_0x72df('0x12'),_0x3238af,'request\x20sent');_0x3d7e53(_0x296627[_0x72df('0x14')][_0x72df('0x13')]);}})[_0x72df('0x15')](function(_0x1f441f){logger[_0x72df('0x10')](_0x72df('0x12'),_0x3238af,_0x1f441f);_0x4feeba(_0x1f441f);});});} \ No newline at end of file +var _0xba7a=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','AnalyticFieldReport,\x20%s,\x20%s','message','result','lodash','util','moment'];(function(_0x277698,_0x48c3da){var _0x221fe1=function(_0x1a770a){while(--_0x1a770a){_0x277698['push'](_0x277698['shift']());}};_0x221fe1(++_0x48c3da);}(_0xba7a,0x18d));var _0xaba7=function(_0x3f9f0a,_0x463a73){_0x3f9f0a=_0x3f9f0a-0x0;var _0x2ac3fd=_0xba7a[_0x3f9f0a];return _0x2ac3fd;};'use strict';var _=require(_0xaba7('0x0'));var util=require(_0xaba7('0x1'));var moment=require(_0xaba7('0x2'));var BPromise=require(_0xaba7('0x3'));var rs=require(_0xaba7('0x4'));var fs=require('fs');var Redis=require(_0xaba7('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xaba7('0x6'));var logger=require(_0xaba7('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xaba7('0x8'));var client=jayson['client'][_0xaba7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x13780d,_0x49e40c,_0x2d0684){return new BPromise(function(_0x32c06a,_0x2a9865){return client[_0xaba7('0xa')](_0x13780d,_0x2d0684)[_0xaba7('0xb')](function(_0x4bf5fe){logger[_0xaba7('0xc')]('AnalyticFieldReport,\x20%s,\x20%s',_0x49e40c,'request\x20sent');logger['debug'](_0xaba7('0xd'),_0x49e40c,_0xaba7('0xe'),JSON[_0xaba7('0xf')](_0x4bf5fe));if(_0x4bf5fe['error']){if(_0x4bf5fe[_0xaba7('0x10')]['code']===0x1f4){logger[_0xaba7('0x10')](_0xaba7('0x11'),_0x49e40c,_0x4bf5fe[_0xaba7('0x10')][_0xaba7('0x12')]);return _0x2a9865(_0x4bf5fe[_0xaba7('0x10')][_0xaba7('0x12')]);}logger[_0xaba7('0x10')](_0xaba7('0x11'),_0x49e40c,_0x4bf5fe[_0xaba7('0x10')][_0xaba7('0x12')]);return _0x32c06a(_0x4bf5fe[_0xaba7('0x10')][_0xaba7('0x12')]);}else{logger[_0xaba7('0xc')](_0xaba7('0x11'),_0x49e40c,_0xaba7('0xe'));_0x32c06a(_0x4bf5fe[_0xaba7('0x13')]['message']);}})['catch'](function(_0x358e5c){logger['error'](_0xaba7('0x11'),_0x49e40c,_0x358e5c);_0x2a9865(_0x358e5c);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index f39c98c..6470546 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(_0x114b70,_0x20d8b6){var _0x48e5b8=function(_0x3e6637){while(--_0x3e6637){_0x114b70['push'](_0x114b70['shift']());}};_0x48e5b8(++_0x20d8b6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));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(_0x2d9e85,_0x6ac8a4){var _0x1b01ce=function(_0x27a21c){while(--_0x27a21c){_0x2d9e85['push'](_0x2d9e85['shift']());}};_0x1b01ce(++_0x6ac8a4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));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 e1ac9d0..aff3658 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 _0x6584=['STRING','name','TEXT','sequelize','exports'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x6584,0x175));var _0x4658=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0x6584[_0x2b7764];return _0x848dcb;};'use strict';var Sequelize=require(_0x4658('0x0'));module[_0x4658('0x1')]={'name':{'type':Sequelize[_0x4658('0x2')],'allowNull':![],'unique':_0x4658('0x3')},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0x4658('0x4')]},'description':{'type':Sequelize[_0x4658('0x2')]}}; \ No newline at end of file +var _0x3276=['name','STRING','TEXT','sequelize'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x3276,0xc7));var _0x6327=function(_0x2fa0d7,_0x1fdf2d){_0x2fa0d7=_0x2fa0d7-0x0;var _0x162429=_0x3276[_0x2fa0d7];return _0x162429;};'use strict';var Sequelize=require(_0x6327('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x6327('0x1')},'table':{'type':Sequelize[_0x6327('0x2')]},'metric':{'type':Sequelize[_0x6327('0x3')]},'description':{'type':Sequelize[_0x6327('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 38c71ab..f1e4cea 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 _0x3e74=['status','set','Content-Range','apply','save','update','then','destroy','get','Metrics','sendStatus','stack','name','send','index','map','AnalyticMetric','fieldName','type','key','model','query','keys','attributes','intersection','fields','hasOwnProperty','sort','where','filters','pick','merge','VIRTUAL','filter','include','findAll','rows','catch','params','rawAttributes','length','includeAll','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','json','undefined','limit','offset','count'];(function(_0x3b6078,_0x4cccde){var _0x417d62=function(_0x5e99af){while(--_0x5e99af){_0x3b6078['push'](_0x3b6078['shift']());}};_0x417d62(++_0x4cccde);}(_0x3e74,0x175));var _0x43e7=function(_0x251a07,_0x3b5070){_0x251a07=_0x251a07-0x0;var _0xcdfbed=_0x3e74[_0x251a07];return _0xcdfbed;};'use strict';var emlformat=require(_0x43e7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x43e7('0x1'));var jsonpatch=require(_0x43e7('0x2'));var rp=require(_0x43e7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x43e7('0x4'));var util=require('util');var path=require(_0x43e7('0x5'));var sox=require(_0x43e7('0x6'));var csv=require(_0x43e7('0x7'));var ejs=require(_0x43e7('0x8'));var fs=require('fs');var fs_extra=require(_0x43e7('0x9'));var _=require('lodash');var squel=require(_0x43e7('0xa'));var crypto=require(_0x43e7('0xb'));var jsforce=require(_0x43e7('0xc'));var deskjs=require(_0x43e7('0xd'));var toCsv=require(_0x43e7('0x7'));var querystring=require('querystring');var Papa=require(_0x43e7('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x43e7('0xf'));var as=require(_0x43e7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x43e7('0x11'))('api');var utils=require(_0x43e7('0x12'));var config=require(_0x43e7('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x43e7('0x14'))['db'];function respondWithStatusCode(_0xc960ea,_0x2718d3){_0x2718d3=_0x2718d3||0xcc;return function(_0x3bb83f){if(_0x3bb83f){return _0xc960ea['sendStatus'](_0x2718d3);}return _0xc960ea['status'](_0x2718d3)[_0x43e7('0x15')]();};}function respondWithResult(_0x21fdd3,_0x44b0bd){_0x44b0bd=_0x44b0bd||0xc8;return function(_0x51b974){if(_0x51b974){return _0x21fdd3['status'](_0x44b0bd)[_0x43e7('0x16')](_0x51b974);}};}function respondWithFilteredResult(_0x14c146,_0x203378){return function(_0x328445){if(_0x328445){var _0x4de324=typeof _0x203378['offset']===_0x43e7('0x17')&&typeof _0x203378[_0x43e7('0x18')]===_0x43e7('0x17');var _0x5d346f=_0x328445['count'];var _0x446986=_0x4de324?0x0:_0x203378[_0x43e7('0x19')];var _0x9037d3=_0x4de324?_0x328445[_0x43e7('0x1a')]:_0x203378[_0x43e7('0x19')]+_0x203378[_0x43e7('0x18')];var _0x619236;if(_0x9037d3>=_0x5d346f){_0x9037d3=_0x5d346f;_0x619236=0xc8;}else{_0x619236=0xce;}_0x14c146[_0x43e7('0x1b')](_0x619236);return _0x14c146[_0x43e7('0x1c')](_0x43e7('0x1d'),_0x446986+'-'+_0x9037d3+'/'+_0x5d346f)[_0x43e7('0x16')](_0x328445);}return null;};}function patchUpdates(_0x177ee1){return function(_0x4b5d64){try{jsonpatch[_0x43e7('0x1e')](_0x4b5d64,_0x177ee1,!![]);}catch(_0x3c6625){return BPromise['reject'](_0x3c6625);}return _0x4b5d64[_0x43e7('0x1f')]();};}function saveUpdates(_0x3e281e,_0x3945bb){return function(_0x28aacc){if(_0x28aacc){return _0x28aacc[_0x43e7('0x20')](_0x3e281e)[_0x43e7('0x21')](function(_0x54a9e7){return _0x54a9e7;});}return null;};}function removeEntity(_0x454359,_0x4eea52){return function(_0x4c9df3){if(_0x4c9df3){return _0x4c9df3[_0x43e7('0x22')]()[_0x43e7('0x21')](function(){var _0x4b2b9f=_0x4c9df3[_0x43e7('0x23')]({'plain':!![]});var _0x4ca5cf=_0x43e7('0x24');return db['UserProfileResource'][_0x43e7('0x22')]({'where':{'type':_0x4ca5cf,'resourceId':_0x4b2b9f['id']}})[_0x43e7('0x21')](function(){return _0x4c9df3;});})[_0x43e7('0x21')](function(){_0x454359[_0x43e7('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x52b7b3,_0x805b54){return function(_0x501551){if(!_0x501551){_0x52b7b3[_0x43e7('0x25')](0x194);}return _0x501551;};}function handleError(_0x40dc8f,_0x3565cf){_0x3565cf=_0x3565cf||0x1f4;return function(_0xb1fc63){logger['error'](_0xb1fc63[_0x43e7('0x26')]);if(_0xb1fc63[_0x43e7('0x27')]){delete _0xb1fc63[_0x43e7('0x27')];}_0x40dc8f[_0x43e7('0x1b')](_0x3565cf)[_0x43e7('0x28')](_0xb1fc63);};}exports[_0x43e7('0x29')]=function(_0x2b85a5,_0x31b2a6){var _0x3bf475={},_0x35dbcd={},_0x17df44={'count':0x0,'rows':[]};var _0x19725a=_[_0x43e7('0x2a')](db[_0x43e7('0x2b')]['rawAttributes'],function(_0x238321){return{'name':_0x238321[_0x43e7('0x2c')],'type':_0x238321[_0x43e7('0x2d')][_0x43e7('0x2e')]};});_0x35dbcd[_0x43e7('0x2f')]=_['map'](_0x19725a,_0x43e7('0x27'));_0x35dbcd[_0x43e7('0x30')]=_[_0x43e7('0x31')](_0x2b85a5[_0x43e7('0x30')]);_0x35dbcd['filters']=_['intersection'](_0x35dbcd['model'],_0x35dbcd[_0x43e7('0x30')]);_0x3bf475[_0x43e7('0x32')]=_[_0x43e7('0x33')](_0x35dbcd[_0x43e7('0x2f')],qs[_0x43e7('0x34')](_0x2b85a5[_0x43e7('0x30')]['fields']));_0x3bf475['attributes']=_0x3bf475['attributes']['length']?_0x3bf475['attributes']:_0x35dbcd['model'];if(!_0x2b85a5['query'][_0x43e7('0x35')]('nolimit')){_0x3bf475[_0x43e7('0x18')]=qs[_0x43e7('0x18')](_0x2b85a5[_0x43e7('0x30')][_0x43e7('0x18')]);_0x3bf475[_0x43e7('0x19')]=qs[_0x43e7('0x19')](_0x2b85a5[_0x43e7('0x30')]['offset']);}_0x3bf475['order']=qs['sort'](_0x2b85a5[_0x43e7('0x30')][_0x43e7('0x36')]);_0x3bf475[_0x43e7('0x37')]=qs[_0x43e7('0x38')](_[_0x43e7('0x39')](_0x2b85a5[_0x43e7('0x30')],_0x35dbcd[_0x43e7('0x38')]),_0x19725a);if(_0x2b85a5[_0x43e7('0x30')]['filter']){_0x3bf475[_0x43e7('0x37')]=_[_0x43e7('0x3a')](_0x3bf475['where'],{'$or':_[_0x43e7('0x2a')](_0x19725a,function(_0x4c0c7a){if(_0x4c0c7a[_0x43e7('0x2d')]!==_0x43e7('0x3b')){var _0x1c6f45={};_0x1c6f45[_0x4c0c7a[_0x43e7('0x27')]]={'$like':'%'+_0x2b85a5[_0x43e7('0x30')][_0x43e7('0x3c')]+'%'};return _0x1c6f45;}})});}_0x3bf475=_['merge']({},_0x3bf475,_0x2b85a5['options']);var _0x30dfa9={'where':_0x3bf475[_0x43e7('0x37')]};return db[_0x43e7('0x2b')][_0x43e7('0x1a')](_0x30dfa9)[_0x43e7('0x21')](function(_0x4a4a85){_0x17df44[_0x43e7('0x1a')]=_0x4a4a85;if(_0x2b85a5[_0x43e7('0x30')]['includeAll']){_0x3bf475[_0x43e7('0x3d')]=[{'all':!![]}];}return db['AnalyticMetric'][_0x43e7('0x3e')](_0x3bf475);})['then'](function(_0x3d81ae){_0x17df44[_0x43e7('0x3f')]=_0x3d81ae;return _0x17df44;})[_0x43e7('0x21')](respondWithFilteredResult(_0x31b2a6,_0x3bf475))[_0x43e7('0x40')](handleError(_0x31b2a6,null));};exports['show']=function(_0x47d6a1,_0x103393){var _0x40c509={'raw':!![],'where':{'id':_0x47d6a1[_0x43e7('0x41')]['id']}},_0xe979b5={};_0xe979b5['model']=_['keys'](db['AnalyticMetric'][_0x43e7('0x42')]);_0xe979b5['query']=_[_0x43e7('0x31')](_0x47d6a1['query']);_0xe979b5['filters']=_[_0x43e7('0x33')](_0xe979b5['model'],_0xe979b5[_0x43e7('0x30')]);_0x40c509[_0x43e7('0x32')]=_[_0x43e7('0x33')](_0xe979b5[_0x43e7('0x2f')],qs['fields'](_0x47d6a1[_0x43e7('0x30')][_0x43e7('0x34')]));_0x40c509[_0x43e7('0x32')]=_0x40c509[_0x43e7('0x32')][_0x43e7('0x43')]?_0x40c509[_0x43e7('0x32')]:_0xe979b5['model'];if(_0x47d6a1['query'][_0x43e7('0x44')]){_0x40c509[_0x43e7('0x3d')]=[{'all':!![]}];}_0x40c509=_[_0x43e7('0x3a')]({},_0x40c509,_0x47d6a1['options']);return db['AnalyticMetric']['find'](_0x40c509)[_0x43e7('0x21')](handleEntityNotFound(_0x103393,null))[_0x43e7('0x21')](respondWithResult(_0x103393,null))['catch'](handleError(_0x103393,null));};exports[_0x43e7('0x45')]=function(_0x47686e,_0x3c96fe){return db['AnalyticMetric']['create'](_0x47686e['body'],{})['then'](function(_0x214e7e){var _0xe955fc=_0x47686e['user'][_0x43e7('0x23')]({'plain':!![]});if(!_0xe955fc)throw new Error(_0x43e7('0x46'));if(_0xe955fc[_0x43e7('0x47')]===_0x43e7('0x48')){var _0x4a0ce5=_0x214e7e[_0x43e7('0x23')]({'plain':!![]});var _0x483f20='Metrics';return db[_0x43e7('0x49')][_0x43e7('0x4a')]({'where':{'name':_0x483f20,'userProfileId':_0xe955fc[_0x43e7('0x4b')]},'raw':!![]})[_0x43e7('0x21')](function(_0x13503c){if(_0x13503c&&_0x13503c[_0x43e7('0x4c')]===0x0){return db[_0x43e7('0x4d')][_0x43e7('0x45')]({'name':_0x4a0ce5[_0x43e7('0x27')],'resourceId':_0x4a0ce5['id'],'type':_0x13503c[_0x43e7('0x27')],'sectionId':_0x13503c['id']},{})['then'](function(){return _0x214e7e;});}else{return _0x214e7e;}})[_0x43e7('0x40')](function(_0x46c910){logger['error'](_0x43e7('0x4e'),_0x46c910);throw _0x46c910;});}return _0x214e7e;})['then'](respondWithResult(_0x3c96fe,0xc9))[_0x43e7('0x40')](handleError(_0x3c96fe,null));};exports[_0x43e7('0x20')]=function(_0x34e2ec,_0x1f561f){if(_0x34e2ec[_0x43e7('0x4f')]['id']){delete _0x34e2ec['body']['id'];}return db['AnalyticMetric'][_0x43e7('0x4a')]({'where':{'id':_0x34e2ec[_0x43e7('0x41')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x1f561f,null))[_0x43e7('0x21')](saveUpdates(_0x34e2ec[_0x43e7('0x4f')],null))[_0x43e7('0x21')](respondWithResult(_0x1f561f,null))[_0x43e7('0x40')](handleError(_0x1f561f,null));};exports[_0x43e7('0x22')]=function(_0x26d86c,_0x24e758){return db[_0x43e7('0x2b')]['find']({'where':{'id':_0x26d86c[_0x43e7('0x41')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x24e758,null))['then'](removeEntity(_0x24e758,null))[_0x43e7('0x40')](handleError(_0x24e758,null));}; \ No newline at end of file +var _0x3e74=['status','set','Content-Range','apply','save','update','then','destroy','get','Metrics','sendStatus','stack','name','send','index','map','AnalyticMetric','fieldName','type','key','model','query','keys','attributes','intersection','fields','hasOwnProperty','sort','where','filters','pick','merge','VIRTUAL','filter','include','findAll','rows','catch','params','rawAttributes','length','includeAll','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','json','undefined','limit','offset','count'];(function(_0x156795,_0x4cb45a){var _0x6d3d7e=function(_0x1a40b7){while(--_0x1a40b7){_0x156795['push'](_0x156795['shift']());}};_0x6d3d7e(++_0x4cb45a);}(_0x3e74,0x175));var _0x43e7=function(_0x1840cf,_0x5bd637){_0x1840cf=_0x1840cf-0x0;var _0x352648=_0x3e74[_0x1840cf];return _0x352648;};'use strict';var emlformat=require(_0x43e7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x43e7('0x1'));var jsonpatch=require(_0x43e7('0x2'));var rp=require(_0x43e7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x43e7('0x4'));var util=require('util');var path=require(_0x43e7('0x5'));var sox=require(_0x43e7('0x6'));var csv=require(_0x43e7('0x7'));var ejs=require(_0x43e7('0x8'));var fs=require('fs');var fs_extra=require(_0x43e7('0x9'));var _=require('lodash');var squel=require(_0x43e7('0xa'));var crypto=require(_0x43e7('0xb'));var jsforce=require(_0x43e7('0xc'));var deskjs=require(_0x43e7('0xd'));var toCsv=require(_0x43e7('0x7'));var querystring=require('querystring');var Papa=require(_0x43e7('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x43e7('0xf'));var as=require(_0x43e7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x43e7('0x11'))('api');var utils=require(_0x43e7('0x12'));var config=require(_0x43e7('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x43e7('0x14'))['db'];function respondWithStatusCode(_0xc960ea,_0x2718d3){_0x2718d3=_0x2718d3||0xcc;return function(_0x3bb83f){if(_0x3bb83f){return _0xc960ea['sendStatus'](_0x2718d3);}return _0xc960ea['status'](_0x2718d3)[_0x43e7('0x15')]();};}function respondWithResult(_0x21fdd3,_0x44b0bd){_0x44b0bd=_0x44b0bd||0xc8;return function(_0x51b974){if(_0x51b974){return _0x21fdd3['status'](_0x44b0bd)[_0x43e7('0x16')](_0x51b974);}};}function respondWithFilteredResult(_0x14c146,_0x203378){return function(_0x328445){if(_0x328445){var _0x4de324=typeof _0x203378['offset']===_0x43e7('0x17')&&typeof _0x203378[_0x43e7('0x18')]===_0x43e7('0x17');var _0x5d346f=_0x328445['count'];var _0x446986=_0x4de324?0x0:_0x203378[_0x43e7('0x19')];var _0x9037d3=_0x4de324?_0x328445[_0x43e7('0x1a')]:_0x203378[_0x43e7('0x19')]+_0x203378[_0x43e7('0x18')];var _0x619236;if(_0x9037d3>=_0x5d346f){_0x9037d3=_0x5d346f;_0x619236=0xc8;}else{_0x619236=0xce;}_0x14c146[_0x43e7('0x1b')](_0x619236);return _0x14c146[_0x43e7('0x1c')](_0x43e7('0x1d'),_0x446986+'-'+_0x9037d3+'/'+_0x5d346f)[_0x43e7('0x16')](_0x328445);}return null;};}function patchUpdates(_0x177ee1){return function(_0x4b5d64){try{jsonpatch[_0x43e7('0x1e')](_0x4b5d64,_0x177ee1,!![]);}catch(_0x3c6625){return BPromise['reject'](_0x3c6625);}return _0x4b5d64[_0x43e7('0x1f')]();};}function saveUpdates(_0x3e281e,_0x3945bb){return function(_0x28aacc){if(_0x28aacc){return _0x28aacc[_0x43e7('0x20')](_0x3e281e)[_0x43e7('0x21')](function(_0x54a9e7){return _0x54a9e7;});}return null;};}function removeEntity(_0x454359,_0x4eea52){return function(_0x4c9df3){if(_0x4c9df3){return _0x4c9df3[_0x43e7('0x22')]()[_0x43e7('0x21')](function(){var _0x4b2b9f=_0x4c9df3[_0x43e7('0x23')]({'plain':!![]});var _0x4ca5cf=_0x43e7('0x24');return db['UserProfileResource'][_0x43e7('0x22')]({'where':{'type':_0x4ca5cf,'resourceId':_0x4b2b9f['id']}})[_0x43e7('0x21')](function(){return _0x4c9df3;});})[_0x43e7('0x21')](function(){_0x454359[_0x43e7('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x52b7b3,_0x805b54){return function(_0x501551){if(!_0x501551){_0x52b7b3[_0x43e7('0x25')](0x194);}return _0x501551;};}function handleError(_0x40dc8f,_0x3565cf){_0x3565cf=_0x3565cf||0x1f4;return function(_0xb1fc63){logger['error'](_0xb1fc63[_0x43e7('0x26')]);if(_0xb1fc63[_0x43e7('0x27')]){delete _0xb1fc63[_0x43e7('0x27')];}_0x40dc8f[_0x43e7('0x1b')](_0x3565cf)[_0x43e7('0x28')](_0xb1fc63);};}exports[_0x43e7('0x29')]=function(_0x2b85a5,_0x31b2a6){var _0x3bf475={},_0x35dbcd={},_0x17df44={'count':0x0,'rows':[]};var _0x19725a=_[_0x43e7('0x2a')](db[_0x43e7('0x2b')]['rawAttributes'],function(_0x238321){return{'name':_0x238321[_0x43e7('0x2c')],'type':_0x238321[_0x43e7('0x2d')][_0x43e7('0x2e')]};});_0x35dbcd[_0x43e7('0x2f')]=_['map'](_0x19725a,_0x43e7('0x27'));_0x35dbcd[_0x43e7('0x30')]=_[_0x43e7('0x31')](_0x2b85a5[_0x43e7('0x30')]);_0x35dbcd['filters']=_['intersection'](_0x35dbcd['model'],_0x35dbcd[_0x43e7('0x30')]);_0x3bf475[_0x43e7('0x32')]=_[_0x43e7('0x33')](_0x35dbcd[_0x43e7('0x2f')],qs[_0x43e7('0x34')](_0x2b85a5[_0x43e7('0x30')]['fields']));_0x3bf475['attributes']=_0x3bf475['attributes']['length']?_0x3bf475['attributes']:_0x35dbcd['model'];if(!_0x2b85a5['query'][_0x43e7('0x35')]('nolimit')){_0x3bf475[_0x43e7('0x18')]=qs[_0x43e7('0x18')](_0x2b85a5[_0x43e7('0x30')][_0x43e7('0x18')]);_0x3bf475[_0x43e7('0x19')]=qs[_0x43e7('0x19')](_0x2b85a5[_0x43e7('0x30')]['offset']);}_0x3bf475['order']=qs['sort'](_0x2b85a5[_0x43e7('0x30')][_0x43e7('0x36')]);_0x3bf475[_0x43e7('0x37')]=qs[_0x43e7('0x38')](_[_0x43e7('0x39')](_0x2b85a5[_0x43e7('0x30')],_0x35dbcd[_0x43e7('0x38')]),_0x19725a);if(_0x2b85a5[_0x43e7('0x30')]['filter']){_0x3bf475[_0x43e7('0x37')]=_[_0x43e7('0x3a')](_0x3bf475['where'],{'$or':_[_0x43e7('0x2a')](_0x19725a,function(_0x4c0c7a){if(_0x4c0c7a[_0x43e7('0x2d')]!==_0x43e7('0x3b')){var _0x1c6f45={};_0x1c6f45[_0x4c0c7a[_0x43e7('0x27')]]={'$like':'%'+_0x2b85a5[_0x43e7('0x30')][_0x43e7('0x3c')]+'%'};return _0x1c6f45;}})});}_0x3bf475=_['merge']({},_0x3bf475,_0x2b85a5['options']);var _0x30dfa9={'where':_0x3bf475[_0x43e7('0x37')]};return db[_0x43e7('0x2b')][_0x43e7('0x1a')](_0x30dfa9)[_0x43e7('0x21')](function(_0x4a4a85){_0x17df44[_0x43e7('0x1a')]=_0x4a4a85;if(_0x2b85a5[_0x43e7('0x30')]['includeAll']){_0x3bf475[_0x43e7('0x3d')]=[{'all':!![]}];}return db['AnalyticMetric'][_0x43e7('0x3e')](_0x3bf475);})['then'](function(_0x3d81ae){_0x17df44[_0x43e7('0x3f')]=_0x3d81ae;return _0x17df44;})[_0x43e7('0x21')](respondWithFilteredResult(_0x31b2a6,_0x3bf475))[_0x43e7('0x40')](handleError(_0x31b2a6,null));};exports['show']=function(_0x47d6a1,_0x103393){var _0x40c509={'raw':!![],'where':{'id':_0x47d6a1[_0x43e7('0x41')]['id']}},_0xe979b5={};_0xe979b5['model']=_['keys'](db['AnalyticMetric'][_0x43e7('0x42')]);_0xe979b5['query']=_[_0x43e7('0x31')](_0x47d6a1['query']);_0xe979b5['filters']=_[_0x43e7('0x33')](_0xe979b5['model'],_0xe979b5[_0x43e7('0x30')]);_0x40c509[_0x43e7('0x32')]=_[_0x43e7('0x33')](_0xe979b5[_0x43e7('0x2f')],qs['fields'](_0x47d6a1[_0x43e7('0x30')][_0x43e7('0x34')]));_0x40c509[_0x43e7('0x32')]=_0x40c509[_0x43e7('0x32')][_0x43e7('0x43')]?_0x40c509[_0x43e7('0x32')]:_0xe979b5['model'];if(_0x47d6a1['query'][_0x43e7('0x44')]){_0x40c509[_0x43e7('0x3d')]=[{'all':!![]}];}_0x40c509=_[_0x43e7('0x3a')]({},_0x40c509,_0x47d6a1['options']);return db['AnalyticMetric']['find'](_0x40c509)[_0x43e7('0x21')](handleEntityNotFound(_0x103393,null))[_0x43e7('0x21')](respondWithResult(_0x103393,null))['catch'](handleError(_0x103393,null));};exports[_0x43e7('0x45')]=function(_0x47686e,_0x3c96fe){return db['AnalyticMetric']['create'](_0x47686e['body'],{})['then'](function(_0x214e7e){var _0xe955fc=_0x47686e['user'][_0x43e7('0x23')]({'plain':!![]});if(!_0xe955fc)throw new Error(_0x43e7('0x46'));if(_0xe955fc[_0x43e7('0x47')]===_0x43e7('0x48')){var _0x4a0ce5=_0x214e7e[_0x43e7('0x23')]({'plain':!![]});var _0x483f20='Metrics';return db[_0x43e7('0x49')][_0x43e7('0x4a')]({'where':{'name':_0x483f20,'userProfileId':_0xe955fc[_0x43e7('0x4b')]},'raw':!![]})[_0x43e7('0x21')](function(_0x13503c){if(_0x13503c&&_0x13503c[_0x43e7('0x4c')]===0x0){return db[_0x43e7('0x4d')][_0x43e7('0x45')]({'name':_0x4a0ce5[_0x43e7('0x27')],'resourceId':_0x4a0ce5['id'],'type':_0x13503c[_0x43e7('0x27')],'sectionId':_0x13503c['id']},{})['then'](function(){return _0x214e7e;});}else{return _0x214e7e;}})[_0x43e7('0x40')](function(_0x46c910){logger['error'](_0x43e7('0x4e'),_0x46c910);throw _0x46c910;});}return _0x214e7e;})['then'](respondWithResult(_0x3c96fe,0xc9))[_0x43e7('0x40')](handleError(_0x3c96fe,null));};exports[_0x43e7('0x20')]=function(_0x34e2ec,_0x1f561f){if(_0x34e2ec[_0x43e7('0x4f')]['id']){delete _0x34e2ec['body']['id'];}return db['AnalyticMetric'][_0x43e7('0x4a')]({'where':{'id':_0x34e2ec[_0x43e7('0x41')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x1f561f,null))[_0x43e7('0x21')](saveUpdates(_0x34e2ec[_0x43e7('0x4f')],null))[_0x43e7('0x21')](respondWithResult(_0x1f561f,null))[_0x43e7('0x40')](handleError(_0x1f561f,null));};exports[_0x43e7('0x22')]=function(_0x26d86c,_0x24e758){return db[_0x43e7('0x2b')]['find']({'where':{'id':_0x26d86c[_0x43e7('0x41')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x24e758,null))['then'](removeEntity(_0x24e758,null))[_0x43e7('0x40')](handleError(_0x24e758,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index aa8cc9b..57b4e44 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 _0x980e=['api','bluebird','path','rimraf','exports','define','AnalyticMetric','analytics_metrics','lodash'];(function(_0x56724d,_0x25749f){var _0x4201ba=function(_0x3c4fd5){while(--_0x3c4fd5){_0x56724d['push'](_0x56724d['shift']());}};_0x4201ba(++_0x25749f);}(_0x980e,0x1a6));var _0xe980=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x980e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe980('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xe980('0x1'));var moment=require('moment');var BPromise=require(_0xe980('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe980('0x3'));var rimraf=require(_0xe980('0x4'));var config=require('../../config/environment');var attributes=require('./analyticMetric.attributes');module[_0xe980('0x5')]=function(_0x55b114,_0x539945){return _0x55b114[_0xe980('0x6')](_0xe980('0x7'),attributes,{'tableName':_0xe980('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd991=['./analyticMetric.attributes','exports','define','analytics_metrics','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x2e1d3d,_0x719bf0){var _0x3d81df=function(_0x3ddfa3){while(--_0x3ddfa3){_0x2e1d3d['push'](_0x2e1d3d['shift']());}};_0x3d81df(++_0x719bf0);}(_0xd991,0x115));var _0x1d99=function(_0x54dcb1,_0x21a9c9){_0x54dcb1=_0x54dcb1-0x0;var _0x284141=_0xd991[_0x54dcb1];return _0x284141;};'use strict';var _=require(_0x1d99('0x0'));var util=require(_0x1d99('0x1'));var logger=require(_0x1d99('0x2'))(_0x1d99('0x3'));var moment=require(_0x1d99('0x4'));var BPromise=require('bluebird');var rp=require(_0x1d99('0x5'));var fs=require('fs');var path=require(_0x1d99('0x6'));var rimraf=require(_0x1d99('0x7'));var config=require(_0x1d99('0x8'));var attributes=require(_0x1d99('0x9'));module[_0x1d99('0xa')]=function(_0x5f3a37,_0x1adbca){return _0x5f3a37[_0x1d99('0xb')]('AnalyticMetric',attributes,{'tableName':_0x1d99('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 62e7b52..2900d69 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 _0xa899=['stringify','error','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','AnalyticMetric,\x20%s,\x20%s,\x20%s'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa899,0x17a));var _0x9a89=function(_0x1b8d87,_0x4168fb){_0x1b8d87=_0x1b8d87-0x0;var _0x182b74=_0xa899[_0x1b8d87];return _0x182b74;};'use strict';var _=require(_0x9a89('0x0'));var util=require(_0x9a89('0x1'));var moment=require('moment');var BPromise=require(_0x9a89('0x2'));var rs=require(_0x9a89('0x3'));var fs=require('fs');var Redis=require(_0x9a89('0x4'));var db=require(_0x9a89('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9a89('0x6'));var config=require('../../config/environment');var jayson=require(_0x9a89('0x7'));var client=jayson[_0x9a89('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x531a05,_0x580e6b,_0x29f6bd){return new BPromise(function(_0x38fae9,_0x54fc9c){return client['request'](_0x531a05,_0x29f6bd)['then'](function(_0x47c54d){logger[_0x9a89('0x9')](_0x9a89('0xa'),_0x580e6b,_0x9a89('0xb'));logger['debug'](_0x9a89('0xc'),_0x580e6b,'request\x20sent',JSON[_0x9a89('0xd')](_0x47c54d));if(_0x47c54d[_0x9a89('0xe')]){if(_0x47c54d['error']['code']===0x1f4){logger[_0x9a89('0xe')](_0x9a89('0xa'),_0x580e6b,_0x47c54d[_0x9a89('0xe')][_0x9a89('0xf')]);return _0x54fc9c(_0x47c54d[_0x9a89('0xe')]['message']);}logger[_0x9a89('0xe')](_0x9a89('0xa'),_0x580e6b,_0x47c54d[_0x9a89('0xe')][_0x9a89('0xf')]);return _0x38fae9(_0x47c54d[_0x9a89('0xe')][_0x9a89('0xf')]);}else{logger[_0x9a89('0x9')]('AnalyticMetric,\x20%s,\x20%s',_0x580e6b,'request\x20sent');_0x38fae9(_0x47c54d['result'][_0x9a89('0xf')]);}})[_0x9a89('0x10')](function(_0x1347fe){logger[_0x9a89('0xe')](_0x9a89('0xa'),_0x580e6b,_0x1347fe);_0x54fc9c(_0x1347fe);});});} \ No newline at end of file +var _0x4147=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x3d86a4,_0x43dc05){var _0x100df5=function(_0x24d968){while(--_0x24d968){_0x3d86a4['push'](_0x3d86a4['shift']());}};_0x100df5(++_0x43dc05);}(_0x4147,0x19e));var _0x7414=function(_0xb4ce71,_0x23158f){_0xb4ce71=_0xb4ce71-0x0;var _0x476202=_0x4147[_0xb4ce71];return _0x476202;};'use strict';var _=require(_0x7414('0x0'));var util=require(_0x7414('0x1'));var moment=require(_0x7414('0x2'));var BPromise=require(_0x7414('0x3'));var rs=require(_0x7414('0x4'));var fs=require('fs');var Redis=require(_0x7414('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7414('0x6'))(_0x7414('0x7'));var config=require(_0x7414('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7414('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3f3782,_0x4b3e03,_0x15e863){return new BPromise(function(_0x620f55,_0xa3efdd){return client[_0x7414('0xa')](_0x3f3782,_0x15e863)[_0x7414('0xb')](function(_0x19d46a){logger[_0x7414('0xc')](_0x7414('0xd'),_0x4b3e03,_0x7414('0xe'));logger[_0x7414('0xf')](_0x7414('0x10'),_0x4b3e03,_0x7414('0xe'),JSON[_0x7414('0x11')](_0x19d46a));if(_0x19d46a[_0x7414('0x12')]){if(_0x19d46a['error'][_0x7414('0x13')]===0x1f4){logger[_0x7414('0x12')](_0x7414('0xd'),_0x4b3e03,_0x19d46a[_0x7414('0x12')]['message']);return _0xa3efdd(_0x19d46a['error'][_0x7414('0x14')]);}logger[_0x7414('0x12')](_0x7414('0xd'),_0x4b3e03,_0x19d46a[_0x7414('0x12')][_0x7414('0x14')]);return _0x620f55(_0x19d46a[_0x7414('0x12')]['message']);}else{logger[_0x7414('0xc')](_0x7414('0xd'),_0x4b3e03,'request\x20sent');_0x620f55(_0x19d46a[_0x7414('0x15')][_0x7414('0x14')]);}})[_0x7414('0x16')](function(_0x105b0c){logger[_0x7414('0x12')](_0x7414('0xd'),_0x4b3e03,_0x105b0c);_0xa3efdd(_0x105b0c);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 4f7626c..e476f1e 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 _0x0b3d=['express','fs-extra','../../components/interaction/service','./analyticMetric.controller','get','index','/:id','post','put','isAuthenticated','update','destroy','exports','multer','path'];(function(_0x3497b2,_0x32c98b){var _0x3c4622=function(_0x5c3fc2){while(--_0x5c3fc2){_0x3497b2['push'](_0x3497b2['shift']());}};_0x3c4622(++_0x32c98b);}(_0x0b3d,0x76));var _0xd0b3=function(_0x57d4c4,_0x1eb1c7){_0x57d4c4=_0x57d4c4-0x0;var _0x551561=_0x0b3d[_0x57d4c4];return _0x551561;};'use strict';var multer=require(_0xd0b3('0x0'));var util=require('util');var path=require(_0xd0b3('0x1'));var timeout=require('connect-timeout');var express=require(_0xd0b3('0x2'));var router=express['Router']();var fs_extra=require(_0xd0b3('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xd0b3('0x4'));var config=require('../../config/environment');var controller=require(_0xd0b3('0x5'));router[_0xd0b3('0x6')]('/',auth['isAuthenticated'](),controller[_0xd0b3('0x7')]);router['get'](_0xd0b3('0x8'),auth['isAuthenticated'](),controller['show']);router[_0xd0b3('0x9')]('/',auth['isAuthenticated'](),controller['create']);router[_0xd0b3('0xa')]('/:id',auth[_0xd0b3('0xb')](),controller[_0xd0b3('0xc')]);router['delete']('/:id',auth[_0xd0b3('0xb')](),controller[_0xd0b3('0xd')]);module[_0xd0b3('0xe')]=router; \ No newline at end of file +var _0x4d61=['create','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticMetric.controller','get','isAuthenticated','index','/:id','post'];(function(_0x45b1ad,_0x3128e3){var _0x3a36df=function(_0x3bae63){while(--_0x3bae63){_0x45b1ad['push'](_0x45b1ad['shift']());}};_0x3a36df(++_0x3128e3);}(_0x4d61,0x147));var _0x14d6=function(_0x125243,_0x119e35){_0x125243=_0x125243-0x0;var _0x1e1a69=_0x4d61[_0x125243];return _0x1e1a69;};'use strict';var multer=require(_0x14d6('0x0'));var util=require(_0x14d6('0x1'));var path=require(_0x14d6('0x2'));var timeout=require(_0x14d6('0x3'));var express=require(_0x14d6('0x4'));var router=express[_0x14d6('0x5')]();var fs_extra=require(_0x14d6('0x6'));var auth=require(_0x14d6('0x7'));var interaction=require(_0x14d6('0x8'));var config=require('../../config/environment');var controller=require(_0x14d6('0x9'));router[_0x14d6('0xa')]('/',auth[_0x14d6('0xb')](),controller[_0x14d6('0xc')]);router[_0x14d6('0xa')](_0x14d6('0xd'),auth[_0x14d6('0xb')](),controller['show']);router[_0x14d6('0xe')]('/',auth['isAuthenticated'](),controller[_0x14d6('0xf')]);router['put'](_0x14d6('0xd'),auth[_0x14d6('0xb')](),controller['update']);router[_0x14d6('0x10')](_0x14d6('0xd'),auth[_0x14d6('0xb')](),controller[_0x14d6('0x11')]);module[_0x14d6('0x12')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 0d13aee..c70d5c0 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 _0xfa71=['TEXT'];(function(_0x5660d5,_0x235c27){var _0x2a144d=function(_0x54fb3f){while(--_0x54fb3f){_0x5660d5['push'](_0x5660d5['shift']());}};_0x2a144d(++_0x235c27);}(_0xfa71,0x13c));var _0x1fa7=function(_0x3585cc,_0x43fc48){_0x3585cc=_0x3585cc-0x0;var _0x19e326=_0xfa71[_0x3585cc];return _0x19e326;};'use strict';var Sequelize=require('sequelize');module['exports']={'tree':{'type':Sequelize[_0x1fa7('0x0')],'allowNull':![]}}; \ No newline at end of file +var _0x3d56=['TEXT','sequelize'];(function(_0x2590f9,_0x57deb0){var _0x2b2779=function(_0x2444ec){while(--_0x2444ec){_0x2590f9['push'](_0x2590f9['shift']());}};_0x2b2779(++_0x57deb0);}(_0x3d56,0xd3));var _0x63d5=function(_0x4dd0e0,_0x11b9e9){_0x4dd0e0=_0x4dd0e0-0x0;var _0x11d1af=_0x3d56[_0x4dd0e0];return _0x11d1af;};'use strict';var Sequelize=require(_0x63d5('0x0'));module['exports']={'tree':{'type':Sequelize[_0x63d5('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 e27ca1b..49cde00 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 _0xeaf9=['model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','params','create','body','find','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','destroy','then','error','stack','name','send','map','AnalyticTreeReport','rawAttributes','type','key'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0xeaf9,0x1dc));var _0x9eaf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xeaf9[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x9eaf('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9eaf('0x1'));var jsonpatch=require(_0x9eaf('0x2'));var rp=require(_0x9eaf('0x3'));var moment=require('moment');var BPromise=require(_0x9eaf('0x4'));var Mustache=require(_0x9eaf('0x5'));var util=require(_0x9eaf('0x6'));var path=require('path');var sox=require(_0x9eaf('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9eaf('0x8'));var _=require(_0x9eaf('0x9'));var squel=require(_0x9eaf('0xa'));var crypto=require(_0x9eaf('0xb'));var jsforce=require(_0x9eaf('0xc'));var deskjs=require(_0x9eaf('0xd'));var toCsv=require(_0x9eaf('0xe'));var querystring=require('querystring');var Papa=require(_0x9eaf('0xf'));var Redis=require(_0x9eaf('0x10'));var authService=require(_0x9eaf('0x11'));var qs=require(_0x9eaf('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9eaf('0x13'));var logger=require(_0x9eaf('0x14'))(_0x9eaf('0x15'));var utils=require(_0x9eaf('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x9eaf('0x17'));var db=require(_0x9eaf('0x18'))['db'];function respondWithStatusCode(_0x464b6f,_0x243b7e){_0x243b7e=_0x243b7e||0xcc;return function(_0x12132a){if(_0x12132a){return _0x464b6f[_0x9eaf('0x19')](_0x243b7e);}return _0x464b6f[_0x9eaf('0x1a')](_0x243b7e)[_0x9eaf('0x1b')]();};}function respondWithResult(_0x25c4bc,_0x85424a){_0x85424a=_0x85424a||0xc8;return function(_0x5e9681){if(_0x5e9681){return _0x25c4bc[_0x9eaf('0x1a')](_0x85424a)[_0x9eaf('0x1c')](_0x5e9681);}};}function respondWithFilteredResult(_0x2815b4,_0x5bc6b0){return function(_0x529eb8){if(_0x529eb8){var _0x1126ea=typeof _0x5bc6b0[_0x9eaf('0x1d')]==='undefined'&&typeof _0x5bc6b0[_0x9eaf('0x1e')]===_0x9eaf('0x1f');var _0x17c118=_0x529eb8[_0x9eaf('0x20')];var _0x173a58=_0x1126ea?0x0:_0x5bc6b0[_0x9eaf('0x1d')];var _0x489521=_0x1126ea?_0x529eb8['count']:_0x5bc6b0['offset']+_0x5bc6b0[_0x9eaf('0x1e')];var _0xa45aa5;if(_0x489521>=_0x17c118){_0x489521=_0x17c118;_0xa45aa5=0xc8;}else{_0xa45aa5=0xce;}_0x2815b4[_0x9eaf('0x1a')](_0xa45aa5);return _0x2815b4[_0x9eaf('0x21')](_0x9eaf('0x22'),_0x173a58+'-'+_0x489521+'/'+_0x17c118)['json'](_0x529eb8);}return null;};}function patchUpdates(_0xf28d27){return function(_0x324b96){try{jsonpatch[_0x9eaf('0x23')](_0x324b96,_0xf28d27,!![]);}catch(_0x118a46){return BPromise[_0x9eaf('0x24')](_0x118a46);}return _0x324b96['save']();};}function saveUpdates(_0x13288f,_0x2cc01f){return function(_0x2ac284){if(_0x2ac284){return _0x2ac284[_0x9eaf('0x25')](_0x13288f)['then'](function(_0x2b22aa){return _0x2b22aa;});}return null;};}function removeEntity(_0x17f8ec,_0x52f435){return function(_0x51b172){if(_0x51b172){return _0x51b172[_0x9eaf('0x26')]()[_0x9eaf('0x27')](function(){_0x17f8ec[_0x9eaf('0x1a')](0xcc)[_0x9eaf('0x1b')]();});}};}function handleEntityNotFound(_0x3a934e,_0x38f021){return function(_0x14f035){if(!_0x14f035){_0x3a934e[_0x9eaf('0x19')](0x194);}return _0x14f035;};}function handleError(_0x445490,_0x43dfb0){_0x43dfb0=_0x43dfb0||0x1f4;return function(_0x56a9bd){logger[_0x9eaf('0x28')](_0x56a9bd[_0x9eaf('0x29')]);if(_0x56a9bd[_0x9eaf('0x2a')]){delete _0x56a9bd['name'];}_0x445490['status'](_0x43dfb0)[_0x9eaf('0x2b')](_0x56a9bd);};}exports['index']=function(_0x1c822d,_0x263553){var _0x3529e9={},_0x582b95={},_0x2e4c20={'count':0x0,'rows':[]};var _0x2f1102=_[_0x9eaf('0x2c')](db[_0x9eaf('0x2d')][_0x9eaf('0x2e')],function(_0xd14d49){return{'name':_0xd14d49['fieldName'],'type':_0xd14d49[_0x9eaf('0x2f')][_0x9eaf('0x30')]};});_0x582b95[_0x9eaf('0x31')]=_[_0x9eaf('0x2c')](_0x2f1102,_0x9eaf('0x2a'));_0x582b95[_0x9eaf('0x32')]=_[_0x9eaf('0x33')](_0x1c822d[_0x9eaf('0x32')]);_0x582b95[_0x9eaf('0x34')]=_[_0x9eaf('0x35')](_0x582b95[_0x9eaf('0x31')],_0x582b95[_0x9eaf('0x32')]);_0x3529e9[_0x9eaf('0x36')]=_[_0x9eaf('0x35')](_0x582b95['model'],qs[_0x9eaf('0x37')](_0x1c822d[_0x9eaf('0x32')][_0x9eaf('0x37')]));_0x3529e9['attributes']=_0x3529e9[_0x9eaf('0x36')][_0x9eaf('0x38')]?_0x3529e9[_0x9eaf('0x36')]:_0x582b95[_0x9eaf('0x31')];if(!_0x1c822d[_0x9eaf('0x32')][_0x9eaf('0x39')](_0x9eaf('0x3a'))){_0x3529e9[_0x9eaf('0x1e')]=qs[_0x9eaf('0x1e')](_0x1c822d[_0x9eaf('0x32')][_0x9eaf('0x1e')]);_0x3529e9['offset']=qs[_0x9eaf('0x1d')](_0x1c822d[_0x9eaf('0x32')]['offset']);}_0x3529e9[_0x9eaf('0x3b')]=qs[_0x9eaf('0x3c')](_0x1c822d[_0x9eaf('0x32')]['sort']);_0x3529e9[_0x9eaf('0x3d')]=qs[_0x9eaf('0x34')](_[_0x9eaf('0x3e')](_0x1c822d[_0x9eaf('0x32')],_0x582b95[_0x9eaf('0x34')]),_0x2f1102);if(_0x1c822d[_0x9eaf('0x32')][_0x9eaf('0x3f')]){_0x3529e9['where']=_['merge'](_0x3529e9[_0x9eaf('0x3d')],{'$or':_[_0x9eaf('0x2c')](_0x2f1102,function(_0x22689f){if(_0x22689f[_0x9eaf('0x2f')]!=='VIRTUAL'){var _0x3ecfc0={};_0x3ecfc0[_0x22689f['name']]={'$like':'%'+_0x1c822d[_0x9eaf('0x32')][_0x9eaf('0x3f')]+'%'};return _0x3ecfc0;}})});}_0x3529e9=_[_0x9eaf('0x40')]({},_0x3529e9,_0x1c822d[_0x9eaf('0x41')]);var _0x553f6b={'where':_0x3529e9['where']};return db[_0x9eaf('0x2d')][_0x9eaf('0x20')](_0x553f6b)[_0x9eaf('0x27')](function(_0xf2433f){_0x2e4c20['count']=_0xf2433f;if(_0x1c822d['query'][_0x9eaf('0x42')]){_0x3529e9[_0x9eaf('0x43')]=[{'all':!![]}];}return db['AnalyticTreeReport'][_0x9eaf('0x44')](_0x3529e9);})['then'](function(_0x44a5c6){_0x2e4c20[_0x9eaf('0x45')]=_0x44a5c6;return _0x2e4c20;})['then'](respondWithFilteredResult(_0x263553,_0x3529e9))[_0x9eaf('0x46')](handleError(_0x263553,null));};exports['show']=function(_0x4a2f11,_0x2d1b8a){var _0x3f1c01={'raw':!![],'where':{'id':_0x4a2f11[_0x9eaf('0x47')]['id']}},_0x369e51={};_0x369e51[_0x9eaf('0x31')]=_['keys'](db[_0x9eaf('0x2d')][_0x9eaf('0x2e')]);_0x369e51['query']=_['keys'](_0x4a2f11['query']);_0x369e51[_0x9eaf('0x34')]=_[_0x9eaf('0x35')](_0x369e51['model'],_0x369e51['query']);_0x3f1c01[_0x9eaf('0x36')]=_['intersection'](_0x369e51[_0x9eaf('0x31')],qs[_0x9eaf('0x37')](_0x4a2f11['query'][_0x9eaf('0x37')]));_0x3f1c01[_0x9eaf('0x36')]=_0x3f1c01[_0x9eaf('0x36')][_0x9eaf('0x38')]?_0x3f1c01['attributes']:_0x369e51[_0x9eaf('0x31')];if(_0x4a2f11[_0x9eaf('0x32')][_0x9eaf('0x42')]){_0x3f1c01[_0x9eaf('0x43')]=[{'all':!![]}];}_0x3f1c01=_[_0x9eaf('0x40')]({},_0x3f1c01,_0x4a2f11[_0x9eaf('0x41')]);return db[_0x9eaf('0x2d')]['find'](_0x3f1c01)[_0x9eaf('0x27')](handleEntityNotFound(_0x2d1b8a,null))[_0x9eaf('0x27')](respondWithResult(_0x2d1b8a,null))[_0x9eaf('0x46')](handleError(_0x2d1b8a,null));};exports['create']=function(_0x435315,_0x4159c8){return db[_0x9eaf('0x2d')][_0x9eaf('0x48')](_0x435315[_0x9eaf('0x49')],{})[_0x9eaf('0x27')](respondWithResult(_0x4159c8,0xc9))['catch'](handleError(_0x4159c8,null));};exports['update']=function(_0x1e1921,_0x261979){if(_0x1e1921['body']['id']){delete _0x1e1921[_0x9eaf('0x49')]['id'];}return db[_0x9eaf('0x2d')][_0x9eaf('0x4a')]({'where':{'id':_0x1e1921['params']['id']}})[_0x9eaf('0x27')](handleEntityNotFound(_0x261979,null))[_0x9eaf('0x27')](saveUpdates(_0x1e1921[_0x9eaf('0x49')],null))[_0x9eaf('0x27')](respondWithResult(_0x261979,null))[_0x9eaf('0x46')](handleError(_0x261979,null));};exports['destroy']=function(_0x4fd189,_0x26467b){return db[_0x9eaf('0x2d')][_0x9eaf('0x4a')]({'where':{'id':_0x4fd189[_0x9eaf('0x47')]['id']}})['then'](handleEntityNotFound(_0x26467b,null))['then'](removeEntity(_0x26467b,null))[_0x9eaf('0x46')](handleError(_0x26467b,null));}; \ No newline at end of file +var _0x9fa7=['destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/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','set','Content-Range','apply','reject','save','update','then','sendStatus','stack','name','send','index','map','AnalyticTreeReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','find','catch','create','body'];(function(_0x35d32d,_0x189a93){var _0x278467=function(_0x1584fd){while(--_0x1584fd){_0x35d32d['push'](_0x35d32d['shift']());}};_0x278467(++_0x189a93);}(_0x9fa7,0x1e7));var _0x79fa=function(_0x149fa0,_0x599133){_0x149fa0=_0x149fa0-0x0;var _0x29da31=_0x9fa7[_0x149fa0];return _0x29da31;};'use strict';var emlformat=require(_0x79fa('0x0'));var rimraf=require(_0x79fa('0x1'));var zipdir=require(_0x79fa('0x2'));var jsonpatch=require(_0x79fa('0x3'));var rp=require(_0x79fa('0x4'));var moment=require('moment');var BPromise=require(_0x79fa('0x5'));var Mustache=require(_0x79fa('0x6'));var util=require(_0x79fa('0x7'));var path=require(_0x79fa('0x8'));var sox=require(_0x79fa('0x9'));var csv=require(_0x79fa('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x79fa('0xb'));var _=require(_0x79fa('0xc'));var squel=require(_0x79fa('0xd'));var crypto=require(_0x79fa('0xe'));var jsforce=require(_0x79fa('0xf'));var deskjs=require(_0x79fa('0x10'));var toCsv=require('to-csv');var querystring=require(_0x79fa('0x11'));var Papa=require(_0x79fa('0x12'));var Redis=require(_0x79fa('0x13'));var authService=require(_0x79fa('0x14'));var qs=require(_0x79fa('0x15'));var as=require(_0x79fa('0x16'));var hardwareService=require(_0x79fa('0x17'));var logger=require(_0x79fa('0x18'))(_0x79fa('0x19'));var utils=require(_0x79fa('0x1a'));var config=require(_0x79fa('0x1b'));var licenseUtil=require(_0x79fa('0x1c'));var db=require(_0x79fa('0x1d'))['db'];function respondWithStatusCode(_0x232888,_0xd45ee6){_0xd45ee6=_0xd45ee6||0xcc;return function(_0x4f797c){if(_0x4f797c){return _0x232888['sendStatus'](_0xd45ee6);}return _0x232888[_0x79fa('0x1e')](_0xd45ee6)[_0x79fa('0x1f')]();};}function respondWithResult(_0x421283,_0x5d071b){_0x5d071b=_0x5d071b||0xc8;return function(_0x20b4ec){if(_0x20b4ec){return _0x421283['status'](_0x5d071b)['json'](_0x20b4ec);}};}function respondWithFilteredResult(_0x2e1514,_0x9b22c9){return function(_0x3ac3f5){if(_0x3ac3f5){var _0x5458bd=typeof _0x9b22c9[_0x79fa('0x20')]===_0x79fa('0x21')&&typeof _0x9b22c9[_0x79fa('0x22')]==='undefined';var _0x13436d=_0x3ac3f5[_0x79fa('0x23')];var _0x440a44=_0x5458bd?0x0:_0x9b22c9['offset'];var _0x39143e=_0x5458bd?_0x3ac3f5['count']:_0x9b22c9['offset']+_0x9b22c9['limit'];var _0x524fe7;if(_0x39143e>=_0x13436d){_0x39143e=_0x13436d;_0x524fe7=0xc8;}else{_0x524fe7=0xce;}_0x2e1514[_0x79fa('0x1e')](_0x524fe7);return _0x2e1514[_0x79fa('0x24')](_0x79fa('0x25'),_0x440a44+'-'+_0x39143e+'/'+_0x13436d)['json'](_0x3ac3f5);}return null;};}function patchUpdates(_0x5a2a15){return function(_0x101d3c){try{jsonpatch[_0x79fa('0x26')](_0x101d3c,_0x5a2a15,!![]);}catch(_0x58cabd){return BPromise[_0x79fa('0x27')](_0x58cabd);}return _0x101d3c[_0x79fa('0x28')]();};}function saveUpdates(_0x1a31b1,_0x1c70ee){return function(_0x56d63c){if(_0x56d63c){return _0x56d63c[_0x79fa('0x29')](_0x1a31b1)[_0x79fa('0x2a')](function(_0x1e0602){return _0x1e0602;});}return null;};}function removeEntity(_0x3d7480,_0x313a22){return function(_0x2199a0){if(_0x2199a0){return _0x2199a0['destroy']()[_0x79fa('0x2a')](function(){_0x3d7480['status'](0xcc)[_0x79fa('0x1f')]();});}};}function handleEntityNotFound(_0x5dd459,_0x513bf8){return function(_0x21e871){if(!_0x21e871){_0x5dd459[_0x79fa('0x2b')](0x194);}return _0x21e871;};}function handleError(_0x330f36,_0x4028c7){_0x4028c7=_0x4028c7||0x1f4;return function(_0x413e96){logger['error'](_0x413e96[_0x79fa('0x2c')]);if(_0x413e96[_0x79fa('0x2d')]){delete _0x413e96[_0x79fa('0x2d')];}_0x330f36[_0x79fa('0x1e')](_0x4028c7)[_0x79fa('0x2e')](_0x413e96);};}exports[_0x79fa('0x2f')]=function(_0x5d7460,_0x2fc4e3){var _0x47075c={},_0x2410e1={},_0x26adac={'count':0x0,'rows':[]};var _0x34182f=_[_0x79fa('0x30')](db[_0x79fa('0x31')][_0x79fa('0x32')],function(_0x334b17){return{'name':_0x334b17[_0x79fa('0x33')],'type':_0x334b17[_0x79fa('0x34')][_0x79fa('0x35')]};});_0x2410e1[_0x79fa('0x36')]=_[_0x79fa('0x30')](_0x34182f,_0x79fa('0x2d'));_0x2410e1[_0x79fa('0x37')]=_[_0x79fa('0x38')](_0x5d7460['query']);_0x2410e1[_0x79fa('0x39')]=_[_0x79fa('0x3a')](_0x2410e1[_0x79fa('0x36')],_0x2410e1['query']);_0x47075c[_0x79fa('0x3b')]=_[_0x79fa('0x3a')](_0x2410e1['model'],qs[_0x79fa('0x3c')](_0x5d7460['query'][_0x79fa('0x3c')]));_0x47075c[_0x79fa('0x3b')]=_0x47075c[_0x79fa('0x3b')][_0x79fa('0x3d')]?_0x47075c['attributes']:_0x2410e1[_0x79fa('0x36')];if(!_0x5d7460['query'][_0x79fa('0x3e')](_0x79fa('0x3f'))){_0x47075c['limit']=qs[_0x79fa('0x22')](_0x5d7460[_0x79fa('0x37')][_0x79fa('0x22')]);_0x47075c[_0x79fa('0x20')]=qs[_0x79fa('0x20')](_0x5d7460['query'][_0x79fa('0x20')]);}_0x47075c['order']=qs[_0x79fa('0x40')](_0x5d7460['query'][_0x79fa('0x40')]);_0x47075c[_0x79fa('0x41')]=qs[_0x79fa('0x39')](_[_0x79fa('0x42')](_0x5d7460['query'],_0x2410e1[_0x79fa('0x39')]),_0x34182f);if(_0x5d7460[_0x79fa('0x37')][_0x79fa('0x43')]){_0x47075c[_0x79fa('0x41')]=_[_0x79fa('0x44')](_0x47075c[_0x79fa('0x41')],{'$or':_[_0x79fa('0x30')](_0x34182f,function(_0xdca7c8){if(_0xdca7c8['type']!==_0x79fa('0x45')){var _0x340ab6={};_0x340ab6[_0xdca7c8['name']]={'$like':'%'+_0x5d7460[_0x79fa('0x37')][_0x79fa('0x43')]+'%'};return _0x340ab6;}})});}_0x47075c=_[_0x79fa('0x44')]({},_0x47075c,_0x5d7460[_0x79fa('0x46')]);var _0x27f84e={'where':_0x47075c[_0x79fa('0x41')]};return db[_0x79fa('0x31')][_0x79fa('0x23')](_0x27f84e)[_0x79fa('0x2a')](function(_0x57f84e){_0x26adac['count']=_0x57f84e;if(_0x5d7460[_0x79fa('0x37')][_0x79fa('0x47')]){_0x47075c[_0x79fa('0x48')]=[{'all':!![]}];}return db['AnalyticTreeReport'][_0x79fa('0x49')](_0x47075c);})['then'](function(_0x51521c){_0x26adac['rows']=_0x51521c;return _0x26adac;})[_0x79fa('0x2a')](respondWithFilteredResult(_0x2fc4e3,_0x47075c))['catch'](handleError(_0x2fc4e3,null));};exports[_0x79fa('0x4a')]=function(_0x1b62e5,_0x1fb5fc){var _0x1468b5={'raw':!![],'where':{'id':_0x1b62e5[_0x79fa('0x4b')]['id']}},_0x247688={};_0x247688[_0x79fa('0x36')]=_[_0x79fa('0x38')](db['AnalyticTreeReport']['rawAttributes']);_0x247688[_0x79fa('0x37')]=_[_0x79fa('0x38')](_0x1b62e5[_0x79fa('0x37')]);_0x247688[_0x79fa('0x39')]=_[_0x79fa('0x3a')](_0x247688[_0x79fa('0x36')],_0x247688['query']);_0x1468b5[_0x79fa('0x3b')]=_['intersection'](_0x247688['model'],qs[_0x79fa('0x3c')](_0x1b62e5[_0x79fa('0x37')][_0x79fa('0x3c')]));_0x1468b5[_0x79fa('0x3b')]=_0x1468b5[_0x79fa('0x3b')][_0x79fa('0x3d')]?_0x1468b5[_0x79fa('0x3b')]:_0x247688['model'];if(_0x1b62e5['query'][_0x79fa('0x47')]){_0x1468b5[_0x79fa('0x48')]=[{'all':!![]}];}_0x1468b5=_[_0x79fa('0x44')]({},_0x1468b5,_0x1b62e5[_0x79fa('0x46')]);return db[_0x79fa('0x31')][_0x79fa('0x4c')](_0x1468b5)[_0x79fa('0x2a')](handleEntityNotFound(_0x1fb5fc,null))[_0x79fa('0x2a')](respondWithResult(_0x1fb5fc,null))[_0x79fa('0x4d')](handleError(_0x1fb5fc,null));};exports[_0x79fa('0x4e')]=function(_0x362dda,_0x61b95b){return db[_0x79fa('0x31')][_0x79fa('0x4e')](_0x362dda[_0x79fa('0x4f')],{})[_0x79fa('0x2a')](respondWithResult(_0x61b95b,0xc9))[_0x79fa('0x4d')](handleError(_0x61b95b,null));};exports[_0x79fa('0x29')]=function(_0x31c29b,_0x398a78){if(_0x31c29b[_0x79fa('0x4f')]['id']){delete _0x31c29b[_0x79fa('0x4f')]['id'];}return db[_0x79fa('0x31')][_0x79fa('0x4c')]({'where':{'id':_0x31c29b[_0x79fa('0x4b')]['id']}})[_0x79fa('0x2a')](handleEntityNotFound(_0x398a78,null))[_0x79fa('0x2a')](saveUpdates(_0x31c29b[_0x79fa('0x4f')],null))[_0x79fa('0x2a')](respondWithResult(_0x398a78,null))[_0x79fa('0x4d')](handleError(_0x398a78,null));};exports[_0x79fa('0x50')]=function(_0x195aae,_0x21dc62){return db[_0x79fa('0x31')][_0x79fa('0x4c')]({'where':{'id':_0x195aae[_0x79fa('0x4b')]['id']}})[_0x79fa('0x2a')](handleEntityNotFound(_0x21dc62,null))['then'](removeEntity(_0x21dc62,null))[_0x79fa('0x4d')](handleError(_0x21dc62,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index f91e05d..c830926 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 _0x5c79=['../../config/logger','api','moment','bluebird','path','rimraf','./analyticTreeReport.attributes','exports','AnalyticTreeReport','analytics_report_trees','lodash','util'];(function(_0x5560df,_0x548b46){var _0x1d0688=function(_0x5383f9){while(--_0x5383f9){_0x5560df['push'](_0x5560df['shift']());}};_0x1d0688(++_0x548b46);}(_0x5c79,0x1c6));var _0x95c7=function(_0x53e3de,_0x13da7b){_0x53e3de=_0x53e3de-0x0;var _0x7b905b=_0x5c79[_0x53e3de];return _0x7b905b;};'use strict';var _=require(_0x95c7('0x0'));var util=require(_0x95c7('0x1'));var logger=require(_0x95c7('0x2'))(_0x95c7('0x3'));var moment=require(_0x95c7('0x4'));var BPromise=require(_0x95c7('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x95c7('0x6'));var rimraf=require(_0x95c7('0x7'));var config=require('../../config/environment');var attributes=require(_0x95c7('0x8'));module[_0x95c7('0x9')]=function(_0xe91a54,_0xcabcc8){return _0xe91a54['define'](_0x95c7('0xa'),attributes,{'tableName':_0x95c7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xde79=['analytics_report_trees','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','AnalyticTreeReport'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0xde79,0xc7));var _0x9de7=function(_0x57547d,_0x58db70){_0x57547d=_0x57547d-0x0;var _0x440342=_0xde79[_0x57547d];return _0x440342;};'use strict';var _=require('lodash');var util=require(_0x9de7('0x0'));var logger=require(_0x9de7('0x1'))('api');var moment=require(_0x9de7('0x2'));var BPromise=require(_0x9de7('0x3'));var rp=require(_0x9de7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9de7('0x5'));var config=require(_0x9de7('0x6'));var attributes=require('./analyticTreeReport.attributes');module[_0x9de7('0x7')]=function(_0x37f10b,_0x42504b){return _0x37f10b[_0x9de7('0x8')](_0x9de7('0x9'),attributes,{'tableName':_0x9de7('0xa'),'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 14cd29b..8382ef9 100644 --- a/server/api/analyticTreeReport/analyticTreeReport.rpc.js +++ b/server/api/analyticTreeReport/analyticTreeReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','AnalyticTreeReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x1e195b,_0x18ec21){var _0x1c98a3=function(_0x2d96c3){while(--_0x2d96c3){_0x1e195b['push'](_0x1e195b['shift']());}};_0x1c98a3(++_0x18ec21);}(_0x5f2f,0x73));var _0xf5f2=function(_0x56b557,_0x4e06b1){_0x56b557=_0x56b557-0x0;var _0x596b6a=_0x5f2f[_0x56b557];return _0x596b6a;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file +var _0x7a54=['info','AnalyticTreeReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x7a54,0x106));var _0x47a5=function(_0x1e87a3,_0xf21a70){_0x1e87a3=_0x1e87a3-0x0;var _0x2f58ff=_0x7a54[_0x1e87a3];return _0x2f58ff;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 37649d4..91b7829 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 _0x07ed=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','show','isAuthenticated'];(function(_0x3ce3c,_0x319337){var _0x55a2c9=function(_0x1568d0){while(--_0x1568d0){_0x3ce3c['push'](_0x3ce3c['shift']());}};_0x55a2c9(++_0x319337);}(_0x07ed,0x16b));var _0xd07e=function(_0x436974,_0x78d896){_0x436974=_0x436974-0x0;var _0x2fbfc8=_0x07ed[_0x436974];return _0x2fbfc8;};'use strict';var multer=require(_0xd07e('0x0'));var util=require(_0xd07e('0x1'));var path=require(_0xd07e('0x2'));var timeout=require(_0xd07e('0x3'));var express=require(_0xd07e('0x4'));var router=express[_0xd07e('0x5')]();var fs_extra=require(_0xd07e('0x6'));var auth=require(_0xd07e('0x7'));var interaction=require(_0xd07e('0x8'));var config=require(_0xd07e('0x9'));var controller=require('./analyticTreeReport.controller');router[_0xd07e('0xa')]('/',auth['isAuthenticated'](),controller[_0xd07e('0xb')]);router[_0xd07e('0xa')](_0xd07e('0xc'),auth['isAuthenticated'](),controller[_0xd07e('0xd')]);router['post']('/',auth[_0xd07e('0xe')](),controller[_0xd07e('0xf')]);router[_0xd07e('0x10')](_0xd07e('0xc'),auth[_0xd07e('0xe')](),controller[_0xd07e('0x11')]);router[_0xd07e('0x12')]('/:id',auth[_0xd07e('0xe')](),controller[_0xd07e('0x13')]);module[_0xd07e('0x14')]=router; \ No newline at end of file +var _0x1a63=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','index','post','create','put','/:id','delete','exports','util'];(function(_0x446d9f,_0x4062f6){var _0xff1bce=function(_0x66cdd9){while(--_0x66cdd9){_0x446d9f['push'](_0x446d9f['shift']());}};_0xff1bce(++_0x4062f6);}(_0x1a63,0xc5));var _0x31a6=function(_0x4e8f63,_0x783de9){_0x4e8f63=_0x4e8f63-0x0;var _0x2a129f=_0x1a63[_0x4e8f63];return _0x2a129f;};'use strict';var multer=require('multer');var util=require(_0x31a6('0x0'));var path=require(_0x31a6('0x1'));var timeout=require(_0x31a6('0x2'));var express=require(_0x31a6('0x3'));var router=express['Router']();var fs_extra=require(_0x31a6('0x4'));var auth=require(_0x31a6('0x5'));var interaction=require(_0x31a6('0x6'));var config=require(_0x31a6('0x7'));var controller=require(_0x31a6('0x8'));router[_0x31a6('0x9')]('/',auth[_0x31a6('0xa')](),controller[_0x31a6('0xb')]);router[_0x31a6('0x9')]('/:id',auth[_0x31a6('0xa')](),controller['show']);router[_0x31a6('0xc')]('/',auth[_0x31a6('0xa')](),controller[_0x31a6('0xd')]);router[_0x31a6('0xe')](_0x31a6('0xf'),auth[_0x31a6('0xa')](),controller['update']);router[_0x31a6('0x10')](_0x31a6('0xf'),auth[_0x31a6('0xa')](),controller['destroy']);module[_0x31a6('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 7758685..df6bc3c 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 _0xf0ba=['STRING','sequelize','exports'];(function(_0x1e0de,_0x100b6e){var _0x511bfc=function(_0x1d2826){while(--_0x1d2826){_0x1e0de['push'](_0x1e0de['shift']());}};_0x511bfc(++_0x100b6e);}(_0xf0ba,0x1ed));var _0xaf0b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf0ba[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xaf0b('0x0'));module[_0xaf0b('0x1')]={'name':{'type':Sequelize[_0xaf0b('0x2')]},'basename':{'type':Sequelize[_0xaf0b('0x2')]},'type':{'type':Sequelize[_0xaf0b('0x2')]}}; \ No newline at end of file +var _0xfa2f=['STRING'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xfa2f,0xe8));var _0xffa2=function(_0x4daa2f,_0x367bbd){_0x4daa2f=_0x4daa2f-0x0;var _0x2f6824=_0xfa2f[_0x4daa2f];return _0x2f6824;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xffa2('0x0')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xffa2('0x0')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 26f3d1e..2c035fd 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 _0xfbaa=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','count','set','save','then','destroy','end','error','stack','name','send','index','Attachment','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','clone','find','get','omit','createdAt','updatedAt','body','create','update','file','basename','filename','mimetype','download','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','to-csv','ejs','fs-extra','crypto','desk.js','querystring','papaparse','ioredis'];(function(_0x2bf4f3,_0x225c34){var _0x2147e2=function(_0x5b2ad2){while(--_0x5b2ad2){_0x2bf4f3['push'](_0x2bf4f3['shift']());}};_0x2147e2(++_0x225c34);}(_0xfbaa,0xf9));var _0xafba=function(_0x4fa166,_0x58b7fb){_0x4fa166=_0x4fa166-0x0;var _0x5dd974=_0xfbaa[_0x4fa166];return _0x5dd974;};'use strict';var emlformat=require(_0xafba('0x0'));var rimraf=require(_0xafba('0x1'));var zipdir=require(_0xafba('0x2'));var jsonpatch=require(_0xafba('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xafba('0x4'));var Mustache=require(_0xafba('0x5'));var util=require(_0xafba('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xafba('0x7'));var ejs=require(_0xafba('0x8'));var fs=require('fs');var fs_extra=require(_0xafba('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xafba('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xafba('0xb'));var toCsv=require(_0xafba('0x7'));var querystring=require(_0xafba('0xc'));var Papa=require(_0xafba('0xd'));var Redis=require(_0xafba('0xe'));var authService=require(_0xafba('0xf'));var qs=require(_0xafba('0x10'));var as=require(_0xafba('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xafba('0x12'))('api');var utils=require(_0xafba('0x13'));var config=require(_0xafba('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xafba('0x15'))['db'];function respondWithStatusCode(_0x4296f9,_0x50a7d2){_0x50a7d2=_0x50a7d2||0xcc;return function(_0xfafdd3){if(_0xfafdd3){return _0x4296f9[_0xafba('0x16')](_0x50a7d2);}return _0x4296f9['status'](_0x50a7d2)['end']();};}function respondWithResult(_0x4d944f,_0x4722a9){_0x4722a9=_0x4722a9||0xc8;return function(_0x4ebe96){if(_0x4ebe96){return _0x4d944f[_0xafba('0x17')](_0x4722a9)['json'](_0x4ebe96);}};}function respondWithFilteredResult(_0x1ac208,_0x45f5b2){return function(_0x41633d){if(_0x41633d){var _0x4db17f=typeof _0x45f5b2[_0xafba('0x18')]===_0xafba('0x19')&&typeof _0x45f5b2['limit']===_0xafba('0x19');var _0x14f6f5=_0x41633d[_0xafba('0x1a')];var _0xee6bf6=_0x4db17f?0x0:_0x45f5b2[_0xafba('0x18')];var _0x5cb665=_0x4db17f?_0x41633d[_0xafba('0x1a')]:_0x45f5b2[_0xafba('0x18')]+_0x45f5b2['limit'];var _0x5f4e64;if(_0x5cb665>=_0x14f6f5){_0x5cb665=_0x14f6f5;_0x5f4e64=0xc8;}else{_0x5f4e64=0xce;}_0x1ac208[_0xafba('0x17')](_0x5f4e64);return _0x1ac208[_0xafba('0x1b')]('Content-Range',_0xee6bf6+'-'+_0x5cb665+'/'+_0x14f6f5)['json'](_0x41633d);}return null;};}function patchUpdates(_0x2a0c71){return function(_0x1ed888){try{jsonpatch['apply'](_0x1ed888,_0x2a0c71,!![]);}catch(_0x171854){return BPromise['reject'](_0x171854);}return _0x1ed888[_0xafba('0x1c')]();};}function saveUpdates(_0x59f597,_0x4217b1){return function(_0xefedc0){if(_0xefedc0){return _0xefedc0['update'](_0x59f597)[_0xafba('0x1d')](function(_0x2dd6ba){return _0x2dd6ba;});}return null;};}function removeEntity(_0x4baf7e,_0x38aae6){return function(_0x1caf4a){if(_0x1caf4a){return _0x1caf4a[_0xafba('0x1e')]()[_0xafba('0x1d')](function(){_0x4baf7e['status'](0xcc)[_0xafba('0x1f')]();});}};}function handleEntityNotFound(_0x30ebec,_0x347825){return function(_0x50e677){if(!_0x50e677){_0x30ebec[_0xafba('0x16')](0x194);}return _0x50e677;};}function handleError(_0x35d31c,_0x9786df){_0x9786df=_0x9786df||0x1f4;return function(_0x560dd0){logger[_0xafba('0x20')](_0x560dd0[_0xafba('0x21')]);if(_0x560dd0[_0xafba('0x22')]){delete _0x560dd0[_0xafba('0x22')];}_0x35d31c[_0xafba('0x17')](_0x9786df)[_0xafba('0x23')](_0x560dd0);};}exports[_0xafba('0x24')]=function(_0xc668d0,_0x1bf9d2){var _0x7e241={},_0x5acb4a={},_0x51123b={'count':0x0,'rows':[]};var _0x171be9=_['map'](db[_0xafba('0x25')][_0xafba('0x26')],function(_0x3a1bae){return{'name':_0x3a1bae[_0xafba('0x27')],'type':_0x3a1bae[_0xafba('0x28')][_0xafba('0x29')]};});_0x5acb4a[_0xafba('0x2a')]=_[_0xafba('0x2b')](_0x171be9,_0xafba('0x22'));_0x5acb4a[_0xafba('0x2c')]=_[_0xafba('0x2d')](_0xc668d0['query']);_0x5acb4a['filters']=_[_0xafba('0x2e')](_0x5acb4a[_0xafba('0x2a')],_0x5acb4a['query']);_0x7e241[_0xafba('0x2f')]=_[_0xafba('0x2e')](_0x5acb4a[_0xafba('0x2a')],qs[_0xafba('0x30')](_0xc668d0['query'][_0xafba('0x30')]));_0x7e241[_0xafba('0x2f')]=_0x7e241[_0xafba('0x2f')][_0xafba('0x31')]?_0x7e241['attributes']:_0x5acb4a[_0xafba('0x2a')];if(!_0xc668d0[_0xafba('0x2c')][_0xafba('0x32')](_0xafba('0x33'))){_0x7e241[_0xafba('0x34')]=qs[_0xafba('0x34')](_0xc668d0[_0xafba('0x2c')][_0xafba('0x34')]);_0x7e241[_0xafba('0x18')]=qs[_0xafba('0x18')](_0xc668d0['query'][_0xafba('0x18')]);}_0x7e241[_0xafba('0x35')]=qs['sort'](_0xc668d0['query'][_0xafba('0x36')]);_0x7e241[_0xafba('0x37')]=qs[_0xafba('0x38')](_['pick'](_0xc668d0['query'],_0x5acb4a[_0xafba('0x38')]),_0x171be9);if(_0xc668d0[_0xafba('0x2c')][_0xafba('0x39')]){_0x7e241[_0xafba('0x37')]=_[_0xafba('0x3a')](_0x7e241[_0xafba('0x37')],{'$or':_[_0xafba('0x2b')](_0x171be9,function(_0x1f64bc){if(_0x1f64bc[_0xafba('0x28')]!==_0xafba('0x3b')){var _0xb63fbb={};_0xb63fbb[_0x1f64bc[_0xafba('0x22')]]={'$like':'%'+_0xc668d0[_0xafba('0x2c')][_0xafba('0x39')]+'%'};return _0xb63fbb;}})});}_0x7e241=_['merge']({},_0x7e241,_0xc668d0[_0xafba('0x3c')]);var _0x4481f2={'where':_0x7e241['where']};return db['Attachment']['count'](_0x4481f2)[_0xafba('0x1d')](function(_0x1dcd93){_0x51123b[_0xafba('0x1a')]=_0x1dcd93;if(_0xc668d0['query']['includeAll']){_0x7e241[_0xafba('0x3d')]=[{'all':!![]}];}return db[_0xafba('0x25')][_0xafba('0x3e')](_0x7e241);})[_0xafba('0x1d')](function(_0x23a18a){_0x51123b[_0xafba('0x3f')]=_0x23a18a;return _0x51123b;})[_0xafba('0x1d')](respondWithFilteredResult(_0x1bf9d2,_0x7e241))[_0xafba('0x40')](handleError(_0x1bf9d2,null));};exports[_0xafba('0x41')]=function(_0x568d97,_0x4c3229){var _0x1bf450={'raw':!![],'where':{'id':_0x568d97[_0xafba('0x42')]['id']}},_0x254281={};_0x254281[_0xafba('0x2a')]=_[_0xafba('0x2d')](db['Attachment'][_0xafba('0x26')]);_0x254281['query']=_[_0xafba('0x2d')](_0x568d97[_0xafba('0x2c')]);_0x254281['filters']=_['intersection'](_0x254281['model'],_0x254281[_0xafba('0x2c')]);_0x1bf450['attributes']=_[_0xafba('0x2e')](_0x254281[_0xafba('0x2a')],qs['fields'](_0x568d97['query']['fields']));_0x1bf450[_0xafba('0x2f')]=_0x1bf450[_0xafba('0x2f')][_0xafba('0x31')]?_0x1bf450[_0xafba('0x2f')]:_0x254281['model'];if(_0x568d97[_0xafba('0x2c')][_0xafba('0x43')]){_0x1bf450[_0xafba('0x3d')]=[{'all':!![]}];}_0x1bf450=_[_0xafba('0x3a')]({},_0x1bf450,_0x568d97[_0xafba('0x3c')]);return db[_0xafba('0x25')]['find'](_0x1bf450)[_0xafba('0x1d')](handleEntityNotFound(_0x4c3229,null))[_0xafba('0x1d')](respondWithResult(_0x4c3229,null))[_0xafba('0x40')](handleError(_0x4c3229,null));};exports[_0xafba('0x44')]=function(_0x26f39a,_0x53fe77){var _0x353e29={'where':{'id':_0x26f39a['params']['id']}},_0x568acc={};_0x568acc[_0xafba('0x2a')]=_[_0xafba('0x2d')](db[_0xafba('0x25')][_0xafba('0x26')]);_0x353e29[_0xafba('0x2f')]=_[_0xafba('0x2e')](_0x568acc[_0xafba('0x2a')],qs[_0xafba('0x30')](_0x26f39a['query'][_0xafba('0x30')]));_0x353e29[_0xafba('0x2f')]=_0x353e29[_0xafba('0x2f')][_0xafba('0x31')]?_0x353e29[_0xafba('0x2f')]:_0x568acc[_0xafba('0x2a')];if(_0x26f39a[_0xafba('0x2c')][_0xafba('0x43')]){_0x353e29[_0xafba('0x3d')]=[{'all':!![]}];}_0x353e29=_[_0xafba('0x3a')]({},_0x353e29,_0x26f39a['options']);return db[_0xafba('0x25')][_0xafba('0x45')](_0x353e29)[_0xafba('0x1d')](handleEntityNotFound(_0x53fe77,null))[_0xafba('0x1d')](function(_0x3137f3){if(_0x3137f3){var _0x1ead54=_0x3137f3[_0xafba('0x46')]({'plain':!![]});_0x1ead54=qs[_0xafba('0x47')](_0x1ead54,['id',_0xafba('0x48'),_0xafba('0x49')]);_0x26f39a[_0xafba('0x4a')]=_[_0xafba('0x47')](_0x26f39a[_0xafba('0x4a')],['id','createdAt','updatedAt']);return db[_0xafba('0x25')][_0xafba('0x4b')](_[_0xafba('0x3a')](_0x1ead54,_0x26f39a[_0xafba('0x4a')]),{'include':_0x26f39a[_0xafba('0x2c')][_0xafba('0x43')]?[{'all':!![]}]:undefined});}})[_0xafba('0x1d')](respondWithResult(_0x53fe77,0xc9))['catch'](handleError(_0x53fe77,null));};exports[_0xafba('0x4c')]=function(_0x4ce7c3,_0x494471){if(_0x4ce7c3[_0xafba('0x4a')]['id']){delete _0x4ce7c3['body']['id'];}return db['Attachment']['find']({'where':{'id':_0x4ce7c3[_0xafba('0x42')]['id']}})[_0xafba('0x1d')](handleEntityNotFound(_0x494471,null))[_0xafba('0x1d')](saveUpdates(_0x4ce7c3[_0xafba('0x4a')],null))[_0xafba('0x1d')](respondWithResult(_0x494471,null))[_0xafba('0x40')](handleError(_0x494471,null));};exports['destroy']=function(_0x50c60a,_0x47805b){return db[_0xafba('0x25')][_0xafba('0x45')]({'where':{'id':_0x50c60a[_0xafba('0x42')]['id']}})[_0xafba('0x1d')](handleEntityNotFound(_0x47805b,null))[_0xafba('0x1d')](removeEntity(_0x47805b,null))['catch'](handleError(_0x47805b,null));};exports['create']=function(_0x579f04,_0x1bfb5e,_0x26d154){_0x579f04['body']['name']=_0x579f04[_0xafba('0x4d')]['originalname'];_0x579f04[_0xafba('0x4a')][_0xafba('0x4e')]=_0x579f04[_0xafba('0x4d')][_0xafba('0x4f')];_0x579f04[_0xafba('0x4a')][_0xafba('0x28')]=_0x579f04[_0xafba('0x4d')][_0xafba('0x50')];return db['Attachment'][_0xafba('0x4b')](_0x579f04['body'])['then'](respondWithResult(_0x1bfb5e,0xc9))['catch'](handleError(_0x1bfb5e,null));};exports[_0xafba('0x51')]=function(_0x1c5aa4,_0x21ab19,_0x54ed04){return db[_0xafba('0x25')][_0xafba('0x52')]({'where':{'id':_0x1c5aa4[_0xafba('0x42')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x21ab19,null))['then'](function(_0x3babf8){if(_0x3babf8){var _0x17956d=_0x3babf8[_0xafba('0x53')]!==null;var _0x2b5bf1=path[_0xafba('0x54')](config[_0xafba('0x55')],_0xafba('0x56'));if(_0x17956d){_0x2b5bf1=path[_0xafba('0x54')](_0x2b5bf1,_0xafba('0x57'));}var _0xc1bec1=path[_0xafba('0x54')](_0x2b5bf1,_0x3babf8[_0xafba('0x4e')]);return _0x21ab19[_0xafba('0x51')](_0xc1bec1);}})[_0xafba('0x40')](handleError(_0x21ab19,null));}; \ No newline at end of file +var _0xc1ba=['create','file','originalname','basename','filename','mimetype','findOne','ChatOfflineMessageId','root','join','download','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','ejs','lodash','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','count','Content-Range','apply','reject','save','update','then','destroy','name','send','map','Attachment','rawAttributes','type','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','show','params','keys','length','find','get','omit','updatedAt','body'];(function(_0x1a8abe,_0x123187){var _0x424187=function(_0x471e95){while(--_0x471e95){_0x1a8abe['push'](_0x1a8abe['shift']());}};_0x424187(++_0x123187);}(_0xc1ba,0x187));var _0xac1b=function(_0x9153c6,_0x2745aa){_0x9153c6=_0x9153c6-0x0;var _0x8d0486=_0xc1ba[_0x9153c6];return _0x8d0486;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xac1b('0x0'));var zipdir=require(_0xac1b('0x1'));var jsonpatch=require(_0xac1b('0x2'));var rp=require(_0xac1b('0x3'));var moment=require('moment');var BPromise=require(_0xac1b('0x4'));var Mustache=require('mustache');var util=require(_0xac1b('0x5'));var path=require(_0xac1b('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xac1b('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xac1b('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xac1b('0x9'));var deskjs=require(_0xac1b('0xa'));var toCsv=require(_0xac1b('0xb'));var querystring=require(_0xac1b('0xc'));var Papa=require('papaparse');var Redis=require(_0xac1b('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xac1b('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xac1b('0xf'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xac1b('0x10'));var licenseUtil=require('../../config/license/util');var db=require(_0xac1b('0x11'))['db'];function respondWithStatusCode(_0x43189b,_0x5f367a){_0x5f367a=_0x5f367a||0xcc;return function(_0x357e40){if(_0x357e40){return _0x43189b[_0xac1b('0x12')](_0x5f367a);}return _0x43189b['status'](_0x5f367a)['end']();};}function respondWithResult(_0x4739b7,_0x2b4adb){_0x2b4adb=_0x2b4adb||0xc8;return function(_0x5f4b42){if(_0x5f4b42){return _0x4739b7[_0xac1b('0x13')](_0x2b4adb)[_0xac1b('0x14')](_0x5f4b42);}};}function respondWithFilteredResult(_0x297c9c,_0x5083b1){return function(_0x299bde){if(_0x299bde){var _0x565b61=typeof _0x5083b1[_0xac1b('0x15')]==='undefined'&&typeof _0x5083b1[_0xac1b('0x16')]==='undefined';var _0x55f661=_0x299bde[_0xac1b('0x17')];var _0x382ae3=_0x565b61?0x0:_0x5083b1[_0xac1b('0x15')];var _0x9f048a=_0x565b61?_0x299bde[_0xac1b('0x17')]:_0x5083b1[_0xac1b('0x15')]+_0x5083b1[_0xac1b('0x16')];var _0x262959;if(_0x9f048a>=_0x55f661){_0x9f048a=_0x55f661;_0x262959=0xc8;}else{_0x262959=0xce;}_0x297c9c[_0xac1b('0x13')](_0x262959);return _0x297c9c['set'](_0xac1b('0x18'),_0x382ae3+'-'+_0x9f048a+'/'+_0x55f661)[_0xac1b('0x14')](_0x299bde);}return null;};}function patchUpdates(_0x3cb230){return function(_0x14708e){try{jsonpatch[_0xac1b('0x19')](_0x14708e,_0x3cb230,!![]);}catch(_0x2018ad){return BPromise[_0xac1b('0x1a')](_0x2018ad);}return _0x14708e[_0xac1b('0x1b')]();};}function saveUpdates(_0x4a5276,_0x3a7153){return function(_0xe56c0d){if(_0xe56c0d){return _0xe56c0d[_0xac1b('0x1c')](_0x4a5276)[_0xac1b('0x1d')](function(_0x14d5c6){return _0x14d5c6;});}return null;};}function removeEntity(_0xff7fae,_0x168531){return function(_0x27ec65){if(_0x27ec65){return _0x27ec65[_0xac1b('0x1e')]()[_0xac1b('0x1d')](function(){_0xff7fae[_0xac1b('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x52e7db,_0xdf2fd0){return function(_0x4c6b34){if(!_0x4c6b34){_0x52e7db[_0xac1b('0x12')](0x194);}return _0x4c6b34;};}function handleError(_0x2f3f06,_0x2e98aa){_0x2e98aa=_0x2e98aa||0x1f4;return function(_0x18dee6){logger['error'](_0x18dee6['stack']);if(_0x18dee6[_0xac1b('0x1f')]){delete _0x18dee6['name'];}_0x2f3f06[_0xac1b('0x13')](_0x2e98aa)[_0xac1b('0x20')](_0x18dee6);};}exports['index']=function(_0x34aad7,_0x461b4e){var _0x536b05={},_0x3b55ea={},_0xc4939c={'count':0x0,'rows':[]};var _0x2b0e7e=_[_0xac1b('0x21')](db[_0xac1b('0x22')][_0xac1b('0x23')],function(_0x2ad0cd){return{'name':_0x2ad0cd['fieldName'],'type':_0x2ad0cd[_0xac1b('0x24')]['key']};});_0x3b55ea[_0xac1b('0x25')]=_[_0xac1b('0x21')](_0x2b0e7e,'name');_0x3b55ea[_0xac1b('0x26')]=_['keys'](_0x34aad7[_0xac1b('0x26')]);_0x3b55ea[_0xac1b('0x27')]=_['intersection'](_0x3b55ea[_0xac1b('0x25')],_0x3b55ea['query']);_0x536b05['attributes']=_[_0xac1b('0x28')](_0x3b55ea[_0xac1b('0x25')],qs[_0xac1b('0x29')](_0x34aad7[_0xac1b('0x26')][_0xac1b('0x29')]));_0x536b05['attributes']=_0x536b05[_0xac1b('0x2a')]['length']?_0x536b05['attributes']:_0x3b55ea[_0xac1b('0x25')];if(!_0x34aad7[_0xac1b('0x26')][_0xac1b('0x2b')](_0xac1b('0x2c'))){_0x536b05[_0xac1b('0x16')]=qs['limit'](_0x34aad7[_0xac1b('0x26')][_0xac1b('0x16')]);_0x536b05[_0xac1b('0x15')]=qs[_0xac1b('0x15')](_0x34aad7[_0xac1b('0x26')]['offset']);}_0x536b05[_0xac1b('0x2d')]=qs[_0xac1b('0x2e')](_0x34aad7[_0xac1b('0x26')][_0xac1b('0x2e')]);_0x536b05[_0xac1b('0x2f')]=qs[_0xac1b('0x27')](_[_0xac1b('0x30')](_0x34aad7[_0xac1b('0x26')],_0x3b55ea['filters']),_0x2b0e7e);if(_0x34aad7[_0xac1b('0x26')][_0xac1b('0x31')]){_0x536b05[_0xac1b('0x2f')]=_['merge'](_0x536b05[_0xac1b('0x2f')],{'$or':_[_0xac1b('0x21')](_0x2b0e7e,function(_0x3278ce){if(_0x3278ce[_0xac1b('0x24')]!=='VIRTUAL'){var _0x16f1e9={};_0x16f1e9[_0x3278ce['name']]={'$like':'%'+_0x34aad7[_0xac1b('0x26')][_0xac1b('0x31')]+'%'};return _0x16f1e9;}})});}_0x536b05=_[_0xac1b('0x32')]({},_0x536b05,_0x34aad7[_0xac1b('0x33')]);var _0x2cee03={'where':_0x536b05[_0xac1b('0x2f')]};return db[_0xac1b('0x22')][_0xac1b('0x17')](_0x2cee03)[_0xac1b('0x1d')](function(_0x3b59df){_0xc4939c[_0xac1b('0x17')]=_0x3b59df;if(_0x34aad7['query'][_0xac1b('0x34')]){_0x536b05['include']=[{'all':!![]}];}return db[_0xac1b('0x22')][_0xac1b('0x35')](_0x536b05);})[_0xac1b('0x1d')](function(_0x546a37){_0xc4939c[_0xac1b('0x36')]=_0x546a37;return _0xc4939c;})[_0xac1b('0x1d')](respondWithFilteredResult(_0x461b4e,_0x536b05))[_0xac1b('0x37')](handleError(_0x461b4e,null));};exports[_0xac1b('0x38')]=function(_0x5c6931,_0x4828de){var _0x46fc79={'raw':!![],'where':{'id':_0x5c6931[_0xac1b('0x39')]['id']}},_0x950d03={};_0x950d03[_0xac1b('0x25')]=_[_0xac1b('0x3a')](db['Attachment']['rawAttributes']);_0x950d03[_0xac1b('0x26')]=_['keys'](_0x5c6931['query']);_0x950d03[_0xac1b('0x27')]=_[_0xac1b('0x28')](_0x950d03['model'],_0x950d03[_0xac1b('0x26')]);_0x46fc79[_0xac1b('0x2a')]=_['intersection'](_0x950d03[_0xac1b('0x25')],qs['fields'](_0x5c6931['query'][_0xac1b('0x29')]));_0x46fc79['attributes']=_0x46fc79['attributes'][_0xac1b('0x3b')]?_0x46fc79[_0xac1b('0x2a')]:_0x950d03['model'];if(_0x5c6931['query'][_0xac1b('0x34')]){_0x46fc79['include']=[{'all':!![]}];}_0x46fc79=_[_0xac1b('0x32')]({},_0x46fc79,_0x5c6931[_0xac1b('0x33')]);return db[_0xac1b('0x22')][_0xac1b('0x3c')](_0x46fc79)[_0xac1b('0x1d')](handleEntityNotFound(_0x4828de,null))[_0xac1b('0x1d')](respondWithResult(_0x4828de,null))[_0xac1b('0x37')](handleError(_0x4828de,null));};exports['clone']=function(_0x30d320,_0x3d6489){var _0x95c688={'where':{'id':_0x30d320['params']['id']}},_0x24ad3e={};_0x24ad3e['model']=_[_0xac1b('0x3a')](db['Attachment'][_0xac1b('0x23')]);_0x95c688[_0xac1b('0x2a')]=_[_0xac1b('0x28')](_0x24ad3e[_0xac1b('0x25')],qs[_0xac1b('0x29')](_0x30d320[_0xac1b('0x26')][_0xac1b('0x29')]));_0x95c688[_0xac1b('0x2a')]=_0x95c688[_0xac1b('0x2a')][_0xac1b('0x3b')]?_0x95c688[_0xac1b('0x2a')]:_0x24ad3e[_0xac1b('0x25')];if(_0x30d320[_0xac1b('0x26')][_0xac1b('0x34')]){_0x95c688['include']=[{'all':!![]}];}_0x95c688=_['merge']({},_0x95c688,_0x30d320['options']);return db['Attachment'][_0xac1b('0x3c')](_0x95c688)['then'](handleEntityNotFound(_0x3d6489,null))[_0xac1b('0x1d')](function(_0x55947c){if(_0x55947c){var _0x3735e6=_0x55947c[_0xac1b('0x3d')]({'plain':!![]});_0x3735e6=qs[_0xac1b('0x3e')](_0x3735e6,['id','createdAt',_0xac1b('0x3f')]);_0x30d320[_0xac1b('0x40')]=_[_0xac1b('0x3e')](_0x30d320[_0xac1b('0x40')],['id','createdAt','updatedAt']);return db[_0xac1b('0x22')][_0xac1b('0x41')](_['merge'](_0x3735e6,_0x30d320[_0xac1b('0x40')]),{'include':_0x30d320[_0xac1b('0x26')][_0xac1b('0x34')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x3d6489,0xc9))[_0xac1b('0x37')](handleError(_0x3d6489,null));};exports['update']=function(_0xf801e1,_0x20585f){if(_0xf801e1[_0xac1b('0x40')]['id']){delete _0xf801e1[_0xac1b('0x40')]['id'];}return db[_0xac1b('0x22')][_0xac1b('0x3c')]({'where':{'id':_0xf801e1[_0xac1b('0x39')]['id']}})[_0xac1b('0x1d')](handleEntityNotFound(_0x20585f,null))[_0xac1b('0x1d')](saveUpdates(_0xf801e1[_0xac1b('0x40')],null))[_0xac1b('0x1d')](respondWithResult(_0x20585f,null))['catch'](handleError(_0x20585f,null));};exports[_0xac1b('0x1e')]=function(_0x1b64e9,_0x2ac772){return db[_0xac1b('0x22')][_0xac1b('0x3c')]({'where':{'id':_0x1b64e9[_0xac1b('0x39')]['id']}})['then'](handleEntityNotFound(_0x2ac772,null))[_0xac1b('0x1d')](removeEntity(_0x2ac772,null))['catch'](handleError(_0x2ac772,null));};exports[_0xac1b('0x41')]=function(_0x326ae0,_0x517b42,_0xd5b649){_0x326ae0[_0xac1b('0x40')][_0xac1b('0x1f')]=_0x326ae0[_0xac1b('0x42')][_0xac1b('0x43')];_0x326ae0[_0xac1b('0x40')][_0xac1b('0x44')]=_0x326ae0[_0xac1b('0x42')][_0xac1b('0x45')];_0x326ae0['body'][_0xac1b('0x24')]=_0x326ae0[_0xac1b('0x42')][_0xac1b('0x46')];return db[_0xac1b('0x22')]['create'](_0x326ae0['body'])['then'](respondWithResult(_0x517b42,0xc9))[_0xac1b('0x37')](handleError(_0x517b42,null));};exports['download']=function(_0xc7b42b,_0xce9b62,_0xdc7e0c){return db[_0xac1b('0x22')][_0xac1b('0x47')]({'where':{'id':_0xc7b42b[_0xac1b('0x39')]['id']},'raw':!![]})[_0xac1b('0x1d')](handleEntityNotFound(_0xce9b62,null))[_0xac1b('0x1d')](function(_0x90caaf){if(_0x90caaf){var _0xf4fc4a=_0x90caaf[_0xac1b('0x48')]!==null;var _0x22d5a9=path['join'](config[_0xac1b('0x49')],'server/files/attachments/');if(_0xf4fc4a){_0x22d5a9=path[_0xac1b('0x4a')](_0x22d5a9,'offline-chat/');}var _0x518e48=path['join'](_0x22d5a9,_0x90caaf[_0xac1b('0x44')]);return _0xce9b62[_0xac1b('0x4b')](_0x518e48);}})[_0xac1b('0x37')](handleError(_0xce9b62,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 4e8bdfa..e022c43 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 _0x5c0f=['Attachment','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./attachment.attributes','exports','define'];(function(_0x5a2f71,_0x98029e){var _0x3267cc=function(_0x5d64db){while(--_0x5d64db){_0x5a2f71['push'](_0x5a2f71['shift']());}};_0x3267cc(++_0x98029e);}(_0x5c0f,0xb1));var _0xf5c0=function(_0x3def1b,_0x56f748){_0x3def1b=_0x3def1b-0x0;var _0x57340e=_0x5c0f[_0x3def1b];return _0x57340e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf5c0('0x0'))(_0xf5c0('0x1'));var moment=require(_0xf5c0('0x2'));var BPromise=require(_0xf5c0('0x3'));var rp=require(_0xf5c0('0x4'));var fs=require('fs');var path=require(_0xf5c0('0x5'));var rimraf=require(_0xf5c0('0x6'));var config=require('../../config/environment');var attributes=require(_0xf5c0('0x7'));module[_0xf5c0('0x8')]=function(_0x152879,_0x541d87){return _0x152879[_0xf5c0('0x9')](_0xf5c0('0xa'),attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8871=['define','Attachment','attachments','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./attachment.attributes','exports'];(function(_0x4b0114,_0x1c3c3b){var _0x32dab9=function(_0x4f8f51){while(--_0x4f8f51){_0x4b0114['push'](_0x4b0114['shift']());}};_0x32dab9(++_0x1c3c3b);}(_0x8871,0x1bd));var _0x1887=function(_0x1554e6,_0x28607d){_0x1554e6=_0x1554e6-0x0;var _0x4cafbf=_0x8871[_0x1554e6];return _0x4cafbf;};'use strict';var _=require(_0x1887('0x0'));var util=require(_0x1887('0x1'));var logger=require(_0x1887('0x2'))(_0x1887('0x3'));var moment=require('moment');var BPromise=require(_0x1887('0x4'));var rp=require(_0x1887('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1887('0x6'));var config=require(_0x1887('0x7'));var attributes=require(_0x1887('0x8'));module[_0x1887('0x9')]=function(_0x55feab,_0x2bcc01){return _0x55feab[_0x1887('0xa')](_0x1887('0xb'),attributes,{'tableName':_0x1887('0xc'),'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 4ee4775..6f45ab6 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 _0xda55=['options','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateAttachment','Attachment','create','body'];(function(_0x2a1ab6,_0x39b10e){var _0x182f6a=function(_0x69d9c4){while(--_0x69d9c4){_0x2a1ab6['push'](_0x2a1ab6['shift']());}};_0x182f6a(++_0x39b10e);}(_0xda55,0x6d));var _0x5da5=function(_0x4fe649,_0x177b95){_0x4fe649=_0x4fe649-0x0;var _0x19cebe=_0xda55[_0x4fe649];return _0x19cebe;};'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')]('Attachment,\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);});});}exports[_0x5da5('0x16')]=function(_0x16b11f){var _0x3f7e98=this;return new Promise(function(_0x428b07,_0x547c58){return db[_0x5da5('0x17')][_0x5da5('0x18')](_0x16b11f[_0x5da5('0x19')],{'raw':_0x16b11f[_0x5da5('0x1a')]?_0x16b11f[_0x5da5('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x5da5('0xa')](function(_0x3372fc){logger[_0x5da5('0x13')]('CreateAttachment',_0x16b11f);logger[_0x5da5('0xd')](_0x5da5('0x16'),_0x16b11f,JSON[_0x5da5('0xf')](_0x3372fc));_0x428b07(_0x3372fc);})[_0x5da5('0x15')](function(_0xec69f2){logger[_0x5da5('0x10')]('CreateAttachment',_0xec69f2[_0x5da5('0x12')],_0x16b11f);_0x547c58(_0x3f7e98['error'](0x1f4,_0xec69f2[_0x5da5('0x12')]));});});}; \ No newline at end of file +var _0x720c=['http','request','info','request\x20sent','debug','stringify','error','code','Attachment,\x20%s,\x20%s','message','catch','Attachment','create','body','options','CreateAttachment','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x2a78f5,_0x25960f){var _0x158e72=function(_0x550e37){while(--_0x550e37){_0x2a78f5['push'](_0x2a78f5['shift']());}};_0x158e72(++_0x25960f);}(_0x720c,0x154));var _0xc720=function(_0x21f18f,_0xced443){_0x21f18f=_0x21f18f-0x0;var _0x44e5d0=_0x720c[_0x21f18f];return _0x44e5d0;};'use strict';var _=require(_0xc720('0x0'));var util=require('util');var moment=require(_0xc720('0x1'));var BPromise=require(_0xc720('0x2'));var rs=require(_0xc720('0x3'));var fs=require('fs');var Redis=require(_0xc720('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc720('0x5'));var logger=require(_0xc720('0x6'))(_0xc720('0x7'));var config=require(_0xc720('0x8'));var jayson=require(_0xc720('0x9'));var client=jayson[_0xc720('0xa')][_0xc720('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5bc8b0,_0x20d21c,_0x8a01fc){return new BPromise(function(_0x10a2c8,_0x1a2a00){return client[_0xc720('0xc')](_0x5bc8b0,_0x8a01fc)['then'](function(_0x539493){logger[_0xc720('0xd')]('Attachment,\x20%s,\x20%s',_0x20d21c,_0xc720('0xe'));logger[_0xc720('0xf')]('Attachment,\x20%s,\x20%s,\x20%s',_0x20d21c,_0xc720('0xe'),JSON[_0xc720('0x10')](_0x539493));if(_0x539493[_0xc720('0x11')]){if(_0x539493[_0xc720('0x11')][_0xc720('0x12')]===0x1f4){logger['error'](_0xc720('0x13'),_0x20d21c,_0x539493[_0xc720('0x11')][_0xc720('0x14')]);return _0x1a2a00(_0x539493[_0xc720('0x11')]['message']);}logger[_0xc720('0x11')](_0xc720('0x13'),_0x20d21c,_0x539493[_0xc720('0x11')]['message']);return _0x10a2c8(_0x539493[_0xc720('0x11')][_0xc720('0x14')]);}else{logger[_0xc720('0xd')](_0xc720('0x13'),_0x20d21c,_0xc720('0xe'));_0x10a2c8(_0x539493['result']['message']);}})[_0xc720('0x15')](function(_0x583e07){logger[_0xc720('0x11')](_0xc720('0x13'),_0x20d21c,_0x583e07);_0x1a2a00(_0x583e07);});});}exports['CreateAttachment']=function(_0x34de4c){var _0x2a4fc0=this;return new Promise(function(_0x195cf3,_0x7b41f3){return db[_0xc720('0x16')][_0xc720('0x17')](_0x34de4c[_0xc720('0x18')],{'raw':_0x34de4c[_0xc720('0x19')]?_0x34de4c[_0xc720('0x19')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x52cdf7){logger[_0xc720('0xd')](_0xc720('0x1a'),_0x34de4c);logger[_0xc720('0xf')](_0xc720('0x1a'),_0x34de4c,JSON[_0xc720('0x10')](_0x52cdf7));_0x195cf3(_0x52cdf7);})[_0xc720('0x15')](function(_0x358cfe){logger['error'](_0xc720('0x1a'),_0x358cfe['message'],_0x34de4c);_0x7b41f3(_0x2a4fc0[_0xc720('0x11')](0x1f4,_0x358cfe[_0xc720('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 23a43b1..9475c42 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 _0xb10b=['originalname','replace','single','file','create','put','/:id','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','index','isAuthenticated','show','/:id/download','download','post','/:id/clone','diskStorage','join','server/files/attachments/','format','%s-%s'];(function(_0x43c534,_0x51e65e){var _0x4dea44=function(_0x480adc){while(--_0x480adc){_0x43c534['push'](_0x43c534['shift']());}};_0x4dea44(++_0x51e65e);}(_0xb10b,0x12a));var _0xbb10=function(_0x41d02a,_0x355e19){_0x41d02a=_0x41d02a-0x0;var _0x4c3983=_0xb10b[_0x41d02a];return _0x4c3983;};'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('0xf')](_0xbb10('0x10'),auth['isAuthenticated'](),controller['clone']);var upload=multer({'storage':multer[_0xbb10('0x11')]({'destination':function(_0x118a74,_0xce64f3,_0x5e136d){_0x5e136d(null,path[_0xbb10('0x12')](config['root'],_0xbb10('0x13')));},'filename':function(_0x916a32,_0x285009,_0x193a27){_0x193a27(null,util[_0xbb10('0x14')](_0xbb10('0x15'),Date['now'](),_0x285009[_0xbb10('0x16')][_0xbb10('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xbb10('0xf')]('/',upload[_0xbb10('0x18')](_0xbb10('0x19')),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')](_0xbb10('0x1c'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1d')]);router['delete'](_0xbb10('0x1c'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);module[_0xbb10('0x1f')]=router; \ No newline at end of file +var _0xb10b=['originalname','replace','single','file','create','put','/:id','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','index','isAuthenticated','show','/:id/download','download','post','/:id/clone','diskStorage','join','server/files/attachments/','format','%s-%s'];(function(_0xe5aeb9,_0x566135){var _0x471bdb=function(_0x421dc0){while(--_0x421dc0){_0xe5aeb9['push'](_0xe5aeb9['shift']());}};_0x471bdb(++_0x566135);}(_0xb10b,0x12a));var _0xbb10=function(_0xec919c,_0x45c528){_0xec919c=_0xec919c-0x0;var _0x516869=_0xb10b[_0xec919c];return _0x516869;};'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('0xf')](_0xbb10('0x10'),auth['isAuthenticated'](),controller['clone']);var upload=multer({'storage':multer[_0xbb10('0x11')]({'destination':function(_0x118a74,_0xce64f3,_0x5e136d){_0x5e136d(null,path[_0xbb10('0x12')](config['root'],_0xbb10('0x13')));},'filename':function(_0x916a32,_0x285009,_0x193a27){_0x193a27(null,util[_0xbb10('0x14')](_0xbb10('0x15'),Date['now'](),_0x285009[_0xbb10('0x16')][_0xbb10('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xbb10('0xf')]('/',upload[_0xbb10('0x18')](_0xbb10('0x19')),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')](_0xbb10('0x1c'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1d')]);router['delete'](_0xbb10('0x1c'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);module[_0xbb10('0x1f')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index 33bca05..a48546a 100644 --- a/server/api/authActiveDirectory/authActiveDirectory.controller.js +++ b/server/api/authActiveDirectory/authActiveDirectory.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb08c=['authenticate','Error\x20authenticate\x20%s:\x20%s','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','error','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','findOne','blockDuration','then','adSsoEnabled','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','salt','role','disabled','blocked','blockedAt','online','admin','user','name','add','minutes','clearBlockUser','getLicense','status','send','message','login','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','use','password','User','passport','passport-local','Strategy','moment','activedirectory2','util','../../mysqldb','../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','api','activedirectory','baseDN','domain'];(function(_0x32fb5a,_0x565a38){var _0x2f212c=function(_0x597960){while(--_0x597960){_0x32fb5a['push'](_0x32fb5a['shift']());}};_0x2f212c(++_0x565a38);}(_0xb08c,0x181));var _0xcb08=function(_0x2f4ca9,_0x2898c9){_0x2f4ca9=_0x2f4ca9-0x0;var _0x50e240=_0xb08c[_0x2f4ca9];return _0x50e240;};'use strict';var passport=require(_0xcb08('0x0'));var LocalStrategy=require(_0xcb08('0x1'))[_0xcb08('0x2')];var moment=require(_0xcb08('0x3'));var ActiveDirectory=require(_0xcb08('0x4'));var BPromise=require('bluebird');var util=require(_0xcb08('0x5'));var db=require(_0xcb08('0x6'))['db'];var authService=require(_0xcb08('0x7'));var utils=require(_0xcb08('0x8'));var config=require(_0xcb08('0x9'));var logger=require(_0xcb08('0xa'))(_0xcb08('0xb'));function isActiveDirectoryConfigured(_0x5097b2){var _0x2444e0=![];if(typeof _0x5097b2[_0xcb08('0xc')]!=='undefined'){_0x2444e0=_0x5097b2['activedirectory'][_0xcb08('0xd')]&&_0x5097b2[_0xcb08('0xc')]['url']&&_0x5097b2[_0xcb08('0xc')][_0xcb08('0xe')];}return _0x2444e0;}function adAuthenticate(_0x3fbdbd,_0x303f37,_0xf5a47f){return new BPromise(function(_0x5aad94,_0x23b496){try{var _0x1c6fbb=new ActiveDirectory(_0x3fbdbd);_0x1c6fbb[_0xcb08('0xf')](_0x303f37,_0xf5a47f,function(_0x546cc4,_0x1906e9){if(_0x546cc4){logger['error'](_0xcb08('0x10'),_0x303f37,util[_0xcb08('0x11')](_0x546cc4,{'showHidden':![],'depth':null}));_0x23b496(_0xcb08('0x12'));}else if(!_0x1906e9){logger[_0xcb08('0x13')](_0xcb08('0x14'),_0x303f37);_0x23b496(_0xcb08('0x12'));}else{_0x5aad94(_0x1906e9);}});}catch(_0x3b0597){_0x23b496(_0x3b0597);}});}function ActiveDirectoryAuthenticate(_0xd6193f,_0xb7215f,_0x3f4eb4,_0x1a1960){var _0x18f2c0,_0x153886;if(!isActiveDirectoryConfigured(config)){logger['error']('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured',_0xb7215f);return _0x1a1960(null,![],{'message':_0xcb08('0x12')});}return db['Setting'][_0xcb08('0x15')]({'where':{'id':0x1},'attributes':['adSsoEnabled',_0xcb08('0x16')],'raw':!![]})[_0xcb08('0x17')](function(_0x422c55){_0x18f2c0=_0x422c55;if(!_0x18f2c0[_0xcb08('0x18')]){logger[_0xcb08('0x13')](_0xcb08('0x19'),_0xb7215f);throw new Error(_0xcb08('0x12'));}return _0xd6193f[_0xcb08('0x15')]({'attributes':['id','name','password',_0xcb08('0x1a'),_0xcb08('0x1b'),_0xcb08('0x1c'),_0xcb08('0x1d'),_0xcb08('0x1e'),_0xcb08('0x1f')],'where':{'name':_0xb7215f,'role':{'$or':[_0xcb08('0x20'),_0xcb08('0x21'),'agent']},'adSsoEnabled':!![]}});})[_0xcb08('0x17')](function(_0x27ef59){if(!_0x27ef59||_0x27ef59&&_0x27ef59[_0xcb08('0x22')]!==_0xb7215f){throw new Error(_0xcb08('0x12'));}_0x153886=_0x27ef59;var _0x58531e=_0x153886['name']+'@'+config[_0xcb08('0xc')][_0xcb08('0xe')];return adAuthenticate(config[_0xcb08('0xc')],_0x58531e,_0x3f4eb4);})[_0xcb08('0x17')](function(_0x1303d4){if(_0x153886[_0xcb08('0x1c')]){throw new Error(_0xcb08('0x12'));}if(_0x18f2c0[_0xcb08('0x16')]>0x0){if(_0x153886[_0xcb08('0x1d')]){if(moment(_0x153886['blockedAt'])[_0xcb08('0x23')](_0x18f2c0[_0xcb08('0x16')],_0xcb08('0x24'))>moment()){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return utils[_0xcb08('0x25')](_0x153886,0x0,![],null)[_0xcb08('0x17')](function(){return utils[_0xcb08('0x26')](_0x153886);})['then'](function(){return _0x1a1960(null,_0x153886);});}else{return utils[_0xcb08('0x26')](_0x153886)[_0xcb08('0x17')](function(){return _0x1a1960(null,_0x153886);});}}else{return utils[_0xcb08('0x26')](_0x153886)[_0xcb08('0x17')](function(){return _0x1a1960(null,_0x153886);});}})['catch'](function(_0x2b5faa){return _0x1a1960(null,![],_0x2b5faa);});}function handleError(_0x42981b,_0x3b3154,_0x202194){return _0x42981b[_0xcb08('0x27')](_0x3b3154||0x1f4)[_0xcb08('0x28')]({'message':_0x202194?_0x202194[_0xcb08('0x29')]||_0x202194:''});}exports[_0xcb08('0x2a')]=function(_0x4853de,_0x2283da,_0x5533d2){passport['authenticate'](_0xcb08('0x2b'),function(_0x5edf9b,_0x1651cc,_0xbfbf08){var _0x1c84e2=_0x5edf9b||_0xbfbf08;if(_0x1c84e2){return handleError(_0x2283da,0x191,_0x1c84e2);}if(!_0x1651cc){return handleError(_0x2283da,0x194,{'message':_0xcb08('0x2c')});}else{var _0x4b70e1={'payload':{'id':_0x1651cc['id'],'role':_0x1651cc[_0xcb08('0x1b')]},'options':{'expiresIn':0x15180}};return authService[_0xcb08('0x2d')](_0x4b70e1)[_0xcb08('0x17')](function(_0x321473){_0x2283da[_0xcb08('0x2e')]({'id':_0x1651cc['id'],'token':_0x321473,'statusCall':'','isAlreadyLogged':_0x1651cc[_0xcb08('0x1f')]});});}})(_0x4853de,_0x2283da,_0x5533d2);};passport[_0xcb08('0x2f')](_0xcb08('0x2b'),new LocalStrategy({'usernameField':_0xcb08('0x22'),'passwordField':_0xcb08('0x30')},function(_0x554669,_0x11f981,_0x5951fd){return ActiveDirectoryAuthenticate(db[_0xcb08('0x31')],_0x554669,_0x11f981,_0x5951fd);})); \ No newline at end of file +var _0xb170=['online','admin','user','name','blocked','add','minutes','getLicense','status','send','login','authenticate','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','use','User','Strategy','moment','util','../../mysqldb','../../config/utils','../../config/environment','../../config/logger','api','activedirectory','undefined','baseDN','url','domain','error','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','adSsoEnabled','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','password','salt','disabled','blockedAt'];(function(_0x3f705a,_0x148dff){var _0x29c354=function(_0x4d9d7f){while(--_0x4d9d7f){_0x3f705a['push'](_0x3f705a['shift']());}};_0x29c354(++_0x148dff);}(_0xb170,0xbd));var _0x0b17=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xb170[_0x122ef9];return _0x42fba0;};'use strict';var passport=require('passport');var LocalStrategy=require('passport-local')[_0x0b17('0x0')];var moment=require(_0x0b17('0x1'));var ActiveDirectory=require('activedirectory2');var BPromise=require('bluebird');var util=require(_0x0b17('0x2'));var db=require(_0x0b17('0x3'))['db'];var authService=require('../../components/auth/service');var utils=require(_0x0b17('0x4'));var config=require(_0x0b17('0x5'));var logger=require(_0x0b17('0x6'))(_0x0b17('0x7'));function isActiveDirectoryConfigured(_0x170093){var _0x499bc2=![];if(typeof _0x170093[_0x0b17('0x8')]!==_0x0b17('0x9')){_0x499bc2=_0x170093[_0x0b17('0x8')][_0x0b17('0xa')]&&_0x170093[_0x0b17('0x8')][_0x0b17('0xb')]&&_0x170093[_0x0b17('0x8')][_0x0b17('0xc')];}return _0x499bc2;}function adAuthenticate(_0x40bd1c,_0x55d1f5,_0x5acf68){return new BPromise(function(_0x23b61e,_0xc83fbd){try{var _0x4fdb4d=new ActiveDirectory(_0x40bd1c);_0x4fdb4d['authenticate'](_0x55d1f5,_0x5acf68,function(_0x5aed64,_0x3734ef){if(_0x5aed64){logger[_0x0b17('0xd')]('Error\x20authenticate\x20%s:\x20%s',_0x55d1f5,util['inspect'](_0x5aed64,{'showHidden':![],'depth':null}));_0xc83fbd(_0x0b17('0xe'));}else if(!_0x3734ef){logger[_0x0b17('0xd')]('Error\x20authenticate\x20%s:\x20Wrong\x20credentials',_0x55d1f5);_0xc83fbd('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x23b61e(_0x3734ef);}});}catch(_0x7e3f13){_0xc83fbd(_0x7e3f13);}});}function ActiveDirectoryAuthenticate(_0x33fddd,_0x17c131,_0x56ac2d,_0x4626cc){var _0x215996,_0x45ba1a;if(!isActiveDirectoryConfigured(config)){logger[_0x0b17('0xd')](_0x0b17('0xf'),_0x17c131);return _0x4626cc(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}return db[_0x0b17('0x10')][_0x0b17('0x11')]({'where':{'id':0x1},'attributes':[_0x0b17('0x12'),_0x0b17('0x13')],'raw':!![]})[_0x0b17('0x14')](function(_0x550664){_0x215996=_0x550664;if(!_0x215996[_0x0b17('0x12')]){logger[_0x0b17('0xd')](_0x0b17('0x15'),_0x17c131);throw new Error(_0x0b17('0xe'));}return _0x33fddd['findOne']({'attributes':['id','name',_0x0b17('0x16'),_0x0b17('0x17'),'role',_0x0b17('0x18'),'blocked',_0x0b17('0x19'),_0x0b17('0x1a')],'where':{'name':_0x17c131,'role':{'$or':[_0x0b17('0x1b'),_0x0b17('0x1c'),'agent']},'adSsoEnabled':!![]}});})['then'](function(_0x4b0aaa){if(!_0x4b0aaa||_0x4b0aaa&&_0x4b0aaa[_0x0b17('0x1d')]!==_0x17c131){throw new Error(_0x0b17('0xe'));}_0x45ba1a=_0x4b0aaa;var _0x26998c=_0x45ba1a[_0x0b17('0x1d')]+'@'+config[_0x0b17('0x8')][_0x0b17('0xc')];return adAuthenticate(config[_0x0b17('0x8')],_0x26998c,_0x56ac2d);})[_0x0b17('0x14')](function(_0xc6ea5e){if(_0x45ba1a[_0x0b17('0x18')]){throw new Error(_0x0b17('0xe'));}if(_0x215996[_0x0b17('0x13')]>0x0){if(_0x45ba1a[_0x0b17('0x1e')]){if(moment(_0x45ba1a['blockedAt'])[_0x0b17('0x1f')](_0x215996[_0x0b17('0x13')],_0x0b17('0x20'))>moment()){throw new Error(_0x0b17('0xe'));}return utils['clearBlockUser'](_0x45ba1a,0x0,![],null)[_0x0b17('0x14')](function(){return utils[_0x0b17('0x21')](_0x45ba1a);})[_0x0b17('0x14')](function(){return _0x4626cc(null,_0x45ba1a);});}else{return utils['getLicense'](_0x45ba1a)['then'](function(){return _0x4626cc(null,_0x45ba1a);});}}else{return utils[_0x0b17('0x21')](_0x45ba1a)['then'](function(){return _0x4626cc(null,_0x45ba1a);});}})['catch'](function(_0x312d36){return _0x4626cc(null,![],_0x312d36);});}function handleError(_0x4564ef,_0x38988e,_0x62c586){return _0x4564ef[_0x0b17('0x22')](_0x38988e||0x1f4)[_0x0b17('0x23')]({'message':_0x62c586?_0x62c586['message']||_0x62c586:''});}exports[_0x0b17('0x24')]=function(_0x38aebf,_0x6bf581,_0x173b76){passport[_0x0b17('0x25')](_0x0b17('0x26'),function(_0x271588,_0x47a5ce,_0x24d716){var _0x597e6c=_0x271588||_0x24d716;if(_0x597e6c){return handleError(_0x6bf581,0x191,_0x597e6c);}if(!_0x47a5ce){return handleError(_0x6bf581,0x194,{'message':_0x0b17('0x27')});}else{var _0x57c43d={'payload':{'id':_0x47a5ce['id'],'role':_0x47a5ce[_0x0b17('0x28')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x57c43d)[_0x0b17('0x14')](function(_0xedebf7){_0x6bf581['json']({'id':_0x47a5ce['id'],'token':_0xedebf7,'statusCall':'','isAlreadyLogged':_0x47a5ce[_0x0b17('0x1a')]});});}})(_0x38aebf,_0x6bf581,_0x173b76);};passport[_0x0b17('0x29')](_0x0b17('0x26'),new LocalStrategy({'usernameField':'name','passwordField':_0x0b17('0x16')},function(_0x474d71,_0x49c75b,_0x14416f){return ActiveDirectoryAuthenticate(db[_0x0b17('0x2a')],_0x474d71,_0x49c75b,_0x14416f);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index 197dec2..22378a5 100644 --- a/server/api/authActiveDirectory/index.js +++ b/server/api/authActiveDirectory/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x85bd=['Router','./authActiveDirectory.controller','express'];(function(_0x58beaa,_0x41a8f0){var _0x478b2a=function(_0x499abf){while(--_0x499abf){_0x58beaa['push'](_0x58beaa['shift']());}};_0x478b2a(++_0x41a8f0);}(_0x85bd,0x1b2));var _0xd85b=function(_0x10852d,_0x4cdcc6){_0x10852d=_0x10852d-0x0;var _0x13a8d6=_0x85bd[_0x10852d];return _0x13a8d6;};'use strict';var express=require(_0xd85b('0x0'));var router=express[_0xd85b('0x1')]();var controller=require(_0xd85b('0x2'));router['post']('/',controller['login']);module['exports']=router; \ No newline at end of file +var _0x4de0=['express','Router','./authActiveDirectory.controller','post','login'];(function(_0x4c25cb,_0xce5c6c){var _0x5a61f2=function(_0x5ad642){while(--_0x5ad642){_0x4c25cb['push'](_0x4c25cb['shift']());}};_0x5a61f2(++_0xce5c6c);}(_0x4de0,0x16d));var _0x04de=function(_0x562435,_0x1cbdee){_0x562435=_0x562435-0x0;var _0x402999=_0x4de0[_0x562435];return _0x402999;};'use strict';var express=require(_0x04de('0x0'));var router=express[_0x04de('0x1')]();var controller=require(_0x04de('0x2'));router[_0x04de('0x3')]('/',controller[_0x04de('0x4')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 6ceaa93..f1fd18a 100644 --- a/server/api/authGoogle/authGoogle.controller.js +++ b/server/api/authGoogle/authGoogle.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['../../config/environment','../../config/utils','login','google','/login','profile','email','callback','authenticate','use','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','User','find','map','emails','value','admin','user','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','add','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb'];(function(_0x351c9d,_0x2b306e){var _0x281bfa=function(_0x32fe12){while(--_0x32fe12){_0x351c9d['push'](_0x351c9d['shift']());}};_0x281bfa(++_0x2b306e);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x7995('0x0'));var passport=require(_0x7995('0x1'));var GoogleStrategy=require(_0x7995('0x2'))[_0x7995('0x3')];var moment=require('moment');var db=require(_0x7995('0x4'))['db'];var config=require(_0x7995('0x5'));var utils=require(_0x7995('0x6'));exports[_0x7995('0x7')]=passport['authenticate'](_0x7995('0x8'),{'failureRedirect':_0x7995('0x9'),'scope':[_0x7995('0xa'),_0x7995('0xb')],'session':![]});exports[_0x7995('0xc')]=passport[_0x7995('0xd')]('google',{'failureRedirect':_0x7995('0x9'),'session':![]});passport[_0x7995('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x7995('0x8')][_0x7995('0xf')]:'id','clientSecret':config[_0x7995('0x8')]?config[_0x7995('0x8')][_0x7995('0x10')]:_0x7995('0x11'),'callbackURL':config[_0x7995('0x8')]?config['google'][_0x7995('0x12')]:''},function(_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e,_0x385f00;return db[_0x7995('0x13')][_0x7995('0x14')]({'where':{'id':0x1},'attributes':[_0x7995('0x15'),'blockDuration'],'raw':!![]})['then'](function(_0x2b4e94){_0x19a27e=_0x2b4e94;return db[_0x7995('0x16')][_0x7995('0x17')]({'where':{'email':_[_0x7995('0x18')](_0xb0c872[_0x7995('0x19')],_0x7995('0x1a')),'role':{'$or':[_0x7995('0x1b'),_0x7995('0x1c'),'agent']}}});})[_0x7995('0x1d')](function(_0x565d97){_0x385f00=_0x565d97;if(_0x385f00){if(_0x385f00[_0x7995('0x1e')]){return _0x2cb37a(_0x7995('0x1f'));}else if(_0x19a27e[_0x7995('0x20')]>0x0){if(_0x385f00[_0x7995('0x21')]){if(moment(_0x385f00[_0x7995('0x22')])[_0x7995('0x23')](_0x19a27e['blockDuration'],'minutes')>moment()){return _0x2cb37a(_0x7995('0x1f'));}else{return utils['clearBlockUser'](_0x385f00,0x0,![],null)['then'](function(){return utils[_0x7995('0x24')](_0x385f00);})[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)['then'](function(){return _0x2cb37a(null,_0x385f00);});}}return _0x2cb37a(_0x7995('0x1f'));})[_0x7995('0x25')](function(_0x350fd9){_0x2cb37a(_0x350fd9);});})); \ No newline at end of file +var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x7a54,0x106));var _0x47a5=function(_0x2c0025,_0x353ba8){_0x2c0025=_0x2c0025-0x0;var _0x5bb668=_0x7a54[_0x2c0025];return _0x5bb668;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 80b9485..694d376 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 _0x300f=['../user/user.controller.js','../../components/auth/service','/callback','isMiddleware','setTokenCookie','exports','Router','./authGoogle.controller'];(function(_0x5cfb43,_0xddf01b){var _0xd01d86=function(_0x45cb29){while(--_0x45cb29){_0x5cfb43['push'](_0x5cfb43['shift']());}};_0xd01d86(++_0xddf01b);}(_0x300f,0x18e));var _0xf300=function(_0x5b14c5,_0xe0f313){_0x5b14c5=_0x5b14c5-0x0;var _0x5c00c1=_0x300f[_0x5b14c5];return _0x5c00c1;};'use strict';var express=require('express');var passport=require('passport');var router=express[_0xf300('0x0')]();var controller=require(_0xf300('0x1'));var userController=require(_0xf300('0x2'));var authService=require(_0xf300('0x3'));router['get']('/',controller['login']);router['get'](_0xf300('0x4'),controller['callback'],authService[_0xf300('0x5')],userController['login'],authService[_0xf300('0x6')]);module[_0xf300('0x7')]=router; \ No newline at end of file +var _0x4e60=['../user/user.controller.js','../../components/auth/service','get','callback','setTokenCookie','exports','express','passport','Router','./authGoogle.controller'];(function(_0x477cb1,_0x1bd49a){var _0x40bfc2=function(_0x5d3d52){while(--_0x5d3d52){_0x477cb1['push'](_0x477cb1['shift']());}};_0x40bfc2(++_0x1bd49a);}(_0x4e60,0x150));var _0x04e6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4e60[_0x3dd15e];return _0x231fd0;};'use strict';var express=require(_0x04e6('0x0'));var passport=require(_0x04e6('0x1'));var router=express[_0x04e6('0x2')]();var controller=require(_0x04e6('0x3'));var userController=require(_0x04e6('0x4'));var authService=require(_0x04e6('0x5'));router[_0x04e6('0x6')]('/',controller['login']);router[_0x04e6('0x6')]('/callback',controller[_0x04e6('0x7')],authService['isMiddleware'],userController['login'],authService[_0x04e6('0x8')]);module[_0x04e6('0x9')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 6982bbe..2bdb58a 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 _0x2b86=['request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','send','login','local-login','signToken','json','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','minutes','resetPasswordToken','resetPasswordExpires','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','headers','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','status','Reset\x20Email\x20sent!','reset','params','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','passwordHistoryLimit','validatePasswordPattern','password','enforcePasswordHistory','previousPasswords','use','passport','passport-local','Strategy','jayson/promise','lodash','moment','../../mysqldb','../../config/utils','client','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','salt','role','blocked','blockedAt','loginAttempts','admin','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','disabled','add','clearBlockUser','getLicense','catch','MailAccount','find','email','MailServerOut','Smtp','CloudProvider','merge','format','\x22%s\x22\x20<%s>','user'];(function(_0x9b0237,_0x2905ca){var _0x5203fe=function(_0x3d1db2){while(--_0x3d1db2){_0x9b0237['push'](_0x9b0237['shift']());}};_0x5203fe(++_0x2905ca);}(_0x2b86,0x1bb));var _0x62b8=function(_0x237aab,_0x523604){_0x237aab=_0x237aab-0x0;var _0x55b525=_0x2b86[_0x237aab];return _0x55b525;};'use strict';var util=require('util');var passport=require(_0x62b8('0x0'));var LocalStrategy=require(_0x62b8('0x1'))[_0x62b8('0x2')];var jayson=require(_0x62b8('0x3'));var _=require(_0x62b8('0x4'));var rs=require('randomstring');var moment=require(_0x62b8('0x5'));var db=require(_0x62b8('0x6'))['db'];var authService=require('../../components/auth/service');var utils=require(_0x62b8('0x7'));var client=jayson[_0x62b8('0x8')]['http']({'port':0x232b});function localAuthenticate(_0x3cadab,_0x1d0715,_0x276770,_0x6c2104){var _0x21575f,_0xede99c;return db[_0x62b8('0x9')][_0x62b8('0xa')]({'where':{'id':0x1},'attributes':[_0x62b8('0xb'),_0x62b8('0xc')],'raw':!![]})[_0x62b8('0xd')](function(_0x1170ad){_0x21575f=_0x1170ad;return _0x3cadab[_0x62b8('0xa')]({'attributes':['id',_0x62b8('0xe'),'password',_0x62b8('0xf'),_0x62b8('0x10'),'disabled',_0x62b8('0x11'),_0x62b8('0x12'),_0x62b8('0x13')],'where':{'name':_0x1d0715,'role':{'$or':[_0x62b8('0x14'),'user','agent']}}});})[_0x62b8('0xd')](function(_0x1f4864){if(!_0x1f4864||_0x1f4864&&_0x1f4864['name']!==_0x1d0715){throw new Error(_0x62b8('0x15'));}else{_0xede99c=_0x1f4864;return _0xede99c;}})[_0x62b8('0xd')](function(){_0xede99c['authenticate'](_0x276770,function(_0x36fd0f,_0x5809b5){var _0x5aa64b=_0xede99c[_0x62b8('0x13')]+0x1;if(_0x36fd0f){return _0x6c2104(_0x36fd0f);}else if(!_0x5809b5){if(_0xede99c[_0x62b8('0x16')]){return _0x6c2104(null,![],{'message':_0x62b8('0x15')});}else if(_0x21575f[_0x62b8('0xb')]>0x0){if(_0xede99c[_0x62b8('0x11')]){if(_0x21575f[_0x62b8('0xc')]>0x0){if(moment(_0xede99c[_0x62b8('0x12')])[_0x62b8('0x17')](_0x21575f[_0x62b8('0xc')],'minutes')>moment()){return _0x6c2104(null,![],{'message':_0x62b8('0x15')});}else{return utils[_0x62b8('0x18')](_0xede99c,_0x5aa64b,![],null)[_0x62b8('0xd')](function(){return _0x6c2104(null,![],{'message':_0x62b8('0x15')});});}}else{return _0x6c2104(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x5aa64b>=_0x21575f[_0x62b8('0xb')]){return utils[_0x62b8('0x18')](_0xede99c,0x0,!![],moment())[_0x62b8('0xd')](function(){return _0x6c2104(null,![],{'message':_0x62b8('0x15')});});}else{return utils[_0x62b8('0x18')](_0xede99c,_0x5aa64b,![],null)[_0x62b8('0xd')](function(){return _0x6c2104(null,![],{'message':_0x62b8('0x15')});});}}}else{return _0x6c2104(null,![],{'message':_0x62b8('0x15')});}}else{if(_0xede99c[_0x62b8('0x16')]){return _0x6c2104(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x21575f[_0x62b8('0xb')]>0x0){if(_0xede99c[_0x62b8('0x11')]){if(_0x21575f[_0x62b8('0xc')]>0x0){if(moment(_0xede99c['blockedAt'])[_0x62b8('0x17')](_0x21575f[_0x62b8('0xc')],'minutes')>moment()){return _0x6c2104(null,![],{'message':_0x62b8('0x15')});}else{return utils[_0x62b8('0x18')](_0xede99c,0x0,![],null)[_0x62b8('0xd')](function(){return utils[_0x62b8('0x19')](_0xede99c);})[_0x62b8('0xd')](function(){return _0x6c2104(null,_0xede99c);});}}else{return _0x6c2104(null,![],{'message':_0x62b8('0x15')});}}else{return utils[_0x62b8('0x18')](_0xede99c,0x0,![],null)[_0x62b8('0xd')](function(){return utils[_0x62b8('0x19')](_0xede99c);})[_0x62b8('0xd')](function(){return _0x6c2104(null,_0xede99c);})[_0x62b8('0x1a')](function(_0x55c0cb){return _0x6c2104(null,![],_0x55c0cb);});}}else{if(_0xede99c[_0x62b8('0x11')]){return _0x6c2104(null,![],{'message':_0x62b8('0x15')});}else{return utils['getLicense'](_0xede99c)['then'](function(){return _0x6c2104(null,_0xede99c);});}}}});})[_0x62b8('0x1a')](function(_0x3c0d0c){return _0x6c2104(null,![],_0x3c0d0c);});}function sendServiceMail(_0x51d64d){return db[_0x62b8('0x1b')][_0x62b8('0x1c')]({'where':{'service':!![]},'attributes':['id',_0x62b8('0xe'),_0x62b8('0x1d')],'include':[{'model':db[_0x62b8('0x1e')],'as':_0x62b8('0x1f'),'include':[{'model':db[_0x62b8('0x20')],'as':_0x62b8('0x20')}]}]})[_0x62b8('0xd')](function(_0x27c111){if(!_0x27c111){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x156906=_0x27c111['getSmtpOptions']();var _0x2363cb={'account':_0x156906,'message':_[_0x62b8('0x21')]({'from':util[_0x62b8('0x22')](_0x62b8('0x23'),_0x27c111[_0x62b8('0xe')],_0x27c111[_0x62b8('0x1d')]||_0x27c111['Smtp'][_0x62b8('0x24')])},_0x51d64d)};return client[_0x62b8('0x25')](_0x62b8('0x26'),_0x2363cb);})['then'](function(_0x26241c){if(_0x26241c[_0x62b8('0x27')]){throw new Error(util[_0x62b8('0x22')](_0x62b8('0x28'),_0x26241c[_0x62b8('0x27')][_0x62b8('0x29')]||JSON[_0x62b8('0x2a')](_0x26241c[_0x62b8('0x27')])));}return!![];});}function handleError(_0x2db6a4,_0x22a69c,_0x53d28d){return _0x2db6a4['status'](_0x22a69c||0x1f4)[_0x62b8('0x2b')]({'message':_0x53d28d?_0x53d28d[_0x62b8('0x29')]||_0x53d28d:''});}exports[_0x62b8('0x2c')]=function(_0x577e38,_0x1b9eff,_0x33e0a7){passport['authenticate'](_0x62b8('0x2d'),function(_0x2450a3,_0x21adc5,_0x4e1967){var _0x5213e5=_0x2450a3||_0x4e1967;if(_0x5213e5){return handleError(_0x1b9eff,0x191,_0x5213e5);}if(!_0x21adc5){return handleError(_0x1b9eff,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x2bc806={'payload':{'id':_0x21adc5['id'],'role':_0x21adc5[_0x62b8('0x10')]},'options':{'expiresIn':0x15180}};return authService[_0x62b8('0x2e')](_0x2bc806)['then'](function(_0x21babd){_0x1b9eff[_0x62b8('0x2f')]({'id':_0x21adc5['id'],'token':_0x21babd,'statusCall':'','isAlreadyLogged':_0x21adc5[_0x62b8('0x30')]});});}})(_0x577e38,_0x1b9eff,_0x33e0a7);};exports[_0x62b8('0x31')]=function(_0x2f964d,_0x1c234c){if(!_0x2f964d[_0x62b8('0x32')][_0x62b8('0x1d')]){return handleError(_0x1c234c,0x1f4,{'message':_0x62b8('0x33')});}var _0x284808=rs[_0x62b8('0x34')]();_0x2f964d[_0x62b8('0x32')]['email']=_0x2f964d[_0x62b8('0x32')][_0x62b8('0x1d')][_0x62b8('0x35')]()[_0x62b8('0x36')]();var _0x576adc;return db[_0x62b8('0x9')][_0x62b8('0xa')]({'where':{'id':0x1},'attributes':[_0x62b8('0xb'),'blockDuration'],'raw':!![]})[_0x62b8('0xd')](function(_0x45ec90){_0x576adc=_0x45ec90;return db[_0x62b8('0x37')]['find']({'where':{'email':_0x2f964d[_0x62b8('0x32')]['email']}});})[_0x62b8('0xd')](function(_0x93d1c0){if(!_0x93d1c0){throw new Error(_0x62b8('0x38'));}if(_0x93d1c0['disabled']){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x93d1c0['blocked']){if(moment(_0x93d1c0[_0x62b8('0x12')])[_0x62b8('0x17')](_0x576adc[_0x62b8('0xc')],_0x62b8('0x39'))>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x93d1c0[_0x62b8('0x11')]=![];_0x93d1c0[_0x62b8('0x12')]=null;}}_0x93d1c0[_0x62b8('0x3a')]=_0x284808;_0x93d1c0[_0x62b8('0x3b')]=Date['now']()+0x36ee80;return _0x93d1c0[_0x62b8('0x3c')]();})[_0x62b8('0xd')](function(){return sendServiceMail({'to':_0x2f964d[_0x62b8('0x32')][_0x62b8('0x1d')],'subject':_0x62b8('0x3d'),'text':_0x62b8('0x3e')+_0x62b8('0x3f')+'https://'+_0x2f964d[_0x62b8('0x40')][_0x62b8('0x41')]+_0x62b8('0x42')+_0x284808+'\x0a\x0a'+_0x62b8('0x43')});})[_0x62b8('0xd')](function(){_0x1c234c[_0x62b8('0x44')](0xc8)[_0x62b8('0x2b')]({'message':_0x62b8('0x45')});})[_0x62b8('0x1a')](function(_0x5513cc){return handleError(_0x1c234c,0x1f4,_0x5513cc);});};exports[_0x62b8('0x46')]=function(_0x38704f,_0x30e8ab){return db[_0x62b8('0x37')][_0x62b8('0x1c')]({'where':{'resetPasswordToken':_0x38704f[_0x62b8('0x47')]['token'],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0x62b8('0xd')](function(_0x255752){if(!_0x255752){throw new Error(_0x62b8('0x48'));}return db['Setting'][_0x62b8('0xa')]({'attributes':['id',_0x62b8('0x49'),'enforcePasswordHistory',_0x62b8('0x4a')]})[_0x62b8('0xd')](function(_0x19901f){if(_0x19901f['securePassword'])authService[_0x62b8('0x4b')](_0x38704f[_0x62b8('0x32')][_0x62b8('0x4c')]);if(!_0x19901f[_0x62b8('0x4d')]||!_0x255752[_0x62b8('0x4e')])return _0x255752;authService['validatePasswordHistory'](_0x38704f[_0x62b8('0x32')][_0x62b8('0x4c')],_0x255752[_0x62b8('0x4e')],_0x19901f[_0x62b8('0x4a')]);return _0x255752;})['then'](function(){_0x255752[_0x62b8('0x4c')]=_0x38704f[_0x62b8('0x32')][_0x62b8('0x4c')];_0x255752[_0x62b8('0x3a')]=null;_0x255752[_0x62b8('0x3b')]=null;return _0x255752['save']();});})[_0x62b8('0xd')](function(){_0x30e8ab['status'](0xc8)[_0x62b8('0x2b')]({'message':'Password\x20reset!'});})['catch'](function(_0x523716){return handleError(_0x30e8ab,0x1f4,_0x523716);});};passport[_0x62b8('0x4f')]('local-login',new LocalStrategy({'usernameField':_0x62b8('0xe'),'passwordField':_0x62b8('0x4c')},function(_0x1462ea,_0x31b514,_0x1fb611){return localAuthenticate(db[_0x62b8('0x37')],_0x1462ea,_0x31b514,_0x1fb611);})); \ No newline at end of file +var _0x5d01=['\x22%s\x22\x20<%s>','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','login','authenticate','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','online','forgot','Email\x20parameter\x20is\x20missing','generate','body','trim','toLowerCase','Setting','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordExpires','now','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','/reset/','Reset\x20Email\x20sent!','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','enforcePasswordHistory','passwordHistoryLimit','securePassword','validatePasswordPattern','previousPasswords','validatePasswordHistory','save','Password\x20reset!','use','util','passport-local','jayson/promise','lodash','moment','../../mysqldb','../../components/auth/service','client','http','findOne','allowedLoginAttempts','blockDuration','then','name','password','role','disabled','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','add','clearBlockUser','blockedAt','minutes','getLicense','catch','find','email','MailServerOut','Smtp','CloudProvider','merge','format'];(function(_0x3f4678,_0x3751cb){var _0x596a02=function(_0x32283c){while(--_0x32283c){_0x3f4678['push'](_0x3f4678['shift']());}};_0x596a02(++_0x3751cb);}(_0x5d01,0xd5));var _0x15d0=function(_0x40747f,_0xfb96d9){_0x40747f=_0x40747f-0x0;var _0x37edc6=_0x5d01[_0x40747f];return _0x37edc6;};'use strict';var util=require(_0x15d0('0x0'));var passport=require('passport');var LocalStrategy=require(_0x15d0('0x1'))['Strategy'];var jayson=require(_0x15d0('0x2'));var _=require(_0x15d0('0x3'));var rs=require('randomstring');var moment=require(_0x15d0('0x4'));var db=require(_0x15d0('0x5'))['db'];var authService=require(_0x15d0('0x6'));var utils=require('../../config/utils');var client=jayson[_0x15d0('0x7')][_0x15d0('0x8')]({'port':0x232b});function localAuthenticate(_0x98d71d,_0x54547f,_0x489fb3,_0x280993){var _0x404b5b,_0x490391;return db['Setting'][_0x15d0('0x9')]({'where':{'id':0x1},'attributes':[_0x15d0('0xa'),_0x15d0('0xb')],'raw':!![]})[_0x15d0('0xc')](function(_0x5090ca){_0x404b5b=_0x5090ca;return _0x98d71d[_0x15d0('0x9')]({'attributes':['id',_0x15d0('0xd'),_0x15d0('0xe'),'salt',_0x15d0('0xf'),_0x15d0('0x10'),'blocked','blockedAt',_0x15d0('0x11')],'where':{'name':_0x54547f,'role':{'$or':[_0x15d0('0x12'),_0x15d0('0x13'),_0x15d0('0x14')]}}});})[_0x15d0('0xc')](function(_0x3ad0b4){if(!_0x3ad0b4||_0x3ad0b4&&_0x3ad0b4['name']!==_0x54547f){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x490391=_0x3ad0b4;return _0x490391;}})[_0x15d0('0xc')](function(){_0x490391['authenticate'](_0x489fb3,function(_0x7f6442,_0x4edac6){var _0x579f68=_0x490391['loginAttempts']+0x1;if(_0x7f6442){return _0x280993(_0x7f6442);}else if(!_0x4edac6){if(_0x490391[_0x15d0('0x10')]){return _0x280993(null,![],{'message':_0x15d0('0x15')});}else if(_0x404b5b[_0x15d0('0xa')]>0x0){if(_0x490391[_0x15d0('0x16')]){if(_0x404b5b[_0x15d0('0xb')]>0x0){if(moment(_0x490391['blockedAt'])[_0x15d0('0x17')](_0x404b5b[_0x15d0('0xb')],'minutes')>moment()){return _0x280993(null,![],{'message':_0x15d0('0x15')});}else{return utils[_0x15d0('0x18')](_0x490391,_0x579f68,![],null)[_0x15d0('0xc')](function(){return _0x280993(null,![],{'message':_0x15d0('0x15')});});}}else{return _0x280993(null,![],{'message':_0x15d0('0x15')});}}else{if(_0x579f68>=_0x404b5b[_0x15d0('0xa')]){return utils['clearBlockUser'](_0x490391,0x0,!![],moment())[_0x15d0('0xc')](function(){return _0x280993(null,![],{'message':_0x15d0('0x15')});});}else{return utils[_0x15d0('0x18')](_0x490391,_0x579f68,![],null)[_0x15d0('0xc')](function(){return _0x280993(null,![],{'message':_0x15d0('0x15')});});}}}else{return _0x280993(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x490391[_0x15d0('0x10')]){return _0x280993(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x404b5b[_0x15d0('0xa')]>0x0){if(_0x490391['blocked']){if(_0x404b5b[_0x15d0('0xb')]>0x0){if(moment(_0x490391[_0x15d0('0x19')])['add'](_0x404b5b[_0x15d0('0xb')],_0x15d0('0x1a'))>moment()){return _0x280993(null,![],{'message':_0x15d0('0x15')});}else{return utils[_0x15d0('0x18')](_0x490391,0x0,![],null)[_0x15d0('0xc')](function(){return utils[_0x15d0('0x1b')](_0x490391);})['then'](function(){return _0x280993(null,_0x490391);});}}else{return _0x280993(null,![],{'message':_0x15d0('0x15')});}}else{return utils[_0x15d0('0x18')](_0x490391,0x0,![],null)[_0x15d0('0xc')](function(){return utils['getLicense'](_0x490391);})['then'](function(){return _0x280993(null,_0x490391);})['catch'](function(_0x447018){return _0x280993(null,![],_0x447018);});}}else{if(_0x490391[_0x15d0('0x16')]){return _0x280993(null,![],{'message':_0x15d0('0x15')});}else{return utils[_0x15d0('0x1b')](_0x490391)[_0x15d0('0xc')](function(){return _0x280993(null,_0x490391);});}}}});})[_0x15d0('0x1c')](function(_0x323226){return _0x280993(null,![],_0x323226);});}function sendServiceMail(_0x4e4ba4){return db['MailAccount'][_0x15d0('0x1d')]({'where':{'service':!![]},'attributes':['id',_0x15d0('0xd'),_0x15d0('0x1e')],'include':[{'model':db[_0x15d0('0x1f')],'as':_0x15d0('0x20'),'include':[{'model':db[_0x15d0('0x21')],'as':'CloudProvider'}]}]})[_0x15d0('0xc')](function(_0x8610e9){if(!_0x8610e9){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x5787a7=_0x8610e9['getSmtpOptions']();var _0x1d64fb={'account':_0x5787a7,'message':_[_0x15d0('0x22')]({'from':util[_0x15d0('0x23')](_0x15d0('0x24'),_0x8610e9[_0x15d0('0xd')],_0x8610e9[_0x15d0('0x1e')]||_0x8610e9[_0x15d0('0x20')][_0x15d0('0x13')])},_0x4e4ba4)};return client[_0x15d0('0x25')](_0x15d0('0x26'),_0x1d64fb);})['then'](function(_0x49cc3f){if(_0x49cc3f[_0x15d0('0x27')]){throw new Error(util['format'](_0x15d0('0x28'),_0x49cc3f[_0x15d0('0x27')][_0x15d0('0x29')]||JSON[_0x15d0('0x2a')](_0x49cc3f[_0x15d0('0x27')])));}return!![];});}function handleError(_0x441c4b,_0x5090da,_0x8691a){return _0x441c4b[_0x15d0('0x2b')](_0x5090da||0x1f4)[_0x15d0('0x2c')]({'message':_0x8691a?_0x8691a[_0x15d0('0x29')]||_0x8691a:''});}exports[_0x15d0('0x2d')]=function(_0x3c7d32,_0x5ef28c,_0x5e75e2){passport[_0x15d0('0x2e')](_0x15d0('0x2f'),function(_0x3de7de,_0x5bd560,_0x5ea2e3){var _0x3c9831=_0x3de7de||_0x5ea2e3;if(_0x3c9831){return handleError(_0x5ef28c,0x191,_0x3c9831);}if(!_0x5bd560){return handleError(_0x5ef28c,0x194,{'message':_0x15d0('0x30')});}else{var _0x307561={'payload':{'id':_0x5bd560['id'],'role':_0x5bd560['role']},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x307561)[_0x15d0('0xc')](function(_0xcee3e4){_0x5ef28c[_0x15d0('0x31')]({'id':_0x5bd560['id'],'token':_0xcee3e4,'statusCall':'','isAlreadyLogged':_0x5bd560[_0x15d0('0x32')]});});}})(_0x3c7d32,_0x5ef28c,_0x5e75e2);};exports[_0x15d0('0x33')]=function(_0x5d19ae,_0x27b8ab){if(!_0x5d19ae['body'][_0x15d0('0x1e')]){return handleError(_0x27b8ab,0x1f4,{'message':_0x15d0('0x34')});}var _0x1c4b4b=rs[_0x15d0('0x35')]();_0x5d19ae['body'][_0x15d0('0x1e')]=_0x5d19ae[_0x15d0('0x36')][_0x15d0('0x1e')][_0x15d0('0x37')]()[_0x15d0('0x38')]();var _0x3d57db;return db[_0x15d0('0x39')][_0x15d0('0x9')]({'where':{'id':0x1},'attributes':[_0x15d0('0xa'),'blockDuration'],'raw':!![]})[_0x15d0('0xc')](function(_0x579d15){_0x3d57db=_0x579d15;return db[_0x15d0('0x3a')][_0x15d0('0x1d')]({'where':{'email':_0x5d19ae['body'][_0x15d0('0x1e')]}});})['then'](function(_0x5e6782){if(!_0x5e6782){throw new Error(_0x15d0('0x3b'));}if(_0x5e6782[_0x15d0('0x10')]){throw new Error(_0x15d0('0x3c'));}if(_0x5e6782[_0x15d0('0x16')]){if(moment(_0x5e6782['blockedAt'])[_0x15d0('0x17')](_0x3d57db['blockDuration'],_0x15d0('0x1a'))>moment()){throw new Error(_0x15d0('0x3d'));}else{_0x5e6782[_0x15d0('0x16')]=![];_0x5e6782[_0x15d0('0x19')]=null;}}_0x5e6782['resetPasswordToken']=_0x1c4b4b;_0x5e6782[_0x15d0('0x3e')]=Date[_0x15d0('0x3f')]()+0x36ee80;return _0x5e6782['save']();})[_0x15d0('0xc')](function(){return sendServiceMail({'to':_0x5d19ae[_0x15d0('0x36')][_0x15d0('0x1e')],'subject':_0x15d0('0x40'),'text':_0x15d0('0x41')+_0x15d0('0x42')+_0x15d0('0x43')+_0x5d19ae['headers']['host']+_0x15d0('0x44')+_0x1c4b4b+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})[_0x15d0('0xc')](function(){_0x27b8ab[_0x15d0('0x2b')](0xc8)[_0x15d0('0x2c')]({'message':_0x15d0('0x45')});})['catch'](function(_0x2ff62c){return handleError(_0x27b8ab,0x1f4,_0x2ff62c);});};exports[_0x15d0('0x46')]=function(_0x6bb6d,_0x284ca0){return db[_0x15d0('0x3a')]['find']({'where':{'resetPasswordToken':_0x6bb6d[_0x15d0('0x47')][_0x15d0('0x48')],'resetPasswordExpires':{'$gt':Date[_0x15d0('0x3f')]()}}})['then'](function(_0x483e84){if(!_0x483e84){throw new Error(_0x15d0('0x49'));}return db['Setting'][_0x15d0('0x9')]({'attributes':['id','securePassword',_0x15d0('0x4a'),_0x15d0('0x4b')]})[_0x15d0('0xc')](function(_0x3d2684){if(_0x3d2684[_0x15d0('0x4c')])authService[_0x15d0('0x4d')](_0x6bb6d['body'][_0x15d0('0xe')]);if(!_0x3d2684['enforcePasswordHistory']||!_0x483e84[_0x15d0('0x4e')])return _0x483e84;authService[_0x15d0('0x4f')](_0x6bb6d[_0x15d0('0x36')][_0x15d0('0xe')],_0x483e84[_0x15d0('0x4e')],_0x3d2684[_0x15d0('0x4b')]);return _0x483e84;})['then'](function(){_0x483e84[_0x15d0('0xe')]=_0x6bb6d[_0x15d0('0x36')][_0x15d0('0xe')];_0x483e84['resetPasswordToken']=null;_0x483e84['resetPasswordExpires']=null;return _0x483e84[_0x15d0('0x50')]();});})[_0x15d0('0xc')](function(){_0x284ca0[_0x15d0('0x2b')](0xc8)['send']({'message':_0x15d0('0x51')});})['catch'](function(_0x6f7015){return handleError(_0x284ca0,0x1f4,_0x6f7015);});};passport[_0x15d0('0x52')]('local-login',new LocalStrategy({'usernameField':'name','passwordField':_0x15d0('0xe')},function(_0x162df5,_0x3e24e3,_0x304ccc){return localAuthenticate(db[_0x15d0('0x3a')],_0x162df5,_0x3e24e3,_0x304ccc);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 05ec362..7794e67 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 _0xcade=['./authLocal.controller','post','login','forgot','reset','exports','express','Router'];(function(_0x1cfc39,_0x15adef){var _0x1ae59b=function(_0x153274){while(--_0x153274){_0x1cfc39['push'](_0x1cfc39['shift']());}};_0x1ae59b(++_0x15adef);}(_0xcade,0x176));var _0xecad=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcade[_0x3dd15e];return _0x231fd0;};'use strict';var express=require(_0xecad('0x0'));var router=express[_0xecad('0x1')]();var controller=require(_0xecad('0x2'));router[_0xecad('0x3')]('/',controller[_0xecad('0x4')]);router[_0xecad('0x3')]('/forgot',controller[_0xecad('0x5')]);router[_0xecad('0x3')]('/reset/:token',controller[_0xecad('0x6')]);module[_0xecad('0x7')]=router; \ No newline at end of file +var _0x39d4=['/reset/:token','reset','exports','Router','./authLocal.controller','post','login','/forgot','forgot'];(function(_0x3d7f32,_0x1a0361){var _0x201b3f=function(_0x2e9100){while(--_0x2e9100){_0x3d7f32['push'](_0x3d7f32['shift']());}};_0x201b3f(++_0x1a0361);}(_0x39d4,0x93));var _0x439d=function(_0x12a909,_0x2809e8){_0x12a909=_0x12a909-0x0;var _0x2f98c5=_0x39d4[_0x12a909];return _0x2f98c5;};'use strict';var express=require('express');var router=express[_0x439d('0x0')]();var controller=require(_0x439d('0x1'));router[_0x439d('0x2')]('/',controller[_0x439d('0x3')]);router['post'](_0x439d('0x4'),controller[_0x439d('0x5')]);router[_0x439d('0x2')](_0x439d('0x6'),controller[_0x439d('0x7')]);module[_0x439d('0x8')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index cb8a0a3..b07460c 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 _0xf28b=['STRING','BOOLEAN','INTEGER','exports'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0xf28b,0x1cb));var _0xbf28=function(_0x410746,_0x301fbb){_0x410746=_0x410746-0x0;var _0x37a399=_0xf28b[_0x410746];return _0x37a399;};'use strict';var Sequelize=require('sequelize');module[_0xbf28('0x0')]={'name':{'type':Sequelize[_0xbf28('0x1')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xbf28('0x1')]},'status':{'type':Sequelize[_0xbf28('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xbf28('0x3')],'defaultValue':0xa}}; \ No newline at end of file +var _0x4074=['INTEGER','exports','STRING','BOOLEAN'];(function(_0x37f364,_0x56f6ae){var _0x1a97dd=function(_0x4f4161){while(--_0x4f4161){_0x37f364['push'](_0x37f364['shift']());}};_0x1a97dd(++_0x56f6ae);}(_0x4074,0xcd));var _0x4407=function(_0x3c5042,_0x4f390f){_0x3c5042=_0x3c5042-0x0;var _0x4cc406=_0x4074[_0x3c5042];return _0x4cc406;};'use strict';var Sequelize=require('sequelize');module[_0x4407('0x0')]={'name':{'type':Sequelize[_0x4407('0x1')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4407('0x1')]},'status':{'type':Sequelize[_0x4407('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x4407('0x3')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index 27419fc..a2a1f6d 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 _0x98ed=['fields','length','hasOwnProperty','limit','order','sort','where','filter','merge','options','includeAll','rows','show','params','rawAttributes','include','create','body','catch','update','find','Condition','addConditions','ids','omit','getConditions','pick','addActions','getActions','findOne','Action','nolimit','rimraf','zip-dir','request-promise','moment','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','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','then','destroy','sendStatus','name','send','index','map','Automation','fieldName','type','key','query','keys','filters','intersection','model','attributes'];(function(_0x56aca0,_0x18e90d){var _0x5bfcdd=function(_0x2a6ccb){while(--_0x2a6ccb){_0x56aca0['push'](_0x56aca0['shift']());}};_0x5bfcdd(++_0x18e90d);}(_0x98ed,0x1ce));var _0xd98e=function(_0x995f33,_0x17fdce){_0x995f33=_0x995f33-0x0;var _0x587aec=_0x98ed[_0x995f33];return _0x587aec;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd98e('0x0'));var zipdir=require(_0xd98e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd98e('0x2'));var moment=require(_0xd98e('0x3'));var BPromise=require(_0xd98e('0x4'));var Mustache=require(_0xd98e('0x5'));var util=require(_0xd98e('0x6'));var path=require(_0xd98e('0x7'));var sox=require('sox');var csv=require(_0xd98e('0x8'));var ejs=require(_0xd98e('0x9'));var fs=require('fs');var fs_extra=require(_0xd98e('0xa'));var _=require(_0xd98e('0xb'));var squel=require('squel');var crypto=require(_0xd98e('0xc'));var jsforce=require(_0xd98e('0xd'));var deskjs=require(_0xd98e('0xe'));var toCsv=require(_0xd98e('0x8'));var querystring=require(_0xd98e('0xf'));var Papa=require(_0xd98e('0x10'));var Redis=require(_0xd98e('0x11'));var authService=require(_0xd98e('0x12'));var qs=require(_0xd98e('0x13'));var as=require(_0xd98e('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd98e('0x15'))(_0xd98e('0x16'));var utils=require(_0xd98e('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xd98e('0x18'));var db=require(_0xd98e('0x19'))['db'];function respondWithStatusCode(_0x567bc0,_0x51450c){_0x51450c=_0x51450c||0xcc;return function(_0x4a289e){if(_0x4a289e){return _0x567bc0['sendStatus'](_0x51450c);}return _0x567bc0['status'](_0x51450c)[_0xd98e('0x1a')]();};}function respondWithResult(_0x547555,_0x38fd1f){_0x38fd1f=_0x38fd1f||0xc8;return function(_0x41b5e0){if(_0x41b5e0){return _0x547555[_0xd98e('0x1b')](_0x38fd1f)[_0xd98e('0x1c')](_0x41b5e0);}};}function respondWithFilteredResult(_0x488a73,_0x3e18dc){return function(_0x126fd4){if(_0x126fd4){var _0x573cca=typeof _0x3e18dc[_0xd98e('0x1d')]===_0xd98e('0x1e')&&typeof _0x3e18dc['limit']==='undefined';var _0x17fc1b=_0x126fd4[_0xd98e('0x1f')];var _0x248381=_0x573cca?0x0:_0x3e18dc['offset'];var _0x4924d8=_0x573cca?_0x126fd4[_0xd98e('0x1f')]:_0x3e18dc['offset']+_0x3e18dc['limit'];var _0x3fef2d;if(_0x4924d8>=_0x17fc1b){_0x4924d8=_0x17fc1b;_0x3fef2d=0xc8;}else{_0x3fef2d=0xce;}_0x488a73[_0xd98e('0x1b')](_0x3fef2d);return _0x488a73[_0xd98e('0x20')](_0xd98e('0x21'),_0x248381+'-'+_0x4924d8+'/'+_0x17fc1b)[_0xd98e('0x1c')](_0x126fd4);}return null;};}function patchUpdates(_0x5b39a5){return function(_0x3f9c26){try{jsonpatch[_0xd98e('0x22')](_0x3f9c26,_0x5b39a5,!![]);}catch(_0x1f1873){return BPromise[_0xd98e('0x23')](_0x1f1873);}return _0x3f9c26[_0xd98e('0x24')]();};}function saveUpdates(_0x172c16,_0x5b60b7){return function(_0x330abf){if(_0x330abf){return _0x330abf['update'](_0x172c16)[_0xd98e('0x25')](function(_0x161608){return _0x161608;});}return null;};}function removeEntity(_0x116788,_0x1aae96){return function(_0x44d0e1){if(_0x44d0e1){return _0x44d0e1[_0xd98e('0x26')]()[_0xd98e('0x25')](function(){_0x116788['status'](0xcc)[_0xd98e('0x1a')]();});}};}function handleEntityNotFound(_0x1e536e,_0x4e5eaa){return function(_0x11cf56){if(!_0x11cf56){_0x1e536e[_0xd98e('0x27')](0x194);}return _0x11cf56;};}function handleError(_0x32f1d3,_0x2e23f6){_0x2e23f6=_0x2e23f6||0x1f4;return function(_0x1ae3bd){logger['error'](_0x1ae3bd['stack']);if(_0x1ae3bd[_0xd98e('0x28')]){delete _0x1ae3bd[_0xd98e('0x28')];}_0x32f1d3['status'](_0x2e23f6)[_0xd98e('0x29')](_0x1ae3bd);};}exports[_0xd98e('0x2a')]=function(_0xadc207,_0x103c89){var _0xe5a52={},_0x2a056f={},_0x38ee5a={'count':0x0,'rows':[]};var _0x250d6d=_[_0xd98e('0x2b')](db[_0xd98e('0x2c')]['rawAttributes'],function(_0x15102c){return{'name':_0x15102c[_0xd98e('0x2d')],'type':_0x15102c[_0xd98e('0x2e')][_0xd98e('0x2f')]};});_0x2a056f['model']=_[_0xd98e('0x2b')](_0x250d6d,_0xd98e('0x28'));_0x2a056f[_0xd98e('0x30')]=_[_0xd98e('0x31')](_0xadc207[_0xd98e('0x30')]);_0x2a056f[_0xd98e('0x32')]=_[_0xd98e('0x33')](_0x2a056f[_0xd98e('0x34')],_0x2a056f['query']);_0xe5a52[_0xd98e('0x35')]=_[_0xd98e('0x33')](_0x2a056f[_0xd98e('0x34')],qs[_0xd98e('0x36')](_0xadc207['query'][_0xd98e('0x36')]));_0xe5a52[_0xd98e('0x35')]=_0xe5a52[_0xd98e('0x35')][_0xd98e('0x37')]?_0xe5a52[_0xd98e('0x35')]:_0x2a056f[_0xd98e('0x34')];if(!_0xadc207[_0xd98e('0x30')][_0xd98e('0x38')]('nolimit')){_0xe5a52[_0xd98e('0x39')]=qs[_0xd98e('0x39')](_0xadc207[_0xd98e('0x30')][_0xd98e('0x39')]);_0xe5a52['offset']=qs[_0xd98e('0x1d')](_0xadc207[_0xd98e('0x30')][_0xd98e('0x1d')]);}_0xe5a52[_0xd98e('0x3a')]=qs['sort'](_0xadc207[_0xd98e('0x30')][_0xd98e('0x3b')]);_0xe5a52[_0xd98e('0x3c')]=qs[_0xd98e('0x32')](_['pick'](_0xadc207[_0xd98e('0x30')],_0x2a056f['filters']),_0x250d6d);if(_0xadc207[_0xd98e('0x30')][_0xd98e('0x3d')]){_0xe5a52[_0xd98e('0x3c')]=_[_0xd98e('0x3e')](_0xe5a52[_0xd98e('0x3c')],{'$or':_['map'](_0x250d6d,function(_0x156827){if(_0x156827[_0xd98e('0x2e')]!=='VIRTUAL'){var _0x54a20a={};_0x54a20a[_0x156827[_0xd98e('0x28')]]={'$like':'%'+_0xadc207['query'][_0xd98e('0x3d')]+'%'};return _0x54a20a;}})});}_0xe5a52=_['merge']({},_0xe5a52,_0xadc207[_0xd98e('0x3f')]);var _0x5f4b91={'where':_0xe5a52['where']};return db['Automation'][_0xd98e('0x1f')](_0x5f4b91)[_0xd98e('0x25')](function(_0x13f513){_0x38ee5a[_0xd98e('0x1f')]=_0x13f513;if(_0xadc207[_0xd98e('0x30')][_0xd98e('0x40')]){_0xe5a52['include']=[{'all':!![]}];}return db['Automation']['findAll'](_0xe5a52);})[_0xd98e('0x25')](function(_0x1c0da9){_0x38ee5a[_0xd98e('0x41')]=_0x1c0da9;return _0x38ee5a;})[_0xd98e('0x25')](respondWithFilteredResult(_0x103c89,_0xe5a52))['catch'](handleError(_0x103c89,null));};exports[_0xd98e('0x42')]=function(_0x4b0989,_0x321287){var _0x7969ed={'raw':![],'where':{'id':_0x4b0989[_0xd98e('0x43')]['id']}},_0x51380a={};_0x51380a[_0xd98e('0x34')]=_[_0xd98e('0x31')](db[_0xd98e('0x2c')][_0xd98e('0x44')]);_0x51380a[_0xd98e('0x30')]=_[_0xd98e('0x31')](_0x4b0989[_0xd98e('0x30')]);_0x51380a[_0xd98e('0x32')]=_[_0xd98e('0x33')](_0x51380a[_0xd98e('0x34')],_0x51380a[_0xd98e('0x30')]);_0x7969ed[_0xd98e('0x35')]=_[_0xd98e('0x33')](_0x51380a[_0xd98e('0x34')],qs['fields'](_0x4b0989['query']['fields']));_0x7969ed[_0xd98e('0x35')]=_0x7969ed[_0xd98e('0x35')]['length']?_0x7969ed[_0xd98e('0x35')]:_0x51380a[_0xd98e('0x34')];if(_0x4b0989['query'][_0xd98e('0x40')]){_0x7969ed[_0xd98e('0x45')]=[{'all':!![]}];}_0x7969ed=_['merge']({},_0x7969ed,_0x4b0989['options']);return db['Automation']['find'](_0x7969ed)[_0xd98e('0x25')](handleEntityNotFound(_0x321287,null))[_0xd98e('0x25')](respondWithResult(_0x321287,null))['catch'](handleError(_0x321287,null));};exports[_0xd98e('0x46')]=function(_0x1625d3,_0x20a282){return db[_0xd98e('0x2c')]['create'](_0x1625d3[_0xd98e('0x47')],{})['then'](respondWithResult(_0x20a282,0xc9))[_0xd98e('0x48')](handleError(_0x20a282,null));};exports[_0xd98e('0x49')]=function(_0x6adb85,_0x346595){if(_0x6adb85['body']['id']){delete _0x6adb85[_0xd98e('0x47')]['id'];}return db['Automation']['find']({'where':{'id':_0x6adb85['params']['id']}})[_0xd98e('0x25')](handleEntityNotFound(_0x346595,null))[_0xd98e('0x25')](saveUpdates(_0x6adb85[_0xd98e('0x47')],null))[_0xd98e('0x25')](respondWithResult(_0x346595,null))['catch'](handleError(_0x346595,null));};exports[_0xd98e('0x26')]=function(_0x7a3cfe,_0x5bf270){return db['Automation'][_0xd98e('0x4a')]({'where':{'id':_0x7a3cfe[_0xd98e('0x43')]['id']}})[_0xd98e('0x25')](handleEntityNotFound(_0x5bf270,null))[_0xd98e('0x25')](removeEntity(_0x5bf270,null))[_0xd98e('0x48')](handleError(_0x5bf270,null));};exports['addConditions']=function(_0x3467c7,_0x3cc191,_0xf3d19c){return db[_0xd98e('0x4b')]['find']({'where':{'id':_0x3467c7['params']['id']}})[_0xd98e('0x25')](handleEntityNotFound(_0x3cc191,null))[_0xd98e('0x25')](function(_0x217ece){if(_0x217ece){return _0x217ece[_0xd98e('0x4c')](_0x3467c7[_0xd98e('0x47')][_0xd98e('0x4d')],_[_0xd98e('0x4e')](_0x3467c7[_0xd98e('0x47')],[_0xd98e('0x4d'),'id'])||{});}})[_0xd98e('0x25')](respondWithResult(_0x3cc191,null))[_0xd98e('0x48')](handleError(_0x3cc191,null));};exports[_0xd98e('0x4f')]=function(_0xb03ada,_0x1ddfa2,_0x590ea6){var _0x157f44={};var _0x4107c5={};var _0x309864;var _0x1835f1;return db[_0xd98e('0x2c')]['findOne']({'where':{'id':_0xb03ada['params']['id']}})[_0xd98e('0x25')](handleEntityNotFound(_0x1ddfa2,null))[_0xd98e('0x25')](function(_0x292558){if(_0x292558){_0x309864=_0x292558;_0x4107c5[_0xd98e('0x34')]=_[_0xd98e('0x31')](db[_0xd98e('0x4b')][_0xd98e('0x44')]);_0x4107c5[_0xd98e('0x30')]=_[_0xd98e('0x31')](_0xb03ada['query']);_0x4107c5[_0xd98e('0x32')]=_[_0xd98e('0x33')](_0x4107c5[_0xd98e('0x34')],_0x4107c5[_0xd98e('0x30')]);_0x157f44[_0xd98e('0x35')]=_['intersection'](_0x4107c5[_0xd98e('0x34')],qs['fields'](_0xb03ada[_0xd98e('0x30')]['fields']));_0x157f44[_0xd98e('0x35')]=_0x157f44[_0xd98e('0x35')][_0xd98e('0x37')]?_0x157f44['attributes']:_0x4107c5['model'];_0x157f44[_0xd98e('0x3a')]=qs[_0xd98e('0x3b')](_0xb03ada[_0xd98e('0x30')][_0xd98e('0x3b')]);_0x157f44[_0xd98e('0x3c')]=qs[_0xd98e('0x32')](_[_0xd98e('0x50')](_0xb03ada['query'],_0x4107c5['filters']));if(_0xb03ada[_0xd98e('0x30')][_0xd98e('0x3d')]){_0x157f44[_0xd98e('0x3c')]=_[_0xd98e('0x3e')](_0x157f44[_0xd98e('0x3c')],{'$or':_[_0xd98e('0x2b')](_0x157f44[_0xd98e('0x35')],function(_0x16133b){var _0x33f7e0={};_0x33f7e0[_0x16133b]={'$like':'%'+_0xb03ada[_0xd98e('0x30')]['filter']+'%'};return _0x33f7e0;})});}_0x157f44=_[_0xd98e('0x3e')]({},_0x157f44,_0xb03ada[_0xd98e('0x3f')]);return _0x309864[_0xd98e('0x4f')](_0x157f44);}})[_0xd98e('0x25')](function(_0x35171f){if(_0x35171f){_0x1835f1=_0x35171f['length'];if(!_0xb03ada[_0xd98e('0x30')][_0xd98e('0x38')]('nolimit')){_0x157f44['limit']=qs[_0xd98e('0x39')](_0xb03ada[_0xd98e('0x30')][_0xd98e('0x39')]);_0x157f44['offset']=qs['offset'](_0xb03ada[_0xd98e('0x30')]['offset']);}return _0x309864[_0xd98e('0x4f')](_0x157f44);}})[_0xd98e('0x25')](function(_0x5aa8b9){if(_0x5aa8b9){return _0x5aa8b9?{'count':_0x1835f1,'rows':_0x5aa8b9}:null;}})['then'](respondWithResult(_0x1ddfa2,null))[_0xd98e('0x48')](handleError(_0x1ddfa2,null));};exports[_0xd98e('0x51')]=function(_0x878ebd,_0x9d8718,_0x2a5d7e){return db['Action'][_0xd98e('0x4a')]({'where':{'id':_0x878ebd[_0xd98e('0x43')]['id']}})[_0xd98e('0x25')](handleEntityNotFound(_0x9d8718,null))[_0xd98e('0x25')](function(_0x5c349d){if(_0x5c349d){return _0x5c349d[_0xd98e('0x51')](_0x878ebd[_0xd98e('0x47')]['ids'],_[_0xd98e('0x4e')](_0x878ebd[_0xd98e('0x47')],[_0xd98e('0x4d'),'id'])||{});}})[_0xd98e('0x25')](respondWithResult(_0x9d8718,null))['catch'](handleError(_0x9d8718,null));};exports[_0xd98e('0x52')]=function(_0x48930b,_0x1aa72f,_0x280bbb){var _0x5acf86={};var _0x8e80df={};var _0x342f5e;var _0x574f2d;return db[_0xd98e('0x2c')][_0xd98e('0x53')]({'where':{'id':_0x48930b['params']['id']}})[_0xd98e('0x25')](handleEntityNotFound(_0x1aa72f,null))[_0xd98e('0x25')](function(_0x47fe5c){if(_0x47fe5c){_0x342f5e=_0x47fe5c;_0x8e80df[_0xd98e('0x34')]=_[_0xd98e('0x31')](db[_0xd98e('0x54')][_0xd98e('0x44')]);_0x8e80df['query']=_[_0xd98e('0x31')](_0x48930b[_0xd98e('0x30')]);_0x8e80df[_0xd98e('0x32')]=_['intersection'](_0x8e80df['model'],_0x8e80df[_0xd98e('0x30')]);_0x5acf86[_0xd98e('0x35')]=_[_0xd98e('0x33')](_0x8e80df[_0xd98e('0x34')],qs[_0xd98e('0x36')](_0x48930b['query'][_0xd98e('0x36')]));_0x5acf86[_0xd98e('0x35')]=_0x5acf86['attributes'][_0xd98e('0x37')]?_0x5acf86['attributes']:_0x8e80df[_0xd98e('0x34')];_0x5acf86[_0xd98e('0x3a')]=qs['sort'](_0x48930b[_0xd98e('0x30')][_0xd98e('0x3b')]);_0x5acf86[_0xd98e('0x3c')]=qs[_0xd98e('0x32')](_[_0xd98e('0x50')](_0x48930b[_0xd98e('0x30')],_0x8e80df[_0xd98e('0x32')]));if(_0x48930b[_0xd98e('0x30')][_0xd98e('0x3d')]){_0x5acf86['where']=_[_0xd98e('0x3e')](_0x5acf86[_0xd98e('0x3c')],{'$or':_[_0xd98e('0x2b')](_0x5acf86[_0xd98e('0x35')],function(_0x47d20a){var _0x1731dc={};_0x1731dc[_0x47d20a]={'$like':'%'+_0x48930b[_0xd98e('0x30')][_0xd98e('0x3d')]+'%'};return _0x1731dc;})});}_0x5acf86=_[_0xd98e('0x3e')]({},_0x5acf86,_0x48930b[_0xd98e('0x3f')]);return _0x342f5e['getActions'](_0x5acf86);}})[_0xd98e('0x25')](function(_0x5b4765){if(_0x5b4765){_0x574f2d=_0x5b4765[_0xd98e('0x37')];if(!_0x48930b['query'][_0xd98e('0x38')](_0xd98e('0x55'))){_0x5acf86[_0xd98e('0x39')]=qs[_0xd98e('0x39')](_0x48930b[_0xd98e('0x30')]['limit']);_0x5acf86['offset']=qs['offset'](_0x48930b[_0xd98e('0x30')][_0xd98e('0x1d')]);}return _0x342f5e[_0xd98e('0x52')](_0x5acf86);}})[_0xd98e('0x25')](function(_0x93ab9){if(_0x93ab9){return _0x93ab9?{'count':_0x574f2d,'rows':_0x93ab9}:null;}})[_0xd98e('0x25')](respondWithResult(_0x1aa72f,null))[_0xd98e('0x48')](handleError(_0x1aa72f,null));}; \ No newline at end of file +var _0x46fc=['length','includeAll','find','create','update','body','Condition','ids','omit','findOne','getConditions','nolimit','addActions','getActions','Action','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','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','apply','save','destroy','then','stack','name','send','index','map','Automation','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params'];(function(_0x4c0d78,_0x5860c5){var _0x2410e8=function(_0x28fbb8){while(--_0x28fbb8){_0x4c0d78['push'](_0x4c0d78['shift']());}};_0x2410e8(++_0x5860c5);}(_0x46fc,0x1c2));var _0xc46f=function(_0x416a38,_0x5004e0){_0x416a38=_0x416a38-0x0;var _0xec6c28=_0x46fc[_0x416a38];return _0xec6c28;};'use strict';var emlformat=require(_0xc46f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc46f('0x1'));var jsonpatch=require(_0xc46f('0x2'));var rp=require(_0xc46f('0x3'));var moment=require(_0xc46f('0x4'));var BPromise=require(_0xc46f('0x5'));var Mustache=require('mustache');var util=require(_0xc46f('0x6'));var path=require(_0xc46f('0x7'));var sox=require(_0xc46f('0x8'));var csv=require('to-csv');var ejs=require(_0xc46f('0x9'));var fs=require('fs');var fs_extra=require(_0xc46f('0xa'));var _=require(_0xc46f('0xb'));var squel=require(_0xc46f('0xc'));var crypto=require(_0xc46f('0xd'));var jsforce=require(_0xc46f('0xe'));var deskjs=require(_0xc46f('0xf'));var toCsv=require(_0xc46f('0x10'));var querystring=require(_0xc46f('0x11'));var Papa=require('papaparse');var Redis=require(_0xc46f('0x12'));var authService=require(_0xc46f('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xc46f('0x14'));var hardwareService=require(_0xc46f('0x15'));var logger=require(_0xc46f('0x16'))(_0xc46f('0x17'));var utils=require(_0xc46f('0x18'));var config=require(_0xc46f('0x19'));var licenseUtil=require(_0xc46f('0x1a'));var db=require(_0xc46f('0x1b'))['db'];function respondWithStatusCode(_0x2fb6be,_0x3c4cd7){_0x3c4cd7=_0x3c4cd7||0xcc;return function(_0x265bef){if(_0x265bef){return _0x2fb6be[_0xc46f('0x1c')](_0x3c4cd7);}return _0x2fb6be[_0xc46f('0x1d')](_0x3c4cd7)[_0xc46f('0x1e')]();};}function respondWithResult(_0x4f6543,_0x3c34c7){_0x3c34c7=_0x3c34c7||0xc8;return function(_0x8e4387){if(_0x8e4387){return _0x4f6543[_0xc46f('0x1d')](_0x3c34c7)[_0xc46f('0x1f')](_0x8e4387);}};}function respondWithFilteredResult(_0xf7615c,_0x53e7fc){return function(_0x5e0a9d){if(_0x5e0a9d){var _0x318b15=typeof _0x53e7fc[_0xc46f('0x20')]===_0xc46f('0x21')&&typeof _0x53e7fc[_0xc46f('0x22')]===_0xc46f('0x21');var _0x443495=_0x5e0a9d[_0xc46f('0x23')];var _0x586034=_0x318b15?0x0:_0x53e7fc[_0xc46f('0x20')];var _0x403592=_0x318b15?_0x5e0a9d[_0xc46f('0x23')]:_0x53e7fc['offset']+_0x53e7fc[_0xc46f('0x22')];var _0x334b7e;if(_0x403592>=_0x443495){_0x403592=_0x443495;_0x334b7e=0xc8;}else{_0x334b7e=0xce;}_0xf7615c[_0xc46f('0x1d')](_0x334b7e);return _0xf7615c['set']('Content-Range',_0x586034+'-'+_0x403592+'/'+_0x443495)[_0xc46f('0x1f')](_0x5e0a9d);}return null;};}function patchUpdates(_0x2fd5a0){return function(_0x694403){try{jsonpatch[_0xc46f('0x24')](_0x694403,_0x2fd5a0,!![]);}catch(_0x99ff22){return BPromise['reject'](_0x99ff22);}return _0x694403[_0xc46f('0x25')]();};}function saveUpdates(_0x15d462,_0x443034){return function(_0x154288){if(_0x154288){return _0x154288['update'](_0x15d462)['then'](function(_0x46ec8e){return _0x46ec8e;});}return null;};}function removeEntity(_0x160009,_0x2f8dc0){return function(_0x1bd6f0){if(_0x1bd6f0){return _0x1bd6f0[_0xc46f('0x26')]()[_0xc46f('0x27')](function(){_0x160009[_0xc46f('0x1d')](0xcc)[_0xc46f('0x1e')]();});}};}function handleEntityNotFound(_0x4e9df2,_0x557093){return function(_0x3c1961){if(!_0x3c1961){_0x4e9df2[_0xc46f('0x1c')](0x194);}return _0x3c1961;};}function handleError(_0x1b859f,_0x52ad7f){_0x52ad7f=_0x52ad7f||0x1f4;return function(_0x1ac116){logger['error'](_0x1ac116[_0xc46f('0x28')]);if(_0x1ac116[_0xc46f('0x29')]){delete _0x1ac116['name'];}_0x1b859f[_0xc46f('0x1d')](_0x52ad7f)[_0xc46f('0x2a')](_0x1ac116);};}exports[_0xc46f('0x2b')]=function(_0xaf9f65,_0x19b921){var _0x2888a5={},_0x383b8f={},_0x104cd5={'count':0x0,'rows':[]};var _0x37e3af=_[_0xc46f('0x2c')](db[_0xc46f('0x2d')][_0xc46f('0x2e')],function(_0x4b7071){return{'name':_0x4b7071[_0xc46f('0x2f')],'type':_0x4b7071[_0xc46f('0x30')][_0xc46f('0x31')]};});_0x383b8f['model']=_[_0xc46f('0x2c')](_0x37e3af,_0xc46f('0x29'));_0x383b8f['query']=_[_0xc46f('0x32')](_0xaf9f65[_0xc46f('0x33')]);_0x383b8f[_0xc46f('0x34')]=_[_0xc46f('0x35')](_0x383b8f[_0xc46f('0x36')],_0x383b8f[_0xc46f('0x33')]);_0x2888a5[_0xc46f('0x37')]=_[_0xc46f('0x35')](_0x383b8f[_0xc46f('0x36')],qs[_0xc46f('0x38')](_0xaf9f65[_0xc46f('0x33')][_0xc46f('0x38')]));_0x2888a5[_0xc46f('0x37')]=_0x2888a5[_0xc46f('0x37')]['length']?_0x2888a5[_0xc46f('0x37')]:_0x383b8f['model'];if(!_0xaf9f65['query'][_0xc46f('0x39')]('nolimit')){_0x2888a5[_0xc46f('0x22')]=qs[_0xc46f('0x22')](_0xaf9f65[_0xc46f('0x33')]['limit']);_0x2888a5[_0xc46f('0x20')]=qs[_0xc46f('0x20')](_0xaf9f65[_0xc46f('0x33')][_0xc46f('0x20')]);}_0x2888a5[_0xc46f('0x3a')]=qs[_0xc46f('0x3b')](_0xaf9f65[_0xc46f('0x33')][_0xc46f('0x3b')]);_0x2888a5[_0xc46f('0x3c')]=qs[_0xc46f('0x34')](_[_0xc46f('0x3d')](_0xaf9f65[_0xc46f('0x33')],_0x383b8f[_0xc46f('0x34')]),_0x37e3af);if(_0xaf9f65[_0xc46f('0x33')][_0xc46f('0x3e')]){_0x2888a5[_0xc46f('0x3c')]=_[_0xc46f('0x3f')](_0x2888a5[_0xc46f('0x3c')],{'$or':_['map'](_0x37e3af,function(_0x4bd2f5){if(_0x4bd2f5['type']!==_0xc46f('0x40')){var _0x317e08={};_0x317e08[_0x4bd2f5[_0xc46f('0x29')]]={'$like':'%'+_0xaf9f65[_0xc46f('0x33')][_0xc46f('0x3e')]+'%'};return _0x317e08;}})});}_0x2888a5=_[_0xc46f('0x3f')]({},_0x2888a5,_0xaf9f65[_0xc46f('0x41')]);var _0x4bfb83={'where':_0x2888a5[_0xc46f('0x3c')]};return db['Automation'][_0xc46f('0x23')](_0x4bfb83)[_0xc46f('0x27')](function(_0xc80523){_0x104cd5[_0xc46f('0x23')]=_0xc80523;if(_0xaf9f65[_0xc46f('0x33')]['includeAll']){_0x2888a5[_0xc46f('0x42')]=[{'all':!![]}];}return db[_0xc46f('0x2d')][_0xc46f('0x43')](_0x2888a5);})[_0xc46f('0x27')](function(_0x10a2f3){_0x104cd5[_0xc46f('0x44')]=_0x10a2f3;return _0x104cd5;})[_0xc46f('0x27')](respondWithFilteredResult(_0x19b921,_0x2888a5))[_0xc46f('0x45')](handleError(_0x19b921,null));};exports[_0xc46f('0x46')]=function(_0x4f307a,_0x1cfa85){var _0x284b02={'raw':![],'where':{'id':_0x4f307a[_0xc46f('0x47')]['id']}},_0x43a695={};_0x43a695['model']=_[_0xc46f('0x32')](db[_0xc46f('0x2d')][_0xc46f('0x2e')]);_0x43a695[_0xc46f('0x33')]=_['keys'](_0x4f307a[_0xc46f('0x33')]);_0x43a695[_0xc46f('0x34')]=_[_0xc46f('0x35')](_0x43a695[_0xc46f('0x36')],_0x43a695[_0xc46f('0x33')]);_0x284b02[_0xc46f('0x37')]=_['intersection'](_0x43a695[_0xc46f('0x36')],qs[_0xc46f('0x38')](_0x4f307a[_0xc46f('0x33')][_0xc46f('0x38')]));_0x284b02[_0xc46f('0x37')]=_0x284b02[_0xc46f('0x37')][_0xc46f('0x48')]?_0x284b02[_0xc46f('0x37')]:_0x43a695['model'];if(_0x4f307a['query'][_0xc46f('0x49')]){_0x284b02[_0xc46f('0x42')]=[{'all':!![]}];}_0x284b02=_[_0xc46f('0x3f')]({},_0x284b02,_0x4f307a['options']);return db[_0xc46f('0x2d')][_0xc46f('0x4a')](_0x284b02)['then'](handleEntityNotFound(_0x1cfa85,null))[_0xc46f('0x27')](respondWithResult(_0x1cfa85,null))[_0xc46f('0x45')](handleError(_0x1cfa85,null));};exports[_0xc46f('0x4b')]=function(_0x1262ad,_0x31a7ef){return db[_0xc46f('0x2d')][_0xc46f('0x4b')](_0x1262ad['body'],{})['then'](respondWithResult(_0x31a7ef,0xc9))['catch'](handleError(_0x31a7ef,null));};exports[_0xc46f('0x4c')]=function(_0x2ce979,_0x3b9db8){if(_0x2ce979[_0xc46f('0x4d')]['id']){delete _0x2ce979[_0xc46f('0x4d')]['id'];}return db[_0xc46f('0x2d')][_0xc46f('0x4a')]({'where':{'id':_0x2ce979[_0xc46f('0x47')]['id']}})['then'](handleEntityNotFound(_0x3b9db8,null))[_0xc46f('0x27')](saveUpdates(_0x2ce979[_0xc46f('0x4d')],null))['then'](respondWithResult(_0x3b9db8,null))[_0xc46f('0x45')](handleError(_0x3b9db8,null));};exports[_0xc46f('0x26')]=function(_0x534794,_0x7af268){return db['Automation'][_0xc46f('0x4a')]({'where':{'id':_0x534794[_0xc46f('0x47')]['id']}})[_0xc46f('0x27')](handleEntityNotFound(_0x7af268,null))[_0xc46f('0x27')](removeEntity(_0x7af268,null))['catch'](handleError(_0x7af268,null));};exports['addConditions']=function(_0x45aace,_0x21ca9b,_0x1708c8){return db[_0xc46f('0x4e')]['find']({'where':{'id':_0x45aace[_0xc46f('0x47')]['id']}})[_0xc46f('0x27')](handleEntityNotFound(_0x21ca9b,null))[_0xc46f('0x27')](function(_0xa50ac4){if(_0xa50ac4){return _0xa50ac4['addConditions'](_0x45aace['body'][_0xc46f('0x4f')],_[_0xc46f('0x50')](_0x45aace['body'],['ids','id'])||{});}})[_0xc46f('0x27')](respondWithResult(_0x21ca9b,null))['catch'](handleError(_0x21ca9b,null));};exports['getConditions']=function(_0x5b3c65,_0x2466d7,_0x2bc673){var _0x12b2fd={};var _0x973c={};var _0x36900b;var _0x199f66;return db['Automation'][_0xc46f('0x51')]({'where':{'id':_0x5b3c65[_0xc46f('0x47')]['id']}})['then'](handleEntityNotFound(_0x2466d7,null))[_0xc46f('0x27')](function(_0x171566){if(_0x171566){_0x36900b=_0x171566;_0x973c[_0xc46f('0x36')]=_['keys'](db[_0xc46f('0x4e')][_0xc46f('0x2e')]);_0x973c[_0xc46f('0x33')]=_[_0xc46f('0x32')](_0x5b3c65['query']);_0x973c[_0xc46f('0x34')]=_[_0xc46f('0x35')](_0x973c[_0xc46f('0x36')],_0x973c['query']);_0x12b2fd[_0xc46f('0x37')]=_[_0xc46f('0x35')](_0x973c[_0xc46f('0x36')],qs['fields'](_0x5b3c65[_0xc46f('0x33')][_0xc46f('0x38')]));_0x12b2fd[_0xc46f('0x37')]=_0x12b2fd[_0xc46f('0x37')][_0xc46f('0x48')]?_0x12b2fd[_0xc46f('0x37')]:_0x973c[_0xc46f('0x36')];_0x12b2fd[_0xc46f('0x3a')]=qs[_0xc46f('0x3b')](_0x5b3c65[_0xc46f('0x33')][_0xc46f('0x3b')]);_0x12b2fd['where']=qs[_0xc46f('0x34')](_[_0xc46f('0x3d')](_0x5b3c65[_0xc46f('0x33')],_0x973c[_0xc46f('0x34')]));if(_0x5b3c65['query'][_0xc46f('0x3e')]){_0x12b2fd[_0xc46f('0x3c')]=_[_0xc46f('0x3f')](_0x12b2fd[_0xc46f('0x3c')],{'$or':_['map'](_0x12b2fd['attributes'],function(_0x3ae59c){var _0x6bd041={};_0x6bd041[_0x3ae59c]={'$like':'%'+_0x5b3c65[_0xc46f('0x33')][_0xc46f('0x3e')]+'%'};return _0x6bd041;})});}_0x12b2fd=_[_0xc46f('0x3f')]({},_0x12b2fd,_0x5b3c65[_0xc46f('0x41')]);return _0x36900b[_0xc46f('0x52')](_0x12b2fd);}})[_0xc46f('0x27')](function(_0x1b82a1){if(_0x1b82a1){_0x199f66=_0x1b82a1[_0xc46f('0x48')];if(!_0x5b3c65['query']['hasOwnProperty'](_0xc46f('0x53'))){_0x12b2fd[_0xc46f('0x22')]=qs['limit'](_0x5b3c65['query']['limit']);_0x12b2fd[_0xc46f('0x20')]=qs[_0xc46f('0x20')](_0x5b3c65[_0xc46f('0x33')][_0xc46f('0x20')]);}return _0x36900b[_0xc46f('0x52')](_0x12b2fd);}})[_0xc46f('0x27')](function(_0x3ba845){if(_0x3ba845){return _0x3ba845?{'count':_0x199f66,'rows':_0x3ba845}:null;}})['then'](respondWithResult(_0x2466d7,null))[_0xc46f('0x45')](handleError(_0x2466d7,null));};exports[_0xc46f('0x54')]=function(_0x417390,_0x39f181,_0x4d48e3){return db['Action'][_0xc46f('0x4a')]({'where':{'id':_0x417390['params']['id']}})[_0xc46f('0x27')](handleEntityNotFound(_0x39f181,null))[_0xc46f('0x27')](function(_0x25d194){if(_0x25d194){return _0x25d194[_0xc46f('0x54')](_0x417390[_0xc46f('0x4d')][_0xc46f('0x4f')],_[_0xc46f('0x50')](_0x417390[_0xc46f('0x4d')],[_0xc46f('0x4f'),'id'])||{});}})[_0xc46f('0x27')](respondWithResult(_0x39f181,null))['catch'](handleError(_0x39f181,null));};exports[_0xc46f('0x55')]=function(_0x2f9e56,_0x3f5103,_0x745069){var _0x3a642f={};var _0x1ce8de={};var _0x50d5b5;var _0x91d57;return db['Automation']['findOne']({'where':{'id':_0x2f9e56['params']['id']}})[_0xc46f('0x27')](handleEntityNotFound(_0x3f5103,null))['then'](function(_0x16e82b){if(_0x16e82b){_0x50d5b5=_0x16e82b;_0x1ce8de[_0xc46f('0x36')]=_[_0xc46f('0x32')](db[_0xc46f('0x56')][_0xc46f('0x2e')]);_0x1ce8de[_0xc46f('0x33')]=_[_0xc46f('0x32')](_0x2f9e56[_0xc46f('0x33')]);_0x1ce8de[_0xc46f('0x34')]=_[_0xc46f('0x35')](_0x1ce8de[_0xc46f('0x36')],_0x1ce8de[_0xc46f('0x33')]);_0x3a642f['attributes']=_[_0xc46f('0x35')](_0x1ce8de[_0xc46f('0x36')],qs[_0xc46f('0x38')](_0x2f9e56[_0xc46f('0x33')][_0xc46f('0x38')]));_0x3a642f[_0xc46f('0x37')]=_0x3a642f[_0xc46f('0x37')][_0xc46f('0x48')]?_0x3a642f[_0xc46f('0x37')]:_0x1ce8de[_0xc46f('0x36')];_0x3a642f['order']=qs['sort'](_0x2f9e56[_0xc46f('0x33')][_0xc46f('0x3b')]);_0x3a642f['where']=qs[_0xc46f('0x34')](_[_0xc46f('0x3d')](_0x2f9e56[_0xc46f('0x33')],_0x1ce8de[_0xc46f('0x34')]));if(_0x2f9e56[_0xc46f('0x33')]['filter']){_0x3a642f[_0xc46f('0x3c')]=_[_0xc46f('0x3f')](_0x3a642f[_0xc46f('0x3c')],{'$or':_[_0xc46f('0x2c')](_0x3a642f[_0xc46f('0x37')],function(_0x4189b4){var _0x3e9ea7={};_0x3e9ea7[_0x4189b4]={'$like':'%'+_0x2f9e56[_0xc46f('0x33')]['filter']+'%'};return _0x3e9ea7;})});}_0x3a642f=_[_0xc46f('0x3f')]({},_0x3a642f,_0x2f9e56[_0xc46f('0x41')]);return _0x50d5b5[_0xc46f('0x55')](_0x3a642f);}})[_0xc46f('0x27')](function(_0x657702){if(_0x657702){_0x91d57=_0x657702['length'];if(!_0x2f9e56[_0xc46f('0x33')][_0xc46f('0x39')](_0xc46f('0x53'))){_0x3a642f[_0xc46f('0x22')]=qs[_0xc46f('0x22')](_0x2f9e56['query'][_0xc46f('0x22')]);_0x3a642f['offset']=qs[_0xc46f('0x20')](_0x2f9e56['query'][_0xc46f('0x20')]);}return _0x50d5b5['getActions'](_0x3a642f);}})[_0xc46f('0x27')](function(_0x37967b){if(_0x37967b){return _0x37967b?{'count':_0x91d57,'rows':_0x37967b}:null;}})[_0xc46f('0x27')](respondWithResult(_0x3f5103,null))[_0xc46f('0x45')](handleError(_0x3f5103,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index e430018..2e0a4b2 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 _0xa286=['tools_automations','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','exports','define','Automation'];(function(_0x5ba6f1,_0x3bcad1){var _0x2d5be8=function(_0x1fef87){while(--_0x1fef87){_0x5ba6f1['push'](_0x5ba6f1['shift']());}};_0x2d5be8(++_0x3bcad1);}(_0xa286,0x139));var _0x6a28=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xa286[_0x1d1779];return _0x2377e9;};'use strict';var _=require(_0x6a28('0x0'));var util=require(_0x6a28('0x1'));var logger=require(_0x6a28('0x2'))('api');var moment=require(_0x6a28('0x3'));var BPromise=require(_0x6a28('0x4'));var rp=require(_0x6a28('0x5'));var fs=require('fs');var path=require(_0x6a28('0x6'));var rimraf=require('rimraf');var config=require(_0x6a28('0x7'));var attributes=require('./automation.attributes');module[_0x6a28('0x8')]=function(_0x3400d4,_0x25a07a){return _0x3400d4[_0x6a28('0x9')](_0x6a28('0xa'),attributes,{'tableName':_0x6a28('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x48c3=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./automation.attributes','exports','define','Automation','tools_automations'];(function(_0x433ef6,_0xfb9389){var _0x568cfd=function(_0x2384e5){while(--_0x2384e5){_0x433ef6['push'](_0x433ef6['shift']());}};_0x568cfd(++_0xfb9389);}(_0x48c3,0x16c));var _0x348c=function(_0x68c0da,_0x6b33c2){_0x68c0da=_0x68c0da-0x0;var _0x439da2=_0x48c3[_0x68c0da];return _0x439da2;};'use strict';var _=require(_0x348c('0x0'));var util=require('util');var logger=require(_0x348c('0x1'))(_0x348c('0x2'));var moment=require(_0x348c('0x3'));var BPromise=require(_0x348c('0x4'));var rp=require(_0x348c('0x5'));var fs=require('fs');var path=require(_0x348c('0x6'));var rimraf=require(_0x348c('0x7'));var config=require('../../config/environment');var attributes=require(_0x348c('0x8'));module[_0x348c('0x9')]=function(_0x335f35,_0x54a3d5){return _0x335f35[_0x348c('0xa')](_0x348c('0xb'),attributes,{'tableName':_0x348c('0xc'),'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 d9c8e44..0cbe1a5 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 _0x77e6=['client','request','then','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','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x3b0609,_0x3515d0){var _0x3326c1=function(_0x216cbb){while(--_0x216cbb){_0x3b0609['push'](_0x3b0609['shift']());}};_0x3326c1(++_0x3515d0);}(_0x77e6,0x1a6));var _0x677e=function(_0x2a7f61,_0x4bf309){_0x2a7f61=_0x2a7f61-0x0;var _0x10387c=_0x77e6[_0x2a7f61];return _0x10387c;};'use strict';var _=require(_0x677e('0x0'));var util=require(_0x677e('0x1'));var moment=require(_0x677e('0x2'));var BPromise=require(_0x677e('0x3'));var rs=require(_0x677e('0x4'));var fs=require('fs');var Redis=require(_0x677e('0x5'));var db=require(_0x677e('0x6'))['db'];var utils=require(_0x677e('0x7'));var logger=require('../../config/logger')(_0x677e('0x8'));var config=require(_0x677e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x677e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x40d314,_0x4d1a57,_0x5a5dd3){return new BPromise(function(_0x2eb40c,_0x4c519f){return client[_0x677e('0xb')](_0x40d314,_0x5a5dd3)[_0x677e('0xc')](function(_0x552931){logger[_0x677e('0xd')]('Automation,\x20%s,\x20%s',_0x4d1a57,_0x677e('0xe'));logger[_0x677e('0xf')](_0x677e('0x10'),_0x4d1a57,_0x677e('0xe'),JSON[_0x677e('0x11')](_0x552931));if(_0x552931[_0x677e('0x12')]){if(_0x552931[_0x677e('0x12')][_0x677e('0x13')]===0x1f4){logger[_0x677e('0x12')](_0x677e('0x14'),_0x4d1a57,_0x552931[_0x677e('0x12')][_0x677e('0x15')]);return _0x4c519f(_0x552931[_0x677e('0x12')][_0x677e('0x15')]);}logger['error']('Automation,\x20%s,\x20%s',_0x4d1a57,_0x552931['error'][_0x677e('0x15')]);return _0x2eb40c(_0x552931[_0x677e('0x12')][_0x677e('0x15')]);}else{logger[_0x677e('0xd')](_0x677e('0x14'),_0x4d1a57,_0x677e('0xe'));_0x2eb40c(_0x552931[_0x677e('0x16')][_0x677e('0x15')]);}})[_0x677e('0x17')](function(_0x32d306){logger[_0x677e('0x12')](_0x677e('0x14'),_0x4d1a57,_0x32d306);_0x4c519f(_0x32d306);});});} \ No newline at end of file +var _0xd142=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Automation,\x20%s,\x20%s','request\x20sent','Automation,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','bluebird'];(function(_0x492d93,_0x4a6106){var _0x2e46a3=function(_0x2d91ca){while(--_0x2d91ca){_0x492d93['push'](_0x492d93['shift']());}};_0x2e46a3(++_0x4a6106);}(_0xd142,0x11a));var _0x2d14=function(_0x214890,_0x2562c0){_0x214890=_0x214890-0x0;var _0x760050=_0xd142[_0x214890];return _0x760050;};'use strict';var _=require(_0x2d14('0x0'));var util=require(_0x2d14('0x1'));var moment=require(_0x2d14('0x2'));var BPromise=require(_0x2d14('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2d14('0x4'))['db'];var utils=require(_0x2d14('0x5'));var logger=require(_0x2d14('0x6'))(_0x2d14('0x7'));var config=require(_0x2d14('0x8'));var jayson=require(_0x2d14('0x9'));var client=jayson[_0x2d14('0xa')][_0x2d14('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5eb081,_0x2104d6,_0xba6306){return new BPromise(function(_0x1b2d92,_0x4e5f73){return client[_0x2d14('0xc')](_0x5eb081,_0xba6306)[_0x2d14('0xd')](function(_0x581f76){logger[_0x2d14('0xe')](_0x2d14('0xf'),_0x2104d6,_0x2d14('0x10'));logger['debug'](_0x2d14('0x11'),_0x2104d6,_0x2d14('0x10'),JSON['stringify'](_0x581f76));if(_0x581f76['error']){if(_0x581f76[_0x2d14('0x12')][_0x2d14('0x13')]===0x1f4){logger[_0x2d14('0x12')]('Automation,\x20%s,\x20%s',_0x2104d6,_0x581f76[_0x2d14('0x12')][_0x2d14('0x14')]);return _0x4e5f73(_0x581f76[_0x2d14('0x12')][_0x2d14('0x14')]);}logger['error'](_0x2d14('0xf'),_0x2104d6,_0x581f76[_0x2d14('0x12')]['message']);return _0x1b2d92(_0x581f76[_0x2d14('0x12')][_0x2d14('0x14')]);}else{logger[_0x2d14('0xe')](_0x2d14('0xf'),_0x2104d6,_0x2d14('0x10'));_0x1b2d92(_0x581f76['result'][_0x2d14('0x14')]);}})[_0x2d14('0x15')](function(_0x3e12d3){logger[_0x2d14('0x12')](_0x2d14('0xf'),_0x2104d6,_0x3e12d3);_0x4e5f73(_0x3e12d3);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 2305c21..daf4b44 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 _0xd89f=['exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/conditions','getConditions','/:id/actions','getActions','create','addConditions','post','addActions','update','destroy'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0xd89f,0x191));var _0xfd89=function(_0x135363,_0x520e22){_0x135363=_0x135363-0x0;var _0x59c7a0=_0xd89f[_0x135363];return _0x59c7a0;};'use strict';var multer=require(_0xfd89('0x0'));var util=require(_0xfd89('0x1'));var path=require(_0xfd89('0x2'));var timeout=require('connect-timeout');var express=require(_0xfd89('0x3'));var router=express[_0xfd89('0x4')]();var fs_extra=require(_0xfd89('0x5'));var auth=require(_0xfd89('0x6'));var interaction=require(_0xfd89('0x7'));var config=require(_0xfd89('0x8'));var controller=require('./automation.controller');router[_0xfd89('0x9')]('/',auth[_0xfd89('0xa')](),controller[_0xfd89('0xb')]);router[_0xfd89('0x9')](_0xfd89('0xc'),auth[_0xfd89('0xa')](),controller[_0xfd89('0xd')]);router[_0xfd89('0x9')](_0xfd89('0xe'),auth[_0xfd89('0xa')](),controller[_0xfd89('0xf')]);router[_0xfd89('0x9')](_0xfd89('0x10'),auth[_0xfd89('0xa')](),controller[_0xfd89('0x11')]);router['post']('/',auth[_0xfd89('0xa')](),controller[_0xfd89('0x12')]);router['post']('/:id/conditions',auth[_0xfd89('0xa')](),controller[_0xfd89('0x13')]);router[_0xfd89('0x14')](_0xfd89('0x10'),auth['isAuthenticated'](),controller[_0xfd89('0x15')]);router['put'](_0xfd89('0xc'),auth[_0xfd89('0xa')](),controller[_0xfd89('0x16')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xfd89('0x17')]);module[_0xfd89('0x18')]=router; \ No newline at end of file +var _0xbd3b=['fs-extra','../../components/auth/service','../../config/environment','./automation.controller','isAuthenticated','get','/:id','/:id/conditions','getConditions','/:id/actions','getActions','post','create','addConditions','addActions','put','update','destroy','exports','multer','util','path','express','Router'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbd3b,0x1c3));var _0xbbd3=function(_0x28ee74,_0x289441){_0x28ee74=_0x28ee74-0x0;var _0x6cc80c=_0xbd3b[_0x28ee74];return _0x6cc80c;};'use strict';var multer=require(_0xbbd3('0x0'));var util=require(_0xbbd3('0x1'));var path=require(_0xbbd3('0x2'));var timeout=require('connect-timeout');var express=require(_0xbbd3('0x3'));var router=express[_0xbbd3('0x4')]();var fs_extra=require(_0xbbd3('0x5'));var auth=require(_0xbbd3('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xbbd3('0x7'));var controller=require(_0xbbd3('0x8'));router['get']('/',auth[_0xbbd3('0x9')](),controller['index']);router[_0xbbd3('0xa')](_0xbbd3('0xb'),auth[_0xbbd3('0x9')](),controller['show']);router[_0xbbd3('0xa')](_0xbbd3('0xc'),auth[_0xbbd3('0x9')](),controller[_0xbbd3('0xd')]);router['get'](_0xbbd3('0xe'),auth[_0xbbd3('0x9')](),controller[_0xbbd3('0xf')]);router[_0xbbd3('0x10')]('/',auth['isAuthenticated'](),controller[_0xbbd3('0x11')]);router['post']('/:id/conditions',auth[_0xbbd3('0x9')](),controller[_0xbbd3('0x12')]);router[_0xbbd3('0x10')](_0xbbd3('0xe'),auth[_0xbbd3('0x9')](),controller[_0xbbd3('0x13')]);router[_0xbbd3('0x14')](_0xbbd3('0xb'),auth[_0xbbd3('0x9')](),controller[_0xbbd3('0x15')]);router['delete']('/:id',auth[_0xbbd3('0x9')](),controller[_0xbbd3('0x16')]);module[_0xbbd3('0x17')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index e97b422..36e92a7 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 _0x6514=['always','never','BOOLEAN','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','exports','name','ENUM','ivr','STRING','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','INTEGER','#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,*,*,*'];(function(_0x2af157,_0x374798){var _0x3b4d49=function(_0x51faac){while(--_0x51faac){_0x2af157['push'](_0x2af157['shift']());}};_0x3b4d49(++_0x374798);}(_0x6514,0x1ab));var _0x4651=function(_0x6ceb8,_0x4f1030){_0x6ceb8=_0x6ceb8-0x0;var _0x44b460=_0x6514[_0x6ceb8];return _0x44b460;};'use strict';var Sequelize=require('sequelize');module[_0x4651('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x4651('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x4651('0x2')](_0x4651('0x3')),'allowNull':![],'defaultValue':_0x4651('0x3')},'description':{'type':Sequelize[_0x4651('0x4')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0x4651('0x5')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x4651('0x6')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x4651('0x4')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x4651('0x5')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4651('0x7')},'dialCongestionMaxRetry':{'type':Sequelize[_0x4651('0x8')](0x3)[_0x4651('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4651('0x9')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x4651('0x8')](0x5)[_0x4651('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4651('0xa')},'dialBusyMaxRetry':{'type':Sequelize[_0x4651('0x8')](0x3)[_0x4651('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4651('0xb')},'dialBusyRetryFrequency':{'type':Sequelize[_0x4651('0x8')](0x5)[_0x4651('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4651('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x4651('0x5')],'defaultValue':0x3,'comment':_0x4651('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x4651('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4651('0xe')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x4651('0x5')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x4651('0xf')},'dialTimezone':{'type':Sequelize[_0x4651('0x4')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x4651('0x4')],'defaultValue':_0x4651('0x10')},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x4651('0x11'),_0x4651('0x12'),'onlyIfOpen'),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x4651('0x13')],'defaultValue':0x0,'comment':_0x4651('0x14')},'dialAMDInitialSilence':{'type':Sequelize[_0x4651('0x8')](0x9)[_0x4651('0x5')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x4651('0x15')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x4651('0x5')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x4651('0x8')](0x9)[_0x4651('0x5')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x4651('0x16')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x4651('0x17')},'dialAMDMinWordLength':{'type':Sequelize[_0x4651('0x8')](0x9)[_0x4651('0x5')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x4651('0x18')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x4651('0x8')](0x9)[_0x4651('0x5')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x4651('0x19')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x4651('0x8')](0x9)[_0x4651('0x5')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x4651('0x1a')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x4651('0x8')](0x5)[_0x4651('0x5')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x4651('0x8')](0x9)[_0x4651('0x5')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize[_0x4651('0x2')](_0x4651('0x1b'),'ASC'),'defaultValue':_0x4651('0x1b')},'dialPrefix':{'type':Sequelize[_0x4651('0x4')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x4651('0x8')](0x3)[_0x4651('0x5')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x4651('0x1c')},'dialCutDigit':{'type':Sequelize[_0x4651('0x8')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x4651('0x8')](0x3)[_0x4651('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4651('0x1d')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x4651('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4651('0x1e')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x4651('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4651('0x1f')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x4651('0x8')](0x3)[_0x4651('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4651('0x20')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x4651('0x8')](0x5)[_0x4651('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0x4651('0x8')](0x3)[_0x4651('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4651('0x21')},'dialMachineRetryFrequency':{'type':Sequelize[_0x4651('0x8')](0x5)[_0x4651('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4651('0x22')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x4651('0x8')](0x3)[_0x4651('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4651('0x23')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x4651('0x8')](0x5)[_0x4651('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4651('0x24')}}; \ No newline at end of file +var _0xdb2d=['BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','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','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','name','ENUM','ivr'];(function(_0x4686cf,_0x103d2d){var _0x400108=function(_0x16e725){while(--_0x16e725){_0x4686cf['push'](_0x4686cf['shift']());}};_0x400108(++_0x103d2d);}(_0xdb2d,0x19c));var _0xddb2=function(_0xf8b370,_0x3fd468){_0xf8b370=_0xf8b370-0x0;var _0x2208be=_0xdb2d[_0xf8b370];return _0x2208be;};'use strict';var Sequelize=require(_0xddb2('0x0'));module[_0xddb2('0x1')]={'name':{'type':Sequelize[_0xddb2('0x2')],'unique':_0xddb2('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xddb2('0x4')]('ivr'),'allowNull':![],'defaultValue':_0xddb2('0x5')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0xddb2('0x6')],'defaultValue':0x0,'comment':_0xddb2('0x7')},'limitCalls':{'type':Sequelize[_0xddb2('0x8')](0x4)[_0xddb2('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xddb2('0xa')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xddb2('0x2')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0xddb2('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xddb2('0xb')},'dialCongestionMaxRetry':{'type':Sequelize[_0xddb2('0x8')](0x3)[_0xddb2('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0xddb2('0x8')](0x5)[_0xddb2('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xddb2('0xc')},'dialBusyMaxRetry':{'type':Sequelize[_0xddb2('0x8')](0x3)[_0xddb2('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xddb2('0xd')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xddb2('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xddb2('0xe')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xddb2('0x8')](0x3)[_0xddb2('0x9')],'defaultValue':0x3,'comment':_0xddb2('0xf')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xddb2('0x8')](0x5)[_0xddb2('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xddb2('0x10')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xddb2('0x9')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xddb2('0x11')},'dialTimezone':{'type':Sequelize[_0xddb2('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0xddb2('0x12')},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0xddb2('0x13'),_0xddb2('0x14'),_0xddb2('0x15')),'defaultValue':_0xddb2('0x13')},'dialAMDActive':{'type':Sequelize[_0xddb2('0x6')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0xddb2('0x8')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0xddb2('0x8')](0x9)[_0xddb2('0x9')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xddb2('0x16')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xddb2('0x8')](0x9)[_0xddb2('0x9')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xddb2('0x17')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xddb2('0x8')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0xddb2('0x8')](0x9)[_0xddb2('0x9')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xddb2('0x8')](0x9)[_0xddb2('0x9')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xddb2('0x18')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xddb2('0x19')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xddb2('0x8')](0x5)[_0xddb2('0x9')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xddb2('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0xddb2('0x1a'),_0xddb2('0x1b')),'defaultValue':_0xddb2('0x1a')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xddb2('0x8')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xddb2('0x1c')},'dialCutDigit':{'type':Sequelize[_0xddb2('0x8')](0x3)[_0xddb2('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xddb2('0x1d')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xddb2('0x8')](0x3)[_0xddb2('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xddb2('0x1e')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xddb2('0x8')](0x5)[_0xddb2('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xddb2('0x1f')},'dialDropMaxRetry':{'type':Sequelize[_0xddb2('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xddb2('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xddb2('0x20')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xddb2('0x8')](0x3)[_0xddb2('0x9')],'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':_0xddb2('0x21')},'dialMachineMaxRetry':{'type':Sequelize[_0xddb2('0x8')](0x3)[_0xddb2('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xddb2('0x22')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xddb2('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xddb2('0x23')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xddb2('0x8')](0x3)[_0xddb2('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xddb2('0x24')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xddb2('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xddb2('0x25')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 142837e..7b0d0c5 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 _0x5ba3=['cm_hopper_final','COALESCE(phone,\x27\x27)','CampaignId\x20=\x20?','onlyIfOpen','into','select','scheduledAt','cm_contacts','cm_hopper_additional_phones','cmHopperId','h.id','ci.item','ci.OrderBY','OrderBy','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','then','UserProfileResource','destroy','error','stack','name','send','index','Campaign','rawAttributes','fieldName','model','map','keys','filters','intersection','attributes','fields','nolimit','offset','order','sort','query','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','length','createdAt','omit','user','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','CmHopper','hasOwnProperty','getHopperHistories','findOne','CmHopperHistory','getHopperFinals','CmHopperFinal','CampaignId','CmHopperBlack','getLists','CmList','addLists','format','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','always','insert','cm_hopper','fromQuery','phone','ContactId','ListId','updatedAt','field','NOW()','CmListId','toString','from','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)'];(function(_0x203c16,_0x2103c3){var _0x166c59=function(_0x2a0113){while(--_0x2a0113){_0x203c16['push'](_0x203c16['shift']());}};_0x166c59(++_0x2103c3);}(_0x5ba3,0x140));var _0x35ba=function(_0x48e4df,_0x349364){_0x48e4df=_0x48e4df-0x0;var _0x751b1=_0x5ba3[_0x48e4df];return _0x751b1;};'use strict';var emlformat=require(_0x35ba('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x35ba('0x1'));var jsonpatch=require(_0x35ba('0x2'));var rp=require('request-promise');var moment=require(_0x35ba('0x3'));var BPromise=require(_0x35ba('0x4'));var Mustache=require(_0x35ba('0x5'));var util=require('util');var path=require(_0x35ba('0x6'));var sox=require(_0x35ba('0x7'));var csv=require(_0x35ba('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x35ba('0x9'));var squel=require(_0x35ba('0xa'));var crypto=require(_0x35ba('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x35ba('0xc'));var toCsv=require('to-csv');var querystring=require(_0x35ba('0xd'));var Papa=require(_0x35ba('0xe'));var Redis=require(_0x35ba('0xf'));var authService=require(_0x35ba('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x35ba('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x35ba('0x12'));var config=require(_0x35ba('0x13'));var licenseUtil=require(_0x35ba('0x14'));var db=require(_0x35ba('0x15'))['db'];function respondWithStatusCode(_0x3755c0,_0x203e6e){_0x203e6e=_0x203e6e||0xcc;return function(_0x23c253){if(_0x23c253){return _0x3755c0[_0x35ba('0x16')](_0x203e6e);}return _0x3755c0['status'](_0x203e6e)[_0x35ba('0x17')]();};}function respondWithResult(_0x169a24,_0x3ad4cc){_0x3ad4cc=_0x3ad4cc||0xc8;return function(_0x249caf){if(_0x249caf){return _0x169a24['status'](_0x3ad4cc)[_0x35ba('0x18')](_0x249caf);}};}function respondWithFilteredResult(_0x58b608,_0x50bf46){return function(_0x2372f7){if(_0x2372f7){var _0x71a8b=typeof _0x50bf46['offset']===_0x35ba('0x19')&&typeof _0x50bf46[_0x35ba('0x1a')]===_0x35ba('0x19');var _0x32b9e4=_0x2372f7[_0x35ba('0x1b')];var _0x374f91=_0x71a8b?0x0:_0x50bf46['offset'];var _0x423666=_0x71a8b?_0x2372f7[_0x35ba('0x1b')]:_0x50bf46['offset']+_0x50bf46[_0x35ba('0x1a')];var _0x1d73a2;if(_0x423666>=_0x32b9e4){_0x423666=_0x32b9e4;_0x1d73a2=0xc8;}else{_0x1d73a2=0xce;}_0x58b608[_0x35ba('0x1c')](_0x1d73a2);return _0x58b608[_0x35ba('0x1d')](_0x35ba('0x1e'),_0x374f91+'-'+_0x423666+'/'+_0x32b9e4)[_0x35ba('0x18')](_0x2372f7);}return null;};}function patchUpdates(_0x3f5e92){return function(_0x430522){try{jsonpatch[_0x35ba('0x1f')](_0x430522,_0x3f5e92,!![]);}catch(_0x205889){return BPromise[_0x35ba('0x20')](_0x205889);}return _0x430522[_0x35ba('0x21')]();};}function saveUpdates(_0x4e4c09,_0x2d3b2b){return function(_0xba9dbc){if(_0xba9dbc){return _0xba9dbc[_0x35ba('0x22')](_0x4e4c09)[_0x35ba('0x23')](function(_0x29a25f){return _0x29a25f;});}return null;};}function removeEntity(_0x1a638a,_0xa9080b){return function(_0x439f43){if(_0x439f43){return _0x439f43['destroy']()[_0x35ba('0x23')](function(){var _0x53fd3d=_0x439f43['get']({'plain':!![]});var _0x1cffd9='IvrCampaigns';return db[_0x35ba('0x24')][_0x35ba('0x25')]({'where':{'type':_0x1cffd9,'resourceId':_0x53fd3d['id']}})[_0x35ba('0x23')](function(){return _0x439f43;});})[_0x35ba('0x23')](function(){_0x1a638a[_0x35ba('0x1c')](0xcc)[_0x35ba('0x17')]();});}};}function handleEntityNotFound(_0x246198,_0x25fc3b){return function(_0x13b8fb){if(!_0x13b8fb){_0x246198[_0x35ba('0x16')](0x194);}return _0x13b8fb;};}function handleError(_0x40f2fc,_0x1d3d7f){_0x1d3d7f=_0x1d3d7f||0x1f4;return function(_0x38112f){logger[_0x35ba('0x26')](_0x38112f[_0x35ba('0x27')]);if(_0x38112f[_0x35ba('0x28')]){delete _0x38112f['name'];}_0x40f2fc[_0x35ba('0x1c')](_0x1d3d7f)[_0x35ba('0x29')](_0x38112f);};}exports[_0x35ba('0x2a')]=function(_0x2185dd,_0xe022f2){var _0x1eceef={},_0xe130c5={},_0x246981={'count':0x0,'rows':[]};var _0x1cb674=_['map'](db[_0x35ba('0x2b')][_0x35ba('0x2c')],function(_0x1c2b6e){return{'name':_0x1c2b6e[_0x35ba('0x2d')],'type':_0x1c2b6e['type']['key']};});_0xe130c5[_0x35ba('0x2e')]=_[_0x35ba('0x2f')](_0x1cb674,_0x35ba('0x28'));_0xe130c5['query']=_[_0x35ba('0x30')](_0x2185dd['query']);_0xe130c5[_0x35ba('0x31')]=_[_0x35ba('0x32')](_0xe130c5['model'],_0xe130c5['query']);_0x1eceef[_0x35ba('0x33')]=_[_0x35ba('0x32')](_0xe130c5[_0x35ba('0x2e')],qs[_0x35ba('0x34')](_0x2185dd['query'][_0x35ba('0x34')]));_0x1eceef[_0x35ba('0x33')]=_0x1eceef[_0x35ba('0x33')]['length']?_0x1eceef[_0x35ba('0x33')]:_0xe130c5[_0x35ba('0x2e')];if(!_0x2185dd['query']['hasOwnProperty'](_0x35ba('0x35'))){_0x1eceef[_0x35ba('0x1a')]=qs['limit'](_0x2185dd['query']['limit']);_0x1eceef[_0x35ba('0x36')]=qs['offset'](_0x2185dd['query'][_0x35ba('0x36')]);}_0x1eceef[_0x35ba('0x37')]=qs[_0x35ba('0x38')](_0x2185dd[_0x35ba('0x39')][_0x35ba('0x38')]);_0x1eceef[_0x35ba('0x3a')]=qs[_0x35ba('0x31')](_[_0x35ba('0x3b')](_0x2185dd[_0x35ba('0x39')],_0xe130c5[_0x35ba('0x31')]),_0x1cb674);if(_0x2185dd[_0x35ba('0x39')][_0x35ba('0x3c')]){_0x1eceef['where']=_[_0x35ba('0x3d')](_0x1eceef['where'],{'$or':_[_0x35ba('0x2f')](_0x1cb674,function(_0x3267a1){if(_0x3267a1['type']!=='VIRTUAL'){var _0x172e0a={};_0x172e0a[_0x3267a1['name']]={'$like':'%'+_0x2185dd['query']['filter']+'%'};return _0x172e0a;}})});}_0x1eceef=_[_0x35ba('0x3d')]({},_0x1eceef,_0x2185dd[_0x35ba('0x3e')]);var _0x1019c7={'where':_0x1eceef['where']};return db[_0x35ba('0x2b')]['count'](_0x1019c7)[_0x35ba('0x23')](function(_0x58481a){_0x246981[_0x35ba('0x1b')]=_0x58481a;if(_0x2185dd[_0x35ba('0x39')][_0x35ba('0x3f')]){_0x1eceef[_0x35ba('0x40')]=[{'all':!![]}];}return db['Campaign'][_0x35ba('0x41')](_0x1eceef);})[_0x35ba('0x23')](function(_0x51c9e1){_0x246981[_0x35ba('0x42')]=_0x51c9e1;return _0x246981;})[_0x35ba('0x23')](respondWithFilteredResult(_0xe022f2,_0x1eceef))[_0x35ba('0x43')](handleError(_0xe022f2,null));};exports[_0x35ba('0x44')]=function(_0x170e5c,_0x16f559){var _0x433077={'raw':![],'where':{'id':_0x170e5c[_0x35ba('0x45')]['id']}},_0xe86741={};_0xe86741[_0x35ba('0x2e')]=_['keys'](db[_0x35ba('0x2b')][_0x35ba('0x2c')]);_0xe86741[_0x35ba('0x39')]=_[_0x35ba('0x30')](_0x170e5c[_0x35ba('0x39')]);_0xe86741[_0x35ba('0x31')]=_[_0x35ba('0x32')](_0xe86741[_0x35ba('0x2e')],_0xe86741[_0x35ba('0x39')]);_0x433077[_0x35ba('0x33')]=_[_0x35ba('0x32')](_0xe86741['model'],qs[_0x35ba('0x34')](_0x170e5c[_0x35ba('0x39')]['fields']));_0x433077[_0x35ba('0x33')]=_0x433077[_0x35ba('0x33')]['length']?_0x433077[_0x35ba('0x33')]:_0xe86741[_0x35ba('0x2e')];if(_0x170e5c[_0x35ba('0x39')][_0x35ba('0x3f')]){_0x433077[_0x35ba('0x40')]=[{'all':!![]}];}_0x433077=_[_0x35ba('0x3d')]({},_0x433077,_0x170e5c[_0x35ba('0x3e')]);return db[_0x35ba('0x2b')][_0x35ba('0x46')](_0x433077)['then'](handleEntityNotFound(_0x16f559,null))['then'](respondWithResult(_0x16f559,null))[_0x35ba('0x43')](handleError(_0x16f559,null));};exports[_0x35ba('0x47')]=function(_0xe2dd75,_0x55bc33){return db[_0x35ba('0x2b')]['create'](_0xe2dd75[_0x35ba('0x48')],{})[_0x35ba('0x23')](function(_0x4791b0){var _0x4075ac=_0xe2dd75['user'][_0x35ba('0x49')]({'plain':!![]});if(!_0x4075ac)throw new Error(_0x35ba('0x4a'));if(_0x4075ac[_0x35ba('0x4b')]==='user'){var _0x760f60=_0x4791b0[_0x35ba('0x49')]({'plain':!![]});var _0x2f7877='IvrCampaigns';return db['UserProfileSection']['find']({'where':{'name':_0x2f7877,'userProfileId':_0x4075ac['userProfileId']},'raw':!![]})[_0x35ba('0x23')](function(_0x12f0c5){if(_0x12f0c5&&_0x12f0c5[_0x35ba('0x4c')]===0x0){return db[_0x35ba('0x24')][_0x35ba('0x47')]({'name':_0x760f60[_0x35ba('0x28')],'resourceId':_0x760f60['id'],'type':_0x12f0c5[_0x35ba('0x28')],'sectionId':_0x12f0c5['id']},{})[_0x35ba('0x23')](function(){return _0x4791b0;});}else{return _0x4791b0;}})[_0x35ba('0x43')](function(_0x18bb1f){logger[_0x35ba('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x18bb1f);throw _0x18bb1f;});}return _0x4791b0;})['then'](respondWithResult(_0x55bc33,0xc9))[_0x35ba('0x43')](handleError(_0x55bc33,null));};exports['clone']=function(_0xdb9d74,_0x4b8bf7){var _0x55f904={'where':{'id':_0xdb9d74['params']['id']}},_0x15744c={};_0x15744c[_0x35ba('0x2e')]=_[_0x35ba('0x30')](db['Campaign'][_0x35ba('0x2c')]);_0x55f904[_0x35ba('0x33')]=_[_0x35ba('0x32')](_0x15744c[_0x35ba('0x2e')],qs['fields'](_0xdb9d74[_0x35ba('0x39')]['fields']));_0x55f904[_0x35ba('0x33')]=_0x55f904[_0x35ba('0x33')][_0x35ba('0x4d')]?_0x55f904[_0x35ba('0x33')]:_0x15744c[_0x35ba('0x2e')];if(_0xdb9d74['query'][_0x35ba('0x3f')]){_0x55f904[_0x35ba('0x40')]=[{'all':!![]}];}_0x55f904=_['merge']({},_0x55f904,_0xdb9d74[_0x35ba('0x3e')]);return db['Campaign']['find'](_0x55f904)[_0x35ba('0x23')](handleEntityNotFound(_0x4b8bf7,null))['then'](function(_0x2766a9){if(_0x2766a9){var _0x441324=_0x2766a9[_0x35ba('0x49')]({'plain':!![]});_0x441324=qs['omit'](_0x441324,['id',_0x35ba('0x4e'),'updatedAt']);_0xdb9d74[_0x35ba('0x48')]=_[_0x35ba('0x4f')](_0xdb9d74[_0x35ba('0x48')],['id',_0x35ba('0x4e'),'updatedAt']);return db['Campaign']['create'](_['merge'](_0x441324,_0xdb9d74[_0x35ba('0x48')]),{'include':_0xdb9d74['query'][_0x35ba('0x3f')]?[{'all':!![]}]:undefined})[_0x35ba('0x23')](function(_0x2979a8){var _0x16ee0f=_0xdb9d74[_0x35ba('0x50')][_0x35ba('0x49')]({'plain':!![]});if(!_0x16ee0f)throw new Error(_0x35ba('0x4a'));if(_0x16ee0f['role']===_0x35ba('0x50')){var _0x20d08c=_0x2979a8[_0x35ba('0x49')]({'plain':!![]});var _0x234f78='IvrCampaigns';return db['UserProfileSection'][_0x35ba('0x46')]({'where':{'name':_0x234f78,'userProfileId':_0x16ee0f['userProfileId']},'raw':!![]})[_0x35ba('0x23')](function(_0x106510){if(_0x106510&&_0x106510['autoAssociation']===0x0){return db[_0x35ba('0x24')][_0x35ba('0x47')]({'name':_0x20d08c[_0x35ba('0x28')],'resourceId':_0x20d08c['id'],'type':_0x106510[_0x35ba('0x28')],'sectionId':_0x106510['id']},{})[_0x35ba('0x23')](function(){return _0x2979a8;});}else{return _0x2979a8;}})['catch'](function(_0x184b72){logger['error'](_0x35ba('0x51'),_0x184b72);throw _0x184b72;});}return _0x2979a8;});}})[_0x35ba('0x23')](respondWithResult(_0x4b8bf7,0xc9))['catch'](handleError(_0x4b8bf7,null));};exports['update']=function(_0x1a856a,_0x53d9c7){if(_0x1a856a[_0x35ba('0x48')]['id']){delete _0x1a856a[_0x35ba('0x48')]['id'];}return db[_0x35ba('0x2b')]['find']({'where':{'id':_0x1a856a['params']['id']}})[_0x35ba('0x23')](handleEntityNotFound(_0x53d9c7,null))[_0x35ba('0x23')](saveUpdates(_0x1a856a['body'],null))[_0x35ba('0x23')](respondWithResult(_0x53d9c7,null))[_0x35ba('0x43')](handleError(_0x53d9c7,null));};exports[_0x35ba('0x25')]=function(_0x2b001b,_0x1ad5e6){return db[_0x35ba('0x2b')][_0x35ba('0x46')]({'where':{'id':_0x2b001b[_0x35ba('0x45')]['id']}})[_0x35ba('0x23')](handleEntityNotFound(_0x1ad5e6,null))['then'](removeEntity(_0x1ad5e6,null))[_0x35ba('0x43')](handleError(_0x1ad5e6,null));};exports[_0x35ba('0x52')]=function(_0x62ac22,_0x5eb454,_0x4b8994){var _0x17e870={'raw':!![],'where':{}};var _0x327918={};var _0x4de3d6={'count':0x0,'rows':[]};return db[_0x35ba('0x2b')]['findOne']({'where':{'id':_0x62ac22[_0x35ba('0x45')]['id']}})[_0x35ba('0x23')](handleEntityNotFound(_0x5eb454,null))[_0x35ba('0x23')](function(_0x5d3b60){if(_0x5d3b60){_0x327918[_0x35ba('0x2e')]=_[_0x35ba('0x30')](db[_0x35ba('0x53')][_0x35ba('0x2c')]);_0x327918['query']=_[_0x35ba('0x30')](_0x62ac22['query']);_0x327918[_0x35ba('0x31')]=_[_0x35ba('0x32')](_0x327918['model'],_0x327918['query']);_0x17e870[_0x35ba('0x33')]=_['intersection'](_0x327918[_0x35ba('0x2e')],qs[_0x35ba('0x34')](_0x62ac22['query'][_0x35ba('0x34')]));_0x17e870['attributes']=_0x17e870[_0x35ba('0x33')][_0x35ba('0x4d')]?_0x17e870[_0x35ba('0x33')]:_0x327918[_0x35ba('0x2e')];if(!_0x62ac22[_0x35ba('0x39')][_0x35ba('0x54')](_0x35ba('0x35'))){_0x17e870[_0x35ba('0x1a')]=qs['limit'](_0x62ac22[_0x35ba('0x39')][_0x35ba('0x1a')]);_0x17e870[_0x35ba('0x36')]=qs[_0x35ba('0x36')](_0x62ac22[_0x35ba('0x39')]['offset']);}_0x17e870['order']=qs[_0x35ba('0x38')](_0x62ac22[_0x35ba('0x39')][_0x35ba('0x38')]);_0x17e870[_0x35ba('0x3a')]=qs[_0x35ba('0x31')](_['pick'](_0x62ac22['query'],_0x327918[_0x35ba('0x31')]));_0x17e870[_0x35ba('0x3a')]['CampaignId']=_0x5d3b60['id'];if(_0x62ac22['query'][_0x35ba('0x3c')]){_0x17e870[_0x35ba('0x3a')]=_[_0x35ba('0x3d')](_0x17e870[_0x35ba('0x3a')],{'$or':_[_0x35ba('0x2f')](_0x17e870[_0x35ba('0x33')],function(_0x4c28b1){var _0x3b66f1={};_0x3b66f1[_0x4c28b1]={'$like':'%'+_0x62ac22['query'][_0x35ba('0x3c')]+'%'};return _0x3b66f1;})});}_0x17e870=_[_0x35ba('0x3d')]({},_0x17e870,_0x62ac22[_0x35ba('0x3e')]);return db[_0x35ba('0x53')][_0x35ba('0x1b')]({'where':_0x17e870[_0x35ba('0x3a')]})[_0x35ba('0x23')](function(_0x590ea5){_0x4de3d6[_0x35ba('0x1b')]=_0x590ea5;if(_0x62ac22[_0x35ba('0x39')][_0x35ba('0x3f')]){_0x17e870[_0x35ba('0x40')]=[{'all':!![]}];}return db[_0x35ba('0x53')][_0x35ba('0x41')](_0x17e870);})[_0x35ba('0x23')](function(_0x14a26d){_0x4de3d6['rows']=_0x14a26d;return _0x4de3d6;});}})[_0x35ba('0x23')](respondWithFilteredResult(_0x5eb454,_0x17e870))[_0x35ba('0x43')](handleError(_0x5eb454,null));};exports[_0x35ba('0x55')]=function(_0x4aeded,_0x28a39c,_0x2fc472){var _0x2cb290={'raw':!![],'where':{}};var _0x4384d4={};var _0xe7ab={'count':0x0,'rows':[]};return db[_0x35ba('0x2b')][_0x35ba('0x56')]({'where':{'id':_0x4aeded[_0x35ba('0x45')]['id']}})[_0x35ba('0x23')](handleEntityNotFound(_0x28a39c,null))[_0x35ba('0x23')](function(_0x3f1347){if(_0x3f1347){_0x4384d4['model']=_[_0x35ba('0x30')](db['CmHopperHistory'][_0x35ba('0x2c')]);_0x4384d4['query']=_[_0x35ba('0x30')](_0x4aeded['query']);_0x4384d4[_0x35ba('0x31')]=_[_0x35ba('0x32')](_0x4384d4['model'],_0x4384d4['query']);_0x2cb290[_0x35ba('0x33')]=_[_0x35ba('0x32')](_0x4384d4[_0x35ba('0x2e')],qs[_0x35ba('0x34')](_0x4aeded[_0x35ba('0x39')][_0x35ba('0x34')]));_0x2cb290[_0x35ba('0x33')]=_0x2cb290[_0x35ba('0x33')][_0x35ba('0x4d')]?_0x2cb290[_0x35ba('0x33')]:_0x4384d4['model'];if(!_0x4aeded['query'][_0x35ba('0x54')]('nolimit')){_0x2cb290['limit']=qs[_0x35ba('0x1a')](_0x4aeded['query'][_0x35ba('0x1a')]);_0x2cb290[_0x35ba('0x36')]=qs[_0x35ba('0x36')](_0x4aeded['query'][_0x35ba('0x36')]);}_0x2cb290['order']=qs[_0x35ba('0x38')](_0x4aeded[_0x35ba('0x39')][_0x35ba('0x38')]);_0x2cb290[_0x35ba('0x3a')]=qs['filters'](_[_0x35ba('0x3b')](_0x4aeded[_0x35ba('0x39')],_0x4384d4[_0x35ba('0x31')]));_0x2cb290[_0x35ba('0x3a')]['CampaignId']=_0x3f1347['id'];if(_0x4aeded[_0x35ba('0x39')][_0x35ba('0x3c')]){_0x2cb290['where']=_['merge'](_0x2cb290['where'],{'$or':_[_0x35ba('0x2f')](_0x2cb290['attributes'],function(_0x48cd25){var _0x59d990={};_0x59d990[_0x48cd25]={'$like':'%'+_0x4aeded[_0x35ba('0x39')][_0x35ba('0x3c')]+'%'};return _0x59d990;})});}_0x2cb290=_[_0x35ba('0x3d')]({},_0x2cb290,_0x4aeded[_0x35ba('0x3e')]);return db[_0x35ba('0x57')][_0x35ba('0x1b')]({'where':_0x2cb290[_0x35ba('0x3a')]})[_0x35ba('0x23')](function(_0x5a31f1){_0xe7ab[_0x35ba('0x1b')]=_0x5a31f1;if(_0x4aeded[_0x35ba('0x39')]['includeAll']){_0x2cb290[_0x35ba('0x40')]=[{'all':!![]}];}return db[_0x35ba('0x57')][_0x35ba('0x41')](_0x2cb290);})[_0x35ba('0x23')](function(_0x2697ee){_0xe7ab['rows']=_0x2697ee;return _0xe7ab;});}})[_0x35ba('0x23')](respondWithFilteredResult(_0x28a39c,_0x2cb290))['catch'](handleError(_0x28a39c,null));};exports[_0x35ba('0x58')]=function(_0x4ee40,_0x5180cc,_0x3ace0b){var _0x136607={'raw':!![],'where':{}};var _0x456a3c={};var _0xd4182b={'count':0x0,'rows':[]};return db[_0x35ba('0x2b')]['findOne']({'where':{'id':_0x4ee40['params']['id']}})[_0x35ba('0x23')](handleEntityNotFound(_0x5180cc,null))['then'](function(_0x47e877){if(_0x47e877){_0x456a3c['model']=_['keys'](db[_0x35ba('0x59')][_0x35ba('0x2c')]);_0x456a3c[_0x35ba('0x39')]=_[_0x35ba('0x30')](_0x4ee40[_0x35ba('0x39')]);_0x456a3c[_0x35ba('0x31')]=_[_0x35ba('0x32')](_0x456a3c[_0x35ba('0x2e')],_0x456a3c['query']);_0x136607[_0x35ba('0x33')]=_[_0x35ba('0x32')](_0x456a3c[_0x35ba('0x2e')],qs[_0x35ba('0x34')](_0x4ee40['query']['fields']));_0x136607['attributes']=_0x136607['attributes'][_0x35ba('0x4d')]?_0x136607[_0x35ba('0x33')]:_0x456a3c[_0x35ba('0x2e')];if(!_0x4ee40[_0x35ba('0x39')][_0x35ba('0x54')](_0x35ba('0x35'))){_0x136607['limit']=qs[_0x35ba('0x1a')](_0x4ee40[_0x35ba('0x39')][_0x35ba('0x1a')]);_0x136607[_0x35ba('0x36')]=qs['offset'](_0x4ee40[_0x35ba('0x39')][_0x35ba('0x36')]);}_0x136607[_0x35ba('0x37')]=qs[_0x35ba('0x38')](_0x4ee40[_0x35ba('0x39')][_0x35ba('0x38')]);_0x136607[_0x35ba('0x3a')]=qs[_0x35ba('0x31')](_['pick'](_0x4ee40[_0x35ba('0x39')],_0x456a3c[_0x35ba('0x31')]));_0x136607[_0x35ba('0x3a')][_0x35ba('0x5a')]=_0x47e877['id'];if(_0x4ee40[_0x35ba('0x39')]['filter']){_0x136607[_0x35ba('0x3a')]=_[_0x35ba('0x3d')](_0x136607[_0x35ba('0x3a')],{'$or':_[_0x35ba('0x2f')](_0x136607['attributes'],function(_0x58ceaf){var _0xbb64e={};_0xbb64e[_0x58ceaf]={'$like':'%'+_0x4ee40[_0x35ba('0x39')][_0x35ba('0x3c')]+'%'};return _0xbb64e;})});}_0x136607=_[_0x35ba('0x3d')]({},_0x136607,_0x4ee40[_0x35ba('0x3e')]);return db[_0x35ba('0x59')]['count']({'where':_0x136607['where']})[_0x35ba('0x23')](function(_0x4e7bcf){_0xd4182b[_0x35ba('0x1b')]=_0x4e7bcf;if(_0x4ee40['query']['includeAll']){_0x136607[_0x35ba('0x40')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x35ba('0x41')](_0x136607);})[_0x35ba('0x23')](function(_0x3daef9){_0xd4182b[_0x35ba('0x42')]=_0x3daef9;return _0xd4182b;});}})[_0x35ba('0x23')](respondWithFilteredResult(_0x5180cc,_0x136607))[_0x35ba('0x43')](handleError(_0x5180cc,null));};exports['getHopperBlacks']=function(_0x2d3e20,_0x1c67b7,_0x3a0bbb){var _0x5c94f7={'raw':!![],'where':{}};var _0x4408bd={};var _0x7fc09b={'count':0x0,'rows':[]};return db[_0x35ba('0x2b')][_0x35ba('0x56')]({'where':{'id':_0x2d3e20[_0x35ba('0x45')]['id']}})[_0x35ba('0x23')](handleEntityNotFound(_0x1c67b7,null))[_0x35ba('0x23')](function(_0x50a02a){if(_0x50a02a){_0x4408bd['model']=_[_0x35ba('0x30')](db[_0x35ba('0x5b')][_0x35ba('0x2c')]);_0x4408bd[_0x35ba('0x39')]=_[_0x35ba('0x30')](_0x2d3e20[_0x35ba('0x39')]);_0x4408bd[_0x35ba('0x31')]=_[_0x35ba('0x32')](_0x4408bd[_0x35ba('0x2e')],_0x4408bd['query']);_0x5c94f7[_0x35ba('0x33')]=_[_0x35ba('0x32')](_0x4408bd['model'],qs['fields'](_0x2d3e20[_0x35ba('0x39')]['fields']));_0x5c94f7[_0x35ba('0x33')]=_0x5c94f7[_0x35ba('0x33')][_0x35ba('0x4d')]?_0x5c94f7['attributes']:_0x4408bd[_0x35ba('0x2e')];if(!_0x2d3e20['query'][_0x35ba('0x54')]('nolimit')){_0x5c94f7[_0x35ba('0x1a')]=qs[_0x35ba('0x1a')](_0x2d3e20[_0x35ba('0x39')][_0x35ba('0x1a')]);_0x5c94f7[_0x35ba('0x36')]=qs[_0x35ba('0x36')](_0x2d3e20[_0x35ba('0x39')]['offset']);}_0x5c94f7['order']=qs[_0x35ba('0x38')](_0x2d3e20[_0x35ba('0x39')][_0x35ba('0x38')]);_0x5c94f7[_0x35ba('0x3a')]=qs[_0x35ba('0x31')](_[_0x35ba('0x3b')](_0x2d3e20[_0x35ba('0x39')],_0x4408bd[_0x35ba('0x31')]));_0x5c94f7['where'][_0x35ba('0x5a')]=_0x50a02a['id'];if(_0x2d3e20[_0x35ba('0x39')][_0x35ba('0x3c')]){_0x5c94f7[_0x35ba('0x3a')]=_[_0x35ba('0x3d')](_0x5c94f7[_0x35ba('0x3a')],{'$or':_[_0x35ba('0x2f')](_0x5c94f7[_0x35ba('0x33')],function(_0x5d03c1){var _0x5e0332={};_0x5e0332[_0x5d03c1]={'$like':'%'+_0x2d3e20['query'][_0x35ba('0x3c')]+'%'};return _0x5e0332;})});}_0x5c94f7=_[_0x35ba('0x3d')]({},_0x5c94f7,_0x2d3e20['options']);return db[_0x35ba('0x5b')][_0x35ba('0x1b')]({'where':_0x5c94f7['where']})[_0x35ba('0x23')](function(_0x43aec5){_0x7fc09b[_0x35ba('0x1b')]=_0x43aec5;if(_0x2d3e20['query'][_0x35ba('0x3f')]){_0x5c94f7[_0x35ba('0x40')]=[{'all':!![]}];}return db[_0x35ba('0x5b')][_0x35ba('0x41')](_0x5c94f7);})[_0x35ba('0x23')](function(_0x44eb0e){_0x7fc09b[_0x35ba('0x42')]=_0x44eb0e;return _0x7fc09b;});}})['then'](respondWithFilteredResult(_0x1c67b7,_0x5c94f7))[_0x35ba('0x43')](handleError(_0x1c67b7,null));};exports[_0x35ba('0x5c')]=function(_0xc76997,_0x22576d,_0x5cf0e6){var _0xa51fd={};var _0x5cea6c={};var _0x2b581a;var _0x5c14f0;return db[_0x35ba('0x2b')][_0x35ba('0x56')]({'where':{'id':_0xc76997[_0x35ba('0x45')]['id']}})['then'](handleEntityNotFound(_0x22576d,null))[_0x35ba('0x23')](function(_0x4bb175){if(_0x4bb175){_0x2b581a=_0x4bb175;_0x5cea6c['model']=_[_0x35ba('0x30')](db[_0x35ba('0x5d')][_0x35ba('0x2c')]);_0x5cea6c[_0x35ba('0x39')]=_['keys'](_0xc76997[_0x35ba('0x39')]);_0x5cea6c[_0x35ba('0x31')]=_[_0x35ba('0x32')](_0x5cea6c[_0x35ba('0x2e')],_0x5cea6c['query']);_0xa51fd['attributes']=_[_0x35ba('0x32')](_0x5cea6c['model'],qs[_0x35ba('0x34')](_0xc76997[_0x35ba('0x39')][_0x35ba('0x34')]));_0xa51fd['attributes']=_0xa51fd[_0x35ba('0x33')][_0x35ba('0x4d')]?_0xa51fd[_0x35ba('0x33')]:_0x5cea6c[_0x35ba('0x2e')];_0xa51fd[_0x35ba('0x37')]=qs[_0x35ba('0x38')](_0xc76997[_0x35ba('0x39')]['sort']);_0xa51fd[_0x35ba('0x3a')]=qs[_0x35ba('0x31')](_[_0x35ba('0x3b')](_0xc76997['query'],_0x5cea6c[_0x35ba('0x31')]));if(_0xc76997[_0x35ba('0x39')][_0x35ba('0x3c')]){_0xa51fd[_0x35ba('0x3a')]=_[_0x35ba('0x3d')](_0xa51fd[_0x35ba('0x3a')],{'$or':_[_0x35ba('0x2f')](_0xa51fd[_0x35ba('0x33')],function(_0x51a09e){var _0x3090e2={};_0x3090e2[_0x51a09e]={'$like':'%'+_0xc76997[_0x35ba('0x39')]['filter']+'%'};return _0x3090e2;})});}_0xa51fd=_[_0x35ba('0x3d')]({},_0xa51fd,_0xc76997[_0x35ba('0x3e')]);return _0x2b581a[_0x35ba('0x5c')](_0xa51fd);}})['then'](function(_0x50e22c){if(_0x50e22c){_0x5c14f0=_0x50e22c[_0x35ba('0x4d')];if(!_0xc76997[_0x35ba('0x39')][_0x35ba('0x54')](_0x35ba('0x35'))){_0xa51fd['limit']=qs[_0x35ba('0x1a')](_0xc76997['query'][_0x35ba('0x1a')]);_0xa51fd['offset']=qs[_0x35ba('0x36')](_0xc76997['query'][_0x35ba('0x36')]);}return _0x2b581a[_0x35ba('0x5c')](_0xa51fd);}})[_0x35ba('0x23')](function(_0x29ae75){if(_0x29ae75){return _0x29ae75?{'count':_0x5c14f0,'rows':_0x29ae75}:null;}})['then'](respondWithResult(_0x22576d,null))[_0x35ba('0x43')](handleError(_0x22576d,null));};exports[_0x35ba('0x5e')]=function(_0xbc360,_0x1a9885,_0x2d2449){var _0x50e74c,_0xf7bcce;var _0x2a7764=[];var _0xed4e6e=moment()[_0x35ba('0x5f')](_0x35ba('0x60'));return db[_0x35ba('0x2b')]['find']({'where':{'id':_0xbc360[_0x35ba('0x45')]['id']}})[_0x35ba('0x23')](handleEntityNotFound(_0x1a9885,null))['then'](function(_0x285d16){if(_0x285d16){_0xf7bcce=_0x285d16;return _0x285d16['addLists'](_0xbc360[_0x35ba('0x48')][_0x35ba('0x61')],_[_0x35ba('0x4f')](_0xbc360[_0x35ba('0x48')],['ids','id'])||{});}return null;})[_0x35ba('0x62')](function(_0x1a7211){var _0x7cd657;var _0x236fff;_0x50e74c=_0x1a7211||[];var _0x1c6cb2=[];if(_0x1a7211){for(var _0x403763=0x0;_0x403763<_0x1a7211[_0x35ba('0x4d')];_0x403763+=0x1){var _0x445036=_0x1a7211[_0x403763][_0x35ba('0x49')]({'plain':!![]});_0xf7bcce['dialCheckDuplicateType']=_0xbc360['body']['dialCheckDuplicateType']?_0xbc360[_0x35ba('0x48')][_0x35ba('0x63')]:_0xf7bcce[_0x35ba('0x63')];switch(_0xf7bcce[_0x35ba('0x63')]){case _0x35ba('0x64'):_0x7cd657=squel[_0x35ba('0x65')]()['into'](_0x35ba('0x66'))[_0x35ba('0x67')]([_0x35ba('0x68'),'scheduledAt',_0x35ba('0x69'),_0x35ba('0x6a'),'CampaignId','createdAt',_0x35ba('0x6b')],squel['select']()[_0x35ba('0x6c')]('phone',_0x35ba('0x68'))['field'](_0x35ba('0x6d'),'scheduledAt')[_0x35ba('0x6c')]('id',_0x35ba('0x69'))[_0x35ba('0x6c')](_0x445036[_0x35ba('0x6e')][_0x35ba('0x6f')](),'ListId')[_0x35ba('0x6c')](_0xbc360[_0x35ba('0x45')]['id'][_0x35ba('0x6f')](),_0x35ba('0x5a'))['field']('\x27'+_0xed4e6e+'\x27',_0x35ba('0x4e'))['field']('\x27'+_0xed4e6e+'\x27','updatedAt')[_0x35ba('0x70')]('cm_contacts')[_0x35ba('0x3a')](_0x35ba('0x71'))[_0x35ba('0x3a')](_0x35ba('0x72'),_0x445036['CmListId'][_0x35ba('0x6f')]())[_0x35ba('0x3a')](_0x35ba('0x73'))[_0x35ba('0x3a')](_0x35ba('0x74'),squel['select']()['field'](_0x35ba('0x75'))[_0x35ba('0x70')](_0x35ba('0x76'))[_0x35ba('0x3a')]('CampaignId\x20=\x20?',_0xbc360[_0x35ba('0x45')]['id']['toString']()))['where']('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x35ba('0x6c')](_0x35ba('0x77'))['from']('cm_hopper')[_0x35ba('0x3a')](_0x35ba('0x78'),_0xbc360[_0x35ba('0x45')]['id'][_0x35ba('0x6f')]())))['toString']();break;case _0x35ba('0x79'):_0x7cd657=squel[_0x35ba('0x65')]()[_0x35ba('0x7a')]('cm_hopper')[_0x35ba('0x67')]([_0x35ba('0x68'),'scheduledAt','ContactId','ListId',_0x35ba('0x5a'),'createdAt','updatedAt'],squel[_0x35ba('0x7b')]()[_0x35ba('0x6c')](_0x35ba('0x68'),_0x35ba('0x68'))['field'](_0x35ba('0x6d'),_0x35ba('0x7c'))[_0x35ba('0x6c')]('id',_0x35ba('0x69'))[_0x35ba('0x6c')](_0x445036[_0x35ba('0x6e')][_0x35ba('0x6f')](),_0x35ba('0x6a'))[_0x35ba('0x6c')](_0xbc360['params']['id'][_0x35ba('0x6f')](),_0x35ba('0x5a'))[_0x35ba('0x6c')]('\x27'+_0xed4e6e+'\x27',_0x35ba('0x4e'))[_0x35ba('0x6c')]('\x27'+_0xed4e6e+'\x27',_0x35ba('0x6b'))[_0x35ba('0x70')](_0x35ba('0x7d'))[_0x35ba('0x3a')]('deletedAt\x20IS\x20NULL')[_0x35ba('0x3a')](_0x35ba('0x72'),_0x445036[_0x35ba('0x6e')][_0x35ba('0x6f')]())[_0x35ba('0x3a')](_0x35ba('0x73'))[_0x35ba('0x3a')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x35ba('0x6c')]('COALESCE(phone,\x27\x27)')[_0x35ba('0x70')]('cm_hopper')[_0x35ba('0x3a')]('CampaignId\x20=\x20?',_0xbc360['params']['id'][_0x35ba('0x6f')]())))[_0x35ba('0x6f')]();break;default:_0x7cd657=squel[_0x35ba('0x65')]()[_0x35ba('0x7a')](_0x35ba('0x66'))[_0x35ba('0x67')]([_0x35ba('0x68'),_0x35ba('0x7c'),'ContactId',_0x35ba('0x6a'),'CampaignId',_0x35ba('0x4e'),_0x35ba('0x6b')],squel[_0x35ba('0x7b')]()[_0x35ba('0x6c')](_0x35ba('0x68'),_0x35ba('0x68'))[_0x35ba('0x6c')](_0x35ba('0x6d'),_0x35ba('0x7c'))[_0x35ba('0x6c')]('id',_0x35ba('0x69'))[_0x35ba('0x6c')](_0x445036[_0x35ba('0x6e')][_0x35ba('0x6f')](),_0x35ba('0x6a'))['field'](_0xbc360[_0x35ba('0x45')]['id'][_0x35ba('0x6f')](),_0x35ba('0x5a'))[_0x35ba('0x6c')]('\x27'+_0xed4e6e+'\x27',_0x35ba('0x4e'))['field']('\x27'+_0xed4e6e+'\x27',_0x35ba('0x6b'))['from'](_0x35ba('0x7d'))['where'](_0x35ba('0x71'))[_0x35ba('0x3a')](_0x35ba('0x72'),_0x445036[_0x35ba('0x6e')]['toString']())[_0x35ba('0x3a')](_0x35ba('0x73')))[_0x35ba('0x6f')]();}_0x236fff=squel[_0x35ba('0x65')]()[_0x35ba('0x7a')](_0x35ba('0x7e'))[_0x35ba('0x67')]([_0x35ba('0x7f'),_0x35ba('0x7c'),_0x35ba('0x68'),'OrderBy',_0x35ba('0x4e'),'updatedAt'],squel[_0x35ba('0x7b')]()['field'](_0x35ba('0x80'),'id')[_0x35ba('0x6c')](_0x35ba('0x6d'),_0x35ba('0x7c'))[_0x35ba('0x6c')](_0x35ba('0x81'),_0x35ba('0x68'))[_0x35ba('0x6c')](_0x35ba('0x82'),_0x35ba('0x83'))[_0x35ba('0x6c')]('\x27'+_0xed4e6e+'\x27',_0x35ba('0x4e'))[_0x35ba('0x6c')]('\x27'+_0xed4e6e+'\x27',_0x35ba('0x6b'))[_0x35ba('0x70')](_0x35ba('0x84'),'ci')[_0x35ba('0x85')](_0x35ba('0x66'),'h',_0x35ba('0x86'))['where'](_0x35ba('0x87'),_0x445036[_0x35ba('0x6e')][_0x35ba('0x6f')]())[_0x35ba('0x3a')](_0x35ba('0x88'),_0xbc360['params']['id']['toString']())[_0x35ba('0x3a')](_0x35ba('0x89'),_0xed4e6e))['toString']();_0x1c6cb2[_0x35ba('0x8a')](db[_0x35ba('0x8b')]['query'](_0x7cd657));_0x2a7764[_0x35ba('0x8a')](db[_0x35ba('0x8b')][_0x35ba('0x39')](_0x236fff));}return BPromise[_0x35ba('0x8c')](_0x1c6cb2);}})['then'](function(){return BPromise['all'](_0x2a7764);})['then'](function(){return _0x50e74c;})[_0x35ba('0x23')](respondWithResult(_0x1a9885,null))[_0x35ba('0x43')](handleError(_0x1a9885,null));};exports[_0x35ba('0x8d')]=function(_0x23f486,_0x48f1a3,_0x5c4c08){return db[_0x35ba('0x2b')][_0x35ba('0x46')]({'where':{'id':_0x23f486[_0x35ba('0x45')]['id']}})[_0x35ba('0x23')](handleEntityNotFound(_0x48f1a3,null))[_0x35ba('0x23')](function(_0x5399bd){if(_0x5399bd){return _0x5399bd[_0x35ba('0x8d')](_0x23f486['query']['ids']);}})[_0x35ba('0x23')](function(_0x41dcc7){if(_0x41dcc7){return db[_0x35ba('0x53')][_0x35ba('0x25')]({'where':{'ListId':_0x23f486[_0x35ba('0x39')][_0x35ba('0x61')],'CampaignId':_0x23f486[_0x35ba('0x45')]['id']}})['then'](function(){return _0x41dcc7;});}})[_0x35ba('0x23')](respondWithStatusCode(_0x48f1a3,null))[_0x35ba('0x43')](handleError(_0x48f1a3,null));};exports[_0x35ba('0x8e')]=function(_0x15eeb7,_0x584223,_0x32e213){var _0x213037={};var _0x50bce2={};var _0x54e80a;var _0x5fd5d7;return db['Campaign'][_0x35ba('0x56')]({'where':{'id':_0x15eeb7['params']['id']}})['then'](handleEntityNotFound(_0x584223,null))[_0x35ba('0x23')](function(_0x5c1980){if(_0x5c1980){_0x54e80a=_0x5c1980;_0x50bce2[_0x35ba('0x2e')]=_[_0x35ba('0x30')](db[_0x35ba('0x5d')][_0x35ba('0x2c')]);_0x50bce2['query']=_[_0x35ba('0x30')](_0x15eeb7[_0x35ba('0x39')]);_0x50bce2[_0x35ba('0x31')]=_[_0x35ba('0x32')](_0x50bce2[_0x35ba('0x2e')],_0x50bce2[_0x35ba('0x39')]);_0x213037['attributes']=_['intersection'](_0x50bce2[_0x35ba('0x2e')],qs[_0x35ba('0x34')](_0x15eeb7['query'][_0x35ba('0x34')]));_0x213037[_0x35ba('0x33')]=_0x213037[_0x35ba('0x33')]['length']?_0x213037[_0x35ba('0x33')]:_0x50bce2[_0x35ba('0x2e')];_0x213037[_0x35ba('0x37')]=qs[_0x35ba('0x38')](_0x15eeb7['query'][_0x35ba('0x38')]);_0x213037['where']=qs[_0x35ba('0x31')](_[_0x35ba('0x3b')](_0x15eeb7[_0x35ba('0x39')],_0x50bce2[_0x35ba('0x31')]));if(_0x15eeb7['query'][_0x35ba('0x3c')]){_0x213037[_0x35ba('0x3a')]=_[_0x35ba('0x3d')](_0x213037[_0x35ba('0x3a')],{'$or':_[_0x35ba('0x2f')](_0x213037[_0x35ba('0x33')],function(_0x4a710e){var _0x275029={};_0x275029[_0x4a710e]={'$like':'%'+_0x15eeb7[_0x35ba('0x39')][_0x35ba('0x3c')]+'%'};return _0x275029;})});}_0x213037=_[_0x35ba('0x3d')]({},_0x213037,_0x15eeb7[_0x35ba('0x3e')]);return _0x54e80a[_0x35ba('0x8e')](_0x213037);}})[_0x35ba('0x23')](function(_0x4c0515){if(_0x4c0515){_0x5fd5d7=_0x4c0515[_0x35ba('0x4d')];if(!_0x15eeb7['query']['hasOwnProperty']('nolimit')){_0x213037[_0x35ba('0x1a')]=qs[_0x35ba('0x1a')](_0x15eeb7[_0x35ba('0x39')][_0x35ba('0x1a')]);_0x213037['offset']=qs[_0x35ba('0x36')](_0x15eeb7[_0x35ba('0x39')][_0x35ba('0x36')]);}return _0x54e80a[_0x35ba('0x8e')](_0x213037);}})[_0x35ba('0x23')](function(_0x334e6a){if(_0x334e6a){return _0x334e6a?{'count':_0x5fd5d7,'rows':_0x334e6a}:null;}})['then'](respondWithResult(_0x584223,null))[_0x35ba('0x43')](handleError(_0x584223,null));};exports[_0x35ba('0x8f')]=function(_0x34cd51,_0x40aeef,_0xefde4d){var _0x11c2b8,_0x30f4b0;var _0x132ca4=[];var _0x13bcca=moment()[_0x35ba('0x5f')]('YYYY-MM-DD\x20HH:mm:ss');return db['Campaign'][_0x35ba('0x46')]({'where':{'id':_0x34cd51[_0x35ba('0x45')]['id']}})[_0x35ba('0x23')](handleEntityNotFound(_0x40aeef,null))[_0x35ba('0x23')](function(_0x5e8239){if(_0x5e8239){_0x30f4b0=_0x5e8239;return _0x5e8239[_0x35ba('0x8f')](_0x34cd51['body']['ids'],_[_0x35ba('0x4f')](_0x34cd51[_0x35ba('0x48')],[_0x35ba('0x61'),'id'])||{});}return null;})['spread'](function(_0x113143){var _0x11b00d;var _0x5774d7;_0x11c2b8=_0x113143||[];var _0x2d4adb=[];if(_0x113143){for(var _0x135f3b=0x0;_0x135f3b<_0x113143[_0x35ba('0x4d')];_0x135f3b+=0x1){var _0x16a42e=_0x113143[_0x135f3b][_0x35ba('0x49')]({'plain':!![]});_0x11b00d=squel[_0x35ba('0x65')]()['into'](_0x35ba('0x90'))[_0x35ba('0x67')](['phone',_0x35ba('0x69'),_0x35ba('0x6a'),'CampaignId',_0x35ba('0x4e'),_0x35ba('0x6b')],squel[_0x35ba('0x7b')]()[_0x35ba('0x6c')](_0x35ba('0x68'),_0x35ba('0x68'))[_0x35ba('0x6c')]('id',_0x35ba('0x69'))[_0x35ba('0x6c')](_0x16a42e[_0x35ba('0x6e')][_0x35ba('0x6f')](),_0x35ba('0x6a'))[_0x35ba('0x6c')](_0x34cd51['params']['id']['toString'](),_0x35ba('0x5a'))['field'](_0x35ba('0x6d'),_0x35ba('0x4e'))[_0x35ba('0x6c')](_0x35ba('0x6d'),_0x35ba('0x6b'))[_0x35ba('0x70')](_0x35ba('0x7d'))[_0x35ba('0x3a')](_0x35ba('0x71'))[_0x35ba('0x3a')](_0x35ba('0x72'),_0x16a42e[_0x35ba('0x6e')]['toString']())[_0x35ba('0x3a')]('phone\x20IS\x20NOT\x20NULL'))[_0x35ba('0x6f')]();_0x2d4adb[_0x35ba('0x8a')](db[_0x35ba('0x8b')]['query'](_0x11b00d));}return BPromise[_0x35ba('0x8c')](_0x2d4adb);}})[_0x35ba('0x23')](function(){return _0x11c2b8;})['then'](respondWithResult(_0x40aeef,null))[_0x35ba('0x43')](handleError(_0x40aeef,null));};exports[_0x35ba('0x91')]=function(_0x5d5d00,_0x413a92,_0xdeade8){return db[_0x35ba('0x2b')][_0x35ba('0x46')]({'where':{'id':_0x5d5d00[_0x35ba('0x45')]['id']}})[_0x35ba('0x23')](handleEntityNotFound(_0x413a92,null))[_0x35ba('0x23')](function(_0x41fda5){if(_0x41fda5){return _0x41fda5['removeBlackLists'](_0x5d5d00[_0x35ba('0x39')]['ids']);}})['then'](function(_0x4c1fca){if(_0x4c1fca){return db[_0x35ba('0x5b')][_0x35ba('0x25')]({'where':{'ListId':_0x5d5d00[_0x35ba('0x39')][_0x35ba('0x61')],'CampaignId':_0x5d5d00['params']['id']}})[_0x35ba('0x23')](function(){return _0x4c1fca;});}})[_0x35ba('0x23')](respondWithStatusCode(_0x413a92,null))[_0x35ba('0x43')](handleError(_0x413a92,null));}; \ No newline at end of file +var _0x13ea=['onlyIfOpen','into','phone\x20IS\x20NOT\x20NULL','cm_contacts','deletedAt\x20IS\x20NULL','cm_hopper_additional_phones','h.id','ci.item','ci.OrderBY','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','removeLists','getBlackLists','findOne','CmList','addBlackLists','cm_hopper_black','all','removeBlackLists','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','Content-Range','apply','save','update','then','IvrCampaigns','UserProfileResource','destroy','sendStatus','error','stack','send','index','map','Campaign','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','name','include','findAll','rows','catch','show','keys','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','params','length','find','get','omit','updatedAt','createdAt','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','CampaignId','options','CmHopper','getHopperHistories','CmHopperHistory','getHopperFinals','getHopperBlacks','CmHopperBlack','getLists','addLists','format','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','insert','cm_hopper','fromQuery','phone','scheduledAt','ContactId','select','field','NOW()','CmListId','toString','ListId','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','from','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)'];(function(_0x580647,_0x43d2c3){var _0x5f0792=function(_0x386cef){while(--_0x386cef){_0x580647['push'](_0x580647['shift']());}};_0x5f0792(++_0x43d2c3);}(_0x13ea,0xa9));var _0xa13e=function(_0x506d83,_0x1899e9){_0x506d83=_0x506d83-0x0;var _0x335e8b=_0x13ea[_0x506d83];return _0x335e8b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa13e('0x0'));var jsonpatch=require(_0xa13e('0x1'));var rp=require(_0xa13e('0x2'));var moment=require('moment');var BPromise=require(_0xa13e('0x3'));var Mustache=require('mustache');var util=require(_0xa13e('0x4'));var path=require('path');var sox=require(_0xa13e('0x5'));var csv=require(_0xa13e('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xa13e('0x7'));var jsforce=require(_0xa13e('0x8'));var deskjs=require(_0xa13e('0x9'));var toCsv=require('to-csv');var querystring=require(_0xa13e('0xa'));var Papa=require(_0xa13e('0xb'));var Redis=require(_0xa13e('0xc'));var authService=require(_0xa13e('0xd'));var qs=require(_0xa13e('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa13e('0xf'));var logger=require(_0xa13e('0x10'))(_0xa13e('0x11'));var utils=require(_0xa13e('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xa13e('0x13'));var db=require(_0xa13e('0x14'))['db'];function respondWithStatusCode(_0x17a949,_0x39fa45){_0x39fa45=_0x39fa45||0xcc;return function(_0x423688){if(_0x423688){return _0x17a949['sendStatus'](_0x39fa45);}return _0x17a949[_0xa13e('0x15')](_0x39fa45)[_0xa13e('0x16')]();};}function respondWithResult(_0x57ec24,_0x493010){_0x493010=_0x493010||0xc8;return function(_0xd9c8a8){if(_0xd9c8a8){return _0x57ec24['status'](_0x493010)[_0xa13e('0x17')](_0xd9c8a8);}};}function respondWithFilteredResult(_0x513019,_0x112321){return function(_0x243ce5){if(_0x243ce5){var _0x1c5b14=typeof _0x112321[_0xa13e('0x18')]===_0xa13e('0x19')&&typeof _0x112321['limit']===_0xa13e('0x19');var _0x193d4a=_0x243ce5[_0xa13e('0x1a')];var _0x4f8af2=_0x1c5b14?0x0:_0x112321[_0xa13e('0x18')];var _0x36acb8=_0x1c5b14?_0x243ce5['count']:_0x112321[_0xa13e('0x18')]+_0x112321[_0xa13e('0x1b')];var _0x441df6;if(_0x36acb8>=_0x193d4a){_0x36acb8=_0x193d4a;_0x441df6=0xc8;}else{_0x441df6=0xce;}_0x513019[_0xa13e('0x15')](_0x441df6);return _0x513019['set'](_0xa13e('0x1c'),_0x4f8af2+'-'+_0x36acb8+'/'+_0x193d4a)[_0xa13e('0x17')](_0x243ce5);}return null;};}function patchUpdates(_0x24b13a){return function(_0x321cd3){try{jsonpatch[_0xa13e('0x1d')](_0x321cd3,_0x24b13a,!![]);}catch(_0x30f4e5){return BPromise['reject'](_0x30f4e5);}return _0x321cd3[_0xa13e('0x1e')]();};}function saveUpdates(_0x1eeacc,_0x498081){return function(_0x5136be){if(_0x5136be){return _0x5136be[_0xa13e('0x1f')](_0x1eeacc)[_0xa13e('0x20')](function(_0x359dd7){return _0x359dd7;});}return null;};}function removeEntity(_0x1932bd,_0x213000){return function(_0x2dc21b){if(_0x2dc21b){return _0x2dc21b['destroy']()[_0xa13e('0x20')](function(){var _0x364e70=_0x2dc21b['get']({'plain':!![]});var _0x1dd290=_0xa13e('0x21');return db[_0xa13e('0x22')][_0xa13e('0x23')]({'where':{'type':_0x1dd290,'resourceId':_0x364e70['id']}})[_0xa13e('0x20')](function(){return _0x2dc21b;});})[_0xa13e('0x20')](function(){_0x1932bd[_0xa13e('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x21c2b6,_0x416433){return function(_0x380f6b){if(!_0x380f6b){_0x21c2b6[_0xa13e('0x24')](0x194);}return _0x380f6b;};}function handleError(_0x4e8405,_0x643ce7){_0x643ce7=_0x643ce7||0x1f4;return function(_0x30814a){logger[_0xa13e('0x25')](_0x30814a[_0xa13e('0x26')]);if(_0x30814a['name']){delete _0x30814a['name'];}_0x4e8405[_0xa13e('0x15')](_0x643ce7)[_0xa13e('0x27')](_0x30814a);};}exports[_0xa13e('0x28')]=function(_0x5af83d,_0x133694){var _0x2d1a4d={},_0x5b919d={},_0x1a61a8={'count':0x0,'rows':[]};var _0x11bf12=_[_0xa13e('0x29')](db[_0xa13e('0x2a')][_0xa13e('0x2b')],function(_0x2bfd0b){return{'name':_0x2bfd0b['fieldName'],'type':_0x2bfd0b[_0xa13e('0x2c')][_0xa13e('0x2d')]};});_0x5b919d[_0xa13e('0x2e')]=_['map'](_0x11bf12,'name');_0x5b919d[_0xa13e('0x2f')]=_['keys'](_0x5af83d['query']);_0x5b919d[_0xa13e('0x30')]=_[_0xa13e('0x31')](_0x5b919d['model'],_0x5b919d['query']);_0x2d1a4d[_0xa13e('0x32')]=_[_0xa13e('0x31')](_0x5b919d[_0xa13e('0x2e')],qs[_0xa13e('0x33')](_0x5af83d['query']['fields']));_0x2d1a4d[_0xa13e('0x32')]=_0x2d1a4d['attributes']['length']?_0x2d1a4d[_0xa13e('0x32')]:_0x5b919d[_0xa13e('0x2e')];if(!_0x5af83d[_0xa13e('0x2f')][_0xa13e('0x34')](_0xa13e('0x35'))){_0x2d1a4d[_0xa13e('0x1b')]=qs['limit'](_0x5af83d[_0xa13e('0x2f')][_0xa13e('0x1b')]);_0x2d1a4d['offset']=qs[_0xa13e('0x18')](_0x5af83d[_0xa13e('0x2f')]['offset']);}_0x2d1a4d[_0xa13e('0x36')]=qs[_0xa13e('0x37')](_0x5af83d[_0xa13e('0x2f')][_0xa13e('0x37')]);_0x2d1a4d['where']=qs[_0xa13e('0x30')](_[_0xa13e('0x38')](_0x5af83d['query'],_0x5b919d[_0xa13e('0x30')]),_0x11bf12);if(_0x5af83d[_0xa13e('0x2f')][_0xa13e('0x39')]){_0x2d1a4d[_0xa13e('0x3a')]=_[_0xa13e('0x3b')](_0x2d1a4d['where'],{'$or':_[_0xa13e('0x29')](_0x11bf12,function(_0x1f41b1){if(_0x1f41b1['type']!==_0xa13e('0x3c')){var _0x2ed1eb={};_0x2ed1eb[_0x1f41b1[_0xa13e('0x3d')]]={'$like':'%'+_0x5af83d['query'][_0xa13e('0x39')]+'%'};return _0x2ed1eb;}})});}_0x2d1a4d=_[_0xa13e('0x3b')]({},_0x2d1a4d,_0x5af83d['options']);var _0x2b0834={'where':_0x2d1a4d[_0xa13e('0x3a')]};return db[_0xa13e('0x2a')][_0xa13e('0x1a')](_0x2b0834)[_0xa13e('0x20')](function(_0x1a66aa){_0x1a61a8[_0xa13e('0x1a')]=_0x1a66aa;if(_0x5af83d[_0xa13e('0x2f')]['includeAll']){_0x2d1a4d[_0xa13e('0x3e')]=[{'all':!![]}];}return db['Campaign'][_0xa13e('0x3f')](_0x2d1a4d);})['then'](function(_0x4e23fc){_0x1a61a8[_0xa13e('0x40')]=_0x4e23fc;return _0x1a61a8;})[_0xa13e('0x20')](respondWithFilteredResult(_0x133694,_0x2d1a4d))[_0xa13e('0x41')](handleError(_0x133694,null));};exports[_0xa13e('0x42')]=function(_0xa5d7c5,_0x589051){var _0x3fc3d7={'raw':![],'where':{'id':_0xa5d7c5['params']['id']}},_0x19f127={};_0x19f127[_0xa13e('0x2e')]=_[_0xa13e('0x43')](db['Campaign'][_0xa13e('0x2b')]);_0x19f127[_0xa13e('0x2f')]=_[_0xa13e('0x43')](_0xa5d7c5[_0xa13e('0x2f')]);_0x19f127['filters']=_[_0xa13e('0x31')](_0x19f127[_0xa13e('0x2e')],_0x19f127['query']);_0x3fc3d7['attributes']=_[_0xa13e('0x31')](_0x19f127[_0xa13e('0x2e')],qs[_0xa13e('0x33')](_0xa5d7c5[_0xa13e('0x2f')][_0xa13e('0x33')]));_0x3fc3d7[_0xa13e('0x32')]=_0x3fc3d7[_0xa13e('0x32')]['length']?_0x3fc3d7['attributes']:_0x19f127[_0xa13e('0x2e')];if(_0xa5d7c5[_0xa13e('0x2f')][_0xa13e('0x44')]){_0x3fc3d7[_0xa13e('0x3e')]=[{'all':!![]}];}_0x3fc3d7=_[_0xa13e('0x3b')]({},_0x3fc3d7,_0xa5d7c5['options']);return db['Campaign']['find'](_0x3fc3d7)['then'](handleEntityNotFound(_0x589051,null))[_0xa13e('0x20')](respondWithResult(_0x589051,null))[_0xa13e('0x41')](handleError(_0x589051,null));};exports[_0xa13e('0x45')]=function(_0x1522b6,_0x2762d4){return db[_0xa13e('0x2a')][_0xa13e('0x45')](_0x1522b6[_0xa13e('0x46')],{})['then'](function(_0x49ea7b){var _0x58c8cc=_0x1522b6[_0xa13e('0x47')]['get']({'plain':!![]});if(!_0x58c8cc)throw new Error(_0xa13e('0x48'));if(_0x58c8cc['role']===_0xa13e('0x47')){var _0x7f3666=_0x49ea7b['get']({'plain':!![]});var _0x4d11d5=_0xa13e('0x21');return db[_0xa13e('0x49')]['find']({'where':{'name':_0x4d11d5,'userProfileId':_0x58c8cc[_0xa13e('0x4a')]},'raw':!![]})[_0xa13e('0x20')](function(_0x33431f){if(_0x33431f&&_0x33431f['autoAssociation']===0x0){return db['UserProfileResource'][_0xa13e('0x45')]({'name':_0x7f3666['name'],'resourceId':_0x7f3666['id'],'type':_0x33431f[_0xa13e('0x3d')],'sectionId':_0x33431f['id']},{})[_0xa13e('0x20')](function(){return _0x49ea7b;});}else{return _0x49ea7b;}})[_0xa13e('0x41')](function(_0x1c2726){logger[_0xa13e('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1c2726);throw _0x1c2726;});}return _0x49ea7b;})[_0xa13e('0x20')](respondWithResult(_0x2762d4,0xc9))[_0xa13e('0x41')](handleError(_0x2762d4,null));};exports['clone']=function(_0x3d7f44,_0x437c68){var _0x4f5a6b={'where':{'id':_0x3d7f44[_0xa13e('0x4b')]['id']}},_0x255ba1={};_0x255ba1[_0xa13e('0x2e')]=_[_0xa13e('0x43')](db[_0xa13e('0x2a')][_0xa13e('0x2b')]);_0x4f5a6b['attributes']=_[_0xa13e('0x31')](_0x255ba1[_0xa13e('0x2e')],qs[_0xa13e('0x33')](_0x3d7f44[_0xa13e('0x2f')][_0xa13e('0x33')]));_0x4f5a6b[_0xa13e('0x32')]=_0x4f5a6b[_0xa13e('0x32')][_0xa13e('0x4c')]?_0x4f5a6b[_0xa13e('0x32')]:_0x255ba1[_0xa13e('0x2e')];if(_0x3d7f44[_0xa13e('0x2f')][_0xa13e('0x44')]){_0x4f5a6b['include']=[{'all':!![]}];}_0x4f5a6b=_[_0xa13e('0x3b')]({},_0x4f5a6b,_0x3d7f44['options']);return db[_0xa13e('0x2a')][_0xa13e('0x4d')](_0x4f5a6b)[_0xa13e('0x20')](handleEntityNotFound(_0x437c68,null))[_0xa13e('0x20')](function(_0x2b598d){if(_0x2b598d){var _0x47870e=_0x2b598d[_0xa13e('0x4e')]({'plain':!![]});_0x47870e=qs[_0xa13e('0x4f')](_0x47870e,['id','createdAt',_0xa13e('0x50')]);_0x3d7f44[_0xa13e('0x46')]=_[_0xa13e('0x4f')](_0x3d7f44[_0xa13e('0x46')],['id',_0xa13e('0x51'),'updatedAt']);return db[_0xa13e('0x2a')]['create'](_['merge'](_0x47870e,_0x3d7f44[_0xa13e('0x46')]),{'include':_0x3d7f44[_0xa13e('0x2f')][_0xa13e('0x44')]?[{'all':!![]}]:undefined})[_0xa13e('0x20')](function(_0x43e9fd){var _0x598a6a=_0x3d7f44[_0xa13e('0x47')][_0xa13e('0x4e')]({'plain':!![]});if(!_0x598a6a)throw new Error(_0xa13e('0x48'));if(_0x598a6a[_0xa13e('0x52')]===_0xa13e('0x47')){var _0x4cef03=_0x43e9fd['get']({'plain':!![]});var _0x2a291a=_0xa13e('0x21');return db['UserProfileSection'][_0xa13e('0x4d')]({'where':{'name':_0x2a291a,'userProfileId':_0x598a6a[_0xa13e('0x4a')]},'raw':!![]})[_0xa13e('0x20')](function(_0x18007a){if(_0x18007a&&_0x18007a[_0xa13e('0x53')]===0x0){return db['UserProfileResource'][_0xa13e('0x45')]({'name':_0x4cef03[_0xa13e('0x3d')],'resourceId':_0x4cef03['id'],'type':_0x18007a[_0xa13e('0x3d')],'sectionId':_0x18007a['id']},{})[_0xa13e('0x20')](function(){return _0x43e9fd;});}else{return _0x43e9fd;}})['catch'](function(_0xe918a){logger[_0xa13e('0x25')](_0xa13e('0x54'),_0xe918a);throw _0xe918a;});}return _0x43e9fd;});}})[_0xa13e('0x20')](respondWithResult(_0x437c68,0xc9))[_0xa13e('0x41')](handleError(_0x437c68,null));};exports[_0xa13e('0x1f')]=function(_0x249e41,_0x5df452){if(_0x249e41['body']['id']){delete _0x249e41[_0xa13e('0x46')]['id'];}return db['Campaign'][_0xa13e('0x4d')]({'where':{'id':_0x249e41[_0xa13e('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5df452,null))[_0xa13e('0x20')](saveUpdates(_0x249e41[_0xa13e('0x46')],null))[_0xa13e('0x20')](respondWithResult(_0x5df452,null))[_0xa13e('0x41')](handleError(_0x5df452,null));};exports[_0xa13e('0x23')]=function(_0x112cc2,_0x194ce4){return db[_0xa13e('0x2a')][_0xa13e('0x4d')]({'where':{'id':_0x112cc2['params']['id']}})[_0xa13e('0x20')](handleEntityNotFound(_0x194ce4,null))[_0xa13e('0x20')](removeEntity(_0x194ce4,null))[_0xa13e('0x41')](handleError(_0x194ce4,null));};exports[_0xa13e('0x55')]=function(_0x35be12,_0xab3a3c,_0x134fad){var _0x194a4c={'raw':!![],'where':{}};var _0x16dee2={};var _0x58f985={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x35be12[_0xa13e('0x4b')]['id']}})[_0xa13e('0x20')](handleEntityNotFound(_0xab3a3c,null))[_0xa13e('0x20')](function(_0x2f513e){if(_0x2f513e){_0x16dee2[_0xa13e('0x2e')]=_[_0xa13e('0x43')](db['CmHopper'][_0xa13e('0x2b')]);_0x16dee2['query']=_[_0xa13e('0x43')](_0x35be12[_0xa13e('0x2f')]);_0x16dee2[_0xa13e('0x30')]=_[_0xa13e('0x31')](_0x16dee2[_0xa13e('0x2e')],_0x16dee2[_0xa13e('0x2f')]);_0x194a4c['attributes']=_[_0xa13e('0x31')](_0x16dee2[_0xa13e('0x2e')],qs[_0xa13e('0x33')](_0x35be12[_0xa13e('0x2f')][_0xa13e('0x33')]));_0x194a4c[_0xa13e('0x32')]=_0x194a4c['attributes'][_0xa13e('0x4c')]?_0x194a4c[_0xa13e('0x32')]:_0x16dee2['model'];if(!_0x35be12[_0xa13e('0x2f')][_0xa13e('0x34')](_0xa13e('0x35'))){_0x194a4c['limit']=qs[_0xa13e('0x1b')](_0x35be12['query']['limit']);_0x194a4c[_0xa13e('0x18')]=qs[_0xa13e('0x18')](_0x35be12[_0xa13e('0x2f')][_0xa13e('0x18')]);}_0x194a4c[_0xa13e('0x36')]=qs[_0xa13e('0x37')](_0x35be12['query'][_0xa13e('0x37')]);_0x194a4c[_0xa13e('0x3a')]=qs[_0xa13e('0x30')](_[_0xa13e('0x38')](_0x35be12['query'],_0x16dee2[_0xa13e('0x30')]));_0x194a4c[_0xa13e('0x3a')][_0xa13e('0x56')]=_0x2f513e['id'];if(_0x35be12['query']['filter']){_0x194a4c['where']=_['merge'](_0x194a4c['where'],{'$or':_[_0xa13e('0x29')](_0x194a4c['attributes'],function(_0x1e29cb){var _0x3d68ac={};_0x3d68ac[_0x1e29cb]={'$like':'%'+_0x35be12[_0xa13e('0x2f')][_0xa13e('0x39')]+'%'};return _0x3d68ac;})});}_0x194a4c=_[_0xa13e('0x3b')]({},_0x194a4c,_0x35be12[_0xa13e('0x57')]);return db['CmHopper']['count']({'where':_0x194a4c['where']})[_0xa13e('0x20')](function(_0x31d4e){_0x58f985[_0xa13e('0x1a')]=_0x31d4e;if(_0x35be12[_0xa13e('0x2f')][_0xa13e('0x44')]){_0x194a4c['include']=[{'all':!![]}];}return db[_0xa13e('0x58')]['findAll'](_0x194a4c);})[_0xa13e('0x20')](function(_0x212892){_0x58f985[_0xa13e('0x40')]=_0x212892;return _0x58f985;});}})[_0xa13e('0x20')](respondWithFilteredResult(_0xab3a3c,_0x194a4c))[_0xa13e('0x41')](handleError(_0xab3a3c,null));};exports[_0xa13e('0x59')]=function(_0x1c6d0a,_0x325492,_0x20d933){var _0x391356={'raw':!![],'where':{}};var _0x2633db={};var _0x5955c0={'count':0x0,'rows':[]};return db[_0xa13e('0x2a')]['findOne']({'where':{'id':_0x1c6d0a['params']['id']}})['then'](handleEntityNotFound(_0x325492,null))[_0xa13e('0x20')](function(_0x51636d){if(_0x51636d){_0x2633db[_0xa13e('0x2e')]=_['keys'](db[_0xa13e('0x5a')][_0xa13e('0x2b')]);_0x2633db[_0xa13e('0x2f')]=_['keys'](_0x1c6d0a['query']);_0x2633db[_0xa13e('0x30')]=_[_0xa13e('0x31')](_0x2633db[_0xa13e('0x2e')],_0x2633db['query']);_0x391356[_0xa13e('0x32')]=_[_0xa13e('0x31')](_0x2633db['model'],qs[_0xa13e('0x33')](_0x1c6d0a[_0xa13e('0x2f')][_0xa13e('0x33')]));_0x391356[_0xa13e('0x32')]=_0x391356[_0xa13e('0x32')][_0xa13e('0x4c')]?_0x391356['attributes']:_0x2633db[_0xa13e('0x2e')];if(!_0x1c6d0a[_0xa13e('0x2f')][_0xa13e('0x34')](_0xa13e('0x35'))){_0x391356[_0xa13e('0x1b')]=qs[_0xa13e('0x1b')](_0x1c6d0a['query'][_0xa13e('0x1b')]);_0x391356[_0xa13e('0x18')]=qs[_0xa13e('0x18')](_0x1c6d0a[_0xa13e('0x2f')][_0xa13e('0x18')]);}_0x391356['order']=qs[_0xa13e('0x37')](_0x1c6d0a['query']['sort']);_0x391356[_0xa13e('0x3a')]=qs[_0xa13e('0x30')](_[_0xa13e('0x38')](_0x1c6d0a[_0xa13e('0x2f')],_0x2633db[_0xa13e('0x30')]));_0x391356[_0xa13e('0x3a')][_0xa13e('0x56')]=_0x51636d['id'];if(_0x1c6d0a[_0xa13e('0x2f')]['filter']){_0x391356[_0xa13e('0x3a')]=_[_0xa13e('0x3b')](_0x391356[_0xa13e('0x3a')],{'$or':_[_0xa13e('0x29')](_0x391356['attributes'],function(_0xc544c0){var _0xc1e082={};_0xc1e082[_0xc544c0]={'$like':'%'+_0x1c6d0a[_0xa13e('0x2f')][_0xa13e('0x39')]+'%'};return _0xc1e082;})});}_0x391356=_[_0xa13e('0x3b')]({},_0x391356,_0x1c6d0a[_0xa13e('0x57')]);return db[_0xa13e('0x5a')]['count']({'where':_0x391356[_0xa13e('0x3a')]})[_0xa13e('0x20')](function(_0x536b50){_0x5955c0['count']=_0x536b50;if(_0x1c6d0a[_0xa13e('0x2f')][_0xa13e('0x44')]){_0x391356['include']=[{'all':!![]}];}return db[_0xa13e('0x5a')][_0xa13e('0x3f')](_0x391356);})[_0xa13e('0x20')](function(_0x4afca5){_0x5955c0['rows']=_0x4afca5;return _0x5955c0;});}})[_0xa13e('0x20')](respondWithFilteredResult(_0x325492,_0x391356))[_0xa13e('0x41')](handleError(_0x325492,null));};exports[_0xa13e('0x5b')]=function(_0xd9a51,_0x5943d1,_0x2825d2){var _0x4ce9b9={'raw':!![],'where':{}};var _0x3c09ba={};var _0x6acd20={'count':0x0,'rows':[]};return db[_0xa13e('0x2a')]['findOne']({'where':{'id':_0xd9a51[_0xa13e('0x4b')]['id']}})[_0xa13e('0x20')](handleEntityNotFound(_0x5943d1,null))[_0xa13e('0x20')](function(_0x568a91){if(_0x568a91){_0x3c09ba['model']=_[_0xa13e('0x43')](db['CmHopperFinal'][_0xa13e('0x2b')]);_0x3c09ba[_0xa13e('0x2f')]=_['keys'](_0xd9a51[_0xa13e('0x2f')]);_0x3c09ba['filters']=_['intersection'](_0x3c09ba['model'],_0x3c09ba[_0xa13e('0x2f')]);_0x4ce9b9[_0xa13e('0x32')]=_['intersection'](_0x3c09ba[_0xa13e('0x2e')],qs[_0xa13e('0x33')](_0xd9a51[_0xa13e('0x2f')][_0xa13e('0x33')]));_0x4ce9b9['attributes']=_0x4ce9b9['attributes'][_0xa13e('0x4c')]?_0x4ce9b9[_0xa13e('0x32')]:_0x3c09ba[_0xa13e('0x2e')];if(!_0xd9a51['query']['hasOwnProperty'](_0xa13e('0x35'))){_0x4ce9b9['limit']=qs['limit'](_0xd9a51[_0xa13e('0x2f')]['limit']);_0x4ce9b9['offset']=qs[_0xa13e('0x18')](_0xd9a51[_0xa13e('0x2f')]['offset']);}_0x4ce9b9[_0xa13e('0x36')]=qs['sort'](_0xd9a51['query'][_0xa13e('0x37')]);_0x4ce9b9[_0xa13e('0x3a')]=qs[_0xa13e('0x30')](_[_0xa13e('0x38')](_0xd9a51['query'],_0x3c09ba[_0xa13e('0x30')]));_0x4ce9b9[_0xa13e('0x3a')][_0xa13e('0x56')]=_0x568a91['id'];if(_0xd9a51[_0xa13e('0x2f')]['filter']){_0x4ce9b9[_0xa13e('0x3a')]=_[_0xa13e('0x3b')](_0x4ce9b9[_0xa13e('0x3a')],{'$or':_[_0xa13e('0x29')](_0x4ce9b9[_0xa13e('0x32')],function(_0x3e53ba){var _0x57e8d5={};_0x57e8d5[_0x3e53ba]={'$like':'%'+_0xd9a51['query'][_0xa13e('0x39')]+'%'};return _0x57e8d5;})});}_0x4ce9b9=_[_0xa13e('0x3b')]({},_0x4ce9b9,_0xd9a51[_0xa13e('0x57')]);return db['CmHopperFinal'][_0xa13e('0x1a')]({'where':_0x4ce9b9[_0xa13e('0x3a')]})[_0xa13e('0x20')](function(_0xfa6a95){_0x6acd20[_0xa13e('0x1a')]=_0xfa6a95;if(_0xd9a51['query'][_0xa13e('0x44')]){_0x4ce9b9[_0xa13e('0x3e')]=[{'all':!![]}];}return db['CmHopperFinal'][_0xa13e('0x3f')](_0x4ce9b9);})[_0xa13e('0x20')](function(_0xc034e3){_0x6acd20[_0xa13e('0x40')]=_0xc034e3;return _0x6acd20;});}})[_0xa13e('0x20')](respondWithFilteredResult(_0x5943d1,_0x4ce9b9))['catch'](handleError(_0x5943d1,null));};exports[_0xa13e('0x5c')]=function(_0x26bf7f,_0x3ceef4,_0x111cd3){var _0x2307c4={'raw':!![],'where':{}};var _0x3ac04d={};var _0x487ee8={'count':0x0,'rows':[]};return db[_0xa13e('0x2a')]['findOne']({'where':{'id':_0x26bf7f[_0xa13e('0x4b')]['id']}})[_0xa13e('0x20')](handleEntityNotFound(_0x3ceef4,null))[_0xa13e('0x20')](function(_0x50a662){if(_0x50a662){_0x3ac04d[_0xa13e('0x2e')]=_[_0xa13e('0x43')](db[_0xa13e('0x5d')]['rawAttributes']);_0x3ac04d[_0xa13e('0x2f')]=_[_0xa13e('0x43')](_0x26bf7f[_0xa13e('0x2f')]);_0x3ac04d[_0xa13e('0x30')]=_[_0xa13e('0x31')](_0x3ac04d['model'],_0x3ac04d[_0xa13e('0x2f')]);_0x2307c4[_0xa13e('0x32')]=_['intersection'](_0x3ac04d[_0xa13e('0x2e')],qs[_0xa13e('0x33')](_0x26bf7f[_0xa13e('0x2f')][_0xa13e('0x33')]));_0x2307c4[_0xa13e('0x32')]=_0x2307c4[_0xa13e('0x32')][_0xa13e('0x4c')]?_0x2307c4['attributes']:_0x3ac04d[_0xa13e('0x2e')];if(!_0x26bf7f[_0xa13e('0x2f')][_0xa13e('0x34')](_0xa13e('0x35'))){_0x2307c4['limit']=qs[_0xa13e('0x1b')](_0x26bf7f[_0xa13e('0x2f')][_0xa13e('0x1b')]);_0x2307c4[_0xa13e('0x18')]=qs[_0xa13e('0x18')](_0x26bf7f[_0xa13e('0x2f')][_0xa13e('0x18')]);}_0x2307c4[_0xa13e('0x36')]=qs[_0xa13e('0x37')](_0x26bf7f['query'][_0xa13e('0x37')]);_0x2307c4[_0xa13e('0x3a')]=qs['filters'](_['pick'](_0x26bf7f[_0xa13e('0x2f')],_0x3ac04d['filters']));_0x2307c4[_0xa13e('0x3a')][_0xa13e('0x56')]=_0x50a662['id'];if(_0x26bf7f['query'][_0xa13e('0x39')]){_0x2307c4['where']=_[_0xa13e('0x3b')](_0x2307c4[_0xa13e('0x3a')],{'$or':_['map'](_0x2307c4[_0xa13e('0x32')],function(_0x16214c){var _0x5658a8={};_0x5658a8[_0x16214c]={'$like':'%'+_0x26bf7f['query'][_0xa13e('0x39')]+'%'};return _0x5658a8;})});}_0x2307c4=_['merge']({},_0x2307c4,_0x26bf7f[_0xa13e('0x57')]);return db[_0xa13e('0x5d')]['count']({'where':_0x2307c4[_0xa13e('0x3a')]})[_0xa13e('0x20')](function(_0x24f88f){_0x487ee8[_0xa13e('0x1a')]=_0x24f88f;if(_0x26bf7f[_0xa13e('0x2f')]['includeAll']){_0x2307c4[_0xa13e('0x3e')]=[{'all':!![]}];}return db['CmHopperBlack'][_0xa13e('0x3f')](_0x2307c4);})[_0xa13e('0x20')](function(_0x125452){_0x487ee8['rows']=_0x125452;return _0x487ee8;});}})[_0xa13e('0x20')](respondWithFilteredResult(_0x3ceef4,_0x2307c4))[_0xa13e('0x41')](handleError(_0x3ceef4,null));};exports['getLists']=function(_0x11dc24,_0x4063fe,_0x32b444){var _0x48dad3={};var _0x3ed0f4={};var _0x229cc1;var _0x9dab81;return db[_0xa13e('0x2a')]['findOne']({'where':{'id':_0x11dc24[_0xa13e('0x4b')]['id']}})[_0xa13e('0x20')](handleEntityNotFound(_0x4063fe,null))[_0xa13e('0x20')](function(_0x3a7183){if(_0x3a7183){_0x229cc1=_0x3a7183;_0x3ed0f4[_0xa13e('0x2e')]=_['keys'](db['CmList']['rawAttributes']);_0x3ed0f4[_0xa13e('0x2f')]=_[_0xa13e('0x43')](_0x11dc24[_0xa13e('0x2f')]);_0x3ed0f4[_0xa13e('0x30')]=_[_0xa13e('0x31')](_0x3ed0f4[_0xa13e('0x2e')],_0x3ed0f4[_0xa13e('0x2f')]);_0x48dad3[_0xa13e('0x32')]=_[_0xa13e('0x31')](_0x3ed0f4[_0xa13e('0x2e')],qs[_0xa13e('0x33')](_0x11dc24[_0xa13e('0x2f')][_0xa13e('0x33')]));_0x48dad3['attributes']=_0x48dad3[_0xa13e('0x32')][_0xa13e('0x4c')]?_0x48dad3[_0xa13e('0x32')]:_0x3ed0f4[_0xa13e('0x2e')];_0x48dad3[_0xa13e('0x36')]=qs[_0xa13e('0x37')](_0x11dc24[_0xa13e('0x2f')][_0xa13e('0x37')]);_0x48dad3[_0xa13e('0x3a')]=qs[_0xa13e('0x30')](_[_0xa13e('0x38')](_0x11dc24[_0xa13e('0x2f')],_0x3ed0f4[_0xa13e('0x30')]));if(_0x11dc24[_0xa13e('0x2f')][_0xa13e('0x39')]){_0x48dad3[_0xa13e('0x3a')]=_[_0xa13e('0x3b')](_0x48dad3[_0xa13e('0x3a')],{'$or':_[_0xa13e('0x29')](_0x48dad3[_0xa13e('0x32')],function(_0x530ec0){var _0x2b618a={};_0x2b618a[_0x530ec0]={'$like':'%'+_0x11dc24['query'][_0xa13e('0x39')]+'%'};return _0x2b618a;})});}_0x48dad3=_[_0xa13e('0x3b')]({},_0x48dad3,_0x11dc24['options']);return _0x229cc1[_0xa13e('0x5e')](_0x48dad3);}})['then'](function(_0x1b829a){if(_0x1b829a){_0x9dab81=_0x1b829a[_0xa13e('0x4c')];if(!_0x11dc24['query']['hasOwnProperty']('nolimit')){_0x48dad3['limit']=qs['limit'](_0x11dc24['query']['limit']);_0x48dad3[_0xa13e('0x18')]=qs['offset'](_0x11dc24[_0xa13e('0x2f')][_0xa13e('0x18')]);}return _0x229cc1[_0xa13e('0x5e')](_0x48dad3);}})[_0xa13e('0x20')](function(_0x264326){if(_0x264326){return _0x264326?{'count':_0x9dab81,'rows':_0x264326}:null;}})[_0xa13e('0x20')](respondWithResult(_0x4063fe,null))[_0xa13e('0x41')](handleError(_0x4063fe,null));};exports[_0xa13e('0x5f')]=function(_0x240232,_0x2af916,_0x421c27){var _0x1a30d1,_0x5bfca;var _0x338a00=[];var _0x2a56f9=moment()[_0xa13e('0x60')](_0xa13e('0x61'));return db[_0xa13e('0x2a')]['find']({'where':{'id':_0x240232['params']['id']}})['then'](handleEntityNotFound(_0x2af916,null))[_0xa13e('0x20')](function(_0x3ad70b){if(_0x3ad70b){_0x5bfca=_0x3ad70b;return _0x3ad70b[_0xa13e('0x5f')](_0x240232[_0xa13e('0x46')][_0xa13e('0x62')],_[_0xa13e('0x4f')](_0x240232['body'],[_0xa13e('0x62'),'id'])||{});}return null;})[_0xa13e('0x63')](function(_0x316ca8){var _0x449106;var _0xf30953;_0x1a30d1=_0x316ca8||[];var _0x1ffea2=[];if(_0x316ca8){for(var _0x20c8b0=0x0;_0x20c8b0<_0x316ca8[_0xa13e('0x4c')];_0x20c8b0+=0x1){var _0x12399c=_0x316ca8[_0x20c8b0]['get']({'plain':!![]});_0x5bfca[_0xa13e('0x64')]=_0x240232['body'][_0xa13e('0x64')]?_0x240232[_0xa13e('0x46')][_0xa13e('0x64')]:_0x5bfca['dialCheckDuplicateType'];switch(_0x5bfca[_0xa13e('0x64')]){case'always':_0x449106=squel[_0xa13e('0x65')]()['into'](_0xa13e('0x66'))[_0xa13e('0x67')]([_0xa13e('0x68'),_0xa13e('0x69'),_0xa13e('0x6a'),'ListId','CampaignId','createdAt',_0xa13e('0x50')],squel[_0xa13e('0x6b')]()[_0xa13e('0x6c')](_0xa13e('0x68'),_0xa13e('0x68'))[_0xa13e('0x6c')](_0xa13e('0x6d'),_0xa13e('0x69'))[_0xa13e('0x6c')]('id',_0xa13e('0x6a'))['field'](_0x12399c[_0xa13e('0x6e')][_0xa13e('0x6f')](),_0xa13e('0x70'))[_0xa13e('0x6c')](_0x240232[_0xa13e('0x4b')]['id'][_0xa13e('0x6f')](),_0xa13e('0x56'))[_0xa13e('0x6c')]('\x27'+_0x2a56f9+'\x27',_0xa13e('0x51'))[_0xa13e('0x6c')]('\x27'+_0x2a56f9+'\x27',_0xa13e('0x50'))['from']('cm_contacts')[_0xa13e('0x3a')]('deletedAt\x20IS\x20NULL')['where'](_0xa13e('0x71'),_0x12399c[_0xa13e('0x6e')][_0xa13e('0x6f')]())[_0xa13e('0x3a')]('phone\x20IS\x20NOT\x20NULL')[_0xa13e('0x3a')](_0xa13e('0x72'),squel[_0xa13e('0x6b')]()[_0xa13e('0x6c')]('COALESCE(calleridnum,\x27\x27)')[_0xa13e('0x73')](_0xa13e('0x74'))[_0xa13e('0x3a')](_0xa13e('0x75'),_0x240232[_0xa13e('0x4b')]['id'][_0xa13e('0x6f')]()))[_0xa13e('0x3a')](_0xa13e('0x72'),squel['select']()[_0xa13e('0x6c')](_0xa13e('0x76'))[_0xa13e('0x73')](_0xa13e('0x66'))['where'](_0xa13e('0x75'),_0x240232[_0xa13e('0x4b')]['id'][_0xa13e('0x6f')]())))[_0xa13e('0x6f')]();break;case _0xa13e('0x77'):_0x449106=squel[_0xa13e('0x65')]()[_0xa13e('0x78')](_0xa13e('0x66'))['fromQuery']([_0xa13e('0x68'),'scheduledAt',_0xa13e('0x6a'),_0xa13e('0x70'),'CampaignId',_0xa13e('0x51'),_0xa13e('0x50')],squel[_0xa13e('0x6b')]()[_0xa13e('0x6c')](_0xa13e('0x68'),_0xa13e('0x68'))[_0xa13e('0x6c')](_0xa13e('0x6d'),_0xa13e('0x69'))[_0xa13e('0x6c')]('id',_0xa13e('0x6a'))[_0xa13e('0x6c')](_0x12399c[_0xa13e('0x6e')]['toString'](),'ListId')[_0xa13e('0x6c')](_0x240232[_0xa13e('0x4b')]['id'][_0xa13e('0x6f')](),_0xa13e('0x56'))[_0xa13e('0x6c')]('\x27'+_0x2a56f9+'\x27',_0xa13e('0x51'))[_0xa13e('0x6c')]('\x27'+_0x2a56f9+'\x27','updatedAt')[_0xa13e('0x73')]('cm_contacts')[_0xa13e('0x3a')]('deletedAt\x20IS\x20NULL')[_0xa13e('0x3a')](_0xa13e('0x71'),_0x12399c[_0xa13e('0x6e')]['toString']())[_0xa13e('0x3a')](_0xa13e('0x79'))[_0xa13e('0x3a')](_0xa13e('0x72'),squel[_0xa13e('0x6b')]()[_0xa13e('0x6c')]('COALESCE(phone,\x27\x27)')['from'](_0xa13e('0x66'))[_0xa13e('0x3a')](_0xa13e('0x75'),_0x240232['params']['id'][_0xa13e('0x6f')]())))[_0xa13e('0x6f')]();break;default:_0x449106=squel[_0xa13e('0x65')]()[_0xa13e('0x78')](_0xa13e('0x66'))[_0xa13e('0x67')]([_0xa13e('0x68'),_0xa13e('0x69'),_0xa13e('0x6a'),_0xa13e('0x70'),'CampaignId',_0xa13e('0x51'),_0xa13e('0x50')],squel[_0xa13e('0x6b')]()[_0xa13e('0x6c')]('phone',_0xa13e('0x68'))['field'](_0xa13e('0x6d'),_0xa13e('0x69'))['field']('id',_0xa13e('0x6a'))[_0xa13e('0x6c')](_0x12399c['CmListId'][_0xa13e('0x6f')](),_0xa13e('0x70'))[_0xa13e('0x6c')](_0x240232['params']['id'][_0xa13e('0x6f')](),_0xa13e('0x56'))[_0xa13e('0x6c')]('\x27'+_0x2a56f9+'\x27',_0xa13e('0x51'))[_0xa13e('0x6c')]('\x27'+_0x2a56f9+'\x27',_0xa13e('0x50'))[_0xa13e('0x73')](_0xa13e('0x7a'))[_0xa13e('0x3a')](_0xa13e('0x7b'))[_0xa13e('0x3a')](_0xa13e('0x71'),_0x12399c[_0xa13e('0x6e')][_0xa13e('0x6f')]())[_0xa13e('0x3a')]('phone\x20IS\x20NOT\x20NULL'))[_0xa13e('0x6f')]();}_0xf30953=squel[_0xa13e('0x65')]()['into'](_0xa13e('0x7c'))['fromQuery'](['cmHopperId',_0xa13e('0x69'),'phone','OrderBy',_0xa13e('0x51'),'updatedAt'],squel['select']()[_0xa13e('0x6c')](_0xa13e('0x7d'),'id')['field'](_0xa13e('0x6d'),_0xa13e('0x69'))[_0xa13e('0x6c')](_0xa13e('0x7e'),'phone')['field'](_0xa13e('0x7f'),'OrderBy')[_0xa13e('0x6c')]('\x27'+_0x2a56f9+'\x27',_0xa13e('0x51'))[_0xa13e('0x6c')]('\x27'+_0x2a56f9+'\x27',_0xa13e('0x50'))[_0xa13e('0x73')](_0xa13e('0x80'),'ci')[_0xa13e('0x81')](_0xa13e('0x66'),'h',_0xa13e('0x82'))[_0xa13e('0x3a')](_0xa13e('0x83'),_0x12399c[_0xa13e('0x6e')][_0xa13e('0x6f')]())[_0xa13e('0x3a')](_0xa13e('0x84'),_0x240232[_0xa13e('0x4b')]['id'][_0xa13e('0x6f')]())['where'](_0xa13e('0x85'),_0x2a56f9))[_0xa13e('0x6f')]();_0x1ffea2[_0xa13e('0x86')](db[_0xa13e('0x87')][_0xa13e('0x2f')](_0x449106));_0x338a00['push'](db[_0xa13e('0x87')][_0xa13e('0x2f')](_0xf30953));}return BPromise['all'](_0x1ffea2);}})[_0xa13e('0x20')](function(){return BPromise['all'](_0x338a00);})[_0xa13e('0x20')](function(){return _0x1a30d1;})[_0xa13e('0x20')](respondWithResult(_0x2af916,null))[_0xa13e('0x41')](handleError(_0x2af916,null));};exports['removeLists']=function(_0x48b5a6,_0x2680bc,_0x4db4ab){return db[_0xa13e('0x2a')][_0xa13e('0x4d')]({'where':{'id':_0x48b5a6['params']['id']}})[_0xa13e('0x20')](handleEntityNotFound(_0x2680bc,null))[_0xa13e('0x20')](function(_0x82421e){if(_0x82421e){return _0x82421e[_0xa13e('0x88')](_0x48b5a6['query'][_0xa13e('0x62')]);}})['then'](function(_0x4b8291){if(_0x4b8291){return db[_0xa13e('0x58')][_0xa13e('0x23')]({'where':{'ListId':_0x48b5a6[_0xa13e('0x2f')][_0xa13e('0x62')],'CampaignId':_0x48b5a6[_0xa13e('0x4b')]['id']}})[_0xa13e('0x20')](function(){return _0x4b8291;});}})['then'](respondWithStatusCode(_0x2680bc,null))[_0xa13e('0x41')](handleError(_0x2680bc,null));};exports[_0xa13e('0x89')]=function(_0x9ef5ef,_0x3ace49,_0x3c27cf){var _0x3d37d4={};var _0x56fcb9={};var _0x1235d2;var _0x3aa30d;return db['Campaign'][_0xa13e('0x8a')]({'where':{'id':_0x9ef5ef[_0xa13e('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3ace49,null))['then'](function(_0x531f45){if(_0x531f45){_0x1235d2=_0x531f45;_0x56fcb9[_0xa13e('0x2e')]=_[_0xa13e('0x43')](db[_0xa13e('0x8b')][_0xa13e('0x2b')]);_0x56fcb9[_0xa13e('0x2f')]=_[_0xa13e('0x43')](_0x9ef5ef[_0xa13e('0x2f')]);_0x56fcb9[_0xa13e('0x30')]=_[_0xa13e('0x31')](_0x56fcb9['model'],_0x56fcb9[_0xa13e('0x2f')]);_0x3d37d4[_0xa13e('0x32')]=_[_0xa13e('0x31')](_0x56fcb9['model'],qs['fields'](_0x9ef5ef[_0xa13e('0x2f')]['fields']));_0x3d37d4[_0xa13e('0x32')]=_0x3d37d4[_0xa13e('0x32')]['length']?_0x3d37d4[_0xa13e('0x32')]:_0x56fcb9[_0xa13e('0x2e')];_0x3d37d4[_0xa13e('0x36')]=qs[_0xa13e('0x37')](_0x9ef5ef['query'][_0xa13e('0x37')]);_0x3d37d4[_0xa13e('0x3a')]=qs['filters'](_['pick'](_0x9ef5ef[_0xa13e('0x2f')],_0x56fcb9[_0xa13e('0x30')]));if(_0x9ef5ef[_0xa13e('0x2f')]['filter']){_0x3d37d4[_0xa13e('0x3a')]=_[_0xa13e('0x3b')](_0x3d37d4[_0xa13e('0x3a')],{'$or':_[_0xa13e('0x29')](_0x3d37d4[_0xa13e('0x32')],function(_0x175c3d){var _0x4c0ce2={};_0x4c0ce2[_0x175c3d]={'$like':'%'+_0x9ef5ef[_0xa13e('0x2f')][_0xa13e('0x39')]+'%'};return _0x4c0ce2;})});}_0x3d37d4=_['merge']({},_0x3d37d4,_0x9ef5ef[_0xa13e('0x57')]);return _0x1235d2[_0xa13e('0x89')](_0x3d37d4);}})[_0xa13e('0x20')](function(_0x20888d){if(_0x20888d){_0x3aa30d=_0x20888d[_0xa13e('0x4c')];if(!_0x9ef5ef[_0xa13e('0x2f')][_0xa13e('0x34')](_0xa13e('0x35'))){_0x3d37d4[_0xa13e('0x1b')]=qs[_0xa13e('0x1b')](_0x9ef5ef[_0xa13e('0x2f')][_0xa13e('0x1b')]);_0x3d37d4[_0xa13e('0x18')]=qs[_0xa13e('0x18')](_0x9ef5ef[_0xa13e('0x2f')][_0xa13e('0x18')]);}return _0x1235d2['getBlackLists'](_0x3d37d4);}})[_0xa13e('0x20')](function(_0x2d67e5){if(_0x2d67e5){return _0x2d67e5?{'count':_0x3aa30d,'rows':_0x2d67e5}:null;}})['then'](respondWithResult(_0x3ace49,null))['catch'](handleError(_0x3ace49,null));};exports[_0xa13e('0x8c')]=function(_0x39de9d,_0xad3cd9,_0x18997c){var _0x568103,_0x53ed1a;var _0x1e7974=[];var _0x2055f2=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');return db[_0xa13e('0x2a')][_0xa13e('0x4d')]({'where':{'id':_0x39de9d['params']['id']}})[_0xa13e('0x20')](handleEntityNotFound(_0xad3cd9,null))[_0xa13e('0x20')](function(_0x144081){if(_0x144081){_0x53ed1a=_0x144081;return _0x144081[_0xa13e('0x8c')](_0x39de9d[_0xa13e('0x46')]['ids'],_[_0xa13e('0x4f')](_0x39de9d[_0xa13e('0x46')],[_0xa13e('0x62'),'id'])||{});}return null;})['spread'](function(_0x36c380){var _0x39f19e;var _0x5a137c;_0x568103=_0x36c380||[];var _0x7e2407=[];if(_0x36c380){for(var _0x22cf3f=0x0;_0x22cf3f<_0x36c380[_0xa13e('0x4c')];_0x22cf3f+=0x1){var _0x1a9d0b=_0x36c380[_0x22cf3f]['get']({'plain':!![]});_0x39f19e=squel['insert']()[_0xa13e('0x78')](_0xa13e('0x8d'))[_0xa13e('0x67')]([_0xa13e('0x68'),'ContactId',_0xa13e('0x70'),_0xa13e('0x56'),'createdAt','updatedAt'],squel[_0xa13e('0x6b')]()['field']('phone',_0xa13e('0x68'))['field']('id',_0xa13e('0x6a'))[_0xa13e('0x6c')](_0x1a9d0b[_0xa13e('0x6e')][_0xa13e('0x6f')](),_0xa13e('0x70'))[_0xa13e('0x6c')](_0x39de9d[_0xa13e('0x4b')]['id']['toString'](),'CampaignId')['field']('NOW()',_0xa13e('0x51'))['field'](_0xa13e('0x6d'),'updatedAt')[_0xa13e('0x73')](_0xa13e('0x7a'))[_0xa13e('0x3a')](_0xa13e('0x7b'))['where'](_0xa13e('0x71'),_0x1a9d0b[_0xa13e('0x6e')][_0xa13e('0x6f')]())['where'](_0xa13e('0x79')))[_0xa13e('0x6f')]();_0x7e2407[_0xa13e('0x86')](db[_0xa13e('0x87')][_0xa13e('0x2f')](_0x39f19e));}return BPromise[_0xa13e('0x8e')](_0x7e2407);}})['then'](function(){return _0x568103;})[_0xa13e('0x20')](respondWithResult(_0xad3cd9,null))['catch'](handleError(_0xad3cd9,null));};exports['removeBlackLists']=function(_0x1ccf44,_0xc645c2,_0x144e3b){return db['Campaign']['find']({'where':{'id':_0x1ccf44[_0xa13e('0x4b')]['id']}})[_0xa13e('0x20')](handleEntityNotFound(_0xc645c2,null))[_0xa13e('0x20')](function(_0x1ca7f3){if(_0x1ca7f3){return _0x1ca7f3[_0xa13e('0x8f')](_0x1ccf44['query']['ids']);}})['then'](function(_0x122a71){if(_0x122a71){return db[_0xa13e('0x5d')][_0xa13e('0x23')]({'where':{'ListId':_0x1ccf44[_0xa13e('0x2f')]['ids'],'CampaignId':_0x1ccf44[_0xa13e('0x4b')]['id']}})[_0xa13e('0x20')](function(){return _0x122a71;});}})['then'](respondWithStatusCode(_0xc645c2,null))[_0xa13e('0x41')](handleError(_0xc645c2,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index db96bf1..07d038b 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(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_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 _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x4c2a8c,_0x1df943){var _0x5d734f=function(_0x1c44f5){while(--_0x1c44f5){_0x4c2a8c['push'](_0x4c2a8c['shift']());}};_0x5d734f(++_0x1df943);}(_0x7a54,0x106));var _0x47a5=function(_0x4f9ca5,_0x42a802){_0x4f9ca5=_0x4f9ca5-0x0;var _0x4e0c9c=_0x7a54[_0x4f9ca5];return _0x4e0c9c;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index a1903e7..fc62beb 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 _0x3eec=['debug','Campaign,\x20%s,\x20%s,\x20%s','error','code','message','Campaign,\x20%s,\x20%s','info','result','catch','GetCampaign','Campaign','findAll','options','raw','where','attributes','limit','include','map','model','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','request\x20sent'];(function(_0x22e2f1,_0xae1e65){var _0x495d2d=function(_0x3e1f5){while(--_0x3e1f5){_0x22e2f1['push'](_0x22e2f1['shift']());}};_0x495d2d(++_0xae1e65);}(_0x3eec,0x1e9));var _0xc3ee=function(_0x12b5fa,_0x563c6c){_0x12b5fa=_0x12b5fa-0x0;var _0x1cef10=_0x3eec[_0x12b5fa];return _0x1cef10;};'use strict';var _=require(_0xc3ee('0x0'));var util=require(_0xc3ee('0x1'));var moment=require(_0xc3ee('0x2'));var BPromise=require(_0xc3ee('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc3ee('0x4'));var db=require(_0xc3ee('0x5'))['db'];var utils=require(_0xc3ee('0x6'));var logger=require(_0xc3ee('0x7'))(_0xc3ee('0x8'));var config=require(_0xc3ee('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xc3ee('0xa')][_0xc3ee('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xea4318,_0x2cc750,_0x356374){return new BPromise(function(_0x3d74c0,_0xd88f6){return client[_0xc3ee('0xc')](_0xea4318,_0x356374)[_0xc3ee('0xd')](function(_0x23e9c0){logger['info']('Campaign,\x20%s,\x20%s',_0x2cc750,_0xc3ee('0xe'));logger[_0xc3ee('0xf')](_0xc3ee('0x10'),_0x2cc750,_0xc3ee('0xe'),JSON['stringify'](_0x23e9c0));if(_0x23e9c0[_0xc3ee('0x11')]){if(_0x23e9c0['error'][_0xc3ee('0x12')]===0x1f4){logger[_0xc3ee('0x11')]('Campaign,\x20%s,\x20%s',_0x2cc750,_0x23e9c0['error'][_0xc3ee('0x13')]);return _0xd88f6(_0x23e9c0['error'][_0xc3ee('0x13')]);}logger['error'](_0xc3ee('0x14'),_0x2cc750,_0x23e9c0['error'][_0xc3ee('0x13')]);return _0x3d74c0(_0x23e9c0[_0xc3ee('0x11')][_0xc3ee('0x13')]);}else{logger[_0xc3ee('0x15')](_0xc3ee('0x14'),_0x2cc750,_0xc3ee('0xe'));_0x3d74c0(_0x23e9c0[_0xc3ee('0x16')]['message']);}})[_0xc3ee('0x17')](function(_0x4eea89){logger[_0xc3ee('0x11')](_0xc3ee('0x14'),_0x2cc750,_0x4eea89);_0xd88f6(_0x4eea89);});});}exports[_0xc3ee('0x18')]=function(_0x219db0){var _0x304889=this;return new Promise(function(_0x3acb0c,_0xd4b414){return db[_0xc3ee('0x19')][_0xc3ee('0x1a')]({'raw':_0x219db0[_0xc3ee('0x1b')]?_0x219db0[_0xc3ee('0x1b')][_0xc3ee('0x1c')]===undefined?!![]:![]:!![],'where':_0x219db0[_0xc3ee('0x1b')]?_0x219db0[_0xc3ee('0x1b')][_0xc3ee('0x1d')]||null:null,'attributes':_0x219db0[_0xc3ee('0x1b')]?_0x219db0[_0xc3ee('0x1b')][_0xc3ee('0x1e')]||null:null,'limit':_0x219db0[_0xc3ee('0x1b')]?_0x219db0[_0xc3ee('0x1b')][_0xc3ee('0x1f')]||null:null,'include':_0x219db0['options']?_0x219db0['options'][_0xc3ee('0x20')]?_[_0xc3ee('0x21')](_0x219db0[_0xc3ee('0x1b')][_0xc3ee('0x20')],function(_0x28bfeb){return{'model':db[_0x28bfeb[_0xc3ee('0x22')]],'as':_0x28bfeb['as'],'attributes':_0x28bfeb['attributes'],'include':_0x28bfeb[_0xc3ee('0x20')]?_[_0xc3ee('0x21')](_0x28bfeb[_0xc3ee('0x20')],function(_0xfd03bd){return{'model':db[_0xfd03bd[_0xc3ee('0x22')]],'as':_0xfd03bd['as'],'attributes':_0xfd03bd['attributes'],'include':_0xfd03bd['include']?_[_0xc3ee('0x21')](_0xfd03bd[_0xc3ee('0x20')],function(_0x3d8c79){return{'model':db[_0x3d8c79[_0xc3ee('0x22')]],'as':_0x3d8c79['as'],'attributes':_0x3d8c79[_0xc3ee('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x56201a){logger['info'](_0xc3ee('0x18'),_0x219db0);logger[_0xc3ee('0xf')](_0xc3ee('0x18'),_0x219db0,JSON[_0xc3ee('0x23')](_0x56201a));_0x3acb0c(_0x56201a);})[_0xc3ee('0x17')](function(_0x50ffaa){logger[_0xc3ee('0x11')](_0xc3ee('0x18'),_0x50ffaa[_0xc3ee('0x13')],_0x219db0);_0xd4b414(_0x304889[_0xc3ee('0x11')](0x1f4,_0x50ffaa[_0xc3ee('0x13')]));});});}; \ No newline at end of file +var _0x47d6=['error','code','message','catch','GetCampaign','Campaign','findAll','options','raw','where','attributes','limit','include','model','map','debug','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','Campaign,\x20%s,\x20%s','request\x20sent','Campaign,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x48b355,_0x2dc37d){var _0x124e15=function(_0x4efdf5){while(--_0x4efdf5){_0x48b355['push'](_0x48b355['shift']());}};_0x124e15(++_0x2dc37d);}(_0x47d6,0x1de));var _0x647d=function(_0x41a502,_0x1adab8){_0x41a502=_0x41a502-0x0;var _0x4c5136=_0x47d6[_0x41a502];return _0x4c5136;};'use strict';var _=require(_0x647d('0x0'));var util=require(_0x647d('0x1'));var moment=require(_0x647d('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x647d('0x3'));var db=require(_0x647d('0x4'))['db'];var utils=require(_0x647d('0x5'));var logger=require('../../config/logger')(_0x647d('0x6'));var config=require(_0x647d('0x7'));var jayson=require(_0x647d('0x8'));var client=jayson['client'][_0x647d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2a77b3,_0xeab7f7,_0xe5937){return new BPromise(function(_0x2a9508,_0x11a337){return client[_0x647d('0xa')](_0x2a77b3,_0xe5937)[_0x647d('0xb')](function(_0x3ed97f){logger[_0x647d('0xc')](_0x647d('0xd'),_0xeab7f7,_0x647d('0xe'));logger['debug'](_0x647d('0xf'),_0xeab7f7,_0x647d('0xe'),JSON[_0x647d('0x10')](_0x3ed97f));if(_0x3ed97f[_0x647d('0x11')]){if(_0x3ed97f[_0x647d('0x11')][_0x647d('0x12')]===0x1f4){logger[_0x647d('0x11')](_0x647d('0xd'),_0xeab7f7,_0x3ed97f[_0x647d('0x11')][_0x647d('0x13')]);return _0x11a337(_0x3ed97f[_0x647d('0x11')][_0x647d('0x13')]);}logger[_0x647d('0x11')]('Campaign,\x20%s,\x20%s',_0xeab7f7,_0x3ed97f[_0x647d('0x11')][_0x647d('0x13')]);return _0x2a9508(_0x3ed97f[_0x647d('0x11')]['message']);}else{logger[_0x647d('0xc')]('Campaign,\x20%s,\x20%s',_0xeab7f7,_0x647d('0xe'));_0x2a9508(_0x3ed97f['result'][_0x647d('0x13')]);}})[_0x647d('0x14')](function(_0x598186){logger[_0x647d('0x11')]('Campaign,\x20%s,\x20%s',_0xeab7f7,_0x598186);_0x11a337(_0x598186);});});}exports[_0x647d('0x15')]=function(_0x30a107){var _0x15aa16=this;return new Promise(function(_0x407788,_0x2123d1){return db[_0x647d('0x16')][_0x647d('0x17')]({'raw':_0x30a107[_0x647d('0x18')]?_0x30a107[_0x647d('0x18')][_0x647d('0x19')]===undefined?!![]:![]:!![],'where':_0x30a107[_0x647d('0x18')]?_0x30a107[_0x647d('0x18')][_0x647d('0x1a')]||null:null,'attributes':_0x30a107[_0x647d('0x18')]?_0x30a107[_0x647d('0x18')][_0x647d('0x1b')]||null:null,'limit':_0x30a107[_0x647d('0x18')]?_0x30a107[_0x647d('0x18')][_0x647d('0x1c')]||null:null,'include':_0x30a107['options']?_0x30a107[_0x647d('0x18')][_0x647d('0x1d')]?_['map'](_0x30a107[_0x647d('0x18')][_0x647d('0x1d')],function(_0x1f4c09){return{'model':db[_0x1f4c09[_0x647d('0x1e')]],'as':_0x1f4c09['as'],'attributes':_0x1f4c09['attributes'],'include':_0x1f4c09[_0x647d('0x1d')]?_[_0x647d('0x1f')](_0x1f4c09[_0x647d('0x1d')],function(_0x2a974c){return{'model':db[_0x2a974c[_0x647d('0x1e')]],'as':_0x2a974c['as'],'attributes':_0x2a974c['attributes'],'include':_0x2a974c[_0x647d('0x1d')]?_[_0x647d('0x1f')](_0x2a974c[_0x647d('0x1d')],function(_0x4499b2){return{'model':db[_0x4499b2[_0x647d('0x1e')]],'as':_0x4499b2['as'],'attributes':_0x4499b2[_0x647d('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x647d('0xb')](function(_0x26086e){logger['info']('GetCampaign',_0x30a107);logger[_0x647d('0x20')](_0x647d('0x15'),_0x30a107,JSON[_0x647d('0x10')](_0x26086e));_0x407788(_0x26086e);})[_0x647d('0x14')](function(_0xefdb81){logger[_0x647d('0x11')](_0x647d('0x15'),_0xefdb81[_0x647d('0x13')],_0x30a107);_0x2123d1(_0x15aa16[_0x647d('0x11')](0x1f4,_0xefdb81[_0x647d('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index a6894af..38abf63 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 _0xa47e=['getLists','/:id/blacklists','getBlackLists','create','post','/:id/clone','clone','addLists','addBlackLists','put','update','delete','removeLists','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','isAuthenticated','index','/:id','show','get','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','/:id/lists'];(function(_0x4dab14,_0x164ea0){var _0xf41aa=function(_0x305d50){while(--_0x305d50){_0x4dab14['push'](_0x4dab14['shift']());}};_0xf41aa(++_0x164ea0);}(_0xa47e,0x9a));var _0xea47=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa47e[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xea47('0x0'));var util=require(_0xea47('0x1'));var path=require('path');var timeout=require(_0xea47('0x2'));var express=require(_0xea47('0x3'));var router=express[_0xea47('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xea47('0x5'));var interaction=require(_0xea47('0x6'));var config=require(_0xea47('0x7'));var controller=require(_0xea47('0x8'));router['get']('/',auth[_0xea47('0x9')](),controller[_0xea47('0xa')]);router['get'](_0xea47('0xb'),auth[_0xea47('0x9')](),controller[_0xea47('0xc')]);router[_0xea47('0xd')]('/:id/hoppers',auth[_0xea47('0x9')](),controller[_0xea47('0xe')]);router[_0xea47('0xd')](_0xea47('0xf'),auth['isAuthenticated'](),controller[_0xea47('0x10')]);router['get'](_0xea47('0x11'),auth['isAuthenticated'](),controller[_0xea47('0x12')]);router[_0xea47('0xd')](_0xea47('0x13'),auth[_0xea47('0x9')](),controller['getHopperBlacks']);router[_0xea47('0xd')](_0xea47('0x14'),auth['isAuthenticated'](),controller[_0xea47('0x15')]);router['get'](_0xea47('0x16'),auth[_0xea47('0x9')](),controller[_0xea47('0x17')]);router['post']('/',auth['isAuthenticated'](),controller[_0xea47('0x18')]);router[_0xea47('0x19')](_0xea47('0x1a'),auth[_0xea47('0x9')](),controller[_0xea47('0x1b')]);router[_0xea47('0x19')](_0xea47('0x14'),auth[_0xea47('0x9')](),controller[_0xea47('0x1c')]);router[_0xea47('0x19')]('/:id/blacklists',auth[_0xea47('0x9')](),controller[_0xea47('0x1d')]);router[_0xea47('0x1e')]('/:id',auth[_0xea47('0x9')](),controller[_0xea47('0x1f')]);router[_0xea47('0x20')](_0xea47('0xb'),auth['isAuthenticated'](),controller['destroy']);router[_0xea47('0x20')](_0xea47('0x14'),auth[_0xea47('0x9')](),controller[_0xea47('0x21')]);router['delete'](_0xea47('0x16'),auth['isAuthenticated'](),controller['removeBlackLists']);module[_0xea47('0x22')]=router; \ No newline at end of file +var _0x826a=['/:id/blacklists','create','clone','post','addLists','put','destroy','delete','removeLists','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./campaign.controller','get','isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists'];(function(_0x38c4ca,_0x56fa50){var _0x3b30be=function(_0x203bb1){while(--_0x203bb1){_0x38c4ca['push'](_0x38c4ca['shift']());}};_0x3b30be(++_0x56fa50);}(_0x826a,0x1aa));var _0xa826=function(_0x4b255b,_0x4615ef){_0x4b255b=_0x4b255b-0x0;var _0x4d7392=_0x826a[_0x4b255b];return _0x4d7392;};'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('0x7')](_0xa826('0xe'),auth[_0xa826('0x8')](),controller[_0xa826('0xf')]);router['get'](_0xa826('0x10'),auth['isAuthenticated'](),controller[_0xa826('0x11')]);router[_0xa826('0x7')](_0xa826('0x12'),auth[_0xa826('0x8')](),controller[_0xa826('0x13')]);router[_0xa826('0x7')](_0xa826('0x14'),auth['isAuthenticated'](),controller[_0xa826('0x15')]);router['get'](_0xa826('0x16'),auth[_0xa826('0x8')](),controller['getBlackLists']);router['post']('/',auth['isAuthenticated'](),controller[_0xa826('0x17')]);router['post']('/:id/clone',auth[_0xa826('0x8')](),controller[_0xa826('0x18')]);router[_0xa826('0x19')]('/:id/lists',auth[_0xa826('0x8')](),controller[_0xa826('0x1a')]);router[_0xa826('0x19')](_0xa826('0x16'),auth[_0xa826('0x8')](),controller['addBlackLists']);router[_0xa826('0x1b')](_0xa826('0xa'),auth[_0xa826('0x8')](),controller['update']);router['delete'](_0xa826('0xa'),auth[_0xa826('0x8')](),controller[_0xa826('0x1c')]);router[_0xa826('0x1d')](_0xa826('0x14'),auth['isAuthenticated'](),controller[_0xa826('0x1e')]);router[_0xa826('0x1d')](_0xa826('0x16'),auth['isAuthenticated'](),controller['removeBlackLists']);module[_0xa826('0x1f')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 6311d4a..5d02ead 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 _0x835e=['TEXT','getDataValue','key','sequelize','exports'];(function(_0x244653,_0xc5c030){var _0xa3776c=function(_0x69a3a4){while(--_0x69a3a4){_0x244653['push'](_0x244653['shift']());}};_0xa3776c(++_0xc5c030);}(_0x835e,0x71));var _0xe835=function(_0x55034f,_0x8b08a6){_0x55034f=_0x55034f-0x0;var _0x124a13=_0x835e[_0x55034f];return _0x124a13;};'use strict';var Sequelize=require(_0xe835('0x0'));module[_0xe835('0x1')]={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0xe835('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xe835('0x3')](_0xe835('0x4'));}}}; \ No newline at end of file +var _0x6d3c=['getDataValue','key','sequelize','exports','TEXT','STRING'];(function(_0x586e4e,_0x48d0bd){var _0xbe54fa=function(_0x538c1b){while(--_0x538c1b){_0x586e4e['push'](_0x586e4e['shift']());}};_0xbe54fa(++_0x48d0bd);}(_0x6d3c,0x176));var _0xc6d3=function(_0x26a09a,_0x335c58){_0x26a09a=_0x26a09a-0x0;var _0x2ec847=_0x6d3c[_0x26a09a];return _0x2ec847;};'use strict';var Sequelize=require(_0xc6d3('0x0'));module[_0xc6d3('0x1')]={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0xc6d3('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xc6d3('0x3')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xc6d3('0x4')](_0xc6d3('0x5'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 3ea57a0..5ed1281 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 _0xfbbb=['destroy','then','get','UserProfileResource','error','stack','name','send','map','CannedAnswer','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','params','options','find','body','create','key','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CannedAnswers','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','fs-extra','lodash','squel','crypto','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','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update'];(function(_0x5c0967,_0x1412b6){var _0x3403ac=function(_0x20e400){while(--_0x20e400){_0x5c0967['push'](_0x5c0967['shift']());}};_0x3403ac(++_0x1412b6);}(_0xfbbb,0x147));var _0xbfbb=function(_0x52e4fc,_0x42843f){_0x52e4fc=_0x52e4fc-0x0;var _0x1816fe=_0xfbbb[_0x52e4fc];return _0x1816fe;};'use strict';var emlformat=require(_0xbfbb('0x0'));var rimraf=require(_0xbfbb('0x1'));var zipdir=require(_0xbfbb('0x2'));var jsonpatch=require(_0xbfbb('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xbfbb('0x4'));var Mustache=require('mustache');var util=require(_0xbfbb('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(_0xbfbb('0x6'));var _=require(_0xbfbb('0x7'));var squel=require(_0xbfbb('0x8'));var crypto=require(_0xbfbb('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xbfbb('0xa'));var toCsv=require(_0xbfbb('0xb'));var querystring=require(_0xbfbb('0xc'));var Papa=require(_0xbfbb('0xd'));var Redis=require('ioredis');var authService=require(_0xbfbb('0xe'));var qs=require(_0xbfbb('0xf'));var as=require(_0xbfbb('0x10'));var hardwareService=require(_0xbfbb('0x11'));var logger=require(_0xbfbb('0x12'))(_0xbfbb('0x13'));var utils=require(_0xbfbb('0x14'));var config=require(_0xbfbb('0x15'));var licenseUtil=require(_0xbfbb('0x16'));var db=require(_0xbfbb('0x17'))['db'];function respondWithStatusCode(_0x5e848b,_0x5829b6){_0x5829b6=_0x5829b6||0xcc;return function(_0x1f39c4){if(_0x1f39c4){return _0x5e848b[_0xbfbb('0x18')](_0x5829b6);}return _0x5e848b[_0xbfbb('0x19')](_0x5829b6)[_0xbfbb('0x1a')]();};}function respondWithResult(_0x4f775e,_0x449007){_0x449007=_0x449007||0xc8;return function(_0xa7e8cb){if(_0xa7e8cb){return _0x4f775e['status'](_0x449007)['json'](_0xa7e8cb);}};}function respondWithFilteredResult(_0x4d81d3,_0x403ed8){return function(_0x3d8061){if(_0x3d8061){var _0x3e6510=typeof _0x403ed8[_0xbfbb('0x1b')]===_0xbfbb('0x1c')&&typeof _0x403ed8['limit']===_0xbfbb('0x1c');var _0x33ba70=_0x3d8061['count'];var _0x1f03b1=_0x3e6510?0x0:_0x403ed8[_0xbfbb('0x1b')];var _0x56139b=_0x3e6510?_0x3d8061[_0xbfbb('0x1d')]:_0x403ed8[_0xbfbb('0x1b')]+_0x403ed8[_0xbfbb('0x1e')];var _0x468bdf;if(_0x56139b>=_0x33ba70){_0x56139b=_0x33ba70;_0x468bdf=0xc8;}else{_0x468bdf=0xce;}_0x4d81d3[_0xbfbb('0x19')](_0x468bdf);return _0x4d81d3[_0xbfbb('0x1f')](_0xbfbb('0x20'),_0x1f03b1+'-'+_0x56139b+'/'+_0x33ba70)['json'](_0x3d8061);}return null;};}function patchUpdates(_0x50e766){return function(_0x3328fb){try{jsonpatch[_0xbfbb('0x21')](_0x3328fb,_0x50e766,!![]);}catch(_0x53ccc7){return BPromise[_0xbfbb('0x22')](_0x53ccc7);}return _0x3328fb[_0xbfbb('0x23')]();};}function saveUpdates(_0x2ab8f8,_0x1d1d80){return function(_0x458ec1){if(_0x458ec1){return _0x458ec1[_0xbfbb('0x24')](_0x2ab8f8)['then'](function(_0x580026){return _0x580026;});}return null;};}function removeEntity(_0x5af9bd,_0xa6d85e){return function(_0x6613eb){if(_0x6613eb){return _0x6613eb[_0xbfbb('0x25')]()[_0xbfbb('0x26')](function(){var _0x2e89f9=_0x6613eb[_0xbfbb('0x27')]({'plain':!![]});var _0x54877b='CannedAnswers';return db[_0xbfbb('0x28')][_0xbfbb('0x25')]({'where':{'type':_0x54877b,'resourceId':_0x2e89f9['id']}})[_0xbfbb('0x26')](function(){return _0x6613eb;});})[_0xbfbb('0x26')](function(){_0x5af9bd[_0xbfbb('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x46b269,_0x31a74c){return function(_0x2394f7){if(!_0x2394f7){_0x46b269['sendStatus'](0x194);}return _0x2394f7;};}function handleError(_0x421f1f,_0x2a43bf){_0x2a43bf=_0x2a43bf||0x1f4;return function(_0x545140){logger[_0xbfbb('0x29')](_0x545140[_0xbfbb('0x2a')]);if(_0x545140[_0xbfbb('0x2b')]){delete _0x545140[_0xbfbb('0x2b')];}_0x421f1f[_0xbfbb('0x19')](_0x2a43bf)[_0xbfbb('0x2c')](_0x545140);};}exports['index']=function(_0x345bf8,_0x4a6c8a){var _0x344b73={},_0x3304a0={},_0x1c4c16={'count':0x0,'rows':[]};var _0x22f90c=_[_0xbfbb('0x2d')](db[_0xbfbb('0x2e')][_0xbfbb('0x2f')],function(_0x267c1c){return{'name':_0x267c1c[_0xbfbb('0x30')],'type':_0x267c1c[_0xbfbb('0x31')]['key']};});_0x3304a0[_0xbfbb('0x32')]=_[_0xbfbb('0x2d')](_0x22f90c,'name');_0x3304a0[_0xbfbb('0x33')]=_[_0xbfbb('0x34')](_0x345bf8[_0xbfbb('0x33')]);_0x3304a0[_0xbfbb('0x35')]=_[_0xbfbb('0x36')](_0x3304a0[_0xbfbb('0x32')],_0x3304a0[_0xbfbb('0x33')]);_0x344b73[_0xbfbb('0x37')]=_[_0xbfbb('0x36')](_0x3304a0[_0xbfbb('0x32')],qs[_0xbfbb('0x38')](_0x345bf8[_0xbfbb('0x33')][_0xbfbb('0x38')]));_0x344b73['attributes']=_0x344b73[_0xbfbb('0x37')][_0xbfbb('0x39')]?_0x344b73[_0xbfbb('0x37')]:_0x3304a0['model'];if(!_0x345bf8['query'][_0xbfbb('0x3a')](_0xbfbb('0x3b'))){_0x344b73[_0xbfbb('0x1e')]=qs[_0xbfbb('0x1e')](_0x345bf8[_0xbfbb('0x33')][_0xbfbb('0x1e')]);_0x344b73[_0xbfbb('0x1b')]=qs[_0xbfbb('0x1b')](_0x345bf8[_0xbfbb('0x33')][_0xbfbb('0x1b')]);}_0x344b73['order']=qs[_0xbfbb('0x3c')](_0x345bf8['query']['sort']);_0x344b73[_0xbfbb('0x3d')]=qs[_0xbfbb('0x35')](_[_0xbfbb('0x3e')](_0x345bf8[_0xbfbb('0x33')],_0x3304a0[_0xbfbb('0x35')]),_0x22f90c);if(_0x345bf8[_0xbfbb('0x33')][_0xbfbb('0x3f')]){_0x344b73[_0xbfbb('0x3d')]=_[_0xbfbb('0x40')](_0x344b73[_0xbfbb('0x3d')],{'$or':[{'key':{'$like':'%'+_0x345bf8[_0xbfbb('0x33')][_0xbfbb('0x3f')]+'%'}},{'value':{'$like':'%'+_0x345bf8[_0xbfbb('0x33')][_0xbfbb('0x3f')]+'%'}}]});}_0x344b73=_['merge']({},_0x344b73,_0x345bf8['options']);var _0x496127={'where':_0x344b73[_0xbfbb('0x3d')]};return db[_0xbfbb('0x2e')][_0xbfbb('0x1d')](_0x496127)['then'](function(_0x5594a7){_0x1c4c16['count']=_0x5594a7;if(_0x345bf8[_0xbfbb('0x33')][_0xbfbb('0x41')]){_0x344b73[_0xbfbb('0x42')]=[{'all':!![]}];}return db[_0xbfbb('0x2e')][_0xbfbb('0x43')](_0x344b73);})[_0xbfbb('0x26')](function(_0x541f46){_0x1c4c16[_0xbfbb('0x44')]=_0x541f46;return _0x1c4c16;})[_0xbfbb('0x26')](respondWithFilteredResult(_0x4a6c8a,_0x344b73))[_0xbfbb('0x45')](handleError(_0x4a6c8a,null));};exports[_0xbfbb('0x46')]=function(_0x2bbf6a,_0x2bdf1f){var _0x54aa77={'raw':!![],'where':{'id':_0x2bbf6a[_0xbfbb('0x47')]['id']}},_0x51544e={};_0x51544e[_0xbfbb('0x32')]=_[_0xbfbb('0x34')](db[_0xbfbb('0x2e')][_0xbfbb('0x2f')]);_0x51544e[_0xbfbb('0x33')]=_[_0xbfbb('0x34')](_0x2bbf6a[_0xbfbb('0x33')]);_0x51544e[_0xbfbb('0x35')]=_[_0xbfbb('0x36')](_0x51544e[_0xbfbb('0x32')],_0x51544e[_0xbfbb('0x33')]);_0x54aa77[_0xbfbb('0x37')]=_['intersection'](_0x51544e[_0xbfbb('0x32')],qs[_0xbfbb('0x38')](_0x2bbf6a[_0xbfbb('0x33')][_0xbfbb('0x38')]));_0x54aa77[_0xbfbb('0x37')]=_0x54aa77[_0xbfbb('0x37')][_0xbfbb('0x39')]?_0x54aa77[_0xbfbb('0x37')]:_0x51544e[_0xbfbb('0x32')];if(_0x2bbf6a['query'][_0xbfbb('0x41')]){_0x54aa77[_0xbfbb('0x42')]=[{'all':!![]}];}_0x54aa77=_[_0xbfbb('0x40')]({},_0x54aa77,_0x2bbf6a[_0xbfbb('0x48')]);return db[_0xbfbb('0x2e')][_0xbfbb('0x49')](_0x54aa77)[_0xbfbb('0x26')](handleEntityNotFound(_0x2bdf1f,null))['then'](respondWithResult(_0x2bdf1f,null))[_0xbfbb('0x45')](handleError(_0x2bdf1f,null));};exports[_0xbfbb('0x24')]=function(_0x270248,_0x570ec7){if(_0x270248[_0xbfbb('0x4a')]['id']){delete _0x270248['body']['id'];}return db['CannedAnswer'][_0xbfbb('0x49')]({'where':{'id':_0x270248[_0xbfbb('0x47')]['id']}})[_0xbfbb('0x26')](handleEntityNotFound(_0x570ec7,null))[_0xbfbb('0x26')](saveUpdates(_0x270248['body'],null))[_0xbfbb('0x26')](respondWithResult(_0x570ec7,null))['catch'](handleError(_0x570ec7,null));};exports[_0xbfbb('0x25')]=function(_0x4617c7,_0x5a1783){return db[_0xbfbb('0x2e')][_0xbfbb('0x49')]({'where':{'id':_0x4617c7['params']['id']}})[_0xbfbb('0x26')](handleEntityNotFound(_0x5a1783,null))['then'](removeEntity(_0x5a1783,null))[_0xbfbb('0x45')](handleError(_0x5a1783,null));};exports[_0xbfbb('0x4b')]=function(_0x5c3418,_0x54cc21){var _0x32d0cf={'key':_0x5c3418[_0xbfbb('0x4a')][_0xbfbb('0x4c')]};if(_0x5c3418[_0xbfbb('0x4a')][_0xbfbb('0x4d')]){_0x32d0cf[_0xbfbb('0x4d')]=_0x5c3418[_0xbfbb('0x4a')][_0xbfbb('0x4d')];}else if(_0x5c3418[_0xbfbb('0x4a')][_0xbfbb('0x4e')]){_0x32d0cf[_0xbfbb('0x4e')]=_0x5c3418[_0xbfbb('0x4a')]['SmsAccountId'];}else if(_0x5c3418['body']['OpenchannelAccountId']){_0x32d0cf[_0xbfbb('0x4f')]=_0x5c3418[_0xbfbb('0x4a')]['OpenchannelAccountId'];}else if(_0x5c3418[_0xbfbb('0x4a')][_0xbfbb('0x50')]){_0x32d0cf[_0xbfbb('0x50')]=_0x5c3418['body'][_0xbfbb('0x50')];}return db[_0xbfbb('0x2e')][_0xbfbb('0x49')]({'where':_0x32d0cf})[_0xbfbb('0x26')](function(_0x7c85a4){if(_0x7c85a4){throw new db[(_0xbfbb('0x51'))][(_0xbfbb('0x52'))](_0xbfbb('0x53'));}return db[_0xbfbb('0x2e')][_0xbfbb('0x4b')](_0x5c3418[_0xbfbb('0x4a')]);})['then'](function(_0x34e83e){var _0x3f71d1=_0x5c3418[_0xbfbb('0x54')]['get']({'plain':!![]});if(!_0x3f71d1)throw new Error(_0xbfbb('0x55'));if(_0x3f71d1[_0xbfbb('0x56')]===_0xbfbb('0x54')){var _0x470e5f=_0x34e83e[_0xbfbb('0x27')]({'plain':!![]});return db['UserProfileSection'][_0xbfbb('0x49')]({'where':{'name':_0xbfbb('0x57'),'userProfileId':_0x3f71d1[_0xbfbb('0x58')]},'raw':!![]})[_0xbfbb('0x26')](function(_0x2183c2){if(_0x2183c2&&_0x2183c2[_0xbfbb('0x59')]===0x0){return db[_0xbfbb('0x28')][_0xbfbb('0x4b')]({'name':_0x470e5f[_0xbfbb('0x2b')],'resourceId':_0x470e5f['id'],'type':_0x2183c2[_0xbfbb('0x2b')],'sectionId':_0x2183c2['id']},{})[_0xbfbb('0x26')](function(){return _0x34e83e;});}else{return _0x34e83e;}})[_0xbfbb('0x45')](function(_0x2af38a){logger[_0xbfbb('0x29')](_0xbfbb('0x5a'),_0x2af38a);throw _0x2af38a;});}return _0x34e83e;})[_0xbfbb('0x26')](respondWithResult(_0x54cc21,0xc9))[_0xbfbb('0x45')](handleError(_0x54cc21,null));}; \ No newline at end of file +var _0xf322=['fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','where','pick','filter','merge','options','includeAll','CannedAnswer','findAll','rows','catch','show','include','body','find','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','then','get','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes'];(function(_0x13facd,_0x202f99){var _0x106558=function(_0x37f3ed){while(--_0x37f3ed){_0x13facd['push'](_0x13facd['shift']());}};_0x106558(++_0x202f99);}(_0xf322,0xd3));var _0x2f32=function(_0x4f545a,_0x223855){_0x4f545a=_0x4f545a-0x0;var _0xbe2517=_0xf322[_0x4f545a];return _0xbe2517;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2f32('0x0'));var zipdir=require(_0x2f32('0x1'));var jsonpatch=require(_0x2f32('0x2'));var rp=require('request-promise');var moment=require(_0x2f32('0x3'));var BPromise=require(_0x2f32('0x4'));var Mustache=require(_0x2f32('0x5'));var util=require(_0x2f32('0x6'));var path=require('path');var sox=require(_0x2f32('0x7'));var csv=require(_0x2f32('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2f32('0x9'));var squel=require('squel');var crypto=require(_0x2f32('0xa'));var jsforce=require(_0x2f32('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x2f32('0x8'));var querystring=require(_0x2f32('0xc'));var Papa=require(_0x2f32('0xd'));var Redis=require(_0x2f32('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x2f32('0xf'));var as=require(_0x2f32('0x10'));var hardwareService=require(_0x2f32('0x11'));var logger=require(_0x2f32('0x12'))(_0x2f32('0x13'));var utils=require(_0x2f32('0x14'));var config=require(_0x2f32('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x2f32('0x16'))['db'];function respondWithStatusCode(_0x18d86c,_0x15576c){_0x15576c=_0x15576c||0xcc;return function(_0x46b22a){if(_0x46b22a){return _0x18d86c['sendStatus'](_0x15576c);}return _0x18d86c[_0x2f32('0x17')](_0x15576c)[_0x2f32('0x18')]();};}function respondWithResult(_0x5438a3,_0x5cd60c){_0x5cd60c=_0x5cd60c||0xc8;return function(_0x56a79c){if(_0x56a79c){return _0x5438a3[_0x2f32('0x17')](_0x5cd60c)[_0x2f32('0x19')](_0x56a79c);}};}function respondWithFilteredResult(_0x1f22df,_0x458a53){return function(_0x2aae03){if(_0x2aae03){var _0x158ad2=typeof _0x458a53[_0x2f32('0x1a')]===_0x2f32('0x1b')&&typeof _0x458a53[_0x2f32('0x1c')]===_0x2f32('0x1b');var _0x4069e4=_0x2aae03[_0x2f32('0x1d')];var _0x27369f=_0x158ad2?0x0:_0x458a53[_0x2f32('0x1a')];var _0x3e165c=_0x158ad2?_0x2aae03[_0x2f32('0x1d')]:_0x458a53[_0x2f32('0x1a')]+_0x458a53[_0x2f32('0x1c')];var _0x3e5c5a;if(_0x3e165c>=_0x4069e4){_0x3e165c=_0x4069e4;_0x3e5c5a=0xc8;}else{_0x3e5c5a=0xce;}_0x1f22df['status'](_0x3e5c5a);return _0x1f22df['set'](_0x2f32('0x1e'),_0x27369f+'-'+_0x3e165c+'/'+_0x4069e4)['json'](_0x2aae03);}return null;};}function patchUpdates(_0x1f85b0){return function(_0x4086b3){try{jsonpatch[_0x2f32('0x1f')](_0x4086b3,_0x1f85b0,!![]);}catch(_0x3cdb5e){return BPromise['reject'](_0x3cdb5e);}return _0x4086b3[_0x2f32('0x20')]();};}function saveUpdates(_0x17ce06,_0x193915){return function(_0x2fae97){if(_0x2fae97){return _0x2fae97['update'](_0x17ce06)[_0x2f32('0x21')](function(_0x14ad2d){return _0x14ad2d;});}return null;};}function removeEntity(_0x4a98cf,_0x32758e){return function(_0x1dd122){if(_0x1dd122){return _0x1dd122['destroy']()[_0x2f32('0x21')](function(){var _0x350197=_0x1dd122[_0x2f32('0x22')]({'plain':!![]});var _0x5169cd='CannedAnswers';return db['UserProfileResource'][_0x2f32('0x23')]({'where':{'type':_0x5169cd,'resourceId':_0x350197['id']}})['then'](function(){return _0x1dd122;});})[_0x2f32('0x21')](function(){_0x4a98cf[_0x2f32('0x17')](0xcc)[_0x2f32('0x18')]();});}};}function handleEntityNotFound(_0x405bd0,_0x4e0ac2){return function(_0x589532){if(!_0x589532){_0x405bd0[_0x2f32('0x24')](0x194);}return _0x589532;};}function handleError(_0x5a0808,_0x104de3){_0x104de3=_0x104de3||0x1f4;return function(_0x4f305c){logger[_0x2f32('0x25')](_0x4f305c[_0x2f32('0x26')]);if(_0x4f305c[_0x2f32('0x27')]){delete _0x4f305c['name'];}_0x5a0808['status'](_0x104de3)[_0x2f32('0x28')](_0x4f305c);};}exports[_0x2f32('0x29')]=function(_0x59fd3b,_0x2bce5b){var _0x3d3c4f={},_0x4718bb={},_0x3aee52={'count':0x0,'rows':[]};var _0x1f4300=_[_0x2f32('0x2a')](db['CannedAnswer'][_0x2f32('0x2b')],function(_0x122c4a){return{'name':_0x122c4a[_0x2f32('0x2c')],'type':_0x122c4a[_0x2f32('0x2d')][_0x2f32('0x2e')]};});_0x4718bb['model']=_[_0x2f32('0x2a')](_0x1f4300,_0x2f32('0x27'));_0x4718bb[_0x2f32('0x2f')]=_[_0x2f32('0x30')](_0x59fd3b[_0x2f32('0x2f')]);_0x4718bb[_0x2f32('0x31')]=_[_0x2f32('0x32')](_0x4718bb[_0x2f32('0x33')],_0x4718bb[_0x2f32('0x2f')]);_0x3d3c4f[_0x2f32('0x34')]=_[_0x2f32('0x32')](_0x4718bb['model'],qs['fields'](_0x59fd3b[_0x2f32('0x2f')][_0x2f32('0x35')]));_0x3d3c4f['attributes']=_0x3d3c4f[_0x2f32('0x34')]['length']?_0x3d3c4f[_0x2f32('0x34')]:_0x4718bb[_0x2f32('0x33')];if(!_0x59fd3b[_0x2f32('0x2f')][_0x2f32('0x36')](_0x2f32('0x37'))){_0x3d3c4f[_0x2f32('0x1c')]=qs[_0x2f32('0x1c')](_0x59fd3b['query'][_0x2f32('0x1c')]);_0x3d3c4f[_0x2f32('0x1a')]=qs['offset'](_0x59fd3b[_0x2f32('0x2f')][_0x2f32('0x1a')]);}_0x3d3c4f[_0x2f32('0x38')]=qs['sort'](_0x59fd3b[_0x2f32('0x2f')]['sort']);_0x3d3c4f[_0x2f32('0x39')]=qs[_0x2f32('0x31')](_[_0x2f32('0x3a')](_0x59fd3b['query'],_0x4718bb[_0x2f32('0x31')]),_0x1f4300);if(_0x59fd3b[_0x2f32('0x2f')][_0x2f32('0x3b')]){_0x3d3c4f[_0x2f32('0x39')]=_[_0x2f32('0x3c')](_0x3d3c4f[_0x2f32('0x39')],{'$or':[{'key':{'$like':'%'+_0x59fd3b[_0x2f32('0x2f')]['filter']+'%'}},{'value':{'$like':'%'+_0x59fd3b[_0x2f32('0x2f')]['filter']+'%'}}]});}_0x3d3c4f=_[_0x2f32('0x3c')]({},_0x3d3c4f,_0x59fd3b[_0x2f32('0x3d')]);var _0xf1bf55={'where':_0x3d3c4f[_0x2f32('0x39')]};return db['CannedAnswer'][_0x2f32('0x1d')](_0xf1bf55)[_0x2f32('0x21')](function(_0x1264d9){_0x3aee52[_0x2f32('0x1d')]=_0x1264d9;if(_0x59fd3b[_0x2f32('0x2f')][_0x2f32('0x3e')]){_0x3d3c4f['include']=[{'all':!![]}];}return db[_0x2f32('0x3f')][_0x2f32('0x40')](_0x3d3c4f);})[_0x2f32('0x21')](function(_0x15ddd0){_0x3aee52[_0x2f32('0x41')]=_0x15ddd0;return _0x3aee52;})[_0x2f32('0x21')](respondWithFilteredResult(_0x2bce5b,_0x3d3c4f))[_0x2f32('0x42')](handleError(_0x2bce5b,null));};exports[_0x2f32('0x43')]=function(_0x338170,_0x9b2575){var _0x201fef={'raw':!![],'where':{'id':_0x338170['params']['id']}},_0x58a6b6={};_0x58a6b6[_0x2f32('0x33')]=_[_0x2f32('0x30')](db[_0x2f32('0x3f')][_0x2f32('0x2b')]);_0x58a6b6['query']=_['keys'](_0x338170[_0x2f32('0x2f')]);_0x58a6b6[_0x2f32('0x31')]=_[_0x2f32('0x32')](_0x58a6b6[_0x2f32('0x33')],_0x58a6b6[_0x2f32('0x2f')]);_0x201fef[_0x2f32('0x34')]=_[_0x2f32('0x32')](_0x58a6b6[_0x2f32('0x33')],qs[_0x2f32('0x35')](_0x338170[_0x2f32('0x2f')][_0x2f32('0x35')]));_0x201fef[_0x2f32('0x34')]=_0x201fef['attributes']['length']?_0x201fef[_0x2f32('0x34')]:_0x58a6b6[_0x2f32('0x33')];if(_0x338170[_0x2f32('0x2f')][_0x2f32('0x3e')]){_0x201fef[_0x2f32('0x44')]=[{'all':!![]}];}_0x201fef=_[_0x2f32('0x3c')]({},_0x201fef,_0x338170[_0x2f32('0x3d')]);return db[_0x2f32('0x3f')]['find'](_0x201fef)[_0x2f32('0x21')](handleEntityNotFound(_0x9b2575,null))['then'](respondWithResult(_0x9b2575,null))[_0x2f32('0x42')](handleError(_0x9b2575,null));};exports['update']=function(_0x196f06,_0x49c0de){if(_0x196f06['body']['id']){delete _0x196f06[_0x2f32('0x45')]['id'];}return db['CannedAnswer'][_0x2f32('0x46')]({'where':{'id':_0x196f06['params']['id']}})[_0x2f32('0x21')](handleEntityNotFound(_0x49c0de,null))['then'](saveUpdates(_0x196f06[_0x2f32('0x45')],null))['then'](respondWithResult(_0x49c0de,null))[_0x2f32('0x42')](handleError(_0x49c0de,null));};exports['destroy']=function(_0xcea8b3,_0x37ef5e){return db[_0x2f32('0x3f')][_0x2f32('0x46')]({'where':{'id':_0xcea8b3['params']['id']}})[_0x2f32('0x21')](handleEntityNotFound(_0x37ef5e,null))[_0x2f32('0x21')](removeEntity(_0x37ef5e,null))['catch'](handleError(_0x37ef5e,null));};exports[_0x2f32('0x47')]=function(_0x2adefb,_0x2ce987){var _0x1b9348={'key':_0x2adefb[_0x2f32('0x45')][_0x2f32('0x2e')]};if(_0x2adefb['body'][_0x2f32('0x48')]){_0x1b9348[_0x2f32('0x48')]=_0x2adefb['body'][_0x2f32('0x48')];}else if(_0x2adefb[_0x2f32('0x45')]['SmsAccountId']){_0x1b9348[_0x2f32('0x49')]=_0x2adefb[_0x2f32('0x45')][_0x2f32('0x49')];}else if(_0x2adefb[_0x2f32('0x45')]['OpenchannelAccountId']){_0x1b9348[_0x2f32('0x4a')]=_0x2adefb[_0x2f32('0x45')][_0x2f32('0x4a')];}else if(_0x2adefb[_0x2f32('0x45')][_0x2f32('0x4b')]){_0x1b9348['ChatWebsiteId']=_0x2adefb[_0x2f32('0x45')][_0x2f32('0x4b')];}return db[_0x2f32('0x3f')]['find']({'where':_0x1b9348})[_0x2f32('0x21')](function(_0x4738d5){if(_0x4738d5){throw new db[(_0x2f32('0x4c'))][(_0x2f32('0x4d'))]('The\x20inserted\x20key\x20already\x20exists.');}return db[_0x2f32('0x3f')][_0x2f32('0x47')](_0x2adefb[_0x2f32('0x45')]);})[_0x2f32('0x21')](function(_0x44d1e4){var _0x3768d0=_0x2adefb['user']['get']({'plain':!![]});if(!_0x3768d0)throw new Error(_0x2f32('0x4e'));if(_0x3768d0[_0x2f32('0x4f')]===_0x2f32('0x50')){var _0x5bad29=_0x44d1e4[_0x2f32('0x22')]({'plain':!![]});return db[_0x2f32('0x51')][_0x2f32('0x46')]({'where':{'name':'CannedAnswers','userProfileId':_0x3768d0[_0x2f32('0x52')]},'raw':!![]})[_0x2f32('0x21')](function(_0x5264fd){if(_0x5264fd&&_0x5264fd[_0x2f32('0x53')]===0x0){return db[_0x2f32('0x54')][_0x2f32('0x47')]({'name':_0x5bad29[_0x2f32('0x27')],'resourceId':_0x5bad29['id'],'type':_0x5264fd[_0x2f32('0x27')],'sectionId':_0x5264fd['id']},{})[_0x2f32('0x21')](function(){return _0x44d1e4;});}else{return _0x44d1e4;}})[_0x2f32('0x42')](function(_0x30c9c7){logger[_0x2f32('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x30c9c7);throw _0x30c9c7;});}return _0x44d1e4;})[_0x2f32('0x21')](respondWithResult(_0x2ce987,0xc9))[_0x2f32('0x42')](handleError(_0x2ce987,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index b6ee3c0..18adb4a 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 _0x7f5e=['define','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','rimraf','exports'];(function(_0x4b92f7,_0x333277){var _0x2acc58=function(_0x2284d0){while(--_0x2284d0){_0x4b92f7['push'](_0x4b92f7['shift']());}};_0x2acc58(++_0x333277);}(_0x7f5e,0x139));var _0xe7f5=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7f5e[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xe7f5('0x0'));var util=require(_0xe7f5('0x1'));var logger=require('../../config/logger')(_0xe7f5('0x2'));var moment=require(_0xe7f5('0x3'));var BPromise=require(_0xe7f5('0x4'));var rp=require(_0xe7f5('0x5'));var fs=require('fs');var path=require(_0xe7f5('0x6'));var rimraf=require(_0xe7f5('0x7'));var config=require('../../config/environment');var attributes=require('./cannedAnswer.attributes');module[_0xe7f5('0x8')]=function(_0x1a7cca,_0x4645f9){return _0x1a7cca[_0xe7f5('0x9')](_0xe7f5('0xa'),attributes,{'tableName':_0xe7f5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe7f5('0xc'),'collate':_0xe7f5('0xd')});}; \ No newline at end of file +var _0x08b3=['path','../../config/environment','./cannedAnswer.attributes','exports','define','CannedAnswer','tools_canned_answers','utf8mb4','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4a9193,_0x9eeeae){var _0x10aa17=function(_0x3edffe){while(--_0x3edffe){_0x4a9193['push'](_0x4a9193['shift']());}};_0x10aa17(++_0x9eeeae);}(_0x08b3,0xe8));var _0x308b=function(_0xcf76f5,_0x49de1e){_0xcf76f5=_0xcf76f5-0x0;var _0x597348=_0x08b3[_0xcf76f5];return _0x597348;};'use strict';var _=require(_0x308b('0x0'));var util=require('util');var logger=require(_0x308b('0x1'))(_0x308b('0x2'));var moment=require(_0x308b('0x3'));var BPromise=require(_0x308b('0x4'));var rp=require(_0x308b('0x5'));var fs=require('fs');var path=require(_0x308b('0x6'));var rimraf=require('rimraf');var config=require(_0x308b('0x7'));var attributes=require(_0x308b('0x8'));module[_0x308b('0x9')]=function(_0x31ad9c,_0x5c3661){return _0x31ad9c[_0x308b('0xa')](_0x308b('0xb'),attributes,{'tableName':_0x308b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x308b('0xd'),'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 78bf518..6ccb868 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(_0x2eea9e,_0x5709fe){var _0x51413d=function(_0x5d82b5){while(--_0x5d82b5){_0x2eea9e['push'](_0x2eea9e['shift']());}};_0x51413d(++_0x5709fe);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xa9e0[_0x2576d7];return _0x16a08c;};'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(_0x4ab6c6,_0x1715c1){var _0x48ac96=function(_0x1e0640){while(--_0x1e0640){_0x4ab6c6['push'](_0x4ab6c6['shift']());}};_0x48ac96(++_0x1715c1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index 53f8147..4292113 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 _0x0949=['../../config/environment','./cannedAnswer.controller','get','isAuthenticated','/:id','create','put','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x208d8a,_0x4d244f){var _0x3fc5ce=function(_0x522473){while(--_0x522473){_0x208d8a['push'](_0x208d8a['shift']());}};_0x3fc5ce(++_0x4d244f);}(_0x0949,0x149));var _0x9094=function(_0x2f9849,_0x209c0e){_0x2f9849=_0x2f9849-0x0;var _0x1aefac=_0x0949[_0x2f9849];return _0x1aefac;};'use strict';var multer=require('multer');var util=require(_0x9094('0x0'));var path=require(_0x9094('0x1'));var timeout=require(_0x9094('0x2'));var express=require(_0x9094('0x3'));var router=express[_0x9094('0x4')]();var fs_extra=require(_0x9094('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9094('0x6'));var config=require(_0x9094('0x7'));var controller=require(_0x9094('0x8'));router[_0x9094('0x9')]('/',auth[_0x9094('0xa')](),controller['index']);router[_0x9094('0x9')](_0x9094('0xb'),auth[_0x9094('0xa')](),controller['show']);router['post']('/',auth[_0x9094('0xa')](),controller[_0x9094('0xc')]);router[_0x9094('0xd')](_0x9094('0xb'),auth[_0x9094('0xa')](),controller['update']);router[_0x9094('0xe')](_0x9094('0xb'),auth[_0x9094('0xa')](),controller['destroy']);module[_0x9094('0xf')]=router; \ No newline at end of file +var _0xd572=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','index','/:id','show','create','delete','destroy','util','path'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0xd572,0x141));var _0x2d57=function(_0x58c099,_0x5c8584){_0x58c099=_0x58c099-0x0;var _0x4b2be0=_0xd572[_0x58c099];return _0x4b2be0;};'use strict';var multer=require('multer');var util=require(_0x2d57('0x0'));var path=require(_0x2d57('0x1'));var timeout=require(_0x2d57('0x2'));var express=require(_0x2d57('0x3'));var router=express[_0x2d57('0x4')]();var fs_extra=require(_0x2d57('0x5'));var auth=require(_0x2d57('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2d57('0x7'));var controller=require(_0x2d57('0x8'));router[_0x2d57('0x9')]('/',auth[_0x2d57('0xa')](),controller[_0x2d57('0xb')]);router['get'](_0x2d57('0xc'),auth['isAuthenticated'](),controller[_0x2d57('0xd')]);router['post']('/',auth[_0x2d57('0xa')](),controller[_0x2d57('0xe')]);router['put'](_0x2d57('0xc'),auth[_0x2d57('0xa')](),controller['update']);router[_0x2d57('0xf')]('/:id',auth[_0x2d57('0xa')](),controller[_0x2d57('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 7c451ac..39ba010 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 _0x79d8=['INTEGER','sequelize','exports','DATE','1970-01-01\x2000:00:01','STRING'];(function(_0x590a46,_0x3fe0a4){var _0x12efdc=function(_0x59d14b){while(--_0x59d14b){_0x590a46['push'](_0x590a46['shift']());}};_0x12efdc(++_0x3fe0a4);}(_0x79d8,0x67));var _0x879d=function(_0x3546b4,_0x34e1f5){_0x3546b4=_0x3546b4-0x0;var _0x507bdc=_0x79d8[_0x3546b4];return _0x507bdc;};'use strict';var Sequelize=require(_0x879d('0x0'));module[_0x879d('0x1')]={'calldate':{'type':Sequelize[_0x879d('0x2')],'allowNull':![],'defaultValue':_0x879d('0x3')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0x879d('0x4')]},'dst':{'type':Sequelize[_0x879d('0x4')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x879d('0x4')]},'dstchannel':{'type':Sequelize[_0x879d('0x4')]},'lastapp':{'type':Sequelize[_0x879d('0x4')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0x879d('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x879d('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x879d('0x4')]},'amaflags':{'type':Sequelize[_0x879d('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x879d('0x4')]},'uniqueid':{'type':Sequelize[_0x879d('0x4')]},'linkedid':{'type':Sequelize[_0x879d('0x4')]},'sequence':{'type':Sequelize[_0x879d('0x4')]},'peeraccount':{'type':Sequelize[_0x879d('0x4')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0x879d('0x4')]}}; \ No newline at end of file +var _0xab55=['INTEGER','sequelize','exports','DATE','1970-01-01\x2000:00:01','STRING'];(function(_0x5c6671,_0x324809){var _0x12fe6e=function(_0x1d127a){while(--_0x1d127a){_0x5c6671['push'](_0x5c6671['shift']());}};_0x12fe6e(++_0x324809);}(_0xab55,0x139));var _0x5ab5=function(_0x36f0c9,_0x1203ef){_0x36f0c9=_0x36f0c9-0x0;var _0x50a510=_0xab55[_0x36f0c9];return _0x50a510;};'use strict';var Sequelize=require(_0x5ab5('0x0'));module[_0x5ab5('0x1')]={'calldate':{'type':Sequelize[_0x5ab5('0x2')],'allowNull':![],'defaultValue':_0x5ab5('0x3')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0x5ab5('0x4')]},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize[_0x5ab5('0x4')]},'channel':{'type':Sequelize[_0x5ab5('0x4')]},'dstchannel':{'type':Sequelize[_0x5ab5('0x4')]},'lastapp':{'type':Sequelize[_0x5ab5('0x4')]},'lastdata':{'type':Sequelize[_0x5ab5('0x4')]},'duration':{'type':Sequelize[_0x5ab5('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x5ab5('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x5ab5('0x4')]},'amaflags':{'type':Sequelize[_0x5ab5('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x5ab5('0x4')]},'userfield':{'type':Sequelize[_0x5ab5('0x4')]},'uniqueid':{'type':Sequelize[_0x5ab5('0x4')]},'linkedid':{'type':Sequelize[_0x5ab5('0x4')]},'sequence':{'type':Sequelize[_0x5ab5('0x4')]},'peeraccount':{'type':Sequelize[_0x5ab5('0x4')]},'type':{'type':Sequelize[_0x5ab5('0x4')]},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 99447ae..a6a81b3 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 _0x3c94=['then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','Cdr','includeAll','include','findAll','rows','catch','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','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','count','set','Content-Range','apply','reject','save','update'];(function(_0x207312,_0x4c7652){var _0x49309d=function(_0x2caf1d){while(--_0x2caf1d){_0x207312['push'](_0x207312['shift']());}};_0x49309d(++_0x4c7652);}(_0x3c94,0xcd));var _0x43c9=function(_0x2c2980,_0x34282a){_0x2c2980=_0x2c2980-0x0;var _0x2a20a9=_0x3c94[_0x2c2980];return _0x2a20a9;};'use strict';var emlformat=require(_0x43c9('0x0'));var rimraf=require(_0x43c9('0x1'));var zipdir=require(_0x43c9('0x2'));var jsonpatch=require(_0x43c9('0x3'));var rp=require(_0x43c9('0x4'));var moment=require(_0x43c9('0x5'));var BPromise=require(_0x43c9('0x6'));var Mustache=require(_0x43c9('0x7'));var util=require(_0x43c9('0x8'));var path=require(_0x43c9('0x9'));var sox=require(_0x43c9('0xa'));var csv=require(_0x43c9('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x43c9('0xc'));var _=require(_0x43c9('0xd'));var squel=require(_0x43c9('0xe'));var crypto=require(_0x43c9('0xf'));var jsforce=require(_0x43c9('0x10'));var deskjs=require(_0x43c9('0x11'));var toCsv=require(_0x43c9('0xb'));var querystring=require(_0x43c9('0x12'));var Papa=require(_0x43c9('0x13'));var Redis=require('ioredis');var authService=require(_0x43c9('0x14'));var qs=require(_0x43c9('0x15'));var as=require(_0x43c9('0x16'));var hardwareService=require(_0x43c9('0x17'));var logger=require(_0x43c9('0x18'))(_0x43c9('0x19'));var utils=require(_0x43c9('0x1a'));var config=require(_0x43c9('0x1b'));var licenseUtil=require(_0x43c9('0x1c'));var db=require(_0x43c9('0x1d'))['db'];function respondWithStatusCode(_0x62bb3b,_0x31faa1){_0x31faa1=_0x31faa1||0xcc;return function(_0x11fe24){if(_0x11fe24){return _0x62bb3b[_0x43c9('0x1e')](_0x31faa1);}return _0x62bb3b[_0x43c9('0x1f')](_0x31faa1)[_0x43c9('0x20')]();};}function respondWithResult(_0x275b2b,_0x569fa9){_0x569fa9=_0x569fa9||0xc8;return function(_0x37932f){if(_0x37932f){return _0x275b2b[_0x43c9('0x1f')](_0x569fa9)[_0x43c9('0x21')](_0x37932f);}};}function respondWithFilteredResult(_0xe02707,_0x3f908d){return function(_0x5cc1fa){if(_0x5cc1fa){var _0x549d3f=typeof _0x3f908d[_0x43c9('0x22')]===_0x43c9('0x23')&&typeof _0x3f908d[_0x43c9('0x24')]===_0x43c9('0x23');var _0x501856=_0x5cc1fa[_0x43c9('0x25')];var _0x1da149=_0x549d3f?0x0:_0x3f908d[_0x43c9('0x22')];var _0x22bf3d=_0x549d3f?_0x5cc1fa[_0x43c9('0x25')]:_0x3f908d[_0x43c9('0x22')]+_0x3f908d[_0x43c9('0x24')];var _0x1e3996;if(_0x22bf3d>=_0x501856){_0x22bf3d=_0x501856;_0x1e3996=0xc8;}else{_0x1e3996=0xce;}_0xe02707[_0x43c9('0x1f')](_0x1e3996);return _0xe02707[_0x43c9('0x26')](_0x43c9('0x27'),_0x1da149+'-'+_0x22bf3d+'/'+_0x501856)['json'](_0x5cc1fa);}return null;};}function patchUpdates(_0x39c6f1){return function(_0x772b71){try{jsonpatch[_0x43c9('0x28')](_0x772b71,_0x39c6f1,!![]);}catch(_0x4c2d7c){return BPromise[_0x43c9('0x29')](_0x4c2d7c);}return _0x772b71[_0x43c9('0x2a')]();};}function saveUpdates(_0x2ef8d9,_0x5705c6){return function(_0x28290a){if(_0x28290a){return _0x28290a[_0x43c9('0x2b')](_0x2ef8d9)[_0x43c9('0x2c')](function(_0x4d58d7){return _0x4d58d7;});}return null;};}function removeEntity(_0x4963d2,_0x2a40f4){return function(_0x3fd641){if(_0x3fd641){return _0x3fd641[_0x43c9('0x2d')]()['then'](function(){_0x4963d2[_0x43c9('0x1f')](0xcc)[_0x43c9('0x20')]();});}};}function handleEntityNotFound(_0x1e676a,_0x16fee9){return function(_0x2c69af){if(!_0x2c69af){_0x1e676a['sendStatus'](0x194);}return _0x2c69af;};}function handleError(_0x386078,_0x3b5c47){_0x3b5c47=_0x3b5c47||0x1f4;return function(_0x3910af){logger[_0x43c9('0x2e')](_0x3910af[_0x43c9('0x2f')]);if(_0x3910af[_0x43c9('0x30')]){delete _0x3910af[_0x43c9('0x30')];}_0x386078[_0x43c9('0x1f')](_0x3b5c47)[_0x43c9('0x31')](_0x3910af);};}exports[_0x43c9('0x32')]=function(_0x4eb970,_0x11e3c3){var _0x2cbfd7={},_0x15028c={},_0x519e2c={'count':0x0,'rows':[]};var _0x2c0ccc=_[_0x43c9('0x33')](db['Cdr'][_0x43c9('0x34')],function(_0x497719){return{'name':_0x497719[_0x43c9('0x35')],'type':_0x497719[_0x43c9('0x36')][_0x43c9('0x37')]};});_0x15028c[_0x43c9('0x38')]=_['map'](_0x2c0ccc,_0x43c9('0x30'));_0x15028c[_0x43c9('0x39')]=_[_0x43c9('0x3a')](_0x4eb970['query']);_0x15028c[_0x43c9('0x3b')]=_['intersection'](_0x15028c[_0x43c9('0x38')],_0x15028c[_0x43c9('0x39')]);_0x2cbfd7[_0x43c9('0x3c')]=_[_0x43c9('0x3d')](_0x15028c['model'],qs[_0x43c9('0x3e')](_0x4eb970[_0x43c9('0x39')][_0x43c9('0x3e')]));_0x2cbfd7[_0x43c9('0x3c')]=_0x2cbfd7['attributes'][_0x43c9('0x3f')]?_0x2cbfd7[_0x43c9('0x3c')]:_0x15028c[_0x43c9('0x38')];if(!_0x4eb970[_0x43c9('0x39')][_0x43c9('0x40')](_0x43c9('0x41'))){_0x2cbfd7[_0x43c9('0x24')]=qs[_0x43c9('0x24')](_0x4eb970['query'][_0x43c9('0x24')]);_0x2cbfd7[_0x43c9('0x22')]=qs[_0x43c9('0x22')](_0x4eb970[_0x43c9('0x39')][_0x43c9('0x22')]);}_0x2cbfd7[_0x43c9('0x42')]=qs[_0x43c9('0x43')](_0x4eb970[_0x43c9('0x39')][_0x43c9('0x43')]);_0x2cbfd7['where']=qs[_0x43c9('0x3b')](_['pick'](_0x4eb970[_0x43c9('0x39')],_0x15028c[_0x43c9('0x3b')]),_0x2c0ccc);if(_0x4eb970[_0x43c9('0x39')][_0x43c9('0x44')]){_0x2cbfd7[_0x43c9('0x45')]=_[_0x43c9('0x46')](_0x2cbfd7[_0x43c9('0x45')],{'$or':_[_0x43c9('0x33')](_0x2c0ccc,function(_0x518bd3){if(_0x518bd3['type']!==_0x43c9('0x47')){var _0x2d63bd={};_0x2d63bd[_0x518bd3['name']]={'$like':'%'+_0x4eb970[_0x43c9('0x39')][_0x43c9('0x44')]+'%'};return _0x2d63bd;}})});}_0x2cbfd7=_[_0x43c9('0x46')]({},_0x2cbfd7,_0x4eb970['options']);var _0xb01a6e={'where':_0x2cbfd7[_0x43c9('0x45')]};return db[_0x43c9('0x48')][_0x43c9('0x25')](_0xb01a6e)[_0x43c9('0x2c')](function(_0x39601e){_0x519e2c[_0x43c9('0x25')]=_0x39601e;if(_0x4eb970[_0x43c9('0x39')][_0x43c9('0x49')]){_0x2cbfd7[_0x43c9('0x4a')]=[{'all':!![]}];}return db[_0x43c9('0x48')][_0x43c9('0x4b')](_0x2cbfd7);})['then'](function(_0x2d5dd5){_0x519e2c[_0x43c9('0x4c')]=_0x2d5dd5;return _0x519e2c;})[_0x43c9('0x2c')](respondWithFilteredResult(_0x11e3c3,_0x2cbfd7))[_0x43c9('0x4d')](handleError(_0x11e3c3,null));};exports['show']=function(_0xff891d,_0x66cac9){var _0x5ce14f={'raw':!![],'where':{'id':_0xff891d[_0x43c9('0x4e')]['id']}},_0x2a8f7d={};_0x2a8f7d[_0x43c9('0x38')]=_[_0x43c9('0x3a')](db[_0x43c9('0x48')][_0x43c9('0x34')]);_0x2a8f7d[_0x43c9('0x39')]=_[_0x43c9('0x3a')](_0xff891d[_0x43c9('0x39')]);_0x2a8f7d['filters']=_[_0x43c9('0x3d')](_0x2a8f7d['model'],_0x2a8f7d[_0x43c9('0x39')]);_0x5ce14f[_0x43c9('0x3c')]=_[_0x43c9('0x3d')](_0x2a8f7d[_0x43c9('0x38')],qs['fields'](_0xff891d[_0x43c9('0x39')][_0x43c9('0x3e')]));_0x5ce14f['attributes']=_0x5ce14f[_0x43c9('0x3c')][_0x43c9('0x3f')]?_0x5ce14f['attributes']:_0x2a8f7d[_0x43c9('0x38')];if(_0xff891d[_0x43c9('0x39')][_0x43c9('0x49')]){_0x5ce14f['include']=[{'all':!![]}];}_0x5ce14f=_[_0x43c9('0x46')]({},_0x5ce14f,_0xff891d['options']);return db['Cdr'][_0x43c9('0x4f')](_0x5ce14f)[_0x43c9('0x2c')](handleEntityNotFound(_0x66cac9,null))[_0x43c9('0x2c')](respondWithResult(_0x66cac9,null))[_0x43c9('0x4d')](handleError(_0x66cac9,null));};exports[_0x43c9('0x50')]=function(_0x28fe5d,_0x1f966e){return db[_0x43c9('0x48')][_0x43c9('0x50')](_0x28fe5d[_0x43c9('0x51')],{})[_0x43c9('0x2c')](respondWithResult(_0x1f966e,0xc9))[_0x43c9('0x4d')](handleError(_0x1f966e,null));};exports[_0x43c9('0x2b')]=function(_0x5082e9,_0xc57086){if(_0x5082e9[_0x43c9('0x51')]['id']){delete _0x5082e9['body']['id'];}return db[_0x43c9('0x48')][_0x43c9('0x4f')]({'where':{'id':_0x5082e9[_0x43c9('0x4e')]['id']}})[_0x43c9('0x2c')](handleEntityNotFound(_0xc57086,null))[_0x43c9('0x2c')](saveUpdates(_0x5082e9[_0x43c9('0x51')],null))[_0x43c9('0x2c')](respondWithResult(_0xc57086,null))[_0x43c9('0x4d')](handleError(_0xc57086,null));};exports[_0x43c9('0x2d')]=function(_0x508b62,_0x27db89){return db[_0x43c9('0x48')][_0x43c9('0x4f')]({'where':{'id':_0x508b62[_0x43c9('0x4e')]['id']}})[_0x43c9('0x2c')](handleEntityNotFound(_0x27db89,null))[_0x43c9('0x2c')](removeEntity(_0x27db89,null))['catch'](handleError(_0x27db89,null));};exports[_0x43c9('0x52')]=function(_0x1bc3b5,_0x3aff2e){return db[_0x43c9('0x48')][_0x43c9('0x52')]()[_0x43c9('0x2c')](respondWithResult(_0x3aff2e,null))[_0x43c9('0x4d')](handleError(_0x3aff2e,null));}; \ No newline at end of file +var _0xfd7b=['stack','name','send','index','map','Cdr','rawAttributes','fieldName','key','keys','query','intersection','model','fields','attributes','length','nolimit','order','sort','where','filters','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','show','params','find','body','catch','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','json','apply','reject','update','then','destroy','end','error'];(function(_0x39bf9f,_0x4c9693){var _0x8cfbbf=function(_0x1cbf02){while(--_0x1cbf02){_0x39bf9f['push'](_0x39bf9f['shift']());}};_0x8cfbbf(++_0x4c9693);}(_0xfd7b,0x1df));var _0xbfd7=function(_0x4e4f0e,_0x1c3892){_0x4e4f0e=_0x4e4f0e-0x0;var _0x1a7219=_0xfd7b[_0x4e4f0e];return _0x1a7219;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbfd7('0x0'));var zipdir=require(_0xbfd7('0x1'));var jsonpatch=require(_0xbfd7('0x2'));var rp=require(_0xbfd7('0x3'));var moment=require(_0xbfd7('0x4'));var BPromise=require(_0xbfd7('0x5'));var Mustache=require(_0xbfd7('0x6'));var util=require(_0xbfd7('0x7'));var path=require(_0xbfd7('0x8'));var sox=require(_0xbfd7('0x9'));var csv=require(_0xbfd7('0xa'));var ejs=require(_0xbfd7('0xb'));var fs=require('fs');var fs_extra=require(_0xbfd7('0xc'));var _=require('lodash');var squel=require(_0xbfd7('0xd'));var crypto=require('crypto');var jsforce=require(_0xbfd7('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xbfd7('0xa'));var querystring=require(_0xbfd7('0xf'));var Papa=require(_0xbfd7('0x10'));var Redis=require(_0xbfd7('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xbfd7('0x12'));var as=require(_0xbfd7('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbfd7('0x14'));var utils=require(_0xbfd7('0x15'));var config=require(_0xbfd7('0x16'));var licenseUtil=require(_0xbfd7('0x17'));var db=require(_0xbfd7('0x18'))['db'];function respondWithStatusCode(_0x559eca,_0x46feae){_0x46feae=_0x46feae||0xcc;return function(_0x534d66){if(_0x534d66){return _0x559eca[_0xbfd7('0x19')](_0x46feae);}return _0x559eca['status'](_0x46feae)['end']();};}function respondWithResult(_0x44847e,_0x4fec16){_0x4fec16=_0x4fec16||0xc8;return function(_0x3789b7){if(_0x3789b7){return _0x44847e[_0xbfd7('0x1a')](_0x4fec16)['json'](_0x3789b7);}};}function respondWithFilteredResult(_0x5efd54,_0x48f4a4){return function(_0x37e777){if(_0x37e777){var _0x115a34=typeof _0x48f4a4[_0xbfd7('0x1b')]===_0xbfd7('0x1c')&&typeof _0x48f4a4[_0xbfd7('0x1d')]===_0xbfd7('0x1c');var _0x137d50=_0x37e777[_0xbfd7('0x1e')];var _0x3053f3=_0x115a34?0x0:_0x48f4a4['offset'];var _0x5b718b=_0x115a34?_0x37e777[_0xbfd7('0x1e')]:_0x48f4a4[_0xbfd7('0x1b')]+_0x48f4a4['limit'];var _0x5ea27a;if(_0x5b718b>=_0x137d50){_0x5b718b=_0x137d50;_0x5ea27a=0xc8;}else{_0x5ea27a=0xce;}_0x5efd54[_0xbfd7('0x1a')](_0x5ea27a);return _0x5efd54['set']('Content-Range',_0x3053f3+'-'+_0x5b718b+'/'+_0x137d50)[_0xbfd7('0x1f')](_0x37e777);}return null;};}function patchUpdates(_0x5eab37){return function(_0x594792){try{jsonpatch[_0xbfd7('0x20')](_0x594792,_0x5eab37,!![]);}catch(_0x1db6de){return BPromise[_0xbfd7('0x21')](_0x1db6de);}return _0x594792['save']();};}function saveUpdates(_0xb38f6b,_0x32a489){return function(_0x152893){if(_0x152893){return _0x152893[_0xbfd7('0x22')](_0xb38f6b)[_0xbfd7('0x23')](function(_0x2639b6){return _0x2639b6;});}return null;};}function removeEntity(_0x51b13d,_0x2402fb){return function(_0x1c765b){if(_0x1c765b){return _0x1c765b[_0xbfd7('0x24')]()['then'](function(){_0x51b13d[_0xbfd7('0x1a')](0xcc)[_0xbfd7('0x25')]();});}};}function handleEntityNotFound(_0x18dd74,_0x2d0549){return function(_0x358549){if(!_0x358549){_0x18dd74['sendStatus'](0x194);}return _0x358549;};}function handleError(_0x2a7749,_0x6ef5aa){_0x6ef5aa=_0x6ef5aa||0x1f4;return function(_0x120e39){logger[_0xbfd7('0x26')](_0x120e39[_0xbfd7('0x27')]);if(_0x120e39[_0xbfd7('0x28')]){delete _0x120e39[_0xbfd7('0x28')];}_0x2a7749['status'](_0x6ef5aa)[_0xbfd7('0x29')](_0x120e39);};}exports[_0xbfd7('0x2a')]=function(_0x4d7ef4,_0x2971ea){var _0x33583b={},_0x2ec4a5={},_0x14c55d={'count':0x0,'rows':[]};var _0x510506=_[_0xbfd7('0x2b')](db[_0xbfd7('0x2c')][_0xbfd7('0x2d')],function(_0x489365){return{'name':_0x489365[_0xbfd7('0x2e')],'type':_0x489365['type'][_0xbfd7('0x2f')]};});_0x2ec4a5['model']=_[_0xbfd7('0x2b')](_0x510506,_0xbfd7('0x28'));_0x2ec4a5['query']=_[_0xbfd7('0x30')](_0x4d7ef4[_0xbfd7('0x31')]);_0x2ec4a5['filters']=_[_0xbfd7('0x32')](_0x2ec4a5[_0xbfd7('0x33')],_0x2ec4a5[_0xbfd7('0x31')]);_0x33583b['attributes']=_[_0xbfd7('0x32')](_0x2ec4a5[_0xbfd7('0x33')],qs[_0xbfd7('0x34')](_0x4d7ef4[_0xbfd7('0x31')][_0xbfd7('0x34')]));_0x33583b[_0xbfd7('0x35')]=_0x33583b[_0xbfd7('0x35')][_0xbfd7('0x36')]?_0x33583b[_0xbfd7('0x35')]:_0x2ec4a5[_0xbfd7('0x33')];if(!_0x4d7ef4[_0xbfd7('0x31')]['hasOwnProperty'](_0xbfd7('0x37'))){_0x33583b['limit']=qs['limit'](_0x4d7ef4[_0xbfd7('0x31')][_0xbfd7('0x1d')]);_0x33583b[_0xbfd7('0x1b')]=qs[_0xbfd7('0x1b')](_0x4d7ef4[_0xbfd7('0x31')][_0xbfd7('0x1b')]);}_0x33583b[_0xbfd7('0x38')]=qs[_0xbfd7('0x39')](_0x4d7ef4['query']['sort']);_0x33583b[_0xbfd7('0x3a')]=qs[_0xbfd7('0x3b')](_['pick'](_0x4d7ef4[_0xbfd7('0x31')],_0x2ec4a5[_0xbfd7('0x3b')]),_0x510506);if(_0x4d7ef4['query']['filter']){_0x33583b[_0xbfd7('0x3a')]=_[_0xbfd7('0x3c')](_0x33583b['where'],{'$or':_[_0xbfd7('0x2b')](_0x510506,function(_0xfee712){if(_0xfee712[_0xbfd7('0x3d')]!==_0xbfd7('0x3e')){var _0x68f13={};_0x68f13[_0xfee712['name']]={'$like':'%'+_0x4d7ef4[_0xbfd7('0x31')][_0xbfd7('0x3f')]+'%'};return _0x68f13;}})});}_0x33583b=_[_0xbfd7('0x3c')]({},_0x33583b,_0x4d7ef4[_0xbfd7('0x40')]);var _0x25ac4a={'where':_0x33583b[_0xbfd7('0x3a')]};return db[_0xbfd7('0x2c')][_0xbfd7('0x1e')](_0x25ac4a)['then'](function(_0x32df79){_0x14c55d['count']=_0x32df79;if(_0x4d7ef4['query'][_0xbfd7('0x41')]){_0x33583b[_0xbfd7('0x42')]=[{'all':!![]}];}return db[_0xbfd7('0x2c')][_0xbfd7('0x43')](_0x33583b);})[_0xbfd7('0x23')](function(_0x1236dd){_0x14c55d['rows']=_0x1236dd;return _0x14c55d;})[_0xbfd7('0x23')](respondWithFilteredResult(_0x2971ea,_0x33583b))['catch'](handleError(_0x2971ea,null));};exports[_0xbfd7('0x44')]=function(_0x3b7d7f,_0x12f99b){var _0x159c20={'raw':!![],'where':{'id':_0x3b7d7f[_0xbfd7('0x45')]['id']}},_0x1df6a3={};_0x1df6a3[_0xbfd7('0x33')]=_['keys'](db[_0xbfd7('0x2c')][_0xbfd7('0x2d')]);_0x1df6a3[_0xbfd7('0x31')]=_[_0xbfd7('0x30')](_0x3b7d7f[_0xbfd7('0x31')]);_0x1df6a3[_0xbfd7('0x3b')]=_[_0xbfd7('0x32')](_0x1df6a3['model'],_0x1df6a3[_0xbfd7('0x31')]);_0x159c20[_0xbfd7('0x35')]=_[_0xbfd7('0x32')](_0x1df6a3['model'],qs['fields'](_0x3b7d7f['query'][_0xbfd7('0x34')]));_0x159c20[_0xbfd7('0x35')]=_0x159c20[_0xbfd7('0x35')][_0xbfd7('0x36')]?_0x159c20['attributes']:_0x1df6a3[_0xbfd7('0x33')];if(_0x3b7d7f['query'][_0xbfd7('0x41')]){_0x159c20[_0xbfd7('0x42')]=[{'all':!![]}];}_0x159c20=_['merge']({},_0x159c20,_0x3b7d7f[_0xbfd7('0x40')]);return db['Cdr'][_0xbfd7('0x46')](_0x159c20)[_0xbfd7('0x23')](handleEntityNotFound(_0x12f99b,null))[_0xbfd7('0x23')](respondWithResult(_0x12f99b,null))['catch'](handleError(_0x12f99b,null));};exports['create']=function(_0x356f58,_0xb8b319){return db['Cdr']['create'](_0x356f58[_0xbfd7('0x47')],{})[_0xbfd7('0x23')](respondWithResult(_0xb8b319,0xc9))[_0xbfd7('0x48')](handleError(_0xb8b319,null));};exports[_0xbfd7('0x22')]=function(_0x1cea7d,_0x14bc15){if(_0x1cea7d[_0xbfd7('0x47')]['id']){delete _0x1cea7d['body']['id'];}return db['Cdr']['find']({'where':{'id':_0x1cea7d[_0xbfd7('0x45')]['id']}})[_0xbfd7('0x23')](handleEntityNotFound(_0x14bc15,null))[_0xbfd7('0x23')](saveUpdates(_0x1cea7d['body'],null))[_0xbfd7('0x23')](respondWithResult(_0x14bc15,null))[_0xbfd7('0x48')](handleError(_0x14bc15,null));};exports['destroy']=function(_0x4a7a72,_0xc89535){return db[_0xbfd7('0x2c')][_0xbfd7('0x46')]({'where':{'id':_0x4a7a72['params']['id']}})[_0xbfd7('0x23')](handleEntityNotFound(_0xc89535,null))[_0xbfd7('0x23')](removeEntity(_0xc89535,null))[_0xbfd7('0x48')](handleError(_0xc89535,null));};exports['describe']=function(_0x371d01,_0x15c0fe){return db[_0xbfd7('0x2c')][_0xbfd7('0x49')]()['then'](respondWithResult(_0x15c0fe,null))[_0xbfd7('0x48')](handleError(_0x15c0fe,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index e447fa4..c55ea56 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(_0x47870f,_0x88bf6){var _0xb9bfa3=function(_0x1c676b){while(--_0x1c676b){_0x47870f['push'](_0x47870f['shift']());}};_0xb9bfa3(++_0x88bf6);}(_0x7a54,0x106));var _0x47a5=function(_0x5741dd,_0x2d9ae6){_0x5741dd=_0x5741dd-0x0;var _0x22f8ad=_0x7a54[_0x5741dd];return _0x22f8ad;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file +var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x492f29,_0x4ca0b0){var _0x4ef358=function(_0x4a2ed2){while(--_0x4a2ed2){_0x492f29['push'](_0x492f29['shift']());}};_0x4ef358(++_0x4ca0b0);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index f9fbcd4..651ac3c 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 _0x24b1=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch'];(function(_0x1385dc,_0x2c7fd7){var _0x2f6469=function(_0x47ed8a){while(--_0x47ed8a){_0x1385dc['push'](_0x1385dc['shift']());}};_0x2f6469(++_0x2c7fd7);}(_0x24b1,0x108));var _0x124b=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x24b1[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0x124b('0x0'));var util=require(_0x124b('0x1'));var moment=require(_0x124b('0x2'));var BPromise=require(_0x124b('0x3'));var rs=require(_0x124b('0x4'));var fs=require('fs');var Redis=require(_0x124b('0x5'));var db=require(_0x124b('0x6'))['db'];var utils=require(_0x124b('0x7'));var logger=require(_0x124b('0x8'))(_0x124b('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x124b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe78f6b,_0x36f5c0,_0x26f9ce){return new BPromise(function(_0x57cc78,_0x96b2da){return client[_0x124b('0xb')](_0xe78f6b,_0x26f9ce)['then'](function(_0x3acb94){logger[_0x124b('0xc')](_0x124b('0xd'),_0x36f5c0,_0x124b('0xe'));logger[_0x124b('0xf')](_0x124b('0x10'),_0x36f5c0,_0x124b('0xe'),JSON[_0x124b('0x11')](_0x3acb94));if(_0x3acb94[_0x124b('0x12')]){if(_0x3acb94['error']['code']===0x1f4){logger[_0x124b('0x12')]('Cdr,\x20%s,\x20%s',_0x36f5c0,_0x3acb94[_0x124b('0x12')][_0x124b('0x13')]);return _0x96b2da(_0x3acb94[_0x124b('0x12')][_0x124b('0x13')]);}logger[_0x124b('0x12')]('Cdr,\x20%s,\x20%s',_0x36f5c0,_0x3acb94['error']['message']);return _0x57cc78(_0x3acb94['error']['message']);}else{logger[_0x124b('0xc')](_0x124b('0xd'),_0x36f5c0,_0x124b('0xe'));_0x57cc78(_0x3acb94[_0x124b('0x14')][_0x124b('0x13')]);}})[_0x124b('0x15')](function(_0x198259){logger[_0x124b('0x12')]('Cdr,\x20%s,\x20%s',_0x36f5c0,_0x198259);_0x96b2da(_0x198259);});});} \ No newline at end of file +var _0x8ea7=['message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x865802,_0x191bc4){var _0x2f2dc3=function(_0x348346){while(--_0x348346){_0x865802['push'](_0x865802['shift']());}};_0x2f2dc3(++_0x191bc4);}(_0x8ea7,0xd2));var _0x78ea=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8ea7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x78ea('0x0'));var util=require('util');var moment=require(_0x78ea('0x1'));var BPromise=require(_0x78ea('0x2'));var rs=require(_0x78ea('0x3'));var fs=require('fs');var Redis=require(_0x78ea('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x78ea('0x5'));var logger=require(_0x78ea('0x6'))(_0x78ea('0x7'));var config=require(_0x78ea('0x8'));var jayson=require(_0x78ea('0x9'));var client=jayson[_0x78ea('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2ac9cc,_0x3e32b8,_0x38f328){return new BPromise(function(_0xc5c863,_0x39a489){return client[_0x78ea('0xb')](_0x2ac9cc,_0x38f328)[_0x78ea('0xc')](function(_0x4a08f7){logger[_0x78ea('0xd')](_0x78ea('0xe'),_0x3e32b8,_0x78ea('0xf'));logger[_0x78ea('0x10')](_0x78ea('0x11'),_0x3e32b8,_0x78ea('0xf'),JSON['stringify'](_0x4a08f7));if(_0x4a08f7[_0x78ea('0x12')]){if(_0x4a08f7[_0x78ea('0x12')][_0x78ea('0x13')]===0x1f4){logger['error'](_0x78ea('0xe'),_0x3e32b8,_0x4a08f7[_0x78ea('0x12')][_0x78ea('0x14')]);return _0x39a489(_0x4a08f7['error'][_0x78ea('0x14')]);}logger[_0x78ea('0x12')](_0x78ea('0xe'),_0x3e32b8,_0x4a08f7[_0x78ea('0x12')]['message']);return _0xc5c863(_0x4a08f7[_0x78ea('0x12')]['message']);}else{logger[_0x78ea('0xd')]('Cdr,\x20%s,\x20%s',_0x3e32b8,_0x78ea('0xf'));_0xc5c863(_0x4a08f7[_0x78ea('0x15')][_0x78ea('0x14')]);}})[_0x78ea('0x16')](function(_0x3c422e){logger[_0x78ea('0x12')](_0x78ea('0xe'),_0x3e32b8,_0x3c422e);_0x39a489(_0x3c422e);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index d22d1b4..7643048 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(_0x238671,_0x34aea0){var _0x474844=function(_0x26cab4){while(--_0x26cab4){_0x238671['push'](_0x238671['shift']());}};_0x474844(++_0x34aea0);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _0xb10b=['../../components/interaction/service','../../config/environment','./cdr.controller','get','index','isAuthenticated','describe','/:id','show','post','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x4469d2,_0x307fda){var _0x1a312d=function(_0x562f9a){while(--_0x562f9a){_0x4469d2['push'](_0x4469d2['shift']());}};_0x1a312d(++_0x307fda);}(_0xb10b,0x12a));var _0xbb10=function(_0x8a2e9d,_0xa7a01c){_0x8a2e9d=_0x8a2e9d-0x0;var _0xf64cdd=_0xb10b[_0x8a2e9d];return _0xf64cdd;};'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')]('/describe',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')]('/',auth[_0xbb10('0xb')](),controller['create']);router['put'](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x10')]);router['delete'](_0xbb10('0xd'),auth['isAuthenticated'](),controller[_0xbb10('0x11')]);module[_0xbb10('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 fc15550..58b3546 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 _0x539c=['INTEGER','STRING','exports'];(function(_0x53fcbb,_0x2cc6ab){var _0x2e4a99=function(_0x4c9d83){while(--_0x4c9d83){_0x53fcbb['push'](_0x53fcbb['shift']());}};_0x2e4a99(++_0x2cc6ab);}(_0x539c,0x1c4));var _0xc539=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x539c[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0xc539('0x0')]={'priority':{'type':Sequelize[_0xc539('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xc539('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xd474=['INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize'];(function(_0x2ac9c1,_0x28f870){var _0x553d9d=function(_0x17a8b2){while(--_0x17a8b2){_0x2ac9c1['push'](_0x2ac9c1['shift']());}};_0x553d9d(++_0x28f870);}(_0xd474,0x6b));var _0x4d47=function(_0x33b627,_0xcd64e0){_0x33b627=_0x33b627-0x0;var _0x531df0=_0xd474[_0x33b627];return _0x531df0;};'use strict';var Sequelize=require(_0x4d47('0x0'));module['exports']={'priority':{'type':Sequelize[_0x4d47('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x4d47('0x2')],'allowNull':![],'defaultValue':_0x4d47('0x3')},'appdata':{'type':Sequelize[_0x4d47('0x4')]()},'description':{'type':Sequelize[_0x4d47('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x4d47('0x5')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 5949120..03fcf82 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 _0x6594=['../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','apply','reject','save','destroy','then','end','error','stack','name','send','show','params','ChatApplication','keys','query','intersection','model','attributes','fields','length','includeAll','include','merge','options','catch','body','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x2db12b,_0x30ab1d){var _0x20990b=function(_0x589477){while(--_0x589477){_0x2db12b['push'](_0x2db12b['shift']());}};_0x20990b(++_0x30ab1d);}(_0x6594,0xcb));var _0x4659=function(_0x4a2689,_0x314a16){_0x4a2689=_0x4a2689-0x0;var _0x463450=_0x6594[_0x4a2689];return _0x463450;};'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(_0x4659('0x0'));var moment=require(_0x4659('0x1'));var BPromise=require(_0x4659('0x2'));var Mustache=require(_0x4659('0x3'));var util=require(_0x4659('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x4659('0x5'));var ejs=require(_0x4659('0x6'));var fs=require('fs');var fs_extra=require(_0x4659('0x7'));var _=require(_0x4659('0x8'));var squel=require('squel');var crypto=require(_0x4659('0x9'));var jsforce=require(_0x4659('0xa'));var deskjs=require(_0x4659('0xb'));var toCsv=require(_0x4659('0x5'));var querystring=require(_0x4659('0xc'));var Papa=require(_0x4659('0xd'));var Redis=require('ioredis');var authService=require(_0x4659('0xe'));var qs=require(_0x4659('0xf'));var as=require(_0x4659('0x10'));var hardwareService=require(_0x4659('0x11'));var logger=require(_0x4659('0x12'))(_0x4659('0x13'));var utils=require(_0x4659('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4659('0x15'))['db'];function respondWithStatusCode(_0x22941b,_0x1f89cf){_0x1f89cf=_0x1f89cf||0xcc;return function(_0x5389a0){if(_0x5389a0){return _0x22941b[_0x4659('0x16')](_0x1f89cf);}return _0x22941b[_0x4659('0x17')](_0x1f89cf)['end']();};}function respondWithResult(_0x5d303e,_0x1a9e9c){_0x1a9e9c=_0x1a9e9c||0xc8;return function(_0x4c3c05){if(_0x4c3c05){return _0x5d303e[_0x4659('0x17')](_0x1a9e9c)[_0x4659('0x18')](_0x4c3c05);}};}function respondWithFilteredResult(_0x37d37d,_0x5c099c){return function(_0x3d9a17){if(_0x3d9a17){var _0x429b72=typeof _0x5c099c[_0x4659('0x19')]===_0x4659('0x1a')&&typeof _0x5c099c['limit']===_0x4659('0x1a');var _0xb9e922=_0x3d9a17[_0x4659('0x1b')];var _0x2fdd7a=_0x429b72?0x0:_0x5c099c['offset'];var _0x434282=_0x429b72?_0x3d9a17[_0x4659('0x1b')]:_0x5c099c['offset']+_0x5c099c[_0x4659('0x1c')];var _0x3c7bd0;if(_0x434282>=_0xb9e922){_0x434282=_0xb9e922;_0x3c7bd0=0xc8;}else{_0x3c7bd0=0xce;}_0x37d37d[_0x4659('0x17')](_0x3c7bd0);return _0x37d37d[_0x4659('0x1d')]('Content-Range',_0x2fdd7a+'-'+_0x434282+'/'+_0xb9e922)['json'](_0x3d9a17);}return null;};}function patchUpdates(_0x494261){return function(_0x157f1a){try{jsonpatch[_0x4659('0x1e')](_0x157f1a,_0x494261,!![]);}catch(_0xd6012e){return BPromise[_0x4659('0x1f')](_0xd6012e);}return _0x157f1a[_0x4659('0x20')]();};}function saveUpdates(_0x428e2c,_0x2e773b){return function(_0x1a016e){if(_0x1a016e){return _0x1a016e['update'](_0x428e2c)['then'](function(_0x31273d){return _0x31273d;});}return null;};}function removeEntity(_0x4c40b3,_0x1e9c93){return function(_0x47c73d){if(_0x47c73d){return _0x47c73d[_0x4659('0x21')]()[_0x4659('0x22')](function(){_0x4c40b3[_0x4659('0x17')](0xcc)[_0x4659('0x23')]();});}};}function handleEntityNotFound(_0x20fc37,_0x1fe661){return function(_0x2b4ad8){if(!_0x2b4ad8){_0x20fc37[_0x4659('0x16')](0x194);}return _0x2b4ad8;};}function handleError(_0x376e34,_0x507598){_0x507598=_0x507598||0x1f4;return function(_0x428dd5){logger[_0x4659('0x24')](_0x428dd5[_0x4659('0x25')]);if(_0x428dd5[_0x4659('0x26')]){delete _0x428dd5[_0x4659('0x26')];}_0x376e34[_0x4659('0x17')](_0x507598)[_0x4659('0x27')](_0x428dd5);};}exports[_0x4659('0x28')]=function(_0x5c152b,_0x479a2e){var _0x5d0c89={'raw':!![],'where':{'id':_0x5c152b[_0x4659('0x29')]['id']}},_0xde3c49={};_0xde3c49['model']=_['keys'](db[_0x4659('0x2a')]['rawAttributes']);_0xde3c49['query']=_[_0x4659('0x2b')](_0x5c152b[_0x4659('0x2c')]);_0xde3c49['filters']=_[_0x4659('0x2d')](_0xde3c49[_0x4659('0x2e')],_0xde3c49[_0x4659('0x2c')]);_0x5d0c89[_0x4659('0x2f')]=_[_0x4659('0x2d')](_0xde3c49[_0x4659('0x2e')],qs[_0x4659('0x30')](_0x5c152b['query'][_0x4659('0x30')]));_0x5d0c89[_0x4659('0x2f')]=_0x5d0c89[_0x4659('0x2f')][_0x4659('0x31')]?_0x5d0c89['attributes']:_0xde3c49[_0x4659('0x2e')];if(_0x5c152b[_0x4659('0x2c')][_0x4659('0x32')]){_0x5d0c89[_0x4659('0x33')]=[{'all':!![]}];}_0x5d0c89=_[_0x4659('0x34')]({},_0x5d0c89,_0x5c152b[_0x4659('0x35')]);return db['ChatApplication']['find'](_0x5d0c89)['then'](handleEntityNotFound(_0x479a2e,null))[_0x4659('0x22')](respondWithResult(_0x479a2e,null))[_0x4659('0x36')](handleError(_0x479a2e,null));};exports['update']=function(_0xe85ca8,_0xf2b91c){if(_0xe85ca8['body']['id']){delete _0xe85ca8[_0x4659('0x37')]['id'];}return db[_0x4659('0x2a')]['find']({'where':{'id':_0xe85ca8['params']['id']}})[_0x4659('0x22')](handleEntityNotFound(_0xf2b91c,null))[_0x4659('0x22')](saveUpdates(_0xe85ca8[_0x4659('0x37')],null))[_0x4659('0x22')](respondWithResult(_0xf2b91c,null))[_0x4659('0x36')](handleError(_0xf2b91c,null));};exports[_0x4659('0x21')]=function(_0xcac96a,_0x1f3259){return db[_0x4659('0x2a')]['find']({'where':{'id':_0xcac96a[_0x4659('0x29')]['id']}})[_0x4659('0x22')](handleEntityNotFound(_0x1f3259,null))['then'](removeEntity(_0x1f3259,null))['catch'](handleError(_0x1f3259,null));}; \ No newline at end of file +var _0xc68d=['sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','apply','save','update','then','destroy','error','stack','name','params','model','keys','ChatApplication','rawAttributes','query','filters','intersection','attributes','fields','includeAll','options','find','catch','body','rimraf','zip-dir','moment','bluebird','mustache','util','path'];(function(_0x420cb4,_0x2149bf){var _0x44bfb1=function(_0xcd79a8){while(--_0xcd79a8){_0x420cb4['push'](_0x420cb4['shift']());}};_0x44bfb1(++_0x2149bf);}(_0xc68d,0x17a));var _0xdc68=function(_0x281950,_0x3da368){_0x281950=_0x281950-0x0;var _0x24f81a=_0xc68d[_0x281950];return _0x24f81a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdc68('0x0'));var zipdir=require(_0xdc68('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xdc68('0x2'));var BPromise=require(_0xdc68('0x3'));var Mustache=require(_0xdc68('0x4'));var util=require(_0xdc68('0x5'));var path=require(_0xdc68('0x6'));var sox=require(_0xdc68('0x7'));var csv=require('to-csv');var ejs=require(_0xdc68('0x8'));var fs=require('fs');var fs_extra=require(_0xdc68('0x9'));var _=require(_0xdc68('0xa'));var squel=require('squel');var crypto=require(_0xdc68('0xb'));var jsforce=require(_0xdc68('0xc'));var deskjs=require(_0xdc68('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xdc68('0xe'));var Redis=require(_0xdc68('0xf'));var authService=require(_0xdc68('0x10'));var qs=require(_0xdc68('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdc68('0x12'));var logger=require(_0xdc68('0x13'))(_0xdc68('0x14'));var utils=require(_0xdc68('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xdc68('0x16'));var db=require(_0xdc68('0x17'))['db'];function respondWithStatusCode(_0x500a71,_0x44775f){_0x44775f=_0x44775f||0xcc;return function(_0x448d4a){if(_0x448d4a){return _0x500a71[_0xdc68('0x18')](_0x44775f);}return _0x500a71['status'](_0x44775f)[_0xdc68('0x19')]();};}function respondWithResult(_0x181136,_0x19c1ed){_0x19c1ed=_0x19c1ed||0xc8;return function(_0xd229ba){if(_0xd229ba){return _0x181136[_0xdc68('0x1a')](_0x19c1ed)[_0xdc68('0x1b')](_0xd229ba);}};}function respondWithFilteredResult(_0x2b6883,_0x4a139b){return function(_0x210d65){if(_0x210d65){var _0x4aa2ad=typeof _0x4a139b[_0xdc68('0x1c')]==='undefined'&&typeof _0x4a139b[_0xdc68('0x1d')]===_0xdc68('0x1e');var _0x5c6d6b=_0x210d65[_0xdc68('0x1f')];var _0x3afa9a=_0x4aa2ad?0x0:_0x4a139b[_0xdc68('0x1c')];var _0x59896b=_0x4aa2ad?_0x210d65[_0xdc68('0x1f')]:_0x4a139b[_0xdc68('0x1c')]+_0x4a139b[_0xdc68('0x1d')];var _0x17c349;if(_0x59896b>=_0x5c6d6b){_0x59896b=_0x5c6d6b;_0x17c349=0xc8;}else{_0x17c349=0xce;}_0x2b6883['status'](_0x17c349);return _0x2b6883['set']('Content-Range',_0x3afa9a+'-'+_0x59896b+'/'+_0x5c6d6b)[_0xdc68('0x1b')](_0x210d65);}return null;};}function patchUpdates(_0x15f955){return function(_0x16e37d){try{jsonpatch[_0xdc68('0x20')](_0x16e37d,_0x15f955,!![]);}catch(_0xbeae7d){return BPromise['reject'](_0xbeae7d);}return _0x16e37d[_0xdc68('0x21')]();};}function saveUpdates(_0x42e1ce,_0x3199d8){return function(_0x1cea8e){if(_0x1cea8e){return _0x1cea8e[_0xdc68('0x22')](_0x42e1ce)[_0xdc68('0x23')](function(_0x5b3f02){return _0x5b3f02;});}return null;};}function removeEntity(_0x1f14b3,_0x34273d){return function(_0x5685ed){if(_0x5685ed){return _0x5685ed[_0xdc68('0x24')]()['then'](function(){_0x1f14b3[_0xdc68('0x1a')](0xcc)[_0xdc68('0x19')]();});}};}function handleEntityNotFound(_0xd5cceb,_0xeb9997){return function(_0x5e6f52){if(!_0x5e6f52){_0xd5cceb[_0xdc68('0x18')](0x194);}return _0x5e6f52;};}function handleError(_0x599af3,_0x4121cd){_0x4121cd=_0x4121cd||0x1f4;return function(_0x41e500){logger[_0xdc68('0x25')](_0x41e500[_0xdc68('0x26')]);if(_0x41e500[_0xdc68('0x27')]){delete _0x41e500['name'];}_0x599af3['status'](_0x4121cd)['send'](_0x41e500);};}exports['show']=function(_0x268766,_0x11418b){var _0x296424={'raw':!![],'where':{'id':_0x268766[_0xdc68('0x28')]['id']}},_0x472ca4={};_0x472ca4[_0xdc68('0x29')]=_[_0xdc68('0x2a')](db[_0xdc68('0x2b')][_0xdc68('0x2c')]);_0x472ca4[_0xdc68('0x2d')]=_[_0xdc68('0x2a')](_0x268766['query']);_0x472ca4[_0xdc68('0x2e')]=_[_0xdc68('0x2f')](_0x472ca4['model'],_0x472ca4['query']);_0x296424[_0xdc68('0x30')]=_[_0xdc68('0x2f')](_0x472ca4['model'],qs[_0xdc68('0x31')](_0x268766[_0xdc68('0x2d')]['fields']));_0x296424[_0xdc68('0x30')]=_0x296424['attributes']['length']?_0x296424[_0xdc68('0x30')]:_0x472ca4['model'];if(_0x268766[_0xdc68('0x2d')][_0xdc68('0x32')]){_0x296424['include']=[{'all':!![]}];}_0x296424=_['merge']({},_0x296424,_0x268766[_0xdc68('0x33')]);return db[_0xdc68('0x2b')][_0xdc68('0x34')](_0x296424)['then'](handleEntityNotFound(_0x11418b,null))[_0xdc68('0x23')](respondWithResult(_0x11418b,null))[_0xdc68('0x35')](handleError(_0x11418b,null));};exports['update']=function(_0x1bf8c6,_0x4e47c5){if(_0x1bf8c6[_0xdc68('0x36')]['id']){delete _0x1bf8c6[_0xdc68('0x36')]['id'];}return db[_0xdc68('0x2b')][_0xdc68('0x34')]({'where':{'id':_0x1bf8c6[_0xdc68('0x28')]['id']}})['then'](handleEntityNotFound(_0x4e47c5,null))[_0xdc68('0x23')](saveUpdates(_0x1bf8c6[_0xdc68('0x36')],null))['then'](respondWithResult(_0x4e47c5,null))[_0xdc68('0x35')](handleError(_0x4e47c5,null));};exports[_0xdc68('0x24')]=function(_0x5b77b3,_0x1e563a){return db[_0xdc68('0x2b')][_0xdc68('0x34')]({'where':{'id':_0x5b77b3['params']['id']}})[_0xdc68('0x23')](handleEntityNotFound(_0x1e563a,null))[_0xdc68('0x23')](removeEntity(_0x1e563a,null))[_0xdc68('0x35')](handleError(_0x1e563a,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 18ad6fa..79e6850 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 _0x1b4a=['api','rimraf','../../config/environment','./chatApplication.attributes','exports','define','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x4dc4dd,_0xe3d8a4){var _0x46c030=function(_0x424349){while(--_0x424349){_0x4dc4dd['push'](_0x4dc4dd['shift']());}};_0x46c030(++_0xe3d8a4);}(_0x1b4a,0x99));var _0xa1b4=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x1b4a[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0xa1b4('0x0'));var util=require(_0xa1b4('0x1'));var logger=require(_0xa1b4('0x2'))(_0xa1b4('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(_0xa1b4('0x4'));var config=require(_0xa1b4('0x5'));var attributes=require(_0xa1b4('0x6'));module[_0xa1b4('0x7')]=function(_0x262f0c,_0x1a583c){return _0x262f0c[_0xa1b4('0x8')](_0xa1b4('0x9'),attributes,{'tableName':_0xa1b4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa1b4('0xb'),'collate':_0xa1b4('0xc')});}; \ No newline at end of file +var _0x5c21=['utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatApplication.attributes','exports','define','ChatApplication'];(function(_0x2430de,_0x40394d){var _0x30d356=function(_0x2cd79d){while(--_0x2cd79d){_0x2430de['push'](_0x2430de['shift']());}};_0x30d356(++_0x40394d);}(_0x5c21,0x119));var _0x15c2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5c21[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x15c2('0x0'));var util=require(_0x15c2('0x1'));var logger=require(_0x15c2('0x2'))(_0x15c2('0x3'));var moment=require(_0x15c2('0x4'));var BPromise=require('bluebird');var rp=require(_0x15c2('0x5'));var fs=require('fs');var path=require(_0x15c2('0x6'));var rimraf=require(_0x15c2('0x7'));var config=require(_0x15c2('0x8'));var attributes=require(_0x15c2('0x9'));module[_0x15c2('0xa')]=function(_0xa3217b,_0x25dd42){return _0xa3217b[_0x15c2('0xb')](_0x15c2('0xc'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x15c2('0xd')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index f6d2ea8..2c58432 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 _0x7afd=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird'];(function(_0x33b81e,_0x70384e){var _0x431c98=function(_0x3bbb88){while(--_0x3bbb88){_0x33b81e['push'](_0x33b81e['shift']());}};_0x431c98(++_0x70384e);}(_0x7afd,0x11c));var _0xd7af=function(_0x496c30,_0x4f32cf){_0x496c30=_0x496c30-0x0;var _0x168fbb=_0x7afd[_0x496c30];return _0x168fbb;};'use strict';var _=require(_0xd7af('0x0'));var util=require(_0xd7af('0x1'));var moment=require(_0xd7af('0x2'));var BPromise=require(_0xd7af('0x3'));var rs=require(_0xd7af('0x4'));var fs=require('fs');var Redis=require(_0xd7af('0x5'));var db=require(_0xd7af('0x6'))['db'];var utils=require(_0xd7af('0x7'));var logger=require('../../config/logger')(_0xd7af('0x8'));var config=require(_0xd7af('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd7af('0xa')][_0xd7af('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x501638,_0x52f399,_0x33e2cf){return new BPromise(function(_0x54bb8a,_0x4b326a){return client[_0xd7af('0xc')](_0x501638,_0x33e2cf)[_0xd7af('0xd')](function(_0x565c6b){logger[_0xd7af('0xe')](_0xd7af('0xf'),_0x52f399,_0xd7af('0x10'));logger[_0xd7af('0x11')](_0xd7af('0x12'),_0x52f399,'request\x20sent',JSON[_0xd7af('0x13')](_0x565c6b));if(_0x565c6b[_0xd7af('0x14')]){if(_0x565c6b[_0xd7af('0x14')]['code']===0x1f4){logger[_0xd7af('0x14')](_0xd7af('0xf'),_0x52f399,_0x565c6b['error'][_0xd7af('0x15')]);return _0x4b326a(_0x565c6b['error'][_0xd7af('0x15')]);}logger[_0xd7af('0x14')](_0xd7af('0xf'),_0x52f399,_0x565c6b[_0xd7af('0x14')][_0xd7af('0x15')]);return _0x54bb8a(_0x565c6b[_0xd7af('0x14')]['message']);}else{logger[_0xd7af('0xe')]('ChatApplication,\x20%s,\x20%s',_0x52f399,_0xd7af('0x10'));_0x54bb8a(_0x565c6b[_0xd7af('0x16')][_0xd7af('0x15')]);}})[_0xd7af('0x17')](function(_0x2b9eff){logger[_0xd7af('0x14')]('ChatApplication,\x20%s,\x20%s',_0x52f399,_0x2b9eff);_0x4b326a(_0x2b9eff);});});} \ No newline at end of file +var _0x80ee=['message','ChatApplication,\x20%s,\x20%s','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','request\x20sent','debug','stringify','error'];(function(_0x76a8ae,_0x38a5ea){var _0x3b3123=function(_0x2f95c6){while(--_0x2f95c6){_0x76a8ae['push'](_0x76a8ae['shift']());}};_0x3b3123(++_0x38a5ea);}(_0x80ee,0x67));var _0xe80e=function(_0x528bb5,_0x119c5b){_0x528bb5=_0x528bb5-0x0;var _0x58e8ca=_0x80ee[_0x528bb5];return _0x58e8ca;};'use strict';var _=require(_0xe80e('0x0'));var util=require(_0xe80e('0x1'));var moment=require('moment');var BPromise=require(_0xe80e('0x2'));var rs=require(_0xe80e('0x3'));var fs=require('fs');var Redis=require(_0xe80e('0x4'));var db=require(_0xe80e('0x5'))['db'];var utils=require(_0xe80e('0x6'));var logger=require(_0xe80e('0x7'))(_0xe80e('0x8'));var config=require('../../config/environment');var jayson=require(_0xe80e('0x9'));var client=jayson['client'][_0xe80e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5c76e7,_0x115769,_0x5ce479){return new BPromise(function(_0x26ad08,_0x2ad388){return client['request'](_0x5c76e7,_0x5ce479)[_0xe80e('0xb')](function(_0xeecff9){logger[_0xe80e('0xc')]('ChatApplication,\x20%s,\x20%s',_0x115769,_0xe80e('0xd'));logger[_0xe80e('0xe')]('ChatApplication,\x20%s,\x20%s,\x20%s',_0x115769,_0xe80e('0xd'),JSON[_0xe80e('0xf')](_0xeecff9));if(_0xeecff9['error']){if(_0xeecff9[_0xe80e('0x10')]['code']===0x1f4){logger['error']('ChatApplication,\x20%s,\x20%s',_0x115769,_0xeecff9[_0xe80e('0x10')][_0xe80e('0x11')]);return _0x2ad388(_0xeecff9[_0xe80e('0x10')][_0xe80e('0x11')]);}logger['error'](_0xe80e('0x12'),_0x115769,_0xeecff9[_0xe80e('0x10')][_0xe80e('0x11')]);return _0x26ad08(_0xeecff9['error']['message']);}else{logger[_0xe80e('0xc')](_0xe80e('0x12'),_0x115769,'request\x20sent');_0x26ad08(_0xeecff9['result']['message']);}})[_0xe80e('0x13')](function(_0x1d5c06){logger[_0xe80e('0x10')](_0xe80e('0x12'),_0x115769,_0x1d5c06);_0x2ad388(_0x1d5c06);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index aa01ce7..1facbb9 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 _0xbef1=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','/:id','isAuthenticated','show','put','update','delete'];(function(_0xca3c23,_0x45c5a3){var _0x4012b2=function(_0x471f72){while(--_0x471f72){_0xca3c23['push'](_0xca3c23['shift']());}};_0x4012b2(++_0x45c5a3);}(_0xbef1,0x154));var _0x1bef=function(_0x4192ad,_0x488f5c){_0x4192ad=_0x4192ad-0x0;var _0x415dc3=_0xbef1[_0x4192ad];return _0x415dc3;};'use strict';var multer=require('multer');var util=require(_0x1bef('0x0'));var path=require(_0x1bef('0x1'));var timeout=require(_0x1bef('0x2'));var express=require(_0x1bef('0x3'));var router=express[_0x1bef('0x4')]();var fs_extra=require(_0x1bef('0x5'));var auth=require(_0x1bef('0x6'));var interaction=require(_0x1bef('0x7'));var config=require(_0x1bef('0x8'));var controller=require(_0x1bef('0x9'));router[_0x1bef('0xa')](_0x1bef('0xb'),auth[_0x1bef('0xc')](),controller[_0x1bef('0xd')]);router[_0x1bef('0xe')]('/:id',auth[_0x1bef('0xc')](),controller[_0x1bef('0xf')]);router[_0x1bef('0x10')](_0x1bef('0xb'),auth[_0x1bef('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xd92c=['../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','/:id','isAuthenticated','show','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x1602ef,_0x447aba){var _0x5870ee=function(_0x4d94e7){while(--_0x4d94e7){_0x1602ef['push'](_0x1602ef['shift']());}};_0x5870ee(++_0x447aba);}(_0xd92c,0x1b3));var _0xcd92=function(_0x24d9e5,_0x42e6e2){_0x24d9e5=_0x24d9e5-0x0;var _0x2264b9=_0xd92c[_0x24d9e5];return _0x2264b9;};'use strict';var multer=require(_0xcd92('0x0'));var util=require(_0xcd92('0x1'));var path=require(_0xcd92('0x2'));var timeout=require(_0xcd92('0x3'));var express=require(_0xcd92('0x4'));var router=express[_0xcd92('0x5')]();var fs_extra=require(_0xcd92('0x6'));var auth=require(_0xcd92('0x7'));var interaction=require(_0xcd92('0x8'));var config=require(_0xcd92('0x9'));var controller=require(_0xcd92('0xa'));router['get'](_0xcd92('0xb'),auth[_0xcd92('0xc')](),controller[_0xcd92('0xd')]);router['put'](_0xcd92('0xb'),auth[_0xcd92('0xc')](),controller[_0xcd92('0xe')]);router[_0xcd92('0xf')](_0xcd92('0xb'),auth['isAuthenticated'](),controller[_0xcd92('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 884daf9..1b05094 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 _0x5a4f=['STRING','BOOLEAN','sequelize'];(function(_0x317cc2,_0x3aacf3){var _0x10d052=function(_0x3432ec){while(--_0x3432ec){_0x317cc2['push'](_0x317cc2['shift']());}};_0x10d052(++_0x3aacf3);}(_0x5a4f,0x10d));var _0xf5a4=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0x5a4f[_0x376b45];return _0x2341b3;};'use strict';var Sequelize=require(_0xf5a4('0x0'));module['exports']={'name':{'type':Sequelize[_0xf5a4('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0xf5a4('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0xac73=['STRING','BOOLEAN','sequelize','exports'];(function(_0x14193b,_0x26c176){var _0x3c3e79=function(_0x218d63){while(--_0x218d63){_0x14193b['push'](_0x14193b['shift']());}};_0x3c3e79(++_0x26c176);}(_0xac73,0x186));var _0x3ac7=function(_0x29b602,_0x294bfb){_0x29b602=_0x29b602-0x0;var _0x5e0a5b=_0xac73[_0x29b602];return _0x5e0a5b;};'use strict';var Sequelize=require(_0x3ac7('0x0'));module[_0x3ac7('0x1')]={'name':{'type':Sequelize[_0x3ac7('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x3ac7('0x2')]},'write':{'type':Sequelize[_0x3ac7('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 8042ef5..e991eda 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 _0x7a6a=['body','params','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','findOne','User','pick','getMembers','removeMembers','addMessage','getMessages','$gte','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./chatGroup.socket','register','sendStatus','end','status','json','offset','limit','undefined','count','Content-Range','apply','reject','update','then','destroy','error','name','send','ChatGroup','rawAttributes','fieldName','model','map','keys','query','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','merge','type','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','options','find','create'];(function(_0x353cad,_0x52220e){var _0xc1cfe3=function(_0x3f1c02){while(--_0x3f1c02){_0x353cad['push'](_0x353cad['shift']());}};_0xc1cfe3(++_0x52220e);}(_0x7a6a,0x19b));var _0xa7a6=function(_0x21a0c2,_0x4562da){_0x21a0c2=_0x21a0c2-0x0;var _0xa9659e=_0x7a6a[_0x21a0c2];return _0xa9659e;};'use strict';var emlformat=require(_0xa7a6('0x0'));var rimraf=require(_0xa7a6('0x1'));var zipdir=require(_0xa7a6('0x2'));var jsonpatch=require(_0xa7a6('0x3'));var rp=require(_0xa7a6('0x4'));var moment=require('moment');var BPromise=require(_0xa7a6('0x5'));var Mustache=require(_0xa7a6('0x6'));var util=require(_0xa7a6('0x7'));var path=require('path');var sox=require(_0xa7a6('0x8'));var csv=require(_0xa7a6('0x9'));var ejs=require(_0xa7a6('0xa'));var fs=require('fs');var fs_extra=require(_0xa7a6('0xb'));var _=require(_0xa7a6('0xc'));var squel=require(_0xa7a6('0xd'));var crypto=require(_0xa7a6('0xe'));var jsforce=require(_0xa7a6('0xf'));var deskjs=require(_0xa7a6('0x10'));var toCsv=require(_0xa7a6('0x9'));var querystring=require(_0xa7a6('0x11'));var Papa=require('papaparse');var Redis=require(_0xa7a6('0x12'));var authService=require(_0xa7a6('0x13'));var qs=require(_0xa7a6('0x14'));var as=require(_0xa7a6('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa7a6('0x16'))('api');var utils=require(_0xa7a6('0x17'));var config=require(_0xa7a6('0x18'));var licenseUtil=require(_0xa7a6('0x19'));var db=require(_0xa7a6('0x1a'))['db'];config[_0xa7a6('0x1b')]=_['defaults'](config['redis'],{'host':_0xa7a6('0x1c'),'port':0x18eb});var socket=require(_0xa7a6('0x1d'))(new Redis(config['redis']));require(_0xa7a6('0x1e'))[_0xa7a6('0x1f')](socket);function respondWithStatusCode(_0x58b727,_0x425c6d){_0x425c6d=_0x425c6d||0xcc;return function(_0x1ef935){if(_0x1ef935){return _0x58b727[_0xa7a6('0x20')](_0x425c6d);}return _0x58b727['status'](_0x425c6d)[_0xa7a6('0x21')]();};}function respondWithResult(_0x29b3f2,_0x5565bf){_0x5565bf=_0x5565bf||0xc8;return function(_0x2ff273){if(_0x2ff273){return _0x29b3f2[_0xa7a6('0x22')](_0x5565bf)[_0xa7a6('0x23')](_0x2ff273);}};}function respondWithFilteredResult(_0x223af4,_0x56f3c0){return function(_0x481a7a){if(_0x481a7a){var _0x186b3c=typeof _0x56f3c0[_0xa7a6('0x24')]==='undefined'&&typeof _0x56f3c0[_0xa7a6('0x25')]===_0xa7a6('0x26');var _0x2009af=_0x481a7a['count'];var _0x10db83=_0x186b3c?0x0:_0x56f3c0[_0xa7a6('0x24')];var _0x287a44=_0x186b3c?_0x481a7a[_0xa7a6('0x27')]:_0x56f3c0[_0xa7a6('0x24')]+_0x56f3c0[_0xa7a6('0x25')];var _0x4c7741;if(_0x287a44>=_0x2009af){_0x287a44=_0x2009af;_0x4c7741=0xc8;}else{_0x4c7741=0xce;}_0x223af4[_0xa7a6('0x22')](_0x4c7741);return _0x223af4['set'](_0xa7a6('0x28'),_0x10db83+'-'+_0x287a44+'/'+_0x2009af)[_0xa7a6('0x23')](_0x481a7a);}return null;};}function patchUpdates(_0x5d196e){return function(_0x2a3ec3){try{jsonpatch[_0xa7a6('0x29')](_0x2a3ec3,_0x5d196e,!![]);}catch(_0x3e1105){return BPromise[_0xa7a6('0x2a')](_0x3e1105);}return _0x2a3ec3['save']();};}function saveUpdates(_0x9e8733,_0x3a7c81){return function(_0x56fa49){if(_0x56fa49){return _0x56fa49[_0xa7a6('0x2b')](_0x9e8733)[_0xa7a6('0x2c')](function(_0x517c2a){return _0x517c2a;});}return null;};}function removeEntity(_0x1a265b,_0x32e18b){return function(_0x3dc520){if(_0x3dc520){return _0x3dc520[_0xa7a6('0x2d')]()[_0xa7a6('0x2c')](function(){_0x1a265b[_0xa7a6('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x401ff1,_0xc0594){return function(_0x45f29c){if(!_0x45f29c){_0x401ff1[_0xa7a6('0x20')](0x194);}return _0x45f29c;};}function handleError(_0x2d3d68,_0x5bd74d){_0x5bd74d=_0x5bd74d||0x1f4;return function(_0x281413){logger[_0xa7a6('0x2e')](_0x281413['stack']);if(_0x281413['name']){delete _0x281413[_0xa7a6('0x2f')];}_0x2d3d68[_0xa7a6('0x22')](_0x5bd74d)[_0xa7a6('0x30')](_0x281413);};}exports['index']=function(_0x5edb7a,_0x55249d){var _0x539e5b={},_0x5b8bae={},_0x5aba8a={'count':0x0,'rows':[]};var _0x188268=_['map'](db[_0xa7a6('0x31')][_0xa7a6('0x32')],function(_0x1cfec7){return{'name':_0x1cfec7[_0xa7a6('0x33')],'type':_0x1cfec7['type']['key']};});_0x5b8bae[_0xa7a6('0x34')]=_[_0xa7a6('0x35')](_0x188268,_0xa7a6('0x2f'));_0x5b8bae['query']=_[_0xa7a6('0x36')](_0x5edb7a[_0xa7a6('0x37')]);_0x5b8bae[_0xa7a6('0x38')]=_[_0xa7a6('0x39')](_0x5b8bae[_0xa7a6('0x34')],_0x5b8bae[_0xa7a6('0x37')]);_0x539e5b['attributes']=_['intersection'](_0x5b8bae['model'],qs[_0xa7a6('0x3a')](_0x5edb7a['query'][_0xa7a6('0x3a')]));_0x539e5b['attributes']=_0x539e5b['attributes'][_0xa7a6('0x3b')]?_0x539e5b[_0xa7a6('0x3c')]:_0x5b8bae[_0xa7a6('0x34')];if(!_0x5edb7a[_0xa7a6('0x37')][_0xa7a6('0x3d')](_0xa7a6('0x3e'))){_0x539e5b[_0xa7a6('0x25')]=qs[_0xa7a6('0x25')](_0x5edb7a['query'][_0xa7a6('0x25')]);_0x539e5b[_0xa7a6('0x24')]=qs[_0xa7a6('0x24')](_0x5edb7a['query']['offset']);}_0x539e5b[_0xa7a6('0x3f')]=qs[_0xa7a6('0x40')](_0x5edb7a['query'][_0xa7a6('0x40')]);_0x539e5b[_0xa7a6('0x41')]=qs['filters'](_['pick'](_0x5edb7a[_0xa7a6('0x37')],_0x5b8bae[_0xa7a6('0x38')]),_0x188268);if(_0x5edb7a[_0xa7a6('0x37')]['filter']){_0x539e5b['where']=_[_0xa7a6('0x42')](_0x539e5b[_0xa7a6('0x41')],{'$or':_[_0xa7a6('0x35')](_0x188268,function(_0x46bee2){if(_0x46bee2[_0xa7a6('0x43')]!==_0xa7a6('0x44')){var _0x43ff9e={};_0x43ff9e[_0x46bee2[_0xa7a6('0x2f')]]={'$like':'%'+_0x5edb7a[_0xa7a6('0x37')][_0xa7a6('0x45')]+'%'};return _0x43ff9e;}})});}_0x539e5b=_[_0xa7a6('0x42')]({},_0x539e5b,_0x5edb7a['options']);var _0x39cf9f={'where':_0x539e5b[_0xa7a6('0x41')]};return db[_0xa7a6('0x31')]['count'](_0x39cf9f)['then'](function(_0x163997){_0x5aba8a['count']=_0x163997;if(_0x5edb7a['query'][_0xa7a6('0x46')]){_0x539e5b[_0xa7a6('0x47')]=[{'all':!![]}];}return db['ChatGroup'][_0xa7a6('0x48')](_0x539e5b);})['then'](function(_0x3ee11a){_0x5aba8a[_0xa7a6('0x49')]=_0x3ee11a;return _0x5aba8a;})[_0xa7a6('0x2c')](respondWithFilteredResult(_0x55249d,_0x539e5b))[_0xa7a6('0x4a')](handleError(_0x55249d,null));};exports[_0xa7a6('0x4b')]=function(_0x3742d6,_0x50bd8b){var _0x140772={'raw':!![],'where':{'id':_0x3742d6['params']['id']}},_0x53dc64={};_0x53dc64[_0xa7a6('0x34')]=_[_0xa7a6('0x36')](db[_0xa7a6('0x31')][_0xa7a6('0x32')]);_0x53dc64[_0xa7a6('0x37')]=_[_0xa7a6('0x36')](_0x3742d6[_0xa7a6('0x37')]);_0x53dc64[_0xa7a6('0x38')]=_[_0xa7a6('0x39')](_0x53dc64['model'],_0x53dc64[_0xa7a6('0x37')]);_0x140772['attributes']=_['intersection'](_0x53dc64[_0xa7a6('0x34')],qs[_0xa7a6('0x3a')](_0x3742d6['query'][_0xa7a6('0x3a')]));_0x140772['attributes']=_0x140772[_0xa7a6('0x3c')][_0xa7a6('0x3b')]?_0x140772[_0xa7a6('0x3c')]:_0x53dc64['model'];if(_0x3742d6[_0xa7a6('0x37')][_0xa7a6('0x46')]){_0x140772[_0xa7a6('0x47')]=[{'all':!![]}];}_0x140772=_[_0xa7a6('0x42')]({},_0x140772,_0x3742d6[_0xa7a6('0x4c')]);return db[_0xa7a6('0x31')][_0xa7a6('0x4d')](_0x140772)[_0xa7a6('0x2c')](handleEntityNotFound(_0x50bd8b,null))[_0xa7a6('0x2c')](respondWithResult(_0x50bd8b,null))[_0xa7a6('0x4a')](handleError(_0x50bd8b,null));};exports['create']=function(_0x300a3a,_0x1d9881){return db['ChatGroup'][_0xa7a6('0x4e')](_0x300a3a[_0xa7a6('0x4f')],{})[_0xa7a6('0x2c')](respondWithResult(_0x1d9881,0xc9))[_0xa7a6('0x4a')](handleError(_0x1d9881,null));};exports[_0xa7a6('0x2b')]=function(_0x2ccd45,_0x57948e){if(_0x2ccd45[_0xa7a6('0x4f')]['id']){delete _0x2ccd45['body']['id'];}return db[_0xa7a6('0x31')][_0xa7a6('0x4d')]({'where':{'id':_0x2ccd45[_0xa7a6('0x50')]['id']}})[_0xa7a6('0x2c')](handleEntityNotFound(_0x57948e,null))[_0xa7a6('0x2c')](saveUpdates(_0x2ccd45[_0xa7a6('0x4f')],null))[_0xa7a6('0x2c')](respondWithResult(_0x57948e,null))[_0xa7a6('0x4a')](handleError(_0x57948e,null));};exports['destroy']=function(_0x1ff91f,_0x346aa1){return db[_0xa7a6('0x31')]['find']({'where':{'id':_0x1ff91f['params']['id']}})['then'](handleEntityNotFound(_0x346aa1,null))['then'](removeEntity(_0x346aa1,null))['catch'](handleError(_0x346aa1,null));};exports['describe']=function(_0x130cd8,_0x422890){return db[_0xa7a6('0x31')][_0xa7a6('0x51')]()[_0xa7a6('0x2c')](respondWithResult(_0x422890,null))[_0xa7a6('0x4a')](handleError(_0x422890,null));};exports[_0xa7a6('0x52')]=function(_0x2df859,_0x393b39,_0x52db92){return db[_0xa7a6('0x53')][_0xa7a6('0x27')]({'where':{'ChatGroupId':_0x2df859[_0xa7a6('0x50')]['id'],'ToId':_0x2df859[_0xa7a6('0x54')]['id'],'read':![]}})[_0xa7a6('0x2c')](function(_0x3d61c5){return{'id':_[_0xa7a6('0x55')](_0x2df859[_0xa7a6('0x50')]['id']),'count':_0x3d61c5};})[_0xa7a6('0x2c')](respondWithResult(_0x393b39,null))['catch'](handleError(_0x393b39,null));};exports[_0xa7a6('0x56')]=function(_0x34d5dd,_0x3306c8,_0x48f583){return db['ChatGroup'][_0xa7a6('0x4d')]({'where':{'id':_0x34d5dd['params']['id']}})[_0xa7a6('0x2c')](handleEntityNotFound(_0x3306c8,null))[_0xa7a6('0x2c')](function(_0x3b3f7f){if(_0x3b3f7f){return _0x3b3f7f[_0xa7a6('0x56')](_0x34d5dd['body']['ids'],_['omit'](_0x34d5dd[_0xa7a6('0x4f')],[_0xa7a6('0x57'),'id'])||{});}})[_0xa7a6('0x2c')](respondWithResult(_0x3306c8,null))[_0xa7a6('0x4a')](handleError(_0x3306c8,null));};exports['getMembers']=function(_0x41abd8,_0x124ed2,_0x2eef4e){var _0x57941a={};var _0x2b135e={};var _0x46f775;var _0x12eef5;return db['ChatGroup'][_0xa7a6('0x58')]({'where':{'id':_0x41abd8[_0xa7a6('0x50')]['id']}})['then'](handleEntityNotFound(_0x124ed2,null))[_0xa7a6('0x2c')](function(_0x269613){if(_0x269613){_0x46f775=_0x269613;_0x2b135e[_0xa7a6('0x34')]=_[_0xa7a6('0x36')](db[_0xa7a6('0x59')][_0xa7a6('0x32')]);_0x2b135e[_0xa7a6('0x37')]=_[_0xa7a6('0x36')](_0x41abd8['query']);_0x2b135e['filters']=_[_0xa7a6('0x39')](_0x2b135e[_0xa7a6('0x34')],_0x2b135e[_0xa7a6('0x37')]);_0x57941a[_0xa7a6('0x3c')]=_['intersection'](_0x2b135e[_0xa7a6('0x34')],qs['fields'](_0x41abd8['query'][_0xa7a6('0x3a')]));_0x57941a[_0xa7a6('0x3c')]=_0x57941a[_0xa7a6('0x3c')][_0xa7a6('0x3b')]?_0x57941a['attributes']:_0x2b135e[_0xa7a6('0x34')];_0x57941a['order']=qs['sort'](_0x41abd8[_0xa7a6('0x37')][_0xa7a6('0x40')]);_0x57941a['where']=qs['filters'](_[_0xa7a6('0x5a')](_0x41abd8[_0xa7a6('0x37')],_0x2b135e[_0xa7a6('0x38')]));if(_0x41abd8[_0xa7a6('0x37')][_0xa7a6('0x45')]){_0x57941a[_0xa7a6('0x41')]=_[_0xa7a6('0x42')](_0x57941a[_0xa7a6('0x41')],{'$or':_[_0xa7a6('0x35')](_0x57941a[_0xa7a6('0x3c')],function(_0x4cbd2b){var _0x33487c={};_0x33487c[_0x4cbd2b]={'$like':'%'+_0x41abd8['query'][_0xa7a6('0x45')]+'%'};return _0x33487c;})});}_0x57941a=_[_0xa7a6('0x42')]({},_0x57941a,_0x41abd8[_0xa7a6('0x4c')]);return _0x46f775[_0xa7a6('0x5b')](_0x57941a);}})[_0xa7a6('0x2c')](function(_0x4d7e43){if(_0x4d7e43){_0x12eef5=_0x4d7e43[_0xa7a6('0x3b')];if(!_0x41abd8['query'][_0xa7a6('0x3d')]('nolimit')){_0x57941a[_0xa7a6('0x25')]=qs[_0xa7a6('0x25')](_0x41abd8['query'][_0xa7a6('0x25')]);_0x57941a[_0xa7a6('0x24')]=qs['offset'](_0x41abd8[_0xa7a6('0x37')][_0xa7a6('0x24')]);}return _0x46f775['getMembers'](_0x57941a);}})[_0xa7a6('0x2c')](function(_0xb693a0){if(_0xb693a0){return _0xb693a0?{'count':_0x12eef5,'rows':_0xb693a0}:null;}})[_0xa7a6('0x2c')](respondWithResult(_0x124ed2,null))[_0xa7a6('0x4a')](handleError(_0x124ed2,null));};exports[_0xa7a6('0x5c')]=function(_0x231213,_0x167e39,_0x317466){return db['ChatGroup'][_0xa7a6('0x4d')]({'where':{'id':_0x231213[_0xa7a6('0x50')]['id']}})[_0xa7a6('0x2c')](handleEntityNotFound(_0x167e39,null))['then'](function(_0x250580){if(_0x250580){return _0x250580[_0xa7a6('0x5c')](_0x231213[_0xa7a6('0x37')][_0xa7a6('0x57')]);}})[_0xa7a6('0x2c')](respondWithStatusCode(_0x167e39,null))[_0xa7a6('0x4a')](handleError(_0x167e39,null));};exports[_0xa7a6('0x5d')]=function(_0x16f456,_0x420e38,_0x176013){if(_0x16f456[_0xa7a6('0x4f')]['id']){delete _0x16f456[_0xa7a6('0x4f')]['id'];}return db[_0xa7a6('0x31')]['find']({'where':{'id':_0x16f456[_0xa7a6('0x50')]['id']}})[_0xa7a6('0x2c')](handleEntityNotFound(_0x420e38,null))[_0xa7a6('0x2c')](function(_0x377bc2){if(_0x377bc2){_0x16f456[_0xa7a6('0x4f')]['ChatGroupId']=_0x377bc2['id'];return db[_0xa7a6('0x53')]['create'](_0x16f456[_0xa7a6('0x4f')]);}})['then'](respondWithResult(_0x420e38,null))[_0xa7a6('0x4a')](handleError(_0x420e38,null));};exports[_0xa7a6('0x5e')]=function(_0x35dcc5,_0x5cee29,_0x1521f7){var _0x3754f0={};var _0x2a009d={};var _0x26d9f6;var _0x500b4f;return db[_0xa7a6('0x31')][_0xa7a6('0x58')]({'where':{'id':_0x35dcc5[_0xa7a6('0x50')]['id']}})[_0xa7a6('0x2c')](handleEntityNotFound(_0x5cee29,null))[_0xa7a6('0x2c')](function(_0x6f03a9){if(_0x6f03a9){_0x26d9f6=_0x6f03a9;_0x2a009d[_0xa7a6('0x34')]=_['keys'](db[_0xa7a6('0x53')][_0xa7a6('0x32')]);_0x2a009d[_0xa7a6('0x37')]=_[_0xa7a6('0x36')](_0x35dcc5[_0xa7a6('0x37')]);_0x2a009d['filters']=_[_0xa7a6('0x39')](_0x2a009d[_0xa7a6('0x34')],_0x2a009d[_0xa7a6('0x37')]);_0x3754f0['attributes']=_['intersection'](_0x2a009d['model'],qs[_0xa7a6('0x3a')](_0x35dcc5[_0xa7a6('0x37')][_0xa7a6('0x3a')]));_0x3754f0[_0xa7a6('0x3c')]=_0x3754f0[_0xa7a6('0x3c')][_0xa7a6('0x3b')]?_0x3754f0[_0xa7a6('0x3c')]:_0x2a009d[_0xa7a6('0x34')];_0x3754f0[_0xa7a6('0x3f')]=qs[_0xa7a6('0x40')](_0x35dcc5[_0xa7a6('0x37')]['sort']);_0x3754f0[_0xa7a6('0x41')]=qs[_0xa7a6('0x38')](_[_0xa7a6('0x5a')](_0x35dcc5[_0xa7a6('0x37')],_0x2a009d[_0xa7a6('0x38')]));if(_0x35dcc5[_0xa7a6('0x37')][_0xa7a6('0x45')]){_0x3754f0['where']=_[_0xa7a6('0x42')](_0x3754f0['where'],{'$or':_[_0xa7a6('0x35')](_0x3754f0[_0xa7a6('0x3c')],function(_0x53f647){var _0x2ea1bf={};_0x2ea1bf[_0x53f647]={'$like':'%'+_0x35dcc5['query'][_0xa7a6('0x45')]+'%'};return _0x2ea1bf;})});}if(_0x35dcc5[_0xa7a6('0x37')][_0xa7a6('0x5f')]){var _0x588836=_0x35dcc5[_0xa7a6('0x37')]['$gte']['split'](',');var _0x4005fd={};_0x4005fd[_0x588836[0x0]]={'$gte':moment(_0x588836[0x1])[_0xa7a6('0x60')](_0xa7a6('0x61'))};_0x3754f0[_0xa7a6('0x41')]=_[_0xa7a6('0x42')](_0x3754f0[_0xa7a6('0x41')],_0x4005fd);}_0x3754f0=_['merge']({},_0x3754f0,_0x35dcc5['options']);return _0x26d9f6[_0xa7a6('0x5e')](_0x3754f0);}})[_0xa7a6('0x2c')](function(_0x3cf0b){if(_0x3cf0b){_0x500b4f=_0x3cf0b[_0xa7a6('0x3b')];if(!_0x35dcc5['query'][_0xa7a6('0x3d')](_0xa7a6('0x3e'))){_0x3754f0[_0xa7a6('0x25')]=qs[_0xa7a6('0x25')](_0x35dcc5[_0xa7a6('0x37')]['limit']);_0x3754f0[_0xa7a6('0x24')]=qs[_0xa7a6('0x24')](_0x35dcc5[_0xa7a6('0x37')][_0xa7a6('0x24')]);}return _0x26d9f6[_0xa7a6('0x5e')](_0x3754f0);}})[_0xa7a6('0x2c')](function(_0x5b4d91){if(_0x5b4d91){return _0x5b4d91?{'count':_0x500b4f,'rows':_0x5b4d91}:null;}})[_0xa7a6('0x2c')](respondWithResult(_0x5cee29,null))[_0xa7a6('0x4a')](handleError(_0x5cee29,null));}; \ No newline at end of file +var _0x610d=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','socket.io-emitter','./chatGroup.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','error','stack','name','send','index','ChatGroup','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','length','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','then','includeAll','rows','catch','show','params','fields','include','find','create','body','destroy','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','omit','findOne','User','getMembers','hasOwnProperty','nolimit','removeMembers','addMessage','ChatGroupId','getMessages','$gte','split','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger'];(function(_0x491413,_0x5a439e){var _0x783705=function(_0x54cceb){while(--_0x54cceb){_0x491413['push'](_0x491413['shift']());}};_0x783705(++_0x5a439e);}(_0x610d,0x175));var _0xd610=function(_0x4af78d,_0x10b5e1){_0x4af78d=_0x4af78d-0x0;var _0x1892da=_0x610d[_0x4af78d];return _0x1892da;};'use strict';var emlformat=require(_0xd610('0x0'));var rimraf=require(_0xd610('0x1'));var zipdir=require(_0xd610('0x2'));var jsonpatch=require(_0xd610('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd610('0x4'));var Mustache=require(_0xd610('0x5'));var util=require(_0xd610('0x6'));var path=require(_0xd610('0x7'));var sox=require(_0xd610('0x8'));var csv=require(_0xd610('0x9'));var ejs=require(_0xd610('0xa'));var fs=require('fs');var fs_extra=require(_0xd610('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xd610('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xd610('0xd'));var toCsv=require(_0xd610('0x9'));var querystring=require(_0xd610('0xe'));var Papa=require(_0xd610('0xf'));var Redis=require(_0xd610('0x10'));var authService=require(_0xd610('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd610('0x12'))(_0xd610('0x13'));var utils=require(_0xd610('0x14'));var config=require(_0xd610('0x15'));var licenseUtil=require(_0xd610('0x16'));var db=require(_0xd610('0x17'))['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xd610('0x18'))(new Redis(config['redis']));require(_0xd610('0x19'))[_0xd610('0x1a')](socket);function respondWithStatusCode(_0x45e02a,_0x27eb3c){_0x27eb3c=_0x27eb3c||0xcc;return function(_0x57c982){if(_0x57c982){return _0x45e02a[_0xd610('0x1b')](_0x27eb3c);}return _0x45e02a[_0xd610('0x1c')](_0x27eb3c)[_0xd610('0x1d')]();};}function respondWithResult(_0x3c2173,_0x5ce263){_0x5ce263=_0x5ce263||0xc8;return function(_0x1e70ff){if(_0x1e70ff){return _0x3c2173[_0xd610('0x1c')](_0x5ce263)['json'](_0x1e70ff);}};}function respondWithFilteredResult(_0x373f39,_0x4f4180){return function(_0x195fe9){if(_0x195fe9){var _0x19e318=typeof _0x4f4180[_0xd610('0x1e')]===_0xd610('0x1f')&&typeof _0x4f4180[_0xd610('0x20')]===_0xd610('0x1f');var _0x4fc34b=_0x195fe9[_0xd610('0x21')];var _0x33c86b=_0x19e318?0x0:_0x4f4180[_0xd610('0x1e')];var _0x2da88a=_0x19e318?_0x195fe9[_0xd610('0x21')]:_0x4f4180['offset']+_0x4f4180['limit'];var _0x31fa89;if(_0x2da88a>=_0x4fc34b){_0x2da88a=_0x4fc34b;_0x31fa89=0xc8;}else{_0x31fa89=0xce;}_0x373f39[_0xd610('0x1c')](_0x31fa89);return _0x373f39[_0xd610('0x22')]('Content-Range',_0x33c86b+'-'+_0x2da88a+'/'+_0x4fc34b)[_0xd610('0x23')](_0x195fe9);}return null;};}function patchUpdates(_0x32651e){return function(_0x1d136a){try{jsonpatch[_0xd610('0x24')](_0x1d136a,_0x32651e,!![]);}catch(_0x3b50b8){return BPromise[_0xd610('0x25')](_0x3b50b8);}return _0x1d136a[_0xd610('0x26')]();};}function saveUpdates(_0x254069,_0x2b4ee1){return function(_0x73b73f){if(_0x73b73f){return _0x73b73f[_0xd610('0x27')](_0x254069)['then'](function(_0x762709){return _0x762709;});}return null;};}function removeEntity(_0x5e4379,_0x1b8644){return function(_0x31d56a){if(_0x31d56a){return _0x31d56a['destroy']()['then'](function(){_0x5e4379['status'](0xcc)[_0xd610('0x1d')]();});}};}function handleEntityNotFound(_0x3f2302,_0xfbf197){return function(_0x275fdc){if(!_0x275fdc){_0x3f2302[_0xd610('0x1b')](0x194);}return _0x275fdc;};}function handleError(_0x51c1e0,_0x54261a){_0x54261a=_0x54261a||0x1f4;return function(_0x34581f){logger[_0xd610('0x28')](_0x34581f[_0xd610('0x29')]);if(_0x34581f[_0xd610('0x2a')]){delete _0x34581f['name'];}_0x51c1e0[_0xd610('0x1c')](_0x54261a)[_0xd610('0x2b')](_0x34581f);};}exports[_0xd610('0x2c')]=function(_0x219811,_0x5eddaa){var _0x2f0e36={},_0x15018c={},_0xf8bdb1={'count':0x0,'rows':[]};var _0x2fdf4d=_['map'](db[_0xd610('0x2d')][_0xd610('0x2e')],function(_0x19a767){return{'name':_0x19a767[_0xd610('0x2f')],'type':_0x19a767[_0xd610('0x30')][_0xd610('0x31')]};});_0x15018c[_0xd610('0x32')]=_[_0xd610('0x33')](_0x2fdf4d,_0xd610('0x2a'));_0x15018c[_0xd610('0x34')]=_[_0xd610('0x35')](_0x219811[_0xd610('0x34')]);_0x15018c['filters']=_[_0xd610('0x36')](_0x15018c[_0xd610('0x32')],_0x15018c['query']);_0x2f0e36['attributes']=_[_0xd610('0x36')](_0x15018c[_0xd610('0x32')],qs['fields'](_0x219811[_0xd610('0x34')]['fields']));_0x2f0e36[_0xd610('0x37')]=_0x2f0e36[_0xd610('0x37')][_0xd610('0x38')]?_0x2f0e36[_0xd610('0x37')]:_0x15018c[_0xd610('0x32')];if(!_0x219811[_0xd610('0x34')]['hasOwnProperty']('nolimit')){_0x2f0e36['limit']=qs[_0xd610('0x20')](_0x219811['query'][_0xd610('0x20')]);_0x2f0e36[_0xd610('0x1e')]=qs['offset'](_0x219811[_0xd610('0x34')][_0xd610('0x1e')]);}_0x2f0e36[_0xd610('0x39')]=qs[_0xd610('0x3a')](_0x219811[_0xd610('0x34')][_0xd610('0x3a')]);_0x2f0e36[_0xd610('0x3b')]=qs[_0xd610('0x3c')](_[_0xd610('0x3d')](_0x219811[_0xd610('0x34')],_0x15018c[_0xd610('0x3c')]),_0x2fdf4d);if(_0x219811[_0xd610('0x34')]['filter']){_0x2f0e36[_0xd610('0x3b')]=_[_0xd610('0x3e')](_0x2f0e36['where'],{'$or':_[_0xd610('0x33')](_0x2fdf4d,function(_0x22fa8c){if(_0x22fa8c[_0xd610('0x30')]!==_0xd610('0x3f')){var _0x1569a8={};_0x1569a8[_0x22fa8c[_0xd610('0x2a')]]={'$like':'%'+_0x219811[_0xd610('0x34')][_0xd610('0x40')]+'%'};return _0x1569a8;}})});}_0x2f0e36=_[_0xd610('0x3e')]({},_0x2f0e36,_0x219811[_0xd610('0x41')]);var _0x324f8f={'where':_0x2f0e36[_0xd610('0x3b')]};return db[_0xd610('0x2d')]['count'](_0x324f8f)[_0xd610('0x42')](function(_0x4712a2){_0xf8bdb1[_0xd610('0x21')]=_0x4712a2;if(_0x219811[_0xd610('0x34')][_0xd610('0x43')]){_0x2f0e36['include']=[{'all':!![]}];}return db[_0xd610('0x2d')]['findAll'](_0x2f0e36);})[_0xd610('0x42')](function(_0x32b68d){_0xf8bdb1[_0xd610('0x44')]=_0x32b68d;return _0xf8bdb1;})[_0xd610('0x42')](respondWithFilteredResult(_0x5eddaa,_0x2f0e36))[_0xd610('0x45')](handleError(_0x5eddaa,null));};exports[_0xd610('0x46')]=function(_0x421141,_0x16ffc1){var _0x28f6d2={'raw':!![],'where':{'id':_0x421141[_0xd610('0x47')]['id']}},_0x3bab2f={};_0x3bab2f['model']=_[_0xd610('0x35')](db['ChatGroup'][_0xd610('0x2e')]);_0x3bab2f['query']=_[_0xd610('0x35')](_0x421141['query']);_0x3bab2f['filters']=_[_0xd610('0x36')](_0x3bab2f[_0xd610('0x32')],_0x3bab2f[_0xd610('0x34')]);_0x28f6d2['attributes']=_['intersection'](_0x3bab2f[_0xd610('0x32')],qs[_0xd610('0x48')](_0x421141[_0xd610('0x34')][_0xd610('0x48')]));_0x28f6d2[_0xd610('0x37')]=_0x28f6d2[_0xd610('0x37')][_0xd610('0x38')]?_0x28f6d2[_0xd610('0x37')]:_0x3bab2f[_0xd610('0x32')];if(_0x421141[_0xd610('0x34')][_0xd610('0x43')]){_0x28f6d2[_0xd610('0x49')]=[{'all':!![]}];}_0x28f6d2=_['merge']({},_0x28f6d2,_0x421141[_0xd610('0x41')]);return db[_0xd610('0x2d')][_0xd610('0x4a')](_0x28f6d2)['then'](handleEntityNotFound(_0x16ffc1,null))[_0xd610('0x42')](respondWithResult(_0x16ffc1,null))[_0xd610('0x45')](handleError(_0x16ffc1,null));};exports[_0xd610('0x4b')]=function(_0x2b53fb,_0x28e8ef){return db['ChatGroup'][_0xd610('0x4b')](_0x2b53fb[_0xd610('0x4c')],{})[_0xd610('0x42')](respondWithResult(_0x28e8ef,0xc9))[_0xd610('0x45')](handleError(_0x28e8ef,null));};exports[_0xd610('0x27')]=function(_0x577816,_0x154ba7){if(_0x577816[_0xd610('0x4c')]['id']){delete _0x577816['body']['id'];}return db[_0xd610('0x2d')][_0xd610('0x4a')]({'where':{'id':_0x577816[_0xd610('0x47')]['id']}})[_0xd610('0x42')](handleEntityNotFound(_0x154ba7,null))[_0xd610('0x42')](saveUpdates(_0x577816['body'],null))[_0xd610('0x42')](respondWithResult(_0x154ba7,null))[_0xd610('0x45')](handleError(_0x154ba7,null));};exports[_0xd610('0x4d')]=function(_0x1fcafe,_0x172f17){return db[_0xd610('0x2d')][_0xd610('0x4a')]({'where':{'id':_0x1fcafe[_0xd610('0x47')]['id']}})['then'](handleEntityNotFound(_0x172f17,null))['then'](removeEntity(_0x172f17,null))['catch'](handleError(_0x172f17,null));};exports[_0xd610('0x4e')]=function(_0x10e057,_0x5b7039){return db[_0xd610('0x2d')][_0xd610('0x4e')]()[_0xd610('0x42')](respondWithResult(_0x5b7039,null))[_0xd610('0x45')](handleError(_0x5b7039,null));};exports[_0xd610('0x4f')]=function(_0x468c0d,_0x4d0690,_0x3ca62b){return db[_0xd610('0x50')][_0xd610('0x21')]({'where':{'ChatGroupId':_0x468c0d[_0xd610('0x47')]['id'],'ToId':_0x468c0d[_0xd610('0x51')]['id'],'read':![]}})['then'](function(_0x3aeb6b){return{'id':_[_0xd610('0x52')](_0x468c0d['params']['id']),'count':_0x3aeb6b};})[_0xd610('0x42')](respondWithResult(_0x4d0690,null))[_0xd610('0x45')](handleError(_0x4d0690,null));};exports[_0xd610('0x53')]=function(_0x101572,_0x48e04d,_0x117f55){return db[_0xd610('0x2d')]['find']({'where':{'id':_0x101572[_0xd610('0x47')]['id']}})[_0xd610('0x42')](handleEntityNotFound(_0x48e04d,null))['then'](function(_0x374d1a){if(_0x374d1a){return _0x374d1a[_0xd610('0x53')](_0x101572[_0xd610('0x4c')][_0xd610('0x54')],_[_0xd610('0x55')](_0x101572[_0xd610('0x4c')],[_0xd610('0x54'),'id'])||{});}})['then'](respondWithResult(_0x48e04d,null))[_0xd610('0x45')](handleError(_0x48e04d,null));};exports['getMembers']=function(_0x5541d9,_0x2a7f0f,_0x214a80){var _0x37a04d={};var _0x4fccf2={};var _0x20d835;var _0xa6052f;return db[_0xd610('0x2d')][_0xd610('0x56')]({'where':{'id':_0x5541d9[_0xd610('0x47')]['id']}})[_0xd610('0x42')](handleEntityNotFound(_0x2a7f0f,null))[_0xd610('0x42')](function(_0x55b630){if(_0x55b630){_0x20d835=_0x55b630;_0x4fccf2[_0xd610('0x32')]=_[_0xd610('0x35')](db[_0xd610('0x57')][_0xd610('0x2e')]);_0x4fccf2[_0xd610('0x34')]=_[_0xd610('0x35')](_0x5541d9['query']);_0x4fccf2[_0xd610('0x3c')]=_[_0xd610('0x36')](_0x4fccf2[_0xd610('0x32')],_0x4fccf2[_0xd610('0x34')]);_0x37a04d[_0xd610('0x37')]=_[_0xd610('0x36')](_0x4fccf2[_0xd610('0x32')],qs[_0xd610('0x48')](_0x5541d9[_0xd610('0x34')][_0xd610('0x48')]));_0x37a04d[_0xd610('0x37')]=_0x37a04d[_0xd610('0x37')][_0xd610('0x38')]?_0x37a04d[_0xd610('0x37')]:_0x4fccf2[_0xd610('0x32')];_0x37a04d[_0xd610('0x39')]=qs[_0xd610('0x3a')](_0x5541d9['query']['sort']);_0x37a04d[_0xd610('0x3b')]=qs[_0xd610('0x3c')](_[_0xd610('0x3d')](_0x5541d9['query'],_0x4fccf2[_0xd610('0x3c')]));if(_0x5541d9['query'][_0xd610('0x40')]){_0x37a04d[_0xd610('0x3b')]=_[_0xd610('0x3e')](_0x37a04d['where'],{'$or':_['map'](_0x37a04d[_0xd610('0x37')],function(_0x4a35ee){var _0x5d116c={};_0x5d116c[_0x4a35ee]={'$like':'%'+_0x5541d9[_0xd610('0x34')][_0xd610('0x40')]+'%'};return _0x5d116c;})});}_0x37a04d=_[_0xd610('0x3e')]({},_0x37a04d,_0x5541d9[_0xd610('0x41')]);return _0x20d835[_0xd610('0x58')](_0x37a04d);}})['then'](function(_0x343341){if(_0x343341){_0xa6052f=_0x343341[_0xd610('0x38')];if(!_0x5541d9[_0xd610('0x34')][_0xd610('0x59')](_0xd610('0x5a'))){_0x37a04d[_0xd610('0x20')]=qs['limit'](_0x5541d9[_0xd610('0x34')]['limit']);_0x37a04d['offset']=qs[_0xd610('0x1e')](_0x5541d9[_0xd610('0x34')][_0xd610('0x1e')]);}return _0x20d835['getMembers'](_0x37a04d);}})['then'](function(_0x41d208){if(_0x41d208){return _0x41d208?{'count':_0xa6052f,'rows':_0x41d208}:null;}})[_0xd610('0x42')](respondWithResult(_0x2a7f0f,null))[_0xd610('0x45')](handleError(_0x2a7f0f,null));};exports[_0xd610('0x5b')]=function(_0x17896a,_0x3b8a43,_0x3ca233){return db['ChatGroup']['find']({'where':{'id':_0x17896a['params']['id']}})['then'](handleEntityNotFound(_0x3b8a43,null))[_0xd610('0x42')](function(_0x1f8223){if(_0x1f8223){return _0x1f8223[_0xd610('0x5b')](_0x17896a['query']['ids']);}})[_0xd610('0x42')](respondWithStatusCode(_0x3b8a43,null))[_0xd610('0x45')](handleError(_0x3b8a43,null));};exports[_0xd610('0x5c')]=function(_0x550363,_0x32f7ee,_0x504a53){if(_0x550363[_0xd610('0x4c')]['id']){delete _0x550363[_0xd610('0x4c')]['id'];}return db['ChatGroup'][_0xd610('0x4a')]({'where':{'id':_0x550363[_0xd610('0x47')]['id']}})[_0xd610('0x42')](handleEntityNotFound(_0x32f7ee,null))[_0xd610('0x42')](function(_0xd06c64){if(_0xd06c64){_0x550363[_0xd610('0x4c')][_0xd610('0x5d')]=_0xd06c64['id'];return db[_0xd610('0x50')][_0xd610('0x4b')](_0x550363[_0xd610('0x4c')]);}})['then'](respondWithResult(_0x32f7ee,null))[_0xd610('0x45')](handleError(_0x32f7ee,null));};exports[_0xd610('0x5e')]=function(_0x4b7b8a,_0x598f14,_0x34fe23){var _0x4e881d={};var _0x1372f4={};var _0x28379e;var _0x4d0fa7;return db['ChatGroup'][_0xd610('0x56')]({'where':{'id':_0x4b7b8a[_0xd610('0x47')]['id']}})[_0xd610('0x42')](handleEntityNotFound(_0x598f14,null))[_0xd610('0x42')](function(_0x1f4a36){if(_0x1f4a36){_0x28379e=_0x1f4a36;_0x1372f4[_0xd610('0x32')]=_[_0xd610('0x35')](db[_0xd610('0x50')][_0xd610('0x2e')]);_0x1372f4[_0xd610('0x34')]=_[_0xd610('0x35')](_0x4b7b8a[_0xd610('0x34')]);_0x1372f4[_0xd610('0x3c')]=_[_0xd610('0x36')](_0x1372f4['model'],_0x1372f4['query']);_0x4e881d[_0xd610('0x37')]=_[_0xd610('0x36')](_0x1372f4[_0xd610('0x32')],qs[_0xd610('0x48')](_0x4b7b8a['query'][_0xd610('0x48')]));_0x4e881d[_0xd610('0x37')]=_0x4e881d[_0xd610('0x37')][_0xd610('0x38')]?_0x4e881d[_0xd610('0x37')]:_0x1372f4[_0xd610('0x32')];_0x4e881d[_0xd610('0x39')]=qs['sort'](_0x4b7b8a[_0xd610('0x34')]['sort']);_0x4e881d[_0xd610('0x3b')]=qs['filters'](_[_0xd610('0x3d')](_0x4b7b8a[_0xd610('0x34')],_0x1372f4[_0xd610('0x3c')]));if(_0x4b7b8a[_0xd610('0x34')][_0xd610('0x40')]){_0x4e881d['where']=_[_0xd610('0x3e')](_0x4e881d[_0xd610('0x3b')],{'$or':_[_0xd610('0x33')](_0x4e881d[_0xd610('0x37')],function(_0x3646f3){var _0xda7fda={};_0xda7fda[_0x3646f3]={'$like':'%'+_0x4b7b8a[_0xd610('0x34')][_0xd610('0x40')]+'%'};return _0xda7fda;})});}if(_0x4b7b8a[_0xd610('0x34')][_0xd610('0x5f')]){var _0xbfec2e=_0x4b7b8a['query'][_0xd610('0x5f')][_0xd610('0x60')](',');var _0x1fe060={};_0x1fe060[_0xbfec2e[0x0]]={'$gte':moment(_0xbfec2e[0x1])['format'](_0xd610('0x61'))};_0x4e881d[_0xd610('0x3b')]=_[_0xd610('0x3e')](_0x4e881d['where'],_0x1fe060);}_0x4e881d=_['merge']({},_0x4e881d,_0x4b7b8a[_0xd610('0x41')]);return _0x28379e[_0xd610('0x5e')](_0x4e881d);}})['then'](function(_0x59f3d1){if(_0x59f3d1){_0x4d0fa7=_0x59f3d1[_0xd610('0x38')];if(!_0x4b7b8a['query'][_0xd610('0x59')]('nolimit')){_0x4e881d[_0xd610('0x20')]=qs[_0xd610('0x20')](_0x4b7b8a[_0xd610('0x34')][_0xd610('0x20')]);_0x4e881d[_0xd610('0x1e')]=qs[_0xd610('0x1e')](_0x4b7b8a['query']['offset']);}return _0x28379e[_0xd610('0x5e')](_0x4e881d);}})[_0xd610('0x42')](function(_0xee5375){if(_0xee5375){return _0xee5375?{'count':_0x4d0fa7,'rows':_0xee5375}:null;}})[_0xd610('0x42')](respondWithResult(_0x598f14,null))['catch'](handleError(_0x598f14,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 52ec80b..37bade5 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 _0xba37=['emit','exports','events','ChatGroup','save','remove'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xba37,0xb6));var _0x7ba3=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0xba37[_0x500419];return _0x241c1a;};'use strict';var EventEmitter=require(_0x7ba3('0x0'));var ChatGroup=require('../../mysqldb')['db'][_0x7ba3('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7ba3('0x2'),'afterUpdate':'update','afterDestroy':_0x7ba3('0x3')};function emitEvent(_0x413255){return function(_0x318802,_0x180ebc,_0x1ad964){ChatGroupEvents['emit'](_0x413255+':'+_0x318802['id'],_0x318802);ChatGroupEvents[_0x7ba3('0x4')](_0x413255,_0x318802);_0x1ad964(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module[_0x7ba3('0x5')]=ChatGroupEvents; \ No newline at end of file +var _0x161c=['exports','../../mysqldb','setMaxListeners','update','emit','hasOwnProperty','hook'];(function(_0x38c699,_0x56fea7){var _0x3b1ded=function(_0x100851){while(--_0x100851){_0x38c699['push'](_0x38c699['shift']());}};_0x3b1ded(++_0x56fea7);}(_0x161c,0xb7));var _0xc161=function(_0x3cb5bb,_0x272e35){_0x3cb5bb=_0x3cb5bb-0x0;var _0x2c765f=_0x161c[_0x3cb5bb];return _0x2c765f;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0xc161('0x0'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xc161('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc161('0x2'),'afterDestroy':'remove'};function emitEvent(_0x336a55){return function(_0x2d9ae2,_0x4653a3,_0xa9e9ef){ChatGroupEvents[_0xc161('0x3')](_0x336a55+':'+_0x2d9ae2['id'],_0x2d9ae2);ChatGroupEvents[_0xc161('0x3')](_0x336a55,_0x2d9ae2);_0xa9e9ef(null);};}for(var e in events){if(events[_0xc161('0x4')](e)){var event=events[e];ChatGroup[_0xc161('0x5')](e,emitEvent(event));}}module[_0xc161('0x6')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index f123d67..a9618c5 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 _0x3553=['util','api','bluebird','rimraf','../../config/environment','./chatGroup.attributes','exports','chat_groups','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3553,0x10d));var _0x3355=function(_0x50cd20,_0xe3ff25){_0x50cd20=_0x50cd20-0x0;var _0x3506e1=_0x3553[_0x50cd20];return _0x3506e1;};'use strict';var _=require(_0x3355('0x0'));var util=require(_0x3355('0x1'));var logger=require('../../config/logger')(_0x3355('0x2'));var moment=require('moment');var BPromise=require(_0x3355('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3355('0x4'));var config=require(_0x3355('0x5'));var attributes=require(_0x3355('0x6'));module[_0x3355('0x7')]=function(_0x3744df,_0x3a6c06){return _0x3744df['define']('ChatGroup',attributes,{'tableName':_0x3355('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc54d=['api','moment','bluebird','request-promise','path','rimraf','./chatGroup.attributes','exports','lodash','util','../../config/logger'];(function(_0x3c8e9a,_0x384306){var _0x2d4c57=function(_0x43d408){while(--_0x43d408){_0x3c8e9a['push'](_0x3c8e9a['shift']());}};_0x2d4c57(++_0x384306);}(_0xc54d,0x173));var _0xdc54=function(_0x4ef34e,_0x11ac32){_0x4ef34e=_0x4ef34e-0x0;var _0x3a6f82=_0xc54d[_0x4ef34e];return _0x3a6f82;};'use strict';var _=require(_0xdc54('0x0'));var util=require(_0xdc54('0x1'));var logger=require(_0xdc54('0x2'))(_0xdc54('0x3'));var moment=require(_0xdc54('0x4'));var BPromise=require(_0xdc54('0x5'));var rp=require(_0xdc54('0x6'));var fs=require('fs');var path=require(_0xdc54('0x7'));var rimraf=require(_0xdc54('0x8'));var config=require('../../config/environment');var attributes=require(_0xdc54('0x9'));module[_0xdc54('0xa')]=function(_0x222526,_0x280da7){return _0x222526['define']('ChatGroup',attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index 1fb5799..5f96770 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 _0xc4f5=['message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','register','request','info','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','code','error','ChatGroup,\x20%s,\x20%s'];(function(_0x2f4878,_0x5bf834){var _0x1c22ac=function(_0x288f20){while(--_0x288f20){_0x2f4878['push'](_0x2f4878['shift']());}};_0x1c22ac(++_0x5bf834);}(_0xc4f5,0xa5));var _0x5c4f=function(_0x1f1641,_0x42ad9d){_0x1f1641=_0x1f1641-0x0;var _0x9660b4=_0xc4f5[_0x1f1641];return _0x9660b4;};'use strict';var _=require('lodash');var util=require(_0x5c4f('0x0'));var moment=require(_0x5c4f('0x1'));var BPromise=require(_0x5c4f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5c4f('0x3'));var db=require(_0x5c4f('0x4'))['db'];var utils=require(_0x5c4f('0x5'));var logger=require(_0x5c4f('0x6'))(_0x5c4f('0x7'));var config=require('../../config/environment');var jayson=require(_0x5c4f('0x8'));var client=jayson[_0x5c4f('0x9')][_0x5c4f('0xa')]({'port':0x232a});config[_0x5c4f('0xb')]=_[_0x5c4f('0xc')](config['redis'],{'host':_0x5c4f('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5c4f('0xb')]));require('./chatGroup.socket')[_0x5c4f('0xe')](socket);function respondWithRpcPromise(_0x458348,_0x19623c,_0x56535a){return new BPromise(function(_0x249955,_0x2a9bf9){return client[_0x5c4f('0xf')](_0x458348,_0x56535a)['then'](function(_0x255e5d){logger[_0x5c4f('0x10')]('ChatGroup,\x20%s,\x20%s',_0x19623c,_0x5c4f('0x11'));logger[_0x5c4f('0x12')](_0x5c4f('0x13'),_0x19623c,_0x5c4f('0x11'),JSON[_0x5c4f('0x14')](_0x255e5d));if(_0x255e5d['error']){if(_0x255e5d['error'][_0x5c4f('0x15')]===0x1f4){logger[_0x5c4f('0x16')](_0x5c4f('0x17'),_0x19623c,_0x255e5d[_0x5c4f('0x16')][_0x5c4f('0x18')]);return _0x2a9bf9(_0x255e5d['error']['message']);}logger[_0x5c4f('0x16')]('ChatGroup,\x20%s,\x20%s',_0x19623c,_0x255e5d['error'][_0x5c4f('0x18')]);return _0x249955(_0x255e5d['error'][_0x5c4f('0x18')]);}else{logger[_0x5c4f('0x10')](_0x5c4f('0x17'),_0x19623c,_0x5c4f('0x11'));_0x249955(_0x255e5d[_0x5c4f('0x19')][_0x5c4f('0x18')]);}})[_0x5c4f('0x1a')](function(_0x3ec0ff){logger[_0x5c4f('0x16')]('ChatGroup,\x20%s,\x20%s',_0x19623c,_0x3ec0ff);_0x2a9bf9(_0x3ec0ff);});});} \ No newline at end of file +var _0xaeaf=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./chatGroup.socket','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util'];(function(_0x3c0224,_0x243e3e){var _0x315ce8=function(_0x2c0659){while(--_0x2c0659){_0x3c0224['push'](_0x3c0224['shift']());}};_0x315ce8(++_0x243e3e);}(_0xaeaf,0x14e));var _0xfaea=function(_0x2ef644,_0x2ab0ff){_0x2ef644=_0x2ef644-0x0;var _0x11f00e=_0xaeaf[_0x2ef644];return _0x11f00e;};'use strict';var _=require(_0xfaea('0x0'));var util=require(_0xfaea('0x1'));var moment=require(_0xfaea('0x2'));var BPromise=require(_0xfaea('0x3'));var rs=require(_0xfaea('0x4'));var fs=require('fs');var Redis=require(_0xfaea('0x5'));var db=require(_0xfaea('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xfaea('0x7'))(_0xfaea('0x8'));var config=require(_0xfaea('0x9'));var jayson=require(_0xfaea('0xa'));var client=jayson['client'][_0xfaea('0xb')]({'port':0x232a});config[_0xfaea('0xc')]=_[_0xfaea('0xd')](config[_0xfaea('0xc')],{'host':_0xfaea('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfaea('0xc')]));require(_0xfaea('0xf'))['register'](socket);function respondWithRpcPromise(_0x191039,_0x3c1f4d,_0x2462f5){return new BPromise(function(_0x5078b6,_0x116379){return client[_0xfaea('0x10')](_0x191039,_0x2462f5)[_0xfaea('0x11')](function(_0x5c4746){logger[_0xfaea('0x12')](_0xfaea('0x13'),_0x3c1f4d,_0xfaea('0x14'));logger[_0xfaea('0x15')](_0xfaea('0x16'),_0x3c1f4d,'request\x20sent',JSON[_0xfaea('0x17')](_0x5c4746));if(_0x5c4746['error']){if(_0x5c4746[_0xfaea('0x18')]['code']===0x1f4){logger[_0xfaea('0x18')](_0xfaea('0x13'),_0x3c1f4d,_0x5c4746['error'][_0xfaea('0x19')]);return _0x116379(_0x5c4746[_0xfaea('0x18')][_0xfaea('0x19')]);}logger[_0xfaea('0x18')](_0xfaea('0x13'),_0x3c1f4d,_0x5c4746['error']['message']);return _0x5078b6(_0x5c4746[_0xfaea('0x18')][_0xfaea('0x19')]);}else{logger[_0xfaea('0x12')](_0xfaea('0x13'),_0x3c1f4d,_0xfaea('0x14'));_0x5078b6(_0x5c4746[_0xfaea('0x1a')][_0xfaea('0x19')]);}})[_0xfaea('0x1b')](function(_0x328924){logger[_0xfaea('0x18')]('ChatGroup,\x20%s,\x20%s',_0x3c1f4d,_0x328924);_0x116379(_0x328924);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index e727238..28114e9 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 _0x0cad=['length','chatGroup:','./chatGroup.events','save','remove','update','emit','register'];(function(_0x38a247,_0x2d72bf){var _0x17a3b0=function(_0x5d201a){while(--_0x5d201a){_0x38a247['push'](_0x38a247['shift']());}};_0x17a3b0(++_0x2d72bf);}(_0x0cad,0x82));var _0xd0ca=function(_0x16972f,_0x24951d){_0x16972f=_0x16972f-0x0;var _0x3e2509=_0x0cad[_0x16972f];return _0x3e2509;};'use strict';var ChatGroupEvents=require(_0xd0ca('0x0'));var events=[_0xd0ca('0x1'),_0xd0ca('0x2'),_0xd0ca('0x3')];function createListener(_0x1681dc,_0x261c60){return function(_0x5bff60){_0x261c60[_0xd0ca('0x4')](_0x1681dc,_0x5bff60);};}function removeListener(_0x5c77fe,_0xeedf84){return function(){ChatGroupEvents['removeListener'](_0x5c77fe,_0xeedf84);};}exports[_0xd0ca('0x5')]=function(_0x324e74){for(var _0x3946bf=0x0,_0x155e3c=events[_0xd0ca('0x6')];_0x3946bf<_0x155e3c;_0x3946bf++){var _0x4ae3d6=events[_0x3946bf];var _0x40f76d=createListener(_0xd0ca('0x7')+_0x4ae3d6,_0x324e74);ChatGroupEvents['on'](_0x4ae3d6,_0x40f76d);}}; \ No newline at end of file +var _0x2e56=['save','remove','emit','length','chatGroup:','./chatGroup.events'];(function(_0x4fccf1,_0x1c7cb3){var _0x1de5d9=function(_0x2b2e58){while(--_0x2b2e58){_0x4fccf1['push'](_0x4fccf1['shift']());}};_0x1de5d9(++_0x1c7cb3);}(_0x2e56,0x149));var _0x62e5=function(_0xae282f,_0x2d9368){_0xae282f=_0xae282f-0x0;var _0x5f46d4=_0x2e56[_0xae282f];return _0x5f46d4;};'use strict';var ChatGroupEvents=require(_0x62e5('0x0'));var events=[_0x62e5('0x1'),_0x62e5('0x2'),'update'];function createListener(_0x4c6c43,_0x149ca2){return function(_0x423601){_0x149ca2[_0x62e5('0x3')](_0x4c6c43,_0x423601);};}function removeListener(_0x1898d2,_0x278ac3){return function(){ChatGroupEvents['removeListener'](_0x1898d2,_0x278ac3);};}exports['register']=function(_0x5a649f){for(var _0xae5289=0x0,_0x25b884=events[_0x62e5('0x4')];_0xae5289<_0x25b884;_0xae5289++){var _0x31d06a=events[_0xae5289];var _0x14cd26=createListener(_0x62e5('0x5')+_0x31d06a,_0x5a649f);ChatGroupEvents['on'](_0x31d06a,_0x14cd26);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 8e2c961..8ed2584 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 _0xd022=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','create','post','addMembers','update','delete','destroy','removeMembers'];(function(_0xe13ec5,_0x45efea){var _0x219c41=function(_0x4f8f96){while(--_0x4f8f96){_0xe13ec5['push'](_0xe13ec5['shift']());}};_0x219c41(++_0x45efea);}(_0xd022,0x106));var _0x2d02=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0xd022[_0x36c5b0];return _0xf19333;};'use strict';var multer=require(_0x2d02('0x0'));var util=require(_0x2d02('0x1'));var path=require(_0x2d02('0x2'));var timeout=require(_0x2d02('0x3'));var express=require(_0x2d02('0x4'));var router=express['Router']();var fs_extra=require(_0x2d02('0x5'));var auth=require(_0x2d02('0x6'));var interaction=require(_0x2d02('0x7'));var config=require(_0x2d02('0x8'));var controller=require(_0x2d02('0x9'));router[_0x2d02('0xa')]('/',auth[_0x2d02('0xb')](),controller[_0x2d02('0xc')]);router['get'](_0x2d02('0xd'),auth['isAuthenticated'](),controller['describe']);router[_0x2d02('0xa')](_0x2d02('0xe'),auth[_0x2d02('0xb')](),controller[_0x2d02('0xf')]);router[_0x2d02('0xa')](_0x2d02('0x10'),auth[_0x2d02('0xb')](),controller[_0x2d02('0x11')]);router[_0x2d02('0xa')](_0x2d02('0x12'),auth['isAuthenticated'](),controller[_0x2d02('0x13')]);router[_0x2d02('0xa')](_0x2d02('0x14'),auth[_0x2d02('0xb')](),controller['getMessages']);router['post']('/',auth['isAuthenticated'](),controller[_0x2d02('0x15')]);router[_0x2d02('0x16')](_0x2d02('0x12'),auth[_0x2d02('0xb')](),controller[_0x2d02('0x17')]);router[_0x2d02('0x16')](_0x2d02('0x14'),auth['isAuthenticated'](),controller['addMessage']);router['put'](_0x2d02('0xe'),auth[_0x2d02('0xb')](),controller[_0x2d02('0x18')]);router[_0x2d02('0x19')](_0x2d02('0xe'),auth[_0x2d02('0xb')](),controller[_0x2d02('0x1a')]);router['delete'](_0x2d02('0x12'),auth[_0x2d02('0xb')](),controller[_0x2d02('0x1b')]);module[_0x2d02('0x1c')]=router; \ No newline at end of file +var _0xb0f5=['post','create','addMembers','put','delete','removeMembers','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatGroup.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages'];(function(_0x28a8ca,_0x3d211a){var _0x1d5dfc=function(_0x376388){while(--_0x376388){_0x28a8ca['push'](_0x28a8ca['shift']());}};_0x1d5dfc(++_0x3d211a);}(_0xb0f5,0x18d));var _0x5b0f=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0xb0f5[_0x1928c9];return _0x51b5fb;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5b0f('0x0'));var timeout=require(_0x5b0f('0x1'));var express=require(_0x5b0f('0x2'));var router=express[_0x5b0f('0x3')]();var fs_extra=require(_0x5b0f('0x4'));var auth=require(_0x5b0f('0x5'));var interaction=require(_0x5b0f('0x6'));var config=require('../../config/environment');var controller=require(_0x5b0f('0x7'));router[_0x5b0f('0x8')]('/',auth[_0x5b0f('0x9')](),controller['index']);router['get'](_0x5b0f('0xa'),auth[_0x5b0f('0x9')](),controller[_0x5b0f('0xb')]);router[_0x5b0f('0x8')](_0x5b0f('0xc'),auth[_0x5b0f('0x9')](),controller[_0x5b0f('0xd')]);router[_0x5b0f('0x8')](_0x5b0f('0xe'),auth[_0x5b0f('0x9')](),controller[_0x5b0f('0xf')]);router['get'](_0x5b0f('0x10'),auth[_0x5b0f('0x9')](),controller[_0x5b0f('0x11')]);router[_0x5b0f('0x8')](_0x5b0f('0x12'),auth[_0x5b0f('0x9')](),controller['getMessages']);router[_0x5b0f('0x13')]('/',auth[_0x5b0f('0x9')](),controller[_0x5b0f('0x14')]);router[_0x5b0f('0x13')]('/:id/members',auth[_0x5b0f('0x9')](),controller[_0x5b0f('0x15')]);router[_0x5b0f('0x13')]('/:id/messages',auth['isAuthenticated'](),controller['addMessage']);router[_0x5b0f('0x16')](_0x5b0f('0xc'),auth[_0x5b0f('0x9')](),controller['update']);router[_0x5b0f('0x17')](_0x5b0f('0xc'),auth['isAuthenticated'](),controller['destroy']);router[_0x5b0f('0x17')](_0x5b0f('0x10'),auth[_0x5b0f('0x9')](),controller[_0x5b0f('0x18')]);module[_0x5b0f('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index a93ca31..66c1917 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 _0x928c=['TEXT','DATE','STRING','long','out','BOOLEAN','INTEGER','star','thumb'];(function(_0x24f69b,_0x432b8f){var _0x272ad6=function(_0x1b529a){while(--_0x1b529a){_0x24f69b['push'](_0x24f69b['shift']());}};_0x272ad6(++_0x432b8f);}(_0x928c,0x17f));var _0xc928=function(_0x25cd1b,_0x4cf5b4){_0x25cd1b=_0x25cd1b-0x0;var _0x4ef60d=_0x928c[_0x25cd1b];return _0x4ef60d;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize[_0xc928('0x0')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xc928('0x1')]},'ratingType':{'type':Sequelize['ENUM'](_0xc928('0x2'),_0xc928('0x3')),'defaultValue':_0xc928('0x2')},'ratingMessage':{'type':Sequelize[_0xc928('0x4')]},'pathTranscript':{'type':Sequelize[_0xc928('0x4')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xc928('0x5')]},'disposition':{'type':Sequelize[_0xc928('0x6')]},'secondDisposition':{'type':Sequelize[_0xc928('0x6')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize[_0xc928('0x6')]},'osName':{'type':Sequelize[_0xc928('0x6')]},'osVersion':{'type':Sequelize[_0xc928('0x6')]},'deviceModel':{'type':Sequelize[_0xc928('0x6')]},'deviceVendor':{'type':Sequelize[_0xc928('0x6')]},'deviceType':{'type':Sequelize[_0xc928('0x6')]},'referer':{'type':Sequelize[_0xc928('0x4')]},'customerIp':{'type':Sequelize[_0xc928('0x6')]},'formData':{'type':Sequelize['TEXT'](_0xc928('0x7'))},'read1stAt':{'type':Sequelize[_0xc928('0x5')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xc928('0x8')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize[_0xc928('0x6')]},'vidaooSessionId':{'type':Sequelize['TEXT']},'autoreplyExecuted':{'type':Sequelize[_0xc928('0x0')],'defaultValue':![]}}; \ No newline at end of file +var _0x9ffd=['TEXT','STRING','long','DATE','out','sequelize','exports','BOOLEAN','ENUM','star','thumb'];(function(_0x5ee635,_0x117d58){var _0x51d9be=function(_0x34f0e2){while(--_0x34f0e2){_0x5ee635['push'](_0x5ee635['shift']());}};_0x51d9be(++_0x117d58);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x47e7f3,_0x9bad04){_0x47e7f3=_0x47e7f3-0x0;var _0x128801=_0x9ffd[_0x47e7f3];return _0x128801;};'use strict';var Sequelize=require(_0xd9ff('0x0'));module[_0xd9ff('0x1')]={'closed':{'type':Sequelize[_0xd9ff('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0xd9ff('0x3')](_0xd9ff('0x4'),_0xd9ff('0x5')),'defaultValue':_0xd9ff('0x4')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0xd9ff('0x6')]},'mailTranscript':{'type':Sequelize[_0xd9ff('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xd9ff('0x7')]},'secondDisposition':{'type':Sequelize[_0xd9ff('0x7')]},'thirdDisposition':{'type':Sequelize[_0xd9ff('0x7')]},'note':{'type':Sequelize[_0xd9ff('0x7')]},'browserName':{'type':Sequelize[_0xd9ff('0x7')]},'browserVersion':{'type':Sequelize[_0xd9ff('0x7')]},'osName':{'type':Sequelize[_0xd9ff('0x7')]},'osVersion':{'type':Sequelize[_0xd9ff('0x7')]},'deviceModel':{'type':Sequelize[_0xd9ff('0x7')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0xd9ff('0x6')](_0xd9ff('0x8'))},'read1stAt':{'type':Sequelize[_0xd9ff('0x9')]},'lastMsgAt':{'type':Sequelize[_0xd9ff('0x9')]},'lastMsgDirection':{'type':Sequelize[_0xd9ff('0x3')]('in',_0xd9ff('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xd9ff('0x7')]},'customerPort':{'type':Sequelize[_0xd9ff('0x7')]},'vidaooSessionId':{'type':Sequelize['TEXT']},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 5889132..a0f7aa0 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 _0xff23=['format','Visitor','website_alias','alias','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','secret','MailAccount','MailServerOut','Smtp','CloudProvider','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','keys','filters','nolimit','order','sort','pick','where','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','options','rows','getMyMessages','hasOwnProperty','ChatInteractionId','Tag','color','emit','chatInteractionTags:save','removeTags','download','unix','toString','server','files','transcript-%d-%s.zip','push','CmContact','firstName','attachments','createdAt','direction','read','Account','Owner','get','mkdirSync','Chat','N.A.','closedAt','browserName','osName','customerPort','createWriteStream','out','lastName','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','err','unlinkSync','rimraf','zip-dir','request-promise','moment','bluebird','util','path','ejs','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','api','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','client','http','request','then','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','update','destroy','stack','name','send','render','merge','contact','agent','interaction','account','index','map','ChatInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','chat','query','user','show','model','attributes','intersection','fields','length','includeAll','include','find','create','body','describe','createVidaooSession','findOne','ChatWebsiteId','vidaooApiKey','vidaooTopic','vidaooNote','vidaooMetadata','vidaooEscalation','fullname','POST','https://api-vidaoo.xcally.com/api/v1/meetings','email','isNull','follow','parse','metadata','Sequelize','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','params','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','UserId','Interaction\x20already\x20assigned','disposition','attachmentUpload','mimetype','Attachment','attachmentDownload','closed','Unauthorized','ChatOfflineMessageId','join','server/files/attachments/','basename','close','mailTranscript','root','server/files/chat/upload/','transcript-%s.txt','now','pathTranscript','ChatMessage','Messages','User','ChatWebsite','ContactId','%s%d','agentAlias','System','customer'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xff23,0x1ee));var _0x3ff2=function(_0x205406,_0x11b6e0){_0x205406=_0x205406-0x0;var _0x238b92=_0xff23[_0x205406];return _0x238b92;};'use strict';var rimraf=require(_0x3ff2('0x0'));var zipdir=require(_0x3ff2('0x1'));var rp=require(_0x3ff2('0x2'));var moment=require(_0x3ff2('0x3'));var BPromise=require(_0x3ff2('0x4'));var Mustache=require('mustache');var util=require(_0x3ff2('0x5'));var path=require(_0x3ff2('0x6'));var ejs=require(_0x3ff2('0x7'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x3ff2('0x8'));var interaction=require(_0x3ff2('0x9'));var qs=require(_0x3ff2('0xa'));var pdf=require(_0x3ff2('0xb'));var logger=require('../../config/logger')(_0x3ff2('0xc'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x3ff2('0xd')]=_['defaults'](config[_0x3ff2('0xd')],{'host':_0x3ff2('0xe'),'port':0x18eb});var socket=require(_0x3ff2('0xf'))(new Redis(config['redis']));require(_0x3ff2('0x10'))[_0x3ff2('0x11')](socket);var jayson=require('jayson/promise');var client=jayson[_0x3ff2('0x12')]['http']({'port':0x232b});var client9004=jayson['client'][_0x3ff2('0x13')]({'port':0x232c});function respondWithRpcPromise(_0x217576,_0x5c152c,_0x1892d5,_0x1161d6){return new BPromise(function(_0x174327,_0x23dbab){var _0x36f51e=_0x1161d6||client;return _0x36f51e[_0x3ff2('0x14')](_0x217576,_0x1892d5)[_0x3ff2('0x15')](function(_0x201886){logger['info'](_0x3ff2('0x16'),_0x5c152c,_0x3ff2('0x17'));logger[_0x3ff2('0x18')](_0x3ff2('0x19'),_0x5c152c,_0x3ff2('0x17'),JSON[_0x3ff2('0x1a')](_0x201886));if(_0x201886[_0x3ff2('0x1b')]){if(_0x201886[_0x3ff2('0x1b')]['code']===0x1f4){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x5c152c,_0x201886['error'][_0x3ff2('0x1c')]);return _0x23dbab(_0x201886['error'][_0x3ff2('0x1c')]);}logger[_0x3ff2('0x1b')](_0x3ff2('0x16'),_0x5c152c,_0x201886[_0x3ff2('0x1b')][_0x3ff2('0x1c')]);return _0x174327(_0x201886[_0x3ff2('0x1b')][_0x3ff2('0x1c')]);}else{logger[_0x3ff2('0x1d')](_0x3ff2('0x16'),_0x5c152c,_0x3ff2('0x17'));_0x174327(_0x201886[_0x3ff2('0x1e')][_0x3ff2('0x1c')]);}})[_0x3ff2('0x1f')](function(_0x45ef57){logger[_0x3ff2('0x1b')]('ChatInteraction,\x20%s,\x20%s',_0x5c152c,_0x45ef57);_0x23dbab(_0x45ef57);});});}function respondWithStatusCode(_0x5742f5,_0x972a74){_0x972a74=_0x972a74||0xcc;return function(_0x10d9c9){if(_0x10d9c9){return _0x5742f5[_0x3ff2('0x20')](_0x972a74);}return _0x5742f5[_0x3ff2('0x21')](_0x972a74)[_0x3ff2('0x22')]();};}function respondWithResult(_0x4a2cdc,_0xf8f32){_0xf8f32=_0xf8f32||0xc8;return function(_0x30610b){if(_0x30610b){return _0x4a2cdc['status'](_0xf8f32)[_0x3ff2('0x23')](_0x30610b);}};}function respondWithFilteredResult(_0x538cb7,_0x2b1203){return function(_0x4de4ce){if(_0x4de4ce){var _0x175340=typeof _0x2b1203[_0x3ff2('0x24')]===_0x3ff2('0x25')&&typeof _0x2b1203[_0x3ff2('0x26')]==='undefined';var _0x47cd32=_0x4de4ce[_0x3ff2('0x27')];var _0x78b989=_0x175340?0x0:_0x2b1203[_0x3ff2('0x24')];var _0x9f2201=_0x175340?_0x4de4ce[_0x3ff2('0x27')]:_0x2b1203[_0x3ff2('0x24')]+_0x2b1203['limit'];var _0x3ffd4c;if(_0x9f2201>=_0x47cd32){_0x9f2201=_0x47cd32;_0x3ffd4c=0xc8;}else{_0x3ffd4c=0xce;}_0x538cb7[_0x3ff2('0x21')](_0x3ffd4c);return _0x538cb7[_0x3ff2('0x28')]('Content-Range',_0x78b989+'-'+_0x9f2201+'/'+_0x47cd32)[_0x3ff2('0x23')](_0x4de4ce);}return null;};}function saveUpdates(_0x55fad0){return function(_0x267047){if(_0x267047){return _0x267047[_0x3ff2('0x29')](_0x55fad0)[_0x3ff2('0x15')](function(_0x160bfe){return _0x160bfe;});}return null;};}function removeEntity(_0x583c49){return function(_0x41fd95){if(_0x41fd95){return _0x41fd95[_0x3ff2('0x2a')]()['then'](function(){_0x583c49[_0x3ff2('0x21')](0xcc)[_0x3ff2('0x22')]();});}};}function handleEntityNotFound(_0x3f1fe3){return function(_0x32f543){if(!_0x32f543){_0x3f1fe3['sendStatus'](0x194);}return _0x32f543;};}function handleError(_0x32be6b,_0x4dfef0){_0x4dfef0=_0x4dfef0||0x1f4;return function(_0x10b3fb){logger[_0x3ff2('0x1b')](_0x10b3fb[_0x3ff2('0x2b')]);if(_0x10b3fb['name']){delete _0x10b3fb[_0x3ff2('0x2c')];}_0x32be6b[_0x3ff2('0x21')](_0x4dfef0)[_0x3ff2('0x2d')](_0x10b3fb);};}function getMustacheRender(_0x57e2e4,_0x5a5f70){return Mustache[_0x3ff2('0x2e')](_0x57e2e4,_[_0x3ff2('0x2f')](_0x5a5f70['body'],{'contact':_0x5a5f70[_0x3ff2('0x30')],'message':_0x5a5f70[_0x3ff2('0x1c')],'agent':_0x5a5f70[_0x3ff2('0x31')],'interaction':_0x5a5f70[_0x3ff2('0x32')],'account':_0x5a5f70[_0x3ff2('0x33')]}))||'';}exports[_0x3ff2('0x34')]=function(_0x56e5a3,_0x55e000){var _0xa989d9={};var _0x4200ac=_[_0x3ff2('0x35')](db[_0x3ff2('0x36')][_0x3ff2('0x37')],function(_0x15e08c){return{'name':_0x15e08c[_0x3ff2('0x38')],'type':_0x15e08c[_0x3ff2('0x39')][_0x3ff2('0x3a')]};});_0xa989d9=qs[_0x3ff2('0x3b')](_0x4200ac,_0x56e5a3);return interaction[_0x3ff2('0x3c')](_0x3ff2('0x3d'),_0x56e5a3[_0x3ff2('0x3e')],_0x56e5a3[_0x3ff2('0x3f')],_0xa989d9,_0x4200ac)[_0x3ff2('0x15')](respondWithFilteredResult(_0x55e000,_0xa989d9))[_0x3ff2('0x1f')](handleError(_0x55e000,null));};exports[_0x3ff2('0x40')]=function(_0x1d6648,_0x4e5e00){var _0x2f5e9d={'raw':![],'where':{'id':_0x1d6648['params']['id']}},_0x49830f={};_0x49830f[_0x3ff2('0x41')]=_['keys'](db[_0x3ff2('0x36')]['rawAttributes']);_0x49830f[_0x3ff2('0x3e')]=_['keys'](_0x1d6648['query']);_0x49830f['filters']=_['intersection'](_0x49830f['model'],_0x49830f[_0x3ff2('0x3e')]);_0x2f5e9d[_0x3ff2('0x42')]=_[_0x3ff2('0x43')](_0x49830f[_0x3ff2('0x41')],qs['fields'](_0x1d6648[_0x3ff2('0x3e')][_0x3ff2('0x44')]));_0x2f5e9d[_0x3ff2('0x42')]=_0x2f5e9d[_0x3ff2('0x42')][_0x3ff2('0x45')]?_0x2f5e9d[_0x3ff2('0x42')]:_0x49830f['model'];if(_0x1d6648[_0x3ff2('0x3e')][_0x3ff2('0x46')]){_0x2f5e9d[_0x3ff2('0x47')]=[{'all':!![]}];}_0x2f5e9d=_[_0x3ff2('0x2f')]({},_0x2f5e9d,_0x1d6648['options']);return db['ChatInteraction'][_0x3ff2('0x48')](_0x2f5e9d)['then'](handleEntityNotFound(_0x4e5e00,null))[_0x3ff2('0x15')](respondWithResult(_0x4e5e00,null))[_0x3ff2('0x1f')](handleError(_0x4e5e00,null));};exports[_0x3ff2('0x49')]=function(_0x2ee67a,_0x39b7c2){return db[_0x3ff2('0x36')]['create'](_0x2ee67a[_0x3ff2('0x4a')],{})[_0x3ff2('0x15')](respondWithResult(_0x39b7c2,0xc9))[_0x3ff2('0x1f')](handleError(_0x39b7c2,null));};exports[_0x3ff2('0x29')]=function(_0xfa6a24,_0x183132){if(_0xfa6a24[_0x3ff2('0x4a')]['id']){delete _0xfa6a24['body']['id'];}return db['ChatInteraction'][_0x3ff2('0x48')]({'where':{'id':_0xfa6a24['params']['id']}})[_0x3ff2('0x15')](handleEntityNotFound(_0x183132,null))[_0x3ff2('0x15')](saveUpdates(_0xfa6a24['body'],null))[_0x3ff2('0x15')](respondWithResult(_0x183132,null))[_0x3ff2('0x1f')](handleError(_0x183132,null));};exports['destroy']=function(_0x3dca91,_0x36bb3e){return db[_0x3ff2('0x36')][_0x3ff2('0x48')]({'where':{'id':_0x3dca91['params']['id']}})[_0x3ff2('0x15')](handleEntityNotFound(_0x36bb3e,null))['then'](removeEntity(_0x36bb3e,null))[_0x3ff2('0x1f')](handleError(_0x36bb3e,null));};exports[_0x3ff2('0x4b')]=function(_0x3e2dda,_0x16e331){return db[_0x3ff2('0x36')][_0x3ff2('0x4b')]()['then'](respondWithResult(_0x16e331,null))[_0x3ff2('0x1f')](handleError(_0x16e331,null));};exports[_0x3ff2('0x4c')]=function(_0x2cac90,_0x6c8752){var _0x4859a6=_0x2cac90['params']['id'];var _0x35e34e;var _0xbfab08;var _0x381e74;return db['ChatInteraction'][_0x3ff2('0x4d')]({'where':{'id':_0x4859a6}})[_0x3ff2('0x15')](function(_0xab9d4b){_0x35e34e=_0xab9d4b;return db['ChatWebsite'][_0x3ff2('0x4d')]({'where':{'id':_0xab9d4b[_0x3ff2('0x4e')]},'attributes':['id',_0x3ff2('0x4f'),'vidaooEscalation',_0x3ff2('0x50'),_0x3ff2('0x51'),_0x3ff2('0x52')],'raw':!![]});})['then'](function(_0x2a29a3){if(_0x2a29a3&&_0x2a29a3['vidaooApiKey']&&_0x2a29a3[_0x3ff2('0x53')]){_0xbfab08=_0x2a29a3;var _0x430ed1={'interaction':{'id':_0x4859a6},'agent':{'id':_0x2cac90['user']['id'],'name':_0x2cac90[_0x3ff2('0x3f')][_0x3ff2('0x2c')],'fullname':_0x2cac90[_0x3ff2('0x3f')][_0x3ff2('0x54')],'email':_0x2cac90[_0x3ff2('0x3f')]['email']},'contact':_0x2cac90['body']['contact'],'account':_0x2cac90[_0x3ff2('0x4a')]['account']};var _0x4b1222={'rejectUnauthorized':![],'method':_0x3ff2('0x55'),'url':_0x3ff2('0x56'),'headers':{'X-APIKEY':_0x2a29a3[_0x3ff2('0x4f')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x2cac90[_0x3ff2('0x3f')][_0x3ff2('0x57')]],'buttons':null,'topic':_0xbfab08[_0x3ff2('0x50')],'note':_[_0x3ff2('0x58')](_0xbfab08[_0x3ff2('0x51')])?null:getMustacheRender(_0xbfab08[_0x3ff2('0x51')],_0x430ed1),'metadata':null},'redirect':_0x3ff2('0x59'),'json':!![]};try{if(!_[_0x3ff2('0x58')](_0xbfab08['vidaooMetadata'])){var _0x33323c=getMustacheRender(_0xbfab08[_0x3ff2('0x52')],_0x430ed1);var _0x3c9520=JSON[_0x3ff2('0x5a')](_0x33323c);_0x4b1222[_0x3ff2('0x4a')][_0x3ff2('0x5b')]=_0x3c9520;}}catch(_0x4a834a){throw new db[(_0x3ff2('0x5c'))][(_0x3ff2('0x5d'))]('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0x4b1222);}else{throw new db[(_0x3ff2('0x5c'))]['ValidationError'](_0x3ff2('0x5e'));}})[_0x3ff2('0x15')](function(_0x6cbac){_0x381e74=_0x6cbac;if(_0x381e74['id']){var _0x1ce0a9={'body':_0x381e74[_0x3ff2('0x5f')],'ChatWebsiteId':_0xbfab08['id'],'ChatInteractionId':_0x35e34e['id'],'direction':'out','UserId':_0x2cac90[_0x3ff2('0x3f')]['id']};return db['ChatMessage'][_0x3ff2('0x49')](_0x1ce0a9,{});}else{throw new db[(_0x3ff2('0x5c'))]['ValidationError'](_0x3ff2('0x60'));}})[_0x3ff2('0x15')](function(){return _0x35e34e[_0x3ff2('0x61')]({'vidaooSessionId':_0x381e74['id']});})[_0x3ff2('0x15')](respondWithResult(_0x6c8752,null))[_0x3ff2('0x1f')](handleError(_0x6c8752,null));};exports[_0x3ff2('0x62')]=function(_0x13f5d8,_0x5c4cb5){if(_0x13f5d8['body']['id']){delete _0x13f5d8[_0x3ff2('0x4a')]['id'];}return db[_0x3ff2('0x36')][_0x3ff2('0x48')]({'where':{'id':_0x13f5d8[_0x3ff2('0x63')]['id']},'include':[{'model':db['CmContact'],'as':_0x3ff2('0x64')}]})[_0x3ff2('0x15')](handleEntityNotFound(_0x5c4cb5,null))[_0x3ff2('0x15')](saveUpdates(_0x13f5d8[_0x3ff2('0x4a')],null))[_0x3ff2('0x15')](respondWithResult(_0x5c4cb5,null))[_0x3ff2('0x1f')](handleError(_0x5c4cb5,null));};exports[_0x3ff2('0x65')]=function(_0x14932d,_0x1d625c){if(_0x14932d[_0x3ff2('0x4a')]['id']){delete _0x14932d[_0x3ff2('0x4a')]['id'];}return db[_0x3ff2('0x36')]['find']({'where':{'id':_0x14932d['params']['id']}})[_0x3ff2('0x15')](function(_0x470166){if(!_0x470166){logger[_0x3ff2('0x1b')](_0x3ff2('0x66'),_0x3ff2('0x65'),0x194,_0x3ff2('0x67'));_0x1d625c['sendStatus'](0x194);}else{if(_0x470166[_0x3ff2('0x68')]){throw new db[(_0x3ff2('0x5c'))]['ValidationError'](_0x3ff2('0x69'));}}return _0x470166;})[_0x3ff2('0x15')](function(_0x418456){if(_0x418456){return _0x418456[_0x3ff2('0x29')]({'closed':_0x14932d[_0x3ff2('0x4a')]['closed'],'disposition':_0x14932d[_0x3ff2('0x4a')][_0x3ff2('0x6a')]})[_0x3ff2('0x15')](function(_0x35f6c2){return _0x35f6c2;});}})[_0x3ff2('0x15')](function(){return respondWithRpcPromise('AbandonInteraction',_0x3ff2('0x65'),_0x14932d[_0x3ff2('0x4a')],client9004);})[_0x3ff2('0x15')](respondWithResult(_0x1d625c,null))[_0x3ff2('0x1f')](handleError(_0x1d625c,null));};exports[_0x3ff2('0x6b')]=function(_0x1fdf93,_0x4b14ca){_0x1fdf93[_0x3ff2('0x4a')][_0x3ff2('0x2c')]=_0x1fdf93['file']['originalname'];_0x1fdf93[_0x3ff2('0x4a')]['basename']=_0x1fdf93['file']['filename'];_0x1fdf93['body']['type']=_0x1fdf93['file'][_0x3ff2('0x6c')];return db[_0x3ff2('0x6d')][_0x3ff2('0x49')](_0x1fdf93[_0x3ff2('0x4a')])[_0x3ff2('0x15')](respondWithResult(_0x4b14ca,0xc9))['catch'](handleError(_0x4b14ca,null));};exports[_0x3ff2('0x6e')]=function(_0x211768,_0x219a42){return db[_0x3ff2('0x36')][_0x3ff2('0x4d')]({'where':{'id':_0x211768[_0x3ff2('0x63')]['id']},'raw':!![]})[_0x3ff2('0x15')](handleEntityNotFound(_0x219a42,null))['then'](function(_0x4e45a6){if(_0x4e45a6){if(_0x4e45a6[_0x3ff2('0x6f')]){return _0x219a42['status'](0x193)['json']({'status':0x193,'message':_0x3ff2('0x70')});}return db['Attachment']['findOne']({'where':{'id':_0x211768['query']['attachId']},'raw':!![]})['then'](handleEntityNotFound(_0x219a42,null));}})[_0x3ff2('0x15')](function(_0x103b02){if(_0x103b02){var _0x465b96=_0x103b02[_0x3ff2('0x71')]!==null;var _0x3243d7=path[_0x3ff2('0x72')](config['root'],_0x3ff2('0x73'));if(_0x465b96){_0x3243d7=path['join'](_0x3243d7,'offline-chat/');}var _0x2dddbd=path['join'](_0x3243d7,_0x103b02[_0x3ff2('0x74')]);return _0x219a42['download'](_0x2dddbd);}})[_0x3ff2('0x1f')](handleError(_0x219a42,null));};exports[_0x3ff2('0x75')]=function(_0xf28a9e,_0xaa0369){var _0x1c7d66=null;var _0x38f1b4=null;var _0x48f9bb=null;if(_0xf28a9e[_0x3ff2('0x4a')]['id']){delete _0xf28a9e['body']['id'];}if(_0xf28a9e[_0x3ff2('0x4a')][_0x3ff2('0x76')]){_0x48f9bb=path[_0x3ff2('0x72')](config[_0x3ff2('0x77')],_0x3ff2('0x78'),util['format'](_0x3ff2('0x79'),Date[_0x3ff2('0x7a')]()));_0xf28a9e[_0x3ff2('0x4a')][_0x3ff2('0x7b')]=_0x48f9bb;}return db[_0x3ff2('0x36')][_0x3ff2('0x48')]({'where':{'id':_0xf28a9e[_0x3ff2('0x63')]['id']},'include':[{'model':db[_0x3ff2('0x7c')],'as':_0x3ff2('0x7d'),'include':[{'model':db[_0x3ff2('0x7e')],'as':_0x3ff2('0x7e')}]}]})[_0x3ff2('0x15')](handleEntityNotFound(_0xaa0369,null))['then'](saveUpdates(_0xf28a9e[_0x3ff2('0x4a')],null))[_0x3ff2('0x15')](function(_0x3fb2f9){if(_0x3fb2f9){_0x1c7d66=_0x3fb2f9;return db[_0x3ff2('0x7f')][_0x3ff2('0x48')]({'where':{'id':_0x1c7d66[_0x3ff2('0x4e')]}});}})[_0x3ff2('0x15')](function(_0x49f27d){if(_0x49f27d){_0x38f1b4=_0x49f27d;return db['CmContact'][_0x3ff2('0x48')]({'where':{'id':_0x1c7d66[_0x3ff2('0x80')]}});}})[_0x3ff2('0x15')](function(_0x20bec3){if(_0x20bec3){if(_0x48f9bb){var _0x2abced=null;for(var _0x4beaf3=0x1;_0x4beaf3<_0x1c7d66[_0x3ff2('0x7d')][_0x3ff2('0x45')];++_0x4beaf3){_0x2abced=_0x1c7d66['Messages'][_0x4beaf3];var _0x20d42f=_0x2abced[_0x3ff2('0x68')]?util['format'](_0x3ff2('0x81'),_0x38f1b4[_0x3ff2('0x82')],_0x2abced[_0x3ff2('0x68')]):_0x3ff2('0x83');var _0x21db0d=_0xf28a9e[_0x3ff2('0x4a')][_0x3ff2('0x84')]||util[_0x3ff2('0x85')](_0x3ff2('0x81'),_0x3ff2('0x86'),_0x2abced[_0x3ff2('0x80')]);switch(_0x38f1b4['agentIdentifier']){case _0x3ff2('0x87'):_0x20d42f=_0x2abced[_0x3ff2('0x68')]?util[_0x3ff2('0x85')](_0x3ff2('0x81'),_0x38f1b4[_0x3ff2('0x82')],_0x2abced['UserId']):_0x3ff2('0x83');break;case'agent_alias':_0x20d42f=_0x2abced[_0x3ff2('0x68')]?_0x2abced['User'][_0x3ff2('0x88')]||_0x2abced[_0x3ff2('0x7e')][_0x3ff2('0x54')]:_0x3ff2('0x83');break;case'agent_fullname':_0x20d42f=_0x2abced[_0x3ff2('0x68')]?_0x2abced[_0x3ff2('0x7e')][_0x3ff2('0x54')]:_0x3ff2('0x83');break;default:_0x20d42f=_0x2abced[_0x3ff2('0x68')]?util['format']('%s%d',_0x38f1b4[_0x3ff2('0x82')],_0x2abced['UserId']):_0x3ff2('0x83');}var _0x168762=util[_0x3ff2('0x85')](_0x3ff2('0x89'),moment(_0x2abced['createdAt'])[_0x3ff2('0x85')](_0x3ff2('0x8a')),_0x2abced['direction']==='in'?_0x21db0d:_0x20d42f,_0x2abced[_0x3ff2('0x4a')]);if(!_0x2abced[_0x3ff2('0x8b')]){fs['appendFileSync'](_0x48f9bb,_0x168762);}}return db[_0x3ff2('0x8c')][_0x3ff2('0x4d')]({'where':{'service':!![]},'include':[{'model':db[_0x3ff2('0x8d')],'as':_0x3ff2('0x8e'),'raw':!![],'include':[{'model':db[_0x3ff2('0x8f')],'as':_0x3ff2('0x8f'),'raw':!![]}]}]});}}})[_0x3ff2('0x15')](function(_0x55af40){if(!_0x55af40||!_0x55af40['Smtp']||!_0xf28a9e['body'])return _0x1c7d66;var _0x9d9dda=_0x55af40[_0x3ff2('0x90')]();return respondWithRpcPromise(_0x3ff2('0x91'),_0x3ff2('0x92'),{'account':_0x9d9dda,'message':{'from':util[_0x3ff2('0x85')](_0x3ff2('0x93'),_0x55af40[_0x3ff2('0x2c')],_0x55af40[_0x3ff2('0x57')]||_0x55af40[_0x3ff2('0x8e')]['user']),'to':_0xf28a9e[_0x3ff2('0x4a')][_0x3ff2('0x76')],'subject':'Mail\x20Transcript','text':util['format'](_0x3ff2('0x94'),_0xf28a9e[_0x3ff2('0x4a')]['mailTranscript']),'attachments':[{'path':_0x48f9bb}]}})[_0x3ff2('0x15')](function(){return _0x1c7d66;})[_0x3ff2('0x1f')](function(_0x193cd1){logger[_0x3ff2('0x1b')](_0x193cd1);});})[_0x3ff2('0x15')](respondWithStatusCode(_0xaa0369,0xc8))[_0x3ff2('0x1f')](handleError(_0xaa0369,null));};exports[_0x3ff2('0x95')]=function(_0x52620a,_0x5dd5dc){return db[_0x3ff2('0x7c')][_0x3ff2('0x48')]({'where':{'id':_0x52620a[_0x3ff2('0x63')]['id']}})[_0x3ff2('0x15')](handleEntityNotFound(_0x5dd5dc,null))[_0x3ff2('0x15')](function(_0x57b1a5){if(_0x57b1a5){return _0x57b1a5[_0x3ff2('0x95')](_0x52620a[_0x3ff2('0x4a')][_0x3ff2('0x96')],_[_0x3ff2('0x97')](_0x52620a['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x5dd5dc,null))[_0x3ff2('0x1f')](handleError(_0x5dd5dc,null));};exports[_0x3ff2('0x98')]=function(_0x35340f,_0x1cb3b4){var _0x5b51a1={'raw':![],'where':{}};var _0x240846={};var _0x1ce1b4={'count':0x0,'rows':[]};return db[_0x3ff2('0x36')][_0x3ff2('0x4d')]({'where':{'id':_0x35340f[_0x3ff2('0x63')]['id']}})[_0x3ff2('0x15')](handleEntityNotFound(_0x1cb3b4,null))[_0x3ff2('0x15')](function(_0x1913c9){if(_0x1913c9){_0x240846[_0x3ff2('0x41')]=_[_0x3ff2('0x99')](db['ChatMessage']['rawAttributes']);_0x240846[_0x3ff2('0x3e')]=_['keys'](_0x35340f['query']);_0x240846[_0x3ff2('0x9a')]=_[_0x3ff2('0x43')](_0x240846[_0x3ff2('0x41')],_0x240846[_0x3ff2('0x3e')]);_0x5b51a1[_0x3ff2('0x42')]=_[_0x3ff2('0x43')](_0x240846[_0x3ff2('0x41')],qs[_0x3ff2('0x44')](_0x35340f[_0x3ff2('0x3e')][_0x3ff2('0x44')]));_0x5b51a1[_0x3ff2('0x42')]=_0x5b51a1[_0x3ff2('0x42')][_0x3ff2('0x45')]?_0x5b51a1[_0x3ff2('0x42')]:_0x240846[_0x3ff2('0x41')];if(!_0x35340f['query']['hasOwnProperty'](_0x3ff2('0x9b'))){_0x5b51a1[_0x3ff2('0x26')]=qs[_0x3ff2('0x26')](_0x35340f['query'][_0x3ff2('0x26')]);_0x5b51a1[_0x3ff2('0x24')]=qs[_0x3ff2('0x24')](_0x35340f[_0x3ff2('0x3e')][_0x3ff2('0x24')]);}_0x5b51a1[_0x3ff2('0x9c')]=qs['sort'](_0x35340f[_0x3ff2('0x3e')][_0x3ff2('0x9d')]);_0x5b51a1['where']=qs[_0x3ff2('0x9a')](_[_0x3ff2('0x9e')](_0x35340f[_0x3ff2('0x3e')],_0x240846['filters']));_0x5b51a1[_0x3ff2('0x9f')]['ChatInteractionId']=_0x1913c9['id'];if(_0x35340f[_0x3ff2('0x3e')][_0x3ff2('0xa0')]){_0x5b51a1[_0x3ff2('0x9f')]=_[_0x3ff2('0x2f')](_0x5b51a1[_0x3ff2('0x9f')],{'$or':_['map'](_0x5b51a1[_0x3ff2('0x42')],function(_0x4671c5){var _0x539eb0={};_0x539eb0[_0x4671c5]={'$like':'%'+_0x35340f[_0x3ff2('0x3e')][_0x3ff2('0xa0')]+'%'};return _0x539eb0;})});}if(_0x35340f[_0x3ff2('0x3e')][_0x3ff2('0xa1')]){var _0x1e68b7=_0x35340f[_0x3ff2('0x3e')][_0x3ff2('0xa1')][_0x3ff2('0xa2')](',');var _0x3ca197={};_0x3ca197[_0x1e68b7[0x0]]={'$gte':moment(_0x1e68b7[0x1])[_0x3ff2('0x85')](_0x3ff2('0xa3'))};_0x5b51a1['where']=_[_0x3ff2('0x2f')](_0x5b51a1['where'],_0x3ca197);}_0x5b51a1=_[_0x3ff2('0x2f')]({},_0x5b51a1,_0x35340f[_0x3ff2('0xa4')]);return db[_0x3ff2('0x7c')]['count']({'where':_0x5b51a1[_0x3ff2('0x9f')]})[_0x3ff2('0x15')](function(_0x44c28f){_0x1ce1b4[_0x3ff2('0x27')]=_0x44c28f;if(_0x35340f[_0x3ff2('0x3e')][_0x3ff2('0x46')]){_0x5b51a1[_0x3ff2('0x47')]=[{'all':!![]}];}return db[_0x3ff2('0x7c')][_0x3ff2('0x3c')](_0x5b51a1);})[_0x3ff2('0x15')](function(_0x27585d){_0x1ce1b4[_0x3ff2('0xa5')]=_0x27585d;return _0x1ce1b4;});}})[_0x3ff2('0x15')](respondWithFilteredResult(_0x1cb3b4,_0x5b51a1))[_0x3ff2('0x1f')](handleError(_0x1cb3b4,null));};exports[_0x3ff2('0xa6')]=function(_0x86843f,_0x5306f2){var _0x21e6f1={'where':{}},_0xdb60f1={},_0x353771={'count':0x0,'rows':[]};return db[_0x3ff2('0x36')][_0x3ff2('0x4d')]({'where':{'id':_0x86843f[_0x3ff2('0x63')]['id']}})[_0x3ff2('0x15')](handleEntityNotFound(_0x5306f2,null))['then'](function(_0x3a4997){if(_0x3a4997){_0xdb60f1['model']=_[_0x3ff2('0x99')](db[_0x3ff2('0x7c')]['rawAttributes']);_0xdb60f1[_0x3ff2('0x3e')]=_[_0x3ff2('0x99')](_0x86843f[_0x3ff2('0x3e')]);_0xdb60f1[_0x3ff2('0x9a')]=_['intersection'](_0xdb60f1[_0x3ff2('0x41')],_0xdb60f1[_0x3ff2('0x3e')]);_0x21e6f1[_0x3ff2('0x42')]=_[_0x3ff2('0x43')](_0xdb60f1[_0x3ff2('0x41')],qs[_0x3ff2('0x44')](_0x86843f[_0x3ff2('0x3e')][_0x3ff2('0x44')]));_0x21e6f1[_0x3ff2('0x42')]=_0x21e6f1['attributes'][_0x3ff2('0x45')]?_0x21e6f1[_0x3ff2('0x42')]:_0xdb60f1[_0x3ff2('0x41')];if(!_0x86843f[_0x3ff2('0x3e')][_0x3ff2('0xa7')](_0x3ff2('0x9b'))){_0x21e6f1[_0x3ff2('0x26')]=qs[_0x3ff2('0x26')](_0x86843f[_0x3ff2('0x3e')][_0x3ff2('0x26')]);_0x21e6f1[_0x3ff2('0x24')]=qs['offset'](_0x86843f[_0x3ff2('0x3e')][_0x3ff2('0x24')]);}_0x21e6f1['order']=qs[_0x3ff2('0x9d')](_0x86843f['query']['sort']);_0x21e6f1['where']=qs[_0x3ff2('0x9a')](_[_0x3ff2('0x9e')](_0x86843f[_0x3ff2('0x3e')],_0xdb60f1[_0x3ff2('0x9a')]));_0x21e6f1[_0x3ff2('0x9f')][_0x3ff2('0xa8')]=_0x3a4997['id'];if(_0x86843f[_0x3ff2('0x3e')]['filter']){_0x21e6f1[_0x3ff2('0x9f')]=_['merge'](_0x21e6f1[_0x3ff2('0x9f')],{'$or':_[_0x3ff2('0x35')](_0x21e6f1[_0x3ff2('0x42')],function(_0x27e1b4){var _0x42a7b9={};_0x42a7b9[_0x27e1b4]={'$like':'%'+_0x86843f[_0x3ff2('0x3e')]['filter']+'%'};return _0x42a7b9;})});}_0x21e6f1['where']['secret']=![];if(_0x86843f[_0x3ff2('0x3e')]['id']){_0x21e6f1[_0x3ff2('0x9f')]['id']={'$gt':_0x86843f['query']['id']};}_0x21e6f1=_[_0x3ff2('0x2f')]({},_0x21e6f1,_0x86843f[_0x3ff2('0xa4')]);return db['ChatMessage'][_0x3ff2('0x27')]({'where':_0x21e6f1[_0x3ff2('0x9f')]})['then'](function(_0x3dba77){_0x353771[_0x3ff2('0x27')]=_0x3dba77;_0x21e6f1[_0x3ff2('0x47')]=[];if(_0x86843f[_0x3ff2('0x3e')]['includeAgent']){_0x21e6f1['include']['push']({'model':db['User'],'as':'User','attributes':['id',_0x3ff2('0x54'),_0x3ff2('0x88')]});}if(_0x86843f[_0x3ff2('0x3e')][_0x3ff2('0x46')]){_0x21e6f1[_0x3ff2('0x47')]=[{'all':!![]}];}return db[_0x3ff2('0x7c')]['findAll'](_0x21e6f1);})[_0x3ff2('0x15')](function(_0x35f2c7){_0x353771[_0x3ff2('0xa5')]=_0x35f2c7;return _0x353771;});}})[_0x3ff2('0x15')](respondWithFilteredResult(_0x5306f2,_0x21e6f1))[_0x3ff2('0x1f')](handleError(_0x5306f2,null));};exports['addTags']=function(_0x26b448,_0x7dff07){return db[_0x3ff2('0x36')]['find']({'where':{'id':_0x26b448[_0x3ff2('0x63')]['id']}})[_0x3ff2('0x15')](handleEntityNotFound(_0x7dff07,null))['then'](function(_0x52d2fb){if(_0x52d2fb){return _0x52d2fb['setTags'](_0x26b448['body'][_0x3ff2('0x96')],_['omit'](_0x26b448[_0x3ff2('0x4a')],[_0x3ff2('0x96'),'id'])||{})['spread'](function(){return db[_0x3ff2('0xa9')][_0x3ff2('0x3c')]({'attributes':['id',_0x3ff2('0x2c'),_0x3ff2('0xaa')],'where':{'id':_0x26b448[_0x3ff2('0x4a')][_0x3ff2('0x96')]}});})[_0x3ff2('0x15')](function(_0x2598c0){socket[_0x3ff2('0xab')](_0x3ff2('0xac'),{'id':Number(_0x26b448['params']['id']),'tags':_0x2598c0||[]});return{'id':Number(_0x26b448[_0x3ff2('0x63')]['id']),'tags':_0x2598c0||[]};});}})[_0x3ff2('0x15')](respondWithResult(_0x7dff07,null))[_0x3ff2('0x1f')](handleError(_0x7dff07,null));};exports[_0x3ff2('0xad')]=function(_0x25ec02,_0x4adcc0){return db['ChatInteraction'][_0x3ff2('0x48')]({'where':{'id':_0x25ec02[_0x3ff2('0x63')]['id']}})['then'](handleEntityNotFound(_0x4adcc0,null))['then'](function(_0x5a7e91){if(_0x5a7e91){return _0x5a7e91[_0x3ff2('0xad')](_0x25ec02[_0x3ff2('0x3e')][_0x3ff2('0x96')]);}})['then'](respondWithStatusCode(_0x4adcc0,null))[_0x3ff2('0x1f')](handleError(_0x4adcc0,null));};exports[_0x3ff2('0xae')]=function(_0x5083e4,_0x462bf5){var _0x1680c4=moment()[_0x3ff2('0xaf')]()[_0x3ff2('0xb0')]();var _0xde5147=path[_0x3ff2('0x72')](config['root'],_0x3ff2('0xb1'),_0x3ff2('0xb2'),'tmp');var _0x3bc3e8=path[_0x3ff2('0x72')](config[_0x3ff2('0x77')],_0x3ff2('0xb1'),_0x3ff2('0xb2'),'attachments');var _0x2b9697=path[_0x3ff2('0x72')](_0xde5147,_0x1680c4);var _0x385548=util[_0x3ff2('0x85')](_0x3ff2('0xb3'),_0x5083e4[_0x3ff2('0x63')]['id'],_0x1680c4);var _0xd4ceb8=path[_0x3ff2('0x72')](_0xde5147,_0x385548);var _0x32c504=[];_0x32c504[_0x3ff2('0xb4')]({'model':db[_0x3ff2('0x7e')],'as':_0x3ff2('0x7e'),'attributes':['id',_0x3ff2('0x54')],'raw':!![]});_0x32c504['push']({'model':db[_0x3ff2('0xb5')],'as':_0x3ff2('0x64'),'attributes':['id',_0x3ff2('0xb6'),'lastName'],'raw':!![]});if(_0x5083e4[_0x3ff2('0x3e')][_0x3ff2('0xb7')]){_0x32c504['push']({'model':db[_0x3ff2('0x6d')],'as':_0x3ff2('0x6d'),'raw':!![]});}var _0x1f067a=[{'model':db[_0x3ff2('0x7c')],'as':_0x3ff2('0x7d'),'attributes':['id','body',_0x3ff2('0xb8'),_0x3ff2('0xb9'),_0x3ff2('0x8b'),_0x3ff2('0xba')],'include':_0x32c504}];_0x1f067a[_0x3ff2('0xb4')]({'model':db[_0x3ff2('0x7f')],'as':_0x3ff2('0xbb'),'attributes':['id','name']});_0x1f067a[_0x3ff2('0xb4')]({'model':db[_0x3ff2('0x7e')],'as':_0x3ff2('0xbc'),'attributes':['id','fullname']});return db[_0x3ff2('0x36')][_0x3ff2('0x48')]({'where':{'id':_0x5083e4[_0x3ff2('0x63')]['id']},'include':_0x1f067a})[_0x3ff2('0x15')](handleEntityNotFound(_0x462bf5,null))[_0x3ff2('0x15')](function(_0x275e26){if(_0x275e26){var _0x3383da=_0x275e26[_0x3ff2('0xbd')]({'plain':!![]});fs[_0x3ff2('0xbe')](_0x2b9697);var _0x110b19={'channel':_0x3ff2('0xbf'),'account':_0x3383da['Account'][_0x3ff2('0x2c')],'agent':_0x3383da['Owner']?_0x3383da[_0x3ff2('0xbc')][_0x3ff2('0x54')]:_0x3ff2('0xc0'),'createdAt':moment(_0x3383da[_0x3ff2('0xb8')])['format'](_0x3ff2('0xa3'))['toString'](),'closedAt':_0x3383da[_0x3ff2('0x6f')]?moment(_0x3383da[_0x3ff2('0xc1')])['format']('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x3383da[_0x3ff2('0x6a')],'chatInfo':{'browser':_0x3383da[_0x3ff2('0xc2')],'os':_0x3383da[_0x3ff2('0xc3')],'referer':_0x3383da['referer'],'customerIp':_0x3383da['customerIp'],'customerPort':_0x3383da['customerPort']?_0x3383da[_0x3ff2('0xc4')]:_0x3ff2('0xc0')},'messages':_(_0x3383da[_0x3ff2('0x7d')])['tail']()['filter']({'secret':![]})['map'](function(_0x33834d){if(_0x33834d[_0x3ff2('0x6d')]){var _0xd53f3f=path[_0x3ff2('0x72')](_0x3bc3e8,_0x33834d[_0x3ff2('0x6d')][_0x3ff2('0x74')]);if(fs['existsSync'](_0xd53f3f)){fs['createReadStream'](_0xd53f3f)['pipe'](fs[_0x3ff2('0xc5')](path[_0x3ff2('0x72')](_0x2b9697,_0x33834d[_0x3ff2('0x6d')]['basename'])));}}return{'date':moment(_0x33834d['createdAt'])[_0x3ff2('0x85')](_0x3ff2('0xa3'))[_0x3ff2('0xb0')](),'sender':_0x33834d[_0x3ff2('0xb9')]===_0x3ff2('0xc6')?_0x33834d[_0x3ff2('0x7e')]?_0x33834d[_0x3ff2('0x7e')][_0x3ff2('0x54')]:_0x3ff2('0x83'):_0x33834d['Contact'][_0x3ff2('0xb6')]+(_0x33834d['Contact'][_0x3ff2('0xc7')]?'\x20'+_0x33834d['Contact'][_0x3ff2('0xc7')]:''),'body':_0x33834d['Attachment']?_0x33834d[_0x3ff2('0x6d')][_0x3ff2('0x74')]:_0x33834d[_0x3ff2('0x4a')],'direction':_0x33834d[_0x3ff2('0xb9')]===_0x3ff2('0xc6')?'A':'C','secret':_0x33834d[_0x3ff2('0x8b')],'read':_0x33834d[_0x3ff2('0xba')],'attachment':_0x33834d[_0x3ff2('0x6d')]};})[_0x3ff2('0xc8')]()};return ejs[_0x3ff2('0xc9')](path['join'](config['root'],_0x3ff2('0xb1'),_0x3ff2('0xca'),_0x3ff2('0xcb')),{'interaction':_0x110b19})[_0x3ff2('0x15')](function(_0x45eeeb){var _0x34e329=path['join'](_0x2b9697,_0x3ff2('0xcc')+_0x3383da['id']+'-'+_0x1680c4+_0x3ff2('0xcd'));var _0x8b1a3b={'path':_0x34e329,'channel':_0x3ff2('0xbf'),'interactionId':_0x3383da['id']};return pdf[_0x3ff2('0xce')](_0x45eeeb,_0x8b1a3b);})['then'](function(){return new Promise(function(_0x38e4d1,_0x3eb81c){zipdir(_0x2b9697,{'saveTo':_0xd4ceb8},function(_0x56ab8c,_0x71eb54){if(_0x56ab8c)return _0x3eb81c(_0x56ab8c);return _0x38e4d1(_0x71eb54);});})[_0x3ff2('0x15')](function(){return new BPromise(function(_0x5e3198,_0x4111cc){rimraf(_0x2b9697,function(_0x54a473){if(_0x54a473)_0x4111cc(_0x54a473);return _0x5e3198();});});})[_0x3ff2('0x15')](function(){return _0x462bf5[_0x3ff2('0xae')](_0xd4ceb8,_0x385548,function(_0x45252a){if(_0x45252a){logger[_0x3ff2('0x1b')](_0x3ff2('0xcf'),_0x45252a);}else{fs[_0x3ff2('0xd0')](_0xd4ceb8);}});});});}else{return _0x462bf5['sendStatus'](0xc8);}})[_0x3ff2('0x1f')](handleError(_0x462bf5,null));}; \ No newline at end of file +var _0x47da=['client','http','request','request\x20sent','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','info','catch','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','sendStatus','name','send','merge','body','contact','agent','interaction','account','index','rawAttributes','type','key','getOptions','query','user','show','keys','intersection','model','attributes','fields','includeAll','include','options','ChatInteraction','find','create','params','destroy','describe','ChatWebsite','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','fullname','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','follow','parse','metadata','Sequelize','Error\x20in\x20conversion\x20vidaooMetadata','ValidationError','Error\x20in\x20Vidaoo\x20configuration','out','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','UserId','Interaction\x20already\x20assigned','AbandonInteraction','attachmentUpload','originalname','basename','file','filename','mimetype','Attachment','attachmentDownload','findOne','closed','Unauthorized','attachId','ChatOfflineMessageId','join','root','offline-chat/','download','close','server/files/chat/upload/','format','transcript-%s.txt','pathTranscript','ChatMessage','Messages','User','ContactId','length','%s%d','agentAlias','System','Visitor','agentIdentifier','website_alias','agent_alias','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','CloudProvider','SendMail','sendMail','\x22%s\x22\x20<%s>','email','mailTranscript','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','ids','omit','getMessages','filters','hasOwnProperty','nolimit','order','sort','where','ChatInteractionId','filter','map','$gte','split','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','pick','push','setTags','spread','color','emit','removeTags','toString','server','files','tmp','attachments','transcript-%d-%s.zip','Contact','firstName','read','Account','Owner','get','mkdirSync','closedAt','disposition','browserName','osName','customerPort','N.A.','tail','existsSync','createReadStream','pipe','createWriteStream','lastName','renderFile','views','transcript-','.pdf','Chat','createPdfFromHTML','err','unlinkSync','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','jayson/promise'];(function(_0x4de0f7,_0x4d94f2){var _0x5ac7cd=function(_0x25983d){while(--_0x25983d){_0x4de0f7['push'](_0x4de0f7['shift']());}};_0x5ac7cd(++_0x4d94f2);}(_0x47da,0x195));var _0xa47d=function(_0x1b0fad,_0x2f3d35){_0x1b0fad=_0x1b0fad-0x0;var _0x49a68c=_0x47da[_0x1b0fad];return _0x49a68c;};'use strict';var rimraf=require(_0xa47d('0x0'));var zipdir=require(_0xa47d('0x1'));var rp=require(_0xa47d('0x2'));var moment=require(_0xa47d('0x3'));var BPromise=require(_0xa47d('0x4'));var Mustache=require(_0xa47d('0x5'));var util=require(_0xa47d('0x6'));var path=require(_0xa47d('0x7'));var ejs=require(_0xa47d('0x8'));var fs=require('fs');var _=require(_0xa47d('0x9'));var Redis=require(_0xa47d('0xa'));var interaction=require(_0xa47d('0xb'));var qs=require(_0xa47d('0xc'));var pdf=require(_0xa47d('0xd'));var logger=require(_0xa47d('0xe'))(_0xa47d('0xf'));var config=require(_0xa47d('0x10'));var db=require(_0xa47d('0x11'))['db'];config[_0xa47d('0x12')]=_[_0xa47d('0x13')](config['redis'],{'host':_0xa47d('0x14'),'port':0x18eb});var socket=require(_0xa47d('0x15'))(new Redis(config[_0xa47d('0x12')]));require(_0xa47d('0x16'))[_0xa47d('0x17')](socket);var jayson=require(_0xa47d('0x18'));var client=jayson[_0xa47d('0x19')][_0xa47d('0x1a')]({'port':0x232b});var client9004=jayson['client'][_0xa47d('0x1a')]({'port':0x232c});function respondWithRpcPromise(_0x35adf0,_0x11be8e,_0x117cab,_0x471587){return new BPromise(function(_0x47f254,_0xb410a0){var _0x100508=_0x471587||client;return _0x100508[_0xa47d('0x1b')](_0x35adf0,_0x117cab)['then'](function(_0x2d71d9){logger['info']('ChatInteraction,\x20%s,\x20%s',_0x11be8e,_0xa47d('0x1c'));logger['debug']('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x11be8e,_0xa47d('0x1c'),JSON[_0xa47d('0x1d')](_0x2d71d9));if(_0x2d71d9['error']){if(_0x2d71d9[_0xa47d('0x1e')][_0xa47d('0x1f')]===0x1f4){logger[_0xa47d('0x1e')](_0xa47d('0x20'),_0x11be8e,_0x2d71d9[_0xa47d('0x1e')][_0xa47d('0x21')]);return _0xb410a0(_0x2d71d9[_0xa47d('0x1e')][_0xa47d('0x21')]);}logger[_0xa47d('0x1e')]('ChatInteraction,\x20%s,\x20%s',_0x11be8e,_0x2d71d9[_0xa47d('0x1e')][_0xa47d('0x21')]);return _0x47f254(_0x2d71d9[_0xa47d('0x1e')][_0xa47d('0x21')]);}else{logger[_0xa47d('0x22')](_0xa47d('0x20'),_0x11be8e,'request\x20sent');_0x47f254(_0x2d71d9['result'][_0xa47d('0x21')]);}})[_0xa47d('0x23')](function(_0x23ba4b){logger[_0xa47d('0x1e')](_0xa47d('0x20'),_0x11be8e,_0x23ba4b);_0xb410a0(_0x23ba4b);});});}function respondWithStatusCode(_0x5dc788,_0x340ada){_0x340ada=_0x340ada||0xcc;return function(_0x228ee1){if(_0x228ee1){return _0x5dc788['sendStatus'](_0x340ada);}return _0x5dc788[_0xa47d('0x24')](_0x340ada)[_0xa47d('0x25')]();};}function respondWithResult(_0x4c059f,_0x4a131b){_0x4a131b=_0x4a131b||0xc8;return function(_0x343024){if(_0x343024){return _0x4c059f[_0xa47d('0x24')](_0x4a131b)[_0xa47d('0x26')](_0x343024);}};}function respondWithFilteredResult(_0x1b7bcb,_0x2ddfc8){return function(_0x5c5234){if(_0x5c5234){var _0x340927=typeof _0x2ddfc8[_0xa47d('0x27')]===_0xa47d('0x28')&&typeof _0x2ddfc8[_0xa47d('0x29')]===_0xa47d('0x28');var _0x10fad1=_0x5c5234[_0xa47d('0x2a')];var _0x54ef39=_0x340927?0x0:_0x2ddfc8[_0xa47d('0x27')];var _0x45109f=_0x340927?_0x5c5234[_0xa47d('0x2a')]:_0x2ddfc8[_0xa47d('0x27')]+_0x2ddfc8['limit'];var _0x482889;if(_0x45109f>=_0x10fad1){_0x45109f=_0x10fad1;_0x482889=0xc8;}else{_0x482889=0xce;}_0x1b7bcb[_0xa47d('0x24')](_0x482889);return _0x1b7bcb[_0xa47d('0x2b')](_0xa47d('0x2c'),_0x54ef39+'-'+_0x45109f+'/'+_0x10fad1)['json'](_0x5c5234);}return null;};}function saveUpdates(_0x502aa1){return function(_0x2092d2){if(_0x2092d2){return _0x2092d2[_0xa47d('0x2d')](_0x502aa1)[_0xa47d('0x2e')](function(_0x4131d3){return _0x4131d3;});}return null;};}function removeEntity(_0x91416e){return function(_0x1a8135){if(_0x1a8135){return _0x1a8135['destroy']()['then'](function(){_0x91416e[_0xa47d('0x24')](0xcc)[_0xa47d('0x25')]();});}};}function handleEntityNotFound(_0x28e06a){return function(_0x45abf6){if(!_0x45abf6){_0x28e06a[_0xa47d('0x2f')](0x194);}return _0x45abf6;};}function handleError(_0x10ea03,_0x175bf4){_0x175bf4=_0x175bf4||0x1f4;return function(_0x566777){logger[_0xa47d('0x1e')](_0x566777['stack']);if(_0x566777[_0xa47d('0x30')]){delete _0x566777['name'];}_0x10ea03[_0xa47d('0x24')](_0x175bf4)[_0xa47d('0x31')](_0x566777);};}function getMustacheRender(_0xbb27bb,_0x451aa5){return Mustache['render'](_0xbb27bb,_[_0xa47d('0x32')](_0x451aa5[_0xa47d('0x33')],{'contact':_0x451aa5[_0xa47d('0x34')],'message':_0x451aa5[_0xa47d('0x21')],'agent':_0x451aa5[_0xa47d('0x35')],'interaction':_0x451aa5[_0xa47d('0x36')],'account':_0x451aa5[_0xa47d('0x37')]}))||'';}exports[_0xa47d('0x38')]=function(_0x15b530,_0x7b2f52){var _0x3693a2={};var _0x347cc3=_['map'](db['ChatInteraction'][_0xa47d('0x39')],function(_0x324a47){return{'name':_0x324a47['fieldName'],'type':_0x324a47[_0xa47d('0x3a')][_0xa47d('0x3b')]};});_0x3693a2=qs[_0xa47d('0x3c')](_0x347cc3,_0x15b530);return interaction['findAll']('chat',_0x15b530[_0xa47d('0x3d')],_0x15b530[_0xa47d('0x3e')],_0x3693a2,_0x347cc3)[_0xa47d('0x2e')](respondWithFilteredResult(_0x7b2f52,_0x3693a2))[_0xa47d('0x23')](handleError(_0x7b2f52,null));};exports[_0xa47d('0x3f')]=function(_0x1d7714,_0x2e1d67){var _0x4b1e73={'raw':![],'where':{'id':_0x1d7714['params']['id']}},_0x15b1e2={};_0x15b1e2['model']=_['keys'](db['ChatInteraction'][_0xa47d('0x39')]);_0x15b1e2[_0xa47d('0x3d')]=_[_0xa47d('0x40')](_0x1d7714[_0xa47d('0x3d')]);_0x15b1e2['filters']=_[_0xa47d('0x41')](_0x15b1e2[_0xa47d('0x42')],_0x15b1e2[_0xa47d('0x3d')]);_0x4b1e73[_0xa47d('0x43')]=_[_0xa47d('0x41')](_0x15b1e2[_0xa47d('0x42')],qs['fields'](_0x1d7714[_0xa47d('0x3d')][_0xa47d('0x44')]));_0x4b1e73[_0xa47d('0x43')]=_0x4b1e73[_0xa47d('0x43')]['length']?_0x4b1e73[_0xa47d('0x43')]:_0x15b1e2[_0xa47d('0x42')];if(_0x1d7714[_0xa47d('0x3d')][_0xa47d('0x45')]){_0x4b1e73[_0xa47d('0x46')]=[{'all':!![]}];}_0x4b1e73=_[_0xa47d('0x32')]({},_0x4b1e73,_0x1d7714[_0xa47d('0x47')]);return db[_0xa47d('0x48')][_0xa47d('0x49')](_0x4b1e73)[_0xa47d('0x2e')](handleEntityNotFound(_0x2e1d67,null))[_0xa47d('0x2e')](respondWithResult(_0x2e1d67,null))[_0xa47d('0x23')](handleError(_0x2e1d67,null));};exports['create']=function(_0x515f40,_0x3a989c){return db[_0xa47d('0x48')][_0xa47d('0x4a')](_0x515f40[_0xa47d('0x33')],{})['then'](respondWithResult(_0x3a989c,0xc9))[_0xa47d('0x23')](handleError(_0x3a989c,null));};exports[_0xa47d('0x2d')]=function(_0xd829ee,_0x596598){if(_0xd829ee[_0xa47d('0x33')]['id']){delete _0xd829ee[_0xa47d('0x33')]['id'];}return db[_0xa47d('0x48')]['find']({'where':{'id':_0xd829ee[_0xa47d('0x4b')]['id']}})[_0xa47d('0x2e')](handleEntityNotFound(_0x596598,null))[_0xa47d('0x2e')](saveUpdates(_0xd829ee[_0xa47d('0x33')],null))[_0xa47d('0x2e')](respondWithResult(_0x596598,null))[_0xa47d('0x23')](handleError(_0x596598,null));};exports[_0xa47d('0x4c')]=function(_0x8bb481,_0xc07ff6){return db[_0xa47d('0x48')][_0xa47d('0x49')]({'where':{'id':_0x8bb481[_0xa47d('0x4b')]['id']}})[_0xa47d('0x2e')](handleEntityNotFound(_0xc07ff6,null))[_0xa47d('0x2e')](removeEntity(_0xc07ff6,null))[_0xa47d('0x23')](handleError(_0xc07ff6,null));};exports[_0xa47d('0x4d')]=function(_0x3b96ad,_0x50af54){return db[_0xa47d('0x48')][_0xa47d('0x4d')]()['then'](respondWithResult(_0x50af54,null))['catch'](handleError(_0x50af54,null));};exports['createVidaooSession']=function(_0x5e490a,_0x2720a5){var _0x2e7789=_0x5e490a[_0xa47d('0x4b')]['id'];var _0x342663;var _0x36b3f5;var _0x44f55d;return db[_0xa47d('0x48')]['findOne']({'where':{'id':_0x2e7789}})[_0xa47d('0x2e')](function(_0x1c930c){_0x342663=_0x1c930c;return db[_0xa47d('0x4e')]['findOne']({'where':{'id':_0x1c930c[_0xa47d('0x4f')]},'attributes':['id',_0xa47d('0x50'),_0xa47d('0x51'),_0xa47d('0x52'),_0xa47d('0x53'),_0xa47d('0x54')],'raw':!![]});})[_0xa47d('0x2e')](function(_0x1dd58a){if(_0x1dd58a&&_0x1dd58a[_0xa47d('0x50')]&&_0x1dd58a[_0xa47d('0x51')]){_0x36b3f5=_0x1dd58a;var _0x20f706={'interaction':{'id':_0x2e7789},'agent':{'id':_0x5e490a[_0xa47d('0x3e')]['id'],'name':_0x5e490a[_0xa47d('0x3e')][_0xa47d('0x30')],'fullname':_0x5e490a[_0xa47d('0x3e')][_0xa47d('0x55')],'email':_0x5e490a['user']['email']},'contact':_0x5e490a['body'][_0xa47d('0x34')],'account':_0x5e490a[_0xa47d('0x33')][_0xa47d('0x37')]};var _0x143d8f={'rejectUnauthorized':![],'method':_0xa47d('0x56'),'url':_0xa47d('0x57'),'headers':{'X-APIKEY':_0x1dd58a['vidaooApiKey']},'body':{'duration':null,'scheduledAt':null,'participants':[_0x5e490a[_0xa47d('0x3e')]['email']],'buttons':null,'topic':_0x36b3f5[_0xa47d('0x52')],'note':_[_0xa47d('0x58')](_0x36b3f5[_0xa47d('0x53')])?null:getMustacheRender(_0x36b3f5[_0xa47d('0x53')],_0x20f706),'metadata':null},'redirect':_0xa47d('0x59'),'json':!![]};try{if(!_[_0xa47d('0x58')](_0x36b3f5['vidaooMetadata'])){var _0x128e31=getMustacheRender(_0x36b3f5[_0xa47d('0x54')],_0x20f706);var _0x42c6b9=JSON[_0xa47d('0x5a')](_0x128e31);_0x143d8f[_0xa47d('0x33')][_0xa47d('0x5b')]=_0x42c6b9;}}catch(_0x1d91fe){throw new db[(_0xa47d('0x5c'))]['ValidationError'](_0xa47d('0x5d'));}return rp(_0x143d8f);}else{throw new db[(_0xa47d('0x5c'))][(_0xa47d('0x5e'))](_0xa47d('0x5f'));}})[_0xa47d('0x2e')](function(_0x364d34){_0x44f55d=_0x364d34;if(_0x44f55d['id']){var _0x3a5d63={'body':_0x44f55d['join_url'],'ChatWebsiteId':_0x36b3f5['id'],'ChatInteractionId':_0x342663['id'],'direction':_0xa47d('0x60'),'UserId':_0x5e490a[_0xa47d('0x3e')]['id']};return db['ChatMessage'][_0xa47d('0x4a')](_0x3a5d63,{});}else{throw new db[(_0xa47d('0x5c'))]['ValidationError'](_0xa47d('0x61'));}})['then'](function(){return _0x342663[_0xa47d('0x62')]({'vidaooSessionId':_0x44f55d['id']});})[_0xa47d('0x2e')](respondWithResult(_0x2720a5,null))[_0xa47d('0x23')](handleError(_0x2720a5,null));};exports[_0xa47d('0x63')]=function(_0x1b866d,_0x42236d){if(_0x1b866d[_0xa47d('0x33')]['id']){delete _0x1b866d[_0xa47d('0x33')]['id'];}return db[_0xa47d('0x48')][_0xa47d('0x49')]({'where':{'id':_0x1b866d[_0xa47d('0x4b')]['id']},'include':[{'model':db[_0xa47d('0x64')],'as':'Contact'}]})[_0xa47d('0x2e')](handleEntityNotFound(_0x42236d,null))['then'](saveUpdates(_0x1b866d[_0xa47d('0x33')],null))[_0xa47d('0x2e')](respondWithResult(_0x42236d,null))['catch'](handleError(_0x42236d,null));};exports[_0xa47d('0x65')]=function(_0x215473,_0x2d2230){if(_0x215473['body']['id']){delete _0x215473['body']['id'];}return db[_0xa47d('0x48')]['find']({'where':{'id':_0x215473[_0xa47d('0x4b')]['id']}})['then'](function(_0x5a41d7){if(!_0x5a41d7){logger[_0xa47d('0x1e')](_0xa47d('0x66'),'abandon',0x194,_0xa47d('0x67'));_0x2d2230[_0xa47d('0x2f')](0x194);}else{if(_0x5a41d7[_0xa47d('0x68')]){throw new db[(_0xa47d('0x5c'))]['ValidationError'](_0xa47d('0x69'));}}return _0x5a41d7;})[_0xa47d('0x2e')](function(_0x1e8a86){if(_0x1e8a86){return _0x1e8a86[_0xa47d('0x2d')]({'closed':_0x215473[_0xa47d('0x33')]['closed'],'disposition':_0x215473[_0xa47d('0x33')]['disposition']})[_0xa47d('0x2e')](function(_0x183b1e){return _0x183b1e;});}})[_0xa47d('0x2e')](function(){return respondWithRpcPromise(_0xa47d('0x6a'),_0xa47d('0x65'),_0x215473[_0xa47d('0x33')],client9004);})['then'](respondWithResult(_0x2d2230,null))[_0xa47d('0x23')](handleError(_0x2d2230,null));};exports[_0xa47d('0x6b')]=function(_0x2987f7,_0x1896d2){_0x2987f7[_0xa47d('0x33')][_0xa47d('0x30')]=_0x2987f7['file'][_0xa47d('0x6c')];_0x2987f7[_0xa47d('0x33')][_0xa47d('0x6d')]=_0x2987f7[_0xa47d('0x6e')][_0xa47d('0x6f')];_0x2987f7['body'][_0xa47d('0x3a')]=_0x2987f7[_0xa47d('0x6e')][_0xa47d('0x70')];return db[_0xa47d('0x71')][_0xa47d('0x4a')](_0x2987f7[_0xa47d('0x33')])['then'](respondWithResult(_0x1896d2,0xc9))['catch'](handleError(_0x1896d2,null));};exports[_0xa47d('0x72')]=function(_0x435ece,_0x1e7228){return db[_0xa47d('0x48')][_0xa47d('0x73')]({'where':{'id':_0x435ece[_0xa47d('0x4b')]['id']},'raw':!![]})[_0xa47d('0x2e')](handleEntityNotFound(_0x1e7228,null))['then'](function(_0x4bb329){if(_0x4bb329){if(_0x4bb329[_0xa47d('0x74')]){return _0x1e7228[_0xa47d('0x24')](0x193)[_0xa47d('0x26')]({'status':0x193,'message':_0xa47d('0x75')});}return db['Attachment']['findOne']({'where':{'id':_0x435ece['query'][_0xa47d('0x76')]},'raw':!![]})[_0xa47d('0x2e')](handleEntityNotFound(_0x1e7228,null));}})['then'](function(_0x1d4eca){if(_0x1d4eca){var _0x5072bb=_0x1d4eca[_0xa47d('0x77')]!==null;var _0x5c1813=path[_0xa47d('0x78')](config[_0xa47d('0x79')],'server/files/attachments/');if(_0x5072bb){_0x5c1813=path[_0xa47d('0x78')](_0x5c1813,_0xa47d('0x7a'));}var _0x3c4e5a=path[_0xa47d('0x78')](_0x5c1813,_0x1d4eca['basename']);return _0x1e7228[_0xa47d('0x7b')](_0x3c4e5a);}})[_0xa47d('0x23')](handleError(_0x1e7228,null));};exports[_0xa47d('0x7c')]=function(_0x54c5c5,_0x4bcc46){var _0x3976ac=null;var _0x3b8620=null;var _0x2293ab=null;if(_0x54c5c5[_0xa47d('0x33')]['id']){delete _0x54c5c5[_0xa47d('0x33')]['id'];}if(_0x54c5c5['body']['mailTranscript']){_0x2293ab=path[_0xa47d('0x78')](config[_0xa47d('0x79')],_0xa47d('0x7d'),util[_0xa47d('0x7e')](_0xa47d('0x7f'),Date['now']()));_0x54c5c5['body'][_0xa47d('0x80')]=_0x2293ab;}return db[_0xa47d('0x48')]['find']({'where':{'id':_0x54c5c5[_0xa47d('0x4b')]['id']},'include':[{'model':db[_0xa47d('0x81')],'as':_0xa47d('0x82'),'include':[{'model':db[_0xa47d('0x83')],'as':_0xa47d('0x83')}]}]})[_0xa47d('0x2e')](handleEntityNotFound(_0x4bcc46,null))[_0xa47d('0x2e')](saveUpdates(_0x54c5c5[_0xa47d('0x33')],null))[_0xa47d('0x2e')](function(_0x1ea00d){if(_0x1ea00d){_0x3976ac=_0x1ea00d;return db[_0xa47d('0x4e')]['find']({'where':{'id':_0x3976ac[_0xa47d('0x4f')]}});}})['then'](function(_0x11712d){if(_0x11712d){_0x3b8620=_0x11712d;return db['CmContact'][_0xa47d('0x49')]({'where':{'id':_0x3976ac[_0xa47d('0x84')]}});}})[_0xa47d('0x2e')](function(_0x434565){if(_0x434565){if(_0x2293ab){var _0x161a28=null;for(var _0x3a1b74=0x1;_0x3a1b74<_0x3976ac[_0xa47d('0x82')][_0xa47d('0x85')];++_0x3a1b74){_0x161a28=_0x3976ac[_0xa47d('0x82')][_0x3a1b74];var _0x1c3a72=_0x161a28[_0xa47d('0x68')]?util[_0xa47d('0x7e')](_0xa47d('0x86'),_0x3b8620[_0xa47d('0x87')],_0x161a28[_0xa47d('0x68')]):_0xa47d('0x88');var _0x162d82=_0x54c5c5[_0xa47d('0x33')]['customer']||util[_0xa47d('0x7e')](_0xa47d('0x86'),_0xa47d('0x89'),_0x161a28['ContactId']);switch(_0x3b8620[_0xa47d('0x8a')]){case _0xa47d('0x8b'):_0x1c3a72=_0x161a28[_0xa47d('0x68')]?util[_0xa47d('0x7e')]('%s%d',_0x3b8620[_0xa47d('0x87')],_0x161a28['UserId']):_0xa47d('0x88');break;case _0xa47d('0x8c'):_0x1c3a72=_0x161a28[_0xa47d('0x68')]?_0x161a28[_0xa47d('0x83')]['alias']||_0x161a28[_0xa47d('0x83')]['fullname']:_0xa47d('0x88');break;case'agent_fullname':_0x1c3a72=_0x161a28[_0xa47d('0x68')]?_0x161a28[_0xa47d('0x83')][_0xa47d('0x55')]:_0xa47d('0x88');break;default:_0x1c3a72=_0x161a28[_0xa47d('0x68')]?util[_0xa47d('0x7e')](_0xa47d('0x86'),_0x3b8620['agentAlias'],_0x161a28[_0xa47d('0x68')]):_0xa47d('0x88');}var _0x1a26af=util[_0xa47d('0x7e')](_0xa47d('0x8d'),moment(_0x161a28[_0xa47d('0x8e')])[_0xa47d('0x7e')](_0xa47d('0x8f')),_0x161a28[_0xa47d('0x90')]==='in'?_0x162d82:_0x1c3a72,_0x161a28['body']);if(!_0x161a28[_0xa47d('0x91')]){fs[_0xa47d('0x92')](_0x2293ab,_0x1a26af);}}return db[_0xa47d('0x93')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0xa47d('0x94')],'as':_0xa47d('0x95'),'raw':!![],'include':[{'model':db[_0xa47d('0x96')],'as':_0xa47d('0x96'),'raw':!![]}]}]});}}})[_0xa47d('0x2e')](function(_0x746241){if(!_0x746241||!_0x746241[_0xa47d('0x95')]||!_0x54c5c5['body'])return _0x3976ac;var _0x5d619a=_0x746241['getSmtpOptions']();return respondWithRpcPromise(_0xa47d('0x97'),_0xa47d('0x98'),{'account':_0x5d619a,'message':{'from':util[_0xa47d('0x7e')](_0xa47d('0x99'),_0x746241[_0xa47d('0x30')],_0x746241[_0xa47d('0x9a')]||_0x746241[_0xa47d('0x95')][_0xa47d('0x3e')]),'to':_0x54c5c5[_0xa47d('0x33')][_0xa47d('0x9b')],'subject':_0xa47d('0x9c'),'text':util['format'](_0xa47d('0x9d'),_0x54c5c5[_0xa47d('0x33')][_0xa47d('0x9b')]),'attachments':[{'path':_0x2293ab}]}})[_0xa47d('0x2e')](function(){return _0x3976ac;})[_0xa47d('0x23')](function(_0x50ed44){logger[_0xa47d('0x1e')](_0x50ed44);});})[_0xa47d('0x2e')](respondWithStatusCode(_0x4bcc46,0xc8))[_0xa47d('0x23')](handleError(_0x4bcc46,null));};exports['addMessage']=function(_0x441370,_0x33c3b8){return db[_0xa47d('0x81')][_0xa47d('0x49')]({'where':{'id':_0x441370[_0xa47d('0x4b')]['id']}})[_0xa47d('0x2e')](handleEntityNotFound(_0x33c3b8,null))[_0xa47d('0x2e')](function(_0x45c5f5){if(_0x45c5f5){return _0x45c5f5['addMessage'](_0x441370[_0xa47d('0x33')][_0xa47d('0x9e')],_[_0xa47d('0x9f')](_0x441370[_0xa47d('0x33')],['ids','id'])||{});}})[_0xa47d('0x2e')](respondWithResult(_0x33c3b8,null))[_0xa47d('0x23')](handleError(_0x33c3b8,null));};exports[_0xa47d('0xa0')]=function(_0x1539e2,_0x3f65f9){var _0x41d350={'raw':![],'where':{}};var _0x27acd1={};var _0x47b9c9={'count':0x0,'rows':[]};return db[_0xa47d('0x48')][_0xa47d('0x73')]({'where':{'id':_0x1539e2['params']['id']}})[_0xa47d('0x2e')](handleEntityNotFound(_0x3f65f9,null))[_0xa47d('0x2e')](function(_0x78b80){if(_0x78b80){_0x27acd1[_0xa47d('0x42')]=_[_0xa47d('0x40')](db[_0xa47d('0x81')][_0xa47d('0x39')]);_0x27acd1[_0xa47d('0x3d')]=_[_0xa47d('0x40')](_0x1539e2[_0xa47d('0x3d')]);_0x27acd1[_0xa47d('0xa1')]=_[_0xa47d('0x41')](_0x27acd1['model'],_0x27acd1[_0xa47d('0x3d')]);_0x41d350[_0xa47d('0x43')]=_[_0xa47d('0x41')](_0x27acd1[_0xa47d('0x42')],qs['fields'](_0x1539e2[_0xa47d('0x3d')][_0xa47d('0x44')]));_0x41d350['attributes']=_0x41d350[_0xa47d('0x43')][_0xa47d('0x85')]?_0x41d350[_0xa47d('0x43')]:_0x27acd1[_0xa47d('0x42')];if(!_0x1539e2[_0xa47d('0x3d')][_0xa47d('0xa2')](_0xa47d('0xa3'))){_0x41d350['limit']=qs['limit'](_0x1539e2['query']['limit']);_0x41d350[_0xa47d('0x27')]=qs[_0xa47d('0x27')](_0x1539e2['query'][_0xa47d('0x27')]);}_0x41d350[_0xa47d('0xa4')]=qs[_0xa47d('0xa5')](_0x1539e2[_0xa47d('0x3d')][_0xa47d('0xa5')]);_0x41d350[_0xa47d('0xa6')]=qs[_0xa47d('0xa1')](_['pick'](_0x1539e2[_0xa47d('0x3d')],_0x27acd1['filters']));_0x41d350[_0xa47d('0xa6')][_0xa47d('0xa7')]=_0x78b80['id'];if(_0x1539e2[_0xa47d('0x3d')][_0xa47d('0xa8')]){_0x41d350[_0xa47d('0xa6')]=_[_0xa47d('0x32')](_0x41d350[_0xa47d('0xa6')],{'$or':_[_0xa47d('0xa9')](_0x41d350[_0xa47d('0x43')],function(_0x2a63a1){var _0x3886f7={};_0x3886f7[_0x2a63a1]={'$like':'%'+_0x1539e2['query'][_0xa47d('0xa8')]+'%'};return _0x3886f7;})});}if(_0x1539e2[_0xa47d('0x3d')]['$gte']){var _0x173845=_0x1539e2['query'][_0xa47d('0xaa')][_0xa47d('0xab')](',');var _0xd8e032={};_0xd8e032[_0x173845[0x0]]={'$gte':moment(_0x173845[0x1])[_0xa47d('0x7e')](_0xa47d('0xac'))};_0x41d350[_0xa47d('0xa6')]=_[_0xa47d('0x32')](_0x41d350[_0xa47d('0xa6')],_0xd8e032);}_0x41d350=_[_0xa47d('0x32')]({},_0x41d350,_0x1539e2[_0xa47d('0x47')]);return db[_0xa47d('0x81')][_0xa47d('0x2a')]({'where':_0x41d350[_0xa47d('0xa6')]})[_0xa47d('0x2e')](function(_0x4079da){_0x47b9c9[_0xa47d('0x2a')]=_0x4079da;if(_0x1539e2[_0xa47d('0x3d')][_0xa47d('0x45')]){_0x41d350[_0xa47d('0x46')]=[{'all':!![]}];}return db[_0xa47d('0x81')][_0xa47d('0xad')](_0x41d350);})[_0xa47d('0x2e')](function(_0x2de9a3){_0x47b9c9[_0xa47d('0xae')]=_0x2de9a3;return _0x47b9c9;});}})['then'](respondWithFilteredResult(_0x3f65f9,_0x41d350))[_0xa47d('0x23')](handleError(_0x3f65f9,null));};exports['getMyMessages']=function(_0x3525f4,_0x76bae){var _0x16c7f4={'where':{}},_0x49dea3={},_0x1212f2={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xa47d('0x73')]({'where':{'id':_0x3525f4['params']['id']}})[_0xa47d('0x2e')](handleEntityNotFound(_0x76bae,null))[_0xa47d('0x2e')](function(_0x240e11){if(_0x240e11){_0x49dea3[_0xa47d('0x42')]=_[_0xa47d('0x40')](db['ChatMessage'][_0xa47d('0x39')]);_0x49dea3['query']=_[_0xa47d('0x40')](_0x3525f4[_0xa47d('0x3d')]);_0x49dea3[_0xa47d('0xa1')]=_['intersection'](_0x49dea3['model'],_0x49dea3[_0xa47d('0x3d')]);_0x16c7f4[_0xa47d('0x43')]=_['intersection'](_0x49dea3[_0xa47d('0x42')],qs['fields'](_0x3525f4[_0xa47d('0x3d')][_0xa47d('0x44')]));_0x16c7f4[_0xa47d('0x43')]=_0x16c7f4[_0xa47d('0x43')]['length']?_0x16c7f4[_0xa47d('0x43')]:_0x49dea3[_0xa47d('0x42')];if(!_0x3525f4['query']['hasOwnProperty'](_0xa47d('0xa3'))){_0x16c7f4[_0xa47d('0x29')]=qs[_0xa47d('0x29')](_0x3525f4[_0xa47d('0x3d')][_0xa47d('0x29')]);_0x16c7f4[_0xa47d('0x27')]=qs[_0xa47d('0x27')](_0x3525f4[_0xa47d('0x3d')][_0xa47d('0x27')]);}_0x16c7f4['order']=qs['sort'](_0x3525f4[_0xa47d('0x3d')][_0xa47d('0xa5')]);_0x16c7f4['where']=qs['filters'](_[_0xa47d('0xaf')](_0x3525f4[_0xa47d('0x3d')],_0x49dea3[_0xa47d('0xa1')]));_0x16c7f4['where']['ChatInteractionId']=_0x240e11['id'];if(_0x3525f4[_0xa47d('0x3d')]['filter']){_0x16c7f4[_0xa47d('0xa6')]=_['merge'](_0x16c7f4[_0xa47d('0xa6')],{'$or':_['map'](_0x16c7f4[_0xa47d('0x43')],function(_0x1028e1){var _0x1cbc72={};_0x1cbc72[_0x1028e1]={'$like':'%'+_0x3525f4[_0xa47d('0x3d')]['filter']+'%'};return _0x1cbc72;})});}_0x16c7f4[_0xa47d('0xa6')][_0xa47d('0x91')]=![];if(_0x3525f4['query']['id']){_0x16c7f4[_0xa47d('0xa6')]['id']={'$gt':_0x3525f4['query']['id']};}_0x16c7f4=_[_0xa47d('0x32')]({},_0x16c7f4,_0x3525f4['options']);return db[_0xa47d('0x81')][_0xa47d('0x2a')]({'where':_0x16c7f4['where']})['then'](function(_0xc349eb){_0x1212f2[_0xa47d('0x2a')]=_0xc349eb;_0x16c7f4[_0xa47d('0x46')]=[];if(_0x3525f4[_0xa47d('0x3d')]['includeAgent']){_0x16c7f4[_0xa47d('0x46')][_0xa47d('0xb0')]({'model':db['User'],'as':_0xa47d('0x83'),'attributes':['id',_0xa47d('0x55'),'alias']});}if(_0x3525f4[_0xa47d('0x3d')][_0xa47d('0x45')]){_0x16c7f4[_0xa47d('0x46')]=[{'all':!![]}];}return db['ChatMessage']['findAll'](_0x16c7f4);})[_0xa47d('0x2e')](function(_0x17c646){_0x1212f2[_0xa47d('0xae')]=_0x17c646;return _0x1212f2;});}})['then'](respondWithFilteredResult(_0x76bae,_0x16c7f4))[_0xa47d('0x23')](handleError(_0x76bae,null));};exports['addTags']=function(_0x24692a,_0x5d5ea1){return db[_0xa47d('0x48')][_0xa47d('0x49')]({'where':{'id':_0x24692a[_0xa47d('0x4b')]['id']}})[_0xa47d('0x2e')](handleEntityNotFound(_0x5d5ea1,null))[_0xa47d('0x2e')](function(_0x28411a){if(_0x28411a){return _0x28411a[_0xa47d('0xb1')](_0x24692a[_0xa47d('0x33')][_0xa47d('0x9e')],_[_0xa47d('0x9f')](_0x24692a[_0xa47d('0x33')],[_0xa47d('0x9e'),'id'])||{})[_0xa47d('0xb2')](function(){return db['Tag']['findAll']({'attributes':['id',_0xa47d('0x30'),_0xa47d('0xb3')],'where':{'id':_0x24692a[_0xa47d('0x33')][_0xa47d('0x9e')]}});})[_0xa47d('0x2e')](function(_0x4a0eea){socket[_0xa47d('0xb4')]('chatInteractionTags:save',{'id':Number(_0x24692a[_0xa47d('0x4b')]['id']),'tags':_0x4a0eea||[]});return{'id':Number(_0x24692a['params']['id']),'tags':_0x4a0eea||[]};});}})[_0xa47d('0x2e')](respondWithResult(_0x5d5ea1,null))['catch'](handleError(_0x5d5ea1,null));};exports[_0xa47d('0xb5')]=function(_0x31e6b8,_0x54d4e3){return db[_0xa47d('0x48')][_0xa47d('0x49')]({'where':{'id':_0x31e6b8[_0xa47d('0x4b')]['id']}})[_0xa47d('0x2e')](handleEntityNotFound(_0x54d4e3,null))['then'](function(_0x5cbb50){if(_0x5cbb50){return _0x5cbb50[_0xa47d('0xb5')](_0x31e6b8[_0xa47d('0x3d')]['ids']);}})[_0xa47d('0x2e')](respondWithStatusCode(_0x54d4e3,null))[_0xa47d('0x23')](handleError(_0x54d4e3,null));};exports[_0xa47d('0x7b')]=function(_0x259b83,_0x2708d4){var _0x3ae42d=moment()['unix']()[_0xa47d('0xb6')]();var _0x61940b=path['join'](config[_0xa47d('0x79')],_0xa47d('0xb7'),_0xa47d('0xb8'),_0xa47d('0xb9'));var _0x1db3d4=path[_0xa47d('0x78')](config[_0xa47d('0x79')],_0xa47d('0xb7'),'files',_0xa47d('0xba'));var _0x9fd3f2=path[_0xa47d('0x78')](_0x61940b,_0x3ae42d);var _0x3d71a4=util[_0xa47d('0x7e')](_0xa47d('0xbb'),_0x259b83[_0xa47d('0x4b')]['id'],_0x3ae42d);var _0x5753ab=path[_0xa47d('0x78')](_0x61940b,_0x3d71a4);var _0x5e803f=[];_0x5e803f[_0xa47d('0xb0')]({'model':db[_0xa47d('0x83')],'as':'User','attributes':['id',_0xa47d('0x55')],'raw':!![]});_0x5e803f[_0xa47d('0xb0')]({'model':db[_0xa47d('0x64')],'as':_0xa47d('0xbc'),'attributes':['id',_0xa47d('0xbd'),'lastName'],'raw':!![]});if(_0x259b83[_0xa47d('0x3d')][_0xa47d('0xba')]){_0x5e803f[_0xa47d('0xb0')]({'model':db[_0xa47d('0x71')],'as':_0xa47d('0x71'),'raw':!![]});}var _0x1572a6=[{'model':db['ChatMessage'],'as':_0xa47d('0x82'),'attributes':['id',_0xa47d('0x33'),_0xa47d('0x8e'),_0xa47d('0x90'),'secret',_0xa47d('0xbe')],'include':_0x5e803f}];_0x1572a6[_0xa47d('0xb0')]({'model':db[_0xa47d('0x4e')],'as':_0xa47d('0xbf'),'attributes':['id',_0xa47d('0x30')]});_0x1572a6[_0xa47d('0xb0')]({'model':db[_0xa47d('0x83')],'as':_0xa47d('0xc0'),'attributes':['id','fullname']});return db['ChatInteraction'][_0xa47d('0x49')]({'where':{'id':_0x259b83[_0xa47d('0x4b')]['id']},'include':_0x1572a6})[_0xa47d('0x2e')](handleEntityNotFound(_0x2708d4,null))[_0xa47d('0x2e')](function(_0x77d38a){if(_0x77d38a){var _0x4758ba=_0x77d38a[_0xa47d('0xc1')]({'plain':!![]});fs[_0xa47d('0xc2')](_0x9fd3f2);var _0x185308={'channel':'Chat','account':_0x4758ba['Account'][_0xa47d('0x30')],'agent':_0x4758ba[_0xa47d('0xc0')]?_0x4758ba[_0xa47d('0xc0')]['fullname']:'N.A.','createdAt':moment(_0x4758ba['createdAt'])['format'](_0xa47d('0xac'))[_0xa47d('0xb6')](),'closedAt':_0x4758ba[_0xa47d('0x74')]?moment(_0x4758ba[_0xa47d('0xc3')])['format'](_0xa47d('0xac'))[_0xa47d('0xb6')]():'','disposition':_0x4758ba[_0xa47d('0xc4')],'chatInfo':{'browser':_0x4758ba[_0xa47d('0xc5')],'os':_0x4758ba[_0xa47d('0xc6')],'referer':_0x4758ba['referer'],'customerIp':_0x4758ba['customerIp'],'customerPort':_0x4758ba[_0xa47d('0xc7')]?_0x4758ba[_0xa47d('0xc7')]:_0xa47d('0xc8')},'messages':_(_0x4758ba[_0xa47d('0x82')])[_0xa47d('0xc9')]()[_0xa47d('0xa8')]({'secret':![]})['map'](function(_0x217e6f){if(_0x217e6f['Attachment']){var _0x2f0ad1=path['join'](_0x1db3d4,_0x217e6f[_0xa47d('0x71')]['basename']);if(fs[_0xa47d('0xca')](_0x2f0ad1)){fs[_0xa47d('0xcb')](_0x2f0ad1)[_0xa47d('0xcc')](fs[_0xa47d('0xcd')](path[_0xa47d('0x78')](_0x9fd3f2,_0x217e6f['Attachment'][_0xa47d('0x6d')])));}}return{'date':moment(_0x217e6f[_0xa47d('0x8e')])[_0xa47d('0x7e')](_0xa47d('0xac'))['toString'](),'sender':_0x217e6f[_0xa47d('0x90')]===_0xa47d('0x60')?_0x217e6f[_0xa47d('0x83')]?_0x217e6f['User'][_0xa47d('0x55')]:_0xa47d('0x88'):_0x217e6f[_0xa47d('0xbc')][_0xa47d('0xbd')]+(_0x217e6f['Contact'][_0xa47d('0xce')]?'\x20'+_0x217e6f['Contact']['lastName']:''),'body':_0x217e6f[_0xa47d('0x71')]?_0x217e6f[_0xa47d('0x71')][_0xa47d('0x6d')]:_0x217e6f[_0xa47d('0x33')],'direction':_0x217e6f[_0xa47d('0x90')]==='out'?'A':'C','secret':_0x217e6f[_0xa47d('0x91')],'read':_0x217e6f['read'],'attachment':_0x217e6f['Attachment']};})['value']()};return ejs[_0xa47d('0xcf')](path[_0xa47d('0x78')](config[_0xa47d('0x79')],_0xa47d('0xb7'),_0xa47d('0xd0'),'downloadInteraction.ejs'),{'interaction':_0x185308})['then'](function(_0x20e45a){var _0x29719b=path['join'](_0x9fd3f2,_0xa47d('0xd1')+_0x4758ba['id']+'-'+_0x3ae42d+_0xa47d('0xd2'));var _0x48774d={'path':_0x29719b,'channel':_0xa47d('0xd3'),'interactionId':_0x4758ba['id']};return pdf[_0xa47d('0xd4')](_0x20e45a,_0x48774d);})[_0xa47d('0x2e')](function(){return new Promise(function(_0x177fa0,_0x2c942f){zipdir(_0x9fd3f2,{'saveTo':_0x5753ab},function(_0x417f23,_0x8846c0){if(_0x417f23)return _0x2c942f(_0x417f23);return _0x177fa0(_0x8846c0);});})[_0xa47d('0x2e')](function(){return new BPromise(function(_0x2f2977,_0xd70464){rimraf(_0x9fd3f2,function(_0x4ffbd1){if(_0x4ffbd1)_0xd70464(_0x4ffbd1);return _0x2f2977();});});})[_0xa47d('0x2e')](function(){return _0x2708d4[_0xa47d('0x7b')](_0x5753ab,_0x3d71a4,function(_0x579399){if(_0x579399){logger[_0xa47d('0x1e')](_0xa47d('0xd5'),_0x579399);}else{fs[_0xa47d('0xd6')](_0x5753ab);}});});});}else{return _0x2708d4[_0xa47d('0x2f')](0xc8);}})[_0xa47d('0x23')](handleError(_0x2708d4,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index a67f30d..ce4ad7a 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 _0x4487=['events','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','save','update','remove','getUsers','setDataValue','Users','map','findAll','then','unreadMessages','length','emit','hasOwnProperty','hook','exports'];(function(_0x3529ea,_0x2061a1){var _0x5cad54=function(_0x5102d0){while(--_0x5102d0){_0x3529ea['push'](_0x3529ea['shift']());}};_0x5cad54(++_0x2061a1);}(_0x4487,0x12c));var _0x7448=function(_0x44bcb0,_0x235aa9){_0x44bcb0=_0x44bcb0-0x0;var _0xfaf881=_0x4487[_0x44bcb0];return _0xfaf881;};'use strict';var EventEmitter=require(_0x7448('0x0'));var ChatInteraction=require(_0x7448('0x1'))['db'][_0x7448('0x2')];var ChatMessage=require('../../mysqldb')['db'][_0x7448('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x7448('0x4')](0x0);var events={'afterCreate':_0x7448('0x5'),'afterUpdate':_0x7448('0x6'),'afterDestroy':_0x7448('0x7')};function emitEvent(_0xcb0ab0){return function(_0x41e9a3,_0x3a03b4,_0x40ffe3){_0x41e9a3[_0x7448('0x8')]({'attributes':['id'],'raw':!![]})['then'](function(_0x450a2d){_0x41e9a3[_0x7448('0x9')](_0x7448('0xa'),_0x450a2d[_0x7448('0xb')](function(_0x5e7412){return{'id':_0x5e7412['id']};}));return ChatMessage[_0x7448('0xc')]({'where':{'ChatInteractionId':_0x41e9a3['id'],'direction':'in','read':![]},'raw':!![]});})[_0x7448('0xd')](function(_0x1a638b){_0x41e9a3['setDataValue'](_0x7448('0xe'),_0x1a638b[_0x7448('0xf')]);ChatInteractionEvents[_0x7448('0x10')](_0xcb0ab0+':'+_0x41e9a3['id'],_0x41e9a3);ChatInteractionEvents[_0x7448('0x10')](_0xcb0ab0,_0x41e9a3);_0x40ffe3(null);})['catch'](_0x40ffe3(null));};}for(var e in events){if(events[_0x7448('0x11')](e)){var event=events[e];ChatInteraction[_0x7448('0x12')](e,emitEvent(event));}}module[_0x7448('0x13')]=ChatInteractionEvents; \ No newline at end of file +var _0x18cd=['../../mysqldb','ChatMessage','setMaxListeners','save','getUsers','then','map','findAll','setDataValue','length','emit','catch','hasOwnProperty','hook','exports'];(function(_0x5bee7b,_0x2eac4e){var _0xdc2175=function(_0x22689e){while(--_0x22689e){_0x5bee7b['push'](_0x5bee7b['shift']());}};_0xdc2175(++_0x2eac4e);}(_0x18cd,0xe1));var _0xd18c=function(_0x1ea9e1,_0x3fb7b2){_0x1ea9e1=_0x1ea9e1-0x0;var _0x286900=_0x18cd[_0x1ea9e1];return _0x286900;};'use strict';var EventEmitter=require('events');var ChatInteraction=require(_0xd18c('0x0'))['db']['ChatInteraction'];var ChatMessage=require('../../mysqldb')['db'][_0xd18c('0x1')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xd18c('0x2')](0x0);var events={'afterCreate':_0xd18c('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3ee108){return function(_0x4d2af3,_0x109e39,_0xfccec8){_0x4d2af3[_0xd18c('0x4')]({'attributes':['id'],'raw':!![]})[_0xd18c('0x5')](function(_0x2bbcdf){_0x4d2af3['setDataValue']('Users',_0x2bbcdf[_0xd18c('0x6')](function(_0x5b5823){return{'id':_0x5b5823['id']};}));return ChatMessage[_0xd18c('0x7')]({'where':{'ChatInteractionId':_0x4d2af3['id'],'direction':'in','read':![]},'raw':!![]});})[_0xd18c('0x5')](function(_0x3f0e71){_0x4d2af3[_0xd18c('0x8')]('unreadMessages',_0x3f0e71[_0xd18c('0x9')]);ChatInteractionEvents[_0xd18c('0xa')](_0x3ee108+':'+_0x4d2af3['id'],_0x4d2af3);ChatInteractionEvents[_0xd18c('0xa')](_0x3ee108,_0x4d2af3);_0xfccec8(null);})[_0xd18c('0xb')](_0xfccec8(null));};}for(var e in events){if(events[_0xd18c('0xc')](e)){var event=events[e];ChatInteraction[_0xd18c('0xd')](e,emitEvent(event));}}module[_0xd18c('0xe')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index fe662bd..10e5812 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 _0x9f61=['path','rimraf','../../config/environment','exports','define','ChatInteraction','changed','format','utf8mb4_unicode_ci','util','api','request-promise'];(function(_0x23653e,_0x27eece){var _0x40fca4=function(_0x323050){while(--_0x323050){_0x23653e['push'](_0x23653e['shift']());}};_0x40fca4(++_0x27eece);}(_0x9f61,0xc9));var _0x19f6=function(_0x246768,_0x5aa36d){_0x246768=_0x246768-0x0;var _0x28de2f=_0x9f61[_0x246768];return _0x28de2f;};'use strict';var _=require('lodash');var util=require(_0x19f6('0x0'));var logger=require('../../config/logger')(_0x19f6('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x19f6('0x2'));var fs=require('fs');var path=require(_0x19f6('0x3'));var rimraf=require(_0x19f6('0x4'));var config=require(_0x19f6('0x5'));var attributes=require('./chatInteraction.attributes');module[_0x19f6('0x6')]=function(_0x563b1d,_0x4ceeac){return _0x563b1d[_0x19f6('0x7')](_0x19f6('0x8'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4a6484,_0x358074,_0x2272d8){if(_0x4a6484[_0x19f6('0x9')]('closed')){_0x4a6484['closedAt']=moment()[_0x19f6('0xa')]('YYYY-MM-DD\x20HH:mm:ss');}_0x2272d8(null,_0x4a6484);}},'charset':'utf8mb4','collate':_0x19f6('0xb')});}; \ No newline at end of file +var _0x79d3=['define','chat_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','lodash','util','moment','bluebird','rimraf','../../config/environment','exports'];(function(_0x2a86cd,_0x311500){var _0x2b4f82=function(_0x3c1c65){while(--_0x3c1c65){_0x2a86cd['push'](_0x2a86cd['shift']());}};_0x2b4f82(++_0x311500);}(_0x79d3,0xe9));var _0x379d=function(_0x103b91,_0x25f9da){_0x103b91=_0x103b91-0x0;var _0x281218=_0x79d3[_0x103b91];return _0x281218;};'use strict';var _=require(_0x379d('0x0'));var util=require(_0x379d('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x379d('0x2'));var BPromise=require(_0x379d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x379d('0x4'));var config=require(_0x379d('0x5'));var attributes=require('./chatInteraction.attributes');module[_0x379d('0x6')]=function(_0x127a6b,_0x503a51){return _0x127a6b[_0x379d('0x7')]('ChatInteraction',attributes,{'tableName':_0x379d('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x598f4f,_0x52567d,_0x5bbab9){if(_0x598f4f[_0x379d('0x9')](_0x379d('0xa'))){_0x598f4f[_0x379d('0xb')]=moment()[_0x379d('0xc')](_0x379d('0xd'));}_0x5bbab9(null,_0x598f4f);}},'charset':_0x379d('0xe'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 582afd4..332c51c 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 _0x849c=['bluebird','../../config/utils','rpc','jayson/promise','redis','defaults','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','code','message','result','catch','UpdateChatInteraction','options','raw','where','limit','then','AddTagsToChatInteraction','body','ids','omit','spread','AddTags','lodash','util','moment'];(function(_0x5a2655,_0x3e36c3){var _0x4ddb50=function(_0x484f5e){while(--_0x484f5e){_0x5a2655['push'](_0x5a2655['shift']());}};_0x4ddb50(++_0x3e36c3);}(_0x849c,0x69));var _0xc849=function(_0x1b4ad3,_0x5b223f){_0x1b4ad3=_0x1b4ad3-0x0;var _0x373923=_0x849c[_0x1b4ad3];return _0x373923;};'use strict';var _=require(_0xc849('0x0'));var util=require(_0xc849('0x1'));var moment=require(_0xc849('0x2'));var BPromise=require(_0xc849('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc849('0x4'));var logger=require('../../config/logger')(_0xc849('0x5'));var config=require('../../config/environment');var jayson=require(_0xc849('0x6'));var client=jayson['client']['http']({'port':0x232a});config[_0xc849('0x7')]=_[_0xc849('0x8')](config[_0xc849('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0xc849('0x9'))(new Redis(config[_0xc849('0x7')]));require(_0xc849('0xa'))[_0xc849('0xb')](socket);function respondWithRpcPromise(_0x15843b,_0x15e56b,_0x1bc0fd){return new BPromise(function(_0x248172,_0x1ab049){return client[_0xc849('0xc')](_0x15843b,_0x1bc0fd)['then'](function(_0x40a0cb){logger[_0xc849('0xd')](_0xc849('0xe'),_0x15e56b,_0xc849('0xf'));logger[_0xc849('0x10')](_0xc849('0x11'),_0x15e56b,_0xc849('0xf'),JSON[_0xc849('0x12')](_0x40a0cb));if(_0x40a0cb[_0xc849('0x13')]){if(_0x40a0cb[_0xc849('0x13')][_0xc849('0x14')]===0x1f4){logger[_0xc849('0x13')](_0xc849('0xe'),_0x15e56b,_0x40a0cb[_0xc849('0x13')][_0xc849('0x15')]);return _0x1ab049(_0x40a0cb['error']['message']);}logger['error'](_0xc849('0xe'),_0x15e56b,_0x40a0cb[_0xc849('0x13')]['message']);return _0x248172(_0x40a0cb['error'][_0xc849('0x15')]);}else{logger['info'](_0xc849('0xe'),_0x15e56b,_0xc849('0xf'));_0x248172(_0x40a0cb[_0xc849('0x16')][_0xc849('0x15')]);}})[_0xc849('0x17')](function(_0x1aea6f){logger[_0xc849('0x13')]('ChatInteraction,\x20%s,\x20%s',_0x15e56b,_0x1aea6f);_0x1ab049(_0x1aea6f);});});}exports[_0xc849('0x18')]=function(_0x3686d4){var _0x1477a9=this;return new Promise(function(_0x14553b,_0x1bca4b){return db['ChatInteraction']['update'](_0x3686d4['body'],{'raw':_0x3686d4[_0xc849('0x19')]?_0x3686d4[_0xc849('0x19')][_0xc849('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3686d4[_0xc849('0x19')]?_0x3686d4[_0xc849('0x19')][_0xc849('0x1b')]||null:null,'attributes':_0x3686d4[_0xc849('0x19')]?_0x3686d4['options']['attributes']||null:null,'limit':_0x3686d4[_0xc849('0x19')]?_0x3686d4['options'][_0xc849('0x1c')]||null:null})[_0xc849('0x1d')](function(_0x29bffe){logger[_0xc849('0xd')](_0xc849('0x18'),_0x3686d4);logger['debug'](_0xc849('0x18'),_0x3686d4,JSON[_0xc849('0x12')](_0x29bffe));_0x14553b(_0x29bffe);})['catch'](function(_0x36678a){logger['error'](_0xc849('0x18'),_0x36678a[_0xc849('0x15')],_0x3686d4);_0x1bca4b(_0x1477a9[_0xc849('0x13')](0x1f4,_0x36678a[_0xc849('0x15')]));});});};exports[_0xc849('0x1e')]=function(_0x3bcac1){return new Promise(function(_0x5d4a52,_0x1a8e6a){return db['ChatInteraction']['find']({'where':_0x3bcac1['options']?_0x3bcac1[_0xc849('0x19')][_0xc849('0x1b')]||null:null})[_0xc849('0x1d')](function(_0x1bb661){if(_0x1bb661){return _0x1bb661['addTags'](_0x3bcac1[_0xc849('0x1f')][_0xc849('0x20')],_[_0xc849('0x21')](_0x3bcac1[_0xc849('0x1f')],[_0xc849('0x20'),'id'])||{});}})[_0xc849('0x22')](function(_0x3b448e){logger['info'](_0xc849('0x23'),_0x3bcac1);logger[_0xc849('0x10')](_0xc849('0x23'),_0x3bcac1,JSON[_0xc849('0x12')](_0x3b448e));_0x5d4a52(_0x3b448e);})[_0xc849('0x17')](function(_0x1ae604){logger[_0xc849('0x13')](_0xc849('0x23'),_0x1ae604[_0xc849('0x15')],_0x3bcac1);_0x1a8e6a(_this[_0xc849('0x13')](0x1f4,_0x1ae604[_0xc849('0x15')]));});});}; \ No newline at end of file +var _0x2d9e=['AddTagsToChatInteraction','find','addTags','ids','omit','spread','AddTags','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','./chatInteraction.socket','register','then','ChatInteraction,\x20%s,\x20%s','request\x20sent','error','message','result','catch','UpdateChatInteraction','ChatInteraction','update','body','options','raw','where','limit','info','debug','stringify'];(function(_0x213518,_0x51e022){var _0x1baf75=function(_0x5c8444){while(--_0x5c8444){_0x213518['push'](_0x213518['shift']());}};_0x1baf75(++_0x51e022);}(_0x2d9e,0x1e7));var _0xe2d9=function(_0x3497ec,_0x9e1d14){_0x3497ec=_0x3497ec-0x0;var _0x47ee1e=_0x2d9e[_0x3497ec];return _0x47ee1e;};'use strict';var _=require('lodash');var util=require(_0xe2d9('0x0'));var moment=require('moment');var BPromise=require(_0xe2d9('0x1'));var rs=require(_0xe2d9('0x2'));var fs=require('fs');var Redis=require(_0xe2d9('0x3'));var db=require(_0xe2d9('0x4'))['db'];var utils=require(_0xe2d9('0x5'));var logger=require(_0xe2d9('0x6'))(_0xe2d9('0x7'));var config=require(_0xe2d9('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe2d9('0x9')]({'port':0x232a});config[_0xe2d9('0xa')]=_[_0xe2d9('0xb')](config[_0xe2d9('0xa')],{'host':_0xe2d9('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe2d9('0xa')]));require(_0xe2d9('0xd'))[_0xe2d9('0xe')](socket);function respondWithRpcPromise(_0x11fb54,_0x3d240b,_0x72b4c7){return new BPromise(function(_0x1f1c38,_0x2f6b66){return client['request'](_0x11fb54,_0x72b4c7)[_0xe2d9('0xf')](function(_0x109687){logger['info'](_0xe2d9('0x10'),_0x3d240b,_0xe2d9('0x11'));logger['debug']('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x3d240b,'request\x20sent',JSON['stringify'](_0x109687));if(_0x109687['error']){if(_0x109687[_0xe2d9('0x12')]['code']===0x1f4){logger['error'](_0xe2d9('0x10'),_0x3d240b,_0x109687[_0xe2d9('0x12')]['message']);return _0x2f6b66(_0x109687[_0xe2d9('0x12')][_0xe2d9('0x13')]);}logger['error'](_0xe2d9('0x10'),_0x3d240b,_0x109687['error'][_0xe2d9('0x13')]);return _0x1f1c38(_0x109687[_0xe2d9('0x12')][_0xe2d9('0x13')]);}else{logger['info'](_0xe2d9('0x10'),_0x3d240b,'request\x20sent');_0x1f1c38(_0x109687[_0xe2d9('0x14')][_0xe2d9('0x13')]);}})[_0xe2d9('0x15')](function(_0x301699){logger[_0xe2d9('0x12')](_0xe2d9('0x10'),_0x3d240b,_0x301699);_0x2f6b66(_0x301699);});});}exports[_0xe2d9('0x16')]=function(_0x36377f){var _0xf9ed9f=this;return new Promise(function(_0xf45d25,_0x55c58c){return db[_0xe2d9('0x17')][_0xe2d9('0x18')](_0x36377f[_0xe2d9('0x19')],{'raw':_0x36377f[_0xe2d9('0x1a')]?_0x36377f[_0xe2d9('0x1a')][_0xe2d9('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x36377f[_0xe2d9('0x1a')]?_0x36377f[_0xe2d9('0x1a')][_0xe2d9('0x1c')]||null:null,'attributes':_0x36377f[_0xe2d9('0x1a')]?_0x36377f[_0xe2d9('0x1a')]['attributes']||null:null,'limit':_0x36377f['options']?_0x36377f[_0xe2d9('0x1a')][_0xe2d9('0x1d')]||null:null})[_0xe2d9('0xf')](function(_0x30e9c6){logger[_0xe2d9('0x1e')]('UpdateChatInteraction',_0x36377f);logger[_0xe2d9('0x1f')](_0xe2d9('0x16'),_0x36377f,JSON[_0xe2d9('0x20')](_0x30e9c6));_0xf45d25(_0x30e9c6);})[_0xe2d9('0x15')](function(_0x2fd210){logger[_0xe2d9('0x12')]('UpdateChatInteraction',_0x2fd210[_0xe2d9('0x13')],_0x36377f);_0x55c58c(_0xf9ed9f[_0xe2d9('0x12')](0x1f4,_0x2fd210[_0xe2d9('0x13')]));});});};exports[_0xe2d9('0x21')]=function(_0x1196f0){return new Promise(function(_0x2335a2,_0x1e0d51){return db[_0xe2d9('0x17')][_0xe2d9('0x22')]({'where':_0x1196f0[_0xe2d9('0x1a')]?_0x1196f0['options'][_0xe2d9('0x1c')]||null:null})[_0xe2d9('0xf')](function(_0x17a63e){if(_0x17a63e){return _0x17a63e[_0xe2d9('0x23')](_0x1196f0[_0xe2d9('0x19')][_0xe2d9('0x24')],_[_0xe2d9('0x25')](_0x1196f0['body'],[_0xe2d9('0x24'),'id'])||{});}})[_0xe2d9('0x26')](function(_0x4d4a1b){logger[_0xe2d9('0x1e')]('AddTags',_0x1196f0);logger[_0xe2d9('0x1f')]('AddTags',_0x1196f0,JSON[_0xe2d9('0x20')](_0x4d4a1b));_0x2335a2(_0x4d4a1b);})[_0xe2d9('0x15')](function(_0x538a0b){logger[_0xe2d9('0x12')](_0xe2d9('0x27'),_0x538a0b[_0xe2d9('0x13')],_0x1196f0);_0x1e0d51(_this[_0xe2d9('0x12')](0x1f4,_0x538a0b[_0xe2d9('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index e5d173c..788ff83 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 _0x028b=['remove','update','emit','removeListener','register','length','chatInteraction:','./chatInteraction.events','save'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x028b,0x1c0));var _0xb028=function(_0x3afaa8,_0x1182bc){_0x3afaa8=_0x3afaa8-0x0;var _0x53844f=_0x028b[_0x3afaa8];return _0x53844f;};'use strict';var ChatInteractionEvents=require(_0xb028('0x0'));var events=[_0xb028('0x1'),_0xb028('0x2'),_0xb028('0x3')];function createListener(_0xce15cf,_0x4b0284){return function(_0x385330){_0x4b0284[_0xb028('0x4')](_0xce15cf,_0x385330);};}function removeListener(_0x694462,_0x26207a){return function(){ChatInteractionEvents[_0xb028('0x5')](_0x694462,_0x26207a);};}exports[_0xb028('0x6')]=function(_0x3fb92a){for(var _0x463c86=0x0,_0x3dad8e=events[_0xb028('0x7')];_0x463c86<_0x3dad8e;_0x463c86++){var _0x1e95e7=events[_0x463c86];var _0x1757ff=createListener(_0xb028('0x8')+_0x1e95e7,_0x3fb92a);ChatInteractionEvents['on'](_0x1e95e7,_0x1757ff);}}; \ No newline at end of file +var _0x61c6=['chatInteraction:','./chatInteraction.events','save','remove','update','removeListener','register','length'];(function(_0xa33769,_0x24efe9){var _0x4b39b8=function(_0x4a752c){while(--_0x4a752c){_0xa33769['push'](_0xa33769['shift']());}};_0x4b39b8(++_0x24efe9);}(_0x61c6,0x199));var _0x661c=function(_0x382f6c,_0x7e79e3){_0x382f6c=_0x382f6c-0x0;var _0x1ec773=_0x61c6[_0x382f6c];return _0x1ec773;};'use strict';var ChatInteractionEvents=require(_0x661c('0x0'));var events=[_0x661c('0x1'),_0x661c('0x2'),_0x661c('0x3')];function createListener(_0x51fa8d,_0x562393){return function(_0x29652b){_0x562393['emit'](_0x51fa8d,_0x29652b);};}function removeListener(_0x26d854,_0x5e5835){return function(){ChatInteractionEvents[_0x661c('0x4')](_0x26d854,_0x5e5835);};}exports[_0x661c('0x5')]=function(_0x531865){for(var _0x4936a9=0x0,_0x330c23=events[_0x661c('0x6')];_0x4936a9<_0x330c23;_0x4936a9++){var _0x306d2c=events[_0x4936a9];var _0x250e2c=createListener(_0x661c('0x7')+_0x306d2c,_0x531865);ChatInteractionEvents['on'](_0x306d2c,_0x250e2c);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index b47a4db..6f8befa 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 _0x0b48=['addTags','put','/:id','chatinteraction:update','update','/:id/abandon','abandon','delete','chatinteraction:destroy','destroy','exports','multer','util','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','isChatInteractionAuthorized','getMyMessages','/:id/download','download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','join','root','format','single','file','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags'];(function(_0x1cc4e1,_0x1629d4){var _0x192d47=function(_0x40dbe2){while(--_0x40dbe2){_0x1cc4e1['push'](_0x1cc4e1['shift']());}};_0x192d47(++_0x1629d4);}(_0x0b48,0x1ef));var _0x80b4=function(_0x45c6f5,_0x4e7b86){_0x45c6f5=_0x45c6f5-0x0;var _0x2b4d40=_0x0b48[_0x45c6f5];return _0x2b4d40;};'use strict';var multer=require(_0x80b4('0x0'));var util=require(_0x80b4('0x1'));var path=require('path');var timeout=require(_0x80b4('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x80b4('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x80b4('0x4'));var config=require(_0x80b4('0x5'));var controller=require(_0x80b4('0x6'));router[_0x80b4('0x7')]('/',auth[_0x80b4('0x8')](),controller[_0x80b4('0x9')]);router[_0x80b4('0x7')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth['isChatInteractionAuthorized'](),controller['show']);router[_0x80b4('0x7')](_0x80b4('0xa'),auth['isChatInteractionAuthorized'](),controller[_0x80b4('0xb')]);router['get'](_0x80b4('0xc'),auth['isAuthenticated'](),controller[_0x80b4('0xd')]);router[_0x80b4('0x7')]('/:id/my_messages',auth[_0x80b4('0xe')](),controller[_0x80b4('0xf')]);router['get'](_0x80b4('0x10'),auth[_0x80b4('0x8')](),controller[_0x80b4('0x11')]);router[_0x80b4('0x12')]('/',auth[_0x80b4('0x8')](),controller[_0x80b4('0x13')]);router[_0x80b4('0x12')](_0x80b4('0x14'),auth[_0x80b4('0x8')](),controller[_0x80b4('0x15')]);var upload=multer({'storage':multer[_0x80b4('0x16')]({'destination':function(_0x5b9f93,_0x22cd31,_0x367447){_0x367447(null,path[_0x80b4('0x17')](config[_0x80b4('0x18')],'server/files/attachments/'));},'filename':function(_0x454d95,_0x4eb5d1,_0x2b7559){_0x2b7559(null,util[_0x80b4('0x19')]('%s-%s',Date['now'](),_0x4eb5d1['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x80b4('0x12')]('/:id/attachment_upload',upload[_0x80b4('0x1a')](_0x80b4('0x1b')),controller['attachmentUpload']);router[_0x80b4('0x12')]('/:id/messages',auth[_0x80b4('0xe')](),controller[_0x80b4('0x1c')]);router[_0x80b4('0x12')](_0x80b4('0x1d'),auth[_0x80b4('0x8')](),interaction[_0x80b4('0x1e')](_0x80b4('0x1f'),_0x80b4('0x20')),controller[_0x80b4('0x21')]);router[_0x80b4('0x22')](_0x80b4('0x23'),auth[_0x80b4('0x8')](),interaction[_0x80b4('0x1e')](_0x80b4('0x1f'),_0x80b4('0x24')),controller[_0x80b4('0x25')]);router[_0x80b4('0x22')]('/:id/custom_update',controller['customUpdate']);router[_0x80b4('0x22')](_0x80b4('0x26'),auth['isChatInteractionAuthorized'](),controller[_0x80b4('0x27')]);router[_0x80b4('0x22')]('/:id/close',controller['close']);router[_0x80b4('0x28')](_0x80b4('0x23'),auth[_0x80b4('0x8')](),interaction[_0x80b4('0x1e')](_0x80b4('0x1f'),_0x80b4('0x29')),controller[_0x80b4('0x2a')]);router[_0x80b4('0x28')](_0x80b4('0x1d'),auth[_0x80b4('0x8')](),controller['removeTags']);module[_0x80b4('0x2b')]=router; \ No newline at end of file +var _0x914c=['abandon','/:id/close','/:id','chatinteraction:destroy','destroy','delete','removeTags','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./chatInteraction.controller','get','isAuthenticated','/describe','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','/:id/download','download','create','createVidaooSession','diskStorage','join','root','server/files/attachments/','format','%s-%s','now','originalname','post','/:id/attachment_upload','attachmentUpload','addMessage','/:id/tags','tracked','chat','addTags','put','chatinteraction:update','customUpdate','/:id/abandon'];(function(_0x2cf68e,_0x32ed11){var _0x27ae6a=function(_0x5e39c7){while(--_0x5e39c7){_0x2cf68e['push'](_0x2cf68e['shift']());}};_0x27ae6a(++_0x32ed11);}(_0x914c,0x134));var _0xc914=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x914c[_0x4a9fb1];return _0x348672;};'use strict';var multer=require(_0xc914('0x0'));var util=require(_0xc914('0x1'));var path=require(_0xc914('0x2'));var timeout=require(_0xc914('0x3'));var express=require(_0xc914('0x4'));var router=express[_0xc914('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc914('0x6'));var controller=require(_0xc914('0x7'));router[_0xc914('0x8')]('/',auth[_0xc914('0x9')](),controller['index']);router[_0xc914('0x8')](_0xc914('0xa'),auth[_0xc914('0x9')](),controller['describe']);router[_0xc914('0x8')]('/:id',auth[_0xc914('0xb')](),controller[_0xc914('0xc')]);router['get'](_0xc914('0xd'),auth[_0xc914('0xb')](),controller[_0xc914('0xe')]);router[_0xc914('0x8')](_0xc914('0xf'),auth[_0xc914('0x9')](),controller[_0xc914('0x10')]);router[_0xc914('0x8')](_0xc914('0x11'),auth[_0xc914('0xb')](),controller['getMyMessages']);router[_0xc914('0x8')](_0xc914('0x12'),auth[_0xc914('0x9')](),controller[_0xc914('0x13')]);router['post']('/',auth['isAuthenticated'](),controller[_0xc914('0x14')]);router['post']('/:id/vidaoo',auth[_0xc914('0x9')](),controller[_0xc914('0x15')]);var upload=multer({'storage':multer[_0xc914('0x16')]({'destination':function(_0x2d528b,_0x41bcc8,_0x2d2a43){_0x2d2a43(null,path[_0xc914('0x17')](config[_0xc914('0x18')],_0xc914('0x19')));},'filename':function(_0x3907ed,_0x39ee4e,_0x812d69){_0x812d69(null,util[_0xc914('0x1a')](_0xc914('0x1b'),Date[_0xc914('0x1c')](),_0x39ee4e[_0xc914('0x1d')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xc914('0x1e')](_0xc914('0x1f'),upload['single']('file'),controller[_0xc914('0x20')]);router[_0xc914('0x1e')](_0xc914('0xf'),auth[_0xc914('0xb')](),controller[_0xc914('0x21')]);router[_0xc914('0x1e')](_0xc914('0x22'),auth[_0xc914('0x9')](),interaction[_0xc914('0x23')](_0xc914('0x24'),'chatinteraction:addtags'),controller[_0xc914('0x25')]);router[_0xc914('0x26')]('/:id',auth[_0xc914('0x9')](),interaction[_0xc914('0x23')]('chat',_0xc914('0x27')),controller['update']);router[_0xc914('0x26')]('/:id/custom_update',controller[_0xc914('0x28')]);router[_0xc914('0x26')](_0xc914('0x29'),auth[_0xc914('0xb')](),controller[_0xc914('0x2a')]);router[_0xc914('0x26')](_0xc914('0x2b'),controller['close']);router['delete'](_0xc914('0x2c'),auth[_0xc914('0x9')](),interaction[_0xc914('0x23')](_0xc914('0x24'),_0xc914('0x2d')),controller[_0xc914('0x2e')]);router[_0xc914('0x2f')](_0xc914('0x22'),auth[_0xc914('0x9')](),controller[_0xc914('0x30')]);module[_0xc914('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 21017a5..5ba5f8b 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 _0xe10d=['BOOLEAN','INTEGER','sequelize','exports','TEXT','medium'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe10d,0x1b8));var _0xde10=function(_0x5aa90c,_0x40e79b){_0x5aa90c=_0x5aa90c-0x0;var _0x228251=_0xe10d[_0x5aa90c];return _0x228251;};'use strict';var Sequelize=require(_0xde10('0x0'));module[_0xde10('0x1')]={'body':{'type':Sequelize[_0xde10('0x2')](_0xde10('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xde10('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xde10('0x5')]}}; \ No newline at end of file +var _0xa36f=['TEXT','medium','BOOLEAN','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa36f,0xab));var _0xfa36=function(_0x5ede1a,_0x51e4d0){_0x5ede1a=_0x5ede1a-0x0;var _0x9b0761=_0xa36f[_0x5ede1a];return _0x9b0761;};'use strict';var Sequelize=require('sequelize');module[_0xfa36('0x0')]={'body':{'type':Sequelize[_0xfa36('0x1')](_0xfa36('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xfa36('0x3')],'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 1c1efd2..0c96195 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 _0xb47e=['attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','include','ChatInternalMessage','findAll','rows','catch','show','params','keys','includeAll','options','find','create','body','describe','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','agent','admin','user','fullname','userpic','internal','online','allowmessenger','showWebBar','-online','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Agents','userProfileId','autoAssociation','isEmpty','push','messages','FromId','ToId','read','-createdAt','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','defaults','socket.io-emitter','redis','./chatInternalMessage.socket','register','sendStatus','status','end','offset','limit','undefined','count','Content-Range','json','reject','save','update','then','destroy','stack','name','send','index','rawAttributes','type','key','model','map','query'];(function(_0x32d254,_0x15e17c){var _0x1b2a7a=function(_0x3ad486){while(--_0x3ad486){_0x32d254['push'](_0x32d254['shift']());}};_0x1b2a7a(++_0x15e17c);}(_0xb47e,0xa6));var _0xeb47=function(_0x2f11b1,_0x27fe5e){_0x2f11b1=_0x2f11b1-0x0;var _0x19f371=_0xb47e[_0x2f11b1];return _0x19f371;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xeb47('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xeb47('0x1'));var rp=require(_0xeb47('0x2'));var moment=require('moment');var BPromise=require(_0xeb47('0x3'));var Mustache=require('mustache');var util=require(_0xeb47('0x4'));var path=require(_0xeb47('0x5'));var sox=require(_0xeb47('0x6'));var csv=require(_0xeb47('0x7'));var ejs=require(_0xeb47('0x8'));var fs=require('fs');var fs_extra=require(_0xeb47('0x9'));var _=require(_0xeb47('0xa'));var squel=require('squel');var crypto=require(_0xeb47('0xb'));var jsforce=require(_0xeb47('0xc'));var deskjs=require(_0xeb47('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xeb47('0xe'));var Redis=require('ioredis');var authService=require(_0xeb47('0xf'));var qs=require(_0xeb47('0x10'));var as=require(_0xeb47('0x11'));var hardwareService=require(_0xeb47('0x12'));var logger=require(_0xeb47('0x13'))('api');var utils=require(_0xeb47('0x14'));var config=require(_0xeb47('0x15'));var licenseUtil=require(_0xeb47('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xeb47('0x17')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xeb47('0x18'))(new Redis(config[_0xeb47('0x19')]));require(_0xeb47('0x1a'))[_0xeb47('0x1b')](socket);function respondWithStatusCode(_0x585244,_0x57949f){_0x57949f=_0x57949f||0xcc;return function(_0x850454){if(_0x850454){return _0x585244[_0xeb47('0x1c')](_0x57949f);}return _0x585244[_0xeb47('0x1d')](_0x57949f)[_0xeb47('0x1e')]();};}function respondWithResult(_0x458f6d,_0x368422){_0x368422=_0x368422||0xc8;return function(_0x17afe2){if(_0x17afe2){return _0x458f6d[_0xeb47('0x1d')](_0x368422)['json'](_0x17afe2);}};}function respondWithFilteredResult(_0xbea28e,_0x7b5474){return function(_0x54f05c){if(_0x54f05c){var _0x5bdab4=typeof _0x7b5474[_0xeb47('0x1f')]==='undefined'&&typeof _0x7b5474[_0xeb47('0x20')]===_0xeb47('0x21');var _0x3dbaa5=_0x54f05c[_0xeb47('0x22')];var _0x1daac6=_0x5bdab4?0x0:_0x7b5474[_0xeb47('0x1f')];var _0x5913ea=_0x5bdab4?_0x54f05c[_0xeb47('0x22')]:_0x7b5474[_0xeb47('0x1f')]+_0x7b5474[_0xeb47('0x20')];var _0x22e77b;if(_0x5913ea>=_0x3dbaa5){_0x5913ea=_0x3dbaa5;_0x22e77b=0xc8;}else{_0x22e77b=0xce;}_0xbea28e[_0xeb47('0x1d')](_0x22e77b);return _0xbea28e['set'](_0xeb47('0x23'),_0x1daac6+'-'+_0x5913ea+'/'+_0x3dbaa5)[_0xeb47('0x24')](_0x54f05c);}return null;};}function patchUpdates(_0x40655b){return function(_0x58d75d){try{jsonpatch['apply'](_0x58d75d,_0x40655b,!![]);}catch(_0x489b01){return BPromise[_0xeb47('0x25')](_0x489b01);}return _0x58d75d[_0xeb47('0x26')]();};}function saveUpdates(_0x30a819,_0x546f0c){return function(_0x4aecdb){if(_0x4aecdb){return _0x4aecdb[_0xeb47('0x27')](_0x30a819)[_0xeb47('0x28')](function(_0x3f5d0a){return _0x3f5d0a;});}return null;};}function removeEntity(_0x2984a2,_0x48a5e6){return function(_0xc3e05){if(_0xc3e05){return _0xc3e05[_0xeb47('0x29')]()['then'](function(){_0x2984a2[_0xeb47('0x1d')](0xcc)[_0xeb47('0x1e')]();});}};}function handleEntityNotFound(_0x97d451,_0x19436a){return function(_0x1bbc87){if(!_0x1bbc87){_0x97d451[_0xeb47('0x1c')](0x194);}return _0x1bbc87;};}function handleError(_0x105a1e,_0x222258){_0x222258=_0x222258||0x1f4;return function(_0x2183ae){logger['error'](_0x2183ae[_0xeb47('0x2a')]);if(_0x2183ae[_0xeb47('0x2b')]){delete _0x2183ae[_0xeb47('0x2b')];}_0x105a1e[_0xeb47('0x1d')](_0x222258)[_0xeb47('0x2c')](_0x2183ae);};}exports[_0xeb47('0x2d')]=function(_0x949af,_0x23bb8f){var _0x3540c9={},_0x2cb46e={},_0x54e97a={'count':0x0,'rows':[]};var _0x4b8ed6=_['map'](db['ChatInternalMessage'][_0xeb47('0x2e')],function(_0x1e4417){return{'name':_0x1e4417['fieldName'],'type':_0x1e4417[_0xeb47('0x2f')][_0xeb47('0x30')]};});_0x2cb46e[_0xeb47('0x31')]=_[_0xeb47('0x32')](_0x4b8ed6,_0xeb47('0x2b'));_0x2cb46e[_0xeb47('0x33')]=_['keys'](_0x949af['query']);_0x2cb46e['filters']=_['intersection'](_0x2cb46e[_0xeb47('0x31')],_0x2cb46e[_0xeb47('0x33')]);_0x3540c9[_0xeb47('0x34')]=_[_0xeb47('0x35')](_0x2cb46e[_0xeb47('0x31')],qs[_0xeb47('0x36')](_0x949af[_0xeb47('0x33')][_0xeb47('0x36')]));_0x3540c9[_0xeb47('0x34')]=_0x3540c9[_0xeb47('0x34')][_0xeb47('0x37')]?_0x3540c9[_0xeb47('0x34')]:_0x2cb46e[_0xeb47('0x31')];if(!_0x949af['query'][_0xeb47('0x38')](_0xeb47('0x39'))){_0x3540c9['limit']=qs[_0xeb47('0x20')](_0x949af[_0xeb47('0x33')]['limit']);_0x3540c9['offset']=qs['offset'](_0x949af[_0xeb47('0x33')][_0xeb47('0x1f')]);}_0x3540c9[_0xeb47('0x3a')]=qs[_0xeb47('0x3b')](_0x949af[_0xeb47('0x33')][_0xeb47('0x3b')]);_0x3540c9[_0xeb47('0x3c')]=qs[_0xeb47('0x3d')](_[_0xeb47('0x3e')](_0x949af['query'],_0x2cb46e[_0xeb47('0x3d')]),_0x4b8ed6);if(_0x949af['query']['filter']){_0x3540c9[_0xeb47('0x3c')]=_[_0xeb47('0x3f')](_0x3540c9[_0xeb47('0x3c')],{'$or':_[_0xeb47('0x32')](_0x4b8ed6,function(_0x5bbff2){if(_0x5bbff2[_0xeb47('0x2f')]!==_0xeb47('0x40')){var _0x115610={};_0x115610[_0x5bbff2[_0xeb47('0x2b')]]={'$like':'%'+_0x949af[_0xeb47('0x33')][_0xeb47('0x41')]+'%'};return _0x115610;}})});}_0x3540c9=_[_0xeb47('0x3f')]({},_0x3540c9,_0x949af['options']);var _0x110d03={'where':_0x3540c9[_0xeb47('0x3c')]};return db['ChatInternalMessage']['count'](_0x110d03)[_0xeb47('0x28')](function(_0x30b0da){_0x54e97a[_0xeb47('0x22')]=_0x30b0da;if(_0x949af[_0xeb47('0x33')]['includeAll']){_0x3540c9[_0xeb47('0x42')]=[{'all':!![]}];}return db[_0xeb47('0x43')][_0xeb47('0x44')](_0x3540c9);})[_0xeb47('0x28')](function(_0x3ccdb5){_0x54e97a[_0xeb47('0x45')]=_0x3ccdb5;return _0x54e97a;})[_0xeb47('0x28')](respondWithFilteredResult(_0x23bb8f,_0x3540c9))[_0xeb47('0x46')](handleError(_0x23bb8f,null));};exports[_0xeb47('0x47')]=function(_0x4221e3,_0x3f056b){var _0x127f60={'raw':!![],'where':{'id':_0x4221e3[_0xeb47('0x48')]['id']}},_0x49bd43={};_0x49bd43[_0xeb47('0x31')]=_[_0xeb47('0x49')](db[_0xeb47('0x43')][_0xeb47('0x2e')]);_0x49bd43[_0xeb47('0x33')]=_[_0xeb47('0x49')](_0x4221e3[_0xeb47('0x33')]);_0x49bd43[_0xeb47('0x3d')]=_[_0xeb47('0x35')](_0x49bd43['model'],_0x49bd43[_0xeb47('0x33')]);_0x127f60[_0xeb47('0x34')]=_[_0xeb47('0x35')](_0x49bd43['model'],qs[_0xeb47('0x36')](_0x4221e3[_0xeb47('0x33')][_0xeb47('0x36')]));_0x127f60[_0xeb47('0x34')]=_0x127f60[_0xeb47('0x34')][_0xeb47('0x37')]?_0x127f60[_0xeb47('0x34')]:_0x49bd43[_0xeb47('0x31')];if(_0x4221e3['query'][_0xeb47('0x4a')]){_0x127f60[_0xeb47('0x42')]=[{'all':!![]}];}_0x127f60=_[_0xeb47('0x3f')]({},_0x127f60,_0x4221e3[_0xeb47('0x4b')]);return db['ChatInternalMessage'][_0xeb47('0x4c')](_0x127f60)[_0xeb47('0x28')](handleEntityNotFound(_0x3f056b,null))[_0xeb47('0x28')](respondWithResult(_0x3f056b,null))[_0xeb47('0x46')](handleError(_0x3f056b,null));};exports[_0xeb47('0x4d')]=function(_0x3213d1,_0x1894b8){return db[_0xeb47('0x43')]['create'](_0x3213d1[_0xeb47('0x4e')],{})[_0xeb47('0x28')](respondWithResult(_0x1894b8,0xc9))['catch'](handleError(_0x1894b8,null));};exports[_0xeb47('0x27')]=function(_0x3c11f7,_0x168749){if(_0x3c11f7[_0xeb47('0x4e')]['id']){delete _0x3c11f7[_0xeb47('0x4e')]['id'];}return db[_0xeb47('0x43')][_0xeb47('0x4c')]({'where':{'id':_0x3c11f7[_0xeb47('0x48')]['id']}})[_0xeb47('0x28')](handleEntityNotFound(_0x168749,null))[_0xeb47('0x28')](saveUpdates(_0x3c11f7[_0xeb47('0x4e')],null))[_0xeb47('0x28')](respondWithResult(_0x168749,null))[_0xeb47('0x46')](handleError(_0x168749,null));};exports['destroy']=function(_0x2c8922,_0x4252be){return db[_0xeb47('0x43')][_0xeb47('0x4c')]({'where':{'id':_0x2c8922[_0xeb47('0x48')]['id']}})[_0xeb47('0x28')](handleEntityNotFound(_0x4252be,null))[_0xeb47('0x28')](removeEntity(_0x4252be,null))['catch'](handleError(_0x4252be,null));};exports[_0xeb47('0x4f')]=function(_0x4444f6,_0x42c241){return db[_0xeb47('0x43')][_0xeb47('0x4f')]()[_0xeb47('0x28')](respondWithResult(_0x42c241,null))['catch'](handleError(_0x42c241,null));};function wrapUser(_0x338515){return function(_0x1c5385){var _0x15506a=_0x338515['get']({'plain':!![]});_0x15506a['messages']=[];if(_0x1c5385){_0x15506a['lastMessageAt']=_0x1c5385[_0xeb47('0x50')];_0x15506a[_0xeb47('0x51')]=_0x1c5385;}else{_0x15506a['lastMessageAt']=moment(0x0)[_0xeb47('0x52')](_0xeb47('0x53'));_0x15506a[_0xeb47('0x51')]={};}return _0x15506a;};}exports[_0xeb47('0x54')]=function(_0x17fa8f,_0x325f06,_0xf6066){var _0x6005fe=[];return db['User'][_0xeb47('0x44')]({'where':{'role':[_0xeb47('0x55'),_0xeb47('0x56'),_0xeb47('0x57')]},'attributes':['id',_0xeb47('0x58'),'name','role',_0xeb47('0x59'),_0xeb47('0x5a'),_0xeb47('0x5b'),'lastLoginAt',_0xeb47('0x5c'),_0xeb47('0x5d')],'order':qs[_0xeb47('0x3b')](_0xeb47('0x5e')),'include':[{'model':db['VoiceQueue'],'as':_0xeb47('0x5f'),'attributes':['id',_0xeb47('0x2b'),_0xeb47('0x2f')],'through':{'attributes':[]}}]})[_0xeb47('0x28')](function(_0xa139ab){if(_0xa139ab){var _0x3e16f8=_0x17fa8f[_0xeb47('0x57')]['get']({'plain':!![]});if(!_0x3e16f8)throw new Error(_0xeb47('0x60'));if(_0x3e16f8[_0xeb47('0x61')]===_0xeb47('0x57')){return db[_0xeb47('0x62')][_0xeb47('0x4c')]({'where':{'name':_0xeb47('0x63'),'userProfileId':_0x3e16f8[_0xeb47('0x64')]},'raw':!![]})[_0xeb47('0x28')](function(_0x4e0ad6){if(_0x4e0ad6){if(_0x4e0ad6[_0xeb47('0x65')]===0x0){return db['UserProfileResource'][_0xeb47('0x44')]({'where':{'sectionId':_0x4e0ad6['id']},'raw':!![]})['then'](function(_0x5a2b25){var _0x2a03dd=[];if(_[_0xeb47('0x66')](_0x5a2b25)){_0x2a03dd=_[_0xeb47('0x41')](_0xa139ab,function(_0x6068e3){if(_0x6068e3['role']!==_0xeb47('0x55')){return _0x6068e3;}});return _0x2a03dd;}else{for(var _0x5ed7a9=0x0;_0x5ed7a9<_0xa139ab['length'];_0x5ed7a9++){var _0x3ae34d=_0xa139ab[_0x5ed7a9];if(_0x3ae34d[_0xeb47('0x61')]===_0xeb47('0x55')){var _0x450d60=_[_0xeb47('0x4c')](_0x5a2b25,function(_0x46a2eb){return _0x46a2eb['resourceId']===_0x3ae34d['id'];});if(_0x450d60)_0x2a03dd[_0xeb47('0x67')](_0x3ae34d);}else{_0x2a03dd['push'](_0x3ae34d);}}return _0x2a03dd;}});}else{return _0xa139ab;}}else{var _0x9e6d24=_[_0xeb47('0x41')](_0xa139ab,function(_0x1a54f5){if(_0x1a54f5['role']!=='agent'){return _0x1a54f5;}});return _0x9e6d24;}});}else{return _0xa139ab;}}})[_0xeb47('0x28')](function(_0xab0246){var _0x3adedc=[];if(_0xab0246){_0x6005fe=_0xab0246;for(var _0x4a6664=0x0;_0x4a6664<_0xab0246[_0xeb47('0x37')];_0x4a6664+=0x1){_0x6005fe[_0x4a6664][_0xeb47('0x68')]=[];_0x3adedc['push'](db[_0xeb47('0x43')][_0xeb47('0x4c')]({'where':{'FromId':[_0x17fa8f[_0xeb47('0x57')]['id'],_0xab0246[_0x4a6664]['id']],'ToId':[_0x17fa8f[_0xeb47('0x57')]['id'],_0xab0246[_0x4a6664]['id']],'ChatGroupId':null},'attributes':['id','createdAt',_0xeb47('0x69'),_0xeb47('0x6a'),_0xeb47('0x6b'),_0xeb47('0x4e')],'order':qs[_0xeb47('0x3b')](_0xeb47('0x6c')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0xab0246[_0x4a6664])));}return BPromise['all'](_0x3adedc);}return[];})[_0xeb47('0x28')](function(_0x299423){return{'rows':_0x299423,'count':_0x299423['length']};})[_0xeb47('0x28')](respondWithResult(_0x325f06,null))[_0xeb47('0x46')](handleError(_0x325f06,null));}; \ No newline at end of file +var _0x5e0f=['sort','where','filters','filter','merge','VIRTUAL','options','ChatInternalMessage','includeAll','include','findAll','rows','show','params','intersection','find','create','body','catch','describe','get','messages','lastMessageAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','admin','user','fullname','role','userpic','internal','online','allowmessenger','showWebBar','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','agent','resourceId','push','FromId','ToId','read','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./chatInternalMessage.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x384231,_0x50be41){var _0x2480bf=function(_0x1c4838){while(--_0x1c4838){_0x384231['push'](_0x384231['shift']());}};_0x2480bf(++_0x50be41);}(_0x5e0f,0x1f3));var _0xf5e0=function(_0x2bb428,_0xa4668d){_0x2bb428=_0x2bb428-0x0;var _0xb72625=_0x5e0f[_0x2bb428];return _0xb72625;};'use strict';var emlformat=require(_0xf5e0('0x0'));var rimraf=require(_0xf5e0('0x1'));var zipdir=require(_0xf5e0('0x2'));var jsonpatch=require(_0xf5e0('0x3'));var rp=require(_0xf5e0('0x4'));var moment=require(_0xf5e0('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf5e0('0x6'));var util=require('util');var path=require(_0xf5e0('0x7'));var sox=require(_0xf5e0('0x8'));var csv=require(_0xf5e0('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf5e0('0xa'));var _=require('lodash');var squel=require(_0xf5e0('0xb'));var crypto=require(_0xf5e0('0xc'));var jsforce=require(_0xf5e0('0xd'));var deskjs=require(_0xf5e0('0xe'));var toCsv=require(_0xf5e0('0x9'));var querystring=require(_0xf5e0('0xf'));var Papa=require(_0xf5e0('0x10'));var Redis=require('ioredis');var authService=require(_0xf5e0('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf5e0('0x12'));var logger=require(_0xf5e0('0x13'))(_0xf5e0('0x14'));var utils=require('../../config/utils');var config=require(_0xf5e0('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xf5e0('0x16'))['db'];config[_0xf5e0('0x17')]=_[_0xf5e0('0x18')](config[_0xf5e0('0x17')],{'host':_0xf5e0('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf5e0('0x17')]));require(_0xf5e0('0x1a'))[_0xf5e0('0x1b')](socket);function respondWithStatusCode(_0x1a6095,_0x198b44){_0x198b44=_0x198b44||0xcc;return function(_0x422d83){if(_0x422d83){return _0x1a6095[_0xf5e0('0x1c')](_0x198b44);}return _0x1a6095[_0xf5e0('0x1d')](_0x198b44)[_0xf5e0('0x1e')]();};}function respondWithResult(_0x1e8299,_0x40e6f4){_0x40e6f4=_0x40e6f4||0xc8;return function(_0x237281){if(_0x237281){return _0x1e8299[_0xf5e0('0x1d')](_0x40e6f4)[_0xf5e0('0x1f')](_0x237281);}};}function respondWithFilteredResult(_0x5aea67,_0x2b93e9){return function(_0xf70b2a){if(_0xf70b2a){var _0x4b5ae8=typeof _0x2b93e9[_0xf5e0('0x20')]==='undefined'&&typeof _0x2b93e9[_0xf5e0('0x21')]===_0xf5e0('0x22');var _0x4d6ad6=_0xf70b2a[_0xf5e0('0x23')];var _0x22c1cf=_0x4b5ae8?0x0:_0x2b93e9[_0xf5e0('0x20')];var _0x2bbf07=_0x4b5ae8?_0xf70b2a[_0xf5e0('0x23')]:_0x2b93e9[_0xf5e0('0x20')]+_0x2b93e9[_0xf5e0('0x21')];var _0x12a12b;if(_0x2bbf07>=_0x4d6ad6){_0x2bbf07=_0x4d6ad6;_0x12a12b=0xc8;}else{_0x12a12b=0xce;}_0x5aea67['status'](_0x12a12b);return _0x5aea67[_0xf5e0('0x24')](_0xf5e0('0x25'),_0x22c1cf+'-'+_0x2bbf07+'/'+_0x4d6ad6)['json'](_0xf70b2a);}return null;};}function patchUpdates(_0x4b5d67){return function(_0x3cf41a){try{jsonpatch[_0xf5e0('0x26')](_0x3cf41a,_0x4b5d67,!![]);}catch(_0x51c91a){return BPromise[_0xf5e0('0x27')](_0x51c91a);}return _0x3cf41a[_0xf5e0('0x28')]();};}function saveUpdates(_0x470efe,_0x49c504){return function(_0x24f8b7){if(_0x24f8b7){return _0x24f8b7[_0xf5e0('0x29')](_0x470efe)[_0xf5e0('0x2a')](function(_0x4aeba0){return _0x4aeba0;});}return null;};}function removeEntity(_0x53cc2b,_0x11dca9){return function(_0x21b3b1){if(_0x21b3b1){return _0x21b3b1[_0xf5e0('0x2b')]()[_0xf5e0('0x2a')](function(){_0x53cc2b[_0xf5e0('0x1d')](0xcc)[_0xf5e0('0x1e')]();});}};}function handleEntityNotFound(_0x283ad2,_0xf0f953){return function(_0x2fa981){if(!_0x2fa981){_0x283ad2[_0xf5e0('0x1c')](0x194);}return _0x2fa981;};}function handleError(_0x61281a,_0xbd8309){_0xbd8309=_0xbd8309||0x1f4;return function(_0x4d9974){logger[_0xf5e0('0x2c')](_0x4d9974[_0xf5e0('0x2d')]);if(_0x4d9974[_0xf5e0('0x2e')]){delete _0x4d9974[_0xf5e0('0x2e')];}_0x61281a[_0xf5e0('0x1d')](_0xbd8309)[_0xf5e0('0x2f')](_0x4d9974);};}exports[_0xf5e0('0x30')]=function(_0x3faed1,_0x3e83cc){var _0x4c443b={},_0x444af2={},_0x110d4e={'count':0x0,'rows':[]};var _0x2d7b8d=_[_0xf5e0('0x31')](db['ChatInternalMessage'][_0xf5e0('0x32')],function(_0x4bc063){return{'name':_0x4bc063[_0xf5e0('0x33')],'type':_0x4bc063[_0xf5e0('0x34')]['key']};});_0x444af2[_0xf5e0('0x35')]=_['map'](_0x2d7b8d,'name');_0x444af2[_0xf5e0('0x36')]=_[_0xf5e0('0x37')](_0x3faed1[_0xf5e0('0x36')]);_0x444af2['filters']=_['intersection'](_0x444af2['model'],_0x444af2[_0xf5e0('0x36')]);_0x4c443b[_0xf5e0('0x38')]=_['intersection'](_0x444af2['model'],qs[_0xf5e0('0x39')](_0x3faed1[_0xf5e0('0x36')][_0xf5e0('0x39')]));_0x4c443b[_0xf5e0('0x38')]=_0x4c443b[_0xf5e0('0x38')][_0xf5e0('0x3a')]?_0x4c443b[_0xf5e0('0x38')]:_0x444af2[_0xf5e0('0x35')];if(!_0x3faed1[_0xf5e0('0x36')][_0xf5e0('0x3b')](_0xf5e0('0x3c'))){_0x4c443b[_0xf5e0('0x21')]=qs[_0xf5e0('0x21')](_0x3faed1[_0xf5e0('0x36')]['limit']);_0x4c443b[_0xf5e0('0x20')]=qs[_0xf5e0('0x20')](_0x3faed1[_0xf5e0('0x36')][_0xf5e0('0x20')]);}_0x4c443b['order']=qs[_0xf5e0('0x3d')](_0x3faed1[_0xf5e0('0x36')][_0xf5e0('0x3d')]);_0x4c443b[_0xf5e0('0x3e')]=qs[_0xf5e0('0x3f')](_['pick'](_0x3faed1[_0xf5e0('0x36')],_0x444af2['filters']),_0x2d7b8d);if(_0x3faed1[_0xf5e0('0x36')][_0xf5e0('0x40')]){_0x4c443b['where']=_[_0xf5e0('0x41')](_0x4c443b['where'],{'$or':_[_0xf5e0('0x31')](_0x2d7b8d,function(_0x1d6116){if(_0x1d6116[_0xf5e0('0x34')]!==_0xf5e0('0x42')){var _0x21697b={};_0x21697b[_0x1d6116['name']]={'$like':'%'+_0x3faed1[_0xf5e0('0x36')][_0xf5e0('0x40')]+'%'};return _0x21697b;}})});}_0x4c443b=_[_0xf5e0('0x41')]({},_0x4c443b,_0x3faed1[_0xf5e0('0x43')]);var _0x5df3aa={'where':_0x4c443b[_0xf5e0('0x3e')]};return db[_0xf5e0('0x44')][_0xf5e0('0x23')](_0x5df3aa)[_0xf5e0('0x2a')](function(_0x2dbd6b){_0x110d4e[_0xf5e0('0x23')]=_0x2dbd6b;if(_0x3faed1['query'][_0xf5e0('0x45')]){_0x4c443b[_0xf5e0('0x46')]=[{'all':!![]}];}return db[_0xf5e0('0x44')][_0xf5e0('0x47')](_0x4c443b);})[_0xf5e0('0x2a')](function(_0xfc8977){_0x110d4e[_0xf5e0('0x48')]=_0xfc8977;return _0x110d4e;})[_0xf5e0('0x2a')](respondWithFilteredResult(_0x3e83cc,_0x4c443b))['catch'](handleError(_0x3e83cc,null));};exports[_0xf5e0('0x49')]=function(_0x461b15,_0x2c1af0){var _0x46fe04={'raw':!![],'where':{'id':_0x461b15[_0xf5e0('0x4a')]['id']}},_0x61d1e7={};_0x61d1e7[_0xf5e0('0x35')]=_['keys'](db[_0xf5e0('0x44')][_0xf5e0('0x32')]);_0x61d1e7[_0xf5e0('0x36')]=_[_0xf5e0('0x37')](_0x461b15['query']);_0x61d1e7[_0xf5e0('0x3f')]=_[_0xf5e0('0x4b')](_0x61d1e7[_0xf5e0('0x35')],_0x61d1e7['query']);_0x46fe04[_0xf5e0('0x38')]=_[_0xf5e0('0x4b')](_0x61d1e7[_0xf5e0('0x35')],qs['fields'](_0x461b15['query'][_0xf5e0('0x39')]));_0x46fe04[_0xf5e0('0x38')]=_0x46fe04['attributes']['length']?_0x46fe04[_0xf5e0('0x38')]:_0x61d1e7['model'];if(_0x461b15['query'][_0xf5e0('0x45')]){_0x46fe04[_0xf5e0('0x46')]=[{'all':!![]}];}_0x46fe04=_[_0xf5e0('0x41')]({},_0x46fe04,_0x461b15[_0xf5e0('0x43')]);return db[_0xf5e0('0x44')][_0xf5e0('0x4c')](_0x46fe04)['then'](handleEntityNotFound(_0x2c1af0,null))[_0xf5e0('0x2a')](respondWithResult(_0x2c1af0,null))['catch'](handleError(_0x2c1af0,null));};exports[_0xf5e0('0x4d')]=function(_0x3245c8,_0x2056c3){return db['ChatInternalMessage'][_0xf5e0('0x4d')](_0x3245c8[_0xf5e0('0x4e')],{})['then'](respondWithResult(_0x2056c3,0xc9))[_0xf5e0('0x4f')](handleError(_0x2056c3,null));};exports[_0xf5e0('0x29')]=function(_0x517229,_0x5bbdd1){if(_0x517229[_0xf5e0('0x4e')]['id']){delete _0x517229['body']['id'];}return db[_0xf5e0('0x44')][_0xf5e0('0x4c')]({'where':{'id':_0x517229[_0xf5e0('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5bbdd1,null))['then'](saveUpdates(_0x517229[_0xf5e0('0x4e')],null))['then'](respondWithResult(_0x5bbdd1,null))[_0xf5e0('0x4f')](handleError(_0x5bbdd1,null));};exports[_0xf5e0('0x2b')]=function(_0x45afde,_0x121fe6){return db[_0xf5e0('0x44')][_0xf5e0('0x4c')]({'where':{'id':_0x45afde['params']['id']}})[_0xf5e0('0x2a')](handleEntityNotFound(_0x121fe6,null))[_0xf5e0('0x2a')](removeEntity(_0x121fe6,null))['catch'](handleError(_0x121fe6,null));};exports[_0xf5e0('0x50')]=function(_0x589c80,_0xe875ac){return db['ChatInternalMessage'][_0xf5e0('0x50')]()[_0xf5e0('0x2a')](respondWithResult(_0xe875ac,null))[_0xf5e0('0x4f')](handleError(_0xe875ac,null));};function wrapUser(_0x4621bd){return function(_0x32d9ba){var _0x42b8e4=_0x4621bd[_0xf5e0('0x51')]({'plain':!![]});_0x42b8e4[_0xf5e0('0x52')]=[];if(_0x32d9ba){_0x42b8e4[_0xf5e0('0x53')]=_0x32d9ba['createdAt'];_0x42b8e4[_0xf5e0('0x54')]=_0x32d9ba;}else{_0x42b8e4[_0xf5e0('0x53')]=moment(0x0)[_0xf5e0('0x55')](_0xf5e0('0x56'));_0x42b8e4['lastMessage']={};}return _0x42b8e4;};}exports[_0xf5e0('0x57')]=function(_0x5cd3c6,_0x130cdd,_0x9fa3d1){var _0x7ca218=[];return db[_0xf5e0('0x58')]['findAll']({'where':{'role':['agent',_0xf5e0('0x59'),_0xf5e0('0x5a')]},'attributes':['id',_0xf5e0('0x5b'),'name',_0xf5e0('0x5c'),_0xf5e0('0x5d'),_0xf5e0('0x5e'),_0xf5e0('0x5f'),'lastLoginAt',_0xf5e0('0x60'),_0xf5e0('0x61')],'order':qs[_0xf5e0('0x3d')]('-online'),'include':[{'model':db[_0xf5e0('0x62')],'as':_0xf5e0('0x63'),'attributes':['id',_0xf5e0('0x2e'),_0xf5e0('0x34')],'through':{'attributes':[]}}]})[_0xf5e0('0x2a')](function(_0x5bb63f){if(_0x5bb63f){var _0x20df2a=_0x5cd3c6[_0xf5e0('0x5a')][_0xf5e0('0x51')]({'plain':!![]});if(!_0x20df2a)throw new Error(_0xf5e0('0x64'));if(_0x20df2a[_0xf5e0('0x5c')]==='user'){return db[_0xf5e0('0x65')][_0xf5e0('0x4c')]({'where':{'name':_0xf5e0('0x66'),'userProfileId':_0x20df2a[_0xf5e0('0x67')]},'raw':!![]})[_0xf5e0('0x2a')](function(_0x436537){if(_0x436537){if(_0x436537[_0xf5e0('0x68')]===0x0){return db[_0xf5e0('0x69')][_0xf5e0('0x47')]({'where':{'sectionId':_0x436537['id']},'raw':!![]})[_0xf5e0('0x2a')](function(_0xaa9cf9){var _0x23b10e=[];if(_['isEmpty'](_0xaa9cf9)){_0x23b10e=_['filter'](_0x5bb63f,function(_0x289a26){if(_0x289a26[_0xf5e0('0x5c')]!==_0xf5e0('0x6a')){return _0x289a26;}});return _0x23b10e;}else{for(var _0x101d60=0x0;_0x101d60<_0x5bb63f[_0xf5e0('0x3a')];_0x101d60++){var _0x7fe8c9=_0x5bb63f[_0x101d60];if(_0x7fe8c9['role']===_0xf5e0('0x6a')){var _0x394922=_[_0xf5e0('0x4c')](_0xaa9cf9,function(_0x3d67c6){return _0x3d67c6[_0xf5e0('0x6b')]===_0x7fe8c9['id'];});if(_0x394922)_0x23b10e['push'](_0x7fe8c9);}else{_0x23b10e[_0xf5e0('0x6c')](_0x7fe8c9);}}return _0x23b10e;}});}else{return _0x5bb63f;}}else{var _0x25341e=_[_0xf5e0('0x40')](_0x5bb63f,function(_0x3308ba){if(_0x3308ba[_0xf5e0('0x5c')]!==_0xf5e0('0x6a')){return _0x3308ba;}});return _0x25341e;}});}else{return _0x5bb63f;}}})[_0xf5e0('0x2a')](function(_0x1091fc){var _0x3f41bc=[];if(_0x1091fc){_0x7ca218=_0x1091fc;for(var _0x165ee6=0x0;_0x165ee6<_0x1091fc[_0xf5e0('0x3a')];_0x165ee6+=0x1){_0x7ca218[_0x165ee6][_0xf5e0('0x52')]=[];_0x3f41bc[_0xf5e0('0x6c')](db[_0xf5e0('0x44')][_0xf5e0('0x4c')]({'where':{'FromId':[_0x5cd3c6['user']['id'],_0x1091fc[_0x165ee6]['id']],'ToId':[_0x5cd3c6[_0xf5e0('0x5a')]['id'],_0x1091fc[_0x165ee6]['id']],'ChatGroupId':null},'attributes':['id','createdAt',_0xf5e0('0x6d'),_0xf5e0('0x6e'),_0xf5e0('0x6f'),_0xf5e0('0x4e')],'order':qs[_0xf5e0('0x3d')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0xf5e0('0x2a')](wrapUser(_0x1091fc[_0x165ee6])));}return BPromise['all'](_0x3f41bc);}return[];})['then'](function(_0x4e51ab){return{'rows':_0x4e51ab,'count':_0x4e51ab[_0xf5e0('0x3a')]};})[_0xf5e0('0x2a')](respondWithResult(_0x130cdd,null))[_0xf5e0('0x4f')](handleError(_0x130cdd,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 12ab840..5a57aca 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 _0x8079=['emit','events','../../mysqldb','ChatInternalMessage','setMaxListeners','update','remove'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0x8079,0x1e4));var _0x9807=function(_0x19b84f,_0x48765e){_0x19b84f=_0x19b84f-0x0;var _0x18067b=_0x8079[_0x19b84f];return _0x18067b;};'use strict';var EventEmitter=require(_0x9807('0x0'));var ChatInternalMessage=require(_0x9807('0x1'))['db'][_0x9807('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x9807('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9807('0x4'),'afterDestroy':_0x9807('0x5')};function emitEvent(_0x44637a){return function(_0x388292,_0x3f405d,_0x1ddd20){ChatInternalMessageEvents[_0x9807('0x6')](_0x44637a+':'+_0x388292['id'],_0x388292);ChatInternalMessageEvents[_0x9807('0x6')](_0x44637a,_0x388292);_0x1ddd20(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file +var _0x5e36=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x55d040,_0xe989f4){var _0x442c89=function(_0x778f7){while(--_0x778f7){_0x55d040['push'](_0x55d040['shift']());}};_0x442c89(++_0xe989f4);}(_0x5e36,0xc8));var _0x65e3=function(_0x54e6e4,_0x537f82){_0x54e6e4=_0x54e6e4-0x0;var _0x1eaeef=_0x5e36[_0x54e6e4];return _0x1eaeef;};'use strict';var EventEmitter=require(_0x65e3('0x0'));var ChatInternalMessage=require(_0x65e3('0x1'))['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x65e3('0x2')](0x0);var events={'afterCreate':_0x65e3('0x3'),'afterUpdate':_0x65e3('0x4'),'afterDestroy':_0x65e3('0x5')};function emitEvent(_0x2e5411){return function(_0x12aad3,_0x795b2d,_0x431a4f){ChatInternalMessageEvents[_0x65e3('0x6')](_0x2e5411+':'+_0x12aad3['id'],_0x12aad3);ChatInternalMessageEvents['emit'](_0x2e5411,_0x12aad3);_0x431a4f(null);};}for(var e in events){if(events[_0x65e3('0x7')](e)){var event=events[e];ChatInternalMessage[_0x65e3('0x8')](e,emitEvent(event));}}module[_0x65e3('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 db30f77..98b3c60 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 _0x26ae=['define','ChatInternalMessage','utf8mb4','utf8mb4_unicode_ci','../../config/logger','moment','bluebird','path','../../config/environment','exports'];(function(_0x102376,_0x16c6a2){var _0x29bc9c=function(_0x5fe5b1){while(--_0x5fe5b1){_0x102376['push'](_0x102376['shift']());}};_0x29bc9c(++_0x16c6a2);}(_0x26ae,0x16c));var _0xe26a=function(_0x574afd,_0x113fd0){_0x574afd=_0x574afd-0x0;var _0x50fdef=_0x26ae[_0x574afd];return _0x50fdef;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe26a('0x0'))('api');var moment=require(_0xe26a('0x1'));var BPromise=require(_0xe26a('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe26a('0x3'));var rimraf=require('rimraf');var config=require(_0xe26a('0x4'));var attributes=require('./chatInternalMessage.attributes');module[_0xe26a('0x5')]=function(_0xee6f66,_0x382efb){return _0xee6f66[_0xe26a('0x6')](_0xe26a('0x7'),attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe26a('0x8'),'collate':_0xe26a('0x9')});}; \ No newline at end of file +var _0x6347=['moment','bluebird','path','rimraf','../../config/environment','./chatInternalMessage.attributes','exports','define','chat_internal_messages','utf8mb4','lodash','util','../../config/logger','api'];(function(_0x5b908d,_0x2a3602){var _0x369f1f=function(_0xc4273c){while(--_0xc4273c){_0x5b908d['push'](_0x5b908d['shift']());}};_0x369f1f(++_0x2a3602);}(_0x6347,0x1f4));var _0x7634=function(_0x7202ae,_0x24c776){_0x7202ae=_0x7202ae-0x0;var _0x2c4924=_0x6347[_0x7202ae];return _0x2c4924;};'use strict';var _=require(_0x7634('0x0'));var util=require(_0x7634('0x1'));var logger=require(_0x7634('0x2'))(_0x7634('0x3'));var moment=require(_0x7634('0x4'));var BPromise=require(_0x7634('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7634('0x6'));var rimraf=require(_0x7634('0x7'));var config=require(_0x7634('0x8'));var attributes=require(_0x7634('0x9'));module[_0x7634('0xa')]=function(_0x5b26bc,_0x25bc12){return _0x5b26bc[_0x7634('0xb')]('ChatInternalMessage',attributes,{'tableName':_0x7634('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7634('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 927d63c..2b932f2 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 _0x5262=['rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','error','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0x5262,0xc2));var _0x2526=function(_0x5e1d41,_0x40504e){_0x5e1d41=_0x5e1d41-0x0;var _0x199894=_0x5262[_0x5e1d41];return _0x199894;};'use strict';var _=require(_0x2526('0x0'));var util=require(_0x2526('0x1'));var moment=require(_0x2526('0x2'));var BPromise=require(_0x2526('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2526('0x4'));var db=require(_0x2526('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2526('0x6'));var config=require(_0x2526('0x7'));var jayson=require(_0x2526('0x8'));var client=jayson[_0x2526('0x9')]['http']({'port':0x232a});config[_0x2526('0xa')]=_[_0x2526('0xb')](config[_0x2526('0xa')],{'host':_0x2526('0xc'),'port':0x18eb});var socket=require(_0x2526('0xd'))(new Redis(config['redis']));require(_0x2526('0xe'))['register'](socket);function respondWithRpcPromise(_0x4508a4,_0x75b820,_0x38776d){return new BPromise(function(_0x236dff,_0x255c9d){return client[_0x2526('0xf')](_0x4508a4,_0x38776d)[_0x2526('0x10')](function(_0x4884f4){logger[_0x2526('0x11')](_0x2526('0x12'),_0x75b820,_0x2526('0x13'));logger[_0x2526('0x14')](_0x2526('0x15'),_0x75b820,_0x2526('0x13'),JSON['stringify'](_0x4884f4));if(_0x4884f4['error']){if(_0x4884f4['error']['code']===0x1f4){logger[_0x2526('0x16')](_0x2526('0x12'),_0x75b820,_0x4884f4[_0x2526('0x16')][_0x2526('0x17')]);return _0x255c9d(_0x4884f4[_0x2526('0x16')][_0x2526('0x17')]);}logger[_0x2526('0x16')]('ChatInternalMessage,\x20%s,\x20%s',_0x75b820,_0x4884f4['error']['message']);return _0x236dff(_0x4884f4[_0x2526('0x16')][_0x2526('0x17')]);}else{logger[_0x2526('0x11')](_0x2526('0x12'),_0x75b820,_0x2526('0x13'));_0x236dff(_0x4884f4[_0x2526('0x18')][_0x2526('0x17')]);}})['catch'](function(_0x5c4bc3){logger['error'](_0x2526('0x12'),_0x75b820,_0x5c4bc3);_0x255c9d(_0x5c4bc3);});});} \ No newline at end of file +var _0xf3c2=['request','then','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register'];(function(_0xe7c0d9,_0x1fee6c){var _0x279170=function(_0x4e6a9e){while(--_0x4e6a9e){_0xe7c0d9['push'](_0xe7c0d9['shift']());}};_0x279170(++_0x1fee6c);}(_0xf3c2,0x14c));var _0x2f3c=function(_0x555878,_0x225ae8){_0x555878=_0x555878-0x0;var _0x20c8be=_0xf3c2[_0x555878];return _0x20c8be;};'use strict';var _=require(_0x2f3c('0x0'));var util=require('util');var moment=require(_0x2f3c('0x1'));var BPromise=require(_0x2f3c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2f3c('0x3'));var db=require(_0x2f3c('0x4'))['db'];var utils=require(_0x2f3c('0x5'));var logger=require(_0x2f3c('0x6'))(_0x2f3c('0x7'));var config=require(_0x2f3c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x2f3c('0x9')][_0x2f3c('0xa')]({'port':0x232a});config[_0x2f3c('0xb')]=_[_0x2f3c('0xc')](config['redis'],{'host':_0x2f3c('0xd'),'port':0x18eb});var socket=require(_0x2f3c('0xe'))(new Redis(config[_0x2f3c('0xb')]));require('./chatInternalMessage.socket')[_0x2f3c('0xf')](socket);function respondWithRpcPromise(_0x88af22,_0x140ee2,_0x1c6ded){return new BPromise(function(_0x182efe,_0x4e50da){return client[_0x2f3c('0x10')](_0x88af22,_0x1c6ded)[_0x2f3c('0x11')](function(_0x1e19ba){logger['info'](_0x2f3c('0x12'),_0x140ee2,_0x2f3c('0x13'));logger[_0x2f3c('0x14')](_0x2f3c('0x15'),_0x140ee2,_0x2f3c('0x13'),JSON[_0x2f3c('0x16')](_0x1e19ba));if(_0x1e19ba['error']){if(_0x1e19ba[_0x2f3c('0x17')][_0x2f3c('0x18')]===0x1f4){logger[_0x2f3c('0x17')](_0x2f3c('0x12'),_0x140ee2,_0x1e19ba[_0x2f3c('0x17')][_0x2f3c('0x19')]);return _0x4e50da(_0x1e19ba[_0x2f3c('0x17')][_0x2f3c('0x19')]);}logger[_0x2f3c('0x17')](_0x2f3c('0x12'),_0x140ee2,_0x1e19ba[_0x2f3c('0x17')]['message']);return _0x182efe(_0x1e19ba[_0x2f3c('0x17')][_0x2f3c('0x19')]);}else{logger[_0x2f3c('0x1a')](_0x2f3c('0x12'),_0x140ee2,'request\x20sent');_0x182efe(_0x1e19ba[_0x2f3c('0x1b')][_0x2f3c('0x19')]);}})[_0x2f3c('0x1c')](function(_0x2ab205){logger['error'](_0x2f3c('0x12'),_0x140ee2,_0x2ab205);_0x4e50da(_0x2ab205);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 2a4e5b7..30572d5 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 _0x59e7=['removeListener','register','chatInternalMessage:','./chatInternalMessage.events','save','remove','update','emit'];(function(_0x4aba15,_0x4e90aa){var _0x1c8122=function(_0x568dba){while(--_0x568dba){_0x4aba15['push'](_0x4aba15['shift']());}};_0x1c8122(++_0x4e90aa);}(_0x59e7,0x83));var _0x759e=function(_0x568db3,_0x24395d){_0x568db3=_0x568db3-0x0;var _0x58c38b=_0x59e7[_0x568db3];return _0x58c38b;};'use strict';var ChatInternalMessageEvents=require(_0x759e('0x0'));var events=[_0x759e('0x1'),_0x759e('0x2'),_0x759e('0x3')];function createListener(_0x2c40a3,_0x493e43){return function(_0x1fa73e){_0x493e43[_0x759e('0x4')](_0x2c40a3,_0x1fa73e);};}function removeListener(_0x786f48,_0x1b0c1e){return function(){ChatInternalMessageEvents[_0x759e('0x5')](_0x786f48,_0x1b0c1e);};}exports[_0x759e('0x6')]=function(_0x3b64ff){for(var _0x56df42=0x0,_0x3a7aff=events['length'];_0x56df42<_0x3a7aff;_0x56df42++){var _0x15fcef=events[_0x56df42];var _0x1a303a=createListener(_0x759e('0x7')+_0x15fcef,_0x3b64ff);ChatInternalMessageEvents['on'](_0x15fcef,_0x1a303a);}}; \ No newline at end of file +var _0x368e=['removeListener','register','length','./chatInternalMessage.events','save','remove','update'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x368e,0x192));var _0xe368=function(_0x5b2c50,_0x4db66b){_0x5b2c50=_0x5b2c50-0x0;var _0x47f2f9=_0x368e[_0x5b2c50];return _0x47f2f9;};'use strict';var ChatInternalMessageEvents=require(_0xe368('0x0'));var events=[_0xe368('0x1'),_0xe368('0x2'),_0xe368('0x3')];function createListener(_0x42c69f,_0x24c1d0){return function(_0x4c135e){_0x24c1d0['emit'](_0x42c69f,_0x4c135e);};}function removeListener(_0x1e1b1f,_0x310494){return function(){ChatInternalMessageEvents[_0xe368('0x4')](_0x1e1b1f,_0x310494);};}exports[_0xe368('0x5')]=function(_0x2e1eee){for(var _0x146250=0x0,_0x5ad4c7=events[_0xe368('0x6')];_0x146250<_0x5ad4c7;_0x146250++){var _0x1e8af7=events[_0x146250];var _0x4826a5=createListener('chatInternalMessage:'+_0x1e8af7,_0x2e1eee);ChatInternalMessageEvents['on'](_0x1e8af7,_0x4826a5);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 7d3af9c..4359e0f 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 _0xe066=['describe','/users','getUsers','/:id','show','create','put','delete','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','/describe'];(function(_0x61a2a9,_0x3b02ae){var _0x43d36c=function(_0x299541){while(--_0x299541){_0x61a2a9['push'](_0x61a2a9['shift']());}};_0x43d36c(++_0x3b02ae);}(_0xe066,0x1c1));var _0x6e06=function(_0x3b7b42,_0x31badd){_0x3b7b42=_0x3b7b42-0x0;var _0x1ebaad=_0xe066[_0x3b7b42];return _0x1ebaad;};'use strict';var multer=require(_0x6e06('0x0'));var util=require('util');var path=require(_0x6e06('0x1'));var timeout=require('connect-timeout');var express=require(_0x6e06('0x2'));var router=express[_0x6e06('0x3')]();var fs_extra=require(_0x6e06('0x4'));var auth=require(_0x6e06('0x5'));var interaction=require(_0x6e06('0x6'));var config=require(_0x6e06('0x7'));var controller=require(_0x6e06('0x8'));router[_0x6e06('0x9')]('/',auth[_0x6e06('0xa')](),controller[_0x6e06('0xb')]);router[_0x6e06('0x9')](_0x6e06('0xc'),auth[_0x6e06('0xa')](),controller[_0x6e06('0xd')]);router[_0x6e06('0x9')](_0x6e06('0xe'),auth[_0x6e06('0xa')](),controller[_0x6e06('0xf')]);router[_0x6e06('0x9')](_0x6e06('0x10'),auth[_0x6e06('0xa')](),controller[_0x6e06('0x11')]);router['post']('/',auth[_0x6e06('0xa')](),controller[_0x6e06('0x12')]);router[_0x6e06('0x13')](_0x6e06('0x10'),controller['update']);router[_0x6e06('0x14')](_0x6e06('0x10'),auth[_0x6e06('0xa')](),controller['destroy']);module[_0x6e06('0x15')]=router; \ No newline at end of file +var _0x11f3=['/users','show','post','/:id','update','destroy','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','index','isAuthenticated'];(function(_0x3c933e,_0x26c429){var _0x3ad1eb=function(_0x2d9726){while(--_0x2d9726){_0x3c933e['push'](_0x3c933e['shift']());}};_0x3ad1eb(++_0x26c429);}(_0x11f3,0xe3));var _0x311f=function(_0x3c9c05,_0x31f740){_0x3c9c05=_0x3c9c05-0x0;var _0x2f1d51=_0x11f3[_0x3c9c05];return _0x2f1d51;};'use strict';var multer=require('multer');var util=require(_0x311f('0x0'));var path=require(_0x311f('0x1'));var timeout=require(_0x311f('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x311f('0x3'));var auth=require(_0x311f('0x4'));var interaction=require(_0x311f('0x5'));var config=require(_0x311f('0x6'));var controller=require(_0x311f('0x7'));router[_0x311f('0x8')]('/',auth['isAuthenticated'](),controller[_0x311f('0x9')]);router[_0x311f('0x8')]('/describe',auth[_0x311f('0xa')](),controller['describe']);router[_0x311f('0x8')](_0x311f('0xb'),auth[_0x311f('0xa')](),controller['getUsers']);router[_0x311f('0x8')]('/:id',auth[_0x311f('0xa')](),controller[_0x311f('0xc')]);router[_0x311f('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x311f('0xe'),controller[_0x311f('0xf')]);router['delete'](_0x311f('0xe'),auth[_0x311f('0xa')](),controller[_0x311f('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index af2ce6b..d15b919 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 _0xc692=['exports','TEXT','BOOLEAN','ENUM','out','DATE','STRING','sequelize'];(function(_0x40ca0f,_0x3ac979){var _0x25380b=function(_0x1483e9){while(--_0x1483e9){_0x40ca0f['push'](_0x40ca0f['shift']());}};_0x25380b(++_0x3ac979);}(_0xc692,0x15f));var _0x2c69=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0xc692[_0x42245d];return _0x4b211a;};'use strict';var Sequelize=require(_0x2c69('0x0'));module[_0x2c69('0x1')]={'body':{'type':Sequelize[_0x2c69('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x2c69('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x2c69('0x4')]('in',_0x2c69('0x5')),'defaultValue':_0x2c69('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x2c69('0x6')]},'providerName':{'type':Sequelize[_0x2c69('0x7')]},'providerResponse':{'type':Sequelize[_0x2c69('0x2')]}}; \ No newline at end of file +var _0x6ae2=['medium','BOOLEAN','ENUM','out','STRING','sequelize','exports','TEXT'];(function(_0x1a7846,_0x59723e){var _0x48049=function(_0x203ff6){while(--_0x203ff6){_0x1a7846['push'](_0x1a7846['shift']());}};_0x48049(++_0x59723e);}(_0x6ae2,0x1ed));var _0x26ae=function(_0x43a48f,_0x39a89a){_0x43a48f=_0x43a48f-0x0;var _0x19aeba=_0x6ae2[_0x43a48f];return _0x19aeba;};'use strict';var Sequelize=require(_0x26ae('0x0'));module[_0x26ae('0x1')]={'body':{'type':Sequelize[_0x26ae('0x2')](_0x26ae('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x26ae('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x26ae('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x26ae('0x5')]('in',_0x26ae('0x6')),'defaultValue':_0x26ae('0x6'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x26ae('0x7')]},'providerResponse':{'type':Sequelize[_0x26ae('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 4c44d82..d4ad5fb 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 _0xf8c8=['internal','manual','interface','SIP/%s','channel','event','EventManager','formData','chat','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','fullname','email','motionChannel','rejectmessage','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','then','ChatMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','catch','sendStatus','json','offset','undefined','count','limit','Content-Range','reject','destroy','status','stack','name','send','index','map','ChatMessage','rawAttributes','type','key','model','query','intersection','attributes','fields','length','order','sort','where','pick','filters','filter','merge','options','include','show','params','keys','includeAll','find','create','body','update','describe','../../config/logger','chat-interactions','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','ChatInteraction','ChatInteractionId','read1stAt','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','AcceptMessage','acceptMessage','sequelize','Sequelize','QueryTypes','SELECT','contact','User'];(function(_0x337e95,_0x4446a1){var _0x3ad74b=function(_0x2a73b1){while(--_0x2a73b1){_0x337e95['push'](_0x337e95['shift']());}};_0x3ad74b(++_0x4446a1);}(_0xf8c8,0x118));var _0x8f8c=function(_0x16dd60,_0x495245){_0x16dd60=_0x16dd60-0x0;var _0x167e1a=_0xf8c8[_0x16dd60];return _0x167e1a;};'use strict';var emlformat=require(_0x8f8c('0x0'));var rimraf=require(_0x8f8c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8f8c('0x2'));var rp=require(_0x8f8c('0x3'));var moment=require('moment');var BPromise=require(_0x8f8c('0x4'));var Mustache=require('mustache');var util=require(_0x8f8c('0x5'));var path=require(_0x8f8c('0x6'));var sox=require(_0x8f8c('0x7'));var csv=require(_0x8f8c('0x8'));var ejs=require(_0x8f8c('0x9'));var fs=require('fs');var fs_extra=require(_0x8f8c('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8f8c('0xb'));var deskjs=require(_0x8f8c('0xc'));var toCsv=require(_0x8f8c('0x8'));var querystring=require(_0x8f8c('0xd'));var Papa=require(_0x8f8c('0xe'));var Redis=require(_0x8f8c('0xf'));var authService=require(_0x8f8c('0x10'));var qs=require(_0x8f8c('0x11'));var as=require(_0x8f8c('0x12'));var hardwareService=require(_0x8f8c('0x13'));var logger=require('../../config/logger')(_0x8f8c('0x14'));var utils=require(_0x8f8c('0x15'));var config=require(_0x8f8c('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x8f8c('0x17'))['db'];config[_0x8f8c('0x18')]=_[_0x8f8c('0x19')](config[_0x8f8c('0x18')],{'host':_0x8f8c('0x1a'),'port':0x18eb});var socket=require(_0x8f8c('0x1b'))(new Redis(config['redis']));require(_0x8f8c('0x1c'))[_0x8f8c('0x1d')](socket);var jayson=require(_0x8f8c('0x1e'));var client=jayson[_0x8f8c('0x1f')][_0x8f8c('0x20')]({'port':0x232c});var client9002=jayson[_0x8f8c('0x1f')][_0x8f8c('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x2a9d67,_0x5e1c12,_0x34464a,_0x37b405){return new BPromise(function(_0x4d6141,_0x306f43){var _0x2ccb7d=_0x37b405||client;return _0x2ccb7d['request'](_0x2a9d67,_0x34464a)[_0x8f8c('0x21')](function(_0xa11dac){logger['info'](_0x8f8c('0x22'),_0x5e1c12,'request\x20sent');logger[_0x8f8c('0x23')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x5e1c12,_0x8f8c('0x24'),JSON[_0x8f8c('0x25')](_0xa11dac));if(_0xa11dac[_0x8f8c('0x26')]){if(_0xa11dac[_0x8f8c('0x26')][_0x8f8c('0x27')]===0x1f4){logger[_0x8f8c('0x26')](_0x8f8c('0x22'),_0x5e1c12,_0xa11dac[_0x8f8c('0x26')][_0x8f8c('0x28')]);return _0x306f43(_0xa11dac[_0x8f8c('0x26')]['message']);}logger[_0x8f8c('0x26')]('ChatMessage,\x20%s,\x20%s',_0x5e1c12,_0xa11dac[_0x8f8c('0x26')][_0x8f8c('0x28')]);return _0x4d6141(_0xa11dac[_0x8f8c('0x26')][_0x8f8c('0x28')]);}else{logger[_0x8f8c('0x29')](_0x8f8c('0x22'),_0x5e1c12,_0x8f8c('0x24'));_0x4d6141(_0xa11dac[_0x8f8c('0x2a')][_0x8f8c('0x28')]);}})[_0x8f8c('0x2b')](function(_0x1e5684){logger[_0x8f8c('0x26')]('ChatMessage,\x20%s,\x20%s',_0x5e1c12,_0x1e5684);_0x306f43(_0x1e5684);});});}function respondWithStatusCode(_0x380154,_0x557053){_0x557053=_0x557053||0xcc;return function(_0x20d8cc){if(_0x20d8cc){return _0x380154[_0x8f8c('0x2c')](_0x557053);}return _0x380154['status'](_0x557053)['end']();};}function respondWithResult(_0x418868,_0x5a9e8a){_0x5a9e8a=_0x5a9e8a||0xc8;return function(_0x49173d){if(_0x49173d){return _0x418868['status'](_0x5a9e8a)[_0x8f8c('0x2d')](_0x49173d);}};}function respondWithFilteredResult(_0x3542a7,_0x5e5a80){return function(_0x114196){if(_0x114196){var _0x21f96f=typeof _0x5e5a80[_0x8f8c('0x2e')]===_0x8f8c('0x2f')&&typeof _0x5e5a80['limit']==='undefined';var _0x77bee4=_0x114196[_0x8f8c('0x30')];var _0x127bbc=_0x21f96f?0x0:_0x5e5a80[_0x8f8c('0x2e')];var _0x58c24c=_0x21f96f?_0x114196[_0x8f8c('0x30')]:_0x5e5a80[_0x8f8c('0x2e')]+_0x5e5a80[_0x8f8c('0x31')];var _0x49e2aa;if(_0x58c24c>=_0x77bee4){_0x58c24c=_0x77bee4;_0x49e2aa=0xc8;}else{_0x49e2aa=0xce;}_0x3542a7['status'](_0x49e2aa);return _0x3542a7['set'](_0x8f8c('0x32'),_0x127bbc+'-'+_0x58c24c+'/'+_0x77bee4)[_0x8f8c('0x2d')](_0x114196);}return null;};}function patchUpdates(_0x2707b4){return function(_0x23d6c1){try{jsonpatch['apply'](_0x23d6c1,_0x2707b4,!![]);}catch(_0x301b45){return BPromise[_0x8f8c('0x33')](_0x301b45);}return _0x23d6c1['save']();};}function saveUpdates(_0x104d41,_0x590012){return function(_0x321ff6){if(_0x321ff6){return _0x321ff6['update'](_0x104d41)[_0x8f8c('0x21')](function(_0x283e36){return _0x283e36;});}return null;};}function removeEntity(_0x4a8543,_0x2dab9c){return function(_0x1f4fff){if(_0x1f4fff){return _0x1f4fff[_0x8f8c('0x34')]()[_0x8f8c('0x21')](function(){_0x4a8543[_0x8f8c('0x35')](0xcc)['end']();});}};}function handleEntityNotFound(_0x15ff82,_0x30f560){return function(_0x10e0a7){if(!_0x10e0a7){_0x15ff82['sendStatus'](0x194);}return _0x10e0a7;};}function handleError(_0xe88a41,_0x1ba517){_0x1ba517=_0x1ba517||0x1f4;return function(_0x477553){logger['error'](_0x477553[_0x8f8c('0x36')]);if(_0x477553[_0x8f8c('0x37')]){delete _0x477553[_0x8f8c('0x37')];}_0xe88a41['status'](_0x1ba517)[_0x8f8c('0x38')](_0x477553);};}exports[_0x8f8c('0x39')]=function(_0x1b20d2,_0x356f95){var _0x1d2829={},_0x2b05f8={},_0x29929e={'count':0x0,'rows':[]};var _0xdf976e=_[_0x8f8c('0x3a')](db[_0x8f8c('0x3b')][_0x8f8c('0x3c')],function(_0xd22039){return{'name':_0xd22039['fieldName'],'type':_0xd22039[_0x8f8c('0x3d')][_0x8f8c('0x3e')]};});_0x2b05f8[_0x8f8c('0x3f')]=_[_0x8f8c('0x3a')](_0xdf976e,_0x8f8c('0x37'));_0x2b05f8[_0x8f8c('0x40')]=_['keys'](_0x1b20d2[_0x8f8c('0x40')]);_0x2b05f8['filters']=_[_0x8f8c('0x41')](_0x2b05f8[_0x8f8c('0x3f')],_0x2b05f8[_0x8f8c('0x40')]);_0x1d2829[_0x8f8c('0x42')]=_[_0x8f8c('0x41')](_0x2b05f8['model'],qs[_0x8f8c('0x43')](_0x1b20d2[_0x8f8c('0x40')][_0x8f8c('0x43')]));_0x1d2829[_0x8f8c('0x42')]=_0x1d2829['attributes'][_0x8f8c('0x44')]?_0x1d2829['attributes']:_0x2b05f8[_0x8f8c('0x3f')];if(!_0x1b20d2[_0x8f8c('0x40')]['hasOwnProperty']('nolimit')){_0x1d2829[_0x8f8c('0x31')]=qs[_0x8f8c('0x31')](_0x1b20d2[_0x8f8c('0x40')]['limit']);_0x1d2829[_0x8f8c('0x2e')]=qs[_0x8f8c('0x2e')](_0x1b20d2['query'][_0x8f8c('0x2e')]);}_0x1d2829[_0x8f8c('0x45')]=qs[_0x8f8c('0x46')](_0x1b20d2[_0x8f8c('0x40')][_0x8f8c('0x46')]);_0x1d2829[_0x8f8c('0x47')]=qs['filters'](_[_0x8f8c('0x48')](_0x1b20d2[_0x8f8c('0x40')],_0x2b05f8[_0x8f8c('0x49')]),_0xdf976e);if(_0x1b20d2[_0x8f8c('0x40')][_0x8f8c('0x4a')]){_0x1d2829[_0x8f8c('0x47')]=_[_0x8f8c('0x4b')](_0x1d2829[_0x8f8c('0x47')],{'$or':_['map'](_0xdf976e,function(_0x5aff0c){if(_0x5aff0c[_0x8f8c('0x3d')]!=='VIRTUAL'){var _0x5aca4a={};_0x5aca4a[_0x5aff0c[_0x8f8c('0x37')]]={'$like':'%'+_0x1b20d2[_0x8f8c('0x40')][_0x8f8c('0x4a')]+'%'};return _0x5aca4a;}})});}_0x1d2829=_[_0x8f8c('0x4b')]({},_0x1d2829,_0x1b20d2[_0x8f8c('0x4c')]);var _0x52437b={'where':_0x1d2829[_0x8f8c('0x47')]};return db[_0x8f8c('0x3b')][_0x8f8c('0x30')](_0x52437b)[_0x8f8c('0x21')](function(_0x1116ce){_0x29929e[_0x8f8c('0x30')]=_0x1116ce;if(_0x1b20d2[_0x8f8c('0x40')]['includeAll']){_0x1d2829[_0x8f8c('0x4d')]=[{'all':!![]}];}return db[_0x8f8c('0x3b')]['findAll'](_0x1d2829);})[_0x8f8c('0x21')](function(_0x2d4fe0){_0x29929e['rows']=_0x2d4fe0;return _0x29929e;})[_0x8f8c('0x21')](respondWithFilteredResult(_0x356f95,_0x1d2829))['catch'](handleError(_0x356f95,null));};exports[_0x8f8c('0x4e')]=function(_0x276502,_0x2a0c9f){var _0x1193b0={'raw':!![],'where':{'id':_0x276502[_0x8f8c('0x4f')]['id']}},_0x37fc2b={};_0x37fc2b['model']=_[_0x8f8c('0x50')](db['ChatMessage'][_0x8f8c('0x3c')]);_0x37fc2b[_0x8f8c('0x40')]=_['keys'](_0x276502[_0x8f8c('0x40')]);_0x37fc2b['filters']=_[_0x8f8c('0x41')](_0x37fc2b['model'],_0x37fc2b[_0x8f8c('0x40')]);_0x1193b0['attributes']=_[_0x8f8c('0x41')](_0x37fc2b[_0x8f8c('0x3f')],qs[_0x8f8c('0x43')](_0x276502['query'][_0x8f8c('0x43')]));_0x1193b0[_0x8f8c('0x42')]=_0x1193b0['attributes'][_0x8f8c('0x44')]?_0x1193b0[_0x8f8c('0x42')]:_0x37fc2b[_0x8f8c('0x3f')];if(_0x276502[_0x8f8c('0x40')][_0x8f8c('0x51')]){_0x1193b0[_0x8f8c('0x4d')]=[{'all':!![]}];}_0x1193b0=_[_0x8f8c('0x4b')]({},_0x1193b0,_0x276502[_0x8f8c('0x4c')]);return db[_0x8f8c('0x3b')][_0x8f8c('0x52')](_0x1193b0)[_0x8f8c('0x21')](handleEntityNotFound(_0x2a0c9f,null))['then'](respondWithResult(_0x2a0c9f,null))[_0x8f8c('0x2b')](handleError(_0x2a0c9f,null));};exports[_0x8f8c('0x53')]=function(_0x123f08,_0x570284){return db[_0x8f8c('0x3b')][_0x8f8c('0x53')](_0x123f08[_0x8f8c('0x54')],{})[_0x8f8c('0x21')](respondWithResult(_0x570284,0xc9))['catch'](handleError(_0x570284,null));};exports[_0x8f8c('0x55')]=function(_0x20afc9,_0xd0c559){if(_0x20afc9[_0x8f8c('0x54')]['id']){delete _0x20afc9[_0x8f8c('0x54')]['id'];}return db[_0x8f8c('0x3b')][_0x8f8c('0x52')]({'where':{'id':_0x20afc9[_0x8f8c('0x4f')]['id']}})[_0x8f8c('0x21')](handleEntityNotFound(_0xd0c559,null))[_0x8f8c('0x21')](saveUpdates(_0x20afc9[_0x8f8c('0x54')],null))[_0x8f8c('0x21')](respondWithResult(_0xd0c559,null))[_0x8f8c('0x2b')](handleError(_0xd0c559,null));};exports[_0x8f8c('0x34')]=function(_0x344a79,_0x413801){return db[_0x8f8c('0x3b')]['find']({'where':{'id':_0x344a79[_0x8f8c('0x4f')]['id']}})[_0x8f8c('0x21')](handleEntityNotFound(_0x413801,null))[_0x8f8c('0x21')](removeEntity(_0x413801,null))[_0x8f8c('0x2b')](handleError(_0x413801,null));};exports[_0x8f8c('0x56')]=function(_0x13cbb1,_0x1fe372){return db[_0x8f8c('0x3b')]['describe']()['then'](respondWithResult(_0x1fe372,null))[_0x8f8c('0x2b')](handleError(_0x1fe372,null));};var interaction_log=require(_0x8f8c('0x57'))(_0x8f8c('0x58'));exports[_0x8f8c('0x59')]=function(_0x7cde34,_0x2aa3a5,_0x2a0a20){var _0x34eb4c={'agent':{},'channel':'chat'};if(_0x7cde34[_0x8f8c('0x54')]['id']){delete _0x7cde34[_0x8f8c('0x54')]['id'];}_0x7cde34['body'][_0x8f8c('0x5a')]=!![];_0x7cde34[_0x8f8c('0x54')][_0x8f8c('0x5b')]=moment()[_0x8f8c('0x5c')](_0x8f8c('0x5d'));_0x7cde34[_0x8f8c('0x54')][_0x8f8c('0x5e')]=_0x7cde34[_0x8f8c('0x54')]['UserId']||_0x7cde34[_0x8f8c('0x5f')]['id'];_0x34eb4c[_0x8f8c('0x60')]['id']=_0x7cde34['body'][_0x8f8c('0x5e')];return db['ChatMessage'][_0x8f8c('0x52')]({'where':{'id':_0x7cde34[_0x8f8c('0x4f')]['id'],'UserId':null}})[_0x8f8c('0x21')](handleEntityNotFound(_0x2aa3a5,null))[_0x8f8c('0x21')](saveUpdates(_0x7cde34[_0x8f8c('0x54')],null))[_0x8f8c('0x21')](function(_0x35c7e5){if(_0x35c7e5){_0x34eb4c[_0x8f8c('0x28')]=_0x35c7e5[_0x8f8c('0x61')]({'plain':!![]});return db[_0x8f8c('0x62')][_0x8f8c('0x52')]({'where':{'id':_0x35c7e5[_0x8f8c('0x63')]}});}return null;})[_0x8f8c('0x21')](handleEntityNotFound(_0x2aa3a5,null))[_0x8f8c('0x21')](function(_0x5db8c7){if(_0x5db8c7){return _0x5db8c7[_0x8f8c('0x55')]({'UserId':_0x7cde34['body'][_0x8f8c('0x5e')],'read1stAt':_['isNil'](_0x5db8c7[_0x8f8c('0x64')])?moment()[_0x8f8c('0x5c')](_0x8f8c('0x5d')):undefined});}return null;})[_0x8f8c('0x21')](function(_0x54fb4e){if(_0x54fb4e){_0x34eb4c['interaction']=_0x54fb4e[_0x8f8c('0x61')]({'plain':!![]});interaction_log[_0x8f8c('0x29')](_0x8f8c('0x65'),_0x7cde34['user']['id'],_0x7cde34[_0x8f8c('0x5f')][_0x8f8c('0x37')],_0x7cde34['user'][_0x8f8c('0x66')],_0x34eb4c[_0x8f8c('0x67')]['id'],_0x7cde34[_0x8f8c('0x54')]?JSON[_0x8f8c('0x25')](_0x7cde34[_0x8f8c('0x54')]):_0x8f8c('0x68'));return respondWithRpcPromise(_0x8f8c('0x69'),_0x8f8c('0x6a'),_0x34eb4c);}return null;})[_0x8f8c('0x21')](function(_0x164637){var _0x5e670c='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x164637['message']['ContactId'];return db[_0x8f8c('0x6b')][_0x8f8c('0x40')](_0x5e670c,{'type':db[_0x8f8c('0x6c')][_0x8f8c('0x6d')][_0x8f8c('0x6e')],'raw':!![]})[_0x8f8c('0x21')](function(_0x2020e7){return _0x2020e7;});})['then'](function(_0x114989){if(_0x114989){_0x34eb4c[_0x8f8c('0x28')][_0x8f8c('0x6f')]=_0x114989[0x0];if(!_0x7cde34[_0x8f8c('0x54')][_0x8f8c('0x5e')])return;return db[_0x8f8c('0x70')][_0x8f8c('0x52')]({'where':{'id':_0x7cde34[_0x8f8c('0x54')][_0x8f8c('0x5e')],'role':_0x8f8c('0x60')},'attributes':['id',_0x8f8c('0x37'),'fullname','email',_0x8f8c('0x71')],'raw':!![]});}return null;})[_0x8f8c('0x21')](function(_0x2e93f9){if(!_0x2e93f9)return null;_0x34eb4c['message'][_0x8f8c('0x60')]=_0x2e93f9;return _0x34eb4c;})[_0x8f8c('0x21')](function(_0x5c6817){if(_0x5c6817){if(_0x7cde34['body'][_0x8f8c('0x72')]){_0x34eb4c[_0x8f8c('0x28')][_0x8f8c('0x73')]=util[_0x8f8c('0x5c')](_0x8f8c('0x74'),_0x7cde34[_0x8f8c('0x5f')][_0x8f8c('0x37')]);_0x34eb4c[_0x8f8c('0x28')][_0x8f8c('0x75')]=_0x34eb4c['channel'];_0x34eb4c[_0x8f8c('0x28')]['motionChannel']=_0x34eb4c[_0x8f8c('0x75')];_0x34eb4c[_0x8f8c('0x28')][_0x8f8c('0x76')]=_0x8f8c('0x59');return respondWithRpcPromise(_0x8f8c('0x77'),_0x8f8c('0x77'),{'event':'acceptmessage','message':_[_0x8f8c('0x4b')](_0x34eb4c['message'],JSON['parse'](_0x34eb4c[_0x8f8c('0x67')][_0x8f8c('0x78')]))},client9002)[_0x8f8c('0x21')](function(){return _0x34eb4c;});}return _0x34eb4c;}return null;})[_0x8f8c('0x21')](respondWithResult(_0x2aa3a5,null))[_0x8f8c('0x2b')](handleError(_0x2aa3a5,null));};var interaction_log=require(_0x8f8c('0x57'))(_0x8f8c('0x58'));exports[_0x8f8c('0x33')]=function(_0x4bad81,_0x65528f,_0x59bffb){var _0x4bec00={'agent':{},'channel':_0x8f8c('0x79')};if(_0x4bad81[_0x8f8c('0x54')]['id']){delete _0x4bad81[_0x8f8c('0x54')]['id'];}_0x4bad81[_0x8f8c('0x54')][_0x8f8c('0x5e')]=_0x4bad81[_0x8f8c('0x54')][_0x8f8c('0x5e')]||_0x4bad81[_0x8f8c('0x5f')]['id'];_0x4bec00[_0x8f8c('0x60')]['id']=_0x4bad81[_0x8f8c('0x54')][_0x8f8c('0x5e')];return db['ChatMessage'][_0x8f8c('0x52')]({'where':{'id':_0x4bad81[_0x8f8c('0x4f')]['id'],'UserId':null}})[_0x8f8c('0x21')](handleEntityNotFound(_0x65528f,null))[_0x8f8c('0x21')](function(_0x3582de){if(_0x3582de){_0x4bec00[_0x8f8c('0x28')]=_0x3582de['get']({'plain':!![]});return db['ChatInteraction'][_0x8f8c('0x52')]({'where':{'id':_0x3582de[_0x8f8c('0x63')]}});}return null;})[_0x8f8c('0x21')](handleEntityNotFound(_0x65528f,null))['then'](function(_0x3e5440){if(_0x3e5440){_0x4bec00[_0x8f8c('0x67')]=_0x3e5440['get']({'plain':!![]});interaction_log[_0x8f8c('0x29')](_0x8f8c('0x7a'),_0x4bad81['user']['id'],_0x4bad81[_0x8f8c('0x5f')][_0x8f8c('0x37')],_0x4bad81[_0x8f8c('0x5f')][_0x8f8c('0x66')],_0x4bec00[_0x8f8c('0x67')]['id'],_0x4bad81[_0x8f8c('0x54')]?JSON[_0x8f8c('0x25')](_0x4bad81[_0x8f8c('0x54')]):_0x8f8c('0x68'));return respondWithRpcPromise(_0x8f8c('0x7b'),_0x8f8c('0x7c'),_0x4bec00);}return null;})[_0x8f8c('0x21')](function(_0x409e12){var _0x59bdd4=_0x8f8c('0x7d')+_0x409e12[_0x8f8c('0x28')][_0x8f8c('0x7e')];return db[_0x8f8c('0x6b')][_0x8f8c('0x40')](_0x59bdd4,{'type':db[_0x8f8c('0x6c')][_0x8f8c('0x6d')]['SELECT'],'raw':!![]})[_0x8f8c('0x21')](function(_0x5c71eb){return _0x5c71eb;});})[_0x8f8c('0x21')](function(_0x1d199d){if(_0x1d199d){_0x4bec00['message'][_0x8f8c('0x6f')]=_0x1d199d[0x0];if(!_0x4bad81[_0x8f8c('0x54')][_0x8f8c('0x5e')])return;return db['User'][_0x8f8c('0x52')]({'where':{'id':_0x4bad81[_0x8f8c('0x54')][_0x8f8c('0x5e')],'role':_0x8f8c('0x60')},'attributes':['id',_0x8f8c('0x37'),_0x8f8c('0x7f'),_0x8f8c('0x80'),'internal'],'raw':!![]});}return null;})[_0x8f8c('0x21')](function(_0x5906ce){if(!_0x5906ce)return null;_0x4bec00[_0x8f8c('0x28')]['agent']=_0x5906ce;return _0x4bec00;})[_0x8f8c('0x21')](function(_0x5a5839){if(_0x5a5839){_0x5a5839[_0x8f8c('0x28')][_0x8f8c('0x73')]=util['format']('SIP/%s',_0x4bad81[_0x8f8c('0x5f')][_0x8f8c('0x37')]);_0x5a5839[_0x8f8c('0x28')][_0x8f8c('0x75')]=_0x4bec00['channel'];_0x5a5839[_0x8f8c('0x28')][_0x8f8c('0x81')]=_0x4bec00['channel'];_0x5a5839[_0x8f8c('0x28')][_0x8f8c('0x76')]='reject';respondWithRpcPromise(_0x8f8c('0x77'),_0x8f8c('0x77'),{'event':_0x8f8c('0x82'),'message':_['merge'](_0x4bec00[_0x8f8c('0x28')],JSON['parse'](_0x4bec00[_0x8f8c('0x67')]['formData']))},client9002);return _0x4bec00;}return null;})[_0x8f8c('0x21')](respondWithResult(_0x65528f,null))['catch'](handleError(_0x65528f,null));}; \ No newline at end of file +var _0x12c4=['ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','status','offset','limit','undefined','count','set','json','apply','update','destroy','end','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','VIRTUAL','merge','ChatMessage','includeAll','include','findAll','catch','show','params','options','find','create','body','describe','../../config/logger','chat-interactions','accept','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','ChatInteraction','ChatInteractionId','read1stAt','interaction','get','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','agent','email','manual','SIP/%s','channel','event','EventManager','acceptmessage','formData','reject','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','ContactId','contact','fullname','internal','interface','motionChannel','parse','eml-format','rimraf','request-promise','moment','path','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatMessage.socket','jayson/promise','http','client','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3c3798,_0x3c11e7){var _0x4d7e50=function(_0x5ca732){while(--_0x5ca732){_0x3c3798['push'](_0x3c3798['shift']());}};_0x4d7e50(++_0x3c11e7);}(_0x12c4,0x1e4));var _0x412c=function(_0x5be938,_0x2b9124){_0x5be938=_0x5be938-0x0;var _0x3de204=_0x12c4[_0x5be938];return _0x3de204;};'use strict';var emlformat=require(_0x412c('0x0'));var rimraf=require(_0x412c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x412c('0x2'));var moment=require(_0x412c('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x412c('0x4'));var sox=require('sox');var csv=require(_0x412c('0x5'));var ejs=require(_0x412c('0x6'));var fs=require('fs');var fs_extra=require(_0x412c('0x7'));var _=require('lodash');var squel=require(_0x412c('0x8'));var crypto=require(_0x412c('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x412c('0x5'));var querystring=require(_0x412c('0xa'));var Papa=require(_0x412c('0xb'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x412c('0xc'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x412c('0xd'));var logger=require('../../config/logger')(_0x412c('0xe'));var utils=require(_0x412c('0xf'));var config=require(_0x412c('0x10'));var licenseUtil=require(_0x412c('0x11'));var db=require(_0x412c('0x12'))['db'];config[_0x412c('0x13')]=_[_0x412c('0x14')](config[_0x412c('0x13')],{'host':_0x412c('0x15'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x412c('0x13')]));require(_0x412c('0x16'))['register'](socket);var jayson=require(_0x412c('0x17'));var client=jayson['client'][_0x412c('0x18')]({'port':0x232c});var client9002=jayson[_0x412c('0x19')]['http']({'port':0x232a});function respondWithRpcPromise(_0x111596,_0x3ed66b,_0x2aa6d8,_0x350eee){return new BPromise(function(_0x1ec1c0,_0x4fea71){var _0x51d72b=_0x350eee||client;return _0x51d72b[_0x412c('0x1a')](_0x111596,_0x2aa6d8)[_0x412c('0x1b')](function(_0x133cad){logger[_0x412c('0x1c')](_0x412c('0x1d'),_0x3ed66b,_0x412c('0x1e'));logger[_0x412c('0x1f')](_0x412c('0x20'),_0x3ed66b,_0x412c('0x1e'),JSON[_0x412c('0x21')](_0x133cad));if(_0x133cad[_0x412c('0x22')]){if(_0x133cad['error'][_0x412c('0x23')]===0x1f4){logger[_0x412c('0x22')]('ChatMessage,\x20%s,\x20%s',_0x3ed66b,_0x133cad['error'][_0x412c('0x24')]);return _0x4fea71(_0x133cad['error'][_0x412c('0x24')]);}logger[_0x412c('0x22')](_0x412c('0x1d'),_0x3ed66b,_0x133cad[_0x412c('0x22')][_0x412c('0x24')]);return _0x1ec1c0(_0x133cad[_0x412c('0x22')][_0x412c('0x24')]);}else{logger['info'](_0x412c('0x1d'),_0x3ed66b,_0x412c('0x1e'));_0x1ec1c0(_0x133cad['result'][_0x412c('0x24')]);}})['catch'](function(_0x3d6c77){logger['error'](_0x412c('0x1d'),_0x3ed66b,_0x3d6c77);_0x4fea71(_0x3d6c77);});});}function respondWithStatusCode(_0xa19c70,_0x230fcb){_0x230fcb=_0x230fcb||0xcc;return function(_0x1bd28f){if(_0x1bd28f){return _0xa19c70['sendStatus'](_0x230fcb);}return _0xa19c70[_0x412c('0x25')](_0x230fcb)['end']();};}function respondWithResult(_0x3c95b5,_0x7fefaf){_0x7fefaf=_0x7fefaf||0xc8;return function(_0x40f40b){if(_0x40f40b){return _0x3c95b5['status'](_0x7fefaf)['json'](_0x40f40b);}};}function respondWithFilteredResult(_0x585c1d,_0x8bd6cb){return function(_0x1625e4){if(_0x1625e4){var _0x5d8a1c=typeof _0x8bd6cb[_0x412c('0x26')]==='undefined'&&typeof _0x8bd6cb[_0x412c('0x27')]===_0x412c('0x28');var _0x1a166=_0x1625e4[_0x412c('0x29')];var _0x4a17fd=_0x5d8a1c?0x0:_0x8bd6cb[_0x412c('0x26')];var _0x3f0850=_0x5d8a1c?_0x1625e4['count']:_0x8bd6cb[_0x412c('0x26')]+_0x8bd6cb[_0x412c('0x27')];var _0x76f353;if(_0x3f0850>=_0x1a166){_0x3f0850=_0x1a166;_0x76f353=0xc8;}else{_0x76f353=0xce;}_0x585c1d[_0x412c('0x25')](_0x76f353);return _0x585c1d[_0x412c('0x2a')]('Content-Range',_0x4a17fd+'-'+_0x3f0850+'/'+_0x1a166)[_0x412c('0x2b')](_0x1625e4);}return null;};}function patchUpdates(_0xa86f67){return function(_0x414e67){try{jsonpatch[_0x412c('0x2c')](_0x414e67,_0xa86f67,!![]);}catch(_0x23be30){return BPromise['reject'](_0x23be30);}return _0x414e67['save']();};}function saveUpdates(_0x2f4c1a,_0x41bddc){return function(_0x4416cd){if(_0x4416cd){return _0x4416cd[_0x412c('0x2d')](_0x2f4c1a)[_0x412c('0x1b')](function(_0x5e0762){return _0x5e0762;});}return null;};}function removeEntity(_0x28c401,_0x4f2d71){return function(_0x4adeed){if(_0x4adeed){return _0x4adeed[_0x412c('0x2e')]()[_0x412c('0x1b')](function(){_0x28c401[_0x412c('0x25')](0xcc)[_0x412c('0x2f')]();});}};}function handleEntityNotFound(_0x7105c4,_0x5be686){return function(_0x3680b9){if(!_0x3680b9){_0x7105c4[_0x412c('0x30')](0x194);}return _0x3680b9;};}function handleError(_0x4c1093,_0x3658ac){_0x3658ac=_0x3658ac||0x1f4;return function(_0x5d23bb){logger[_0x412c('0x22')](_0x5d23bb[_0x412c('0x31')]);if(_0x5d23bb[_0x412c('0x32')]){delete _0x5d23bb[_0x412c('0x32')];}_0x4c1093[_0x412c('0x25')](_0x3658ac)[_0x412c('0x33')](_0x5d23bb);};}exports[_0x412c('0x34')]=function(_0x49bc0d,_0xe475de){var _0x36ffe1={},_0x79553={},_0x4abb1f={'count':0x0,'rows':[]};var _0x45dc06=_[_0x412c('0x35')](db['ChatMessage'][_0x412c('0x36')],function(_0x2fb0b6){return{'name':_0x2fb0b6[_0x412c('0x37')],'type':_0x2fb0b6[_0x412c('0x38')][_0x412c('0x39')]};});_0x79553[_0x412c('0x3a')]=_[_0x412c('0x35')](_0x45dc06,_0x412c('0x32'));_0x79553[_0x412c('0x3b')]=_[_0x412c('0x3c')](_0x49bc0d[_0x412c('0x3b')]);_0x79553['filters']=_['intersection'](_0x79553['model'],_0x79553[_0x412c('0x3b')]);_0x36ffe1[_0x412c('0x3d')]=_[_0x412c('0x3e')](_0x79553[_0x412c('0x3a')],qs[_0x412c('0x3f')](_0x49bc0d[_0x412c('0x3b')]['fields']));_0x36ffe1[_0x412c('0x3d')]=_0x36ffe1[_0x412c('0x3d')][_0x412c('0x40')]?_0x36ffe1[_0x412c('0x3d')]:_0x79553[_0x412c('0x3a')];if(!_0x49bc0d[_0x412c('0x3b')][_0x412c('0x41')](_0x412c('0x42'))){_0x36ffe1['limit']=qs[_0x412c('0x27')](_0x49bc0d['query']['limit']);_0x36ffe1[_0x412c('0x26')]=qs['offset'](_0x49bc0d[_0x412c('0x3b')][_0x412c('0x26')]);}_0x36ffe1['order']=qs['sort'](_0x49bc0d[_0x412c('0x3b')][_0x412c('0x43')]);_0x36ffe1[_0x412c('0x44')]=qs['filters'](_['pick'](_0x49bc0d[_0x412c('0x3b')],_0x79553[_0x412c('0x45')]),_0x45dc06);if(_0x49bc0d[_0x412c('0x3b')][_0x412c('0x46')]){_0x36ffe1[_0x412c('0x44')]=_['merge'](_0x36ffe1[_0x412c('0x44')],{'$or':_[_0x412c('0x35')](_0x45dc06,function(_0x50e220){if(_0x50e220['type']!==_0x412c('0x47')){var _0x2f786d={};_0x2f786d[_0x50e220[_0x412c('0x32')]]={'$like':'%'+_0x49bc0d['query']['filter']+'%'};return _0x2f786d;}})});}_0x36ffe1=_[_0x412c('0x48')]({},_0x36ffe1,_0x49bc0d['options']);var _0x2aed03={'where':_0x36ffe1[_0x412c('0x44')]};return db[_0x412c('0x49')][_0x412c('0x29')](_0x2aed03)[_0x412c('0x1b')](function(_0x3096e5){_0x4abb1f[_0x412c('0x29')]=_0x3096e5;if(_0x49bc0d[_0x412c('0x3b')][_0x412c('0x4a')]){_0x36ffe1[_0x412c('0x4b')]=[{'all':!![]}];}return db[_0x412c('0x49')][_0x412c('0x4c')](_0x36ffe1);})[_0x412c('0x1b')](function(_0x3514ca){_0x4abb1f['rows']=_0x3514ca;return _0x4abb1f;})['then'](respondWithFilteredResult(_0xe475de,_0x36ffe1))[_0x412c('0x4d')](handleError(_0xe475de,null));};exports[_0x412c('0x4e')]=function(_0x402e38,_0x27a107){var _0x4cde3d={'raw':!![],'where':{'id':_0x402e38[_0x412c('0x4f')]['id']}},_0x3b663d={};_0x3b663d[_0x412c('0x3a')]=_[_0x412c('0x3c')](db[_0x412c('0x49')][_0x412c('0x36')]);_0x3b663d[_0x412c('0x3b')]=_[_0x412c('0x3c')](_0x402e38[_0x412c('0x3b')]);_0x3b663d[_0x412c('0x45')]=_['intersection'](_0x3b663d[_0x412c('0x3a')],_0x3b663d[_0x412c('0x3b')]);_0x4cde3d[_0x412c('0x3d')]=_[_0x412c('0x3e')](_0x3b663d[_0x412c('0x3a')],qs[_0x412c('0x3f')](_0x402e38['query']['fields']));_0x4cde3d['attributes']=_0x4cde3d[_0x412c('0x3d')][_0x412c('0x40')]?_0x4cde3d[_0x412c('0x3d')]:_0x3b663d['model'];if(_0x402e38[_0x412c('0x3b')][_0x412c('0x4a')]){_0x4cde3d['include']=[{'all':!![]}];}_0x4cde3d=_[_0x412c('0x48')]({},_0x4cde3d,_0x402e38[_0x412c('0x50')]);return db[_0x412c('0x49')][_0x412c('0x51')](_0x4cde3d)[_0x412c('0x1b')](handleEntityNotFound(_0x27a107,null))[_0x412c('0x1b')](respondWithResult(_0x27a107,null))['catch'](handleError(_0x27a107,null));};exports[_0x412c('0x52')]=function(_0x2261be,_0x5f0d00){return db[_0x412c('0x49')]['create'](_0x2261be['body'],{})[_0x412c('0x1b')](respondWithResult(_0x5f0d00,0xc9))[_0x412c('0x4d')](handleError(_0x5f0d00,null));};exports[_0x412c('0x2d')]=function(_0x1f2e8b,_0x4711e4){if(_0x1f2e8b['body']['id']){delete _0x1f2e8b[_0x412c('0x53')]['id'];}return db[_0x412c('0x49')][_0x412c('0x51')]({'where':{'id':_0x1f2e8b[_0x412c('0x4f')]['id']}})[_0x412c('0x1b')](handleEntityNotFound(_0x4711e4,null))['then'](saveUpdates(_0x1f2e8b['body'],null))[_0x412c('0x1b')](respondWithResult(_0x4711e4,null))['catch'](handleError(_0x4711e4,null));};exports['destroy']=function(_0x4bdac2,_0x1e378a){return db[_0x412c('0x49')][_0x412c('0x51')]({'where':{'id':_0x4bdac2['params']['id']}})[_0x412c('0x1b')](handleEntityNotFound(_0x1e378a,null))['then'](removeEntity(_0x1e378a,null))[_0x412c('0x4d')](handleError(_0x1e378a,null));};exports[_0x412c('0x54')]=function(_0x4b05fd,_0x3bd0c3){return db[_0x412c('0x49')]['describe']()[_0x412c('0x1b')](respondWithResult(_0x3bd0c3,null))[_0x412c('0x4d')](handleError(_0x3bd0c3,null));};var interaction_log=require(_0x412c('0x55'))(_0x412c('0x56'));exports[_0x412c('0x57')]=function(_0x80aca9,_0x11bb1b,_0x450ccc){var _0x2ae459={'agent':{},'channel':_0x412c('0x58')};if(_0x80aca9['body']['id']){delete _0x80aca9[_0x412c('0x53')]['id'];}_0x80aca9[_0x412c('0x53')][_0x412c('0x59')]=!![];_0x80aca9[_0x412c('0x53')][_0x412c('0x5a')]=moment()[_0x412c('0x5b')](_0x412c('0x5c'));_0x80aca9['body'][_0x412c('0x5d')]=_0x80aca9['body'][_0x412c('0x5d')]||_0x80aca9[_0x412c('0x5e')]['id'];_0x2ae459['agent']['id']=_0x80aca9[_0x412c('0x53')][_0x412c('0x5d')];return db[_0x412c('0x49')]['find']({'where':{'id':_0x80aca9[_0x412c('0x4f')]['id'],'UserId':null}})[_0x412c('0x1b')](handleEntityNotFound(_0x11bb1b,null))['then'](saveUpdates(_0x80aca9['body'],null))['then'](function(_0x28bb45){if(_0x28bb45){_0x2ae459['message']=_0x28bb45['get']({'plain':!![]});return db[_0x412c('0x5f')][_0x412c('0x51')]({'where':{'id':_0x28bb45[_0x412c('0x60')]}});}return null;})[_0x412c('0x1b')](handleEntityNotFound(_0x11bb1b,null))[_0x412c('0x1b')](function(_0x461fbb){if(_0x461fbb){return _0x461fbb[_0x412c('0x2d')]({'UserId':_0x80aca9['body']['UserId'],'read1stAt':_['isNil'](_0x461fbb[_0x412c('0x61')])?moment()[_0x412c('0x5b')](_0x412c('0x5c')):undefined});}return null;})['then'](function(_0x23dd35){if(_0x23dd35){_0x2ae459[_0x412c('0x62')]=_0x23dd35[_0x412c('0x63')]({'plain':!![]});interaction_log[_0x412c('0x1c')](_0x412c('0x64'),_0x80aca9[_0x412c('0x5e')]['id'],_0x80aca9[_0x412c('0x5e')][_0x412c('0x32')],_0x80aca9[_0x412c('0x5e')]['role'],_0x2ae459[_0x412c('0x62')]['id'],_0x80aca9['body']?JSON['stringify'](_0x80aca9['body']):_0x412c('0x65'));return respondWithRpcPromise('AcceptMessage',_0x412c('0x66'),_0x2ae459);}return null;})[_0x412c('0x1b')](function(_0x29113e){var _0x21ccb3=_0x412c('0x67')+_0x29113e['message']['ContactId'];return db[_0x412c('0x68')]['query'](_0x21ccb3,{'type':db[_0x412c('0x69')][_0x412c('0x6a')][_0x412c('0x6b')],'raw':!![]})[_0x412c('0x1b')](function(_0x3f4d29){return _0x3f4d29;});})['then'](function(_0x52addc){if(_0x52addc){_0x2ae459['message']['contact']=_0x52addc[0x0];if(!_0x80aca9[_0x412c('0x53')]['UserId'])return;return db['User'][_0x412c('0x51')]({'where':{'id':_0x80aca9['body']['UserId'],'role':_0x412c('0x6c')},'attributes':['id',_0x412c('0x32'),'fullname',_0x412c('0x6d'),'internal'],'raw':!![]});}return null;})['then'](function(_0x2d76ff){if(!_0x2d76ff)return null;_0x2ae459[_0x412c('0x24')][_0x412c('0x6c')]=_0x2d76ff;return _0x2ae459;})[_0x412c('0x1b')](function(_0x3895e9){if(_0x3895e9){if(_0x80aca9[_0x412c('0x53')][_0x412c('0x6e')]){_0x2ae459['message']['interface']=util[_0x412c('0x5b')](_0x412c('0x6f'),_0x80aca9['user'][_0x412c('0x32')]);_0x2ae459['message'][_0x412c('0x70')]=_0x2ae459[_0x412c('0x70')];_0x2ae459['message']['motionChannel']=_0x2ae459[_0x412c('0x70')];_0x2ae459[_0x412c('0x24')][_0x412c('0x71')]='accept';return respondWithRpcPromise(_0x412c('0x72'),_0x412c('0x72'),{'event':_0x412c('0x73'),'message':_['merge'](_0x2ae459[_0x412c('0x24')],JSON['parse'](_0x2ae459[_0x412c('0x62')][_0x412c('0x74')]))},client9002)['then'](function(){return _0x2ae459;});}return _0x2ae459;}return null;})[_0x412c('0x1b')](respondWithResult(_0x11bb1b,null))['catch'](handleError(_0x11bb1b,null));};var interaction_log=require('../../config/logger')(_0x412c('0x56'));exports[_0x412c('0x75')]=function(_0x4e9426,_0x554582,_0x2866a4){var _0x29f0d1={'agent':{},'channel':_0x412c('0x58')};if(_0x4e9426[_0x412c('0x53')]['id']){delete _0x4e9426[_0x412c('0x53')]['id'];}_0x4e9426['body'][_0x412c('0x5d')]=_0x4e9426[_0x412c('0x53')]['UserId']||_0x4e9426['user']['id'];_0x29f0d1[_0x412c('0x6c')]['id']=_0x4e9426[_0x412c('0x53')][_0x412c('0x5d')];return db[_0x412c('0x49')][_0x412c('0x51')]({'where':{'id':_0x4e9426[_0x412c('0x4f')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x554582,null))['then'](function(_0x985895){if(_0x985895){_0x29f0d1[_0x412c('0x24')]=_0x985895['get']({'plain':!![]});return db[_0x412c('0x5f')][_0x412c('0x51')]({'where':{'id':_0x985895['ChatInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x554582,null))['then'](function(_0x482c91){if(_0x482c91){_0x29f0d1[_0x412c('0x62')]=_0x482c91[_0x412c('0x63')]({'plain':!![]});interaction_log[_0x412c('0x1c')](_0x412c('0x76'),_0x4e9426[_0x412c('0x5e')]['id'],_0x4e9426[_0x412c('0x5e')][_0x412c('0x32')],_0x4e9426['user'][_0x412c('0x77')],_0x29f0d1['interaction']['id'],_0x4e9426['body']?JSON[_0x412c('0x21')](_0x4e9426[_0x412c('0x53')]):_0x412c('0x65'));return respondWithRpcPromise(_0x412c('0x78'),_0x412c('0x79'),_0x29f0d1);}return null;})[_0x412c('0x1b')](function(_0x5204af){var _0x47c503=_0x412c('0x67')+_0x5204af[_0x412c('0x24')][_0x412c('0x7a')];return db[_0x412c('0x68')][_0x412c('0x3b')](_0x47c503,{'type':db[_0x412c('0x69')][_0x412c('0x6a')][_0x412c('0x6b')],'raw':!![]})['then'](function(_0x16df71){return _0x16df71;});})[_0x412c('0x1b')](function(_0x3f119c){if(_0x3f119c){_0x29f0d1[_0x412c('0x24')][_0x412c('0x7b')]=_0x3f119c[0x0];if(!_0x4e9426['body'][_0x412c('0x5d')])return;return db['User'][_0x412c('0x51')]({'where':{'id':_0x4e9426['body'][_0x412c('0x5d')],'role':'agent'},'attributes':['id',_0x412c('0x32'),_0x412c('0x7c'),_0x412c('0x6d'),_0x412c('0x7d')],'raw':!![]});}return null;})[_0x412c('0x1b')](function(_0x5d8410){if(!_0x5d8410)return null;_0x29f0d1[_0x412c('0x24')]['agent']=_0x5d8410;return _0x29f0d1;})[_0x412c('0x1b')](function(_0x3f0b20){if(_0x3f0b20){_0x3f0b20[_0x412c('0x24')][_0x412c('0x7e')]=util[_0x412c('0x5b')]('SIP/%s',_0x4e9426[_0x412c('0x5e')][_0x412c('0x32')]);_0x3f0b20[_0x412c('0x24')][_0x412c('0x70')]=_0x29f0d1[_0x412c('0x70')];_0x3f0b20[_0x412c('0x24')][_0x412c('0x7f')]=_0x29f0d1[_0x412c('0x70')];_0x3f0b20[_0x412c('0x24')][_0x412c('0x71')]=_0x412c('0x75');respondWithRpcPromise('EventManager',_0x412c('0x72'),{'event':'rejectmessage','message':_[_0x412c('0x48')](_0x29f0d1[_0x412c('0x24')],JSON[_0x412c('0x80')](_0x29f0d1[_0x412c('0x62')][_0x412c('0x74')]))},client9002);return _0x29f0d1;}return null;})['then'](respondWithResult(_0x554582,null))[_0x412c('0x4d')](handleError(_0x554582,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 02a0926..f3f5063 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 _0xd5d1=['update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners'];(function(_0x527099,_0xda2c2a){var _0x2ea130=function(_0x3b1f66){while(--_0x3b1f66){_0x527099['push'](_0x527099['shift']());}};_0x2ea130(++_0xda2c2a);}(_0xd5d1,0x14e));var _0x1d5d=function(_0x38d3c9,_0x86f436){_0x38d3c9=_0x38d3c9-0x0;var _0xb7bb23=_0xd5d1[_0x38d3c9];return _0xb7bb23;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0x1d5d('0x0'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x1d5d('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1d5d('0x2'),'afterDestroy':_0x1d5d('0x3')};function emitEvent(_0x3b8992){return function(_0x1bf717,_0x848497,_0x13cad0){ChatMessageEvents[_0x1d5d('0x4')](_0x3b8992+':'+_0x1bf717['id'],_0x1bf717);ChatMessageEvents['emit'](_0x3b8992,_0x1bf717);_0x13cad0(null);};}for(var e in events){if(events[_0x1d5d('0x5')](e)){var event=events[e];ChatMessage[_0x1d5d('0x6')](e,emitEvent(event));}}module[_0x1d5d('0x7')]=ChatMessageEvents; \ No newline at end of file +var _0x63d7=['emit','hook','exports','events','../../mysqldb','ChatMessage','setMaxListeners','save','update','remove'];(function(_0x2aa5c1,_0x4292b4){var _0x3d7758=function(_0x20e29e){while(--_0x20e29e){_0x2aa5c1['push'](_0x2aa5c1['shift']());}};_0x3d7758(++_0x4292b4);}(_0x63d7,0x67));var _0x763d=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x63d7[_0x17d9e3];return _0x14192d;};'use strict';var EventEmitter=require(_0x763d('0x0'));var ChatMessage=require(_0x763d('0x1'))['db'][_0x763d('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x763d('0x3')](0x0);var events={'afterCreate':_0x763d('0x4'),'afterUpdate':_0x763d('0x5'),'afterDestroy':_0x763d('0x6')};function emitEvent(_0x43a2b7){return function(_0x13f16d,_0x145a35,_0xc97676){ChatMessageEvents[_0x763d('0x7')](_0x43a2b7+':'+_0x13f16d['id'],_0x13f16d);ChatMessageEvents[_0x763d('0x7')](_0x43a2b7,_0x13f16d);_0xc97676(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0x763d('0x8')](e,emitEvent(event));}}module[_0x763d('0x9')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index c4048c2..76af9e1 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 _0x8066=['models','get','toLowerCase','direction','out','secret','isNil','UserId','update','catch','error','lodash','util','api','moment','bluebird','rimraf','../../config/environment','./chatMessage.attributes','define','chat_messages','fti_chat_messages','body','FULLTEXT'];(function(_0x4f80b,_0x4f8552){var _0x26459c=function(_0x2d8fcb){while(--_0x2d8fcb){_0x4f80b['push'](_0x4f80b['shift']());}};_0x26459c(++_0x4f8552);}(_0x8066,0x83));var _0x6806=function(_0x4fbfd9,_0x3ab91a){_0x4fbfd9=_0x4fbfd9-0x0;var _0x31dc94=_0x8066[_0x4fbfd9];return _0x31dc94;};'use strict';var _=require(_0x6806('0x0'));var util=require(_0x6806('0x1'));var logger=require('../../config/logger')(_0x6806('0x2'));var moment=require(_0x6806('0x3'));var BPromise=require(_0x6806('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6806('0x5'));var config=require(_0x6806('0x6'));var attributes=require(_0x6806('0x7'));module['exports']=function(_0x1ec999,_0x38eac6){return _0x1ec999[_0x6806('0x8')]('ChatMessage',attributes,{'tableName':_0x6806('0x9'),'paranoid':![],'indexes':[{'name':_0x6806('0xa'),'fields':[_0x6806('0xb')],'type':_0x6806('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x45836c,_0x3a3129,_0x2d9fc2){var _0x4313ae=_0x1ec999[_0x6806('0xd')];var _0x2a46a5=_0x45836c[_0x6806('0xe')]({'plain':!![]});if(_0x2a46a5['direction'][_0x6806('0xf')]()==='in'||_0x2a46a5[_0x6806('0x10')][_0x6806('0xf')]()===_0x6806('0x11')&&!_0x2a46a5[_0x6806('0x12')]&&!_[_0x6806('0x13')](_0x2a46a5[_0x6806('0x14')])){_0x4313ae['ChatInteraction']['findOne']({'where':{'id':_0x2a46a5['ChatInteractionId']}})['then'](function(_0x275c40){if(_0x275c40){_0x275c40[_0x6806('0x15')]({'lastMsgAt':_0x2a46a5['createdAt'],'lastMsgDirection':_0x2a46a5[_0x6806('0x10')]['toLowerCase']()});}})[_0x6806('0x16')](function(_0x4c5a11){console[_0x6806('0x17')](_0x4c5a11);});}_0x2d9fc2();}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x7b97=['direction','toLowerCase','out','secret','isNil','UserId','findOne','ChatInteractionId','then','update','createdAt','catch','error','utf8mb4_unicode_ci','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./chatMessage.attributes','exports','ChatMessage','chat_messages','body','FULLTEXT','models','get'];(function(_0x26f702,_0x3919bf){var _0x11417d=function(_0x1aa3e8){while(--_0x1aa3e8){_0x26f702['push'](_0x26f702['shift']());}};_0x11417d(++_0x3919bf);}(_0x7b97,0x1c1));var _0x77b9=function(_0x162780,_0x47f2e2){_0x162780=_0x162780-0x0;var _0x1ea2dc=_0x7b97[_0x162780];return _0x1ea2dc;};'use strict';var _=require('lodash');var util=require(_0x77b9('0x0'));var logger=require(_0x77b9('0x1'))(_0x77b9('0x2'));var moment=require(_0x77b9('0x3'));var BPromise=require('bluebird');var rp=require(_0x77b9('0x4'));var fs=require('fs');var path=require(_0x77b9('0x5'));var rimraf=require('rimraf');var config=require(_0x77b9('0x6'));var attributes=require(_0x77b9('0x7'));module[_0x77b9('0x8')]=function(_0x55fad1,_0x3bba19){return _0x55fad1['define'](_0x77b9('0x9'),attributes,{'tableName':_0x77b9('0xa'),'paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':[_0x77b9('0xb')],'type':_0x77b9('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x112316,_0x1ea4be,_0x28574e){var _0x3f37b8=_0x55fad1[_0x77b9('0xd')];var _0x117e98=_0x112316[_0x77b9('0xe')]({'plain':!![]});if(_0x117e98[_0x77b9('0xf')][_0x77b9('0x10')]()==='in'||_0x117e98['direction'][_0x77b9('0x10')]()===_0x77b9('0x11')&&!_0x117e98[_0x77b9('0x12')]&&!_[_0x77b9('0x13')](_0x117e98[_0x77b9('0x14')])){_0x3f37b8['ChatInteraction'][_0x77b9('0x15')]({'where':{'id':_0x117e98[_0x77b9('0x16')]}})[_0x77b9('0x17')](function(_0x3c16a9){if(_0x3c16a9){_0x3c16a9[_0x77b9('0x18')]({'lastMsgAt':_0x117e98[_0x77b9('0x19')],'lastMsgDirection':_0x117e98[_0x77b9('0xf')][_0x77b9('0x10')]()});}})[_0x77b9('0x1a')](function(_0x2f662b){console[_0x77b9('0x1b')](_0x2f662b);});}_0x28574e();}},'charset':'utf8mb4','collate':_0x77b9('0x1c')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 5614944..d79c975 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 _0x0835=['defaults','redis','localhost','socket.io-emitter','./chatMessage.socket','register','request','then','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','CreateChatMessage','ChatMessage','create','body','options','raw','debug','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','http'];(function(_0x24da21,_0x47a53d){var _0x33014f=function(_0x35ed22){while(--_0x35ed22){_0x24da21['push'](_0x24da21['shift']());}};_0x33014f(++_0x47a53d);}(_0x0835,0x77));var _0x5083=function(_0x2ba984,_0xd1af26){_0x2ba984=_0x2ba984-0x0;var _0x16d186=_0x0835[_0x2ba984];return _0x16d186;};'use strict';var _=require(_0x5083('0x0'));var util=require(_0x5083('0x1'));var moment=require(_0x5083('0x2'));var BPromise=require('bluebird');var rs=require(_0x5083('0x3'));var fs=require('fs');var Redis=require(_0x5083('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5083('0x5'));var logger=require(_0x5083('0x6'))(_0x5083('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x5083('0x8')]({'port':0x232a});config['redis']=_[_0x5083('0x9')](config[_0x5083('0xa')],{'host':_0x5083('0xb'),'port':0x18eb});var socket=require(_0x5083('0xc'))(new Redis(config[_0x5083('0xa')]));require(_0x5083('0xd'))[_0x5083('0xe')](socket);function respondWithRpcPromise(_0x5f30b3,_0x2c01a1,_0x2059e6){return new BPromise(function(_0x344b07,_0x583b4d){return client[_0x5083('0xf')](_0x5f30b3,_0x2059e6)[_0x5083('0x10')](function(_0x488f26){logger['info'](_0x5083('0x11'),_0x2c01a1,_0x5083('0x12'));logger['debug'](_0x5083('0x13'),_0x2c01a1,_0x5083('0x12'),JSON[_0x5083('0x14')](_0x488f26));if(_0x488f26[_0x5083('0x15')]){if(_0x488f26['error']['code']===0x1f4){logger[_0x5083('0x15')](_0x5083('0x11'),_0x2c01a1,_0x488f26[_0x5083('0x15')]['message']);return _0x583b4d(_0x488f26['error'][_0x5083('0x16')]);}logger[_0x5083('0x15')](_0x5083('0x11'),_0x2c01a1,_0x488f26[_0x5083('0x15')][_0x5083('0x16')]);return _0x344b07(_0x488f26[_0x5083('0x15')][_0x5083('0x16')]);}else{logger[_0x5083('0x17')]('ChatMessage,\x20%s,\x20%s',_0x2c01a1,_0x5083('0x12'));_0x344b07(_0x488f26[_0x5083('0x18')][_0x5083('0x16')]);}})['catch'](function(_0x4c762d){logger['error']('ChatMessage,\x20%s,\x20%s',_0x2c01a1,_0x4c762d);_0x583b4d(_0x4c762d);});});}exports[_0x5083('0x19')]=function(_0x494783){var _0x5d5ca4=this;return new Promise(function(_0x53251b,_0x19cf2c){return db[_0x5083('0x1a')][_0x5083('0x1b')](_0x494783[_0x5083('0x1c')],{'raw':_0x494783[_0x5083('0x1d')]?_0x494783[_0x5083('0x1d')][_0x5083('0x1e')]===undefined?!![]:![]:!![]})[_0x5083('0x10')](function(_0x2c282d){logger[_0x5083('0x17')](_0x5083('0x19'),_0x494783);logger[_0x5083('0x1f')](_0x5083('0x19'),_0x494783,JSON['stringify'](_0x2c282d));_0x53251b(_0x2c282d);})['catch'](function(_0x1e1fd9){logger['error'](_0x5083('0x19'),_0x1e1fd9['message'],_0x494783);_0x19cf2c(_0x5d5ca4[_0x5083('0x15')](0x1f4,_0x1e1fd9[_0x5083('0x16')]));});});}; \ No newline at end of file +var _0x53fa=['redis','localhost','socket.io-emitter','./chatMessage.socket','request','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatMessage,\x20%s,\x20%s','message','info','result','catch','CreateChatMessage','ChatMessage','body','options','raw','then','lodash','util','bluebird','randomstring','rpc','../../config/environment','http'];(function(_0x242de6,_0x22ecad){var _0x7cb5a6=function(_0x466591){while(--_0x466591){_0x242de6['push'](_0x242de6['shift']());}};_0x7cb5a6(++_0x22ecad);}(_0x53fa,0x1ac));var _0xa53f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x53fa[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa53f('0x0'));var util=require(_0xa53f('0x1'));var moment=require('moment');var BPromise=require(_0xa53f('0x2'));var rs=require(_0xa53f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa53f('0x4'));var config=require(_0xa53f('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0xa53f('0x6')]({'port':0x232a});config[_0xa53f('0x7')]=_['defaults'](config[_0xa53f('0x7')],{'host':_0xa53f('0x8'),'port':0x18eb});var socket=require(_0xa53f('0x9'))(new Redis(config[_0xa53f('0x7')]));require(_0xa53f('0xa'))['register'](socket);function respondWithRpcPromise(_0x2cbdcf,_0x325f0c,_0x56d54e){return new BPromise(function(_0x83d645,_0x57fbe2){return client[_0xa53f('0xb')](_0x2cbdcf,_0x56d54e)['then'](function(_0x55e2ef){logger['info']('ChatMessage,\x20%s,\x20%s',_0x325f0c,_0xa53f('0xc'));logger[_0xa53f('0xd')](_0xa53f('0xe'),_0x325f0c,'request\x20sent',JSON[_0xa53f('0xf')](_0x55e2ef));if(_0x55e2ef[_0xa53f('0x10')]){if(_0x55e2ef[_0xa53f('0x10')][_0xa53f('0x11')]===0x1f4){logger['error'](_0xa53f('0x12'),_0x325f0c,_0x55e2ef['error']['message']);return _0x57fbe2(_0x55e2ef[_0xa53f('0x10')]['message']);}logger[_0xa53f('0x10')](_0xa53f('0x12'),_0x325f0c,_0x55e2ef[_0xa53f('0x10')][_0xa53f('0x13')]);return _0x83d645(_0x55e2ef[_0xa53f('0x10')][_0xa53f('0x13')]);}else{logger[_0xa53f('0x14')](_0xa53f('0x12'),_0x325f0c,_0xa53f('0xc'));_0x83d645(_0x55e2ef[_0xa53f('0x15')][_0xa53f('0x13')]);}})[_0xa53f('0x16')](function(_0x4d1a92){logger[_0xa53f('0x10')](_0xa53f('0x12'),_0x325f0c,_0x4d1a92);_0x57fbe2(_0x4d1a92);});});}exports[_0xa53f('0x17')]=function(_0x33c57e){var _0x5d0215=this;return new Promise(function(_0x2274ba,_0x1d6aa7){return db[_0xa53f('0x18')]['create'](_0x33c57e[_0xa53f('0x19')],{'raw':_0x33c57e[_0xa53f('0x1a')]?_0x33c57e[_0xa53f('0x1a')][_0xa53f('0x1b')]===undefined?!![]:![]:!![]})[_0xa53f('0x1c')](function(_0x138c69){logger[_0xa53f('0x14')]('CreateChatMessage',_0x33c57e);logger[_0xa53f('0xd')](_0xa53f('0x17'),_0x33c57e,JSON[_0xa53f('0xf')](_0x138c69));_0x2274ba(_0x138c69);})['catch'](function(_0x3c1546){logger[_0xa53f('0x10')](_0xa53f('0x17'),_0x3c1546[_0xa53f('0x13')],_0x33c57e);_0x1d6aa7(_0x5d0215['error'](0x1f4,_0x3c1546[_0xa53f('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 2a6c520..7199f08 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 _0x2caf=['removeListener','register','length','chatMessage:','update','emit'];(function(_0x1aa3fe,_0x27c5fa){var _0x163cee=function(_0x2a1505){while(--_0x2a1505){_0x1aa3fe['push'](_0x1aa3fe['shift']());}};_0x163cee(++_0x27c5fa);}(_0x2caf,0x6a));var _0xf2ca=function(_0x26dee2,_0x574477){_0x26dee2=_0x26dee2-0x0;var _0x3eaeaa=_0x2caf[_0x26dee2];return _0x3eaeaa;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=['save','remove',_0xf2ca('0x0')];function createListener(_0x53a64f,_0x3b2612){return function(_0x36e439){_0x3b2612[_0xf2ca('0x1')](_0x53a64f,_0x36e439);};}function removeListener(_0x375e8b,_0x137501){return function(){ChatMessageEvents[_0xf2ca('0x2')](_0x375e8b,_0x137501);};}exports[_0xf2ca('0x3')]=function(_0x51372a){for(var _0x8ce770=0x0,_0x4292b4=events[_0xf2ca('0x4')];_0x8ce770<_0x4292b4;_0x8ce770++){var _0x57e3e8=events[_0x8ce770];var _0x4ea38c=createListener(_0xf2ca('0x5')+_0x57e3e8,_0x51372a);ChatMessageEvents['on'](_0x57e3e8,_0x4ea38c);}}; \ No newline at end of file +var _0x24ca=['removeListener','register','length','chatMessage:','./chatMessage.events','remove','update','emit'];(function(_0x461886,_0x4fc171){var _0x295e0a=function(_0x451524){while(--_0x451524){_0x461886['push'](_0x461886['shift']());}};_0x295e0a(++_0x4fc171);}(_0x24ca,0x1bc));var _0xa24c=function(_0xc8db6b,_0x320abd){_0xc8db6b=_0xc8db6b-0x0;var _0x12cb81=_0x24ca[_0xc8db6b];return _0x12cb81;};'use strict';var ChatMessageEvents=require(_0xa24c('0x0'));var events=['save',_0xa24c('0x1'),_0xa24c('0x2')];function createListener(_0x4defb1,_0x5876d6){return function(_0x18497e){_0x5876d6[_0xa24c('0x3')](_0x4defb1,_0x18497e);};}function removeListener(_0x195e60,_0x28aa2f){return function(){ChatMessageEvents[_0xa24c('0x4')](_0x195e60,_0x28aa2f);};}exports[_0xa24c('0x5')]=function(_0xf0511){for(var _0x3c0aaa=0x0,_0x2dd348=events[_0xa24c('0x6')];_0x3c0aaa<_0x2dd348;_0x3c0aaa++){var _0x9a5013=events[_0x3c0aaa];var _0x481196=createListener(_0xa24c('0x7')+_0x9a5013,_0xf0511);ChatMessageEvents['on'](_0x9a5013,_0x481196);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index c132393..567cec5 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 _0xea18=['tracked','chat','chatmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util','path','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x55e5b9,_0x1be20e){var _0x58d1e7=function(_0x3cba6d){while(--_0x3cba6d){_0x55e5b9['push'](_0x55e5b9['shift']());}};_0x58d1e7(++_0x1be20e);}(_0xea18,0x150));var _0x8ea1=function(_0x1275c8,_0x1d4a25){_0x1275c8=_0x1275c8-0x0;var _0x44637a=_0xea18[_0x1275c8];return _0x44637a;};'use strict';var multer=require(_0x8ea1('0x0'));var util=require(_0x8ea1('0x1'));var path=require(_0x8ea1('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8ea1('0x3')]();var fs_extra=require(_0x8ea1('0x4'));var auth=require(_0x8ea1('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8ea1('0x6'));var controller=require('./chatMessage.controller');router[_0x8ea1('0x7')]('/',auth[_0x8ea1('0x8')](),controller[_0x8ea1('0x9')]);router[_0x8ea1('0x7')](_0x8ea1('0xa'),auth[_0x8ea1('0x8')](),controller[_0x8ea1('0xb')]);router[_0x8ea1('0x7')](_0x8ea1('0xc'),auth['isAuthenticated'](),controller[_0x8ea1('0xd')]);router[_0x8ea1('0xe')]('/',auth[_0x8ea1('0x8')](),interaction[_0x8ea1('0xf')](_0x8ea1('0x10'),_0x8ea1('0x11')),controller[_0x8ea1('0x12')]);router[_0x8ea1('0x13')]('/:id',controller[_0x8ea1('0x14')]);router[_0x8ea1('0x13')](_0x8ea1('0x15'),auth[_0x8ea1('0x8')](),controller[_0x8ea1('0x16')]);router[_0x8ea1('0x13')](_0x8ea1('0x17'),auth[_0x8ea1('0x8')](),controller[_0x8ea1('0x18')]);router[_0x8ea1('0x19')](_0x8ea1('0xc'),auth['isAuthenticated'](),controller[_0x8ea1('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x058a=['../../components/auth/service','./chatMessage.controller','get','isAuthenticated','index','/describe','describe','show','post','tracked','create','put','/:id','update','/:id/accept','accept','reject','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x102b0c,_0x33dee4){var _0x9b15ca=function(_0x42d504){while(--_0x42d504){_0x102b0c['push'](_0x102b0c['shift']());}};_0x9b15ca(++_0x33dee4);}(_0x058a,0x180));var _0xa058=function(_0x2a0007,_0x15c8f3){_0x2a0007=_0x2a0007-0x0;var _0x2b4244=_0x058a[_0x2a0007];return _0x2b4244;};'use strict';var multer=require('multer');var util=require(_0xa058('0x0'));var path=require(_0xa058('0x1'));var timeout=require(_0xa058('0x2'));var express=require(_0xa058('0x3'));var router=express[_0xa058('0x4')]();var fs_extra=require(_0xa058('0x5'));var auth=require(_0xa058('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa058('0x7'));router[_0xa058('0x8')]('/',auth[_0xa058('0x9')](),controller[_0xa058('0xa')]);router[_0xa058('0x8')](_0xa058('0xb'),auth[_0xa058('0x9')](),controller[_0xa058('0xc')]);router[_0xa058('0x8')]('/:id',auth[_0xa058('0x9')](),controller[_0xa058('0xd')]);router[_0xa058('0xe')]('/',auth['isAuthenticated'](),interaction[_0xa058('0xf')]('chat','chatmessage:create'),controller[_0xa058('0x10')]);router[_0xa058('0x11')](_0xa058('0x12'),controller[_0xa058('0x13')]);router[_0xa058('0x11')](_0xa058('0x14'),auth['isAuthenticated'](),controller[_0xa058('0x15')]);router[_0xa058('0x11')]('/:id/reject',auth['isAuthenticated'](),controller[_0xa058('0x16')]);router[_0xa058('0x17')](_0xa058('0x12'),auth['isAuthenticated'](),controller[_0xa058('0x18')]);module[_0xa058('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 1a0ff38..0bf977f 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 _0x5f66=['medium','TEXT','exports'];(function(_0x4a07df,_0x35c682){var _0x104c21=function(_0x5c606c){while(--_0x5c606c){_0x4a07df['push'](_0x4a07df['shift']());}};_0x104c21(++_0x35c682);}(_0x5f66,0x1a0));var _0x65f6=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x5f66[_0x5d4607];return _0x5e4a86;};'use strict';var Sequelize=require('sequelize');module[_0x65f6('0x0')]={'body':{'type':Sequelize['TEXT'](_0x65f6('0x1')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x65f6('0x2')](_0x65f6('0x1')),'allowNull':![]}}; \ No newline at end of file +var _0x2032=['medium','exports','TEXT'];(function(_0x467e39,_0x54a12e){var _0x3d4c8e=function(_0x517c1f){while(--_0x517c1f){_0x467e39['push'](_0x467e39['shift']());}};_0x3d4c8e(++_0x54a12e);}(_0x2032,0xd9));var _0x2203=function(_0x4bc004,_0x15ce2d){_0x4bc004=_0x4bc004-0x0;var _0x115da2=_0x2032[_0x4bc004];return _0x115da2;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'body':{'type':Sequelize[_0x2203('0x1')](_0x2203('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x2203('0x2')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 3844e42..5b0b010 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(_0x1a68ba,_0x5edb89){var _0x227053=function(_0x17c9ee){while(--_0x17c9ee){_0x1a68ba['push'](_0x1a68ba['shift']());}};_0x227053(++_0x5edb89);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file +var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0x7a54,0x106));var _0x47a5=function(_0x4b2a2,_0x558e1a){_0x4b2a2=_0x4b2a2-0x0;var _0x4b66ad=_0x7a54[_0x4b2a2];return _0x4b66ad;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.events.js b/server/api/chatOfflineMessage/chatOfflineMessage.events.js index 79548d3..2ea12f1 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.events.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1c55=['emit','../../mysqldb','ChatOfflineMessage','save','update'];(function(_0xd7fc59,_0x476659){var _0x43daa0=function(_0x357fd3){while(--_0x357fd3){_0xd7fc59['push'](_0xd7fc59['shift']());}};_0x43daa0(++_0x476659);}(_0x1c55,0x11e));var _0x51c5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1c55[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require('events');var ChatOfflineMessage=require(_0x51c5('0x0'))['db'][_0x51c5('0x1')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x51c5('0x2'),'afterUpdate':_0x51c5('0x3'),'afterDestroy':'remove'};function emitEvent(_0x3ae55a){return function(_0x11053b,_0x18aa0c,_0x161d84){ChatOfflineMessageEvents['emit'](_0x3ae55a+':'+_0x11053b['id'],_0x11053b);ChatOfflineMessageEvents[_0x51c5('0x4')](_0x3ae55a,_0x11053b);_0x161d84(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatOfflineMessage['hook'](e,emitEvent(event));}}module['exports']=ChatOfflineMessageEvents; \ No newline at end of file +var _0x4969=['setMaxListeners','save','hasOwnProperty','hook','exports','../../mysqldb','ChatOfflineMessage'];(function(_0x5b5c45,_0x199467){var _0x2cd0dd=function(_0x3f3266){while(--_0x3f3266){_0x5b5c45['push'](_0x5b5c45['shift']());}};_0x2cd0dd(++_0x199467);}(_0x4969,0x1da));var _0x9496=function(_0x221ba2,_0x79208){_0x221ba2=_0x221ba2-0x0;var _0x47d08e=_0x4969[_0x221ba2];return _0x47d08e;};'use strict';var EventEmitter=require('events');var ChatOfflineMessage=require(_0x9496('0x0'))['db'][_0x9496('0x1')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x9496('0x2')](0x0);var events={'afterCreate':_0x9496('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x57c8a2){return function(_0x4cb924,_0x46385d,_0x26ac20){ChatOfflineMessageEvents['emit'](_0x57c8a2+':'+_0x4cb924['id'],_0x4cb924);ChatOfflineMessageEvents['emit'](_0x57c8a2,_0x4cb924);_0x26ac20(null);};}for(var e in events){if(events[_0x9496('0x4')](e)){var event=events[e];ChatOfflineMessage[_0x9496('0x5')](e,emitEvent(event));}}module[_0x9496('0x6')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 6a5920f..2dfaef1 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 _0x6e39=['exports','define','ChatOfflineMessage','chat_offline_messages','utf8mb4','./chatOfflineMessage.attributes'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x6e39,0xd7));var _0x96e3=function(_0x19a107,_0x3d70ab){_0x19a107=_0x19a107-0x0;var _0x3a3332=_0x6e39[_0x19a107];return _0x3a3332;};'use strict';var attributes=require(_0x96e3('0x0'));module[_0x96e3('0x1')]=function(_0xe20aa2){return _0xe20aa2[_0x96e3('0x2')](_0x96e3('0x3'),attributes,{'tableName':_0x96e3('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x96e3('0x5'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x7072=['exports','define','ChatOfflineMessage','utf8mb4_unicode_ci'];(function(_0x6469e9,_0x42a60b){var _0x3cc75e=function(_0x227665){while(--_0x227665){_0x6469e9['push'](_0x6469e9['shift']());}};_0x3cc75e(++_0x42a60b);}(_0x7072,0xc4));var _0x2707=function(_0x2283dc,_0x2fcfc5){_0x2283dc=_0x2283dc-0x0;var _0x16db90=_0x7072[_0x2283dc];return _0x16db90;};'use strict';var attributes=require('./chatOfflineMessage.attributes');module[_0x2707('0x0')]=function(_0x2eded2){return _0x2eded2[_0x2707('0x1')](_0x2707('0x2'),attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x2707('0x3')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index eae4009..da0b6a8 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 _0x28e8=['ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x41b6ba,_0x20e996){var _0x451a0a=function(_0x15866f){while(--_0x15866f){_0x41b6ba['push'](_0x41b6ba['shift']());}};_0x451a0a(++_0x20e996);}(_0x28e8,0x1e0));var _0x828e=function(_0x5911cb,_0x5202cf){_0x5911cb=_0x5911cb-0x0;var _0x49506f=_0x28e8[_0x5911cb];return _0x49506f;};'use strict';var _=require(_0x828e('0x0'));var util=require('util');var moment=require(_0x828e('0x1'));var BPromise=require(_0x828e('0x2'));var rs=require(_0x828e('0x3'));var fs=require('fs');var Redis=require(_0x828e('0x4'));var db=require(_0x828e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x828e('0x6'))('rpc');var config=require(_0x828e('0x7'));var jayson=require(_0x828e('0x8'));var client=jayson[_0x828e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3db8f7,_0x3008e9,_0x36d496){return new BPromise(function(_0x24afbc,_0x21a8f0){return client[_0x828e('0xa')](_0x3db8f7,_0x36d496)[_0x828e('0xb')](function(_0x16f441){logger[_0x828e('0xc')](_0x828e('0xd'),_0x3008e9,_0x828e('0xe'));logger[_0x828e('0xf')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x3008e9,_0x828e('0xe'),JSON[_0x828e('0x10')](_0x16f441));if(_0x16f441[_0x828e('0x11')]){if(_0x16f441[_0x828e('0x11')][_0x828e('0x12')]===0x1f4){logger[_0x828e('0x11')](_0x828e('0xd'),_0x3008e9,_0x16f441[_0x828e('0x11')][_0x828e('0x13')]);return _0x21a8f0(_0x16f441['error'][_0x828e('0x13')]);}logger[_0x828e('0x11')](_0x828e('0xd'),_0x3008e9,_0x16f441['error']['message']);return _0x24afbc(_0x16f441['error']['message']);}else{logger[_0x828e('0xc')](_0x828e('0xd'),_0x3008e9,'request\x20sent');_0x24afbc(_0x16f441[_0x828e('0x14')]['message']);}})[_0x828e('0x15')](function(_0x3e6b8c){logger['error'](_0x828e('0xd'),_0x3008e9,_0x3e6b8c);_0x21a8f0(_0x3e6b8c);});});} \ No newline at end of file +var _0xdb1e=['../../config/environment','client','request','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','ChatOfflineMessage,\x20%s,\x20%s','message','result','catch','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x532875,_0x1ca8c3){var _0x5a47f7=function(_0x208d84){while(--_0x208d84){_0x532875['push'](_0x532875['shift']());}};_0x5a47f7(++_0x1ca8c3);}(_0xdb1e,0xc6));var _0xedb1=function(_0x1680cf,_0x2af10a){_0x1680cf=_0x1680cf-0x0;var _0x34d4e8=_0xdb1e[_0x1680cf];return _0x34d4e8;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xedb1('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xedb1('0x1'));var db=require(_0xedb1('0x2'))['db'];var utils=require(_0xedb1('0x3'));var logger=require(_0xedb1('0x4'))(_0xedb1('0x5'));var config=require(_0xedb1('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xedb1('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x223e8,_0x38d840,_0x5e3a02){return new BPromise(function(_0x2bddcd,_0x17516b){return client[_0xedb1('0x8')](_0x223e8,_0x5e3a02)['then'](function(_0x1584a1){logger['info']('ChatOfflineMessage,\x20%s,\x20%s',_0x38d840,'request\x20sent');logger[_0xedb1('0x9')](_0xedb1('0xa'),_0x38d840,'request\x20sent',JSON[_0xedb1('0xb')](_0x1584a1));if(_0x1584a1[_0xedb1('0xc')]){if(_0x1584a1['error']['code']===0x1f4){logger[_0xedb1('0xc')](_0xedb1('0xd'),_0x38d840,_0x1584a1[_0xedb1('0xc')][_0xedb1('0xe')]);return _0x17516b(_0x1584a1[_0xedb1('0xc')][_0xedb1('0xe')]);}logger[_0xedb1('0xc')]('ChatOfflineMessage,\x20%s,\x20%s',_0x38d840,_0x1584a1[_0xedb1('0xc')][_0xedb1('0xe')]);return _0x2bddcd(_0x1584a1[_0xedb1('0xc')][_0xedb1('0xe')]);}else{logger['info'](_0xedb1('0xd'),_0x38d840,'request\x20sent');_0x2bddcd(_0x1584a1[_0xedb1('0xf')]['message']);}})[_0xedb1('0x10')](function(_0x3ad23c){logger[_0xedb1('0xc')](_0xedb1('0xd'),_0x38d840,_0x3ad23c);_0x17516b(_0x3ad23c);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 8da6093..e13bd13 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 _0x818d=['/describe','/:id','isAuthenticated','show','post','create','put','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatOfflineMessage.controller','get'];(function(_0x29c7d9,_0x4379b6){var _0x4b3432=function(_0x493139){while(--_0x493139){_0x29c7d9['push'](_0x29c7d9['shift']());}};_0x4b3432(++_0x4379b6);}(_0x818d,0x1e4));var _0xd818=function(_0x4776cc,_0x3a715e){_0x4776cc=_0x4776cc-0x0;var _0x427bda=_0x818d[_0x4776cc];return _0x427bda;};'use strict';var multer=require('multer');var util=require(_0xd818('0x0'));var path=require(_0xd818('0x1'));var timeout=require(_0xd818('0x2'));var express=require(_0xd818('0x3'));var router=express[_0xd818('0x4')]();var fs_extra=require(_0xd818('0x5'));var auth=require(_0xd818('0x6'));var interaction=require(_0xd818('0x7'));var config=require('../../config/environment');var controller=require(_0xd818('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xd818('0x9')](_0xd818('0xa'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xd818('0xb'),auth[_0xd818('0xc')](),controller[_0xd818('0xd')]);router[_0xd818('0xe')]('/',auth[_0xd818('0xc')](),controller[_0xd818('0xf')]);router[_0xd818('0x10')](_0xd818('0xb'),auth[_0xd818('0xc')](),controller['update']);router[_0xd818('0x11')](_0xd818('0xb'),auth[_0xd818('0xc')](),controller[_0xd818('0x12')]);module['exports']=router; \ No newline at end of file +var _0x4588=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','destroy','exports','multer','connect-timeout','express','fs-extra'];(function(_0x4a393d,_0x3447ea){var _0x1d57f5=function(_0x331e43){while(--_0x331e43){_0x4a393d['push'](_0x4a393d['shift']());}};_0x1d57f5(++_0x3447ea);}(_0x4588,0x1d7));var _0x8458=function(_0x3792e6,_0x32bd91){_0x3792e6=_0x3792e6-0x0;var _0x441e44=_0x4588[_0x3792e6];return _0x441e44;};'use strict';var multer=require(_0x8458('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x8458('0x1'));var express=require(_0x8458('0x2'));var router=express['Router']();var fs_extra=require(_0x8458('0x3'));var auth=require(_0x8458('0x4'));var interaction=require(_0x8458('0x5'));var config=require(_0x8458('0x6'));var controller=require('./chatOfflineMessage.controller');router[_0x8458('0x7')]('/',auth[_0x8458('0x8')](),controller[_0x8458('0x9')]);router[_0x8458('0x7')](_0x8458('0xa'),auth[_0x8458('0x8')](),controller[_0x8458('0xb')]);router['get'](_0x8458('0xc'),auth['isAuthenticated'](),controller[_0x8458('0xd')]);router[_0x8458('0xe')]('/',auth[_0x8458('0x8')](),controller[_0x8458('0xf')]);router['put'](_0x8458('0xc'),auth['isAuthenticated'](),controller[_0x8458('0x10')]);router['delete'](_0x8458('0xc'),auth['isAuthenticated'](),controller[_0x8458('0x11')]);module[_0x8458('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index a301c41..1025bc0 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 _0x8073=['sequelize','exports','STRING','ENUM','mouseOver','timeout'];(function(_0x34e311,_0x5ba39a){var _0x23abf8=function(_0x44c385){while(--_0x44c385){_0x34e311['push'](_0x34e311['shift']());}};_0x23abf8(++_0x5ba39a);}(_0x8073,0xcc));var _0x3807=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x8073[_0x1d1779];return _0x2377e9;};'use strict';var Sequelize=require(_0x3807('0x0'));module[_0x3807('0x1')]={'name':{'type':Sequelize[_0x3807('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x3807('0x3')](_0x3807('0x4'),_0x3807('0x5')),'defaultValue':_0x3807('0x4')},'selector':{'type':Sequelize[_0x3807('0x2')]},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x462c=['INTEGER','sequelize','exports','STRING','mouseOver','timeout'];(function(_0x18afca,_0x4219d9){var _0x11603f=function(_0x21d5d1){while(--_0x21d5d1){_0x18afca['push'](_0x18afca['shift']());}};_0x11603f(++_0x4219d9);}(_0x462c,0x169));var _0xc462=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x462c[_0x5ddb1c];return _0x354adc;};'use strict';var Sequelize=require(_0xc462('0x0'));module[_0xc462('0x1')]={'name':{'type':Sequelize[_0xc462('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xc462('0x3'),_0xc462('0x4')),'defaultValue':_0xc462('0x3')},'selector':{'type':Sequelize[_0xc462('0x2')]},'timeout':{'type':Sequelize[_0xc462('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index b59037e..39c2d9d 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 _0x14f5=['sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','set','Content-Range','reject','update','destroy','then','error','stack','name','send','show','model','keys','ChatProactiveAction','rawAttributes','query','filters','attributes','intersection','length','includeAll','include','merge','options','create','body','catch','find','params','rimraf','fast-json-patch','request-promise','moment','mustache','util'];(function(_0x3a07c1,_0x34d57f){var _0x2bbe15=function(_0x5a02fb){while(--_0x5a02fb){_0x3a07c1['push'](_0x3a07c1['shift']());}};_0x2bbe15(++_0x34d57f);}(_0x14f5,0xae));var _0x514f=function(_0x5ea79f,_0x46484e){_0x5ea79f=_0x5ea79f-0x0;var _0xed70c8=_0x14f5[_0x5ea79f];return _0xed70c8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x514f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x514f('0x1'));var rp=require(_0x514f('0x2'));var moment=require(_0x514f('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x514f('0x4'));var util=require(_0x514f('0x5'));var path=require('path');var sox=require(_0x514f('0x6'));var csv=require(_0x514f('0x7'));var ejs=require(_0x514f('0x8'));var fs=require('fs');var fs_extra=require(_0x514f('0x9'));var _=require(_0x514f('0xa'));var squel=require(_0x514f('0xb'));var crypto=require(_0x514f('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x514f('0xd'));var toCsv=require('to-csv');var querystring=require(_0x514f('0xe'));var Papa=require(_0x514f('0xf'));var Redis=require(_0x514f('0x10'));var authService=require(_0x514f('0x11'));var qs=require(_0x514f('0x12'));var as=require(_0x514f('0x13'));var hardwareService=require(_0x514f('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x514f('0x15'));var licenseUtil=require(_0x514f('0x16'));var db=require(_0x514f('0x17'))['db'];function respondWithStatusCode(_0x321914,_0x3eed49){_0x3eed49=_0x3eed49||0xcc;return function(_0x2ed1b7){if(_0x2ed1b7){return _0x321914[_0x514f('0x18')](_0x3eed49);}return _0x321914[_0x514f('0x19')](_0x3eed49)[_0x514f('0x1a')]();};}function respondWithResult(_0x4124bf,_0x46e552){_0x46e552=_0x46e552||0xc8;return function(_0x3fc905){if(_0x3fc905){return _0x4124bf[_0x514f('0x19')](_0x46e552)[_0x514f('0x1b')](_0x3fc905);}};}function respondWithFilteredResult(_0x1694b3,_0x5865d1){return function(_0x70d2b4){if(_0x70d2b4){var _0x1f0cbe=typeof _0x5865d1['offset']===_0x514f('0x1c')&&typeof _0x5865d1['limit']===_0x514f('0x1c');var _0x309ce0=_0x70d2b4[_0x514f('0x1d')];var _0x5a5641=_0x1f0cbe?0x0:_0x5865d1[_0x514f('0x1e')];var _0x3673a4=_0x1f0cbe?_0x70d2b4[_0x514f('0x1d')]:_0x5865d1[_0x514f('0x1e')]+_0x5865d1['limit'];var _0x4f9193;if(_0x3673a4>=_0x309ce0){_0x3673a4=_0x309ce0;_0x4f9193=0xc8;}else{_0x4f9193=0xce;}_0x1694b3[_0x514f('0x19')](_0x4f9193);return _0x1694b3[_0x514f('0x1f')](_0x514f('0x20'),_0x5a5641+'-'+_0x3673a4+'/'+_0x309ce0)['json'](_0x70d2b4);}return null;};}function patchUpdates(_0x43fcf9){return function(_0x7248e8){try{jsonpatch['apply'](_0x7248e8,_0x43fcf9,!![]);}catch(_0x186417){return BPromise[_0x514f('0x21')](_0x186417);}return _0x7248e8['save']();};}function saveUpdates(_0xd093a1,_0x18a430){return function(_0xd89aa2){if(_0xd89aa2){return _0xd89aa2[_0x514f('0x22')](_0xd093a1)['then'](function(_0x58861e){return _0x58861e;});}return null;};}function removeEntity(_0x4b0245,_0x5d80cb){return function(_0x1c16f9){if(_0x1c16f9){return _0x1c16f9[_0x514f('0x23')]()[_0x514f('0x24')](function(){_0x4b0245[_0x514f('0x19')](0xcc)[_0x514f('0x1a')]();});}};}function handleEntityNotFound(_0x26df04,_0x2c6bb1){return function(_0x101742){if(!_0x101742){_0x26df04[_0x514f('0x18')](0x194);}return _0x101742;};}function handleError(_0x5f2da2,_0x8c8bdf){_0x8c8bdf=_0x8c8bdf||0x1f4;return function(_0x37b3db){logger[_0x514f('0x25')](_0x37b3db[_0x514f('0x26')]);if(_0x37b3db[_0x514f('0x27')]){delete _0x37b3db[_0x514f('0x27')];}_0x5f2da2[_0x514f('0x19')](_0x8c8bdf)[_0x514f('0x28')](_0x37b3db);};}exports[_0x514f('0x29')]=function(_0x594a50,_0x2c4c4b){var _0x488c17={'raw':!![],'where':{'id':_0x594a50['params']['id']}},_0x2b43e0={};_0x2b43e0[_0x514f('0x2a')]=_[_0x514f('0x2b')](db[_0x514f('0x2c')][_0x514f('0x2d')]);_0x2b43e0[_0x514f('0x2e')]=_['keys'](_0x594a50['query']);_0x2b43e0[_0x514f('0x2f')]=_['intersection'](_0x2b43e0[_0x514f('0x2a')],_0x2b43e0[_0x514f('0x2e')]);_0x488c17[_0x514f('0x30')]=_[_0x514f('0x31')](_0x2b43e0[_0x514f('0x2a')],qs['fields'](_0x594a50['query']['fields']));_0x488c17[_0x514f('0x30')]=_0x488c17[_0x514f('0x30')][_0x514f('0x32')]?_0x488c17[_0x514f('0x30')]:_0x2b43e0[_0x514f('0x2a')];if(_0x594a50[_0x514f('0x2e')][_0x514f('0x33')]){_0x488c17[_0x514f('0x34')]=[{'all':!![]}];}_0x488c17=_[_0x514f('0x35')]({},_0x488c17,_0x594a50[_0x514f('0x36')]);return db['ChatProactiveAction']['find'](_0x488c17)['then'](handleEntityNotFound(_0x2c4c4b,null))[_0x514f('0x24')](respondWithResult(_0x2c4c4b,null))['catch'](handleError(_0x2c4c4b,null));};exports[_0x514f('0x37')]=function(_0x50c120,_0x3aefc5){return db['ChatProactiveAction']['create'](_0x50c120[_0x514f('0x38')],{})['then'](respondWithResult(_0x3aefc5,0xc9))[_0x514f('0x39')](handleError(_0x3aefc5,null));};exports[_0x514f('0x22')]=function(_0x2cea89,_0x1696a2){if(_0x2cea89[_0x514f('0x38')]['id']){delete _0x2cea89['body']['id'];}return db[_0x514f('0x2c')][_0x514f('0x3a')]({'where':{'id':_0x2cea89[_0x514f('0x3b')]['id']}})[_0x514f('0x24')](handleEntityNotFound(_0x1696a2,null))['then'](saveUpdates(_0x2cea89[_0x514f('0x38')],null))[_0x514f('0x24')](respondWithResult(_0x1696a2,null))[_0x514f('0x39')](handleError(_0x1696a2,null));};exports[_0x514f('0x23')]=function(_0x51b24a,_0x1c1a24){return db[_0x514f('0x2c')][_0x514f('0x3a')]({'where':{'id':_0x51b24a[_0x514f('0x3b')]['id']}})['then'](handleEntityNotFound(_0x1c1a24,null))[_0x514f('0x24')](removeEntity(_0x1c1a24,null))['catch'](handleError(_0x1c1a24,null));}; \ No newline at end of file +var _0x8ece=['apply','save','update','destroy','then','error','stack','name','send','show','params','keys','rawAttributes','query','filters','model','attributes','fields','length','includeAll','merge','options','ChatProactiveAction','create','body','catch','find','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','set','Content-Range'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x8ece,0x195));var _0xe8ec=function(_0x4f2530,_0x5c0bb5){_0x4f2530=_0x4f2530-0x0;var _0x4a9e71=_0x8ece[_0x4f2530];return _0x4a9e71;};'use strict';var emlformat=require(_0xe8ec('0x0'));var rimraf=require(_0xe8ec('0x1'));var zipdir=require(_0xe8ec('0x2'));var jsonpatch=require(_0xe8ec('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe8ec('0x4'));var Mustache=require(_0xe8ec('0x5'));var util=require(_0xe8ec('0x6'));var path=require(_0xe8ec('0x7'));var sox=require(_0xe8ec('0x8'));var csv=require('to-csv');var ejs=require(_0xe8ec('0x9'));var fs=require('fs');var fs_extra=require(_0xe8ec('0xa'));var _=require(_0xe8ec('0xb'));var squel=require(_0xe8ec('0xc'));var crypto=require(_0xe8ec('0xd'));var jsforce=require(_0xe8ec('0xe'));var deskjs=require(_0xe8ec('0xf'));var toCsv=require('to-csv');var querystring=require(_0xe8ec('0x10'));var Papa=require('papaparse');var Redis=require(_0xe8ec('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xe8ec('0x12'));var as=require(_0xe8ec('0x13'));var hardwareService=require(_0xe8ec('0x14'));var logger=require(_0xe8ec('0x15'))(_0xe8ec('0x16'));var utils=require(_0xe8ec('0x17'));var config=require(_0xe8ec('0x18'));var licenseUtil=require(_0xe8ec('0x19'));var db=require(_0xe8ec('0x1a'))['db'];function respondWithStatusCode(_0x69a424,_0xf72aa7){_0xf72aa7=_0xf72aa7||0xcc;return function(_0x153203){if(_0x153203){return _0x69a424[_0xe8ec('0x1b')](_0xf72aa7);}return _0x69a424['status'](_0xf72aa7)[_0xe8ec('0x1c')]();};}function respondWithResult(_0x431723,_0x2e5a88){_0x2e5a88=_0x2e5a88||0xc8;return function(_0x167ebb){if(_0x167ebb){return _0x431723[_0xe8ec('0x1d')](_0x2e5a88)[_0xe8ec('0x1e')](_0x167ebb);}};}function respondWithFilteredResult(_0x1e76ac,_0x218a4b){return function(_0x531f69){if(_0x531f69){var _0x2e7c82=typeof _0x218a4b[_0xe8ec('0x1f')]===_0xe8ec('0x20')&&typeof _0x218a4b['limit']===_0xe8ec('0x20');var _0x20e847=_0x531f69[_0xe8ec('0x21')];var _0x34a582=_0x2e7c82?0x0:_0x218a4b[_0xe8ec('0x1f')];var _0x39e557=_0x2e7c82?_0x531f69[_0xe8ec('0x21')]:_0x218a4b[_0xe8ec('0x1f')]+_0x218a4b['limit'];var _0x11dbe0;if(_0x39e557>=_0x20e847){_0x39e557=_0x20e847;_0x11dbe0=0xc8;}else{_0x11dbe0=0xce;}_0x1e76ac[_0xe8ec('0x1d')](_0x11dbe0);return _0x1e76ac[_0xe8ec('0x22')](_0xe8ec('0x23'),_0x34a582+'-'+_0x39e557+'/'+_0x20e847)[_0xe8ec('0x1e')](_0x531f69);}return null;};}function patchUpdates(_0x3d6fbc){return function(_0xd5ccf5){try{jsonpatch[_0xe8ec('0x24')](_0xd5ccf5,_0x3d6fbc,!![]);}catch(_0x3a5d14){return BPromise['reject'](_0x3a5d14);}return _0xd5ccf5[_0xe8ec('0x25')]();};}function saveUpdates(_0x3fa53f,_0x3de125){return function(_0x31a97d){if(_0x31a97d){return _0x31a97d[_0xe8ec('0x26')](_0x3fa53f)['then'](function(_0x2e05d8){return _0x2e05d8;});}return null;};}function removeEntity(_0x78b6f4,_0x431af0){return function(_0x24260b){if(_0x24260b){return _0x24260b[_0xe8ec('0x27')]()[_0xe8ec('0x28')](function(){_0x78b6f4['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x457607,_0x1899d9){return function(_0x35af9b){if(!_0x35af9b){_0x457607[_0xe8ec('0x1b')](0x194);}return _0x35af9b;};}function handleError(_0xbec801,_0x3519a5){_0x3519a5=_0x3519a5||0x1f4;return function(_0x267356){logger[_0xe8ec('0x29')](_0x267356[_0xe8ec('0x2a')]);if(_0x267356[_0xe8ec('0x2b')]){delete _0x267356[_0xe8ec('0x2b')];}_0xbec801[_0xe8ec('0x1d')](_0x3519a5)[_0xe8ec('0x2c')](_0x267356);};}exports[_0xe8ec('0x2d')]=function(_0x1140d6,_0x5d6888){var _0x21badd={'raw':!![],'where':{'id':_0x1140d6[_0xe8ec('0x2e')]['id']}},_0x243904={};_0x243904['model']=_[_0xe8ec('0x2f')](db['ChatProactiveAction'][_0xe8ec('0x30')]);_0x243904[_0xe8ec('0x31')]=_[_0xe8ec('0x2f')](_0x1140d6[_0xe8ec('0x31')]);_0x243904[_0xe8ec('0x32')]=_['intersection'](_0x243904[_0xe8ec('0x33')],_0x243904[_0xe8ec('0x31')]);_0x21badd[_0xe8ec('0x34')]=_['intersection'](_0x243904[_0xe8ec('0x33')],qs['fields'](_0x1140d6[_0xe8ec('0x31')][_0xe8ec('0x35')]));_0x21badd[_0xe8ec('0x34')]=_0x21badd[_0xe8ec('0x34')][_0xe8ec('0x36')]?_0x21badd[_0xe8ec('0x34')]:_0x243904[_0xe8ec('0x33')];if(_0x1140d6[_0xe8ec('0x31')][_0xe8ec('0x37')]){_0x21badd['include']=[{'all':!![]}];}_0x21badd=_[_0xe8ec('0x38')]({},_0x21badd,_0x1140d6[_0xe8ec('0x39')]);return db[_0xe8ec('0x3a')]['find'](_0x21badd)[_0xe8ec('0x28')](handleEntityNotFound(_0x5d6888,null))[_0xe8ec('0x28')](respondWithResult(_0x5d6888,null))['catch'](handleError(_0x5d6888,null));};exports[_0xe8ec('0x3b')]=function(_0x5b638d,_0x1bd67e){return db[_0xe8ec('0x3a')]['create'](_0x5b638d[_0xe8ec('0x3c')],{})[_0xe8ec('0x28')](respondWithResult(_0x1bd67e,0xc9))[_0xe8ec('0x3d')](handleError(_0x1bd67e,null));};exports[_0xe8ec('0x26')]=function(_0x58eed6,_0x295cdb){if(_0x58eed6[_0xe8ec('0x3c')]['id']){delete _0x58eed6[_0xe8ec('0x3c')]['id'];}return db['ChatProactiveAction']['find']({'where':{'id':_0x58eed6[_0xe8ec('0x2e')]['id']}})[_0xe8ec('0x28')](handleEntityNotFound(_0x295cdb,null))[_0xe8ec('0x28')](saveUpdates(_0x58eed6[_0xe8ec('0x3c')],null))[_0xe8ec('0x28')](respondWithResult(_0x295cdb,null))[_0xe8ec('0x3d')](handleError(_0x295cdb,null));};exports[_0xe8ec('0x27')]=function(_0x47d68b,_0x3ab84e){return db['ChatProactiveAction'][_0xe8ec('0x3e')]({'where':{'id':_0x47d68b[_0xe8ec('0x2e')]['id']}})['then'](handleEntityNotFound(_0x3ab84e,null))['then'](removeEntity(_0x3ab84e,null))[_0xe8ec('0x3d')](handleError(_0x3ab84e,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index cade51d..0ebf696 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 _0x4500=['define','ChatProactiveAction','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./chatProactiveAction.attributes','exports'];(function(_0x4ea557,_0x41b5c4){var _0x4a6c3b=function(_0x5e28fc){while(--_0x5e28fc){_0x4ea557['push'](_0x4ea557['shift']());}};_0x4a6c3b(++_0x41b5c4);}(_0x4500,0xd4));var _0x0450=function(_0x578275,_0xe7ae46){_0x578275=_0x578275-0x0;var _0xf78041=_0x4500[_0x578275];return _0xf78041;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0450('0x0'))('api');var moment=require(_0x0450('0x1'));var BPromise=require('bluebird');var rp=require(_0x0450('0x2'));var fs=require('fs');var path=require(_0x0450('0x3'));var rimraf=require(_0x0450('0x4'));var config=require(_0x0450('0x5'));var attributes=require(_0x0450('0x6'));module[_0x0450('0x7')]=function(_0x6f23aa,_0x11521d){return _0x6f23aa[_0x0450('0x8')](_0x0450('0x9'),attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2069=['moment','bluebird','request-promise','rimraf','./chatProactiveAction.attributes','exports','ChatProactiveAction','chat_proactive_actions','lodash','util','../../config/logger','api'];(function(_0x3a4fa5,_0x1caf4f){var _0x5e3215=function(_0x598eed){while(--_0x598eed){_0x3a4fa5['push'](_0x3a4fa5['shift']());}};_0x5e3215(++_0x1caf4f);}(_0x2069,0x170));var _0x9206=function(_0x4ec1ec,_0xf2176a){_0x4ec1ec=_0x4ec1ec-0x0;var _0x401e7e=_0x2069[_0x4ec1ec];return _0x401e7e;};'use strict';var _=require(_0x9206('0x0'));var util=require(_0x9206('0x1'));var logger=require(_0x9206('0x2'))(_0x9206('0x3'));var moment=require(_0x9206('0x4'));var BPromise=require(_0x9206('0x5'));var rp=require(_0x9206('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9206('0x7'));var config=require('../../config/environment');var attributes=require(_0x9206('0x8'));module[_0x9206('0x9')]=function(_0x422a24,_0x3981fc){return _0x422a24['define'](_0x9206('0xa'),attributes,{'tableName':_0x9206('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index 03d27a1..f26f147 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 _0x72b4=['rpc','jayson/promise','http','then','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0xe299ae,_0x494c4b){var _0x258685=function(_0x598a46){while(--_0x598a46){_0xe299ae['push'](_0xe299ae['shift']());}};_0x258685(++_0x494c4b);}(_0x72b4,0x1c4));var _0x472b=function(_0x575d3d,_0x1b92d7){_0x575d3d=_0x575d3d-0x0;var _0x49e231=_0x72b4[_0x575d3d];return _0x49e231;};'use strict';var _=require(_0x472b('0x0'));var util=require(_0x472b('0x1'));var moment=require(_0x472b('0x2'));var BPromise=require(_0x472b('0x3'));var rs=require(_0x472b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x472b('0x5'))['db'];var utils=require(_0x472b('0x6'));var logger=require(_0x472b('0x7'))(_0x472b('0x8'));var config=require('../../config/environment');var jayson=require(_0x472b('0x9'));var client=jayson['client'][_0x472b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2aa8e8,_0x48614a,_0x5c39e2){return new BPromise(function(_0x38d27c,_0x49708e){return client['request'](_0x2aa8e8,_0x5c39e2)[_0x472b('0xb')](function(_0x22d0ce){logger['info'](_0x472b('0xc'),_0x48614a,_0x472b('0xd'));logger['debug']('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x48614a,_0x472b('0xd'),JSON[_0x472b('0xe')](_0x22d0ce));if(_0x22d0ce[_0x472b('0xf')]){if(_0x22d0ce[_0x472b('0xf')][_0x472b('0x10')]===0x1f4){logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x48614a,_0x22d0ce[_0x472b('0xf')][_0x472b('0x11')]);return _0x49708e(_0x22d0ce['error'][_0x472b('0x11')]);}logger[_0x472b('0xf')](_0x472b('0xc'),_0x48614a,_0x22d0ce['error']['message']);return _0x38d27c(_0x22d0ce[_0x472b('0xf')]['message']);}else{logger['info']('ChatProactiveAction,\x20%s,\x20%s',_0x48614a,_0x472b('0xd'));_0x38d27c(_0x22d0ce[_0x472b('0x12')][_0x472b('0x11')]);}})[_0x472b('0x13')](function(_0x377af2){logger['error'](_0x472b('0xc'),_0x48614a,_0x377af2);_0x49708e(_0x377af2);});});} \ No newline at end of file +var _0x5772=['ChatProactiveAction,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5772,0x1d3));var _0x2577=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0x5772[_0x521929];return _0x632436;};'use strict';var _=require(_0x2577('0x0'));var util=require(_0x2577('0x1'));var moment=require(_0x2577('0x2'));var BPromise=require('bluebird');var rs=require(_0x2577('0x3'));var fs=require('fs');var Redis=require(_0x2577('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2577('0x5'));var logger=require(_0x2577('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2577('0x7'));var client=jayson[_0x2577('0x8')][_0x2577('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2d829d,_0x618aea,_0x283f02){return new BPromise(function(_0x2cd138,_0x24e0aa){return client[_0x2577('0xa')](_0x2d829d,_0x283f02)[_0x2577('0xb')](function(_0x2eea19){logger[_0x2577('0xc')](_0x2577('0xd'),_0x618aea,_0x2577('0xe'));logger[_0x2577('0xf')](_0x2577('0x10'),_0x618aea,_0x2577('0xe'),JSON['stringify'](_0x2eea19));if(_0x2eea19[_0x2577('0x11')]){if(_0x2eea19['error']['code']===0x1f4){logger[_0x2577('0x11')]('ChatProactiveAction,\x20%s,\x20%s',_0x618aea,_0x2eea19[_0x2577('0x11')][_0x2577('0x12')]);return _0x24e0aa(_0x2eea19[_0x2577('0x11')][_0x2577('0x12')]);}logger[_0x2577('0x11')]('ChatProactiveAction,\x20%s,\x20%s',_0x618aea,_0x2eea19[_0x2577('0x11')][_0x2577('0x12')]);return _0x2cd138(_0x2eea19['error'][_0x2577('0x12')]);}else{logger['info'](_0x2577('0xd'),_0x618aea,_0x2577('0xe'));_0x2cd138(_0x2eea19[_0x2577('0x13')]['message']);}})[_0x2577('0x14')](function(_0xbb3d26){logger[_0x2577('0x11')]('ChatProactiveAction,\x20%s,\x20%s',_0x618aea,_0xbb3d26);_0x24e0aa(_0xbb3d26);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index a0153aa..f3c4d06 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 _0xbd51=['show','post','isAuthenticated','create','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','./chatProactiveAction.controller','get','/:id'];(function(_0x38e37d,_0x2bbc57){var _0x386053=function(_0x1f58c0){while(--_0x1f58c0){_0x38e37d['push'](_0x38e37d['shift']());}};_0x386053(++_0x2bbc57);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x3c68ad,_0x2f35d3){_0x3c68ad=_0x3c68ad-0x0;var _0x3ae640=_0xbd51[_0x3c68ad];return _0x3ae640;};'use strict';var multer=require(_0x1bd5('0x0'));var util=require('util');var path=require(_0x1bd5('0x1'));var timeout=require(_0x1bd5('0x2'));var express=require(_0x1bd5('0x3'));var router=express[_0x1bd5('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1bd5('0x5'));router[_0x1bd5('0x6')](_0x1bd5('0x7'),auth['isAuthenticated'](),controller[_0x1bd5('0x8')]);router[_0x1bd5('0x9')]('/',auth[_0x1bd5('0xa')](),controller[_0x1bd5('0xb')]);router[_0x1bd5('0xc')]('/:id',auth[_0x1bd5('0xa')](),controller['update']);router[_0x1bd5('0xd')](_0x1bd5('0x7'),auth[_0x1bd5('0xa')](),controller[_0x1bd5('0xe')]);module[_0x1bd5('0xf')]=router; \ No newline at end of file +var _0x33c5=['fs-extra','../../components/auth/service','../../components/interaction/service','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','util','path','express','Router'];(function(_0x59a802,_0x4f63d7){var _0x200655=function(_0x4b1245){while(--_0x4b1245){_0x59a802['push'](_0x59a802['shift']());}};_0x200655(++_0x4f63d7);}(_0x33c5,0xe6));var _0x533c=function(_0x46451c,_0x88ddd){_0x46451c=_0x46451c-0x0;var _0x12dce4=_0x33c5[_0x46451c];return _0x12dce4;};'use strict';var multer=require('multer');var util=require(_0x533c('0x0'));var path=require(_0x533c('0x1'));var timeout=require('connect-timeout');var express=require(_0x533c('0x2'));var router=express[_0x533c('0x3')]();var fs_extra=require(_0x533c('0x4'));var auth=require(_0x533c('0x5'));var interaction=require(_0x533c('0x6'));var config=require('../../config/environment');var controller=require(_0x533c('0x7'));router[_0x533c('0x8')](_0x533c('0x9'),auth[_0x533c('0xa')](),controller[_0x533c('0xb')]);router[_0x533c('0xc')]('/',auth[_0x533c('0xa')](),controller[_0x533c('0xd')]);router[_0x533c('0xe')](_0x533c('0x9'),auth[_0x533c('0xa')](),controller[_0x533c('0xf')]);router[_0x533c('0x10')](_0x533c('0x9'),auth[_0x533c('0xa')](),controller[_0x533c('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 7e138fd..9935dcc 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 _0xe8c5=['exports','STRING','INTEGER','ENUM','beepall','roundrobin'];(function(_0x4bd6a9,_0xad262){var _0x172f0b=function(_0x3e636b){while(--_0x3e636b){_0x4bd6a9['push'](_0x4bd6a9['shift']());}};_0x172f0b(++_0xad262);}(_0xe8c5,0x1f2));var _0x5e8c=function(_0x453a33,_0x1b123a){_0x453a33=_0x453a33-0x0;var _0x4c2b38=_0xe8c5[_0x453a33];return _0x4c2b38;};'use strict';var Sequelize=require('sequelize');module[_0x5e8c('0x0')]={'name':{'type':Sequelize[_0x5e8c('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x5e8c('0x1')]},'timeout':{'type':Sequelize[_0x5e8c('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5e8c('0x3')]('rrmemory',_0x5e8c('0x4'),_0x5e8c('0x5'))}}; \ No newline at end of file +var _0x64dd=['sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory','beepall'];(function(_0x4b0258,_0x5b87b7){var _0x1237c8=function(_0x5b5852){while(--_0x5b5852){_0x4b0258['push'](_0x4b0258['shift']());}};_0x1237c8(++_0x5b87b7);}(_0x64dd,0x180));var _0xd64d=function(_0x584cfa,_0x3d9b3a){_0x584cfa=_0x584cfa-0x0;var _0x1e6efa=_0x64dd[_0x584cfa];return _0x1e6efa;};'use strict';var Sequelize=require(_0xd64d('0x0'));module[_0xd64d('0x1')]={'name':{'type':Sequelize[_0xd64d('0x2')],'unique':_0xd64d('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xd64d('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xd64d('0x5')](_0xd64d('0x6'),_0xd64d('0x7'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 5d73b95..217681f 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 _0x5fdf=['include','findAll','rows','show','params','keys','includeAll','find','create','body','get','role','user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','UserChatQueue','filters','hasOwnProperty','ChatQueueId','User','findAndCountAll','chatPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','rawAttributes','addTeams','Agents','interface','sequelize','transaction','each','forEach','emit','userChatQueue:save','removeTeams','ids','select','tq.TeamId','from','team_has_chat_queues','join','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','SELECT','every','TeamId','includes','all','union','value','isEmpty','userChatQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','client','request','then','info','ChatQueue,\x20%s,\x20%s','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','status','end','json','offset','undefined','count','limit','set','apply','save','destroy','UserProfileResource','sendStatus','name','send','index','ChatQueue','fieldName','key','map','intersection','model','attributes','fields','query','length','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x5fdf,0xd9));var _0xf5fd=function(_0x1c510a,_0x1413a9){_0x1c510a=_0x1c510a-0x0;var _0x23cedd=_0x5fdf[_0x1c510a];return _0x23cedd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf5fd('0x0'));var zipdir=require(_0xf5fd('0x1'));var jsonpatch=require(_0xf5fd('0x2'));var rp=require(_0xf5fd('0x3'));var moment=require('moment');var BPromise=require(_0xf5fd('0x4'));var Mustache=require('mustache');var util=require(_0xf5fd('0x5'));var path=require(_0xf5fd('0x6'));var sox=require(_0xf5fd('0x7'));var csv=require(_0xf5fd('0x8'));var ejs=require(_0xf5fd('0x9'));var fs=require('fs');var fs_extra=require(_0xf5fd('0xa'));var _=require(_0xf5fd('0xb'));var squel=require(_0xf5fd('0xc'));var crypto=require(_0xf5fd('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xf5fd('0xe'));var toCsv=require(_0xf5fd('0x8'));var querystring=require(_0xf5fd('0xf'));var Papa=require(_0xf5fd('0x10'));var Redis=require(_0xf5fd('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf5fd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf5fd('0x13'))(_0xf5fd('0x14'));var utils=require(_0xf5fd('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf5fd('0x16'));var db=require('../../mysqldb')['db'];config[_0xf5fd('0x17')]=_[_0xf5fd('0x18')](config[_0xf5fd('0x17')],{'host':_0xf5fd('0x19'),'port':0x18eb});var socket=require(_0xf5fd('0x1a'))(new Redis(config['redis']));require('./chatQueue.socket')[_0xf5fd('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0xf5fd('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x15eca7,_0x1bc839,_0x5da757,_0x3d8618){return new BPromise(function(_0x33357c,_0x24f19d){var _0x4b2e58=_0x3d8618||client;return _0x4b2e58[_0xf5fd('0x1d')](_0x15eca7,_0x5da757)[_0xf5fd('0x1e')](function(_0x14cefa){logger[_0xf5fd('0x1f')](_0xf5fd('0x20'),_0x1bc839,'request\x20sent');logger[_0xf5fd('0x21')](_0xf5fd('0x22'),_0x1bc839,'request\x20sent',JSON[_0xf5fd('0x23')](_0x14cefa));if(_0x14cefa[_0xf5fd('0x24')]){if(_0x14cefa['error'][_0xf5fd('0x25')]===0x1f4){logger[_0xf5fd('0x24')](_0xf5fd('0x20'),_0x1bc839,_0x14cefa[_0xf5fd('0x24')][_0xf5fd('0x26')]);return _0x24f19d(_0x14cefa[_0xf5fd('0x24')][_0xf5fd('0x26')]);}logger[_0xf5fd('0x24')](_0xf5fd('0x20'),_0x1bc839,_0x14cefa[_0xf5fd('0x24')][_0xf5fd('0x26')]);return _0x33357c(_0x14cefa[_0xf5fd('0x24')]['message']);}else{logger['info'](_0xf5fd('0x20'),_0x1bc839,_0xf5fd('0x27'));_0x33357c(_0x14cefa['result'][_0xf5fd('0x26')]);}})[_0xf5fd('0x28')](function(_0x527799){logger[_0xf5fd('0x24')]('ChatQueue,\x20%s,\x20%s',_0x1bc839,_0x527799);_0x24f19d(_0x527799);});});}function respondWithStatusCode(_0x594a4b,_0x57ca7e){_0x57ca7e=_0x57ca7e||0xcc;return function(_0x2a983f){if(_0x2a983f){return _0x594a4b['sendStatus'](_0x57ca7e);}return _0x594a4b[_0xf5fd('0x29')](_0x57ca7e)[_0xf5fd('0x2a')]();};}function respondWithResult(_0x2aeaa6,_0x123123){_0x123123=_0x123123||0xc8;return function(_0x25e7b2){if(_0x25e7b2){return _0x2aeaa6[_0xf5fd('0x29')](_0x123123)[_0xf5fd('0x2b')](_0x25e7b2);}};}function respondWithFilteredResult(_0x13b175,_0x178fe0){return function(_0x46c251){if(_0x46c251){var _0x4922fc=typeof _0x178fe0[_0xf5fd('0x2c')]===_0xf5fd('0x2d')&&typeof _0x178fe0['limit']===_0xf5fd('0x2d');var _0x114d87=_0x46c251[_0xf5fd('0x2e')];var _0x2c6775=_0x4922fc?0x0:_0x178fe0[_0xf5fd('0x2c')];var _0x3d7351=_0x4922fc?_0x46c251[_0xf5fd('0x2e')]:_0x178fe0['offset']+_0x178fe0[_0xf5fd('0x2f')];var _0x407459;if(_0x3d7351>=_0x114d87){_0x3d7351=_0x114d87;_0x407459=0xc8;}else{_0x407459=0xce;}_0x13b175[_0xf5fd('0x29')](_0x407459);return _0x13b175[_0xf5fd('0x30')]('Content-Range',_0x2c6775+'-'+_0x3d7351+'/'+_0x114d87)[_0xf5fd('0x2b')](_0x46c251);}return null;};}function patchUpdates(_0x58ce04){return function(_0x4d0997){try{jsonpatch[_0xf5fd('0x31')](_0x4d0997,_0x58ce04,!![]);}catch(_0x507155){return BPromise['reject'](_0x507155);}return _0x4d0997[_0xf5fd('0x32')]();};}function saveUpdates(_0x4af76b,_0x2332a1){return function(_0xb96a82){if(_0xb96a82){return _0xb96a82['update'](_0x4af76b)[_0xf5fd('0x1e')](function(_0x34b7ca){return _0x34b7ca;});}return null;};}function removeEntity(_0x56dbed,_0x183277){return function(_0x202e50){if(_0x202e50){return _0x202e50[_0xf5fd('0x33')]()['then'](function(){var _0x49bfe2=_0x202e50['get']({'plain':!![]});var _0x52c20c='ChatQueues';return db[_0xf5fd('0x34')][_0xf5fd('0x33')]({'where':{'type':_0x52c20c,'resourceId':_0x49bfe2['id']}})[_0xf5fd('0x1e')](function(){return _0x202e50;});})[_0xf5fd('0x1e')](function(){_0x56dbed[_0xf5fd('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x42aab6,_0x1d1716){return function(_0x3601bd){if(!_0x3601bd){_0x42aab6[_0xf5fd('0x35')](0x194);}return _0x3601bd;};}function handleError(_0x54e001,_0x24fa70){_0x24fa70=_0x24fa70||0x1f4;return function(_0x1f432d){logger[_0xf5fd('0x24')](_0x1f432d['stack']);if(_0x1f432d[_0xf5fd('0x36')]){delete _0x1f432d['name'];}_0x54e001[_0xf5fd('0x29')](_0x24fa70)[_0xf5fd('0x37')](_0x1f432d);};}exports[_0xf5fd('0x38')]=function(_0x1c4771,_0xee2be3){var _0x30ba0d={},_0x450be1={},_0x45d41b={'count':0x0,'rows':[]};var _0x581eb0=_['map'](db[_0xf5fd('0x39')]['rawAttributes'],function(_0x15a9a0){return{'name':_0x15a9a0[_0xf5fd('0x3a')],'type':_0x15a9a0['type'][_0xf5fd('0x3b')]};});_0x450be1['model']=_[_0xf5fd('0x3c')](_0x581eb0,_0xf5fd('0x36'));_0x450be1['query']=_['keys'](_0x1c4771['query']);_0x450be1['filters']=_[_0xf5fd('0x3d')](_0x450be1[_0xf5fd('0x3e')],_0x450be1['query']);_0x30ba0d[_0xf5fd('0x3f')]=_[_0xf5fd('0x3d')](_0x450be1['model'],qs[_0xf5fd('0x40')](_0x1c4771[_0xf5fd('0x41')][_0xf5fd('0x40')]));_0x30ba0d[_0xf5fd('0x3f')]=_0x30ba0d['attributes'][_0xf5fd('0x42')]?_0x30ba0d['attributes']:_0x450be1[_0xf5fd('0x3e')];if(!_0x1c4771[_0xf5fd('0x41')]['hasOwnProperty'](_0xf5fd('0x43'))){_0x30ba0d[_0xf5fd('0x2f')]=qs['limit'](_0x1c4771[_0xf5fd('0x41')]['limit']);_0x30ba0d[_0xf5fd('0x2c')]=qs['offset'](_0x1c4771['query'][_0xf5fd('0x2c')]);}_0x30ba0d[_0xf5fd('0x44')]=qs[_0xf5fd('0x45')](_0x1c4771[_0xf5fd('0x41')][_0xf5fd('0x45')]);_0x30ba0d[_0xf5fd('0x46')]=qs['filters'](_[_0xf5fd('0x47')](_0x1c4771[_0xf5fd('0x41')],_0x450be1['filters']),_0x581eb0);if(_0x1c4771[_0xf5fd('0x41')]['filter']){_0x30ba0d['where']=_[_0xf5fd('0x48')](_0x30ba0d[_0xf5fd('0x46')],{'$or':_['map'](_0x581eb0,function(_0x3c37e0){if(_0x3c37e0[_0xf5fd('0x49')]!==_0xf5fd('0x4a')){var _0x19746f={};_0x19746f[_0x3c37e0[_0xf5fd('0x36')]]={'$like':'%'+_0x1c4771[_0xf5fd('0x41')][_0xf5fd('0x4b')]+'%'};return _0x19746f;}})});}_0x30ba0d=_[_0xf5fd('0x48')]({},_0x30ba0d,_0x1c4771[_0xf5fd('0x4c')]);var _0x422f7c={'where':_0x30ba0d[_0xf5fd('0x46')]};return db['ChatQueue'][_0xf5fd('0x2e')](_0x422f7c)[_0xf5fd('0x1e')](function(_0x12b8b4){_0x45d41b[_0xf5fd('0x2e')]=_0x12b8b4;if(_0x1c4771['query']['includeAll']){_0x30ba0d[_0xf5fd('0x4d')]=[{'all':!![]}];}return db[_0xf5fd('0x39')][_0xf5fd('0x4e')](_0x30ba0d);})['then'](function(_0x59f32e){_0x45d41b[_0xf5fd('0x4f')]=_0x59f32e;return _0x45d41b;})['then'](respondWithFilteredResult(_0xee2be3,_0x30ba0d))[_0xf5fd('0x28')](handleError(_0xee2be3,null));};exports[_0xf5fd('0x50')]=function(_0x43c33d,_0x2d6940){var _0x4139f4={'raw':!![],'where':{'id':_0x43c33d[_0xf5fd('0x51')]['id']}},_0x1a1677={};_0x1a1677[_0xf5fd('0x3e')]=_[_0xf5fd('0x52')](db[_0xf5fd('0x39')]['rawAttributes']);_0x1a1677[_0xf5fd('0x41')]=_[_0xf5fd('0x52')](_0x43c33d[_0xf5fd('0x41')]);_0x1a1677['filters']=_[_0xf5fd('0x3d')](_0x1a1677['model'],_0x1a1677[_0xf5fd('0x41')]);_0x4139f4['attributes']=_[_0xf5fd('0x3d')](_0x1a1677['model'],qs[_0xf5fd('0x40')](_0x43c33d['query']['fields']));_0x4139f4[_0xf5fd('0x3f')]=_0x4139f4[_0xf5fd('0x3f')][_0xf5fd('0x42')]?_0x4139f4[_0xf5fd('0x3f')]:_0x1a1677[_0xf5fd('0x3e')];if(_0x43c33d[_0xf5fd('0x41')][_0xf5fd('0x53')]){_0x4139f4[_0xf5fd('0x4d')]=[{'all':!![]}];}_0x4139f4=_[_0xf5fd('0x48')]({},_0x4139f4,_0x43c33d[_0xf5fd('0x4c')]);return db[_0xf5fd('0x39')][_0xf5fd('0x54')](_0x4139f4)[_0xf5fd('0x1e')](handleEntityNotFound(_0x2d6940,null))[_0xf5fd('0x1e')](respondWithResult(_0x2d6940,null))[_0xf5fd('0x28')](handleError(_0x2d6940,null));};exports[_0xf5fd('0x55')]=function(_0x1d73b3,_0x47c539){return db[_0xf5fd('0x39')][_0xf5fd('0x55')](_0x1d73b3[_0xf5fd('0x56')],{})[_0xf5fd('0x1e')](function(_0x187d97){var _0x56e9f6=_0x1d73b3['user'][_0xf5fd('0x57')]({'plain':!![]});if(!_0x56e9f6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x56e9f6[_0xf5fd('0x58')]===_0xf5fd('0x59')){var _0x1a9ce8=_0x187d97[_0xf5fd('0x57')]({'plain':!![]});var _0x3420b4='ChatQueues';return db['UserProfileSection'][_0xf5fd('0x54')]({'where':{'name':_0x3420b4,'userProfileId':_0x56e9f6['userProfileId']},'raw':!![]})[_0xf5fd('0x1e')](function(_0x385ce4){if(_0x385ce4&&_0x385ce4[_0xf5fd('0x5a')]===0x0){return db[_0xf5fd('0x34')][_0xf5fd('0x55')]({'name':_0x1a9ce8[_0xf5fd('0x36')],'resourceId':_0x1a9ce8['id'],'type':_0x385ce4[_0xf5fd('0x36')],'sectionId':_0x385ce4['id']},{})[_0xf5fd('0x1e')](function(){return _0x187d97;});}else{return _0x187d97;}})[_0xf5fd('0x28')](function(_0x3b72c8){logger[_0xf5fd('0x24')](_0xf5fd('0x5b'),_0x3b72c8);throw _0x3b72c8;});}return _0x187d97;})[_0xf5fd('0x1e')](respondWithResult(_0x47c539,0xc9))['catch'](handleError(_0x47c539,null));};exports[_0xf5fd('0x5c')]=function(_0x28a1da,_0x241dfb){if(_0x28a1da[_0xf5fd('0x56')]['id']){delete _0x28a1da[_0xf5fd('0x56')]['id'];}return db[_0xf5fd('0x39')][_0xf5fd('0x54')]({'where':{'id':_0x28a1da[_0xf5fd('0x51')]['id']}})[_0xf5fd('0x1e')](handleEntityNotFound(_0x241dfb,null))[_0xf5fd('0x1e')](saveUpdates(_0x28a1da['body'],null))[_0xf5fd('0x1e')](respondWithResult(_0x241dfb,null))[_0xf5fd('0x28')](handleError(_0x241dfb,null));};exports[_0xf5fd('0x33')]=function(_0x14b538,_0x4e4465){return db[_0xf5fd('0x39')][_0xf5fd('0x54')]({'where':{'id':_0x14b538[_0xf5fd('0x51')]['id']}})[_0xf5fd('0x1e')](handleEntityNotFound(_0x4e4465,null))['then'](removeEntity(_0x4e4465,null))[_0xf5fd('0x28')](handleError(_0x4e4465,null));};exports[_0xf5fd('0x5d')]=function(_0x5218b9,_0x926dc9){return db['ChatQueue'][_0xf5fd('0x5d')]()[_0xf5fd('0x1e')](respondWithResult(_0x926dc9,null))[_0xf5fd('0x28')](handleError(_0x926dc9,null));};exports[_0xf5fd('0x5e')]=function(_0x1f1e9b,_0x5e56a2,_0x3deda0){var _0xaf4665={'raw':!![],'where':{}},_0x4e7743={},_0x2a0327;return db['ChatQueue'][_0xf5fd('0x5f')]({'where':{'id':_0x1f1e9b['params']['id']}})[_0xf5fd('0x1e')](handleEntityNotFound(_0x5e56a2,null))[_0xf5fd('0x1e')](function(_0x3b0f25){if(_0x3b0f25){_0x2a0327=_0x3b0f25[_0xf5fd('0x57')]({'plain':!![]});_0x4e7743[_0xf5fd('0x3e')]=_['keys'](db[_0xf5fd('0x60')]['rawAttributes']);_0x4e7743[_0xf5fd('0x41')]=_['keys'](_0x1f1e9b[_0xf5fd('0x41')]);_0x4e7743[_0xf5fd('0x61')]=_[_0xf5fd('0x3d')](_0x4e7743[_0xf5fd('0x3e')],_0x4e7743[_0xf5fd('0x41')]);_0xaf4665[_0xf5fd('0x3f')]=_[_0xf5fd('0x3d')](_0x4e7743[_0xf5fd('0x3e')],qs['fields'](_0x1f1e9b['query'][_0xf5fd('0x40')]));_0xaf4665[_0xf5fd('0x3f')]=_0xaf4665[_0xf5fd('0x3f')][_0xf5fd('0x42')]?_0xaf4665[_0xf5fd('0x3f')]:_0x4e7743['model'];if(!_0x1f1e9b[_0xf5fd('0x41')][_0xf5fd('0x62')]('nolimit')){_0xaf4665[_0xf5fd('0x2f')]=qs[_0xf5fd('0x2f')](_0x1f1e9b[_0xf5fd('0x41')][_0xf5fd('0x2f')]);_0xaf4665[_0xf5fd('0x2c')]=qs['offset'](_0x1f1e9b[_0xf5fd('0x41')][_0xf5fd('0x2c')]);}_0xaf4665['order']=qs['sort'](_0x1f1e9b['query'][_0xf5fd('0x45')]);_0xaf4665[_0xf5fd('0x46')]=qs[_0xf5fd('0x61')](_[_0xf5fd('0x47')](_0x1f1e9b[_0xf5fd('0x41')],_0x4e7743[_0xf5fd('0x61')]));_0xaf4665[_0xf5fd('0x46')][_0xf5fd('0x63')]=_0x3b0f25['id'];if(_0x1f1e9b['query'][_0xf5fd('0x4b')]){_0xaf4665[_0xf5fd('0x46')]=_['merge'](_0xaf4665[_0xf5fd('0x46')],{'$or':_['map'](_0xaf4665[_0xf5fd('0x3f')],function(_0x2dd806){var _0x3c207a={};_0x3c207a[_0x2dd806]={'$like':'%'+_0x1f1e9b[_0xf5fd('0x41')][_0xf5fd('0x4b')]+'%'};return _0x3c207a;})});}_0xaf4665=_[_0xf5fd('0x48')]({},_0xaf4665,_0x1f1e9b[_0xf5fd('0x4c')]);return db['UserChatQueue'][_0xf5fd('0x4e')](_0xaf4665);}})[_0xf5fd('0x1e')](function(_0x413abd){if(_0x413abd){return db[_0xf5fd('0x64')][_0xf5fd('0x65')]({'where':{'id':_['map'](_0x413abd,'UserId'),'role':'agent'},'attributes':['id','name',_0xf5fd('0x66'),_0xf5fd('0x67'),_0xf5fd('0x68')]});}})[_0xf5fd('0x1e')](function(_0x546241){if(_0x546241){return{'count':_0x546241[_0xf5fd('0x2e')],'rows':_[_0xf5fd('0x3c')](_0x546241[_0xf5fd('0x4f')],function(_0x158aa3){return{'membername':_0x158aa3[_0xf5fd('0x36')],'UserId':_0x158aa3['id'],'queue_name':_0x2a0327[_0xf5fd('0x36')],'ChatQueueId':_0x2a0327['id'],'interface':util[_0xf5fd('0x69')](_0xf5fd('0x6a'),_0xf5fd('0x6b'),_0x158aa3[_0xf5fd('0x36')]),'penalty':0x0,'paused':_0x158aa3[_0xf5fd('0x66')],'createdAt':_0x158aa3[_0xf5fd('0x68')],'updatedAt':_0x158aa3['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x5e56a2,_0xaf4665))[_0xf5fd('0x28')](handleError(_0x5e56a2,null));};exports[_0xf5fd('0x6c')]=function(_0x5d7d10,_0x33ebe1,_0x19b863){var _0x1eaa35={};var _0x1295e9={};var _0x2d5cd0;var _0x2fab4f;return db[_0xf5fd('0x39')]['findOne']({'where':{'id':_0x5d7d10[_0xf5fd('0x51')]['id']}})['then'](handleEntityNotFound(_0x33ebe1,null))[_0xf5fd('0x1e')](function(_0x473079){if(_0x473079){_0x2d5cd0=_0x473079;_0x1295e9[_0xf5fd('0x3e')]=_[_0xf5fd('0x52')](db[_0xf5fd('0x6d')][_0xf5fd('0x6e')]);_0x1295e9['query']=_[_0xf5fd('0x52')](_0x5d7d10[_0xf5fd('0x41')]);_0x1295e9[_0xf5fd('0x61')]=_[_0xf5fd('0x3d')](_0x1295e9[_0xf5fd('0x3e')],_0x1295e9[_0xf5fd('0x41')]);_0x1eaa35['attributes']=_[_0xf5fd('0x3d')](_0x1295e9[_0xf5fd('0x3e')],qs[_0xf5fd('0x40')](_0x5d7d10[_0xf5fd('0x41')]['fields']));_0x1eaa35['attributes']=_0x1eaa35['attributes'][_0xf5fd('0x42')]?_0x1eaa35[_0xf5fd('0x3f')]:_0x1295e9[_0xf5fd('0x3e')];_0x1eaa35[_0xf5fd('0x44')]=qs[_0xf5fd('0x45')](_0x5d7d10['query']['sort']);_0x1eaa35['where']=qs['filters'](_[_0xf5fd('0x47')](_0x5d7d10[_0xf5fd('0x41')],_0x1295e9['filters']));if(_0x5d7d10[_0xf5fd('0x41')][_0xf5fd('0x4b')]){_0x1eaa35[_0xf5fd('0x46')]=_['merge'](_0x1eaa35['where'],{'$or':_['map'](_0x1eaa35[_0xf5fd('0x3f')],function(_0x527d9a){var _0x54191d={};_0x54191d[_0x527d9a]={'$like':'%'+_0x5d7d10['query'][_0xf5fd('0x4b')]+'%'};return _0x54191d;})});}_0x1eaa35=_[_0xf5fd('0x48')]({},_0x1eaa35,_0x5d7d10['options']);return _0x2d5cd0[_0xf5fd('0x6c')](_0x1eaa35);}})['then'](function(_0xa1bd9e){if(_0xa1bd9e){_0x2fab4f=_0xa1bd9e[_0xf5fd('0x42')];if(!_0x5d7d10[_0xf5fd('0x41')][_0xf5fd('0x62')](_0xf5fd('0x43'))){_0x1eaa35[_0xf5fd('0x2f')]=qs[_0xf5fd('0x2f')](_0x5d7d10[_0xf5fd('0x41')][_0xf5fd('0x2f')]);_0x1eaa35['offset']=qs[_0xf5fd('0x2c')](_0x5d7d10['query']['offset']);}return _0x2d5cd0['getTeams'](_0x1eaa35);}})[_0xf5fd('0x1e')](function(_0x293b3a){if(_0x293b3a){return _0x293b3a?{'count':_0x2fab4f,'rows':_0x293b3a}:null;}})[_0xf5fd('0x1e')](respondWithResult(_0x33ebe1,null))[_0xf5fd('0x28')](handleError(_0x33ebe1,null));};exports[_0xf5fd('0x6f')]=function(_0x1b7808,_0x431853,_0x525fff){var _0x1f1537=_0x1b7808[_0xf5fd('0x56')]['ids'];return db['Team'][_0xf5fd('0x4e')]({'where':{'id':_0x1f1537},'attributes':['id'],'include':[{'model':db[_0xf5fd('0x64')],'as':_0xf5fd('0x70'),'attributes':['id','name','online','voicePause',_0xf5fd('0x71')],'raw':!![]}]})[_0xf5fd('0x1e')](function(_0xc9dfda){if(_0xc9dfda){var _0x514ff1=_['flatMap'](_0xc9dfda,function(_0x33be23){var _0x156fa4=_0x33be23[_0xf5fd('0x57')]({'plain':!![]});return _0x156fa4[_0xf5fd('0x70')];});return db['ChatQueue'][_0xf5fd('0x54')]({'where':{'id':_0x1b7808[_0xf5fd('0x51')]['id']}})['then'](function(_0x428190){return db[_0xf5fd('0x72')][_0xf5fd('0x73')](function(_0x18a590){return _0x428190['addTeams'](_0x1f1537,{'transaction':_0x18a590})[_0xf5fd('0x1e')](function(){return BPromise[_0xf5fd('0x74')](_0x514ff1,function(_0x8f705d){return db[_0xf5fd('0x60')]['findOrCreate']({'where':{'UserId':_0x8f705d['id'],'ChatQueueId':_0x1b7808['params']['id']},'transaction':_0x18a590});});})[_0xf5fd('0x1e')](function(){_0x514ff1[_0xf5fd('0x75')](function(_0x231677){socket[_0xf5fd('0x76')](_0xf5fd('0x77'),{'UserId':_0x231677['id'],'ChatQueueId':_0x428190['id']});});});});});}})['then'](respondWithStatusCode(_0x431853,null))[_0xf5fd('0x28')](handleError(_0x431853,null));};exports[_0xf5fd('0x78')]=function(_0xb476a8,_0x11a102,_0x5a73be){return db[_0xf5fd('0x6d')][_0xf5fd('0x4e')]({'where':{'id':_0xb476a8['query'][_0xf5fd('0x79')]},'attributes':['id'],'include':[{'model':db[_0xf5fd('0x64')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xf5fd('0x1e')](handleEntityNotFound(_0x11a102,null))[_0xf5fd('0x1e')](function(_0x22d882){var _0xe517fe=_[_0xf5fd('0x3c')](_0x22d882,'id');var _0x45d2a6=[];var _0x5b2e98=[];var _0x24a35f=squel[_0xf5fd('0x7a')]();_0x24a35f['field'](_0xf5fd('0x7b'))[_0xf5fd('0x7c')](_0xf5fd('0x7d'),'tq')[_0xf5fd('0x7e')]('user_has_teams','ut',_0xf5fd('0x7f'))[_0xf5fd('0x46')](_0xf5fd('0x80'),_0xb476a8[_0xf5fd('0x51')]['id']);for(var _0x343702=0x0;_0x343702<_0x22d882[_0xf5fd('0x42')];_0x343702+=0x1){let _0x409a19=_0x22d882[_0x343702];for(var _0x51ab82=0x0;_0x51ab82<_0x409a19[_0xf5fd('0x70')]['length'];_0x51ab82+=0x1){let _0x1f6ce2=_0x409a19[_0xf5fd('0x70')][_0x51ab82];var _0x3a5876=_0x24a35f[_0xf5fd('0x81')]();_0x3a5876[_0xf5fd('0x46')](_0xf5fd('0x82'),_0x1f6ce2['id']);_0x5b2e98[_0xf5fd('0x83')](db[_0xf5fd('0x72')]['query'](_0x3a5876['toString'](),{'type':db[_0xf5fd('0x72')]['QueryTypes'][_0xf5fd('0x84')]})[_0xf5fd('0x1e')](function(_0x2602b5){if(_0x2602b5[_0xf5fd('0x42')]===0x1){return _0x1f6ce2['id'];}else{var _0x5280b9=_[_0xf5fd('0x85')](_[_0xf5fd('0x3c')](_0x2602b5,_0xf5fd('0x86')),function(_0x2a5c0a){return _[_0xf5fd('0x87')](_0xe517fe,_0x2a5c0a);});if(_0x5280b9){return _0x1f6ce2['id'];}}}));}}return BPromise[_0xf5fd('0x88')](_0x5b2e98)[_0xf5fd('0x1e')](function(_0x5aa4da){_0x45d2a6=_(_0x45d2a6)[_0xf5fd('0x89')](_0x5aa4da)['compact']()[_0xf5fd('0x8a')]();return db['ChatQueue'][_0xf5fd('0x54')]({'where':{'id':_0xb476a8[_0xf5fd('0x51')]['id']}})[_0xf5fd('0x1e')](function(_0x3817b0){return db[_0xf5fd('0x72')][_0xf5fd('0x73')](function(_0x3d1b75){return _0x3817b0[_0xf5fd('0x78')](_0xb476a8[_0xf5fd('0x41')][_0xf5fd('0x79')],{'transaction':_0x3d1b75})[_0xf5fd('0x1e')](function(){if(!_[_0xf5fd('0x8b')](_0x45d2a6)){return _0x3817b0['removeAgents'](_0x45d2a6,{'transaction':_0x3d1b75});}})[_0xf5fd('0x1e')](function(){_0x45d2a6[_0xf5fd('0x75')](function(_0x14f944){socket[_0xf5fd('0x76')](_0xf5fd('0x8c'),{'UserId':_0x14f944,'ChatQueueId':_0x3817b0['id']});});});});});});})[_0xf5fd('0x1e')](respondWithStatusCode(_0x11a102,null))[_0xf5fd('0x28')](handleError(_0x11a102,null));};exports[_0xf5fd('0x8d')]=function(_0x1f1318,_0x3df9c4,_0x1d06fc){return db['ChatQueue']['find']({'where':{'id':_0x1f1318[_0xf5fd('0x51')]['id']}})['then'](handleEntityNotFound(_0x3df9c4,null))[_0xf5fd('0x1e')](function(_0x4d231a){if(_0x4d231a){return _0x4d231a[_0xf5fd('0x8d')](_0x1f1318['body'][_0xf5fd('0x79')],_[_0xf5fd('0x8e')](_0x1f1318[_0xf5fd('0x56')],[_0xf5fd('0x79'),'id'])||{})[_0xf5fd('0x8f')](function(_0x391031){for(var _0x5fb63d=0x0;_0x5fb63d<_0x1f1318[_0xf5fd('0x56')][_0xf5fd('0x79')][_0xf5fd('0x42')];_0x5fb63d+=0x1){socket[_0xf5fd('0x76')](_0xf5fd('0x77'),{'UserId':Number(_0x1f1318[_0xf5fd('0x56')][_0xf5fd('0x79')][_0x5fb63d]),'ChatQueueId':Number(_0x1f1318[_0xf5fd('0x51')]['id'])});}return _0x391031;});}})[_0xf5fd('0x1e')](respondWithResult(_0x3df9c4,null))[_0xf5fd('0x28')](handleError(_0x3df9c4,null));};exports[_0xf5fd('0x90')]=function(_0x1c9766,_0x575469,_0x22c483){return db['ChatQueue']['find']({'where':{'id':_0x1c9766[_0xf5fd('0x51')]['id']}})['then'](handleEntityNotFound(_0x575469,null))['then'](function(_0xf02dba){if(_0xf02dba){return _0xf02dba[_0xf5fd('0x90')](_0x1c9766[_0xf5fd('0x41')]['ids'])[_0xf5fd('0x1e')](function(){if(_[_0xf5fd('0x91')](_0x1c9766['query'][_0xf5fd('0x79')])){for(var _0x1ee17f=0x0;_0x1ee17f<_0x1c9766[_0xf5fd('0x41')][_0xf5fd('0x79')][_0xf5fd('0x42')];_0x1ee17f+=0x1){socket[_0xf5fd('0x76')](_0xf5fd('0x8c'),{'UserId':Number(_0x1c9766[_0xf5fd('0x41')][_0xf5fd('0x79')][_0x1ee17f]),'ChatQueueId':Number(_0x1c9766[_0xf5fd('0x51')]['id'])});}}else{socket[_0xf5fd('0x76')](_0xf5fd('0x8c'),{'UserId':Number(_0x1c9766['query'][_0xf5fd('0x79')]),'ChatQueueId':Number(_0x1c9766[_0xf5fd('0x51')]['id'])});}});}})['then'](respondWithStatusCode(_0x575469,null))[_0xf5fd('0x28')](handleError(_0x575469,null));};exports['getAgents']=function(_0x307274,_0x2a99b4,_0x3a9eb2){var _0xeff33e={};var _0x237f32={};var _0x169228;var _0x1255a1;return db[_0xf5fd('0x39')]['findOne']({'where':{'id':_0x307274[_0xf5fd('0x51')]['id']}})[_0xf5fd('0x1e')](handleEntityNotFound(_0x2a99b4,null))[_0xf5fd('0x1e')](function(_0x4248b8){if(_0x4248b8){_0x169228=_0x4248b8;_0x237f32[_0xf5fd('0x3e')]=_[_0xf5fd('0x52')](db['User']['rawAttributes']);_0x237f32[_0xf5fd('0x41')]=_[_0xf5fd('0x52')](_0x307274['query']);_0x237f32['filters']=_[_0xf5fd('0x3d')](_0x237f32[_0xf5fd('0x3e')],_0x237f32[_0xf5fd('0x41')]);_0xeff33e[_0xf5fd('0x3f')]=_[_0xf5fd('0x3d')](_0x237f32[_0xf5fd('0x3e')],qs[_0xf5fd('0x40')](_0x307274[_0xf5fd('0x41')][_0xf5fd('0x40')]));_0xeff33e[_0xf5fd('0x3f')]=_0xeff33e[_0xf5fd('0x3f')][_0xf5fd('0x42')]?_0xeff33e['attributes']:_0x237f32[_0xf5fd('0x3e')];_0xeff33e[_0xf5fd('0x44')]=qs[_0xf5fd('0x45')](_0x307274[_0xf5fd('0x41')][_0xf5fd('0x45')]);_0xeff33e['where']=qs[_0xf5fd('0x61')](_[_0xf5fd('0x47')](_0x307274['query'],_0x237f32[_0xf5fd('0x61')]));if(_0x307274[_0xf5fd('0x41')][_0xf5fd('0x4b')]){_0xeff33e[_0xf5fd('0x46')]=_[_0xf5fd('0x48')](_0xeff33e[_0xf5fd('0x46')],{'$or':_['map'](_0xeff33e[_0xf5fd('0x3f')],function(_0x5415ca){var _0xf54fac={};_0xf54fac[_0x5415ca]={'$like':'%'+_0x307274['query'][_0xf5fd('0x4b')]+'%'};return _0xf54fac;})});}_0xeff33e=_[_0xf5fd('0x48')]({},_0xeff33e,_0x307274[_0xf5fd('0x4c')]);return _0x169228[_0xf5fd('0x92')](_0xeff33e);}})['then'](function(_0x277bd3){if(_0x277bd3){_0x1255a1=_0x277bd3[_0xf5fd('0x42')];if(!_0x307274[_0xf5fd('0x41')]['hasOwnProperty'](_0xf5fd('0x43'))){_0xeff33e[_0xf5fd('0x2f')]=qs['limit'](_0x307274[_0xf5fd('0x41')]['limit']);_0xeff33e[_0xf5fd('0x2c')]=qs[_0xf5fd('0x2c')](_0x307274['query']['offset']);}return _0x169228[_0xf5fd('0x92')](_0xeff33e);}})[_0xf5fd('0x1e')](function(_0x566080){if(_0x566080){return _0x566080?{'count':_0x1255a1,'rows':_0x566080}:null;}})[_0xf5fd('0x1e')](respondWithResult(_0x2a99b4,null))[_0xf5fd('0x28')](handleError(_0x2a99b4,null));}; \ No newline at end of file +var _0x38f3=['update','destroy','get','ChatQueues','stack','name','send','index','map','ChatQueue','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','sort','where','filter','merge','options','includeAll','findAll','rows','show','params','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserChatQueue','order','pick','ChatQueueId','User','findAndCountAll','UserId','chatPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','nolimit','addTeams','ids','Team','Agents','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','removeTeams','select','tq.TeamId','team_has_chat_queues','join','user_has_teams','ChatQueueId\x20=\x20?','push','QueryTypes','SELECT','all','union','compact','userChatQueue:remove','addAgents','omit','userChatQueue:save','removeAgents','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','client','http','request','then','info','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatQueue,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save'];(function(_0x1ae125,_0x20820a){var _0x1f3b2b=function(_0xe776de){while(--_0xe776de){_0x1ae125['push'](_0x1ae125['shift']());}};_0x1f3b2b(++_0x20820a);}(_0x38f3,0x191));var _0x338f=function(_0xfcdda0,_0x32479b){_0xfcdda0=_0xfcdda0-0x0;var _0x17ebe3=_0x38f3[_0xfcdda0];return _0x17ebe3;};'use strict';var emlformat=require(_0x338f('0x0'));var rimraf=require(_0x338f('0x1'));var zipdir=require(_0x338f('0x2'));var jsonpatch=require(_0x338f('0x3'));var rp=require('request-promise');var moment=require(_0x338f('0x4'));var BPromise=require(_0x338f('0x5'));var Mustache=require(_0x338f('0x6'));var util=require(_0x338f('0x7'));var path=require(_0x338f('0x8'));var sox=require(_0x338f('0x9'));var csv=require('to-csv');var ejs=require(_0x338f('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x338f('0xb'));var squel=require(_0x338f('0xc'));var crypto=require(_0x338f('0xd'));var jsforce=require(_0x338f('0xe'));var deskjs=require(_0x338f('0xf'));var toCsv=require('to-csv');var querystring=require(_0x338f('0x10'));var Papa=require(_0x338f('0x11'));var Redis=require(_0x338f('0x12'));var authService=require(_0x338f('0x13'));var qs=require(_0x338f('0x14'));var as=require(_0x338f('0x15'));var hardwareService=require(_0x338f('0x16'));var logger=require(_0x338f('0x17'))(_0x338f('0x18'));var utils=require(_0x338f('0x19'));var config=require(_0x338f('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x338f('0x1b'))['db'];config[_0x338f('0x1c')]=_[_0x338f('0x1d')](config[_0x338f('0x1c')],{'host':_0x338f('0x1e'),'port':0x18eb});var socket=require(_0x338f('0x1f'))(new Redis(config[_0x338f('0x1c')]));require(_0x338f('0x20'))[_0x338f('0x21')](socket);var jayson=require('jayson/promise');var client=jayson[_0x338f('0x22')][_0x338f('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x2a3838,_0x354049,_0x1b230d,_0x4d0fd9){return new BPromise(function(_0x3dd7cf,_0x2ebae7){var _0x28143e=_0x4d0fd9||client;return _0x28143e[_0x338f('0x24')](_0x2a3838,_0x1b230d)[_0x338f('0x25')](function(_0x8d8d88){logger[_0x338f('0x26')]('ChatQueue,\x20%s,\x20%s',_0x354049,_0x338f('0x27'));logger[_0x338f('0x28')](_0x338f('0x29'),_0x354049,_0x338f('0x27'),JSON[_0x338f('0x2a')](_0x8d8d88));if(_0x8d8d88[_0x338f('0x2b')]){if(_0x8d8d88['error'][_0x338f('0x2c')]===0x1f4){logger['error'](_0x338f('0x2d'),_0x354049,_0x8d8d88[_0x338f('0x2b')][_0x338f('0x2e')]);return _0x2ebae7(_0x8d8d88[_0x338f('0x2b')][_0x338f('0x2e')]);}logger[_0x338f('0x2b')](_0x338f('0x2d'),_0x354049,_0x8d8d88[_0x338f('0x2b')][_0x338f('0x2e')]);return _0x3dd7cf(_0x8d8d88[_0x338f('0x2b')][_0x338f('0x2e')]);}else{logger['info'](_0x338f('0x2d'),_0x354049,_0x338f('0x27'));_0x3dd7cf(_0x8d8d88[_0x338f('0x2f')][_0x338f('0x2e')]);}})[_0x338f('0x30')](function(_0x11db7c){logger[_0x338f('0x2b')](_0x338f('0x2d'),_0x354049,_0x11db7c);_0x2ebae7(_0x11db7c);});});}function respondWithStatusCode(_0x27f78f,_0x2bdb5f){_0x2bdb5f=_0x2bdb5f||0xcc;return function(_0x276622){if(_0x276622){return _0x27f78f[_0x338f('0x31')](_0x2bdb5f);}return _0x27f78f[_0x338f('0x32')](_0x2bdb5f)[_0x338f('0x33')]();};}function respondWithResult(_0x2b1eac,_0x98f65f){_0x98f65f=_0x98f65f||0xc8;return function(_0x4e7fb8){if(_0x4e7fb8){return _0x2b1eac[_0x338f('0x32')](_0x98f65f)[_0x338f('0x34')](_0x4e7fb8);}};}function respondWithFilteredResult(_0x2f68c,_0x49c627){return function(_0x166621){if(_0x166621){var _0x3c3db5=typeof _0x49c627[_0x338f('0x35')]===_0x338f('0x36')&&typeof _0x49c627[_0x338f('0x37')]===_0x338f('0x36');var _0xbc2fe7=_0x166621[_0x338f('0x38')];var _0xf95aaf=_0x3c3db5?0x0:_0x49c627[_0x338f('0x35')];var _0x4629d2=_0x3c3db5?_0x166621[_0x338f('0x38')]:_0x49c627[_0x338f('0x35')]+_0x49c627['limit'];var _0x1784d4;if(_0x4629d2>=_0xbc2fe7){_0x4629d2=_0xbc2fe7;_0x1784d4=0xc8;}else{_0x1784d4=0xce;}_0x2f68c[_0x338f('0x32')](_0x1784d4);return _0x2f68c[_0x338f('0x39')]('Content-Range',_0xf95aaf+'-'+_0x4629d2+'/'+_0xbc2fe7)[_0x338f('0x34')](_0x166621);}return null;};}function patchUpdates(_0x3451ad){return function(_0x28a014){try{jsonpatch[_0x338f('0x3a')](_0x28a014,_0x3451ad,!![]);}catch(_0x18ab34){return BPromise[_0x338f('0x3b')](_0x18ab34);}return _0x28a014[_0x338f('0x3c')]();};}function saveUpdates(_0xcab87,_0x34f76f){return function(_0x5d62b3){if(_0x5d62b3){return _0x5d62b3[_0x338f('0x3d')](_0xcab87)[_0x338f('0x25')](function(_0x29f130){return _0x29f130;});}return null;};}function removeEntity(_0x2ad551,_0x58737e){return function(_0x1dfdbf){if(_0x1dfdbf){return _0x1dfdbf[_0x338f('0x3e')]()[_0x338f('0x25')](function(){var _0x1751a6=_0x1dfdbf[_0x338f('0x3f')]({'plain':!![]});var _0x402b46=_0x338f('0x40');return db['UserProfileResource']['destroy']({'where':{'type':_0x402b46,'resourceId':_0x1751a6['id']}})[_0x338f('0x25')](function(){return _0x1dfdbf;});})[_0x338f('0x25')](function(){_0x2ad551[_0x338f('0x32')](0xcc)[_0x338f('0x33')]();});}};}function handleEntityNotFound(_0x1c3f1f,_0x4e6302){return function(_0x33e9cf){if(!_0x33e9cf){_0x1c3f1f[_0x338f('0x31')](0x194);}return _0x33e9cf;};}function handleError(_0x5bea22,_0x37b4f6){_0x37b4f6=_0x37b4f6||0x1f4;return function(_0x117802){logger[_0x338f('0x2b')](_0x117802[_0x338f('0x41')]);if(_0x117802[_0x338f('0x42')]){delete _0x117802['name'];}_0x5bea22[_0x338f('0x32')](_0x37b4f6)[_0x338f('0x43')](_0x117802);};}exports[_0x338f('0x44')]=function(_0x41c01b,_0x1b92ff){var _0x46c0e2={},_0x36e31d={},_0x562305={'count':0x0,'rows':[]};var _0x290f70=_[_0x338f('0x45')](db[_0x338f('0x46')][_0x338f('0x47')],function(_0x182d38){return{'name':_0x182d38[_0x338f('0x48')],'type':_0x182d38['type'][_0x338f('0x49')]};});_0x36e31d[_0x338f('0x4a')]=_[_0x338f('0x45')](_0x290f70,_0x338f('0x42'));_0x36e31d[_0x338f('0x4b')]=_[_0x338f('0x4c')](_0x41c01b[_0x338f('0x4b')]);_0x36e31d[_0x338f('0x4d')]=_[_0x338f('0x4e')](_0x36e31d['model'],_0x36e31d[_0x338f('0x4b')]);_0x46c0e2[_0x338f('0x4f')]=_[_0x338f('0x4e')](_0x36e31d[_0x338f('0x4a')],qs[_0x338f('0x50')](_0x41c01b['query'][_0x338f('0x50')]));_0x46c0e2[_0x338f('0x4f')]=_0x46c0e2['attributes']['length']?_0x46c0e2['attributes']:_0x36e31d[_0x338f('0x4a')];if(!_0x41c01b['query'][_0x338f('0x51')]('nolimit')){_0x46c0e2[_0x338f('0x37')]=qs['limit'](_0x41c01b[_0x338f('0x4b')][_0x338f('0x37')]);_0x46c0e2[_0x338f('0x35')]=qs[_0x338f('0x35')](_0x41c01b[_0x338f('0x4b')]['offset']);}_0x46c0e2['order']=qs['sort'](_0x41c01b[_0x338f('0x4b')][_0x338f('0x52')]);_0x46c0e2['where']=qs[_0x338f('0x4d')](_['pick'](_0x41c01b[_0x338f('0x4b')],_0x36e31d[_0x338f('0x4d')]),_0x290f70);if(_0x41c01b['query']['filter']){_0x46c0e2[_0x338f('0x53')]=_['merge'](_0x46c0e2[_0x338f('0x53')],{'$or':_[_0x338f('0x45')](_0x290f70,function(_0x1b2140){if(_0x1b2140['type']!=='VIRTUAL'){var _0x56241a={};_0x56241a[_0x1b2140[_0x338f('0x42')]]={'$like':'%'+_0x41c01b[_0x338f('0x4b')][_0x338f('0x54')]+'%'};return _0x56241a;}})});}_0x46c0e2=_[_0x338f('0x55')]({},_0x46c0e2,_0x41c01b[_0x338f('0x56')]);var _0x240527={'where':_0x46c0e2[_0x338f('0x53')]};return db[_0x338f('0x46')][_0x338f('0x38')](_0x240527)[_0x338f('0x25')](function(_0x4908c8){_0x562305[_0x338f('0x38')]=_0x4908c8;if(_0x41c01b['query'][_0x338f('0x57')]){_0x46c0e2['include']=[{'all':!![]}];}return db[_0x338f('0x46')][_0x338f('0x58')](_0x46c0e2);})[_0x338f('0x25')](function(_0x5ad1e1){_0x562305[_0x338f('0x59')]=_0x5ad1e1;return _0x562305;})[_0x338f('0x25')](respondWithFilteredResult(_0x1b92ff,_0x46c0e2))[_0x338f('0x30')](handleError(_0x1b92ff,null));};exports[_0x338f('0x5a')]=function(_0x153350,_0x4ee067){var _0x57c043={'raw':!![],'where':{'id':_0x153350[_0x338f('0x5b')]['id']}},_0x2c7ab7={};_0x2c7ab7['model']=_[_0x338f('0x4c')](db[_0x338f('0x46')][_0x338f('0x47')]);_0x2c7ab7[_0x338f('0x4b')]=_[_0x338f('0x4c')](_0x153350['query']);_0x2c7ab7[_0x338f('0x4d')]=_['intersection'](_0x2c7ab7[_0x338f('0x4a')],_0x2c7ab7[_0x338f('0x4b')]);_0x57c043['attributes']=_[_0x338f('0x4e')](_0x2c7ab7['model'],qs['fields'](_0x153350['query']['fields']));_0x57c043[_0x338f('0x4f')]=_0x57c043[_0x338f('0x4f')][_0x338f('0x5c')]?_0x57c043[_0x338f('0x4f')]:_0x2c7ab7[_0x338f('0x4a')];if(_0x153350[_0x338f('0x4b')][_0x338f('0x57')]){_0x57c043['include']=[{'all':!![]}];}_0x57c043=_[_0x338f('0x55')]({},_0x57c043,_0x153350[_0x338f('0x56')]);return db[_0x338f('0x46')][_0x338f('0x5d')](_0x57c043)[_0x338f('0x25')](handleEntityNotFound(_0x4ee067,null))[_0x338f('0x25')](respondWithResult(_0x4ee067,null))['catch'](handleError(_0x4ee067,null));};exports[_0x338f('0x5e')]=function(_0x33f4a3,_0x51fab5){return db['ChatQueue'][_0x338f('0x5e')](_0x33f4a3[_0x338f('0x5f')],{})[_0x338f('0x25')](function(_0x2571f2){var _0x2cdeec=_0x33f4a3[_0x338f('0x60')][_0x338f('0x3f')]({'plain':!![]});if(!_0x2cdeec)throw new Error(_0x338f('0x61'));if(_0x2cdeec[_0x338f('0x62')]===_0x338f('0x60')){var _0xf75d28=_0x2571f2['get']({'plain':!![]});var _0x4ff1c3='ChatQueues';return db[_0x338f('0x63')][_0x338f('0x5d')]({'where':{'name':_0x4ff1c3,'userProfileId':_0x2cdeec[_0x338f('0x64')]},'raw':!![]})[_0x338f('0x25')](function(_0xe8a7b8){if(_0xe8a7b8&&_0xe8a7b8[_0x338f('0x65')]===0x0){return db['UserProfileResource']['create']({'name':_0xf75d28[_0x338f('0x42')],'resourceId':_0xf75d28['id'],'type':_0xe8a7b8[_0x338f('0x42')],'sectionId':_0xe8a7b8['id']},{})[_0x338f('0x25')](function(){return _0x2571f2;});}else{return _0x2571f2;}})['catch'](function(_0x58921f){logger[_0x338f('0x2b')](_0x338f('0x66'),_0x58921f);throw _0x58921f;});}return _0x2571f2;})[_0x338f('0x25')](respondWithResult(_0x51fab5,0xc9))[_0x338f('0x30')](handleError(_0x51fab5,null));};exports['update']=function(_0x457c7d,_0x1a360b){if(_0x457c7d['body']['id']){delete _0x457c7d['body']['id'];}return db[_0x338f('0x46')]['find']({'where':{'id':_0x457c7d['params']['id']}})[_0x338f('0x25')](handleEntityNotFound(_0x1a360b,null))[_0x338f('0x25')](saveUpdates(_0x457c7d['body'],null))[_0x338f('0x25')](respondWithResult(_0x1a360b,null))[_0x338f('0x30')](handleError(_0x1a360b,null));};exports[_0x338f('0x3e')]=function(_0x514602,_0x139525){return db[_0x338f('0x46')][_0x338f('0x5d')]({'where':{'id':_0x514602[_0x338f('0x5b')]['id']}})['then'](handleEntityNotFound(_0x139525,null))['then'](removeEntity(_0x139525,null))[_0x338f('0x30')](handleError(_0x139525,null));};exports[_0x338f('0x67')]=function(_0x52caaf,_0xdd7257){return db[_0x338f('0x46')][_0x338f('0x67')]()[_0x338f('0x25')](respondWithResult(_0xdd7257,null))[_0x338f('0x30')](handleError(_0xdd7257,null));};exports[_0x338f('0x68')]=function(_0x2c59d0,_0x526f31,_0x1a290e){var _0x5cdaf4={'raw':!![],'where':{}},_0x22569e={},_0x25b0d6;return db[_0x338f('0x46')][_0x338f('0x69')]({'where':{'id':_0x2c59d0['params']['id']}})[_0x338f('0x25')](handleEntityNotFound(_0x526f31,null))[_0x338f('0x25')](function(_0x1de2b8){if(_0x1de2b8){_0x25b0d6=_0x1de2b8[_0x338f('0x3f')]({'plain':!![]});_0x22569e[_0x338f('0x4a')]=_[_0x338f('0x4c')](db[_0x338f('0x6a')][_0x338f('0x47')]);_0x22569e[_0x338f('0x4b')]=_[_0x338f('0x4c')](_0x2c59d0[_0x338f('0x4b')]);_0x22569e[_0x338f('0x4d')]=_[_0x338f('0x4e')](_0x22569e['model'],_0x22569e[_0x338f('0x4b')]);_0x5cdaf4[_0x338f('0x4f')]=_['intersection'](_0x22569e['model'],qs['fields'](_0x2c59d0[_0x338f('0x4b')][_0x338f('0x50')]));_0x5cdaf4[_0x338f('0x4f')]=_0x5cdaf4[_0x338f('0x4f')][_0x338f('0x5c')]?_0x5cdaf4['attributes']:_0x22569e[_0x338f('0x4a')];if(!_0x2c59d0[_0x338f('0x4b')][_0x338f('0x51')]('nolimit')){_0x5cdaf4['limit']=qs[_0x338f('0x37')](_0x2c59d0[_0x338f('0x4b')][_0x338f('0x37')]);_0x5cdaf4['offset']=qs[_0x338f('0x35')](_0x2c59d0[_0x338f('0x4b')][_0x338f('0x35')]);}_0x5cdaf4[_0x338f('0x6b')]=qs[_0x338f('0x52')](_0x2c59d0['query']['sort']);_0x5cdaf4[_0x338f('0x53')]=qs[_0x338f('0x4d')](_[_0x338f('0x6c')](_0x2c59d0[_0x338f('0x4b')],_0x22569e[_0x338f('0x4d')]));_0x5cdaf4[_0x338f('0x53')][_0x338f('0x6d')]=_0x1de2b8['id'];if(_0x2c59d0[_0x338f('0x4b')][_0x338f('0x54')]){_0x5cdaf4['where']=_['merge'](_0x5cdaf4[_0x338f('0x53')],{'$or':_['map'](_0x5cdaf4[_0x338f('0x4f')],function(_0x5c5921){var _0x4eeb31={};_0x4eeb31[_0x5c5921]={'$like':'%'+_0x2c59d0['query'][_0x338f('0x54')]+'%'};return _0x4eeb31;})});}_0x5cdaf4=_['merge']({},_0x5cdaf4,_0x2c59d0[_0x338f('0x56')]);return db['UserChatQueue'][_0x338f('0x58')](_0x5cdaf4);}})[_0x338f('0x25')](function(_0x2e1142){if(_0x2e1142){return db[_0x338f('0x6e')][_0x338f('0x6f')]({'where':{'id':_[_0x338f('0x45')](_0x2e1142,_0x338f('0x70')),'role':'agent'},'attributes':['id','name',_0x338f('0x71'),_0x338f('0x72'),_0x338f('0x73')]});}})['then'](function(_0x57d5e9){if(_0x57d5e9){return{'count':_0x57d5e9['count'],'rows':_[_0x338f('0x45')](_0x57d5e9[_0x338f('0x59')],function(_0x39bce5){return{'membername':_0x39bce5['name'],'UserId':_0x39bce5['id'],'queue_name':_0x25b0d6['name'],'ChatQueueId':_0x25b0d6['id'],'interface':util[_0x338f('0x74')](_0x338f('0x75'),_0x338f('0x76'),_0x39bce5[_0x338f('0x42')]),'penalty':0x0,'paused':_0x39bce5[_0x338f('0x71')],'createdAt':_0x39bce5[_0x338f('0x73')],'updatedAt':_0x39bce5[_0x338f('0x72')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x526f31,_0x5cdaf4))[_0x338f('0x30')](handleError(_0x526f31,null));};exports[_0x338f('0x77')]=function(_0x582448,_0x58f28d,_0x35c64a){var _0x5c5f8a={};var _0x3f7f90={};var _0x97c982;var _0x26a51d;return db[_0x338f('0x46')][_0x338f('0x69')]({'where':{'id':_0x582448[_0x338f('0x5b')]['id']}})[_0x338f('0x25')](handleEntityNotFound(_0x58f28d,null))['then'](function(_0x4ba0e9){if(_0x4ba0e9){_0x97c982=_0x4ba0e9;_0x3f7f90[_0x338f('0x4a')]=_['keys'](db['Team'][_0x338f('0x47')]);_0x3f7f90['query']=_[_0x338f('0x4c')](_0x582448[_0x338f('0x4b')]);_0x3f7f90[_0x338f('0x4d')]=_['intersection'](_0x3f7f90[_0x338f('0x4a')],_0x3f7f90[_0x338f('0x4b')]);_0x5c5f8a[_0x338f('0x4f')]=_['intersection'](_0x3f7f90['model'],qs[_0x338f('0x50')](_0x582448[_0x338f('0x4b')][_0x338f('0x50')]));_0x5c5f8a['attributes']=_0x5c5f8a[_0x338f('0x4f')][_0x338f('0x5c')]?_0x5c5f8a['attributes']:_0x3f7f90[_0x338f('0x4a')];_0x5c5f8a['order']=qs[_0x338f('0x52')](_0x582448[_0x338f('0x4b')]['sort']);_0x5c5f8a[_0x338f('0x53')]=qs[_0x338f('0x4d')](_[_0x338f('0x6c')](_0x582448['query'],_0x3f7f90[_0x338f('0x4d')]));if(_0x582448[_0x338f('0x4b')][_0x338f('0x54')]){_0x5c5f8a[_0x338f('0x53')]=_[_0x338f('0x55')](_0x5c5f8a[_0x338f('0x53')],{'$or':_[_0x338f('0x45')](_0x5c5f8a[_0x338f('0x4f')],function(_0xffbafd){var _0x453afd={};_0x453afd[_0xffbafd]={'$like':'%'+_0x582448[_0x338f('0x4b')][_0x338f('0x54')]+'%'};return _0x453afd;})});}_0x5c5f8a=_[_0x338f('0x55')]({},_0x5c5f8a,_0x582448['options']);return _0x97c982[_0x338f('0x77')](_0x5c5f8a);}})[_0x338f('0x25')](function(_0xfec572){if(_0xfec572){_0x26a51d=_0xfec572[_0x338f('0x5c')];if(!_0x582448['query']['hasOwnProperty'](_0x338f('0x78'))){_0x5c5f8a['limit']=qs[_0x338f('0x37')](_0x582448[_0x338f('0x4b')][_0x338f('0x37')]);_0x5c5f8a[_0x338f('0x35')]=qs['offset'](_0x582448[_0x338f('0x4b')][_0x338f('0x35')]);}return _0x97c982[_0x338f('0x77')](_0x5c5f8a);}})[_0x338f('0x25')](function(_0x5b6d3b){if(_0x5b6d3b){return _0x5b6d3b?{'count':_0x26a51d,'rows':_0x5b6d3b}:null;}})[_0x338f('0x25')](respondWithResult(_0x58f28d,null))[_0x338f('0x30')](handleError(_0x58f28d,null));};exports[_0x338f('0x79')]=function(_0x48d69f,_0x2d4bd6,_0x2a6dd4){var _0x5f4019=_0x48d69f['body'][_0x338f('0x7a')];return db[_0x338f('0x7b')]['findAll']({'where':{'id':_0x5f4019},'attributes':['id'],'include':[{'model':db['User'],'as':_0x338f('0x7c'),'attributes':['id',_0x338f('0x42'),'online',_0x338f('0x7d'),_0x338f('0x7e')],'raw':!![]}]})['then'](function(_0x42dd79){if(_0x42dd79){var _0x472aeb=_[_0x338f('0x7f')](_0x42dd79,function(_0x490e3c){var _0x1b8074=_0x490e3c[_0x338f('0x3f')]({'plain':!![]});return _0x1b8074[_0x338f('0x7c')];});return db['ChatQueue'][_0x338f('0x5d')]({'where':{'id':_0x48d69f[_0x338f('0x5b')]['id']}})['then'](function(_0x50574){return db[_0x338f('0x80')][_0x338f('0x81')](function(_0x1695f6){return _0x50574[_0x338f('0x79')](_0x5f4019,{'transaction':_0x1695f6})['then'](function(){return BPromise[_0x338f('0x82')](_0x472aeb,function(_0x47ebbb){return db['UserChatQueue'][_0x338f('0x83')]({'where':{'UserId':_0x47ebbb['id'],'ChatQueueId':_0x48d69f[_0x338f('0x5b')]['id']},'transaction':_0x1695f6});});})['then'](function(){_0x472aeb[_0x338f('0x84')](function(_0x35587d){socket[_0x338f('0x85')]('userChatQueue:save',{'UserId':_0x35587d['id'],'ChatQueueId':_0x50574['id']});});});});});}})[_0x338f('0x25')](respondWithStatusCode(_0x2d4bd6,null))[_0x338f('0x30')](handleError(_0x2d4bd6,null));};exports[_0x338f('0x86')]=function(_0x218fdd,_0x5c6e33,_0x133f66){return db[_0x338f('0x7b')][_0x338f('0x58')]({'where':{'id':_0x218fdd[_0x338f('0x4b')][_0x338f('0x7a')]},'attributes':['id'],'include':[{'model':db[_0x338f('0x6e')],'as':_0x338f('0x7c'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x5c6e33,null))[_0x338f('0x25')](function(_0x3add83){var _0x2a040f=_[_0x338f('0x45')](_0x3add83,'id');var _0x3d4def=[];var _0x440f6d=[];var _0x37be3c=squel[_0x338f('0x87')]();_0x37be3c['field'](_0x338f('0x88'))['from'](_0x338f('0x89'),'tq')[_0x338f('0x8a')](_0x338f('0x8b'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x338f('0x53')](_0x338f('0x8c'),_0x218fdd['params']['id']);for(var _0x1f7b5d=0x0;_0x1f7b5d<_0x3add83[_0x338f('0x5c')];_0x1f7b5d+=0x1){let _0x8a0918=_0x3add83[_0x1f7b5d];for(var _0x5ad9fe=0x0;_0x5ad9fe<_0x8a0918[_0x338f('0x7c')][_0x338f('0x5c')];_0x5ad9fe+=0x1){let _0x16e778=_0x8a0918[_0x338f('0x7c')][_0x5ad9fe];var _0x1392ba=_0x37be3c['clone']();_0x1392ba['where']('ut.UserId\x20=\x20?',_0x16e778['id']);_0x440f6d[_0x338f('0x8d')](db[_0x338f('0x80')][_0x338f('0x4b')](_0x1392ba['toString'](),{'type':db[_0x338f('0x80')][_0x338f('0x8e')][_0x338f('0x8f')]})['then'](function(_0x3cb128){if(_0x3cb128[_0x338f('0x5c')]===0x1){return _0x16e778['id'];}else{var _0x15dbbb=_['every'](_[_0x338f('0x45')](_0x3cb128,'TeamId'),function(_0x1d5835){return _['includes'](_0x2a040f,_0x1d5835);});if(_0x15dbbb){return _0x16e778['id'];}}}));}}return BPromise[_0x338f('0x90')](_0x440f6d)[_0x338f('0x25')](function(_0x2f6176){_0x3d4def=_(_0x3d4def)[_0x338f('0x91')](_0x2f6176)[_0x338f('0x92')]()['value']();return db[_0x338f('0x46')]['find']({'where':{'id':_0x218fdd[_0x338f('0x5b')]['id']}})[_0x338f('0x25')](function(_0x3e0b94){return db[_0x338f('0x80')][_0x338f('0x81')](function(_0x3523da){return _0x3e0b94[_0x338f('0x86')](_0x218fdd[_0x338f('0x4b')]['ids'],{'transaction':_0x3523da})[_0x338f('0x25')](function(){if(!_['isEmpty'](_0x3d4def)){return _0x3e0b94['removeAgents'](_0x3d4def,{'transaction':_0x3523da});}})[_0x338f('0x25')](function(){_0x3d4def[_0x338f('0x84')](function(_0x8f1c45){socket[_0x338f('0x85')](_0x338f('0x93'),{'UserId':_0x8f1c45,'ChatQueueId':_0x3e0b94['id']});});});});});});})[_0x338f('0x25')](respondWithStatusCode(_0x5c6e33,null))[_0x338f('0x30')](handleError(_0x5c6e33,null));};exports[_0x338f('0x94')]=function(_0x27b182,_0x4087c6,_0x441b14){return db[_0x338f('0x46')][_0x338f('0x5d')]({'where':{'id':_0x27b182[_0x338f('0x5b')]['id']}})[_0x338f('0x25')](handleEntityNotFound(_0x4087c6,null))[_0x338f('0x25')](function(_0x44b08b){if(_0x44b08b){return _0x44b08b[_0x338f('0x94')](_0x27b182[_0x338f('0x5f')][_0x338f('0x7a')],_[_0x338f('0x95')](_0x27b182[_0x338f('0x5f')],['ids','id'])||{})['spread'](function(_0x34e5cf){for(var _0x547ebe=0x0;_0x547ebe<_0x27b182[_0x338f('0x5f')]['ids']['length'];_0x547ebe+=0x1){socket['emit'](_0x338f('0x96'),{'UserId':Number(_0x27b182['body']['ids'][_0x547ebe]),'ChatQueueId':Number(_0x27b182[_0x338f('0x5b')]['id'])});}return _0x34e5cf;});}})['then'](respondWithResult(_0x4087c6,null))[_0x338f('0x30')](handleError(_0x4087c6,null));};exports['removeAgents']=function(_0x6d27ad,_0x59c192,_0x3026aa){return db[_0x338f('0x46')][_0x338f('0x5d')]({'where':{'id':_0x6d27ad[_0x338f('0x5b')]['id']}})[_0x338f('0x25')](handleEntityNotFound(_0x59c192,null))[_0x338f('0x25')](function(_0x2138ba){if(_0x2138ba){return _0x2138ba[_0x338f('0x97')](_0x6d27ad['query']['ids'])[_0x338f('0x25')](function(){if(_[_0x338f('0x98')](_0x6d27ad['query'][_0x338f('0x7a')])){for(var _0x7a8f=0x0;_0x7a8f<_0x6d27ad[_0x338f('0x4b')]['ids'][_0x338f('0x5c')];_0x7a8f+=0x1){socket['emit'](_0x338f('0x93'),{'UserId':Number(_0x6d27ad['query'][_0x338f('0x7a')][_0x7a8f]),'ChatQueueId':Number(_0x6d27ad[_0x338f('0x5b')]['id'])});}}else{socket[_0x338f('0x85')](_0x338f('0x93'),{'UserId':Number(_0x6d27ad[_0x338f('0x4b')][_0x338f('0x7a')]),'ChatQueueId':Number(_0x6d27ad[_0x338f('0x5b')]['id'])});}});}})['then'](respondWithStatusCode(_0x59c192,null))[_0x338f('0x30')](handleError(_0x59c192,null));};exports[_0x338f('0x99')]=function(_0x3e8ce5,_0x15566a,_0x4cd52a){var _0x2fe06b={};var _0x228dc7={};var _0x5b3f58;var _0x407819;return db[_0x338f('0x46')][_0x338f('0x69')]({'where':{'id':_0x3e8ce5[_0x338f('0x5b')]['id']}})[_0x338f('0x25')](handleEntityNotFound(_0x15566a,null))['then'](function(_0x7b1702){if(_0x7b1702){_0x5b3f58=_0x7b1702;_0x228dc7[_0x338f('0x4a')]=_[_0x338f('0x4c')](db[_0x338f('0x6e')]['rawAttributes']);_0x228dc7[_0x338f('0x4b')]=_[_0x338f('0x4c')](_0x3e8ce5[_0x338f('0x4b')]);_0x228dc7[_0x338f('0x4d')]=_[_0x338f('0x4e')](_0x228dc7['model'],_0x228dc7[_0x338f('0x4b')]);_0x2fe06b[_0x338f('0x4f')]=_[_0x338f('0x4e')](_0x228dc7[_0x338f('0x4a')],qs['fields'](_0x3e8ce5['query'][_0x338f('0x50')]));_0x2fe06b[_0x338f('0x4f')]=_0x2fe06b['attributes']['length']?_0x2fe06b[_0x338f('0x4f')]:_0x228dc7['model'];_0x2fe06b[_0x338f('0x6b')]=qs[_0x338f('0x52')](_0x3e8ce5[_0x338f('0x4b')][_0x338f('0x52')]);_0x2fe06b[_0x338f('0x53')]=qs['filters'](_[_0x338f('0x6c')](_0x3e8ce5[_0x338f('0x4b')],_0x228dc7[_0x338f('0x4d')]));if(_0x3e8ce5['query'][_0x338f('0x54')]){_0x2fe06b['where']=_[_0x338f('0x55')](_0x2fe06b['where'],{'$or':_[_0x338f('0x45')](_0x2fe06b['attributes'],function(_0x11fab5){var _0x4b646d={};_0x4b646d[_0x11fab5]={'$like':'%'+_0x3e8ce5[_0x338f('0x4b')]['filter']+'%'};return _0x4b646d;})});}_0x2fe06b=_['merge']({},_0x2fe06b,_0x3e8ce5[_0x338f('0x56')]);return _0x5b3f58['getAgents'](_0x2fe06b);}})[_0x338f('0x25')](function(_0x589b6b){if(_0x589b6b){_0x407819=_0x589b6b[_0x338f('0x5c')];if(!_0x3e8ce5[_0x338f('0x4b')]['hasOwnProperty'](_0x338f('0x78'))){_0x2fe06b[_0x338f('0x37')]=qs[_0x338f('0x37')](_0x3e8ce5[_0x338f('0x4b')][_0x338f('0x37')]);_0x2fe06b[_0x338f('0x35')]=qs[_0x338f('0x35')](_0x3e8ce5[_0x338f('0x4b')][_0x338f('0x35')]);}return _0x5b3f58[_0x338f('0x99')](_0x2fe06b);}})[_0x338f('0x25')](function(_0x538163){if(_0x538163){return _0x538163?{'count':_0x407819,'rows':_0x538163}:null;}})[_0x338f('0x25')](respondWithResult(_0x15566a,null))[_0x338f('0x30')](handleError(_0x15566a,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 908b2ca..a78a7dc 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 _0xf08d=['ChatQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xf08d,0x80));var _0xdf08=function(_0x1251a9,_0x3899f4){_0x1251a9=_0x1251a9-0x0;var _0x3fb2fc=_0xf08d[_0x1251a9];return _0x3fb2fc;};'use strict';var EventEmitter=require(_0xdf08('0x0'));var ChatQueue=require(_0xdf08('0x1'))['db'][_0xdf08('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xdf08('0x3')](0x0);var events={'afterCreate':_0xdf08('0x4'),'afterUpdate':_0xdf08('0x5'),'afterDestroy':_0xdf08('0x6')};function emitEvent(_0xb99dc9){return function(_0x1d2030,_0x5a9765,_0x132305){ChatQueueEvents[_0xdf08('0x7')](_0xb99dc9+':'+_0x1d2030['id'],_0x1d2030);ChatQueueEvents[_0xdf08('0x7')](_0xb99dc9,_0x1d2030);_0x132305(null);};}for(var e in events){if(events[_0xdf08('0x8')](e)){var event=events[e];ChatQueue[_0xdf08('0x9')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file +var _0x1429=['events','../../mysqldb','ChatQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x39772f,_0x5605cb){var _0xc9edbf=function(_0x106a39){while(--_0x106a39){_0x39772f['push'](_0x39772f['shift']());}};_0xc9edbf(++_0x5605cb);}(_0x1429,0x1d9));var _0x9142=function(_0x12bc60,_0x8b1be9){_0x12bc60=_0x12bc60-0x0;var _0x2ac34a=_0x1429[_0x12bc60];return _0x2ac34a;};'use strict';var EventEmitter=require(_0x9142('0x0'));var ChatQueue=require(_0x9142('0x1'))['db'][_0x9142('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x9142('0x3')](0x0);var events={'afterCreate':_0x9142('0x4'),'afterUpdate':_0x9142('0x5'),'afterDestroy':_0x9142('0x6')};function emitEvent(_0x4ed352){return function(_0x32155e,_0x151af7,_0x41382f){ChatQueueEvents[_0x9142('0x7')](_0x4ed352+':'+_0x32155e['id'],_0x32155e);ChatQueueEvents[_0x9142('0x7')](_0x4ed352,_0x32155e);_0x41382f(null);};}for(var e in events){if(events[_0x9142('0x8')](e)){var event=events[e];ChatQueue[_0x9142('0x9')](e,emitEvent(event));}}module[_0x9142('0xa')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 5cf668b..1ce5c54 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 _0x4889=['moment','request-promise','path','rimraf','../../config/environment','exports','chat_queues','lodash','util','../../config/logger','api'];(function(_0x31b569,_0x85d4c1){var _0x3330ba=function(_0x2757ef){while(--_0x2757ef){_0x31b569['push'](_0x31b569['shift']());}};_0x3330ba(++_0x85d4c1);}(_0x4889,0xee));var _0x9488=function(_0x2fda4d,_0x1a3f7a){_0x2fda4d=_0x2fda4d-0x0;var _0x1b6ce7=_0x4889[_0x2fda4d];return _0x1b6ce7;};'use strict';var _=require(_0x9488('0x0'));var util=require(_0x9488('0x1'));var logger=require(_0x9488('0x2'))(_0x9488('0x3'));var moment=require(_0x9488('0x4'));var BPromise=require('bluebird');var rp=require(_0x9488('0x5'));var fs=require('fs');var path=require(_0x9488('0x6'));var rimraf=require(_0x9488('0x7'));var config=require(_0x9488('0x8'));var attributes=require('./chatQueue.attributes');module[_0x9488('0x9')]=function(_0xc7e19c,_0x3a6f8e){return _0xc7e19c['define']('ChatQueue',attributes,{'tableName':_0x9488('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8d6a=['rimraf','../../config/environment','./chatQueue.attributes','exports','define','ChatQueue','util','../../config/logger','api','moment','request-promise','path'];(function(_0x2f7842,_0x303782){var _0x21e788=function(_0x29e914){while(--_0x29e914){_0x2f7842['push'](_0x2f7842['shift']());}};_0x21e788(++_0x303782);}(_0x8d6a,0x1b6));var _0xa8d6=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x8d6a[_0xae7c2f];return _0x5d7001;};'use strict';var _=require('lodash');var util=require(_0xa8d6('0x0'));var logger=require(_0xa8d6('0x1'))(_0xa8d6('0x2'));var moment=require(_0xa8d6('0x3'));var BPromise=require('bluebird');var rp=require(_0xa8d6('0x4'));var fs=require('fs');var path=require(_0xa8d6('0x5'));var rimraf=require(_0xa8d6('0x6'));var config=require(_0xa8d6('0x7'));var attributes=require(_0xa8d6('0x8'));module[_0xa8d6('0x9')]=function(_0x52f8a8,_0x38e650){return _0x52f8a8[_0xa8d6('0xa')](_0xa8d6('0xb'),attributes,{'tableName':'chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index 0bef540..93f96d3 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 _0x66d3=['redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','request','then','info','debug','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','ChatQueue,\x20%s,\x20%s','message','result','catch','GetChatQueue','ChatQueue','findAll','options','raw','where','attributes','limit','include','map','model','find','ShowChatQueue','lodash','moment','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x66d3,0x10f));var _0x366d=function(_0x45b6fd,_0x17ef51){_0x45b6fd=_0x45b6fd-0x0;var _0x1b3c61=_0x66d3[_0x45b6fd];return _0x1b3c61;};'use strict';var _=require(_0x366d('0x0'));var util=require('util');var moment=require(_0x366d('0x1'));var BPromise=require('bluebird');var rs=require(_0x366d('0x2'));var fs=require('fs');var Redis=require(_0x366d('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x366d('0x4'));var logger=require('../../config/logger')(_0x366d('0x5'));var config=require('../../config/environment');var jayson=require(_0x366d('0x6'));var client=jayson[_0x366d('0x7')][_0x366d('0x8')]({'port':0x232a});config[_0x366d('0x9')]=_[_0x366d('0xa')](config[_0x366d('0x9')],{'host':_0x366d('0xb'),'port':0x18eb});var socket=require(_0x366d('0xc'))(new Redis(config[_0x366d('0x9')]));require(_0x366d('0xd'))[_0x366d('0xe')](socket);function respondWithRpcPromise(_0x4e3ba3,_0x30ad5a,_0x38213d){return new BPromise(function(_0x3b6902,_0x40cc04){return client[_0x366d('0xf')](_0x4e3ba3,_0x38213d)[_0x366d('0x10')](function(_0x1ef0a8){logger[_0x366d('0x11')]('ChatQueue,\x20%s,\x20%s',_0x30ad5a,'request\x20sent');logger[_0x366d('0x12')](_0x366d('0x13'),_0x30ad5a,_0x366d('0x14'),JSON[_0x366d('0x15')](_0x1ef0a8));if(_0x1ef0a8[_0x366d('0x16')]){if(_0x1ef0a8[_0x366d('0x16')]['code']===0x1f4){logger[_0x366d('0x16')](_0x366d('0x17'),_0x30ad5a,_0x1ef0a8['error'][_0x366d('0x18')]);return _0x40cc04(_0x1ef0a8[_0x366d('0x16')]['message']);}logger[_0x366d('0x16')](_0x366d('0x17'),_0x30ad5a,_0x1ef0a8[_0x366d('0x16')]['message']);return _0x3b6902(_0x1ef0a8[_0x366d('0x16')]['message']);}else{logger[_0x366d('0x11')](_0x366d('0x17'),_0x30ad5a,'request\x20sent');_0x3b6902(_0x1ef0a8[_0x366d('0x19')][_0x366d('0x18')]);}})[_0x366d('0x1a')](function(_0x3134e5){logger[_0x366d('0x16')]('ChatQueue,\x20%s,\x20%s',_0x30ad5a,_0x3134e5);_0x40cc04(_0x3134e5);});});}exports[_0x366d('0x1b')]=function(_0x51bf3b){var _0x191966=this;return new Promise(function(_0x51da9a,_0x5cbe3b){return db[_0x366d('0x1c')][_0x366d('0x1d')]({'raw':_0x51bf3b['options']?_0x51bf3b[_0x366d('0x1e')][_0x366d('0x1f')]===undefined?!![]:![]:!![],'where':_0x51bf3b[_0x366d('0x1e')]?_0x51bf3b[_0x366d('0x1e')][_0x366d('0x20')]||null:null,'attributes':_0x51bf3b[_0x366d('0x1e')]?_0x51bf3b['options'][_0x366d('0x21')]||null:null,'limit':_0x51bf3b[_0x366d('0x1e')]?_0x51bf3b[_0x366d('0x1e')][_0x366d('0x22')]||null:null,'include':_0x51bf3b[_0x366d('0x1e')]?_0x51bf3b['options'][_0x366d('0x23')]?_[_0x366d('0x24')](_0x51bf3b[_0x366d('0x1e')][_0x366d('0x23')],function(_0x53002e){return{'model':db[_0x53002e['model']],'as':_0x53002e['as'],'attributes':_0x53002e[_0x366d('0x21')],'include':_0x53002e[_0x366d('0x23')]?_['map'](_0x53002e['include'],function(_0x10628b){return{'model':db[_0x10628b[_0x366d('0x25')]],'as':_0x10628b['as'],'attributes':_0x10628b[_0x366d('0x21')],'include':_0x10628b[_0x366d('0x23')]?_['map'](_0x10628b[_0x366d('0x23')],function(_0x5dc954){return{'model':db[_0x5dc954[_0x366d('0x25')]],'as':_0x5dc954['as'],'attributes':_0x5dc954[_0x366d('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x535b26){logger[_0x366d('0x11')](_0x366d('0x1b'),_0x51bf3b);logger[_0x366d('0x12')]('GetChatQueue',_0x51bf3b,JSON[_0x366d('0x15')](_0x535b26));_0x51da9a(_0x535b26);})[_0x366d('0x1a')](function(_0x460e4c){logger[_0x366d('0x16')](_0x366d('0x1b'),_0x460e4c[_0x366d('0x18')],_0x51bf3b);_0x5cbe3b(_0x191966['error'](0x1f4,_0x460e4c[_0x366d('0x18')]));});});};exports['ShowChatQueue']=function(_0x318f63){var _0x58890a=this;return new Promise(function(_0x12106a,_0x12ed22){return db[_0x366d('0x1c')][_0x366d('0x26')]({'raw':_0x318f63['options']?_0x318f63[_0x366d('0x1e')][_0x366d('0x1f')]===undefined?!![]:![]:!![],'where':_0x318f63[_0x366d('0x1e')]?_0x318f63[_0x366d('0x1e')][_0x366d('0x20')]||null:null,'attributes':_0x318f63[_0x366d('0x1e')]?_0x318f63['options']['attributes']||null:null,'include':_0x318f63[_0x366d('0x1e')]?_0x318f63[_0x366d('0x1e')][_0x366d('0x23')]?_[_0x366d('0x24')](_0x318f63['options'][_0x366d('0x23')],function(_0x3517bc){return{'model':db[_0x3517bc[_0x366d('0x25')]],'as':_0x3517bc['as'],'attributes':_0x3517bc[_0x366d('0x21')],'include':_0x3517bc[_0x366d('0x23')]?_[_0x366d('0x24')](_0x3517bc[_0x366d('0x23')],function(_0x20b991){return{'model':db[_0x20b991[_0x366d('0x25')]],'as':_0x20b991['as'],'attributes':_0x20b991['attributes'],'include':_0x20b991[_0x366d('0x23')]?_[_0x366d('0x24')](_0x20b991[_0x366d('0x23')],function(_0x5a93f3){return{'model':db[_0x5a93f3[_0x366d('0x25')]],'as':_0x5a93f3['as'],'attributes':_0x5a93f3[_0x366d('0x21')]};}):[]};}):[]};}):[]:[]})[_0x366d('0x10')](function(_0x3602e7){logger[_0x366d('0x11')](_0x366d('0x27'),_0x318f63);logger['debug'](_0x366d('0x27'),_0x318f63,JSON[_0x366d('0x15')](_0x3602e7));_0x12106a(_0x3602e7);})[_0x366d('0x1a')](function(_0x4a99f2){logger['error'](_0x366d('0x27'),_0x4a99f2[_0x366d('0x18')],_0x318f63);_0x12ed22(_0x58890a[_0x366d('0x16')](0x1f4,_0x4a99f2[_0x366d('0x18')]));});});}; \ No newline at end of file +var _0x9efc=['ChatQueue','findAll','options','raw','where','attributes','limit','include','map','model','ShowChatQueue','find','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','then','info','debug','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ChatQueue,\x20%s,\x20%s','message','result','catch','GetChatQueue'];(function(_0x40251c,_0x3320b5){var _0x1dad5a=function(_0x1a6993){while(--_0x1a6993){_0x40251c['push'](_0x40251c['shift']());}};_0x1dad5a(++_0x3320b5);}(_0x9efc,0x19c));var _0xc9ef=function(_0xa4f636,_0xaca1b6){_0xa4f636=_0xa4f636-0x0;var _0x37e02a=_0x9efc[_0xa4f636];return _0x37e02a;};'use strict';var _=require(_0xc9ef('0x0'));var util=require(_0xc9ef('0x1'));var moment=require(_0xc9ef('0x2'));var BPromise=require(_0xc9ef('0x3'));var rs=require(_0xc9ef('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc9ef('0x5'));var logger=require('../../config/logger')(_0xc9ef('0x6'));var config=require('../../config/environment');var jayson=require(_0xc9ef('0x7'));var client=jayson['client'][_0xc9ef('0x8')]({'port':0x232a});config[_0xc9ef('0x9')]=_[_0xc9ef('0xa')](config[_0xc9ef('0x9')],{'host':_0xc9ef('0xb'),'port':0x18eb});var socket=require(_0xc9ef('0xc'))(new Redis(config[_0xc9ef('0x9')]));require(_0xc9ef('0xd'))[_0xc9ef('0xe')](socket);function respondWithRpcPromise(_0x72a763,_0x3db539,_0x5a9bf4){return new BPromise(function(_0x51b805,_0x129f49){return client['request'](_0x72a763,_0x5a9bf4)[_0xc9ef('0xf')](function(_0x52699a){logger[_0xc9ef('0x10')]('ChatQueue,\x20%s,\x20%s',_0x3db539,'request\x20sent');logger[_0xc9ef('0x11')](_0xc9ef('0x12'),_0x3db539,_0xc9ef('0x13'),JSON[_0xc9ef('0x14')](_0x52699a));if(_0x52699a[_0xc9ef('0x15')]){if(_0x52699a[_0xc9ef('0x15')][_0xc9ef('0x16')]===0x1f4){logger[_0xc9ef('0x15')](_0xc9ef('0x17'),_0x3db539,_0x52699a[_0xc9ef('0x15')][_0xc9ef('0x18')]);return _0x129f49(_0x52699a['error'][_0xc9ef('0x18')]);}logger[_0xc9ef('0x15')](_0xc9ef('0x17'),_0x3db539,_0x52699a[_0xc9ef('0x15')][_0xc9ef('0x18')]);return _0x51b805(_0x52699a['error'][_0xc9ef('0x18')]);}else{logger[_0xc9ef('0x10')](_0xc9ef('0x17'),_0x3db539,_0xc9ef('0x13'));_0x51b805(_0x52699a[_0xc9ef('0x19')][_0xc9ef('0x18')]);}})[_0xc9ef('0x1a')](function(_0x22a0de){logger[_0xc9ef('0x15')](_0xc9ef('0x17'),_0x3db539,_0x22a0de);_0x129f49(_0x22a0de);});});}exports[_0xc9ef('0x1b')]=function(_0x301d56){var _0x2936f6=this;return new Promise(function(_0x1b8dbd,_0x572f83){return db[_0xc9ef('0x1c')][_0xc9ef('0x1d')]({'raw':_0x301d56[_0xc9ef('0x1e')]?_0x301d56['options'][_0xc9ef('0x1f')]===undefined?!![]:![]:!![],'where':_0x301d56[_0xc9ef('0x1e')]?_0x301d56[_0xc9ef('0x1e')][_0xc9ef('0x20')]||null:null,'attributes':_0x301d56['options']?_0x301d56[_0xc9ef('0x1e')][_0xc9ef('0x21')]||null:null,'limit':_0x301d56['options']?_0x301d56[_0xc9ef('0x1e')][_0xc9ef('0x22')]||null:null,'include':_0x301d56['options']?_0x301d56[_0xc9ef('0x1e')][_0xc9ef('0x23')]?_[_0xc9ef('0x24')](_0x301d56[_0xc9ef('0x1e')]['include'],function(_0x1c6422){return{'model':db[_0x1c6422[_0xc9ef('0x25')]],'as':_0x1c6422['as'],'attributes':_0x1c6422[_0xc9ef('0x21')],'include':_0x1c6422[_0xc9ef('0x23')]?_['map'](_0x1c6422['include'],function(_0x1ffdfa){return{'model':db[_0x1ffdfa[_0xc9ef('0x25')]],'as':_0x1ffdfa['as'],'attributes':_0x1ffdfa[_0xc9ef('0x21')],'include':_0x1ffdfa['include']?_[_0xc9ef('0x24')](_0x1ffdfa[_0xc9ef('0x23')],function(_0x2b5831){return{'model':db[_0x2b5831[_0xc9ef('0x25')]],'as':_0x2b5831['as'],'attributes':_0x2b5831[_0xc9ef('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x56dca7){logger[_0xc9ef('0x10')](_0xc9ef('0x1b'),_0x301d56);logger['debug']('GetChatQueue',_0x301d56,JSON[_0xc9ef('0x14')](_0x56dca7));_0x1b8dbd(_0x56dca7);})['catch'](function(_0x3a5c1b){logger['error'](_0xc9ef('0x1b'),_0x3a5c1b[_0xc9ef('0x18')],_0x301d56);_0x572f83(_0x2936f6[_0xc9ef('0x15')](0x1f4,_0x3a5c1b[_0xc9ef('0x18')]));});});};exports[_0xc9ef('0x26')]=function(_0x148190){var _0x5210ac=this;return new Promise(function(_0x2f957b,_0xfdd7){return db['ChatQueue'][_0xc9ef('0x27')]({'raw':_0x148190[_0xc9ef('0x1e')]?_0x148190[_0xc9ef('0x1e')][_0xc9ef('0x1f')]===undefined?!![]:![]:!![],'where':_0x148190[_0xc9ef('0x1e')]?_0x148190['options'][_0xc9ef('0x20')]||null:null,'attributes':_0x148190[_0xc9ef('0x1e')]?_0x148190[_0xc9ef('0x1e')][_0xc9ef('0x21')]||null:null,'include':_0x148190[_0xc9ef('0x1e')]?_0x148190['options']['include']?_[_0xc9ef('0x24')](_0x148190[_0xc9ef('0x1e')][_0xc9ef('0x23')],function(_0x5f10c9){return{'model':db[_0x5f10c9['model']],'as':_0x5f10c9['as'],'attributes':_0x5f10c9[_0xc9ef('0x21')],'include':_0x5f10c9[_0xc9ef('0x23')]?_['map'](_0x5f10c9['include'],function(_0x23686a){return{'model':db[_0x23686a[_0xc9ef('0x25')]],'as':_0x23686a['as'],'attributes':_0x23686a[_0xc9ef('0x21')],'include':_0x23686a['include']?_[_0xc9ef('0x24')](_0x23686a[_0xc9ef('0x23')],function(_0x30d2ba){return{'model':db[_0x30d2ba['model']],'as':_0x30d2ba['as'],'attributes':_0x30d2ba[_0xc9ef('0x21')]};}):[]};}):[]};}):[]:[]})[_0xc9ef('0xf')](function(_0x22fb79){logger['info']('ShowChatQueue',_0x148190);logger[_0xc9ef('0x11')](_0xc9ef('0x26'),_0x148190,JSON['stringify'](_0x22fb79));_0x2f957b(_0x22fb79);})[_0xc9ef('0x1a')](function(_0x4a0a71){logger[_0xc9ef('0x15')](_0xc9ef('0x26'),_0x4a0a71[_0xc9ef('0x18')],_0x148190);_0xfdd7(_0x5210ac['error'](0x1f4,_0x4a0a71[_0xc9ef('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 770d064..95aa7dc 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 _0x3e74=['emit','removeListener','register','length','chatQueue:','./chatQueue.events','remove','update'];(function(_0x49d41c,_0x2bdc35){var _0xb64c5f=function(_0x28f535){while(--_0x28f535){_0x49d41c['push'](_0x49d41c['shift']());}};_0xb64c5f(++_0x2bdc35);}(_0x3e74,0x175));var _0x43e7=function(_0x29d830,_0x27dced){_0x29d830=_0x29d830-0x0;var _0x14a961=_0x3e74[_0x29d830];return _0x14a961;};'use strict';var ChatQueueEvents=require(_0x43e7('0x0'));var events=['save',_0x43e7('0x1'),_0x43e7('0x2')];function createListener(_0x151ad2,_0x494e45){return function(_0x490ced){_0x494e45[_0x43e7('0x3')](_0x151ad2,_0x490ced);};}function removeListener(_0x4f9bbe,_0x128b0f){return function(){ChatQueueEvents[_0x43e7('0x4')](_0x4f9bbe,_0x128b0f);};}exports[_0x43e7('0x5')]=function(_0x1c503b){for(var _0xc98b9c=0x0,_0x503698=events[_0x43e7('0x6')];_0xc98b9c<_0x503698;_0xc98b9c++){var _0x3491d6=events[_0xc98b9c];var _0x2ede2d=createListener(_0x43e7('0x7')+_0x3491d6,_0x1c503b);ChatQueueEvents['on'](_0x3491d6,_0x2ede2d);}}; \ No newline at end of file +var _0x0b78=['removeListener','length','chatQueue:','./chatQueue.events','save','update'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x0b78,0x1ad));var _0x80b7=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x0b78[_0x2641f9];return _0x585741;};'use strict';var ChatQueueEvents=require(_0x80b7('0x0'));var events=[_0x80b7('0x1'),'remove',_0x80b7('0x2')];function createListener(_0x4f55ab,_0x4bffac){return function(_0x261012){_0x4bffac['emit'](_0x4f55ab,_0x261012);};}function removeListener(_0x6a187e,_0x89d4d7){return function(){ChatQueueEvents[_0x80b7('0x3')](_0x6a187e,_0x89d4d7);};}exports['register']=function(_0x49bc7f){for(var _0x167ddd=0x0,_0x584401=events[_0x80b7('0x4')];_0x167ddd<_0x584401;_0x167ddd++){var _0x122ebe=events[_0x167ddd];var _0x3c248d=createListener(_0x80b7('0x5')+_0x122ebe,_0x49bc7f);ChatQueueEvents['on'](_0x122ebe,_0x3c248d);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 5ab281e..ade93e3 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 _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(_0x5b4c81,_0x493f98){var _0x4c3fcb=function(_0x3211db){while(--_0x3211db){_0x5b4c81['push'](_0x5b4c81['shift']());}};_0x4c3fcb(++_0x493f98);}(_0x7217,0x19e));var _0x7721=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0x7217[_0x47b58b];return _0x46bebe;};'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 +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(_0x2f27d2,_0x3cd0fb){var _0x466174=function(_0x1f0229){while(--_0x1f0229){_0x2f27d2['push'](_0x2f27d2['shift']());}};_0x466174(++_0x3cd0fb);}(_0x7217,0x19e));var _0x7721=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0x7217[_0x43d11d];return _0x38cd08;};'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 ac15a48..b9b68eb 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 _0x61bb=['DATE','sequelize','exports','STRING'];(function(_0x5b5abe,_0x5cc1dc){var _0x1e5f0c=function(_0x42e135){while(--_0x42e135){_0x5b5abe['push'](_0x5b5abe['shift']());}};_0x1e5f0c(++_0x5cc1dc);}(_0x61bb,0xa1));var _0xb61b=function(_0x27e9f6,_0x31574e){_0x27e9f6=_0x27e9f6-0x0;var _0x23c018=_0x61bb[_0x27e9f6];return _0x23c018;};'use strict';var moment=require('moment');var Sequelize=require(_0xb61b('0x0'));module[_0xb61b('0x1')]={'uniqueid':{'type':Sequelize[_0xb61b('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xb61b('0x2')]},'joinAt':{'type':Sequelize[_0xb61b('0x3')]},'leaveAt':{'type':Sequelize[_0xb61b('0x3')]},'acceptAt':{'type':Sequelize[_0xb61b('0x3')]},'exitAt':{'type':Sequelize[_0xb61b('0x3')]},'reason':{'type':Sequelize[_0xb61b('0x2')]}}; \ No newline at end of file +var _0xe3c2=['sequelize','exports','STRING','DATE','moment'];(function(_0x49ee29,_0x520e25){var _0x2e1ba1=function(_0x114831){while(--_0x114831){_0x49ee29['push'](_0x49ee29['shift']());}};_0x2e1ba1(++_0x520e25);}(_0xe3c2,0x68));var _0x2e3c=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0xe3c2[_0x565c49];return _0x20ca34;};'use strict';var moment=require(_0x2e3c('0x0'));var Sequelize=require(_0x2e3c('0x1'));module[_0x2e3c('0x2')]={'uniqueid':{'type':Sequelize[_0x2e3c('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x2e3c('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x2e3c('0x4')]},'exitAt':{'type':Sequelize[_0x2e3c('0x4')]},'reason':{'type':Sequelize[_0x2e3c('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 9f7bf8f..8792825 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 _0x870d=['includeAll','findAll','rows','catch','show','keys','intersection','include','find','body','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','offset','undefined','count','set','Content-Range','apply','save','update','then','destroy','end','stack','name','index','rawAttributes','map','query','filters','model','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','ChatQueueReport'];(function(_0x240d77,_0x55da73){var _0x26d8f5=function(_0xb459e4){while(--_0xb459e4){_0x240d77['push'](_0x240d77['shift']());}};_0x26d8f5(++_0x55da73);}(_0x870d,0xde));var _0xd870=function(_0x597f81,_0x47a82a){_0x597f81=_0x597f81-0x0;var _0xbe0f2=_0x870d[_0x597f81];return _0xbe0f2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd870('0x0'));var zipdir=require(_0xd870('0x1'));var jsonpatch=require(_0xd870('0x2'));var rp=require(_0xd870('0x3'));var moment=require(_0xd870('0x4'));var BPromise=require(_0xd870('0x5'));var Mustache=require('mustache');var util=require(_0xd870('0x6'));var path=require(_0xd870('0x7'));var sox=require(_0xd870('0x8'));var csv=require(_0xd870('0x9'));var ejs=require(_0xd870('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd870('0xb'));var squel=require(_0xd870('0xc'));var crypto=require(_0xd870('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd870('0x9'));var querystring=require(_0xd870('0xe'));var Papa=require(_0xd870('0xf'));var Redis=require(_0xd870('0x10'));var authService=require(_0xd870('0x11'));var qs=require(_0xd870('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd870('0x13'))(_0xd870('0x14'));var utils=require(_0xd870('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xd870('0x16'));var db=require(_0xd870('0x17'))['db'];function respondWithStatusCode(_0x51137f,_0xd66446){_0xd66446=_0xd66446||0xcc;return function(_0x434193){if(_0x434193){return _0x51137f['sendStatus'](_0xd66446);}return _0x51137f[_0xd870('0x18')](_0xd66446)['end']();};}function respondWithResult(_0x34e325,_0x161fde){_0x161fde=_0x161fde||0xc8;return function(_0x424f06){if(_0x424f06){return _0x34e325[_0xd870('0x18')](_0x161fde)['json'](_0x424f06);}};}function respondWithFilteredResult(_0x1929ef,_0xb2308b){return function(_0x57708e){if(_0x57708e){var _0x14e306=typeof _0xb2308b[_0xd870('0x19')]===_0xd870('0x1a')&&typeof _0xb2308b['limit']===_0xd870('0x1a');var _0xc1f658=_0x57708e['count'];var _0x2b7286=_0x14e306?0x0:_0xb2308b[_0xd870('0x19')];var _0x4ed8da=_0x14e306?_0x57708e[_0xd870('0x1b')]:_0xb2308b[_0xd870('0x19')]+_0xb2308b['limit'];var _0x2e33a2;if(_0x4ed8da>=_0xc1f658){_0x4ed8da=_0xc1f658;_0x2e33a2=0xc8;}else{_0x2e33a2=0xce;}_0x1929ef[_0xd870('0x18')](_0x2e33a2);return _0x1929ef[_0xd870('0x1c')](_0xd870('0x1d'),_0x2b7286+'-'+_0x4ed8da+'/'+_0xc1f658)['json'](_0x57708e);}return null;};}function patchUpdates(_0x53fade){return function(_0x3ea237){try{jsonpatch[_0xd870('0x1e')](_0x3ea237,_0x53fade,!![]);}catch(_0x4dd75e){return BPromise['reject'](_0x4dd75e);}return _0x3ea237[_0xd870('0x1f')]();};}function saveUpdates(_0x1300c,_0xc3e06b){return function(_0x247b90){if(_0x247b90){return _0x247b90[_0xd870('0x20')](_0x1300c)[_0xd870('0x21')](function(_0x134b84){return _0x134b84;});}return null;};}function removeEntity(_0x549b1e,_0x945d1){return function(_0x44787d){if(_0x44787d){return _0x44787d[_0xd870('0x22')]()[_0xd870('0x21')](function(){_0x549b1e[_0xd870('0x18')](0xcc)[_0xd870('0x23')]();});}};}function handleEntityNotFound(_0x3dbf19,_0xf22ff7){return function(_0x2fa5bd){if(!_0x2fa5bd){_0x3dbf19['sendStatus'](0x194);}return _0x2fa5bd;};}function handleError(_0x50d66f,_0x3fcb68){_0x3fcb68=_0x3fcb68||0x1f4;return function(_0x201c8f){logger['error'](_0x201c8f[_0xd870('0x24')]);if(_0x201c8f[_0xd870('0x25')]){delete _0x201c8f[_0xd870('0x25')];}_0x50d66f[_0xd870('0x18')](_0x3fcb68)['send'](_0x201c8f);};}exports[_0xd870('0x26')]=function(_0x401c9d,_0x5bfead){var _0x4413ad={},_0x5ed1d5={},_0x1efd8d={'count':0x0,'rows':[]};var _0x4ccbdb=_['map'](db['ChatQueueReport'][_0xd870('0x27')],function(_0x1061c5){return{'name':_0x1061c5['fieldName'],'type':_0x1061c5['type']['key']};});_0x5ed1d5['model']=_[_0xd870('0x28')](_0x4ccbdb,'name');_0x5ed1d5[_0xd870('0x29')]=_['keys'](_0x401c9d['query']);_0x5ed1d5[_0xd870('0x2a')]=_['intersection'](_0x5ed1d5[_0xd870('0x2b')],_0x5ed1d5[_0xd870('0x29')]);_0x4413ad[_0xd870('0x2c')]=_['intersection'](_0x5ed1d5[_0xd870('0x2b')],qs['fields'](_0x401c9d[_0xd870('0x29')][_0xd870('0x2d')]));_0x4413ad['attributes']=_0x4413ad[_0xd870('0x2c')][_0xd870('0x2e')]?_0x4413ad[_0xd870('0x2c')]:_0x5ed1d5[_0xd870('0x2b')];if(!_0x401c9d[_0xd870('0x29')]['hasOwnProperty'](_0xd870('0x2f'))){_0x4413ad['limit']=qs[_0xd870('0x30')](_0x401c9d[_0xd870('0x29')]['limit']);_0x4413ad[_0xd870('0x19')]=qs['offset'](_0x401c9d[_0xd870('0x29')][_0xd870('0x19')]);}_0x4413ad[_0xd870('0x31')]=qs[_0xd870('0x32')](_0x401c9d[_0xd870('0x29')][_0xd870('0x32')]);_0x4413ad[_0xd870('0x33')]=qs['filters'](_[_0xd870('0x34')](_0x401c9d[_0xd870('0x29')],_0x5ed1d5[_0xd870('0x2a')]),_0x4ccbdb);if(_0x401c9d['query'][_0xd870('0x35')]){_0x4413ad[_0xd870('0x33')]=_[_0xd870('0x36')](_0x4413ad[_0xd870('0x33')],{'$or':_['map'](_0x4ccbdb,function(_0x55daa8){if(_0x55daa8[_0xd870('0x37')]!==_0xd870('0x38')){var _0x171590={};_0x171590[_0x55daa8[_0xd870('0x25')]]={'$like':'%'+_0x401c9d[_0xd870('0x29')]['filter']+'%'};return _0x171590;}})});}_0x4413ad=_[_0xd870('0x36')]({},_0x4413ad,_0x401c9d['options']);var _0x326762={'where':_0x4413ad[_0xd870('0x33')]};return db[_0xd870('0x39')]['count'](_0x326762)['then'](function(_0x516332){_0x1efd8d[_0xd870('0x1b')]=_0x516332;if(_0x401c9d[_0xd870('0x29')][_0xd870('0x3a')]){_0x4413ad['include']=[{'all':!![]}];}return db[_0xd870('0x39')][_0xd870('0x3b')](_0x4413ad);})[_0xd870('0x21')](function(_0x5e04be){_0x1efd8d[_0xd870('0x3c')]=_0x5e04be;return _0x1efd8d;})['then'](respondWithFilteredResult(_0x5bfead,_0x4413ad))[_0xd870('0x3d')](handleError(_0x5bfead,null));};exports[_0xd870('0x3e')]=function(_0x389278,_0x53291d){var _0x3adbe4={'raw':!![],'where':{'id':_0x389278['params']['id']}},_0x5ead29={};_0x5ead29[_0xd870('0x2b')]=_[_0xd870('0x3f')](db[_0xd870('0x39')][_0xd870('0x27')]);_0x5ead29[_0xd870('0x29')]=_['keys'](_0x389278[_0xd870('0x29')]);_0x5ead29['filters']=_[_0xd870('0x40')](_0x5ead29[_0xd870('0x2b')],_0x5ead29[_0xd870('0x29')]);_0x3adbe4[_0xd870('0x2c')]=_[_0xd870('0x40')](_0x5ead29[_0xd870('0x2b')],qs[_0xd870('0x2d')](_0x389278[_0xd870('0x29')][_0xd870('0x2d')]));_0x3adbe4[_0xd870('0x2c')]=_0x3adbe4[_0xd870('0x2c')][_0xd870('0x2e')]?_0x3adbe4[_0xd870('0x2c')]:_0x5ead29[_0xd870('0x2b')];if(_0x389278[_0xd870('0x29')][_0xd870('0x3a')]){_0x3adbe4[_0xd870('0x41')]=[{'all':!![]}];}_0x3adbe4=_[_0xd870('0x36')]({},_0x3adbe4,_0x389278['options']);return db['ChatQueueReport'][_0xd870('0x42')](_0x3adbe4)[_0xd870('0x21')](handleEntityNotFound(_0x53291d,null))['then'](respondWithResult(_0x53291d,null))[_0xd870('0x3d')](handleError(_0x53291d,null));};exports['create']=function(_0x428c5f,_0x255ba5){return db['ChatQueueReport']['create'](_0x428c5f[_0xd870('0x43')],{})['then'](respondWithResult(_0x255ba5,0xc9))[_0xd870('0x3d')](handleError(_0x255ba5,null));};exports[_0xd870('0x20')]=function(_0x1c6635,_0x3459b1){if(_0x1c6635[_0xd870('0x43')]['id']){delete _0x1c6635[_0xd870('0x43')]['id'];}return db[_0xd870('0x39')]['find']({'where':{'id':_0x1c6635[_0xd870('0x44')]['id']}})[_0xd870('0x21')](handleEntityNotFound(_0x3459b1,null))[_0xd870('0x21')](saveUpdates(_0x1c6635[_0xd870('0x43')],null))[_0xd870('0x21')](respondWithResult(_0x3459b1,null))[_0xd870('0x3d')](handleError(_0x3459b1,null));};exports[_0xd870('0x22')]=function(_0x4ca6a6,_0x49ef39){return db[_0xd870('0x39')]['find']({'where':{'id':_0x4ca6a6[_0xd870('0x44')]['id']}})[_0xd870('0x21')](handleEntityNotFound(_0x49ef39,null))[_0xd870('0x21')](removeEntity(_0x49ef39,null))[_0xd870('0x3d')](handleError(_0x49ef39,null));};exports[_0xd870('0x45')]=function(_0x439e12,_0x477ee5){return db['ChatQueueReport'][_0xd870('0x45')]()[_0xd870('0x21')](respondWithResult(_0x477ee5,null))[_0xd870('0x3d')](handleError(_0x477ee5,null));}; \ No newline at end of file +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','ChatQueueReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','order','sort','where','merge','VIRTUAL','filter','includeAll'];(function(_0xfda4ac,_0x4aa1b1){var _0x5e1d2b=function(_0x1a941f){while(--_0x1a941f){_0xfda4ac['push'](_0xfda4ac['shift']());}};_0x5e1d2b(++_0x4aa1b1);}(_0x33af,0xec));var _0xf33a=function(_0x5c98ea,_0xa782aa){_0x5c98ea=_0x5c98ea-0x0;var _0x51e853=_0x33af[_0x5c98ea];return _0x51e853;};'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['ChatQueueReport'][_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['ChatQueueReport'][_0xf33a('0x4a')]()[_0xf33a('0x26')](respondWithResult(_0x36cba8,null))[_0xf33a('0x42')](handleError(_0x36cba8,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 94f957b..8232681 100644 --- a/server/api/chatQueueReport/chatQueueReport.model.js +++ b/server/api/chatQueueReport/chatQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['define','ChatQueueReport','report_chat_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports'];(function(_0x33d13f,_0x218de7){var _0x19cad3=function(_0x10ae2d){while(--_0x10ae2d){_0x33d13f['push'](_0x33d13f['shift']());}};_0x19cad3(++_0x218de7);}(_0xbaf0,0x12a));var _0x0baf=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xbaf0[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0baf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb7e7=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','define','ChatQueueReport','uniqueid','lodash'];(function(_0x404975,_0x234854){var _0x1191ea=function(_0x50ddfa){while(--_0x50ddfa){_0x404975['push'](_0x404975['shift']());}};_0x1191ea(++_0x234854);}(_0xb7e7,0x121));var _0x7b7e=function(_0x5c9307,_0x5b97e4){_0x5c9307=_0x5c9307-0x0;var _0x373e29=_0xb7e7[_0x5c9307];return _0x373e29;};'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 diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index b1cdfa9..2a211b1 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 _0xdb53=['rpc','jayson/promise','info','request\x20sent','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','ChatQueueReport,\x20%s,\x20%s','message','result','catch','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','then','debug','UpdateChatQueueReport','where','attributes','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1abb09,_0x18ee91){var _0xea1c07=function(_0x38f42c){while(--_0x38f42c){_0x1abb09['push'](_0x1abb09['shift']());}};_0xea1c07(++_0x18ee91);}(_0xdb53,0x142));var _0x3db5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdb53[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3db5('0x0'));var util=require(_0x3db5('0x1'));var moment=require(_0x3db5('0x2'));var BPromise=require(_0x3db5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3db5('0x4'));var db=require(_0x3db5('0x5'))['db'];var utils=require(_0x3db5('0x6'));var logger=require(_0x3db5('0x7'))(_0x3db5('0x8'));var config=require('../../config/environment');var jayson=require(_0x3db5('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xdcb620,_0x34a358,_0x637615){return new BPromise(function(_0xc35198,_0x733121){return client['request'](_0xdcb620,_0x637615)['then'](function(_0x25bece){logger[_0x3db5('0xa')]('ChatQueueReport,\x20%s,\x20%s',_0x34a358,_0x3db5('0xb'));logger['debug'](_0x3db5('0xc'),_0x34a358,'request\x20sent',JSON[_0x3db5('0xd')](_0x25bece));if(_0x25bece[_0x3db5('0xe')]){if(_0x25bece[_0x3db5('0xe')]['code']===0x1f4){logger['error'](_0x3db5('0xf'),_0x34a358,_0x25bece[_0x3db5('0xe')][_0x3db5('0x10')]);return _0x733121(_0x25bece[_0x3db5('0xe')][_0x3db5('0x10')]);}logger[_0x3db5('0xe')]('ChatQueueReport,\x20%s,\x20%s',_0x34a358,_0x25bece['error'][_0x3db5('0x10')]);return _0xc35198(_0x25bece['error'][_0x3db5('0x10')]);}else{logger['info']('ChatQueueReport,\x20%s,\x20%s',_0x34a358,_0x3db5('0xb'));_0xc35198(_0x25bece[_0x3db5('0x11')][_0x3db5('0x10')]);}})[_0x3db5('0x12')](function(_0x483cc6){logger[_0x3db5('0xe')](_0x3db5('0xf'),_0x34a358,_0x483cc6);_0x733121(_0x483cc6);});});}exports[_0x3db5('0x13')]=function(_0x209265){var _0x1fcc22=this;return new Promise(function(_0x29811a,_0x29c482){return db[_0x3db5('0x14')][_0x3db5('0x15')](_0x209265[_0x3db5('0x16')],{'raw':_0x209265[_0x3db5('0x17')]?_0x209265[_0x3db5('0x17')][_0x3db5('0x18')]===undefined?!![]:![]:!![]})[_0x3db5('0x19')](function(_0x3174fd){logger['info'](_0x3db5('0x13'),_0x209265);logger[_0x3db5('0x1a')](_0x3db5('0x13'),_0x209265,JSON[_0x3db5('0xd')](_0x3174fd));_0x29811a(_0x3174fd);})[_0x3db5('0x12')](function(_0x2c81ff){logger[_0x3db5('0xe')](_0x3db5('0x13'),_0x2c81ff['message'],_0x209265);_0x29c482(_0x1fcc22[_0x3db5('0xe')](0x1f4,_0x2c81ff[_0x3db5('0x10')]));});});};exports[_0x3db5('0x1b')]=function(_0x4a430a){var _0xd895f6=this;return new Promise(function(_0x11238e,_0x1e5d5d){return db[_0x3db5('0x14')]['update'](_0x4a430a['body'],{'raw':_0x4a430a[_0x3db5('0x17')]?_0x4a430a[_0x3db5('0x17')][_0x3db5('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4a430a[_0x3db5('0x17')]?_0x4a430a['options'][_0x3db5('0x1c')]||null:null,'attributes':_0x4a430a[_0x3db5('0x17')]?_0x4a430a[_0x3db5('0x17')][_0x3db5('0x1d')]||null:null,'limit':_0x4a430a[_0x3db5('0x17')]?_0x4a430a['options']['limit']||null:null})[_0x3db5('0x19')](function(_0x2f8e56){logger[_0x3db5('0xa')](_0x3db5('0x1b'),_0x4a430a);logger[_0x3db5('0x1a')](_0x3db5('0x1b'),_0x4a430a,JSON[_0x3db5('0xd')](_0x2f8e56));_0x11238e(_0x2f8e56);})['catch'](function(_0x136f87){logger[_0x3db5('0xe')](_0x3db5('0x1b'),_0x136f87[_0x3db5('0x10')],_0x4a430a);_0x1e5d5d(_0xd895f6['error'](0x1f4,_0x136f87['message']));});});}; \ No newline at end of file +var _0xee89=['stringify','error','code','message','result','CreateChatQueueReport','ChatQueueReport','create','body','options','UpdateChatQueueReport','attributes','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xee89,0x1ad));var _0x9ee8=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xee89[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x9ee8('0x0'));var util=require(_0x9ee8('0x1'));var moment=require('moment');var BPromise=require(_0x9ee8('0x2'));var rs=require(_0x9ee8('0x3'));var fs=require('fs');var Redis=require(_0x9ee8('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9ee8('0x5'));var logger=require(_0x9ee8('0x6'))(_0x9ee8('0x7'));var config=require(_0x9ee8('0x8'));var jayson=require(_0x9ee8('0x9'));var client=jayson[_0x9ee8('0xa')][_0x9ee8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2ee39c,_0x488849,_0x32b783){return new BPromise(function(_0xc9552e,_0x29be17){return client[_0x9ee8('0xc')](_0x2ee39c,_0x32b783)[_0x9ee8('0xd')](function(_0x5cc067){logger[_0x9ee8('0xe')](_0x9ee8('0xf'),_0x488849,_0x9ee8('0x10'));logger[_0x9ee8('0x11')](_0x9ee8('0x12'),_0x488849,_0x9ee8('0x10'),JSON[_0x9ee8('0x13')](_0x5cc067));if(_0x5cc067[_0x9ee8('0x14')]){if(_0x5cc067[_0x9ee8('0x14')][_0x9ee8('0x15')]===0x1f4){logger[_0x9ee8('0x14')]('ChatQueueReport,\x20%s,\x20%s',_0x488849,_0x5cc067[_0x9ee8('0x14')][_0x9ee8('0x16')]);return _0x29be17(_0x5cc067[_0x9ee8('0x14')][_0x9ee8('0x16')]);}logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x488849,_0x5cc067[_0x9ee8('0x14')][_0x9ee8('0x16')]);return _0xc9552e(_0x5cc067['error']['message']);}else{logger['info']('ChatQueueReport,\x20%s,\x20%s',_0x488849,'request\x20sent');_0xc9552e(_0x5cc067[_0x9ee8('0x17')][_0x9ee8('0x16')]);}})['catch'](function(_0x2a905e){logger[_0x9ee8('0x14')](_0x9ee8('0xf'),_0x488849,_0x2a905e);_0x29be17(_0x2a905e);});});}exports[_0x9ee8('0x18')]=function(_0xf9951b){var _0x3044b3=this;return new Promise(function(_0x5d5832,_0x34985f){return db[_0x9ee8('0x19')][_0x9ee8('0x1a')](_0xf9951b[_0x9ee8('0x1b')],{'raw':_0xf9951b['options']?_0xf9951b[_0x9ee8('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x559eb8){logger[_0x9ee8('0xe')](_0x9ee8('0x18'),_0xf9951b);logger[_0x9ee8('0x11')]('CreateChatQueueReport',_0xf9951b,JSON[_0x9ee8('0x13')](_0x559eb8));_0x5d5832(_0x559eb8);})['catch'](function(_0x4d118a){logger[_0x9ee8('0x14')](_0x9ee8('0x18'),_0x4d118a[_0x9ee8('0x16')],_0xf9951b);_0x34985f(_0x3044b3[_0x9ee8('0x14')](0x1f4,_0x4d118a['message']));});});};exports[_0x9ee8('0x1d')]=function(_0x2bbed9){var _0x4ea04f=this;return new Promise(function(_0x5e2dad,_0x269c66){return db[_0x9ee8('0x19')]['update'](_0x2bbed9['body'],{'raw':_0x2bbed9[_0x9ee8('0x1c')]?_0x2bbed9[_0x9ee8('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2bbed9[_0x9ee8('0x1c')]?_0x2bbed9[_0x9ee8('0x1c')]['where']||null:null,'attributes':_0x2bbed9[_0x9ee8('0x1c')]?_0x2bbed9[_0x9ee8('0x1c')][_0x9ee8('0x1e')]||null:null,'limit':_0x2bbed9['options']?_0x2bbed9[_0x9ee8('0x1c')]['limit']||null:null})[_0x9ee8('0xd')](function(_0x1dd412){logger['info']('UpdateChatQueueReport',_0x2bbed9);logger[_0x9ee8('0x11')](_0x9ee8('0x1d'),_0x2bbed9,JSON['stringify'](_0x1dd412));_0x5e2dad(_0x1dd412);})[_0x9ee8('0x1f')](function(_0xa38f6b){logger['error']('UpdateChatQueueReport',_0xa38f6b[_0x9ee8('0x16')],_0x2bbed9);_0x269c66(_0x4ea04f[_0x9ee8('0x14')](0x1f4,_0xa38f6b[_0x9ee8('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index e1c85b4..0159623 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 _0xc174=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/describe','describe','/:id','show','post','put','update','delete','destroy'];(function(_0x5567a7,_0x42dd01){var _0xf09423=function(_0x3a48bb){while(--_0x3a48bb){_0x5567a7['push'](_0x5567a7['shift']());}};_0xf09423(++_0x42dd01);}(_0xc174,0x17b));var _0x4c17=function(_0x810e4d,_0x909ef4){_0x810e4d=_0x810e4d-0x0;var _0x13f01c=_0xc174[_0x810e4d];return _0x13f01c;};'use strict';var multer=require('multer');var util=require(_0x4c17('0x0'));var path=require(_0x4c17('0x1'));var timeout=require(_0x4c17('0x2'));var express=require(_0x4c17('0x3'));var router=express[_0x4c17('0x4')]();var fs_extra=require(_0x4c17('0x5'));var auth=require(_0x4c17('0x6'));var interaction=require(_0x4c17('0x7'));var config=require('../../config/environment');var controller=require('./chatQueueReport.controller');router['get']('/',auth[_0x4c17('0x8')](),controller[_0x4c17('0x9')]);router[_0x4c17('0xa')](_0x4c17('0xb'),auth[_0x4c17('0x8')](),controller[_0x4c17('0xc')]);router[_0x4c17('0xa')](_0x4c17('0xd'),auth[_0x4c17('0x8')](),controller[_0x4c17('0xe')]);router[_0x4c17('0xf')]('/',auth[_0x4c17('0x8')](),controller['create']);router[_0x4c17('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x4c17('0x11')]);router[_0x4c17('0x12')](_0x4c17('0xd'),auth[_0x4c17('0x8')](),controller[_0x4c17('0x13')]);module[_0x4c17('0x14')]=router; \ No newline at end of file +var _0x7dfc=['path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','isAuthenticated','index','get','describe','/:id','post','put','destroy','util'];(function(_0xe4b4fa,_0x1dbb08){var _0x3f49b7=function(_0x14e17f){while(--_0x14e17f){_0xe4b4fa['push'](_0xe4b4fa['shift']());}};_0x3f49b7(++_0x1dbb08);}(_0x7dfc,0x1cf));var _0xc7df=function(_0xf606a0,_0x38f3b1){_0xf606a0=_0xf606a0-0x0;var _0x345298=_0x7dfc[_0xf606a0];return _0x345298;};'use strict';var multer=require('multer');var util=require(_0xc7df('0x0'));var path=require(_0xc7df('0x1'));var timeout=require(_0xc7df('0x2'));var express=require('express');var router=express[_0xc7df('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xc7df('0x4'));var interaction=require(_0xc7df('0x5'));var config=require(_0xc7df('0x6'));var controller=require(_0xc7df('0x7'));router['get']('/',auth[_0xc7df('0x8')](),controller[_0xc7df('0x9')]);router[_0xc7df('0xa')]('/describe',auth[_0xc7df('0x8')](),controller[_0xc7df('0xb')]);router[_0xc7df('0xa')](_0xc7df('0xc'),auth[_0xc7df('0x8')](),controller['show']);router[_0xc7df('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc7df('0xe')](_0xc7df('0xc'),auth[_0xc7df('0x8')](),controller['update']);router['delete'](_0xc7df('0xc'),auth[_0xc7df('0x8')](),controller[_0xc7df('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index f34b368..5ba040a 100644 --- a/server/api/chatTransferReport/chatTransferReport.attributes.js +++ b/server/api/chatTransferReport/chatTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x516f2e,_0x42130a){var _0x25414a=function(_0x170a0a){while(--_0x170a0a){_0x516f2e['push'](_0x516f2e['shift']());}};_0x25414a(++_0x42130a);}(_0x70e0,0x17b));var _0x070e=function(_0x2c02a7,_0xe1bc68){_0x2c02a7=_0x2c02a7-0x0;var _0x24ba66=_0x70e0[_0x2c02a7];return _0x24ba66;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file +var _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x293da6,_0x5112e3){var _0x38005a=function(_0x331f70){while(--_0x331f70){_0x293da6['push'](_0x293da6['shift']());}};_0x38005a(++_0x5112e3);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x1e235e,_0x994b77){_0x1e235e=_0x1e235e-0x0;var _0x1e8e94=_0xf3cd[_0x1e235e];return _0x1e8e94;};'use strict';var moment=require(_0xdf3c('0x0'));var Sequelize=require(_0xdf3c('0x1'));module[_0xdf3c('0x2')]={'uniqueid':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xdf3c('0x4')](_0xdf3c('0x5'),'agent',_0xdf3c('0x6')),'allowNull':![],'defaultValue':_0xdf3c('0x6')},'transferredAt':{'type':Sequelize[_0xdf3c('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 621a9ab..e665545 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 _0xf6b2=['catch','params','model','includeAll','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','save','then','destroy','stack','name','map','ChatTransferReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','include','findAll'];(function(_0x5ef12e,_0x59a72a){var _0xd8607=function(_0x4a71f8){while(--_0x4a71f8){_0x5ef12e['push'](_0x5ef12e['shift']());}};_0xd8607(++_0x59a72a);}(_0xf6b2,0x115));var _0x2f6b=function(_0x5bfd0e,_0x542423){_0x5bfd0e=_0x5bfd0e-0x0;var _0x1e0110=_0xf6b2[_0x5bfd0e];return _0x1e0110;};'use strict';var emlformat=require(_0x2f6b('0x0'));var rimraf=require(_0x2f6b('0x1'));var zipdir=require(_0x2f6b('0x2'));var jsonpatch=require(_0x2f6b('0x3'));var rp=require(_0x2f6b('0x4'));var moment=require(_0x2f6b('0x5'));var BPromise=require(_0x2f6b('0x6'));var Mustache=require('mustache');var util=require(_0x2f6b('0x7'));var path=require(_0x2f6b('0x8'));var sox=require(_0x2f6b('0x9'));var csv=require(_0x2f6b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2f6b('0xb'));var _=require('lodash');var squel=require(_0x2f6b('0xc'));var crypto=require('crypto');var jsforce=require(_0x2f6b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x2f6b('0xa'));var querystring=require('querystring');var Papa=require(_0x2f6b('0xe'));var Redis=require(_0x2f6b('0xf'));var authService=require(_0x2f6b('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x2f6b('0x11'));var hardwareService=require(_0x2f6b('0x12'));var logger=require('../../config/logger')(_0x2f6b('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2c0a7c,_0x18689e){_0x18689e=_0x18689e||0xcc;return function(_0x1b7bc2){if(_0x1b7bc2){return _0x2c0a7c[_0x2f6b('0x14')](_0x18689e);}return _0x2c0a7c['status'](_0x18689e)[_0x2f6b('0x15')]();};}function respondWithResult(_0x2cb311,_0x344aa8){_0x344aa8=_0x344aa8||0xc8;return function(_0x432616){if(_0x432616){return _0x2cb311[_0x2f6b('0x16')](_0x344aa8)['json'](_0x432616);}};}function respondWithFilteredResult(_0x435502,_0x2f901a){return function(_0x3a509b){if(_0x3a509b){var _0x20832c=typeof _0x2f901a[_0x2f6b('0x17')]===_0x2f6b('0x18')&&typeof _0x2f901a[_0x2f6b('0x19')]===_0x2f6b('0x18');var _0x224a04=_0x3a509b[_0x2f6b('0x1a')];var _0x187965=_0x20832c?0x0:_0x2f901a['offset'];var _0x555d1d=_0x20832c?_0x3a509b['count']:_0x2f901a[_0x2f6b('0x17')]+_0x2f901a['limit'];var _0x5a68be;if(_0x555d1d>=_0x224a04){_0x555d1d=_0x224a04;_0x5a68be=0xc8;}else{_0x5a68be=0xce;}_0x435502['status'](_0x5a68be);return _0x435502[_0x2f6b('0x1b')](_0x2f6b('0x1c'),_0x187965+'-'+_0x555d1d+'/'+_0x224a04)[_0x2f6b('0x1d')](_0x3a509b);}return null;};}function patchUpdates(_0x1b1df8){return function(_0x37e480){try{jsonpatch['apply'](_0x37e480,_0x1b1df8,!![]);}catch(_0x4d72e2){return BPromise['reject'](_0x4d72e2);}return _0x37e480[_0x2f6b('0x1e')]();};}function saveUpdates(_0x5d75d2,_0x72f558){return function(_0xc7c90d){if(_0xc7c90d){return _0xc7c90d['update'](_0x5d75d2)[_0x2f6b('0x1f')](function(_0x45ac3e){return _0x45ac3e;});}return null;};}function removeEntity(_0x1a1055,_0x16baab){return function(_0x4ed0b3){if(_0x4ed0b3){return _0x4ed0b3[_0x2f6b('0x20')]()['then'](function(){_0x1a1055[_0x2f6b('0x16')](0xcc)[_0x2f6b('0x15')]();});}};}function handleEntityNotFound(_0x801552,_0x4f87d1){return function(_0x5e96ee){if(!_0x5e96ee){_0x801552[_0x2f6b('0x14')](0x194);}return _0x5e96ee;};}function handleError(_0xc35a55,_0x599375){_0x599375=_0x599375||0x1f4;return function(_0x1c7344){logger['error'](_0x1c7344[_0x2f6b('0x21')]);if(_0x1c7344[_0x2f6b('0x22')]){delete _0x1c7344['name'];}_0xc35a55[_0x2f6b('0x16')](_0x599375)['send'](_0x1c7344);};}exports['index']=function(_0x1987a6,_0x4d6138){var _0x112426={},_0x419887={},_0x2fae44={'count':0x0,'rows':[]};var _0x1088f6=_[_0x2f6b('0x23')](db[_0x2f6b('0x24')][_0x2f6b('0x25')],function(_0x163037){return{'name':_0x163037[_0x2f6b('0x26')],'type':_0x163037[_0x2f6b('0x27')][_0x2f6b('0x28')]};});_0x419887['model']=_[_0x2f6b('0x23')](_0x1088f6,_0x2f6b('0x22'));_0x419887[_0x2f6b('0x29')]=_[_0x2f6b('0x2a')](_0x1987a6[_0x2f6b('0x29')]);_0x419887[_0x2f6b('0x2b')]=_['intersection'](_0x419887['model'],_0x419887[_0x2f6b('0x29')]);_0x112426['attributes']=_[_0x2f6b('0x2c')](_0x419887['model'],qs[_0x2f6b('0x2d')](_0x1987a6[_0x2f6b('0x29')]['fields']));_0x112426[_0x2f6b('0x2e')]=_0x112426[_0x2f6b('0x2e')][_0x2f6b('0x2f')]?_0x112426['attributes']:_0x419887['model'];if(!_0x1987a6[_0x2f6b('0x29')][_0x2f6b('0x30')]('nolimit')){_0x112426[_0x2f6b('0x19')]=qs['limit'](_0x1987a6[_0x2f6b('0x29')][_0x2f6b('0x19')]);_0x112426[_0x2f6b('0x17')]=qs[_0x2f6b('0x17')](_0x1987a6[_0x2f6b('0x29')][_0x2f6b('0x17')]);}_0x112426[_0x2f6b('0x31')]=qs[_0x2f6b('0x32')](_0x1987a6[_0x2f6b('0x29')][_0x2f6b('0x32')]);_0x112426[_0x2f6b('0x33')]=qs[_0x2f6b('0x2b')](_['pick'](_0x1987a6[_0x2f6b('0x29')],_0x419887['filters']),_0x1088f6);if(_0x1987a6[_0x2f6b('0x29')][_0x2f6b('0x34')]){_0x112426[_0x2f6b('0x33')]=_[_0x2f6b('0x35')](_0x112426[_0x2f6b('0x33')],{'$or':_['map'](_0x1088f6,function(_0x3d9e1d){if(_0x3d9e1d[_0x2f6b('0x27')]!==_0x2f6b('0x36')){var _0x58b112={};_0x58b112[_0x3d9e1d[_0x2f6b('0x22')]]={'$like':'%'+_0x1987a6[_0x2f6b('0x29')][_0x2f6b('0x34')]+'%'};return _0x58b112;}})});}_0x112426=_['merge']({},_0x112426,_0x1987a6[_0x2f6b('0x37')]);var _0x38b57a={'where':_0x112426[_0x2f6b('0x33')]};return db[_0x2f6b('0x24')][_0x2f6b('0x1a')](_0x38b57a)[_0x2f6b('0x1f')](function(_0x27ef7e){_0x2fae44[_0x2f6b('0x1a')]=_0x27ef7e;if(_0x1987a6[_0x2f6b('0x29')]['includeAll']){_0x112426[_0x2f6b('0x38')]=[{'all':!![]}];}return db[_0x2f6b('0x24')][_0x2f6b('0x39')](_0x112426);})[_0x2f6b('0x1f')](function(_0x294a80){_0x2fae44['rows']=_0x294a80;return _0x2fae44;})['then'](respondWithFilteredResult(_0x4d6138,_0x112426))[_0x2f6b('0x3a')](handleError(_0x4d6138,null));};exports['show']=function(_0x25224b,_0x3e2f46){var _0x3b36c8={'raw':!![],'where':{'id':_0x25224b[_0x2f6b('0x3b')]['id']}},_0x22f73a={};_0x22f73a['model']=_[_0x2f6b('0x2a')](db[_0x2f6b('0x24')][_0x2f6b('0x25')]);_0x22f73a['query']=_['keys'](_0x25224b['query']);_0x22f73a['filters']=_[_0x2f6b('0x2c')](_0x22f73a['model'],_0x22f73a[_0x2f6b('0x29')]);_0x3b36c8[_0x2f6b('0x2e')]=_[_0x2f6b('0x2c')](_0x22f73a[_0x2f6b('0x3c')],qs[_0x2f6b('0x2d')](_0x25224b[_0x2f6b('0x29')]['fields']));_0x3b36c8[_0x2f6b('0x2e')]=_0x3b36c8[_0x2f6b('0x2e')]['length']?_0x3b36c8[_0x2f6b('0x2e')]:_0x22f73a['model'];if(_0x25224b[_0x2f6b('0x29')][_0x2f6b('0x3d')]){_0x3b36c8['include']=[{'all':!![]}];}_0x3b36c8=_['merge']({},_0x3b36c8,_0x25224b[_0x2f6b('0x37')]);return db['ChatTransferReport'][_0x2f6b('0x3e')](_0x3b36c8)[_0x2f6b('0x1f')](handleEntityNotFound(_0x3e2f46,null))[_0x2f6b('0x1f')](respondWithResult(_0x3e2f46,null))[_0x2f6b('0x3a')](handleError(_0x3e2f46,null));};exports['create']=function(_0x4290c4,_0x4445db){return db[_0x2f6b('0x24')][_0x2f6b('0x3f')](_0x4290c4[_0x2f6b('0x40')],{})['then'](respondWithResult(_0x4445db,0xc9))[_0x2f6b('0x3a')](handleError(_0x4445db,null));};exports[_0x2f6b('0x41')]=function(_0x2a7220,_0x5b7ed7){if(_0x2a7220[_0x2f6b('0x40')]['id']){delete _0x2a7220['body']['id'];}return db['ChatTransferReport'][_0x2f6b('0x3e')]({'where':{'id':_0x2a7220[_0x2f6b('0x3b')]['id']}})[_0x2f6b('0x1f')](handleEntityNotFound(_0x5b7ed7,null))[_0x2f6b('0x1f')](saveUpdates(_0x2a7220[_0x2f6b('0x40')],null))[_0x2f6b('0x1f')](respondWithResult(_0x5b7ed7,null))[_0x2f6b('0x3a')](handleError(_0x5b7ed7,null));};exports[_0x2f6b('0x20')]=function(_0x532ba0,_0x5779db){return db['ChatTransferReport'][_0x2f6b('0x3e')]({'where':{'id':_0x532ba0[_0x2f6b('0x3b')]['id']}})[_0x2f6b('0x1f')](handleEntityNotFound(_0x5779db,null))[_0x2f6b('0x1f')](removeEntity(_0x5779db,null))['catch'](handleError(_0x5779db,null));};exports[_0x2f6b('0x42')]=function(_0x8ad272,_0x13cfec){return db[_0x2f6b('0x24')]['describe']()[_0x2f6b('0x1f')](respondWithResult(_0x13cfec,null))['catch'](handleError(_0x13cfec,null));}; \ No newline at end of file +var _0xa17e=['ejs','fs-extra','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','end','error','name','send','index','map','ChatTransferReport','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','find','create','body','catch','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv'];(function(_0x2e9703,_0x299227){var _0x5056a3=function(_0x36990e){while(--_0x36990e){_0x2e9703['push'](_0x2e9703['shift']());}};_0x5056a3(++_0x299227);}(_0xa17e,0x171));var _0xea17=function(_0x1ff98d,_0x1e263c){_0x1ff98d=_0x1ff98d-0x0;var _0x1884c8=_0xa17e[_0x1ff98d];return _0x1884c8;};'use strict';var emlformat=require(_0xea17('0x0'));var rimraf=require(_0xea17('0x1'));var zipdir=require(_0xea17('0x2'));var jsonpatch=require(_0xea17('0x3'));var rp=require(_0xea17('0x4'));var moment=require(_0xea17('0x5'));var BPromise=require(_0xea17('0x6'));var Mustache=require(_0xea17('0x7'));var util=require(_0xea17('0x8'));var path=require(_0xea17('0x9'));var sox=require('sox');var csv=require(_0xea17('0xa'));var ejs=require(_0xea17('0xb'));var fs=require('fs');var fs_extra=require(_0xea17('0xc'));var _=require('lodash');var squel=require(_0xea17('0xd'));var crypto=require(_0xea17('0xe'));var jsforce=require(_0xea17('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xea17('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xea17('0x10'));var authService=require(_0xea17('0x11'));var qs=require(_0xea17('0x12'));var as=require(_0xea17('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xea17('0x14'))(_0xea17('0x15'));var utils=require(_0xea17('0x16'));var config=require(_0xea17('0x17'));var licenseUtil=require(_0xea17('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xf3b54f,_0x36a826){_0x36a826=_0x36a826||0xcc;return function(_0x32bb3f){if(_0x32bb3f){return _0xf3b54f[_0xea17('0x19')](_0x36a826);}return _0xf3b54f[_0xea17('0x1a')](_0x36a826)['end']();};}function respondWithResult(_0x4c9afb,_0x3daa2c){_0x3daa2c=_0x3daa2c||0xc8;return function(_0x4936aa){if(_0x4936aa){return _0x4c9afb[_0xea17('0x1a')](_0x3daa2c)[_0xea17('0x1b')](_0x4936aa);}};}function respondWithFilteredResult(_0x358625,_0x4fdfd1){return function(_0x1dbd26){if(_0x1dbd26){var _0x284ab7=typeof _0x4fdfd1[_0xea17('0x1c')]===_0xea17('0x1d')&&typeof _0x4fdfd1[_0xea17('0x1e')]==='undefined';var _0x3bc262=_0x1dbd26['count'];var _0x1cb206=_0x284ab7?0x0:_0x4fdfd1[_0xea17('0x1c')];var _0x133432=_0x284ab7?_0x1dbd26[_0xea17('0x1f')]:_0x4fdfd1[_0xea17('0x1c')]+_0x4fdfd1[_0xea17('0x1e')];var _0xee0653;if(_0x133432>=_0x3bc262){_0x133432=_0x3bc262;_0xee0653=0xc8;}else{_0xee0653=0xce;}_0x358625[_0xea17('0x1a')](_0xee0653);return _0x358625[_0xea17('0x20')](_0xea17('0x21'),_0x1cb206+'-'+_0x133432+'/'+_0x3bc262)['json'](_0x1dbd26);}return null;};}function patchUpdates(_0x2ac329){return function(_0x14e906){try{jsonpatch['apply'](_0x14e906,_0x2ac329,!![]);}catch(_0x164997){return BPromise[_0xea17('0x22')](_0x164997);}return _0x14e906[_0xea17('0x23')]();};}function saveUpdates(_0x5ea37b,_0x4aeede){return function(_0x1dfacf){if(_0x1dfacf){return _0x1dfacf[_0xea17('0x24')](_0x5ea37b)[_0xea17('0x25')](function(_0xacb961){return _0xacb961;});}return null;};}function removeEntity(_0x3805ba,_0x121c00){return function(_0x2ee9dc){if(_0x2ee9dc){return _0x2ee9dc[_0xea17('0x26')]()[_0xea17('0x25')](function(){_0x3805ba[_0xea17('0x1a')](0xcc)[_0xea17('0x27')]();});}};}function handleEntityNotFound(_0x26675b,_0x28b0af){return function(_0x37c769){if(!_0x37c769){_0x26675b['sendStatus'](0x194);}return _0x37c769;};}function handleError(_0x1f1ad5,_0x2c26a7){_0x2c26a7=_0x2c26a7||0x1f4;return function(_0x32f6f5){logger[_0xea17('0x28')](_0x32f6f5['stack']);if(_0x32f6f5[_0xea17('0x29')]){delete _0x32f6f5[_0xea17('0x29')];}_0x1f1ad5[_0xea17('0x1a')](_0x2c26a7)[_0xea17('0x2a')](_0x32f6f5);};}exports[_0xea17('0x2b')]=function(_0x1ff394,_0x2ced8a){var _0x29c97e={},_0x4d8b4f={},_0x1153d5={'count':0x0,'rows':[]};var _0x5b4081=_[_0xea17('0x2c')](db[_0xea17('0x2d')]['rawAttributes'],function(_0x256585){return{'name':_0x256585['fieldName'],'type':_0x256585[_0xea17('0x2e')][_0xea17('0x2f')]};});_0x4d8b4f[_0xea17('0x30')]=_['map'](_0x5b4081,_0xea17('0x29'));_0x4d8b4f[_0xea17('0x31')]=_[_0xea17('0x32')](_0x1ff394[_0xea17('0x31')]);_0x4d8b4f[_0xea17('0x33')]=_[_0xea17('0x34')](_0x4d8b4f['model'],_0x4d8b4f['query']);_0x29c97e[_0xea17('0x35')]=_[_0xea17('0x34')](_0x4d8b4f[_0xea17('0x30')],qs[_0xea17('0x36')](_0x1ff394[_0xea17('0x31')]['fields']));_0x29c97e[_0xea17('0x35')]=_0x29c97e['attributes'][_0xea17('0x37')]?_0x29c97e[_0xea17('0x35')]:_0x4d8b4f[_0xea17('0x30')];if(!_0x1ff394[_0xea17('0x31')][_0xea17('0x38')](_0xea17('0x39'))){_0x29c97e['limit']=qs[_0xea17('0x1e')](_0x1ff394[_0xea17('0x31')][_0xea17('0x1e')]);_0x29c97e[_0xea17('0x1c')]=qs[_0xea17('0x1c')](_0x1ff394[_0xea17('0x31')][_0xea17('0x1c')]);}_0x29c97e[_0xea17('0x3a')]=qs['sort'](_0x1ff394[_0xea17('0x31')][_0xea17('0x3b')]);_0x29c97e[_0xea17('0x3c')]=qs[_0xea17('0x33')](_[_0xea17('0x3d')](_0x1ff394[_0xea17('0x31')],_0x4d8b4f[_0xea17('0x33')]),_0x5b4081);if(_0x1ff394['query'][_0xea17('0x3e')]){_0x29c97e[_0xea17('0x3c')]=_[_0xea17('0x3f')](_0x29c97e[_0xea17('0x3c')],{'$or':_['map'](_0x5b4081,function(_0x3f4a74){if(_0x3f4a74['type']!==_0xea17('0x40')){var _0x93809f={};_0x93809f[_0x3f4a74[_0xea17('0x29')]]={'$like':'%'+_0x1ff394[_0xea17('0x31')][_0xea17('0x3e')]+'%'};return _0x93809f;}})});}_0x29c97e=_['merge']({},_0x29c97e,_0x1ff394[_0xea17('0x41')]);var _0x551bc3={'where':_0x29c97e[_0xea17('0x3c')]};return db['ChatTransferReport'][_0xea17('0x1f')](_0x551bc3)[_0xea17('0x25')](function(_0x142ece){_0x1153d5[_0xea17('0x1f')]=_0x142ece;if(_0x1ff394[_0xea17('0x31')][_0xea17('0x42')]){_0x29c97e[_0xea17('0x43')]=[{'all':!![]}];}return db[_0xea17('0x2d')][_0xea17('0x44')](_0x29c97e);})['then'](function(_0x16bcfe){_0x1153d5[_0xea17('0x45')]=_0x16bcfe;return _0x1153d5;})[_0xea17('0x25')](respondWithFilteredResult(_0x2ced8a,_0x29c97e))['catch'](handleError(_0x2ced8a,null));};exports['show']=function(_0x526f3a,_0x18b354){var _0x346de7={'raw':!![],'where':{'id':_0x526f3a[_0xea17('0x46')]['id']}},_0x3f59d9={};_0x3f59d9[_0xea17('0x30')]=_[_0xea17('0x32')](db[_0xea17('0x2d')]['rawAttributes']);_0x3f59d9[_0xea17('0x31')]=_[_0xea17('0x32')](_0x526f3a['query']);_0x3f59d9[_0xea17('0x33')]=_[_0xea17('0x34')](_0x3f59d9[_0xea17('0x30')],_0x3f59d9[_0xea17('0x31')]);_0x346de7[_0xea17('0x35')]=_[_0xea17('0x34')](_0x3f59d9[_0xea17('0x30')],qs[_0xea17('0x36')](_0x526f3a[_0xea17('0x31')][_0xea17('0x36')]));_0x346de7['attributes']=_0x346de7[_0xea17('0x35')]['length']?_0x346de7[_0xea17('0x35')]:_0x3f59d9['model'];if(_0x526f3a['query'][_0xea17('0x42')]){_0x346de7['include']=[{'all':!![]}];}_0x346de7=_[_0xea17('0x3f')]({},_0x346de7,_0x526f3a[_0xea17('0x41')]);return db[_0xea17('0x2d')][_0xea17('0x47')](_0x346de7)['then'](handleEntityNotFound(_0x18b354,null))[_0xea17('0x25')](respondWithResult(_0x18b354,null))['catch'](handleError(_0x18b354,null));};exports[_0xea17('0x48')]=function(_0x2fbf90,_0xad9a2a){return db['ChatTransferReport'][_0xea17('0x48')](_0x2fbf90[_0xea17('0x49')],{})[_0xea17('0x25')](respondWithResult(_0xad9a2a,0xc9))['catch'](handleError(_0xad9a2a,null));};exports[_0xea17('0x24')]=function(_0x38c9ce,_0x12fb3a){if(_0x38c9ce['body']['id']){delete _0x38c9ce['body']['id'];}return db['ChatTransferReport'][_0xea17('0x47')]({'where':{'id':_0x38c9ce[_0xea17('0x46')]['id']}})['then'](handleEntityNotFound(_0x12fb3a,null))[_0xea17('0x25')](saveUpdates(_0x38c9ce['body'],null))[_0xea17('0x25')](respondWithResult(_0x12fb3a,null))[_0xea17('0x4a')](handleError(_0x12fb3a,null));};exports['destroy']=function(_0x4db2e3,_0x4f70c9){return db[_0xea17('0x2d')][_0xea17('0x47')]({'where':{'id':_0x4db2e3[_0xea17('0x46')]['id']}})[_0xea17('0x25')](handleEntityNotFound(_0x4f70c9,null))[_0xea17('0x25')](removeEntity(_0x4f70c9,null))['catch'](handleError(_0x4f70c9,null));};exports[_0xea17('0x4b')]=function(_0x346424,_0x4a0cfd){return db[_0xea17('0x2d')][_0xea17('0x4b')]()[_0xea17('0x25')](respondWithResult(_0x4a0cfd,null))[_0xea17('0x4a')](handleError(_0x4a0cfd,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 99ada88..0bc058e 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 _0x0697=['rimraf','./chatTransferReport.attributes','exports','define','ChatTransferReport','report_chat_transfer','util','api','moment','request-promise','path'];(function(_0x5d70bf,_0x19b7e4){var _0x35946d=function(_0x5cce87){while(--_0x5cce87){_0x5d70bf['push'](_0x5d70bf['shift']());}};_0x35946d(++_0x19b7e4);}(_0x0697,0x1c9));var _0x7069=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0x0697[_0x1caf6a];return _0x1bf493;};'use strict';var _=require('lodash');var util=require(_0x7069('0x0'));var logger=require('../../config/logger')(_0x7069('0x1'));var moment=require(_0x7069('0x2'));var BPromise=require('bluebird');var rp=require(_0x7069('0x3'));var fs=require('fs');var path=require(_0x7069('0x4'));var rimraf=require(_0x7069('0x5'));var config=require('../../config/environment');var attributes=require(_0x7069('0x6'));module[_0x7069('0x7')]=function(_0x2e3fde,_0x482841){return _0x2e3fde[_0x7069('0x8')](_0x7069('0x9'),attributes,{'tableName':_0x7069('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x2052=['report_chat_transfer','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','exports','ChatTransferReport'];(function(_0x595669,_0x4620f0){var _0xf33ba2=function(_0x40bf73){while(--_0x40bf73){_0x595669['push'](_0x595669['shift']());}};_0xf33ba2(++_0x4620f0);}(_0x2052,0xb8));var _0x2205=function(_0x31daf4,_0x3e2d34){_0x31daf4=_0x31daf4-0x0;var _0x129207=_0x2052[_0x31daf4];return _0x129207;};'use strict';var _=require(_0x2205('0x0'));var util=require('util');var logger=require(_0x2205('0x1'))(_0x2205('0x2'));var moment=require(_0x2205('0x3'));var BPromise=require(_0x2205('0x4'));var rp=require(_0x2205('0x5'));var fs=require('fs');var path=require(_0x2205('0x6'));var rimraf=require(_0x2205('0x7'));var config=require(_0x2205('0x8'));var attributes=require(_0x2205('0x9'));module[_0x2205('0xa')]=function(_0x460b9f,_0x386a2){return _0x460b9f['define'](_0x2205('0xb'),attributes,{'tableName':_0x2205('0xc'),'paranoid':![],'indexes':[{'name':_0x2205('0xd'),'fields':[_0x2205('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index f16d01d..c1582e9 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 _0x6369=['ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0x6369,0xf7));var _0x9636=function(_0x230249,_0x27c009){_0x230249=_0x230249-0x0;var _0x4f6e0b=_0x6369[_0x230249];return _0x4f6e0b;};'use strict';var _=require(_0x9636('0x0'));var util=require(_0x9636('0x1'));var moment=require('moment');var BPromise=require(_0x9636('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9636('0x3'));var db=require(_0x9636('0x4'))['db'];var utils=require(_0x9636('0x5'));var logger=require(_0x9636('0x6'))(_0x9636('0x7'));var config=require(_0x9636('0x8'));var jayson=require(_0x9636('0x9'));var client=jayson['client'][_0x9636('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x586d0f,_0x35e7d1,_0xa57bdd){return new BPromise(function(_0x4e7162,_0x266db0){return client[_0x9636('0xb')](_0x586d0f,_0xa57bdd)[_0x9636('0xc')](function(_0x2f7b16){logger[_0x9636('0xd')](_0x9636('0xe'),_0x35e7d1,_0x9636('0xf'));logger[_0x9636('0x10')](_0x9636('0x11'),_0x35e7d1,'request\x20sent',JSON[_0x9636('0x12')](_0x2f7b16));if(_0x2f7b16[_0x9636('0x13')]){if(_0x2f7b16[_0x9636('0x13')][_0x9636('0x14')]===0x1f4){logger[_0x9636('0x13')](_0x9636('0xe'),_0x35e7d1,_0x2f7b16[_0x9636('0x13')][_0x9636('0x15')]);return _0x266db0(_0x2f7b16[_0x9636('0x13')][_0x9636('0x15')]);}logger[_0x9636('0x13')](_0x9636('0xe'),_0x35e7d1,_0x2f7b16[_0x9636('0x13')][_0x9636('0x15')]);return _0x4e7162(_0x2f7b16[_0x9636('0x13')][_0x9636('0x15')]);}else{logger[_0x9636('0xd')](_0x9636('0xe'),_0x35e7d1,_0x9636('0xf'));_0x4e7162(_0x2f7b16[_0x9636('0x16')]['message']);}})[_0x9636('0x17')](function(_0x1c97e5){logger[_0x9636('0x13')](_0x9636('0xe'),_0x35e7d1,_0x1c97e5);_0x266db0(_0x1c97e5);});});} \ No newline at end of file +var _0xa39e=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','ChatTransferReport,\x20%s,\x20%s','request\x20sent','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x36bf46,_0x3d8db9){var _0x1d0a72=function(_0x328e8d){while(--_0x328e8d){_0x36bf46['push'](_0x36bf46['shift']());}};_0x1d0a72(++_0x3d8db9);}(_0xa39e,0x1df));var _0xea39=function(_0x34bc5e,_0x538eb4){_0x34bc5e=_0x34bc5e-0x0;var _0x3e6969=_0xa39e[_0x34bc5e];return _0x3e6969;};'use strict';var _=require(_0xea39('0x0'));var util=require(_0xea39('0x1'));var moment=require(_0xea39('0x2'));var BPromise=require(_0xea39('0x3'));var rs=require(_0xea39('0x4'));var fs=require('fs');var Redis=require(_0xea39('0x5'));var db=require(_0xea39('0x6'))['db'];var utils=require(_0xea39('0x7'));var logger=require(_0xea39('0x8'))(_0xea39('0x9'));var config=require(_0xea39('0xa'));var jayson=require(_0xea39('0xb'));var client=jayson['client'][_0xea39('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2fcbab,_0x3380d1,_0xf32174){return new BPromise(function(_0x1d19a1,_0x32ed4c){return client[_0xea39('0xd')](_0x2fcbab,_0xf32174)[_0xea39('0xe')](function(_0x10b8d7){logger['info'](_0xea39('0xf'),_0x3380d1,_0xea39('0x10'));logger['debug'](_0xea39('0x11'),_0x3380d1,_0xea39('0x10'),JSON[_0xea39('0x12')](_0x10b8d7));if(_0x10b8d7[_0xea39('0x13')]){if(_0x10b8d7[_0xea39('0x13')][_0xea39('0x14')]===0x1f4){logger['error']('ChatTransferReport,\x20%s,\x20%s',_0x3380d1,_0x10b8d7[_0xea39('0x13')][_0xea39('0x15')]);return _0x32ed4c(_0x10b8d7['error'][_0xea39('0x15')]);}logger[_0xea39('0x13')](_0xea39('0xf'),_0x3380d1,_0x10b8d7[_0xea39('0x13')][_0xea39('0x15')]);return _0x1d19a1(_0x10b8d7['error'][_0xea39('0x15')]);}else{logger['info'](_0xea39('0xf'),_0x3380d1,_0xea39('0x10'));_0x1d19a1(_0x10b8d7[_0xea39('0x16')][_0xea39('0x15')]);}})[_0xea39('0x17')](function(_0x30c7db){logger[_0xea39('0x13')]('ChatTransferReport,\x20%s,\x20%s',_0x3380d1,_0x30c7db);_0x32ed4c(_0x30c7db);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 1ed44a5..d51dac4 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 _0x5e45=['update','delete','destroy','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','index','isAuthenticated','/:id','show','post','create','put'];(function(_0x427352,_0x1bce61){var _0x23e0e6=function(_0x2a42a9){while(--_0x2a42a9){_0x427352['push'](_0x427352['shift']());}};_0x23e0e6(++_0x1bce61);}(_0x5e45,0x1bb));var _0x55e4=function(_0x464f43,_0x515b97){_0x464f43=_0x464f43-0x0;var _0x5e17db=_0x5e45[_0x464f43];return _0x5e17db;};'use strict';var multer=require(_0x55e4('0x0'));var util=require(_0x55e4('0x1'));var path=require('path');var timeout=require(_0x55e4('0x2'));var express=require(_0x55e4('0x3'));var router=express['Router']();var fs_extra=require(_0x55e4('0x4'));var auth=require(_0x55e4('0x5'));var interaction=require(_0x55e4('0x6'));var config=require(_0x55e4('0x7'));var controller=require(_0x55e4('0x8'));router[_0x55e4('0x9')]('/',auth['isAuthenticated'](),controller[_0x55e4('0xa')]);router['get']('/describe',auth[_0x55e4('0xb')](),controller['describe']);router['get'](_0x55e4('0xc'),auth[_0x55e4('0xb')](),controller[_0x55e4('0xd')]);router[_0x55e4('0xe')]('/',auth[_0x55e4('0xb')](),controller[_0x55e4('0xf')]);router[_0x55e4('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x55e4('0x11')]);router[_0x55e4('0x12')](_0x55e4('0xc'),auth[_0x55e4('0xb')](),controller[_0x55e4('0x13')]);module['exports']=router; \ No newline at end of file +var _0x5291=['/:id','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./chatTransferReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x343e44,_0x519af9){var _0xa5130e=function(_0xae1fa0){while(--_0xae1fa0){_0x343e44['push'](_0x343e44['shift']());}};_0xa5130e(++_0x519af9);}(_0x5291,0x92));var _0x1529=function(_0x125f58,_0x565244){_0x125f58=_0x125f58-0x0;var _0x553b08=_0x5291[_0x125f58];return _0x553b08;};'use strict';var multer=require(_0x1529('0x0'));var util=require(_0x1529('0x1'));var path=require(_0x1529('0x2'));var timeout=require(_0x1529('0x3'));var express=require(_0x1529('0x4'));var router=express[_0x1529('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x1529('0x6'));var interaction=require(_0x1529('0x7'));var config=require('../../config/environment');var controller=require(_0x1529('0x8'));router[_0x1529('0x9')]('/',auth[_0x1529('0xa')](),controller[_0x1529('0xb')]);router[_0x1529('0x9')](_0x1529('0xc'),auth[_0x1529('0xa')](),controller[_0x1529('0xd')]);router[_0x1529('0x9')](_0x1529('0xe'),auth[_0x1529('0xa')](),controller['show']);router['post']('/',auth[_0x1529('0xa')](),controller[_0x1529('0xf')]);router[_0x1529('0x10')](_0x1529('0xe'),auth[_0x1529('0xa')](),controller[_0x1529('0x11')]);router['delete']('/:id',auth[_0x1529('0xa')](),controller[_0x1529('0x12')]);module[_0x1529('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 1d761ed..4a448d8 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 _0x6324=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING','address','Agent','#011F6A','#ffffff','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Form\x20properly\x20submitted','Form\x20submission\x20error','Type\x20a\x20message','Feedback','star','thumb','INTEGER','stringify','input','name','text','email','getDataValue','onlineForm','parse','setDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Skip','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','CHAT','alternate','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x2a76fb,_0x2405e2){var _0x5781c7=function(_0x1da807){while(--_0x1da807){_0x2a76fb['push'](_0x2a76fb['shift']());}};_0x5781c7(++_0x2405e2);}(_0x6324,0x142));var _0x4632=function(_0x3ea3ae,_0x29dd29){_0x3ea3ae=_0x3ea3ae-0x0;var _0x2aa587=_0x6324[_0x3ea3ae];return _0x2aa587;};'use strict';var Sequelize=require(_0x4632('0x0'));var rs=require(_0x4632('0x1'));module[_0x4632('0x2')]={'name':{'type':Sequelize[_0x4632('0x3')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x4632('0x4')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0x4632('0x3')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize[_0x4632('0x3')],'defaultValue':'email'},'key':{'type':Sequelize[_0x4632('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x4632('0x3')],'defaultValue':_0x4632('0x5')},'customerAlias':{'type':Sequelize[_0x4632('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x4632('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x4632('0x3')],'allowNull':![],'defaultValue':_0x4632('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x4632('0x7'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x4632('0x3')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0x4632('0x3')]},'animation':{'type':Sequelize[_0x4632('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x4632('0x9')](_0x4632('0xa'),_0x4632('0xb')),'defaultValue':_0x4632('0xa')},'header_online':{'type':Sequelize[_0x4632('0x3')],'defaultValue':_0x4632('0xc')},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x4632('0xd')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x4632('0xe')},'header_offline':{'type':Sequelize[_0x4632('0x3')],'defaultValue':_0x4632('0xf')},'download_transcript':{'type':Sequelize[_0x4632('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x4632('0x3')],'defaultValue':_0x4632('0x10')},'defaultWhiteLabel':{'type':Sequelize[_0x4632('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x4632('0x11')]},'closingQuestion':{'type':Sequelize[_0x4632('0x3')],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':_0x4632('0x12')},'formSubmitFailureMessage':{'type':Sequelize[_0x4632('0x3')],'defaultValue':_0x4632('0x13')},'noteTitle':{'type':Sequelize[_0x4632('0x3')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0x4632('0x3')],'defaultValue':_0x4632('0x14')},'closingMessage':{'type':Sequelize[_0x4632('0x3')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0x4632('0x3')],'defaultValue':_0x4632('0xe')},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0x4632('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x4632('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x4632('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x4632('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x4632('0x3')],'defaultValue':_0x4632('0x15')},'ratingType':{'type':Sequelize[_0x4632('0x9')](_0x4632('0x16'),_0x4632('0x17')),'defaultValue':_0x4632('0x16')},'ratingStarsNumber':{'type':Sequelize[_0x4632('0x18')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x4632('0x11')],'defaultValue':function(){return JSON[_0x4632('0x19')]({'items':[{'type':_0x4632('0x1a'),'variable':null,'config':{'placeholder':_0x4632('0x1b'),'type':_0x4632('0x1c'),'required':!![]},'props':{'title':_0x4632('0x1b'),'helpText':''}},{'type':_0x4632('0x1a'),'props':{'title':_0x4632('0x1d'),'helpText':''},'config':{'required':!![],'placeholder':_0x4632('0x1d'),'type':_0x4632('0x1d')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x4632('0x1e')](_0x4632('0x1f'))?JSON[_0x4632('0x20')](this[_0x4632('0x1e')](_0x4632('0x1f'))):{};},'set':function(_0x4af026){return this[_0x4632('0x21')](_0x4632('0x1f'),JSON[_0x4632('0x19')](_0x4af026));}},'offlineForm':{'type':Sequelize[_0x4632('0x11')],'defaultValue':function(){return JSON[_0x4632('0x19')]({'items':[{'type':_0x4632('0x1a'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x4632('0x1d')},'variable':null},{'type':_0x4632('0x22'),'config':{'placeholder':_0x4632('0x23')},'props':{'title':_0x4632('0x23'),'helpText':_0x4632('0x24')}}],'fromKey':0x0});},'get':function(){return this[_0x4632('0x1e')](_0x4632('0x25'))?JSON['parse'](this[_0x4632('0x1e')](_0x4632('0x25'))):{};},'set':function(_0x48f5fb){return this[_0x4632('0x21')]('offlineForm',JSON[_0x4632('0x19')](_0x48f5fb));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0x4632('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x4632('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x4632('0x8')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x4632('0x3')]},'waitingTitle':{'type':Sequelize[_0x4632('0x3')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x4632('0x26')},'offlineMessageSubject':{'type':Sequelize[_0x4632('0x3')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0x4632('0x3')],'defaultValue':_0x4632('0x27')},'enableUnmanagedNote':{'type':Sequelize[_0x4632('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x4632('0x3')],'defaultValue':_0x4632('0x28')},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x4632('0x29')},'sendUnmanaged':{'type':Sequelize[_0x4632('0x3')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x4632('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0x4632('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x4632('0x2a');}},'notificationSound':{'type':Sequelize[_0x4632('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x4632('0x8')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x4632('0x3')],'defaultValue':_0x4632('0x2b')},'waitForTheAssignedAgent':{'type':Sequelize[_0x4632('0x18')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x4632('0x3')],'defaultValue':_0x4632('0x2c')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'labelText':{'type':Sequelize['STRING'],'defaultValue':_0x4632('0x2d')},'messagesAlignment':{'type':Sequelize[_0x4632('0x3')],'defaultValue':_0x4632('0x2e')},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x4632('0x18')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x4632('0x3')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x4632('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x4632('0x18')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x4632('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x4632('0x18')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x4632('0x3')],'defaultValue':_0x4632('0x2f')},'systemAvatar':{'type':Sequelize[_0x4632('0x11')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4632('0x18')],'comment':_0x4632('0x30')},'mandatoryDisposition':{'type':Sequelize[_0x4632('0x8')],'defaultValue':![],'comment':_0x4632('0x31'),'set':function(_0x3b6258){if(!_0x3b6258)this['setDataValue'](_0x4632('0x32'),null);this[_0x4632('0x21')]('mandatoryDisposition',_0x3b6258);}},'vidaooEscalation':{'type':Sequelize[_0x4632('0x8')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x4632('0x3')]},'vidaooTopic':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x4632('0x33')},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0x4632('0x34');}},'vidaooMetadata':{'type':Sequelize[_0x4632('0x11')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x4632('0x8')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x4632('0x11')]}}; \ No newline at end of file +var _0x0bb5=['mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','STRING','address','email','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','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','Feedback','star','input','text','name','onlineForm','parse','getDataValue','setDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','stringify','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Skip','website_alias','bottom_right','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x2f02d4,_0x27b24a){var _0x4b707d=function(_0x52f3ba){while(--_0x52f3ba){_0x2f02d4['push'](_0x2f02d4['shift']());}};_0x4b707d(++_0x27b24a);}(_0x0bb5,0x148));var _0x50bb=function(_0xbe507e,_0x261a54){_0xbe507e=_0xbe507e-0x0;var _0x1359ad=_0x0bb5[_0xbe507e];return _0x1359ad;};'use strict';var Sequelize=require(_0x50bb('0x0'));var rs=require(_0x50bb('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize[_0x50bb('0x2')],'allowNull':![],'unique':_0x50bb('0x3')},'description':{'type':Sequelize[_0x50bb('0x2')]},'mapKey':{'type':Sequelize[_0x50bb('0x2')],'defaultValue':_0x50bb('0x4')},'mapKeyOffline':{'type':Sequelize[_0x50bb('0x2')],'defaultValue':_0x50bb('0x4')},'key':{'type':Sequelize[_0x50bb('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0x50bb('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x50bb('0x2')],'allowNull':![],'defaultValue':_0x50bb('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x50bb('0x2')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x50bb('0x6'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x50bb('0x2')],'allowNull':![],'defaultValue':_0x50bb('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x50bb('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0x50bb('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x50bb('0x9')](_0x50bb('0xa'),_0x50bb('0xb')),'defaultValue':_0x50bb('0xa')},'header_online':{'type':Sequelize[_0x50bb('0x2')],'defaultValue':_0x50bb('0xc')},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x50bb('0xd')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x50bb('0xe')},'header_offline':{'type':Sequelize[_0x50bb('0x2')],'defaultValue':_0x50bb('0xf')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x50bb('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x50bb('0x2')],'defaultValue':_0x50bb('0x10')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x50bb('0x11')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0x50bb('0x12')},'formSubmitSuccessMessage':{'type':Sequelize[_0x50bb('0x2')],'defaultValue':_0x50bb('0x13')},'formSubmitFailureMessage':{'type':Sequelize[_0x50bb('0x2')],'defaultValue':_0x50bb('0x14')},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':_0x50bb('0x15')},'placeholderMessage':{'type':Sequelize[_0x50bb('0x2')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0x50bb('0x2')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0x50bb('0x2')],'defaultValue':_0x50bb('0xe')},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0x50bb('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x50bb('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x50bb('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x50bb('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':_0x50bb('0x16')},'ratingType':{'type':Sequelize[_0x50bb('0x9')](_0x50bb('0x17'),'thumb'),'defaultValue':_0x50bb('0x17')},'ratingStarsNumber':{'type':Sequelize[_0x50bb('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x50bb('0x11')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x50bb('0x18'),'variable':null,'config':{'placeholder':'name','type':_0x50bb('0x19'),'required':!![]},'props':{'title':_0x50bb('0x1a'),'helpText':''}},{'type':_0x50bb('0x18'),'props':{'title':_0x50bb('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x50bb('0x4'),'type':_0x50bb('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0x50bb('0x1b'))?JSON[_0x50bb('0x1c')](this[_0x50bb('0x1d')](_0x50bb('0x1b'))):{};},'set':function(_0x5234d7){return this[_0x50bb('0x1e')]('onlineForm',JSON['stringify'](_0x5234d7));}},'offlineForm':{'type':Sequelize[_0x50bb('0x11')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':'input','props':{'title':_0x50bb('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x50bb('0x4'),'type':_0x50bb('0x4')},'variable':null},{'type':_0x50bb('0x1f'),'config':{'placeholder':_0x50bb('0x20')},'props':{'title':_0x50bb('0x20'),'helpText':_0x50bb('0x21')}}],'fromKey':0x0});},'get':function(){return this[_0x50bb('0x1d')]('offlineForm')?JSON[_0x50bb('0x1c')](this[_0x50bb('0x1d')](_0x50bb('0x22'))):{};},'set':function(_0x1b7c0f){return this['setDataValue'](_0x50bb('0x22'),JSON[_0x50bb('0x23')](_0x1b7c0f));}},'token':{'type':Sequelize[_0x50bb('0x2')],'defaultValue':function(){return rs[_0x50bb('0x24')]();}},'autoclose':{'type':Sequelize[_0x50bb('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x50bb('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x50bb('0x8')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x50bb('0x2')]},'forwardOffline':{'type':Sequelize[_0x50bb('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x50bb('0x2')]},'waitingTitle':{'type':Sequelize[_0x50bb('0x2')],'defaultValue':_0x50bb('0x25')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x50bb('0x26')},'offlineMessageSubject':{'type':Sequelize[_0x50bb('0x2')],'defaultValue':_0x50bb('0x27')},'offlineMessageBody':{'type':Sequelize[_0x50bb('0x2')],'defaultValue':_0x50bb('0x28')},'enableUnmanagedNote':{'type':Sequelize[_0x50bb('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x50bb('0x2')],'defaultValue':_0x50bb('0x29')},'skipUnmanaged':{'type':Sequelize[_0x50bb('0x2')],'defaultValue':_0x50bb('0x2a')},'sendUnmanaged':{'type':Sequelize[_0x50bb('0x2')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0x50bb('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x50bb('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x50bb('0x11')]},'showAgentAvatar':{'type':Sequelize[_0x50bb('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x50bb('0x2')]},'notificationTemplate':{'type':Sequelize[_0x50bb('0x11')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x50bb('0x8')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x50bb('0x2')],'defaultValue':_0x50bb('0x2b')},'waitForTheAssignedAgent':{'type':Sequelize[_0x50bb('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x50bb('0x2')],'defaultValue':_0x50bb('0x2c')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x50bb('0x2')],'defaultValue':'CHAT'},'messagesAlignment':{'type':Sequelize[_0x50bb('0x2')],'defaultValue':_0x50bb('0x2d')},'defaultTitle':{'type':Sequelize[_0x50bb('0x2')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x50bb('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x50bb('0x2')],'allowNull':![],'defaultValue':_0x50bb('0x2e'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x50bb('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x50bb('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':_0x50bb('0x2f')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x50bb('0x7')],'comment':_0x50bb('0x30')},'mandatoryDisposition':{'type':Sequelize[_0x50bb('0x8')],'defaultValue':![],'comment':_0x50bb('0x31'),'set':function(_0x3a9fe4){if(!_0x3a9fe4)this[_0x50bb('0x1e')](_0x50bb('0x32'),null);this[_0x50bb('0x1e')](_0x50bb('0x33'),_0x3a9fe4);}},'vidaooEscalation':{'type':Sequelize[_0x50bb('0x8')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING']},'vidaooTopic':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x50bb('0x34')},'vidaooNote':{'type':Sequelize[_0x50bb('0x2')],'defaultValue':function(){return _0x50bb('0x35');}},'vidaooMetadata':{'type':Sequelize[_0x50bb('0x11')],'defaultValue':null},'openNewInteraction':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x50bb('0x11')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 6486a5d..7cc82b2 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 _0x1806=['index','map','ChatWebsite','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','mandatoryDispositionPause','rawAttributes','length','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','ChatWebsites','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','hasOwnProperty','removeDispositions','ids','CannedAnswer','findOne','findAll','removeAnswers','addLogo','sitepic','file','filename','getLogo','join','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','isNil','existsSync','root','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','agentAvatar','server/files/images/avatars/','getCustomerAvatar','showCustomerAvatar','customerAvatar','getSystemAvatar','systemAvatar','notify','setUA','headers','getResult','CmContact','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from','from\x20is\x20mandatory','ValidationError','Sequelize','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','Applications','account','applications','asc','contact','customerIp','cf-connecting-ip','split','firstName','lastName','x-real-port','browser','version','format','%s\x20%s','unknown','device','vendor','%s\x20%s\x20%s','threadId','externalUrl','ChatInteraction','interaction','messageId','created','autoclose','push','close','unmanaged','*,*,*,*','AttachmentId','UserId','User','unshift','agent','startRouting','Start','EventManager','files','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','spread','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','ChatOfflineMessage','fromString','originalname','server','attachments','openNewInteraction','sequelize','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','getSmtpOptions','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','mimetype','subjectOffline','mapValues','Chat','MailAccountId','NotifyMailAccount','notifyMail','offline-chat','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','Owner','fullname','internal','Tag','color','tag','getSnippet','iftime\x20%s,%s','interval','timezone','iftime\x20%s','indexOf','true','ONLINE','No\x20timezone','inspect','Interval','Intervals','getProactiveActions','License','increment','chatLicenseExceeded','all','some','server/files/chat/iframe.ejs','remote','x-forwarded-for','virtual','alignment','verticalAlignment','labelText','backgroundColor','addApplications','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','ChatApplication','findAndCountAll','finally','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','online','false','offlineForm','items','fromKey','Attachment','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','mustache','util','path','ejs','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','html-to-text','jayson/promise','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','status','json','undefined','limit','count','offset','Content-Range','destroy','UserProfileResource','stack','name','send'];(function(_0x2eeed4,_0x28dc98){var _0x56099d=function(_0x1018a7){while(--_0x1018a7){_0x2eeed4['push'](_0x2eeed4['shift']());}};_0x56099d(++_0x28dc98);}(_0x1806,0xec));var _0x6180=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x1806[_0x2dafbe];return _0x58a45a;};'use strict';var BPromise=require('bluebird');var Mustache=require(_0x6180('0x0'));var util=require(_0x6180('0x1'));var path=require(_0x6180('0x2'));var ejs=require(_0x6180('0x3'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var querystring=require('querystring');var Redis=require(_0x6180('0x4'));var qs=require(_0x6180('0x5'));var logger=require(_0x6180('0x6'))('api');var config=require(_0x6180('0x7'));var db=require(_0x6180('0x8'))['db'];config[_0x6180('0x9')]=_[_0x6180('0xa')](config[_0x6180('0x9')],{'host':_0x6180('0xb'),'port':0x18eb});var socket=require(_0x6180('0xc'))(new Redis(config[_0x6180('0x9')]));require(_0x6180('0xd'))[_0x6180('0xe')](socket);var htmlToText=require(_0x6180('0xf'));var jayson=require(_0x6180('0x10'));var client=jayson[_0x6180('0x11')][_0x6180('0x12')]({'port':0x232c});var client9002=jayson[_0x6180('0x11')][_0x6180('0x12')]({'port':0x232a});var client9003=jayson[_0x6180('0x11')][_0x6180('0x12')]({'port':0x232b});var client9001=jayson[_0x6180('0x11')]['http']({'port':0x2329});function respondWithRpcPromise(_0xa081dc,_0x4fd411,_0x25269e,_0x1c6d58){return new BPromise(function(_0x503908,_0x1b9f19){var _0x70b237=_0x1c6d58||client;return _0x70b237[_0x6180('0x13')](_0xa081dc,_0x25269e)[_0x6180('0x14')](function(_0x55ca9e){logger[_0x6180('0x15')](_0x6180('0x16'),_0x4fd411,'request\x20sent');logger['debug']('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x4fd411,_0x6180('0x17'),JSON[_0x6180('0x18')](_0x55ca9e));if(_0x55ca9e[_0x6180('0x19')]){if(_0x55ca9e[_0x6180('0x19')][_0x6180('0x1a')]===0x1f4){logger['error'](_0x6180('0x16'),_0x4fd411,_0x55ca9e[_0x6180('0x19')][_0x6180('0x1b')]);return _0x1b9f19(_0x55ca9e[_0x6180('0x19')][_0x6180('0x1b')]);}logger['error'](_0x6180('0x16'),_0x4fd411,_0x55ca9e[_0x6180('0x19')]['message']);return _0x503908(_0x55ca9e[_0x6180('0x19')][_0x6180('0x1b')]);}else{logger[_0x6180('0x15')](_0x6180('0x16'),_0x4fd411,_0x6180('0x17'));_0x503908(_0x55ca9e['result'][_0x6180('0x1b')]);}})[_0x6180('0x1c')](function(_0x20fc9b){logger[_0x6180('0x19')](_0x6180('0x16'),_0x4fd411,_0x20fc9b);_0x1b9f19(_0x20fc9b);});});}function respondWithStatusCode(_0x589a74,_0x23a41a){_0x23a41a=_0x23a41a||0xcc;return function(_0x3261f2){if(_0x3261f2){return _0x589a74[_0x6180('0x1d')](_0x23a41a);}return _0x589a74[_0x6180('0x1e')](_0x23a41a)['end']();};}function respondWithResult(_0x3acc02,_0x3e05fe){_0x3e05fe=_0x3e05fe||0xc8;return function(_0x24ad44){if(_0x24ad44){return _0x3acc02[_0x6180('0x1e')](_0x3e05fe)[_0x6180('0x1f')](_0x24ad44);}};}function respondWithFilteredResult(_0x2830ca,_0x55b71b){return function(_0x58f69c){if(_0x58f69c){var _0xcc82d8=typeof _0x55b71b['offset']===_0x6180('0x20')&&typeof _0x55b71b[_0x6180('0x21')]===_0x6180('0x20');var _0x69a84f=_0x58f69c[_0x6180('0x22')];var _0x4c398b=_0xcc82d8?0x0:_0x55b71b[_0x6180('0x23')];var _0x1298c7=_0xcc82d8?_0x58f69c[_0x6180('0x22')]:_0x55b71b[_0x6180('0x23')]+_0x55b71b[_0x6180('0x21')];var _0x4e5bba;if(_0x1298c7>=_0x69a84f){_0x1298c7=_0x69a84f;_0x4e5bba=0xc8;}else{_0x4e5bba=0xce;}_0x2830ca[_0x6180('0x1e')](_0x4e5bba);return _0x2830ca['set'](_0x6180('0x24'),_0x4c398b+'-'+_0x1298c7+'/'+_0x69a84f)[_0x6180('0x1f')](_0x58f69c);}return null;};}function saveUpdates(_0x4431c9){return function(_0x1a4d3e){if(_0x1a4d3e){return _0x1a4d3e['update'](_0x4431c9)[_0x6180('0x14')](function(_0xef7ad){return _0xef7ad;});}return null;};}function removeEntity(_0x1df772){return function(_0x3b4151){if(_0x3b4151){return _0x3b4151[_0x6180('0x25')]()[_0x6180('0x14')](function(){var _0x47ee1f=_0x3b4151['get']({'plain':!![]});var _0x59c505='ChatWebsites';return db[_0x6180('0x26')][_0x6180('0x25')]({'where':{'type':_0x59c505,'resourceId':_0x47ee1f['id']}})[_0x6180('0x14')](function(){return _0x3b4151;});})['then'](function(){_0x1df772[_0x6180('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0xddba3){return function(_0x2f83cd){if(!_0x2f83cd){_0xddba3[_0x6180('0x1d')](0x194);}return _0x2f83cd;};}function handleError(_0xd770d7,_0x4ec04b){_0x4ec04b=_0x4ec04b||0x1f4;return function(_0x27fd4a){logger[_0x6180('0x19')](_0x27fd4a[_0x6180('0x27')]);if(_0x27fd4a[_0x6180('0x28')]){delete _0x27fd4a[_0x6180('0x28')];}_0xd770d7[_0x6180('0x1e')](_0x4ec04b)[_0x6180('0x29')](_0x27fd4a);};}exports[_0x6180('0x2a')]=function(_0x2de8f4,_0x22bdec){var _0x584bb0={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x4b8a51={},_0xd46127={'count':0x0,'rows':[]};var _0x1fed2e=_[_0x6180('0x2b')](db[_0x6180('0x2c')]['rawAttributes'],function(_0x440a97){return{'name':_0x440a97[_0x6180('0x2d')],'type':_0x440a97[_0x6180('0x2e')][_0x6180('0x2f')]};});_0x4b8a51[_0x6180('0x30')]=_[_0x6180('0x2b')](_0x1fed2e,'name');_0x4b8a51[_0x6180('0x31')]=_[_0x6180('0x32')](_0x2de8f4['query']);_0x4b8a51[_0x6180('0x33')]=_[_0x6180('0x34')](_0x4b8a51[_0x6180('0x30')],_0x4b8a51['query']);_0x584bb0[_0x6180('0x35')]=_[_0x6180('0x34')](_0x4b8a51[_0x6180('0x30')],qs[_0x6180('0x36')](_0x2de8f4['query']['fields']));_0x584bb0[_0x6180('0x35')]=_0x584bb0['attributes']['length']?_0x584bb0[_0x6180('0x35')]:_0x4b8a51[_0x6180('0x30')];if(!_0x2de8f4[_0x6180('0x31')]['hasOwnProperty'](_0x6180('0x37'))){_0x584bb0[_0x6180('0x21')]=qs[_0x6180('0x21')](_0x2de8f4['query'][_0x6180('0x21')]);_0x584bb0[_0x6180('0x23')]=qs[_0x6180('0x23')](_0x2de8f4['query'][_0x6180('0x23')]);}_0x584bb0[_0x6180('0x38')]=qs[_0x6180('0x39')](_0x2de8f4[_0x6180('0x31')]['sort']);_0x584bb0['where']=qs[_0x6180('0x33')](_[_0x6180('0x3a')](_0x2de8f4[_0x6180('0x31')],_0x4b8a51['filters']),_0x1fed2e);if(_0x2de8f4[_0x6180('0x31')][_0x6180('0x3b')]){_0x584bb0[_0x6180('0x3c')]=_[_0x6180('0x3d')](_0x584bb0[_0x6180('0x3c')],{'$or':_[_0x6180('0x2b')](_0x1fed2e,function(_0x57d8f7){if(_0x57d8f7[_0x6180('0x2e')]!==_0x6180('0x3e')){var _0x524ad0={};_0x524ad0[_0x57d8f7[_0x6180('0x28')]]={'$like':'%'+_0x2de8f4[_0x6180('0x31')][_0x6180('0x3b')]+'%'};return _0x524ad0;}})});}_0x584bb0=_['merge']({},_0x584bb0,_0x2de8f4[_0x6180('0x3f')]);var _0x19398b={'where':_0x584bb0[_0x6180('0x3c')]};return db[_0x6180('0x2c')]['count'](_0x19398b)[_0x6180('0x14')](function(_0x34bb3a){_0xd46127['count']=_0x34bb3a;if(_0x2de8f4[_0x6180('0x31')][_0x6180('0x40')]){_0x584bb0[_0x6180('0x41')]=[{'all':!![]}];}return db[_0x6180('0x2c')]['findAll'](_0x584bb0);})['then'](function(_0x2fce13){_0xd46127[_0x6180('0x42')]=_0x2fce13;return _0xd46127;})['then'](respondWithFilteredResult(_0x22bdec,_0x584bb0))[_0x6180('0x1c')](handleError(_0x22bdec,null));};exports['show']=function(_0x425d26,_0x5a416e){var _0x234e65={'raw':![],'where':{'id':_0x425d26['params']['id']},'include':[{'model':db['Pause'],'as':_0x6180('0x43')}]},_0x5813d0={};_0x5813d0[_0x6180('0x30')]=_[_0x6180('0x32')](db[_0x6180('0x2c')][_0x6180('0x44')]);_0x5813d0[_0x6180('0x31')]=_[_0x6180('0x32')](_0x425d26['query']);_0x5813d0[_0x6180('0x33')]=_[_0x6180('0x34')](_0x5813d0[_0x6180('0x30')],_0x5813d0[_0x6180('0x31')]);_0x234e65['attributes']=_[_0x6180('0x34')](_0x5813d0[_0x6180('0x30')],qs[_0x6180('0x36')](_0x425d26[_0x6180('0x31')]['fields']));_0x234e65[_0x6180('0x35')]=_0x234e65['attributes'][_0x6180('0x45')]?_0x234e65[_0x6180('0x35')]:_0x5813d0[_0x6180('0x30')];if(_0x425d26[_0x6180('0x31')][_0x6180('0x40')]){_0x234e65[_0x6180('0x41')]=[{'all':!![]}];}_0x234e65=_[_0x6180('0x3d')]({},_0x234e65,_0x425d26[_0x6180('0x3f')]);return db[_0x6180('0x2c')]['find'](_0x234e65)[_0x6180('0x14')](handleEntityNotFound(_0x5a416e,null))[_0x6180('0x14')](respondWithResult(_0x5a416e,null))['catch'](handleError(_0x5a416e,null));};exports[_0x6180('0x46')]=function(_0x38f699,_0xfb0115){return db[_0x6180('0x2c')][_0x6180('0x46')](_0x38f699[_0x6180('0x47')],{})[_0x6180('0x14')](function(_0xb62887){var _0x152ffb=_0x38f699[_0x6180('0x48')][_0x6180('0x49')]({'plain':!![]});if(!_0x152ffb)throw new Error(_0x6180('0x4a'));if(_0x152ffb['role']===_0x6180('0x48')){var _0x966c3b=_0xb62887[_0x6180('0x49')]({'plain':!![]});var _0x51eec6=_0x6180('0x4b');return db[_0x6180('0x4c')][_0x6180('0x4d')]({'where':{'name':_0x51eec6,'userProfileId':_0x152ffb[_0x6180('0x4e')]},'raw':!![]})[_0x6180('0x14')](function(_0x333aaa){if(_0x333aaa&&_0x333aaa[_0x6180('0x4f')]===0x0){return db['UserProfileResource'][_0x6180('0x46')]({'name':_0x966c3b[_0x6180('0x28')],'resourceId':_0x966c3b['id'],'type':_0x333aaa['name'],'sectionId':_0x333aaa['id']},{})[_0x6180('0x14')](function(){return _0xb62887;});}else{return _0xb62887;}})[_0x6180('0x1c')](function(_0x4fa84d){logger['error'](_0x6180('0x50'),_0x4fa84d);throw _0x4fa84d;});}return _0xb62887;})[_0x6180('0x14')](respondWithResult(_0xfb0115,0xc9))[_0x6180('0x1c')](handleError(_0xfb0115,null));};exports[_0x6180('0x51')]=function(_0xea5f8c,_0xceefc9){if(_0xea5f8c[_0x6180('0x47')]['id']){delete _0xea5f8c['body']['id'];}return db[_0x6180('0x2c')][_0x6180('0x4d')]({'where':{'id':_0xea5f8c[_0x6180('0x52')]['id']},'include':[{'model':db['Pause'],'as':_0x6180('0x43')}]})[_0x6180('0x14')](handleEntityNotFound(_0xceefc9,null))[_0x6180('0x14')](saveUpdates(_0xea5f8c[_0x6180('0x47')],null))['then'](respondWithResult(_0xceefc9,null))[_0x6180('0x1c')](handleError(_0xceefc9,null));};exports[_0x6180('0x25')]=function(_0x3d164c,_0x390541){return db[_0x6180('0x2c')]['find']({'where':{'id':_0x3d164c[_0x6180('0x52')]['id']}})[_0x6180('0x14')](handleEntityNotFound(_0x390541,null))[_0x6180('0x14')](removeEntity(_0x390541,null))[_0x6180('0x1c')](handleError(_0x390541,null));};exports[_0x6180('0x53')]=function(_0x2b4a74,_0x189564){return db[_0x6180('0x2c')][_0x6180('0x53')]()['then'](respondWithResult(_0x189564,null))[_0x6180('0x1c')](handleError(_0x189564,null));};exports[_0x6180('0x54')]=function(_0x223982,_0x2b6abc){if(_0x223982[_0x6180('0x47')]['id']){delete _0x223982[_0x6180('0x47')]['id'];}return db[_0x6180('0x2c')]['find']({'where':{'id':_0x223982[_0x6180('0x52')]['id']}})[_0x6180('0x14')](handleEntityNotFound(_0x2b6abc,null))[_0x6180('0x14')](function(_0x2ef3d3){if(_0x2ef3d3){_0x223982['body'][_0x6180('0x55')]=_0x2ef3d3['id'];return db[_0x6180('0x56')][_0x6180('0x46')](_0x223982['body']);}})[_0x6180('0x14')](respondWithResult(_0x2b6abc,null))[_0x6180('0x1c')](handleError(_0x2b6abc,null));};exports[_0x6180('0x57')]=function(_0x19afac,_0x1d0bd8){var _0x5b4858={'raw':![],'where':{}};var _0x5a156f={};var _0x2fade1={'count':0x0,'rows':[]};return db[_0x6180('0x2c')]['findOne']({'where':{'id':_0x19afac[_0x6180('0x52')]['id']}})[_0x6180('0x14')](handleEntityNotFound(_0x1d0bd8,null))[_0x6180('0x14')](function(_0x47d775){if(_0x47d775){_0x5a156f[_0x6180('0x30')]=_[_0x6180('0x32')](db[_0x6180('0x56')][_0x6180('0x44')]);_0x5a156f[_0x6180('0x31')]=_[_0x6180('0x32')](_0x19afac[_0x6180('0x31')]);_0x5a156f[_0x6180('0x33')]=_['intersection'](_0x5a156f['model'],_0x5a156f[_0x6180('0x31')]);_0x5b4858[_0x6180('0x35')]=_['intersection'](_0x5a156f['model'],qs[_0x6180('0x36')](_0x19afac[_0x6180('0x31')][_0x6180('0x36')]));_0x5b4858[_0x6180('0x35')]=_0x5b4858['attributes'][_0x6180('0x45')]?_0x5b4858['attributes']:_0x5a156f[_0x6180('0x30')];if(!_0x19afac[_0x6180('0x31')][_0x6180('0x58')](_0x6180('0x37'))){_0x5b4858[_0x6180('0x21')]=qs[_0x6180('0x21')](_0x19afac['query'][_0x6180('0x21')]);_0x5b4858[_0x6180('0x23')]=qs['offset'](_0x19afac['query'][_0x6180('0x23')]);}_0x5b4858['order']=qs[_0x6180('0x39')](_0x19afac['query'][_0x6180('0x39')]);_0x5b4858[_0x6180('0x3c')]=qs[_0x6180('0x33')](_[_0x6180('0x3a')](_0x19afac[_0x6180('0x31')],_0x5a156f[_0x6180('0x33')]));_0x5b4858[_0x6180('0x3c')][_0x6180('0x55')]=_0x47d775['id'];if(_0x19afac[_0x6180('0x31')]['filter']){_0x5b4858[_0x6180('0x3c')]=_[_0x6180('0x3d')](_0x5b4858[_0x6180('0x3c')],{'$or':_['map'](_0x5b4858[_0x6180('0x35')],function(_0x565217){var _0x21a3b4={};_0x21a3b4[_0x565217]={'$like':'%'+_0x19afac[_0x6180('0x31')]['filter']+'%'};return _0x21a3b4;})});}_0x5b4858=_[_0x6180('0x3d')]({},_0x5b4858,_0x19afac[_0x6180('0x3f')]);return db[_0x6180('0x56')][_0x6180('0x22')]({'where':_0x5b4858[_0x6180('0x3c')]})[_0x6180('0x14')](function(_0x4afeaa){_0x2fade1[_0x6180('0x22')]=_0x4afeaa;if(_0x19afac[_0x6180('0x31')][_0x6180('0x40')]){_0x5b4858['include']=[{'all':!![]}];}return db[_0x6180('0x56')]['findAll'](_0x5b4858);})['then'](function(_0x3cada6){_0x2fade1[_0x6180('0x42')]=_0x3cada6;return _0x2fade1;});}})[_0x6180('0x14')](respondWithFilteredResult(_0x1d0bd8,_0x5b4858))['catch'](handleError(_0x1d0bd8,null));};exports[_0x6180('0x59')]=function(_0x27df8d,_0xa00c3c){return db[_0x6180('0x2c')][_0x6180('0x4d')]({'where':{'id':_0x27df8d[_0x6180('0x52')]['id']}})[_0x6180('0x14')](handleEntityNotFound(_0xa00c3c,null))[_0x6180('0x14')](function(_0xbb1581){if(_0xbb1581){return _0xbb1581['removeDispositions'](_0x27df8d[_0x6180('0x31')][_0x6180('0x5a')]);}})[_0x6180('0x14')](respondWithStatusCode(_0xa00c3c,null))[_0x6180('0x1c')](handleError(_0xa00c3c,null));};exports['addAnswer']=function(_0x7a51d3,_0x1a3fcc){if(_0x7a51d3[_0x6180('0x47')]['id']){delete _0x7a51d3[_0x6180('0x47')]['id'];}return db[_0x6180('0x2c')][_0x6180('0x4d')]({'where':{'id':_0x7a51d3[_0x6180('0x52')]['id']}})[_0x6180('0x14')](handleEntityNotFound(_0x1a3fcc,null))['then'](function(_0x35a3cc){if(_0x35a3cc){_0x7a51d3[_0x6180('0x47')][_0x6180('0x55')]=_0x35a3cc['id'];return db[_0x6180('0x5b')]['create'](_0x7a51d3[_0x6180('0x47')]);}})[_0x6180('0x14')](respondWithResult(_0x1a3fcc,null))['catch'](handleError(_0x1a3fcc,null));};exports['getAnswers']=function(_0x2552ac,_0x3e8ab7){var _0x4d5e37={'raw':![],'where':{}};var _0x4af3cd={};var _0x2b11fe={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x6180('0x5c')]({'where':{'id':_0x2552ac[_0x6180('0x52')]['id']}})['then'](handleEntityNotFound(_0x3e8ab7,null))[_0x6180('0x14')](function(_0x54c40a){if(_0x54c40a){_0x4af3cd[_0x6180('0x30')]=_[_0x6180('0x32')](db['CannedAnswer'][_0x6180('0x44')]);_0x4af3cd[_0x6180('0x31')]=_[_0x6180('0x32')](_0x2552ac[_0x6180('0x31')]);_0x4af3cd[_0x6180('0x33')]=_[_0x6180('0x34')](_0x4af3cd[_0x6180('0x30')],_0x4af3cd[_0x6180('0x31')]);_0x4d5e37['attributes']=_[_0x6180('0x34')](_0x4af3cd[_0x6180('0x30')],qs[_0x6180('0x36')](_0x2552ac[_0x6180('0x31')]['fields']));_0x4d5e37[_0x6180('0x35')]=_0x4d5e37[_0x6180('0x35')][_0x6180('0x45')]?_0x4d5e37[_0x6180('0x35')]:_0x4af3cd[_0x6180('0x30')];if(!_0x2552ac[_0x6180('0x31')][_0x6180('0x58')](_0x6180('0x37'))){_0x4d5e37[_0x6180('0x21')]=qs[_0x6180('0x21')](_0x2552ac[_0x6180('0x31')][_0x6180('0x21')]);_0x4d5e37[_0x6180('0x23')]=qs[_0x6180('0x23')](_0x2552ac[_0x6180('0x31')]['offset']);}_0x4d5e37['order']=qs[_0x6180('0x39')](_0x2552ac['query'][_0x6180('0x39')]);_0x4d5e37[_0x6180('0x3c')]=qs[_0x6180('0x33')](_[_0x6180('0x3a')](_0x2552ac[_0x6180('0x31')],_0x4af3cd[_0x6180('0x33')]));_0x4d5e37['where'][_0x6180('0x55')]=_0x54c40a['id'];if(_0x2552ac['query'][_0x6180('0x3b')]){_0x4d5e37[_0x6180('0x3c')]=_[_0x6180('0x3d')](_0x4d5e37[_0x6180('0x3c')],{'$or':_[_0x6180('0x2b')](_0x4d5e37[_0x6180('0x35')],function(_0x3e426a){var _0x39dc40={};_0x39dc40[_0x3e426a]={'$like':'%'+_0x2552ac['query'][_0x6180('0x3b')]+'%'};return _0x39dc40;})});}_0x4d5e37=_[_0x6180('0x3d')]({},_0x4d5e37,_0x2552ac[_0x6180('0x3f')]);return db['CannedAnswer'][_0x6180('0x22')]({'where':_0x4d5e37[_0x6180('0x3c')]})[_0x6180('0x14')](function(_0x52d45b){_0x2b11fe[_0x6180('0x22')]=_0x52d45b;if(_0x2552ac[_0x6180('0x31')]['includeAll']){_0x4d5e37[_0x6180('0x41')]=[{'all':!![]}];}return db['CannedAnswer'][_0x6180('0x5d')](_0x4d5e37);})['then'](function(_0x4455bb){_0x2b11fe[_0x6180('0x42')]=_0x4455bb;return _0x2b11fe;});}})[_0x6180('0x14')](respondWithFilteredResult(_0x3e8ab7,_0x4d5e37))[_0x6180('0x1c')](handleError(_0x3e8ab7,null));};exports['removeAnswers']=function(_0x42d426,_0x4a9559){return db['ChatWebsite'][_0x6180('0x4d')]({'where':{'id':_0x42d426['params']['id']}})[_0x6180('0x14')](handleEntityNotFound(_0x4a9559,null))['then'](function(_0x2d4740){if(_0x2d4740){return _0x2d4740[_0x6180('0x5e')](_0x42d426[_0x6180('0x31')]['ids']);}})[_0x6180('0x14')](respondWithStatusCode(_0x4a9559,null))[_0x6180('0x1c')](handleError(_0x4a9559,null));};exports[_0x6180('0x5f')]=function(_0x2a4ae5,_0x17282d){_0x2a4ae5['body'][_0x6180('0x60')]=_0x2a4ae5[_0x6180('0x61')][_0x6180('0x62')];return db[_0x6180('0x2c')][_0x6180('0x4d')]({'where':{'id':_0x2a4ae5[_0x6180('0x52')]['id']}})['then'](handleEntityNotFound(_0x17282d,null))[_0x6180('0x14')](saveUpdates(_0x2a4ae5[_0x6180('0x47')],null))[_0x6180('0x14')](respondWithResult(_0x17282d,null))[_0x6180('0x1c')](handleError(_0x17282d,null));};exports['addAvatar']=function(_0x337115,_0x631335){_0x337115['body']['agentAvatar']=_0x337115[_0x6180('0x61')][_0x6180('0x62')];return db[_0x6180('0x2c')][_0x6180('0x4d')]({'where':{'id':_0x337115[_0x6180('0x52')]['id']}})['then'](handleEntityNotFound(_0x631335,null))[_0x6180('0x14')](saveUpdates(_0x337115['body'],null))[_0x6180('0x14')](respondWithResult(_0x631335,null))[_0x6180('0x1c')](handleError(_0x631335,null));};exports['addCustomerAvatar']=function(_0x45a998,_0x15fb89){_0x45a998[_0x6180('0x47')]['customerAvatar']=_0x45a998[_0x6180('0x61')][_0x6180('0x62')];return db[_0x6180('0x2c')][_0x6180('0x4d')]({'where':{'id':_0x45a998['params']['id']}})[_0x6180('0x14')](handleEntityNotFound(_0x15fb89,null))['then'](saveUpdates(_0x45a998['body'],null))[_0x6180('0x14')](respondWithResult(_0x15fb89,null))[_0x6180('0x1c')](handleError(_0x15fb89,null));};exports['addSystemAvatar']=function(_0x1f918b,_0x41682a){_0x1f918b[_0x6180('0x47')]['systemAvatar']=_0x1f918b[_0x6180('0x61')]['filename'];return db[_0x6180('0x2c')][_0x6180('0x4d')]({'where':{'id':_0x1f918b[_0x6180('0x52')]['id']}})[_0x6180('0x14')](handleEntityNotFound(_0x41682a,null))[_0x6180('0x14')](saveUpdates(_0x1f918b['body'],null))[_0x6180('0x14')](respondWithResult(_0x41682a,null))['catch'](handleError(_0x41682a,null));};exports[_0x6180('0x63')]=function(_0x3fd8b7,_0x9bc909){var _0x1af513=path[_0x6180('0x64')](config['root'],_0x6180('0x65'));var _0x3866da={'where':{'id':_0x3fd8b7[_0x6180('0x52')]['id']},'attributes':['id',_0x6180('0x60')],'raw':!![]};var _0x3d6c22=![];return require(_0x6180('0x66'))[_0x6180('0x67')]()['then'](function(_0x12c94c){if(_0x12c94c){_0x3d6c22=_0x12c94c[_0x6180('0x68')];}})[_0x6180('0x14')](function(){return db[_0x6180('0x2c')][_0x6180('0x4d')](_0x3866da);})[_0x6180('0x14')](handleEntityNotFound(_0x9bc909,null))[_0x6180('0x14')](function(_0x40593b){if(_0x40593b){if(!_[_0x6180('0x69')](_0x40593b[_0x6180('0x60')])){if(fs[_0x6180('0x6a')](path['join'](config[_0x6180('0x6b')],_0x6180('0x6c'),_0x40593b[_0x6180('0x60')]))&&_0x3d6c22){_0x1af513=path[_0x6180('0x64')](config[_0x6180('0x6b')],'server/files/images/logos/',_0x40593b['sitepic']);}}return _0x9bc909[_0x6180('0x6d')](_0x1af513);}})['catch'](handleError(_0x9bc909,null));};exports[_0x6180('0x6e')]=function(_0x31baca,_0x248f44){var _0x18a936=path[_0x6180('0x64')](config[_0x6180('0x6b')],_0x6180('0x6f'));var _0x4d1441={'where':{'id':_0x31baca['params']['id']},'attributes':['id',_0x6180('0x70')],'raw':!![]};return db[_0x6180('0x2c')][_0x6180('0x4d')](_0x4d1441)[_0x6180('0x14')](handleEntityNotFound(_0x248f44,null))[_0x6180('0x14')](function(_0x4e5723){if(_0x4e5723){if(!_[_0x6180('0x69')](_0x4e5723[_0x6180('0x70')])){if(fs[_0x6180('0x6a')](path[_0x6180('0x64')](config[_0x6180('0x6b')],_0x6180('0x71'),_0x4e5723[_0x6180('0x70')]))){_0x18a936=path[_0x6180('0x64')](config['root'],_0x6180('0x71'),_0x4e5723[_0x6180('0x70')]);}}return _0x248f44[_0x6180('0x6d')](_0x18a936);}})[_0x6180('0x1c')](handleError(_0x248f44,null));};exports[_0x6180('0x72')]=function(_0x3c5ad0,_0x68f219){var _0x41aba0=path[_0x6180('0x64')](config[_0x6180('0x6b')],'server/files/images/avatars/customer_avatar.png');var _0xfc06de={'where':{'id':_0x3c5ad0[_0x6180('0x52')]['id']},'attributes':['id','customerAvatar',_0x6180('0x73')],'raw':!![]};return db['ChatWebsite'][_0x6180('0x4d')](_0xfc06de)['then'](handleEntityNotFound(_0x68f219,null))['then'](function(_0x4c0fc9){if(_0x4c0fc9){if(!_['isNil'](_0x4c0fc9[_0x6180('0x74')])){if(fs[_0x6180('0x6a')](path['join'](config[_0x6180('0x6b')],_0x6180('0x71'),_0x4c0fc9[_0x6180('0x74')]))&&_0x4c0fc9[_0x6180('0x73')]){_0x41aba0=path[_0x6180('0x64')](config[_0x6180('0x6b')],_0x6180('0x71'),_0x4c0fc9[_0x6180('0x74')]);}}return _0x68f219['download'](_0x41aba0);}})[_0x6180('0x1c')](handleError(_0x68f219,null));};exports[_0x6180('0x75')]=function(_0x4c2b36,_0x31bd79){var _0x44fa36=path[_0x6180('0x64')](config[_0x6180('0x6b')],'server/files/images/avatars/system_avatar.png');var _0x5ce254={'where':{'id':_0x4c2b36[_0x6180('0x52')]['id']},'attributes':['id',_0x6180('0x76')],'raw':!![]};return db[_0x6180('0x2c')][_0x6180('0x4d')](_0x5ce254)[_0x6180('0x14')](handleEntityNotFound(_0x31bd79,null))[_0x6180('0x14')](function(_0x42420a){if(_0x42420a){if(!_['isNil'](_0x42420a[_0x6180('0x76')])){if(fs[_0x6180('0x6a')](path[_0x6180('0x64')](config[_0x6180('0x6b')],'server/files/images/avatars/',_0x42420a[_0x6180('0x76')]))){_0x44fa36=path['join'](config[_0x6180('0x6b')],_0x6180('0x71'),_0x42420a[_0x6180('0x76')]);}}return _0x31bd79['download'](_0x44fa36);}})['catch'](handleError(_0x31bd79,null));};exports[_0x6180('0x77')]=function(_0x1abb72,_0x1027c3){var _0x4f3f41=require('user-agent-parser');var _0x9c08f8=new _0x4f3f41();var _0x4b8c94=_0x9c08f8[_0x6180('0x78')](_0x1abb72[_0x6180('0x79')]['user-agent'])[_0x6180('0x7a')]();var _0x23ef81={'body':_0x1abb72[_0x6180('0x47')],'channel':'chat'};var _0x511db4=[];var _0x3b025a=[];var _0x3c8de1={};var _0x2227a9=![];return db[_0x6180('0x7b')][_0x6180('0x53')]()[_0x6180('0x14')](function(_0x4bb03a){if(!_0x4bb03a){throw new db['Sequelize']['ValidationError'](_0x6180('0x7c'));}_0x511db4=_[_0x6180('0x7d')](_['keys'](_0x4bb03a),[_0x6180('0x7e'),'updatedAt']);_0x3b025a=_[_0x6180('0x7d')](_['keys'](_0x4bb03a),[_0x6180('0x7e'),_0x6180('0x7f'),_0x6180('0x80'),_0x6180('0x81')]);if(_0x1abb72[_0x6180('0x47')]['id']){delete _0x1abb72[_0x6180('0x47')]['id'];}if(_[_0x6180('0x69')](_0x1abb72[_0x6180('0x47')][_0x6180('0x82')])){throw new db['Sequelize']['ValidationError'](_0x6180('0x83'));}if(_['isNil'](_0x1abb72['body']['body'])||_0x1abb72[_0x6180('0x47')]['body']===''){throw new db['Sequelize'][(_0x6180('0x84'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x1abb72[_0x6180('0x47')]['mapKey'])){throw new db[(_0x6180('0x85'))][(_0x6180('0x84'))](_0x6180('0x86')+_0x3b025a);}if(!_['includes'](_0x3b025a,_0x1abb72[_0x6180('0x47')][_0x6180('0x87')])){throw new db['Sequelize'][(_0x6180('0x84'))](_0x6180('0x88')+_0x3b025a);}_0x3c8de1[_0x1abb72[_0x6180('0x47')][_0x6180('0x87')]]=_0x1abb72['body']['from'];})[_0x6180('0x14')](function(){return db[_0x6180('0x2c')][_0x6180('0x4d')]({'where':{'id':_0x1abb72[_0x6180('0x52')]['id']},'include':[{'model':db[_0x6180('0x89')],'as':_0x6180('0x8a'),'include':[{'model':db[_0x6180('0x7b')],'as':_0x6180('0x8b'),'where':_0x3c8de1,'limit':0x1,'order':[[_0x6180('0x7f'),'DESC']]}]},{'model':db['ChatApplication'],'as':_0x6180('0x8c')}]});})[_0x6180('0x14')](handleEntityNotFound(_0x1027c3,null))['then'](function(_0x1530aa){if(_0x1530aa&&_0x1530aa[_0x6180('0x8a')]){_0x23ef81[_0x6180('0x8d')]=_0x1530aa;_0x23ef81[_0x6180('0x8e')]=_0x1530aa[_0x6180('0x8c')];_0x23ef81['list']=_0x1530aa[_0x6180('0x8a')];_0x23ef81[_0x6180('0x8e')]=_['orderBy'](_0x23ef81['applications'],['priority'],[_0x6180('0x8f')]);if(_0x23ef81[_0x6180('0x8d')][_0x6180('0x8c')]){delete _0x23ef81['account'][_0x6180('0x8c')];}if(_0x23ef81[_0x6180('0x8d')]['List']&&_0x23ef81[_0x6180('0x8d')][_0x6180('0x8a')]['Contacts']['length']){return _0x23ef81[_0x6180('0x8d')][_0x6180('0x8a')][_0x6180('0x8b')][0x0];}var _0x5e8515=_[_0x6180('0xa')](_0x1abb72['body'],{'firstName':_0x1abb72[_0x6180('0x47')][_0x6180('0x82')],'ListId':_0x1530aa[_0x6180('0x81')]});_0x5e8515[_0x1abb72[_0x6180('0x47')]['mapKey']]=_0x1abb72[_0x6180('0x47')]['from'];return db[_0x6180('0x7b')]['create'](_0x5e8515,{'fields':_0x511db4,'raw':!![]});}})[_0x6180('0x14')](handleEntityNotFound(_0x1027c3,null))[_0x6180('0x14')](function(_0x5eb357){_0x23ef81[_0x6180('0x90')]=_0x5eb357;var _0x550ae7=_0x1abb72[_0x6180('0x47')][_0x6180('0x91')];if(_0x1abb72[_0x6180('0x79')][_0x6180('0x92')]){_0x550ae7=_0x1abb72[_0x6180('0x79')]['cf-connecting-ip'];}else if(_0x1abb72[_0x6180('0x79')]['x-forwarded-for']){_0x550ae7=_['first'](_0x1abb72[_0x6180('0x79')]['x-forwarded-for'][_0x6180('0x93')](','));}if(_0x5eb357){var _0x41bd41={'ContactId':_0x5eb357['id'],'ChatWebsiteId':_0x1abb72[_0x6180('0x52')]['id'],'from':(_0x5eb357[_0x6180('0x94')]||'')+'\x20'+(_0x5eb357[_0x6180('0x95')]||''),'customerIp':_0x550ae7,'customerPort':_0x1abb72['headers'][_0x6180('0x96')]?_0x1abb72[_0x6180('0x79')][_0x6180('0x96')]:null,'referer':_0x1abb72[_0x6180('0x47')]['referer'],'browserName':_0x4b8c94[_0x6180('0x97')][_0x6180('0x28')]&&_0x4b8c94[_0x6180('0x97')][_0x6180('0x98')]?util[_0x6180('0x99')](_0x6180('0x9a'),_0x4b8c94[_0x6180('0x97')][_0x6180('0x28')],_0x4b8c94[_0x6180('0x97')]['version']):'unknown','browserVersion':_0x4b8c94[_0x6180('0x97')][_0x6180('0x98')]||_0x6180('0x9b'),'osName':util['format']('%s\x20%s',_0x4b8c94['os'][_0x6180('0x28')],_0x4b8c94['os'][_0x6180('0x98')]),'osVersion':_0x4b8c94['os'][_0x6180('0x98')],'deviceModel':_0x4b8c94[_0x6180('0x9c')]['model']&&_0x4b8c94[_0x6180('0x9c')][_0x6180('0x9d')]?util[_0x6180('0x99')](_0x6180('0x9e'),_0x4b8c94['device'][_0x6180('0x30')],_0x4b8c94[_0x6180('0x9c')][_0x6180('0x9d')],_0x4b8c94[_0x6180('0x9c')][_0x6180('0x2e')]):null,'deviceVendor':_0x4b8c94[_0x6180('0x9c')][_0x6180('0x9d')],'deviceType':_0x4b8c94[_0x6180('0x9c')][_0x6180('0x2e')],'formData':JSON['stringify'](_0x1abb72['body'])};var _0x34b7c5={'ChatWebsiteId':_0x1abb72[_0x6180('0x52')]['id'],'closed':![]};if(_0x1abb72['body'][_0x6180('0x9f')]){_0x34b7c5[_0x6180('0x9f')]=_0x1abb72[_0x6180('0x47')][_0x6180('0x9f')];return db['ChatInteraction'][_0x6180('0x4d')]({'where':_0x34b7c5})['then'](function(_0x383f6c){if(_0x383f6c){return[_0x383f6c,![]];}_0x41bd41[_0x6180('0x9f')]=_0x1abb72[_0x6180('0x47')][_0x6180('0x9f')];_0x41bd41[_0x6180('0xa0')]=_0x1abb72[_0x6180('0x47')]['externalUrl'];return db[_0x6180('0xa1')][_0x6180('0x46')](_0x41bd41)[_0x6180('0x14')](function(_0x32ccf0){return[_0x32ccf0,!![]];});});}_0x34b7c5['ContactId']=_0x5eb357['id'];if(_0x1abb72['body'][_0x6180('0xa2')]&&_0x1abb72[_0x6180('0x47')]['interaction']['id']){_0x34b7c5['id']=_0x1abb72[_0x6180('0x47')][_0x6180('0xa2')]['id'];return db['ChatInteraction'][_0x6180('0x4d')]({'where':_0x34b7c5})[_0x6180('0x14')](function(_0xb24872){if(_0xb24872){return[_0xb24872,![]];}return db[_0x6180('0xa1')][_0x6180('0x46')](_0x41bd41)[_0x6180('0x14')](function(_0x4ac1d0){return[_0x4ac1d0,!![]];});});}return db[_0x6180('0xa1')][_0x6180('0x46')](_0x41bd41)[_0x6180('0x14')](function(_0x94799e){return[_0x94799e,!![]];});}})['spread'](function(_0x4d4172,_0x3f8bda){if(_0x4d4172){_0x2227a9=_0x3f8bda;if(!_0x3f8bda){var _0x33d217={'from':(_0x23ef81[_0x6180('0x90')]['firstName']||'')+'\x20'+(_0x23ef81[_0x6180('0x90')]['lastName']||'')};if(_0x1abb72[_0x6180('0x47')][_0x6180('0x9f')]&&_0x1abb72[_0x6180('0x47')][_0x6180('0xa3')]&&_0x1abb72[_0x6180('0x47')][_0x6180('0x9f')]!=_0x1abb72[_0x6180('0x47')][_0x6180('0xa3')]){_0x33d217[_0x6180('0x9f')]=_0x1abb72[_0x6180('0x47')][_0x6180('0xa3')];}return _0x4d4172[_0x6180('0x51')](_0x33d217);}else{return _0x4d4172;}}})[_0x6180('0x14')](function(_0x185e75){_0x23ef81['interaction']=_0x185e75['get']({'plain':!![]});_0x23ef81['interaction'][_0x6180('0xa4')]=_0x2227a9;if(_0x23ef81['interaction'][_0x6180('0xa4')]){if(_0x23ef81[_0x6180('0x8d')][_0x6180('0xa5')]){_0x23ef81[_0x6180('0x8e')][_0x6180('0xa6')]({'id':0x0,'priority':_0x23ef81[_0x6180('0x8e')][_0x6180('0x45')]+0x1,'app':_0x6180('0xa7'),'appdata':_0x6180('0xa8'),'interval':_0x6180('0xa9')});}}return db['ChatMessage'][_0x6180('0x46')]({'body':_0x1abb72[_0x6180('0x47')]['body'],'ChatWebsiteId':_0x1abb72[_0x6180('0x52')]['id'],'ChatInteractionId':_0x185e75['id'],'direction':'in','ContactId':_0x23ef81[_0x6180('0x90')]['id'],'AttachmentId':_0x1abb72[_0x6180('0x47')][_0x6180('0xaa')]});})[_0x6180('0x14')](function(_0x1b79d2){_0x23ef81[_0x6180('0x1b')]=_0x1b79d2;if(_0x23ef81['interaction'][_0x6180('0xab')]){return db[_0x6180('0xac')][_0x6180('0x4d')]({'attributes':['id',_0x6180('0x28')],'where':{'id':_0x23ef81['interaction'][_0x6180('0xab')]}})['then'](function(_0x3f26f4){if(_0x3f26f4){_0x23ef81[_0x6180('0x8e')][_0x6180('0xad')]({'id':0x0,'priority':0x0,'app':_0x6180('0xae'),'appdata':_0x3f26f4[_0x6180('0x28')]+','+(_0x23ef81[_0x6180('0x8d')]['waitForTheAssignedAgent']||0xa),'interval':_0x6180('0xa9')});_0x23ef81['forcedOwnership']=!![];}return respondWithRpcPromise('Start',_0x6180('0xaf'),_0x23ef81);});}return respondWithRpcPromise(_0x6180('0xb0'),'startRouting',_0x23ef81);})[_0x6180('0x14')](function(_0x17470e){respondWithRpcPromise(_0x6180('0xb1'),_0x6180('0xb1'),{'event':'notify','message':_0x17470e},client9002);return _0x17470e;})['then'](respondWithResult(_0x1027c3,null))['catch'](handleError(_0x1027c3,null));};exports['offline']=function(_0x723b52,_0x2db59f){var _0x2e38bf,_0x4f62d,_0x4484f4;var _0xc84533=[];var _0x6a406c={};var _0x4fc8a6=_0x723b52[_0x6180('0xb2')]||[];var _0x144c84=[];var _0x1602f4;return db[_0x6180('0x7b')][_0x6180('0x53')]()[_0x6180('0x14')](function(_0x317ce2){if(!_0x317ce2){throw new db[(_0x6180('0x85'))][(_0x6180('0x84'))]('no\x20available\x20attributes');}_0xc84533=_['difference'](_['keys'](_0x317ce2),[_0x6180('0x7e'),_0x6180('0x7f'),_0x6180('0x80'),'ListId']);if(_0x723b52[_0x6180('0x47')]['id']){delete _0x723b52[_0x6180('0x47')]['id'];}if(_[_0x6180('0x69')](_0x723b52[_0x6180('0x47')]['from'])){throw _0x2db59f[_0x6180('0x1e')](0x1f4)[_0x6180('0x29')](new db['Sequelize'][(_0x6180('0x84'))]('from\x20is\x20mandatory'));}if(_[_0x6180('0x69')](_0x723b52[_0x6180('0x47')][_0x6180('0x47')])||_0x723b52[_0x6180('0x47')][_0x6180('0x47')]===''){throw _0x2db59f[_0x6180('0x1e')](0x1f4)[_0x6180('0x29')](new db['Sequelize'][(_0x6180('0x84'))](_0x6180('0xb3')));}if(_['isNil'](_0x723b52[_0x6180('0x47')][_0x6180('0xb4')])){throw _0x2db59f[_0x6180('0x1e')](0x1f4)[_0x6180('0x29')](new db['Sequelize']['ValidationError'](_0x6180('0xb5')+_0xc84533));}if(!_['includes'](_0xc84533,_0x723b52[_0x6180('0x47')]['mapKeyOffline'])){throw _0x2db59f[_0x6180('0x1e')](0x1f4)[_0x6180('0x29')](new db[(_0x6180('0x85'))][(_0x6180('0x84'))](_0x6180('0xb6')+_0xc84533));}_0x6a406c[_0x723b52[_0x6180('0x47')][_0x6180('0xb4')]]=_0x723b52[_0x6180('0x47')]['from'];})[_0x6180('0x14')](function(){return db[_0x6180('0x2c')]['find']({'where':{'id':_0x723b52['params']['id']},'include':[{'model':db[_0x6180('0x89')],'as':_0x6180('0x8a')},{'model':db[_0x6180('0xb7')],'as':'MailAccount'}]});})[_0x6180('0x14')](handleEntityNotFound(_0x2db59f,null))['then'](function(_0x3ee7d2){if(_0x3ee7d2&&_0x3ee7d2[_0x6180('0x8a')]){_0x4f62d=_0x3ee7d2;var _0x3b8fa6=_[_0x6180('0xa')](_0x723b52[_0x6180('0x47')],{'firstName':_0x723b52[_0x6180('0x47')][_0x6180('0x82')],'phone':_0x723b52[_0x6180('0x47')][_0x6180('0x82')],'ListId':_0x3ee7d2[_0x6180('0x81')]});_0x3b8fa6[_0x723b52[_0x6180('0x47')][_0x6180('0xb4')]]=_0x723b52[_0x6180('0x47')][_0x6180('0x82')];return db['CmContact'][_0x6180('0xb8')]({'where':_0x6a406c,'defaults':_0x3b8fa6});}})[_0x6180('0xb9')](function(_0x3f80c3){if(_0x3f80c3){_0x4484f4=_0x3f80c3;var _0x5893a6=fs[_0x6180('0xba')](path[_0x6180('0x64')](config[_0x6180('0x6b')],_0x6180('0xbb')),_0x6180('0xbc'));var _0x57bbaa=ejs[_0x6180('0xbd')](_0x5893a6,{'body':_['toPairs'](_0x723b52[_0x6180('0x47')][_0x6180('0x47')]),'bodyTitle':_0x4f62d['offlineMessageBody']});return db[_0x6180('0xbe')][_0x6180('0x46')]({'body':_0x57bbaa,'plainBody':htmlToText[_0x6180('0xbf')](_0x57bbaa),'ContactId':_0x3f80c3['id'],'ChatWebsiteId':_0x4f62d['id']});}})[_0x6180('0x14')](function(_0x216358){_0x1602f4=_0x216358;if(_0x4fc8a6[_0x6180('0x45')]){var _0x52abf3=_0x4fc8a6[_0x6180('0x2b')](function(_0x830e54){return{'name':_0x830e54[_0x6180('0xc0')],'basename':_0x830e54[_0x6180('0x62')],'type':_0x830e54['mimetype'],'ChatOfflineMessageId':_0x216358['id']};});_0x144c84=_0x52abf3[_0x6180('0x2b')](_0x1f87fb=>{var _0x2652cc={'filename':_0x1f87fb[_0x6180('0x28')],'path':path[_0x6180('0x64')](config[_0x6180('0x6b')],_0x6180('0xc1'),_0x6180('0xb2'),_0x6180('0xc2'),'offline-chat',_0x1f87fb['basename'])};return _0x2652cc;});if(!_0x4f62d[_0x6180('0xc3')]){return db[_0x6180('0xc4')]['transaction'](function(_0x4266bc){return db['Attachment']['bulkCreate'](_0x52abf3,{'transaction':_0x4266bc});});}}})[_0x6180('0x14')](function(){if(_0x1602f4){_0x2e38bf=_0x1602f4;return db['MailAccount'][_0x6180('0x5c')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0x6180('0xc5'),'raw':!![],'include':[{'model':db[_0x6180('0xc6')],'as':_0x6180('0xc6'),'raw':!![]}]}]});}})[_0x6180('0x14')](function(_0x400c4c){if(_0x400c4c&&_0x400c4c[_0x6180('0xc5')]&&_0x4f62d[_0x6180('0xc7')]&&_0x4f62d[_0x6180('0xc8')]){var _0x20f229=_0x400c4c[_0x6180('0xc9')]();return respondWithRpcPromise('SendMail',_0x6180('0xca'),{'account':_0x20f229,'message':{'from':util[_0x6180('0x99')](_0x6180('0xcb'),_0x400c4c[_0x6180('0x28')],_0x400c4c[_0x6180('0xcc')]||_0x400c4c[_0x6180('0xc5')]['user']),'to':_0x4f62d[_0x6180('0xc8')],'subject':_0x4f62d[_0x6180('0xcd')],'html':_0x2e38bf[_0x6180('0x47')],'attachments':_0x144c84}},client9003)[_0x6180('0x14')](function(){return _0x2e38bf;})[_0x6180('0x1c')](function(_0x423582){logger[_0x6180('0x19')](_0x423582);});}})['then'](function(){if(_0x4f62d&&_0x4f62d[_0x6180('0xc3')]&&_0x4f62d['MailAccountId']){var _0x4e26a8=[];if(_0x4fc8a6[_0x6180('0x45')]){_0x4e26a8=_0x4fc8a6[_0x6180('0x2b')](function(_0x3b3451){return{'name':_0x3b3451[_0x6180('0xc0')],'basename':_0x3b3451[_0x6180('0x62')],'type':_0x3b3451[_0x6180('0xce')],'ChatOfflineMessageId':_0x1602f4['id']};});}var _0x4694bb;if(!_['isNil'](_0x4f62d[_0x6180('0xcf')])){var _0x259295=_[_0x6180('0x2b')](_0x723b52['body'],function(_0x254e98){return _0x254e98;});var _0x11dbc8=_['toPairsIn'](_0x259295)[0x0];var _0x43855f=_[_0x6180('0xd0')](_0x11dbc8,function(_0x533064){return _0x533064;});_0x4694bb=_0x43855f[0x1][_0x4f62d[_0x6180('0xcf')]];}var _0x4f4b1d={'from':_0x4484f4['email'],'firstName':_0x4484f4[_0x6180('0x94')],'lastName':_0x4484f4[_0x6180('0x95')],'mapKey':_0x6180('0xcc'),'message':{'from':_0x4484f4[_0x6180('0xcc')],'to':_0x4f62d[_0x6180('0xb7')][_0x6180('0xcc')],'cc':'','subject':_['isNil'](_0x4694bb)?_0x4f62d[_0x6180('0xcd')]:_0x4694bb,'messageId':'','sentAt':new Date(),'attach':_0x4e26a8[_0x6180('0x45')],'attachments':_0x4e26a8,'originChannel':_0x6180('0xd1'),'ChatWebsiteId':_0x4f62d['id'],'ChatOfflineMessageId':_0x2e38bf['id'],'originTo':_0x4f62d['MailAccount'][_0x6180('0xcc')]},'body':_0x2e38bf['body']};var _0x1ce91d={'account':{'id':_0x4f62d[_0x6180('0xd2')]},'body':_0x4f4b1d,'log':_0x6180('0xd3')};return respondWithRpcPromise(_0x6180('0xd3'),_0x6180('0xd4'),_0x1ce91d,client9001)[_0x6180('0x14')](function(){return _0x2e38bf;})[_0x6180('0x1c')](function(_0x341268){logger[_0x6180('0x19')](_0x341268);});}return;})[_0x6180('0x14')](function(){if(_0x2e38bf){return _0x2e38bf;}})['then'](respondWithResult(_0x2db59f,null))[_0x6180('0x1c')](function(_0x331353){logger[_0x6180('0x19')](_0x6180('0x1c'),_0x331353);for(var _0x1a7db8 of _0x4fc8a6){var _0x39d9b6=path['join'](config[_0x6180('0x6b')],_0x6180('0xc1'),_0x6180('0xb2'),_0x6180('0xc2'),_0x6180('0xd5'),_0x1a7db8[_0x6180('0x62')]);fs_extra[_0x6180('0xd6')](_0x39d9b6)['catch'](function(_0xa6a703){logger[_0x6180('0x19')](_0x6180('0xd7'),_0x39d9b6,_0xa6a703);});}});};exports['addInteraction']=function(_0xe65422,_0x90cc71){return db[_0x6180('0xa1')][_0x6180('0x4d')]({'where':{'id':_0xe65422[_0x6180('0x52')]['id']}})[_0x6180('0x14')](handleEntityNotFound(_0x90cc71,null))[_0x6180('0x14')](function(_0x4da34e){if(_0x4da34e){return _0x4da34e[_0x6180('0xd8')](_0xe65422['body']['ids'],_[_0x6180('0xd9')](_0xe65422[_0x6180('0x47')],[_0x6180('0x5a'),'id'])||{});}})[_0x6180('0x14')](respondWithResult(_0x90cc71,null))['catch'](handleError(_0x90cc71,null));};exports[_0x6180('0xda')]=function(_0x45f903,_0x580703){var _0xb65a00={'raw':![],'where':{}};var _0xb8b698={};var _0x4848be={'count':0x0,'rows':[]};return db[_0x6180('0x2c')]['findOne']({'where':{'id':_0x45f903[_0x6180('0x52')]['id']}})[_0x6180('0x14')](handleEntityNotFound(_0x580703,null))[_0x6180('0x14')](function(_0x27ad86){if(_0x27ad86){_0xb8b698[_0x6180('0x30')]=_[_0x6180('0x32')](db[_0x6180('0xa1')]['rawAttributes']);_0xb8b698[_0x6180('0x31')]=_['keys'](_0x45f903[_0x6180('0x31')]);_0xb8b698['filters']=_[_0x6180('0x34')](_0xb8b698[_0x6180('0x30')],_0xb8b698[_0x6180('0x31')]);_0xb65a00['attributes']=_[_0x6180('0x34')](_0xb8b698[_0x6180('0x30')],qs['fields'](_0x45f903[_0x6180('0x31')][_0x6180('0x36')]));_0xb65a00[_0x6180('0x35')]=_0xb65a00[_0x6180('0x35')][_0x6180('0x45')]?_0xb65a00['attributes']:_0xb8b698[_0x6180('0x30')];if(!_0x45f903['query'][_0x6180('0x58')]('nolimit')){_0xb65a00[_0x6180('0x21')]=qs[_0x6180('0x21')](_0x45f903[_0x6180('0x31')][_0x6180('0x21')]);_0xb65a00[_0x6180('0x23')]=qs[_0x6180('0x23')](_0x45f903[_0x6180('0x31')][_0x6180('0x23')]);}_0xb65a00['order']=qs['sort'](_0x45f903[_0x6180('0x31')][_0x6180('0x39')]);_0xb65a00[_0x6180('0x3c')]=qs[_0x6180('0x33')](_[_0x6180('0x3a')](_0x45f903[_0x6180('0x31')],_0xb8b698['filters']));_0xb65a00['where']['ChatWebsiteId']=_0x27ad86['id'];if(_0x45f903[_0x6180('0x31')][_0x6180('0x3b')]){_0xb65a00['where']=_[_0x6180('0x3d')](_0xb65a00[_0x6180('0x3c')],{'$or':_[_0x6180('0x2b')](_0xb65a00[_0x6180('0x35')],function(_0x1e14fc){var _0x15959c={};_0x15959c[_0x1e14fc]={'$like':'%'+_0x45f903[_0x6180('0x31')][_0x6180('0x3b')]+'%'};return _0x15959c;})});}_0xb65a00=_[_0x6180('0x3d')]({},_0xb65a00,_0x45f903[_0x6180('0x3f')]);return db[_0x6180('0xa1')][_0x6180('0x22')]({'where':_0xb65a00['where']})[_0x6180('0x14')](function(_0x105028){_0x4848be[_0x6180('0x22')]=_0x105028;if(_0x45f903[_0x6180('0x31')][_0x6180('0x40')]){_0xb65a00[_0x6180('0x41')]=[{'model':db['CmContact'],'as':_0x6180('0xdb'),'required':![]},{'model':db['User'],'as':_0x6180('0xdc'),'attributes':['name',_0x6180('0xdd'),_0x6180('0xde')],'required':![]},{'model':db[_0x6180('0xdf')],'as':'Tags','attributes':['id',_0x6180('0x28'),_0x6180('0xe0')],'where':_0x45f903[_0x6180('0x31')]['tag']?{'id':_0x45f903[_0x6180('0x31')][_0x6180('0xe1')]}:undefined,'required':_0x45f903[_0x6180('0x31')][_0x6180('0xe1')]?!![]:![]}];}return db['ChatInteraction'][_0x6180('0x5d')](_0xb65a00);})[_0x6180('0x14')](function(_0x34f1e9){_0x4848be[_0x6180('0x42')]=_0x34f1e9;return _0x4848be;});}})[_0x6180('0x14')](respondWithFilteredResult(_0x580703,_0xb65a00))[_0x6180('0x1c')](handleError(_0x580703,null));};function iftimePromise(_0x4cfccd,_0x2642a0){return respondWithRpcPromise('Command',_0x6180('0xe2'),{'command':_0x2642a0['timezone']?util[_0x6180('0x99')](_0x6180('0xe3'),_0x4cfccd[_0x6180('0xe4')],_0x2642a0[_0x6180('0xe5')]):util['format'](_0x6180('0xe6'),_0x4cfccd[_0x6180('0xe4')])},client9002)[_0x6180('0x14')](function(_0xae9c47){var _0x4f59e2=_0xae9c47&&_0xae9c47[_0x6180('0xe7')](_0x6180('0xe8'))>=0x0?!![]:![];logger[_0x6180('0x15')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x2642a0['id'],_0x4cfccd['id'],_0x4cfccd['interval'],_0x4f59e2?_0x6180('0xe9'):'OFFLINE',_0x2642a0[_0x6180('0xe5')]?_0x2642a0[_0x6180('0xe5')]:_0x6180('0xea'));return _0x4f59e2;})['catch'](function(_0x19c83b){logger[_0x6180('0x19')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x2642a0['id'],_0x4cfccd['id'],_0x4cfccd[_0x6180('0xe4')],util[_0x6180('0xeb')](_0x19c83b,{'showHidden':![],'depth':null}),_0x2642a0[_0x6180('0xe5')]?_0x2642a0[_0x6180('0xe5')]:'No\x20timezone');return![];});}exports[_0x6180('0xe2')]=function(_0x506233,_0x3b67c2){var _0x1ac3cb=0x0;var _0x225577=0x0;var _0x276253=![];var _0x5572ce;var _0x1ecf51;return db['ChatWebsite'][_0x6180('0x4d')]({'where':{'id':_0x506233[_0x6180('0x52')]['id']},'include':[{'model':db[_0x6180('0xec')],'as':'Interval','include':[{'model':db[_0x6180('0xec')],'as':_0x6180('0xed'),'attributes':['id','interval'],'raw':!![]}]}]})[_0x6180('0x14')](handleEntityNotFound(_0x3b67c2,null))['then'](function(_0x3ffc79){if(_0x3ffc79){_0x5572ce=_0x3ffc79;return _0x3ffc79[_0x6180('0xee')]({'raw':!![]});}})['then'](function(_0x34ecb1){if(_0x5572ce){if(_0x34ecb1){_0x1ecf51=_0x34ecb1;}}return require(_0x6180('0x66'))[_0x6180('0x67')]();})[_0x6180('0x14')](function(_0x4a7fb3){if(_0x4a7fb3){_0x225577=_0x4a7fb3['virtual'];_0x276253=_0x4a7fb3[_0x6180('0x68')];}})['then'](function(){return db[_0x6180('0xa1')]['count']({'where':{'closed':![]}});})['then'](function(_0x331ed){_0x1ac3cb=_0x331ed;if(_0x225577&&_0x331ed>_0x225577){return db[_0x6180('0xef')][_0x6180('0x5c')]({'where':{'id':0x1}})[_0x6180('0x14')](function(_0x4d7f6a){if(_0x4d7f6a){_0x4d7f6a[_0x6180('0xf0')](_0x6180('0xf1'));}});}})[_0x6180('0x14')](function(){if(_0x5572ce[_0x6180('0xec')]&&_0x5572ce['Interval'][_0x6180('0xed')]){var _0x401235=[];for(var _0x40e7ea=0x0;_0x40e7ea<_0x5572ce[_0x6180('0xec')][_0x6180('0xed')][_0x6180('0x45')];_0x40e7ea++){var _0x32c03c=_0x5572ce[_0x6180('0xec')][_0x6180('0xed')][_0x40e7ea][_0x6180('0x49')]({'plain':!![]});_0x401235['push'](iftimePromise(_0x32c03c,_0x5572ce));}return BPromise[_0x6180('0xf2')](_0x401235)[_0x6180('0x14')](function(_0x5bea57){return _[_0x6180('0xf3')](_0x5bea57);});}else{return!![];}})[_0x6180('0x14')](function(_0x422af6){var _0x1dd1d5=fs['readFileSync'](path[_0x6180('0x64')](config[_0x6180('0x6b')],_0x6180('0xf4')),_0x6180('0xbc'));var _0x176e26={'remote':_0x5572ce[_0x6180('0xf5')],'query':querystring[_0x6180('0x18')](_[_0x6180('0x3d')](_0x5572ce[_0x6180('0x49')]({'plain':!![]}),{'customerIp':_0x506233[_0x6180('0x79')][_0x6180('0xf6')]||_0x506233[_0x6180('0x79')]['x-real-ip']||_0x506233['connection']['remoteAddress']||_0x506233['ip'],'referer':_0x506233[_0x6180('0x79')]['referer'],'openedInteractions':_0x1ac3cb,'maxInteractions':_0x225577,'virtual':_0x276253[_0x6180('0xf7')],'online':_0x422af6,'custom':_0x276253}))['replace'](/'/g,'\x5c\x27')};_0x3b67c2['send'](ejs[_0x6180('0xbd')](Mustache[_0x6180('0xbd')](_0x1dd1d5,_0x176e26),{'proactiveActions':_0x1ecf51,'alignment':_0x5572ce[_0x6180('0xf8')],'verticalAlignment':_0x5572ce[_0x6180('0xf9')],'div_color':_0x5572ce[_0x6180('0xe0')],'labelText':_0x5572ce[_0x6180('0xfa')],'text_color':_0x5572ce['textColor'],'text_button_color':_0x5572ce['textButtonColor'],'button_color':_0x5572ce['color_button'],'background_color':_0x5572ce[_0x6180('0xfb')],'hideWhenOffline':_0x5572ce['hideWhenOffline'],'interval':_0x5572ce['IntervalId']}));})[_0x6180('0x1c')](handleError(_0x3b67c2,null));};exports[_0x6180('0xfc')]=function(_0x5d0df5,_0xc865a8){var _0x3f7e19=_0x5d0df5[_0x6180('0x52')]['id'];var _0xc2a58a=_0x5d0df5[_0x6180('0x47')];var _0x32199f=0xc8;var _0x9f3650=null;return db['sequelize'][_0x6180('0xfd')]({'isolationLevel':db[_0x6180('0xc4')][_0x6180('0xfe')][_0x6180('0xff')][_0x6180('0x100')]},function(_0x28b0ba){return db[_0x6180('0x2c')][_0x6180('0x5c')]({'where':{'id':_0x3f7e19},'transaction':_0x28b0ba})[_0x6180('0x14')](function(_0x3e7724){if(_0x3e7724){return db[_0x6180('0x101')]['destroy']({'where':{'ChatWebsiteId':_0x3f7e19},'transaction':_0x28b0ba})['then'](function(){var _0x53f8c3=_['map'](_0xc2a58a,function(_0x41e907){_0x41e907[_0x6180('0x55')]=_0x3f7e19;return _0x41e907;});return db[_0x6180('0x101')]['bulkCreate'](_0x53f8c3,{'transaction':_0x28b0ba});});}else{_0x32199f=0x194;_0x9f3650=[];}});})[_0x6180('0x14')](function(){if(_0x32199f!==0x194){return db[_0x6180('0x101')][_0x6180('0x102')]({'where':{'ChatWebsiteId':_0x3f7e19},'order':'priority'})[_0x6180('0x14')](function(_0x7ac0f3){_0x9f3650=_0x7ac0f3;});}})['catch'](function(_0x49ce0a){_0x32199f=0x1f4;logger[_0x6180('0x19')](_0x49ce0a[_0x6180('0x27')]);if(_0x49ce0a[_0x6180('0x28')]){delete _0x49ce0a[_0x6180('0x28')];}_0x9f3650=_0x49ce0a;})[_0x6180('0x103')](function(){if(_0x9f3650===null){_0xc865a8['sendStatus'](_0x32199f);}else{if(_0x32199f===0x1f4){_0xc865a8['status'](_0x32199f)[_0x6180('0x29')](_0x9f3650);}else{_0xc865a8[_0x6180('0x1e')](_0x32199f)[_0x6180('0x1f')](_0x9f3650);}}});};exports['getApplications']=function(_0x319e2c,_0x1f6d51){var _0x5d7c9a={};var _0x132bcf={};var _0x28444e;var _0x554633;return db[_0x6180('0x2c')][_0x6180('0x5c')]({'where':{'id':_0x319e2c[_0x6180('0x52')]['id']}})[_0x6180('0x14')](handleEntityNotFound(_0x1f6d51,null))[_0x6180('0x14')](function(_0x9fca9a){if(_0x9fca9a){_0x28444e=_0x9fca9a;_0x132bcf[_0x6180('0x30')]=_[_0x6180('0x32')](db[_0x6180('0x101')][_0x6180('0x44')]);_0x132bcf[_0x6180('0x31')]=_[_0x6180('0x32')](_0x319e2c['query']);_0x132bcf[_0x6180('0x33')]=_['intersection'](_0x132bcf[_0x6180('0x30')],_0x132bcf[_0x6180('0x31')]);_0x5d7c9a['attributes']=_['intersection'](_0x132bcf[_0x6180('0x30')],qs[_0x6180('0x36')](_0x319e2c['query'][_0x6180('0x36')]));_0x5d7c9a[_0x6180('0x35')]=_0x5d7c9a['attributes'][_0x6180('0x45')]?_0x5d7c9a['attributes']:_0x132bcf['model'];_0x5d7c9a[_0x6180('0x38')]=qs['sort'](_0x319e2c[_0x6180('0x31')][_0x6180('0x39')]);_0x5d7c9a['where']=qs['filters'](_[_0x6180('0x3a')](_0x319e2c[_0x6180('0x31')],_0x132bcf['filters']));if(_0x319e2c['query'][_0x6180('0x3b')]){_0x5d7c9a[_0x6180('0x3c')]=_[_0x6180('0x3d')](_0x5d7c9a[_0x6180('0x3c')],{'$or':_[_0x6180('0x2b')](_0x5d7c9a[_0x6180('0x35')],function(_0x53796e){var _0x1328ca={};_0x1328ca[_0x53796e]={'$like':'%'+_0x319e2c[_0x6180('0x31')][_0x6180('0x3b')]+'%'};return _0x1328ca;})});}_0x5d7c9a=_['merge']({},_0x5d7c9a,_0x319e2c[_0x6180('0x3f')]);return _0x28444e[_0x6180('0x104')](_0x5d7c9a);}})[_0x6180('0x14')](function(_0x10465b){if(_0x10465b){_0x554633=_0x10465b[_0x6180('0x45')];if(!_0x319e2c[_0x6180('0x31')][_0x6180('0x58')](_0x6180('0x37'))){_0x5d7c9a[_0x6180('0x21')]=qs['limit'](_0x319e2c[_0x6180('0x31')][_0x6180('0x21')]);_0x5d7c9a[_0x6180('0x23')]=qs[_0x6180('0x23')](_0x319e2c['query'][_0x6180('0x23')]);}return _0x28444e[_0x6180('0x104')](_0x5d7c9a);}})[_0x6180('0x14')](function(_0x27a473){if(_0x27a473){return _0x27a473?{'count':_0x554633,'rows':_0x27a473}:null;}})[_0x6180('0x14')](respondWithResult(_0x1f6d51,null))[_0x6180('0x1c')](handleError(_0x1f6d51,null));};exports[_0x6180('0x105')]=function(_0xd070a6,_0x2c6247){return db[_0x6180('0x106')][_0x6180('0x4d')]({'where':{'id':_0xd070a6[_0x6180('0x52')]['id']}})[_0x6180('0x14')](handleEntityNotFound(_0x2c6247,null))[_0x6180('0x14')](function(_0x32de76){if(_0x32de76){return _0x32de76[_0x6180('0x105')](_0xd070a6[_0x6180('0x47')]['ids'],_[_0x6180('0xd9')](_0xd070a6[_0x6180('0x47')],['ids','id'])||{});}})[_0x6180('0x14')](respondWithResult(_0x2c6247,null))[_0x6180('0x1c')](handleError(_0x2c6247,null));};exports['getProactiveActions']=function(_0x1fe38c,_0x2f4de3){var _0x138bb1={};var _0x67f245={};var _0x55fc7d;var _0x4e4c5c;return db[_0x6180('0x2c')]['findOne']({'where':{'id':_0x1fe38c[_0x6180('0x52')]['id']}})[_0x6180('0x14')](handleEntityNotFound(_0x2f4de3,null))[_0x6180('0x14')](function(_0xa18bdc){if(_0xa18bdc){_0x55fc7d=_0xa18bdc;_0x67f245[_0x6180('0x30')]=_[_0x6180('0x32')](db[_0x6180('0x107')][_0x6180('0x44')]);_0x67f245[_0x6180('0x31')]=_[_0x6180('0x32')](_0x1fe38c[_0x6180('0x31')]);_0x67f245[_0x6180('0x33')]=_[_0x6180('0x34')](_0x67f245[_0x6180('0x30')],_0x67f245[_0x6180('0x31')]);_0x138bb1[_0x6180('0x35')]=_[_0x6180('0x34')](_0x67f245[_0x6180('0x30')],qs[_0x6180('0x36')](_0x1fe38c['query'][_0x6180('0x36')]));_0x138bb1[_0x6180('0x35')]=_0x138bb1['attributes'][_0x6180('0x45')]?_0x138bb1['attributes']:_0x67f245[_0x6180('0x30')];_0x138bb1['order']=qs[_0x6180('0x39')](_0x1fe38c[_0x6180('0x31')][_0x6180('0x39')]);_0x138bb1[_0x6180('0x3c')]=qs[_0x6180('0x33')](_[_0x6180('0x3a')](_0x1fe38c[_0x6180('0x31')],_0x67f245[_0x6180('0x33')]));if(_0x1fe38c[_0x6180('0x31')][_0x6180('0x3b')]){_0x138bb1['where']=_['merge'](_0x138bb1[_0x6180('0x3c')],{'$or':_[_0x6180('0x2b')](_0x138bb1[_0x6180('0x35')],function(_0x9778a4){var _0x1f71c3={};_0x1f71c3[_0x9778a4]={'$like':'%'+_0x1fe38c[_0x6180('0x31')][_0x6180('0x3b')]+'%'};return _0x1f71c3;})});}_0x138bb1=_['merge']({},_0x138bb1,_0x1fe38c[_0x6180('0x3f')]);return _0x55fc7d['getProactiveActions'](_0x138bb1);}})['then'](function(_0x53ac08){if(_0x53ac08){_0x4e4c5c=_0x53ac08['length'];if(!_0x1fe38c[_0x6180('0x31')][_0x6180('0x58')]('nolimit')){_0x138bb1[_0x6180('0x21')]=qs['limit'](_0x1fe38c[_0x6180('0x31')][_0x6180('0x21')]);_0x138bb1[_0x6180('0x23')]=qs[_0x6180('0x23')](_0x1fe38c[_0x6180('0x31')][_0x6180('0x23')]);}return _0x55fc7d['getProactiveActions'](_0x138bb1);}})[_0x6180('0x14')](function(_0x398ae5){if(_0x398ae5){return _0x398ae5?{'count':_0x4e4c5c,'rows':_0x398ae5}:null;}})[_0x6180('0x14')](respondWithResult(_0x2f4de3,null))[_0x6180('0x1c')](handleError(_0x2f4de3,null));};exports[_0x6180('0x108')]=function(_0x2042ca,_0x499461){var _0x5f1044=_0x2042ca['query'][_0x6180('0x109')]===_0x6180('0x10a')?_0x6180('0x10b'):'onlineForm';return db[_0x6180('0x2c')]['find']({'attributes':['id',_0x5f1044],'where':{'id':_0x2042ca['params']['id']}})['then'](handleEntityNotFound(_0x499461,null))[_0x6180('0x14')](function(_0x1241f2){if(_0x1241f2){var _0xd7e651=_0x1241f2[_0x5f1044];var _0x116e3f=_0xd7e651&&_0xd7e651[_0x6180('0x10c')]?_0xd7e651[_0x6180('0x10c')]:[];_0x499461[_0x6180('0x29')]({'fromKey':_[_0x6180('0x69')](_0xd7e651[_0x6180('0x10d')])?undefined:_0xd7e651['fromKey'],'count':_0x116e3f[_0x6180('0x45')],'rows':_0x116e3f});}})[_0x6180('0x1c')](handleError(_0x499461,null));};exports['getOfflineMessages']=function(_0x535fe8,_0x54fc42){var _0x25d24b={'raw':![],'where':{}};var _0x53f67e={};var _0x227bb0={'count':0x0,'rows':[]};return db[_0x6180('0x2c')][_0x6180('0x5c')]({'where':{'id':_0x535fe8[_0x6180('0x52')]['id']}})[_0x6180('0x14')](handleEntityNotFound(_0x54fc42,null))['then'](function(_0x3771dc){if(_0x3771dc){_0x53f67e['model']=_[_0x6180('0x32')](db[_0x6180('0xbe')][_0x6180('0x44')]);_0x53f67e[_0x6180('0x31')]=_[_0x6180('0x32')](_0x535fe8['query']);_0x53f67e[_0x6180('0x33')]=_[_0x6180('0x34')](_0x53f67e['model'],_0x53f67e['query']);_0x25d24b['attributes']=_[_0x6180('0x34')](_0x53f67e[_0x6180('0x30')],qs[_0x6180('0x36')](_0x535fe8[_0x6180('0x31')][_0x6180('0x36')]));_0x25d24b[_0x6180('0x35')]=_0x25d24b['attributes']['length']?_0x25d24b[_0x6180('0x35')]:_0x53f67e[_0x6180('0x30')];if(!_0x535fe8[_0x6180('0x31')][_0x6180('0x58')](_0x6180('0x37'))){_0x25d24b['limit']=qs[_0x6180('0x21')](_0x535fe8['query']['limit']);_0x25d24b['offset']=qs[_0x6180('0x23')](_0x535fe8['query'][_0x6180('0x23')]);}_0x25d24b[_0x6180('0x38')]=qs[_0x6180('0x39')](_0x535fe8['query'][_0x6180('0x39')]);_0x25d24b[_0x6180('0x3c')]=qs[_0x6180('0x33')](_['pick'](_0x535fe8['query'],_0x53f67e[_0x6180('0x33')]));_0x25d24b['where']['ChatWebsiteId']=_0x3771dc['id'];if(_0x535fe8[_0x6180('0x31')][_0x6180('0x3b')]){_0x25d24b['where']=_[_0x6180('0x3d')](_0x25d24b[_0x6180('0x3c')],{'$or':_[_0x6180('0x2b')](_0x25d24b[_0x6180('0x35')],function(_0x15bbab){var _0x2833ee={};_0x2833ee[_0x15bbab]={'$like':'%'+_0x535fe8[_0x6180('0x31')][_0x6180('0x3b')]+'%'};return _0x2833ee;})});}_0x25d24b=_[_0x6180('0x3d')]({},_0x25d24b,_0x535fe8['options']);return db[_0x6180('0xbe')][_0x6180('0x22')]({'where':_0x25d24b['where']})[_0x6180('0x14')](function(_0x138a51){_0x227bb0['count']=_0x138a51;if(_0x535fe8[_0x6180('0x31')][_0x6180('0x40')]){_0x25d24b[_0x6180('0x41')]=[{'all':!![]}];}else{_0x25d24b['include']=[{'model':db[_0x6180('0x7b')],'as':_0x6180('0xdb'),'required':![]},{'model':db[_0x6180('0x10e')],'as':'Attachments','required':![]}];}return db[_0x6180('0xbe')][_0x6180('0x5d')](_0x25d24b);})[_0x6180('0x14')](function(_0x102b54){_0x227bb0['rows']=_0x102b54;return _0x227bb0;});}})['then'](respondWithFilteredResult(_0x54fc42,_0x25d24b))['catch'](handleError(_0x54fc42,null));};exports[_0x6180('0x10f')]=function(_0x502612,_0x36d498){return db[_0x6180('0x2c')]['find']({'where':{'id':_0x502612[_0x6180('0x52')]['id']}})['then'](handleEntityNotFound(_0x36d498,null))[_0x6180('0x14')](function(_0x35e620){if(_0x35e620){return _0x35e620[_0x6180('0x10f')](_0x502612[_0x6180('0x47')][_0x6180('0x5a')],_[_0x6180('0xd9')](_0x502612[_0x6180('0x47')],[_0x6180('0x5a'),'id'])||{})[_0x6180('0xb9')](function(_0x468c81){for(var _0x283014=0x0;_0x283014<_0x502612[_0x6180('0x47')][_0x6180('0x5a')][_0x6180('0x45')];_0x283014+=0x1){socket[_0x6180('0x110')](_0x6180('0x111'),{'UserId':Number(_0x502612[_0x6180('0x47')][_0x6180('0x5a')][_0x283014]),'ChatWebsiteId':Number(_0x502612[_0x6180('0x52')]['id'])});}return _0x468c81;});}})[_0x6180('0x14')](respondWithResult(_0x36d498,null))[_0x6180('0x1c')](handleError(_0x36d498,null));};exports[_0x6180('0x112')]=function(_0xa11ad3,_0x4d2573){return db['ChatWebsite'][_0x6180('0x4d')]({'where':{'id':_0xa11ad3[_0x6180('0x52')]['id']}})[_0x6180('0x14')](handleEntityNotFound(_0x4d2573,null))['then'](function(_0x1eb867){if(_0x1eb867){return _0x1eb867[_0x6180('0x112')](_0xa11ad3['query']['ids'])[_0x6180('0x14')](function(){if(_[_0x6180('0x113')](_0xa11ad3[_0x6180('0x31')][_0x6180('0x5a')])){for(var _0x7c0fb=0x0;_0x7c0fb<_0xa11ad3['query'][_0x6180('0x5a')]['length'];_0x7c0fb+=0x1){socket[_0x6180('0x110')]('userChatWebsite:remove',{'UserId':Number(_0xa11ad3[_0x6180('0x31')][_0x6180('0x5a')][_0x7c0fb]),'ChatWebsiteId':Number(_0xa11ad3[_0x6180('0x52')]['id'])});}}else{socket['emit'](_0x6180('0x114'),{'UserId':Number(_0xa11ad3['query'][_0x6180('0x5a')]),'ChatWebsiteId':Number(_0xa11ad3[_0x6180('0x52')]['id'])});}});}})[_0x6180('0x14')](respondWithStatusCode(_0x4d2573,null))['catch'](handleError(_0x4d2573,null));};exports[_0x6180('0x115')]=function(_0x49dd63,_0x2d84fb){var _0x215495={};var _0x5f2875={};var _0x3f6c0d;var _0x2629ee;return db[_0x6180('0x2c')][_0x6180('0x5c')]({'where':{'id':_0x49dd63[_0x6180('0x52')]['id']}})['then'](handleEntityNotFound(_0x2d84fb,null))[_0x6180('0x14')](function(_0x22d919){if(_0x22d919){_0x3f6c0d=_0x22d919;_0x5f2875[_0x6180('0x30')]=_[_0x6180('0x32')](db[_0x6180('0xac')][_0x6180('0x44')]);_0x5f2875['query']=_['keys'](_0x49dd63[_0x6180('0x31')]);_0x5f2875[_0x6180('0x33')]=_[_0x6180('0x34')](_0x5f2875[_0x6180('0x30')],_0x5f2875['query']);_0x215495[_0x6180('0x35')]=_['intersection'](_0x5f2875[_0x6180('0x30')],qs['fields'](_0x49dd63[_0x6180('0x31')][_0x6180('0x36')]));_0x215495[_0x6180('0x35')]=_0x215495[_0x6180('0x35')][_0x6180('0x45')]?_0x215495['attributes']:_0x5f2875[_0x6180('0x30')];_0x215495['order']=qs['sort'](_0x49dd63[_0x6180('0x31')][_0x6180('0x39')]);_0x215495[_0x6180('0x3c')]=qs['filters'](_[_0x6180('0x3a')](_0x49dd63[_0x6180('0x31')],_0x5f2875[_0x6180('0x33')]));if(_0x49dd63[_0x6180('0x31')][_0x6180('0x3b')]){_0x215495['where']=_[_0x6180('0x3d')](_0x215495[_0x6180('0x3c')],{'$or':_[_0x6180('0x2b')](_0x215495[_0x6180('0x35')],function(_0x258cef){var _0xe1291d={};_0xe1291d[_0x258cef]={'$like':'%'+_0x49dd63['query'][_0x6180('0x3b')]+'%'};return _0xe1291d;})});}_0x215495=_['merge']({},_0x215495,_0x49dd63[_0x6180('0x3f')]);return _0x3f6c0d[_0x6180('0x115')](_0x215495);}})[_0x6180('0x14')](function(_0x418a00){if(_0x418a00){_0x2629ee=_0x418a00[_0x6180('0x45')];if(!_0x49dd63[_0x6180('0x31')][_0x6180('0x58')]('nolimit')){_0x215495['limit']=qs[_0x6180('0x21')](_0x49dd63[_0x6180('0x31')][_0x6180('0x21')]);_0x215495[_0x6180('0x23')]=qs[_0x6180('0x23')](_0x49dd63['query'][_0x6180('0x23')]);}return _0x3f6c0d['getAgents'](_0x215495);}})[_0x6180('0x14')](function(_0x3988be){if(_0x3988be){return _0x3988be?{'count':_0x2629ee,'rows':_0x3988be}:null;}})[_0x6180('0x14')](respondWithResult(_0x2d84fb,null))[_0x6180('0x1c')](handleError(_0x2d84fb,null));}; \ No newline at end of file +var _0xcd27=['forwardOfflineAddress','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','subjectOffline','toPairsIn','mapValues','email','Chat','MailAccountId','NotifyMailAccount','notifyMail','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','fullname','Tags','color','tag','getSnippet','timezone','iftime\x20%s,%s','iftime\x20%s','interval','indexOf','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','Interval','Intervals','getProactiveActions','virtual','increment','chatLicenseExceeded','all','some','server/files/chat/iframe.ejs','remote','x-real-ip','connection','remoteAddress','replace','verticalAlignment','labelText','textColor','textButtonColor','color_button','backgroundColor','IntervalId','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','ChatApplication','priority','finally','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','false','onlineForm','items','fromKey','ChatOfflineMessage','Attachments','addAgents','userChatWebsite:save','isArray','userChatWebsite:remove','getAgents','bluebird','mustache','util','path','ejs','fs-extra','lodash','querystring','ioredis','../../components/parsers/qs','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','html-to-text','client','http','request','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','update','destroy','get','ChatWebsites','UserProfileResource','stack','name','index','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','limit','sort','where','filter','VIRTUAL','options','includeAll','findAll','rows','show','params','include','merge','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','nolimit','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','order','pick','removeAnswers','addLogo','sitepic','file','filename','addAvatar','agentAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','isNil','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','existsSync','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','customerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','headers','user-agent','getResult','chat','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','CompanyId','ListId','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','Contacts','DESC','account','applications','List','orderBy','asc','Applications','contact','customerIp','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','vendor','%s\x20%s\x20%s','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','messageId','created','autoclose','push','unmanaged','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','Start','startRouting','EventManager','offline','files','send','mapKeyOffline','includes','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','MailAccount','findOrCreate','readFileSync','utf8','render','toPairs','offlineMessageBody','fromString','originalname','mimetype','server','attachments','offline-chat','basename','openNewInteraction','Attachment','bulkCreate','MailServerOut','CloudProvider','forwardOffline'];(function(_0xefac4e,_0x201094){var _0x42bbd4=function(_0x4bebc8){while(--_0x4bebc8){_0xefac4e['push'](_0xefac4e['shift']());}};_0x42bbd4(++_0x201094);}(_0xcd27,0x177));var _0x7cd2=function(_0xefc997,_0x223a4d){_0xefc997=_0xefc997-0x0;var _0x3079ed=_0xcd27[_0xefc997];return _0x3079ed;};'use strict';var BPromise=require(_0x7cd2('0x0'));var Mustache=require(_0x7cd2('0x1'));var util=require(_0x7cd2('0x2'));var path=require(_0x7cd2('0x3'));var ejs=require(_0x7cd2('0x4'));var fs=require('fs');var fs_extra=require(_0x7cd2('0x5'));var _=require(_0x7cd2('0x6'));var querystring=require(_0x7cd2('0x7'));var Redis=require(_0x7cd2('0x8'));var qs=require(_0x7cd2('0x9'));var logger=require('../../config/logger')(_0x7cd2('0xa'));var config=require('../../config/environment');var db=require(_0x7cd2('0xb'))['db'];config[_0x7cd2('0xc')]=_[_0x7cd2('0xd')](config[_0x7cd2('0xc')],{'host':_0x7cd2('0xe'),'port':0x18eb});var socket=require(_0x7cd2('0xf'))(new Redis(config[_0x7cd2('0xc')]));require(_0x7cd2('0x10'))[_0x7cd2('0x11')](socket);var htmlToText=require(_0x7cd2('0x12'));var jayson=require('jayson/promise');var client=jayson[_0x7cd2('0x13')][_0x7cd2('0x14')]({'port':0x232c});var client9002=jayson[_0x7cd2('0x13')][_0x7cd2('0x14')]({'port':0x232a});var client9003=jayson[_0x7cd2('0x13')][_0x7cd2('0x14')]({'port':0x232b});var client9001=jayson[_0x7cd2('0x13')][_0x7cd2('0x14')]({'port':0x2329});function respondWithRpcPromise(_0x34dd69,_0x32e324,_0x4c411b,_0x424cdd){return new BPromise(function(_0x4a81be,_0x4f94a8){var _0x2ab3c3=_0x424cdd||client;return _0x2ab3c3[_0x7cd2('0x15')](_0x34dd69,_0x4c411b)[_0x7cd2('0x16')](function(_0x1e7354){logger['info'](_0x7cd2('0x17'),_0x32e324,_0x7cd2('0x18'));logger[_0x7cd2('0x19')](_0x7cd2('0x1a'),_0x32e324,_0x7cd2('0x18'),JSON[_0x7cd2('0x1b')](_0x1e7354));if(_0x1e7354[_0x7cd2('0x1c')]){if(_0x1e7354['error']['code']===0x1f4){logger[_0x7cd2('0x1c')](_0x7cd2('0x17'),_0x32e324,_0x1e7354[_0x7cd2('0x1c')][_0x7cd2('0x1d')]);return _0x4f94a8(_0x1e7354[_0x7cd2('0x1c')][_0x7cd2('0x1d')]);}logger[_0x7cd2('0x1c')](_0x7cd2('0x17'),_0x32e324,_0x1e7354['error'][_0x7cd2('0x1d')]);return _0x4a81be(_0x1e7354[_0x7cd2('0x1c')][_0x7cd2('0x1d')]);}else{logger[_0x7cd2('0x1e')](_0x7cd2('0x17'),_0x32e324,_0x7cd2('0x18'));_0x4a81be(_0x1e7354['result'][_0x7cd2('0x1d')]);}})[_0x7cd2('0x1f')](function(_0x45c268){logger['error'](_0x7cd2('0x17'),_0x32e324,_0x45c268);_0x4f94a8(_0x45c268);});});}function respondWithStatusCode(_0x920269,_0x5197a3){_0x5197a3=_0x5197a3||0xcc;return function(_0x45eacb){if(_0x45eacb){return _0x920269[_0x7cd2('0x20')](_0x5197a3);}return _0x920269[_0x7cd2('0x21')](_0x5197a3)[_0x7cd2('0x22')]();};}function respondWithResult(_0x1b27c5,_0x3e2093){_0x3e2093=_0x3e2093||0xc8;return function(_0x1baf30){if(_0x1baf30){return _0x1b27c5[_0x7cd2('0x21')](_0x3e2093)[_0x7cd2('0x23')](_0x1baf30);}};}function respondWithFilteredResult(_0x5e2897,_0x355f3a){return function(_0x3713a7){if(_0x3713a7){var _0x19c114=typeof _0x355f3a[_0x7cd2('0x24')]===_0x7cd2('0x25')&&typeof _0x355f3a['limit']===_0x7cd2('0x25');var _0x11abc6=_0x3713a7[_0x7cd2('0x26')];var _0x3e99d0=_0x19c114?0x0:_0x355f3a[_0x7cd2('0x24')];var _0x2e4115=_0x19c114?_0x3713a7[_0x7cd2('0x26')]:_0x355f3a[_0x7cd2('0x24')]+_0x355f3a['limit'];var _0xea4cf9;if(_0x2e4115>=_0x11abc6){_0x2e4115=_0x11abc6;_0xea4cf9=0xc8;}else{_0xea4cf9=0xce;}_0x5e2897[_0x7cd2('0x21')](_0xea4cf9);return _0x5e2897[_0x7cd2('0x27')](_0x7cd2('0x28'),_0x3e99d0+'-'+_0x2e4115+'/'+_0x11abc6)[_0x7cd2('0x23')](_0x3713a7);}return null;};}function saveUpdates(_0x54b19f){return function(_0x531e40){if(_0x531e40){return _0x531e40[_0x7cd2('0x29')](_0x54b19f)[_0x7cd2('0x16')](function(_0x3a7914){return _0x3a7914;});}return null;};}function removeEntity(_0x4333df){return function(_0x52fab2){if(_0x52fab2){return _0x52fab2[_0x7cd2('0x2a')]()['then'](function(){var _0x549123=_0x52fab2[_0x7cd2('0x2b')]({'plain':!![]});var _0x233ab8=_0x7cd2('0x2c');return db[_0x7cd2('0x2d')][_0x7cd2('0x2a')]({'where':{'type':_0x233ab8,'resourceId':_0x549123['id']}})[_0x7cd2('0x16')](function(){return _0x52fab2;});})[_0x7cd2('0x16')](function(){_0x4333df[_0x7cd2('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51a811){return function(_0x36af96){if(!_0x36af96){_0x51a811[_0x7cd2('0x20')](0x194);}return _0x36af96;};}function handleError(_0x5f4e85,_0x3b3c81){_0x3b3c81=_0x3b3c81||0x1f4;return function(_0x437e56){logger[_0x7cd2('0x1c')](_0x437e56[_0x7cd2('0x2e')]);if(_0x437e56[_0x7cd2('0x2f')]){delete _0x437e56[_0x7cd2('0x2f')];}_0x5f4e85[_0x7cd2('0x21')](_0x3b3c81)['send'](_0x437e56);};}exports[_0x7cd2('0x30')]=function(_0x7aff6d,_0x1879a2){var _0x11d4db={'include':[{'model':db[_0x7cd2('0x31')],'as':_0x7cd2('0x32')}]},_0x554302={},_0x315e88={'count':0x0,'rows':[]};var _0x101700=_[_0x7cd2('0x33')](db[_0x7cd2('0x34')][_0x7cd2('0x35')],function(_0x47aa54){return{'name':_0x47aa54[_0x7cd2('0x36')],'type':_0x47aa54[_0x7cd2('0x37')]['key']};});_0x554302[_0x7cd2('0x38')]=_[_0x7cd2('0x33')](_0x101700,'name');_0x554302[_0x7cd2('0x39')]=_[_0x7cd2('0x3a')](_0x7aff6d[_0x7cd2('0x39')]);_0x554302[_0x7cd2('0x3b')]=_[_0x7cd2('0x3c')](_0x554302[_0x7cd2('0x38')],_0x554302['query']);_0x11d4db['attributes']=_[_0x7cd2('0x3c')](_0x554302[_0x7cd2('0x38')],qs[_0x7cd2('0x3d')](_0x7aff6d[_0x7cd2('0x39')][_0x7cd2('0x3d')]));_0x11d4db[_0x7cd2('0x3e')]=_0x11d4db['attributes'][_0x7cd2('0x3f')]?_0x11d4db['attributes']:_0x554302['model'];if(!_0x7aff6d[_0x7cd2('0x39')][_0x7cd2('0x40')]('nolimit')){_0x11d4db[_0x7cd2('0x41')]=qs['limit'](_0x7aff6d['query']['limit']);_0x11d4db[_0x7cd2('0x24')]=qs[_0x7cd2('0x24')](_0x7aff6d[_0x7cd2('0x39')]['offset']);}_0x11d4db['order']=qs[_0x7cd2('0x42')](_0x7aff6d[_0x7cd2('0x39')][_0x7cd2('0x42')]);_0x11d4db[_0x7cd2('0x43')]=qs[_0x7cd2('0x3b')](_['pick'](_0x7aff6d[_0x7cd2('0x39')],_0x554302[_0x7cd2('0x3b')]),_0x101700);if(_0x7aff6d[_0x7cd2('0x39')][_0x7cd2('0x44')]){_0x11d4db[_0x7cd2('0x43')]=_['merge'](_0x11d4db[_0x7cd2('0x43')],{'$or':_[_0x7cd2('0x33')](_0x101700,function(_0x543f98){if(_0x543f98['type']!==_0x7cd2('0x45')){var _0x293c16={};_0x293c16[_0x543f98[_0x7cd2('0x2f')]]={'$like':'%'+_0x7aff6d[_0x7cd2('0x39')][_0x7cd2('0x44')]+'%'};return _0x293c16;}})});}_0x11d4db=_['merge']({},_0x11d4db,_0x7aff6d[_0x7cd2('0x46')]);var _0x4955f1={'where':_0x11d4db[_0x7cd2('0x43')]};return db[_0x7cd2('0x34')][_0x7cd2('0x26')](_0x4955f1)[_0x7cd2('0x16')](function(_0x262b3f){_0x315e88[_0x7cd2('0x26')]=_0x262b3f;if(_0x7aff6d['query'][_0x7cd2('0x47')]){_0x11d4db['include']=[{'all':!![]}];}return db[_0x7cd2('0x34')][_0x7cd2('0x48')](_0x11d4db);})[_0x7cd2('0x16')](function(_0x3dc157){_0x315e88[_0x7cd2('0x49')]=_0x3dc157;return _0x315e88;})[_0x7cd2('0x16')](respondWithFilteredResult(_0x1879a2,_0x11d4db))['catch'](handleError(_0x1879a2,null));};exports[_0x7cd2('0x4a')]=function(_0x516fe6,_0x1c19e3){var _0x2069ac={'raw':![],'where':{'id':_0x516fe6[_0x7cd2('0x4b')]['id']},'include':[{'model':db[_0x7cd2('0x31')],'as':_0x7cd2('0x32')}]},_0x114420={};_0x114420['model']=_['keys'](db[_0x7cd2('0x34')][_0x7cd2('0x35')]);_0x114420['query']=_[_0x7cd2('0x3a')](_0x516fe6['query']);_0x114420['filters']=_[_0x7cd2('0x3c')](_0x114420['model'],_0x114420[_0x7cd2('0x39')]);_0x2069ac[_0x7cd2('0x3e')]=_[_0x7cd2('0x3c')](_0x114420['model'],qs['fields'](_0x516fe6[_0x7cd2('0x39')][_0x7cd2('0x3d')]));_0x2069ac[_0x7cd2('0x3e')]=_0x2069ac['attributes'][_0x7cd2('0x3f')]?_0x2069ac[_0x7cd2('0x3e')]:_0x114420[_0x7cd2('0x38')];if(_0x516fe6[_0x7cd2('0x39')][_0x7cd2('0x47')]){_0x2069ac[_0x7cd2('0x4c')]=[{'all':!![]}];}_0x2069ac=_[_0x7cd2('0x4d')]({},_0x2069ac,_0x516fe6[_0x7cd2('0x46')]);return db[_0x7cd2('0x34')]['find'](_0x2069ac)[_0x7cd2('0x16')](handleEntityNotFound(_0x1c19e3,null))['then'](respondWithResult(_0x1c19e3,null))[_0x7cd2('0x1f')](handleError(_0x1c19e3,null));};exports[_0x7cd2('0x4e')]=function(_0x3e50e2,_0x54b996){return db[_0x7cd2('0x34')][_0x7cd2('0x4e')](_0x3e50e2[_0x7cd2('0x4f')],{})[_0x7cd2('0x16')](function(_0x156a8f){var _0x398023=_0x3e50e2['user'][_0x7cd2('0x2b')]({'plain':!![]});if(!_0x398023)throw new Error(_0x7cd2('0x50'));if(_0x398023[_0x7cd2('0x51')]===_0x7cd2('0x52')){var _0x57c7b5=_0x156a8f[_0x7cd2('0x2b')]({'plain':!![]});var _0x20e09d='ChatWebsites';return db[_0x7cd2('0x53')][_0x7cd2('0x54')]({'where':{'name':_0x20e09d,'userProfileId':_0x398023['userProfileId']},'raw':!![]})['then'](function(_0x53c1a9){if(_0x53c1a9&&_0x53c1a9[_0x7cd2('0x55')]===0x0){return db[_0x7cd2('0x2d')][_0x7cd2('0x4e')]({'name':_0x57c7b5[_0x7cd2('0x2f')],'resourceId':_0x57c7b5['id'],'type':_0x53c1a9[_0x7cd2('0x2f')],'sectionId':_0x53c1a9['id']},{})[_0x7cd2('0x16')](function(){return _0x156a8f;});}else{return _0x156a8f;}})[_0x7cd2('0x1f')](function(_0x2e7e80){logger[_0x7cd2('0x1c')](_0x7cd2('0x56'),_0x2e7e80);throw _0x2e7e80;});}return _0x156a8f;})[_0x7cd2('0x16')](respondWithResult(_0x54b996,0xc9))[_0x7cd2('0x1f')](handleError(_0x54b996,null));};exports[_0x7cd2('0x29')]=function(_0x1bb5ee,_0x37444f){if(_0x1bb5ee[_0x7cd2('0x4f')]['id']){delete _0x1bb5ee['body']['id'];}return db[_0x7cd2('0x34')][_0x7cd2('0x54')]({'where':{'id':_0x1bb5ee[_0x7cd2('0x4b')]['id']},'include':[{'model':db[_0x7cd2('0x31')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x37444f,null))[_0x7cd2('0x16')](saveUpdates(_0x1bb5ee['body'],null))[_0x7cd2('0x16')](respondWithResult(_0x37444f,null))[_0x7cd2('0x1f')](handleError(_0x37444f,null));};exports[_0x7cd2('0x2a')]=function(_0x4f4ebb,_0x34d54d){return db['ChatWebsite'][_0x7cd2('0x54')]({'where':{'id':_0x4f4ebb['params']['id']}})[_0x7cd2('0x16')](handleEntityNotFound(_0x34d54d,null))[_0x7cd2('0x16')](removeEntity(_0x34d54d,null))['catch'](handleError(_0x34d54d,null));};exports[_0x7cd2('0x57')]=function(_0x553dd0,_0x284cfc){return db[_0x7cd2('0x34')]['describe']()[_0x7cd2('0x16')](respondWithResult(_0x284cfc,null))[_0x7cd2('0x1f')](handleError(_0x284cfc,null));};exports[_0x7cd2('0x58')]=function(_0x25d8c9,_0x32ac83){if(_0x25d8c9['body']['id']){delete _0x25d8c9[_0x7cd2('0x4f')]['id'];}return db[_0x7cd2('0x34')]['find']({'where':{'id':_0x25d8c9[_0x7cd2('0x4b')]['id']}})['then'](handleEntityNotFound(_0x32ac83,null))[_0x7cd2('0x16')](function(_0x4640cc){if(_0x4640cc){_0x25d8c9[_0x7cd2('0x4f')][_0x7cd2('0x59')]=_0x4640cc['id'];return db[_0x7cd2('0x5a')][_0x7cd2('0x4e')](_0x25d8c9[_0x7cd2('0x4f')]);}})[_0x7cd2('0x16')](respondWithResult(_0x32ac83,null))['catch'](handleError(_0x32ac83,null));};exports[_0x7cd2('0x5b')]=function(_0x34fc89,_0x57d533){var _0xd8a061={'raw':![],'where':{}};var _0x42edab={};var _0x3b1b34={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x34fc89[_0x7cd2('0x4b')]['id']}})[_0x7cd2('0x16')](handleEntityNotFound(_0x57d533,null))[_0x7cd2('0x16')](function(_0x593429){if(_0x593429){_0x42edab[_0x7cd2('0x38')]=_[_0x7cd2('0x3a')](db[_0x7cd2('0x5a')]['rawAttributes']);_0x42edab[_0x7cd2('0x39')]=_['keys'](_0x34fc89[_0x7cd2('0x39')]);_0x42edab[_0x7cd2('0x3b')]=_[_0x7cd2('0x3c')](_0x42edab[_0x7cd2('0x38')],_0x42edab[_0x7cd2('0x39')]);_0xd8a061[_0x7cd2('0x3e')]=_[_0x7cd2('0x3c')](_0x42edab[_0x7cd2('0x38')],qs['fields'](_0x34fc89[_0x7cd2('0x39')][_0x7cd2('0x3d')]));_0xd8a061[_0x7cd2('0x3e')]=_0xd8a061['attributes']['length']?_0xd8a061[_0x7cd2('0x3e')]:_0x42edab['model'];if(!_0x34fc89[_0x7cd2('0x39')][_0x7cd2('0x40')](_0x7cd2('0x5c'))){_0xd8a061['limit']=qs['limit'](_0x34fc89[_0x7cd2('0x39')][_0x7cd2('0x41')]);_0xd8a061['offset']=qs[_0x7cd2('0x24')](_0x34fc89[_0x7cd2('0x39')]['offset']);}_0xd8a061['order']=qs[_0x7cd2('0x42')](_0x34fc89[_0x7cd2('0x39')][_0x7cd2('0x42')]);_0xd8a061[_0x7cd2('0x43')]=qs[_0x7cd2('0x3b')](_['pick'](_0x34fc89[_0x7cd2('0x39')],_0x42edab[_0x7cd2('0x3b')]));_0xd8a061[_0x7cd2('0x43')][_0x7cd2('0x59')]=_0x593429['id'];if(_0x34fc89[_0x7cd2('0x39')][_0x7cd2('0x44')]){_0xd8a061[_0x7cd2('0x43')]=_[_0x7cd2('0x4d')](_0xd8a061[_0x7cd2('0x43')],{'$or':_[_0x7cd2('0x33')](_0xd8a061[_0x7cd2('0x3e')],function(_0x1e3109){var _0x31ac99={};_0x31ac99[_0x1e3109]={'$like':'%'+_0x34fc89[_0x7cd2('0x39')][_0x7cd2('0x44')]+'%'};return _0x31ac99;})});}_0xd8a061=_[_0x7cd2('0x4d')]({},_0xd8a061,_0x34fc89[_0x7cd2('0x46')]);return db[_0x7cd2('0x5a')]['count']({'where':_0xd8a061['where']})[_0x7cd2('0x16')](function(_0x40f6d6){_0x3b1b34[_0x7cd2('0x26')]=_0x40f6d6;if(_0x34fc89[_0x7cd2('0x39')][_0x7cd2('0x47')]){_0xd8a061[_0x7cd2('0x4c')]=[{'all':!![]}];}return db[_0x7cd2('0x5a')]['findAll'](_0xd8a061);})[_0x7cd2('0x16')](function(_0x5dd8a8){_0x3b1b34['rows']=_0x5dd8a8;return _0x3b1b34;});}})['then'](respondWithFilteredResult(_0x57d533,_0xd8a061))['catch'](handleError(_0x57d533,null));};exports[_0x7cd2('0x5d')]=function(_0x236679,_0x24b751){return db['ChatWebsite'][_0x7cd2('0x54')]({'where':{'id':_0x236679['params']['id']}})[_0x7cd2('0x16')](handleEntityNotFound(_0x24b751,null))[_0x7cd2('0x16')](function(_0x510569){if(_0x510569){return _0x510569[_0x7cd2('0x5d')](_0x236679[_0x7cd2('0x39')][_0x7cd2('0x5e')]);}})[_0x7cd2('0x16')](respondWithStatusCode(_0x24b751,null))[_0x7cd2('0x1f')](handleError(_0x24b751,null));};exports[_0x7cd2('0x5f')]=function(_0x2b2d38,_0x34bd0c){if(_0x2b2d38[_0x7cd2('0x4f')]['id']){delete _0x2b2d38[_0x7cd2('0x4f')]['id'];}return db[_0x7cd2('0x34')][_0x7cd2('0x54')]({'where':{'id':_0x2b2d38[_0x7cd2('0x4b')]['id']}})[_0x7cd2('0x16')](handleEntityNotFound(_0x34bd0c,null))[_0x7cd2('0x16')](function(_0x5290c3){if(_0x5290c3){_0x2b2d38[_0x7cd2('0x4f')][_0x7cd2('0x59')]=_0x5290c3['id'];return db[_0x7cd2('0x60')][_0x7cd2('0x4e')](_0x2b2d38[_0x7cd2('0x4f')]);}})[_0x7cd2('0x16')](respondWithResult(_0x34bd0c,null))[_0x7cd2('0x1f')](handleError(_0x34bd0c,null));};exports[_0x7cd2('0x61')]=function(_0x26252b,_0x2fc015){var _0x457ecf={'raw':![],'where':{}};var _0x48407f={};var _0x5dd2b7={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x7cd2('0x62')]({'where':{'id':_0x26252b[_0x7cd2('0x4b')]['id']}})[_0x7cd2('0x16')](handleEntityNotFound(_0x2fc015,null))[_0x7cd2('0x16')](function(_0x26c740){if(_0x26c740){_0x48407f[_0x7cd2('0x38')]=_[_0x7cd2('0x3a')](db[_0x7cd2('0x60')][_0x7cd2('0x35')]);_0x48407f[_0x7cd2('0x39')]=_[_0x7cd2('0x3a')](_0x26252b[_0x7cd2('0x39')]);_0x48407f[_0x7cd2('0x3b')]=_['intersection'](_0x48407f[_0x7cd2('0x38')],_0x48407f[_0x7cd2('0x39')]);_0x457ecf[_0x7cd2('0x3e')]=_[_0x7cd2('0x3c')](_0x48407f['model'],qs[_0x7cd2('0x3d')](_0x26252b[_0x7cd2('0x39')][_0x7cd2('0x3d')]));_0x457ecf['attributes']=_0x457ecf['attributes'][_0x7cd2('0x3f')]?_0x457ecf['attributes']:_0x48407f['model'];if(!_0x26252b[_0x7cd2('0x39')][_0x7cd2('0x40')]('nolimit')){_0x457ecf['limit']=qs[_0x7cd2('0x41')](_0x26252b[_0x7cd2('0x39')]['limit']);_0x457ecf[_0x7cd2('0x24')]=qs[_0x7cd2('0x24')](_0x26252b[_0x7cd2('0x39')][_0x7cd2('0x24')]);}_0x457ecf[_0x7cd2('0x63')]=qs['sort'](_0x26252b['query'][_0x7cd2('0x42')]);_0x457ecf[_0x7cd2('0x43')]=qs[_0x7cd2('0x3b')](_[_0x7cd2('0x64')](_0x26252b[_0x7cd2('0x39')],_0x48407f['filters']));_0x457ecf['where'][_0x7cd2('0x59')]=_0x26c740['id'];if(_0x26252b[_0x7cd2('0x39')][_0x7cd2('0x44')]){_0x457ecf[_0x7cd2('0x43')]=_[_0x7cd2('0x4d')](_0x457ecf[_0x7cd2('0x43')],{'$or':_[_0x7cd2('0x33')](_0x457ecf[_0x7cd2('0x3e')],function(_0x29574b){var _0x4f2a1e={};_0x4f2a1e[_0x29574b]={'$like':'%'+_0x26252b[_0x7cd2('0x39')][_0x7cd2('0x44')]+'%'};return _0x4f2a1e;})});}_0x457ecf=_[_0x7cd2('0x4d')]({},_0x457ecf,_0x26252b[_0x7cd2('0x46')]);return db[_0x7cd2('0x60')][_0x7cd2('0x26')]({'where':_0x457ecf[_0x7cd2('0x43')]})[_0x7cd2('0x16')](function(_0x6d550b){_0x5dd2b7[_0x7cd2('0x26')]=_0x6d550b;if(_0x26252b[_0x7cd2('0x39')][_0x7cd2('0x47')]){_0x457ecf[_0x7cd2('0x4c')]=[{'all':!![]}];}return db['CannedAnswer'][_0x7cd2('0x48')](_0x457ecf);})[_0x7cd2('0x16')](function(_0x379f4){_0x5dd2b7['rows']=_0x379f4;return _0x5dd2b7;});}})[_0x7cd2('0x16')](respondWithFilteredResult(_0x2fc015,_0x457ecf))[_0x7cd2('0x1f')](handleError(_0x2fc015,null));};exports[_0x7cd2('0x65')]=function(_0xaeedfd,_0x472827){return db['ChatWebsite'][_0x7cd2('0x54')]({'where':{'id':_0xaeedfd[_0x7cd2('0x4b')]['id']}})['then'](handleEntityNotFound(_0x472827,null))['then'](function(_0x221063){if(_0x221063){return _0x221063[_0x7cd2('0x65')](_0xaeedfd[_0x7cd2('0x39')]['ids']);}})[_0x7cd2('0x16')](respondWithStatusCode(_0x472827,null))[_0x7cd2('0x1f')](handleError(_0x472827,null));};exports[_0x7cd2('0x66')]=function(_0x3e9c87,_0x586f80){_0x3e9c87[_0x7cd2('0x4f')][_0x7cd2('0x67')]=_0x3e9c87[_0x7cd2('0x68')][_0x7cd2('0x69')];return db[_0x7cd2('0x34')]['find']({'where':{'id':_0x3e9c87[_0x7cd2('0x4b')]['id']}})[_0x7cd2('0x16')](handleEntityNotFound(_0x586f80,null))[_0x7cd2('0x16')](saveUpdates(_0x3e9c87['body'],null))[_0x7cd2('0x16')](respondWithResult(_0x586f80,null))[_0x7cd2('0x1f')](handleError(_0x586f80,null));};exports[_0x7cd2('0x6a')]=function(_0x11ca13,_0x16ef4f){_0x11ca13[_0x7cd2('0x4f')][_0x7cd2('0x6b')]=_0x11ca13['file'][_0x7cd2('0x69')];return db[_0x7cd2('0x34')][_0x7cd2('0x54')]({'where':{'id':_0x11ca13[_0x7cd2('0x4b')]['id']}})[_0x7cd2('0x16')](handleEntityNotFound(_0x16ef4f,null))[_0x7cd2('0x16')](saveUpdates(_0x11ca13[_0x7cd2('0x4f')],null))['then'](respondWithResult(_0x16ef4f,null))[_0x7cd2('0x1f')](handleError(_0x16ef4f,null));};exports['addCustomerAvatar']=function(_0xda5680,_0x46c1a4){_0xda5680[_0x7cd2('0x4f')]['customerAvatar']=_0xda5680['file']['filename'];return db[_0x7cd2('0x34')][_0x7cd2('0x54')]({'where':{'id':_0xda5680[_0x7cd2('0x4b')]['id']}})[_0x7cd2('0x16')](handleEntityNotFound(_0x46c1a4,null))[_0x7cd2('0x16')](saveUpdates(_0xda5680[_0x7cd2('0x4f')],null))['then'](respondWithResult(_0x46c1a4,null))[_0x7cd2('0x1f')](handleError(_0x46c1a4,null));};exports[_0x7cd2('0x6c')]=function(_0x57f63d,_0x3023fa){_0x57f63d[_0x7cd2('0x4f')][_0x7cd2('0x6d')]=_0x57f63d[_0x7cd2('0x68')][_0x7cd2('0x69')];return db[_0x7cd2('0x34')][_0x7cd2('0x54')]({'where':{'id':_0x57f63d[_0x7cd2('0x4b')]['id']}})[_0x7cd2('0x16')](handleEntityNotFound(_0x3023fa,null))[_0x7cd2('0x16')](saveUpdates(_0x57f63d[_0x7cd2('0x4f')],null))[_0x7cd2('0x16')](respondWithResult(_0x3023fa,null))[_0x7cd2('0x1f')](handleError(_0x3023fa,null));};exports[_0x7cd2('0x6e')]=function(_0x16faba,_0xabf49c){var _0x1cb705=path[_0x7cd2('0x6f')](config[_0x7cd2('0x70')],_0x7cd2('0x71'));var _0x3387b2={'where':{'id':_0x16faba['params']['id']},'attributes':['id',_0x7cd2('0x67')],'raw':!![]};var _0x345aab=![];return require(_0x7cd2('0x72'))[_0x7cd2('0x73')]()[_0x7cd2('0x16')](function(_0x3af4af){if(_0x3af4af){_0x345aab=_0x3af4af[_0x7cd2('0x74')];}})['then'](function(){return db['ChatWebsite'][_0x7cd2('0x54')](_0x3387b2);})[_0x7cd2('0x16')](handleEntityNotFound(_0xabf49c,null))[_0x7cd2('0x16')](function(_0x374f8d){if(_0x374f8d){if(!_[_0x7cd2('0x75')](_0x374f8d[_0x7cd2('0x67')])){if(fs['existsSync'](path['join'](config['root'],'server/files/images/logos/',_0x374f8d[_0x7cd2('0x67')]))&&_0x345aab){_0x1cb705=path[_0x7cd2('0x6f')](config[_0x7cd2('0x70')],_0x7cd2('0x76'),_0x374f8d[_0x7cd2('0x67')]);}}return _0xabf49c[_0x7cd2('0x77')](_0x1cb705);}})[_0x7cd2('0x1f')](handleError(_0xabf49c,null));};exports[_0x7cd2('0x78')]=function(_0x1e7667,_0x401301){var _0x74e28d=path[_0x7cd2('0x6f')](config[_0x7cd2('0x70')],_0x7cd2('0x79'));var _0x24f986={'where':{'id':_0x1e7667[_0x7cd2('0x4b')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0x7cd2('0x34')][_0x7cd2('0x54')](_0x24f986)[_0x7cd2('0x16')](handleEntityNotFound(_0x401301,null))[_0x7cd2('0x16')](function(_0x4b3ea9){if(_0x4b3ea9){if(!_[_0x7cd2('0x75')](_0x4b3ea9[_0x7cd2('0x6b')])){if(fs[_0x7cd2('0x7a')](path[_0x7cd2('0x6f')](config[_0x7cd2('0x70')],_0x7cd2('0x7b'),_0x4b3ea9[_0x7cd2('0x6b')]))){_0x74e28d=path[_0x7cd2('0x6f')](config['root'],_0x7cd2('0x7b'),_0x4b3ea9[_0x7cd2('0x6b')]);}}return _0x401301[_0x7cd2('0x77')](_0x74e28d);}})[_0x7cd2('0x1f')](handleError(_0x401301,null));};exports[_0x7cd2('0x7c')]=function(_0x3a3d16,_0xe651bf){var _0x5948bb=path[_0x7cd2('0x6f')](config[_0x7cd2('0x70')],_0x7cd2('0x7d'));var _0x90bdf3={'where':{'id':_0x3a3d16[_0x7cd2('0x4b')]['id']},'attributes':['id','customerAvatar',_0x7cd2('0x7e')],'raw':!![]};return db[_0x7cd2('0x34')]['find'](_0x90bdf3)['then'](handleEntityNotFound(_0xe651bf,null))['then'](function(_0x44a52e){if(_0x44a52e){if(!_[_0x7cd2('0x75')](_0x44a52e['customerAvatar'])){if(fs[_0x7cd2('0x7a')](path[_0x7cd2('0x6f')](config[_0x7cd2('0x70')],'server/files/images/avatars/',_0x44a52e[_0x7cd2('0x7f')]))&&_0x44a52e[_0x7cd2('0x7e')]){_0x5948bb=path[_0x7cd2('0x6f')](config[_0x7cd2('0x70')],_0x7cd2('0x7b'),_0x44a52e[_0x7cd2('0x7f')]);}}return _0xe651bf[_0x7cd2('0x77')](_0x5948bb);}})[_0x7cd2('0x1f')](handleError(_0xe651bf,null));};exports[_0x7cd2('0x80')]=function(_0x251097,_0xd14c04){var _0x536bfe=path[_0x7cd2('0x6f')](config[_0x7cd2('0x70')],_0x7cd2('0x81'));var _0x360e85={'where':{'id':_0x251097[_0x7cd2('0x4b')]['id']},'attributes':['id',_0x7cd2('0x6d')],'raw':!![]};return db['ChatWebsite'][_0x7cd2('0x54')](_0x360e85)['then'](handleEntityNotFound(_0xd14c04,null))[_0x7cd2('0x16')](function(_0x4929a0){if(_0x4929a0){if(!_[_0x7cd2('0x75')](_0x4929a0[_0x7cd2('0x6d')])){if(fs[_0x7cd2('0x7a')](path[_0x7cd2('0x6f')](config[_0x7cd2('0x70')],_0x7cd2('0x7b'),_0x4929a0[_0x7cd2('0x6d')]))){_0x536bfe=path[_0x7cd2('0x6f')](config['root'],_0x7cd2('0x7b'),_0x4929a0['systemAvatar']);}}return _0xd14c04[_0x7cd2('0x77')](_0x536bfe);}})[_0x7cd2('0x1f')](handleError(_0xd14c04,null));};exports[_0x7cd2('0x82')]=function(_0x22268b,_0x186e2b){var _0x3ddd0f=require(_0x7cd2('0x83'));var _0x1c5163=new _0x3ddd0f();var _0x2a8bed=_0x1c5163['setUA'](_0x22268b[_0x7cd2('0x84')][_0x7cd2('0x85')])[_0x7cd2('0x86')]();var _0x4787cb={'body':_0x22268b['body'],'channel':_0x7cd2('0x87')};var _0x75889f=[];var _0x473fb9=[];var _0x877413={};var _0x2ccf0d=![];return db[_0x7cd2('0x88')][_0x7cd2('0x57')]()[_0x7cd2('0x16')](function(_0x4f8567){if(!_0x4f8567){throw new db[(_0x7cd2('0x89'))][(_0x7cd2('0x8a'))](_0x7cd2('0x8b'));}_0x75889f=_['difference'](_[_0x7cd2('0x3a')](_0x4f8567),[_0x7cd2('0x8c'),_0x7cd2('0x8d')]);_0x473fb9=_['difference'](_[_0x7cd2('0x3a')](_0x4f8567),['createdAt','updatedAt',_0x7cd2('0x8e'),_0x7cd2('0x8f')]);if(_0x22268b[_0x7cd2('0x4f')]['id']){delete _0x22268b[_0x7cd2('0x4f')]['id'];}if(_['isNil'](_0x22268b[_0x7cd2('0x4f')][_0x7cd2('0x90')])){throw new db[(_0x7cd2('0x89'))][(_0x7cd2('0x8a'))]('from\x20is\x20mandatory');}if(_[_0x7cd2('0x75')](_0x22268b[_0x7cd2('0x4f')]['body'])||_0x22268b[_0x7cd2('0x4f')][_0x7cd2('0x4f')]===''){throw new db[(_0x7cd2('0x89'))][(_0x7cd2('0x8a'))](_0x7cd2('0x91'));}if(_[_0x7cd2('0x75')](_0x22268b[_0x7cd2('0x4f')][_0x7cd2('0x92')])){throw new db[(_0x7cd2('0x89'))][(_0x7cd2('0x8a'))](_0x7cd2('0x93')+_0x473fb9);}if(!_['includes'](_0x473fb9,_0x22268b[_0x7cd2('0x4f')][_0x7cd2('0x92')])){throw new db[(_0x7cd2('0x89'))]['ValidationError'](_0x7cd2('0x94')+_0x473fb9);}_0x877413[_0x22268b['body'][_0x7cd2('0x92')]]=_0x22268b[_0x7cd2('0x4f')][_0x7cd2('0x90')];})[_0x7cd2('0x16')](function(){return db['ChatWebsite']['find']({'where':{'id':_0x22268b['params']['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x7cd2('0x88')],'as':_0x7cd2('0x95'),'where':_0x877413,'limit':0x1,'order':[[_0x7cd2('0x8d'),_0x7cd2('0x96')]]}]},{'model':db['ChatApplication'],'as':'Applications'}]});})[_0x7cd2('0x16')](handleEntityNotFound(_0x186e2b,null))[_0x7cd2('0x16')](function(_0x192fa9){if(_0x192fa9&&_0x192fa9['List']){_0x4787cb[_0x7cd2('0x97')]=_0x192fa9;_0x4787cb[_0x7cd2('0x98')]=_0x192fa9['Applications'];_0x4787cb['list']=_0x192fa9[_0x7cd2('0x99')];_0x4787cb[_0x7cd2('0x98')]=_[_0x7cd2('0x9a')](_0x4787cb[_0x7cd2('0x98')],['priority'],[_0x7cd2('0x9b')]);if(_0x4787cb[_0x7cd2('0x97')][_0x7cd2('0x9c')]){delete _0x4787cb[_0x7cd2('0x97')][_0x7cd2('0x9c')];}if(_0x4787cb[_0x7cd2('0x97')][_0x7cd2('0x99')]&&_0x4787cb['account'][_0x7cd2('0x99')][_0x7cd2('0x95')][_0x7cd2('0x3f')]){return _0x4787cb[_0x7cd2('0x97')][_0x7cd2('0x99')][_0x7cd2('0x95')][0x0];}var _0x1796ac=_['defaults'](_0x22268b[_0x7cd2('0x4f')],{'firstName':_0x22268b['body'][_0x7cd2('0x90')],'ListId':_0x192fa9['ListId']});_0x1796ac[_0x22268b['body'][_0x7cd2('0x92')]]=_0x22268b[_0x7cd2('0x4f')][_0x7cd2('0x90')];return db[_0x7cd2('0x88')][_0x7cd2('0x4e')](_0x1796ac,{'fields':_0x75889f,'raw':!![]});}})[_0x7cd2('0x16')](handleEntityNotFound(_0x186e2b,null))['then'](function(_0x44901f){_0x4787cb[_0x7cd2('0x9d')]=_0x44901f;var _0xa65f73=_0x22268b[_0x7cd2('0x4f')][_0x7cd2('0x9e')];if(_0x22268b[_0x7cd2('0x84')]['cf-connecting-ip']){_0xa65f73=_0x22268b[_0x7cd2('0x84')][_0x7cd2('0x9f')];}else if(_0x22268b[_0x7cd2('0x84')][_0x7cd2('0xa0')]){_0xa65f73=_[_0x7cd2('0xa1')](_0x22268b['headers'][_0x7cd2('0xa0')][_0x7cd2('0xa2')](','));}if(_0x44901f){var _0x5f0e1a={'ContactId':_0x44901f['id'],'ChatWebsiteId':_0x22268b[_0x7cd2('0x4b')]['id'],'from':(_0x44901f[_0x7cd2('0xa3')]||'')+'\x20'+(_0x44901f[_0x7cd2('0xa4')]||''),'customerIp':_0xa65f73,'customerPort':_0x22268b[_0x7cd2('0x84')][_0x7cd2('0xa5')]?_0x22268b[_0x7cd2('0x84')][_0x7cd2('0xa5')]:null,'referer':_0x22268b[_0x7cd2('0x4f')][_0x7cd2('0xa6')],'browserName':_0x2a8bed['browser'][_0x7cd2('0x2f')]&&_0x2a8bed[_0x7cd2('0xa7')][_0x7cd2('0xa8')]?util[_0x7cd2('0xa9')](_0x7cd2('0xaa'),_0x2a8bed[_0x7cd2('0xa7')]['name'],_0x2a8bed[_0x7cd2('0xa7')][_0x7cd2('0xa8')]):'unknown','browserVersion':_0x2a8bed[_0x7cd2('0xa7')][_0x7cd2('0xa8')]||_0x7cd2('0xab'),'osName':util[_0x7cd2('0xa9')](_0x7cd2('0xaa'),_0x2a8bed['os'][_0x7cd2('0x2f')],_0x2a8bed['os']['version']),'osVersion':_0x2a8bed['os'][_0x7cd2('0xa8')],'deviceModel':_0x2a8bed[_0x7cd2('0xac')]['model']&&_0x2a8bed[_0x7cd2('0xac')][_0x7cd2('0xad')]?util[_0x7cd2('0xa9')](_0x7cd2('0xae'),_0x2a8bed[_0x7cd2('0xac')]['model'],_0x2a8bed['device']['vendor'],_0x2a8bed[_0x7cd2('0xac')][_0x7cd2('0x37')]):null,'deviceVendor':_0x2a8bed[_0x7cd2('0xac')][_0x7cd2('0xad')],'deviceType':_0x2a8bed[_0x7cd2('0xac')][_0x7cd2('0x37')],'formData':JSON[_0x7cd2('0x1b')](_0x22268b[_0x7cd2('0x4f')])};var _0x40bb82={'ChatWebsiteId':_0x22268b['params']['id'],'closed':![]};if(_0x22268b['body']['threadId']){_0x40bb82[_0x7cd2('0xaf')]=_0x22268b[_0x7cd2('0x4f')][_0x7cd2('0xaf')];return db[_0x7cd2('0xb0')][_0x7cd2('0x54')]({'where':_0x40bb82})['then'](function(_0x5d3f50){if(_0x5d3f50){return[_0x5d3f50,![]];}_0x5f0e1a[_0x7cd2('0xaf')]=_0x22268b[_0x7cd2('0x4f')][_0x7cd2('0xaf')];_0x5f0e1a[_0x7cd2('0xb1')]=_0x22268b[_0x7cd2('0x4f')][_0x7cd2('0xb1')];return db[_0x7cd2('0xb0')][_0x7cd2('0x4e')](_0x5f0e1a)[_0x7cd2('0x16')](function(_0x5005d1){return[_0x5005d1,!![]];});});}_0x40bb82[_0x7cd2('0xb2')]=_0x44901f['id'];if(_0x22268b[_0x7cd2('0x4f')][_0x7cd2('0xb3')]&&_0x22268b['body'][_0x7cd2('0xb3')]['id']){_0x40bb82['id']=_0x22268b['body']['interaction']['id'];return db[_0x7cd2('0xb0')]['find']({'where':_0x40bb82})[_0x7cd2('0x16')](function(_0x51e4f2){if(_0x51e4f2){return[_0x51e4f2,![]];}return db[_0x7cd2('0xb0')][_0x7cd2('0x4e')](_0x5f0e1a)[_0x7cd2('0x16')](function(_0x8978b1){return[_0x8978b1,!![]];});});}return db[_0x7cd2('0xb0')][_0x7cd2('0x4e')](_0x5f0e1a)[_0x7cd2('0x16')](function(_0x308f81){return[_0x308f81,!![]];});}})[_0x7cd2('0xb4')](function(_0x4d86e7,_0x148b71){if(_0x4d86e7){_0x2ccf0d=_0x148b71;if(!_0x148b71){var _0x4e207e={'from':(_0x4787cb[_0x7cd2('0x9d')][_0x7cd2('0xa3')]||'')+'\x20'+(_0x4787cb[_0x7cd2('0x9d')][_0x7cd2('0xa4')]||'')};if(_0x22268b[_0x7cd2('0x4f')]['threadId']&&_0x22268b[_0x7cd2('0x4f')][_0x7cd2('0xb5')]&&_0x22268b[_0x7cd2('0x4f')][_0x7cd2('0xaf')]!=_0x22268b[_0x7cd2('0x4f')][_0x7cd2('0xb5')]){_0x4e207e[_0x7cd2('0xaf')]=_0x22268b[_0x7cd2('0x4f')][_0x7cd2('0xb5')];}return _0x4d86e7[_0x7cd2('0x29')](_0x4e207e);}else{return _0x4d86e7;}}})[_0x7cd2('0x16')](function(_0x422d70){_0x4787cb['interaction']=_0x422d70[_0x7cd2('0x2b')]({'plain':!![]});_0x4787cb['interaction'][_0x7cd2('0xb6')]=_0x2ccf0d;if(_0x4787cb[_0x7cd2('0xb3')][_0x7cd2('0xb6')]){if(_0x4787cb[_0x7cd2('0x97')][_0x7cd2('0xb7')]){_0x4787cb[_0x7cd2('0x98')][_0x7cd2('0xb8')]({'id':0x0,'priority':_0x4787cb[_0x7cd2('0x98')][_0x7cd2('0x3f')]+0x1,'app':'close','appdata':_0x7cd2('0xb9'),'interval':'*,*,*,*'});}}return db['ChatMessage']['create']({'body':_0x22268b[_0x7cd2('0x4f')][_0x7cd2('0x4f')],'ChatWebsiteId':_0x22268b['params']['id'],'ChatInteractionId':_0x422d70['id'],'direction':'in','ContactId':_0x4787cb[_0x7cd2('0x9d')]['id'],'AttachmentId':_0x22268b['body'][_0x7cd2('0xba')]});})[_0x7cd2('0x16')](function(_0x467181){_0x4787cb[_0x7cd2('0x1d')]=_0x467181;if(_0x4787cb[_0x7cd2('0xb3')][_0x7cd2('0xbb')]){return db[_0x7cd2('0xbc')][_0x7cd2('0x54')]({'attributes':['id',_0x7cd2('0x2f')],'where':{'id':_0x4787cb[_0x7cd2('0xb3')][_0x7cd2('0xbb')]}})[_0x7cd2('0x16')](function(_0x2ebcd1){if(_0x2ebcd1){_0x4787cb['applications'][_0x7cd2('0xbd')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x2ebcd1['name']+','+(_0x4787cb[_0x7cd2('0x97')][_0x7cd2('0xbe')]||0xa),'interval':'*,*,*,*'});_0x4787cb['forcedOwnership']=!![];}return respondWithRpcPromise(_0x7cd2('0xbf'),_0x7cd2('0xc0'),_0x4787cb);});}return respondWithRpcPromise(_0x7cd2('0xbf'),_0x7cd2('0xc0'),_0x4787cb);})['then'](function(_0x476924){respondWithRpcPromise(_0x7cd2('0xc1'),'EventManager',{'event':_0x7cd2('0x82'),'message':_0x476924},client9002);return _0x476924;})['then'](respondWithResult(_0x186e2b,null))[_0x7cd2('0x1f')](handleError(_0x186e2b,null));};exports[_0x7cd2('0xc2')]=function(_0xdd71a7,_0x1d0bb2){var _0x6cdfe1,_0x2d3cb5,_0x14d680;var _0x2df905=[];var _0x521b49={};var _0xf1af17=_0xdd71a7[_0x7cd2('0xc3')]||[];var _0x2e1b91=[];var _0x3ed64f;return db[_0x7cd2('0x88')]['describe']()[_0x7cd2('0x16')](function(_0x436d61){if(!_0x436d61){throw new db[(_0x7cd2('0x89'))][(_0x7cd2('0x8a'))](_0x7cd2('0x8b'));}_0x2df905=_['difference'](_[_0x7cd2('0x3a')](_0x436d61),[_0x7cd2('0x8c'),_0x7cd2('0x8d'),_0x7cd2('0x8e'),_0x7cd2('0x8f')]);if(_0xdd71a7[_0x7cd2('0x4f')]['id']){delete _0xdd71a7[_0x7cd2('0x4f')]['id'];}if(_['isNil'](_0xdd71a7[_0x7cd2('0x4f')][_0x7cd2('0x90')])){throw _0x1d0bb2[_0x7cd2('0x21')](0x1f4)[_0x7cd2('0xc4')](new db[(_0x7cd2('0x89'))][(_0x7cd2('0x8a'))]('from\x20is\x20mandatory'));}if(_['isNil'](_0xdd71a7[_0x7cd2('0x4f')][_0x7cd2('0x4f')])||_0xdd71a7[_0x7cd2('0x4f')][_0x7cd2('0x4f')]===''){throw _0x1d0bb2[_0x7cd2('0x21')](0x1f4)[_0x7cd2('0xc4')](new db[(_0x7cd2('0x89'))][(_0x7cd2('0x8a'))]('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_['isNil'](_0xdd71a7[_0x7cd2('0x4f')][_0x7cd2('0xc5')])){throw _0x1d0bb2['status'](0x1f4)[_0x7cd2('0xc4')](new db[(_0x7cd2('0x89'))][(_0x7cd2('0x8a'))]('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2df905));}if(!_[_0x7cd2('0xc6')](_0x2df905,_0xdd71a7['body'][_0x7cd2('0xc5')])){throw _0x1d0bb2['status'](0x1f4)[_0x7cd2('0xc4')](new db[(_0x7cd2('0x89'))][(_0x7cd2('0x8a'))](_0x7cd2('0xc7')+_0x2df905));}_0x521b49[_0xdd71a7[_0x7cd2('0x4f')][_0x7cd2('0xc5')]]=_0xdd71a7[_0x7cd2('0x4f')][_0x7cd2('0x90')];})['then'](function(){return db[_0x7cd2('0x34')][_0x7cd2('0x54')]({'where':{'id':_0xdd71a7[_0x7cd2('0x4b')]['id']},'include':[{'model':db[_0x7cd2('0xc8')],'as':_0x7cd2('0x99')},{'model':db[_0x7cd2('0xc9')],'as':'MailAccount'}]});})['then'](handleEntityNotFound(_0x1d0bb2,null))['then'](function(_0xe62b36){if(_0xe62b36&&_0xe62b36['List']){_0x2d3cb5=_0xe62b36;var _0x2c0d10=_['defaults'](_0xdd71a7[_0x7cd2('0x4f')],{'firstName':_0xdd71a7['body']['from'],'phone':_0xdd71a7['body'][_0x7cd2('0x90')],'ListId':_0xe62b36['ListId']});_0x2c0d10[_0xdd71a7[_0x7cd2('0x4f')][_0x7cd2('0xc5')]]=_0xdd71a7[_0x7cd2('0x4f')][_0x7cd2('0x90')];return db[_0x7cd2('0x88')][_0x7cd2('0xca')]({'where':_0x521b49,'defaults':_0x2c0d10});}})[_0x7cd2('0xb4')](function(_0x31dbdf){if(_0x31dbdf){_0x14d680=_0x31dbdf;var _0x4977d0=fs[_0x7cd2('0xcb')](path[_0x7cd2('0x6f')](config[_0x7cd2('0x70')],'server/files/templates/chatOfflineMessage.ejs'),_0x7cd2('0xcc'));var _0x209c0=ejs[_0x7cd2('0xcd')](_0x4977d0,{'body':_[_0x7cd2('0xce')](_0xdd71a7[_0x7cd2('0x4f')]['body']),'bodyTitle':_0x2d3cb5[_0x7cd2('0xcf')]});return db['ChatOfflineMessage'][_0x7cd2('0x4e')]({'body':_0x209c0,'plainBody':htmlToText[_0x7cd2('0xd0')](_0x209c0),'ContactId':_0x31dbdf['id'],'ChatWebsiteId':_0x2d3cb5['id']});}})[_0x7cd2('0x16')](function(_0x5baaf9){_0x3ed64f=_0x5baaf9;if(_0xf1af17[_0x7cd2('0x3f')]){var _0x5cef90=_0xf1af17[_0x7cd2('0x33')](function(_0x480529){return{'name':_0x480529[_0x7cd2('0xd1')],'basename':_0x480529[_0x7cd2('0x69')],'type':_0x480529[_0x7cd2('0xd2')],'ChatOfflineMessageId':_0x5baaf9['id']};});_0x2e1b91=_0x5cef90['map'](_0x47b4f1=>{var _0x355161={'filename':_0x47b4f1[_0x7cd2('0x2f')],'path':path['join'](config[_0x7cd2('0x70')],_0x7cd2('0xd3'),_0x7cd2('0xc3'),_0x7cd2('0xd4'),_0x7cd2('0xd5'),_0x47b4f1[_0x7cd2('0xd6')])};return _0x355161;});if(!_0x2d3cb5[_0x7cd2('0xd7')]){return db['sequelize']['transaction'](function(_0x19e102){return db[_0x7cd2('0xd8')][_0x7cd2('0xd9')](_0x5cef90,{'transaction':_0x19e102});});}}})['then'](function(){if(_0x3ed64f){_0x6cdfe1=_0x3ed64f;return db[_0x7cd2('0xc9')][_0x7cd2('0x62')]({'where':{'service':!![]},'include':[{'model':db[_0x7cd2('0xda')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x7cd2('0xdb')],'as':'CloudProvider','raw':!![]}]}]});}})[_0x7cd2('0x16')](function(_0x416ce4){if(_0x416ce4&&_0x416ce4['Smtp']&&_0x2d3cb5[_0x7cd2('0xdc')]&&_0x2d3cb5[_0x7cd2('0xdd')]){var _0x48a14d=_0x416ce4[_0x7cd2('0xde')]();return respondWithRpcPromise(_0x7cd2('0xdf'),_0x7cd2('0xe0'),{'account':_0x48a14d,'message':{'from':util[_0x7cd2('0xa9')](_0x7cd2('0xe1'),_0x416ce4[_0x7cd2('0x2f')],_0x416ce4['email']||_0x416ce4['Smtp'][_0x7cd2('0x52')]),'to':_0x2d3cb5['forwardOfflineAddress'],'subject':_0x2d3cb5['offlineMessageSubject'],'html':_0x6cdfe1[_0x7cd2('0x4f')],'attachments':_0x2e1b91}},client9003)[_0x7cd2('0x16')](function(){return _0x6cdfe1;})['catch'](function(_0x2017f6){logger['error'](_0x2017f6);});}})[_0x7cd2('0x16')](function(){if(_0x2d3cb5&&_0x2d3cb5['openNewInteraction']&&_0x2d3cb5['MailAccountId']){var _0x72b8c8=[];if(_0xf1af17[_0x7cd2('0x3f')]){_0x72b8c8=_0xf1af17[_0x7cd2('0x33')](function(_0x1d99a4){return{'name':_0x1d99a4[_0x7cd2('0xd1')],'basename':_0x1d99a4[_0x7cd2('0x69')],'type':_0x1d99a4[_0x7cd2('0xd2')],'ChatOfflineMessageId':_0x3ed64f['id']};});}var _0x5a1678;if(!_[_0x7cd2('0x75')](_0x2d3cb5[_0x7cd2('0xe2')])){var _0x433c95=_[_0x7cd2('0x33')](_0xdd71a7[_0x7cd2('0x4f')],function(_0x3506af){return _0x3506af;});var _0x34ce3b=_[_0x7cd2('0xe3')](_0x433c95)[0x0];var _0x218f6c=_[_0x7cd2('0xe4')](_0x34ce3b,function(_0x4d829a){return _0x4d829a;});_0x5a1678=_0x218f6c[0x1][_0x2d3cb5[_0x7cd2('0xe2')]];}var _0x4d2e54={'from':_0x14d680['email'],'firstName':_0x14d680[_0x7cd2('0xa3')],'lastName':_0x14d680[_0x7cd2('0xa4')],'mapKey':_0x7cd2('0xe5'),'message':{'from':_0x14d680[_0x7cd2('0xe5')],'to':_0x2d3cb5[_0x7cd2('0xc9')][_0x7cd2('0xe5')],'cc':'','subject':_[_0x7cd2('0x75')](_0x5a1678)?_0x2d3cb5['offlineMessageSubject']:_0x5a1678,'messageId':'','sentAt':new Date(),'attach':_0x72b8c8['length'],'attachments':_0x72b8c8,'originChannel':_0x7cd2('0xe6'),'ChatWebsiteId':_0x2d3cb5['id'],'ChatOfflineMessageId':_0x6cdfe1['id'],'originTo':_0x2d3cb5[_0x7cd2('0xc9')]['email']},'body':_0x6cdfe1[_0x7cd2('0x4f')]};var _0x2516e0={'account':{'id':_0x2d3cb5[_0x7cd2('0xe7')]},'body':_0x4d2e54,'log':_0x7cd2('0xe8')};return respondWithRpcPromise(_0x7cd2('0xe8'),_0x7cd2('0xe9'),_0x2516e0,client9001)[_0x7cd2('0x16')](function(){return _0x6cdfe1;})['catch'](function(_0x10ea17){logger[_0x7cd2('0x1c')](_0x10ea17);});}return;})[_0x7cd2('0x16')](function(){if(_0x6cdfe1){return _0x6cdfe1;}})[_0x7cd2('0x16')](respondWithResult(_0x1d0bb2,null))[_0x7cd2('0x1f')](function(_0x10f3f5){logger[_0x7cd2('0x1c')](_0x7cd2('0x1f'),_0x10f3f5);for(var _0x5082c9 of _0xf1af17){var _0x38407b=path[_0x7cd2('0x6f')](config['root'],_0x7cd2('0xd3'),_0x7cd2('0xc3'),_0x7cd2('0xd4'),_0x7cd2('0xd5'),_0x5082c9[_0x7cd2('0x69')]);fs_extra['remove'](_0x38407b)[_0x7cd2('0x1f')](function(_0x5cfe75){logger['error'](_0x7cd2('0xea'),_0x38407b,_0x5cfe75);});}});};exports[_0x7cd2('0xeb')]=function(_0x2300c7,_0x101ac6){return db['ChatInteraction'][_0x7cd2('0x54')]({'where':{'id':_0x2300c7[_0x7cd2('0x4b')]['id']}})[_0x7cd2('0x16')](handleEntityNotFound(_0x101ac6,null))[_0x7cd2('0x16')](function(_0x11d086){if(_0x11d086){return _0x11d086[_0x7cd2('0xeb')](_0x2300c7[_0x7cd2('0x4f')][_0x7cd2('0x5e')],_[_0x7cd2('0xec')](_0x2300c7[_0x7cd2('0x4f')],[_0x7cd2('0x5e'),'id'])||{});}})[_0x7cd2('0x16')](respondWithResult(_0x101ac6,null))[_0x7cd2('0x1f')](handleError(_0x101ac6,null));};exports[_0x7cd2('0xed')]=function(_0x26091c,_0x538094){var _0x128dc0={'raw':![],'where':{}};var _0x405b81={};var _0x1e5620={'count':0x0,'rows':[]};return db[_0x7cd2('0x34')][_0x7cd2('0x62')]({'where':{'id':_0x26091c['params']['id']}})['then'](handleEntityNotFound(_0x538094,null))[_0x7cd2('0x16')](function(_0x5bdf9f){if(_0x5bdf9f){_0x405b81[_0x7cd2('0x38')]=_[_0x7cd2('0x3a')](db['ChatInteraction'][_0x7cd2('0x35')]);_0x405b81['query']=_['keys'](_0x26091c['query']);_0x405b81[_0x7cd2('0x3b')]=_[_0x7cd2('0x3c')](_0x405b81[_0x7cd2('0x38')],_0x405b81[_0x7cd2('0x39')]);_0x128dc0[_0x7cd2('0x3e')]=_[_0x7cd2('0x3c')](_0x405b81[_0x7cd2('0x38')],qs[_0x7cd2('0x3d')](_0x26091c[_0x7cd2('0x39')][_0x7cd2('0x3d')]));_0x128dc0[_0x7cd2('0x3e')]=_0x128dc0[_0x7cd2('0x3e')][_0x7cd2('0x3f')]?_0x128dc0[_0x7cd2('0x3e')]:_0x405b81['model'];if(!_0x26091c['query'][_0x7cd2('0x40')](_0x7cd2('0x5c'))){_0x128dc0['limit']=qs['limit'](_0x26091c[_0x7cd2('0x39')][_0x7cd2('0x41')]);_0x128dc0['offset']=qs['offset'](_0x26091c['query'][_0x7cd2('0x24')]);}_0x128dc0[_0x7cd2('0x63')]=qs[_0x7cd2('0x42')](_0x26091c[_0x7cd2('0x39')]['sort']);_0x128dc0[_0x7cd2('0x43')]=qs[_0x7cd2('0x3b')](_['pick'](_0x26091c['query'],_0x405b81[_0x7cd2('0x3b')]));_0x128dc0[_0x7cd2('0x43')]['ChatWebsiteId']=_0x5bdf9f['id'];if(_0x26091c[_0x7cd2('0x39')][_0x7cd2('0x44')]){_0x128dc0[_0x7cd2('0x43')]=_[_0x7cd2('0x4d')](_0x128dc0['where'],{'$or':_[_0x7cd2('0x33')](_0x128dc0[_0x7cd2('0x3e')],function(_0xe0bdca){var _0x59f724={};_0x59f724[_0xe0bdca]={'$like':'%'+_0x26091c[_0x7cd2('0x39')][_0x7cd2('0x44')]+'%'};return _0x59f724;})});}_0x128dc0=_[_0x7cd2('0x4d')]({},_0x128dc0,_0x26091c[_0x7cd2('0x46')]);return db[_0x7cd2('0xb0')][_0x7cd2('0x26')]({'where':_0x128dc0[_0x7cd2('0x43')]})[_0x7cd2('0x16')](function(_0x39d6e7){_0x1e5620[_0x7cd2('0x26')]=_0x39d6e7;if(_0x26091c[_0x7cd2('0x39')][_0x7cd2('0x47')]){_0x128dc0[_0x7cd2('0x4c')]=[{'model':db[_0x7cd2('0x88')],'as':_0x7cd2('0xee'),'required':![]},{'model':db[_0x7cd2('0xbc')],'as':'Owner','attributes':[_0x7cd2('0x2f'),_0x7cd2('0xef'),'internal'],'required':![]},{'model':db['Tag'],'as':_0x7cd2('0xf0'),'attributes':['id',_0x7cd2('0x2f'),_0x7cd2('0xf1')],'where':_0x26091c[_0x7cd2('0x39')]['tag']?{'id':_0x26091c[_0x7cd2('0x39')][_0x7cd2('0xf2')]}:undefined,'required':_0x26091c[_0x7cd2('0x39')]['tag']?!![]:![]}];}return db[_0x7cd2('0xb0')][_0x7cd2('0x48')](_0x128dc0);})[_0x7cd2('0x16')](function(_0x26be3b){_0x1e5620[_0x7cd2('0x49')]=_0x26be3b;return _0x1e5620;});}})[_0x7cd2('0x16')](respondWithFilteredResult(_0x538094,_0x128dc0))[_0x7cd2('0x1f')](handleError(_0x538094,null));};function iftimePromise(_0x3c77df,_0x5ab79d){return respondWithRpcPromise('Command',_0x7cd2('0xf3'),{'command':_0x5ab79d[_0x7cd2('0xf4')]?util[_0x7cd2('0xa9')](_0x7cd2('0xf5'),_0x3c77df['interval'],_0x5ab79d['timezone']):util['format'](_0x7cd2('0xf6'),_0x3c77df[_0x7cd2('0xf7')])},client9002)[_0x7cd2('0x16')](function(_0x20f10d){var _0x3c5cf9=_0x20f10d&&_0x20f10d[_0x7cd2('0xf8')]('true')>=0x0?!![]:![];logger[_0x7cd2('0x1e')](_0x7cd2('0xf9'),_0x5ab79d['id'],_0x3c77df['id'],_0x3c77df[_0x7cd2('0xf7')],_0x3c5cf9?_0x7cd2('0xfa'):_0x7cd2('0xfb'),_0x5ab79d[_0x7cd2('0xf4')]?_0x5ab79d[_0x7cd2('0xf4')]:_0x7cd2('0xfc'));return _0x3c5cf9;})[_0x7cd2('0x1f')](function(_0x5d85e3){logger[_0x7cd2('0x1c')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x5ab79d['id'],_0x3c77df['id'],_0x3c77df[_0x7cd2('0xf7')],util['inspect'](_0x5d85e3,{'showHidden':![],'depth':null}),_0x5ab79d[_0x7cd2('0xf4')]?_0x5ab79d[_0x7cd2('0xf4')]:_0x7cd2('0xfc'));return![];});}exports[_0x7cd2('0xf3')]=function(_0x5af50a,_0x50dc06){var _0xd28bf3=0x0;var _0x5b2510=0x0;var _0x53559a=![];var _0x175d8e;var _0xd366aa;return db['ChatWebsite'][_0x7cd2('0x54')]({'where':{'id':_0x5af50a['params']['id']},'include':[{'model':db[_0x7cd2('0xfd')],'as':'Interval','include':[{'model':db[_0x7cd2('0xfd')],'as':_0x7cd2('0xfe'),'attributes':['id',_0x7cd2('0xf7')],'raw':!![]}]}]})[_0x7cd2('0x16')](handleEntityNotFound(_0x50dc06,null))[_0x7cd2('0x16')](function(_0x509fa5){if(_0x509fa5){_0x175d8e=_0x509fa5;return _0x509fa5[_0x7cd2('0xff')]({'raw':!![]});}})[_0x7cd2('0x16')](function(_0x1b4c3a){if(_0x175d8e){if(_0x1b4c3a){_0xd366aa=_0x1b4c3a;}}return require(_0x7cd2('0x72'))[_0x7cd2('0x73')]();})[_0x7cd2('0x16')](function(_0x5205cc){if(_0x5205cc){_0x5b2510=_0x5205cc[_0x7cd2('0x100')];_0x53559a=_0x5205cc['custom'];}})[_0x7cd2('0x16')](function(){return db['ChatInteraction'][_0x7cd2('0x26')]({'where':{'closed':![]}});})[_0x7cd2('0x16')](function(_0x46d746){_0xd28bf3=_0x46d746;if(_0x5b2510&&_0x46d746>_0x5b2510){return db['License'][_0x7cd2('0x62')]({'where':{'id':0x1}})[_0x7cd2('0x16')](function(_0x1b5686){if(_0x1b5686){_0x1b5686[_0x7cd2('0x101')](_0x7cd2('0x102'));}});}})[_0x7cd2('0x16')](function(){if(_0x175d8e[_0x7cd2('0xfd')]&&_0x175d8e['Interval'][_0x7cd2('0xfe')]){var _0x1dfc20=[];for(var _0x47dc8b=0x0;_0x47dc8b<_0x175d8e[_0x7cd2('0xfd')][_0x7cd2('0xfe')]['length'];_0x47dc8b++){var _0x160069=_0x175d8e[_0x7cd2('0xfd')]['Intervals'][_0x47dc8b]['get']({'plain':!![]});_0x1dfc20[_0x7cd2('0xb8')](iftimePromise(_0x160069,_0x175d8e));}return BPromise[_0x7cd2('0x103')](_0x1dfc20)[_0x7cd2('0x16')](function(_0x14f2f5){return _[_0x7cd2('0x104')](_0x14f2f5);});}else{return!![];}})[_0x7cd2('0x16')](function(_0x5aabb8){var _0x39f73a=fs[_0x7cd2('0xcb')](path['join'](config[_0x7cd2('0x70')],_0x7cd2('0x105')),_0x7cd2('0xcc'));var _0x92ff24={'remote':_0x175d8e[_0x7cd2('0x106')],'query':querystring[_0x7cd2('0x1b')](_[_0x7cd2('0x4d')](_0x175d8e[_0x7cd2('0x2b')]({'plain':!![]}),{'customerIp':_0x5af50a[_0x7cd2('0x84')][_0x7cd2('0xa0')]||_0x5af50a['headers'][_0x7cd2('0x107')]||_0x5af50a[_0x7cd2('0x108')][_0x7cd2('0x109')]||_0x5af50a['ip'],'referer':_0x5af50a[_0x7cd2('0x84')][_0x7cd2('0xa6')],'openedInteractions':_0xd28bf3,'maxInteractions':_0x5b2510,'virtual':_0x53559a[_0x7cd2('0x100')],'online':_0x5aabb8,'custom':_0x53559a}))[_0x7cd2('0x10a')](/'/g,'\x5c\x27')};_0x50dc06[_0x7cd2('0xc4')](ejs[_0x7cd2('0xcd')](Mustache[_0x7cd2('0xcd')](_0x39f73a,_0x92ff24),{'proactiveActions':_0xd366aa,'alignment':_0x175d8e['alignment'],'verticalAlignment':_0x175d8e[_0x7cd2('0x10b')],'div_color':_0x175d8e[_0x7cd2('0xf1')],'labelText':_0x175d8e[_0x7cd2('0x10c')],'text_color':_0x175d8e[_0x7cd2('0x10d')],'text_button_color':_0x175d8e[_0x7cd2('0x10e')],'button_color':_0x175d8e[_0x7cd2('0x10f')],'background_color':_0x175d8e[_0x7cd2('0x110')],'hideWhenOffline':_0x175d8e['hideWhenOffline'],'interval':_0x175d8e[_0x7cd2('0x111')]}));})[_0x7cd2('0x1f')](handleError(_0x50dc06,null));};exports[_0x7cd2('0x112')]=function(_0x583771,_0x151aba){var _0x1e88dc=_0x583771[_0x7cd2('0x4b')]['id'];var _0x54757e=_0x583771['body'];var _0x2bb9c0=0xc8;var _0x12e3f2=null;return db[_0x7cd2('0x113')][_0x7cd2('0x114')]({'isolationLevel':db['sequelize'][_0x7cd2('0x115')][_0x7cd2('0x116')]['READ_COMMITTED']},function(_0x5d32e3){return db[_0x7cd2('0x34')][_0x7cd2('0x62')]({'where':{'id':_0x1e88dc},'transaction':_0x5d32e3})[_0x7cd2('0x16')](function(_0xfd4bd5){if(_0xfd4bd5){return db[_0x7cd2('0x117')]['destroy']({'where':{'ChatWebsiteId':_0x1e88dc},'transaction':_0x5d32e3})['then'](function(){var _0x363fc8=_[_0x7cd2('0x33')](_0x54757e,function(_0x3508b4){_0x3508b4[_0x7cd2('0x59')]=_0x1e88dc;return _0x3508b4;});return db[_0x7cd2('0x117')][_0x7cd2('0xd9')](_0x363fc8,{'transaction':_0x5d32e3});});}else{_0x2bb9c0=0x194;_0x12e3f2=[];}});})[_0x7cd2('0x16')](function(){if(_0x2bb9c0!==0x194){return db['ChatApplication']['findAndCountAll']({'where':{'ChatWebsiteId':_0x1e88dc},'order':_0x7cd2('0x118')})['then'](function(_0x54e751){_0x12e3f2=_0x54e751;});}})['catch'](function(_0x16f6ea){_0x2bb9c0=0x1f4;logger[_0x7cd2('0x1c')](_0x16f6ea[_0x7cd2('0x2e')]);if(_0x16f6ea[_0x7cd2('0x2f')]){delete _0x16f6ea[_0x7cd2('0x2f')];}_0x12e3f2=_0x16f6ea;})[_0x7cd2('0x119')](function(){if(_0x12e3f2===null){_0x151aba[_0x7cd2('0x20')](_0x2bb9c0);}else{if(_0x2bb9c0===0x1f4){_0x151aba[_0x7cd2('0x21')](_0x2bb9c0)['send'](_0x12e3f2);}else{_0x151aba['status'](_0x2bb9c0)[_0x7cd2('0x23')](_0x12e3f2);}}});};exports[_0x7cd2('0x11a')]=function(_0x1c8efd,_0x3c71d2){var _0xae75ad={};var _0x3abb51={};var _0x4e5cf5;var _0x5f01b2;return db[_0x7cd2('0x34')][_0x7cd2('0x62')]({'where':{'id':_0x1c8efd['params']['id']}})[_0x7cd2('0x16')](handleEntityNotFound(_0x3c71d2,null))[_0x7cd2('0x16')](function(_0xccc8df){if(_0xccc8df){_0x4e5cf5=_0xccc8df;_0x3abb51[_0x7cd2('0x38')]=_['keys'](db['ChatApplication'][_0x7cd2('0x35')]);_0x3abb51['query']=_[_0x7cd2('0x3a')](_0x1c8efd[_0x7cd2('0x39')]);_0x3abb51['filters']=_['intersection'](_0x3abb51[_0x7cd2('0x38')],_0x3abb51[_0x7cd2('0x39')]);_0xae75ad[_0x7cd2('0x3e')]=_[_0x7cd2('0x3c')](_0x3abb51['model'],qs['fields'](_0x1c8efd[_0x7cd2('0x39')][_0x7cd2('0x3d')]));_0xae75ad['attributes']=_0xae75ad[_0x7cd2('0x3e')][_0x7cd2('0x3f')]?_0xae75ad[_0x7cd2('0x3e')]:_0x3abb51[_0x7cd2('0x38')];_0xae75ad['order']=qs[_0x7cd2('0x42')](_0x1c8efd[_0x7cd2('0x39')][_0x7cd2('0x42')]);_0xae75ad[_0x7cd2('0x43')]=qs[_0x7cd2('0x3b')](_[_0x7cd2('0x64')](_0x1c8efd['query'],_0x3abb51[_0x7cd2('0x3b')]));if(_0x1c8efd[_0x7cd2('0x39')][_0x7cd2('0x44')]){_0xae75ad['where']=_['merge'](_0xae75ad[_0x7cd2('0x43')],{'$or':_[_0x7cd2('0x33')](_0xae75ad['attributes'],function(_0x5e051b){var _0x5a92b6={};_0x5a92b6[_0x5e051b]={'$like':'%'+_0x1c8efd[_0x7cd2('0x39')][_0x7cd2('0x44')]+'%'};return _0x5a92b6;})});}_0xae75ad=_[_0x7cd2('0x4d')]({},_0xae75ad,_0x1c8efd[_0x7cd2('0x46')]);return _0x4e5cf5[_0x7cd2('0x11a')](_0xae75ad);}})['then'](function(_0x51c05d){if(_0x51c05d){_0x5f01b2=_0x51c05d['length'];if(!_0x1c8efd[_0x7cd2('0x39')][_0x7cd2('0x40')](_0x7cd2('0x5c'))){_0xae75ad[_0x7cd2('0x41')]=qs[_0x7cd2('0x41')](_0x1c8efd[_0x7cd2('0x39')]['limit']);_0xae75ad['offset']=qs[_0x7cd2('0x24')](_0x1c8efd[_0x7cd2('0x39')]['offset']);}return _0x4e5cf5[_0x7cd2('0x11a')](_0xae75ad);}})[_0x7cd2('0x16')](function(_0x395864){if(_0x395864){return _0x395864?{'count':_0x5f01b2,'rows':_0x395864}:null;}})['then'](respondWithResult(_0x3c71d2,null))[_0x7cd2('0x1f')](handleError(_0x3c71d2,null));};exports[_0x7cd2('0x11b')]=function(_0x12c6e8,_0x5cfa7e){return db[_0x7cd2('0x11c')]['find']({'where':{'id':_0x12c6e8[_0x7cd2('0x4b')]['id']}})[_0x7cd2('0x16')](handleEntityNotFound(_0x5cfa7e,null))[_0x7cd2('0x16')](function(_0x127b3e){if(_0x127b3e){return _0x127b3e[_0x7cd2('0x11b')](_0x12c6e8[_0x7cd2('0x4f')]['ids'],_[_0x7cd2('0xec')](_0x12c6e8[_0x7cd2('0x4f')],[_0x7cd2('0x5e'),'id'])||{});}})[_0x7cd2('0x16')](respondWithResult(_0x5cfa7e,null))[_0x7cd2('0x1f')](handleError(_0x5cfa7e,null));};exports[_0x7cd2('0xff')]=function(_0xef147d,_0xb5a2a2){var _0x315788={};var _0x44a232={};var _0x34a414;var _0x39b14f;return db['ChatWebsite']['findOne']({'where':{'id':_0xef147d[_0x7cd2('0x4b')]['id']}})[_0x7cd2('0x16')](handleEntityNotFound(_0xb5a2a2,null))['then'](function(_0xc9c84e){if(_0xc9c84e){_0x34a414=_0xc9c84e;_0x44a232[_0x7cd2('0x38')]=_[_0x7cd2('0x3a')](db[_0x7cd2('0x11d')][_0x7cd2('0x35')]);_0x44a232[_0x7cd2('0x39')]=_[_0x7cd2('0x3a')](_0xef147d[_0x7cd2('0x39')]);_0x44a232[_0x7cd2('0x3b')]=_['intersection'](_0x44a232[_0x7cd2('0x38')],_0x44a232[_0x7cd2('0x39')]);_0x315788[_0x7cd2('0x3e')]=_[_0x7cd2('0x3c')](_0x44a232['model'],qs[_0x7cd2('0x3d')](_0xef147d['query'][_0x7cd2('0x3d')]));_0x315788['attributes']=_0x315788[_0x7cd2('0x3e')][_0x7cd2('0x3f')]?_0x315788[_0x7cd2('0x3e')]:_0x44a232['model'];_0x315788[_0x7cd2('0x63')]=qs[_0x7cd2('0x42')](_0xef147d['query'][_0x7cd2('0x42')]);_0x315788[_0x7cd2('0x43')]=qs[_0x7cd2('0x3b')](_[_0x7cd2('0x64')](_0xef147d['query'],_0x44a232[_0x7cd2('0x3b')]));if(_0xef147d[_0x7cd2('0x39')][_0x7cd2('0x44')]){_0x315788[_0x7cd2('0x43')]=_[_0x7cd2('0x4d')](_0x315788[_0x7cd2('0x43')],{'$or':_[_0x7cd2('0x33')](_0x315788[_0x7cd2('0x3e')],function(_0x598822){var _0xef4aa4={};_0xef4aa4[_0x598822]={'$like':'%'+_0xef147d[_0x7cd2('0x39')][_0x7cd2('0x44')]+'%'};return _0xef4aa4;})});}_0x315788=_[_0x7cd2('0x4d')]({},_0x315788,_0xef147d['options']);return _0x34a414[_0x7cd2('0xff')](_0x315788);}})['then'](function(_0x299e2c){if(_0x299e2c){_0x39b14f=_0x299e2c[_0x7cd2('0x3f')];if(!_0xef147d[_0x7cd2('0x39')][_0x7cd2('0x40')](_0x7cd2('0x5c'))){_0x315788[_0x7cd2('0x41')]=qs[_0x7cd2('0x41')](_0xef147d[_0x7cd2('0x39')][_0x7cd2('0x41')]);_0x315788[_0x7cd2('0x24')]=qs[_0x7cd2('0x24')](_0xef147d['query'][_0x7cd2('0x24')]);}return _0x34a414[_0x7cd2('0xff')](_0x315788);}})[_0x7cd2('0x16')](function(_0x297379){if(_0x297379){return _0x297379?{'count':_0x39b14f,'rows':_0x297379}:null;}})['then'](respondWithResult(_0xb5a2a2,null))['catch'](handleError(_0xb5a2a2,null));};exports[_0x7cd2('0x11e')]=function(_0x1175d7,_0x522bb9){var _0x2f98fa=_0x1175d7['query']['online']===_0x7cd2('0x11f')?'offlineForm':_0x7cd2('0x120');return db[_0x7cd2('0x34')]['find']({'attributes':['id',_0x2f98fa],'where':{'id':_0x1175d7[_0x7cd2('0x4b')]['id']}})[_0x7cd2('0x16')](handleEntityNotFound(_0x522bb9,null))[_0x7cd2('0x16')](function(_0x561ee5){if(_0x561ee5){var _0x5147b6=_0x561ee5[_0x2f98fa];var _0x20510c=_0x5147b6&&_0x5147b6[_0x7cd2('0x121')]?_0x5147b6[_0x7cd2('0x121')]:[];_0x522bb9[_0x7cd2('0xc4')]({'fromKey':_[_0x7cd2('0x75')](_0x5147b6[_0x7cd2('0x122')])?undefined:_0x5147b6[_0x7cd2('0x122')],'count':_0x20510c[_0x7cd2('0x3f')],'rows':_0x20510c});}})[_0x7cd2('0x1f')](handleError(_0x522bb9,null));};exports['getOfflineMessages']=function(_0x5bcd51,_0x3c9747){var _0x1c8bc8={'raw':![],'where':{}};var _0x59d3df={};var _0x42f372={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x7cd2('0x62')]({'where':{'id':_0x5bcd51[_0x7cd2('0x4b')]['id']}})[_0x7cd2('0x16')](handleEntityNotFound(_0x3c9747,null))['then'](function(_0x86513a){if(_0x86513a){_0x59d3df['model']=_['keys'](db[_0x7cd2('0x123')][_0x7cd2('0x35')]);_0x59d3df[_0x7cd2('0x39')]=_[_0x7cd2('0x3a')](_0x5bcd51[_0x7cd2('0x39')]);_0x59d3df[_0x7cd2('0x3b')]=_[_0x7cd2('0x3c')](_0x59d3df['model'],_0x59d3df[_0x7cd2('0x39')]);_0x1c8bc8[_0x7cd2('0x3e')]=_['intersection'](_0x59d3df[_0x7cd2('0x38')],qs['fields'](_0x5bcd51[_0x7cd2('0x39')][_0x7cd2('0x3d')]));_0x1c8bc8[_0x7cd2('0x3e')]=_0x1c8bc8[_0x7cd2('0x3e')]['length']?_0x1c8bc8[_0x7cd2('0x3e')]:_0x59d3df[_0x7cd2('0x38')];if(!_0x5bcd51['query'][_0x7cd2('0x40')](_0x7cd2('0x5c'))){_0x1c8bc8[_0x7cd2('0x41')]=qs['limit'](_0x5bcd51[_0x7cd2('0x39')][_0x7cd2('0x41')]);_0x1c8bc8[_0x7cd2('0x24')]=qs[_0x7cd2('0x24')](_0x5bcd51[_0x7cd2('0x39')]['offset']);}_0x1c8bc8[_0x7cd2('0x63')]=qs[_0x7cd2('0x42')](_0x5bcd51['query'][_0x7cd2('0x42')]);_0x1c8bc8[_0x7cd2('0x43')]=qs[_0x7cd2('0x3b')](_[_0x7cd2('0x64')](_0x5bcd51['query'],_0x59d3df[_0x7cd2('0x3b')]));_0x1c8bc8[_0x7cd2('0x43')][_0x7cd2('0x59')]=_0x86513a['id'];if(_0x5bcd51['query'][_0x7cd2('0x44')]){_0x1c8bc8[_0x7cd2('0x43')]=_[_0x7cd2('0x4d')](_0x1c8bc8[_0x7cd2('0x43')],{'$or':_[_0x7cd2('0x33')](_0x1c8bc8[_0x7cd2('0x3e')],function(_0x2aee4d){var _0x34f5cd={};_0x34f5cd[_0x2aee4d]={'$like':'%'+_0x5bcd51[_0x7cd2('0x39')][_0x7cd2('0x44')]+'%'};return _0x34f5cd;})});}_0x1c8bc8=_[_0x7cd2('0x4d')]({},_0x1c8bc8,_0x5bcd51[_0x7cd2('0x46')]);return db['ChatOfflineMessage']['count']({'where':_0x1c8bc8[_0x7cd2('0x43')]})[_0x7cd2('0x16')](function(_0x38a07e){_0x42f372[_0x7cd2('0x26')]=_0x38a07e;if(_0x5bcd51[_0x7cd2('0x39')][_0x7cd2('0x47')]){_0x1c8bc8['include']=[{'all':!![]}];}else{_0x1c8bc8[_0x7cd2('0x4c')]=[{'model':db['CmContact'],'as':_0x7cd2('0xee'),'required':![]},{'model':db['Attachment'],'as':_0x7cd2('0x124'),'required':![]}];}return db[_0x7cd2('0x123')][_0x7cd2('0x48')](_0x1c8bc8);})['then'](function(_0x5ea675){_0x42f372[_0x7cd2('0x49')]=_0x5ea675;return _0x42f372;});}})['then'](respondWithFilteredResult(_0x3c9747,_0x1c8bc8))[_0x7cd2('0x1f')](handleError(_0x3c9747,null));};exports[_0x7cd2('0x125')]=function(_0x626d28,_0x3c3a82){return db[_0x7cd2('0x34')][_0x7cd2('0x54')]({'where':{'id':_0x626d28[_0x7cd2('0x4b')]['id']}})[_0x7cd2('0x16')](handleEntityNotFound(_0x3c3a82,null))[_0x7cd2('0x16')](function(_0x12c5da){if(_0x12c5da){return _0x12c5da[_0x7cd2('0x125')](_0x626d28[_0x7cd2('0x4f')][_0x7cd2('0x5e')],_[_0x7cd2('0xec')](_0x626d28[_0x7cd2('0x4f')],['ids','id'])||{})['spread'](function(_0x33d6ae){for(var _0x2c86bf=0x0;_0x2c86bf<_0x626d28[_0x7cd2('0x4f')]['ids'][_0x7cd2('0x3f')];_0x2c86bf+=0x1){socket['emit'](_0x7cd2('0x126'),{'UserId':Number(_0x626d28[_0x7cd2('0x4f')][_0x7cd2('0x5e')][_0x2c86bf]),'ChatWebsiteId':Number(_0x626d28[_0x7cd2('0x4b')]['id'])});}return _0x33d6ae;});}})[_0x7cd2('0x16')](respondWithResult(_0x3c3a82,null))['catch'](handleError(_0x3c3a82,null));};exports['removeAgents']=function(_0x5916a7,_0x1716ba){return db[_0x7cd2('0x34')][_0x7cd2('0x54')]({'where':{'id':_0x5916a7['params']['id']}})['then'](handleEntityNotFound(_0x1716ba,null))[_0x7cd2('0x16')](function(_0x1f7853){if(_0x1f7853){return _0x1f7853['removeAgents'](_0x5916a7['query'][_0x7cd2('0x5e')])[_0x7cd2('0x16')](function(){if(_[_0x7cd2('0x127')](_0x5916a7[_0x7cd2('0x39')][_0x7cd2('0x5e')])){for(var _0x402a20=0x0;_0x402a20<_0x5916a7[_0x7cd2('0x39')][_0x7cd2('0x5e')][_0x7cd2('0x3f')];_0x402a20+=0x1){socket['emit'](_0x7cd2('0x128'),{'UserId':Number(_0x5916a7[_0x7cd2('0x39')][_0x7cd2('0x5e')][_0x402a20]),'ChatWebsiteId':Number(_0x5916a7[_0x7cd2('0x4b')]['id'])});}}else{socket['emit'](_0x7cd2('0x128'),{'UserId':Number(_0x5916a7[_0x7cd2('0x39')]['ids']),'ChatWebsiteId':Number(_0x5916a7[_0x7cd2('0x4b')]['id'])});}});}})[_0x7cd2('0x16')](respondWithStatusCode(_0x1716ba,null))[_0x7cd2('0x1f')](handleError(_0x1716ba,null));};exports[_0x7cd2('0x129')]=function(_0x19ed38,_0xcf900e){var _0x4e8925={};var _0x541b22={};var _0x273521;var _0x44f74a;return db[_0x7cd2('0x34')]['findOne']({'where':{'id':_0x19ed38[_0x7cd2('0x4b')]['id']}})[_0x7cd2('0x16')](handleEntityNotFound(_0xcf900e,null))[_0x7cd2('0x16')](function(_0x1e2d4c){if(_0x1e2d4c){_0x273521=_0x1e2d4c;_0x541b22[_0x7cd2('0x38')]=_['keys'](db['User']['rawAttributes']);_0x541b22[_0x7cd2('0x39')]=_['keys'](_0x19ed38[_0x7cd2('0x39')]);_0x541b22['filters']=_['intersection'](_0x541b22[_0x7cd2('0x38')],_0x541b22[_0x7cd2('0x39')]);_0x4e8925[_0x7cd2('0x3e')]=_[_0x7cd2('0x3c')](_0x541b22[_0x7cd2('0x38')],qs[_0x7cd2('0x3d')](_0x19ed38[_0x7cd2('0x39')][_0x7cd2('0x3d')]));_0x4e8925['attributes']=_0x4e8925[_0x7cd2('0x3e')][_0x7cd2('0x3f')]?_0x4e8925['attributes']:_0x541b22['model'];_0x4e8925[_0x7cd2('0x63')]=qs[_0x7cd2('0x42')](_0x19ed38[_0x7cd2('0x39')][_0x7cd2('0x42')]);_0x4e8925[_0x7cd2('0x43')]=qs[_0x7cd2('0x3b')](_[_0x7cd2('0x64')](_0x19ed38[_0x7cd2('0x39')],_0x541b22[_0x7cd2('0x3b')]));if(_0x19ed38['query'][_0x7cd2('0x44')]){_0x4e8925[_0x7cd2('0x43')]=_[_0x7cd2('0x4d')](_0x4e8925['where'],{'$or':_['map'](_0x4e8925['attributes'],function(_0x116c94){var _0x19896e={};_0x19896e[_0x116c94]={'$like':'%'+_0x19ed38[_0x7cd2('0x39')][_0x7cd2('0x44')]+'%'};return _0x19896e;})});}_0x4e8925=_['merge']({},_0x4e8925,_0x19ed38['options']);return _0x273521[_0x7cd2('0x129')](_0x4e8925);}})[_0x7cd2('0x16')](function(_0x9c1561){if(_0x9c1561){_0x44f74a=_0x9c1561[_0x7cd2('0x3f')];if(!_0x19ed38[_0x7cd2('0x39')][_0x7cd2('0x40')](_0x7cd2('0x5c'))){_0x4e8925['limit']=qs[_0x7cd2('0x41')](_0x19ed38['query'][_0x7cd2('0x41')]);_0x4e8925[_0x7cd2('0x24')]=qs[_0x7cd2('0x24')](_0x19ed38[_0x7cd2('0x39')][_0x7cd2('0x24')]);}return _0x273521['getAgents'](_0x4e8925);}})[_0x7cd2('0x16')](function(_0x1c82ed){if(_0x1c82ed){return _0x1c82ed?{'count':_0x44f74a,'rows':_0x1c82ed}:null;}})[_0x7cd2('0x16')](respondWithResult(_0xcf900e,null))[_0x7cd2('0x1f')](handleError(_0xcf900e,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index f68ed9d..795890d 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 _0x8743=['update','hasOwnProperty','hook','events','../../mysqldb','ChatWebsite','save'];(function(_0x51bcee,_0x3706c4){var _0x43a631=function(_0x4b1497){while(--_0x4b1497){_0x51bcee['push'](_0x51bcee['shift']());}};_0x43a631(++_0x3706c4);}(_0x8743,0x7a));var _0x3874=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x8743[_0x501510];return _0x1e6ee5;};'use strict';var EventEmitter=require(_0x3874('0x0'));var ChatWebsite=require(_0x3874('0x1'))['db'][_0x3874('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3874('0x3'),'afterUpdate':_0x3874('0x4'),'afterDestroy':'remove'};function emitEvent(_0x511fe6){return function(_0x35cd1b,_0x230e06,_0x17e25f){ChatWebsiteEvents['emit'](_0x511fe6+':'+_0x35cd1b['id'],_0x35cd1b);ChatWebsiteEvents['emit'](_0x511fe6,_0x35cd1b);_0x17e25f(null);};}for(var e in events){if(events[_0x3874('0x5')](e)){var event=events[e];ChatWebsite[_0x3874('0x6')](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file +var _0xd82a=['events','../../mysqldb','ChatWebsite','setMaxListeners','update','emit','hasOwnProperty','hook','exports'];(function(_0x3fcd68,_0x110de5){var _0x4521d7=function(_0x1c7380){while(--_0x1c7380){_0x3fcd68['push'](_0x3fcd68['shift']());}};_0x4521d7(++_0x110de5);}(_0xd82a,0xbd));var _0xad82=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0xd82a[_0x51020b];return _0x371e47;};'use strict';var EventEmitter=require(_0xad82('0x0'));var ChatWebsite=require(_0xad82('0x1'))['db'][_0xad82('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xad82('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xad82('0x4'),'afterDestroy':'remove'};function emitEvent(_0x17cf59){return function(_0x3a0a37,_0x40b3d6,_0x43a596){ChatWebsiteEvents[_0xad82('0x5')](_0x17cf59+':'+_0x3a0a37['id'],_0x3a0a37);ChatWebsiteEvents[_0xad82('0x5')](_0x17cf59,_0x3a0a37);_0x43a596(null);};}for(var e in events){if(events[_0xad82('0x6')](e)){var event=events[e];ChatWebsite[_0xad82('0x7')](e,emitEvent(event));}}module[_0xad82('0x8')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 7d29039..4968085 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 _0xeab2=['rimraf','../../config/environment','./chatWebsite.attributes','exports','ChatWebsite','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x21d2af,_0x3285bd){var _0x39bcf9=function(_0x379d02){while(--_0x379d02){_0x21d2af['push'](_0x21d2af['shift']());}};_0x39bcf9(++_0x3285bd);}(_0xeab2,0x149));var _0x2eab=function(_0x2cc8bb,_0x5f2607){_0x2cc8bb=_0x2cc8bb-0x0;var _0x140e40=_0xeab2[_0x2cc8bb];return _0x140e40;};'use strict';var _=require(_0x2eab('0x0'));var util=require(_0x2eab('0x1'));var logger=require(_0x2eab('0x2'))(_0x2eab('0x3'));var moment=require('moment');var BPromise=require(_0x2eab('0x4'));var rp=require(_0x2eab('0x5'));var fs=require('fs');var path=require(_0x2eab('0x6'));var rimraf=require(_0x2eab('0x7'));var config=require(_0x2eab('0x8'));var attributes=require(_0x2eab('0x9'));module[_0x2eab('0xa')]=function(_0x549823,_0xe257d1){return _0x549823['define'](_0x2eab('0xb'),attributes,{'tableName':'chat_websites','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x92a3=['request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes','exports','define','ChatWebsite','lodash','util','../../config/logger','api','moment'];(function(_0x6143dc,_0x1ffb4e){var _0x1fb65b=function(_0x5f058e){while(--_0x5f058e){_0x6143dc['push'](_0x6143dc['shift']());}};_0x1fb65b(++_0x1ffb4e);}(_0x92a3,0x174));var _0x392a=function(_0x37f220,_0xf0f4ba){_0x37f220=_0x37f220-0x0;var _0x52b81d=_0x92a3[_0x37f220];return _0x52b81d;};'use strict';var _=require(_0x392a('0x0'));var util=require(_0x392a('0x1'));var logger=require(_0x392a('0x2'))(_0x392a('0x3'));var moment=require(_0x392a('0x4'));var BPromise=require('bluebird');var rp=require(_0x392a('0x5'));var fs=require('fs');var path=require(_0x392a('0x6'));var rimraf=require(_0x392a('0x7'));var config=require(_0x392a('0x8'));var attributes=require(_0x392a('0x9'));module[_0x392a('0xa')]=function(_0x132f6d,_0x15b31f){return _0x132f6d[_0x392a('0xb')](_0x392a('0xc'),attributes,{'tableName':'chat_websites','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 6606670..8023ec3 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 _0x5467=['lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','then','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','info','result','catch'];(function(_0xab6a2b,_0x403a6b){var _0x33edba=function(_0x533c32){while(--_0x533c32){_0xab6a2b['push'](_0xab6a2b['shift']());}};_0x33edba(++_0x403a6b);}(_0x5467,0x91));var _0x7546=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0x5467[_0x28947d];return _0x12d2ee;};'use strict';var _=require(_0x7546('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7546('0x1'));var rs=require(_0x7546('0x2'));var fs=require('fs');var Redis=require(_0x7546('0x3'));var db=require(_0x7546('0x4'))['db'];var utils=require(_0x7546('0x5'));var logger=require(_0x7546('0x6'))('rpc');var config=require(_0x7546('0x7'));var jayson=require(_0x7546('0x8'));var client=jayson[_0x7546('0x9')][_0x7546('0xa')]({'port':0x232a});config[_0x7546('0xb')]=_[_0x7546('0xc')](config[_0x7546('0xb')],{'host':_0x7546('0xd'),'port':0x18eb});var socket=require(_0x7546('0xe'))(new Redis(config[_0x7546('0xb')]));require(_0x7546('0xf'))[_0x7546('0x10')](socket);function respondWithRpcPromise(_0x25cea8,_0x225173,_0x378e35){return new BPromise(function(_0x2958e5,_0x5f3467){return client['request'](_0x25cea8,_0x378e35)[_0x7546('0x11')](function(_0x2f7aea){logger['info']('ChatWebsite,\x20%s,\x20%s',_0x225173,'request\x20sent');logger[_0x7546('0x12')](_0x7546('0x13'),_0x225173,_0x7546('0x14'),JSON[_0x7546('0x15')](_0x2f7aea));if(_0x2f7aea[_0x7546('0x16')]){if(_0x2f7aea[_0x7546('0x16')][_0x7546('0x17')]===0x1f4){logger[_0x7546('0x16')](_0x7546('0x18'),_0x225173,_0x2f7aea[_0x7546('0x16')][_0x7546('0x19')]);return _0x5f3467(_0x2f7aea[_0x7546('0x16')][_0x7546('0x19')]);}logger['error'](_0x7546('0x18'),_0x225173,_0x2f7aea[_0x7546('0x16')][_0x7546('0x19')]);return _0x2958e5(_0x2f7aea[_0x7546('0x16')][_0x7546('0x19')]);}else{logger[_0x7546('0x1a')](_0x7546('0x18'),_0x225173,'request\x20sent');_0x2958e5(_0x2f7aea[_0x7546('0x1b')]['message']);}})[_0x7546('0x1c')](function(_0x2a12e7){logger[_0x7546('0x16')]('ChatWebsite,\x20%s,\x20%s',_0x225173,_0x2a12e7);_0x5f3467(_0x2a12e7);});});} \ No newline at end of file +var _0xd32b=['defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis'];(function(_0xa8929b,_0x4b6426){var _0x2f5ccf=function(_0x2ce9f3){while(--_0x2ce9f3){_0xa8929b['push'](_0xa8929b['shift']());}};_0x2f5ccf(++_0x4b6426);}(_0xd32b,0x1c0));var _0xbd32=function(_0x4b318e,_0x15fe4f){_0x4b318e=_0x4b318e-0x0;var _0x3b6a2f=_0xd32b[_0x4b318e];return _0x3b6a2f;};'use strict';var _=require(_0xbd32('0x0'));var util=require(_0xbd32('0x1'));var moment=require(_0xbd32('0x2'));var BPromise=require(_0xbd32('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xbd32('0x4'));var logger=require(_0xbd32('0x5'))(_0xbd32('0x6'));var config=require(_0xbd32('0x7'));var jayson=require(_0xbd32('0x8'));var client=jayson[_0xbd32('0x9')]['http']({'port':0x232a});config[_0xbd32('0xa')]=_[_0xbd32('0xb')](config[_0xbd32('0xa')],{'host':_0xbd32('0xc'),'port':0x18eb});var socket=require(_0xbd32('0xd'))(new Redis(config[_0xbd32('0xa')]));require(_0xbd32('0xe'))[_0xbd32('0xf')](socket);function respondWithRpcPromise(_0x26329d,_0x24c033,_0x1b7b55){return new BPromise(function(_0x40510c,_0x31f910){return client['request'](_0x26329d,_0x1b7b55)[_0xbd32('0x10')](function(_0x27d9da){logger[_0xbd32('0x11')](_0xbd32('0x12'),_0x24c033,_0xbd32('0x13'));logger['debug'](_0xbd32('0x14'),_0x24c033,'request\x20sent',JSON[_0xbd32('0x15')](_0x27d9da));if(_0x27d9da['error']){if(_0x27d9da['error'][_0xbd32('0x16')]===0x1f4){logger[_0xbd32('0x17')](_0xbd32('0x12'),_0x24c033,_0x27d9da[_0xbd32('0x17')][_0xbd32('0x18')]);return _0x31f910(_0x27d9da['error'][_0xbd32('0x18')]);}logger[_0xbd32('0x17')]('ChatWebsite,\x20%s,\x20%s',_0x24c033,_0x27d9da[_0xbd32('0x17')][_0xbd32('0x18')]);return _0x40510c(_0x27d9da[_0xbd32('0x17')]['message']);}else{logger[_0xbd32('0x11')](_0xbd32('0x12'),_0x24c033,_0xbd32('0x13'));_0x40510c(_0x27d9da[_0xbd32('0x19')][_0xbd32('0x18')]);}})[_0xbd32('0x1a')](function(_0x36894c){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x24c033,_0x36894c);_0x31f910(_0x36894c);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 8957413..9574eb5 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 _0x3294=['length','chatWebsite:','./chatWebsite.events','save','remove','update','emit','register'];(function(_0x163386,_0x3af94f){var _0x2df3e2=function(_0x1ef691){while(--_0x1ef691){_0x163386['push'](_0x163386['shift']());}};_0x2df3e2(++_0x3af94f);}(_0x3294,0x1da));var _0x4329=function(_0x709fff,_0x365daf){_0x709fff=_0x709fff-0x0;var _0x591717=_0x3294[_0x709fff];return _0x591717;};'use strict';var ChatWebsiteEvents=require(_0x4329('0x0'));var events=[_0x4329('0x1'),_0x4329('0x2'),_0x4329('0x3')];function createListener(_0x5a9d67,_0x49fe30){return function(_0x4ed992){_0x49fe30[_0x4329('0x4')](_0x5a9d67,_0x4ed992);};}function removeListener(_0xa2512d,_0x3c99be){return function(){ChatWebsiteEvents['removeListener'](_0xa2512d,_0x3c99be);};}exports[_0x4329('0x5')]=function(_0x1265f5){for(var _0x3cf176=0x0,_0x5c7cb3=events[_0x4329('0x6')];_0x3cf176<_0x5c7cb3;_0x3cf176++){var _0x3d9f0a=events[_0x3cf176];var _0x2aacec=createListener(_0x4329('0x7')+_0x3d9f0a,_0x1265f5);ChatWebsiteEvents['on'](_0x3d9f0a,_0x2aacec);}}; \ No newline at end of file +var _0xd7e7=['chatWebsite:','./chatWebsite.events','remove','update','emit','removeListener','register','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd7e7,0x111));var _0x7d7e=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xd7e7[_0x42cae2];return _0x5f256f;};'use strict';var ChatWebsiteEvents=require(_0x7d7e('0x0'));var events=['save',_0x7d7e('0x1'),_0x7d7e('0x2')];function createListener(_0x20f383,_0x2e69a8){return function(_0x222b70){_0x2e69a8[_0x7d7e('0x3')](_0x20f383,_0x222b70);};}function removeListener(_0xba6244,_0x367a3b){return function(){ChatWebsiteEvents[_0x7d7e('0x4')](_0xba6244,_0x367a3b);};}exports[_0x7d7e('0x5')]=function(_0x136250){for(var _0x33e251=0x0,_0x3299b9=events[_0x7d7e('0x6')];_0x33e251<_0x3299b9;_0x33e251++){var _0x2113f2=events[_0x33e251];var _0x423bd6=createListener(_0x7d7e('0x7')+_0x2113f2,_0x136250);ChatWebsiteEvents['on'](_0x2113f2,_0x423bd6);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 1cb96d5..434883e 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 _0xf00c=['destroy','delete','removeDispositions','/:id/canned_answers','removeAnswers','removeAgents','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatWebsite.controller','get','isAuthenticated','describe','show','/:id/dispositions','getDispositions','getAnswers','/:id/logo','getLogo','/:id/avatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','getProactiveActions','/:id/offline_messages','/:id/users','getAgents','post','create','addDisposition','addAnswer','diskStorage','root','server/files/images/logos/','format','%s-%s','originalname','single','join','server/files/images/avatars/','now','file','addAvatar','addSystemAvatar','attachments','offline-chat','replace','extname','/:id/offline','offline','addInteraction','addApplications','/:id/proactive_actions','addProactiveActions','addAgents','/:id','update'];(function(_0x725b8e,_0xc22b48){var _0x43ac45=function(_0x46bb4a){while(--_0x46bb4a){_0x725b8e['push'](_0x725b8e['shift']());}};_0x43ac45(++_0xc22b48);}(_0xf00c,0x1e9));var _0xcf00=function(_0x5375ae,_0x4ef5c7){_0x5375ae=_0x5375ae-0x0;var _0x357f37=_0xf00c[_0x5375ae];return _0x357f37;};'use strict';var multer=require(_0xcf00('0x0'));var util=require(_0xcf00('0x1'));var path=require(_0xcf00('0x2'));var timeout=require('connect-timeout');var express=require(_0xcf00('0x3'));var router=express[_0xcf00('0x4')]();var fs_extra=require(_0xcf00('0x5'));var auth=require(_0xcf00('0x6'));var interaction=require(_0xcf00('0x7'));var config=require('../../config/environment');var controller=require(_0xcf00('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xcf00('0x9')]('/describe',auth[_0xcf00('0xa')](),controller[_0xcf00('0xb')]);router[_0xcf00('0x9')]('/:id',auth[_0xcf00('0xa')](),controller[_0xcf00('0xc')]);router[_0xcf00('0x9')](_0xcf00('0xd'),auth[_0xcf00('0xa')](),controller[_0xcf00('0xe')]);router['get']('/:id/canned_answers',auth[_0xcf00('0xa')](),controller[_0xcf00('0xf')]);router['get'](_0xcf00('0x10'),controller[_0xcf00('0x11')]);router[_0xcf00('0x9')](_0xcf00('0x12'),controller['getAvatar']);router['get'](_0xcf00('0x13'),controller[_0xcf00('0x14')]);router[_0xcf00('0x9')](_0xcf00('0x15'),controller[_0xcf00('0x16')]);router[_0xcf00('0x9')](_0xcf00('0x17'),auth[_0xcf00('0xa')](),controller[_0xcf00('0x18')]);router[_0xcf00('0x9')](_0xcf00('0x19'),controller[_0xcf00('0x1a')]);router[_0xcf00('0x9')](_0xcf00('0x1b'),auth[_0xcf00('0xa')](),controller[_0xcf00('0x1c')]);router[_0xcf00('0x9')]('/:id/proactive_actions',auth[_0xcf00('0xa')](),controller[_0xcf00('0x1d')]);router[_0xcf00('0x9')]('/:id/fields',controller['getFields']);router[_0xcf00('0x9')](_0xcf00('0x1e'),auth[_0xcf00('0xa')](),controller['getOfflineMessages']);router[_0xcf00('0x9')](_0xcf00('0x1f'),auth[_0xcf00('0xa')](),controller[_0xcf00('0x20')]);router[_0xcf00('0x21')]('/',auth['isAuthenticated'](),controller[_0xcf00('0x22')]);router[_0xcf00('0x21')](_0xcf00('0xd'),auth[_0xcf00('0xa')](),controller[_0xcf00('0x23')]);router[_0xcf00('0x21')]('/:id/canned_answers',auth[_0xcf00('0xa')](),controller[_0xcf00('0x24')]);var upload=multer({'storage':multer[_0xcf00('0x25')]({'destination':function(_0x18fc4c,_0x333103,_0x2ade38){_0x2ade38(null,path['join'](config[_0xcf00('0x26')],_0xcf00('0x27')));},'filename':function(_0x34259f,_0x17d5d8,_0x308ca5){_0x308ca5(null,util[_0xcf00('0x28')](_0xcf00('0x29'),Date['now'](),_0x17d5d8[_0xcf00('0x2a')]));}})});router[_0xcf00('0x21')](_0xcf00('0x10'),upload[_0xcf00('0x2b')]('file'),controller['addLogo']);var upload=multer({'storage':multer[_0xcf00('0x25')]({'destination':function(_0x1d1629,_0x199484,_0x5eb0b2){_0x5eb0b2(null,path[_0xcf00('0x2c')](config['root'],_0xcf00('0x2d')));},'filename':function(_0x1ca305,_0x546fae,_0x2764c3){_0x2764c3(null,util[_0xcf00('0x28')](_0xcf00('0x29'),Date[_0xcf00('0x2e')](),_0x546fae[_0xcf00('0x2a')]));}})});router[_0xcf00('0x21')](_0xcf00('0x12'),upload[_0xcf00('0x2b')](_0xcf00('0x2f')),controller[_0xcf00('0x30')]);var upload=multer({'storage':multer[_0xcf00('0x25')]({'destination':function(_0x36bc8e,_0x57ed8f,_0x33203f){_0x33203f(null,path[_0xcf00('0x2c')](config[_0xcf00('0x26')],_0xcf00('0x2d')));},'filename':function(_0x47953e,_0x1d604c,_0x291246){_0x291246(null,util[_0xcf00('0x28')](_0xcf00('0x29'),Date[_0xcf00('0x2e')](),_0x1d604c['originalname']));}})});router[_0xcf00('0x21')](_0xcf00('0x13'),upload[_0xcf00('0x2b')](_0xcf00('0x2f')),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0xcf00('0x25')]({'destination':function(_0x3f983d,_0x10c840,_0x14ec37){_0x14ec37(null,path['join'](config[_0xcf00('0x26')],_0xcf00('0x2d')));},'filename':function(_0x153732,_0x755e6b,_0x475652){_0x475652(null,util[_0xcf00('0x28')](_0xcf00('0x29'),Date['now'](),_0x755e6b['originalname']));}})});router[_0xcf00('0x21')](_0xcf00('0x15'),upload[_0xcf00('0x2b')](_0xcf00('0x2f')),controller[_0xcf00('0x31')]);router['post']('/:id/notify',controller['notify']);const offlineUploadMulter=multer({'storage':multer[_0xcf00('0x25')]({'destination':function(_0x2ad0b9,_0x52ebca,_0x16d1ff){const _0x102656=path[_0xcf00('0x2c')](config['root'],'server/files',_0xcf00('0x32'),_0xcf00('0x33'));fs_extra['ensureDir'](_0x102656,function(){_0x16d1ff(null,_0x102656);});},'filename':function(_0x50992d,_0x2e048b,_0x114bdc){const _0x54fa87=_0x2e048b['originalname'][_0xcf00('0x34')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x1d1350=path[_0xcf00('0x35')](_0x54fa87);const _0x1a940d=Date[_0xcf00('0x2e')]()+'-'+_0x54fa87['replace'](_0x1d1350,'')+_0x1d1350;_0x114bdc(null,_0x1a940d);}})});router['post'](_0xcf00('0x36'),offlineUploadMulter['any'](),controller[_0xcf00('0x37')]);router[_0xcf00('0x21')](_0xcf00('0x17'),auth[_0xcf00('0xa')](),controller[_0xcf00('0x38')]);router[_0xcf00('0x21')](_0xcf00('0x1b'),auth[_0xcf00('0xa')](),controller[_0xcf00('0x39')]);router[_0xcf00('0x21')](_0xcf00('0x3a'),auth[_0xcf00('0xa')](),controller[_0xcf00('0x3b')]);router['post'](_0xcf00('0x1f'),auth[_0xcf00('0xa')](),controller[_0xcf00('0x3c')]);router['put'](_0xcf00('0x3d'),auth[_0xcf00('0xa')](),controller[_0xcf00('0x3e')]);router['delete'](_0xcf00('0x3d'),auth[_0xcf00('0xa')](),controller[_0xcf00('0x3f')]);router[_0xcf00('0x40')](_0xcf00('0xd'),auth[_0xcf00('0xa')](),controller[_0xcf00('0x41')]);router[_0xcf00('0x40')](_0xcf00('0x42'),auth[_0xcf00('0xa')](),controller[_0xcf00('0x43')]);router[_0xcf00('0x40')](_0xcf00('0x1f'),auth['isAuthenticated'](),controller[_0xcf00('0x44')]);module['exports']=router; \ No newline at end of file +var _0xcc35=['getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/proactive_actions','getProactiveActions','/:id/fields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','create','addDisposition','diskStorage','join','root','server/files/images/logos/','format','%s-%s','now','originalname','single','addLogo','server/files/images/avatars/','addAvatar','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','server/files','attachments','offline-chat','ensureDir','replace','offline','addInteraction','/:id/applications','addApplications','addAgents','put','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar'];(function(_0x4f8a16,_0x35acb3){var _0x4c1c46=function(_0x483ae3){while(--_0x483ae3){_0x4f8a16['push'](_0x4f8a16['shift']());}};_0x4c1c46(++_0x35acb3);}(_0xcc35,0xc1));var _0x5cc3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcc35[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x5cc3('0x0'));var util=require(_0x5cc3('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5cc3('0x2')]();var fs_extra=require(_0x5cc3('0x3'));var auth=require(_0x5cc3('0x4'));var interaction=require(_0x5cc3('0x5'));var config=require(_0x5cc3('0x6'));var controller=require('./chatWebsite.controller');router[_0x5cc3('0x7')]('/',auth[_0x5cc3('0x8')](),controller[_0x5cc3('0x9')]);router[_0x5cc3('0x7')](_0x5cc3('0xa'),auth[_0x5cc3('0x8')](),controller['describe']);router[_0x5cc3('0x7')](_0x5cc3('0xb'),auth[_0x5cc3('0x8')](),controller[_0x5cc3('0xc')]);router[_0x5cc3('0x7')](_0x5cc3('0xd'),auth[_0x5cc3('0x8')](),controller[_0x5cc3('0xe')]);router[_0x5cc3('0x7')](_0x5cc3('0xf'),auth[_0x5cc3('0x8')](),controller[_0x5cc3('0x10')]);router['get'](_0x5cc3('0x11'),controller[_0x5cc3('0x12')]);router[_0x5cc3('0x7')](_0x5cc3('0x13'),controller[_0x5cc3('0x14')]);router[_0x5cc3('0x7')](_0x5cc3('0x15'),controller[_0x5cc3('0x16')]);router[_0x5cc3('0x7')](_0x5cc3('0x17'),controller[_0x5cc3('0x18')]);router['get'](_0x5cc3('0x19'),auth['isAuthenticated'](),controller[_0x5cc3('0x1a')]);router[_0x5cc3('0x7')]('/:id/snippet',controller['getSnippet']);router[_0x5cc3('0x7')]('/:id/applications',auth[_0x5cc3('0x8')](),controller['getApplications']);router[_0x5cc3('0x7')](_0x5cc3('0x1b'),auth['isAuthenticated'](),controller[_0x5cc3('0x1c')]);router[_0x5cc3('0x7')](_0x5cc3('0x1d'),controller['getFields']);router['get'](_0x5cc3('0x1e'),auth[_0x5cc3('0x8')](),controller[_0x5cc3('0x1f')]);router[_0x5cc3('0x7')](_0x5cc3('0x20'),auth[_0x5cc3('0x8')](),controller[_0x5cc3('0x21')]);router[_0x5cc3('0x22')]('/',auth[_0x5cc3('0x8')](),controller[_0x5cc3('0x23')]);router[_0x5cc3('0x22')](_0x5cc3('0xd'),auth[_0x5cc3('0x8')](),controller[_0x5cc3('0x24')]);router[_0x5cc3('0x22')](_0x5cc3('0xf'),auth[_0x5cc3('0x8')](),controller['addAnswer']);var upload=multer({'storage':multer[_0x5cc3('0x25')]({'destination':function(_0x51fd45,_0x3fe1a0,_0x1f1ea0){_0x1f1ea0(null,path[_0x5cc3('0x26')](config[_0x5cc3('0x27')],_0x5cc3('0x28')));},'filename':function(_0x428015,_0xb90809,_0x177c47){_0x177c47(null,util[_0x5cc3('0x29')](_0x5cc3('0x2a'),Date[_0x5cc3('0x2b')](),_0xb90809[_0x5cc3('0x2c')]));}})});router['post'](_0x5cc3('0x11'),upload[_0x5cc3('0x2d')]('file'),controller[_0x5cc3('0x2e')]);var upload=multer({'storage':multer[_0x5cc3('0x25')]({'destination':function(_0x13fe3d,_0x252ab9,_0x2501b0){_0x2501b0(null,path[_0x5cc3('0x26')](config[_0x5cc3('0x27')],_0x5cc3('0x2f')));},'filename':function(_0x63c5b3,_0x490acc,_0x4a0c36){_0x4a0c36(null,util[_0x5cc3('0x29')]('%s-%s',Date[_0x5cc3('0x2b')](),_0x490acc[_0x5cc3('0x2c')]));}})});router[_0x5cc3('0x22')](_0x5cc3('0x13'),upload['single']('file'),controller[_0x5cc3('0x30')]);var upload=multer({'storage':multer[_0x5cc3('0x25')]({'destination':function(_0x14a6e6,_0x37820d,_0x2781d4){_0x2781d4(null,path[_0x5cc3('0x26')](config[_0x5cc3('0x27')],_0x5cc3('0x2f')));},'filename':function(_0x3e2ba5,_0x404306,_0x3abeb7){_0x3abeb7(null,util[_0x5cc3('0x29')](_0x5cc3('0x2a'),Date[_0x5cc3('0x2b')](),_0x404306[_0x5cc3('0x2c')]));}})});router[_0x5cc3('0x22')](_0x5cc3('0x15'),upload[_0x5cc3('0x2d')]('file'),controller[_0x5cc3('0x31')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x53452b,_0x3fbd0f,_0x53ae56){_0x53ae56(null,path['join'](config['root'],_0x5cc3('0x2f')));},'filename':function(_0x6fc2ae,_0x5775f5,_0x565fcb){_0x565fcb(null,util[_0x5cc3('0x29')](_0x5cc3('0x2a'),Date[_0x5cc3('0x2b')](),_0x5775f5[_0x5cc3('0x2c')]));}})});router['post'](_0x5cc3('0x17'),upload[_0x5cc3('0x2d')]('file'),controller[_0x5cc3('0x32')]);router[_0x5cc3('0x22')](_0x5cc3('0x33'),controller[_0x5cc3('0x34')]);const offlineUploadMulter=multer({'storage':multer[_0x5cc3('0x25')]({'destination':function(_0x105be0,_0x306292,_0x4a10b1){const _0x2f8bfe=path['join'](config[_0x5cc3('0x27')],_0x5cc3('0x35'),_0x5cc3('0x36'),_0x5cc3('0x37'));fs_extra[_0x5cc3('0x38')](_0x2f8bfe,function(){_0x4a10b1(null,_0x2f8bfe);});},'filename':function(_0xa6fa15,_0x449296,_0x29a456){const _0x13787f=_0x449296[_0x5cc3('0x2c')][_0x5cc3('0x39')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x33a683=path['extname'](_0x13787f);const _0x382866=Date[_0x5cc3('0x2b')]()+'-'+_0x13787f[_0x5cc3('0x39')](_0x33a683,'')+_0x33a683;_0x29a456(null,_0x382866);}})});router[_0x5cc3('0x22')]('/:id/offline',offlineUploadMulter['any'](),controller[_0x5cc3('0x3a')]);router[_0x5cc3('0x22')]('/:id/interactions',auth[_0x5cc3('0x8')](),controller[_0x5cc3('0x3b')]);router[_0x5cc3('0x22')](_0x5cc3('0x3c'),auth['isAuthenticated'](),controller[_0x5cc3('0x3d')]);router[_0x5cc3('0x22')](_0x5cc3('0x1b'),auth[_0x5cc3('0x8')](),controller['addProactiveActions']);router[_0x5cc3('0x22')](_0x5cc3('0x20'),auth['isAuthenticated'](),controller[_0x5cc3('0x3e')]);router[_0x5cc3('0x3f')](_0x5cc3('0xb'),auth[_0x5cc3('0x8')](),controller[_0x5cc3('0x40')]);router['delete'](_0x5cc3('0xb'),auth['isAuthenticated'](),controller[_0x5cc3('0x41')]);router[_0x5cc3('0x42')](_0x5cc3('0xd'),auth['isAuthenticated'](),controller[_0x5cc3('0x43')]);router['delete'](_0x5cc3('0xf'),auth[_0x5cc3('0x8')](),controller[_0x5cc3('0x44')]);router['delete'](_0x5cc3('0x20'),auth['isAuthenticated'](),controller[_0x5cc3('0x45')]);module[_0x5cc3('0x46')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index 82e9972..6107a3f 100644 --- a/server/api/client-side-logs.js +++ b/server/api/client-side-logs.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x85dd=['app','get','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs','use','exports','express','../components/auth/service','../config/environment','Router','env','production'];(function(_0x7a1a95,_0x3f1f79){var _0x401748=function(_0x108c28){while(--_0x108c28){_0x7a1a95['push'](_0x7a1a95['shift']());}};_0x401748(++_0x3f1f79);}(_0x85dd,0x14a));var _0xd85d=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x85dd[_0x432682];return _0x463d05;};var beaverLogger=require('beaver-logger/server');var express=require(_0xd85d('0x0'));var auth=require(_0xd85d('0x1'));var config=require(_0xd85d('0x2'));var router=express[_0xd85d('0x3')]();var isProduction=config[_0xd85d('0x4')]===_0xd85d('0x5')||![];function clientSideLogs(_0x91f8a2,_0x57610e,_0xc16663){var _0x11a8b7=_0x91f8a2[_0xd85d('0x6')][_0xd85d('0x7')](_0xd85d('0x8'));if(!_0x11a8b7){throw new Error(_0xd85d('0x9'));}return beaverLogger[_0xd85d('0xa')]({'uri':_0xd85d('0xb'),'logger':_0x11a8b7,'enableCors':!isProduction})(_0x91f8a2,_0x57610e,_0xc16663);}router[_0xd85d('0xc')](auth['isAuthenticated'](),clientSideLogs);module[_0xd85d('0xd')]=router; \ No newline at end of file +var _0x1329=['app','get','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','use','isAuthenticated','exports','beaver-logger/server','../components/auth/service','../config/environment','Router','env'];(function(_0x499e72,_0x2618c8){var _0x456522=function(_0x372456){while(--_0x372456){_0x499e72['push'](_0x499e72['shift']());}};_0x456522(++_0x2618c8);}(_0x1329,0x140));var _0x9132=function(_0x139f28,_0x5956b9){_0x139f28=_0x139f28-0x0;var _0x5420c9=_0x1329[_0x139f28];return _0x5420c9;};var beaverLogger=require(_0x9132('0x0'));var express=require('express');var auth=require(_0x9132('0x1'));var config=require(_0x9132('0x2'));var router=express[_0x9132('0x3')]();var isProduction=config[_0x9132('0x4')]==='production'||![];function clientSideLogs(_0x57fba0,_0x22a68b,_0x194aec){var _0x355ee4=_0x57fba0[_0x9132('0x5')][_0x9132('0x6')](_0x9132('0x7'));if(!_0x355ee4){throw new Error(_0x9132('0x8'));}return beaverLogger[_0x9132('0x9')]({'uri':'/client-logs','logger':_0x355ee4,'enableCors':!isProduction})(_0x57fba0,_0x22a68b,_0x194aec);}router[_0x9132('0xa')](auth[_0x9132('0xb')](),clientSideLogs);module[_0x9132('0xc')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 5cdbff1..d82f721 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 _0x1626=['MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','STRING','AmazonAWS','ENUM','Dynamics365','TEXT'];(function(_0x2a94c0,_0x6f7914){var _0x39296f=function(_0x559af1){while(--_0x559af1){_0x2a94c0['push'](_0x2a94c0['shift']());}};_0x39296f(++_0x6f7914);}(_0x1626,0x12b));var _0x6162=function(_0x55d58f,_0x2bea83){_0x55d58f=_0x55d58f-0x0;var _0x1ad6e6=_0x1626[_0x55d58f];return _0x1ad6e6;};'use strict';var Sequelize=require(_0x6162('0x0'));module[_0x6162('0x1')]={'name':{'type':Sequelize[_0x6162('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM'](_0x6162('0x3'),'Google','MicrosoftAzure'),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x6162('0x4')]('Outlook365',_0x6162('0x5'))},'data1':{'type':Sequelize[_0x6162('0x2')],'comment':'MicrosoftAzure\x20=>\x20client_id'},'data2':{'type':Sequelize[_0x6162('0x2')],'comment':'MicrosoftAzure\x20=>\x20tenant'},'data3':{'type':Sequelize['STRING'],'comment':'MicrosoftAzure\x20=>\x20client_secret'},'data4':{'type':Sequelize[_0x6162('0x2')],'comment':'MicrosoftAzure\x20=>\x20redirect_uri'},'data5':{'type':Sequelize['TEXT'],'comment':'MicrosoftAzure\x20=>\x20access_token'},'data6':{'type':Sequelize[_0x6162('0x6')],'comment':_0x6162('0x7')},'data7':{'type':Sequelize[_0x6162('0x6')],'comment':_0x6162('0x8')}}; \ No newline at end of file +var _0xcf63=['AmazonAWS','MicrosoftAzure','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','STRING','ENUM'];(function(_0x3df249,_0x1d0c54){var _0x15ad5b=function(_0x1432c3){while(--_0x1432c3){_0x3df249['push'](_0x3df249['shift']());}};_0x15ad5b(++_0x1d0c54);}(_0xcf63,0xc1));var _0x3cf6=function(_0x484473,_0x38314e){_0x484473=_0x484473-0x0;var _0x5f5914=_0xcf63[_0x484473];return _0x5f5914;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3cf6('0x0')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x3cf6('0x1')](_0x3cf6('0x2'),'Google',_0x3cf6('0x3')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x3cf6('0x4'),_0x3cf6('0x5'))},'data1':{'type':Sequelize[_0x3cf6('0x0')],'comment':_0x3cf6('0x6')},'data2':{'type':Sequelize['STRING'],'comment':'MicrosoftAzure\x20=>\x20tenant'},'data3':{'type':Sequelize[_0x3cf6('0x0')],'comment':_0x3cf6('0x7')},'data4':{'type':Sequelize[_0x3cf6('0x0')],'comment':_0x3cf6('0x8')},'data5':{'type':Sequelize[_0x3cf6('0x9')],'comment':_0x3cf6('0xa')},'data6':{'type':Sequelize[_0x3cf6('0x9')],'comment':_0x3cf6('0xb')},'data7':{'type':Sequelize[_0x3cf6('0x9')],'comment':_0x3cf6('0xc')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index e785813..b1844f6 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 _0xcd0a=['state','parse','from','base64','toString','ascii','isValidIdToken','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','code','data5','access_token','data6','refresh_token','startRefreshInterval','emit','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','../../components/encryptor','../../config/environment','../../config/logger','../../mysqldb','redis','defaults','localhost','socket.io-emitter','status','json','offset','limit','undefined','then','destroy','sendStatus','stack','name','send','padEnd','slice','index','map','CloudProvider','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','count','findAll','rows','decryptString','catch','show','rawAttributes','length','includeAll','find','service','data3','create','Name\x20parameter\x20not\x20specified','body','Service\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','MicrosoftAzure','encryptString','params','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','error','get'];(function(_0x45b2b8,_0x2ad5f0){var _0x125c87=function(_0x27ac50){while(--_0x27ac50){_0x45b2b8['push'](_0x45b2b8['shift']());}};_0x125c87(++_0x2ad5f0);}(_0xcd0a,0x1ed));var _0xacd0=function(_0x44d88c,_0x4e0cb4){_0x44d88c=_0x44d88c-0x0;var _0x508da7=_0xcd0a[_0x44d88c];return _0x508da7;};'use strict';var _=require('lodash');var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var encryptor=require(_0xacd0('0x0'));var config=require(_0xacd0('0x1'));var logger=require(_0xacd0('0x2'))('api');var db=require(_0xacd0('0x3'))['db'];var oauth=require('./cloudProvider.oauth');config[_0xacd0('0x4')]=_[_0xacd0('0x5')](config[_0xacd0('0x4')],{'host':_0xacd0('0x6'),'port':0x18eb});var socket=require(_0xacd0('0x7'))(new Redis(config['redis']));var redis=new Redis(config[_0xacd0('0x4')]);function respondWithStatusCode(_0x5d0829,_0x3252c7){_0x3252c7=_0x3252c7||0xcc;return function(_0x17ebab){if(_0x17ebab){return _0x5d0829['sendStatus'](_0x3252c7);}return _0x5d0829[_0xacd0('0x8')](_0x3252c7)['end']();};}function respondWithResult(_0x418a0c,_0x1a4b59){_0x1a4b59=_0x1a4b59||0xc8;return function(_0x48d1c6){if(_0x48d1c6){return _0x418a0c['status'](_0x1a4b59)[_0xacd0('0x9')](_0x48d1c6);}};}function respondWithFilteredResult(_0x358eda,_0x53c763){return function(_0x38281f){if(_0x38281f){var _0x52ec11=typeof _0x53c763[_0xacd0('0xa')]==='undefined'&&typeof _0x53c763[_0xacd0('0xb')]===_0xacd0('0xc');var _0xf0bead=_0x38281f['count'];var _0x26e6cc=_0x52ec11?0x0:_0x53c763[_0xacd0('0xa')];var _0x34003a=_0x52ec11?_0x38281f['count']:_0x53c763[_0xacd0('0xa')]+_0x53c763['limit'];var _0x25336c;if(_0x34003a>=_0xf0bead){_0x34003a=_0xf0bead;_0x25336c=0xc8;}else{_0x25336c=0xce;}_0x358eda[_0xacd0('0x8')](_0x25336c);return _0x358eda['set']('Content-Range',_0x26e6cc+'-'+_0x34003a+'/'+_0xf0bead)[_0xacd0('0x9')](_0x38281f);}return null;};}function saveUpdates(_0x390628){return function(_0x554c3b){if(_0x554c3b){return _0x554c3b['update'](_0x390628)[_0xacd0('0xd')](function(_0x2eb885){return _0x2eb885;});}return null;};}function removeEntity(_0x476d24){return function(_0x2b627e){if(_0x2b627e){return _0x2b627e[_0xacd0('0xe')]()['then'](function(){_0x476d24[_0xacd0('0x8')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b33cd){return function(_0x43bd2b){if(!_0x43bd2b){_0x1b33cd[_0xacd0('0xf')](0x194);}return _0x43bd2b;};}function handleError(_0x32ae56,_0xaaa8a4){_0xaaa8a4=_0xaaa8a4||0x1f4;return function(_0x2639f3){logger['error'](_0x2639f3[_0xacd0('0x10')]);if(_0x2639f3[_0xacd0('0x11')]){delete _0x2639f3[_0xacd0('0x11')];}_0x32ae56[_0xacd0('0x8')](_0xaaa8a4)[_0xacd0('0x12')](_0x2639f3);};}function maskClientSecret(_0x2daeec){return _[_0xacd0('0x13')](_0x2daeec[_0xacd0('0x14')](0x0,0x3),0x14,'*');}exports[_0xacd0('0x15')]=function(_0x98a2e7,_0x85d4ae){var _0x4e2486={},_0x37212e={},_0x5d345f={'count':0x0,'rows':[]};var _0x4d8875=_[_0xacd0('0x16')](db[_0xacd0('0x17')]['rawAttributes'],function(_0x1b8d93){return{'name':_0x1b8d93[_0xacd0('0x18')],'type':_0x1b8d93[_0xacd0('0x19')][_0xacd0('0x1a')]};});_0x37212e[_0xacd0('0x1b')]=_[_0xacd0('0x16')](_0x4d8875,_0xacd0('0x11'));_0x37212e[_0xacd0('0x1c')]=_[_0xacd0('0x1d')](_0x98a2e7['query']);_0x37212e[_0xacd0('0x1e')]=_[_0xacd0('0x1f')](_0x37212e['model'],_0x37212e[_0xacd0('0x1c')]);_0x4e2486[_0xacd0('0x20')]=_[_0xacd0('0x1f')](_0x37212e['model'],qs[_0xacd0('0x21')](_0x98a2e7[_0xacd0('0x1c')][_0xacd0('0x21')]));_0x4e2486['attributes']=_0x4e2486[_0xacd0('0x20')]['length']?_0x4e2486[_0xacd0('0x20')]:_0x37212e[_0xacd0('0x1b')];if(!_0x98a2e7[_0xacd0('0x1c')][_0xacd0('0x22')]('nolimit')){_0x4e2486['limit']=qs[_0xacd0('0xb')](_0x98a2e7[_0xacd0('0x1c')]['limit']);_0x4e2486[_0xacd0('0xa')]=qs[_0xacd0('0xa')](_0x98a2e7['query']['offset']);}_0x4e2486[_0xacd0('0x23')]=qs[_0xacd0('0x24')](_0x98a2e7['query'][_0xacd0('0x24')]);_0x4e2486[_0xacd0('0x25')]=qs[_0xacd0('0x1e')](_[_0xacd0('0x26')](_0x98a2e7[_0xacd0('0x1c')],_0x37212e[_0xacd0('0x1e')]),_0x4d8875);if(_0x98a2e7[_0xacd0('0x1c')][_0xacd0('0x27')]){_0x4e2486[_0xacd0('0x25')]=_[_0xacd0('0x28')](_0x4e2486[_0xacd0('0x25')],{'$or':_[_0xacd0('0x16')](_0x4d8875,function(_0x3bae34){if(_0x3bae34[_0xacd0('0x19')]!==_0xacd0('0x29')){var _0x516a52={};_0x516a52[_0x3bae34[_0xacd0('0x11')]]={'$like':'%'+_0x98a2e7[_0xacd0('0x1c')][_0xacd0('0x27')]+'%'};return _0x516a52;}})});}_0x4e2486=_[_0xacd0('0x28')]({},_0x4e2486,_0x98a2e7[_0xacd0('0x2a')]);var _0x51d541={'where':_0x4e2486[_0xacd0('0x25')]};return db['CloudProvider'][_0xacd0('0x2b')](_0x51d541)['then'](function(_0x316e3d){_0x5d345f[_0xacd0('0x2b')]=_0x316e3d;if(_0x98a2e7[_0xacd0('0x1c')]['includeAll']){_0x4e2486['include']=[{'all':!![]}];}return db[_0xacd0('0x17')][_0xacd0('0x2c')](_0x4e2486);})[_0xacd0('0xd')](function(_0x549bc1){_0x5d345f[_0xacd0('0x2d')]=_[_0xacd0('0x16')](_0x549bc1,function(_0x398ccd){if(_0x398ccd['service']==='MicrosoftAzure'){var _0x4b662c=encryptor[_0xacd0('0x2e')](_0x398ccd['data3']);_0x398ccd['data3']=maskClientSecret(_0x4b662c);}return _0x398ccd;});return _0x5d345f;})[_0xacd0('0xd')](respondWithFilteredResult(_0x85d4ae,_0x4e2486))[_0xacd0('0x2f')](handleError(_0x85d4ae,null));};exports[_0xacd0('0x30')]=function(_0x24aa07,_0x24d1f3){var _0x5702bd={'raw':!![],'where':{'id':_0x24aa07['params']['id']}},_0x1c0b90={};_0x1c0b90[_0xacd0('0x1b')]=_[_0xacd0('0x1d')](db['CloudProvider'][_0xacd0('0x31')]);_0x1c0b90[_0xacd0('0x1c')]=_[_0xacd0('0x1d')](_0x24aa07['query']);_0x1c0b90[_0xacd0('0x1e')]=_[_0xacd0('0x1f')](_0x1c0b90[_0xacd0('0x1b')],_0x1c0b90['query']);_0x5702bd[_0xacd0('0x20')]=_[_0xacd0('0x1f')](_0x1c0b90[_0xacd0('0x1b')],qs['fields'](_0x24aa07[_0xacd0('0x1c')][_0xacd0('0x21')]));_0x5702bd[_0xacd0('0x20')]=_0x5702bd[_0xacd0('0x20')][_0xacd0('0x32')]?_0x5702bd[_0xacd0('0x20')]:_0x1c0b90[_0xacd0('0x1b')];if(_0x24aa07[_0xacd0('0x1c')][_0xacd0('0x33')]){_0x5702bd['include']=[{'all':!![]}];}_0x5702bd=_[_0xacd0('0x28')]({},_0x5702bd,_0x24aa07[_0xacd0('0x2a')]);return db[_0xacd0('0x17')][_0xacd0('0x34')](_0x5702bd)[_0xacd0('0xd')](handleEntityNotFound(_0x24d1f3,null))['then'](function(_0x1c8784){if(_0x1c8784[_0xacd0('0x35')]==='MicrosoftAzure'){var _0x2800e5=encryptor[_0xacd0('0x2e')](_0x1c8784[_0xacd0('0x36')]);_0x1c8784[_0xacd0('0x36')]=maskClientSecret(_0x2800e5);}return _0x1c8784;})['then'](respondWithResult(_0x24d1f3,null))['catch'](handleError(_0x24d1f3,null));};exports[_0xacd0('0x37')]=function(_0x4ae249,_0x1888ac){if(!_0x4ae249['body'][_0xacd0('0x11')])throw new Error(_0xacd0('0x38'));if(!_0x4ae249[_0xacd0('0x39')][_0xacd0('0x35')])throw new Error(_0xacd0('0x3a'));var _0x17cf01=db[_0xacd0('0x17')]['rawAttributes'][_0xacd0('0x35')][_0xacd0('0x3b')];if(!_0x17cf01[_0xacd0('0x3c')](_0x4ae249['body'][_0xacd0('0x35')]))throw new Error(_0xacd0('0x3d')+_0x17cf01[_0xacd0('0x3e')](',\x20'));if(_0x4ae249['body'][_0xacd0('0x35')]===_0xacd0('0x3f')&&_0x4ae249[_0xacd0('0x39')][_0xacd0('0x36')]){_0x4ae249[_0xacd0('0x39')][_0xacd0('0x36')]=encryptor[_0xacd0('0x40')](_0x4ae249[_0xacd0('0x39')][_0xacd0('0x36')]);}return db[_0xacd0('0x17')]['create'](_0x4ae249['body'],{})[_0xacd0('0xd')](respondWithResult(_0x1888ac,0xc9))['catch'](handleError(_0x1888ac,null));};exports['update']=function(_0x2a140b,_0x45b294){if(_0x2a140b['body']['id']){delete _0x2a140b[_0xacd0('0x39')]['id'];}return db[_0xacd0('0x17')][_0xacd0('0x34')]({'where':{'id':_0x2a140b[_0xacd0('0x41')]['id']}})[_0xacd0('0xd')](handleEntityNotFound(_0x45b294,null))[_0xacd0('0xd')](function(_0x24a2fc){if(_0x24a2fc[_0xacd0('0x35')]===_0xacd0('0x3f')&&_0x2a140b[_0xacd0('0x39')][_0xacd0('0x36')]){_0x2a140b[_0xacd0('0x39')][_0xacd0('0x36')]=encryptor[_0xacd0('0x40')](_0x2a140b[_0xacd0('0x39')]['data3']);}return _0x24a2fc;})[_0xacd0('0xd')](saveUpdates(_0x2a140b[_0xacd0('0x39')],null))[_0xacd0('0xd')](respondWithResult(_0x45b294,null))['catch'](handleError(_0x45b294,null));};exports['destroy']=function(_0x33e687,_0x114e57){return db[_0xacd0('0x17')][_0xacd0('0x34')]({'where':{'id':_0x33e687[_0xacd0('0x41')]['id']}})['then'](handleEntityNotFound(_0x114e57,null))[_0xacd0('0xd')](removeEntity(_0x114e57,null))['catch'](handleError(_0x114e57,null));};exports['oauth2MicrosoftAuthorize']=function(_0x5810a1,_0x50f0d5){return db['CloudProvider']['findOne']({'where':{'id':_0x5810a1[_0xacd0('0x41')]['id']},'raw':!![]})[_0xacd0('0xd')](function(_0x73db11){if(!_0x73db11)return _0x50f0d5[_0xacd0('0xf')](0x194);return{'url':oauth[_0xacd0('0x42')](_0x73db11,_0x5810a1[_0xacd0('0x43')]['id'])};})[_0xacd0('0xd')](respondWithResult(_0x50f0d5,null))[_0xacd0('0x2f')](handleError(_0x50f0d5,null));};exports[_0xacd0('0x44')]=function(_0x6e6d92,_0x4c7c36){var _0x50ed62=_0x6e6d92[_0xacd0('0x39')];var _0x27519c;var _0x138146;if(_0x50ed62[_0xacd0('0x45')])throw _0x50ed62;redis[_0xacd0('0x46')](_0x50ed62[_0xacd0('0x47')])['then'](function(_0x26f1ce){if(!_0x26f1ce)throw new Error('Invalid\x20state\x20parameter');_0x27519c=JSON[_0xacd0('0x48')](_0x26f1ce);var _0x4c7b93=Buffer[_0xacd0('0x49')](_0x50ed62[_0xacd0('0x47')],_0xacd0('0x4a'))[_0xacd0('0x4b')](_0xacd0('0x4c'));_0x138146=JSON['parse'](_0x4c7b93);if(!oauth[_0xacd0('0x4d')](_0x50ed62[_0xacd0('0x4e')],_0x27519c[_0xacd0('0x4f')]))throw new Error(_0xacd0('0x50'));redis[_0xacd0('0x51')](_0x50ed62[_0xacd0('0x47')]);return oauth[_0xacd0('0x52')](_0x50ed62[_0xacd0('0x53')],_0x27519c);})[_0xacd0('0xd')](function(_0x409014){_0x27519c[_0xacd0('0x54')]=_0x409014[_0xacd0('0x55')];_0x27519c[_0xacd0('0x56')]=_0x409014[_0xacd0('0x57')];return db[_0xacd0('0x17')]['update']({'data5':_0x27519c[_0xacd0('0x54')],'data6':_0x27519c['data6']},{'where':{'id':_0x27519c['id']}});})['then'](function(){oauth[_0xacd0('0x58')](_0x27519c);socket[_0xacd0('0x59')]('microsoftAuthorization:success',{'id':_0x138146['id']});return;})['then'](respondWithStatusCode(_0x4c7c36,null))[_0xacd0('0x2f')](function(_0x189a25){if(_0x138146){socket[_0xacd0('0x59')](_0xacd0('0x5a'),{'id':_0x138146['id']});}if(!_0x27519c){logger[_0xacd0('0x45')](_0xacd0('0x5b'),_0x189a25);return _0x4c7c36[_0xacd0('0x8')](0x1f4)[_0xacd0('0x12')](_0x189a25[_0xacd0('0x5c')]);}logger[_0xacd0('0x45')](_0xacd0('0x5d'),_0x27519c['id'],JSON['stringify'](_0x189a25));});}; \ No newline at end of file +var _0xfec1=['map','CloudProvider','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','then','include','findAll','rows','service','MicrosoftAzure','decryptString','data3','catch','show','params','includeAll','create','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','values','includes','join','encryptString','find','findOne','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','get','state','Invalid\x20state\x20parameter','parse','toString','ascii','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','code','data5','data6','refresh_token','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','message','stringify','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/environment','../../config/logger','../../mysqldb','redis','defaults','localhost','sendStatus','end','status','undefined','count','offset','limit','set','json','update','destroy','error','stack','name','send','slice','index'];(function(_0x1aec28,_0x556b6f){var _0x2398c7=function(_0x27ee37){while(--_0x27ee37){_0x1aec28['push'](_0x1aec28['shift']());}};_0x2398c7(++_0x556b6f);}(_0xfec1,0xa6));var _0x1fec=function(_0xf8973d,_0x56a803){_0xf8973d=_0xf8973d-0x0;var _0x1c46bc=_0xfec1[_0xf8973d];return _0x1c46bc;};'use strict';var _=require('lodash');var Redis=require(_0x1fec('0x0'));var qs=require(_0x1fec('0x1'));var encryptor=require(_0x1fec('0x2'));var config=require(_0x1fec('0x3'));var logger=require(_0x1fec('0x4'))('api');var db=require(_0x1fec('0x5'))['db'];var oauth=require('./cloudProvider.oauth');config[_0x1fec('0x6')]=_[_0x1fec('0x7')](config[_0x1fec('0x6')],{'host':_0x1fec('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));var redis=new Redis(config[_0x1fec('0x6')]);function respondWithStatusCode(_0x4bb85d,_0x5a003c){_0x5a003c=_0x5a003c||0xcc;return function(_0x3246e2){if(_0x3246e2){return _0x4bb85d[_0x1fec('0x9')](_0x5a003c);}return _0x4bb85d['status'](_0x5a003c)[_0x1fec('0xa')]();};}function respondWithResult(_0x945ac0,_0x394acc){_0x394acc=_0x394acc||0xc8;return function(_0x2c5668){if(_0x2c5668){return _0x945ac0[_0x1fec('0xb')](_0x394acc)['json'](_0x2c5668);}};}function respondWithFilteredResult(_0x439a6c,_0xee3d1a){return function(_0x15dd8f){if(_0x15dd8f){var _0x1c0f40=typeof _0xee3d1a['offset']===_0x1fec('0xc')&&typeof _0xee3d1a['limit']===_0x1fec('0xc');var _0x1cfad7=_0x15dd8f['count'];var _0x389d2e=_0x1c0f40?0x0:_0xee3d1a['offset'];var _0x3d9aa4=_0x1c0f40?_0x15dd8f[_0x1fec('0xd')]:_0xee3d1a[_0x1fec('0xe')]+_0xee3d1a[_0x1fec('0xf')];var _0x2f25c4;if(_0x3d9aa4>=_0x1cfad7){_0x3d9aa4=_0x1cfad7;_0x2f25c4=0xc8;}else{_0x2f25c4=0xce;}_0x439a6c[_0x1fec('0xb')](_0x2f25c4);return _0x439a6c[_0x1fec('0x10')]('Content-Range',_0x389d2e+'-'+_0x3d9aa4+'/'+_0x1cfad7)[_0x1fec('0x11')](_0x15dd8f);}return null;};}function saveUpdates(_0x21081f){return function(_0x3dfd36){if(_0x3dfd36){return _0x3dfd36[_0x1fec('0x12')](_0x21081f)['then'](function(_0x42e750){return _0x42e750;});}return null;};}function removeEntity(_0x30518d){return function(_0x358e83){if(_0x358e83){return _0x358e83[_0x1fec('0x13')]()['then'](function(){_0x30518d[_0x1fec('0xb')](0xcc)[_0x1fec('0xa')]();});}};}function handleEntityNotFound(_0x475ea0){return function(_0x24b3b5){if(!_0x24b3b5){_0x475ea0[_0x1fec('0x9')](0x194);}return _0x24b3b5;};}function handleError(_0x1f5db1,_0x3da31c){_0x3da31c=_0x3da31c||0x1f4;return function(_0x314db1){logger[_0x1fec('0x14')](_0x314db1[_0x1fec('0x15')]);if(_0x314db1[_0x1fec('0x16')]){delete _0x314db1[_0x1fec('0x16')];}_0x1f5db1[_0x1fec('0xb')](_0x3da31c)[_0x1fec('0x17')](_0x314db1);};}function maskClientSecret(_0x289f88){return _['padEnd'](_0x289f88[_0x1fec('0x18')](0x0,0x3),0x14,'*');}exports[_0x1fec('0x19')]=function(_0x260d67,_0x510ec8){var _0x2f1883={},_0x10483c={},_0x7e5849={'count':0x0,'rows':[]};var _0x258fad=_[_0x1fec('0x1a')](db[_0x1fec('0x1b')][_0x1fec('0x1c')],function(_0x45ee9b){return{'name':_0x45ee9b[_0x1fec('0x1d')],'type':_0x45ee9b[_0x1fec('0x1e')][_0x1fec('0x1f')]};});_0x10483c['model']=_[_0x1fec('0x1a')](_0x258fad,'name');_0x10483c[_0x1fec('0x20')]=_[_0x1fec('0x21')](_0x260d67[_0x1fec('0x20')]);_0x10483c[_0x1fec('0x22')]=_[_0x1fec('0x23')](_0x10483c[_0x1fec('0x24')],_0x10483c['query']);_0x2f1883['attributes']=_[_0x1fec('0x23')](_0x10483c['model'],qs[_0x1fec('0x25')](_0x260d67['query']['fields']));_0x2f1883[_0x1fec('0x26')]=_0x2f1883[_0x1fec('0x26')][_0x1fec('0x27')]?_0x2f1883[_0x1fec('0x26')]:_0x10483c[_0x1fec('0x24')];if(!_0x260d67['query'][_0x1fec('0x28')](_0x1fec('0x29'))){_0x2f1883[_0x1fec('0xf')]=qs[_0x1fec('0xf')](_0x260d67[_0x1fec('0x20')][_0x1fec('0xf')]);_0x2f1883[_0x1fec('0xe')]=qs['offset'](_0x260d67[_0x1fec('0x20')][_0x1fec('0xe')]);}_0x2f1883[_0x1fec('0x2a')]=qs[_0x1fec('0x2b')](_0x260d67[_0x1fec('0x20')][_0x1fec('0x2b')]);_0x2f1883[_0x1fec('0x2c')]=qs[_0x1fec('0x22')](_[_0x1fec('0x2d')](_0x260d67['query'],_0x10483c['filters']),_0x258fad);if(_0x260d67[_0x1fec('0x20')]['filter']){_0x2f1883[_0x1fec('0x2c')]=_[_0x1fec('0x2e')](_0x2f1883[_0x1fec('0x2c')],{'$or':_[_0x1fec('0x1a')](_0x258fad,function(_0x35164c){if(_0x35164c['type']!==_0x1fec('0x2f')){var _0x1e829c={};_0x1e829c[_0x35164c[_0x1fec('0x16')]]={'$like':'%'+_0x260d67[_0x1fec('0x20')]['filter']+'%'};return _0x1e829c;}})});}_0x2f1883=_[_0x1fec('0x2e')]({},_0x2f1883,_0x260d67[_0x1fec('0x30')]);var _0x26bfca={'where':_0x2f1883[_0x1fec('0x2c')]};return db[_0x1fec('0x1b')][_0x1fec('0xd')](_0x26bfca)[_0x1fec('0x31')](function(_0x3f2da5){_0x7e5849[_0x1fec('0xd')]=_0x3f2da5;if(_0x260d67[_0x1fec('0x20')]['includeAll']){_0x2f1883[_0x1fec('0x32')]=[{'all':!![]}];}return db[_0x1fec('0x1b')][_0x1fec('0x33')](_0x2f1883);})[_0x1fec('0x31')](function(_0x349d45){_0x7e5849[_0x1fec('0x34')]=_[_0x1fec('0x1a')](_0x349d45,function(_0x229b75){if(_0x229b75[_0x1fec('0x35')]===_0x1fec('0x36')){var _0xe66e6b=encryptor[_0x1fec('0x37')](_0x229b75[_0x1fec('0x38')]);_0x229b75[_0x1fec('0x38')]=maskClientSecret(_0xe66e6b);}return _0x229b75;});return _0x7e5849;})[_0x1fec('0x31')](respondWithFilteredResult(_0x510ec8,_0x2f1883))[_0x1fec('0x39')](handleError(_0x510ec8,null));};exports[_0x1fec('0x3a')]=function(_0x49d317,_0x39accb){var _0x38daa9={'raw':!![],'where':{'id':_0x49d317[_0x1fec('0x3b')]['id']}},_0x20dda1={};_0x20dda1[_0x1fec('0x24')]=_[_0x1fec('0x21')](db[_0x1fec('0x1b')][_0x1fec('0x1c')]);_0x20dda1['query']=_['keys'](_0x49d317['query']);_0x20dda1['filters']=_[_0x1fec('0x23')](_0x20dda1[_0x1fec('0x24')],_0x20dda1[_0x1fec('0x20')]);_0x38daa9['attributes']=_[_0x1fec('0x23')](_0x20dda1[_0x1fec('0x24')],qs[_0x1fec('0x25')](_0x49d317['query'][_0x1fec('0x25')]));_0x38daa9[_0x1fec('0x26')]=_0x38daa9[_0x1fec('0x26')]['length']?_0x38daa9[_0x1fec('0x26')]:_0x20dda1[_0x1fec('0x24')];if(_0x49d317['query'][_0x1fec('0x3c')]){_0x38daa9['include']=[{'all':!![]}];}_0x38daa9=_[_0x1fec('0x2e')]({},_0x38daa9,_0x49d317[_0x1fec('0x30')]);return db[_0x1fec('0x1b')]['find'](_0x38daa9)[_0x1fec('0x31')](handleEntityNotFound(_0x39accb,null))[_0x1fec('0x31')](function(_0x12f19c){if(_0x12f19c[_0x1fec('0x35')]==='MicrosoftAzure'){var _0x2b4631=encryptor[_0x1fec('0x37')](_0x12f19c[_0x1fec('0x38')]);_0x12f19c[_0x1fec('0x38')]=maskClientSecret(_0x2b4631);}return _0x12f19c;})[_0x1fec('0x31')](respondWithResult(_0x39accb,null))[_0x1fec('0x39')](handleError(_0x39accb,null));};exports[_0x1fec('0x3d')]=function(_0xb4895,_0xd552c9){if(!_0xb4895[_0x1fec('0x3e')][_0x1fec('0x16')])throw new Error(_0x1fec('0x3f'));if(!_0xb4895['body'][_0x1fec('0x35')])throw new Error(_0x1fec('0x40'));var _0x161f42=db['CloudProvider'][_0x1fec('0x1c')][_0x1fec('0x35')][_0x1fec('0x41')];if(!_0x161f42[_0x1fec('0x42')](_0xb4895[_0x1fec('0x3e')][_0x1fec('0x35')]))throw new Error('Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20'+_0x161f42[_0x1fec('0x43')](',\x20'));if(_0xb4895[_0x1fec('0x3e')][_0x1fec('0x35')]===_0x1fec('0x36')&&_0xb4895['body']['data3']){_0xb4895[_0x1fec('0x3e')][_0x1fec('0x38')]=encryptor[_0x1fec('0x44')](_0xb4895[_0x1fec('0x3e')]['data3']);}return db[_0x1fec('0x1b')][_0x1fec('0x3d')](_0xb4895[_0x1fec('0x3e')],{})[_0x1fec('0x31')](respondWithResult(_0xd552c9,0xc9))[_0x1fec('0x39')](handleError(_0xd552c9,null));};exports[_0x1fec('0x12')]=function(_0x1f95e7,_0x2e59ed){if(_0x1f95e7[_0x1fec('0x3e')]['id']){delete _0x1f95e7[_0x1fec('0x3e')]['id'];}return db[_0x1fec('0x1b')][_0x1fec('0x45')]({'where':{'id':_0x1f95e7['params']['id']}})[_0x1fec('0x31')](handleEntityNotFound(_0x2e59ed,null))[_0x1fec('0x31')](function(_0x1637b3){if(_0x1637b3[_0x1fec('0x35')]===_0x1fec('0x36')&&_0x1f95e7[_0x1fec('0x3e')]['data3']){_0x1f95e7[_0x1fec('0x3e')]['data3']=encryptor['encryptString'](_0x1f95e7[_0x1fec('0x3e')][_0x1fec('0x38')]);}return _0x1637b3;})[_0x1fec('0x31')](saveUpdates(_0x1f95e7[_0x1fec('0x3e')],null))[_0x1fec('0x31')](respondWithResult(_0x2e59ed,null))[_0x1fec('0x39')](handleError(_0x2e59ed,null));};exports[_0x1fec('0x13')]=function(_0x563940,_0x2933c7){return db['CloudProvider'][_0x1fec('0x45')]({'where':{'id':_0x563940[_0x1fec('0x3b')]['id']}})[_0x1fec('0x31')](handleEntityNotFound(_0x2933c7,null))[_0x1fec('0x31')](removeEntity(_0x2933c7,null))[_0x1fec('0x39')](handleError(_0x2933c7,null));};exports['oauth2MicrosoftAuthorize']=function(_0x503174,_0x5d682c){return db[_0x1fec('0x1b')][_0x1fec('0x46')]({'where':{'id':_0x503174[_0x1fec('0x3b')]['id']},'raw':!![]})[_0x1fec('0x31')](function(_0x119987){if(!_0x119987)return _0x5d682c['sendStatus'](0x194);return{'url':oauth[_0x1fec('0x47')](_0x119987,_0x503174[_0x1fec('0x48')]['id'])};})['then'](respondWithResult(_0x5d682c,null))[_0x1fec('0x39')](handleError(_0x5d682c,null));};exports[_0x1fec('0x49')]=function(_0x5eb245,_0x3bc044){var _0x145227=_0x5eb245[_0x1fec('0x3e')];var _0x376b73;var _0x463446;if(_0x145227[_0x1fec('0x14')])throw _0x145227;redis[_0x1fec('0x4a')](_0x145227[_0x1fec('0x4b')])[_0x1fec('0x31')](function(_0x382d1a){if(!_0x382d1a)throw new Error(_0x1fec('0x4c'));_0x376b73=JSON[_0x1fec('0x4d')](_0x382d1a);var _0x2b800e=Buffer['from'](_0x145227[_0x1fec('0x4b')],'base64')[_0x1fec('0x4e')](_0x1fec('0x4f'));_0x463446=JSON[_0x1fec('0x4d')](_0x2b800e);if(!oauth['isValidIdToken'](_0x145227[_0x1fec('0x50')],_0x376b73[_0x1fec('0x51')]))throw new Error(_0x1fec('0x52'));redis[_0x1fec('0x53')](_0x145227['state']);return oauth[_0x1fec('0x54')](_0x145227[_0x1fec('0x55')],_0x376b73);})[_0x1fec('0x31')](function(_0x4cf51a){_0x376b73[_0x1fec('0x56')]=_0x4cf51a['access_token'];_0x376b73[_0x1fec('0x57')]=_0x4cf51a[_0x1fec('0x58')];return db[_0x1fec('0x1b')][_0x1fec('0x12')]({'data5':_0x376b73[_0x1fec('0x56')],'data6':_0x376b73[_0x1fec('0x57')]},{'where':{'id':_0x376b73['id']}});})[_0x1fec('0x31')](function(){oauth[_0x1fec('0x59')](_0x376b73);socket[_0x1fec('0x5a')](_0x1fec('0x5b'),{'id':_0x463446['id']});return;})[_0x1fec('0x31')](respondWithStatusCode(_0x3bc044,null))[_0x1fec('0x39')](function(_0xf071ab){if(_0x463446){socket[_0x1fec('0x5a')](_0x1fec('0x5c'),{'id':_0x463446['id']});}if(!_0x376b73){logger[_0x1fec('0x14')](_0x1fec('0x5d'),_0xf071ab);return _0x3bc044[_0x1fec('0xb')](0x1f4)['send'](_0xf071ab[_0x1fec('0x5e')]);}logger[_0x1fec('0x14')]('Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s',_0x376b73['id'],JSON[_0x1fec('0x5f')](_0xf071ab));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 92a86c1..e6e13c0 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 _0x17cb=['cloud_providers','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cloudProvider.attributes','CloudProvider'];(function(_0x1a7846,_0x59723e){var _0x48049=function(_0x203ff6){while(--_0x203ff6){_0x1a7846['push'](_0x1a7846['shift']());}};_0x48049(++_0x59723e);}(_0x17cb,0x7a));var _0xb17c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x17cb[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb17c('0x0'));var util=require(_0xb17c('0x1'));var logger=require(_0xb17c('0x2'))('api');var moment=require(_0xb17c('0x3'));var BPromise=require(_0xb17c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb17c('0x5'));var rimraf=require(_0xb17c('0x6'));var config=require(_0xb17c('0x7'));var attributes=require(_0xb17c('0x8'));module['exports']=function(_0x37146e,_0x39ffd7){return _0x37146e['define'](_0xb17c('0x9'),attributes,{'tableName':_0xb17c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa3cf=['./cloudProvider.attributes','exports','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa3cf,0x142));var _0xfa3c=function(_0x5b3229,_0x4bf196){_0x5b3229=_0x5b3229-0x0;var _0x1d8932=_0xa3cf[_0x5b3229];return _0x1d8932;};'use strict';var _=require(_0xfa3c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xfa3c('0x1'));var moment=require(_0xfa3c('0x2'));var BPromise=require(_0xfa3c('0x3'));var rp=require(_0xfa3c('0x4'));var fs=require('fs');var path=require(_0xfa3c('0x5'));var rimraf=require(_0xfa3c('0x6'));var config=require(_0xfa3c('0x7'));var attributes=require(_0xfa3c('0x8'));module[_0xfa3c('0x9')]=function(_0x519e7,_0x6ceff1){return _0x519e7['define']('CloudProvider',attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.oauth.js b/server/api/cloudProvider/cloudProvider.oauth.js index 0e4553b..91fb5f3 100644 --- a/server/api/cloudProvider/cloudProvider.oauth.js +++ b/server/api/cloudProvider/cloudProvider.oauth.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd308=['stringify','toString','base64','randomBytes','hex','client_id','data1','response_type','redirect_uri','response_mode','form_post','scope','state','nonce','prompt','key','value','oauth2/','decode','aud','isAfter','unix','exp','then','data3','CloudProvider','findOne','refresh_token','data6','POST','data5','access_token','update','catch','authorization_code','data4','decryptString','intervals','bind','findAll','all','inspect','error','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','crypto','jsonwebtoken','moment','request-promise','util','../../components/encryptor','../../config/environment','../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','defaults','localhost','redis','openid','profile','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','/authorize','/token','map','type','data7','/.default','join','Outlook365','Dynamics365','replace','{TENANT_ID}','data2','code','id_token','from'];(function(_0x577ee4,_0x4ea06e){var _0x407b75=function(_0x3302a5){while(--_0x3302a5){_0x577ee4['push'](_0x577ee4['shift']());}};_0x407b75(++_0x4ea06e);}(_0xd308,0xcd));var _0x8d30=function(_0x242e48,_0x1ea276){_0x242e48=_0x242e48-0x0;var _0x3eca29=_0xd308[_0x242e48];return _0x3eca29;};'use strict';var _=require(_0x8d30('0x0'));var crypto=require(_0x8d30('0x1'));var jwt=require(_0x8d30('0x2'));var moment=require(_0x8d30('0x3'));var Redis=require('ioredis');var rp=require(_0x8d30('0x4'));var util=require(_0x8d30('0x5'));var encryptor=require(_0x8d30('0x6'));var config=require(_0x8d30('0x7'));var logger=require(_0x8d30('0x8'))(_0x8d30('0x9'));var schedule=require(_0x8d30('0xa'));var db=require(_0x8d30('0xb'))['db'];config['redis']=_[_0x8d30('0xc')](config['redis'],{'host':_0x8d30('0xd'),'port':0x18eb});var redis=new Redis(config[_0x8d30('0xe')]);var MICROSOFT_AUTH_URL='https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0';var AZURE_AUTH_SCOPES={'Outlook365':[_0x8d30('0xf'),_0x8d30('0x10'),_0x8d30('0x11'),_0x8d30('0x12'),_0x8d30('0x13'),'https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send'],'Dynamics365':[_0x8d30('0xf'),_0x8d30('0x12')]};var MICROSOFT_AUTH_ENDPOINT=_0x8d30('0x14');var MICROSOFT_TOKEN_ENDPOINT=_0x8d30('0x15');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x4f4585){var _0x499156=_[_0x8d30('0x16')](AZURE_AUTH_SCOPES[_0x4f4585[_0x8d30('0x17')]]);if(_0x4f4585[_0x8d30('0x17')]==='Dynamics365')_0x499156['push'](_0x4f4585[_0x8d30('0x18')]+_0x8d30('0x19'));return _0x499156[_0x8d30('0x1a')]('\x20');}function getAccessTokenScope(_0x5d473c){if(_0x5d473c['type']===_0x8d30('0x1b'))return _0x8d30('0x13');if(_0x5d473c[_0x8d30('0x17')]===_0x8d30('0x1c'))return _0x5d473c[_0x8d30('0x18')]+'/.default';}function generateMicrosoftAuthorizationUrl(_0x300f84,_0x2b7efc){var _0x71ecf1=MICROSOFT_AUTH_URL[_0x8d30('0x1d')](_0x8d30('0x1e'),_0x300f84[_0x8d30('0x1f')]);var _0x1d58b9=[_0x8d30('0x20'),_0x8d30('0x21')];var _0x3208cb=Buffer[_0x8d30('0x22')](JSON[_0x8d30('0x23')]({'id':_0x2b7efc}))[_0x8d30('0x24')](_0x8d30('0x25'));var _0x19fa08=crypto[_0x8d30('0x26')](0x10)[_0x8d30('0x24')](_0x8d30('0x27'));var _0x1e2de1=getAuthorizationScopes(_0x300f84);var _0x5bf83e=[{'key':_0x8d30('0x28'),'value':_0x300f84[_0x8d30('0x29')]},{'key':_0x8d30('0x2a'),'value':encodeURIComponent(_0x1d58b9[_0x8d30('0x1a')]('\x20'))},{'key':_0x8d30('0x2b'),'value':_0x300f84['data4']},{'key':_0x8d30('0x2c'),'value':_0x8d30('0x2d')},{'key':_0x8d30('0x2e'),'value':encodeURIComponent(_0x1e2de1)},{'key':_0x8d30('0x2f'),'value':_0x3208cb},{'key':_0x8d30('0x30'),'value':_0x19fa08},{'key':_0x8d30('0x31'),'value':'login'}];var _0x9cf7cb=_0x71ecf1+MICROSOFT_AUTH_ENDPOINT+'?'+_['map'](_0x5bf83e,function(_0x2ceb9a){return _0x2ceb9a[_0x8d30('0x32')]+'='+_0x2ceb9a[_0x8d30('0x33')];})[_0x8d30('0x1a')]('&');_0x300f84['oauth2Claims']={'issuer':_0x71ecf1['replace'](_0x8d30('0x34'),''),'audience':_0x300f84['data1'],'state':_0x3208cb,'nonce':_0x19fa08};redis['set'](_0x3208cb,JSON[_0x8d30('0x23')](_0x300f84));return _0x9cf7cb;}function isValidIdToken(_0xa6e728,_0x3c7cb7){try{var _0x18e86e=jwt[_0x8d30('0x35')](_0xa6e728,{'complete':!![]});var _0x2f6e7f=_0x18e86e['payload'];if(_0x2f6e7f['iss']!==_0x3c7cb7['issuer'])return![];if(_0x2f6e7f[_0x8d30('0x36')]!==_0x3c7cb7['audience'])return![];if(_0x2f6e7f[_0x8d30('0x30')]!==_0x3c7cb7[_0x8d30('0x30')])return![];if(moment()[_0x8d30('0x37')](moment[_0x8d30('0x38')](_0x2f6e7f[_0x8d30('0x39')])))return![];return!![];}catch(_0x369606){throw _0x369606;}}function refreshOauth2MicrosoftAccessToken(_0x4419ea){return Promise['resolve']()[_0x8d30('0x3a')](function(){if(_0x4419ea[_0x8d30('0x3b')])return _0x4419ea;return db[_0x8d30('0x3c')][_0x8d30('0x3d')]({'where':{'id':_0x4419ea['id']},'raw':!![]});})['then'](function(_0x5b5864){var _0x1c6545={'grant_type':_0x8d30('0x3e'),'refresh_token':_0x5b5864[_0x8d30('0x3f')],'scope':getAccessTokenScope(_0x5b5864),'redirect_uri':_0x5b5864['data4'],'client_id':_0x5b5864[_0x8d30('0x29')],'client_secret':encryptor['decryptString'](_0x5b5864[_0x8d30('0x3b')])};var _0x14c85e={'method':_0x8d30('0x40'),'uri':MICROSOFT_AUTH_URL['replace'](_0x8d30('0x1e'),_0x5b5864['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x1c6545,'json':!![]};return rp(_0x14c85e);})[_0x8d30('0x3a')](function(_0x519279){_0x4419ea[_0x8d30('0x41')]=_0x519279[_0x8d30('0x42')];_0x4419ea['data6']=_0x519279[_0x8d30('0x3e')];return db[_0x8d30('0x3c')][_0x8d30('0x43')]({'data5':_0x4419ea[_0x8d30('0x41')],'data6':_0x4419ea[_0x8d30('0x3f')]},{'where':{'id':_0x4419ea['id']}});})[_0x8d30('0x3a')](function(){return _0x4419ea;})[_0x8d30('0x44')](function(_0x12a2dd){logger['error']('Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s',_0x4419ea['id'],_0x12a2dd);});}function getOauth2MicrosoftAccessToken(_0x1b5d7b,_0x2bfa7c){var _0x33d295={'grant_type':_0x8d30('0x45'),'code':_0x1b5d7b,'scope':getAccessTokenScope(_0x2bfa7c),'redirect_uri':_0x2bfa7c[_0x8d30('0x46')],'client_id':_0x2bfa7c['data1'],'client_secret':encryptor[_0x8d30('0x47')](_0x2bfa7c[_0x8d30('0x3b')])};var _0x25d1e2={'method':_0x8d30('0x40'),'uri':MICROSOFT_AUTH_URL[_0x8d30('0x1d')](_0x8d30('0x1e'),_0x2bfa7c[_0x8d30('0x1f')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x33d295,'json':!![]};return rp(_0x25d1e2);}function startRefreshInterval(_0x532eb8){var _0x40fd0a=schedule[_0x8d30('0x48')];if(_0x40fd0a[_0x532eb8['id']])clearInterval(_0x40fd0a[_0x532eb8['id']]);_0x40fd0a[_0x532eb8['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x8d30('0x49')](this,{'id':_0x532eb8['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x8d30('0x48')]=_0x40fd0a;}function startAllRefreshIntervals(){return db[_0x8d30('0x3c')][_0x8d30('0x4a')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x8d30('0x3a')](function(_0x4b205f){var _0x34ff5b=_0x4b205f[_0x8d30('0x16')](function(_0x487f0a){return refreshOauth2MicrosoftAccessToken(_0x487f0a)[_0x8d30('0x3a')](function(_0x4eaa2e){startRefreshInterval(_0x4eaa2e);});});return Promise[_0x8d30('0x4b')](_0x34ff5b);})[_0x8d30('0x44')](function(_0x334af6){var _0x137bce=_0x334af6?util[_0x8d30('0x4c')](_0x334af6,{'showHidden':![],'depth':null}):'';logger[_0x8d30('0x4d')](_0x8d30('0x4e'),_0x137bce);});}module[_0x8d30('0x4f')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0x1e17=['iss','aud','audience','isAfter','unix','exp','resolve','then','data3','findOne','refresh_token','data4','decryptString','POST','data5','access_token','data6','CloudProvider','update','catch','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','bind','intervals','findAll','all','inspect','error','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','lodash','crypto','jsonwebtoken','moment','request-promise','util','../../components/encryptor','../../config/environment','api','../../mysqldb','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','profile','email','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','openid','offline_access','/authorize','/token','map','type','Dynamics365','join','replace','{TENANT_ID}','data2','id_token','from','stringify','toString','randomBytes','hex','client_id','data1','response_type','redirect_uri','response_mode','state','nonce','prompt','key','value','oauth2Claims','oauth2/','set','payload'];(function(_0x424d40,_0x2cd41a){var _0x247f84=function(_0x2a0318){while(--_0x2a0318){_0x424d40['push'](_0x424d40['shift']());}};_0x247f84(++_0x2cd41a);}(_0x1e17,0x106));var _0x71e1=function(_0x340380,_0x4bd2a8){_0x340380=_0x340380-0x0;var _0x49ce1c=_0x1e17[_0x340380];return _0x49ce1c;};'use strict';var _=require(_0x71e1('0x0'));var crypto=require(_0x71e1('0x1'));var jwt=require(_0x71e1('0x2'));var moment=require(_0x71e1('0x3'));var Redis=require('ioredis');var rp=require(_0x71e1('0x4'));var util=require(_0x71e1('0x5'));var encryptor=require(_0x71e1('0x6'));var config=require(_0x71e1('0x7'));var logger=require('../../config/logger')(_0x71e1('0x8'));var schedule=require('../../config/schedule/cloud-provider');var db=require(_0x71e1('0x9'))['db'];config[_0x71e1('0xa')]=_[_0x71e1('0xb')](config['redis'],{'host':_0x71e1('0xc'),'port':0x18eb});var redis=new Redis(config['redis']);var MICROSOFT_AUTH_URL=_0x71e1('0xd');var AZURE_AUTH_SCOPES={'Outlook365':['openid',_0x71e1('0xe'),_0x71e1('0xf'),'offline_access',_0x71e1('0x10'),_0x71e1('0x11'),_0x71e1('0x12')],'Dynamics365':[_0x71e1('0x13'),_0x71e1('0x14')]};var MICROSOFT_AUTH_ENDPOINT=_0x71e1('0x15');var MICROSOFT_TOKEN_ENDPOINT=_0x71e1('0x16');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0xaa6a85){var _0x1fdc35=_[_0x71e1('0x17')](AZURE_AUTH_SCOPES[_0xaa6a85[_0x71e1('0x18')]]);if(_0xaa6a85[_0x71e1('0x18')]===_0x71e1('0x19'))_0x1fdc35['push'](_0xaa6a85['data7']+'/.default');return _0x1fdc35[_0x71e1('0x1a')]('\x20');}function getAccessTokenScope(_0x5afe96){if(_0x5afe96['type']==='Outlook365')return _0x71e1('0x10');if(_0x5afe96['type']==='Dynamics365')return _0x5afe96['data7']+'/.default';}function generateMicrosoftAuthorizationUrl(_0x4a07c2,_0x53bd57){var _0x492bde=MICROSOFT_AUTH_URL[_0x71e1('0x1b')](_0x71e1('0x1c'),_0x4a07c2[_0x71e1('0x1d')]);var _0x56380d=['code',_0x71e1('0x1e')];var _0x41c2ed=Buffer[_0x71e1('0x1f')](JSON[_0x71e1('0x20')]({'id':_0x53bd57}))[_0x71e1('0x21')]('base64');var _0x13ca88=crypto[_0x71e1('0x22')](0x10)[_0x71e1('0x21')](_0x71e1('0x23'));var _0x313cc5=getAuthorizationScopes(_0x4a07c2);var _0x1154b6=[{'key':_0x71e1('0x24'),'value':_0x4a07c2[_0x71e1('0x25')]},{'key':_0x71e1('0x26'),'value':encodeURIComponent(_0x56380d[_0x71e1('0x1a')]('\x20'))},{'key':_0x71e1('0x27'),'value':_0x4a07c2['data4']},{'key':_0x71e1('0x28'),'value':'form_post'},{'key':'scope','value':encodeURIComponent(_0x313cc5)},{'key':_0x71e1('0x29'),'value':_0x41c2ed},{'key':_0x71e1('0x2a'),'value':_0x13ca88},{'key':_0x71e1('0x2b'),'value':'login'}];var _0x1d5bae=_0x492bde+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x71e1('0x17')](_0x1154b6,function(_0x32b7ca){return _0x32b7ca[_0x71e1('0x2c')]+'='+_0x32b7ca[_0x71e1('0x2d')];})[_0x71e1('0x1a')]('&');_0x4a07c2[_0x71e1('0x2e')]={'issuer':_0x492bde['replace'](_0x71e1('0x2f'),''),'audience':_0x4a07c2[_0x71e1('0x25')],'state':_0x41c2ed,'nonce':_0x13ca88};redis[_0x71e1('0x30')](_0x41c2ed,JSON[_0x71e1('0x20')](_0x4a07c2));return _0x1d5bae;}function isValidIdToken(_0x5d6c42,_0x18311c){try{var _0xc8625f=jwt['decode'](_0x5d6c42,{'complete':!![]});var _0x595563=_0xc8625f[_0x71e1('0x31')];if(_0x595563[_0x71e1('0x32')]!==_0x18311c['issuer'])return![];if(_0x595563[_0x71e1('0x33')]!==_0x18311c[_0x71e1('0x34')])return![];if(_0x595563['nonce']!==_0x18311c[_0x71e1('0x2a')])return![];if(moment()[_0x71e1('0x35')](moment[_0x71e1('0x36')](_0x595563[_0x71e1('0x37')])))return![];return!![];}catch(_0x38e7aa){throw _0x38e7aa;}}function refreshOauth2MicrosoftAccessToken(_0x1d8895){return Promise[_0x71e1('0x38')]()[_0x71e1('0x39')](function(){if(_0x1d8895[_0x71e1('0x3a')])return _0x1d8895;return db['CloudProvider'][_0x71e1('0x3b')]({'where':{'id':_0x1d8895['id']},'raw':!![]});})[_0x71e1('0x39')](function(_0x33737f){var _0x5a2506={'grant_type':_0x71e1('0x3c'),'refresh_token':_0x33737f['data6'],'scope':getAccessTokenScope(_0x33737f),'redirect_uri':_0x33737f[_0x71e1('0x3d')],'client_id':_0x33737f[_0x71e1('0x25')],'client_secret':encryptor[_0x71e1('0x3e')](_0x33737f[_0x71e1('0x3a')])};var _0x22b144={'method':_0x71e1('0x3f'),'uri':MICROSOFT_AUTH_URL[_0x71e1('0x1b')](_0x71e1('0x1c'),_0x33737f[_0x71e1('0x1d')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x5a2506,'json':!![]};return rp(_0x22b144);})[_0x71e1('0x39')](function(_0x2d4414){_0x1d8895[_0x71e1('0x40')]=_0x2d4414[_0x71e1('0x41')];_0x1d8895[_0x71e1('0x42')]=_0x2d4414[_0x71e1('0x3c')];return db[_0x71e1('0x43')][_0x71e1('0x44')]({'data5':_0x1d8895[_0x71e1('0x40')],'data6':_0x1d8895[_0x71e1('0x42')]},{'where':{'id':_0x1d8895['id']}});})[_0x71e1('0x39')](function(){return _0x1d8895;})[_0x71e1('0x45')](function(_0x372762){logger['error'](_0x71e1('0x46'),_0x1d8895['id'],_0x372762);});}function getOauth2MicrosoftAccessToken(_0x7f4b5,_0x34588){var _0x216882={'grant_type':'authorization_code','code':_0x7f4b5,'scope':getAccessTokenScope(_0x34588),'redirect_uri':_0x34588[_0x71e1('0x3d')],'client_id':_0x34588[_0x71e1('0x25')],'client_secret':encryptor[_0x71e1('0x3e')](_0x34588['data3'])};var _0x346074={'method':'POST','uri':MICROSOFT_AUTH_URL['replace'](_0x71e1('0x1c'),_0x34588[_0x71e1('0x1d')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x216882,'json':!![]};return rp(_0x346074);}function startRefreshInterval(_0x48b85b){var _0x3779d9=schedule['intervals'];if(_0x3779d9[_0x48b85b['id']])clearInterval(_0x3779d9[_0x48b85b['id']]);_0x3779d9[_0x48b85b['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x71e1('0x47')](this,{'id':_0x48b85b['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x71e1('0x48')]=_0x3779d9;}function startAllRefreshIntervals(){return db['CloudProvider'][_0x71e1('0x49')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x71e1('0x39')](function(_0x12255f){var _0x537f4d=_0x12255f['map'](function(_0x438eac){return refreshOauth2MicrosoftAccessToken(_0x438eac)[_0x71e1('0x39')](function(_0x3bd3b7){startRefreshInterval(_0x3bd3b7);});});return Promise[_0x71e1('0x4a')](_0x537f4d);})[_0x71e1('0x45')](function(_0x226b5c){var _0x2a5687=_0x226b5c?util[_0x71e1('0x4b')](_0x226b5c,{'showHidden':![],'depth':null}):'';logger[_0x71e1('0x4c')](_0x71e1('0x4d'),_0x2a5687);});}module['exports']={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index d462e33..218b069 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 _0x58cc=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x4068a3,_0x1c2cd3){var _0xcdea1=function(_0x1eabe1){while(--_0x1eabe1){_0x4068a3['push'](_0x4068a3['shift']());}};_0xcdea1(++_0x1c2cd3);}(_0x58cc,0x7a));var _0xc58c=function(_0x460150,_0x232949){_0x460150=_0x460150-0x0;var _0x340677=_0x58cc[_0x460150];return _0x340677;};'use strict';var _=require(_0xc58c('0x0'));var util=require(_0xc58c('0x1'));var moment=require(_0xc58c('0x2'));var BPromise=require(_0xc58c('0x3'));var rs=require(_0xc58c('0x4'));var fs=require('fs');var Redis=require(_0xc58c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc58c('0x6'));var logger=require(_0xc58c('0x7'))(_0xc58c('0x8'));var config=require(_0xc58c('0x9'));var jayson=require(_0xc58c('0xa'));var client=jayson[_0xc58c('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4f1b4e,_0x448646,_0x282354){return new BPromise(function(_0x48a9f4,_0x184b6d){return client[_0xc58c('0xc')](_0x4f1b4e,_0x282354)['then'](function(_0x248c8c){logger['info'](_0xc58c('0xd'),_0x448646,_0xc58c('0xe'));logger[_0xc58c('0xf')](_0xc58c('0x10'),_0x448646,_0xc58c('0xe'),JSON[_0xc58c('0x11')](_0x248c8c));if(_0x248c8c['error']){if(_0x248c8c[_0xc58c('0x12')][_0xc58c('0x13')]===0x1f4){logger[_0xc58c('0x12')](_0xc58c('0xd'),_0x448646,_0x248c8c[_0xc58c('0x12')][_0xc58c('0x14')]);return _0x184b6d(_0x248c8c[_0xc58c('0x12')][_0xc58c('0x14')]);}logger[_0xc58c('0x12')](_0xc58c('0xd'),_0x448646,_0x248c8c['error'][_0xc58c('0x14')]);return _0x48a9f4(_0x248c8c['error'][_0xc58c('0x14')]);}else{logger[_0xc58c('0x15')](_0xc58c('0xd'),_0x448646,_0xc58c('0xe'));_0x48a9f4(_0x248c8c[_0xc58c('0x16')][_0xc58c('0x14')]);}})[_0xc58c('0x17')](function(_0xf1601f){logger[_0xc58c('0x12')](_0xc58c('0xd'),_0x448646,_0xf1601f);_0x184b6d(_0xf1601f);});});} \ No newline at end of file +var _0x9e6b=['request','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x5834bc,_0x3d4801){var _0x3e183a=function(_0x18b023){while(--_0x18b023){_0x5834bc['push'](_0x5834bc['shift']());}};_0x3e183a(++_0x3d4801);}(_0x9e6b,0x11c));var _0xb9e6=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x9e6b[_0x40a045];return _0x1a687c;};'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});function respondWithRpcPromise(_0x4bb674,_0x2cbcf7,_0x49565c){return new BPromise(function(_0x5a54db,_0x4cc018){return client[_0xb9e6('0xa')](_0x4bb674,_0x49565c)['then'](function(_0x378e17){logger[_0xb9e6('0xb')](_0xb9e6('0xc'),_0x2cbcf7,_0xb9e6('0xd'));logger[_0xb9e6('0xe')](_0xb9e6('0xf'),_0x2cbcf7,_0xb9e6('0xd'),JSON[_0xb9e6('0x10')](_0x378e17));if(_0x378e17[_0xb9e6('0x11')]){if(_0x378e17[_0xb9e6('0x11')]['code']===0x1f4){logger[_0xb9e6('0x11')](_0xb9e6('0xc'),_0x2cbcf7,_0x378e17[_0xb9e6('0x11')][_0xb9e6('0x12')]);return _0x4cc018(_0x378e17['error'][_0xb9e6('0x12')]);}logger[_0xb9e6('0x11')]('CloudProvider,\x20%s,\x20%s',_0x2cbcf7,_0x378e17['error'][_0xb9e6('0x12')]);return _0x5a54db(_0x378e17[_0xb9e6('0x11')][_0xb9e6('0x12')]);}else{logger[_0xb9e6('0xb')]('CloudProvider,\x20%s,\x20%s',_0x2cbcf7,_0xb9e6('0xd'));_0x5a54db(_0x378e17[_0xb9e6('0x13')][_0xb9e6('0x12')]);}})[_0xb9e6('0x14')](function(_0x15aa3d){logger[_0xb9e6('0x11')](_0xb9e6('0xc'),_0x2cbcf7,_0x15aa3d);_0x4cc018(_0x15aa3d);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 071c2ea..7853112 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 _0x1261=['/:id','show','create','put','update','delete','/:id/oauth2/microsoft/authorize/','post','exports','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','index'];(function(_0x2b9e8a,_0x7b21d4){var _0x520e67=function(_0x22bce8){while(--_0x22bce8){_0x2b9e8a['push'](_0x2b9e8a['shift']());}};_0x520e67(++_0x7b21d4);}(_0x1261,0x144));var _0x1126=function(_0x2a0350,_0x249319){_0x2a0350=_0x2a0350-0x0;var _0x425220=_0x1261[_0x2a0350];return _0x425220;};'use strict';var express=require('express');var router=express[_0x1126('0x0')]();var auth=require(_0x1126('0x1'));var controller=require(_0x1126('0x2'));router[_0x1126('0x3')]('/',auth[_0x1126('0x4')](),controller[_0x1126('0x5')]);router[_0x1126('0x3')](_0x1126('0x6'),auth[_0x1126('0x4')](),controller[_0x1126('0x7')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1126('0x8')]);router[_0x1126('0x9')]('/:id',auth[_0x1126('0x4')](),controller[_0x1126('0xa')]);router[_0x1126('0xb')](_0x1126('0x6'),auth[_0x1126('0x4')](),controller['destroy']);router[_0x1126('0x3')](_0x1126('0xc'),auth[_0x1126('0x4')](),controller['oauth2MicrosoftAuthorize']);router[_0x1126('0xd')]('/oauth2/microsoft/callback',controller['oauth2MicrosoftCallback']);module[_0x1126('0xe')]=router; \ No newline at end of file +var _0xc4aa=['put','/:id','destroy','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','/oauth2/microsoft/callback','exports','express','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','show','post','create'];(function(_0xcb5608,_0x5ec499){var _0x3941d9=function(_0x3f3965){while(--_0x3f3965){_0xcb5608['push'](_0xcb5608['shift']());}};_0x3941d9(++_0x5ec499);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0xc4aa[_0x50a0c2];return _0x5ebadd;};'use strict';var express=require(_0xac4a('0x0'));var router=express[_0xac4a('0x1')]();var auth=require(_0xac4a('0x2'));var controller=require(_0xac4a('0x3'));router[_0xac4a('0x4')]('/',auth[_0xac4a('0x5')](),controller['index']);router['get']('/:id',auth[_0xac4a('0x5')](),controller[_0xac4a('0x6')]);router[_0xac4a('0x7')]('/',auth[_0xac4a('0x5')](),controller[_0xac4a('0x8')]);router[_0xac4a('0x9')](_0xac4a('0xa'),auth[_0xac4a('0x5')](),controller['update']);router['delete'](_0xac4a('0xa'),auth[_0xac4a('0x5')](),controller[_0xac4a('0xb')]);router['get'](_0xac4a('0xc'),auth[_0xac4a('0x5')](),controller[_0xac4a('0xd')]);router['post'](_0xac4a('0xe'),controller['oauth2MicrosoftCallback']);module[_0xac4a('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index a002d0f..2977a5c 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 _0xa67b=['exports','STRING','sequelize'];(function(_0x493b80,_0x6b33a1){var _0x11d5c6=function(_0x3010fc){while(--_0x3010fc){_0x493b80['push'](_0x493b80['shift']());}};_0x11d5c6(++_0x6b33a1);}(_0xa67b,0xc5));var _0xba67=function(_0x98e3a1,_0x5ba9bd){_0x98e3a1=_0x98e3a1-0x0;var _0x1836e0=_0xa67b[_0x98e3a1];return _0x1836e0;};'use strict';var Sequelize=require(_0xba67('0x0'));module[_0xba67('0x1')]={'name':{'type':Sequelize[_0xba67('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xba67('0x2')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0xba67('0x2')]},'phone':{'type':Sequelize[_0xba67('0x2')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xba67('0x2')]},'street':{'type':Sequelize[_0xba67('0x2')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xba67('0x2')]},'country':{'type':Sequelize[_0xba67('0x2')]},'email':{'type':Sequelize[_0xba67('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xba67('0x2')]},'sStreet':{'type':Sequelize[_0xba67('0x2')]},'sPostalCode':{'type':Sequelize[_0xba67('0x2')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xba67('0x2')]}}; \ No newline at end of file +var _0xefe5=['sequelize','STRING','name'];(function(_0x3ec7ff,_0x3f87f4){var _0x4468d8=function(_0x30e7d4){while(--_0x30e7d4){_0x3ec7ff['push'](_0x3ec7ff['shift']());}};_0x4468d8(++_0x3f87f4);}(_0xefe5,0x10b));var _0x5efe=function(_0x25be2d,_0xbe7d6b){_0x25be2d=_0x25be2d-0x0;var _0x366bb0=_0xefe5[_0x25be2d];return _0x366bb0;};'use strict';var Sequelize=require(_0x5efe('0x0'));module['exports']={'name':{'type':Sequelize[_0x5efe('0x1')],'unique':_0x5efe('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x5efe('0x1')]},'companyId':{'type':Sequelize[_0x5efe('0x1')]},'website':{'type':Sequelize[_0x5efe('0x1')]},'phone':{'type':Sequelize[_0x5efe('0x1')]},'fax':{'type':Sequelize[_0x5efe('0x1')]},'type':{'type':Sequelize[_0x5efe('0x1')]},'street':{'type':Sequelize[_0x5efe('0x1')]},'postalCode':{'type':Sequelize[_0x5efe('0x1')]},'city':{'type':Sequelize[_0x5efe('0x1')]},'country':{'type':Sequelize[_0x5efe('0x1')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x5efe('0x1')]},'sStreet':{'type':Sequelize[_0x5efe('0x1')]},'sPostalCode':{'type':Sequelize[_0x5efe('0x1')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5efe('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index b5bfdf5..49e58bd 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 _0x280d=['moment','util','path','sox','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','destroy','get','Companies','UserProfileResource','then','error','name','send','index','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','map','options','CmCompany','includeAll','include','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addContacts','CmContact','ids','findOne','pick','getContacts','eml-format','zip-dir','fast-json-patch','request-promise'];(function(_0x386e,_0x384ed8){var _0xc45a21=function(_0x5ac954){while(--_0x5ac954){_0x386e['push'](_0x386e['shift']());}};_0xc45a21(++_0x384ed8);}(_0x280d,0xa0));var _0xd280=function(_0x5e5fb3,_0x856803){_0x5e5fb3=_0x5e5fb3-0x0;var _0x1a40f7=_0x280d[_0x5e5fb3];return _0x1a40f7;};'use strict';var emlformat=require(_0xd280('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd280('0x1'));var jsonpatch=require(_0xd280('0x2'));var rp=require(_0xd280('0x3'));var moment=require(_0xd280('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd280('0x5'));var path=require(_0xd280('0x6'));var sox=require(_0xd280('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd280('0x8'));var _=require(_0xd280('0x9'));var squel=require(_0xd280('0xa'));var crypto=require(_0xd280('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xd280('0xc'));var toCsv=require(_0xd280('0xd'));var querystring=require(_0xd280('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd280('0xf'));var as=require(_0xd280('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd280('0x11'))(_0xd280('0x12'));var utils=require(_0xd280('0x13'));var config=require(_0xd280('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xd280('0x15'))['db'];function respondWithStatusCode(_0x3fab85,_0x2c7ca4){_0x2c7ca4=_0x2c7ca4||0xcc;return function(_0x11cc1e){if(_0x11cc1e){return _0x3fab85[_0xd280('0x16')](_0x2c7ca4);}return _0x3fab85[_0xd280('0x17')](_0x2c7ca4)[_0xd280('0x18')]();};}function respondWithResult(_0x34d1f4,_0x29fee2){_0x29fee2=_0x29fee2||0xc8;return function(_0x132249){if(_0x132249){return _0x34d1f4[_0xd280('0x17')](_0x29fee2)['json'](_0x132249);}};}function respondWithFilteredResult(_0x5d7c39,_0x2823e9){return function(_0x30ba9e){if(_0x30ba9e){var _0x20dd53=typeof _0x2823e9[_0xd280('0x19')]===_0xd280('0x1a')&&typeof _0x2823e9[_0xd280('0x1b')]===_0xd280('0x1a');var _0x2da025=_0x30ba9e[_0xd280('0x1c')];var _0x36f682=_0x20dd53?0x0:_0x2823e9['offset'];var _0x414634=_0x20dd53?_0x30ba9e['count']:_0x2823e9[_0xd280('0x19')]+_0x2823e9[_0xd280('0x1b')];var _0x1fa291;if(_0x414634>=_0x2da025){_0x414634=_0x2da025;_0x1fa291=0xc8;}else{_0x1fa291=0xce;}_0x5d7c39['status'](_0x1fa291);return _0x5d7c39[_0xd280('0x1d')](_0xd280('0x1e'),_0x36f682+'-'+_0x414634+'/'+_0x2da025)[_0xd280('0x1f')](_0x30ba9e);}return null;};}function patchUpdates(_0x2e4b04){return function(_0x11f1f6){try{jsonpatch[_0xd280('0x20')](_0x11f1f6,_0x2e4b04,!![]);}catch(_0x12e8eb){return BPromise[_0xd280('0x21')](_0x12e8eb);}return _0x11f1f6['save']();};}function saveUpdates(_0x56a18f,_0x12c689){return function(_0x5559d4){if(_0x5559d4){return _0x5559d4[_0xd280('0x22')](_0x56a18f)['then'](function(_0x528a5b){return _0x528a5b;});}return null;};}function removeEntity(_0x225eb1,_0x39ac4e){return function(_0x1ff8b7){if(_0x1ff8b7){return _0x1ff8b7[_0xd280('0x23')]()['then'](function(){var _0x1697a5=_0x1ff8b7[_0xd280('0x24')]({'plain':!![]});var _0x480d1d=_0xd280('0x25');return db[_0xd280('0x26')][_0xd280('0x23')]({'where':{'type':_0x480d1d,'resourceId':_0x1697a5['id']}})[_0xd280('0x27')](function(){return _0x1ff8b7;});})[_0xd280('0x27')](function(){_0x225eb1[_0xd280('0x17')](0xcc)[_0xd280('0x18')]();});}};}function handleEntityNotFound(_0x3af1c8,_0x449899){return function(_0x59299e){if(!_0x59299e){_0x3af1c8[_0xd280('0x16')](0x194);}return _0x59299e;};}function handleError(_0x470574,_0x3132f9){_0x3132f9=_0x3132f9||0x1f4;return function(_0x79bb8d){logger[_0xd280('0x28')](_0x79bb8d['stack']);if(_0x79bb8d[_0xd280('0x29')]){delete _0x79bb8d['name'];}_0x470574[_0xd280('0x17')](_0x3132f9)[_0xd280('0x2a')](_0x79bb8d);};}exports[_0xd280('0x2b')]=function(_0x5be81b,_0x3cad21){var _0x458dee={},_0x608853={},_0x40a001={'count':0x0,'rows':[]};return db['CmCompany']['describe']()[_0xd280('0x27')](function(_0x24ffb3){_0x608853['model']=_[_0xd280('0x2c')](_0x24ffb3);_0x608853[_0xd280('0x2d')]=_[_0xd280('0x2c')](_0x5be81b[_0xd280('0x2d')]);_0x608853['filters']=_[_0xd280('0x2e')](_0x608853[_0xd280('0x2f')],_0x608853[_0xd280('0x2d')]);_0x458dee[_0xd280('0x30')]=_[_0xd280('0x2e')](_0x608853[_0xd280('0x2f')],qs[_0xd280('0x31')](_0x5be81b[_0xd280('0x2d')][_0xd280('0x31')]));_0x458dee['attributes']=_0x458dee[_0xd280('0x30')][_0xd280('0x32')]?_0x458dee[_0xd280('0x30')]:_0x608853['model'];if(!_0x5be81b[_0xd280('0x2d')][_0xd280('0x33')](_0xd280('0x34'))){_0x458dee[_0xd280('0x1b')]=qs['limit'](_0x5be81b[_0xd280('0x2d')]['limit']);_0x458dee[_0xd280('0x19')]=qs['offset'](_0x5be81b['query']['offset']);}_0x458dee[_0xd280('0x35')]=qs[_0xd280('0x36')](_0x5be81b[_0xd280('0x2d')][_0xd280('0x36')]);_0x458dee[_0xd280('0x37')]=qs['filters'](_['pick'](_0x5be81b[_0xd280('0x2d')],_0x608853[_0xd280('0x38')]),_0x24ffb3);if(_0x5be81b[_0xd280('0x2d')][_0xd280('0x39')]){_0x458dee['where']=_[_0xd280('0x3a')](_0x458dee['where'],{'$or':_[_0xd280('0x3b')](_0x458dee[_0xd280('0x30')],function(_0x83a96d){var _0xe18223={};_0xe18223[_0x83a96d]={'$like':'%'+_0x5be81b[_0xd280('0x2d')][_0xd280('0x39')]+'%'};return _0xe18223;})});}_0x458dee=_[_0xd280('0x3a')]({},_0x458dee,_0x5be81b[_0xd280('0x3c')]);var _0x31ff09={'where':_0x458dee['where']};return db[_0xd280('0x3d')]['count'](_0x31ff09)[_0xd280('0x27')](function(_0x2e77ca){_0x40a001[_0xd280('0x1c')]=_0x2e77ca;if(_0x5be81b['query'][_0xd280('0x3e')]){_0x458dee[_0xd280('0x3f')]=[{'all':!![]}];}return db[_0xd280('0x3d')]['findAll'](_0x458dee);})[_0xd280('0x27')](function(_0x4ced00){_0x40a001['rows']=_0x4ced00;return _0x40a001;})['then'](respondWithFilteredResult(_0x3cad21,_0x458dee))[_0xd280('0x40')](handleError(_0x3cad21,null));})[_0xd280('0x40')](handleError(_0x3cad21,null));};exports[_0xd280('0x41')]=function(_0x385d70,_0x318987){var _0x15d5fd={'raw':![],'where':{'id':_0x385d70[_0xd280('0x42')]['id']}},_0x58c56d={};_0x58c56d[_0xd280('0x2f')]=_[_0xd280('0x2c')](db['CmCompany']['rawAttributes']);_0x58c56d[_0xd280('0x2d')]=_[_0xd280('0x2c')](_0x385d70[_0xd280('0x2d')]);_0x58c56d[_0xd280('0x38')]=_[_0xd280('0x2e')](_0x58c56d['model'],_0x58c56d[_0xd280('0x2d')]);_0x15d5fd['attributes']=_[_0xd280('0x2e')](_0x58c56d[_0xd280('0x2f')],qs[_0xd280('0x31')](_0x385d70[_0xd280('0x2d')][_0xd280('0x31')]));_0x15d5fd[_0xd280('0x30')]=_0x15d5fd['attributes'][_0xd280('0x32')]?_0x15d5fd[_0xd280('0x30')]:_0x58c56d['model'];if(_0x385d70[_0xd280('0x2d')][_0xd280('0x3e')]){_0x15d5fd[_0xd280('0x3f')]=[{'all':!![]}];}_0x15d5fd=_[_0xd280('0x3a')]({},_0x15d5fd,_0x385d70['options']);return db['CmCompany'][_0xd280('0x43')](_0x15d5fd)[_0xd280('0x27')](handleEntityNotFound(_0x318987,null))['then'](respondWithResult(_0x318987,null))[_0xd280('0x40')](handleError(_0x318987,null));};exports[_0xd280('0x44')]=function(_0x366844,_0x19aac8){return db[_0xd280('0x3d')][_0xd280('0x44')](_0x366844['body'],{})['then'](function(_0xf664c){var _0x491074=_0x366844[_0xd280('0x45')][_0xd280('0x24')]({'plain':!![]});if(!_0x491074)throw new Error(_0xd280('0x46'));if(_0x491074[_0xd280('0x47')]===_0xd280('0x45')){var _0x166117=_0xf664c[_0xd280('0x24')]({'plain':!![]});var _0x4f3312=_0xd280('0x25');return db['UserProfileSection'][_0xd280('0x43')]({'where':{'name':_0x4f3312,'userProfileId':_0x491074[_0xd280('0x48')]},'raw':!![]})[_0xd280('0x27')](function(_0x2951b9){if(_0x2951b9&&_0x2951b9['autoAssociation']===0x0){return db[_0xd280('0x26')]['create']({'name':_0x166117[_0xd280('0x29')],'resourceId':_0x166117['id'],'type':_0x2951b9[_0xd280('0x29')],'sectionId':_0x2951b9['id']},{})['then'](function(){return _0xf664c;});}else{return _0xf664c;}})[_0xd280('0x40')](function(_0x20a02a){logger[_0xd280('0x28')](_0xd280('0x49'),_0x20a02a);throw _0x20a02a;});}return _0xf664c;})[_0xd280('0x27')](respondWithResult(_0x19aac8,0xc9))[_0xd280('0x40')](handleError(_0x19aac8,null));};exports[_0xd280('0x22')]=function(_0x197918,_0x160e1b){if(_0x197918[_0xd280('0x4a')]['id']){delete _0x197918[_0xd280('0x4a')]['id'];}return db[_0xd280('0x3d')]['find']({'where':{'id':_0x197918[_0xd280('0x42')]['id']}})['then'](handleEntityNotFound(_0x160e1b,null))['then'](saveUpdates(_0x197918[_0xd280('0x4a')],null))['then'](respondWithResult(_0x160e1b,null))[_0xd280('0x40')](handleError(_0x160e1b,null));};exports[_0xd280('0x23')]=function(_0x1b7f90,_0xb992eb){return db[_0xd280('0x3d')][_0xd280('0x43')]({'where':{'id':_0x1b7f90['params']['id']}})[_0xd280('0x27')](handleEntityNotFound(_0xb992eb,null))['then'](removeEntity(_0xb992eb,null))[_0xd280('0x40')](handleError(_0xb992eb,null));};exports[_0xd280('0x4b')]=function(_0xb1eca0,_0x579349){return db[_0xd280('0x3d')]['describe']()['then'](respondWithResult(_0x579349,null))[_0xd280('0x40')](handleError(_0x579349,null));};exports[_0xd280('0x4c')]=function(_0x4c207e,_0x4a5515,_0x4838fc){return db[_0xd280('0x4d')][_0xd280('0x43')]({'where':{'id':_0x4c207e[_0xd280('0x42')]['id']}})[_0xd280('0x27')](handleEntityNotFound(_0x4a5515,null))[_0xd280('0x27')](function(_0x2d42a2){if(_0x2d42a2){return _0x2d42a2['addContacts'](_0x4c207e[_0xd280('0x4a')][_0xd280('0x4e')],_['omit'](_0x4c207e['body'],[_0xd280('0x4e'),'id'])||{});}})[_0xd280('0x27')](respondWithResult(_0x4a5515,null))[_0xd280('0x40')](handleError(_0x4a5515,null));};exports['getContacts']=function(_0x15660f,_0x5b6a90,_0x5c68f5){var _0x59d27e={};var _0x1e0c11={};var _0x3a7cd9;var _0x46fc4f;return db['CmCompany'][_0xd280('0x4f')]({'where':{'id':_0x15660f[_0xd280('0x42')]['id']}})[_0xd280('0x27')](handleEntityNotFound(_0x5b6a90,null))[_0xd280('0x27')](function(_0x22021b){if(_0x22021b){_0x3a7cd9=_0x22021b;_0x1e0c11[_0xd280('0x2f')]=_[_0xd280('0x2c')](db['CmContact']['rawAttributes']);_0x1e0c11[_0xd280('0x2d')]=_[_0xd280('0x2c')](_0x15660f['query']);_0x1e0c11[_0xd280('0x38')]=_[_0xd280('0x2e')](_0x1e0c11[_0xd280('0x2f')],_0x1e0c11['query']);_0x59d27e['attributes']=_['intersection'](_0x1e0c11[_0xd280('0x2f')],qs[_0xd280('0x31')](_0x15660f[_0xd280('0x2d')][_0xd280('0x31')]));_0x59d27e['attributes']=_0x59d27e[_0xd280('0x30')][_0xd280('0x32')]?_0x59d27e[_0xd280('0x30')]:_0x1e0c11[_0xd280('0x2f')];_0x59d27e[_0xd280('0x35')]=qs['sort'](_0x15660f['query'][_0xd280('0x36')]);_0x59d27e['where']=qs[_0xd280('0x38')](_[_0xd280('0x50')](_0x15660f['query'],_0x1e0c11[_0xd280('0x38')]));if(_0x15660f[_0xd280('0x2d')]['filter']){_0x59d27e['where']=_[_0xd280('0x3a')](_0x59d27e[_0xd280('0x37')],{'$or':_[_0xd280('0x3b')](_0x59d27e[_0xd280('0x30')],function(_0x1e9dd0){var _0x12e883={};_0x12e883[_0x1e9dd0]={'$like':'%'+_0x15660f['query'][_0xd280('0x39')]+'%'};return _0x12e883;})});}_0x59d27e=_[_0xd280('0x3a')]({},_0x59d27e,_0x15660f['options']);return _0x3a7cd9[_0xd280('0x51')](_0x59d27e);}})['then'](function(_0x25e8b5){if(_0x25e8b5){_0x46fc4f=_0x25e8b5[_0xd280('0x32')];if(!_0x15660f[_0xd280('0x2d')][_0xd280('0x33')](_0xd280('0x34'))){_0x59d27e[_0xd280('0x1b')]=qs[_0xd280('0x1b')](_0x15660f[_0xd280('0x2d')][_0xd280('0x1b')]);_0x59d27e['offset']=qs[_0xd280('0x19')](_0x15660f[_0xd280('0x2d')][_0xd280('0x19')]);}return _0x3a7cd9[_0xd280('0x51')](_0x59d27e);}})['then'](function(_0x1fb6ce){if(_0x1fb6ce){return _0x1fb6ce?{'count':_0x46fc4f,'rows':_0x1fb6ce}:null;}})[_0xd280('0x27')](respondWithResult(_0x5b6a90,null))['catch'](handleError(_0x5b6a90,null));}; \ No newline at end of file +var _0xb7ba=['undefined','limit','count','offset','set','apply','save','update','then','destroy','get','Companies','UserProfileResource','error','stack','name','CmCompany','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','map','options','where','findAll','rows','catch','params','rawAttributes','include','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','describe','addContacts','CmContact','ids','getContacts','findOne','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb7ba,0x1e1));var _0xab7b=function(_0x2ea087,_0x17f324){_0x2ea087=_0x2ea087-0x0;var _0x23ebac=_0xb7ba[_0x2ea087];return _0x23ebac;};'use strict';var emlformat=require(_0xab7b('0x0'));var rimraf=require(_0xab7b('0x1'));var zipdir=require(_0xab7b('0x2'));var jsonpatch=require(_0xab7b('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xab7b('0x4'));var Mustache=require(_0xab7b('0x5'));var util=require(_0xab7b('0x6'));var path=require('path');var sox=require(_0xab7b('0x7'));var csv=require(_0xab7b('0x8'));var ejs=require(_0xab7b('0x9'));var fs=require('fs');var fs_extra=require(_0xab7b('0xa'));var _=require(_0xab7b('0xb'));var squel=require(_0xab7b('0xc'));var crypto=require(_0xab7b('0xd'));var jsforce=require(_0xab7b('0xe'));var deskjs=require(_0xab7b('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xab7b('0x10'));var authService=require(_0xab7b('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xab7b('0x12'));var hardwareService=require(_0xab7b('0x13'));var logger=require(_0xab7b('0x14'))(_0xab7b('0x15'));var utils=require(_0xab7b('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xab7b('0x17'));var db=require(_0xab7b('0x18'))['db'];function respondWithStatusCode(_0x1e5ed8,_0x49d4ec){_0x49d4ec=_0x49d4ec||0xcc;return function(_0x14e260){if(_0x14e260){return _0x1e5ed8[_0xab7b('0x19')](_0x49d4ec);}return _0x1e5ed8[_0xab7b('0x1a')](_0x49d4ec)[_0xab7b('0x1b')]();};}function respondWithResult(_0x525354,_0x73d615){_0x73d615=_0x73d615||0xc8;return function(_0x561a01){if(_0x561a01){return _0x525354[_0xab7b('0x1a')](_0x73d615)[_0xab7b('0x1c')](_0x561a01);}};}function respondWithFilteredResult(_0x19b9e6,_0x32f4ad){return function(_0xc89968){if(_0xc89968){var _0x520e68=typeof _0x32f4ad['offset']===_0xab7b('0x1d')&&typeof _0x32f4ad[_0xab7b('0x1e')]===_0xab7b('0x1d');var _0x22ed5f=_0xc89968[_0xab7b('0x1f')];var _0x3a8583=_0x520e68?0x0:_0x32f4ad['offset'];var _0x3c38dc=_0x520e68?_0xc89968[_0xab7b('0x1f')]:_0x32f4ad[_0xab7b('0x20')]+_0x32f4ad['limit'];var _0x105af7;if(_0x3c38dc>=_0x22ed5f){_0x3c38dc=_0x22ed5f;_0x105af7=0xc8;}else{_0x105af7=0xce;}_0x19b9e6[_0xab7b('0x1a')](_0x105af7);return _0x19b9e6[_0xab7b('0x21')]('Content-Range',_0x3a8583+'-'+_0x3c38dc+'/'+_0x22ed5f)[_0xab7b('0x1c')](_0xc89968);}return null;};}function patchUpdates(_0x363fcb){return function(_0x4d96a3){try{jsonpatch[_0xab7b('0x22')](_0x4d96a3,_0x363fcb,!![]);}catch(_0x257b50){return BPromise['reject'](_0x257b50);}return _0x4d96a3[_0xab7b('0x23')]();};}function saveUpdates(_0x52f07d,_0x33083b){return function(_0x4af165){if(_0x4af165){return _0x4af165[_0xab7b('0x24')](_0x52f07d)[_0xab7b('0x25')](function(_0x408c3f){return _0x408c3f;});}return null;};}function removeEntity(_0x5b2e26,_0x1b1d9b){return function(_0x235fcf){if(_0x235fcf){return _0x235fcf[_0xab7b('0x26')]()[_0xab7b('0x25')](function(){var _0xb982d4=_0x235fcf[_0xab7b('0x27')]({'plain':!![]});var _0x139e9c=_0xab7b('0x28');return db[_0xab7b('0x29')][_0xab7b('0x26')]({'where':{'type':_0x139e9c,'resourceId':_0xb982d4['id']}})[_0xab7b('0x25')](function(){return _0x235fcf;});})[_0xab7b('0x25')](function(){_0x5b2e26[_0xab7b('0x1a')](0xcc)[_0xab7b('0x1b')]();});}};}function handleEntityNotFound(_0x2af2a3,_0x1c8528){return function(_0x4b79ed){if(!_0x4b79ed){_0x2af2a3[_0xab7b('0x19')](0x194);}return _0x4b79ed;};}function handleError(_0x4ed10c,_0x2dfb1d){_0x2dfb1d=_0x2dfb1d||0x1f4;return function(_0x280d71){logger[_0xab7b('0x2a')](_0x280d71[_0xab7b('0x2b')]);if(_0x280d71[_0xab7b('0x2c')]){delete _0x280d71[_0xab7b('0x2c')];}_0x4ed10c[_0xab7b('0x1a')](_0x2dfb1d)['send'](_0x280d71);};}exports['index']=function(_0x4262ae,_0x5b2f17){var _0x29d3a5={},_0x68a317={},_0x3d0184={'count':0x0,'rows':[]};return db[_0xab7b('0x2d')]['describe']()[_0xab7b('0x25')](function(_0x5b4fd4){_0x68a317['model']=_['keys'](_0x5b4fd4);_0x68a317[_0xab7b('0x2e')]=_[_0xab7b('0x2f')](_0x4262ae['query']);_0x68a317[_0xab7b('0x30')]=_[_0xab7b('0x31')](_0x68a317[_0xab7b('0x32')],_0x68a317[_0xab7b('0x2e')]);_0x29d3a5[_0xab7b('0x33')]=_[_0xab7b('0x31')](_0x68a317[_0xab7b('0x32')],qs[_0xab7b('0x34')](_0x4262ae['query'][_0xab7b('0x34')]));_0x29d3a5[_0xab7b('0x33')]=_0x29d3a5['attributes'][_0xab7b('0x35')]?_0x29d3a5[_0xab7b('0x33')]:_0x68a317[_0xab7b('0x32')];if(!_0x4262ae[_0xab7b('0x2e')][_0xab7b('0x36')](_0xab7b('0x37'))){_0x29d3a5[_0xab7b('0x1e')]=qs[_0xab7b('0x1e')](_0x4262ae[_0xab7b('0x2e')][_0xab7b('0x1e')]);_0x29d3a5[_0xab7b('0x20')]=qs[_0xab7b('0x20')](_0x4262ae[_0xab7b('0x2e')][_0xab7b('0x20')]);}_0x29d3a5[_0xab7b('0x38')]=qs[_0xab7b('0x39')](_0x4262ae[_0xab7b('0x2e')]['sort']);_0x29d3a5['where']=qs[_0xab7b('0x30')](_[_0xab7b('0x3a')](_0x4262ae['query'],_0x68a317[_0xab7b('0x30')]),_0x5b4fd4);if(_0x4262ae[_0xab7b('0x2e')][_0xab7b('0x3b')]){_0x29d3a5['where']=_[_0xab7b('0x3c')](_0x29d3a5['where'],{'$or':_[_0xab7b('0x3d')](_0x29d3a5[_0xab7b('0x33')],function(_0x3e2514){var _0x13389e={};_0x13389e[_0x3e2514]={'$like':'%'+_0x4262ae['query']['filter']+'%'};return _0x13389e;})});}_0x29d3a5=_[_0xab7b('0x3c')]({},_0x29d3a5,_0x4262ae[_0xab7b('0x3e')]);var _0x586b96={'where':_0x29d3a5[_0xab7b('0x3f')]};return db[_0xab7b('0x2d')][_0xab7b('0x1f')](_0x586b96)[_0xab7b('0x25')](function(_0xab5785){_0x3d0184[_0xab7b('0x1f')]=_0xab5785;if(_0x4262ae['query']['includeAll']){_0x29d3a5['include']=[{'all':!![]}];}return db[_0xab7b('0x2d')][_0xab7b('0x40')](_0x29d3a5);})[_0xab7b('0x25')](function(_0x511a58){_0x3d0184[_0xab7b('0x41')]=_0x511a58;return _0x3d0184;})['then'](respondWithFilteredResult(_0x5b2f17,_0x29d3a5))[_0xab7b('0x42')](handleError(_0x5b2f17,null));})[_0xab7b('0x42')](handleError(_0x5b2f17,null));};exports['show']=function(_0xc37e8c,_0x5db34e){var _0x130bd8={'raw':![],'where':{'id':_0xc37e8c[_0xab7b('0x43')]['id']}},_0x211396={};_0x211396[_0xab7b('0x32')]=_[_0xab7b('0x2f')](db[_0xab7b('0x2d')][_0xab7b('0x44')]);_0x211396[_0xab7b('0x2e')]=_[_0xab7b('0x2f')](_0xc37e8c[_0xab7b('0x2e')]);_0x211396[_0xab7b('0x30')]=_[_0xab7b('0x31')](_0x211396[_0xab7b('0x32')],_0x211396['query']);_0x130bd8['attributes']=_[_0xab7b('0x31')](_0x211396[_0xab7b('0x32')],qs['fields'](_0xc37e8c[_0xab7b('0x2e')][_0xab7b('0x34')]));_0x130bd8[_0xab7b('0x33')]=_0x130bd8[_0xab7b('0x33')][_0xab7b('0x35')]?_0x130bd8[_0xab7b('0x33')]:_0x211396[_0xab7b('0x32')];if(_0xc37e8c[_0xab7b('0x2e')]['includeAll']){_0x130bd8[_0xab7b('0x45')]=[{'all':!![]}];}_0x130bd8=_[_0xab7b('0x3c')]({},_0x130bd8,_0xc37e8c['options']);return db[_0xab7b('0x2d')]['find'](_0x130bd8)[_0xab7b('0x25')](handleEntityNotFound(_0x5db34e,null))[_0xab7b('0x25')](respondWithResult(_0x5db34e,null))[_0xab7b('0x42')](handleError(_0x5db34e,null));};exports['create']=function(_0x4829e3,_0x18b978){return db[_0xab7b('0x2d')][_0xab7b('0x46')](_0x4829e3[_0xab7b('0x47')],{})[_0xab7b('0x25')](function(_0x1c433e){var _0xe9f21b=_0x4829e3[_0xab7b('0x48')][_0xab7b('0x27')]({'plain':!![]});if(!_0xe9f21b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xe9f21b[_0xab7b('0x49')]===_0xab7b('0x48')){var _0x48c44f=_0x1c433e[_0xab7b('0x27')]({'plain':!![]});var _0x23d550=_0xab7b('0x28');return db[_0xab7b('0x4a')]['find']({'where':{'name':_0x23d550,'userProfileId':_0xe9f21b[_0xab7b('0x4b')]},'raw':!![]})[_0xab7b('0x25')](function(_0x42ce19){if(_0x42ce19&&_0x42ce19[_0xab7b('0x4c')]===0x0){return db[_0xab7b('0x29')][_0xab7b('0x46')]({'name':_0x48c44f['name'],'resourceId':_0x48c44f['id'],'type':_0x42ce19[_0xab7b('0x2c')],'sectionId':_0x42ce19['id']},{})[_0xab7b('0x25')](function(){return _0x1c433e;});}else{return _0x1c433e;}})[_0xab7b('0x42')](function(_0x5e8d54){logger[_0xab7b('0x2a')](_0xab7b('0x4d'),_0x5e8d54);throw _0x5e8d54;});}return _0x1c433e;})['then'](respondWithResult(_0x18b978,0xc9))[_0xab7b('0x42')](handleError(_0x18b978,null));};exports['update']=function(_0x5b4800,_0x415727){if(_0x5b4800[_0xab7b('0x47')]['id']){delete _0x5b4800[_0xab7b('0x47')]['id'];}return db[_0xab7b('0x2d')][_0xab7b('0x4e')]({'where':{'id':_0x5b4800[_0xab7b('0x43')]['id']}})[_0xab7b('0x25')](handleEntityNotFound(_0x415727,null))['then'](saveUpdates(_0x5b4800['body'],null))[_0xab7b('0x25')](respondWithResult(_0x415727,null))[_0xab7b('0x42')](handleError(_0x415727,null));};exports[_0xab7b('0x26')]=function(_0x2f08f5,_0x24c396){return db[_0xab7b('0x2d')][_0xab7b('0x4e')]({'where':{'id':_0x2f08f5[_0xab7b('0x43')]['id']}})[_0xab7b('0x25')](handleEntityNotFound(_0x24c396,null))[_0xab7b('0x25')](removeEntity(_0x24c396,null))['catch'](handleError(_0x24c396,null));};exports[_0xab7b('0x4f')]=function(_0x1f2f81,_0x95675c){return db[_0xab7b('0x2d')]['describe']()['then'](respondWithResult(_0x95675c,null))[_0xab7b('0x42')](handleError(_0x95675c,null));};exports[_0xab7b('0x50')]=function(_0x25873c,_0x91015c,_0xade2ad){return db[_0xab7b('0x51')][_0xab7b('0x4e')]({'where':{'id':_0x25873c[_0xab7b('0x43')]['id']}})[_0xab7b('0x25')](handleEntityNotFound(_0x91015c,null))[_0xab7b('0x25')](function(_0x389a45){if(_0x389a45){return _0x389a45['addContacts'](_0x25873c[_0xab7b('0x47')][_0xab7b('0x52')],_['omit'](_0x25873c[_0xab7b('0x47')],[_0xab7b('0x52'),'id'])||{});}})[_0xab7b('0x25')](respondWithResult(_0x91015c,null))[_0xab7b('0x42')](handleError(_0x91015c,null));};exports[_0xab7b('0x53')]=function(_0x46a8d7,_0x226e4c,_0x40ec46){var _0x4f9b32={};var _0x14b597={};var _0x32f9c2;var _0x457e75;return db[_0xab7b('0x2d')][_0xab7b('0x54')]({'where':{'id':_0x46a8d7[_0xab7b('0x43')]['id']}})[_0xab7b('0x25')](handleEntityNotFound(_0x226e4c,null))[_0xab7b('0x25')](function(_0x48cc38){if(_0x48cc38){_0x32f9c2=_0x48cc38;_0x14b597[_0xab7b('0x32')]=_[_0xab7b('0x2f')](db['CmContact']['rawAttributes']);_0x14b597[_0xab7b('0x2e')]=_[_0xab7b('0x2f')](_0x46a8d7[_0xab7b('0x2e')]);_0x14b597[_0xab7b('0x30')]=_[_0xab7b('0x31')](_0x14b597[_0xab7b('0x32')],_0x14b597['query']);_0x4f9b32[_0xab7b('0x33')]=_[_0xab7b('0x31')](_0x14b597[_0xab7b('0x32')],qs['fields'](_0x46a8d7['query'][_0xab7b('0x34')]));_0x4f9b32[_0xab7b('0x33')]=_0x4f9b32[_0xab7b('0x33')][_0xab7b('0x35')]?_0x4f9b32['attributes']:_0x14b597[_0xab7b('0x32')];_0x4f9b32[_0xab7b('0x38')]=qs[_0xab7b('0x39')](_0x46a8d7[_0xab7b('0x2e')]['sort']);_0x4f9b32['where']=qs[_0xab7b('0x30')](_['pick'](_0x46a8d7[_0xab7b('0x2e')],_0x14b597[_0xab7b('0x30')]));if(_0x46a8d7[_0xab7b('0x2e')][_0xab7b('0x3b')]){_0x4f9b32[_0xab7b('0x3f')]=_[_0xab7b('0x3c')](_0x4f9b32[_0xab7b('0x3f')],{'$or':_['map'](_0x4f9b32[_0xab7b('0x33')],function(_0x324330){var _0x14ccb3={};_0x14ccb3[_0x324330]={'$like':'%'+_0x46a8d7['query'][_0xab7b('0x3b')]+'%'};return _0x14ccb3;})});}_0x4f9b32=_[_0xab7b('0x3c')]({},_0x4f9b32,_0x46a8d7[_0xab7b('0x3e')]);return _0x32f9c2[_0xab7b('0x53')](_0x4f9b32);}})[_0xab7b('0x25')](function(_0x1a8ff0){if(_0x1a8ff0){_0x457e75=_0x1a8ff0[_0xab7b('0x35')];if(!_0x46a8d7['query'][_0xab7b('0x36')](_0xab7b('0x37'))){_0x4f9b32[_0xab7b('0x1e')]=qs[_0xab7b('0x1e')](_0x46a8d7[_0xab7b('0x2e')][_0xab7b('0x1e')]);_0x4f9b32[_0xab7b('0x20')]=qs[_0xab7b('0x20')](_0x46a8d7['query'][_0xab7b('0x20')]);}return _0x32f9c2['getContacts'](_0x4f9b32);}})[_0xab7b('0x25')](function(_0x59c268){if(_0x59c268){return _0x59c268?{'count':_0x457e75,'rows':_0x59c268}:null;}})['then'](respondWithResult(_0x226e4c,null))[_0xab7b('0x42')](handleError(_0x226e4c,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 14e2cdb..0173bdf 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 _0xd55b=['util','../../config/logger','moment','bluebird','request-promise','../../config/environment','exports','define','CmCompany','cm_companies'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0xd55b,0xfa));var _0xbd55=function(_0x361382,_0x29c2ce){_0x361382=_0x361382-0x0;var _0x3394b9=_0xd55b[_0x361382];return _0x3394b9;};'use strict';var _=require('lodash');var util=require(_0xbd55('0x0'));var logger=require(_0xbd55('0x1'))('api');var moment=require(_0xbd55('0x2'));var BPromise=require(_0xbd55('0x3'));var rp=require(_0xbd55('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xbd55('0x5'));var attributes=require('./cmCompany.attributes');module[_0xbd55('0x6')]=function(_0x27b84f,_0x56786c){return _0x27b84f[_0xbd55('0x7')](_0xbd55('0x8'),attributes,{'tableName':_0xbd55('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf1dd=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','cm_companies'];(function(_0x421c56,_0x4efd00){var _0x49b244=function(_0x5cd079){while(--_0x5cd079){_0x421c56['push'](_0x421c56['shift']());}};_0x49b244(++_0x4efd00);}(_0xf1dd,0x6c));var _0xdf1d=function(_0x26a818,_0x40708a){_0x26a818=_0x26a818-0x0;var _0x5d8ca0=_0xf1dd[_0x26a818];return _0x5d8ca0;};'use strict';var _=require(_0xdf1d('0x0'));var util=require('util');var logger=require(_0xdf1d('0x1'))(_0xdf1d('0x2'));var moment=require(_0xdf1d('0x3'));var BPromise=require(_0xdf1d('0x4'));var rp=require(_0xdf1d('0x5'));var fs=require('fs');var path=require(_0xdf1d('0x6'));var rimraf=require(_0xdf1d('0x7'));var config=require(_0xdf1d('0x8'));var attributes=require('./cmCompany.attributes');module[_0xdf1d('0x9')]=function(_0x529b1a,_0x4a180e){return _0x529b1a[_0xdf1d('0xa')]('CmCompany',attributes,{'tableName':_0xdf1d('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 e74a514..a75740b 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 _0xddb6=['error','code','message','info','result','catch','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','CmCompany,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x503564,_0x55867e){var _0x4be9fd=function(_0x41c543){while(--_0x41c543){_0x503564['push'](_0x503564['shift']());}};_0x4be9fd(++_0x55867e);}(_0xddb6,0x1a4));var _0x6ddb=function(_0x1de654,_0x438816){_0x1de654=_0x1de654-0x0;var _0x5ba5fb=_0xddb6[_0x1de654];return _0x5ba5fb;};'use strict';var _=require(_0x6ddb('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6ddb('0x1'));var rs=require(_0x6ddb('0x2'));var fs=require('fs');var Redis=require(_0x6ddb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6ddb('0x4'));var logger=require(_0x6ddb('0x5'))(_0x6ddb('0x6'));var config=require(_0x6ddb('0x7'));var jayson=require(_0x6ddb('0x8'));var client=jayson[_0x6ddb('0x9')][_0x6ddb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x702e43,_0x30d28a,_0x52755c){return new BPromise(function(_0x4e3ea5,_0x54eaec){return client[_0x6ddb('0xb')](_0x702e43,_0x52755c)[_0x6ddb('0xc')](function(_0x216f35){logger['info'](_0x6ddb('0xd'),_0x30d28a,_0x6ddb('0xe'));logger[_0x6ddb('0xf')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x30d28a,_0x6ddb('0xe'),JSON[_0x6ddb('0x10')](_0x216f35));if(_0x216f35[_0x6ddb('0x11')]){if(_0x216f35['error'][_0x6ddb('0x12')]===0x1f4){logger[_0x6ddb('0x11')](_0x6ddb('0xd'),_0x30d28a,_0x216f35[_0x6ddb('0x11')][_0x6ddb('0x13')]);return _0x54eaec(_0x216f35['error']['message']);}logger[_0x6ddb('0x11')](_0x6ddb('0xd'),_0x30d28a,_0x216f35['error'][_0x6ddb('0x13')]);return _0x4e3ea5(_0x216f35['error'][_0x6ddb('0x13')]);}else{logger[_0x6ddb('0x14')](_0x6ddb('0xd'),_0x30d28a,_0x6ddb('0xe'));_0x4e3ea5(_0x216f35[_0x6ddb('0x15')][_0x6ddb('0x13')]);}})[_0x6ddb('0x16')](function(_0x49b0b1){logger[_0x6ddb('0x11')](_0x6ddb('0xd'),_0x30d28a,_0x49b0b1);_0x54eaec(_0x49b0b1);});});} \ No newline at end of file +var _0x4e8a=['debug','CmCompany,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','CmCompany,\x20%s,\x20%s'];(function(_0x281305,_0x2998d6){var _0x56ffbe=function(_0x270b4c){while(--_0x270b4c){_0x281305['push'](_0x281305['shift']());}};_0x56ffbe(++_0x2998d6);}(_0x4e8a,0x17e));var _0xa4e8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4e8a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xa4e8('0x0'));var moment=require('moment');var BPromise=require(_0xa4e8('0x1'));var rs=require(_0xa4e8('0x2'));var fs=require('fs');var Redis=require(_0xa4e8('0x3'));var db=require(_0xa4e8('0x4'))['db'];var utils=require(_0xa4e8('0x5'));var logger=require(_0xa4e8('0x6'))(_0xa4e8('0x7'));var config=require(_0xa4e8('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa4e8('0x9')][_0xa4e8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xbe47b1,_0x1ef0a9,_0x1a9785){return new BPromise(function(_0x5eac77,_0x36e240){return client['request'](_0xbe47b1,_0x1a9785)[_0xa4e8('0xb')](function(_0x46d010){logger[_0xa4e8('0xc')](_0xa4e8('0xd'),_0x1ef0a9,'request\x20sent');logger[_0xa4e8('0xe')](_0xa4e8('0xf'),_0x1ef0a9,_0xa4e8('0x10'),JSON[_0xa4e8('0x11')](_0x46d010));if(_0x46d010[_0xa4e8('0x12')]){if(_0x46d010['error'][_0xa4e8('0x13')]===0x1f4){logger[_0xa4e8('0x12')](_0xa4e8('0xd'),_0x1ef0a9,_0x46d010['error'][_0xa4e8('0x14')]);return _0x36e240(_0x46d010[_0xa4e8('0x12')]['message']);}logger[_0xa4e8('0x12')]('CmCompany,\x20%s,\x20%s',_0x1ef0a9,_0x46d010['error'][_0xa4e8('0x14')]);return _0x5eac77(_0x46d010[_0xa4e8('0x12')]['message']);}else{logger[_0xa4e8('0xc')](_0xa4e8('0xd'),_0x1ef0a9,_0xa4e8('0x10'));_0x5eac77(_0x46d010[_0xa4e8('0x15')][_0xa4e8('0x14')]);}})['catch'](function(_0x1fff9d){logger['error']('CmCompany,\x20%s,\x20%s',_0x1ef0a9,_0x1fff9d);_0x36e240(_0x1fff9d);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 83c331a..3659d62 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 _0x6011=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/contacts','getContacts','post','create','addContacts','put','delete','destroy','multer','util'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6011,0xa6));var _0x1601=function(_0x5c135d,_0x52bd57){_0x5c135d=_0x5c135d-0x0;var _0x264044=_0x6011[_0x5c135d];return _0x264044;};'use strict';var multer=require(_0x1601('0x0'));var util=require(_0x1601('0x1'));var path=require(_0x1601('0x2'));var timeout=require(_0x1601('0x3'));var express=require(_0x1601('0x4'));var router=express['Router']();var fs_extra=require(_0x1601('0x5'));var auth=require(_0x1601('0x6'));var interaction=require(_0x1601('0x7'));var config=require(_0x1601('0x8'));var controller=require(_0x1601('0x9'));router[_0x1601('0xa')]('/',auth[_0x1601('0xb')](),controller[_0x1601('0xc')]);router[_0x1601('0xa')](_0x1601('0xd'),auth[_0x1601('0xb')](),controller[_0x1601('0xe')]);router[_0x1601('0xa')](_0x1601('0xf'),auth['isAuthenticated'](),controller['show']);router['get'](_0x1601('0x10'),auth[_0x1601('0xb')](),controller[_0x1601('0x11')]);router[_0x1601('0x12')]('/',auth[_0x1601('0xb')](),controller[_0x1601('0x13')]);router[_0x1601('0x12')](_0x1601('0x10'),auth[_0x1601('0xb')](),controller[_0x1601('0x14')]);router[_0x1601('0x15')](_0x1601('0xf'),auth[_0x1601('0xb')](),controller['update']);router[_0x1601('0x16')](_0x1601('0xf'),auth['isAuthenticated'](),controller[_0x1601('0x17')]);module['exports']=router; \ No newline at end of file +var _0x06e3=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','/:id/contacts','getContacts','create','post','addContacts','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x2980de,_0x1426a4){var _0x81a4ca=function(_0x19040e){while(--_0x19040e){_0x2980de['push'](_0x2980de['shift']());}};_0x81a4ca(++_0x1426a4);}(_0x06e3,0x1cc));var _0x306e=function(_0x39ad28,_0x36dbfd){_0x39ad28=_0x39ad28-0x0;var _0x1a6e47=_0x06e3[_0x39ad28];return _0x1a6e47;};'use strict';var multer=require(_0x306e('0x0'));var util=require(_0x306e('0x1'));var path=require(_0x306e('0x2'));var timeout=require(_0x306e('0x3'));var express=require(_0x306e('0x4'));var router=express[_0x306e('0x5')]();var fs_extra=require(_0x306e('0x6'));var auth=require(_0x306e('0x7'));var interaction=require(_0x306e('0x8'));var config=require(_0x306e('0x9'));var controller=require('./cmCompany.controller');router[_0x306e('0xa')]('/',auth[_0x306e('0xb')](),controller[_0x306e('0xc')]);router[_0x306e('0xa')]('/describe',auth[_0x306e('0xb')](),controller[_0x306e('0xd')]);router[_0x306e('0xa')](_0x306e('0xe'),auth[_0x306e('0xb')](),controller[_0x306e('0xf')]);router[_0x306e('0xa')](_0x306e('0x10'),auth[_0x306e('0xb')](),controller[_0x306e('0x11')]);router['post']('/',auth[_0x306e('0xb')](),controller[_0x306e('0x12')]);router[_0x306e('0x13')]('/:id/contacts',auth[_0x306e('0xb')](),controller[_0x306e('0x14')]);router[_0x306e('0x15')](_0x306e('0xe'),auth['isAuthenticated'](),controller[_0x306e('0x16')]);router[_0x306e('0x17')](_0x306e('0xe'),auth[_0x306e('0xb')](),controller[_0x306e('0x18')]);module[_0x306e('0x19')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index c234c72..630b763 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 _0x93ac=['DATE','NOW','sequelize','exports','STRING','INTEGER','UNSIGNED'];(function(_0x4b64a4,_0x1bdc50){var _0xd19b0e=function(_0x4dfbe0){while(--_0x4dfbe0){_0x4b64a4['push'](_0x4b64a4['shift']());}};_0xd19b0e(++_0x1bdc50);}(_0x93ac,0xfe));var _0xc93a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x93ac[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var Sequelize=require(_0xc93a('0x0'));module[_0xc93a('0x1')]={'firstName':{'type':Sequelize[_0xc93a('0x2')],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0xc93a('0x2')]},'postalCode':{'type':Sequelize[_0xc93a('0x2')]},'city':{'type':Sequelize[_0xc93a('0x2')]},'country':{'type':Sequelize[_0xc93a('0x2')]},'dateOfBirth':{'type':Sequelize[_0xc93a('0x2')]},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0xc93a('0x2')]},'mobile':{'type':Sequelize[_0xc93a('0x2')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xc93a('0x2')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0xc93a('0x2')]},'skype':{'type':Sequelize[_0xc93a('0x2')]},'teams':{'type':Sequelize[_0xc93a('0x2')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0xc93a('0x2')]},'wechat':{'type':Sequelize[_0xc93a('0x2')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0xc93a('0x3')]},'AdditionalPhones':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xc93a('0x3')](0x2)[_0xc93a('0x4')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xc93a('0x5')],'defaultValue':Sequelize[_0xc93a('0x6')]},'dialTimezone':{'type':Sequelize[_0xc93a('0x2')]},'utcOffset':{'type':Sequelize[_0xc93a('0x3')]}}; \ No newline at end of file +var _0xd365=['STRING','INTEGER','UNSIGNED','DATE','exports'];(function(_0x444b0d,_0x27bac6){var _0x368629=function(_0x3dbbb4){while(--_0x3dbbb4){_0x444b0d['push'](_0x444b0d['shift']());}};_0x368629(++_0x27bac6);}(_0xd365,0x6d));var _0x5d36=function(_0x2af262,_0x1c6838){_0x2af262=_0x2af262-0x0;var _0x2df649=_0xd365[_0x2af262];return _0x2df649;};'use strict';var _=require('lodash');var Sequelize=require('sequelize');module[_0x5d36('0x0')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0x5d36('0x1')]},'street':{'type':Sequelize[_0x5d36('0x1')]},'postalCode':{'type':Sequelize[_0x5d36('0x1')]},'city':{'type':Sequelize[_0x5d36('0x1')]},'country':{'type':Sequelize[_0x5d36('0x1')]},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0x5d36('0x1')]},'mobile':{'type':Sequelize[_0x5d36('0x1')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x5d36('0x1')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0x5d36('0x1')]},'fb_data':{'type':Sequelize[_0x5d36('0x1')]},'twitter':{'type':Sequelize[_0x5d36('0x1')]},'skype':{'type':Sequelize[_0x5d36('0x1')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize[_0x5d36('0x1')]},'line':{'type':Sequelize[_0x5d36('0x1')]},'wechat':{'type':Sequelize[_0x5d36('0x1')]},'telegram':{'type':Sequelize[_0x5d36('0x1')]},'UserId':{'type':Sequelize[_0x5d36('0x2')]},'AdditionalPhones':{'type':Sequelize[_0x5d36('0x1')]},'priority':{'type':Sequelize[_0x5d36('0x2')](0x2)[_0x5d36('0x3')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x5d36('0x4')],'defaultValue':Sequelize['NOW']},'dialTimezone':{'type':Sequelize[_0x5d36('0x1')]},'utcOffset':{'type':Sequelize[_0x5d36('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 8f9388e..506ba5d 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 _0x84a0=['duplicateAdditionalPhones','fromContactId','toContactId','rescheduleAdditionalPhones','hopperId','getHoppers','rawAttributes','pick','ContactId','includeAll','include','getHopperHistories','options','getHopperFinals','getJscriptySessions','binding_keys','binding_values','No\x20association\x20values\x20specified!','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','Incorrect\x20binding\x20parameters\x20passed!','zipObject','firstName','No\x20firstName\x20column\x20specified','root','file','chmodSync','0777','child_process','fork','CompanyId','socket_timestamp','File\x20uploaded\x20correctly!','pid','upload','createReadStream','parse','meta','import','No\x20ListId\x20specified','binding','No\x20phone\x20column\x20specified','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','importUpdates','getJourney','mail','chat','sms','fax','whatsapp','voice','-createdAt','includes','toLowerCase','Invalid\x20channel','channel','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','uniqueid','destination','callerid','starttime','endtime','duration','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','fullname','findAndCountAll','startCase','Website','Account','closed','note','disposition','thirdDisposition','UserId','key','Owner','browserName','customerIp','deviceModel','osName','ratingType','ratingValue','referer','substatus','externalUrl','threadId','Interaction','flatten','sortBy','reverse','slice','moment','bluebird','util','path','squel','papaparse','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/environment/shared','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmContact.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','sendStatus','error','stack','name','send','index','CmContact','describe','keys','length','startsWith','cf_','fieldType','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','select','field','color','from','tools_tags','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20c.id','cm_contact_has_tags','ct.CmContactId\x20=\x20c.id','t.id\x20=\x20ct.TagId','c.deletedAt\x20IS\x20NULL','expr','search','conditions','find','Tag','value','split','map','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','and','uc.UserId\x20=\x20?','castTo','DATE','text','filter','isNil','Contact','isEmpty','forEach','ListId','c.ListId\x20IN\x20?','concat','\x20=\x20?','tag','isArray','replace','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','c.email\x20LIKE\x20?','c.id','Sequelize','QueryTypes','SELECT','COUNT(*)','order','DESC','having','t.id\x20IN\x20?','resolve','user','agent','some','c.ListId\x20IS\x20NULL','role','autocomplete','sequelize','toString','keyBy','merge','c.firstName','c.lastName','c.phone','c.mobile','c.email','c.ListId','c.createdAt','c.CompanyId','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','Tags','push','rows','params','catch','tags','columnName','displayName','alias','custom','values','body','get','mergeWith','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsMessage','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','CmHopperHistory','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','join','dialTimezone','timezones','utcOffset','additionalPhones','bulkCreate','each','duplicates','$or','findOrCreate','contact','all','Phones','ContactItemType','ItemType','literal','Phones.OrderBy','findAll','omit','format','cf_%d','$and','CmCustomField','pickBy','table','cm_contacts','setFields','id\x20=\x20?','toParam','phone','getTags','findOne','setTags','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','PHONE','CmHopperAdditionalPhone','item','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','getAdditionalPhones'];(function(_0x46dd2b,_0x4d6e97){var _0x3f29c6=function(_0x123a2f){while(--_0x123a2f){_0x46dd2b['push'](_0x46dd2b['shift']());}};_0x3f29c6(++_0x4d6e97);}(_0x84a0,0x66));var _0x084a=function(_0x25f4dc,_0x59bec9){_0x25f4dc=_0x25f4dc-0x0;var _0x46ce50=_0x84a0[_0x25f4dc];return _0x46ce50;};'use strict';var moment=require(_0x084a('0x0'));var BPromise=require(_0x084a('0x1'));var util=require(_0x084a('0x2'));var path=require(_0x084a('0x3'));var fs=require('fs');var _=require('lodash');var squel=require(_0x084a('0x4'));var Papa=require(_0x084a('0x5'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var as=require(_0x084a('0x6'));var logger=require(_0x084a('0x7'))('api');var config=require(_0x084a('0x8'));var shared=require(_0x084a('0x9'));var db=require(_0x084a('0xa'))['db'];config[_0x084a('0xb')]=_[_0x084a('0xc')](config['redis'],{'host':_0x084a('0xd'),'port':0x18eb});var socket=require(_0x084a('0xe'))(new Redis(config[_0x084a('0xb')]));require(_0x084a('0xf'))[_0x084a('0x10')](socket);function respondWithResult(_0x4c1e29,_0x4dd423){_0x4dd423=_0x4dd423||0xc8;return function(_0x3d9dc6){if(_0x3d9dc6){return _0x4c1e29[_0x084a('0x11')](_0x4dd423)[_0x084a('0x12')](_0x3d9dc6);}};}function respondWithFilteredResult(_0x2abce2,_0x2d7c90){return function(_0x57c405){if(_0x57c405){var _0x4ef41f=typeof _0x2d7c90[_0x084a('0x13')]===_0x084a('0x14')&&typeof _0x2d7c90[_0x084a('0x15')]===_0x084a('0x14');var _0x1bdfb8=_0x57c405[_0x084a('0x16')];var _0x3ff351=_0x4ef41f?0x0:_0x2d7c90[_0x084a('0x13')];var _0x5aef40=_0x4ef41f?_0x57c405[_0x084a('0x16')]:_0x2d7c90['offset']+_0x2d7c90[_0x084a('0x15')];var _0x3ccaca;if(_0x5aef40>=_0x1bdfb8){_0x5aef40=_0x1bdfb8;_0x3ccaca=0xc8;}else{_0x3ccaca=0xce;}_0x2abce2[_0x084a('0x11')](_0x3ccaca);return _0x2abce2[_0x084a('0x17')](_0x084a('0x18'),_0x3ff351+'-'+_0x5aef40+'/'+_0x1bdfb8)['json'](_0x57c405);}return null;};}function saveUpdates(_0x443ebb){return function(_0x4abd81){if(_0x4abd81){return _0x4abd81[_0x084a('0x19')](_0x443ebb)[_0x084a('0x1a')](function(_0x4af43e){return _0x4af43e;});}return null;};}function removeEntity(_0xf2c333){return function(_0x32c729){if(_0x32c729){return _0x32c729[_0x084a('0x1b')]()[_0x084a('0x1a')](function(){_0xf2c333[_0x084a('0x11')](0xcc)[_0x084a('0x1c')]();});}};}function handleEntityNotFound(_0x447a19){return function(_0x34e86e){if(!_0x34e86e){_0x447a19[_0x084a('0x1d')](0x194);}return _0x34e86e;};}function handleError(_0xcb5356,_0x3c7fd6){_0x3c7fd6=_0x3c7fd6||0x1f4;return function(_0x279e25){logger[_0x084a('0x1e')](_0x279e25[_0x084a('0x1f')]);if(_0x279e25[_0x084a('0x20')]){delete _0x279e25['name'];}_0xcb5356[_0x084a('0x11')](_0x3c7fd6)[_0x084a('0x21')](_0x279e25);};}exports[_0x084a('0x22')]=function(_0x2d62bf,_0x1c3f6c){var _0x4865c8={},_0x755c24={},_0x288e9e={'count':0x0,'rows':[]};return db[_0x084a('0x23')][_0x084a('0x24')]()[_0x084a('0x1a')](function(_0x3cdc1e){var _0x5be167=[];for(var _0x297e5b=0x0;_0x297e5b0x1){_0x3d1aa5['or'](_0x084a('0x5d'),qs[_0x084a('0x5e')](_0x490ad9),null);}else{if(qs[_0x084a('0x5f')](_0x490ad9)){_0x3d1aa5['or'](_0x084a('0x60'),_0x490ad9+'%');_0x3d1aa5['or']('c.phone\x20LIKE\x20?',_0x490ad9+'%');_0x3d1aa5['or'](_0x084a('0x61'),_0x490ad9+'%');_0x3d1aa5['or'](_0x084a('0x62'),_0x490ad9+'%');}else if(qs[_0x084a('0x63')](_0x490ad9)){_0x3d1aa5['or']('c.email\x20LIKE\x20?',_0x490ad9+'%');}else{_0x3d1aa5['or'](_0x084a('0x64'),'%'+_0x490ad9+'%');_0x3d1aa5['or'](_0x084a('0x65'),'%'+_0x490ad9+'%');_0x3d1aa5['or'](_0x084a('0x66'),'%'+_0x490ad9+'%');}}}}_0x284cdc[_0x084a('0x34')](_0x3d1aa5);_0x284cdc['group'](_0x084a('0x67'));var _0x58fe64={'type':db[_0x084a('0x68')][_0x084a('0x69')][_0x084a('0x6a')],'raw':!![]};var _0x4cc344=_0x284cdc['clone']();_0x4cc344[_0x084a('0x36')](_0x084a('0x6b'));if(_0x4865c8['order']){_0x4865c8[_0x084a('0x6c')]['forEach'](function(_0x501017){_0x284cdc[_0x084a('0x6c')]('c.'+_0x501017[0x0],_0x501017[0x1]===_0x084a('0x6d')?![]:!![]);});}if(!_[_0x084a('0x54')](_0x432eb7)){_0x284cdc[_0x084a('0x6e')](_0x256008);_0x4cc344[_0x084a('0x34')](_0x084a('0x6f'),_0x432eb7);}Promise[_0x084a('0x70')]()[_0x084a('0x1a')](function(){if(!_0x515743)return;if(_0x2d62bf[_0x084a('0x71')]['role']!==_0x084a('0x72'))return;if(!_[_0x084a('0x73')](_0x515743[_0x084a('0x43')],['field',_0x084a('0x4b')])){return _0x2d62bf[_0x084a('0x71')]['getLists']({'attributes':['id'],'raw':!![]})[_0x084a('0x1a')](function(_0x51e151){if(_['isEmpty'](_0x51e151)){_0x4cc344[_0x084a('0x34')]('c.ListId\x20IS\x20NULL');_0x284cdc['where'](_0x084a('0x74'));}else{_0x4cc344[_0x084a('0x34')](_0x084a('0x57'),_['map'](_0x51e151,'id'));_0x284cdc[_0x084a('0x34')](_0x084a('0x57'),_[_0x084a('0x48')](_0x51e151,'id'));}});}})[_0x084a('0x1a')](function(){if(_0x2d62bf[_0x084a('0x71')][_0x084a('0x75')]===_0x084a('0x72')&&!_0x515743&&!_0x2d62bf['query']['ListId']&&_0x2d62bf[_0x084a('0x2c')][_0x084a('0x76')]!=='true')return[];return db[_0x084a('0x77')][_0x084a('0x2c')](_0x4cc344[_0x084a('0x78')](),_0x58fe64);})[_0x084a('0x1a')](function(_0x48e300){_0x288e9e[_0x084a('0x16')]=_0x48e300[_0x084a('0x26')];if(_0x288e9e[_0x084a('0x16')]===0x0)return[];return db['sequelize']['query'](_0x28b199[_0x084a('0x78')](),_0x58fe64)[_0x084a('0x1a')](function(_0x2a6331){_0x3f9533=_[_0x084a('0x79')](_0x2a6331,'id');_0x58fe64=_[_0x084a('0x7a')](_0x58fe64,{'model':db[_0x084a('0x23')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2d62bf[_0x084a('0x2c')]['fields']){_0x4865c8[_0x084a('0x2f')]['forEach'](function(_0x4e713c){_0x284cdc[_0x084a('0x36')]('c.'+_0x4e713c);});}else{_0x284cdc[_0x084a('0x36')](_0x084a('0x67'));_0x284cdc['field'](_0x084a('0x7b'));_0x284cdc['field'](_0x084a('0x7c'));_0x284cdc[_0x084a('0x36')](_0x084a('0x7d'));_0x284cdc[_0x084a('0x36')](_0x084a('0x7e'));_0x284cdc[_0x084a('0x36')]('c.fax');_0x284cdc['field'](_0x084a('0x7f'));_0x284cdc[_0x084a('0x36')](_0x084a('0x80'));_0x284cdc[_0x084a('0x36')](_0x084a('0x81'));_0x284cdc[_0x084a('0x36')]('c.deletedAt');_0x284cdc[_0x084a('0x36')](_0x084a('0x82'));_0x284cdc[_0x084a('0x36')](_0x084a('0x83'),_0x084a('0x84'));}if(_0x4865c8[_0x084a('0x15')])_0x284cdc[_0x084a('0x15')](_0x4865c8['limit']);if(_0x4865c8[_0x084a('0x13')])_0x284cdc[_0x084a('0x13')](_0x4865c8[_0x084a('0x13')]);return db[_0x084a('0x77')][_0x084a('0x2c')](_0x284cdc[_0x084a('0x78')](),_0x58fe64);});})[_0x084a('0x1a')](function(_0x26cd70){_0x26cd70[_0x084a('0x55')](function(_0x1ada1d){if(_0x1ada1d['TagIds']){_0x1ada1d['Tags']=[];_0x1ada1d['TagIds'][_0x084a('0x47')](',')[_0x084a('0x55')](function(_0x5a73ed){_0x1ada1d[_0x084a('0x85')][_0x084a('0x86')](_0x3f9533[_0x5a73ed]);});}delete _0x1ada1d[_0x084a('0x84')];});_0x288e9e[_0x084a('0x87')]=_0x26cd70;return _0x288e9e;})['then'](respondWithFilteredResult(_0x1c3f6c,_0x4865c8));})['catch'](handleError(_0x1c3f6c,null));};exports[_0x084a('0x1b')]=function(_0x320f1d,_0x4267bd){return db[_0x084a('0x23')][_0x084a('0x44')]({'where':{'id':_0x320f1d[_0x084a('0x88')]['id']}})[_0x084a('0x1a')](handleEntityNotFound(_0x4267bd,null))['then'](removeEntity(_0x4267bd,null))[_0x084a('0x89')](handleError(_0x4267bd,null));};exports[_0x084a('0x24')]=function(_0x108f64,_0x137bba){return db[_0x084a('0x23')][_0x084a('0x24')]()[_0x084a('0x1a')](function(_0x51e7b2){delete _0x51e7b2[_0x084a('0x8a')];for(var _0x2d3a76=0x0;_0x2d3a760x0){return new Promise(function(_0xafff35,_0x193db9){var _0x557b25=[];for(var _0x194a36=0x0;_0x194a36<_0x370456[_0x084a('0x26')];_0x194a36++){_0x557b25[_0x084a('0x86')](insertAdditionalPhones(_0x370456[_0x194a36][_0x084a('0xbb')],_0x370456[_0x194a36][_0x084a('0xb5')]));}Promise[_0x084a('0xbc')](_0x557b25)[_0x084a('0x1a')](function(){_0xafff35(0x1);});})[_0x084a('0x1a')](function(){return{'success':_0x622764,'failure':_0x3ea85e,'duplicates':_0xf61ef9};});}else{return{'success':_0x622764,'failure':_0x3ea85e,'duplicates':_0xf61ef9};}}})['then'](respondWithResult(_0x4dfd60,0xc9))['catch'](handleError(_0x4dfd60,null));};exports['show']=function(_0x1bcb9d,_0x138f9a){var _0x8ea9c9;return db[_0x084a('0x23')][_0x084a('0x24')]()[_0x084a('0x1a')](function(_0x122dbb){return db[_0x084a('0x23')][_0x084a('0x44')]({'where':{'id':_0x1bcb9d[_0x084a('0x88')]['id']},'include':[{'model':db[_0x084a('0x45')],'as':_0x084a('0x85'),'attributes':['id',_0x084a('0x20'),_0x084a('0x37')],'required':_0x1bcb9d[_0x084a('0x2c')][_0x084a('0x5a')]?!![]:![]},{'model':db[_0x084a('0xa3')],'as':_0x084a('0xbd'),'where':{'CmContactId':_0x1bcb9d[_0x084a('0x88')]['id']},'required':![],'include':[{'model':db[_0x084a('0xbe')],'as':_0x084a('0xbf')}]}],'order':[db['sequelize'][_0x084a('0xc0')](_0x084a('0xc1'))],'attributes':_[_0x084a('0x25')](_0x122dbb)});})['then'](function(_0xf13042){if(!_[_0x084a('0x52')](_0xf13042)){_0x8ea9c9=_0xf13042[_0x084a('0x91')]({'plain':!![]});var _0x3c153a={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0xf13042&&_0xf13042['ListId']){if(_0xf13042[_0x084a('0x56')]){_0x3c153a[_0x084a('0x34')]['$and'][_0x084a('0x86')]({'ListId':{'$ne':_0xf13042['ListId']}});}}return db['CmCustomField'][_0x084a('0xc2')](_0x3c153a);}})[_0x084a('0x1a')](function(_0x270c3e){if(!_[_0x084a('0x52')](_0x270c3e)){return _[_0x084a('0xc3')](_0x8ea9c9,_['map'](_0x270c3e,function(_0x38af4f){return util[_0x084a('0xc4')](_0x084a('0xc5'),_0x38af4f['id']);}));}})[_0x084a('0x1a')](handleEntityNotFound(_0x138f9a,null))[_0x084a('0x1a')](respondWithResult(_0x138f9a,null))[_0x084a('0x89')](handleError(_0x138f9a,null));};exports['update']=function(_0xc77599,_0x5e988c){var _0x2d9ef0;if(_0xc77599[_0x084a('0x90')]['id']){delete _0xc77599[_0x084a('0x90')]['id'];}if(!_[_0x084a('0x52')](_0xc77599['body']['dialTimezone'])){var _0x122225=_0xc77599['body'][_0x084a('0xb2')];if(!_[_0x084a('0x52')](shared[_0x084a('0xb3')][_0x122225]))_0xc77599[_0x084a('0x90')]['utcOffset']=shared['timezones'][_0x122225]['utcOffset'];}return db['CmContact']['find']({'where':{'id':_0xc77599[_0x084a('0x88')]['id']}})[_0x084a('0x1a')](handleEntityNotFound(_0x5e988c,null))[_0x084a('0x1a')](saveUpdates(_0xc77599[_0x084a('0x90')],null))[_0x084a('0x1a')](function(_0x35208f){_0x2d9ef0=_0x35208f;var _0x112427={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x35208f&&_0x35208f[_0x084a('0x56')]){if(_0x35208f[_0x084a('0x56')]){_0x112427['where'][_0x084a('0xc6')][_0x084a('0x86')]({'ListId':{'$ne':_0x35208f['ListId']}});}}return db[_0x084a('0xc7')][_0x084a('0xc2')](_0x112427);})[_0x084a('0x1a')](function(_0x137e7d){if(_0x137e7d){return _[_0x084a('0xc3')](_[_0x084a('0xc8')](_0xc77599['body'],function(_0x27900d,_0x3b26a7){return _[_0x084a('0x27')](_0x3b26a7,_0x084a('0x28'));}),_[_0x084a('0x48')](_0x137e7d,function(_0x4ff780){return util[_0x084a('0xc4')]('cf_%d',_0x4ff780['id']);}));}})[_0x084a('0x1a')](function(_0x2e5ce0){if(_0x2e5ce0&&!_[_0x084a('0x54')](_0x2e5ce0)){var _0x4d0790=squel[_0x084a('0x19')]()[_0x084a('0xc9')](_0x084a('0xca'))[_0x084a('0xcb')](_0x2e5ce0)['where'](_0x084a('0xcc'),_0xc77599[_0x084a('0x88')]['id'])[_0x084a('0xcd')]();return db[_0x084a('0x77')][_0x084a('0x2c')](_0x4d0790[_0x084a('0x50')],{'replacements':_0x4d0790['values']});}})[_0x084a('0x1a')](function(){if(_0xc77599[_0x084a('0x90')][_0x084a('0xce')]&&_0x2d9ef0){return db['CmHopper']['update']({'phone':_0xc77599[_0x084a('0x90')][_0x084a('0xce')],'OrderBy':0x0},{'where':{'ContactId':_0x2d9ef0['id']}});}})[_0x084a('0x1a')](function(){return _0x2d9ef0;})[_0x084a('0x1a')](respondWithResult(_0x5e988c,null))[_0x084a('0x89')](handleError(_0x5e988c,null));};exports[_0x084a('0xcf')]=function(_0x136f6d,_0x132d98){var _0x22e997={};var _0x5c6547={};var _0x15e0ff;var _0x3c7310;return db[_0x084a('0x23')][_0x084a('0xd0')]({'where':{'id':_0x136f6d[_0x084a('0x88')]['id']}})[_0x084a('0x1a')](handleEntityNotFound(_0x132d98,null))[_0x084a('0x1a')](function(_0x5d0874){if(_0x5d0874){_0x15e0ff=_0x5d0874;_0x5c6547['model']=_[_0x084a('0x25')](db['Tag']['rawAttributes']);_0x5c6547[_0x084a('0x2c')]=_[_0x084a('0x25')](_0x136f6d[_0x084a('0x2c')]);_0x5c6547[_0x084a('0x2d')]=_[_0x084a('0x2e')](_0x5c6547[_0x084a('0x2b')],_0x5c6547[_0x084a('0x2c')]);_0x22e997[_0x084a('0x2f')]=_[_0x084a('0x2e')](_0x5c6547['model'],qs[_0x084a('0x30')](_0x136f6d[_0x084a('0x2c')]['fields']));_0x22e997[_0x084a('0x2f')]=_0x22e997[_0x084a('0x2f')]['length']?_0x22e997[_0x084a('0x2f')]:_0x5c6547[_0x084a('0x2b')];_0x22e997['order']=qs[_0x084a('0x33')](_0x136f6d[_0x084a('0x2c')]['sort']);_0x22e997['where']=qs[_0x084a('0x2d')](_['pick'](_0x136f6d['query'],_0x5c6547[_0x084a('0x2d')]));if(_0x136f6d['query'][_0x084a('0x51')]){_0x22e997[_0x084a('0x34')]=_[_0x084a('0x7a')](_0x22e997[_0x084a('0x34')],{'$or':_[_0x084a('0x48')](_0x22e997[_0x084a('0x2f')],function(_0x7f205){var _0x34f685={};_0x34f685[_0x7f205]={'$like':'%'+_0x136f6d['query'][_0x084a('0x51')]+'%'};return _0x34f685;})});}_0x22e997=_[_0x084a('0x7a')]({},_0x22e997,_0x136f6d['options']);return _0x15e0ff['getTags'](_0x22e997);}})[_0x084a('0x1a')](function(_0x584f2a){if(_0x584f2a){_0x3c7310=_0x584f2a[_0x084a('0x26')];if(!_0x136f6d['query'][_0x084a('0x31')](_0x084a('0x32'))){_0x22e997[_0x084a('0x15')]=qs['limit'](_0x136f6d[_0x084a('0x2c')][_0x084a('0x15')]);_0x22e997[_0x084a('0x13')]=qs[_0x084a('0x13')](_0x136f6d['query']['offset']);}return _0x15e0ff[_0x084a('0xcf')](_0x22e997);}})[_0x084a('0x1a')](function(_0x1b2826){if(_0x1b2826){return _0x1b2826?{'count':_0x3c7310,'rows':_0x1b2826}:null;}})[_0x084a('0x1a')](respondWithResult(_0x132d98,null))[_0x084a('0x89')](handleError(_0x132d98,null));};exports[_0x084a('0xd1')]=function(_0x548e23,_0x4c7c9f){if(_0x548e23[_0x084a('0x90')]['id']){delete _0x548e23[_0x084a('0x90')]['id'];}return db[_0x084a('0x23')][_0x084a('0xd0')]({'where':{'id':_0x548e23[_0x084a('0x88')]['id']}})[_0x084a('0x1a')](handleEntityNotFound(_0x4c7c9f,null))[_0x084a('0x1a')](function(_0x3889ce){if(_0x3889ce){return _0x3889ce[_0x084a('0xd1')](_0x548e23[_0x084a('0x90')]['ids']||[]);}return null;})[_0x084a('0x1a')](respondWithResult(_0x4c7c9f,null))[_0x084a('0x89')](handleError(_0x4c7c9f,null));};exports['setAdditionalPhones']=function(_0x343216,_0x3ebd6d){var _0x117fd2=[];_0x117fd2[_0x084a('0x86')](addAdditionalPhones(_0x343216['body']));Promise[_0x084a('0xbc')](_0x117fd2)[_0x084a('0x1a')](function(){_0x117fd2=[];_0x117fd2[_0x084a('0x86')](deleteCmHopperPhones(_0x343216[_0x084a('0x90')]['id']));_0x117fd2['push'](addCmHopperPhones(_0x343216[_0x084a('0x90')]['id']));Promise[_0x084a('0xbc')](_0x117fd2)[_0x084a('0x1a')](function(){return[0x1];})[_0x084a('0x1a')](respondWithResult(_0x3ebd6d,null));});};function addAdditionalPhones(_0x2443a6){var _0x3357b;return new Promise(function(_0xe9c3d2,_0x5d51c5){return db['CmContactHasItem'][_0x084a('0x1b')]({'where':{'CmContactId':_0x2443a6['id']}})[_0x084a('0x1a')](function(){db[_0x084a('0xbe')][_0x084a('0xc2')]({'raw':!![],'attributes':['id',_0x084a('0xd2')]})[_0x084a('0x1a')](function(_0x5249a9){var _0x34fc97=[];for(var _0x364a28=0x0;_0x364a28<_0x2443a6[_0x084a('0xd3')][_0x084a('0x26')];_0x364a28++){var _0x2d5ea1=_0x2443a6['item_types']?_[_0x084a('0x52')](_0x2443a6[_0x084a('0xd4')][_0x364a28])?'':_0x2443a6['item_types'][_0x364a28]:_0x2443a6[_0x084a('0xd3')][_0x364a28]['ItemTypeId']?_0x2443a6[_0x084a('0xd3')][_0x364a28][_0x084a('0xd5')]:'';var _0x365ddc=_[_0x084a('0x52')](_0x2443a6[_0x084a('0xd3')][_0x364a28][_0x084a('0xd6')])?'':_0x2443a6['items'][_0x364a28][_0x084a('0xd6')];var _0x436824=_0x2d5ea1+':'+_0x2443a6[_0x084a('0xd3')][_0x364a28][_0x084a('0xce')]+'§'+_0x365ddc;if(_[_0x084a('0x52')](_0x3357b))_0x3357b=_0x436824;else _0x3357b+=';'+_0x436824;var _0x1f5f01=null;if(_0x2443a6['item_types']){if(!_['isNil'](_0x2443a6[_0x084a('0xd4')][_0x364a28])){var _0x17e071=_[_0x084a('0x44')](_0x5249a9,function(_0xa38c00){return _0xa38c00['id']===_0x2443a6[_0x084a('0xd4')][_0x364a28];});if(!_[_0x084a('0x52')](_0x17e071)){_0x1f5f01=_0x17e071[_0x084a('0xd2')];}}}else{if(!_['isNil'](_0x2443a6['items'][_0x364a28])){var _0x17e071=_[_0x084a('0x44')](_0x5249a9,function(_0x57e593){return _0x57e593['id']===_0x2443a6['items'][_0x364a28][_0x084a('0xd5')];});if(!_[_0x084a('0x52')](_0x17e071)){_0x1f5f01=_0x364a28;}}}if(_[_0x084a('0x52')](_0x1f5f01)){_0x1f5f01=0x64;}_0x34fc97['push'](addAdditionalPhone(_0x2443a6['id'],_0x2443a6['items'][_0x364a28][_0x084a('0xce')],_0x2443a6[_0x084a('0xd4')]?_[_0x084a('0x52')](_0x2443a6[_0x084a('0xd4')][_0x364a28])?null:_0x2443a6[_0x084a('0xd4')][_0x364a28]:_0x2443a6[_0x084a('0xd3')][_0x364a28][_0x084a('0xd5')]?_0x2443a6['items'][_0x364a28][_0x084a('0xd5')]:null,_0x1f5f01,_0x365ddc));}Promise[_0x084a('0xbc')](_0x34fc97)['then'](function(){db[_0x084a('0x23')][_0x084a('0x19')]({'AdditionalPhones':_0x3357b},{'where':{'id':_0x2443a6['id']}})[_0x084a('0x1a')](function(){_0xe9c3d2(0x1);});});});});});}function addAdditionalPhone(_0x5d17ff,_0x49ce9b,_0x3231de,_0x295285,_0x4077fd){return db['CmContactHasItem'][_0x084a('0x44')]({'where':{'CmContactId':_0x5d17ff,'item':_0x49ce9b}})[_0x084a('0x1a')](function(_0x894536){if(_0x894536)logger['info'](_0x084a('0xd7'),_0x894536);else{db[_0x084a('0xa3')][_0x084a('0x99')]({'CmContactId':_0x5d17ff,'item':_0x49ce9b,'ItemTypeId':_0x3231de,'OrderBy':_0x295285,'ItemClass':_0x084a('0xd8'),'description':_0x4077fd});}});}function deletePhones(_0x38ce65){return db[_0x084a('0xa3')]['destroy']({'where':{'CmContactId':_0x38ce65}});}function deleteCmHopperPhones(_0xcdd877){return new Promise(function(_0x1109d3,_0x1ba2e6){return db[_0x084a('0x95')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0xcdd877}})['then'](function(_0x24f858){db[_0x084a('0xd9')]['destroy']({'where':{'CmHopperId':{'$in':_[_0x084a('0x48')](_0x24f858,'id')}}});})[_0x084a('0x1a')](function(){_0x1109d3(0x1);});});}function addCmHopperPhones(_0x3a699a){return new Promise(function(_0x44075c,_0x5d545f){return db[_0x084a('0x95')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x3a699a}})[_0x084a('0x1a')](function(_0x3ca579){var _0x3a972d=[];_[_0x084a('0x48')](_0x3ca579,function(_0x433107){_0x3a972d[_0x084a('0x86')](createCmHopperPhone(_0x3a699a,_0x433107['id']));});Promise[_0x084a('0xbc')](_0x3a972d)['then'](function(){_0x44075c(0x1);});});});}function createCmHopperPhone(_0x40c947,_0x239f3e){return new Promise(function(_0x3b16cc,_0x544b41){db[_0x084a('0xa3')]['findAll']({'raw':!![],'attributes':[_0x084a('0xda'),_0x084a('0xd2')],'where':{'CmContactId':_0x40c947,'ItemClass':_0x084a('0xd8')},'include':[{'model':db[_0x084a('0xbe')],'attributes':[_0x084a('0xd2')],'as':_0x084a('0xbf')}],'order':[_0x084a('0xd2'),db[_0x084a('0x77')]['literal'](_0x084a('0xdb'))]})['then'](function(_0x37a17a){var _0x35c281=0x1;var _0x13a5fd=_[_0x084a('0x48')](_0x37a17a,function(_0x43134e){_0x43134e[_0x084a('0xdc')]=_0x239f3e;_0x43134e['phone']=_0x43134e[_0x084a('0xda')];_0x43134e[_0x084a('0xd2')]=_0x35c281;delete _0x43134e[_0x084a('0xdd')];_0x35c281=_0x35c281+0x1;return _0x43134e;});return db[_0x084a('0xd9')][_0x084a('0xb6')](_0x13a5fd,{});})[_0x084a('0x1a')](function(){_0x3b16cc(0x1);});});}function insertAdditionalPhones(_0x410663,_0x1eb438){return new Promise(function(_0x114fb3,_0x430aea){var _0x2aa8fd=[];for(var _0xd43fb8=0x0;_0xd43fb8<_0x1eb438[_0x084a('0x26')];_0xd43fb8++){var _0xf61bd6=_0x1eb438[_0xd43fb8];_0x2aa8fd[_0x084a('0x86')](parseContactItemType(_0xf61bd6));}Promise[_0x084a('0xbc')](_0x2aa8fd)[_0x084a('0x1a')](function(){var _0x3e2854={'id':_0x410663['id'],'items':_0x1eb438};return addAdditionalPhones(_0x3e2854)[_0x084a('0x1a')](function(_0x4b0cbe){return addCmHopperPhones(_0x410663['id']);});})[_0x084a('0x1a')](function(){_0x114fb3(_0x410663);});});}function parseContactItemType(_0x2f2e01){return new Promise(function(_0x3b0a62,_0x360858){if(_0x2f2e01[_0x084a('0x31')](_0x084a('0xd5'))){_0x3b0a62(_0x2f2e01);}else{return db['ContactItemType'][_0x084a('0x44')]({'where':{'name':_0x2f2e01[_0x084a('0xbf')]}})[_0x084a('0x1a')](function(_0x47eec5){if(_[_0x084a('0x52')](_0x47eec5))_0x2f2e01[_0x084a('0xd5')]=null;else _0x2f2e01['ItemTypeId']=_0x47eec5['id'];_0x3b0a62(_0x2f2e01);});}});}exports[_0x084a('0xde')]=function(_0x1b1183,_0x54413d){return db[_0x084a('0xa3')][_0x084a('0xc2')]({'raw':!![],'where':{'CmContactId':_0x1b1183[_0x084a('0x88')]['id'],'ItemClass':_0x084a('0xd8')},'include':[{'model':db[_0x084a('0xbe')],'as':_0x084a('0xbf')}],'order':[[_0x084a('0xd2')],[db['sequelize']['literal'](_0x084a('0xdb'))]]})['then'](function(_0x83cf0d){return _0x83cf0d;})[_0x084a('0x1a')](respondWithResult(_0x54413d,null))['catch'](handleError(_0x54413d,null));};exports[_0x084a('0xdf')]=function(_0x46c339,_0x26663a){return db['CmContactHasItem'][_0x084a('0xc2')]({'raw':!![],'where':{'CmContactId':_0x46c339[_0x084a('0x90')][_0x084a('0xe0')]}})[_0x084a('0x1a')](function(_0x3357b2){var _0x20aee6=_['map'](_0x3357b2,function(_0x4c2227){_0x4c2227['CmContactId']=_0x46c339['body'][_0x084a('0xe1')];return _0x4c2227;});return db[_0x084a('0xa3')][_0x084a('0xb6')](_0x20aee6,{});})['then'](function(_0x11e222){return addCmHopperPhones(_0x46c339[_0x084a('0x90')][_0x084a('0xe1')]);})[_0x084a('0x1a')](function(_0xf671c9){return['ok'];})[_0x084a('0x1a')](respondWithResult(_0x26663a,null))[_0x084a('0x89')](handleError(_0x26663a,null));};exports[_0x084a('0xe2')]=function(_0xce2e2c,_0x26958f){var _0x2e08c4=[];_0x2e08c4[_0x084a('0x86')](createCmHopperPhone(_0xce2e2c[_0x084a('0x90')]['id'],_0xce2e2c[_0x084a('0x90')][_0x084a('0xe3')]));Promise[_0x084a('0xbc')](_0x2e08c4)[_0x084a('0x1a')](function(){return[0x1];})[_0x084a('0x1a')](respondWithResult(_0x26958f,null));};exports[_0x084a('0xe4')]=function(_0x2b4d6d,_0x2c336d){var _0x272afc={'raw':![],'where':{}};var _0x11134b={};var _0x54000e={'count':0x0,'rows':[]};return db['CmContact'][_0x084a('0xd0')]({'where':{'id':_0x2b4d6d['params']['id']}})[_0x084a('0x1a')](handleEntityNotFound(_0x2c336d,null))[_0x084a('0x1a')](function(_0x4d490f){if(_0x4d490f){_0x11134b[_0x084a('0x2b')]=_[_0x084a('0x25')](db[_0x084a('0x95')][_0x084a('0xe5')]);_0x11134b['query']=_['keys'](_0x2b4d6d[_0x084a('0x2c')]);_0x11134b[_0x084a('0x2d')]=_[_0x084a('0x2e')](_0x11134b['model'],_0x11134b['query']);_0x272afc[_0x084a('0x2f')]=_[_0x084a('0x2e')](_0x11134b[_0x084a('0x2b')],qs['fields'](_0x2b4d6d[_0x084a('0x2c')][_0x084a('0x30')]));_0x272afc['attributes']=_0x272afc[_0x084a('0x2f')][_0x084a('0x26')]?_0x272afc[_0x084a('0x2f')]:_0x11134b[_0x084a('0x2b')];if(!_0x2b4d6d['query'][_0x084a('0x31')](_0x084a('0x32'))){_0x272afc[_0x084a('0x15')]=qs['limit'](_0x2b4d6d['query'][_0x084a('0x15')]);_0x272afc[_0x084a('0x13')]=qs[_0x084a('0x13')](_0x2b4d6d[_0x084a('0x2c')][_0x084a('0x13')]);}_0x272afc['order']=qs['sort'](_0x2b4d6d[_0x084a('0x2c')][_0x084a('0x33')]);_0x272afc[_0x084a('0x34')]=qs[_0x084a('0x2d')](_[_0x084a('0xe6')](_0x2b4d6d[_0x084a('0x2c')],_0x11134b[_0x084a('0x2d')]));_0x272afc[_0x084a('0x34')][_0x084a('0xe7')]=_0x4d490f['id'];if(_0x2b4d6d[_0x084a('0x2c')][_0x084a('0x51')]){_0x272afc[_0x084a('0x34')]=_[_0x084a('0x7a')](_0x272afc[_0x084a('0x34')],{'$or':_['map'](_0x272afc[_0x084a('0x2f')],function(_0x52b753){var _0x283ad9={};_0x283ad9[_0x52b753]={'$like':'%'+_0x2b4d6d[_0x084a('0x2c')]['filter']+'%'};return _0x283ad9;})});}_0x272afc=_[_0x084a('0x7a')]({},_0x272afc,_0x2b4d6d['options']);return db[_0x084a('0x95')][_0x084a('0x16')]({'where':_0x272afc['where']})[_0x084a('0x1a')](function(_0x148baa){_0x54000e['count']=_0x148baa;if(_0x2b4d6d[_0x084a('0x2c')][_0x084a('0xe8')]){_0x272afc[_0x084a('0xe9')]=[{'all':!![]}];}return db[_0x084a('0x95')][_0x084a('0xc2')](_0x272afc);})[_0x084a('0x1a')](function(_0x5f0566){_0x54000e[_0x084a('0x87')]=_0x5f0566;return _0x54000e;});}})[_0x084a('0x1a')](respondWithFilteredResult(_0x2c336d,_0x272afc))['catch'](handleError(_0x2c336d,null));};exports[_0x084a('0xea')]=function(_0x4af3e4,_0x4d17aa){var _0x5202aa={'raw':!![],'where':{}};var _0x4a1c22={};var _0x15a103={'count':0x0,'rows':[]};return db[_0x084a('0x23')]['findOne']({'where':{'id':_0x4af3e4['params']['id']}})[_0x084a('0x1a')](handleEntityNotFound(_0x4d17aa,null))[_0x084a('0x1a')](function(_0x3e7525){if(_0x3e7525){_0x4a1c22[_0x084a('0x2b')]=_[_0x084a('0x25')](db['CmHopperHistory']['rawAttributes']);_0x4a1c22[_0x084a('0x2c')]=_[_0x084a('0x25')](_0x4af3e4[_0x084a('0x2c')]);_0x4a1c22[_0x084a('0x2d')]=_[_0x084a('0x2e')](_0x4a1c22[_0x084a('0x2b')],_0x4a1c22[_0x084a('0x2c')]);_0x5202aa[_0x084a('0x2f')]=_[_0x084a('0x2e')](_0x4a1c22[_0x084a('0x2b')],qs[_0x084a('0x30')](_0x4af3e4['query'][_0x084a('0x30')]));_0x5202aa[_0x084a('0x2f')]=_0x5202aa[_0x084a('0x2f')]['length']?_0x5202aa[_0x084a('0x2f')]:_0x4a1c22[_0x084a('0x2b')];if(!_0x4af3e4['query'][_0x084a('0x31')](_0x084a('0x32'))){_0x5202aa['limit']=qs[_0x084a('0x15')](_0x4af3e4[_0x084a('0x2c')][_0x084a('0x15')]);_0x5202aa[_0x084a('0x13')]=qs['offset'](_0x4af3e4[_0x084a('0x2c')][_0x084a('0x13')]);}_0x5202aa[_0x084a('0x6c')]=qs[_0x084a('0x33')](_0x4af3e4[_0x084a('0x2c')][_0x084a('0x33')]);_0x5202aa['where']=qs[_0x084a('0x2d')](_[_0x084a('0xe6')](_0x4af3e4[_0x084a('0x2c')],_0x4a1c22['filters']));_0x5202aa[_0x084a('0x34')]['ContactId']=_0x3e7525['id'];if(_0x4af3e4[_0x084a('0x2c')][_0x084a('0x51')]){_0x5202aa['where']=_['merge'](_0x5202aa[_0x084a('0x34')],{'$or':_[_0x084a('0x48')](_0x5202aa[_0x084a('0x2f')],function(_0x80d706){var _0x37548a={};_0x37548a[_0x80d706]={'$like':'%'+_0x4af3e4[_0x084a('0x2c')][_0x084a('0x51')]+'%'};return _0x37548a;})});}_0x5202aa=_[_0x084a('0x7a')]({},_0x5202aa,_0x4af3e4[_0x084a('0xeb')]);return db['CmHopperHistory'][_0x084a('0x16')]({'where':_0x5202aa[_0x084a('0x34')]})[_0x084a('0x1a')](function(_0x5281ae){_0x15a103['count']=_0x5281ae;if(_0x4af3e4['query'][_0x084a('0xe8')]){_0x5202aa[_0x084a('0xe9')]=[{'all':!![]}];}return db[_0x084a('0xa5')]['findAll'](_0x5202aa);})['then'](function(_0xe9e67f){_0x15a103[_0x084a('0x87')]=_0xe9e67f;return _0x15a103;});}})[_0x084a('0x1a')](respondWithFilteredResult(_0x4d17aa,_0x5202aa))[_0x084a('0x89')](handleError(_0x4d17aa,null));};exports[_0x084a('0xec')]=function(_0x51ebb5,_0x5c49ec){var _0x2e341a={'raw':!![],'where':{}};var _0x435713={};var _0x3cf053={'count':0x0,'rows':[]};return db[_0x084a('0x23')][_0x084a('0xd0')]({'where':{'id':_0x51ebb5[_0x084a('0x88')]['id']}})['then'](handleEntityNotFound(_0x5c49ec,null))[_0x084a('0x1a')](function(_0x1c861f){if(_0x1c861f){_0x435713[_0x084a('0x2b')]=_[_0x084a('0x25')](db[_0x084a('0xa4')]['rawAttributes']);_0x435713[_0x084a('0x2c')]=_[_0x084a('0x25')](_0x51ebb5[_0x084a('0x2c')]);_0x435713['filters']=_['intersection'](_0x435713[_0x084a('0x2b')],_0x435713[_0x084a('0x2c')]);_0x2e341a[_0x084a('0x2f')]=_[_0x084a('0x2e')](_0x435713['model'],qs[_0x084a('0x30')](_0x51ebb5[_0x084a('0x2c')][_0x084a('0x30')]));_0x2e341a[_0x084a('0x2f')]=_0x2e341a[_0x084a('0x2f')][_0x084a('0x26')]?_0x2e341a[_0x084a('0x2f')]:_0x435713[_0x084a('0x2b')];if(!_0x51ebb5[_0x084a('0x2c')][_0x084a('0x31')]('nolimit')){_0x2e341a[_0x084a('0x15')]=qs[_0x084a('0x15')](_0x51ebb5[_0x084a('0x2c')][_0x084a('0x15')]);_0x2e341a['offset']=qs[_0x084a('0x13')](_0x51ebb5['query']['offset']);}_0x2e341a['order']=qs[_0x084a('0x33')](_0x51ebb5[_0x084a('0x2c')][_0x084a('0x33')]);_0x2e341a['where']=qs[_0x084a('0x2d')](_[_0x084a('0xe6')](_0x51ebb5[_0x084a('0x2c')],_0x435713['filters']));_0x2e341a['where']['ContactId']=_0x1c861f['id'];if(_0x51ebb5[_0x084a('0x2c')][_0x084a('0x51')]){_0x2e341a[_0x084a('0x34')]=_[_0x084a('0x7a')](_0x2e341a[_0x084a('0x34')],{'$or':_['map'](_0x2e341a[_0x084a('0x2f')],function(_0x31f1ee){var _0x4465a1={};_0x4465a1[_0x31f1ee]={'$like':'%'+_0x51ebb5[_0x084a('0x2c')][_0x084a('0x51')]+'%'};return _0x4465a1;})});}_0x2e341a=_[_0x084a('0x7a')]({},_0x2e341a,_0x51ebb5[_0x084a('0xeb')]);return db[_0x084a('0xa4')][_0x084a('0x16')]({'where':_0x2e341a['where']})[_0x084a('0x1a')](function(_0x405121){_0x3cf053[_0x084a('0x16')]=_0x405121;if(_0x51ebb5[_0x084a('0x2c')]['includeAll']){_0x2e341a[_0x084a('0xe9')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x084a('0xc2')](_0x2e341a);})[_0x084a('0x1a')](function(_0x4a23a2){_0x3cf053[_0x084a('0x87')]=_0x4a23a2;return _0x3cf053;});}})[_0x084a('0x1a')](respondWithFilteredResult(_0x5c49ec,_0x2e341a))[_0x084a('0x89')](handleError(_0x5c49ec,null));};exports[_0x084a('0xed')]=function(_0x5c4d95,_0x32692f){var _0x4c5342={'raw':!![],'where':{}};var _0x58e9ea={};var _0x299442={'count':0x0,'rows':[]};return db[_0x084a('0x23')]['findOne']({'where':{'id':_0x5c4d95['params']['id']}})[_0x084a('0x1a')](handleEntityNotFound(_0x32692f,null))['then'](function(_0x1da435){if(_0x1da435){_0x58e9ea[_0x084a('0x2b')]=_[_0x084a('0x25')](db[_0x084a('0xad')][_0x084a('0xe5')]);_0x58e9ea[_0x084a('0x2c')]=_['keys'](_0x5c4d95[_0x084a('0x2c')]);_0x58e9ea[_0x084a('0x2d')]=_['intersection'](_0x58e9ea[_0x084a('0x2b')],_0x58e9ea[_0x084a('0x2c')]);_0x4c5342[_0x084a('0x2f')]=_[_0x084a('0x2e')](_0x58e9ea['model'],qs[_0x084a('0x30')](_0x5c4d95[_0x084a('0x2c')][_0x084a('0x30')]));_0x4c5342[_0x084a('0x2f')]=_0x4c5342['attributes'][_0x084a('0x26')]?_0x4c5342[_0x084a('0x2f')]:_0x58e9ea[_0x084a('0x2b')];if(!_0x5c4d95['query'][_0x084a('0x31')](_0x084a('0x32'))){_0x4c5342[_0x084a('0x15')]=qs[_0x084a('0x15')](_0x5c4d95[_0x084a('0x2c')][_0x084a('0x15')]);_0x4c5342[_0x084a('0x13')]=qs[_0x084a('0x13')](_0x5c4d95[_0x084a('0x2c')][_0x084a('0x13')]);}_0x4c5342['order']=qs[_0x084a('0x33')](_0x5c4d95[_0x084a('0x2c')][_0x084a('0x33')]);_0x4c5342[_0x084a('0x34')]=qs[_0x084a('0x2d')](_[_0x084a('0xe6')](_0x5c4d95[_0x084a('0x2c')],_0x58e9ea[_0x084a('0x2d')]));_0x4c5342[_0x084a('0x34')][_0x084a('0xe7')]=_0x1da435['id'];if(_0x5c4d95[_0x084a('0x2c')]['filter']){_0x4c5342[_0x084a('0x34')]=_[_0x084a('0x7a')](_0x4c5342[_0x084a('0x34')],{'$or':_[_0x084a('0x48')](_0x4c5342['attributes'],function(_0xdba6e4){var _0x1c2851={};_0x1c2851[_0xdba6e4]={'$like':'%'+_0x5c4d95[_0x084a('0x2c')][_0x084a('0x51')]+'%'};return _0x1c2851;})});}_0x4c5342=_[_0x084a('0x7a')]({},_0x4c5342,_0x5c4d95[_0x084a('0xeb')]);return db[_0x084a('0xad')]['count']({'where':_0x4c5342['where']})['then'](function(_0x413428){_0x299442['count']=_0x413428;if(_0x5c4d95[_0x084a('0x2c')][_0x084a('0xe8')]){_0x4c5342[_0x084a('0xe9')]=[{'all':!![]}];}return db[_0x084a('0xad')][_0x084a('0xc2')](_0x4c5342);})[_0x084a('0x1a')](function(_0x216838){_0x299442['rows']=_0x216838;return _0x299442;});}})['then'](respondWithFilteredResult(_0x32692f,_0x4c5342))[_0x084a('0x89')](handleError(_0x32692f,null));};exports['uploadCsv']=function(_0x2d31bf,_0x2849cb){try{if(!_0x2d31bf[_0x084a('0x90')][_0x084a('0x56')]){throw new Error('No\x20ListId\x20specified');}if(!_0x2d31bf[_0x084a('0x90')][_0x084a('0xee')]){throw new Error('No\x20association\x20keys\x20specified!');}if(!_0x2d31bf[_0x084a('0x90')][_0x084a('0xef')]){throw new Error(_0x084a('0xf0'));}if(!_0x2d31bf[_0x084a('0x90')]['socket_timestamp']){throw new Error(_0x084a('0xf1'));}var _0x3a7653=_0x2d31bf['body'][_0x084a('0xee')]['split'](',');var _0x2e7df6=_0x2d31bf['body'][_0x084a('0xef')][_0x084a('0x47')](',');if(!_0x3a7653[_0x084a('0x26')]||!_0x2e7df6[_0x084a('0x26')]||_0x3a7653[_0x084a('0x26')]!==_0x2e7df6[_0x084a('0x26')]){throw new Error(_0x084a('0xf2'));}_0x2d31bf[_0x084a('0x90')][_0x084a('0x30')]=_[_0x084a('0xf3')](_0x3a7653,_0x2e7df6);if(!_0x2d31bf[_0x084a('0x90')][_0x084a('0x30')][_0x084a('0xce')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x2d31bf['body'][_0x084a('0x30')][_0x084a('0xf4')]){throw new Error(_0x084a('0xf5'));}var _0x561c79=path[_0x084a('0xb1')](config[_0x084a('0xf6')],'server/files/tmp',_0x2d31bf[_0x084a('0xf7')]['filename']);fs[_0x084a('0xf8')](_0x561c79,parseInt(_0x084a('0xf9'),0x8));var _0x80618=require(_0x084a('0xfa'))[_0x084a('0xfb')](path['join'](__dirname,'../../components/import/cm/csv'),[_0x561c79,_0x2d31bf[_0x084a('0x90')][_0x084a('0xee')],_0x2d31bf[_0x084a('0x90')]['binding_values'],_0x2d31bf['body'][_0x084a('0x56')],_0x2d31bf[_0x084a('0x90')][_0x084a('0xfc')],_0x2d31bf['body'][_0x084a('0xb8')],_0x2d31bf[_0x084a('0x90')][_0x084a('0xfd')]]);return _0x2849cb[_0x084a('0x11')](0xc8)[_0x084a('0x12')]({'message':_0x084a('0xfe'),'pid':_0x80618[_0x084a('0xff')]});}catch(_0x2c1247){return _0x2849cb[_0x084a('0x11')](0x1f4)['send'](_0x2c1247);}};exports[_0x084a('0x100')]=function(_0x4824f4,_0x3d8968){var _0x467fc9=fs[_0x084a('0x101')](_0x4824f4['file']['path']);Papa[_0x084a('0x102')](_0x467fc9,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x10eab7){return _0x3d8968['status'](0xc8)['json']({'file':_0x4824f4[_0x084a('0xf7')],'fields':_0x10eab7[_0x084a('0x103')][_0x084a('0x30')]});}});};exports[_0x084a('0x104')]=function(_0x1218b2,_0x32a001){return db['User'][_0x084a('0xc2')]({'raw':!![],'attributes':['id'],'where':{'role':_0x084a('0x72')}})['then'](function(_0x19bb03){var _0x4db547=![];if(!_0x1218b2[_0x084a('0x90')]['ListId']){throw new Error(_0x084a('0x105'));}if(!_0x1218b2['body'][_0x084a('0x106')][_0x084a('0xce')]){throw new Error(_0x084a('0x107'));}if(!_0x1218b2[_0x084a('0x90')]['binding']['firstName']){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x1218b2[_0x084a('0x90')]['socket_timestamp']){throw new Error(_0x084a('0xf1'));}var _0x3771fe=require(_0x084a('0xfa'))[_0x084a('0xfb')](path['join'](__dirname,_0x084a('0x108')),[_0x1218b2['params']['id'],JSON[_0x084a('0x109')](_0x1218b2[_0x084a('0x90')]),JSON[_0x084a('0x109')](_0x19bb03)]);_0x3771fe['on'](_0x084a('0x10a'),function(){_0x4db547=!![];return _0x32a001[_0x084a('0x11')](0xc8)[_0x084a('0x12')]({'message':_0x084a('0x10b'),'pid':_0x3771fe[_0x084a('0xff')]});});_0x3771fe['on'](_0x084a('0x10c'),function(_0x507662){if(_0x507662&&!_0x4db547){return _0x32a001[_0x084a('0x11')](0x1f4)[_0x084a('0x12')]({'message':_0x084a('0x10d'),'pid':_0x3771fe[_0x084a('0xff')]});}});})['catch'](handleError(_0x32a001,null));};exports[_0x084a('0x10e')]=function(_0x3505f4,_0x27bd17,_0x55d234){return db[_0x084a('0x4b')][_0x084a('0xc2')]({'raw':!![],'attributes':['id'],'where':{'role':_0x084a('0x72')}})['then'](function(_0x2daa21){var _0x3e6bd1=![];if(!_0x3505f4[_0x084a('0x90')][_0x084a('0x56')]){throw new Error('No\x20ListId\x20specified');}if(!_0x3505f4[_0x084a('0x90')][_0x084a('0x106')][_0x084a('0xce')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x3505f4['body']['binding'][_0x084a('0xf4')]){throw new Error(_0x084a('0xf5'));}if(!_0x3505f4[_0x084a('0x90')][_0x084a('0xfd')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x4ec18f=require(_0x084a('0xfa'))['fork'](path[_0x084a('0xb1')](__dirname,'../../components/import/cm/csvUpdates'),[_0x3505f4['params']['id'],JSON['stringify'](_0x3505f4[_0x084a('0x90')]),JSON[_0x084a('0x109')](_0x2daa21)]);_0x4ec18f['on'](_0x084a('0x10a'),function(_0x4e7341){_0x3e6bd1=!![];return _0x27bd17[_0x084a('0x11')](0xc8)[_0x084a('0x12')]({'message':_0x084a('0x10b'),'pid':_0x4ec18f[_0x084a('0xff')]});});_0x4ec18f['on'](_0x084a('0x10c'),function(_0x575e73){if(_0x575e73&&!_0x3e6bd1){return _0x27bd17['status'](0x1f4)[_0x084a('0x12')]({'message':_0x084a('0x10d'),'pid':_0x4ec18f[_0x084a('0xff')]});}});})['catch'](handleError(_0x27bd17,null));};exports[_0x084a('0x10f')]=function(_0x427e25,_0x116a52){var _0x16d22b=[_0x084a('0x110'),_0x084a('0x111'),_0x084a('0x112'),'openchannel',_0x084a('0x113'),_0x084a('0x114'),_0x084a('0x115')];var _0x5918ca={'offset':0x0,'order':qs[_0x084a('0x33')](_0x084a('0x116'))},_0x148cba={'count':0x0,'rows':[]};Promise['resolve']()['then'](function(){if(_0x427e25['query']['channel']){if(!_[_0x084a('0x117')](_0x16d22b,_0x427e25[_0x084a('0x2c')]['channel'][_0x084a('0x118')]())){throw new Error(_0x084a('0x119'));}_0x16d22b=[_0x427e25[_0x084a('0x2c')][_0x084a('0x11a')]['toLowerCase']()];}if(_0x427e25['query']['range']){try{var _0x26472b=JSON['parse'](_0x427e25[_0x084a('0x2c')][_0x084a('0x11b')]);if(!moment(_0x26472b[_0x084a('0x38')])[_0x084a('0x11c')]()){throw new Error(_0x084a('0x11d'));}if(!moment(_0x26472b['to'])[_0x084a('0x11c')]()){throw new Error(_0x084a('0x11e'));}}catch(_0x5a4607){throw new Error(_0x084a('0x11f'));}}if(!_0x427e25[_0x084a('0x2c')][_0x084a('0x31')](_0x084a('0x32'))){_0x5918ca[_0x084a('0x15')]=qs[_0x084a('0x15')](_0x427e25[_0x084a('0x2c')][_0x084a('0x15')]||0xa);_0x5918ca[_0x084a('0x13')]=qs[_0x084a('0x13')](_0x427e25[_0x084a('0x2c')]['offset']);}var _0x295c78=_0x16d22b[_0x084a('0x48')](function(_0x266b73){if(_0x266b73===_0x084a('0x115')){var _0x39bbd3={'attributes':['id',_0x084a('0x120'),_0x084a('0x2a'),'source',_0x084a('0x121'),_0x084a('0x122'),_0x084a('0x123'),_0x084a('0x124'),_0x084a('0x125'),'note',_0x084a('0x126'),_0x084a('0x127'),_0x084a('0x128'),_0x084a('0x129'),'UserId'],'where':{'ContactId':_0x427e25[_0x084a('0x88')]['id']},'include':[{'model':db[_0x084a('0x4b')],'as':'User','attributes':['id',_0x084a('0x20'),_0x084a('0x12a'),_0x084a('0x8d')]}],'order':[['createdAt','DESC']]};if(_0x427e25[_0x084a('0x2c')][_0x084a('0x11b')]){_0x39bbd3[_0x084a('0x34')]['createdAt']={'$gte':_0x26472b[_0x084a('0x38')],'$lte':_0x26472b['to']};}return db[_0x084a('0xa7')][_0x084a('0x12b')](_0x39bbd3)[_0x084a('0x1a')](function(_0xf45575){_0x148cba[_0x084a('0x16')]+=_0xf45575['count'];return _[_0x084a('0x48')](_0xf45575[_0x084a('0x87')],function(_0x2e9ca3){var _0x233dd8=_0x2e9ca3[_0x084a('0x91')]({'plain':!![]});_0x233dd8[_0x084a('0x11a')]=_0x266b73;if(_0x233dd8[_0x084a('0x4b')]){_0x233dd8['User']={'id':_0x233dd8['User']['id'],'name':_0x233dd8[_0x084a('0x4b')]['name'],'fullname':_0x233dd8['User'][_0x084a('0x12a')],'alias':_0x233dd8[_0x084a('0x4b')][_0x084a('0x8d')]};}return _0x233dd8;});});}else{var _0x41647f=_[_0x084a('0x12c')](_0x266b73)+(_0x266b73===_0x084a('0x111')?_0x084a('0x12d'):_0x084a('0x12e'));var _0x1a6808={'attributes':['id',_0x084a('0x12f'),'closedAt',_0x084a('0x126'),_0x084a('0x130'),_0x084a('0x131'),'secondDisposition',_0x084a('0x132'),_0x084a('0x133'),_0x41647f+'Id'],'where':{'ContactId':_0x427e25['params']['id']},'include':[{'model':db[_0x41647f],'as':_0x084a('0x12e'),'attributes':['id',_0x084a('0x20'),_0x084a('0x134')]},{'model':db[_0x084a('0x4b')],'as':_0x084a('0x135'),'attributes':['id',_0x084a('0x20'),_0x084a('0x12a')]},{'model':db[_0x084a('0x45')],'as':_0x084a('0x85'),'attributes':['id',_0x084a('0x20'),'color'],'through':{'attributes':[]}}],'order':[[_0x084a('0x126'),_0x084a('0x6d')]]};if(_0x427e25['query'][_0x084a('0x11b')]){_0x1a6808[_0x084a('0x34')][_0x084a('0x126')]={'$gte':_0x26472b[_0x084a('0x38')],'$lte':_0x26472b['to']};}switch(_0x266b73){case _0x084a('0x111'):_0x1a6808[_0x084a('0x2f')][_0x084a('0x86')](_0x084a('0x136'),_0x084a('0x137'),'customerPort',_0x084a('0x138'),_0x084a('0x139'),'ratingMessage',_0x084a('0x13a'),_0x084a('0x13b'),_0x084a('0x13c'));break;case _0x084a('0x110'):_0x1a6808[_0x084a('0x2f')][_0x084a('0x86')]('subject',_0x084a('0x13d'));break;case'openchannel':_0x1a6808[_0x084a('0x2f')][_0x084a('0x86')](_0x084a('0x13e'),_0x084a('0x13f'));break;}return db[_['startCase'](_0x266b73)+_0x084a('0x140')][_0x084a('0x12b')](_0x1a6808)['then'](function(_0x3f21b0){_0x148cba[_0x084a('0x16')]+=_0x3f21b0[_0x084a('0x16')];return _[_0x084a('0x48')](_0x3f21b0[_0x084a('0x87')],function(_0x492921){var _0xa8ad07=_0x492921[_0x084a('0x91')]({'plain':!![]});_0xa8ad07['channel']=_0x266b73;if(_0xa8ad07[_0x084a('0x135')]){_0xa8ad07[_0x084a('0x135')]={'id':_0xa8ad07[_0x084a('0x135')]['id'],'name':_0xa8ad07[_0x084a('0x135')][_0x084a('0x20')],'fullname':_0xa8ad07[_0x084a('0x135')][_0x084a('0x12a')]};}return _0xa8ad07;});});}});return Promise[_0x084a('0xbc')](_0x295c78);})[_0x084a('0x1a')](function(_0xbc292b){return _(_0xbc292b)[_0x084a('0x141')]()[_0x084a('0x142')](_0x084a('0x126'))[_0x084a('0x143')]()[_0x084a('0x46')]();})[_0x084a('0x1a')](function(_0x4dca95){_0x148cba[_0x084a('0x87')]=_0x5918ca[_0x084a('0x15')]?_0x4dca95[_0x084a('0x144')](_0x5918ca[_0x084a('0x13')],_0x5918ca[_0x084a('0x13')]+_0x5918ca['limit']):_0x4dca95;return _0x148cba;})[_0x084a('0x1a')](respondWithFilteredResult(_0x116a52,_0x5918ca))['catch'](handleError(_0x116a52,null));}; \ No newline at end of file +var _0xa9e0=['source','destination','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','alias','DESC','findAndCountAll','startCase','Website','Account','closedAt','disposition','secondDisposition','thirdDisposition','Owner','browserName','customerIp','osName','ratingType','subject','substatus','externalUrl','threadId','Interaction','flatten','reverse','value','slice','moment','bluebird','util','squel','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment/shared','../../mysqldb','redis','localhost','./cmContact.socket','register','status','offset','undefined','limit','count','Content-Range','then','destroy','end','sendStatus','stack','name','describe','getOptions','findAll','query','user','catch','CmContact','find','params','tags','keys','startsWith','cf_','displayName','analytics','CmCustomField','length','columnName','custom','type','values','forEach','hasOwnProperty','body','from','get','isArray','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','update','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','ReportAgentPreview','VoiceCallReport','ChatQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','dialTimezone','isNil','timezones','utcOffset','additionalPhones','bulkCreate','duplicates','where','$or','push','ListId','findOrCreate','spread','all','show','Tag','color','tag','Phones','ContactItemType','ItemType','literal','Phones.OrderBy','$and','map','format','omit','cf_%d','isEmpty','cm_contacts','id\x20=\x20?','toParam','text','phone','getTags','model','rawAttributes','filters','intersection','attributes','fields','order','sort','pick','filter','merge','nolimit','setTags','findOne','ids','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','CmHopperAdditionalPhone','item','sequelize','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','getAdditionalPhones','PHONE','duplicateAdditionalPhones','CmContactId','toContactId','rescheduleAdditionalPhones','ContactId','options','includeAll','include','getHopperHistories','CmHopperHistory','rows','getJscriptySessions','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','file','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','json','File\x20uploaded\x20correctly!','pid','send','path','meta','import','agent','binding','stringify','message','start\x20child\x20process\x20correctly!','error\x20child\x20process','importUpdates','User','../../components/import/cm/csvUpdates','exit','getJourney','mail','chat','sms','openchannel','fax','whatsapp','voice','-createdAt','resolve','channel','includes','toLowerCase','Invalid\x20channel','range','parse','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'use strict';var moment=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var path=require('path');var fs=require('fs');var _=require('lodash');var squel=require(_0x0a9e('0x3'));var Papa=require('papaparse');var Redis=require(_0x0a9e('0x4'));var contacts=require(_0x0a9e('0x5'));var qs=require(_0x0a9e('0x6'));var logger=require(_0x0a9e('0x7'))(_0x0a9e('0x8'));var config=require('../../config/environment');var shared=require(_0x0a9e('0x9'));var db=require(_0x0a9e('0xa'))['db'];config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithResult(_0x307b3e,_0x3ab53f){_0x3ab53f=_0x3ab53f||0xc8;return function(_0xfeb75b){if(_0xfeb75b){return _0x307b3e[_0x0a9e('0xf')](_0x3ab53f)['json'](_0xfeb75b);}};}function respondWithFilteredResult(_0x50dfb2,_0x527cdd){return function(_0x4cfe67){if(_0x4cfe67){var _0x273d4d=typeof _0x527cdd[_0x0a9e('0x10')]===_0x0a9e('0x11')&&typeof _0x527cdd[_0x0a9e('0x12')]===_0x0a9e('0x11');var _0x69aeb7=_0x4cfe67['count'];var _0x4283ce=_0x273d4d?0x0:_0x527cdd[_0x0a9e('0x10')];var _0x2b4227=_0x273d4d?_0x4cfe67[_0x0a9e('0x13')]:_0x527cdd[_0x0a9e('0x10')]+_0x527cdd[_0x0a9e('0x12')];var _0x52a03d;if(_0x2b4227>=_0x69aeb7){_0x2b4227=_0x69aeb7;_0x52a03d=0xc8;}else{_0x52a03d=0xce;}_0x50dfb2[_0x0a9e('0xf')](_0x52a03d);return _0x50dfb2['set'](_0x0a9e('0x14'),_0x4283ce+'-'+_0x2b4227+'/'+_0x69aeb7)['json'](_0x4cfe67);}return null;};}function saveUpdates(_0x16033c){return function(_0x12066b){if(_0x12066b){return _0x12066b['update'](_0x16033c)[_0x0a9e('0x15')](function(_0x5a0a06){return _0x5a0a06;});}return null;};}function removeEntity(_0x459eb1){return function(_0x478723){if(_0x478723){return _0x478723[_0x0a9e('0x16')]()[_0x0a9e('0x15')](function(){_0x459eb1[_0x0a9e('0xf')](0xcc)[_0x0a9e('0x17')]();});}};}function handleEntityNotFound(_0x530eb7){return function(_0x20559e){if(!_0x20559e){_0x530eb7[_0x0a9e('0x18')](0x194);}return _0x20559e;};}function handleError(_0x112016,_0x1c696a){_0x1c696a=_0x1c696a||0x1f4;return function(_0x105080){logger['error'](_0x105080[_0x0a9e('0x19')]);if(_0x105080[_0x0a9e('0x1a')]){delete _0x105080['name'];}_0x112016[_0x0a9e('0xf')](_0x1c696a)['send'](_0x105080);};}exports['index']=function(_0x3a02e1,_0x432e56){var _0x38e7c4={};return contacts[_0x0a9e('0x1b')]()['then'](function(_0xfb6e48){_0x38e7c4=qs[_0x0a9e('0x1c')](_0xfb6e48,_0x3a02e1);return contacts[_0x0a9e('0x1d')](_0x3a02e1[_0x0a9e('0x1e')],_0x3a02e1[_0x0a9e('0x1f')],_0x38e7c4,_0xfb6e48);})[_0x0a9e('0x15')](respondWithFilteredResult(_0x432e56,_0x38e7c4))[_0x0a9e('0x20')](handleError(_0x432e56,null));};exports['destroy']=function(_0x59181e,_0x197ec0){return db[_0x0a9e('0x21')][_0x0a9e('0x22')]({'where':{'id':_0x59181e[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x197ec0,null))[_0x0a9e('0x15')](removeEntity(_0x197ec0,null))['catch'](handleError(_0x197ec0,null));};exports[_0x0a9e('0x1b')]=function(_0x5bfb33,_0x1dc186){return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x140511){delete _0x140511[_0x0a9e('0x24')];for(var _0x11c3b6=0x0;_0x11c3b60x0){return new Promise(function(_0x56e31e){var _0x3ef315=[];for(var _0x427946=0x0;_0x427946<_0x401837[_0x0a9e('0x2b')];_0x427946++){_0x3ef315['push'](insertAdditionalPhones(_0x401837[_0x427946]['contact'],_0x401837[_0x427946]['additionalPhones']));}Promise[_0x0a9e('0x62')](_0x3ef315)[_0x0a9e('0x15')](function(){_0x56e31e(0x1);});})[_0x0a9e('0x15')](function(){return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};});}else{return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};}}})[_0x0a9e('0x15')](respondWithResult(_0x797b45,0xc9))[_0x0a9e('0x20')](handleError(_0x797b45,null));};exports[_0x0a9e('0x63')]=function(_0xeef20,_0x1a0677){var _0x5512d1;return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x4a4fc7){return db[_0x0a9e('0x21')]['find']({'where':{'id':_0xeef20[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x0a9e('0x64')],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'required':_0xeef20[_0x0a9e('0x1e')][_0x0a9e('0x66')]?!![]:![]},{'model':db['CmContactHasItem'],'as':_0x0a9e('0x67'),'where':{'CmContactId':_0xeef20[_0x0a9e('0x23')]['id']},'required':![],'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}]}],'order':[db['sequelize'][_0x0a9e('0x6a')](_0x0a9e('0x6b'))],'attributes':_[_0x0a9e('0x25')](_0x4a4fc7)});})[_0x0a9e('0x15')](function(_0x4abc8f){if(!_[_0x0a9e('0x56')](_0x4abc8f)){_0x5512d1=_0x4abc8f[_0x0a9e('0x34')]({'plain':!![]});var _0x30a4c7={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x4abc8f&&_0x4abc8f[_0x0a9e('0x5f')]){if(_0x4abc8f[_0x0a9e('0x5f')]){_0x30a4c7[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0x4abc8f[_0x0a9e('0x5f')]}});}}return db[_0x0a9e('0x2a')][_0x0a9e('0x1d')](_0x30a4c7);}})[_0x0a9e('0x15')](function(_0x25744a){if(!_[_0x0a9e('0x56')](_0x25744a)){return _['omit'](_0x5512d1,_[_0x0a9e('0x6d')](_0x25744a,function(_0x11da9c){return util[_0x0a9e('0x6e')]('cf_%d',_0x11da9c['id']);}));}})[_0x0a9e('0x15')](handleEntityNotFound(_0x1a0677,null))[_0x0a9e('0x15')](respondWithResult(_0x1a0677,null))[_0x0a9e('0x20')](handleError(_0x1a0677,null));};exports[_0x0a9e('0x3f')]=function(_0x56d650,_0x541e80){var _0x7ebea8;if(_0x56d650[_0x0a9e('0x32')]['id']){delete _0x56d650['body']['id'];}if(!_[_0x0a9e('0x56')](_0x56d650['body'][_0x0a9e('0x55')])){var _0x8ebf02=_0x56d650['body'][_0x0a9e('0x55')];if(!_[_0x0a9e('0x56')](shared[_0x0a9e('0x57')][_0x8ebf02]))_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x58')]=shared[_0x0a9e('0x57')][_0x8ebf02][_0x0a9e('0x58')];}return db['CmContact'][_0x0a9e('0x22')]({'where':{'id':_0x56d650[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x541e80,null))[_0x0a9e('0x15')](saveUpdates(_0x56d650['body'],null))[_0x0a9e('0x15')](function(_0xf0db1){_0x7ebea8=_0xf0db1;var _0x4bf3a5={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0xf0db1&&_0xf0db1[_0x0a9e('0x5f')]){if(_0xf0db1['ListId']){_0x4bf3a5[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0xf0db1[_0x0a9e('0x5f')]}});}}return db['CmCustomField']['findAll'](_0x4bf3a5);})[_0x0a9e('0x15')](function(_0x2b9c01){if(_0x2b9c01){return _[_0x0a9e('0x6f')](_['pickBy'](_0x56d650[_0x0a9e('0x32')],function(_0x36e975,_0x524e38){return _['startsWith'](_0x524e38,_0x0a9e('0x27'));}),_['map'](_0x2b9c01,function(_0x5ea541){return util['format'](_0x0a9e('0x70'),_0x5ea541['id']);}));}})[_0x0a9e('0x15')](function(_0x9044fe){if(_0x9044fe&&!_[_0x0a9e('0x71')](_0x9044fe)){var _0x3c6dd6=squel[_0x0a9e('0x3f')]()['table'](_0x0a9e('0x72'))['setFields'](_0x9044fe)[_0x0a9e('0x5c')](_0x0a9e('0x73'),_0x56d650[_0x0a9e('0x23')]['id'])[_0x0a9e('0x74')]();return db['sequelize'][_0x0a9e('0x1e')](_0x3c6dd6[_0x0a9e('0x75')],{'replacements':_0x3c6dd6[_0x0a9e('0x2f')]});}})['then'](function(){if(_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')]&&_0x7ebea8){return db[_0x0a9e('0x39')][_0x0a9e('0x3f')]({'phone':_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')],'OrderBy':0x0},{'where':{'ContactId':_0x7ebea8['id']}});}})[_0x0a9e('0x15')](function(){return _0x7ebea8;})[_0x0a9e('0x15')](respondWithResult(_0x541e80,null))['catch'](handleError(_0x541e80,null));};exports[_0x0a9e('0x77')]=function(_0x3325c5,_0x589ff3){var _0x40e0f0={};var _0x982340={};var _0x3a1974;var _0x5a26c8;return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x3325c5[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x589ff3,null))[_0x0a9e('0x15')](function(_0x1f29bd){if(_0x1f29bd){_0x3a1974=_0x1f29bd;_0x982340[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x64')][_0x0a9e('0x79')]);_0x982340['query']=_[_0x0a9e('0x25')](_0x3325c5[_0x0a9e('0x1e')]);_0x982340[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],_0x982340[_0x0a9e('0x1e')]);_0x40e0f0[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x40e0f0[_0x0a9e('0x7c')]=_0x40e0f0['attributes'][_0x0a9e('0x2b')]?_0x40e0f0[_0x0a9e('0x7c')]:_0x982340[_0x0a9e('0x78')];_0x40e0f0[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x3325c5['query'][_0x0a9e('0x7f')]);_0x40e0f0[_0x0a9e('0x5c')]=qs['filters'](_[_0x0a9e('0x80')](_0x3325c5['query'],_0x982340[_0x0a9e('0x7a')]));if(_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x40e0f0[_0x0a9e('0x5c')]=_['merge'](_0x40e0f0[_0x0a9e('0x5c')],{'$or':_['map'](_0x40e0f0[_0x0a9e('0x7c')],function(_0x3d0a77){var _0x5e5b89={};_0x5e5b89[_0x3d0a77]={'$like':'%'+_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x5e5b89;})});}_0x40e0f0=_[_0x0a9e('0x82')]({},_0x40e0f0,_0x3325c5['options']);return _0x3a1974['getTags'](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x6ba2be){if(_0x6ba2be){_0x5a26c8=_0x6ba2be[_0x0a9e('0x2b')];if(!_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x40e0f0[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3325c5[_0x0a9e('0x1e')]['limit']);_0x40e0f0[_0x0a9e('0x10')]=qs['offset'](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}return _0x3a1974[_0x0a9e('0x77')](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x1b61d5){if(_0x1b61d5){return _0x1b61d5?{'count':_0x5a26c8,'rows':_0x1b61d5}:null;}})['then'](respondWithResult(_0x589ff3,null))[_0x0a9e('0x20')](handleError(_0x589ff3,null));};exports[_0x0a9e('0x84')]=function(_0x2791c5,_0x2aa5f2){if(_0x2791c5[_0x0a9e('0x32')]['id']){delete _0x2791c5['body']['id'];}return db['CmContact'][_0x0a9e('0x85')]({'where':{'id':_0x2791c5['params']['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x2aa5f2,null))[_0x0a9e('0x15')](function(_0x4672e1){if(_0x4672e1){return _0x4672e1[_0x0a9e('0x84')](_0x2791c5[_0x0a9e('0x32')][_0x0a9e('0x86')]||[]);}return null;})['then'](respondWithResult(_0x2aa5f2,null))['catch'](handleError(_0x2aa5f2,null));};exports[_0x0a9e('0x87')]=function(_0x5dfbe2,_0x2469d1){var _0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](addAdditionalPhones(_0x5dfbe2['body']));Promise['all'](_0x5c689c)[_0x0a9e('0x15')](function(){_0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](deleteCmHopperPhones(_0x5dfbe2['body']['id']));_0x5c689c[_0x0a9e('0x5e')](addCmHopperPhones(_0x5dfbe2[_0x0a9e('0x32')]['id']));Promise[_0x0a9e('0x62')](_0x5c689c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x2469d1,null));});};function addAdditionalPhones(_0x5ab0bc){var _0x5505f4;return new Promise(function(_0x16449b){return db[_0x0a9e('0x4a')][_0x0a9e('0x16')]({'where':{'CmContactId':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){db[_0x0a9e('0x68')]['findAll']({'raw':!![],'attributes':['id',_0x0a9e('0x88')]})[_0x0a9e('0x15')](function(_0x5416a9){var _0x3c313d=[];for(var _0x19fd11=0x0;_0x19fd11<_0x5ab0bc[_0x0a9e('0x89')][_0x0a9e('0x2b')];_0x19fd11++){var _0x23b25b=_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?'':_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['ItemTypeId']?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:'';var _0x2ada60=_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['description'])?'':_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8c')];var _0x16ae1a=_0x23b25b+':'+_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')]+'§'+_0x2ada60;if(_[_0x0a9e('0x56')](_0x5505f4))_0x5505f4=_0x16ae1a;else _0x5505f4+=';'+_0x16ae1a;var _0x59e46f=null;var _0x1339d0=null;if(_0x5ab0bc[_0x0a9e('0x8a')]){if(!_[_0x0a9e('0x56')](_0x5ab0bc['item_types'][_0x19fd11])){_0x1339d0=_[_0x0a9e('0x22')](_0x5416a9,function(_0x59aa7b){return _0x59aa7b['id']===_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11];});if(!_['isNil'](_0x1339d0)){_0x59e46f=_0x1339d0[_0x0a9e('0x88')];}}}else{if(!_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11])){_0x1339d0=_['find'](_0x5416a9,function(_0xc9529d){return _0xc9529d['id']===_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8b')];});if(!_[_0x0a9e('0x56')](_0x1339d0)){_0x59e46f=_0x19fd11;}}}if(_[_0x0a9e('0x56')](_0x59e46f)){_0x59e46f=0x64;}_0x3c313d[_0x0a9e('0x5e')](addAdditionalPhone(_0x5ab0bc['id'],_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')],_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?null:_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:null,_0x59e46f,_0x2ada60));}Promise[_0x0a9e('0x62')](_0x3c313d)[_0x0a9e('0x15')](function(){db['CmContact']['update']({'AdditionalPhones':_0x5505f4},{'where':{'id':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){_0x16449b(0x1);});});});});});}function addAdditionalPhone(_0x5c4be0,_0x1d999b,_0x3428c9,_0x5d6b69,_0x1a3754){return db[_0x0a9e('0x4a')][_0x0a9e('0x22')]({'where':{'CmContactId':_0x5c4be0,'item':_0x1d999b}})[_0x0a9e('0x15')](function(_0x5585d5){if(_0x5585d5)logger[_0x0a9e('0x37')](_0x0a9e('0x8d'),_0x5585d5);else{db[_0x0a9e('0x4a')][_0x0a9e('0x3d')]({'CmContactId':_0x5c4be0,'item':_0x1d999b,'ItemTypeId':_0x3428c9,'OrderBy':_0x5d6b69,'ItemClass':'PHONE','description':_0x1a3754});}});}function deleteCmHopperPhones(_0x19e9ed){return new Promise(function(_0x1a0b08){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x19e9ed}})[_0x0a9e('0x15')](function(_0x270df8){db[_0x0a9e('0x8e')]['destroy']({'where':{'CmHopperId':{'$in':_[_0x0a9e('0x6d')](_0x270df8,'id')}}});})[_0x0a9e('0x15')](function(){_0x1a0b08(0x1);});});}function addCmHopperPhones(_0x1d9b57){return new Promise(function(_0x1a7f58){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x1d9b57}})[_0x0a9e('0x15')](function(_0x289e65){var _0x4795ae=[];_[_0x0a9e('0x6d')](_0x289e65,function(_0x1fcfe6){_0x4795ae[_0x0a9e('0x5e')](createCmHopperPhone(_0x1d9b57,_0x1fcfe6['id']));});Promise['all'](_0x4795ae)['then'](function(){_0x1a7f58(0x1);});});});}function createCmHopperPhone(_0x523d08,_0x1015aa){return new Promise(function(_0x4a70ce){db['CmContactHasItem'][_0x0a9e('0x1d')]({'raw':!![],'attributes':[_0x0a9e('0x8f'),_0x0a9e('0x88')],'where':{'CmContactId':_0x523d08,'ItemClass':'PHONE'},'include':[{'model':db[_0x0a9e('0x68')],'attributes':[_0x0a9e('0x88')],'as':_0x0a9e('0x69')}],'order':[_0x0a9e('0x88'),db[_0x0a9e('0x90')][_0x0a9e('0x6a')](_0x0a9e('0x91'))]})[_0x0a9e('0x15')](function(_0x3b5bda){var _0x5a1848=0x1;var _0x43c397=_['map'](_0x3b5bda,function(_0x138cf5){_0x138cf5[_0x0a9e('0x92')]=_0x1015aa;_0x138cf5[_0x0a9e('0x76')]=_0x138cf5[_0x0a9e('0x8f')];_0x138cf5[_0x0a9e('0x88')]=_0x5a1848;delete _0x138cf5[_0x0a9e('0x93')];_0x5a1848=_0x5a1848+0x1;return _0x138cf5;});return db['CmHopperAdditionalPhone'][_0x0a9e('0x5a')](_0x43c397,{});})[_0x0a9e('0x15')](function(){_0x4a70ce(0x1);});});}function insertAdditionalPhones(_0xe25eb5,_0x1af799){return new Promise(function(_0x51aa2f){var _0x2e4887=[];for(var _0x3c9135=0x0;_0x3c9135<_0x1af799[_0x0a9e('0x2b')];_0x3c9135++){var _0x1c9539=_0x1af799[_0x3c9135];_0x2e4887[_0x0a9e('0x5e')](parseContactItemType(_0x1c9539));}Promise[_0x0a9e('0x62')](_0x2e4887)[_0x0a9e('0x15')](function(){var _0x25931e={'id':_0xe25eb5['id'],'items':_0x1af799};return addAdditionalPhones(_0x25931e)[_0x0a9e('0x15')](function(){return addCmHopperPhones(_0xe25eb5['id']);});})[_0x0a9e('0x15')](function(){_0x51aa2f(_0xe25eb5);});});}function parseContactItemType(_0x57f0ad){return new Promise(function(_0x2272bc){if(_0x57f0ad[_0x0a9e('0x31')](_0x0a9e('0x8b'))){_0x2272bc(_0x57f0ad);}else{return db[_0x0a9e('0x68')][_0x0a9e('0x22')]({'where':{'name':_0x57f0ad[_0x0a9e('0x69')]}})[_0x0a9e('0x15')](function(_0x20ae21){if(_['isNil'](_0x20ae21))_0x57f0ad[_0x0a9e('0x8b')]=null;else _0x57f0ad[_0x0a9e('0x8b')]=_0x20ae21['id'];_0x2272bc(_0x57f0ad);});}});}exports[_0x0a9e('0x94')]=function(_0x5c65fc,_0x1402c7){return db[_0x0a9e('0x4a')][_0x0a9e('0x1d')]({'raw':!![],'where':{'CmContactId':_0x5c65fc[_0x0a9e('0x23')]['id'],'ItemClass':_0x0a9e('0x95')},'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}],'order':[[_0x0a9e('0x88')],[db[_0x0a9e('0x90')][_0x0a9e('0x6a')]('`ItemType`.OrderBy')]]})[_0x0a9e('0x15')](function(_0x446e6){return _0x446e6;})[_0x0a9e('0x15')](respondWithResult(_0x1402c7,null))[_0x0a9e('0x20')](handleError(_0x1402c7,null));};exports[_0x0a9e('0x96')]=function(_0x3942fd,_0x5cb48d){return db[_0x0a9e('0x4a')]['findAll']({'raw':!![],'where':{'CmContactId':_0x3942fd['body']['fromContactId']}})[_0x0a9e('0x15')](function(_0x3fa3f2){var _0x426cb4=_[_0x0a9e('0x6d')](_0x3fa3f2,function(_0x4d99a8){_0x4d99a8[_0x0a9e('0x97')]=_0x3942fd[_0x0a9e('0x32')][_0x0a9e('0x98')];return _0x4d99a8;});return db[_0x0a9e('0x4a')][_0x0a9e('0x5a')](_0x426cb4,{});})['then'](function(){return addCmHopperPhones(_0x3942fd['body'][_0x0a9e('0x98')]);})[_0x0a9e('0x15')](function(){return['ok'];})[_0x0a9e('0x15')](respondWithResult(_0x5cb48d,null))['catch'](handleError(_0x5cb48d,null));};exports[_0x0a9e('0x99')]=function(_0x248a9a,_0x422f0a){var _0x4cee8c=[];_0x4cee8c[_0x0a9e('0x5e')](createCmHopperPhone(_0x248a9a[_0x0a9e('0x32')]['id'],_0x248a9a[_0x0a9e('0x32')]['hopperId']));Promise[_0x0a9e('0x62')](_0x4cee8c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x422f0a,null));};exports['getHoppers']=function(_0x549697,_0x53ef46){var _0x3b04fd={'raw':![],'where':{}};var _0x1f50db={};var _0xcbc73c={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x549697[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x53ef46,null))[_0x0a9e('0x15')](function(_0x2ff2ab){if(_0x2ff2ab){_0x1f50db[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x39')][_0x0a9e('0x79')]);_0x1f50db[_0x0a9e('0x1e')]=_['keys'](_0x549697[_0x0a9e('0x1e')]);_0x1f50db['filters']=_[_0x0a9e('0x7b')](_0x1f50db['model'],_0x1f50db[_0x0a9e('0x1e')]);_0x3b04fd['attributes']=_[_0x0a9e('0x7b')](_0x1f50db[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x3b04fd[_0x0a9e('0x7c')]=_0x3b04fd[_0x0a9e('0x7c')]['length']?_0x3b04fd[_0x0a9e('0x7c')]:_0x1f50db[_0x0a9e('0x78')];if(!_0x549697['query'][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x3b04fd['limit']=qs[_0x0a9e('0x12')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x3b04fd['offset']=qs[_0x0a9e('0x10')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x3b04fd[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x3b04fd[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x549697['query'],_0x1f50db[_0x0a9e('0x7a')]));_0x3b04fd['where'][_0x0a9e('0x9a')]=_0x2ff2ab['id'];if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x3b04fd[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x3b04fd[_0x0a9e('0x5c')],{'$or':_['map'](_0x3b04fd[_0x0a9e('0x7c')],function(_0x469035){var _0x2977a7={};_0x2977a7[_0x469035]={'$like':'%'+_0x549697['query'][_0x0a9e('0x81')]+'%'};return _0x2977a7;})});}_0x3b04fd=_[_0x0a9e('0x82')]({},_0x3b04fd,_0x549697[_0x0a9e('0x9b')]);return db[_0x0a9e('0x39')][_0x0a9e('0x13')]({'where':_0x3b04fd[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x5f2c51){_0xcbc73c[_0x0a9e('0x13')]=_0x5f2c51;if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x3b04fd[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x39')][_0x0a9e('0x1d')](_0x3b04fd);})[_0x0a9e('0x15')](function(_0x5d6a48){_0xcbc73c['rows']=_0x5d6a48;return _0xcbc73c;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x53ef46,_0x3b04fd))[_0x0a9e('0x20')](handleError(_0x53ef46,null));};exports[_0x0a9e('0x9e')]=function(_0x1bf692,_0x40e2da){var _0x131da8={'raw':!![],'where':{}};var _0x609711={};var _0x584854={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x1bf692[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x40e2da,null))[_0x0a9e('0x15')](function(_0x3c6082){if(_0x3c6082){_0x609711[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x9f')][_0x0a9e('0x79')]);_0x609711[_0x0a9e('0x1e')]=_['keys'](_0x1bf692[_0x0a9e('0x1e')]);_0x609711[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],_0x609711['query']);_0x131da8[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x131da8[_0x0a9e('0x7c')]=_0x131da8[_0x0a9e('0x7c')]['length']?_0x131da8[_0x0a9e('0x7c')]:_0x609711[_0x0a9e('0x78')];if(!_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0x131da8['limit']=qs[_0x0a9e('0x12')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x131da8['offset']=qs[_0x0a9e('0x10')](_0x1bf692[_0x0a9e('0x1e')]['offset']);}_0x131da8[_0x0a9e('0x7e')]=qs['sort'](_0x1bf692[_0x0a9e('0x1e')]['sort']);_0x131da8['where']=qs['filters'](_[_0x0a9e('0x80')](_0x1bf692[_0x0a9e('0x1e')],_0x609711[_0x0a9e('0x7a')]));_0x131da8[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x3c6082['id'];if(_0x1bf692[_0x0a9e('0x1e')]['filter']){_0x131da8[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x131da8[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x131da8[_0x0a9e('0x7c')],function(_0x18dccf){var _0x31c937={};_0x31c937[_0x18dccf]={'$like':'%'+_0x1bf692['query']['filter']+'%'};return _0x31c937;})});}_0x131da8=_[_0x0a9e('0x82')]({},_0x131da8,_0x1bf692['options']);return db[_0x0a9e('0x9f')][_0x0a9e('0x13')]({'where':_0x131da8[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x37a448){_0x584854[_0x0a9e('0x13')]=_0x37a448;if(_0x1bf692['query'][_0x0a9e('0x9c')]){_0x131da8['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x0a9e('0x1d')](_0x131da8);})['then'](function(_0x38dceb){_0x584854['rows']=_0x38dceb;return _0x584854;});}})['then'](respondWithFilteredResult(_0x40e2da,_0x131da8))[_0x0a9e('0x20')](handleError(_0x40e2da,null));};exports['getHopperFinals']=function(_0x24470a,_0x142e53){var _0xe1ab0d={'raw':!![],'where':{}};var _0x48f532={};var _0x4152cd={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x24470a['params']['id']}})['then'](handleEntityNotFound(_0x142e53,null))[_0x0a9e('0x15')](function(_0x948aab){if(_0x948aab){_0x48f532[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x4b')][_0x0a9e('0x79')]);_0x48f532[_0x0a9e('0x1e')]=_[_0x0a9e('0x25')](_0x24470a[_0x0a9e('0x1e')]);_0x48f532[_0x0a9e('0x7a')]=_['intersection'](_0x48f532['model'],_0x48f532['query']);_0xe1ab0d[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x48f532[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0xe1ab0d[_0x0a9e('0x7c')]=_0xe1ab0d[_0x0a9e('0x7c')]['length']?_0xe1ab0d['attributes']:_0x48f532[_0x0a9e('0x78')];if(!_0x24470a[_0x0a9e('0x1e')]['hasOwnProperty'](_0x0a9e('0x83'))){_0xe1ab0d[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0xe1ab0d[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0xe1ab0d[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x24470a[_0x0a9e('0x1e')]['sort']);_0xe1ab0d[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x24470a[_0x0a9e('0x1e')],_0x48f532[_0x0a9e('0x7a')]));_0xe1ab0d[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x948aab['id'];if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0xe1ab0d[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0xe1ab0d[_0x0a9e('0x5c')],{'$or':_['map'](_0xe1ab0d['attributes'],function(_0x3e5182){var _0x401207={};_0x401207[_0x3e5182]={'$like':'%'+_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x401207;})});}_0xe1ab0d=_[_0x0a9e('0x82')]({},_0xe1ab0d,_0x24470a[_0x0a9e('0x9b')]);return db[_0x0a9e('0x4b')]['count']({'where':_0xe1ab0d[_0x0a9e('0x5c')]})['then'](function(_0x26aa44){_0x4152cd[_0x0a9e('0x13')]=_0x26aa44;if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0xe1ab0d[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x4b')][_0x0a9e('0x1d')](_0xe1ab0d);})[_0x0a9e('0x15')](function(_0xa7a754){_0x4152cd[_0x0a9e('0xa0')]=_0xa7a754;return _0x4152cd;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x142e53,_0xe1ab0d))[_0x0a9e('0x20')](handleError(_0x142e53,null));};exports[_0x0a9e('0xa1')]=function(_0x3f7cb6,_0x3c8a9a){var _0x2d5e00={'raw':!![],'where':{}};var _0x5b78a8={};var _0x54cf62={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x3f7cb6['params']['id']}})['then'](handleEntityNotFound(_0x3c8a9a,null))[_0x0a9e('0x15')](function(_0x1feb9){if(_0x1feb9){_0x5b78a8[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0xa2')]['rawAttributes']);_0x5b78a8[_0x0a9e('0x1e')]=_['keys'](_0x3f7cb6[_0x0a9e('0x1e')]);_0x5b78a8['filters']=_[_0x0a9e('0x7b')](_0x5b78a8[_0x0a9e('0x78')],_0x5b78a8[_0x0a9e('0x1e')]);_0x2d5e00['attributes']=_[_0x0a9e('0x7b')](_0x5b78a8['model'],qs['fields'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x2d5e00[_0x0a9e('0x7c')]=_0x2d5e00[_0x0a9e('0x7c')][_0x0a9e('0x2b')]?_0x2d5e00[_0x0a9e('0x7c')]:_0x5b78a8[_0x0a9e('0x78')];if(!_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x2d5e00[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x2d5e00[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x2d5e00[_0x0a9e('0x7e')]=qs['sort'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x2d5e00[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_['pick'](_0x3f7cb6['query'],_0x5b78a8['filters']));_0x2d5e00[_0x0a9e('0x5c')]['ContactId']=_0x1feb9['id'];if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x2d5e00[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x2d5e00[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x2d5e00[_0x0a9e('0x7c')],function(_0x1cc73e){var _0x2154d8={};_0x2154d8[_0x1cc73e]={'$like':'%'+_0x3f7cb6[_0x0a9e('0x1e')]['filter']+'%'};return _0x2154d8;})});}_0x2d5e00=_[_0x0a9e('0x82')]({},_0x2d5e00,_0x3f7cb6['options']);return db[_0x0a9e('0xa2')]['count']({'where':_0x2d5e00[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x216791){_0x54cf62['count']=_0x216791;if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x2d5e00['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0x0a9e('0x1d')](_0x2d5e00);})[_0x0a9e('0x15')](function(_0x1262ff){_0x54cf62['rows']=_0x1262ff;return _0x54cf62;});}})['then'](respondWithFilteredResult(_0x3c8a9a,_0x2d5e00))['catch'](handleError(_0x3c8a9a,null));};exports[_0x0a9e('0xa3')]=function(_0x22c591,_0x2b7ba9){try{if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]){throw new Error(_0x0a9e('0xa6'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')]){throw new Error(_0x0a9e('0xa8'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error(_0x0a9e('0xaa'));}var _0x1a74c4=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]['split'](',');var _0xb33e27=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')][_0x0a9e('0xab')](',');if(!_0x1a74c4[_0x0a9e('0x2b')]||!_0xb33e27[_0x0a9e('0x2b')]||_0x1a74c4['length']!==_0xb33e27[_0x0a9e('0x2b')]){throw new Error(_0x0a9e('0xac'));}_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')]=_[_0x0a9e('0xad')](_0x1a74c4,_0xb33e27);if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x22c591['body']['fields'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}var _0x5c2996=path[_0x0a9e('0x36')](config[_0x0a9e('0xb1')],'server/files/tmp',_0x22c591[_0x0a9e('0xb2')]['filename']);fs[_0x0a9e('0xb3')](_0x5c2996,parseInt(_0x0a9e('0xb4'),0x8));var _0x58c53c=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xb7')),[_0x5c2996,_0x22c591[_0x0a9e('0x32')]['binding_keys'],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xb8')],_0x22c591['body'][_0x0a9e('0x5b')],_0x22c591[_0x0a9e('0x32')]['socket_timestamp']]);return _0x2b7ba9[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xba'),'pid':_0x58c53c[_0x0a9e('0xbb')]});}catch(_0x3fae71){return _0x2b7ba9[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xbc')](_0x3fae71);}};exports['upload']=function(_0x49e1b8,_0x5a2013){var _0x55d764=fs['createReadStream'](_0x49e1b8[_0x0a9e('0xb2')][_0x0a9e('0xbd')]);Papa['parse'](_0x55d764,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x5c23aa){return _0x5a2013[_0x0a9e('0xf')](0xc8)['json']({'file':_0x49e1b8[_0x0a9e('0xb2')],'fields':_0x5c23aa[_0x0a9e('0xbe')][_0x0a9e('0x7d')]});}});};exports[_0x0a9e('0xbf')]=function(_0x336518,_0x14a683){return db['User'][_0x0a9e('0x1d')]({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})['then'](function(_0x44cdb8){var _0x1c0d54=![];if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xc1')]['phone']){throw new Error(_0x0a9e('0xae'));}if(!_0x336518['body'][_0x0a9e('0xc1')][_0x0a9e('0xaf')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x78a398=require('child_process')[_0x0a9e('0xb6')](path[_0x0a9e('0x36')](__dirname,'../../components/import/cm/csv2'),[_0x336518[_0x0a9e('0x23')]['id'],JSON['stringify'](_0x336518[_0x0a9e('0x32')]),JSON[_0x0a9e('0xc2')](_0x44cdb8)]);_0x78a398['on'](_0x0a9e('0xc3'),function(){_0x1c0d54=!![];return _0x14a683[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x78a398[_0x0a9e('0xbb')]});});_0x78a398['on']('exit',function(_0x36318d){if(_0x36318d&&!_0x1c0d54){return _0x14a683[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc5'),'pid':_0x78a398[_0x0a9e('0xbb')]});}});})['catch'](handleError(_0x14a683,null));};exports[_0x0a9e('0xc6')]=function(_0x49a6b2,_0x5d1159){return db[_0x0a9e('0xc7')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})[_0x0a9e('0x15')](function(_0x58d5fd){var _0x171a69=![];if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xc1')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x49a6b2[_0x0a9e('0x32')]['binding'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x38d95a=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xc8')),[_0x49a6b2[_0x0a9e('0x23')]['id'],JSON[_0x0a9e('0xc2')](_0x49a6b2['body']),JSON[_0x0a9e('0xc2')](_0x58d5fd)]);_0x38d95a['on']('message',function(){_0x171a69=!![];return _0x5d1159[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x38d95a[_0x0a9e('0xbb')]});});_0x38d95a['on'](_0x0a9e('0xc9'),function(_0x1b86e6){if(_0x1b86e6&&!_0x171a69){return _0x5d1159[_0x0a9e('0xf')](0x1f4)['json']({'message':_0x0a9e('0xc5'),'pid':_0x38d95a[_0x0a9e('0xbb')]});}});})[_0x0a9e('0x20')](handleError(_0x5d1159,null));};exports[_0x0a9e('0xca')]=function(_0x1eb768,_0x117694){var _0x3a4def=[_0x0a9e('0xcb'),_0x0a9e('0xcc'),_0x0a9e('0xcd'),_0x0a9e('0xce'),_0x0a9e('0xcf'),_0x0a9e('0xd0'),_0x0a9e('0xd1')];var _0xdce963={'offset':0x0,'order':qs[_0x0a9e('0x7f')](_0x0a9e('0xd2'))},_0xfc4f={'count':0x0,'rows':[]};Promise[_0x0a9e('0xd3')]()[_0x0a9e('0x15')](function(){if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd4')]){if(!_[_0x0a9e('0xd5')](_0x3a4def,_0x1eb768['query'][_0x0a9e('0xd4')][_0x0a9e('0xd6')]())){throw new Error(_0x0a9e('0xd7'));}_0x3a4def=[_0x1eb768['query'][_0x0a9e('0xd4')]['toLowerCase']()];}if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){try{var _0x20a292=JSON[_0x0a9e('0xd9')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]);if(!moment(_0x20a292[_0x0a9e('0x33')])[_0x0a9e('0xda')]()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0x20a292['to'])[_0x0a9e('0xda')]()){throw new Error(_0x0a9e('0xdb'));}}catch(_0x4d6f2d){throw new Error(_0x0a9e('0xdc'));}}if(!_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0xdce963[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x12')]||0xa);_0xdce963['offset']=qs[_0x0a9e('0x10')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}var _0x2b8eed=_0x3a4def[_0x0a9e('0x6d')](function(_0x4ea917){if(_0x4ea917===_0x0a9e('0xd1')){var _0x3fc431={'attributes':['id','uniqueid',_0x0a9e('0x2e'),_0x0a9e('0xdd'),_0x0a9e('0xde'),'callerid','starttime',_0x0a9e('0xdf'),_0x0a9e('0xe0'),_0x0a9e('0xe1'),_0x0a9e('0xe2'),_0x0a9e('0xe3'),_0x0a9e('0xe4'),_0x0a9e('0xe5'),_0x0a9e('0xe6')],'where':{'ContactId':_0x1eb768['params']['id']},'include':[{'model':db['User'],'as':_0x0a9e('0xc7'),'attributes':['id','name',_0x0a9e('0xe7'),_0x0a9e('0xe8')]}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768['query'][_0x0a9e('0xd8')]){_0x3fc431[_0x0a9e('0x5c')]['createdAt']={'$gte':_0x20a292[_0x0a9e('0x33')],'$lte':_0x20a292['to']};}return db['VoiceCallReport'][_0x0a9e('0xea')](_0x3fc431)[_0x0a9e('0x15')](function(_0xd63c87){_0xfc4f[_0x0a9e('0x13')]+=_0xd63c87[_0x0a9e('0x13')];return _[_0x0a9e('0x6d')](_0xd63c87['rows'],function(_0x16d50b){var _0x580dd2=_0x16d50b[_0x0a9e('0x34')]({'plain':!![]});_0x580dd2[_0x0a9e('0xd4')]=_0x4ea917;if(_0x580dd2[_0x0a9e('0xc7')]){_0x580dd2[_0x0a9e('0xc7')]={'id':_0x580dd2[_0x0a9e('0xc7')]['id'],'name':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0x1a')],'fullname':_0x580dd2['User'][_0x0a9e('0xe7')],'alias':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0xe8')]};}return _0x580dd2;});});}else{var _0x188231=_[_0x0a9e('0xeb')](_0x4ea917)+(_0x4ea917==='chat'?_0x0a9e('0xec'):_0x0a9e('0xed'));var _0x488d6c={'attributes':['id','closed',_0x0a9e('0xee'),_0x0a9e('0xe2'),_0x0a9e('0xe1'),_0x0a9e('0xef'),_0x0a9e('0xf0'),_0x0a9e('0xf1'),'UserId',_0x188231+'Id'],'where':{'ContactId':_0x1eb768[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x188231],'as':_0x0a9e('0xed'),'attributes':['id',_0x0a9e('0x1a'),'key']},{'model':db[_0x0a9e('0xc7')],'as':_0x0a9e('0xf2'),'attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0xe7')]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'through':{'attributes':[]}}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){_0x488d6c[_0x0a9e('0x5c')][_0x0a9e('0xe2')]={'$gte':_0x20a292['from'],'$lte':_0x20a292['to']};}switch(_0x4ea917){case _0x0a9e('0xcc'):_0x488d6c['attributes'][_0x0a9e('0x5e')](_0x0a9e('0xf3'),_0x0a9e('0xf4'),'customerPort','deviceModel',_0x0a9e('0xf5'),'ratingMessage',_0x0a9e('0xf6'),'ratingValue','referer');break;case _0x0a9e('0xcb'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf7'),_0x0a9e('0xf8'));break;case _0x0a9e('0xce'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf9'),_0x0a9e('0xfa'));break;}return db[_[_0x0a9e('0xeb')](_0x4ea917)+_0x0a9e('0xfb')][_0x0a9e('0xea')](_0x488d6c)['then'](function(_0x58f251){_0xfc4f[_0x0a9e('0x13')]+=_0x58f251['count'];return _[_0x0a9e('0x6d')](_0x58f251[_0x0a9e('0xa0')],function(_0x27be90){var _0x54befc=_0x27be90['get']({'plain':!![]});_0x54befc[_0x0a9e('0xd4')]=_0x4ea917;if(_0x54befc[_0x0a9e('0xf2')]){_0x54befc[_0x0a9e('0xf2')]={'id':_0x54befc[_0x0a9e('0xf2')]['id'],'name':_0x54befc[_0x0a9e('0xf2')][_0x0a9e('0x1a')],'fullname':_0x54befc[_0x0a9e('0xf2')]['fullname']};}return _0x54befc;});});}});return Promise[_0x0a9e('0x62')](_0x2b8eed);})['then'](function(_0x46b11b){return _(_0x46b11b)[_0x0a9e('0xfc')]()['sortBy'](_0x0a9e('0xe2'))[_0x0a9e('0xfd')]()[_0x0a9e('0xfe')]();})[_0x0a9e('0x15')](function(_0xb0fb60){_0xfc4f[_0x0a9e('0xa0')]=_0xdce963['limit']?_0xb0fb60[_0x0a9e('0xff')](_0xdce963[_0x0a9e('0x10')],_0xdce963[_0x0a9e('0x10')]+_0xdce963['limit']):_0xb0fb60;return _0xfc4f;})[_0x0a9e('0x15')](respondWithFilteredResult(_0x117694,_0xdce963))[_0x0a9e('0x20')](handleError(_0x117694,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index 27673a8..dadb9d8 100644 --- a/server/api/cmContact/cmContact.events.js +++ b/server/api/cmContact/cmContact.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe612=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','CmContact','setMaxListeners','save'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xe612,0x17c));var _0x2e61=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xe612[_0x6131cd];return _0x47e916;};'use strict';var EventEmitter=require(_0x2e61('0x0'));var CmContact=require(_0x2e61('0x1'))['db'][_0x2e61('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x2e61('0x3')](0x0);var events={'afterCreate':_0x2e61('0x4'),'afterUpdate':_0x2e61('0x5'),'afterDestroy':_0x2e61('0x6')};function emitEvent(_0x148bc0){return function(_0x11dd9e,_0x2235b8,_0x4aed9a){CmContactEvents[_0x2e61('0x7')](_0x148bc0+':'+_0x11dd9e['id'],_0x11dd9e);CmContactEvents[_0x2e61('0x7')](_0x148bc0,_0x11dd9e);_0x4aed9a(null);};}for(var e in events){if(events[_0x2e61('0x8')](e)){var event=events[e];CmContact[_0x2e61('0x9')](e,emitEvent(event));}}module[_0x2e61('0xa')]=CmContactEvents; \ No newline at end of file +var _0x46ec=['../../mysqldb','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x53f458,_0x4ced31){var _0x51b1db=function(_0x2aca0c){while(--_0x2aca0c){_0x53f458['push'](_0x53f458['shift']());}};_0x51b1db(++_0x4ced31);}(_0x46ec,0xef));var _0xc46e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x46ec[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require(_0xc46e('0x0'));var CmContact=require(_0xc46e('0x1'))['db']['CmContact'];var CmContactEvents=new EventEmitter();CmContactEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc46e('0x2'),'afterUpdate':_0xc46e('0x3'),'afterDestroy':_0xc46e('0x4')};function emitEvent(_0x22aa15){return function(_0x450eb6,_0x33447f,_0x57a3a0){CmContactEvents[_0xc46e('0x5')](_0x22aa15+':'+_0x450eb6['id'],_0x450eb6);CmContactEvents[_0xc46e('0x5')](_0x22aa15,_0x450eb6);_0x57a3a0(null);};}for(var e in events){if(events[_0xc46e('0x6')](e)){var event=events[e];CmContact[_0xc46e('0x7')](e,emitEvent(event));}}module['exports']=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index a09f2cc..c9a3bcf 100644 --- a/server/api/cmContact/cmContact.model.js +++ b/server/api/cmContact/cmContact.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3a9d=['findOne','then','timezones','utcOffset','add','format','ret','CmHopper','cmContact,\x20afterCreate\x20','create','ListId','priority','callbackUniqueid','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal','cmContact,\x20afterCreate,\x20','catch','Campaign','minutes','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','BlackLists','CmHopperBlack','cmContact,\x20%s,\x20%s','message','length','always','onlyIfOpen','List\x20not\x20found','models','isEmpty','ContactId','VoiceQueueId','CampaignId','all','info','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./cmContact.attributes','exports','define','CmContact','cm_contacts','phone','fti_cm_contacts','firstName','lastName','mobile','fax','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','error','cmContact','afterCreate','inspect','scheduledat','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone'];(function(_0x27a5b4,_0x547d2d){var _0x2026a2=function(_0x548beb){while(--_0x548beb){_0x27a5b4['push'](_0x27a5b4['shift']());}};_0x2026a2(++_0x547d2d);}(_0x3a9d,0x1af));var _0xd3a9=function(_0x3ff0c9,_0x35d6e8){_0x3ff0c9=_0x3ff0c9-0x0;var _0x568b92=_0x3a9d[_0x3ff0c9];return _0x568b92;};'use strict';var _=require(_0xd3a9('0x0'));var util=require(_0xd3a9('0x1'));var logger=require(_0xd3a9('0x2'))(_0xd3a9('0x3'));var moment=require(_0xd3a9('0x4'));var BPromise=require(_0xd3a9('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd3a9('0x6'));var rimraf=require(_0xd3a9('0x7'));var config=require(_0xd3a9('0x8'));var shared=require('../../config/environment/shared');var attributes=require(_0xd3a9('0x9'));module[_0xd3a9('0xa')]=function(_0x2ae308,_0x401f46){return _0x2ae308[_0xd3a9('0xb')](_0xd3a9('0xc'),attributes,{'tableName':_0xd3a9('0xd'),'paranoid':!![],'indexes':[{'name':_0xd3a9('0xe'),'fields':[_0xd3a9('0xe')]},{'name':_0xd3a9('0xf'),'fields':[_0xd3a9('0x10'),_0xd3a9('0x11'),_0xd3a9('0xe'),_0xd3a9('0x12'),_0xd3a9('0x13'),'email'],'type':_0xd3a9('0x14')}],'timestamps':!![],'charset':_0xd3a9('0x15'),'collate':_0xd3a9('0x16'),'hooks':{'afterCreate':function(_0x443cd1,_0x497e1d,_0x47ef88){var _0x21234f=_0x2ae308['models'];var _0x4a2c35=_0x443cd1['get']({'plain':!![]});function _0x3241a9(){return function(_0x52df5b){logger[_0xd3a9('0x17')](_0xd3a9('0x18'),_0xd3a9('0x19'),util[_0xd3a9('0x1a')](_0x52df5b,{'showHidden':![],'depth':null}));};}function _0x76a222(_0x1e729f,_0x14fb7f){var _0x21c74f=_0x14fb7f[_0xd3a9('0x1b')]?_0x14fb7f[_0xd3a9('0x1b')]:moment()['format'](_0xd3a9('0x1c'));return new BPromise(function(_0x559dad,_0x507d99){if(_[_0xd3a9('0x1d')](_0x14fb7f[_0xd3a9('0x1e')])){_0x559dad({'ret':_0x21c74f});}else{_0x21234f['VoiceQueue'][_0xd3a9('0x1f')]({'where':{'id':_0x1e729f['id']}})[_0xd3a9('0x20')](function(_0x1af6dd){if(!_[_0xd3a9('0x1d')](_0x1af6dd)){var _0x21c745=_0x1af6dd['dialTimezone'];if(!_[_0xd3a9('0x1d')](_0x21c745)){var _0x4fb01c=shared[_0xd3a9('0x21')];var _0x25dda1=_0x4fb01c[_0x21c745];var _0x50ee14=_0x4fb01c[_0x14fb7f[_0xd3a9('0x1e')]];if(!_['isNil'](_0x25dda1)&&!_[_0xd3a9('0x1d')](_0x50ee14)){var _0x34c3a5=_0x25dda1[_0xd3a9('0x22')]-_0x50ee14[_0xd3a9('0x22')];_0x21c74f=_0x14fb7f[_0xd3a9('0x1b')]?_0x14fb7f[_0xd3a9('0x1b')]:moment();var _0x51364e=moment(_0x21c74f)[_0xd3a9('0x23')](_0x34c3a5,'minutes');_0x559dad({'ret':_0x51364e[_0xd3a9('0x24')]('YYYY-MM-DD\x20HH:mm:ss')});}else _0x559dad({'ret':_0x21c74f});}else _0x559dad({'ret':_0x21c74f});}else{_0x559dad({'ret':_0x21c74f});}});}});return 0xa;}var _0x24d3dc=function(_0x312677){return new BPromise(function(_0x1a9c47,_0x3d2569){_0x76a222(_0x312677,_0x4a2c35)[_0xd3a9('0x20')](function(_0x447fbb){_0x4a2c35[_0xd3a9('0x1b')]=_0x447fbb[_0xd3a9('0x25')];_0x21234f[_0xd3a9('0x26')]['findOne']({'where':{'phone':_0x4a2c35['phone'],'VoiceQueueId':_0x312677['id']}})[_0xd3a9('0x20')](function(_0x1fcac4){if(!_['isNil'](_0x1fcac4)){throw new Error(_0xd3a9('0x27')+_0x4a2c35[_0xd3a9('0xe')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0x312677['id']);}return _0x21234f[_0xd3a9('0x26')][_0xd3a9('0x28')]({'phone':_0x4a2c35[_0xd3a9('0xe')],'ContactId':_0x4a2c35['id'],'ListId':_0x4a2c35[_0xd3a9('0x29')],'priority':_0x4a2c35['priority']?_0x4a2c35[_0xd3a9('0x2a')]:0x2,'scheduledat':_0x4a2c35[_0xd3a9('0x1b')]?_0x4a2c35['scheduledat']:moment()[_0xd3a9('0x24')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x4a2c35[_0xd3a9('0x2b')]?!![]:![],'callbackuniqueid':_0x4a2c35[_0xd3a9('0x2b')]?_0x4a2c35[_0xd3a9('0x2b')]:undefined,'callbackat':_0x4a2c35[_0xd3a9('0x2b')]?moment()[_0xd3a9('0x24')](_0xd3a9('0x1c')):undefined,'VoiceQueueId':_0x312677['id']});})['catch'](function(_0xae52c0){_0x3d2569(_0xae52c0);});});});};var _0x37be34=function(_0x382146){return new BPromise(function(_0x324bbd,_0x2b991b){_0x76a222(_0x382146,_0x4a2c35)[_0xd3a9('0x20')](function(_0x272fe3){_0x4a2c35[_0xd3a9('0x1b')]=_0x272fe3[_0xd3a9('0x25')];_0x21234f[_0xd3a9('0x26')][_0xd3a9('0x1f')]({'where':{'phone':_0x4a2c35[_0xd3a9('0xe')],'VoiceQueueId':_0x382146['id']}})[_0xd3a9('0x20')](function(_0x2e6aca){if(!_[_0xd3a9('0x1d')](_0x2e6aca)){throw new Error(_0xd3a9('0x27')+_0x4a2c35[_0xd3a9('0xe')]+_0xd3a9('0x2c')+_0x382146['id']);}return _0x21234f[_0xd3a9('0x2d')][_0xd3a9('0x1f')]({'where':{'calleridnum':_0x4a2c35['phone'],'VoiceQueueId':_0x382146['id']}});})[_0xd3a9('0x20')](function(_0x2835d7){if(!_[_0xd3a9('0x1d')](_0x2835d7)){throw new Error(_0xd3a9('0x2e')+_0x4a2c35[_0xd3a9('0xe')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20'+_0x382146['id']);}return _0x21234f[_0xd3a9('0x26')][_0xd3a9('0x28')]({'phone':_0x4a2c35[_0xd3a9('0xe')],'ContactId':_0x4a2c35['id'],'ListId':_0x4a2c35[_0xd3a9('0x29')],'priority':_0x4a2c35[_0xd3a9('0x2a')]?_0x4a2c35[_0xd3a9('0x2a')]:0x2,'scheduledat':_0x4a2c35[_0xd3a9('0x1b')]?_0x4a2c35['scheduledat']:moment()[_0xd3a9('0x24')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x4a2c35[_0xd3a9('0x2b')]?!![]:![],'callbackuniqueid':_0x4a2c35[_0xd3a9('0x2b')]?_0x4a2c35[_0xd3a9('0x2b')]:undefined,'callbackat':_0x4a2c35[_0xd3a9('0x2b')]?moment()[_0xd3a9('0x24')](_0xd3a9('0x1c')):undefined,'VoiceQueueId':_0x382146['id']});})[_0xd3a9('0x2f')](function(_0x46d121){_0x2b991b(_0x46d121);});});});};function _0x184229(){return function(_0x4edb6b){logger[_0xd3a9('0x17')](_0xd3a9('0x18'),_0xd3a9('0x19'),util[_0xd3a9('0x1a')](_0x4edb6b,{'showHidden':![],'depth':null}));};}function _0x4a3e35(_0x15caec,_0x39cae1){var _0x1b2df8=_0x39cae1['scheduledat']?_0x39cae1[_0xd3a9('0x1b')]:moment()[_0xd3a9('0x24')](_0xd3a9('0x1c'));return new BPromise(function(_0xb321b,_0x41f474){if(_[_0xd3a9('0x1d')](_0x39cae1[_0xd3a9('0x1e')])){_0xb321b({'ret':_0x1b2df8});}else{_0x21234f[_0xd3a9('0x30')][_0xd3a9('0x1f')]({'where':{'id':_0x15caec['id']}})[_0xd3a9('0x20')](function(_0x5975c6){if(!_['isNil'](_0x5975c6)){var _0x5a6062=_0x5975c6[_0xd3a9('0x1e')];if(!_[_0xd3a9('0x1d')](_0x5a6062)){var _0x1ec6e3=shared[_0xd3a9('0x21')];var _0x454f43=_0x1ec6e3[_0x5a6062];var _0x32c5f3=_0x1ec6e3[_0x39cae1[_0xd3a9('0x1e')]];if(!_['isNil'](_0x454f43)&&!_[_0xd3a9('0x1d')](_0x32c5f3)){var _0x527990=_0x454f43[_0xd3a9('0x22')]-_0x32c5f3[_0xd3a9('0x22')];_0x1b2df8=_0x39cae1['scheduledat']?_0x39cae1[_0xd3a9('0x1b')]:moment();var _0x472c4b=moment(_0x1b2df8)['add'](_0x527990,_0xd3a9('0x31'));_0xb321b({'ret':_0x472c4b[_0xd3a9('0x24')](_0xd3a9('0x1c'))});}else _0xb321b({'ret':_0x1b2df8});}else _0xb321b({'ret':_0x1b2df8});}else{_0xb321b({'ret':_0x1b2df8});}});}});return 0xa;}var _0x4bc6a1=function(_0x4e38ca){return new BPromise(function(_0x474237,_0x1be72d){_0x4a3e35(_0x4e38ca,_0x4a2c35)[_0xd3a9('0x20')](function(_0x2814e5){_0x4a2c35['scheduledat']=_0x2814e5[_0xd3a9('0x25')];_0x21234f[_0xd3a9('0x26')]['findOne']({'where':{'phone':_0x4a2c35[_0xd3a9('0xe')],'CampaignId':_0x4e38ca['id']}})[_0xd3a9('0x20')](function(_0x13a0c5){if(!_[_0xd3a9('0x1d')](_0x13a0c5)){throw new Error(_0xd3a9('0x27')+_0x4a2c35[_0xd3a9('0xe')]+_0xd3a9('0x32')+_0x4e38ca['id']);}return _0x21234f[_0xd3a9('0x26')][_0xd3a9('0x28')]({'phone':_0x4a2c35[_0xd3a9('0xe')],'ContactId':_0x4a2c35['id'],'ListId':_0x4a2c35[_0xd3a9('0x29')],'priority':_0x4a2c35[_0xd3a9('0x2a')]?_0x4a2c35['priority']:0x2,'scheduledat':_0x4a2c35[_0xd3a9('0x1b')]?_0x4a2c35[_0xd3a9('0x1b')]:moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x4a2c35[_0xd3a9('0x2b')]?!![]:![],'callbackuniqueid':_0x4a2c35[_0xd3a9('0x2b')]?_0x4a2c35['callbackUniqueid']:undefined,'callbackat':_0x4a2c35['callbackUniqueid']?moment()[_0xd3a9('0x24')](_0xd3a9('0x1c')):undefined,'CampaignId':_0x4e38ca['id']});})[_0xd3a9('0x2f')](function(_0x2e22e8){_0x1be72d(_0x2e22e8);});});});};var _0x1c6d26=function(_0x49a1a5){return new BPromise(function(_0x2701d4,_0x2519c5){_0x4a3e35(_0x49a1a5,_0x4a2c35)[_0xd3a9('0x20')](function(_0x48d592){_0x4a2c35['scheduledat']=_0x48d592[_0xd3a9('0x25')];_0x21234f['CmHopper']['findOne']({'where':{'phone':_0x4a2c35[_0xd3a9('0xe')],'CampaignId':_0x49a1a5['id']}})[_0xd3a9('0x20')](function(_0x5f5bf8){if(!_[_0xd3a9('0x1d')](_0x5f5bf8)){throw new Error(_0xd3a9('0x27')+_0x4a2c35['phone']+_0xd3a9('0x33')+_0x49a1a5['id']);}return _0x21234f[_0xd3a9('0x2d')][_0xd3a9('0x1f')]({'where':{'calleridnum':_0x4a2c35[_0xd3a9('0xe')],'CampaignId':_0x49a1a5['id']}});})[_0xd3a9('0x20')](function(_0x5e4db5){if(!_[_0xd3a9('0x1d')](_0x5e4db5)){throw new Error('cmContact,\x20afterCreate,\x20'+_0x4a2c35[_0xd3a9('0xe')]+_0xd3a9('0x34')+_0x49a1a5['id']);}return _0x21234f['CmHopper']['create']({'phone':_0x4a2c35[_0xd3a9('0xe')],'ContactId':_0x4a2c35['id'],'ListId':_0x4a2c35[_0xd3a9('0x29')],'priority':_0x4a2c35[_0xd3a9('0x2a')]?_0x4a2c35['priority']:0x2,'scheduledat':_0x4a2c35[_0xd3a9('0x1b')]?_0x4a2c35[_0xd3a9('0x1b')]:moment()[_0xd3a9('0x24')](_0xd3a9('0x1c')),'callback':_0x4a2c35[_0xd3a9('0x2b')]?!![]:![],'callbackuniqueid':_0x4a2c35[_0xd3a9('0x2b')]?_0x4a2c35[_0xd3a9('0x2b')]:undefined,'callbackat':_0x4a2c35[_0xd3a9('0x2b')]?moment()['format'](_0xd3a9('0x1c')):undefined,'CampaignId':_0x49a1a5['id']});})[_0xd3a9('0x2f')](function(_0x4eda10){_0x2519c5(_0x4eda10);});});});};if(_0x4a2c35[_0xd3a9('0x29')]){_0x21234f[_0xd3a9('0x35')][_0xd3a9('0x36')]({'where':{'type':_0xd3a9('0x37')},'attributes':['id',_0xd3a9('0x38'),_0xd3a9('0x1e')],'include':[{'model':_0x21234f[_0xd3a9('0x39')],'as':_0xd3a9('0x3a'),'where':{'id':_0x4a2c35['ListId']}}]})[_0xd3a9('0x20')](function(_0x470dab){if(_0x470dab){var _0x1a009b=[];for(var _0x5a48dd=0x0,_0x53baab;_0x5a48dd<_0x470dab['length'];_0x5a48dd+=0x1){_0x53baab=_0x470dab[_0x5a48dd][_0xd3a9('0x3b')]({'plain':!![]});switch(_0x53baab[_0xd3a9('0x38')]){case'always':_0x37be34(_0x53baab)['catch'](_0x3241a9());break;case'onlyIfOpen':_0x24d3dc(_0x53baab)[_0xd3a9('0x2f')](_0x3241a9());break;default:_0x4a3e35(_0x53baab,_0x4a2c35)[_0xd3a9('0x20')](function(_0x29a397){_0x4a2c35[_0xd3a9('0x1b')]=_0x29a397['ret'];_0x21234f[_0xd3a9('0x26')][_0xd3a9('0x28')]({'phone':_0x4a2c35[_0xd3a9('0xe')],'ContactId':_0x4a2c35['id'],'ListId':_0x4a2c35[_0xd3a9('0x29')],'scheduledat':_0x4a2c35[_0xd3a9('0x1b')]?_0x4a2c35[_0xd3a9('0x1b')]:moment()[_0xd3a9('0x24')](_0xd3a9('0x1c')),'priority':_0x4a2c35['priority']?_0x4a2c35[_0xd3a9('0x2a')]:0x2,'callback':_0x4a2c35[_0xd3a9('0x2b')]?!![]:![],'callbackuniqueid':_0x4a2c35[_0xd3a9('0x2b')]?_0x4a2c35[_0xd3a9('0x2b')]:undefined,'callbackat':_0x4a2c35[_0xd3a9('0x2b')]?moment()[_0xd3a9('0x24')](_0xd3a9('0x1c')):undefined,'VoiceQueueId':_0x53baab['id']})[_0xd3a9('0x2f')](_0x3241a9());});}}}})[_0xd3a9('0x20')](function(){return _0x21234f[_0xd3a9('0x35')][_0xd3a9('0x36')]({'where':{'type':_0xd3a9('0x37')},'attributes':['id'],'include':[{'model':_0x21234f[_0xd3a9('0x39')],'as':_0xd3a9('0x3c'),'where':{'id':_0x4a2c35[_0xd3a9('0x29')]}}]})[_0xd3a9('0x20')](function(_0x335ce5){if(_0x335ce5){var _0x21640b=[];for(var _0x4f28bc=0x0,_0x2467ce;_0x4f28bc<_0x335ce5['length'];_0x4f28bc+=0x1){_0x2467ce=_0x335ce5[_0x4f28bc][_0xd3a9('0x3b')]({'plain':!![]});_0x21234f[_0xd3a9('0x3d')][_0xd3a9('0x28')]({'phone':_0x4a2c35[_0xd3a9('0xe')],'ContactId':_0x4a2c35['id'],'ListId':_0x4a2c35['ListId'],'VoiceQueueId':_0x2467ce['id']})[_0xd3a9('0x2f')](function(_0x114f9a){logger['error'](_0xd3a9('0x3e'),_0xd3a9('0x19'),_0x114f9a[_0xd3a9('0x3f')]);});}}});})[_0xd3a9('0x20')](function(){return _0x21234f[_0xd3a9('0x30')][_0xd3a9('0x36')]({'attributes':['id',_0xd3a9('0x38'),'dialTimezone'],'include':[{'model':_0x21234f[_0xd3a9('0x39')],'as':'Lists','where':{'id':_0x4a2c35[_0xd3a9('0x29')]}}]})[_0xd3a9('0x20')](function(_0xa407cf){if(_0xa407cf){var _0x10b82f=[];for(var _0x56d555=0x0,_0x5591b2;_0x56d555<_0xa407cf[_0xd3a9('0x40')];_0x56d555+=0x1){_0x5591b2=_0xa407cf[_0x56d555]['get']({'plain':!![]});switch(_0x5591b2[_0xd3a9('0x38')]){case _0xd3a9('0x41'):_0x1c6d26(_0x5591b2)['catch'](_0x184229());break;case _0xd3a9('0x42'):_0x4bc6a1(_0x5591b2)[_0xd3a9('0x2f')](_0x184229());break;default:_0x21234f[_0xd3a9('0x26')][_0xd3a9('0x28')]({'phone':_0x4a2c35[_0xd3a9('0xe')],'ContactId':_0x4a2c35['id'],'ListId':_0x4a2c35[_0xd3a9('0x29')],'scheduledat':_0x4a2c35[_0xd3a9('0x1b')]?_0x4a2c35[_0xd3a9('0x1b')]:moment()[_0xd3a9('0x24')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x4a2c35[_0xd3a9('0x2a')]?_0x4a2c35['priority']:0x2,'callback':_0x4a2c35['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x4a2c35[_0xd3a9('0x2b')]?_0x4a2c35[_0xd3a9('0x2b')]:undefined,'callbackat':_0x4a2c35[_0xd3a9('0x2b')]?moment()['format'](_0xd3a9('0x1c')):undefined,'CampaignId':_0x5591b2['id']})[_0xd3a9('0x2f')](_0x184229());}}}});})[_0xd3a9('0x20')](function(){return _0x21234f[_0xd3a9('0x30')][_0xd3a9('0x36')]({'attributes':['id'],'include':[{'model':_0x21234f['CmList'],'as':'BlackLists','where':{'id':_0x4a2c35[_0xd3a9('0x29')]}}]})[_0xd3a9('0x20')](function(_0x2e5006){if(_0x2e5006){var _0x59952b=[];for(var _0x3b7503=0x0,_0x40e97e;_0x3b7503<_0x2e5006['length'];_0x3b7503+=0x1){_0x40e97e=_0x2e5006[_0x3b7503]['get']({'plain':!![]});_0x21234f['CmHopperBlack'][_0xd3a9('0x28')]({'phone':_0x4a2c35[_0xd3a9('0xe')],'ContactId':_0x4a2c35['id'],'ListId':_0x4a2c35[_0xd3a9('0x29')],'CampaignId':_0x40e97e['id']})[_0xd3a9('0x2f')](function(_0x1e4552){logger[_0xd3a9('0x17')](_0xd3a9('0x3e'),'afterCreate',_0x1e4552['message']);});}}});})['then'](function(){_0x47ef88();})[_0xd3a9('0x2f')](function(_0x5194fe){logger['error'](_0xd3a9('0x3e'),_0xd3a9('0x19'),_0x5194fe[_0xd3a9('0x3f')]);_0x47ef88(_0x5194fe);});}else{_0x47ef88(new Error(_0xd3a9('0x43')));}},'afterDestroy':function(_0x10b8af,_0x740c0,_0x32c389){var _0x19c014=_0x2ae308[_0xd3a9('0x44')];var _0x572ff8=_0x10b8af['get']({'plain':!![]});return _0x19c014[_0xd3a9('0x26')][_0xd3a9('0x36')]({'raw':!![],'where':{'ListId':_0x572ff8[_0xd3a9('0x29')],'ContactId':_0x572ff8['id']}})[_0xd3a9('0x20')](function(_0x535869){if(!_[_0xd3a9('0x45')](_0x535869)){var _0x347aae=[];for(var _0x4d6783=0x0;_0x4d6783<_0x535869['length'];_0x4d6783+=0x1){var _0x163786=_0x19c014[_0xd3a9('0x26')]['destroy']({'where':{'ListId':_0x535869[_0x4d6783][_0xd3a9('0x29')],'ContactId':_0x535869[_0x4d6783][_0xd3a9('0x46')],'VoiceQueueId':_0x535869[_0x4d6783][_0xd3a9('0x47')],'CampaignId':_0x535869[_0x4d6783][_0xd3a9('0x48')]}});_0x347aae['push'](_0x163786);}return BPromise[_0xd3a9('0x49')](_0x347aae);}})['then'](function(_0x1fce22){logger[_0xd3a9('0x4a')](_0xd3a9('0x4b'),util['inspect'](_0x1fce22,{'showHidden':![],'depth':null}));_0x32c389();})['catch'](function(_0x40003a){logger[_0xd3a9('0x17')](_0xd3a9('0x4c'),util[_0xd3a9('0x1a')](_0x40003a,{'showHidden':![],'depth':null}));_0x32c389(_0x40003a);});}}});}; \ No newline at end of file +var _0xc7e1=['ContactId','push','all','info','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','../../config/environment/shared','exports','define','CmContact','cm_contacts','phone','fti_cm_contacts','firstName','lastName','fax','email','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','models','get','error','cmContact','afterCreate','scheduledat','isNil','dialTimezone','VoiceQueue','utcOffset','add','minutes','format','YYYY-MM-DD\x20HH:mm:ss','then','ret','CmHopper','findOne','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','create','priority','callbackUniqueid','catch','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal','cmContact,\x20afterCreate,\x20','ListId','inspect','Campaign','timezones','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','findAll','dialCheckDuplicateType','Lists','length','onlyIfOpen','outbound','CmList','BlackLists','always','CmHopperBlack','cmContact,\x20%s,\x20%s','message','List\x20not\x20found','isEmpty','destroy'];(function(_0x1414b9,_0x2f5fd5){var _0x52fac3=function(_0x29bda7){while(--_0x29bda7){_0x1414b9['push'](_0x1414b9['shift']());}};_0x52fac3(++_0x2f5fd5);}(_0xc7e1,0x136));var _0x1c7e=function(_0x3733e0,_0x1f0d95){_0x3733e0=_0x3733e0-0x0;var _0x2461a9=_0xc7e1[_0x3733e0];return _0x2461a9;};'use strict';var _=require(_0x1c7e('0x0'));var util=require(_0x1c7e('0x1'));var logger=require(_0x1c7e('0x2'))(_0x1c7e('0x3'));var moment=require(_0x1c7e('0x4'));var BPromise=require(_0x1c7e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1c7e('0x6'));var config=require(_0x1c7e('0x7'));var shared=require(_0x1c7e('0x8'));var attributes=require('./cmContact.attributes');module[_0x1c7e('0x9')]=function(_0x31ee6e,_0x3b93da){return _0x31ee6e[_0x1c7e('0xa')](_0x1c7e('0xb'),attributes,{'tableName':_0x1c7e('0xc'),'paranoid':!![],'indexes':[{'name':_0x1c7e('0xd'),'fields':['phone']},{'name':_0x1c7e('0xe'),'fields':[_0x1c7e('0xf'),_0x1c7e('0x10'),_0x1c7e('0xd'),'mobile',_0x1c7e('0x11'),_0x1c7e('0x12')],'type':_0x1c7e('0x13')}],'timestamps':!![],'charset':_0x1c7e('0x14'),'collate':_0x1c7e('0x15'),'hooks':{'afterCreate':function(_0x6c3d0d,_0x19a4b6,_0x2e26bd){var _0x3375a7=_0x31ee6e[_0x1c7e('0x16')];var _0x43fa16=_0x6c3d0d[_0x1c7e('0x17')]({'plain':!![]});function _0x8e5498(){return function(_0x139ccf){logger[_0x1c7e('0x18')](_0x1c7e('0x19'),_0x1c7e('0x1a'),util['inspect'](_0x139ccf,{'showHidden':![],'depth':null}));};}function _0x223249(_0x8609e3,_0x1f69ee){var _0x112ddf=_0x1f69ee['scheduledat']?_0x1f69ee[_0x1c7e('0x1b')]:moment()['format']('YYYY-MM-DD\x20HH:mm:ss');return new BPromise(function(_0x514049,_0x4ec8a9){if(_[_0x1c7e('0x1c')](_0x1f69ee[_0x1c7e('0x1d')])){_0x514049({'ret':_0x112ddf});}else{_0x3375a7[_0x1c7e('0x1e')]['findOne']({'where':{'id':_0x8609e3['id']}})['then'](function(_0x4ff626){if(!_['isNil'](_0x4ff626)){var _0xdb332a=_0x4ff626['dialTimezone'];if(!_['isNil'](_0xdb332a)){var _0xad21cc=shared['timezones'];var _0xa1f80e=_0xad21cc[_0xdb332a];var _0x27ba7a=_0xad21cc[_0x1f69ee['dialTimezone']];if(!_[_0x1c7e('0x1c')](_0xa1f80e)&&!_[_0x1c7e('0x1c')](_0x27ba7a)){var _0x495ca4=_0xa1f80e[_0x1c7e('0x1f')]-_0x27ba7a[_0x1c7e('0x1f')];_0x112ddf=_0x1f69ee['scheduledat']?_0x1f69ee[_0x1c7e('0x1b')]:moment();var _0x34ddaf=moment(_0x112ddf)[_0x1c7e('0x20')](_0x495ca4,_0x1c7e('0x21'));_0x514049({'ret':_0x34ddaf[_0x1c7e('0x22')](_0x1c7e('0x23'))});}else _0x514049({'ret':_0x112ddf});}else _0x514049({'ret':_0x112ddf});}else{_0x514049({'ret':_0x112ddf});}});}});return 0xa;}var _0x282c76=function(_0x5e2585){return new BPromise(function(_0x36a634,_0x4e8e9a){_0x223249(_0x5e2585,_0x43fa16)[_0x1c7e('0x24')](function(_0x3173d5){_0x43fa16[_0x1c7e('0x1b')]=_0x3173d5[_0x1c7e('0x25')];_0x3375a7[_0x1c7e('0x26')][_0x1c7e('0x27')]({'where':{'phone':_0x43fa16[_0x1c7e('0xd')],'VoiceQueueId':_0x5e2585['id']}})[_0x1c7e('0x24')](function(_0x5a4ee4){if(!_[_0x1c7e('0x1c')](_0x5a4ee4)){throw new Error(_0x1c7e('0x28')+_0x43fa16[_0x1c7e('0xd')]+_0x1c7e('0x29')+_0x5e2585['id']);}return _0x3375a7[_0x1c7e('0x26')][_0x1c7e('0x2a')]({'phone':_0x43fa16['phone'],'ContactId':_0x43fa16['id'],'ListId':_0x43fa16['ListId'],'priority':_0x43fa16[_0x1c7e('0x2b')]?_0x43fa16[_0x1c7e('0x2b')]:0x2,'scheduledat':_0x43fa16[_0x1c7e('0x1b')]?_0x43fa16[_0x1c7e('0x1b')]:moment()['format'](_0x1c7e('0x23')),'callback':_0x43fa16[_0x1c7e('0x2c')]?!![]:![],'callbackuniqueid':_0x43fa16[_0x1c7e('0x2c')]?_0x43fa16[_0x1c7e('0x2c')]:undefined,'callbackat':_0x43fa16[_0x1c7e('0x2c')]?moment()[_0x1c7e('0x22')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x5e2585['id']});})[_0x1c7e('0x2d')](function(_0x537b9c){_0x4e8e9a(_0x537b9c);});});});};var _0x589851=function(_0x3b15db){return new BPromise(function(_0x16c6a0,_0x14019e){_0x223249(_0x3b15db,_0x43fa16)[_0x1c7e('0x24')](function(_0x51fc1c){_0x43fa16[_0x1c7e('0x1b')]=_0x51fc1c[_0x1c7e('0x25')];_0x3375a7[_0x1c7e('0x26')][_0x1c7e('0x27')]({'where':{'phone':_0x43fa16[_0x1c7e('0xd')],'VoiceQueueId':_0x3b15db['id']}})[_0x1c7e('0x24')](function(_0x463a96){if(!_[_0x1c7e('0x1c')](_0x463a96)){throw new Error(_0x1c7e('0x28')+_0x43fa16[_0x1c7e('0xd')]+_0x1c7e('0x2e')+_0x3b15db['id']);}return _0x3375a7[_0x1c7e('0x2f')][_0x1c7e('0x27')]({'where':{'calleridnum':_0x43fa16[_0x1c7e('0xd')],'VoiceQueueId':_0x3b15db['id']}});})[_0x1c7e('0x24')](function(_0xd09a35){if(!_[_0x1c7e('0x1c')](_0xd09a35)){throw new Error(_0x1c7e('0x30')+_0x43fa16[_0x1c7e('0xd')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20'+_0x3b15db['id']);}return _0x3375a7['CmHopper']['create']({'phone':_0x43fa16['phone'],'ContactId':_0x43fa16['id'],'ListId':_0x43fa16[_0x1c7e('0x31')],'priority':_0x43fa16[_0x1c7e('0x2b')]?_0x43fa16['priority']:0x2,'scheduledat':_0x43fa16[_0x1c7e('0x1b')]?_0x43fa16[_0x1c7e('0x1b')]:moment()['format'](_0x1c7e('0x23')),'callback':_0x43fa16[_0x1c7e('0x2c')]?!![]:![],'callbackuniqueid':_0x43fa16[_0x1c7e('0x2c')]?_0x43fa16[_0x1c7e('0x2c')]:undefined,'callbackat':_0x43fa16['callbackUniqueid']?moment()[_0x1c7e('0x22')](_0x1c7e('0x23')):undefined,'VoiceQueueId':_0x3b15db['id']});})[_0x1c7e('0x2d')](function(_0x189a6f){_0x14019e(_0x189a6f);});});});};function _0x3ac6ab(){return function(_0x51933b){logger[_0x1c7e('0x18')](_0x1c7e('0x19'),_0x1c7e('0x1a'),util[_0x1c7e('0x32')](_0x51933b,{'showHidden':![],'depth':null}));};}function _0x28b1f7(_0x3bf81f,_0x1a5d7e){var _0x3cf0ba=_0x1a5d7e[_0x1c7e('0x1b')]?_0x1a5d7e[_0x1c7e('0x1b')]:moment()[_0x1c7e('0x22')]('YYYY-MM-DD\x20HH:mm:ss');return new BPromise(function(_0x2fe4d2,_0x3922ec){if(_[_0x1c7e('0x1c')](_0x1a5d7e[_0x1c7e('0x1d')])){_0x2fe4d2({'ret':_0x3cf0ba});}else{_0x3375a7[_0x1c7e('0x33')][_0x1c7e('0x27')]({'where':{'id':_0x3bf81f['id']}})[_0x1c7e('0x24')](function(_0x372f6d){if(!_[_0x1c7e('0x1c')](_0x372f6d)){var _0x5cc23f=_0x372f6d[_0x1c7e('0x1d')];if(!_[_0x1c7e('0x1c')](_0x5cc23f)){var _0x17a214=shared[_0x1c7e('0x34')];var _0x12d782=_0x17a214[_0x5cc23f];var _0x1b102f=_0x17a214[_0x1a5d7e[_0x1c7e('0x1d')]];if(!_['isNil'](_0x12d782)&&!_[_0x1c7e('0x1c')](_0x1b102f)){var _0xd1cf73=_0x12d782['utcOffset']-_0x1b102f[_0x1c7e('0x1f')];_0x3cf0ba=_0x1a5d7e['scheduledat']?_0x1a5d7e[_0x1c7e('0x1b')]:moment();var _0x30a2fe=moment(_0x3cf0ba)[_0x1c7e('0x20')](_0xd1cf73,_0x1c7e('0x21'));_0x2fe4d2({'ret':_0x30a2fe[_0x1c7e('0x22')](_0x1c7e('0x23'))});}else _0x2fe4d2({'ret':_0x3cf0ba});}else _0x2fe4d2({'ret':_0x3cf0ba});}else{_0x2fe4d2({'ret':_0x3cf0ba});}});}});return 0xa;}var _0x2a29db=function(_0x5c0f0d){return new BPromise(function(_0x13cf29,_0x427e73){_0x28b1f7(_0x5c0f0d,_0x43fa16)[_0x1c7e('0x24')](function(_0x1cd9ac){_0x43fa16[_0x1c7e('0x1b')]=_0x1cd9ac[_0x1c7e('0x25')];_0x3375a7[_0x1c7e('0x26')][_0x1c7e('0x27')]({'where':{'phone':_0x43fa16[_0x1c7e('0xd')],'CampaignId':_0x5c0f0d['id']}})[_0x1c7e('0x24')](function(_0x1bfed4){if(!_[_0x1c7e('0x1c')](_0x1bfed4)){throw new Error(_0x1c7e('0x28')+_0x43fa16[_0x1c7e('0xd')]+_0x1c7e('0x35')+_0x5c0f0d['id']);}return _0x3375a7[_0x1c7e('0x26')][_0x1c7e('0x2a')]({'phone':_0x43fa16['phone'],'ContactId':_0x43fa16['id'],'ListId':_0x43fa16[_0x1c7e('0x31')],'priority':_0x43fa16[_0x1c7e('0x2b')]?_0x43fa16[_0x1c7e('0x2b')]:0x2,'scheduledat':_0x43fa16['scheduledat']?_0x43fa16['scheduledat']:moment()[_0x1c7e('0x22')](_0x1c7e('0x23')),'callback':_0x43fa16[_0x1c7e('0x2c')]?!![]:![],'callbackuniqueid':_0x43fa16[_0x1c7e('0x2c')]?_0x43fa16['callbackUniqueid']:undefined,'callbackat':_0x43fa16[_0x1c7e('0x2c')]?moment()[_0x1c7e('0x22')](_0x1c7e('0x23')):undefined,'CampaignId':_0x5c0f0d['id']});})['catch'](function(_0x74dc21){_0x427e73(_0x74dc21);});});});};var _0x1b1175=function(_0x58cd72){return new BPromise(function(_0x457734,_0x228a15){_0x28b1f7(_0x58cd72,_0x43fa16)[_0x1c7e('0x24')](function(_0x4184a6){_0x43fa16['scheduledat']=_0x4184a6['ret'];_0x3375a7[_0x1c7e('0x26')]['findOne']({'where':{'phone':_0x43fa16[_0x1c7e('0xd')],'CampaignId':_0x58cd72['id']}})[_0x1c7e('0x24')](function(_0x40a46c){if(!_[_0x1c7e('0x1c')](_0x40a46c)){throw new Error(_0x1c7e('0x28')+_0x43fa16[_0x1c7e('0xd')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20'+_0x58cd72['id']);}return _0x3375a7['CmHopperFinal'][_0x1c7e('0x27')]({'where':{'calleridnum':_0x43fa16['phone'],'CampaignId':_0x58cd72['id']}});})[_0x1c7e('0x24')](function(_0x389fdb){if(!_[_0x1c7e('0x1c')](_0x389fdb)){throw new Error(_0x1c7e('0x30')+_0x43fa16[_0x1c7e('0xd')]+_0x1c7e('0x36')+_0x58cd72['id']);}return _0x3375a7['CmHopper']['create']({'phone':_0x43fa16[_0x1c7e('0xd')],'ContactId':_0x43fa16['id'],'ListId':_0x43fa16[_0x1c7e('0x31')],'priority':_0x43fa16[_0x1c7e('0x2b')]?_0x43fa16[_0x1c7e('0x2b')]:0x2,'scheduledat':_0x43fa16[_0x1c7e('0x1b')]?_0x43fa16[_0x1c7e('0x1b')]:moment()['format'](_0x1c7e('0x23')),'callback':_0x43fa16['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x43fa16['callbackUniqueid']?_0x43fa16['callbackUniqueid']:undefined,'callbackat':_0x43fa16['callbackUniqueid']?moment()[_0x1c7e('0x22')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x58cd72['id']});})[_0x1c7e('0x2d')](function(_0x4bd535){_0x228a15(_0x4bd535);});});});};if(_0x43fa16[_0x1c7e('0x31')]){_0x3375a7['VoiceQueue'][_0x1c7e('0x37')]({'where':{'type':'outbound'},'attributes':['id',_0x1c7e('0x38'),_0x1c7e('0x1d')],'include':[{'model':_0x3375a7['CmList'],'as':_0x1c7e('0x39'),'where':{'id':_0x43fa16[_0x1c7e('0x31')]}}]})[_0x1c7e('0x24')](function(_0x367fbc){if(_0x367fbc){var _0x45c584=[];for(var _0x5b0d4e=0x0,_0xfa8c08;_0x5b0d4e<_0x367fbc[_0x1c7e('0x3a')];_0x5b0d4e+=0x1){_0xfa8c08=_0x367fbc[_0x5b0d4e][_0x1c7e('0x17')]({'plain':!![]});switch(_0xfa8c08['dialCheckDuplicateType']){case'always':_0x589851(_0xfa8c08)[_0x1c7e('0x2d')](_0x8e5498());break;case _0x1c7e('0x3b'):_0x282c76(_0xfa8c08)[_0x1c7e('0x2d')](_0x8e5498());break;default:_0x28b1f7(_0xfa8c08,_0x43fa16)[_0x1c7e('0x24')](function(_0x189814){_0x43fa16['scheduledat']=_0x189814[_0x1c7e('0x25')];_0x3375a7['CmHopper']['create']({'phone':_0x43fa16[_0x1c7e('0xd')],'ContactId':_0x43fa16['id'],'ListId':_0x43fa16['ListId'],'scheduledat':_0x43fa16[_0x1c7e('0x1b')]?_0x43fa16[_0x1c7e('0x1b')]:moment()[_0x1c7e('0x22')](_0x1c7e('0x23')),'priority':_0x43fa16['priority']?_0x43fa16[_0x1c7e('0x2b')]:0x2,'callback':_0x43fa16[_0x1c7e('0x2c')]?!![]:![],'callbackuniqueid':_0x43fa16['callbackUniqueid']?_0x43fa16[_0x1c7e('0x2c')]:undefined,'callbackat':_0x43fa16[_0x1c7e('0x2c')]?moment()[_0x1c7e('0x22')](_0x1c7e('0x23')):undefined,'VoiceQueueId':_0xfa8c08['id']})[_0x1c7e('0x2d')](_0x8e5498());});}}}})[_0x1c7e('0x24')](function(){return _0x3375a7[_0x1c7e('0x1e')][_0x1c7e('0x37')]({'where':{'type':_0x1c7e('0x3c')},'attributes':['id'],'include':[{'model':_0x3375a7[_0x1c7e('0x3d')],'as':_0x1c7e('0x3e'),'where':{'id':_0x43fa16[_0x1c7e('0x31')]}}]})[_0x1c7e('0x24')](function(_0x3cd3e){if(_0x3cd3e){var _0x21e089=[];for(var _0x1ed654=0x0,_0xe3fc03;_0x1ed654<_0x3cd3e[_0x1c7e('0x3a')];_0x1ed654+=0x1){_0xe3fc03=_0x3cd3e[_0x1ed654][_0x1c7e('0x17')]({'plain':!![]});_0x3375a7['CmHopperBlack'][_0x1c7e('0x2a')]({'phone':_0x43fa16['phone'],'ContactId':_0x43fa16['id'],'ListId':_0x43fa16[_0x1c7e('0x31')],'VoiceQueueId':_0xe3fc03['id']})['catch'](function(_0x472b4a){logger[_0x1c7e('0x18')]('cmContact,\x20%s,\x20%s','afterCreate',_0x472b4a['message']);});}}});})[_0x1c7e('0x24')](function(){return _0x3375a7['Campaign'][_0x1c7e('0x37')]({'attributes':['id',_0x1c7e('0x38'),_0x1c7e('0x1d')],'include':[{'model':_0x3375a7[_0x1c7e('0x3d')],'as':_0x1c7e('0x39'),'where':{'id':_0x43fa16[_0x1c7e('0x31')]}}]})[_0x1c7e('0x24')](function(_0x3520a5){if(_0x3520a5){var _0x360419=[];for(var _0x2e4df6=0x0,_0x426b12;_0x2e4df6<_0x3520a5[_0x1c7e('0x3a')];_0x2e4df6+=0x1){_0x426b12=_0x3520a5[_0x2e4df6][_0x1c7e('0x17')]({'plain':!![]});switch(_0x426b12[_0x1c7e('0x38')]){case _0x1c7e('0x3f'):_0x1b1175(_0x426b12)[_0x1c7e('0x2d')](_0x3ac6ab());break;case _0x1c7e('0x3b'):_0x2a29db(_0x426b12)['catch'](_0x3ac6ab());break;default:_0x3375a7[_0x1c7e('0x26')][_0x1c7e('0x2a')]({'phone':_0x43fa16['phone'],'ContactId':_0x43fa16['id'],'ListId':_0x43fa16['ListId'],'scheduledat':_0x43fa16['scheduledat']?_0x43fa16['scheduledat']:moment()[_0x1c7e('0x22')](_0x1c7e('0x23')),'priority':_0x43fa16[_0x1c7e('0x2b')]?_0x43fa16['priority']:0x2,'callback':_0x43fa16[_0x1c7e('0x2c')]?!![]:![],'callbackuniqueid':_0x43fa16[_0x1c7e('0x2c')]?_0x43fa16[_0x1c7e('0x2c')]:undefined,'callbackat':_0x43fa16[_0x1c7e('0x2c')]?moment()[_0x1c7e('0x22')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x426b12['id']})[_0x1c7e('0x2d')](_0x3ac6ab());}}}});})['then'](function(){return _0x3375a7[_0x1c7e('0x33')][_0x1c7e('0x37')]({'attributes':['id'],'include':[{'model':_0x3375a7[_0x1c7e('0x3d')],'as':_0x1c7e('0x3e'),'where':{'id':_0x43fa16[_0x1c7e('0x31')]}}]})[_0x1c7e('0x24')](function(_0x1ba056){if(_0x1ba056){var _0x545c57=[];for(var _0x270d69=0x0,_0x5ba602;_0x270d69<_0x1ba056[_0x1c7e('0x3a')];_0x270d69+=0x1){_0x5ba602=_0x1ba056[_0x270d69][_0x1c7e('0x17')]({'plain':!![]});_0x3375a7[_0x1c7e('0x40')]['create']({'phone':_0x43fa16[_0x1c7e('0xd')],'ContactId':_0x43fa16['id'],'ListId':_0x43fa16['ListId'],'CampaignId':_0x5ba602['id']})[_0x1c7e('0x2d')](function(_0x21860a){logger[_0x1c7e('0x18')](_0x1c7e('0x41'),_0x1c7e('0x1a'),_0x21860a['message']);});}}});})['then'](function(){_0x2e26bd();})[_0x1c7e('0x2d')](function(_0x4f5b5d){logger[_0x1c7e('0x18')](_0x1c7e('0x41'),'afterCreate',_0x4f5b5d[_0x1c7e('0x42')]);_0x2e26bd(_0x4f5b5d);});}else{_0x2e26bd(new Error(_0x1c7e('0x43')));}},'afterDestroy':function(_0x13d079,_0x4663b8,_0x6905e){var _0x9d6abd=_0x31ee6e[_0x1c7e('0x16')];var _0xa7375=_0x13d079[_0x1c7e('0x17')]({'plain':!![]});return _0x9d6abd[_0x1c7e('0x26')][_0x1c7e('0x37')]({'raw':!![],'where':{'ListId':_0xa7375[_0x1c7e('0x31')],'ContactId':_0xa7375['id']}})[_0x1c7e('0x24')](function(_0x4954d8){if(!_[_0x1c7e('0x44')](_0x4954d8)){var _0x17b424=[];for(var _0x37132a=0x0;_0x37132a<_0x4954d8[_0x1c7e('0x3a')];_0x37132a+=0x1){var _0x10dc02=_0x9d6abd['CmHopper'][_0x1c7e('0x45')]({'where':{'ListId':_0x4954d8[_0x37132a][_0x1c7e('0x31')],'ContactId':_0x4954d8[_0x37132a][_0x1c7e('0x46')],'VoiceQueueId':_0x4954d8[_0x37132a]['VoiceQueueId'],'CampaignId':_0x4954d8[_0x37132a]['CampaignId']}});_0x17b424[_0x1c7e('0x47')](_0x10dc02);}return BPromise[_0x1c7e('0x48')](_0x17b424);}})[_0x1c7e('0x24')](function(_0x437f86){logger[_0x1c7e('0x49')](_0x1c7e('0x4a'),util['inspect'](_0x437f86,{'showHidden':![],'depth':null}));_0x6905e();})['catch'](function(_0x476cf9){logger[_0x1c7e('0x18')](_0x1c7e('0x4b'),util[_0x1c7e('0x32')](_0x476cf9,{'showHidden':![],'depth':null}));_0x6905e(_0x476cf9);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index 81a521f..1705669 100644 --- a/server/api/cmContact/cmContact.rpc.js +++ b/server/api/cmContact/cmContact.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['phone','ListId','Contact','CmContactId','create','body','keys','length','startsWith','update','table','cm_contacts','id\x20=\x20?','sequelize','query','CreateCmContact','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./cmContact.socket','register','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetCmContact','CmContact','findAll','options','where','limit','include','map','model','attributes','then','stringify','CmContactHasItem','find'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'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 squel=require('squel');var db=require(_0x0a9e('0x4'))['db'];var utils=require(_0x0a9e('0x5'));var logger=require(_0x0a9e('0x6'))(_0x0a9e('0x7'));var config=require(_0x0a9e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0a9e('0x9')][_0x0a9e('0xa')]({'port':0x232a});config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithRpcPromise(_0x307b3e,_0x3ab53f,_0xfeb75b){return new BPromise(function(_0xbd1168,_0x4a4c56){return client['request'](_0x307b3e,_0xfeb75b)['then'](function(_0x4cfe67){logger[_0x0a9e('0xf')](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));logger[_0x0a9e('0x12')](_0x0a9e('0x13'),_0x3ab53f,_0x0a9e('0x11'),JSON['stringify'](_0x4cfe67));if(_0x4cfe67[_0x0a9e('0x14')]){if(_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x15')]===0x1f4){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')]['message']);return _0x4a4c56(_0x4cfe67[_0x0a9e('0x14')]['message']);}logger[_0x0a9e('0x14')]('CmContact,\x20%s,\x20%s',_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x16')]);return _0xbd1168(_0x4cfe67['error'][_0x0a9e('0x16')]);}else{logger['info'](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));_0xbd1168(_0x4cfe67[_0x0a9e('0x17')][_0x0a9e('0x16')]);}})[_0x0a9e('0x18')](function(_0x2eb11f){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x2eb11f);_0x4a4c56(_0x2eb11f);});});}exports[_0x0a9e('0x19')]=function(_0x112016){var _0x1c696a=this;return new Promise(function(_0x105080,_0x4bb1e3){return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':_0x112016['options']?_0x112016[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x112016['options']?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')]||null:null,'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')]['attributes']||null:null,'limit':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1e')]||null:null,'include':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x112016['options']['include'],function(_0x197ec0){return{'model':db[_0x197ec0[_0x0a9e('0x21')]],'as':_0x197ec0['as'],'attributes':_0x197ec0[_0x0a9e('0x22')],'include':_0x197ec0[_0x0a9e('0x1f')]?_['map'](_0x197ec0[_0x0a9e('0x1f')],function(_0x479bc4){return{'model':db[_0x479bc4[_0x0a9e('0x21')]],'as':_0x479bc4['as'],'attributes':_0x479bc4['attributes'],'include':_0x479bc4[_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x479bc4[_0x0a9e('0x1f')],function(_0x14433c){return{'model':db[_0x14433c[_0x0a9e('0x21')]],'as':_0x14433c['as'],'attributes':_0x14433c[_0x0a9e('0x22')]};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x23')](function(_0x14de77){logger['info'](_0x0a9e('0x19'),_0x112016);logger[_0x0a9e('0x12')](_0x0a9e('0x19'),_0x112016,JSON[_0x0a9e('0x24')](_0x14de77));if(_0x14de77['length']==0x0){return db[_0x0a9e('0x25')][_0x0a9e('0x26')]({'raw':!![],'where':{'item':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x27')]},'include':[{'model':db[_0x0a9e('0x1a')],'where':{'ListId':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')][_0x0a9e('0x28')],'deletedAt':{'$eq':null}},'as':_0x0a9e('0x29')}]})['then'](function(_0x426950){if(_['isNil'](_0x426950)){_0x105080(_0x14de77);}else{var _0x2407f9=_0x426950[_0x0a9e('0x2a')];return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':!![],'where':{'id':_0x2407f9},'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016['options'][_0x0a9e('0x22')]||null:null})[_0x0a9e('0x23')](function(_0x40cb85){_0x105080(_0x40cb85);});}});}else{_0x105080(_0x14de77);}})[_0x0a9e('0x18')](function(_0x2b45ea){logger[_0x0a9e('0x14')](_0x0a9e('0x19'),_0x2b45ea[_0x0a9e('0x16')],_0x112016);_0x4bb1e3(_0x1c696a['error'](0x1f4,_0x2b45ea[_0x0a9e('0x16')]));});});};exports['CreateCmContact']=function(_0x2cc7a0){var _0x14b13f=this;return new Promise(function(_0x2b7e7f,_0x3f3d41){return db['CmContact'][_0x0a9e('0x2b')](_0x2cc7a0[_0x0a9e('0x2c')],{'raw':_0x2cc7a0[_0x0a9e('0x1c')]?_0x2cc7a0[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1e8694){var _0x5640eb;for(var _0x24936a=0x0;_0x24936a{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file +var _0xa9e0=['basename','extname','now','/csv','single','file','uploadCsv','%s-%s%s','upload','/upload/:id','import','put','/:id','update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','index','/describe','show','/:id/tags','isAuthenticated','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','post','create','/create_many','bulkCreate','setTags','setAdditionalPhones','/:id/duplicateAdditionalPhones','/:id/rescheduleAdditionalPhones','rescheduleAdditionalPhones','join','root','server/files/tmp','originalname','replace','format'];(function(_0x42ea87,_0x47099e){var _0x4850a3=function(_0x27ac39){while(--_0x27ac39){_0x42ea87['push'](_0x42ea87['shift']());}};_0x4850a3(++_0x47099e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/phones',auth['isAuthenticated'](),controller['getAdditionalPhones']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getHopperHistories']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x18')]('/merge',auth[_0x0a9e('0xd')](),controller['merge']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/phones',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x1e'),auth['isAuthenticated'](),controller['duplicateAdditionalPhones']);router[_0x0a9e('0x18')](_0x0a9e('0x1f'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xfb6e48,_0x2fb0e4,_0x3b45bc){_0x3b45bc(null,path[_0x0a9e('0x21')](config[_0x0a9e('0x22')],_0x0a9e('0x23')));},'filename':function(_0x16b1ca,_0x5ea472,_0x59181e){_0x5ea472[_0x0a9e('0x24')]=_0x5ea472[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.attributes.js b/server/api/cmContactHasItem/cmContactHasItem.attributes.js index 95ae4ee..c3e8f80 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.attributes.js +++ b/server/api/cmContactHasItem/cmContactHasItem.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4944=['PHONE','sequelize','INTEGER','STRING'];(function(_0x51e378,_0xcd323d){var _0x5f1926=function(_0x4f22dc){while(--_0x4f22dc){_0x51e378['push'](_0x51e378['shift']());}};_0x5f1926(++_0xcd323d);}(_0x4944,0x6d));var _0x4494=function(_0x493e8f,_0x127f30){_0x493e8f=_0x493e8f-0x0;var _0x2b46b0=_0x4944[_0x493e8f];return _0x2b46b0;};'use strict';var Sequelize=require(_0x4494('0x0'));module['exports']={'CmContactId':{'type':Sequelize[_0x4494('0x1')],'primaryKey':!![]},'item':{'type':Sequelize[_0x4494('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x4494('0x1')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x4494('0x2')],'defaultValue':_0x4494('0x3')},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':null},'description':{'type':Sequelize[_0x4494('0x2')],'defaultValue':null}}; \ No newline at end of file +var _0x3667=['sequelize','exports','INTEGER','STRING','PHONE'];(function(_0x2bdaf4,_0x48c891){var _0x2dbeec=function(_0x1894a0){while(--_0x1894a0){_0x2bdaf4['push'](_0x2bdaf4['shift']());}};_0x2dbeec(++_0x48c891);}(_0x3667,0xcd));var _0x7366=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3667[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x7366('0x0'));module[_0x7366('0x1')]={'CmContactId':{'type':Sequelize[_0x7366('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0x7366('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x7366('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize['STRING'],'defaultValue':_0x7366('0x4')},'OrderBy':{'type':Sequelize[_0x7366('0x2')],'defaultValue':null},'description':{'type':Sequelize['STRING'],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.controller.js b/server/api/cmContactHasItem/cmContactHasItem.controller.js index 33ef777..f3cfc36 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.controller.js +++ b/server/api/cmContactHasItem/cmContactHasItem.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5a21=['mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','apply','reject','update','then','get','destroy','error','send','index','map','CmContactHasItem','rawAttributes','fieldName','type','name','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format'];(function(_0x5b6d90,_0x433d49){var _0x867b01=function(_0x3edbfe){while(--_0x3edbfe){_0x5b6d90['push'](_0x5b6d90['shift']());}};_0x867b01(++_0x433d49);}(_0x5a21,0x1d3));var _0x15a2=function(_0xce755b,_0x58fb87){_0xce755b=_0xce755b-0x0;var _0x30d6da=_0x5a21[_0xce755b];return _0x30d6da;};'use strict';var emlformat=require(_0x15a2('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x15a2('0x1'));var util=require(_0x15a2('0x2'));var path=require(_0x15a2('0x3'));var sox=require('sox');var csv=require(_0x15a2('0x4'));var ejs=require(_0x15a2('0x5'));var fs=require('fs');var fs_extra=require(_0x15a2('0x6'));var _=require(_0x15a2('0x7'));var squel=require(_0x15a2('0x8'));var crypto=require('crypto');var jsforce=require(_0x15a2('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x15a2('0x4'));var querystring=require(_0x15a2('0xa'));var Papa=require(_0x15a2('0xb'));var Redis=require(_0x15a2('0xc'));var authService=require(_0x15a2('0xd'));var qs=require(_0x15a2('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x15a2('0xf'));var logger=require(_0x15a2('0x10'))(_0x15a2('0x11'));var utils=require(_0x15a2('0x12'));var config=require(_0x15a2('0x13'));var licenseUtil=require(_0x15a2('0x14'));var db=require(_0x15a2('0x15'))['db'];function respondWithStatusCode(_0x41dc3a,_0x30f05c){_0x30f05c=_0x30f05c||0xcc;return function(_0x32718a){if(_0x32718a){return _0x41dc3a[_0x15a2('0x16')](_0x30f05c);}return _0x41dc3a['status'](_0x30f05c)[_0x15a2('0x17')]();};}function respondWithResult(_0x1dd3a1,_0x109853){_0x109853=_0x109853||0xc8;return function(_0x220ebd){if(_0x220ebd){return _0x1dd3a1['status'](_0x109853)[_0x15a2('0x18')](_0x220ebd);}};}function respondWithFilteredResult(_0x4b4bc4,_0x5b149e){return function(_0x5f420d){if(_0x5f420d){var _0x3fd4d8=typeof _0x5b149e[_0x15a2('0x19')]===_0x15a2('0x1a')&&typeof _0x5b149e[_0x15a2('0x1b')]===_0x15a2('0x1a');var _0x5a7220=_0x5f420d[_0x15a2('0x1c')];var _0x59ad13=_0x3fd4d8?0x0:_0x5b149e[_0x15a2('0x19')];var _0x554775=_0x3fd4d8?_0x5f420d[_0x15a2('0x1c')]:_0x5b149e[_0x15a2('0x19')]+_0x5b149e[_0x15a2('0x1b')];var _0x509282;if(_0x554775>=_0x5a7220){_0x554775=_0x5a7220;_0x509282=0xc8;}else{_0x509282=0xce;}_0x4b4bc4[_0x15a2('0x1d')](_0x509282);return _0x4b4bc4[_0x15a2('0x1e')]('Content-Range',_0x59ad13+'-'+_0x554775+'/'+_0x5a7220)['json'](_0x5f420d);}return null;};}function patchUpdates(_0x43cda6){return function(_0xbbd14e){try{jsonpatch[_0x15a2('0x1f')](_0xbbd14e,_0x43cda6,!![]);}catch(_0x2ef674){return BPromise[_0x15a2('0x20')](_0x2ef674);}return _0xbbd14e['save']();};}function saveUpdates(_0x97cfdf,_0x24b256){return function(_0x32208e){if(_0x32208e){return _0x32208e[_0x15a2('0x21')](_0x97cfdf)[_0x15a2('0x22')](function(_0x5ba59c){return _0x5ba59c;});}return null;};}function removeEntity(_0x316d62,_0x503ade){return function(_0x4be442){if(_0x4be442){return _0x4be442['destroy']()['then'](function(){var _0x3a6e61=_0x4be442[_0x15a2('0x23')]({'plain':!![]});var _0x3711d2='CmContactHasItems';return db['UserProfileResource'][_0x15a2('0x24')]({'where':{'type':_0x3711d2,'resourceId':_0x3a6e61['id']}})[_0x15a2('0x22')](function(){return _0x4be442;});})['then'](function(){_0x316d62['status'](0xcc)[_0x15a2('0x17')]();});}};}function handleEntityNotFound(_0x19e15f,_0x275764){return function(_0x2e389c){if(!_0x2e389c){_0x19e15f[_0x15a2('0x16')](0x194);}return _0x2e389c;};}function handleError(_0x5034d5,_0x52cf96){_0x52cf96=_0x52cf96||0x1f4;return function(_0x274b77){logger[_0x15a2('0x25')](_0x274b77['stack']);if(_0x274b77['name']){delete _0x274b77['name'];}_0x5034d5[_0x15a2('0x1d')](_0x52cf96)[_0x15a2('0x26')](_0x274b77);};}exports[_0x15a2('0x27')]=function(_0x29ce9a,_0x3b4bbe){var _0xc89dc={},_0x1601a9={},_0x411e9f={'count':0x0,'rows':[]};var _0x4d87b8=_[_0x15a2('0x28')](db[_0x15a2('0x29')][_0x15a2('0x2a')],function(_0x29dee4){return{'name':_0x29dee4[_0x15a2('0x2b')],'type':_0x29dee4[_0x15a2('0x2c')]['key']};});_0x1601a9['model']=_[_0x15a2('0x28')](_0x4d87b8,_0x15a2('0x2d'));_0x1601a9[_0x15a2('0x2e')]=_[_0x15a2('0x2f')](_0x29ce9a['query']);_0x1601a9[_0x15a2('0x30')]=_[_0x15a2('0x31')](_0x1601a9[_0x15a2('0x32')],_0x1601a9['query']);_0xc89dc['attributes']=_[_0x15a2('0x31')](_0x1601a9['model'],qs[_0x15a2('0x33')](_0x29ce9a['query'][_0x15a2('0x33')]));_0xc89dc[_0x15a2('0x34')]=_0xc89dc[_0x15a2('0x34')]['length']?_0xc89dc[_0x15a2('0x34')]:_0x1601a9[_0x15a2('0x32')];if(!_0x29ce9a['query'][_0x15a2('0x35')](_0x15a2('0x36'))){_0xc89dc[_0x15a2('0x1b')]=qs[_0x15a2('0x1b')](_0x29ce9a[_0x15a2('0x2e')]['limit']);_0xc89dc[_0x15a2('0x19')]=qs['offset'](_0x29ce9a['query'][_0x15a2('0x19')]);}_0xc89dc[_0x15a2('0x37')]=qs['sort'](_0x29ce9a[_0x15a2('0x2e')]['sort']);_0xc89dc[_0x15a2('0x38')]=qs[_0x15a2('0x30')](_[_0x15a2('0x39')](_0x29ce9a[_0x15a2('0x2e')],_0x1601a9[_0x15a2('0x30')]),_0x4d87b8);if(_0x29ce9a['query'][_0x15a2('0x3a')]){_0xc89dc[_0x15a2('0x38')]=_['merge'](_0xc89dc[_0x15a2('0x38')],{'$or':_[_0x15a2('0x28')](_0x4d87b8,function(_0x2c87b8){if(_0x2c87b8[_0x15a2('0x2c')]!==_0x15a2('0x3b')){var _0x444a84={};_0x444a84[_0x2c87b8[_0x15a2('0x2d')]]={'$like':'%'+_0x29ce9a[_0x15a2('0x2e')][_0x15a2('0x3a')]+'%'};return _0x444a84;}})});}_0xc89dc=_[_0x15a2('0x3c')]({},_0xc89dc,_0x29ce9a['options']);var _0x2ba00e={'where':_0xc89dc[_0x15a2('0x38')]};return db[_0x15a2('0x29')][_0x15a2('0x1c')](_0x2ba00e)[_0x15a2('0x22')](function(_0x331043){_0x411e9f['count']=_0x331043;if(_0x29ce9a['query'][_0x15a2('0x3d')]){_0xc89dc[_0x15a2('0x3e')]=[{'all':!![]}];}return db[_0x15a2('0x29')][_0x15a2('0x3f')](_0xc89dc);})['then'](function(_0x15a0ad){_0x411e9f[_0x15a2('0x40')]=_0x15a0ad;return _0x411e9f;})[_0x15a2('0x22')](respondWithFilteredResult(_0x3b4bbe,_0xc89dc))[_0x15a2('0x41')](handleError(_0x3b4bbe,null));};exports[_0x15a2('0x42')]=function(_0x469590,_0x3e3876){var _0x527275={'raw':!![],'where':{'id':_0x469590['params']['id']}},_0x5ce7ce={};_0x5ce7ce[_0x15a2('0x32')]=_[_0x15a2('0x2f')](db[_0x15a2('0x29')][_0x15a2('0x2a')]);_0x5ce7ce['query']=_[_0x15a2('0x2f')](_0x469590[_0x15a2('0x2e')]);_0x5ce7ce['filters']=_[_0x15a2('0x31')](_0x5ce7ce[_0x15a2('0x32')],_0x5ce7ce['query']);_0x527275[_0x15a2('0x34')]=_[_0x15a2('0x31')](_0x5ce7ce[_0x15a2('0x32')],qs[_0x15a2('0x33')](_0x469590['query'][_0x15a2('0x33')]));_0x527275[_0x15a2('0x34')]=_0x527275['attributes']['length']?_0x527275[_0x15a2('0x34')]:_0x5ce7ce[_0x15a2('0x32')];if(_0x469590[_0x15a2('0x2e')][_0x15a2('0x3d')]){_0x527275[_0x15a2('0x3e')]=[{'all':!![]}];}_0x527275=_[_0x15a2('0x3c')]({},_0x527275,_0x469590[_0x15a2('0x43')]);return db['CmContactHasItem'][_0x15a2('0x44')](_0x527275)[_0x15a2('0x22')](handleEntityNotFound(_0x3e3876,null))[_0x15a2('0x22')](respondWithResult(_0x3e3876,null))['catch'](handleError(_0x3e3876,null));};exports[_0x15a2('0x45')]=function(_0x420bf7,_0x3e372a){return db[_0x15a2('0x29')][_0x15a2('0x45')](_0x420bf7[_0x15a2('0x46')],{})['then'](function(_0x1134b7){var _0x448bb6=_0x420bf7[_0x15a2('0x47')]['get']({'plain':!![]});if(!_0x448bb6)throw new Error(_0x15a2('0x48'));if(_0x448bb6[_0x15a2('0x49')]===_0x15a2('0x47')){var _0x9fe972=_0x1134b7[_0x15a2('0x23')]({'plain':!![]});var _0x4a08ee='CmContactHasItems';return db['UserProfileSection'][_0x15a2('0x44')]({'where':{'name':_0x4a08ee,'userProfileId':_0x448bb6[_0x15a2('0x4a')]},'raw':!![]})['then'](function(_0x2f21e7){if(_0x2f21e7&&_0x2f21e7['autoAssociation']===0x0){return db[_0x15a2('0x4b')]['create']({'name':_0x9fe972['name'],'resourceId':_0x9fe972['id'],'type':_0x2f21e7[_0x15a2('0x2d')],'sectionId':_0x2f21e7['id']},{})[_0x15a2('0x22')](function(){return _0x1134b7;});}else{return _0x1134b7;}})[_0x15a2('0x41')](function(_0xf59b1f){logger[_0x15a2('0x25')](_0x15a2('0x4c'),_0xf59b1f);throw _0xf59b1f;});}return _0x1134b7;})['then'](respondWithResult(_0x3e372a,0xc9))[_0x15a2('0x41')](handleError(_0x3e372a,null));};exports[_0x15a2('0x21')]=function(_0x5af849,_0x2dd97c){if(_0x5af849[_0x15a2('0x46')]['id']){delete _0x5af849['body']['id'];}return db[_0x15a2('0x29')][_0x15a2('0x44')]({'where':{'id':_0x5af849['params']['id']}})[_0x15a2('0x22')](handleEntityNotFound(_0x2dd97c,null))[_0x15a2('0x22')](saveUpdates(_0x5af849[_0x15a2('0x46')],null))[_0x15a2('0x22')](respondWithResult(_0x2dd97c,null))[_0x15a2('0x41')](handleError(_0x2dd97c,null));};exports[_0x15a2('0x24')]=function(_0x34a902,_0x340f76){return db[_0x15a2('0x29')]['find']({'where':{'id':_0x34a902[_0x15a2('0x4d')]['id']}})[_0x15a2('0x22')](handleEntityNotFound(_0x340f76,null))[_0x15a2('0x22')](removeEntity(_0x340f76,null))[_0x15a2('0x41')](handleError(_0x340f76,null));}; \ No newline at end of file +var _0x31d5=['autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','limit','offset','Content-Range','apply','reject','save','destroy','get','CmContactHasItems','then','end','name','send','index','map','CmContactHasItem','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','sort','where','pick','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','rawAttributes','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x3457b4,_0x4cd8f9){var _0xaa8fa9=function(_0x51897a){while(--_0x51897a){_0x3457b4['push'](_0x3457b4['shift']());}};_0xaa8fa9(++_0x4cd8f9);}(_0x31d5,0x1a0));var _0x531d=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x31d5[_0x3b380d];return _0x54502b;};'use strict';var emlformat=require(_0x531d('0x0'));var rimraf=require(_0x531d('0x1'));var zipdir=require(_0x531d('0x2'));var jsonpatch=require(_0x531d('0x3'));var rp=require('request-promise');var moment=require(_0x531d('0x4'));var BPromise=require(_0x531d('0x5'));var Mustache=require(_0x531d('0x6'));var util=require('util');var path=require(_0x531d('0x7'));var sox=require(_0x531d('0x8'));var csv=require(_0x531d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x531d('0xa'));var squel=require(_0x531d('0xb'));var crypto=require(_0x531d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x531d('0xd'));var toCsv=require(_0x531d('0x9'));var querystring=require(_0x531d('0xe'));var Papa=require(_0x531d('0xf'));var Redis=require(_0x531d('0x10'));var authService=require(_0x531d('0x11'));var qs=require(_0x531d('0x12'));var as=require(_0x531d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x531d('0x14'))('api');var utils=require(_0x531d('0x15'));var config=require(_0x531d('0x16'));var licenseUtil=require(_0x531d('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x238f05,_0x39e45c){_0x39e45c=_0x39e45c||0xcc;return function(_0x23bbda){if(_0x23bbda){return _0x238f05[_0x531d('0x18')](_0x39e45c);}return _0x238f05[_0x531d('0x19')](_0x39e45c)['end']();};}function respondWithResult(_0x5a2a98,_0x40a651){_0x40a651=_0x40a651||0xc8;return function(_0x4dbdeb){if(_0x4dbdeb){return _0x5a2a98['status'](_0x40a651)[_0x531d('0x1a')](_0x4dbdeb);}};}function respondWithFilteredResult(_0x35fa87,_0x53cac5){return function(_0x559c2a){if(_0x559c2a){var _0x201d61=typeof _0x53cac5['offset']===_0x531d('0x1b')&&typeof _0x53cac5[_0x531d('0x1c')]===_0x531d('0x1b');var _0x26249d=_0x559c2a['count'];var _0x296fa1=_0x201d61?0x0:_0x53cac5[_0x531d('0x1d')];var _0x50239a=_0x201d61?_0x559c2a['count']:_0x53cac5['offset']+_0x53cac5['limit'];var _0x588ab7;if(_0x50239a>=_0x26249d){_0x50239a=_0x26249d;_0x588ab7=0xc8;}else{_0x588ab7=0xce;}_0x35fa87[_0x531d('0x19')](_0x588ab7);return _0x35fa87['set'](_0x531d('0x1e'),_0x296fa1+'-'+_0x50239a+'/'+_0x26249d)['json'](_0x559c2a);}return null;};}function patchUpdates(_0x18e97d){return function(_0x4a0a3d){try{jsonpatch[_0x531d('0x1f')](_0x4a0a3d,_0x18e97d,!![]);}catch(_0x3e0aa4){return BPromise[_0x531d('0x20')](_0x3e0aa4);}return _0x4a0a3d[_0x531d('0x21')]();};}function saveUpdates(_0x124a63,_0x24bc5a){return function(_0x209037){if(_0x209037){return _0x209037['update'](_0x124a63)['then'](function(_0x5a1ab9){return _0x5a1ab9;});}return null;};}function removeEntity(_0x220d0f,_0x2b640b){return function(_0xfcc0bf){if(_0xfcc0bf){return _0xfcc0bf[_0x531d('0x22')]()['then'](function(){var _0x787a3a=_0xfcc0bf[_0x531d('0x23')]({'plain':!![]});var _0x59124a=_0x531d('0x24');return db['UserProfileResource'][_0x531d('0x22')]({'where':{'type':_0x59124a,'resourceId':_0x787a3a['id']}})[_0x531d('0x25')](function(){return _0xfcc0bf;});})[_0x531d('0x25')](function(){_0x220d0f[_0x531d('0x19')](0xcc)[_0x531d('0x26')]();});}};}function handleEntityNotFound(_0xd66c13,_0x5aa64b){return function(_0x5f0824){if(!_0x5f0824){_0xd66c13[_0x531d('0x18')](0x194);}return _0x5f0824;};}function handleError(_0x20ecbf,_0x260570){_0x260570=_0x260570||0x1f4;return function(_0x2d6e5a){logger['error'](_0x2d6e5a['stack']);if(_0x2d6e5a['name']){delete _0x2d6e5a[_0x531d('0x27')];}_0x20ecbf['status'](_0x260570)[_0x531d('0x28')](_0x2d6e5a);};}exports[_0x531d('0x29')]=function(_0x2355b8,_0x3bac22){var _0x4c5fc2={},_0x2b15fa={},_0xe8ed9c={'count':0x0,'rows':[]};var _0x3e13da=_[_0x531d('0x2a')](db[_0x531d('0x2b')]['rawAttributes'],function(_0x19b81d){return{'name':_0x19b81d[_0x531d('0x2c')],'type':_0x19b81d[_0x531d('0x2d')][_0x531d('0x2e')]};});_0x2b15fa[_0x531d('0x2f')]=_[_0x531d('0x2a')](_0x3e13da,_0x531d('0x27'));_0x2b15fa[_0x531d('0x30')]=_[_0x531d('0x31')](_0x2355b8[_0x531d('0x30')]);_0x2b15fa[_0x531d('0x32')]=_[_0x531d('0x33')](_0x2b15fa[_0x531d('0x2f')],_0x2b15fa[_0x531d('0x30')]);_0x4c5fc2[_0x531d('0x34')]=_[_0x531d('0x33')](_0x2b15fa[_0x531d('0x2f')],qs[_0x531d('0x35')](_0x2355b8['query'][_0x531d('0x35')]));_0x4c5fc2[_0x531d('0x34')]=_0x4c5fc2[_0x531d('0x34')]['length']?_0x4c5fc2[_0x531d('0x34')]:_0x2b15fa[_0x531d('0x2f')];if(!_0x2355b8[_0x531d('0x30')]['hasOwnProperty'](_0x531d('0x36'))){_0x4c5fc2['limit']=qs[_0x531d('0x1c')](_0x2355b8[_0x531d('0x30')]['limit']);_0x4c5fc2[_0x531d('0x1d')]=qs[_0x531d('0x1d')](_0x2355b8[_0x531d('0x30')][_0x531d('0x1d')]);}_0x4c5fc2['order']=qs[_0x531d('0x37')](_0x2355b8[_0x531d('0x30')][_0x531d('0x37')]);_0x4c5fc2[_0x531d('0x38')]=qs[_0x531d('0x32')](_[_0x531d('0x39')](_0x2355b8[_0x531d('0x30')],_0x2b15fa[_0x531d('0x32')]),_0x3e13da);if(_0x2355b8[_0x531d('0x30')]['filter']){_0x4c5fc2['where']=_[_0x531d('0x3a')](_0x4c5fc2[_0x531d('0x38')],{'$or':_[_0x531d('0x2a')](_0x3e13da,function(_0x521219){if(_0x521219[_0x531d('0x2d')]!==_0x531d('0x3b')){var _0x40c0cd={};_0x40c0cd[_0x521219[_0x531d('0x27')]]={'$like':'%'+_0x2355b8[_0x531d('0x30')]['filter']+'%'};return _0x40c0cd;}})});}_0x4c5fc2=_[_0x531d('0x3a')]({},_0x4c5fc2,_0x2355b8[_0x531d('0x3c')]);var _0x171503={'where':_0x4c5fc2[_0x531d('0x38')]};return db['CmContactHasItem'][_0x531d('0x3d')](_0x171503)[_0x531d('0x25')](function(_0x48ad03){_0xe8ed9c[_0x531d('0x3d')]=_0x48ad03;if(_0x2355b8['query'][_0x531d('0x3e')]){_0x4c5fc2[_0x531d('0x3f')]=[{'all':!![]}];}return db[_0x531d('0x2b')][_0x531d('0x40')](_0x4c5fc2);})[_0x531d('0x25')](function(_0xba0970){_0xe8ed9c[_0x531d('0x41')]=_0xba0970;return _0xe8ed9c;})['then'](respondWithFilteredResult(_0x3bac22,_0x4c5fc2))[_0x531d('0x42')](handleError(_0x3bac22,null));};exports[_0x531d('0x43')]=function(_0x3ddc7f,_0x54364c){var _0x4adcd3={'raw':!![],'where':{'id':_0x3ddc7f['params']['id']}},_0x23728d={};_0x23728d[_0x531d('0x2f')]=_[_0x531d('0x31')](db[_0x531d('0x2b')][_0x531d('0x44')]);_0x23728d['query']=_[_0x531d('0x31')](_0x3ddc7f[_0x531d('0x30')]);_0x23728d[_0x531d('0x32')]=_[_0x531d('0x33')](_0x23728d[_0x531d('0x2f')],_0x23728d[_0x531d('0x30')]);_0x4adcd3[_0x531d('0x34')]=_[_0x531d('0x33')](_0x23728d[_0x531d('0x2f')],qs[_0x531d('0x35')](_0x3ddc7f['query'][_0x531d('0x35')]));_0x4adcd3[_0x531d('0x34')]=_0x4adcd3['attributes'][_0x531d('0x45')]?_0x4adcd3['attributes']:_0x23728d[_0x531d('0x2f')];if(_0x3ddc7f[_0x531d('0x30')]['includeAll']){_0x4adcd3[_0x531d('0x3f')]=[{'all':!![]}];}_0x4adcd3=_[_0x531d('0x3a')]({},_0x4adcd3,_0x3ddc7f[_0x531d('0x3c')]);return db['CmContactHasItem'][_0x531d('0x46')](_0x4adcd3)[_0x531d('0x25')](handleEntityNotFound(_0x54364c,null))[_0x531d('0x25')](respondWithResult(_0x54364c,null))[_0x531d('0x42')](handleError(_0x54364c,null));};exports[_0x531d('0x47')]=function(_0x21788d,_0x1da23f){return db[_0x531d('0x2b')][_0x531d('0x47')](_0x21788d[_0x531d('0x48')],{})[_0x531d('0x25')](function(_0x4d1661){var _0x3c0bb1=_0x21788d[_0x531d('0x49')][_0x531d('0x23')]({'plain':!![]});if(!_0x3c0bb1)throw new Error(_0x531d('0x4a'));if(_0x3c0bb1[_0x531d('0x4b')]===_0x531d('0x49')){var _0x33b295=_0x4d1661[_0x531d('0x23')]({'plain':!![]});var _0x296d77=_0x531d('0x24');return db['UserProfileSection'][_0x531d('0x46')]({'where':{'name':_0x296d77,'userProfileId':_0x3c0bb1['userProfileId']},'raw':!![]})['then'](function(_0x3da8a8){if(_0x3da8a8&&_0x3da8a8[_0x531d('0x4c')]===0x0){return db[_0x531d('0x4d')][_0x531d('0x47')]({'name':_0x33b295[_0x531d('0x27')],'resourceId':_0x33b295['id'],'type':_0x3da8a8[_0x531d('0x27')],'sectionId':_0x3da8a8['id']},{})['then'](function(){return _0x4d1661;});}else{return _0x4d1661;}})[_0x531d('0x42')](function(_0x1cae40){logger[_0x531d('0x4e')](_0x531d('0x4f'),_0x1cae40);throw _0x1cae40;});}return _0x4d1661;})[_0x531d('0x25')](respondWithResult(_0x1da23f,0xc9))[_0x531d('0x42')](handleError(_0x1da23f,null));};exports[_0x531d('0x50')]=function(_0x3d394b,_0x364f96){if(_0x3d394b[_0x531d('0x48')]['id']){delete _0x3d394b['body']['id'];}return db[_0x531d('0x2b')]['find']({'where':{'id':_0x3d394b[_0x531d('0x51')]['id']}})[_0x531d('0x25')](handleEntityNotFound(_0x364f96,null))[_0x531d('0x25')](saveUpdates(_0x3d394b[_0x531d('0x48')],null))[_0x531d('0x25')](respondWithResult(_0x364f96,null))['catch'](handleError(_0x364f96,null));};exports[_0x531d('0x22')]=function(_0x8fb923,_0x417f10){return db[_0x531d('0x2b')]['find']({'where':{'id':_0x8fb923['params']['id']}})[_0x531d('0x25')](handleEntityNotFound(_0x417f10,null))[_0x531d('0x25')](removeEntity(_0x417f10,null))[_0x531d('0x42')](handleError(_0x417f10,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 3de7b42..81121e3 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.model.js +++ b/server/api/cmContactHasItem/cmContactHasItem.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaa89=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./cmContactHasItem.attributes','exports','CmContactHasItem','cm_contact_has_items','lodash'];(function(_0x1fc5a1,_0x2d7df5){var _0x188400=function(_0x2ca8d7){while(--_0x2ca8d7){_0x1fc5a1['push'](_0x1fc5a1['shift']());}};_0x188400(++_0x2d7df5);}(_0xaa89,0xef));var _0x9aa8=function(_0x31dde9,_0x12e816){_0x31dde9=_0x31dde9-0x0;var _0x1fbf2d=_0xaa89[_0x31dde9];return _0x1fbf2d;};'use strict';var _=require(_0x9aa8('0x0'));var util=require('util');var logger=require(_0x9aa8('0x1'))('api');var moment=require(_0x9aa8('0x2'));var BPromise=require('bluebird');var rp=require(_0x9aa8('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9aa8('0x4'));var config=require(_0x9aa8('0x5'));var attributes=require(_0x9aa8('0x6'));module[_0x9aa8('0x7')]=function(_0x1c8986,_0x2f1a72){return _0x1c8986['define'](_0x9aa8('0x8'),attributes,{'tableName':_0x9aa8('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6fbc=['./cmContactHasItem.attributes','exports','define','cm_contact_has_items','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment'];(function(_0x35e7e7,_0x2adedf){var _0x43f7cb=function(_0x3cd5c9){while(--_0x3cd5c9){_0x35e7e7['push'](_0x35e7e7['shift']());}};_0x43f7cb(++_0x2adedf);}(_0x6fbc,0x143));var _0xc6fb=function(_0x18c1af,_0x179004){_0x18c1af=_0x18c1af-0x0;var _0xaa92=_0x6fbc[_0x18c1af];return _0xaa92;};'use strict';var _=require(_0xc6fb('0x0'));var util=require(_0xc6fb('0x1'));var logger=require(_0xc6fb('0x2'))('api');var moment=require('moment');var BPromise=require(_0xc6fb('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc6fb('0x4'));var rimraf=require(_0xc6fb('0x5'));var config=require(_0xc6fb('0x6'));var attributes=require(_0xc6fb('0x7'));module[_0xc6fb('0x8')]=function(_0x31602d,_0x3cfabe){return _0x31602d[_0xc6fb('0x9')]('CmContactHasItem',attributes,{'tableName':_0xc6fb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index df66f89..021ce6a 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.rpc.js +++ b/server/api/cmContactHasItem/cmContactHasItem.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5af2=['../../config/utils','rpc','jayson/promise','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x1c0698,_0x366431){var _0x36c589=function(_0x28ee9f){while(--_0x28ee9f){_0x1c0698['push'](_0x1c0698['shift']());}};_0x36c589(++_0x366431);}(_0x5af2,0x66));var _0x25af=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x5af2[_0x5f09c5];return _0x426ad9;};'use strict';var _=require(_0x25af('0x0'));var util=require('util');var moment=require(_0x25af('0x1'));var BPromise=require(_0x25af('0x2'));var rs=require(_0x25af('0x3'));var fs=require('fs');var Redis=require(_0x25af('0x4'));var db=require(_0x25af('0x5'))['db'];var utils=require(_0x25af('0x6'));var logger=require('../../config/logger')(_0x25af('0x7'));var config=require('../../config/environment');var jayson=require(_0x25af('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x42537b,_0x51364d,_0x2abe4c){return new BPromise(function(_0x421bd7,_0x1b3e79){return client['request'](_0x42537b,_0x2abe4c)['then'](function(_0x4d4f70){logger[_0x25af('0x9')](_0x25af('0xa'),_0x51364d,_0x25af('0xb'));logger[_0x25af('0xc')](_0x25af('0xd'),_0x51364d,_0x25af('0xb'),JSON[_0x25af('0xe')](_0x4d4f70));if(_0x4d4f70['error']){if(_0x4d4f70[_0x25af('0xf')]['code']===0x1f4){logger[_0x25af('0xf')](_0x25af('0xa'),_0x51364d,_0x4d4f70[_0x25af('0xf')]['message']);return _0x1b3e79(_0x4d4f70[_0x25af('0xf')]['message']);}logger[_0x25af('0xf')](_0x25af('0xa'),_0x51364d,_0x4d4f70[_0x25af('0xf')][_0x25af('0x10')]);return _0x421bd7(_0x4d4f70[_0x25af('0xf')]['message']);}else{logger[_0x25af('0x9')](_0x25af('0xa'),_0x51364d,_0x25af('0xb'));_0x421bd7(_0x4d4f70['result'][_0x25af('0x10')]);}})[_0x25af('0x11')](function(_0x450cea){logger[_0x25af('0xf')]('CmContactHasItem,\x20%s,\x20%s',_0x51364d,_0x450cea);_0x1b3e79(_0x450cea);});});} \ No newline at end of file +var _0xee24=['CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','CmContactHasItem,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','request\x20sent','debug'];(function(_0x30d15a,_0x13e8f0){var _0x1a730e=function(_0x577d79){while(--_0x577d79){_0x30d15a['push'](_0x30d15a['shift']());}};_0x1a730e(++_0x13e8f0);}(_0xee24,0x151));var _0x4ee2=function(_0x5ed88a,_0x1d13a7){_0x5ed88a=_0x5ed88a-0x0;var _0x5233fb=_0xee24[_0x5ed88a];return _0x5233fb;};'use strict';var _=require('lodash');var util=require(_0x4ee2('0x0'));var moment=require(_0x4ee2('0x1'));var BPromise=require(_0x4ee2('0x2'));var rs=require(_0x4ee2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4ee2('0x4'))['db'];var utils=require(_0x4ee2('0x5'));var logger=require(_0x4ee2('0x6'))(_0x4ee2('0x7'));var config=require(_0x4ee2('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4ee2('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5b8dbc,_0x20c709,_0x2865af){return new BPromise(function(_0x26e700,_0x5219f1){return client[_0x4ee2('0xa')](_0x5b8dbc,_0x2865af)[_0x4ee2('0xb')](function(_0x46bbc7){logger[_0x4ee2('0xc')]('CmContactHasItem,\x20%s,\x20%s',_0x20c709,_0x4ee2('0xd'));logger[_0x4ee2('0xe')](_0x4ee2('0xf'),_0x20c709,_0x4ee2('0xd'),JSON[_0x4ee2('0x10')](_0x46bbc7));if(_0x46bbc7['error']){if(_0x46bbc7['error']['code']===0x1f4){logger[_0x4ee2('0x11')](_0x4ee2('0x12'),_0x20c709,_0x46bbc7[_0x4ee2('0x11')][_0x4ee2('0x13')]);return _0x5219f1(_0x46bbc7[_0x4ee2('0x11')][_0x4ee2('0x13')]);}logger[_0x4ee2('0x11')](_0x4ee2('0x12'),_0x20c709,_0x46bbc7[_0x4ee2('0x11')][_0x4ee2('0x13')]);return _0x26e700(_0x46bbc7[_0x4ee2('0x11')]['message']);}else{logger[_0x4ee2('0xc')](_0x4ee2('0x12'),_0x20c709,_0x4ee2('0xd'));_0x26e700(_0x46bbc7[_0x4ee2('0x14')][_0x4ee2('0x13')]);}})[_0x4ee2('0x15')](function(_0x28432a){logger[_0x4ee2('0x11')](_0x4ee2('0x12'),_0x20c709,_0x28432a);_0x5219f1(_0x28432a);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index c019943..956a7ce 100644 --- a/server/api/cmContactHasItem/index.js +++ b/server/api/cmContactHasItem/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe78b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','get','isAuthenticated','index','/:id','post','create','put','destroy','exports','util','connect-timeout'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0xe78b,0x1c9));var _0xbe78=function(_0x27d2aa,_0x5a595c){_0x27d2aa=_0x27d2aa-0x0;var _0x46c5ab=_0xe78b[_0x27d2aa];return _0x46c5ab;};'use strict';var multer=require('multer');var util=require(_0xbe78('0x0'));var path=require('path');var timeout=require(_0xbe78('0x1'));var express=require(_0xbe78('0x2'));var router=express['Router']();var fs_extra=require(_0xbe78('0x3'));var auth=require(_0xbe78('0x4'));var interaction=require(_0xbe78('0x5'));var config=require(_0xbe78('0x6'));var controller=require(_0xbe78('0x7'));router[_0xbe78('0x8')]('/',auth[_0xbe78('0x9')](),controller[_0xbe78('0xa')]);router[_0xbe78('0x8')](_0xbe78('0xb'),auth[_0xbe78('0x9')](),controller['show']);router[_0xbe78('0xc')]('/',auth[_0xbe78('0x9')](),controller[_0xbe78('0xd')]);router[_0xbe78('0xe')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0xbe78('0xb'),auth[_0xbe78('0x9')](),controller[_0xbe78('0xf')]);module[_0xbe78('0x10')]=router; \ No newline at end of file +var _0xc2ab=['exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','get','isAuthenticated','index','show','put','/:id','update','delete','destroy'];(function(_0x47ac32,_0x35ae4a){var _0x4f3542=function(_0x2efae5){while(--_0x2efae5){_0x47ac32['push'](_0x47ac32['shift']());}};_0x4f3542(++_0x35ae4a);}(_0xc2ab,0x1cd));var _0xbc2a=function(_0x170762,_0x59776b){_0x170762=_0x170762-0x0;var _0x50b567=_0xc2ab[_0x170762];return _0x50b567;};'use strict';var multer=require(_0xbc2a('0x0'));var util=require(_0xbc2a('0x1'));var path=require(_0xbc2a('0x2'));var timeout=require(_0xbc2a('0x3'));var express=require('express');var router=express[_0xbc2a('0x4')]();var fs_extra=require(_0xbc2a('0x5'));var auth=require(_0xbc2a('0x6'));var interaction=require(_0xbc2a('0x7'));var config=require(_0xbc2a('0x8'));var controller=require(_0xbc2a('0x9'));router[_0xbc2a('0xa')]('/',auth[_0xbc2a('0xb')](),controller[_0xbc2a('0xc')]);router[_0xbc2a('0xa')]('/:id',auth[_0xbc2a('0xb')](),controller[_0xbc2a('0xd')]);router['post']('/',auth[_0xbc2a('0xb')](),controller['create']);router[_0xbc2a('0xe')](_0xbc2a('0xf'),auth['isAuthenticated'](),controller[_0xbc2a('0x10')]);router[_0xbc2a('0x11')](_0xbc2a('0xf'),auth['isAuthenticated'](),controller[_0xbc2a('0x12')]);module[_0xbc2a('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 610dc95..efb40db 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 _0x0121=['VIRTUAL','getDataValue','alias','name','TEXT','select','parse','values','setDataValue','stringify','BOOLEAN','ENUM','voice','sequelize','lodash'];(function(_0x478331,_0x325263){var _0x5ef57a=function(_0x12cda5){while(--_0x12cda5){_0x478331['push'](_0x478331['shift']());}};_0x5ef57a(++_0x325263);}(_0x0121,0x148));var _0x1012=function(_0x41ecc6,_0x571a3f){_0x41ecc6=_0x41ecc6-0x0;var _0x29fb01=_0x0121[_0x41ecc6];return _0x29fb01;};'use strict';var Sequelize=require(_0x1012('0x0'));var _=require(_0x1012('0x1'));module['exports']={'name':{'type':Sequelize[_0x1012('0x2')],'get':function(_0x51a00e){return this[_0x1012('0x3')](_0x1012('0x4'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x143bff){this['setDataValue']('alias',_0x143bff?_0x143bff:this[_0x1012('0x3')](_0x1012('0x5')));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize[_0x1012('0x6')]('long'),'get':function(){if(this[_0x1012('0x3')]('type')===_0x1012('0x7')){return JSON[_0x1012('0x8')](this['getDataValue'](_0x1012('0x9')));}else{return this[_0x1012('0x3')]('values');}},'set':function(_0x5ab2a7){if(Array['isArray'](_0x5ab2a7)){this[_0x1012('0xa')](_0x1012('0x9'),JSON[_0x1012('0xb')](_0x5ab2a7));}else{this[_0x1012('0xa')]('values',_0x5ab2a7);}}},'required':{'type':Sequelize[_0x1012('0xc')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x1012('0xc')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x1012('0xd')](_0x1012('0xe'))}}; \ No newline at end of file +var _0x4c32=['select','parse','values','isArray','BOOLEAN','ENUM','sequelize','lodash','exports','getDataValue','STRING','setDataValue','alias','TEXT','long','type'];(function(_0x533391,_0x5f36a7){var _0x2cbaac=function(_0xcccfd0){while(--_0xcccfd0){_0x533391['push'](_0x533391['shift']());}};_0x2cbaac(++_0x5f36a7);}(_0x4c32,0x1b6));var _0x24c3=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x4c32[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require(_0x24c3('0x0'));var _=require(_0x24c3('0x1'));module[_0x24c3('0x2')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0xd4660e){return this[_0x24c3('0x3')]('alias');}},'alias':{'type':Sequelize[_0x24c3('0x4')],'allowNull':![],'set':function(_0x5afb4c){this[_0x24c3('0x5')](_0x24c3('0x6'),_0x5afb4c?_0x5afb4c:this[_0x24c3('0x3')]('name'));}},'type':{'type':Sequelize[_0x24c3('0x4')],'allowNull':![]},'values':{'type':Sequelize[_0x24c3('0x7')](_0x24c3('0x8')),'get':function(){if(this[_0x24c3('0x3')](_0x24c3('0x9'))===_0x24c3('0xa')){return JSON[_0x24c3('0xb')](this[_0x24c3('0x3')](_0x24c3('0xc')));}else{return this[_0x24c3('0x3')](_0x24c3('0xc'));}},'set':function(_0x59418a){if(Array[_0x24c3('0xd')](_0x59418a)){this[_0x24c3('0x5')](_0x24c3('0xc'),JSON['stringify'](_0x59418a));}else{this[_0x24c3('0x5')](_0x24c3('0xc'),_0x59418a);}}},'required':{'type':Sequelize[_0x24c3('0xe')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x24c3('0xe')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x24c3('0xf')]('voice')}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 5987c47..4f655df 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 _0xda85=['findAll','rows','catch','show','params','intersection','find','body','create','sequelize','transaction','Sequelize','TEXT','text','number','switch','BOOLEAN','queryInterface','addColumn','cm_contacts','format','cf_%d','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','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','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','sendStatus','stack','name','send','index','map','CmCustomField','rawAttributes','fieldName','type','key','differenceBy','keys','query','filters','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include'];(function(_0xdf9f0b,_0x2e1f85){var _0x295ab6=function(_0x1bdd5c){while(--_0x1bdd5c){_0xdf9f0b['push'](_0xdf9f0b['shift']());}};_0x295ab6(++_0x2e1f85);}(_0xda85,0xc8));var _0x5da8=function(_0x3c28c5,_0x20e5ba){_0x3c28c5=_0x3c28c5-0x0;var _0x32fc94=_0xda85[_0x3c28c5];return _0x32fc94;};'use strict';var emlformat=require(_0x5da8('0x0'));var rimraf=require(_0x5da8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5da8('0x2'));var rp=require(_0x5da8('0x3'));var moment=require(_0x5da8('0x4'));var BPromise=require(_0x5da8('0x5'));var Mustache=require(_0x5da8('0x6'));var util=require('util');var path=require('path');var sox=require(_0x5da8('0x7'));var csv=require(_0x5da8('0x8'));var ejs=require(_0x5da8('0x9'));var fs=require('fs');var fs_extra=require(_0x5da8('0xa'));var _=require(_0x5da8('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5da8('0xc'));var deskjs=require(_0x5da8('0xd'));var toCsv=require('to-csv');var querystring=require(_0x5da8('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x5da8('0xf'));var qs=require(_0x5da8('0x10'));var as=require(_0x5da8('0x11'));var hardwareService=require(_0x5da8('0x12'));var logger=require(_0x5da8('0x13'))(_0x5da8('0x14'));var utils=require(_0x5da8('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x5da8('0x16'));var db=require(_0x5da8('0x17'))['db'];function respondWithStatusCode(_0x2fff18,_0x3819d5){_0x3819d5=_0x3819d5||0xcc;return function(_0x121d4a){if(_0x121d4a){return _0x2fff18['sendStatus'](_0x3819d5);}return _0x2fff18[_0x5da8('0x18')](_0x3819d5)[_0x5da8('0x19')]();};}function respondWithResult(_0x7854e4,_0x4f6655){_0x4f6655=_0x4f6655||0xc8;return function(_0x5bde74){if(_0x5bde74){return _0x7854e4['status'](_0x4f6655)[_0x5da8('0x1a')](_0x5bde74);}};}function respondWithFilteredResult(_0x586e25,_0x599cb9){return function(_0x3a90f2){if(_0x3a90f2){var _0x5cce88=typeof _0x599cb9[_0x5da8('0x1b')]===_0x5da8('0x1c')&&typeof _0x599cb9[_0x5da8('0x1d')]===_0x5da8('0x1c');var _0x57144b=_0x3a90f2[_0x5da8('0x1e')];var _0x5191cb=_0x5cce88?0x0:_0x599cb9[_0x5da8('0x1b')];var _0x369345=_0x5cce88?_0x3a90f2[_0x5da8('0x1e')]:_0x599cb9['offset']+_0x599cb9[_0x5da8('0x1d')];var _0x6a59b4;if(_0x369345>=_0x57144b){_0x369345=_0x57144b;_0x6a59b4=0xc8;}else{_0x6a59b4=0xce;}_0x586e25[_0x5da8('0x18')](_0x6a59b4);return _0x586e25[_0x5da8('0x1f')](_0x5da8('0x20'),_0x5191cb+'-'+_0x369345+'/'+_0x57144b)[_0x5da8('0x1a')](_0x3a90f2);}return null;};}function patchUpdates(_0x57d509){return function(_0x419cc2){try{jsonpatch[_0x5da8('0x21')](_0x419cc2,_0x57d509,!![]);}catch(_0x1bb82f){return BPromise[_0x5da8('0x22')](_0x1bb82f);}return _0x419cc2[_0x5da8('0x23')]();};}function saveUpdates(_0x5b48c5,_0x2a1a34){return function(_0x1043b3){if(_0x1043b3){return _0x1043b3[_0x5da8('0x24')](_0x5b48c5)[_0x5da8('0x25')](function(_0x3c922d){return _0x3c922d;});}return null;};}function removeEntity(_0x42218d,_0x5a0750){return function(_0x505e84){if(_0x505e84){return _0x505e84['destroy']()[_0x5da8('0x25')](function(){_0x42218d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5efff4,_0x3ef898){return function(_0x4d07f4){if(!_0x4d07f4){_0x5efff4[_0x5da8('0x26')](0x194);}return _0x4d07f4;};}function handleError(_0x349060,_0x4a809b){_0x4a809b=_0x4a809b||0x1f4;return function(_0x25547a){logger['error'](_0x25547a[_0x5da8('0x27')]);if(_0x25547a[_0x5da8('0x28')]){delete _0x25547a[_0x5da8('0x28')];}_0x349060[_0x5da8('0x18')](_0x4a809b)[_0x5da8('0x29')](_0x25547a);};}exports[_0x5da8('0x2a')]=function(_0x41d216,_0x393406){var _0x3e6322={},_0x15e1cf={},_0x3e98f2={'count':0x0,'rows':[]};var _0x37fd7a=_[_0x5da8('0x2b')](db[_0x5da8('0x2c')][_0x5da8('0x2d')],function(_0x6f158c){return{'name':_0x6f158c[_0x5da8('0x2e')],'type':_0x6f158c[_0x5da8('0x2f')][_0x5da8('0x30')]};});_0x15e1cf['model']=_[_0x5da8('0x31')](_[_0x5da8('0x2b')](_0x37fd7a,_0x5da8('0x28')),[_0x5da8('0x28')]);_0x15e1cf['query']=_[_0x5da8('0x32')](_0x41d216[_0x5da8('0x33')]);_0x15e1cf[_0x5da8('0x34')]=_['intersection'](_0x15e1cf['model'],_0x15e1cf[_0x5da8('0x33')]);_0x3e6322[_0x5da8('0x35')]=_['intersection'](_0x15e1cf[_0x5da8('0x36')],qs['fields'](_0x41d216[_0x5da8('0x33')][_0x5da8('0x37')]));_0x3e6322['attributes']=_0x3e6322[_0x5da8('0x35')][_0x5da8('0x38')]?_0x3e6322[_0x5da8('0x35')]:_0x15e1cf[_0x5da8('0x36')];if(!_0x41d216[_0x5da8('0x33')][_0x5da8('0x39')](_0x5da8('0x3a'))){_0x3e6322[_0x5da8('0x1d')]=qs['limit'](_0x41d216[_0x5da8('0x33')][_0x5da8('0x1d')]);_0x3e6322[_0x5da8('0x1b')]=qs[_0x5da8('0x1b')](_0x41d216[_0x5da8('0x33')][_0x5da8('0x1b')]);}_0x3e6322['order']=qs[_0x5da8('0x3b')](_0x41d216['query']['sort']);_0x3e6322[_0x5da8('0x3c')]=qs[_0x5da8('0x34')](_['pick'](_0x41d216['query'],_0x15e1cf[_0x5da8('0x34')]),_0x37fd7a);if(_0x41d216['query'][_0x5da8('0x3d')]){_0x3e6322['where']=_[_0x5da8('0x3e')](_0x3e6322['where'],{'$or':_[_0x5da8('0x2b')](_0x37fd7a,function(_0x13df63){if(_0x13df63[_0x5da8('0x2f')]!==_0x5da8('0x3f')){var _0x384647={};_0x384647[_0x13df63[_0x5da8('0x28')]]={'$like':'%'+_0x41d216[_0x5da8('0x33')]['filter']+'%'};return _0x384647;}})});}_0x3e6322=_[_0x5da8('0x3e')]({},_0x3e6322,_0x41d216[_0x5da8('0x40')]);var _0x50adfd={'where':_0x3e6322[_0x5da8('0x3c')]};return db['CmCustomField'][_0x5da8('0x1e')](_0x50adfd)[_0x5da8('0x25')](function(_0x587ed9){_0x3e98f2[_0x5da8('0x1e')]=_0x587ed9;if(_0x41d216[_0x5da8('0x33')][_0x5da8('0x41')]){_0x3e6322[_0x5da8('0x42')]=[{'all':!![]}];}return db[_0x5da8('0x2c')][_0x5da8('0x43')](_0x3e6322);})[_0x5da8('0x25')](function(_0x5c247e){_0x3e98f2[_0x5da8('0x44')]=_0x5c247e;return _0x3e98f2;})[_0x5da8('0x25')](respondWithFilteredResult(_0x393406,_0x3e6322))[_0x5da8('0x45')](handleError(_0x393406,null));};exports[_0x5da8('0x46')]=function(_0x40f69f,_0x217ead){var _0x829ef0={'raw':!![],'where':{'id':_0x40f69f[_0x5da8('0x47')]['id']}},_0x1a3eb1={};_0x1a3eb1[_0x5da8('0x36')]=_[_0x5da8('0x32')](db['CmCustomField'][_0x5da8('0x2d')]);_0x1a3eb1[_0x5da8('0x33')]=_['keys'](_0x40f69f[_0x5da8('0x33')]);_0x1a3eb1[_0x5da8('0x34')]=_[_0x5da8('0x48')](_0x1a3eb1['model'],_0x1a3eb1[_0x5da8('0x33')]);_0x829ef0[_0x5da8('0x35')]=_['intersection'](_0x1a3eb1[_0x5da8('0x36')],qs['fields'](_0x40f69f[_0x5da8('0x33')][_0x5da8('0x37')]));_0x829ef0[_0x5da8('0x35')]=_0x829ef0[_0x5da8('0x35')]['length']?_0x829ef0[_0x5da8('0x35')]:_0x1a3eb1[_0x5da8('0x36')];if(_0x40f69f[_0x5da8('0x33')]['includeAll']){_0x829ef0[_0x5da8('0x42')]=[{'all':!![]}];}_0x829ef0=_[_0x5da8('0x3e')]({},_0x829ef0,_0x40f69f['options']);return db[_0x5da8('0x2c')][_0x5da8('0x49')](_0x829ef0)[_0x5da8('0x25')](handleEntityNotFound(_0x217ead,null))[_0x5da8('0x25')](respondWithResult(_0x217ead,null))[_0x5da8('0x45')](handleError(_0x217ead,null));};exports['update']=function(_0x513b72,_0x1837f2){if(_0x513b72[_0x5da8('0x4a')]['id']){delete _0x513b72[_0x5da8('0x4a')]['id'];}return db[_0x5da8('0x2c')][_0x5da8('0x49')]({'where':{'id':_0x513b72[_0x5da8('0x47')]['id']}})[_0x5da8('0x25')](handleEntityNotFound(_0x1837f2,null))[_0x5da8('0x25')](saveUpdates(_0x513b72[_0x5da8('0x4a')],null))[_0x5da8('0x25')](respondWithResult(_0x1837f2,null))[_0x5da8('0x45')](handleError(_0x1837f2,null));};exports['destroy']=function(_0x5dbb5c,_0x4fd104){return db['CmCustomField']['find']({'where':{'id':_0x5dbb5c[_0x5da8('0x47')]['id']}})['then'](handleEntityNotFound(_0x4fd104,null))['then'](removeEntity(_0x4fd104,null))[_0x5da8('0x45')](handleError(_0x4fd104,null));};exports[_0x5da8('0x4b')]=function(_0x252fbf,_0x202fb8){var _0x5d28bc;return db[_0x5da8('0x4c')][_0x5da8('0x4d')](function(_0xa8ef75){return db['CmCustomField']['create'](_0x252fbf[_0x5da8('0x4a')],{'transaction':_0xa8ef75})['then'](function(_0x289c1e){_0x5d28bc=_0x289c1e;var _0xc210cb={'type':db[_0x5da8('0x4e')][_0x5da8('0x4f')],'transaction':_0xa8ef75};switch(_0x252fbf[_0x5da8('0x4a')][_0x5da8('0x2f')]){case _0x5da8('0x50'):_0xc210cb[_0x5da8('0x2f')]=db[_0x5da8('0x4e')][_0x5da8('0x4f')];break;case _0x5da8('0x51'):_0xc210cb['type']=db[_0x5da8('0x4e')]['INTEGER'];break;case _0x5da8('0x52'):_0xc210cb[_0x5da8('0x2f')]=db['Sequelize'][_0x5da8('0x53')];_0xc210cb['defaultValue']=![];break;default:}return db[_0x5da8('0x4c')][_0x5da8('0x54')][_0x5da8('0x55')](_0x5da8('0x56'),util[_0x5da8('0x57')](_0x5da8('0x58'),_0x5d28bc['id']),_0xc210cb);})['then'](function(){return _0x5d28bc;});})[_0x5da8('0x25')](respondWithResult(_0x202fb8,0xc9))['catch'](handleError(_0x202fb8,null));}; \ No newline at end of file +var _0x5d4e=['undefined','limit','count','Content-Range','apply','reject','save','update','then','end','error','stack','name','send','index','map','CmCustomField','rawAttributes','fieldName','type','key','differenceBy','keys','query','filters','intersection','model','fields','attributes','nolimit','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','show','params','include','body','find','destroy','create','sequelize','transaction','Sequelize','TEXT','text','INTEGER','defaultValue','addColumn','format','cf_%d','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','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','sendStatus','status','json','offset'];(function(_0x4685a9,_0x36f79d){var _0x2d6f70=function(_0x2ff1ae){while(--_0x2ff1ae){_0x4685a9['push'](_0x4685a9['shift']());}};_0x2d6f70(++_0x36f79d);}(_0x5d4e,0x138));var _0xe5d4=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x5d4e[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe5d4('0x0'));var zipdir=require(_0xe5d4('0x1'));var jsonpatch=require(_0xe5d4('0x2'));var rp=require(_0xe5d4('0x3'));var moment=require(_0xe5d4('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe5d4('0x5'));var util=require(_0xe5d4('0x6'));var path=require(_0xe5d4('0x7'));var sox=require('sox');var csv=require(_0xe5d4('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xe5d4('0x9'));var crypto=require(_0xe5d4('0xa'));var jsforce=require(_0xe5d4('0xb'));var deskjs=require(_0xe5d4('0xc'));var toCsv=require(_0xe5d4('0x8'));var querystring=require(_0xe5d4('0xd'));var Papa=require(_0xe5d4('0xe'));var Redis=require(_0xe5d4('0xf'));var authService=require(_0xe5d4('0x10'));var qs=require(_0xe5d4('0x11'));var as=require(_0xe5d4('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe5d4('0x13'));var utils=require(_0xe5d4('0x14'));var config=require(_0xe5d4('0x15'));var licenseUtil=require(_0xe5d4('0x16'));var db=require(_0xe5d4('0x17'))['db'];function respondWithStatusCode(_0xf3b751,_0x451ac4){_0x451ac4=_0x451ac4||0xcc;return function(_0x1d2de6){if(_0x1d2de6){return _0xf3b751[_0xe5d4('0x18')](_0x451ac4);}return _0xf3b751['status'](_0x451ac4)['end']();};}function respondWithResult(_0x31aa74,_0x22f970){_0x22f970=_0x22f970||0xc8;return function(_0x4d0756){if(_0x4d0756){return _0x31aa74[_0xe5d4('0x19')](_0x22f970)[_0xe5d4('0x1a')](_0x4d0756);}};}function respondWithFilteredResult(_0x3dee9f,_0x49a0e1){return function(_0x3e7987){if(_0x3e7987){var _0x96d668=typeof _0x49a0e1[_0xe5d4('0x1b')]===_0xe5d4('0x1c')&&typeof _0x49a0e1[_0xe5d4('0x1d')]===_0xe5d4('0x1c');var _0x473e7f=_0x3e7987[_0xe5d4('0x1e')];var _0x915fb7=_0x96d668?0x0:_0x49a0e1[_0xe5d4('0x1b')];var _0x435782=_0x96d668?_0x3e7987[_0xe5d4('0x1e')]:_0x49a0e1[_0xe5d4('0x1b')]+_0x49a0e1[_0xe5d4('0x1d')];var _0x1efe37;if(_0x435782>=_0x473e7f){_0x435782=_0x473e7f;_0x1efe37=0xc8;}else{_0x1efe37=0xce;}_0x3dee9f[_0xe5d4('0x19')](_0x1efe37);return _0x3dee9f['set'](_0xe5d4('0x1f'),_0x915fb7+'-'+_0x435782+'/'+_0x473e7f)[_0xe5d4('0x1a')](_0x3e7987);}return null;};}function patchUpdates(_0x4c632f){return function(_0x2b6e17){try{jsonpatch[_0xe5d4('0x20')](_0x2b6e17,_0x4c632f,!![]);}catch(_0x157307){return BPromise[_0xe5d4('0x21')](_0x157307);}return _0x2b6e17[_0xe5d4('0x22')]();};}function saveUpdates(_0x16a819,_0x5730e3){return function(_0x51ddf6){if(_0x51ddf6){return _0x51ddf6[_0xe5d4('0x23')](_0x16a819)[_0xe5d4('0x24')](function(_0x5c2bbc){return _0x5c2bbc;});}return null;};}function removeEntity(_0x1ddbbb,_0x357161){return function(_0x57ea65){if(_0x57ea65){return _0x57ea65['destroy']()[_0xe5d4('0x24')](function(){_0x1ddbbb[_0xe5d4('0x19')](0xcc)[_0xe5d4('0x25')]();});}};}function handleEntityNotFound(_0xb79648,_0x3e266e){return function(_0xb124df){if(!_0xb124df){_0xb79648[_0xe5d4('0x18')](0x194);}return _0xb124df;};}function handleError(_0x456ab2,_0x5d3473){_0x5d3473=_0x5d3473||0x1f4;return function(_0x436d08){logger[_0xe5d4('0x26')](_0x436d08[_0xe5d4('0x27')]);if(_0x436d08['name']){delete _0x436d08[_0xe5d4('0x28')];}_0x456ab2[_0xe5d4('0x19')](_0x5d3473)[_0xe5d4('0x29')](_0x436d08);};}exports[_0xe5d4('0x2a')]=function(_0xbb9fdd,_0xb0ae3b){var _0x5a80a2={},_0x15965d={},_0x3315c7={'count':0x0,'rows':[]};var _0x3a517b=_[_0xe5d4('0x2b')](db[_0xe5d4('0x2c')][_0xe5d4('0x2d')],function(_0x569160){return{'name':_0x569160[_0xe5d4('0x2e')],'type':_0x569160[_0xe5d4('0x2f')][_0xe5d4('0x30')]};});_0x15965d['model']=_[_0xe5d4('0x31')](_['map'](_0x3a517b,'name'),['name']);_0x15965d['query']=_[_0xe5d4('0x32')](_0xbb9fdd[_0xe5d4('0x33')]);_0x15965d[_0xe5d4('0x34')]=_[_0xe5d4('0x35')](_0x15965d[_0xe5d4('0x36')],_0x15965d[_0xe5d4('0x33')]);_0x5a80a2['attributes']=_['intersection'](_0x15965d['model'],qs['fields'](_0xbb9fdd[_0xe5d4('0x33')][_0xe5d4('0x37')]));_0x5a80a2[_0xe5d4('0x38')]=_0x5a80a2[_0xe5d4('0x38')]['length']?_0x5a80a2[_0xe5d4('0x38')]:_0x15965d[_0xe5d4('0x36')];if(!_0xbb9fdd[_0xe5d4('0x33')]['hasOwnProperty'](_0xe5d4('0x39'))){_0x5a80a2[_0xe5d4('0x1d')]=qs[_0xe5d4('0x1d')](_0xbb9fdd[_0xe5d4('0x33')][_0xe5d4('0x1d')]);_0x5a80a2[_0xe5d4('0x1b')]=qs[_0xe5d4('0x1b')](_0xbb9fdd[_0xe5d4('0x33')][_0xe5d4('0x1b')]);}_0x5a80a2['order']=qs[_0xe5d4('0x3a')](_0xbb9fdd[_0xe5d4('0x33')][_0xe5d4('0x3a')]);_0x5a80a2[_0xe5d4('0x3b')]=qs['filters'](_[_0xe5d4('0x3c')](_0xbb9fdd[_0xe5d4('0x33')],_0x15965d[_0xe5d4('0x34')]),_0x3a517b);if(_0xbb9fdd[_0xe5d4('0x33')][_0xe5d4('0x3d')]){_0x5a80a2['where']=_['merge'](_0x5a80a2[_0xe5d4('0x3b')],{'$or':_[_0xe5d4('0x2b')](_0x3a517b,function(_0x769b8e){if(_0x769b8e[_0xe5d4('0x2f')]!=='VIRTUAL'){var _0x13319c={};_0x13319c[_0x769b8e[_0xe5d4('0x28')]]={'$like':'%'+_0xbb9fdd[_0xe5d4('0x33')][_0xe5d4('0x3d')]+'%'};return _0x13319c;}})});}_0x5a80a2=_[_0xe5d4('0x3e')]({},_0x5a80a2,_0xbb9fdd[_0xe5d4('0x3f')]);var _0x39e17b={'where':_0x5a80a2[_0xe5d4('0x3b')]};return db[_0xe5d4('0x2c')][_0xe5d4('0x1e')](_0x39e17b)[_0xe5d4('0x24')](function(_0x4f2531){_0x3315c7['count']=_0x4f2531;if(_0xbb9fdd[_0xe5d4('0x33')][_0xe5d4('0x40')]){_0x5a80a2['include']=[{'all':!![]}];}return db[_0xe5d4('0x2c')][_0xe5d4('0x41')](_0x5a80a2);})[_0xe5d4('0x24')](function(_0x2777da){_0x3315c7[_0xe5d4('0x42')]=_0x2777da;return _0x3315c7;})[_0xe5d4('0x24')](respondWithFilteredResult(_0xb0ae3b,_0x5a80a2))[_0xe5d4('0x43')](handleError(_0xb0ae3b,null));};exports[_0xe5d4('0x44')]=function(_0xb62655,_0x2f0b69){var _0x579a32={'raw':!![],'where':{'id':_0xb62655[_0xe5d4('0x45')]['id']}},_0xc7d014={};_0xc7d014[_0xe5d4('0x36')]=_[_0xe5d4('0x32')](db[_0xe5d4('0x2c')]['rawAttributes']);_0xc7d014[_0xe5d4('0x33')]=_[_0xe5d4('0x32')](_0xb62655[_0xe5d4('0x33')]);_0xc7d014[_0xe5d4('0x34')]=_[_0xe5d4('0x35')](_0xc7d014['model'],_0xc7d014['query']);_0x579a32[_0xe5d4('0x38')]=_[_0xe5d4('0x35')](_0xc7d014[_0xe5d4('0x36')],qs[_0xe5d4('0x37')](_0xb62655[_0xe5d4('0x33')][_0xe5d4('0x37')]));_0x579a32[_0xe5d4('0x38')]=_0x579a32[_0xe5d4('0x38')]['length']?_0x579a32[_0xe5d4('0x38')]:_0xc7d014['model'];if(_0xb62655['query'][_0xe5d4('0x40')]){_0x579a32[_0xe5d4('0x46')]=[{'all':!![]}];}_0x579a32=_['merge']({},_0x579a32,_0xb62655[_0xe5d4('0x3f')]);return db[_0xe5d4('0x2c')]['find'](_0x579a32)['then'](handleEntityNotFound(_0x2f0b69,null))['then'](respondWithResult(_0x2f0b69,null))[_0xe5d4('0x43')](handleError(_0x2f0b69,null));};exports[_0xe5d4('0x23')]=function(_0x47aba8,_0x36bc7e){if(_0x47aba8['body']['id']){delete _0x47aba8[_0xe5d4('0x47')]['id'];}return db[_0xe5d4('0x2c')][_0xe5d4('0x48')]({'where':{'id':_0x47aba8[_0xe5d4('0x45')]['id']}})['then'](handleEntityNotFound(_0x36bc7e,null))[_0xe5d4('0x24')](saveUpdates(_0x47aba8['body'],null))[_0xe5d4('0x24')](respondWithResult(_0x36bc7e,null))['catch'](handleError(_0x36bc7e,null));};exports[_0xe5d4('0x49')]=function(_0x1dbc69,_0x2f81a5){return db[_0xe5d4('0x2c')]['find']({'where':{'id':_0x1dbc69[_0xe5d4('0x45')]['id']}})['then'](handleEntityNotFound(_0x2f81a5,null))['then'](removeEntity(_0x2f81a5,null))['catch'](handleError(_0x2f81a5,null));};exports[_0xe5d4('0x4a')]=function(_0x4e8f53,_0x582b4c){var _0x3210aa;return db[_0xe5d4('0x4b')][_0xe5d4('0x4c')](function(_0x5bceb1){return db[_0xe5d4('0x2c')][_0xe5d4('0x4a')](_0x4e8f53[_0xe5d4('0x47')],{'transaction':_0x5bceb1})['then'](function(_0x236c3f){_0x3210aa=_0x236c3f;var _0x5aabd1={'type':db[_0xe5d4('0x4d')][_0xe5d4('0x4e')],'transaction':_0x5bceb1};switch(_0x4e8f53[_0xe5d4('0x47')][_0xe5d4('0x2f')]){case _0xe5d4('0x4f'):_0x5aabd1[_0xe5d4('0x2f')]=db[_0xe5d4('0x4d')]['TEXT'];break;case'number':_0x5aabd1[_0xe5d4('0x2f')]=db[_0xe5d4('0x4d')][_0xe5d4('0x50')];break;case'switch':_0x5aabd1['type']=db['Sequelize']['BOOLEAN'];_0x5aabd1[_0xe5d4('0x51')]=![];break;default:}return db[_0xe5d4('0x4b')]['queryInterface'][_0xe5d4('0x52')]('cm_contacts',util[_0xe5d4('0x53')](_0xe5d4('0x54'),_0x3210aa['id']),_0x5aabd1);})[_0xe5d4('0x24')](function(){return _0x3210aa;});})[_0xe5d4('0x24')](respondWithResult(_0x582b4c,0xc9))[_0xe5d4('0x43')](handleError(_0x582b4c,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 6c0161e..05876df 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 _0x26b2=['cm_custom_fields','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./cmCustomField.attributes','CmCustomField'];(function(_0x3da6ae,_0x13fdf4){var _0x1aa8df=function(_0xaac51){while(--_0xaac51){_0x3da6ae['push'](_0x3da6ae['shift']());}};_0x1aa8df(++_0x13fdf4);}(_0x26b2,0x64));var _0x226b=function(_0xa2a80e,_0x2a6df1){_0xa2a80e=_0xa2a80e-0x0;var _0x342e3d=_0x26b2[_0xa2a80e];return _0x342e3d;};'use strict';var _=require(_0x226b('0x0'));var util=require(_0x226b('0x1'));var logger=require(_0x226b('0x2'))(_0x226b('0x3'));var moment=require('moment');var BPromise=require(_0x226b('0x4'));var rp=require(_0x226b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x226b('0x6'));var config=require(_0x226b('0x7'));var attributes=require(_0x226b('0x8'));module['exports']=function(_0x4d4fd1,_0x333247){return _0x4d4fd1['define'](_0x226b('0x9'),attributes,{'tableName':_0x226b('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd57e=['bluebird','request-promise','rimraf','../../config/environment','./cmCustomField.attributes','exports','CmCustomField','lodash','util','../../config/logger'];(function(_0x2610a8,_0x34f21c){var _0x66d9fe=function(_0x34d58d){while(--_0x34d58d){_0x2610a8['push'](_0x2610a8['shift']());}};_0x66d9fe(++_0x34f21c);}(_0xd57e,0x1d3));var _0xed57=function(_0x497b1e,_0x586379){_0x497b1e=_0x497b1e-0x0;var _0x3f72e1=_0xd57e[_0x497b1e];return _0x3f72e1;};'use strict';var _=require(_0xed57('0x0'));var util=require(_0xed57('0x1'));var logger=require(_0xed57('0x2'))('api');var moment=require('moment');var BPromise=require(_0xed57('0x3'));var rp=require(_0xed57('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xed57('0x5'));var config=require(_0xed57('0x6'));var attributes=require(_0xed57('0x7'));module[_0xed57('0x8')]=function(_0x3e62a9,_0x41a941){return _0x3e62a9['define'](_0xed57('0x9'),attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index b67bfce..a56ba6a 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 _0xc98b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x39c63a,_0x4ae380){var _0x3ca456=function(_0x298fe5){while(--_0x298fe5){_0x39c63a['push'](_0x39c63a['shift']());}};_0x3ca456(++_0x4ae380);}(_0xc98b,0x169));var _0xbc98=function(_0x35e1a4,_0x8a2064){_0x35e1a4=_0x35e1a4-0x0;var _0x301744=_0xc98b[_0x35e1a4];return _0x301744;};'use strict';var _=require(_0xbc98('0x0'));var util=require('util');var moment=require(_0xbc98('0x1'));var BPromise=require(_0xbc98('0x2'));var rs=require(_0xbc98('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbc98('0x4'))['db'];var utils=require(_0xbc98('0x5'));var logger=require(_0xbc98('0x6'))(_0xbc98('0x7'));var config=require(_0xbc98('0x8'));var jayson=require(_0xbc98('0x9'));var client=jayson[_0xbc98('0xa')][_0xbc98('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xd7fe2b,_0x3b7d78,_0x57e6e2){return new BPromise(function(_0x520925,_0x7ccb8){return client[_0xbc98('0xc')](_0xd7fe2b,_0x57e6e2)[_0xbc98('0xd')](function(_0x1bf771){logger[_0xbc98('0xe')](_0xbc98('0xf'),_0x3b7d78,_0xbc98('0x10'));logger[_0xbc98('0x11')](_0xbc98('0x12'),_0x3b7d78,_0xbc98('0x10'),JSON['stringify'](_0x1bf771));if(_0x1bf771[_0xbc98('0x13')]){if(_0x1bf771[_0xbc98('0x13')][_0xbc98('0x14')]===0x1f4){logger['error'](_0xbc98('0xf'),_0x3b7d78,_0x1bf771['error'][_0xbc98('0x15')]);return _0x7ccb8(_0x1bf771['error'][_0xbc98('0x15')]);}logger[_0xbc98('0x13')]('CmCustomField,\x20%s,\x20%s',_0x3b7d78,_0x1bf771[_0xbc98('0x13')]['message']);return _0x520925(_0x1bf771[_0xbc98('0x13')][_0xbc98('0x15')]);}else{logger[_0xbc98('0xe')]('CmCustomField,\x20%s,\x20%s',_0x3b7d78,'request\x20sent');_0x520925(_0x1bf771[_0xbc98('0x16')][_0xbc98('0x15')]);}})[_0xbc98('0x17')](function(_0x29fb11){logger['error'](_0xbc98('0xf'),_0x3b7d78,_0x29fb11);_0x7ccb8(_0x29fb11);});});} \ No newline at end of file +var _0x9352=['../../config/logger','jayson/promise','client','request','then','info','CmCustomField,\x20%s,\x20%s','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0xf0df5b,_0x211693){var _0x422acf=function(_0x175ec6){while(--_0x175ec6){_0xf0df5b['push'](_0xf0df5b['shift']());}};_0x422acf(++_0x211693);}(_0x9352,0x7d));var _0x2935=function(_0x1545f5,_0x60fd9){_0x1545f5=_0x1545f5-0x0;var _0x2abd3e=_0x9352[_0x1545f5];return _0x2abd3e;};'use strict';var _=require(_0x2935('0x0'));var util=require(_0x2935('0x1'));var moment=require(_0x2935('0x2'));var BPromise=require(_0x2935('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2935('0x4'));var db=require(_0x2935('0x5'))['db'];var utils=require(_0x2935('0x6'));var logger=require(_0x2935('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2935('0x8'));var client=jayson[_0x2935('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4d690c,_0xcb16ad,_0x2501ca){return new BPromise(function(_0x2c1d0d,_0x4b21d3){return client[_0x2935('0xa')](_0x4d690c,_0x2501ca)[_0x2935('0xb')](function(_0x22790c){logger[_0x2935('0xc')](_0x2935('0xd'),_0xcb16ad,'request\x20sent');logger[_0x2935('0xe')](_0x2935('0xf'),_0xcb16ad,'request\x20sent',JSON[_0x2935('0x10')](_0x22790c));if(_0x22790c[_0x2935('0x11')]){if(_0x22790c[_0x2935('0x11')][_0x2935('0x12')]===0x1f4){logger[_0x2935('0x11')](_0x2935('0xd'),_0xcb16ad,_0x22790c[_0x2935('0x11')][_0x2935('0x13')]);return _0x4b21d3(_0x22790c[_0x2935('0x11')]['message']);}logger[_0x2935('0x11')](_0x2935('0xd'),_0xcb16ad,_0x22790c[_0x2935('0x11')][_0x2935('0x13')]);return _0x2c1d0d(_0x22790c['error'][_0x2935('0x13')]);}else{logger[_0x2935('0xc')](_0x2935('0xd'),_0xcb16ad,_0x2935('0x14'));_0x2c1d0d(_0x22790c['result'][_0x2935('0x13')]);}})[_0x2935('0x15')](function(_0x24ccc8){logger[_0x2935('0x11')](_0x2935('0xd'),_0xcb16ad,_0x24ccc8);_0x4b21d3(_0x24ccc8);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index d72b964..bb9eb66 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 _0xd8b1=['show','post','put','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','index','/:id','isAuthenticated'];(function(_0x54879a,_0x41dfa7){var _0x26a4cc=function(_0x9a82aa){while(--_0x9a82aa){_0x54879a['push'](_0x54879a['shift']());}};_0x26a4cc(++_0x41dfa7);}(_0xd8b1,0x105));var _0x1d8b=function(_0x196f7a,_0x34be8b){_0x196f7a=_0x196f7a-0x0;var _0x451b5e=_0xd8b1[_0x196f7a];return _0x451b5e;};'use strict';var multer=require(_0x1d8b('0x0'));var util=require(_0x1d8b('0x1'));var path=require(_0x1d8b('0x2'));var timeout=require(_0x1d8b('0x3'));var express=require(_0x1d8b('0x4'));var router=express['Router']();var fs_extra=require(_0x1d8b('0x5'));var auth=require(_0x1d8b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1d8b('0x7'));var controller=require('./cmCustomField.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x1d8b('0x8')]);router['get'](_0x1d8b('0x9'),auth[_0x1d8b('0xa')](),controller[_0x1d8b('0xb')]);router[_0x1d8b('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x1d8b('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x1d8b('0xe')]);router['delete'](_0x1d8b('0x9'),auth['isAuthenticated'](),controller[_0x1d8b('0xf')]);module[_0x1d8b('0x10')]=router; \ No newline at end of file +var _0x6f76=['../../components/interaction/service','./cmCustomField.controller','get','isAuthenticated','index','/:id','create','put','update','destroy','multer','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x5c8bde,_0x18c40c){var _0x50b8de=function(_0x4c6de8){while(--_0x4c6de8){_0x5c8bde['push'](_0x5c8bde['shift']());}};_0x50b8de(++_0x18c40c);}(_0x6f76,0x14a));var _0x66f7=function(_0x4d9ad2,_0x476339){_0x4d9ad2=_0x4d9ad2-0x0;var _0x3c17e9=_0x6f76[_0x4d9ad2];return _0x3c17e9;};'use strict';var multer=require(_0x66f7('0x0'));var util=require('util');var path=require(_0x66f7('0x1'));var timeout=require('connect-timeout');var express=require(_0x66f7('0x2'));var router=express[_0x66f7('0x3')]();var fs_extra=require(_0x66f7('0x4'));var auth=require(_0x66f7('0x5'));var interaction=require(_0x66f7('0x6'));var config=require('../../config/environment');var controller=require(_0x66f7('0x7'));router[_0x66f7('0x8')]('/',auth[_0x66f7('0x9')](),controller[_0x66f7('0xa')]);router[_0x66f7('0x8')](_0x66f7('0xb'),auth[_0x66f7('0x9')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x66f7('0xc')]);router[_0x66f7('0xd')](_0x66f7('0xb'),auth[_0x66f7('0x9')](),controller[_0x66f7('0xe')]);router['delete']('/:id',auth[_0x66f7('0x9')](),controller[_0x66f7('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index f25c917..567a1ab 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 _0xfb13=['format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue','moment','sequelize','exports','STRING','BOOLEAN'];(function(_0xb39122,_0x1c4f04){var _0x4126c7=function(_0x5d0871){while(--_0x5d0871){_0xb39122['push'](_0xb39122['shift']());}};_0x4126c7(++_0x1c4f04);}(_0xfb13,0xb9));var _0x3fb1=function(_0x255c46,_0x302d1e){_0x255c46=_0x255c46-0x0;var _0x30a191=_0xfb13[_0x255c46];return _0x30a191;};'use strict';var moment=require(_0x3fb1('0x0'));var Sequelize=require(_0x3fb1('0x1'));module[_0x3fb1('0x2')]={'phone':{'type':Sequelize[_0x3fb1('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0x3fb1('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x3fb1('0x5')](_0x3fb1('0x6'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x3fb1('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x3fb1('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0x3fb1('0x7')](0x2)[_0x3fb1('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x3fb1('0x4')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x3fb1('0x7')],'unique':_0x3fb1('0x9')},'ListId':{'type':Sequelize[_0x3fb1('0x7')],'unique':_0x3fb1('0x9')},'UserId':{'type':Sequelize[_0x3fb1('0x7')]},'VoiceQueueId':{'type':Sequelize[_0x3fb1('0x7')],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize[_0x3fb1('0x7')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x3fb1('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x3fb1('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x3fb1('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x3fb1('0x7')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x3fb1('0x7')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x3fb1('0x3')]},'recallmeNotifiedDate':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0x072b=['YYYY-MM-DD\x20HH:mm:ss','INTEGER','DATE','BOOLEAN','contactListQueue','STRING','format'];(function(_0x1db831,_0x42b7b5){var _0x39ba56=function(_0x2c2dd3){while(--_0x2c2dd3){_0x1db831['push'](_0x1db831['shift']());}};_0x39ba56(++_0x42b7b5);}(_0x072b,0x12b));var _0xb072=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x072b[_0x20a584];return _0x4b41a8;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module['exports']={'phone':{'type':Sequelize[_0xb072('0x0')],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0xb072('0x1')](_0xb072('0x2'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xb072('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xb072('0x0')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xb072('0x4')]},'priority':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xb072('0x5')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xb072('0x3')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0xb072('0x3')],'unique':_0xb072('0x6')},'UserId':{'type':Sequelize[_0xb072('0x3')]},'VoiceQueueId':{'type':Sequelize[_0xb072('0x3')],'unique':_0xb072('0x6')},'CampaignId':{'type':Sequelize[_0xb072('0x3')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xb072('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xb072('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xb072('0x3')],'defaultValue':0x0},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xb072('0x0')]},'recallmeNotifiedDate':{'type':Sequelize[_0xb072('0x4')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index 9fb3e5c..93af7cc 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 _0x06f4=['CmHopperFinal','end','getPreview','getVoiceQueues','outbound','dialOrderByScheduledAt','dialPreviewAutoRecallMe','length','sequelize','transaction','direction','prev','hopperIds','priority','ASC','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','isEmpty','scheduledAt','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','recallme','Contact','Company','CmList','List','VoiceQueue','Queue','dialActive','LOCK','CmCompany','preview','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts','entity\x20not\x20found','timezones','push','utcOffset','getTimezone','moment','lodash','../../config/logger','api','status','json','offset','undefined','limit','count','set','update','then','sendStatus','error','name','index','map','CmHopper','fieldName','key','query','intersection','model','concat','$and','$or','$gt','$gte','$lt','$eq','$between','$notBetween','$like','$iLike','$notILike','$overlap','$contains','$contained','$any','attributes','fields','nolimit','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','include','findAll','rows','catch','show','params','keys','includeAll','options','create','body','find','describe','destroy','VoiceQueueId','CampaignId','Campaign','omit','dataValues','createdAt','updatedAt','state','statedesc','deleted','membername','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','queue','ivr','CmContact','ContactId','lastName','isNil','firstName','calleridname','finally'];(function(_0x274025,_0x24fe4a){var _0x48ee45=function(_0x403922){while(--_0x403922){_0x274025['push'](_0x274025['shift']());}};_0x48ee45(++_0x24fe4a);}(_0x06f4,0x136));var _0x406f=function(_0x3a970,_0x5ec74d){_0x3a970=_0x3a970-0x0;var _0x177b94=_0x06f4[_0x3a970];return _0x177b94;};'use strict';var moment=require(_0x406f('0x0'));var _=require(_0x406f('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0x406f('0x2'))(_0x406f('0x3'));var shared=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithResult(_0x3a4ff0,_0x5ed32f){_0x5ed32f=_0x5ed32f||0xc8;return function(_0x32abfd){if(_0x32abfd){return _0x3a4ff0[_0x406f('0x4')](_0x5ed32f)[_0x406f('0x5')](_0x32abfd);}};}function respondWithFilteredResult(_0x32b2bd,_0x59821c){return function(_0x1d2886){if(_0x1d2886){var _0x5bec4f=typeof _0x59821c[_0x406f('0x6')]===_0x406f('0x7')&&typeof _0x59821c[_0x406f('0x8')]==='undefined';var _0x407936=_0x1d2886['count'];var _0x5b46bf=_0x5bec4f?0x0:_0x59821c[_0x406f('0x6')];var _0x56edc2=_0x5bec4f?_0x1d2886[_0x406f('0x9')]:_0x59821c['offset']+_0x59821c[_0x406f('0x8')];var _0x5af7cd;if(_0x56edc2>=_0x407936){_0x56edc2=_0x407936;_0x5af7cd=0xc8;}else{_0x5af7cd=0xce;}_0x32b2bd[_0x406f('0x4')](_0x5af7cd);return _0x32b2bd[_0x406f('0xa')]('Content-Range',_0x5b46bf+'-'+_0x56edc2+'/'+_0x407936)[_0x406f('0x5')](_0x1d2886);}return null;};}function saveUpdates(_0x380382,_0x451592){return function(_0x163de4){if(_0x163de4){return _0x163de4[_0x406f('0xb')](_0x380382)[_0x406f('0xc')](function(_0x29aef9){return _0x29aef9;});}return null;};}function handleEntityNotFound(_0xcc1d6,_0x4522b2){return function(_0x5045e8){if(!_0x5045e8){_0xcc1d6[_0x406f('0xd')](0x194);}return _0x5045e8;};}function handleError(_0x489445,_0x1bf795){_0x1bf795=_0x1bf795||0x1f4;return function(_0x28fda6){logger[_0x406f('0xe')](_0x28fda6['stack']);if(_0x28fda6[_0x406f('0xf')]){delete _0x28fda6[_0x406f('0xf')];}_0x489445['status'](_0x1bf795)['send'](_0x28fda6);};}exports[_0x406f('0x10')]=function(_0x4357e3,_0x509bae){var _0x2e4409={},_0x57d93a={},_0xe186fb={'count':0x0,'rows':[]};var _0x3ad3fe=_[_0x406f('0x11')](db[_0x406f('0x12')]['rawAttributes'],function(_0x492c68){return{'name':_0x492c68[_0x406f('0x13')],'type':_0x492c68['type'][_0x406f('0x14')]};});_0x57d93a['model']=_[_0x406f('0x11')](_0x3ad3fe,_0x406f('0xf'));_0x57d93a[_0x406f('0x15')]=_['keys'](_0x4357e3['query']);_0x57d93a['filters']=_[_0x406f('0x16')](_0x57d93a[_0x406f('0x17')],_0x57d93a[_0x406f('0x15')]);_0x57d93a['filters']=_[_0x406f('0x18')](_0x57d93a['filters'],[_0x406f('0x19'),_0x406f('0x1a'),_0x406f('0x1b'),_0x406f('0x1c'),_0x406f('0x1d'),'$lte','$ne',_0x406f('0x1e'),'$not',_0x406f('0x1f'),_0x406f('0x20'),'$in','$notIn',_0x406f('0x21'),'$notLike',_0x406f('0x22'),_0x406f('0x23'),_0x406f('0x21'),_0x406f('0x24'),_0x406f('0x25'),_0x406f('0x26'),_0x406f('0x27')]);_0x2e4409[_0x406f('0x28')]=_['intersection'](_0x57d93a['model'],qs[_0x406f('0x29')](_0x4357e3[_0x406f('0x15')][_0x406f('0x29')]));_0x2e4409[_0x406f('0x28')]=_0x2e4409['attributes']['length']?_0x2e4409[_0x406f('0x28')]:_0x57d93a[_0x406f('0x17')];if(!_0x4357e3['query']['hasOwnProperty'](_0x406f('0x2a'))){_0x2e4409[_0x406f('0x8')]=qs[_0x406f('0x8')](_0x4357e3[_0x406f('0x15')][_0x406f('0x8')]);_0x2e4409[_0x406f('0x6')]=qs[_0x406f('0x6')](_0x4357e3[_0x406f('0x15')][_0x406f('0x6')]);}_0x2e4409[_0x406f('0x2b')]=qs[_0x406f('0x2c')](_0x4357e3[_0x406f('0x15')][_0x406f('0x2c')]);_0x2e4409['where']=qs[_0x406f('0x2d')](_[_0x406f('0x2e')](_0x4357e3[_0x406f('0x15')],_0x57d93a[_0x406f('0x2d')]),_0x3ad3fe);if(_0x4357e3[_0x406f('0x15')][_0x406f('0x2f')]){_0x2e4409[_0x406f('0x30')]=_[_0x406f('0x31')](_0x2e4409[_0x406f('0x30')],{'$or':_[_0x406f('0x11')](_0x3ad3fe,function(_0x52b465){if(_0x52b465[_0x406f('0x32')]!==_0x406f('0x33')){var _0x36a17a={};_0x36a17a[_0x52b465[_0x406f('0xf')]]={'$like':'%'+_0x4357e3[_0x406f('0x15')][_0x406f('0x2f')]+'%'};return _0x36a17a;}})});}_0x2e4409=_['merge']({},_0x2e4409,_0x4357e3['options']);var _0x44c63a={'where':_0x2e4409[_0x406f('0x30')]};return db['CmHopper'][_0x406f('0x9')](_0x44c63a)['then'](function(_0x43fb4f){_0xe186fb[_0x406f('0x9')]=_0x43fb4f;if(_0x4357e3[_0x406f('0x15')]['includeAll']){_0x2e4409[_0x406f('0x34')]=[{'all':!![]}];}return db[_0x406f('0x12')][_0x406f('0x35')](_0x2e4409);})[_0x406f('0xc')](function(_0x224e9d){_0xe186fb[_0x406f('0x36')]=_0x224e9d;return _0xe186fb;})[_0x406f('0xc')](respondWithFilteredResult(_0x509bae,_0x2e4409))[_0x406f('0x37')](handleError(_0x509bae,null));};exports[_0x406f('0x38')]=function(_0x14c27f,_0x17f217){var _0x37c4d2={'raw':!![],'where':{'id':_0x14c27f[_0x406f('0x39')]['id']}},_0x279e9e={};_0x279e9e[_0x406f('0x17')]=_['keys'](db['CmHopper']['rawAttributes']);_0x279e9e[_0x406f('0x15')]=_[_0x406f('0x3a')](_0x14c27f[_0x406f('0x15')]);_0x279e9e['filters']=_[_0x406f('0x16')](_0x279e9e[_0x406f('0x17')],_0x279e9e[_0x406f('0x15')]);_0x37c4d2[_0x406f('0x28')]=_[_0x406f('0x16')](_0x279e9e[_0x406f('0x17')],qs['fields'](_0x14c27f[_0x406f('0x15')][_0x406f('0x29')]));_0x37c4d2['attributes']=_0x37c4d2[_0x406f('0x28')]['length']?_0x37c4d2['attributes']:_0x279e9e[_0x406f('0x17')];if(_0x14c27f[_0x406f('0x15')][_0x406f('0x3b')]){_0x37c4d2[_0x406f('0x34')]=[{'all':!![]}];}_0x37c4d2=_[_0x406f('0x31')]({},_0x37c4d2,_0x14c27f[_0x406f('0x3c')]);return db['CmHopper']['find'](_0x37c4d2)[_0x406f('0xc')](handleEntityNotFound(_0x17f217,null))[_0x406f('0xc')](respondWithResult(_0x17f217,null))[_0x406f('0x37')](handleError(_0x17f217,null));};exports[_0x406f('0x3d')]=function(_0x453289,_0x2b226e){return db[_0x406f('0x12')]['create'](_0x453289[_0x406f('0x3e')],{})[_0x406f('0xc')](respondWithResult(_0x2b226e,0xc9))[_0x406f('0x37')](handleError(_0x2b226e,null));};exports[_0x406f('0xb')]=function(_0x792ac9,_0x17c499){if(_0x792ac9[_0x406f('0x3e')]['id']){delete _0x792ac9[_0x406f('0x3e')]['id'];}return db[_0x406f('0x12')][_0x406f('0x3f')]({'where':{'id':_0x792ac9[_0x406f('0x39')]['id']}})['then'](handleEntityNotFound(_0x17c499,null))[_0x406f('0xc')](saveUpdates(_0x792ac9[_0x406f('0x3e')],null))['then'](respondWithResult(_0x17c499,null))['catch'](handleError(_0x17c499,null));};exports[_0x406f('0x40')]=function(_0x3eb55b,_0x2a13c3){return db[_0x406f('0x12')]['describe']()[_0x406f('0xc')](respondWithResult(_0x2a13c3,null))['catch'](handleError(_0x2a13c3,null));};exports[_0x406f('0x41')]=function(_0x351d2f,_0x5b1143){var _0x5a91dd;var _0x1bdb59=_0x351d2f[_0x406f('0x39')]['id'];return db[_0x406f('0x12')][_0x406f('0x3f')]({'where':{'id':_0x351d2f['params']['id']}})[_0x406f('0xc')](handleEntityNotFound(_0x5b1143,null))[_0x406f('0xc')](function(_0x8ef14b){if(_0x8ef14b){return _0x8ef14b[_0x406f('0x41')]()['then'](function(_0x5d4041){return _0x5d4041;});}})[_0x406f('0xc')](function(_0x244fcf){_0x5a91dd=_0x244fcf;if(_0x244fcf){if(_0x244fcf[_0x406f('0x42')]||_0x244fcf[_0x406f('0x43')]){return db[_0x244fcf[_0x406f('0x42')]?'VoiceQueue':_0x406f('0x44')][_0x406f('0x3f')]({'where':{'id':_0x244fcf['VoiceQueueId']?_0x244fcf['VoiceQueueId']:_0x244fcf[_0x406f('0x43')]},'attributes':['id',_0x406f('0xf')],'raw':!![]});}}})[_0x406f('0xc')](function(_0x4b0b19){var _0x1a99b9={};if(_0x4b0b19){_[_0x406f('0x31')](_0x1a99b9,_[_0x406f('0x45')](_0x5a91dd[_0x406f('0x46')],[_0x406f('0x47'),_0x406f('0x48'),'id']));_0x1a99b9[_0x406f('0x49')]=0x15;_0x1a99b9[_0x406f('0x4a')]=_0x406f('0x4b');_0x1a99b9['campaign']=_0x4b0b19['name'];_0x1a99b9[_0x406f('0x4c')]=_0x351d2f[_0x406f('0x4d')][_0x406f('0xf')];_0x1a99b9[_0x406f('0x4e')]=_0x351d2f[_0x406f('0x4d')]['id'];_0x1a99b9[_0x406f('0x4b')]=!![];_0x1a99b9[_0x406f('0x4f')]=moment()[_0x406f('0x50')](_0x406f('0x51'));_0x1a99b9[_0x406f('0x52')]=_0x5a91dd['phone'];_0x1a99b9['campaigntype']=_0x5a91dd[_0x406f('0x42')]?_0x406f('0x53'):_0x406f('0x54');return db[_0x406f('0x55')][_0x406f('0x3f')]({'where':{'id':_0x1a99b9[_0x406f('0x56')]},'attributes':['firstName',_0x406f('0x57')]})[_0x406f('0xc')](function(_0x39f7f6){if(!_[_0x406f('0x58')](_0x5b1143)&&!_[_0x406f('0x58')](_0x39f7f6[_0x406f('0x59')])){_0x1a99b9[_0x406f('0x5a')]=_0x39f7f6[_0x406f('0x59')];if(!_[_0x406f('0x58')](_0x39f7f6[_0x406f('0x57')])){_0x1a99b9['calleridname']+='\x20'+_0x39f7f6[_0x406f('0x57')];}}})[_0x406f('0x5b')](function(){return db[_0x406f('0x5c')]['create'](_0x1a99b9);});}})[_0x406f('0xc')](function(_0x538517){return db['CmHopperAdditionalPhone'][_0x406f('0x41')]({'where':{'CmHopperId':_0x1bdb59}});})[_0x406f('0xc')](function(){return _0x5b1143['status'](0xcc)[_0x406f('0x5d')]();})['catch'](handleError(_0x5b1143,null));};exports[_0x406f('0x5e')]=function(_0x4a4bf8,_0x2c3881){var _0x48bca4=[];return db[_0x406f('0x55')][_0x406f('0x40')]()['then'](function(_0x5dd1e8){_0x48bca4=_[_0x406f('0x3a')](_0x5dd1e8);return _0x4a4bf8[_0x406f('0x4d')][_0x406f('0x5f')]({'where':{'type':_0x406f('0x60'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0x406f('0x61'),_0x406f('0x62')],'raw':!![]});})[_0x406f('0xc')](function(_0x41839a){if(_0x41839a&&_0x41839a[_0x406f('0x63')]){return db[_0x406f('0x64')][_0x406f('0x65')](function(_0x5c1a91){var _0x44297b={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x406f('0x51'))},'VoiceQueueId':{'$in':_[_0x406f('0x11')](_0x41839a,'id')},'$or':[{'UserId':null},{'UserId':_0x4a4bf8[_0x406f('0x4d')]['id']}]};var _0x55cac0={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x41839a)[_0x406f('0x2f')]([_0x406f('0x62'),0x0])['map']('id')['value']()},'$or':[{'UserId':null},{'UserId':_0x4a4bf8[_0x406f('0x4d')]['id']}]};var _0x468e2b={'$or':[_0x44297b,_0x55cac0]};var _0x4a150b=[];if(_0x4a4bf8['body']['direction']&&_0x4a4bf8[_0x406f('0x3e')][_0x406f('0x66')]===_0x406f('0x67')){if(!_['isEmpty'](_0x4a4bf8['body'][_0x406f('0x68')])){_0x468e2b['id']={'$in':_0x4a4bf8[_0x406f('0x3e')][_0x406f('0x68')]};}_0x4a150b=[[_0x406f('0x69'),_0x406f('0x6a')],['scheduledAt',_0x41839a[0x0][_0x406f('0x61')]===_0x406f('0x6a')?_0x406f('0x6b'):_0x406f('0x6a')],db[_0x406f('0x64')][_0x406f('0x6c')](_0x406f('0x6d')),['id',_0x406f('0x6b')]];}else{if(!_[_0x406f('0x6e')](_0x4a4bf8[_0x406f('0x3e')][_0x406f('0x68')])){_0x468e2b['id']={'$notIn':_0x4a4bf8[_0x406f('0x3e')][_0x406f('0x68')]};}_0x4a150b=[[_0x406f('0x69'),_0x406f('0x6b')],[_0x406f('0x6f'),_0x41839a[0x0][_0x406f('0x61')]],db['sequelize'][_0x406f('0x6c')](_0x406f('0x70')),['id',_0x406f('0x6a')]];}return db['CmHopper'][_0x406f('0x71')]({'attributes':['id',_0x406f('0x72'),'phone',_0x406f('0x73')],'where':_0x468e2b,'order':_0x4a150b,'transaction':_0x5c1a91,'lock':_0x5c1a91['LOCK']['UPDATE'],'include':[{'model':db[_0x406f('0x55')],'as':_0x406f('0x74'),'attributes':_0x48bca4,'include':[{'model':db['CmCompany'],'as':_0x406f('0x75'),'attributes':['id','name']}]},{'model':db[_0x406f('0x76')],'as':_0x406f('0x77'),'attributes':['id',_0x406f('0xf')]},{'model':db[_0x406f('0x78')],'as':_0x406f('0x79'),'attributes':['id',_0x406f('0xf'),_0x406f('0x7a')]}]})[_0x406f('0xc')](function(_0x3e9e31){if(_0x3e9e31){return _0x3e9e31['update']({'UserId':_0x4a4bf8[_0x406f('0x4d')]['id']},{'transaction':_0x5c1a91});}});});}})['then'](handleEntityNotFound(_0x2c3881,null))[_0x406f('0xc')](respondWithResult(_0x2c3881,null))['catch'](handleError(_0x2c3881,null));};exports['getPreviewRecall']=function(_0x519cd9,_0x14ce45,_0x3f0e29){var _0x2bb105=[];var _0x156fa5=_0x519cd9[_0x406f('0x39')]['id'];var _0x552db1=_0x519cd9['user']['id'];return db['CmContact'][_0x406f('0x40')]()['then'](function(_0x31212a){_0x2bb105=_[_0x406f('0x3a')](_0x31212a);return db[_0x406f('0x64')][_0x406f('0x65')](function(_0x238912){const _0x1b2e3c={'id':_0x156fa5};return db['CmHopper']['findOne']({'attributes':['id',_0x406f('0x72'),_0x406f('0x73')],'where':_0x1b2e3c,'transaction':_0x238912,'lock':_0x238912[_0x406f('0x7b')]['UPDATE'],'include':[{'model':db[_0x406f('0x55')],'as':_0x406f('0x74'),'attributes':_0x2bb105,'include':[{'model':db[_0x406f('0x7c')],'as':_0x406f('0x75'),'attributes':['id',_0x406f('0xf')]}]},{'model':db['CmList'],'as':_0x406f('0x77'),'attributes':['id',_0x406f('0xf')]},{'model':db[_0x406f('0x78')],'as':_0x406f('0x79'),'attributes':['id',_0x406f('0xf'),_0x406f('0x7a')]}]})[_0x406f('0xc')](function(_0x23ae6b){if(_0x23ae6b){return _0x23ae6b['update']({'UserId':_0x552db1},{'transaction':_0x238912});}});});})['then'](handleEntityNotFound(_0x14ce45,null))['then'](respondWithResult(_0x14ce45,null))[_0x406f('0x37')](handleError(_0x14ce45,null));};exports['getOpenContacts']=function(_0x5ec137,_0x2c032b){return _0x5ec137[_0x406f('0x4d')][_0x406f('0x5f')]({'where':{'type':_0x406f('0x60'),'dialActive':!![],'dialMethod':_0x406f('0x7d')},'attributes':['id'],'raw':!![]})['then'](function(_0x58206a){if(_0x58206a&&_0x58206a[_0x406f('0x63')]){return db[_0x406f('0x12')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x406f('0x50')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x406f('0x11')](_0x58206a,'id')},'$or':[{'UserId':null},{'UserId':_0x5ec137[_0x406f('0x4d')]['id']}]}});}return 0x0;})['then'](function(_0x110072){if(!_[_0x406f('0x58')](_0x110072)&&_[_0x406f('0x7e')](_0x110072)){return _0x2c032b[_0x406f('0x4')](0xc8)[_0x406f('0x5')]({'contacts':_0x110072});}else{logger[_0x406f('0xe')](_0x406f('0x7f'),_0x406f('0x80'),0x194,_0x406f('0x81'));_0x2c032b[_0x406f('0xd')](0x194);}})[_0x406f('0x37')](handleError(_0x2c032b,null));};exports['getTimezones']=function(_0x35968c,_0x16791a){var _0x169662=shared[_0x406f('0x82')];var _0x2bf211=[];_[_0x406f('0x11')](_0x169662,function(_0x115736){_0x2bf211[_0x406f('0x83')]({'id':_0x115736[_0x406f('0xf')],'name':_0x115736['name'],'utcOffset':_0x115736[_0x406f('0x84')]});});return _0x16791a[_0x406f('0x4')](0xc8)['json']({'tz':_0x2bf211});};exports[_0x406f('0x85')]=function(_0x2213b4,_0x39fe38){var _0x42a297=shared[_0x406f('0x82')];var _0x2178ac={};if(!_['isNil'](_0x42a297[_0x2213b4[_0x406f('0x3e')]['id']]))_0x2178ac=_0x42a297[_0x2213b4[_0x406f('0x3e')]['id']];return _0x39fe38['status'](0xc8)[_0x406f('0x5')](_0x2178ac);}; \ No newline at end of file +var _0x4bc3=['intersection','concat','$and','$or','$gt','$gte','$lt','$lte','$ne','$eq','$not','$notBetween','$like','$iLike','$notILike','$contains','$contained','$any','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','CmHopper','include','findAll','catch','show','keys','options','find','create','update','body','params','describe','VoiceQueueId','CampaignId','VoiceQueue','omit','state','statedesc','deleted','campaign','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','ivr','CmContact','ContactId','firstName','isNil','calleridname','lastName','finally','CmHopperFinal','CmHopperAdditionalPhone','destroy','end','getPreview','getVoiceQueues','outbound','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','transaction','value','direction','prev','isEmpty','hopperIds','priority','ASC','DESC','COALESCE(CmHopper.UserId,\x200)\x20ASC','scheduledAt','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','recallme','Contact','CmCompany','Company','CmList','List','Queue','dialActive','getPreviewRecall','LOCK','getOpenContacts','preview','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','timezones','push','moment','lodash','../../config/logger','api','../../mysqldb','status','json','undefined','limit','count','offset','Content-Range','then','sendStatus','error','stack','name','map','rawAttributes','type','key','model','query','filters'];(function(_0x32547b,_0x3e39dc){var _0x16bb8b=function(_0x1e2070){while(--_0x1e2070){_0x32547b['push'](_0x32547b['shift']());}};_0x16bb8b(++_0x3e39dc);}(_0x4bc3,0x16e));var _0x34bc=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0x4bc3[_0x5a776b];return _0xbbef59;};'use strict';var moment=require(_0x34bc('0x0'));var _=require(_0x34bc('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0x34bc('0x2'))(_0x34bc('0x3'));var shared=require('../../config/environment');var db=require(_0x34bc('0x4'))['db'];function respondWithResult(_0x616014,_0x3ce1c3){_0x3ce1c3=_0x3ce1c3||0xc8;return function(_0x2e043e){if(_0x2e043e){return _0x616014[_0x34bc('0x5')](_0x3ce1c3)[_0x34bc('0x6')](_0x2e043e);}};}function respondWithFilteredResult(_0x2cc9c2,_0x4c63a1){return function(_0x21451b){if(_0x21451b){var _0x50320d=typeof _0x4c63a1['offset']===_0x34bc('0x7')&&typeof _0x4c63a1[_0x34bc('0x8')]===_0x34bc('0x7');var _0x365e49=_0x21451b[_0x34bc('0x9')];var _0x41b2ff=_0x50320d?0x0:_0x4c63a1['offset'];var _0x5a478d=_0x50320d?_0x21451b[_0x34bc('0x9')]:_0x4c63a1[_0x34bc('0xa')]+_0x4c63a1[_0x34bc('0x8')];var _0x5a608a;if(_0x5a478d>=_0x365e49){_0x5a478d=_0x365e49;_0x5a608a=0xc8;}else{_0x5a608a=0xce;}_0x2cc9c2[_0x34bc('0x5')](_0x5a608a);return _0x2cc9c2['set'](_0x34bc('0xb'),_0x41b2ff+'-'+_0x5a478d+'/'+_0x365e49)[_0x34bc('0x6')](_0x21451b);}return null;};}function saveUpdates(_0x164fb2,_0x536ebd){return function(_0x3f8852){if(_0x3f8852){return _0x3f8852['update'](_0x164fb2)[_0x34bc('0xc')](function(_0x43ff68){return _0x43ff68;});}return null;};}function handleEntityNotFound(_0xc77013,_0x5a22a3){return function(_0x4c365a){if(!_0x4c365a){_0xc77013[_0x34bc('0xd')](0x194);}return _0x4c365a;};}function handleError(_0x5e691b,_0x3e93bf){_0x3e93bf=_0x3e93bf||0x1f4;return function(_0x217605){logger[_0x34bc('0xe')](_0x217605[_0x34bc('0xf')]);if(_0x217605[_0x34bc('0x10')]){delete _0x217605[_0x34bc('0x10')];}_0x5e691b['status'](_0x3e93bf)['send'](_0x217605);};}exports['index']=function(_0x4205eb,_0x3eaedf){var _0x30282b={},_0x239e6c={},_0x567eee={'count':0x0,'rows':[]};var _0x46aa24=_[_0x34bc('0x11')](db['CmHopper'][_0x34bc('0x12')],function(_0x9e9f14){return{'name':_0x9e9f14['fieldName'],'type':_0x9e9f14[_0x34bc('0x13')][_0x34bc('0x14')]};});_0x239e6c[_0x34bc('0x15')]=_[_0x34bc('0x11')](_0x46aa24,_0x34bc('0x10'));_0x239e6c[_0x34bc('0x16')]=_['keys'](_0x4205eb[_0x34bc('0x16')]);_0x239e6c[_0x34bc('0x17')]=_[_0x34bc('0x18')](_0x239e6c['model'],_0x239e6c['query']);_0x239e6c[_0x34bc('0x17')]=_[_0x34bc('0x19')](_0x239e6c[_0x34bc('0x17')],[_0x34bc('0x1a'),_0x34bc('0x1b'),_0x34bc('0x1c'),_0x34bc('0x1d'),_0x34bc('0x1e'),_0x34bc('0x1f'),_0x34bc('0x20'),_0x34bc('0x21'),_0x34bc('0x22'),'$between',_0x34bc('0x23'),'$in','$notIn',_0x34bc('0x24'),'$notLike',_0x34bc('0x25'),_0x34bc('0x26'),_0x34bc('0x24'),'$overlap',_0x34bc('0x27'),_0x34bc('0x28'),_0x34bc('0x29')]);_0x30282b[_0x34bc('0x2a')]=_[_0x34bc('0x18')](_0x239e6c[_0x34bc('0x15')],qs['fields'](_0x4205eb[_0x34bc('0x16')][_0x34bc('0x2b')]));_0x30282b[_0x34bc('0x2a')]=_0x30282b[_0x34bc('0x2a')][_0x34bc('0x2c')]?_0x30282b[_0x34bc('0x2a')]:_0x239e6c['model'];if(!_0x4205eb[_0x34bc('0x16')]['hasOwnProperty']('nolimit')){_0x30282b[_0x34bc('0x8')]=qs['limit'](_0x4205eb[_0x34bc('0x16')][_0x34bc('0x8')]);_0x30282b[_0x34bc('0xa')]=qs[_0x34bc('0xa')](_0x4205eb[_0x34bc('0x16')][_0x34bc('0xa')]);}_0x30282b[_0x34bc('0x2d')]=qs['sort'](_0x4205eb[_0x34bc('0x16')][_0x34bc('0x2e')]);_0x30282b[_0x34bc('0x2f')]=qs[_0x34bc('0x17')](_[_0x34bc('0x30')](_0x4205eb['query'],_0x239e6c[_0x34bc('0x17')]),_0x46aa24);if(_0x4205eb[_0x34bc('0x16')][_0x34bc('0x31')]){_0x30282b[_0x34bc('0x2f')]=_[_0x34bc('0x32')](_0x30282b['where'],{'$or':_['map'](_0x46aa24,function(_0x39e630){if(_0x39e630[_0x34bc('0x13')]!==_0x34bc('0x33')){var _0x128c1c={};_0x128c1c[_0x39e630['name']]={'$like':'%'+_0x4205eb[_0x34bc('0x16')][_0x34bc('0x31')]+'%'};return _0x128c1c;}})});}_0x30282b=_[_0x34bc('0x32')]({},_0x30282b,_0x4205eb['options']);var _0x37cd30={'where':_0x30282b[_0x34bc('0x2f')]};return db[_0x34bc('0x34')][_0x34bc('0x9')](_0x37cd30)['then'](function(_0x2ac72b){_0x567eee[_0x34bc('0x9')]=_0x2ac72b;if(_0x4205eb[_0x34bc('0x16')]['includeAll']){_0x30282b[_0x34bc('0x35')]=[{'all':!![]}];}return db[_0x34bc('0x34')][_0x34bc('0x36')](_0x30282b);})[_0x34bc('0xc')](function(_0x348cea){_0x567eee['rows']=_0x348cea;return _0x567eee;})[_0x34bc('0xc')](respondWithFilteredResult(_0x3eaedf,_0x30282b))[_0x34bc('0x37')](handleError(_0x3eaedf,null));};exports[_0x34bc('0x38')]=function(_0x174cfe,_0xbaf32){var _0x4bf331={'raw':!![],'where':{'id':_0x174cfe['params']['id']}},_0x4105d8={};_0x4105d8[_0x34bc('0x15')]=_[_0x34bc('0x39')](db[_0x34bc('0x34')][_0x34bc('0x12')]);_0x4105d8['query']=_[_0x34bc('0x39')](_0x174cfe[_0x34bc('0x16')]);_0x4105d8['filters']=_[_0x34bc('0x18')](_0x4105d8[_0x34bc('0x15')],_0x4105d8[_0x34bc('0x16')]);_0x4bf331['attributes']=_[_0x34bc('0x18')](_0x4105d8[_0x34bc('0x15')],qs[_0x34bc('0x2b')](_0x174cfe[_0x34bc('0x16')][_0x34bc('0x2b')]));_0x4bf331[_0x34bc('0x2a')]=_0x4bf331[_0x34bc('0x2a')][_0x34bc('0x2c')]?_0x4bf331[_0x34bc('0x2a')]:_0x4105d8[_0x34bc('0x15')];if(_0x174cfe[_0x34bc('0x16')]['includeAll']){_0x4bf331['include']=[{'all':!![]}];}_0x4bf331=_[_0x34bc('0x32')]({},_0x4bf331,_0x174cfe[_0x34bc('0x3a')]);return db[_0x34bc('0x34')][_0x34bc('0x3b')](_0x4bf331)[_0x34bc('0xc')](handleEntityNotFound(_0xbaf32,null))[_0x34bc('0xc')](respondWithResult(_0xbaf32,null))['catch'](handleError(_0xbaf32,null));};exports[_0x34bc('0x3c')]=function(_0x4f912a,_0x3f6a2f){return db[_0x34bc('0x34')][_0x34bc('0x3c')](_0x4f912a['body'],{})[_0x34bc('0xc')](respondWithResult(_0x3f6a2f,0xc9))[_0x34bc('0x37')](handleError(_0x3f6a2f,null));};exports[_0x34bc('0x3d')]=function(_0x1c6480,_0x21b903){if(_0x1c6480[_0x34bc('0x3e')]['id']){delete _0x1c6480[_0x34bc('0x3e')]['id'];}return db[_0x34bc('0x34')][_0x34bc('0x3b')]({'where':{'id':_0x1c6480[_0x34bc('0x3f')]['id']}})[_0x34bc('0xc')](handleEntityNotFound(_0x21b903,null))[_0x34bc('0xc')](saveUpdates(_0x1c6480['body'],null))['then'](respondWithResult(_0x21b903,null))[_0x34bc('0x37')](handleError(_0x21b903,null));};exports[_0x34bc('0x40')]=function(_0x180a51,_0x51116e){return db['CmHopper'][_0x34bc('0x40')]()[_0x34bc('0xc')](respondWithResult(_0x51116e,null))[_0x34bc('0x37')](handleError(_0x51116e,null));};exports['destroy']=function(_0x43bfb7,_0x25b02e){var _0x49286b;var _0x4627de=_0x43bfb7['params']['id'];return db[_0x34bc('0x34')]['find']({'where':{'id':_0x43bfb7[_0x34bc('0x3f')]['id']}})[_0x34bc('0xc')](handleEntityNotFound(_0x25b02e,null))[_0x34bc('0xc')](function(_0x374271){if(_0x374271){return _0x374271['destroy']()[_0x34bc('0xc')](function(_0x2bbd0b){return _0x2bbd0b;});}})[_0x34bc('0xc')](function(_0x42a96b){_0x49286b=_0x42a96b;if(_0x42a96b){if(_0x42a96b[_0x34bc('0x41')]||_0x42a96b[_0x34bc('0x42')]){return db[_0x42a96b[_0x34bc('0x41')]?_0x34bc('0x43'):'Campaign']['find']({'where':{'id':_0x42a96b['VoiceQueueId']?_0x42a96b[_0x34bc('0x41')]:_0x42a96b[_0x34bc('0x42')]},'attributes':['id','name'],'raw':!![]});}}})[_0x34bc('0xc')](function(_0xe7b515){var _0x2a38c3={};if(_0xe7b515){_[_0x34bc('0x32')](_0x2a38c3,_[_0x34bc('0x44')](_0x49286b['dataValues'],['createdAt','updatedAt','id']));_0x2a38c3[_0x34bc('0x45')]=0x15;_0x2a38c3[_0x34bc('0x46')]=_0x34bc('0x47');_0x2a38c3[_0x34bc('0x48')]=_0xe7b515[_0x34bc('0x10')];_0x2a38c3['membername']=_0x43bfb7[_0x34bc('0x49')][_0x34bc('0x10')];_0x2a38c3[_0x34bc('0x4a')]=_0x43bfb7[_0x34bc('0x49')]['id'];_0x2a38c3['deleted']=!![];_0x2a38c3[_0x34bc('0x4b')]=moment()[_0x34bc('0x4c')](_0x34bc('0x4d'));_0x2a38c3[_0x34bc('0x4e')]=_0x49286b[_0x34bc('0x4f')];_0x2a38c3[_0x34bc('0x50')]=_0x49286b[_0x34bc('0x41')]?_0x34bc('0x51'):_0x34bc('0x52');return db[_0x34bc('0x53')][_0x34bc('0x3b')]({'where':{'id':_0x2a38c3[_0x34bc('0x54')]},'attributes':[_0x34bc('0x55'),'lastName']})[_0x34bc('0xc')](function(_0x2cc1f5){if(!_[_0x34bc('0x56')](_0x25b02e)&&!_[_0x34bc('0x56')](_0x2cc1f5[_0x34bc('0x55')])){_0x2a38c3[_0x34bc('0x57')]=_0x2cc1f5[_0x34bc('0x55')];if(!_[_0x34bc('0x56')](_0x2cc1f5[_0x34bc('0x58')])){_0x2a38c3[_0x34bc('0x57')]+='\x20'+_0x2cc1f5[_0x34bc('0x58')];}}})[_0x34bc('0x59')](function(){return db[_0x34bc('0x5a')][_0x34bc('0x3c')](_0x2a38c3);});}})['then'](function(_0x1e0a00){return db[_0x34bc('0x5b')][_0x34bc('0x5c')]({'where':{'CmHopperId':_0x4627de}});})[_0x34bc('0xc')](function(){return _0x25b02e[_0x34bc('0x5')](0xcc)[_0x34bc('0x5d')]();})[_0x34bc('0x37')](handleError(_0x25b02e,null));};exports[_0x34bc('0x5e')]=function(_0x47068c,_0x32041a){var _0x5ba13a=[];return db[_0x34bc('0x53')][_0x34bc('0x40')]()[_0x34bc('0xc')](function(_0x582931){_0x5ba13a=_[_0x34bc('0x39')](_0x582931);return _0x47068c[_0x34bc('0x49')][_0x34bc('0x5f')]({'where':{'type':_0x34bc('0x60'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0x34bc('0x61'),_0x34bc('0x62')],'raw':!![]});})[_0x34bc('0xc')](function(_0xfbc469){if(_0xfbc469&&_0xfbc469[_0x34bc('0x2c')]){return db[_0x34bc('0x63')][_0x34bc('0x64')](function(_0x3b8f72){var _0x4e9409={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x34bc('0x4d'))},'VoiceQueueId':{'$in':_[_0x34bc('0x11')](_0xfbc469,'id')},'$or':[{'UserId':null},{'UserId':_0x47068c[_0x34bc('0x49')]['id']}]};var _0x1aad17={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0xfbc469)[_0x34bc('0x31')]([_0x34bc('0x62'),0x0])[_0x34bc('0x11')]('id')[_0x34bc('0x65')]()},'$or':[{'UserId':null},{'UserId':_0x47068c[_0x34bc('0x49')]['id']}]};var _0x3b1eb9={'$or':[_0x4e9409,_0x1aad17]};var _0x161a75=[];if(_0x47068c[_0x34bc('0x3e')][_0x34bc('0x66')]&&_0x47068c[_0x34bc('0x3e')]['direction']===_0x34bc('0x67')){if(!_[_0x34bc('0x68')](_0x47068c[_0x34bc('0x3e')]['hopperIds'])){_0x3b1eb9['id']={'$in':_0x47068c[_0x34bc('0x3e')][_0x34bc('0x69')]};}_0x161a75=[[_0x34bc('0x6a'),_0x34bc('0x6b')],['scheduledAt',_0xfbc469[0x0][_0x34bc('0x61')]===_0x34bc('0x6b')?_0x34bc('0x6c'):_0x34bc('0x6b')],db[_0x34bc('0x63')]['literal'](_0x34bc('0x6d')),['id',_0x34bc('0x6c')]];}else{if(!_[_0x34bc('0x68')](_0x47068c[_0x34bc('0x3e')]['hopperIds'])){_0x3b1eb9['id']={'$notIn':_0x47068c[_0x34bc('0x3e')][_0x34bc('0x69')]};}_0x161a75=[[_0x34bc('0x6a'),_0x34bc('0x6c')],[_0x34bc('0x6e'),_0xfbc469[0x0][_0x34bc('0x61')]],db['sequelize']['literal'](_0x34bc('0x6f')),['id',_0x34bc('0x6b')]];}return db['CmHopper'][_0x34bc('0x70')]({'attributes':['id',_0x34bc('0x71'),_0x34bc('0x4f'),_0x34bc('0x72')],'where':_0x3b1eb9,'order':_0x161a75,'transaction':_0x3b8f72,'lock':_0x3b8f72['LOCK']['UPDATE'],'include':[{'model':db[_0x34bc('0x53')],'as':_0x34bc('0x73'),'attributes':_0x5ba13a,'include':[{'model':db[_0x34bc('0x74')],'as':_0x34bc('0x75'),'attributes':['id',_0x34bc('0x10')]}]},{'model':db[_0x34bc('0x76')],'as':_0x34bc('0x77'),'attributes':['id',_0x34bc('0x10')]},{'model':db[_0x34bc('0x43')],'as':_0x34bc('0x78'),'attributes':['id',_0x34bc('0x10'),_0x34bc('0x79')]}]})[_0x34bc('0xc')](function(_0xa62d58){if(_0xa62d58){return _0xa62d58[_0x34bc('0x3d')]({'UserId':_0x47068c[_0x34bc('0x49')]['id']},{'transaction':_0x3b8f72});}});});}})['then'](handleEntityNotFound(_0x32041a,null))[_0x34bc('0xc')](respondWithResult(_0x32041a,null))[_0x34bc('0x37')](handleError(_0x32041a,null));};exports[_0x34bc('0x7a')]=function(_0x1a7269,_0x1507bb,_0x48b13c){var _0x415c29=[];var _0x2d68f6=_0x1a7269[_0x34bc('0x3f')]['id'];var _0x464e1c=_0x1a7269[_0x34bc('0x49')]['id'];return db['CmContact'][_0x34bc('0x40')]()[_0x34bc('0xc')](function(_0x1b783c){_0x415c29=_[_0x34bc('0x39')](_0x1b783c);return db[_0x34bc('0x63')][_0x34bc('0x64')](function(_0x5ad6ce){const _0x1a882b={'id':_0x2d68f6};return db[_0x34bc('0x34')]['findOne']({'attributes':['id',_0x34bc('0x71'),_0x34bc('0x72')],'where':_0x1a882b,'transaction':_0x5ad6ce,'lock':_0x5ad6ce[_0x34bc('0x7b')]['UPDATE'],'include':[{'model':db['CmContact'],'as':_0x34bc('0x73'),'attributes':_0x415c29,'include':[{'model':db['CmCompany'],'as':'Company','attributes':['id','name']}]},{'model':db[_0x34bc('0x76')],'as':_0x34bc('0x77'),'attributes':['id',_0x34bc('0x10')]},{'model':db['VoiceQueue'],'as':_0x34bc('0x78'),'attributes':['id',_0x34bc('0x10'),_0x34bc('0x79')]}]})[_0x34bc('0xc')](function(_0x142231){if(_0x142231){return _0x142231[_0x34bc('0x3d')]({'UserId':_0x464e1c},{'transaction':_0x5ad6ce});}});});})[_0x34bc('0xc')](handleEntityNotFound(_0x1507bb,null))[_0x34bc('0xc')](respondWithResult(_0x1507bb,null))[_0x34bc('0x37')](handleError(_0x1507bb,null));};exports[_0x34bc('0x7c')]=function(_0x3716f8,_0x16240e){return _0x3716f8['user']['getVoiceQueues']({'where':{'type':_0x34bc('0x60'),'dialActive':!![],'dialMethod':_0x34bc('0x7d')},'attributes':['id'],'raw':!![]})[_0x34bc('0xc')](function(_0x2423a3){if(_0x2423a3&&_0x2423a3[_0x34bc('0x2c')]){return db[_0x34bc('0x34')][_0x34bc('0x9')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x34bc('0x4c')](_0x34bc('0x4d'))},'VoiceQueueId':{'$in':_[_0x34bc('0x11')](_0x2423a3,'id')},'$or':[{'UserId':null},{'UserId':_0x3716f8['user']['id']}]}});}return 0x0;})[_0x34bc('0xc')](function(_0x2fdbd8){if(!_[_0x34bc('0x56')](_0x2fdbd8)&&_[_0x34bc('0x7e')](_0x2fdbd8)){return _0x16240e[_0x34bc('0x5')](0xc8)[_0x34bc('0x6')]({'contacts':_0x2fdbd8});}else{logger[_0x34bc('0xe')](_0x34bc('0x7f'),_0x34bc('0x7c'),0x194,'entity\x20not\x20found');_0x16240e[_0x34bc('0xd')](0x194);}})['catch'](handleError(_0x16240e,null));};exports['getTimezones']=function(_0x21a70a,_0x5dac93){var _0x4d25e2=shared[_0x34bc('0x80')];var _0x47275a=[];_['map'](_0x4d25e2,function(_0x139fcc){_0x47275a[_0x34bc('0x81')]({'id':_0x139fcc[_0x34bc('0x10')],'name':_0x139fcc[_0x34bc('0x10')],'utcOffset':_0x139fcc['utcOffset']});});return _0x5dac93[_0x34bc('0x5')](0xc8)[_0x34bc('0x6')]({'tz':_0x47275a});};exports['getTimezone']=function(_0x4ea0d8,_0x49da95){var _0x18c493=shared[_0x34bc('0x80')];var _0x1d9ca2={};if(!_[_0x34bc('0x56')](_0x18c493[_0x4ea0d8[_0x34bc('0x3e')]['id']]))_0x1d9ca2=_0x18c493[_0x4ea0d8[_0x34bc('0x3e')]['id']];return _0x49da95[_0x34bc('0x5')](0xc8)[_0x34bc('0x6')](_0x1d9ca2);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 5773a69..903d6b6 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 _0x5496=['request-promise','rimraf','../../config/environment','./cmHopper.attributes','define','cm_hopper','scheduledat','phone','priority','lodash','util','../../config/logger','api','moment'];(function(_0x6b51a9,_0x3d0c09){var _0x52b3d8=function(_0x331162){while(--_0x331162){_0x6b51a9['push'](_0x6b51a9['shift']());}};_0x52b3d8(++_0x3d0c09);}(_0x5496,0x175));var _0x6549=function(_0x25aca8,_0x427dfb){_0x25aca8=_0x25aca8-0x0;var _0x37a508=_0x5496[_0x25aca8];return _0x37a508;};'use strict';var _=require(_0x6549('0x0'));var util=require(_0x6549('0x1'));var logger=require(_0x6549('0x2'))(_0x6549('0x3'));var moment=require(_0x6549('0x4'));var BPromise=require('bluebird');var rp=require(_0x6549('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6549('0x6'));var config=require(_0x6549('0x7'));var attributes=require(_0x6549('0x8'));module['exports']=function(_0x5a4658,_0x43cb17){return _0x5a4658[_0x6549('0x9')]('CmHopper',attributes,{'tableName':_0x6549('0xa'),'paranoid':![],'indexes':[{'name':_0x6549('0xb'),'fields':[_0x6549('0xb')]},{'name':'phone','fields':[_0x6549('0xc')]},{'name':_0x6549('0xd'),'fields':[_0x6549('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5d17=['define','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','util','moment','bluebird','request-promise','rimraf','../../config/environment','./cmHopper.attributes','exports'];(function(_0x360586,_0x35c5af){var _0x1d8eb3=function(_0x4648a4){while(--_0x4648a4){_0x360586['push'](_0x360586['shift']());}};_0x1d8eb3(++_0x35c5af);}(_0x5d17,0x114));var _0x75d1=function(_0x4e3843,_0x571529){_0x4e3843=_0x4e3843-0x0;var _0x2537db=_0x5d17[_0x4e3843];return _0x2537db;};'use strict';var _=require(_0x75d1('0x0'));var util=require(_0x75d1('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x75d1('0x2'));var BPromise=require(_0x75d1('0x3'));var rp=require(_0x75d1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x75d1('0x5'));var config=require(_0x75d1('0x6'));var attributes=require(_0x75d1('0x7'));module[_0x75d1('0x8')]=function(_0x56ac0a,_0x458681){return _0x56ac0a[_0x75d1('0x9')](_0x75d1('0xa'),attributes,{'tableName':_0x75d1('0xb'),'paranoid':![],'indexes':[{'name':_0x75d1('0xc'),'fields':[_0x75d1('0xc')]},{'name':_0x75d1('0xd'),'fields':['phone']},{'name':'priority','fields':[_0x75d1('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 cda432f..15990fc 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 _0xceab=['ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','name','CmList','List','lodash','moment','bluebird','../../config/logger','rpc','client','http','request','info','CmHopper,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','CmHopper','findAll','options','raw','where','attributes','limit','include','map','model','then','GetCmHopper','stringify','ShowCmHopper','find','CreateCmHopper','body','UpdateCmHopper','update','active','destroy','DestroyCmHopper','GetContactDialer','CmContact','sequelize','order','LOCK','UPDATE','Contact','User','Agent','voicePause','length','UserId','push','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','MoveContactManagedDialer','transaction','create','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','describe','GetContactByPhone','phone','dialTimezone','getContactByPhone'];(function(_0x4402cd,_0x4b9938){var _0xfaa5e2=function(_0xf58c04){while(--_0xf58c04){_0x4402cd['push'](_0x4402cd['shift']());}};_0xfaa5e2(++_0x4b9938);}(_0xceab,0x106));var _0xbcea=function(_0x556a8a,_0x496f92){_0x556a8a=_0x556a8a-0x0;var _0x22a836=_0xceab[_0x556a8a];return _0x22a836;};'use strict';var _=require(_0xbcea('0x0'));var util=require('util');var moment=require(_0xbcea('0x1'));var BPromise=require(_0xbcea('0x2'));var db=require('../../mysqldb')['db'];var logger=require(_0xbcea('0x3'))(_0xbcea('0x4'));var jayson=require('jayson/promise');var client=jayson[_0xbcea('0x5')][_0xbcea('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x487c71,_0x19d6f5,_0x42d6e6){return new BPromise(function(_0x240f60,_0x331fd0){return client[_0xbcea('0x7')](_0x487c71,_0x42d6e6)['then'](function(_0x445b9b){logger[_0xbcea('0x8')](_0xbcea('0x9'),_0x19d6f5,_0xbcea('0xa'));logger[_0xbcea('0xb')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x19d6f5,_0xbcea('0xa'),JSON['stringify'](_0x445b9b));if(_0x445b9b[_0xbcea('0xc')]){if(_0x445b9b[_0xbcea('0xc')][_0xbcea('0xd')]===0x1f4){logger[_0xbcea('0xc')](_0xbcea('0x9'),_0x19d6f5,_0x445b9b[_0xbcea('0xc')][_0xbcea('0xe')]);return _0x331fd0(_0x445b9b['error'][_0xbcea('0xe')]);}logger[_0xbcea('0xc')](_0xbcea('0x9'),_0x19d6f5,_0x445b9b['error'][_0xbcea('0xe')]);return _0x240f60(_0x445b9b['error']['message']);}else{logger[_0xbcea('0x8')](_0xbcea('0x9'),_0x19d6f5,_0xbcea('0xa'));_0x240f60(_0x445b9b[_0xbcea('0xf')][_0xbcea('0xe')]);}})[_0xbcea('0x10')](function(_0x4f205f){logger[_0xbcea('0xc')]('CmHopper,\x20%s,\x20%s',_0x19d6f5,_0x4f205f);_0x331fd0(_0x4f205f);});});}exports['GetCmHopper']=function(_0x5c3ace){var _0x2b808c=this;return new Promise(function(_0x1487d8,_0x59e63c){return db[_0xbcea('0x11')][_0xbcea('0x12')]({'raw':_0x5c3ace[_0xbcea('0x13')]?_0x5c3ace[_0xbcea('0x13')][_0xbcea('0x14')]===undefined?!![]:![]:!![],'where':_0x5c3ace[_0xbcea('0x13')]?_0x5c3ace[_0xbcea('0x13')][_0xbcea('0x15')]||null:null,'attributes':_0x5c3ace[_0xbcea('0x13')]?_0x5c3ace[_0xbcea('0x13')][_0xbcea('0x16')]||null:null,'limit':_0x5c3ace[_0xbcea('0x13')]?_0x5c3ace[_0xbcea('0x13')][_0xbcea('0x17')]||null:null,'include':_0x5c3ace['options']?_0x5c3ace[_0xbcea('0x13')][_0xbcea('0x18')]?_[_0xbcea('0x19')](_0x5c3ace[_0xbcea('0x13')]['include'],function(_0x597d50){return{'model':db[_0x597d50[_0xbcea('0x1a')]],'as':_0x597d50['as'],'attributes':_0x597d50[_0xbcea('0x16')],'include':_0x597d50[_0xbcea('0x18')]?_['map'](_0x597d50[_0xbcea('0x18')],function(_0x576aa3){return{'model':db[_0x576aa3['model']],'as':_0x576aa3['as'],'attributes':_0x576aa3['attributes'],'include':_0x576aa3[_0xbcea('0x18')]?_[_0xbcea('0x19')](_0x576aa3[_0xbcea('0x18')],function(_0x1a601d){return{'model':db[_0x1a601d[_0xbcea('0x1a')]],'as':_0x1a601d['as'],'attributes':_0x1a601d[_0xbcea('0x16')]};}):[]};}):[]};}):[]:[]})[_0xbcea('0x1b')](function(_0x418c89){logger[_0xbcea('0x8')]('GetCmHopper',_0x5c3ace);logger[_0xbcea('0xb')](_0xbcea('0x1c'),_0x5c3ace,JSON[_0xbcea('0x1d')](_0x418c89));_0x1487d8(_0x418c89);})['catch'](function(_0x4e956f){logger[_0xbcea('0xc')](_0xbcea('0x1c'),_0x4e956f[_0xbcea('0xe')],_0x5c3ace);_0x59e63c(_0x2b808c['error'](0x1f4,_0x4e956f[_0xbcea('0xe')]));});});};exports[_0xbcea('0x1e')]=function(_0xf0a869){var _0x423a54=this;return new Promise(function(_0x1393a5,_0x2a7468){return db[_0xbcea('0x11')][_0xbcea('0x1f')]({'raw':_0xf0a869[_0xbcea('0x13')]?_0xf0a869[_0xbcea('0x13')]['raw']===undefined?!![]:![]:!![],'where':_0xf0a869['options']?_0xf0a869[_0xbcea('0x13')][_0xbcea('0x15')]||null:null,'attributes':_0xf0a869[_0xbcea('0x13')]?_0xf0a869[_0xbcea('0x13')][_0xbcea('0x16')]||null:null,'include':_0xf0a869[_0xbcea('0x13')]?_0xf0a869['options']['include']?_['map'](_0xf0a869[_0xbcea('0x13')][_0xbcea('0x18')],function(_0x1e2670){return{'model':db[_0x1e2670[_0xbcea('0x1a')]],'as':_0x1e2670['as'],'attributes':_0x1e2670[_0xbcea('0x16')],'include':_0x1e2670[_0xbcea('0x18')]?_[_0xbcea('0x19')](_0x1e2670[_0xbcea('0x18')],function(_0x5f57ec){return{'model':db[_0x5f57ec['model']],'as':_0x5f57ec['as'],'attributes':_0x5f57ec['attributes'],'include':_0x5f57ec[_0xbcea('0x18')]?_['map'](_0x5f57ec[_0xbcea('0x18')],function(_0x5292e7){return{'model':db[_0x5292e7['model']],'as':_0x5292e7['as'],'attributes':_0x5292e7[_0xbcea('0x16')]};}):[]};}):[]};}):[]:[]})[_0xbcea('0x1b')](function(_0x4b92d5){logger[_0xbcea('0x8')](_0xbcea('0x1e'),_0xf0a869);logger[_0xbcea('0xb')]('ShowCmHopper',_0xf0a869,JSON[_0xbcea('0x1d')](_0x4b92d5));_0x1393a5(_0x4b92d5);})['catch'](function(_0x1af241){logger[_0xbcea('0xc')](_0xbcea('0x1e'),_0x1af241[_0xbcea('0xe')],_0xf0a869);_0x2a7468(_0x423a54[_0xbcea('0xc')](0x1f4,_0x1af241[_0xbcea('0xe')]));});});};exports[_0xbcea('0x20')]=function(_0x5bafd3){var _0x5465c2=this;return new Promise(function(_0xa7e4d1,_0x53f6ae){return db[_0xbcea('0x11')]['create'](_0x5bafd3[_0xbcea('0x21')],{'raw':_0x5bafd3[_0xbcea('0x13')]?_0x5bafd3[_0xbcea('0x13')][_0xbcea('0x14')]===undefined?!![]:![]:!![]})[_0xbcea('0x1b')](function(_0x169136){logger['info'](_0xbcea('0x20'),_0x5bafd3);logger[_0xbcea('0xb')](_0xbcea('0x20'),_0x5bafd3,JSON[_0xbcea('0x1d')](_0x169136));_0xa7e4d1(_0x169136);})['catch'](function(_0x3e1cdf){logger['error'](_0xbcea('0x20'),_0x3e1cdf[_0xbcea('0xe')],_0x5bafd3);_0x53f6ae(_0x5465c2[_0xbcea('0xc')](0x1f4,_0x3e1cdf['message']));});});};exports[_0xbcea('0x22')]=function(_0x4ba3eb){var _0x2d587c=this;return new Promise(function(_0x3a6d0a,_0x34e19b){return db[_0xbcea('0x11')][_0xbcea('0x23')](_0x4ba3eb['body'],{'raw':_0x4ba3eb['options']?_0x4ba3eb[_0xbcea('0x13')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4ba3eb[_0xbcea('0x13')]?_0x4ba3eb[_0xbcea('0x13')][_0xbcea('0x15')]||null:null,'attributes':_0x4ba3eb[_0xbcea('0x13')]?_0x4ba3eb[_0xbcea('0x13')][_0xbcea('0x16')]||null:null,'limit':_0x4ba3eb[_0xbcea('0x13')]?_0x4ba3eb[_0xbcea('0x13')][_0xbcea('0x17')]||null:null})[_0xbcea('0x1b')](function(_0x114453){logger[_0xbcea('0x8')](_0xbcea('0x22'),_0x4ba3eb);logger['info']('UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0xbcea('0x1d')](_0x4ba3eb[_0xbcea('0x13')][_0xbcea('0x15')]),_0x4ba3eb[_0xbcea('0x21')][_0xbcea('0x24')]);logger[_0xbcea('0xb')](_0xbcea('0x22'),_0x4ba3eb,JSON[_0xbcea('0x1d')](_0x114453));_0x3a6d0a(_0x114453);})[_0xbcea('0x10')](function(_0x4665f5){logger[_0xbcea('0xc')](_0xbcea('0x22'),_0x4665f5[_0xbcea('0xe')],_0x4ba3eb);_0x34e19b(_0x2d587c[_0xbcea('0xc')](0x1f4,_0x4665f5[_0xbcea('0xe')]));});});};exports['DestroyCmHopper']=function(_0x409204){var _0x6b6817=this;return new Promise(function(_0x5d315f,_0x48ab77){return db[_0xbcea('0x11')][_0xbcea('0x25')]({'where':_0x409204['options']?_0x409204[_0xbcea('0x13')][_0xbcea('0x15')]||null:null})['then'](function(_0x3f83f1){logger['info'](_0xbcea('0x26'),_0x409204);logger[_0xbcea('0xb')](_0xbcea('0x26'),_0x409204,JSON[_0xbcea('0x1d')](_0x3f83f1));_0x5d315f(_0x3f83f1);})[_0xbcea('0x10')](function(_0x5cb081){logger['error'](_0xbcea('0x26'),_0x5cb081[_0xbcea('0xe')],_0x409204);_0x48ab77(_0x6b6817['error'](0x1f4,_0x5cb081[_0xbcea('0xe')]));});});};exports[_0xbcea('0x27')]=function(_0xe852f1){var _0x3ee0bd=this;return new Promise(function(_0xa3cb6f,_0xc38abc){return db[_0xbcea('0x28')]['describe']()['then'](function(_0x259262){return db[_0xbcea('0x29')]['transaction'](function(_0xb6002e){return db[_0xbcea('0x11')][_0xbcea('0x12')]({'where':_0xe852f1[_0xbcea('0x13')]?_0xe852f1[_0xbcea('0x13')][_0xbcea('0x15')]||null:null,'attributes':_0xe852f1[_0xbcea('0x13')]?_0xe852f1['options'][_0xbcea('0x16')]||null:null,'limit':_0xe852f1['options']?_0xe852f1[_0xbcea('0x13')][_0xbcea('0x17')]||null:null,'order':_0xe852f1['options']?_0xe852f1[_0xbcea('0x13')][_0xbcea('0x2a')]||null:null,'transaction':_0xb6002e,'lock':_0xb6002e[_0xbcea('0x2b')][_0xbcea('0x2c')],'include':[{'model':db[_0xbcea('0x28')],'as':_0xbcea('0x2d'),'attributes':_['keys'](_0x259262)},{'model':db[_0xbcea('0x2e')],'as':_0xbcea('0x2f'),'attributes':['id','name',_0xbcea('0x30')]}]})[_0xbcea('0x1b')](function(_0x545e30){var _0x25669d=[];var _0x4c8534=[];for(var _0x77f5b2=0x0;_0x77f5b2<_0x545e30[_0xbcea('0x31')];_0x77f5b2+=0x1){var _0x2e5d7d=_0x545e30[_0x77f5b2][_0xbcea('0x32')];if(_0x2e5d7d===null){_0x25669d[_0xbcea('0x33')](_0x545e30[_0x77f5b2][_0xbcea('0x23')](_0xe852f1[_0xbcea('0x21')],{'transaction':_0xb6002e}));}else if(!_0x4c8534['includes'](_0x2e5d7d)){_0x4c8534['push'](_0x2e5d7d);_0x25669d[_0xbcea('0x33')](_0x545e30[_0x77f5b2][_0xbcea('0x23')](_0xe852f1[_0xbcea('0x21')],{'transaction':_0xb6002e}));}}return BPromise[_0xbcea('0x34')](_0x25669d);});})['then'](function(_0xc2476a){logger[_0xbcea('0x8')](_0xbcea('0x27'),_0xe852f1);if(_0xc2476a['length']>0x0){logger['info'](_0xbcea('0x35'),_0xc2476a[0x0][_0xbcea('0x36')]['id'],_0xc2476a[0x0][_0xbcea('0x36')][_0xbcea('0x37')],_0xc2476a[0x0][_0xbcea('0x36')][_0xbcea('0x24')]);}logger[_0xbcea('0xb')](_0xbcea('0x27'),_0xe852f1,JSON[_0xbcea('0x1d')](_0xc2476a));_0xa3cb6f(_0xc2476a);})[_0xbcea('0x10')](function(_0x248de9){logger[_0xbcea('0xc')](_0xbcea('0x27'),_0x248de9['message'],_0xe852f1);_0xc38abc(_0x3ee0bd['error'](0x1f4,_0x248de9[_0xbcea('0xe')]));});});});};exports[_0xbcea('0x38')]=function(_0x4c6db6){var _0x4e6973=this;return new Promise(function(_0x2f2982,_0x260b57){return db[_0xbcea('0x29')][_0xbcea('0x39')](function(_0x3c92ab){return db['CmHopperFinal'][_0xbcea('0x3a')](_0x4c6db6[_0xbcea('0x21')],{'raw':_0x4c6db6[_0xbcea('0x13')]?_0x4c6db6[_0xbcea('0x13')][_0xbcea('0x14')]===undefined?!![]:![]:!![],'transaction':_0x3c92ab})[_0xbcea('0x1b')](function(){logger[_0xbcea('0x8')](_0xbcea('0x3b'),JSON[_0xbcea('0x1d')](_0x4c6db6[_0xbcea('0x13')]['where']),_0x4c6db6[_0xbcea('0x13')]['where'][_0xbcea('0x24')]);return db[_0xbcea('0x11')][_0xbcea('0x25')]({'where':_0x4c6db6[_0xbcea('0x13')]?_0x4c6db6['options'][_0xbcea('0x15')]||null:null,'transaction':_0x3c92ab});});})['then'](function(_0x48a750){logger[_0xbcea('0x8')](_0xbcea('0x38'),_0x4c6db6);logger[_0xbcea('0xb')](_0xbcea('0x38'),_0x4c6db6,JSON[_0xbcea('0x1d')](_0x48a750));_0x2f2982(_0x48a750);})[_0xbcea('0x10')](function(_0x43adf4){logger[_0xbcea('0xc')](_0xbcea('0x38'),_0x43adf4[_0xbcea('0xe')],_0x4c6db6);_0x260b57(_0x4e6973['error'](0x1f4,_0x43adf4[_0xbcea('0xe')]));});});};exports[_0xbcea('0x3c')]=function(_0x37685e){var _0x3c268d=this;return new Promise(function(_0x4abae4,_0x262c25){return db['CmHopper'][_0xbcea('0x12')]({'raw':_0x37685e[_0xbcea('0x13')]?_0x37685e[_0xbcea('0x13')][_0xbcea('0x14')]===undefined?!![]:![]:!![],'where':_0x37685e[_0xbcea('0x13')]?_0x37685e[_0xbcea('0x13')][_0xbcea('0x15')]||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db[_0xbcea('0x29')]['fn']('IF',db['sequelize'][_0xbcea('0x3d')](_0xbcea('0x3e')+util[_0xbcea('0x3f')](_0xbcea('0x40'),moment()['format'](_0xbcea('0x41')))+_0xbcea('0x42')))),_0xbcea('0x43')]]})['then'](function(_0x316f7c){logger['info'](_0xbcea('0x3c'),_0x37685e);logger[_0xbcea('0xb')](_0xbcea('0x3c'),_0x37685e,JSON[_0xbcea('0x1d')](_0x316f7c));_0x4abae4(_0x316f7c);})[_0xbcea('0x10')](function(_0x18d266){logger[_0xbcea('0xc')](_0xbcea('0x3c'),_0x18d266[_0xbcea('0xe')],_0x37685e);_0x262c25(_0x3c268d[_0xbcea('0xc')](0x1f4,_0x18d266[_0xbcea('0xe')]));});});};exports[_0xbcea('0x44')]=function(_0x9b2251){var _0x156355=this;return new Promise(function(_0x3d89a7,_0x423b76){return db[_0xbcea('0x28')][_0xbcea('0x45')]()[_0xbcea('0x1b')](function(_0x19b31f){return db['sequelize']['transaction'](function(_0x59b7a1){return db[_0xbcea('0x11')]['findAll']({'where':_0x9b2251[_0xbcea('0x13')]?_0x9b2251['options'][_0xbcea('0x15')]||null:null,'attributes':_0x9b2251[_0xbcea('0x13')]?_0x9b2251[_0xbcea('0x13')][_0xbcea('0x16')]||null:null,'limit':0x1,'order':_0x9b2251[_0xbcea('0x13')]?_0x9b2251['options']['order']||null:null,'group':db[_0xbcea('0x11')][_0xbcea('0x32')],'transaction':_0x59b7a1,'lock':_0x59b7a1['LOCK'][_0xbcea('0x2c')],'include':_0x9b2251['options']?_0x9b2251['options']['include']?_[_0xbcea('0x19')](_0x9b2251['options'][_0xbcea('0x18')],function(_0x3a865b){return{'model':db[_0x3a865b['model']],'as':_0x3a865b['as'],'attributes':_0x3a865b[_0xbcea('0x16')],'include':_0x3a865b[_0xbcea('0x18')]?_['map'](_0x3a865b[_0xbcea('0x18')],function(_0x51a245){return{'model':db[_0x51a245[_0xbcea('0x1a')]],'as':_0x51a245['as'],'attributes':_0x51a245[_0xbcea('0x16')],'include':_0x51a245[_0xbcea('0x18')]?_[_0xbcea('0x19')](_0x51a245[_0xbcea('0x18')],function(_0x8790d4){return{'model':db[_0x8790d4[_0xbcea('0x1a')]],'as':_0x8790d4['as'],'attributes':_0x8790d4[_0xbcea('0x16')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x34e3c0){var _0x41bd22=[];for(var _0x24d3c3=0x0;_0x24d3c3<_0x34e3c0[_0xbcea('0x31')];_0x24d3c3+=0x1){_0x41bd22[_0xbcea('0x33')](_0x34e3c0[_0x24d3c3][_0xbcea('0x23')](_0x9b2251[_0xbcea('0x21')],{'transaction':_0x59b7a1}));}return BPromise[_0xbcea('0x34')](_0x41bd22);});})[_0xbcea('0x1b')](function(_0x3f5f28){logger[_0xbcea('0x8')]('GetContactRecallMe',_0x9b2251);logger['debug'](_0xbcea('0x44'),_0x9b2251,JSON[_0xbcea('0x1d')](_0x3f5f28));_0x3d89a7(_0x3f5f28);})[_0xbcea('0x10')](function(_0xc19edc){logger[_0xbcea('0xc')]('GetContactRecallMe',_0xc19edc['message'],_0x9b2251);_0x423b76(_0x156355[_0xbcea('0xc')](0x1f4,_0xc19edc[_0xbcea('0xe')]));});});});};exports['GetCmHopperPreview']=function(_0x36c1a7){var _0x27ed7b=this;return new Promise(function(_0x2d2133,_0x367839){db[_0xbcea('0x28')][_0xbcea('0x45')]()[_0xbcea('0x1b')](function(_0x2b40a5){return db[_0xbcea('0x11')][_0xbcea('0x12')]({'raw':_0x36c1a7[_0xbcea('0x13')]?_0x36c1a7[_0xbcea('0x13')][_0xbcea('0x14')]===undefined?!![]:![]:!![],'where':_0x36c1a7[_0xbcea('0x13')]?_0x36c1a7[_0xbcea('0x13')][_0xbcea('0x15')]||null:null,'attributes':_0x36c1a7[_0xbcea('0x13')]?_0x36c1a7[_0xbcea('0x13')][_0xbcea('0x16')]||null:null,'limit':_0x36c1a7[_0xbcea('0x13')]?_0x36c1a7[_0xbcea('0x13')][_0xbcea('0x17')]||null:null,'include':_0x36c1a7['options']?_0x36c1a7[_0xbcea('0x13')][_0xbcea('0x18')]?_['map'](_0x36c1a7[_0xbcea('0x13')][_0xbcea('0x18')],function(_0x3539a2){return{'model':db[_0x3539a2[_0xbcea('0x1a')]],'as':_0x3539a2['as'],'attributes':_0x3539a2['as']===_0xbcea('0x2d')?_['keys'](_0x2b40a5):_0x3539a2['attributes'],'include':_0x3539a2[_0xbcea('0x18')]?_[_0xbcea('0x19')](_0x3539a2[_0xbcea('0x18')],function(_0x169880){return{'model':db[_0x169880['model']],'as':_0x169880['as'],'attributes':_0x169880[_0xbcea('0x16')],'include':_0x169880[_0xbcea('0x18')]?_[_0xbcea('0x19')](_0x169880['include'],function(_0x3f7159){return{'model':db[_0x3f7159[_0xbcea('0x1a')]],'as':_0x3f7159['as'],'attributes':_0x3f7159['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x44d694){logger['info'](_0xbcea('0x1c'),_0x36c1a7);logger['debug'](_0xbcea('0x1c'),_0x36c1a7,JSON[_0xbcea('0x1d')](_0x44d694));_0x2d2133(_0x44d694);})[_0xbcea('0x10')](function(_0x574ac2){logger[_0xbcea('0xc')](_0xbcea('0x1c'),_0x574ac2['message'],_0x36c1a7);_0x367839(_0x27ed7b[_0xbcea('0xc')](0x1f4,_0x574ac2[_0xbcea('0xe')]));});});});};exports[_0xbcea('0x46')]=function(_0x47709a){var _0x246374=this;return new Promise(function(_0x1abd3e,_0x290426){return db[_0xbcea('0x28')]['findOne']({'raw':!![],'where':{'phone':_0x47709a['options'][_0xbcea('0x15')][_0xbcea('0x47')]},'attributes':['id',_0xbcea('0x48')],'order':[['id','DESC']]})[_0xbcea('0x1b')](function(_0xb8861d){logger[_0xbcea('0x8')]('getContactByPhone',_0x47709a);logger[_0xbcea('0xb')](_0xbcea('0x49'),_0x47709a,JSON[_0xbcea('0x1d')](_0xb8861d));_0x1abd3e(_0xb8861d);})[_0xbcea('0x10')](function(_0x6d0cac){logger[_0xbcea('0xc')]('getContactByPhone',_0x6d0cac[_0xbcea('0xe')],_0x47709a);_0x290426(_0x246374['error'](0x1f4,_0x6d0cac[_0xbcea('0xe')]));});});};exports[_0xbcea('0x4a')]=function(_0x3d6304){var _0x1c9b13=this;return new Promise(function(_0x3ae4ba,_0x3ed87a){return db[_0xbcea('0x29')][_0xbcea('0x39')](function(_0x129f90){return db['CmHopper'][_0xbcea('0x23')]({'active':![]},{'where':{},'transaction':_0x129f90})[_0xbcea('0x1b')](function(_0x244e9b){logger[_0xbcea('0x8')](_0xbcea('0x4a'),_0x3d6304);logger[_0xbcea('0xb')](_0xbcea('0x4a'),_0x3d6304,JSON[_0xbcea('0x1d')](_0x244e9b));_0x3ae4ba(_0x244e9b);})[_0xbcea('0x10')](function(_0xce90ee){logger[_0xbcea('0xc')](_0xbcea('0x4a'),_0xce90ee[_0xbcea('0xe')],_0x3d6304);_0x3ed87a(_0x1c9b13[_0xbcea('0xc')](0x1f4,_0xce90ee[_0xbcea('0xe')]));});});});};exports[_0xbcea('0x4b')]=function(_0x57f62b){var _0x3ef315=this;var _0x2daf89=_0x57f62b[_0xbcea('0x21')][_0xbcea('0x15')][_0xbcea('0x4c')];var _0x4d4c76=_0x57f62b['body'][_0xbcea('0x15')][_0xbcea('0x4d')];var _0x1145e9=_0x57f62b[_0xbcea('0x21')][_0xbcea('0x15')]['availableAgentsIds'];return new Promise(function(_0x3eecc1,_0x553025){return db[_0xbcea('0x11')][_0xbcea('0x12')]({'where':{'voiceQueueId':{'$in':_0x2daf89},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db['sequelize'][_0xbcea('0x3d')](_0xbcea('0x4e')+_0x4d4c76+_0xbcea('0x4f')),'$gt':db[_0xbcea('0x29')][_0xbcea('0x3d')](_0xbcea('0x50'))}},'UserId':{'$in':_0x1145e9}},'include':[{'model':db[_0xbcea('0x28')],'as':_0xbcea('0x2d')},{'model':db['User'],'as':_0xbcea('0x2f'),'attributes':['id',_0xbcea('0x51'),_0xbcea('0x30')]},{'model':db[_0xbcea('0x52')],'as':_0xbcea('0x53')}]})[_0xbcea('0x1b')](function(_0x1028a9){if(_0x1028a9[_0xbcea('0x31')]>0x0){return db['sequelize'][_0xbcea('0x39')](function(_0x5b2ed4){return db[_0xbcea('0x11')][_0xbcea('0x23')]({'recallmeNotifiedDate':db[_0xbcea('0x29')][_0xbcea('0x3d')](_0xbcea('0x50'))},{'where':{'id':{'$in':_[_0xbcea('0x19')](_0x1028a9,'id')}},'transaction':_0x5b2ed4})[_0xbcea('0x1b')](function(){_0x3eecc1(_0x1028a9);})[_0xbcea('0x10')](function(_0x4dad3a){logger['error'](_0xbcea('0x4b'),_0x4dad3a[_0xbcea('0xe')],_0x57f62b);_0x553025(_0x3ef315[_0xbcea('0xc')](0x1f4,_0x4dad3a[_0xbcea('0xe')]));});})[_0xbcea('0x10')](function(_0x433b58){logger[_0xbcea('0xc')](_0xbcea('0x4b'),_0x433b58[_0xbcea('0xe')],_0x57f62b);_0x553025(_0x3ef315[_0xbcea('0xc')](0x1f4,_0x433b58[_0xbcea('0xe')]));});}else{_0x3eecc1(_0x1028a9);}});});}; \ No newline at end of file +var _0xd945=['transaction','findAll','order','LOCK','UPDATE','CmContact','Contact','keys','User','Agent','voicePause','UserId','push','includes','GetContactDialer','length','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','ContactId','MoveContactManagedDialer','sequelize','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','COUNT','literal','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','GetCmHopperPreview','GetContactByPhone','findOne','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','name','CmList','List','NOW()','lodash','util','moment','../../mysqldb','../../config/logger','rpc','jayson/promise','client','then','info','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','error','code','CmHopper,\x20%s,\x20%s','message','result','catch','CmHopper','options','raw','where','attributes','limit','include','map','model','GetCmHopper','stringify','ShowCmHopper','find','CreateCmHopper','create','UpdateCmHopper','update','body','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','describe'];(function(_0x281f57,_0x5d1a2f){var _0x994844=function(_0x2f16af){while(--_0x2f16af){_0x281f57['push'](_0x281f57['shift']());}};_0x994844(++_0x5d1a2f);}(_0xd945,0x84));var _0x5d94=function(_0x372389,_0x53a95c){_0x372389=_0x372389-0x0;var _0x23ce48=_0xd945[_0x372389];return _0x23ce48;};'use strict';var _=require(_0x5d94('0x0'));var util=require(_0x5d94('0x1'));var moment=require(_0x5d94('0x2'));var BPromise=require('bluebird');var db=require(_0x5d94('0x3'))['db'];var logger=require(_0x5d94('0x4'))(_0x5d94('0x5'));var jayson=require(_0x5d94('0x6'));var client=jayson[_0x5d94('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x353703,_0x42296b,_0x30b667){return new BPromise(function(_0x3056d3,_0x3635a6){return client['request'](_0x353703,_0x30b667)[_0x5d94('0x8')](function(_0x34fa30){logger[_0x5d94('0x9')]('CmHopper,\x20%s,\x20%s',_0x42296b,_0x5d94('0xa'));logger[_0x5d94('0xb')](_0x5d94('0xc'),_0x42296b,_0x5d94('0xa'),JSON['stringify'](_0x34fa30));if(_0x34fa30[_0x5d94('0xd')]){if(_0x34fa30['error'][_0x5d94('0xe')]===0x1f4){logger[_0x5d94('0xd')](_0x5d94('0xf'),_0x42296b,_0x34fa30[_0x5d94('0xd')][_0x5d94('0x10')]);return _0x3635a6(_0x34fa30[_0x5d94('0xd')][_0x5d94('0x10')]);}logger[_0x5d94('0xd')](_0x5d94('0xf'),_0x42296b,_0x34fa30[_0x5d94('0xd')]['message']);return _0x3056d3(_0x34fa30[_0x5d94('0xd')][_0x5d94('0x10')]);}else{logger['info'](_0x5d94('0xf'),_0x42296b,_0x5d94('0xa'));_0x3056d3(_0x34fa30[_0x5d94('0x11')][_0x5d94('0x10')]);}})[_0x5d94('0x12')](function(_0x452a88){logger['error']('CmHopper,\x20%s,\x20%s',_0x42296b,_0x452a88);_0x3635a6(_0x452a88);});});}exports['GetCmHopper']=function(_0x38d3c7){var _0x470c8b=this;return new Promise(function(_0x1ef529,_0x133ee5){return db[_0x5d94('0x13')]['findAll']({'raw':_0x38d3c7[_0x5d94('0x14')]?_0x38d3c7[_0x5d94('0x14')][_0x5d94('0x15')]===undefined?!![]:![]:!![],'where':_0x38d3c7[_0x5d94('0x14')]?_0x38d3c7[_0x5d94('0x14')][_0x5d94('0x16')]||null:null,'attributes':_0x38d3c7[_0x5d94('0x14')]?_0x38d3c7[_0x5d94('0x14')][_0x5d94('0x17')]||null:null,'limit':_0x38d3c7[_0x5d94('0x14')]?_0x38d3c7[_0x5d94('0x14')][_0x5d94('0x18')]||null:null,'include':_0x38d3c7[_0x5d94('0x14')]?_0x38d3c7['options'][_0x5d94('0x19')]?_[_0x5d94('0x1a')](_0x38d3c7[_0x5d94('0x14')][_0x5d94('0x19')],function(_0x2b867b){return{'model':db[_0x2b867b[_0x5d94('0x1b')]],'as':_0x2b867b['as'],'attributes':_0x2b867b[_0x5d94('0x17')],'include':_0x2b867b[_0x5d94('0x19')]?_[_0x5d94('0x1a')](_0x2b867b[_0x5d94('0x19')],function(_0x100aa2){return{'model':db[_0x100aa2[_0x5d94('0x1b')]],'as':_0x100aa2['as'],'attributes':_0x100aa2[_0x5d94('0x17')],'include':_0x100aa2[_0x5d94('0x19')]?_[_0x5d94('0x1a')](_0x100aa2['include'],function(_0x374c3f){return{'model':db[_0x374c3f[_0x5d94('0x1b')]],'as':_0x374c3f['as'],'attributes':_0x374c3f[_0x5d94('0x17')]};}):[]};}):[]};}):[]:[]})[_0x5d94('0x8')](function(_0x3241a7){logger[_0x5d94('0x9')](_0x5d94('0x1c'),_0x38d3c7);logger[_0x5d94('0xb')](_0x5d94('0x1c'),_0x38d3c7,JSON[_0x5d94('0x1d')](_0x3241a7));_0x1ef529(_0x3241a7);})[_0x5d94('0x12')](function(_0x4a0398){logger['error'](_0x5d94('0x1c'),_0x4a0398['message'],_0x38d3c7);_0x133ee5(_0x470c8b[_0x5d94('0xd')](0x1f4,_0x4a0398[_0x5d94('0x10')]));});});};exports[_0x5d94('0x1e')]=function(_0x43ee02){var _0x2d90f4=this;return new Promise(function(_0x27a401,_0x124b59){return db[_0x5d94('0x13')][_0x5d94('0x1f')]({'raw':_0x43ee02[_0x5d94('0x14')]?_0x43ee02['options']['raw']===undefined?!![]:![]:!![],'where':_0x43ee02[_0x5d94('0x14')]?_0x43ee02[_0x5d94('0x14')][_0x5d94('0x16')]||null:null,'attributes':_0x43ee02['options']?_0x43ee02['options']['attributes']||null:null,'include':_0x43ee02[_0x5d94('0x14')]?_0x43ee02['options'][_0x5d94('0x19')]?_[_0x5d94('0x1a')](_0x43ee02[_0x5d94('0x14')][_0x5d94('0x19')],function(_0x460e4e){return{'model':db[_0x460e4e[_0x5d94('0x1b')]],'as':_0x460e4e['as'],'attributes':_0x460e4e[_0x5d94('0x17')],'include':_0x460e4e[_0x5d94('0x19')]?_['map'](_0x460e4e[_0x5d94('0x19')],function(_0x247056){return{'model':db[_0x247056[_0x5d94('0x1b')]],'as':_0x247056['as'],'attributes':_0x247056[_0x5d94('0x17')],'include':_0x247056['include']?_['map'](_0x247056[_0x5d94('0x19')],function(_0x57aace){return{'model':db[_0x57aace['model']],'as':_0x57aace['as'],'attributes':_0x57aace[_0x5d94('0x17')]};}):[]};}):[]};}):[]:[]})[_0x5d94('0x8')](function(_0x4f67a2){logger['info'](_0x5d94('0x1e'),_0x43ee02);logger[_0x5d94('0xb')]('ShowCmHopper',_0x43ee02,JSON[_0x5d94('0x1d')](_0x4f67a2));_0x27a401(_0x4f67a2);})[_0x5d94('0x12')](function(_0x416c30){logger[_0x5d94('0xd')](_0x5d94('0x1e'),_0x416c30[_0x5d94('0x10')],_0x43ee02);_0x124b59(_0x2d90f4[_0x5d94('0xd')](0x1f4,_0x416c30[_0x5d94('0x10')]));});});};exports[_0x5d94('0x20')]=function(_0x12c118){var _0x4f16e6=this;return new Promise(function(_0xd15523,_0x26614b){return db[_0x5d94('0x13')][_0x5d94('0x21')](_0x12c118['body'],{'raw':_0x12c118[_0x5d94('0x14')]?_0x12c118[_0x5d94('0x14')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x158cf4){logger[_0x5d94('0x9')](_0x5d94('0x20'),_0x12c118);logger[_0x5d94('0xb')](_0x5d94('0x20'),_0x12c118,JSON['stringify'](_0x158cf4));_0xd15523(_0x158cf4);})[_0x5d94('0x12')](function(_0x5a4646){logger[_0x5d94('0xd')](_0x5d94('0x20'),_0x5a4646['message'],_0x12c118);_0x26614b(_0x4f16e6[_0x5d94('0xd')](0x1f4,_0x5a4646[_0x5d94('0x10')]));});});};exports[_0x5d94('0x22')]=function(_0x4b9b02){var _0x1bcbcb=this;return new Promise(function(_0x4b7617,_0x5e4156){return db['CmHopper'][_0x5d94('0x23')](_0x4b9b02[_0x5d94('0x24')],{'raw':_0x4b9b02[_0x5d94('0x14')]?_0x4b9b02[_0x5d94('0x14')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b9b02[_0x5d94('0x14')]?_0x4b9b02[_0x5d94('0x14')]['where']||null:null,'attributes':_0x4b9b02['options']?_0x4b9b02[_0x5d94('0x14')][_0x5d94('0x17')]||null:null,'limit':_0x4b9b02['options']?_0x4b9b02[_0x5d94('0x14')]['limit']||null:null})[_0x5d94('0x8')](function(_0x54d3aa){logger[_0x5d94('0x9')](_0x5d94('0x22'),_0x4b9b02);logger[_0x5d94('0x9')](_0x5d94('0x25'),JSON[_0x5d94('0x1d')](_0x4b9b02[_0x5d94('0x14')]['where']),_0x4b9b02[_0x5d94('0x24')][_0x5d94('0x26')]);logger[_0x5d94('0xb')](_0x5d94('0x22'),_0x4b9b02,JSON['stringify'](_0x54d3aa));_0x4b7617(_0x54d3aa);})[_0x5d94('0x12')](function(_0x51eeec){logger['error'](_0x5d94('0x22'),_0x51eeec[_0x5d94('0x10')],_0x4b9b02);_0x5e4156(_0x1bcbcb[_0x5d94('0xd')](0x1f4,_0x51eeec[_0x5d94('0x10')]));});});};exports[_0x5d94('0x27')]=function(_0x16c8a4){var _0x56516d=this;return new Promise(function(_0x486e1a,_0x25d315){return db[_0x5d94('0x13')][_0x5d94('0x28')]({'where':_0x16c8a4[_0x5d94('0x14')]?_0x16c8a4[_0x5d94('0x14')][_0x5d94('0x16')]||null:null})[_0x5d94('0x8')](function(_0x5ce78c){logger[_0x5d94('0x9')](_0x5d94('0x27'),_0x16c8a4);logger['debug'](_0x5d94('0x27'),_0x16c8a4,JSON[_0x5d94('0x1d')](_0x5ce78c));_0x486e1a(_0x5ce78c);})[_0x5d94('0x12')](function(_0x20b2bc){logger[_0x5d94('0xd')](_0x5d94('0x27'),_0x20b2bc[_0x5d94('0x10')],_0x16c8a4);_0x25d315(_0x56516d[_0x5d94('0xd')](0x1f4,_0x20b2bc['message']));});});};exports['GetContactDialer']=function(_0x1ffcdf){var _0x38d21a=this;return new Promise(function(_0x1a9bf1,_0x134689){return db['CmContact'][_0x5d94('0x29')]()[_0x5d94('0x8')](function(_0x174e25){return db['sequelize'][_0x5d94('0x2a')](function(_0x2e49ff){return db[_0x5d94('0x13')][_0x5d94('0x2b')]({'where':_0x1ffcdf['options']?_0x1ffcdf[_0x5d94('0x14')][_0x5d94('0x16')]||null:null,'attributes':_0x1ffcdf[_0x5d94('0x14')]?_0x1ffcdf['options'][_0x5d94('0x17')]||null:null,'limit':_0x1ffcdf[_0x5d94('0x14')]?_0x1ffcdf[_0x5d94('0x14')]['limit']||null:null,'order':_0x1ffcdf[_0x5d94('0x14')]?_0x1ffcdf[_0x5d94('0x14')][_0x5d94('0x2c')]||null:null,'transaction':_0x2e49ff,'lock':_0x2e49ff[_0x5d94('0x2d')][_0x5d94('0x2e')],'include':[{'model':db[_0x5d94('0x2f')],'as':_0x5d94('0x30'),'attributes':_[_0x5d94('0x31')](_0x174e25)},{'model':db[_0x5d94('0x32')],'as':_0x5d94('0x33'),'attributes':['id','name',_0x5d94('0x34')]}]})[_0x5d94('0x8')](function(_0x900963){var _0xc27d01=[];var _0x32944c=[];for(var _0x2ba161=0x0;_0x2ba161<_0x900963['length'];_0x2ba161+=0x1){var _0x1381f1=_0x900963[_0x2ba161][_0x5d94('0x35')];if(_0x1381f1===null){_0xc27d01[_0x5d94('0x36')](_0x900963[_0x2ba161][_0x5d94('0x23')](_0x1ffcdf[_0x5d94('0x24')],{'transaction':_0x2e49ff}));}else if(!_0x32944c[_0x5d94('0x37')](_0x1381f1)){_0x32944c[_0x5d94('0x36')](_0x1381f1);_0xc27d01[_0x5d94('0x36')](_0x900963[_0x2ba161][_0x5d94('0x23')](_0x1ffcdf['body'],{'transaction':_0x2e49ff}));}}return BPromise['all'](_0xc27d01);});})[_0x5d94('0x8')](function(_0x51de26){logger[_0x5d94('0x9')](_0x5d94('0x38'),_0x1ffcdf);if(_0x51de26[_0x5d94('0x39')]>0x0){logger[_0x5d94('0x9')](_0x5d94('0x3a'),_0x51de26[0x0]['dataValues']['id'],_0x51de26[0x0]['dataValues'][_0x5d94('0x3b')],_0x51de26[0x0]['dataValues'][_0x5d94('0x26')]);}logger[_0x5d94('0xb')](_0x5d94('0x38'),_0x1ffcdf,JSON[_0x5d94('0x1d')](_0x51de26));_0x1a9bf1(_0x51de26);})[_0x5d94('0x12')](function(_0x483c73){logger[_0x5d94('0xd')]('GetContactDialer',_0x483c73[_0x5d94('0x10')],_0x1ffcdf);_0x134689(_0x38d21a[_0x5d94('0xd')](0x1f4,_0x483c73[_0x5d94('0x10')]));});});});};exports[_0x5d94('0x3c')]=function(_0x3ffd95){var _0x30edc8=this;return new Promise(function(_0x3356c2,_0x2f721d){return db[_0x5d94('0x3d')][_0x5d94('0x2a')](function(_0x370d49){return db[_0x5d94('0x3e')][_0x5d94('0x21')](_0x3ffd95[_0x5d94('0x24')],{'raw':_0x3ffd95[_0x5d94('0x14')]?_0x3ffd95[_0x5d94('0x14')][_0x5d94('0x15')]===undefined?!![]:![]:!![],'transaction':_0x370d49})[_0x5d94('0x8')](function(){logger[_0x5d94('0x9')](_0x5d94('0x3f'),JSON[_0x5d94('0x1d')](_0x3ffd95[_0x5d94('0x14')]['where']),_0x3ffd95[_0x5d94('0x14')]['where']['active']);return db[_0x5d94('0x13')][_0x5d94('0x28')]({'where':_0x3ffd95['options']?_0x3ffd95[_0x5d94('0x14')][_0x5d94('0x16')]||null:null,'transaction':_0x370d49});});})[_0x5d94('0x8')](function(_0x306baa){logger[_0x5d94('0x9')](_0x5d94('0x3c'),_0x3ffd95);logger[_0x5d94('0xb')](_0x5d94('0x3c'),_0x3ffd95,JSON[_0x5d94('0x1d')](_0x306baa));_0x3356c2(_0x306baa);})[_0x5d94('0x12')](function(_0x4285f4){logger['error'](_0x5d94('0x3c'),_0x4285f4[_0x5d94('0x10')],_0x3ffd95);_0x2f721d(_0x30edc8[_0x5d94('0xd')](0x1f4,_0x4285f4[_0x5d94('0x10')]));});});};exports[_0x5d94('0x40')]=function(_0x51dedb){var _0x6a4ccd=this;return new Promise(function(_0x2bb7c2,_0x3b59e3){return db['CmHopper']['findAll']({'raw':_0x51dedb[_0x5d94('0x14')]?_0x51dedb['options'][_0x5d94('0x15')]===undefined?!![]:![]:!![],'where':_0x51dedb[_0x5d94('0x14')]?_0x51dedb[_0x5d94('0x14')][_0x5d94('0x16')]||null:null,'attributes':[[db[_0x5d94('0x3d')]['fn'](_0x5d94('0x41'),db[_0x5d94('0x3d')]['fn']('IF',db[_0x5d94('0x3d')][_0x5d94('0x42')]('`scheduledat`\x20>=\x20'+util[_0x5d94('0x43')]('\x22%s\x22',moment()[_0x5d94('0x43')](_0x5d94('0x44')))+_0x5d94('0x45')))),_0x5d94('0x46')]]})[_0x5d94('0x8')](function(_0x5deac8){logger['info'](_0x5d94('0x40'),_0x51dedb);logger[_0x5d94('0xb')](_0x5d94('0x40'),_0x51dedb,JSON[_0x5d94('0x1d')](_0x5deac8));_0x2bb7c2(_0x5deac8);})[_0x5d94('0x12')](function(_0x36ac76){logger[_0x5d94('0xd')](_0x5d94('0x40'),_0x36ac76[_0x5d94('0x10')],_0x51dedb);_0x3b59e3(_0x6a4ccd['error'](0x1f4,_0x36ac76[_0x5d94('0x10')]));});});};exports[_0x5d94('0x47')]=function(_0x4cc339){var _0x27911d=this;return new Promise(function(_0x4ddb87,_0x5f45a9){return db[_0x5d94('0x2f')]['describe']()[_0x5d94('0x8')](function(_0x195dd8){return db[_0x5d94('0x3d')][_0x5d94('0x2a')](function(_0x8a97a9){return db['CmHopper'][_0x5d94('0x2b')]({'where':_0x4cc339[_0x5d94('0x14')]?_0x4cc339[_0x5d94('0x14')]['where']||null:null,'attributes':_0x4cc339[_0x5d94('0x14')]?_0x4cc339[_0x5d94('0x14')]['attributes']||null:null,'limit':0x1,'order':_0x4cc339[_0x5d94('0x14')]?_0x4cc339[_0x5d94('0x14')][_0x5d94('0x2c')]||null:null,'group':db['CmHopper'][_0x5d94('0x35')],'transaction':_0x8a97a9,'lock':_0x8a97a9[_0x5d94('0x2d')]['UPDATE'],'include':_0x4cc339[_0x5d94('0x14')]?_0x4cc339[_0x5d94('0x14')][_0x5d94('0x19')]?_['map'](_0x4cc339[_0x5d94('0x14')][_0x5d94('0x19')],function(_0x12fd02){return{'model':db[_0x12fd02['model']],'as':_0x12fd02['as'],'attributes':_0x12fd02[_0x5d94('0x17')],'include':_0x12fd02[_0x5d94('0x19')]?_[_0x5d94('0x1a')](_0x12fd02[_0x5d94('0x19')],function(_0x2e20a5){return{'model':db[_0x2e20a5[_0x5d94('0x1b')]],'as':_0x2e20a5['as'],'attributes':_0x2e20a5[_0x5d94('0x17')],'include':_0x2e20a5[_0x5d94('0x19')]?_[_0x5d94('0x1a')](_0x2e20a5[_0x5d94('0x19')],function(_0x5253f4){return{'model':db[_0x5253f4[_0x5d94('0x1b')]],'as':_0x5253f4['as'],'attributes':_0x5253f4['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x158939){var _0x4e13aa=[];for(var _0x2f8ab1=0x0;_0x2f8ab1<_0x158939[_0x5d94('0x39')];_0x2f8ab1+=0x1){_0x4e13aa[_0x5d94('0x36')](_0x158939[_0x2f8ab1][_0x5d94('0x23')](_0x4cc339['body'],{'transaction':_0x8a97a9}));}return BPromise['all'](_0x4e13aa);});})[_0x5d94('0x8')](function(_0x156da9){logger[_0x5d94('0x9')](_0x5d94('0x47'),_0x4cc339);logger[_0x5d94('0xb')](_0x5d94('0x47'),_0x4cc339,JSON[_0x5d94('0x1d')](_0x156da9));_0x4ddb87(_0x156da9);})['catch'](function(_0x3ae559){logger[_0x5d94('0xd')](_0x5d94('0x47'),_0x3ae559[_0x5d94('0x10')],_0x4cc339);_0x5f45a9(_0x27911d[_0x5d94('0xd')](0x1f4,_0x3ae559['message']));});});});};exports[_0x5d94('0x48')]=function(_0x2911ae){var _0x474b50=this;return new Promise(function(_0x23c6e5,_0x56f639){db[_0x5d94('0x2f')][_0x5d94('0x29')]()[_0x5d94('0x8')](function(_0xcc8815){return db[_0x5d94('0x13')][_0x5d94('0x2b')]({'raw':_0x2911ae[_0x5d94('0x14')]?_0x2911ae[_0x5d94('0x14')][_0x5d94('0x15')]===undefined?!![]:![]:!![],'where':_0x2911ae[_0x5d94('0x14')]?_0x2911ae[_0x5d94('0x14')][_0x5d94('0x16')]||null:null,'attributes':_0x2911ae[_0x5d94('0x14')]?_0x2911ae['options']['attributes']||null:null,'limit':_0x2911ae[_0x5d94('0x14')]?_0x2911ae[_0x5d94('0x14')][_0x5d94('0x18')]||null:null,'include':_0x2911ae[_0x5d94('0x14')]?_0x2911ae[_0x5d94('0x14')][_0x5d94('0x19')]?_[_0x5d94('0x1a')](_0x2911ae[_0x5d94('0x14')][_0x5d94('0x19')],function(_0x34c631){return{'model':db[_0x34c631['model']],'as':_0x34c631['as'],'attributes':_0x34c631['as']==='Contact'?_[_0x5d94('0x31')](_0xcc8815):_0x34c631['attributes'],'include':_0x34c631['include']?_['map'](_0x34c631['include'],function(_0x1e565d){return{'model':db[_0x1e565d['model']],'as':_0x1e565d['as'],'attributes':_0x1e565d[_0x5d94('0x17')],'include':_0x1e565d['include']?_[_0x5d94('0x1a')](_0x1e565d[_0x5d94('0x19')],function(_0x3b8904){return{'model':db[_0x3b8904[_0x5d94('0x1b')]],'as':_0x3b8904['as'],'attributes':_0x3b8904['attributes']};}):[]};}):[]};}):[]:[]})[_0x5d94('0x8')](function(_0x54530f){logger[_0x5d94('0x9')](_0x5d94('0x1c'),_0x2911ae);logger[_0x5d94('0xb')](_0x5d94('0x1c'),_0x2911ae,JSON['stringify'](_0x54530f));_0x23c6e5(_0x54530f);})[_0x5d94('0x12')](function(_0x1a97b0){logger[_0x5d94('0xd')](_0x5d94('0x1c'),_0x1a97b0[_0x5d94('0x10')],_0x2911ae);_0x56f639(_0x474b50[_0x5d94('0xd')](0x1f4,_0x1a97b0['message']));});});});};exports[_0x5d94('0x49')]=function(_0x2540ee){var _0x33d33b=this;return new Promise(function(_0x4c46be,_0x2a82f0){return db[_0x5d94('0x2f')][_0x5d94('0x4a')]({'raw':!![],'where':{'phone':_0x2540ee[_0x5d94('0x14')][_0x5d94('0x16')]['phone']},'attributes':['id','dialTimezone'],'order':[['id',_0x5d94('0x4b')]]})[_0x5d94('0x8')](function(_0x55ae28){logger[_0x5d94('0x9')](_0x5d94('0x4c'),_0x2540ee);logger[_0x5d94('0xb')](_0x5d94('0x4c'),_0x2540ee,JSON['stringify'](_0x55ae28));_0x4c46be(_0x55ae28);})[_0x5d94('0x12')](function(_0x1c52b2){logger['error']('getContactByPhone',_0x1c52b2[_0x5d94('0x10')],_0x2540ee);_0x2a82f0(_0x33d33b[_0x5d94('0xd')](0x1f4,_0x1c52b2[_0x5d94('0x10')]));});});};exports[_0x5d94('0x4d')]=function(_0x138922){var _0x383c98=this;return new Promise(function(_0x51fe9c,_0x4cbf88){return db[_0x5d94('0x3d')][_0x5d94('0x2a')](function(_0x335eb6){return db[_0x5d94('0x13')][_0x5d94('0x23')]({'active':![]},{'where':{},'transaction':_0x335eb6})[_0x5d94('0x8')](function(_0x14323e){logger[_0x5d94('0x9')](_0x5d94('0x4d'),_0x138922);logger[_0x5d94('0xb')](_0x5d94('0x4d'),_0x138922,JSON[_0x5d94('0x1d')](_0x14323e));_0x51fe9c(_0x14323e);})['catch'](function(_0x205141){logger['error'](_0x5d94('0x4d'),_0x205141[_0x5d94('0x10')],_0x138922);_0x4cbf88(_0x383c98[_0x5d94('0xd')](0x1f4,_0x205141[_0x5d94('0x10')]));});});});};exports[_0x5d94('0x4e')]=function(_0x28c915){var _0x3aa82e=this;var _0x176c30=_0x28c915[_0x5d94('0x24')][_0x5d94('0x16')]['voiceQueueIds'];var _0x711220=_0x28c915[_0x5d94('0x24')][_0x5d94('0x16')][_0x5d94('0x4f')];var _0x332723=_0x28c915[_0x5d94('0x24')][_0x5d94('0x16')][_0x5d94('0x50')];return new Promise(function(_0xf4c450,_0x3d8d17){return db[_0x5d94('0x13')][_0x5d94('0x2b')]({'where':{'voiceQueueId':{'$in':_0x176c30},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x5d94('0x3d')]['literal'](_0x5d94('0x51')+_0x711220+_0x5d94('0x52')),'$gt':db['sequelize'][_0x5d94('0x42')]('NOW()')}},'UserId':{'$in':_0x332723}},'include':[{'model':db[_0x5d94('0x2f')],'as':'Contact'},{'model':db[_0x5d94('0x32')],'as':_0x5d94('0x33'),'attributes':['id',_0x5d94('0x53'),_0x5d94('0x34')]},{'model':db[_0x5d94('0x54')],'as':_0x5d94('0x55')}]})[_0x5d94('0x8')](function(_0x21c886){if(_0x21c886[_0x5d94('0x39')]>0x0){return db[_0x5d94('0x3d')][_0x5d94('0x2a')](function(_0x2192b9){return db[_0x5d94('0x13')]['update']({'recallmeNotifiedDate':db['sequelize']['literal'](_0x5d94('0x56'))},{'where':{'id':{'$in':_[_0x5d94('0x1a')](_0x21c886,'id')}},'transaction':_0x2192b9})['then'](function(){_0xf4c450(_0x21c886);})[_0x5d94('0x12')](function(_0x5a4d27){logger[_0x5d94('0xd')](_0x5d94('0x4e'),_0x5a4d27['message'],_0x28c915);_0x3d8d17(_0x3aa82e[_0x5d94('0xd')](0x1f4,_0x5a4d27[_0x5d94('0x10')]));});})['catch'](function(_0xff69a6){logger[_0x5d94('0xd')](_0x5d94('0x4e'),_0xff69a6['message'],_0x28c915);_0x3d8d17(_0x3aa82e[_0x5d94('0xd')](0x1f4,_0xff69a6[_0x5d94('0x10')]));});}else{_0xf4c450(_0x21c886);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index bd2d98c..69e693e 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 _0x8325=['../../components/auth/service','./cmHopper.controller','get','isAuthenticated','index','/describe','describe','/opencontacts','getOpenContacts','/timezones','getTimezones','/:id','show','getPreviewRecall','post','create','/preview','/timezone','getTimezone','update','destroy','express'];(function(_0xc67528,_0x24e2fb){var _0x38e26d=function(_0x1b0efe){while(--_0x1b0efe){_0xc67528['push'](_0xc67528['shift']());}};_0x38e26d(++_0x24e2fb);}(_0x8325,0xaf));var _0x5832=function(_0x32fa85,_0x217fe3){_0x32fa85=_0x32fa85-0x0;var _0x3f6216=_0x8325[_0x32fa85];return _0x3f6216;};'use strict';var express=require(_0x5832('0x0'));var router=express['Router']();var auth=require(_0x5832('0x1'));var controller=require(_0x5832('0x2'));router[_0x5832('0x3')]('/',auth[_0x5832('0x4')](),controller[_0x5832('0x5')]);router[_0x5832('0x3')](_0x5832('0x6'),auth[_0x5832('0x4')](),controller[_0x5832('0x7')]);router[_0x5832('0x3')](_0x5832('0x8'),auth[_0x5832('0x4')](),controller[_0x5832('0x9')]);router[_0x5832('0x3')](_0x5832('0xa'),auth['isAuthenticated'](),controller[_0x5832('0xb')]);router['get'](_0x5832('0xc'),auth[_0x5832('0x4')](),controller[_0x5832('0xd')]);router[_0x5832('0x3')]('/:id/previewrecall',auth['isAuthenticated'](),controller[_0x5832('0xe')]);router[_0x5832('0xf')]('/',auth['isAuthenticated'](),controller[_0x5832('0x10')]);router[_0x5832('0xf')](_0x5832('0x11'),auth['isAuthenticated'](),controller['getPreview']);router['post'](_0x5832('0x12'),auth[_0x5832('0x4')](),controller[_0x5832('0x13')]);router['put'](_0x5832('0xc'),auth['isAuthenticated'](),controller[_0x5832('0x14')]);router['delete'](_0x5832('0xc'),auth[_0x5832('0x4')](),controller[_0x5832('0x15')]);module['exports']=router; \ No newline at end of file +var _0x317d=['/:id','getPreviewRecall','post','/preview','/timezone','getTimezone','put','update','delete','destroy','express','Router','../../components/auth/service','./cmHopper.controller','get','isAuthenticated','describe','/opencontacts','getOpenContacts','/timezones','getTimezones'];(function(_0x30a98e,_0x450ef1){var _0xab47a4=function(_0x3c5d68){while(--_0x3c5d68){_0x30a98e['push'](_0x30a98e['shift']());}};_0xab47a4(++_0x450ef1);}(_0x317d,0xb2));var _0xd317=function(_0x22705e,_0x247175){_0x22705e=_0x22705e-0x0;var _0x366471=_0x317d[_0x22705e];return _0x366471;};'use strict';var express=require(_0xd317('0x0'));var router=express[_0xd317('0x1')]();var auth=require(_0xd317('0x2'));var controller=require(_0xd317('0x3'));router[_0xd317('0x4')]('/',auth[_0xd317('0x5')](),controller['index']);router['get']('/describe',auth[_0xd317('0x5')](),controller[_0xd317('0x6')]);router[_0xd317('0x4')](_0xd317('0x7'),auth[_0xd317('0x5')](),controller[_0xd317('0x8')]);router[_0xd317('0x4')](_0xd317('0x9'),auth[_0xd317('0x5')](),controller[_0xd317('0xa')]);router[_0xd317('0x4')](_0xd317('0xb'),auth[_0xd317('0x5')](),controller['show']);router['get']('/:id/previewrecall',auth['isAuthenticated'](),controller[_0xd317('0xc')]);router[_0xd317('0xd')]('/',auth[_0xd317('0x5')](),controller['create']);router[_0xd317('0xd')](_0xd317('0xe'),auth['isAuthenticated'](),controller['getPreview']);router['post'](_0xd317('0xf'),auth[_0xd317('0x5')](),controller[_0xd317('0x10')]);router[_0xd317('0x11')](_0xd317('0xb'),auth['isAuthenticated'](),controller[_0xd317('0x12')]);router[_0xd317('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xd317('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index a4ce922..1d03b1e 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7dc6=['format','YYYY-MM-DD\x20HH:mm:ss','moment','sequelize','exports','STRING','INTEGER'];(function(_0x560849,_0x54df45){var _0x9ee7c3=function(_0x18c836){while(--_0x18c836){_0x560849['push'](_0x560849['shift']());}};_0x9ee7c3(++_0x54df45);}(_0x7dc6,0x144));var _0x67dc=function(_0x47c9e8,_0x44e600){_0x47c9e8=_0x47c9e8-0x0;var _0x3df2f2=_0x7dc6[_0x47c9e8];return _0x3df2f2;};'use strict';var moment=require(_0x67dc('0x0'));var Sequelize=require(_0x67dc('0x1'));module[_0x67dc('0x2')]={'CmHopperId':{'type':Sequelize['INTEGER']},'phone':{'type':Sequelize[_0x67dc('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x67dc('0x4')],'defaultValue':0x0},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x67dc('0x5')](_0x67dc('0x6'))},'countbusyretry':{'type':Sequelize[_0x67dc('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x67dc('0x4')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x67dc('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x67dc('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x67dc('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x67dc('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x67dc('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xf8ca=['moment','INTEGER','DATE'];(function(_0x4a7f3c,_0x74b703){var _0x89d3ae=function(_0x1ae014){while(--_0x1ae014){_0x4a7f3c['push'](_0x4a7f3c['shift']());}};_0x89d3ae(++_0x74b703);}(_0xf8ca,0x1a1));var _0xaf8c=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0xf8ca[_0x550d12];return _0x12103d;};'use strict';var moment=require(_0xaf8c('0x0'));var Sequelize=require('sequelize');module['exports']={'CmHopperId':{'type':Sequelize[_0xaf8c('0x1')]},'phone':{'type':Sequelize['STRING'],'allowNull':![]},'OrderBy':{'type':Sequelize[_0xaf8c('0x1')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0xaf8c('0x2')],'defaultValue':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xaf8c('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xaf8c('0x1')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0xaf8c('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xaf8c('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index a4d5a77..295f7a1 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe42c=['CmHopperAdditionalPhones','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','send','map','CmHopperAdditionalPhone','rawAttributes','fieldName','type','key','model','keys','filters','query','attributes','length','hasOwnProperty','nolimit','where','pick','filter','merge','VIRTUAL','name','options','includeAll','include','rows','catch','show','params','intersection','fields','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x146484,_0x27a7f0){var _0x4c7aa3=function(_0x481b98){while(--_0x481b98){_0x146484['push'](_0x146484['shift']());}};_0x4c7aa3(++_0x27a7f0);}(_0xe42c,0x102));var _0xce42=function(_0x466b04,_0x238396){_0x466b04=_0x466b04-0x0;var _0x1dd736=_0xe42c[_0x466b04];return _0x1dd736;};'use strict';var emlformat=require(_0xce42('0x0'));var rimraf=require(_0xce42('0x1'));var zipdir=require(_0xce42('0x2'));var jsonpatch=require(_0xce42('0x3'));var rp=require(_0xce42('0x4'));var moment=require(_0xce42('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xce42('0x6'));var path=require(_0xce42('0x7'));var sox=require(_0xce42('0x8'));var csv=require(_0xce42('0x9'));var ejs=require(_0xce42('0xa'));var fs=require('fs');var fs_extra=require(_0xce42('0xb'));var _=require(_0xce42('0xc'));var squel=require(_0xce42('0xd'));var crypto=require(_0xce42('0xe'));var jsforce=require(_0xce42('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xce42('0x9'));var querystring=require(_0xce42('0x10'));var Papa=require('papaparse');var Redis=require(_0xce42('0x11'));var authService=require(_0xce42('0x12'));var qs=require(_0xce42('0x13'));var as=require(_0xce42('0x14'));var hardwareService=require(_0xce42('0x15'));var logger=require(_0xce42('0x16'))(_0xce42('0x17'));var utils=require(_0xce42('0x18'));var config=require(_0xce42('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xce42('0x1a'))['db'];function respondWithStatusCode(_0x4fd9df,_0x331541){_0x331541=_0x331541||0xcc;return function(_0x5592c2){if(_0x5592c2){return _0x4fd9df[_0xce42('0x1b')](_0x331541);}return _0x4fd9df[_0xce42('0x1c')](_0x331541)[_0xce42('0x1d')]();};}function respondWithResult(_0x593197,_0x3c4a98){_0x3c4a98=_0x3c4a98||0xc8;return function(_0xc9ebf6){if(_0xc9ebf6){return _0x593197[_0xce42('0x1c')](_0x3c4a98)[_0xce42('0x1e')](_0xc9ebf6);}};}function respondWithFilteredResult(_0x382dec,_0x57c286){return function(_0xd9b1b2){if(_0xd9b1b2){var _0x51c924=typeof _0x57c286['offset']===_0xce42('0x1f')&&typeof _0x57c286[_0xce42('0x20')]==='undefined';var _0x46bf81=_0xd9b1b2['count'];var _0xe986d4=_0x51c924?0x0:_0x57c286[_0xce42('0x21')];var _0x109a58=_0x51c924?_0xd9b1b2[_0xce42('0x22')]:_0x57c286['offset']+_0x57c286['limit'];var _0x6fb0e6;if(_0x109a58>=_0x46bf81){_0x109a58=_0x46bf81;_0x6fb0e6=0xc8;}else{_0x6fb0e6=0xce;}_0x382dec[_0xce42('0x1c')](_0x6fb0e6);return _0x382dec['set'](_0xce42('0x23'),_0xe986d4+'-'+_0x109a58+'/'+_0x46bf81)[_0xce42('0x1e')](_0xd9b1b2);}return null;};}function patchUpdates(_0x3114ae){return function(_0x192e4f){try{jsonpatch[_0xce42('0x24')](_0x192e4f,_0x3114ae,!![]);}catch(_0x201c8d){return BPromise[_0xce42('0x25')](_0x201c8d);}return _0x192e4f[_0xce42('0x26')]();};}function saveUpdates(_0x425116,_0x3cfa8a){return function(_0x3eebb8){if(_0x3eebb8){return _0x3eebb8[_0xce42('0x27')](_0x425116)[_0xce42('0x28')](function(_0x151901){return _0x151901;});}return null;};}function removeEntity(_0xe3fde1,_0x2faee5){return function(_0x97a6da){if(_0x97a6da){return _0x97a6da[_0xce42('0x29')]()[_0xce42('0x28')](function(){var _0x38042b=_0x97a6da[_0xce42('0x2a')]({'plain':!![]});var _0x277ea2='CmHopperAdditionalPhones';return db[_0xce42('0x2b')][_0xce42('0x29')]({'where':{'type':_0x277ea2,'resourceId':_0x38042b['id']}})[_0xce42('0x28')](function(){return _0x97a6da;});})['then'](function(){_0xe3fde1[_0xce42('0x1c')](0xcc)[_0xce42('0x1d')]();});}};}function handleEntityNotFound(_0x1e1709,_0x63c7c5){return function(_0x271e52){if(!_0x271e52){_0x1e1709[_0xce42('0x1b')](0x194);}return _0x271e52;};}function handleError(_0x29bd6e,_0x3482c8){_0x3482c8=_0x3482c8||0x1f4;return function(_0x4dfb4a){logger[_0xce42('0x2c')](_0x4dfb4a[_0xce42('0x2d')]);if(_0x4dfb4a['name']){delete _0x4dfb4a['name'];}_0x29bd6e[_0xce42('0x1c')](_0x3482c8)[_0xce42('0x2e')](_0x4dfb4a);};}exports['index']=function(_0x2c6076,_0x596c81){var _0x270a3e={},_0x268efc={},_0x1bc2ac={'count':0x0,'rows':[]};var _0x23df22=_[_0xce42('0x2f')](db[_0xce42('0x30')][_0xce42('0x31')],function(_0x2497d0){return{'name':_0x2497d0[_0xce42('0x32')],'type':_0x2497d0[_0xce42('0x33')][_0xce42('0x34')]};});_0x268efc[_0xce42('0x35')]=_[_0xce42('0x2f')](_0x23df22,'name');_0x268efc['query']=_[_0xce42('0x36')](_0x2c6076['query']);_0x268efc[_0xce42('0x37')]=_['intersection'](_0x268efc['model'],_0x268efc[_0xce42('0x38')]);_0x270a3e['attributes']=_['intersection'](_0x268efc[_0xce42('0x35')],qs['fields'](_0x2c6076[_0xce42('0x38')]['fields']));_0x270a3e[_0xce42('0x39')]=_0x270a3e['attributes'][_0xce42('0x3a')]?_0x270a3e[_0xce42('0x39')]:_0x268efc[_0xce42('0x35')];if(!_0x2c6076[_0xce42('0x38')][_0xce42('0x3b')](_0xce42('0x3c'))){_0x270a3e[_0xce42('0x20')]=qs[_0xce42('0x20')](_0x2c6076[_0xce42('0x38')][_0xce42('0x20')]);_0x270a3e[_0xce42('0x21')]=qs[_0xce42('0x21')](_0x2c6076[_0xce42('0x38')]['offset']);}_0x270a3e['order']=qs['sort'](_0x2c6076[_0xce42('0x38')]['sort']);_0x270a3e[_0xce42('0x3d')]=qs[_0xce42('0x37')](_[_0xce42('0x3e')](_0x2c6076[_0xce42('0x38')],_0x268efc[_0xce42('0x37')]),_0x23df22);if(_0x2c6076['query'][_0xce42('0x3f')]){_0x270a3e[_0xce42('0x3d')]=_[_0xce42('0x40')](_0x270a3e[_0xce42('0x3d')],{'$or':_[_0xce42('0x2f')](_0x23df22,function(_0xafa972){if(_0xafa972[_0xce42('0x33')]!==_0xce42('0x41')){var _0x3f27df={};_0x3f27df[_0xafa972[_0xce42('0x42')]]={'$like':'%'+_0x2c6076[_0xce42('0x38')][_0xce42('0x3f')]+'%'};return _0x3f27df;}})});}_0x270a3e=_['merge']({},_0x270a3e,_0x2c6076[_0xce42('0x43')]);var _0x1b563d={'where':_0x270a3e[_0xce42('0x3d')]};return db[_0xce42('0x30')][_0xce42('0x22')](_0x1b563d)[_0xce42('0x28')](function(_0x23d1dd){_0x1bc2ac[_0xce42('0x22')]=_0x23d1dd;if(_0x2c6076[_0xce42('0x38')][_0xce42('0x44')]){_0x270a3e[_0xce42('0x45')]=[{'all':!![]}];}return db[_0xce42('0x30')]['findAll'](_0x270a3e);})['then'](function(_0x136dcf){_0x1bc2ac[_0xce42('0x46')]=_0x136dcf;return _0x1bc2ac;})[_0xce42('0x28')](respondWithFilteredResult(_0x596c81,_0x270a3e))[_0xce42('0x47')](handleError(_0x596c81,null));};exports[_0xce42('0x48')]=function(_0x216e0d,_0x211974){var _0x258cf6={'raw':!![],'where':{'id':_0x216e0d[_0xce42('0x49')]['id']}},_0xb46758={};_0xb46758['model']=_[_0xce42('0x36')](db['CmHopperAdditionalPhone'][_0xce42('0x31')]);_0xb46758[_0xce42('0x38')]=_['keys'](_0x216e0d[_0xce42('0x38')]);_0xb46758[_0xce42('0x37')]=_['intersection'](_0xb46758[_0xce42('0x35')],_0xb46758[_0xce42('0x38')]);_0x258cf6[_0xce42('0x39')]=_[_0xce42('0x4a')](_0xb46758[_0xce42('0x35')],qs[_0xce42('0x4b')](_0x216e0d['query'][_0xce42('0x4b')]));_0x258cf6[_0xce42('0x39')]=_0x258cf6[_0xce42('0x39')][_0xce42('0x3a')]?_0x258cf6[_0xce42('0x39')]:_0xb46758[_0xce42('0x35')];if(_0x216e0d['query'][_0xce42('0x44')]){_0x258cf6[_0xce42('0x45')]=[{'all':!![]}];}_0x258cf6=_['merge']({},_0x258cf6,_0x216e0d[_0xce42('0x43')]);return db[_0xce42('0x30')][_0xce42('0x4c')](_0x258cf6)[_0xce42('0x28')](handleEntityNotFound(_0x211974,null))[_0xce42('0x28')](respondWithResult(_0x211974,null))[_0xce42('0x47')](handleError(_0x211974,null));};exports[_0xce42('0x4d')]=function(_0x7b19bb,_0x2672d1){return db['CmHopperAdditionalPhone'][_0xce42('0x4d')](_0x7b19bb[_0xce42('0x4e')],{})[_0xce42('0x28')](function(_0x204dee){var _0x4b4f10=_0x7b19bb[_0xce42('0x4f')]['get']({'plain':!![]});if(!_0x4b4f10)throw new Error(_0xce42('0x50'));if(_0x4b4f10[_0xce42('0x51')]===_0xce42('0x4f')){var _0x2a314b=_0x204dee[_0xce42('0x2a')]({'plain':!![]});var _0x5b0c65=_0xce42('0x52');return db['UserProfileSection'][_0xce42('0x4c')]({'where':{'name':_0x5b0c65,'userProfileId':_0x4b4f10['userProfileId']},'raw':!![]})[_0xce42('0x28')](function(_0x1179b9){if(_0x1179b9&&_0x1179b9[_0xce42('0x53')]===0x0){return db[_0xce42('0x2b')][_0xce42('0x4d')]({'name':_0x2a314b[_0xce42('0x42')],'resourceId':_0x2a314b['id'],'type':_0x1179b9[_0xce42('0x42')],'sectionId':_0x1179b9['id']},{})['then'](function(){return _0x204dee;});}else{return _0x204dee;}})['catch'](function(_0x4e614a){logger[_0xce42('0x2c')](_0xce42('0x54'),_0x4e614a);throw _0x4e614a;});}return _0x204dee;})[_0xce42('0x28')](respondWithResult(_0x2672d1,0xc9))[_0xce42('0x47')](handleError(_0x2672d1,null));};exports['update']=function(_0x2959d9,_0xcdb352){if(_0x2959d9[_0xce42('0x4e')]['id']){delete _0x2959d9['body']['id'];}return db[_0xce42('0x30')]['find']({'where':{'id':_0x2959d9['params']['id']}})[_0xce42('0x28')](handleEntityNotFound(_0xcdb352,null))[_0xce42('0x28')](saveUpdates(_0x2959d9['body'],null))[_0xce42('0x28')](respondWithResult(_0xcdb352,null))[_0xce42('0x47')](handleError(_0xcdb352,null));};exports[_0xce42('0x29')]=function(_0xf487af,_0x267942){return db['CmHopperAdditionalPhone'][_0xce42('0x4c')]({'where':{'id':_0xf487af['params']['id']}})['then'](handleEntityNotFound(_0x267942,null))[_0xce42('0x28')](removeEntity(_0x267942,null))[_0xce42('0x47')](handleError(_0x267942,null));}; \ No newline at end of file +var _0x2093=['crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','get','CmHopperAdditionalPhones','error','stack','name','send','index','map','CmHopperAdditionalPhone','rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','type','VIRTUAL','merge','includeAll','include','rows','show','params','keys','options','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','request-promise','moment','bluebird','util','path','sox','fs-extra','lodash','squel'];(function(_0x26658,_0x644236){var _0x5499d4=function(_0x3543fd){while(--_0x3543fd){_0x26658['push'](_0x26658['shift']());}};_0x5499d4(++_0x644236);}(_0x2093,0x195));var _0x3209=function(_0x54f493,_0x385811){_0x54f493=_0x54f493-0x0;var _0x5f2b47=_0x2093[_0x54f493];return _0x5f2b47;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3209('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3209('0x1'));var moment=require(_0x3209('0x2'));var BPromise=require(_0x3209('0x3'));var Mustache=require('mustache');var util=require(_0x3209('0x4'));var path=require(_0x3209('0x5'));var sox=require(_0x3209('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3209('0x7'));var _=require(_0x3209('0x8'));var squel=require(_0x3209('0x9'));var crypto=require(_0x3209('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x3209('0xb'));var toCsv=require('to-csv');var querystring=require(_0x3209('0xc'));var Papa=require(_0x3209('0xd'));var Redis=require(_0x3209('0xe'));var authService=require(_0x3209('0xf'));var qs=require(_0x3209('0x10'));var as=require(_0x3209('0x11'));var hardwareService=require(_0x3209('0x12'));var logger=require('../../config/logger')(_0x3209('0x13'));var utils=require(_0x3209('0x14'));var config=require(_0x3209('0x15'));var licenseUtil=require(_0x3209('0x16'));var db=require(_0x3209('0x17'))['db'];function respondWithStatusCode(_0x269995,_0x437b3e){_0x437b3e=_0x437b3e||0xcc;return function(_0x49ab31){if(_0x49ab31){return _0x269995[_0x3209('0x18')](_0x437b3e);}return _0x269995[_0x3209('0x19')](_0x437b3e)[_0x3209('0x1a')]();};}function respondWithResult(_0x49649d,_0x578f1e){_0x578f1e=_0x578f1e||0xc8;return function(_0x3f75c6){if(_0x3f75c6){return _0x49649d['status'](_0x578f1e)[_0x3209('0x1b')](_0x3f75c6);}};}function respondWithFilteredResult(_0x4cf20d,_0x6bad86){return function(_0x4339d1){if(_0x4339d1){var _0x443ea5=typeof _0x6bad86[_0x3209('0x1c')]==='undefined'&&typeof _0x6bad86['limit']===_0x3209('0x1d');var _0x4a3c2b=_0x4339d1[_0x3209('0x1e')];var _0x256c47=_0x443ea5?0x0:_0x6bad86[_0x3209('0x1c')];var _0x1a5c8f=_0x443ea5?_0x4339d1['count']:_0x6bad86['offset']+_0x6bad86[_0x3209('0x1f')];var _0x127efe;if(_0x1a5c8f>=_0x4a3c2b){_0x1a5c8f=_0x4a3c2b;_0x127efe=0xc8;}else{_0x127efe=0xce;}_0x4cf20d['status'](_0x127efe);return _0x4cf20d[_0x3209('0x20')](_0x3209('0x21'),_0x256c47+'-'+_0x1a5c8f+'/'+_0x4a3c2b)[_0x3209('0x1b')](_0x4339d1);}return null;};}function patchUpdates(_0x481fa8){return function(_0x16b938){try{jsonpatch[_0x3209('0x22')](_0x16b938,_0x481fa8,!![]);}catch(_0x22db4d){return BPromise['reject'](_0x22db4d);}return _0x16b938[_0x3209('0x23')]();};}function saveUpdates(_0x16fc65,_0x555cac){return function(_0x2c835b){if(_0x2c835b){return _0x2c835b[_0x3209('0x24')](_0x16fc65)[_0x3209('0x25')](function(_0x413351){return _0x413351;});}return null;};}function removeEntity(_0x400057,_0x1df121){return function(_0x39cc34){if(_0x39cc34){return _0x39cc34[_0x3209('0x26')]()['then'](function(){var _0x5e6a0d=_0x39cc34[_0x3209('0x27')]({'plain':!![]});var _0x6fcce8=_0x3209('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x6fcce8,'resourceId':_0x5e6a0d['id']}})[_0x3209('0x25')](function(){return _0x39cc34;});})['then'](function(){_0x400057[_0x3209('0x19')](0xcc)[_0x3209('0x1a')]();});}};}function handleEntityNotFound(_0x27c641,_0xba3abd){return function(_0x36b0df){if(!_0x36b0df){_0x27c641['sendStatus'](0x194);}return _0x36b0df;};}function handleError(_0x45bdc8,_0xc155c9){_0xc155c9=_0xc155c9||0x1f4;return function(_0x1e24d3){logger[_0x3209('0x29')](_0x1e24d3[_0x3209('0x2a')]);if(_0x1e24d3[_0x3209('0x2b')]){delete _0x1e24d3[_0x3209('0x2b')];}_0x45bdc8[_0x3209('0x19')](_0xc155c9)[_0x3209('0x2c')](_0x1e24d3);};}exports[_0x3209('0x2d')]=function(_0x29172c,_0x401ade){var _0x27fa6e={},_0xeb2e7={},_0x3acb74={'count':0x0,'rows':[]};var _0x3aacd0=_[_0x3209('0x2e')](db[_0x3209('0x2f')][_0x3209('0x30')],function(_0x243ecb){return{'name':_0x243ecb[_0x3209('0x31')],'type':_0x243ecb['type']['key']};});_0xeb2e7[_0x3209('0x32')]=_[_0x3209('0x2e')](_0x3aacd0,_0x3209('0x2b'));_0xeb2e7[_0x3209('0x33')]=_['keys'](_0x29172c['query']);_0xeb2e7[_0x3209('0x34')]=_[_0x3209('0x35')](_0xeb2e7[_0x3209('0x32')],_0xeb2e7['query']);_0x27fa6e[_0x3209('0x36')]=_[_0x3209('0x35')](_0xeb2e7[_0x3209('0x32')],qs[_0x3209('0x37')](_0x29172c[_0x3209('0x33')][_0x3209('0x37')]));_0x27fa6e[_0x3209('0x36')]=_0x27fa6e['attributes'][_0x3209('0x38')]?_0x27fa6e[_0x3209('0x36')]:_0xeb2e7[_0x3209('0x32')];if(!_0x29172c[_0x3209('0x33')][_0x3209('0x39')]('nolimit')){_0x27fa6e[_0x3209('0x1f')]=qs[_0x3209('0x1f')](_0x29172c[_0x3209('0x33')]['limit']);_0x27fa6e['offset']=qs[_0x3209('0x1c')](_0x29172c[_0x3209('0x33')][_0x3209('0x1c')]);}_0x27fa6e[_0x3209('0x3a')]=qs['sort'](_0x29172c['query'][_0x3209('0x3b')]);_0x27fa6e[_0x3209('0x3c')]=qs[_0x3209('0x34')](_['pick'](_0x29172c[_0x3209('0x33')],_0xeb2e7[_0x3209('0x34')]),_0x3aacd0);if(_0x29172c['query'][_0x3209('0x3d')]){_0x27fa6e[_0x3209('0x3c')]=_['merge'](_0x27fa6e[_0x3209('0x3c')],{'$or':_[_0x3209('0x2e')](_0x3aacd0,function(_0xbf030){if(_0xbf030[_0x3209('0x3e')]!==_0x3209('0x3f')){var _0x317754={};_0x317754[_0xbf030[_0x3209('0x2b')]]={'$like':'%'+_0x29172c[_0x3209('0x33')][_0x3209('0x3d')]+'%'};return _0x317754;}})});}_0x27fa6e=_[_0x3209('0x40')]({},_0x27fa6e,_0x29172c['options']);var _0x134c14={'where':_0x27fa6e[_0x3209('0x3c')]};return db[_0x3209('0x2f')][_0x3209('0x1e')](_0x134c14)[_0x3209('0x25')](function(_0x2b7465){_0x3acb74[_0x3209('0x1e')]=_0x2b7465;if(_0x29172c[_0x3209('0x33')][_0x3209('0x41')]){_0x27fa6e[_0x3209('0x42')]=[{'all':!![]}];}return db['CmHopperAdditionalPhone']['findAll'](_0x27fa6e);})[_0x3209('0x25')](function(_0x30643d){_0x3acb74[_0x3209('0x43')]=_0x30643d;return _0x3acb74;})['then'](respondWithFilteredResult(_0x401ade,_0x27fa6e))['catch'](handleError(_0x401ade,null));};exports[_0x3209('0x44')]=function(_0x1dc1d3,_0x29b063){var _0x5ea343={'raw':!![],'where':{'id':_0x1dc1d3[_0x3209('0x45')]['id']}},_0x2bdbc9={};_0x2bdbc9[_0x3209('0x32')]=_[_0x3209('0x46')](db[_0x3209('0x2f')][_0x3209('0x30')]);_0x2bdbc9[_0x3209('0x33')]=_[_0x3209('0x46')](_0x1dc1d3[_0x3209('0x33')]);_0x2bdbc9[_0x3209('0x34')]=_[_0x3209('0x35')](_0x2bdbc9['model'],_0x2bdbc9[_0x3209('0x33')]);_0x5ea343[_0x3209('0x36')]=_['intersection'](_0x2bdbc9[_0x3209('0x32')],qs[_0x3209('0x37')](_0x1dc1d3[_0x3209('0x33')]['fields']));_0x5ea343['attributes']=_0x5ea343['attributes'][_0x3209('0x38')]?_0x5ea343[_0x3209('0x36')]:_0x2bdbc9[_0x3209('0x32')];if(_0x1dc1d3[_0x3209('0x33')]['includeAll']){_0x5ea343['include']=[{'all':!![]}];}_0x5ea343=_[_0x3209('0x40')]({},_0x5ea343,_0x1dc1d3[_0x3209('0x47')]);return db['CmHopperAdditionalPhone']['find'](_0x5ea343)['then'](handleEntityNotFound(_0x29b063,null))[_0x3209('0x25')](respondWithResult(_0x29b063,null))[_0x3209('0x48')](handleError(_0x29b063,null));};exports[_0x3209('0x49')]=function(_0x4e96ea,_0xc579c6){return db[_0x3209('0x2f')]['create'](_0x4e96ea[_0x3209('0x4a')],{})[_0x3209('0x25')](function(_0x26adc8){var _0x10b54f=_0x4e96ea['user']['get']({'plain':!![]});if(!_0x10b54f)throw new Error(_0x3209('0x4b'));if(_0x10b54f[_0x3209('0x4c')]===_0x3209('0x4d')){var _0x20135c=_0x26adc8['get']({'plain':!![]});var _0x471505=_0x3209('0x28');return db[_0x3209('0x4e')][_0x3209('0x4f')]({'where':{'name':_0x471505,'userProfileId':_0x10b54f['userProfileId']},'raw':!![]})[_0x3209('0x25')](function(_0x24780f){if(_0x24780f&&_0x24780f[_0x3209('0x50')]===0x0){return db[_0x3209('0x51')][_0x3209('0x49')]({'name':_0x20135c[_0x3209('0x2b')],'resourceId':_0x20135c['id'],'type':_0x24780f[_0x3209('0x2b')],'sectionId':_0x24780f['id']},{})['then'](function(){return _0x26adc8;});}else{return _0x26adc8;}})[_0x3209('0x48')](function(_0x2fa8e5){logger[_0x3209('0x29')](_0x3209('0x52'),_0x2fa8e5);throw _0x2fa8e5;});}return _0x26adc8;})[_0x3209('0x25')](respondWithResult(_0xc579c6,0xc9))[_0x3209('0x48')](handleError(_0xc579c6,null));};exports['update']=function(_0x1b8007,_0x1f76c4){if(_0x1b8007[_0x3209('0x4a')]['id']){delete _0x1b8007['body']['id'];}return db['CmHopperAdditionalPhone'][_0x3209('0x4f')]({'where':{'id':_0x1b8007[_0x3209('0x45')]['id']}})[_0x3209('0x25')](handleEntityNotFound(_0x1f76c4,null))[_0x3209('0x25')](saveUpdates(_0x1b8007[_0x3209('0x4a')],null))['then'](respondWithResult(_0x1f76c4,null))[_0x3209('0x48')](handleError(_0x1f76c4,null));};exports[_0x3209('0x26')]=function(_0x22dc01,_0x3eeb92){return db[_0x3209('0x2f')]['find']({'where':{'id':_0x22dc01[_0x3209('0x45')]['id']}})['then'](handleEntityNotFound(_0x3eeb92,null))['then'](removeEntity(_0x3eeb92,null))[_0x3209('0x48')](handleError(_0x3eeb92,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index e3028c0..36278c4 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xab4b=['util','moment','bluebird','path','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes','CmHopperAdditionalPhone','cm_hopper_additional_phones'];(function(_0x3517ad,_0xc450c3){var _0x29d267=function(_0x411ffc){while(--_0x411ffc){_0x3517ad['push'](_0x3517ad['shift']());}};_0x29d267(++_0xc450c3);}(_0xab4b,0x156));var _0xbab4=function(_0x18fd0b,_0xe0f9ed){_0x18fd0b=_0x18fd0b-0x0;var _0x3b19a3=_0xab4b[_0x18fd0b];return _0x3b19a3;};'use strict';var _=require('lodash');var util=require(_0xbab4('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xbab4('0x1'));var BPromise=require(_0xbab4('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbab4('0x3'));var rimraf=require(_0xbab4('0x4'));var config=require(_0xbab4('0x5'));var attributes=require(_0xbab4('0x6'));module['exports']=function(_0x365090,_0x6f1a52){return _0x365090['define'](_0xbab4('0x7'),attributes,{'tableName':_0xbab4('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x85b3=['cm_hopper_additional_phones','lodash','../../config/logger','moment','bluebird','path','../../config/environment','./cmHopperAdditionalPhone.attributes','exports','define','CmHopperAdditionalPhone'];(function(_0x54fcf2,_0x14fbd9){var _0x41a6e2=function(_0x38c1c4){while(--_0x38c1c4){_0x54fcf2['push'](_0x54fcf2['shift']());}};_0x41a6e2(++_0x14fbd9);}(_0x85b3,0x90));var _0x385b=function(_0x4882c6,_0x42475b){_0x4882c6=_0x4882c6-0x0;var _0x59154f=_0x85b3[_0x4882c6];return _0x59154f;};'use strict';var _=require(_0x385b('0x0'));var util=require('util');var logger=require(_0x385b('0x1'))('api');var moment=require(_0x385b('0x2'));var BPromise=require(_0x385b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x385b('0x4'));var rimraf=require('rimraf');var config=require(_0x385b('0x5'));var attributes=require(_0x385b('0x6'));module[_0x385b('0x7')]=function(_0x43059a,_0x859ecd){return _0x43059a[_0x385b('0x8')](_0x385b('0x9'),attributes,{'tableName':_0x385b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js index 67a489a..31d3de5 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9a0b=['../../config/utils','../../config/logger','rpc','client','http','request','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','error','code','message','VerifyAdditionalPhones','CmHopper','findOne','body','ContactId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','countbusyretry','countcongestionretry','countdropretry','countabandonedretry','countmachineretry','dialGlobalMaxRetry','countnoanswerretry','countnosuchnumberretry','entity','catch','SwapAdditionalPhones','ListId','duration','waitTime','isNil','scheduledat','add','minutes','phone','countagentrejectretry','createdAt','updatedAt','sequelize','transaction','update','activateAdditionalPhone','IncrementPreviewCounters','field','util','moment','bluebird','randomstring','ioredis'];(function(_0x2c66d8,_0x4ba4b1){var _0xacbcb=function(_0x45624b){while(--_0x45624b){_0x2c66d8['push'](_0x2c66d8['shift']());}};_0xacbcb(++_0x4ba4b1);}(_0x9a0b,0x1f3));var _0xb9a0=function(_0x5cc341,_0x24ff02){_0x5cc341=_0x5cc341-0x0;var _0x13a67e=_0x9a0b[_0x5cc341];return _0x13a67e;};'use strict';var _=require('lodash');var util=require(_0xb9a0('0x0'));var moment=require(_0xb9a0('0x1'));var BPromise=require(_0xb9a0('0x2'));var rs=require(_0xb9a0('0x3'));var fs=require('fs');var Redis=require(_0xb9a0('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb9a0('0x5'));var logger=require(_0xb9a0('0x6'))(_0xb9a0('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb9a0('0x8')][_0xb9a0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x7b462e,_0x321427,_0x3353a0){return new BPromise(function(_0x158560,_0x542f50){return client[_0xb9a0('0xa')](_0x7b462e,_0x3353a0)[_0xb9a0('0xb')](function(_0x5cc9a2){logger[_0xb9a0('0xc')](_0xb9a0('0xd'),_0x321427,_0xb9a0('0xe'));logger['debug']('CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s',_0x321427,_0xb9a0('0xe'),JSON['stringify'](_0x5cc9a2));if(_0x5cc9a2[_0xb9a0('0xf')]){if(_0x5cc9a2['error'][_0xb9a0('0x10')]===0x1f4){logger[_0xb9a0('0xf')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x321427,_0x5cc9a2[_0xb9a0('0xf')][_0xb9a0('0x11')]);return _0x542f50(_0x5cc9a2['error'][_0xb9a0('0x11')]);}logger[_0xb9a0('0xf')](_0xb9a0('0xd'),_0x321427,_0x5cc9a2[_0xb9a0('0xf')][_0xb9a0('0x11')]);return _0x158560(_0x5cc9a2[_0xb9a0('0xf')][_0xb9a0('0x11')]);}else{logger[_0xb9a0('0xc')](_0xb9a0('0xd'),_0x321427,_0xb9a0('0xe'));_0x158560(_0x5cc9a2['result'][_0xb9a0('0x11')]);}})['catch'](function(_0x2c1fab){logger['error'](_0xb9a0('0xd'),_0x321427,_0x2c1fab);_0x542f50(_0x2c1fab);});});}exports[_0xb9a0('0x12')]=function(_0x104a3e){var _0x266e22=this;return new Promise(function(_0x2dc7aa,_0x6030a7){return db[_0xb9a0('0x13')][_0xb9a0('0x14')]({'raw':!![],'where':{'ContactId':_0x104a3e[_0xb9a0('0x15')][_0xb9a0('0x16')],'ListId':_0x104a3e[_0xb9a0('0x15')]['ListId'],'VoiceQueueId':_0x104a3e[_0xb9a0('0x15')]['VoiceQueueId']===undefined?null:_0x104a3e[_0xb9a0('0x15')][_0xb9a0('0x17')],'CampaignId':_0x104a3e[_0xb9a0('0x15')][_0xb9a0('0x18')]===undefined?null:_0x104a3e['body'][_0xb9a0('0x18')]}})[_0xb9a0('0xb')](function(_0xdc3bde){if(_0xdc3bde!=null){return db[_0xb9a0('0x19')][_0xb9a0('0x14')]({'raw':!![],'where':{'CmHopperId':_0xdc3bde['id'],'OrderBy':{'$gt':_0xdc3bde['OrderBy']}},'order':[[_0xb9a0('0x1a'),_0xb9a0('0x1b')]]})[_0xb9a0('0xb')](function(_0x5bb6b3){var _0x9f38c7=0x0;if(_0x5bb6b3){if(_0x5bb6b3[_0xb9a0('0x1c')]+_0x5bb6b3[_0xb9a0('0x1d')]+_0x5bb6b3['countnoanswerretry']+_0x5bb6b3['countnosuchnumberretry']+_0x5bb6b3[_0xb9a0('0x1e')]+_0x5bb6b3[_0xb9a0('0x1f')]+_0x5bb6b3[_0xb9a0('0x20')]+_0x5bb6b3['countagentrejectretry']<_0x104a3e['entity'][_0xb9a0('0x21')])_0x9f38c7=0x1;_0x2dc7aa({'additional':_0x9f38c7});}else{return db[_0xb9a0('0x19')][_0xb9a0('0x14')]({'raw':!![],'where':{'CmHopperId':_0xdc3bde['id']},'order':[[_0xb9a0('0x1a'),_0xb9a0('0x1b')]]})[_0xb9a0('0xb')](function(_0x3bf5c9){var _0x206686=0x0;if(_0x3bf5c9){if(_0x3bf5c9['countbusyretry']+_0x3bf5c9[_0xb9a0('0x1d')]+_0x3bf5c9[_0xb9a0('0x22')]+_0x3bf5c9[_0xb9a0('0x23')]+_0x3bf5c9[_0xb9a0('0x1e')]+_0x3bf5c9[_0xb9a0('0x1f')]+_0x3bf5c9[_0xb9a0('0x20')]+_0x3bf5c9['countagentrejectretry']<_0x104a3e[_0xb9a0('0x24')][_0xb9a0('0x21')])_0x206686=0x1;_0x2dc7aa({'additional':_0x206686});}else{_0x2dc7aa({'additional':0x0});}})['catch'](function(_0x5f1526){logger[_0xb9a0('0xf')](_0xb9a0('0x12'),_0x5f1526[_0xb9a0('0x11')]);_0x6030a7(_0x266e22[_0xb9a0('0xf')](0x1f4,_0x5f1526[_0xb9a0('0x11')]));});}})[_0xb9a0('0x25')](function(_0x2390f8){logger[_0xb9a0('0xf')]('VerifyAdditionalPhones',_0x2390f8['message']);_0x6030a7(_0x266e22[_0xb9a0('0xf')](0x1f4,_0x2390f8[_0xb9a0('0x11')]));});}else _0x2dc7aa({'additional':0x0});});});};exports[_0xb9a0('0x26')]=function(_0x59b5f3){var _0x429911=this;return new Promise(function(_0x2d0b53,_0x3a3573){return db[_0xb9a0('0x13')][_0xb9a0('0x14')]({'raw':!![],'where':{'ContactId':_0x59b5f3[_0xb9a0('0x15')][_0xb9a0('0x16')],'ListId':_0x59b5f3['body'][_0xb9a0('0x27')],'VoiceQueueId':_0x59b5f3['body']['VoiceQueueId']===undefined?null:_0x59b5f3['body'][_0xb9a0('0x17')],'CampaignId':_0x59b5f3['body'][_0xb9a0('0x18')]===undefined?null:_0x59b5f3[_0xb9a0('0x15')][_0xb9a0('0x18')]}})[_0xb9a0('0xb')](function(_0x48951e){if(_0x48951e!=null){return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x48951e['id'],'OrderBy':{'$gte':_0x48951e[_0xb9a0('0x1a')]}},'order':[[_0xb9a0('0x1a'),_0xb9a0('0x1b')]]})[_0xb9a0('0xb')](function(_0x282b28){if(_0x282b28)return activateAdditionalPhone(_0x48951e,_0x59b5f3['body'],_0x282b28,_0x59b5f3[_0xb9a0('0x28')],_0x59b5f3['waitTime'])[_0xb9a0('0xb')](function(_0x20af21){_0x2d0b53(_0x20af21);});else{return db[_0xb9a0('0x19')][_0xb9a0('0x14')]({'raw':!![],'where':{'CmHopperId':_0x48951e['id']},'order':[[_0xb9a0('0x1a'),_0xb9a0('0x1b')]]})[_0xb9a0('0xb')](function(_0x4e1eb8){if(_0x4e1eb8)return activateAdditionalPhone(_0x48951e,_0x59b5f3['body'],_0x4e1eb8,_0x59b5f3['duration'],_0x59b5f3[_0xb9a0('0x29')])[_0xb9a0('0xb')](function(_0xd6b88d){_0x2d0b53(_0xd6b88d);});else{_0x2d0b53({'id':_0x48951e['id'],'phone':''});}})[_0xb9a0('0x25')](function(_0x99c295){logger['error'](_0xb9a0('0x12'),_0x99c295[_0xb9a0('0x11')]);_0x3a3573(_0x429911[_0xb9a0('0xf')](0x1f4,_0x99c295[_0xb9a0('0x11')]));});}})[_0xb9a0('0x25')](function(_0x51ce63){logger[_0xb9a0('0xf')](_0xb9a0('0x12'),_0x51ce63[_0xb9a0('0x11')]);_0x3a3573(_0x429911[_0xb9a0('0xf')](0x1f4,_0x51ce63[_0xb9a0('0x11')]));});}else _0x2d0b53(0x1);});});};function activateAdditionalPhone(_0x30a6cb,_0x8a9a57,_0x8abf98,_0x31ae1d,_0x406c4d){return new Promise(function(_0x5d31e5,_0x2c2d55){var _0x195cd8;if(_[_0xb9a0('0x2a')](_0x8abf98[_0xb9a0('0x2b')])){_0x8abf98[_0xb9a0('0x2b')]=moment();}if(moment()>moment(_0x8abf98[_0xb9a0('0x2b')])){_0x195cd8=moment()[_0xb9a0('0x2c')](_0x406c4d||0x3,_0xb9a0('0x2d'));}else{if(_0x8abf98[_0xb9a0('0x1a')]==0x0){_0x195cd8=moment(_0x8abf98[_0xb9a0('0x2b')]);}else{_0x195cd8=moment()[_0xb9a0('0x2c')](_0x406c4d||0x3,_0xb9a0('0x2d'));}}if(_[_0xb9a0('0x2a')](_0x195cd8)){_0x195cd8=moment()['add'](_0x406c4d||0x3,_0xb9a0('0x2d'));}var _0x4fdad6={'phone':_0x30a6cb[_0xb9a0('0x2e')],'active':0x0,'OrderBy':_[_0xb9a0('0x2a')](_0x30a6cb[_0xb9a0('0x1a')])?0x0:_0x30a6cb[_0xb9a0('0x1a')],'scheduledat':moment()[_0xb9a0('0x2c')](_0x31ae1d||0x1,_0xb9a0('0x2d')),'countbusyretry':_0x8a9a57['countbusyretry'],'countcongestionretry':_0x8a9a57[_0xb9a0('0x1d')],'countnoanswerretry':_0x8a9a57['countnoanswerretry'],'countnosuchnumberretry':_0x8a9a57[_0xb9a0('0x23')],'countdropretry':_0x8a9a57[_0xb9a0('0x1e')],'countabandonedretry':_0x8a9a57[_0xb9a0('0x1f')],'countmachineretry':_0x8a9a57[_0xb9a0('0x20')],'countagentrejectretry':_0x8a9a57[_0xb9a0('0x2f')],'createdAt':_0x8a9a57[_0xb9a0('0x30')],'updatedAt':_0x8a9a57[_0xb9a0('0x31')]};var _0x1b1dc9={'CmHopperId':_0x30a6cb['id'],'phone':_0x8abf98[_0xb9a0('0x2e')],'active':0x0,'OrderBy':_[_0xb9a0('0x2a')](_0x8abf98[_0xb9a0('0x1a')])?0x0:_0x8abf98[_0xb9a0('0x1a')],'scheduledat':_0x195cd8,'countbusyretry':_0x8abf98[_0xb9a0('0x1c')],'countcongestionretry':_0x8abf98[_0xb9a0('0x1d')],'countnoanswerretry':_0x8abf98['countnoanswerretry'],'countnosuchnumberretry':_0x8abf98[_0xb9a0('0x23')],'countdropretry':_0x8abf98[_0xb9a0('0x1e')],'countabandonedretry':_0x8abf98[_0xb9a0('0x1f')],'countmachineretry':_0x8abf98[_0xb9a0('0x20')],'countagentrejectretry':_0x8abf98[_0xb9a0('0x2f')],'createdAt':_0x8abf98['createdAt'],'updatedAt':_0x8abf98['updatedAt']};return db[_0xb9a0('0x32')][_0xb9a0('0x33')](function(_0x1ff895){return db[_0xb9a0('0x19')][_0xb9a0('0x34')](_0x4fdad6,{'where':{'id':_0x8abf98['id']}},{'transaction':_0x1ff895})[_0xb9a0('0xb')](function(){return db['CmHopper'][_0xb9a0('0x34')](_0x1b1dc9,{'where':{'id':_0x30a6cb['id']}},{'transaction':_0x1ff895});});})[_0xb9a0('0xb')](function(_0x40906e){_0x5d31e5({'id':_0x30a6cb['id'],'phone':_0x8abf98[_0xb9a0('0x2e')]});})[_0xb9a0('0x25')](function(_0xae93c4){logger['error'](_0xb9a0('0x35'),_0xae93c4['message']);_0x2c2d55({'error':_0xae93c4['message']});});});}exports[_0xb9a0('0x36')]=function(_0x20a183){var _0xe51cde=this;return new Promise(function(_0x4042e2,_0x50b936){return db[_0xb9a0('0x13')][_0xb9a0('0x34')](_0x20a183[_0xb9a0('0x15')][_0xb9a0('0x37')],{'where':{'id':_0x20a183[_0xb9a0('0x15')]['id']}})[_0xb9a0('0xb')](function(_0x30b8c1){_0x4042e2(_0x30b8c1);})[_0xb9a0('0x25')](function(_0x4ea482){logger['error'](_0xb9a0('0x36'),_0x4ea482[_0xb9a0('0x11')]);_0x50b936(_0xe51cde['error'](0x1f4,_0x4ea482[_0xb9a0('0x11')]));});});}; \ No newline at end of file +var _0x786c=['activateAdditionalPhone','IncrementPreviewCounters','CmHopper','field','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','CmHopperAdditionalPhone,\x20%s,\x20%s','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','VerifyAdditionalPhones','findOne','ContactId','ListId','body','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','SwapAdditionalPhones','duration','waitTime','scheduledat','add','minutes','isNil','createdAt','updatedAt','sequelize','transaction','update','phone'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x786c,0x172));var _0xc786=function(_0xf38000,_0x4fe6f2){_0xf38000=_0xf38000-0x0;var _0x1b0f1b=_0x786c[_0xf38000];return _0x1b0f1b;};'use strict';var _=require(_0xc786('0x0'));var util=require(_0xc786('0x1'));var moment=require(_0xc786('0x2'));var BPromise=require(_0xc786('0x3'));var rs=require(_0xc786('0x4'));var fs=require('fs');var Redis=require(_0xc786('0x5'));var db=require(_0xc786('0x6'))['db'];var utils=require(_0xc786('0x7'));var logger=require(_0xc786('0x8'))(_0xc786('0x9'));var config=require(_0xc786('0xa'));var jayson=require(_0xc786('0xb'));var client=jayson['client'][_0xc786('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1ddbe2,_0x48f8d2,_0x52146c){return new BPromise(function(_0x23d4d1,_0x2f9f7a){return client[_0xc786('0xd')](_0x1ddbe2,_0x52146c)[_0xc786('0xe')](function(_0x1a25cd){logger['info'](_0xc786('0xf'),_0x48f8d2,'request\x20sent');logger[_0xc786('0x10')](_0xc786('0x11'),_0x48f8d2,_0xc786('0x12'),JSON[_0xc786('0x13')](_0x1a25cd));if(_0x1a25cd[_0xc786('0x14')]){if(_0x1a25cd[_0xc786('0x14')][_0xc786('0x15')]===0x1f4){logger['error']('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x48f8d2,_0x1a25cd[_0xc786('0x14')][_0xc786('0x16')]);return _0x2f9f7a(_0x1a25cd['error'][_0xc786('0x16')]);}logger['error'](_0xc786('0xf'),_0x48f8d2,_0x1a25cd['error']['message']);return _0x23d4d1(_0x1a25cd[_0xc786('0x14')][_0xc786('0x16')]);}else{logger[_0xc786('0x17')](_0xc786('0xf'),_0x48f8d2,'request\x20sent');_0x23d4d1(_0x1a25cd[_0xc786('0x18')][_0xc786('0x16')]);}})[_0xc786('0x19')](function(_0x2f691e){logger['error'](_0xc786('0xf'),_0x48f8d2,_0x2f691e);_0x2f9f7a(_0x2f691e);});});}exports[_0xc786('0x1a')]=function(_0x144624){var _0x1f4ee6=this;return new Promise(function(_0x39f90a,_0x4a7e6d){return db['CmHopper'][_0xc786('0x1b')]({'raw':!![],'where':{'ContactId':_0x144624['body'][_0xc786('0x1c')],'ListId':_0x144624['body'][_0xc786('0x1d')],'VoiceQueueId':_0x144624[_0xc786('0x1e')][_0xc786('0x1f')]===undefined?null:_0x144624['body']['VoiceQueueId'],'CampaignId':_0x144624[_0xc786('0x1e')][_0xc786('0x20')]===undefined?null:_0x144624[_0xc786('0x1e')][_0xc786('0x20')]}})[_0xc786('0xe')](function(_0x22d830){if(_0x22d830!=null){return db[_0xc786('0x21')][_0xc786('0x1b')]({'raw':!![],'where':{'CmHopperId':_0x22d830['id'],'OrderBy':{'$gt':_0x22d830[_0xc786('0x22')]}},'order':[[_0xc786('0x22'),_0xc786('0x23')]]})[_0xc786('0xe')](function(_0x224afd){var _0x1e7e5f=0x0;if(_0x224afd){if(_0x224afd[_0xc786('0x24')]+_0x224afd[_0xc786('0x25')]+_0x224afd[_0xc786('0x26')]+_0x224afd[_0xc786('0x27')]+_0x224afd[_0xc786('0x28')]+_0x224afd[_0xc786('0x29')]+_0x224afd[_0xc786('0x2a')]+_0x224afd[_0xc786('0x2b')]<_0x144624['entity']['dialGlobalMaxRetry'])_0x1e7e5f=0x1;_0x39f90a({'additional':_0x1e7e5f});}else{return db[_0xc786('0x21')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x22d830['id']},'order':[['OrderBy',_0xc786('0x23')]]})[_0xc786('0xe')](function(_0x298298){var _0x335e45=0x0;if(_0x298298){if(_0x298298[_0xc786('0x24')]+_0x298298[_0xc786('0x25')]+_0x298298[_0xc786('0x26')]+_0x298298[_0xc786('0x27')]+_0x298298[_0xc786('0x28')]+_0x298298[_0xc786('0x29')]+_0x298298['countmachineretry']+_0x298298[_0xc786('0x2b')]<_0x144624['entity']['dialGlobalMaxRetry'])_0x335e45=0x1;_0x39f90a({'additional':_0x335e45});}else{_0x39f90a({'additional':0x0});}})[_0xc786('0x19')](function(_0x45f9b6){logger[_0xc786('0x14')]('VerifyAdditionalPhones',_0x45f9b6['message']);_0x4a7e6d(_0x1f4ee6[_0xc786('0x14')](0x1f4,_0x45f9b6[_0xc786('0x16')]));});}})['catch'](function(_0x4ec381){logger[_0xc786('0x14')](_0xc786('0x1a'),_0x4ec381[_0xc786('0x16')]);_0x4a7e6d(_0x1f4ee6['error'](0x1f4,_0x4ec381[_0xc786('0x16')]));});}else _0x39f90a({'additional':0x0});});});};exports[_0xc786('0x2c')]=function(_0x4ff16a){var _0x469543=this;return new Promise(function(_0x430e3a,_0x530feb){return db['CmHopper'][_0xc786('0x1b')]({'raw':!![],'where':{'ContactId':_0x4ff16a[_0xc786('0x1e')]['ContactId'],'ListId':_0x4ff16a[_0xc786('0x1e')][_0xc786('0x1d')],'VoiceQueueId':_0x4ff16a['body'][_0xc786('0x1f')]===undefined?null:_0x4ff16a[_0xc786('0x1e')][_0xc786('0x1f')],'CampaignId':_0x4ff16a[_0xc786('0x1e')][_0xc786('0x20')]===undefined?null:_0x4ff16a[_0xc786('0x1e')][_0xc786('0x20')]}})[_0xc786('0xe')](function(_0x304f6f){if(_0x304f6f!=null){return db[_0xc786('0x21')][_0xc786('0x1b')]({'raw':!![],'where':{'CmHopperId':_0x304f6f['id'],'OrderBy':{'$gte':_0x304f6f[_0xc786('0x22')]}},'order':[[_0xc786('0x22'),_0xc786('0x23')]]})[_0xc786('0xe')](function(_0x2d1332){if(_0x2d1332)return activateAdditionalPhone(_0x304f6f,_0x4ff16a['body'],_0x2d1332,_0x4ff16a[_0xc786('0x2d')],_0x4ff16a[_0xc786('0x2e')])[_0xc786('0xe')](function(_0x505c4a){_0x430e3a(_0x505c4a);});else{return db[_0xc786('0x21')][_0xc786('0x1b')]({'raw':!![],'where':{'CmHopperId':_0x304f6f['id']},'order':[['OrderBy',_0xc786('0x23')]]})[_0xc786('0xe')](function(_0x28aeb3){if(_0x28aeb3)return activateAdditionalPhone(_0x304f6f,_0x4ff16a[_0xc786('0x1e')],_0x28aeb3,_0x4ff16a[_0xc786('0x2d')],_0x4ff16a[_0xc786('0x2e')])['then'](function(_0x15b3ff){_0x430e3a(_0x15b3ff);});else{_0x430e3a({'id':_0x304f6f['id'],'phone':''});}})[_0xc786('0x19')](function(_0x3907de){logger[_0xc786('0x14')]('VerifyAdditionalPhones',_0x3907de[_0xc786('0x16')]);_0x530feb(_0x469543[_0xc786('0x14')](0x1f4,_0x3907de['message']));});}})['catch'](function(_0x51044f){logger[_0xc786('0x14')](_0xc786('0x1a'),_0x51044f['message']);_0x530feb(_0x469543[_0xc786('0x14')](0x1f4,_0x51044f[_0xc786('0x16')]));});}else _0x430e3a(0x1);});});};function activateAdditionalPhone(_0x480e77,_0x52f5ad,_0xc6549,_0x3336e5,_0x37e87f){return new Promise(function(_0x4a4c8d,_0x2efcf0){var _0x23a36a;if(_['isNil'](_0xc6549[_0xc786('0x2f')])){_0xc6549[_0xc786('0x2f')]=moment();}if(moment()>moment(_0xc6549['scheduledat'])){_0x23a36a=moment()[_0xc786('0x30')](_0x37e87f||0x3,'minutes');}else{if(_0xc6549['OrderBy']==0x0){_0x23a36a=moment(_0xc6549['scheduledat']);}else{_0x23a36a=moment()['add'](_0x37e87f||0x3,_0xc786('0x31'));}}if(_[_0xc786('0x32')](_0x23a36a)){_0x23a36a=moment()['add'](_0x37e87f||0x3,'minutes');}var _0x3cd7ff={'phone':_0x480e77['phone'],'active':0x0,'OrderBy':_[_0xc786('0x32')](_0x480e77[_0xc786('0x22')])?0x0:_0x480e77[_0xc786('0x22')],'scheduledat':moment()[_0xc786('0x30')](_0x3336e5||0x1,_0xc786('0x31')),'countbusyretry':_0x52f5ad[_0xc786('0x24')],'countcongestionretry':_0x52f5ad['countcongestionretry'],'countnoanswerretry':_0x52f5ad[_0xc786('0x26')],'countnosuchnumberretry':_0x52f5ad['countnosuchnumberretry'],'countdropretry':_0x52f5ad[_0xc786('0x28')],'countabandonedretry':_0x52f5ad['countabandonedretry'],'countmachineretry':_0x52f5ad[_0xc786('0x2a')],'countagentrejectretry':_0x52f5ad[_0xc786('0x2b')],'createdAt':_0x52f5ad[_0xc786('0x33')],'updatedAt':_0x52f5ad[_0xc786('0x34')]};var _0x16f8fd={'CmHopperId':_0x480e77['id'],'phone':_0xc6549['phone'],'active':0x0,'OrderBy':_[_0xc786('0x32')](_0xc6549['OrderBy'])?0x0:_0xc6549[_0xc786('0x22')],'scheduledat':_0x23a36a,'countbusyretry':_0xc6549[_0xc786('0x24')],'countcongestionretry':_0xc6549[_0xc786('0x25')],'countnoanswerretry':_0xc6549[_0xc786('0x26')],'countnosuchnumberretry':_0xc6549[_0xc786('0x27')],'countdropretry':_0xc6549[_0xc786('0x28')],'countabandonedretry':_0xc6549[_0xc786('0x29')],'countmachineretry':_0xc6549['countmachineretry'],'countagentrejectretry':_0xc6549[_0xc786('0x2b')],'createdAt':_0xc6549[_0xc786('0x33')],'updatedAt':_0xc6549[_0xc786('0x34')]};return db[_0xc786('0x35')][_0xc786('0x36')](function(_0x33749f){return db[_0xc786('0x21')][_0xc786('0x37')](_0x3cd7ff,{'where':{'id':_0xc6549['id']}},{'transaction':_0x33749f})['then'](function(){return db['CmHopper'][_0xc786('0x37')](_0x16f8fd,{'where':{'id':_0x480e77['id']}},{'transaction':_0x33749f});});})[_0xc786('0xe')](function(_0x85eb75){_0x4a4c8d({'id':_0x480e77['id'],'phone':_0xc6549[_0xc786('0x38')]});})[_0xc786('0x19')](function(_0x11766b){logger['error'](_0xc786('0x39'),_0x11766b[_0xc786('0x16')]);_0x2efcf0({'error':_0x11766b['message']});});});}exports[_0xc786('0x3a')]=function(_0x40c4b4){var _0x3270a0=this;return new Promise(function(_0x1be4a0,_0x33019b){return db[_0xc786('0x3b')][_0xc786('0x37')](_0x40c4b4[_0xc786('0x1e')][_0xc786('0x3c')],{'where':{'id':_0x40c4b4[_0xc786('0x1e')]['id']}})[_0xc786('0xe')](function(_0x4b2fd7){_0x1be4a0(_0x4b2fd7);})[_0xc786('0x19')](function(_0x530a1c){logger['error'](_0xc786('0x3a'),_0x530a1c[_0xc786('0x16')]);_0x33019b(_0x3270a0[_0xc786('0x14')](0x1f4,_0x530a1c[_0xc786('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index dbc553f..948c62c 100644 --- a/server/api/cmHopperAdditionalPhone/index.js +++ b/server/api/cmHopperAdditionalPhone/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1604=['./cmHopperAdditionalPhone.controller','get','isAuthenticated','index','/:id','show','create','update','delete','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x40dd1e,_0x16eba5){var _0x5218b7=function(_0x3427c8){while(--_0x3427c8){_0x40dd1e['push'](_0x40dd1e['shift']());}};_0x5218b7(++_0x16eba5);}(_0x1604,0xac));var _0x4160=function(_0x4538ea,_0x4143b8){_0x4538ea=_0x4538ea-0x0;var _0x13c198=_0x1604[_0x4538ea];return _0x13c198;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4160('0x0'));var timeout=require(_0x4160('0x1'));var express=require(_0x4160('0x2'));var router=express[_0x4160('0x3')]();var fs_extra=require(_0x4160('0x4'));var auth=require(_0x4160('0x5'));var interaction=require(_0x4160('0x6'));var config=require(_0x4160('0x7'));var controller=require(_0x4160('0x8'));router[_0x4160('0x9')]('/',auth[_0x4160('0xa')](),controller[_0x4160('0xb')]);router[_0x4160('0x9')](_0x4160('0xc'),auth['isAuthenticated'](),controller[_0x4160('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4160('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x4160('0xf')]);router[_0x4160('0x10')](_0x4160('0xc'),auth[_0x4160('0xa')](),controller['destroy']);module[_0x4160('0x11')]=router; \ No newline at end of file +var _0x5100=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./cmHopperAdditionalPhone.controller','isAuthenticated','index','post','create','put','/:id','update','delete'];(function(_0x32a6b6,_0x5b4051){var _0x1f0d46=function(_0x57a315){while(--_0x57a315){_0x32a6b6['push'](_0x32a6b6['shift']());}};_0x1f0d46(++_0x5b4051);}(_0x5100,0x132));var _0x0510=function(_0x1b1fa0,_0x57a2d2){_0x1b1fa0=_0x1b1fa0-0x0;var _0xe1c4a=_0x5100[_0x1b1fa0];return _0xe1c4a;};'use strict';var multer=require(_0x0510('0x0'));var util=require(_0x0510('0x1'));var path=require(_0x0510('0x2'));var timeout=require(_0x0510('0x3'));var express=require(_0x0510('0x4'));var router=express[_0x0510('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x0510('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0510('0x7'));var controller=require(_0x0510('0x8'));router['get']('/',auth[_0x0510('0x9')](),controller[_0x0510('0xa')]);router['get']('/:id',auth[_0x0510('0x9')](),controller['show']);router[_0x0510('0xb')]('/',auth[_0x0510('0x9')](),controller[_0x0510('0xc')]);router[_0x0510('0xd')](_0x0510('0xe'),auth[_0x0510('0x9')](),controller[_0x0510('0xf')]);router[_0x0510('0x10')](_0x0510('0xe'),auth[_0x0510('0x9')](),controller[_0x0510('0x11')]);module[_0x0510('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index c98a93a..e4744aa 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 _0x16ce=['contactListQueue','sequelize','exports','STRING','INTEGER'];(function(_0x158037,_0x35e4fe){var _0x2a283a=function(_0x3e512b){while(--_0x3e512b){_0x158037['push'](_0x158037['shift']());}};_0x2a283a(++_0x35e4fe);}(_0x16ce,0xfb));var _0xe16c=function(_0x20f3fa,_0x708ddd){_0x20f3fa=_0x20f3fa-0x0;var _0x3c690a=_0x16ce[_0x20f3fa];return _0x3c690a;};'use strict';var moment=require('moment');var Sequelize=require(_0xe16c('0x0'));module[_0xe16c('0x1')]={'phone':{'type':Sequelize[_0xe16c('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xe16c('0x3')],'unique':_0xe16c('0x4')},'ListId':{'type':Sequelize[_0xe16c('0x3')],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'}}; \ No newline at end of file +var _0x3e6d=['contactListQueue','sequelize','exports','STRING','INTEGER'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3e6d,0x187));var _0xd3e6=function(_0x4e25c5,_0xacabe3){_0x4e25c5=_0x4e25c5-0x0;var _0x54b972=_0x3e6d[_0x4e25c5];return _0x54b972;};'use strict';var moment=require('moment');var Sequelize=require(_0xd3e6('0x0'));module[_0xd3e6('0x1')]={'phone':{'type':Sequelize[_0xd3e6('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xd3e6('0x3')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0xd3e6('0x3')],'unique':_0xd3e6('0x4')},'VoiceQueueId':{'type':Sequelize[_0xd3e6('0x3')],'unique':_0xd3e6('0x4')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 9457de8..c979a8d 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 _0xe989=['ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','filter','CmHopperBlack','includeAll','include','findAll','rows','catch','show','options','find','body','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse'];(function(_0x1b4d45,_0x554945){var _0x24fa2e=function(_0x2d0611){while(--_0x2d0611){_0x1b4d45['push'](_0x1b4d45['shift']());}};_0x24fa2e(++_0x554945);}(_0xe989,0x11e));var _0x9e98=function(_0x383ea6,_0x2f2296){_0x383ea6=_0x383ea6-0x0;var _0x3334ff=_0xe989[_0x383ea6];return _0x3334ff;};'use strict';var emlformat=require(_0x9e98('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9e98('0x1'));var jsonpatch=require(_0x9e98('0x2'));var rp=require(_0x9e98('0x3'));var moment=require(_0x9e98('0x4'));var BPromise=require(_0x9e98('0x5'));var Mustache=require(_0x9e98('0x6'));var util=require(_0x9e98('0x7'));var path=require(_0x9e98('0x8'));var sox=require(_0x9e98('0x9'));var csv=require(_0x9e98('0xa'));var ejs=require(_0x9e98('0xb'));var fs=require('fs');var fs_extra=require(_0x9e98('0xc'));var _=require('lodash');var squel=require(_0x9e98('0xd'));var crypto=require('crypto');var jsforce=require(_0x9e98('0xe'));var deskjs=require(_0x9e98('0xf'));var toCsv=require(_0x9e98('0xa'));var querystring=require(_0x9e98('0x10'));var Papa=require(_0x9e98('0x11'));var Redis=require(_0x9e98('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9e98('0x13'));var hardwareService=require(_0x9e98('0x14'));var logger=require(_0x9e98('0x15'))(_0x9e98('0x16'));var utils=require(_0x9e98('0x17'));var config=require(_0x9e98('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3ea642,_0x539611){_0x539611=_0x539611||0xcc;return function(_0x34ce72){if(_0x34ce72){return _0x3ea642[_0x9e98('0x19')](_0x539611);}return _0x3ea642[_0x9e98('0x1a')](_0x539611)[_0x9e98('0x1b')]();};}function respondWithResult(_0x2eff97,_0x2f04f8){_0x2f04f8=_0x2f04f8||0xc8;return function(_0xa25fb0){if(_0xa25fb0){return _0x2eff97[_0x9e98('0x1a')](_0x2f04f8)[_0x9e98('0x1c')](_0xa25fb0);}};}function respondWithFilteredResult(_0x314c48,_0x2ae26c){return function(_0x36cf00){if(_0x36cf00){var _0x3fc0c0=typeof _0x2ae26c[_0x9e98('0x1d')]===_0x9e98('0x1e')&&typeof _0x2ae26c[_0x9e98('0x1f')]===_0x9e98('0x1e');var _0x40c4ff=_0x36cf00[_0x9e98('0x20')];var _0x330d19=_0x3fc0c0?0x0:_0x2ae26c[_0x9e98('0x1d')];var _0x7e7e49=_0x3fc0c0?_0x36cf00[_0x9e98('0x20')]:_0x2ae26c[_0x9e98('0x1d')]+_0x2ae26c[_0x9e98('0x1f')];var _0x30e54e;if(_0x7e7e49>=_0x40c4ff){_0x7e7e49=_0x40c4ff;_0x30e54e=0xc8;}else{_0x30e54e=0xce;}_0x314c48['status'](_0x30e54e);return _0x314c48[_0x9e98('0x21')](_0x9e98('0x22'),_0x330d19+'-'+_0x7e7e49+'/'+_0x40c4ff)[_0x9e98('0x1c')](_0x36cf00);}return null;};}function patchUpdates(_0x19a3f8){return function(_0x5c857a){try{jsonpatch[_0x9e98('0x23')](_0x5c857a,_0x19a3f8,!![]);}catch(_0xf8454c){return BPromise[_0x9e98('0x24')](_0xf8454c);}return _0x5c857a[_0x9e98('0x25')]();};}function saveUpdates(_0x4abd06,_0x256b27){return function(_0x55dd16){if(_0x55dd16){return _0x55dd16[_0x9e98('0x26')](_0x4abd06)[_0x9e98('0x27')](function(_0x5608d1){return _0x5608d1;});}return null;};}function removeEntity(_0x12d1c3,_0xf0b9cb){return function(_0x343af3){if(_0x343af3){return _0x343af3[_0x9e98('0x28')]()['then'](function(){_0x12d1c3[_0x9e98('0x1a')](0xcc)[_0x9e98('0x1b')]();});}};}function handleEntityNotFound(_0x77458d,_0x503ce8){return function(_0x48b26a){if(!_0x48b26a){_0x77458d[_0x9e98('0x19')](0x194);}return _0x48b26a;};}function handleError(_0x51c785,_0x4b1a7a){_0x4b1a7a=_0x4b1a7a||0x1f4;return function(_0x2ad27a){logger[_0x9e98('0x29')](_0x2ad27a['stack']);if(_0x2ad27a['name']){delete _0x2ad27a[_0x9e98('0x2a')];}_0x51c785[_0x9e98('0x1a')](_0x4b1a7a)['send'](_0x2ad27a);};}exports[_0x9e98('0x2b')]=function(_0x3e5415,_0x70aa85){var _0x5d830d={},_0x470a21={},_0x27a6e3={'count':0x0,'rows':[]};var _0xde2f61=_[_0x9e98('0x2c')](db['CmHopperBlack'][_0x9e98('0x2d')],function(_0x4dc11b){return{'name':_0x4dc11b[_0x9e98('0x2e')],'type':_0x4dc11b[_0x9e98('0x2f')][_0x9e98('0x30')]};});_0x470a21[_0x9e98('0x31')]=_[_0x9e98('0x2c')](_0xde2f61,_0x9e98('0x2a'));_0x470a21[_0x9e98('0x32')]=_[_0x9e98('0x33')](_0x3e5415[_0x9e98('0x32')]);_0x470a21[_0x9e98('0x34')]=_[_0x9e98('0x35')](_0x470a21[_0x9e98('0x31')],_0x470a21[_0x9e98('0x32')]);_0x5d830d[_0x9e98('0x36')]=_[_0x9e98('0x35')](_0x470a21[_0x9e98('0x31')],qs[_0x9e98('0x37')](_0x3e5415[_0x9e98('0x32')][_0x9e98('0x37')]));_0x5d830d[_0x9e98('0x36')]=_0x5d830d['attributes'][_0x9e98('0x38')]?_0x5d830d['attributes']:_0x470a21[_0x9e98('0x31')];if(!_0x3e5415[_0x9e98('0x32')][_0x9e98('0x39')](_0x9e98('0x3a'))){_0x5d830d[_0x9e98('0x1f')]=qs[_0x9e98('0x1f')](_0x3e5415[_0x9e98('0x32')][_0x9e98('0x1f')]);_0x5d830d[_0x9e98('0x1d')]=qs[_0x9e98('0x1d')](_0x3e5415['query'][_0x9e98('0x1d')]);}_0x5d830d['order']=qs[_0x9e98('0x3b')](_0x3e5415[_0x9e98('0x32')][_0x9e98('0x3b')]);_0x5d830d[_0x9e98('0x3c')]=qs[_0x9e98('0x34')](_[_0x9e98('0x3d')](_0x3e5415['query'],_0x470a21[_0x9e98('0x34')]),_0xde2f61);if(_0x3e5415['query']['filter']){_0x5d830d[_0x9e98('0x3c')]=_[_0x9e98('0x3e')](_0x5d830d['where'],{'$or':_['map'](_0xde2f61,function(_0x5b05b6){if(_0x5b05b6[_0x9e98('0x2f')]!=='VIRTUAL'){var _0x2423b8={};_0x2423b8[_0x5b05b6[_0x9e98('0x2a')]]={'$like':'%'+_0x3e5415[_0x9e98('0x32')][_0x9e98('0x3f')]+'%'};return _0x2423b8;}})});}_0x5d830d=_[_0x9e98('0x3e')]({},_0x5d830d,_0x3e5415['options']);var _0x45fe0f={'where':_0x5d830d['where']};return db[_0x9e98('0x40')][_0x9e98('0x20')](_0x45fe0f)[_0x9e98('0x27')](function(_0x4a3cc9){_0x27a6e3[_0x9e98('0x20')]=_0x4a3cc9;if(_0x3e5415[_0x9e98('0x32')][_0x9e98('0x41')]){_0x5d830d[_0x9e98('0x42')]=[{'all':!![]}];}return db[_0x9e98('0x40')][_0x9e98('0x43')](_0x5d830d);})[_0x9e98('0x27')](function(_0x10f62c){_0x27a6e3[_0x9e98('0x44')]=_0x10f62c;return _0x27a6e3;})[_0x9e98('0x27')](respondWithFilteredResult(_0x70aa85,_0x5d830d))[_0x9e98('0x45')](handleError(_0x70aa85,null));};exports[_0x9e98('0x46')]=function(_0x59fa4f,_0x4194c5){var _0x546420={'raw':!![],'where':{'id':_0x59fa4f['params']['id']}},_0x1d10a6={};_0x1d10a6['model']=_['keys'](db[_0x9e98('0x40')][_0x9e98('0x2d')]);_0x1d10a6[_0x9e98('0x32')]=_['keys'](_0x59fa4f[_0x9e98('0x32')]);_0x1d10a6[_0x9e98('0x34')]=_[_0x9e98('0x35')](_0x1d10a6[_0x9e98('0x31')],_0x1d10a6[_0x9e98('0x32')]);_0x546420[_0x9e98('0x36')]=_['intersection'](_0x1d10a6[_0x9e98('0x31')],qs[_0x9e98('0x37')](_0x59fa4f[_0x9e98('0x32')][_0x9e98('0x37')]));_0x546420['attributes']=_0x546420[_0x9e98('0x36')][_0x9e98('0x38')]?_0x546420[_0x9e98('0x36')]:_0x1d10a6['model'];if(_0x59fa4f[_0x9e98('0x32')][_0x9e98('0x41')]){_0x546420[_0x9e98('0x42')]=[{'all':!![]}];}_0x546420=_['merge']({},_0x546420,_0x59fa4f[_0x9e98('0x47')]);return db[_0x9e98('0x40')][_0x9e98('0x48')](_0x546420)[_0x9e98('0x27')](handleEntityNotFound(_0x4194c5,null))[_0x9e98('0x27')](respondWithResult(_0x4194c5,null))[_0x9e98('0x45')](handleError(_0x4194c5,null));};exports[_0x9e98('0x26')]=function(_0x141678,_0x5aa126){if(_0x141678[_0x9e98('0x49')]['id']){delete _0x141678[_0x9e98('0x49')]['id'];}return db['CmHopperBlack']['find']({'where':{'id':_0x141678[_0x9e98('0x4a')]['id']}})[_0x9e98('0x27')](handleEntityNotFound(_0x5aa126,null))['then'](saveUpdates(_0x141678[_0x9e98('0x49')],null))[_0x9e98('0x27')](respondWithResult(_0x5aa126,null))[_0x9e98('0x45')](handleError(_0x5aa126,null));};exports[_0x9e98('0x28')]=function(_0x594429,_0x3959cf){return db[_0x9e98('0x40')][_0x9e98('0x48')]({'where':{'id':_0x594429[_0x9e98('0x4a')]['id']}})[_0x9e98('0x27')](handleEntityNotFound(_0x3959cf,null))['then'](removeEntity(_0x3959cf,null))[_0x9e98('0x45')](handleError(_0x3959cf,null));};exports[_0x9e98('0x4b')]=function(_0x4b024b,_0x4c39bb){return db[_0x9e98('0x40')][_0x9e98('0x4b')]()[_0x9e98('0x27')](respondWithResult(_0x4c39bb,null))[_0x9e98('0x45')](handleError(_0x4c39bb,null));}; \ No newline at end of file +var _0xe056=['body','destroy','describe','zip-dir','fast-json-patch','request-promise','bluebird','util','path','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','Content-Range','json','apply','reject','save','update','then','stack','name','send','map','CmHopperBlack','fieldName','type','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','options','includeAll','include','findAll','rows','params','fields','merge','find','catch'];(function(_0x4e6845,_0x5001f6){var _0x3703e2=function(_0x2ccbd8){while(--_0x2ccbd8){_0x4e6845['push'](_0x4e6845['shift']());}};_0x3703e2(++_0x5001f6);}(_0xe056,0xdb));var _0x6e05=function(_0x422be2,_0x1c439e){_0x422be2=_0x422be2-0x0;var _0x1b820e=_0xe056[_0x422be2];return _0x1b820e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6e05('0x0'));var jsonpatch=require(_0x6e05('0x1'));var rp=require(_0x6e05('0x2'));var moment=require('moment');var BPromise=require(_0x6e05('0x3'));var Mustache=require('mustache');var util=require(_0x6e05('0x4'));var path=require(_0x6e05('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6e05('0x6'));var _=require(_0x6e05('0x7'));var squel=require(_0x6e05('0x8'));var crypto=require('crypto');var jsforce=require(_0x6e05('0x9'));var deskjs=require(_0x6e05('0xa'));var toCsv=require(_0x6e05('0xb'));var querystring=require(_0x6e05('0xc'));var Papa=require(_0x6e05('0xd'));var Redis=require('ioredis');var authService=require(_0x6e05('0xe'));var qs=require(_0x6e05('0xf'));var as=require(_0x6e05('0x10'));var hardwareService=require(_0x6e05('0x11'));var logger=require(_0x6e05('0x12'))(_0x6e05('0x13'));var utils=require('../../config/utils');var config=require(_0x6e05('0x14'));var licenseUtil=require(_0x6e05('0x15'));var db=require(_0x6e05('0x16'))['db'];function respondWithStatusCode(_0x5eaf38,_0x111a7c){_0x111a7c=_0x111a7c||0xcc;return function(_0x41ce19){if(_0x41ce19){return _0x5eaf38[_0x6e05('0x17')](_0x111a7c);}return _0x5eaf38[_0x6e05('0x18')](_0x111a7c)[_0x6e05('0x19')]();};}function respondWithResult(_0x4f4fab,_0x20afe3){_0x20afe3=_0x20afe3||0xc8;return function(_0x291d2c){if(_0x291d2c){return _0x4f4fab['status'](_0x20afe3)['json'](_0x291d2c);}};}function respondWithFilteredResult(_0x37b270,_0x45567a){return function(_0xb0c230){if(_0xb0c230){var _0x5c778b=typeof _0x45567a[_0x6e05('0x1a')]==='undefined'&&typeof _0x45567a[_0x6e05('0x1b')]===_0x6e05('0x1c');var _0x517326=_0xb0c230['count'];var _0x9d1e04=_0x5c778b?0x0:_0x45567a[_0x6e05('0x1a')];var _0x4418c6=_0x5c778b?_0xb0c230[_0x6e05('0x1d')]:_0x45567a[_0x6e05('0x1a')]+_0x45567a['limit'];var _0x13d0aa;if(_0x4418c6>=_0x517326){_0x4418c6=_0x517326;_0x13d0aa=0xc8;}else{_0x13d0aa=0xce;}_0x37b270['status'](_0x13d0aa);return _0x37b270['set'](_0x6e05('0x1e'),_0x9d1e04+'-'+_0x4418c6+'/'+_0x517326)[_0x6e05('0x1f')](_0xb0c230);}return null;};}function patchUpdates(_0xe49265){return function(_0x3d9c12){try{jsonpatch[_0x6e05('0x20')](_0x3d9c12,_0xe49265,!![]);}catch(_0x31c52e){return BPromise[_0x6e05('0x21')](_0x31c52e);}return _0x3d9c12[_0x6e05('0x22')]();};}function saveUpdates(_0x488055,_0x1438a6){return function(_0x4db161){if(_0x4db161){return _0x4db161[_0x6e05('0x23')](_0x488055)[_0x6e05('0x24')](function(_0x3eb6e4){return _0x3eb6e4;});}return null;};}function removeEntity(_0x5988b5,_0x5dc6dc){return function(_0x447d4b){if(_0x447d4b){return _0x447d4b['destroy']()[_0x6e05('0x24')](function(){_0x5988b5[_0x6e05('0x18')](0xcc)[_0x6e05('0x19')]();});}};}function handleEntityNotFound(_0x3444ea,_0x3a268b){return function(_0x19f3a6){if(!_0x19f3a6){_0x3444ea[_0x6e05('0x17')](0x194);}return _0x19f3a6;};}function handleError(_0x5d7701,_0x3b8842){_0x3b8842=_0x3b8842||0x1f4;return function(_0x3bdfef){logger['error'](_0x3bdfef[_0x6e05('0x25')]);if(_0x3bdfef[_0x6e05('0x26')]){delete _0x3bdfef['name'];}_0x5d7701['status'](_0x3b8842)[_0x6e05('0x27')](_0x3bdfef);};}exports['index']=function(_0x2d421f,_0x3c2504){var _0x4c8852={},_0x4e15c7={},_0x3f19f7={'count':0x0,'rows':[]};var _0x15138d=_[_0x6e05('0x28')](db[_0x6e05('0x29')]['rawAttributes'],function(_0x2bc108){return{'name':_0x2bc108[_0x6e05('0x2a')],'type':_0x2bc108[_0x6e05('0x2b')]['key']};});_0x4e15c7[_0x6e05('0x2c')]=_['map'](_0x15138d,'name');_0x4e15c7['query']=_[_0x6e05('0x2d')](_0x2d421f[_0x6e05('0x2e')]);_0x4e15c7[_0x6e05('0x2f')]=_[_0x6e05('0x30')](_0x4e15c7[_0x6e05('0x2c')],_0x4e15c7[_0x6e05('0x2e')]);_0x4c8852[_0x6e05('0x31')]=_['intersection'](_0x4e15c7[_0x6e05('0x2c')],qs['fields'](_0x2d421f[_0x6e05('0x2e')]['fields']));_0x4c8852[_0x6e05('0x31')]=_0x4c8852['attributes'][_0x6e05('0x32')]?_0x4c8852['attributes']:_0x4e15c7[_0x6e05('0x2c')];if(!_0x2d421f['query'][_0x6e05('0x33')](_0x6e05('0x34'))){_0x4c8852[_0x6e05('0x1b')]=qs[_0x6e05('0x1b')](_0x2d421f[_0x6e05('0x2e')][_0x6e05('0x1b')]);_0x4c8852['offset']=qs[_0x6e05('0x1a')](_0x2d421f[_0x6e05('0x2e')][_0x6e05('0x1a')]);}_0x4c8852[_0x6e05('0x35')]=qs['sort'](_0x2d421f['query'][_0x6e05('0x36')]);_0x4c8852['where']=qs[_0x6e05('0x2f')](_[_0x6e05('0x37')](_0x2d421f[_0x6e05('0x2e')],_0x4e15c7[_0x6e05('0x2f')]),_0x15138d);if(_0x2d421f['query'][_0x6e05('0x38')]){_0x4c8852['where']=_['merge'](_0x4c8852[_0x6e05('0x39')],{'$or':_['map'](_0x15138d,function(_0x547950){if(_0x547950[_0x6e05('0x2b')]!==_0x6e05('0x3a')){var _0x2ec523={};_0x2ec523[_0x547950[_0x6e05('0x26')]]={'$like':'%'+_0x2d421f['query'][_0x6e05('0x38')]+'%'};return _0x2ec523;}})});}_0x4c8852=_['merge']({},_0x4c8852,_0x2d421f[_0x6e05('0x3b')]);var _0x3cf0e5={'where':_0x4c8852['where']};return db[_0x6e05('0x29')][_0x6e05('0x1d')](_0x3cf0e5)[_0x6e05('0x24')](function(_0x2498b7){_0x3f19f7['count']=_0x2498b7;if(_0x2d421f['query'][_0x6e05('0x3c')]){_0x4c8852[_0x6e05('0x3d')]=[{'all':!![]}];}return db[_0x6e05('0x29')][_0x6e05('0x3e')](_0x4c8852);})[_0x6e05('0x24')](function(_0x5df453){_0x3f19f7[_0x6e05('0x3f')]=_0x5df453;return _0x3f19f7;})['then'](respondWithFilteredResult(_0x3c2504,_0x4c8852))['catch'](handleError(_0x3c2504,null));};exports['show']=function(_0x4a4f56,_0xeabd51){var _0x562dd8={'raw':!![],'where':{'id':_0x4a4f56[_0x6e05('0x40')]['id']}},_0x506515={};_0x506515[_0x6e05('0x2c')]=_[_0x6e05('0x2d')](db[_0x6e05('0x29')]['rawAttributes']);_0x506515[_0x6e05('0x2e')]=_['keys'](_0x4a4f56[_0x6e05('0x2e')]);_0x506515['filters']=_[_0x6e05('0x30')](_0x506515['model'],_0x506515[_0x6e05('0x2e')]);_0x562dd8['attributes']=_[_0x6e05('0x30')](_0x506515[_0x6e05('0x2c')],qs[_0x6e05('0x41')](_0x4a4f56['query']['fields']));_0x562dd8[_0x6e05('0x31')]=_0x562dd8[_0x6e05('0x31')]['length']?_0x562dd8[_0x6e05('0x31')]:_0x506515[_0x6e05('0x2c')];if(_0x4a4f56[_0x6e05('0x2e')][_0x6e05('0x3c')]){_0x562dd8[_0x6e05('0x3d')]=[{'all':!![]}];}_0x562dd8=_[_0x6e05('0x42')]({},_0x562dd8,_0x4a4f56[_0x6e05('0x3b')]);return db[_0x6e05('0x29')][_0x6e05('0x43')](_0x562dd8)[_0x6e05('0x24')](handleEntityNotFound(_0xeabd51,null))[_0x6e05('0x24')](respondWithResult(_0xeabd51,null))[_0x6e05('0x44')](handleError(_0xeabd51,null));};exports[_0x6e05('0x23')]=function(_0x3dc9d9,_0x30f81c){if(_0x3dc9d9[_0x6e05('0x45')]['id']){delete _0x3dc9d9['body']['id'];}return db[_0x6e05('0x29')][_0x6e05('0x43')]({'where':{'id':_0x3dc9d9[_0x6e05('0x40')]['id']}})[_0x6e05('0x24')](handleEntityNotFound(_0x30f81c,null))['then'](saveUpdates(_0x3dc9d9['body'],null))[_0x6e05('0x24')](respondWithResult(_0x30f81c,null))['catch'](handleError(_0x30f81c,null));};exports[_0x6e05('0x46')]=function(_0x2cd3a6,_0x3350bf){return db[_0x6e05('0x29')]['find']({'where':{'id':_0x2cd3a6[_0x6e05('0x40')]['id']}})[_0x6e05('0x24')](handleEntityNotFound(_0x3350bf,null))[_0x6e05('0x24')](removeEntity(_0x3350bf,null))[_0x6e05('0x44')](handleError(_0x3350bf,null));};exports[_0x6e05('0x47')]=function(_0x518ae6,_0x439115){return db[_0x6e05('0x29')]['describe']()[_0x6e05('0x24')](respondWithResult(_0x439115,null))[_0x6e05('0x44')](handleError(_0x439115,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index bacc112..fcc588d 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 _0xa01a=['define','CmHopperBlack','cm_hopper_black','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x3bd961,_0x26f947){var _0xbeeb8e=function(_0x3c2a17){while(--_0x3c2a17){_0x3bd961['push'](_0x3bd961['shift']());}};_0xbeeb8e(++_0x26f947);}(_0xa01a,0x8a));var _0xaa01=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa01a[_0xae7c2f];return _0x5d7001;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xaa01('0x0'));var rp=require(_0xaa01('0x1'));var fs=require('fs');var path=require(_0xaa01('0x2'));var rimraf=require(_0xaa01('0x3'));var config=require(_0xaa01('0x4'));var attributes=require('./cmHopperBlack.attributes');module[_0xaa01('0x5')]=function(_0x564603,_0x1a9ad3){return _0x564603[_0xaa01('0x6')](_0xaa01('0x7'),attributes,{'tableName':_0xaa01('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1c05=['exports','define','CmHopperBlack','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x470bfb,_0x389787){var _0x2f5d97=function(_0x3431b4){while(--_0x3431b4){_0x470bfb['push'](_0x470bfb['shift']());}};_0x2f5d97(++_0x389787);}(_0x1c05,0xf3));var _0x51c0=function(_0x2ff6e8,_0x4edcb5){_0x2ff6e8=_0x2ff6e8-0x0;var _0x23d5c7=_0x1c05[_0x2ff6e8];return _0x23d5c7;};'use strict';var _=require(_0x51c0('0x0'));var util=require(_0x51c0('0x1'));var logger=require(_0x51c0('0x2'))(_0x51c0('0x3'));var moment=require(_0x51c0('0x4'));var BPromise=require(_0x51c0('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x51c0('0x6'));var rimraf=require(_0x51c0('0x7'));var config=require(_0x51c0('0x8'));var attributes=require('./cmHopperBlack.attributes');module[_0x51c0('0x9')]=function(_0x4b1452,_0x3d00ce){return _0x4b1452[_0x51c0('0xa')](_0x51c0('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 bc5e785..01aa054 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 _0xe161=['options','raw','attributes','limit','include','map','model','body','where','UpdateCmHopperBlack','catch','DestroyCmHopperBlack','destroy','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','CmHopperBlack,\x20%s,\x20%s','message','info','result','GetCmHopperBlack','CmHopperBlack','findAll'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xe161,0x15a));var _0x1e16=function(_0x280fa3,_0x5f52a7){_0x280fa3=_0x280fa3-0x0;var _0x248ec6=_0xe161[_0x280fa3];return _0x248ec6;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1e16('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1e16('0x1'));var db=require(_0x1e16('0x2'))['db'];var utils=require(_0x1e16('0x3'));var logger=require(_0x1e16('0x4'))(_0x1e16('0x5'));var config=require(_0x1e16('0x6'));var jayson=require(_0x1e16('0x7'));var client=jayson[_0x1e16('0x8')][_0x1e16('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4572e0,_0xedff67,_0x261be1){return new BPromise(function(_0x4345bf,_0x4e3aee){return client[_0x1e16('0xa')](_0x4572e0,_0x261be1)[_0x1e16('0xb')](function(_0x17349d){logger['info']('CmHopperBlack,\x20%s,\x20%s',_0xedff67,_0x1e16('0xc'));logger[_0x1e16('0xd')](_0x1e16('0xe'),_0xedff67,_0x1e16('0xc'),JSON[_0x1e16('0xf')](_0x17349d));if(_0x17349d['error']){if(_0x17349d[_0x1e16('0x10')]['code']===0x1f4){logger[_0x1e16('0x10')](_0x1e16('0x11'),_0xedff67,_0x17349d['error']['message']);return _0x4e3aee(_0x17349d['error']['message']);}logger['error'](_0x1e16('0x11'),_0xedff67,_0x17349d['error'][_0x1e16('0x12')]);return _0x4345bf(_0x17349d[_0x1e16('0x10')][_0x1e16('0x12')]);}else{logger[_0x1e16('0x13')](_0x1e16('0x11'),_0xedff67,_0x1e16('0xc'));_0x4345bf(_0x17349d[_0x1e16('0x14')]['message']);}})['catch'](function(_0x17ef72){logger[_0x1e16('0x10')]('CmHopperBlack,\x20%s,\x20%s',_0xedff67,_0x17ef72);_0x4e3aee(_0x17ef72);});});}exports[_0x1e16('0x15')]=function(_0xca3ca6){var _0x923aad=this;return new Promise(function(_0x732cf5,_0x5493f4){return db[_0x1e16('0x16')][_0x1e16('0x17')]({'raw':_0xca3ca6[_0x1e16('0x18')]?_0xca3ca6[_0x1e16('0x18')][_0x1e16('0x19')]===undefined?!![]:![]:!![],'where':_0xca3ca6[_0x1e16('0x18')]?_0xca3ca6[_0x1e16('0x18')]['where']||null:null,'attributes':_0xca3ca6[_0x1e16('0x18')]?_0xca3ca6[_0x1e16('0x18')][_0x1e16('0x1a')]||null:null,'limit':_0xca3ca6[_0x1e16('0x18')]?_0xca3ca6[_0x1e16('0x18')][_0x1e16('0x1b')]||null:null,'include':_0xca3ca6['options']?_0xca3ca6[_0x1e16('0x18')][_0x1e16('0x1c')]?_[_0x1e16('0x1d')](_0xca3ca6[_0x1e16('0x18')]['include'],function(_0x40a53b){return{'model':db[_0x40a53b[_0x1e16('0x1e')]],'as':_0x40a53b['as'],'attributes':_0x40a53b[_0x1e16('0x1a')],'include':_0x40a53b[_0x1e16('0x1c')]?_[_0x1e16('0x1d')](_0x40a53b['include'],function(_0x230986){return{'model':db[_0x230986[_0x1e16('0x1e')]],'as':_0x230986['as'],'attributes':_0x230986['attributes'],'include':_0x230986['include']?_[_0x1e16('0x1d')](_0x230986[_0x1e16('0x1c')],function(_0x5d5ec3){return{'model':db[_0x5d5ec3[_0x1e16('0x1e')]],'as':_0x5d5ec3['as'],'attributes':_0x5d5ec3['attributes']};}):[]};}):[]};}):[]:[]})[_0x1e16('0xb')](function(_0x9294e){logger[_0x1e16('0x13')](_0x1e16('0x15'),_0xca3ca6);logger[_0x1e16('0xd')](_0x1e16('0x15'),_0xca3ca6,JSON[_0x1e16('0xf')](_0x9294e));_0x732cf5(_0x9294e);})['catch'](function(_0x377657){logger[_0x1e16('0x10')]('GetCmHopperBlack',_0x377657[_0x1e16('0x12')],_0xca3ca6);_0x5493f4(_0x923aad[_0x1e16('0x10')](0x1f4,_0x377657['message']));});});};exports['UpdateCmHopperBlack']=function(_0x36991c){var _0x454cd4=this;return new Promise(function(_0x44e14f,_0x40a981){return db[_0x1e16('0x16')]['update'](_0x36991c[_0x1e16('0x1f')],{'raw':_0x36991c[_0x1e16('0x18')]?_0x36991c[_0x1e16('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x36991c[_0x1e16('0x18')]?_0x36991c[_0x1e16('0x18')][_0x1e16('0x20')]||null:null,'attributes':_0x36991c['options']?_0x36991c[_0x1e16('0x18')]['attributes']||null:null,'limit':_0x36991c[_0x1e16('0x18')]?_0x36991c[_0x1e16('0x18')]['limit']||null:null})[_0x1e16('0xb')](function(_0x1eafcd){logger[_0x1e16('0x13')](_0x1e16('0x21'),_0x36991c);logger[_0x1e16('0xd')](_0x1e16('0x21'),_0x36991c,JSON[_0x1e16('0xf')](_0x1eafcd));_0x44e14f(_0x1eafcd);})[_0x1e16('0x22')](function(_0x57b9ff){logger['error'](_0x1e16('0x21'),_0x57b9ff[_0x1e16('0x12')],_0x36991c);_0x40a981(_0x454cd4[_0x1e16('0x10')](0x1f4,_0x57b9ff[_0x1e16('0x12')]));});});};exports[_0x1e16('0x23')]=function(_0x347144){var _0x5d19e0=this;return new Promise(function(_0x25eafd,_0x2d24e5){return db[_0x1e16('0x16')][_0x1e16('0x24')]({'where':_0x347144[_0x1e16('0x18')]?_0x347144[_0x1e16('0x18')][_0x1e16('0x20')]||null:null})['then'](function(_0x43ec5a){logger[_0x1e16('0x13')](_0x1e16('0x23'),_0x347144);logger[_0x1e16('0xd')](_0x1e16('0x23'),_0x347144,JSON[_0x1e16('0xf')](_0x43ec5a));_0x25eafd(_0x43ec5a);})[_0x1e16('0x22')](function(_0x18ceba){logger[_0x1e16('0x10')]('DestroyCmHopperBlack',_0x18ceba[_0x1e16('0x12')],_0x347144);_0x2d24e5(_0x5d19e0['error'](0x1f4,_0x18ceba['message']));});});}; \ No newline at end of file +var _0x9810=['CmHopperBlack','findAll','options','attributes','limit','include','map','model','GetCmHopperBlack','UpdateCmHopperBlack','update','body','raw','debug','DestroyCmHopperBlack','destroy','where','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','CmHopperBlack,\x20%s,\x20%s','CmHopperBlack,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch'];(function(_0x29fa3d,_0x45d24f){var _0x5d4bbf=function(_0x5b89ef){while(--_0x5b89ef){_0x29fa3d['push'](_0x29fa3d['shift']());}};_0x5d4bbf(++_0x45d24f);}(_0x9810,0x101));var _0x0981=function(_0x5be7aa,_0x5de661){_0x5be7aa=_0x5be7aa-0x0;var _0x215408=_0x9810[_0x5be7aa];return _0x215408;};'use strict';var _=require(_0x0981('0x0'));var util=require(_0x0981('0x1'));var moment=require(_0x0981('0x2'));var BPromise=require(_0x0981('0x3'));var rs=require(_0x0981('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0981('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0981('0x6'))(_0x0981('0x7'));var config=require(_0x0981('0x8'));var jayson=require(_0x0981('0x9'));var client=jayson['client'][_0x0981('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4dc020,_0x26eaf5,_0x12d832){return new BPromise(function(_0x44e747,_0xf3caeb){return client[_0x0981('0xb')](_0x4dc020,_0x12d832)[_0x0981('0xc')](function(_0x1c96d3){logger['info'](_0x0981('0xd'),_0x26eaf5,'request\x20sent');logger['debug'](_0x0981('0xe'),_0x26eaf5,_0x0981('0xf'),JSON[_0x0981('0x10')](_0x1c96d3));if(_0x1c96d3[_0x0981('0x11')]){if(_0x1c96d3[_0x0981('0x11')][_0x0981('0x12')]===0x1f4){logger[_0x0981('0x11')]('CmHopperBlack,\x20%s,\x20%s',_0x26eaf5,_0x1c96d3[_0x0981('0x11')][_0x0981('0x13')]);return _0xf3caeb(_0x1c96d3[_0x0981('0x11')][_0x0981('0x13')]);}logger[_0x0981('0x11')](_0x0981('0xd'),_0x26eaf5,_0x1c96d3[_0x0981('0x11')]['message']);return _0x44e747(_0x1c96d3[_0x0981('0x11')][_0x0981('0x13')]);}else{logger[_0x0981('0x14')]('CmHopperBlack,\x20%s,\x20%s',_0x26eaf5,_0x0981('0xf'));_0x44e747(_0x1c96d3[_0x0981('0x15')][_0x0981('0x13')]);}})[_0x0981('0x16')](function(_0x3e3624){logger['error'](_0x0981('0xd'),_0x26eaf5,_0x3e3624);_0xf3caeb(_0x3e3624);});});}exports['GetCmHopperBlack']=function(_0x5213d8){var _0x3b2ab7=this;return new Promise(function(_0x2a91bd,_0x1fbda0){return db[_0x0981('0x17')][_0x0981('0x18')]({'raw':_0x5213d8[_0x0981('0x19')]?_0x5213d8[_0x0981('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x5213d8[_0x0981('0x19')]?_0x5213d8['options']['where']||null:null,'attributes':_0x5213d8[_0x0981('0x19')]?_0x5213d8[_0x0981('0x19')][_0x0981('0x1a')]||null:null,'limit':_0x5213d8[_0x0981('0x19')]?_0x5213d8['options'][_0x0981('0x1b')]||null:null,'include':_0x5213d8[_0x0981('0x19')]?_0x5213d8[_0x0981('0x19')][_0x0981('0x1c')]?_[_0x0981('0x1d')](_0x5213d8['options'][_0x0981('0x1c')],function(_0x516264){return{'model':db[_0x516264[_0x0981('0x1e')]],'as':_0x516264['as'],'attributes':_0x516264['attributes'],'include':_0x516264[_0x0981('0x1c')]?_[_0x0981('0x1d')](_0x516264['include'],function(_0x1aeb7c){return{'model':db[_0x1aeb7c['model']],'as':_0x1aeb7c['as'],'attributes':_0x1aeb7c[_0x0981('0x1a')],'include':_0x1aeb7c[_0x0981('0x1c')]?_[_0x0981('0x1d')](_0x1aeb7c[_0x0981('0x1c')],function(_0x35b77e){return{'model':db[_0x35b77e[_0x0981('0x1e')]],'as':_0x35b77e['as'],'attributes':_0x35b77e[_0x0981('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1127cc){logger['info']('GetCmHopperBlack',_0x5213d8);logger['debug'](_0x0981('0x1f'),_0x5213d8,JSON[_0x0981('0x10')](_0x1127cc));_0x2a91bd(_0x1127cc);})[_0x0981('0x16')](function(_0x4ee4f1){logger[_0x0981('0x11')](_0x0981('0x1f'),_0x4ee4f1['message'],_0x5213d8);_0x1fbda0(_0x3b2ab7[_0x0981('0x11')](0x1f4,_0x4ee4f1[_0x0981('0x13')]));});});};exports[_0x0981('0x20')]=function(_0x198e97){var _0x459d05=this;return new Promise(function(_0x570207,_0x200284){return db['CmHopperBlack'][_0x0981('0x21')](_0x198e97[_0x0981('0x22')],{'raw':_0x198e97[_0x0981('0x19')]?_0x198e97['options'][_0x0981('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x198e97['options']?_0x198e97[_0x0981('0x19')]['where']||null:null,'attributes':_0x198e97[_0x0981('0x19')]?_0x198e97['options'][_0x0981('0x1a')]||null:null,'limit':_0x198e97[_0x0981('0x19')]?_0x198e97['options'][_0x0981('0x1b')]||null:null})[_0x0981('0xc')](function(_0x8a21c8){logger[_0x0981('0x14')](_0x0981('0x20'),_0x198e97);logger[_0x0981('0x24')](_0x0981('0x20'),_0x198e97,JSON[_0x0981('0x10')](_0x8a21c8));_0x570207(_0x8a21c8);})[_0x0981('0x16')](function(_0x58a58d){logger[_0x0981('0x11')]('UpdateCmHopperBlack',_0x58a58d[_0x0981('0x13')],_0x198e97);_0x200284(_0x459d05['error'](0x1f4,_0x58a58d['message']));});});};exports[_0x0981('0x25')]=function(_0x294a48){var _0x265667=this;return new Promise(function(_0x47e793,_0x59d9fe){return db[_0x0981('0x17')][_0x0981('0x26')]({'where':_0x294a48['options']?_0x294a48[_0x0981('0x19')][_0x0981('0x27')]||null:null})[_0x0981('0xc')](function(_0x5e6d83){logger['info'](_0x0981('0x25'),_0x294a48);logger[_0x0981('0x24')](_0x0981('0x25'),_0x294a48,JSON[_0x0981('0x10')](_0x5e6d83));_0x47e793(_0x5e6d83);})[_0x0981('0x16')](function(_0x198efe){logger['error'](_0x0981('0x25'),_0x198efe[_0x0981('0x13')],_0x294a48);_0x59d9fe(_0x265667['error'](0x1f4,_0x198efe['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 88a283f..aa83de5 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 _0x187d=['multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmHopperBlack.controller','isAuthenticated','index','get','/describe','describe','/:id','show','put','update','delete','destroy','exports'];(function(_0x3b84e9,_0x50e1cc){var _0x41b48f=function(_0x3dd2e5){while(--_0x3dd2e5){_0x3b84e9['push'](_0x3b84e9['shift']());}};_0x41b48f(++_0x50e1cc);}(_0x187d,0x93));var _0xd187=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0x187d[_0xbb091];return _0x467a04;};'use strict';var multer=require(_0xd187('0x0'));var util=require('util');var path=require(_0xd187('0x1'));var timeout=require(_0xd187('0x2'));var express=require(_0xd187('0x3'));var router=express[_0xd187('0x4')]();var fs_extra=require(_0xd187('0x5'));var auth=require(_0xd187('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd187('0x7'));var controller=require(_0xd187('0x8'));router['get']('/',auth[_0xd187('0x9')](),controller[_0xd187('0xa')]);router[_0xd187('0xb')](_0xd187('0xc'),auth[_0xd187('0x9')](),controller[_0xd187('0xd')]);router[_0xd187('0xb')](_0xd187('0xe'),auth['isAuthenticated'](),controller[_0xd187('0xf')]);router[_0xd187('0x10')](_0xd187('0xe'),auth[_0xd187('0x9')](),controller[_0xd187('0x11')]);router[_0xd187('0x12')]('/:id',auth[_0xd187('0x9')](),controller[_0xd187('0x13')]);module[_0xd187('0x14')]=router; \ No newline at end of file +var _0xfdbd=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmHopperBlack.controller','isAuthenticated','index','describe','get','show','put','/:id','update','delete','destroy'];(function(_0x154b4c,_0xa38e2){var _0x100586=function(_0x2912a8){while(--_0x2912a8){_0x154b4c['push'](_0x154b4c['shift']());}};_0x100586(++_0xa38e2);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x34ecbf,_0x210898){_0x34ecbf=_0x34ecbf-0x0;var _0x115f8a=_0xfdbd[_0x34ecbf];return _0x115f8a;};'use strict';var multer=require(_0xdfdb('0x0'));var util=require(_0xdfdb('0x1'));var path=require(_0xdfdb('0x2'));var timeout=require(_0xdfdb('0x3'));var express=require(_0xdfdb('0x4'));var router=express[_0xdfdb('0x5')]();var fs_extra=require(_0xdfdb('0x6'));var auth=require(_0xdfdb('0x7'));var interaction=require(_0xdfdb('0x8'));var config=require('../../config/environment');var controller=require(_0xdfdb('0x9'));router['get']('/',auth[_0xdfdb('0xa')](),controller[_0xdfdb('0xb')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xdfdb('0xc')]);router[_0xdfdb('0xd')]('/:id',auth[_0xdfdb('0xa')](),controller[_0xdfdb('0xe')]);router[_0xdfdb('0xf')](_0xdfdb('0x10'),auth[_0xdfdb('0xa')](),controller[_0xdfdb('0x11')]);router[_0xdfdb('0x12')]('/:id',auth[_0xdfdb('0xa')](),controller[_0xdfdb('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 045db62..2166d83 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 _0xd436=['BOOLEAN','sequelize','moment','exports','INTEGER','STRING','DATE','endtime','setDataValue','diff','seconds'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0xd436,0xdd));var _0x6d43=function(_0x42bda2,_0x4106ca){_0x42bda2=_0x42bda2-0x0;var _0x625d2d=_0xd436[_0x42bda2];return _0x625d2d;};'use strict';var Sequelize=require(_0x6d43('0x0'));var moment=require(_0x6d43('0x1'));module[_0x6d43('0x2')]={'state':{'type':Sequelize[_0x6d43('0x3')](0x2)},'statedesc':{'type':Sequelize[_0x6d43('0x4')]},'scheduledat':{'type':Sequelize[_0x6d43('0x5')]},'countbusyretry':{'type':Sequelize[_0x6d43('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x6d43('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x6d43('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x6d43('0x4')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x6d43('0x4')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x6d43('0x4')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x6d43('0x5')]},'answertime':{'type':Sequelize[_0x6d43('0x5')]},'droptime':{'type':Sequelize[_0x6d43('0x5')]},'endtime':{'type':Sequelize[_0x6d43('0x5')]},'ringtime':{'type':Sequelize[_0x6d43('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x6d43('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x6d43('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x6d43('0x4')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x6d43('0x4')]},'membername':{'type':Sequelize[_0x6d43('0x4')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x6d43('0x4')]},'secondDisposition':{'type':Sequelize[_0x6d43('0x4')]},'thirdDisposition':{'type':Sequelize[_0x6d43('0x4')]},'dispositionat':{'type':Sequelize[_0x6d43('0x5')],'set':function(_0x156917){var _0x369ad6=this['getDataValue'](_0x6d43('0x6'));if(_0x369ad6&&_0x156917){this[_0x6d43('0x7')]('followuptime',moment(_0x156917)[_0x6d43('0x8')](moment(_0x369ad6),_0x6d43('0x9')));}}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x6d43('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x6d43('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0x6d43('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x6d43('0x5')]},'deleted':{'type':Sequelize[_0x6d43('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x6d43('0x5')]},'recallme':{'type':Sequelize[_0x6d43('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0x6d43('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x6d43('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x6d43('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd25e=['sequelize','moment','INTEGER','STRING','DATE','getDataValue','setDataValue','followuptime','diff','seconds','BOOLEAN'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0xd25e,0x134));var _0xed25=function(_0x11f279,_0x294a63){_0x11f279=_0x11f279-0x0;var _0x41074d=_0xd25e[_0x11f279];return _0x41074d;};'use strict';var Sequelize=require(_0xed25('0x0'));var moment=require(_0xed25('0x1'));module['exports']={'state':{'type':Sequelize[_0xed25('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xed25('0x3')]},'scheduledat':{'type':Sequelize[_0xed25('0x4')]},'countbusyretry':{'type':Sequelize[_0xed25('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xed25('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xed25('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xed25('0x3')]},'originatecalleridnum':{'type':Sequelize[_0xed25('0x3')]},'originatecalleridname':{'type':Sequelize[_0xed25('0x3')]},'calleridnum':{'type':Sequelize[_0xed25('0x3')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xed25('0x4')]},'responsetime':{'type':Sequelize[_0xed25('0x4')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0xed25('0x4')]},'endtime':{'type':Sequelize[_0xed25('0x4')]},'ringtime':{'type':Sequelize[_0xed25('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xed25('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xed25('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xed25('0x3')]},'membername':{'type':Sequelize[_0xed25('0x3')]},'reason':{'type':Sequelize[_0xed25('0x3')]},'disposition':{'type':Sequelize[_0xed25('0x3')]},'secondDisposition':{'type':Sequelize[_0xed25('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize[_0xed25('0x4')],'set':function(_0x1e0822){var _0x2b142c=this[_0xed25('0x5')]('endtime');if(_0x2b142c&&_0x1e0822){this[_0xed25('0x6')](_0xed25('0x7'),moment(_0x1e0822)[_0xed25('0x8')](moment(_0x2b142c),_0xed25('0x9')));}}},'amd':{'type':Sequelize[_0xed25('0xa')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xed25('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xed25('0x4')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xed25('0x4')]},'deleted':{'type':Sequelize[_0xed25('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xed25('0x4')]},'recallme':{'type':Sequelize[_0xed25('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xed25('0x4')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xed25('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index 565414b..af982bc 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 _0x2675=['lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','destroy','then','error','name','send','index','map','CmHopperFinal','fieldName','type','key','query','keys','intersection','model','attributes','fields','hasOwnProperty','sort','where','filters','pick','merge','VIRTUAL','filter','includeAll','include','rows','catch','show','rawAttributes','length','options','find','describe','body','uniqueid','params','findAll','sequelize','COUNT','`state`\x20=\x200,\x201,\x20null','literal','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','noSuchContacts','busyContacts','abandonedContacts','moveContactsQueueCampaignHopperFinal','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','VoiceQueueId','createdAt','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ListId','ANY_VALUE(VoiceQueueId)','updatedAt','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','select','phone','from','calleridnum','cm_hopper_final','state\x20=\x204','moveContactsIvrCampaignHopperFinal','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','calleridnum\x20NOT\x20IN\x20(?)','group','eml-format','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra'];(function(_0x52e462,_0xb6b096){var _0x39a940=function(_0x30a508){while(--_0x30a508){_0x52e462['push'](_0x52e462['shift']());}};_0x39a940(++_0xb6b096);}(_0x2675,0x75));var _0x5267=function(_0x30218a,_0xf62ef9){_0x30218a=_0x30218a-0x0;var _0x313c0d=_0x2675[_0x30218a];return _0x313c0d;};'use strict';var emlformat=require(_0x5267('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5267('0x1'));var moment=require(_0x5267('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x5267('0x3'));var util=require(_0x5267('0x4'));var path=require('path');var sox=require(_0x5267('0x5'));var csv=require(_0x5267('0x6'));var ejs=require(_0x5267('0x7'));var fs=require('fs');var fs_extra=require(_0x5267('0x8'));var _=require(_0x5267('0x9'));var squel=require(_0x5267('0xa'));var crypto=require('crypto');var jsforce=require(_0x5267('0xb'));var deskjs=require(_0x5267('0xc'));var toCsv=require('to-csv');var querystring=require(_0x5267('0xd'));var Papa=require('papaparse');var Redis=require(_0x5267('0xe'));var authService=require(_0x5267('0xf'));var qs=require(_0x5267('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5267('0x11'));var logger=require('../../config/logger')(_0x5267('0x12'));var utils=require('../../config/utils');var config=require(_0x5267('0x13'));var licenseUtil=require(_0x5267('0x14'));var db=require(_0x5267('0x15'))['db'];function respondWithStatusCode(_0x1f9be3,_0x1d7090){_0x1d7090=_0x1d7090||0xcc;return function(_0x1171b9){if(_0x1171b9){return _0x1f9be3[_0x5267('0x16')](_0x1d7090);}return _0x1f9be3[_0x5267('0x17')](_0x1d7090)[_0x5267('0x18')]();};}function respondWithResult(_0x1e2d3b,_0x16e5a7){_0x16e5a7=_0x16e5a7||0xc8;return function(_0x29349a){if(_0x29349a){return _0x1e2d3b[_0x5267('0x17')](_0x16e5a7)['json'](_0x29349a);}};}function respondWithFilteredResult(_0x52e24e,_0xa593fb){return function(_0x40d897){if(_0x40d897){var _0x38a147=typeof _0xa593fb[_0x5267('0x19')]===_0x5267('0x1a')&&typeof _0xa593fb[_0x5267('0x1b')]===_0x5267('0x1a');var _0x6831e0=_0x40d897[_0x5267('0x1c')];var _0xb1c97a=_0x38a147?0x0:_0xa593fb[_0x5267('0x19')];var _0x1ab03=_0x38a147?_0x40d897['count']:_0xa593fb[_0x5267('0x19')]+_0xa593fb[_0x5267('0x1b')];var _0x5069e8;if(_0x1ab03>=_0x6831e0){_0x1ab03=_0x6831e0;_0x5069e8=0xc8;}else{_0x5069e8=0xce;}_0x52e24e[_0x5267('0x17')](_0x5069e8);return _0x52e24e['set'](_0x5267('0x1d'),_0xb1c97a+'-'+_0x1ab03+'/'+_0x6831e0)[_0x5267('0x1e')](_0x40d897);}return null;};}function patchUpdates(_0x39c0c3){return function(_0x2a9f99){try{jsonpatch[_0x5267('0x1f')](_0x2a9f99,_0x39c0c3,!![]);}catch(_0x4dd637){return BPromise[_0x5267('0x20')](_0x4dd637);}return _0x2a9f99['save']();};}function saveUpdates(_0xa32663,_0x420fb8){return function(_0x3b53ac){if(_0x3b53ac){return _0x3b53ac['update'](_0xa32663)['then'](function(_0x5546e2){return _0x5546e2;});}return null;};}function removeEntity(_0x4a17c7,_0x5ea6a6){return function(_0x26c7f8){if(_0x26c7f8){return _0x26c7f8[_0x5267('0x21')]()[_0x5267('0x22')](function(){_0x4a17c7[_0x5267('0x17')](0xcc)[_0x5267('0x18')]();});}};}function handleEntityNotFound(_0x40d1be,_0x126a97){return function(_0x220e03){if(!_0x220e03){_0x40d1be[_0x5267('0x16')](0x194);}return _0x220e03;};}function handleError(_0x59f112,_0x5cb64f){_0x5cb64f=_0x5cb64f||0x1f4;return function(_0x354111){logger[_0x5267('0x23')](_0x354111['stack']);if(_0x354111[_0x5267('0x24')]){delete _0x354111['name'];}_0x59f112['status'](_0x5cb64f)[_0x5267('0x25')](_0x354111);};}exports[_0x5267('0x26')]=function(_0x1f33b7,_0x2d2ace){var _0x33c431={},_0x4f3d4d={},_0x5e87eb={'count':0x0,'rows':[]};var _0x18020c=_[_0x5267('0x27')](db[_0x5267('0x28')]['rawAttributes'],function(_0x58d685){return{'name':_0x58d685[_0x5267('0x29')],'type':_0x58d685[_0x5267('0x2a')][_0x5267('0x2b')]};});_0x4f3d4d['model']=_['map'](_0x18020c,_0x5267('0x24'));_0x4f3d4d[_0x5267('0x2c')]=_[_0x5267('0x2d')](_0x1f33b7[_0x5267('0x2c')]);_0x4f3d4d['filters']=_[_0x5267('0x2e')](_0x4f3d4d[_0x5267('0x2f')],_0x4f3d4d[_0x5267('0x2c')]);_0x33c431[_0x5267('0x30')]=_[_0x5267('0x2e')](_0x4f3d4d[_0x5267('0x2f')],qs[_0x5267('0x31')](_0x1f33b7[_0x5267('0x2c')]['fields']));_0x33c431['attributes']=_0x33c431[_0x5267('0x30')]['length']?_0x33c431[_0x5267('0x30')]:_0x4f3d4d[_0x5267('0x2f')];if(!_0x1f33b7[_0x5267('0x2c')][_0x5267('0x32')]('nolimit')){_0x33c431[_0x5267('0x1b')]=qs[_0x5267('0x1b')](_0x1f33b7[_0x5267('0x2c')][_0x5267('0x1b')]);_0x33c431[_0x5267('0x19')]=qs[_0x5267('0x19')](_0x1f33b7[_0x5267('0x2c')][_0x5267('0x19')]);}_0x33c431['order']=qs[_0x5267('0x33')](_0x1f33b7['query'][_0x5267('0x33')]);_0x33c431[_0x5267('0x34')]=qs[_0x5267('0x35')](_[_0x5267('0x36')](_0x1f33b7[_0x5267('0x2c')],_0x4f3d4d[_0x5267('0x35')]),_0x18020c);if(_0x1f33b7[_0x5267('0x2c')]['filter']){_0x33c431[_0x5267('0x34')]=_[_0x5267('0x37')](_0x33c431[_0x5267('0x34')],{'$or':_[_0x5267('0x27')](_0x18020c,function(_0x82cea7){if(_0x82cea7[_0x5267('0x2a')]!==_0x5267('0x38')){var _0x487dfc={};_0x487dfc[_0x82cea7[_0x5267('0x24')]]={'$like':'%'+_0x1f33b7['query'][_0x5267('0x39')]+'%'};return _0x487dfc;}})});}_0x33c431=_['merge']({},_0x33c431,_0x1f33b7['options']);var _0x51bddd={'where':_0x33c431[_0x5267('0x34')]};return db['CmHopperFinal'][_0x5267('0x1c')](_0x51bddd)[_0x5267('0x22')](function(_0x3d4b19){_0x5e87eb[_0x5267('0x1c')]=_0x3d4b19;if(_0x1f33b7['query'][_0x5267('0x3a')]){_0x33c431[_0x5267('0x3b')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x33c431);})[_0x5267('0x22')](function(_0x560cdf){_0x5e87eb[_0x5267('0x3c')]=_0x560cdf;return _0x5e87eb;})[_0x5267('0x22')](respondWithFilteredResult(_0x2d2ace,_0x33c431))[_0x5267('0x3d')](handleError(_0x2d2ace,null));};exports[_0x5267('0x3e')]=function(_0x36d0f1,_0x3012cb){var _0x27add5={'raw':!![],'where':{'id':_0x36d0f1['params']['id']}},_0x5697b3={};_0x5697b3[_0x5267('0x2f')]=_['keys'](db[_0x5267('0x28')][_0x5267('0x3f')]);_0x5697b3['query']=_[_0x5267('0x2d')](_0x36d0f1[_0x5267('0x2c')]);_0x5697b3[_0x5267('0x35')]=_[_0x5267('0x2e')](_0x5697b3[_0x5267('0x2f')],_0x5697b3[_0x5267('0x2c')]);_0x27add5[_0x5267('0x30')]=_[_0x5267('0x2e')](_0x5697b3[_0x5267('0x2f')],qs['fields'](_0x36d0f1[_0x5267('0x2c')][_0x5267('0x31')]));_0x27add5[_0x5267('0x30')]=_0x27add5[_0x5267('0x30')][_0x5267('0x40')]?_0x27add5['attributes']:_0x5697b3[_0x5267('0x2f')];if(_0x36d0f1['query'][_0x5267('0x3a')]){_0x27add5['include']=[{'all':!![]}];}_0x27add5=_['merge']({},_0x27add5,_0x36d0f1[_0x5267('0x41')]);return db['CmHopperFinal'][_0x5267('0x42')](_0x27add5)[_0x5267('0x22')](handleEntityNotFound(_0x3012cb,null))[_0x5267('0x22')](respondWithResult(_0x3012cb,null))[_0x5267('0x3d')](handleError(_0x3012cb,null));};exports['describe']=function(_0x12d6a8,_0x4ee826){return db['CmHopperFinal'][_0x5267('0x43')]()[_0x5267('0x22')](respondWithResult(_0x4ee826,null))['catch'](handleError(_0x4ee826,null));};exports['update']=function(_0x383ebe,_0xe0439e){if(_0x383ebe[_0x5267('0x44')][_0x5267('0x45')]){delete _0x383ebe[_0x5267('0x44')][_0x5267('0x45')];}return db[_0x5267('0x28')][_0x5267('0x42')]({'where':{'uniqueid':_0x383ebe[_0x5267('0x46')]['id']}})[_0x5267('0x22')](handleEntityNotFound(_0xe0439e,null))[_0x5267('0x22')](saveUpdates(_0x383ebe[_0x5267('0x44')],null))[_0x5267('0x22')](respondWithResult(_0xe0439e,null))[_0x5267('0x3d')](handleError(_0xe0439e,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x8636d0,_0x466d46,_0x371486){return db['CmHopperFinal'][_0x5267('0x47')]({'raw':![],'where':{'VoiceQueueId':_0x8636d0[_0x5267('0x46')]['id']},'attributes':[[db[_0x5267('0x48')]['fn'](_0x5267('0x49'),db[_0x5267('0x48')]['fn']('IF',db[_0x5267('0x48')]['literal'](_0x5267('0x4a')))),'noSuchContacts'],[db[_0x5267('0x48')]['fn'](_0x5267('0x49'),db[_0x5267('0x48')]['fn']('IF',db[_0x5267('0x48')][_0x5267('0x4b')](_0x5267('0x4c')))),_0x5267('0x4d')],[db['sequelize']['fn']('COUNT',db[_0x5267('0x48')]['fn']('IF',db[_0x5267('0x48')]['literal'](_0x5267('0x4e')))),'busyContacts'],[db['sequelize']['fn'](_0x5267('0x49'),db[_0x5267('0x48')]['fn']('IF',db[_0x5267('0x48')][_0x5267('0x4b')](_0x5267('0x4f')))),_0x5267('0x50')],[db[_0x5267('0x48')]['fn'](_0x5267('0x49'),db[_0x5267('0x48')]['fn']('IF',db[_0x5267('0x48')]['literal'](_0x5267('0x51')))),_0x5267('0x52')],[db[_0x5267('0x48')]['fn'](_0x5267('0x49'),db[_0x5267('0x48')]['fn']('IF',db[_0x5267('0x48')]['literal'](_0x5267('0x53')))),'abandonedContacts'],[db[_0x5267('0x48')]['fn'](_0x5267('0x49'),db[_0x5267('0x48')]['fn']('IF',db['sequelize'][_0x5267('0x4b')](_0x5267('0x54')))),_0x5267('0x55')],[db[_0x5267('0x48')]['fn'](_0x5267('0x49'),db[_0x5267('0x48')]['fn']('IF',db['sequelize'][_0x5267('0x4b')](_0x5267('0x56')))),_0x5267('0x57')]]})[_0x5267('0x22')](handleEntityNotFound(_0x466d46,null))['then'](respondWithResult(_0x466d46,null))['catch'](handleError(_0x466d46,null));};exports[_0x5267('0x58')]=function(_0x5393e9,_0x3f5cda,_0x47059c){return db['CmHopperFinal']['findAll']({'raw':![],'where':{'CampaignId':_0x5393e9[_0x5267('0x46')]['id']},'attributes':[[db[_0x5267('0x48')]['fn'](_0x5267('0x49'),db['sequelize']['fn']('IF',db[_0x5267('0x48')][_0x5267('0x4b')](_0x5267('0x4a')))),_0x5267('0x59')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x5267('0x48')][_0x5267('0x4b')](_0x5267('0x4c')))),_0x5267('0x4d')],[db[_0x5267('0x48')]['fn'](_0x5267('0x49'),db[_0x5267('0x48')]['fn']('IF',db[_0x5267('0x48')]['literal'](_0x5267('0x4e')))),_0x5267('0x5a')],[db['sequelize']['fn'](_0x5267('0x49'),db[_0x5267('0x48')]['fn']('IF',db[_0x5267('0x48')][_0x5267('0x4b')](_0x5267('0x4f')))),_0x5267('0x50')],[db['sequelize']['fn'](_0x5267('0x49'),db[_0x5267('0x48')]['fn']('IF',db[_0x5267('0x48')][_0x5267('0x4b')](_0x5267('0x51')))),_0x5267('0x52')],[db['sequelize']['fn'](_0x5267('0x49'),db[_0x5267('0x48')]['fn']('IF',db[_0x5267('0x48')][_0x5267('0x4b')](_0x5267('0x53')))),_0x5267('0x5b')],[db['sequelize']['fn'](_0x5267('0x49'),db[_0x5267('0x48')]['fn']('IF',db[_0x5267('0x48')][_0x5267('0x4b')]('`state`\x20=\x2022,\x201,\x20null'))),'reCallContacts'],[db['sequelize']['fn'](_0x5267('0x49'),db['sequelize']['fn']('IF',db[_0x5267('0x48')]['literal'](_0x5267('0x56')))),_0x5267('0x57')]]})[_0x5267('0x22')](handleEntityNotFound(_0x3f5cda,null))[_0x5267('0x22')](respondWithResult(_0x3f5cda,null))[_0x5267('0x3d')](handleError(_0x3f5cda,null));};exports[_0x5267('0x5c')]=function(_0x21338f,_0x1103c5,_0x489b9a){return db['VoiceQueue']['find']({'where':{'id':_0x21338f[_0x5267('0x46')]['id']}})[_0x5267('0x22')](handleEntityNotFound(_0x1103c5,null))[_0x5267('0x22')](function(_0x457d84){var _0x4974d1;if(_0x457d84){_0x4974d1=squel[_0x5267('0x5d')]()[_0x5267('0x5e')](_0x5267('0x5f'))[_0x5267('0x60')](['phone',_0x5267('0x61'),_0x5267('0x62'),'ListId',_0x5267('0x63'),_0x5267('0x64'),'updatedAt'],squel['select']()[_0x5267('0x65')](_0x5267('0x66'),'phone')['field'](_0x5267('0x67'),_0x5267('0x61'))[_0x5267('0x65')](_0x5267('0x68'),_0x5267('0x62'))['field'](_0x5267('0x69'),_0x5267('0x6a'))['field'](_0x5267('0x6b'),_0x5267('0x63'))[_0x5267('0x65')](_0x5267('0x67'),_0x5267('0x64'))[_0x5267('0x65')](_0x5267('0x67'),_0x5267('0x6c'))['from']('cm_hopper_final')[_0x5267('0x34')](_0x5267('0x6d'),_0x21338f[_0x5267('0x46')]['id'][_0x5267('0x6e')]())['where'](_0x5267('0x6f'),_0x21338f['body'][_0x5267('0x70')][_0x5267('0x6e')]())[_0x5267('0x34')](_0x5267('0x71'))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x5267('0x72')]()[_0x5267('0x65')](_0x5267('0x73'))[_0x5267('0x74')](_0x5267('0x5f'))[_0x5267('0x34')]('VoiceQueueId\x20=\x20?',_0x21338f[_0x5267('0x46')]['id']['toString']()))[_0x5267('0x34')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x5267('0x72')]()[_0x5267('0x65')](_0x5267('0x75'))[_0x5267('0x74')](_0x5267('0x76'))[_0x5267('0x34')](_0x5267('0x6d'),_0x21338f[_0x5267('0x46')]['id'][_0x5267('0x6e')]())[_0x5267('0x34')](_0x5267('0x77')))['group'](_0x5267('0x62')))[_0x5267('0x6e')]();return db['sequelize'][_0x5267('0x2c')](_0x4974d1);}return[];})[_0x5267('0x22')](respondWithResult(_0x1103c5,null))[_0x5267('0x3d')](handleError(_0x1103c5,null));};exports[_0x5267('0x78')]=function(_0xd18795,_0x37b007,_0x358543){return db['Campaign'][_0x5267('0x42')]({'where':{'id':_0xd18795[_0x5267('0x46')]['id']}})[_0x5267('0x22')](handleEntityNotFound(_0x37b007,null))[_0x5267('0x22')](function(_0x1cdf9f){var _0x4dbaa2;if(_0x1cdf9f){_0x4dbaa2=squel['insert']()[_0x5267('0x5e')](_0x5267('0x5f'))[_0x5267('0x60')]([_0x5267('0x73'),'scheduledAt',_0x5267('0x62'),_0x5267('0x6a'),_0x5267('0x79'),_0x5267('0x64'),_0x5267('0x6c')],squel[_0x5267('0x72')]()[_0x5267('0x65')](_0x5267('0x66'),_0x5267('0x73'))[_0x5267('0x65')](_0x5267('0x67'),_0x5267('0x61'))[_0x5267('0x65')]('ANY_VALUE(ContactId)',_0x5267('0x62'))[_0x5267('0x65')](_0x5267('0x69'),_0x5267('0x6a'))[_0x5267('0x65')](_0x5267('0x7a'),_0x5267('0x79'))[_0x5267('0x65')](_0x5267('0x67'),_0x5267('0x64'))[_0x5267('0x65')](_0x5267('0x67'),_0x5267('0x6c'))[_0x5267('0x74')](_0x5267('0x76'))[_0x5267('0x34')](_0x5267('0x7b'),_0xd18795[_0x5267('0x46')]['id'][_0x5267('0x6e')]())[_0x5267('0x34')](_0x5267('0x6f'),_0xd18795[_0x5267('0x44')][_0x5267('0x70')]['toString']())[_0x5267('0x34')](_0x5267('0x71'))[_0x5267('0x34')](_0x5267('0x7c'),squel[_0x5267('0x72')]()['field'](_0x5267('0x73'))[_0x5267('0x74')]('cm_hopper')['where']('CampaignId\x20=\x20?',_0xd18795[_0x5267('0x46')]['id']['toString']()))[_0x5267('0x34')]('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()[_0x5267('0x65')](_0x5267('0x75'))[_0x5267('0x74')](_0x5267('0x76'))[_0x5267('0x34')]('CampaignId\x20=\x20?',_0xd18795['params']['id'][_0x5267('0x6e')]())[_0x5267('0x34')](_0x5267('0x77')))[_0x5267('0x7d')](_0x5267('0x62')))['toString']();return db[_0x5267('0x48')]['query'](_0x4dbaa2);}return[];})['then'](respondWithResult(_0x37b007,null))[_0x5267('0x3d')](handleError(_0x37b007,null));};exports['checkContactHopper']=function(_0x5da8d6,_0x3ebe63,_0x321322){return db['CmHopper']['findOne']({'where':{'VoiceQueueId':_0x5da8d6['body'][_0x5267('0x63')],'CampaignId':_0x5da8d6['body'][_0x5267('0x79')],'ContactId':_0x5da8d6['body'][_0x5267('0x62')]}})[_0x5267('0x22')](handleEntityNotFound(_0x3ebe63,null))['then'](function(_0x1ae9fe){if(_0x1ae9fe){return _0x1ae9fe;}return null;})[_0x5267('0x22')](respondWithResult(_0x3ebe63,null))[_0x5267('0x3d')](handleError(_0x3ebe63,null));}; \ No newline at end of file +var _0x4819=['send','map','CmHopperFinal','rawAttributes','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','count','includeAll','include','catch','show','keys','find','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','findAll','params','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','VoiceQueue','insert','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','from','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','cm_hopper_final','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','into','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','calleridnum\x20IS\x20NOT\x20NULL','CmHopper','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','offset','set','Content-Range','apply','reject','update','then','destroy','stack','name'];(function(_0x327f66,_0x188d77){var _0x31f70a=function(_0x125d9f){while(--_0x125d9f){_0x327f66['push'](_0x327f66['shift']());}};_0x31f70a(++_0x188d77);}(_0x4819,0xcd));var _0x9481=function(_0x4fc435,_0x45eddf){_0x4fc435=_0x4fc435-0x0;var _0x3c5db1=_0x4819[_0x4fc435];return _0x3c5db1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9481('0x0'));var zipdir=require(_0x9481('0x1'));var jsonpatch=require(_0x9481('0x2'));var rp=require(_0x9481('0x3'));var moment=require(_0x9481('0x4'));var BPromise=require(_0x9481('0x5'));var Mustache=require(_0x9481('0x6'));var util=require(_0x9481('0x7'));var path=require(_0x9481('0x8'));var sox=require(_0x9481('0x9'));var csv=require('to-csv');var ejs=require(_0x9481('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x9481('0xb'));var crypto=require(_0x9481('0xc'));var jsforce=require(_0x9481('0xd'));var deskjs=require(_0x9481('0xe'));var toCsv=require(_0x9481('0xf'));var querystring=require('querystring');var Papa=require(_0x9481('0x10'));var Redis=require('ioredis');var authService=require(_0x9481('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x9481('0x12'));var hardwareService=require(_0x9481('0x13'));var logger=require(_0x9481('0x14'))(_0x9481('0x15'));var utils=require(_0x9481('0x16'));var config=require(_0x9481('0x17'));var licenseUtil=require(_0x9481('0x18'));var db=require(_0x9481('0x19'))['db'];function respondWithStatusCode(_0xed8e9,_0x499b87){_0x499b87=_0x499b87||0xcc;return function(_0x5aac02){if(_0x5aac02){return _0xed8e9[_0x9481('0x1a')](_0x499b87);}return _0xed8e9[_0x9481('0x1b')](_0x499b87)[_0x9481('0x1c')]();};}function respondWithResult(_0x28fcb6,_0x3d23c2){_0x3d23c2=_0x3d23c2||0xc8;return function(_0xc7a0b5){if(_0xc7a0b5){return _0x28fcb6[_0x9481('0x1b')](_0x3d23c2)['json'](_0xc7a0b5);}};}function respondWithFilteredResult(_0x4220f1,_0x7a7ee){return function(_0x5b1fe6){if(_0x5b1fe6){var _0x2266d5=typeof _0x7a7ee['offset']===_0x9481('0x1d')&&typeof _0x7a7ee[_0x9481('0x1e')]===_0x9481('0x1d');var _0x2bb2a4=_0x5b1fe6['count'];var _0x5eda66=_0x2266d5?0x0:_0x7a7ee[_0x9481('0x1f')];var _0x50a559=_0x2266d5?_0x5b1fe6['count']:_0x7a7ee[_0x9481('0x1f')]+_0x7a7ee[_0x9481('0x1e')];var _0x18c6f5;if(_0x50a559>=_0x2bb2a4){_0x50a559=_0x2bb2a4;_0x18c6f5=0xc8;}else{_0x18c6f5=0xce;}_0x4220f1[_0x9481('0x1b')](_0x18c6f5);return _0x4220f1[_0x9481('0x20')](_0x9481('0x21'),_0x5eda66+'-'+_0x50a559+'/'+_0x2bb2a4)['json'](_0x5b1fe6);}return null;};}function patchUpdates(_0x2cf1aa){return function(_0x272a84){try{jsonpatch[_0x9481('0x22')](_0x272a84,_0x2cf1aa,!![]);}catch(_0x615e02){return BPromise[_0x9481('0x23')](_0x615e02);}return _0x272a84['save']();};}function saveUpdates(_0x215dd7,_0x294908){return function(_0x572599){if(_0x572599){return _0x572599[_0x9481('0x24')](_0x215dd7)[_0x9481('0x25')](function(_0x352b3a){return _0x352b3a;});}return null;};}function removeEntity(_0x1809d2,_0x2dc02e){return function(_0x49ecfa){if(_0x49ecfa){return _0x49ecfa[_0x9481('0x26')]()[_0x9481('0x25')](function(){_0x1809d2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x12b0c3,_0x299e28){return function(_0x550fce){if(!_0x550fce){_0x12b0c3[_0x9481('0x1a')](0x194);}return _0x550fce;};}function handleError(_0x20ff9a,_0xeff0a5){_0xeff0a5=_0xeff0a5||0x1f4;return function(_0x28ae1b){logger['error'](_0x28ae1b[_0x9481('0x27')]);if(_0x28ae1b[_0x9481('0x28')]){delete _0x28ae1b[_0x9481('0x28')];}_0x20ff9a['status'](_0xeff0a5)[_0x9481('0x29')](_0x28ae1b);};}exports['index']=function(_0x2e1eff,_0xe153ab){var _0x22ab26={},_0x13ef93={},_0x2e5e63={'count':0x0,'rows':[]};var _0x53560d=_[_0x9481('0x2a')](db[_0x9481('0x2b')][_0x9481('0x2c')],function(_0x4895a0){return{'name':_0x4895a0['fieldName'],'type':_0x4895a0[_0x9481('0x2d')][_0x9481('0x2e')]};});_0x13ef93[_0x9481('0x2f')]=_[_0x9481('0x2a')](_0x53560d,'name');_0x13ef93['query']=_['keys'](_0x2e1eff[_0x9481('0x30')]);_0x13ef93['filters']=_[_0x9481('0x31')](_0x13ef93['model'],_0x13ef93[_0x9481('0x30')]);_0x22ab26[_0x9481('0x32')]=_[_0x9481('0x31')](_0x13ef93[_0x9481('0x2f')],qs[_0x9481('0x33')](_0x2e1eff['query'][_0x9481('0x33')]));_0x22ab26[_0x9481('0x32')]=_0x22ab26[_0x9481('0x32')]['length']?_0x22ab26[_0x9481('0x32')]:_0x13ef93[_0x9481('0x2f')];if(!_0x2e1eff[_0x9481('0x30')][_0x9481('0x34')](_0x9481('0x35'))){_0x22ab26[_0x9481('0x1e')]=qs['limit'](_0x2e1eff[_0x9481('0x30')]['limit']);_0x22ab26[_0x9481('0x1f')]=qs[_0x9481('0x1f')](_0x2e1eff[_0x9481('0x30')][_0x9481('0x1f')]);}_0x22ab26[_0x9481('0x36')]=qs[_0x9481('0x37')](_0x2e1eff['query'][_0x9481('0x37')]);_0x22ab26[_0x9481('0x38')]=qs['filters'](_['pick'](_0x2e1eff[_0x9481('0x30')],_0x13ef93['filters']),_0x53560d);if(_0x2e1eff[_0x9481('0x30')][_0x9481('0x39')]){_0x22ab26[_0x9481('0x38')]=_[_0x9481('0x3a')](_0x22ab26['where'],{'$or':_[_0x9481('0x2a')](_0x53560d,function(_0x590d50){if(_0x590d50[_0x9481('0x2d')]!=='VIRTUAL'){var _0x2ce972={};_0x2ce972[_0x590d50['name']]={'$like':'%'+_0x2e1eff[_0x9481('0x30')][_0x9481('0x39')]+'%'};return _0x2ce972;}})});}_0x22ab26=_[_0x9481('0x3a')]({},_0x22ab26,_0x2e1eff[_0x9481('0x3b')]);var _0x97dc3e={'where':_0x22ab26[_0x9481('0x38')]};return db[_0x9481('0x2b')]['count'](_0x97dc3e)[_0x9481('0x25')](function(_0x3857e8){_0x2e5e63[_0x9481('0x3c')]=_0x3857e8;if(_0x2e1eff[_0x9481('0x30')][_0x9481('0x3d')]){_0x22ab26[_0x9481('0x3e')]=[{'all':!![]}];}return db[_0x9481('0x2b')]['findAll'](_0x22ab26);})[_0x9481('0x25')](function(_0x1872ff){_0x2e5e63['rows']=_0x1872ff;return _0x2e5e63;})[_0x9481('0x25')](respondWithFilteredResult(_0xe153ab,_0x22ab26))[_0x9481('0x3f')](handleError(_0xe153ab,null));};exports[_0x9481('0x40')]=function(_0x3eb9ee,_0x29a8e9){var _0x5a8ffd={'raw':!![],'where':{'id':_0x3eb9ee['params']['id']}},_0x304791={};_0x304791[_0x9481('0x2f')]=_[_0x9481('0x41')](db['CmHopperFinal']['rawAttributes']);_0x304791[_0x9481('0x30')]=_[_0x9481('0x41')](_0x3eb9ee[_0x9481('0x30')]);_0x304791['filters']=_[_0x9481('0x31')](_0x304791[_0x9481('0x2f')],_0x304791['query']);_0x5a8ffd['attributes']=_[_0x9481('0x31')](_0x304791['model'],qs[_0x9481('0x33')](_0x3eb9ee[_0x9481('0x30')][_0x9481('0x33')]));_0x5a8ffd[_0x9481('0x32')]=_0x5a8ffd[_0x9481('0x32')]['length']?_0x5a8ffd[_0x9481('0x32')]:_0x304791[_0x9481('0x2f')];if(_0x3eb9ee['query'][_0x9481('0x3d')]){_0x5a8ffd[_0x9481('0x3e')]=[{'all':!![]}];}_0x5a8ffd=_[_0x9481('0x3a')]({},_0x5a8ffd,_0x3eb9ee[_0x9481('0x3b')]);return db[_0x9481('0x2b')][_0x9481('0x42')](_0x5a8ffd)[_0x9481('0x25')](handleEntityNotFound(_0x29a8e9,null))[_0x9481('0x25')](respondWithResult(_0x29a8e9,null))[_0x9481('0x3f')](handleError(_0x29a8e9,null));};exports['describe']=function(_0xd36133,_0x5d3a06){return db['CmHopperFinal'][_0x9481('0x43')]()['then'](respondWithResult(_0x5d3a06,null))[_0x9481('0x3f')](handleError(_0x5d3a06,null));};exports[_0x9481('0x24')]=function(_0x47f8b2,_0x277e2a){if(_0x47f8b2[_0x9481('0x44')][_0x9481('0x45')]){delete _0x47f8b2[_0x9481('0x44')][_0x9481('0x45')];}return db[_0x9481('0x2b')]['find']({'where':{'uniqueid':_0x47f8b2['params']['id']}})[_0x9481('0x25')](handleEntityNotFound(_0x277e2a,null))[_0x9481('0x25')](saveUpdates(_0x47f8b2[_0x9481('0x44')],null))[_0x9481('0x25')](respondWithResult(_0x277e2a,null))[_0x9481('0x3f')](handleError(_0x277e2a,null));};exports[_0x9481('0x46')]=function(_0x1c070c,_0x3d2250,_0x580273){return db[_0x9481('0x2b')][_0x9481('0x47')]({'raw':![],'where':{'VoiceQueueId':_0x1c070c[_0x9481('0x48')]['id']},'attributes':[[db[_0x9481('0x49')]['fn'](_0x9481('0x4a'),db['sequelize']['fn']('IF',db['sequelize'][_0x9481('0x4b')](_0x9481('0x4c')))),_0x9481('0x4d')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize']['literal']('`state`\x20=\x203,\x201,\x20null'))),'noAnswerContacts'],[db[_0x9481('0x49')]['fn'](_0x9481('0x4a'),db['sequelize']['fn']('IF',db[_0x9481('0x49')]['literal'](_0x9481('0x4e')))),_0x9481('0x4f')],[db[_0x9481('0x49')]['fn'](_0x9481('0x4a'),db[_0x9481('0x49')]['fn']('IF',db[_0x9481('0x49')][_0x9481('0x4b')]('`state`\x20=\x208,\x201,\x20null'))),_0x9481('0x50')],[db[_0x9481('0x49')]['fn']('COUNT',db[_0x9481('0x49')]['fn']('IF',db[_0x9481('0x49')][_0x9481('0x4b')](_0x9481('0x51')))),_0x9481('0x52')],[db['sequelize']['fn'](_0x9481('0x4a'),db[_0x9481('0x49')]['fn']('IF',db[_0x9481('0x49')][_0x9481('0x4b')](_0x9481('0x53')))),_0x9481('0x54')],[db[_0x9481('0x49')]['fn'](_0x9481('0x4a'),db[_0x9481('0x49')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2022,\x201,\x20null'))),_0x9481('0x55')],[db[_0x9481('0x49')]['fn']('COUNT',db[_0x9481('0x49')]['fn']('IF',db[_0x9481('0x49')][_0x9481('0x4b')](_0x9481('0x56')))),_0x9481('0x57')]]})[_0x9481('0x25')](handleEntityNotFound(_0x3d2250,null))['then'](respondWithResult(_0x3d2250,null))['catch'](handleError(_0x3d2250,null));};exports[_0x9481('0x58')]=function(_0x3cbab5,_0xb58b67,_0xe008db){return db[_0x9481('0x2b')][_0x9481('0x47')]({'raw':![],'where':{'CampaignId':_0x3cbab5['params']['id']},'attributes':[[db['sequelize']['fn'](_0x9481('0x4a'),db['sequelize']['fn']('IF',db[_0x9481('0x49')]['literal'](_0x9481('0x4c')))),_0x9481('0x4d')],[db[_0x9481('0x49')]['fn']('COUNT',db[_0x9481('0x49')]['fn']('IF',db[_0x9481('0x49')]['literal']('`state`\x20=\x203,\x201,\x20null'))),'noAnswerContacts'],[db['sequelize']['fn'](_0x9481('0x4a'),db['sequelize']['fn']('IF',db[_0x9481('0x49')][_0x9481('0x4b')](_0x9481('0x4e')))),'busyContacts'],[db[_0x9481('0x49')]['fn']('COUNT',db[_0x9481('0x49')]['fn']('IF',db[_0x9481('0x49')][_0x9481('0x4b')]('`state`\x20=\x208,\x201,\x20null'))),_0x9481('0x50')],[db[_0x9481('0x49')]['fn']('COUNT',db[_0x9481('0x49')]['fn']('IF',db[_0x9481('0x49')][_0x9481('0x4b')](_0x9481('0x51')))),_0x9481('0x52')],[db[_0x9481('0x49')]['fn'](_0x9481('0x4a'),db[_0x9481('0x49')]['fn']('IF',db[_0x9481('0x49')][_0x9481('0x4b')](_0x9481('0x53')))),_0x9481('0x54')],[db[_0x9481('0x49')]['fn'](_0x9481('0x4a'),db[_0x9481('0x49')]['fn']('IF',db[_0x9481('0x49')][_0x9481('0x4b')]('`state`\x20=\x2022,\x201,\x20null'))),_0x9481('0x55')],[db['sequelize']['fn']('COUNT',db[_0x9481('0x49')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2019,\x201,\x20null'))),_0x9481('0x57')]]})[_0x9481('0x25')](handleEntityNotFound(_0xb58b67,null))[_0x9481('0x25')](respondWithResult(_0xb58b67,null))[_0x9481('0x3f')](handleError(_0xb58b67,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0xa83176,_0x265f1c,_0x2a053a){return db[_0x9481('0x59')]['find']({'where':{'id':_0xa83176['params']['id']}})[_0x9481('0x25')](handleEntityNotFound(_0x265f1c,null))[_0x9481('0x25')](function(_0x193992){var _0x380f2a;if(_0x193992){_0x380f2a=squel[_0x9481('0x5a')]()['into'](_0x9481('0x5b'))[_0x9481('0x5c')]([_0x9481('0x5d'),_0x9481('0x5e'),_0x9481('0x5f'),_0x9481('0x60'),_0x9481('0x61'),_0x9481('0x62'),_0x9481('0x63')],squel[_0x9481('0x64')]()[_0x9481('0x65')](_0x9481('0x66'),_0x9481('0x5d'))[_0x9481('0x65')](_0x9481('0x67'),'scheduledAt')[_0x9481('0x65')](_0x9481('0x68'),_0x9481('0x5f'))[_0x9481('0x65')](_0x9481('0x69'),_0x9481('0x60'))[_0x9481('0x65')]('ANY_VALUE(VoiceQueueId)',_0x9481('0x61'))[_0x9481('0x65')]('NOW()','createdAt')[_0x9481('0x65')]('NOW()','updatedAt')[_0x9481('0x6a')]('cm_hopper_final')[_0x9481('0x38')](_0x9481('0x6b'),_0xa83176[_0x9481('0x48')]['id'][_0x9481('0x6c')]())['where'](_0x9481('0x6d'),_0xa83176['body'][_0x9481('0x6e')][_0x9481('0x6c')]())[_0x9481('0x38')]('calleridnum\x20IS\x20NOT\x20NULL')['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x9481('0x64')]()['field']('phone')[_0x9481('0x6a')](_0x9481('0x5b'))[_0x9481('0x38')]('VoiceQueueId\x20=\x20?',_0xa83176[_0x9481('0x48')]['id'][_0x9481('0x6c')]()))['where'](_0x9481('0x6f'),squel[_0x9481('0x64')]()[_0x9481('0x65')](_0x9481('0x70'))['from'](_0x9481('0x71'))['where'](_0x9481('0x6b'),_0xa83176[_0x9481('0x48')]['id']['toString']())[_0x9481('0x38')](_0x9481('0x72')))[_0x9481('0x73')]('ContactId'))['toString']();return db[_0x9481('0x49')]['query'](_0x380f2a);}return[];})[_0x9481('0x25')](respondWithResult(_0x265f1c,null))[_0x9481('0x3f')](handleError(_0x265f1c,null));};exports[_0x9481('0x74')]=function(_0x55b428,_0x3f74f1,_0x287d06){return db[_0x9481('0x75')]['find']({'where':{'id':_0x55b428[_0x9481('0x48')]['id']}})[_0x9481('0x25')](handleEntityNotFound(_0x3f74f1,null))[_0x9481('0x25')](function(_0x32b30f){var _0x347da1;if(_0x32b30f){_0x347da1=squel[_0x9481('0x5a')]()[_0x9481('0x76')](_0x9481('0x5b'))[_0x9481('0x5c')]([_0x9481('0x5d'),'scheduledAt',_0x9481('0x5f'),'ListId','CampaignId','createdAt',_0x9481('0x63')],squel[_0x9481('0x64')]()[_0x9481('0x65')](_0x9481('0x66'),_0x9481('0x5d'))['field'](_0x9481('0x67'),_0x9481('0x5e'))[_0x9481('0x65')](_0x9481('0x68'),_0x9481('0x5f'))[_0x9481('0x65')](_0x9481('0x69'),_0x9481('0x60'))[_0x9481('0x65')](_0x9481('0x77'),'CampaignId')[_0x9481('0x65')](_0x9481('0x67'),_0x9481('0x62'))[_0x9481('0x65')](_0x9481('0x67'),_0x9481('0x63'))[_0x9481('0x6a')](_0x9481('0x71'))[_0x9481('0x38')](_0x9481('0x78'),_0x55b428['params']['id'][_0x9481('0x6c')]())[_0x9481('0x38')](_0x9481('0x6d'),_0x55b428[_0x9481('0x44')][_0x9481('0x6e')][_0x9481('0x6c')]())[_0x9481('0x38')](_0x9481('0x79'))[_0x9481('0x38')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x9481('0x64')]()['field']('phone')[_0x9481('0x6a')](_0x9481('0x5b'))[_0x9481('0x38')](_0x9481('0x78'),_0x55b428[_0x9481('0x48')]['id'][_0x9481('0x6c')]()))['where'](_0x9481('0x6f'),squel['select']()[_0x9481('0x65')](_0x9481('0x70'))[_0x9481('0x6a')]('cm_hopper_final')['where'](_0x9481('0x78'),_0x55b428[_0x9481('0x48')]['id'][_0x9481('0x6c')]())[_0x9481('0x38')](_0x9481('0x72')))[_0x9481('0x73')](_0x9481('0x5f')))[_0x9481('0x6c')]();return db[_0x9481('0x49')]['query'](_0x347da1);}return[];})[_0x9481('0x25')](respondWithResult(_0x3f74f1,null))[_0x9481('0x3f')](handleError(_0x3f74f1,null));};exports['checkContactHopper']=function(_0x2c53df,_0x534979,_0x616b77){return db[_0x9481('0x7a')]['findOne']({'where':{'VoiceQueueId':_0x2c53df[_0x9481('0x44')][_0x9481('0x61')],'CampaignId':_0x2c53df[_0x9481('0x44')]['CampaignId'],'ContactId':_0x2c53df[_0x9481('0x44')][_0x9481('0x5f')]}})['then'](handleEntityNotFound(_0x534979,null))[_0x9481('0x25')](function(_0x5c7602){if(_0x5c7602){return _0x5c7602;}return null;})[_0x9481('0x25')](respondWithResult(_0x534979,null))[_0x9481('0x3f')](handleError(_0x534979,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 18f880f..c42ebf8 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 _0x7f6b=['uniqueid','lodash','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperFinal.attributes','define','CmHopperFinal','cm_hopper_final','calleridnum'];(function(_0x481a61,_0x23ea81){var _0x4702c0=function(_0x956156){while(--_0x956156){_0x481a61['push'](_0x481a61['shift']());}};_0x4702c0(++_0x23ea81);}(_0x7f6b,0x194));var _0xb7f6=function(_0x1c9c3e,_0x1b386d){_0x1c9c3e=_0x1c9c3e-0x0;var _0x5cc545=_0x7f6b[_0x1c9c3e];return _0x5cc545;};'use strict';var _=require(_0xb7f6('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xb7f6('0x1'));var BPromise=require(_0xb7f6('0x2'));var rp=require(_0xb7f6('0x3'));var fs=require('fs');var path=require(_0xb7f6('0x4'));var rimraf=require(_0xb7f6('0x5'));var config=require(_0xb7f6('0x6'));var attributes=require(_0xb7f6('0x7'));module['exports']=function(_0x1d6bcb,_0x4db457){return _0x1d6bcb[_0xb7f6('0x8')](_0xb7f6('0x9'),attributes,{'tableName':_0xb7f6('0xa'),'paranoid':![],'indexes':[{'name':_0xb7f6('0xb'),'fields':[_0xb7f6('0xb')]},{'name':'uniqueid','fields':[_0xb7f6('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2c57=['moment','bluebird','request-promise','path','../../config/environment','exports','CmHopperFinal','calleridnum','uniqueid','lodash','util','api'];(function(_0x424db6,_0x2d0b62){var _0x44ab48=function(_0x4c071c){while(--_0x4c071c){_0x424db6['push'](_0x424db6['shift']());}};_0x44ab48(++_0x2d0b62);}(_0x2c57,0x105));var _0x72c5=function(_0x106e66,_0x5498ae){_0x106e66=_0x106e66-0x0;var _0x271628=_0x2c57[_0x106e66];return _0x271628;};'use strict';var _=require(_0x72c5('0x0'));var util=require(_0x72c5('0x1'));var logger=require('../../config/logger')(_0x72c5('0x2'));var moment=require(_0x72c5('0x3'));var BPromise=require(_0x72c5('0x4'));var rp=require(_0x72c5('0x5'));var fs=require('fs');var path=require(_0x72c5('0x6'));var rimraf=require('rimraf');var config=require(_0x72c5('0x7'));var attributes=require('./cmHopperFinal.attributes');module[_0x72c5('0x8')]=function(_0x3eb559,_0x51223b){return _0x3eb559['define'](_0x72c5('0x9'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0x72c5('0xa'),'fields':[_0x72c5('0xa')]},{'name':_0x72c5('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index ec6f553..e196bf8 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x131a8c,_0x43a2ee){var _0x5a7032=function(_0x1d5a93){while(--_0x1d5a93){_0x131a8c['push'](_0x131a8c['shift']());}};_0x5a7032(++_0x43a2ee);}(_0xb10b,0x12a));var _0xbb10=function(_0x1ff92d,_0x3bfdeb){_0x1ff92d=_0x1ff92d-0x0;var _0x129a98=_0xb10b[_0x1ff92d];return _0x129a98;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x1dd32f,_0x205bbc){var _0x574da3=function(_0x523467){while(--_0x523467){_0x1dd32f['push'](_0x1dd32f['shift']());}};_0x574da3(++_0x205bbc);}(_0xb10b,0x12a));var _0xbb10=function(_0x2a2e72,_0x1de962){_0x2a2e72=_0x2a2e72-0x0;var _0x3cfb4a=_0xb10b[_0x2a2e72];return _0x3cfb4a;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index c37c277..83a2cac 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 _0x66b8=['describe','/:id','show','/voice/queue/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','/checkContactHopper','checkContactHopper','put','update','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','get'];(function(_0x5c88c8,_0x2c04cf){var _0x7b15d5=function(_0x3435dd){while(--_0x3435dd){_0x5c88c8['push'](_0x5c88c8['shift']());}};_0x7b15d5(++_0x2c04cf);}(_0x66b8,0x8b));var _0x866b=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x66b8[_0x413feb];return _0x40ee88;};'use strict';var multer=require(_0x866b('0x0'));var util=require('util');var path=require(_0x866b('0x1'));var timeout=require(_0x866b('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x866b('0x3'));var auth=require(_0x866b('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x866b('0x5'));var controller=require('./cmHopperFinal.controller');router['get']('/',auth[_0x866b('0x6')](),controller['index']);router[_0x866b('0x7')]('/describe',auth[_0x866b('0x6')](),controller[_0x866b('0x8')]);router[_0x866b('0x7')](_0x866b('0x9'),auth[_0x866b('0x6')](),controller[_0x866b('0xa')]);router[_0x866b('0x7')](_0x866b('0xb'),auth[_0x866b('0x6')](),controller['countContactsQueueCampaignHopperFinal']);router[_0x866b('0x7')]('/campaign/countAttributes/:id',auth[_0x866b('0x6')](),controller[_0x866b('0xc')]);router[_0x866b('0xd')](_0x866b('0xe'),auth[_0x866b('0x6')](),controller[_0x866b('0xf')]);router[_0x866b('0xd')](_0x866b('0x10'),auth['isAuthenticated'](),controller['moveContactsIvrCampaignHopperFinal']);router['post'](_0x866b('0x11'),auth[_0x866b('0x6')](),controller[_0x866b('0x12')]);router[_0x866b('0x13')](_0x866b('0x9'),auth[_0x866b('0x6')](),controller[_0x866b('0x14')]);module['exports']=router; \ No newline at end of file +var _0x41e0=['/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','post','/voice/queue/moveContacts/:id','/voice/campaign/moveContacts/:id','/checkContactHopper','checkContactHopper','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','/:id','show'];(function(_0x5c5159,_0xc27f73){var _0x248bd0=function(_0x250632){while(--_0x250632){_0x5c5159['push'](_0x5c5159['shift']());}};_0x248bd0(++_0xc27f73);}(_0x41e0,0x18f));var _0x041e=function(_0x4c9393,_0x20e6de){_0x4c9393=_0x4c9393-0x0;var _0x580eda=_0x41e0[_0x4c9393];return _0x580eda;};'use strict';var multer=require(_0x041e('0x0'));var util=require(_0x041e('0x1'));var path=require(_0x041e('0x2'));var timeout=require(_0x041e('0x3'));var express=require(_0x041e('0x4'));var router=express[_0x041e('0x5')]();var fs_extra=require(_0x041e('0x6'));var auth=require(_0x041e('0x7'));var interaction=require(_0x041e('0x8'));var config=require(_0x041e('0x9'));var controller=require(_0x041e('0xa'));router[_0x041e('0xb')]('/',auth[_0x041e('0xc')](),controller[_0x041e('0xd')]);router[_0x041e('0xb')](_0x041e('0xe'),auth[_0x041e('0xc')](),controller['describe']);router[_0x041e('0xb')](_0x041e('0xf'),auth[_0x041e('0xc')](),controller[_0x041e('0x10')]);router['get'](_0x041e('0x11'),auth[_0x041e('0xc')](),controller[_0x041e('0x12')]);router[_0x041e('0xb')]('/campaign/countAttributes/:id',auth[_0x041e('0xc')](),controller['countContactsIvrCampaignHopperFinal']);router[_0x041e('0x13')](_0x041e('0x14'),auth[_0x041e('0xc')](),controller['moveContactsQueueCampaignHopperFinal']);router[_0x041e('0x13')](_0x041e('0x15'),auth[_0x041e('0xc')](),controller['moveContactsIvrCampaignHopperFinal']);router[_0x041e('0x13')](_0x041e('0x16'),auth[_0x041e('0xc')](),controller[_0x041e('0x17')]);router['put'](_0x041e('0xf'),auth[_0x041e('0xc')](),controller[_0x041e('0x18')]);module[_0x041e('0x19')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 04f7e24..7b0f127 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 _0xea78=['sequelize','exports','INTEGER','STRING','DATE','BOOLEAN'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xea78,0x162));var _0x8ea7=function(_0x4c9380,_0x2fefc0){_0x4c9380=_0x4c9380-0x0;var _0x49a523=_0xea78[_0x4c9380];return _0x49a523;};'use strict';var Sequelize=require(_0x8ea7('0x0'));module[_0x8ea7('0x1')]={'state':{'type':Sequelize[_0x8ea7('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x8ea7('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x8ea7('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x8ea7('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x8ea7('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x8ea7('0x3')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x8ea7('0x3')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x8ea7('0x4')]},'responsetime':{'type':Sequelize[_0x8ea7('0x4')]},'answertime':{'type':Sequelize[_0x8ea7('0x4')]},'droptime':{'type':Sequelize[_0x8ea7('0x4')]},'endtime':{'type':Sequelize[_0x8ea7('0x4')]},'ringtime':{'type':Sequelize[_0x8ea7('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x8ea7('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x8ea7('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x8ea7('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x8ea7('0x3')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x8ea7('0x3')]},'amd':{'type':Sequelize[_0x8ea7('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x8ea7('0x5')],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x8ea7('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x8ea7('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x8ea7('0x4')]},'edited':{'type':Sequelize[_0x8ea7('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x8ea7('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x8ea7('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x8ea7('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x8ea7('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x94aa=['BOOLEAN','sequelize','DATE','INTEGER','STRING'];(function(_0x57975f,_0x388556){var _0x4793b8=function(_0x652c05){while(--_0x652c05){_0x57975f['push'](_0x57975f['shift']());}};_0x4793b8(++_0x388556);}(_0x94aa,0x65));var _0xa94a=function(_0x30ba75,_0x47b525){_0x30ba75=_0x30ba75-0x0;var _0x5c7400=_0x94aa[_0x30ba75];return _0x5c7400;};'use strict';var Sequelize=require(_0xa94a('0x0'));module['exports']={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0xa94a('0x1')]},'countbusyretry':{'type':Sequelize[_0xa94a('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xa94a('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xa94a('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xa94a('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0xa94a('0x3')]},'originatecalleridname':{'type':Sequelize[_0xa94a('0x3')]},'calleridnum':{'type':Sequelize[_0xa94a('0x3')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xa94a('0x1')]},'ringtime':{'type':Sequelize[_0xa94a('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xa94a('0x3')]},'campaign':{'type':Sequelize[_0xa94a('0x3')]},'campaigntype':{'type':Sequelize[_0xa94a('0x3')]},'membername':{'type':Sequelize[_0xa94a('0x3')]},'reason':{'type':Sequelize[_0xa94a('0x3')]},'amd':{'type':Sequelize[_0xa94a('0x4')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0xa94a('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xa94a('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xa94a('0x1')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0xa94a('0x1')]},'edited':{'type':Sequelize[_0xa94a('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xa94a('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xa94a('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xa94a('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xa94a('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xa94a('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 5131396..794499d 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 _0x2606=['count','limit','set','Content-Range','json','reject','save','update','then','destroy','error','name','send','map','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','CmHopperHistory','findAll','rows','catch','show','includeAll','find','create','body','uniqueid','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','end','offset','undefined'];(function(_0x13f91a,_0x487ec0){var _0x2fb345=function(_0x32faf1){while(--_0x32faf1){_0x13f91a['push'](_0x13f91a['shift']());}};_0x2fb345(++_0x487ec0);}(_0x2606,0x19a));var _0x6260=function(_0x4dc35f,_0x377c51){_0x4dc35f=_0x4dc35f-0x0;var _0x1f8820=_0x2606[_0x4dc35f];return _0x1f8820;};'use strict';var emlformat=require(_0x6260('0x0'));var rimraf=require(_0x6260('0x1'));var zipdir=require(_0x6260('0x2'));var jsonpatch=require(_0x6260('0x3'));var rp=require(_0x6260('0x4'));var moment=require(_0x6260('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x6260('0x6'));var util=require(_0x6260('0x7'));var path=require(_0x6260('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6260('0x9'));var _=require(_0x6260('0xa'));var squel=require(_0x6260('0xb'));var crypto=require('crypto');var jsforce=require(_0x6260('0xc'));var deskjs=require(_0x6260('0xd'));var toCsv=require(_0x6260('0xe'));var querystring=require(_0x6260('0xf'));var Papa=require(_0x6260('0x10'));var Redis=require('ioredis');var authService=require(_0x6260('0x11'));var qs=require(_0x6260('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6260('0x13'));var logger=require(_0x6260('0x14'))(_0x6260('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6260('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x295c62,_0x526463){_0x526463=_0x526463||0xcc;return function(_0x3d9ebf){if(_0x3d9ebf){return _0x295c62[_0x6260('0x17')](_0x526463);}return _0x295c62[_0x6260('0x18')](_0x526463)[_0x6260('0x19')]();};}function respondWithResult(_0x2dd750,_0x7805a2){_0x7805a2=_0x7805a2||0xc8;return function(_0x2c60cd){if(_0x2c60cd){return _0x2dd750['status'](_0x7805a2)['json'](_0x2c60cd);}};}function respondWithFilteredResult(_0x17bc21,_0x4d4226){return function(_0x10398e){if(_0x10398e){var _0x1c3bd0=typeof _0x4d4226[_0x6260('0x1a')]===_0x6260('0x1b')&&typeof _0x4d4226['limit']===_0x6260('0x1b');var _0x448a19=_0x10398e[_0x6260('0x1c')];var _0x3eff9a=_0x1c3bd0?0x0:_0x4d4226[_0x6260('0x1a')];var _0x17dd5d=_0x1c3bd0?_0x10398e[_0x6260('0x1c')]:_0x4d4226['offset']+_0x4d4226[_0x6260('0x1d')];var _0x306b7d;if(_0x17dd5d>=_0x448a19){_0x17dd5d=_0x448a19;_0x306b7d=0xc8;}else{_0x306b7d=0xce;}_0x17bc21[_0x6260('0x18')](_0x306b7d);return _0x17bc21[_0x6260('0x1e')](_0x6260('0x1f'),_0x3eff9a+'-'+_0x17dd5d+'/'+_0x448a19)[_0x6260('0x20')](_0x10398e);}return null;};}function patchUpdates(_0x204f56){return function(_0x24054d){try{jsonpatch['apply'](_0x24054d,_0x204f56,!![]);}catch(_0xda08d5){return BPromise[_0x6260('0x21')](_0xda08d5);}return _0x24054d[_0x6260('0x22')]();};}function saveUpdates(_0x5a56e5,_0x5b3ff1){return function(_0x150d9a){if(_0x150d9a){return _0x150d9a[_0x6260('0x23')](_0x5a56e5)[_0x6260('0x24')](function(_0x15de87){return _0x15de87;});}return null;};}function removeEntity(_0x3d320b,_0x368157){return function(_0x545279){if(_0x545279){return _0x545279[_0x6260('0x25')]()[_0x6260('0x24')](function(){_0x3d320b[_0x6260('0x18')](0xcc)[_0x6260('0x19')]();});}};}function handleEntityNotFound(_0x178302,_0x3c9634){return function(_0x204e40){if(!_0x204e40){_0x178302[_0x6260('0x17')](0x194);}return _0x204e40;};}function handleError(_0x25d48a,_0x313f5a){_0x313f5a=_0x313f5a||0x1f4;return function(_0xdb3a7a){logger[_0x6260('0x26')](_0xdb3a7a['stack']);if(_0xdb3a7a[_0x6260('0x27')]){delete _0xdb3a7a[_0x6260('0x27')];}_0x25d48a[_0x6260('0x18')](_0x313f5a)[_0x6260('0x28')](_0xdb3a7a);};}exports['index']=function(_0x1f8ed2,_0x10e626){var _0x40b67f={},_0xde42ce={},_0x366314={'count':0x0,'rows':[]};var _0xaf2649=_[_0x6260('0x29')](db['CmHopperHistory'][_0x6260('0x2a')],function(_0x20393a){return{'name':_0x20393a['fieldName'],'type':_0x20393a[_0x6260('0x2b')][_0x6260('0x2c')]};});_0xde42ce[_0x6260('0x2d')]=_[_0x6260('0x29')](_0xaf2649,_0x6260('0x27'));_0xde42ce[_0x6260('0x2e')]=_[_0x6260('0x2f')](_0x1f8ed2[_0x6260('0x2e')]);_0xde42ce['filters']=_[_0x6260('0x30')](_0xde42ce[_0x6260('0x2d')],_0xde42ce[_0x6260('0x2e')]);_0x40b67f[_0x6260('0x31')]=_[_0x6260('0x30')](_0xde42ce[_0x6260('0x2d')],qs[_0x6260('0x32')](_0x1f8ed2[_0x6260('0x2e')][_0x6260('0x32')]));_0x40b67f[_0x6260('0x31')]=_0x40b67f[_0x6260('0x31')][_0x6260('0x33')]?_0x40b67f[_0x6260('0x31')]:_0xde42ce[_0x6260('0x2d')];if(!_0x1f8ed2[_0x6260('0x2e')][_0x6260('0x34')](_0x6260('0x35'))){_0x40b67f['limit']=qs[_0x6260('0x1d')](_0x1f8ed2[_0x6260('0x2e')][_0x6260('0x1d')]);_0x40b67f[_0x6260('0x1a')]=qs['offset'](_0x1f8ed2[_0x6260('0x2e')][_0x6260('0x1a')]);}_0x40b67f[_0x6260('0x36')]=qs[_0x6260('0x37')](_0x1f8ed2['query']['sort']);_0x40b67f['where']=qs[_0x6260('0x38')](_[_0x6260('0x39')](_0x1f8ed2[_0x6260('0x2e')],_0xde42ce[_0x6260('0x38')]),_0xaf2649);if(_0x1f8ed2['query'][_0x6260('0x3a')]){_0x40b67f[_0x6260('0x3b')]=_[_0x6260('0x3c')](_0x40b67f['where'],{'$or':_[_0x6260('0x29')](_0xaf2649,function(_0x403de5){if(_0x403de5[_0x6260('0x2b')]!==_0x6260('0x3d')){var _0xbfdfd0={};_0xbfdfd0[_0x403de5['name']]={'$like':'%'+_0x1f8ed2['query'][_0x6260('0x3a')]+'%'};return _0xbfdfd0;}})});}_0x40b67f=_[_0x6260('0x3c')]({},_0x40b67f,_0x1f8ed2['options']);var _0x5f520f={'where':_0x40b67f[_0x6260('0x3b')]};return db['CmHopperHistory'][_0x6260('0x1c')](_0x5f520f)[_0x6260('0x24')](function(_0x2e73a2){_0x366314['count']=_0x2e73a2;if(_0x1f8ed2['query']['includeAll']){_0x40b67f['include']=[{'all':!![]}];}return db[_0x6260('0x3e')][_0x6260('0x3f')](_0x40b67f);})['then'](function(_0x1f1a29){_0x366314[_0x6260('0x40')]=_0x1f1a29;return _0x366314;})[_0x6260('0x24')](respondWithFilteredResult(_0x10e626,_0x40b67f))[_0x6260('0x41')](handleError(_0x10e626,null));};exports[_0x6260('0x42')]=function(_0x50f2e7,_0x2011c4){var _0x1a17a8={'raw':!![],'where':{'id':_0x50f2e7['params']['id']}},_0x2490b9={};_0x2490b9[_0x6260('0x2d')]=_[_0x6260('0x2f')](db[_0x6260('0x3e')]['rawAttributes']);_0x2490b9[_0x6260('0x2e')]=_[_0x6260('0x2f')](_0x50f2e7[_0x6260('0x2e')]);_0x2490b9[_0x6260('0x38')]=_[_0x6260('0x30')](_0x2490b9[_0x6260('0x2d')],_0x2490b9[_0x6260('0x2e')]);_0x1a17a8[_0x6260('0x31')]=_[_0x6260('0x30')](_0x2490b9[_0x6260('0x2d')],qs['fields'](_0x50f2e7['query']['fields']));_0x1a17a8['attributes']=_0x1a17a8[_0x6260('0x31')][_0x6260('0x33')]?_0x1a17a8[_0x6260('0x31')]:_0x2490b9[_0x6260('0x2d')];if(_0x50f2e7['query'][_0x6260('0x43')]){_0x1a17a8['include']=[{'all':!![]}];}_0x1a17a8=_[_0x6260('0x3c')]({},_0x1a17a8,_0x50f2e7['options']);return db['CmHopperHistory'][_0x6260('0x44')](_0x1a17a8)[_0x6260('0x24')](handleEntityNotFound(_0x2011c4,null))[_0x6260('0x24')](respondWithResult(_0x2011c4,null))[_0x6260('0x41')](handleError(_0x2011c4,null));};exports[_0x6260('0x45')]=function(_0x2b1d3b,_0x2cf2ef){return db[_0x6260('0x3e')][_0x6260('0x45')](_0x2b1d3b[_0x6260('0x46')],{})[_0x6260('0x24')](respondWithResult(_0x2cf2ef,0xc9))['catch'](handleError(_0x2cf2ef,null));};exports['describe']=function(_0x5f1249,_0x27af26){return db[_0x6260('0x3e')]['describe']()['then'](respondWithResult(_0x27af26,null))[_0x6260('0x41')](handleError(_0x27af26,null));};exports[_0x6260('0x23')]=function(_0x33c854,_0x43a882){if(_0x33c854[_0x6260('0x46')][_0x6260('0x47')]){delete _0x33c854['body'][_0x6260('0x47')];}return db[_0x6260('0x3e')][_0x6260('0x44')]({'where':{'uniqueid':_0x33c854[_0x6260('0x48')]['id']}})[_0x6260('0x24')](handleEntityNotFound(_0x43a882,null))[_0x6260('0x24')](saveUpdates(_0x33c854['body'],null))[_0x6260('0x24')](respondWithResult(_0x43a882,null))[_0x6260('0x41')](handleError(_0x43a882,null));}; \ No newline at end of file +var _0x7ecf=['error','stack','name','send','index','map','CmHopperHistory','rawAttributes','type','model','query','keys','attributes','intersection','fields','length','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','show','params','filters','includeAll','find','create','body','catch','describe','uniqueid','eml-format','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','apply','save','update','then','destroy'];(function(_0x16b05c,_0x355b3a){var _0x4d166a=function(_0x595027){while(--_0x595027){_0x16b05c['push'](_0x16b05c['shift']());}};_0x4d166a(++_0x355b3a);}(_0x7ecf,0x1d9));var _0xf7ec=function(_0x22fa5f,_0x4ac64f){_0x22fa5f=_0x22fa5f-0x0;var _0x3b1e94=_0x7ecf[_0x22fa5f];return _0x3b1e94;};'use strict';var emlformat=require(_0xf7ec('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf7ec('0x1'));var rp=require(_0xf7ec('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf7ec('0x3'));var util=require('util');var path=require(_0xf7ec('0x4'));var sox=require(_0xf7ec('0x5'));var csv=require(_0xf7ec('0x6'));var ejs=require(_0xf7ec('0x7'));var fs=require('fs');var fs_extra=require(_0xf7ec('0x8'));var _=require(_0xf7ec('0x9'));var squel=require(_0xf7ec('0xa'));var crypto=require('crypto');var jsforce=require(_0xf7ec('0xb'));var deskjs=require(_0xf7ec('0xc'));var toCsv=require(_0xf7ec('0x6'));var querystring=require(_0xf7ec('0xd'));var Papa=require(_0xf7ec('0xe'));var Redis=require(_0xf7ec('0xf'));var authService=require(_0xf7ec('0x10'));var qs=require(_0xf7ec('0x11'));var as=require(_0xf7ec('0x12'));var hardwareService=require(_0xf7ec('0x13'));var logger=require(_0xf7ec('0x14'))('api');var utils=require(_0xf7ec('0x15'));var config=require(_0xf7ec('0x16'));var licenseUtil=require(_0xf7ec('0x17'));var db=require(_0xf7ec('0x18'))['db'];function respondWithStatusCode(_0x50be3f,_0x3457fb){_0x3457fb=_0x3457fb||0xcc;return function(_0x32efae){if(_0x32efae){return _0x50be3f[_0xf7ec('0x19')](_0x3457fb);}return _0x50be3f[_0xf7ec('0x1a')](_0x3457fb)[_0xf7ec('0x1b')]();};}function respondWithResult(_0x1253e5,_0x1dcd92){_0x1dcd92=_0x1dcd92||0xc8;return function(_0x3b3b16){if(_0x3b3b16){return _0x1253e5[_0xf7ec('0x1a')](_0x1dcd92)[_0xf7ec('0x1c')](_0x3b3b16);}};}function respondWithFilteredResult(_0xdf2349,_0x22322c){return function(_0x2c0f07){if(_0x2c0f07){var _0x491605=typeof _0x22322c['offset']===_0xf7ec('0x1d')&&typeof _0x22322c[_0xf7ec('0x1e')]==='undefined';var _0x1866b2=_0x2c0f07['count'];var _0xb2e91f=_0x491605?0x0:_0x22322c[_0xf7ec('0x1f')];var _0x57bde6=_0x491605?_0x2c0f07[_0xf7ec('0x20')]:_0x22322c['offset']+_0x22322c[_0xf7ec('0x1e')];var _0x25501;if(_0x57bde6>=_0x1866b2){_0x57bde6=_0x1866b2;_0x25501=0xc8;}else{_0x25501=0xce;}_0xdf2349[_0xf7ec('0x1a')](_0x25501);return _0xdf2349['set']('Content-Range',_0xb2e91f+'-'+_0x57bde6+'/'+_0x1866b2)[_0xf7ec('0x1c')](_0x2c0f07);}return null;};}function patchUpdates(_0x45cf8a){return function(_0x39ea7d){try{jsonpatch[_0xf7ec('0x21')](_0x39ea7d,_0x45cf8a,!![]);}catch(_0x225fe1){return BPromise['reject'](_0x225fe1);}return _0x39ea7d[_0xf7ec('0x22')]();};}function saveUpdates(_0x4f31e5,_0x4f33af){return function(_0x4335a5){if(_0x4335a5){return _0x4335a5[_0xf7ec('0x23')](_0x4f31e5)[_0xf7ec('0x24')](function(_0x3034a6){return _0x3034a6;});}return null;};}function removeEntity(_0x20b39f,_0x3e868f){return function(_0x58d102){if(_0x58d102){return _0x58d102[_0xf7ec('0x25')]()['then'](function(){_0x20b39f[_0xf7ec('0x1a')](0xcc)[_0xf7ec('0x1b')]();});}};}function handleEntityNotFound(_0x1cad2e,_0x7cb1d2){return function(_0x1f0cde){if(!_0x1f0cde){_0x1cad2e[_0xf7ec('0x19')](0x194);}return _0x1f0cde;};}function handleError(_0x450f96,_0xaccd20){_0xaccd20=_0xaccd20||0x1f4;return function(_0xd4b02a){logger[_0xf7ec('0x26')](_0xd4b02a[_0xf7ec('0x27')]);if(_0xd4b02a[_0xf7ec('0x28')]){delete _0xd4b02a[_0xf7ec('0x28')];}_0x450f96['status'](_0xaccd20)[_0xf7ec('0x29')](_0xd4b02a);};}exports[_0xf7ec('0x2a')]=function(_0x54c038,_0x197eaf){var _0xb4ab6b={},_0x3f9d91={},_0x271aeb={'count':0x0,'rows':[]};var _0x15bd0d=_[_0xf7ec('0x2b')](db[_0xf7ec('0x2c')][_0xf7ec('0x2d')],function(_0x5e11fc){return{'name':_0x5e11fc['fieldName'],'type':_0x5e11fc[_0xf7ec('0x2e')]['key']};});_0x3f9d91[_0xf7ec('0x2f')]=_['map'](_0x15bd0d,_0xf7ec('0x28'));_0x3f9d91[_0xf7ec('0x30')]=_[_0xf7ec('0x31')](_0x54c038[_0xf7ec('0x30')]);_0x3f9d91['filters']=_['intersection'](_0x3f9d91[_0xf7ec('0x2f')],_0x3f9d91[_0xf7ec('0x30')]);_0xb4ab6b[_0xf7ec('0x32')]=_[_0xf7ec('0x33')](_0x3f9d91['model'],qs[_0xf7ec('0x34')](_0x54c038[_0xf7ec('0x30')][_0xf7ec('0x34')]));_0xb4ab6b['attributes']=_0xb4ab6b[_0xf7ec('0x32')][_0xf7ec('0x35')]?_0xb4ab6b[_0xf7ec('0x32')]:_0x3f9d91[_0xf7ec('0x2f')];if(!_0x54c038[_0xf7ec('0x30')]['hasOwnProperty']('nolimit')){_0xb4ab6b['limit']=qs[_0xf7ec('0x1e')](_0x54c038[_0xf7ec('0x30')][_0xf7ec('0x1e')]);_0xb4ab6b[_0xf7ec('0x1f')]=qs[_0xf7ec('0x1f')](_0x54c038[_0xf7ec('0x30')][_0xf7ec('0x1f')]);}_0xb4ab6b['order']=qs[_0xf7ec('0x36')](_0x54c038['query'][_0xf7ec('0x36')]);_0xb4ab6b['where']=qs['filters'](_[_0xf7ec('0x37')](_0x54c038[_0xf7ec('0x30')],_0x3f9d91['filters']),_0x15bd0d);if(_0x54c038[_0xf7ec('0x30')][_0xf7ec('0x38')]){_0xb4ab6b[_0xf7ec('0x39')]=_[_0xf7ec('0x3a')](_0xb4ab6b[_0xf7ec('0x39')],{'$or':_['map'](_0x15bd0d,function(_0x4f4443){if(_0x4f4443[_0xf7ec('0x2e')]!==_0xf7ec('0x3b')){var _0x49410a={};_0x49410a[_0x4f4443[_0xf7ec('0x28')]]={'$like':'%'+_0x54c038['query'][_0xf7ec('0x38')]+'%'};return _0x49410a;}})});}_0xb4ab6b=_[_0xf7ec('0x3a')]({},_0xb4ab6b,_0x54c038[_0xf7ec('0x3c')]);var _0x452562={'where':_0xb4ab6b[_0xf7ec('0x39')]};return db[_0xf7ec('0x2c')][_0xf7ec('0x20')](_0x452562)[_0xf7ec('0x24')](function(_0x8837e6){_0x271aeb[_0xf7ec('0x20')]=_0x8837e6;if(_0x54c038[_0xf7ec('0x30')]['includeAll']){_0xb4ab6b[_0xf7ec('0x3d')]=[{'all':!![]}];}return db[_0xf7ec('0x2c')][_0xf7ec('0x3e')](_0xb4ab6b);})[_0xf7ec('0x24')](function(_0xf1ec3){_0x271aeb['rows']=_0xf1ec3;return _0x271aeb;})[_0xf7ec('0x24')](respondWithFilteredResult(_0x197eaf,_0xb4ab6b))['catch'](handleError(_0x197eaf,null));};exports[_0xf7ec('0x3f')]=function(_0x121652,_0x576354){var _0x16eb1d={'raw':!![],'where':{'id':_0x121652[_0xf7ec('0x40')]['id']}},_0x582209={};_0x582209['model']=_[_0xf7ec('0x31')](db[_0xf7ec('0x2c')][_0xf7ec('0x2d')]);_0x582209[_0xf7ec('0x30')]=_[_0xf7ec('0x31')](_0x121652[_0xf7ec('0x30')]);_0x582209[_0xf7ec('0x41')]=_['intersection'](_0x582209[_0xf7ec('0x2f')],_0x582209[_0xf7ec('0x30')]);_0x16eb1d[_0xf7ec('0x32')]=_[_0xf7ec('0x33')](_0x582209[_0xf7ec('0x2f')],qs[_0xf7ec('0x34')](_0x121652['query'][_0xf7ec('0x34')]));_0x16eb1d[_0xf7ec('0x32')]=_0x16eb1d['attributes'][_0xf7ec('0x35')]?_0x16eb1d[_0xf7ec('0x32')]:_0x582209[_0xf7ec('0x2f')];if(_0x121652[_0xf7ec('0x30')][_0xf7ec('0x42')]){_0x16eb1d[_0xf7ec('0x3d')]=[{'all':!![]}];}_0x16eb1d=_['merge']({},_0x16eb1d,_0x121652[_0xf7ec('0x3c')]);return db[_0xf7ec('0x2c')][_0xf7ec('0x43')](_0x16eb1d)[_0xf7ec('0x24')](handleEntityNotFound(_0x576354,null))['then'](respondWithResult(_0x576354,null))['catch'](handleError(_0x576354,null));};exports[_0xf7ec('0x44')]=function(_0x1b2c97,_0x55f8d5){return db[_0xf7ec('0x2c')][_0xf7ec('0x44')](_0x1b2c97[_0xf7ec('0x45')],{})[_0xf7ec('0x24')](respondWithResult(_0x55f8d5,0xc9))[_0xf7ec('0x46')](handleError(_0x55f8d5,null));};exports['describe']=function(_0x439bb4,_0x5e1a32){return db[_0xf7ec('0x2c')][_0xf7ec('0x47')]()[_0xf7ec('0x24')](respondWithResult(_0x5e1a32,null))[_0xf7ec('0x46')](handleError(_0x5e1a32,null));};exports['update']=function(_0x55fd78,_0x447987){if(_0x55fd78['body']['uniqueid']){delete _0x55fd78[_0xf7ec('0x45')][_0xf7ec('0x48')];}return db['CmHopperHistory']['find']({'where':{'uniqueid':_0x55fd78[_0xf7ec('0x40')]['id']}})[_0xf7ec('0x24')](handleEntityNotFound(_0x447987,null))[_0xf7ec('0x24')](saveUpdates(_0x55fd78[_0xf7ec('0x45')],null))[_0xf7ec('0x24')](respondWithResult(_0x447987,null))[_0xf7ec('0x46')](handleError(_0x447987,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 4ba1fbe..ff4c672 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 _0xe0dc=['bluebird','request-promise','path','rimraf','./cmHopperHistory.attributes','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','../../config/logger','api'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe0dc,0x190));var _0xce0d=function(_0x269ee8,_0x477226){_0x269ee8=_0x269ee8-0x0;var _0x4d98bd=_0xe0dc[_0x269ee8];return _0x4d98bd;};'use strict';var _=require(_0xce0d('0x0'));var util=require('util');var logger=require(_0xce0d('0x1'))(_0xce0d('0x2'));var moment=require('moment');var BPromise=require(_0xce0d('0x3'));var rp=require(_0xce0d('0x4'));var fs=require('fs');var path=require(_0xce0d('0x5'));var rimraf=require(_0xce0d('0x6'));var config=require('../../config/environment');var attributes=require(_0xce0d('0x7'));module['exports']=function(_0x3e7888,_0x33f430){return _0x3e7888[_0xce0d('0x8')](_0xce0d('0x9'),attributes,{'tableName':_0xce0d('0xa'),'paranoid':![],'indexes':[{'name':_0xce0d('0xb'),'fields':[_0xce0d('0xb')]},{'name':_0xce0d('0xc'),'fields':[_0xce0d('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe3b3=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','CmHopperHistory','cm_hopper_history','endtime','uniqueid'];(function(_0x17df81,_0x1abf55){var _0x2d1007=function(_0x185ded){while(--_0x185ded){_0x17df81['push'](_0x17df81['shift']());}};_0x2d1007(++_0x1abf55);}(_0xe3b3,0x1b3));var _0x3e3b=function(_0x58a89d,_0x5b8404){_0x58a89d=_0x58a89d-0x0;var _0x44bed1=_0xe3b3[_0x58a89d];return _0x44bed1;};'use strict';var _=require(_0x3e3b('0x0'));var util=require(_0x3e3b('0x1'));var logger=require(_0x3e3b('0x2'))(_0x3e3b('0x3'));var moment=require(_0x3e3b('0x4'));var BPromise=require(_0x3e3b('0x5'));var rp=require(_0x3e3b('0x6'));var fs=require('fs');var path=require(_0x3e3b('0x7'));var rimraf=require(_0x3e3b('0x8'));var config=require(_0x3e3b('0x9'));var attributes=require('./cmHopperHistory.attributes');module[_0x3e3b('0xa')]=function(_0x3fd79a,_0x410458){return _0x3fd79a['define'](_0x3e3b('0xb'),attributes,{'tableName':_0x3e3b('0xc'),'paranoid':![],'indexes':[{'name':_0x3e3b('0xd'),'fields':[_0x3e3b('0xd')]},{'name':_0x3e3b('0xe'),'fields':[_0x3e3b('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index b920b3d..22bcb16 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 _0xe5b5=['CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateCmHopperHistory','CmHopperHistory','options','raw','catch','AvgHandleTime','findAll','where','COUNT','sequelize','col','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','literal','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','stringify','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info'];(function(_0x510b98,_0x4c4cbb){var _0x45e775=function(_0x29ec11){while(--_0x29ec11){_0x510b98['push'](_0x510b98['shift']());}};_0x45e775(++_0x4c4cbb);}(_0xe5b5,0x73));var _0x5e5b=function(_0x35a140,_0x3aeac6){_0x35a140=_0x35a140-0x0;var _0x30ab82=_0xe5b5[_0x35a140];return _0x30ab82;};'use strict';var _=require('lodash');var util=require(_0x5e5b('0x0'));var moment=require(_0x5e5b('0x1'));var BPromise=require(_0x5e5b('0x2'));var rs=require(_0x5e5b('0x3'));var fs=require('fs');var Redis=require(_0x5e5b('0x4'));var db=require(_0x5e5b('0x5'))['db'];var utils=require(_0x5e5b('0x6'));var logger=require(_0x5e5b('0x7'))(_0x5e5b('0x8'));var config=require(_0x5e5b('0x9'));var jayson=require(_0x5e5b('0xa'));var client=jayson['client'][_0x5e5b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x46660b,_0x365505,_0xfeecb4){return new BPromise(function(_0x26d2fa,_0x392941){return client[_0x5e5b('0xc')](_0x46660b,_0xfeecb4)[_0x5e5b('0xd')](function(_0x5d99be){logger[_0x5e5b('0xe')](_0x5e5b('0xf'),_0x365505,_0x5e5b('0x10'));logger[_0x5e5b('0x11')](_0x5e5b('0x12'),_0x365505,_0x5e5b('0x10'),JSON['stringify'](_0x5d99be));if(_0x5d99be['error']){if(_0x5d99be[_0x5e5b('0x13')][_0x5e5b('0x14')]===0x1f4){logger[_0x5e5b('0x13')](_0x5e5b('0xf'),_0x365505,_0x5d99be[_0x5e5b('0x13')][_0x5e5b('0x15')]);return _0x392941(_0x5d99be['error'][_0x5e5b('0x15')]);}logger[_0x5e5b('0x13')](_0x5e5b('0xf'),_0x365505,_0x5d99be[_0x5e5b('0x13')][_0x5e5b('0x15')]);return _0x26d2fa(_0x5d99be[_0x5e5b('0x13')][_0x5e5b('0x15')]);}else{logger[_0x5e5b('0xe')](_0x5e5b('0xf'),_0x365505,_0x5e5b('0x10'));_0x26d2fa(_0x5d99be[_0x5e5b('0x16')][_0x5e5b('0x15')]);}})['catch'](function(_0x271be0){logger[_0x5e5b('0x13')](_0x5e5b('0xf'),_0x365505,_0x271be0);_0x392941(_0x271be0);});});}exports[_0x5e5b('0x17')]=function(_0x498d68){var _0x2dcf5e=this;return new Promise(function(_0xe24365,_0x3afbf5){return db[_0x5e5b('0x18')]['create'](_0x498d68['body'],{'raw':_0x498d68[_0x5e5b('0x19')]?_0x498d68[_0x5e5b('0x19')][_0x5e5b('0x1a')]===undefined?!![]:![]:!![]})[_0x5e5b('0xd')](function(_0x479ae5){logger[_0x5e5b('0xe')](_0x5e5b('0x17'),_0x498d68);logger['debug'](_0x5e5b('0x17'),_0x498d68,JSON['stringify'](_0x479ae5));_0xe24365(_0x479ae5);})[_0x5e5b('0x1b')](function(_0x36cce7){logger[_0x5e5b('0x13')]('CreateCmHopperHistory',_0x36cce7[_0x5e5b('0x15')],_0x498d68);_0x3afbf5(_0x2dcf5e['error'](0x1f4,_0x36cce7[_0x5e5b('0x15')]));});});};exports[_0x5e5b('0x1c')]=function(_0x49b15b){var _0x55f2ed=this;return new Promise(function(_0x544349,_0x5558b3){return db['CmHopperHistory'][_0x5e5b('0x1d')]({'raw':_0x49b15b['options']?_0x49b15b['options']['raw']===undefined?!![]:![]:!![],'where':_0x49b15b['options']?_0x49b15b[_0x5e5b('0x19')][_0x5e5b('0x1e')]||null:null,'attributes':[[db['sequelize']['fn'](_0x5e5b('0x1f'),db[_0x5e5b('0x20')][_0x5e5b('0x21')]('id')),'predictiveIntervalTotalCalls'],[db[_0x5e5b('0x20')]['fn'](_0x5e5b('0x1f'),db['sequelize']['fn']('IF',db[_0x5e5b('0x20')]['literal'](_0x5e5b('0x22')))),_0x5e5b('0x23')],[db[_0x5e5b('0x20')]['fn'](_0x5e5b('0x1f'),db[_0x5e5b('0x20')]['fn']('IF',db[_0x5e5b('0x20')][_0x5e5b('0x24')](_0x5e5b('0x25')))),_0x5e5b('0x26')],[db['sequelize']['fn'](_0x5e5b('0x1f'),db[_0x5e5b('0x20')]['fn']('IF',db[_0x5e5b('0x20')][_0x5e5b('0x24')](_0x5e5b('0x27')))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0x5e5b('0x20')]['fn']('AVG',db[_0x5e5b('0x20')]['fn']('IF',db[_0x5e5b('0x20')]['literal'](_0x5e5b('0x28')))),_0x5e5b('0x29')],[db[_0x5e5b('0x20')]['fn']('AVG',db[_0x5e5b('0x20')]['fn']('IF',db['sequelize'][_0x5e5b('0x24')](_0x5e5b('0x2a')))),_0x5e5b('0x2b')]]})[_0x5e5b('0xd')](function(_0x3e0110){logger[_0x5e5b('0xe')](_0x5e5b('0x1c'),_0x49b15b);logger[_0x5e5b('0x11')](_0x5e5b('0x1c'),_0x49b15b,JSON[_0x5e5b('0x2c')](_0x3e0110));_0x544349(_0x3e0110);})[_0x5e5b('0x1b')](function(_0x6f7f53){logger[_0x5e5b('0x13')]('AvgHandleTime',_0x6f7f53['message'],_0x49b15b);_0x5558b3(_0x55f2ed['error'](0x1f4,_0x6f7f53[_0x5e5b('0x15')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x2d6016){var _0x59bea4=this;return new Promise(function(_0x293003,_0xe54628){return db[_0x5e5b('0x18')][_0x5e5b('0x1d')]({'raw':_0x2d6016[_0x5e5b('0x19')]?_0x2d6016[_0x5e5b('0x19')][_0x5e5b('0x1a')]===undefined?!![]:![]:!![],'where':_0x2d6016['options']?_0x2d6016[_0x5e5b('0x19')]['where']||null:null,'attributes':[[_0x5e5b('0x2d'),_0x5e5b('0x2e')],[db[_0x5e5b('0x20')]['fn'](_0x5e5b('0x1f'),db['sequelize']['fn']('IF',db[_0x5e5b('0x20')]['literal'](_0x5e5b('0x2f')))),_0x5e5b('0x30')],[db[_0x5e5b('0x20')]['fn'](_0x5e5b('0x1f'),db[_0x5e5b('0x20')]['fn']('IF',db['sequelize']['literal'](_0x5e5b('0x31')))),_0x5e5b('0x32')],[db[_0x5e5b('0x20')]['fn'](_0x5e5b('0x1f'),db[_0x5e5b('0x20')]['fn']('IF',db[_0x5e5b('0x20')]['literal'](_0x5e5b('0x22')))),'outboundAnswerCallsDay'],[db[_0x5e5b('0x20')]['fn'](_0x5e5b('0x1f'),db[_0x5e5b('0x20')]['fn']('IF',db[_0x5e5b('0x20')][_0x5e5b('0x24')](_0x5e5b('0x33')))),'outboundBusyCallsDay'],[db[_0x5e5b('0x20')]['fn'](_0x5e5b('0x1f'),db[_0x5e5b('0x20')]['fn']('IF',db[_0x5e5b('0x20')]['literal'](_0x5e5b('0x34')))),'outboundCongestionCallsDay'],[db[_0x5e5b('0x20')]['fn']('COUNT',db[_0x5e5b('0x20')]['fn']('IF',db[_0x5e5b('0x20')][_0x5e5b('0x24')](_0x5e5b('0x35')))),'outboundDropCallsDayTimeout'],[db['sequelize']['fn']('COUNT',db[_0x5e5b('0x20')]['fn']('IF',db['sequelize'][_0x5e5b('0x24')](_0x5e5b('0x36')))),'outboundDropCallsDayCallersExit'],[db[_0x5e5b('0x20')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x5e5b('0x20')][_0x5e5b('0x24')]('`state`\x20=\x2012,\x201,\x20null'))),'outboundUnknownCallsDay'],[db[_0x5e5b('0x20')]['fn'](_0x5e5b('0x1f'),db['sequelize']['fn']('IF',db[_0x5e5b('0x20')][_0x5e5b('0x24')](_0x5e5b('0x37')))),_0x5e5b('0x38')],[db['sequelize']['fn']('COUNT',db[_0x5e5b('0x20')]['fn']('IF',db[_0x5e5b('0x20')][_0x5e5b('0x24')](_0x5e5b('0x39')))),_0x5e5b('0x3a')],[db[_0x5e5b('0x20')]['fn']('COUNT',db[_0x5e5b('0x20')]['fn']('IF',db[_0x5e5b('0x20')][_0x5e5b('0x24')](_0x5e5b('0x3b')))),_0x5e5b('0x3c')],[db[_0x5e5b('0x20')]['fn'](_0x5e5b('0x1f'),db[_0x5e5b('0x20')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2016,\x201,\x20null'))),'outboundAnswerAgiCallsDay'],[db[_0x5e5b('0x20')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x5e5b('0x20')][_0x5e5b('0x24')]('`state`\x20=\x2020,\x201,\x20null'))),_0x5e5b('0x3c')],[db[_0x5e5b('0x20')]['fn'](_0x5e5b('0x1f'),db[_0x5e5b('0x20')]['fn']('IF',db['sequelize']['literal'](_0x5e5b('0x3d')))),_0x5e5b('0x3e')]],'group':[_0x5e5b('0x2d')]})[_0x5e5b('0xd')](function(_0x1281b2){logger['info']('GetVoiceQueueHopperHistory',_0x2d6016);logger['debug']('GetVoiceQueueHopperHistory',_0x2d6016,JSON[_0x5e5b('0x2c')](_0x1281b2));_0x293003(_0x1281b2);})[_0x5e5b('0x1b')](function(_0x5b3fe0){logger[_0x5e5b('0x13')](_0x5e5b('0x3f'),_0x5b3fe0[_0x5e5b('0x15')],_0x2d6016);_0xe54628(_0x59bea4[_0x5e5b('0x13')](0x1f4,_0x5b3fe0[_0x5e5b('0x15')]));});});};exports['GetCampaignHopperHistory']=function(_0x18b12e){var _0x414f78=this;return new Promise(function(_0x39cfff,_0x3c6abe){return db[_0x5e5b('0x18')][_0x5e5b('0x1d')]({'raw':_0x18b12e['options']?_0x18b12e['options'][_0x5e5b('0x1a')]===undefined?!![]:![]:!![],'where':_0x18b12e[_0x5e5b('0x19')]?_0x18b12e['options'][_0x5e5b('0x1e')]||null:null,'attributes':[[_0x5e5b('0x2d'),_0x5e5b('0x2e')],[db['sequelize']['fn'](_0x5e5b('0x1f'),db[_0x5e5b('0x20')]['col']('id')),'ivrTotalCallsDays'],[db[_0x5e5b('0x20')]['fn']('COUNT',db[_0x5e5b('0x20')]['fn']('IF',db['sequelize'][_0x5e5b('0x24')](_0x5e5b('0x22')))),'ivrAnswerCallsDay']],'group':[_0x5e5b('0x2d')]})[_0x5e5b('0xd')](function(_0x4882bc){logger[_0x5e5b('0xe')](_0x5e5b('0x40'),_0x18b12e);logger['debug'](_0x5e5b('0x40'),_0x18b12e,JSON[_0x5e5b('0x2c')](_0x4882bc));_0x39cfff(_0x4882bc);})[_0x5e5b('0x1b')](function(_0x209ec1){logger['error'](_0x5e5b('0x40'),_0x209ec1[_0x5e5b('0x15')],_0x18b12e);_0x3c6abe(_0x414f78[_0x5e5b('0x13')](0x1f4,_0x209ec1['message']));});});}; \ No newline at end of file +var _0xba30=['`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','moment','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperHistory,\x20%s,\x20%s','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateCmHopperHistory','body','options','AvgHandleTime','CmHopperHistory','raw','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','findAll','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay'];(function(_0x573d33,_0x3cb737){var _0x9ed149=function(_0x16d7e7){while(--_0x16d7e7){_0x573d33['push'](_0x573d33['shift']());}};_0x9ed149(++_0x3cb737);}(_0xba30,0xf0));var _0x0ba3=function(_0x3238bd,_0x4ea3ef){_0x3238bd=_0x3238bd-0x0;var _0xdc7a7e=_0xba30[_0x3238bd];return _0xdc7a7e;};'use strict';var _=require(_0x0ba3('0x0'));var util=require(_0x0ba3('0x1'));var moment=require(_0x0ba3('0x2'));var BPromise=require('bluebird');var rs=require(_0x0ba3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0ba3('0x4'));var logger=require(_0x0ba3('0x5'))('rpc');var config=require(_0x0ba3('0x6'));var jayson=require(_0x0ba3('0x7'));var client=jayson[_0x0ba3('0x8')][_0x0ba3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x45429c,_0x1888a2,_0x390541){return new BPromise(function(_0x2b3d81,_0x43e5ba){return client[_0x0ba3('0xa')](_0x45429c,_0x390541)[_0x0ba3('0xb')](function(_0x4695ec){logger[_0x0ba3('0xc')](_0x0ba3('0xd'),_0x1888a2,'request\x20sent');logger[_0x0ba3('0xe')](_0x0ba3('0xf'),_0x1888a2,_0x0ba3('0x10'),JSON[_0x0ba3('0x11')](_0x4695ec));if(_0x4695ec[_0x0ba3('0x12')]){if(_0x4695ec[_0x0ba3('0x12')][_0x0ba3('0x13')]===0x1f4){logger[_0x0ba3('0x12')](_0x0ba3('0xd'),_0x1888a2,_0x4695ec[_0x0ba3('0x12')][_0x0ba3('0x14')]);return _0x43e5ba(_0x4695ec['error'][_0x0ba3('0x14')]);}logger[_0x0ba3('0x12')](_0x0ba3('0xd'),_0x1888a2,_0x4695ec['error'][_0x0ba3('0x14')]);return _0x2b3d81(_0x4695ec[_0x0ba3('0x12')][_0x0ba3('0x14')]);}else{logger[_0x0ba3('0xc')](_0x0ba3('0xd'),_0x1888a2,_0x0ba3('0x10'));_0x2b3d81(_0x4695ec[_0x0ba3('0x15')][_0x0ba3('0x14')]);}})[_0x0ba3('0x16')](function(_0x16fa5a){logger[_0x0ba3('0x12')]('CmHopperHistory,\x20%s,\x20%s',_0x1888a2,_0x16fa5a);_0x43e5ba(_0x16fa5a);});});}exports[_0x0ba3('0x17')]=function(_0x4f8dff){var _0x23ff5d=this;return new Promise(function(_0x13c515,_0x10f748){return db['CmHopperHistory']['create'](_0x4f8dff[_0x0ba3('0x18')],{'raw':_0x4f8dff[_0x0ba3('0x19')]?_0x4f8dff[_0x0ba3('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x0ba3('0xb')](function(_0x2a2315){logger[_0x0ba3('0xc')](_0x0ba3('0x17'),_0x4f8dff);logger[_0x0ba3('0xe')]('CreateCmHopperHistory',_0x4f8dff,JSON[_0x0ba3('0x11')](_0x2a2315));_0x13c515(_0x2a2315);})[_0x0ba3('0x16')](function(_0xeb2208){logger[_0x0ba3('0x12')]('CreateCmHopperHistory',_0xeb2208[_0x0ba3('0x14')],_0x4f8dff);_0x10f748(_0x23ff5d[_0x0ba3('0x12')](0x1f4,_0xeb2208[_0x0ba3('0x14')]));});});};exports[_0x0ba3('0x1a')]=function(_0x2e64ff){var _0x4b0339=this;return new Promise(function(_0x30f356,_0x464726){return db[_0x0ba3('0x1b')]['findAll']({'raw':_0x2e64ff[_0x0ba3('0x19')]?_0x2e64ff['options'][_0x0ba3('0x1c')]===undefined?!![]:![]:!![],'where':_0x2e64ff[_0x0ba3('0x19')]?_0x2e64ff['options'][_0x0ba3('0x1d')]||null:null,'attributes':[[db[_0x0ba3('0x1e')]['fn'](_0x0ba3('0x1f'),db[_0x0ba3('0x1e')][_0x0ba3('0x20')]('id')),_0x0ba3('0x21')],[db['sequelize']['fn']('COUNT',db[_0x0ba3('0x1e')]['fn']('IF',db['sequelize'][_0x0ba3('0x22')](_0x0ba3('0x23')))),'predictiveIntervalAnsweredCalls'],[db['sequelize']['fn'](_0x0ba3('0x1f'),db[_0x0ba3('0x1e')]['fn']('IF',db[_0x0ba3('0x1e')]['literal'](_0x0ba3('0x24')))),_0x0ba3('0x25')],[db['sequelize']['fn'](_0x0ba3('0x1f'),db[_0x0ba3('0x1e')]['fn']('IF',db[_0x0ba3('0x1e')][_0x0ba3('0x22')](_0x0ba3('0x26')))),_0x0ba3('0x27')],[db[_0x0ba3('0x1e')]['fn']('AVG',db[_0x0ba3('0x1e')]['fn']('IF',db[_0x0ba3('0x1e')][_0x0ba3('0x22')](_0x0ba3('0x28')))),_0x0ba3('0x29')],[db[_0x0ba3('0x1e')]['fn'](_0x0ba3('0x2a'),db['sequelize']['fn']('IF',db[_0x0ba3('0x1e')][_0x0ba3('0x22')](_0x0ba3('0x2b')))),_0x0ba3('0x2c')]]})['then'](function(_0x45afc7){logger[_0x0ba3('0xc')](_0x0ba3('0x1a'),_0x2e64ff);logger['debug'](_0x0ba3('0x1a'),_0x2e64ff,JSON[_0x0ba3('0x11')](_0x45afc7));_0x30f356(_0x45afc7);})[_0x0ba3('0x16')](function(_0x38b1d9){logger['error'](_0x0ba3('0x1a'),_0x38b1d9['message'],_0x2e64ff);_0x464726(_0x4b0339[_0x0ba3('0x12')](0x1f4,_0x38b1d9[_0x0ba3('0x14')]));});});};exports[_0x0ba3('0x2d')]=function(_0x298358){var _0x4f5962=this;return new Promise(function(_0x3a91ff,_0x4453b7){return db[_0x0ba3('0x1b')][_0x0ba3('0x2e')]({'raw':_0x298358[_0x0ba3('0x19')]?_0x298358[_0x0ba3('0x19')][_0x0ba3('0x1c')]===undefined?!![]:![]:!![],'where':_0x298358[_0x0ba3('0x19')]?_0x298358['options']['where']||null:null,'attributes':[[_0x0ba3('0x2f'),_0x0ba3('0x30')],[db['sequelize']['fn'](_0x0ba3('0x1f'),db[_0x0ba3('0x1e')]['fn']('IF',db[_0x0ba3('0x1e')]['literal'](_0x0ba3('0x31')))),_0x0ba3('0x32')],[db['sequelize']['fn'](_0x0ba3('0x1f'),db[_0x0ba3('0x1e')]['fn']('IF',db['sequelize']['literal'](_0x0ba3('0x33')))),_0x0ba3('0x34')],[db[_0x0ba3('0x1e')]['fn'](_0x0ba3('0x1f'),db[_0x0ba3('0x1e')]['fn']('IF',db['sequelize'][_0x0ba3('0x22')](_0x0ba3('0x23')))),_0x0ba3('0x35')],[db[_0x0ba3('0x1e')]['fn'](_0x0ba3('0x1f'),db[_0x0ba3('0x1e')]['fn']('IF',db[_0x0ba3('0x1e')][_0x0ba3('0x22')](_0x0ba3('0x36')))),_0x0ba3('0x37')],[db[_0x0ba3('0x1e')]['fn'](_0x0ba3('0x1f'),db[_0x0ba3('0x1e')]['fn']('IF',db[_0x0ba3('0x1e')]['literal'](_0x0ba3('0x38')))),_0x0ba3('0x39')],[db[_0x0ba3('0x1e')]['fn'](_0x0ba3('0x1f'),db[_0x0ba3('0x1e')]['fn']('IF',db['sequelize'][_0x0ba3('0x22')](_0x0ba3('0x3a')))),'outboundDropCallsDayTimeout'],[db[_0x0ba3('0x1e')]['fn']('COUNT',db[_0x0ba3('0x1e')]['fn']('IF',db[_0x0ba3('0x1e')][_0x0ba3('0x22')](_0x0ba3('0x3b')))),'outboundDropCallsDayCallersExit'],[db['sequelize']['fn'](_0x0ba3('0x1f'),db[_0x0ba3('0x1e')]['fn']('IF',db[_0x0ba3('0x1e')]['literal'](_0x0ba3('0x3c')))),_0x0ba3('0x3d')],[db[_0x0ba3('0x1e')]['fn'](_0x0ba3('0x1f'),db[_0x0ba3('0x1e')]['fn']('IF',db[_0x0ba3('0x1e')][_0x0ba3('0x22')](_0x0ba3('0x3e')))),_0x0ba3('0x3f')],[db['sequelize']['fn']('COUNT',db[_0x0ba3('0x1e')]['fn']('IF',db[_0x0ba3('0x1e')][_0x0ba3('0x22')](_0x0ba3('0x40')))),'outboundOriginateFailureCallsDay'],[db[_0x0ba3('0x1e')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x0ba3('0x1e')][_0x0ba3('0x22')](_0x0ba3('0x41')))),_0x0ba3('0x42')],[db[_0x0ba3('0x1e')]['fn']('COUNT',db[_0x0ba3('0x1e')]['fn']('IF',db[_0x0ba3('0x1e')]['literal']('`state`\x20=\x2016,\x201,\x20null'))),_0x0ba3('0x43')],[db[_0x0ba3('0x1e')]['fn'](_0x0ba3('0x1f'),db[_0x0ba3('0x1e')]['fn']('IF',db[_0x0ba3('0x1e')][_0x0ba3('0x22')](_0x0ba3('0x44')))),'outboundRejectCallsDay'],[db[_0x0ba3('0x1e')]['fn'](_0x0ba3('0x1f'),db[_0x0ba3('0x1e')]['fn']('IF',db['sequelize'][_0x0ba3('0x22')](_0x0ba3('0x45')))),_0x0ba3('0x46')]],'group':['campaign']})[_0x0ba3('0xb')](function(_0x5721e3){logger[_0x0ba3('0xc')](_0x0ba3('0x2d'),_0x298358);logger[_0x0ba3('0xe')](_0x0ba3('0x2d'),_0x298358,JSON[_0x0ba3('0x11')](_0x5721e3));_0x3a91ff(_0x5721e3);})[_0x0ba3('0x16')](function(_0x2f6a03){logger['error']('GetVoiceQueueHopperHistory',_0x2f6a03[_0x0ba3('0x14')],_0x298358);_0x4453b7(_0x4f5962[_0x0ba3('0x12')](0x1f4,_0x2f6a03[_0x0ba3('0x14')]));});});};exports[_0x0ba3('0x47')]=function(_0x2434a2){var _0x5e7c3c=this;return new Promise(function(_0x56a606,_0x2e07f6){return db[_0x0ba3('0x1b')][_0x0ba3('0x2e')]({'raw':_0x2434a2[_0x0ba3('0x19')]?_0x2434a2[_0x0ba3('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x2434a2['options']?_0x2434a2[_0x0ba3('0x19')][_0x0ba3('0x1d')]||null:null,'attributes':[[_0x0ba3('0x2f'),_0x0ba3('0x30')],[db[_0x0ba3('0x1e')]['fn'](_0x0ba3('0x1f'),db[_0x0ba3('0x1e')][_0x0ba3('0x20')]('id')),_0x0ba3('0x48')],[db['sequelize']['fn']('COUNT',db[_0x0ba3('0x1e')]['fn']('IF',db[_0x0ba3('0x1e')][_0x0ba3('0x22')]('`state`\x20=\x204,\x201,\x20null'))),_0x0ba3('0x49')]],'group':[_0x0ba3('0x2f')]})[_0x0ba3('0xb')](function(_0x1c9ca9){logger['info'](_0x0ba3('0x47'),_0x2434a2);logger[_0x0ba3('0xe')](_0x0ba3('0x47'),_0x2434a2,JSON[_0x0ba3('0x11')](_0x1c9ca9));_0x56a606(_0x1c9ca9);})[_0x0ba3('0x16')](function(_0x18ecf9){logger[_0x0ba3('0x12')](_0x0ba3('0x47'),_0x18ecf9['message'],_0x2434a2);_0x2e07f6(_0x5e7c3c[_0x0ba3('0x12')](0x1f4,_0x18ecf9[_0x0ba3('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index d1f34a7..a6a4cd3 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 _0x695f=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update','exports','multer','util','connect-timeout','express'];(function(_0x5df2e7,_0x459c03){var _0x223898=function(_0x405cb2){while(--_0x405cb2){_0x5df2e7['push'](_0x5df2e7['shift']());}};_0x223898(++_0x459c03);}(_0x695f,0x65));var _0xf695=function(_0x3e8ec1,_0x436698){_0x3e8ec1=_0x3e8ec1-0x0;var _0xa63fb1=_0x695f[_0x3e8ec1];return _0xa63fb1;};'use strict';var multer=require(_0xf695('0x0'));var util=require(_0xf695('0x1'));var path=require('path');var timeout=require(_0xf695('0x2'));var express=require(_0xf695('0x3'));var router=express[_0xf695('0x4')]();var fs_extra=require(_0xf695('0x5'));var auth=require(_0xf695('0x6'));var interaction=require(_0xf695('0x7'));var config=require(_0xf695('0x8'));var controller=require(_0xf695('0x9'));router[_0xf695('0xa')]('/',auth[_0xf695('0xb')](),controller[_0xf695('0xc')]);router['get'](_0xf695('0xd'),auth[_0xf695('0xb')](),controller[_0xf695('0xe')]);router[_0xf695('0xa')](_0xf695('0xf'),auth['isAuthenticated'](),controller['show']);router[_0xf695('0x10')]('/',auth[_0xf695('0xb')](),controller[_0xf695('0x11')]);router[_0xf695('0x12')](_0xf695('0xf'),auth[_0xf695('0xb')](),controller[_0xf695('0x13')]);module[_0xf695('0x14')]=router; \ No newline at end of file +var _0xb2a0=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./cmHopperHistory.controller','get','isAuthenticated','/:id','show','create','update','multer'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xb2a0,0xfb));var _0x0b2a=function(_0x30947e,_0x349ca0){_0x30947e=_0x30947e-0x0;var _0x21a417=_0xb2a0[_0x30947e];return _0x21a417;};'use strict';var multer=require(_0x0b2a('0x0'));var util=require(_0x0b2a('0x1'));var path=require(_0x0b2a('0x2'));var timeout=require(_0x0b2a('0x3'));var express=require(_0x0b2a('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x0b2a('0x5'));var interaction=require(_0x0b2a('0x6'));var config=require('../../config/environment');var controller=require(_0x0b2a('0x7'));router[_0x0b2a('0x8')]('/',auth[_0x0b2a('0x9')](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x0b2a('0x8')](_0x0b2a('0xa'),auth['isAuthenticated'](),controller[_0x0b2a('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x0b2a('0xc')]);router['put'](_0x0b2a('0xa'),auth['isAuthenticated'](),controller[_0x0b2a('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index c2f94f4..7c0292a 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 _0xf350=['sequelize','name','STRING'];(function(_0x1835b9,_0x9e7abd){var _0x5583b6=function(_0x5a1b8b){while(--_0x5a1b8b){_0x1835b9['push'](_0x1835b9['shift']());}};_0x5583b6(++_0x9e7abd);}(_0xf350,0x105));var _0x0f35=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf350[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x0f35('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x0f35('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x0f35('0x2')]},'dialPrefix':{'type':Sequelize[_0x0f35('0x2')]}}; \ No newline at end of file +var _0x3468=['name','sequelize'];(function(_0xf83382,_0x28c617){var _0x39b803=function(_0x2a54e2){while(--_0x2a54e2){_0xf83382['push'](_0xf83382['shift']());}};_0x39b803(++_0x28c617);}(_0x3468,0x8d));var _0x8346=function(_0x2bbf41,_0x341dcc){_0x2bbf41=_0x2bbf41-0x0;var _0x3eaf83=_0x3468[_0x2bbf41];return _0x3eaf83;};'use strict';var Sequelize=require(_0x8346('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x8346('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 18aef5b..f39be51 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 _0x4faf=['transaction','addCustomFields','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','cm_contacts','cf_%s','findAndCountAll','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','sequelize','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./cmList.socket','register','status','end','offset','undefined','limit','count','set','apply','reject','save','then','get','UserProfileResource','destroy','sendStatus','error','name','send','index','CmList','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','catch','params','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Lists','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','addDisposition','ListId','Disposition','includeAll','removeDispositions','ids','addContacts','tags','isArray','join','push','CmContact','omit','success','errors','message','Malformed\x20request\x20syntax','CmCustomField','CustomFields','cf_%d','getContacts','getContactsCsv','ContactItemType','OrderBy','alias','select','distinct','field','c.cf_','customField_','item','from','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','description','toString','each','isEmpty','now','format','/tmp/list_%d_%s.csv','setHeader','attachment;\x20filename=','Content-type','download'];(function(_0x29d142,_0x539fc4){var _0x175259=function(_0x48e99f){while(--_0x48e99f){_0x29d142['push'](_0x29d142['shift']());}};_0x175259(++_0x539fc4);}(_0x4faf,0xb1));var _0xf4fa=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4faf[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf4fa('0x0'));var zipdir=require(_0xf4fa('0x1'));var jsonpatch=require(_0xf4fa('0x2'));var rp=require(_0xf4fa('0x3'));var moment=require(_0xf4fa('0x4'));var BPromise=require(_0xf4fa('0x5'));var Mustache=require('mustache');var util=require(_0xf4fa('0x6'));var path=require(_0xf4fa('0x7'));var sox=require(_0xf4fa('0x8'));var csv=require(_0xf4fa('0x9'));var ejs=require(_0xf4fa('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf4fa('0xb'));var squel=require(_0xf4fa('0xc'));var crypto=require(_0xf4fa('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xf4fa('0xe'));var toCsv=require(_0xf4fa('0x9'));var querystring=require(_0xf4fa('0xf'));var Papa=require(_0xf4fa('0x10'));var Redis=require('ioredis');var authService=require(_0xf4fa('0x11'));var qs=require(_0xf4fa('0x12'));var as=require(_0xf4fa('0x13'));var hardwareService=require(_0xf4fa('0x14'));var logger=require('../../config/logger')(_0xf4fa('0x15'));var utils=require(_0xf4fa('0x16'));var config=require(_0xf4fa('0x17'));var licenseUtil=require(_0xf4fa('0x18'));var db=require(_0xf4fa('0x19'))['db'];var csv_results;config[_0xf4fa('0x1a')]=_[_0xf4fa('0x1b')](config[_0xf4fa('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf4fa('0x1a')]));require(_0xf4fa('0x1c'))[_0xf4fa('0x1d')](socket);function respondWithStatusCode(_0x1518d6,_0x5cfa72){_0x5cfa72=_0x5cfa72||0xcc;return function(_0x1b4d0e){if(_0x1b4d0e){return _0x1518d6['sendStatus'](_0x5cfa72);}return _0x1518d6[_0xf4fa('0x1e')](_0x5cfa72)[_0xf4fa('0x1f')]();};}function respondWithResult(_0x2842c2,_0x23c76f){_0x23c76f=_0x23c76f||0xc8;return function(_0x573c5e){if(_0x573c5e){return _0x2842c2['status'](_0x23c76f)['json'](_0x573c5e);}};}function respondWithFilteredResult(_0x16f90b,_0x29172d){return function(_0x32eb9a){if(_0x32eb9a){var _0x10a81d=typeof _0x29172d[_0xf4fa('0x20')]===_0xf4fa('0x21')&&typeof _0x29172d[_0xf4fa('0x22')]===_0xf4fa('0x21');var _0x2ea44d=_0x32eb9a[_0xf4fa('0x23')];var _0x1ed306=_0x10a81d?0x0:_0x29172d[_0xf4fa('0x20')];var _0x28daa8=_0x10a81d?_0x32eb9a[_0xf4fa('0x23')]:_0x29172d[_0xf4fa('0x20')]+_0x29172d[_0xf4fa('0x22')];var _0x3fcaa4;if(_0x28daa8>=_0x2ea44d){_0x28daa8=_0x2ea44d;_0x3fcaa4=0xc8;}else{_0x3fcaa4=0xce;}_0x16f90b[_0xf4fa('0x1e')](_0x3fcaa4);return _0x16f90b[_0xf4fa('0x24')]('Content-Range',_0x1ed306+'-'+_0x28daa8+'/'+_0x2ea44d)['json'](_0x32eb9a);}return null;};}function patchUpdates(_0x56e06a){return function(_0x383f60){try{jsonpatch[_0xf4fa('0x25')](_0x383f60,_0x56e06a,!![]);}catch(_0x330239){return BPromise[_0xf4fa('0x26')](_0x330239);}return _0x383f60[_0xf4fa('0x27')]();};}function saveUpdates(_0x12ae1c,_0x161eca){return function(_0x50bc8b){if(_0x50bc8b){return _0x50bc8b['update'](_0x12ae1c)[_0xf4fa('0x28')](function(_0x518b64){return _0x518b64;});}return null;};}function removeEntity(_0x536532,_0x5d35f5){return function(_0x3d044d){if(_0x3d044d){return _0x3d044d['destroy']()['then'](function(){var _0x397a33=_0x3d044d[_0xf4fa('0x29')]({'plain':!![]});var _0x4c0c63='Lists';return db[_0xf4fa('0x2a')][_0xf4fa('0x2b')]({'where':{'type':_0x4c0c63,'resourceId':_0x397a33['id']}})[_0xf4fa('0x28')](function(){return _0x3d044d;});})[_0xf4fa('0x28')](function(){_0x536532[_0xf4fa('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ff5e6,_0x3909ab){return function(_0x56467f){if(!_0x56467f){_0x4ff5e6[_0xf4fa('0x2c')](0x194);}return _0x56467f;};}function handleError(_0x4b20b0,_0x17d20a){_0x17d20a=_0x17d20a||0x1f4;return function(_0x2148a7){logger[_0xf4fa('0x2d')](_0x2148a7['stack']);if(_0x2148a7[_0xf4fa('0x2e')]){delete _0x2148a7['name'];}_0x4b20b0[_0xf4fa('0x1e')](_0x17d20a)[_0xf4fa('0x2f')](_0x2148a7);};}exports[_0xf4fa('0x30')]=function(_0x57d306,_0x2a93a1){var _0x24f69a={},_0x3fc9ba={},_0x5245ed={'count':0x0,'rows':[]};var _0x563ec3=_['map'](db[_0xf4fa('0x31')][_0xf4fa('0x32')],function(_0x37d277){return{'name':_0x37d277[_0xf4fa('0x33')],'type':_0x37d277[_0xf4fa('0x34')][_0xf4fa('0x35')]};});_0x3fc9ba[_0xf4fa('0x36')]=_[_0xf4fa('0x37')](_0x563ec3,_0xf4fa('0x2e'));_0x3fc9ba[_0xf4fa('0x38')]=_[_0xf4fa('0x39')](_0x57d306[_0xf4fa('0x38')]);_0x3fc9ba[_0xf4fa('0x3a')]=_['intersection'](_0x3fc9ba[_0xf4fa('0x36')],_0x3fc9ba[_0xf4fa('0x38')]);_0x24f69a[_0xf4fa('0x3b')]=_[_0xf4fa('0x3c')](_0x3fc9ba['model'],qs[_0xf4fa('0x3d')](_0x57d306[_0xf4fa('0x38')][_0xf4fa('0x3d')]));_0x24f69a['attributes']=_0x24f69a[_0xf4fa('0x3b')]['length']?_0x24f69a[_0xf4fa('0x3b')]:_0x3fc9ba['model'];if(!_0x57d306[_0xf4fa('0x38')][_0xf4fa('0x3e')](_0xf4fa('0x3f'))){_0x24f69a[_0xf4fa('0x22')]=qs[_0xf4fa('0x22')](_0x57d306[_0xf4fa('0x38')][_0xf4fa('0x22')]);_0x24f69a[_0xf4fa('0x20')]=qs['offset'](_0x57d306['query'][_0xf4fa('0x20')]);}_0x24f69a[_0xf4fa('0x40')]=qs[_0xf4fa('0x41')](_0x57d306[_0xf4fa('0x38')][_0xf4fa('0x41')]);_0x24f69a['where']=qs[_0xf4fa('0x3a')](_[_0xf4fa('0x42')](_0x57d306[_0xf4fa('0x38')],_0x3fc9ba[_0xf4fa('0x3a')]),_0x563ec3);if(_0x57d306[_0xf4fa('0x38')][_0xf4fa('0x43')]){_0x24f69a[_0xf4fa('0x44')]=_[_0xf4fa('0x45')](_0x24f69a[_0xf4fa('0x44')],{'$or':_[_0xf4fa('0x37')](_0x563ec3,function(_0x29739e){if(_0x29739e['type']!==_0xf4fa('0x46')){var _0x12d55d={};_0x12d55d[_0x29739e['name']]={'$like':'%'+_0x57d306['query'][_0xf4fa('0x43')]+'%'};return _0x12d55d;}})});}_0x24f69a=_[_0xf4fa('0x45')]({},_0x24f69a,_0x57d306[_0xf4fa('0x47')]);var _0x1e109d={'where':_0x24f69a[_0xf4fa('0x44')]};return db[_0xf4fa('0x31')][_0xf4fa('0x23')](_0x1e109d)[_0xf4fa('0x28')](function(_0x4c8a05){_0x5245ed[_0xf4fa('0x23')]=_0x4c8a05;if(_0x57d306['query']['includeAll']){_0x24f69a[_0xf4fa('0x48')]=[{'all':!![]}];}return db[_0xf4fa('0x31')][_0xf4fa('0x49')](_0x24f69a);})[_0xf4fa('0x28')](function(_0xb99bcf){_0x5245ed[_0xf4fa('0x4a')]=_0xb99bcf;return _0x5245ed;})[_0xf4fa('0x28')](respondWithFilteredResult(_0x2a93a1,_0x24f69a))[_0xf4fa('0x4b')](handleError(_0x2a93a1,null));};exports['show']=function(_0x3dfc29,_0x23530a){var _0x5328ce={'raw':![],'where':{'id':_0x3dfc29[_0xf4fa('0x4c')]['id']}},_0x1768c2={};_0x1768c2[_0xf4fa('0x36')]=_[_0xf4fa('0x39')](db[_0xf4fa('0x31')]['rawAttributes']);_0x1768c2[_0xf4fa('0x38')]=_['keys'](_0x3dfc29[_0xf4fa('0x38')]);_0x1768c2[_0xf4fa('0x3a')]=_[_0xf4fa('0x3c')](_0x1768c2[_0xf4fa('0x36')],_0x1768c2[_0xf4fa('0x38')]);_0x5328ce[_0xf4fa('0x3b')]=_['intersection'](_0x1768c2['model'],qs[_0xf4fa('0x3d')](_0x3dfc29[_0xf4fa('0x38')][_0xf4fa('0x3d')]));_0x5328ce[_0xf4fa('0x3b')]=_0x5328ce[_0xf4fa('0x3b')][_0xf4fa('0x4d')]?_0x5328ce[_0xf4fa('0x3b')]:_0x1768c2['model'];if(_0x3dfc29[_0xf4fa('0x38')]['includeAll']){_0x5328ce['include']=[{'all':!![]}];}_0x5328ce=_[_0xf4fa('0x45')]({},_0x5328ce,_0x3dfc29[_0xf4fa('0x47')]);return db['CmList'][_0xf4fa('0x4e')](_0x5328ce)[_0xf4fa('0x28')](handleEntityNotFound(_0x23530a,null))[_0xf4fa('0x28')](respondWithResult(_0x23530a,null))[_0xf4fa('0x4b')](handleError(_0x23530a,null));};exports['create']=function(_0x2982b8,_0x21c072){return db[_0xf4fa('0x31')][_0xf4fa('0x4f')](_0x2982b8['body'],{})[_0xf4fa('0x28')](function(_0x4e5621){var _0x56e4cf=_0x2982b8[_0xf4fa('0x50')]['get']({'plain':!![]});if(!_0x56e4cf)throw new Error(_0xf4fa('0x51'));if(_0x56e4cf['role']===_0xf4fa('0x50')){var _0x13479a=_0x4e5621[_0xf4fa('0x29')]({'plain':!![]});var _0x5b7d7d=_0xf4fa('0x52');return db['UserProfileSection'][_0xf4fa('0x4e')]({'where':{'name':_0x5b7d7d,'userProfileId':_0x56e4cf[_0xf4fa('0x53')]},'raw':!![]})['then'](function(_0x7fe964){if(_0x7fe964&&_0x7fe964[_0xf4fa('0x54')]===0x0){return db['UserProfileResource'][_0xf4fa('0x4f')]({'name':_0x13479a[_0xf4fa('0x2e')],'resourceId':_0x13479a['id'],'type':_0x7fe964[_0xf4fa('0x2e')],'sectionId':_0x7fe964['id']},{})[_0xf4fa('0x28')](function(){return _0x4e5621;});}else{return _0x4e5621;}})[_0xf4fa('0x4b')](function(_0x59f6f){logger[_0xf4fa('0x2d')](_0xf4fa('0x55'),_0x59f6f);throw _0x59f6f;});}return _0x4e5621;})['then'](respondWithResult(_0x21c072,0xc9))[_0xf4fa('0x4b')](handleError(_0x21c072,null));};exports[_0xf4fa('0x56')]=function(_0x157507,_0x556d9b){if(_0x157507['body']['id']){delete _0x157507[_0xf4fa('0x57')]['id'];}return db[_0xf4fa('0x31')][_0xf4fa('0x4e')]({'where':{'id':_0x157507[_0xf4fa('0x4c')]['id']}})[_0xf4fa('0x28')](handleEntityNotFound(_0x556d9b,null))[_0xf4fa('0x28')](saveUpdates(_0x157507[_0xf4fa('0x57')],null))[_0xf4fa('0x28')](respondWithResult(_0x556d9b,null))[_0xf4fa('0x4b')](handleError(_0x556d9b,null));};exports[_0xf4fa('0x2b')]=function(_0x1e5786,_0x4877ec){return db[_0xf4fa('0x31')][_0xf4fa('0x4e')]({'where':{'id':_0x1e5786[_0xf4fa('0x4c')]['id']}})[_0xf4fa('0x28')](handleEntityNotFound(_0x4877ec,null))[_0xf4fa('0x28')](removeEntity(_0x4877ec,null))['catch'](handleError(_0x4877ec,null));};exports[_0xf4fa('0x58')]=function(_0x4649a2,_0x33a6f3){return db[_0xf4fa('0x31')]['describe']()[_0xf4fa('0x28')](respondWithResult(_0x33a6f3,null))[_0xf4fa('0x4b')](handleError(_0x33a6f3,null));};exports[_0xf4fa('0x59')]=function(_0x312898,_0x59140a,_0x4d08aa){if(_0x312898[_0xf4fa('0x57')]['id']){delete _0x312898[_0xf4fa('0x57')]['id'];}return db['CmList'][_0xf4fa('0x4e')]({'where':{'id':_0x312898[_0xf4fa('0x4c')]['id']}})[_0xf4fa('0x28')](handleEntityNotFound(_0x59140a,null))[_0xf4fa('0x28')](function(_0x335e5b){if(_0x335e5b){_0x312898[_0xf4fa('0x57')][_0xf4fa('0x5a')]=_0x335e5b['id'];return db['Disposition'][_0xf4fa('0x4f')](_0x312898[_0xf4fa('0x57')]);}})[_0xf4fa('0x28')](respondWithResult(_0x59140a,null))[_0xf4fa('0x4b')](handleError(_0x59140a,null));};exports['getDispositions']=function(_0x5d4556,_0x46d952,_0x4da9eb){var _0x39921f={'raw':![],'where':{}};var _0x16c7f6={};var _0x2ad560={'count':0x0,'rows':[]};return db['CmList']['findOne']({'where':{'id':_0x5d4556[_0xf4fa('0x4c')]['id']}})[_0xf4fa('0x28')](handleEntityNotFound(_0x46d952,null))['then'](function(_0x19d3a8){if(_0x19d3a8){_0x16c7f6[_0xf4fa('0x36')]=_[_0xf4fa('0x39')](db[_0xf4fa('0x5b')][_0xf4fa('0x32')]);_0x16c7f6[_0xf4fa('0x38')]=_[_0xf4fa('0x39')](_0x5d4556[_0xf4fa('0x38')]);_0x16c7f6[_0xf4fa('0x3a')]=_[_0xf4fa('0x3c')](_0x16c7f6[_0xf4fa('0x36')],_0x16c7f6[_0xf4fa('0x38')]);_0x39921f[_0xf4fa('0x3b')]=_[_0xf4fa('0x3c')](_0x16c7f6[_0xf4fa('0x36')],qs['fields'](_0x5d4556[_0xf4fa('0x38')][_0xf4fa('0x3d')]));_0x39921f['attributes']=_0x39921f[_0xf4fa('0x3b')][_0xf4fa('0x4d')]?_0x39921f['attributes']:_0x16c7f6[_0xf4fa('0x36')];if(!_0x5d4556['query'][_0xf4fa('0x3e')]('nolimit')){_0x39921f[_0xf4fa('0x22')]=qs[_0xf4fa('0x22')](_0x5d4556[_0xf4fa('0x38')][_0xf4fa('0x22')]);_0x39921f[_0xf4fa('0x20')]=qs['offset'](_0x5d4556[_0xf4fa('0x38')][_0xf4fa('0x20')]);}_0x39921f['order']=qs['sort'](_0x5d4556[_0xf4fa('0x38')][_0xf4fa('0x41')]);_0x39921f[_0xf4fa('0x44')]=qs[_0xf4fa('0x3a')](_[_0xf4fa('0x42')](_0x5d4556[_0xf4fa('0x38')],_0x16c7f6['filters']));_0x39921f[_0xf4fa('0x44')][_0xf4fa('0x5a')]=_0x19d3a8['id'];if(_0x5d4556[_0xf4fa('0x38')][_0xf4fa('0x43')]){_0x39921f[_0xf4fa('0x44')]=_[_0xf4fa('0x45')](_0x39921f[_0xf4fa('0x44')],{'$or':_[_0xf4fa('0x37')](_0x39921f['attributes'],function(_0x19cd68){var _0x44f675={};_0x44f675[_0x19cd68]={'$like':'%'+_0x5d4556[_0xf4fa('0x38')][_0xf4fa('0x43')]+'%'};return _0x44f675;})});}_0x39921f=_[_0xf4fa('0x45')]({},_0x39921f,_0x5d4556['options']);return db['Disposition'][_0xf4fa('0x23')]({'where':_0x39921f[_0xf4fa('0x44')]})[_0xf4fa('0x28')](function(_0x9c6a89){_0x2ad560[_0xf4fa('0x23')]=_0x9c6a89;if(_0x5d4556['query'][_0xf4fa('0x5c')]){_0x39921f[_0xf4fa('0x48')]=[{'all':!![]}];}return db[_0xf4fa('0x5b')][_0xf4fa('0x49')](_0x39921f);})[_0xf4fa('0x28')](function(_0x51940f){_0x2ad560[_0xf4fa('0x4a')]=_0x51940f;return _0x2ad560;});}})[_0xf4fa('0x28')](respondWithFilteredResult(_0x46d952,_0x39921f))[_0xf4fa('0x4b')](handleError(_0x46d952,null));};exports[_0xf4fa('0x5d')]=function(_0x47530f,_0x361fca,_0x2c92cd){return db[_0xf4fa('0x31')][_0xf4fa('0x4e')]({'where':{'id':_0x47530f['params']['id']}})[_0xf4fa('0x28')](handleEntityNotFound(_0x361fca,null))[_0xf4fa('0x28')](function(_0x331b09){if(_0x331b09){return _0x331b09[_0xf4fa('0x5d')](_0x47530f['query'][_0xf4fa('0x5e')]);}})['then'](respondWithStatusCode(_0x361fca,null))[_0xf4fa('0x4b')](handleError(_0x361fca,null));};exports[_0xf4fa('0x5f')]=function(_0x22c52c,_0x27aea0,_0x17aaed){return db[_0xf4fa('0x31')][_0xf4fa('0x4e')]({'where':{'id':_0x22c52c[_0xf4fa('0x4c')]['id']}})[_0xf4fa('0x28')](handleEntityNotFound(_0x27aea0,null))['then'](function(_0x44f098){if(_0x44f098){var _0x2477bc=[];var _0x1bc921={'success':[],'errors':[]};return db['CmContact'][_0xf4fa('0x58')]()[_0xf4fa('0x28')](function(_0x516bce){if(_0x22c52c[_0xf4fa('0x57')][_0xf4fa('0x60')]&&_[_0xf4fa('0x61')](_0x22c52c[_0xf4fa('0x57')]['tags'])){if(_0x22c52c[_0xf4fa('0x57')]['tags']['length']){_0x22c52c[_0xf4fa('0x57')][_0xf4fa('0x60')]=_0x22c52c[_0xf4fa('0x57')]['tags'][_0xf4fa('0x62')](';')+';';}else{_0x22c52c[_0xf4fa('0x57')]['tags']=null;}}else{_0x22c52c[_0xf4fa('0x57')][_0xf4fa('0x60')]=null;}if(_0x22c52c[_0xf4fa('0x57')]&&_[_0xf4fa('0x61')](_0x22c52c[_0xf4fa('0x57')])){for(var _0x3536c6=0x0;_0x3536c6<_0x22c52c[_0xf4fa('0x57')][_0xf4fa('0x4d')];_0x3536c6+=0x1){_0x22c52c[_0xf4fa('0x57')][_0x3536c6][_0xf4fa('0x5a')]=_0x22c52c[_0xf4fa('0x4c')]['id'];_0x2477bc[_0xf4fa('0x63')](_0x22c52c['body'][_0x3536c6]);}return BPromise['each'](_0x2477bc,function(_0xcbb34c){return db[_0xf4fa('0x64')][_0xf4fa('0x4f')](_[_0xf4fa('0x65')](_0xcbb34c,['ids','id'])||{},{'fields':_[_0xf4fa('0x39')](_0x516bce),'raw':!![]})[_0xf4fa('0x28')](function(_0x58e8c2){_0x1bc921[_0xf4fa('0x66')][_0xf4fa('0x63')](_0x58e8c2['dataValues']);})[_0xf4fa('0x4b')](function(_0x559b06){_0x1bc921[_0xf4fa('0x67')][_0xf4fa('0x63')]({'data':_0xcbb34c,'error':_0x559b06[_0xf4fa('0x68')]});});})['then'](function(_0x13a7c8){return _0x1bc921;})[_0xf4fa('0x4b')](function(_0x2290ca){return _0x2290ca;});}else{_0x27aea0[_0xf4fa('0x1e')](0x190)['json']({'message':_0xf4fa('0x69')});}});}})[_0xf4fa('0x28')](respondWithResult(_0x27aea0,null))[_0xf4fa('0x4b')](handleError(_0x27aea0,null));};exports['getContacts']=function(_0x307100,_0x2cc50b,_0x94b302){var _0x1570ce;return db[_0xf4fa('0x31')][_0xf4fa('0x4e')]({'where':{'id':_0x307100['params']['id']},'include':[{'model':db[_0xf4fa('0x6a')],'as':_0xf4fa('0x6b')}]})[_0xf4fa('0x28')](handleEntityNotFound(_0x2cc50b,null))[_0xf4fa('0x28')](function(_0x2034a8){if(_0x2034a8){_0x1570ce=_0x2034a8;return db[_0xf4fa('0x64')][_0xf4fa('0x32')];}})[_0xf4fa('0x28')](function(_0x45959f){if(_0x45959f){var _0x1308fb={};var _0x2f1c9e={};_0x2f1c9e[_0xf4fa('0x36')]=_['concat'](_[_0xf4fa('0x39')](_0x45959f),_[_0xf4fa('0x37')](_0x1570ce[_0xf4fa('0x6b')],function(_0x228e4c){return util['format'](_0xf4fa('0x6c'),_0x228e4c['id']);}));_0x2f1c9e[_0xf4fa('0x38')]=_[_0xf4fa('0x39')](_0x307100['query']);_0x2f1c9e[_0xf4fa('0x3a')]=_[_0xf4fa('0x3c')](_0x2f1c9e['model'],_0x2f1c9e[_0xf4fa('0x38')]);_0x1308fb[_0xf4fa('0x3b')]=_['intersection'](_0x2f1c9e[_0xf4fa('0x36')],qs[_0xf4fa('0x3d')](_0x307100['query'][_0xf4fa('0x3d')]));_0x1308fb['attributes']=_0x1308fb[_0xf4fa('0x3b')][_0xf4fa('0x4d')]?_0x1308fb[_0xf4fa('0x3b')]:_0x2f1c9e[_0xf4fa('0x36')];if(!_0x307100['query'][_0xf4fa('0x3e')]('nolimit')){_0x1308fb[_0xf4fa('0x22')]=qs[_0xf4fa('0x22')](_0x307100['query'][_0xf4fa('0x22')]);_0x1308fb['offset']=qs[_0xf4fa('0x20')](_0x307100[_0xf4fa('0x38')][_0xf4fa('0x20')]);}_0x1308fb['order']=qs[_0xf4fa('0x41')](_0x307100['query'][_0xf4fa('0x41')]);_0x1308fb[_0xf4fa('0x44')]=qs[_0xf4fa('0x3a')](_[_0xf4fa('0x42')](_0x307100[_0xf4fa('0x38')],_0x2f1c9e[_0xf4fa('0x3a')]));_0x1308fb['raw']=!![];if(_0x307100[_0xf4fa('0x38')]['filter']){_0x1308fb[_0xf4fa('0x44')]=_['merge'](_0x1308fb[_0xf4fa('0x44')],{'$or':_[_0xf4fa('0x37')](_0x1308fb[_0xf4fa('0x3b')],function(_0x33ee27){var _0x5d4416={};_0x5d4416[_0x33ee27]={'$like':'%'+_0x307100[_0xf4fa('0x38')]['filter']+'%'};return _0x5d4416;})});}_0x1308fb=_[_0xf4fa('0x45')]({},_0x1308fb,_0x307100[_0xf4fa('0x47')]);return _0x1570ce[_0xf4fa('0x6d')](_0x1308fb);}})[_0xf4fa('0x28')](respondWithResult(_0x2cc50b,null))[_0xf4fa('0x4b')](handleError(_0x2cc50b,null));};exports[_0xf4fa('0x6e')]=function(_0x537e3a,_0x504891,_0xe170d0){var _0x28d11e;var _0x1b49eb;var _0x42fe00;var _0x47b8bf=_0x537e3a[_0xf4fa('0x4c')]['id'];csv_results=[];return db[_0xf4fa('0x6f')]['findAll']({'attributes':['id',_0xf4fa('0x2e')],'raw':!![],'order':[_0xf4fa('0x70')]})[_0xf4fa('0x28')](function(_0x2c8a9b){_0x28d11e=_0x2c8a9b;var _0x5604b3=_[_0xf4fa('0x39')](db[_0xf4fa('0x64')][_0xf4fa('0x32')]);return db[_0xf4fa('0x6a')][_0xf4fa('0x49')]({'raw':!![],'attributes':['id',_0xf4fa('0x71')]})[_0xf4fa('0x28')](function(_0x202edb){_0x1b49eb=_0x202edb;var _0xcdfdb3=squel[_0xf4fa('0x72')]()[_0xf4fa('0x3d')](_0x5604b3)['from']('cm_contacts','c')[_0xf4fa('0x44')]('c.ListId\x20=\x20?',_0x47b8bf)[_0xf4fa('0x44')]('c.deletedAt\x20is\x20null')[_0xf4fa('0x73')]();for(var _0x219e41=0x0;_0x219e41<_0x1b49eb['length'];_0x219e41++){_0xcdfdb3[_0xf4fa('0x74')](_0xf4fa('0x75')+_0x1b49eb[_0x219e41]['id'],_0xf4fa('0x76')+_0x1b49eb[_0x219e41][_0xf4fa('0x71')]);}for(var _0x219e41=0x0;_0x219e41<_0x28d11e['length'];_0x219e41++){_0xcdfdb3['field'](squel[_0xf4fa('0x72')]()[_0xf4fa('0x74')](_0xf4fa('0x77'))[_0xf4fa('0x78')](_0xf4fa('0x79'))['where'](_0xf4fa('0x7a'),_0x28d11e[_0x219e41]['id'])[_0xf4fa('0x44')](_0xf4fa('0x7b')),'additionalPhone_'+_0x28d11e[_0x219e41][_0xf4fa('0x2e')]);_0xcdfdb3['field'](squel[_0xf4fa('0x72')]()[_0xf4fa('0x74')](_0xf4fa('0x7c'))[_0xf4fa('0x78')]('cm_contact_has_items')[_0xf4fa('0x44')](_0xf4fa('0x7a'),_0x28d11e[_0x219e41]['id'])[_0xf4fa('0x44')](_0xf4fa('0x7b')),'description_additionalPhone_'+_0x28d11e[_0x219e41][_0xf4fa('0x2e')]);}var _0x42a526=[];_0x42a526[_0xf4fa('0x63')](_0xcdfdb3[_0xf4fa('0x7d')]());BPromise[_0xf4fa('0x7e')](_0x42a526,handleQuery)['then'](function(_0x906175){handleQuery(_0xcdfdb3[_0xf4fa('0x7d')]());var _0x14f78e=csv_results[0x0];if(!_[_0xf4fa('0x7f')](_0x14f78e)){var _0x1d0e39=toCsv(_0x14f78e);var _0x15a0b8=Date[_0xf4fa('0x80')]();fs['writeFileSync'](util[_0xf4fa('0x81')](_0xf4fa('0x82'),_0x47b8bf,_0x15a0b8),_0x1d0e39);_0x504891[_0xf4fa('0x83')]('Content-disposition',_0xf4fa('0x84')+util[_0xf4fa('0x81')]('list_%d_%s.csv',_0x47b8bf,_0x15a0b8));_0x504891['setHeader'](_0xf4fa('0x85'),'text/csv');return _0x504891[_0xf4fa('0x86')](util[_0xf4fa('0x81')](_0xf4fa('0x82'),_0x47b8bf,_0x15a0b8));}else{return _0x504891[_0xf4fa('0x2c')](0xcc);}});});});};exports['addCustomField']=function(_0x4d47c4,_0x232581,_0x3ffffa){var _0x5bd902;delete _0x4d47c4[_0xf4fa('0x57')]['id'];return db[_0xf4fa('0x31')]['findOne']({'where':{'id':_0x4d47c4[_0xf4fa('0x4c')]['id']}})[_0xf4fa('0x28')](handleEntityNotFound(_0x232581,null))['then'](function(_0xcd5f0a){if(_0xcd5f0a){return db['sequelize'][_0xf4fa('0x87')](function(_0x15458e){return db[_0xf4fa('0x6a')][_0xf4fa('0x4f')](_0x4d47c4[_0xf4fa('0x57')],{'transaction':_0x15458e})['then'](function(_0x6fc887){_0x5bd902=_0x6fc887;return _0xcd5f0a[_0xf4fa('0x88')](_0x6fc887,{'transaction':_0x15458e});})[_0xf4fa('0x28')](function(){var _0x4e548a={'type':db[_0xf4fa('0x89')][_0xf4fa('0x8a')],'transaction':_0x15458e};switch(_0x4d47c4[_0xf4fa('0x57')][_0xf4fa('0x34')]){case _0xf4fa('0x8b'):_0x4e548a['type']=db[_0xf4fa('0x89')][_0xf4fa('0x8a')];break;case _0xf4fa('0x8c'):_0x4e548a[_0xf4fa('0x34')]=db[_0xf4fa('0x89')][_0xf4fa('0x8d')];break;case _0xf4fa('0x8e'):_0x4e548a[_0xf4fa('0x34')]=db['Sequelize'][_0xf4fa('0x8f')];_0x4e548a['defaultValue']=![];break;default:}return db['sequelize']['queryInterface']['addColumn'](_0xf4fa('0x90'),util[_0xf4fa('0x81')](_0xf4fa('0x91'),_0x5bd902['id']),_0x4e548a);})[_0xf4fa('0x28')](function(){return _0x5bd902;});});}})[_0xf4fa('0x28')](respondWithResult(_0x232581,null))['catch'](handleError(_0x232581,null));};exports['getCustomFields']=function(_0x4fe61b,_0x5d38ed,_0x1cabc2){var _0x2da7fc={};var _0x236a88={};var _0x4bf814;var _0x37cceb;return db[_0xf4fa('0x31')]['findOne']({'where':{'id':_0x4fe61b[_0xf4fa('0x4c')]['id']}})[_0xf4fa('0x28')](handleEntityNotFound(_0x5d38ed,null))[_0xf4fa('0x28')](function(_0x1d1051){if(_0x1d1051){_0x4bf814=_0x1d1051;_0x236a88[_0xf4fa('0x36')]=_['keys'](db[_0xf4fa('0x6a')][_0xf4fa('0x32')]);_0x236a88['query']=_[_0xf4fa('0x39')](_0x4fe61b[_0xf4fa('0x38')]);_0x236a88[_0xf4fa('0x3a')]=_['intersection'](_0x236a88[_0xf4fa('0x36')],_0x236a88[_0xf4fa('0x38')]);_0x2da7fc[_0xf4fa('0x3b')]=_[_0xf4fa('0x3c')](_0x236a88[_0xf4fa('0x36')],qs[_0xf4fa('0x3d')](_0x4fe61b[_0xf4fa('0x38')][_0xf4fa('0x3d')]));_0x2da7fc[_0xf4fa('0x3b')]=_0x2da7fc[_0xf4fa('0x3b')][_0xf4fa('0x4d')]?_0x2da7fc[_0xf4fa('0x3b')]:_0x236a88['model'];_0x2da7fc[_0xf4fa('0x40')]=qs[_0xf4fa('0x41')](_0x4fe61b[_0xf4fa('0x38')]['sort']);_0x2da7fc[_0xf4fa('0x44')]=qs[_0xf4fa('0x3a')](_[_0xf4fa('0x42')](_0x4fe61b[_0xf4fa('0x38')],_0x236a88['filters']));_0x2da7fc['where']=_['merge'](_0x2da7fc['where'],{'$or':[{'ListId':_0x1d1051['id']},{'ListId':null}]});if(_0x4fe61b[_0xf4fa('0x38')][_0xf4fa('0x43')]){_0x2da7fc[_0xf4fa('0x44')]=_[_0xf4fa('0x45')](_0x2da7fc[_0xf4fa('0x44')],{'$or':_[_0xf4fa('0x37')](_0x2da7fc[_0xf4fa('0x3b')],function(_0x56e175){var _0x40ac93={};_0x40ac93[_0x56e175]={'$like':'%'+_0x4fe61b['query'][_0xf4fa('0x43')]+'%'};return _0x40ac93;})});}_0x2da7fc=_[_0xf4fa('0x45')]({},_0x2da7fc,_0x4fe61b[_0xf4fa('0x47')]);return db['CmCustomField'][_0xf4fa('0x92')](_0x2da7fc);}})[_0xf4fa('0x28')](respondWithResult(_0x5d38ed,null))[_0xf4fa('0x4b')](handleError(_0x5d38ed,null));};exports['getGlobalCustomFields']=function(_0x525017,_0x48aff1){return db[_0xf4fa('0x6a')][_0xf4fa('0x92')]({'where':{'ListId':null}})['then'](handleEntityNotFound(_0x48aff1,null))['then'](function(_0x550376){return _0x550376;})[_0xf4fa('0x28')](respondWithResult(_0x48aff1,null))[_0xf4fa('0x4b')](handleError(_0x48aff1,null));};exports[_0xf4fa('0x93')]=function(_0x3b87e6,_0x4292b7,_0x30183e){return db[_0xf4fa('0x31')][_0xf4fa('0x4e')]({'where':{'id':_0x3b87e6['params']['id']}})[_0xf4fa('0x28')](handleEntityNotFound(_0x4292b7,null))[_0xf4fa('0x28')](function(_0x1e2bce){if(_0x1e2bce){return _0x1e2bce['addAgents'](_0x3b87e6[_0xf4fa('0x57')]['ids'],_[_0xf4fa('0x65')](_0x3b87e6[_0xf4fa('0x57')],[_0xf4fa('0x5e'),'id'])||{})[_0xf4fa('0x94')](function(_0xc0ac55){for(var _0x450e49=0x0;_0x450e49<_0x3b87e6[_0xf4fa('0x57')]['ids']['length'];_0x450e49+=0x1){socket[_0xf4fa('0x95')](_0xf4fa('0x96'),{'UserId':Number(_0x3b87e6[_0xf4fa('0x57')][_0xf4fa('0x5e')][_0x450e49]),'CmListId':Number(_0x3b87e6[_0xf4fa('0x4c')]['id'])});}return _0xc0ac55;});}})[_0xf4fa('0x28')](respondWithResult(_0x4292b7,null))[_0xf4fa('0x4b')](handleError(_0x4292b7,null));};exports['removeAgents']=function(_0x56f770,_0x17c241,_0x5ed3f9){return db['CmList'][_0xf4fa('0x4e')]({'where':{'id':_0x56f770[_0xf4fa('0x4c')]['id']}})['then'](handleEntityNotFound(_0x17c241,null))[_0xf4fa('0x28')](function(_0x54bb05){if(_0x54bb05){return _0x54bb05[_0xf4fa('0x97')](_0x56f770['query'][_0xf4fa('0x5e')])['then'](function(){if(_['isArray'](_0x56f770[_0xf4fa('0x38')]['ids'])){for(var _0x1e830d=0x0;_0x1e830d<_0x56f770[_0xf4fa('0x38')]['ids'][_0xf4fa('0x4d')];_0x1e830d+=0x1){socket['emit']('userCmList:remove',{'UserId':Number(_0x56f770['query'][_0xf4fa('0x5e')][_0x1e830d]),'CmListId':Number(_0x56f770[_0xf4fa('0x4c')]['id'])});}}else{socket['emit'](_0xf4fa('0x98'),{'UserId':Number(_0x56f770[_0xf4fa('0x38')][_0xf4fa('0x5e')]),'CmListId':Number(_0x56f770[_0xf4fa('0x4c')]['id'])});}});}})['then'](respondWithStatusCode(_0x17c241,null))[_0xf4fa('0x4b')](handleError(_0x17c241,null));};exports[_0xf4fa('0x99')]=function(_0x441e9f,_0x43a6ee,_0xb124fc){var _0x211b1b={};var _0x3c9df7={};var _0x5cd209;var _0x2465cc;return db[_0xf4fa('0x31')]['findOne']({'where':{'id':_0x441e9f[_0xf4fa('0x4c')]['id']}})[_0xf4fa('0x28')](handleEntityNotFound(_0x43a6ee,null))[_0xf4fa('0x28')](function(_0x2d46d0){if(_0x2d46d0){_0x5cd209=_0x2d46d0;_0x3c9df7[_0xf4fa('0x36')]=_[_0xf4fa('0x39')](db[_0xf4fa('0x9a')]['rawAttributes']);_0x3c9df7[_0xf4fa('0x38')]=_['keys'](_0x441e9f['query']);_0x3c9df7[_0xf4fa('0x3a')]=_[_0xf4fa('0x3c')](_0x3c9df7['model'],_0x3c9df7[_0xf4fa('0x38')]);_0x211b1b[_0xf4fa('0x3b')]=_[_0xf4fa('0x3c')](_0x3c9df7[_0xf4fa('0x36')],qs[_0xf4fa('0x3d')](_0x441e9f[_0xf4fa('0x38')][_0xf4fa('0x3d')]));_0x211b1b['attributes']=_0x211b1b[_0xf4fa('0x3b')][_0xf4fa('0x4d')]?_0x211b1b[_0xf4fa('0x3b')]:_0x3c9df7[_0xf4fa('0x36')];_0x211b1b['order']=qs[_0xf4fa('0x41')](_0x441e9f[_0xf4fa('0x38')][_0xf4fa('0x41')]);_0x211b1b[_0xf4fa('0x44')]=qs[_0xf4fa('0x3a')](_[_0xf4fa('0x42')](_0x441e9f[_0xf4fa('0x38')],_0x3c9df7['filters']));if(_0x441e9f[_0xf4fa('0x38')][_0xf4fa('0x43')]){_0x211b1b[_0xf4fa('0x44')]=_[_0xf4fa('0x45')](_0x211b1b[_0xf4fa('0x44')],{'$or':_[_0xf4fa('0x37')](_0x211b1b[_0xf4fa('0x3b')],function(_0x4b7e2f){var _0x1bf1ee={};_0x1bf1ee[_0x4b7e2f]={'$like':'%'+_0x441e9f['query'][_0xf4fa('0x43')]+'%'};return _0x1bf1ee;})});}_0x211b1b=_[_0xf4fa('0x45')]({},_0x211b1b,_0x441e9f[_0xf4fa('0x47')]);return _0x5cd209[_0xf4fa('0x99')](_0x211b1b);}})[_0xf4fa('0x28')](function(_0x2b22f2){if(_0x2b22f2){_0x2465cc=_0x2b22f2[_0xf4fa('0x4d')];if(!_0x441e9f['query']['hasOwnProperty'](_0xf4fa('0x3f'))){_0x211b1b[_0xf4fa('0x22')]=qs[_0xf4fa('0x22')](_0x441e9f['query'][_0xf4fa('0x22')]);_0x211b1b[_0xf4fa('0x20')]=qs['offset'](_0x441e9f['query'][_0xf4fa('0x20')]);}return _0x5cd209[_0xf4fa('0x99')](_0x211b1b);}})[_0xf4fa('0x28')](function(_0x33a5f9){if(_0x33a5f9){return _0x33a5f9?{'count':_0x2465cc,'rows':_0x33a5f9}:null;}})[_0xf4fa('0x28')](respondWithResult(_0x43a6ee,null))[_0xf4fa('0x4b')](handleError(_0x43a6ee,null));};function handleQuery(_0x2ae405){logger['info'](_0x2ae405);return db[_0xf4fa('0x9b')][_0xf4fa('0x38')](_0x2ae405)[_0xf4fa('0x94')](function(_0x35a7e0){csv_results['push'](_0x35a7e0);})[_0xf4fa('0x4b')](function(_0x4b34ec){logger[_0xf4fa('0x2d')](_0x4b34ec[_0xf4fa('0x68')]);});} \ No newline at end of file +var _0xd19c=['Content-disposition','attachment;\x20filename=','list_%d_%s.csv','text/csv','download','sequelize','transaction','CmCustomField','addCustomFields','Sequelize','TEXT','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','getCustomFields','findOne','addAgents','omit','spread','emit','userCmList:save','removeAgents','isArray','getAgents','User','info','message','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','Lists','end','name','index','map','CmList','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','findAll','rows','params','keys','catch','create','body','user','get','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','describe','addDisposition','ListId','Disposition','getDispositions','include','removeDispositions','ids','addContacts','CmContact','tags','join','push','each','success','dataValues','errors','Malformed\x20request\x20syntax','getContacts','concat','CustomFields','format','cf_%d','raw','getContactsCsv','ContactItemType','OrderBy','alias','select','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','field','customField_','item','from','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','description','toString','isEmpty','now','/tmp/list_%d_%s.csv','setHeader'];(function(_0x5185cf,_0x18e620){var _0x53a6b5=function(_0x414d58){while(--_0x414d58){_0x5185cf['push'](_0x5185cf['shift']());}};_0x53a6b5(++_0x18e620);}(_0xd19c,0xc3));var _0xcd19=function(_0x453e93,_0x19e75d){_0x453e93=_0x453e93-0x0;var _0x4d7e80=_0xd19c[_0x453e93];return _0x4d7e80;};'use strict';var emlformat=require(_0xcd19('0x0'));var rimraf=require(_0xcd19('0x1'));var zipdir=require(_0xcd19('0x2'));var jsonpatch=require(_0xcd19('0x3'));var rp=require(_0xcd19('0x4'));var moment=require(_0xcd19('0x5'));var BPromise=require(_0xcd19('0x6'));var Mustache=require(_0xcd19('0x7'));var util=require(_0xcd19('0x8'));var path=require(_0xcd19('0x9'));var sox=require(_0xcd19('0xa'));var csv=require(_0xcd19('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcd19('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xcd19('0xd'));var jsforce=require(_0xcd19('0xe'));var deskjs=require(_0xcd19('0xf'));var toCsv=require(_0xcd19('0xb'));var querystring=require(_0xcd19('0x10'));var Papa=require(_0xcd19('0x11'));var Redis=require(_0xcd19('0x12'));var authService=require(_0xcd19('0x13'));var qs=require(_0xcd19('0x14'));var as=require(_0xcd19('0x15'));var hardwareService=require(_0xcd19('0x16'));var logger=require(_0xcd19('0x17'))(_0xcd19('0x18'));var utils=require(_0xcd19('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xcd19('0x1a'))['db'];var csv_results;config[_0xcd19('0x1b')]=_[_0xcd19('0x1c')](config[_0xcd19('0x1b')],{'host':_0xcd19('0x1d'),'port':0x18eb});var socket=require(_0xcd19('0x1e'))(new Redis(config[_0xcd19('0x1b')]));require(_0xcd19('0x1f'))[_0xcd19('0x20')](socket);function respondWithStatusCode(_0x25db87,_0x2dc7a3){_0x2dc7a3=_0x2dc7a3||0xcc;return function(_0x37a760){if(_0x37a760){return _0x25db87[_0xcd19('0x21')](_0x2dc7a3);}return _0x25db87[_0xcd19('0x22')](_0x2dc7a3)['end']();};}function respondWithResult(_0x1f8b46,_0x2b4ba4){_0x2b4ba4=_0x2b4ba4||0xc8;return function(_0x25d11a){if(_0x25d11a){return _0x1f8b46['status'](_0x2b4ba4)[_0xcd19('0x23')](_0x25d11a);}};}function respondWithFilteredResult(_0x4bafe0,_0x4e4654){return function(_0xaa4042){if(_0xaa4042){var _0x3926d9=typeof _0x4e4654[_0xcd19('0x24')]===_0xcd19('0x25')&&typeof _0x4e4654[_0xcd19('0x26')]===_0xcd19('0x25');var _0x5dcb1c=_0xaa4042[_0xcd19('0x27')];var _0x48419f=_0x3926d9?0x0:_0x4e4654[_0xcd19('0x24')];var _0x4b47bd=_0x3926d9?_0xaa4042[_0xcd19('0x27')]:_0x4e4654[_0xcd19('0x24')]+_0x4e4654[_0xcd19('0x26')];var _0x58b857;if(_0x4b47bd>=_0x5dcb1c){_0x4b47bd=_0x5dcb1c;_0x58b857=0xc8;}else{_0x58b857=0xce;}_0x4bafe0['status'](_0x58b857);return _0x4bafe0[_0xcd19('0x28')](_0xcd19('0x29'),_0x48419f+'-'+_0x4b47bd+'/'+_0x5dcb1c)[_0xcd19('0x23')](_0xaa4042);}return null;};}function patchUpdates(_0x39c110){return function(_0x45f1ff){try{jsonpatch[_0xcd19('0x2a')](_0x45f1ff,_0x39c110,!![]);}catch(_0x5b2b22){return BPromise['reject'](_0x5b2b22);}return _0x45f1ff[_0xcd19('0x2b')]();};}function saveUpdates(_0x39ead3,_0x4f1bd9){return function(_0x505c8d){if(_0x505c8d){return _0x505c8d[_0xcd19('0x2c')](_0x39ead3)[_0xcd19('0x2d')](function(_0x3797cd){return _0x3797cd;});}return null;};}function removeEntity(_0x7d4349,_0x77206c){return function(_0x3759c8){if(_0x3759c8){return _0x3759c8[_0xcd19('0x2e')]()[_0xcd19('0x2d')](function(){var _0x2541e7=_0x3759c8['get']({'plain':!![]});var _0xc8add6=_0xcd19('0x2f');return db['UserProfileResource']['destroy']({'where':{'type':_0xc8add6,'resourceId':_0x2541e7['id']}})[_0xcd19('0x2d')](function(){return _0x3759c8;});})[_0xcd19('0x2d')](function(){_0x7d4349[_0xcd19('0x22')](0xcc)[_0xcd19('0x30')]();});}};}function handleEntityNotFound(_0x1e2ca4,_0x32cf37){return function(_0xe0240d){if(!_0xe0240d){_0x1e2ca4[_0xcd19('0x21')](0x194);}return _0xe0240d;};}function handleError(_0x323647,_0x36cbb7){_0x36cbb7=_0x36cbb7||0x1f4;return function(_0x17ca60){logger['error'](_0x17ca60['stack']);if(_0x17ca60[_0xcd19('0x31')]){delete _0x17ca60[_0xcd19('0x31')];}_0x323647[_0xcd19('0x22')](_0x36cbb7)['send'](_0x17ca60);};}exports[_0xcd19('0x32')]=function(_0x1eb22a,_0x152f5f){var _0x5607e0={},_0x26da9a={},_0x56343e={'count':0x0,'rows':[]};var _0x2f44c9=_[_0xcd19('0x33')](db[_0xcd19('0x34')][_0xcd19('0x35')],function(_0x1fa1ea){return{'name':_0x1fa1ea[_0xcd19('0x36')],'type':_0x1fa1ea[_0xcd19('0x37')]['key']};});_0x26da9a[_0xcd19('0x38')]=_[_0xcd19('0x33')](_0x2f44c9,_0xcd19('0x31'));_0x26da9a[_0xcd19('0x39')]=_['keys'](_0x1eb22a[_0xcd19('0x39')]);_0x26da9a[_0xcd19('0x3a')]=_[_0xcd19('0x3b')](_0x26da9a[_0xcd19('0x38')],_0x26da9a[_0xcd19('0x39')]);_0x5607e0['attributes']=_['intersection'](_0x26da9a[_0xcd19('0x38')],qs[_0xcd19('0x3c')](_0x1eb22a[_0xcd19('0x39')][_0xcd19('0x3c')]));_0x5607e0['attributes']=_0x5607e0[_0xcd19('0x3d')][_0xcd19('0x3e')]?_0x5607e0[_0xcd19('0x3d')]:_0x26da9a[_0xcd19('0x38')];if(!_0x1eb22a[_0xcd19('0x39')][_0xcd19('0x3f')](_0xcd19('0x40'))){_0x5607e0[_0xcd19('0x26')]=qs[_0xcd19('0x26')](_0x1eb22a[_0xcd19('0x39')][_0xcd19('0x26')]);_0x5607e0[_0xcd19('0x24')]=qs[_0xcd19('0x24')](_0x1eb22a[_0xcd19('0x39')][_0xcd19('0x24')]);}_0x5607e0[_0xcd19('0x41')]=qs['sort'](_0x1eb22a[_0xcd19('0x39')][_0xcd19('0x42')]);_0x5607e0['where']=qs[_0xcd19('0x3a')](_[_0xcd19('0x43')](_0x1eb22a[_0xcd19('0x39')],_0x26da9a[_0xcd19('0x3a')]),_0x2f44c9);if(_0x1eb22a[_0xcd19('0x39')][_0xcd19('0x44')]){_0x5607e0[_0xcd19('0x45')]=_['merge'](_0x5607e0[_0xcd19('0x45')],{'$or':_[_0xcd19('0x33')](_0x2f44c9,function(_0x436d43){if(_0x436d43[_0xcd19('0x37')]!=='VIRTUAL'){var _0x323587={};_0x323587[_0x436d43['name']]={'$like':'%'+_0x1eb22a['query'][_0xcd19('0x44')]+'%'};return _0x323587;}})});}_0x5607e0=_[_0xcd19('0x46')]({},_0x5607e0,_0x1eb22a[_0xcd19('0x47')]);var _0x52e2c8={'where':_0x5607e0[_0xcd19('0x45')]};return db[_0xcd19('0x34')]['count'](_0x52e2c8)[_0xcd19('0x2d')](function(_0x40c854){_0x56343e[_0xcd19('0x27')]=_0x40c854;if(_0x1eb22a[_0xcd19('0x39')][_0xcd19('0x48')]){_0x5607e0['include']=[{'all':!![]}];}return db['CmList'][_0xcd19('0x49')](_0x5607e0);})[_0xcd19('0x2d')](function(_0x5fd57e){_0x56343e[_0xcd19('0x4a')]=_0x5fd57e;return _0x56343e;})['then'](respondWithFilteredResult(_0x152f5f,_0x5607e0))['catch'](handleError(_0x152f5f,null));};exports['show']=function(_0x37da80,_0x110929){var _0x2d413d={'raw':![],'where':{'id':_0x37da80[_0xcd19('0x4b')]['id']}},_0x390be0={};_0x390be0[_0xcd19('0x38')]=_[_0xcd19('0x4c')](db[_0xcd19('0x34')]['rawAttributes']);_0x390be0[_0xcd19('0x39')]=_['keys'](_0x37da80[_0xcd19('0x39')]);_0x390be0[_0xcd19('0x3a')]=_[_0xcd19('0x3b')](_0x390be0[_0xcd19('0x38')],_0x390be0[_0xcd19('0x39')]);_0x2d413d[_0xcd19('0x3d')]=_[_0xcd19('0x3b')](_0x390be0[_0xcd19('0x38')],qs['fields'](_0x37da80[_0xcd19('0x39')][_0xcd19('0x3c')]));_0x2d413d['attributes']=_0x2d413d['attributes'][_0xcd19('0x3e')]?_0x2d413d['attributes']:_0x390be0[_0xcd19('0x38')];if(_0x37da80[_0xcd19('0x39')][_0xcd19('0x48')]){_0x2d413d['include']=[{'all':!![]}];}_0x2d413d=_['merge']({},_0x2d413d,_0x37da80[_0xcd19('0x47')]);return db['CmList']['find'](_0x2d413d)[_0xcd19('0x2d')](handleEntityNotFound(_0x110929,null))[_0xcd19('0x2d')](respondWithResult(_0x110929,null))[_0xcd19('0x4d')](handleError(_0x110929,null));};exports[_0xcd19('0x4e')]=function(_0x36f105,_0x5e0234){return db[_0xcd19('0x34')][_0xcd19('0x4e')](_0x36f105[_0xcd19('0x4f')],{})['then'](function(_0x21c537){var _0x62d0cf=_0x36f105[_0xcd19('0x50')][_0xcd19('0x51')]({'plain':!![]});if(!_0x62d0cf)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x62d0cf[_0xcd19('0x52')]===_0xcd19('0x50')){var _0x1e840d=_0x21c537[_0xcd19('0x51')]({'plain':!![]});var _0x3b4703=_0xcd19('0x2f');return db[_0xcd19('0x53')]['find']({'where':{'name':_0x3b4703,'userProfileId':_0x62d0cf[_0xcd19('0x54')]},'raw':!![]})[_0xcd19('0x2d')](function(_0x2e1484){if(_0x2e1484&&_0x2e1484[_0xcd19('0x55')]===0x0){return db['UserProfileResource'][_0xcd19('0x4e')]({'name':_0x1e840d['name'],'resourceId':_0x1e840d['id'],'type':_0x2e1484[_0xcd19('0x31')],'sectionId':_0x2e1484['id']},{})[_0xcd19('0x2d')](function(){return _0x21c537;});}else{return _0x21c537;}})['catch'](function(_0x4b510d){logger[_0xcd19('0x56')](_0xcd19('0x57'),_0x4b510d);throw _0x4b510d;});}return _0x21c537;})['then'](respondWithResult(_0x5e0234,0xc9))['catch'](handleError(_0x5e0234,null));};exports[_0xcd19('0x2c')]=function(_0x958603,_0x352567){if(_0x958603[_0xcd19('0x4f')]['id']){delete _0x958603[_0xcd19('0x4f')]['id'];}return db['CmList'][_0xcd19('0x58')]({'where':{'id':_0x958603[_0xcd19('0x4b')]['id']}})[_0xcd19('0x2d')](handleEntityNotFound(_0x352567,null))[_0xcd19('0x2d')](saveUpdates(_0x958603[_0xcd19('0x4f')],null))['then'](respondWithResult(_0x352567,null))[_0xcd19('0x4d')](handleError(_0x352567,null));};exports[_0xcd19('0x2e')]=function(_0x23d66f,_0x2b4919){return db[_0xcd19('0x34')][_0xcd19('0x58')]({'where':{'id':_0x23d66f[_0xcd19('0x4b')]['id']}})[_0xcd19('0x2d')](handleEntityNotFound(_0x2b4919,null))[_0xcd19('0x2d')](removeEntity(_0x2b4919,null))[_0xcd19('0x4d')](handleError(_0x2b4919,null));};exports[_0xcd19('0x59')]=function(_0x1fe0ad,_0x3a9e9f){return db['CmList'][_0xcd19('0x59')]()[_0xcd19('0x2d')](respondWithResult(_0x3a9e9f,null))[_0xcd19('0x4d')](handleError(_0x3a9e9f,null));};exports[_0xcd19('0x5a')]=function(_0x6f0aa5,_0x25a623,_0x291e76){if(_0x6f0aa5['body']['id']){delete _0x6f0aa5[_0xcd19('0x4f')]['id'];}return db['CmList'][_0xcd19('0x58')]({'where':{'id':_0x6f0aa5['params']['id']}})[_0xcd19('0x2d')](handleEntityNotFound(_0x25a623,null))[_0xcd19('0x2d')](function(_0x3936d3){if(_0x3936d3){_0x6f0aa5[_0xcd19('0x4f')][_0xcd19('0x5b')]=_0x3936d3['id'];return db[_0xcd19('0x5c')]['create'](_0x6f0aa5['body']);}})[_0xcd19('0x2d')](respondWithResult(_0x25a623,null))[_0xcd19('0x4d')](handleError(_0x25a623,null));};exports[_0xcd19('0x5d')]=function(_0x4589fa,_0x108903,_0x2b9df7){var _0x126bc4={'raw':![],'where':{}};var _0x2964b0={};var _0x2073e0={'count':0x0,'rows':[]};return db[_0xcd19('0x34')]['findOne']({'where':{'id':_0x4589fa['params']['id']}})[_0xcd19('0x2d')](handleEntityNotFound(_0x108903,null))[_0xcd19('0x2d')](function(_0x1506b6){if(_0x1506b6){_0x2964b0['model']=_['keys'](db[_0xcd19('0x5c')][_0xcd19('0x35')]);_0x2964b0[_0xcd19('0x39')]=_[_0xcd19('0x4c')](_0x4589fa[_0xcd19('0x39')]);_0x2964b0[_0xcd19('0x3a')]=_[_0xcd19('0x3b')](_0x2964b0[_0xcd19('0x38')],_0x2964b0[_0xcd19('0x39')]);_0x126bc4[_0xcd19('0x3d')]=_[_0xcd19('0x3b')](_0x2964b0[_0xcd19('0x38')],qs['fields'](_0x4589fa[_0xcd19('0x39')][_0xcd19('0x3c')]));_0x126bc4[_0xcd19('0x3d')]=_0x126bc4['attributes'][_0xcd19('0x3e')]?_0x126bc4['attributes']:_0x2964b0[_0xcd19('0x38')];if(!_0x4589fa[_0xcd19('0x39')][_0xcd19('0x3f')](_0xcd19('0x40'))){_0x126bc4[_0xcd19('0x26')]=qs[_0xcd19('0x26')](_0x4589fa[_0xcd19('0x39')][_0xcd19('0x26')]);_0x126bc4[_0xcd19('0x24')]=qs[_0xcd19('0x24')](_0x4589fa[_0xcd19('0x39')][_0xcd19('0x24')]);}_0x126bc4[_0xcd19('0x41')]=qs[_0xcd19('0x42')](_0x4589fa[_0xcd19('0x39')][_0xcd19('0x42')]);_0x126bc4[_0xcd19('0x45')]=qs[_0xcd19('0x3a')](_[_0xcd19('0x43')](_0x4589fa[_0xcd19('0x39')],_0x2964b0['filters']));_0x126bc4[_0xcd19('0x45')][_0xcd19('0x5b')]=_0x1506b6['id'];if(_0x4589fa[_0xcd19('0x39')][_0xcd19('0x44')]){_0x126bc4[_0xcd19('0x45')]=_[_0xcd19('0x46')](_0x126bc4[_0xcd19('0x45')],{'$or':_[_0xcd19('0x33')](_0x126bc4[_0xcd19('0x3d')],function(_0x5f1ecb){var _0x36ac45={};_0x36ac45[_0x5f1ecb]={'$like':'%'+_0x4589fa[_0xcd19('0x39')][_0xcd19('0x44')]+'%'};return _0x36ac45;})});}_0x126bc4=_[_0xcd19('0x46')]({},_0x126bc4,_0x4589fa[_0xcd19('0x47')]);return db[_0xcd19('0x5c')][_0xcd19('0x27')]({'where':_0x126bc4['where']})[_0xcd19('0x2d')](function(_0x361b8a){_0x2073e0[_0xcd19('0x27')]=_0x361b8a;if(_0x4589fa[_0xcd19('0x39')][_0xcd19('0x48')]){_0x126bc4[_0xcd19('0x5e')]=[{'all':!![]}];}return db[_0xcd19('0x5c')][_0xcd19('0x49')](_0x126bc4);})['then'](function(_0x478dc7){_0x2073e0[_0xcd19('0x4a')]=_0x478dc7;return _0x2073e0;});}})[_0xcd19('0x2d')](respondWithFilteredResult(_0x108903,_0x126bc4))[_0xcd19('0x4d')](handleError(_0x108903,null));};exports[_0xcd19('0x5f')]=function(_0x272fd8,_0x401015,_0x2058e2){return db[_0xcd19('0x34')][_0xcd19('0x58')]({'where':{'id':_0x272fd8[_0xcd19('0x4b')]['id']}})[_0xcd19('0x2d')](handleEntityNotFound(_0x401015,null))['then'](function(_0x494f2a){if(_0x494f2a){return _0x494f2a[_0xcd19('0x5f')](_0x272fd8[_0xcd19('0x39')][_0xcd19('0x60')]);}})[_0xcd19('0x2d')](respondWithStatusCode(_0x401015,null))[_0xcd19('0x4d')](handleError(_0x401015,null));};exports[_0xcd19('0x61')]=function(_0x5d6b21,_0x4bf76c,_0x552e91){return db[_0xcd19('0x34')]['find']({'where':{'id':_0x5d6b21[_0xcd19('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4bf76c,null))[_0xcd19('0x2d')](function(_0x5d5ab8){if(_0x5d5ab8){var _0x231104=[];var _0x58d22a={'success':[],'errors':[]};return db[_0xcd19('0x62')][_0xcd19('0x59')]()[_0xcd19('0x2d')](function(_0x5a44fa){if(_0x5d6b21[_0xcd19('0x4f')][_0xcd19('0x63')]&&_['isArray'](_0x5d6b21[_0xcd19('0x4f')]['tags'])){if(_0x5d6b21[_0xcd19('0x4f')][_0xcd19('0x63')][_0xcd19('0x3e')]){_0x5d6b21[_0xcd19('0x4f')]['tags']=_0x5d6b21[_0xcd19('0x4f')][_0xcd19('0x63')][_0xcd19('0x64')](';')+';';}else{_0x5d6b21['body']['tags']=null;}}else{_0x5d6b21['body'][_0xcd19('0x63')]=null;}if(_0x5d6b21['body']&&_['isArray'](_0x5d6b21['body'])){for(var _0x17c7dd=0x0;_0x17c7dd<_0x5d6b21[_0xcd19('0x4f')][_0xcd19('0x3e')];_0x17c7dd+=0x1){_0x5d6b21[_0xcd19('0x4f')][_0x17c7dd][_0xcd19('0x5b')]=_0x5d6b21['params']['id'];_0x231104[_0xcd19('0x65')](_0x5d6b21[_0xcd19('0x4f')][_0x17c7dd]);}return BPromise[_0xcd19('0x66')](_0x231104,function(_0x3c264f){return db[_0xcd19('0x62')][_0xcd19('0x4e')](_['omit'](_0x3c264f,[_0xcd19('0x60'),'id'])||{},{'fields':_[_0xcd19('0x4c')](_0x5a44fa),'raw':!![]})[_0xcd19('0x2d')](function(_0x25576d){_0x58d22a[_0xcd19('0x67')][_0xcd19('0x65')](_0x25576d[_0xcd19('0x68')]);})[_0xcd19('0x4d')](function(_0x2eea33){_0x58d22a[_0xcd19('0x69')][_0xcd19('0x65')]({'data':_0x3c264f,'error':_0x2eea33['message']});});})[_0xcd19('0x2d')](function(_0x49b126){return _0x58d22a;})[_0xcd19('0x4d')](function(_0x23abac){return _0x23abac;});}else{_0x4bf76c[_0xcd19('0x22')](0x190)['json']({'message':_0xcd19('0x6a')});}});}})[_0xcd19('0x2d')](respondWithResult(_0x4bf76c,null))[_0xcd19('0x4d')](handleError(_0x4bf76c,null));};exports[_0xcd19('0x6b')]=function(_0x3b5531,_0x443a66,_0x2580d8){var _0x1d5cdb;return db[_0xcd19('0x34')][_0xcd19('0x58')]({'where':{'id':_0x3b5531[_0xcd19('0x4b')]['id']},'include':[{'model':db['CmCustomField'],'as':'CustomFields'}]})[_0xcd19('0x2d')](handleEntityNotFound(_0x443a66,null))['then'](function(_0x44ba00){if(_0x44ba00){_0x1d5cdb=_0x44ba00;return db[_0xcd19('0x62')][_0xcd19('0x35')];}})[_0xcd19('0x2d')](function(_0x4ecaec){if(_0x4ecaec){var _0x32b30a={};var _0x1e7036={};_0x1e7036[_0xcd19('0x38')]=_[_0xcd19('0x6c')](_['keys'](_0x4ecaec),_[_0xcd19('0x33')](_0x1d5cdb[_0xcd19('0x6d')],function(_0x5105e7){return util[_0xcd19('0x6e')](_0xcd19('0x6f'),_0x5105e7['id']);}));_0x1e7036[_0xcd19('0x39')]=_[_0xcd19('0x4c')](_0x3b5531['query']);_0x1e7036[_0xcd19('0x3a')]=_[_0xcd19('0x3b')](_0x1e7036[_0xcd19('0x38')],_0x1e7036[_0xcd19('0x39')]);_0x32b30a[_0xcd19('0x3d')]=_['intersection'](_0x1e7036[_0xcd19('0x38')],qs[_0xcd19('0x3c')](_0x3b5531[_0xcd19('0x39')][_0xcd19('0x3c')]));_0x32b30a[_0xcd19('0x3d')]=_0x32b30a[_0xcd19('0x3d')][_0xcd19('0x3e')]?_0x32b30a[_0xcd19('0x3d')]:_0x1e7036['model'];if(!_0x3b5531['query'][_0xcd19('0x3f')](_0xcd19('0x40'))){_0x32b30a['limit']=qs[_0xcd19('0x26')](_0x3b5531[_0xcd19('0x39')][_0xcd19('0x26')]);_0x32b30a[_0xcd19('0x24')]=qs[_0xcd19('0x24')](_0x3b5531[_0xcd19('0x39')][_0xcd19('0x24')]);}_0x32b30a[_0xcd19('0x41')]=qs[_0xcd19('0x42')](_0x3b5531[_0xcd19('0x39')][_0xcd19('0x42')]);_0x32b30a[_0xcd19('0x45')]=qs[_0xcd19('0x3a')](_[_0xcd19('0x43')](_0x3b5531[_0xcd19('0x39')],_0x1e7036[_0xcd19('0x3a')]));_0x32b30a[_0xcd19('0x70')]=!![];if(_0x3b5531['query']['filter']){_0x32b30a['where']=_[_0xcd19('0x46')](_0x32b30a[_0xcd19('0x45')],{'$or':_[_0xcd19('0x33')](_0x32b30a[_0xcd19('0x3d')],function(_0x1bcd40){var _0x3416f7={};_0x3416f7[_0x1bcd40]={'$like':'%'+_0x3b5531[_0xcd19('0x39')][_0xcd19('0x44')]+'%'};return _0x3416f7;})});}_0x32b30a=_[_0xcd19('0x46')]({},_0x32b30a,_0x3b5531['options']);return _0x1d5cdb[_0xcd19('0x6b')](_0x32b30a);}})['then'](respondWithResult(_0x443a66,null))[_0xcd19('0x4d')](handleError(_0x443a66,null));};exports[_0xcd19('0x71')]=function(_0x86b71b,_0x5f4739,_0x2d6360){var _0x46de07;var _0x5759eb;var _0x174a8f;var _0x2be29d=_0x86b71b['params']['id'];csv_results=[];return db[_0xcd19('0x72')][_0xcd19('0x49')]({'attributes':['id',_0xcd19('0x31')],'raw':!![],'order':[_0xcd19('0x73')]})[_0xcd19('0x2d')](function(_0x57b779){_0x46de07=_0x57b779;var _0x3763eb=_[_0xcd19('0x4c')](db['CmContact'][_0xcd19('0x35')]);return db['CmCustomField'][_0xcd19('0x49')]({'raw':!![],'attributes':['id',_0xcd19('0x74')]})[_0xcd19('0x2d')](function(_0xf08548){_0x5759eb=_0xf08548;var _0x15164e=squel[_0xcd19('0x75')]()[_0xcd19('0x3c')](_0x3763eb)['from'](_0xcd19('0x76'),'c')['where'](_0xcd19('0x77'),_0x2be29d)[_0xcd19('0x45')](_0xcd19('0x78'))[_0xcd19('0x79')]();for(var _0x3473d8=0x0;_0x3473d8<_0x5759eb[_0xcd19('0x3e')];_0x3473d8++){_0x15164e[_0xcd19('0x7a')]('c.cf_'+_0x5759eb[_0x3473d8]['id'],_0xcd19('0x7b')+_0x5759eb[_0x3473d8][_0xcd19('0x74')]);}for(var _0x3473d8=0x0;_0x3473d8<_0x46de07[_0xcd19('0x3e')];_0x3473d8++){_0x15164e['field'](squel[_0xcd19('0x75')]()[_0xcd19('0x7a')](_0xcd19('0x7c'))[_0xcd19('0x7d')](_0xcd19('0x7e'))[_0xcd19('0x45')](_0xcd19('0x7f'),_0x46de07[_0x3473d8]['id'])[_0xcd19('0x45')](_0xcd19('0x80')),'additionalPhone_'+_0x46de07[_0x3473d8][_0xcd19('0x31')]);_0x15164e['field'](squel['select']()[_0xcd19('0x7a')](_0xcd19('0x81'))[_0xcd19('0x7d')](_0xcd19('0x7e'))['where'](_0xcd19('0x7f'),_0x46de07[_0x3473d8]['id'])[_0xcd19('0x45')](_0xcd19('0x80')),'description_additionalPhone_'+_0x46de07[_0x3473d8][_0xcd19('0x31')]);}var _0x4ccf97=[];_0x4ccf97[_0xcd19('0x65')](_0x15164e[_0xcd19('0x82')]());BPromise['each'](_0x4ccf97,handleQuery)[_0xcd19('0x2d')](function(_0x59f72a){handleQuery(_0x15164e['toString']());var _0x530192=csv_results[0x0];if(!_[_0xcd19('0x83')](_0x530192)){var _0x4a6b97=toCsv(_0x530192);var _0x2e4075=Date[_0xcd19('0x84')]();fs['writeFileSync'](util[_0xcd19('0x6e')](_0xcd19('0x85'),_0x2be29d,_0x2e4075),_0x4a6b97);_0x5f4739[_0xcd19('0x86')](_0xcd19('0x87'),_0xcd19('0x88')+util[_0xcd19('0x6e')](_0xcd19('0x89'),_0x2be29d,_0x2e4075));_0x5f4739[_0xcd19('0x86')]('Content-type',_0xcd19('0x8a'));return _0x5f4739[_0xcd19('0x8b')](util['format'](_0xcd19('0x85'),_0x2be29d,_0x2e4075));}else{return _0x5f4739['sendStatus'](0xcc);}});});});};exports['addCustomField']=function(_0x39a9d3,_0x4f5589,_0x6f39b9){var _0x51dd2e;delete _0x39a9d3[_0xcd19('0x4f')]['id'];return db[_0xcd19('0x34')]['findOne']({'where':{'id':_0x39a9d3[_0xcd19('0x4b')]['id']}})[_0xcd19('0x2d')](handleEntityNotFound(_0x4f5589,null))[_0xcd19('0x2d')](function(_0x5b3c92){if(_0x5b3c92){return db[_0xcd19('0x8c')][_0xcd19('0x8d')](function(_0x3df4b3){return db[_0xcd19('0x8e')]['create'](_0x39a9d3[_0xcd19('0x4f')],{'transaction':_0x3df4b3})[_0xcd19('0x2d')](function(_0x44bba6){_0x51dd2e=_0x44bba6;return _0x5b3c92[_0xcd19('0x8f')](_0x44bba6,{'transaction':_0x3df4b3});})[_0xcd19('0x2d')](function(){var _0x5c7e29={'type':db[_0xcd19('0x90')][_0xcd19('0x91')],'transaction':_0x3df4b3};switch(_0x39a9d3[_0xcd19('0x4f')]['type']){case'text':_0x5c7e29[_0xcd19('0x37')]=db[_0xcd19('0x90')][_0xcd19('0x91')];break;case'number':_0x5c7e29['type']=db[_0xcd19('0x90')][_0xcd19('0x92')];break;case _0xcd19('0x93'):_0x5c7e29[_0xcd19('0x37')]=db[_0xcd19('0x90')][_0xcd19('0x94')];_0x5c7e29[_0xcd19('0x95')]=![];break;default:}return db[_0xcd19('0x8c')][_0xcd19('0x96')][_0xcd19('0x97')](_0xcd19('0x76'),util[_0xcd19('0x6e')]('cf_%s',_0x51dd2e['id']),_0x5c7e29);})['then'](function(){return _0x51dd2e;});});}})[_0xcd19('0x2d')](respondWithResult(_0x4f5589,null))[_0xcd19('0x4d')](handleError(_0x4f5589,null));};exports[_0xcd19('0x98')]=function(_0x5f0196,_0x3c4067,_0x4b370e){var _0x261abf={};var _0x1aa111={};var _0x2b3a4e;var _0x32abb9;return db[_0xcd19('0x34')][_0xcd19('0x99')]({'where':{'id':_0x5f0196[_0xcd19('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3c4067,null))[_0xcd19('0x2d')](function(_0x21aef0){if(_0x21aef0){_0x2b3a4e=_0x21aef0;_0x1aa111['model']=_[_0xcd19('0x4c')](db['CmCustomField'][_0xcd19('0x35')]);_0x1aa111['query']=_[_0xcd19('0x4c')](_0x5f0196['query']);_0x1aa111[_0xcd19('0x3a')]=_[_0xcd19('0x3b')](_0x1aa111[_0xcd19('0x38')],_0x1aa111[_0xcd19('0x39')]);_0x261abf['attributes']=_['intersection'](_0x1aa111[_0xcd19('0x38')],qs[_0xcd19('0x3c')](_0x5f0196[_0xcd19('0x39')][_0xcd19('0x3c')]));_0x261abf['attributes']=_0x261abf[_0xcd19('0x3d')][_0xcd19('0x3e')]?_0x261abf['attributes']:_0x1aa111[_0xcd19('0x38')];_0x261abf[_0xcd19('0x41')]=qs[_0xcd19('0x42')](_0x5f0196[_0xcd19('0x39')]['sort']);_0x261abf[_0xcd19('0x45')]=qs[_0xcd19('0x3a')](_[_0xcd19('0x43')](_0x5f0196[_0xcd19('0x39')],_0x1aa111['filters']));_0x261abf[_0xcd19('0x45')]=_[_0xcd19('0x46')](_0x261abf[_0xcd19('0x45')],{'$or':[{'ListId':_0x21aef0['id']},{'ListId':null}]});if(_0x5f0196[_0xcd19('0x39')][_0xcd19('0x44')]){_0x261abf[_0xcd19('0x45')]=_[_0xcd19('0x46')](_0x261abf[_0xcd19('0x45')],{'$or':_[_0xcd19('0x33')](_0x261abf[_0xcd19('0x3d')],function(_0x5bb11d){var _0x2ac247={};_0x2ac247[_0x5bb11d]={'$like':'%'+_0x5f0196[_0xcd19('0x39')][_0xcd19('0x44')]+'%'};return _0x2ac247;})});}_0x261abf=_[_0xcd19('0x46')]({},_0x261abf,_0x5f0196[_0xcd19('0x47')]);return db[_0xcd19('0x8e')]['findAndCountAll'](_0x261abf);}})[_0xcd19('0x2d')](respondWithResult(_0x3c4067,null))[_0xcd19('0x4d')](handleError(_0x3c4067,null));};exports['getGlobalCustomFields']=function(_0x2bfef3,_0x2ce5b5){return db[_0xcd19('0x8e')]['findAndCountAll']({'where':{'ListId':null}})[_0xcd19('0x2d')](handleEntityNotFound(_0x2ce5b5,null))[_0xcd19('0x2d')](function(_0xd75603){return _0xd75603;})[_0xcd19('0x2d')](respondWithResult(_0x2ce5b5,null))[_0xcd19('0x4d')](handleError(_0x2ce5b5,null));};exports[_0xcd19('0x9a')]=function(_0x25a16b,_0x1a136b,_0x12af52){return db[_0xcd19('0x34')]['find']({'where':{'id':_0x25a16b['params']['id']}})[_0xcd19('0x2d')](handleEntityNotFound(_0x1a136b,null))['then'](function(_0x4b5c89){if(_0x4b5c89){return _0x4b5c89[_0xcd19('0x9a')](_0x25a16b[_0xcd19('0x4f')]['ids'],_[_0xcd19('0x9b')](_0x25a16b[_0xcd19('0x4f')],[_0xcd19('0x60'),'id'])||{})[_0xcd19('0x9c')](function(_0x53f1c3){for(var _0x28f123=0x0;_0x28f123<_0x25a16b[_0xcd19('0x4f')][_0xcd19('0x60')][_0xcd19('0x3e')];_0x28f123+=0x1){socket[_0xcd19('0x9d')](_0xcd19('0x9e'),{'UserId':Number(_0x25a16b[_0xcd19('0x4f')]['ids'][_0x28f123]),'CmListId':Number(_0x25a16b[_0xcd19('0x4b')]['id'])});}return _0x53f1c3;});}})[_0xcd19('0x2d')](respondWithResult(_0x1a136b,null))['catch'](handleError(_0x1a136b,null));};exports[_0xcd19('0x9f')]=function(_0x1375f5,_0x176819,_0x362236){return db[_0xcd19('0x34')][_0xcd19('0x58')]({'where':{'id':_0x1375f5[_0xcd19('0x4b')]['id']}})[_0xcd19('0x2d')](handleEntityNotFound(_0x176819,null))[_0xcd19('0x2d')](function(_0x3519c8){if(_0x3519c8){return _0x3519c8['removeAgents'](_0x1375f5[_0xcd19('0x39')]['ids'])[_0xcd19('0x2d')](function(){if(_[_0xcd19('0xa0')](_0x1375f5[_0xcd19('0x39')][_0xcd19('0x60')])){for(var _0xa1de12=0x0;_0xa1de12<_0x1375f5[_0xcd19('0x39')][_0xcd19('0x60')][_0xcd19('0x3e')];_0xa1de12+=0x1){socket['emit']('userCmList:remove',{'UserId':Number(_0x1375f5['query'][_0xcd19('0x60')][_0xa1de12]),'CmListId':Number(_0x1375f5['params']['id'])});}}else{socket[_0xcd19('0x9d')]('userCmList:remove',{'UserId':Number(_0x1375f5[_0xcd19('0x39')][_0xcd19('0x60')]),'CmListId':Number(_0x1375f5[_0xcd19('0x4b')]['id'])});}});}})['then'](respondWithStatusCode(_0x176819,null))[_0xcd19('0x4d')](handleError(_0x176819,null));};exports[_0xcd19('0xa1')]=function(_0x450bf8,_0x57053f,_0x6d33b5){var _0xe84fcd={};var _0x36d952={};var _0x30f76e;var _0x26661e;return db[_0xcd19('0x34')][_0xcd19('0x99')]({'where':{'id':_0x450bf8[_0xcd19('0x4b')]['id']}})['then'](handleEntityNotFound(_0x57053f,null))['then'](function(_0x5ea06b){if(_0x5ea06b){_0x30f76e=_0x5ea06b;_0x36d952['model']=_[_0xcd19('0x4c')](db[_0xcd19('0xa2')][_0xcd19('0x35')]);_0x36d952['query']=_[_0xcd19('0x4c')](_0x450bf8[_0xcd19('0x39')]);_0x36d952[_0xcd19('0x3a')]=_[_0xcd19('0x3b')](_0x36d952[_0xcd19('0x38')],_0x36d952[_0xcd19('0x39')]);_0xe84fcd[_0xcd19('0x3d')]=_[_0xcd19('0x3b')](_0x36d952[_0xcd19('0x38')],qs[_0xcd19('0x3c')](_0x450bf8[_0xcd19('0x39')]['fields']));_0xe84fcd[_0xcd19('0x3d')]=_0xe84fcd[_0xcd19('0x3d')][_0xcd19('0x3e')]?_0xe84fcd[_0xcd19('0x3d')]:_0x36d952['model'];_0xe84fcd[_0xcd19('0x41')]=qs['sort'](_0x450bf8['query'][_0xcd19('0x42')]);_0xe84fcd[_0xcd19('0x45')]=qs[_0xcd19('0x3a')](_[_0xcd19('0x43')](_0x450bf8[_0xcd19('0x39')],_0x36d952['filters']));if(_0x450bf8[_0xcd19('0x39')][_0xcd19('0x44')]){_0xe84fcd['where']=_['merge'](_0xe84fcd[_0xcd19('0x45')],{'$or':_[_0xcd19('0x33')](_0xe84fcd[_0xcd19('0x3d')],function(_0x332581){var _0x3bd670={};_0x3bd670[_0x332581]={'$like':'%'+_0x450bf8[_0xcd19('0x39')][_0xcd19('0x44')]+'%'};return _0x3bd670;})});}_0xe84fcd=_[_0xcd19('0x46')]({},_0xe84fcd,_0x450bf8[_0xcd19('0x47')]);return _0x30f76e['getAgents'](_0xe84fcd);}})['then'](function(_0x3f49f2){if(_0x3f49f2){_0x26661e=_0x3f49f2['length'];if(!_0x450bf8['query'][_0xcd19('0x3f')](_0xcd19('0x40'))){_0xe84fcd['limit']=qs['limit'](_0x450bf8[_0xcd19('0x39')][_0xcd19('0x26')]);_0xe84fcd[_0xcd19('0x24')]=qs['offset'](_0x450bf8[_0xcd19('0x39')][_0xcd19('0x24')]);}return _0x30f76e[_0xcd19('0xa1')](_0xe84fcd);}})['then'](function(_0x401cb7){if(_0x401cb7){return _0x401cb7?{'count':_0x26661e,'rows':_0x401cb7}:null;}})['then'](respondWithResult(_0x57053f,null))[_0xcd19('0x4d')](handleError(_0x57053f,null));};function handleQuery(_0x22671b){logger[_0xcd19('0xa3')](_0x22671b);return db[_0xcd19('0x8c')][_0xcd19('0x39')](_0x22671b)[_0xcd19('0x9c')](function(_0x58074e){csv_results[_0xcd19('0x65')](_0x58074e);})['catch'](function(_0x35efa2){logger['error'](_0x35efa2[_0xcd19('0xa4')]);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index cd6ccbb..ff6fbd0 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 _0xe14b=['hasOwnProperty','hook','exports','events','../../mysqldb','save','update','emit'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xe14b,0x93));var _0xbe14=function(_0x5231ae,_0x586388){_0x5231ae=_0x5231ae-0x0;var _0x25d4ca=_0xe14b[_0x5231ae];return _0x25d4ca;};'use strict';var EventEmitter=require(_0xbe14('0x0'));var CmList=require(_0xbe14('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbe14('0x2'),'afterUpdate':_0xbe14('0x3'),'afterDestroy':'remove'};function emitEvent(_0x7d3665){return function(_0x5ce8fb,_0x496c04,_0x1833e3){CmListEvents[_0xbe14('0x4')](_0x7d3665+':'+_0x5ce8fb['id'],_0x5ce8fb);CmListEvents[_0xbe14('0x4')](_0x7d3665,_0x5ce8fb);_0x1833e3(null);};}for(var e in events){if(events[_0xbe14('0x5')](e)){var event=events[e];CmList[_0xbe14('0x6')](e,emitEvent(event));}}module[_0xbe14('0x7')]=CmListEvents; \ No newline at end of file +var _0x55ca=['events','../../mysqldb','update','remove','emit','hasOwnProperty','hook'];(function(_0x547456,_0x1de17e){var _0xc1fd7b=function(_0x12be35){while(--_0x12be35){_0x547456['push'](_0x547456['shift']());}};_0xc1fd7b(++_0x1de17e);}(_0x55ca,0x126));var _0xa55c=function(_0xcfeda9,_0xd418ae){_0xcfeda9=_0xcfeda9-0x0;var _0x4826c7=_0x55ca[_0xcfeda9];return _0x4826c7;};'use strict';var EventEmitter=require(_0xa55c('0x0'));var CmList=require(_0xa55c('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xa55c('0x2'),'afterDestroy':_0xa55c('0x3')};function emitEvent(_0x5dc716){return function(_0x3b478a,_0x2db02a,_0xcb02e3){CmListEvents[_0xa55c('0x4')](_0x5dc716+':'+_0x3b478a['id'],_0x3b478a);CmListEvents[_0xa55c('0x4')](_0x5dc716,_0x3b478a);_0xcb02e3(null);};}for(var e in events){if(events[_0xa55c('0x5')](e)){var event=events[e];CmList[_0xa55c('0x6')](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 696ad55..8039864 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 _0xb58b=['CmList','cm_lists','util','../../config/logger','api','bluebird','request-promise','rimraf','./cmList.attributes','exports','define'];(function(_0x25e625,_0x2a97e2){var _0x3312cb=function(_0x3294e8){while(--_0x3294e8){_0x25e625['push'](_0x25e625['shift']());}};_0x3312cb(++_0x2a97e2);}(_0xb58b,0x1f1));var _0xbb58=function(_0x43985c,_0x5b531a){_0x43985c=_0x43985c-0x0;var _0x4e5404=_0xb58b[_0x43985c];return _0x4e5404;};'use strict';var _=require('lodash');var util=require(_0xbb58('0x0'));var logger=require(_0xbb58('0x1'))(_0xbb58('0x2'));var moment=require('moment');var BPromise=require(_0xbb58('0x3'));var rp=require(_0xbb58('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbb58('0x5'));var config=require('../../config/environment');var attributes=require(_0xbb58('0x6'));module[_0xbb58('0x7')]=function(_0x33fe85,_0x5cf8b1){return _0x33fe85[_0xbb58('0x8')](_0xbb58('0x9'),attributes,{'tableName':_0xbb58('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1339=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','CmList','cm_lists','../../config/logger','api'];(function(_0x372e78,_0xa4b08a){var _0x8f8851=function(_0x2694ce){while(--_0x2694ce){_0x372e78['push'](_0x372e78['shift']());}};_0x8f8851(++_0xa4b08a);}(_0x1339,0x1ed));var _0x9133=function(_0xbaa69b,_0x2ce2ad){_0xbaa69b=_0xbaa69b-0x0;var _0x2da0ee=_0x1339[_0xbaa69b];return _0x2da0ee;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9133('0x0'))(_0x9133('0x1'));var moment=require(_0x9133('0x2'));var BPromise=require(_0x9133('0x3'));var rp=require(_0x9133('0x4'));var fs=require('fs');var path=require(_0x9133('0x5'));var rimraf=require(_0x9133('0x6'));var config=require(_0x9133('0x7'));var attributes=require('./cmList.attributes');module[_0x9133('0x8')]=function(_0x855473,_0x379915){return _0x855473['define'](_0x9133('0x9'),attributes,{'tableName':_0x9133('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 94adf2d..a18476a 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 _0x40e3=['register','info','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CmList,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./cmList.socket'];(function(_0x492b45,_0x1f3d71){var _0xf79de=function(_0x39f63e){while(--_0x39f63e){_0x492b45['push'](_0x492b45['shift']());}};_0xf79de(++_0x1f3d71);}(_0x40e3,0x8e));var _0x340e=function(_0x437b02,_0x34b630){_0x437b02=_0x437b02-0x0;var _0xf8c681=_0x40e3[_0x437b02];return _0xf8c681;};'use strict';var _=require(_0x340e('0x0'));var util=require(_0x340e('0x1'));var moment=require(_0x340e('0x2'));var BPromise=require(_0x340e('0x3'));var rs=require(_0x340e('0x4'));var fs=require('fs');var Redis=require(_0x340e('0x5'));var db=require(_0x340e('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x340e('0x7'));var jayson=require(_0x340e('0x8'));var client=jayson[_0x340e('0x9')][_0x340e('0xa')]({'port':0x232a});config[_0x340e('0xb')]=_['defaults'](config[_0x340e('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x340e('0xc'))(new Redis(config[_0x340e('0xb')]));require(_0x340e('0xd'))[_0x340e('0xe')](socket);function respondWithRpcPromise(_0x170397,_0x34ef99,_0x360ddb){return new BPromise(function(_0x5d637f,_0x4db9db){return client['request'](_0x170397,_0x360ddb)['then'](function(_0x7a4694){logger[_0x340e('0xf')]('CmList,\x20%s,\x20%s',_0x34ef99,_0x340e('0x10'));logger[_0x340e('0x11')](_0x340e('0x12'),_0x34ef99,'request\x20sent',JSON[_0x340e('0x13')](_0x7a4694));if(_0x7a4694['error']){if(_0x7a4694[_0x340e('0x14')][_0x340e('0x15')]===0x1f4){logger['error']('CmList,\x20%s,\x20%s',_0x34ef99,_0x7a4694[_0x340e('0x14')][_0x340e('0x16')]);return _0x4db9db(_0x7a4694[_0x340e('0x14')][_0x340e('0x16')]);}logger[_0x340e('0x14')]('CmList,\x20%s,\x20%s',_0x34ef99,_0x7a4694[_0x340e('0x14')][_0x340e('0x16')]);return _0x5d637f(_0x7a4694[_0x340e('0x14')][_0x340e('0x16')]);}else{logger['info'](_0x340e('0x17'),_0x34ef99,_0x340e('0x10'));_0x5d637f(_0x7a4694[_0x340e('0x18')]['message']);}})[_0x340e('0x19')](function(_0x379afb){logger[_0x340e('0x14')](_0x340e('0x17'),_0x34ef99,_0x379afb);_0x4db9db(_0x379afb);});});} \ No newline at end of file +var _0x5bc4=['request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','./cmList.socket','register','request','then','info','CmList,\x20%s,\x20%s'];(function(_0x39d430,_0x171696){var _0x521ce4=function(_0x5a52ca){while(--_0x5a52ca){_0x39d430['push'](_0x39d430['shift']());}};_0x521ce4(++_0x171696);}(_0x5bc4,0x10d));var _0x45bc=function(_0x23f3f6,_0x409180){_0x23f3f6=_0x23f3f6-0x0;var _0x384cfc=_0x5bc4[_0x23f3f6];return _0x384cfc;};'use strict';var _=require(_0x45bc('0x0'));var util=require('util');var moment=require(_0x45bc('0x1'));var BPromise=require('bluebird');var rs=require(_0x45bc('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x45bc('0x3'))['db'];var utils=require(_0x45bc('0x4'));var logger=require(_0x45bc('0x5'))(_0x45bc('0x6'));var config=require(_0x45bc('0x7'));var jayson=require(_0x45bc('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x45bc('0x9')]=_[_0x45bc('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x45bc('0x9')]));require(_0x45bc('0xb'))[_0x45bc('0xc')](socket);function respondWithRpcPromise(_0x164d34,_0x212270,_0x32472f){return new BPromise(function(_0x3b47ba,_0x4601b0){return client[_0x45bc('0xd')](_0x164d34,_0x32472f)[_0x45bc('0xe')](function(_0x287ca4){logger[_0x45bc('0xf')](_0x45bc('0x10'),_0x212270,_0x45bc('0x11'));logger[_0x45bc('0x12')](_0x45bc('0x13'),_0x212270,'request\x20sent',JSON[_0x45bc('0x14')](_0x287ca4));if(_0x287ca4[_0x45bc('0x15')]){if(_0x287ca4[_0x45bc('0x15')][_0x45bc('0x16')]===0x1f4){logger['error'](_0x45bc('0x10'),_0x212270,_0x287ca4['error']['message']);return _0x4601b0(_0x287ca4[_0x45bc('0x15')][_0x45bc('0x17')]);}logger[_0x45bc('0x15')](_0x45bc('0x10'),_0x212270,_0x287ca4[_0x45bc('0x15')][_0x45bc('0x17')]);return _0x3b47ba(_0x287ca4[_0x45bc('0x15')][_0x45bc('0x17')]);}else{logger[_0x45bc('0xf')](_0x45bc('0x10'),_0x212270,'request\x20sent');_0x3b47ba(_0x287ca4[_0x45bc('0x18')][_0x45bc('0x17')]);}})[_0x45bc('0x19')](function(_0xa9548a){logger[_0x45bc('0x15')](_0x45bc('0x10'),_0x212270,_0xa9548a);_0x4601b0(_0xa9548a);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 884d253..5d6da81 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 _0x9ed7=['./cmList.events','remove','update','length','cmList:'];(function(_0x543d5b,_0x95d0e2){var _0x27fee9=function(_0x3812b8){while(--_0x3812b8){_0x543d5b['push'](_0x543d5b['shift']());}};_0x27fee9(++_0x95d0e2);}(_0x9ed7,0x16d));var _0x79ed=function(_0x378891,_0x4e3e16){_0x378891=_0x378891-0x0;var _0xfbfda2=_0x9ed7[_0x378891];return _0xfbfda2;};'use strict';var CmListEvents=require(_0x79ed('0x0'));var events=['save',_0x79ed('0x1'),_0x79ed('0x2')];function createListener(_0x226b24,_0x28c2a0){return function(_0x32caf2){_0x28c2a0['emit'](_0x226b24,_0x32caf2);};}function removeListener(_0x2836b4,_0x10ea40){return function(){CmListEvents['removeListener'](_0x2836b4,_0x10ea40);};}exports['register']=function(_0x1ea74c){for(var _0x224ba0=0x0,_0x26fc5c=events[_0x79ed('0x3')];_0x224ba0<_0x26fc5c;_0x224ba0++){var _0x1da9b3=events[_0x224ba0];var _0x59b4c5=createListener(_0x79ed('0x4')+_0x1da9b3,_0x1ea74c);CmListEvents['on'](_0x1da9b3,_0x59b4c5);}}; \ No newline at end of file +var _0x5c99=['length','./cmList.events','save','remove','update','emit','removeListener','register'];(function(_0x705e3f,_0x432e1b){var _0x513d0c=function(_0x2b4976){while(--_0x2b4976){_0x705e3f['push'](_0x705e3f['shift']());}};_0x513d0c(++_0x432e1b);}(_0x5c99,0xb1));var _0x95c9=function(_0x494fa2,_0x84b5d8){_0x494fa2=_0x494fa2-0x0;var _0xf013c7=_0x5c99[_0x494fa2];return _0xf013c7;};'use strict';var CmListEvents=require(_0x95c9('0x0'));var events=[_0x95c9('0x1'),_0x95c9('0x2'),_0x95c9('0x3')];function createListener(_0x3fa3bf,_0x3fa8d5){return function(_0x317631){_0x3fa8d5[_0x95c9('0x4')](_0x3fa3bf,_0x317631);};}function removeListener(_0x450f8d,_0x1f8022){return function(){CmListEvents[_0x95c9('0x5')](_0x450f8d,_0x1f8022);};}exports[_0x95c9('0x6')]=function(_0x5772ae){for(var _0x4c89d6=0x0,_0x370609=events[_0x95c9('0x7')];_0x4c89d6<_0x370609;_0x4c89d6++){var _0x35c26a=events[_0x4c89d6];var _0x21cf20=createListener('cmList:'+_0x35c26a,_0x5772ae);CmListEvents['on'](_0x35c26a,_0x21cf20);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 9f3ff3c..eae2c2c 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 _0x7c5e=['/:id/contacts','getContacts','/:id/fields','getCustomFields','getAgents','post','addDisposition','addContacts','addCustomField','/:id/users','addAgents','put','/:id','update','delete','destroy','removeDispositions','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','/describe','describe','/global_fields','getGlobalCustomFields','/:id/dispositions','getDispositions'];(function(_0x25f9ca,_0x508ba3){var _0x530c2c=function(_0x32811c){while(--_0x32811c){_0x25f9ca['push'](_0x25f9ca['shift']());}};_0x530c2c(++_0x508ba3);}(_0x7c5e,0x11d));var _0xe7c5=function(_0x511a77,_0x222f2f){_0x511a77=_0x511a77-0x0;var _0x32ef48=_0x7c5e[_0x511a77];return _0x32ef48;};'use strict';var multer=require(_0xe7c5('0x0'));var util=require(_0xe7c5('0x1'));var path=require(_0xe7c5('0x2'));var timeout=require(_0xe7c5('0x3'));var express=require(_0xe7c5('0x4'));var router=express[_0xe7c5('0x5')]();var fs_extra=require(_0xe7c5('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xe7c5('0x7'));var config=require(_0xe7c5('0x8'));var controller=require(_0xe7c5('0x9'));router[_0xe7c5('0xa')]('/',auth[_0xe7c5('0xb')](),controller[_0xe7c5('0xc')]);router[_0xe7c5('0xa')](_0xe7c5('0xd'),auth[_0xe7c5('0xb')](),controller[_0xe7c5('0xe')]);router[_0xe7c5('0xa')](_0xe7c5('0xf'),auth[_0xe7c5('0xb')](),controller[_0xe7c5('0x10')]);router[_0xe7c5('0xa')]('/:id',auth[_0xe7c5('0xb')](),controller['show']);router[_0xe7c5('0xa')](_0xe7c5('0x11'),auth[_0xe7c5('0xb')](),controller[_0xe7c5('0x12')]);router['get'](_0xe7c5('0x13'),auth[_0xe7c5('0xb')](),controller[_0xe7c5('0x14')]);router['get']('/:id/contacts/csv',auth[_0xe7c5('0xb')](),controller['getContactsCsv']);router[_0xe7c5('0xa')](_0xe7c5('0x15'),auth[_0xe7c5('0xb')](),controller[_0xe7c5('0x16')]);router['get']('/:id/users',auth[_0xe7c5('0xb')](),controller[_0xe7c5('0x17')]);router['post']('/',auth[_0xe7c5('0xb')](),controller['create']);router[_0xe7c5('0x18')](_0xe7c5('0x11'),auth[_0xe7c5('0xb')](),controller[_0xe7c5('0x19')]);router['post'](_0xe7c5('0x13'),auth[_0xe7c5('0xb')](),controller[_0xe7c5('0x1a')]);router[_0xe7c5('0x18')](_0xe7c5('0x15'),auth[_0xe7c5('0xb')](),controller[_0xe7c5('0x1b')]);router['post'](_0xe7c5('0x1c'),auth[_0xe7c5('0xb')](),controller[_0xe7c5('0x1d')]);router[_0xe7c5('0x1e')](_0xe7c5('0x1f'),auth[_0xe7c5('0xb')](),controller[_0xe7c5('0x20')]);router[_0xe7c5('0x21')]('/:id',auth['isAuthenticated'](),controller[_0xe7c5('0x22')]);router['delete']('/:id/dispositions',auth[_0xe7c5('0xb')](),controller[_0xe7c5('0x23')]);router[_0xe7c5('0x21')]('/:id/users',auth[_0xe7c5('0xb')](),controller[_0xe7c5('0x24')]);module[_0xe7c5('0x25')]=router; \ No newline at end of file +var _0x51cb=['getContactsCsv','/:id/fields','/:id/users','getAgents','post','addDisposition','addContacts','addCustomField','addAgents','delete','destroy','/:id/dispositions','removeDispositions','removeAgents','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./cmList.controller','isAuthenticated','get','getGlobalCustomFields','/:id','show','getDispositions','/:id/contacts','/:id/contacts/csv'];(function(_0x458f9b,_0x169301){var _0x58cfae=function(_0x1e1017){while(--_0x1e1017){_0x458f9b['push'](_0x458f9b['shift']());}};_0x58cfae(++_0x169301);}(_0x51cb,0xc8));var _0xb51c=function(_0x562217,_0xf5d90){_0x562217=_0x562217-0x0;var _0x4e6c8e=_0x51cb[_0x562217];return _0x4e6c8e;};'use strict';var multer=require(_0xb51c('0x0'));var util=require(_0xb51c('0x1'));var path=require(_0xb51c('0x2'));var timeout=require(_0xb51c('0x3'));var express=require(_0xb51c('0x4'));var router=express[_0xb51c('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xb51c('0x6'));var config=require(_0xb51c('0x7'));var controller=require(_0xb51c('0x8'));router['get']('/',auth[_0xb51c('0x9')](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xb51c('0xa')]('/global_fields',auth['isAuthenticated'](),controller[_0xb51c('0xb')]);router['get'](_0xb51c('0xc'),auth[_0xb51c('0x9')](),controller[_0xb51c('0xd')]);router['get']('/:id/dispositions',auth[_0xb51c('0x9')](),controller[_0xb51c('0xe')]);router[_0xb51c('0xa')](_0xb51c('0xf'),auth[_0xb51c('0x9')](),controller['getContacts']);router[_0xb51c('0xa')](_0xb51c('0x10'),auth['isAuthenticated'](),controller[_0xb51c('0x11')]);router['get'](_0xb51c('0x12'),auth[_0xb51c('0x9')](),controller['getCustomFields']);router['get'](_0xb51c('0x13'),auth[_0xb51c('0x9')](),controller[_0xb51c('0x14')]);router[_0xb51c('0x15')]('/',auth[_0xb51c('0x9')](),controller['create']);router[_0xb51c('0x15')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xb51c('0x16')]);router[_0xb51c('0x15')]('/:id/contacts',auth['isAuthenticated'](),controller[_0xb51c('0x17')]);router['post']('/:id/fields',auth[_0xb51c('0x9')](),controller[_0xb51c('0x18')]);router['post'](_0xb51c('0x13'),auth[_0xb51c('0x9')](),controller[_0xb51c('0x19')]);router['put']('/:id',auth[_0xb51c('0x9')](),controller['update']);router[_0xb51c('0x1a')](_0xb51c('0xc'),auth[_0xb51c('0x9')](),controller[_0xb51c('0x1b')]);router[_0xb51c('0x1a')](_0xb51c('0x1c'),auth['isAuthenticated'](),controller[_0xb51c('0x1d')]);router[_0xb51c('0x1a')](_0xb51c('0x13'),auth[_0xb51c('0x9')](),controller[_0xb51c('0x1e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index aca906b..f58c9fe 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 _0xe6f4=['getDataValue','field','STRING','exports'];(function(_0x56db49,_0xad32eb){var _0x2f1573=function(_0xb17823){while(--_0xb17823){_0x56db49['push'](_0x56db49['shift']());}};_0x2f1573(++_0xad32eb);}(_0xe6f4,0x1df));var _0x4e6f=function(_0x120376,_0x571898){_0x120376=_0x120376-0x0;var _0x28c529=_0xe6f4[_0x120376];return _0x28c529;};'use strict';var Sequelize=require('sequelize');module[_0x4e6f('0x0')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0xc9ab1){return this[_0x4e6f('0x1')](_0x4e6f('0x2'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x4e6f('0x3')],'allowNull':![]},'value':{'type':Sequelize[_0x4e6f('0x3')],'allowNull':![]}}; \ No newline at end of file +var _0xb359=['getDataValue','field','STRING','sequelize','exports'];(function(_0x211632,_0x378e2e){var _0x5a1da1=function(_0x44aff2){while(--_0x44aff2){_0x211632['push'](_0x211632['shift']());}};_0x5a1da1(++_0x378e2e);}(_0xb359,0xda));var _0x9b35=function(_0x18cebb,_0x19503d){_0x18cebb=_0x18cebb-0x0;var _0x27b789=_0xb359[_0x18cebb];return _0x27b789;};'use strict';var Sequelize=require(_0x9b35('0x0'));module[_0x9b35('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x44a61a){return this[_0x9b35('0x2')](_0x9b35('0x3'));}},'field':{'type':Sequelize[_0x9b35('0x4')],'allowNull':![]},'operator':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x9b35('0x4')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 9d7d9c4..9491bb9 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x5ecdd8,_0x599c79){var _0x35d1e5=function(_0x2e8d5e){while(--_0x2e8d5e){_0x5ecdd8['push'](_0x5ecdd8['shift']());}};_0x35d1e5(++_0x599c79);}(_0x7a54,0x106));var _0x47a5=function(_0x5e18cf,_0x4e8bed){_0x5e18cf=_0x5e18cf-0x0;var _0x509007=_0x7a54[_0x5e18cf];return _0x509007;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file +var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0xe91922,_0x38510f){var _0x432250=function(_0x53589c){while(--_0x53589c){_0xe91922['push'](_0xe91922['shift']());}};_0x432250(++_0x38510f);}(_0x7a54,0x106));var _0x47a5=function(_0x5777d0,_0x3f3e78){_0x5777d0=_0x5777d0-0x0;var _0x4721ba=_0x7a54[_0x5777d0];return _0x4721ba;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 035f59b..7751244 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 _0xc1de=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./condition.attributes','exports','define','Condition','tools_conditions','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc1de,0x86));var _0xec1d=function(_0x17e960,_0x3122d1){_0x17e960=_0x17e960-0x0;var _0x1f09fb=_0xc1de[_0x17e960];return _0x1f09fb;};'use strict';var _=require(_0xec1d('0x0'));var util=require(_0xec1d('0x1'));var logger=require(_0xec1d('0x2'))(_0xec1d('0x3'));var moment=require(_0xec1d('0x4'));var BPromise=require(_0xec1d('0x5'));var rp=require(_0xec1d('0x6'));var fs=require('fs');var path=require(_0xec1d('0x7'));var rimraf=require(_0xec1d('0x8'));var config=require(_0xec1d('0x9'));var attributes=require(_0xec1d('0xa'));module[_0xec1d('0xb')]=function(_0x2d4324,_0x142ddc){return _0x2d4324[_0xec1d('0xc')](_0xec1d('0xd'),attributes,{'tableName':_0xec1d('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe8d6=['Condition','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./condition.attributes','exports'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xe8d6,0x16c));var _0x6e8d=function(_0x365bd5,_0x172c77){_0x365bd5=_0x365bd5-0x0;var _0x3234eb=_0xe8d6[_0x365bd5];return _0x3234eb;};'use strict';var _=require(_0x6e8d('0x0'));var util=require(_0x6e8d('0x1'));var logger=require('../../config/logger')(_0x6e8d('0x2'));var moment=require(_0x6e8d('0x3'));var BPromise=require(_0x6e8d('0x4'));var rp=require(_0x6e8d('0x5'));var fs=require('fs');var path=require(_0x6e8d('0x6'));var rimraf=require('rimraf');var config=require(_0x6e8d('0x7'));var attributes=require(_0x6e8d('0x8'));module[_0x6e8d('0x9')]=function(_0x16eac2,_0x5e32b0){return _0x16eac2['define'](_0x6e8d('0xa'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index f700515..48a106e 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 _0x8628=['Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','Condition,\x20%s,\x20%s','message','catch','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug'];(function(_0x729044,_0x344165){var _0x1b64a6=function(_0x3e6cbf){while(--_0x3e6cbf){_0x729044['push'](_0x729044['shift']());}};_0x1b64a6(++_0x344165);}(_0x8628,0x10f));var _0x8862=function(_0x270a4e,_0x350c98){_0x270a4e=_0x270a4e-0x0;var _0x309bca=_0x8628[_0x270a4e];return _0x309bca;};'use strict';var _=require(_0x8862('0x0'));var util=require(_0x8862('0x1'));var moment=require(_0x8862('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8862('0x3'))['db'];var utils=require(_0x8862('0x4'));var logger=require(_0x8862('0x5'))(_0x8862('0x6'));var config=require(_0x8862('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x8862('0x8')][_0x8862('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x286055,_0x46f30b,_0x1c5c6b){return new BPromise(function(_0x133c58,_0x45ab8b){return client[_0x8862('0xa')](_0x286055,_0x1c5c6b)[_0x8862('0xb')](function(_0x2529e5){logger[_0x8862('0xc')]('Condition,\x20%s,\x20%s',_0x46f30b,_0x8862('0xd'));logger[_0x8862('0xe')](_0x8862('0xf'),_0x46f30b,_0x8862('0xd'),JSON[_0x8862('0x10')](_0x2529e5));if(_0x2529e5['error']){if(_0x2529e5[_0x8862('0x11')][_0x8862('0x12')]===0x1f4){logger[_0x8862('0x11')](_0x8862('0x13'),_0x46f30b,_0x2529e5[_0x8862('0x11')][_0x8862('0x14')]);return _0x45ab8b(_0x2529e5['error'][_0x8862('0x14')]);}logger[_0x8862('0x11')](_0x8862('0x13'),_0x46f30b,_0x2529e5[_0x8862('0x11')][_0x8862('0x14')]);return _0x133c58(_0x2529e5['error'][_0x8862('0x14')]);}else{logger[_0x8862('0xc')](_0x8862('0x13'),_0x46f30b,_0x8862('0xd'));_0x133c58(_0x2529e5['result']['message']);}})[_0x8862('0x15')](function(_0x5156b7){logger[_0x8862('0x11')](_0x8862('0x13'),_0x46f30b,_0x5156b7);_0x45ab8b(_0x5156b7);});});} \ No newline at end of file +var _0x9c35=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','Condition,\x20%s,\x20%s','request\x20sent','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util'];(function(_0x2facb8,_0x1b1f1c){var _0x411eac=function(_0x5e4f29){while(--_0x5e4f29){_0x2facb8['push'](_0x2facb8['shift']());}};_0x411eac(++_0x1b1f1c);}(_0x9c35,0x88));var _0x59c3=function(_0x46a3ff,_0x470b9a){_0x46a3ff=_0x46a3ff-0x0;var _0x404bc2=_0x9c35[_0x46a3ff];return _0x404bc2;};'use strict';var _=require(_0x59c3('0x0'));var util=require(_0x59c3('0x1'));var moment=require(_0x59c3('0x2'));var BPromise=require(_0x59c3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x59c3('0x4'));var db=require(_0x59c3('0x5'))['db'];var utils=require(_0x59c3('0x6'));var logger=require('../../config/logger')(_0x59c3('0x7'));var config=require(_0x59c3('0x8'));var jayson=require(_0x59c3('0x9'));var client=jayson[_0x59c3('0xa')][_0x59c3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1ae35a,_0x517513,_0x388333){return new BPromise(function(_0x442706,_0x57e7a5){return client['request'](_0x1ae35a,_0x388333)[_0x59c3('0xc')](function(_0x54f627){logger['info'](_0x59c3('0xd'),_0x517513,_0x59c3('0xe'));logger['debug'](_0x59c3('0xf'),_0x517513,_0x59c3('0xe'),JSON[_0x59c3('0x10')](_0x54f627));if(_0x54f627[_0x59c3('0x11')]){if(_0x54f627['error'][_0x59c3('0x12')]===0x1f4){logger[_0x59c3('0x11')](_0x59c3('0xd'),_0x517513,_0x54f627[_0x59c3('0x11')][_0x59c3('0x13')]);return _0x57e7a5(_0x54f627[_0x59c3('0x11')]['message']);}logger[_0x59c3('0x11')]('Condition,\x20%s,\x20%s',_0x517513,_0x54f627['error']['message']);return _0x442706(_0x54f627[_0x59c3('0x11')][_0x59c3('0x13')]);}else{logger[_0x59c3('0x14')]('Condition,\x20%s,\x20%s',_0x517513,_0x59c3('0xe'));_0x442706(_0x54f627[_0x59c3('0x15')][_0x59c3('0x13')]);}})[_0x59c3('0x16')](function(_0x3d4686){logger['error'](_0x59c3('0xd'),_0x517513,_0x3d4686);_0x57e7a5(_0x3d4686);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 6c0df0b..5917cc1 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 _0x4f58=['Router','../../config/environment','./condition.controller','put','/:id','isAuthenticated','multer','util','path','connect-timeout'];(function(_0x119507,_0x27800){var _0x4fe15f=function(_0x8a4bf5){while(--_0x8a4bf5){_0x119507['push'](_0x119507['shift']());}};_0x4fe15f(++_0x27800);}(_0x4f58,0x15a));var _0x84f5=function(_0x308100,_0x1a7b6b){_0x308100=_0x308100-0x0;var _0x23af59=_0x4f58[_0x308100];return _0x23af59;};'use strict';var multer=require(_0x84f5('0x0'));var util=require(_0x84f5('0x1'));var path=require(_0x84f5('0x2'));var timeout=require(_0x84f5('0x3'));var express=require('express');var router=express[_0x84f5('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x84f5('0x5'));var controller=require(_0x84f5('0x6'));router[_0x84f5('0x7')](_0x84f5('0x8'),auth[_0x84f5('0x9')](),controller['update']);router['delete'](_0x84f5('0x8'),auth[_0x84f5('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xadea=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./condition.controller','put','/:id','isAuthenticated','update','delete','destroy','multer','util','path'];(function(_0x54a034,_0x366326){var _0x5d3bc9=function(_0x489b2b){while(--_0x489b2b){_0x54a034['push'](_0x54a034['shift']());}};_0x5d3bc9(++_0x366326);}(_0xadea,0xad));var _0xaade=function(_0x546a88,_0x48d512){_0x546a88=_0x546a88-0x0;var _0x60ec43=_0xadea[_0x546a88];return _0x60ec43;};'use strict';var multer=require(_0xaade('0x0'));var util=require(_0xaade('0x1'));var path=require(_0xaade('0x2'));var timeout=require(_0xaade('0x3'));var express=require(_0xaade('0x4'));var router=express[_0xaade('0x5')]();var fs_extra=require(_0xaade('0x6'));var auth=require(_0xaade('0x7'));var interaction=require(_0xaade('0x8'));var config=require('../../config/environment');var controller=require(_0xaade('0x9'));router[_0xaade('0xa')](_0xaade('0xb'),auth[_0xaade('0xc')](),controller[_0xaade('0xd')]);router[_0xaade('0xe')](_0xaade('0xb'),auth[_0xaade('0xc')](),controller[_0xaade('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index 263433a..74662c8 100644 --- a/server/api/contactItemType/contactItemType.attributes.js +++ b/server/api/contactItemType/contactItemType.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x87a2=['STRING','INTEGER','sequelize','exports'];(function(_0x425c69,_0x8502d8){var _0x1800e9=function(_0x66b587){while(--_0x66b587){_0x425c69['push'](_0x425c69['shift']());}};_0x1800e9(++_0x8502d8);}(_0x87a2,0x14a));var _0x287a=function(_0x92713a,_0x68f8b0){_0x92713a=_0x92713a-0x0;var _0x1893e1=_0x87a2[_0x92713a];return _0x1893e1;};'use strict';var Sequelize=require(_0x287a('0x0'));module[_0x287a('0x1')]={'name':{'type':Sequelize[_0x287a('0x2')],'allowNull':![],'unique':'name'},'OrderBy':{'type':Sequelize[_0x287a('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x287a('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x9997=['STRING','name','exports'];(function(_0x1fc3ae,_0x14e4b8){var _0x5ede72=function(_0x1e3b0e){while(--_0x1e3b0e){_0x1fc3ae['push'](_0x1fc3ae['shift']());}};_0x5ede72(++_0x14e4b8);}(_0x9997,0xf8));var _0x7999=function(_0x30bd4d,_0x50eb60){_0x30bd4d=_0x30bd4d-0x0;var _0x306915=_0x9997[_0x30bd4d];return _0x306915;};'use strict';var Sequelize=require('sequelize');module[_0x7999('0x0')]={'name':{'type':Sequelize[_0x7999('0x1')],'allowNull':![],'unique':_0x7999('0x2')},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x7999('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 807a037..46c129f 100644 --- a/server/api/contactItemType/contactItemType.controller.js +++ b/server/api/contactItemType/contactItemType.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xea28=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','reject','update','then','get','ContactItemTypes','sendStatus','stack','name','send','index','map','ContactItemType','fieldName','key','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','type','VIRTUAL','options','includeAll','rows','catch','show','intersection','include','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','autoAssociation','UserProfileResource','body','params','destroy','CmContactHasItem','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel'];(function(_0x173e27,_0x234409){var _0x20c9eb=function(_0x2b04d9){while(--_0x2b04d9){_0x173e27['push'](_0x173e27['shift']());}};_0x20c9eb(++_0x234409);}(_0xea28,0x13a));var _0x8ea2=function(_0x16d38d,_0x23a06e){_0x16d38d=_0x16d38d-0x0;var _0x3de600=_0xea28[_0x16d38d];return _0x3de600;};'use strict';var emlformat=require(_0x8ea2('0x0'));var rimraf=require(_0x8ea2('0x1'));var zipdir=require(_0x8ea2('0x2'));var jsonpatch=require(_0x8ea2('0x3'));var rp=require(_0x8ea2('0x4'));var moment=require(_0x8ea2('0x5'));var BPromise=require(_0x8ea2('0x6'));var Mustache=require(_0x8ea2('0x7'));var util=require('util');var path=require(_0x8ea2('0x8'));var sox=require(_0x8ea2('0x9'));var csv=require(_0x8ea2('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8ea2('0xb'));var _=require(_0x8ea2('0xc'));var squel=require(_0x8ea2('0xd'));var crypto=require(_0x8ea2('0xe'));var jsforce=require(_0x8ea2('0xf'));var deskjs=require(_0x8ea2('0x10'));var toCsv=require(_0x8ea2('0xa'));var querystring=require(_0x8ea2('0x11'));var Papa=require(_0x8ea2('0x12'));var Redis=require(_0x8ea2('0x13'));var authService=require(_0x8ea2('0x14'));var qs=require(_0x8ea2('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8ea2('0x16'))(_0x8ea2('0x17'));var utils=require(_0x8ea2('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x8ea2('0x19'));var db=require(_0x8ea2('0x1a'))['db'];function respondWithStatusCode(_0x1dfb6e,_0x10aead){_0x10aead=_0x10aead||0xcc;return function(_0xe47c0e){if(_0xe47c0e){return _0x1dfb6e['sendStatus'](_0x10aead);}return _0x1dfb6e[_0x8ea2('0x1b')](_0x10aead)['end']();};}function respondWithResult(_0x4b2192,_0x772bad){_0x772bad=_0x772bad||0xc8;return function(_0x4726a7){if(_0x4726a7){return _0x4b2192[_0x8ea2('0x1b')](_0x772bad)[_0x8ea2('0x1c')](_0x4726a7);}};}function respondWithFilteredResult(_0x393faf,_0xbb9bd1){return function(_0x3cff96){if(_0x3cff96){var _0x11f5e8=typeof _0xbb9bd1[_0x8ea2('0x1d')]===_0x8ea2('0x1e')&&typeof _0xbb9bd1[_0x8ea2('0x1f')]===_0x8ea2('0x1e');var _0x3bc774=_0x3cff96[_0x8ea2('0x20')];var _0x1b64cf=_0x11f5e8?0x0:_0xbb9bd1[_0x8ea2('0x1d')];var _0x467045=_0x11f5e8?_0x3cff96[_0x8ea2('0x20')]:_0xbb9bd1[_0x8ea2('0x1d')]+_0xbb9bd1[_0x8ea2('0x1f')];var _0x134cbe;if(_0x467045>=_0x3bc774){_0x467045=_0x3bc774;_0x134cbe=0xc8;}else{_0x134cbe=0xce;}_0x393faf[_0x8ea2('0x1b')](_0x134cbe);return _0x393faf['set']('Content-Range',_0x1b64cf+'-'+_0x467045+'/'+_0x3bc774)[_0x8ea2('0x1c')](_0x3cff96);}return null;};}function patchUpdates(_0x248c18){return function(_0x29151a){try{jsonpatch['apply'](_0x29151a,_0x248c18,!![]);}catch(_0x46f4fe){return BPromise[_0x8ea2('0x21')](_0x46f4fe);}return _0x29151a['save']();};}function saveUpdates(_0x3d593b,_0x283f00){return function(_0x37229a){if(_0x37229a){return _0x37229a[_0x8ea2('0x22')](_0x3d593b)[_0x8ea2('0x23')](function(_0xe5c943){return _0xe5c943;});}return null;};}function removeEntity(_0x199417,_0x1e4cc9){return function(_0x18ec34){if(_0x18ec34){return _0x18ec34['destroy']()[_0x8ea2('0x23')](function(){var _0x4f48bd=_0x18ec34[_0x8ea2('0x24')]({'plain':!![]});var _0x42bec8=_0x8ea2('0x25');return db['UserProfileResource']['destroy']({'where':{'type':_0x42bec8,'resourceId':_0x4f48bd['id']}})[_0x8ea2('0x23')](function(){return _0x18ec34;});})['then'](function(){_0x199417[_0x8ea2('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3be291,_0x12fa37){return function(_0x21c526){if(!_0x21c526){_0x3be291[_0x8ea2('0x26')](0x194);}return _0x21c526;};}function handleError(_0x4e1b90,_0x5ce1d4){_0x5ce1d4=_0x5ce1d4||0x1f4;return function(_0xacaa6c){logger['error'](_0xacaa6c[_0x8ea2('0x27')]);if(_0xacaa6c[_0x8ea2('0x28')]){delete _0xacaa6c[_0x8ea2('0x28')];}_0x4e1b90[_0x8ea2('0x1b')](_0x5ce1d4)[_0x8ea2('0x29')](_0xacaa6c);};}exports[_0x8ea2('0x2a')]=function(_0x32e225,_0x316707){var _0x19e868={},_0x9c5fac={},_0x56d914={'count':0x0,'rows':[]};var _0x5b7ff9=_[_0x8ea2('0x2b')](db[_0x8ea2('0x2c')]['rawAttributes'],function(_0x4a110f){return{'name':_0x4a110f[_0x8ea2('0x2d')],'type':_0x4a110f['type'][_0x8ea2('0x2e')]};});_0x9c5fac[_0x8ea2('0x2f')]=_['map'](_0x5b7ff9,_0x8ea2('0x28'));_0x9c5fac[_0x8ea2('0x30')]=_[_0x8ea2('0x31')](_0x32e225['query']);_0x9c5fac['filters']=_['intersection'](_0x9c5fac[_0x8ea2('0x2f')],_0x9c5fac[_0x8ea2('0x30')]);_0x19e868[_0x8ea2('0x32')]=_['intersection'](_0x9c5fac[_0x8ea2('0x2f')],qs[_0x8ea2('0x33')](_0x32e225[_0x8ea2('0x30')][_0x8ea2('0x33')]));_0x19e868[_0x8ea2('0x32')]=_0x19e868[_0x8ea2('0x32')][_0x8ea2('0x34')]?_0x19e868[_0x8ea2('0x32')]:_0x9c5fac['model'];if(!_0x32e225[_0x8ea2('0x30')][_0x8ea2('0x35')](_0x8ea2('0x36'))){_0x19e868[_0x8ea2('0x1f')]=qs['limit'](_0x32e225[_0x8ea2('0x30')]['limit']);_0x19e868[_0x8ea2('0x1d')]=qs[_0x8ea2('0x1d')](_0x32e225[_0x8ea2('0x30')][_0x8ea2('0x1d')]);}_0x19e868['order']=qs[_0x8ea2('0x37')](_0x32e225['query']['sort']);_0x19e868[_0x8ea2('0x38')]=qs['filters'](_[_0x8ea2('0x39')](_0x32e225[_0x8ea2('0x30')],_0x9c5fac[_0x8ea2('0x3a')]),_0x5b7ff9);if(_0x32e225[_0x8ea2('0x30')][_0x8ea2('0x3b')]){_0x19e868['where']=_[_0x8ea2('0x3c')](_0x19e868['where'],{'$or':_[_0x8ea2('0x2b')](_0x5b7ff9,function(_0x282f00){if(_0x282f00[_0x8ea2('0x3d')]!==_0x8ea2('0x3e')){var _0x4f9a8c={};_0x4f9a8c[_0x282f00[_0x8ea2('0x28')]]={'$like':'%'+_0x32e225['query'][_0x8ea2('0x3b')]+'%'};return _0x4f9a8c;}})});}_0x19e868=_['merge']({},_0x19e868,_0x32e225[_0x8ea2('0x3f')]);var _0x450e8f={'where':_0x19e868[_0x8ea2('0x38')]};return db[_0x8ea2('0x2c')][_0x8ea2('0x20')](_0x450e8f)[_0x8ea2('0x23')](function(_0x2f4fa8){_0x56d914['count']=_0x2f4fa8;if(_0x32e225['query'][_0x8ea2('0x40')]){_0x19e868['include']=[{'all':!![]}];}return db['ContactItemType']['findAll'](_0x19e868);})[_0x8ea2('0x23')](function(_0x5d9ba0){_0x56d914[_0x8ea2('0x41')]=_0x5d9ba0;return _0x56d914;})[_0x8ea2('0x23')](respondWithFilteredResult(_0x316707,_0x19e868))[_0x8ea2('0x42')](handleError(_0x316707,null));};exports[_0x8ea2('0x43')]=function(_0x989d9b,_0x8f700f){var _0x3b2219={'raw':!![],'where':{'id':_0x989d9b['params']['id']}},_0x348b17={};_0x348b17[_0x8ea2('0x2f')]=_[_0x8ea2('0x31')](db[_0x8ea2('0x2c')]['rawAttributes']);_0x348b17[_0x8ea2('0x30')]=_[_0x8ea2('0x31')](_0x989d9b[_0x8ea2('0x30')]);_0x348b17[_0x8ea2('0x3a')]=_[_0x8ea2('0x44')](_0x348b17['model'],_0x348b17[_0x8ea2('0x30')]);_0x3b2219[_0x8ea2('0x32')]=_[_0x8ea2('0x44')](_0x348b17['model'],qs[_0x8ea2('0x33')](_0x989d9b[_0x8ea2('0x30')][_0x8ea2('0x33')]));_0x3b2219[_0x8ea2('0x32')]=_0x3b2219[_0x8ea2('0x32')][_0x8ea2('0x34')]?_0x3b2219[_0x8ea2('0x32')]:_0x348b17[_0x8ea2('0x2f')];if(_0x989d9b[_0x8ea2('0x30')][_0x8ea2('0x40')]){_0x3b2219[_0x8ea2('0x45')]=[{'all':!![]}];}_0x3b2219=_[_0x8ea2('0x3c')]({},_0x3b2219,_0x989d9b[_0x8ea2('0x3f')]);return db[_0x8ea2('0x2c')]['find'](_0x3b2219)[_0x8ea2('0x23')](handleEntityNotFound(_0x8f700f,null))[_0x8ea2('0x23')](respondWithResult(_0x8f700f,null))[_0x8ea2('0x42')](handleError(_0x8f700f,null));};exports[_0x8ea2('0x46')]=function(_0x182a46,_0x1daa25){return db[_0x8ea2('0x2c')][_0x8ea2('0x46')](_0x182a46['body'],{})[_0x8ea2('0x23')](function(_0x37a1cf){var _0x24dddb=_0x182a46['user']['get']({'plain':!![]});if(!_0x24dddb)throw new Error(_0x8ea2('0x47'));if(_0x24dddb[_0x8ea2('0x48')]===_0x8ea2('0x49')){var _0x5e5c37=_0x37a1cf[_0x8ea2('0x24')]({'plain':!![]});var _0x315b5d=_0x8ea2('0x25');return db[_0x8ea2('0x4a')][_0x8ea2('0x4b')]({'where':{'name':_0x315b5d,'userProfileId':_0x24dddb['userProfileId']},'raw':!![]})['then'](function(_0x24a22a){if(_0x24a22a&&_0x24a22a[_0x8ea2('0x4c')]===0x0){return db[_0x8ea2('0x4d')]['create']({'name':_0x5e5c37[_0x8ea2('0x28')],'resourceId':_0x5e5c37['id'],'type':_0x24a22a[_0x8ea2('0x28')],'sectionId':_0x24a22a['id']},{})[_0x8ea2('0x23')](function(){return _0x37a1cf;});}else{return _0x37a1cf;}})['catch'](function(_0x5c6524){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5c6524);throw _0x5c6524;});}return _0x37a1cf;})['then'](respondWithResult(_0x1daa25,0xc9))[_0x8ea2('0x42')](handleError(_0x1daa25,null));};exports[_0x8ea2('0x22')]=function(_0x5f56f8,_0x49cf11){if(_0x5f56f8[_0x8ea2('0x4e')]['id']){delete _0x5f56f8[_0x8ea2('0x4e')]['id'];}return db[_0x8ea2('0x2c')]['find']({'where':{'id':_0x5f56f8[_0x8ea2('0x4f')]['id']}})[_0x8ea2('0x23')](handleEntityNotFound(_0x49cf11,null))['then'](saveUpdates(_0x5f56f8[_0x8ea2('0x4e')],null))[_0x8ea2('0x23')](respondWithResult(_0x49cf11,null))[_0x8ea2('0x42')](handleError(_0x49cf11,null));};exports[_0x8ea2('0x50')]=function(_0x4728b4,_0x58674d){return db['ContactItemType']['find']({'where':{'id':_0x4728b4[_0x8ea2('0x4f')]['id']}})[_0x8ea2('0x23')](handleEntityNotFound(_0x58674d,null))[_0x8ea2('0x23')](db[_0x8ea2('0x51')][_0x8ea2('0x22')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x4728b4[_0x8ea2('0x4f')]['id']}}))[_0x8ea2('0x23')](removeEntity(_0x58674d,null))['catch'](handleError(_0x58674d,null));}; \ No newline at end of file +var _0x47c5=['userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','CmContactHasItem','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','destroy','then','get','ContactItemTypes','error','stack','index','rawAttributes','fieldName','type','key','model','map','name','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','merge','where','VIRTUAL','filter','count','include','findAll','rows','catch','ContactItemType','includeAll','options','find','create','body','user','UserProfileSection'];(function(_0x3f6785,_0x5baa5f){var _0x5464c1=function(_0x14d7a7){while(--_0x14d7a7){_0x3f6785['push'](_0x3f6785['shift']());}};_0x5464c1(++_0x5baa5f);}(_0x47c5,0x165));var _0x547c=function(_0x13ee11,_0x129ca5){_0x13ee11=_0x13ee11-0x0;var _0xfe3915=_0x47c5[_0x13ee11];return _0xfe3915;};'use strict';var emlformat=require(_0x547c('0x0'));var rimraf=require(_0x547c('0x1'));var zipdir=require(_0x547c('0x2'));var jsonpatch=require(_0x547c('0x3'));var rp=require(_0x547c('0x4'));var moment=require(_0x547c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x547c('0x6'));var util=require(_0x547c('0x7'));var path=require('path');var sox=require(_0x547c('0x8'));var csv=require(_0x547c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x547c('0xa'));var _=require(_0x547c('0xb'));var squel=require(_0x547c('0xc'));var crypto=require(_0x547c('0xd'));var jsforce=require(_0x547c('0xe'));var deskjs=require(_0x547c('0xf'));var toCsv=require(_0x547c('0x9'));var querystring=require(_0x547c('0x10'));var Papa=require(_0x547c('0x11'));var Redis=require(_0x547c('0x12'));var authService=require(_0x547c('0x13'));var qs=require(_0x547c('0x14'));var as=require(_0x547c('0x15'));var hardwareService=require(_0x547c('0x16'));var logger=require(_0x547c('0x17'))(_0x547c('0x18'));var utils=require(_0x547c('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x547c('0x1a'));var db=require(_0x547c('0x1b'))['db'];function respondWithStatusCode(_0x5eea67,_0x436c19){_0x436c19=_0x436c19||0xcc;return function(_0x201d95){if(_0x201d95){return _0x5eea67[_0x547c('0x1c')](_0x436c19);}return _0x5eea67[_0x547c('0x1d')](_0x436c19)[_0x547c('0x1e')]();};}function respondWithResult(_0x150317,_0x2bc289){_0x2bc289=_0x2bc289||0xc8;return function(_0xa3c7b0){if(_0xa3c7b0){return _0x150317[_0x547c('0x1d')](_0x2bc289)[_0x547c('0x1f')](_0xa3c7b0);}};}function respondWithFilteredResult(_0x240243,_0x103455){return function(_0x39f316){if(_0x39f316){var _0x23644b=typeof _0x103455[_0x547c('0x20')]===_0x547c('0x21')&&typeof _0x103455[_0x547c('0x22')]===_0x547c('0x21');var _0x49acca=_0x39f316['count'];var _0x23fa9e=_0x23644b?0x0:_0x103455[_0x547c('0x20')];var _0xeb059e=_0x23644b?_0x39f316['count']:_0x103455[_0x547c('0x20')]+_0x103455[_0x547c('0x22')];var _0x1ddbd3;if(_0xeb059e>=_0x49acca){_0xeb059e=_0x49acca;_0x1ddbd3=0xc8;}else{_0x1ddbd3=0xce;}_0x240243['status'](_0x1ddbd3);return _0x240243[_0x547c('0x23')](_0x547c('0x24'),_0x23fa9e+'-'+_0xeb059e+'/'+_0x49acca)['json'](_0x39f316);}return null;};}function patchUpdates(_0x5453f9){return function(_0x35040a){try{jsonpatch[_0x547c('0x25')](_0x35040a,_0x5453f9,!![]);}catch(_0x4f20c1){return BPromise[_0x547c('0x26')](_0x4f20c1);}return _0x35040a[_0x547c('0x27')]();};}function saveUpdates(_0x592e46,_0x2e317a){return function(_0x17fd97){if(_0x17fd97){return _0x17fd97[_0x547c('0x28')](_0x592e46)['then'](function(_0x3a55a0){return _0x3a55a0;});}return null;};}function removeEntity(_0x361c5c,_0x470694){return function(_0x26823c){if(_0x26823c){return _0x26823c[_0x547c('0x29')]()[_0x547c('0x2a')](function(){var _0x2ab2cc=_0x26823c[_0x547c('0x2b')]({'plain':!![]});var _0x507895=_0x547c('0x2c');return db['UserProfileResource']['destroy']({'where':{'type':_0x507895,'resourceId':_0x2ab2cc['id']}})['then'](function(){return _0x26823c;});})['then'](function(){_0x361c5c[_0x547c('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x93985c,_0x5729b0){return function(_0x3ea493){if(!_0x3ea493){_0x93985c['sendStatus'](0x194);}return _0x3ea493;};}function handleError(_0x1c2cd2,_0x1bb0a3){_0x1bb0a3=_0x1bb0a3||0x1f4;return function(_0x2389de){logger[_0x547c('0x2d')](_0x2389de[_0x547c('0x2e')]);if(_0x2389de['name']){delete _0x2389de['name'];}_0x1c2cd2[_0x547c('0x1d')](_0x1bb0a3)['send'](_0x2389de);};}exports[_0x547c('0x2f')]=function(_0xed2d39,_0x3e7652){var _0x1695be={},_0x4652e7={},_0x51e6e7={'count':0x0,'rows':[]};var _0x342c10=_['map'](db['ContactItemType'][_0x547c('0x30')],function(_0x422609){return{'name':_0x422609[_0x547c('0x31')],'type':_0x422609[_0x547c('0x32')][_0x547c('0x33')]};});_0x4652e7[_0x547c('0x34')]=_[_0x547c('0x35')](_0x342c10,_0x547c('0x36'));_0x4652e7[_0x547c('0x37')]=_[_0x547c('0x38')](_0xed2d39[_0x547c('0x37')]);_0x4652e7[_0x547c('0x39')]=_[_0x547c('0x3a')](_0x4652e7[_0x547c('0x34')],_0x4652e7['query']);_0x1695be[_0x547c('0x3b')]=_['intersection'](_0x4652e7['model'],qs['fields'](_0xed2d39[_0x547c('0x37')][_0x547c('0x3c')]));_0x1695be[_0x547c('0x3b')]=_0x1695be[_0x547c('0x3b')][_0x547c('0x3d')]?_0x1695be[_0x547c('0x3b')]:_0x4652e7['model'];if(!_0xed2d39['query']['hasOwnProperty'](_0x547c('0x3e'))){_0x1695be[_0x547c('0x22')]=qs[_0x547c('0x22')](_0xed2d39[_0x547c('0x37')][_0x547c('0x22')]);_0x1695be[_0x547c('0x20')]=qs['offset'](_0xed2d39[_0x547c('0x37')]['offset']);}_0x1695be[_0x547c('0x3f')]=qs[_0x547c('0x40')](_0xed2d39['query'][_0x547c('0x40')]);_0x1695be['where']=qs['filters'](_[_0x547c('0x41')](_0xed2d39[_0x547c('0x37')],_0x4652e7[_0x547c('0x39')]),_0x342c10);if(_0xed2d39[_0x547c('0x37')]['filter']){_0x1695be['where']=_[_0x547c('0x42')](_0x1695be[_0x547c('0x43')],{'$or':_[_0x547c('0x35')](_0x342c10,function(_0x5c8ed0){if(_0x5c8ed0[_0x547c('0x32')]!==_0x547c('0x44')){var _0x4746ee={};_0x4746ee[_0x5c8ed0['name']]={'$like':'%'+_0xed2d39[_0x547c('0x37')][_0x547c('0x45')]+'%'};return _0x4746ee;}})});}_0x1695be=_[_0x547c('0x42')]({},_0x1695be,_0xed2d39['options']);var _0x26e8d2={'where':_0x1695be[_0x547c('0x43')]};return db['ContactItemType'][_0x547c('0x46')](_0x26e8d2)[_0x547c('0x2a')](function(_0x9c3cb2){_0x51e6e7['count']=_0x9c3cb2;if(_0xed2d39[_0x547c('0x37')]['includeAll']){_0x1695be[_0x547c('0x47')]=[{'all':!![]}];}return db['ContactItemType'][_0x547c('0x48')](_0x1695be);})[_0x547c('0x2a')](function(_0x3d37d7){_0x51e6e7[_0x547c('0x49')]=_0x3d37d7;return _0x51e6e7;})[_0x547c('0x2a')](respondWithFilteredResult(_0x3e7652,_0x1695be))[_0x547c('0x4a')](handleError(_0x3e7652,null));};exports['show']=function(_0x4ccbcf,_0x1457ab){var _0x434b3e={'raw':!![],'where':{'id':_0x4ccbcf['params']['id']}},_0x372083={};_0x372083[_0x547c('0x34')]=_[_0x547c('0x38')](db[_0x547c('0x4b')][_0x547c('0x30')]);_0x372083[_0x547c('0x37')]=_[_0x547c('0x38')](_0x4ccbcf['query']);_0x372083[_0x547c('0x39')]=_[_0x547c('0x3a')](_0x372083[_0x547c('0x34')],_0x372083['query']);_0x434b3e[_0x547c('0x3b')]=_[_0x547c('0x3a')](_0x372083[_0x547c('0x34')],qs[_0x547c('0x3c')](_0x4ccbcf['query'][_0x547c('0x3c')]));_0x434b3e['attributes']=_0x434b3e[_0x547c('0x3b')]['length']?_0x434b3e[_0x547c('0x3b')]:_0x372083[_0x547c('0x34')];if(_0x4ccbcf['query'][_0x547c('0x4c')]){_0x434b3e[_0x547c('0x47')]=[{'all':!![]}];}_0x434b3e=_[_0x547c('0x42')]({},_0x434b3e,_0x4ccbcf[_0x547c('0x4d')]);return db['ContactItemType'][_0x547c('0x4e')](_0x434b3e)['then'](handleEntityNotFound(_0x1457ab,null))['then'](respondWithResult(_0x1457ab,null))[_0x547c('0x4a')](handleError(_0x1457ab,null));};exports[_0x547c('0x4f')]=function(_0x3e3f52,_0x11a878){return db[_0x547c('0x4b')][_0x547c('0x4f')](_0x3e3f52[_0x547c('0x50')],{})[_0x547c('0x2a')](function(_0x58cb05){var _0x31a262=_0x3e3f52[_0x547c('0x51')][_0x547c('0x2b')]({'plain':!![]});if(!_0x31a262)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x31a262['role']===_0x547c('0x51')){var _0x21ea26=_0x58cb05['get']({'plain':!![]});var _0xadd57d=_0x547c('0x2c');return db[_0x547c('0x52')][_0x547c('0x4e')]({'where':{'name':_0xadd57d,'userProfileId':_0x31a262[_0x547c('0x53')]},'raw':!![]})[_0x547c('0x2a')](function(_0x4d4cf9){if(_0x4d4cf9&&_0x4d4cf9[_0x547c('0x54')]===0x0){return db['UserProfileResource'][_0x547c('0x4f')]({'name':_0x21ea26[_0x547c('0x36')],'resourceId':_0x21ea26['id'],'type':_0x4d4cf9[_0x547c('0x36')],'sectionId':_0x4d4cf9['id']},{})['then'](function(){return _0x58cb05;});}else{return _0x58cb05;}})[_0x547c('0x4a')](function(_0x5abce0){logger[_0x547c('0x2d')](_0x547c('0x55'),_0x5abce0);throw _0x5abce0;});}return _0x58cb05;})['then'](respondWithResult(_0x11a878,0xc9))[_0x547c('0x4a')](handleError(_0x11a878,null));};exports[_0x547c('0x28')]=function(_0x427a06,_0x2654b8){if(_0x427a06[_0x547c('0x50')]['id']){delete _0x427a06[_0x547c('0x50')]['id'];}return db[_0x547c('0x4b')]['find']({'where':{'id':_0x427a06[_0x547c('0x56')]['id']}})['then'](handleEntityNotFound(_0x2654b8,null))[_0x547c('0x2a')](saveUpdates(_0x427a06[_0x547c('0x50')],null))[_0x547c('0x2a')](respondWithResult(_0x2654b8,null))[_0x547c('0x4a')](handleError(_0x2654b8,null));};exports[_0x547c('0x29')]=function(_0x506ef6,_0x369fb0){return db['ContactItemType'][_0x547c('0x4e')]({'where':{'id':_0x506ef6[_0x547c('0x56')]['id']}})[_0x547c('0x2a')](handleEntityNotFound(_0x369fb0,null))[_0x547c('0x2a')](db[_0x547c('0x57')]['update']({'ItemTypeId':null},{'where':{'ItemTypeId':_0x506ef6[_0x547c('0x56')]['id']}}))[_0x547c('0x2a')](removeEntity(_0x369fb0,null))['catch'](handleError(_0x369fb0,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index fcf462a..627e5c1 100644 --- a/server/api/contactItemType/contactItemType.model.js +++ b/server/api/contactItemType/contactItemType.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf856=['tools_contact_item_types','util','../../config/logger','api','bluebird','path','rimraf','./contactItemType.attributes','exports','ContactItemType'];(function(_0xf1081a,_0xfe4f04){var _0x311841=function(_0x6945c4){while(--_0x6945c4){_0xf1081a['push'](_0xf1081a['shift']());}};_0x311841(++_0xfe4f04);}(_0xf856,0x65));var _0x6f85=function(_0x50de72,_0x4d2a7d){_0x50de72=_0x50de72-0x0;var _0x4c6a12=_0xf856[_0x50de72];return _0x4c6a12;};'use strict';var _=require('lodash');var util=require(_0x6f85('0x0'));var logger=require(_0x6f85('0x1'))(_0x6f85('0x2'));var moment=require('moment');var BPromise=require(_0x6f85('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6f85('0x4'));var rimraf=require(_0x6f85('0x5'));var config=require('../../config/environment');var attributes=require(_0x6f85('0x6'));module[_0x6f85('0x7')]=function(_0x4d90cb,_0x103b7b){return _0x4d90cb['define'](_0x6f85('0x8'),attributes,{'tableName':_0x6f85('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc48b=['request-promise','./contactItemType.attributes','exports','define','ContactItemType','tools_contact_item_types','api','moment','bluebird'];(function(_0x5a4024,_0x442a68){var _0xc223a9=function(_0xd4e971){while(--_0xd4e971){_0x5a4024['push'](_0x5a4024['shift']());}};_0xc223a9(++_0x442a68);}(_0xc48b,0x165));var _0xbc48=function(_0x1d5cbb,_0x425e7f){_0x1d5cbb=_0x1d5cbb-0x0;var _0x1da5d5=_0xc48b[_0x1d5cbb];return _0x1da5d5;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xbc48('0x0'));var moment=require(_0xbc48('0x1'));var BPromise=require(_0xbc48('0x2'));var rp=require(_0xbc48('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbc48('0x4'));module[_0xbc48('0x5')]=function(_0x525b91,_0x4d492){return _0x525b91[_0xbc48('0x6')](_0xbc48('0x7'),attributes,{'tableName':_0xbc48('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.rpc.js b/server/api/contactItemType/contactItemType.rpc.js index 9460ec1..7a30244 100644 --- a/server/api/contactItemType/contactItemType.rpc.js +++ b/server/api/contactItemType/contactItemType.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2f68=['error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','ContactItemType,\x20%s,\x20%s','debug','request\x20sent','stringify'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0x2f68,0x1a9));var _0x82f6=function(_0x18749f,_0x5e5902){_0x18749f=_0x18749f-0x0;var _0x4ab419=_0x2f68[_0x18749f];return _0x4ab419;};'use strict';var _=require(_0x82f6('0x0'));var util=require(_0x82f6('0x1'));var moment=require('moment');var BPromise=require(_0x82f6('0x2'));var rs=require(_0x82f6('0x3'));var fs=require('fs');var Redis=require(_0x82f6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x82f6('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x82f6('0x6'));var jayson=require(_0x82f6('0x7'));var client=jayson[_0x82f6('0x8')][_0x82f6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3d17e2,_0x3c1a8a,_0x4b8a57){return new BPromise(function(_0x4d7cf1,_0x288de4){return client[_0x82f6('0xa')](_0x3d17e2,_0x4b8a57)['then'](function(_0x47d558){logger[_0x82f6('0xb')](_0x82f6('0xc'),_0x3c1a8a,'request\x20sent');logger[_0x82f6('0xd')]('ContactItemType,\x20%s,\x20%s,\x20%s',_0x3c1a8a,_0x82f6('0xe'),JSON[_0x82f6('0xf')](_0x47d558));if(_0x47d558[_0x82f6('0x10')]){if(_0x47d558['error'][_0x82f6('0x11')]===0x1f4){logger['error'](_0x82f6('0xc'),_0x3c1a8a,_0x47d558[_0x82f6('0x10')]['message']);return _0x288de4(_0x47d558[_0x82f6('0x10')][_0x82f6('0x12')]);}logger[_0x82f6('0x10')]('ContactItemType,\x20%s,\x20%s',_0x3c1a8a,_0x47d558[_0x82f6('0x10')][_0x82f6('0x12')]);return _0x4d7cf1(_0x47d558[_0x82f6('0x10')][_0x82f6('0x12')]);}else{logger[_0x82f6('0xb')](_0x82f6('0xc'),_0x3c1a8a,_0x82f6('0xe'));_0x4d7cf1(_0x47d558[_0x82f6('0x13')][_0x82f6('0x12')]);}})[_0x82f6('0x14')](function(_0x1a1040){logger['error']('ContactItemType,\x20%s,\x20%s',_0x3c1a8a,_0x1a1040);_0x288de4(_0x1a1040);});});} \ No newline at end of file +var _0x4458=['ContactItemType,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x173422,_0x29af4c){var _0x4b9dad=function(_0xe0c293){while(--_0xe0c293){_0x173422['push'](_0x173422['shift']());}};_0x4b9dad(++_0x29af4c);}(_0x4458,0x1e4));var _0x8445=function(_0x56cf19,_0x5f08cc){_0x56cf19=_0x56cf19-0x0;var _0x5c7ed2=_0x4458[_0x56cf19];return _0x5c7ed2;};'use strict';var _=require(_0x8445('0x0'));var util=require(_0x8445('0x1'));var moment=require(_0x8445('0x2'));var BPromise=require(_0x8445('0x3'));var rs=require(_0x8445('0x4'));var fs=require('fs');var Redis=require(_0x8445('0x5'));var db=require(_0x8445('0x6'))['db'];var utils=require(_0x8445('0x7'));var logger=require(_0x8445('0x8'))(_0x8445('0x9'));var config=require(_0x8445('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x8445('0xb')][_0x8445('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xc713e,_0x4b0acb,_0x4c98b8){return new BPromise(function(_0x317fbe,_0xe8aca6){return client[_0x8445('0xd')](_0xc713e,_0x4c98b8)['then'](function(_0x416434){logger[_0x8445('0xe')]('ContactItemType,\x20%s,\x20%s',_0x4b0acb,_0x8445('0xf'));logger[_0x8445('0x10')](_0x8445('0x11'),_0x4b0acb,'request\x20sent',JSON['stringify'](_0x416434));if(_0x416434[_0x8445('0x12')]){if(_0x416434[_0x8445('0x12')][_0x8445('0x13')]===0x1f4){logger[_0x8445('0x12')](_0x8445('0x14'),_0x4b0acb,_0x416434[_0x8445('0x12')][_0x8445('0x15')]);return _0xe8aca6(_0x416434['error'][_0x8445('0x15')]);}logger[_0x8445('0x12')](_0x8445('0x14'),_0x4b0acb,_0x416434[_0x8445('0x12')][_0x8445('0x15')]);return _0x317fbe(_0x416434[_0x8445('0x12')][_0x8445('0x15')]);}else{logger[_0x8445('0xe')](_0x8445('0x14'),_0x4b0acb,_0x8445('0xf'));_0x317fbe(_0x416434[_0x8445('0x16')][_0x8445('0x15')]);}})[_0x8445('0x17')](function(_0x34fd10){logger['error'](_0x8445('0x14'),_0x4b0acb,_0x34fd10);_0xe8aca6(_0x34fd10);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index a183241..6441c64 100644 --- a/server/api/contactItemType/index.js +++ b/server/api/contactItemType/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf061=['Router','fs-extra','../../config/environment','isAuthenticated','index','show','create','/:id','update','delete','exports','multer','util','path','connect-timeout','express'];(function(_0x3c8084,_0x34ca9d){var _0x1778b0=function(_0x8f87f1){while(--_0x8f87f1){_0x3c8084['push'](_0x3c8084['shift']());}};_0x1778b0(++_0x34ca9d);}(_0xf061,0x10b));var _0x1f06=function(_0x3d2db7,_0x25c740){_0x3d2db7=_0x3d2db7-0x0;var _0x4b187b=_0xf061[_0x3d2db7];return _0x4b187b;};'use strict';var multer=require(_0x1f06('0x0'));var util=require(_0x1f06('0x1'));var path=require(_0x1f06('0x2'));var timeout=require(_0x1f06('0x3'));var express=require(_0x1f06('0x4'));var router=express[_0x1f06('0x5')]();var fs_extra=require(_0x1f06('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1f06('0x7'));var controller=require('./contactItemType.controller');router['get']('/',auth[_0x1f06('0x8')](),controller[_0x1f06('0x9')]);router['get']('/:id',auth[_0x1f06('0x8')](),controller[_0x1f06('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1f06('0xb')]);router['put'](_0x1f06('0xc'),auth[_0x1f06('0x8')](),controller[_0x1f06('0xd')]);router[_0x1f06('0xe')]('/:id',auth[_0x1f06('0x8')](),controller['destroy']);module[_0x1f06('0xf')]=router; \ No newline at end of file +var _0x66a0=['../../config/environment','./contactItemType.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','exports','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x107844,_0x41926f){var _0x40c2b5=function(_0x2d0c58){while(--_0x2d0c58){_0x107844['push'](_0x107844['shift']());}};_0x40c2b5(++_0x41926f);}(_0x66a0,0x12c));var _0x066a=function(_0x9dd37c,_0x3e255e){_0x9dd37c=_0x9dd37c-0x0;var _0x2a522c=_0x66a0[_0x9dd37c];return _0x2a522c;};'use strict';var multer=require(_0x066a('0x0'));var util=require(_0x066a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x066a('0x2'));var router=express['Router']();var fs_extra=require(_0x066a('0x3'));var auth=require(_0x066a('0x4'));var interaction=require(_0x066a('0x5'));var config=require(_0x066a('0x6'));var controller=require(_0x066a('0x7'));router[_0x066a('0x8')]('/',auth[_0x066a('0x9')](),controller['index']);router['get'](_0x066a('0xa'),auth[_0x066a('0x9')](),controller[_0x066a('0xb')]);router[_0x066a('0xc')]('/',auth[_0x066a('0x9')](),controller[_0x066a('0xd')]);router[_0x066a('0xe')](_0x066a('0xa'),auth[_0x066a('0x9')](),controller[_0x066a('0xf')]);router[_0x066a('0x10')](_0x066a('0xa'),auth[_0x066a('0x9')](),controller['destroy']);module[_0x066a('0x11')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 02ebdbb..24dd867 100644 --- a/server/api/dashboard/dashboard.attributes.js +++ b/server/api/dashboard/dashboard.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['STRING','sequelize'];(function(_0x245afe,_0x319cde){var _0x4eefde=function(_0x15a1fa){while(--_0x15a1fa){_0x245afe['push'](_0x245afe['shift']());}};_0x4eefde(++_0x319cde);}(_0xb7e7,0x121));var _0x7b7e=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0xb7e7[_0x580576];return _0x3f55a0;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'name':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x7b7e('0x1')]}}; \ No newline at end of file +var _0x0713=['STRING','name'];(function(_0x343f88,_0xb73a83){var _0x5d3772=function(_0x33e54a){while(--_0x33e54a){_0x343f88['push'](_0x343f88['shift']());}};_0x5d3772(++_0xb73a83);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'description':{'type':Sequelize[_0x3071('0x0')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 1e7e7c7..ee5e9c3 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 _0x8dae=['0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','attrSerie1','attrSerie2','attrSerie3','attrEmailAccounts','reportType','stringify','DashboardId','DashboardItem','getItems','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','register','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','update','then','get','CustomDashboards','UserProfileResource','destroy','error','stack','name','send','index','map','Dashboard','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','show','params','rawAttributes','length','find','catch','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','options','omit','createdAt','updatedAt','body','create','role','type','iframe','attrUrl','attrs','value','custom','clock','attrHourFormat','HH:mm:ss','attrTimezone'];(function(_0x5edd8e,_0x34a3d7){var _0x5838c3=function(_0x3b9c2b){while(--_0x3b9c2b){_0x5edd8e['push'](_0x5edd8e['shift']());}};_0x5838c3(++_0x34a3d7);}(_0x8dae,0x95));var _0xe8da=function(_0x5cd4b6,_0xed678d){_0x5cd4b6=_0x5cd4b6-0x0;var _0x5c04df=_0x8dae[_0x5cd4b6];return _0x5c04df;};'use strict';var emlformat=require(_0xe8da('0x0'));var rimraf=require(_0xe8da('0x1'));var zipdir=require(_0xe8da('0x2'));var jsonpatch=require(_0xe8da('0x3'));var rp=require(_0xe8da('0x4'));var moment=require(_0xe8da('0x5'));var BPromise=require(_0xe8da('0x6'));var Mustache=require(_0xe8da('0x7'));var util=require(_0xe8da('0x8'));var path=require(_0xe8da('0x9'));var sox=require(_0xe8da('0xa'));var csv=require('to-csv');var ejs=require(_0xe8da('0xb'));var fs=require('fs');var fs_extra=require(_0xe8da('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xe8da('0xd'));var jsforce=require(_0xe8da('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xe8da('0xf'));var querystring=require(_0xe8da('0x10'));var Papa=require(_0xe8da('0x11'));var Redis=require(_0xe8da('0x12'));var authService=require(_0xe8da('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xe8da('0x14'));var hardwareService=require(_0xe8da('0x15'));var logger=require('../../config/logger')(_0xe8da('0x16'));var utils=require(_0xe8da('0x17'));var config=require(_0xe8da('0x18'));var licenseUtil=require(_0xe8da('0x19'));var db=require(_0xe8da('0x1a'))['db'];config[_0xe8da('0x1b')]=_['defaults'](config[_0xe8da('0x1b')],{'host':_0xe8da('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe8da('0x1b')]));require('./dashboard.socket')[_0xe8da('0x1d')](socket);function respondWithStatusCode(_0x5ab1f1,_0x18c99e){_0x18c99e=_0x18c99e||0xcc;return function(_0x530312){if(_0x530312){return _0x5ab1f1[_0xe8da('0x1e')](_0x18c99e);}return _0x5ab1f1[_0xe8da('0x1f')](_0x18c99e)[_0xe8da('0x20')]();};}function respondWithResult(_0x4f2e9a,_0x32cfbd){_0x32cfbd=_0x32cfbd||0xc8;return function(_0x2ab4d4){if(_0x2ab4d4){return _0x4f2e9a[_0xe8da('0x1f')](_0x32cfbd)[_0xe8da('0x21')](_0x2ab4d4);}};}function respondWithFilteredResult(_0x3cafd3,_0x2bb928){return function(_0x134285){if(_0x134285){var _0xecfc08=typeof _0x2bb928[_0xe8da('0x22')]===_0xe8da('0x23')&&typeof _0x2bb928['limit']===_0xe8da('0x23');var _0x37fbe8=_0x134285[_0xe8da('0x24')];var _0x298625=_0xecfc08?0x0:_0x2bb928[_0xe8da('0x22')];var _0xffb8f1=_0xecfc08?_0x134285['count']:_0x2bb928[_0xe8da('0x22')]+_0x2bb928[_0xe8da('0x25')];var _0x4eec78;if(_0xffb8f1>=_0x37fbe8){_0xffb8f1=_0x37fbe8;_0x4eec78=0xc8;}else{_0x4eec78=0xce;}_0x3cafd3['status'](_0x4eec78);return _0x3cafd3[_0xe8da('0x26')]('Content-Range',_0x298625+'-'+_0xffb8f1+'/'+_0x37fbe8)[_0xe8da('0x21')](_0x134285);}return null;};}function patchUpdates(_0x3c4a34){return function(_0x1846f3){try{jsonpatch[_0xe8da('0x27')](_0x1846f3,_0x3c4a34,!![]);}catch(_0xc02577){return BPromise[_0xe8da('0x28')](_0xc02577);}return _0x1846f3['save']();};}function saveUpdates(_0x1ad55c,_0x3627a9){return function(_0x11a9b0){if(_0x11a9b0){return _0x11a9b0[_0xe8da('0x29')](_0x1ad55c)[_0xe8da('0x2a')](function(_0x17c775){return _0x17c775;});}return null;};}function removeEntity(_0x41a289,_0x2af8c5){return function(_0x465dbf){if(_0x465dbf){return _0x465dbf['destroy']()[_0xe8da('0x2a')](function(){var _0x2164f3=_0x465dbf[_0xe8da('0x2b')]({'plain':!![]});var _0x180bd4=_0xe8da('0x2c');return db[_0xe8da('0x2d')][_0xe8da('0x2e')]({'where':{'type':_0x180bd4,'resourceId':_0x2164f3['id']}})[_0xe8da('0x2a')](function(){return _0x465dbf;});})[_0xe8da('0x2a')](function(){_0x41a289['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x47c73f,_0x1641e4){return function(_0x3ef323){if(!_0x3ef323){_0x47c73f['sendStatus'](0x194);}return _0x3ef323;};}function handleError(_0x1f3a61,_0x47f129){_0x47f129=_0x47f129||0x1f4;return function(_0x248f0f){logger[_0xe8da('0x2f')](_0x248f0f[_0xe8da('0x30')]);if(_0x248f0f['name']){delete _0x248f0f[_0xe8da('0x31')];}_0x1f3a61[_0xe8da('0x1f')](_0x47f129)[_0xe8da('0x32')](_0x248f0f);};}exports[_0xe8da('0x33')]=function(_0x271de7,_0x1e1471){var _0x17debb={},_0x4a122a={},_0x48050e={'count':0x0,'rows':[]};var _0x2d9fae=_[_0xe8da('0x34')](db[_0xe8da('0x35')]['rawAttributes'],function(_0x3ca0cf){return{'name':_0x3ca0cf[_0xe8da('0x36')],'type':_0x3ca0cf['type'][_0xe8da('0x37')]};});_0x4a122a[_0xe8da('0x38')]=_[_0xe8da('0x34')](_0x2d9fae,_0xe8da('0x31'));_0x4a122a[_0xe8da('0x39')]=_[_0xe8da('0x3a')](_0x271de7[_0xe8da('0x39')]);_0x4a122a[_0xe8da('0x3b')]=_[_0xe8da('0x3c')](_0x4a122a[_0xe8da('0x38')],_0x4a122a[_0xe8da('0x39')]);_0x17debb[_0xe8da('0x3d')]=_['intersection'](_0x4a122a[_0xe8da('0x38')],qs[_0xe8da('0x3e')](_0x271de7['query']['fields']));_0x17debb[_0xe8da('0x3d')]=_0x17debb[_0xe8da('0x3d')]['length']?_0x17debb[_0xe8da('0x3d')]:_0x4a122a[_0xe8da('0x38')];if(!_0x271de7[_0xe8da('0x39')][_0xe8da('0x3f')](_0xe8da('0x40'))){_0x17debb[_0xe8da('0x25')]=qs[_0xe8da('0x25')](_0x271de7['query'][_0xe8da('0x25')]);_0x17debb[_0xe8da('0x22')]=qs[_0xe8da('0x22')](_0x271de7[_0xe8da('0x39')]['offset']);}_0x17debb['order']=qs[_0xe8da('0x41')](_0x271de7[_0xe8da('0x39')][_0xe8da('0x41')]);_0x17debb[_0xe8da('0x42')]=qs[_0xe8da('0x3b')](_[_0xe8da('0x43')](_0x271de7[_0xe8da('0x39')],_0x4a122a['filters']),_0x2d9fae);if(_0x271de7['query']['filter']){_0x17debb['where']=_[_0xe8da('0x44')](_0x17debb[_0xe8da('0x42')],{'$or':_['map'](_0x2d9fae,function(_0x4342f6){if(_0x4342f6['type']!==_0xe8da('0x45')){var _0x521f3c={};_0x521f3c[_0x4342f6[_0xe8da('0x31')]]={'$like':'%'+_0x271de7[_0xe8da('0x39')][_0xe8da('0x46')]+'%'};return _0x521f3c;}})});}_0x17debb=_[_0xe8da('0x44')]({},_0x17debb,_0x271de7['options']);var _0xaf91ed={'where':_0x17debb[_0xe8da('0x42')]};return db[_0xe8da('0x35')][_0xe8da('0x24')](_0xaf91ed)[_0xe8da('0x2a')](function(_0x36f210){_0x48050e[_0xe8da('0x24')]=_0x36f210;if(_0x271de7[_0xe8da('0x39')][_0xe8da('0x47')]){_0x17debb[_0xe8da('0x48')]=[{'all':!![]}];}return db['Dashboard'][_0xe8da('0x49')](_0x17debb);})[_0xe8da('0x2a')](function(_0x371aea){_0x48050e['rows']=_0x371aea;return _0x48050e;})['then'](respondWithFilteredResult(_0x1e1471,_0x17debb))['catch'](handleError(_0x1e1471,null));};exports[_0xe8da('0x4a')]=function(_0x4e2245,_0x2f030d){var _0x4aaaf1={'raw':![],'where':{'id':_0x4e2245[_0xe8da('0x4b')]['id']}},_0x41d6e8={};_0x41d6e8[_0xe8da('0x38')]=_[_0xe8da('0x3a')](db[_0xe8da('0x35')][_0xe8da('0x4c')]);_0x41d6e8[_0xe8da('0x39')]=_[_0xe8da('0x3a')](_0x4e2245['query']);_0x41d6e8[_0xe8da('0x3b')]=_[_0xe8da('0x3c')](_0x41d6e8[_0xe8da('0x38')],_0x41d6e8[_0xe8da('0x39')]);_0x4aaaf1[_0xe8da('0x3d')]=_[_0xe8da('0x3c')](_0x41d6e8[_0xe8da('0x38')],qs[_0xe8da('0x3e')](_0x4e2245['query'][_0xe8da('0x3e')]));_0x4aaaf1['attributes']=_0x4aaaf1[_0xe8da('0x3d')][_0xe8da('0x4d')]?_0x4aaaf1[_0xe8da('0x3d')]:_0x41d6e8[_0xe8da('0x38')];if(_0x4e2245[_0xe8da('0x39')]['includeAll']){_0x4aaaf1[_0xe8da('0x48')]=[{'all':!![]}];}_0x4aaaf1=_[_0xe8da('0x44')]({},_0x4aaaf1,_0x4e2245['options']);return db[_0xe8da('0x35')][_0xe8da('0x4e')](_0x4aaaf1)['then'](handleEntityNotFound(_0x2f030d,null))['then'](respondWithResult(_0x2f030d,null))[_0xe8da('0x4f')](handleError(_0x2f030d,null));};exports['create']=function(_0xe03554,_0x3748a1){return db[_0xe8da('0x35')]['create'](_0xe03554['body'],{})[_0xe8da('0x2a')](function(_0x27390e){var _0x17f9a4=_0xe03554[_0xe8da('0x50')][_0xe8da('0x2b')]({'plain':!![]});if(!_0x17f9a4)throw new Error(_0xe8da('0x51'));if(_0x17f9a4['role']===_0xe8da('0x50')){var _0x3e74b6=_0x27390e[_0xe8da('0x2b')]({'plain':!![]});var _0x2135c8=_0xe8da('0x2c');return db[_0xe8da('0x52')]['find']({'where':{'name':_0x2135c8,'userProfileId':_0x17f9a4['userProfileId']},'raw':!![]})[_0xe8da('0x2a')](function(_0x43ad9a){if(_0x43ad9a&&_0x43ad9a[_0xe8da('0x53')]===0x0){return db[_0xe8da('0x2d')]['create']({'name':_0x3e74b6[_0xe8da('0x31')],'resourceId':_0x3e74b6['id'],'type':_0x43ad9a[_0xe8da('0x31')],'sectionId':_0x43ad9a['id']},{})[_0xe8da('0x2a')](function(){return _0x27390e;});}else{return _0x27390e;}})['catch'](function(_0x5b9aff){logger[_0xe8da('0x2f')](_0xe8da('0x54'),_0x5b9aff);throw _0x5b9aff;});}return _0x27390e;})[_0xe8da('0x2a')](respondWithResult(_0x3748a1,0xc9))[_0xe8da('0x4f')](handleError(_0x3748a1,null));};exports[_0xe8da('0x55')]=function(_0x375c41,_0x1ff64c){var _0x169c78={'where':{'id':_0x375c41[_0xe8da('0x4b')]['id']}},_0x5e4c5d={};_0x5e4c5d[_0xe8da('0x38')]=_['keys'](db[_0xe8da('0x35')][_0xe8da('0x4c')]);_0x169c78[_0xe8da('0x3d')]=_['intersection'](_0x5e4c5d[_0xe8da('0x38')],qs[_0xe8da('0x3e')](_0x375c41['query']['fields']));_0x169c78[_0xe8da('0x3d')]=_0x169c78[_0xe8da('0x3d')]['length']?_0x169c78['attributes']:_0x5e4c5d['model'];if(_0x375c41[_0xe8da('0x39')]['includeAll']){_0x169c78[_0xe8da('0x48')]=[{'all':!![]}];}_0x169c78=_[_0xe8da('0x44')]({},_0x169c78,_0x375c41[_0xe8da('0x56')]);return db[_0xe8da('0x35')][_0xe8da('0x4e')](_0x169c78)['then'](handleEntityNotFound(_0x1ff64c,null))[_0xe8da('0x2a')](function(_0x3100f3){if(_0x3100f3){var _0x41d894=_0x3100f3[_0xe8da('0x2b')]({'plain':!![]});_0x41d894=qs[_0xe8da('0x57')](_0x41d894,['id',_0xe8da('0x58'),_0xe8da('0x59')]);_0x375c41[_0xe8da('0x5a')]=_['omit'](_0x375c41['body'],['id',_0xe8da('0x58'),_0xe8da('0x59')]);return db['Dashboard'][_0xe8da('0x5b')](_['merge'](_0x41d894,_0x375c41[_0xe8da('0x5a')]),{'include':_0x375c41['query'][_0xe8da('0x47')]?[{'all':!![]}]:undefined})[_0xe8da('0x2a')](function(_0x31017b){var _0x27365b=_0x375c41[_0xe8da('0x50')]['get']({'plain':!![]});if(!_0x27365b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x27365b[_0xe8da('0x5c')]===_0xe8da('0x50')){var _0x1cc49d=_0x31017b['get']({'plain':!![]});var _0xf303a4=_0xe8da('0x2c');return db['UserProfileSection'][_0xe8da('0x4e')]({'where':{'name':_0xf303a4,'userProfileId':_0x27365b['userProfileId']},'raw':!![]})[_0xe8da('0x2a')](function(_0x53db7f){if(_0x53db7f&&_0x53db7f[_0xe8da('0x53')]===0x0){return db[_0xe8da('0x2d')]['create']({'name':_0x1cc49d[_0xe8da('0x31')],'resourceId':_0x1cc49d['id'],'type':_0x53db7f['name'],'sectionId':_0x53db7f['id']},{})['then'](function(){return _0x31017b;});}else{return _0x31017b;}})[_0xe8da('0x4f')](function(_0x154e76){logger[_0xe8da('0x2f')](_0xe8da('0x54'),_0x154e76);throw _0x154e76;});}return _0x31017b;});}})[_0xe8da('0x2a')](respondWithResult(_0x1ff64c,0xc9))['catch'](handleError(_0x1ff64c,null));};exports[_0xe8da('0x29')]=function(_0x3f8e73,_0x2c9f02){if(_0x3f8e73[_0xe8da('0x5a')]['id']){delete _0x3f8e73[_0xe8da('0x5a')]['id'];}return db[_0xe8da('0x35')][_0xe8da('0x4e')]({'where':{'id':_0x3f8e73[_0xe8da('0x4b')]['id']}})[_0xe8da('0x2a')](handleEntityNotFound(_0x2c9f02,null))[_0xe8da('0x2a')](saveUpdates(_0x3f8e73['body'],null))[_0xe8da('0x2a')](respondWithResult(_0x2c9f02,null))[_0xe8da('0x4f')](handleError(_0x2c9f02,null));};exports['destroy']=function(_0x540c78,_0x4a91f5){return db[_0xe8da('0x35')][_0xe8da('0x4e')]({'where':{'id':_0x540c78[_0xe8da('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4a91f5,null))[_0xe8da('0x2a')](removeEntity(_0x4a91f5,null))[_0xe8da('0x4f')](handleError(_0x4a91f5,null));};function widgetAttributes(_0x3af632){try{switch(_0x3af632[_0xe8da('0x5d')]){case _0xe8da('0x5e'):return[{'name':'attrUrl','value':_0x3af632[_0xe8da('0x5f')]||(_0x3af632[_0xe8da('0x60')]&&_0x3af632[_0xe8da('0x60')][0x0]?_0x3af632['attrs'][0x0][_0xe8da('0x61')]:undefined)||'https://'}];case _0xe8da('0x62'):return[{'name':'attrPath','value':_0x3af632['attrPath']||(_0x3af632['attrs']&&_0x3af632['attrs'][0x0]?_0x3af632[_0xe8da('0x60')][0x0][_0xe8da('0x61')]:undefined)||''}];case _0xe8da('0x63'):return[{'name':'attrHourFormat','value':_0x3af632[_0xe8da('0x64')]||(_0x3af632[_0xe8da('0x60')]&&_0x3af632[_0xe8da('0x60')][0x0]?_0x3af632[_0xe8da('0x60')][0x0][_0xe8da('0x61')]:undefined)||_0xe8da('0x65')},{'name':'attrTimezone','value':_0x3af632[_0xe8da('0x66')]||(_0x3af632[_0xe8da('0x60')]&&_0x3af632['attrs'][0x1]?_0x3af632['attrs'][0x1]['value']:undefined)||_0xe8da('0x67')},{'name':'attrFontSize','value':_0x3af632[_0xe8da('0x68')]||(_0x3af632[_0xe8da('0x60')]&&_0x3af632[_0xe8da('0x60')][0x2]?_0x3af632['attrs'][0x2]['value']:undefined)||0xc}];case _0xe8da('0x69'):return[{'name':_0xe8da('0x6a'),'value':_0x3af632['attrMetric']||(_0x3af632['attrs']&&_0x3af632[_0xe8da('0x60')][0x0]?_0x3af632[_0xe8da('0x60')][0x0][_0xe8da('0x61')]:undefined)||_0xe8da('0x6b')},{'name':'attrVoiceQueues','value':_0x3af632[_0xe8da('0x6c')]||(_0x3af632[_0xe8da('0x60')]&&_0x3af632['attrs'][0x1]?_0x3af632['attrs'][0x1][_0xe8da('0x61')]:undefined)||[]},{'name':_0xe8da('0x68'),'value':_0x3af632['attrFontSize']||(_0x3af632[_0xe8da('0x60')]&&_0x3af632[_0xe8da('0x60')][0x2]?_0x3af632[_0xe8da('0x60')][0x2][_0xe8da('0x61')]:undefined)||0x14},{'name':_0xe8da('0x6d'),'value':_0x3af632['attrChannel']||(_0x3af632[_0xe8da('0x60')]&&_0x3af632['attrs'][0x3]?_0x3af632[_0xe8da('0x60')][0x3]['value']:undefined)||_0xe8da('0x6e')},{'name':'attrEmailAccounts','value':_0x3af632['attrEmailAccounts']||(_0x3af632[_0xe8da('0x60')]&&_0x3af632[_0xe8da('0x60')][0x4]?_0x3af632[_0xe8da('0x60')][0x4]['value']:undefined)||''},{'name':_0xe8da('0x6f'),'value':_0x3af632[_0xe8da('0x6f')]||(_0x3af632[_0xe8da('0x60')]&&_0x3af632[_0xe8da('0x60')][0x5]?_0x3af632[_0xe8da('0x60')][0x5][_0xe8da('0x61')]:undefined)||''},{'name':_0xe8da('0x70'),'value':_0x3af632[_0xe8da('0x70')]||(_0x3af632[_0xe8da('0x60')]&&_0x3af632[_0xe8da('0x60')][0x6]?_0x3af632[_0xe8da('0x60')][0x6][_0xe8da('0x61')]:undefined)||''},{'name':_0xe8da('0x71'),'value':_0x3af632[_0xe8da('0x71')]||(_0x3af632[_0xe8da('0x60')]&&_0x3af632['attrs'][0x7]?_0x3af632[_0xe8da('0x60')][0x7][_0xe8da('0x61')]:undefined)||''},{'name':_0xe8da('0x72'),'value':_0x3af632[_0xe8da('0x72')]||(_0x3af632[_0xe8da('0x60')]&&_0x3af632['attrs'][0x8]?_0x3af632['attrs'][0x8]['value']:undefined)||''},{'name':_0xe8da('0x73'),'value':_0x3af632[_0xe8da('0x73')]||(_0x3af632[_0xe8da('0x60')]&&_0x3af632[_0xe8da('0x60')][0x9]?_0x3af632[_0xe8da('0x60')][0x9]['value']:undefined)||''}];case _0xe8da('0x74'):case'pie-chart':return[{'name':_0xe8da('0x75'),'value':_0x3af632[_0xe8da('0x75')]||(_0x3af632[_0xe8da('0x60')]&&_0x3af632[_0xe8da('0x60')][0x0]?_0x3af632[_0xe8da('0x60')][0x0]['value']:undefined)||_0xe8da('0x6b')},{'name':_0xe8da('0x76'),'value':_0x3af632[_0xe8da('0x76')]||(_0x3af632[_0xe8da('0x60')]&&_0x3af632['attrs'][0x1]?_0x3af632[_0xe8da('0x60')][0x1][_0xe8da('0x61')]:undefined)||null},{'name':_0xe8da('0x77'),'value':_0x3af632[_0xe8da('0x77')]||(_0x3af632[_0xe8da('0x60')]&&_0x3af632[_0xe8da('0x60')][0x2]?_0x3af632[_0xe8da('0x60')][0x2][_0xe8da('0x61')]:undefined)||null},{'name':_0xe8da('0x6c'),'value':_0x3af632['attrVoiceQueues']||(_0x3af632[_0xe8da('0x60')]&&_0x3af632['attrs'][0x3]?_0x3af632[_0xe8da('0x60')][0x3][_0xe8da('0x61')]:undefined)||[]},{'name':_0xe8da('0x6d'),'value':_0x3af632[_0xe8da('0x6d')]||(_0x3af632[_0xe8da('0x60')]&&_0x3af632['attrs'][0x4]?_0x3af632['attrs'][0x4][_0xe8da('0x61')]:undefined)||'voice'},{'name':_0xe8da('0x78'),'value':_0x3af632[_0xe8da('0x78')]||(_0x3af632[_0xe8da('0x60')]&&_0x3af632['attrs'][0x5]?_0x3af632[_0xe8da('0x60')][0x5][_0xe8da('0x61')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x3af632['attrFaxAccounts']||(_0x3af632[_0xe8da('0x60')]&&_0x3af632[_0xe8da('0x60')][0x6]?_0x3af632[_0xe8da('0x60')][0x6]['value']:undefined)||''},{'name':_0xe8da('0x70'),'value':_0x3af632[_0xe8da('0x70')]||(_0x3af632[_0xe8da('0x60')]&&_0x3af632[_0xe8da('0x60')][0x7]?_0x3af632[_0xe8da('0x60')][0x7][_0xe8da('0x61')]:undefined)||''},{'name':_0xe8da('0x71'),'value':_0x3af632['attrOpenchannelAccounts']||(_0x3af632[_0xe8da('0x60')]&&_0x3af632[_0xe8da('0x60')][0x8]?_0x3af632[_0xe8da('0x60')][0x8]['value']:undefined)||''},{'name':_0xe8da('0x72'),'value':_0x3af632[_0xe8da('0x72')]||(_0x3af632[_0xe8da('0x60')]&&_0x3af632[_0xe8da('0x60')][0x9]?_0x3af632[_0xe8da('0x60')][0x9][_0xe8da('0x61')]:undefined)||''},{'name':'attrChatWebsites','value':_0x3af632['attrChatWebsites']||(_0x3af632[_0xe8da('0x60')]&&_0x3af632[_0xe8da('0x60')][0xa]?_0x3af632[_0xe8da('0x60')][0xa][_0xe8da('0x61')]:undefined)||''}];case'web-report':return[{'name':'attrReport','type':_0x3af632[_0xe8da('0x79')]||(_0x3af632[_0xe8da('0x60')]&&_0x3af632[_0xe8da('0x60')][0x0]?_0x3af632['attrs'][0x0][_0xe8da('0x5d')]:undefined)||null,'value':_0x3af632['attrReport']||(_0x3af632[_0xe8da('0x60')]&&_0x3af632[_0xe8da('0x60')][0x0]?_0x3af632[_0xe8da('0x60')][0x0][_0xe8da('0x61')]:undefined)||null},{'name':'attrRefresh','value':_0x3af632['attrRefresh']||(_0x3af632[_0xe8da('0x60')]&&_0x3af632['attrs'][0x1]?_0x3af632[_0xe8da('0x60')][0x1][_0xe8da('0x61')]:undefined)||0x0}];default:return[];}}catch(_0xb23df9){logger['error']('widgetAttributes:\x20%s',JSON[_0xe8da('0x7a')](_0xb23df9));return[];}}exports['addItem']=function(_0x4779d7,_0x1fb62c,_0x358239){if(_0x4779d7[_0xe8da('0x5a')]['id']){delete _0x4779d7[_0xe8da('0x5a')]['id'];}return db[_0xe8da('0x35')]['find']({'where':{'id':_0x4779d7[_0xe8da('0x4b')]['id']}})[_0xe8da('0x2a')](handleEntityNotFound(_0x1fb62c,null))[_0xe8da('0x2a')](function(_0x3eb892){if(_0x3eb892){_0x4779d7['body'][_0xe8da('0x7b')]=_0x3eb892['id'];_0x4779d7[_0xe8da('0x5a')][_0xe8da('0x60')]=widgetAttributes(_0x4779d7[_0xe8da('0x5a')]);return db[_0xe8da('0x7c')][_0xe8da('0x5b')](_0x4779d7[_0xe8da('0x5a')]);}})['then'](respondWithResult(_0x1fb62c,null))['catch'](handleError(_0x1fb62c,null));};exports[_0xe8da('0x7d')]=function(_0x293a0e,_0x1d2a17,_0x38b9fc){var _0x7c4526={};var _0x47a68c={};var _0x1458ad;var _0x4868f8;return db[_0xe8da('0x35')]['findOne']({'where':{'id':_0x293a0e[_0xe8da('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1d2a17,null))[_0xe8da('0x2a')](function(_0xcd42c9){if(_0xcd42c9){_0x1458ad=_0xcd42c9;_0x47a68c[_0xe8da('0x38')]=_[_0xe8da('0x3a')](db['DashboardItem'][_0xe8da('0x4c')]);_0x47a68c[_0xe8da('0x39')]=_[_0xe8da('0x3a')](_0x293a0e[_0xe8da('0x39')]);_0x47a68c[_0xe8da('0x3b')]=_[_0xe8da('0x3c')](_0x47a68c[_0xe8da('0x38')],_0x47a68c[_0xe8da('0x39')]);_0x7c4526['attributes']=_[_0xe8da('0x3c')](_0x47a68c[_0xe8da('0x38')],qs['fields'](_0x293a0e[_0xe8da('0x39')]['fields']));_0x7c4526[_0xe8da('0x3d')]=_0x7c4526[_0xe8da('0x3d')]['length']?_0x7c4526[_0xe8da('0x3d')]:_0x47a68c['model'];_0x7c4526['order']=qs['sort'](_0x293a0e[_0xe8da('0x39')]['sort']);_0x7c4526[_0xe8da('0x42')]=qs[_0xe8da('0x3b')](_[_0xe8da('0x43')](_0x293a0e[_0xe8da('0x39')],_0x47a68c[_0xe8da('0x3b')]));if(_0x293a0e[_0xe8da('0x39')]['filter']){_0x7c4526[_0xe8da('0x42')]=_[_0xe8da('0x44')](_0x7c4526['where'],{'$or':_[_0xe8da('0x34')](_0x7c4526[_0xe8da('0x3d')],function(_0x51ef81){var _0x2512b3={};_0x2512b3[_0x51ef81]={'$like':'%'+_0x293a0e['query'][_0xe8da('0x46')]+'%'};return _0x2512b3;})});}_0x7c4526=_[_0xe8da('0x44')]({},_0x7c4526,_0x293a0e['options']);return _0x1458ad[_0xe8da('0x7d')](_0x7c4526);}})[_0xe8da('0x2a')](function(_0x2a8a73){if(_0x2a8a73){_0x4868f8=_0x2a8a73[_0xe8da('0x4d')];if(!_0x293a0e['query']['hasOwnProperty']('nolimit')){_0x7c4526[_0xe8da('0x25')]=qs[_0xe8da('0x25')](_0x293a0e['query'][_0xe8da('0x25')]);_0x7c4526[_0xe8da('0x22')]=qs[_0xe8da('0x22')](_0x293a0e[_0xe8da('0x39')]['offset']);}return _0x1458ad['getItems'](_0x7c4526);}})[_0xe8da('0x2a')](function(_0x4d6ee6){if(_0x4d6ee6){return _0x4d6ee6?{'count':_0x4868f8,'rows':_0x4d6ee6}:null;}})[_0xe8da('0x2a')](respondWithResult(_0x1d2a17,null))[_0xe8da('0x4f')](handleError(_0x1d2a17,null));}; \ No newline at end of file +var _0xffd6=['squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','CustomDashboards','UserProfileResource','destroy','error','stack','name','send','Dashboard','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','createdAt','updatedAt','role','iframe','attrUrl','attrs','https://','custom','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','voice','attrWhatsappAccounts','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','DashboardItem','pick','getItems','zip-dir','request-promise','moment','util','fs-extra','lodash'];(function(_0xe3307f,_0x435ec9){var _0x36a671=function(_0x4a6378){while(--_0x4a6378){_0xe3307f['push'](_0xe3307f['shift']());}};_0x36a671(++_0x435ec9);}(_0xffd6,0xf8));var _0x6ffd=function(_0x34933a,_0x327378){_0x34933a=_0x34933a-0x0;var _0x36abb4=_0xffd6[_0x34933a];return _0x36abb4;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6ffd('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6ffd('0x1'));var moment=require(_0x6ffd('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6ffd('0x3'));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(_0x6ffd('0x4'));var _=require(_0x6ffd('0x5'));var squel=require(_0x6ffd('0x6'));var crypto=require(_0x6ffd('0x7'));var jsforce=require(_0x6ffd('0x8'));var deskjs=require(_0x6ffd('0x9'));var toCsv=require(_0x6ffd('0xa'));var querystring=require(_0x6ffd('0xb'));var Papa=require(_0x6ffd('0xc'));var Redis=require('ioredis');var authService=require(_0x6ffd('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6ffd('0xe'));var logger=require(_0x6ffd('0xf'))('api');var utils=require(_0x6ffd('0x10'));var config=require(_0x6ffd('0x11'));var licenseUtil=require(_0x6ffd('0x12'));var db=require(_0x6ffd('0x13'))['db'];config[_0x6ffd('0x14')]=_[_0x6ffd('0x15')](config[_0x6ffd('0x14')],{'host':_0x6ffd('0x16'),'port':0x18eb});var socket=require(_0x6ffd('0x17'))(new Redis(config['redis']));require(_0x6ffd('0x18'))['register'](socket);function respondWithStatusCode(_0x138d18,_0x17aeb8){_0x17aeb8=_0x17aeb8||0xcc;return function(_0x1f264d){if(_0x1f264d){return _0x138d18[_0x6ffd('0x19')](_0x17aeb8);}return _0x138d18[_0x6ffd('0x1a')](_0x17aeb8)[_0x6ffd('0x1b')]();};}function respondWithResult(_0x3586e5,_0x252a58){_0x252a58=_0x252a58||0xc8;return function(_0x48290d){if(_0x48290d){return _0x3586e5['status'](_0x252a58)[_0x6ffd('0x1c')](_0x48290d);}};}function respondWithFilteredResult(_0x258fbd,_0x49cc5d){return function(_0xd2f6de){if(_0xd2f6de){var _0x133838=typeof _0x49cc5d[_0x6ffd('0x1d')]===_0x6ffd('0x1e')&&typeof _0x49cc5d[_0x6ffd('0x1f')]===_0x6ffd('0x1e');var _0x27dfe4=_0xd2f6de[_0x6ffd('0x20')];var _0xe95696=_0x133838?0x0:_0x49cc5d[_0x6ffd('0x1d')];var _0x9c265a=_0x133838?_0xd2f6de['count']:_0x49cc5d['offset']+_0x49cc5d[_0x6ffd('0x1f')];var _0x3ecf0b;if(_0x9c265a>=_0x27dfe4){_0x9c265a=_0x27dfe4;_0x3ecf0b=0xc8;}else{_0x3ecf0b=0xce;}_0x258fbd['status'](_0x3ecf0b);return _0x258fbd[_0x6ffd('0x21')](_0x6ffd('0x22'),_0xe95696+'-'+_0x9c265a+'/'+_0x27dfe4)['json'](_0xd2f6de);}return null;};}function patchUpdates(_0x3d38cc){return function(_0x5da69f){try{jsonpatch[_0x6ffd('0x23')](_0x5da69f,_0x3d38cc,!![]);}catch(_0x3549fa){return BPromise[_0x6ffd('0x24')](_0x3549fa);}return _0x5da69f[_0x6ffd('0x25')]();};}function saveUpdates(_0xfd581a,_0x26cc43){return function(_0x28db1f){if(_0x28db1f){return _0x28db1f[_0x6ffd('0x26')](_0xfd581a)[_0x6ffd('0x27')](function(_0x4ca902){return _0x4ca902;});}return null;};}function removeEntity(_0x34d172,_0x31bfa0){return function(_0x171edf){if(_0x171edf){return _0x171edf['destroy']()[_0x6ffd('0x27')](function(){var _0x14f9ee=_0x171edf[_0x6ffd('0x28')]({'plain':!![]});var _0x37c181=_0x6ffd('0x29');return db[_0x6ffd('0x2a')][_0x6ffd('0x2b')]({'where':{'type':_0x37c181,'resourceId':_0x14f9ee['id']}})[_0x6ffd('0x27')](function(){return _0x171edf;});})[_0x6ffd('0x27')](function(){_0x34d172[_0x6ffd('0x1a')](0xcc)[_0x6ffd('0x1b')]();});}};}function handleEntityNotFound(_0x583e41,_0x41a637){return function(_0x57f6f6){if(!_0x57f6f6){_0x583e41[_0x6ffd('0x19')](0x194);}return _0x57f6f6;};}function handleError(_0x37ce3d,_0xf1644d){_0xf1644d=_0xf1644d||0x1f4;return function(_0x39d648){logger[_0x6ffd('0x2c')](_0x39d648[_0x6ffd('0x2d')]);if(_0x39d648[_0x6ffd('0x2e')]){delete _0x39d648[_0x6ffd('0x2e')];}_0x37ce3d[_0x6ffd('0x1a')](_0xf1644d)[_0x6ffd('0x2f')](_0x39d648);};}exports['index']=function(_0x287fa5,_0x57dc24){var _0x572c95={},_0x474001={},_0x23a789={'count':0x0,'rows':[]};var _0x362bb7=_['map'](db[_0x6ffd('0x30')][_0x6ffd('0x31')],function(_0x344231){return{'name':_0x344231[_0x6ffd('0x32')],'type':_0x344231[_0x6ffd('0x33')][_0x6ffd('0x34')]};});_0x474001[_0x6ffd('0x35')]=_[_0x6ffd('0x36')](_0x362bb7,_0x6ffd('0x2e'));_0x474001[_0x6ffd('0x37')]=_[_0x6ffd('0x38')](_0x287fa5[_0x6ffd('0x37')]);_0x474001[_0x6ffd('0x39')]=_[_0x6ffd('0x3a')](_0x474001[_0x6ffd('0x35')],_0x474001[_0x6ffd('0x37')]);_0x572c95['attributes']=_[_0x6ffd('0x3a')](_0x474001[_0x6ffd('0x35')],qs[_0x6ffd('0x3b')](_0x287fa5[_0x6ffd('0x37')]['fields']));_0x572c95['attributes']=_0x572c95[_0x6ffd('0x3c')][_0x6ffd('0x3d')]?_0x572c95[_0x6ffd('0x3c')]:_0x474001[_0x6ffd('0x35')];if(!_0x287fa5[_0x6ffd('0x37')]['hasOwnProperty'](_0x6ffd('0x3e'))){_0x572c95[_0x6ffd('0x1f')]=qs[_0x6ffd('0x1f')](_0x287fa5[_0x6ffd('0x37')][_0x6ffd('0x1f')]);_0x572c95[_0x6ffd('0x1d')]=qs[_0x6ffd('0x1d')](_0x287fa5['query'][_0x6ffd('0x1d')]);}_0x572c95['order']=qs[_0x6ffd('0x3f')](_0x287fa5[_0x6ffd('0x37')][_0x6ffd('0x3f')]);_0x572c95[_0x6ffd('0x40')]=qs[_0x6ffd('0x39')](_['pick'](_0x287fa5['query'],_0x474001[_0x6ffd('0x39')]),_0x362bb7);if(_0x287fa5[_0x6ffd('0x37')][_0x6ffd('0x41')]){_0x572c95[_0x6ffd('0x40')]=_[_0x6ffd('0x42')](_0x572c95['where'],{'$or':_[_0x6ffd('0x36')](_0x362bb7,function(_0x27f53d){if(_0x27f53d[_0x6ffd('0x33')]!==_0x6ffd('0x43')){var _0x4a7ba2={};_0x4a7ba2[_0x27f53d[_0x6ffd('0x2e')]]={'$like':'%'+_0x287fa5[_0x6ffd('0x37')][_0x6ffd('0x41')]+'%'};return _0x4a7ba2;}})});}_0x572c95=_['merge']({},_0x572c95,_0x287fa5[_0x6ffd('0x44')]);var _0x4105d1={'where':_0x572c95[_0x6ffd('0x40')]};return db['Dashboard'][_0x6ffd('0x20')](_0x4105d1)['then'](function(_0x3c2cce){_0x23a789[_0x6ffd('0x20')]=_0x3c2cce;if(_0x287fa5[_0x6ffd('0x37')][_0x6ffd('0x45')]){_0x572c95[_0x6ffd('0x46')]=[{'all':!![]}];}return db[_0x6ffd('0x30')][_0x6ffd('0x47')](_0x572c95);})[_0x6ffd('0x27')](function(_0x2f2f44){_0x23a789['rows']=_0x2f2f44;return _0x23a789;})[_0x6ffd('0x27')](respondWithFilteredResult(_0x57dc24,_0x572c95))[_0x6ffd('0x48')](handleError(_0x57dc24,null));};exports[_0x6ffd('0x49')]=function(_0x244d87,_0x4310e3){var _0x380303={'raw':![],'where':{'id':_0x244d87['params']['id']}},_0x279cdf={};_0x279cdf[_0x6ffd('0x35')]=_[_0x6ffd('0x38')](db[_0x6ffd('0x30')]['rawAttributes']);_0x279cdf[_0x6ffd('0x37')]=_[_0x6ffd('0x38')](_0x244d87['query']);_0x279cdf[_0x6ffd('0x39')]=_[_0x6ffd('0x3a')](_0x279cdf[_0x6ffd('0x35')],_0x279cdf[_0x6ffd('0x37')]);_0x380303['attributes']=_['intersection'](_0x279cdf[_0x6ffd('0x35')],qs[_0x6ffd('0x3b')](_0x244d87[_0x6ffd('0x37')]['fields']));_0x380303[_0x6ffd('0x3c')]=_0x380303[_0x6ffd('0x3c')]['length']?_0x380303['attributes']:_0x279cdf[_0x6ffd('0x35')];if(_0x244d87['query'][_0x6ffd('0x45')]){_0x380303[_0x6ffd('0x46')]=[{'all':!![]}];}_0x380303=_[_0x6ffd('0x42')]({},_0x380303,_0x244d87[_0x6ffd('0x44')]);return db['Dashboard'][_0x6ffd('0x4a')](_0x380303)['then'](handleEntityNotFound(_0x4310e3,null))[_0x6ffd('0x27')](respondWithResult(_0x4310e3,null))[_0x6ffd('0x48')](handleError(_0x4310e3,null));};exports['create']=function(_0x3267c3,_0x1297fd){return db[_0x6ffd('0x30')][_0x6ffd('0x4b')](_0x3267c3[_0x6ffd('0x4c')],{})[_0x6ffd('0x27')](function(_0x12e195){var _0x14eedb=_0x3267c3[_0x6ffd('0x4d')]['get']({'plain':!![]});if(!_0x14eedb)throw new Error(_0x6ffd('0x4e'));if(_0x14eedb['role']===_0x6ffd('0x4d')){var _0x3eb0ef=_0x12e195['get']({'plain':!![]});var _0x1dfb64='CustomDashboards';return db[_0x6ffd('0x4f')][_0x6ffd('0x4a')]({'where':{'name':_0x1dfb64,'userProfileId':_0x14eedb[_0x6ffd('0x50')]},'raw':!![]})[_0x6ffd('0x27')](function(_0x484753){if(_0x484753&&_0x484753[_0x6ffd('0x51')]===0x0){return db['UserProfileResource'][_0x6ffd('0x4b')]({'name':_0x3eb0ef[_0x6ffd('0x2e')],'resourceId':_0x3eb0ef['id'],'type':_0x484753['name'],'sectionId':_0x484753['id']},{})[_0x6ffd('0x27')](function(){return _0x12e195;});}else{return _0x12e195;}})['catch'](function(_0x592a16){logger[_0x6ffd('0x2c')](_0x6ffd('0x52'),_0x592a16);throw _0x592a16;});}return _0x12e195;})[_0x6ffd('0x27')](respondWithResult(_0x1297fd,0xc9))[_0x6ffd('0x48')](handleError(_0x1297fd,null));};exports[_0x6ffd('0x53')]=function(_0x6b85a3,_0x347077){var _0x26a2c7={'where':{'id':_0x6b85a3[_0x6ffd('0x54')]['id']}},_0x1caeb9={};_0x1caeb9[_0x6ffd('0x35')]=_[_0x6ffd('0x38')](db['Dashboard'][_0x6ffd('0x31')]);_0x26a2c7[_0x6ffd('0x3c')]=_['intersection'](_0x1caeb9[_0x6ffd('0x35')],qs[_0x6ffd('0x3b')](_0x6b85a3[_0x6ffd('0x37')][_0x6ffd('0x3b')]));_0x26a2c7[_0x6ffd('0x3c')]=_0x26a2c7['attributes']['length']?_0x26a2c7[_0x6ffd('0x3c')]:_0x1caeb9[_0x6ffd('0x35')];if(_0x6b85a3['query'][_0x6ffd('0x45')]){_0x26a2c7[_0x6ffd('0x46')]=[{'all':!![]}];}_0x26a2c7=_[_0x6ffd('0x42')]({},_0x26a2c7,_0x6b85a3[_0x6ffd('0x44')]);return db['Dashboard'][_0x6ffd('0x4a')](_0x26a2c7)['then'](handleEntityNotFound(_0x347077,null))[_0x6ffd('0x27')](function(_0x5c496c){if(_0x5c496c){var _0x5baa7a=_0x5c496c['get']({'plain':!![]});_0x5baa7a=qs[_0x6ffd('0x55')](_0x5baa7a,['id',_0x6ffd('0x56'),'updatedAt']);_0x6b85a3[_0x6ffd('0x4c')]=_[_0x6ffd('0x55')](_0x6b85a3[_0x6ffd('0x4c')],['id','createdAt',_0x6ffd('0x57')]);return db['Dashboard'][_0x6ffd('0x4b')](_[_0x6ffd('0x42')](_0x5baa7a,_0x6b85a3['body']),{'include':_0x6b85a3[_0x6ffd('0x37')][_0x6ffd('0x45')]?[{'all':!![]}]:undefined})[_0x6ffd('0x27')](function(_0xd94f4d){var _0x5cc556=_0x6b85a3[_0x6ffd('0x4d')][_0x6ffd('0x28')]({'plain':!![]});if(!_0x5cc556)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5cc556[_0x6ffd('0x58')]===_0x6ffd('0x4d')){var _0x2791a7=_0xd94f4d['get']({'plain':!![]});var _0x5eadb8=_0x6ffd('0x29');return db['UserProfileSection'][_0x6ffd('0x4a')]({'where':{'name':_0x5eadb8,'userProfileId':_0x5cc556['userProfileId']},'raw':!![]})[_0x6ffd('0x27')](function(_0x7fa5e9){if(_0x7fa5e9&&_0x7fa5e9['autoAssociation']===0x0){return db[_0x6ffd('0x2a')]['create']({'name':_0x2791a7['name'],'resourceId':_0x2791a7['id'],'type':_0x7fa5e9[_0x6ffd('0x2e')],'sectionId':_0x7fa5e9['id']},{})[_0x6ffd('0x27')](function(){return _0xd94f4d;});}else{return _0xd94f4d;}})[_0x6ffd('0x48')](function(_0x1e2ccc){logger[_0x6ffd('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1e2ccc);throw _0x1e2ccc;});}return _0xd94f4d;});}})[_0x6ffd('0x27')](respondWithResult(_0x347077,0xc9))[_0x6ffd('0x48')](handleError(_0x347077,null));};exports[_0x6ffd('0x26')]=function(_0x221017,_0xbb32ff){if(_0x221017[_0x6ffd('0x4c')]['id']){delete _0x221017[_0x6ffd('0x4c')]['id'];}return db[_0x6ffd('0x30')][_0x6ffd('0x4a')]({'where':{'id':_0x221017[_0x6ffd('0x54')]['id']}})['then'](handleEntityNotFound(_0xbb32ff,null))['then'](saveUpdates(_0x221017[_0x6ffd('0x4c')],null))['then'](respondWithResult(_0xbb32ff,null))[_0x6ffd('0x48')](handleError(_0xbb32ff,null));};exports[_0x6ffd('0x2b')]=function(_0x392d2f,_0x133a14){return db[_0x6ffd('0x30')][_0x6ffd('0x4a')]({'where':{'id':_0x392d2f[_0x6ffd('0x54')]['id']}})[_0x6ffd('0x27')](handleEntityNotFound(_0x133a14,null))['then'](removeEntity(_0x133a14,null))[_0x6ffd('0x48')](handleError(_0x133a14,null));};function widgetAttributes(_0x5477d5){try{switch(_0x5477d5[_0x6ffd('0x33')]){case _0x6ffd('0x59'):return[{'name':_0x6ffd('0x5a'),'value':_0x5477d5[_0x6ffd('0x5a')]||(_0x5477d5['attrs']&&_0x5477d5['attrs'][0x0]?_0x5477d5[_0x6ffd('0x5b')][0x0]['value']:undefined)||_0x6ffd('0x5c')}];case _0x6ffd('0x5d'):return[{'name':_0x6ffd('0x5e'),'value':_0x5477d5[_0x6ffd('0x5e')]||(_0x5477d5[_0x6ffd('0x5b')]&&_0x5477d5[_0x6ffd('0x5b')][0x0]?_0x5477d5['attrs'][0x0][_0x6ffd('0x5f')]:undefined)||''}];case _0x6ffd('0x60'):return[{'name':_0x6ffd('0x61'),'value':_0x5477d5[_0x6ffd('0x61')]||(_0x5477d5[_0x6ffd('0x5b')]&&_0x5477d5[_0x6ffd('0x5b')][0x0]?_0x5477d5[_0x6ffd('0x5b')][0x0][_0x6ffd('0x5f')]:undefined)||_0x6ffd('0x62')},{'name':_0x6ffd('0x63'),'value':_0x5477d5[_0x6ffd('0x63')]||(_0x5477d5['attrs']&&_0x5477d5[_0x6ffd('0x5b')][0x1]?_0x5477d5['attrs'][0x1][_0x6ffd('0x5f')]:undefined)||_0x6ffd('0x64')},{'name':_0x6ffd('0x65'),'value':_0x5477d5[_0x6ffd('0x65')]||(_0x5477d5['attrs']&&_0x5477d5[_0x6ffd('0x5b')][0x2]?_0x5477d5['attrs'][0x2][_0x6ffd('0x5f')]:undefined)||0xc}];case _0x6ffd('0x66'):return[{'name':'attrMetric','value':_0x5477d5[_0x6ffd('0x67')]||(_0x5477d5[_0x6ffd('0x5b')]&&_0x5477d5['attrs'][0x0]?_0x5477d5[_0x6ffd('0x5b')][0x0][_0x6ffd('0x5f')]:undefined)||_0x6ffd('0x68')},{'name':_0x6ffd('0x69'),'value':_0x5477d5['attrVoiceQueues']||(_0x5477d5['attrs']&&_0x5477d5[_0x6ffd('0x5b')][0x1]?_0x5477d5[_0x6ffd('0x5b')][0x1][_0x6ffd('0x5f')]:undefined)||[]},{'name':_0x6ffd('0x65'),'value':_0x5477d5['attrFontSize']||(_0x5477d5[_0x6ffd('0x5b')]&&_0x5477d5['attrs'][0x2]?_0x5477d5[_0x6ffd('0x5b')][0x2][_0x6ffd('0x5f')]:undefined)||0x14},{'name':_0x6ffd('0x6a'),'value':_0x5477d5['attrChannel']||(_0x5477d5['attrs']&&_0x5477d5[_0x6ffd('0x5b')][0x3]?_0x5477d5[_0x6ffd('0x5b')][0x3][_0x6ffd('0x5f')]:undefined)||'voice'},{'name':_0x6ffd('0x6b'),'value':_0x5477d5[_0x6ffd('0x6b')]||(_0x5477d5['attrs']&&_0x5477d5[_0x6ffd('0x5b')][0x4]?_0x5477d5[_0x6ffd('0x5b')][0x4][_0x6ffd('0x5f')]:undefined)||''},{'name':_0x6ffd('0x6c'),'value':_0x5477d5['attrFaxAccounts']||(_0x5477d5[_0x6ffd('0x5b')]&&_0x5477d5[_0x6ffd('0x5b')][0x5]?_0x5477d5[_0x6ffd('0x5b')][0x5]['value']:undefined)||''},{'name':_0x6ffd('0x6d'),'value':_0x5477d5['attrSmsAccounts']||(_0x5477d5[_0x6ffd('0x5b')]&&_0x5477d5[_0x6ffd('0x5b')][0x6]?_0x5477d5[_0x6ffd('0x5b')][0x6][_0x6ffd('0x5f')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x5477d5[_0x6ffd('0x6e')]||(_0x5477d5['attrs']&&_0x5477d5['attrs'][0x7]?_0x5477d5[_0x6ffd('0x5b')][0x7][_0x6ffd('0x5f')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x5477d5['attrWhatsappAccounts']||(_0x5477d5[_0x6ffd('0x5b')]&&_0x5477d5[_0x6ffd('0x5b')][0x8]?_0x5477d5[_0x6ffd('0x5b')][0x8]['value']:undefined)||''},{'name':_0x6ffd('0x6f'),'value':_0x5477d5[_0x6ffd('0x6f')]||(_0x5477d5[_0x6ffd('0x5b')]&&_0x5477d5[_0x6ffd('0x5b')][0x9]?_0x5477d5[_0x6ffd('0x5b')][0x9][_0x6ffd('0x5f')]:undefined)||''}];case _0x6ffd('0x70'):case _0x6ffd('0x71'):return[{'name':_0x6ffd('0x72'),'value':_0x5477d5[_0x6ffd('0x72')]||(_0x5477d5['attrs']&&_0x5477d5[_0x6ffd('0x5b')][0x0]?_0x5477d5['attrs'][0x0][_0x6ffd('0x5f')]:undefined)||'total'},{'name':_0x6ffd('0x73'),'value':_0x5477d5['attrSerie2']||(_0x5477d5['attrs']&&_0x5477d5['attrs'][0x1]?_0x5477d5[_0x6ffd('0x5b')][0x1][_0x6ffd('0x5f')]:undefined)||null},{'name':_0x6ffd('0x74'),'value':_0x5477d5[_0x6ffd('0x74')]||(_0x5477d5[_0x6ffd('0x5b')]&&_0x5477d5[_0x6ffd('0x5b')][0x2]?_0x5477d5[_0x6ffd('0x5b')][0x2][_0x6ffd('0x5f')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x5477d5[_0x6ffd('0x69')]||(_0x5477d5[_0x6ffd('0x5b')]&&_0x5477d5[_0x6ffd('0x5b')][0x3]?_0x5477d5[_0x6ffd('0x5b')][0x3][_0x6ffd('0x5f')]:undefined)||[]},{'name':_0x6ffd('0x6a'),'value':_0x5477d5[_0x6ffd('0x6a')]||(_0x5477d5[_0x6ffd('0x5b')]&&_0x5477d5[_0x6ffd('0x5b')][0x4]?_0x5477d5[_0x6ffd('0x5b')][0x4]['value']:undefined)||_0x6ffd('0x75')},{'name':_0x6ffd('0x6b'),'value':_0x5477d5['attrEmailAccounts']||(_0x5477d5[_0x6ffd('0x5b')]&&_0x5477d5[_0x6ffd('0x5b')][0x5]?_0x5477d5[_0x6ffd('0x5b')][0x5]['value']:undefined)||''},{'name':_0x6ffd('0x6c'),'value':_0x5477d5[_0x6ffd('0x6c')]||(_0x5477d5[_0x6ffd('0x5b')]&&_0x5477d5[_0x6ffd('0x5b')][0x6]?_0x5477d5[_0x6ffd('0x5b')][0x6][_0x6ffd('0x5f')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x5477d5[_0x6ffd('0x6d')]||(_0x5477d5[_0x6ffd('0x5b')]&&_0x5477d5[_0x6ffd('0x5b')][0x7]?_0x5477d5[_0x6ffd('0x5b')][0x7][_0x6ffd('0x5f')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x5477d5[_0x6ffd('0x6e')]||(_0x5477d5['attrs']&&_0x5477d5[_0x6ffd('0x5b')][0x8]?_0x5477d5[_0x6ffd('0x5b')][0x8][_0x6ffd('0x5f')]:undefined)||''},{'name':_0x6ffd('0x76'),'value':_0x5477d5[_0x6ffd('0x76')]||(_0x5477d5[_0x6ffd('0x5b')]&&_0x5477d5['attrs'][0x9]?_0x5477d5[_0x6ffd('0x5b')][0x9][_0x6ffd('0x5f')]:undefined)||''},{'name':_0x6ffd('0x6f'),'value':_0x5477d5[_0x6ffd('0x6f')]||(_0x5477d5['attrs']&&_0x5477d5['attrs'][0xa]?_0x5477d5[_0x6ffd('0x5b')][0xa][_0x6ffd('0x5f')]:undefined)||''}];case _0x6ffd('0x77'):return[{'name':_0x6ffd('0x78'),'type':_0x5477d5['reportType']||(_0x5477d5['attrs']&&_0x5477d5['attrs'][0x0]?_0x5477d5['attrs'][0x0][_0x6ffd('0x33')]:undefined)||null,'value':_0x5477d5[_0x6ffd('0x78')]||(_0x5477d5[_0x6ffd('0x5b')]&&_0x5477d5[_0x6ffd('0x5b')][0x0]?_0x5477d5[_0x6ffd('0x5b')][0x0]['value']:undefined)||null},{'name':_0x6ffd('0x79'),'value':_0x5477d5[_0x6ffd('0x79')]||(_0x5477d5[_0x6ffd('0x5b')]&&_0x5477d5['attrs'][0x1]?_0x5477d5[_0x6ffd('0x5b')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x36375f){logger['error'](_0x6ffd('0x7a'),JSON[_0x6ffd('0x7b')](_0x36375f));return[];}}exports['addItem']=function(_0x468c5b,_0x3ba3f4,_0x2a51d0){if(_0x468c5b['body']['id']){delete _0x468c5b[_0x6ffd('0x4c')]['id'];}return db[_0x6ffd('0x30')]['find']({'where':{'id':_0x468c5b[_0x6ffd('0x54')]['id']}})[_0x6ffd('0x27')](handleEntityNotFound(_0x3ba3f4,null))[_0x6ffd('0x27')](function(_0x56f234){if(_0x56f234){_0x468c5b[_0x6ffd('0x4c')]['DashboardId']=_0x56f234['id'];_0x468c5b['body'][_0x6ffd('0x5b')]=widgetAttributes(_0x468c5b[_0x6ffd('0x4c')]);return db[_0x6ffd('0x7c')][_0x6ffd('0x4b')](_0x468c5b['body']);}})[_0x6ffd('0x27')](respondWithResult(_0x3ba3f4,null))[_0x6ffd('0x48')](handleError(_0x3ba3f4,null));};exports['getItems']=function(_0x4a62e7,_0x148949,_0xa1230d){var _0x119690={};var _0x1b8fb1={};var _0x533a44;var _0x24827d;return db[_0x6ffd('0x30')]['findOne']({'where':{'id':_0x4a62e7['params']['id']}})[_0x6ffd('0x27')](handleEntityNotFound(_0x148949,null))[_0x6ffd('0x27')](function(_0x4c4f4c){if(_0x4c4f4c){_0x533a44=_0x4c4f4c;_0x1b8fb1[_0x6ffd('0x35')]=_[_0x6ffd('0x38')](db['DashboardItem']['rawAttributes']);_0x1b8fb1['query']=_['keys'](_0x4a62e7[_0x6ffd('0x37')]);_0x1b8fb1[_0x6ffd('0x39')]=_[_0x6ffd('0x3a')](_0x1b8fb1[_0x6ffd('0x35')],_0x1b8fb1[_0x6ffd('0x37')]);_0x119690['attributes']=_['intersection'](_0x1b8fb1[_0x6ffd('0x35')],qs[_0x6ffd('0x3b')](_0x4a62e7[_0x6ffd('0x37')][_0x6ffd('0x3b')]));_0x119690['attributes']=_0x119690[_0x6ffd('0x3c')][_0x6ffd('0x3d')]?_0x119690[_0x6ffd('0x3c')]:_0x1b8fb1['model'];_0x119690['order']=qs[_0x6ffd('0x3f')](_0x4a62e7[_0x6ffd('0x37')][_0x6ffd('0x3f')]);_0x119690[_0x6ffd('0x40')]=qs[_0x6ffd('0x39')](_[_0x6ffd('0x7d')](_0x4a62e7[_0x6ffd('0x37')],_0x1b8fb1['filters']));if(_0x4a62e7[_0x6ffd('0x37')]['filter']){_0x119690['where']=_[_0x6ffd('0x42')](_0x119690['where'],{'$or':_[_0x6ffd('0x36')](_0x119690[_0x6ffd('0x3c')],function(_0x221938){var _0x4ac9be={};_0x4ac9be[_0x221938]={'$like':'%'+_0x4a62e7[_0x6ffd('0x37')][_0x6ffd('0x41')]+'%'};return _0x4ac9be;})});}_0x119690=_[_0x6ffd('0x42')]({},_0x119690,_0x4a62e7[_0x6ffd('0x44')]);return _0x533a44[_0x6ffd('0x7e')](_0x119690);}})['then'](function(_0x29b7e9){if(_0x29b7e9){_0x24827d=_0x29b7e9['length'];if(!_0x4a62e7['query']['hasOwnProperty']('nolimit')){_0x119690[_0x6ffd('0x1f')]=qs[_0x6ffd('0x1f')](_0x4a62e7[_0x6ffd('0x37')][_0x6ffd('0x1f')]);_0x119690[_0x6ffd('0x1d')]=qs['offset'](_0x4a62e7['query'][_0x6ffd('0x1d')]);}return _0x533a44[_0x6ffd('0x7e')](_0x119690);}})[_0x6ffd('0x27')](function(_0x538fa9){if(_0x538fa9){return _0x538fa9?{'count':_0x24827d,'rows':_0x538fa9}:null;}})[_0x6ffd('0x27')](respondWithResult(_0x148949,null))['catch'](handleError(_0x148949,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index f785b70..1ac44fd 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 _0x9a72=['setMaxListeners','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x9a72,0x8e));var _0x29a7=function(_0x5ddbe9,_0x4c8e88){_0x5ddbe9=_0x5ddbe9-0x0;var _0x397377=_0x9a72[_0x5ddbe9];return _0x397377;};'use strict';var EventEmitter=require(_0x29a7('0x0'));var Dashboard=require(_0x29a7('0x1'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0x29a7('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x29a7('0x3')};function emitEvent(_0x406177){return function(_0x2864d2,_0xeacd88,_0x53858a){DashboardEvents[_0x29a7('0x4')](_0x406177+':'+_0x2864d2['id'],_0x2864d2);DashboardEvents[_0x29a7('0x4')](_0x406177,_0x2864d2);_0x53858a(null);};}for(var e in events){if(events[_0x29a7('0x5')](e)){var event=events[e];Dashboard[_0x29a7('0x6')](e,emitEvent(event));}}module[_0x29a7('0x7')]=DashboardEvents; \ No newline at end of file +var _0x71ab=['emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','update','remove'];(function(_0x29874f,_0x53237c){var _0x3886c2=function(_0x2e250a){while(--_0x2e250a){_0x29874f['push'](_0x29874f['shift']());}};_0x3886c2(++_0x53237c);}(_0x71ab,0x64));var _0xb71a=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x71ab[_0x502c7d];return _0x30b7ed;};'use strict';var EventEmitter=require('events');var Dashboard=require(_0xb71a('0x0'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0xb71a('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb71a('0x2'),'afterDestroy':_0xb71a('0x3')};function emitEvent(_0x20fd9c){return function(_0x4094b2,_0x37ce74,_0x3c6438){DashboardEvents[_0xb71a('0x4')](_0x20fd9c+':'+_0x4094b2['id'],_0x4094b2);DashboardEvents[_0xb71a('0x4')](_0x20fd9c,_0x4094b2);_0x3c6438(null);};}for(var e in events){if(events[_0xb71a('0x5')](e)){var event=events[e];Dashboard[_0xb71a('0x6')](e,emitEvent(event));}}module[_0xb71a('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 4d00252..3308610 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 _0xb1b6=['bluebird','request-promise','path','./dashboard.attributes','exports','define','Dashboard','lodash','util','../../config/logger','api'];(function(_0x46d7b9,_0x94363b){var _0x155acf=function(_0xe24b60){while(--_0xe24b60){_0x46d7b9['push'](_0x46d7b9['shift']());}};_0x155acf(++_0x94363b);}(_0xb1b6,0x1b4));var _0x6b1b=function(_0x428d83,_0x4a9eb1){_0x428d83=_0x428d83-0x0;var _0xdf5ca8=_0xb1b6[_0x428d83];return _0xdf5ca8;};'use strict';var _=require(_0x6b1b('0x0'));var util=require(_0x6b1b('0x1'));var logger=require(_0x6b1b('0x2'))(_0x6b1b('0x3'));var moment=require('moment');var BPromise=require(_0x6b1b('0x4'));var rp=require(_0x6b1b('0x5'));var fs=require('fs');var path=require(_0x6b1b('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6b1b('0x7'));module[_0x6b1b('0x8')]=function(_0x371162,_0x57be15){return _0x371162[_0x6b1b('0x9')](_0x6b1b('0xa'),attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x33e5=['path','rimraf','exports','define','Dashboard','dashboards','lodash','util','../../config/logger','moment','request-promise'];(function(_0xad723a,_0x25f080){var _0x289b51=function(_0x548bd1){while(--_0x548bd1){_0xad723a['push'](_0xad723a['shift']());}};_0x289b51(++_0x25f080);}(_0x33e5,0x13a));var _0x533e=function(_0x4ad44b,_0x4e96ca){_0x4ad44b=_0x4ad44b-0x0;var _0x271b0b=_0x33e5[_0x4ad44b];return _0x271b0b;};'use strict';var _=require(_0x533e('0x0'));var util=require(_0x533e('0x1'));var logger=require(_0x533e('0x2'))('api');var moment=require(_0x533e('0x3'));var BPromise=require('bluebird');var rp=require(_0x533e('0x4'));var fs=require('fs');var path=require(_0x533e('0x5'));var rimraf=require(_0x533e('0x6'));var config=require('../../config/environment');var attributes=require('./dashboard.attributes');module[_0x533e('0x7')]=function(_0x3d834d,_0x275007){return _0x3d834d[_0x533e('0x8')](_0x533e('0x9'),attributes,{'tableName':_0x533e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index e238ae1..0ecfb6b 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 _0x0052=['stringify','error','code','message','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','request','info','Dashboard,\x20%s,\x20%s','Dashboard,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x48ff4c,_0xc57a6a){var _0x264f00=function(_0x3eb8a0){while(--_0x3eb8a0){_0x48ff4c['push'](_0x48ff4c['shift']());}};_0x264f00(++_0xc57a6a);}(_0x0052,0x184));var _0x2005=function(_0x17e24a,_0xf7ac2c){_0x17e24a=_0x17e24a-0x0;var _0x411fa8=_0x0052[_0x17e24a];return _0x411fa8;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x2005('0x0'));var rs=require(_0x2005('0x1'));var fs=require('fs');var Redis=require(_0x2005('0x2'));var db=require(_0x2005('0x3'))['db'];var utils=require(_0x2005('0x4'));var logger=require(_0x2005('0x5'))(_0x2005('0x6'));var config=require(_0x2005('0x7'));var jayson=require(_0x2005('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x2005('0x9')]=_[_0x2005('0xa')](config['redis'],{'host':_0x2005('0xb'),'port':0x18eb});var socket=require(_0x2005('0xc'))(new Redis(config['redis']));require(_0x2005('0xd'))[_0x2005('0xe')](socket);function respondWithRpcPromise(_0x163ee7,_0x4e315f,_0x3f8ae3){return new BPromise(function(_0x1462bf,_0x2753e0){return client[_0x2005('0xf')](_0x163ee7,_0x3f8ae3)['then'](function(_0x307821){logger[_0x2005('0x10')](_0x2005('0x11'),_0x4e315f,'request\x20sent');logger['debug'](_0x2005('0x12'),_0x4e315f,_0x2005('0x13'),JSON[_0x2005('0x14')](_0x307821));if(_0x307821[_0x2005('0x15')]){if(_0x307821[_0x2005('0x15')][_0x2005('0x16')]===0x1f4){logger[_0x2005('0x15')](_0x2005('0x11'),_0x4e315f,_0x307821[_0x2005('0x15')][_0x2005('0x17')]);return _0x2753e0(_0x307821[_0x2005('0x15')][_0x2005('0x17')]);}logger['error']('Dashboard,\x20%s,\x20%s',_0x4e315f,_0x307821[_0x2005('0x15')]['message']);return _0x1462bf(_0x307821[_0x2005('0x15')][_0x2005('0x17')]);}else{logger[_0x2005('0x10')](_0x2005('0x11'),_0x4e315f,'request\x20sent');_0x1462bf(_0x307821['result'][_0x2005('0x17')]);}})['catch'](function(_0x373166){logger[_0x2005('0x15')](_0x2005('0x11'),_0x4e315f,_0x373166);_0x2753e0(_0x373166);});});} \ No newline at end of file +var _0xda83=['localhost','./dashboard.socket','register','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','Dashboard,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','redis','defaults'];(function(_0xb24a3e,_0x4a3594){var _0x4038d7=function(_0x1ea3c3){while(--_0x1ea3c3){_0xb24a3e['push'](_0xb24a3e['shift']());}};_0x4038d7(++_0x4a3594);}(_0xda83,0x9e));var _0x3da8=function(_0x276df5,_0x315cb0){_0x276df5=_0x276df5-0x0;var _0x4c0925=_0xda83[_0x276df5];return _0x4c0925;};'use strict';var _=require('lodash');var util=require(_0x3da8('0x0'));var moment=require('moment');var BPromise=require(_0x3da8('0x1'));var rs=require(_0x3da8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3da8('0x3'))['db'];var utils=require(_0x3da8('0x4'));var logger=require(_0x3da8('0x5'))('rpc');var config=require(_0x3da8('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3da8('0x7')]({'port':0x232a});config[_0x3da8('0x8')]=_[_0x3da8('0x9')](config[_0x3da8('0x8')],{'host':_0x3da8('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3da8('0xb'))[_0x3da8('0xc')](socket);function respondWithRpcPromise(_0x555a79,_0xef61c6,_0x466481){return new BPromise(function(_0x2d9351,_0x168cd7){return client[_0x3da8('0xd')](_0x555a79,_0x466481)[_0x3da8('0xe')](function(_0x42ad81){logger[_0x3da8('0xf')](_0x3da8('0x10'),_0xef61c6,_0x3da8('0x11'));logger['debug'](_0x3da8('0x12'),_0xef61c6,_0x3da8('0x11'),JSON['stringify'](_0x42ad81));if(_0x42ad81[_0x3da8('0x13')]){if(_0x42ad81[_0x3da8('0x13')][_0x3da8('0x14')]===0x1f4){logger['error']('Dashboard,\x20%s,\x20%s',_0xef61c6,_0x42ad81[_0x3da8('0x13')][_0x3da8('0x15')]);return _0x168cd7(_0x42ad81[_0x3da8('0x13')][_0x3da8('0x15')]);}logger[_0x3da8('0x13')](_0x3da8('0x10'),_0xef61c6,_0x42ad81['error']['message']);return _0x2d9351(_0x42ad81[_0x3da8('0x13')]['message']);}else{logger[_0x3da8('0xf')](_0x3da8('0x10'),_0xef61c6,_0x3da8('0x11'));_0x2d9351(_0x42ad81[_0x3da8('0x16')]['message']);}})[_0x3da8('0x17')](function(_0xaa8f4){logger[_0x3da8('0x13')]('Dashboard,\x20%s,\x20%s',_0xef61c6,_0xaa8f4);_0x168cd7(_0xaa8f4);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index ffb58d5..4f07578 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 _0x8c16=['remove','removeListener','register','dashboard:','./dashboard.events'];(function(_0x4dcef2,_0x52845d){var _0xe80f33=function(_0x510b1c){while(--_0x510b1c){_0x4dcef2['push'](_0x4dcef2['shift']());}};_0xe80f33(++_0x52845d);}(_0x8c16,0x1bc));var _0x68c1=function(_0x3d1f7f,_0x51a1f4){_0x3d1f7f=_0x3d1f7f-0x0;var _0x36da60=_0x8c16[_0x3d1f7f];return _0x36da60;};'use strict';var DashboardEvents=require(_0x68c1('0x0'));var events=['save',_0x68c1('0x1'),'update'];function createListener(_0x373ad9,_0x204969){return function(_0x51af3e){_0x204969['emit'](_0x373ad9,_0x51af3e);};}function removeListener(_0x310cf7,_0xf9fbf0){return function(){DashboardEvents[_0x68c1('0x2')](_0x310cf7,_0xf9fbf0);};}exports[_0x68c1('0x3')]=function(_0x50a5d7){for(var _0x4badd7=0x0,_0x45bb69=events['length'];_0x4badd7<_0x45bb69;_0x4badd7++){var _0x4fd243=events[_0x4badd7];var _0x145778=createListener(_0x68c1('0x4')+_0x4fd243,_0x50a5d7);DashboardEvents['on'](_0x4fd243,_0x145778);}}; \ No newline at end of file +var _0x3799=['./dashboard.events','save','remove','update','register','length','dashboard:'];(function(_0xe270af,_0x16b5d4){var _0x3e65cb=function(_0x37060c){while(--_0x37060c){_0xe270af['push'](_0xe270af['shift']());}};_0x3e65cb(++_0x16b5d4);}(_0x3799,0x126));var _0x9379=function(_0x50bdc5,_0x105d23){_0x50bdc5=_0x50bdc5-0x0;var _0x375d2a=_0x3799[_0x50bdc5];return _0x375d2a;};'use strict';var DashboardEvents=require(_0x9379('0x0'));var events=[_0x9379('0x1'),_0x9379('0x2'),_0x9379('0x3')];function createListener(_0x33d5cc,_0x47444a){return function(_0x1d19e3){_0x47444a['emit'](_0x33d5cc,_0x1d19e3);};}function removeListener(_0x4fc051,_0x2f2d6a){return function(){DashboardEvents['removeListener'](_0x4fc051,_0x2f2d6a);};}exports[_0x9379('0x4')]=function(_0x10ec64){for(var _0x37ccac=0x0,_0x6a271d=events[_0x9379('0x5')];_0x37ccac<_0x6a271d;_0x37ccac++){var _0x2dc639=events[_0x37ccac];var _0x9f328e=createListener(_0x9379('0x6')+_0x2dc639,_0x10ec64);DashboardEvents['on'](_0x2dc639,_0x9f328e);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 86340ad..1049c80 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 _0xe5eb=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','isAuthenticated','index','get','/:id','show','/:id/items','getItems','post','/:id/clone','clone','put','update'];(function(_0x1ec144,_0x141f3b){var _0x388c34=function(_0x182808){while(--_0x182808){_0x1ec144['push'](_0x1ec144['shift']());}};_0x388c34(++_0x141f3b);}(_0xe5eb,0xb9));var _0xbe5e=function(_0x47beda,_0xf71fef){_0x47beda=_0x47beda-0x0;var _0x3a744f=_0xe5eb[_0x47beda];return _0x3a744f;};'use strict';var multer=require(_0xbe5e('0x0'));var util=require(_0xbe5e('0x1'));var path=require(_0xbe5e('0x2'));var timeout=require(_0xbe5e('0x3'));var express=require(_0xbe5e('0x4'));var router=express[_0xbe5e('0x5')]();var fs_extra=require(_0xbe5e('0x6'));var auth=require(_0xbe5e('0x7'));var interaction=require(_0xbe5e('0x8'));var config=require(_0xbe5e('0x9'));var controller=require(_0xbe5e('0xa'));router['get']('/',auth[_0xbe5e('0xb')](),controller[_0xbe5e('0xc')]);router[_0xbe5e('0xd')](_0xbe5e('0xe'),auth[_0xbe5e('0xb')](),controller[_0xbe5e('0xf')]);router[_0xbe5e('0xd')](_0xbe5e('0x10'),auth[_0xbe5e('0xb')](),controller[_0xbe5e('0x11')]);router[_0xbe5e('0x12')]('/',auth[_0xbe5e('0xb')](),controller['create']);router[_0xbe5e('0x12')](_0xbe5e('0x13'),auth[_0xbe5e('0xb')](),controller[_0xbe5e('0x14')]);router['post'](_0xbe5e('0x10'),auth[_0xbe5e('0xb')](),controller['addItem']);router[_0xbe5e('0x15')](_0xbe5e('0xe'),auth['isAuthenticated'](),controller[_0xbe5e('0x16')]);router[_0xbe5e('0x17')](_0xbe5e('0xe'),auth[_0xbe5e('0xb')](),controller[_0xbe5e('0x18')]);module[_0xbe5e('0x19')]=router; \ No newline at end of file +var _0xe43a=['get','/:id','show','/:id/items','getItems','create','post','clone','addItem','put','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./dashboard.controller','isAuthenticated','index'];(function(_0x165d61,_0x18426e){var _0x40c5f9=function(_0x3dac32){while(--_0x3dac32){_0x165d61['push'](_0x165d61['shift']());}};_0x40c5f9(++_0x18426e);}(_0xe43a,0xc5));var _0xae43=function(_0x5dbca2,_0x40abd8){_0x5dbca2=_0x5dbca2-0x0;var _0x22bef9=_0xe43a[_0x5dbca2];return _0x22bef9;};'use strict';var multer=require('multer');var util=require(_0xae43('0x0'));var path=require(_0xae43('0x1'));var timeout=require(_0xae43('0x2'));var express=require(_0xae43('0x3'));var router=express[_0xae43('0x4')]();var fs_extra=require(_0xae43('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xae43('0x6'));var controller=require(_0xae43('0x7'));router['get']('/',auth[_0xae43('0x8')](),controller[_0xae43('0x9')]);router[_0xae43('0xa')](_0xae43('0xb'),auth[_0xae43('0x8')](),controller[_0xae43('0xc')]);router[_0xae43('0xa')](_0xae43('0xd'),auth[_0xae43('0x8')](),controller[_0xae43('0xe')]);router['post']('/',auth[_0xae43('0x8')](),controller[_0xae43('0xf')]);router[_0xae43('0x10')]('/:id/clone',auth[_0xae43('0x8')](),controller[_0xae43('0x11')]);router[_0xae43('0x10')]('/:id/items',auth[_0xae43('0x8')](),controller[_0xae43('0x12')]);router[_0xae43('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xae43('0x14')]);router[_0xae43('0x15')]('/:id',auth[_0xae43('0x8')](),controller[_0xae43('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 4e02d29..d882812 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 _0x4819=['long','parse','getDataValue','attrs','stringify','setDataValue','INTEGER','#ffffff','#2196f3','squel','lodash','exports','STRING','TEXT'];(function(_0x175916,_0x5aa198){var _0x86c00e=function(_0x6be656){while(--_0x6be656){_0x175916['push'](_0x175916['shift']());}};_0x86c00e(++_0x5aa198);}(_0x4819,0xcd));var _0x9481=function(_0x401554,_0x34b410){_0x401554=_0x401554-0x0;var _0x5b70e9=_0x4819[_0x401554];return _0x5b70e9;};'use strict';var Sequelize=require('sequelize');var squel=require(_0x9481('0x0'));var _=require(_0x9481('0x1'));module[_0x9481('0x2')]={'title':{'type':Sequelize[_0x9481('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x9481('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x9481('0x4')](_0x9481('0x5')),'get':function(){try{return JSON[_0x9481('0x6')](this[_0x9481('0x7')](_0x9481('0x8')));}catch(_0x5ac51c){return[];}},'set':function(_0x4d9e3a){try{this['setDataValue']('attrs',JSON[_0x9481('0x9')](_0x4d9e3a));}catch(_0x6c6a08){this[_0x9481('0xa')](_0x9481('0x8'),JSON[_0x9481('0x9')]([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x9481('0xb')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize[_0x9481('0xb')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x9481('0xc'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x9481('0x3')],'allowNull':![],'defaultValue':_0x9481('0xd'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x9481('0x3')]},'titleFontSize':{'type':Sequelize[_0x9481('0xb')],'defaultValue':0xc}}; \ No newline at end of file +var _0x2a07=['setDataValue','stringify','INTEGER','#2196f3','sequelize','squel','lodash','exports','STRING','TEXT','long','parse','getDataValue','attrs'];(function(_0x12a5ac,_0x4cb0d2){var _0x282958=function(_0x3ae041){while(--_0x3ae041){_0x12a5ac['push'](_0x12a5ac['shift']());}};_0x282958(++_0x4cb0d2);}(_0x2a07,0x74));var _0x72a0=function(_0x50859e,_0x2c958a){_0x50859e=_0x50859e-0x0;var _0x5847a2=_0x2a07[_0x50859e];return _0x5847a2;};'use strict';var Sequelize=require(_0x72a0('0x0'));var squel=require(_0x72a0('0x1'));var _=require(_0x72a0('0x2'));module[_0x72a0('0x3')]={'title':{'type':Sequelize[_0x72a0('0x4')],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x72a0('0x5')](_0x72a0('0x6')),'get':function(){try{return JSON[_0x72a0('0x7')](this[_0x72a0('0x8')](_0x72a0('0x9')));}catch(_0xce74c){return[];}},'set':function(_0x3ccf6d){try{this[_0x72a0('0xa')](_0x72a0('0x9'),JSON[_0x72a0('0xb')](_0x3ccf6d));}catch(_0x21c819){this[_0x72a0('0xa')](_0x72a0('0x9'),JSON[_0x72a0('0xb')]([]));}}},'sizeX':{'type':Sequelize[_0x72a0('0xc')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x72a0('0xc')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize[_0x72a0('0xc')]},'background':{'type':Sequelize[_0x72a0('0x4')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x72a0('0x4')],'allowNull':![],'defaultValue':_0x72a0('0xd'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x72a0('0x4')]},'titleFontSize':{'type':Sequelize[_0x72a0('0xc')],'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 2a02b83..1d91270 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 _0x2af8=['params','DashboardItem','keys','query','model','attributes','intersection','fields','includeAll','include','merge','find','catch','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','attrChannel','voice','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrEmailAccounts','web-report','reportType','attrReport','attrRefresh','widgetAttributes:\x20%s','create','body','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','sendStatus','name','send','show'];(function(_0x10966b,_0x31e5f8){var _0x4c21e1=function(_0x4238dc){while(--_0x4238dc){_0x10966b['push'](_0x10966b['shift']());}};_0x4c21e1(++_0x31e5f8);}(_0x2af8,0xf6));var _0x82af=function(_0x344c8b,_0x362a62){_0x344c8b=_0x344c8b-0x0;var _0x43b7ed=_0x2af8[_0x344c8b];return _0x43b7ed;};'use strict';var emlformat=require(_0x82af('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x82af('0x1'));var jsonpatch=require(_0x82af('0x2'));var rp=require('request-promise');var moment=require(_0x82af('0x3'));var BPromise=require(_0x82af('0x4'));var Mustache=require('mustache');var util=require(_0x82af('0x5'));var path=require('path');var sox=require(_0x82af('0x6'));var csv=require(_0x82af('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x82af('0x8'));var _=require(_0x82af('0x9'));var squel=require('squel');var crypto=require(_0x82af('0xa'));var jsforce=require(_0x82af('0xb'));var deskjs=require(_0x82af('0xc'));var toCsv=require(_0x82af('0x7'));var querystring=require(_0x82af('0xd'));var Papa=require(_0x82af('0xe'));var Redis=require(_0x82af('0xf'));var authService=require(_0x82af('0x10'));var qs=require(_0x82af('0x11'));var as=require(_0x82af('0x12'));var hardwareService=require(_0x82af('0x13'));var logger=require(_0x82af('0x14'))(_0x82af('0x15'));var utils=require(_0x82af('0x16'));var config=require(_0x82af('0x17'));var licenseUtil=require(_0x82af('0x18'));var db=require(_0x82af('0x19'))['db'];config[_0x82af('0x1a')]=_['defaults'](config['redis'],{'host':_0x82af('0x1b'),'port':0x18eb});var socket=require(_0x82af('0x1c'))(new Redis(config[_0x82af('0x1a')]));require('./dashboardItem.socket')[_0x82af('0x1d')](socket);function respondWithStatusCode(_0x18332f,_0x195bd2){_0x195bd2=_0x195bd2||0xcc;return function(_0x2b7ce8){if(_0x2b7ce8){return _0x18332f['sendStatus'](_0x195bd2);}return _0x18332f[_0x82af('0x1e')](_0x195bd2)[_0x82af('0x1f')]();};}function respondWithResult(_0x25b822,_0x23e035){_0x23e035=_0x23e035||0xc8;return function(_0x216527){if(_0x216527){return _0x25b822[_0x82af('0x1e')](_0x23e035)[_0x82af('0x20')](_0x216527);}};}function respondWithFilteredResult(_0x42f7f2,_0x2b5fef){return function(_0x225b68){if(_0x225b68){var _0x3e6bd5=typeof _0x2b5fef[_0x82af('0x21')]===_0x82af('0x22')&&typeof _0x2b5fef['limit']===_0x82af('0x22');var _0x2139f8=_0x225b68[_0x82af('0x23')];var _0x20cc9e=_0x3e6bd5?0x0:_0x2b5fef['offset'];var _0x5be0d8=_0x3e6bd5?_0x225b68[_0x82af('0x23')]:_0x2b5fef['offset']+_0x2b5fef[_0x82af('0x24')];var _0x17a58a;if(_0x5be0d8>=_0x2139f8){_0x5be0d8=_0x2139f8;_0x17a58a=0xc8;}else{_0x17a58a=0xce;}_0x42f7f2[_0x82af('0x1e')](_0x17a58a);return _0x42f7f2[_0x82af('0x25')](_0x82af('0x26'),_0x20cc9e+'-'+_0x5be0d8+'/'+_0x2139f8)[_0x82af('0x20')](_0x225b68);}return null;};}function patchUpdates(_0x6e416b){return function(_0x4f6d08){try{jsonpatch[_0x82af('0x27')](_0x4f6d08,_0x6e416b,!![]);}catch(_0x4e8b45){return BPromise[_0x82af('0x28')](_0x4e8b45);}return _0x4f6d08['save']();};}function saveUpdates(_0x5ed461,_0x74853c){return function(_0x582800){if(_0x582800){return _0x582800[_0x82af('0x29')](_0x5ed461)[_0x82af('0x2a')](function(_0x158a9a){return _0x158a9a;});}return null;};}function removeEntity(_0xad287e,_0x436d07){return function(_0x21123d){if(_0x21123d){return _0x21123d[_0x82af('0x2b')]()[_0x82af('0x2a')](function(){_0xad287e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x122825,_0x37cf2b){return function(_0x5c0a33){if(!_0x5c0a33){_0x122825[_0x82af('0x2c')](0x194);}return _0x5c0a33;};}function handleError(_0x2e6753,_0x428c5e){_0x428c5e=_0x428c5e||0x1f4;return function(_0x1561f7){logger['error'](_0x1561f7['stack']);if(_0x1561f7[_0x82af('0x2d')]){delete _0x1561f7[_0x82af('0x2d')];}_0x2e6753[_0x82af('0x1e')](_0x428c5e)[_0x82af('0x2e')](_0x1561f7);};}exports[_0x82af('0x2f')]=function(_0x1fb8e6,_0x389452){var _0x9cdb3a={'raw':![],'where':{'id':_0x1fb8e6[_0x82af('0x30')]['id']}},_0x2c7aa6={};_0x2c7aa6['model']=_['keys'](db[_0x82af('0x31')]['rawAttributes']);_0x2c7aa6['query']=_[_0x82af('0x32')](_0x1fb8e6[_0x82af('0x33')]);_0x2c7aa6['filters']=_['intersection'](_0x2c7aa6[_0x82af('0x34')],_0x2c7aa6[_0x82af('0x33')]);_0x9cdb3a[_0x82af('0x35')]=_[_0x82af('0x36')](_0x2c7aa6['model'],qs[_0x82af('0x37')](_0x1fb8e6[_0x82af('0x33')][_0x82af('0x37')]));_0x9cdb3a[_0x82af('0x35')]=_0x9cdb3a[_0x82af('0x35')]['length']?_0x9cdb3a[_0x82af('0x35')]:_0x2c7aa6[_0x82af('0x34')];if(_0x1fb8e6[_0x82af('0x33')][_0x82af('0x38')]){_0x9cdb3a[_0x82af('0x39')]=[{'all':!![]}];}_0x9cdb3a=_[_0x82af('0x3a')]({},_0x9cdb3a,_0x1fb8e6['options']);return db[_0x82af('0x31')][_0x82af('0x3b')](_0x9cdb3a)[_0x82af('0x2a')](handleEntityNotFound(_0x389452,null))[_0x82af('0x2a')](respondWithResult(_0x389452,null))[_0x82af('0x3c')](handleError(_0x389452,null));};exports[_0x82af('0x2b')]=function(_0x537a1d,_0x18e212){return db[_0x82af('0x31')][_0x82af('0x3b')]({'where':{'id':_0x537a1d[_0x82af('0x30')]['id']}})[_0x82af('0x2a')](handleEntityNotFound(_0x18e212,null))[_0x82af('0x2a')](removeEntity(_0x18e212,null))['catch'](handleError(_0x18e212,null));};function widgetAttributes(_0x45c006){try{switch(_0x45c006[_0x82af('0x3d')]){case _0x82af('0x3e'):return[{'name':_0x82af('0x3f'),'value':_0x45c006['attrUrl']||(_0x45c006[_0x82af('0x40')]&&_0x45c006[_0x82af('0x40')][0x0]?_0x45c006['attrs'][0x0][_0x82af('0x41')]:undefined)||_0x82af('0x42')}];case _0x82af('0x43'):return[{'name':_0x82af('0x44'),'value':_0x45c006[_0x82af('0x44')]||(_0x45c006[_0x82af('0x40')]&&_0x45c006['attrs'][0x0]?_0x45c006[_0x82af('0x40')][0x0]['value']:undefined)||''}];case _0x82af('0x45'):return[{'name':_0x82af('0x46'),'value':_0x45c006[_0x82af('0x46')]||(_0x45c006['attrs']&&_0x45c006[_0x82af('0x40')][0x0]?_0x45c006[_0x82af('0x40')][0x0][_0x82af('0x41')]:undefined)||_0x82af('0x47')},{'name':_0x82af('0x48'),'value':_0x45c006[_0x82af('0x48')]||(_0x45c006[_0x82af('0x40')]&&_0x45c006[_0x82af('0x40')][0x1]?_0x45c006[_0x82af('0x40')][0x1]['value']:undefined)||_0x82af('0x49')},{'name':'attrFontSize','value':_0x45c006[_0x82af('0x4a')]||(_0x45c006[_0x82af('0x40')]&&_0x45c006[_0x82af('0x40')][0x2]?_0x45c006['attrs'][0x2][_0x82af('0x41')]:undefined)||0xc}];case _0x82af('0x4b'):return[{'name':_0x82af('0x4c'),'value':_0x45c006[_0x82af('0x4c')]||(_0x45c006[_0x82af('0x40')]&&_0x45c006['attrs'][0x0]?_0x45c006[_0x82af('0x40')][0x0][_0x82af('0x41')]:undefined)||'total'},{'name':'attrVoiceQueues','value':_0x45c006[_0x82af('0x4d')]||(_0x45c006[_0x82af('0x40')]&&_0x45c006[_0x82af('0x40')][0x1]?_0x45c006['attrs'][0x1][_0x82af('0x41')]:undefined)||[]},{'name':_0x82af('0x4a'),'value':_0x45c006[_0x82af('0x4a')]||(_0x45c006[_0x82af('0x40')]&&_0x45c006['attrs'][0x2]?_0x45c006[_0x82af('0x40')][0x2][_0x82af('0x41')]:undefined)||0x14},{'name':_0x82af('0x4e'),'value':_0x45c006[_0x82af('0x4e')]||(_0x45c006[_0x82af('0x40')]&&_0x45c006[_0x82af('0x40')][0x3]?_0x45c006['attrs'][0x3]['value']:undefined)||_0x82af('0x4f')},{'name':'attrEmailAccounts','value':_0x45c006['attrEmailAccounts']||(_0x45c006[_0x82af('0x40')]&&_0x45c006[_0x82af('0x40')][0x4]?_0x45c006[_0x82af('0x40')][0x4][_0x82af('0x41')]:undefined)||''},{'name':_0x82af('0x50'),'value':_0x45c006['attrFaxAccounts']||(_0x45c006[_0x82af('0x40')]&&_0x45c006[_0x82af('0x40')][0x5]?_0x45c006['attrs'][0x5][_0x82af('0x41')]:undefined)||''},{'name':_0x82af('0x51'),'value':_0x45c006[_0x82af('0x51')]||(_0x45c006[_0x82af('0x40')]&&_0x45c006[_0x82af('0x40')][0x6]?_0x45c006[_0x82af('0x40')][0x6][_0x82af('0x41')]:undefined)||''},{'name':_0x82af('0x52'),'value':_0x45c006['attrOpenchannelAccounts']||(_0x45c006[_0x82af('0x40')]&&_0x45c006[_0x82af('0x40')][0x7]?_0x45c006['attrs'][0x7][_0x82af('0x41')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x45c006[_0x82af('0x53')]||(_0x45c006[_0x82af('0x40')]&&_0x45c006[_0x82af('0x40')][0x8]?_0x45c006[_0x82af('0x40')][0x8][_0x82af('0x41')]:undefined)||''},{'name':_0x82af('0x54'),'value':_0x45c006[_0x82af('0x54')]||(_0x45c006[_0x82af('0x40')]&&_0x45c006[_0x82af('0x40')][0x9]?_0x45c006[_0x82af('0x40')][0x9]['value']:undefined)||''}];case _0x82af('0x55'):case _0x82af('0x56'):return[{'name':_0x82af('0x57'),'value':_0x45c006[_0x82af('0x57')]||(_0x45c006[_0x82af('0x40')]&&_0x45c006[_0x82af('0x40')][0x0]?_0x45c006[_0x82af('0x40')][0x0]['value']:undefined)||'total'},{'name':_0x82af('0x58'),'value':_0x45c006['attrSerie2']||(_0x45c006[_0x82af('0x40')]&&_0x45c006['attrs'][0x1]?_0x45c006[_0x82af('0x40')][0x1][_0x82af('0x41')]:undefined)||null},{'name':_0x82af('0x59'),'value':_0x45c006[_0x82af('0x59')]||(_0x45c006[_0x82af('0x40')]&&_0x45c006[_0x82af('0x40')][0x2]?_0x45c006['attrs'][0x2]['value']:undefined)||null},{'name':'attrVoiceQueues','value':_0x45c006[_0x82af('0x4d')]||(_0x45c006['attrs']&&_0x45c006[_0x82af('0x40')][0x3]?_0x45c006[_0x82af('0x40')][0x3]['value']:undefined)||[]},{'name':_0x82af('0x4e'),'value':_0x45c006['attrChannel']||(_0x45c006['attrs']&&_0x45c006[_0x82af('0x40')][0x4]?_0x45c006[_0x82af('0x40')][0x4][_0x82af('0x41')]:undefined)||_0x82af('0x4f')},{'name':'attrEmailAccounts','value':_0x45c006[_0x82af('0x5a')]||(_0x45c006['attrs']&&_0x45c006[_0x82af('0x40')][0x5]?_0x45c006[_0x82af('0x40')][0x5]['value']:undefined)||''},{'name':'attrFaxAccounts','value':_0x45c006[_0x82af('0x50')]||(_0x45c006[_0x82af('0x40')]&&_0x45c006[_0x82af('0x40')][0x6]?_0x45c006['attrs'][0x6][_0x82af('0x41')]:undefined)||''},{'name':_0x82af('0x51'),'value':_0x45c006[_0x82af('0x51')]||(_0x45c006[_0x82af('0x40')]&&_0x45c006[_0x82af('0x40')][0x7]?_0x45c006['attrs'][0x7][_0x82af('0x41')]:undefined)||''},{'name':_0x82af('0x52'),'value':_0x45c006['attrOpenchannelAccounts']||(_0x45c006[_0x82af('0x40')]&&_0x45c006[_0x82af('0x40')][0x8]?_0x45c006[_0x82af('0x40')][0x8][_0x82af('0x41')]:undefined)||''},{'name':_0x82af('0x53'),'value':_0x45c006[_0x82af('0x53')]||(_0x45c006[_0x82af('0x40')]&&_0x45c006['attrs'][0x9]?_0x45c006[_0x82af('0x40')][0x9][_0x82af('0x41')]:undefined)||''},{'name':_0x82af('0x54'),'value':_0x45c006['attrChatWebsites']||(_0x45c006[_0x82af('0x40')]&&_0x45c006[_0x82af('0x40')][0xa]?_0x45c006['attrs'][0xa][_0x82af('0x41')]:undefined)||''}];case _0x82af('0x5b'):return[{'name':'attrReport','type':_0x45c006[_0x82af('0x5c')]||(_0x45c006[_0x82af('0x40')]&&_0x45c006[_0x82af('0x40')][0x0]?_0x45c006['attrs'][0x0][_0x82af('0x3d')]:undefined)||null,'value':_0x45c006[_0x82af('0x5d')]||(_0x45c006[_0x82af('0x40')]&&_0x45c006['attrs'][0x0]?_0x45c006[_0x82af('0x40')][0x0][_0x82af('0x41')]:undefined)||null},{'name':_0x82af('0x5e'),'value':_0x45c006[_0x82af('0x5e')]||(_0x45c006['attrs']&&_0x45c006[_0x82af('0x40')][0x1]?_0x45c006[_0x82af('0x40')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x5f378f){logger['error'](_0x82af('0x5f'),JSON['stringify'](_0x5f378f));return[];}}exports[_0x82af('0x60')]=function(_0x36011b,_0x5ef008){if(_0x36011b[_0x82af('0x61')]){_0x36011b[_0x82af('0x61')][_0x82af('0x40')]=widgetAttributes(_0x36011b[_0x82af('0x61')]);}return db[_0x82af('0x31')]['create'](_0x36011b[_0x82af('0x61')],{})[_0x82af('0x2a')](respondWithResult(_0x5ef008,0xc9))[_0x82af('0x3c')](handleError(_0x5ef008,null));};exports['update']=function(_0x3ebee2,_0x126d50){if(_0x3ebee2[_0x82af('0x61')]['id']){delete _0x3ebee2[_0x82af('0x61')]['id'];}_0x3ebee2[_0x82af('0x61')]['attrs']=widgetAttributes(_0x3ebee2[_0x82af('0x61')]);return db[_0x82af('0x31')][_0x82af('0x3b')]({'where':{'id':_0x3ebee2['params']['id']}})[_0x82af('0x2a')](handleEntityNotFound(_0x126d50,null))[_0x82af('0x2a')](saveUpdates(_0x3ebee2[_0x82af('0x61')],null))['then'](respondWithResult(_0x126d50,null))[_0x82af('0x3c')](handleError(_0x126d50,null));}; \ No newline at end of file +var _0xb296=['undefined','limit','count','set','Content-Range','apply','reject','update','then','error','stack','name','send','show','params','model','keys','DashboardItem','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','iframe','attrUrl','attrs','value','https://','custom','attrPath','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrWhatsappAccounts','multibar-chart','attrSerie1','attrSerie2','attrSerie3','attrVoiceQueues','voice','attrOpenchannelAccounts','attrChatWebsites','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','./dashboardItem.socket','sendStatus','status','end','json','offset'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xb296,0xa3));var _0x6b29=function(_0x4a85f6,_0x3cf170){_0x4a85f6=_0x4a85f6-0x0;var _0x17281f=_0xb296[_0x4a85f6];return _0x17281f;};'use strict';var emlformat=require(_0x6b29('0x0'));var rimraf=require(_0x6b29('0x1'));var zipdir=require(_0x6b29('0x2'));var jsonpatch=require(_0x6b29('0x3'));var rp=require(_0x6b29('0x4'));var moment=require(_0x6b29('0x5'));var BPromise=require(_0x6b29('0x6'));var Mustache=require('mustache');var util=require(_0x6b29('0x7'));var path=require('path');var sox=require(_0x6b29('0x8'));var csv=require(_0x6b29('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6b29('0xa'));var _=require(_0x6b29('0xb'));var squel=require(_0x6b29('0xc'));var crypto=require(_0x6b29('0xd'));var jsforce=require(_0x6b29('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x6b29('0x9'));var querystring=require(_0x6b29('0xf'));var Papa=require(_0x6b29('0x10'));var Redis=require(_0x6b29('0x11'));var authService=require(_0x6b29('0x12'));var qs=require(_0x6b29('0x13'));var as=require(_0x6b29('0x14'));var hardwareService=require(_0x6b29('0x15'));var logger=require('../../config/logger')(_0x6b29('0x16'));var utils=require(_0x6b29('0x17'));var config=require(_0x6b29('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x6b29('0x19'))['db'];config['redis']=_['defaults'](config[_0x6b29('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6b29('0x1a')]));require(_0x6b29('0x1b'))['register'](socket);function respondWithStatusCode(_0x37a206,_0x222635){_0x222635=_0x222635||0xcc;return function(_0x9e1b53){if(_0x9e1b53){return _0x37a206[_0x6b29('0x1c')](_0x222635);}return _0x37a206[_0x6b29('0x1d')](_0x222635)[_0x6b29('0x1e')]();};}function respondWithResult(_0x383e5f,_0x578ab5){_0x578ab5=_0x578ab5||0xc8;return function(_0x45acdf){if(_0x45acdf){return _0x383e5f[_0x6b29('0x1d')](_0x578ab5)[_0x6b29('0x1f')](_0x45acdf);}};}function respondWithFilteredResult(_0x49620d,_0x4b348d){return function(_0xc9511c){if(_0xc9511c){var _0x298470=typeof _0x4b348d[_0x6b29('0x20')]===_0x6b29('0x21')&&typeof _0x4b348d[_0x6b29('0x22')]===_0x6b29('0x21');var _0x412e1d=_0xc9511c[_0x6b29('0x23')];var _0x555008=_0x298470?0x0:_0x4b348d[_0x6b29('0x20')];var _0xdf69a8=_0x298470?_0xc9511c[_0x6b29('0x23')]:_0x4b348d['offset']+_0x4b348d[_0x6b29('0x22')];var _0x2f2fdc;if(_0xdf69a8>=_0x412e1d){_0xdf69a8=_0x412e1d;_0x2f2fdc=0xc8;}else{_0x2f2fdc=0xce;}_0x49620d['status'](_0x2f2fdc);return _0x49620d[_0x6b29('0x24')](_0x6b29('0x25'),_0x555008+'-'+_0xdf69a8+'/'+_0x412e1d)['json'](_0xc9511c);}return null;};}function patchUpdates(_0x312e12){return function(_0x1696cd){try{jsonpatch[_0x6b29('0x26')](_0x1696cd,_0x312e12,!![]);}catch(_0x263fb2){return BPromise[_0x6b29('0x27')](_0x263fb2);}return _0x1696cd['save']();};}function saveUpdates(_0x2765d5,_0x4d7521){return function(_0x237cad){if(_0x237cad){return _0x237cad[_0x6b29('0x28')](_0x2765d5)[_0x6b29('0x29')](function(_0x5ab584){return _0x5ab584;});}return null;};}function removeEntity(_0x308142,_0x21c442){return function(_0x269d55){if(_0x269d55){return _0x269d55['destroy']()[_0x6b29('0x29')](function(){_0x308142[_0x6b29('0x1d')](0xcc)[_0x6b29('0x1e')]();});}};}function handleEntityNotFound(_0x654528,_0x5546b4){return function(_0x537092){if(!_0x537092){_0x654528[_0x6b29('0x1c')](0x194);}return _0x537092;};}function handleError(_0x207c39,_0x330a6d){_0x330a6d=_0x330a6d||0x1f4;return function(_0x18ea35){logger[_0x6b29('0x2a')](_0x18ea35[_0x6b29('0x2b')]);if(_0x18ea35[_0x6b29('0x2c')]){delete _0x18ea35['name'];}_0x207c39[_0x6b29('0x1d')](_0x330a6d)[_0x6b29('0x2d')](_0x18ea35);};}exports[_0x6b29('0x2e')]=function(_0x36e708,_0x36e293){var _0x2343c0={'raw':![],'where':{'id':_0x36e708[_0x6b29('0x2f')]['id']}},_0x49bb5b={};_0x49bb5b[_0x6b29('0x30')]=_[_0x6b29('0x31')](db[_0x6b29('0x32')][_0x6b29('0x33')]);_0x49bb5b[_0x6b29('0x34')]=_[_0x6b29('0x31')](_0x36e708['query']);_0x49bb5b[_0x6b29('0x35')]=_[_0x6b29('0x36')](_0x49bb5b[_0x6b29('0x30')],_0x49bb5b[_0x6b29('0x34')]);_0x2343c0[_0x6b29('0x37')]=_[_0x6b29('0x36')](_0x49bb5b[_0x6b29('0x30')],qs[_0x6b29('0x38')](_0x36e708['query']['fields']));_0x2343c0['attributes']=_0x2343c0['attributes'][_0x6b29('0x39')]?_0x2343c0[_0x6b29('0x37')]:_0x49bb5b[_0x6b29('0x30')];if(_0x36e708['query'][_0x6b29('0x3a')]){_0x2343c0[_0x6b29('0x3b')]=[{'all':!![]}];}_0x2343c0=_[_0x6b29('0x3c')]({},_0x2343c0,_0x36e708[_0x6b29('0x3d')]);return db['DashboardItem'][_0x6b29('0x3e')](_0x2343c0)[_0x6b29('0x29')](handleEntityNotFound(_0x36e293,null))[_0x6b29('0x29')](respondWithResult(_0x36e293,null))['catch'](handleError(_0x36e293,null));};exports['destroy']=function(_0x31fe46,_0x5b8e0f){return db['DashboardItem'][_0x6b29('0x3e')]({'where':{'id':_0x31fe46[_0x6b29('0x2f')]['id']}})[_0x6b29('0x29')](handleEntityNotFound(_0x5b8e0f,null))[_0x6b29('0x29')](removeEntity(_0x5b8e0f,null))['catch'](handleError(_0x5b8e0f,null));};function widgetAttributes(_0x37f14e){try{switch(_0x37f14e['type']){case _0x6b29('0x3f'):return[{'name':_0x6b29('0x40'),'value':_0x37f14e[_0x6b29('0x40')]||(_0x37f14e[_0x6b29('0x41')]&&_0x37f14e[_0x6b29('0x41')][0x0]?_0x37f14e['attrs'][0x0][_0x6b29('0x42')]:undefined)||_0x6b29('0x43')}];case _0x6b29('0x44'):return[{'name':_0x6b29('0x45'),'value':_0x37f14e['attrPath']||(_0x37f14e[_0x6b29('0x41')]&&_0x37f14e['attrs'][0x0]?_0x37f14e[_0x6b29('0x41')][0x0][_0x6b29('0x42')]:undefined)||''}];case'clock':return[{'name':'attrHourFormat','value':_0x37f14e[_0x6b29('0x46')]||(_0x37f14e[_0x6b29('0x41')]&&_0x37f14e[_0x6b29('0x41')][0x0]?_0x37f14e[_0x6b29('0x41')][0x0]['value']:undefined)||_0x6b29('0x47')},{'name':_0x6b29('0x48'),'value':_0x37f14e['attrTimezone']||(_0x37f14e[_0x6b29('0x41')]&&_0x37f14e[_0x6b29('0x41')][0x1]?_0x37f14e['attrs'][0x1][_0x6b29('0x42')]:undefined)||_0x6b29('0x49')},{'name':_0x6b29('0x4a'),'value':_0x37f14e['attrFontSize']||(_0x37f14e['attrs']&&_0x37f14e[_0x6b29('0x41')][0x2]?_0x37f14e[_0x6b29('0x41')][0x2][_0x6b29('0x42')]:undefined)||0xc}];case _0x6b29('0x4b'):return[{'name':_0x6b29('0x4c'),'value':_0x37f14e[_0x6b29('0x4c')]||(_0x37f14e[_0x6b29('0x41')]&&_0x37f14e['attrs'][0x0]?_0x37f14e[_0x6b29('0x41')][0x0][_0x6b29('0x42')]:undefined)||_0x6b29('0x4d')},{'name':'attrVoiceQueues','value':_0x37f14e['attrVoiceQueues']||(_0x37f14e[_0x6b29('0x41')]&&_0x37f14e[_0x6b29('0x41')][0x1]?_0x37f14e[_0x6b29('0x41')][0x1]['value']:undefined)||[]},{'name':_0x6b29('0x4a'),'value':_0x37f14e[_0x6b29('0x4a')]||(_0x37f14e['attrs']&&_0x37f14e[_0x6b29('0x41')][0x2]?_0x37f14e['attrs'][0x2][_0x6b29('0x42')]:undefined)||0x14},{'name':_0x6b29('0x4e'),'value':_0x37f14e['attrChannel']||(_0x37f14e[_0x6b29('0x41')]&&_0x37f14e[_0x6b29('0x41')][0x3]?_0x37f14e[_0x6b29('0x41')][0x3][_0x6b29('0x42')]:undefined)||'voice'},{'name':_0x6b29('0x4f'),'value':_0x37f14e[_0x6b29('0x4f')]||(_0x37f14e[_0x6b29('0x41')]&&_0x37f14e[_0x6b29('0x41')][0x4]?_0x37f14e['attrs'][0x4][_0x6b29('0x42')]:undefined)||''},{'name':_0x6b29('0x50'),'value':_0x37f14e[_0x6b29('0x50')]||(_0x37f14e['attrs']&&_0x37f14e[_0x6b29('0x41')][0x5]?_0x37f14e[_0x6b29('0x41')][0x5][_0x6b29('0x42')]:undefined)||''},{'name':_0x6b29('0x51'),'value':_0x37f14e[_0x6b29('0x51')]||(_0x37f14e['attrs']&&_0x37f14e[_0x6b29('0x41')][0x6]?_0x37f14e[_0x6b29('0x41')][0x6]['value']:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x37f14e['attrOpenchannelAccounts']||(_0x37f14e[_0x6b29('0x41')]&&_0x37f14e['attrs'][0x7]?_0x37f14e[_0x6b29('0x41')][0x7][_0x6b29('0x42')]:undefined)||''},{'name':_0x6b29('0x52'),'value':_0x37f14e[_0x6b29('0x52')]||(_0x37f14e[_0x6b29('0x41')]&&_0x37f14e[_0x6b29('0x41')][0x8]?_0x37f14e[_0x6b29('0x41')][0x8]['value']:undefined)||''},{'name':'attrChatWebsites','value':_0x37f14e['attrChatWebsites']||(_0x37f14e[_0x6b29('0x41')]&&_0x37f14e[_0x6b29('0x41')][0x9]?_0x37f14e['attrs'][0x9][_0x6b29('0x42')]:undefined)||''}];case _0x6b29('0x53'):case'pie-chart':return[{'name':_0x6b29('0x54'),'value':_0x37f14e[_0x6b29('0x54')]||(_0x37f14e[_0x6b29('0x41')]&&_0x37f14e[_0x6b29('0x41')][0x0]?_0x37f14e[_0x6b29('0x41')][0x0]['value']:undefined)||_0x6b29('0x4d')},{'name':_0x6b29('0x55'),'value':_0x37f14e[_0x6b29('0x55')]||(_0x37f14e[_0x6b29('0x41')]&&_0x37f14e['attrs'][0x1]?_0x37f14e[_0x6b29('0x41')][0x1][_0x6b29('0x42')]:undefined)||null},{'name':_0x6b29('0x56'),'value':_0x37f14e[_0x6b29('0x56')]||(_0x37f14e[_0x6b29('0x41')]&&_0x37f14e[_0x6b29('0x41')][0x2]?_0x37f14e[_0x6b29('0x41')][0x2][_0x6b29('0x42')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x37f14e[_0x6b29('0x57')]||(_0x37f14e[_0x6b29('0x41')]&&_0x37f14e['attrs'][0x3]?_0x37f14e[_0x6b29('0x41')][0x3]['value']:undefined)||[]},{'name':_0x6b29('0x4e'),'value':_0x37f14e[_0x6b29('0x4e')]||(_0x37f14e['attrs']&&_0x37f14e[_0x6b29('0x41')][0x4]?_0x37f14e[_0x6b29('0x41')][0x4][_0x6b29('0x42')]:undefined)||_0x6b29('0x58')},{'name':'attrEmailAccounts','value':_0x37f14e[_0x6b29('0x4f')]||(_0x37f14e[_0x6b29('0x41')]&&_0x37f14e[_0x6b29('0x41')][0x5]?_0x37f14e[_0x6b29('0x41')][0x5][_0x6b29('0x42')]:undefined)||''},{'name':_0x6b29('0x50'),'value':_0x37f14e[_0x6b29('0x50')]||(_0x37f14e[_0x6b29('0x41')]&&_0x37f14e[_0x6b29('0x41')][0x6]?_0x37f14e[_0x6b29('0x41')][0x6][_0x6b29('0x42')]:undefined)||''},{'name':_0x6b29('0x51'),'value':_0x37f14e['attrSmsAccounts']||(_0x37f14e[_0x6b29('0x41')]&&_0x37f14e['attrs'][0x7]?_0x37f14e['attrs'][0x7][_0x6b29('0x42')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x37f14e[_0x6b29('0x59')]||(_0x37f14e[_0x6b29('0x41')]&&_0x37f14e[_0x6b29('0x41')][0x8]?_0x37f14e['attrs'][0x8]['value']:undefined)||''},{'name':_0x6b29('0x52'),'value':_0x37f14e[_0x6b29('0x52')]||(_0x37f14e[_0x6b29('0x41')]&&_0x37f14e[_0x6b29('0x41')][0x9]?_0x37f14e[_0x6b29('0x41')][0x9][_0x6b29('0x42')]:undefined)||''},{'name':'attrChatWebsites','value':_0x37f14e[_0x6b29('0x5a')]||(_0x37f14e[_0x6b29('0x41')]&&_0x37f14e[_0x6b29('0x41')][0xa]?_0x37f14e['attrs'][0xa][_0x6b29('0x42')]:undefined)||''}];case'web-report':return[{'name':_0x6b29('0x5b'),'type':_0x37f14e['reportType']||(_0x37f14e['attrs']&&_0x37f14e['attrs'][0x0]?_0x37f14e[_0x6b29('0x41')][0x0]['type']:undefined)||null,'value':_0x37f14e[_0x6b29('0x5b')]||(_0x37f14e['attrs']&&_0x37f14e[_0x6b29('0x41')][0x0]?_0x37f14e[_0x6b29('0x41')][0x0][_0x6b29('0x42')]:undefined)||null},{'name':'attrRefresh','value':_0x37f14e[_0x6b29('0x5c')]||(_0x37f14e['attrs']&&_0x37f14e[_0x6b29('0x41')][0x1]?_0x37f14e['attrs'][0x1][_0x6b29('0x42')]:undefined)||0x0}];default:return[];}}catch(_0x41e527){logger[_0x6b29('0x2a')](_0x6b29('0x5d'),JSON[_0x6b29('0x5e')](_0x41e527));return[];}}exports[_0x6b29('0x5f')]=function(_0x466222,_0x1e4684){if(_0x466222[_0x6b29('0x60')]){_0x466222['body'][_0x6b29('0x41')]=widgetAttributes(_0x466222[_0x6b29('0x60')]);}return db[_0x6b29('0x32')][_0x6b29('0x5f')](_0x466222['body'],{})[_0x6b29('0x29')](respondWithResult(_0x1e4684,0xc9))['catch'](handleError(_0x1e4684,null));};exports['update']=function(_0x2e9ee0,_0x92a3b2){if(_0x2e9ee0[_0x6b29('0x60')]['id']){delete _0x2e9ee0[_0x6b29('0x60')]['id'];}_0x2e9ee0[_0x6b29('0x60')][_0x6b29('0x41')]=widgetAttributes(_0x2e9ee0[_0x6b29('0x60')]);return db[_0x6b29('0x32')][_0x6b29('0x3e')]({'where':{'id':_0x2e9ee0['params']['id']}})['then'](handleEntityNotFound(_0x92a3b2,null))[_0x6b29('0x29')](saveUpdates(_0x2e9ee0[_0x6b29('0x60')],null))['then'](respondWithResult(_0x92a3b2,null))[_0x6b29('0x61')](handleError(_0x92a3b2,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index ddd7403..634a3e3 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 _0x002d=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','DashboardItem','update','remove'];(function(_0x3ca527,_0x2f821a){var _0x270680=function(_0xe2a92){while(--_0xe2a92){_0x3ca527['push'](_0x3ca527['shift']());}};_0x270680(++_0x2f821a);}(_0x002d,0xca));var _0xd002=function(_0x3c4ef0,_0x7722d){_0x3c4ef0=_0x3c4ef0-0x0;var _0x38e4ba=_0x002d[_0x3c4ef0];return _0x38e4ba;};'use strict';var EventEmitter=require(_0xd002('0x0'));var DashboardItem=require(_0xd002('0x1'))['db'][_0xd002('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xd002('0x3'),'afterDestroy':_0xd002('0x4')};function emitEvent(_0x1c0d0a){return function(_0x24ff42,_0x1323f0,_0x179915){DashboardItemEvents[_0xd002('0x5')](_0x1c0d0a+':'+_0x24ff42['id'],_0x24ff42);DashboardItemEvents[_0xd002('0x5')](_0x1c0d0a,_0x24ff42);_0x179915(null);};}for(var e in events){if(events[_0xd002('0x6')](e)){var event=events[e];DashboardItem[_0xd002('0x7')](e,emitEvent(event));}}module[_0xd002('0x8')]=DashboardItemEvents; \ No newline at end of file +var _0xf801=['DashboardItem','setMaxListeners','update','remove','emit','hook','events','../../mysqldb'];(function(_0x5f0bdb,_0x11147d){var _0xce4df8=function(_0x3572ca){while(--_0x3572ca){_0x5f0bdb['push'](_0x5f0bdb['shift']());}};_0xce4df8(++_0x11147d);}(_0xf801,0x96));var _0x1f80=function(_0x260b6f,_0x1edc36){_0x260b6f=_0x260b6f-0x0;var _0x3f672e=_0xf801[_0x260b6f];return _0x3f672e;};'use strict';var EventEmitter=require(_0x1f80('0x0'));var DashboardItem=require(_0x1f80('0x1'))['db'][_0x1f80('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x1f80('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1f80('0x4'),'afterDestroy':_0x1f80('0x5')};function emitEvent(_0x5b85f6){return function(_0x46c013,_0x2e65a6,_0x1b46d4){DashboardItemEvents[_0x1f80('0x6')](_0x5b85f6+':'+_0x46c013['id'],_0x46c013);DashboardItemEvents['emit'](_0x5b85f6,_0x46c013);_0x1b46d4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0x1f80('0x7')](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 fe5bfcc..cdcfba2 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 _0xe49f=['request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes','define','dashboard_items','lodash','../../config/logger','api','moment','bluebird'];(function(_0x41aea2,_0x175a77){var _0x4e1f8c=function(_0xdfca29){while(--_0xdfca29){_0x41aea2['push'](_0x41aea2['shift']());}};_0x4e1f8c(++_0x175a77);}(_0xe49f,0x17b));var _0xfe49=function(_0x5082fa,_0x3135c3){_0x5082fa=_0x5082fa-0x0;var _0x21e53f=_0xe49f[_0x5082fa];return _0x21e53f;};'use strict';var _=require(_0xfe49('0x0'));var util=require('util');var logger=require(_0xfe49('0x1'))(_0xfe49('0x2'));var moment=require(_0xfe49('0x3'));var BPromise=require(_0xfe49('0x4'));var rp=require(_0xfe49('0x5'));var fs=require('fs');var path=require(_0xfe49('0x6'));var rimraf=require(_0xfe49('0x7'));var config=require(_0xfe49('0x8'));var attributes=require(_0xfe49('0x9'));module['exports']=function(_0x1a2ef4,_0x8acca7){return _0x1a2ef4[_0xfe49('0xa')]('DashboardItem',attributes,{'tableName':_0xfe49('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3ea0=['define','lodash','util','../../config/logger','api','request-promise','path','../../config/environment','exports'];(function(_0x28056d,_0x4c78a7){var _0x293e5b=function(_0x4400cd){while(--_0x4400cd){_0x28056d['push'](_0x28056d['shift']());}};_0x293e5b(++_0x4c78a7);}(_0x3ea0,0xf4));var _0x03ea=function(_0x296b3c,_0x203828){_0x296b3c=_0x296b3c-0x0;var _0x53adfa=_0x3ea0[_0x296b3c];return _0x53adfa;};'use strict';var _=require(_0x03ea('0x0'));var util=require(_0x03ea('0x1'));var logger=require(_0x03ea('0x2'))(_0x03ea('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x03ea('0x4'));var fs=require('fs');var path=require(_0x03ea('0x5'));var rimraf=require('rimraf');var config=require(_0x03ea('0x6'));var attributes=require('./dashboardItem.attributes');module[_0x03ea('0x7')]=function(_0x4b157a,_0x1e251e){return _0x4b157a[_0x03ea('0x8')]('DashboardItem',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 0fbbc85..fd4bf02 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 _0x050a=['register','then','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket'];(function(_0x4f7618,_0x243df2){var _0x20ba5f=function(_0x1bfe65){while(--_0x1bfe65){_0x4f7618['push'](_0x4f7618['shift']());}};_0x20ba5f(++_0x243df2);}(_0x050a,0x1a0));var _0xa050=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x050a[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0xa050('0x0'));var util=require(_0xa050('0x1'));var moment=require('moment');var BPromise=require(_0xa050('0x2'));var rs=require(_0xa050('0x3'));var fs=require('fs');var Redis=require(_0xa050('0x4'));var db=require(_0xa050('0x5'))['db'];var utils=require(_0xa050('0x6'));var logger=require(_0xa050('0x7'))(_0xa050('0x8'));var config=require('../../config/environment');var jayson=require(_0xa050('0x9'));var client=jayson[_0xa050('0xa')]['http']({'port':0x232a});config[_0xa050('0xb')]=_[_0xa050('0xc')](config['redis'],{'host':_0xa050('0xd'),'port':0x18eb});var socket=require(_0xa050('0xe'))(new Redis(config[_0xa050('0xb')]));require(_0xa050('0xf'))[_0xa050('0x10')](socket);function respondWithRpcPromise(_0x22fea9,_0x3bf141,_0xf5fe60){return new BPromise(function(_0x4bdf32,_0x4987d0){return client['request'](_0x22fea9,_0xf5fe60)[_0xa050('0x11')](function(_0x428d17){logger['info'](_0xa050('0x12'),_0x3bf141,_0xa050('0x13'));logger[_0xa050('0x14')](_0xa050('0x15'),_0x3bf141,_0xa050('0x13'),JSON['stringify'](_0x428d17));if(_0x428d17['error']){if(_0x428d17[_0xa050('0x16')]['code']===0x1f4){logger['error'](_0xa050('0x12'),_0x3bf141,_0x428d17[_0xa050('0x16')][_0xa050('0x17')]);return _0x4987d0(_0x428d17[_0xa050('0x16')]['message']);}logger[_0xa050('0x16')](_0xa050('0x12'),_0x3bf141,_0x428d17['error'][_0xa050('0x17')]);return _0x4bdf32(_0x428d17['error'][_0xa050('0x17')]);}else{logger[_0xa050('0x18')](_0xa050('0x12'),_0x3bf141,_0xa050('0x13'));_0x4bdf32(_0x428d17[_0xa050('0x19')][_0xa050('0x17')]);}})[_0xa050('0x1a')](function(_0x1f5b6d){logger[_0xa050('0x16')]('DashboardItem,\x20%s,\x20%s',_0x3bf141,_0x1f5b6d);_0x4987d0(_0x1f5b6d);});});} \ No newline at end of file +var _0xf28c=['../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./dashboardItem.socket','request','then','info','request\x20sent','stringify','error','code','DashboardItem,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x5a523e,_0x3d2f3d){var _0x2f756c=function(_0x5c049a){while(--_0x5c049a){_0x5a523e['push'](_0x5a523e['shift']());}};_0x2f756c(++_0x3d2f3d);}(_0xf28c,0x1cc));var _0xcf28=function(_0x3444e4,_0x14d6ae){_0x3444e4=_0x3444e4-0x0;var _0x5acba3=_0xf28c[_0x3444e4];return _0x5acba3;};'use strict';var _=require(_0xcf28('0x0'));var util=require(_0xcf28('0x1'));var moment=require(_0xcf28('0x2'));var BPromise=require(_0xcf28('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcf28('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xcf28('0x5'));var logger=require(_0xcf28('0x6'))(_0xcf28('0x7'));var config=require(_0xcf28('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xcf28('0x9')][_0xcf28('0xa')]({'port':0x232a});config['redis']=_[_0xcf28('0xb')](config[_0xcf28('0xc')],{'host':_0xcf28('0xd'),'port':0x18eb});var socket=require(_0xcf28('0xe'))(new Redis(config[_0xcf28('0xc')]));require(_0xcf28('0xf'))['register'](socket);function respondWithRpcPromise(_0x4a724c,_0x1ea704,_0x2e09ef){return new BPromise(function(_0x14550b,_0x408e15){return client[_0xcf28('0x10')](_0x4a724c,_0x2e09ef)[_0xcf28('0x11')](function(_0xf8f877){logger[_0xcf28('0x12')]('DashboardItem,\x20%s,\x20%s',_0x1ea704,_0xcf28('0x13'));logger['debug']('DashboardItem,\x20%s,\x20%s,\x20%s',_0x1ea704,_0xcf28('0x13'),JSON[_0xcf28('0x14')](_0xf8f877));if(_0xf8f877[_0xcf28('0x15')]){if(_0xf8f877[_0xcf28('0x15')][_0xcf28('0x16')]===0x1f4){logger['error'](_0xcf28('0x17'),_0x1ea704,_0xf8f877[_0xcf28('0x15')][_0xcf28('0x18')]);return _0x408e15(_0xf8f877[_0xcf28('0x15')]['message']);}logger[_0xcf28('0x15')](_0xcf28('0x17'),_0x1ea704,_0xf8f877[_0xcf28('0x15')][_0xcf28('0x18')]);return _0x14550b(_0xf8f877[_0xcf28('0x15')]['message']);}else{logger[_0xcf28('0x12')](_0xcf28('0x17'),_0x1ea704,_0xcf28('0x13'));_0x14550b(_0xf8f877[_0xcf28('0x19')][_0xcf28('0x18')]);}})['catch'](function(_0x33768a){logger[_0xcf28('0x15')](_0xcf28('0x17'),_0x1ea704,_0x33768a);_0x408e15(_0x33768a);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index b7e940c..5dd86e9 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 _0x14b3=['length','dashboardItem:','./dashboardItem.events','remove','update','emit','removeListener','register'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0x14b3,0x1f2));var _0x314b=function(_0x5130aa,_0x441b77){_0x5130aa=_0x5130aa-0x0;var _0x125ec6=_0x14b3[_0x5130aa];return _0x125ec6;};'use strict';var DashboardItemEvents=require(_0x314b('0x0'));var events=['save',_0x314b('0x1'),_0x314b('0x2')];function createListener(_0x18cbc6,_0x26bd54){return function(_0x499b5b){_0x26bd54[_0x314b('0x3')](_0x18cbc6,_0x499b5b);};}function removeListener(_0x2ad41e,_0x2e2966){return function(){DashboardItemEvents[_0x314b('0x4')](_0x2ad41e,_0x2e2966);};}exports[_0x314b('0x5')]=function(_0xa6e202){for(var _0x3cf94c=0x0,_0x4b0578=events[_0x314b('0x6')];_0x3cf94c<_0x4b0578;_0x3cf94c++){var _0x2d9730=events[_0x3cf94c];var _0x50079d=createListener(_0x314b('0x7')+_0x2d9730,_0xa6e202);DashboardItemEvents['on'](_0x2d9730,_0x50079d);}}; \ No newline at end of file +var _0x6d1f=['length','dashboardItem:','./dashboardItem.events','save','remove','update','register'];(function(_0x51c819,_0xd812db){var _0x15c5d2=function(_0x2977f0){while(--_0x2977f0){_0x51c819['push'](_0x51c819['shift']());}};_0x15c5d2(++_0xd812db);}(_0x6d1f,0x175));var _0xf6d1=function(_0x3aecd3,_0x27befa){_0x3aecd3=_0x3aecd3-0x0;var _0x15ffa1=_0x6d1f[_0x3aecd3];return _0x15ffa1;};'use strict';var DashboardItemEvents=require(_0xf6d1('0x0'));var events=[_0xf6d1('0x1'),_0xf6d1('0x2'),_0xf6d1('0x3')];function createListener(_0x12c27d,_0xae7a6f){return function(_0x3b7cbd){_0xae7a6f['emit'](_0x12c27d,_0x3b7cbd);};}function removeListener(_0x35b57a,_0xf16e06){return function(){DashboardItemEvents['removeListener'](_0x35b57a,_0xf16e06);};}exports[_0xf6d1('0x4')]=function(_0x21b0c5){for(var _0x5ca902=0x0,_0x28ad4=events[_0xf6d1('0x5')];_0x5ca902<_0x28ad4;_0x5ca902++){var _0x3b8dee=events[_0x5ca902];var _0x4c0203=createListener(_0xf6d1('0x6')+_0x3b8dee,_0x21b0c5);DashboardItemEvents['on'](_0x3b8dee,_0x4c0203);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 3115fda..30d96ff 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 _0x3a0f=['get','/:id','isAuthenticated','show','post','create','put','update','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./dashboardItem.controller'];(function(_0x236ac8,_0xa798d6){var _0x1ff538=function(_0x35c99e){while(--_0x35c99e){_0x236ac8['push'](_0x236ac8['shift']());}};_0x1ff538(++_0xa798d6);}(_0x3a0f,0x1b1));var _0xf3a0=function(_0x254460,_0x718b12){_0x254460=_0x254460-0x0;var _0x1fd450=_0x3a0f[_0x254460];return _0x1fd450;};'use strict';var multer=require(_0xf3a0('0x0'));var util=require('util');var path=require(_0xf3a0('0x1'));var timeout=require(_0xf3a0('0x2'));var express=require(_0xf3a0('0x3'));var router=express[_0xf3a0('0x4')]();var fs_extra=require(_0xf3a0('0x5'));var auth=require(_0xf3a0('0x6'));var interaction=require(_0xf3a0('0x7'));var config=require('../../config/environment');var controller=require(_0xf3a0('0x8'));router[_0xf3a0('0x9')](_0xf3a0('0xa'),auth[_0xf3a0('0xb')](),controller[_0xf3a0('0xc')]);router[_0xf3a0('0xd')]('/',auth[_0xf3a0('0xb')](),controller[_0xf3a0('0xe')]);router[_0xf3a0('0xf')]('/:id',auth[_0xf3a0('0xb')](),controller[_0xf3a0('0x10')]);router['delete'](_0xf3a0('0xa'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x438d=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','post','create','put','update','destroy','exports','multer','util','path','express','Router'];(function(_0x4cee4b,_0x1dfff3){var _0x4d891d=function(_0x3722ba){while(--_0x3722ba){_0x4cee4b['push'](_0x4cee4b['shift']());}};_0x4d891d(++_0x1dfff3);}(_0x438d,0x1cf));var _0xd438=function(_0x1639be,_0x4ac980){_0x1639be=_0x1639be-0x0;var _0x4af3e1=_0x438d[_0x1639be];return _0x4af3e1;};'use strict';var multer=require(_0xd438('0x0'));var util=require(_0xd438('0x1'));var path=require(_0xd438('0x2'));var timeout=require('connect-timeout');var express=require(_0xd438('0x3'));var router=express[_0xd438('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd438('0x5'));var interaction=require(_0xd438('0x6'));var config=require(_0xd438('0x7'));var controller=require('./dashboardItem.controller');router[_0xd438('0x8')](_0xd438('0x9'),auth[_0xd438('0xa')](),controller[_0xd438('0xb')]);router[_0xd438('0xc')]('/',auth[_0xd438('0xa')](),controller[_0xd438('0xd')]);router[_0xd438('0xe')](_0xd438('0x9'),auth['isAuthenticated'](),controller[_0xd438('0xf')]);router['delete'](_0xd438('0x9'),auth[_0xd438('0xa')](),controller[_0xd438('0x10')]);module[_0xd438('0x11')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index df8763e..c91e7cb 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 _0xc8c7=['third','STRING','sequelize','exports','ENUM','first','second'];(function(_0x2d9e27,_0x5965b2){var _0xd35381=function(_0x343d18){while(--_0x343d18){_0x2d9e27['push'](_0x2d9e27['shift']());}};_0xd35381(++_0x5965b2);}(_0xc8c7,0x1c9));var _0x7c8c=function(_0x12b543,_0x23a88a){_0x12b543=_0x12b543-0x0;var _0x1fba93=_0xc8c7[_0x12b543];return _0x1fba93;};'use strict';var Sequelize=require(_0x7c8c('0x0'));module[_0x7c8c('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize[_0x7c8c('0x2')](_0x7c8c('0x3'),_0x7c8c('0x4'),_0x7c8c('0x5')),'allowNull':![],'defaultValue':_0x7c8c('0x3')},'description':{'type':Sequelize[_0x7c8c('0x6')]}}; \ No newline at end of file +var _0xc6dc=['third','exports','STRING','ENUM','first','second'];(function(_0x5c3fbb,_0x52ecd5){var _0x27ebe3=function(_0x234297){while(--_0x234297){_0x5c3fbb['push'](_0x5c3fbb['shift']());}};_0x27ebe3(++_0x52ecd5);}(_0xc6dc,0x85));var _0xcc6d=function(_0x596a61,_0x52d5e8){_0x596a61=_0x596a61-0x0;var _0x19e77b=_0xc6dc[_0x596a61];return _0x19e77b;};'use strict';var Sequelize=require('sequelize');module[_0xcc6d('0x0')]={'name':{'type':Sequelize[_0xcc6d('0x1')],'allowNull':![]},'level':{'type':Sequelize[_0xcc6d('0x2')](_0xcc6d('0x3'),_0xcc6d('0x4'),_0xcc6d('0x5')),'allowNull':![],'defaultValue':_0xcc6d('0x3')},'description':{'type':Sequelize[_0xcc6d('0x1')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 06b4f45..a42246d 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 _0x21f2=['moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','count','offset','set','Content-Range','apply','save','destroy','get','Dispositions','then','error','name','send','index','map','Disposition','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','includeAll','rows','params','keys','rawAttributes','include','options','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x4341c8,_0x478568){var _0x5c1eac=function(_0xdbf55d){while(--_0xdbf55d){_0x4341c8['push'](_0x4341c8['shift']());}};_0x5c1eac(++_0x478568);}(_0x21f2,0x158));var _0x221f=function(_0x4b5706,_0x343ea6){_0x4b5706=_0x4b5706-0x0;var _0x366873=_0x21f2[_0x4b5706];return _0x366873;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x221f('0x0'));var zipdir=require(_0x221f('0x1'));var jsonpatch=require(_0x221f('0x2'));var rp=require(_0x221f('0x3'));var moment=require(_0x221f('0x4'));var BPromise=require(_0x221f('0x5'));var Mustache=require(_0x221f('0x6'));var util=require(_0x221f('0x7'));var path=require(_0x221f('0x8'));var sox=require(_0x221f('0x9'));var csv=require(_0x221f('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x221f('0xb'));var _=require(_0x221f('0xc'));var squel=require(_0x221f('0xd'));var crypto=require(_0x221f('0xe'));var jsforce=require(_0x221f('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x221f('0xa'));var querystring=require(_0x221f('0x10'));var Papa=require(_0x221f('0x11'));var Redis=require(_0x221f('0x12'));var authService=require(_0x221f('0x13'));var qs=require(_0x221f('0x14'));var as=require(_0x221f('0x15'));var hardwareService=require(_0x221f('0x16'));var logger=require(_0x221f('0x17'))(_0x221f('0x18'));var utils=require(_0x221f('0x19'));var config=require(_0x221f('0x1a'));var licenseUtil=require(_0x221f('0x1b'));var db=require(_0x221f('0x1c'))['db'];function respondWithStatusCode(_0x2b1532,_0x1cbaef){_0x1cbaef=_0x1cbaef||0xcc;return function(_0x2e861b){if(_0x2e861b){return _0x2b1532[_0x221f('0x1d')](_0x1cbaef);}return _0x2b1532[_0x221f('0x1e')](_0x1cbaef)[_0x221f('0x1f')]();};}function respondWithResult(_0x301eba,_0x952913){_0x952913=_0x952913||0xc8;return function(_0x175ca3){if(_0x175ca3){return _0x301eba[_0x221f('0x1e')](_0x952913)[_0x221f('0x20')](_0x175ca3);}};}function respondWithFilteredResult(_0x4aa8d5,_0xc21672){return function(_0x26a7c2){if(_0x26a7c2){var _0x930b02=typeof _0xc21672['offset']==='undefined'&&typeof _0xc21672[_0x221f('0x21')]==='undefined';var _0x136f52=_0x26a7c2[_0x221f('0x22')];var _0x5eb7ea=_0x930b02?0x0:_0xc21672[_0x221f('0x23')];var _0x4e9b55=_0x930b02?_0x26a7c2[_0x221f('0x22')]:_0xc21672['offset']+_0xc21672[_0x221f('0x21')];var _0x2d0d09;if(_0x4e9b55>=_0x136f52){_0x4e9b55=_0x136f52;_0x2d0d09=0xc8;}else{_0x2d0d09=0xce;}_0x4aa8d5['status'](_0x2d0d09);return _0x4aa8d5[_0x221f('0x24')](_0x221f('0x25'),_0x5eb7ea+'-'+_0x4e9b55+'/'+_0x136f52)['json'](_0x26a7c2);}return null;};}function patchUpdates(_0x4e9ef1){return function(_0x250b6f){try{jsonpatch[_0x221f('0x26')](_0x250b6f,_0x4e9ef1,!![]);}catch(_0x27db98){return BPromise['reject'](_0x27db98);}return _0x250b6f[_0x221f('0x27')]();};}function saveUpdates(_0x12e841,_0x288849){return function(_0x52d9f7){if(_0x52d9f7){return _0x52d9f7['update'](_0x12e841)['then'](function(_0x2d51a6){return _0x2d51a6;});}return null;};}function removeEntity(_0x559747,_0x4b29eb){return function(_0x288cca){if(_0x288cca){return _0x288cca[_0x221f('0x28')]()['then'](function(){var _0x17512a=_0x288cca[_0x221f('0x29')]({'plain':!![]});var _0x37e035=_0x221f('0x2a');return db['UserProfileResource'][_0x221f('0x28')]({'where':{'type':_0x37e035,'resourceId':_0x17512a['id']}})[_0x221f('0x2b')](function(){return _0x288cca;});})[_0x221f('0x2b')](function(){_0x559747[_0x221f('0x1e')](0xcc)[_0x221f('0x1f')]();});}};}function handleEntityNotFound(_0x40abd7,_0x246f31){return function(_0x26eb71){if(!_0x26eb71){_0x40abd7[_0x221f('0x1d')](0x194);}return _0x26eb71;};}function handleError(_0x52423e,_0x13f07a){_0x13f07a=_0x13f07a||0x1f4;return function(_0xdf5b32){logger[_0x221f('0x2c')](_0xdf5b32['stack']);if(_0xdf5b32[_0x221f('0x2d')]){delete _0xdf5b32[_0x221f('0x2d')];}_0x52423e[_0x221f('0x1e')](_0x13f07a)[_0x221f('0x2e')](_0xdf5b32);};}exports[_0x221f('0x2f')]=function(_0x29e0ba,_0x4c69bc){var _0x391dce={},_0x17023e={},_0x1a33bd={'count':0x0,'rows':[]};var _0x5865f0=_[_0x221f('0x30')](db[_0x221f('0x31')]['rawAttributes'],function(_0x58e974){return{'name':_0x58e974[_0x221f('0x32')],'type':_0x58e974['type'][_0x221f('0x33')]};});_0x17023e[_0x221f('0x34')]=_[_0x221f('0x30')](_0x5865f0,_0x221f('0x2d'));_0x17023e[_0x221f('0x35')]=_['keys'](_0x29e0ba[_0x221f('0x35')]);_0x17023e[_0x221f('0x36')]=_[_0x221f('0x37')](_0x17023e[_0x221f('0x34')],_0x17023e[_0x221f('0x35')]);_0x391dce[_0x221f('0x38')]=_[_0x221f('0x37')](_0x17023e[_0x221f('0x34')],qs[_0x221f('0x39')](_0x29e0ba[_0x221f('0x35')][_0x221f('0x39')]));_0x391dce[_0x221f('0x38')]=_0x391dce['attributes'][_0x221f('0x3a')]?_0x391dce['attributes']:_0x17023e['model'];if(!_0x29e0ba[_0x221f('0x35')][_0x221f('0x3b')](_0x221f('0x3c'))){_0x391dce['limit']=qs[_0x221f('0x21')](_0x29e0ba[_0x221f('0x35')][_0x221f('0x21')]);_0x391dce['offset']=qs['offset'](_0x29e0ba['query'][_0x221f('0x23')]);}_0x391dce[_0x221f('0x3d')]=qs[_0x221f('0x3e')](_0x29e0ba[_0x221f('0x35')]['sort']);_0x391dce[_0x221f('0x3f')]=qs[_0x221f('0x36')](_[_0x221f('0x40')](_0x29e0ba['query'],_0x17023e['filters']),_0x5865f0);if(_0x29e0ba['query']['filter']){_0x391dce[_0x221f('0x3f')]=_[_0x221f('0x41')](_0x391dce['where'],{'$or':_['map'](_0x5865f0,function(_0x3fdfa8){if(_0x3fdfa8[_0x221f('0x42')]!==_0x221f('0x43')){var _0x4d0089={};_0x4d0089[_0x3fdfa8['name']]={'$like':'%'+_0x29e0ba[_0x221f('0x35')][_0x221f('0x44')]+'%'};return _0x4d0089;}})});}_0x391dce=_[_0x221f('0x41')]({},_0x391dce,_0x29e0ba['options']);var _0x4a63cc={'where':_0x391dce[_0x221f('0x3f')]};return db[_0x221f('0x31')]['count'](_0x4a63cc)[_0x221f('0x2b')](function(_0x20fa3d){_0x1a33bd[_0x221f('0x22')]=_0x20fa3d;if(_0x29e0ba[_0x221f('0x35')][_0x221f('0x45')]){_0x391dce['include']=[{'all':!![]}];}return db[_0x221f('0x31')]['findAll'](_0x391dce);})[_0x221f('0x2b')](function(_0xea0e08){_0x1a33bd[_0x221f('0x46')]=_0xea0e08;return _0x1a33bd;})[_0x221f('0x2b')](respondWithFilteredResult(_0x4c69bc,_0x391dce))['catch'](handleError(_0x4c69bc,null));};exports['show']=function(_0x51cee3,_0x4200b3){var _0x4847f9={'raw':!![],'where':{'id':_0x51cee3[_0x221f('0x47')]['id']}},_0x2f6d6e={};_0x2f6d6e[_0x221f('0x34')]=_[_0x221f('0x48')](db['Disposition'][_0x221f('0x49')]);_0x2f6d6e[_0x221f('0x35')]=_[_0x221f('0x48')](_0x51cee3[_0x221f('0x35')]);_0x2f6d6e[_0x221f('0x36')]=_[_0x221f('0x37')](_0x2f6d6e[_0x221f('0x34')],_0x2f6d6e[_0x221f('0x35')]);_0x4847f9[_0x221f('0x38')]=_[_0x221f('0x37')](_0x2f6d6e['model'],qs[_0x221f('0x39')](_0x51cee3['query']['fields']));_0x4847f9[_0x221f('0x38')]=_0x4847f9[_0x221f('0x38')][_0x221f('0x3a')]?_0x4847f9[_0x221f('0x38')]:_0x2f6d6e['model'];if(_0x51cee3['query']['includeAll']){_0x4847f9[_0x221f('0x4a')]=[{'all':!![]}];}_0x4847f9=_['merge']({},_0x4847f9,_0x51cee3[_0x221f('0x4b')]);return db[_0x221f('0x31')][_0x221f('0x4c')](_0x4847f9)[_0x221f('0x2b')](handleEntityNotFound(_0x4200b3,null))[_0x221f('0x2b')](respondWithResult(_0x4200b3,null))['catch'](handleError(_0x4200b3,null));};exports[_0x221f('0x4d')]=function(_0x2e2aa2,_0x3c4b14){return db[_0x221f('0x31')][_0x221f('0x4d')](_0x2e2aa2[_0x221f('0x4e')],{})['then'](function(_0x144682){var _0x4666e0=_0x2e2aa2[_0x221f('0x4f')][_0x221f('0x29')]({'plain':!![]});if(!_0x4666e0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4666e0[_0x221f('0x50')]==='user'){var _0xa90d27=_0x144682[_0x221f('0x29')]({'plain':!![]});var _0x920651=_0x221f('0x2a');return db[_0x221f('0x51')][_0x221f('0x4c')]({'where':{'name':_0x920651,'userProfileId':_0x4666e0[_0x221f('0x52')]},'raw':!![]})[_0x221f('0x2b')](function(_0x3b2ea7){if(_0x3b2ea7&&_0x3b2ea7[_0x221f('0x53')]===0x0){return db[_0x221f('0x54')][_0x221f('0x4d')]({'name':_0xa90d27[_0x221f('0x2d')],'resourceId':_0xa90d27['id'],'type':_0x3b2ea7[_0x221f('0x2d')],'sectionId':_0x3b2ea7['id']},{})[_0x221f('0x2b')](function(){return _0x144682;});}else{return _0x144682;}})['catch'](function(_0x16f4a4){logger[_0x221f('0x2c')](_0x221f('0x55'),_0x16f4a4);throw _0x16f4a4;});}return _0x144682;})['then'](respondWithResult(_0x3c4b14,0xc9))['catch'](handleError(_0x3c4b14,null));};exports['update']=function(_0x548819,_0x59fc64){if(_0x548819[_0x221f('0x4e')]['id']){delete _0x548819[_0x221f('0x4e')]['id'];}return db[_0x221f('0x31')][_0x221f('0x4c')]({'where':{'id':_0x548819['params']['id']}})[_0x221f('0x2b')](handleEntityNotFound(_0x59fc64,null))[_0x221f('0x2b')](saveUpdates(_0x548819[_0x221f('0x4e')],null))['then'](respondWithResult(_0x59fc64,null))[_0x221f('0x56')](handleError(_0x59fc64,null));};exports[_0x221f('0x28')]=function(_0x3635a2,_0x4d34e8){return db['Disposition'][_0x221f('0x4c')]({'where':{'id':_0x3635a2[_0x221f('0x47')]['id']}})[_0x221f('0x2b')](handleEntityNotFound(_0x4d34e8,null))[_0x221f('0x2b')](removeEntity(_0x4d34e8,null))[_0x221f('0x56')](handleError(_0x4d34e8,null));}; \ No newline at end of file +var _0xec96=['name','index','map','Disposition','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','filter','where','merge','includeAll','include','findAll','rows','catch','keys','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','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','apply','reject','save','update','then','get','UserProfileResource','destroy','sendStatus'];(function(_0x300b26,_0x3a9b67){var _0x5cb1ae=function(_0x2b8e7f){while(--_0x2b8e7f){_0x300b26['push'](_0x300b26['shift']());}};_0x5cb1ae(++_0x3a9b67);}(_0xec96,0x119));var _0x6ec9=function(_0x2a87ac,_0xde9e67){_0x2a87ac=_0x2a87ac-0x0;var _0x5d11da=_0xec96[_0x2a87ac];return _0x5d11da;};'use strict';var emlformat=require(_0x6ec9('0x0'));var rimraf=require(_0x6ec9('0x1'));var zipdir=require(_0x6ec9('0x2'));var jsonpatch=require(_0x6ec9('0x3'));var rp=require(_0x6ec9('0x4'));var moment=require(_0x6ec9('0x5'));var BPromise=require(_0x6ec9('0x6'));var Mustache=require(_0x6ec9('0x7'));var util=require('util');var path=require(_0x6ec9('0x8'));var sox=require(_0x6ec9('0x9'));var csv=require('to-csv');var ejs=require(_0x6ec9('0xa'));var fs=require('fs');var fs_extra=require(_0x6ec9('0xb'));var _=require(_0x6ec9('0xc'));var squel=require(_0x6ec9('0xd'));var crypto=require('crypto');var jsforce=require(_0x6ec9('0xe'));var deskjs=require(_0x6ec9('0xf'));var toCsv=require(_0x6ec9('0x10'));var querystring=require(_0x6ec9('0x11'));var Papa=require(_0x6ec9('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6ec9('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6ec9('0x14'));var logger=require(_0x6ec9('0x15'))('api');var utils=require(_0x6ec9('0x16'));var config=require(_0x6ec9('0x17'));var licenseUtil=require(_0x6ec9('0x18'));var db=require(_0x6ec9('0x19'))['db'];function respondWithStatusCode(_0x58f315,_0x435b50){_0x435b50=_0x435b50||0xcc;return function(_0x10663c){if(_0x10663c){return _0x58f315['sendStatus'](_0x435b50);}return _0x58f315[_0x6ec9('0x1a')](_0x435b50)[_0x6ec9('0x1b')]();};}function respondWithResult(_0x1acef4,_0x4ce59e){_0x4ce59e=_0x4ce59e||0xc8;return function(_0x413e3a){if(_0x413e3a){return _0x1acef4[_0x6ec9('0x1a')](_0x4ce59e)[_0x6ec9('0x1c')](_0x413e3a);}};}function respondWithFilteredResult(_0x282cd1,_0x29120c){return function(_0xa126fc){if(_0xa126fc){var _0x2f4222=typeof _0x29120c['offset']===_0x6ec9('0x1d')&&typeof _0x29120c[_0x6ec9('0x1e')]==='undefined';var _0x695593=_0xa126fc[_0x6ec9('0x1f')];var _0x8f5fed=_0x2f4222?0x0:_0x29120c[_0x6ec9('0x20')];var _0xc32d28=_0x2f4222?_0xa126fc[_0x6ec9('0x1f')]:_0x29120c[_0x6ec9('0x20')]+_0x29120c['limit'];var _0x56701d;if(_0xc32d28>=_0x695593){_0xc32d28=_0x695593;_0x56701d=0xc8;}else{_0x56701d=0xce;}_0x282cd1[_0x6ec9('0x1a')](_0x56701d);return _0x282cd1[_0x6ec9('0x21')]('Content-Range',_0x8f5fed+'-'+_0xc32d28+'/'+_0x695593)[_0x6ec9('0x1c')](_0xa126fc);}return null;};}function patchUpdates(_0x50c739){return function(_0x4513eb){try{jsonpatch[_0x6ec9('0x22')](_0x4513eb,_0x50c739,!![]);}catch(_0x275dfa){return BPromise[_0x6ec9('0x23')](_0x275dfa);}return _0x4513eb[_0x6ec9('0x24')]();};}function saveUpdates(_0x360f50,_0x473a5c){return function(_0x3b4b9c){if(_0x3b4b9c){return _0x3b4b9c[_0x6ec9('0x25')](_0x360f50)[_0x6ec9('0x26')](function(_0x37faf7){return _0x37faf7;});}return null;};}function removeEntity(_0x4ffd64,_0x3b005b){return function(_0x39aeee){if(_0x39aeee){return _0x39aeee['destroy']()['then'](function(){var _0x5e30a2=_0x39aeee[_0x6ec9('0x27')]({'plain':!![]});var _0x3aa140='Dispositions';return db[_0x6ec9('0x28')][_0x6ec9('0x29')]({'where':{'type':_0x3aa140,'resourceId':_0x5e30a2['id']}})['then'](function(){return _0x39aeee;});})['then'](function(){_0x4ffd64['status'](0xcc)[_0x6ec9('0x1b')]();});}};}function handleEntityNotFound(_0x4269a4,_0x39df97){return function(_0x21bc66){if(!_0x21bc66){_0x4269a4[_0x6ec9('0x2a')](0x194);}return _0x21bc66;};}function handleError(_0x26bc43,_0x50989a){_0x50989a=_0x50989a||0x1f4;return function(_0x54d524){logger['error'](_0x54d524['stack']);if(_0x54d524['name']){delete _0x54d524[_0x6ec9('0x2b')];}_0x26bc43[_0x6ec9('0x1a')](_0x50989a)['send'](_0x54d524);};}exports[_0x6ec9('0x2c')]=function(_0x38f7c8,_0x168db8){var _0x527a6f={},_0x151d4c={},_0x5687a5={'count':0x0,'rows':[]};var _0x369b40=_[_0x6ec9('0x2d')](db[_0x6ec9('0x2e')][_0x6ec9('0x2f')],function(_0x420852){return{'name':_0x420852[_0x6ec9('0x30')],'type':_0x420852[_0x6ec9('0x31')][_0x6ec9('0x32')]};});_0x151d4c['model']=_[_0x6ec9('0x2d')](_0x369b40,'name');_0x151d4c[_0x6ec9('0x33')]=_['keys'](_0x38f7c8[_0x6ec9('0x33')]);_0x151d4c[_0x6ec9('0x34')]=_[_0x6ec9('0x35')](_0x151d4c[_0x6ec9('0x36')],_0x151d4c['query']);_0x527a6f[_0x6ec9('0x37')]=_['intersection'](_0x151d4c[_0x6ec9('0x36')],qs[_0x6ec9('0x38')](_0x38f7c8['query'][_0x6ec9('0x38')]));_0x527a6f[_0x6ec9('0x37')]=_0x527a6f[_0x6ec9('0x37')][_0x6ec9('0x39')]?_0x527a6f[_0x6ec9('0x37')]:_0x151d4c[_0x6ec9('0x36')];if(!_0x38f7c8[_0x6ec9('0x33')][_0x6ec9('0x3a')]('nolimit')){_0x527a6f[_0x6ec9('0x1e')]=qs[_0x6ec9('0x1e')](_0x38f7c8[_0x6ec9('0x33')][_0x6ec9('0x1e')]);_0x527a6f['offset']=qs[_0x6ec9('0x20')](_0x38f7c8[_0x6ec9('0x33')][_0x6ec9('0x20')]);}_0x527a6f[_0x6ec9('0x3b')]=qs[_0x6ec9('0x3c')](_0x38f7c8[_0x6ec9('0x33')]['sort']);_0x527a6f['where']=qs[_0x6ec9('0x34')](_['pick'](_0x38f7c8[_0x6ec9('0x33')],_0x151d4c[_0x6ec9('0x34')]),_0x369b40);if(_0x38f7c8[_0x6ec9('0x33')][_0x6ec9('0x3d')]){_0x527a6f[_0x6ec9('0x3e')]=_[_0x6ec9('0x3f')](_0x527a6f[_0x6ec9('0x3e')],{'$or':_['map'](_0x369b40,function(_0x317ee4){if(_0x317ee4[_0x6ec9('0x31')]!=='VIRTUAL'){var _0x20fdb1={};_0x20fdb1[_0x317ee4[_0x6ec9('0x2b')]]={'$like':'%'+_0x38f7c8[_0x6ec9('0x33')][_0x6ec9('0x3d')]+'%'};return _0x20fdb1;}})});}_0x527a6f=_[_0x6ec9('0x3f')]({},_0x527a6f,_0x38f7c8['options']);var _0x330c0a={'where':_0x527a6f[_0x6ec9('0x3e')]};return db[_0x6ec9('0x2e')][_0x6ec9('0x1f')](_0x330c0a)['then'](function(_0x1a2ae8){_0x5687a5[_0x6ec9('0x1f')]=_0x1a2ae8;if(_0x38f7c8[_0x6ec9('0x33')][_0x6ec9('0x40')]){_0x527a6f[_0x6ec9('0x41')]=[{'all':!![]}];}return db['Disposition'][_0x6ec9('0x42')](_0x527a6f);})[_0x6ec9('0x26')](function(_0x2839be){_0x5687a5[_0x6ec9('0x43')]=_0x2839be;return _0x5687a5;})[_0x6ec9('0x26')](respondWithFilteredResult(_0x168db8,_0x527a6f))[_0x6ec9('0x44')](handleError(_0x168db8,null));};exports['show']=function(_0x5c5761,_0x1572d3){var _0x3585ab={'raw':!![],'where':{'id':_0x5c5761['params']['id']}},_0x59cd9e={};_0x59cd9e[_0x6ec9('0x36')]=_[_0x6ec9('0x45')](db['Disposition']['rawAttributes']);_0x59cd9e[_0x6ec9('0x33')]=_[_0x6ec9('0x45')](_0x5c5761['query']);_0x59cd9e[_0x6ec9('0x34')]=_['intersection'](_0x59cd9e[_0x6ec9('0x36')],_0x59cd9e[_0x6ec9('0x33')]);_0x3585ab[_0x6ec9('0x37')]=_[_0x6ec9('0x35')](_0x59cd9e['model'],qs['fields'](_0x5c5761[_0x6ec9('0x33')][_0x6ec9('0x38')]));_0x3585ab[_0x6ec9('0x37')]=_0x3585ab['attributes'][_0x6ec9('0x39')]?_0x3585ab[_0x6ec9('0x37')]:_0x59cd9e['model'];if(_0x5c5761[_0x6ec9('0x33')][_0x6ec9('0x40')]){_0x3585ab[_0x6ec9('0x41')]=[{'all':!![]}];}_0x3585ab=_['merge']({},_0x3585ab,_0x5c5761['options']);return db[_0x6ec9('0x2e')][_0x6ec9('0x46')](_0x3585ab)[_0x6ec9('0x26')](handleEntityNotFound(_0x1572d3,null))[_0x6ec9('0x26')](respondWithResult(_0x1572d3,null))[_0x6ec9('0x44')](handleError(_0x1572d3,null));};exports[_0x6ec9('0x47')]=function(_0x418f6d,_0x5c876c){return db[_0x6ec9('0x2e')][_0x6ec9('0x47')](_0x418f6d['body'],{})[_0x6ec9('0x26')](function(_0x1a115c){var _0x383426=_0x418f6d[_0x6ec9('0x48')][_0x6ec9('0x27')]({'plain':!![]});if(!_0x383426)throw new Error(_0x6ec9('0x49'));if(_0x383426[_0x6ec9('0x4a')]===_0x6ec9('0x48')){var _0x3f9eb6=_0x1a115c[_0x6ec9('0x27')]({'plain':!![]});var _0x4c052b='Dispositions';return db[_0x6ec9('0x4b')][_0x6ec9('0x46')]({'where':{'name':_0x4c052b,'userProfileId':_0x383426[_0x6ec9('0x4c')]},'raw':!![]})[_0x6ec9('0x26')](function(_0xd55541){if(_0xd55541&&_0xd55541['autoAssociation']===0x0){return db[_0x6ec9('0x28')][_0x6ec9('0x47')]({'name':_0x3f9eb6['name'],'resourceId':_0x3f9eb6['id'],'type':_0xd55541[_0x6ec9('0x2b')],'sectionId':_0xd55541['id']},{})['then'](function(){return _0x1a115c;});}else{return _0x1a115c;}})['catch'](function(_0x5d197d){logger[_0x6ec9('0x4d')](_0x6ec9('0x4e'),_0x5d197d);throw _0x5d197d;});}return _0x1a115c;})['then'](respondWithResult(_0x5c876c,0xc9))['catch'](handleError(_0x5c876c,null));};exports[_0x6ec9('0x25')]=function(_0x44f17b,_0x1b190b){if(_0x44f17b[_0x6ec9('0x4f')]['id']){delete _0x44f17b[_0x6ec9('0x4f')]['id'];}return db[_0x6ec9('0x2e')]['find']({'where':{'id':_0x44f17b[_0x6ec9('0x50')]['id']}})[_0x6ec9('0x26')](handleEntityNotFound(_0x1b190b,null))[_0x6ec9('0x26')](saveUpdates(_0x44f17b['body'],null))[_0x6ec9('0x26')](respondWithResult(_0x1b190b,null))[_0x6ec9('0x44')](handleError(_0x1b190b,null));};exports[_0x6ec9('0x29')]=function(_0x4d76d3,_0x2cc24e){return db[_0x6ec9('0x2e')][_0x6ec9('0x46')]({'where':{'id':_0x4d76d3['params']['id']}})[_0x6ec9('0x26')](handleEntityNotFound(_0x2cc24e,null))[_0x6ec9('0x26')](removeEntity(_0x2cc24e,null))[_0x6ec9('0x44')](handleError(_0x2cc24e,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index f4a540b..0520485 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 _0x5ef9=['../../config/environment','./disposition.attributes','exports','Disposition','name_voice','name','ListId','name_chat','ChatWebsiteId','MailAccountId','name_sms','SmsAccountId','name_fax','FaxAccountId','name_openchannel','name_whatsapp','WhatsappAccountId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x1e003b,_0x3e4ded){var _0x268789=function(_0x559062){while(--_0x559062){_0x1e003b['push'](_0x1e003b['shift']());}};_0x268789(++_0x3e4ded);}(_0x5ef9,0x16f));var _0x95ef=function(_0x4ed4d2,_0x47acf7){_0x4ed4d2=_0x4ed4d2-0x0;var _0x15ae2e=_0x5ef9[_0x4ed4d2];return _0x15ae2e;};'use strict';var _=require(_0x95ef('0x0'));var util=require(_0x95ef('0x1'));var logger=require(_0x95ef('0x2'))(_0x95ef('0x3'));var moment=require(_0x95ef('0x4'));var BPromise=require(_0x95ef('0x5'));var rp=require(_0x95ef('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x95ef('0x7'));var config=require(_0x95ef('0x8'));var attributes=require(_0x95ef('0x9'));module[_0x95ef('0xa')]=function(_0x15267c,_0x214129){return _0x15267c['define'](_0x95ef('0xb'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0x95ef('0xc'),'fields':[_0x95ef('0xd'),_0x95ef('0xe')]},{'unique':!![],'name':_0x95ef('0xf'),'fields':[_0x95ef('0xd'),_0x95ef('0x10')]},{'unique':!![],'name':'name_mail','fields':['name',_0x95ef('0x11')]},{'unique':!![],'name':_0x95ef('0x12'),'fields':[_0x95ef('0xd'),_0x95ef('0x13')]},{'unique':!![],'name':_0x95ef('0x14'),'fields':[_0x95ef('0xd'),_0x95ef('0x15')]},{'unique':!![],'name':_0x95ef('0x16'),'fields':[_0x95ef('0xd'),'OpenchannelAccountId']},{'unique':!![],'name':_0x95ef('0x17'),'fields':['name',_0x95ef('0x18')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x321f=['name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./disposition.attributes','exports','define','Disposition','name_voice','name','ListId','name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','FaxAccountId'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0x321f,0x1d8));var _0xf321=function(_0x45977c,_0x7eaed0){_0x45977c=_0x45977c-0x0;var _0x399413=_0x321f[_0x45977c];return _0x399413;};'use strict';var _=require(_0xf321('0x0'));var util=require('util');var logger=require(_0xf321('0x1'))(_0xf321('0x2'));var moment=require('moment');var BPromise=require(_0xf321('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf321('0x4'));var rimraf=require(_0xf321('0x5'));var config=require(_0xf321('0x6'));var attributes=require(_0xf321('0x7'));module[_0xf321('0x8')]=function(_0x27ee3f,_0x3343f4){return _0x27ee3f[_0xf321('0x9')](_0xf321('0xa'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0xf321('0xb'),'fields':[_0xf321('0xc'),_0xf321('0xd')]},{'unique':!![],'name':_0xf321('0xe'),'fields':[_0xf321('0xc'),_0xf321('0xf')]},{'unique':!![],'name':_0xf321('0x10'),'fields':[_0xf321('0xc'),_0xf321('0x11')]},{'unique':!![],'name':_0xf321('0x12'),'fields':['name',_0xf321('0x13')]},{'unique':!![],'name':_0xf321('0x14'),'fields':[_0xf321('0xc'),_0xf321('0x15')]},{'unique':!![],'name':_0xf321('0x16'),'fields':['name',_0xf321('0x17')]},{'unique':!![],'name':_0xf321('0x18'),'fields':[_0xf321('0xc'),_0xf321('0x19')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 1b6bf50..4a7b08f 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(_0x5e22bc,_0x707495){var _0x3b3049=function(_0x1d71af){while(--_0x1d71af){_0x5e22bc['push'](_0x5e22bc['shift']());}};_0x3b3049(++_0x707495);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'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(_0x275386,_0x175c60){var _0x278c3e=function(_0x405fa9){while(--_0x405fa9){_0x275386['push'](_0x275386['shift']());}};_0x278c3e(++_0x175c60);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 18e4ab9..8e27203 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 _0x9913=['Router','fs-extra','../../components/auth/service','../../config/environment','./disposition.controller','get','isAuthenticated','/:id','post','put','update','delete','destroy','path','express'];(function(_0x288f5e,_0x205edd){var _0x476cc9=function(_0x796f53){while(--_0x796f53){_0x288f5e['push'](_0x288f5e['shift']());}};_0x476cc9(++_0x205edd);}(_0x9913,0x193));var _0x3991=function(_0x4b174a,_0x33a017){_0x4b174a=_0x4b174a-0x0;var _0x3cd7bf=_0x9913[_0x4b174a];return _0x3cd7bf;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3991('0x0'));var timeout=require('connect-timeout');var express=require(_0x3991('0x1'));var router=express[_0x3991('0x2')]();var fs_extra=require(_0x3991('0x3'));var auth=require(_0x3991('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3991('0x5'));var controller=require(_0x3991('0x6'));router[_0x3991('0x7')]('/',auth[_0x3991('0x8')](),controller['index']);router[_0x3991('0x7')](_0x3991('0x9'),auth[_0x3991('0x8')](),controller['show']);router[_0x3991('0xa')]('/',auth[_0x3991('0x8')](),controller['create']);router[_0x3991('0xb')](_0x3991('0x9'),auth[_0x3991('0x8')](),controller[_0x3991('0xc')]);router[_0x3991('0xd')](_0x3991('0x9'),auth[_0x3991('0x8')](),controller[_0x3991('0xe')]);module['exports']=router; \ No newline at end of file +var _0x8854=['Router','../../components/auth/service','../../config/environment','./disposition.controller','get','index','/:id','create','put','isAuthenticated','destroy','multer','path','connect-timeout'];(function(_0xfcba04,_0xd515e){var _0x1b8c32=function(_0x5602d1){while(--_0x5602d1){_0xfcba04['push'](_0xfcba04['shift']());}};_0x1b8c32(++_0xd515e);}(_0x8854,0x13f));var _0x4885=function(_0x496599,_0x24815c){_0x496599=_0x496599-0x0;var _0x45d0ab=_0x8854[_0x496599];return _0x45d0ab;};'use strict';var multer=require(_0x4885('0x0'));var util=require('util');var path=require(_0x4885('0x1'));var timeout=require(_0x4885('0x2'));var express=require('express');var router=express[_0x4885('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x4885('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x4885('0x5'));var controller=require(_0x4885('0x6'));router[_0x4885('0x7')]('/',auth['isAuthenticated'](),controller[_0x4885('0x8')]);router[_0x4885('0x7')](_0x4885('0x9'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x4885('0xa')]);router[_0x4885('0xb')](_0x4885('0x9'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x4885('0x9'),auth[_0x4885('0xc')](),controller[_0x4885('0xd')]);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 7aae292..31081c5 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 _0x3aa5=['7200','12000','14400','v17,v27,v29','INTEGER','SIP','IAX','KHOMP','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','STRING','yes','xCALLY\x20Motion\x20Fax','localstationid','ENUM','4800','9600','2400'];(function(_0x2ab895,_0x477fd6){var _0x223fcc=function(_0x308a59){while(--_0x308a59){_0x2ab895['push'](_0x2ab895['shift']());}};_0x223fcc(++_0x477fd6);}(_0x3aa5,0xa7));var _0x53aa=function(_0x408862,_0xa7be17){_0x408862=_0x408862-0x0;var _0x17bbef=_0x3aa5[_0x408862];return _0x17bbef;};'use strict';var Sequelize=require(_0x53aa('0x0'));module['exports']={'name':{'type':Sequelize[_0x53aa('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x53aa('0x1')]},'ecm':{'type':Sequelize['ENUM'](_0x53aa('0x2'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0x53aa('0x1')],'defaultValue':_0x53aa('0x3')},'localstationid':{'type':Sequelize['STRING'],'unique':_0x53aa('0x4')},'minrate':{'type':Sequelize[_0x53aa('0x5')]('2400',_0x53aa('0x6'),'7200',_0x53aa('0x7'),'12000','14400'),'defaultValue':_0x53aa('0x6')},'maxrate':{'type':Sequelize[_0x53aa('0x5')](_0x53aa('0x8'),_0x53aa('0x6'),_0x53aa('0x9'),_0x53aa('0x7'),_0x53aa('0xa'),_0x53aa('0xb')),'defaultValue':'14400'},'modem':{'type':Sequelize['STRING'],'defaultValue':_0x53aa('0xc')},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x53aa('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x53aa('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x53aa('0x5')](_0x53aa('0xe'),_0x53aa('0xf'),'DADHI',_0x53aa('0x10')),'defaultValue':_0x53aa('0xe')},'key':{'type':Sequelize[_0x53aa('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x53aa('0x11');}},'notificationSound':{'type':Sequelize[_0x53aa('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x53aa('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x53aa('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x53aa('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x53aa('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x53aa('0xd')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x53aa('0x12')],'defaultValue':![],'comment':_0x53aa('0x13'),'set':function(_0x4c5c93){if(!_0x4c5c93)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x53aa('0x14')](_0x53aa('0x15'),_0x4c5c93);}}}; \ No newline at end of file +var _0xd2b3=['exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','7200','12000','9600','14400','v17,v27,v29','INTEGER','SIP','IAX','DADHI','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize'];(function(_0x9aada2,_0xd2d349){var _0x196dff=function(_0x5ad061){while(--_0x5ad061){_0x9aada2['push'](_0x9aada2['shift']());}};_0x196dff(++_0xd2d349);}(_0xd2b3,0x67));var _0x3d2b=function(_0x15c068,_0x441624){_0x15c068=_0x15c068-0x0;var _0x369daf=_0xd2b3[_0x15c068];return _0x369daf;};'use strict';var Sequelize=require(_0x3d2b('0x0'));module[_0x3d2b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x3d2b('0x2')]},'ecm':{'type':Sequelize[_0x3d2b('0x3')]('yes','no'),'defaultValue':_0x3d2b('0x4')},'headerinfo':{'type':Sequelize[_0x3d2b('0x2')],'defaultValue':_0x3d2b('0x5')},'localstationid':{'type':Sequelize['STRING'],'unique':_0x3d2b('0x6')},'minrate':{'type':Sequelize['ENUM'](_0x3d2b('0x7'),_0x3d2b('0x8'),_0x3d2b('0x9'),'9600',_0x3d2b('0xa'),'14400'),'defaultValue':'4800'},'maxrate':{'type':Sequelize[_0x3d2b('0x3')](_0x3d2b('0x7'),_0x3d2b('0x8'),_0x3d2b('0x9'),_0x3d2b('0xb'),'12000','14400'),'defaultValue':_0x3d2b('0xc')},'modem':{'type':Sequelize['STRING'],'defaultValue':_0x3d2b('0xd')},'gateway':{'type':Sequelize[_0x3d2b('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x3d2b('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x3d2b('0xe')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x3d2b('0x3')](_0x3d2b('0xf'),_0x3d2b('0x10'),_0x3d2b('0x11'),_0x3d2b('0x12')),'defaultValue':_0x3d2b('0xf')},'key':{'type':Sequelize[_0x3d2b('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x3d2b('0x13')],'defaultValue':function(){return _0x3d2b('0x14');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x3d2b('0x15')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x3d2b('0x15')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x3d2b('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x3d2b('0x16')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x52864b){if(!_0x52864b)this['setDataValue'](_0x3d2b('0x17'),null);this[_0x3d2b('0x18')](_0x3d2b('0x19'),_0x52864b);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 9420eaa..5b8e5f6 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 _0x22c1=['rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','./faxAccount.socket','register','client','http','request','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','end','json','offset','undefined','count','limit','status','Content-Range','apply','update','then','destroy','get','UserProfileResource','stack','name','send','index','mandatoryDispositionPause','map','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','FaxAccount','findAll','params','rawAttributes','include','options','find','create','body','user','role','FaxAccounts','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Pause','describe','FaxAccountId','Disposition','getDispositions','findOne','nolimit','removeDispositions','ids','CannedAnswer','getAnswers','includeAll','removeAnswers','addInteraction','FaxInteraction','omit','CmContact','User','Owner','fullname','internal','Tag','Tags','tag','rows','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','priority','finally','getApplications','context','from-voip-provider','localstationid','system','description','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','gateway','faxdetect','headerinfo','maxrate','modem','t38timeout','Set','/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','updateAccountApplications','VoiceExtension','key','createdAt','updatedAt','TrunkId','ListId','findById','getMessages','FaxMessage','split','YYYY-MM-DD\x20HH:mm:ss','List','Contacts','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','format','\x22%s\x22\x20<%s>','fax','defaults','out','filename','Contact\x20not\x20found','spread','ContactId','dataValues','Messages','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove'];(function(_0x57f7ea,_0x54da6b){var _0x54a7e4=function(_0x2c9d4f){while(--_0x2c9d4f){_0x57f7ea['push'](_0x57f7ea['shift']());}};_0x54a7e4(++_0x54da6b);}(_0x22c1,0x17c));var _0x122c=function(_0x4a29a9,_0x58cd04){_0x4a29a9=_0x4a29a9-0x0;var _0x386570=_0x22c1[_0x4a29a9];return _0x386570;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x122c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x122c('0x1'));var rp=require(_0x122c('0x2'));var moment=require('moment');var BPromise=require(_0x122c('0x3'));var Mustache=require('mustache');var util=require(_0x122c('0x4'));var path=require(_0x122c('0x5'));var sox=require(_0x122c('0x6'));var csv=require(_0x122c('0x7'));var ejs=require(_0x122c('0x8'));var fs=require('fs');var fs_extra=require(_0x122c('0x9'));var _=require(_0x122c('0xa'));var squel=require(_0x122c('0xb'));var crypto=require(_0x122c('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x122c('0xd'));var toCsv=require(_0x122c('0x7'));var querystring=require(_0x122c('0xe'));var Papa=require(_0x122c('0xf'));var Redis=require(_0x122c('0x10'));var authService=require(_0x122c('0x11'));var qs=require(_0x122c('0x12'));var as=require(_0x122c('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x122c('0x14'))(_0x122c('0x15'));var utils=require(_0x122c('0x16'));var config=require(_0x122c('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x122c('0x18'))['db'];config[_0x122c('0x19')]=_['defaults'](config[_0x122c('0x19')],{'host':_0x122c('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x122c('0x19')]));require(_0x122c('0x1b'))[_0x122c('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0x122c('0x1d')][_0x122c('0x1e')]({'port':0x232c});var client9002=jayson[_0x122c('0x1d')][_0x122c('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x56f763,_0x232e16,_0x3cbac9,_0x56d7a9){return new BPromise(function(_0x4110f5,_0x44eba8){var _0x31f2f5=_0x56d7a9||client;return _0x31f2f5[_0x122c('0x1f')](_0x56f763,_0x3cbac9)['then'](function(_0xb11440){logger[_0x122c('0x20')](_0x122c('0x21'),_0x232e16,_0x122c('0x22'));logger[_0x122c('0x23')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x232e16,_0x122c('0x22'),JSON[_0x122c('0x24')](_0xb11440));if(_0xb11440[_0x122c('0x25')]){if(_0xb11440[_0x122c('0x25')][_0x122c('0x26')]===0x1f4){logger[_0x122c('0x25')](_0x122c('0x21'),_0x232e16,_0xb11440[_0x122c('0x25')][_0x122c('0x27')]);return _0x44eba8(_0xb11440['error'][_0x122c('0x27')]);}logger[_0x122c('0x25')]('FaxAccount,\x20%s,\x20%s',_0x232e16,_0xb11440[_0x122c('0x25')][_0x122c('0x27')]);return _0x4110f5(_0xb11440[_0x122c('0x25')][_0x122c('0x27')]);}else{logger[_0x122c('0x20')](_0x122c('0x21'),_0x232e16,_0x122c('0x22'));_0x4110f5(_0xb11440[_0x122c('0x28')][_0x122c('0x27')]);}})[_0x122c('0x29')](function(_0x5790ff){logger[_0x122c('0x25')](_0x122c('0x21'),_0x232e16,_0x5790ff);_0x44eba8(_0x5790ff);});});}function respondWithStatusCode(_0x3a6477,_0x9337d){_0x9337d=_0x9337d||0xcc;return function(_0x27baa5){if(_0x27baa5){return _0x3a6477[_0x122c('0x2a')](_0x9337d);}return _0x3a6477['status'](_0x9337d)[_0x122c('0x2b')]();};}function respondWithResult(_0x1f1a63,_0x2b9fe1){_0x2b9fe1=_0x2b9fe1||0xc8;return function(_0x5d9a9e){if(_0x5d9a9e){return _0x1f1a63['status'](_0x2b9fe1)[_0x122c('0x2c')](_0x5d9a9e);}};}function respondWithFilteredResult(_0x2e0937,_0x5c4000){return function(_0x27cd72){if(_0x27cd72){var _0x5da24a=typeof _0x5c4000[_0x122c('0x2d')]===_0x122c('0x2e')&&typeof _0x5c4000['limit']==='undefined';var _0x53e39c=_0x27cd72['count'];var _0x1e1a9b=_0x5da24a?0x0:_0x5c4000['offset'];var _0x1eb73f=_0x5da24a?_0x27cd72[_0x122c('0x2f')]:_0x5c4000[_0x122c('0x2d')]+_0x5c4000[_0x122c('0x30')];var _0x5470e6;if(_0x1eb73f>=_0x53e39c){_0x1eb73f=_0x53e39c;_0x5470e6=0xc8;}else{_0x5470e6=0xce;}_0x2e0937[_0x122c('0x31')](_0x5470e6);return _0x2e0937['set'](_0x122c('0x32'),_0x1e1a9b+'-'+_0x1eb73f+'/'+_0x53e39c)['json'](_0x27cd72);}return null;};}function patchUpdates(_0x439a66){return function(_0x5f2d3c){try{jsonpatch[_0x122c('0x33')](_0x5f2d3c,_0x439a66,!![]);}catch(_0x1de8a3){return BPromise['reject'](_0x1de8a3);}return _0x5f2d3c['save']();};}function saveUpdates(_0x1f354d,_0xea7eac){return function(_0x583438){if(_0x583438){return _0x583438[_0x122c('0x34')](_0x1f354d)[_0x122c('0x35')](function(_0x420292){return _0x420292;});}return null;};}function removeEntity(_0x15c032,_0x566a69){return function(_0x285ecc){if(_0x285ecc){return _0x285ecc[_0x122c('0x36')]()[_0x122c('0x35')](function(){var _0x5737bd=_0x285ecc[_0x122c('0x37')]({'plain':!![]});var _0x5a1ceb='FaxAccounts';return db[_0x122c('0x38')][_0x122c('0x36')]({'where':{'type':_0x5a1ceb,'resourceId':_0x5737bd['id']}})[_0x122c('0x35')](function(){return _0x285ecc;});})['then'](function(){_0x15c032['status'](0xcc)[_0x122c('0x2b')]();});}};}function handleEntityNotFound(_0x326d6b,_0x5927ad){return function(_0x39a450){if(!_0x39a450){_0x326d6b[_0x122c('0x2a')](0x194);}return _0x39a450;};}function handleError(_0x4f91fb,_0xf84bcc){_0xf84bcc=_0xf84bcc||0x1f4;return function(_0x4d4a9d){logger['error'](_0x4d4a9d[_0x122c('0x39')]);if(_0x4d4a9d[_0x122c('0x3a')]){delete _0x4d4a9d[_0x122c('0x3a')];}_0x4f91fb[_0x122c('0x31')](_0xf84bcc)[_0x122c('0x3b')](_0x4d4a9d);};}exports[_0x122c('0x3c')]=function(_0x3793c3,_0x3d8868){var _0x293b6e={'include':[{'model':db['Pause'],'as':_0x122c('0x3d')}]},_0x3b60ca={},_0x29b3cc={'count':0x0,'rows':[]};var _0x322427=_[_0x122c('0x3e')](db['FaxAccount']['rawAttributes'],function(_0xa54cd7){return{'name':_0xa54cd7['fieldName'],'type':_0xa54cd7[_0x122c('0x3f')]['key']};});_0x3b60ca[_0x122c('0x40')]=_[_0x122c('0x3e')](_0x322427,_0x122c('0x3a'));_0x3b60ca[_0x122c('0x41')]=_[_0x122c('0x42')](_0x3793c3[_0x122c('0x41')]);_0x3b60ca[_0x122c('0x43')]=_['intersection'](_0x3b60ca[_0x122c('0x40')],_0x3b60ca[_0x122c('0x41')]);_0x293b6e[_0x122c('0x44')]=_[_0x122c('0x45')](_0x3b60ca[_0x122c('0x40')],qs['fields'](_0x3793c3['query'][_0x122c('0x46')]));_0x293b6e[_0x122c('0x44')]=_0x293b6e[_0x122c('0x44')][_0x122c('0x47')]?_0x293b6e[_0x122c('0x44')]:_0x3b60ca['model'];if(!_0x3793c3[_0x122c('0x41')][_0x122c('0x48')]('nolimit')){_0x293b6e[_0x122c('0x30')]=qs[_0x122c('0x30')](_0x3793c3['query'][_0x122c('0x30')]);_0x293b6e[_0x122c('0x2d')]=qs[_0x122c('0x2d')](_0x3793c3[_0x122c('0x41')][_0x122c('0x2d')]);}_0x293b6e[_0x122c('0x49')]=qs['sort'](_0x3793c3[_0x122c('0x41')][_0x122c('0x4a')]);_0x293b6e[_0x122c('0x4b')]=qs['filters'](_[_0x122c('0x4c')](_0x3793c3['query'],_0x3b60ca[_0x122c('0x43')]),_0x322427);if(_0x3793c3[_0x122c('0x41')][_0x122c('0x4d')]){_0x293b6e['where']=_[_0x122c('0x4e')](_0x293b6e[_0x122c('0x4b')],{'$or':_[_0x122c('0x3e')](_0x322427,function(_0x8fc8c3){if(_0x8fc8c3['type']!==_0x122c('0x4f')){var _0x29a948={};_0x29a948[_0x8fc8c3['name']]={'$like':'%'+_0x3793c3[_0x122c('0x41')]['filter']+'%'};return _0x29a948;}})});}_0x293b6e=_[_0x122c('0x4e')]({},_0x293b6e,_0x3793c3['options']);var _0x113f8a={'where':_0x293b6e[_0x122c('0x4b')]};return db[_0x122c('0x50')]['count'](_0x113f8a)[_0x122c('0x35')](function(_0x13f576){_0x29b3cc['count']=_0x13f576;if(_0x3793c3[_0x122c('0x41')]['includeAll']){_0x293b6e['include']=[{'all':!![]}];}return db[_0x122c('0x50')][_0x122c('0x51')](_0x293b6e);})[_0x122c('0x35')](function(_0x3e9ac5){_0x29b3cc['rows']=_0x3e9ac5;return _0x29b3cc;})[_0x122c('0x35')](respondWithFilteredResult(_0x3d8868,_0x293b6e))[_0x122c('0x29')](handleError(_0x3d8868,null));};exports['show']=function(_0x1823de,_0x1f90aa){var _0x44d743={'raw':![],'where':{'id':_0x1823de[_0x122c('0x52')]['id']},'include':[{'model':db['Pause'],'as':_0x122c('0x3d')}]},_0x35bce8={};_0x35bce8[_0x122c('0x40')]=_[_0x122c('0x42')](db['FaxAccount'][_0x122c('0x53')]);_0x35bce8[_0x122c('0x41')]=_['keys'](_0x1823de[_0x122c('0x41')]);_0x35bce8[_0x122c('0x43')]=_[_0x122c('0x45')](_0x35bce8[_0x122c('0x40')],_0x35bce8[_0x122c('0x41')]);_0x44d743['attributes']=_[_0x122c('0x45')](_0x35bce8[_0x122c('0x40')],qs[_0x122c('0x46')](_0x1823de[_0x122c('0x41')][_0x122c('0x46')]));_0x44d743['attributes']=_0x44d743[_0x122c('0x44')]['length']?_0x44d743[_0x122c('0x44')]:_0x35bce8[_0x122c('0x40')];if(_0x1823de[_0x122c('0x41')]['includeAll']){_0x44d743[_0x122c('0x54')]=[{'all':!![]}];}_0x44d743=_[_0x122c('0x4e')]({},_0x44d743,_0x1823de[_0x122c('0x55')]);return db[_0x122c('0x50')][_0x122c('0x56')](_0x44d743)[_0x122c('0x35')](handleEntityNotFound(_0x1f90aa,null))[_0x122c('0x35')](respondWithResult(_0x1f90aa,null))['catch'](handleError(_0x1f90aa,null));};exports[_0x122c('0x57')]=function(_0x436146,_0x1071dd){return db['FaxAccount']['create'](_0x436146[_0x122c('0x58')],{})[_0x122c('0x35')](function(_0x5627a8){var _0x22bb41=_0x436146[_0x122c('0x59')][_0x122c('0x37')]({'plain':!![]});if(!_0x22bb41)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x22bb41[_0x122c('0x5a')]===_0x122c('0x59')){var _0x424496=_0x5627a8[_0x122c('0x37')]({'plain':!![]});var _0x2f9935=_0x122c('0x5b');return db[_0x122c('0x5c')][_0x122c('0x56')]({'where':{'name':_0x2f9935,'userProfileId':_0x22bb41['userProfileId']},'raw':!![]})['then'](function(_0xbb21ec){if(_0xbb21ec&&_0xbb21ec[_0x122c('0x5d')]===0x0){return db['UserProfileResource'][_0x122c('0x57')]({'name':_0x424496[_0x122c('0x3a')],'resourceId':_0x424496['id'],'type':_0xbb21ec[_0x122c('0x3a')],'sectionId':_0xbb21ec['id']},{})[_0x122c('0x35')](function(){return _0x5627a8;});}else{return _0x5627a8;}})[_0x122c('0x29')](function(_0x1fbadc){logger[_0x122c('0x25')](_0x122c('0x5e'),_0x1fbadc);throw _0x1fbadc;});}return _0x5627a8;})[_0x122c('0x35')](respondWithResult(_0x1071dd,0xc9))[_0x122c('0x29')](handleError(_0x1071dd,null));};exports['update']=function(_0x2ebdb1,_0x36b844){if(_0x2ebdb1[_0x122c('0x58')]['id']){delete _0x2ebdb1[_0x122c('0x58')]['id'];}return db[_0x122c('0x50')][_0x122c('0x56')]({'where':{'id':_0x2ebdb1['params']['id']},'include':[{'model':db[_0x122c('0x5f')],'as':_0x122c('0x3d')}]})['then'](handleEntityNotFound(_0x36b844,null))[_0x122c('0x35')](saveUpdates(_0x2ebdb1[_0x122c('0x58')],null))['then'](respondWithResult(_0x36b844,null))[_0x122c('0x29')](handleError(_0x36b844,null));};exports[_0x122c('0x36')]=function(_0x443a87,_0x382d28){return db[_0x122c('0x50')][_0x122c('0x56')]({'where':{'id':_0x443a87['params']['id']}})[_0x122c('0x35')](handleEntityNotFound(_0x382d28,null))['then'](removeEntity(_0x382d28,null))[_0x122c('0x29')](handleError(_0x382d28,null));};exports['describe']=function(_0x14b2dd,_0x50f173){return db[_0x122c('0x50')][_0x122c('0x60')]()['then'](respondWithResult(_0x50f173,null))[_0x122c('0x29')](handleError(_0x50f173,null));};exports['addDisposition']=function(_0x36663e,_0x40fdde,_0x2f739d){if(_0x36663e[_0x122c('0x58')]['id']){delete _0x36663e[_0x122c('0x58')]['id'];}return db[_0x122c('0x50')]['find']({'where':{'id':_0x36663e['params']['id']}})[_0x122c('0x35')](handleEntityNotFound(_0x40fdde,null))[_0x122c('0x35')](function(_0x15adfd){if(_0x15adfd){_0x36663e[_0x122c('0x58')][_0x122c('0x61')]=_0x15adfd['id'];return db[_0x122c('0x62')][_0x122c('0x57')](_0x36663e['body']);}})[_0x122c('0x35')](respondWithResult(_0x40fdde,null))[_0x122c('0x29')](handleError(_0x40fdde,null));};exports[_0x122c('0x63')]=function(_0x5a3237,_0xd86a58,_0x563117){var _0x5113fd={'raw':![],'where':{}};var _0x2178ac={};var _0x353195={'count':0x0,'rows':[]};return db[_0x122c('0x50')][_0x122c('0x64')]({'where':{'id':_0x5a3237[_0x122c('0x52')]['id']}})[_0x122c('0x35')](handleEntityNotFound(_0xd86a58,null))[_0x122c('0x35')](function(_0x4ffdae){if(_0x4ffdae){_0x2178ac[_0x122c('0x40')]=_[_0x122c('0x42')](db['Disposition'][_0x122c('0x53')]);_0x2178ac[_0x122c('0x41')]=_['keys'](_0x5a3237['query']);_0x2178ac[_0x122c('0x43')]=_[_0x122c('0x45')](_0x2178ac['model'],_0x2178ac['query']);_0x5113fd['attributes']=_['intersection'](_0x2178ac['model'],qs[_0x122c('0x46')](_0x5a3237[_0x122c('0x41')][_0x122c('0x46')]));_0x5113fd[_0x122c('0x44')]=_0x5113fd['attributes'][_0x122c('0x47')]?_0x5113fd[_0x122c('0x44')]:_0x2178ac['model'];if(!_0x5a3237[_0x122c('0x41')][_0x122c('0x48')](_0x122c('0x65'))){_0x5113fd[_0x122c('0x30')]=qs[_0x122c('0x30')](_0x5a3237[_0x122c('0x41')]['limit']);_0x5113fd[_0x122c('0x2d')]=qs[_0x122c('0x2d')](_0x5a3237[_0x122c('0x41')][_0x122c('0x2d')]);}_0x5113fd[_0x122c('0x49')]=qs[_0x122c('0x4a')](_0x5a3237[_0x122c('0x41')]['sort']);_0x5113fd[_0x122c('0x4b')]=qs[_0x122c('0x43')](_['pick'](_0x5a3237[_0x122c('0x41')],_0x2178ac['filters']));_0x5113fd[_0x122c('0x4b')][_0x122c('0x61')]=_0x4ffdae['id'];if(_0x5a3237[_0x122c('0x41')][_0x122c('0x4d')]){_0x5113fd[_0x122c('0x4b')]=_[_0x122c('0x4e')](_0x5113fd[_0x122c('0x4b')],{'$or':_[_0x122c('0x3e')](_0x5113fd['attributes'],function(_0xe68e0e){var _0x342656={};_0x342656[_0xe68e0e]={'$like':'%'+_0x5a3237[_0x122c('0x41')][_0x122c('0x4d')]+'%'};return _0x342656;})});}_0x5113fd=_['merge']({},_0x5113fd,_0x5a3237['options']);return db['Disposition'][_0x122c('0x2f')]({'where':_0x5113fd[_0x122c('0x4b')]})[_0x122c('0x35')](function(_0x2d6da2){_0x353195[_0x122c('0x2f')]=_0x2d6da2;if(_0x5a3237[_0x122c('0x41')]['includeAll']){_0x5113fd[_0x122c('0x54')]=[{'all':!![]}];}return db[_0x122c('0x62')][_0x122c('0x51')](_0x5113fd);})[_0x122c('0x35')](function(_0x422ebe){_0x353195['rows']=_0x422ebe;return _0x353195;});}})[_0x122c('0x35')](respondWithFilteredResult(_0xd86a58,_0x5113fd))[_0x122c('0x29')](handleError(_0xd86a58,null));};exports[_0x122c('0x66')]=function(_0x12b223,_0x31f382,_0x3822f9){return db[_0x122c('0x50')][_0x122c('0x56')]({'where':{'id':_0x12b223[_0x122c('0x52')]['id']}})['then'](handleEntityNotFound(_0x31f382,null))[_0x122c('0x35')](function(_0x934ce7){if(_0x934ce7){return _0x934ce7[_0x122c('0x66')](_0x12b223[_0x122c('0x41')][_0x122c('0x67')]);}})[_0x122c('0x35')](respondWithStatusCode(_0x31f382,null))[_0x122c('0x29')](handleError(_0x31f382,null));};exports['addAnswer']=function(_0x262a21,_0x55948a,_0x53198f){if(_0x262a21[_0x122c('0x58')]['id']){delete _0x262a21[_0x122c('0x58')]['id'];}return db['FaxAccount'][_0x122c('0x56')]({'where':{'id':_0x262a21[_0x122c('0x52')]['id']}})[_0x122c('0x35')](handleEntityNotFound(_0x55948a,null))[_0x122c('0x35')](function(_0x3408dd){if(_0x3408dd){_0x262a21['body']['FaxAccountId']=_0x3408dd['id'];return db[_0x122c('0x68')]['create'](_0x262a21[_0x122c('0x58')]);}})[_0x122c('0x35')](respondWithResult(_0x55948a,null))[_0x122c('0x29')](handleError(_0x55948a,null));};exports[_0x122c('0x69')]=function(_0x5c2708,_0x1746a8,_0x3cfe12){var _0xdf0d23={'raw':![],'where':{}};var _0x397886={};var _0x325533={'count':0x0,'rows':[]};return db[_0x122c('0x50')][_0x122c('0x64')]({'where':{'id':_0x5c2708[_0x122c('0x52')]['id']}})['then'](handleEntityNotFound(_0x1746a8,null))[_0x122c('0x35')](function(_0x242706){if(_0x242706){_0x397886['model']=_[_0x122c('0x42')](db[_0x122c('0x68')][_0x122c('0x53')]);_0x397886['query']=_[_0x122c('0x42')](_0x5c2708[_0x122c('0x41')]);_0x397886['filters']=_[_0x122c('0x45')](_0x397886[_0x122c('0x40')],_0x397886[_0x122c('0x41')]);_0xdf0d23[_0x122c('0x44')]=_[_0x122c('0x45')](_0x397886['model'],qs['fields'](_0x5c2708[_0x122c('0x41')][_0x122c('0x46')]));_0xdf0d23[_0x122c('0x44')]=_0xdf0d23[_0x122c('0x44')][_0x122c('0x47')]?_0xdf0d23[_0x122c('0x44')]:_0x397886['model'];if(!_0x5c2708[_0x122c('0x41')][_0x122c('0x48')](_0x122c('0x65'))){_0xdf0d23[_0x122c('0x30')]=qs[_0x122c('0x30')](_0x5c2708['query']['limit']);_0xdf0d23['offset']=qs[_0x122c('0x2d')](_0x5c2708[_0x122c('0x41')]['offset']);}_0xdf0d23['order']=qs[_0x122c('0x4a')](_0x5c2708['query'][_0x122c('0x4a')]);_0xdf0d23[_0x122c('0x4b')]=qs['filters'](_[_0x122c('0x4c')](_0x5c2708[_0x122c('0x41')],_0x397886[_0x122c('0x43')]));_0xdf0d23[_0x122c('0x4b')]['FaxAccountId']=_0x242706['id'];if(_0x5c2708[_0x122c('0x41')][_0x122c('0x4d')]){_0xdf0d23[_0x122c('0x4b')]=_['merge'](_0xdf0d23[_0x122c('0x4b')],{'$or':_[_0x122c('0x3e')](_0xdf0d23[_0x122c('0x44')],function(_0x197c0e){var _0xefc61a={};_0xefc61a[_0x197c0e]={'$like':'%'+_0x5c2708[_0x122c('0x41')][_0x122c('0x4d')]+'%'};return _0xefc61a;})});}_0xdf0d23=_['merge']({},_0xdf0d23,_0x5c2708[_0x122c('0x55')]);return db[_0x122c('0x68')]['count']({'where':_0xdf0d23[_0x122c('0x4b')]})[_0x122c('0x35')](function(_0x193b6d){_0x325533[_0x122c('0x2f')]=_0x193b6d;if(_0x5c2708[_0x122c('0x41')][_0x122c('0x6a')]){_0xdf0d23[_0x122c('0x54')]=[{'all':!![]}];}return db[_0x122c('0x68')][_0x122c('0x51')](_0xdf0d23);})[_0x122c('0x35')](function(_0x3a5eba){_0x325533['rows']=_0x3a5eba;return _0x325533;});}})[_0x122c('0x35')](respondWithFilteredResult(_0x1746a8,_0xdf0d23))[_0x122c('0x29')](handleError(_0x1746a8,null));};exports[_0x122c('0x6b')]=function(_0x59bf59,_0x2d1b67,_0x861844){return db[_0x122c('0x50')][_0x122c('0x56')]({'where':{'id':_0x59bf59[_0x122c('0x52')]['id']}})['then'](handleEntityNotFound(_0x2d1b67,null))[_0x122c('0x35')](function(_0x4aa738){if(_0x4aa738){return _0x4aa738[_0x122c('0x6b')](_0x59bf59[_0x122c('0x41')][_0x122c('0x67')]);}})[_0x122c('0x35')](respondWithStatusCode(_0x2d1b67,null))['catch'](handleError(_0x2d1b67,null));};exports[_0x122c('0x6c')]=function(_0x2e0198,_0x28516a,_0x58ca36){return db[_0x122c('0x6d')][_0x122c('0x56')]({'where':{'id':_0x2e0198['params']['id']}})[_0x122c('0x35')](handleEntityNotFound(_0x28516a,null))['then'](function(_0x3a1401){if(_0x3a1401){return _0x3a1401[_0x122c('0x6c')](_0x2e0198[_0x122c('0x58')]['ids'],_[_0x122c('0x6e')](_0x2e0198[_0x122c('0x58')],[_0x122c('0x67'),'id'])||{});}})[_0x122c('0x35')](respondWithResult(_0x28516a,null))[_0x122c('0x29')](handleError(_0x28516a,null));};exports['getInteractions']=function(_0x3f5663,_0x3c8244,_0x53eb14){var _0x5b6a4d={'raw':![],'where':{}};var _0x4cc531={};var _0x4ba7a8={'count':0x0,'rows':[]};return db[_0x122c('0x50')][_0x122c('0x64')]({'where':{'id':_0x3f5663['params']['id']}})[_0x122c('0x35')](handleEntityNotFound(_0x3c8244,null))[_0x122c('0x35')](function(_0x3cc5e7){if(_0x3cc5e7){_0x4cc531['model']=_[_0x122c('0x42')](db[_0x122c('0x6d')]['rawAttributes']);_0x4cc531[_0x122c('0x41')]=_[_0x122c('0x42')](_0x3f5663[_0x122c('0x41')]);_0x4cc531[_0x122c('0x43')]=_['intersection'](_0x4cc531[_0x122c('0x40')],_0x4cc531['query']);_0x5b6a4d[_0x122c('0x44')]=_[_0x122c('0x45')](_0x4cc531['model'],qs[_0x122c('0x46')](_0x3f5663[_0x122c('0x41')][_0x122c('0x46')]));_0x5b6a4d['attributes']=_0x5b6a4d['attributes']['length']?_0x5b6a4d['attributes']:_0x4cc531[_0x122c('0x40')];if(!_0x3f5663[_0x122c('0x41')][_0x122c('0x48')](_0x122c('0x65'))){_0x5b6a4d[_0x122c('0x30')]=qs[_0x122c('0x30')](_0x3f5663['query'][_0x122c('0x30')]);_0x5b6a4d[_0x122c('0x2d')]=qs[_0x122c('0x2d')](_0x3f5663[_0x122c('0x41')]['offset']);}_0x5b6a4d[_0x122c('0x49')]=qs[_0x122c('0x4a')](_0x3f5663[_0x122c('0x41')]['sort']);_0x5b6a4d[_0x122c('0x4b')]=qs['filters'](_[_0x122c('0x4c')](_0x3f5663['query'],_0x4cc531[_0x122c('0x43')]));_0x5b6a4d[_0x122c('0x4b')]['FaxAccountId']=_0x3cc5e7['id'];if(_0x3f5663[_0x122c('0x41')][_0x122c('0x4d')]){_0x5b6a4d[_0x122c('0x4b')]=_[_0x122c('0x4e')](_0x5b6a4d['where'],{'$or':_[_0x122c('0x3e')](_0x5b6a4d['attributes'],function(_0x5a1491){var _0x5ea469={};_0x5ea469[_0x5a1491]={'$like':'%'+_0x3f5663[_0x122c('0x41')][_0x122c('0x4d')]+'%'};return _0x5ea469;})});}_0x5b6a4d=_['merge']({},_0x5b6a4d,_0x3f5663[_0x122c('0x55')]);return db['FaxInteraction'][_0x122c('0x2f')]({'where':_0x5b6a4d[_0x122c('0x4b')]})[_0x122c('0x35')](function(_0x33b1f2){_0x4ba7a8[_0x122c('0x2f')]=_0x33b1f2;if(_0x3f5663[_0x122c('0x41')][_0x122c('0x6a')]){_0x5b6a4d[_0x122c('0x54')]=[{'model':db[_0x122c('0x6f')],'as':'Contact','required':![]},{'model':db[_0x122c('0x70')],'as':_0x122c('0x71'),'attributes':[_0x122c('0x3a'),_0x122c('0x72'),_0x122c('0x73')],'required':![]},{'model':db[_0x122c('0x74')],'as':_0x122c('0x75'),'attributes':['id','name','color'],'where':_0x3f5663[_0x122c('0x41')][_0x122c('0x76')]?{'id':_0x3f5663[_0x122c('0x41')][_0x122c('0x76')]}:undefined,'required':_0x3f5663[_0x122c('0x41')][_0x122c('0x76')]?!![]:![]}];}return db[_0x122c('0x6d')]['findAll'](_0x5b6a4d);})['then'](function(_0x5e4a60){_0x4ba7a8[_0x122c('0x77')]=_0x5e4a60;return _0x4ba7a8;});}})[_0x122c('0x35')](respondWithFilteredResult(_0x3c8244,_0x5b6a4d))[_0x122c('0x29')](handleError(_0x3c8244,null));};exports['addApplications']=function(_0x5118a2,_0x57fc6b){var _0x445399=_0x5118a2[_0x122c('0x52')]['id'];var _0x18d903=_0x5118a2[_0x122c('0x58')];var _0x39bb27=0xc8;var _0x157143=null;return db[_0x122c('0x78')][_0x122c('0x79')]({'isolationLevel':db['sequelize'][_0x122c('0x7a')][_0x122c('0x7b')][_0x122c('0x7c')]},function(_0x216a61){return db[_0x122c('0x50')][_0x122c('0x64')]({'where':{'id':_0x445399},'transaction':_0x216a61})['then'](function(_0x1d5d4a){if(_0x1d5d4a){return db[_0x122c('0x7d')][_0x122c('0x36')]({'where':{'FaxAccountId':_0x445399},'transaction':_0x216a61})[_0x122c('0x35')](function(){var _0x24ffc3=_[_0x122c('0x3e')](_0x18d903,function(_0x402adc){_0x402adc['FaxAccountId']=_0x445399;return _0x402adc;});return db['FaxApplication'][_0x122c('0x7e')](_0x24ffc3,{'transaction':_0x216a61});});}else{_0x39bb27=0x194;_0x157143=[];}});})['then'](function(){if(_0x39bb27!==0x194){return db[_0x122c('0x7d')]['findAndCountAll']({'where':{'FaxAccountId':_0x445399},'order':_0x122c('0x7f')})[_0x122c('0x35')](function(_0x2aabaa){_0x157143=_0x2aabaa;});}})[_0x122c('0x29')](function(_0x3e15ab){_0x39bb27=0x1f4;logger[_0x122c('0x25')](_0x3e15ab[_0x122c('0x39')]);if(_0x3e15ab[_0x122c('0x3a')]){delete _0x3e15ab[_0x122c('0x3a')];}_0x157143=_0x3e15ab;})[_0x122c('0x80')](function(){if(_0x157143===null){_0x57fc6b['sendStatus'](_0x39bb27);}else{if(_0x39bb27===0x1f4){_0x57fc6b[_0x122c('0x31')](_0x39bb27)[_0x122c('0x3b')](_0x157143);}else{_0x57fc6b[_0x122c('0x31')](_0x39bb27)[_0x122c('0x2c')](_0x157143);}}});};exports[_0x122c('0x81')]=function(_0xd3b7fa,_0x4700e7,_0x48f94d){var _0x5ac115={};var _0x185868={};var _0x41118e;var _0x19be4a;return db[_0x122c('0x50')]['findOne']({'where':{'id':_0xd3b7fa[_0x122c('0x52')]['id']}})['then'](handleEntityNotFound(_0x4700e7,null))[_0x122c('0x35')](function(_0x2fe818){if(_0x2fe818){_0x41118e=_0x2fe818;_0x185868[_0x122c('0x40')]=_[_0x122c('0x42')](db['FaxApplication'][_0x122c('0x53')]);_0x185868['query']=_['keys'](_0xd3b7fa[_0x122c('0x41')]);_0x185868[_0x122c('0x43')]=_[_0x122c('0x45')](_0x185868['model'],_0x185868[_0x122c('0x41')]);_0x5ac115[_0x122c('0x44')]=_[_0x122c('0x45')](_0x185868[_0x122c('0x40')],qs[_0x122c('0x46')](_0xd3b7fa['query']['fields']));_0x5ac115[_0x122c('0x44')]=_0x5ac115['attributes'][_0x122c('0x47')]?_0x5ac115[_0x122c('0x44')]:_0x185868[_0x122c('0x40')];_0x5ac115[_0x122c('0x49')]=qs['sort'](_0xd3b7fa[_0x122c('0x41')][_0x122c('0x4a')]);_0x5ac115[_0x122c('0x4b')]=qs['filters'](_[_0x122c('0x4c')](_0xd3b7fa[_0x122c('0x41')],_0x185868['filters']));if(_0xd3b7fa[_0x122c('0x41')][_0x122c('0x4d')]){_0x5ac115[_0x122c('0x4b')]=_[_0x122c('0x4e')](_0x5ac115[_0x122c('0x4b')],{'$or':_[_0x122c('0x3e')](_0x5ac115[_0x122c('0x44')],function(_0x5d0fdb){var _0x15a38d={};_0x15a38d[_0x5d0fdb]={'$like':'%'+_0xd3b7fa['query'][_0x122c('0x4d')]+'%'};return _0x15a38d;})});}_0x5ac115=_['merge']({},_0x5ac115,_0xd3b7fa[_0x122c('0x55')]);return _0x41118e[_0x122c('0x81')](_0x5ac115);}})[_0x122c('0x35')](function(_0x57ea20){if(_0x57ea20){_0x19be4a=_0x57ea20['length'];if(!_0xd3b7fa['query'][_0x122c('0x48')]('nolimit')){_0x5ac115[_0x122c('0x30')]=qs[_0x122c('0x30')](_0xd3b7fa[_0x122c('0x41')]['limit']);_0x5ac115[_0x122c('0x2d')]=qs[_0x122c('0x2d')](_0xd3b7fa[_0x122c('0x41')]['offset']);}return _0x41118e[_0x122c('0x81')](_0x5ac115);}})[_0x122c('0x35')](function(_0x2cb821){if(_0x2cb821){return _0x2cb821?{'count':_0x19be4a,'rows':_0x2cb821}:null;}})[_0x122c('0x35')](respondWithResult(_0x4700e7,null))[_0x122c('0x29')](handleError(_0x4700e7,null));};function Extension(_0x269b23,_0x45f662,_0x3d5604,_0x2eb826){this[_0x122c('0x82')]=_0x122c('0x83');this['exten']=_0x269b23[_0x122c('0x84')];this['app']=_0x2eb826;this[_0x122c('0x3f')]=_0x122c('0x85');this[_0x122c('0x86')]=_0x122c('0x87');this[_0x122c('0x61')]=_0x269b23['id'];this[_0x122c('0x7f')]=_0x45f662;this[_0x122c('0x88')]=_0x3d5604;}function createExtensionsReciveFax(_0x205427){var _0x552bb5=0x1;var _0x755d=[];_0x755d[_0x122c('0x89')](new Extension(_0x205427,_0x552bb5,'',_0x122c('0x8a')));_0x552bb5+=0x1;_0x755d[_0x122c('0x89')](new Extension(_0x205427,_0x552bb5,_0x122c('0x8b'),'Set'));_0x552bb5+=0x1;for(var _0x401711 in _0x205427){if(_0x205427[_0x122c('0x48')](_0x401711)&&(_0x401711==='ecm'||_0x401711==='localstationid'||_0x401711===_0x122c('0x8c')||_0x401711===_0x122c('0x8d')||_0x401711===_0x122c('0x8e')||_0x401711===_0x122c('0x8f')||_0x401711==='minrate'||_0x401711===_0x122c('0x90')||_0x401711===_0x122c('0x91'))){_0x755d[_0x122c('0x89')](new Extension(_0x205427,_0x552bb5,'FAXOPT('+_0x401711+')='+_0x205427[_0x401711],_0x122c('0x92')));_0x552bb5+=0x1;}}_0x755d['push'](new Extension(_0x205427,_0x552bb5,'6','Wait'));_0x552bb5+=0x1;_0x755d[_0x122c('0x89')](new Extension(_0x205427,_0x552bb5,_0x122c('0x93'),'ReceiveFax'));_0x552bb5=0x0;return _0x755d;}exports['addAccountApplications']=function(_0x4ded97,_0x4701b1,_0x2d16cb){var _0x1e0b3f;return db['sequelize']['transaction'](function(_0x5b1f7f){return db['FaxAccount']['create'](_0x4ded97[_0x122c('0x58')],{'transaction':_0x5b1f7f})[_0x122c('0x35')](function(_0x8281f6){_0x1e0b3f=_0x8281f6['get']({'plain':!![]});return db['VoiceExtension'][_0x122c('0x7e')](createExtensionsReciveFax(_0x1e0b3f),{'transaction':_0x5b1f7f});});})[_0x122c('0x35')](function(){return _0x1e0b3f;})[_0x122c('0x35')](respondWithResult(_0x4701b1,null))[_0x122c('0x29')](handleError(_0x4701b1,null));};exports[_0x122c('0x94')]=function(_0x37d687,_0x470d5e,_0x747f85){var _0x1e04be;return db[_0x122c('0x78')]['transaction'](function(_0x1b4840){return db[_0x122c('0x50')][_0x122c('0x34')](_0x37d687['body'],{'where':{'id':_0x37d687[_0x122c('0x58')]['id']},'transaction':_0x1b4840})['then'](function(_0x621ea1){return db[_0x122c('0x95')][_0x122c('0x36')]({'where':{'FaxAccountId':_0x37d687[_0x122c('0x58')]['id']},'transaction':_0x1b4840})[_0x122c('0x35')](function(_0x42fcaf){return db[_0x122c('0x95')][_0x122c('0x7e')](createExtensionsReciveFax(_[_0x122c('0x6e')](_0x37d687[_0x122c('0x58')],['tech',_0x122c('0x96'),_0x122c('0x97'),_0x122c('0x98'),_0x122c('0x99'),_0x122c('0x9a')])),{'transaction':_0x1b4840});});});})[_0x122c('0x35')](function(){return db[_0x122c('0x50')][_0x122c('0x9b')](_0x37d687[_0x122c('0x58')]['id']);})[_0x122c('0x35')](respondWithResult(_0x470d5e,null))[_0x122c('0x29')](handleError(_0x470d5e,null));};exports[_0x122c('0x9c')]=function(_0x1e148e,_0xc10da1,_0x4a46ab){var _0x5a3046={'raw':!![],'where':{}};var _0x59b8b2={};var _0x392422={'count':0x0,'rows':[]};return db[_0x122c('0x50')][_0x122c('0x64')]({'where':{'id':_0x1e148e[_0x122c('0x52')]['id']}})['then'](handleEntityNotFound(_0xc10da1,null))[_0x122c('0x35')](function(_0x381722){if(_0x381722){_0x59b8b2['model']=_['keys'](db[_0x122c('0x9d')][_0x122c('0x53')]);_0x59b8b2[_0x122c('0x41')]=_['keys'](_0x1e148e[_0x122c('0x41')]);_0x59b8b2[_0x122c('0x43')]=_[_0x122c('0x45')](_0x59b8b2[_0x122c('0x40')],_0x59b8b2[_0x122c('0x41')]);_0x5a3046['attributes']=_[_0x122c('0x45')](_0x59b8b2[_0x122c('0x40')],qs[_0x122c('0x46')](_0x1e148e[_0x122c('0x41')]['fields']));_0x5a3046[_0x122c('0x44')]=_0x5a3046[_0x122c('0x44')][_0x122c('0x47')]?_0x5a3046[_0x122c('0x44')]:_0x59b8b2[_0x122c('0x40')];if(!_0x1e148e[_0x122c('0x41')]['hasOwnProperty'](_0x122c('0x65'))){_0x5a3046[_0x122c('0x30')]=qs[_0x122c('0x30')](_0x1e148e[_0x122c('0x41')][_0x122c('0x30')]);_0x5a3046[_0x122c('0x2d')]=qs[_0x122c('0x2d')](_0x1e148e[_0x122c('0x41')][_0x122c('0x2d')]);}_0x5a3046[_0x122c('0x49')]=qs[_0x122c('0x4a')](_0x1e148e[_0x122c('0x41')][_0x122c('0x4a')]);_0x5a3046[_0x122c('0x4b')]=qs[_0x122c('0x43')](_['pick'](_0x1e148e[_0x122c('0x41')],_0x59b8b2[_0x122c('0x43')]));_0x5a3046['where'][_0x122c('0x61')]=_0x381722['id'];if(_0x1e148e['query'][_0x122c('0x4d')]){_0x5a3046[_0x122c('0x4b')]=_['merge'](_0x5a3046[_0x122c('0x4b')],{'$or':_['map'](_0x5a3046['attributes'],function(_0x4aa47d){var _0x501ab5={};_0x501ab5[_0x4aa47d]={'$like':'%'+_0x1e148e[_0x122c('0x41')][_0x122c('0x4d')]+'%'};return _0x501ab5;})});}if(_0x1e148e[_0x122c('0x41')]['$gte']){var _0x23232c=_0x1e148e['query']['$gte'][_0x122c('0x9e')](',');var _0x5b757a={};_0x5b757a[_0x23232c[0x0]]={'$gte':moment(_0x23232c[0x1])['format'](_0x122c('0x9f'))};_0x5a3046[_0x122c('0x4b')]=_['merge'](_0x5a3046['where'],_0x5b757a);}_0x5a3046=_[_0x122c('0x4e')]({},_0x5a3046,_0x1e148e[_0x122c('0x55')]);return db[_0x122c('0x9d')][_0x122c('0x2f')]({'where':_0x5a3046[_0x122c('0x4b')]})[_0x122c('0x35')](function(_0x4872e7){_0x392422[_0x122c('0x2f')]=_0x4872e7;if(_0x1e148e[_0x122c('0x41')][_0x122c('0x6a')]){_0x5a3046[_0x122c('0x54')]=[{'all':!![]}];}return db[_0x122c('0x9d')][_0x122c('0x51')](_0x5a3046);})[_0x122c('0x35')](function(_0x55408f){_0x392422['rows']=_0x55408f;return _0x392422;});}})[_0x122c('0x35')](respondWithFilteredResult(_0xc10da1,_0x5a3046))[_0x122c('0x29')](handleError(_0xc10da1,null));};exports['send']=function(_0x23182c,_0x4d3563,_0x1a009b){var _0x5b84d6,_0xf45e71={},_0x1d8e99;if(_0x23182c[_0x122c('0x58')]['to']){_0x1d8e99=_0x23182c[_0x122c('0x58')]['to'][0x0];}return db[_0x122c('0x50')][_0x122c('0x56')]({'where':{'id':_0x23182c[_0x122c('0x52')]['id']},'include':[{'model':db['CmList'],'as':_0x122c('0xa0'),'include':[{'model':db[_0x122c('0x6f')],'as':_0x122c('0xa1'),'where':{'fax':_0x1d8e99},'limit':0x1,'order':[[_0x122c('0x98'),_0x122c('0xa2')]]}]}]})['then'](handleEntityNotFound(_0x4d3563,null))[_0x122c('0x35')](function(_0x399e7e){_0x5b84d6=_0x399e7e;if(_0x23182c[_0x122c('0x58')]['attachments']&&_0x23182c[_0x122c('0x58')][_0x122c('0xa3')][_0x122c('0x47')]){for(var _0x5dc184=0x0;_0x5dc184<_0x23182c[_0x122c('0x58')]['attachments'][_0x122c('0x47')];_0x5dc184+=0x1){_0x23182c[_0x122c('0x58')]['attachments'][_0x5dc184]={'filename':_0x23182c[_0x122c('0x58')][_0x122c('0xa3')][_0x5dc184]['name'],'id':_0x23182c['body'][_0x122c('0xa3')][_0x5dc184]['id'],'path':path[_0x122c('0xa4')](config[_0x122c('0xa5')],_0x122c('0xa6'),_0x23182c[_0x122c('0x58')][_0x122c('0xa3')][_0x5dc184][_0x122c('0xa7')])};}}return respondWithRpcPromise('CheckAfterSend',_0x122c('0xa8'),{'FaxAccountId':_[_0x122c('0xa9')](_0x23182c[_0x122c('0x52')]['id'])?undefined:_0x23182c[_0x122c('0x52')]['id'],'path':_[_0x122c('0xa9')](_0x23182c[_0x122c('0x58')][_0x122c('0xa3')][0x0][_0x122c('0x5')])?undefined:_0x23182c[_0x122c('0x58')][_0x122c('0xa3')][0x0][_0x122c('0x5')],'fax':_[_0x122c('0xa9')](_0x23182c[_0x122c('0x58')]['to'][0x0])?undefined:_0x23182c[_0x122c('0x58')]['to'][0x0]},client9002);})[_0x122c('0x35')](function(){if(_0x5b84d6){if(_[_0x122c('0xa9')](_0x23182c['body'][_0x122c('0xaa')])){_0x23182c['body'][_0x122c('0xaa')]=util[_0x122c('0xab')](_0x122c('0xac'),_0x5b84d6[_0x122c('0x3a')],_0x5b84d6[_0x122c('0xad')]);}if(_0x5b84d6[_0x122c('0xa0')]){if(_0x5b84d6[_0x122c('0xa0')][_0x122c('0xa1')][_0x122c('0x47')]){return _0x5b84d6[_0x122c('0xa0')][_0x122c('0xa1')][0x0];}else{return db['CmContact'][_0x122c('0x57')](_[_0x122c('0xae')](_0x23182c[_0x122c('0x58')],{'firstName':_0x23182c[_0x122c('0x58')]['to'][0x0],'phone':_0x23182c[_0x122c('0x58')]['to'][0x0],'fax':_0x23182c[_0x122c('0x58')]['to'][0x0],'ListId':_0x5b84d6['ListId']}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error('Send\x20Fax\x20failed');}})[_0x122c('0x35')](function(_0xbc86ef){if(_0xbc86ef){return db[_0x122c('0x6d')][_0x122c('0x56')]({'where':{'ContactId':_0xbc86ef['id'],'closed':![],'FaxAccountId':_0x5b84d6['id']}})['then'](function(_0x5a6c88){if(_0x5a6c88){return[_0x5a6c88,![]];}return db[_0x122c('0x6d')][_0x122c('0x57')]({'UserId':_0x23182c['user']['id'],'ContactId':_0xbc86ef['id'],'FaxAccountId':_0x5b84d6['id'],'fax':_0x23182c[_0x122c('0x58')]['to'][0x0],'firstMsgDirection':_0x122c('0xaf'),'Messages':[_[_0x122c('0x4e')](_0x23182c[_0x122c('0x58')],{'read':![],'body':_0x23182c[_0x122c('0x58')][_0x122c('0xa3')][0x0][_0x122c('0xb0')],'FaxAccountId':_0x5b84d6['id'],'UserId':_0x23182c[_0x122c('0x59')]['id'],'ContactId':_0xbc86ef['id'],'AttachmentId':_0x23182c[_0x122c('0x58')][_0x122c('0xa3')][0x0]['id']})]},{'include':[{'model':db[_0x122c('0x9d')],'as':'Messages'}]})[_0x122c('0x35')](function(_0x325eba){return[_0x325eba,!![]];});});}else{throw new Error(_0x122c('0xb1'));}})[_0x122c('0xb2')](function(_0x2246d5,_0x7bcc54){if(_0x7bcc54){return _0x2246d5;}return db[_0x122c('0x9d')][_0x122c('0x57')]({'direction':_0x122c('0xaf'),'read':![],'body':_0x23182c['body'][_0x122c('0xa3')][0x0][_0x122c('0xb0')],'FaxAccountId':_0x5b84d6['id'],'FaxInteractionId':_0x2246d5['id'],'UserId':_0x23182c[_0x122c('0x59')]['id'],'ContactId':_0x2246d5[_0x122c('0xb3')],'AttachmentId':_0x23182c[_0x122c('0x58')]['attachments'][0x0]['id']})[_0x122c('0x35')](function(_0x386ea2){_0x2246d5[_0x122c('0xb4')][_0x122c('0xb5')]=[];_0x2246d5['dataValues']['Messages']['push'](_0x386ea2['dataValues']);return _0x2246d5;});})[_0x122c('0x35')](function(_0x2c3c1a){respondWithRpcPromise(_0x122c('0xb6'),_0x122c('0xb6'),{'FaxAccountId':_[_0x122c('0xa9')](_0x23182c[_0x122c('0x52')]['id'])?undefined:_0x23182c[_0x122c('0x52')]['id'],'path':_['isNil'](_0x23182c[_0x122c('0x58')]['attachments'][0x0][_0x122c('0x5')])?undefined:_0x23182c['body'][_0x122c('0xa3')][0x0][_0x122c('0x5')],'fax':_[_0x122c('0xa9')](_0x23182c['body']['to'][0x0])?undefined:_0x23182c[_0x122c('0x58')]['to'][0x0],'AttachmentId':_0x23182c[_0x122c('0x58')][_0x122c('0xa3')][0x0]['id']},client9002)[_0x122c('0x35')](function(_0x3de4c4){logger['info'](_0x122c('0xb7'),_0x3de4c4);})['catch'](function(_0x1da2e9){logger[_0x122c('0x20')](_0x122c('0xb7'),_0x1da2e9);});return _0x2c3c1a;})['then'](respondWithResult(_0x4d3563,null))[_0x122c('0x29')](handleError(_0x4d3563,null));};exports[_0x122c('0xb8')]=function(_0x56b2ef,_0x5eaf15,_0x184c8d){return db[_0x122c('0x50')][_0x122c('0x56')]({'where':{'id':_0x56b2ef[_0x122c('0x52')]['id']}})[_0x122c('0x35')](handleEntityNotFound(_0x5eaf15,null))[_0x122c('0x35')](function(_0xa3b239){if(_0xa3b239){return _0xa3b239[_0x122c('0xb8')](_0x56b2ef[_0x122c('0x58')]['ids'],_[_0x122c('0x6e')](_0x56b2ef['body'],[_0x122c('0x67'),'id'])||{})[_0x122c('0xb2')](function(_0x519259){for(var _0x29fd84=0x0;_0x29fd84<_0x56b2ef[_0x122c('0x58')][_0x122c('0x67')][_0x122c('0x47')];_0x29fd84+=0x1){socket[_0x122c('0xb9')](_0x122c('0xba'),{'UserId':Number(_0x56b2ef['body'][_0x122c('0x67')][_0x29fd84]),'FaxAccountId':Number(_0x56b2ef['params']['id'])});}return _0x519259;});}})[_0x122c('0x35')](respondWithResult(_0x5eaf15,null))[_0x122c('0x29')](handleError(_0x5eaf15,null));};exports[_0x122c('0xbb')]=function(_0x5c46c3,_0x269a5c,_0x24d5d9){return db['FaxAccount'][_0x122c('0x56')]({'where':{'id':_0x5c46c3[_0x122c('0x52')]['id']}})[_0x122c('0x35')](handleEntityNotFound(_0x269a5c,null))[_0x122c('0x35')](function(_0x437b1b){if(_0x437b1b){return _0x437b1b[_0x122c('0xbb')](_0x5c46c3[_0x122c('0x41')][_0x122c('0x67')])[_0x122c('0x35')](function(){if(_[_0x122c('0xbc')](_0x5c46c3[_0x122c('0x41')]['ids'])){for(var _0x5ab4fd=0x0;_0x5ab4fd<_0x5c46c3[_0x122c('0x41')]['ids'][_0x122c('0x47')];_0x5ab4fd+=0x1){socket['emit'](_0x122c('0xbd'),{'UserId':Number(_0x5c46c3[_0x122c('0x41')]['ids'][_0x5ab4fd]),'FaxAccountId':Number(_0x5c46c3['params']['id'])});}}else{socket['emit'](_0x122c('0xbd'),{'UserId':Number(_0x5c46c3['query'][_0x122c('0x67')]),'FaxAccountId':Number(_0x5c46c3['params']['id'])});}});}})[_0x122c('0x35')](respondWithStatusCode(_0x269a5c,null))[_0x122c('0x29')](handleError(_0x269a5c,null));};exports['getAgents']=function(_0x296291,_0x5cc945,_0x56b517){var _0x6849bd={};var _0x3d4df9={};var _0x416ca8;var _0x1eeeaf;return db[_0x122c('0x50')]['findOne']({'where':{'id':_0x296291[_0x122c('0x52')]['id']}})['then'](handleEntityNotFound(_0x5cc945,null))[_0x122c('0x35')](function(_0x14bcc7){if(_0x14bcc7){_0x416ca8=_0x14bcc7;_0x3d4df9[_0x122c('0x40')]=_[_0x122c('0x42')](db[_0x122c('0x70')][_0x122c('0x53')]);_0x3d4df9['query']=_[_0x122c('0x42')](_0x296291[_0x122c('0x41')]);_0x3d4df9[_0x122c('0x43')]=_[_0x122c('0x45')](_0x3d4df9[_0x122c('0x40')],_0x3d4df9[_0x122c('0x41')]);_0x6849bd[_0x122c('0x44')]=_[_0x122c('0x45')](_0x3d4df9[_0x122c('0x40')],qs[_0x122c('0x46')](_0x296291[_0x122c('0x41')][_0x122c('0x46')]));_0x6849bd[_0x122c('0x44')]=_0x6849bd[_0x122c('0x44')]['length']?_0x6849bd[_0x122c('0x44')]:_0x3d4df9[_0x122c('0x40')];_0x6849bd['order']=qs[_0x122c('0x4a')](_0x296291[_0x122c('0x41')][_0x122c('0x4a')]);_0x6849bd[_0x122c('0x4b')]=qs['filters'](_[_0x122c('0x4c')](_0x296291[_0x122c('0x41')],_0x3d4df9[_0x122c('0x43')]));if(_0x296291[_0x122c('0x41')][_0x122c('0x4d')]){_0x6849bd[_0x122c('0x4b')]=_[_0x122c('0x4e')](_0x6849bd['where'],{'$or':_[_0x122c('0x3e')](_0x6849bd[_0x122c('0x44')],function(_0x166fe9){var _0x33f873={};_0x33f873[_0x166fe9]={'$like':'%'+_0x296291[_0x122c('0x41')][_0x122c('0x4d')]+'%'};return _0x33f873;})});}_0x6849bd=_[_0x122c('0x4e')]({},_0x6849bd,_0x296291[_0x122c('0x55')]);return _0x416ca8['getAgents'](_0x6849bd);}})[_0x122c('0x35')](function(_0x10c798){if(_0x10c798){_0x1eeeaf=_0x10c798[_0x122c('0x47')];if(!_0x296291['query'][_0x122c('0x48')](_0x122c('0x65'))){_0x6849bd['limit']=qs[_0x122c('0x30')](_0x296291[_0x122c('0x41')]['limit']);_0x6849bd[_0x122c('0x2d')]=qs[_0x122c('0x2d')](_0x296291['query'][_0x122c('0x2d')]);}return _0x416ca8['getAgents'](_0x6849bd);}})[_0x122c('0x35')](function(_0x3faad8){if(_0x3faad8){return _0x3faad8?{'count':_0x1eeeaf,'rows':_0x3faad8}:null;}})[_0x122c('0x35')](respondWithResult(_0x5cc945,null))['catch'](handleError(_0x5cc945,null));}; \ No newline at end of file +var _0xe1f8=['defaults','localhost','socket.io-emitter','./faxAccount.socket','http','client','request','then','FaxAccount,\x20%s,\x20%s','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','get','FaxAccounts','stack','name','index','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','type','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','params','keys','filters','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','describe','addDisposition','Disposition','findOne','FaxAccountId','options','rows','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','addInteraction','FaxInteraction','omit','CmContact','User','Owner','fullname','internal','Tag','tag','addApplications','transaction','sequelize','Transaction','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','finally','getApplications','context','exten','localstationid','app','Fax\x20Extension','priority','appdata','push','Set','ecm','gateway','headerinfo','maxrate','minrate','modem','t38timeout','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','VoiceExtension','createdAt','updatedAt','ListId','findById','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','send','CmList','List','Contacts','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','fax','Send\x20Fax\x20failed','filename','spread','out','Messages','dataValues','SendFax','info','SendFaxRpc,\x20%s','addAgents','userFaxAccount:save','removeAgents','isArray','emit','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','lodash','squel','desk.js','to-csv','querystring','papaparse','../../config/utils','../../config/environment','../../mysqldb','redis'];(function(_0x559345,_0x30afef){var _0x32b009=function(_0x5019e3){while(--_0x5019e3){_0x559345['push'](_0x559345['shift']());}};_0x32b009(++_0x30afef);}(_0xe1f8,0xa3));var _0x8e1f=function(_0x473091,_0x16b81a){_0x473091=_0x473091-0x0;var _0x5efdc3=_0xe1f8[_0x473091];return _0x5efdc3;};'use strict';var emlformat=require(_0x8e1f('0x0'));var rimraf=require(_0x8e1f('0x1'));var zipdir=require(_0x8e1f('0x2'));var jsonpatch=require(_0x8e1f('0x3'));var rp=require(_0x8e1f('0x4'));var moment=require('moment');var BPromise=require(_0x8e1f('0x5'));var Mustache=require(_0x8e1f('0x6'));var util=require('util');var path=require(_0x8e1f('0x7'));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(_0x8e1f('0x8'));var squel=require(_0x8e1f('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8e1f('0xa'));var toCsv=require(_0x8e1f('0xb'));var querystring=require(_0x8e1f('0xc'));var Papa=require(_0x8e1f('0xd'));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(_0x8e1f('0xe'));var config=require(_0x8e1f('0xf'));var licenseUtil=require('../../config/license/util');var db=require(_0x8e1f('0x10'))['db'];config[_0x8e1f('0x11')]=_[_0x8e1f('0x12')](config[_0x8e1f('0x11')],{'host':_0x8e1f('0x13'),'port':0x18eb});var socket=require(_0x8e1f('0x14'))(new Redis(config[_0x8e1f('0x11')]));require(_0x8e1f('0x15'))['register'](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x8e1f('0x16')]({'port':0x232c});var client9002=jayson[_0x8e1f('0x17')][_0x8e1f('0x16')]({'port':0x232a});function respondWithRpcPromise(_0x480694,_0x77b538,_0x4d750c,_0x4232d7){return new BPromise(function(_0x4e0a2c,_0x157f48){var _0xfe5989=_0x4232d7||client;return _0xfe5989[_0x8e1f('0x18')](_0x480694,_0x4d750c)[_0x8e1f('0x19')](function(_0x2ce745){logger['info'](_0x8e1f('0x1a'),_0x77b538,'request\x20sent');logger[_0x8e1f('0x1b')](_0x8e1f('0x1c'),_0x77b538,_0x8e1f('0x1d'),JSON[_0x8e1f('0x1e')](_0x2ce745));if(_0x2ce745[_0x8e1f('0x1f')]){if(_0x2ce745[_0x8e1f('0x1f')][_0x8e1f('0x20')]===0x1f4){logger['error'](_0x8e1f('0x1a'),_0x77b538,_0x2ce745[_0x8e1f('0x1f')][_0x8e1f('0x21')]);return _0x157f48(_0x2ce745['error'][_0x8e1f('0x21')]);}logger[_0x8e1f('0x1f')](_0x8e1f('0x1a'),_0x77b538,_0x2ce745['error'][_0x8e1f('0x21')]);return _0x4e0a2c(_0x2ce745[_0x8e1f('0x1f')][_0x8e1f('0x21')]);}else{logger['info']('FaxAccount,\x20%s,\x20%s',_0x77b538,_0x8e1f('0x1d'));_0x4e0a2c(_0x2ce745['result'][_0x8e1f('0x21')]);}})[_0x8e1f('0x22')](function(_0x3eb892){logger['error'](_0x8e1f('0x1a'),_0x77b538,_0x3eb892);_0x157f48(_0x3eb892);});});}function respondWithStatusCode(_0x1e8780,_0x133a16){_0x133a16=_0x133a16||0xcc;return function(_0x4b485a){if(_0x4b485a){return _0x1e8780[_0x8e1f('0x23')](_0x133a16);}return _0x1e8780[_0x8e1f('0x24')](_0x133a16)[_0x8e1f('0x25')]();};}function respondWithResult(_0x4b7e72,_0x23a379){_0x23a379=_0x23a379||0xc8;return function(_0x286fd4){if(_0x286fd4){return _0x4b7e72['status'](_0x23a379)[_0x8e1f('0x26')](_0x286fd4);}};}function respondWithFilteredResult(_0x471601,_0xd04383){return function(_0x212726){if(_0x212726){var _0x11763d=typeof _0xd04383[_0x8e1f('0x27')]===_0x8e1f('0x28')&&typeof _0xd04383[_0x8e1f('0x29')]===_0x8e1f('0x28');var _0x3f9633=_0x212726[_0x8e1f('0x2a')];var _0x445ba9=_0x11763d?0x0:_0xd04383['offset'];var _0x328350=_0x11763d?_0x212726['count']:_0xd04383['offset']+_0xd04383['limit'];var _0xce3a6a;if(_0x328350>=_0x3f9633){_0x328350=_0x3f9633;_0xce3a6a=0xc8;}else{_0xce3a6a=0xce;}_0x471601[_0x8e1f('0x24')](_0xce3a6a);return _0x471601[_0x8e1f('0x2b')](_0x8e1f('0x2c'),_0x445ba9+'-'+_0x328350+'/'+_0x3f9633)[_0x8e1f('0x26')](_0x212726);}return null;};}function patchUpdates(_0x26ef90){return function(_0x411aa6){try{jsonpatch[_0x8e1f('0x2d')](_0x411aa6,_0x26ef90,!![]);}catch(_0x477a91){return BPromise['reject'](_0x477a91);}return _0x411aa6[_0x8e1f('0x2e')]();};}function saveUpdates(_0x478540,_0xc62c68){return function(_0x406aaa){if(_0x406aaa){return _0x406aaa[_0x8e1f('0x2f')](_0x478540)[_0x8e1f('0x19')](function(_0x43c174){return _0x43c174;});}return null;};}function removeEntity(_0x36d973,_0x3d7b18){return function(_0x17e66f){if(_0x17e66f){return _0x17e66f[_0x8e1f('0x30')]()[_0x8e1f('0x19')](function(){var _0x434e19=_0x17e66f[_0x8e1f('0x31')]({'plain':!![]});var _0x9e6ee2=_0x8e1f('0x32');return db['UserProfileResource']['destroy']({'where':{'type':_0x9e6ee2,'resourceId':_0x434e19['id']}})[_0x8e1f('0x19')](function(){return _0x17e66f;});})[_0x8e1f('0x19')](function(){_0x36d973[_0x8e1f('0x24')](0xcc)[_0x8e1f('0x25')]();});}};}function handleEntityNotFound(_0x1a8908,_0x1dc562){return function(_0x25994a){if(!_0x25994a){_0x1a8908[_0x8e1f('0x23')](0x194);}return _0x25994a;};}function handleError(_0x2e1399,_0x5e0b1e){_0x5e0b1e=_0x5e0b1e||0x1f4;return function(_0x4fbf31){logger[_0x8e1f('0x1f')](_0x4fbf31[_0x8e1f('0x33')]);if(_0x4fbf31[_0x8e1f('0x34')]){delete _0x4fbf31['name'];}_0x2e1399[_0x8e1f('0x24')](_0x5e0b1e)['send'](_0x4fbf31);};}exports[_0x8e1f('0x35')]=function(_0x52d6b5,_0x5072fe){var _0x825c30={'include':[{'model':db[_0x8e1f('0x36')],'as':_0x8e1f('0x37')}]},_0x31a69b={},_0x4b2116={'count':0x0,'rows':[]};var _0x18c4f4=_[_0x8e1f('0x38')](db[_0x8e1f('0x39')][_0x8e1f('0x3a')],function(_0x3a90b0){return{'name':_0x3a90b0[_0x8e1f('0x3b')],'type':_0x3a90b0[_0x8e1f('0x3c')]['key']};});_0x31a69b[_0x8e1f('0x3d')]=_['map'](_0x18c4f4,_0x8e1f('0x34'));_0x31a69b[_0x8e1f('0x3e')]=_['keys'](_0x52d6b5[_0x8e1f('0x3e')]);_0x31a69b['filters']=_[_0x8e1f('0x3f')](_0x31a69b[_0x8e1f('0x3d')],_0x31a69b[_0x8e1f('0x3e')]);_0x825c30['attributes']=_[_0x8e1f('0x3f')](_0x31a69b[_0x8e1f('0x3d')],qs[_0x8e1f('0x40')](_0x52d6b5[_0x8e1f('0x3e')]['fields']));_0x825c30[_0x8e1f('0x41')]=_0x825c30['attributes'][_0x8e1f('0x42')]?_0x825c30['attributes']:_0x31a69b['model'];if(!_0x52d6b5[_0x8e1f('0x3e')][_0x8e1f('0x43')](_0x8e1f('0x44'))){_0x825c30[_0x8e1f('0x29')]=qs[_0x8e1f('0x29')](_0x52d6b5[_0x8e1f('0x3e')][_0x8e1f('0x29')]);_0x825c30[_0x8e1f('0x27')]=qs['offset'](_0x52d6b5['query'][_0x8e1f('0x27')]);}_0x825c30[_0x8e1f('0x45')]=qs[_0x8e1f('0x46')](_0x52d6b5[_0x8e1f('0x3e')][_0x8e1f('0x46')]);_0x825c30['where']=qs['filters'](_[_0x8e1f('0x47')](_0x52d6b5[_0x8e1f('0x3e')],_0x31a69b['filters']),_0x18c4f4);if(_0x52d6b5[_0x8e1f('0x3e')][_0x8e1f('0x48')]){_0x825c30[_0x8e1f('0x49')]=_[_0x8e1f('0x4a')](_0x825c30['where'],{'$or':_[_0x8e1f('0x38')](_0x18c4f4,function(_0x391693){if(_0x391693[_0x8e1f('0x3c')]!==_0x8e1f('0x4b')){var _0x204fa2={};_0x204fa2[_0x391693['name']]={'$like':'%'+_0x52d6b5[_0x8e1f('0x3e')][_0x8e1f('0x48')]+'%'};return _0x204fa2;}})});}_0x825c30=_['merge']({},_0x825c30,_0x52d6b5['options']);var _0x23dc54={'where':_0x825c30[_0x8e1f('0x49')]};return db[_0x8e1f('0x39')][_0x8e1f('0x2a')](_0x23dc54)[_0x8e1f('0x19')](function(_0x19a42f){_0x4b2116[_0x8e1f('0x2a')]=_0x19a42f;if(_0x52d6b5['query'][_0x8e1f('0x4c')]){_0x825c30[_0x8e1f('0x4d')]=[{'all':!![]}];}return db['FaxAccount'][_0x8e1f('0x4e')](_0x825c30);})[_0x8e1f('0x19')](function(_0x262392){_0x4b2116['rows']=_0x262392;return _0x4b2116;})[_0x8e1f('0x19')](respondWithFilteredResult(_0x5072fe,_0x825c30))[_0x8e1f('0x22')](handleError(_0x5072fe,null));};exports['show']=function(_0x5e0b49,_0x4fff58){var _0x38900e={'raw':![],'where':{'id':_0x5e0b49[_0x8e1f('0x4f')]['id']},'include':[{'model':db[_0x8e1f('0x36')],'as':_0x8e1f('0x37')}]},_0x19c05e={};_0x19c05e[_0x8e1f('0x3d')]=_['keys'](db[_0x8e1f('0x39')][_0x8e1f('0x3a')]);_0x19c05e[_0x8e1f('0x3e')]=_[_0x8e1f('0x50')](_0x5e0b49['query']);_0x19c05e[_0x8e1f('0x51')]=_[_0x8e1f('0x3f')](_0x19c05e[_0x8e1f('0x3d')],_0x19c05e[_0x8e1f('0x3e')]);_0x38900e['attributes']=_[_0x8e1f('0x3f')](_0x19c05e[_0x8e1f('0x3d')],qs[_0x8e1f('0x40')](_0x5e0b49[_0x8e1f('0x3e')][_0x8e1f('0x40')]));_0x38900e['attributes']=_0x38900e['attributes'][_0x8e1f('0x42')]?_0x38900e[_0x8e1f('0x41')]:_0x19c05e['model'];if(_0x5e0b49['query']['includeAll']){_0x38900e['include']=[{'all':!![]}];}_0x38900e=_[_0x8e1f('0x4a')]({},_0x38900e,_0x5e0b49['options']);return db[_0x8e1f('0x39')]['find'](_0x38900e)['then'](handleEntityNotFound(_0x4fff58,null))[_0x8e1f('0x19')](respondWithResult(_0x4fff58,null))[_0x8e1f('0x22')](handleError(_0x4fff58,null));};exports['create']=function(_0x30abea,_0x280d68){return db['FaxAccount'][_0x8e1f('0x52')](_0x30abea[_0x8e1f('0x53')],{})[_0x8e1f('0x19')](function(_0x5e57fe){var _0x1dbdc1=_0x30abea[_0x8e1f('0x54')][_0x8e1f('0x31')]({'plain':!![]});if(!_0x1dbdc1)throw new Error(_0x8e1f('0x55'));if(_0x1dbdc1[_0x8e1f('0x56')]===_0x8e1f('0x54')){var _0x3e06e4=_0x5e57fe[_0x8e1f('0x31')]({'plain':!![]});var _0x4d3d6b=_0x8e1f('0x32');return db[_0x8e1f('0x57')][_0x8e1f('0x58')]({'where':{'name':_0x4d3d6b,'userProfileId':_0x1dbdc1['userProfileId']},'raw':!![]})[_0x8e1f('0x19')](function(_0x426762){if(_0x426762&&_0x426762[_0x8e1f('0x59')]===0x0){return db['UserProfileResource'][_0x8e1f('0x52')]({'name':_0x3e06e4[_0x8e1f('0x34')],'resourceId':_0x3e06e4['id'],'type':_0x426762[_0x8e1f('0x34')],'sectionId':_0x426762['id']},{})['then'](function(){return _0x5e57fe;});}else{return _0x5e57fe;}})['catch'](function(_0x86a20){logger[_0x8e1f('0x1f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x86a20);throw _0x86a20;});}return _0x5e57fe;})[_0x8e1f('0x19')](respondWithResult(_0x280d68,0xc9))[_0x8e1f('0x22')](handleError(_0x280d68,null));};exports[_0x8e1f('0x2f')]=function(_0x11e4c4,_0x1150a9){if(_0x11e4c4['body']['id']){delete _0x11e4c4['body']['id'];}return db[_0x8e1f('0x39')][_0x8e1f('0x58')]({'where':{'id':_0x11e4c4['params']['id']},'include':[{'model':db[_0x8e1f('0x36')],'as':_0x8e1f('0x37')}]})[_0x8e1f('0x19')](handleEntityNotFound(_0x1150a9,null))[_0x8e1f('0x19')](saveUpdates(_0x11e4c4[_0x8e1f('0x53')],null))[_0x8e1f('0x19')](respondWithResult(_0x1150a9,null))[_0x8e1f('0x22')](handleError(_0x1150a9,null));};exports[_0x8e1f('0x30')]=function(_0x328ebc,_0x4095f2){return db[_0x8e1f('0x39')][_0x8e1f('0x58')]({'where':{'id':_0x328ebc[_0x8e1f('0x4f')]['id']}})[_0x8e1f('0x19')](handleEntityNotFound(_0x4095f2,null))[_0x8e1f('0x19')](removeEntity(_0x4095f2,null))[_0x8e1f('0x22')](handleError(_0x4095f2,null));};exports[_0x8e1f('0x5a')]=function(_0x61f963,_0x55b1f6){return db['FaxAccount'][_0x8e1f('0x5a')]()[_0x8e1f('0x19')](respondWithResult(_0x55b1f6,null))[_0x8e1f('0x22')](handleError(_0x55b1f6,null));};exports[_0x8e1f('0x5b')]=function(_0x199cbc,_0x148f32,_0x158caa){if(_0x199cbc[_0x8e1f('0x53')]['id']){delete _0x199cbc[_0x8e1f('0x53')]['id'];}return db['FaxAccount'][_0x8e1f('0x58')]({'where':{'id':_0x199cbc['params']['id']}})['then'](handleEntityNotFound(_0x148f32,null))[_0x8e1f('0x19')](function(_0x3b9f5d){if(_0x3b9f5d){_0x199cbc[_0x8e1f('0x53')]['FaxAccountId']=_0x3b9f5d['id'];return db[_0x8e1f('0x5c')][_0x8e1f('0x52')](_0x199cbc[_0x8e1f('0x53')]);}})[_0x8e1f('0x19')](respondWithResult(_0x148f32,null))[_0x8e1f('0x22')](handleError(_0x148f32,null));};exports['getDispositions']=function(_0x590387,_0x5684e9,_0x542b1a){var _0x1a09c9={'raw':![],'where':{}};var _0x60992b={};var _0x3f8191={'count':0x0,'rows':[]};return db[_0x8e1f('0x39')][_0x8e1f('0x5d')]({'where':{'id':_0x590387['params']['id']}})[_0x8e1f('0x19')](handleEntityNotFound(_0x5684e9,null))[_0x8e1f('0x19')](function(_0x170339){if(_0x170339){_0x60992b['model']=_[_0x8e1f('0x50')](db['Disposition'][_0x8e1f('0x3a')]);_0x60992b[_0x8e1f('0x3e')]=_[_0x8e1f('0x50')](_0x590387['query']);_0x60992b[_0x8e1f('0x51')]=_[_0x8e1f('0x3f')](_0x60992b[_0x8e1f('0x3d')],_0x60992b[_0x8e1f('0x3e')]);_0x1a09c9[_0x8e1f('0x41')]=_[_0x8e1f('0x3f')](_0x60992b['model'],qs[_0x8e1f('0x40')](_0x590387[_0x8e1f('0x3e')][_0x8e1f('0x40')]));_0x1a09c9[_0x8e1f('0x41')]=_0x1a09c9[_0x8e1f('0x41')]['length']?_0x1a09c9[_0x8e1f('0x41')]:_0x60992b[_0x8e1f('0x3d')];if(!_0x590387[_0x8e1f('0x3e')]['hasOwnProperty'](_0x8e1f('0x44'))){_0x1a09c9[_0x8e1f('0x29')]=qs[_0x8e1f('0x29')](_0x590387[_0x8e1f('0x3e')][_0x8e1f('0x29')]);_0x1a09c9[_0x8e1f('0x27')]=qs['offset'](_0x590387[_0x8e1f('0x3e')][_0x8e1f('0x27')]);}_0x1a09c9[_0x8e1f('0x45')]=qs[_0x8e1f('0x46')](_0x590387[_0x8e1f('0x3e')]['sort']);_0x1a09c9['where']=qs[_0x8e1f('0x51')](_[_0x8e1f('0x47')](_0x590387[_0x8e1f('0x3e')],_0x60992b[_0x8e1f('0x51')]));_0x1a09c9[_0x8e1f('0x49')][_0x8e1f('0x5e')]=_0x170339['id'];if(_0x590387[_0x8e1f('0x3e')][_0x8e1f('0x48')]){_0x1a09c9['where']=_[_0x8e1f('0x4a')](_0x1a09c9[_0x8e1f('0x49')],{'$or':_['map'](_0x1a09c9[_0x8e1f('0x41')],function(_0x354e11){var _0x5379bc={};_0x5379bc[_0x354e11]={'$like':'%'+_0x590387['query'][_0x8e1f('0x48')]+'%'};return _0x5379bc;})});}_0x1a09c9=_[_0x8e1f('0x4a')]({},_0x1a09c9,_0x590387[_0x8e1f('0x5f')]);return db[_0x8e1f('0x5c')][_0x8e1f('0x2a')]({'where':_0x1a09c9[_0x8e1f('0x49')]})[_0x8e1f('0x19')](function(_0x3f5007){_0x3f8191[_0x8e1f('0x2a')]=_0x3f5007;if(_0x590387[_0x8e1f('0x3e')][_0x8e1f('0x4c')]){_0x1a09c9[_0x8e1f('0x4d')]=[{'all':!![]}];}return db[_0x8e1f('0x5c')]['findAll'](_0x1a09c9);})[_0x8e1f('0x19')](function(_0x3ba2ec){_0x3f8191[_0x8e1f('0x60')]=_0x3ba2ec;return _0x3f8191;});}})['then'](respondWithFilteredResult(_0x5684e9,_0x1a09c9))[_0x8e1f('0x22')](handleError(_0x5684e9,null));};exports[_0x8e1f('0x61')]=function(_0x30a47f,_0x3e036e,_0x2decef){return db[_0x8e1f('0x39')]['find']({'where':{'id':_0x30a47f[_0x8e1f('0x4f')]['id']}})[_0x8e1f('0x19')](handleEntityNotFound(_0x3e036e,null))['then'](function(_0xa13ada){if(_0xa13ada){return _0xa13ada[_0x8e1f('0x61')](_0x30a47f[_0x8e1f('0x3e')][_0x8e1f('0x62')]);}})[_0x8e1f('0x19')](respondWithStatusCode(_0x3e036e,null))['catch'](handleError(_0x3e036e,null));};exports[_0x8e1f('0x63')]=function(_0x3eb474,_0xca08bb,_0x50b313){if(_0x3eb474[_0x8e1f('0x53')]['id']){delete _0x3eb474['body']['id'];}return db['FaxAccount'][_0x8e1f('0x58')]({'where':{'id':_0x3eb474['params']['id']}})[_0x8e1f('0x19')](handleEntityNotFound(_0xca08bb,null))[_0x8e1f('0x19')](function(_0x3101d3){if(_0x3101d3){_0x3eb474['body'][_0x8e1f('0x5e')]=_0x3101d3['id'];return db['CannedAnswer'][_0x8e1f('0x52')](_0x3eb474['body']);}})[_0x8e1f('0x19')](respondWithResult(_0xca08bb,null))['catch'](handleError(_0xca08bb,null));};exports[_0x8e1f('0x64')]=function(_0x115fe2,_0x188f80,_0x41d867){var _0x5b501e={'raw':![],'where':{}};var _0x183037={};var _0x5b5d52={'count':0x0,'rows':[]};return db[_0x8e1f('0x39')][_0x8e1f('0x5d')]({'where':{'id':_0x115fe2[_0x8e1f('0x4f')]['id']}})[_0x8e1f('0x19')](handleEntityNotFound(_0x188f80,null))[_0x8e1f('0x19')](function(_0x42b71f){if(_0x42b71f){_0x183037[_0x8e1f('0x3d')]=_[_0x8e1f('0x50')](db[_0x8e1f('0x65')][_0x8e1f('0x3a')]);_0x183037[_0x8e1f('0x3e')]=_['keys'](_0x115fe2[_0x8e1f('0x3e')]);_0x183037[_0x8e1f('0x51')]=_[_0x8e1f('0x3f')](_0x183037['model'],_0x183037[_0x8e1f('0x3e')]);_0x5b501e['attributes']=_[_0x8e1f('0x3f')](_0x183037[_0x8e1f('0x3d')],qs['fields'](_0x115fe2[_0x8e1f('0x3e')][_0x8e1f('0x40')]));_0x5b501e[_0x8e1f('0x41')]=_0x5b501e[_0x8e1f('0x41')][_0x8e1f('0x42')]?_0x5b501e['attributes']:_0x183037[_0x8e1f('0x3d')];if(!_0x115fe2[_0x8e1f('0x3e')]['hasOwnProperty'](_0x8e1f('0x44'))){_0x5b501e['limit']=qs[_0x8e1f('0x29')](_0x115fe2['query'][_0x8e1f('0x29')]);_0x5b501e[_0x8e1f('0x27')]=qs[_0x8e1f('0x27')](_0x115fe2['query'][_0x8e1f('0x27')]);}_0x5b501e['order']=qs[_0x8e1f('0x46')](_0x115fe2[_0x8e1f('0x3e')][_0x8e1f('0x46')]);_0x5b501e[_0x8e1f('0x49')]=qs[_0x8e1f('0x51')](_[_0x8e1f('0x47')](_0x115fe2['query'],_0x183037[_0x8e1f('0x51')]));_0x5b501e['where']['FaxAccountId']=_0x42b71f['id'];if(_0x115fe2['query'][_0x8e1f('0x48')]){_0x5b501e[_0x8e1f('0x49')]=_[_0x8e1f('0x4a')](_0x5b501e[_0x8e1f('0x49')],{'$or':_[_0x8e1f('0x38')](_0x5b501e[_0x8e1f('0x41')],function(_0x5415e1){var _0x1ab600={};_0x1ab600[_0x5415e1]={'$like':'%'+_0x115fe2['query'][_0x8e1f('0x48')]+'%'};return _0x1ab600;})});}_0x5b501e=_[_0x8e1f('0x4a')]({},_0x5b501e,_0x115fe2[_0x8e1f('0x5f')]);return db[_0x8e1f('0x65')][_0x8e1f('0x2a')]({'where':_0x5b501e[_0x8e1f('0x49')]})['then'](function(_0x1f8dfc){_0x5b5d52[_0x8e1f('0x2a')]=_0x1f8dfc;if(_0x115fe2[_0x8e1f('0x3e')][_0x8e1f('0x4c')]){_0x5b501e[_0x8e1f('0x4d')]=[{'all':!![]}];}return db[_0x8e1f('0x65')][_0x8e1f('0x4e')](_0x5b501e);})[_0x8e1f('0x19')](function(_0x5f5053){_0x5b5d52[_0x8e1f('0x60')]=_0x5f5053;return _0x5b5d52;});}})[_0x8e1f('0x19')](respondWithFilteredResult(_0x188f80,_0x5b501e))[_0x8e1f('0x22')](handleError(_0x188f80,null));};exports['removeAnswers']=function(_0xcaeac9,_0x9ce3c9,_0x53130d){return db['FaxAccount'][_0x8e1f('0x58')]({'where':{'id':_0xcaeac9['params']['id']}})['then'](handleEntityNotFound(_0x9ce3c9,null))['then'](function(_0x3d68a1){if(_0x3d68a1){return _0x3d68a1['removeAnswers'](_0xcaeac9[_0x8e1f('0x3e')]['ids']);}})[_0x8e1f('0x19')](respondWithStatusCode(_0x9ce3c9,null))['catch'](handleError(_0x9ce3c9,null));};exports[_0x8e1f('0x66')]=function(_0x5526eb,_0xa466fc,_0x3390e3){return db[_0x8e1f('0x67')][_0x8e1f('0x58')]({'where':{'id':_0x5526eb[_0x8e1f('0x4f')]['id']}})[_0x8e1f('0x19')](handleEntityNotFound(_0xa466fc,null))[_0x8e1f('0x19')](function(_0x161931){if(_0x161931){return _0x161931[_0x8e1f('0x66')](_0x5526eb[_0x8e1f('0x53')]['ids'],_[_0x8e1f('0x68')](_0x5526eb[_0x8e1f('0x53')],[_0x8e1f('0x62'),'id'])||{});}})[_0x8e1f('0x19')](respondWithResult(_0xa466fc,null))[_0x8e1f('0x22')](handleError(_0xa466fc,null));};exports['getInteractions']=function(_0xa45fbe,_0x2f1d27,_0x424e69){var _0x5914c1={'raw':![],'where':{}};var _0x56b179={};var _0x2579b4={'count':0x0,'rows':[]};return db[_0x8e1f('0x39')]['findOne']({'where':{'id':_0xa45fbe['params']['id']}})[_0x8e1f('0x19')](handleEntityNotFound(_0x2f1d27,null))[_0x8e1f('0x19')](function(_0x3026c2){if(_0x3026c2){_0x56b179[_0x8e1f('0x3d')]=_['keys'](db[_0x8e1f('0x67')][_0x8e1f('0x3a')]);_0x56b179['query']=_[_0x8e1f('0x50')](_0xa45fbe[_0x8e1f('0x3e')]);_0x56b179[_0x8e1f('0x51')]=_['intersection'](_0x56b179[_0x8e1f('0x3d')],_0x56b179[_0x8e1f('0x3e')]);_0x5914c1['attributes']=_[_0x8e1f('0x3f')](_0x56b179[_0x8e1f('0x3d')],qs['fields'](_0xa45fbe[_0x8e1f('0x3e')]['fields']));_0x5914c1[_0x8e1f('0x41')]=_0x5914c1['attributes'][_0x8e1f('0x42')]?_0x5914c1[_0x8e1f('0x41')]:_0x56b179['model'];if(!_0xa45fbe['query'][_0x8e1f('0x43')]('nolimit')){_0x5914c1['limit']=qs[_0x8e1f('0x29')](_0xa45fbe[_0x8e1f('0x3e')][_0x8e1f('0x29')]);_0x5914c1[_0x8e1f('0x27')]=qs['offset'](_0xa45fbe[_0x8e1f('0x3e')][_0x8e1f('0x27')]);}_0x5914c1[_0x8e1f('0x45')]=qs[_0x8e1f('0x46')](_0xa45fbe['query']['sort']);_0x5914c1['where']=qs[_0x8e1f('0x51')](_[_0x8e1f('0x47')](_0xa45fbe[_0x8e1f('0x3e')],_0x56b179[_0x8e1f('0x51')]));_0x5914c1['where'][_0x8e1f('0x5e')]=_0x3026c2['id'];if(_0xa45fbe['query'][_0x8e1f('0x48')]){_0x5914c1[_0x8e1f('0x49')]=_[_0x8e1f('0x4a')](_0x5914c1[_0x8e1f('0x49')],{'$or':_[_0x8e1f('0x38')](_0x5914c1['attributes'],function(_0x26f5e7){var _0x23c2fc={};_0x23c2fc[_0x26f5e7]={'$like':'%'+_0xa45fbe['query'][_0x8e1f('0x48')]+'%'};return _0x23c2fc;})});}_0x5914c1=_['merge']({},_0x5914c1,_0xa45fbe[_0x8e1f('0x5f')]);return db[_0x8e1f('0x67')][_0x8e1f('0x2a')]({'where':_0x5914c1[_0x8e1f('0x49')]})[_0x8e1f('0x19')](function(_0x3539e5){_0x2579b4['count']=_0x3539e5;if(_0xa45fbe[_0x8e1f('0x3e')][_0x8e1f('0x4c')]){_0x5914c1[_0x8e1f('0x4d')]=[{'model':db[_0x8e1f('0x69')],'as':'Contact','required':![]},{'model':db[_0x8e1f('0x6a')],'as':_0x8e1f('0x6b'),'attributes':[_0x8e1f('0x34'),_0x8e1f('0x6c'),_0x8e1f('0x6d')],'required':![]},{'model':db[_0x8e1f('0x6e')],'as':'Tags','attributes':['id',_0x8e1f('0x34'),'color'],'where':_0xa45fbe[_0x8e1f('0x3e')][_0x8e1f('0x6f')]?{'id':_0xa45fbe[_0x8e1f('0x3e')]['tag']}:undefined,'required':_0xa45fbe['query'][_0x8e1f('0x6f')]?!![]:![]}];}return db[_0x8e1f('0x67')][_0x8e1f('0x4e')](_0x5914c1);})[_0x8e1f('0x19')](function(_0x9e9e15){_0x2579b4['rows']=_0x9e9e15;return _0x2579b4;});}})[_0x8e1f('0x19')](respondWithFilteredResult(_0x2f1d27,_0x5914c1))[_0x8e1f('0x22')](handleError(_0x2f1d27,null));};exports[_0x8e1f('0x70')]=function(_0x3974ce,_0x13f878){var _0xdc9404=_0x3974ce[_0x8e1f('0x4f')]['id'];var _0x4323a8=_0x3974ce[_0x8e1f('0x53')];var _0x15b498=0xc8;var _0x2f012d=null;return db['sequelize'][_0x8e1f('0x71')]({'isolationLevel':db[_0x8e1f('0x72')][_0x8e1f('0x73')]['ISOLATION_LEVELS'][_0x8e1f('0x74')]},function(_0x3c6bc9){return db[_0x8e1f('0x39')][_0x8e1f('0x5d')]({'where':{'id':_0xdc9404},'transaction':_0x3c6bc9})[_0x8e1f('0x19')](function(_0x163346){if(_0x163346){return db[_0x8e1f('0x75')][_0x8e1f('0x30')]({'where':{'FaxAccountId':_0xdc9404},'transaction':_0x3c6bc9})['then'](function(){var _0x302bd6=_[_0x8e1f('0x38')](_0x4323a8,function(_0x5f0625){_0x5f0625[_0x8e1f('0x5e')]=_0xdc9404;return _0x5f0625;});return db['FaxApplication'][_0x8e1f('0x76')](_0x302bd6,{'transaction':_0x3c6bc9});});}else{_0x15b498=0x194;_0x2f012d=[];}});})[_0x8e1f('0x19')](function(){if(_0x15b498!==0x194){return db[_0x8e1f('0x75')][_0x8e1f('0x77')]({'where':{'FaxAccountId':_0xdc9404},'order':'priority'})[_0x8e1f('0x19')](function(_0x2223d8){_0x2f012d=_0x2223d8;});}})['catch'](function(_0x45138c){_0x15b498=0x1f4;logger[_0x8e1f('0x1f')](_0x45138c[_0x8e1f('0x33')]);if(_0x45138c[_0x8e1f('0x34')]){delete _0x45138c[_0x8e1f('0x34')];}_0x2f012d=_0x45138c;})[_0x8e1f('0x78')](function(){if(_0x2f012d===null){_0x13f878['sendStatus'](_0x15b498);}else{if(_0x15b498===0x1f4){_0x13f878[_0x8e1f('0x24')](_0x15b498)['send'](_0x2f012d);}else{_0x13f878[_0x8e1f('0x24')](_0x15b498)['json'](_0x2f012d);}}});};exports['getApplications']=function(_0x48a9cb,_0x310a98,_0x334ba0){var _0xb533c4={};var _0x4fafbb={};var _0x5d93bb;var _0x1d2027;return db[_0x8e1f('0x39')][_0x8e1f('0x5d')]({'where':{'id':_0x48a9cb['params']['id']}})[_0x8e1f('0x19')](handleEntityNotFound(_0x310a98,null))['then'](function(_0x5a1583){if(_0x5a1583){_0x5d93bb=_0x5a1583;_0x4fafbb['model']=_['keys'](db[_0x8e1f('0x75')][_0x8e1f('0x3a')]);_0x4fafbb[_0x8e1f('0x3e')]=_[_0x8e1f('0x50')](_0x48a9cb[_0x8e1f('0x3e')]);_0x4fafbb['filters']=_[_0x8e1f('0x3f')](_0x4fafbb[_0x8e1f('0x3d')],_0x4fafbb['query']);_0xb533c4[_0x8e1f('0x41')]=_[_0x8e1f('0x3f')](_0x4fafbb[_0x8e1f('0x3d')],qs[_0x8e1f('0x40')](_0x48a9cb[_0x8e1f('0x3e')][_0x8e1f('0x40')]));_0xb533c4['attributes']=_0xb533c4[_0x8e1f('0x41')][_0x8e1f('0x42')]?_0xb533c4[_0x8e1f('0x41')]:_0x4fafbb[_0x8e1f('0x3d')];_0xb533c4[_0x8e1f('0x45')]=qs[_0x8e1f('0x46')](_0x48a9cb[_0x8e1f('0x3e')]['sort']);_0xb533c4[_0x8e1f('0x49')]=qs[_0x8e1f('0x51')](_[_0x8e1f('0x47')](_0x48a9cb[_0x8e1f('0x3e')],_0x4fafbb[_0x8e1f('0x51')]));if(_0x48a9cb[_0x8e1f('0x3e')][_0x8e1f('0x48')]){_0xb533c4[_0x8e1f('0x49')]=_[_0x8e1f('0x4a')](_0xb533c4[_0x8e1f('0x49')],{'$or':_[_0x8e1f('0x38')](_0xb533c4[_0x8e1f('0x41')],function(_0x163a0b){var _0x7c8384={};_0x7c8384[_0x163a0b]={'$like':'%'+_0x48a9cb[_0x8e1f('0x3e')][_0x8e1f('0x48')]+'%'};return _0x7c8384;})});}_0xb533c4=_[_0x8e1f('0x4a')]({},_0xb533c4,_0x48a9cb[_0x8e1f('0x5f')]);return _0x5d93bb['getApplications'](_0xb533c4);}})[_0x8e1f('0x19')](function(_0x1e8597){if(_0x1e8597){_0x1d2027=_0x1e8597[_0x8e1f('0x42')];if(!_0x48a9cb[_0x8e1f('0x3e')]['hasOwnProperty'](_0x8e1f('0x44'))){_0xb533c4[_0x8e1f('0x29')]=qs[_0x8e1f('0x29')](_0x48a9cb[_0x8e1f('0x3e')][_0x8e1f('0x29')]);_0xb533c4['offset']=qs[_0x8e1f('0x27')](_0x48a9cb['query'][_0x8e1f('0x27')]);}return _0x5d93bb[_0x8e1f('0x79')](_0xb533c4);}})[_0x8e1f('0x19')](function(_0x26511a){if(_0x26511a){return _0x26511a?{'count':_0x1d2027,'rows':_0x26511a}:null;}})[_0x8e1f('0x19')](respondWithResult(_0x310a98,null))[_0x8e1f('0x22')](handleError(_0x310a98,null));};function Extension(_0x2cbc2e,_0x59b039,_0xf29ee4,_0x29eb36){this[_0x8e1f('0x7a')]='from-voip-provider';this[_0x8e1f('0x7b')]=_0x2cbc2e[_0x8e1f('0x7c')];this[_0x8e1f('0x7d')]=_0x29eb36;this[_0x8e1f('0x3c')]='system';this['description']=_0x8e1f('0x7e');this[_0x8e1f('0x5e')]=_0x2cbc2e['id'];this[_0x8e1f('0x7f')]=_0x59b039;this[_0x8e1f('0x80')]=_0xf29ee4;}function createExtensionsReciveFax(_0x5a6bdc){var _0x46ade8=0x1;var _0x1bad60=[];_0x1bad60[_0x8e1f('0x81')](new Extension(_0x5a6bdc,_0x46ade8,'','Answer'));_0x46ade8+=0x1;_0x1bad60[_0x8e1f('0x81')](new Extension(_0x5a6bdc,_0x46ade8,'CDR(type)=inbound-fax',_0x8e1f('0x82')));_0x46ade8+=0x1;for(var _0x12dd7b in _0x5a6bdc){if(_0x5a6bdc[_0x8e1f('0x43')](_0x12dd7b)&&(_0x12dd7b===_0x8e1f('0x83')||_0x12dd7b===_0x8e1f('0x7c')||_0x12dd7b===_0x8e1f('0x84')||_0x12dd7b==='faxdetect'||_0x12dd7b===_0x8e1f('0x85')||_0x12dd7b===_0x8e1f('0x86')||_0x12dd7b===_0x8e1f('0x87')||_0x12dd7b===_0x8e1f('0x88')||_0x12dd7b===_0x8e1f('0x89'))){_0x1bad60[_0x8e1f('0x81')](new Extension(_0x5a6bdc,_0x46ade8,'FAXOPT('+_0x12dd7b+')='+_0x5a6bdc[_0x12dd7b],'Set'));_0x46ade8+=0x1;}}_0x1bad60['push'](new Extension(_0x5a6bdc,_0x46ade8,'6',_0x8e1f('0x8a')));_0x46ade8+=0x1;_0x1bad60['push'](new Extension(_0x5a6bdc,_0x46ade8,_0x8e1f('0x8b'),_0x8e1f('0x8c')));_0x46ade8=0x0;return _0x1bad60;}exports[_0x8e1f('0x8d')]=function(_0xb63e05,_0x42a3a2,_0x15a890){var _0x333e4a;return db['sequelize'][_0x8e1f('0x71')](function(_0x3f27da){return db['FaxAccount']['create'](_0xb63e05[_0x8e1f('0x53')],{'transaction':_0x3f27da})[_0x8e1f('0x19')](function(_0xb5c637){_0x333e4a=_0xb5c637[_0x8e1f('0x31')]({'plain':!![]});return db['VoiceExtension']['bulkCreate'](createExtensionsReciveFax(_0x333e4a),{'transaction':_0x3f27da});});})[_0x8e1f('0x19')](function(){return _0x333e4a;})[_0x8e1f('0x19')](respondWithResult(_0x42a3a2,null))[_0x8e1f('0x22')](handleError(_0x42a3a2,null));};exports['updateAccountApplications']=function(_0x5b4c0a,_0x3cfbca,_0x5dac2e){var _0x3d63d7;return db[_0x8e1f('0x72')][_0x8e1f('0x71')](function(_0x320f02){return db[_0x8e1f('0x39')]['update'](_0x5b4c0a['body'],{'where':{'id':_0x5b4c0a[_0x8e1f('0x53')]['id']},'transaction':_0x320f02})[_0x8e1f('0x19')](function(_0x3b5d9c){return db[_0x8e1f('0x8e')][_0x8e1f('0x30')]({'where':{'FaxAccountId':_0x5b4c0a[_0x8e1f('0x53')]['id']},'transaction':_0x320f02})[_0x8e1f('0x19')](function(_0x1dd15a){return db[_0x8e1f('0x8e')][_0x8e1f('0x76')](createExtensionsReciveFax(_[_0x8e1f('0x68')](_0x5b4c0a['body'],['tech','key',_0x8e1f('0x8f'),_0x8e1f('0x90'),'TrunkId',_0x8e1f('0x91')])),{'transaction':_0x320f02});});});})['then'](function(){return db[_0x8e1f('0x39')][_0x8e1f('0x92')](_0x5b4c0a[_0x8e1f('0x53')]['id']);})[_0x8e1f('0x19')](respondWithResult(_0x3cfbca,null))[_0x8e1f('0x22')](handleError(_0x3cfbca,null));};exports[_0x8e1f('0x93')]=function(_0x5a81aa,_0x25ad34,_0x511c57){var _0x1f7e59={'raw':!![],'where':{}};var _0x409f92={};var _0x18de4e={'count':0x0,'rows':[]};return db['FaxAccount'][_0x8e1f('0x5d')]({'where':{'id':_0x5a81aa[_0x8e1f('0x4f')]['id']}})[_0x8e1f('0x19')](handleEntityNotFound(_0x25ad34,null))['then'](function(_0x2c640f){if(_0x2c640f){_0x409f92[_0x8e1f('0x3d')]=_[_0x8e1f('0x50')](db['FaxMessage']['rawAttributes']);_0x409f92[_0x8e1f('0x3e')]=_['keys'](_0x5a81aa[_0x8e1f('0x3e')]);_0x409f92[_0x8e1f('0x51')]=_[_0x8e1f('0x3f')](_0x409f92[_0x8e1f('0x3d')],_0x409f92[_0x8e1f('0x3e')]);_0x1f7e59[_0x8e1f('0x41')]=_['intersection'](_0x409f92[_0x8e1f('0x3d')],qs[_0x8e1f('0x40')](_0x5a81aa[_0x8e1f('0x3e')]['fields']));_0x1f7e59[_0x8e1f('0x41')]=_0x1f7e59[_0x8e1f('0x41')][_0x8e1f('0x42')]?_0x1f7e59[_0x8e1f('0x41')]:_0x409f92[_0x8e1f('0x3d')];if(!_0x5a81aa[_0x8e1f('0x3e')][_0x8e1f('0x43')](_0x8e1f('0x44'))){_0x1f7e59[_0x8e1f('0x29')]=qs[_0x8e1f('0x29')](_0x5a81aa['query'][_0x8e1f('0x29')]);_0x1f7e59[_0x8e1f('0x27')]=qs[_0x8e1f('0x27')](_0x5a81aa[_0x8e1f('0x3e')]['offset']);}_0x1f7e59[_0x8e1f('0x45')]=qs[_0x8e1f('0x46')](_0x5a81aa[_0x8e1f('0x3e')][_0x8e1f('0x46')]);_0x1f7e59[_0x8e1f('0x49')]=qs['filters'](_[_0x8e1f('0x47')](_0x5a81aa[_0x8e1f('0x3e')],_0x409f92['filters']));_0x1f7e59[_0x8e1f('0x49')][_0x8e1f('0x5e')]=_0x2c640f['id'];if(_0x5a81aa['query'][_0x8e1f('0x48')]){_0x1f7e59['where']=_['merge'](_0x1f7e59[_0x8e1f('0x49')],{'$or':_[_0x8e1f('0x38')](_0x1f7e59['attributes'],function(_0x46d1ff){var _0xd74e87={};_0xd74e87[_0x46d1ff]={'$like':'%'+_0x5a81aa[_0x8e1f('0x3e')][_0x8e1f('0x48')]+'%'};return _0xd74e87;})});}if(_0x5a81aa[_0x8e1f('0x3e')][_0x8e1f('0x94')]){var _0x1462c0=_0x5a81aa['query']['$gte'][_0x8e1f('0x95')](',');var _0x539709={};_0x539709[_0x1462c0[0x0]]={'$gte':moment(_0x1462c0[0x1])[_0x8e1f('0x96')](_0x8e1f('0x97'))};_0x1f7e59[_0x8e1f('0x49')]=_[_0x8e1f('0x4a')](_0x1f7e59[_0x8e1f('0x49')],_0x539709);}_0x1f7e59=_[_0x8e1f('0x4a')]({},_0x1f7e59,_0x5a81aa['options']);return db[_0x8e1f('0x98')][_0x8e1f('0x2a')]({'where':_0x1f7e59['where']})[_0x8e1f('0x19')](function(_0x3c735a){_0x18de4e[_0x8e1f('0x2a')]=_0x3c735a;if(_0x5a81aa['query'][_0x8e1f('0x4c')]){_0x1f7e59[_0x8e1f('0x4d')]=[{'all':!![]}];}return db[_0x8e1f('0x98')][_0x8e1f('0x4e')](_0x1f7e59);})['then'](function(_0x4fa0aa){_0x18de4e[_0x8e1f('0x60')]=_0x4fa0aa;return _0x18de4e;});}})[_0x8e1f('0x19')](respondWithFilteredResult(_0x25ad34,_0x1f7e59))[_0x8e1f('0x22')](handleError(_0x25ad34,null));};exports[_0x8e1f('0x99')]=function(_0x16db9f,_0xb8c1b4,_0x5d6767){var _0x52d0b9,_0x1da3ce={},_0x251139;if(_0x16db9f[_0x8e1f('0x53')]['to']){_0x251139=_0x16db9f[_0x8e1f('0x53')]['to'][0x0];}return db['FaxAccount'][_0x8e1f('0x58')]({'where':{'id':_0x16db9f[_0x8e1f('0x4f')]['id']},'include':[{'model':db[_0x8e1f('0x9a')],'as':_0x8e1f('0x9b'),'include':[{'model':db['CmContact'],'as':_0x8e1f('0x9c'),'where':{'fax':_0x251139},'limit':0x1,'order':[[_0x8e1f('0x90'),'DESC']]}]}]})['then'](handleEntityNotFound(_0xb8c1b4,null))[_0x8e1f('0x19')](function(_0x1a262d){_0x52d0b9=_0x1a262d;if(_0x16db9f[_0x8e1f('0x53')]['attachments']&&_0x16db9f[_0x8e1f('0x53')][_0x8e1f('0x9d')][_0x8e1f('0x42')]){for(var _0x52f7bd=0x0;_0x52f7bd<_0x16db9f[_0x8e1f('0x53')][_0x8e1f('0x9d')][_0x8e1f('0x42')];_0x52f7bd+=0x1){_0x16db9f[_0x8e1f('0x53')][_0x8e1f('0x9d')][_0x52f7bd]={'filename':_0x16db9f[_0x8e1f('0x53')][_0x8e1f('0x9d')][_0x52f7bd][_0x8e1f('0x34')],'id':_0x16db9f[_0x8e1f('0x53')][_0x8e1f('0x9d')][_0x52f7bd]['id'],'path':path[_0x8e1f('0x9e')](config[_0x8e1f('0x9f')],_0x8e1f('0xa0'),_0x16db9f['body'][_0x8e1f('0x9d')][_0x52f7bd][_0x8e1f('0xa1')])};}}return respondWithRpcPromise(_0x8e1f('0xa2'),_0x8e1f('0xa2'),{'FaxAccountId':_[_0x8e1f('0xa3')](_0x16db9f[_0x8e1f('0x4f')]['id'])?undefined:_0x16db9f[_0x8e1f('0x4f')]['id'],'path':_[_0x8e1f('0xa3')](_0x16db9f[_0x8e1f('0x53')][_0x8e1f('0x9d')][0x0][_0x8e1f('0x7')])?undefined:_0x16db9f[_0x8e1f('0x53')][_0x8e1f('0x9d')][0x0][_0x8e1f('0x7')],'fax':_[_0x8e1f('0xa3')](_0x16db9f[_0x8e1f('0x53')]['to'][0x0])?undefined:_0x16db9f[_0x8e1f('0x53')]['to'][0x0]},client9002);})['then'](function(){if(_0x52d0b9){if(_[_0x8e1f('0xa3')](_0x16db9f[_0x8e1f('0x53')]['from'])){_0x16db9f['body']['from']=util['format']('\x22%s\x22\x20<%s>',_0x52d0b9['name'],_0x52d0b9[_0x8e1f('0xa4')]);}if(_0x52d0b9[_0x8e1f('0x9b')]){if(_0x52d0b9[_0x8e1f('0x9b')][_0x8e1f('0x9c')][_0x8e1f('0x42')]){return _0x52d0b9[_0x8e1f('0x9b')]['Contacts'][0x0];}else{return db[_0x8e1f('0x69')]['create'](_[_0x8e1f('0x12')](_0x16db9f[_0x8e1f('0x53')],{'firstName':_0x16db9f[_0x8e1f('0x53')]['to'][0x0],'phone':_0x16db9f[_0x8e1f('0x53')]['to'][0x0],'fax':_0x16db9f[_0x8e1f('0x53')]['to'][0x0],'ListId':_0x52d0b9[_0x8e1f('0x91')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error(_0x8e1f('0xa5'));}})['then'](function(_0x3264dd){if(_0x3264dd){return db['FaxInteraction'][_0x8e1f('0x58')]({'where':{'ContactId':_0x3264dd['id'],'closed':![],'FaxAccountId':_0x52d0b9['id']}})['then'](function(_0x3bfd1a){if(_0x3bfd1a){return[_0x3bfd1a,![]];}return db[_0x8e1f('0x67')][_0x8e1f('0x52')]({'UserId':_0x16db9f[_0x8e1f('0x54')]['id'],'ContactId':_0x3264dd['id'],'FaxAccountId':_0x52d0b9['id'],'fax':_0x16db9f[_0x8e1f('0x53')]['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0x8e1f('0x4a')](_0x16db9f[_0x8e1f('0x53')],{'read':![],'body':_0x16db9f[_0x8e1f('0x53')]['attachments'][0x0][_0x8e1f('0xa6')],'FaxAccountId':_0x52d0b9['id'],'UserId':_0x16db9f[_0x8e1f('0x54')]['id'],'ContactId':_0x3264dd['id'],'AttachmentId':_0x16db9f['body']['attachments'][0x0]['id']})]},{'include':[{'model':db[_0x8e1f('0x98')],'as':'Messages'}]})['then'](function(_0x8206a2){return[_0x8206a2,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x8e1f('0xa7')](function(_0x493208,_0xd1b1be){if(_0xd1b1be){return _0x493208;}return db[_0x8e1f('0x98')][_0x8e1f('0x52')]({'direction':_0x8e1f('0xa8'),'read':![],'body':_0x16db9f['body']['attachments'][0x0]['filename'],'FaxAccountId':_0x52d0b9['id'],'FaxInteractionId':_0x493208['id'],'UserId':_0x16db9f[_0x8e1f('0x54')]['id'],'ContactId':_0x493208['ContactId'],'AttachmentId':_0x16db9f[_0x8e1f('0x53')][_0x8e1f('0x9d')][0x0]['id']})[_0x8e1f('0x19')](function(_0x11c648){_0x493208['dataValues'][_0x8e1f('0xa9')]=[];_0x493208[_0x8e1f('0xaa')][_0x8e1f('0xa9')][_0x8e1f('0x81')](_0x11c648[_0x8e1f('0xaa')]);return _0x493208;});})[_0x8e1f('0x19')](function(_0x66e8d5){respondWithRpcPromise(_0x8e1f('0xab'),_0x8e1f('0xab'),{'FaxAccountId':_[_0x8e1f('0xa3')](_0x16db9f[_0x8e1f('0x4f')]['id'])?undefined:_0x16db9f[_0x8e1f('0x4f')]['id'],'path':_[_0x8e1f('0xa3')](_0x16db9f[_0x8e1f('0x53')][_0x8e1f('0x9d')][0x0][_0x8e1f('0x7')])?undefined:_0x16db9f[_0x8e1f('0x53')][_0x8e1f('0x9d')][0x0][_0x8e1f('0x7')],'fax':_[_0x8e1f('0xa3')](_0x16db9f[_0x8e1f('0x53')]['to'][0x0])?undefined:_0x16db9f[_0x8e1f('0x53')]['to'][0x0],'AttachmentId':_0x16db9f[_0x8e1f('0x53')][_0x8e1f('0x9d')][0x0]['id']},client9002)[_0x8e1f('0x19')](function(_0x55618e){logger[_0x8e1f('0xac')]('SendFaxRpc,\x20%s',_0x55618e);})[_0x8e1f('0x22')](function(_0x45a06a){logger[_0x8e1f('0xac')](_0x8e1f('0xad'),_0x45a06a);});return _0x66e8d5;})[_0x8e1f('0x19')](respondWithResult(_0xb8c1b4,null))['catch'](handleError(_0xb8c1b4,null));};exports[_0x8e1f('0xae')]=function(_0x4c43e2,_0x2825e4,_0x346e45){return db[_0x8e1f('0x39')]['find']({'where':{'id':_0x4c43e2[_0x8e1f('0x4f')]['id']}})[_0x8e1f('0x19')](handleEntityNotFound(_0x2825e4,null))['then'](function(_0x3a468a){if(_0x3a468a){return _0x3a468a[_0x8e1f('0xae')](_0x4c43e2['body'][_0x8e1f('0x62')],_[_0x8e1f('0x68')](_0x4c43e2['body'],['ids','id'])||{})['spread'](function(_0x589532){for(var _0x45d9a5=0x0;_0x45d9a5<_0x4c43e2[_0x8e1f('0x53')]['ids'][_0x8e1f('0x42')];_0x45d9a5+=0x1){socket['emit'](_0x8e1f('0xaf'),{'UserId':Number(_0x4c43e2['body'][_0x8e1f('0x62')][_0x45d9a5]),'FaxAccountId':Number(_0x4c43e2['params']['id'])});}return _0x589532;});}})[_0x8e1f('0x19')](respondWithResult(_0x2825e4,null))[_0x8e1f('0x22')](handleError(_0x2825e4,null));};exports[_0x8e1f('0xb0')]=function(_0x1e0dd7,_0x36af85,_0x272048){return db[_0x8e1f('0x39')][_0x8e1f('0x58')]({'where':{'id':_0x1e0dd7[_0x8e1f('0x4f')]['id']}})[_0x8e1f('0x19')](handleEntityNotFound(_0x36af85,null))[_0x8e1f('0x19')](function(_0x2f81df){if(_0x2f81df){return _0x2f81df['removeAgents'](_0x1e0dd7[_0x8e1f('0x3e')][_0x8e1f('0x62')])[_0x8e1f('0x19')](function(){if(_[_0x8e1f('0xb1')](_0x1e0dd7[_0x8e1f('0x3e')]['ids'])){for(var _0x149191=0x0;_0x149191<_0x1e0dd7[_0x8e1f('0x3e')]['ids'][_0x8e1f('0x42')];_0x149191+=0x1){socket[_0x8e1f('0xb2')]('userFaxAccount:remove',{'UserId':Number(_0x1e0dd7[_0x8e1f('0x3e')]['ids'][_0x149191]),'FaxAccountId':Number(_0x1e0dd7['params']['id'])});}}else{socket[_0x8e1f('0xb2')](_0x8e1f('0xb3'),{'UserId':Number(_0x1e0dd7[_0x8e1f('0x3e')][_0x8e1f('0x62')]),'FaxAccountId':Number(_0x1e0dd7[_0x8e1f('0x4f')]['id'])});}});}})[_0x8e1f('0x19')](respondWithStatusCode(_0x36af85,null))[_0x8e1f('0x22')](handleError(_0x36af85,null));};exports['getAgents']=function(_0x529019,_0x526dad,_0x165f01){var _0x2515a5={};var _0x57c4f3={};var _0x53d001;var _0x5a8dfc;return db[_0x8e1f('0x39')][_0x8e1f('0x5d')]({'where':{'id':_0x529019[_0x8e1f('0x4f')]['id']}})[_0x8e1f('0x19')](handleEntityNotFound(_0x526dad,null))['then'](function(_0x2c72cc){if(_0x2c72cc){_0x53d001=_0x2c72cc;_0x57c4f3[_0x8e1f('0x3d')]=_[_0x8e1f('0x50')](db[_0x8e1f('0x6a')][_0x8e1f('0x3a')]);_0x57c4f3[_0x8e1f('0x3e')]=_[_0x8e1f('0x50')](_0x529019[_0x8e1f('0x3e')]);_0x57c4f3[_0x8e1f('0x51')]=_['intersection'](_0x57c4f3[_0x8e1f('0x3d')],_0x57c4f3['query']);_0x2515a5[_0x8e1f('0x41')]=_[_0x8e1f('0x3f')](_0x57c4f3[_0x8e1f('0x3d')],qs[_0x8e1f('0x40')](_0x529019['query']['fields']));_0x2515a5['attributes']=_0x2515a5[_0x8e1f('0x41')][_0x8e1f('0x42')]?_0x2515a5[_0x8e1f('0x41')]:_0x57c4f3[_0x8e1f('0x3d')];_0x2515a5[_0x8e1f('0x45')]=qs['sort'](_0x529019[_0x8e1f('0x3e')]['sort']);_0x2515a5['where']=qs[_0x8e1f('0x51')](_[_0x8e1f('0x47')](_0x529019['query'],_0x57c4f3[_0x8e1f('0x51')]));if(_0x529019[_0x8e1f('0x3e')][_0x8e1f('0x48')]){_0x2515a5[_0x8e1f('0x49')]=_['merge'](_0x2515a5[_0x8e1f('0x49')],{'$or':_[_0x8e1f('0x38')](_0x2515a5[_0x8e1f('0x41')],function(_0x596877){var _0x4207d9={};_0x4207d9[_0x596877]={'$like':'%'+_0x529019[_0x8e1f('0x3e')][_0x8e1f('0x48')]+'%'};return _0x4207d9;})});}_0x2515a5=_[_0x8e1f('0x4a')]({},_0x2515a5,_0x529019['options']);return _0x53d001[_0x8e1f('0xb4')](_0x2515a5);}})[_0x8e1f('0x19')](function(_0xbebbda){if(_0xbebbda){_0x5a8dfc=_0xbebbda[_0x8e1f('0x42')];if(!_0x529019[_0x8e1f('0x3e')][_0x8e1f('0x43')](_0x8e1f('0x44'))){_0x2515a5[_0x8e1f('0x29')]=qs[_0x8e1f('0x29')](_0x529019[_0x8e1f('0x3e')][_0x8e1f('0x29')]);_0x2515a5[_0x8e1f('0x27')]=qs[_0x8e1f('0x27')](_0x529019['query'][_0x8e1f('0x27')]);}return _0x53d001[_0x8e1f('0xb4')](_0x2515a5);}})[_0x8e1f('0x19')](function(_0x3c4069){if(_0x3c4069){return _0x3c4069?{'count':_0x5a8dfc,'rows':_0x3c4069}:null;}})[_0x8e1f('0x19')](respondWithResult(_0x526dad,null))[_0x8e1f('0x22')](handleError(_0x526dad,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 22cb9cf..721ce4c 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 _0xd97a=['hook','events','FaxAccount','setMaxListeners','remove','emit','hasOwnProperty'];(function(_0x34a38d,_0x5af692){var _0x268aac=function(_0x3ea46b){while(--_0x3ea46b){_0x34a38d['push'](_0x34a38d['shift']());}};_0x268aac(++_0x5af692);}(_0xd97a,0x13c));var _0xad97=function(_0x11f0a6,_0x1ce59d){_0x11f0a6=_0x11f0a6-0x0;var _0xa5ab4b=_0xd97a[_0x11f0a6];return _0xa5ab4b;};'use strict';var EventEmitter=require(_0xad97('0x0'));var FaxAccount=require('../../mysqldb')['db'][_0xad97('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xad97('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xad97('0x3')};function emitEvent(_0x3fb191){return function(_0xaf68d0,_0x2361e9,_0x4165f6){FaxAccountEvents[_0xad97('0x4')](_0x3fb191+':'+_0xaf68d0['id'],_0xaf68d0);FaxAccountEvents[_0xad97('0x4')](_0x3fb191,_0xaf68d0);_0x4165f6(null);};}for(var e in events){if(events[_0xad97('0x5')](e)){var event=events[e];FaxAccount[_0xad97('0x6')](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file +var _0x4095=['update','emit','exports','events','FaxAccount','save'];(function(_0x41e823,_0x3ff33a){var _0x2654df=function(_0x5917c3){while(--_0x5917c3){_0x41e823['push'](_0x41e823['shift']());}};_0x2654df(++_0x3ff33a);}(_0x4095,0xd5));var _0x5409=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x4095[_0x397e5f];return _0x5302b8;};'use strict';var EventEmitter=require(_0x5409('0x0'));var FaxAccount=require('../../mysqldb')['db'][_0x5409('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5409('0x2'),'afterUpdate':_0x5409('0x3'),'afterDestroy':'remove'};function emitEvent(_0x5b8aad){return function(_0x20e49a,_0x54c9ee,_0x17070f){FaxAccountEvents[_0x5409('0x4')](_0x5b8aad+':'+_0x20e49a['id'],_0x20e49a);FaxAccountEvents[_0x5409('0x4')](_0x5b8aad,_0x20e49a);_0x17070f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0x5409('0x5')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 99ace9f..ac87d47 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 _0x5770=['exports','define','fax_accounts','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxAccount.attributes'];(function(_0xbc9917,_0x479324){var _0x20ab5a=function(_0x43951d){while(--_0x43951d){_0xbc9917['push'](_0xbc9917['shift']());}};_0x20ab5a(++_0x479324);}(_0x5770,0xe9));var _0x0577=function(_0x3ed95e,_0x2d2d13){_0x3ed95e=_0x3ed95e-0x0;var _0x4ab531=_0x5770[_0x3ed95e];return _0x4ab531;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x0577('0x0'));var BPromise=require(_0x0577('0x1'));var rp=require(_0x0577('0x2'));var fs=require('fs');var path=require(_0x0577('0x3'));var rimraf=require(_0x0577('0x4'));var config=require(_0x0577('0x5'));var attributes=require(_0x0577('0x6'));module[_0x0577('0x7')]=function(_0x1a38d4,_0x4c6027){return _0x1a38d4[_0x0577('0x8')]('FaxAccount',attributes,{'tableName':_0x0577('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2d2a=['fax_accounts','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./faxAccount.attributes','FaxAccount'];(function(_0x319730,_0x28d2df){var _0x5efe3e=function(_0x81325d){while(--_0x81325d){_0x319730['push'](_0x319730['shift']());}};_0x5efe3e(++_0x28d2df);}(_0x2d2a,0x1da));var _0xa2d2=function(_0x285395,_0x49ed20){_0x285395=_0x285395-0x0;var _0x2d019f=_0x2d2a[_0x285395];return _0x2d019f;};'use strict';var _=require(_0xa2d2('0x0'));var util=require(_0xa2d2('0x1'));var logger=require('../../config/logger')(_0xa2d2('0x2'));var moment=require(_0xa2d2('0x3'));var BPromise=require(_0xa2d2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa2d2('0x5'));var rimraf=require(_0xa2d2('0x6'));var config=require(_0xa2d2('0x7'));var attributes=require(_0xa2d2('0x8'));module['exports']=function(_0x9782ad,_0x418972){return _0x9782ad['define'](_0xa2d2('0x9'),attributes,{'tableName':_0xa2d2('0xa'),'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 38f51d6..6be486d 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 _0x70d4=['raw','where','attributes','limit','map','include','model','catch','body','fax','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','updatedAt','createdAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','FaxAccount','find','List','Contacts','DESC','FaxApplication','Applications','get','applications','list','priority','account','create','contact','FaxInteraction','Contact\x20not\x20found','spread','autoclose','length','close','unmanaged','created','ContactId','AttachmentId','User','interaction','UserId','agent','name','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','then','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','GetFaxAccount','findAll','options'];(function(_0x41f309,_0x558c88){var _0x354c4c=function(_0x142d67){while(--_0x142d67){_0x41f309['push'](_0x41f309['shift']());}};_0x354c4c(++_0x558c88);}(_0x70d4,0x94));var _0x470d=function(_0x5311e8,_0x57c5bb){_0x5311e8=_0x5311e8-0x0;var _0x582ad8=_0x70d4[_0x5311e8];return _0x582ad8;};'use strict';var _=require(_0x470d('0x0'));var util=require('util');var moment=require(_0x470d('0x1'));var BPromise=require(_0x470d('0x2'));var rs=require(_0x470d('0x3'));var fs=require('fs');var Redis=require(_0x470d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x470d('0x5'));var logger=require(_0x470d('0x6'))(_0x470d('0x7'));var config=require(_0x470d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x470d('0x9')][_0x470d('0xa')]({'port':0x232c});config[_0x470d('0xb')]=_[_0x470d('0xc')](config[_0x470d('0xb')],{'host':_0x470d('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x470d('0xb')]));require('./faxAccount.socket')['register'](socket);function respondWithRpcPromise(_0x3c542f,_0x35b5bc,_0x5da55d){return new BPromise(function(_0x34b21e,_0x4136ec){return client['request'](_0x3c542f,_0x5da55d)[_0x470d('0xe')](function(_0x417063){logger['info'](_0x470d('0xf'),_0x35b5bc,_0x470d('0x10'));logger[_0x470d('0x11')](_0x470d('0x12'),_0x35b5bc,_0x470d('0x10'),JSON[_0x470d('0x13')](_0x417063));if(_0x417063[_0x470d('0x14')]){if(_0x417063[_0x470d('0x14')][_0x470d('0x15')]===0x1f4){logger[_0x470d('0x14')](_0x470d('0xf'),_0x35b5bc,_0x417063[_0x470d('0x14')]['message']);return _0x4136ec(_0x417063[_0x470d('0x14')]['message']);}logger['error']('FaxAccount,\x20%s,\x20%s',_0x35b5bc,_0x417063[_0x470d('0x14')][_0x470d('0x16')]);return _0x34b21e(_0x417063[_0x470d('0x14')][_0x470d('0x16')]);}else{logger[_0x470d('0x17')](_0x470d('0xf'),_0x35b5bc,_0x470d('0x10'));_0x34b21e(_0x417063[_0x470d('0x18')][_0x470d('0x16')]);}})['catch'](function(_0x14b024){logger[_0x470d('0x14')](_0x470d('0xf'),_0x35b5bc,_0x14b024);_0x4136ec(_0x14b024);});});}exports[_0x470d('0x19')]=function(_0x24219a){var _0xdfb8ed=this;return new Promise(function(_0x33b211,_0x428a54){return db['FaxAccount'][_0x470d('0x1a')]({'raw':_0x24219a[_0x470d('0x1b')]?_0x24219a['options'][_0x470d('0x1c')]===undefined?!![]:![]:!![],'where':_0x24219a[_0x470d('0x1b')]?_0x24219a[_0x470d('0x1b')][_0x470d('0x1d')]||null:null,'attributes':_0x24219a['options']?_0x24219a[_0x470d('0x1b')][_0x470d('0x1e')]||null:null,'limit':_0x24219a[_0x470d('0x1b')]?_0x24219a[_0x470d('0x1b')][_0x470d('0x1f')]||null:null,'include':_0x24219a[_0x470d('0x1b')]?_0x24219a[_0x470d('0x1b')]['include']?_[_0x470d('0x20')](_0x24219a[_0x470d('0x1b')][_0x470d('0x21')],function(_0x4021ed){return{'model':db[_0x4021ed['model']],'as':_0x4021ed['as'],'attributes':_0x4021ed[_0x470d('0x1e')],'include':_0x4021ed['include']?_['map'](_0x4021ed[_0x470d('0x21')],function(_0x47aa13){return{'model':db[_0x47aa13[_0x470d('0x22')]],'as':_0x47aa13['as'],'attributes':_0x47aa13['attributes'],'include':_0x47aa13[_0x470d('0x21')]?_[_0x470d('0x20')](_0x47aa13[_0x470d('0x21')],function(_0x255a51){return{'model':db[_0x255a51[_0x470d('0x22')]],'as':_0x255a51['as'],'attributes':_0x255a51[_0x470d('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x470d('0xe')](function(_0x34a1e2){logger['info'](_0x470d('0x19'),_0x24219a);logger[_0x470d('0x11')](_0x470d('0x19'),_0x24219a,JSON[_0x470d('0x13')](_0x34a1e2));_0x33b211(_0x34a1e2);})[_0x470d('0x23')](function(_0x30dd55){logger[_0x470d('0x14')](_0x470d('0x19'),_0x30dd55[_0x470d('0x16')],_0x24219a);_0x428a54(_0xdfb8ed[_0x470d('0x14')](0x1f4,_0x30dd55[_0x470d('0x16')]));});});};exports['NotifyFaxAccount']=function(_0x42a1eb,_0x2079b9,_0x89f5cd){var _0x5334a9=this;return new Promise(function(_0x1be6ca,_0x577f56){var _0x34d704={'body':_0x42a1eb[_0x470d('0x24')],'channel':_0x470d('0x25')};var _0x53b6a8=[];var _0x1211a1=[];var _0x5a9011={};return db[_0x470d('0x26')][_0x470d('0x27')]()[_0x470d('0xe')](function(_0x9708fb){if(!_0x9708fb){throw new db[(_0x470d('0x28'))][(_0x470d('0x29'))](_0x470d('0x2a'));}_0x53b6a8=_[_0x470d('0x2b')](_[_0x470d('0x2c')](_0x9708fb),['createdAt',_0x470d('0x2d')]);_0x1211a1=_[_0x470d('0x2b')](_[_0x470d('0x2c')](_0x9708fb),[_0x470d('0x2e'),_0x470d('0x2d'),_0x470d('0x2f'),_0x470d('0x30')]);if(_0x42a1eb[_0x470d('0x24')]['id']){delete _0x42a1eb[_0x470d('0x24')]['id'];}if(_[_0x470d('0x31')](_0x42a1eb['body'][_0x470d('0x32')])){throw new db[(_0x470d('0x28'))]['ValidationError'](_0x470d('0x33'));}if(_[_0x470d('0x31')](_0x42a1eb[_0x470d('0x24')][_0x470d('0x24')])||_0x42a1eb[_0x470d('0x24')]['body']===''){throw new db[(_0x470d('0x28'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x470d('0x31')](_0x42a1eb[_0x470d('0x24')][_0x470d('0x34')])){throw new db[(_0x470d('0x28'))][(_0x470d('0x29'))](_0x470d('0x35')+_0x1211a1);}if(!_[_0x470d('0x36')](_0x1211a1,_0x42a1eb[_0x470d('0x24')][_0x470d('0x34')])){throw new db[(_0x470d('0x28'))][(_0x470d('0x29'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1211a1);}_0x5a9011[_0x42a1eb[_0x470d('0x24')]['mapKey']]=_0x42a1eb[_0x470d('0x24')]['from'];})['then'](function(){return db[_0x470d('0x37')][_0x470d('0x38')]({'where':{'id':_0x42a1eb['account']['id']},'include':[{'model':db['CmList'],'as':_0x470d('0x39'),'include':[{'model':db[_0x470d('0x26')],'as':_0x470d('0x3a'),'where':_0x5a9011,'limit':0x1,'order':[[_0x470d('0x2d'),_0x470d('0x3b')]]}]},{'model':db[_0x470d('0x3c')],'as':_0x470d('0x3d')}]});})[_0x470d('0xe')](function(_0x46a778){if(_0x46a778&&_0x46a778[_0x470d('0x39')]){var _0x1100ef=_0x46a778[_0x470d('0x3e')]({'plain':!![]});_0x34d704['account']=_0x1100ef;_0x34d704[_0x470d('0x3f')]=_0x1100ef[_0x470d('0x3d')];_0x34d704[_0x470d('0x40')]=_0x1100ef['List'];_0x34d704[_0x470d('0x3f')]=_['orderBy'](_0x34d704[_0x470d('0x3f')],[_0x470d('0x41')],['asc']);if(_0x34d704[_0x470d('0x42')][_0x470d('0x3d')]){delete _0x34d704[_0x470d('0x42')][_0x470d('0x3d')];}if(_0x34d704['account'][_0x470d('0x39')]&&_0x34d704[_0x470d('0x42')]['List'][_0x470d('0x3a')]['length']){return _0x34d704['account'][_0x470d('0x39')]['Contacts'][0x0];}var _0x27bf99=_[_0x470d('0xc')](_0x42a1eb['body'],{'firstName':_0x42a1eb[_0x470d('0x24')]['from'],'ListId':_0x1100ef[_0x470d('0x30')]});_0x27bf99[_0x42a1eb[_0x470d('0x24')][_0x470d('0x34')]]=_0x42a1eb[_0x470d('0x24')][_0x470d('0x32')];return db['CmContact'][_0x470d('0x43')](_0x27bf99,{'fields':_0x53b6a8,'raw':!![]});}})['then'](function(_0x4b4e31){_0x34d704[_0x470d('0x44')]=_0x4b4e31;if(_0x4b4e31){var _0x572b49={'ContactId':_0x4b4e31['id'],'FaxAccountId':_0x42a1eb[_0x470d('0x42')]['id'],'fax':_0x4b4e31[_0x470d('0x25')]};return db[_0x470d('0x45')]['find']({'where':{'ContactId':_0x4b4e31['id'],'closed':![],'FaxAccountId':_0x42a1eb[_0x470d('0x42')]['id']}})['then'](function(_0x2fcbf0){if(_0x2fcbf0){return[_0x2fcbf0,![]];}return db[_0x470d('0x45')][_0x470d('0x43')](_0x572b49)[_0x470d('0xe')](function(_0x153b43){return[_0x153b43,!![]];});});}else{throw new Error(_0x470d('0x46'));}})[_0x470d('0x47')](function(_0x43ecae,_0x5769e4){var _0x469669=_0x43ecae[_0x470d('0x3e')]({'plain':!![]});if(_0x5769e4){if(_0x34d704[_0x470d('0x42')][_0x470d('0x48')]){_0x34d704[_0x470d('0x3f')]['push']({'id':0x0,'priority':_0x34d704['applications'][_0x470d('0x49')]+0x1,'app':_0x470d('0x4a'),'appdata':_0x470d('0x4b'),'interval':'*,*,*,*'});}_0x469669[_0x470d('0x4c')]=!![];}else{_0x469669['created']=![];}_0x34d704['interaction']=_0x469669;return db['FaxMessage'][_0x470d('0x43')]({'body':_0x42a1eb[_0x470d('0x24')]['body'],'FaxAccountId':_0x42a1eb[_0x470d('0x42')]['id'],'FaxInteractionId':_0x43ecae['id'],'direction':'in','ContactId':_0x43ecae[_0x470d('0x4d')],'AttachmentId':_0x42a1eb[_0x470d('0x24')][_0x470d('0x4e')]});})[_0x470d('0xe')](function(_0x4e1649){_0x34d704[_0x470d('0x16')]=_0x4e1649;if(_0x34d704['interaction']['UserId']){return db[_0x470d('0x4f')][_0x470d('0x38')]({'attributes':['id','name'],'where':{'id':_0x34d704[_0x470d('0x50')][_0x470d('0x51')]}})[_0x470d('0xe')](function(_0x2c34f7){if(_0x2c34f7){_0x34d704['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0x470d('0x52'),'appdata':_0x2c34f7[_0x470d('0x53')]+','+(_0x34d704[_0x470d('0x42')][_0x470d('0x54')]||0xa),'interval':_0x470d('0x55')});}return respondWithRpcPromise(_0x470d('0x56'),_0x470d('0x57'),_0x34d704);});}return respondWithRpcPromise(_0x470d('0x56'),_0x470d('0x57'),_0x34d704);})['then'](function(_0x33aa05){_0x1be6ca(_0x33aa05);})[_0x470d('0x23')](function(_0x3e1993){_0x577f56(_0x5334a9[_0x470d('0x14')](0x1f4,_0x3e1993[_0x470d('0x16')]));});});}; \ No newline at end of file +var _0x666f=['length','from','create','FaxInteraction','find','Contact\x20not\x20found','spread','get','push','close','unmanaged','*,*,*,*','created','FaxMessage','AttachmentId','interaction','UserId','User','name','waitForTheAssignedAgent','Start','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','redis','defaults','socket.io-emitter','./faxAccount.socket','register','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetFaxAccount','FaxAccount','findAll','options','limit','include','map','model','attributes','catch','NotifyFaxAccount','body','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','ListId','from\x20is\x20mandatory','isNil','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','Contacts','DESC','FaxApplication','Applications','List','list','applications','orderBy','asc'];(function(_0x4c9c89,_0x44cf0a){var _0x24096c=function(_0x295c3e){while(--_0x295c3e){_0x4c9c89['push'](_0x4c9c89['shift']());}};_0x24096c(++_0x44cf0a);}(_0x666f,0x114));var _0xf666=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x666f[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0xf666('0x0'));var util=require(_0xf666('0x1'));var moment=require(_0xf666('0x2'));var BPromise=require('bluebird');var rs=require(_0xf666('0x3'));var fs=require('fs');var Redis=require(_0xf666('0x4'));var db=require(_0xf666('0x5'))['db'];var utils=require(_0xf666('0x6'));var logger=require(_0xf666('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xf666('0x8'));var client=jayson[_0xf666('0x9')]['http']({'port':0x232c});config[_0xf666('0xa')]=_[_0xf666('0xb')](config[_0xf666('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xf666('0xc'))(new Redis(config['redis']));require(_0xf666('0xd'))[_0xf666('0xe')](socket);function respondWithRpcPromise(_0xe60c59,_0x5cfc07,_0x2bd7a4){return new BPromise(function(_0x9be120,_0x55f668){return client[_0xf666('0xf')](_0xe60c59,_0x2bd7a4)[_0xf666('0x10')](function(_0x240a6c){logger[_0xf666('0x11')](_0xf666('0x12'),_0x5cfc07,_0xf666('0x13'));logger[_0xf666('0x14')](_0xf666('0x15'),_0x5cfc07,_0xf666('0x13'),JSON[_0xf666('0x16')](_0x240a6c));if(_0x240a6c[_0xf666('0x17')]){if(_0x240a6c[_0xf666('0x17')]['code']===0x1f4){logger['error'](_0xf666('0x12'),_0x5cfc07,_0x240a6c['error']['message']);return _0x55f668(_0x240a6c[_0xf666('0x17')][_0xf666('0x18')]);}logger[_0xf666('0x17')](_0xf666('0x12'),_0x5cfc07,_0x240a6c[_0xf666('0x17')]['message']);return _0x9be120(_0x240a6c['error'][_0xf666('0x18')]);}else{logger[_0xf666('0x11')](_0xf666('0x12'),_0x5cfc07,'request\x20sent');_0x9be120(_0x240a6c[_0xf666('0x19')][_0xf666('0x18')]);}})['catch'](function(_0x38404c){logger['error']('FaxAccount,\x20%s,\x20%s',_0x5cfc07,_0x38404c);_0x55f668(_0x38404c);});});}exports[_0xf666('0x1a')]=function(_0x4e6d66){var _0x44e22e=this;return new Promise(function(_0x59ec9b,_0x473578){return db[_0xf666('0x1b')][_0xf666('0x1c')]({'raw':_0x4e6d66[_0xf666('0x1d')]?_0x4e6d66[_0xf666('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x4e6d66[_0xf666('0x1d')]?_0x4e6d66['options']['where']||null:null,'attributes':_0x4e6d66[_0xf666('0x1d')]?_0x4e6d66[_0xf666('0x1d')]['attributes']||null:null,'limit':_0x4e6d66[_0xf666('0x1d')]?_0x4e6d66[_0xf666('0x1d')][_0xf666('0x1e')]||null:null,'include':_0x4e6d66[_0xf666('0x1d')]?_0x4e6d66[_0xf666('0x1d')][_0xf666('0x1f')]?_[_0xf666('0x20')](_0x4e6d66[_0xf666('0x1d')][_0xf666('0x1f')],function(_0x761cff){return{'model':db[_0x761cff[_0xf666('0x21')]],'as':_0x761cff['as'],'attributes':_0x761cff[_0xf666('0x22')],'include':_0x761cff[_0xf666('0x1f')]?_[_0xf666('0x20')](_0x761cff[_0xf666('0x1f')],function(_0x4ecb2c){return{'model':db[_0x4ecb2c[_0xf666('0x21')]],'as':_0x4ecb2c['as'],'attributes':_0x4ecb2c[_0xf666('0x22')],'include':_0x4ecb2c[_0xf666('0x1f')]?_[_0xf666('0x20')](_0x4ecb2c[_0xf666('0x1f')],function(_0x51b4c8){return{'model':db[_0x51b4c8[_0xf666('0x21')]],'as':_0x51b4c8['as'],'attributes':_0x51b4c8['attributes']};}):[]};}):[]};}):[]:[]})[_0xf666('0x10')](function(_0x14ebc8){logger[_0xf666('0x11')](_0xf666('0x1a'),_0x4e6d66);logger[_0xf666('0x14')]('GetFaxAccount',_0x4e6d66,JSON[_0xf666('0x16')](_0x14ebc8));_0x59ec9b(_0x14ebc8);})[_0xf666('0x23')](function(_0x11fc0b){logger[_0xf666('0x17')](_0xf666('0x1a'),_0x11fc0b[_0xf666('0x18')],_0x4e6d66);_0x473578(_0x44e22e[_0xf666('0x17')](0x1f4,_0x11fc0b[_0xf666('0x18')]));});});};exports[_0xf666('0x24')]=function(_0x1b89bb,_0x1bb5d6,_0x975a65){var _0xf90f93=this;return new Promise(function(_0x354142,_0x5ac936){var _0x5f39db={'body':_0x1b89bb[_0xf666('0x25')],'channel':'fax'};var _0x460a60=[];var _0x3a0c92=[];var _0x46a0d7={};return db[_0xf666('0x26')][_0xf666('0x27')]()[_0xf666('0x10')](function(_0x1d055c){if(!_0x1d055c){throw new db[(_0xf666('0x28'))][(_0xf666('0x29'))](_0xf666('0x2a'));}_0x460a60=_['difference'](_['keys'](_0x1d055c),[_0xf666('0x2b'),_0xf666('0x2c')]);_0x3a0c92=_[_0xf666('0x2d')](_['keys'](_0x1d055c),[_0xf666('0x2b'),_0xf666('0x2c'),_0xf666('0x2e'),_0xf666('0x2f')]);if(_0x1b89bb['body']['id']){delete _0x1b89bb[_0xf666('0x25')]['id'];}if(_['isNil'](_0x1b89bb[_0xf666('0x25')]['from'])){throw new db[(_0xf666('0x28'))]['ValidationError'](_0xf666('0x30'));}if(_[_0xf666('0x31')](_0x1b89bb[_0xf666('0x25')][_0xf666('0x25')])||_0x1b89bb['body'][_0xf666('0x25')]===''){throw new db[(_0xf666('0x28'))][(_0xf666('0x29'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xf666('0x31')](_0x1b89bb[_0xf666('0x25')][_0xf666('0x32')])){throw new db['Sequelize']['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3a0c92);}if(!_[_0xf666('0x33')](_0x3a0c92,_0x1b89bb[_0xf666('0x25')]['mapKey'])){throw new db[(_0xf666('0x28'))]['ValidationError'](_0xf666('0x34')+_0x3a0c92);}_0x46a0d7[_0x1b89bb[_0xf666('0x25')]['mapKey']]=_0x1b89bb[_0xf666('0x25')]['from'];})[_0xf666('0x10')](function(){return db[_0xf666('0x1b')]['find']({'where':{'id':_0x1b89bb[_0xf666('0x35')]['id']},'include':[{'model':db[_0xf666('0x36')],'as':'List','include':[{'model':db['CmContact'],'as':_0xf666('0x37'),'where':_0x46a0d7,'limit':0x1,'order':[[_0xf666('0x2c'),_0xf666('0x38')]]}]},{'model':db[_0xf666('0x39')],'as':_0xf666('0x3a')}]});})['then'](function(_0x40277a){if(_0x40277a&&_0x40277a[_0xf666('0x3b')]){var _0x500138=_0x40277a['get']({'plain':!![]});_0x5f39db[_0xf666('0x35')]=_0x500138;_0x5f39db['applications']=_0x500138[_0xf666('0x3a')];_0x5f39db[_0xf666('0x3c')]=_0x500138[_0xf666('0x3b')];_0x5f39db[_0xf666('0x3d')]=_[_0xf666('0x3e')](_0x5f39db['applications'],['priority'],[_0xf666('0x3f')]);if(_0x5f39db['account'][_0xf666('0x3a')]){delete _0x5f39db['account'][_0xf666('0x3a')];}if(_0x5f39db[_0xf666('0x35')][_0xf666('0x3b')]&&_0x5f39db[_0xf666('0x35')][_0xf666('0x3b')][_0xf666('0x37')][_0xf666('0x40')]){return _0x5f39db['account'][_0xf666('0x3b')][_0xf666('0x37')][0x0];}var _0x52eee0=_[_0xf666('0xb')](_0x1b89bb[_0xf666('0x25')],{'firstName':_0x1b89bb['body'][_0xf666('0x41')],'ListId':_0x500138['ListId']});_0x52eee0[_0x1b89bb[_0xf666('0x25')][_0xf666('0x32')]]=_0x1b89bb[_0xf666('0x25')][_0xf666('0x41')];return db[_0xf666('0x26')][_0xf666('0x42')](_0x52eee0,{'fields':_0x460a60,'raw':!![]});}})['then'](function(_0x5dbc28){_0x5f39db['contact']=_0x5dbc28;if(_0x5dbc28){var _0x3e73c2={'ContactId':_0x5dbc28['id'],'FaxAccountId':_0x1b89bb[_0xf666('0x35')]['id'],'fax':_0x5dbc28['fax']};return db[_0xf666('0x43')][_0xf666('0x44')]({'where':{'ContactId':_0x5dbc28['id'],'closed':![],'FaxAccountId':_0x1b89bb[_0xf666('0x35')]['id']}})['then'](function(_0x32c544){if(_0x32c544){return[_0x32c544,![]];}return db[_0xf666('0x43')]['create'](_0x3e73c2)[_0xf666('0x10')](function(_0x338e72){return[_0x338e72,!![]];});});}else{throw new Error(_0xf666('0x45'));}})[_0xf666('0x46')](function(_0x2c7a4c,_0x4f98dc){var _0x192266=_0x2c7a4c[_0xf666('0x47')]({'plain':!![]});if(_0x4f98dc){if(_0x5f39db[_0xf666('0x35')]['autoclose']){_0x5f39db[_0xf666('0x3d')][_0xf666('0x48')]({'id':0x0,'priority':_0x5f39db[_0xf666('0x3d')][_0xf666('0x40')]+0x1,'app':_0xf666('0x49'),'appdata':_0xf666('0x4a'),'interval':_0xf666('0x4b')});}_0x192266['created']=!![];}else{_0x192266[_0xf666('0x4c')]=![];}_0x5f39db['interaction']=_0x192266;return db[_0xf666('0x4d')][_0xf666('0x42')]({'body':_0x1b89bb[_0xf666('0x25')]['body'],'FaxAccountId':_0x1b89bb['account']['id'],'FaxInteractionId':_0x2c7a4c['id'],'direction':'in','ContactId':_0x2c7a4c['ContactId'],'AttachmentId':_0x1b89bb[_0xf666('0x25')][_0xf666('0x4e')]});})[_0xf666('0x10')](function(_0x495ee3){_0x5f39db[_0xf666('0x18')]=_0x495ee3;if(_0x5f39db[_0xf666('0x4f')][_0xf666('0x50')]){return db[_0xf666('0x51')][_0xf666('0x44')]({'attributes':['id',_0xf666('0x52')],'where':{'id':_0x5f39db[_0xf666('0x4f')][_0xf666('0x50')]}})[_0xf666('0x10')](function(_0xe1d3e2){if(_0xe1d3e2){_0x5f39db[_0xf666('0x3d')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0xe1d3e2['name']+','+(_0x5f39db[_0xf666('0x35')][_0xf666('0x53')]||0xa),'interval':_0xf666('0x4b')});}return respondWithRpcPromise('Start','startRouting',_0x5f39db);});}return respondWithRpcPromise(_0xf666('0x54'),'startRouting',_0x5f39db);})[_0xf666('0x10')](function(_0x2d42a6){_0x354142(_0x2d42a6);})[_0xf666('0x23')](function(_0x53d5d3){_0x5ac936(_0xf90f93[_0xf666('0x17')](0x1f4,_0x53d5d3['message']));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index e859289..e6295b6 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 _0x78ec=['faxAccount:','save','remove','emit','removeListener','register','length'];(function(_0x3c1638,_0x222291){var _0xe5215e=function(_0x39c4be){while(--_0x39c4be){_0x3c1638['push'](_0x3c1638['shift']());}};_0xe5215e(++_0x222291);}(_0x78ec,0xcc));var _0xc78e=function(_0x39b013,_0x3610ed){_0x39b013=_0x39b013-0x0;var _0x1dcaf1=_0x78ec[_0x39b013];return _0x1dcaf1;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=[_0xc78e('0x0'),_0xc78e('0x1'),'update'];function createListener(_0x5099f5,_0xbf89ca){return function(_0xf5127e){_0xbf89ca[_0xc78e('0x2')](_0x5099f5,_0xf5127e);};}function removeListener(_0x2aac37,_0x531e17){return function(){FaxAccountEvents[_0xc78e('0x3')](_0x2aac37,_0x531e17);};}exports[_0xc78e('0x4')]=function(_0x3d3943){for(var _0x11f472=0x0,_0x2b1d78=events[_0xc78e('0x5')];_0x11f472<_0x2b1d78;_0x11f472++){var _0x5ca0ed=events[_0x11f472];var _0x5f1297=createListener(_0xc78e('0x6')+_0x5ca0ed,_0x3d3943);FaxAccountEvents['on'](_0x5ca0ed,_0x5f1297);}}; \ No newline at end of file +var _0x4298=['register','length','faxAccount:','./faxAccount.events','save','remove','update','emit','removeListener'];(function(_0x9c8a5a,_0x533957){var _0x37c153=function(_0x3baa6d){while(--_0x3baa6d){_0x9c8a5a['push'](_0x9c8a5a['shift']());}};_0x37c153(++_0x533957);}(_0x4298,0x6f));var _0x8429=function(_0x2366e5,_0x4daae6){_0x2366e5=_0x2366e5-0x0;var _0x2c057c=_0x4298[_0x2366e5];return _0x2c057c;};'use strict';var FaxAccountEvents=require(_0x8429('0x0'));var events=[_0x8429('0x1'),_0x8429('0x2'),_0x8429('0x3')];function createListener(_0x94963a,_0x4eafa4){return function(_0x1b3ef2){_0x4eafa4[_0x8429('0x4')](_0x94963a,_0x1b3ef2);};}function removeListener(_0xe023d9,_0x2f1e25){return function(){FaxAccountEvents[_0x8429('0x5')](_0xe023d9,_0x2f1e25);};}exports[_0x8429('0x6')]=function(_0x112395){for(var _0x7aa6d=0x0,_0x58e931=events[_0x8429('0x7')];_0x7aa6d<_0x58e931;_0x7aa6d++){var _0x2759a8=events[_0x7aa6d];var _0x253be3=createListener(_0x8429('0x8')+_0x2759a8,_0x112395);FaxAccountEvents['on'](_0x2759a8,_0x253be3);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 49cbc9f..c471175 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(_0x589c8d,_0x4185e7){var _0x4c259b=function(_0x2535ef){while(--_0x2535ef){_0x589c8d['push'](_0x589c8d['shift']());}};_0x4c259b(++_0x4185e7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'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(_0x23e567,_0x317c3b){var _0x1fceaf=function(_0x539a67){while(--_0x539a67){_0x23e567['push'](_0x23e567['shift']());}};_0x1fceaf(++_0x317c3b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'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 fa13629..2dc8d11 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 _0x8bae=['TEXT','STRING','sequelize','exports','INTEGER','noop'];(function(_0x347f4e,_0x51235d){var _0x32164d=function(_0x2d5248){while(--_0x2d5248){_0x347f4e['push'](_0x347f4e['shift']());}};_0x32164d(++_0x51235d);}(_0x8bae,0x194));var _0xe8ba=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0x8bae[_0x2235bf];return _0x4c3a64;};'use strict';var Sequelize=require(_0xe8ba('0x0'));module[_0xe8ba('0x1')]={'priority':{'type':Sequelize[_0xe8ba('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xe8ba('0x3')},'appdata':{'type':Sequelize[_0xe8ba('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xe8ba('0x5')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x9981=['sequelize','exports','INTEGER','STRING','TEXT'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x9981,0x19a));var _0x1998=function(_0x3c8e9a,_0x384306){_0x3c8e9a=_0x3c8e9a-0x0;var _0x2d4c57=_0x9981[_0x3c8e9a];return _0x2d4c57;};'use strict';var Sequelize=require(_0x1998('0x0'));module[_0x1998('0x1')]={'priority':{'type':Sequelize[_0x1998('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x1998('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x1998('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x1998('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 4de2b29..9ba253b 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 _0x48f6=['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','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','FaxApplication','includeAll','findAll','rows','catch','show','params','include','find','body','eml-format','rimraf','zip-dir','moment','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','querystring'];(function(_0x19ecfb,_0xdea922){var _0x25e7bd=function(_0x9124ad){while(--_0x9124ad){_0x19ecfb['push'](_0x19ecfb['shift']());}};_0x25e7bd(++_0xdea922);}(_0x48f6,0x127));var _0x648f=function(_0x110bad,_0x252e83){_0x110bad=_0x110bad-0x0;var _0xdcac15=_0x48f6[_0x110bad];return _0xdcac15;};'use strict';var emlformat=require(_0x648f('0x0'));var rimraf=require(_0x648f('0x1'));var zipdir=require(_0x648f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x648f('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x648f('0x4'));var util=require(_0x648f('0x5'));var path=require(_0x648f('0x6'));var sox=require('sox');var csv=require(_0x648f('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x648f('0x8'));var _=require(_0x648f('0x9'));var squel=require(_0x648f('0xa'));var crypto=require(_0x648f('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x648f('0x7'));var querystring=require(_0x648f('0xc'));var Papa=require(_0x648f('0xd'));var Redis=require(_0x648f('0xe'));var authService=require(_0x648f('0xf'));var qs=require(_0x648f('0x10'));var as=require(_0x648f('0x11'));var hardwareService=require(_0x648f('0x12'));var logger=require(_0x648f('0x13'))(_0x648f('0x14'));var utils=require(_0x648f('0x15'));var config=require(_0x648f('0x16'));var licenseUtil=require(_0x648f('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x377f30,_0x377ab4){_0x377ab4=_0x377ab4||0xcc;return function(_0x1f4265){if(_0x1f4265){return _0x377f30[_0x648f('0x18')](_0x377ab4);}return _0x377f30['status'](_0x377ab4)['end']();};}function respondWithResult(_0x37becd,_0x33df3d){_0x33df3d=_0x33df3d||0xc8;return function(_0x34faa6){if(_0x34faa6){return _0x37becd[_0x648f('0x19')](_0x33df3d)['json'](_0x34faa6);}};}function respondWithFilteredResult(_0x4a5986,_0x2cd303){return function(_0x294348){if(_0x294348){var _0x47014a=typeof _0x2cd303[_0x648f('0x1a')]===_0x648f('0x1b')&&typeof _0x2cd303[_0x648f('0x1c')]===_0x648f('0x1b');var _0x386cd7=_0x294348['count'];var _0x14c5a1=_0x47014a?0x0:_0x2cd303['offset'];var _0x367cd0=_0x47014a?_0x294348[_0x648f('0x1d')]:_0x2cd303[_0x648f('0x1a')]+_0x2cd303[_0x648f('0x1c')];var _0x161103;if(_0x367cd0>=_0x386cd7){_0x367cd0=_0x386cd7;_0x161103=0xc8;}else{_0x161103=0xce;}_0x4a5986[_0x648f('0x19')](_0x161103);return _0x4a5986[_0x648f('0x1e')](_0x648f('0x1f'),_0x14c5a1+'-'+_0x367cd0+'/'+_0x386cd7)[_0x648f('0x20')](_0x294348);}return null;};}function patchUpdates(_0x5d81b0){return function(_0x400dae){try{jsonpatch[_0x648f('0x21')](_0x400dae,_0x5d81b0,!![]);}catch(_0x24476d){return BPromise[_0x648f('0x22')](_0x24476d);}return _0x400dae[_0x648f('0x23')]();};}function saveUpdates(_0x2cf0c9,_0xd6c6b6){return function(_0x37e46f){if(_0x37e46f){return _0x37e46f[_0x648f('0x24')](_0x2cf0c9)[_0x648f('0x25')](function(_0xb04757){return _0xb04757;});}return null;};}function removeEntity(_0x598290,_0x3e8532){return function(_0x26e682){if(_0x26e682){return _0x26e682[_0x648f('0x26')]()[_0x648f('0x25')](function(){_0x598290[_0x648f('0x19')](0xcc)[_0x648f('0x27')]();});}};}function handleEntityNotFound(_0x593b05,_0x179f23){return function(_0x2cc8b8){if(!_0x2cc8b8){_0x593b05[_0x648f('0x18')](0x194);}return _0x2cc8b8;};}function handleError(_0x348a5f,_0x3e1019){_0x3e1019=_0x3e1019||0x1f4;return function(_0x50c55f){logger[_0x648f('0x28')](_0x50c55f[_0x648f('0x29')]);if(_0x50c55f[_0x648f('0x2a')]){delete _0x50c55f[_0x648f('0x2a')];}_0x348a5f[_0x648f('0x19')](_0x3e1019)[_0x648f('0x2b')](_0x50c55f);};}exports[_0x648f('0x2c')]=function(_0x1a6a26,_0x1864a1){var _0x5089e1={},_0x409493={},_0x7e3b24={'count':0x0,'rows':[]};var _0x215f75=_[_0x648f('0x2d')](db['FaxApplication'][_0x648f('0x2e')],function(_0xb83a52){return{'name':_0xb83a52[_0x648f('0x2f')],'type':_0xb83a52[_0x648f('0x30')][_0x648f('0x31')]};});_0x409493[_0x648f('0x32')]=_[_0x648f('0x2d')](_0x215f75,'name');_0x409493['query']=_[_0x648f('0x33')](_0x1a6a26[_0x648f('0x34')]);_0x409493[_0x648f('0x35')]=_['intersection'](_0x409493[_0x648f('0x32')],_0x409493[_0x648f('0x34')]);_0x5089e1['attributes']=_[_0x648f('0x36')](_0x409493[_0x648f('0x32')],qs[_0x648f('0x37')](_0x1a6a26[_0x648f('0x34')]['fields']));_0x5089e1['attributes']=_0x5089e1[_0x648f('0x38')][_0x648f('0x39')]?_0x5089e1['attributes']:_0x409493[_0x648f('0x32')];if(!_0x1a6a26['query'][_0x648f('0x3a')]('nolimit')){_0x5089e1[_0x648f('0x1c')]=qs['limit'](_0x1a6a26[_0x648f('0x34')]['limit']);_0x5089e1[_0x648f('0x1a')]=qs[_0x648f('0x1a')](_0x1a6a26[_0x648f('0x34')][_0x648f('0x1a')]);}_0x5089e1[_0x648f('0x3b')]=qs[_0x648f('0x3c')](_0x1a6a26['query']['sort']);_0x5089e1[_0x648f('0x3d')]=qs['filters'](_[_0x648f('0x3e')](_0x1a6a26[_0x648f('0x34')],_0x409493[_0x648f('0x35')]),_0x215f75);if(_0x1a6a26[_0x648f('0x34')][_0x648f('0x3f')]){_0x5089e1[_0x648f('0x3d')]=_[_0x648f('0x40')](_0x5089e1[_0x648f('0x3d')],{'$or':_[_0x648f('0x2d')](_0x215f75,function(_0x5de3fe){if(_0x5de3fe[_0x648f('0x30')]!==_0x648f('0x41')){var _0x15fff0={};_0x15fff0[_0x5de3fe[_0x648f('0x2a')]]={'$like':'%'+_0x1a6a26[_0x648f('0x34')][_0x648f('0x3f')]+'%'};return _0x15fff0;}})});}_0x5089e1=_[_0x648f('0x40')]({},_0x5089e1,_0x1a6a26[_0x648f('0x42')]);var _0xba49d0={'where':_0x5089e1[_0x648f('0x3d')]};return db[_0x648f('0x43')][_0x648f('0x1d')](_0xba49d0)[_0x648f('0x25')](function(_0x2d534a){_0x7e3b24[_0x648f('0x1d')]=_0x2d534a;if(_0x1a6a26[_0x648f('0x34')][_0x648f('0x44')]){_0x5089e1['include']=[{'all':!![]}];}return db[_0x648f('0x43')][_0x648f('0x45')](_0x5089e1);})['then'](function(_0x31b4e0){_0x7e3b24[_0x648f('0x46')]=_0x31b4e0;return _0x7e3b24;})[_0x648f('0x25')](respondWithFilteredResult(_0x1864a1,_0x5089e1))[_0x648f('0x47')](handleError(_0x1864a1,null));};exports[_0x648f('0x48')]=function(_0x53fab7,_0x2ca620){var _0x5be8d5={'raw':!![],'where':{'id':_0x53fab7[_0x648f('0x49')]['id']}},_0x5b8e33={};_0x5b8e33['model']=_['keys'](db[_0x648f('0x43')][_0x648f('0x2e')]);_0x5b8e33['query']=_['keys'](_0x53fab7['query']);_0x5b8e33[_0x648f('0x35')]=_[_0x648f('0x36')](_0x5b8e33[_0x648f('0x32')],_0x5b8e33[_0x648f('0x34')]);_0x5be8d5['attributes']=_[_0x648f('0x36')](_0x5b8e33['model'],qs['fields'](_0x53fab7[_0x648f('0x34')][_0x648f('0x37')]));_0x5be8d5['attributes']=_0x5be8d5[_0x648f('0x38')]['length']?_0x5be8d5[_0x648f('0x38')]:_0x5b8e33[_0x648f('0x32')];if(_0x53fab7[_0x648f('0x34')][_0x648f('0x44')]){_0x5be8d5[_0x648f('0x4a')]=[{'all':!![]}];}_0x5be8d5=_['merge']({},_0x5be8d5,_0x53fab7['options']);return db[_0x648f('0x43')][_0x648f('0x4b')](_0x5be8d5)[_0x648f('0x25')](handleEntityNotFound(_0x2ca620,null))[_0x648f('0x25')](respondWithResult(_0x2ca620,null))[_0x648f('0x47')](handleError(_0x2ca620,null));};exports['create']=function(_0x1f151d,_0x357b70){return db[_0x648f('0x43')]['create'](_0x1f151d[_0x648f('0x4c')],{})['then'](respondWithResult(_0x357b70,0xc9))['catch'](handleError(_0x357b70,null));};exports[_0x648f('0x24')]=function(_0x49ef26,_0x14887a){if(_0x49ef26[_0x648f('0x4c')]['id']){delete _0x49ef26[_0x648f('0x4c')]['id'];}return db['FaxApplication'][_0x648f('0x4b')]({'where':{'id':_0x49ef26[_0x648f('0x49')]['id']}})['then'](handleEntityNotFound(_0x14887a,null))[_0x648f('0x25')](saveUpdates(_0x49ef26[_0x648f('0x4c')],null))[_0x648f('0x25')](respondWithResult(_0x14887a,null))[_0x648f('0x47')](handleError(_0x14887a,null));};exports[_0x648f('0x26')]=function(_0x261b06,_0x43a6b9){return db['FaxApplication'][_0x648f('0x4b')]({'where':{'id':_0x261b06[_0x648f('0x49')]['id']}})['then'](handleEntityNotFound(_0x43a6b9,null))['then'](removeEntity(_0x43a6b9,null))[_0x648f('0x47')](handleError(_0x43a6b9,null));}; \ No newline at end of file +var _0x4d16=['params','keys','create','body','update','find','catch','rimraf','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','save','then','destroy','error','stack','name','index','map','FaxApplication','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','show'];(function(_0x45d701,_0x4bd446){var _0x310b04=function(_0x12128e){while(--_0x12128e){_0x45d701['push'](_0x45d701['shift']());}};_0x310b04(++_0x4bd446);}(_0x4d16,0x95));var _0x64d1=function(_0x8baf19,_0x3950a5){_0x8baf19=_0x8baf19-0x0;var _0x29f744=_0x4d16[_0x8baf19];return _0x29f744;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x64d1('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x64d1('0x1'));var moment=require(_0x64d1('0x2'));var BPromise=require(_0x64d1('0x3'));var Mustache=require('mustache');var util=require(_0x64d1('0x4'));var path=require(_0x64d1('0x5'));var sox=require(_0x64d1('0x6'));var csv=require('to-csv');var ejs=require(_0x64d1('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x64d1('0x8'));var squel=require(_0x64d1('0x9'));var crypto=require(_0x64d1('0xa'));var jsforce=require(_0x64d1('0xb'));var deskjs=require(_0x64d1('0xc'));var toCsv=require(_0x64d1('0xd'));var querystring=require(_0x64d1('0xe'));var Papa=require('papaparse');var Redis=require(_0x64d1('0xf'));var authService=require(_0x64d1('0x10'));var qs=require(_0x64d1('0x11'));var as=require(_0x64d1('0x12'));var hardwareService=require(_0x64d1('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x64d1('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x64d1('0x15'))['db'];function respondWithStatusCode(_0x2f0105,_0x2794d0){_0x2794d0=_0x2794d0||0xcc;return function(_0x464d42){if(_0x464d42){return _0x2f0105[_0x64d1('0x16')](_0x2794d0);}return _0x2f0105[_0x64d1('0x17')](_0x2794d0)[_0x64d1('0x18')]();};}function respondWithResult(_0x34d8ea,_0x4f250e){_0x4f250e=_0x4f250e||0xc8;return function(_0x37957f){if(_0x37957f){return _0x34d8ea[_0x64d1('0x17')](_0x4f250e)[_0x64d1('0x19')](_0x37957f);}};}function respondWithFilteredResult(_0x38da98,_0x51782f){return function(_0x2e2c2b){if(_0x2e2c2b){var _0x574238=typeof _0x51782f[_0x64d1('0x1a')]==='undefined'&&typeof _0x51782f[_0x64d1('0x1b')]===_0x64d1('0x1c');var _0x5d5b07=_0x2e2c2b[_0x64d1('0x1d')];var _0x1bc7ff=_0x574238?0x0:_0x51782f[_0x64d1('0x1a')];var _0xea0862=_0x574238?_0x2e2c2b['count']:_0x51782f[_0x64d1('0x1a')]+_0x51782f[_0x64d1('0x1b')];var _0x2b1753;if(_0xea0862>=_0x5d5b07){_0xea0862=_0x5d5b07;_0x2b1753=0xc8;}else{_0x2b1753=0xce;}_0x38da98[_0x64d1('0x17')](_0x2b1753);return _0x38da98[_0x64d1('0x1e')](_0x64d1('0x1f'),_0x1bc7ff+'-'+_0xea0862+'/'+_0x5d5b07)[_0x64d1('0x19')](_0x2e2c2b);}return null;};}function patchUpdates(_0x44bc5c){return function(_0x29a5f8){try{jsonpatch['apply'](_0x29a5f8,_0x44bc5c,!![]);}catch(_0x3bc713){return BPromise['reject'](_0x3bc713);}return _0x29a5f8[_0x64d1('0x20')]();};}function saveUpdates(_0x4b83f8,_0x537f4a){return function(_0x316085){if(_0x316085){return _0x316085['update'](_0x4b83f8)[_0x64d1('0x21')](function(_0xc935d7){return _0xc935d7;});}return null;};}function removeEntity(_0x1dd5dc,_0x41aa60){return function(_0x23589){if(_0x23589){return _0x23589[_0x64d1('0x22')]()[_0x64d1('0x21')](function(){_0x1dd5dc[_0x64d1('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5262a5,_0x1440b9){return function(_0x9b36a9){if(!_0x9b36a9){_0x5262a5[_0x64d1('0x16')](0x194);}return _0x9b36a9;};}function handleError(_0x281e8a,_0x10eb94){_0x10eb94=_0x10eb94||0x1f4;return function(_0x204124){logger[_0x64d1('0x23')](_0x204124[_0x64d1('0x24')]);if(_0x204124[_0x64d1('0x25')]){delete _0x204124[_0x64d1('0x25')];}_0x281e8a['status'](_0x10eb94)['send'](_0x204124);};}exports[_0x64d1('0x26')]=function(_0x4f2b35,_0x34eddc){var _0x30672d={},_0xa098c4={},_0x130093={'count':0x0,'rows':[]};var _0x37e6e8=_[_0x64d1('0x27')](db[_0x64d1('0x28')][_0x64d1('0x29')],function(_0x2cb6c0){return{'name':_0x2cb6c0['fieldName'],'type':_0x2cb6c0['type'][_0x64d1('0x2a')]};});_0xa098c4[_0x64d1('0x2b')]=_[_0x64d1('0x27')](_0x37e6e8,'name');_0xa098c4[_0x64d1('0x2c')]=_['keys'](_0x4f2b35[_0x64d1('0x2c')]);_0xa098c4[_0x64d1('0x2d')]=_[_0x64d1('0x2e')](_0xa098c4[_0x64d1('0x2b')],_0xa098c4[_0x64d1('0x2c')]);_0x30672d[_0x64d1('0x2f')]=_[_0x64d1('0x2e')](_0xa098c4[_0x64d1('0x2b')],qs[_0x64d1('0x30')](_0x4f2b35[_0x64d1('0x2c')][_0x64d1('0x30')]));_0x30672d[_0x64d1('0x2f')]=_0x30672d[_0x64d1('0x2f')][_0x64d1('0x31')]?_0x30672d[_0x64d1('0x2f')]:_0xa098c4[_0x64d1('0x2b')];if(!_0x4f2b35['query'][_0x64d1('0x32')](_0x64d1('0x33'))){_0x30672d[_0x64d1('0x1b')]=qs[_0x64d1('0x1b')](_0x4f2b35[_0x64d1('0x2c')][_0x64d1('0x1b')]);_0x30672d[_0x64d1('0x1a')]=qs[_0x64d1('0x1a')](_0x4f2b35['query'][_0x64d1('0x1a')]);}_0x30672d[_0x64d1('0x34')]=qs[_0x64d1('0x35')](_0x4f2b35[_0x64d1('0x2c')]['sort']);_0x30672d[_0x64d1('0x36')]=qs['filters'](_['pick'](_0x4f2b35[_0x64d1('0x2c')],_0xa098c4[_0x64d1('0x2d')]),_0x37e6e8);if(_0x4f2b35['query']['filter']){_0x30672d['where']=_[_0x64d1('0x37')](_0x30672d[_0x64d1('0x36')],{'$or':_['map'](_0x37e6e8,function(_0xae1cc4){if(_0xae1cc4[_0x64d1('0x38')]!==_0x64d1('0x39')){var _0x9d3fda={};_0x9d3fda[_0xae1cc4[_0x64d1('0x25')]]={'$like':'%'+_0x4f2b35[_0x64d1('0x2c')][_0x64d1('0x3a')]+'%'};return _0x9d3fda;}})});}_0x30672d=_[_0x64d1('0x37')]({},_0x30672d,_0x4f2b35[_0x64d1('0x3b')]);var _0xf34246={'where':_0x30672d[_0x64d1('0x36')]};return db['FaxApplication'][_0x64d1('0x1d')](_0xf34246)['then'](function(_0x93b7d0){_0x130093[_0x64d1('0x1d')]=_0x93b7d0;if(_0x4f2b35[_0x64d1('0x2c')][_0x64d1('0x3c')]){_0x30672d[_0x64d1('0x3d')]=[{'all':!![]}];}return db[_0x64d1('0x28')][_0x64d1('0x3e')](_0x30672d);})[_0x64d1('0x21')](function(_0x439bd7){_0x130093['rows']=_0x439bd7;return _0x130093;})[_0x64d1('0x21')](respondWithFilteredResult(_0x34eddc,_0x30672d))['catch'](handleError(_0x34eddc,null));};exports[_0x64d1('0x3f')]=function(_0x59961d,_0x4c773f){var _0x227353={'raw':!![],'where':{'id':_0x59961d[_0x64d1('0x40')]['id']}},_0x5de0ca={};_0x5de0ca[_0x64d1('0x2b')]=_['keys'](db[_0x64d1('0x28')]['rawAttributes']);_0x5de0ca[_0x64d1('0x2c')]=_[_0x64d1('0x41')](_0x59961d['query']);_0x5de0ca[_0x64d1('0x2d')]=_['intersection'](_0x5de0ca[_0x64d1('0x2b')],_0x5de0ca[_0x64d1('0x2c')]);_0x227353['attributes']=_['intersection'](_0x5de0ca['model'],qs[_0x64d1('0x30')](_0x59961d['query']['fields']));_0x227353[_0x64d1('0x2f')]=_0x227353[_0x64d1('0x2f')][_0x64d1('0x31')]?_0x227353[_0x64d1('0x2f')]:_0x5de0ca[_0x64d1('0x2b')];if(_0x59961d[_0x64d1('0x2c')]['includeAll']){_0x227353['include']=[{'all':!![]}];}_0x227353=_['merge']({},_0x227353,_0x59961d[_0x64d1('0x3b')]);return db[_0x64d1('0x28')]['find'](_0x227353)[_0x64d1('0x21')](handleEntityNotFound(_0x4c773f,null))[_0x64d1('0x21')](respondWithResult(_0x4c773f,null))['catch'](handleError(_0x4c773f,null));};exports[_0x64d1('0x42')]=function(_0x309d02,_0x328387){return db['FaxApplication']['create'](_0x309d02[_0x64d1('0x43')],{})[_0x64d1('0x21')](respondWithResult(_0x328387,0xc9))['catch'](handleError(_0x328387,null));};exports[_0x64d1('0x44')]=function(_0x39808f,_0x3dfb83){if(_0x39808f[_0x64d1('0x43')]['id']){delete _0x39808f[_0x64d1('0x43')]['id'];}return db['FaxApplication']['find']({'where':{'id':_0x39808f['params']['id']}})[_0x64d1('0x21')](handleEntityNotFound(_0x3dfb83,null))[_0x64d1('0x21')](saveUpdates(_0x39808f[_0x64d1('0x43')],null))['then'](respondWithResult(_0x3dfb83,null))['catch'](handleError(_0x3dfb83,null));};exports[_0x64d1('0x22')]=function(_0x148bd4,_0x16658b){return db[_0x64d1('0x28')][_0x64d1('0x45')]({'where':{'id':_0x148bd4[_0x64d1('0x40')]['id']}})[_0x64d1('0x21')](handleEntityNotFound(_0x16658b,null))[_0x64d1('0x21')](removeEntity(_0x16658b,null))[_0x64d1('0x46')](handleError(_0x16658b,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index b68a1af..3f0fe27 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 _0x2152=['./faxApplication.attributes','exports','define','FaxApplication','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x99b4e1,_0x30611b){var _0x24e4e4=function(_0xcf5f67){while(--_0xcf5f67){_0x99b4e1['push'](_0x99b4e1['shift']());}};_0x24e4e4(++_0x30611b);}(_0x2152,0x1f0));var _0x2215=function(_0x177f95,_0x166fdc){_0x177f95=_0x177f95-0x0;var _0x2fc325=_0x2152[_0x177f95];return _0x2fc325;};'use strict';var _=require(_0x2215('0x0'));var util=require('util');var logger=require(_0x2215('0x1'))(_0x2215('0x2'));var moment=require(_0x2215('0x3'));var BPromise=require('bluebird');var rp=require(_0x2215('0x4'));var fs=require('fs');var path=require(_0x2215('0x5'));var rimraf=require(_0x2215('0x6'));var config=require(_0x2215('0x7'));var attributes=require(_0x2215('0x8'));module[_0x2215('0x9')]=function(_0x16b8d9,_0x25563a){return _0x16b8d9[_0x2215('0xa')](_0x2215('0xb'),attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2215('0xc'),'collate':_0x2215('0xd')});}; \ No newline at end of file +var _0xb51c=['./faxApplication.attributes','exports','define','FaxApplication','utf8mb4','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x315426,_0x1df681){var _0x126418=function(_0x2abc51){while(--_0x2abc51){_0x315426['push'](_0x315426['shift']());}};_0x126418(++_0x1df681);}(_0xb51c,0x17f));var _0xcb51=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xb51c[_0x3e112d];return _0x531c31;};'use strict';var _=require(_0xcb51('0x0'));var util=require(_0xcb51('0x1'));var logger=require('../../config/logger')(_0xcb51('0x2'));var moment=require(_0xcb51('0x3'));var BPromise=require(_0xcb51('0x4'));var rp=require(_0xcb51('0x5'));var fs=require('fs');var path=require(_0xcb51('0x6'));var rimraf=require(_0xcb51('0x7'));var config=require(_0xcb51('0x8'));var attributes=require(_0xcb51('0x9'));module[_0xcb51('0xa')]=function(_0x35688f,_0x22f5a2){return _0x35688f[_0xcb51('0xb')](_0xcb51('0xc'),attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xcb51('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 071bc1b..9281379 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 _0x6acc=['info','FaxApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','FaxApplication,\x20%s,\x20%s','message','catch','UpdateFaxApplication','body','options','raw','attributes','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x40fede,_0x203a11){var _0x482694=function(_0x4b7fa0){while(--_0x4b7fa0){_0x40fede['push'](_0x40fede['shift']());}};_0x482694(++_0x203a11);}(_0x6acc,0x1f3));var _0xc6ac=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x6acc[_0x5d6456];return _0x4d66c1;};'use strict';var _=require('lodash');var util=require(_0xc6ac('0x0'));var moment=require(_0xc6ac('0x1'));var BPromise=require(_0xc6ac('0x2'));var rs=require(_0xc6ac('0x3'));var fs=require('fs');var Redis=require(_0xc6ac('0x4'));var db=require(_0xc6ac('0x5'))['db'];var utils=require(_0xc6ac('0x6'));var logger=require(_0xc6ac('0x7'))(_0xc6ac('0x8'));var config=require(_0xc6ac('0x9'));var jayson=require(_0xc6ac('0xa'));var client=jayson[_0xc6ac('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2933de,_0x34c7f8,_0x57cf25){return new BPromise(function(_0x48d804,_0x533134){return client[_0xc6ac('0xc')](_0x2933de,_0x57cf25)[_0xc6ac('0xd')](function(_0x5cc2e7){logger[_0xc6ac('0xe')]('FaxApplication,\x20%s,\x20%s',_0x34c7f8,'request\x20sent');logger['debug'](_0xc6ac('0xf'),_0x34c7f8,_0xc6ac('0x10'),JSON[_0xc6ac('0x11')](_0x5cc2e7));if(_0x5cc2e7['error']){if(_0x5cc2e7['error']['code']===0x1f4){logger[_0xc6ac('0x12')](_0xc6ac('0x13'),_0x34c7f8,_0x5cc2e7['error'][_0xc6ac('0x14')]);return _0x533134(_0x5cc2e7[_0xc6ac('0x12')][_0xc6ac('0x14')]);}logger['error']('FaxApplication,\x20%s,\x20%s',_0x34c7f8,_0x5cc2e7['error'][_0xc6ac('0x14')]);return _0x48d804(_0x5cc2e7[_0xc6ac('0x12')][_0xc6ac('0x14')]);}else{logger['info'](_0xc6ac('0x13'),_0x34c7f8,'request\x20sent');_0x48d804(_0x5cc2e7['result']['message']);}})[_0xc6ac('0x15')](function(_0x554fa1){logger[_0xc6ac('0x12')](_0xc6ac('0x13'),_0x34c7f8,_0x554fa1);_0x533134(_0x554fa1);});});}exports[_0xc6ac('0x16')]=function(_0x545df6){var _0x4a6866=this;return new Promise(function(_0x1a2bb7,_0x20503c){return db['FaxApplication']['update'](_0x545df6[_0xc6ac('0x17')],{'raw':_0x545df6[_0xc6ac('0x18')]?_0x545df6[_0xc6ac('0x18')][_0xc6ac('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x545df6['options']?_0x545df6[_0xc6ac('0x18')]['where']||null:null,'attributes':_0x545df6[_0xc6ac('0x18')]?_0x545df6[_0xc6ac('0x18')][_0xc6ac('0x1a')]||null:null,'limit':_0x545df6[_0xc6ac('0x18')]?_0x545df6['options']['limit']||null:null})[_0xc6ac('0xd')](function(_0x4b2614){logger['info']('UpdateFaxApplication',_0x545df6);logger['debug'](_0xc6ac('0x16'),_0x545df6,JSON[_0xc6ac('0x11')](_0x4b2614));_0x1a2bb7(_0x4b2614);})[_0xc6ac('0x15')](function(_0x6ece83){logger['error'](_0xc6ac('0x16'),_0x6ece83[_0xc6ac('0x14')],_0x545df6);_0x20503c(_0x4a6866[_0xc6ac('0x12')](0x1f4,_0x6ece83[_0xc6ac('0x14')]));});});}; \ No newline at end of file +var _0x22e7=['error','message','result','catch','UpdateFaxApplication','FaxApplication','options','limit','moment','bluebird','randomstring','ioredis','../../config/utils','jayson/promise','client','http','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x12c330,_0x4de9b9){var _0x437110=function(_0x4666c2){while(--_0x4666c2){_0x12c330['push'](_0x12c330['shift']());}};_0x437110(++_0x4de9b9);}(_0x22e7,0x14a));var _0x722e=function(_0x289372,_0x21d5ba){_0x289372=_0x289372-0x0;var _0x3afd59=_0x22e7[_0x289372];return _0x3afd59;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x722e('0x0'));var BPromise=require(_0x722e('0x1'));var rs=require(_0x722e('0x2'));var fs=require('fs');var Redis=require(_0x722e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x722e('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x722e('0x5'));var client=jayson[_0x722e('0x6')][_0x722e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xadfd33,_0x2bb819,_0x2b4fd3){return new BPromise(function(_0x5f33b5,_0x1054f0){return client['request'](_0xadfd33,_0x2b4fd3)[_0x722e('0x8')](function(_0x1e4e39){logger[_0x722e('0x9')](_0x722e('0xa'),_0x2bb819,_0x722e('0xb'));logger[_0x722e('0xc')](_0x722e('0xd'),_0x2bb819,'request\x20sent',JSON[_0x722e('0xe')](_0x1e4e39));if(_0x1e4e39['error']){if(_0x1e4e39[_0x722e('0xf')]['code']===0x1f4){logger[_0x722e('0xf')](_0x722e('0xa'),_0x2bb819,_0x1e4e39[_0x722e('0xf')][_0x722e('0x10')]);return _0x1054f0(_0x1e4e39[_0x722e('0xf')][_0x722e('0x10')]);}logger['error'](_0x722e('0xa'),_0x2bb819,_0x1e4e39[_0x722e('0xf')][_0x722e('0x10')]);return _0x5f33b5(_0x1e4e39[_0x722e('0xf')][_0x722e('0x10')]);}else{logger[_0x722e('0x9')]('FaxApplication,\x20%s,\x20%s',_0x2bb819,_0x722e('0xb'));_0x5f33b5(_0x1e4e39[_0x722e('0x11')][_0x722e('0x10')]);}})[_0x722e('0x12')](function(_0x406852){logger[_0x722e('0xf')](_0x722e('0xa'),_0x2bb819,_0x406852);_0x1054f0(_0x406852);});});}exports[_0x722e('0x13')]=function(_0x2641dd){var _0x558a17=this;return new Promise(function(_0x17d090,_0x5a05f6){return db[_0x722e('0x14')]['update'](_0x2641dd['body'],{'raw':_0x2641dd['options']?_0x2641dd[_0x722e('0x15')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2641dd[_0x722e('0x15')]?_0x2641dd['options']['where']||null:null,'attributes':_0x2641dd[_0x722e('0x15')]?_0x2641dd[_0x722e('0x15')]['attributes']||null:null,'limit':_0x2641dd['options']?_0x2641dd[_0x722e('0x15')][_0x722e('0x16')]||null:null})[_0x722e('0x8')](function(_0x36b32b){logger[_0x722e('0x9')](_0x722e('0x13'),_0x2641dd);logger['debug'](_0x722e('0x13'),_0x2641dd,JSON[_0x722e('0xe')](_0x36b32b));_0x17d090(_0x36b32b);})[_0x722e('0x12')](function(_0x377680){logger[_0x722e('0xf')](_0x722e('0x13'),_0x377680[_0x722e('0x10')],_0x2641dd);_0x5a05f6(_0x558a17['error'](0x1f4,_0x377680[_0x722e('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 874bc06..091c92e 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(_0x3baaf2,_0x894e3d){var _0x50e8b0=function(_0x35dd6f){while(--_0x35dd6f){_0x3baaf2['push'](_0x3baaf2['shift']());}};_0x50e8b0(++_0x894e3d);}(_0x8603,0x190));var _0x3860=function(_0x36beac,_0x55a397){_0x36beac=_0x36beac-0x0;var _0x1ef5cb=_0x8603[_0x36beac];return _0x1ef5cb;};'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 _0xb7e7=['exports','multer','path','express','fs-extra','../../components/interaction/service','../../config/environment','./faxApplication.controller','index','get','/:id','show','post','isAuthenticated','create','put','delete','destroy'];(function(_0x258d18,_0x58fbe7){var _0x315a82=function(_0xf327aa){while(--_0xf327aa){_0x258d18['push'](_0x258d18['shift']());}};_0x315a82(++_0x58fbe7);}(_0xb7e7,0x121));var _0x7b7e=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0xb7e7[_0x4b2863];return _0x567d67;};'use strict';var multer=require(_0x7b7e('0x0'));var util=require('util');var path=require(_0x7b7e('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b7e('0x2'));var router=express['Router']();var fs_extra=require(_0x7b7e('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var controller=require(_0x7b7e('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x7b7e('0x7')]);router[_0x7b7e('0x8')](_0x7b7e('0x9'),auth['isAuthenticated'](),controller[_0x7b7e('0xa')]);router[_0x7b7e('0xb')]('/',auth[_0x7b7e('0xc')](),controller[_0x7b7e('0xd')]);router[_0x7b7e('0xe')](_0x7b7e('0x9'),auth[_0x7b7e('0xc')](),controller['update']);router[_0x7b7e('0xf')](_0x7b7e('0x9'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x10')]);module[_0x7b7e('0x11')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 5717536..de5c952 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 _0x1cbe=['exports','BOOLEAN','DATE','STRING','ENUM'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x1cbe,0xaf));var _0xe1cb=function(_0x4946da,_0x336a69){_0x4946da=_0x4946da-0x0;var _0x31a415=_0x1cbe[_0x4946da];return _0x31a415;};'use strict';var Sequelize=require('sequelize');module[_0xe1cb('0x0')]={'closed':{'type':Sequelize[_0xe1cb('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xe1cb('0x2')]},'disposition':{'type':Sequelize[_0xe1cb('0x3')]},'secondDisposition':{'type':Sequelize[_0xe1cb('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xe1cb('0x2')]},'fax':{'type':Sequelize[_0xe1cb('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xe1cb('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xe1cb('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xe1cb('0x4')]('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x8989=['exports','BOOLEAN','DATE','STRING','ENUM','out','sequelize'];(function(_0x5a778b,_0x717daa){var _0x32f0da=function(_0x546db4){while(--_0x546db4){_0x5a778b['push'](_0x5a778b['shift']());}};_0x32f0da(++_0x717daa);}(_0x8989,0x8b));var _0x9898=function(_0x36ccbf,_0x45a895){_0x36ccbf=_0x36ccbf-0x0;var _0x495ea0=_0x8989[_0x36ccbf];return _0x495ea0;};'use strict';var Sequelize=require(_0x9898('0x0'));module[_0x9898('0x1')]={'closed':{'type':Sequelize[_0x9898('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x9898('0x3')]},'disposition':{'type':Sequelize[_0x9898('0x4')]},'secondDisposition':{'type':Sequelize[_0x9898('0x4')]},'thirdDisposition':{'type':Sequelize[_0x9898('0x4')]},'note':{'type':Sequelize[_0x9898('0x4')]},'read1stAt':{'type':Sequelize[_0x9898('0x3')]},'fax':{'type':Sequelize[_0x9898('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x9898('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x9898('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x9898('0x5')]('in',_0x9898('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index cc7525d..15ab05b 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 _0x0bd2=['FaxInteraction','rawAttributes','type','findAll','fax','user','catch','show','params','model','keys','query','intersection','attributes','fields','length','includeAll','merge','create','body','find','describe','addMessage','FaxMessage','ids','getMessages','order','sort','filters','where','FaxInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','include','rows','setTags','omit','spread','color','emit','faxInteractionTags:save','removeTags','download','unix','toString','join','root','files','tmp','attachments','format','transcript-%d-%s.zip','push','Attachment','Messages','createdAt','get','basename','createReadStream','pipe','err','rimraf','zip-dir','moment','util','path','lodash','../../components/interaction/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','defaults','redis','localhost','./faxInteraction.socket','status','end','json','offset','limit','undefined','count','Content-Range','update','then','destroy','sendStatus','error','stack','name','index','map'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0bd2,0x15c));var _0x20bd=function(_0x1eda20,_0x1149f4){_0x1eda20=_0x1eda20-0x0;var _0x31b953=_0x0bd2[_0x1eda20];return _0x31b953;};'use strict';var rimraf=require(_0x20bd('0x0'));var zipdir=require(_0x20bd('0x1'));var moment=require(_0x20bd('0x2'));var BPromise=require('bluebird');var util=require(_0x20bd('0x3'));var path=require(_0x20bd('0x4'));var fs=require('fs');var _=require(_0x20bd('0x5'));var Redis=require('ioredis');var interaction=require(_0x20bd('0x6'));var qs=require(_0x20bd('0x7'));var logger=require(_0x20bd('0x8'))('api');var config=require(_0x20bd('0x9'));var db=require(_0x20bd('0xa'))['db'];config['redis']=_[_0x20bd('0xb')](config[_0x20bd('0xc')],{'host':_0x20bd('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x20bd('0xe'))['register'](socket);function respondWithStatusCode(_0x89d4ea,_0x2d0acd){_0x2d0acd=_0x2d0acd||0xcc;return function(_0x57dfff){if(_0x57dfff){return _0x89d4ea['sendStatus'](_0x2d0acd);}return _0x89d4ea[_0x20bd('0xf')](_0x2d0acd)[_0x20bd('0x10')]();};}function respondWithResult(_0x4923ef,_0x5f51f1){_0x5f51f1=_0x5f51f1||0xc8;return function(_0x6b3806){if(_0x6b3806){return _0x4923ef['status'](_0x5f51f1)[_0x20bd('0x11')](_0x6b3806);}};}function respondWithFilteredResult(_0x5a0071,_0x1b98a2){return function(_0x25e9e0){if(_0x25e9e0){var _0x2bc368=typeof _0x1b98a2[_0x20bd('0x12')]==='undefined'&&typeof _0x1b98a2[_0x20bd('0x13')]===_0x20bd('0x14');var _0x14020e=_0x25e9e0[_0x20bd('0x15')];var _0x2a69a5=_0x2bc368?0x0:_0x1b98a2[_0x20bd('0x12')];var _0x1fbcd4=_0x2bc368?_0x25e9e0[_0x20bd('0x15')]:_0x1b98a2[_0x20bd('0x12')]+_0x1b98a2[_0x20bd('0x13')];var _0x52affd;if(_0x1fbcd4>=_0x14020e){_0x1fbcd4=_0x14020e;_0x52affd=0xc8;}else{_0x52affd=0xce;}_0x5a0071[_0x20bd('0xf')](_0x52affd);return _0x5a0071['set'](_0x20bd('0x16'),_0x2a69a5+'-'+_0x1fbcd4+'/'+_0x14020e)[_0x20bd('0x11')](_0x25e9e0);}return null;};}function saveUpdates(_0x4ac7a0){return function(_0x144329){if(_0x144329){return _0x144329[_0x20bd('0x17')](_0x4ac7a0)[_0x20bd('0x18')](function(_0x20e88e){return _0x20e88e;});}return null;};}function removeEntity(_0x5a8d4a){return function(_0x17ac8a){if(_0x17ac8a){return _0x17ac8a[_0x20bd('0x19')]()[_0x20bd('0x18')](function(){_0x5a8d4a[_0x20bd('0xf')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5cb1ae){return function(_0x461e17){if(!_0x461e17){_0x5cb1ae[_0x20bd('0x1a')](0x194);}return _0x461e17;};}function handleError(_0x21c667,_0x34cb51){_0x34cb51=_0x34cb51||0x1f4;return function(_0x1ab4d4){logger[_0x20bd('0x1b')](_0x1ab4d4[_0x20bd('0x1c')]);if(_0x1ab4d4['name']){delete _0x1ab4d4[_0x20bd('0x1d')];}_0x21c667[_0x20bd('0xf')](_0x34cb51)['send'](_0x1ab4d4);};}exports[_0x20bd('0x1e')]=function(_0x234a23,_0x43724b){var _0x57d5b7={};var _0x5261dc=_[_0x20bd('0x1f')](db[_0x20bd('0x20')][_0x20bd('0x21')],function(_0x57fb94){return{'name':_0x57fb94['fieldName'],'type':_0x57fb94[_0x20bd('0x22')]['key']};});_0x57d5b7=qs['getOptions'](_0x5261dc,_0x234a23);return interaction[_0x20bd('0x23')](_0x20bd('0x24'),_0x234a23['query'],_0x234a23[_0x20bd('0x25')],_0x57d5b7,_0x5261dc)[_0x20bd('0x18')](respondWithFilteredResult(_0x43724b,_0x57d5b7))[_0x20bd('0x26')](handleError(_0x43724b,null));};exports[_0x20bd('0x27')]=function(_0x2de0e9,_0x2fe081){var _0x2a29c3={'raw':![],'where':{'id':_0x2de0e9[_0x20bd('0x28')]['id']}},_0x25a712={};_0x25a712[_0x20bd('0x29')]=_[_0x20bd('0x2a')](db[_0x20bd('0x20')][_0x20bd('0x21')]);_0x25a712[_0x20bd('0x2b')]=_[_0x20bd('0x2a')](_0x2de0e9[_0x20bd('0x2b')]);_0x25a712['filters']=_[_0x20bd('0x2c')](_0x25a712[_0x20bd('0x29')],_0x25a712[_0x20bd('0x2b')]);_0x2a29c3[_0x20bd('0x2d')]=_[_0x20bd('0x2c')](_0x25a712[_0x20bd('0x29')],qs[_0x20bd('0x2e')](_0x2de0e9[_0x20bd('0x2b')][_0x20bd('0x2e')]));_0x2a29c3[_0x20bd('0x2d')]=_0x2a29c3[_0x20bd('0x2d')][_0x20bd('0x2f')]?_0x2a29c3[_0x20bd('0x2d')]:_0x25a712['model'];if(_0x2de0e9['query'][_0x20bd('0x30')]){_0x2a29c3['include']=[{'all':!![]}];}_0x2a29c3=_[_0x20bd('0x31')]({},_0x2a29c3,_0x2de0e9['options']);return db[_0x20bd('0x20')]['find'](_0x2a29c3)['then'](handleEntityNotFound(_0x2fe081,null))['then'](respondWithResult(_0x2fe081,null))['catch'](handleError(_0x2fe081,null));};exports[_0x20bd('0x32')]=function(_0x217a18,_0x595caf){return db[_0x20bd('0x20')]['create'](_0x217a18[_0x20bd('0x33')],{})['then'](respondWithResult(_0x595caf,0xc9))['catch'](handleError(_0x595caf,null));};exports[_0x20bd('0x17')]=function(_0x486cab,_0x462203){if(_0x486cab[_0x20bd('0x33')]['id']){delete _0x486cab[_0x20bd('0x33')]['id'];}return db['FaxInteraction'][_0x20bd('0x34')]({'where':{'id':_0x486cab[_0x20bd('0x28')]['id']}})['then'](handleEntityNotFound(_0x462203,null))[_0x20bd('0x18')](saveUpdates(_0x486cab['body'],null))[_0x20bd('0x18')](respondWithResult(_0x462203,null))[_0x20bd('0x26')](handleError(_0x462203,null));};exports['destroy']=function(_0x3aa8d6,_0x2b0f63){return db[_0x20bd('0x20')][_0x20bd('0x34')]({'where':{'id':_0x3aa8d6[_0x20bd('0x28')]['id']}})[_0x20bd('0x18')](handleEntityNotFound(_0x2b0f63,null))[_0x20bd('0x18')](removeEntity(_0x2b0f63,null))[_0x20bd('0x26')](handleError(_0x2b0f63,null));};exports['describe']=function(_0x2c3fb3,_0x19cfc7){return db[_0x20bd('0x20')][_0x20bd('0x35')]()['then'](respondWithResult(_0x19cfc7,null))[_0x20bd('0x26')](handleError(_0x19cfc7,null));};exports[_0x20bd('0x36')]=function(_0x30e31f,_0xc44a30){return db[_0x20bd('0x37')][_0x20bd('0x34')]({'where':{'id':_0x30e31f[_0x20bd('0x28')]['id']}})[_0x20bd('0x18')](handleEntityNotFound(_0xc44a30,null))['then'](function(_0xa339fa){if(_0xa339fa){return _0xa339fa[_0x20bd('0x36')](_0x30e31f[_0x20bd('0x33')][_0x20bd('0x38')],_['omit'](_0x30e31f[_0x20bd('0x33')],[_0x20bd('0x38'),'id'])||{});}})[_0x20bd('0x18')](respondWithResult(_0xc44a30,null))['catch'](handleError(_0xc44a30,null));};exports[_0x20bd('0x39')]=function(_0x401273,_0x591033){var _0x4acc22={'raw':![],'where':{}};var _0x46f1ef={};var _0x56d644={'count':0x0,'rows':[]};return db[_0x20bd('0x20')]['findOne']({'where':{'id':_0x401273['params']['id']}})['then'](handleEntityNotFound(_0x591033,null))[_0x20bd('0x18')](function(_0x58a0a4){if(_0x58a0a4){_0x46f1ef[_0x20bd('0x29')]=_['keys'](db[_0x20bd('0x37')][_0x20bd('0x21')]);_0x46f1ef[_0x20bd('0x2b')]=_[_0x20bd('0x2a')](_0x401273[_0x20bd('0x2b')]);_0x46f1ef['filters']=_['intersection'](_0x46f1ef[_0x20bd('0x29')],_0x46f1ef[_0x20bd('0x2b')]);_0x4acc22['attributes']=_[_0x20bd('0x2c')](_0x46f1ef[_0x20bd('0x29')],qs[_0x20bd('0x2e')](_0x401273[_0x20bd('0x2b')][_0x20bd('0x2e')]));_0x4acc22[_0x20bd('0x2d')]=_0x4acc22[_0x20bd('0x2d')][_0x20bd('0x2f')]?_0x4acc22[_0x20bd('0x2d')]:_0x46f1ef[_0x20bd('0x29')];if(!_0x401273[_0x20bd('0x2b')]['hasOwnProperty']('nolimit')){_0x4acc22[_0x20bd('0x13')]=qs[_0x20bd('0x13')](_0x401273[_0x20bd('0x2b')][_0x20bd('0x13')]);_0x4acc22['offset']=qs['offset'](_0x401273[_0x20bd('0x2b')][_0x20bd('0x12')]);}_0x4acc22[_0x20bd('0x3a')]=qs[_0x20bd('0x3b')](_0x401273['query'][_0x20bd('0x3b')]);_0x4acc22['where']=qs[_0x20bd('0x3c')](_['pick'](_0x401273[_0x20bd('0x2b')],_0x46f1ef['filters']));_0x4acc22[_0x20bd('0x3d')][_0x20bd('0x3e')]=_0x58a0a4['id'];if(_0x401273['query'][_0x20bd('0x3f')]){_0x4acc22[_0x20bd('0x3d')]=_[_0x20bd('0x31')](_0x4acc22[_0x20bd('0x3d')],{'$or':_[_0x20bd('0x1f')](_0x4acc22['attributes'],function(_0x5065a0){var _0x29f61b={};_0x29f61b[_0x5065a0]={'$like':'%'+_0x401273[_0x20bd('0x2b')][_0x20bd('0x3f')]+'%'};return _0x29f61b;})});}if(_0x401273[_0x20bd('0x2b')][_0x20bd('0x40')]){var _0x53700f=_0x401273[_0x20bd('0x2b')][_0x20bd('0x40')][_0x20bd('0x41')](',');var _0xe02b64={};_0xe02b64[_0x53700f[0x0]]={'$gte':moment(_0x53700f[0x1])['format'](_0x20bd('0x42'))};_0x4acc22['where']=_[_0x20bd('0x31')](_0x4acc22['where'],_0xe02b64);}_0x4acc22=_['merge']({},_0x4acc22,_0x401273['options']);return db[_0x20bd('0x37')][_0x20bd('0x15')]({'where':_0x4acc22[_0x20bd('0x3d')]})['then'](function(_0x2a8429){_0x56d644[_0x20bd('0x15')]=_0x2a8429;if(_0x401273[_0x20bd('0x2b')]['includeAll']){_0x4acc22[_0x20bd('0x43')]=[{'all':!![]}];}return db[_0x20bd('0x37')][_0x20bd('0x23')](_0x4acc22);})[_0x20bd('0x18')](function(_0x206e96){_0x56d644[_0x20bd('0x44')]=_0x206e96;return _0x56d644;});}})[_0x20bd('0x18')](respondWithFilteredResult(_0x591033,_0x4acc22))[_0x20bd('0x26')](handleError(_0x591033,null));};exports['addTags']=function(_0x1bbd1e,_0x3d8635){return db[_0x20bd('0x20')][_0x20bd('0x34')]({'where':{'id':_0x1bbd1e[_0x20bd('0x28')]['id']}})[_0x20bd('0x18')](handleEntityNotFound(_0x3d8635,null))[_0x20bd('0x18')](function(_0x2712e9){if(_0x2712e9){return _0x2712e9[_0x20bd('0x45')](_0x1bbd1e[_0x20bd('0x33')][_0x20bd('0x38')],_[_0x20bd('0x46')](_0x1bbd1e[_0x20bd('0x33')],[_0x20bd('0x38'),'id'])||{})[_0x20bd('0x47')](function(){return db['Tag'][_0x20bd('0x23')]({'attributes':['id','name',_0x20bd('0x48')],'where':{'id':_0x1bbd1e[_0x20bd('0x33')]['ids']}});})['then'](function(_0x506892){socket[_0x20bd('0x49')](_0x20bd('0x4a'),{'id':Number(_0x1bbd1e[_0x20bd('0x28')]['id']),'tags':_0x506892||[]});return{'id':Number(_0x1bbd1e[_0x20bd('0x28')]['id']),'tags':_0x506892||[]};});}})[_0x20bd('0x18')](respondWithResult(_0x3d8635,null))['catch'](handleError(_0x3d8635,null));};exports[_0x20bd('0x4b')]=function(_0x4e5d84,_0x3a0fca){return db[_0x20bd('0x20')][_0x20bd('0x34')]({'where':{'id':_0x4e5d84['params']['id']}})['then'](handleEntityNotFound(_0x3a0fca,null))[_0x20bd('0x18')](function(_0x457141){if(_0x457141){return _0x457141[_0x20bd('0x4b')](_0x4e5d84['query']['ids']);}})[_0x20bd('0x18')](respondWithStatusCode(_0x3a0fca,null))[_0x20bd('0x26')](handleError(_0x3a0fca,null));};exports[_0x20bd('0x4c')]=function(_0x59313e,_0x2cc972){var _0x475614=moment()[_0x20bd('0x4d')]()[_0x20bd('0x4e')]();var _0x4ff817=path[_0x20bd('0x4f')](config[_0x20bd('0x50')],'server',_0x20bd('0x51'),_0x20bd('0x52'));var _0x27d448=path[_0x20bd('0x4f')](config['root'],'server',_0x20bd('0x51'),_0x20bd('0x53'));var _0x20db9c=path[_0x20bd('0x4f')](_0x4ff817,_0x475614);var _0x368632=util[_0x20bd('0x54')](_0x20bd('0x55'),_0x59313e['params']['id'],_0x475614);var _0x5734aa=path['join'](_0x4ff817,_0x368632);var _0x902606=[];_0x902606[_0x20bd('0x56')]({'model':db[_0x20bd('0x57')],'as':'Attachment','raw':!![]});var _0x218828=[{'model':db[_0x20bd('0x37')],'as':_0x20bd('0x58'),'attributes':['id',_0x20bd('0x33'),_0x20bd('0x59')],'include':_0x902606}];return db[_0x20bd('0x20')][_0x20bd('0x34')]({'where':{'id':_0x59313e[_0x20bd('0x28')]['id']},'include':_0x218828})[_0x20bd('0x18')](handleEntityNotFound(_0x2cc972,null))[_0x20bd('0x18')](function(_0x106fa3){if(_0x106fa3&&_0x106fa3[_0x20bd('0x58')]){var _0x4d9de5=_0x106fa3[_0x20bd('0x5a')]({'plain':!![]});fs['mkdirSync'](_0x20db9c);for(var _0x5f1fdd=0x0;_0x5f1fdd<_0x4d9de5[_0x20bd('0x58')][_0x20bd('0x2f')];_0x5f1fdd++){var _0x2de7f7=_0x4d9de5[_0x20bd('0x58')][_0x5f1fdd][_0x20bd('0x57')];if(_0x2de7f7){var _0x1c9db2=path[_0x20bd('0x4f')](_0x27d448,_0x2de7f7[_0x20bd('0x5b')]);if(fs['existsSync'](_0x1c9db2)){fs[_0x20bd('0x5c')](_0x1c9db2)[_0x20bd('0x5d')](fs['createWriteStream'](path[_0x20bd('0x4f')](_0x20db9c,_0x2de7f7['basename'])));}}}return BPromise['resolve']()['then'](function(){return new BPromise(function(_0x24a794,_0x1353e2){zipdir(_0x20db9c,{'saveTo':_0x5734aa},function(_0x2bc5e3,_0x2e3b7c){if(_0x2bc5e3)return _0x1353e2(_0x2bc5e3);return _0x24a794(_0x2e3b7c);});})[_0x20bd('0x18')](function(){return new BPromise(function(_0x49c40a,_0x32cbaf){rimraf(_0x20db9c,function(_0x293017){if(_0x293017)_0x32cbaf(_0x293017);return _0x49c40a();});});})[_0x20bd('0x18')](function(){return _0x2cc972['download'](_0x5734aa,_0x368632,function(_0x5e95b5){if(_0x5e95b5){console['log'](_0x20bd('0x5e'),_0x5e95b5);}else{fs['unlinkSync'](_0x5734aa);}});});});}else{return _0x2cc972['sendStatus'](0xc8);}})[_0x20bd('0x26')](handleError(_0x2cc972,null));}; \ No newline at end of file +var _0x86a0=['zip-dir','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','sendStatus','end','status','json','undefined','limit','set','update','then','error','stack','name','send','index','map','FaxInteraction','rawAttributes','fieldName','key','getOptions','findAll','fax','query','user','show','params','model','keys','filters','intersection','fields','attributes','length','includeAll','merge','options','catch','create','body','find','destroy','describe','addMessage','FaxMessage','ids','omit','getMessages','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','include','rows','addTags','Tag','color','emit','faxInteractionTags:save','removeTags','download','unix','toString','tmp','join','root','server','attachments','transcript-%d-%s.zip','push','Attachment','Messages','createdAt','get','mkdirSync','basename','existsSync','pipe','createWriteStream','resolve','log','err','unlinkSync','rimraf'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0x86a0,0x6a));var _0x086a=function(_0x430fbe,_0x89b1a6){_0x430fbe=_0x430fbe-0x0;var _0x1a1f31=_0x86a0[_0x430fbe];return _0x1a1f31;};'use strict';var rimraf=require(_0x086a('0x0'));var zipdir=require(_0x086a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var util=require(_0x086a('0x2'));var path=require(_0x086a('0x3'));var fs=require('fs');var _=require(_0x086a('0x4'));var Redis=require(_0x086a('0x5'));var interaction=require(_0x086a('0x6'));var qs=require(_0x086a('0x7'));var logger=require(_0x086a('0x8'))(_0x086a('0x9'));var config=require(_0x086a('0xa'));var db=require(_0x086a('0xb'))['db'];config[_0x086a('0xc')]=_[_0x086a('0xd')](config['redis'],{'host':_0x086a('0xe'),'port':0x18eb});var socket=require(_0x086a('0xf'))(new Redis(config[_0x086a('0xc')]));require(_0x086a('0x10'))['register'](socket);function respondWithStatusCode(_0x49ee6e,_0x2dcaf0){_0x2dcaf0=_0x2dcaf0||0xcc;return function(_0x4c2abf){if(_0x4c2abf){return _0x49ee6e[_0x086a('0x11')](_0x2dcaf0);}return _0x49ee6e['status'](_0x2dcaf0)[_0x086a('0x12')]();};}function respondWithResult(_0x4bc8c8,_0x479d80){_0x479d80=_0x479d80||0xc8;return function(_0x27dd4a){if(_0x27dd4a){return _0x4bc8c8[_0x086a('0x13')](_0x479d80)[_0x086a('0x14')](_0x27dd4a);}};}function respondWithFilteredResult(_0x430ba2,_0x250661){return function(_0x6674b3){if(_0x6674b3){var _0x4a788b=typeof _0x250661['offset']===_0x086a('0x15')&&typeof _0x250661[_0x086a('0x16')]===_0x086a('0x15');var _0x1f58dc=_0x6674b3['count'];var _0x28cbb6=_0x4a788b?0x0:_0x250661['offset'];var _0x67b91d=_0x4a788b?_0x6674b3['count']:_0x250661['offset']+_0x250661[_0x086a('0x16')];var _0x4c56f4;if(_0x67b91d>=_0x1f58dc){_0x67b91d=_0x1f58dc;_0x4c56f4=0xc8;}else{_0x4c56f4=0xce;}_0x430ba2[_0x086a('0x13')](_0x4c56f4);return _0x430ba2[_0x086a('0x17')]('Content-Range',_0x28cbb6+'-'+_0x67b91d+'/'+_0x1f58dc)['json'](_0x6674b3);}return null;};}function saveUpdates(_0x354e62){return function(_0x17bc6e){if(_0x17bc6e){return _0x17bc6e[_0x086a('0x18')](_0x354e62)[_0x086a('0x19')](function(_0x1feadd){return _0x1feadd;});}return null;};}function removeEntity(_0x38fccb){return function(_0x47d8fb){if(_0x47d8fb){return _0x47d8fb['destroy']()[_0x086a('0x19')](function(){_0x38fccb[_0x086a('0x13')](0xcc)[_0x086a('0x12')]();});}};}function handleEntityNotFound(_0x24aae0){return function(_0x1892b9){if(!_0x1892b9){_0x24aae0['sendStatus'](0x194);}return _0x1892b9;};}function handleError(_0x234ba2,_0x2d3de7){_0x2d3de7=_0x2d3de7||0x1f4;return function(_0x21c70e){logger[_0x086a('0x1a')](_0x21c70e[_0x086a('0x1b')]);if(_0x21c70e[_0x086a('0x1c')]){delete _0x21c70e[_0x086a('0x1c')];}_0x234ba2[_0x086a('0x13')](_0x2d3de7)[_0x086a('0x1d')](_0x21c70e);};}exports[_0x086a('0x1e')]=function(_0x5e1d11,_0x335a2d){var _0x44fcd0={};var _0x4d2b6f=_[_0x086a('0x1f')](db[_0x086a('0x20')][_0x086a('0x21')],function(_0x4a6921){return{'name':_0x4a6921[_0x086a('0x22')],'type':_0x4a6921['type'][_0x086a('0x23')]};});_0x44fcd0=qs[_0x086a('0x24')](_0x4d2b6f,_0x5e1d11);return interaction[_0x086a('0x25')](_0x086a('0x26'),_0x5e1d11[_0x086a('0x27')],_0x5e1d11[_0x086a('0x28')],_0x44fcd0,_0x4d2b6f)[_0x086a('0x19')](respondWithFilteredResult(_0x335a2d,_0x44fcd0))['catch'](handleError(_0x335a2d,null));};exports[_0x086a('0x29')]=function(_0x11e108,_0x25cc6f){var _0x1f006a={'raw':![],'where':{'id':_0x11e108[_0x086a('0x2a')]['id']}},_0x30cbab={};_0x30cbab[_0x086a('0x2b')]=_['keys'](db[_0x086a('0x20')][_0x086a('0x21')]);_0x30cbab[_0x086a('0x27')]=_[_0x086a('0x2c')](_0x11e108[_0x086a('0x27')]);_0x30cbab[_0x086a('0x2d')]=_[_0x086a('0x2e')](_0x30cbab[_0x086a('0x2b')],_0x30cbab[_0x086a('0x27')]);_0x1f006a['attributes']=_[_0x086a('0x2e')](_0x30cbab['model'],qs[_0x086a('0x2f')](_0x11e108[_0x086a('0x27')][_0x086a('0x2f')]));_0x1f006a[_0x086a('0x30')]=_0x1f006a[_0x086a('0x30')][_0x086a('0x31')]?_0x1f006a[_0x086a('0x30')]:_0x30cbab[_0x086a('0x2b')];if(_0x11e108[_0x086a('0x27')][_0x086a('0x32')]){_0x1f006a['include']=[{'all':!![]}];}_0x1f006a=_[_0x086a('0x33')]({},_0x1f006a,_0x11e108[_0x086a('0x34')]);return db[_0x086a('0x20')]['find'](_0x1f006a)['then'](handleEntityNotFound(_0x25cc6f,null))[_0x086a('0x19')](respondWithResult(_0x25cc6f,null))[_0x086a('0x35')](handleError(_0x25cc6f,null));};exports[_0x086a('0x36')]=function(_0x184b7d,_0x4d0815){return db[_0x086a('0x20')][_0x086a('0x36')](_0x184b7d[_0x086a('0x37')],{})['then'](respondWithResult(_0x4d0815,0xc9))[_0x086a('0x35')](handleError(_0x4d0815,null));};exports[_0x086a('0x18')]=function(_0x2a53a2,_0x4a7ec2){if(_0x2a53a2[_0x086a('0x37')]['id']){delete _0x2a53a2[_0x086a('0x37')]['id'];}return db[_0x086a('0x20')][_0x086a('0x38')]({'where':{'id':_0x2a53a2[_0x086a('0x2a')]['id']}})[_0x086a('0x19')](handleEntityNotFound(_0x4a7ec2,null))[_0x086a('0x19')](saveUpdates(_0x2a53a2[_0x086a('0x37')],null))[_0x086a('0x19')](respondWithResult(_0x4a7ec2,null))['catch'](handleError(_0x4a7ec2,null));};exports[_0x086a('0x39')]=function(_0x1933c1,_0x2c16b8){return db[_0x086a('0x20')][_0x086a('0x38')]({'where':{'id':_0x1933c1[_0x086a('0x2a')]['id']}})[_0x086a('0x19')](handleEntityNotFound(_0x2c16b8,null))[_0x086a('0x19')](removeEntity(_0x2c16b8,null))['catch'](handleError(_0x2c16b8,null));};exports[_0x086a('0x3a')]=function(_0x2f3ccb,_0x4561cc){return db['FaxInteraction'][_0x086a('0x3a')]()[_0x086a('0x19')](respondWithResult(_0x4561cc,null))[_0x086a('0x35')](handleError(_0x4561cc,null));};exports[_0x086a('0x3b')]=function(_0x16ad0b,_0x334a95){return db[_0x086a('0x3c')]['find']({'where':{'id':_0x16ad0b[_0x086a('0x2a')]['id']}})[_0x086a('0x19')](handleEntityNotFound(_0x334a95,null))[_0x086a('0x19')](function(_0x23f667){if(_0x23f667){return _0x23f667[_0x086a('0x3b')](_0x16ad0b[_0x086a('0x37')][_0x086a('0x3d')],_[_0x086a('0x3e')](_0x16ad0b[_0x086a('0x37')],['ids','id'])||{});}})[_0x086a('0x19')](respondWithResult(_0x334a95,null))[_0x086a('0x35')](handleError(_0x334a95,null));};exports[_0x086a('0x3f')]=function(_0x2b11e9,_0x4fc33a){var _0x3cb11a={'raw':![],'where':{}};var _0x4bb25d={};var _0x18ee43={'count':0x0,'rows':[]};return db['FaxInteraction']['findOne']({'where':{'id':_0x2b11e9[_0x086a('0x2a')]['id']}})['then'](handleEntityNotFound(_0x4fc33a,null))[_0x086a('0x19')](function(_0x1a1cc4){if(_0x1a1cc4){_0x4bb25d[_0x086a('0x2b')]=_[_0x086a('0x2c')](db['FaxMessage'][_0x086a('0x21')]);_0x4bb25d[_0x086a('0x27')]=_[_0x086a('0x2c')](_0x2b11e9[_0x086a('0x27')]);_0x4bb25d[_0x086a('0x2d')]=_['intersection'](_0x4bb25d[_0x086a('0x2b')],_0x4bb25d['query']);_0x3cb11a[_0x086a('0x30')]=_['intersection'](_0x4bb25d[_0x086a('0x2b')],qs['fields'](_0x2b11e9[_0x086a('0x27')]['fields']));_0x3cb11a[_0x086a('0x30')]=_0x3cb11a[_0x086a('0x30')][_0x086a('0x31')]?_0x3cb11a['attributes']:_0x4bb25d['model'];if(!_0x2b11e9['query'][_0x086a('0x40')](_0x086a('0x41'))){_0x3cb11a[_0x086a('0x16')]=qs[_0x086a('0x16')](_0x2b11e9[_0x086a('0x27')][_0x086a('0x16')]);_0x3cb11a[_0x086a('0x42')]=qs[_0x086a('0x42')](_0x2b11e9[_0x086a('0x27')][_0x086a('0x42')]);}_0x3cb11a[_0x086a('0x43')]=qs['sort'](_0x2b11e9[_0x086a('0x27')][_0x086a('0x44')]);_0x3cb11a[_0x086a('0x45')]=qs[_0x086a('0x2d')](_[_0x086a('0x46')](_0x2b11e9[_0x086a('0x27')],_0x4bb25d[_0x086a('0x2d')]));_0x3cb11a[_0x086a('0x45')]['FaxInteractionId']=_0x1a1cc4['id'];if(_0x2b11e9[_0x086a('0x27')][_0x086a('0x47')]){_0x3cb11a[_0x086a('0x45')]=_[_0x086a('0x33')](_0x3cb11a[_0x086a('0x45')],{'$or':_[_0x086a('0x1f')](_0x3cb11a[_0x086a('0x30')],function(_0x5f1993){var _0x61d0e1={};_0x61d0e1[_0x5f1993]={'$like':'%'+_0x2b11e9[_0x086a('0x27')][_0x086a('0x47')]+'%'};return _0x61d0e1;})});}if(_0x2b11e9['query'][_0x086a('0x48')]){var _0xcd2e48=_0x2b11e9['query'][_0x086a('0x48')][_0x086a('0x49')](',');var _0x19d641={};_0x19d641[_0xcd2e48[0x0]]={'$gte':moment(_0xcd2e48[0x1])[_0x086a('0x4a')](_0x086a('0x4b'))};_0x3cb11a[_0x086a('0x45')]=_[_0x086a('0x33')](_0x3cb11a[_0x086a('0x45')],_0x19d641);}_0x3cb11a=_['merge']({},_0x3cb11a,_0x2b11e9['options']);return db[_0x086a('0x3c')]['count']({'where':_0x3cb11a[_0x086a('0x45')]})[_0x086a('0x19')](function(_0x49551d){_0x18ee43['count']=_0x49551d;if(_0x2b11e9[_0x086a('0x27')][_0x086a('0x32')]){_0x3cb11a[_0x086a('0x4c')]=[{'all':!![]}];}return db[_0x086a('0x3c')][_0x086a('0x25')](_0x3cb11a);})[_0x086a('0x19')](function(_0x3145f7){_0x18ee43[_0x086a('0x4d')]=_0x3145f7;return _0x18ee43;});}})[_0x086a('0x19')](respondWithFilteredResult(_0x4fc33a,_0x3cb11a))[_0x086a('0x35')](handleError(_0x4fc33a,null));};exports[_0x086a('0x4e')]=function(_0x5a7353,_0x615254){return db['FaxInteraction'][_0x086a('0x38')]({'where':{'id':_0x5a7353[_0x086a('0x2a')]['id']}})[_0x086a('0x19')](handleEntityNotFound(_0x615254,null))[_0x086a('0x19')](function(_0x1bac5e){if(_0x1bac5e){return _0x1bac5e['setTags'](_0x5a7353[_0x086a('0x37')]['ids'],_[_0x086a('0x3e')](_0x5a7353['body'],[_0x086a('0x3d'),'id'])||{})['spread'](function(){return db[_0x086a('0x4f')][_0x086a('0x25')]({'attributes':['id',_0x086a('0x1c'),_0x086a('0x50')],'where':{'id':_0x5a7353[_0x086a('0x37')][_0x086a('0x3d')]}});})[_0x086a('0x19')](function(_0x130da2){socket[_0x086a('0x51')](_0x086a('0x52'),{'id':Number(_0x5a7353['params']['id']),'tags':_0x130da2||[]});return{'id':Number(_0x5a7353['params']['id']),'tags':_0x130da2||[]};});}})[_0x086a('0x19')](respondWithResult(_0x615254,null))[_0x086a('0x35')](handleError(_0x615254,null));};exports['removeTags']=function(_0x571c9b,_0x4789c7){return db[_0x086a('0x20')][_0x086a('0x38')]({'where':{'id':_0x571c9b['params']['id']}})[_0x086a('0x19')](handleEntityNotFound(_0x4789c7,null))[_0x086a('0x19')](function(_0xf59ded){if(_0xf59ded){return _0xf59ded[_0x086a('0x53')](_0x571c9b['query'][_0x086a('0x3d')]);}})[_0x086a('0x19')](respondWithStatusCode(_0x4789c7,null))[_0x086a('0x35')](handleError(_0x4789c7,null));};exports[_0x086a('0x54')]=function(_0x4b43c1,_0x19b6bc){var _0x111822=moment()[_0x086a('0x55')]()[_0x086a('0x56')]();var _0x2460bf=path['join'](config['root'],'server','files',_0x086a('0x57'));var _0x2a01bc=path[_0x086a('0x58')](config[_0x086a('0x59')],_0x086a('0x5a'),'files',_0x086a('0x5b'));var _0x560675=path['join'](_0x2460bf,_0x111822);var _0x1c93e3=util[_0x086a('0x4a')](_0x086a('0x5c'),_0x4b43c1[_0x086a('0x2a')]['id'],_0x111822);var _0x100f26=path['join'](_0x2460bf,_0x1c93e3);var _0x197d7e=[];_0x197d7e[_0x086a('0x5d')]({'model':db['Attachment'],'as':_0x086a('0x5e'),'raw':!![]});var _0x266fd3=[{'model':db['FaxMessage'],'as':_0x086a('0x5f'),'attributes':['id',_0x086a('0x37'),_0x086a('0x60')],'include':_0x197d7e}];return db['FaxInteraction']['find']({'where':{'id':_0x4b43c1[_0x086a('0x2a')]['id']},'include':_0x266fd3})[_0x086a('0x19')](handleEntityNotFound(_0x19b6bc,null))[_0x086a('0x19')](function(_0x2e0592){if(_0x2e0592&&_0x2e0592[_0x086a('0x5f')]){var _0x1a9dfd=_0x2e0592[_0x086a('0x61')]({'plain':!![]});fs[_0x086a('0x62')](_0x560675);for(var _0x3849ce=0x0;_0x3849ce<_0x1a9dfd['Messages'][_0x086a('0x31')];_0x3849ce++){var _0x207a6c=_0x1a9dfd[_0x086a('0x5f')][_0x3849ce][_0x086a('0x5e')];if(_0x207a6c){var _0xeb5a29=path['join'](_0x2a01bc,_0x207a6c[_0x086a('0x63')]);if(fs[_0x086a('0x64')](_0xeb5a29)){fs['createReadStream'](_0xeb5a29)[_0x086a('0x65')](fs[_0x086a('0x66')](path['join'](_0x560675,_0x207a6c[_0x086a('0x63')])));}}}return BPromise[_0x086a('0x67')]()['then'](function(){return new BPromise(function(_0x53fa65,_0x43b874){zipdir(_0x560675,{'saveTo':_0x100f26},function(_0xa9d0c1,_0x230153){if(_0xa9d0c1)return _0x43b874(_0xa9d0c1);return _0x53fa65(_0x230153);});})[_0x086a('0x19')](function(){return new BPromise(function(_0x5d1148,_0x696ed9){rimraf(_0x560675,function(_0xb9df59){if(_0xb9df59)_0x696ed9(_0xb9df59);return _0x5d1148();});});})[_0x086a('0x19')](function(){return _0x19b6bc[_0x086a('0x54')](_0x100f26,_0x1c93e3,function(_0x223031){if(_0x223031){console[_0x086a('0x68')](_0x086a('0x69'),_0x223031);}else{fs[_0x086a('0x6a')](_0x100f26);}});});});}else{return _0x19b6bc['sendStatus'](0xc8);}})[_0x086a('0x35')](handleError(_0x19b6bc,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 901c565..45cfd2b 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 _0xe903=['map','findAll','setDataValue','unreadMessages','emit','catch','events','FaxInteraction','../../mysqldb','FaxMessage','save','update','remove','then','Users'];(function(_0xaaf2e2,_0x19d28a){var _0x28bc36=function(_0x53bdb5){while(--_0x53bdb5){_0xaaf2e2['push'](_0xaaf2e2['shift']());}};_0x28bc36(++_0x19d28a);}(_0xe903,0xf6));var _0x3e90=function(_0x2df507,_0x553862){_0x2df507=_0x2df507-0x0;var _0x1f7167=_0xe903[_0x2df507];return _0x1f7167;};'use strict';var EventEmitter=require(_0x3e90('0x0'));var FaxInteraction=require('../../mysqldb')['db'][_0x3e90('0x1')];var FaxMessage=require(_0x3e90('0x2'))['db'][_0x3e90('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3e90('0x4'),'afterUpdate':_0x3e90('0x5'),'afterDestroy':_0x3e90('0x6')};function emitEvent(_0x1552fe){return function(_0x5dee79,_0xc595d9,_0x257e0c){_0x5dee79['getUsers']({'attributes':['id'],'raw':!![]})[_0x3e90('0x7')](function(_0x3e8d6a){_0x5dee79['setDataValue'](_0x3e90('0x8'),_0x3e8d6a[_0x3e90('0x9')](function(_0x1e61fe){return{'id':_0x1e61fe['id']};}));return FaxMessage[_0x3e90('0xa')]({'where':{'FaxInteractionId':_0x5dee79['id'],'direction':'in','read':![]},'raw':!![]});})[_0x3e90('0x7')](function(_0x1a3bfe){_0x5dee79[_0x3e90('0xb')](_0x3e90('0xc'),_0x1a3bfe['length']);FaxInteractionEvents[_0x3e90('0xd')](_0x1552fe+':'+_0x5dee79['id'],_0x5dee79);FaxInteractionEvents[_0x3e90('0xd')](_0x1552fe,_0x5dee79);_0x257e0c(null);})[_0x3e90('0xe')](_0x257e0c(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 _0x7633=['FaxInteraction','FaxMessage','setMaxListeners','update','remove','then','Users','map','setDataValue','unreadMessages','emit','hasOwnProperty','hook','../../mysqldb'];(function(_0x434cc8,_0x2f0e0d){var _0x256f89=function(_0x1e450a){while(--_0x1e450a){_0x434cc8['push'](_0x434cc8['shift']());}};_0x256f89(++_0x2f0e0d);}(_0x7633,0x125));var _0x3763=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x7633[_0x53ccf2];return _0x5a2964;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0x3763('0x0'))['db'][_0x3763('0x1')];var FaxMessage=require(_0x3763('0x0'))['db'][_0x3763('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x3763('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3763('0x4'),'afterDestroy':_0x3763('0x5')};function emitEvent(_0x6db3c4){return function(_0xb9dd02,_0x4d9a2b,_0x40c901){_0xb9dd02['getUsers']({'attributes':['id'],'raw':!![]})[_0x3763('0x6')](function(_0x2fdd7c){_0xb9dd02['setDataValue'](_0x3763('0x7'),_0x2fdd7c[_0x3763('0x8')](function(_0x4aa0b1){return{'id':_0x4aa0b1['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0xb9dd02['id'],'direction':'in','read':![]},'raw':!![]});})[_0x3763('0x6')](function(_0x18bd30){_0xb9dd02[_0x3763('0x9')](_0x3763('0xa'),_0x18bd30['length']);FaxInteractionEvents['emit'](_0x6db3c4+':'+_0xb9dd02['id'],_0xb9dd02);FaxInteractionEvents[_0x3763('0xb')](_0x6db3c4,_0xb9dd02);_0x40c901(null);})['catch'](_0x40c901(null));};}for(var e in events){if(events[_0x3763('0xc')](e)){var event=events[e];FaxInteraction[_0x3763('0xd')](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 f9ecbd4..0a9c989 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 _0x286a=['../../config/logger','api','path','./faxInteraction.attributes','changed','closed','closedAt','format','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x286a,0x76));var _0xa286=function(_0x1327ac,_0x137ed9){_0x1327ac=_0x1327ac-0x0;var _0x55e41e=_0x286a[_0x1327ac];return _0x55e41e;};'use strict';var _=require(_0xa286('0x0'));var util=require(_0xa286('0x1'));var logger=require(_0xa286('0x2'))(_0xa286('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa286('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa286('0x5'));module['exports']=function(_0x5a8a2c,_0x3815be){return _0x5a8a2c['define']('FaxInteraction',attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x20d27e,_0x5aa19e,_0x44ee54){if(_0x20d27e[_0xa286('0x6')](_0xa286('0x7'))){_0x20d27e[_0xa286('0x8')]=moment()[_0xa286('0x9')]('YYYY-MM-DD\x20HH:mm:ss');}_0x44ee54(null,_0x20d27e);}}});}; \ No newline at end of file +var _0x745d=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction','fax_interactions','changed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util'];(function(_0x9af889,_0x1940b1){var _0x5a87ef=function(_0x1ab648){while(--_0x1ab648){_0x9af889['push'](_0x9af889['shift']());}};_0x5a87ef(++_0x1940b1);}(_0x745d,0xec));var _0xd745=function(_0xa7f960,_0x9ab19b){_0xa7f960=_0xa7f960-0x0;var _0x4777f5=_0x745d[_0xa7f960];return _0x4777f5;};'use strict';var _=require(_0xd745('0x0'));var util=require(_0xd745('0x1'));var logger=require(_0xd745('0x2'))(_0xd745('0x3'));var moment=require(_0xd745('0x4'));var BPromise=require('bluebird');var rp=require(_0xd745('0x5'));var fs=require('fs');var path=require(_0xd745('0x6'));var rimraf=require(_0xd745('0x7'));var config=require(_0xd745('0x8'));var attributes=require(_0xd745('0x9'));module[_0xd745('0xa')]=function(_0x73c566,_0x55ba33){return _0x73c566[_0xd745('0xb')](_0xd745('0xc'),attributes,{'tableName':_0xd745('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x39bf87,_0x9fb850,_0x42572e){if(_0x39bf87[_0xd745('0xe')]('closed')){_0x39bf87['closedAt']=moment()[_0xd745('0xf')](_0xd745('0x10'));}_0x42572e(null,_0x39bf87);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index cb2959e..8290efd 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 _0x20ad=['update','options','raw','where','attributes','limit','UpdateFaxInteraction','AddTagsToFaxInteraction','find','addTags','body','ids','omit','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','FaxInteraction'];(function(_0x149be5,_0x4e285c){var _0x32ea44=function(_0x22e147){while(--_0x22e147){_0x149be5['push'](_0x149be5['shift']());}};_0x32ea44(++_0x4e285c);}(_0x20ad,0x135));var _0xd20a=function(_0x40bffc,_0x3a45d7){_0x40bffc=_0x40bffc-0x0;var _0x3007e9=_0x20ad[_0x40bffc];return _0x3007e9;};'use strict';var _=require(_0xd20a('0x0'));var util=require(_0xd20a('0x1'));var moment=require(_0xd20a('0x2'));var BPromise=require('bluebird');var rs=require(_0xd20a('0x3'));var fs=require('fs');var Redis=require(_0xd20a('0x4'));var db=require(_0xd20a('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xd20a('0x6'));var jayson=require(_0xd20a('0x7'));var client=jayson['client'][_0xd20a('0x8')]({'port':0x232a});config[_0xd20a('0x9')]=_[_0xd20a('0xa')](config[_0xd20a('0x9')],{'host':_0xd20a('0xb'),'port':0x18eb});var socket=require(_0xd20a('0xc'))(new Redis(config['redis']));require('./faxInteraction.socket')[_0xd20a('0xd')](socket);function respondWithRpcPromise(_0x161700,_0x2ab817,_0x3d19cf){return new BPromise(function(_0x5a936b,_0x1370e9){return client[_0xd20a('0xe')](_0x161700,_0x3d19cf)[_0xd20a('0xf')](function(_0x208d5d){logger[_0xd20a('0x10')](_0xd20a('0x11'),_0x2ab817,_0xd20a('0x12'));logger[_0xd20a('0x13')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x2ab817,_0xd20a('0x12'),JSON[_0xd20a('0x14')](_0x208d5d));if(_0x208d5d[_0xd20a('0x15')]){if(_0x208d5d[_0xd20a('0x15')][_0xd20a('0x16')]===0x1f4){logger['error'](_0xd20a('0x11'),_0x2ab817,_0x208d5d[_0xd20a('0x15')]['message']);return _0x1370e9(_0x208d5d[_0xd20a('0x15')][_0xd20a('0x17')]);}logger['error'](_0xd20a('0x11'),_0x2ab817,_0x208d5d['error'][_0xd20a('0x17')]);return _0x5a936b(_0x208d5d[_0xd20a('0x15')]['message']);}else{logger[_0xd20a('0x10')](_0xd20a('0x11'),_0x2ab817,_0xd20a('0x12'));_0x5a936b(_0x208d5d[_0xd20a('0x18')][_0xd20a('0x17')]);}})[_0xd20a('0x19')](function(_0xe7aec6){logger['error'](_0xd20a('0x11'),_0x2ab817,_0xe7aec6);_0x1370e9(_0xe7aec6);});});}exports['UpdateFaxInteraction']=function(_0x484456){var _0x2273b0=this;return new Promise(function(_0x11b93c,_0x2b7f2e){return db[_0xd20a('0x1a')][_0xd20a('0x1b')](_0x484456['body'],{'raw':_0x484456[_0xd20a('0x1c')]?_0x484456['options'][_0xd20a('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x484456[_0xd20a('0x1c')]?_0x484456['options'][_0xd20a('0x1e')]||null:null,'attributes':_0x484456[_0xd20a('0x1c')]?_0x484456[_0xd20a('0x1c')][_0xd20a('0x1f')]||null:null,'limit':_0x484456[_0xd20a('0x1c')]?_0x484456[_0xd20a('0x1c')][_0xd20a('0x20')]||null:null})[_0xd20a('0xf')](function(_0x840333){logger['info'](_0xd20a('0x21'),_0x484456);logger[_0xd20a('0x13')](_0xd20a('0x21'),_0x484456,JSON['stringify'](_0x840333));_0x11b93c(_0x840333);})[_0xd20a('0x19')](function(_0x2aad9d){logger['error'](_0xd20a('0x21'),_0x2aad9d[_0xd20a('0x17')],_0x484456);_0x2b7f2e(_0x2273b0[_0xd20a('0x15')](0x1f4,_0x2aad9d[_0xd20a('0x17')]));});});};exports[_0xd20a('0x22')]=function(_0x3b51c2){return new Promise(function(_0x3261b7,_0x9b6531){return db[_0xd20a('0x1a')][_0xd20a('0x23')]({'where':_0x3b51c2[_0xd20a('0x1c')]?_0x3b51c2[_0xd20a('0x1c')]['where']||null:null})[_0xd20a('0xf')](function(_0x2f465f){if(_0x2f465f){return _0x2f465f[_0xd20a('0x24')](_0x3b51c2[_0xd20a('0x25')][_0xd20a('0x26')],_[_0xd20a('0x27')](_0x3b51c2[_0xd20a('0x25')],['ids','id'])||{});}})[_0xd20a('0x28')](function(_0x4bb6cd){logger[_0xd20a('0x10')](_0xd20a('0x29'),_0x3b51c2);logger[_0xd20a('0x13')]('AddTags',_0x3b51c2,JSON[_0xd20a('0x14')](_0x4bb6cd));_0x3261b7(_0x4bb6cd);})['catch'](function(_0x4f4b4b){logger[_0xd20a('0x15')](_0xd20a('0x29'),_0x4f4b4b[_0xd20a('0x17')],_0x3b51c2);_0x9b6531(_this[_0xd20a('0x15')](0x1f4,_0x4f4b4b['message']));});});}; \ No newline at end of file +var _0xff15=['../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','request','then','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FaxInteraction,\x20%s,\x20%s','info','request\x20sent','result','catch','UpdateFaxInteraction','update','body','options','raw','where','attributes','limit','debug','AddTagsToFaxInteraction','find','addTags','ids','spread','AddTags','lodash','moment','bluebird','ioredis','../../config/utils'];(function(_0x50ed0b,_0x15563f){var _0x419b8f=function(_0x114240){while(--_0x114240){_0x50ed0b['push'](_0x50ed0b['shift']());}};_0x419b8f(++_0x15563f);}(_0xff15,0x121));var _0x5ff1=function(_0x4fa291,_0x56e289){_0x4fa291=_0x4fa291-0x0;var _0x506d9b=_0xff15[_0x4fa291];return _0x506d9b;};'use strict';var _=require(_0x5ff1('0x0'));var util=require('util');var moment=require(_0x5ff1('0x1'));var BPromise=require(_0x5ff1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5ff1('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5ff1('0x4'));var logger=require(_0x5ff1('0x5'))(_0x5ff1('0x6'));var config=require(_0x5ff1('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5ff1('0x8')][_0x5ff1('0x9')]({'port':0x232a});config[_0x5ff1('0xa')]=_[_0x5ff1('0xb')](config[_0x5ff1('0xa')],{'host':_0x5ff1('0xc'),'port':0x18eb});var socket=require(_0x5ff1('0xd'))(new Redis(config[_0x5ff1('0xa')]));require(_0x5ff1('0xe'))['register'](socket);function respondWithRpcPromise(_0x20f474,_0x5e280c,_0x4a5892){return new BPromise(function(_0x170da7,_0x44f98d){return client[_0x5ff1('0xf')](_0x20f474,_0x4a5892)[_0x5ff1('0x10')](function(_0x2d7416){logger['info']('FaxInteraction,\x20%s,\x20%s',_0x5e280c,'request\x20sent');logger['debug'](_0x5ff1('0x11'),_0x5e280c,'request\x20sent',JSON[_0x5ff1('0x12')](_0x2d7416));if(_0x2d7416[_0x5ff1('0x13')]){if(_0x2d7416[_0x5ff1('0x13')][_0x5ff1('0x14')]===0x1f4){logger[_0x5ff1('0x13')]('FaxInteraction,\x20%s,\x20%s',_0x5e280c,_0x2d7416[_0x5ff1('0x13')]['message']);return _0x44f98d(_0x2d7416[_0x5ff1('0x13')][_0x5ff1('0x15')]);}logger[_0x5ff1('0x13')](_0x5ff1('0x16'),_0x5e280c,_0x2d7416[_0x5ff1('0x13')]['message']);return _0x170da7(_0x2d7416['error']['message']);}else{logger[_0x5ff1('0x17')]('FaxInteraction,\x20%s,\x20%s',_0x5e280c,_0x5ff1('0x18'));_0x170da7(_0x2d7416[_0x5ff1('0x19')][_0x5ff1('0x15')]);}})[_0x5ff1('0x1a')](function(_0x2f9f9c){logger[_0x5ff1('0x13')](_0x5ff1('0x16'),_0x5e280c,_0x2f9f9c);_0x44f98d(_0x2f9f9c);});});}exports[_0x5ff1('0x1b')]=function(_0x38d6aa){var _0x7d5ded=this;return new Promise(function(_0x5a6812,_0x42be4c){return db['FaxInteraction'][_0x5ff1('0x1c')](_0x38d6aa[_0x5ff1('0x1d')],{'raw':_0x38d6aa[_0x5ff1('0x1e')]?_0x38d6aa[_0x5ff1('0x1e')][_0x5ff1('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x38d6aa[_0x5ff1('0x1e')]?_0x38d6aa[_0x5ff1('0x1e')][_0x5ff1('0x20')]||null:null,'attributes':_0x38d6aa[_0x5ff1('0x1e')]?_0x38d6aa['options'][_0x5ff1('0x21')]||null:null,'limit':_0x38d6aa[_0x5ff1('0x1e')]?_0x38d6aa[_0x5ff1('0x1e')][_0x5ff1('0x22')]||null:null})[_0x5ff1('0x10')](function(_0x5f38fe){logger[_0x5ff1('0x17')](_0x5ff1('0x1b'),_0x38d6aa);logger[_0x5ff1('0x23')](_0x5ff1('0x1b'),_0x38d6aa,JSON['stringify'](_0x5f38fe));_0x5a6812(_0x5f38fe);})[_0x5ff1('0x1a')](function(_0x2a9ad3){logger['error'](_0x5ff1('0x1b'),_0x2a9ad3[_0x5ff1('0x15')],_0x38d6aa);_0x42be4c(_0x7d5ded['error'](0x1f4,_0x2a9ad3['message']));});});};exports[_0x5ff1('0x24')]=function(_0x1355d1){return new Promise(function(_0x43b444,_0x4033cc){return db['FaxInteraction'][_0x5ff1('0x25')]({'where':_0x1355d1[_0x5ff1('0x1e')]?_0x1355d1[_0x5ff1('0x1e')][_0x5ff1('0x20')]||null:null})[_0x5ff1('0x10')](function(_0xb28698){if(_0xb28698){return _0xb28698[_0x5ff1('0x26')](_0x1355d1['body'][_0x5ff1('0x27')],_['omit'](_0x1355d1[_0x5ff1('0x1d')],['ids','id'])||{});}})[_0x5ff1('0x28')](function(_0xc9cf7b){logger[_0x5ff1('0x17')](_0x5ff1('0x29'),_0x1355d1);logger[_0x5ff1('0x23')]('AddTags',_0x1355d1,JSON[_0x5ff1('0x12')](_0xc9cf7b));_0x43b444(_0xc9cf7b);})[_0x5ff1('0x1a')](function(_0xb4761b){logger[_0x5ff1('0x13')]('AddTags',_0xb4761b[_0x5ff1('0x15')],_0x1355d1);_0x4033cc(_this[_0x5ff1('0x13')](0x1f4,_0xb4761b[_0x5ff1('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 4eed85d..8ee79e5 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 _0xa813=['length','faxInteraction:','./faxInteraction.events','update','emit','removeListener','register'];(function(_0x2aa0e7,_0x4e5145){var _0x1472c0=function(_0x4deaeb){while(--_0x4deaeb){_0x2aa0e7['push'](_0x2aa0e7['shift']());}};_0x1472c0(++_0x4e5145);}(_0xa813,0xf7));var _0x3a81=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0xa813[_0x50007c];return _0x5c1ec7;};'use strict';var FaxInteractionEvents=require(_0x3a81('0x0'));var events=['save','remove',_0x3a81('0x1')];function createListener(_0x2169a2,_0x4d5874){return function(_0x1c7dca){_0x4d5874[_0x3a81('0x2')](_0x2169a2,_0x1c7dca);};}function removeListener(_0x2dcb38,_0x3f24bb){return function(){FaxInteractionEvents[_0x3a81('0x3')](_0x2dcb38,_0x3f24bb);};}exports[_0x3a81('0x4')]=function(_0x1b032d){for(var _0xb8ac27=0x0,_0x529abd=events[_0x3a81('0x5')];_0xb8ac27<_0x529abd;_0xb8ac27++){var _0x18df7a=events[_0xb8ac27];var _0x47d616=createListener(_0x3a81('0x6')+_0x18df7a,_0x1b032d);FaxInteractionEvents['on'](_0x18df7a,_0x47d616);}}; \ No newline at end of file +var _0x06ee=['./faxInteraction.events','save','update','emit','removeListener','register','length','faxInteraction:'];(function(_0x3fb59a,_0x1791ed){var _0x15d126=function(_0x3fa67f){while(--_0x3fa67f){_0x3fb59a['push'](_0x3fb59a['shift']());}};_0x15d126(++_0x1791ed);}(_0x06ee,0xe8));var _0xe06e=function(_0x90a796,_0x23acad){_0x90a796=_0x90a796-0x0;var _0x1f79a1=_0x06ee[_0x90a796];return _0x1f79a1;};'use strict';var FaxInteractionEvents=require(_0xe06e('0x0'));var events=[_0xe06e('0x1'),'remove',_0xe06e('0x2')];function createListener(_0x339bb5,_0x261e07){return function(_0x55c607){_0x261e07[_0xe06e('0x3')](_0x339bb5,_0x55c607);};}function removeListener(_0x2b0f25,_0x29c806){return function(){FaxInteractionEvents[_0xe06e('0x4')](_0x2b0f25,_0x29c806);};}exports[_0xe06e('0x5')]=function(_0x4ff55e){for(var _0x33d070=0x0,_0x17314a=events[_0xe06e('0x6')];_0x33d070<_0x17314a;_0x33d070++){var _0xeae22e=events[_0x33d070];var _0x6990ce=createListener(_0xe06e('0x7')+_0xeae22e,_0x4ff55e);FaxInteractionEvents['on'](_0xeae22e,_0x6990ce);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 38ffaff..89d7f22 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 _0xfcb4=['fax','faxinteraction:update','faxinteraction:destroy','destroy','delete','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','faxinteraction:addtags','addTags','put'];(function(_0x16216d,_0xd3852d){var _0xab9ca1=function(_0x131ac1){while(--_0x131ac1){_0x16216d['push'](_0x16216d['shift']());}};_0xab9ca1(++_0xd3852d);}(_0xfcb4,0x1d5));var _0x4fcb=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xfcb4[_0x501510];return _0x1e6ee5;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4fcb('0x0'));var timeout=require('connect-timeout');var express=require(_0x4fcb('0x1'));var router=express[_0x4fcb('0x2')]();var fs_extra=require(_0x4fcb('0x3'));var auth=require(_0x4fcb('0x4'));var interaction=require(_0x4fcb('0x5'));var config=require(_0x4fcb('0x6'));var controller=require('./faxInteraction.controller');router[_0x4fcb('0x7')]('/',auth[_0x4fcb('0x8')](),controller[_0x4fcb('0x9')]);router[_0x4fcb('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x4fcb('0xa')]);router[_0x4fcb('0x7')](_0x4fcb('0xb'),auth[_0x4fcb('0x8')](),controller['show']);router[_0x4fcb('0x7')](_0x4fcb('0xc'),auth[_0x4fcb('0x8')](),controller[_0x4fcb('0xd')]);router[_0x4fcb('0x7')](_0x4fcb('0xe'),auth[_0x4fcb('0x8')](),controller[_0x4fcb('0xf')]);router[_0x4fcb('0x10')]('/',auth[_0x4fcb('0x8')](),controller[_0x4fcb('0x11')]);router[_0x4fcb('0x10')](_0x4fcb('0xc'),auth[_0x4fcb('0x8')](),controller[_0x4fcb('0x12')]);router[_0x4fcb('0x10')](_0x4fcb('0x13'),auth[_0x4fcb('0x8')](),interaction[_0x4fcb('0x14')]('fax',_0x4fcb('0x15')),controller[_0x4fcb('0x16')]);router[_0x4fcb('0x17')](_0x4fcb('0xb'),auth[_0x4fcb('0x8')](),interaction[_0x4fcb('0x14')](_0x4fcb('0x18'),_0x4fcb('0x19')),controller['update']);router['delete'](_0x4fcb('0xb'),auth[_0x4fcb('0x8')](),interaction['tracked'](_0x4fcb('0x18'),_0x4fcb('0x1a')),controller[_0x4fcb('0x1b')]);router[_0x4fcb('0x1c')]('/:id/tags',auth[_0x4fcb('0x8')](),controller['removeTags']);module['exports']=router; \ No newline at end of file +var _0xc900=['show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','faxinteraction:addtags','addTags','put','fax','update','delete','destroy','removeTags','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../config/environment','index','get','/describe','isAuthenticated','/:id'];(function(_0x30b66b,_0x5e416a){var _0x145904=function(_0x4afbd6){while(--_0x4afbd6){_0x30b66b['push'](_0x30b66b['shift']());}};_0x145904(++_0x5e416a);}(_0xc900,0xc7));var _0x0c90=function(_0x265eb8,_0x5deede){_0x265eb8=_0x265eb8-0x0;var _0x5a0381=_0xc900[_0x265eb8];return _0x5a0381;};'use strict';var multer=require(_0x0c90('0x0'));var util=require(_0x0c90('0x1'));var path=require('path');var timeout=require(_0x0c90('0x2'));var express=require('express');var router=express[_0x0c90('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0c90('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x0c90('0x5'));var controller=require('./faxInteraction.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x0c90('0x6')]);router[_0x0c90('0x7')](_0x0c90('0x8'),auth[_0x0c90('0x9')](),controller['describe']);router[_0x0c90('0x7')](_0x0c90('0xa'),auth[_0x0c90('0x9')](),controller[_0x0c90('0xb')]);router[_0x0c90('0x7')](_0x0c90('0xc'),auth['isAuthenticated'](),controller[_0x0c90('0xd')]);router['get'](_0x0c90('0xe'),auth[_0x0c90('0x9')](),controller[_0x0c90('0xf')]);router[_0x0c90('0x10')]('/',auth[_0x0c90('0x9')](),controller[_0x0c90('0x11')]);router['post'](_0x0c90('0xc'),auth[_0x0c90('0x9')](),controller[_0x0c90('0x12')]);router['post'](_0x0c90('0x13'),auth[_0x0c90('0x9')](),interaction[_0x0c90('0x14')]('fax',_0x0c90('0x15')),controller[_0x0c90('0x16')]);router[_0x0c90('0x17')](_0x0c90('0xa'),auth[_0x0c90('0x9')](),interaction[_0x0c90('0x14')](_0x0c90('0x18'),'faxinteraction:update'),controller[_0x0c90('0x19')]);router[_0x0c90('0x1a')]('/:id',auth[_0x0c90('0x9')](),interaction['tracked']('fax','faxinteraction:destroy'),controller[_0x0c90('0x1b')]);router['delete'](_0x0c90('0x13'),auth[_0x0c90('0x9')](),controller[_0x0c90('0x1c')]);module[_0x0c90('0x1d')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 3e0c23a..f5ed71c 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 _0x0f9f=['medium','ENUM','out','DATE','exports','TEXT'];(function(_0x4329ba,_0x15743a){var _0x2faa5b=function(_0x4f2fc3){while(--_0x4f2fc3){_0x4329ba['push'](_0x4329ba['shift']());}};_0x2faa5b(++_0x15743a);}(_0x0f9f,0x1cc));var _0xf0f9=function(_0x1a3a4c,_0x50e07b){_0x1a3a4c=_0x1a3a4c-0x0;var _0x8054c0=_0x0f9f[_0x1a3a4c];return _0x8054c0;};'use strict';var Sequelize=require('sequelize');module[_0xf0f9('0x0')]={'body':{'type':Sequelize[_0xf0f9('0x1')](_0xf0f9('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xf0f9('0x3')]('in',_0xf0f9('0x4')),'defaultValue':_0xf0f9('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xf0f9('0x1')],'defaultValue':null},'readAt':{'type':Sequelize[_0xf0f9('0x5')]}}; \ No newline at end of file +var _0x5d70=['TEXT','sequelize','exports','medium','BOOLEAN','ENUM','out'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5d70,0x8d));var _0x05d7=function(_0x413e48,_0x2bf197){_0x413e48=_0x413e48-0x0;var _0x22c817=_0x5d70[_0x413e48];return _0x22c817;};'use strict';var Sequelize=require(_0x05d7('0x0'));module[_0x05d7('0x1')]={'body':{'type':Sequelize['TEXT'](_0x05d7('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x05d7('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x05d7('0x4')]('in',_0x05d7('0x5')),'defaultValue':_0x05d7('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x05d7('0x6')],'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 c32fed7..fe6def8 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 _0xe5e3=['status','json','undefined','count','limit','set','update','destroy','sendStatus','stack','name','index','map','FaxMessage','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','find','body','describe','fax-interactions','accept','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','FaxInteraction','FaxInteractionId','isNil','read1stAt','get','[FAXMESSAGE: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','QueryTypes','SELECT','User','fullname','email','internal','manual','interface','channel','motionChannel','event','EventManager','acceptmessage','reject','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','interaction','contact','SIP/%s','rejectmessage','create','findOne','AttachmentId','SendFax','FaxAccountId','basename','download','join','root','server','files','Attachment','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x217f7a,_0x2a103f){var _0x468f2d=function(_0x4e3ebe){while(--_0x4e3ebe){_0x217f7a['push'](_0x217f7a['shift']());}};_0x468f2d(++_0x2a103f);}(_0xe5e3,0x175));var _0x3e5e=function(_0x35896c,_0x3a6d67){_0x35896c=_0x35896c-0x0;var _0x57224d=_0xe5e3[_0x35896c];return _0x57224d;};'use strict';var emlformat=require(_0x3e5e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3e5e('0x1'));var jsonpatch=require(_0x3e5e('0x2'));var rp=require(_0x3e5e('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3e5e('0x4'));var util=require(_0x3e5e('0x5'));var path=require('path');var sox=require(_0x3e5e('0x6'));var csv=require(_0x3e5e('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3e5e('0x8'));var _=require(_0x3e5e('0x9'));var squel=require('squel');var crypto=require(_0x3e5e('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x3e5e('0xb'));var toCsv=require('to-csv');var querystring=require(_0x3e5e('0xc'));var Papa=require('papaparse');var Redis=require(_0x3e5e('0xd'));var authService=require(_0x3e5e('0xe'));var qs=require(_0x3e5e('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3e5e('0x10'));var logger=require(_0x3e5e('0x11'))(_0x3e5e('0x12'));var utils=require(_0x3e5e('0x13'));var config=require(_0x3e5e('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x3e5e('0x15'))['db'];config[_0x3e5e('0x16')]=_['defaults'](config[_0x3e5e('0x16')],{'host':_0x3e5e('0x17'),'port':0x18eb});var socket=require(_0x3e5e('0x18'))(new Redis(config['redis']));require(_0x3e5e('0x19'))[_0x3e5e('0x1a')](socket);var jayson=require(_0x3e5e('0x1b'));var client=jayson[_0x3e5e('0x1c')]['http']({'port':0x232c});var client9002=jayson[_0x3e5e('0x1c')][_0x3e5e('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x2ffeaf,_0x5a1bec,_0x24ad16,_0x18fcc4){return new BPromise(function(_0x30273e,_0x5c4bae){var _0x3c7e9e=_0x18fcc4||client;return _0x3c7e9e[_0x3e5e('0x1e')](_0x2ffeaf,_0x24ad16)[_0x3e5e('0x1f')](function(_0x130806){logger[_0x3e5e('0x20')](_0x3e5e('0x21'),_0x5a1bec,_0x3e5e('0x22'));logger['debug']('FaxMessage,\x20%s,\x20%s,\x20%s',_0x5a1bec,_0x3e5e('0x22'),JSON[_0x3e5e('0x23')](_0x130806));if(_0x130806[_0x3e5e('0x24')]){if(_0x130806[_0x3e5e('0x24')][_0x3e5e('0x25')]===0x1f4){logger[_0x3e5e('0x24')](_0x3e5e('0x21'),_0x5a1bec,_0x130806['error'][_0x3e5e('0x26')]);return _0x5c4bae(_0x130806[_0x3e5e('0x24')][_0x3e5e('0x26')]);}logger[_0x3e5e('0x24')](_0x3e5e('0x21'),_0x5a1bec,_0x130806[_0x3e5e('0x24')][_0x3e5e('0x26')]);return _0x30273e(_0x130806['error'][_0x3e5e('0x26')]);}else{logger[_0x3e5e('0x20')](_0x3e5e('0x21'),_0x5a1bec,'request\x20sent');_0x30273e(_0x130806[_0x3e5e('0x27')]['message']);}})[_0x3e5e('0x28')](function(_0x305e28){logger[_0x3e5e('0x24')](_0x3e5e('0x21'),_0x5a1bec,_0x305e28);_0x5c4bae(_0x305e28);});});}function respondWithStatusCode(_0x1b70be,_0x312f3c){_0x312f3c=_0x312f3c||0xcc;return function(_0x3eea0f){if(_0x3eea0f){return _0x1b70be['sendStatus'](_0x312f3c);}return _0x1b70be[_0x3e5e('0x29')](_0x312f3c)['end']();};}function respondWithResult(_0x59aaf0,_0x730daf){_0x730daf=_0x730daf||0xc8;return function(_0x242ffd){if(_0x242ffd){return _0x59aaf0[_0x3e5e('0x29')](_0x730daf)[_0x3e5e('0x2a')](_0x242ffd);}};}function respondWithFilteredResult(_0x3d4f34,_0x1b761a){return function(_0x2776b0){if(_0x2776b0){var _0xb66e17=typeof _0x1b761a['offset']===_0x3e5e('0x2b')&&typeof _0x1b761a['limit']===_0x3e5e('0x2b');var _0x697f8e=_0x2776b0[_0x3e5e('0x2c')];var _0x2a2616=_0xb66e17?0x0:_0x1b761a['offset'];var _0xbd6106=_0xb66e17?_0x2776b0[_0x3e5e('0x2c')]:_0x1b761a['offset']+_0x1b761a[_0x3e5e('0x2d')];var _0x12472c;if(_0xbd6106>=_0x697f8e){_0xbd6106=_0x697f8e;_0x12472c=0xc8;}else{_0x12472c=0xce;}_0x3d4f34[_0x3e5e('0x29')](_0x12472c);return _0x3d4f34[_0x3e5e('0x2e')]('Content-Range',_0x2a2616+'-'+_0xbd6106+'/'+_0x697f8e)[_0x3e5e('0x2a')](_0x2776b0);}return null;};}function patchUpdates(_0x137f83){return function(_0x142381){try{jsonpatch['apply'](_0x142381,_0x137f83,!![]);}catch(_0x49338f){return BPromise['reject'](_0x49338f);}return _0x142381['save']();};}function saveUpdates(_0x315d0a,_0x15ce5d){return function(_0x21d422){if(_0x21d422){return _0x21d422[_0x3e5e('0x2f')](_0x315d0a)['then'](function(_0x4b2d4c){return _0x4b2d4c;});}return null;};}function removeEntity(_0x58433a,_0x4ebd63){return function(_0x1b4def){if(_0x1b4def){return _0x1b4def[_0x3e5e('0x30')]()[_0x3e5e('0x1f')](function(){_0x58433a[_0x3e5e('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39cbc7,_0x530e37){return function(_0x15db7e){if(!_0x15db7e){_0x39cbc7[_0x3e5e('0x31')](0x194);}return _0x15db7e;};}function handleError(_0x5efb2f,_0x5e2924){_0x5e2924=_0x5e2924||0x1f4;return function(_0xe07d6){logger[_0x3e5e('0x24')](_0xe07d6[_0x3e5e('0x32')]);if(_0xe07d6[_0x3e5e('0x33')]){delete _0xe07d6[_0x3e5e('0x33')];}_0x5efb2f[_0x3e5e('0x29')](_0x5e2924)['send'](_0xe07d6);};}exports[_0x3e5e('0x34')]=function(_0x549ab7,_0x526fe1){var _0x8bffb0={},_0x5a1a24={},_0x19315d={'count':0x0,'rows':[]};var _0x5d4518=_[_0x3e5e('0x35')](db[_0x3e5e('0x36')]['rawAttributes'],function(_0x5bf9b1){return{'name':_0x5bf9b1[_0x3e5e('0x37')],'type':_0x5bf9b1['type'][_0x3e5e('0x38')]};});_0x5a1a24[_0x3e5e('0x39')]=_[_0x3e5e('0x35')](_0x5d4518,_0x3e5e('0x33'));_0x5a1a24[_0x3e5e('0x3a')]=_[_0x3e5e('0x3b')](_0x549ab7['query']);_0x5a1a24[_0x3e5e('0x3c')]=_[_0x3e5e('0x3d')](_0x5a1a24[_0x3e5e('0x39')],_0x5a1a24[_0x3e5e('0x3a')]);_0x8bffb0[_0x3e5e('0x3e')]=_[_0x3e5e('0x3d')](_0x5a1a24[_0x3e5e('0x39')],qs[_0x3e5e('0x3f')](_0x549ab7[_0x3e5e('0x3a')][_0x3e5e('0x3f')]));_0x8bffb0[_0x3e5e('0x3e')]=_0x8bffb0[_0x3e5e('0x3e')]['length']?_0x8bffb0[_0x3e5e('0x3e')]:_0x5a1a24['model'];if(!_0x549ab7[_0x3e5e('0x3a')][_0x3e5e('0x40')](_0x3e5e('0x41'))){_0x8bffb0[_0x3e5e('0x2d')]=qs[_0x3e5e('0x2d')](_0x549ab7[_0x3e5e('0x3a')][_0x3e5e('0x2d')]);_0x8bffb0[_0x3e5e('0x42')]=qs[_0x3e5e('0x42')](_0x549ab7[_0x3e5e('0x3a')]['offset']);}_0x8bffb0[_0x3e5e('0x43')]=qs[_0x3e5e('0x44')](_0x549ab7[_0x3e5e('0x3a')][_0x3e5e('0x44')]);_0x8bffb0[_0x3e5e('0x45')]=qs['filters'](_[_0x3e5e('0x46')](_0x549ab7[_0x3e5e('0x3a')],_0x5a1a24[_0x3e5e('0x3c')]),_0x5d4518);if(_0x549ab7[_0x3e5e('0x3a')][_0x3e5e('0x47')]){_0x8bffb0[_0x3e5e('0x45')]=_[_0x3e5e('0x48')](_0x8bffb0[_0x3e5e('0x45')],{'$or':_[_0x3e5e('0x35')](_0x5d4518,function(_0x3bbab1){if(_0x3bbab1['type']!==_0x3e5e('0x49')){var _0x38067d={};_0x38067d[_0x3bbab1[_0x3e5e('0x33')]]={'$like':'%'+_0x549ab7['query']['filter']+'%'};return _0x38067d;}})});}_0x8bffb0=_[_0x3e5e('0x48')]({},_0x8bffb0,_0x549ab7[_0x3e5e('0x4a')]);var _0x28a927={'where':_0x8bffb0[_0x3e5e('0x45')]};return db[_0x3e5e('0x36')][_0x3e5e('0x2c')](_0x28a927)[_0x3e5e('0x1f')](function(_0x5ef636){_0x19315d[_0x3e5e('0x2c')]=_0x5ef636;if(_0x549ab7[_0x3e5e('0x3a')][_0x3e5e('0x4b')]){_0x8bffb0[_0x3e5e('0x4c')]=[{'all':!![]}];}return db[_0x3e5e('0x36')]['findAll'](_0x8bffb0);})[_0x3e5e('0x1f')](function(_0xc61ac3){_0x19315d[_0x3e5e('0x4d')]=_0xc61ac3;return _0x19315d;})[_0x3e5e('0x1f')](respondWithFilteredResult(_0x526fe1,_0x8bffb0))[_0x3e5e('0x28')](handleError(_0x526fe1,null));};exports[_0x3e5e('0x4e')]=function(_0x3b2e2a,_0x58fffc){var _0x4eea04={'raw':!![],'where':{'id':_0x3b2e2a[_0x3e5e('0x4f')]['id']}},_0x188b6e={};_0x188b6e['model']=_[_0x3e5e('0x3b')](db[_0x3e5e('0x36')]['rawAttributes']);_0x188b6e[_0x3e5e('0x3a')]=_[_0x3e5e('0x3b')](_0x3b2e2a[_0x3e5e('0x3a')]);_0x188b6e[_0x3e5e('0x3c')]=_[_0x3e5e('0x3d')](_0x188b6e[_0x3e5e('0x39')],_0x188b6e['query']);_0x4eea04[_0x3e5e('0x3e')]=_[_0x3e5e('0x3d')](_0x188b6e[_0x3e5e('0x39')],qs[_0x3e5e('0x3f')](_0x3b2e2a[_0x3e5e('0x3a')][_0x3e5e('0x3f')]));_0x4eea04['attributes']=_0x4eea04['attributes']['length']?_0x4eea04['attributes']:_0x188b6e['model'];if(_0x3b2e2a[_0x3e5e('0x3a')][_0x3e5e('0x4b')]){_0x4eea04[_0x3e5e('0x4c')]=[{'all':!![]}];}_0x4eea04=_[_0x3e5e('0x48')]({},_0x4eea04,_0x3b2e2a[_0x3e5e('0x4a')]);return db[_0x3e5e('0x36')][_0x3e5e('0x50')](_0x4eea04)[_0x3e5e('0x1f')](handleEntityNotFound(_0x58fffc,null))[_0x3e5e('0x1f')](respondWithResult(_0x58fffc,null))[_0x3e5e('0x28')](handleError(_0x58fffc,null));};exports[_0x3e5e('0x2f')]=function(_0x291a50,_0x5d73ac){if(_0x291a50['body']['id']){delete _0x291a50[_0x3e5e('0x51')]['id'];}return db[_0x3e5e('0x36')][_0x3e5e('0x50')]({'where':{'id':_0x291a50['params']['id']}})['then'](handleEntityNotFound(_0x5d73ac,null))[_0x3e5e('0x1f')](saveUpdates(_0x291a50[_0x3e5e('0x51')],null))['then'](respondWithResult(_0x5d73ac,null))[_0x3e5e('0x28')](handleError(_0x5d73ac,null));};exports['destroy']=function(_0xf7608e,_0x3f2b5c){return db['FaxMessage']['find']({'where':{'id':_0xf7608e[_0x3e5e('0x4f')]['id']}})[_0x3e5e('0x1f')](handleEntityNotFound(_0x3f2b5c,null))['then'](removeEntity(_0x3f2b5c,null))[_0x3e5e('0x28')](handleError(_0x3f2b5c,null));};exports['describe']=function(_0x5e9bdf,_0x55c205){return db[_0x3e5e('0x36')][_0x3e5e('0x52')]()['then'](respondWithResult(_0x55c205,null))['catch'](handleError(_0x55c205,null));};var interaction_log=require(_0x3e5e('0x11'))(_0x3e5e('0x53'));exports[_0x3e5e('0x54')]=function(_0x10c7ae,_0x1a0af2,_0x116543){var _0x36d425={'agent':{},'channel':_0x3e5e('0x55')};if(_0x10c7ae[_0x3e5e('0x51')]['id']){delete _0x10c7ae[_0x3e5e('0x51')]['id'];}_0x10c7ae[_0x3e5e('0x51')][_0x3e5e('0x56')]=!![];_0x10c7ae[_0x3e5e('0x51')][_0x3e5e('0x57')]=moment()[_0x3e5e('0x58')](_0x3e5e('0x59'));_0x10c7ae['body']['UserId']=_0x10c7ae[_0x3e5e('0x51')][_0x3e5e('0x5a')]||_0x10c7ae[_0x3e5e('0x5b')]['id'];_0x36d425[_0x3e5e('0x5c')]['id']=_0x10c7ae[_0x3e5e('0x51')][_0x3e5e('0x5a')];return db[_0x3e5e('0x36')]['find']({'where':{'id':_0x10c7ae['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x1a0af2,null))[_0x3e5e('0x1f')](saveUpdates(_0x10c7ae['body'],null))['then'](function(_0x50cc9d){if(_0x50cc9d){_0x36d425['message']=_0x50cc9d['get']({'plain':!![]});return db[_0x3e5e('0x5d')][_0x3e5e('0x50')]({'where':{'id':_0x50cc9d[_0x3e5e('0x5e')]}});}return null;})[_0x3e5e('0x1f')](handleEntityNotFound(_0x1a0af2,null))[_0x3e5e('0x1f')](function(_0x40b5b6){if(_0x40b5b6){return _0x40b5b6['update']({'UserId':_0x10c7ae[_0x3e5e('0x51')]['UserId'],'read1stAt':_[_0x3e5e('0x5f')](_0x40b5b6[_0x3e5e('0x60')])?moment()[_0x3e5e('0x58')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x3e5e('0x1f')](function(_0x33e975){if(_0x33e975){_0x36d425['interaction']=_0x33e975[_0x3e5e('0x61')]({'plain':!![]});interaction_log[_0x3e5e('0x20')](_0x3e5e('0x62'),_0x10c7ae[_0x3e5e('0x5b')]['id'],_0x10c7ae[_0x3e5e('0x5b')][_0x3e5e('0x33')],_0x10c7ae['user'][_0x3e5e('0x63')],_0x36d425['interaction']['id'],_0x10c7ae[_0x3e5e('0x51')]?JSON[_0x3e5e('0x23')](_0x10c7ae[_0x3e5e('0x51')]):_0x3e5e('0x64'));return respondWithRpcPromise(_0x3e5e('0x65'),_0x3e5e('0x66'),_0x36d425);}return null;})[_0x3e5e('0x1f')](function(_0x5e3654){var _0x28b07e=_0x3e5e('0x67')+_0x5e3654[_0x3e5e('0x26')][_0x3e5e('0x68')];return db[_0x3e5e('0x69')][_0x3e5e('0x3a')](_0x28b07e,{'type':db[_0x3e5e('0x6a')][_0x3e5e('0x6b')][_0x3e5e('0x6c')],'raw':!![]})[_0x3e5e('0x1f')](function(_0x486bc1){return _0x486bc1;});})[_0x3e5e('0x1f')](function(_0x3839ea){if(_0x3839ea){_0x36d425[_0x3e5e('0x26')]['contact']=_0x3839ea[0x0];if(!_0x10c7ae[_0x3e5e('0x51')][_0x3e5e('0x5a')])return;return db[_0x3e5e('0x6d')]['find']({'where':{'id':_0x10c7ae['body'][_0x3e5e('0x5a')],'role':_0x3e5e('0x5c')},'attributes':['id','name',_0x3e5e('0x6e'),_0x3e5e('0x6f'),_0x3e5e('0x70')],'raw':!![]});}return null;})[_0x3e5e('0x1f')](function(_0x272b3f){if(!_0x272b3f)return null;_0x36d425[_0x3e5e('0x26')][_0x3e5e('0x5c')]=_0x272b3f;return _0x36d425;})[_0x3e5e('0x1f')](function(_0x3df304){if(_0x3df304){if(_0x10c7ae['body'][_0x3e5e('0x71')]){_0x36d425[_0x3e5e('0x26')][_0x3e5e('0x72')]=util[_0x3e5e('0x58')]('SIP/%s',_0x10c7ae[_0x3e5e('0x5b')]['name']);_0x36d425['message']['channel']=_0x36d425[_0x3e5e('0x73')];_0x36d425[_0x3e5e('0x26')][_0x3e5e('0x74')]=_0x36d425[_0x3e5e('0x73')];_0x36d425[_0x3e5e('0x26')][_0x3e5e('0x75')]=_0x3e5e('0x54');return respondWithRpcPromise(_0x3e5e('0x76'),'EventManager',{'event':_0x3e5e('0x77'),'message':_0x36d425[_0x3e5e('0x26')]},client9002)[_0x3e5e('0x1f')](function(){return _0x36d425;});}return _0x36d425;}return null;})[_0x3e5e('0x1f')](respondWithResult(_0x1a0af2,null))[_0x3e5e('0x28')](handleError(_0x1a0af2,null));};var interaction_log=require(_0x3e5e('0x11'))(_0x3e5e('0x53'));exports[_0x3e5e('0x78')]=function(_0x52d77a,_0x161bc2,_0x55d0ca){var _0x5a11fc={'agent':{},'channel':_0x3e5e('0x55')};if(_0x52d77a[_0x3e5e('0x51')]['id']){delete _0x52d77a[_0x3e5e('0x51')]['id'];}_0x52d77a['body'][_0x3e5e('0x5a')]=_0x52d77a[_0x3e5e('0x51')][_0x3e5e('0x5a')]||_0x52d77a[_0x3e5e('0x5b')]['id'];_0x5a11fc[_0x3e5e('0x5c')]['id']=_0x52d77a['body'][_0x3e5e('0x5a')];return db['FaxMessage']['find']({'where':{'id':_0x52d77a[_0x3e5e('0x4f')]['id'],'UserId':null}})[_0x3e5e('0x1f')](handleEntityNotFound(_0x161bc2,null))[_0x3e5e('0x1f')](function(_0x2a3024){if(_0x2a3024){_0x5a11fc[_0x3e5e('0x26')]=_0x2a3024[_0x3e5e('0x61')]({'plain':!![]});return db[_0x3e5e('0x5d')][_0x3e5e('0x50')]({'where':{'id':_0x2a3024[_0x3e5e('0x5e')]}});}return null;})['then'](handleEntityNotFound(_0x161bc2,null))[_0x3e5e('0x1f')](function(_0x6bd7d0){if(_0x6bd7d0){_0x5a11fc['interaction']=_0x6bd7d0[_0x3e5e('0x61')]({'plain':!![]});interaction_log[_0x3e5e('0x20')](_0x3e5e('0x79'),_0x52d77a['user']['id'],_0x52d77a[_0x3e5e('0x5b')][_0x3e5e('0x33')],_0x52d77a[_0x3e5e('0x5b')][_0x3e5e('0x63')],_0x5a11fc[_0x3e5e('0x7a')]['id'],_0x52d77a[_0x3e5e('0x51')]?JSON[_0x3e5e('0x23')](_0x52d77a[_0x3e5e('0x51')]):_0x3e5e('0x64'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x5a11fc);}return null;})[_0x3e5e('0x1f')](function(_0x18413e){var _0x3321e0=_0x3e5e('0x67')+_0x18413e[_0x3e5e('0x26')]['ContactId'];return db[_0x3e5e('0x69')][_0x3e5e('0x3a')](_0x3321e0,{'type':db[_0x3e5e('0x6a')][_0x3e5e('0x6b')][_0x3e5e('0x6c')],'raw':!![]})['then'](function(_0xe963fd){return _0xe963fd;});})[_0x3e5e('0x1f')](function(_0x3d222e){if(_0x3d222e){_0x5a11fc['message'][_0x3e5e('0x7b')]=_0x3d222e[0x0];if(!_0x52d77a[_0x3e5e('0x51')][_0x3e5e('0x5a')])return;return db[_0x3e5e('0x6d')][_0x3e5e('0x50')]({'where':{'id':_0x52d77a[_0x3e5e('0x51')][_0x3e5e('0x5a')],'role':'agent'},'attributes':['id','name',_0x3e5e('0x6e'),_0x3e5e('0x6f'),_0x3e5e('0x70')],'raw':!![]});}return null;})[_0x3e5e('0x1f')](function(_0x24678d){if(!_0x24678d)return null;_0x5a11fc[_0x3e5e('0x26')][_0x3e5e('0x5c')]=_0x24678d;return _0x5a11fc;})[_0x3e5e('0x1f')](function(_0x32787b){if(_0x32787b){_0x32787b[_0x3e5e('0x26')][_0x3e5e('0x72')]=util[_0x3e5e('0x58')](_0x3e5e('0x7c'),_0x52d77a['user'][_0x3e5e('0x33')]);_0x32787b[_0x3e5e('0x26')][_0x3e5e('0x73')]=_0x5a11fc[_0x3e5e('0x73')];_0x32787b[_0x3e5e('0x26')][_0x3e5e('0x74')]=_0x5a11fc['channel'];_0x32787b['message']['event']=_0x3e5e('0x78');respondWithRpcPromise(_0x3e5e('0x76'),_0x3e5e('0x76'),{'event':_0x3e5e('0x7d'),'message':_0x32787b['message']},client9002);return _0x5a11fc;}return null;})[_0x3e5e('0x1f')](respondWithResult(_0x161bc2,null))[_0x3e5e('0x28')](handleError(_0x161bc2,null));};exports[_0x3e5e('0x7e')]=function(_0x21d0c1,_0x581a7c){var _0x1f342f;return db[_0x3e5e('0x36')][_0x3e5e('0x7e')](_0x21d0c1[_0x3e5e('0x51')],{})[_0x3e5e('0x1f')](function(_0x2a27c5){_0x1f342f=_0x2a27c5;return db['CmContact'][_0x3e5e('0x7f')]({'where':{'id':_0x1f342f[_0x3e5e('0x68')]}});})[_0x3e5e('0x1f')](function(_0x43ee6b){if(_[_0x3e5e('0x5f')](_0x43ee6b)){return;}else{_0x1f342f['fax']=_0x43ee6b['fax'];return db['Attachment'][_0x3e5e('0x7f')]({'where':{'id':_0x1f342f[_0x3e5e('0x80')]}});}})[_0x3e5e('0x1f')](function(_0x27ce51){return respondWithRpcPromise(_0x3e5e('0x81'),'SendFax',{'FaxAccountId':_[_0x3e5e('0x5f')](_0x21d0c1[_0x3e5e('0x51')])?undefined:_0x21d0c1[_0x3e5e('0x51')][_0x3e5e('0x82')],'path':_[_0x3e5e('0x5f')](_0x27ce51)?undefined:util['format']('/var/opt/motion2/server/files/attachments/%s',_0x27ce51[_0x3e5e('0x83')]),'fax':_[_0x3e5e('0x5f')](_0x1f342f['fax'])?undefined:_0x1f342f['fax'],'AttachmentId':_0x1f342f[_0x3e5e('0x80')]},client9002);})['then'](respondWithResult(_0x581a7c,0xc9))[_0x3e5e('0x28')](handleError(_0x581a7c,null));};exports[_0x3e5e('0x84')]=function(_0x7ced3a,_0x29c65e){var _0x188804=path[_0x3e5e('0x85')](config[_0x3e5e('0x86')],_0x3e5e('0x87'),_0x3e5e('0x88'),'attachments');return db[_0x3e5e('0x36')][_0x3e5e('0x50')]({'where':{'id':_0x7ced3a[_0x3e5e('0x4f')]['id']},'include':[{'model':db[_0x3e5e('0x89')],'as':_0x3e5e('0x89')}]})[_0x3e5e('0x1f')](handleEntityNotFound(_0x29c65e,null))[_0x3e5e('0x1f')](function(_0x160fe5){if(_0x160fe5){return _0x29c65e[_0x3e5e('0x84')](path['join'](_0x188804,_0x160fe5['Attachment'][_0x3e5e('0x83')]));}})[_0x3e5e('0x28')](handleError(_0x29c65e,null));}; \ No newline at end of file +var _0xc87e=['bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','sendStatus','stack','name','index','map','FaxMessage','rawAttributes','fieldName','type','key','query','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','merge','options','includeAll','include','findAll','rows','params','keys','body','find','describe','accept','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','FaxInteraction','isNil','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','interaction','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','SELECT','contact','User','email','internal','channel','motionChannel','EventManager','acceptmessage','FaxInteractionId','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','sequelize','Sequelize','QueryTypes','SIP/%s','event','rejectmessage','CmContact','findOne','Attachment','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','join','files','eml-format','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x1ddedd,_0x485606){var _0xa3e1ac=function(_0x580444){while(--_0x580444){_0x1ddedd['push'](_0x1ddedd['shift']());}};_0xa3e1ac(++_0x485606);}(_0xc87e,0x11f));var _0xec87=function(_0x2a8dce,_0x120f15){_0x2a8dce=_0x2a8dce-0x0;var _0x1ccee8=_0xc87e[_0x2a8dce];return _0x1ccee8;};'use strict';var emlformat=require(_0xec87('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xec87('0x1'));var jsonpatch=require(_0xec87('0x2'));var rp=require(_0xec87('0x3'));var moment=require(_0xec87('0x4'));var BPromise=require(_0xec87('0x5'));var Mustache=require(_0xec87('0x6'));var util=require('util');var path=require(_0xec87('0x7'));var sox=require(_0xec87('0x8'));var csv=require('to-csv');var ejs=require(_0xec87('0x9'));var fs=require('fs');var fs_extra=require(_0xec87('0xa'));var _=require(_0xec87('0xb'));var squel=require(_0xec87('0xc'));var crypto=require(_0xec87('0xd'));var jsforce=require(_0xec87('0xe'));var deskjs=require(_0xec87('0xf'));var toCsv=require('to-csv');var querystring=require(_0xec87('0x10'));var Papa=require('papaparse');var Redis=require(_0xec87('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xec87('0x12'));var as=require(_0xec87('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xec87('0x14'))(_0xec87('0x15'));var utils=require(_0xec87('0x16'));var config=require(_0xec87('0x17'));var licenseUtil=require(_0xec87('0x18'));var db=require(_0xec87('0x19'))['db'];config[_0xec87('0x1a')]=_[_0xec87('0x1b')](config['redis'],{'host':_0xec87('0x1c'),'port':0x18eb});var socket=require(_0xec87('0x1d'))(new Redis(config[_0xec87('0x1a')]));require(_0xec87('0x1e'))[_0xec87('0x1f')](socket);var jayson=require(_0xec87('0x20'));var client=jayson[_0xec87('0x21')][_0xec87('0x22')]({'port':0x232c});var client9002=jayson[_0xec87('0x21')][_0xec87('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x167e2d,_0x6f9fac,_0x211b58,_0x958b1f){return new BPromise(function(_0x3fc39c,_0xf1f748){var _0x278cd1=_0x958b1f||client;return _0x278cd1[_0xec87('0x23')](_0x167e2d,_0x211b58)[_0xec87('0x24')](function(_0x562894){logger['info'](_0xec87('0x25'),_0x6f9fac,_0xec87('0x26'));logger[_0xec87('0x27')](_0xec87('0x28'),_0x6f9fac,_0xec87('0x26'),JSON['stringify'](_0x562894));if(_0x562894[_0xec87('0x29')]){if(_0x562894[_0xec87('0x29')][_0xec87('0x2a')]===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0x6f9fac,_0x562894[_0xec87('0x29')][_0xec87('0x2b')]);return _0xf1f748(_0x562894['error'][_0xec87('0x2b')]);}logger[_0xec87('0x29')]('FaxMessage,\x20%s,\x20%s',_0x6f9fac,_0x562894['error'][_0xec87('0x2b')]);return _0x3fc39c(_0x562894[_0xec87('0x29')][_0xec87('0x2b')]);}else{logger[_0xec87('0x2c')](_0xec87('0x25'),_0x6f9fac,_0xec87('0x26'));_0x3fc39c(_0x562894[_0xec87('0x2d')][_0xec87('0x2b')]);}})[_0xec87('0x2e')](function(_0x241173){logger[_0xec87('0x29')]('FaxMessage,\x20%s,\x20%s',_0x6f9fac,_0x241173);_0xf1f748(_0x241173);});});}function respondWithStatusCode(_0x4bfde3,_0x1b2780){_0x1b2780=_0x1b2780||0xcc;return function(_0x24afe6){if(_0x24afe6){return _0x4bfde3['sendStatus'](_0x1b2780);}return _0x4bfde3[_0xec87('0x2f')](_0x1b2780)[_0xec87('0x30')]();};}function respondWithResult(_0x3b5a9f,_0x3445ca){_0x3445ca=_0x3445ca||0xc8;return function(_0x1bcafb){if(_0x1bcafb){return _0x3b5a9f[_0xec87('0x2f')](_0x3445ca)[_0xec87('0x31')](_0x1bcafb);}};}function respondWithFilteredResult(_0x4f1bc8,_0x3a7160){return function(_0x1645a5){if(_0x1645a5){var _0x24ca6a=typeof _0x3a7160[_0xec87('0x32')]===_0xec87('0x33')&&typeof _0x3a7160[_0xec87('0x34')]===_0xec87('0x33');var _0x3929ab=_0x1645a5[_0xec87('0x35')];var _0x5bf1d6=_0x24ca6a?0x0:_0x3a7160[_0xec87('0x32')];var _0x501bf5=_0x24ca6a?_0x1645a5[_0xec87('0x35')]:_0x3a7160[_0xec87('0x32')]+_0x3a7160[_0xec87('0x34')];var _0x5d4c7e;if(_0x501bf5>=_0x3929ab){_0x501bf5=_0x3929ab;_0x5d4c7e=0xc8;}else{_0x5d4c7e=0xce;}_0x4f1bc8['status'](_0x5d4c7e);return _0x4f1bc8[_0xec87('0x36')](_0xec87('0x37'),_0x5bf1d6+'-'+_0x501bf5+'/'+_0x3929ab)['json'](_0x1645a5);}return null;};}function patchUpdates(_0x4b51d6){return function(_0x4e848c){try{jsonpatch['apply'](_0x4e848c,_0x4b51d6,!![]);}catch(_0x2a2408){return BPromise[_0xec87('0x38')](_0x2a2408);}return _0x4e848c[_0xec87('0x39')]();};}function saveUpdates(_0x58305c,_0x1d25bc){return function(_0x44fcac){if(_0x44fcac){return _0x44fcac[_0xec87('0x3a')](_0x58305c)['then'](function(_0x2d5eec){return _0x2d5eec;});}return null;};}function removeEntity(_0x3a9d00,_0x1275db){return function(_0x17138c){if(_0x17138c){return _0x17138c[_0xec87('0x3b')]()[_0xec87('0x24')](function(){_0x3a9d00[_0xec87('0x2f')](0xcc)[_0xec87('0x30')]();});}};}function handleEntityNotFound(_0x51ddbb,_0x1a1f04){return function(_0x552c37){if(!_0x552c37){_0x51ddbb[_0xec87('0x3c')](0x194);}return _0x552c37;};}function handleError(_0x4d390b,_0x2e5a8d){_0x2e5a8d=_0x2e5a8d||0x1f4;return function(_0x421022){logger[_0xec87('0x29')](_0x421022[_0xec87('0x3d')]);if(_0x421022[_0xec87('0x3e')]){delete _0x421022['name'];}_0x4d390b[_0xec87('0x2f')](_0x2e5a8d)['send'](_0x421022);};}exports[_0xec87('0x3f')]=function(_0x59e5da,_0x3688f8){var _0x7ecad5={},_0x422ad7={},_0x56abe9={'count':0x0,'rows':[]};var _0x2199c1=_[_0xec87('0x40')](db[_0xec87('0x41')][_0xec87('0x42')],function(_0xdd74d3){return{'name':_0xdd74d3[_0xec87('0x43')],'type':_0xdd74d3[_0xec87('0x44')][_0xec87('0x45')]};});_0x422ad7['model']=_[_0xec87('0x40')](_0x2199c1,_0xec87('0x3e'));_0x422ad7[_0xec87('0x46')]=_['keys'](_0x59e5da[_0xec87('0x46')]);_0x422ad7['filters']=_[_0xec87('0x47')](_0x422ad7['model'],_0x422ad7[_0xec87('0x46')]);_0x7ecad5[_0xec87('0x48')]=_[_0xec87('0x47')](_0x422ad7[_0xec87('0x49')],qs[_0xec87('0x4a')](_0x59e5da[_0xec87('0x46')][_0xec87('0x4a')]));_0x7ecad5['attributes']=_0x7ecad5['attributes'][_0xec87('0x4b')]?_0x7ecad5[_0xec87('0x48')]:_0x422ad7['model'];if(!_0x59e5da[_0xec87('0x46')][_0xec87('0x4c')](_0xec87('0x4d'))){_0x7ecad5['limit']=qs[_0xec87('0x34')](_0x59e5da['query'][_0xec87('0x34')]);_0x7ecad5['offset']=qs[_0xec87('0x32')](_0x59e5da['query'][_0xec87('0x32')]);}_0x7ecad5[_0xec87('0x4e')]=qs[_0xec87('0x4f')](_0x59e5da[_0xec87('0x46')][_0xec87('0x4f')]);_0x7ecad5['where']=qs['filters'](_[_0xec87('0x50')](_0x59e5da[_0xec87('0x46')],_0x422ad7[_0xec87('0x51')]),_0x2199c1);if(_0x59e5da[_0xec87('0x46')][_0xec87('0x52')]){_0x7ecad5[_0xec87('0x53')]=_['merge'](_0x7ecad5['where'],{'$or':_[_0xec87('0x40')](_0x2199c1,function(_0x43a530){if(_0x43a530['type']!=='VIRTUAL'){var _0x260591={};_0x260591[_0x43a530[_0xec87('0x3e')]]={'$like':'%'+_0x59e5da['query'][_0xec87('0x52')]+'%'};return _0x260591;}})});}_0x7ecad5=_[_0xec87('0x54')]({},_0x7ecad5,_0x59e5da[_0xec87('0x55')]);var _0x218a40={'where':_0x7ecad5['where']};return db[_0xec87('0x41')][_0xec87('0x35')](_0x218a40)[_0xec87('0x24')](function(_0x3c551a){_0x56abe9[_0xec87('0x35')]=_0x3c551a;if(_0x59e5da[_0xec87('0x46')][_0xec87('0x56')]){_0x7ecad5[_0xec87('0x57')]=[{'all':!![]}];}return db[_0xec87('0x41')][_0xec87('0x58')](_0x7ecad5);})[_0xec87('0x24')](function(_0x574992){_0x56abe9[_0xec87('0x59')]=_0x574992;return _0x56abe9;})[_0xec87('0x24')](respondWithFilteredResult(_0x3688f8,_0x7ecad5))[_0xec87('0x2e')](handleError(_0x3688f8,null));};exports['show']=function(_0x130fa7,_0x17e99a){var _0x44c6b2={'raw':!![],'where':{'id':_0x130fa7[_0xec87('0x5a')]['id']}},_0x32254d={};_0x32254d[_0xec87('0x49')]=_[_0xec87('0x5b')](db[_0xec87('0x41')][_0xec87('0x42')]);_0x32254d[_0xec87('0x46')]=_[_0xec87('0x5b')](_0x130fa7[_0xec87('0x46')]);_0x32254d[_0xec87('0x51')]=_[_0xec87('0x47')](_0x32254d['model'],_0x32254d['query']);_0x44c6b2[_0xec87('0x48')]=_['intersection'](_0x32254d[_0xec87('0x49')],qs[_0xec87('0x4a')](_0x130fa7[_0xec87('0x46')][_0xec87('0x4a')]));_0x44c6b2[_0xec87('0x48')]=_0x44c6b2[_0xec87('0x48')][_0xec87('0x4b')]?_0x44c6b2['attributes']:_0x32254d[_0xec87('0x49')];if(_0x130fa7[_0xec87('0x46')][_0xec87('0x56')]){_0x44c6b2[_0xec87('0x57')]=[{'all':!![]}];}_0x44c6b2=_[_0xec87('0x54')]({},_0x44c6b2,_0x130fa7[_0xec87('0x55')]);return db[_0xec87('0x41')]['find'](_0x44c6b2)['then'](handleEntityNotFound(_0x17e99a,null))[_0xec87('0x24')](respondWithResult(_0x17e99a,null))[_0xec87('0x2e')](handleError(_0x17e99a,null));};exports[_0xec87('0x3a')]=function(_0x5842e9,_0x25e806){if(_0x5842e9[_0xec87('0x5c')]['id']){delete _0x5842e9[_0xec87('0x5c')]['id'];}return db[_0xec87('0x41')]['find']({'where':{'id':_0x5842e9[_0xec87('0x5a')]['id']}})[_0xec87('0x24')](handleEntityNotFound(_0x25e806,null))[_0xec87('0x24')](saveUpdates(_0x5842e9[_0xec87('0x5c')],null))['then'](respondWithResult(_0x25e806,null))[_0xec87('0x2e')](handleError(_0x25e806,null));};exports['destroy']=function(_0x455b85,_0x3ddb67){return db[_0xec87('0x41')][_0xec87('0x5d')]({'where':{'id':_0x455b85[_0xec87('0x5a')]['id']}})['then'](handleEntityNotFound(_0x3ddb67,null))[_0xec87('0x24')](removeEntity(_0x3ddb67,null))[_0xec87('0x2e')](handleError(_0x3ddb67,null));};exports[_0xec87('0x5e')]=function(_0x4ee5b9,_0x5e8384){return db[_0xec87('0x41')][_0xec87('0x5e')]()[_0xec87('0x24')](respondWithResult(_0x5e8384,null))[_0xec87('0x2e')](handleError(_0x5e8384,null));};var interaction_log=require(_0xec87('0x14'))('fax-interactions');exports[_0xec87('0x5f')]=function(_0xfc2e84,_0x34d0ce,_0x22150c){var _0x4039ea={'agent':{},'channel':_0xec87('0x60')};if(_0xfc2e84['body']['id']){delete _0xfc2e84[_0xec87('0x5c')]['id'];}_0xfc2e84[_0xec87('0x5c')][_0xec87('0x61')]=!![];_0xfc2e84[_0xec87('0x5c')][_0xec87('0x62')]=moment()[_0xec87('0x63')](_0xec87('0x64'));_0xfc2e84[_0xec87('0x5c')][_0xec87('0x65')]=_0xfc2e84[_0xec87('0x5c')][_0xec87('0x65')]||_0xfc2e84[_0xec87('0x66')]['id'];_0x4039ea[_0xec87('0x67')]['id']=_0xfc2e84['body'][_0xec87('0x65')];return db['FaxMessage'][_0xec87('0x5d')]({'where':{'id':_0xfc2e84['params']['id'],'UserId':null}})[_0xec87('0x24')](handleEntityNotFound(_0x34d0ce,null))[_0xec87('0x24')](saveUpdates(_0xfc2e84[_0xec87('0x5c')],null))[_0xec87('0x24')](function(_0x1ef4f2){if(_0x1ef4f2){_0x4039ea[_0xec87('0x2b')]=_0x1ef4f2[_0xec87('0x68')]({'plain':!![]});return db[_0xec87('0x69')]['find']({'where':{'id':_0x1ef4f2['FaxInteractionId']}});}return null;})[_0xec87('0x24')](handleEntityNotFound(_0x34d0ce,null))[_0xec87('0x24')](function(_0x59acd1){if(_0x59acd1){return _0x59acd1[_0xec87('0x3a')]({'UserId':_0xfc2e84[_0xec87('0x5c')][_0xec87('0x65')],'read1stAt':_[_0xec87('0x6a')](_0x59acd1['read1stAt'])?moment()[_0xec87('0x63')](_0xec87('0x64')):undefined});}return null;})[_0xec87('0x24')](function(_0x1077e5){if(_0x1077e5){_0x4039ea['interaction']=_0x1077e5[_0xec87('0x68')]({'plain':!![]});interaction_log[_0xec87('0x2c')](_0xec87('0x6b'),_0xfc2e84['user']['id'],_0xfc2e84[_0xec87('0x66')][_0xec87('0x3e')],_0xfc2e84[_0xec87('0x66')]['role'],_0x4039ea[_0xec87('0x6c')]['id'],_0xfc2e84[_0xec87('0x5c')]?JSON[_0xec87('0x6d')](_0xfc2e84[_0xec87('0x5c')]):_0xec87('0x6e'));return respondWithRpcPromise(_0xec87('0x6f'),_0xec87('0x70'),_0x4039ea);}return null;})[_0xec87('0x24')](function(_0x5c0ba6){var _0xac7e28=_0xec87('0x71')+_0x5c0ba6[_0xec87('0x2b')][_0xec87('0x72')];return db['sequelize'][_0xec87('0x46')](_0xac7e28,{'type':db['Sequelize']['QueryTypes'][_0xec87('0x73')],'raw':!![]})[_0xec87('0x24')](function(_0x4b42ae){return _0x4b42ae;});})[_0xec87('0x24')](function(_0x5d48b1){if(_0x5d48b1){_0x4039ea[_0xec87('0x2b')][_0xec87('0x74')]=_0x5d48b1[0x0];if(!_0xfc2e84['body'][_0xec87('0x65')])return;return db[_0xec87('0x75')][_0xec87('0x5d')]({'where':{'id':_0xfc2e84['body'][_0xec87('0x65')],'role':_0xec87('0x67')},'attributes':['id',_0xec87('0x3e'),'fullname',_0xec87('0x76'),_0xec87('0x77')],'raw':!![]});}return null;})[_0xec87('0x24')](function(_0x1b60c7){if(!_0x1b60c7)return null;_0x4039ea[_0xec87('0x2b')][_0xec87('0x67')]=_0x1b60c7;return _0x4039ea;})[_0xec87('0x24')](function(_0x3b7967){if(_0x3b7967){if(_0xfc2e84[_0xec87('0x5c')]['manual']){_0x4039ea[_0xec87('0x2b')]['interface']=util[_0xec87('0x63')]('SIP/%s',_0xfc2e84[_0xec87('0x66')]['name']);_0x4039ea[_0xec87('0x2b')][_0xec87('0x78')]=_0x4039ea[_0xec87('0x78')];_0x4039ea['message'][_0xec87('0x79')]=_0x4039ea[_0xec87('0x78')];_0x4039ea['message']['event']=_0xec87('0x5f');return respondWithRpcPromise(_0xec87('0x7a'),_0xec87('0x7a'),{'event':_0xec87('0x7b'),'message':_0x4039ea['message']},client9002)[_0xec87('0x24')](function(){return _0x4039ea;});}return _0x4039ea;}return null;})[_0xec87('0x24')](respondWithResult(_0x34d0ce,null))['catch'](handleError(_0x34d0ce,null));};var interaction_log=require(_0xec87('0x14'))('fax-interactions');exports[_0xec87('0x38')]=function(_0x395165,_0x4b622d,_0x3639a4){var _0x232bbd={'agent':{},'channel':'fax'};if(_0x395165['body']['id']){delete _0x395165[_0xec87('0x5c')]['id'];}_0x395165['body']['UserId']=_0x395165['body'][_0xec87('0x65')]||_0x395165['user']['id'];_0x232bbd[_0xec87('0x67')]['id']=_0x395165[_0xec87('0x5c')][_0xec87('0x65')];return db[_0xec87('0x41')]['find']({'where':{'id':_0x395165['params']['id'],'UserId':null}})[_0xec87('0x24')](handleEntityNotFound(_0x4b622d,null))[_0xec87('0x24')](function(_0x592505){if(_0x592505){_0x232bbd[_0xec87('0x2b')]=_0x592505[_0xec87('0x68')]({'plain':!![]});return db['FaxInteraction'][_0xec87('0x5d')]({'where':{'id':_0x592505[_0xec87('0x7c')]}});}return null;})[_0xec87('0x24')](handleEntityNotFound(_0x4b622d,null))[_0xec87('0x24')](function(_0x2a5b20){if(_0x2a5b20){_0x232bbd[_0xec87('0x6c')]=_0x2a5b20[_0xec87('0x68')]({'plain':!![]});interaction_log['info'](_0xec87('0x7d'),_0x395165[_0xec87('0x66')]['id'],_0x395165[_0xec87('0x66')][_0xec87('0x3e')],_0x395165[_0xec87('0x66')][_0xec87('0x7e')],_0x232bbd[_0xec87('0x6c')]['id'],_0x395165[_0xec87('0x5c')]?JSON[_0xec87('0x6d')](_0x395165[_0xec87('0x5c')]):'null');return respondWithRpcPromise(_0xec87('0x7f'),_0xec87('0x80'),_0x232bbd);}return null;})[_0xec87('0x24')](function(_0x58378a){var _0x2ba0ea=_0xec87('0x71')+_0x58378a[_0xec87('0x2b')][_0xec87('0x72')];return db[_0xec87('0x81')]['query'](_0x2ba0ea,{'type':db[_0xec87('0x82')][_0xec87('0x83')][_0xec87('0x73')],'raw':!![]})[_0xec87('0x24')](function(_0x4d627c){return _0x4d627c;});})[_0xec87('0x24')](function(_0xe469c9){if(_0xe469c9){_0x232bbd[_0xec87('0x2b')][_0xec87('0x74')]=_0xe469c9[0x0];if(!_0x395165[_0xec87('0x5c')][_0xec87('0x65')])return;return db['User'][_0xec87('0x5d')]({'where':{'id':_0x395165[_0xec87('0x5c')][_0xec87('0x65')],'role':_0xec87('0x67')},'attributes':['id',_0xec87('0x3e'),'fullname',_0xec87('0x76'),_0xec87('0x77')],'raw':!![]});}return null;})[_0xec87('0x24')](function(_0x2ab4de){if(!_0x2ab4de)return null;_0x232bbd['message']['agent']=_0x2ab4de;return _0x232bbd;})['then'](function(_0x24e534){if(_0x24e534){_0x24e534[_0xec87('0x2b')]['interface']=util[_0xec87('0x63')](_0xec87('0x84'),_0x395165[_0xec87('0x66')][_0xec87('0x3e')]);_0x24e534['message'][_0xec87('0x78')]=_0x232bbd['channel'];_0x24e534[_0xec87('0x2b')][_0xec87('0x79')]=_0x232bbd['channel'];_0x24e534[_0xec87('0x2b')][_0xec87('0x85')]=_0xec87('0x38');respondWithRpcPromise(_0xec87('0x7a'),'EventManager',{'event':_0xec87('0x86'),'message':_0x24e534['message']},client9002);return _0x232bbd;}return null;})['then'](respondWithResult(_0x4b622d,null))['catch'](handleError(_0x4b622d,null));};exports['create']=function(_0x595334,_0x5e7345){var _0x47af5a;return db[_0xec87('0x41')]['create'](_0x595334[_0xec87('0x5c')],{})['then'](function(_0x2a0493){_0x47af5a=_0x2a0493;return db[_0xec87('0x87')][_0xec87('0x88')]({'where':{'id':_0x47af5a[_0xec87('0x72')]}});})[_0xec87('0x24')](function(_0x91f2f3){if(_['isNil'](_0x91f2f3)){return;}else{_0x47af5a[_0xec87('0x60')]=_0x91f2f3[_0xec87('0x60')];return db[_0xec87('0x89')][_0xec87('0x88')]({'where':{'id':_0x47af5a[_0xec87('0x8a')]}});}})['then'](function(_0x3c3162){return respondWithRpcPromise(_0xec87('0x8b'),'SendFax',{'FaxAccountId':_[_0xec87('0x6a')](_0x595334[_0xec87('0x5c')])?undefined:_0x595334[_0xec87('0x5c')][_0xec87('0x8c')],'path':_[_0xec87('0x6a')](_0x3c3162)?undefined:util[_0xec87('0x63')](_0xec87('0x8d'),_0x3c3162[_0xec87('0x8e')]),'fax':_['isNil'](_0x47af5a[_0xec87('0x60')])?undefined:_0x47af5a['fax'],'AttachmentId':_0x47af5a[_0xec87('0x8a')]},client9002);})[_0xec87('0x24')](respondWithResult(_0x5e7345,0xc9))[_0xec87('0x2e')](handleError(_0x5e7345,null));};exports[_0xec87('0x8f')]=function(_0x44c004,_0x143327){var _0xac3e43=path[_0xec87('0x90')](config['root'],'server',_0xec87('0x91'),'attachments');return db['FaxMessage'][_0xec87('0x5d')]({'where':{'id':_0x44c004[_0xec87('0x5a')]['id']},'include':[{'model':db[_0xec87('0x89')],'as':_0xec87('0x89')}]})[_0xec87('0x24')](handleEntityNotFound(_0x143327,null))[_0xec87('0x24')](function(_0x19b103){if(_0x19b103){return _0x143327[_0xec87('0x8f')](path[_0xec87('0x90')](_0xac3e43,_0x19b103[_0xec87('0x89')]['basename']));}})[_0xec87('0x2e')](handleError(_0x143327,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 85a4034..96f3ebe 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 _0xb091=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','../../mysqldb','FaxMessage'];(function(_0x518f52,_0x14c370){var _0x5011ab=function(_0x29fca4){while(--_0x29fca4){_0x518f52['push'](_0x518f52['shift']());}};_0x5011ab(++_0x14c370);}(_0xb091,0x16e));var _0x1b09=function(_0x479ff0,_0x41caf8){_0x479ff0=_0x479ff0-0x0;var _0x2478e0=_0xb091[_0x479ff0];return _0x2478e0;};'use strict';var EventEmitter=require('events');var FaxMessage=require(_0x1b09('0x0'))['db'][_0x1b09('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x1b09('0x2')](0x0);var events={'afterCreate':_0x1b09('0x3'),'afterUpdate':'update','afterDestroy':_0x1b09('0x4')};function emitEvent(_0x59af61){return function(_0x5aa3b0,_0x295863,_0x24d22c){FaxMessageEvents['emit'](_0x59af61+':'+_0x5aa3b0['id'],_0x5aa3b0);FaxMessageEvents[_0x1b09('0x5')](_0x59af61,_0x5aa3b0);_0x24d22c(null);};}for(var e in events){if(events[_0x1b09('0x6')](e)){var event=events[e];FaxMessage[_0x1b09('0x7')](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file +var _0xd206=['save','update','emit','exports','events','../../mysqldb','setMaxListeners'];(function(_0x1815b2,_0xdd376f){var _0x11fa9d=function(_0x2d37a0){while(--_0x2d37a0){_0x1815b2['push'](_0x1815b2['shift']());}};_0x11fa9d(++_0xdd376f);}(_0xd206,0x107));var _0x6d20=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0xd206[_0x2e4e19];return _0x9ba20b;};'use strict';var EventEmitter=require(_0x6d20('0x0'));var FaxMessage=require(_0x6d20('0x1'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x6d20('0x2')](0x0);var events={'afterCreate':_0x6d20('0x3'),'afterUpdate':_0x6d20('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5c6c6a){return function(_0x28bc49,_0x243da3,_0x3acacb){FaxMessageEvents['emit'](_0x5c6c6a+':'+_0x28bc49['id'],_0x28bc49);FaxMessageEvents[_0x6d20('0x5')](_0x5c6c6a,_0x28bc49);_0x3acacb(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0x6d20('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 d5b146e..98d14b6 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 _0x2120=['models','get','direction','toLowerCase','out','secret','isNil','UserId','FaxInteraction','findOne','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','request-promise','path','exports','define','FaxMessage','fax_messages','body'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2120,0xfa));var _0x0212=function(_0x25efdf,_0x521462){_0x25efdf=_0x25efdf-0x0;var _0x22c495=_0x2120[_0x25efdf];return _0x22c495;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0212('0x0'))(_0x0212('0x1'));var moment=require(_0x0212('0x2'));var BPromise=require('bluebird');var rp=require(_0x0212('0x3'));var fs=require('fs');var path=require(_0x0212('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./faxMessage.attributes');module[_0x0212('0x5')]=function(_0x12c663,_0x284840){return _0x12c663[_0x0212('0x6')](_0x0212('0x7'),attributes,{'tableName':_0x0212('0x8'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0x0212('0x9')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x436692,_0x2d95f9,_0x17f32d){var _0x3cf41f=_0x12c663[_0x0212('0xa')];var _0x3b6e61=_0x436692[_0x0212('0xb')]({'plain':!![]});if(_0x3b6e61[_0x0212('0xc')][_0x0212('0xd')]()==='in'||_0x3b6e61[_0x0212('0xc')][_0x0212('0xd')]()===_0x0212('0xe')&&!_0x3b6e61[_0x0212('0xf')]&&!_[_0x0212('0x10')](_0x3b6e61[_0x0212('0x11')])){_0x3cf41f[_0x0212('0x12')][_0x0212('0x13')]({'where':{'id':_0x3b6e61['FaxInteractionId']}})['then'](function(_0x404716){if(_0x404716){_0x404716[_0x0212('0x14')]({'lastMsgAt':_0x3b6e61[_0x0212('0x15')],'lastMsgDirection':_0x3b6e61[_0x0212('0xc')][_0x0212('0xd')]()});}})[_0x0212('0x16')](function(_0xce8c3){console[_0x0212('0x17')](_0xce8c3);});}_0x17f32d();}},'charset':_0x0212('0x18'),'collate':_0x0212('0x19')});}; \ No newline at end of file +var _0x24ac=['../../config/logger','api','moment','path','rimraf','./faxMessage.attributes','exports','define','FaxMessage','body','FULLTEXT','models','get','direction','toLowerCase','secret','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','then','createdAt','error','utf8mb4','utf8mb4_unicode_ci','util'];(function(_0x328534,_0x33b41e){var _0x2796c0=function(_0x1ba8ad){while(--_0x1ba8ad){_0x328534['push'](_0x328534['shift']());}};_0x2796c0(++_0x33b41e);}(_0x24ac,0x1ca));var _0xc24a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x24ac[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xc24a('0x0'));var logger=require(_0xc24a('0x1'))(_0xc24a('0x2'));var moment=require(_0xc24a('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc24a('0x4'));var rimraf=require(_0xc24a('0x5'));var config=require('../../config/environment');var attributes=require(_0xc24a('0x6'));module[_0xc24a('0x7')]=function(_0x1e2241,_0x6178ad){return _0x1e2241[_0xc24a('0x8')](_0xc24a('0x9'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0xc24a('0xa')],'type':_0xc24a('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x541cac,_0x37f881,_0x3aea4e){var _0x7a4419=_0x1e2241[_0xc24a('0xc')];var _0x4d1e74=_0x541cac[_0xc24a('0xd')]({'plain':!![]});if(_0x4d1e74[_0xc24a('0xe')][_0xc24a('0xf')]()==='in'||_0x4d1e74[_0xc24a('0xe')][_0xc24a('0xf')]()==='out'&&!_0x4d1e74[_0xc24a('0x10')]&&!_[_0xc24a('0x11')](_0x4d1e74[_0xc24a('0x12')])){_0x7a4419[_0xc24a('0x13')][_0xc24a('0x14')]({'where':{'id':_0x4d1e74[_0xc24a('0x15')]}})[_0xc24a('0x16')](function(_0x29d7d3){if(_0x29d7d3){_0x29d7d3['update']({'lastMsgAt':_0x4d1e74[_0xc24a('0x17')],'lastMsgDirection':_0x4d1e74[_0xc24a('0xe')][_0xc24a('0xf')]()});}})['catch'](function(_0x521c17){console[_0xc24a('0x18')](_0x521c17);});}_0x3aea4e();}},'charset':_0xc24a('0x19'),'collate':_0xc24a('0x1a')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 9e5beb3..2828c1e 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 _0x2d17=['create','catch','UpdateFaxMessage','FaxMessage','body','options','where','attributes','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','http','redis','localhost','socket.io-emitter','./faxMessage.socket','register','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','CreateFaxMessage'];(function(_0x24a371,_0x2433c2){var _0x1d1a4e=function(_0x26ecb9){while(--_0x26ecb9){_0x24a371['push'](_0x24a371['shift']());}};_0x1d1a4e(++_0x2433c2);}(_0x2d17,0x17e));var _0x72d1=function(_0x3b1d67,_0x197090){_0x3b1d67=_0x3b1d67-0x0;var _0xf36b06=_0x2d17[_0x3b1d67];return _0xf36b06;};'use strict';var _=require(_0x72d1('0x0'));var util=require(_0x72d1('0x1'));var moment=require('moment');var BPromise=require(_0x72d1('0x2'));var rs=require(_0x72d1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x72d1('0x4'))['db'];var utils=require(_0x72d1('0x5'));var logger=require('../../config/logger')(_0x72d1('0x6'));var config=require('../../config/environment');var jayson=require(_0x72d1('0x7'));var client=jayson['client'][_0x72d1('0x8')]({'port':0x232a});config[_0x72d1('0x9')]=_['defaults'](config[_0x72d1('0x9')],{'host':_0x72d1('0xa'),'port':0x18eb});var socket=require(_0x72d1('0xb'))(new Redis(config['redis']));require(_0x72d1('0xc'))[_0x72d1('0xd')](socket);function respondWithRpcPromise(_0x283775,_0x593c91,_0x1d7520){return new BPromise(function(_0x3a35c6,_0x45eb4a){return client[_0x72d1('0xe')](_0x283775,_0x1d7520)[_0x72d1('0xf')](function(_0x3916f2){logger[_0x72d1('0x10')](_0x72d1('0x11'),_0x593c91,_0x72d1('0x12'));logger[_0x72d1('0x13')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x593c91,_0x72d1('0x12'),JSON[_0x72d1('0x14')](_0x3916f2));if(_0x3916f2[_0x72d1('0x15')]){if(_0x3916f2[_0x72d1('0x15')][_0x72d1('0x16')]===0x1f4){logger[_0x72d1('0x15')](_0x72d1('0x11'),_0x593c91,_0x3916f2[_0x72d1('0x15')][_0x72d1('0x17')]);return _0x45eb4a(_0x3916f2[_0x72d1('0x15')][_0x72d1('0x17')]);}logger[_0x72d1('0x15')](_0x72d1('0x11'),_0x593c91,_0x3916f2['error'][_0x72d1('0x17')]);return _0x3a35c6(_0x3916f2['error'][_0x72d1('0x17')]);}else{logger[_0x72d1('0x10')]('FaxMessage,\x20%s,\x20%s',_0x593c91,_0x72d1('0x12'));_0x3a35c6(_0x3916f2[_0x72d1('0x18')][_0x72d1('0x17')]);}})['catch'](function(_0x4925f6){logger[_0x72d1('0x15')](_0x72d1('0x11'),_0x593c91,_0x4925f6);_0x45eb4a(_0x4925f6);});});}exports[_0x72d1('0x19')]=function(_0x1865c1){var _0x8d6890=this;return new Promise(function(_0x2253fd,_0x1e2411){return db['FaxMessage'][_0x72d1('0x1a')](_0x1865c1['body'],{'raw':_0x1865c1['options']?_0x1865c1['options']['raw']===undefined?!![]:![]:!![]})[_0x72d1('0xf')](function(_0x374602){logger['info'](_0x72d1('0x19'),_0x1865c1);logger[_0x72d1('0x13')](_0x72d1('0x19'),_0x1865c1,JSON[_0x72d1('0x14')](_0x374602));_0x2253fd(_0x374602);})[_0x72d1('0x1b')](function(_0x4e6acd){logger['error'](_0x72d1('0x19'),_0x4e6acd[_0x72d1('0x17')],_0x1865c1);_0x1e2411(_0x8d6890[_0x72d1('0x15')](0x1f4,_0x4e6acd[_0x72d1('0x17')]));});});};exports[_0x72d1('0x1c')]=function(_0x33d530){var _0x163bec=this;return new Promise(function(_0x589f7c,_0x57ec9e){return db[_0x72d1('0x1d')]['update'](_0x33d530[_0x72d1('0x1e')],{'raw':_0x33d530[_0x72d1('0x1f')]?_0x33d530[_0x72d1('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x33d530[_0x72d1('0x1f')]?_0x33d530['options'][_0x72d1('0x20')]||null:null,'attributes':_0x33d530[_0x72d1('0x1f')]?_0x33d530[_0x72d1('0x1f')][_0x72d1('0x21')]||null:null,'limit':_0x33d530['options']?_0x33d530[_0x72d1('0x1f')]['limit']||null:null})[_0x72d1('0xf')](function(_0x32dc5e){logger['info'](_0x72d1('0x1c'),_0x33d530);logger[_0x72d1('0x13')](_0x72d1('0x1c'),_0x33d530,JSON[_0x72d1('0x14')](_0x32dc5e));_0x589f7c(_0x32dc5e);})[_0x72d1('0x1b')](function(_0x52511f){logger[_0x72d1('0x15')](_0x72d1('0x1c'),_0x52511f[_0x72d1('0x17')],_0x33d530);_0x57ec9e(_0x163bec['error'](0x1f4,_0x52511f[_0x72d1('0x17')]));});});}; \ No newline at end of file +var _0xda55=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','CreateFaxMessage','FaxMessage','body','options','raw','catch','update','where','limit','debug','UpdateFaxMessage','lodash','util'];(function(_0x1825a8,_0x52f2d8){var _0x1e42ee=function(_0x2078d4){while(--_0x2078d4){_0x1825a8['push'](_0x1825a8['shift']());}};_0x1e42ee(++_0x52f2d8);}(_0xda55,0x6d));var _0x5da5=function(_0x855e77,_0x348ad7){_0x855e77=_0x855e77-0x0;var _0x1edd15=_0xda55[_0x855e77];return _0x1edd15;};'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});config[_0x5da5('0x9')]=_[_0x5da5('0xa')](config[_0x5da5('0x9')],{'host':_0x5da5('0xb'),'port':0x18eb});var socket=require(_0x5da5('0xc'))(new Redis(config[_0x5da5('0x9')]));require(_0x5da5('0xd'))[_0x5da5('0xe')](socket);function respondWithRpcPromise(_0x5c056f,_0x3ed24c,_0x1f98a7){return new BPromise(function(_0x2731a3,_0x26fbe3){return client[_0x5da5('0xf')](_0x5c056f,_0x1f98a7)[_0x5da5('0x10')](function(_0x33313e){logger['info'](_0x5da5('0x11'),_0x3ed24c,_0x5da5('0x12'));logger['debug'](_0x5da5('0x13'),_0x3ed24c,_0x5da5('0x12'),JSON[_0x5da5('0x14')](_0x33313e));if(_0x33313e[_0x5da5('0x15')]){if(_0x33313e[_0x5da5('0x15')][_0x5da5('0x16')]===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0x3ed24c,_0x33313e['error'][_0x5da5('0x17')]);return _0x26fbe3(_0x33313e[_0x5da5('0x15')][_0x5da5('0x17')]);}logger[_0x5da5('0x15')](_0x5da5('0x11'),_0x3ed24c,_0x33313e[_0x5da5('0x15')][_0x5da5('0x17')]);return _0x2731a3(_0x33313e['error'][_0x5da5('0x17')]);}else{logger[_0x5da5('0x18')](_0x5da5('0x11'),_0x3ed24c,_0x5da5('0x12'));_0x2731a3(_0x33313e[_0x5da5('0x19')][_0x5da5('0x17')]);}})['catch'](function(_0x1920e2){logger[_0x5da5('0x15')](_0x5da5('0x11'),_0x3ed24c,_0x1920e2);_0x26fbe3(_0x1920e2);});});}exports[_0x5da5('0x1a')]=function(_0xf023af){var _0x513a34=this;return new Promise(function(_0x4393d7,_0x3372fc){return db[_0x5da5('0x1b')]['create'](_0xf023af[_0x5da5('0x1c')],{'raw':_0xf023af[_0x5da5('0x1d')]?_0xf023af[_0x5da5('0x1d')][_0x5da5('0x1e')]===undefined?!![]:![]:!![]})[_0x5da5('0x10')](function(_0x436960){logger['info'](_0x5da5('0x1a'),_0xf023af);logger['debug'](_0x5da5('0x1a'),_0xf023af,JSON[_0x5da5('0x14')](_0x436960));_0x4393d7(_0x436960);})[_0x5da5('0x1f')](function(_0x5d983c){logger[_0x5da5('0x15')](_0x5da5('0x1a'),_0x5d983c[_0x5da5('0x17')],_0xf023af);_0x3372fc(_0x513a34[_0x5da5('0x15')](0x1f4,_0x5d983c['message']));});});};exports['UpdateFaxMessage']=function(_0x50aadc){var _0x3526cf=this;return new Promise(function(_0x56d509,_0x4e8890){return db[_0x5da5('0x1b')][_0x5da5('0x20')](_0x50aadc['body'],{'raw':_0x50aadc[_0x5da5('0x1d')]?_0x50aadc[_0x5da5('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x50aadc[_0x5da5('0x1d')]?_0x50aadc[_0x5da5('0x1d')][_0x5da5('0x21')]||null:null,'attributes':_0x50aadc[_0x5da5('0x1d')]?_0x50aadc[_0x5da5('0x1d')]['attributes']||null:null,'limit':_0x50aadc[_0x5da5('0x1d')]?_0x50aadc[_0x5da5('0x1d')][_0x5da5('0x22')]||null:null})[_0x5da5('0x10')](function(_0x55e2bf){logger['info']('UpdateFaxMessage',_0x50aadc);logger[_0x5da5('0x23')](_0x5da5('0x24'),_0x50aadc,JSON[_0x5da5('0x14')](_0x55e2bf));_0x56d509(_0x55e2bf);})[_0x5da5('0x1f')](function(_0x51b712){logger['error'](_0x5da5('0x24'),_0x51b712['message'],_0x50aadc);_0x4e8890(_0x3526cf['error'](0x1f4,_0x51b712[_0x5da5('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index b1ebdc4..ad1b258 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 _0xa850=['register','length','faxMessage:','./faxMessage.events','save','remove','update','emit','removeListener'];(function(_0x1ab295,_0x4b08f8){var _0x3c2758=function(_0x121f4d){while(--_0x121f4d){_0x1ab295['push'](_0x1ab295['shift']());}};_0x3c2758(++_0x4b08f8);}(_0xa850,0x1a1));var _0x0a85=function(_0x263657,_0x4f3320){_0x263657=_0x263657-0x0;var _0x2e029d=_0xa850[_0x263657];return _0x2e029d;};'use strict';var FaxMessageEvents=require(_0x0a85('0x0'));var events=[_0x0a85('0x1'),_0x0a85('0x2'),_0x0a85('0x3')];function createListener(_0x14ef75,_0x15d5d0){return function(_0x393cb2){_0x15d5d0[_0x0a85('0x4')](_0x14ef75,_0x393cb2);};}function removeListener(_0x1b1dd8,_0x1fa3ad){return function(){FaxMessageEvents[_0x0a85('0x5')](_0x1b1dd8,_0x1fa3ad);};}exports[_0x0a85('0x6')]=function(_0x4def0a){for(var _0x77ac2c=0x0,_0x271f9b=events[_0x0a85('0x7')];_0x77ac2c<_0x271f9b;_0x77ac2c++){var _0x505dcc=events[_0x77ac2c];var _0x36e867=createListener(_0x0a85('0x8')+_0x505dcc,_0x4def0a);FaxMessageEvents['on'](_0x505dcc,_0x36e867);}}; \ No newline at end of file +var _0xb171=['removeListener','length','faxMessage:','./faxMessage.events','save','remove','update','emit'];(function(_0x10e653,_0x59f1cc){var _0x328dfd=function(_0x2bc428){while(--_0x2bc428){_0x10e653['push'](_0x10e653['shift']());}};_0x328dfd(++_0x59f1cc);}(_0xb171,0x17b));var _0x1b17=function(_0x49d547,_0x5d1c12){_0x49d547=_0x49d547-0x0;var _0x2e9002=_0xb171[_0x49d547];return _0x2e9002;};'use strict';var FaxMessageEvents=require(_0x1b17('0x0'));var events=[_0x1b17('0x1'),_0x1b17('0x2'),_0x1b17('0x3')];function createListener(_0x2eb99f,_0x4a1c8b){return function(_0xf4924e){_0x4a1c8b[_0x1b17('0x4')](_0x2eb99f,_0xf4924e);};}function removeListener(_0x5966e7,_0xbd55d5){return function(){FaxMessageEvents[_0x1b17('0x5')](_0x5966e7,_0xbd55d5);};}exports['register']=function(_0x357ef6){for(var _0x8456ce=0x0,_0x3ee28d=events[_0x1b17('0x6')];_0x8456ce<_0x3ee28d;_0x8456ce++){var _0x5088a8=events[_0x8456ce];var _0x3a4122=createListener(_0x1b17('0x7')+_0x5088a8,_0x357ef6);FaxMessageEvents['on'](_0x5088a8,_0x3a4122);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 3e55252..7f8bd7d 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 _0x153f=['util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./faxMessage.controller','get','isAuthenticated','index','describe','/:id','show','/:id/download','download','tracked','fax','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer'];(function(_0x26da89,_0x264785){var _0xc95b7b=function(_0x230e5b){while(--_0x230e5b){_0x26da89['push'](_0x26da89['shift']());}};_0xc95b7b(++_0x264785);}(_0x153f,0x15b));var _0xf153=function(_0x237cbc,_0x223cce){_0x237cbc=_0x237cbc-0x0;var _0x4019f5=_0x153f[_0x237cbc];return _0x4019f5;};'use strict';var multer=require(_0xf153('0x0'));var util=require(_0xf153('0x1'));var path=require(_0xf153('0x2'));var timeout=require(_0xf153('0x3'));var express=require(_0xf153('0x4'));var router=express[_0xf153('0x5')]();var fs_extra=require(_0xf153('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xf153('0x7'));var config=require('../../config/environment');var controller=require(_0xf153('0x8'));router[_0xf153('0x9')]('/',auth[_0xf153('0xa')](),controller[_0xf153('0xb')]);router[_0xf153('0x9')]('/describe',auth[_0xf153('0xa')](),controller[_0xf153('0xc')]);router[_0xf153('0x9')](_0xf153('0xd'),auth[_0xf153('0xa')](),controller[_0xf153('0xe')]);router[_0xf153('0x9')](_0xf153('0xf'),auth[_0xf153('0xa')](),controller[_0xf153('0x10')]);router['post']('/',auth[_0xf153('0xa')](),interaction[_0xf153('0x11')](_0xf153('0x12'),'faxmessage:create'),controller[_0xf153('0x13')]);router[_0xf153('0x14')](_0xf153('0xd'),auth[_0xf153('0xa')](),controller[_0xf153('0x15')]);router[_0xf153('0x14')](_0xf153('0x16'),auth[_0xf153('0xa')](),controller[_0xf153('0x17')]);router['put'](_0xf153('0x18'),auth[_0xf153('0xa')](),controller[_0xf153('0x19')]);router[_0xf153('0x1a')](_0xf153('0xd'),auth[_0xf153('0xa')](),controller[_0xf153('0x1b')]);module[_0xf153('0x1c')]=router; \ No newline at end of file +var _0x9aea=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','index','/describe','describe','/:id','isAuthenticated','show','/:id/download','download','fax','faxmessage:create','create','put','update','accept','/:id/reject','reject','delete','destroy','exports','multer','path','express'];(function(_0x58ba98,_0x154c5f){var _0x40bf57=function(_0x39c622){while(--_0x39c622){_0x58ba98['push'](_0x58ba98['shift']());}};_0x40bf57(++_0x154c5f);}(_0x9aea,0xdd));var _0xa9ae=function(_0x1c4fc8,_0x227048){_0x1c4fc8=_0x1c4fc8-0x0;var _0x2b2583=_0x9aea[_0x1c4fc8];return _0x2b2583;};'use strict';var multer=require(_0xa9ae('0x0'));var util=require('util');var path=require(_0xa9ae('0x1'));var timeout=require('connect-timeout');var express=require(_0xa9ae('0x2'));var router=express[_0xa9ae('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xa9ae('0x4'));var interaction=require(_0xa9ae('0x5'));var config=require(_0xa9ae('0x6'));var controller=require(_0xa9ae('0x7'));router[_0xa9ae('0x8')]('/',auth['isAuthenticated'](),controller[_0xa9ae('0x9')]);router[_0xa9ae('0x8')](_0xa9ae('0xa'),auth['isAuthenticated'](),controller[_0xa9ae('0xb')]);router[_0xa9ae('0x8')](_0xa9ae('0xc'),auth[_0xa9ae('0xd')](),controller[_0xa9ae('0xe')]);router[_0xa9ae('0x8')](_0xa9ae('0xf'),auth[_0xa9ae('0xd')](),controller[_0xa9ae('0x10')]);router['post']('/',auth[_0xa9ae('0xd')](),interaction['tracked'](_0xa9ae('0x11'),_0xa9ae('0x12')),controller[_0xa9ae('0x13')]);router[_0xa9ae('0x14')](_0xa9ae('0xc'),auth[_0xa9ae('0xd')](),controller[_0xa9ae('0x15')]);router[_0xa9ae('0x14')]('/:id/accept',auth[_0xa9ae('0xd')](),controller[_0xa9ae('0x16')]);router[_0xa9ae('0x14')](_0xa9ae('0x17'),auth['isAuthenticated'](),controller[_0xa9ae('0x18')]);router[_0xa9ae('0x19')](_0xa9ae('0xc'),auth[_0xa9ae('0xd')](),controller[_0xa9ae('0x1a')]);module[_0xa9ae('0x1b')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 0fcddb8..1ad212b 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 _0xcdef=['exports','name','STRING','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize'];(function(_0x212f08,_0x13a857){var _0xd3a395=function(_0x5d925f){while(--_0x5d925f){_0x212f08['push'](_0x212f08['shift']());}};_0xd3a395(++_0x13a857);}(_0xcdef,0xb3));var _0xfcde=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xcdef[_0x4e676e];return _0x336a3c;};'use strict';var Sequelize=require(_0xfcde('0x0'));module[_0xfcde('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xfcde('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xfcde('0x3')]},'timeout':{'type':Sequelize[_0xfcde('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xfcde('0x5')](_0xfcde('0x6'),_0xfcde('0x7'),_0xfcde('0x8')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xfcde('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xf643=['beepall','roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM'];(function(_0x513683,_0x56bd88){var _0x6028e=function(_0x595044){while(--_0x595044){_0x513683['push'](_0x513683['shift']());}};_0x6028e(++_0x56bd88);}(_0xf643,0x122));var _0x3f64=function(_0x5dbba9,_0xba1f8e){_0x5dbba9=_0x5dbba9-0x0;var _0x4dcd1d=_0xf643[_0x5dbba9];return _0x4dcd1d;};'use strict';var Sequelize=require(_0x3f64('0x0'));module[_0x3f64('0x1')]={'name':{'type':Sequelize[_0x3f64('0x2')],'unique':_0x3f64('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x3f64('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x3f64('0x5')]('rrmemory',_0x3f64('0x6'),_0x3f64('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x3f64('0x4')],'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 726e600..28eb3b3 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 _0x9efb=['redis','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','FaxQueues','UserProfileResource','stack','name','send','index','map','FaxQueue','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','includeAll','findAll','catch','params','include','merge','options','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserFaxQueue','FaxQueueId','User','UserId','agent','faxPause','createdAt','rows','format','%s/%s','SIP','updatedAt','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','each','findOrCreate','forEach','userFaxQueue:save','removeTeams','select','field','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','SELECT','every','TeamId','includes','all','compact','value','transaction','isEmpty','removeAgents','emit','addAgents','spread','isArray','userFaxQueue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x2235f7,_0x34057a){var _0x476bb4=function(_0x1462a5){while(--_0x1462a5){_0x2235f7['push'](_0x2235f7['shift']());}};_0x476bb4(++_0x34057a);}(_0x9efb,0x7c));var _0xb9ef=function(_0x26cd74,_0x5a2fea){_0x26cd74=_0x26cd74-0x0;var _0x843f55=_0x9efb[_0x26cd74];return _0x843f55;};'use strict';var emlformat=require(_0xb9ef('0x0'));var rimraf=require(_0xb9ef('0x1'));var zipdir=require(_0xb9ef('0x2'));var jsonpatch=require(_0xb9ef('0x3'));var rp=require(_0xb9ef('0x4'));var moment=require(_0xb9ef('0x5'));var BPromise=require(_0xb9ef('0x6'));var Mustache=require(_0xb9ef('0x7'));var util=require('util');var path=require(_0xb9ef('0x8'));var sox=require(_0xb9ef('0x9'));var csv=require(_0xb9ef('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb9ef('0xb'));var _=require(_0xb9ef('0xc'));var squel=require(_0xb9ef('0xd'));var crypto=require(_0xb9ef('0xe'));var jsforce=require(_0xb9ef('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xb9ef('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb9ef('0x10'));var authService=require(_0xb9ef('0x11'));var qs=require(_0xb9ef('0x12'));var as=require(_0xb9ef('0x13'));var hardwareService=require(_0xb9ef('0x14'));var logger=require(_0xb9ef('0x15'))(_0xb9ef('0x16'));var utils=require(_0xb9ef('0x17'));var config=require(_0xb9ef('0x18'));var licenseUtil=require(_0xb9ef('0x19'));var db=require('../../mysqldb')['db'];config[_0xb9ef('0x1a')]=_['defaults'](config[_0xb9ef('0x1a')],{'host':_0xb9ef('0x1b'),'port':0x18eb});var socket=require(_0xb9ef('0x1c'))(new Redis(config[_0xb9ef('0x1a')]));require(_0xb9ef('0x1d'))[_0xb9ef('0x1e')](socket);function respondWithStatusCode(_0x42fe58,_0x436ecb){_0x436ecb=_0x436ecb||0xcc;return function(_0x2f7199){if(_0x2f7199){return _0x42fe58[_0xb9ef('0x1f')](_0x436ecb);}return _0x42fe58[_0xb9ef('0x20')](_0x436ecb)[_0xb9ef('0x21')]();};}function respondWithResult(_0xc77f9b,_0x435b29){_0x435b29=_0x435b29||0xc8;return function(_0x249145){if(_0x249145){return _0xc77f9b[_0xb9ef('0x20')](_0x435b29)[_0xb9ef('0x22')](_0x249145);}};}function respondWithFilteredResult(_0x5af948,_0x5ecb09){return function(_0x39f6ec){if(_0x39f6ec){var _0x469a2b=typeof _0x5ecb09[_0xb9ef('0x23')]===_0xb9ef('0x24')&&typeof _0x5ecb09[_0xb9ef('0x25')]===_0xb9ef('0x24');var _0x28c9ef=_0x39f6ec[_0xb9ef('0x26')];var _0x4595f2=_0x469a2b?0x0:_0x5ecb09[_0xb9ef('0x23')];var _0x319ceb=_0x469a2b?_0x39f6ec[_0xb9ef('0x26')]:_0x5ecb09[_0xb9ef('0x23')]+_0x5ecb09[_0xb9ef('0x25')];var _0x57d499;if(_0x319ceb>=_0x28c9ef){_0x319ceb=_0x28c9ef;_0x57d499=0xc8;}else{_0x57d499=0xce;}_0x5af948[_0xb9ef('0x20')](_0x57d499);return _0x5af948[_0xb9ef('0x27')](_0xb9ef('0x28'),_0x4595f2+'-'+_0x319ceb+'/'+_0x28c9ef)[_0xb9ef('0x22')](_0x39f6ec);}return null;};}function patchUpdates(_0x4f96b8){return function(_0x14e6f0){try{jsonpatch[_0xb9ef('0x29')](_0x14e6f0,_0x4f96b8,!![]);}catch(_0x55aeb1){return BPromise[_0xb9ef('0x2a')](_0x55aeb1);}return _0x14e6f0[_0xb9ef('0x2b')]();};}function saveUpdates(_0x132b46,_0x364aef){return function(_0x459850){if(_0x459850){return _0x459850[_0xb9ef('0x2c')](_0x132b46)[_0xb9ef('0x2d')](function(_0x16cecf){return _0x16cecf;});}return null;};}function removeEntity(_0x1706c0,_0x3d8f4a){return function(_0x3f6d6c){if(_0x3f6d6c){return _0x3f6d6c[_0xb9ef('0x2e')]()[_0xb9ef('0x2d')](function(){var _0x5696b9=_0x3f6d6c[_0xb9ef('0x2f')]({'plain':!![]});var _0x3e11fb=_0xb9ef('0x30');return db[_0xb9ef('0x31')][_0xb9ef('0x2e')]({'where':{'type':_0x3e11fb,'resourceId':_0x5696b9['id']}})['then'](function(){return _0x3f6d6c;});})['then'](function(){_0x1706c0[_0xb9ef('0x20')](0xcc)[_0xb9ef('0x21')]();});}};}function handleEntityNotFound(_0x142808,_0x85c7e8){return function(_0x1b06da){if(!_0x1b06da){_0x142808[_0xb9ef('0x1f')](0x194);}return _0x1b06da;};}function handleError(_0x4f38b3,_0xee3ffd){_0xee3ffd=_0xee3ffd||0x1f4;return function(_0x25d3d6){logger['error'](_0x25d3d6[_0xb9ef('0x32')]);if(_0x25d3d6[_0xb9ef('0x33')]){delete _0x25d3d6[_0xb9ef('0x33')];}_0x4f38b3[_0xb9ef('0x20')](_0xee3ffd)[_0xb9ef('0x34')](_0x25d3d6);};}exports[_0xb9ef('0x35')]=function(_0x223e4c,_0x17a16e){var _0x2fe37a={},_0x303901={},_0x21dbc0={'count':0x0,'rows':[]};var _0x49cd63=_[_0xb9ef('0x36')](db[_0xb9ef('0x37')][_0xb9ef('0x38')],function(_0x5905cd){return{'name':_0x5905cd[_0xb9ef('0x39')],'type':_0x5905cd[_0xb9ef('0x3a')][_0xb9ef('0x3b')]};});_0x303901[_0xb9ef('0x3c')]=_['map'](_0x49cd63,_0xb9ef('0x33'));_0x303901[_0xb9ef('0x3d')]=_[_0xb9ef('0x3e')](_0x223e4c['query']);_0x303901['filters']=_[_0xb9ef('0x3f')](_0x303901[_0xb9ef('0x3c')],_0x303901['query']);_0x2fe37a[_0xb9ef('0x40')]=_['intersection'](_0x303901[_0xb9ef('0x3c')],qs[_0xb9ef('0x41')](_0x223e4c[_0xb9ef('0x3d')][_0xb9ef('0x41')]));_0x2fe37a['attributes']=_0x2fe37a[_0xb9ef('0x40')][_0xb9ef('0x42')]?_0x2fe37a['attributes']:_0x303901[_0xb9ef('0x3c')];if(!_0x223e4c[_0xb9ef('0x3d')][_0xb9ef('0x43')](_0xb9ef('0x44'))){_0x2fe37a[_0xb9ef('0x25')]=qs['limit'](_0x223e4c[_0xb9ef('0x3d')][_0xb9ef('0x25')]);_0x2fe37a[_0xb9ef('0x23')]=qs['offset'](_0x223e4c[_0xb9ef('0x3d')][_0xb9ef('0x23')]);}_0x2fe37a[_0xb9ef('0x45')]=qs[_0xb9ef('0x46')](_0x223e4c[_0xb9ef('0x3d')][_0xb9ef('0x46')]);_0x2fe37a['where']=qs[_0xb9ef('0x47')](_[_0xb9ef('0x48')](_0x223e4c[_0xb9ef('0x3d')],_0x303901[_0xb9ef('0x47')]),_0x49cd63);if(_0x223e4c['query'][_0xb9ef('0x49')]){_0x2fe37a[_0xb9ef('0x4a')]=_['merge'](_0x2fe37a[_0xb9ef('0x4a')],{'$or':_[_0xb9ef('0x36')](_0x49cd63,function(_0x2fbbbd){if(_0x2fbbbd['type']!==_0xb9ef('0x4b')){var _0x359c09={};_0x359c09[_0x2fbbbd[_0xb9ef('0x33')]]={'$like':'%'+_0x223e4c[_0xb9ef('0x3d')][_0xb9ef('0x49')]+'%'};return _0x359c09;}})});}_0x2fe37a=_['merge']({},_0x2fe37a,_0x223e4c['options']);var _0x1801d3={'where':_0x2fe37a['where']};return db[_0xb9ef('0x37')]['count'](_0x1801d3)[_0xb9ef('0x2d')](function(_0x53427e){_0x21dbc0[_0xb9ef('0x26')]=_0x53427e;if(_0x223e4c[_0xb9ef('0x3d')][_0xb9ef('0x4c')]){_0x2fe37a['include']=[{'all':!![]}];}return db['FaxQueue'][_0xb9ef('0x4d')](_0x2fe37a);})['then'](function(_0x203722){_0x21dbc0['rows']=_0x203722;return _0x21dbc0;})[_0xb9ef('0x2d')](respondWithFilteredResult(_0x17a16e,_0x2fe37a))[_0xb9ef('0x4e')](handleError(_0x17a16e,null));};exports['show']=function(_0x4943f1,_0x411bb5){var _0x3baaaa={'raw':!![],'where':{'id':_0x4943f1[_0xb9ef('0x4f')]['id']}},_0x34019a={};_0x34019a[_0xb9ef('0x3c')]=_['keys'](db['FaxQueue']['rawAttributes']);_0x34019a[_0xb9ef('0x3d')]=_[_0xb9ef('0x3e')](_0x4943f1['query']);_0x34019a[_0xb9ef('0x47')]=_[_0xb9ef('0x3f')](_0x34019a[_0xb9ef('0x3c')],_0x34019a[_0xb9ef('0x3d')]);_0x3baaaa[_0xb9ef('0x40')]=_[_0xb9ef('0x3f')](_0x34019a[_0xb9ef('0x3c')],qs[_0xb9ef('0x41')](_0x4943f1['query']['fields']));_0x3baaaa[_0xb9ef('0x40')]=_0x3baaaa['attributes'][_0xb9ef('0x42')]?_0x3baaaa[_0xb9ef('0x40')]:_0x34019a[_0xb9ef('0x3c')];if(_0x4943f1[_0xb9ef('0x3d')][_0xb9ef('0x4c')]){_0x3baaaa[_0xb9ef('0x50')]=[{'all':!![]}];}_0x3baaaa=_[_0xb9ef('0x51')]({},_0x3baaaa,_0x4943f1[_0xb9ef('0x52')]);return db[_0xb9ef('0x37')][_0xb9ef('0x53')](_0x3baaaa)['then'](handleEntityNotFound(_0x411bb5,null))[_0xb9ef('0x2d')](respondWithResult(_0x411bb5,null))[_0xb9ef('0x4e')](handleError(_0x411bb5,null));};exports[_0xb9ef('0x54')]=function(_0x2908e2,_0x3fb3a1){return db[_0xb9ef('0x37')][_0xb9ef('0x54')](_0x2908e2['body'],{})[_0xb9ef('0x2d')](function(_0x3907c8){var _0x2da795=_0x2908e2[_0xb9ef('0x55')][_0xb9ef('0x2f')]({'plain':!![]});if(!_0x2da795)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2da795[_0xb9ef('0x56')]===_0xb9ef('0x55')){var _0x137fb9=_0x3907c8[_0xb9ef('0x2f')]({'plain':!![]});var _0x42381f=_0xb9ef('0x30');return db[_0xb9ef('0x57')][_0xb9ef('0x53')]({'where':{'name':_0x42381f,'userProfileId':_0x2da795[_0xb9ef('0x58')]},'raw':!![]})[_0xb9ef('0x2d')](function(_0x4c3afc){if(_0x4c3afc&&_0x4c3afc[_0xb9ef('0x59')]===0x0){return db[_0xb9ef('0x31')]['create']({'name':_0x137fb9['name'],'resourceId':_0x137fb9['id'],'type':_0x4c3afc[_0xb9ef('0x33')],'sectionId':_0x4c3afc['id']},{})['then'](function(){return _0x3907c8;});}else{return _0x3907c8;}})[_0xb9ef('0x4e')](function(_0x5e9132){logger['error'](_0xb9ef('0x5a'),_0x5e9132);throw _0x5e9132;});}return _0x3907c8;})['then'](respondWithResult(_0x3fb3a1,0xc9))[_0xb9ef('0x4e')](handleError(_0x3fb3a1,null));};exports[_0xb9ef('0x2c')]=function(_0xadd6e5,_0x1fb23e){if(_0xadd6e5['body']['id']){delete _0xadd6e5[_0xb9ef('0x5b')]['id'];}return db[_0xb9ef('0x37')][_0xb9ef('0x53')]({'where':{'id':_0xadd6e5['params']['id']}})['then'](handleEntityNotFound(_0x1fb23e,null))['then'](saveUpdates(_0xadd6e5[_0xb9ef('0x5b')],null))['then'](respondWithResult(_0x1fb23e,null))[_0xb9ef('0x4e')](handleError(_0x1fb23e,null));};exports[_0xb9ef('0x2e')]=function(_0x1706f9,_0x3b0273){return db[_0xb9ef('0x37')][_0xb9ef('0x53')]({'where':{'id':_0x1706f9[_0xb9ef('0x4f')]['id']}})['then'](handleEntityNotFound(_0x3b0273,null))['then'](removeEntity(_0x3b0273,null))[_0xb9ef('0x4e')](handleError(_0x3b0273,null));};exports[_0xb9ef('0x5c')]=function(_0x279971,_0x1b0ce3){return db[_0xb9ef('0x37')]['describe']()[_0xb9ef('0x2d')](respondWithResult(_0x1b0ce3,null))[_0xb9ef('0x4e')](handleError(_0x1b0ce3,null));};exports[_0xb9ef('0x5d')]=function(_0x132cbf,_0x4563ee,_0x5f0fde){var _0x5bfc98={'raw':!![],'where':{}},_0x4deefd={},_0x457b24;return db['FaxQueue'][_0xb9ef('0x5e')]({'where':{'id':_0x132cbf['params']['id']}})[_0xb9ef('0x2d')](handleEntityNotFound(_0x4563ee,null))[_0xb9ef('0x2d')](function(_0x23f157){if(_0x23f157){_0x457b24=_0x23f157[_0xb9ef('0x2f')]({'plain':!![]});_0x4deefd['model']=_[_0xb9ef('0x3e')](db[_0xb9ef('0x5f')][_0xb9ef('0x38')]);_0x4deefd[_0xb9ef('0x3d')]=_[_0xb9ef('0x3e')](_0x132cbf[_0xb9ef('0x3d')]);_0x4deefd['filters']=_[_0xb9ef('0x3f')](_0x4deefd[_0xb9ef('0x3c')],_0x4deefd[_0xb9ef('0x3d')]);_0x5bfc98[_0xb9ef('0x40')]=_[_0xb9ef('0x3f')](_0x4deefd['model'],qs[_0xb9ef('0x41')](_0x132cbf['query'][_0xb9ef('0x41')]));_0x5bfc98[_0xb9ef('0x40')]=_0x5bfc98[_0xb9ef('0x40')][_0xb9ef('0x42')]?_0x5bfc98[_0xb9ef('0x40')]:_0x4deefd[_0xb9ef('0x3c')];if(!_0x132cbf[_0xb9ef('0x3d')][_0xb9ef('0x43')](_0xb9ef('0x44'))){_0x5bfc98[_0xb9ef('0x25')]=qs[_0xb9ef('0x25')](_0x132cbf['query']['limit']);_0x5bfc98['offset']=qs[_0xb9ef('0x23')](_0x132cbf[_0xb9ef('0x3d')]['offset']);}_0x5bfc98[_0xb9ef('0x45')]=qs['sort'](_0x132cbf['query'][_0xb9ef('0x46')]);_0x5bfc98[_0xb9ef('0x4a')]=qs[_0xb9ef('0x47')](_[_0xb9ef('0x48')](_0x132cbf[_0xb9ef('0x3d')],_0x4deefd[_0xb9ef('0x47')]));_0x5bfc98['where'][_0xb9ef('0x60')]=_0x23f157['id'];if(_0x132cbf[_0xb9ef('0x3d')][_0xb9ef('0x49')]){_0x5bfc98[_0xb9ef('0x4a')]=_[_0xb9ef('0x51')](_0x5bfc98[_0xb9ef('0x4a')],{'$or':_[_0xb9ef('0x36')](_0x5bfc98[_0xb9ef('0x40')],function(_0x1c894b){var _0xee2896={};_0xee2896[_0x1c894b]={'$like':'%'+_0x132cbf[_0xb9ef('0x3d')][_0xb9ef('0x49')]+'%'};return _0xee2896;})});}_0x5bfc98=_[_0xb9ef('0x51')]({},_0x5bfc98,_0x132cbf[_0xb9ef('0x52')]);return db['UserFaxQueue'][_0xb9ef('0x4d')](_0x5bfc98);}})['then'](function(_0x417a56){if(_0x417a56){return db[_0xb9ef('0x61')]['findAndCountAll']({'where':{'id':_[_0xb9ef('0x36')](_0x417a56,_0xb9ef('0x62')),'role':_0xb9ef('0x63')},'attributes':['id',_0xb9ef('0x33'),_0xb9ef('0x64'),'updatedAt',_0xb9ef('0x65')]});}})[_0xb9ef('0x2d')](function(_0x3a7032){if(_0x3a7032){return{'count':_0x3a7032['count'],'rows':_['map'](_0x3a7032[_0xb9ef('0x66')],function(_0x420105){return{'membername':_0x420105[_0xb9ef('0x33')],'UserId':_0x420105['id'],'queue_name':_0x457b24[_0xb9ef('0x33')],'FaxQueueId':_0x457b24['id'],'interface':util[_0xb9ef('0x67')](_0xb9ef('0x68'),_0xb9ef('0x69'),_0x420105[_0xb9ef('0x33')]),'penalty':0x0,'paused':_0x420105['faxPause'],'createdAt':_0x420105[_0xb9ef('0x65')],'updatedAt':_0x420105[_0xb9ef('0x6a')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x4563ee,_0x5bfc98))['catch'](handleError(_0x4563ee,null));};exports[_0xb9ef('0x6b')]=function(_0x11d5ae,_0x2cbb57,_0x9cd1a6){var _0x42863c={};var _0xa7c4f6={};var _0x552fd3;var _0x2f00b2;return db[_0xb9ef('0x37')][_0xb9ef('0x5e')]({'where':{'id':_0x11d5ae[_0xb9ef('0x4f')]['id']}})[_0xb9ef('0x2d')](handleEntityNotFound(_0x2cbb57,null))[_0xb9ef('0x2d')](function(_0x27ca01){if(_0x27ca01){_0x552fd3=_0x27ca01;_0xa7c4f6[_0xb9ef('0x3c')]=_[_0xb9ef('0x3e')](db[_0xb9ef('0x6c')]['rawAttributes']);_0xa7c4f6['query']=_[_0xb9ef('0x3e')](_0x11d5ae[_0xb9ef('0x3d')]);_0xa7c4f6[_0xb9ef('0x47')]=_['intersection'](_0xa7c4f6[_0xb9ef('0x3c')],_0xa7c4f6[_0xb9ef('0x3d')]);_0x42863c[_0xb9ef('0x40')]=_[_0xb9ef('0x3f')](_0xa7c4f6[_0xb9ef('0x3c')],qs[_0xb9ef('0x41')](_0x11d5ae[_0xb9ef('0x3d')]['fields']));_0x42863c[_0xb9ef('0x40')]=_0x42863c[_0xb9ef('0x40')][_0xb9ef('0x42')]?_0x42863c[_0xb9ef('0x40')]:_0xa7c4f6['model'];_0x42863c['order']=qs[_0xb9ef('0x46')](_0x11d5ae[_0xb9ef('0x3d')][_0xb9ef('0x46')]);_0x42863c['where']=qs[_0xb9ef('0x47')](_[_0xb9ef('0x48')](_0x11d5ae[_0xb9ef('0x3d')],_0xa7c4f6[_0xb9ef('0x47')]));if(_0x11d5ae[_0xb9ef('0x3d')][_0xb9ef('0x49')]){_0x42863c['where']=_['merge'](_0x42863c[_0xb9ef('0x4a')],{'$or':_[_0xb9ef('0x36')](_0x42863c[_0xb9ef('0x40')],function(_0x275760){var _0x417be8={};_0x417be8[_0x275760]={'$like':'%'+_0x11d5ae[_0xb9ef('0x3d')][_0xb9ef('0x49')]+'%'};return _0x417be8;})});}_0x42863c=_[_0xb9ef('0x51')]({},_0x42863c,_0x11d5ae['options']);return _0x552fd3[_0xb9ef('0x6b')](_0x42863c);}})[_0xb9ef('0x2d')](function(_0x5d6c9d){if(_0x5d6c9d){_0x2f00b2=_0x5d6c9d['length'];if(!_0x11d5ae['query']['hasOwnProperty'](_0xb9ef('0x44'))){_0x42863c[_0xb9ef('0x25')]=qs['limit'](_0x11d5ae[_0xb9ef('0x3d')][_0xb9ef('0x25')]);_0x42863c[_0xb9ef('0x23')]=qs[_0xb9ef('0x23')](_0x11d5ae['query'][_0xb9ef('0x23')]);}return _0x552fd3[_0xb9ef('0x6b')](_0x42863c);}})['then'](function(_0x1ba905){if(_0x1ba905){return _0x1ba905?{'count':_0x2f00b2,'rows':_0x1ba905}:null;}})[_0xb9ef('0x2d')](respondWithResult(_0x2cbb57,null))[_0xb9ef('0x4e')](handleError(_0x2cbb57,null));};exports[_0xb9ef('0x6d')]=function(_0x220704,_0x22b483,_0x335e0a){var _0x359baa=_0x220704[_0xb9ef('0x5b')][_0xb9ef('0x6e')];return db['Team'][_0xb9ef('0x4d')]({'where':{'id':_0x359baa},'attributes':['id'],'include':[{'model':db[_0xb9ef('0x61')],'as':_0xb9ef('0x6f'),'attributes':['id','name',_0xb9ef('0x70'),_0xb9ef('0x71'),_0xb9ef('0x72')],'raw':!![]}]})[_0xb9ef('0x2d')](function(_0x1fdafe){if(_0x1fdafe){var _0x5bb45e=_[_0xb9ef('0x73')](_0x1fdafe,function(_0x417ed6){var _0x4c6976=_0x417ed6['get']({'plain':!![]});return _0x4c6976[_0xb9ef('0x6f')];});return db[_0xb9ef('0x37')]['find']({'where':{'id':_0x220704[_0xb9ef('0x4f')]['id']}})[_0xb9ef('0x2d')](function(_0x29d685){return db['sequelize']['transaction'](function(_0x437e27){return _0x29d685[_0xb9ef('0x6d')](_0x359baa,{'transaction':_0x437e27})[_0xb9ef('0x2d')](function(){return BPromise[_0xb9ef('0x74')](_0x5bb45e,function(_0x198bf9){return db[_0xb9ef('0x5f')][_0xb9ef('0x75')]({'where':{'UserId':_0x198bf9['id'],'FaxQueueId':_0x220704['params']['id']},'transaction':_0x437e27});});})[_0xb9ef('0x2d')](function(){_0x5bb45e[_0xb9ef('0x76')](function(_0x42b7cf){socket['emit'](_0xb9ef('0x77'),{'UserId':_0x42b7cf['id'],'FaxQueueId':_0x29d685['id']});});});});});}})['then'](respondWithStatusCode(_0x22b483,null))['catch'](handleError(_0x22b483,null));};exports[_0xb9ef('0x78')]=function(_0x4556e8,_0x5bf298,_0x9ce5c1){return db[_0xb9ef('0x6c')]['findAll']({'where':{'id':_0x4556e8[_0xb9ef('0x3d')]['ids']},'attributes':['id'],'include':[{'model':db[_0xb9ef('0x61')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xb9ef('0x2d')](handleEntityNotFound(_0x5bf298,null))[_0xb9ef('0x2d')](function(_0x5761f4){var _0x52594e=_[_0xb9ef('0x36')](_0x5761f4,'id');var _0x1e8b8e=[];var _0x15a12d=[];var _0x2bc5a2=squel[_0xb9ef('0x79')]();_0x2bc5a2[_0xb9ef('0x7a')]('tq.TeamId')[_0xb9ef('0x7b')](_0xb9ef('0x7c'),'tq')[_0xb9ef('0x7d')](_0xb9ef('0x7e'),'ut',_0xb9ef('0x7f'))['where'](_0xb9ef('0x80'),_0x4556e8[_0xb9ef('0x4f')]['id']);for(var _0x581f9e=0x0;_0x581f9e<_0x5761f4[_0xb9ef('0x42')];_0x581f9e+=0x1){let _0x5be56c=_0x5761f4[_0x581f9e];for(var _0x453a43=0x0;_0x453a43<_0x5be56c[_0xb9ef('0x6f')][_0xb9ef('0x42')];_0x453a43+=0x1){let _0x1fec9d=_0x5be56c[_0xb9ef('0x6f')][_0x453a43];var _0x133aaa=_0x2bc5a2[_0xb9ef('0x81')]();_0x133aaa[_0xb9ef('0x4a')](_0xb9ef('0x82'),_0x1fec9d['id']);_0x15a12d[_0xb9ef('0x83')](db[_0xb9ef('0x84')][_0xb9ef('0x3d')](_0x133aaa[_0xb9ef('0x85')](),{'type':db[_0xb9ef('0x84')]['QueryTypes'][_0xb9ef('0x86')]})[_0xb9ef('0x2d')](function(_0x5aae0f){if(_0x5aae0f['length']===0x1){return _0x1fec9d['id'];}else{var _0x4b9826=_[_0xb9ef('0x87')](_['map'](_0x5aae0f,_0xb9ef('0x88')),function(_0x36d9a7){return _[_0xb9ef('0x89')](_0x52594e,_0x36d9a7);});if(_0x4b9826){return _0x1fec9d['id'];}}}));}}return BPromise[_0xb9ef('0x8a')](_0x15a12d)[_0xb9ef('0x2d')](function(_0x4f925f){_0x1e8b8e=_(_0x1e8b8e)['union'](_0x4f925f)[_0xb9ef('0x8b')]()[_0xb9ef('0x8c')]();return db[_0xb9ef('0x37')][_0xb9ef('0x53')]({'where':{'id':_0x4556e8['params']['id']}})[_0xb9ef('0x2d')](function(_0x98a91){return db[_0xb9ef('0x84')][_0xb9ef('0x8d')](function(_0x487ef9){return _0x98a91[_0xb9ef('0x78')](_0x4556e8[_0xb9ef('0x3d')][_0xb9ef('0x6e')],{'transaction':_0x487ef9})['then'](function(){if(!_[_0xb9ef('0x8e')](_0x1e8b8e)){return _0x98a91[_0xb9ef('0x8f')](_0x1e8b8e,{'transaction':_0x487ef9});}})[_0xb9ef('0x2d')](function(){_0x1e8b8e[_0xb9ef('0x76')](function(_0xc7daa6){socket[_0xb9ef('0x90')]('userFaxQueue:remove',{'UserId':_0xc7daa6,'FaxQueueId':_0x98a91['id']});});});});});});})[_0xb9ef('0x2d')](respondWithStatusCode(_0x5bf298,null))['catch'](handleError(_0x5bf298,null));};exports[_0xb9ef('0x91')]=function(_0x4dfd21,_0x92da7a,_0x502837){return db['FaxQueue']['find']({'where':{'id':_0x4dfd21[_0xb9ef('0x4f')]['id']}})[_0xb9ef('0x2d')](handleEntityNotFound(_0x92da7a,null))['then'](function(_0x3e4a45){if(_0x3e4a45){return _0x3e4a45[_0xb9ef('0x91')](_0x4dfd21[_0xb9ef('0x5b')][_0xb9ef('0x6e')],_['omit'](_0x4dfd21[_0xb9ef('0x5b')],[_0xb9ef('0x6e'),'id'])||{})[_0xb9ef('0x92')](function(_0xf3bbab){for(var _0x913db9=0x0;_0x913db9<_0x4dfd21[_0xb9ef('0x5b')][_0xb9ef('0x6e')][_0xb9ef('0x42')];_0x913db9+=0x1){socket[_0xb9ef('0x90')](_0xb9ef('0x77'),{'UserId':Number(_0x4dfd21['body'][_0xb9ef('0x6e')][_0x913db9]),'FaxQueueId':Number(_0x4dfd21[_0xb9ef('0x4f')]['id'])});}return _0xf3bbab;});}})[_0xb9ef('0x2d')](respondWithResult(_0x92da7a,null))[_0xb9ef('0x4e')](handleError(_0x92da7a,null));};exports[_0xb9ef('0x8f')]=function(_0x4be46b,_0x2a6d99,_0x28db68){return db[_0xb9ef('0x37')][_0xb9ef('0x53')]({'where':{'id':_0x4be46b['params']['id']}})[_0xb9ef('0x2d')](handleEntityNotFound(_0x2a6d99,null))[_0xb9ef('0x2d')](function(_0x1a3646){if(_0x1a3646){return _0x1a3646[_0xb9ef('0x8f')](_0x4be46b[_0xb9ef('0x3d')][_0xb9ef('0x6e')])['then'](function(){if(_[_0xb9ef('0x93')](_0x4be46b[_0xb9ef('0x3d')]['ids'])){for(var _0x4e62b8=0x0;_0x4e62b8<_0x4be46b[_0xb9ef('0x3d')]['ids'][_0xb9ef('0x42')];_0x4e62b8+=0x1){socket[_0xb9ef('0x90')](_0xb9ef('0x94'),{'UserId':Number(_0x4be46b['query'][_0xb9ef('0x6e')][_0x4e62b8]),'FaxQueueId':Number(_0x4be46b[_0xb9ef('0x4f')]['id'])});}}else{socket['emit'](_0xb9ef('0x94'),{'UserId':Number(_0x4be46b[_0xb9ef('0x3d')][_0xb9ef('0x6e')]),'FaxQueueId':Number(_0x4be46b[_0xb9ef('0x4f')]['id'])});}});}})[_0xb9ef('0x2d')](respondWithStatusCode(_0x2a6d99,null))[_0xb9ef('0x4e')](handleError(_0x2a6d99,null));};exports['getAgents']=function(_0x450e8e,_0x3d791f,_0x42127c){var _0x5e54e2={};var _0x34f8c2={};var _0x5eff59;var _0x488a0e;return db['FaxQueue'][_0xb9ef('0x5e')]({'where':{'id':_0x450e8e[_0xb9ef('0x4f')]['id']}})[_0xb9ef('0x2d')](handleEntityNotFound(_0x3d791f,null))['then'](function(_0x519fa8){if(_0x519fa8){_0x5eff59=_0x519fa8;_0x34f8c2[_0xb9ef('0x3c')]=_[_0xb9ef('0x3e')](db[_0xb9ef('0x61')][_0xb9ef('0x38')]);_0x34f8c2[_0xb9ef('0x3d')]=_[_0xb9ef('0x3e')](_0x450e8e[_0xb9ef('0x3d')]);_0x34f8c2[_0xb9ef('0x47')]=_[_0xb9ef('0x3f')](_0x34f8c2[_0xb9ef('0x3c')],_0x34f8c2[_0xb9ef('0x3d')]);_0x5e54e2[_0xb9ef('0x40')]=_[_0xb9ef('0x3f')](_0x34f8c2[_0xb9ef('0x3c')],qs['fields'](_0x450e8e[_0xb9ef('0x3d')][_0xb9ef('0x41')]));_0x5e54e2[_0xb9ef('0x40')]=_0x5e54e2[_0xb9ef('0x40')][_0xb9ef('0x42')]?_0x5e54e2['attributes']:_0x34f8c2[_0xb9ef('0x3c')];_0x5e54e2['order']=qs[_0xb9ef('0x46')](_0x450e8e[_0xb9ef('0x3d')][_0xb9ef('0x46')]);_0x5e54e2[_0xb9ef('0x4a')]=qs[_0xb9ef('0x47')](_[_0xb9ef('0x48')](_0x450e8e[_0xb9ef('0x3d')],_0x34f8c2[_0xb9ef('0x47')]));if(_0x450e8e[_0xb9ef('0x3d')][_0xb9ef('0x49')]){_0x5e54e2['where']=_['merge'](_0x5e54e2[_0xb9ef('0x4a')],{'$or':_[_0xb9ef('0x36')](_0x5e54e2[_0xb9ef('0x40')],function(_0x25ce24){var _0x5d1dd7={};_0x5d1dd7[_0x25ce24]={'$like':'%'+_0x450e8e[_0xb9ef('0x3d')][_0xb9ef('0x49')]+'%'};return _0x5d1dd7;})});}_0x5e54e2=_[_0xb9ef('0x51')]({},_0x5e54e2,_0x450e8e[_0xb9ef('0x52')]);return _0x5eff59[_0xb9ef('0x95')](_0x5e54e2);}})['then'](function(_0x2aa161){if(_0x2aa161){_0x488a0e=_0x2aa161[_0xb9ef('0x42')];if(!_0x450e8e['query']['hasOwnProperty'](_0xb9ef('0x44'))){_0x5e54e2[_0xb9ef('0x25')]=qs[_0xb9ef('0x25')](_0x450e8e[_0xb9ef('0x3d')][_0xb9ef('0x25')]);_0x5e54e2['offset']=qs[_0xb9ef('0x23')](_0x450e8e['query'][_0xb9ef('0x23')]);}return _0x5eff59['getAgents'](_0x5e54e2);}})[_0xb9ef('0x2d')](function(_0x5546db){if(_0x5546db){return _0x5546db?{'count':_0x488a0e,'rows':_0x5546db}:null;}})[_0xb9ef('0x2d')](respondWithResult(_0x3d791f,null))[_0xb9ef('0x4e')](handleError(_0x3d791f,null));}; \ No newline at end of file +var _0xaf71=['emit','removeTeams','select','field','from','team_has_fax_queues','join','user_has_teams','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','every','TeamId','includes','all','value','transaction','isEmpty','removeAgents','addAgents','omit','spread','userFaxQueue:save','isArray','userFaxQueue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','redis','localhost','./faxQueue.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','UserProfileResource','error','stack','name','send','index','map','key','keys','query','filters','intersection','attributes','fields','length','model','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','FaxQueue','includeAll','include','findAll','rows','show','params','rawAttributes','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserFaxQueue','hasOwnProperty','order','FaxQueueId','User','UserId','faxPause','createdAt','%s/%s','SIP','updatedAt','getTeams','Team','addTeams','ids','Agents','voicePause','interface','flatMap','each','findOrCreate','forEach'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0xaf71,0x1c2));var _0x1af7=function(_0x461752,_0x444b01){_0x461752=_0x461752-0x0;var _0x362c31=_0xaf71[_0x461752];return _0x362c31;};'use strict';var emlformat=require(_0x1af7('0x0'));var rimraf=require(_0x1af7('0x1'));var zipdir=require(_0x1af7('0x2'));var jsonpatch=require(_0x1af7('0x3'));var rp=require(_0x1af7('0x4'));var moment=require(_0x1af7('0x5'));var BPromise=require(_0x1af7('0x6'));var Mustache=require(_0x1af7('0x7'));var util=require('util');var path=require(_0x1af7('0x8'));var sox=require(_0x1af7('0x9'));var csv=require(_0x1af7('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1af7('0xb'));var _=require(_0x1af7('0xc'));var squel=require(_0x1af7('0xd'));var crypto=require('crypto');var jsforce=require(_0x1af7('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x1af7('0xa'));var querystring=require('querystring');var Papa=require(_0x1af7('0xf'));var Redis=require(_0x1af7('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x1af7('0x11'));var as=require(_0x1af7('0x12'));var hardwareService=require(_0x1af7('0x13'));var logger=require(_0x1af7('0x14'))('api');var utils=require(_0x1af7('0x15'));var config=require(_0x1af7('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x1af7('0x17')],{'host':_0x1af7('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1af7('0x17')]));require(_0x1af7('0x19'))[_0x1af7('0x1a')](socket);function respondWithStatusCode(_0x38ec50,_0x425c90){_0x425c90=_0x425c90||0xcc;return function(_0x1769d3){if(_0x1769d3){return _0x38ec50[_0x1af7('0x1b')](_0x425c90);}return _0x38ec50[_0x1af7('0x1c')](_0x425c90)[_0x1af7('0x1d')]();};}function respondWithResult(_0x3e6604,_0x514e49){_0x514e49=_0x514e49||0xc8;return function(_0x4bbc8a){if(_0x4bbc8a){return _0x3e6604[_0x1af7('0x1c')](_0x514e49)['json'](_0x4bbc8a);}};}function respondWithFilteredResult(_0x2c704c,_0x3ee82c){return function(_0x2e73fc){if(_0x2e73fc){var _0x417810=typeof _0x3ee82c[_0x1af7('0x1e')]===_0x1af7('0x1f')&&typeof _0x3ee82c[_0x1af7('0x20')]===_0x1af7('0x1f');var _0x5a55e5=_0x2e73fc[_0x1af7('0x21')];var _0x3cfc29=_0x417810?0x0:_0x3ee82c['offset'];var _0x2c1c74=_0x417810?_0x2e73fc[_0x1af7('0x21')]:_0x3ee82c[_0x1af7('0x1e')]+_0x3ee82c[_0x1af7('0x20')];var _0x4cd006;if(_0x2c1c74>=_0x5a55e5){_0x2c1c74=_0x5a55e5;_0x4cd006=0xc8;}else{_0x4cd006=0xce;}_0x2c704c[_0x1af7('0x1c')](_0x4cd006);return _0x2c704c[_0x1af7('0x22')](_0x1af7('0x23'),_0x3cfc29+'-'+_0x2c1c74+'/'+_0x5a55e5)['json'](_0x2e73fc);}return null;};}function patchUpdates(_0x4cf51a){return function(_0x465f88){try{jsonpatch['apply'](_0x465f88,_0x4cf51a,!![]);}catch(_0x57a10a){return BPromise['reject'](_0x57a10a);}return _0x465f88[_0x1af7('0x24')]();};}function saveUpdates(_0x4f9707,_0x2b11a5){return function(_0x30ba5a){if(_0x30ba5a){return _0x30ba5a[_0x1af7('0x25')](_0x4f9707)[_0x1af7('0x26')](function(_0x2da32b){return _0x2da32b;});}return null;};}function removeEntity(_0x183e05,_0x43977d){return function(_0x1ad3aa){if(_0x1ad3aa){return _0x1ad3aa[_0x1af7('0x27')]()[_0x1af7('0x26')](function(){var _0x76f9c3=_0x1ad3aa['get']({'plain':!![]});var _0x145881='FaxQueues';return db[_0x1af7('0x28')]['destroy']({'where':{'type':_0x145881,'resourceId':_0x76f9c3['id']}})[_0x1af7('0x26')](function(){return _0x1ad3aa;});})[_0x1af7('0x26')](function(){_0x183e05[_0x1af7('0x1c')](0xcc)[_0x1af7('0x1d')]();});}};}function handleEntityNotFound(_0x47ad36,_0x2f0f4a){return function(_0x636466){if(!_0x636466){_0x47ad36[_0x1af7('0x1b')](0x194);}return _0x636466;};}function handleError(_0x29b31a,_0x491724){_0x491724=_0x491724||0x1f4;return function(_0x111c86){logger[_0x1af7('0x29')](_0x111c86[_0x1af7('0x2a')]);if(_0x111c86[_0x1af7('0x2b')]){delete _0x111c86[_0x1af7('0x2b')];}_0x29b31a['status'](_0x491724)[_0x1af7('0x2c')](_0x111c86);};}exports[_0x1af7('0x2d')]=function(_0x4a886d,_0x20518f){var _0xb79d72={},_0x2a7f97={},_0x184de7={'count':0x0,'rows':[]};var _0x2a7698=_[_0x1af7('0x2e')](db['FaxQueue']['rawAttributes'],function(_0x48e95a){return{'name':_0x48e95a['fieldName'],'type':_0x48e95a['type'][_0x1af7('0x2f')]};});_0x2a7f97['model']=_[_0x1af7('0x2e')](_0x2a7698,_0x1af7('0x2b'));_0x2a7f97['query']=_[_0x1af7('0x30')](_0x4a886d[_0x1af7('0x31')]);_0x2a7f97[_0x1af7('0x32')]=_[_0x1af7('0x33')](_0x2a7f97['model'],_0x2a7f97[_0x1af7('0x31')]);_0xb79d72[_0x1af7('0x34')]=_[_0x1af7('0x33')](_0x2a7f97['model'],qs['fields'](_0x4a886d[_0x1af7('0x31')][_0x1af7('0x35')]));_0xb79d72['attributes']=_0xb79d72['attributes'][_0x1af7('0x36')]?_0xb79d72[_0x1af7('0x34')]:_0x2a7f97[_0x1af7('0x37')];if(!_0x4a886d['query']['hasOwnProperty'](_0x1af7('0x38'))){_0xb79d72['limit']=qs['limit'](_0x4a886d[_0x1af7('0x31')]['limit']);_0xb79d72[_0x1af7('0x1e')]=qs['offset'](_0x4a886d['query'][_0x1af7('0x1e')]);}_0xb79d72['order']=qs['sort'](_0x4a886d['query'][_0x1af7('0x39')]);_0xb79d72[_0x1af7('0x3a')]=qs['filters'](_[_0x1af7('0x3b')](_0x4a886d[_0x1af7('0x31')],_0x2a7f97['filters']),_0x2a7698);if(_0x4a886d[_0x1af7('0x31')][_0x1af7('0x3c')]){_0xb79d72['where']=_[_0x1af7('0x3d')](_0xb79d72[_0x1af7('0x3a')],{'$or':_['map'](_0x2a7698,function(_0x4ec780){if(_0x4ec780[_0x1af7('0x3e')]!==_0x1af7('0x3f')){var _0x52316b={};_0x52316b[_0x4ec780['name']]={'$like':'%'+_0x4a886d[_0x1af7('0x31')][_0x1af7('0x3c')]+'%'};return _0x52316b;}})});}_0xb79d72=_[_0x1af7('0x3d')]({},_0xb79d72,_0x4a886d[_0x1af7('0x40')]);var _0x180eee={'where':_0xb79d72[_0x1af7('0x3a')]};return db[_0x1af7('0x41')][_0x1af7('0x21')](_0x180eee)[_0x1af7('0x26')](function(_0xbfa204){_0x184de7[_0x1af7('0x21')]=_0xbfa204;if(_0x4a886d['query'][_0x1af7('0x42')]){_0xb79d72[_0x1af7('0x43')]=[{'all':!![]}];}return db[_0x1af7('0x41')][_0x1af7('0x44')](_0xb79d72);})['then'](function(_0xf48241){_0x184de7[_0x1af7('0x45')]=_0xf48241;return _0x184de7;})[_0x1af7('0x26')](respondWithFilteredResult(_0x20518f,_0xb79d72))['catch'](handleError(_0x20518f,null));};exports[_0x1af7('0x46')]=function(_0x4e2d19,_0xffefaf){var _0x528cf3={'raw':!![],'where':{'id':_0x4e2d19[_0x1af7('0x47')]['id']}},_0x189542={};_0x189542[_0x1af7('0x37')]=_[_0x1af7('0x30')](db[_0x1af7('0x41')][_0x1af7('0x48')]);_0x189542[_0x1af7('0x31')]=_['keys'](_0x4e2d19['query']);_0x189542['filters']=_[_0x1af7('0x33')](_0x189542[_0x1af7('0x37')],_0x189542[_0x1af7('0x31')]);_0x528cf3[_0x1af7('0x34')]=_[_0x1af7('0x33')](_0x189542['model'],qs['fields'](_0x4e2d19[_0x1af7('0x31')]['fields']));_0x528cf3[_0x1af7('0x34')]=_0x528cf3[_0x1af7('0x34')][_0x1af7('0x36')]?_0x528cf3[_0x1af7('0x34')]:_0x189542[_0x1af7('0x37')];if(_0x4e2d19[_0x1af7('0x31')][_0x1af7('0x42')]){_0x528cf3[_0x1af7('0x43')]=[{'all':!![]}];}_0x528cf3=_[_0x1af7('0x3d')]({},_0x528cf3,_0x4e2d19['options']);return db[_0x1af7('0x41')][_0x1af7('0x49')](_0x528cf3)['then'](handleEntityNotFound(_0xffefaf,null))[_0x1af7('0x26')](respondWithResult(_0xffefaf,null))[_0x1af7('0x4a')](handleError(_0xffefaf,null));};exports['create']=function(_0xa13da7,_0x14bc92){return db[_0x1af7('0x41')][_0x1af7('0x4b')](_0xa13da7[_0x1af7('0x4c')],{})[_0x1af7('0x26')](function(_0x218fb7){var _0x3fdd72=_0xa13da7[_0x1af7('0x4d')]['get']({'plain':!![]});if(!_0x3fdd72)throw new Error(_0x1af7('0x4e'));if(_0x3fdd72[_0x1af7('0x4f')]===_0x1af7('0x4d')){var _0x5df2aa=_0x218fb7[_0x1af7('0x50')]({'plain':!![]});var _0x192c2c='FaxQueues';return db[_0x1af7('0x51')][_0x1af7('0x49')]({'where':{'name':_0x192c2c,'userProfileId':_0x3fdd72[_0x1af7('0x52')]},'raw':!![]})[_0x1af7('0x26')](function(_0x9f7fb0){if(_0x9f7fb0&&_0x9f7fb0[_0x1af7('0x53')]===0x0){return db[_0x1af7('0x28')][_0x1af7('0x4b')]({'name':_0x5df2aa[_0x1af7('0x2b')],'resourceId':_0x5df2aa['id'],'type':_0x9f7fb0[_0x1af7('0x2b')],'sectionId':_0x9f7fb0['id']},{})[_0x1af7('0x26')](function(){return _0x218fb7;});}else{return _0x218fb7;}})[_0x1af7('0x4a')](function(_0x2b112b){logger[_0x1af7('0x29')](_0x1af7('0x54'),_0x2b112b);throw _0x2b112b;});}return _0x218fb7;})[_0x1af7('0x26')](respondWithResult(_0x14bc92,0xc9))[_0x1af7('0x4a')](handleError(_0x14bc92,null));};exports['update']=function(_0x21f286,_0x3e8149){if(_0x21f286[_0x1af7('0x4c')]['id']){delete _0x21f286[_0x1af7('0x4c')]['id'];}return db[_0x1af7('0x41')][_0x1af7('0x49')]({'where':{'id':_0x21f286[_0x1af7('0x47')]['id']}})[_0x1af7('0x26')](handleEntityNotFound(_0x3e8149,null))[_0x1af7('0x26')](saveUpdates(_0x21f286[_0x1af7('0x4c')],null))[_0x1af7('0x26')](respondWithResult(_0x3e8149,null))['catch'](handleError(_0x3e8149,null));};exports['destroy']=function(_0x5659ee,_0x40ce4d){return db[_0x1af7('0x41')]['find']({'where':{'id':_0x5659ee[_0x1af7('0x47')]['id']}})['then'](handleEntityNotFound(_0x40ce4d,null))[_0x1af7('0x26')](removeEntity(_0x40ce4d,null))[_0x1af7('0x4a')](handleError(_0x40ce4d,null));};exports['describe']=function(_0x320e4e,_0x2496fa){return db[_0x1af7('0x41')][_0x1af7('0x55')]()['then'](respondWithResult(_0x2496fa,null))[_0x1af7('0x4a')](handleError(_0x2496fa,null));};exports[_0x1af7('0x56')]=function(_0x282026,_0x25964a,_0x180307){var _0x339b04={'raw':!![],'where':{}},_0x15ce24={},_0xeaaf23;return db[_0x1af7('0x41')][_0x1af7('0x57')]({'where':{'id':_0x282026['params']['id']}})[_0x1af7('0x26')](handleEntityNotFound(_0x25964a,null))[_0x1af7('0x26')](function(_0x3ad13e){if(_0x3ad13e){_0xeaaf23=_0x3ad13e['get']({'plain':!![]});_0x15ce24['model']=_['keys'](db[_0x1af7('0x58')][_0x1af7('0x48')]);_0x15ce24['query']=_[_0x1af7('0x30')](_0x282026[_0x1af7('0x31')]);_0x15ce24['filters']=_[_0x1af7('0x33')](_0x15ce24['model'],_0x15ce24['query']);_0x339b04[_0x1af7('0x34')]=_[_0x1af7('0x33')](_0x15ce24[_0x1af7('0x37')],qs[_0x1af7('0x35')](_0x282026[_0x1af7('0x31')][_0x1af7('0x35')]));_0x339b04[_0x1af7('0x34')]=_0x339b04['attributes'][_0x1af7('0x36')]?_0x339b04[_0x1af7('0x34')]:_0x15ce24[_0x1af7('0x37')];if(!_0x282026[_0x1af7('0x31')][_0x1af7('0x59')](_0x1af7('0x38'))){_0x339b04['limit']=qs[_0x1af7('0x20')](_0x282026[_0x1af7('0x31')]['limit']);_0x339b04[_0x1af7('0x1e')]=qs[_0x1af7('0x1e')](_0x282026[_0x1af7('0x31')][_0x1af7('0x1e')]);}_0x339b04[_0x1af7('0x5a')]=qs['sort'](_0x282026[_0x1af7('0x31')][_0x1af7('0x39')]);_0x339b04[_0x1af7('0x3a')]=qs[_0x1af7('0x32')](_[_0x1af7('0x3b')](_0x282026[_0x1af7('0x31')],_0x15ce24[_0x1af7('0x32')]));_0x339b04[_0x1af7('0x3a')][_0x1af7('0x5b')]=_0x3ad13e['id'];if(_0x282026[_0x1af7('0x31')][_0x1af7('0x3c')]){_0x339b04['where']=_[_0x1af7('0x3d')](_0x339b04[_0x1af7('0x3a')],{'$or':_[_0x1af7('0x2e')](_0x339b04[_0x1af7('0x34')],function(_0x25be2a){var _0x4a56d7={};_0x4a56d7[_0x25be2a]={'$like':'%'+_0x282026[_0x1af7('0x31')][_0x1af7('0x3c')]+'%'};return _0x4a56d7;})});}_0x339b04=_['merge']({},_0x339b04,_0x282026[_0x1af7('0x40')]);return db[_0x1af7('0x58')][_0x1af7('0x44')](_0x339b04);}})['then'](function(_0x5dd7e9){if(_0x5dd7e9){return db[_0x1af7('0x5c')]['findAndCountAll']({'where':{'id':_[_0x1af7('0x2e')](_0x5dd7e9,_0x1af7('0x5d')),'role':'agent'},'attributes':['id',_0x1af7('0x2b'),_0x1af7('0x5e'),'updatedAt',_0x1af7('0x5f')]});}})[_0x1af7('0x26')](function(_0x3678e8){if(_0x3678e8){return{'count':_0x3678e8[_0x1af7('0x21')],'rows':_[_0x1af7('0x2e')](_0x3678e8['rows'],function(_0x450e1d){return{'membername':_0x450e1d[_0x1af7('0x2b')],'UserId':_0x450e1d['id'],'queue_name':_0xeaaf23[_0x1af7('0x2b')],'FaxQueueId':_0xeaaf23['id'],'interface':util['format'](_0x1af7('0x60'),_0x1af7('0x61'),_0x450e1d[_0x1af7('0x2b')]),'penalty':0x0,'paused':_0x450e1d['faxPause'],'createdAt':_0x450e1d['createdAt'],'updatedAt':_0x450e1d[_0x1af7('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x25964a,_0x339b04))[_0x1af7('0x4a')](handleError(_0x25964a,null));};exports[_0x1af7('0x63')]=function(_0x26df23,_0x27af19,_0x5afecf){var _0x31a043={};var _0x53a5b6={};var _0x2d4aea;var _0x461c2c;return db['FaxQueue'][_0x1af7('0x57')]({'where':{'id':_0x26df23[_0x1af7('0x47')]['id']}})[_0x1af7('0x26')](handleEntityNotFound(_0x27af19,null))[_0x1af7('0x26')](function(_0x493957){if(_0x493957){_0x2d4aea=_0x493957;_0x53a5b6[_0x1af7('0x37')]=_[_0x1af7('0x30')](db[_0x1af7('0x64')][_0x1af7('0x48')]);_0x53a5b6[_0x1af7('0x31')]=_[_0x1af7('0x30')](_0x26df23['query']);_0x53a5b6[_0x1af7('0x32')]=_[_0x1af7('0x33')](_0x53a5b6[_0x1af7('0x37')],_0x53a5b6['query']);_0x31a043[_0x1af7('0x34')]=_[_0x1af7('0x33')](_0x53a5b6[_0x1af7('0x37')],qs['fields'](_0x26df23[_0x1af7('0x31')][_0x1af7('0x35')]));_0x31a043[_0x1af7('0x34')]=_0x31a043[_0x1af7('0x34')][_0x1af7('0x36')]?_0x31a043[_0x1af7('0x34')]:_0x53a5b6[_0x1af7('0x37')];_0x31a043[_0x1af7('0x5a')]=qs[_0x1af7('0x39')](_0x26df23[_0x1af7('0x31')][_0x1af7('0x39')]);_0x31a043[_0x1af7('0x3a')]=qs['filters'](_[_0x1af7('0x3b')](_0x26df23[_0x1af7('0x31')],_0x53a5b6['filters']));if(_0x26df23[_0x1af7('0x31')][_0x1af7('0x3c')]){_0x31a043[_0x1af7('0x3a')]=_[_0x1af7('0x3d')](_0x31a043[_0x1af7('0x3a')],{'$or':_['map'](_0x31a043[_0x1af7('0x34')],function(_0x5e86ac){var _0x302fc6={};_0x302fc6[_0x5e86ac]={'$like':'%'+_0x26df23['query'][_0x1af7('0x3c')]+'%'};return _0x302fc6;})});}_0x31a043=_[_0x1af7('0x3d')]({},_0x31a043,_0x26df23[_0x1af7('0x40')]);return _0x2d4aea['getTeams'](_0x31a043);}})['then'](function(_0x30f01c){if(_0x30f01c){_0x461c2c=_0x30f01c['length'];if(!_0x26df23[_0x1af7('0x31')][_0x1af7('0x59')]('nolimit')){_0x31a043[_0x1af7('0x20')]=qs[_0x1af7('0x20')](_0x26df23[_0x1af7('0x31')][_0x1af7('0x20')]);_0x31a043['offset']=qs[_0x1af7('0x1e')](_0x26df23[_0x1af7('0x31')][_0x1af7('0x1e')]);}return _0x2d4aea[_0x1af7('0x63')](_0x31a043);}})['then'](function(_0x25eee5){if(_0x25eee5){return _0x25eee5?{'count':_0x461c2c,'rows':_0x25eee5}:null;}})[_0x1af7('0x26')](respondWithResult(_0x27af19,null))[_0x1af7('0x4a')](handleError(_0x27af19,null));};exports[_0x1af7('0x65')]=function(_0x46545b,_0x1aa62e,_0x226170){var _0x3f3755=_0x46545b[_0x1af7('0x4c')][_0x1af7('0x66')];return db[_0x1af7('0x64')]['findAll']({'where':{'id':_0x3f3755},'attributes':['id'],'include':[{'model':db[_0x1af7('0x5c')],'as':_0x1af7('0x67'),'attributes':['id',_0x1af7('0x2b'),'online',_0x1af7('0x68'),_0x1af7('0x69')],'raw':!![]}]})['then'](function(_0x9fb8da){if(_0x9fb8da){var _0x394ba7=_[_0x1af7('0x6a')](_0x9fb8da,function(_0x2a211d){var _0x11f035=_0x2a211d[_0x1af7('0x50')]({'plain':!![]});return _0x11f035['Agents'];});return db[_0x1af7('0x41')]['find']({'where':{'id':_0x46545b['params']['id']}})[_0x1af7('0x26')](function(_0x801ce6){return db['sequelize']['transaction'](function(_0x309309){return _0x801ce6['addTeams'](_0x3f3755,{'transaction':_0x309309})[_0x1af7('0x26')](function(){return BPromise[_0x1af7('0x6b')](_0x394ba7,function(_0x480cb0){return db[_0x1af7('0x58')][_0x1af7('0x6c')]({'where':{'UserId':_0x480cb0['id'],'FaxQueueId':_0x46545b['params']['id']},'transaction':_0x309309});});})['then'](function(){_0x394ba7[_0x1af7('0x6d')](function(_0x60d606){socket[_0x1af7('0x6e')]('userFaxQueue:save',{'UserId':_0x60d606['id'],'FaxQueueId':_0x801ce6['id']});});});});});}})[_0x1af7('0x26')](respondWithStatusCode(_0x1aa62e,null))[_0x1af7('0x4a')](handleError(_0x1aa62e,null));};exports[_0x1af7('0x6f')]=function(_0x358c30,_0x1eb09d,_0x47c3e2){return db[_0x1af7('0x64')][_0x1af7('0x44')]({'where':{'id':_0x358c30[_0x1af7('0x31')][_0x1af7('0x66')]},'attributes':['id'],'include':[{'model':db[_0x1af7('0x5c')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x1eb09d,null))['then'](function(_0x4dafef){var _0x17d9f3=_[_0x1af7('0x2e')](_0x4dafef,'id');var _0x45f3a0=[];var _0x1df1d6=[];var _0x1e6af3=squel[_0x1af7('0x70')]();_0x1e6af3[_0x1af7('0x71')]('tq.TeamId')[_0x1af7('0x72')](_0x1af7('0x73'),'tq')[_0x1af7('0x74')](_0x1af7('0x75'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x1af7('0x76'),_0x358c30['params']['id']);for(var _0x41db45=0x0;_0x41db45<_0x4dafef[_0x1af7('0x36')];_0x41db45+=0x1){let _0x2520d5=_0x4dafef[_0x41db45];for(var _0x5390a0=0x0;_0x5390a0<_0x2520d5[_0x1af7('0x67')][_0x1af7('0x36')];_0x5390a0+=0x1){let _0x5ca70d=_0x2520d5[_0x1af7('0x67')][_0x5390a0];var _0x223616=_0x1e6af3[_0x1af7('0x77')]();_0x223616[_0x1af7('0x3a')](_0x1af7('0x78'),_0x5ca70d['id']);_0x1df1d6[_0x1af7('0x79')](db[_0x1af7('0x7a')][_0x1af7('0x31')](_0x223616[_0x1af7('0x7b')](),{'type':db['sequelize'][_0x1af7('0x7c')]['SELECT']})[_0x1af7('0x26')](function(_0x114fa4){if(_0x114fa4[_0x1af7('0x36')]===0x1){return _0x5ca70d['id'];}else{var _0x3ecf82=_[_0x1af7('0x7d')](_[_0x1af7('0x2e')](_0x114fa4,_0x1af7('0x7e')),function(_0x893fb4){return _[_0x1af7('0x7f')](_0x17d9f3,_0x893fb4);});if(_0x3ecf82){return _0x5ca70d['id'];}}}));}}return BPromise[_0x1af7('0x80')](_0x1df1d6)[_0x1af7('0x26')](function(_0x4583a6){_0x45f3a0=_(_0x45f3a0)['union'](_0x4583a6)['compact']()[_0x1af7('0x81')]();return db[_0x1af7('0x41')][_0x1af7('0x49')]({'where':{'id':_0x358c30[_0x1af7('0x47')]['id']}})['then'](function(_0x317990){return db[_0x1af7('0x7a')][_0x1af7('0x82')](function(_0xbcbad8){return _0x317990[_0x1af7('0x6f')](_0x358c30['query'][_0x1af7('0x66')],{'transaction':_0xbcbad8})['then'](function(){if(!_[_0x1af7('0x83')](_0x45f3a0)){return _0x317990[_0x1af7('0x84')](_0x45f3a0,{'transaction':_0xbcbad8});}})['then'](function(){_0x45f3a0['forEach'](function(_0x5e4cae){socket[_0x1af7('0x6e')]('userFaxQueue:remove',{'UserId':_0x5e4cae,'FaxQueueId':_0x317990['id']});});});});});});})['then'](respondWithStatusCode(_0x1eb09d,null))[_0x1af7('0x4a')](handleError(_0x1eb09d,null));};exports[_0x1af7('0x85')]=function(_0x5bb2b9,_0x534875,_0x3f3a44){return db['FaxQueue'][_0x1af7('0x49')]({'where':{'id':_0x5bb2b9[_0x1af7('0x47')]['id']}})[_0x1af7('0x26')](handleEntityNotFound(_0x534875,null))['then'](function(_0x219dca){if(_0x219dca){return _0x219dca[_0x1af7('0x85')](_0x5bb2b9[_0x1af7('0x4c')][_0x1af7('0x66')],_[_0x1af7('0x86')](_0x5bb2b9['body'],[_0x1af7('0x66'),'id'])||{})[_0x1af7('0x87')](function(_0x3c4fff){for(var _0x2ccd2f=0x0;_0x2ccd2f<_0x5bb2b9['body'][_0x1af7('0x66')][_0x1af7('0x36')];_0x2ccd2f+=0x1){socket['emit'](_0x1af7('0x88'),{'UserId':Number(_0x5bb2b9['body'][_0x1af7('0x66')][_0x2ccd2f]),'FaxQueueId':Number(_0x5bb2b9['params']['id'])});}return _0x3c4fff;});}})[_0x1af7('0x26')](respondWithResult(_0x534875,null))['catch'](handleError(_0x534875,null));};exports['removeAgents']=function(_0x250ac1,_0x563d07,_0x100839){return db[_0x1af7('0x41')][_0x1af7('0x49')]({'where':{'id':_0x250ac1['params']['id']}})[_0x1af7('0x26')](handleEntityNotFound(_0x563d07,null))['then'](function(_0x33b8b5){if(_0x33b8b5){return _0x33b8b5['removeAgents'](_0x250ac1[_0x1af7('0x31')]['ids'])['then'](function(){if(_[_0x1af7('0x89')](_0x250ac1[_0x1af7('0x31')][_0x1af7('0x66')])){for(var _0x37936c=0x0;_0x37936c<_0x250ac1[_0x1af7('0x31')][_0x1af7('0x66')][_0x1af7('0x36')];_0x37936c+=0x1){socket[_0x1af7('0x6e')](_0x1af7('0x8a'),{'UserId':Number(_0x250ac1[_0x1af7('0x31')][_0x1af7('0x66')][_0x37936c]),'FaxQueueId':Number(_0x250ac1[_0x1af7('0x47')]['id'])});}}else{socket['emit'](_0x1af7('0x8a'),{'UserId':Number(_0x250ac1[_0x1af7('0x31')][_0x1af7('0x66')]),'FaxQueueId':Number(_0x250ac1[_0x1af7('0x47')]['id'])});}});}})[_0x1af7('0x26')](respondWithStatusCode(_0x563d07,null))['catch'](handleError(_0x563d07,null));};exports[_0x1af7('0x8b')]=function(_0x4efeb6,_0x44542,_0x3256fd){var _0x19dfb4={};var _0x3d9ed2={};var _0xc8ed5f;var _0x517001;return db[_0x1af7('0x41')][_0x1af7('0x57')]({'where':{'id':_0x4efeb6[_0x1af7('0x47')]['id']}})[_0x1af7('0x26')](handleEntityNotFound(_0x44542,null))['then'](function(_0x135531){if(_0x135531){_0xc8ed5f=_0x135531;_0x3d9ed2[_0x1af7('0x37')]=_[_0x1af7('0x30')](db['User'][_0x1af7('0x48')]);_0x3d9ed2[_0x1af7('0x31')]=_[_0x1af7('0x30')](_0x4efeb6[_0x1af7('0x31')]);_0x3d9ed2[_0x1af7('0x32')]=_['intersection'](_0x3d9ed2['model'],_0x3d9ed2[_0x1af7('0x31')]);_0x19dfb4[_0x1af7('0x34')]=_[_0x1af7('0x33')](_0x3d9ed2['model'],qs[_0x1af7('0x35')](_0x4efeb6[_0x1af7('0x31')][_0x1af7('0x35')]));_0x19dfb4[_0x1af7('0x34')]=_0x19dfb4[_0x1af7('0x34')][_0x1af7('0x36')]?_0x19dfb4[_0x1af7('0x34')]:_0x3d9ed2[_0x1af7('0x37')];_0x19dfb4[_0x1af7('0x5a')]=qs[_0x1af7('0x39')](_0x4efeb6[_0x1af7('0x31')]['sort']);_0x19dfb4[_0x1af7('0x3a')]=qs[_0x1af7('0x32')](_[_0x1af7('0x3b')](_0x4efeb6[_0x1af7('0x31')],_0x3d9ed2[_0x1af7('0x32')]));if(_0x4efeb6[_0x1af7('0x31')][_0x1af7('0x3c')]){_0x19dfb4[_0x1af7('0x3a')]=_['merge'](_0x19dfb4[_0x1af7('0x3a')],{'$or':_['map'](_0x19dfb4[_0x1af7('0x34')],function(_0x14f16a){var _0x54120c={};_0x54120c[_0x14f16a]={'$like':'%'+_0x4efeb6[_0x1af7('0x31')]['filter']+'%'};return _0x54120c;})});}_0x19dfb4=_[_0x1af7('0x3d')]({},_0x19dfb4,_0x4efeb6[_0x1af7('0x40')]);return _0xc8ed5f['getAgents'](_0x19dfb4);}})['then'](function(_0x39dc46){if(_0x39dc46){_0x517001=_0x39dc46[_0x1af7('0x36')];if(!_0x4efeb6[_0x1af7('0x31')]['hasOwnProperty'](_0x1af7('0x38'))){_0x19dfb4[_0x1af7('0x20')]=qs[_0x1af7('0x20')](_0x4efeb6[_0x1af7('0x31')][_0x1af7('0x20')]);_0x19dfb4[_0x1af7('0x1e')]=qs[_0x1af7('0x1e')](_0x4efeb6['query'][_0x1af7('0x1e')]);}return _0xc8ed5f[_0x1af7('0x8b')](_0x19dfb4);}})[_0x1af7('0x26')](function(_0x546849){if(_0x546849){return _0x546849?{'count':_0x517001,'rows':_0x546849}:null;}})[_0x1af7('0x26')](respondWithResult(_0x44542,null))[_0x1af7('0x4a')](handleError(_0x44542,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 9dd9ea3..d837235 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 _0xed13=['save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','FaxQueue','setMaxListeners'];(function(_0x4001ad,_0x1e22dd){var _0x4c7ec2=function(_0x24cb8a){while(--_0x24cb8a){_0x4001ad['push'](_0x4001ad['shift']());}};_0x4c7ec2(++_0x1e22dd);}(_0xed13,0x1f0));var _0x3ed1=function(_0x31a577,_0x22ce08){_0x31a577=_0x31a577-0x0;var _0xde02db=_0xed13[_0x31a577];return _0xde02db;};'use strict';var EventEmitter=require(_0x3ed1('0x0'));var FaxQueue=require(_0x3ed1('0x1'))['db'][_0x3ed1('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x3ed1('0x3')](0x0);var events={'afterCreate':_0x3ed1('0x4'),'afterUpdate':_0x3ed1('0x5'),'afterDestroy':_0x3ed1('0x6')};function emitEvent(_0x570483){return function(_0x3628b2,_0x53a622,_0x44a6f7){FaxQueueEvents[_0x3ed1('0x7')](_0x570483+':'+_0x3628b2['id'],_0x3628b2);FaxQueueEvents['emit'](_0x570483,_0x3628b2);_0x44a6f7(null);};}for(var e in events){if(events[_0x3ed1('0x8')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0x3ed1('0x9')]=FaxQueueEvents; \ No newline at end of file +var _0xd784=['emit','hasOwnProperty','exports','events','FaxQueue','setMaxListeners','save','update','remove'];(function(_0x4ffa64,_0x271035){var _0x5da001=function(_0x7d1940){while(--_0x7d1940){_0x4ffa64['push'](_0x4ffa64['shift']());}};_0x5da001(++_0x271035);}(_0xd784,0x81));var _0x4d78=function(_0x2c0f6f,_0x4b0a86){_0x2c0f6f=_0x2c0f6f-0x0;var _0x55271c=_0xd784[_0x2c0f6f];return _0x55271c;};'use strict';var EventEmitter=require(_0x4d78('0x0'));var FaxQueue=require('../../mysqldb')['db'][_0x4d78('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x4d78('0x2')](0x0);var events={'afterCreate':_0x4d78('0x3'),'afterUpdate':_0x4d78('0x4'),'afterDestroy':_0x4d78('0x5')};function emitEvent(_0xd2ae10){return function(_0x561af4,_0x8f7e1,_0xd886c8){FaxQueueEvents['emit'](_0xd2ae10+':'+_0x561af4['id'],_0x561af4);FaxQueueEvents[_0x4d78('0x6')](_0xd2ae10,_0x561af4);_0xd886c8(null);};}for(var e in events){if(events[_0x4d78('0x7')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0x4d78('0x8')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index ee9c59e..8b8fe76 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 _0x1ce7=['exports','define','FaxQueue','fax_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./faxQueue.attributes'];(function(_0x4b64ed,_0x29fa6d){var _0x222746=function(_0x5e2f10){while(--_0x5e2f10){_0x4b64ed['push'](_0x4b64ed['shift']());}};_0x222746(++_0x29fa6d);}(_0x1ce7,0x156));var _0x71ce=function(_0x5db99b,_0xdee23a){_0x5db99b=_0x5db99b-0x0;var _0x4b2d0e=_0x1ce7[_0x5db99b];return _0x4b2d0e;};'use strict';var _=require(_0x71ce('0x0'));var util=require(_0x71ce('0x1'));var logger=require(_0x71ce('0x2'))(_0x71ce('0x3'));var moment=require('moment');var BPromise=require(_0x71ce('0x4'));var rp=require(_0x71ce('0x5'));var fs=require('fs');var path=require(_0x71ce('0x6'));var rimraf=require(_0x71ce('0x7'));var config=require('../../config/environment');var attributes=require(_0x71ce('0x8'));module[_0x71ce('0x9')]=function(_0x2d1781,_0x38abf9){return _0x2d1781[_0x71ce('0xa')](_0x71ce('0xb'),attributes,{'tableName':_0x71ce('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf028=['./faxQueue.attributes','exports','define','FaxQueue','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x11e0bf,_0x2f5cbe){var _0x40878b=function(_0x368b4f){while(--_0x368b4f){_0x11e0bf['push'](_0x11e0bf['shift']());}};_0x40878b(++_0x2f5cbe);}(_0xf028,0xba));var _0x8f02=function(_0x551c31,_0x469c97){_0x551c31=_0x551c31-0x0;var _0x149777=_0xf028[_0x551c31];return _0x149777;};'use strict';var _=require(_0x8f02('0x0'));var util=require(_0x8f02('0x1'));var logger=require(_0x8f02('0x2'))(_0x8f02('0x3'));var moment=require(_0x8f02('0x4'));var BPromise=require('bluebird');var rp=require(_0x8f02('0x5'));var fs=require('fs');var path=require(_0x8f02('0x6'));var rimraf=require(_0x8f02('0x7'));var config=require(_0x8f02('0x8'));var attributes=require(_0x8f02('0x9'));module[_0x8f02('0xa')]=function(_0xa453ca,_0x164d97){return _0xa453ca[_0x8f02('0xb')](_0x8f02('0xc'),attributes,{'tableName':'fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index 3188737..bfab034 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 _0x1ba1=['request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFaxQueue','options','raw','where','attributes','limit','include','map','model','FaxQueue','find','ShowFaxQueue','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','then','info','FaxQueue,\x20%s,\x20%s'];(function(_0x2dd83d,_0x5be7b0){var _0x20cae4=function(_0x13640f){while(--_0x13640f){_0x2dd83d['push'](_0x2dd83d['shift']());}};_0x20cae4(++_0x5be7b0);}(_0x1ba1,0x1b7));var _0x11ba=function(_0x507821,_0x39ae7e){_0x507821=_0x507821-0x0;var _0x289f6e=_0x1ba1[_0x507821];return _0x289f6e;};'use strict';var _=require(_0x11ba('0x0'));var util=require(_0x11ba('0x1'));var moment=require('moment');var BPromise=require(_0x11ba('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x11ba('0x3'));var db=require(_0x11ba('0x4'))['db'];var utils=require(_0x11ba('0x5'));var logger=require(_0x11ba('0x6'))('rpc');var config=require(_0x11ba('0x7'));var jayson=require(_0x11ba('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x11ba('0x9')]=_[_0x11ba('0xa')](config['redis'],{'host':_0x11ba('0xb'),'port':0x18eb});var socket=require(_0x11ba('0xc'))(new Redis(config[_0x11ba('0x9')]));require(_0x11ba('0xd'))['register'](socket);function respondWithRpcPromise(_0x2e48ec,_0x338a28,_0x4cc62c){return new BPromise(function(_0x2a0829,_0xb93fe1){return client['request'](_0x2e48ec,_0x4cc62c)[_0x11ba('0xe')](function(_0xe238c9){logger[_0x11ba('0xf')](_0x11ba('0x10'),_0x338a28,_0x11ba('0x11'));logger[_0x11ba('0x12')](_0x11ba('0x13'),_0x338a28,_0x11ba('0x11'),JSON[_0x11ba('0x14')](_0xe238c9));if(_0xe238c9[_0x11ba('0x15')]){if(_0xe238c9[_0x11ba('0x15')][_0x11ba('0x16')]===0x1f4){logger[_0x11ba('0x15')]('FaxQueue,\x20%s,\x20%s',_0x338a28,_0xe238c9[_0x11ba('0x15')][_0x11ba('0x17')]);return _0xb93fe1(_0xe238c9['error'][_0x11ba('0x17')]);}logger[_0x11ba('0x15')](_0x11ba('0x10'),_0x338a28,_0xe238c9[_0x11ba('0x15')]['message']);return _0x2a0829(_0xe238c9[_0x11ba('0x15')]['message']);}else{logger[_0x11ba('0xf')]('FaxQueue,\x20%s,\x20%s',_0x338a28,_0x11ba('0x11'));_0x2a0829(_0xe238c9[_0x11ba('0x18')][_0x11ba('0x17')]);}})[_0x11ba('0x19')](function(_0x4f08ac){logger['error'](_0x11ba('0x10'),_0x338a28,_0x4f08ac);_0xb93fe1(_0x4f08ac);});});}exports[_0x11ba('0x1a')]=function(_0xa8d383){var _0x1013a9=this;return new Promise(function(_0x4a0922,_0xed8368){return db['FaxQueue']['findAll']({'raw':_0xa8d383['options']?_0xa8d383[_0x11ba('0x1b')][_0x11ba('0x1c')]===undefined?!![]:![]:!![],'where':_0xa8d383[_0x11ba('0x1b')]?_0xa8d383['options'][_0x11ba('0x1d')]||null:null,'attributes':_0xa8d383[_0x11ba('0x1b')]?_0xa8d383['options'][_0x11ba('0x1e')]||null:null,'limit':_0xa8d383['options']?_0xa8d383[_0x11ba('0x1b')][_0x11ba('0x1f')]||null:null,'include':_0xa8d383[_0x11ba('0x1b')]?_0xa8d383[_0x11ba('0x1b')][_0x11ba('0x20')]?_[_0x11ba('0x21')](_0xa8d383[_0x11ba('0x1b')][_0x11ba('0x20')],function(_0x132c5d){return{'model':db[_0x132c5d['model']],'as':_0x132c5d['as'],'attributes':_0x132c5d['attributes'],'include':_0x132c5d[_0x11ba('0x20')]?_[_0x11ba('0x21')](_0x132c5d['include'],function(_0x254f1c){return{'model':db[_0x254f1c['model']],'as':_0x254f1c['as'],'attributes':_0x254f1c['attributes'],'include':_0x254f1c[_0x11ba('0x20')]?_['map'](_0x254f1c[_0x11ba('0x20')],function(_0x4c6587){return{'model':db[_0x4c6587[_0x11ba('0x22')]],'as':_0x4c6587['as'],'attributes':_0x4c6587[_0x11ba('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x11ba('0xe')](function(_0x3093dc){logger[_0x11ba('0xf')](_0x11ba('0x1a'),_0xa8d383);logger[_0x11ba('0x12')]('GetFaxQueue',_0xa8d383,JSON[_0x11ba('0x14')](_0x3093dc));_0x4a0922(_0x3093dc);})['catch'](function(_0x280876){logger[_0x11ba('0x15')](_0x11ba('0x1a'),_0x280876['message'],_0xa8d383);_0xed8368(_0x1013a9[_0x11ba('0x15')](0x1f4,_0x280876[_0x11ba('0x17')]));});});};exports['ShowFaxQueue']=function(_0x1bedc1){var _0xe4b6e9=this;return new Promise(function(_0x3083b2,_0x25b2b3){return db[_0x11ba('0x23')][_0x11ba('0x24')]({'raw':_0x1bedc1[_0x11ba('0x1b')]?_0x1bedc1[_0x11ba('0x1b')][_0x11ba('0x1c')]===undefined?!![]:![]:!![],'where':_0x1bedc1[_0x11ba('0x1b')]?_0x1bedc1[_0x11ba('0x1b')][_0x11ba('0x1d')]||null:null,'attributes':_0x1bedc1[_0x11ba('0x1b')]?_0x1bedc1[_0x11ba('0x1b')][_0x11ba('0x1e')]||null:null,'include':_0x1bedc1[_0x11ba('0x1b')]?_0x1bedc1[_0x11ba('0x1b')][_0x11ba('0x20')]?_[_0x11ba('0x21')](_0x1bedc1['options'][_0x11ba('0x20')],function(_0x2470b8){return{'model':db[_0x2470b8[_0x11ba('0x22')]],'as':_0x2470b8['as'],'attributes':_0x2470b8[_0x11ba('0x1e')],'include':_0x2470b8[_0x11ba('0x20')]?_[_0x11ba('0x21')](_0x2470b8['include'],function(_0x1471c3){return{'model':db[_0x1471c3[_0x11ba('0x22')]],'as':_0x1471c3['as'],'attributes':_0x1471c3[_0x11ba('0x1e')],'include':_0x1471c3[_0x11ba('0x20')]?_['map'](_0x1471c3[_0x11ba('0x20')],function(_0x5c95ab){return{'model':db[_0x5c95ab[_0x11ba('0x22')]],'as':_0x5c95ab['as'],'attributes':_0x5c95ab['attributes']};}):[]};}):[]};}):[]:[]})[_0x11ba('0xe')](function(_0x425013){logger[_0x11ba('0xf')](_0x11ba('0x25'),_0x1bedc1);logger[_0x11ba('0x12')](_0x11ba('0x25'),_0x1bedc1,JSON[_0x11ba('0x14')](_0x425013));_0x3083b2(_0x425013);})[_0x11ba('0x19')](function(_0x577ab7){logger['error']('ShowFaxQueue',_0x577ab7[_0x11ba('0x17')],_0x1bedc1);_0x25b2b3(_0xe4b6e9[_0x11ba('0x15')](0x1f4,_0x577ab7[_0x11ba('0x17')]));});});}; \ No newline at end of file +var _0xc777=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','request','then','FaxQueue,\x20%s,\x20%s','request\x20sent','FaxQueue,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetFaxQueue','FaxQueue','findAll','options','raw','where','attributes','include','map','model','info','debug','stringify','ShowFaxQueue','find','moment'];(function(_0x3fea2e,_0x2f2143){var _0x916f35=function(_0xab89be){while(--_0xab89be){_0x3fea2e['push'](_0x3fea2e['shift']());}};_0x916f35(++_0x2f2143);}(_0xc777,0x1eb));var _0x7c77=function(_0x2412bd,_0x3dd7eb){_0x2412bd=_0x2412bd-0x0;var _0x2acd23=_0xc777[_0x2412bd];return _0x2acd23;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7c77('0x0'));var BPromise=require(_0x7c77('0x1'));var rs=require(_0x7c77('0x2'));var fs=require('fs');var Redis=require(_0x7c77('0x3'));var db=require(_0x7c77('0x4'))['db'];var utils=require(_0x7c77('0x5'));var logger=require(_0x7c77('0x6'))(_0x7c77('0x7'));var config=require(_0x7c77('0x8'));var jayson=require(_0x7c77('0x9'));var client=jayson[_0x7c77('0xa')][_0x7c77('0xb')]({'port':0x232a});config[_0x7c77('0xc')]=_[_0x7c77('0xd')](config['redis'],{'host':_0x7c77('0xe'),'port':0x18eb});var socket=require(_0x7c77('0xf'))(new Redis(config[_0x7c77('0xc')]));require(_0x7c77('0x10'))['register'](socket);function respondWithRpcPromise(_0x285e72,_0xca3d01,_0x195607){return new BPromise(function(_0xdbc31e,_0x172bdf){return client[_0x7c77('0x11')](_0x285e72,_0x195607)[_0x7c77('0x12')](function(_0x4181c8){logger['info'](_0x7c77('0x13'),_0xca3d01,_0x7c77('0x14'));logger['debug'](_0x7c77('0x15'),_0xca3d01,_0x7c77('0x14'),JSON['stringify'](_0x4181c8));if(_0x4181c8['error']){if(_0x4181c8[_0x7c77('0x16')][_0x7c77('0x17')]===0x1f4){logger['error']('FaxQueue,\x20%s,\x20%s',_0xca3d01,_0x4181c8['error']['message']);return _0x172bdf(_0x4181c8[_0x7c77('0x16')][_0x7c77('0x18')]);}logger[_0x7c77('0x16')](_0x7c77('0x13'),_0xca3d01,_0x4181c8[_0x7c77('0x16')][_0x7c77('0x18')]);return _0xdbc31e(_0x4181c8[_0x7c77('0x16')][_0x7c77('0x18')]);}else{logger['info'](_0x7c77('0x13'),_0xca3d01,_0x7c77('0x14'));_0xdbc31e(_0x4181c8['result'][_0x7c77('0x18')]);}})[_0x7c77('0x19')](function(_0x243fd2){logger['error'](_0x7c77('0x13'),_0xca3d01,_0x243fd2);_0x172bdf(_0x243fd2);});});}exports[_0x7c77('0x1a')]=function(_0x5b0277){var _0x187171=this;return new Promise(function(_0x5b9397,_0x23d9f9){return db[_0x7c77('0x1b')][_0x7c77('0x1c')]({'raw':_0x5b0277[_0x7c77('0x1d')]?_0x5b0277[_0x7c77('0x1d')][_0x7c77('0x1e')]===undefined?!![]:![]:!![],'where':_0x5b0277[_0x7c77('0x1d')]?_0x5b0277['options'][_0x7c77('0x1f')]||null:null,'attributes':_0x5b0277['options']?_0x5b0277[_0x7c77('0x1d')][_0x7c77('0x20')]||null:null,'limit':_0x5b0277[_0x7c77('0x1d')]?_0x5b0277['options']['limit']||null:null,'include':_0x5b0277[_0x7c77('0x1d')]?_0x5b0277[_0x7c77('0x1d')][_0x7c77('0x21')]?_[_0x7c77('0x22')](_0x5b0277[_0x7c77('0x1d')][_0x7c77('0x21')],function(_0x360508){return{'model':db[_0x360508[_0x7c77('0x23')]],'as':_0x360508['as'],'attributes':_0x360508['attributes'],'include':_0x360508[_0x7c77('0x21')]?_['map'](_0x360508[_0x7c77('0x21')],function(_0x529525){return{'model':db[_0x529525[_0x7c77('0x23')]],'as':_0x529525['as'],'attributes':_0x529525[_0x7c77('0x20')],'include':_0x529525['include']?_[_0x7c77('0x22')](_0x529525[_0x7c77('0x21')],function(_0x30d0f7){return{'model':db[_0x30d0f7[_0x7c77('0x23')]],'as':_0x30d0f7['as'],'attributes':_0x30d0f7[_0x7c77('0x20')]};}):[]};}):[]};}):[]:[]})[_0x7c77('0x12')](function(_0x88d0db){logger[_0x7c77('0x24')]('GetFaxQueue',_0x5b0277);logger[_0x7c77('0x25')](_0x7c77('0x1a'),_0x5b0277,JSON[_0x7c77('0x26')](_0x88d0db));_0x5b9397(_0x88d0db);})[_0x7c77('0x19')](function(_0x28a2f8){logger[_0x7c77('0x16')](_0x7c77('0x1a'),_0x28a2f8['message'],_0x5b0277);_0x23d9f9(_0x187171[_0x7c77('0x16')](0x1f4,_0x28a2f8[_0x7c77('0x18')]));});});};exports[_0x7c77('0x27')]=function(_0x179c35){var _0x2ec92d=this;return new Promise(function(_0x402143,_0x1f3756){return db['FaxQueue'][_0x7c77('0x28')]({'raw':_0x179c35[_0x7c77('0x1d')]?_0x179c35[_0x7c77('0x1d')][_0x7c77('0x1e')]===undefined?!![]:![]:!![],'where':_0x179c35['options']?_0x179c35[_0x7c77('0x1d')]['where']||null:null,'attributes':_0x179c35[_0x7c77('0x1d')]?_0x179c35[_0x7c77('0x1d')][_0x7c77('0x20')]||null:null,'include':_0x179c35[_0x7c77('0x1d')]?_0x179c35['options'][_0x7c77('0x21')]?_['map'](_0x179c35[_0x7c77('0x1d')]['include'],function(_0x5aa0d3){return{'model':db[_0x5aa0d3[_0x7c77('0x23')]],'as':_0x5aa0d3['as'],'attributes':_0x5aa0d3[_0x7c77('0x20')],'include':_0x5aa0d3[_0x7c77('0x21')]?_[_0x7c77('0x22')](_0x5aa0d3['include'],function(_0x4c7283){return{'model':db[_0x4c7283['model']],'as':_0x4c7283['as'],'attributes':_0x4c7283[_0x7c77('0x20')],'include':_0x4c7283[_0x7c77('0x21')]?_[_0x7c77('0x22')](_0x4c7283['include'],function(_0x3c09c0){return{'model':db[_0x3c09c0['model']],'as':_0x3c09c0['as'],'attributes':_0x3c09c0[_0x7c77('0x20')]};}):[]};}):[]};}):[]:[]})[_0x7c77('0x12')](function(_0x1b82ce){logger[_0x7c77('0x24')](_0x7c77('0x27'),_0x179c35);logger[_0x7c77('0x25')](_0x7c77('0x27'),_0x179c35,JSON[_0x7c77('0x26')](_0x1b82ce));_0x402143(_0x1b82ce);})[_0x7c77('0x19')](function(_0x27ea53){logger[_0x7c77('0x16')](_0x7c77('0x27'),_0x27ea53['message'],_0x179c35);_0x1f3756(_0x2ec92d[_0x7c77('0x16')](0x1f4,_0x27ea53[_0x7c77('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 94118aa..d2b08dc 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 _0x4504=['length','faxQueue:','./faxQueue.events','save','update','emit','register'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x4504,0xd4));var _0x4450=function(_0x2d2aa6,_0x28063c){_0x2d2aa6=_0x2d2aa6-0x0;var _0x993463=_0x4504[_0x2d2aa6];return _0x993463;};'use strict';var FaxQueueEvents=require(_0x4450('0x0'));var events=[_0x4450('0x1'),'remove',_0x4450('0x2')];function createListener(_0x11d833,_0xce64ea){return function(_0xf3c1e0){_0xce64ea[_0x4450('0x3')](_0x11d833,_0xf3c1e0);};}function removeListener(_0x576ac2,_0x558f50){return function(){FaxQueueEvents['removeListener'](_0x576ac2,_0x558f50);};}exports[_0x4450('0x4')]=function(_0x368730){for(var _0x5be3c5=0x0,_0x2ba484=events[_0x4450('0x5')];_0x5be3c5<_0x2ba484;_0x5be3c5++){var _0xa9671=events[_0x5be3c5];var _0x4767b8=createListener(_0x4450('0x6')+_0xa9671,_0x368730);FaxQueueEvents['on'](_0xa9671,_0x4767b8);}}; \ No newline at end of file +var _0x5111=['length','faxQueue:','./faxQueue.events','save','remove','emit','removeListener','register'];(function(_0x126fb9,_0x122c59){var _0xc8a3b1=function(_0x355744){while(--_0x355744){_0x126fb9['push'](_0x126fb9['shift']());}};_0xc8a3b1(++_0x122c59);}(_0x5111,0x132));var _0x1511=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x5111[_0xfae23b];return _0x200640;};'use strict';var FaxQueueEvents=require(_0x1511('0x0'));var events=[_0x1511('0x1'),_0x1511('0x2'),'update'];function createListener(_0x5820a5,_0x255e0a){return function(_0x177df4){_0x255e0a[_0x1511('0x3')](_0x5820a5,_0x177df4);};}function removeListener(_0x4d164a,_0x55b34d){return function(){FaxQueueEvents[_0x1511('0x4')](_0x4d164a,_0x55b34d);};}exports[_0x1511('0x5')]=function(_0xd0f329){for(var _0x4919a9=0x0,_0x5ae5e7=events[_0x1511('0x6')];_0x4919a9<_0x5ae5e7;_0x4919a9++){var _0x427d6b=events[_0x4919a9];var _0x981ab1=createListener(_0x1511('0x7')+_0x427d6b,_0xd0f329);FaxQueueEvents['on'](_0x427d6b,_0x981ab1);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 6414da2..7e0733e 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 _0x3914=['../../components/auth/service','../../components/interaction/service','./faxQueue.controller','get','index','/describe','describe','show','/:id/members','getMembers','/:id/teams','isAuthenticated','/:id/users','getAgents','post','create','addTeams','addAgents','/:id','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','fs-extra'];(function(_0x18cc48,_0xeda107){var _0x1e13fd=function(_0x4f7860){while(--_0x4f7860){_0x18cc48['push'](_0x18cc48['shift']());}};_0x1e13fd(++_0xeda107);}(_0x3914,0xeb));var _0x4391=function(_0x43d701,_0x4bb2e9){_0x43d701=_0x43d701-0x0;var _0x2ec4c6=_0x3914[_0x43d701];return _0x2ec4c6;};'use strict';var multer=require(_0x4391('0x0'));var util=require(_0x4391('0x1'));var path=require('path');var timeout=require(_0x4391('0x2'));var express=require(_0x4391('0x3'));var router=express['Router']();var fs_extra=require(_0x4391('0x4'));var auth=require(_0x4391('0x5'));var interaction=require(_0x4391('0x6'));var config=require('../../config/environment');var controller=require(_0x4391('0x7'));router[_0x4391('0x8')]('/',auth['isAuthenticated'](),controller[_0x4391('0x9')]);router['get'](_0x4391('0xa'),auth['isAuthenticated'](),controller[_0x4391('0xb')]);router[_0x4391('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x4391('0xc')]);router[_0x4391('0x8')](_0x4391('0xd'),auth['isAuthenticated'](),controller[_0x4391('0xe')]);router[_0x4391('0x8')](_0x4391('0xf'),auth[_0x4391('0x10')](),controller['getTeams']);router[_0x4391('0x8')](_0x4391('0x11'),auth[_0x4391('0x10')](),controller[_0x4391('0x12')]);router[_0x4391('0x13')]('/',auth[_0x4391('0x10')](),controller[_0x4391('0x14')]);router[_0x4391('0x13')]('/:id/teams',auth[_0x4391('0x10')](),controller[_0x4391('0x15')]);router[_0x4391('0x13')](_0x4391('0x11'),auth['isAuthenticated'](),controller[_0x4391('0x16')]);router['put'](_0x4391('0x17'),auth[_0x4391('0x10')](),controller[_0x4391('0x18')]);router[_0x4391('0x19')](_0x4391('0x17'),auth[_0x4391('0x10')](),controller[_0x4391('0x1a')]);router[_0x4391('0x19')]('/:id/teams',auth['isAuthenticated'](),controller[_0x4391('0x1b')]);router['delete'](_0x4391('0x11'),auth[_0x4391('0x10')](),controller[_0x4391('0x1c')]);module[_0x4391('0x1d')]=router; \ No newline at end of file +var _0x0a6b=['update','destroy','delete','removeTeams','removeAgents','exports','multer','express','fs-extra','../../components/auth/service','../../components/interaction/service','./faxQueue.controller','isAuthenticated','index','/describe','describe','show','get','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','/:id'];(function(_0x13137e,_0x29c0f3){var _0x346261=function(_0x8c7d4f){while(--_0x8c7d4f){_0x13137e['push'](_0x13137e['shift']());}};_0x346261(++_0x29c0f3);}(_0x0a6b,0x18e));var _0xb0a6=function(_0xf1dbd8,_0x1cb2e1){_0xf1dbd8=_0xf1dbd8-0x0;var _0x5ee4be=_0x0a6b[_0xf1dbd8];return _0x5ee4be;};'use strict';var multer=require(_0xb0a6('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb0a6('0x1'));var router=express['Router']();var fs_extra=require(_0xb0a6('0x2'));var auth=require(_0xb0a6('0x3'));var interaction=require(_0xb0a6('0x4'));var config=require('../../config/environment');var controller=require(_0xb0a6('0x5'));router['get']('/',auth[_0xb0a6('0x6')](),controller[_0xb0a6('0x7')]);router['get'](_0xb0a6('0x8'),auth[_0xb0a6('0x6')](),controller[_0xb0a6('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xb0a6('0xa')]);router[_0xb0a6('0xb')](_0xb0a6('0xc'),auth[_0xb0a6('0x6')](),controller['getMembers']);router[_0xb0a6('0xb')](_0xb0a6('0xd'),auth['isAuthenticated'](),controller[_0xb0a6('0xe')]);router[_0xb0a6('0xb')](_0xb0a6('0xf'),auth[_0xb0a6('0x6')](),controller[_0xb0a6('0x10')]);router[_0xb0a6('0x11')]('/',auth[_0xb0a6('0x6')](),controller[_0xb0a6('0x12')]);router[_0xb0a6('0x11')](_0xb0a6('0xd'),auth['isAuthenticated'](),controller[_0xb0a6('0x13')]);router['post'](_0xb0a6('0xf'),auth['isAuthenticated'](),controller[_0xb0a6('0x14')]);router['put'](_0xb0a6('0x15'),auth[_0xb0a6('0x6')](),controller[_0xb0a6('0x16')]);router['delete']('/:id',auth[_0xb0a6('0x6')](),controller[_0xb0a6('0x17')]);router[_0xb0a6('0x18')](_0xb0a6('0xd'),auth[_0xb0a6('0x6')](),controller[_0xb0a6('0x19')]);router['delete'](_0xb0a6('0xf'),auth[_0xb0a6('0x6')](),controller[_0xb0a6('0x1a')]);module[_0xb0a6('0x1b')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 891e4c0..3ba081d 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 _0x20d7=['STRING','DATE','exports'];(function(_0x4f5322,_0x5830e0){var _0x1fb1df=function(_0x28643a){while(--_0x28643a){_0x4f5322['push'](_0x4f5322['shift']());}};_0x1fb1df(++_0x5830e0);}(_0x20d7,0x146));var _0x720d=function(_0x2cf254,_0x513096){_0x2cf254=_0x2cf254-0x0;var _0x33c760=_0x20d7[_0x2cf254];return _0x33c760;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x720d('0x0')]={'uniqueid':{'type':Sequelize[_0x720d('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x720d('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x720d('0x2')]},'reason':{'type':Sequelize[_0x720d('0x1')]}}; \ No newline at end of file +var _0x20e2=['sequelize','exports','STRING','DATE','moment'];(function(_0x45c532,_0xeec349){var _0x547182=function(_0x55b3af){while(--_0x55b3af){_0x45c532['push'](_0x45c532['shift']());}};_0x547182(++_0xeec349);}(_0x20e2,0x8b));var _0x220e=function(_0x4a4b9f,_0x184118){_0x4a4b9f=_0x4a4b9f-0x0;var _0x3346de=_0x20e2[_0x4a4b9f];return _0x3346de;};'use strict';var moment=require(_0x220e('0x0'));var Sequelize=require(_0x220e('0x1'));module[_0x220e('0x2')]={'uniqueid':{'type':Sequelize[_0x220e('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x220e('0x4')]},'exitAt':{'type':Sequelize[_0x220e('0x4')]},'reason':{'type':Sequelize[_0x220e('0x3')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 97c23f6..5c8dd21 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 _0x222f=['sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','FaxQueueReport','rawAttributes','fieldName','key','model','query','keys','attributes','intersection','fields','nolimit','sort','where','filters','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x5e08a9,_0x12b7bb){var _0x4896c3=function(_0x11e8d8){while(--_0x11e8d8){_0x5e08a9['push'](_0x5e08a9['shift']());}};_0x4896c3(++_0x12b7bb);}(_0x222f,0x1a4));var _0xf222=function(_0x48ec91,_0x212edc){_0x48ec91=_0x48ec91-0x0;var _0x22766c=_0x222f[_0x48ec91];return _0x22766c;};'use strict';var emlformat=require(_0xf222('0x0'));var rimraf=require(_0xf222('0x1'));var zipdir=require(_0xf222('0x2'));var jsonpatch=require(_0xf222('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf222('0x4'));var Mustache=require(_0xf222('0x5'));var util=require(_0xf222('0x6'));var path=require(_0xf222('0x7'));var sox=require('sox');var csv=require(_0xf222('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf222('0x9'));var _=require(_0xf222('0xa'));var squel=require('squel');var crypto=require(_0xf222('0xb'));var jsforce=require(_0xf222('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xf222('0x8'));var querystring=require(_0xf222('0xd'));var Papa=require(_0xf222('0xe'));var Redis=require(_0xf222('0xf'));var authService=require(_0xf222('0x10'));var qs=require(_0xf222('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf222('0x12'));var logger=require(_0xf222('0x13'))(_0xf222('0x14'));var utils=require(_0xf222('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf222('0x16'));var db=require(_0xf222('0x17'))['db'];function respondWithStatusCode(_0x2a6965,_0x3d3d29){_0x3d3d29=_0x3d3d29||0xcc;return function(_0x12f968){if(_0x12f968){return _0x2a6965[_0xf222('0x18')](_0x3d3d29);}return _0x2a6965[_0xf222('0x19')](_0x3d3d29)[_0xf222('0x1a')]();};}function respondWithResult(_0x52a003,_0x5b8f97){_0x5b8f97=_0x5b8f97||0xc8;return function(_0x1feb86){if(_0x1feb86){return _0x52a003[_0xf222('0x19')](_0x5b8f97)['json'](_0x1feb86);}};}function respondWithFilteredResult(_0x39be58,_0x43d35b){return function(_0x464f3e){if(_0x464f3e){var _0x4392a0=typeof _0x43d35b[_0xf222('0x1b')]===_0xf222('0x1c')&&typeof _0x43d35b[_0xf222('0x1d')]==='undefined';var _0x1efa9f=_0x464f3e[_0xf222('0x1e')];var _0x8783ab=_0x4392a0?0x0:_0x43d35b[_0xf222('0x1b')];var _0x12a2e4=_0x4392a0?_0x464f3e[_0xf222('0x1e')]:_0x43d35b[_0xf222('0x1b')]+_0x43d35b['limit'];var _0xf26a16;if(_0x12a2e4>=_0x1efa9f){_0x12a2e4=_0x1efa9f;_0xf26a16=0xc8;}else{_0xf26a16=0xce;}_0x39be58[_0xf222('0x19')](_0xf26a16);return _0x39be58[_0xf222('0x1f')](_0xf222('0x20'),_0x8783ab+'-'+_0x12a2e4+'/'+_0x1efa9f)['json'](_0x464f3e);}return null;};}function patchUpdates(_0x5cd899){return function(_0x398ff4){try{jsonpatch[_0xf222('0x21')](_0x398ff4,_0x5cd899,!![]);}catch(_0x201cf0){return BPromise[_0xf222('0x22')](_0x201cf0);}return _0x398ff4[_0xf222('0x23')]();};}function saveUpdates(_0x151a89,_0x51b872){return function(_0x176b20){if(_0x176b20){return _0x176b20[_0xf222('0x24')](_0x151a89)[_0xf222('0x25')](function(_0x12d443){return _0x12d443;});}return null;};}function removeEntity(_0x2c48ce,_0x2d18ab){return function(_0x4616de){if(_0x4616de){return _0x4616de[_0xf222('0x26')]()['then'](function(){_0x2c48ce[_0xf222('0x19')](0xcc)[_0xf222('0x1a')]();});}};}function handleEntityNotFound(_0x1883c1,_0x3fce26){return function(_0x4305e0){if(!_0x4305e0){_0x1883c1[_0xf222('0x18')](0x194);}return _0x4305e0;};}function handleError(_0x42616e,_0x263dc2){_0x263dc2=_0x263dc2||0x1f4;return function(_0x15bf4e){logger[_0xf222('0x27')](_0x15bf4e[_0xf222('0x28')]);if(_0x15bf4e['name']){delete _0x15bf4e[_0xf222('0x29')];}_0x42616e[_0xf222('0x19')](_0x263dc2)[_0xf222('0x2a')](_0x15bf4e);};}exports[_0xf222('0x2b')]=function(_0xe41039,_0x40a715){var _0x3789e0={},_0x1b928b={},_0x1e87ec={'count':0x0,'rows':[]};var _0x59721a=_[_0xf222('0x2c')](db[_0xf222('0x2d')][_0xf222('0x2e')],function(_0x53a382){return{'name':_0x53a382[_0xf222('0x2f')],'type':_0x53a382['type'][_0xf222('0x30')]};});_0x1b928b[_0xf222('0x31')]=_[_0xf222('0x2c')](_0x59721a,_0xf222('0x29'));_0x1b928b[_0xf222('0x32')]=_[_0xf222('0x33')](_0xe41039[_0xf222('0x32')]);_0x1b928b['filters']=_['intersection'](_0x1b928b[_0xf222('0x31')],_0x1b928b[_0xf222('0x32')]);_0x3789e0[_0xf222('0x34')]=_[_0xf222('0x35')](_0x1b928b[_0xf222('0x31')],qs[_0xf222('0x36')](_0xe41039['query'][_0xf222('0x36')]));_0x3789e0[_0xf222('0x34')]=_0x3789e0[_0xf222('0x34')]['length']?_0x3789e0[_0xf222('0x34')]:_0x1b928b[_0xf222('0x31')];if(!_0xe41039[_0xf222('0x32')]['hasOwnProperty'](_0xf222('0x37'))){_0x3789e0[_0xf222('0x1d')]=qs[_0xf222('0x1d')](_0xe41039['query'][_0xf222('0x1d')]);_0x3789e0[_0xf222('0x1b')]=qs[_0xf222('0x1b')](_0xe41039[_0xf222('0x32')][_0xf222('0x1b')]);}_0x3789e0['order']=qs[_0xf222('0x38')](_0xe41039['query'][_0xf222('0x38')]);_0x3789e0[_0xf222('0x39')]=qs[_0xf222('0x3a')](_['pick'](_0xe41039[_0xf222('0x32')],_0x1b928b[_0xf222('0x3a')]),_0x59721a);if(_0xe41039['query'][_0xf222('0x3b')]){_0x3789e0['where']=_[_0xf222('0x3c')](_0x3789e0[_0xf222('0x39')],{'$or':_[_0xf222('0x2c')](_0x59721a,function(_0x5c8b04){if(_0x5c8b04[_0xf222('0x3d')]!==_0xf222('0x3e')){var _0x2c1e49={};_0x2c1e49[_0x5c8b04[_0xf222('0x29')]]={'$like':'%'+_0xe41039[_0xf222('0x32')][_0xf222('0x3b')]+'%'};return _0x2c1e49;}})});}_0x3789e0=_['merge']({},_0x3789e0,_0xe41039[_0xf222('0x3f')]);var _0x24e8a5={'where':_0x3789e0['where']};return db['FaxQueueReport'][_0xf222('0x1e')](_0x24e8a5)['then'](function(_0x2b20d3){_0x1e87ec[_0xf222('0x1e')]=_0x2b20d3;if(_0xe41039[_0xf222('0x32')][_0xf222('0x40')]){_0x3789e0['include']=[{'all':!![]}];}return db['FaxQueueReport'][_0xf222('0x41')](_0x3789e0);})['then'](function(_0x522a9e){_0x1e87ec[_0xf222('0x42')]=_0x522a9e;return _0x1e87ec;})[_0xf222('0x25')](respondWithFilteredResult(_0x40a715,_0x3789e0))[_0xf222('0x43')](handleError(_0x40a715,null));};exports[_0xf222('0x44')]=function(_0x10f065,_0x2af478){var _0x5c60e6={'raw':!![],'where':{'id':_0x10f065[_0xf222('0x45')]['id']}},_0xf829ae={};_0xf829ae['model']=_[_0xf222('0x33')](db[_0xf222('0x2d')]['rawAttributes']);_0xf829ae[_0xf222('0x32')]=_['keys'](_0x10f065[_0xf222('0x32')]);_0xf829ae[_0xf222('0x3a')]=_[_0xf222('0x35')](_0xf829ae[_0xf222('0x31')],_0xf829ae[_0xf222('0x32')]);_0x5c60e6[_0xf222('0x34')]=_[_0xf222('0x35')](_0xf829ae[_0xf222('0x31')],qs[_0xf222('0x36')](_0x10f065[_0xf222('0x32')][_0xf222('0x36')]));_0x5c60e6['attributes']=_0x5c60e6['attributes']['length']?_0x5c60e6[_0xf222('0x34')]:_0xf829ae[_0xf222('0x31')];if(_0x10f065[_0xf222('0x32')][_0xf222('0x40')]){_0x5c60e6['include']=[{'all':!![]}];}_0x5c60e6=_[_0xf222('0x3c')]({},_0x5c60e6,_0x10f065[_0xf222('0x3f')]);return db[_0xf222('0x2d')][_0xf222('0x46')](_0x5c60e6)['then'](handleEntityNotFound(_0x2af478,null))[_0xf222('0x25')](respondWithResult(_0x2af478,null))[_0xf222('0x43')](handleError(_0x2af478,null));};exports[_0xf222('0x47')]=function(_0x37b393,_0x1d60e5){return db[_0xf222('0x2d')][_0xf222('0x47')](_0x37b393[_0xf222('0x48')],{})[_0xf222('0x25')](respondWithResult(_0x1d60e5,0xc9))[_0xf222('0x43')](handleError(_0x1d60e5,null));};exports['update']=function(_0x5d0d70,_0x193762){if(_0x5d0d70['body']['id']){delete _0x5d0d70[_0xf222('0x48')]['id'];}return db['FaxQueueReport'][_0xf222('0x46')]({'where':{'id':_0x5d0d70['params']['id']}})[_0xf222('0x25')](handleEntityNotFound(_0x193762,null))[_0xf222('0x25')](saveUpdates(_0x5d0d70[_0xf222('0x48')],null))[_0xf222('0x25')](respondWithResult(_0x193762,null))['catch'](handleError(_0x193762,null));};exports[_0xf222('0x26')]=function(_0x34fd50,_0x380642){return db[_0xf222('0x2d')][_0xf222('0x46')]({'where':{'id':_0x34fd50[_0xf222('0x45')]['id']}})[_0xf222('0x25')](handleEntityNotFound(_0x380642,null))[_0xf222('0x25')](removeEntity(_0x380642,null))[_0xf222('0x43')](handleError(_0x380642,null));};exports[_0xf222('0x49')]=function(_0x40c3b2,_0x72af0b){return db['FaxQueueReport']['describe']()[_0xf222('0x25')](respondWithResult(_0x72af0b,null))[_0xf222('0x43')](handleError(_0x72af0b,null));}; \ No newline at end of file +var _0xc3b0=['sox','to-csv','fs-extra','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','FaxQueueReport','includeAll','include','findAll','rows','show','params','fields','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path'];(function(_0x1cd413,_0x52f2f9){var _0x31b9d4=function(_0x4cd631){while(--_0x4cd631){_0x1cd413['push'](_0x1cd413['shift']());}};_0x31b9d4(++_0x52f2f9);}(_0xc3b0,0x166));var _0x0c3b=function(_0x2321e0,_0x12df53){_0x2321e0=_0x2321e0-0x0;var _0xff9194=_0xc3b0[_0x2321e0];return _0xff9194;};'use strict';var emlformat=require(_0x0c3b('0x0'));var rimraf=require(_0x0c3b('0x1'));var zipdir=require(_0x0c3b('0x2'));var jsonpatch=require(_0x0c3b('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0c3b('0x4'));var Mustache=require(_0x0c3b('0x5'));var util=require('util');var path=require(_0x0c3b('0x6'));var sox=require(_0x0c3b('0x7'));var csv=require(_0x0c3b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0c3b('0x9'));var _=require(_0x0c3b('0xa'));var squel=require(_0x0c3b('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0c3b('0x8'));var querystring=require(_0x0c3b('0xc'));var Papa=require(_0x0c3b('0xd'));var Redis=require(_0x0c3b('0xe'));var authService=require(_0x0c3b('0xf'));var qs=require(_0x0c3b('0x10'));var as=require(_0x0c3b('0x11'));var hardwareService=require(_0x0c3b('0x12'));var logger=require(_0x0c3b('0x13'))(_0x0c3b('0x14'));var utils=require(_0x0c3b('0x15'));var config=require(_0x0c3b('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x0c3b('0x17'))['db'];function respondWithStatusCode(_0x5ba38d,_0x46ccb2){_0x46ccb2=_0x46ccb2||0xcc;return function(_0x4a6eff){if(_0x4a6eff){return _0x5ba38d[_0x0c3b('0x18')](_0x46ccb2);}return _0x5ba38d[_0x0c3b('0x19')](_0x46ccb2)[_0x0c3b('0x1a')]();};}function respondWithResult(_0x2bbfd1,_0x8bf2fd){_0x8bf2fd=_0x8bf2fd||0xc8;return function(_0x7a0b0a){if(_0x7a0b0a){return _0x2bbfd1['status'](_0x8bf2fd)[_0x0c3b('0x1b')](_0x7a0b0a);}};}function respondWithFilteredResult(_0x5b6e54,_0x57d16c){return function(_0x292e67){if(_0x292e67){var _0x35f261=typeof _0x57d16c[_0x0c3b('0x1c')]===_0x0c3b('0x1d')&&typeof _0x57d16c[_0x0c3b('0x1e')]==='undefined';var _0x5aedbd=_0x292e67[_0x0c3b('0x1f')];var _0xeaeeca=_0x35f261?0x0:_0x57d16c[_0x0c3b('0x1c')];var _0x55c08d=_0x35f261?_0x292e67[_0x0c3b('0x1f')]:_0x57d16c[_0x0c3b('0x1c')]+_0x57d16c[_0x0c3b('0x1e')];var _0x1e8ae4;if(_0x55c08d>=_0x5aedbd){_0x55c08d=_0x5aedbd;_0x1e8ae4=0xc8;}else{_0x1e8ae4=0xce;}_0x5b6e54[_0x0c3b('0x19')](_0x1e8ae4);return _0x5b6e54[_0x0c3b('0x20')](_0x0c3b('0x21'),_0xeaeeca+'-'+_0x55c08d+'/'+_0x5aedbd)['json'](_0x292e67);}return null;};}function patchUpdates(_0x31bdf3){return function(_0x55072f){try{jsonpatch[_0x0c3b('0x22')](_0x55072f,_0x31bdf3,!![]);}catch(_0x2a6913){return BPromise[_0x0c3b('0x23')](_0x2a6913);}return _0x55072f[_0x0c3b('0x24')]();};}function saveUpdates(_0x56a97e,_0x1932b3){return function(_0x1f9f16){if(_0x1f9f16){return _0x1f9f16[_0x0c3b('0x25')](_0x56a97e)[_0x0c3b('0x26')](function(_0x57b63b){return _0x57b63b;});}return null;};}function removeEntity(_0x30a2e0,_0x4453fd){return function(_0x413cc9){if(_0x413cc9){return _0x413cc9[_0x0c3b('0x27')]()[_0x0c3b('0x26')](function(){_0x30a2e0['status'](0xcc)[_0x0c3b('0x1a')]();});}};}function handleEntityNotFound(_0x50b315,_0x2e47bb){return function(_0x2733f2){if(!_0x2733f2){_0x50b315[_0x0c3b('0x18')](0x194);}return _0x2733f2;};}function handleError(_0x4f71ce,_0x2c65e2){_0x2c65e2=_0x2c65e2||0x1f4;return function(_0x11802b){logger[_0x0c3b('0x28')](_0x11802b[_0x0c3b('0x29')]);if(_0x11802b[_0x0c3b('0x2a')]){delete _0x11802b[_0x0c3b('0x2a')];}_0x4f71ce['status'](_0x2c65e2)['send'](_0x11802b);};}exports['index']=function(_0x4a78f9,_0xbd8b19){var _0x22d81b={},_0x514873={},_0x382a05={'count':0x0,'rows':[]};var _0x1c9488=_[_0x0c3b('0x2b')](db['FaxQueueReport'][_0x0c3b('0x2c')],function(_0x4694c3){return{'name':_0x4694c3[_0x0c3b('0x2d')],'type':_0x4694c3[_0x0c3b('0x2e')]['key']};});_0x514873[_0x0c3b('0x2f')]=_[_0x0c3b('0x2b')](_0x1c9488,_0x0c3b('0x2a'));_0x514873[_0x0c3b('0x30')]=_[_0x0c3b('0x31')](_0x4a78f9['query']);_0x514873[_0x0c3b('0x32')]=_[_0x0c3b('0x33')](_0x514873[_0x0c3b('0x2f')],_0x514873[_0x0c3b('0x30')]);_0x22d81b[_0x0c3b('0x34')]=_[_0x0c3b('0x33')](_0x514873[_0x0c3b('0x2f')],qs['fields'](_0x4a78f9[_0x0c3b('0x30')]['fields']));_0x22d81b[_0x0c3b('0x34')]=_0x22d81b[_0x0c3b('0x34')]['length']?_0x22d81b[_0x0c3b('0x34')]:_0x514873[_0x0c3b('0x2f')];if(!_0x4a78f9[_0x0c3b('0x30')][_0x0c3b('0x35')]('nolimit')){_0x22d81b[_0x0c3b('0x1e')]=qs[_0x0c3b('0x1e')](_0x4a78f9['query'][_0x0c3b('0x1e')]);_0x22d81b[_0x0c3b('0x1c')]=qs[_0x0c3b('0x1c')](_0x4a78f9['query'][_0x0c3b('0x1c')]);}_0x22d81b['order']=qs[_0x0c3b('0x36')](_0x4a78f9['query'][_0x0c3b('0x36')]);_0x22d81b[_0x0c3b('0x37')]=qs[_0x0c3b('0x32')](_['pick'](_0x4a78f9['query'],_0x514873['filters']),_0x1c9488);if(_0x4a78f9[_0x0c3b('0x30')][_0x0c3b('0x38')]){_0x22d81b[_0x0c3b('0x37')]=_[_0x0c3b('0x39')](_0x22d81b['where'],{'$or':_[_0x0c3b('0x2b')](_0x1c9488,function(_0x394887){if(_0x394887[_0x0c3b('0x2e')]!==_0x0c3b('0x3a')){var _0x5fe0e2={};_0x5fe0e2[_0x394887[_0x0c3b('0x2a')]]={'$like':'%'+_0x4a78f9[_0x0c3b('0x30')][_0x0c3b('0x38')]+'%'};return _0x5fe0e2;}})});}_0x22d81b=_[_0x0c3b('0x39')]({},_0x22d81b,_0x4a78f9[_0x0c3b('0x3b')]);var _0x3eab70={'where':_0x22d81b[_0x0c3b('0x37')]};return db[_0x0c3b('0x3c')][_0x0c3b('0x1f')](_0x3eab70)['then'](function(_0x1e07f1){_0x382a05[_0x0c3b('0x1f')]=_0x1e07f1;if(_0x4a78f9[_0x0c3b('0x30')][_0x0c3b('0x3d')]){_0x22d81b[_0x0c3b('0x3e')]=[{'all':!![]}];}return db[_0x0c3b('0x3c')][_0x0c3b('0x3f')](_0x22d81b);})[_0x0c3b('0x26')](function(_0x4290c5){_0x382a05[_0x0c3b('0x40')]=_0x4290c5;return _0x382a05;})[_0x0c3b('0x26')](respondWithFilteredResult(_0xbd8b19,_0x22d81b))['catch'](handleError(_0xbd8b19,null));};exports[_0x0c3b('0x41')]=function(_0xa0b486,_0x3add76){var _0x2b20f8={'raw':!![],'where':{'id':_0xa0b486[_0x0c3b('0x42')]['id']}},_0x50878b={};_0x50878b[_0x0c3b('0x2f')]=_[_0x0c3b('0x31')](db['FaxQueueReport'][_0x0c3b('0x2c')]);_0x50878b[_0x0c3b('0x30')]=_['keys'](_0xa0b486[_0x0c3b('0x30')]);_0x50878b[_0x0c3b('0x32')]=_[_0x0c3b('0x33')](_0x50878b['model'],_0x50878b['query']);_0x2b20f8[_0x0c3b('0x34')]=_[_0x0c3b('0x33')](_0x50878b[_0x0c3b('0x2f')],qs[_0x0c3b('0x43')](_0xa0b486[_0x0c3b('0x30')][_0x0c3b('0x43')]));_0x2b20f8[_0x0c3b('0x34')]=_0x2b20f8[_0x0c3b('0x34')]['length']?_0x2b20f8[_0x0c3b('0x34')]:_0x50878b[_0x0c3b('0x2f')];if(_0xa0b486['query'][_0x0c3b('0x3d')]){_0x2b20f8[_0x0c3b('0x3e')]=[{'all':!![]}];}_0x2b20f8=_['merge']({},_0x2b20f8,_0xa0b486[_0x0c3b('0x3b')]);return db[_0x0c3b('0x3c')][_0x0c3b('0x44')](_0x2b20f8)[_0x0c3b('0x26')](handleEntityNotFound(_0x3add76,null))[_0x0c3b('0x26')](respondWithResult(_0x3add76,null))[_0x0c3b('0x45')](handleError(_0x3add76,null));};exports[_0x0c3b('0x46')]=function(_0x198190,_0x237566){return db[_0x0c3b('0x3c')][_0x0c3b('0x46')](_0x198190[_0x0c3b('0x47')],{})['then'](respondWithResult(_0x237566,0xc9))['catch'](handleError(_0x237566,null));};exports[_0x0c3b('0x25')]=function(_0x171118,_0xe6b22a){if(_0x171118[_0x0c3b('0x47')]['id']){delete _0x171118['body']['id'];}return db['FaxQueueReport'][_0x0c3b('0x44')]({'where':{'id':_0x171118[_0x0c3b('0x42')]['id']}})[_0x0c3b('0x26')](handleEntityNotFound(_0xe6b22a,null))[_0x0c3b('0x26')](saveUpdates(_0x171118['body'],null))[_0x0c3b('0x26')](respondWithResult(_0xe6b22a,null))[_0x0c3b('0x45')](handleError(_0xe6b22a,null));};exports[_0x0c3b('0x27')]=function(_0x4809a2,_0x1e176b){return db[_0x0c3b('0x3c')][_0x0c3b('0x44')]({'where':{'id':_0x4809a2[_0x0c3b('0x42')]['id']}})[_0x0c3b('0x26')](handleEntityNotFound(_0x1e176b,null))[_0x0c3b('0x26')](removeEntity(_0x1e176b,null))[_0x0c3b('0x45')](handleError(_0x1e176b,null));};exports[_0x0c3b('0x48')]=function(_0x3d3bff,_0x100f75){return db[_0x0c3b('0x3c')][_0x0c3b('0x48')]()['then'](respondWithResult(_0x100f75,null))[_0x0c3b('0x45')](handleError(_0x100f75,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 91700fe..1e79688 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 _0x1cb9=['api','moment','bluebird','path','rimraf','./faxQueueReport.attributes','exports','define','FaxQueueReport','uniqueid','lodash','../../config/logger'];(function(_0x562f3b,_0x4c65ae){var _0x1edd55=function(_0xe67e06){while(--_0xe67e06){_0x562f3b['push'](_0x562f3b['shift']());}};_0x1edd55(++_0x4c65ae);}(_0x1cb9,0x14e));var _0x91cb=function(_0x2c35ff,_0x4d0872){_0x2c35ff=_0x2c35ff-0x0;var _0x28bf56=_0x1cb9[_0x2c35ff];return _0x28bf56;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var logger=require(_0x91cb('0x1'))(_0x91cb('0x2'));var moment=require(_0x91cb('0x3'));var BPromise=require(_0x91cb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x91cb('0x5'));var rimraf=require(_0x91cb('0x6'));var config=require('../../config/environment');var attributes=require(_0x91cb('0x7'));module[_0x91cb('0x8')]=function(_0x186dc3,_0x28543e){return _0x186dc3[_0x91cb('0x9')](_0x91cb('0xa'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0x91cb('0xb'),'fields':['uniqueid']}],'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(_0x586e46,_0x247275){var _0x5e47a1=function(_0x2617bd){while(--_0x2617bd){_0x586e46['push'](_0x586e46['shift']());}};_0x5e47a1(++_0x247275);}(_0xabce,0x103));var _0xeabc=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xabce[_0x397e5f];return _0x5302b8;};'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 766ff7c..9c91951 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 _0x1e24=['limit','UpdateFaxQueueReport','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','create','body','options','raw','CreateFaxQueueReport','FaxQueueReport','update'];(function(_0xbe7405,_0x1de012){var _0x2bcd7f=function(_0x48ceb7){while(--_0x48ceb7){_0xbe7405['push'](_0xbe7405['shift']());}};_0x2bcd7f(++_0x1de012);}(_0x1e24,0x82));var _0x41e2=function(_0x13e0c1,_0x642299){_0x13e0c1=_0x13e0c1-0x0;var _0x56e10d=_0x1e24[_0x13e0c1];return _0x56e10d;};'use strict';var _=require(_0x41e2('0x0'));var util=require(_0x41e2('0x1'));var moment=require(_0x41e2('0x2'));var BPromise=require(_0x41e2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x41e2('0x4'));var db=require(_0x41e2('0x5'))['db'];var utils=require(_0x41e2('0x6'));var logger=require(_0x41e2('0x7'))('rpc');var config=require(_0x41e2('0x8'));var jayson=require(_0x41e2('0x9'));var client=jayson[_0x41e2('0xa')][_0x41e2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x13fda6,_0x3d52b3,_0x12955b){return new BPromise(function(_0x1b6dd9,_0x470d69){return client['request'](_0x13fda6,_0x12955b)[_0x41e2('0xc')](function(_0x25dd75){logger[_0x41e2('0xd')](_0x41e2('0xe'),_0x3d52b3,_0x41e2('0xf'));logger[_0x41e2('0x10')](_0x41e2('0x11'),_0x3d52b3,_0x41e2('0xf'),JSON[_0x41e2('0x12')](_0x25dd75));if(_0x25dd75['error']){if(_0x25dd75[_0x41e2('0x13')]['code']===0x1f4){logger[_0x41e2('0x13')](_0x41e2('0xe'),_0x3d52b3,_0x25dd75[_0x41e2('0x13')]['message']);return _0x470d69(_0x25dd75[_0x41e2('0x13')]['message']);}logger[_0x41e2('0x13')]('FaxQueueReport,\x20%s,\x20%s',_0x3d52b3,_0x25dd75[_0x41e2('0x13')][_0x41e2('0x14')]);return _0x1b6dd9(_0x25dd75[_0x41e2('0x13')]['message']);}else{logger[_0x41e2('0xd')](_0x41e2('0xe'),_0x3d52b3,_0x41e2('0xf'));_0x1b6dd9(_0x25dd75[_0x41e2('0x15')]['message']);}})[_0x41e2('0x16')](function(_0x391c2a){logger[_0x41e2('0x13')](_0x41e2('0xe'),_0x3d52b3,_0x391c2a);_0x470d69(_0x391c2a);});});}exports['CreateFaxQueueReport']=function(_0x3dd4b7){var _0x463013=this;return new Promise(function(_0x4505a6,_0x337a6c){return db['FaxQueueReport'][_0x41e2('0x17')](_0x3dd4b7[_0x41e2('0x18')],{'raw':_0x3dd4b7[_0x41e2('0x19')]?_0x3dd4b7[_0x41e2('0x19')][_0x41e2('0x1a')]===undefined?!![]:![]:!![]})[_0x41e2('0xc')](function(_0x3dc6be){logger[_0x41e2('0xd')](_0x41e2('0x1b'),_0x3dd4b7);logger[_0x41e2('0x10')](_0x41e2('0x1b'),_0x3dd4b7,JSON[_0x41e2('0x12')](_0x3dc6be));_0x4505a6(_0x3dc6be);})[_0x41e2('0x16')](function(_0x267a25){logger[_0x41e2('0x13')](_0x41e2('0x1b'),_0x267a25[_0x41e2('0x14')],_0x3dd4b7);_0x337a6c(_0x463013['error'](0x1f4,_0x267a25[_0x41e2('0x14')]));});});};exports['UpdateFaxQueueReport']=function(_0xced78f){var _0x24be7a=this;return new Promise(function(_0x198c9f,_0x3dced4){return db[_0x41e2('0x1c')][_0x41e2('0x1d')](_0xced78f[_0x41e2('0x18')],{'raw':_0xced78f[_0x41e2('0x19')]?_0xced78f['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xced78f[_0x41e2('0x19')]?_0xced78f['options']['where']||null:null,'attributes':_0xced78f[_0x41e2('0x19')]?_0xced78f['options']['attributes']||null:null,'limit':_0xced78f[_0x41e2('0x19')]?_0xced78f[_0x41e2('0x19')][_0x41e2('0x1e')]||null:null})[_0x41e2('0xc')](function(_0x314d8e){logger[_0x41e2('0xd')]('UpdateFaxQueueReport',_0xced78f);logger[_0x41e2('0x10')]('UpdateFaxQueueReport',_0xced78f,JSON[_0x41e2('0x12')](_0x314d8e));_0x198c9f(_0x314d8e);})[_0x41e2('0x16')](function(_0x114ba1){logger[_0x41e2('0x13')](_0x41e2('0x1f'),_0x114ba1[_0x41e2('0x14')],_0xced78f);_0x3dced4(_0x24be7a[_0x41e2('0x13')](0x1f4,_0x114ba1[_0x41e2('0x14')]));});});}; \ No newline at end of file +var _0x22ae=['client','then','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','info','UpdateFaxQueueReport','update','where','limit','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x115fa5,_0x557371){var _0x465944=function(_0x20e636){while(--_0x20e636){_0x115fa5['push'](_0x115fa5['shift']());}};_0x465944(++_0x557371);}(_0x22ae,0x1b7));var _0xe22a=function(_0x519de3,_0xe7c04e){_0x519de3=_0x519de3-0x0;var _0x3e21d9=_0x22ae[_0x519de3];return _0x3e21d9;};'use strict';var _=require(_0xe22a('0x0'));var util=require(_0xe22a('0x1'));var moment=require(_0xe22a('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe22a('0x3'));var db=require(_0xe22a('0x4'))['db'];var utils=require(_0xe22a('0x5'));var logger=require(_0xe22a('0x6'))(_0xe22a('0x7'));var config=require('../../config/environment');var jayson=require(_0xe22a('0x8'));var client=jayson[_0xe22a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xcbcf71,_0x17dac6,_0x157999){return new BPromise(function(_0x1b8eb3,_0x37b8ba){return client['request'](_0xcbcf71,_0x157999)[_0xe22a('0xa')](function(_0x4754f5){logger['info'](_0xe22a('0xb'),_0x17dac6,_0xe22a('0xc'));logger[_0xe22a('0xd')](_0xe22a('0xe'),_0x17dac6,_0xe22a('0xc'),JSON[_0xe22a('0xf')](_0x4754f5));if(_0x4754f5[_0xe22a('0x10')]){if(_0x4754f5['error'][_0xe22a('0x11')]===0x1f4){logger[_0xe22a('0x10')](_0xe22a('0xb'),_0x17dac6,_0x4754f5[_0xe22a('0x10')][_0xe22a('0x12')]);return _0x37b8ba(_0x4754f5['error'][_0xe22a('0x12')]);}logger['error']('FaxQueueReport,\x20%s,\x20%s',_0x17dac6,_0x4754f5['error'][_0xe22a('0x12')]);return _0x1b8eb3(_0x4754f5[_0xe22a('0x10')][_0xe22a('0x12')]);}else{logger['info'](_0xe22a('0xb'),_0x17dac6,_0xe22a('0xc'));_0x1b8eb3(_0x4754f5[_0xe22a('0x13')][_0xe22a('0x12')]);}})[_0xe22a('0x14')](function(_0x1f3216){logger[_0xe22a('0x10')]('FaxQueueReport,\x20%s,\x20%s',_0x17dac6,_0x1f3216);_0x37b8ba(_0x1f3216);});});}exports[_0xe22a('0x15')]=function(_0x4fb779){var _0x44e683=this;return new Promise(function(_0x4f3dda,_0xb0174e){return db[_0xe22a('0x16')][_0xe22a('0x17')](_0x4fb779[_0xe22a('0x18')],{'raw':_0x4fb779[_0xe22a('0x19')]?_0x4fb779[_0xe22a('0x19')][_0xe22a('0x1a')]===undefined?!![]:![]:!![]})[_0xe22a('0xa')](function(_0x38798d){logger[_0xe22a('0x1b')]('CreateFaxQueueReport',_0x4fb779);logger[_0xe22a('0xd')](_0xe22a('0x15'),_0x4fb779,JSON['stringify'](_0x38798d));_0x4f3dda(_0x38798d);})[_0xe22a('0x14')](function(_0x274c2e){logger['error'](_0xe22a('0x15'),_0x274c2e['message'],_0x4fb779);_0xb0174e(_0x44e683[_0xe22a('0x10')](0x1f4,_0x274c2e[_0xe22a('0x12')]));});});};exports[_0xe22a('0x1c')]=function(_0x4815c1){var _0x211b0d=this;return new Promise(function(_0x7740bf,_0x110a82){return db[_0xe22a('0x16')][_0xe22a('0x1d')](_0x4815c1['body'],{'raw':_0x4815c1[_0xe22a('0x19')]?_0x4815c1[_0xe22a('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4815c1[_0xe22a('0x19')]?_0x4815c1['options'][_0xe22a('0x1e')]||null:null,'attributes':_0x4815c1[_0xe22a('0x19')]?_0x4815c1[_0xe22a('0x19')]['attributes']||null:null,'limit':_0x4815c1[_0xe22a('0x19')]?_0x4815c1[_0xe22a('0x19')][_0xe22a('0x1f')]||null:null})[_0xe22a('0xa')](function(_0x2af9b8){logger[_0xe22a('0x1b')](_0xe22a('0x1c'),_0x4815c1);logger[_0xe22a('0xd')]('UpdateFaxQueueReport',_0x4815c1,JSON[_0xe22a('0xf')](_0x2af9b8));_0x7740bf(_0x2af9b8);})[_0xe22a('0x14')](function(_0x2965b2){logger['error'](_0xe22a('0x1c'),_0x2965b2[_0xe22a('0x12')],_0x4815c1);_0x110a82(_0x211b0d['error'](0x1f4,_0x2965b2['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 96f4335..e7f68d6 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 _0x5a88=['/describe','/:id','show','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','index'];(function(_0x575296,_0x4d9c46){var _0x570242=function(_0x45ba79){while(--_0x45ba79){_0x575296['push'](_0x575296['shift']());}};_0x570242(++_0x4d9c46);}(_0x5a88,0x76));var _0x85a8=function(_0x53a8ae,_0x376612){_0x53a8ae=_0x53a8ae-0x0;var _0x443a88=_0x5a88[_0x53a8ae];return _0x443a88;};'use strict';var multer=require(_0x85a8('0x0'));var util=require(_0x85a8('0x1'));var path=require(_0x85a8('0x2'));var timeout=require(_0x85a8('0x3'));var express=require(_0x85a8('0x4'));var router=express[_0x85a8('0x5')]();var fs_extra=require(_0x85a8('0x6'));var auth=require(_0x85a8('0x7'));var interaction=require(_0x85a8('0x8'));var config=require(_0x85a8('0x9'));var controller=require(_0x85a8('0xa'));router[_0x85a8('0xb')]('/',auth[_0x85a8('0xc')](),controller[_0x85a8('0xd')]);router[_0x85a8('0xb')](_0x85a8('0xe'),auth[_0x85a8('0xc')](),controller['describe']);router[_0x85a8('0xb')](_0x85a8('0xf'),auth[_0x85a8('0xc')](),controller[_0x85a8('0x10')]);router['post']('/',auth[_0x85a8('0xc')](),controller[_0x85a8('0x11')]);router[_0x85a8('0x12')](_0x85a8('0xf'),auth['isAuthenticated'](),controller[_0x85a8('0x13')]);router[_0x85a8('0x14')](_0x85a8('0xf'),auth[_0x85a8('0xc')](),controller['destroy']);module[_0x85a8('0x15')]=router; \ No newline at end of file +var _0x01d6=['create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','index','/describe','/:id','show','post'];(function(_0x50a732,_0x1eab82){var _0x2047a1=function(_0x277e50){while(--_0x277e50){_0x50a732['push'](_0x50a732['shift']());}};_0x2047a1(++_0x1eab82);}(_0x01d6,0x123));var _0x601d=function(_0x44ed8e,_0x466494){_0x44ed8e=_0x44ed8e-0x0;var _0x38d329=_0x01d6[_0x44ed8e];return _0x38d329;};'use strict';var multer=require(_0x601d('0x0'));var util=require(_0x601d('0x1'));var path=require(_0x601d('0x2'));var timeout=require(_0x601d('0x3'));var express=require(_0x601d('0x4'));var router=express[_0x601d('0x5')]();var fs_extra=require(_0x601d('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x601d('0x7'));var config=require(_0x601d('0x8'));var controller=require(_0x601d('0x9'));router[_0x601d('0xa')]('/',auth[_0x601d('0xb')](),controller[_0x601d('0xc')]);router[_0x601d('0xa')](_0x601d('0xd'),auth[_0x601d('0xb')](),controller['describe']);router[_0x601d('0xa')](_0x601d('0xe'),auth[_0x601d('0xb')](),controller[_0x601d('0xf')]);router[_0x601d('0x10')]('/',auth['isAuthenticated'](),controller[_0x601d('0x11')]);router[_0x601d('0x12')](_0x601d('0xe'),auth[_0x601d('0xb')](),controller['update']);router[_0x601d('0x13')](_0x601d('0xe'),auth[_0x601d('0xb')](),controller[_0x601d('0x14')]);module[_0x601d('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 d4165e4..67e3b3d 100644 --- a/server/api/faxTransferReport/faxTransferReport.attributes.js +++ b/server/api/faxTransferReport/faxTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['NOW','moment','sequelize','exports','ENUM','account','agent','queue','DATE'];(function(_0x4f3e4f,_0x71df06){var _0x38cecf=function(_0x4480c2){while(--_0x4480c2){_0x4f3e4f['push'](_0x4f3e4f['shift']());}};_0x38cecf(++_0x71df06);}(_0xe706,0xa3));var _0x6e70=function(_0x535bcd,_0x1575af){_0x535bcd=_0x535bcd-0x0;var _0x42f269=_0xe706[_0x535bcd];return _0x42f269;};'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 _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x251d9c,_0x580977){var _0x16ae64=function(_0x4d3b53){while(--_0x4d3b53){_0x251d9c['push'](_0x251d9c['shift']());}};_0x16ae64(++_0x580977);}(_0x9bde,0xe1));var _0xe9bd=function(_0x2b67b8,_0xb562d0){_0x2b67b8=_0x2b67b8-0x0;var _0x448d4c=_0x9bde[_0x2b67b8];return _0x448d4c;};'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 diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 22183f2..c440e0b 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 _0xfc7d=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','error','stack','name','send','index','map','FaxTransferReport','rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','show','params','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x1ddc83,_0x323987){var _0x3d3d6c=function(_0x4a5cbd){while(--_0x4a5cbd){_0x1ddc83['push'](_0x1ddc83['shift']());}};_0x3d3d6c(++_0x323987);}(_0xfc7d,0x1a9));var _0xdfc7=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xfc7d[_0xfae23b];return _0x200640;};'use strict';var emlformat=require(_0xdfc7('0x0'));var rimraf=require(_0xdfc7('0x1'));var zipdir=require(_0xdfc7('0x2'));var jsonpatch=require(_0xdfc7('0x3'));var rp=require('request-promise');var moment=require(_0xdfc7('0x4'));var BPromise=require(_0xdfc7('0x5'));var Mustache=require(_0xdfc7('0x6'));var util=require(_0xdfc7('0x7'));var path=require(_0xdfc7('0x8'));var sox=require(_0xdfc7('0x9'));var csv=require(_0xdfc7('0xa'));var ejs=require(_0xdfc7('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdfc7('0xc'));var squel=require(_0xdfc7('0xd'));var crypto=require('crypto');var jsforce=require(_0xdfc7('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xdfc7('0xa'));var querystring=require('querystring');var Papa=require(_0xdfc7('0xf'));var Redis=require(_0xdfc7('0x10'));var authService=require(_0xdfc7('0x11'));var qs=require(_0xdfc7('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdfc7('0x13'));var logger=require(_0xdfc7('0x14'))(_0xdfc7('0x15'));var utils=require(_0xdfc7('0x16'));var config=require(_0xdfc7('0x17'));var licenseUtil=require(_0xdfc7('0x18'));var db=require(_0xdfc7('0x19'))['db'];function respondWithStatusCode(_0x28c730,_0x2cb749){_0x2cb749=_0x2cb749||0xcc;return function(_0x35ce2a){if(_0x35ce2a){return _0x28c730['sendStatus'](_0x2cb749);}return _0x28c730[_0xdfc7('0x1a')](_0x2cb749)[_0xdfc7('0x1b')]();};}function respondWithResult(_0x2baa71,_0x15f62e){_0x15f62e=_0x15f62e||0xc8;return function(_0x3d551c){if(_0x3d551c){return _0x2baa71['status'](_0x15f62e)[_0xdfc7('0x1c')](_0x3d551c);}};}function respondWithFilteredResult(_0x18304b,_0x13d93b){return function(_0xe374fe){if(_0xe374fe){var _0x276953=typeof _0x13d93b[_0xdfc7('0x1d')]===_0xdfc7('0x1e')&&typeof _0x13d93b[_0xdfc7('0x1f')]===_0xdfc7('0x1e');var _0x2624ba=_0xe374fe[_0xdfc7('0x20')];var _0x2470f3=_0x276953?0x0:_0x13d93b[_0xdfc7('0x1d')];var _0x394c6b=_0x276953?_0xe374fe[_0xdfc7('0x20')]:_0x13d93b[_0xdfc7('0x1d')]+_0x13d93b[_0xdfc7('0x1f')];var _0x14df48;if(_0x394c6b>=_0x2624ba){_0x394c6b=_0x2624ba;_0x14df48=0xc8;}else{_0x14df48=0xce;}_0x18304b[_0xdfc7('0x1a')](_0x14df48);return _0x18304b[_0xdfc7('0x21')]('Content-Range',_0x2470f3+'-'+_0x394c6b+'/'+_0x2624ba)['json'](_0xe374fe);}return null;};}function patchUpdates(_0x3165e8){return function(_0x115d9c){try{jsonpatch[_0xdfc7('0x22')](_0x115d9c,_0x3165e8,!![]);}catch(_0x1739f5){return BPromise[_0xdfc7('0x23')](_0x1739f5);}return _0x115d9c['save']();};}function saveUpdates(_0x4f4987,_0x5ef4b0){return function(_0x598da3){if(_0x598da3){return _0x598da3[_0xdfc7('0x24')](_0x4f4987)[_0xdfc7('0x25')](function(_0x35f17e){return _0x35f17e;});}return null;};}function removeEntity(_0x267d7a,_0x43522f){return function(_0xb41d3e){if(_0xb41d3e){return _0xb41d3e[_0xdfc7('0x26')]()[_0xdfc7('0x25')](function(){_0x267d7a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e2baa,_0x3b759a){return function(_0x5b865d){if(!_0x5b865d){_0x4e2baa['sendStatus'](0x194);}return _0x5b865d;};}function handleError(_0x238bd5,_0x15ee39){_0x15ee39=_0x15ee39||0x1f4;return function(_0x267c8a){logger[_0xdfc7('0x27')](_0x267c8a[_0xdfc7('0x28')]);if(_0x267c8a[_0xdfc7('0x29')]){delete _0x267c8a['name'];}_0x238bd5[_0xdfc7('0x1a')](_0x15ee39)[_0xdfc7('0x2a')](_0x267c8a);};}exports[_0xdfc7('0x2b')]=function(_0x566880,_0x58b81d){var _0x145feb={},_0x18d610={},_0x235336={'count':0x0,'rows':[]};var _0x208766=_[_0xdfc7('0x2c')](db[_0xdfc7('0x2d')][_0xdfc7('0x2e')],function(_0x548ac9){return{'name':_0x548ac9[_0xdfc7('0x2f')],'type':_0x548ac9['type']['key']};});_0x18d610[_0xdfc7('0x30')]=_[_0xdfc7('0x2c')](_0x208766,'name');_0x18d610[_0xdfc7('0x31')]=_['keys'](_0x566880['query']);_0x18d610[_0xdfc7('0x32')]=_[_0xdfc7('0x33')](_0x18d610['model'],_0x18d610[_0xdfc7('0x31')]);_0x145feb[_0xdfc7('0x34')]=_[_0xdfc7('0x33')](_0x18d610[_0xdfc7('0x30')],qs[_0xdfc7('0x35')](_0x566880[_0xdfc7('0x31')][_0xdfc7('0x35')]));_0x145feb[_0xdfc7('0x34')]=_0x145feb[_0xdfc7('0x34')][_0xdfc7('0x36')]?_0x145feb[_0xdfc7('0x34')]:_0x18d610['model'];if(!_0x566880['query'][_0xdfc7('0x37')](_0xdfc7('0x38'))){_0x145feb[_0xdfc7('0x1f')]=qs['limit'](_0x566880['query']['limit']);_0x145feb[_0xdfc7('0x1d')]=qs[_0xdfc7('0x1d')](_0x566880[_0xdfc7('0x31')][_0xdfc7('0x1d')]);}_0x145feb[_0xdfc7('0x39')]=qs['sort'](_0x566880['query'][_0xdfc7('0x3a')]);_0x145feb[_0xdfc7('0x3b')]=qs['filters'](_[_0xdfc7('0x3c')](_0x566880[_0xdfc7('0x31')],_0x18d610[_0xdfc7('0x32')]),_0x208766);if(_0x566880[_0xdfc7('0x31')][_0xdfc7('0x3d')]){_0x145feb[_0xdfc7('0x3b')]=_[_0xdfc7('0x3e')](_0x145feb[_0xdfc7('0x3b')],{'$or':_['map'](_0x208766,function(_0x128c57){if(_0x128c57['type']!=='VIRTUAL'){var _0x7f7873={};_0x7f7873[_0x128c57[_0xdfc7('0x29')]]={'$like':'%'+_0x566880['query'][_0xdfc7('0x3d')]+'%'};return _0x7f7873;}})});}_0x145feb=_[_0xdfc7('0x3e')]({},_0x145feb,_0x566880[_0xdfc7('0x3f')]);var _0x400537={'where':_0x145feb[_0xdfc7('0x3b')]};return db[_0xdfc7('0x2d')][_0xdfc7('0x20')](_0x400537)[_0xdfc7('0x25')](function(_0x29d674){_0x235336[_0xdfc7('0x20')]=_0x29d674;if(_0x566880['query'][_0xdfc7('0x40')]){_0x145feb[_0xdfc7('0x41')]=[{'all':!![]}];}return db[_0xdfc7('0x2d')]['findAll'](_0x145feb);})['then'](function(_0x16ffbe){_0x235336[_0xdfc7('0x42')]=_0x16ffbe;return _0x235336;})['then'](respondWithFilteredResult(_0x58b81d,_0x145feb))[_0xdfc7('0x43')](handleError(_0x58b81d,null));};exports[_0xdfc7('0x44')]=function(_0x320186,_0x5278c3){var _0x3a48b7={'raw':!![],'where':{'id':_0x320186[_0xdfc7('0x45')]['id']}},_0x4e8bea={};_0x4e8bea[_0xdfc7('0x30')]=_['keys'](db['FaxTransferReport'][_0xdfc7('0x2e')]);_0x4e8bea[_0xdfc7('0x31')]=_['keys'](_0x320186['query']);_0x4e8bea['filters']=_[_0xdfc7('0x33')](_0x4e8bea[_0xdfc7('0x30')],_0x4e8bea[_0xdfc7('0x31')]);_0x3a48b7[_0xdfc7('0x34')]=_[_0xdfc7('0x33')](_0x4e8bea[_0xdfc7('0x30')],qs[_0xdfc7('0x35')](_0x320186[_0xdfc7('0x31')][_0xdfc7('0x35')]));_0x3a48b7[_0xdfc7('0x34')]=_0x3a48b7['attributes'][_0xdfc7('0x36')]?_0x3a48b7[_0xdfc7('0x34')]:_0x4e8bea[_0xdfc7('0x30')];if(_0x320186['query'][_0xdfc7('0x40')]){_0x3a48b7[_0xdfc7('0x41')]=[{'all':!![]}];}_0x3a48b7=_['merge']({},_0x3a48b7,_0x320186[_0xdfc7('0x3f')]);return db[_0xdfc7('0x2d')]['find'](_0x3a48b7)[_0xdfc7('0x25')](handleEntityNotFound(_0x5278c3,null))[_0xdfc7('0x25')](respondWithResult(_0x5278c3,null))[_0xdfc7('0x43')](handleError(_0x5278c3,null));};exports[_0xdfc7('0x46')]=function(_0x5370b4,_0x4475bb){return db[_0xdfc7('0x2d')]['create'](_0x5370b4[_0xdfc7('0x47')],{})['then'](respondWithResult(_0x4475bb,0xc9))[_0xdfc7('0x43')](handleError(_0x4475bb,null));};exports['update']=function(_0x44a00d,_0x4225f0){if(_0x44a00d[_0xdfc7('0x47')]['id']){delete _0x44a00d[_0xdfc7('0x47')]['id'];}return db[_0xdfc7('0x2d')][_0xdfc7('0x48')]({'where':{'id':_0x44a00d[_0xdfc7('0x45')]['id']}})[_0xdfc7('0x25')](handleEntityNotFound(_0x4225f0,null))[_0xdfc7('0x25')](saveUpdates(_0x44a00d[_0xdfc7('0x47')],null))[_0xdfc7('0x25')](respondWithResult(_0x4225f0,null))[_0xdfc7('0x43')](handleError(_0x4225f0,null));};exports['destroy']=function(_0x2c5dbc,_0x338e73){return db['FaxTransferReport']['find']({'where':{'id':_0x2c5dbc[_0xdfc7('0x45')]['id']}})[_0xdfc7('0x25')](handleEntityNotFound(_0x338e73,null))['then'](removeEntity(_0x338e73,null))['catch'](handleError(_0x338e73,null));};exports[_0xdfc7('0x49')]=function(_0x3552d0,_0x48a44d){return db[_0xdfc7('0x2d')]['describe']()[_0xdfc7('0x25')](respondWithResult(_0x48a44d,null))[_0xdfc7('0x43')](handleError(_0x48a44d,null));}; \ No newline at end of file +var _0xafde=['filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','merge','type','filter','options','FaxTransferReport','includeAll','include','rows','catch','show','params','keys','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','end','error','stack','name','send','rawAttributes','fieldName','key','model','map','query'];(function(_0x31efe7,_0x52fe9e){var _0x24b6ee=function(_0x65ae94){while(--_0x65ae94){_0x31efe7['push'](_0x31efe7['shift']());}};_0x24b6ee(++_0x52fe9e);}(_0xafde,0x131));var _0xeafd=function(_0x25f8bd,_0x107947){_0x25f8bd=_0x25f8bd-0x0;var _0x4e0220=_0xafde[_0x25f8bd];return _0x4e0220;};'use strict';var emlformat=require(_0xeafd('0x0'));var rimraf=require(_0xeafd('0x1'));var zipdir=require(_0xeafd('0x2'));var jsonpatch=require(_0xeafd('0x3'));var rp=require(_0xeafd('0x4'));var moment=require(_0xeafd('0x5'));var BPromise=require(_0xeafd('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xeafd('0x7'));var sox=require('sox');var csv=require(_0xeafd('0x8'));var ejs=require(_0xeafd('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xeafd('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xeafd('0xb'));var toCsv=require(_0xeafd('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xeafd('0xc'));var authService=require(_0xeafd('0xd'));var qs=require(_0xeafd('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xeafd('0xf'));var logger=require('../../config/logger')(_0xeafd('0x10'));var utils=require(_0xeafd('0x11'));var config=require(_0xeafd('0x12'));var licenseUtil=require(_0xeafd('0x13'));var db=require(_0xeafd('0x14'))['db'];function respondWithStatusCode(_0x4d257e,_0x10a313){_0x10a313=_0x10a313||0xcc;return function(_0x325ff3){if(_0x325ff3){return _0x4d257e['sendStatus'](_0x10a313);}return _0x4d257e[_0xeafd('0x15')](_0x10a313)['end']();};}function respondWithResult(_0x1ad32f,_0x52f382){_0x52f382=_0x52f382||0xc8;return function(_0x113604){if(_0x113604){return _0x1ad32f['status'](_0x52f382)[_0xeafd('0x16')](_0x113604);}};}function respondWithFilteredResult(_0x29b282,_0x5e43b7){return function(_0x2db205){if(_0x2db205){var _0x2628d7=typeof _0x5e43b7['offset']==='undefined'&&typeof _0x5e43b7[_0xeafd('0x17')]===_0xeafd('0x18');var _0x2032e8=_0x2db205[_0xeafd('0x19')];var _0x9deb98=_0x2628d7?0x0:_0x5e43b7[_0xeafd('0x1a')];var _0x331ba5=_0x2628d7?_0x2db205[_0xeafd('0x19')]:_0x5e43b7[_0xeafd('0x1a')]+_0x5e43b7['limit'];var _0x808030;if(_0x331ba5>=_0x2032e8){_0x331ba5=_0x2032e8;_0x808030=0xc8;}else{_0x808030=0xce;}_0x29b282[_0xeafd('0x15')](_0x808030);return _0x29b282[_0xeafd('0x1b')](_0xeafd('0x1c'),_0x9deb98+'-'+_0x331ba5+'/'+_0x2032e8)['json'](_0x2db205);}return null;};}function patchUpdates(_0x1a27dc){return function(_0x5dc08b){try{jsonpatch[_0xeafd('0x1d')](_0x5dc08b,_0x1a27dc,!![]);}catch(_0xd6935d){return BPromise[_0xeafd('0x1e')](_0xd6935d);}return _0x5dc08b[_0xeafd('0x1f')]();};}function saveUpdates(_0x24feaa,_0x3c8af8){return function(_0x177fc7){if(_0x177fc7){return _0x177fc7[_0xeafd('0x20')](_0x24feaa)[_0xeafd('0x21')](function(_0x347560){return _0x347560;});}return null;};}function removeEntity(_0x4a4a92,_0x316386){return function(_0x52a715){if(_0x52a715){return _0x52a715['destroy']()[_0xeafd('0x21')](function(){_0x4a4a92[_0xeafd('0x15')](0xcc)[_0xeafd('0x22')]();});}};}function handleEntityNotFound(_0x544753,_0x2b11fe){return function(_0x662fc5){if(!_0x662fc5){_0x544753['sendStatus'](0x194);}return _0x662fc5;};}function handleError(_0x4f4dd8,_0x16417e){_0x16417e=_0x16417e||0x1f4;return function(_0x57b789){logger[_0xeafd('0x23')](_0x57b789[_0xeafd('0x24')]);if(_0x57b789['name']){delete _0x57b789[_0xeafd('0x25')];}_0x4f4dd8['status'](_0x16417e)[_0xeafd('0x26')](_0x57b789);};}exports['index']=function(_0xadf4fa,_0x5e2bb2){var _0x1f46ec={},_0xbec865={},_0x10c822={'count':0x0,'rows':[]};var _0x5e7c8=_['map'](db['FaxTransferReport'][_0xeafd('0x27')],function(_0x1b81e3){return{'name':_0x1b81e3[_0xeafd('0x28')],'type':_0x1b81e3['type'][_0xeafd('0x29')]};});_0xbec865[_0xeafd('0x2a')]=_[_0xeafd('0x2b')](_0x5e7c8,_0xeafd('0x25'));_0xbec865[_0xeafd('0x2c')]=_['keys'](_0xadf4fa[_0xeafd('0x2c')]);_0xbec865[_0xeafd('0x2d')]=_[_0xeafd('0x2e')](_0xbec865[_0xeafd('0x2a')],_0xbec865['query']);_0x1f46ec[_0xeafd('0x2f')]=_[_0xeafd('0x2e')](_0xbec865[_0xeafd('0x2a')],qs[_0xeafd('0x30')](_0xadf4fa[_0xeafd('0x2c')][_0xeafd('0x30')]));_0x1f46ec['attributes']=_0x1f46ec['attributes'][_0xeafd('0x31')]?_0x1f46ec[_0xeafd('0x2f')]:_0xbec865[_0xeafd('0x2a')];if(!_0xadf4fa[_0xeafd('0x2c')][_0xeafd('0x32')]('nolimit')){_0x1f46ec[_0xeafd('0x17')]=qs['limit'](_0xadf4fa[_0xeafd('0x2c')][_0xeafd('0x17')]);_0x1f46ec[_0xeafd('0x1a')]=qs['offset'](_0xadf4fa['query']['offset']);}_0x1f46ec[_0xeafd('0x33')]=qs['sort'](_0xadf4fa[_0xeafd('0x2c')][_0xeafd('0x34')]);_0x1f46ec[_0xeafd('0x35')]=qs['filters'](_['pick'](_0xadf4fa[_0xeafd('0x2c')],_0xbec865[_0xeafd('0x2d')]),_0x5e7c8);if(_0xadf4fa[_0xeafd('0x2c')]['filter']){_0x1f46ec[_0xeafd('0x35')]=_[_0xeafd('0x36')](_0x1f46ec[_0xeafd('0x35')],{'$or':_[_0xeafd('0x2b')](_0x5e7c8,function(_0x2d1a8e){if(_0x2d1a8e[_0xeafd('0x37')]!=='VIRTUAL'){var _0x4b418b={};_0x4b418b[_0x2d1a8e[_0xeafd('0x25')]]={'$like':'%'+_0xadf4fa[_0xeafd('0x2c')][_0xeafd('0x38')]+'%'};return _0x4b418b;}})});}_0x1f46ec=_['merge']({},_0x1f46ec,_0xadf4fa[_0xeafd('0x39')]);var _0x5231fe={'where':_0x1f46ec['where']};return db[_0xeafd('0x3a')][_0xeafd('0x19')](_0x5231fe)[_0xeafd('0x21')](function(_0x1152ca){_0x10c822[_0xeafd('0x19')]=_0x1152ca;if(_0xadf4fa['query'][_0xeafd('0x3b')]){_0x1f46ec[_0xeafd('0x3c')]=[{'all':!![]}];}return db['FaxTransferReport']['findAll'](_0x1f46ec);})[_0xeafd('0x21')](function(_0x1765eb){_0x10c822[_0xeafd('0x3d')]=_0x1765eb;return _0x10c822;})[_0xeafd('0x21')](respondWithFilteredResult(_0x5e2bb2,_0x1f46ec))[_0xeafd('0x3e')](handleError(_0x5e2bb2,null));};exports[_0xeafd('0x3f')]=function(_0x54daed,_0x460879){var _0x5a61f0={'raw':!![],'where':{'id':_0x54daed[_0xeafd('0x40')]['id']}},_0x544fb4={};_0x544fb4['model']=_[_0xeafd('0x41')](db[_0xeafd('0x3a')][_0xeafd('0x27')]);_0x544fb4['query']=_['keys'](_0x54daed[_0xeafd('0x2c')]);_0x544fb4[_0xeafd('0x2d')]=_[_0xeafd('0x2e')](_0x544fb4[_0xeafd('0x2a')],_0x544fb4[_0xeafd('0x2c')]);_0x5a61f0['attributes']=_[_0xeafd('0x2e')](_0x544fb4[_0xeafd('0x2a')],qs[_0xeafd('0x30')](_0x54daed[_0xeafd('0x2c')][_0xeafd('0x30')]));_0x5a61f0[_0xeafd('0x2f')]=_0x5a61f0[_0xeafd('0x2f')][_0xeafd('0x31')]?_0x5a61f0[_0xeafd('0x2f')]:_0x544fb4[_0xeafd('0x2a')];if(_0x54daed[_0xeafd('0x2c')][_0xeafd('0x3b')]){_0x5a61f0[_0xeafd('0x3c')]=[{'all':!![]}];}_0x5a61f0=_['merge']({},_0x5a61f0,_0x54daed[_0xeafd('0x39')]);return db[_0xeafd('0x3a')][_0xeafd('0x42')](_0x5a61f0)[_0xeafd('0x21')](handleEntityNotFound(_0x460879,null))[_0xeafd('0x21')](respondWithResult(_0x460879,null))[_0xeafd('0x3e')](handleError(_0x460879,null));};exports[_0xeafd('0x43')]=function(_0x10db5b,_0x5a12e0){return db['FaxTransferReport']['create'](_0x10db5b[_0xeafd('0x44')],{})[_0xeafd('0x21')](respondWithResult(_0x5a12e0,0xc9))[_0xeafd('0x3e')](handleError(_0x5a12e0,null));};exports[_0xeafd('0x20')]=function(_0x4cf830,_0x47feb2){if(_0x4cf830[_0xeafd('0x44')]['id']){delete _0x4cf830['body']['id'];}return db[_0xeafd('0x3a')][_0xeafd('0x42')]({'where':{'id':_0x4cf830[_0xeafd('0x40')]['id']}})[_0xeafd('0x21')](handleEntityNotFound(_0x47feb2,null))['then'](saveUpdates(_0x4cf830['body'],null))[_0xeafd('0x21')](respondWithResult(_0x47feb2,null))[_0xeafd('0x3e')](handleError(_0x47feb2,null));};exports['destroy']=function(_0x462cce,_0x1e64cd){return db[_0xeafd('0x3a')][_0xeafd('0x42')]({'where':{'id':_0x462cce[_0xeafd('0x40')]['id']}})[_0xeafd('0x21')](handleEntityNotFound(_0x1e64cd,null))['then'](removeEntity(_0x1e64cd,null))[_0xeafd('0x3e')](handleError(_0x1e64cd,null));};exports[_0xeafd('0x45')]=function(_0x3f72a3,_0x1cead4){return db[_0xeafd('0x3a')][_0xeafd('0x45')]()[_0xeafd('0x21')](respondWithResult(_0x1cead4,null))[_0xeafd('0x3e')](handleError(_0x1cead4,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 94befd3..e176c9f 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 _0xe0d7=['../../config/environment','./faxTransferReport.attributes','exports','define','FaxTransferReport','report_fax_transfer','lodash','api','moment','bluebird','path','rimraf'];(function(_0x29c35e,_0x5e1e6f){var _0x4a3afc=function(_0x4dd910){while(--_0x4dd910){_0x29c35e['push'](_0x29c35e['shift']());}};_0x4a3afc(++_0x5e1e6f);}(_0xe0d7,0xba));var _0x7e0d=function(_0x13cd71,_0x3df055){_0x13cd71=_0x13cd71-0x0;var _0x5b396d=_0xe0d7[_0x13cd71];return _0x5b396d;};'use strict';var _=require(_0x7e0d('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x7e0d('0x1'));var moment=require(_0x7e0d('0x2'));var BPromise=require(_0x7e0d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7e0d('0x4'));var rimraf=require(_0x7e0d('0x5'));var config=require(_0x7e0d('0x6'));var attributes=require(_0x7e0d('0x7'));module[_0x7e0d('0x8')]=function(_0x432874,_0xe58927){return _0x432874[_0x7e0d('0x9')](_0x7e0d('0xa'),attributes,{'tableName':_0x7e0d('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x9e6b=['path','rimraf','../../config/environment','exports','FaxTransferReport','lodash','util','api','request-promise'];(function(_0x30cb33,_0x47cf5d){var _0x563ee0=function(_0x41ee50){while(--_0x41ee50){_0x30cb33['push'](_0x30cb33['shift']());}};_0x563ee0(++_0x47cf5d);}(_0x9e6b,0x11c));var _0xb9e6=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x9e6b[_0x46698a];return _0x356db0;};'use strict';var _=require(_0xb9e6('0x0'));var util=require(_0xb9e6('0x1'));var logger=require('../../config/logger')(_0xb9e6('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb9e6('0x3'));var fs=require('fs');var path=require(_0xb9e6('0x4'));var rimraf=require(_0xb9e6('0x5'));var config=require(_0xb9e6('0x6'));var attributes=require('./faxTransferReport.attributes');module[_0xb9e6('0x7')]=function(_0x1a6a4f,_0x1b9eed){return _0x1a6a4f['define'](_0xb9e6('0x8'),attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 547d80c..bb17015 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 _0x19cc=['bluebird','ioredis','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','util','moment'];(function(_0x2ac22d,_0x5b35ca){var _0x3cde9d=function(_0x584247){while(--_0x584247){_0x2ac22d['push'](_0x2ac22d['shift']());}};_0x3cde9d(++_0x5b35ca);}(_0x19cc,0x108));var _0xc19c=function(_0x15ca1a,_0x30fc82){_0x15ca1a=_0x15ca1a-0x0;var _0x507626=_0x19cc[_0x15ca1a];return _0x507626;};'use strict';var _=require('lodash');var util=require(_0xc19c('0x0'));var moment=require(_0xc19c('0x1'));var BPromise=require(_0xc19c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc19c('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc19c('0x4'))('rpc');var config=require(_0xc19c('0x5'));var jayson=require(_0xc19c('0x6'));var client=jayson['client'][_0xc19c('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xbed071,_0x40dfea,_0x4583da){return new BPromise(function(_0x2316ae,_0x37d4e8){return client[_0xc19c('0x8')](_0xbed071,_0x4583da)[_0xc19c('0x9')](function(_0x2b263d){logger[_0xc19c('0xa')](_0xc19c('0xb'),_0x40dfea,_0xc19c('0xc'));logger[_0xc19c('0xd')]('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x40dfea,'request\x20sent',JSON[_0xc19c('0xe')](_0x2b263d));if(_0x2b263d[_0xc19c('0xf')]){if(_0x2b263d[_0xc19c('0xf')][_0xc19c('0x10')]===0x1f4){logger[_0xc19c('0xf')](_0xc19c('0xb'),_0x40dfea,_0x2b263d[_0xc19c('0xf')]['message']);return _0x37d4e8(_0x2b263d[_0xc19c('0xf')]['message']);}logger['error'](_0xc19c('0xb'),_0x40dfea,_0x2b263d[_0xc19c('0xf')][_0xc19c('0x11')]);return _0x2316ae(_0x2b263d[_0xc19c('0xf')][_0xc19c('0x11')]);}else{logger[_0xc19c('0xa')](_0xc19c('0xb'),_0x40dfea,_0xc19c('0xc'));_0x2316ae(_0x2b263d['result'][_0xc19c('0x11')]);}})[_0xc19c('0x12')](function(_0x9626){logger[_0xc19c('0xf')](_0xc19c('0xb'),_0x40dfea,_0x9626);_0x37d4e8(_0x9626);});});} \ No newline at end of file +var _0x9f31=['randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','util','moment','bluebird'];(function(_0x7269a7,_0x18262e){var _0x4d9349=function(_0x5e9d66){while(--_0x5e9d66){_0x7269a7['push'](_0x7269a7['shift']());}};_0x4d9349(++_0x18262e);}(_0x9f31,0xe1));var _0x19f3=function(_0x15fc3c,_0x35665b){_0x15fc3c=_0x15fc3c-0x0;var _0x94c5c8=_0x9f31[_0x15fc3c];return _0x94c5c8;};'use strict';var _=require('lodash');var util=require(_0x19f3('0x0'));var moment=require(_0x19f3('0x1'));var BPromise=require(_0x19f3('0x2'));var rs=require(_0x19f3('0x3'));var fs=require('fs');var Redis=require(_0x19f3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x19f3('0x5'));var logger=require('../../config/logger')(_0x19f3('0x6'));var config=require(_0x19f3('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x19f3('0x8')][_0x19f3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x317791,_0x564f73,_0x48adb1){return new BPromise(function(_0x71926a,_0x48ed1d){return client[_0x19f3('0xa')](_0x317791,_0x48adb1)['then'](function(_0x207405){logger[_0x19f3('0xb')](_0x19f3('0xc'),_0x564f73,_0x19f3('0xd'));logger[_0x19f3('0xe')]('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x564f73,'request\x20sent',JSON[_0x19f3('0xf')](_0x207405));if(_0x207405[_0x19f3('0x10')]){if(_0x207405[_0x19f3('0x10')]['code']===0x1f4){logger['error'](_0x19f3('0xc'),_0x564f73,_0x207405[_0x19f3('0x10')][_0x19f3('0x11')]);return _0x48ed1d(_0x207405[_0x19f3('0x10')][_0x19f3('0x11')]);}logger[_0x19f3('0x10')](_0x19f3('0xc'),_0x564f73,_0x207405[_0x19f3('0x10')][_0x19f3('0x11')]);return _0x71926a(_0x207405['error'][_0x19f3('0x11')]);}else{logger[_0x19f3('0xb')](_0x19f3('0xc'),_0x564f73,_0x19f3('0xd'));_0x71926a(_0x207405['result']['message']);}})[_0x19f3('0x12')](function(_0x15138d){logger[_0x19f3('0x10')]('FaxTransferReport,\x20%s,\x20%s',_0x564f73,_0x15138d);_0x48ed1d(_0x15138d);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 02481be..3efac3e 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 _0x19d4=['get','isAuthenticated','index','/describe','describe','/:id','post','put','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller'];(function(_0x2eddb9,_0x41e214){var _0x541be9=function(_0x34ace7){while(--_0x34ace7){_0x2eddb9['push'](_0x2eddb9['shift']());}};_0x541be9(++_0x41e214);}(_0x19d4,0xc8));var _0x419d=function(_0x24b102,_0x219284){_0x24b102=_0x24b102-0x0;var _0x5e8c20=_0x19d4[_0x24b102];return _0x5e8c20;};'use strict';var multer=require(_0x419d('0x0'));var util=require(_0x419d('0x1'));var path=require(_0x419d('0x2'));var timeout=require(_0x419d('0x3'));var express=require('express');var router=express[_0x419d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x419d('0x5'));var interaction=require(_0x419d('0x6'));var config=require(_0x419d('0x7'));var controller=require(_0x419d('0x8'));router[_0x419d('0x9')]('/',auth[_0x419d('0xa')](),controller[_0x419d('0xb')]);router[_0x419d('0x9')](_0x419d('0xc'),auth[_0x419d('0xa')](),controller[_0x419d('0xd')]);router[_0x419d('0x9')](_0x419d('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x419d('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x419d('0x10')](_0x419d('0xe'),auth[_0x419d('0xa')](),controller['update']);router[_0x419d('0x11')](_0x419d('0xe'),auth[_0x419d('0xa')](),controller['destroy']);module[_0x419d('0x12')]=router; \ No newline at end of file +var _0x4454=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update','delete','destroy','exports','multer','util','path'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x4454,0x17d));var _0x4445=function(_0x38fcb9,_0x2935d6){_0x38fcb9=_0x38fcb9-0x0;var _0x41daa8=_0x4454[_0x38fcb9];return _0x41daa8;};'use strict';var multer=require(_0x4445('0x0'));var util=require(_0x4445('0x1'));var path=require(_0x4445('0x2'));var timeout=require(_0x4445('0x3'));var express=require(_0x4445('0x4'));var router=express[_0x4445('0x5')]();var fs_extra=require(_0x4445('0x6'));var auth=require(_0x4445('0x7'));var interaction=require(_0x4445('0x8'));var config=require(_0x4445('0x9'));var controller=require(_0x4445('0xa'));router[_0x4445('0xb')]('/',auth[_0x4445('0xc')](),controller[_0x4445('0xd')]);router['get'](_0x4445('0xe'),auth[_0x4445('0xc')](),controller[_0x4445('0xf')]);router['get'](_0x4445('0x10'),auth[_0x4445('0xc')](),controller[_0x4445('0x11')]);router[_0x4445('0x12')]('/',auth[_0x4445('0xc')](),controller['create']);router[_0x4445('0x13')](_0x4445('0x10'),auth['isAuthenticated'](),controller[_0x4445('0x14')]);router[_0x4445('0x15')](_0x4445('0x10'),auth[_0x4445('0xc')](),controller[_0x4445('0x16')]);module[_0x4445('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 6006ddb..30fb61d 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 _0xa0db=['../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x5a6928,_0x333ee5){var _0x35549a=function(_0x27f28c){while(--_0x27f28c){_0x5a6928['push'](_0x5a6928['shift']());}};_0x35549a(++_0x333ee5);}(_0xa0db,0x1f3));var _0xba0d=function(_0x15592c,_0x3db0cb){_0x15592c=_0x15592c-0x0;var _0x25f537=_0xa0db[_0x15592c];return _0x25f537;};'use strict';var multer=require(_0xba0d('0x0'));var util=require(_0xba0d('0x1'));var path=require(_0xba0d('0x2'));var timeout=require(_0xba0d('0x3'));var express=require('express');var router=express[_0xba0d('0x4')]();var fs_extra=require(_0xba0d('0x5'));var auth=require(_0xba0d('0x6'));var interaction=require(_0xba0d('0x7'));var config=require(_0xba0d('0x8'));var controller=require(_0xba0d('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xba0d('0xa')](_0xba0d('0xb'),auth[_0xba0d('0xc')](),controller[_0xba0d('0xd')]);router[_0xba0d('0xa')](_0xba0d('0xe'),auth[_0xba0d('0xc')](),controller[_0xba0d('0xf')]);router[_0xba0d('0xa')](_0xba0d('0x10'),auth[_0xba0d('0xc')](),controller[_0xba0d('0x11')]);router[_0xba0d('0x12')]('/',auth['isAuthenticated'](),controller[_0xba0d('0x13')]);router[_0xba0d('0x12')](_0xba0d('0xe'),auth[_0xba0d('0xc')](),controller[_0xba0d('0x14')]);router['put'](_0xba0d('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xba0d('0x15')](_0xba0d('0xb'),auth[_0xba0d('0xc')](),controller['destroy']);module[_0xba0d('0x16')]=router; \ No newline at end of file +var _0x27ff=['delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','create','put','update'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x27ff,0x179));var _0xf27f=function(_0xe8e91,_0x401ca3){_0xe8e91=_0xe8e91-0x0;var _0x1258fe=_0x27ff[_0xe8e91];return _0x1258fe;};'use strict';var multer=require(_0xf27f('0x0'));var util=require(_0xf27f('0x1'));var path=require(_0xf27f('0x2'));var timeout=require(_0xf27f('0x3'));var express=require(_0xf27f('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xf27f('0x5'));var config=require(_0xf27f('0x6'));var controller=require('./intDeskAccount.controller');router[_0xf27f('0x7')]('/',auth[_0xf27f('0x8')](),controller[_0xf27f('0x9')]);router['get'](_0xf27f('0xa'),auth[_0xf27f('0x8')](),controller[_0xf27f('0xb')]);router[_0xf27f('0x7')](_0xf27f('0xc'),auth[_0xf27f('0x8')](),controller[_0xf27f('0xd')]);router[_0xf27f('0x7')](_0xf27f('0xe'),auth[_0xf27f('0x8')](),controller['getFields']);router[_0xf27f('0xf')]('/',auth['isAuthenticated'](),controller[_0xf27f('0x10')]);router[_0xf27f('0xf')](_0xf27f('0xc'),auth[_0xf27f('0x8')](),controller['addConfiguration']);router[_0xf27f('0x11')](_0xf27f('0xa'),auth[_0xf27f('0x8')](),controller[_0xf27f('0x12')]);router[_0xf27f('0x13')](_0xf27f('0xa'),auth['isAuthenticated'](),controller[_0xf27f('0x14')]);module[_0xf27f('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 fe8a576..dfb1922 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 _0xb946=['ENUM','integrationTab','newTab','exports','STRING','basic'];(function(_0x5b70f0,_0x189655){var _0x49a246=function(_0x25cd5c){while(--_0x25cd5c){_0x5b70f0['push'](_0x5b70f0['shift']());}};_0x49a246(++_0x189655);}(_0xb946,0x1d7));var _0x6b94=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0xb946[_0x4e9628];return _0x27bc8c;};'use strict';var Sequelize=require('sequelize');module[_0x6b94('0x0')]={'name':{'type':Sequelize[_0x6b94('0x1')]},'description':{'type':Sequelize[_0x6b94('0x1')]},'username':{'type':Sequelize[_0x6b94('0x1')]},'remoteUri':{'type':Sequelize[_0x6b94('0x1')]},'authType':{'type':Sequelize['ENUM'](_0x6b94('0x2')),'defaultValue':'basic'},'password':{'type':Sequelize[_0x6b94('0x1')]},'consumerKey':{'type':Sequelize[_0x6b94('0x1')]},'consumerSecret':{'type':Sequelize[_0x6b94('0x1')]},'token':{'type':Sequelize[_0x6b94('0x1')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x6b94('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x6b94('0x3')](_0x6b94('0x4'),_0x6b94('0x5')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x0036=['STRING','ENUM','basic','integrationTab','exports'];(function(_0x498429,_0x5ed5e7){var _0x56b576=function(_0x4e91f7){while(--_0x4e91f7){_0x498429['push'](_0x498429['shift']());}};_0x56b576(++_0x5ed5e7);}(_0x0036,0xf9));var _0x6003=function(_0x4543e3,_0x2171ec){_0x4543e3=_0x4543e3-0x0;var _0x4da2ba=_0x0036[_0x4543e3];return _0x4da2ba;};'use strict';var Sequelize=require('sequelize');module[_0x6003('0x0')]={'name':{'type':Sequelize[_0x6003('0x1')]},'description':{'type':Sequelize[_0x6003('0x1')]},'username':{'type':Sequelize[_0x6003('0x1')]},'remoteUri':{'type':Sequelize[_0x6003('0x1')]},'authType':{'type':Sequelize[_0x6003('0x2')](_0x6003('0x3')),'defaultValue':_0x6003('0x3')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0x6003('0x1')]},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x6003('0x1')]},'tokenSecret':{'type':Sequelize[_0x6003('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x6003('0x2')](_0x6003('0x4'),'newTab'),'defaultValue':_0x6003('0x4')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 7cd9a63..9644617 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 _0x79cd=['desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','limit','undefined','set','Content-Range','reject','save','update','then','sendStatus','error','name','send','DeskAccount','fieldName','type','model','map','query','filters','intersection','fields','length','attributes','order','sort','where','pick','merge','VIRTUAL','filter','count','includeAll','findAll','rows','catch','show','params','rawAttributes','keys','include','options','find','create','body','destroy','getConfigurations','findOne','DeskConfiguration','hasOwnProperty','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskField','getFields','priority','remoteUri','username','consumerSecret','tokenSecret','slice','substring','format','%s/custom_fields','authType','headers','Authorization','Basic\x20%s','%s:%s','password','toString','base64','concat','entries','active','test','statusCode','stringify','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x79cd,0xd8));var _0xd79c=function(_0x36568f,_0x2a2b3a){_0x36568f=_0x36568f-0x0;var _0x426aa1=_0x79cd[_0x36568f];return _0x426aa1;};'use strict';var emlformat=require(_0xd79c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd79c('0x1'));var jsonpatch=require(_0xd79c('0x2'));var rp=require(_0xd79c('0x3'));var moment=require(_0xd79c('0x4'));var BPromise=require(_0xd79c('0x5'));var Mustache=require(_0xd79c('0x6'));var util=require(_0xd79c('0x7'));var path=require(_0xd79c('0x8'));var sox=require(_0xd79c('0x9'));var csv=require(_0xd79c('0xa'));var ejs=require(_0xd79c('0xb'));var fs=require('fs');var fs_extra=require(_0xd79c('0xc'));var _=require(_0xd79c('0xd'));var squel=require('squel');var crypto=require(_0xd79c('0xe'));var jsforce=require(_0xd79c('0xf'));var deskjs=require(_0xd79c('0x10'));var toCsv=require(_0xd79c('0xa'));var querystring=require(_0xd79c('0x11'));var Papa=require('papaparse');var Redis=require(_0xd79c('0x12'));var authService=require(_0xd79c('0x13'));var qs=require(_0xd79c('0x14'));var as=require(_0xd79c('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd79c('0x16'))(_0xd79c('0x17'));var utils=require(_0xd79c('0x18'));var config=require(_0xd79c('0x19'));var licenseUtil=require(_0xd79c('0x1a'));var db=require(_0xd79c('0x1b'))['db'];var integrations=require(_0xd79c('0x1c'));function respondWithStatusCode(_0x5224d9,_0x22fa2f){_0x22fa2f=_0x22fa2f||0xcc;return function(_0x242d8e){if(_0x242d8e){return _0x5224d9['sendStatus'](_0x22fa2f);}return _0x5224d9[_0xd79c('0x1d')](_0x22fa2f)[_0xd79c('0x1e')]();};}function respondWithResult(_0xb23124,_0x1637dd){_0x1637dd=_0x1637dd||0xc8;return function(_0x212b4c){if(_0x212b4c){return _0xb23124[_0xd79c('0x1d')](_0x1637dd)[_0xd79c('0x1f')](_0x212b4c);}};}function respondWithFilteredResult(_0x2ef7e9,_0x45d572){return function(_0x2a0025){if(_0x2a0025){var _0x6485d7=typeof _0x45d572[_0xd79c('0x20')]==='undefined'&&typeof _0x45d572[_0xd79c('0x21')]===_0xd79c('0x22');var _0x3f4ce7=_0x2a0025['count'];var _0x5ae92a=_0x6485d7?0x0:_0x45d572[_0xd79c('0x20')];var _0x36444f=_0x6485d7?_0x2a0025['count']:_0x45d572[_0xd79c('0x20')]+_0x45d572[_0xd79c('0x21')];var _0x58e664;if(_0x36444f>=_0x3f4ce7){_0x36444f=_0x3f4ce7;_0x58e664=0xc8;}else{_0x58e664=0xce;}_0x2ef7e9[_0xd79c('0x1d')](_0x58e664);return _0x2ef7e9[_0xd79c('0x23')](_0xd79c('0x24'),_0x5ae92a+'-'+_0x36444f+'/'+_0x3f4ce7)[_0xd79c('0x1f')](_0x2a0025);}return null;};}function patchUpdates(_0x4cfb0c){return function(_0x5bed39){try{jsonpatch['apply'](_0x5bed39,_0x4cfb0c,!![]);}catch(_0x2b0054){return BPromise[_0xd79c('0x25')](_0x2b0054);}return _0x5bed39[_0xd79c('0x26')]();};}function saveUpdates(_0x3693be,_0x5e0c01){return function(_0x1495c7){if(_0x1495c7){return _0x1495c7[_0xd79c('0x27')](_0x3693be)[_0xd79c('0x28')](function(_0x2dd356){return _0x2dd356;});}return null;};}function removeEntity(_0x1085cc,_0x55de60){return function(_0x410485){if(_0x410485){return _0x410485['destroy']()[_0xd79c('0x28')](function(){_0x1085cc[_0xd79c('0x1d')](0xcc)[_0xd79c('0x1e')]();});}};}function handleEntityNotFound(_0x1c0e50,_0x3951ae){return function(_0x22515f){if(!_0x22515f){_0x1c0e50[_0xd79c('0x29')](0x194);}return _0x22515f;};}function handleError(_0x2c09b8,_0x3bb123){_0x3bb123=_0x3bb123||0x1f4;return function(_0x2975cf){logger[_0xd79c('0x2a')](_0x2975cf['stack']);if(_0x2975cf['name']){delete _0x2975cf[_0xd79c('0x2b')];}_0x2c09b8['status'](_0x3bb123)[_0xd79c('0x2c')](_0x2975cf);};}exports['index']=function(_0x2e1767,_0x3d97dd){var _0xdd8c79={},_0x7ba6b={},_0x3ba47c={'count':0x0,'rows':[]};var _0x10a7e1=_['map'](db[_0xd79c('0x2d')]['rawAttributes'],function(_0x51d452){return{'name':_0x51d452[_0xd79c('0x2e')],'type':_0x51d452[_0xd79c('0x2f')]['key']};});_0x7ba6b[_0xd79c('0x30')]=_[_0xd79c('0x31')](_0x10a7e1,_0xd79c('0x2b'));_0x7ba6b['query']=_['keys'](_0x2e1767[_0xd79c('0x32')]);_0x7ba6b[_0xd79c('0x33')]=_[_0xd79c('0x34')](_0x7ba6b[_0xd79c('0x30')],_0x7ba6b[_0xd79c('0x32')]);_0xdd8c79['attributes']=_[_0xd79c('0x34')](_0x7ba6b['model'],qs[_0xd79c('0x35')](_0x2e1767['query'][_0xd79c('0x35')]));_0xdd8c79['attributes']=_0xdd8c79['attributes'][_0xd79c('0x36')]?_0xdd8c79[_0xd79c('0x37')]:_0x7ba6b[_0xd79c('0x30')];if(!_0x2e1767[_0xd79c('0x32')]['hasOwnProperty']('nolimit')){_0xdd8c79['limit']=qs[_0xd79c('0x21')](_0x2e1767[_0xd79c('0x32')][_0xd79c('0x21')]);_0xdd8c79[_0xd79c('0x20')]=qs[_0xd79c('0x20')](_0x2e1767[_0xd79c('0x32')][_0xd79c('0x20')]);}_0xdd8c79[_0xd79c('0x38')]=qs[_0xd79c('0x39')](_0x2e1767[_0xd79c('0x32')][_0xd79c('0x39')]);_0xdd8c79[_0xd79c('0x3a')]=qs[_0xd79c('0x33')](_[_0xd79c('0x3b')](_0x2e1767[_0xd79c('0x32')],_0x7ba6b[_0xd79c('0x33')]),_0x10a7e1);if(_0x2e1767['query']['filter']){_0xdd8c79['where']=_[_0xd79c('0x3c')](_0xdd8c79[_0xd79c('0x3a')],{'$or':_['map'](_0x10a7e1,function(_0xad72e5){if(_0xad72e5[_0xd79c('0x2f')]!==_0xd79c('0x3d')){var _0x116c73={};_0x116c73[_0xad72e5['name']]={'$like':'%'+_0x2e1767[_0xd79c('0x32')][_0xd79c('0x3e')]+'%'};return _0x116c73;}})});}_0xdd8c79=_[_0xd79c('0x3c')]({},_0xdd8c79,_0x2e1767['options']);var _0x392a94={'where':_0xdd8c79['where']};return db[_0xd79c('0x2d')][_0xd79c('0x3f')](_0x392a94)[_0xd79c('0x28')](function(_0x13a72d){_0x3ba47c[_0xd79c('0x3f')]=_0x13a72d;if(_0x2e1767[_0xd79c('0x32')][_0xd79c('0x40')]){_0xdd8c79['include']=[{'all':!![]}];}return db[_0xd79c('0x2d')][_0xd79c('0x41')](_0xdd8c79);})[_0xd79c('0x28')](function(_0xdd2aa3){_0x3ba47c[_0xd79c('0x42')]=_0xdd2aa3;return _0x3ba47c;})['then'](respondWithFilteredResult(_0x3d97dd,_0xdd8c79))[_0xd79c('0x43')](handleError(_0x3d97dd,null));};exports[_0xd79c('0x44')]=function(_0x4bff04,_0x1e06e2){var _0x135031={'raw':![],'where':{'id':_0x4bff04[_0xd79c('0x45')]['id']}},_0x4bb84b={};_0x4bb84b[_0xd79c('0x30')]=_['keys'](db['DeskAccount'][_0xd79c('0x46')]);_0x4bb84b[_0xd79c('0x32')]=_[_0xd79c('0x47')](_0x4bff04[_0xd79c('0x32')]);_0x4bb84b[_0xd79c('0x33')]=_['intersection'](_0x4bb84b['model'],_0x4bb84b[_0xd79c('0x32')]);_0x135031[_0xd79c('0x37')]=_[_0xd79c('0x34')](_0x4bb84b['model'],qs['fields'](_0x4bff04['query'][_0xd79c('0x35')]));_0x135031['attributes']=_0x135031[_0xd79c('0x37')][_0xd79c('0x36')]?_0x135031[_0xd79c('0x37')]:_0x4bb84b['model'];if(_0x4bff04[_0xd79c('0x32')][_0xd79c('0x40')]){_0x135031[_0xd79c('0x48')]=[{'all':!![]}];}_0x135031=_[_0xd79c('0x3c')]({},_0x135031,_0x4bff04[_0xd79c('0x49')]);return db[_0xd79c('0x2d')][_0xd79c('0x4a')](_0x135031)['then'](handleEntityNotFound(_0x1e06e2,null))[_0xd79c('0x28')](respondWithResult(_0x1e06e2,null))[_0xd79c('0x43')](handleError(_0x1e06e2,null));};exports[_0xd79c('0x4b')]=function(_0x21f957,_0xe0abc1){return db[_0xd79c('0x2d')]['create'](_0x21f957[_0xd79c('0x4c')],{})['then'](respondWithResult(_0xe0abc1,0xc9))[_0xd79c('0x43')](handleError(_0xe0abc1,null));};exports['update']=function(_0x588e88,_0x199d7f){if(_0x588e88[_0xd79c('0x4c')]['id']){delete _0x588e88[_0xd79c('0x4c')]['id'];}return db[_0xd79c('0x2d')][_0xd79c('0x4a')]({'where':{'id':_0x588e88[_0xd79c('0x45')]['id']}})[_0xd79c('0x28')](handleEntityNotFound(_0x199d7f,null))['then'](saveUpdates(_0x588e88[_0xd79c('0x4c')],null))[_0xd79c('0x28')](respondWithResult(_0x199d7f,null))['catch'](handleError(_0x199d7f,null));};exports[_0xd79c('0x4d')]=function(_0x18d551,_0x33c01a){return db[_0xd79c('0x2d')][_0xd79c('0x4a')]({'where':{'id':_0x18d551[_0xd79c('0x45')]['id']}})[_0xd79c('0x28')](handleEntityNotFound(_0x33c01a,null))[_0xd79c('0x28')](removeEntity(_0x33c01a,null))[_0xd79c('0x43')](handleError(_0x33c01a,null));};exports[_0xd79c('0x4e')]=function(_0x1e7553,_0x234ef7,_0x176482){var _0x580ba1={};var _0x19ba61={};var _0x2b0ad2;var _0x2738bc;return db[_0xd79c('0x2d')][_0xd79c('0x4f')]({'where':{'id':_0x1e7553[_0xd79c('0x45')]['id']}})[_0xd79c('0x28')](handleEntityNotFound(_0x234ef7,null))['then'](function(_0x37b4ed){if(_0x37b4ed){_0x2b0ad2=_0x37b4ed;_0x19ba61['model']=_['keys'](db[_0xd79c('0x50')]['rawAttributes']);_0x19ba61['query']=_['keys'](_0x1e7553[_0xd79c('0x32')]);_0x19ba61[_0xd79c('0x33')]=_[_0xd79c('0x34')](_0x19ba61['model'],_0x19ba61[_0xd79c('0x32')]);_0x580ba1[_0xd79c('0x37')]=_[_0xd79c('0x34')](_0x19ba61[_0xd79c('0x30')],qs[_0xd79c('0x35')](_0x1e7553[_0xd79c('0x32')][_0xd79c('0x35')]));_0x580ba1['attributes']=_0x580ba1[_0xd79c('0x37')][_0xd79c('0x36')]?_0x580ba1[_0xd79c('0x37')]:_0x19ba61['model'];_0x580ba1[_0xd79c('0x38')]=qs[_0xd79c('0x39')](_0x1e7553[_0xd79c('0x32')][_0xd79c('0x39')]);_0x580ba1[_0xd79c('0x3a')]=qs['filters'](_[_0xd79c('0x3b')](_0x1e7553[_0xd79c('0x32')],_0x19ba61['filters']));if(_0x1e7553[_0xd79c('0x32')][_0xd79c('0x3e')]){_0x580ba1[_0xd79c('0x3a')]=_[_0xd79c('0x3c')](_0x580ba1[_0xd79c('0x3a')],{'$or':_['map'](_0x580ba1[_0xd79c('0x37')],function(_0x3d04f9){var _0x16f7b4={};_0x16f7b4[_0x3d04f9]={'$like':'%'+_0x1e7553['query'][_0xd79c('0x3e')]+'%'};return _0x16f7b4;})});}_0x580ba1=_['merge']({},_0x580ba1,_0x1e7553[_0xd79c('0x49')]);return _0x2b0ad2['getConfigurations'](_0x580ba1);}})[_0xd79c('0x28')](function(_0x2f66){if(_0x2f66){_0x2738bc=_0x2f66[_0xd79c('0x36')];if(!_0x1e7553['query'][_0xd79c('0x51')](_0xd79c('0x52'))){_0x580ba1[_0xd79c('0x21')]=qs['limit'](_0x1e7553['query']['limit']);_0x580ba1[_0xd79c('0x20')]=qs[_0xd79c('0x20')](_0x1e7553['query'][_0xd79c('0x20')]);}return _0x2b0ad2[_0xd79c('0x4e')](_0x580ba1);}})[_0xd79c('0x28')](function(_0x1b7eb3){if(_0x1b7eb3){return _0x1b7eb3?{'count':_0x2738bc,'rows':_0x1b7eb3}:null;}})[_0xd79c('0x28')](respondWithResult(_0x234ef7,null))['catch'](handleError(_0x234ef7,null));};exports[_0xd79c('0x53')]=function(_0xc289f8,_0x20e671,_0x14137b){if(_0xc289f8[_0xd79c('0x4c')]['id']){delete _0xc289f8[_0xd79c('0x4c')]['id'];}return db[_0xd79c('0x2d')][_0xd79c('0x4f')]({'where':{'id':_0xc289f8[_0xd79c('0x45')]['id']}})[_0xd79c('0x28')](handleEntityNotFound(_0x20e671,null))[_0xd79c('0x28')](function(_0x2789a6){if(_0x2789a6){_0xc289f8[_0xd79c('0x4c')][_0xd79c('0x54')]=_0x2789a6['id'];_0xc289f8[_0xd79c('0x4c')][_0xd79c('0x55')]=integrations[_0xd79c('0x56')](_0xc289f8['body'][_0xd79c('0x57')],_0xc289f8[_0xd79c('0x4c')]['type']);_0xc289f8[_0xd79c('0x4c')][_0xd79c('0x58')]=integrations[_0xd79c('0x59')](_0xc289f8[_0xd79c('0x4c')][_0xd79c('0x57')],_0xc289f8[_0xd79c('0x4c')][_0xd79c('0x2f')]);return db['DeskConfiguration'][_0xd79c('0x4b')](_0xc289f8[_0xd79c('0x4c')],{'include':[{'model':db[_0xd79c('0x5a')],'as':_0xd79c('0x55')},{'model':db[_0xd79c('0x5a')],'as':'Descriptions'}]});}return null;})[_0xd79c('0x28')](respondWithResult(_0x20e671,null))['catch'](handleError(_0x20e671,null));};exports[_0xd79c('0x5b')]=function(_0x5ecb95,_0x15844b,_0x9ab29a){var _0x3b235c=[{'name':'priority','label':_0xd79c('0x5c'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x2676f2='';return db[_0xd79c('0x2d')][_0xd79c('0x4f')]({'where':{'id':_0x5ecb95[_0xd79c('0x45')]['id']},'attributes':['id',_0xd79c('0x5d'),'authType',_0xd79c('0x5e'),'password','consumerKey',_0xd79c('0x5f'),'token',_0xd79c('0x60')]})['then'](handleEntityNotFound(_0x15844b,null))[_0xd79c('0x28')](function(_0x507408){if(_0x507408){_0x2676f2=_0x507408[_0xd79c('0x5d')];var _0x5963c3=_0x2676f2[_0xd79c('0x61')](-0x1);if(_0x5963c3==='/'){_0x2676f2=_0x2676f2[_0xd79c('0x62')](0x0,_0x2676f2['lastIndexOf'](_0x5963c3));}var _0x270f44={'method':'GET','uri':util[_0xd79c('0x63')](_0xd79c('0x64'),_0x2676f2),'headers':{'Content-Type':'application/json','Accept':'application/json'},'json':!![]};if(_0x507408[_0xd79c('0x65')]==='basic'){_0x270f44[_0xd79c('0x66')][_0xd79c('0x67')]=util[_0xd79c('0x63')](_0xd79c('0x68'),new Buffer(util[_0xd79c('0x63')](_0xd79c('0x69'),_0x507408['username'],_0x507408[_0xd79c('0x6a')]))[_0xd79c('0x6b')](_0xd79c('0x6c')));}return rp(_0x270f44)[_0xd79c('0x28')](function(_0x35493b){return _0x3b235c[_0xd79c('0x6d')](_[_0xd79c('0x31')](_0x35493b['_embedded'][_0xd79c('0x6e')],function(_0xec52d9){return{'id':_0xec52d9[_0xd79c('0x2b')],'name':_0xec52d9['name'],'type':_0xec52d9['type'],'active':_0xec52d9[_0xd79c('0x6f')],'label':_0xec52d9['label'],'custom':!![]};}));});}})[_0xd79c('0x28')](function(_0xcbd3ef){return{'count':_0xcbd3ef[_0xd79c('0x36')],'rows':_0xcbd3ef};})[_0xd79c('0x28')](respondWithResult(_0x15844b,null))[_0xd79c('0x43')](function(_0x51faf0){var _0x4df3c7=_0x5ecb95[_0xd79c('0x32')][_0xd79c('0x70')]?0x1f4:_0x51faf0[_0xd79c('0x71')]||0x1f4;logger[_0xd79c('0x2a')]('getFields,\x20%s,\x20%s,\x20%s',_0xd79c('0x5b'),_0x4df3c7,JSON[_0xd79c('0x72')](_0x51faf0));delete _0x51faf0[_0xd79c('0x2b')];if(_0x4df3c7===0x191){_0x4df3c7=0x190;}_0x15844b[_0xd79c('0x1d')](_0x4df3c7)[_0xd79c('0x2c')](_0x5ecb95[_0xd79c('0x32')][_0xd79c('0x70')]?{'message':_0xd79c('0x73'),'statusCode':_0x51faf0[_0xd79c('0x71')]}:_0x51faf0);});}; \ No newline at end of file +var _0xc400=['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','limit','count','apply','reject','destroy','then','sendStatus','stack','name','index','map','DeskAccount','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','includeAll','include','rows','params','find','catch','create','body','update','getConfigurations','findOne','DeskConfiguration','nolimit','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskField','getFields','priority','remoteUri','authType','username','password','consumerKey','consumerSecret','token','slice','lastIndexOf','GET','format','%s/custom_fields','application/json','basic','headers','Basic\x20%s','toString','base64','concat','_embedded','active','label','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','send','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','jsforce'];(function(_0x2c7839,_0x54318f){var _0x571db5=function(_0x5eaeff){while(--_0x5eaeff){_0x2c7839['push'](_0x2c7839['shift']());}};_0x571db5(++_0x54318f);}(_0xc400,0x135));var _0x0c40=function(_0x5b1c2f,_0x59ccef){_0x5b1c2f=_0x5b1c2f-0x0;var _0x420d16=_0xc400[_0x5b1c2f];return _0x420d16;};'use strict';var emlformat=require(_0x0c40('0x0'));var rimraf=require(_0x0c40('0x1'));var zipdir=require(_0x0c40('0x2'));var jsonpatch=require(_0x0c40('0x3'));var rp=require(_0x0c40('0x4'));var moment=require(_0x0c40('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0c40('0x6'));var util=require('util');var path=require('path');var sox=require(_0x0c40('0x7'));var csv=require(_0x0c40('0x8'));var ejs=require(_0x0c40('0x9'));var fs=require('fs');var fs_extra=require(_0x0c40('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0c40('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0c40('0x8'));var querystring=require('querystring');var Papa=require(_0x0c40('0xc'));var Redis=require(_0x0c40('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x0c40('0xe'));var as=require(_0x0c40('0xf'));var hardwareService=require(_0x0c40('0x10'));var logger=require(_0x0c40('0x11'))(_0x0c40('0x12'));var utils=require(_0x0c40('0x13'));var config=require(_0x0c40('0x14'));var licenseUtil=require(_0x0c40('0x15'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x43ba7e,_0x268994){_0x268994=_0x268994||0xcc;return function(_0x3101cf){if(_0x3101cf){return _0x43ba7e['sendStatus'](_0x268994);}return _0x43ba7e[_0x0c40('0x16')](_0x268994)[_0x0c40('0x17')]();};}function respondWithResult(_0x1432d7,_0x290c07){_0x290c07=_0x290c07||0xc8;return function(_0x14c1e6){if(_0x14c1e6){return _0x1432d7['status'](_0x290c07)[_0x0c40('0x18')](_0x14c1e6);}};}function respondWithFilteredResult(_0x5f22a6,_0x55b86b){return function(_0x5247f3){if(_0x5247f3){var _0x2b7c79=typeof _0x55b86b[_0x0c40('0x19')]===_0x0c40('0x1a')&&typeof _0x55b86b[_0x0c40('0x1b')]===_0x0c40('0x1a');var _0x4c3260=_0x5247f3[_0x0c40('0x1c')];var _0x5e6d77=_0x2b7c79?0x0:_0x55b86b['offset'];var _0x2f3fdf=_0x2b7c79?_0x5247f3['count']:_0x55b86b[_0x0c40('0x19')]+_0x55b86b[_0x0c40('0x1b')];var _0x2ec50e;if(_0x2f3fdf>=_0x4c3260){_0x2f3fdf=_0x4c3260;_0x2ec50e=0xc8;}else{_0x2ec50e=0xce;}_0x5f22a6[_0x0c40('0x16')](_0x2ec50e);return _0x5f22a6['set']('Content-Range',_0x5e6d77+'-'+_0x2f3fdf+'/'+_0x4c3260)[_0x0c40('0x18')](_0x5247f3);}return null;};}function patchUpdates(_0x332c8f){return function(_0x311107){try{jsonpatch[_0x0c40('0x1d')](_0x311107,_0x332c8f,!![]);}catch(_0x42f8b5){return BPromise[_0x0c40('0x1e')](_0x42f8b5);}return _0x311107['save']();};}function saveUpdates(_0x450ebe,_0x580a4e){return function(_0x268250){if(_0x268250){return _0x268250['update'](_0x450ebe)['then'](function(_0xf8f7f6){return _0xf8f7f6;});}return null;};}function removeEntity(_0xc63932,_0x132f30){return function(_0xb2ea40){if(_0xb2ea40){return _0xb2ea40[_0x0c40('0x1f')]()[_0x0c40('0x20')](function(){_0xc63932['status'](0xcc)[_0x0c40('0x17')]();});}};}function handleEntityNotFound(_0x9254ee,_0x45e288){return function(_0x2aff51){if(!_0x2aff51){_0x9254ee[_0x0c40('0x21')](0x194);}return _0x2aff51;};}function handleError(_0xf86eeb,_0x2334a7){_0x2334a7=_0x2334a7||0x1f4;return function(_0x51ba82){logger['error'](_0x51ba82[_0x0c40('0x22')]);if(_0x51ba82['name']){delete _0x51ba82[_0x0c40('0x23')];}_0xf86eeb[_0x0c40('0x16')](_0x2334a7)['send'](_0x51ba82);};}exports[_0x0c40('0x24')]=function(_0x3183c0,_0x1c291e){var _0x56837c={},_0x551d0f={},_0x5b27ba={'count':0x0,'rows':[]};var _0x2c112b=_[_0x0c40('0x25')](db[_0x0c40('0x26')][_0x0c40('0x27')],function(_0x3e4347){return{'name':_0x3e4347[_0x0c40('0x28')],'type':_0x3e4347[_0x0c40('0x29')]['key']};});_0x551d0f[_0x0c40('0x2a')]=_['map'](_0x2c112b,_0x0c40('0x23'));_0x551d0f['query']=_[_0x0c40('0x2b')](_0x3183c0[_0x0c40('0x2c')]);_0x551d0f[_0x0c40('0x2d')]=_[_0x0c40('0x2e')](_0x551d0f[_0x0c40('0x2a')],_0x551d0f['query']);_0x56837c[_0x0c40('0x2f')]=_['intersection'](_0x551d0f[_0x0c40('0x2a')],qs[_0x0c40('0x30')](_0x3183c0[_0x0c40('0x2c')]['fields']));_0x56837c[_0x0c40('0x2f')]=_0x56837c[_0x0c40('0x2f')][_0x0c40('0x31')]?_0x56837c[_0x0c40('0x2f')]:_0x551d0f['model'];if(!_0x3183c0[_0x0c40('0x2c')][_0x0c40('0x32')]('nolimit')){_0x56837c[_0x0c40('0x1b')]=qs[_0x0c40('0x1b')](_0x3183c0[_0x0c40('0x2c')][_0x0c40('0x1b')]);_0x56837c[_0x0c40('0x19')]=qs[_0x0c40('0x19')](_0x3183c0[_0x0c40('0x2c')][_0x0c40('0x19')]);}_0x56837c[_0x0c40('0x33')]=qs['sort'](_0x3183c0[_0x0c40('0x2c')][_0x0c40('0x34')]);_0x56837c['where']=qs[_0x0c40('0x2d')](_[_0x0c40('0x35')](_0x3183c0['query'],_0x551d0f['filters']),_0x2c112b);if(_0x3183c0[_0x0c40('0x2c')][_0x0c40('0x36')]){_0x56837c[_0x0c40('0x37')]=_['merge'](_0x56837c[_0x0c40('0x37')],{'$or':_[_0x0c40('0x25')](_0x2c112b,function(_0x17dbff){if(_0x17dbff[_0x0c40('0x29')]!=='VIRTUAL'){var _0x30bfe0={};_0x30bfe0[_0x17dbff[_0x0c40('0x23')]]={'$like':'%'+_0x3183c0['query'][_0x0c40('0x36')]+'%'};return _0x30bfe0;}})});}_0x56837c=_[_0x0c40('0x38')]({},_0x56837c,_0x3183c0['options']);var _0x27186f={'where':_0x56837c[_0x0c40('0x37')]};return db[_0x0c40('0x26')][_0x0c40('0x1c')](_0x27186f)[_0x0c40('0x20')](function(_0x74c139){_0x5b27ba[_0x0c40('0x1c')]=_0x74c139;if(_0x3183c0['query'][_0x0c40('0x39')]){_0x56837c[_0x0c40('0x3a')]=[{'all':!![]}];}return db[_0x0c40('0x26')]['findAll'](_0x56837c);})[_0x0c40('0x20')](function(_0x4f69fd){_0x5b27ba[_0x0c40('0x3b')]=_0x4f69fd;return _0x5b27ba;})[_0x0c40('0x20')](respondWithFilteredResult(_0x1c291e,_0x56837c))['catch'](handleError(_0x1c291e,null));};exports['show']=function(_0x2dbc3b,_0x7bdd7c){var _0x5bfca6={'raw':![],'where':{'id':_0x2dbc3b[_0x0c40('0x3c')]['id']}},_0xc42cf={};_0xc42cf[_0x0c40('0x2a')]=_[_0x0c40('0x2b')](db[_0x0c40('0x26')]['rawAttributes']);_0xc42cf[_0x0c40('0x2c')]=_[_0x0c40('0x2b')](_0x2dbc3b[_0x0c40('0x2c')]);_0xc42cf[_0x0c40('0x2d')]=_[_0x0c40('0x2e')](_0xc42cf[_0x0c40('0x2a')],_0xc42cf[_0x0c40('0x2c')]);_0x5bfca6[_0x0c40('0x2f')]=_[_0x0c40('0x2e')](_0xc42cf[_0x0c40('0x2a')],qs[_0x0c40('0x30')](_0x2dbc3b[_0x0c40('0x2c')][_0x0c40('0x30')]));_0x5bfca6[_0x0c40('0x2f')]=_0x5bfca6[_0x0c40('0x2f')]['length']?_0x5bfca6['attributes']:_0xc42cf[_0x0c40('0x2a')];if(_0x2dbc3b[_0x0c40('0x2c')][_0x0c40('0x39')]){_0x5bfca6[_0x0c40('0x3a')]=[{'all':!![]}];}_0x5bfca6=_[_0x0c40('0x38')]({},_0x5bfca6,_0x2dbc3b['options']);return db[_0x0c40('0x26')][_0x0c40('0x3d')](_0x5bfca6)[_0x0c40('0x20')](handleEntityNotFound(_0x7bdd7c,null))['then'](respondWithResult(_0x7bdd7c,null))[_0x0c40('0x3e')](handleError(_0x7bdd7c,null));};exports[_0x0c40('0x3f')]=function(_0x50eb5b,_0x4aba32){return db[_0x0c40('0x26')]['create'](_0x50eb5b[_0x0c40('0x40')],{})['then'](respondWithResult(_0x4aba32,0xc9))[_0x0c40('0x3e')](handleError(_0x4aba32,null));};exports[_0x0c40('0x41')]=function(_0x506b5d,_0x205101){if(_0x506b5d[_0x0c40('0x40')]['id']){delete _0x506b5d[_0x0c40('0x40')]['id'];}return db[_0x0c40('0x26')]['find']({'where':{'id':_0x506b5d[_0x0c40('0x3c')]['id']}})[_0x0c40('0x20')](handleEntityNotFound(_0x205101,null))[_0x0c40('0x20')](saveUpdates(_0x506b5d[_0x0c40('0x40')],null))['then'](respondWithResult(_0x205101,null))[_0x0c40('0x3e')](handleError(_0x205101,null));};exports[_0x0c40('0x1f')]=function(_0x344e2a,_0x3afc1f){return db[_0x0c40('0x26')][_0x0c40('0x3d')]({'where':{'id':_0x344e2a[_0x0c40('0x3c')]['id']}})[_0x0c40('0x20')](handleEntityNotFound(_0x3afc1f,null))['then'](removeEntity(_0x3afc1f,null))['catch'](handleError(_0x3afc1f,null));};exports[_0x0c40('0x42')]=function(_0x4e1cb4,_0x1c6189,_0x56bd80){var _0x36643c={};var _0x45f1f4={};var _0x4939d4;var _0xa3152e;return db['DeskAccount'][_0x0c40('0x43')]({'where':{'id':_0x4e1cb4[_0x0c40('0x3c')]['id']}})['then'](handleEntityNotFound(_0x1c6189,null))[_0x0c40('0x20')](function(_0x4cf9c4){if(_0x4cf9c4){_0x4939d4=_0x4cf9c4;_0x45f1f4[_0x0c40('0x2a')]=_[_0x0c40('0x2b')](db[_0x0c40('0x44')][_0x0c40('0x27')]);_0x45f1f4['query']=_[_0x0c40('0x2b')](_0x4e1cb4['query']);_0x45f1f4[_0x0c40('0x2d')]=_[_0x0c40('0x2e')](_0x45f1f4[_0x0c40('0x2a')],_0x45f1f4['query']);_0x36643c['attributes']=_[_0x0c40('0x2e')](_0x45f1f4[_0x0c40('0x2a')],qs['fields'](_0x4e1cb4['query'][_0x0c40('0x30')]));_0x36643c[_0x0c40('0x2f')]=_0x36643c['attributes'][_0x0c40('0x31')]?_0x36643c[_0x0c40('0x2f')]:_0x45f1f4[_0x0c40('0x2a')];_0x36643c[_0x0c40('0x33')]=qs[_0x0c40('0x34')](_0x4e1cb4['query'][_0x0c40('0x34')]);_0x36643c[_0x0c40('0x37')]=qs[_0x0c40('0x2d')](_[_0x0c40('0x35')](_0x4e1cb4[_0x0c40('0x2c')],_0x45f1f4['filters']));if(_0x4e1cb4[_0x0c40('0x2c')][_0x0c40('0x36')]){_0x36643c[_0x0c40('0x37')]=_['merge'](_0x36643c[_0x0c40('0x37')],{'$or':_['map'](_0x36643c['attributes'],function(_0x21669e){var _0x5e84ff={};_0x5e84ff[_0x21669e]={'$like':'%'+_0x4e1cb4[_0x0c40('0x2c')][_0x0c40('0x36')]+'%'};return _0x5e84ff;})});}_0x36643c=_[_0x0c40('0x38')]({},_0x36643c,_0x4e1cb4['options']);return _0x4939d4[_0x0c40('0x42')](_0x36643c);}})[_0x0c40('0x20')](function(_0x426e5e){if(_0x426e5e){_0xa3152e=_0x426e5e[_0x0c40('0x31')];if(!_0x4e1cb4[_0x0c40('0x2c')]['hasOwnProperty'](_0x0c40('0x45'))){_0x36643c[_0x0c40('0x1b')]=qs['limit'](_0x4e1cb4[_0x0c40('0x2c')][_0x0c40('0x1b')]);_0x36643c[_0x0c40('0x19')]=qs[_0x0c40('0x19')](_0x4e1cb4[_0x0c40('0x2c')][_0x0c40('0x19')]);}return _0x4939d4['getConfigurations'](_0x36643c);}})['then'](function(_0x54d1e6){if(_0x54d1e6){return _0x54d1e6?{'count':_0xa3152e,'rows':_0x54d1e6}:null;}})[_0x0c40('0x20')](respondWithResult(_0x1c6189,null))[_0x0c40('0x3e')](handleError(_0x1c6189,null));};exports[_0x0c40('0x46')]=function(_0x165aaf,_0x2bfac2,_0x1d62c3){if(_0x165aaf['body']['id']){delete _0x165aaf[_0x0c40('0x40')]['id'];}return db[_0x0c40('0x26')][_0x0c40('0x43')]({'where':{'id':_0x165aaf[_0x0c40('0x3c')]['id']}})[_0x0c40('0x20')](handleEntityNotFound(_0x2bfac2,null))['then'](function(_0x39c1bf){if(_0x39c1bf){_0x165aaf[_0x0c40('0x40')]['AccountId']=_0x39c1bf['id'];_0x165aaf[_0x0c40('0x40')][_0x0c40('0x47')]=integrations[_0x0c40('0x48')](_0x165aaf[_0x0c40('0x40')][_0x0c40('0x49')],_0x165aaf[_0x0c40('0x40')][_0x0c40('0x29')]);_0x165aaf[_0x0c40('0x40')][_0x0c40('0x4a')]=integrations[_0x0c40('0x4b')](_0x165aaf[_0x0c40('0x40')][_0x0c40('0x49')],_0x165aaf[_0x0c40('0x40')][_0x0c40('0x29')]);return db[_0x0c40('0x44')]['create'](_0x165aaf['body'],{'include':[{'model':db[_0x0c40('0x4c')],'as':_0x0c40('0x47')},{'model':db['DeskField'],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x2bfac2,null))[_0x0c40('0x3e')](handleError(_0x2bfac2,null));};exports[_0x0c40('0x4d')]=function(_0x473808,_0xa85520,_0x3fd094){var _0x10e1fd=[{'name':_0x0c40('0x4e'),'label':_0x0c40('0x4e'),'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 _0x39d8c4='';return db['DeskAccount'][_0x0c40('0x43')]({'where':{'id':_0x473808[_0x0c40('0x3c')]['id']},'attributes':['id',_0x0c40('0x4f'),_0x0c40('0x50'),_0x0c40('0x51'),_0x0c40('0x52'),_0x0c40('0x53'),_0x0c40('0x54'),_0x0c40('0x55'),'tokenSecret']})[_0x0c40('0x20')](handleEntityNotFound(_0xa85520,null))['then'](function(_0x4ecd7a){if(_0x4ecd7a){_0x39d8c4=_0x4ecd7a[_0x0c40('0x4f')];var _0x5455d0=_0x39d8c4[_0x0c40('0x56')](-0x1);if(_0x5455d0==='/'){_0x39d8c4=_0x39d8c4['substring'](0x0,_0x39d8c4[_0x0c40('0x57')](_0x5455d0));}var _0x39c6a7={'method':_0x0c40('0x58'),'uri':util[_0x0c40('0x59')](_0x0c40('0x5a'),_0x39d8c4),'headers':{'Content-Type':_0x0c40('0x5b'),'Accept':_0x0c40('0x5b')},'json':!![]};if(_0x4ecd7a[_0x0c40('0x50')]===_0x0c40('0x5c')){_0x39c6a7[_0x0c40('0x5d')]['Authorization']=util[_0x0c40('0x59')](_0x0c40('0x5e'),new Buffer(util[_0x0c40('0x59')]('%s:%s',_0x4ecd7a[_0x0c40('0x51')],_0x4ecd7a[_0x0c40('0x52')]))[_0x0c40('0x5f')](_0x0c40('0x60')));}return rp(_0x39c6a7)[_0x0c40('0x20')](function(_0x30c906){return _0x10e1fd[_0x0c40('0x61')](_[_0x0c40('0x25')](_0x30c906[_0x0c40('0x62')]['entries'],function(_0x272c99){return{'id':_0x272c99[_0x0c40('0x23')],'name':_0x272c99[_0x0c40('0x23')],'type':_0x272c99['type'],'active':_0x272c99[_0x0c40('0x63')],'label':_0x272c99[_0x0c40('0x64')],'custom':!![]};}));});}})['then'](function(_0x22b41e){return{'count':_0x22b41e[_0x0c40('0x31')],'rows':_0x22b41e};})[_0x0c40('0x20')](respondWithResult(_0xa85520,null))['catch'](function(_0x1ae69f){var _0x48cd1b=_0x473808[_0x0c40('0x2c')]['test']?0x1f4:_0x1ae69f[_0x0c40('0x65')]||0x1f4;logger[_0x0c40('0x66')](_0x0c40('0x67'),'getFields',_0x48cd1b,JSON['stringify'](_0x1ae69f));delete _0x1ae69f['name'];if(_0x48cd1b===0x191){_0x48cd1b=0x190;}_0xa85520[_0x0c40('0x16')](_0x48cd1b)[_0x0c40('0x68')](_0x473808['query'][_0x0c40('0x69')]?{'message':_0x0c40('0x6a'),'statusCode':_0x1ae69f[_0x0c40('0x65')]}:_0x1ae69f);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 65acccc..0206ebf 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 _0x9bdd=['DeskAccount','int_desk_accounts','lodash','util','../../config/logger','api','bluebird','path','../../config/environment','./intDeskAccount.attributes','exports','define'];(function(_0x7a2860,_0x305826){var _0xe931f6=function(_0x3c2f7f){while(--_0x3c2f7f){_0x7a2860['push'](_0x7a2860['shift']());}};_0xe931f6(++_0x305826);}(_0x9bdd,0x116));var _0xd9bd=function(_0x41fc51,_0x18a11f){_0x41fc51=_0x41fc51-0x0;var _0x493593=_0x9bdd[_0x41fc51];return _0x493593;};'use strict';var _=require(_0xd9bd('0x0'));var util=require(_0xd9bd('0x1'));var logger=require(_0xd9bd('0x2'))(_0xd9bd('0x3'));var moment=require('moment');var BPromise=require(_0xd9bd('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd9bd('0x5'));var rimraf=require('rimraf');var config=require(_0xd9bd('0x6'));var attributes=require(_0xd9bd('0x7'));var integrations=require('../../components/integrations/configuration');module[_0xd9bd('0x8')]=function(_0x4d50f9,_0x5c20e4){return _0x4d50f9[_0xd9bd('0x9')](_0xd9bd('0xa'),attributes,{'tableName':_0xd9bd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x67c7=['path','rimraf','./intDeskAccount.attributes','exports','DeskAccount','lodash','util','../../config/logger','api','bluebird'];(function(_0x132a0e,_0x3956fc){var _0x5bea3b=function(_0x6d0083){while(--_0x6d0083){_0x132a0e['push'](_0x132a0e['shift']());}};_0x5bea3b(++_0x3956fc);}(_0x67c7,0x1bd));var _0x767c=function(_0x444127,_0x27d1e9){_0x444127=_0x444127-0x0;var _0x5855c0=_0x67c7[_0x444127];return _0x5855c0;};'use strict';var _=require(_0x767c('0x0'));var util=require(_0x767c('0x1'));var logger=require(_0x767c('0x2'))(_0x767c('0x3'));var moment=require('moment');var BPromise=require(_0x767c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x767c('0x5'));var rimraf=require(_0x767c('0x6'));var config=require('../../config/environment');var attributes=require(_0x767c('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x767c('0x8')]=function(_0x45e9c1,_0x145fcd){return _0x45e9c1['define'](_0x767c('0x9'),attributes,{'tableName':'int_desk_accounts','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 4ab7f76..03281cf 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 _0x1d95=['code','message','result','DeskAccount','findAll','options','attributes','limit','include','map','model','GetDeskAccount','catch','find','raw','where','then','ShowDeskAccount','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x5d1044,_0x18f656){var _0x3cd90e=function(_0x3c40be){while(--_0x3c40be){_0x5d1044['push'](_0x5d1044['shift']());}};_0x3cd90e(++_0x18f656);}(_0x1d95,0x1e6));var _0x51d9=function(_0x511ed0,_0x5a73be){_0x511ed0=_0x511ed0-0x0;var _0xb45422=_0x1d95[_0x511ed0];return _0xb45422;};'use strict';var _=require(_0x51d9('0x0'));var util=require('util');var moment=require(_0x51d9('0x1'));var BPromise=require(_0x51d9('0x2'));var rs=require(_0x51d9('0x3'));var fs=require('fs');var Redis=require(_0x51d9('0x4'));var db=require(_0x51d9('0x5'))['db'];var utils=require(_0x51d9('0x6'));var logger=require(_0x51d9('0x7'))(_0x51d9('0x8'));var config=require(_0x51d9('0x9'));var jayson=require(_0x51d9('0xa'));var client=jayson[_0x51d9('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xfff39f,_0x29ef51,_0x1bd392){return new BPromise(function(_0x581e02,_0x376cb7){return client['request'](_0xfff39f,_0x1bd392)['then'](function(_0x50dd93){logger[_0x51d9('0xc')](_0x51d9('0xd'),_0x29ef51,_0x51d9('0xe'));logger[_0x51d9('0xf')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x29ef51,_0x51d9('0xe'),JSON[_0x51d9('0x10')](_0x50dd93));if(_0x50dd93['error']){if(_0x50dd93[_0x51d9('0x11')][_0x51d9('0x12')]===0x1f4){logger['error'](_0x51d9('0xd'),_0x29ef51,_0x50dd93[_0x51d9('0x11')][_0x51d9('0x13')]);return _0x376cb7(_0x50dd93[_0x51d9('0x11')][_0x51d9('0x13')]);}logger[_0x51d9('0x11')](_0x51d9('0xd'),_0x29ef51,_0x50dd93[_0x51d9('0x11')][_0x51d9('0x13')]);return _0x581e02(_0x50dd93[_0x51d9('0x11')][_0x51d9('0x13')]);}else{logger[_0x51d9('0xc')]('DeskAccount,\x20%s,\x20%s',_0x29ef51,_0x51d9('0xe'));_0x581e02(_0x50dd93[_0x51d9('0x14')][_0x51d9('0x13')]);}})['catch'](function(_0x55e79f){logger['error'](_0x51d9('0xd'),_0x29ef51,_0x55e79f);_0x376cb7(_0x55e79f);});});}exports['GetDeskAccount']=function(_0x103528){var _0x29ab23=this;return new Promise(function(_0x26e3d7,_0x521757){return db[_0x51d9('0x15')][_0x51d9('0x16')]({'raw':_0x103528[_0x51d9('0x17')]?_0x103528[_0x51d9('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x103528['options']?_0x103528['options']['where']||null:null,'attributes':_0x103528[_0x51d9('0x17')]?_0x103528['options'][_0x51d9('0x18')]||null:null,'limit':_0x103528[_0x51d9('0x17')]?_0x103528[_0x51d9('0x17')][_0x51d9('0x19')]||null:null,'include':_0x103528[_0x51d9('0x17')]?_0x103528[_0x51d9('0x17')][_0x51d9('0x1a')]?_[_0x51d9('0x1b')](_0x103528[_0x51d9('0x17')][_0x51d9('0x1a')],function(_0x1e9c18){return{'model':db[_0x1e9c18[_0x51d9('0x1c')]],'as':_0x1e9c18['as'],'attributes':_0x1e9c18[_0x51d9('0x18')],'include':_0x1e9c18[_0x51d9('0x1a')]?_[_0x51d9('0x1b')](_0x1e9c18[_0x51d9('0x1a')],function(_0x39a010){return{'model':db[_0x39a010[_0x51d9('0x1c')]],'as':_0x39a010['as'],'attributes':_0x39a010[_0x51d9('0x18')],'include':_0x39a010[_0x51d9('0x1a')]?_[_0x51d9('0x1b')](_0x39a010[_0x51d9('0x1a')],function(_0x3ebd97){return{'model':db[_0x3ebd97[_0x51d9('0x1c')]],'as':_0x3ebd97['as'],'attributes':_0x3ebd97[_0x51d9('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4b2ea0){logger[_0x51d9('0xc')](_0x51d9('0x1d'),_0x103528);logger[_0x51d9('0xf')](_0x51d9('0x1d'),_0x103528,JSON[_0x51d9('0x10')](_0x4b2ea0));_0x26e3d7(_0x4b2ea0);})[_0x51d9('0x1e')](function(_0x2ae47a){logger[_0x51d9('0x11')]('GetDeskAccount',_0x2ae47a[_0x51d9('0x13')],_0x103528);_0x521757(_0x29ab23[_0x51d9('0x11')](0x1f4,_0x2ae47a[_0x51d9('0x13')]));});});};exports['ShowDeskAccount']=function(_0x278570){var _0x5c8414=this;return new Promise(function(_0x1f5712,_0x58e7fe){return db[_0x51d9('0x15')][_0x51d9('0x1f')]({'raw':_0x278570[_0x51d9('0x17')]?_0x278570['options'][_0x51d9('0x20')]===undefined?!![]:![]:!![],'where':_0x278570[_0x51d9('0x17')]?_0x278570[_0x51d9('0x17')][_0x51d9('0x21')]||null:null,'attributes':_0x278570[_0x51d9('0x17')]?_0x278570[_0x51d9('0x17')]['attributes']||null:null,'include':_0x278570['options']?_0x278570['options'][_0x51d9('0x1a')]?_[_0x51d9('0x1b')](_0x278570['options'][_0x51d9('0x1a')],function(_0x54d3b0){return{'model':db[_0x54d3b0['model']],'as':_0x54d3b0['as'],'attributes':_0x54d3b0['attributes'],'include':_0x54d3b0[_0x51d9('0x1a')]?_['map'](_0x54d3b0[_0x51d9('0x1a')],function(_0x50ce27){return{'model':db[_0x50ce27[_0x51d9('0x1c')]],'as':_0x50ce27['as'],'attributes':_0x50ce27[_0x51d9('0x18')],'include':_0x50ce27[_0x51d9('0x1a')]?_[_0x51d9('0x1b')](_0x50ce27[_0x51d9('0x1a')],function(_0x2eb787){return{'model':db[_0x2eb787['model']],'as':_0x2eb787['as'],'attributes':_0x2eb787[_0x51d9('0x18')]};}):[]};}):[]};}):[]:[]})[_0x51d9('0x22')](function(_0x5f4595){logger[_0x51d9('0xc')](_0x51d9('0x23'),_0x278570);logger['debug'](_0x51d9('0x23'),_0x278570,JSON[_0x51d9('0x10')](_0x5f4595));_0x1f5712(_0x5f4595);})[_0x51d9('0x1e')](function(_0x468de8){logger[_0x51d9('0x11')]('ShowDeskAccount',_0x468de8[_0x51d9('0x13')],_0x278570);_0x58e7fe(_0x5c8414[_0x51d9('0x11')](0x1f4,_0x468de8['message']));});});}; \ No newline at end of file +var _0x9e5e=['request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetDeskAccount','findAll','options','raw','where','limit','include','map','model','attributes','ShowDeskAccount','DeskAccount','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http'];(function(_0x20aae1,_0x51efd4){var _0x510601=function(_0x20895f){while(--_0x20895f){_0x20aae1['push'](_0x20aae1['shift']());}};_0x510601(++_0x51efd4);}(_0x9e5e,0x19a));var _0xe9e5=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0x9e5e[_0x1203f];return _0x365f0a;};'use strict';var _=require(_0xe9e5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe9e5('0x1'));var rs=require(_0xe9e5('0x2'));var fs=require('fs');var Redis=require(_0xe9e5('0x3'));var db=require(_0xe9e5('0x4'))['db'];var utils=require(_0xe9e5('0x5'));var logger=require(_0xe9e5('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe9e5('0x7'));var client=jayson[_0xe9e5('0x8')][_0xe9e5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2e3812,_0x1bd992,_0x26d07e){return new BPromise(function(_0x509ce9,_0x1f4cdd){return client[_0xe9e5('0xa')](_0x2e3812,_0x26d07e)[_0xe9e5('0xb')](function(_0x53e049){logger[_0xe9e5('0xc')](_0xe9e5('0xd'),_0x1bd992,_0xe9e5('0xe'));logger[_0xe9e5('0xf')](_0xe9e5('0x10'),_0x1bd992,'request\x20sent',JSON[_0xe9e5('0x11')](_0x53e049));if(_0x53e049['error']){if(_0x53e049[_0xe9e5('0x12')][_0xe9e5('0x13')]===0x1f4){logger['error'](_0xe9e5('0xd'),_0x1bd992,_0x53e049[_0xe9e5('0x12')]['message']);return _0x1f4cdd(_0x53e049[_0xe9e5('0x12')][_0xe9e5('0x14')]);}logger[_0xe9e5('0x12')](_0xe9e5('0xd'),_0x1bd992,_0x53e049[_0xe9e5('0x12')]['message']);return _0x509ce9(_0x53e049[_0xe9e5('0x12')][_0xe9e5('0x14')]);}else{logger[_0xe9e5('0xc')](_0xe9e5('0xd'),_0x1bd992,_0xe9e5('0xe'));_0x509ce9(_0x53e049[_0xe9e5('0x15')][_0xe9e5('0x14')]);}})[_0xe9e5('0x16')](function(_0x805798){logger['error'](_0xe9e5('0xd'),_0x1bd992,_0x805798);_0x1f4cdd(_0x805798);});});}exports[_0xe9e5('0x17')]=function(_0x3da623){var _0x2042b2=this;return new Promise(function(_0x464e46,_0x26ca56){return db['DeskAccount'][_0xe9e5('0x18')]({'raw':_0x3da623[_0xe9e5('0x19')]?_0x3da623[_0xe9e5('0x19')][_0xe9e5('0x1a')]===undefined?!![]:![]:!![],'where':_0x3da623[_0xe9e5('0x19')]?_0x3da623[_0xe9e5('0x19')][_0xe9e5('0x1b')]||null:null,'attributes':_0x3da623[_0xe9e5('0x19')]?_0x3da623[_0xe9e5('0x19')]['attributes']||null:null,'limit':_0x3da623[_0xe9e5('0x19')]?_0x3da623[_0xe9e5('0x19')][_0xe9e5('0x1c')]||null:null,'include':_0x3da623[_0xe9e5('0x19')]?_0x3da623[_0xe9e5('0x19')][_0xe9e5('0x1d')]?_[_0xe9e5('0x1e')](_0x3da623[_0xe9e5('0x19')][_0xe9e5('0x1d')],function(_0x331548){return{'model':db[_0x331548[_0xe9e5('0x1f')]],'as':_0x331548['as'],'attributes':_0x331548[_0xe9e5('0x20')],'include':_0x331548['include']?_[_0xe9e5('0x1e')](_0x331548[_0xe9e5('0x1d')],function(_0x5cd080){return{'model':db[_0x5cd080[_0xe9e5('0x1f')]],'as':_0x5cd080['as'],'attributes':_0x5cd080['attributes'],'include':_0x5cd080['include']?_[_0xe9e5('0x1e')](_0x5cd080[_0xe9e5('0x1d')],function(_0x28d5e0){return{'model':db[_0x28d5e0[_0xe9e5('0x1f')]],'as':_0x28d5e0['as'],'attributes':_0x28d5e0[_0xe9e5('0x20')]};}):[]};}):[]};}):[]:[]})[_0xe9e5('0xb')](function(_0x727aa5){logger[_0xe9e5('0xc')](_0xe9e5('0x17'),_0x3da623);logger['debug']('GetDeskAccount',_0x3da623,JSON[_0xe9e5('0x11')](_0x727aa5));_0x464e46(_0x727aa5);})['catch'](function(_0x466f33){logger['error'](_0xe9e5('0x17'),_0x466f33[_0xe9e5('0x14')],_0x3da623);_0x26ca56(_0x2042b2[_0xe9e5('0x12')](0x1f4,_0x466f33['message']));});});};exports[_0xe9e5('0x21')]=function(_0x5c9184){var _0x4fd5d2=this;return new Promise(function(_0x1cd9e4,_0x581adf){return db[_0xe9e5('0x22')]['find']({'raw':_0x5c9184[_0xe9e5('0x19')]?_0x5c9184['options'][_0xe9e5('0x1a')]===undefined?!![]:![]:!![],'where':_0x5c9184[_0xe9e5('0x19')]?_0x5c9184[_0xe9e5('0x19')]['where']||null:null,'attributes':_0x5c9184[_0xe9e5('0x19')]?_0x5c9184[_0xe9e5('0x19')][_0xe9e5('0x20')]||null:null,'include':_0x5c9184[_0xe9e5('0x19')]?_0x5c9184[_0xe9e5('0x19')][_0xe9e5('0x1d')]?_[_0xe9e5('0x1e')](_0x5c9184['options'][_0xe9e5('0x1d')],function(_0x18f852){return{'model':db[_0x18f852[_0xe9e5('0x1f')]],'as':_0x18f852['as'],'attributes':_0x18f852['attributes'],'include':_0x18f852[_0xe9e5('0x1d')]?_[_0xe9e5('0x1e')](_0x18f852[_0xe9e5('0x1d')],function(_0x2e84e8){return{'model':db[_0x2e84e8[_0xe9e5('0x1f')]],'as':_0x2e84e8['as'],'attributes':_0x2e84e8[_0xe9e5('0x20')],'include':_0x2e84e8[_0xe9e5('0x1d')]?_['map'](_0x2e84e8[_0xe9e5('0x1d')],function(_0x352221){return{'model':db[_0x352221[_0xe9e5('0x1f')]],'as':_0x352221['as'],'attributes':_0x352221[_0xe9e5('0x20')]};}):[]};}):[]};}):[]:[]})[_0xe9e5('0xb')](function(_0x2abc18){logger[_0xe9e5('0xc')](_0xe9e5('0x21'),_0x5c9184);logger[_0xe9e5('0xf')](_0xe9e5('0x21'),_0x5c9184,JSON[_0xe9e5('0x11')](_0x2abc18));_0x1cd9e4(_0x2abc18);})[_0xe9e5('0x16')](function(_0x403344){logger['error'](_0xe9e5('0x21'),_0x403344[_0xe9e5('0x14')],_0x5c9184);_0x581adf(_0x4fd5d2['error'](0x1f4,_0x403344[_0xe9e5('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 68fafd3..938de0e 100644 --- a/server/api/intDeskConfiguration/index.js +++ b/server/api/intDeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['getTags','post','create','setTags','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getSubjects','/:id/descriptions','/:id/tags'];(function(_0x5ab0d0,_0x3cfed9){var _0x4999ef=function(_0x4e138d){while(--_0x4e138d){_0x5ab0d0['push'](_0x5ab0d0['shift']());}};_0x4999ef(++_0x3cfed9);}(_0xedd9,0xfc));var _0x9edd=function(_0xd5e144,_0x2a93fe){_0xd5e144=_0xd5e144-0x0;var _0x1bb031=_0xedd9[_0xd5e144];return _0x1bb031;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0x9')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller['getFields']);router[_0x9edd('0x9')]('/:id/subjects',auth[_0x9edd('0xa')](),controller[_0x9edd('0xf')]);router['get'](_0x9edd('0x10'),auth[_0x9edd('0xa')](),controller['getDescriptions']);router[_0x9edd('0x9')](_0x9edd('0x11'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x12')]);router[_0x9edd('0x13')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0x14')]);router[_0x9edd('0x13')]('/:id/tags',auth[_0x9edd('0xa')](),controller[_0x9edd('0x15')]);router[_0x9edd('0x16')](_0x9edd('0xc'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x17')]);router[_0x9edd('0x18')](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0x19')]);module[_0x9edd('0x1a')]=router; \ No newline at end of file +var _0x008c=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','getFields','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','setTags','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0xdb0e1a,_0x4b1b08){var _0x51f00f=function(_0x1f415c){while(--_0x1f415c){_0xdb0e1a['push'](_0xdb0e1a['shift']());}};_0x51f00f(++_0x4b1b08);}(_0x008c,0x188));var _0xc008=function(_0x53b2cd,_0x18747e){_0x53b2cd=_0x53b2cd-0x0;var _0x100d52=_0x008c[_0x53b2cd];return _0x100d52;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/:id',auth[_0xc008('0xb')](),controller['show']);router[_0xc008('0xa')]('/:id/fields',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xa')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0xc008('0xa')](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0xf')]);router[_0xc008('0xa')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x11')]);router[_0xc008('0x12')]('/',auth[_0xc008('0xb')](),controller['create']);router['post'](_0xc008('0x10'),auth['isAuthenticated'](),controller[_0xc008('0x13')]);router[_0xc008('0x14')](_0xc008('0x15'),auth[_0xc008('0xb')](),controller[_0xc008('0x16')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xc008('0x17')]);module[_0xc008('0x18')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index e55d33b..1118033 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 _0x535d=['exports','STRING','sequelize'];(function(_0x424501,_0x42096d){var _0xb719af=function(_0x37adcf){while(--_0x37adcf){_0x424501['push'](_0x424501['shift']());}};_0xb719af(++_0x42096d);}(_0x535d,0xfb));var _0xd535=function(_0x4033cd,_0x162134){_0x4033cd=_0x4033cd-0x0;var _0x44f289=_0x535d[_0x4033cd];return _0x44f289;};'use strict';var Sequelize=require(_0xd535('0x0'));module[_0xd535('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd535('0x2')]}}; \ No newline at end of file +var _0x0eea=['sequelize','exports','STRING'];(function(_0x1d513d,_0x3e4747){var _0x20220c=function(_0x3018a1){while(--_0x3018a1){_0x1d513d['push'](_0x1d513d['shift']());}};_0x20220c(++_0x3e4747);}(_0x0eea,0x19b));var _0xa0ee=function(_0x2db883,_0x1af4cf){_0x2db883=_0x2db883-0x0;var _0x1eef85=_0x0eea[_0x2db883];return _0x1eef85;};'use strict';var Sequelize=require(_0xa0ee('0x0'));module[_0xa0ee('0x1')]={'name':{'type':Sequelize[_0xa0ee('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 1761e81..9f7077e 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 _0x0e60=['moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','save','destroy','then','end','stack','name','index','map','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','DeskConfiguration','includeAll','include','findAll','rows','catch','params','rawAttributes','keys','create','update','body','find','getFields','findOne','DeskField','getSubjects','getDescriptions','getTags','Tag','setTags','eml-format','rimraf','fast-json-patch','request-promise'];(function(_0x2033dc,_0x533d2c){var _0x5c5416=function(_0x557476){while(--_0x557476){_0x2033dc['push'](_0x2033dc['shift']());}};_0x5c5416(++_0x533d2c);}(_0x0e60,0x19b));var _0x00e6=function(_0x24b1ec,_0x977b4c){_0x24b1ec=_0x24b1ec-0x0;var _0xbe60c8=_0x0e60[_0x24b1ec];return _0xbe60c8;};'use strict';var emlformat=require(_0x00e6('0x0'));var rimraf=require(_0x00e6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x00e6('0x2'));var rp=require(_0x00e6('0x3'));var moment=require(_0x00e6('0x4'));var BPromise=require(_0x00e6('0x5'));var Mustache=require(_0x00e6('0x6'));var util=require(_0x00e6('0x7'));var path=require(_0x00e6('0x8'));var sox=require(_0x00e6('0x9'));var csv=require(_0x00e6('0xa'));var ejs=require(_0x00e6('0xb'));var fs=require('fs');var fs_extra=require(_0x00e6('0xc'));var _=require('lodash');var squel=require(_0x00e6('0xd'));var crypto=require('crypto');var jsforce=require(_0x00e6('0xe'));var deskjs=require(_0x00e6('0xf'));var toCsv=require('to-csv');var querystring=require(_0x00e6('0x10'));var Papa=require(_0x00e6('0x11'));var Redis=require(_0x00e6('0x12'));var authService=require(_0x00e6('0x13'));var qs=require(_0x00e6('0x14'));var as=require(_0x00e6('0x15'));var hardwareService=require(_0x00e6('0x16'));var logger=require(_0x00e6('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x00e6('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xd2bea0,_0x30df6a){_0x30df6a=_0x30df6a||0xcc;return function(_0x139270){if(_0x139270){return _0xd2bea0[_0x00e6('0x19')](_0x30df6a);}return _0xd2bea0[_0x00e6('0x1a')](_0x30df6a)['end']();};}function respondWithResult(_0x37f2af,_0x4e7992){_0x4e7992=_0x4e7992||0xc8;return function(_0x46c23e){if(_0x46c23e){return _0x37f2af[_0x00e6('0x1a')](_0x4e7992)[_0x00e6('0x1b')](_0x46c23e);}};}function respondWithFilteredResult(_0x354e0a,_0x5d51cf){return function(_0xd7af61){if(_0xd7af61){var _0x287347=typeof _0x5d51cf[_0x00e6('0x1c')]===_0x00e6('0x1d')&&typeof _0x5d51cf[_0x00e6('0x1e')]===_0x00e6('0x1d');var _0xf47219=_0xd7af61[_0x00e6('0x1f')];var _0x2ba2bb=_0x287347?0x0:_0x5d51cf[_0x00e6('0x1c')];var _0x22b080=_0x287347?_0xd7af61[_0x00e6('0x1f')]:_0x5d51cf[_0x00e6('0x1c')]+_0x5d51cf[_0x00e6('0x1e')];var _0x5df511;if(_0x22b080>=_0xf47219){_0x22b080=_0xf47219;_0x5df511=0xc8;}else{_0x5df511=0xce;}_0x354e0a[_0x00e6('0x1a')](_0x5df511);return _0x354e0a['set'](_0x00e6('0x20'),_0x2ba2bb+'-'+_0x22b080+'/'+_0xf47219)[_0x00e6('0x1b')](_0xd7af61);}return null;};}function patchUpdates(_0x2232e8){return function(_0x4d06c9){try{jsonpatch[_0x00e6('0x21')](_0x4d06c9,_0x2232e8,!![]);}catch(_0x2339e9){return BPromise['reject'](_0x2339e9);}return _0x4d06c9[_0x00e6('0x22')]();};}function saveUpdates(_0x14aa38,_0x2e2162){return function(_0x50ddba){if(_0x50ddba){return _0x50ddba['update'](_0x14aa38)['then'](function(_0x10d4d5){return _0x10d4d5;});}return null;};}function removeEntity(_0x1400e9,_0x185e56){return function(_0x28b04e){if(_0x28b04e){return _0x28b04e[_0x00e6('0x23')]()[_0x00e6('0x24')](function(){_0x1400e9[_0x00e6('0x1a')](0xcc)[_0x00e6('0x25')]();});}};}function handleEntityNotFound(_0x26fcb4,_0x941d3f){return function(_0x55a48d){if(!_0x55a48d){_0x26fcb4[_0x00e6('0x19')](0x194);}return _0x55a48d;};}function handleError(_0x2dab79,_0x3369bd){_0x3369bd=_0x3369bd||0x1f4;return function(_0x32e05d){logger['error'](_0x32e05d[_0x00e6('0x26')]);if(_0x32e05d['name']){delete _0x32e05d[_0x00e6('0x27')];}_0x2dab79[_0x00e6('0x1a')](_0x3369bd)['send'](_0x32e05d);};}exports[_0x00e6('0x28')]=function(_0x1c1544,_0x12cfcd){var _0x53868a={},_0x183350={},_0x3bf505={'count':0x0,'rows':[]};var _0xf83605=_[_0x00e6('0x29')](db['DeskConfiguration']['rawAttributes'],function(_0x5d9bf4){return{'name':_0x5d9bf4[_0x00e6('0x2a')],'type':_0x5d9bf4[_0x00e6('0x2b')][_0x00e6('0x2c')]};});_0x183350[_0x00e6('0x2d')]=_[_0x00e6('0x29')](_0xf83605,_0x00e6('0x27'));_0x183350[_0x00e6('0x2e')]=_['keys'](_0x1c1544[_0x00e6('0x2e')]);_0x183350[_0x00e6('0x2f')]=_['intersection'](_0x183350[_0x00e6('0x2d')],_0x183350[_0x00e6('0x2e')]);_0x53868a[_0x00e6('0x30')]=_[_0x00e6('0x31')](_0x183350['model'],qs[_0x00e6('0x32')](_0x1c1544[_0x00e6('0x2e')][_0x00e6('0x32')]));_0x53868a[_0x00e6('0x30')]=_0x53868a[_0x00e6('0x30')][_0x00e6('0x33')]?_0x53868a[_0x00e6('0x30')]:_0x183350[_0x00e6('0x2d')];if(!_0x1c1544[_0x00e6('0x2e')][_0x00e6('0x34')](_0x00e6('0x35'))){_0x53868a['limit']=qs[_0x00e6('0x1e')](_0x1c1544[_0x00e6('0x2e')][_0x00e6('0x1e')]);_0x53868a[_0x00e6('0x1c')]=qs['offset'](_0x1c1544['query']['offset']);}_0x53868a[_0x00e6('0x36')]=qs[_0x00e6('0x37')](_0x1c1544[_0x00e6('0x2e')][_0x00e6('0x37')]);_0x53868a[_0x00e6('0x38')]=qs[_0x00e6('0x2f')](_[_0x00e6('0x39')](_0x1c1544[_0x00e6('0x2e')],_0x183350[_0x00e6('0x2f')]),_0xf83605);if(_0x1c1544[_0x00e6('0x2e')][_0x00e6('0x3a')]){_0x53868a['where']=_[_0x00e6('0x3b')](_0x53868a[_0x00e6('0x38')],{'$or':_['map'](_0xf83605,function(_0xe849f6){if(_0xe849f6[_0x00e6('0x2b')]!==_0x00e6('0x3c')){var _0x206484={};_0x206484[_0xe849f6[_0x00e6('0x27')]]={'$like':'%'+_0x1c1544[_0x00e6('0x2e')][_0x00e6('0x3a')]+'%'};return _0x206484;}})});}_0x53868a=_[_0x00e6('0x3b')]({},_0x53868a,_0x1c1544[_0x00e6('0x3d')]);var _0xeb5701={'where':_0x53868a[_0x00e6('0x38')]};return db[_0x00e6('0x3e')]['count'](_0xeb5701)['then'](function(_0xd524d5){_0x3bf505[_0x00e6('0x1f')]=_0xd524d5;if(_0x1c1544[_0x00e6('0x2e')][_0x00e6('0x3f')]){_0x53868a[_0x00e6('0x40')]=[{'all':!![]}];}return db[_0x00e6('0x3e')][_0x00e6('0x41')](_0x53868a);})[_0x00e6('0x24')](function(_0x2f473c){_0x3bf505[_0x00e6('0x42')]=_0x2f473c;return _0x3bf505;})['then'](respondWithFilteredResult(_0x12cfcd,_0x53868a))[_0x00e6('0x43')](handleError(_0x12cfcd,null));};exports['show']=function(_0x3b62a4,_0x20d1a1){var _0x4425e2={'raw':![],'where':{'id':_0x3b62a4[_0x00e6('0x44')]['id']}},_0x583cc7={};_0x583cc7[_0x00e6('0x2d')]=_['keys'](db[_0x00e6('0x3e')][_0x00e6('0x45')]);_0x583cc7[_0x00e6('0x2e')]=_[_0x00e6('0x46')](_0x3b62a4['query']);_0x583cc7[_0x00e6('0x2f')]=_[_0x00e6('0x31')](_0x583cc7[_0x00e6('0x2d')],_0x583cc7['query']);_0x4425e2['attributes']=_['intersection'](_0x583cc7[_0x00e6('0x2d')],qs[_0x00e6('0x32')](_0x3b62a4['query'][_0x00e6('0x32')]));_0x4425e2[_0x00e6('0x30')]=_0x4425e2[_0x00e6('0x30')][_0x00e6('0x33')]?_0x4425e2[_0x00e6('0x30')]:_0x583cc7[_0x00e6('0x2d')];if(_0x3b62a4[_0x00e6('0x2e')][_0x00e6('0x3f')]){_0x4425e2[_0x00e6('0x40')]=[{'all':!![]}];}_0x4425e2=_['merge']({},_0x4425e2,_0x3b62a4['options']);return db['DeskConfiguration']['find'](_0x4425e2)['then'](handleEntityNotFound(_0x20d1a1,null))['then'](respondWithResult(_0x20d1a1,null))[_0x00e6('0x43')](handleError(_0x20d1a1,null));};exports['create']=function(_0x357ab5,_0x4b16eb){return db[_0x00e6('0x3e')][_0x00e6('0x47')](_0x357ab5['body'],{})['then'](respondWithResult(_0x4b16eb,0xc9))['catch'](handleError(_0x4b16eb,null));};exports[_0x00e6('0x48')]=function(_0x68beb0,_0x4d98e1){if(_0x68beb0[_0x00e6('0x49')]['id']){delete _0x68beb0[_0x00e6('0x49')]['id'];}return db[_0x00e6('0x3e')][_0x00e6('0x4a')]({'where':{'id':_0x68beb0[_0x00e6('0x44')]['id']}})['then'](handleEntityNotFound(_0x4d98e1,null))[_0x00e6('0x24')](saveUpdates(_0x68beb0[_0x00e6('0x49')],null))[_0x00e6('0x24')](respondWithResult(_0x4d98e1,null))[_0x00e6('0x43')](handleError(_0x4d98e1,null));};exports['destroy']=function(_0x9408ce,_0x5538fe){return db[_0x00e6('0x3e')][_0x00e6('0x4a')]({'where':{'id':_0x9408ce['params']['id']}})['then'](handleEntityNotFound(_0x5538fe,null))[_0x00e6('0x24')](removeEntity(_0x5538fe,null))[_0x00e6('0x43')](handleError(_0x5538fe,null));};exports[_0x00e6('0x4b')]=function(_0x423fac,_0x47605d,_0x2a48b9){var _0x6db1a5={};var _0x5ccf24={};var _0x164297;var _0xbb2ff9;return db[_0x00e6('0x3e')][_0x00e6('0x4c')]({'where':{'id':_0x423fac[_0x00e6('0x44')]['id']}})['then'](handleEntityNotFound(_0x47605d,null))[_0x00e6('0x24')](function(_0x4c6b28){if(_0x4c6b28){_0x164297=_0x4c6b28;_0x5ccf24[_0x00e6('0x2d')]=_[_0x00e6('0x46')](db[_0x00e6('0x4d')]['rawAttributes']);_0x5ccf24[_0x00e6('0x2e')]=_[_0x00e6('0x46')](_0x423fac[_0x00e6('0x2e')]);_0x5ccf24[_0x00e6('0x2f')]=_[_0x00e6('0x31')](_0x5ccf24[_0x00e6('0x2d')],_0x5ccf24['query']);_0x6db1a5['attributes']=_['intersection'](_0x5ccf24[_0x00e6('0x2d')],qs[_0x00e6('0x32')](_0x423fac['query'][_0x00e6('0x32')]));_0x6db1a5[_0x00e6('0x30')]=_0x6db1a5['attributes'][_0x00e6('0x33')]?_0x6db1a5[_0x00e6('0x30')]:_0x5ccf24[_0x00e6('0x2d')];_0x6db1a5['order']=qs[_0x00e6('0x37')](_0x423fac['query'][_0x00e6('0x37')]);_0x6db1a5[_0x00e6('0x38')]=qs[_0x00e6('0x2f')](_['pick'](_0x423fac['query'],_0x5ccf24[_0x00e6('0x2f')]));if(_0x423fac[_0x00e6('0x2e')][_0x00e6('0x3a')]){_0x6db1a5[_0x00e6('0x38')]=_[_0x00e6('0x3b')](_0x6db1a5[_0x00e6('0x38')],{'$or':_[_0x00e6('0x29')](_0x6db1a5[_0x00e6('0x30')],function(_0x17f01a){var _0x2b3b5d={};_0x2b3b5d[_0x17f01a]={'$like':'%'+_0x423fac[_0x00e6('0x2e')]['filter']+'%'};return _0x2b3b5d;})});}_0x6db1a5=_[_0x00e6('0x3b')]({},_0x6db1a5,_0x423fac[_0x00e6('0x3d')]);return _0x164297[_0x00e6('0x4b')](_0x6db1a5);}})[_0x00e6('0x24')](function(_0x517389){if(_0x517389){_0xbb2ff9=_0x517389[_0x00e6('0x33')];if(!_0x423fac['query'][_0x00e6('0x34')](_0x00e6('0x35'))){_0x6db1a5[_0x00e6('0x1e')]=qs[_0x00e6('0x1e')](_0x423fac['query'][_0x00e6('0x1e')]);_0x6db1a5[_0x00e6('0x1c')]=qs[_0x00e6('0x1c')](_0x423fac[_0x00e6('0x2e')]['offset']);}return _0x164297[_0x00e6('0x4b')](_0x6db1a5);}})[_0x00e6('0x24')](function(_0x24f24c){if(_0x24f24c){return _0x24f24c?{'count':_0xbb2ff9,'rows':_0x24f24c}:null;}})['then'](respondWithResult(_0x47605d,null))[_0x00e6('0x43')](handleError(_0x47605d,null));};exports[_0x00e6('0x4e')]=function(_0x3f833b,_0x41e3d1,_0x43fa12){var _0x5e5f1e={};var _0x17f0dd={};var _0xe6ddbe;var _0x29597a;return db[_0x00e6('0x3e')]['findOne']({'where':{'id':_0x3f833b[_0x00e6('0x44')]['id']}})[_0x00e6('0x24')](handleEntityNotFound(_0x41e3d1,null))[_0x00e6('0x24')](function(_0x34b3a9){if(_0x34b3a9){_0xe6ddbe=_0x34b3a9;_0x17f0dd[_0x00e6('0x2d')]=_[_0x00e6('0x46')](db[_0x00e6('0x4d')][_0x00e6('0x45')]);_0x17f0dd[_0x00e6('0x2e')]=_[_0x00e6('0x46')](_0x3f833b[_0x00e6('0x2e')]);_0x17f0dd[_0x00e6('0x2f')]=_['intersection'](_0x17f0dd[_0x00e6('0x2d')],_0x17f0dd[_0x00e6('0x2e')]);_0x5e5f1e[_0x00e6('0x30')]=_[_0x00e6('0x31')](_0x17f0dd[_0x00e6('0x2d')],qs['fields'](_0x3f833b['query'][_0x00e6('0x32')]));_0x5e5f1e[_0x00e6('0x30')]=_0x5e5f1e['attributes']['length']?_0x5e5f1e[_0x00e6('0x30')]:_0x17f0dd[_0x00e6('0x2d')];_0x5e5f1e[_0x00e6('0x36')]=qs['sort'](_0x3f833b[_0x00e6('0x2e')][_0x00e6('0x37')]);_0x5e5f1e[_0x00e6('0x38')]=qs[_0x00e6('0x2f')](_[_0x00e6('0x39')](_0x3f833b[_0x00e6('0x2e')],_0x17f0dd[_0x00e6('0x2f')]));if(_0x3f833b[_0x00e6('0x2e')]['filter']){_0x5e5f1e[_0x00e6('0x38')]=_[_0x00e6('0x3b')](_0x5e5f1e['where'],{'$or':_[_0x00e6('0x29')](_0x5e5f1e[_0x00e6('0x30')],function(_0x45fbb1){var _0x2c0590={};_0x2c0590[_0x45fbb1]={'$like':'%'+_0x3f833b[_0x00e6('0x2e')][_0x00e6('0x3a')]+'%'};return _0x2c0590;})});}_0x5e5f1e=_[_0x00e6('0x3b')]({},_0x5e5f1e,_0x3f833b[_0x00e6('0x3d')]);return _0xe6ddbe[_0x00e6('0x4e')](_0x5e5f1e);}})[_0x00e6('0x24')](function(_0x533d6b){if(_0x533d6b){_0x29597a=_0x533d6b[_0x00e6('0x33')];if(!_0x3f833b[_0x00e6('0x2e')][_0x00e6('0x34')](_0x00e6('0x35'))){_0x5e5f1e[_0x00e6('0x1e')]=qs[_0x00e6('0x1e')](_0x3f833b[_0x00e6('0x2e')][_0x00e6('0x1e')]);_0x5e5f1e['offset']=qs[_0x00e6('0x1c')](_0x3f833b[_0x00e6('0x2e')][_0x00e6('0x1c')]);}return _0xe6ddbe[_0x00e6('0x4e')](_0x5e5f1e);}})[_0x00e6('0x24')](function(_0x241df0){if(_0x241df0){return _0x241df0?{'count':_0x29597a,'rows':_0x241df0}:null;}})[_0x00e6('0x24')](respondWithResult(_0x41e3d1,null))[_0x00e6('0x43')](handleError(_0x41e3d1,null));};exports[_0x00e6('0x4f')]=function(_0x5d8c4f,_0x366457,_0x2b6df6){var _0x14922c={};var _0x212666={};var _0x2e8279;var _0x1699e0;return db[_0x00e6('0x3e')][_0x00e6('0x4c')]({'where':{'id':_0x5d8c4f[_0x00e6('0x44')]['id']}})[_0x00e6('0x24')](handleEntityNotFound(_0x366457,null))[_0x00e6('0x24')](function(_0x35a028){if(_0x35a028){_0x2e8279=_0x35a028;_0x212666['model']=_[_0x00e6('0x46')](db['DeskField'][_0x00e6('0x45')]);_0x212666[_0x00e6('0x2e')]=_[_0x00e6('0x46')](_0x5d8c4f[_0x00e6('0x2e')]);_0x212666[_0x00e6('0x2f')]=_[_0x00e6('0x31')](_0x212666[_0x00e6('0x2d')],_0x212666['query']);_0x14922c[_0x00e6('0x30')]=_[_0x00e6('0x31')](_0x212666[_0x00e6('0x2d')],qs[_0x00e6('0x32')](_0x5d8c4f[_0x00e6('0x2e')][_0x00e6('0x32')]));_0x14922c[_0x00e6('0x30')]=_0x14922c[_0x00e6('0x30')][_0x00e6('0x33')]?_0x14922c[_0x00e6('0x30')]:_0x212666['model'];_0x14922c[_0x00e6('0x36')]=qs[_0x00e6('0x37')](_0x5d8c4f['query'][_0x00e6('0x37')]);_0x14922c[_0x00e6('0x38')]=qs[_0x00e6('0x2f')](_[_0x00e6('0x39')](_0x5d8c4f[_0x00e6('0x2e')],_0x212666[_0x00e6('0x2f')]));if(_0x5d8c4f[_0x00e6('0x2e')][_0x00e6('0x3a')]){_0x14922c[_0x00e6('0x38')]=_[_0x00e6('0x3b')](_0x14922c[_0x00e6('0x38')],{'$or':_[_0x00e6('0x29')](_0x14922c['attributes'],function(_0x6da3ce){var _0x5c9b10={};_0x5c9b10[_0x6da3ce]={'$like':'%'+_0x5d8c4f[_0x00e6('0x2e')][_0x00e6('0x3a')]+'%'};return _0x5c9b10;})});}_0x14922c=_[_0x00e6('0x3b')]({},_0x14922c,_0x5d8c4f[_0x00e6('0x3d')]);return _0x2e8279[_0x00e6('0x4f')](_0x14922c);}})['then'](function(_0x17095e){if(_0x17095e){_0x1699e0=_0x17095e[_0x00e6('0x33')];if(!_0x5d8c4f['query'][_0x00e6('0x34')](_0x00e6('0x35'))){_0x14922c[_0x00e6('0x1e')]=qs[_0x00e6('0x1e')](_0x5d8c4f[_0x00e6('0x2e')][_0x00e6('0x1e')]);_0x14922c[_0x00e6('0x1c')]=qs[_0x00e6('0x1c')](_0x5d8c4f[_0x00e6('0x2e')]['offset']);}return _0x2e8279[_0x00e6('0x4f')](_0x14922c);}})[_0x00e6('0x24')](function(_0x18f964){if(_0x18f964){return _0x18f964?{'count':_0x1699e0,'rows':_0x18f964}:null;}})[_0x00e6('0x24')](respondWithResult(_0x366457,null))[_0x00e6('0x43')](handleError(_0x366457,null));};exports[_0x00e6('0x50')]=function(_0x26c8fd,_0x16062b,_0x3c7e41){var _0x5700d4={};var _0x44e957={};var _0x3467f1;var _0x3a9b75;return db[_0x00e6('0x3e')][_0x00e6('0x4c')]({'where':{'id':_0x26c8fd[_0x00e6('0x44')]['id']}})['then'](handleEntityNotFound(_0x16062b,null))[_0x00e6('0x24')](function(_0x56bf6c){if(_0x56bf6c){_0x3467f1=_0x56bf6c;_0x44e957['model']=_['keys'](db[_0x00e6('0x51')][_0x00e6('0x45')]);_0x44e957['query']=_['keys'](_0x26c8fd[_0x00e6('0x2e')]);_0x44e957['filters']=_[_0x00e6('0x31')](_0x44e957[_0x00e6('0x2d')],_0x44e957[_0x00e6('0x2e')]);_0x5700d4[_0x00e6('0x30')]=_[_0x00e6('0x31')](_0x44e957[_0x00e6('0x2d')],qs[_0x00e6('0x32')](_0x26c8fd['query']['fields']));_0x5700d4['attributes']=_0x5700d4[_0x00e6('0x30')]['length']?_0x5700d4[_0x00e6('0x30')]:_0x44e957[_0x00e6('0x2d')];_0x5700d4[_0x00e6('0x36')]=qs['sort'](_0x26c8fd['query']['sort']);_0x5700d4['where']=qs[_0x00e6('0x2f')](_['pick'](_0x26c8fd['query'],_0x44e957['filters']));if(_0x26c8fd[_0x00e6('0x2e')][_0x00e6('0x3a')]){_0x5700d4[_0x00e6('0x38')]=_[_0x00e6('0x3b')](_0x5700d4[_0x00e6('0x38')],{'$or':_[_0x00e6('0x29')](_0x5700d4[_0x00e6('0x30')],function(_0x3657e5){var _0x2f72a3={};_0x2f72a3[_0x3657e5]={'$like':'%'+_0x26c8fd[_0x00e6('0x2e')][_0x00e6('0x3a')]+'%'};return _0x2f72a3;})});}_0x5700d4=_[_0x00e6('0x3b')]({},_0x5700d4,_0x26c8fd['options']);return _0x3467f1[_0x00e6('0x50')](_0x5700d4);}})['then'](function(_0x3faae2){if(_0x3faae2){_0x3a9b75=_0x3faae2[_0x00e6('0x33')];if(!_0x26c8fd[_0x00e6('0x2e')]['hasOwnProperty']('nolimit')){_0x5700d4[_0x00e6('0x1e')]=qs[_0x00e6('0x1e')](_0x26c8fd[_0x00e6('0x2e')]['limit']);_0x5700d4[_0x00e6('0x1c')]=qs[_0x00e6('0x1c')](_0x26c8fd[_0x00e6('0x2e')][_0x00e6('0x1c')]);}return _0x3467f1[_0x00e6('0x50')](_0x5700d4);}})[_0x00e6('0x24')](function(_0x4d9f31){if(_0x4d9f31){return _0x4d9f31?{'count':_0x3a9b75,'rows':_0x4d9f31}:null;}})[_0x00e6('0x24')](respondWithResult(_0x16062b,null))['catch'](handleError(_0x16062b,null));};exports['setTags']=function(_0x5040d,_0x129cf5,_0x7bbba2){if(_0x5040d['body']['id']){delete _0x5040d[_0x00e6('0x49')]['id'];}return db['DeskConfiguration']['findOne']({'where':{'id':_0x5040d[_0x00e6('0x44')]['id']}})[_0x00e6('0x24')](handleEntityNotFound(_0x129cf5,null))['then'](function(_0x118026){if(_0x118026){return _0x118026[_0x00e6('0x52')](_0x5040d['body']['ids']||[]);}return null;})['then'](respondWithResult(_0x129cf5,null))['catch'](handleError(_0x129cf5,null));}; \ No newline at end of file +var _0x918f=['papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','apply','update','then','stack','name','send','index','map','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','DeskConfiguration','includeAll','findAll','catch','show','params','include','create','body','find','destroy','DeskField','getFields','nolimit','getSubjects','findOne','getDescriptions','Tag','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','crypto','querystring'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x918f,0x132));var _0xf918=function(_0x25b022,_0x394a08){_0x25b022=_0x25b022-0x0;var _0x2e13a5=_0x918f[_0x25b022];return _0x2e13a5;};'use strict';var emlformat=require(_0xf918('0x0'));var rimraf=require(_0xf918('0x1'));var zipdir=require(_0xf918('0x2'));var jsonpatch=require(_0xf918('0x3'));var rp=require('request-promise');var moment=require(_0xf918('0x4'));var BPromise=require(_0xf918('0x5'));var Mustache=require(_0xf918('0x6'));var util=require(_0xf918('0x7'));var path=require('path');var sox=require(_0xf918('0x8'));var csv=require(_0xf918('0x9'));var ejs=require(_0xf918('0xa'));var fs=require('fs');var fs_extra=require(_0xf918('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xf918('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf918('0x9'));var querystring=require(_0xf918('0xd'));var Papa=require(_0xf918('0xe'));var Redis=require(_0xf918('0xf'));var authService=require(_0xf918('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xf918('0x11'));var hardwareService=require(_0xf918('0x12'));var logger=require('../../config/logger')(_0xf918('0x13'));var utils=require(_0xf918('0x14'));var config=require(_0xf918('0x15'));var licenseUtil=require(_0xf918('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x40bf97,_0x2a04e6){_0x2a04e6=_0x2a04e6||0xcc;return function(_0xc12c03){if(_0xc12c03){return _0x40bf97['sendStatus'](_0x2a04e6);}return _0x40bf97[_0xf918('0x17')](_0x2a04e6)[_0xf918('0x18')]();};}function respondWithResult(_0x46f361,_0x812bdb){_0x812bdb=_0x812bdb||0xc8;return function(_0x302e55){if(_0x302e55){return _0x46f361[_0xf918('0x17')](_0x812bdb)[_0xf918('0x19')](_0x302e55);}};}function respondWithFilteredResult(_0x2fb6d8,_0x185caa){return function(_0x59afe1){if(_0x59afe1){var _0x20dc72=typeof _0x185caa[_0xf918('0x1a')]===_0xf918('0x1b')&&typeof _0x185caa[_0xf918('0x1c')]===_0xf918('0x1b');var _0x3086c5=_0x59afe1[_0xf918('0x1d')];var _0x4144f8=_0x20dc72?0x0:_0x185caa[_0xf918('0x1a')];var _0x5dd1e8=_0x20dc72?_0x59afe1[_0xf918('0x1d')]:_0x185caa[_0xf918('0x1a')]+_0x185caa[_0xf918('0x1c')];var _0x1a1a5a;if(_0x5dd1e8>=_0x3086c5){_0x5dd1e8=_0x3086c5;_0x1a1a5a=0xc8;}else{_0x1a1a5a=0xce;}_0x2fb6d8[_0xf918('0x17')](_0x1a1a5a);return _0x2fb6d8[_0xf918('0x1e')]('Content-Range',_0x4144f8+'-'+_0x5dd1e8+'/'+_0x3086c5)[_0xf918('0x19')](_0x59afe1);}return null;};}function patchUpdates(_0x1585cc){return function(_0x4a0348){try{jsonpatch[_0xf918('0x1f')](_0x4a0348,_0x1585cc,!![]);}catch(_0x259f93){return BPromise['reject'](_0x259f93);}return _0x4a0348['save']();};}function saveUpdates(_0x275541,_0x5d1c97){return function(_0x287f65){if(_0x287f65){return _0x287f65[_0xf918('0x20')](_0x275541)[_0xf918('0x21')](function(_0xb0561){return _0xb0561;});}return null;};}function removeEntity(_0x47cdc8,_0xaaada1){return function(_0x55fd88){if(_0x55fd88){return _0x55fd88['destroy']()[_0xf918('0x21')](function(){_0x47cdc8[_0xf918('0x17')](0xcc)[_0xf918('0x18')]();});}};}function handleEntityNotFound(_0x181170,_0x2d597b){return function(_0x3c6865){if(!_0x3c6865){_0x181170['sendStatus'](0x194);}return _0x3c6865;};}function handleError(_0x2a3958,_0x229a61){_0x229a61=_0x229a61||0x1f4;return function(_0x4959a2){logger['error'](_0x4959a2[_0xf918('0x22')]);if(_0x4959a2[_0xf918('0x23')]){delete _0x4959a2[_0xf918('0x23')];}_0x2a3958[_0xf918('0x17')](_0x229a61)[_0xf918('0x24')](_0x4959a2);};}exports[_0xf918('0x25')]=function(_0x59a2ad,_0x463897){var _0x5b23f0={},_0x158646={},_0x2c8d66={'count':0x0,'rows':[]};var _0x141a6e=_[_0xf918('0x26')](db['DeskConfiguration'][_0xf918('0x27')],function(_0x57af10){return{'name':_0x57af10['fieldName'],'type':_0x57af10[_0xf918('0x28')][_0xf918('0x29')]};});_0x158646[_0xf918('0x2a')]=_[_0xf918('0x26')](_0x141a6e,_0xf918('0x23'));_0x158646['query']=_[_0xf918('0x2b')](_0x59a2ad[_0xf918('0x2c')]);_0x158646[_0xf918('0x2d')]=_[_0xf918('0x2e')](_0x158646[_0xf918('0x2a')],_0x158646[_0xf918('0x2c')]);_0x5b23f0[_0xf918('0x2f')]=_[_0xf918('0x2e')](_0x158646['model'],qs[_0xf918('0x30')](_0x59a2ad[_0xf918('0x2c')][_0xf918('0x30')]));_0x5b23f0[_0xf918('0x2f')]=_0x5b23f0[_0xf918('0x2f')][_0xf918('0x31')]?_0x5b23f0[_0xf918('0x2f')]:_0x158646['model'];if(!_0x59a2ad[_0xf918('0x2c')][_0xf918('0x32')]('nolimit')){_0x5b23f0[_0xf918('0x1c')]=qs[_0xf918('0x1c')](_0x59a2ad['query'][_0xf918('0x1c')]);_0x5b23f0[_0xf918('0x1a')]=qs['offset'](_0x59a2ad[_0xf918('0x2c')][_0xf918('0x1a')]);}_0x5b23f0[_0xf918('0x33')]=qs[_0xf918('0x34')](_0x59a2ad['query'][_0xf918('0x34')]);_0x5b23f0['where']=qs['filters'](_[_0xf918('0x35')](_0x59a2ad['query'],_0x158646['filters']),_0x141a6e);if(_0x59a2ad[_0xf918('0x2c')][_0xf918('0x36')]){_0x5b23f0[_0xf918('0x37')]=_[_0xf918('0x38')](_0x5b23f0[_0xf918('0x37')],{'$or':_[_0xf918('0x26')](_0x141a6e,function(_0x1aaa5d){if(_0x1aaa5d[_0xf918('0x28')]!==_0xf918('0x39')){var _0x5050b4={};_0x5050b4[_0x1aaa5d[_0xf918('0x23')]]={'$like':'%'+_0x59a2ad[_0xf918('0x2c')]['filter']+'%'};return _0x5050b4;}})});}_0x5b23f0=_['merge']({},_0x5b23f0,_0x59a2ad[_0xf918('0x3a')]);var _0x454059={'where':_0x5b23f0['where']};return db[_0xf918('0x3b')]['count'](_0x454059)[_0xf918('0x21')](function(_0x47f4f0){_0x2c8d66[_0xf918('0x1d')]=_0x47f4f0;if(_0x59a2ad[_0xf918('0x2c')][_0xf918('0x3c')]){_0x5b23f0['include']=[{'all':!![]}];}return db['DeskConfiguration'][_0xf918('0x3d')](_0x5b23f0);})['then'](function(_0x1aaab1){_0x2c8d66['rows']=_0x1aaab1;return _0x2c8d66;})[_0xf918('0x21')](respondWithFilteredResult(_0x463897,_0x5b23f0))[_0xf918('0x3e')](handleError(_0x463897,null));};exports[_0xf918('0x3f')]=function(_0x257abb,_0x28e9bd){var _0xb834ff={'raw':![],'where':{'id':_0x257abb[_0xf918('0x40')]['id']}},_0x5be136={};_0x5be136[_0xf918('0x2a')]=_['keys'](db['DeskConfiguration'][_0xf918('0x27')]);_0x5be136[_0xf918('0x2c')]=_[_0xf918('0x2b')](_0x257abb['query']);_0x5be136[_0xf918('0x2d')]=_['intersection'](_0x5be136[_0xf918('0x2a')],_0x5be136[_0xf918('0x2c')]);_0xb834ff[_0xf918('0x2f')]=_[_0xf918('0x2e')](_0x5be136[_0xf918('0x2a')],qs['fields'](_0x257abb[_0xf918('0x2c')][_0xf918('0x30')]));_0xb834ff[_0xf918('0x2f')]=_0xb834ff[_0xf918('0x2f')]['length']?_0xb834ff[_0xf918('0x2f')]:_0x5be136[_0xf918('0x2a')];if(_0x257abb[_0xf918('0x2c')][_0xf918('0x3c')]){_0xb834ff[_0xf918('0x41')]=[{'all':!![]}];}_0xb834ff=_[_0xf918('0x38')]({},_0xb834ff,_0x257abb['options']);return db['DeskConfiguration']['find'](_0xb834ff)[_0xf918('0x21')](handleEntityNotFound(_0x28e9bd,null))[_0xf918('0x21')](respondWithResult(_0x28e9bd,null))[_0xf918('0x3e')](handleError(_0x28e9bd,null));};exports[_0xf918('0x42')]=function(_0x485aca,_0x263f74){return db['DeskConfiguration'][_0xf918('0x42')](_0x485aca[_0xf918('0x43')],{})[_0xf918('0x21')](respondWithResult(_0x263f74,0xc9))['catch'](handleError(_0x263f74,null));};exports['update']=function(_0x4f3aa9,_0x1ca0d9){if(_0x4f3aa9[_0xf918('0x43')]['id']){delete _0x4f3aa9[_0xf918('0x43')]['id'];}return db['DeskConfiguration'][_0xf918('0x44')]({'where':{'id':_0x4f3aa9[_0xf918('0x40')]['id']}})[_0xf918('0x21')](handleEntityNotFound(_0x1ca0d9,null))[_0xf918('0x21')](saveUpdates(_0x4f3aa9[_0xf918('0x43')],null))[_0xf918('0x21')](respondWithResult(_0x1ca0d9,null))[_0xf918('0x3e')](handleError(_0x1ca0d9,null));};exports[_0xf918('0x45')]=function(_0x2aad86,_0xac4c06){return db['DeskConfiguration'][_0xf918('0x44')]({'where':{'id':_0x2aad86[_0xf918('0x40')]['id']}})[_0xf918('0x21')](handleEntityNotFound(_0xac4c06,null))[_0xf918('0x21')](removeEntity(_0xac4c06,null))[_0xf918('0x3e')](handleError(_0xac4c06,null));};exports['getFields']=function(_0x8bc87e,_0x2e8cc2,_0x57034f){var _0x5133e3={};var _0x5e8769={};var _0x2dd849;var _0x58db01;return db[_0xf918('0x3b')]['findOne']({'where':{'id':_0x8bc87e[_0xf918('0x40')]['id']}})['then'](handleEntityNotFound(_0x2e8cc2,null))[_0xf918('0x21')](function(_0x8c71a8){if(_0x8c71a8){_0x2dd849=_0x8c71a8;_0x5e8769[_0xf918('0x2a')]=_[_0xf918('0x2b')](db[_0xf918('0x46')]['rawAttributes']);_0x5e8769['query']=_['keys'](_0x8bc87e[_0xf918('0x2c')]);_0x5e8769[_0xf918('0x2d')]=_[_0xf918('0x2e')](_0x5e8769['model'],_0x5e8769[_0xf918('0x2c')]);_0x5133e3[_0xf918('0x2f')]=_[_0xf918('0x2e')](_0x5e8769[_0xf918('0x2a')],qs[_0xf918('0x30')](_0x8bc87e[_0xf918('0x2c')][_0xf918('0x30')]));_0x5133e3[_0xf918('0x2f')]=_0x5133e3[_0xf918('0x2f')][_0xf918('0x31')]?_0x5133e3['attributes']:_0x5e8769['model'];_0x5133e3[_0xf918('0x33')]=qs[_0xf918('0x34')](_0x8bc87e[_0xf918('0x2c')][_0xf918('0x34')]);_0x5133e3[_0xf918('0x37')]=qs[_0xf918('0x2d')](_[_0xf918('0x35')](_0x8bc87e[_0xf918('0x2c')],_0x5e8769['filters']));if(_0x8bc87e[_0xf918('0x2c')][_0xf918('0x36')]){_0x5133e3[_0xf918('0x37')]=_[_0xf918('0x38')](_0x5133e3[_0xf918('0x37')],{'$or':_[_0xf918('0x26')](_0x5133e3[_0xf918('0x2f')],function(_0x2754b7){var _0x4a0ed5={};_0x4a0ed5[_0x2754b7]={'$like':'%'+_0x8bc87e['query'][_0xf918('0x36')]+'%'};return _0x4a0ed5;})});}_0x5133e3=_['merge']({},_0x5133e3,_0x8bc87e[_0xf918('0x3a')]);return _0x2dd849[_0xf918('0x47')](_0x5133e3);}})[_0xf918('0x21')](function(_0x4041cf){if(_0x4041cf){_0x58db01=_0x4041cf['length'];if(!_0x8bc87e[_0xf918('0x2c')]['hasOwnProperty'](_0xf918('0x48'))){_0x5133e3['limit']=qs[_0xf918('0x1c')](_0x8bc87e[_0xf918('0x2c')][_0xf918('0x1c')]);_0x5133e3[_0xf918('0x1a')]=qs[_0xf918('0x1a')](_0x8bc87e[_0xf918('0x2c')][_0xf918('0x1a')]);}return _0x2dd849[_0xf918('0x47')](_0x5133e3);}})[_0xf918('0x21')](function(_0x436602){if(_0x436602){return _0x436602?{'count':_0x58db01,'rows':_0x436602}:null;}})[_0xf918('0x21')](respondWithResult(_0x2e8cc2,null))[_0xf918('0x3e')](handleError(_0x2e8cc2,null));};exports['getSubjects']=function(_0x30900f,_0x707a80,_0x1d6c22){var _0x420703={};var _0x5ad6ac={};var _0x2efb56;var _0x4ffa5a;return db[_0xf918('0x3b')]['findOne']({'where':{'id':_0x30900f[_0xf918('0x40')]['id']}})[_0xf918('0x21')](handleEntityNotFound(_0x707a80,null))[_0xf918('0x21')](function(_0x41f9c6){if(_0x41f9c6){_0x2efb56=_0x41f9c6;_0x5ad6ac['model']=_['keys'](db[_0xf918('0x46')]['rawAttributes']);_0x5ad6ac[_0xf918('0x2c')]=_[_0xf918('0x2b')](_0x30900f['query']);_0x5ad6ac[_0xf918('0x2d')]=_[_0xf918('0x2e')](_0x5ad6ac['model'],_0x5ad6ac[_0xf918('0x2c')]);_0x420703[_0xf918('0x2f')]=_['intersection'](_0x5ad6ac[_0xf918('0x2a')],qs['fields'](_0x30900f[_0xf918('0x2c')][_0xf918('0x30')]));_0x420703[_0xf918('0x2f')]=_0x420703['attributes'][_0xf918('0x31')]?_0x420703[_0xf918('0x2f')]:_0x5ad6ac['model'];_0x420703[_0xf918('0x33')]=qs[_0xf918('0x34')](_0x30900f[_0xf918('0x2c')][_0xf918('0x34')]);_0x420703[_0xf918('0x37')]=qs[_0xf918('0x2d')](_[_0xf918('0x35')](_0x30900f[_0xf918('0x2c')],_0x5ad6ac[_0xf918('0x2d')]));if(_0x30900f[_0xf918('0x2c')]['filter']){_0x420703['where']=_['merge'](_0x420703['where'],{'$or':_[_0xf918('0x26')](_0x420703[_0xf918('0x2f')],function(_0x46a6bf){var _0x11ee5a={};_0x11ee5a[_0x46a6bf]={'$like':'%'+_0x30900f['query'][_0xf918('0x36')]+'%'};return _0x11ee5a;})});}_0x420703=_[_0xf918('0x38')]({},_0x420703,_0x30900f['options']);return _0x2efb56[_0xf918('0x49')](_0x420703);}})['then'](function(_0x1a853b){if(_0x1a853b){_0x4ffa5a=_0x1a853b['length'];if(!_0x30900f[_0xf918('0x2c')][_0xf918('0x32')](_0xf918('0x48'))){_0x420703[_0xf918('0x1c')]=qs[_0xf918('0x1c')](_0x30900f[_0xf918('0x2c')]['limit']);_0x420703[_0xf918('0x1a')]=qs[_0xf918('0x1a')](_0x30900f[_0xf918('0x2c')][_0xf918('0x1a')]);}return _0x2efb56[_0xf918('0x49')](_0x420703);}})[_0xf918('0x21')](function(_0x30e1db){if(_0x30e1db){return _0x30e1db?{'count':_0x4ffa5a,'rows':_0x30e1db}:null;}})[_0xf918('0x21')](respondWithResult(_0x707a80,null))[_0xf918('0x3e')](handleError(_0x707a80,null));};exports['getDescriptions']=function(_0x1680f4,_0x3b74e9,_0x4d1ebd){var _0x44a93a={};var _0x3aff7f={};var _0x2762dc;var _0x28a8e0;return db[_0xf918('0x3b')][_0xf918('0x4a')]({'where':{'id':_0x1680f4['params']['id']}})[_0xf918('0x21')](handleEntityNotFound(_0x3b74e9,null))[_0xf918('0x21')](function(_0x38734a){if(_0x38734a){_0x2762dc=_0x38734a;_0x3aff7f[_0xf918('0x2a')]=_['keys'](db['DeskField'][_0xf918('0x27')]);_0x3aff7f[_0xf918('0x2c')]=_['keys'](_0x1680f4[_0xf918('0x2c')]);_0x3aff7f[_0xf918('0x2d')]=_[_0xf918('0x2e')](_0x3aff7f['model'],_0x3aff7f[_0xf918('0x2c')]);_0x44a93a['attributes']=_['intersection'](_0x3aff7f['model'],qs['fields'](_0x1680f4[_0xf918('0x2c')][_0xf918('0x30')]));_0x44a93a['attributes']=_0x44a93a['attributes'][_0xf918('0x31')]?_0x44a93a[_0xf918('0x2f')]:_0x3aff7f['model'];_0x44a93a[_0xf918('0x33')]=qs[_0xf918('0x34')](_0x1680f4[_0xf918('0x2c')][_0xf918('0x34')]);_0x44a93a[_0xf918('0x37')]=qs[_0xf918('0x2d')](_[_0xf918('0x35')](_0x1680f4[_0xf918('0x2c')],_0x3aff7f['filters']));if(_0x1680f4[_0xf918('0x2c')][_0xf918('0x36')]){_0x44a93a[_0xf918('0x37')]=_[_0xf918('0x38')](_0x44a93a['where'],{'$or':_['map'](_0x44a93a['attributes'],function(_0x4c978f){var _0x446838={};_0x446838[_0x4c978f]={'$like':'%'+_0x1680f4[_0xf918('0x2c')][_0xf918('0x36')]+'%'};return _0x446838;})});}_0x44a93a=_[_0xf918('0x38')]({},_0x44a93a,_0x1680f4['options']);return _0x2762dc[_0xf918('0x4b')](_0x44a93a);}})['then'](function(_0x1b5b81){if(_0x1b5b81){_0x28a8e0=_0x1b5b81[_0xf918('0x31')];if(!_0x1680f4['query'][_0xf918('0x32')]('nolimit')){_0x44a93a[_0xf918('0x1c')]=qs[_0xf918('0x1c')](_0x1680f4['query'][_0xf918('0x1c')]);_0x44a93a[_0xf918('0x1a')]=qs['offset'](_0x1680f4[_0xf918('0x2c')][_0xf918('0x1a')]);}return _0x2762dc[_0xf918('0x4b')](_0x44a93a);}})[_0xf918('0x21')](function(_0x23247c){if(_0x23247c){return _0x23247c?{'count':_0x28a8e0,'rows':_0x23247c}:null;}})['then'](respondWithResult(_0x3b74e9,null))[_0xf918('0x3e')](handleError(_0x3b74e9,null));};exports['getTags']=function(_0x587260,_0x1b5c75,_0x4cb616){var _0x35bc67={};var _0x441f96={};var _0x59b037;var _0x534926;return db[_0xf918('0x3b')][_0xf918('0x4a')]({'where':{'id':_0x587260[_0xf918('0x40')]['id']}})[_0xf918('0x21')](handleEntityNotFound(_0x1b5c75,null))['then'](function(_0x455321){if(_0x455321){_0x59b037=_0x455321;_0x441f96[_0xf918('0x2a')]=_['keys'](db[_0xf918('0x4c')][_0xf918('0x27')]);_0x441f96['query']=_['keys'](_0x587260[_0xf918('0x2c')]);_0x441f96[_0xf918('0x2d')]=_[_0xf918('0x2e')](_0x441f96[_0xf918('0x2a')],_0x441f96[_0xf918('0x2c')]);_0x35bc67[_0xf918('0x2f')]=_[_0xf918('0x2e')](_0x441f96[_0xf918('0x2a')],qs[_0xf918('0x30')](_0x587260[_0xf918('0x2c')][_0xf918('0x30')]));_0x35bc67[_0xf918('0x2f')]=_0x35bc67['attributes'][_0xf918('0x31')]?_0x35bc67[_0xf918('0x2f')]:_0x441f96[_0xf918('0x2a')];_0x35bc67[_0xf918('0x33')]=qs[_0xf918('0x34')](_0x587260[_0xf918('0x2c')][_0xf918('0x34')]);_0x35bc67[_0xf918('0x37')]=qs[_0xf918('0x2d')](_[_0xf918('0x35')](_0x587260['query'],_0x441f96['filters']));if(_0x587260[_0xf918('0x2c')]['filter']){_0x35bc67['where']=_['merge'](_0x35bc67[_0xf918('0x37')],{'$or':_[_0xf918('0x26')](_0x35bc67[_0xf918('0x2f')],function(_0x287d43){var _0x520d8b={};_0x520d8b[_0x287d43]={'$like':'%'+_0x587260[_0xf918('0x2c')]['filter']+'%'};return _0x520d8b;})});}_0x35bc67=_[_0xf918('0x38')]({},_0x35bc67,_0x587260[_0xf918('0x3a')]);return _0x59b037[_0xf918('0x4d')](_0x35bc67);}})[_0xf918('0x21')](function(_0x5667eb){if(_0x5667eb){_0x534926=_0x5667eb[_0xf918('0x31')];if(!_0x587260[_0xf918('0x2c')][_0xf918('0x32')](_0xf918('0x48'))){_0x35bc67[_0xf918('0x1c')]=qs[_0xf918('0x1c')](_0x587260['query'][_0xf918('0x1c')]);_0x35bc67['offset']=qs[_0xf918('0x1a')](_0x587260[_0xf918('0x2c')][_0xf918('0x1a')]);}return _0x59b037['getTags'](_0x35bc67);}})[_0xf918('0x21')](function(_0x5a5493){if(_0x5a5493){return _0x5a5493?{'count':_0x534926,'rows':_0x5a5493}:null;}})[_0xf918('0x21')](respondWithResult(_0x1b5c75,null))[_0xf918('0x3e')](handleError(_0x1b5c75,null));};exports[_0xf918('0x4e')]=function(_0x1f5915,_0x2c8e24,_0x1598dd){if(_0x1f5915[_0xf918('0x43')]['id']){delete _0x1f5915['body']['id'];}return db['DeskConfiguration']['findOne']({'where':{'id':_0x1f5915[_0xf918('0x40')]['id']}})[_0xf918('0x21')](handleEntityNotFound(_0x2c8e24,null))[_0xf918('0x21')](function(_0x5e2b6a){if(_0x5e2b6a){return _0x5e2b6a[_0xf918('0x4e')](_0x1f5915['body'][_0xf918('0x4f')]||[]);}return null;})[_0xf918('0x21')](respondWithResult(_0x2c8e24,null))['catch'](handleError(_0x2c8e24,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 905e239..7e1cc66 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 _0x8396=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations','util','../../config/logger'];(function(_0x5ab798,_0x5dca4a){var _0x1626c7=function(_0x23ffe7){while(--_0x23ffe7){_0x5ab798['push'](_0x5ab798['shift']());}};_0x1626c7(++_0x5dca4a);}(_0x8396,0x116));var _0x6839=function(_0x3cd9ee,_0xa0a743){_0x3cd9ee=_0x3cd9ee-0x0;var _0x90b0e4=_0x8396[_0x3cd9ee];return _0x90b0e4;};'use strict';var _=require('lodash');var util=require(_0x6839('0x0'));var logger=require(_0x6839('0x1'))(_0x6839('0x2'));var moment=require(_0x6839('0x3'));var BPromise=require(_0x6839('0x4'));var rp=require(_0x6839('0x5'));var fs=require('fs');var path=require(_0x6839('0x6'));var rimraf=require(_0x6839('0x7'));var config=require(_0x6839('0x8'));var attributes=require(_0x6839('0x9'));module[_0x6839('0xa')]=function(_0x4f3dcd,_0xbb1cf3){return _0x4f3dcd[_0x6839('0xb')](_0x6839('0xc'),attributes,{'tableName':_0x6839('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfce5=['define','int_desk_configurations','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports'];(function(_0xf0ec6e,_0xa183d3){var _0x8bbc27=function(_0x39822b){while(--_0x39822b){_0xf0ec6e['push'](_0xf0ec6e['shift']());}};_0x8bbc27(++_0xa183d3);}(_0xfce5,0x70));var _0x5fce=function(_0x31c6b6,_0xdd33b7){_0x31c6b6=_0x31c6b6-0x0;var _0x32b27b=_0xfce5[_0x31c6b6];return _0x32b27b;};'use strict';var _=require('lodash');var util=require(_0x5fce('0x0'));var logger=require(_0x5fce('0x1'))(_0x5fce('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5fce('0x3'));var fs=require('fs');var path=require(_0x5fce('0x4'));var rimraf=require(_0x5fce('0x5'));var config=require(_0x5fce('0x6'));var attributes=require(_0x5fce('0x7'));module[_0x5fce('0x8')]=function(_0x1c7486,_0x4abcb0){return _0x1c7486[_0x5fce('0x9')]('DeskConfiguration',attributes,{'tableName':_0x5fce('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index 46e2b72..ac8c0bd 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 _0xb96d=['then','DeskConfiguration,\x20%s,\x20%s','request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http'];(function(_0x4cd8b8,_0x34a9e7){var _0x5b8b68=function(_0x6979a4){while(--_0x6979a4){_0x4cd8b8['push'](_0x4cd8b8['shift']());}};_0x5b8b68(++_0x34a9e7);}(_0xb96d,0x9e));var _0xdb96=function(_0x408e38,_0x23cda8){_0x408e38=_0x408e38-0x0;var _0x426b0e=_0xb96d[_0x408e38];return _0x426b0e;};'use strict';var _=require('lodash');var util=require(_0xdb96('0x0'));var moment=require(_0xdb96('0x1'));var BPromise=require(_0xdb96('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdb96('0x3'));var db=require(_0xdb96('0x4'))['db'];var utils=require(_0xdb96('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xdb96('0x6'));var jayson=require(_0xdb96('0x7'));var client=jayson[_0xdb96('0x8')][_0xdb96('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4f5e6f,_0x294084,_0x571e0e){return new BPromise(function(_0x5e2e95,_0x3384b4){return client['request'](_0x4f5e6f,_0x571e0e)[_0xdb96('0xa')](function(_0xaea492){logger['info'](_0xdb96('0xb'),_0x294084,_0xdb96('0xc'));logger['debug'](_0xdb96('0xd'),_0x294084,_0xdb96('0xc'),JSON[_0xdb96('0xe')](_0xaea492));if(_0xaea492[_0xdb96('0xf')]){if(_0xaea492['error'][_0xdb96('0x10')]===0x1f4){logger[_0xdb96('0xf')](_0xdb96('0xb'),_0x294084,_0xaea492['error'][_0xdb96('0x11')]);return _0x3384b4(_0xaea492[_0xdb96('0xf')][_0xdb96('0x11')]);}logger[_0xdb96('0xf')](_0xdb96('0xb'),_0x294084,_0xaea492[_0xdb96('0xf')][_0xdb96('0x11')]);return _0x5e2e95(_0xaea492[_0xdb96('0xf')][_0xdb96('0x11')]);}else{logger[_0xdb96('0x12')](_0xdb96('0xb'),_0x294084,_0xdb96('0xc'));_0x5e2e95(_0xaea492[_0xdb96('0x13')]['message']);}})[_0xdb96('0x14')](function(_0x2a766e){logger[_0xdb96('0xf')](_0xdb96('0xb'),_0x294084,_0x2a766e);_0x3384b4(_0x2a766e);});});} \ No newline at end of file +var _0x90d2=['../../config/environment','jayson/promise','client','http','request','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','randomstring','../../mysqldb','../../config/logger','rpc'];(function(_0x2df018,_0x9f7f98){var _0x5f3a8a=function(_0x26aad6){while(--_0x26aad6){_0x2df018['push'](_0x2df018['shift']());}};_0x5f3a8a(++_0x9f7f98);}(_0x90d2,0x86));var _0x290d=function(_0x30066f,_0x5891c9){_0x30066f=_0x30066f-0x0;var _0x1ad673=_0x90d2[_0x30066f];return _0x1ad673;};'use strict';var _=require(_0x290d('0x0'));var util=require(_0x290d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x290d('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x290d('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x290d('0x4'))(_0x290d('0x5'));var config=require(_0x290d('0x6'));var jayson=require(_0x290d('0x7'));var client=jayson[_0x290d('0x8')][_0x290d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x416f5b,_0x4eeddf,_0x3aeb85){return new BPromise(function(_0x286134,_0x2fe9f7){return client[_0x290d('0xa')](_0x416f5b,_0x3aeb85)['then'](function(_0x49860c){logger[_0x290d('0xb')](_0x290d('0xc'),_0x4eeddf,_0x290d('0xd'));logger[_0x290d('0xe')](_0x290d('0xf'),_0x4eeddf,_0x290d('0xd'),JSON['stringify'](_0x49860c));if(_0x49860c[_0x290d('0x10')]){if(_0x49860c['error'][_0x290d('0x11')]===0x1f4){logger[_0x290d('0x10')](_0x290d('0xc'),_0x4eeddf,_0x49860c[_0x290d('0x10')]['message']);return _0x2fe9f7(_0x49860c[_0x290d('0x10')][_0x290d('0x12')]);}logger[_0x290d('0x10')](_0x290d('0xc'),_0x4eeddf,_0x49860c[_0x290d('0x10')][_0x290d('0x12')]);return _0x286134(_0x49860c[_0x290d('0x10')][_0x290d('0x12')]);}else{logger['info'](_0x290d('0xc'),_0x4eeddf,_0x290d('0xd'));_0x286134(_0x49860c[_0x290d('0x13')][_0x290d('0x12')]);}})['catch'](function(_0x49c7d5){logger[_0x290d('0x10')]('DeskConfiguration,\x20%s,\x20%s',_0x4eeddf,_0x49c7d5);_0x2fe9f7(_0x49c7d5);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index a8ed580..cd89ae1 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 _0x9b94=['put','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','/:id','show','create'];(function(_0x2affc0,_0x4cb6f9){var _0xb24c3c=function(_0xab9811){while(--_0xab9811){_0x2affc0['push'](_0x2affc0['shift']());}};_0xb24c3c(++_0x4cb6f9);}(_0x9b94,0x135));var _0x49b9=function(_0x2f6f57,_0x4aa3b1){_0x2f6f57=_0x2f6f57-0x0;var _0xa52006=_0x9b94[_0x2f6f57];return _0xa52006;};'use strict';var multer=require(_0x49b9('0x0'));var util=require(_0x49b9('0x1'));var path=require(_0x49b9('0x2'));var timeout=require(_0x49b9('0x3'));var express=require('express');var router=express[_0x49b9('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x49b9('0x5'));var interaction=require(_0x49b9('0x6'));var config=require(_0x49b9('0x7'));var controller=require(_0x49b9('0x8'));router[_0x49b9('0x9')]('/',auth[_0x49b9('0xa')](),controller['index']);router[_0x49b9('0x9')](_0x49b9('0xb'),auth[_0x49b9('0xa')](),controller[_0x49b9('0xc')]);router['post']('/',auth[_0x49b9('0xa')](),controller[_0x49b9('0xd')]);router[_0x49b9('0xe')](_0x49b9('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x49b9('0xf')](_0x49b9('0xb'),auth['isAuthenticated'](),controller[_0x49b9('0x10')]);module['exports']=router; \ No newline at end of file +var _0xcb03=['index','show','post','put','/:id','update','delete','destroy','exports','connect-timeout','../../components/auth/service','../../config/environment','get','isAuthenticated'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0xcb03,0x19f));var _0x3cb0=function(_0x86c9ef,_0x2e453f){_0x86c9ef=_0x86c9ef-0x0;var _0x23460e=_0xcb03[_0x86c9ef];return _0x23460e;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x3cb0('0x0'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x3cb0('0x1'));var interaction=require('../../components/interaction/service');var config=require(_0x3cb0('0x2'));var controller=require('./intDeskField.controller');router[_0x3cb0('0x3')]('/',auth[_0x3cb0('0x4')](),controller[_0x3cb0('0x5')]);router[_0x3cb0('0x3')]('/:id',auth[_0x3cb0('0x4')](),controller[_0x3cb0('0x6')]);router[_0x3cb0('0x7')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3cb0('0x8')](_0x3cb0('0x9'),auth[_0x3cb0('0x4')](),controller[_0x3cb0('0xa')]);router[_0x3cb0('0xb')](_0x3cb0('0x9'),auth[_0x3cb0('0x4')](),controller[_0x3cb0('0xc')]);module[_0x3cb0('0xd')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 5cec39d..74befd6 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 _0x7e23=['sequelize','exports','ENUM','string','variable','customVariable','picklist','STRING','BOOLEAN'];(function(_0x53b594,_0x559767){var _0x1e616f=function(_0x333eda){while(--_0x333eda){_0x53b594['push'](_0x53b594['shift']());}};_0x1e616f(++_0x559767);}(_0x7e23,0x14d));var _0x37e2=function(_0x5bb9fc,_0x8c0721){_0x5bb9fc=_0x5bb9fc-0x0;var _0xf2c107=_0x7e23[_0x5bb9fc];return _0xf2c107;};'use strict';var Sequelize=require(_0x37e2('0x0'));module[_0x37e2('0x1')]={'type':{'type':Sequelize[_0x37e2('0x2')](_0x37e2('0x3'),_0x37e2('0x4'),_0x37e2('0x5'),'keyValue',_0x37e2('0x6')),'defaultValue':_0x37e2('0x3')},'content':{'type':Sequelize[_0x37e2('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x37e2('0x3'),'variable',_0x37e2('0x5'))},'keyContent':{'type':Sequelize[_0x37e2('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x37e2('0x7')]},'customField':{'type':Sequelize[_0x37e2('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x37e2('0x7')]}}; \ No newline at end of file +var _0x030c=['keyValue','STRING','customVariable','BOOLEAN','sequelize','exports','ENUM','string','variable'];(function(_0x118afa,_0x4bf0c1){var _0x167d76=function(_0x2c529b){while(--_0x2c529b){_0x118afa['push'](_0x118afa['shift']());}};_0x167d76(++_0x4bf0c1);}(_0x030c,0x1e1));var _0xc030=function(_0x1f0ca6,_0x3a7cfc){_0x1f0ca6=_0x1f0ca6-0x0;var _0x51fc6e=_0x030c[_0x1f0ca6];return _0x51fc6e;};'use strict';var Sequelize=require(_0xc030('0x0'));module[_0xc030('0x1')]={'type':{'type':Sequelize[_0xc030('0x2')](_0xc030('0x3'),_0xc030('0x4'),'customVariable',_0xc030('0x5'),'picklist'),'defaultValue':_0xc030('0x3')},'content':{'type':Sequelize[_0xc030('0x6')]},'key':{'type':Sequelize[_0xc030('0x6')]},'keyType':{'type':Sequelize['ENUM']('string','variable',_0xc030('0x7'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xc030('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 5b26e0c..b125291 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 _0x3914=['order','sort','where','pick','filter','VIRTUAL','merge','include','findAll','rows','catch','params','rawAttributes','intersection','includeAll','find','create','body','destroy','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','apply','reject','save','update','then','end','error','send','index','map','DeskField','fieldName','type','key','model','name','query','keys','filters','attributes','fields','length','nolimit'];(function(_0x213b27,_0x3a531a){var _0x2c04ee=function(_0x538d00){while(--_0x538d00){_0x213b27['push'](_0x213b27['shift']());}};_0x2c04ee(++_0x3a531a);}(_0x3914,0xeb));var _0x4391=function(_0x9729d7,_0x1b79a8){_0x9729d7=_0x9729d7-0x0;var _0x3c4ac6=_0x3914[_0x9729d7];return _0x3c4ac6;};'use strict';var emlformat=require(_0x4391('0x0'));var rimraf=require(_0x4391('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4391('0x2'));var rp=require(_0x4391('0x3'));var moment=require('moment');var BPromise=require(_0x4391('0x4'));var Mustache=require(_0x4391('0x5'));var util=require(_0x4391('0x6'));var path=require('path');var sox=require(_0x4391('0x7'));var csv=require(_0x4391('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4391('0x9'));var _=require('lodash');var squel=require(_0x4391('0xa'));var crypto=require('crypto');var jsforce=require(_0x4391('0xb'));var deskjs=require(_0x4391('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4391('0xd'));var Redis=require(_0x4391('0xe'));var authService=require(_0x4391('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x4391('0x10'));var hardwareService=require(_0x4391('0x11'));var logger=require(_0x4391('0x12'))(_0x4391('0x13'));var utils=require('../../config/utils');var config=require(_0x4391('0x14'));var licenseUtil=require(_0x4391('0x15'));var db=require(_0x4391('0x16'))['db'];function respondWithStatusCode(_0x137902,_0x254ffb){_0x254ffb=_0x254ffb||0xcc;return function(_0xdebb72){if(_0xdebb72){return _0x137902[_0x4391('0x17')](_0x254ffb);}return _0x137902[_0x4391('0x18')](_0x254ffb)['end']();};}function respondWithResult(_0x1a49ba,_0x3bd3a7){_0x3bd3a7=_0x3bd3a7||0xc8;return function(_0x3f82fb){if(_0x3f82fb){return _0x1a49ba[_0x4391('0x18')](_0x3bd3a7)['json'](_0x3f82fb);}};}function respondWithFilteredResult(_0x62c763,_0x4ff882){return function(_0x343203){if(_0x343203){var _0x3a1b80=typeof _0x4ff882[_0x4391('0x19')]===_0x4391('0x1a')&&typeof _0x4ff882[_0x4391('0x1b')]===_0x4391('0x1a');var _0x2b5117=_0x343203[_0x4391('0x1c')];var _0x58a311=_0x3a1b80?0x0:_0x4ff882['offset'];var _0x2ecb23=_0x3a1b80?_0x343203['count']:_0x4ff882[_0x4391('0x19')]+_0x4ff882[_0x4391('0x1b')];var _0xa9c97f;if(_0x2ecb23>=_0x2b5117){_0x2ecb23=_0x2b5117;_0xa9c97f=0xc8;}else{_0xa9c97f=0xce;}_0x62c763[_0x4391('0x18')](_0xa9c97f);return _0x62c763[_0x4391('0x1d')]('Content-Range',_0x58a311+'-'+_0x2ecb23+'/'+_0x2b5117)['json'](_0x343203);}return null;};}function patchUpdates(_0x36c34c){return function(_0x37fca4){try{jsonpatch[_0x4391('0x1e')](_0x37fca4,_0x36c34c,!![]);}catch(_0x5570a8){return BPromise[_0x4391('0x1f')](_0x5570a8);}return _0x37fca4[_0x4391('0x20')]();};}function saveUpdates(_0x737d10,_0x3e1e0b){return function(_0x505d2c){if(_0x505d2c){return _0x505d2c[_0x4391('0x21')](_0x737d10)[_0x4391('0x22')](function(_0x3c4c9b){return _0x3c4c9b;});}return null;};}function removeEntity(_0xfee343,_0x24e16c){return function(_0x40ff34){if(_0x40ff34){return _0x40ff34['destroy']()[_0x4391('0x22')](function(){_0xfee343[_0x4391('0x18')](0xcc)[_0x4391('0x23')]();});}};}function handleEntityNotFound(_0x333ca6,_0x540339){return function(_0x4b0c28){if(!_0x4b0c28){_0x333ca6[_0x4391('0x17')](0x194);}return _0x4b0c28;};}function handleError(_0x3aa79f,_0x3f2554){_0x3f2554=_0x3f2554||0x1f4;return function(_0x197408){logger[_0x4391('0x24')](_0x197408['stack']);if(_0x197408['name']){delete _0x197408['name'];}_0x3aa79f['status'](_0x3f2554)[_0x4391('0x25')](_0x197408);};}exports[_0x4391('0x26')]=function(_0x471d43,_0x2f7b18){var _0x49aa36={},_0x34059f={},_0x32ed74={'count':0x0,'rows':[]};var _0x115e36=_[_0x4391('0x27')](db[_0x4391('0x28')]['rawAttributes'],function(_0x1a8df0){return{'name':_0x1a8df0[_0x4391('0x29')],'type':_0x1a8df0[_0x4391('0x2a')][_0x4391('0x2b')]};});_0x34059f[_0x4391('0x2c')]=_[_0x4391('0x27')](_0x115e36,_0x4391('0x2d'));_0x34059f[_0x4391('0x2e')]=_[_0x4391('0x2f')](_0x471d43[_0x4391('0x2e')]);_0x34059f[_0x4391('0x30')]=_['intersection'](_0x34059f[_0x4391('0x2c')],_0x34059f['query']);_0x49aa36[_0x4391('0x31')]=_['intersection'](_0x34059f['model'],qs[_0x4391('0x32')](_0x471d43[_0x4391('0x2e')][_0x4391('0x32')]));_0x49aa36[_0x4391('0x31')]=_0x49aa36[_0x4391('0x31')][_0x4391('0x33')]?_0x49aa36[_0x4391('0x31')]:_0x34059f['model'];if(!_0x471d43[_0x4391('0x2e')]['hasOwnProperty'](_0x4391('0x34'))){_0x49aa36['limit']=qs[_0x4391('0x1b')](_0x471d43[_0x4391('0x2e')][_0x4391('0x1b')]);_0x49aa36[_0x4391('0x19')]=qs[_0x4391('0x19')](_0x471d43[_0x4391('0x2e')][_0x4391('0x19')]);}_0x49aa36[_0x4391('0x35')]=qs[_0x4391('0x36')](_0x471d43[_0x4391('0x2e')][_0x4391('0x36')]);_0x49aa36[_0x4391('0x37')]=qs[_0x4391('0x30')](_[_0x4391('0x38')](_0x471d43[_0x4391('0x2e')],_0x34059f[_0x4391('0x30')]),_0x115e36);if(_0x471d43[_0x4391('0x2e')][_0x4391('0x39')]){_0x49aa36['where']=_['merge'](_0x49aa36[_0x4391('0x37')],{'$or':_[_0x4391('0x27')](_0x115e36,function(_0x58e161){if(_0x58e161[_0x4391('0x2a')]!==_0x4391('0x3a')){var _0x1c716c={};_0x1c716c[_0x58e161[_0x4391('0x2d')]]={'$like':'%'+_0x471d43[_0x4391('0x2e')]['filter']+'%'};return _0x1c716c;}})});}_0x49aa36=_[_0x4391('0x3b')]({},_0x49aa36,_0x471d43['options']);var _0x5ec1cf={'where':_0x49aa36['where']};return db['DeskField'][_0x4391('0x1c')](_0x5ec1cf)[_0x4391('0x22')](function(_0x33736a){_0x32ed74[_0x4391('0x1c')]=_0x33736a;if(_0x471d43['query']['includeAll']){_0x49aa36[_0x4391('0x3c')]=[{'all':!![]}];}return db['DeskField'][_0x4391('0x3d')](_0x49aa36);})[_0x4391('0x22')](function(_0x3bfcdc){_0x32ed74[_0x4391('0x3e')]=_0x3bfcdc;return _0x32ed74;})[_0x4391('0x22')](respondWithFilteredResult(_0x2f7b18,_0x49aa36))[_0x4391('0x3f')](handleError(_0x2f7b18,null));};exports['show']=function(_0x2708e2,_0x3da701){var _0x361f44={'raw':!![],'where':{'id':_0x2708e2[_0x4391('0x40')]['id']}},_0x13f5f4={};_0x13f5f4[_0x4391('0x2c')]=_[_0x4391('0x2f')](db['DeskField'][_0x4391('0x41')]);_0x13f5f4[_0x4391('0x2e')]=_[_0x4391('0x2f')](_0x2708e2[_0x4391('0x2e')]);_0x13f5f4[_0x4391('0x30')]=_[_0x4391('0x42')](_0x13f5f4[_0x4391('0x2c')],_0x13f5f4['query']);_0x361f44[_0x4391('0x31')]=_['intersection'](_0x13f5f4[_0x4391('0x2c')],qs[_0x4391('0x32')](_0x2708e2[_0x4391('0x2e')][_0x4391('0x32')]));_0x361f44[_0x4391('0x31')]=_0x361f44[_0x4391('0x31')][_0x4391('0x33')]?_0x361f44[_0x4391('0x31')]:_0x13f5f4[_0x4391('0x2c')];if(_0x2708e2[_0x4391('0x2e')][_0x4391('0x43')]){_0x361f44[_0x4391('0x3c')]=[{'all':!![]}];}_0x361f44=_[_0x4391('0x3b')]({},_0x361f44,_0x2708e2['options']);return db['DeskField'][_0x4391('0x44')](_0x361f44)[_0x4391('0x22')](handleEntityNotFound(_0x3da701,null))[_0x4391('0x22')](respondWithResult(_0x3da701,null))[_0x4391('0x3f')](handleError(_0x3da701,null));};exports[_0x4391('0x45')]=function(_0x25c7f6,_0x4efc22){return db[_0x4391('0x28')]['create'](_0x25c7f6[_0x4391('0x46')],{})['then'](respondWithResult(_0x4efc22,0xc9))[_0x4391('0x3f')](handleError(_0x4efc22,null));};exports[_0x4391('0x21')]=function(_0x738d35,_0x1b07b2){if(_0x738d35[_0x4391('0x46')]['id']){delete _0x738d35[_0x4391('0x46')]['id'];}return db['DeskField'][_0x4391('0x44')]({'where':{'id':_0x738d35[_0x4391('0x40')]['id']}})[_0x4391('0x22')](handleEntityNotFound(_0x1b07b2,null))[_0x4391('0x22')](saveUpdates(_0x738d35[_0x4391('0x46')],null))[_0x4391('0x22')](respondWithResult(_0x1b07b2,null))[_0x4391('0x3f')](handleError(_0x1b07b2,null));};exports[_0x4391('0x47')]=function(_0x1ca698,_0x294498){return db[_0x4391('0x28')][_0x4391('0x44')]({'where':{'id':_0x1ca698[_0x4391('0x40')]['id']}})['then'](handleEntityNotFound(_0x294498,null))[_0x4391('0x22')](removeEntity(_0x294498,null))[_0x4391('0x3f')](handleError(_0x294498,null));}; \ No newline at end of file +var _0x8be8=['keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','find','create','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','save','update','then','destroy','error','stack','name','index','map','DeskField','rawAttributes','fieldName','type','model','query'];(function(_0x2c976f,_0x4bd2c4){var _0x1a1227=function(_0x24597e){while(--_0x24597e){_0x2c976f['push'](_0x2c976f['shift']());}};_0x1a1227(++_0x4bd2c4);}(_0x8be8,0xf6));var _0x88be=function(_0x211d9f,_0x529df2){_0x211d9f=_0x211d9f-0x0;var _0x94e2ed=_0x8be8[_0x211d9f];return _0x94e2ed;};'use strict';var emlformat=require(_0x88be('0x0'));var rimraf=require(_0x88be('0x1'));var zipdir=require(_0x88be('0x2'));var jsonpatch=require(_0x88be('0x3'));var rp=require(_0x88be('0x4'));var moment=require(_0x88be('0x5'));var BPromise=require(_0x88be('0x6'));var Mustache=require(_0x88be('0x7'));var util=require(_0x88be('0x8'));var path=require('path');var sox=require(_0x88be('0x9'));var csv=require('to-csv');var ejs=require(_0x88be('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x88be('0xb'));var squel=require(_0x88be('0xc'));var crypto=require(_0x88be('0xd'));var jsforce=require(_0x88be('0xe'));var deskjs=require(_0x88be('0xf'));var toCsv=require(_0x88be('0x10'));var querystring=require('querystring');var Papa=require(_0x88be('0x11'));var Redis=require('ioredis');var authService=require(_0x88be('0x12'));var qs=require(_0x88be('0x13'));var as=require(_0x88be('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x88be('0x15'))(_0x88be('0x16'));var utils=require(_0x88be('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x88be('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x321775,_0x484d78){_0x484d78=_0x484d78||0xcc;return function(_0x51ee23){if(_0x51ee23){return _0x321775[_0x88be('0x19')](_0x484d78);}return _0x321775[_0x88be('0x1a')](_0x484d78)[_0x88be('0x1b')]();};}function respondWithResult(_0x220d9f,_0x1f6f57){_0x1f6f57=_0x1f6f57||0xc8;return function(_0x209623){if(_0x209623){return _0x220d9f[_0x88be('0x1a')](_0x1f6f57)[_0x88be('0x1c')](_0x209623);}};}function respondWithFilteredResult(_0x4ec7cc,_0xefc67){return function(_0x94737d){if(_0x94737d){var _0x44a12f=typeof _0xefc67['offset']===_0x88be('0x1d')&&typeof _0xefc67[_0x88be('0x1e')]==='undefined';var _0x3566e7=_0x94737d[_0x88be('0x1f')];var _0xf43785=_0x44a12f?0x0:_0xefc67[_0x88be('0x20')];var _0x152918=_0x44a12f?_0x94737d[_0x88be('0x1f')]:_0xefc67[_0x88be('0x20')]+_0xefc67[_0x88be('0x1e')];var _0x53fb85;if(_0x152918>=_0x3566e7){_0x152918=_0x3566e7;_0x53fb85=0xc8;}else{_0x53fb85=0xce;}_0x4ec7cc[_0x88be('0x1a')](_0x53fb85);return _0x4ec7cc['set'](_0x88be('0x21'),_0xf43785+'-'+_0x152918+'/'+_0x3566e7)['json'](_0x94737d);}return null;};}function patchUpdates(_0x51c0e4){return function(_0x2fd77d){try{jsonpatch[_0x88be('0x22')](_0x2fd77d,_0x51c0e4,!![]);}catch(_0x4079f7){return BPromise['reject'](_0x4079f7);}return _0x2fd77d[_0x88be('0x23')]();};}function saveUpdates(_0x332e50,_0x1d0414){return function(_0x213580){if(_0x213580){return _0x213580[_0x88be('0x24')](_0x332e50)[_0x88be('0x25')](function(_0x466b19){return _0x466b19;});}return null;};}function removeEntity(_0x344c20,_0xdd27c1){return function(_0x215024){if(_0x215024){return _0x215024[_0x88be('0x26')]()[_0x88be('0x25')](function(){_0x344c20[_0x88be('0x1a')](0xcc)[_0x88be('0x1b')]();});}};}function handleEntityNotFound(_0x1c3e45,_0x2be310){return function(_0x5c1671){if(!_0x5c1671){_0x1c3e45[_0x88be('0x19')](0x194);}return _0x5c1671;};}function handleError(_0x1c9be2,_0x20c9de){_0x20c9de=_0x20c9de||0x1f4;return function(_0x58b671){logger[_0x88be('0x27')](_0x58b671[_0x88be('0x28')]);if(_0x58b671[_0x88be('0x29')]){delete _0x58b671[_0x88be('0x29')];}_0x1c9be2[_0x88be('0x1a')](_0x20c9de)['send'](_0x58b671);};}exports[_0x88be('0x2a')]=function(_0x48f6a0,_0x3dc88a){var _0x537c0b={},_0x3a08fa={},_0x2fe023={'count':0x0,'rows':[]};var _0x1af670=_[_0x88be('0x2b')](db[_0x88be('0x2c')][_0x88be('0x2d')],function(_0x3180a5){return{'name':_0x3180a5[_0x88be('0x2e')],'type':_0x3180a5[_0x88be('0x2f')]['key']};});_0x3a08fa[_0x88be('0x30')]=_[_0x88be('0x2b')](_0x1af670,_0x88be('0x29'));_0x3a08fa[_0x88be('0x31')]=_[_0x88be('0x32')](_0x48f6a0[_0x88be('0x31')]);_0x3a08fa[_0x88be('0x33')]=_[_0x88be('0x34')](_0x3a08fa[_0x88be('0x30')],_0x3a08fa['query']);_0x537c0b['attributes']=_[_0x88be('0x34')](_0x3a08fa[_0x88be('0x30')],qs[_0x88be('0x35')](_0x48f6a0['query']['fields']));_0x537c0b[_0x88be('0x36')]=_0x537c0b['attributes'][_0x88be('0x37')]?_0x537c0b['attributes']:_0x3a08fa[_0x88be('0x30')];if(!_0x48f6a0[_0x88be('0x31')][_0x88be('0x38')](_0x88be('0x39'))){_0x537c0b[_0x88be('0x1e')]=qs[_0x88be('0x1e')](_0x48f6a0[_0x88be('0x31')][_0x88be('0x1e')]);_0x537c0b[_0x88be('0x20')]=qs[_0x88be('0x20')](_0x48f6a0[_0x88be('0x31')][_0x88be('0x20')]);}_0x537c0b[_0x88be('0x3a')]=qs[_0x88be('0x3b')](_0x48f6a0[_0x88be('0x31')][_0x88be('0x3b')]);_0x537c0b[_0x88be('0x3c')]=qs[_0x88be('0x33')](_[_0x88be('0x3d')](_0x48f6a0[_0x88be('0x31')],_0x3a08fa[_0x88be('0x33')]),_0x1af670);if(_0x48f6a0[_0x88be('0x31')][_0x88be('0x3e')]){_0x537c0b[_0x88be('0x3c')]=_['merge'](_0x537c0b['where'],{'$or':_['map'](_0x1af670,function(_0x32d763){if(_0x32d763['type']!==_0x88be('0x3f')){var _0x3e7fdf={};_0x3e7fdf[_0x32d763[_0x88be('0x29')]]={'$like':'%'+_0x48f6a0[_0x88be('0x31')][_0x88be('0x3e')]+'%'};return _0x3e7fdf;}})});}_0x537c0b=_[_0x88be('0x40')]({},_0x537c0b,_0x48f6a0[_0x88be('0x41')]);var _0x4bec59={'where':_0x537c0b['where']};return db[_0x88be('0x2c')][_0x88be('0x1f')](_0x4bec59)[_0x88be('0x25')](function(_0x63b253){_0x2fe023['count']=_0x63b253;if(_0x48f6a0[_0x88be('0x31')][_0x88be('0x42')]){_0x537c0b[_0x88be('0x43')]=[{'all':!![]}];}return db[_0x88be('0x2c')]['findAll'](_0x537c0b);})[_0x88be('0x25')](function(_0x429f7b){_0x2fe023[_0x88be('0x44')]=_0x429f7b;return _0x2fe023;})[_0x88be('0x25')](respondWithFilteredResult(_0x3dc88a,_0x537c0b))[_0x88be('0x45')](handleError(_0x3dc88a,null));};exports[_0x88be('0x46')]=function(_0x6da13f,_0x1514d2){var _0x1dc5b4={'raw':!![],'where':{'id':_0x6da13f[_0x88be('0x47')]['id']}},_0x5261d7={};_0x5261d7['model']=_['keys'](db[_0x88be('0x2c')][_0x88be('0x2d')]);_0x5261d7[_0x88be('0x31')]=_[_0x88be('0x32')](_0x6da13f['query']);_0x5261d7[_0x88be('0x33')]=_[_0x88be('0x34')](_0x5261d7[_0x88be('0x30')],_0x5261d7[_0x88be('0x31')]);_0x1dc5b4[_0x88be('0x36')]=_['intersection'](_0x5261d7[_0x88be('0x30')],qs[_0x88be('0x35')](_0x6da13f['query'][_0x88be('0x35')]));_0x1dc5b4['attributes']=_0x1dc5b4[_0x88be('0x36')]['length']?_0x1dc5b4[_0x88be('0x36')]:_0x5261d7[_0x88be('0x30')];if(_0x6da13f['query'][_0x88be('0x42')]){_0x1dc5b4[_0x88be('0x43')]=[{'all':!![]}];}_0x1dc5b4=_[_0x88be('0x40')]({},_0x1dc5b4,_0x6da13f[_0x88be('0x41')]);return db[_0x88be('0x2c')][_0x88be('0x48')](_0x1dc5b4)['then'](handleEntityNotFound(_0x1514d2,null))['then'](respondWithResult(_0x1514d2,null))[_0x88be('0x45')](handleError(_0x1514d2,null));};exports[_0x88be('0x49')]=function(_0x1c6c8f,_0x18d1db){return db[_0x88be('0x2c')][_0x88be('0x49')](_0x1c6c8f['body'],{})['then'](respondWithResult(_0x18d1db,0xc9))[_0x88be('0x45')](handleError(_0x18d1db,null));};exports[_0x88be('0x24')]=function(_0xf60d87,_0x174488){if(_0xf60d87['body']['id']){delete _0xf60d87['body']['id'];}return db[_0x88be('0x2c')]['find']({'where':{'id':_0xf60d87[_0x88be('0x47')]['id']}})[_0x88be('0x25')](handleEntityNotFound(_0x174488,null))[_0x88be('0x25')](saveUpdates(_0xf60d87['body'],null))[_0x88be('0x25')](respondWithResult(_0x174488,null))[_0x88be('0x45')](handleError(_0x174488,null));};exports['destroy']=function(_0x3dc85b,_0x582efa){return db[_0x88be('0x2c')]['find']({'where':{'id':_0x3dc85b[_0x88be('0x47')]['id']}})[_0x88be('0x25')](handleEntityNotFound(_0x582efa,null))[_0x88be('0x25')](removeEntity(_0x582efa,null))[_0x88be('0x45')](handleError(_0x582efa,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index f2699cb..2520fd1 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 _0xcb3f=['rimraf','exports','define','int_desk_fields','desk_unique_index','FieldId','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x4b12ae,_0xf2b3b){var _0x16957b=function(_0x51932c){while(--_0x51932c){_0x4b12ae['push'](_0x4b12ae['shift']());}};_0x16957b(++_0xf2b3b);}(_0xcb3f,0x1f4));var _0xfcb3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcb3f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xfcb3('0x0'));var util=require(_0xfcb3('0x1'));var logger=require(_0xfcb3('0x2'))(_0xfcb3('0x3'));var moment=require(_0xfcb3('0x4'));var BPromise=require(_0xfcb3('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfcb3('0x6'));var rimraf=require(_0xfcb3('0x7'));var config=require('../../config/environment');var attributes=require('./intDeskField.attributes');module[_0xfcb3('0x8')]=function(_0xf981d5,_0x5982e8){return _0xf981d5[_0xfcb3('0x9')]('DeskField',attributes,{'tableName':_0xfcb3('0xa'),'paranoid':![],'indexes':[{'name':_0xfcb3('0xb'),'fields':['idField',_0xfcb3('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x78d0=['rimraf','../../config/environment','./intDeskField.attributes','exports','define','DeskField','int_desk_fields','idField','FieldId','lodash','util','api','bluebird'];(function(_0x31c3d5,_0x40a38c){var _0x5424ba=function(_0x15b7fa){while(--_0x15b7fa){_0x31c3d5['push'](_0x31c3d5['shift']());}};_0x5424ba(++_0x40a38c);}(_0x78d0,0xcc));var _0x078d=function(_0x3111b2,_0x39fa1a){_0x3111b2=_0x3111b2-0x0;var _0x336e46=_0x78d0[_0x3111b2];return _0x336e46;};'use strict';var _=require(_0x078d('0x0'));var util=require(_0x078d('0x1'));var logger=require('../../config/logger')(_0x078d('0x2'));var moment=require('moment');var BPromise=require(_0x078d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x078d('0x4'));var config=require(_0x078d('0x5'));var attributes=require(_0x078d('0x6'));module[_0x078d('0x7')]=function(_0x4f658e,_0x25b377){return _0x4f658e[_0x078d('0x8')](_0x078d('0x9'),attributes,{'tableName':_0x078d('0xa'),'paranoid':![],'indexes':[{'name':'desk_unique_index','fields':[_0x078d('0xb'),_0x078d('0xc')],'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 d47b11f..f69d7eb 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 _0xf122=['debug','error','message','DeskField,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0x540c13,_0x1c5409){var _0x4796ac=function(_0xdf7404){while(--_0xdf7404){_0x540c13['push'](_0x540c13['shift']());}};_0x4796ac(++_0x1c5409);}(_0xf122,0x126));var _0x2f12=function(_0x3c35e9,_0x5065fd){_0x3c35e9=_0x3c35e9-0x0;var _0x4d0d13=_0xf122[_0x3c35e9];return _0x4d0d13;};'use strict';var _=require(_0x2f12('0x0'));var util=require(_0x2f12('0x1'));var moment=require(_0x2f12('0x2'));var BPromise=require(_0x2f12('0x3'));var rs=require(_0x2f12('0x4'));var fs=require('fs');var Redis=require(_0x2f12('0x5'));var db=require(_0x2f12('0x6'))['db'];var utils=require(_0x2f12('0x7'));var logger=require(_0x2f12('0x8'))(_0x2f12('0x9'));var config=require(_0x2f12('0xa'));var jayson=require(_0x2f12('0xb'));var client=jayson[_0x2f12('0xc')][_0x2f12('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x2ccf14,_0x25fe20,_0x4049a9){return new BPromise(function(_0x109e0b,_0x5d39e4){return client[_0x2f12('0xe')](_0x2ccf14,_0x4049a9)[_0x2f12('0xf')](function(_0x331140){logger[_0x2f12('0x10')]('DeskField,\x20%s,\x20%s',_0x25fe20,_0x2f12('0x11'));logger[_0x2f12('0x12')]('DeskField,\x20%s,\x20%s,\x20%s',_0x25fe20,_0x2f12('0x11'),JSON['stringify'](_0x331140));if(_0x331140['error']){if(_0x331140[_0x2f12('0x13')]['code']===0x1f4){logger['error']('DeskField,\x20%s,\x20%s',_0x25fe20,_0x331140[_0x2f12('0x13')][_0x2f12('0x14')]);return _0x5d39e4(_0x331140[_0x2f12('0x13')][_0x2f12('0x14')]);}logger[_0x2f12('0x13')](_0x2f12('0x15'),_0x25fe20,_0x331140['error'][_0x2f12('0x14')]);return _0x109e0b(_0x331140['error'][_0x2f12('0x14')]);}else{logger[_0x2f12('0x10')](_0x2f12('0x15'),_0x25fe20,'request\x20sent');_0x109e0b(_0x331140[_0x2f12('0x16')][_0x2f12('0x14')]);}})[_0x2f12('0x17')](function(_0x54a48b){logger[_0x2f12('0x13')](_0x2f12('0x15'),_0x25fe20,_0x54a48b);_0x5d39e4(_0x54a48b);});});} \ No newline at end of file +var _0x376a=['info','debug','DeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','DeskField,\x20%s,\x20%s','result','catch','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','http'];(function(_0x5696c3,_0xd2cdc){var _0x2866ce=function(_0x3f26a0){while(--_0x3f26a0){_0x5696c3['push'](_0x5696c3['shift']());}};_0x2866ce(++_0xd2cdc);}(_0x376a,0xab));var _0xa376=function(_0x4c6f32,_0x535f85){_0x4c6f32=_0x4c6f32-0x0;var _0x3bcf45=_0x376a[_0x4c6f32];return _0x3bcf45;};'use strict';var _=require('lodash');var util=require(_0xa376('0x0'));var moment=require(_0xa376('0x1'));var BPromise=require(_0xa376('0x2'));var rs=require(_0xa376('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa376('0x4'));var logger=require(_0xa376('0x5'))(_0xa376('0x6'));var config=require('../../config/environment');var jayson=require(_0xa376('0x7'));var client=jayson['client'][_0xa376('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xb6e239,_0x2d2017,_0x479d5b){return new BPromise(function(_0x5ab0bd,_0x36d6f0){return client['request'](_0xb6e239,_0x479d5b)['then'](function(_0xf5cf5b){logger[_0xa376('0x9')]('DeskField,\x20%s,\x20%s',_0x2d2017,'request\x20sent');logger[_0xa376('0xa')](_0xa376('0xb'),_0x2d2017,_0xa376('0xc'),JSON[_0xa376('0xd')](_0xf5cf5b));if(_0xf5cf5b[_0xa376('0xe')]){if(_0xf5cf5b['error'][_0xa376('0xf')]===0x1f4){logger[_0xa376('0xe')]('DeskField,\x20%s,\x20%s',_0x2d2017,_0xf5cf5b[_0xa376('0xe')][_0xa376('0x10')]);return _0x36d6f0(_0xf5cf5b[_0xa376('0xe')][_0xa376('0x10')]);}logger[_0xa376('0xe')](_0xa376('0x11'),_0x2d2017,_0xf5cf5b[_0xa376('0xe')]['message']);return _0x5ab0bd(_0xf5cf5b[_0xa376('0xe')][_0xa376('0x10')]);}else{logger['info'](_0xa376('0x11'),_0x2d2017,_0xa376('0xc'));_0x5ab0bd(_0xf5cf5b[_0xa376('0x12')][_0xa376('0x10')]);}})[_0xa376('0x13')](function(_0x55af4b){logger[_0xa376('0xe')]('DeskField,\x20%s,\x20%s',_0x2d2017,_0x55af4b);_0x36d6f0(_0x55af4b);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index f1d3ed2..30d1e05 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 _0x7ef3=['multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','create','post','put','/:id','update','destroy','exports'];(function(_0x244437,_0x1aa7f5){var _0x2d48be=function(_0x19ea8d){while(--_0x19ea8d){_0x244437['push'](_0x244437['shift']());}};_0x2d48be(++_0x1aa7f5);}(_0x7ef3,0x69));var _0x37ef=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0x7ef3[_0x4a747d];return _0x3a5b5c;};'use strict';var multer=require(_0x37ef('0x0'));var util=require(_0x37ef('0x1'));var path=require(_0x37ef('0x2'));var timeout=require(_0x37ef('0x3'));var express=require('express');var router=express[_0x37ef('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x37ef('0x5'));var config=require(_0x37ef('0x6'));var controller=require('./intDynamics365Account.controller');router[_0x37ef('0x7')]('/',auth[_0x37ef('0x8')](),controller[_0x37ef('0x9')]);router[_0x37ef('0x7')]('/:id',auth[_0x37ef('0x8')](),controller[_0x37ef('0xa')]);router[_0x37ef('0x7')](_0x37ef('0xb'),auth[_0x37ef('0x8')](),controller[_0x37ef('0xc')]);router[_0x37ef('0x7')](_0x37ef('0xd'),auth['isAuthenticated'](),controller['getFields']);router['post']('/',auth[_0x37ef('0x8')](),controller[_0x37ef('0xe')]);router[_0x37ef('0xf')](_0x37ef('0xb'),auth[_0x37ef('0x8')](),controller['addConfiguration']);router[_0x37ef('0x10')](_0x37ef('0x11'),auth[_0x37ef('0x8')](),controller[_0x37ef('0x12')]);router['delete'](_0x37ef('0x11'),auth[_0x37ef('0x8')](),controller[_0x37ef('0x13')]);module[_0x37ef('0x14')]=router; \ No newline at end of file +var _0xddb7=['getConfigurations','/:id/fields','post','addConfiguration','put','/:id','update','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','index','show','/:id/configurations'];(function(_0x21d0c3,_0x16c71c){var _0x4df18e=function(_0x576bfe){while(--_0x576bfe){_0x21d0c3['push'](_0x21d0c3['shift']());}};_0x4df18e(++_0x16c71c);}(_0xddb7,0xc1));var _0x7ddb=function(_0x2cf8bb,_0x56bd0e){_0x2cf8bb=_0x2cf8bb-0x0;var _0x46dc8a=_0xddb7[_0x2cf8bb];return _0x46dc8a;};'use strict';var multer=require(_0x7ddb('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x7ddb('0x1'));var express=require(_0x7ddb('0x2'));var router=express[_0x7ddb('0x3')]();var fs_extra=require(_0x7ddb('0x4'));var auth=require(_0x7ddb('0x5'));var interaction=require(_0x7ddb('0x6'));var config=require(_0x7ddb('0x7'));var controller=require(_0x7ddb('0x8'));router[_0x7ddb('0x9')]('/',auth[_0x7ddb('0xa')](),controller[_0x7ddb('0xb')]);router[_0x7ddb('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x7ddb('0xc')]);router[_0x7ddb('0x9')](_0x7ddb('0xd'),auth[_0x7ddb('0xa')](),controller[_0x7ddb('0xe')]);router[_0x7ddb('0x9')](_0x7ddb('0xf'),auth[_0x7ddb('0xa')](),controller['getFields']);router[_0x7ddb('0x10')]('/',auth[_0x7ddb('0xa')](),controller['create']);router['post'](_0x7ddb('0xd'),auth[_0x7ddb('0xa')](),controller[_0x7ddb('0x11')]);router[_0x7ddb('0x12')](_0x7ddb('0x13'),auth['isAuthenticated'](),controller[_0x7ddb('0x14')]);router['delete'](_0x7ddb('0x13'),auth[_0x7ddb('0xa')](),controller[_0x7ddb('0x15')]);module[_0x7ddb('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 d0f0582..25821cf 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 _0xa93e=['BOOLEAN','STRING'];(function(_0x23991f,_0x3cf4ee){var _0x536c7b=function(_0x1b9249){while(--_0x1b9249){_0x23991f['push'](_0x23991f['shift']());}};_0x536c7b(++_0x3cf4ee);}(_0xa93e,0x1df));var _0xea93=function(_0x4cdc07,_0x348cfb){_0x4cdc07=_0x4cdc07-0x0;var _0x53aa5e=_0xa93e[_0x4cdc07];return _0x53aa5e;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xea93('0x0')]},'username':{'type':Sequelize[_0xea93('0x0')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xea93('0x0')]},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xea93('0x0')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xea93('0x0')]},'modernAuthentication':{'type':Sequelize[_0xea93('0x1')],'defaultValue':!![]}}; \ No newline at end of file +var _0x3cd8=['sequelize','exports','STRING','BOOLEAN'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x3cd8,0x150));var _0x83cd=function(_0xf61d62,_0x5e1ce1){_0xf61d62=_0xf61d62-0x0;var _0x1b8b00=_0x3cd8[_0xf61d62];return _0x1b8b00;};'use strict';var Sequelize=require(_0x83cd('0x0'));module[_0x83cd('0x1')]={'name':{'type':Sequelize[_0x83cd('0x2')]},'username':{'type':Sequelize[_0x83cd('0x2')]},'password':{'type':Sequelize[_0x83cd('0x2')]},'remoteUri':{'type':Sequelize[_0x83cd('0x2')]},'tenantId':{'type':Sequelize[_0x83cd('0x2')]},'clientId':{'type':Sequelize[_0x83cd('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x83cd('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x83cd('0x2')]},'modernAuthentication':{'type':Sequelize[_0x83cd('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index d4f4f6d..068fe62 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 _0x3f73=['Label','UserLocalizedLabel','Value','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','true','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','util','../../config/logger','../../mysqldb','json','undefined','count','offset','status','set','Content-Range','update','then','destroy','sendStatus','error','stack','name','send','index','map','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','Dynamics365Account','includeAll','findAll','show','keys','rawAttributes','create','body','catch','find','params','getConfigurations','findOne','addConfiguration','AccountId','getSubjects','getDescriptions','channel','Dynamics365Configuration','Dynamics365Field','Subjects','Descriptions','slice','lastIndexOf','format','%s/api/data/v9.0/','getFields','ticketType','incident','Incident','title','customerid','caseorigincode','subject','phonenumber','regardingobjectid','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','entitlementidname','entityimage_timestamp','entityimage_url','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyyominame','modifiedbyname','msdyn_incidenttypename','overriddencreatedon','owneridname','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','concat','username','password','clientId','modernAuthentication','CloudProvider','data7','data5','POST','tenantId','/oauth2/token','clientSecret','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','includes','LogicalName','forEach','@odata.type','substring','PicklistAttributeMetadata','all','isNil','BooleanAttributeMetadata','StringAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','DecimalAttributeMetadata','push','test','Wrong\x20credentials','statusCode',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options'];(function(_0x17c483,_0xc69535){var _0x112bdb=function(_0x19adb9){while(--_0x19adb9){_0x17c483['push'](_0x17c483['shift']());}};_0x112bdb(++_0xc69535);}(_0x3f73,0xc3));var _0x33f7=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x3f73[_0xa464c9];return _0x3d73c4;};'use strict';var rp=require(_0x33f7('0x0'));var util=require(_0x33f7('0x1'));var _=require('lodash');var qs=require('../../components/parsers/qs');var logger=require(_0x33f7('0x2'))('api');var db=require(_0x33f7('0x3'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithResult(_0x182643,_0x257947){_0x257947=_0x257947||0xc8;return function(_0x29b721){if(_0x29b721){return _0x182643['status'](_0x257947)[_0x33f7('0x4')](_0x29b721);}};}function respondWithFilteredResult(_0x227540,_0x172f3e){return function(_0x4b3ea1){if(_0x4b3ea1){var _0x9ce9ce=typeof _0x172f3e['offset']===_0x33f7('0x5')&&typeof _0x172f3e['limit']===_0x33f7('0x5');var _0x37cb20=_0x4b3ea1[_0x33f7('0x6')];var _0x56b335=_0x9ce9ce?0x0:_0x172f3e[_0x33f7('0x7')];var _0x20f59f=_0x9ce9ce?_0x4b3ea1[_0x33f7('0x6')]:_0x172f3e['offset']+_0x172f3e['limit'];var _0x34331b;if(_0x20f59f>=_0x37cb20){_0x20f59f=_0x37cb20;_0x34331b=0xc8;}else{_0x34331b=0xce;}_0x227540[_0x33f7('0x8')](_0x34331b);return _0x227540[_0x33f7('0x9')](_0x33f7('0xa'),_0x56b335+'-'+_0x20f59f+'/'+_0x37cb20)[_0x33f7('0x4')](_0x4b3ea1);}return null;};}function saveUpdates(_0x4a6d31){return function(_0x56b3be){if(_0x56b3be){return _0x56b3be[_0x33f7('0xb')](_0x4a6d31)[_0x33f7('0xc')](function(_0x5d4f0f){return _0x5d4f0f;});}return null;};}function removeEntity(_0xde32cb){return function(_0xcce506){if(_0xcce506){return _0xcce506[_0x33f7('0xd')]()[_0x33f7('0xc')](function(){_0xde32cb[_0x33f7('0x8')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2efea7){return function(_0x509ff9){if(!_0x509ff9){_0x2efea7[_0x33f7('0xe')](0x194);}return _0x509ff9;};}function handleError(_0xa49bfb,_0x51137f){_0x51137f=_0x51137f||0x1f4;return function(_0x1e53c7){logger[_0x33f7('0xf')](_0x1e53c7[_0x33f7('0x10')]);if(_0x1e53c7['name']){delete _0x1e53c7[_0x33f7('0x11')];}_0xa49bfb[_0x33f7('0x8')](_0x51137f)[_0x33f7('0x12')](_0x1e53c7);};}exports[_0x33f7('0x13')]=function(_0x55034f,_0xf623fe){var _0x2c6451={},_0x1629b5={},_0x11c534={'count':0x0,'rows':[]};var _0x22a5a1=_[_0x33f7('0x14')](db['Dynamics365Account']['rawAttributes'],function(_0x2743af){return{'name':_0x2743af[_0x33f7('0x15')],'type':_0x2743af[_0x33f7('0x16')][_0x33f7('0x17')]};});_0x1629b5[_0x33f7('0x18')]=_[_0x33f7('0x14')](_0x22a5a1,_0x33f7('0x11'));_0x1629b5[_0x33f7('0x19')]=_['keys'](_0x55034f[_0x33f7('0x19')]);_0x1629b5[_0x33f7('0x1a')]=_[_0x33f7('0x1b')](_0x1629b5['model'],_0x1629b5['query']);_0x2c6451[_0x33f7('0x1c')]=_[_0x33f7('0x1b')](_0x1629b5['model'],qs[_0x33f7('0x1d')](_0x55034f[_0x33f7('0x19')][_0x33f7('0x1d')]));_0x2c6451[_0x33f7('0x1c')]=_0x2c6451[_0x33f7('0x1c')][_0x33f7('0x1e')]?_0x2c6451['attributes']:_0x1629b5['model'];if(!_0x55034f['query'][_0x33f7('0x1f')](_0x33f7('0x20'))){_0x2c6451[_0x33f7('0x21')]=qs[_0x33f7('0x21')](_0x55034f[_0x33f7('0x19')][_0x33f7('0x21')]);_0x2c6451[_0x33f7('0x7')]=qs[_0x33f7('0x7')](_0x55034f['query'][_0x33f7('0x7')]);}_0x2c6451[_0x33f7('0x22')]=qs['sort'](_0x55034f[_0x33f7('0x19')][_0x33f7('0x23')]);_0x2c6451[_0x33f7('0x24')]=qs['filters'](_[_0x33f7('0x25')](_0x55034f[_0x33f7('0x19')],_0x1629b5['filters']),_0x22a5a1);if(_0x55034f['query'][_0x33f7('0x26')]){_0x2c6451[_0x33f7('0x24')]=_[_0x33f7('0x27')](_0x2c6451[_0x33f7('0x24')],{'$or':_[_0x33f7('0x14')](_0x22a5a1,function(_0x32549b){if(_0x32549b['type']!==_0x33f7('0x28')){var _0x109763={};_0x109763[_0x32549b[_0x33f7('0x11')]]={'$like':'%'+_0x55034f['query']['filter']+'%'};return _0x109763;}})});}_0x2c6451=_[_0x33f7('0x27')]({},_0x2c6451,_0x55034f[_0x33f7('0x29')]);var _0x156d5c={'where':_0x2c6451[_0x33f7('0x24')]};return db[_0x33f7('0x2a')][_0x33f7('0x6')](_0x156d5c)[_0x33f7('0xc')](function(_0xd3188d){_0x11c534[_0x33f7('0x6')]=_0xd3188d;if(_0x55034f[_0x33f7('0x19')][_0x33f7('0x2b')]){_0x2c6451['include']=[{'all':!![]}];}return db[_0x33f7('0x2a')][_0x33f7('0x2c')](_0x2c6451);})[_0x33f7('0xc')](function(_0x20af23){_0x11c534['rows']=_0x20af23;return _0x11c534;})['then'](respondWithFilteredResult(_0xf623fe,_0x2c6451))['catch'](handleError(_0xf623fe,null));};exports[_0x33f7('0x2d')]=function(_0x5786d7,_0x29d457){var _0x3405d9={'raw':![],'where':{'id':_0x5786d7['params']['id']}},_0x40250c={};_0x40250c[_0x33f7('0x18')]=_[_0x33f7('0x2e')](db['Dynamics365Account'][_0x33f7('0x2f')]);_0x40250c[_0x33f7('0x19')]=_[_0x33f7('0x2e')](_0x5786d7['query']);_0x40250c[_0x33f7('0x1a')]=_[_0x33f7('0x1b')](_0x40250c[_0x33f7('0x18')],_0x40250c['query']);_0x3405d9[_0x33f7('0x1c')]=_[_0x33f7('0x1b')](_0x40250c[_0x33f7('0x18')],qs[_0x33f7('0x1d')](_0x5786d7['query'][_0x33f7('0x1d')]));_0x3405d9[_0x33f7('0x1c')]=_0x3405d9[_0x33f7('0x1c')][_0x33f7('0x1e')]?_0x3405d9['attributes']:_0x40250c[_0x33f7('0x18')];if(_0x5786d7[_0x33f7('0x19')][_0x33f7('0x2b')]){_0x3405d9['include']=[{'all':!![]}];}_0x3405d9=_[_0x33f7('0x27')]({},_0x3405d9,_0x5786d7[_0x33f7('0x29')]);return db['Dynamics365Account']['find'](_0x3405d9)['then'](handleEntityNotFound(_0x29d457,null))[_0x33f7('0xc')](respondWithResult(_0x29d457,null))['catch'](handleError(_0x29d457,null));};exports[_0x33f7('0x30')]=function(_0x5ae25b,_0x78352f){return db[_0x33f7('0x2a')][_0x33f7('0x30')](_0x5ae25b['body'],{})['then'](respondWithResult(_0x78352f,0xc9))['catch'](handleError(_0x78352f,null));};exports[_0x33f7('0xb')]=function(_0x627ce0,_0x2670f4){if(_0x627ce0[_0x33f7('0x31')]['id']){delete _0x627ce0[_0x33f7('0x31')]['id'];}return db['Dynamics365Account']['find']({'where':{'id':_0x627ce0['params']['id']}})[_0x33f7('0xc')](handleEntityNotFound(_0x2670f4,null))[_0x33f7('0xc')](saveUpdates(_0x627ce0[_0x33f7('0x31')],null))[_0x33f7('0xc')](respondWithResult(_0x2670f4,null))[_0x33f7('0x32')](handleError(_0x2670f4,null));};exports['destroy']=function(_0x23e76b,_0xaa4418){return db[_0x33f7('0x2a')][_0x33f7('0x33')]({'where':{'id':_0x23e76b[_0x33f7('0x34')]['id']}})[_0x33f7('0xc')](handleEntityNotFound(_0xaa4418,null))['then'](removeEntity(_0xaa4418,null))[_0x33f7('0x32')](handleError(_0xaa4418,null));};exports[_0x33f7('0x35')]=function(_0x26797e,_0x58df40){var _0x5b1129={};var _0x546bc0={};var _0x3a4c41;var _0x1d3b71;return db[_0x33f7('0x2a')][_0x33f7('0x36')]({'where':{'id':_0x26797e['params']['id']}})[_0x33f7('0xc')](handleEntityNotFound(_0x58df40,null))[_0x33f7('0xc')](function(_0x266c01){if(_0x266c01){_0x3a4c41=_0x266c01;_0x546bc0[_0x33f7('0x18')]=_[_0x33f7('0x2e')](db['Dynamics365Configuration'][_0x33f7('0x2f')]);_0x546bc0['query']=_['keys'](_0x26797e[_0x33f7('0x19')]);_0x546bc0[_0x33f7('0x1a')]=_['intersection'](_0x546bc0[_0x33f7('0x18')],_0x546bc0['query']);_0x5b1129[_0x33f7('0x1c')]=_[_0x33f7('0x1b')](_0x546bc0['model'],qs[_0x33f7('0x1d')](_0x26797e['query'][_0x33f7('0x1d')]));_0x5b1129[_0x33f7('0x1c')]=_0x5b1129[_0x33f7('0x1c')]['length']?_0x5b1129['attributes']:_0x546bc0[_0x33f7('0x18')];_0x5b1129[_0x33f7('0x22')]=qs[_0x33f7('0x23')](_0x26797e[_0x33f7('0x19')][_0x33f7('0x23')]);_0x5b1129[_0x33f7('0x24')]=qs[_0x33f7('0x1a')](_['pick'](_0x26797e[_0x33f7('0x19')],_0x546bc0[_0x33f7('0x1a')]));if(_0x26797e[_0x33f7('0x19')][_0x33f7('0x26')]){_0x5b1129['where']=_['merge'](_0x5b1129[_0x33f7('0x24')],{'$or':_[_0x33f7('0x14')](_0x5b1129[_0x33f7('0x1c')],function(_0x4b12c6){var _0x374945={};_0x374945[_0x4b12c6]={'$like':'%'+_0x26797e[_0x33f7('0x19')][_0x33f7('0x26')]+'%'};return _0x374945;})});}_0x5b1129=_[_0x33f7('0x27')]({},_0x5b1129,_0x26797e[_0x33f7('0x29')]);return _0x3a4c41[_0x33f7('0x35')](_0x5b1129);}})[_0x33f7('0xc')](function(_0x465a12){if(_0x465a12){_0x1d3b71=_0x465a12['length'];if(!_0x26797e[_0x33f7('0x19')]['hasOwnProperty'](_0x33f7('0x20'))){_0x5b1129[_0x33f7('0x21')]=qs[_0x33f7('0x21')](_0x26797e[_0x33f7('0x19')][_0x33f7('0x21')]);_0x5b1129[_0x33f7('0x7')]=qs[_0x33f7('0x7')](_0x26797e['query'][_0x33f7('0x7')]);}return _0x3a4c41['getConfigurations'](_0x5b1129);}})[_0x33f7('0xc')](function(_0x4b9ae8){if(_0x4b9ae8){return _0x4b9ae8?{'count':_0x1d3b71,'rows':_0x4b9ae8}:null;}})['then'](respondWithResult(_0x58df40,null))[_0x33f7('0x32')](handleError(_0x58df40,null));};exports[_0x33f7('0x37')]=function(_0x122188,_0x5677ae){if(_0x122188['body']['id']){delete _0x122188['body']['id'];}return db[_0x33f7('0x2a')][_0x33f7('0x36')]({'where':{'id':_0x122188[_0x33f7('0x34')]['id']}})[_0x33f7('0xc')](handleEntityNotFound(_0x5677ae,null))[_0x33f7('0xc')](function(_0x1ebacd){if(_0x1ebacd){_0x122188[_0x33f7('0x31')][_0x33f7('0x38')]=_0x1ebacd['id'];_0x122188[_0x33f7('0x31')]['Subjects']=integrations[_0x33f7('0x39')](_0x122188[_0x33f7('0x31')]['channel'],_0x122188['body'][_0x33f7('0x16')]);_0x122188[_0x33f7('0x31')]['Descriptions']=integrations[_0x33f7('0x3a')](_0x122188['body'][_0x33f7('0x3b')],_0x122188[_0x33f7('0x31')][_0x33f7('0x16')]);return db[_0x33f7('0x3c')]['create'](_0x122188[_0x33f7('0x31')],{'include':[{'model':db[_0x33f7('0x3d')],'as':_0x33f7('0x3e')},{'model':db['Dynamics365Field'],'as':_0x33f7('0x3f')}]});}return null;})[_0x33f7('0xc')](respondWithResult(_0x5677ae,null))[_0x33f7('0x32')](handleError(_0x5677ae,null));};function sanitizeRemoteUri(_0x50eac3){var _0xad4263=_0x50eac3[_0x33f7('0x40')](-0x1);if(_0xad4263==='/')return _0x50eac3['substring'](0x0,_0x50eac3[_0x33f7('0x41')](_0xad4263));return _0x50eac3;}function getWebApiUrl(_0x4ee547){return util[_0x33f7('0x42')](_0x33f7('0x43'),_0x4ee547);}exports[_0x33f7('0x44')]=function(_0x47d4e6,_0x2e5529){var _0x510c76=_0x47d4e6[_0x33f7('0x19')][_0x33f7('0x45')];var _0x2d1bae=_0x510c76===_0x33f7('0x46')?_0x33f7('0x47'):'PhoneCall';var _0x7326f5='';var _0x54a6ea='';var _0x12b5fa='';var _0x391873='';var _0x42bf16='';var _0x5a29a6='';var _0x210447='';var _0x5f2db1='';var _0x4cad55=[_0x33f7('0x48'),'description',_0x33f7('0x49'),'ownerid',_0x33f7('0x4a'),_0x33f7('0x4b'),_0x33f7('0x4c'),_0x33f7('0x4d'),'directioncode',_0x33f7('0x4e')];var _0x5c91db=[_0x33f7('0x4f'),_0x33f7('0x50'),_0x33f7('0x51'),_0x33f7('0x52'),'contactidname',_0x33f7('0x53'),_0x33f7('0x54'),_0x33f7('0x55'),_0x33f7('0x56'),_0x33f7('0x57'),_0x33f7('0x58'),_0x33f7('0x59'),_0x33f7('0x5a'),'createdonbehalfbyname',_0x33f7('0x5b'),_0x33f7('0x5c'),_0x33f7('0x5d'),_0x33f7('0x5e'),'emailaddress',_0x33f7('0x5f'),_0x33f7('0x60'),_0x33f7('0x61'),'escalatedon',_0x33f7('0x62'),_0x33f7('0x63'),_0x33f7('0x64'),_0x33f7('0x65'),_0x33f7('0x66'),_0x33f7('0x67'),_0x33f7('0x68'),_0x33f7('0x69'),'modifiedbyexternalpartyname',_0x33f7('0x6a'),_0x33f7('0x6b'),'modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame',_0x33f7('0x6c'),'msdyn_iotalertname','numberofchildincidents','onholdtime',_0x33f7('0x6d'),_0x33f7('0x6e'),'owneridtype',_0x33f7('0x6f'),_0x33f7('0x70'),_0x33f7('0x71'),_0x33f7('0x72'),_0x33f7('0x73'),_0x33f7('0x74'),_0x33f7('0x75'),'resolveby',_0x33f7('0x76'),_0x33f7('0x77'),_0x33f7('0x78'),_0x33f7('0x79'),'sentimentvalue',_0x33f7('0x7a'),_0x33f7('0x7b'),_0x33f7('0x7c'),_0x33f7('0x7d'),_0x33f7('0x7e'),_0x33f7('0x7f'),_0x33f7('0x80'),_0x33f7('0x81'),'transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber'];var _0x3c2272=_0x4cad55[_0x33f7('0x82')](_0x5c91db);return db[_0x33f7('0x2a')]['findOne']({'where':{'id':_0x47d4e6['params']['id']},'attributes':['id',_0x33f7('0x83'),_0x33f7('0x84'),'remoteUri','tenantId',_0x33f7('0x85'),'clientSecret',_0x33f7('0x86')],'include':[{'model':db[_0x33f7('0x87')],'as':_0x33f7('0x87'),'attributes':['id','data5',_0x33f7('0x88')]}]})[_0x33f7('0xc')](handleEntityNotFound(_0x2e5529,null))[_0x33f7('0xc')](function(_0x4a1836){if(_0x4a1836){if(_0x4a1836[_0x33f7('0x86')]){_0x4a1836['access_token']=_0x4a1836['CloudProvider'][_0x33f7('0x89')];_0x5f2db1=sanitizeRemoteUri(_0x4a1836['CloudProvider'][_0x33f7('0x88')]);_0x210447=getWebApiUrl(_0x5f2db1);return _0x4a1836;}_0x5f2db1=sanitizeRemoteUri(_0x4a1836['remoteUri']);_0x210447=getWebApiUrl(_0x5f2db1);var _0x1913d9={'method':_0x33f7('0x8a'),'uri':'https://login.microsoftonline.com/'+_0x4a1836[_0x33f7('0x8b')]+_0x33f7('0x8c'),'form':{'client_id':_0x4a1836[_0x33f7('0x85')],'resource':_0x5f2db1,'username':_0x4a1836[_0x33f7('0x83')],'password':_0x4a1836[_0x33f7('0x84')],'grant_type':_0x33f7('0x84'),'client_secret':_0x4a1836[_0x33f7('0x8d')]},'json':!![]};return rp(_0x1913d9);}})['then'](function(_0x26dada){_0x5a29a6=_0x26dada[_0x33f7('0x8e')];var _0x476f0d={'method':_0x33f7('0x8f'),'uri':encodeURI(_0x210447+_0x33f7('0x90')+_0x2d1bae+'\x27'),'headers':{'Authorization':_0x33f7('0x91')+_0x5a29a6,'If-None-Match':null,'OData-Version':_0x33f7('0x92')},'json':!![]};return rp(_0x476f0d);})[_0x33f7('0xc')](function(_0x552137){var _0x4d3dfa=_0x552137[_0x33f7('0x93')][0x0];var _0x40ef83=_0x4d3dfa[_0x33f7('0x94')];var _0x403315={'method':_0x33f7('0x8f'),'uri':_0x210447+_0x33f7('0x95')+_0x40ef83+_0x33f7('0x96'),'headers':{'Authorization':'Bearer\x20'+_0x5a29a6,'If-None-Match':null,'OData-Version':_0x33f7('0x92')},'json':!![]};return rp(_0x403315);})[_0x33f7('0xc')](function(_0x594f57){_0x7326f5=_0x594f57;_0x54a6ea=_0x7326f5[_0x33f7('0x97')];_0x54a6ea=_[_0x33f7('0x98')](_0x54a6ea,function(_0x30001c){return!_0x3c2272[_0x33f7('0x99')](_0x30001c[_0x33f7('0x9a')]);});var _0x3a143e=[];var _0xdd0765=[];_0x54a6ea[_0x33f7('0x9b')](function(_0x12a1d1){if(_0x12a1d1['@odata.type']){var _0x5c407b=_0x12a1d1[_0x33f7('0x9c')][_0x33f7('0x9d')](_0x12a1d1[_0x33f7('0x9c')]['lastIndexOf']('.')+0x1);if(_0x5c407b===_0x33f7('0x9e')){_0x3a143e['push'](getSelectList(_0x210447,_0x510c76,_0xdd0765,_0x7326f5[_0x33f7('0x94')],_0x12a1d1[_0x33f7('0x94')],_0x5a29a6));}}});return Promise[_0x33f7('0x9f')](_0x3a143e);})[_0x33f7('0xc')](function(_0x252e46){_0x12b5fa=_0x252e46[0x0];var _0x17e552=[];var _0x5e6565=[];_0x54a6ea[_0x33f7('0x9b')](function(_0xf84008){if(!_[_0x33f7('0xa0')](_0xf84008[_0x33f7('0x9c')])){var _0x5374f2=_0xf84008['@odata.type'][_0x33f7('0x9d')](_0xf84008[_0x33f7('0x9c')]['lastIndexOf']('.')+0x1);if(_0x5374f2===_0x33f7('0xa1')){_0x17e552['push'](getBooleanList(_0x210447,_0x510c76,_0x5e6565,_0x7326f5[_0x33f7('0x94')],_0xf84008[_0x33f7('0x94')],_0x5a29a6));}}});return Promise[_0x33f7('0x9f')](_0x17e552);})[_0x33f7('0xc')](function(_0x1fa8fc){_0x391873=_0x1fa8fc[0x0];var _0x23bba1=[];var _0x4218a3=[];_0x54a6ea[_0x33f7('0x9b')](function(_0x1e87e7){if(_0x1e87e7[_0x33f7('0x9c')]){var _0x415e58=_0x1e87e7['@odata.type'][_0x33f7('0x9d')](_0x1e87e7['@odata.type'][_0x33f7('0x41')]('.')+0x1);if(_0x415e58===_0x33f7('0xa2')||_0x415e58==='DoubleAttributeMetadata'||_0x415e58==='BigIntAttributeMetadata'||_0x415e58===_0x33f7('0xa3')||_0x415e58===_0x33f7('0xa4')||_0x415e58==='DateTimeAttributeMetadata'||_0x415e58===_0x33f7('0xa5')||_0x415e58===_0x33f7('0xa6')||_0x415e58==='StateAttributeMetadata'||_0x415e58===_0x33f7('0xa7')){_0x23bba1[_0x33f7('0xa8')](getInputList(_0x210447,_0x510c76,_0x415e58,_0x4218a3,_0x7326f5['MetadataId'],_0x1e87e7['MetadataId'],_0x5a29a6));}}});return Promise[_0x33f7('0x9f')](_0x23bba1);})['then'](function(_0x563857){_0x42bf16=_0x563857[0x0];var _0x31775a=_0x12b5fa['concat'](_0x391873)[_0x33f7('0x82')](_0x42bf16);var _0x3b668b={'count':_0x31775a[_0x33f7('0x1e')],'rows':_0x31775a};return _0x3b668b;})[_0x33f7('0xc')](respondWithResult(_0x2e5529,null))[_0x33f7('0x32')](function(_0x36baca){var _0x10a1d0=_0x47d4e6[_0x33f7('0x19')][_0x33f7('0xa9')]?0x1f4:_0x36baca['statusCode']||0x1f4;logger[_0x33f7('0xf')](_0x36baca[_0x33f7('0x10')]);delete _0x36baca['name'];if(_0x10a1d0===0x191){_0x10a1d0=0x190;}_0x2e5529[_0x33f7('0x8')](_0x10a1d0)['send'](_0x47d4e6[_0x33f7('0x19')][_0x33f7('0xa9')]?{'message':_0x33f7('0xaa'),'statusCode':_0x36baca[_0x33f7('0xab')]}:_0x36baca);});};function getSelectList(_0x442f8e,_0x46c0ef,_0x1e7f56,_0x4c50ac,_0x223310,_0x5bc283){var _0x37c73b={'method':'GET','uri':_0x442f8e+_0x33f7('0x95')+_0x4c50ac+_0x33f7('0xac')+_0x223310+_0x33f7('0xad')+_0x33f7('0xae'),'headers':{'Authorization':_0x33f7('0x91')+_0x5bc283,'If-None-Match':null,'OData-Version':_0x33f7('0x92')},'json':!![]};return rp(_0x37c73b)[_0x33f7('0xc')](function(_0x2537d7){var _0x466a1c=[];var _0x31b1e7=_0x2537d7[_0x33f7('0xaf')][_0x33f7('0xb0')];_0x31b1e7['forEach'](function(_0x11662b){_0x466a1c[_0x33f7('0xa8')]({'name':_0x11662b[_0x33f7('0xb1')][_0x33f7('0xb2')][_0x33f7('0xb1')],'value':String(_0x11662b[_0x33f7('0xb3')])});});var _0xabb248={'id':_0x46c0ef+'_'+_0x2537d7[_0x33f7('0x9a')],'name':_0x2537d7[_0x33f7('0xb4')][_0x33f7('0xb2')][_0x33f7('0xb1')],'custom':![],'options':_0x466a1c};_0x1e7f56[_0x33f7('0xa8')](_0xabb248);return _0x1e7f56;});}function getBooleanList(_0x28ad88,_0x5dd6b7,_0x20c8a7,_0x24004f,_0x499fb2,_0x47dff2){var _0x4dec7a={'method':_0x33f7('0x8f'),'uri':_0x28ad88+_0x33f7('0x95')+_0x24004f+_0x33f7('0xac')+_0x499fb2+_0x33f7('0xb5'),'headers':{'Authorization':_0x33f7('0x91')+_0x47dff2,'If-None-Match':null,'OData-Version':_0x33f7('0x92')},'json':!![]};return rp(_0x4dec7a)[_0x33f7('0xc')](function(_0x3df399){var _0xda63c6=[];_0xda63c6[_0x33f7('0xa8')]({'name':_0x3df399['OptionSet']['TrueOption'][_0x33f7('0xb1')][_0x33f7('0xb2')][_0x33f7('0xb1')],'value':_0x33f7('0xb6')},{'name':_0x3df399['OptionSet']['FalseOption'][_0x33f7('0xb1')][_0x33f7('0xb2')][_0x33f7('0xb1')],'value':_0x33f7('0xb7')});var _0x281f53={'id':_0x5dd6b7+'_'+_0x3df399[_0x33f7('0x9a')],'name':_0x3df399[_0x33f7('0xb4')][_0x33f7('0xb2')][_0x33f7('0xb1')],'custom':![],'options':_0xda63c6};_0x20c8a7[_0x33f7('0xa8')](_0x281f53);return _0x20c8a7;});}function getInputList(_0x2fccb6,_0x2a3f19,_0x141b81,_0x529873,_0x5ae7b3,_0x7271ac,_0x9e845d){var _0x39e8c7={'method':_0x33f7('0x8f'),'uri':_0x2fccb6+_0x33f7('0x95')+_0x5ae7b3+_0x33f7('0xac')+_0x7271ac+_0x33f7('0xb8')+_0x141b81+_0x33f7('0xb9'),'headers':{'Authorization':_0x33f7('0x91')+_0x9e845d,'If-None-Match':null,'OData-Version':_0x33f7('0x92')},'json':!![]};return rp(_0x39e8c7)[_0x33f7('0xc')](function(_0x5f0387){var _0x47db1f={'id':_0x2a3f19+'_'+_0x5f0387[_0x33f7('0x9a')],'name':_0x5f0387[_0x33f7('0xb4')]['UserLocalizedLabel']?_0x5f0387[_0x33f7('0xb4')][_0x33f7('0xb2')][_0x33f7('0xb1')]:_0x5f0387[_0x33f7('0x9a')],'custom':![],'options':[]};_0x529873[_0x33f7('0xa8')](_0x47db1f);return _0x529873;});} \ No newline at end of file +var _0xb67b=['merge','includeAll','include','Dynamics365Account','findAll','rows','catch','show','params','options','find','create','body','destroy','getConfigurations','findOne','Dynamics365Configuration','nolimit','addConfiguration','Subjects','getSubjects','channel','getDescriptions','Dynamics365Field','Descriptions','slice','substring','format','incident','PhoneCall','title','ownerid','subject','directioncode','phonecall_activity_parties','accountidyominame','actualserviceunits','contactidname','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','entitlementidname','entityimage_url','escalatedon','exchangerate','followupby','importsequencenumber','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','msdyn_iotalertname','onholdtime','owneridname','owneridtype','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','slainvokedidname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','utcconversiontimezonecode','versionnumber','concat','username','password','remoteUri','tenantId','clientId','clientSecret','modernAuthentication','CloudProvider','data5','data7','access_token','POST','https://login.microsoftonline.com/','/oauth2/token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','all','isNil','push','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','MemoAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','send','test','statusCode','EntityDefinitions(',')/Attributes(','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','Value','TrueOption','true','FalseOption','false','DisplayName',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','lodash','../../components/parsers/qs','../../config/logger','api','../../components/integrations/configuration','status','json','limit','undefined','count','offset','set','Content-Range','update','then','end','sendStatus','error','stack','name','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter'];(function(_0x454918,_0x1dbc64){var _0x3a814b=function(_0x3d1c39){while(--_0x3d1c39){_0x454918['push'](_0x454918['shift']());}};_0x3a814b(++_0x1dbc64);}(_0xb67b,0x1f3));var _0xbb67=function(_0x3d7f0e,_0x104d69){_0x3d7f0e=_0x3d7f0e-0x0;var _0x3e45dd=_0xb67b[_0x3d7f0e];return _0x3e45dd;};'use strict';var rp=require(_0xbb67('0x0'));var util=require('util');var _=require(_0xbb67('0x1'));var qs=require(_0xbb67('0x2'));var logger=require(_0xbb67('0x3'))(_0xbb67('0x4'));var db=require('../../mysqldb')['db'];var integrations=require(_0xbb67('0x5'));function respondWithResult(_0xe922b8,_0xcc9429){_0xcc9429=_0xcc9429||0xc8;return function(_0x19cb24){if(_0x19cb24){return _0xe922b8[_0xbb67('0x6')](_0xcc9429)[_0xbb67('0x7')](_0x19cb24);}};}function respondWithFilteredResult(_0x3b9e0c,_0x56ff14){return function(_0x352fae){if(_0x352fae){var _0x24ac3d=typeof _0x56ff14['offset']==='undefined'&&typeof _0x56ff14[_0xbb67('0x8')]===_0xbb67('0x9');var _0x30f2f7=_0x352fae[_0xbb67('0xa')];var _0x22bfd0=_0x24ac3d?0x0:_0x56ff14[_0xbb67('0xb')];var _0x445a2b=_0x24ac3d?_0x352fae[_0xbb67('0xa')]:_0x56ff14[_0xbb67('0xb')]+_0x56ff14[_0xbb67('0x8')];var _0x4ad4df;if(_0x445a2b>=_0x30f2f7){_0x445a2b=_0x30f2f7;_0x4ad4df=0xc8;}else{_0x4ad4df=0xce;}_0x3b9e0c[_0xbb67('0x6')](_0x4ad4df);return _0x3b9e0c[_0xbb67('0xc')](_0xbb67('0xd'),_0x22bfd0+'-'+_0x445a2b+'/'+_0x30f2f7)[_0xbb67('0x7')](_0x352fae);}return null;};}function saveUpdates(_0x1e9afe){return function(_0x412e26){if(_0x412e26){return _0x412e26[_0xbb67('0xe')](_0x1e9afe)['then'](function(_0x47f089){return _0x47f089;});}return null;};}function removeEntity(_0x56158d){return function(_0x1976c7){if(_0x1976c7){return _0x1976c7['destroy']()[_0xbb67('0xf')](function(){_0x56158d[_0xbb67('0x6')](0xcc)[_0xbb67('0x10')]();});}};}function handleEntityNotFound(_0x46dfa3){return function(_0x4d9909){if(!_0x4d9909){_0x46dfa3[_0xbb67('0x11')](0x194);}return _0x4d9909;};}function handleError(_0x4a3201,_0x5c7a68){_0x5c7a68=_0x5c7a68||0x1f4;return function(_0x4b4273){logger[_0xbb67('0x12')](_0x4b4273[_0xbb67('0x13')]);if(_0x4b4273[_0xbb67('0x14')]){delete _0x4b4273['name'];}_0x4a3201[_0xbb67('0x6')](_0x5c7a68)['send'](_0x4b4273);};}exports['index']=function(_0x23da38,_0x55c7a2){var _0xdab993={},_0x287884={},_0x456adf={'count':0x0,'rows':[]};var _0x5d467f=_['map'](db['Dynamics365Account'][_0xbb67('0x15')],function(_0x6a7b0){return{'name':_0x6a7b0['fieldName'],'type':_0x6a7b0[_0xbb67('0x16')][_0xbb67('0x17')]};});_0x287884[_0xbb67('0x18')]=_[_0xbb67('0x19')](_0x5d467f,_0xbb67('0x14'));_0x287884[_0xbb67('0x1a')]=_[_0xbb67('0x1b')](_0x23da38[_0xbb67('0x1a')]);_0x287884[_0xbb67('0x1c')]=_[_0xbb67('0x1d')](_0x287884[_0xbb67('0x18')],_0x287884[_0xbb67('0x1a')]);_0xdab993[_0xbb67('0x1e')]=_[_0xbb67('0x1d')](_0x287884['model'],qs[_0xbb67('0x1f')](_0x23da38[_0xbb67('0x1a')][_0xbb67('0x1f')]));_0xdab993['attributes']=_0xdab993[_0xbb67('0x1e')][_0xbb67('0x20')]?_0xdab993[_0xbb67('0x1e')]:_0x287884[_0xbb67('0x18')];if(!_0x23da38[_0xbb67('0x1a')][_0xbb67('0x21')]('nolimit')){_0xdab993['limit']=qs[_0xbb67('0x8')](_0x23da38[_0xbb67('0x1a')]['limit']);_0xdab993[_0xbb67('0xb')]=qs[_0xbb67('0xb')](_0x23da38['query'][_0xbb67('0xb')]);}_0xdab993['order']=qs[_0xbb67('0x22')](_0x23da38[_0xbb67('0x1a')][_0xbb67('0x22')]);_0xdab993[_0xbb67('0x23')]=qs[_0xbb67('0x1c')](_[_0xbb67('0x24')](_0x23da38[_0xbb67('0x1a')],_0x287884['filters']),_0x5d467f);if(_0x23da38[_0xbb67('0x1a')][_0xbb67('0x25')]){_0xdab993[_0xbb67('0x23')]=_[_0xbb67('0x26')](_0xdab993[_0xbb67('0x23')],{'$or':_[_0xbb67('0x19')](_0x5d467f,function(_0x53b7e1){if(_0x53b7e1['type']!=='VIRTUAL'){var _0x2afae5={};_0x2afae5[_0x53b7e1['name']]={'$like':'%'+_0x23da38['query'][_0xbb67('0x25')]+'%'};return _0x2afae5;}})});}_0xdab993=_[_0xbb67('0x26')]({},_0xdab993,_0x23da38['options']);var _0x5e1c24={'where':_0xdab993['where']};return db['Dynamics365Account'][_0xbb67('0xa')](_0x5e1c24)['then'](function(_0x20cccc){_0x456adf[_0xbb67('0xa')]=_0x20cccc;if(_0x23da38[_0xbb67('0x1a')][_0xbb67('0x27')]){_0xdab993[_0xbb67('0x28')]=[{'all':!![]}];}return db[_0xbb67('0x29')][_0xbb67('0x2a')](_0xdab993);})[_0xbb67('0xf')](function(_0x25493b){_0x456adf[_0xbb67('0x2b')]=_0x25493b;return _0x456adf;})[_0xbb67('0xf')](respondWithFilteredResult(_0x55c7a2,_0xdab993))[_0xbb67('0x2c')](handleError(_0x55c7a2,null));};exports[_0xbb67('0x2d')]=function(_0x3fd0ad,_0x4e1689){var _0x192fbb={'raw':![],'where':{'id':_0x3fd0ad[_0xbb67('0x2e')]['id']}},_0x10916b={};_0x10916b[_0xbb67('0x18')]=_[_0xbb67('0x1b')](db[_0xbb67('0x29')][_0xbb67('0x15')]);_0x10916b[_0xbb67('0x1a')]=_[_0xbb67('0x1b')](_0x3fd0ad[_0xbb67('0x1a')]);_0x10916b['filters']=_[_0xbb67('0x1d')](_0x10916b[_0xbb67('0x18')],_0x10916b[_0xbb67('0x1a')]);_0x192fbb['attributes']=_[_0xbb67('0x1d')](_0x10916b[_0xbb67('0x18')],qs[_0xbb67('0x1f')](_0x3fd0ad[_0xbb67('0x1a')][_0xbb67('0x1f')]));_0x192fbb['attributes']=_0x192fbb[_0xbb67('0x1e')][_0xbb67('0x20')]?_0x192fbb[_0xbb67('0x1e')]:_0x10916b[_0xbb67('0x18')];if(_0x3fd0ad[_0xbb67('0x1a')][_0xbb67('0x27')]){_0x192fbb[_0xbb67('0x28')]=[{'all':!![]}];}_0x192fbb=_[_0xbb67('0x26')]({},_0x192fbb,_0x3fd0ad[_0xbb67('0x2f')]);return db[_0xbb67('0x29')][_0xbb67('0x30')](_0x192fbb)[_0xbb67('0xf')](handleEntityNotFound(_0x4e1689,null))[_0xbb67('0xf')](respondWithResult(_0x4e1689,null))['catch'](handleError(_0x4e1689,null));};exports['create']=function(_0x4cabf5,_0x4d70d5){return db[_0xbb67('0x29')][_0xbb67('0x31')](_0x4cabf5[_0xbb67('0x32')],{})[_0xbb67('0xf')](respondWithResult(_0x4d70d5,0xc9))[_0xbb67('0x2c')](handleError(_0x4d70d5,null));};exports[_0xbb67('0xe')]=function(_0xa5581a,_0x448573){if(_0xa5581a['body']['id']){delete _0xa5581a[_0xbb67('0x32')]['id'];}return db[_0xbb67('0x29')][_0xbb67('0x30')]({'where':{'id':_0xa5581a['params']['id']}})['then'](handleEntityNotFound(_0x448573,null))['then'](saveUpdates(_0xa5581a['body'],null))[_0xbb67('0xf')](respondWithResult(_0x448573,null))['catch'](handleError(_0x448573,null));};exports[_0xbb67('0x33')]=function(_0x5ce19c,_0x4c573c){return db[_0xbb67('0x29')][_0xbb67('0x30')]({'where':{'id':_0x5ce19c[_0xbb67('0x2e')]['id']}})[_0xbb67('0xf')](handleEntityNotFound(_0x4c573c,null))[_0xbb67('0xf')](removeEntity(_0x4c573c,null))[_0xbb67('0x2c')](handleError(_0x4c573c,null));};exports[_0xbb67('0x34')]=function(_0x9f082c,_0x43948d){var _0x2ea193={};var _0x35768c={};var _0x59d531;var _0x2a4514;return db[_0xbb67('0x29')][_0xbb67('0x35')]({'where':{'id':_0x9f082c[_0xbb67('0x2e')]['id']}})['then'](handleEntityNotFound(_0x43948d,null))[_0xbb67('0xf')](function(_0x17c7b7){if(_0x17c7b7){_0x59d531=_0x17c7b7;_0x35768c[_0xbb67('0x18')]=_[_0xbb67('0x1b')](db[_0xbb67('0x36')][_0xbb67('0x15')]);_0x35768c['query']=_[_0xbb67('0x1b')](_0x9f082c[_0xbb67('0x1a')]);_0x35768c[_0xbb67('0x1c')]=_[_0xbb67('0x1d')](_0x35768c[_0xbb67('0x18')],_0x35768c['query']);_0x2ea193[_0xbb67('0x1e')]=_['intersection'](_0x35768c['model'],qs[_0xbb67('0x1f')](_0x9f082c[_0xbb67('0x1a')]['fields']));_0x2ea193[_0xbb67('0x1e')]=_0x2ea193[_0xbb67('0x1e')][_0xbb67('0x20')]?_0x2ea193[_0xbb67('0x1e')]:_0x35768c[_0xbb67('0x18')];_0x2ea193['order']=qs[_0xbb67('0x22')](_0x9f082c[_0xbb67('0x1a')][_0xbb67('0x22')]);_0x2ea193[_0xbb67('0x23')]=qs[_0xbb67('0x1c')](_[_0xbb67('0x24')](_0x9f082c['query'],_0x35768c[_0xbb67('0x1c')]));if(_0x9f082c[_0xbb67('0x1a')][_0xbb67('0x25')]){_0x2ea193[_0xbb67('0x23')]=_[_0xbb67('0x26')](_0x2ea193[_0xbb67('0x23')],{'$or':_[_0xbb67('0x19')](_0x2ea193[_0xbb67('0x1e')],function(_0x1a7076){var _0x1dfd05={};_0x1dfd05[_0x1a7076]={'$like':'%'+_0x9f082c[_0xbb67('0x1a')][_0xbb67('0x25')]+'%'};return _0x1dfd05;})});}_0x2ea193=_[_0xbb67('0x26')]({},_0x2ea193,_0x9f082c[_0xbb67('0x2f')]);return _0x59d531[_0xbb67('0x34')](_0x2ea193);}})[_0xbb67('0xf')](function(_0x4449b2){if(_0x4449b2){_0x2a4514=_0x4449b2[_0xbb67('0x20')];if(!_0x9f082c[_0xbb67('0x1a')][_0xbb67('0x21')](_0xbb67('0x37'))){_0x2ea193[_0xbb67('0x8')]=qs[_0xbb67('0x8')](_0x9f082c[_0xbb67('0x1a')][_0xbb67('0x8')]);_0x2ea193[_0xbb67('0xb')]=qs[_0xbb67('0xb')](_0x9f082c[_0xbb67('0x1a')]['offset']);}return _0x59d531[_0xbb67('0x34')](_0x2ea193);}})['then'](function(_0x347f42){if(_0x347f42){return _0x347f42?{'count':_0x2a4514,'rows':_0x347f42}:null;}})[_0xbb67('0xf')](respondWithResult(_0x43948d,null))['catch'](handleError(_0x43948d,null));};exports[_0xbb67('0x38')]=function(_0x112be7,_0xdae7b8){if(_0x112be7[_0xbb67('0x32')]['id']){delete _0x112be7[_0xbb67('0x32')]['id'];}return db[_0xbb67('0x29')][_0xbb67('0x35')]({'where':{'id':_0x112be7[_0xbb67('0x2e')]['id']}})[_0xbb67('0xf')](handleEntityNotFound(_0xdae7b8,null))[_0xbb67('0xf')](function(_0x367388){if(_0x367388){_0x112be7[_0xbb67('0x32')]['AccountId']=_0x367388['id'];_0x112be7[_0xbb67('0x32')][_0xbb67('0x39')]=integrations[_0xbb67('0x3a')](_0x112be7[_0xbb67('0x32')][_0xbb67('0x3b')],_0x112be7[_0xbb67('0x32')][_0xbb67('0x16')]);_0x112be7['body']['Descriptions']=integrations[_0xbb67('0x3c')](_0x112be7['body']['channel'],_0x112be7[_0xbb67('0x32')][_0xbb67('0x16')]);return db[_0xbb67('0x36')][_0xbb67('0x31')](_0x112be7[_0xbb67('0x32')],{'include':[{'model':db[_0xbb67('0x3d')],'as':'Subjects'},{'model':db[_0xbb67('0x3d')],'as':_0xbb67('0x3e')}]});}return null;})[_0xbb67('0xf')](respondWithResult(_0xdae7b8,null))[_0xbb67('0x2c')](handleError(_0xdae7b8,null));};function sanitizeRemoteUri(_0x8fd71d){var _0xdcbd14=_0x8fd71d[_0xbb67('0x3f')](-0x1);if(_0xdcbd14==='/')return _0x8fd71d[_0xbb67('0x40')](0x0,_0x8fd71d['lastIndexOf'](_0xdcbd14));return _0x8fd71d;}function getWebApiUrl(_0x297ac9){return util[_0xbb67('0x41')]('%s/api/data/v9.0/',_0x297ac9);}exports['getFields']=function(_0x1b4f52,_0x307e45){var _0x572c7d=_0x1b4f52['query']['ticketType'];var _0x2bc559=_0x572c7d===_0xbb67('0x42')?'Incident':_0xbb67('0x43');var _0x199341='';var _0x44261e='';var _0x384e9b='';var _0x19d0db='';var _0x381e76='';var _0x5f3443='';var _0x326624='';var _0x235eef='';var _0x5dc0b0=[_0xbb67('0x44'),'description','customerid',_0xbb67('0x45'),'caseorigincode',_0xbb67('0x46'),'phonenumber','regardingobjectid',_0xbb67('0x47'),_0xbb67('0x48')];var _0x340583=['accountidname',_0xbb67('0x49'),_0xbb67('0x4a'),'billedserviceunits',_0xbb67('0x4b'),'contactidyominame',_0xbb67('0x4c'),_0xbb67('0x4d'),_0xbb67('0x4e'),'createdbyexternalpartyyominame',_0xbb67('0x4f'),_0xbb67('0x50'),_0xbb67('0x51'),_0xbb67('0x52'),_0xbb67('0x53'),_0xbb67('0x54'),_0xbb67('0x55'),'customeridyominame','emailaddress',_0xbb67('0x56'),'entityimage_timestamp',_0xbb67('0x57'),_0xbb67('0x58'),_0xbb67('0x59'),'firstresponsebykpiidname',_0xbb67('0x5a'),_0xbb67('0x5b'),'influencescore',_0xbb67('0x5c'),_0xbb67('0x5d'),_0xbb67('0x5e'),'modifiedbyexternalpartyname',_0xbb67('0x5f'),_0xbb67('0x60'),_0xbb67('0x61'),_0xbb67('0x62'),_0xbb67('0x63'),'modifiedonbehalfbyyominame','msdyn_incidenttypename',_0xbb67('0x64'),'numberofchildincidents',_0xbb67('0x65'),'overriddencreatedon',_0xbb67('0x66'),_0xbb67('0x67'),'owneridyominame','parentcaseidname',_0xbb67('0x68'),_0xbb67('0x69'),_0xbb67('0x6a'),_0xbb67('0x6b'),_0xbb67('0x6c'),_0xbb67('0x6d'),_0xbb67('0x6e'),_0xbb67('0x6f'),_0xbb67('0x70'),'responsiblecontactidyominame','sentimentvalue',_0xbb67('0x71'),'slaname',_0xbb67('0x72'),_0xbb67('0x73'),_0xbb67('0x74'),_0xbb67('0x75'),_0xbb67('0x76'),_0xbb67('0x77'),_0xbb67('0x78'),'traversedpath',_0xbb67('0x79'),_0xbb67('0x7a')];var _0x2b3163=_0x5dc0b0[_0xbb67('0x7b')](_0x340583);return db['Dynamics365Account'][_0xbb67('0x35')]({'where':{'id':_0x1b4f52[_0xbb67('0x2e')]['id']},'attributes':['id',_0xbb67('0x7c'),_0xbb67('0x7d'),_0xbb67('0x7e'),_0xbb67('0x7f'),_0xbb67('0x80'),_0xbb67('0x81'),_0xbb67('0x82')],'include':[{'model':db[_0xbb67('0x83')],'as':_0xbb67('0x83'),'attributes':['id',_0xbb67('0x84'),_0xbb67('0x85')]}]})[_0xbb67('0xf')](handleEntityNotFound(_0x307e45,null))[_0xbb67('0xf')](function(_0x4b896e){if(_0x4b896e){if(_0x4b896e[_0xbb67('0x82')]){_0x4b896e[_0xbb67('0x86')]=_0x4b896e[_0xbb67('0x83')]['data5'];_0x235eef=sanitizeRemoteUri(_0x4b896e[_0xbb67('0x83')][_0xbb67('0x85')]);_0x326624=getWebApiUrl(_0x235eef);return _0x4b896e;}_0x235eef=sanitizeRemoteUri(_0x4b896e['remoteUri']);_0x326624=getWebApiUrl(_0x235eef);var _0x1710ee={'method':_0xbb67('0x87'),'uri':_0xbb67('0x88')+_0x4b896e[_0xbb67('0x7f')]+_0xbb67('0x89'),'form':{'client_id':_0x4b896e[_0xbb67('0x80')],'resource':_0x235eef,'username':_0x4b896e['username'],'password':_0x4b896e[_0xbb67('0x7d')],'grant_type':'password','client_secret':_0x4b896e[_0xbb67('0x81')]},'json':!![]};return rp(_0x1710ee);}})[_0xbb67('0xf')](function(_0x30c904){_0x5f3443=_0x30c904[_0xbb67('0x86')];var _0x16790e={'method':_0xbb67('0x8a'),'uri':encodeURI(_0x326624+_0xbb67('0x8b')+_0x2bc559+'\x27'),'headers':{'Authorization':_0xbb67('0x8c')+_0x5f3443,'If-None-Match':null,'OData-Version':_0xbb67('0x8d')},'json':!![]};return rp(_0x16790e);})[_0xbb67('0xf')](function(_0x55c745){var _0x4877c2=_0x55c745[_0xbb67('0x8e')][0x0];var _0x3cd203=_0x4877c2[_0xbb67('0x8f')];var _0x2200d9={'method':_0xbb67('0x8a'),'uri':_0x326624+'EntityDefinitions('+_0x3cd203+_0xbb67('0x90'),'headers':{'Authorization':'Bearer\x20'+_0x5f3443,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x2200d9);})['then'](function(_0x539069){_0x199341=_0x539069;_0x44261e=_0x199341[_0xbb67('0x91')];_0x44261e=_[_0xbb67('0x92')](_0x44261e,function(_0xeec7a3){return!_0x2b3163['includes'](_0xeec7a3[_0xbb67('0x93')]);});var _0x565e24=[];var _0x420572=[];_0x44261e[_0xbb67('0x94')](function(_0x5df4fd){if(_0x5df4fd[_0xbb67('0x95')]){var _0x1f7fc4=_0x5df4fd[_0xbb67('0x95')]['substring'](_0x5df4fd['@odata.type']['lastIndexOf']('.')+0x1);if(_0x1f7fc4===_0xbb67('0x96')){_0x565e24['push'](getSelectList(_0x326624,_0x572c7d,_0x420572,_0x199341['MetadataId'],_0x5df4fd['MetadataId'],_0x5f3443));}}});return Promise[_0xbb67('0x97')](_0x565e24);})[_0xbb67('0xf')](function(_0x52fcf3){_0x384e9b=_0x52fcf3[0x0];var _0x5a8f81=[];var _0x52b53c=[];_0x44261e['forEach'](function(_0x5d660b){if(!_[_0xbb67('0x98')](_0x5d660b[_0xbb67('0x95')])){var _0x29c8a0=_0x5d660b['@odata.type'][_0xbb67('0x40')](_0x5d660b[_0xbb67('0x95')]['lastIndexOf']('.')+0x1);if(_0x29c8a0==='BooleanAttributeMetadata'){_0x5a8f81[_0xbb67('0x99')](getBooleanList(_0x326624,_0x572c7d,_0x52b53c,_0x199341[_0xbb67('0x8f')],_0x5d660b[_0xbb67('0x8f')],_0x5f3443));}}});return Promise['all'](_0x5a8f81);})[_0xbb67('0xf')](function(_0x407b0c){_0x19d0db=_0x407b0c[0x0];var _0xeca4a8=[];var _0x333ef5=[];_0x44261e[_0xbb67('0x94')](function(_0x5b5d94){if(_0x5b5d94['@odata.type']){var _0x4d0e68=_0x5b5d94[_0xbb67('0x95')]['substring'](_0x5b5d94[_0xbb67('0x95')]['lastIndexOf']('.')+0x1);if(_0x4d0e68===_0xbb67('0x9a')||_0x4d0e68===_0xbb67('0x9b')||_0x4d0e68===_0xbb67('0x9c')||_0x4d0e68==='IntegerAttributeMetadata'||_0x4d0e68===_0xbb67('0x9d')||_0x4d0e68==='DateTimeAttributeMetadata'||_0x4d0e68===_0xbb67('0x9e')||_0x4d0e68===_0xbb67('0x9f')||_0x4d0e68===_0xbb67('0xa0')||_0x4d0e68==='DecimalAttributeMetadata'){_0xeca4a8['push'](getInputList(_0x326624,_0x572c7d,_0x4d0e68,_0x333ef5,_0x199341[_0xbb67('0x8f')],_0x5b5d94[_0xbb67('0x8f')],_0x5f3443));}}});return Promise[_0xbb67('0x97')](_0xeca4a8);})[_0xbb67('0xf')](function(_0x48ab27){_0x381e76=_0x48ab27[0x0];var _0x55bccd=_0x384e9b[_0xbb67('0x7b')](_0x19d0db)['concat'](_0x381e76);var _0x5c0f2e={'count':_0x55bccd['length'],'rows':_0x55bccd};return _0x5c0f2e;})[_0xbb67('0xf')](respondWithResult(_0x307e45,null))[_0xbb67('0x2c')](function(_0x56989d){var _0xd2faa0=_0x1b4f52[_0xbb67('0x1a')]['test']?0x1f4:_0x56989d['statusCode']||0x1f4;logger[_0xbb67('0x12')](_0x56989d[_0xbb67('0x13')]);delete _0x56989d['name'];if(_0xd2faa0===0x191){_0xd2faa0=0x190;}_0x307e45[_0xbb67('0x6')](_0xd2faa0)[_0xbb67('0xa1')](_0x1b4f52[_0xbb67('0x1a')][_0xbb67('0xa2')]?{'message':'Wrong\x20credentials','statusCode':_0x56989d[_0xbb67('0xa3')]}:_0x56989d);});};function getSelectList(_0x108030,_0x3a7a7f,_0x48e137,_0x507f1e,_0x2124ae,_0x23d0a3){var _0x257440={'method':_0xbb67('0x8a'),'uri':_0x108030+_0xbb67('0xa4')+_0x507f1e+_0xbb67('0xa5')+_0x2124ae+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+_0xbb67('0xa6'),'headers':{'Authorization':_0xbb67('0x8c')+_0x23d0a3,'If-None-Match':null,'OData-Version':_0xbb67('0x8d')},'json':!![]};return rp(_0x257440)['then'](function(_0x7ba68e){var _0x1ab7bc=[];var _0x49c96b=_0x7ba68e[_0xbb67('0xa7')][_0xbb67('0xa8')];_0x49c96b[_0xbb67('0x94')](function(_0x39d6ff){_0x1ab7bc[_0xbb67('0x99')]({'name':_0x39d6ff[_0xbb67('0xa9')][_0xbb67('0xaa')][_0xbb67('0xa9')],'value':String(_0x39d6ff[_0xbb67('0xab')])});});var _0x4acf23={'id':_0x3a7a7f+'_'+_0x7ba68e[_0xbb67('0x93')],'name':_0x7ba68e['DisplayName'][_0xbb67('0xaa')][_0xbb67('0xa9')],'custom':![],'options':_0x1ab7bc};_0x48e137[_0xbb67('0x99')](_0x4acf23);return _0x48e137;});}function getBooleanList(_0x193c72,_0x50d362,_0x2677ed,_0x460672,_0x4b47de,_0x68f270){var _0x13f9ae={'method':_0xbb67('0x8a'),'uri':_0x193c72+_0xbb67('0xa4')+_0x460672+_0xbb67('0xa5')+_0x4b47de+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0xbb67('0x8c')+_0x68f270,'If-None-Match':null,'OData-Version':_0xbb67('0x8d')},'json':!![]};return rp(_0x13f9ae)[_0xbb67('0xf')](function(_0x14400d){var _0x5462a1=[];_0x5462a1[_0xbb67('0x99')]({'name':_0x14400d[_0xbb67('0xa7')][_0xbb67('0xac')]['Label']['UserLocalizedLabel']['Label'],'value':_0xbb67('0xad')},{'name':_0x14400d[_0xbb67('0xa7')][_0xbb67('0xae')]['Label'][_0xbb67('0xaa')][_0xbb67('0xa9')],'value':_0xbb67('0xaf')});var _0x552b81={'id':_0x50d362+'_'+_0x14400d[_0xbb67('0x93')],'name':_0x14400d[_0xbb67('0xb0')][_0xbb67('0xaa')][_0xbb67('0xa9')],'custom':![],'options':_0x5462a1};_0x2677ed[_0xbb67('0x99')](_0x552b81);return _0x2677ed;});}function getInputList(_0x89bf58,_0x54286a,_0x457571,_0x3167e4,_0x329f42,_0x258546,_0x3c5907){var _0xe8258a={'method':_0xbb67('0x8a'),'uri':_0x89bf58+'EntityDefinitions('+_0x329f42+_0xbb67('0xa5')+_0x258546+_0xbb67('0xb1')+_0x457571+_0xbb67('0xb2'),'headers':{'Authorization':_0xbb67('0x8c')+_0x3c5907,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0xe8258a)['then'](function(_0x44190c){var _0x316b65={'id':_0x54286a+'_'+_0x44190c[_0xbb67('0x93')],'name':_0x44190c['DisplayName'][_0xbb67('0xaa')]?_0x44190c[_0xbb67('0xb0')][_0xbb67('0xaa')][_0xbb67('0xa9')]:_0x44190c[_0xbb67('0x93')],'custom':![],'options':[]};_0x3167e4[_0xbb67('0x99')](_0x316b65);return _0x3167e4;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index da56832..87f9cff 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 _0x757a=['Dynamics365Account','int_dynamics365_accounts','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration'];(function(_0x57d705,_0x55d8f0){var _0x2b4088=function(_0x313843){while(--_0x313843){_0x57d705['push'](_0x57d705['shift']());}};_0x2b4088(++_0x55d8f0);}(_0x757a,0xde));var _0xa757=function(_0xfa2adc,_0x3399d9){_0xfa2adc=_0xfa2adc-0x0;var _0x517aaa=_0x757a[_0xfa2adc];return _0x517aaa;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));var integrations=require(_0xa757('0x7'));module['exports']=function(_0xae0e7c,_0x4343b6){return _0xae0e7c['define'](_0xa757('0x8'),attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb7e7=['int_dynamics365_accounts','lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','define'];(function(_0x2588e1,_0x5e78d5){var _0x6418c=function(_0x545a07){while(--_0x545a07){_0x2588e1['push'](_0x2588e1['shift']());}};_0x6418c(++_0x5e78d5);}(_0xb7e7,0x121));var _0x7b7e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xb7e7[_0x34bc30];return _0x5706de;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x333fa4,_0x372bde){return _0x333fa4[_0x7b7e('0x7')]('Dynamics365Account',attributes,{'tableName':_0x7b7e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index 2ace6da..117051b 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 _0xcb30=['code','message','Dynamics365Account,\x20%s,\x20%s','info','result','catch','GetDynamics365Account','findAll','options','raw','attributes','map','include','model','ShowDynamics365Account','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','request\x20sent','debug','stringify','error'];(function(_0x544fa6,_0x4f811){var _0x108c1b=function(_0xe4f966){while(--_0xe4f966){_0x544fa6['push'](_0x544fa6['shift']());}};_0x108c1b(++_0x4f811);}(_0xcb30,0x1bd));var _0x0cb3=function(_0x1909d2,_0x4b4803){_0x1909d2=_0x1909d2-0x0;var _0x1f57e1=_0xcb30[_0x1909d2];return _0x1f57e1;};'use strict';var _=require(_0x0cb3('0x0'));var util=require(_0x0cb3('0x1'));var moment=require(_0x0cb3('0x2'));var BPromise=require(_0x0cb3('0x3'));var rs=require(_0x0cb3('0x4'));var fs=require('fs');var Redis=require(_0x0cb3('0x5'));var db=require(_0x0cb3('0x6'))['db'];var utils=require(_0x0cb3('0x7'));var logger=require(_0x0cb3('0x8'))(_0x0cb3('0x9'));var config=require('../../config/environment');var jayson=require(_0x0cb3('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x45bbfc,_0x5a8fe0,_0x119795){return new BPromise(function(_0x91b2bd,_0x5f0ed9){return client[_0x0cb3('0xb')](_0x45bbfc,_0x119795)[_0x0cb3('0xc')](function(_0x28420b){logger['info']('Dynamics365Account,\x20%s,\x20%s',_0x5a8fe0,_0x0cb3('0xd'));logger[_0x0cb3('0xe')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x5a8fe0,'request\x20sent',JSON[_0x0cb3('0xf')](_0x28420b));if(_0x28420b[_0x0cb3('0x10')]){if(_0x28420b['error'][_0x0cb3('0x11')]===0x1f4){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x5a8fe0,_0x28420b['error'][_0x0cb3('0x12')]);return _0x5f0ed9(_0x28420b[_0x0cb3('0x10')][_0x0cb3('0x12')]);}logger['error'](_0x0cb3('0x13'),_0x5a8fe0,_0x28420b['error'][_0x0cb3('0x12')]);return _0x91b2bd(_0x28420b[_0x0cb3('0x10')][_0x0cb3('0x12')]);}else{logger[_0x0cb3('0x14')](_0x0cb3('0x13'),_0x5a8fe0,_0x0cb3('0xd'));_0x91b2bd(_0x28420b[_0x0cb3('0x15')][_0x0cb3('0x12')]);}})[_0x0cb3('0x16')](function(_0x4bc5da){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x5a8fe0,_0x4bc5da);_0x5f0ed9(_0x4bc5da);});});}exports[_0x0cb3('0x17')]=function(_0x5ccd16){var _0x23c182=this;return new Promise(function(_0x3bd758,_0x6fbb59){return db['Dynamics365Account'][_0x0cb3('0x18')]({'raw':_0x5ccd16['options']?_0x5ccd16[_0x0cb3('0x19')][_0x0cb3('0x1a')]===undefined?!![]:![]:!![],'where':_0x5ccd16[_0x0cb3('0x19')]?_0x5ccd16['options']['where']||null:null,'attributes':_0x5ccd16[_0x0cb3('0x19')]?_0x5ccd16['options'][_0x0cb3('0x1b')]||null:null,'limit':_0x5ccd16['options']?_0x5ccd16['options']['limit']||null:null,'include':_0x5ccd16[_0x0cb3('0x19')]?_0x5ccd16[_0x0cb3('0x19')]['include']?_[_0x0cb3('0x1c')](_0x5ccd16[_0x0cb3('0x19')][_0x0cb3('0x1d')],function(_0x1742f4){return{'model':db[_0x1742f4[_0x0cb3('0x1e')]],'as':_0x1742f4['as'],'attributes':_0x1742f4[_0x0cb3('0x1b')],'include':_0x1742f4[_0x0cb3('0x1d')]?_[_0x0cb3('0x1c')](_0x1742f4[_0x0cb3('0x1d')],function(_0x56b4cd){return{'model':db[_0x56b4cd[_0x0cb3('0x1e')]],'as':_0x56b4cd['as'],'attributes':_0x56b4cd['attributes'],'include':_0x56b4cd[_0x0cb3('0x1d')]?_['map'](_0x56b4cd[_0x0cb3('0x1d')],function(_0x45bcdc){return{'model':db[_0x45bcdc['model']],'as':_0x45bcdc['as'],'attributes':_0x45bcdc[_0x0cb3('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x189ab7){logger['info'](_0x0cb3('0x17'),_0x5ccd16);logger['debug']('GetDynamics365Account',_0x5ccd16,JSON[_0x0cb3('0xf')](_0x189ab7));_0x3bd758(_0x189ab7);})[_0x0cb3('0x16')](function(_0x1c2dc4){logger[_0x0cb3('0x10')](_0x0cb3('0x17'),_0x1c2dc4[_0x0cb3('0x12')],_0x5ccd16);_0x6fbb59(_0x23c182[_0x0cb3('0x10')](0x1f4,_0x1c2dc4[_0x0cb3('0x12')]));});});};exports[_0x0cb3('0x1f')]=function(_0x3c5e03){var _0x380a53=this;return new Promise(function(_0xa7c244,_0x346849){return db['Dynamics365Account'][_0x0cb3('0x20')]({'raw':_0x3c5e03[_0x0cb3('0x19')]?_0x3c5e03[_0x0cb3('0x19')][_0x0cb3('0x1a')]===undefined?!![]:![]:!![],'where':_0x3c5e03[_0x0cb3('0x19')]?_0x3c5e03[_0x0cb3('0x19')]['where']||null:null,'attributes':_0x3c5e03[_0x0cb3('0x19')]?_0x3c5e03[_0x0cb3('0x19')][_0x0cb3('0x1b')]||null:null,'include':_0x3c5e03[_0x0cb3('0x19')]?_0x3c5e03['options'][_0x0cb3('0x1d')]?_[_0x0cb3('0x1c')](_0x3c5e03[_0x0cb3('0x19')][_0x0cb3('0x1d')],function(_0xb0cb19){return{'model':db[_0xb0cb19[_0x0cb3('0x1e')]],'as':_0xb0cb19['as'],'attributes':_0xb0cb19['attributes'],'include':_0xb0cb19[_0x0cb3('0x1d')]?_['map'](_0xb0cb19['include'],function(_0x2e2d09){return{'model':db[_0x2e2d09['model']],'as':_0x2e2d09['as'],'attributes':_0x2e2d09[_0x0cb3('0x1b')],'include':_0x2e2d09['include']?_[_0x0cb3('0x1c')](_0x2e2d09['include'],function(_0x3b2cc0){return{'model':db[_0x3b2cc0[_0x0cb3('0x1e')]],'as':_0x3b2cc0['as'],'attributes':_0x3b2cc0[_0x0cb3('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x8d4631){logger['info'](_0x0cb3('0x1f'),_0x3c5e03);logger['debug'](_0x0cb3('0x1f'),_0x3c5e03,JSON[_0x0cb3('0xf')](_0x8d4631));_0xa7c244(_0x8d4631);})[_0x0cb3('0x16')](function(_0x317ea6){logger[_0x0cb3('0x10')](_0x0cb3('0x1f'),_0x317ea6['message'],_0x3c5e03);_0x346849(_0x380a53[_0x0cb3('0x10')](0x1f4,_0x317ea6[_0x0cb3('0x12')]));});});}; \ No newline at end of file +var _0x07ba=['map','model','GetDynamics365Account','ShowDynamics365Account','find','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','Dynamics365Account,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','catch','Dynamics365Account','options','raw','where','attributes','include'];(function(_0x577e86,_0x789d0d){var _0x4d8fd9=function(_0x3beca5){while(--_0x3beca5){_0x577e86['push'](_0x577e86['shift']());}};_0x4d8fd9(++_0x789d0d);}(_0x07ba,0x1a5));var _0xa07b=function(_0x53125c,_0x1b29b6){_0x53125c=_0x53125c-0x0;var _0x5628e2=_0x07ba[_0x53125c];return _0x5628e2;};'use strict';var _=require('lodash');var util=require(_0xa07b('0x0'));var moment=require(_0xa07b('0x1'));var BPromise=require('bluebird');var rs=require(_0xa07b('0x2'));var fs=require('fs');var Redis=require(_0xa07b('0x3'));var db=require(_0xa07b('0x4'))['db'];var utils=require(_0xa07b('0x5'));var logger=require(_0xa07b('0x6'))(_0xa07b('0x7'));var config=require(_0xa07b('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xa07b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x238cb0,_0x175ff6,_0x518204){return new BPromise(function(_0x3e8d35,_0x441d5b){return client['request'](_0x238cb0,_0x518204)[_0xa07b('0xa')](function(_0x48e33a){logger['info'](_0xa07b('0xb'),_0x175ff6,'request\x20sent');logger[_0xa07b('0xc')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x175ff6,_0xa07b('0xd'),JSON[_0xa07b('0xe')](_0x48e33a));if(_0x48e33a[_0xa07b('0xf')]){if(_0x48e33a[_0xa07b('0xf')][_0xa07b('0x10')]===0x1f4){logger[_0xa07b('0xf')]('Dynamics365Account,\x20%s,\x20%s',_0x175ff6,_0x48e33a[_0xa07b('0xf')][_0xa07b('0x11')]);return _0x441d5b(_0x48e33a['error'][_0xa07b('0x11')]);}logger['error'](_0xa07b('0xb'),_0x175ff6,_0x48e33a[_0xa07b('0xf')][_0xa07b('0x11')]);return _0x3e8d35(_0x48e33a[_0xa07b('0xf')][_0xa07b('0x11')]);}else{logger[_0xa07b('0x12')](_0xa07b('0xb'),_0x175ff6,_0xa07b('0xd'));_0x3e8d35(_0x48e33a[_0xa07b('0x13')]['message']);}})[_0xa07b('0x14')](function(_0x26ad4d){logger[_0xa07b('0xf')](_0xa07b('0xb'),_0x175ff6,_0x26ad4d);_0x441d5b(_0x26ad4d);});});}exports['GetDynamics365Account']=function(_0x10ae2e){var _0x635a20=this;return new Promise(function(_0x565f45,_0x59887d){return db[_0xa07b('0x15')]['findAll']({'raw':_0x10ae2e[_0xa07b('0x16')]?_0x10ae2e[_0xa07b('0x16')][_0xa07b('0x17')]===undefined?!![]:![]:!![],'where':_0x10ae2e[_0xa07b('0x16')]?_0x10ae2e[_0xa07b('0x16')][_0xa07b('0x18')]||null:null,'attributes':_0x10ae2e[_0xa07b('0x16')]?_0x10ae2e['options'][_0xa07b('0x19')]||null:null,'limit':_0x10ae2e['options']?_0x10ae2e[_0xa07b('0x16')]['limit']||null:null,'include':_0x10ae2e[_0xa07b('0x16')]?_0x10ae2e[_0xa07b('0x16')][_0xa07b('0x1a')]?_[_0xa07b('0x1b')](_0x10ae2e[_0xa07b('0x16')][_0xa07b('0x1a')],function(_0x4eca9f){return{'model':db[_0x4eca9f[_0xa07b('0x1c')]],'as':_0x4eca9f['as'],'attributes':_0x4eca9f[_0xa07b('0x19')],'include':_0x4eca9f['include']?_[_0xa07b('0x1b')](_0x4eca9f[_0xa07b('0x1a')],function(_0x47e126){return{'model':db[_0x47e126[_0xa07b('0x1c')]],'as':_0x47e126['as'],'attributes':_0x47e126[_0xa07b('0x19')],'include':_0x47e126['include']?_[_0xa07b('0x1b')](_0x47e126[_0xa07b('0x1a')],function(_0x292b71){return{'model':db[_0x292b71[_0xa07b('0x1c')]],'as':_0x292b71['as'],'attributes':_0x292b71[_0xa07b('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x522442){logger[_0xa07b('0x12')](_0xa07b('0x1d'),_0x10ae2e);logger[_0xa07b('0xc')](_0xa07b('0x1d'),_0x10ae2e,JSON[_0xa07b('0xe')](_0x522442));_0x565f45(_0x522442);})[_0xa07b('0x14')](function(_0x51e280){logger[_0xa07b('0xf')](_0xa07b('0x1d'),_0x51e280[_0xa07b('0x11')],_0x10ae2e);_0x59887d(_0x635a20[_0xa07b('0xf')](0x1f4,_0x51e280[_0xa07b('0x11')]));});});};exports[_0xa07b('0x1e')]=function(_0x3bae02){var _0xde8993=this;return new Promise(function(_0x3f9066,_0x11da4c){return db['Dynamics365Account'][_0xa07b('0x1f')]({'raw':_0x3bae02[_0xa07b('0x16')]?_0x3bae02[_0xa07b('0x16')][_0xa07b('0x17')]===undefined?!![]:![]:!![],'where':_0x3bae02[_0xa07b('0x16')]?_0x3bae02[_0xa07b('0x16')][_0xa07b('0x18')]||null:null,'attributes':_0x3bae02[_0xa07b('0x16')]?_0x3bae02[_0xa07b('0x16')][_0xa07b('0x19')]||null:null,'include':_0x3bae02[_0xa07b('0x16')]?_0x3bae02['options'][_0xa07b('0x1a')]?_['map'](_0x3bae02[_0xa07b('0x16')][_0xa07b('0x1a')],function(_0x255d49){return{'model':db[_0x255d49['model']],'as':_0x255d49['as'],'attributes':_0x255d49[_0xa07b('0x19')],'include':_0x255d49[_0xa07b('0x1a')]?_[_0xa07b('0x1b')](_0x255d49[_0xa07b('0x1a')],function(_0x595a1d){return{'model':db[_0x595a1d['model']],'as':_0x595a1d['as'],'attributes':_0x595a1d[_0xa07b('0x19')],'include':_0x595a1d[_0xa07b('0x1a')]?_[_0xa07b('0x1b')](_0x595a1d[_0xa07b('0x1a')],function(_0x4ebc92){return{'model':db[_0x4ebc92[_0xa07b('0x1c')]],'as':_0x4ebc92['as'],'attributes':_0x4ebc92[_0xa07b('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5dc2ac){logger['info'](_0xa07b('0x1e'),_0x3bae02);logger['debug'](_0xa07b('0x1e'),_0x3bae02,JSON[_0xa07b('0xe')](_0x5dc2ac));_0x3f9066(_0x5dc2ac);})[_0xa07b('0x14')](function(_0x217284){logger['error'](_0xa07b('0x1e'),_0x217284[_0xa07b('0x11')],_0x3bae02);_0x11da4c(_0xde8993[_0xa07b('0xf')](0x1f4,_0x217284[_0xa07b('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index def2f29..b591f87 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 _0xea77=['destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','/:id','show','/:id/fields','isAuthenticated','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete'];(function(_0x1903f6,_0x47438b){var _0x2296ff=function(_0x365225){while(--_0x365225){_0x1903f6['push'](_0x1903f6['shift']());}};_0x2296ff(++_0x47438b);}(_0xea77,0xd1));var _0x7ea7=function(_0x34071e,_0x3e5719){_0x34071e=_0x34071e-0x0;var _0x3b76af=_0xea77[_0x34071e];return _0x3b76af;};'use strict';var multer=require(_0x7ea7('0x0'));var util=require(_0x7ea7('0x1'));var path=require(_0x7ea7('0x2'));var timeout=require(_0x7ea7('0x3'));var express=require(_0x7ea7('0x4'));var router=express[_0x7ea7('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x7ea7('0x6'));var interaction=require(_0x7ea7('0x7'));var config=require(_0x7ea7('0x8'));var controller=require(_0x7ea7('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x7ea7('0xa')](_0x7ea7('0xb'),auth['isAuthenticated'](),controller[_0x7ea7('0xc')]);router[_0x7ea7('0xa')](_0x7ea7('0xd'),auth[_0x7ea7('0xe')](),controller[_0x7ea7('0xf')]);router[_0x7ea7('0xa')](_0x7ea7('0x10'),auth[_0x7ea7('0xe')](),controller[_0x7ea7('0x11')]);router[_0x7ea7('0xa')](_0x7ea7('0x12'),auth[_0x7ea7('0xe')](),controller[_0x7ea7('0x13')]);router[_0x7ea7('0x14')]('/',auth['isAuthenticated'](),controller[_0x7ea7('0x15')]);router[_0x7ea7('0x16')](_0x7ea7('0xb'),auth[_0x7ea7('0xe')](),controller[_0x7ea7('0x17')]);router[_0x7ea7('0x18')](_0x7ea7('0xb'),auth[_0x7ea7('0xe')](),controller[_0x7ea7('0x19')]);module['exports']=router; \ No newline at end of file +var _0xbf77=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intDynamics365Configuration.controller','get','index','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','put','/:id','update','delete'];(function(_0x4ab630,_0x1a3c49){var _0x192e41=function(_0x57c365){while(--_0x57c365){_0x4ab630['push'](_0x4ab630['shift']());}};_0x192e41(++_0x1a3c49);}(_0xbf77,0xec));var _0x7bf7=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0xbf77[_0x68c979];return _0x4f0001;};'use strict';var multer=require(_0x7bf7('0x0'));var util=require(_0x7bf7('0x1'));var path=require(_0x7bf7('0x2'));var timeout=require(_0x7bf7('0x3'));var express=require(_0x7bf7('0x4'));var router=express[_0x7bf7('0x5')]();var fs_extra=require(_0x7bf7('0x6'));var auth=require(_0x7bf7('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x7bf7('0x8'));var controller=require(_0x7bf7('0x9'));router[_0x7bf7('0xa')]('/',auth['isAuthenticated'](),controller[_0x7bf7('0xb')]);router[_0x7bf7('0xa')]('/:id',auth[_0x7bf7('0xc')](),controller[_0x7bf7('0xd')]);router[_0x7bf7('0xa')](_0x7bf7('0xe'),auth['isAuthenticated'](),controller[_0x7bf7('0xf')]);router[_0x7bf7('0xa')](_0x7bf7('0x10'),auth[_0x7bf7('0xc')](),controller[_0x7bf7('0x11')]);router[_0x7bf7('0xa')](_0x7bf7('0x12'),auth[_0x7bf7('0xc')](),controller[_0x7bf7('0x13')]);router['post']('/',auth[_0x7bf7('0xc')](),controller['create']);router[_0x7bf7('0x14')](_0x7bf7('0x15'),auth['isAuthenticated'](),controller[_0x7bf7('0x16')]);router[_0x7bf7('0x17')](_0x7bf7('0x15'),auth[_0x7bf7('0xc')](),controller[_0x7bf7('0x18')]);module[_0x7bf7('0x19')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 54d5ae8..02034f0 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 _0xbad8=['phonecall','incident','contact','nothing','exports','STRING','ENUM'];(function(_0x4f1c6c,_0x1e8f52){var _0x1d9e2a=function(_0xbd0746){while(--_0xbd0746){_0x4f1c6c['push'](_0x4f1c6c['shift']());}};_0x1d9e2a(++_0x1e8f52);}(_0xbad8,0x7b));var _0x8bad=function(_0x28b440,_0x1b2b23){_0x28b440=_0x28b440-0x0;var _0x271fdd=_0xbad8[_0x28b440];return _0x271fdd;};'use strict';var Sequelize=require('sequelize');module[_0x8bad('0x0')]={'name':{'type':Sequelize[_0x8bad('0x1')]},'description':{'type':Sequelize[_0x8bad('0x1')]},'ticketType':{'type':Sequelize[_0x8bad('0x2')]('incident',_0x8bad('0x3')),'defaultValue':_0x8bad('0x4')},'moduleCreate':{'type':Sequelize['ENUM'](_0x8bad('0x5'),_0x8bad('0x6')),'defaultValue':_0x8bad('0x5'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x8bad('0x1')],'allowNull':!![]},'openNewTab':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xa7d4=['nothing','BOOLEAN','sequelize','exports','STRING','ENUM','incident','contact'];(function(_0x37c6c3,_0x95ace){var _0xf87ee2=function(_0x16d7f9){while(--_0x16d7f9){_0x37c6c3['push'](_0x37c6c3['shift']());}};_0xf87ee2(++_0x95ace);}(_0xa7d4,0x19a));var _0x4a7d=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0xa7d4[_0x13e741];return _0x3f8bb3;};'use strict';var Sequelize=require(_0x4a7d('0x0'));module[_0x4a7d('0x1')]={'name':{'type':Sequelize[_0x4a7d('0x2')]},'description':{'type':Sequelize[_0x4a7d('0x2')]},'ticketType':{'type':Sequelize[_0x4a7d('0x3')](_0x4a7d('0x4'),'phonecall'),'defaultValue':'incident'},'moduleCreate':{'type':Sequelize[_0x4a7d('0x3')](_0x4a7d('0x5'),_0x4a7d('0x6')),'defaultValue':_0x4a7d('0x5'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize['STRING'],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x4a7d('0x7')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 5abf538..fa0aba1 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 _0x0cc3=['body','getFields','findOne','Dynamics365Field','getSubjects','getDescriptions','eml-format','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','Dynamics365Configuration','findAll','rows','show','params','find','catch','create'];(function(_0x4fa1b,_0x3fa541){var _0x5152cf=function(_0x15727b){while(--_0x15727b){_0x4fa1b['push'](_0x4fa1b['shift']());}};_0x5152cf(++_0x3fa541);}(_0x0cc3,0x14a));var _0x30cc=function(_0x1586e6,_0xb1cada){_0x1586e6=_0x1586e6-0x0;var _0x504c27=_0x0cc3[_0x1586e6];return _0x504c27;};'use strict';var emlformat=require(_0x30cc('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x30cc('0x1'));var BPromise=require(_0x30cc('0x2'));var Mustache=require(_0x30cc('0x3'));var util=require(_0x30cc('0x4'));var path=require(_0x30cc('0x5'));var sox=require(_0x30cc('0x6'));var csv=require(_0x30cc('0x7'));var ejs=require(_0x30cc('0x8'));var fs=require('fs');var fs_extra=require(_0x30cc('0x9'));var _=require(_0x30cc('0xa'));var squel=require(_0x30cc('0xb'));var crypto=require('crypto');var jsforce=require(_0x30cc('0xc'));var deskjs=require(_0x30cc('0xd'));var toCsv=require(_0x30cc('0x7'));var querystring=require(_0x30cc('0xe'));var Papa=require(_0x30cc('0xf'));var Redis=require(_0x30cc('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x30cc('0x11'));var as=require(_0x30cc('0x12'));var hardwareService=require(_0x30cc('0x13'));var logger=require(_0x30cc('0x14'))(_0x30cc('0x15'));var utils=require('../../config/utils');var config=require(_0x30cc('0x16'));var licenseUtil=require(_0x30cc('0x17'));var db=require(_0x30cc('0x18'))['db'];function respondWithStatusCode(_0x18b86c,_0x361d32){_0x361d32=_0x361d32||0xcc;return function(_0xba6300){if(_0xba6300){return _0x18b86c[_0x30cc('0x19')](_0x361d32);}return _0x18b86c['status'](_0x361d32)[_0x30cc('0x1a')]();};}function respondWithResult(_0x2a0d71,_0x16468f){_0x16468f=_0x16468f||0xc8;return function(_0x5ea33c){if(_0x5ea33c){return _0x2a0d71[_0x30cc('0x1b')](_0x16468f)[_0x30cc('0x1c')](_0x5ea33c);}};}function respondWithFilteredResult(_0x36d78d,_0x11a0f4){return function(_0x1d1f6f){if(_0x1d1f6f){var _0x415908=typeof _0x11a0f4[_0x30cc('0x1d')]===_0x30cc('0x1e')&&typeof _0x11a0f4[_0x30cc('0x1f')]===_0x30cc('0x1e');var _0x447bac=_0x1d1f6f['count'];var _0x529d55=_0x415908?0x0:_0x11a0f4[_0x30cc('0x1d')];var _0x2c4467=_0x415908?_0x1d1f6f[_0x30cc('0x20')]:_0x11a0f4[_0x30cc('0x1d')]+_0x11a0f4['limit'];var _0x32d756;if(_0x2c4467>=_0x447bac){_0x2c4467=_0x447bac;_0x32d756=0xc8;}else{_0x32d756=0xce;}_0x36d78d['status'](_0x32d756);return _0x36d78d[_0x30cc('0x21')](_0x30cc('0x22'),_0x529d55+'-'+_0x2c4467+'/'+_0x447bac)[_0x30cc('0x1c')](_0x1d1f6f);}return null;};}function patchUpdates(_0x477737){return function(_0x32a5eb){try{jsonpatch[_0x30cc('0x23')](_0x32a5eb,_0x477737,!![]);}catch(_0x3e5f99){return BPromise['reject'](_0x3e5f99);}return _0x32a5eb[_0x30cc('0x24')]();};}function saveUpdates(_0x6a3707,_0x550c42){return function(_0x55023c){if(_0x55023c){return _0x55023c[_0x30cc('0x25')](_0x6a3707)[_0x30cc('0x26')](function(_0x3b1803){return _0x3b1803;});}return null;};}function removeEntity(_0x12c689,_0x3d06e5){return function(_0x326155){if(_0x326155){return _0x326155['destroy']()['then'](function(){_0x12c689['status'](0xcc)[_0x30cc('0x1a')]();});}};}function handleEntityNotFound(_0x3d8325,_0x47d346){return function(_0x40a497){if(!_0x40a497){_0x3d8325[_0x30cc('0x19')](0x194);}return _0x40a497;};}function handleError(_0x1f49e5,_0x3d5a90){_0x3d5a90=_0x3d5a90||0x1f4;return function(_0x3d59e3){logger[_0x30cc('0x27')](_0x3d59e3[_0x30cc('0x28')]);if(_0x3d59e3['name']){delete _0x3d59e3[_0x30cc('0x29')];}_0x1f49e5['status'](_0x3d5a90)[_0x30cc('0x2a')](_0x3d59e3);};}exports[_0x30cc('0x2b')]=function(_0x202e84,_0x28b44f){var _0x2b9e03={},_0x1c6ad0={},_0x485246={'count':0x0,'rows':[]};var _0x227f69=_[_0x30cc('0x2c')](db['Dynamics365Configuration'][_0x30cc('0x2d')],function(_0x5de691){return{'name':_0x5de691[_0x30cc('0x2e')],'type':_0x5de691['type'][_0x30cc('0x2f')]};});_0x1c6ad0[_0x30cc('0x30')]=_['map'](_0x227f69,_0x30cc('0x29'));_0x1c6ad0[_0x30cc('0x31')]=_[_0x30cc('0x32')](_0x202e84[_0x30cc('0x31')]);_0x1c6ad0[_0x30cc('0x33')]=_['intersection'](_0x1c6ad0[_0x30cc('0x30')],_0x1c6ad0['query']);_0x2b9e03[_0x30cc('0x34')]=_[_0x30cc('0x35')](_0x1c6ad0[_0x30cc('0x30')],qs[_0x30cc('0x36')](_0x202e84[_0x30cc('0x31')]['fields']));_0x2b9e03['attributes']=_0x2b9e03['attributes'][_0x30cc('0x37')]?_0x2b9e03['attributes']:_0x1c6ad0['model'];if(!_0x202e84[_0x30cc('0x31')][_0x30cc('0x38')](_0x30cc('0x39'))){_0x2b9e03[_0x30cc('0x1f')]=qs[_0x30cc('0x1f')](_0x202e84['query']['limit']);_0x2b9e03[_0x30cc('0x1d')]=qs[_0x30cc('0x1d')](_0x202e84[_0x30cc('0x31')][_0x30cc('0x1d')]);}_0x2b9e03[_0x30cc('0x3a')]=qs[_0x30cc('0x3b')](_0x202e84[_0x30cc('0x31')][_0x30cc('0x3b')]);_0x2b9e03['where']=qs[_0x30cc('0x33')](_[_0x30cc('0x3c')](_0x202e84['query'],_0x1c6ad0[_0x30cc('0x33')]),_0x227f69);if(_0x202e84[_0x30cc('0x31')][_0x30cc('0x3d')]){_0x2b9e03[_0x30cc('0x3e')]=_[_0x30cc('0x3f')](_0x2b9e03[_0x30cc('0x3e')],{'$or':_[_0x30cc('0x2c')](_0x227f69,function(_0x2e5493){if(_0x2e5493['type']!=='VIRTUAL'){var _0x57a213={};_0x57a213[_0x2e5493[_0x30cc('0x29')]]={'$like':'%'+_0x202e84[_0x30cc('0x31')][_0x30cc('0x3d')]+'%'};return _0x57a213;}})});}_0x2b9e03=_[_0x30cc('0x3f')]({},_0x2b9e03,_0x202e84[_0x30cc('0x40')]);var _0x368e04={'where':_0x2b9e03[_0x30cc('0x3e')]};return db['Dynamics365Configuration']['count'](_0x368e04)['then'](function(_0x146ca6){_0x485246[_0x30cc('0x20')]=_0x146ca6;if(_0x202e84[_0x30cc('0x31')][_0x30cc('0x41')]){_0x2b9e03[_0x30cc('0x42')]=[{'all':!![]}];}return db[_0x30cc('0x43')][_0x30cc('0x44')](_0x2b9e03);})[_0x30cc('0x26')](function(_0x4740c5){_0x485246[_0x30cc('0x45')]=_0x4740c5;return _0x485246;})[_0x30cc('0x26')](respondWithFilteredResult(_0x28b44f,_0x2b9e03))['catch'](handleError(_0x28b44f,null));};exports[_0x30cc('0x46')]=function(_0x1259e1,_0x54a637){var _0x165af2={'raw':![],'where':{'id':_0x1259e1[_0x30cc('0x47')]['id']}},_0x333048={};_0x333048[_0x30cc('0x30')]=_['keys'](db[_0x30cc('0x43')][_0x30cc('0x2d')]);_0x333048[_0x30cc('0x31')]=_['keys'](_0x1259e1[_0x30cc('0x31')]);_0x333048[_0x30cc('0x33')]=_['intersection'](_0x333048['model'],_0x333048['query']);_0x165af2['attributes']=_[_0x30cc('0x35')](_0x333048['model'],qs[_0x30cc('0x36')](_0x1259e1[_0x30cc('0x31')][_0x30cc('0x36')]));_0x165af2[_0x30cc('0x34')]=_0x165af2[_0x30cc('0x34')][_0x30cc('0x37')]?_0x165af2[_0x30cc('0x34')]:_0x333048[_0x30cc('0x30')];if(_0x1259e1[_0x30cc('0x31')][_0x30cc('0x41')]){_0x165af2[_0x30cc('0x42')]=[{'all':!![]}];}_0x165af2=_['merge']({},_0x165af2,_0x1259e1[_0x30cc('0x40')]);return db[_0x30cc('0x43')][_0x30cc('0x48')](_0x165af2)[_0x30cc('0x26')](handleEntityNotFound(_0x54a637,null))[_0x30cc('0x26')](respondWithResult(_0x54a637,null))[_0x30cc('0x49')](handleError(_0x54a637,null));};exports[_0x30cc('0x4a')]=function(_0x4b8841,_0x33554b){return db[_0x30cc('0x43')][_0x30cc('0x4a')](_0x4b8841[_0x30cc('0x4b')],{})[_0x30cc('0x26')](respondWithResult(_0x33554b,0xc9))[_0x30cc('0x49')](handleError(_0x33554b,null));};exports['update']=function(_0x3d06be,_0xd70da2){if(_0x3d06be[_0x30cc('0x4b')]['id']){delete _0x3d06be[_0x30cc('0x4b')]['id'];}return db[_0x30cc('0x43')][_0x30cc('0x48')]({'where':{'id':_0x3d06be[_0x30cc('0x47')]['id']}})[_0x30cc('0x26')](handleEntityNotFound(_0xd70da2,null))[_0x30cc('0x26')](saveUpdates(_0x3d06be[_0x30cc('0x4b')],null))[_0x30cc('0x26')](respondWithResult(_0xd70da2,null))[_0x30cc('0x49')](handleError(_0xd70da2,null));};exports['destroy']=function(_0x233d6a,_0x300844){return db[_0x30cc('0x43')][_0x30cc('0x48')]({'where':{'id':_0x233d6a[_0x30cc('0x47')]['id']}})[_0x30cc('0x26')](handleEntityNotFound(_0x300844,null))[_0x30cc('0x26')](removeEntity(_0x300844,null))[_0x30cc('0x49')](handleError(_0x300844,null));};exports[_0x30cc('0x4c')]=function(_0x470318,_0x209f19,_0x1af200){var _0x4c0c55={};var _0x4a3d10={};var _0xb7c467;var _0x3bc819;return db['Dynamics365Configuration'][_0x30cc('0x4d')]({'where':{'id':_0x470318[_0x30cc('0x47')]['id']}})[_0x30cc('0x26')](handleEntityNotFound(_0x209f19,null))[_0x30cc('0x26')](function(_0x449efc){if(_0x449efc){_0xb7c467=_0x449efc;_0x4a3d10[_0x30cc('0x30')]=_['keys'](db[_0x30cc('0x4e')][_0x30cc('0x2d')]);_0x4a3d10[_0x30cc('0x31')]=_[_0x30cc('0x32')](_0x470318[_0x30cc('0x31')]);_0x4a3d10[_0x30cc('0x33')]=_[_0x30cc('0x35')](_0x4a3d10[_0x30cc('0x30')],_0x4a3d10['query']);_0x4c0c55[_0x30cc('0x34')]=_['intersection'](_0x4a3d10['model'],qs['fields'](_0x470318[_0x30cc('0x31')]['fields']));_0x4c0c55[_0x30cc('0x34')]=_0x4c0c55['attributes'][_0x30cc('0x37')]?_0x4c0c55[_0x30cc('0x34')]:_0x4a3d10[_0x30cc('0x30')];_0x4c0c55[_0x30cc('0x3a')]=qs['sort'](_0x470318[_0x30cc('0x31')]['sort']);_0x4c0c55[_0x30cc('0x3e')]=qs[_0x30cc('0x33')](_[_0x30cc('0x3c')](_0x470318[_0x30cc('0x31')],_0x4a3d10['filters']));if(_0x470318[_0x30cc('0x31')]['filter']){_0x4c0c55[_0x30cc('0x3e')]=_[_0x30cc('0x3f')](_0x4c0c55[_0x30cc('0x3e')],{'$or':_[_0x30cc('0x2c')](_0x4c0c55[_0x30cc('0x34')],function(_0x201f02){var _0x55cdb0={};_0x55cdb0[_0x201f02]={'$like':'%'+_0x470318[_0x30cc('0x31')][_0x30cc('0x3d')]+'%'};return _0x55cdb0;})});}_0x4c0c55=_[_0x30cc('0x3f')]({},_0x4c0c55,_0x470318[_0x30cc('0x40')]);return _0xb7c467[_0x30cc('0x4c')](_0x4c0c55);}})[_0x30cc('0x26')](function(_0x59b623){if(_0x59b623){_0x3bc819=_0x59b623[_0x30cc('0x37')];if(!_0x470318[_0x30cc('0x31')][_0x30cc('0x38')](_0x30cc('0x39'))){_0x4c0c55['limit']=qs[_0x30cc('0x1f')](_0x470318[_0x30cc('0x31')]['limit']);_0x4c0c55[_0x30cc('0x1d')]=qs[_0x30cc('0x1d')](_0x470318['query']['offset']);}return _0xb7c467[_0x30cc('0x4c')](_0x4c0c55);}})[_0x30cc('0x26')](function(_0x3b4d89){if(_0x3b4d89){return _0x3b4d89?{'count':_0x3bc819,'rows':_0x3b4d89}:null;}})[_0x30cc('0x26')](respondWithResult(_0x209f19,null))[_0x30cc('0x49')](handleError(_0x209f19,null));};exports['getSubjects']=function(_0x25f3f0,_0x2b73c3,_0x32b123){var _0x246b66={};var _0x4e650d={};var _0x41b68d;var _0x3ca4e9;return db[_0x30cc('0x43')][_0x30cc('0x4d')]({'where':{'id':_0x25f3f0[_0x30cc('0x47')]['id']}})[_0x30cc('0x26')](handleEntityNotFound(_0x2b73c3,null))[_0x30cc('0x26')](function(_0x126409){if(_0x126409){_0x41b68d=_0x126409;_0x4e650d[_0x30cc('0x30')]=_[_0x30cc('0x32')](db[_0x30cc('0x4e')][_0x30cc('0x2d')]);_0x4e650d[_0x30cc('0x31')]=_[_0x30cc('0x32')](_0x25f3f0[_0x30cc('0x31')]);_0x4e650d[_0x30cc('0x33')]=_['intersection'](_0x4e650d[_0x30cc('0x30')],_0x4e650d[_0x30cc('0x31')]);_0x246b66[_0x30cc('0x34')]=_[_0x30cc('0x35')](_0x4e650d['model'],qs[_0x30cc('0x36')](_0x25f3f0[_0x30cc('0x31')][_0x30cc('0x36')]));_0x246b66[_0x30cc('0x34')]=_0x246b66[_0x30cc('0x34')][_0x30cc('0x37')]?_0x246b66[_0x30cc('0x34')]:_0x4e650d['model'];_0x246b66[_0x30cc('0x3a')]=qs[_0x30cc('0x3b')](_0x25f3f0['query'][_0x30cc('0x3b')]);_0x246b66[_0x30cc('0x3e')]=qs[_0x30cc('0x33')](_[_0x30cc('0x3c')](_0x25f3f0['query'],_0x4e650d['filters']));if(_0x25f3f0[_0x30cc('0x31')]['filter']){_0x246b66[_0x30cc('0x3e')]=_[_0x30cc('0x3f')](_0x246b66[_0x30cc('0x3e')],{'$or':_[_0x30cc('0x2c')](_0x246b66[_0x30cc('0x34')],function(_0x2539c2){var _0x4f8261={};_0x4f8261[_0x2539c2]={'$like':'%'+_0x25f3f0[_0x30cc('0x31')][_0x30cc('0x3d')]+'%'};return _0x4f8261;})});}_0x246b66=_[_0x30cc('0x3f')]({},_0x246b66,_0x25f3f0[_0x30cc('0x40')]);return _0x41b68d[_0x30cc('0x4f')](_0x246b66);}})['then'](function(_0x39bfe5){if(_0x39bfe5){_0x3ca4e9=_0x39bfe5[_0x30cc('0x37')];if(!_0x25f3f0[_0x30cc('0x31')]['hasOwnProperty'](_0x30cc('0x39'))){_0x246b66[_0x30cc('0x1f')]=qs[_0x30cc('0x1f')](_0x25f3f0[_0x30cc('0x31')]['limit']);_0x246b66[_0x30cc('0x1d')]=qs[_0x30cc('0x1d')](_0x25f3f0[_0x30cc('0x31')][_0x30cc('0x1d')]);}return _0x41b68d['getSubjects'](_0x246b66);}})['then'](function(_0x3a75df){if(_0x3a75df){return _0x3a75df?{'count':_0x3ca4e9,'rows':_0x3a75df}:null;}})[_0x30cc('0x26')](respondWithResult(_0x2b73c3,null))[_0x30cc('0x49')](handleError(_0x2b73c3,null));};exports[_0x30cc('0x50')]=function(_0x3c47d3,_0x2bd919,_0x4c1e3e){var _0x555bc6={};var _0x18859a={};var _0x24ed3e;var _0x11be1a;return db[_0x30cc('0x43')][_0x30cc('0x4d')]({'where':{'id':_0x3c47d3['params']['id']}})[_0x30cc('0x26')](handleEntityNotFound(_0x2bd919,null))[_0x30cc('0x26')](function(_0x6d1221){if(_0x6d1221){_0x24ed3e=_0x6d1221;_0x18859a[_0x30cc('0x30')]=_[_0x30cc('0x32')](db[_0x30cc('0x4e')][_0x30cc('0x2d')]);_0x18859a[_0x30cc('0x31')]=_[_0x30cc('0x32')](_0x3c47d3['query']);_0x18859a[_0x30cc('0x33')]=_[_0x30cc('0x35')](_0x18859a[_0x30cc('0x30')],_0x18859a['query']);_0x555bc6[_0x30cc('0x34')]=_[_0x30cc('0x35')](_0x18859a[_0x30cc('0x30')],qs[_0x30cc('0x36')](_0x3c47d3[_0x30cc('0x31')][_0x30cc('0x36')]));_0x555bc6[_0x30cc('0x34')]=_0x555bc6[_0x30cc('0x34')][_0x30cc('0x37')]?_0x555bc6[_0x30cc('0x34')]:_0x18859a[_0x30cc('0x30')];_0x555bc6[_0x30cc('0x3a')]=qs[_0x30cc('0x3b')](_0x3c47d3[_0x30cc('0x31')][_0x30cc('0x3b')]);_0x555bc6[_0x30cc('0x3e')]=qs[_0x30cc('0x33')](_[_0x30cc('0x3c')](_0x3c47d3[_0x30cc('0x31')],_0x18859a['filters']));if(_0x3c47d3['query']['filter']){_0x555bc6[_0x30cc('0x3e')]=_[_0x30cc('0x3f')](_0x555bc6[_0x30cc('0x3e')],{'$or':_[_0x30cc('0x2c')](_0x555bc6['attributes'],function(_0xeab291){var _0xaf1ade={};_0xaf1ade[_0xeab291]={'$like':'%'+_0x3c47d3[_0x30cc('0x31')][_0x30cc('0x3d')]+'%'};return _0xaf1ade;})});}_0x555bc6=_[_0x30cc('0x3f')]({},_0x555bc6,_0x3c47d3[_0x30cc('0x40')]);return _0x24ed3e[_0x30cc('0x50')](_0x555bc6);}})['then'](function(_0xea3928){if(_0xea3928){_0x11be1a=_0xea3928[_0x30cc('0x37')];if(!_0x3c47d3[_0x30cc('0x31')]['hasOwnProperty']('nolimit')){_0x555bc6['limit']=qs[_0x30cc('0x1f')](_0x3c47d3[_0x30cc('0x31')][_0x30cc('0x1f')]);_0x555bc6[_0x30cc('0x1d')]=qs[_0x30cc('0x1d')](_0x3c47d3[_0x30cc('0x31')][_0x30cc('0x1d')]);}return _0x24ed3e[_0x30cc('0x50')](_0x555bc6);}})[_0x30cc('0x26')](function(_0x361527){if(_0x361527){return _0x361527?{'count':_0x11be1a,'rows':_0x361527}:null;}})[_0x30cc('0x26')](respondWithResult(_0x2bd919,null))[_0x30cc('0x49')](handleError(_0x2bd919,null));}; \ No newline at end of file +var _0x277f=['squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','json','apply','reject','save','update','destroy','error','stack','name','index','map','Dynamics365Configuration','rawAttributes','fieldName','key','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','then','includeAll','include','findAll','rows','catch','show','find','create','body','params','getFields','findOne','Dynamics365Field','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','moment','mustache','path','to-csv','ejs','fs-extra','lodash'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x277f,0xdd));var _0xf277=function(_0x55c37e,_0x229490){_0x55c37e=_0x55c37e-0x0;var _0x10d6ab=_0x277f[_0x55c37e];return _0x10d6ab;};'use strict';var emlformat=require(_0xf277('0x0'));var rimraf=require(_0xf277('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf277('0x2'));var rp=require('request-promise');var moment=require(_0xf277('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf277('0x4'));var util=require('util');var path=require(_0xf277('0x5'));var sox=require('sox');var csv=require(_0xf277('0x6'));var ejs=require(_0xf277('0x7'));var fs=require('fs');var fs_extra=require(_0xf277('0x8'));var _=require(_0xf277('0x9'));var squel=require(_0xf277('0xa'));var crypto=require('crypto');var jsforce=require(_0xf277('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xf277('0x6'));var querystring=require(_0xf277('0xc'));var Papa=require(_0xf277('0xd'));var Redis=require(_0xf277('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf277('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf277('0x10'))('api');var utils=require(_0xf277('0x11'));var config=require(_0xf277('0x12'));var licenseUtil=require(_0xf277('0x13'));var db=require(_0xf277('0x14'))['db'];function respondWithStatusCode(_0x1fa6c9,_0x1aa194){_0x1aa194=_0x1aa194||0xcc;return function(_0x294f80){if(_0x294f80){return _0x1fa6c9[_0xf277('0x15')](_0x1aa194);}return _0x1fa6c9[_0xf277('0x16')](_0x1aa194)['end']();};}function respondWithResult(_0x580e30,_0x4ecc3f){_0x4ecc3f=_0x4ecc3f||0xc8;return function(_0x3e5d8d){if(_0x3e5d8d){return _0x580e30[_0xf277('0x16')](_0x4ecc3f)['json'](_0x3e5d8d);}};}function respondWithFilteredResult(_0x40f240,_0x3ff733){return function(_0x239dc8){if(_0x239dc8){var _0x4d2315=typeof _0x3ff733[_0xf277('0x17')]===_0xf277('0x18')&&typeof _0x3ff733[_0xf277('0x19')]===_0xf277('0x18');var _0x7a2d79=_0x239dc8[_0xf277('0x1a')];var _0x6e629d=_0x4d2315?0x0:_0x3ff733[_0xf277('0x17')];var _0x559134=_0x4d2315?_0x239dc8[_0xf277('0x1a')]:_0x3ff733[_0xf277('0x17')]+_0x3ff733[_0xf277('0x19')];var _0x2f90cb;if(_0x559134>=_0x7a2d79){_0x559134=_0x7a2d79;_0x2f90cb=0xc8;}else{_0x2f90cb=0xce;}_0x40f240[_0xf277('0x16')](_0x2f90cb);return _0x40f240[_0xf277('0x1b')]('Content-Range',_0x6e629d+'-'+_0x559134+'/'+_0x7a2d79)[_0xf277('0x1c')](_0x239dc8);}return null;};}function patchUpdates(_0x5566ec){return function(_0x244e0e){try{jsonpatch[_0xf277('0x1d')](_0x244e0e,_0x5566ec,!![]);}catch(_0x1d5d85){return BPromise[_0xf277('0x1e')](_0x1d5d85);}return _0x244e0e[_0xf277('0x1f')]();};}function saveUpdates(_0x317071,_0x4bfadf){return function(_0x489f4e){if(_0x489f4e){return _0x489f4e[_0xf277('0x20')](_0x317071)['then'](function(_0x550b57){return _0x550b57;});}return null;};}function removeEntity(_0x2b9046,_0x5121f9){return function(_0x5460e7){if(_0x5460e7){return _0x5460e7[_0xf277('0x21')]()['then'](function(){_0x2b9046[_0xf277('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x253d93,_0x12e263){return function(_0x318a14){if(!_0x318a14){_0x253d93['sendStatus'](0x194);}return _0x318a14;};}function handleError(_0x1eaa86,_0x25f6f2){_0x25f6f2=_0x25f6f2||0x1f4;return function(_0x538063){logger[_0xf277('0x22')](_0x538063[_0xf277('0x23')]);if(_0x538063[_0xf277('0x24')]){delete _0x538063['name'];}_0x1eaa86[_0xf277('0x16')](_0x25f6f2)['send'](_0x538063);};}exports[_0xf277('0x25')]=function(_0x5b1ce5,_0x16c7a5){var _0x190b3a={},_0x15fa3a={},_0x43504e={'count':0x0,'rows':[]};var _0x3689d0=_[_0xf277('0x26')](db[_0xf277('0x27')][_0xf277('0x28')],function(_0x1c490a){return{'name':_0x1c490a[_0xf277('0x29')],'type':_0x1c490a['type'][_0xf277('0x2a')]};});_0x15fa3a['model']=_['map'](_0x3689d0,_0xf277('0x24'));_0x15fa3a[_0xf277('0x2b')]=_[_0xf277('0x2c')](_0x5b1ce5[_0xf277('0x2b')]);_0x15fa3a['filters']=_[_0xf277('0x2d')](_0x15fa3a['model'],_0x15fa3a['query']);_0x190b3a[_0xf277('0x2e')]=_[_0xf277('0x2d')](_0x15fa3a[_0xf277('0x2f')],qs[_0xf277('0x30')](_0x5b1ce5[_0xf277('0x2b')][_0xf277('0x30')]));_0x190b3a[_0xf277('0x2e')]=_0x190b3a['attributes'][_0xf277('0x31')]?_0x190b3a['attributes']:_0x15fa3a[_0xf277('0x2f')];if(!_0x5b1ce5['query'][_0xf277('0x32')](_0xf277('0x33'))){_0x190b3a[_0xf277('0x19')]=qs[_0xf277('0x19')](_0x5b1ce5[_0xf277('0x2b')][_0xf277('0x19')]);_0x190b3a[_0xf277('0x17')]=qs[_0xf277('0x17')](_0x5b1ce5[_0xf277('0x2b')][_0xf277('0x17')]);}_0x190b3a[_0xf277('0x34')]=qs[_0xf277('0x35')](_0x5b1ce5[_0xf277('0x2b')][_0xf277('0x35')]);_0x190b3a[_0xf277('0x36')]=qs['filters'](_[_0xf277('0x37')](_0x5b1ce5[_0xf277('0x2b')],_0x15fa3a[_0xf277('0x38')]),_0x3689d0);if(_0x5b1ce5[_0xf277('0x2b')][_0xf277('0x39')]){_0x190b3a['where']=_[_0xf277('0x3a')](_0x190b3a[_0xf277('0x36')],{'$or':_[_0xf277('0x26')](_0x3689d0,function(_0xb2a9be){if(_0xb2a9be['type']!==_0xf277('0x3b')){var _0x3454e3={};_0x3454e3[_0xb2a9be[_0xf277('0x24')]]={'$like':'%'+_0x5b1ce5[_0xf277('0x2b')][_0xf277('0x39')]+'%'};return _0x3454e3;}})});}_0x190b3a=_[_0xf277('0x3a')]({},_0x190b3a,_0x5b1ce5[_0xf277('0x3c')]);var _0x495306={'where':_0x190b3a['where']};return db[_0xf277('0x27')][_0xf277('0x1a')](_0x495306)[_0xf277('0x3d')](function(_0x26297a){_0x43504e[_0xf277('0x1a')]=_0x26297a;if(_0x5b1ce5['query'][_0xf277('0x3e')]){_0x190b3a[_0xf277('0x3f')]=[{'all':!![]}];}return db['Dynamics365Configuration'][_0xf277('0x40')](_0x190b3a);})[_0xf277('0x3d')](function(_0x541a44){_0x43504e[_0xf277('0x41')]=_0x541a44;return _0x43504e;})['then'](respondWithFilteredResult(_0x16c7a5,_0x190b3a))[_0xf277('0x42')](handleError(_0x16c7a5,null));};exports[_0xf277('0x43')]=function(_0x36ca03,_0x34d198){var _0x26d102={'raw':![],'where':{'id':_0x36ca03['params']['id']}},_0xdaace9={};_0xdaace9[_0xf277('0x2f')]=_[_0xf277('0x2c')](db[_0xf277('0x27')]['rawAttributes']);_0xdaace9[_0xf277('0x2b')]=_[_0xf277('0x2c')](_0x36ca03['query']);_0xdaace9[_0xf277('0x38')]=_[_0xf277('0x2d')](_0xdaace9[_0xf277('0x2f')],_0xdaace9['query']);_0x26d102['attributes']=_[_0xf277('0x2d')](_0xdaace9[_0xf277('0x2f')],qs[_0xf277('0x30')](_0x36ca03['query'][_0xf277('0x30')]));_0x26d102['attributes']=_0x26d102[_0xf277('0x2e')]['length']?_0x26d102[_0xf277('0x2e')]:_0xdaace9[_0xf277('0x2f')];if(_0x36ca03['query'][_0xf277('0x3e')]){_0x26d102['include']=[{'all':!![]}];}_0x26d102=_[_0xf277('0x3a')]({},_0x26d102,_0x36ca03[_0xf277('0x3c')]);return db[_0xf277('0x27')][_0xf277('0x44')](_0x26d102)[_0xf277('0x3d')](handleEntityNotFound(_0x34d198,null))[_0xf277('0x3d')](respondWithResult(_0x34d198,null))['catch'](handleError(_0x34d198,null));};exports[_0xf277('0x45')]=function(_0x218d24,_0xba4fa3){return db['Dynamics365Configuration']['create'](_0x218d24[_0xf277('0x46')],{})['then'](respondWithResult(_0xba4fa3,0xc9))[_0xf277('0x42')](handleError(_0xba4fa3,null));};exports[_0xf277('0x20')]=function(_0x99516f,_0x43ae9d){if(_0x99516f[_0xf277('0x46')]['id']){delete _0x99516f[_0xf277('0x46')]['id'];}return db[_0xf277('0x27')][_0xf277('0x44')]({'where':{'id':_0x99516f[_0xf277('0x47')]['id']}})[_0xf277('0x3d')](handleEntityNotFound(_0x43ae9d,null))[_0xf277('0x3d')](saveUpdates(_0x99516f['body'],null))[_0xf277('0x3d')](respondWithResult(_0x43ae9d,null))['catch'](handleError(_0x43ae9d,null));};exports[_0xf277('0x21')]=function(_0x85dcc4,_0x55493a){return db[_0xf277('0x27')]['find']({'where':{'id':_0x85dcc4[_0xf277('0x47')]['id']}})['then'](handleEntityNotFound(_0x55493a,null))[_0xf277('0x3d')](removeEntity(_0x55493a,null))['catch'](handleError(_0x55493a,null));};exports[_0xf277('0x48')]=function(_0x4f3826,_0x3c2254,_0x426e5a){var _0x262a30={};var _0x49a7b0={};var _0x127426;var _0x436181;return db[_0xf277('0x27')][_0xf277('0x49')]({'where':{'id':_0x4f3826['params']['id']}})[_0xf277('0x3d')](handleEntityNotFound(_0x3c2254,null))['then'](function(_0x2f6ec5){if(_0x2f6ec5){_0x127426=_0x2f6ec5;_0x49a7b0[_0xf277('0x2f')]=_[_0xf277('0x2c')](db[_0xf277('0x4a')]['rawAttributes']);_0x49a7b0[_0xf277('0x2b')]=_['keys'](_0x4f3826['query']);_0x49a7b0[_0xf277('0x38')]=_[_0xf277('0x2d')](_0x49a7b0[_0xf277('0x2f')],_0x49a7b0[_0xf277('0x2b')]);_0x262a30[_0xf277('0x2e')]=_[_0xf277('0x2d')](_0x49a7b0[_0xf277('0x2f')],qs[_0xf277('0x30')](_0x4f3826[_0xf277('0x2b')][_0xf277('0x30')]));_0x262a30[_0xf277('0x2e')]=_0x262a30[_0xf277('0x2e')][_0xf277('0x31')]?_0x262a30[_0xf277('0x2e')]:_0x49a7b0[_0xf277('0x2f')];_0x262a30['order']=qs['sort'](_0x4f3826[_0xf277('0x2b')][_0xf277('0x35')]);_0x262a30[_0xf277('0x36')]=qs[_0xf277('0x38')](_[_0xf277('0x37')](_0x4f3826['query'],_0x49a7b0[_0xf277('0x38')]));if(_0x4f3826['query'][_0xf277('0x39')]){_0x262a30[_0xf277('0x36')]=_[_0xf277('0x3a')](_0x262a30[_0xf277('0x36')],{'$or':_[_0xf277('0x26')](_0x262a30[_0xf277('0x2e')],function(_0x1978e5){var _0x1f43ad={};_0x1f43ad[_0x1978e5]={'$like':'%'+_0x4f3826['query'][_0xf277('0x39')]+'%'};return _0x1f43ad;})});}_0x262a30=_[_0xf277('0x3a')]({},_0x262a30,_0x4f3826[_0xf277('0x3c')]);return _0x127426[_0xf277('0x48')](_0x262a30);}})[_0xf277('0x3d')](function(_0x5b4ccf){if(_0x5b4ccf){_0x436181=_0x5b4ccf['length'];if(!_0x4f3826[_0xf277('0x2b')]['hasOwnProperty'](_0xf277('0x33'))){_0x262a30['limit']=qs[_0xf277('0x19')](_0x4f3826[_0xf277('0x2b')]['limit']);_0x262a30[_0xf277('0x17')]=qs[_0xf277('0x17')](_0x4f3826['query']['offset']);}return _0x127426[_0xf277('0x48')](_0x262a30);}})[_0xf277('0x3d')](function(_0x588166){if(_0x588166){return _0x588166?{'count':_0x436181,'rows':_0x588166}:null;}})[_0xf277('0x3d')](respondWithResult(_0x3c2254,null))[_0xf277('0x42')](handleError(_0x3c2254,null));};exports['getSubjects']=function(_0x5dbf94,_0x36e604,_0x40fe7c){var _0x474b20={};var _0x11d0f0={};var _0x2b6e52;var _0x59d394;return db[_0xf277('0x27')][_0xf277('0x49')]({'where':{'id':_0x5dbf94['params']['id']}})[_0xf277('0x3d')](handleEntityNotFound(_0x36e604,null))['then'](function(_0x35121b){if(_0x35121b){_0x2b6e52=_0x35121b;_0x11d0f0[_0xf277('0x2f')]=_[_0xf277('0x2c')](db[_0xf277('0x4a')][_0xf277('0x28')]);_0x11d0f0[_0xf277('0x2b')]=_[_0xf277('0x2c')](_0x5dbf94[_0xf277('0x2b')]);_0x11d0f0[_0xf277('0x38')]=_[_0xf277('0x2d')](_0x11d0f0[_0xf277('0x2f')],_0x11d0f0[_0xf277('0x2b')]);_0x474b20[_0xf277('0x2e')]=_[_0xf277('0x2d')](_0x11d0f0[_0xf277('0x2f')],qs[_0xf277('0x30')](_0x5dbf94[_0xf277('0x2b')][_0xf277('0x30')]));_0x474b20[_0xf277('0x2e')]=_0x474b20[_0xf277('0x2e')][_0xf277('0x31')]?_0x474b20['attributes']:_0x11d0f0[_0xf277('0x2f')];_0x474b20[_0xf277('0x34')]=qs[_0xf277('0x35')](_0x5dbf94[_0xf277('0x2b')][_0xf277('0x35')]);_0x474b20[_0xf277('0x36')]=qs['filters'](_[_0xf277('0x37')](_0x5dbf94[_0xf277('0x2b')],_0x11d0f0[_0xf277('0x38')]));if(_0x5dbf94['query']['filter']){_0x474b20['where']=_[_0xf277('0x3a')](_0x474b20['where'],{'$or':_[_0xf277('0x26')](_0x474b20[_0xf277('0x2e')],function(_0x2625d9){var _0x3e1466={};_0x3e1466[_0x2625d9]={'$like':'%'+_0x5dbf94[_0xf277('0x2b')][_0xf277('0x39')]+'%'};return _0x3e1466;})});}_0x474b20=_[_0xf277('0x3a')]({},_0x474b20,_0x5dbf94[_0xf277('0x3c')]);return _0x2b6e52[_0xf277('0x4b')](_0x474b20);}})[_0xf277('0x3d')](function(_0x4d1152){if(_0x4d1152){_0x59d394=_0x4d1152[_0xf277('0x31')];if(!_0x5dbf94['query']['hasOwnProperty'](_0xf277('0x33'))){_0x474b20[_0xf277('0x19')]=qs[_0xf277('0x19')](_0x5dbf94[_0xf277('0x2b')][_0xf277('0x19')]);_0x474b20[_0xf277('0x17')]=qs['offset'](_0x5dbf94[_0xf277('0x2b')]['offset']);}return _0x2b6e52['getSubjects'](_0x474b20);}})[_0xf277('0x3d')](function(_0x49cb25){if(_0x49cb25){return _0x49cb25?{'count':_0x59d394,'rows':_0x49cb25}:null;}})['then'](respondWithResult(_0x36e604,null))[_0xf277('0x42')](handleError(_0x36e604,null));};exports['getDescriptions']=function(_0x1fb3a6,_0x1c9b4f,_0xa4b198){var _0x468293={};var _0x3e1789={};var _0x3bd12e;var _0x19516f;return db['Dynamics365Configuration'][_0xf277('0x49')]({'where':{'id':_0x1fb3a6[_0xf277('0x47')]['id']}})[_0xf277('0x3d')](handleEntityNotFound(_0x1c9b4f,null))[_0xf277('0x3d')](function(_0x5ec1d9){if(_0x5ec1d9){_0x3bd12e=_0x5ec1d9;_0x3e1789[_0xf277('0x2f')]=_[_0xf277('0x2c')](db['Dynamics365Field'][_0xf277('0x28')]);_0x3e1789[_0xf277('0x2b')]=_[_0xf277('0x2c')](_0x1fb3a6[_0xf277('0x2b')]);_0x3e1789[_0xf277('0x38')]=_[_0xf277('0x2d')](_0x3e1789[_0xf277('0x2f')],_0x3e1789['query']);_0x468293[_0xf277('0x2e')]=_[_0xf277('0x2d')](_0x3e1789[_0xf277('0x2f')],qs[_0xf277('0x30')](_0x1fb3a6[_0xf277('0x2b')][_0xf277('0x30')]));_0x468293[_0xf277('0x2e')]=_0x468293['attributes']['length']?_0x468293[_0xf277('0x2e')]:_0x3e1789['model'];_0x468293[_0xf277('0x34')]=qs[_0xf277('0x35')](_0x1fb3a6['query'][_0xf277('0x35')]);_0x468293[_0xf277('0x36')]=qs[_0xf277('0x38')](_['pick'](_0x1fb3a6['query'],_0x3e1789[_0xf277('0x38')]));if(_0x1fb3a6[_0xf277('0x2b')][_0xf277('0x39')]){_0x468293['where']=_['merge'](_0x468293[_0xf277('0x36')],{'$or':_['map'](_0x468293[_0xf277('0x2e')],function(_0x508895){var _0x565b82={};_0x565b82[_0x508895]={'$like':'%'+_0x1fb3a6[_0xf277('0x2b')][_0xf277('0x39')]+'%'};return _0x565b82;})});}_0x468293=_['merge']({},_0x468293,_0x1fb3a6[_0xf277('0x3c')]);return _0x3bd12e[_0xf277('0x4c')](_0x468293);}})[_0xf277('0x3d')](function(_0x2e63d4){if(_0x2e63d4){_0x19516f=_0x2e63d4['length'];if(!_0x1fb3a6[_0xf277('0x2b')][_0xf277('0x32')]('nolimit')){_0x468293[_0xf277('0x19')]=qs['limit'](_0x1fb3a6[_0xf277('0x2b')]['limit']);_0x468293['offset']=qs[_0xf277('0x17')](_0x1fb3a6[_0xf277('0x2b')][_0xf277('0x17')]);}return _0x3bd12e[_0xf277('0x4c')](_0x468293);}})[_0xf277('0x3d')](function(_0xeff835){if(_0xeff835){return _0xeff835?{'count':_0x19516f,'rows':_0xeff835}:null;}})[_0xf277('0x3d')](respondWithResult(_0x1c9b4f,null))[_0xf277('0x42')](handleError(_0x1c9b4f,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index ed7876f..766ce87 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 _0xb821=['rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','int_dynamics365_configurations','util','../../config/logger','bluebird'];(function(_0x5a0495,_0x589ff5){var _0x46e16f=function(_0x1536ed){while(--_0x1536ed){_0x5a0495['push'](_0x5a0495['shift']());}};_0x46e16f(++_0x589ff5);}(_0xb821,0xa7));var _0x1b82=function(_0x1fd0e8,_0x352c0a){_0x1fd0e8=_0x1fd0e8-0x0;var _0x40398d=_0xb821[_0x1fd0e8];return _0x40398d;};'use strict';var _=require('lodash');var util=require(_0x1b82('0x0'));var logger=require(_0x1b82('0x1'))('api');var moment=require('moment');var BPromise=require(_0x1b82('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1b82('0x3'));var config=require(_0x1b82('0x4'));var attributes=require(_0x1b82('0x5'));module[_0x1b82('0x6')]=function(_0x597ca7,_0x3e27c4){return _0x597ca7[_0x1b82('0x7')](_0x1b82('0x8'),attributes,{'tableName':_0x1b82('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdace=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','Dynamics365Configuration','int_dynamics365_configurations','lodash'];(function(_0x4be69f,_0x2cc2f7){var _0x2413ef=function(_0x372d60){while(--_0x372d60){_0x4be69f['push'](_0x4be69f['shift']());}};_0x2413ef(++_0x2cc2f7);}(_0xdace,0xc5));var _0xedac=function(_0x3cae69,_0x233c38){_0x3cae69=_0x3cae69-0x0;var _0x3128eb=_0xdace[_0x3cae69];return _0x3128eb;};'use strict';var _=require(_0xedac('0x0'));var util=require('util');var logger=require(_0xedac('0x1'))(_0xedac('0x2'));var moment=require(_0xedac('0x3'));var BPromise=require('bluebird');var rp=require(_0xedac('0x4'));var fs=require('fs');var path=require(_0xedac('0x5'));var rimraf=require(_0xedac('0x6'));var config=require(_0xedac('0x7'));var attributes=require('./intDynamics365Configuration.attributes');module[_0xedac('0x8')]=function(_0x1cba89,_0x39328a){return _0x1cba89['define'](_0xedac('0x9'),attributes,{'tableName':_0xedac('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index 20dc587..1b35243 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 _0x8ba3=['message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x1de640,_0x5b7782){var _0x8c5dd4=function(_0x4895be){while(--_0x4895be){_0x1de640['push'](_0x1de640['shift']());}};_0x8c5dd4(++_0x5b7782);}(_0x8ba3,0x18f));var _0x38ba=function(_0x2290b4,_0x3e67b1){_0x2290b4=_0x2290b4-0x0;var _0x4d2d03=_0x8ba3[_0x2290b4];return _0x4d2d03;};'use strict';var _=require(_0x38ba('0x0'));var util=require('util');var moment=require(_0x38ba('0x1'));var BPromise=require(_0x38ba('0x2'));var rs=require(_0x38ba('0x3'));var fs=require('fs');var Redis=require(_0x38ba('0x4'));var db=require(_0x38ba('0x5'))['db'];var utils=require(_0x38ba('0x6'));var logger=require('../../config/logger')(_0x38ba('0x7'));var config=require(_0x38ba('0x8'));var jayson=require(_0x38ba('0x9'));var client=jayson[_0x38ba('0xa')][_0x38ba('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54ec0f,_0x5df394,_0x4fc709){return new BPromise(function(_0x14eeb2,_0x5217f4){return client[_0x38ba('0xc')](_0x54ec0f,_0x4fc709)[_0x38ba('0xd')](function(_0x4ea9d4){logger[_0x38ba('0xe')](_0x38ba('0xf'),_0x5df394,_0x38ba('0x10'));logger['debug']('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x5df394,_0x38ba('0x10'),JSON[_0x38ba('0x11')](_0x4ea9d4));if(_0x4ea9d4[_0x38ba('0x12')]){if(_0x4ea9d4[_0x38ba('0x12')]['code']===0x1f4){logger[_0x38ba('0x12')](_0x38ba('0xf'),_0x5df394,_0x4ea9d4['error'][_0x38ba('0x13')]);return _0x5217f4(_0x4ea9d4[_0x38ba('0x12')][_0x38ba('0x13')]);}logger[_0x38ba('0x12')]('Dynamics365Configuration,\x20%s,\x20%s',_0x5df394,_0x4ea9d4[_0x38ba('0x12')][_0x38ba('0x13')]);return _0x14eeb2(_0x4ea9d4['error'][_0x38ba('0x13')]);}else{logger['info'](_0x38ba('0xf'),_0x5df394,_0x38ba('0x10'));_0x14eeb2(_0x4ea9d4[_0x38ba('0x14')]['message']);}})[_0x38ba('0x15')](function(_0x1ae0c1){logger[_0x38ba('0x12')]('Dynamics365Configuration,\x20%s,\x20%s',_0x5df394,_0x1ae0c1);_0x5217f4(_0x1ae0c1);});});} \ No newline at end of file +var _0x004b=['../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','moment','randomstring','ioredis'];(function(_0x59b014,_0x3c966a){var _0xab075b=function(_0x168713){while(--_0x168713){_0x59b014['push'](_0x59b014['shift']());}};_0xab075b(++_0x3c966a);}(_0x004b,0xd9));var _0xb004=function(_0xda49e2,_0x24f253){_0xda49e2=_0xda49e2-0x0;var _0x26dbdf=_0x004b[_0xda49e2];return _0x26dbdf;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb004('0x0'));var BPromise=require('bluebird');var rs=require(_0xb004('0x1'));var fs=require('fs');var Redis=require(_0xb004('0x2'));var db=require(_0xb004('0x3'))['db'];var utils=require(_0xb004('0x4'));var logger=require(_0xb004('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb004('0x6'));var client=jayson['client'][_0xb004('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x22227c,_0x1eb0e1,_0x5083c6){return new BPromise(function(_0x1ff584,_0x22b17b){return client[_0xb004('0x8')](_0x22227c,_0x5083c6)[_0xb004('0x9')](function(_0x1cf546){logger['info'](_0xb004('0xa'),_0x1eb0e1,_0xb004('0xb'));logger[_0xb004('0xc')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x1eb0e1,_0xb004('0xb'),JSON[_0xb004('0xd')](_0x1cf546));if(_0x1cf546[_0xb004('0xe')]){if(_0x1cf546[_0xb004('0xe')][_0xb004('0xf')]===0x1f4){logger[_0xb004('0xe')](_0xb004('0xa'),_0x1eb0e1,_0x1cf546['error'][_0xb004('0x10')]);return _0x22b17b(_0x1cf546[_0xb004('0xe')]['message']);}logger[_0xb004('0xe')](_0xb004('0xa'),_0x1eb0e1,_0x1cf546[_0xb004('0xe')][_0xb004('0x10')]);return _0x1ff584(_0x1cf546[_0xb004('0xe')][_0xb004('0x10')]);}else{logger[_0xb004('0x11')](_0xb004('0xa'),_0x1eb0e1,_0xb004('0xb'));_0x1ff584(_0x1cf546[_0xb004('0x12')][_0xb004('0x10')]);}})[_0xb004('0x13')](function(_0xdf0fa9){logger['error'](_0xb004('0xa'),_0x1eb0e1,_0xdf0fa9);_0x22b17b(_0xdf0fa9);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 6705591..a64c44b 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 _0xf637=['util','path','connect-timeout','express','../../components/interaction/service','./intDynamics365Field.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','destroy','exports','multer'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xf637,0x167));var _0x7f63=function(_0xc9da32,_0x37698c){_0xc9da32=_0xc9da32-0x0;var _0x519d84=_0xf637[_0xc9da32];return _0x519d84;};'use strict';var multer=require(_0x7f63('0x0'));var util=require(_0x7f63('0x1'));var path=require(_0x7f63('0x2'));var timeout=require(_0x7f63('0x3'));var express=require(_0x7f63('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x7f63('0x5'));var config=require('../../config/environment');var controller=require(_0x7f63('0x6'));router[_0x7f63('0x7')]('/',auth[_0x7f63('0x8')](),controller[_0x7f63('0x9')]);router[_0x7f63('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x7f63('0xa')]);router[_0x7f63('0xb')]('/',auth['isAuthenticated'](),controller[_0x7f63('0xc')]);router[_0x7f63('0xd')](_0x7f63('0xe'),auth['isAuthenticated'](),controller[_0x7f63('0xf')]);router['delete'](_0x7f63('0xe'),auth['isAuthenticated'](),controller[_0x7f63('0x10')]);module[_0x7f63('0x11')]=router; \ No newline at end of file +var _0x68df=['isAuthenticated','index','/:id','show','create','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get'];(function(_0x2388b1,_0x337850){var _0x4187cc=function(_0x42d3c5){while(--_0x42d3c5){_0x2388b1['push'](_0x2388b1['shift']());}};_0x4187cc(++_0x337850);}(_0x68df,0x171));var _0xf68d=function(_0x43cc69,_0x401eea){_0x43cc69=_0x43cc69-0x0;var _0xde43ae=_0x68df[_0x43cc69];return _0xde43ae;};'use strict';var multer=require(_0xf68d('0x0'));var util=require(_0xf68d('0x1'));var path=require(_0xf68d('0x2'));var timeout=require(_0xf68d('0x3'));var express=require('express');var router=express[_0xf68d('0x4')]();var fs_extra=require(_0xf68d('0x5'));var auth=require(_0xf68d('0x6'));var interaction=require(_0xf68d('0x7'));var config=require(_0xf68d('0x8'));var controller=require(_0xf68d('0x9'));router[_0xf68d('0xa')]('/',auth[_0xf68d('0xb')](),controller[_0xf68d('0xc')]);router[_0xf68d('0xa')](_0xf68d('0xd'),auth['isAuthenticated'](),controller[_0xf68d('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xf68d('0xf')]);router[_0xf68d('0x10')]('/:id',auth[_0xf68d('0xb')](),controller[_0xf68d('0x11')]);router[_0xf68d('0x12')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xf68d('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 9c03f14..96213b7 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 _0xb11d=['customVariable','keyValue','STRING','sequelize','exports','ENUM','string','variable'];(function(_0x4a4945,_0x3dc6c0){var _0x1b9eae=function(_0x5bc616){while(--_0x5bc616){_0x4a4945['push'](_0x4a4945['shift']());}};_0x1b9eae(++_0x3dc6c0);}(_0xb11d,0x1eb));var _0xdb11=function(_0x1b5280,_0x381acf){_0x1b5280=_0x1b5280-0x0;var _0x550e7a=_0xb11d[_0x1b5280];return _0x550e7a;};'use strict';var Sequelize=require(_0xdb11('0x0'));module[_0xdb11('0x1')]={'type':{'type':Sequelize[_0xdb11('0x2')](_0xdb11('0x3'),_0xdb11('0x4'),_0xdb11('0x5'),_0xdb11('0x6'),'picklist'),'defaultValue':_0xdb11('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xdb11('0x7')]},'keyType':{'type':Sequelize[_0xdb11('0x2')]('string',_0xdb11('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0xdb11('0x7')]},'idField':{'type':Sequelize[_0xdb11('0x7')]},'nameField':{'type':Sequelize[_0xdb11('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x49dd=['string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','ENUM'];(function(_0x2c5419,_0x8f474f){var _0x50af09=function(_0x4f4114){while(--_0x4f4114){_0x2c5419['push'](_0x2c5419['shift']());}};_0x50af09(++_0x8f474f);}(_0x49dd,0x139));var _0xd49d=function(_0x2b2ee1,_0x1d099b){_0x2b2ee1=_0x2b2ee1-0x0;var _0x286331=_0x49dd[_0x2b2ee1];return _0x286331;};'use strict';var Sequelize=require(_0xd49d('0x0'));module['exports']={'type':{'type':Sequelize[_0xd49d('0x1')](_0xd49d('0x2'),_0xd49d('0x3'),_0xd49d('0x4'),_0xd49d('0x5'),_0xd49d('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0xd49d('0x7')]},'key':{'type':Sequelize[_0xd49d('0x7')]},'keyType':{'type':Sequelize[_0xd49d('0x1')]('string',_0xd49d('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0xd49d('0x7')]},'idField':{'type':Sequelize[_0xd49d('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xd49d('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd49d('0x7')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 2c923c5..2daf9c4 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 _0x5e2f=['lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','update','then','sendStatus','error','name','send','index','map','Dynamics365Field','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','includeAll','rows','show','params','length','include','options','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x3753f8,_0xcb5dd8){var _0x203eff=function(_0x125ee9){while(--_0x125ee9){_0x3753f8['push'](_0x3753f8['shift']());}};_0x203eff(++_0xcb5dd8);}(_0x5e2f,0x15e));var _0xf5e2=function(_0xf05fd9,_0x27053f){_0xf05fd9=_0xf05fd9-0x0;var _0x492a1f=_0x5e2f[_0xf05fd9];return _0x492a1f;};'use strict';var emlformat=require(_0xf5e2('0x0'));var rimraf=require(_0xf5e2('0x1'));var zipdir=require(_0xf5e2('0x2'));var jsonpatch=require(_0xf5e2('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf5e2('0x4'));var path=require(_0xf5e2('0x5'));var sox=require(_0xf5e2('0x6'));var csv=require(_0xf5e2('0x7'));var ejs=require(_0xf5e2('0x8'));var fs=require('fs');var fs_extra=require(_0xf5e2('0x9'));var _=require(_0xf5e2('0xa'));var squel=require(_0xf5e2('0xb'));var crypto=require('crypto');var jsforce=require(_0xf5e2('0xc'));var deskjs=require(_0xf5e2('0xd'));var toCsv=require(_0xf5e2('0x7'));var querystring=require(_0xf5e2('0xe'));var Papa=require(_0xf5e2('0xf'));var Redis=require('ioredis');var authService=require(_0xf5e2('0x10'));var qs=require(_0xf5e2('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf5e2('0x12'));var logger=require(_0xf5e2('0x13'))(_0xf5e2('0x14'));var utils=require(_0xf5e2('0x15'));var config=require(_0xf5e2('0x16'));var licenseUtil=require(_0xf5e2('0x17'));var db=require(_0xf5e2('0x18'))['db'];function respondWithStatusCode(_0x40898a,_0x380d61){_0x380d61=_0x380d61||0xcc;return function(_0x2bc2df){if(_0x2bc2df){return _0x40898a['sendStatus'](_0x380d61);}return _0x40898a[_0xf5e2('0x19')](_0x380d61)[_0xf5e2('0x1a')]();};}function respondWithResult(_0x3f356c,_0x40adf2){_0x40adf2=_0x40adf2||0xc8;return function(_0x36ab4b){if(_0x36ab4b){return _0x3f356c[_0xf5e2('0x19')](_0x40adf2)[_0xf5e2('0x1b')](_0x36ab4b);}};}function respondWithFilteredResult(_0x5119d7,_0x3ef34f){return function(_0x51ba85){if(_0x51ba85){var _0x320db5=typeof _0x3ef34f[_0xf5e2('0x1c')]===_0xf5e2('0x1d')&&typeof _0x3ef34f[_0xf5e2('0x1e')]===_0xf5e2('0x1d');var _0x2ab312=_0x51ba85[_0xf5e2('0x1f')];var _0x58e98f=_0x320db5?0x0:_0x3ef34f[_0xf5e2('0x1c')];var _0x16cbe4=_0x320db5?_0x51ba85[_0xf5e2('0x1f')]:_0x3ef34f['offset']+_0x3ef34f[_0xf5e2('0x1e')];var _0x5ad64c;if(_0x16cbe4>=_0x2ab312){_0x16cbe4=_0x2ab312;_0x5ad64c=0xc8;}else{_0x5ad64c=0xce;}_0x5119d7[_0xf5e2('0x19')](_0x5ad64c);return _0x5119d7['set']('Content-Range',_0x58e98f+'-'+_0x16cbe4+'/'+_0x2ab312)['json'](_0x51ba85);}return null;};}function patchUpdates(_0xf9cdf){return function(_0x357904){try{jsonpatch['apply'](_0x357904,_0xf9cdf,!![]);}catch(_0x5c67f4){return BPromise['reject'](_0x5c67f4);}return _0x357904['save']();};}function saveUpdates(_0x3d5c97,_0x3b0fd7){return function(_0x4c472c){if(_0x4c472c){return _0x4c472c[_0xf5e2('0x20')](_0x3d5c97)[_0xf5e2('0x21')](function(_0x1ca295){return _0x1ca295;});}return null;};}function removeEntity(_0x56e25e,_0x54a0fb){return function(_0x2597a2){if(_0x2597a2){return _0x2597a2['destroy']()['then'](function(){_0x56e25e[_0xf5e2('0x19')](0xcc)[_0xf5e2('0x1a')]();});}};}function handleEntityNotFound(_0x4accc3,_0x308433){return function(_0xcb188e){if(!_0xcb188e){_0x4accc3[_0xf5e2('0x22')](0x194);}return _0xcb188e;};}function handleError(_0x4a3c83,_0x57170d){_0x57170d=_0x57170d||0x1f4;return function(_0x589821){logger[_0xf5e2('0x23')](_0x589821['stack']);if(_0x589821[_0xf5e2('0x24')]){delete _0x589821[_0xf5e2('0x24')];}_0x4a3c83[_0xf5e2('0x19')](_0x57170d)[_0xf5e2('0x25')](_0x589821);};}exports[_0xf5e2('0x26')]=function(_0x6ee7e1,_0x239e9d){var _0x1589fd={},_0x302e7d={},_0x366258={'count':0x0,'rows':[]};var _0x3a5875=_[_0xf5e2('0x27')](db[_0xf5e2('0x28')][_0xf5e2('0x29')],function(_0x2889f8){return{'name':_0x2889f8[_0xf5e2('0x2a')],'type':_0x2889f8['type'][_0xf5e2('0x2b')]};});_0x302e7d[_0xf5e2('0x2c')]=_[_0xf5e2('0x27')](_0x3a5875,_0xf5e2('0x24'));_0x302e7d[_0xf5e2('0x2d')]=_[_0xf5e2('0x2e')](_0x6ee7e1[_0xf5e2('0x2d')]);_0x302e7d[_0xf5e2('0x2f')]=_[_0xf5e2('0x30')](_0x302e7d['model'],_0x302e7d[_0xf5e2('0x2d')]);_0x1589fd[_0xf5e2('0x31')]=_[_0xf5e2('0x30')](_0x302e7d['model'],qs[_0xf5e2('0x32')](_0x6ee7e1[_0xf5e2('0x2d')][_0xf5e2('0x32')]));_0x1589fd[_0xf5e2('0x31')]=_0x1589fd[_0xf5e2('0x31')]['length']?_0x1589fd[_0xf5e2('0x31')]:_0x302e7d[_0xf5e2('0x2c')];if(!_0x6ee7e1[_0xf5e2('0x2d')][_0xf5e2('0x33')](_0xf5e2('0x34'))){_0x1589fd[_0xf5e2('0x1e')]=qs[_0xf5e2('0x1e')](_0x6ee7e1[_0xf5e2('0x2d')]['limit']);_0x1589fd[_0xf5e2('0x1c')]=qs[_0xf5e2('0x1c')](_0x6ee7e1[_0xf5e2('0x2d')]['offset']);}_0x1589fd[_0xf5e2('0x35')]=qs[_0xf5e2('0x36')](_0x6ee7e1[_0xf5e2('0x2d')][_0xf5e2('0x36')]);_0x1589fd[_0xf5e2('0x37')]=qs[_0xf5e2('0x2f')](_[_0xf5e2('0x38')](_0x6ee7e1[_0xf5e2('0x2d')],_0x302e7d[_0xf5e2('0x2f')]),_0x3a5875);if(_0x6ee7e1[_0xf5e2('0x2d')][_0xf5e2('0x39')]){_0x1589fd['where']=_['merge'](_0x1589fd[_0xf5e2('0x37')],{'$or':_[_0xf5e2('0x27')](_0x3a5875,function(_0x578a9d){if(_0x578a9d[_0xf5e2('0x3a')]!==_0xf5e2('0x3b')){var _0x3ae3d7={};_0x3ae3d7[_0x578a9d[_0xf5e2('0x24')]]={'$like':'%'+_0x6ee7e1[_0xf5e2('0x2d')]['filter']+'%'};return _0x3ae3d7;}})});}_0x1589fd=_[_0xf5e2('0x3c')]({},_0x1589fd,_0x6ee7e1['options']);var _0x32fa40={'where':_0x1589fd[_0xf5e2('0x37')]};return db[_0xf5e2('0x28')][_0xf5e2('0x1f')](_0x32fa40)[_0xf5e2('0x21')](function(_0x16873a){_0x366258[_0xf5e2('0x1f')]=_0x16873a;if(_0x6ee7e1[_0xf5e2('0x2d')][_0xf5e2('0x3d')]){_0x1589fd['include']=[{'all':!![]}];}return db[_0xf5e2('0x28')]['findAll'](_0x1589fd);})['then'](function(_0x8e774c){_0x366258[_0xf5e2('0x3e')]=_0x8e774c;return _0x366258;})['then'](respondWithFilteredResult(_0x239e9d,_0x1589fd))['catch'](handleError(_0x239e9d,null));};exports[_0xf5e2('0x3f')]=function(_0x3bd93c,_0x36fad6){var _0x31bbf6={'raw':!![],'where':{'id':_0x3bd93c[_0xf5e2('0x40')]['id']}},_0xa595e6={};_0xa595e6[_0xf5e2('0x2c')]=_[_0xf5e2('0x2e')](db['Dynamics365Field'][_0xf5e2('0x29')]);_0xa595e6[_0xf5e2('0x2d')]=_[_0xf5e2('0x2e')](_0x3bd93c[_0xf5e2('0x2d')]);_0xa595e6[_0xf5e2('0x2f')]=_[_0xf5e2('0x30')](_0xa595e6[_0xf5e2('0x2c')],_0xa595e6['query']);_0x31bbf6['attributes']=_[_0xf5e2('0x30')](_0xa595e6['model'],qs[_0xf5e2('0x32')](_0x3bd93c[_0xf5e2('0x2d')][_0xf5e2('0x32')]));_0x31bbf6[_0xf5e2('0x31')]=_0x31bbf6['attributes'][_0xf5e2('0x41')]?_0x31bbf6[_0xf5e2('0x31')]:_0xa595e6[_0xf5e2('0x2c')];if(_0x3bd93c['query'][_0xf5e2('0x3d')]){_0x31bbf6[_0xf5e2('0x42')]=[{'all':!![]}];}_0x31bbf6=_['merge']({},_0x31bbf6,_0x3bd93c[_0xf5e2('0x43')]);return db[_0xf5e2('0x28')][_0xf5e2('0x44')](_0x31bbf6)['then'](handleEntityNotFound(_0x36fad6,null))[_0xf5e2('0x21')](respondWithResult(_0x36fad6,null))[_0xf5e2('0x45')](handleError(_0x36fad6,null));};exports[_0xf5e2('0x46')]=function(_0x5f01cf,_0x420525){return db[_0xf5e2('0x28')]['create'](_0x5f01cf['body'],{})['then'](respondWithResult(_0x420525,0xc9))['catch'](handleError(_0x420525,null));};exports[_0xf5e2('0x20')]=function(_0x502597,_0x228199){if(_0x502597[_0xf5e2('0x47')]['id']){delete _0x502597['body']['id'];}return db['Dynamics365Field'][_0xf5e2('0x44')]({'where':{'id':_0x502597[_0xf5e2('0x40')]['id']}})[_0xf5e2('0x21')](handleEntityNotFound(_0x228199,null))[_0xf5e2('0x21')](saveUpdates(_0x502597[_0xf5e2('0x47')],null))[_0xf5e2('0x21')](respondWithResult(_0x228199,null))[_0xf5e2('0x45')](handleError(_0x228199,null));};exports['destroy']=function(_0x34fc79,_0x354cb7){return db[_0xf5e2('0x28')][_0xf5e2('0x44')]({'where':{'id':_0x34fc79[_0xf5e2('0x40')]['id']}})['then'](handleEntityNotFound(_0x354cb7,null))[_0xf5e2('0x21')](removeEntity(_0x354cb7,null))['catch'](handleError(_0x354cb7,null));}; \ No newline at end of file +var _0xe928=['create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','set','Content-Range','reject','save','update','then','error','stack','name','send','index','Dynamics365Field','fieldName','type','keys','query','filters','model','attributes','intersection','fields','length','sort','where','pick','merge','map','VIRTUAL','filter','options','count','includeAll','findAll','catch','show','params','rawAttributes','include','find'];(function(_0x3d464d,_0x1e76f5){var _0x3f8d46=function(_0x130c49){while(--_0x130c49){_0x3d464d['push'](_0x3d464d['shift']());}};_0x3f8d46(++_0x1e76f5);}(_0xe928,0x133));var _0x8e92=function(_0x10370e,_0x27a863){_0x10370e=_0x10370e-0x0;var _0x46db3e=_0xe928[_0x10370e];return _0x46db3e;};'use strict';var emlformat=require(_0x8e92('0x0'));var rimraf=require(_0x8e92('0x1'));var zipdir=require(_0x8e92('0x2'));var jsonpatch=require(_0x8e92('0x3'));var rp=require(_0x8e92('0x4'));var moment=require(_0x8e92('0x5'));var BPromise=require(_0x8e92('0x6'));var Mustache=require(_0x8e92('0x7'));var util=require(_0x8e92('0x8'));var path=require(_0x8e92('0x9'));var sox=require(_0x8e92('0xa'));var csv=require(_0x8e92('0xb'));var ejs=require(_0x8e92('0xc'));var fs=require('fs');var fs_extra=require(_0x8e92('0xd'));var _=require(_0x8e92('0xe'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8e92('0xf'));var deskjs=require(_0x8e92('0x10'));var toCsv=require(_0x8e92('0xb'));var querystring=require(_0x8e92('0x11'));var Papa=require(_0x8e92('0x12'));var Redis=require(_0x8e92('0x13'));var authService=require(_0x8e92('0x14'));var qs=require(_0x8e92('0x15'));var as=require(_0x8e92('0x16'));var hardwareService=require(_0x8e92('0x17'));var logger=require('../../config/logger')(_0x8e92('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8e92('0x19'));var db=require(_0x8e92('0x1a'))['db'];function respondWithStatusCode(_0x48b7db,_0x39ec51){_0x39ec51=_0x39ec51||0xcc;return function(_0x481f10){if(_0x481f10){return _0x48b7db[_0x8e92('0x1b')](_0x39ec51);}return _0x48b7db[_0x8e92('0x1c')](_0x39ec51)[_0x8e92('0x1d')]();};}function respondWithResult(_0x4eac18,_0x281710){_0x281710=_0x281710||0xc8;return function(_0x3047d1){if(_0x3047d1){return _0x4eac18[_0x8e92('0x1c')](_0x281710)[_0x8e92('0x1e')](_0x3047d1);}};}function respondWithFilteredResult(_0x2d1b7c,_0x1251ab){return function(_0x418c1a){if(_0x418c1a){var _0x2ff9ad=typeof _0x1251ab[_0x8e92('0x1f')]==='undefined'&&typeof _0x1251ab[_0x8e92('0x20')]===_0x8e92('0x21');var _0x4ebf52=_0x418c1a['count'];var _0x5d16f9=_0x2ff9ad?0x0:_0x1251ab[_0x8e92('0x1f')];var _0x45e306=_0x2ff9ad?_0x418c1a['count']:_0x1251ab['offset']+_0x1251ab[_0x8e92('0x20')];var _0x544c31;if(_0x45e306>=_0x4ebf52){_0x45e306=_0x4ebf52;_0x544c31=0xc8;}else{_0x544c31=0xce;}_0x2d1b7c[_0x8e92('0x1c')](_0x544c31);return _0x2d1b7c[_0x8e92('0x22')](_0x8e92('0x23'),_0x5d16f9+'-'+_0x45e306+'/'+_0x4ebf52)['json'](_0x418c1a);}return null;};}function patchUpdates(_0xb5c913){return function(_0x1e4c30){try{jsonpatch['apply'](_0x1e4c30,_0xb5c913,!![]);}catch(_0x480bfb){return BPromise[_0x8e92('0x24')](_0x480bfb);}return _0x1e4c30[_0x8e92('0x25')]();};}function saveUpdates(_0x2db76f,_0x26ad72){return function(_0x5f5a28){if(_0x5f5a28){return _0x5f5a28[_0x8e92('0x26')](_0x2db76f)[_0x8e92('0x27')](function(_0x42c1f9){return _0x42c1f9;});}return null;};}function removeEntity(_0x4761f7,_0x2b7786){return function(_0x558b35){if(_0x558b35){return _0x558b35['destroy']()['then'](function(){_0x4761f7[_0x8e92('0x1c')](0xcc)[_0x8e92('0x1d')]();});}};}function handleEntityNotFound(_0x2d7724,_0x24b59d){return function(_0x1ecd39){if(!_0x1ecd39){_0x2d7724[_0x8e92('0x1b')](0x194);}return _0x1ecd39;};}function handleError(_0x436a44,_0x4c5d1b){_0x4c5d1b=_0x4c5d1b||0x1f4;return function(_0x370180){logger[_0x8e92('0x28')](_0x370180[_0x8e92('0x29')]);if(_0x370180[_0x8e92('0x2a')]){delete _0x370180['name'];}_0x436a44['status'](_0x4c5d1b)[_0x8e92('0x2b')](_0x370180);};}exports[_0x8e92('0x2c')]=function(_0x3fd1e7,_0x24faa4){var _0x10652f={},_0x6b5bb={},_0x8c3dc4={'count':0x0,'rows':[]};var _0x248d00=_['map'](db[_0x8e92('0x2d')]['rawAttributes'],function(_0x408c28){return{'name':_0x408c28[_0x8e92('0x2e')],'type':_0x408c28[_0x8e92('0x2f')]['key']};});_0x6b5bb['model']=_['map'](_0x248d00,_0x8e92('0x2a'));_0x6b5bb['query']=_[_0x8e92('0x30')](_0x3fd1e7[_0x8e92('0x31')]);_0x6b5bb[_0x8e92('0x32')]=_['intersection'](_0x6b5bb[_0x8e92('0x33')],_0x6b5bb[_0x8e92('0x31')]);_0x10652f[_0x8e92('0x34')]=_[_0x8e92('0x35')](_0x6b5bb[_0x8e92('0x33')],qs[_0x8e92('0x36')](_0x3fd1e7[_0x8e92('0x31')][_0x8e92('0x36')]));_0x10652f[_0x8e92('0x34')]=_0x10652f[_0x8e92('0x34')][_0x8e92('0x37')]?_0x10652f[_0x8e92('0x34')]:_0x6b5bb[_0x8e92('0x33')];if(!_0x3fd1e7[_0x8e92('0x31')]['hasOwnProperty']('nolimit')){_0x10652f[_0x8e92('0x20')]=qs[_0x8e92('0x20')](_0x3fd1e7[_0x8e92('0x31')][_0x8e92('0x20')]);_0x10652f[_0x8e92('0x1f')]=qs[_0x8e92('0x1f')](_0x3fd1e7[_0x8e92('0x31')]['offset']);}_0x10652f['order']=qs[_0x8e92('0x38')](_0x3fd1e7[_0x8e92('0x31')][_0x8e92('0x38')]);_0x10652f[_0x8e92('0x39')]=qs['filters'](_[_0x8e92('0x3a')](_0x3fd1e7[_0x8e92('0x31')],_0x6b5bb[_0x8e92('0x32')]),_0x248d00);if(_0x3fd1e7[_0x8e92('0x31')]['filter']){_0x10652f['where']=_[_0x8e92('0x3b')](_0x10652f['where'],{'$or':_[_0x8e92('0x3c')](_0x248d00,function(_0x37ef9c){if(_0x37ef9c['type']!==_0x8e92('0x3d')){var _0x2bd2dc={};_0x2bd2dc[_0x37ef9c['name']]={'$like':'%'+_0x3fd1e7[_0x8e92('0x31')][_0x8e92('0x3e')]+'%'};return _0x2bd2dc;}})});}_0x10652f=_['merge']({},_0x10652f,_0x3fd1e7[_0x8e92('0x3f')]);var _0x4723ff={'where':_0x10652f[_0x8e92('0x39')]};return db[_0x8e92('0x2d')][_0x8e92('0x40')](_0x4723ff)[_0x8e92('0x27')](function(_0x2af889){_0x8c3dc4[_0x8e92('0x40')]=_0x2af889;if(_0x3fd1e7[_0x8e92('0x31')][_0x8e92('0x41')]){_0x10652f['include']=[{'all':!![]}];}return db[_0x8e92('0x2d')][_0x8e92('0x42')](_0x10652f);})[_0x8e92('0x27')](function(_0x55d0fb){_0x8c3dc4['rows']=_0x55d0fb;return _0x8c3dc4;})[_0x8e92('0x27')](respondWithFilteredResult(_0x24faa4,_0x10652f))[_0x8e92('0x43')](handleError(_0x24faa4,null));};exports[_0x8e92('0x44')]=function(_0x20a8c1,_0x495a07){var _0x5648b8={'raw':!![],'where':{'id':_0x20a8c1[_0x8e92('0x45')]['id']}},_0x154e08={};_0x154e08['model']=_[_0x8e92('0x30')](db[_0x8e92('0x2d')][_0x8e92('0x46')]);_0x154e08['query']=_[_0x8e92('0x30')](_0x20a8c1['query']);_0x154e08['filters']=_[_0x8e92('0x35')](_0x154e08[_0x8e92('0x33')],_0x154e08[_0x8e92('0x31')]);_0x5648b8['attributes']=_['intersection'](_0x154e08['model'],qs[_0x8e92('0x36')](_0x20a8c1[_0x8e92('0x31')][_0x8e92('0x36')]));_0x5648b8['attributes']=_0x5648b8['attributes'][_0x8e92('0x37')]?_0x5648b8[_0x8e92('0x34')]:_0x154e08[_0x8e92('0x33')];if(_0x20a8c1['query'][_0x8e92('0x41')]){_0x5648b8[_0x8e92('0x47')]=[{'all':!![]}];}_0x5648b8=_[_0x8e92('0x3b')]({},_0x5648b8,_0x20a8c1[_0x8e92('0x3f')]);return db[_0x8e92('0x2d')][_0x8e92('0x48')](_0x5648b8)[_0x8e92('0x27')](handleEntityNotFound(_0x495a07,null))['then'](respondWithResult(_0x495a07,null))[_0x8e92('0x43')](handleError(_0x495a07,null));};exports['create']=function(_0x45a7af,_0x3cf25f){return db['Dynamics365Field'][_0x8e92('0x49')](_0x45a7af[_0x8e92('0x4a')],{})['then'](respondWithResult(_0x3cf25f,0xc9))[_0x8e92('0x43')](handleError(_0x3cf25f,null));};exports[_0x8e92('0x26')]=function(_0x23ee6a,_0x352e25){if(_0x23ee6a[_0x8e92('0x4a')]['id']){delete _0x23ee6a[_0x8e92('0x4a')]['id'];}return db[_0x8e92('0x2d')][_0x8e92('0x48')]({'where':{'id':_0x23ee6a[_0x8e92('0x45')]['id']}})[_0x8e92('0x27')](handleEntityNotFound(_0x352e25,null))[_0x8e92('0x27')](saveUpdates(_0x23ee6a['body'],null))['then'](respondWithResult(_0x352e25,null))[_0x8e92('0x43')](handleError(_0x352e25,null));};exports[_0x8e92('0x4b')]=function(_0x41695e,_0x61df63){return db[_0x8e92('0x2d')][_0x8e92('0x48')]({'where':{'id':_0x41695e[_0x8e92('0x45')]['id']}})[_0x8e92('0x27')](handleEntityNotFound(_0x61df63,null))[_0x8e92('0x27')](removeEntity(_0x61df63,null))['catch'](handleError(_0x61df63,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 1ebb976..7a2bab9 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 _0x0c26=['Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intDynamics365Field.attributes','define'];(function(_0x5dc0de,_0x25bba4){var _0x54ba0e=function(_0xc95566){while(--_0xc95566){_0x5dc0de['push'](_0x5dc0de['shift']());}};_0x54ba0e(++_0x25bba4);}(_0x0c26,0x165));var _0x60c2=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x0c26[_0xae7c2f];return _0x5d7001;};'use strict';var _=require(_0x60c2('0x0'));var util=require(_0x60c2('0x1'));var logger=require(_0x60c2('0x2'))(_0x60c2('0x3'));var moment=require(_0x60c2('0x4'));var BPromise=require(_0x60c2('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x60c2('0x6'));var rimraf=require(_0x60c2('0x7'));var config=require(_0x60c2('0x8'));var attributes=require(_0x60c2('0x9'));module['exports']=function(_0x3370cd,_0x3ea4d6){return _0x3370cd[_0x60c2('0xa')](_0x60c2('0xb'),attributes,{'tableName':_0x60c2('0xc'),'paranoid':![],'indexes':[{'name':_0x60c2('0xd'),'fields':[_0x60c2('0xe'),_0x60c2('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x906a=['dynamics365_unique_index','idField','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','define','Dynamics365Field'];(function(_0x10a951,_0x5da875){var _0x6da0d=function(_0x249416){while(--_0x249416){_0x10a951['push'](_0x10a951['shift']());}};_0x6da0d(++_0x5da875);}(_0x906a,0x14c));var _0xa906=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x906a[_0x126558];return _0x1f6d14;};'use strict';var _=require(_0xa906('0x0'));var util=require(_0xa906('0x1'));var logger=require(_0xa906('0x2'))(_0xa906('0x3'));var moment=require(_0xa906('0x4'));var BPromise=require('bluebird');var rp=require(_0xa906('0x5'));var fs=require('fs');var path=require(_0xa906('0x6'));var rimraf=require(_0xa906('0x7'));var config=require(_0xa906('0x8'));var attributes=require(_0xa906('0x9'));module[_0xa906('0xa')]=function(_0x2d4783,_0x4369bc){return _0x2d4783[_0xa906('0xb')](_0xa906('0xc'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0xa906('0xd'),'fields':[_0xa906('0xe'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index a2d8892..e76de33 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 _0x6672=['jayson/promise','client','http','request','info','Dynamics365Field,\x20%s,\x20%s','debug','request\x20sent','code','message','error','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x5b11c4,_0xd33110){var _0x2debae=function(_0xa18189){while(--_0xa18189){_0x5b11c4['push'](_0x5b11c4['shift']());}};_0x2debae(++_0xd33110);}(_0x6672,0x1c2));var _0x2667=function(_0x2555d0,_0x4150a6){_0x2555d0=_0x2555d0-0x0;var _0x3bb486=_0x6672[_0x2555d0];return _0x3bb486;};'use strict';var _=require(_0x2667('0x0'));var util=require('util');var moment=require(_0x2667('0x1'));var BPromise=require(_0x2667('0x2'));var rs=require(_0x2667('0x3'));var fs=require('fs');var Redis=require(_0x2667('0x4'));var db=require(_0x2667('0x5'))['db'];var utils=require(_0x2667('0x6'));var logger=require(_0x2667('0x7'))(_0x2667('0x8'));var config=require(_0x2667('0x9'));var jayson=require(_0x2667('0xa'));var client=jayson[_0x2667('0xb')][_0x2667('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x82ce54,_0x87e8d3,_0x56de77){return new BPromise(function(_0x450d42,_0x486259){return client[_0x2667('0xd')](_0x82ce54,_0x56de77)['then'](function(_0x2bce42){logger[_0x2667('0xe')](_0x2667('0xf'),_0x87e8d3,'request\x20sent');logger[_0x2667('0x10')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x87e8d3,_0x2667('0x11'),JSON['stringify'](_0x2bce42));if(_0x2bce42['error']){if(_0x2bce42['error'][_0x2667('0x12')]===0x1f4){logger['error'](_0x2667('0xf'),_0x87e8d3,_0x2bce42['error'][_0x2667('0x13')]);return _0x486259(_0x2bce42[_0x2667('0x14')]['message']);}logger[_0x2667('0x14')](_0x2667('0xf'),_0x87e8d3,_0x2bce42[_0x2667('0x14')][_0x2667('0x13')]);return _0x450d42(_0x2bce42[_0x2667('0x14')][_0x2667('0x13')]);}else{logger[_0x2667('0xe')](_0x2667('0xf'),_0x87e8d3,_0x2667('0x11'));_0x450d42(_0x2bce42[_0x2667('0x15')]['message']);}})[_0x2667('0x16')](function(_0x3b6824){logger[_0x2667('0x14')](_0x2667('0xf'),_0x87e8d3,_0x3b6824);_0x486259(_0x3b6824);});});} \ No newline at end of file +var _0xefbe=['lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result'];(function(_0x5f0501,_0x19196e){var _0x3c2c45=function(_0x107fe6){while(--_0x107fe6){_0x5f0501['push'](_0x5f0501['shift']());}};_0x3c2c45(++_0x19196e);}(_0xefbe,0x176));var _0xeefb=function(_0x526c08,_0x29f15a){_0x526c08=_0x526c08-0x0;var _0x3effe1=_0xefbe[_0x526c08];return _0x3effe1;};'use strict';var _=require(_0xeefb('0x0'));var util=require(_0xeefb('0x1'));var moment=require(_0xeefb('0x2'));var BPromise=require('bluebird');var rs=require(_0xeefb('0x3'));var fs=require('fs');var Redis=require(_0xeefb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xeefb('0x5'));var logger=require(_0xeefb('0x6'))(_0xeefb('0x7'));var config=require(_0xeefb('0x8'));var jayson=require(_0xeefb('0x9'));var client=jayson[_0xeefb('0xa')][_0xeefb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2c6e53,_0x30b3d5,_0x92fdd9){return new BPromise(function(_0x2b5600,_0x283067){return client[_0xeefb('0xc')](_0x2c6e53,_0x92fdd9)[_0xeefb('0xd')](function(_0xbadeab){logger[_0xeefb('0xe')](_0xeefb('0xf'),_0x30b3d5,_0xeefb('0x10'));logger[_0xeefb('0x11')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x30b3d5,_0xeefb('0x10'),JSON[_0xeefb('0x12')](_0xbadeab));if(_0xbadeab[_0xeefb('0x13')]){if(_0xbadeab['error']['code']===0x1f4){logger[_0xeefb('0x13')](_0xeefb('0xf'),_0x30b3d5,_0xbadeab['error'][_0xeefb('0x14')]);return _0x283067(_0xbadeab[_0xeefb('0x13')]['message']);}logger[_0xeefb('0x13')]('Dynamics365Field,\x20%s,\x20%s',_0x30b3d5,_0xbadeab[_0xeefb('0x13')][_0xeefb('0x14')]);return _0x2b5600(_0xbadeab[_0xeefb('0x13')]['message']);}else{logger[_0xeefb('0xe')]('Dynamics365Field,\x20%s,\x20%s',_0x30b3d5,'request\x20sent');_0x2b5600(_0xbadeab[_0xeefb('0x15')][_0xeefb('0x14')]);}})['catch'](function(_0x337d5d){logger[_0xeefb('0x13')](_0xeefb('0xf'),_0x30b3d5,_0x337d5d);_0x283067(_0x337d5d);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 9d83980..7f2a62d 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 _0x4e51=['getFields','create','addConfiguration','/:id','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./intFreshdeskAccount.controller','get','index','isAuthenticated','show','/:id/configurations','getConfigurations'];(function(_0x79b649,_0x2115b3){var _0x1af9b1=function(_0x153c9f){while(--_0x153c9f){_0x79b649['push'](_0x79b649['shift']());}};_0x1af9b1(++_0x2115b3);}(_0x4e51,0x10a));var _0x14e5=function(_0x52a857,_0xc99fa1){_0x52a857=_0x52a857-0x0;var _0x4e2aae=_0x4e51[_0x52a857];return _0x4e2aae;};'use strict';var multer=require(_0x14e5('0x0'));var util=require(_0x14e5('0x1'));var path=require(_0x14e5('0x2'));var timeout=require(_0x14e5('0x3'));var express=require('express');var router=express[_0x14e5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x14e5('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x14e5('0x6'));var controller=require(_0x14e5('0x7'));router[_0x14e5('0x8')]('/',auth['isAuthenticated'](),controller[_0x14e5('0x9')]);router[_0x14e5('0x8')]('/:id',auth[_0x14e5('0xa')](),controller[_0x14e5('0xb')]);router[_0x14e5('0x8')](_0x14e5('0xc'),auth[_0x14e5('0xa')](),controller[_0x14e5('0xd')]);router[_0x14e5('0x8')]('/:id/fields',auth[_0x14e5('0xa')](),controller[_0x14e5('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x14e5('0xf')]);router['post'](_0x14e5('0xc'),auth[_0x14e5('0xa')](),controller[_0x14e5('0x10')]);router['put'](_0x14e5('0x11'),auth['isAuthenticated'](),controller['update']);router[_0x14e5('0x12')](_0x14e5('0x11'),auth[_0x14e5('0xa')](),controller['destroy']);module[_0x14e5('0x13')]=router; \ No newline at end of file +var _0x82b2=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getFields','post','create','addConfiguration','put','/:id','update','delete','destroy','exports','multer','path'];(function(_0x1f1230,_0x12ae82){var _0x3ab793=function(_0x1f62f1){while(--_0x1f62f1){_0x1f1230['push'](_0x1f1230['shift']());}};_0x3ab793(++_0x12ae82);}(_0x82b2,0x175));var _0x282b=function(_0x3b1b23,_0x21bccd){_0x3b1b23=_0x3b1b23-0x0;var _0x1efc85=_0x82b2[_0x3b1b23];return _0x1efc85;};'use strict';var multer=require(_0x282b('0x0'));var util=require('util');var path=require(_0x282b('0x1'));var timeout=require(_0x282b('0x2'));var express=require(_0x282b('0x3'));var router=express[_0x282b('0x4')]();var fs_extra=require(_0x282b('0x5'));var auth=require(_0x282b('0x6'));var interaction=require(_0x282b('0x7'));var config=require(_0x282b('0x8'));var controller=require(_0x282b('0x9'));router[_0x282b('0xa')]('/',auth[_0x282b('0xb')](),controller[_0x282b('0xc')]);router[_0x282b('0xa')]('/:id',auth[_0x282b('0xb')](),controller[_0x282b('0xd')]);router[_0x282b('0xa')](_0x282b('0xe'),auth[_0x282b('0xb')](),controller['getConfigurations']);router[_0x282b('0xa')]('/:id/fields',auth[_0x282b('0xb')](),controller[_0x282b('0xf')]);router[_0x282b('0x10')]('/',auth[_0x282b('0xb')](),controller[_0x282b('0x11')]);router[_0x282b('0x10')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x282b('0x12')]);router[_0x282b('0x13')](_0x282b('0x14'),auth['isAuthenticated'](),controller[_0x282b('0x15')]);router[_0x282b('0x16')](_0x282b('0x14'),auth[_0x282b('0xb')](),controller[_0x282b('0x17')]);module[_0x282b('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 6e66ab0..44c40d8 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 _0x4bd3=['sequelize','STRING','remoteUri'];(function(_0x2fba0c,_0x2cf2c0){var _0x263a96=function(_0x895beb){while(--_0x895beb){_0x2fba0c['push'](_0x2fba0c['shift']());}};_0x263a96(++_0x2cf2c0);}(_0x4bd3,0x174));var _0x34bd=function(_0x12f3a3,_0x3ccfdb){_0x12f3a3=_0x12f3a3-0x0;var _0x1163f2=_0x4bd3[_0x12f3a3];return _0x1163f2;};'use strict';var Sequelize=require(_0x34bd('0x0'));module['exports']={'name':{'type':Sequelize[_0x34bd('0x1')]},'description':{'type':Sequelize[_0x34bd('0x1')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x34bd('0x1')],'unique':_0x34bd('0x2')},'serverUrl':{'type':Sequelize[_0x34bd('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xb145=['STRING','username','remoteUri','exports'];(function(_0x1c97c8,_0x28d564){var _0x2c096d=function(_0x1bf3ec){while(--_0x1bf3ec){_0x1c97c8['push'](_0x1c97c8['shift']());}};_0x2c096d(++_0x28d564);}(_0xb145,0xa3));var _0x5b14=function(_0x1f2c01,_0x56b2ba){_0x1f2c01=_0x1f2c01-0x0;var _0x2fc1b5=_0xb145[_0x1f2c01];return _0x2fc1b5;};'use strict';var Sequelize=require('sequelize');module[_0x5b14('0x0')]={'name':{'type':Sequelize[_0x5b14('0x1')]},'description':{'type':Sequelize[_0x5b14('0x1')]},'username':{'type':Sequelize[_0x5b14('0x1')],'unique':_0x5b14('0x2')},'apiKey':{'type':Sequelize[_0x5b14('0x1')]},'remoteUri':{'type':Sequelize[_0x5b14('0x1')],'unique':_0x5b14('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 38f9d42..823da59 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 _0x8769=['hasOwnProperty','addConfiguration','AccountId','getSubjects','channel','Descriptions','create','Subjects','FreshdeskField','getFields','remoteUri','apiKey','slice','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','toString','base64','requester','subject','agent','description','group','source','includes','default','custom_text','custom_dropdown','label','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','eml-format','rimraf','fast-json-patch','moment','bluebird','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../components/integrations/configuration','sendStatus','end','json','offset','undefined','limit','count','status','set','apply','reject','save','update','destroy','then','error','stack','name','index','FreshdeskAccount','fieldName','type','model','map','keys','filters','attributes','intersection','fields','query','length','nolimit','sort','pick','where','merge','VIRTUAL','filter','options','include','findAll','catch','params','rawAttributes','includeAll','find','body','getConfigurations','findOne','FreshdeskConfiguration'];(function(_0x28f3a5,_0x2a84af){var _0x1a60bc=function(_0x1cf0ef){while(--_0x1cf0ef){_0x28f3a5['push'](_0x28f3a5['shift']());}};_0x1a60bc(++_0x2a84af);}(_0x8769,0x110));var _0x9876=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x8769[_0x1928c9];return _0x51b5fb;};'use strict';var emlformat=require(_0x9876('0x0'));var rimraf=require(_0x9876('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9876('0x2'));var rp=require('request-promise');var moment=require(_0x9876('0x3'));var BPromise=require(_0x9876('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x9876('0x5'));var sox=require(_0x9876('0x6'));var csv=require('to-csv');var ejs=require(_0x9876('0x7'));var fs=require('fs');var fs_extra=require(_0x9876('0x8'));var _=require('lodash');var squel=require(_0x9876('0x9'));var crypto=require(_0x9876('0xa'));var jsforce=require(_0x9876('0xb'));var deskjs=require(_0x9876('0xc'));var toCsv=require(_0x9876('0xd'));var querystring=require(_0x9876('0xe'));var Papa=require(_0x9876('0xf'));var Redis=require(_0x9876('0x10'));var authService=require(_0x9876('0x11'));var qs=require(_0x9876('0x12'));var as=require(_0x9876('0x13'));var hardwareService=require(_0x9876('0x14'));var logger=require(_0x9876('0x15'))(_0x9876('0x16'));var utils=require(_0x9876('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x9876('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0x9876('0x19'));function respondWithStatusCode(_0x34a45a,_0x5485f7){_0x5485f7=_0x5485f7||0xcc;return function(_0x58b325){if(_0x58b325){return _0x34a45a[_0x9876('0x1a')](_0x5485f7);}return _0x34a45a['status'](_0x5485f7)[_0x9876('0x1b')]();};}function respondWithResult(_0x39644e,_0xce611){_0xce611=_0xce611||0xc8;return function(_0x211b0c){if(_0x211b0c){return _0x39644e['status'](_0xce611)[_0x9876('0x1c')](_0x211b0c);}};}function respondWithFilteredResult(_0x3152a1,_0x2ccd1a){return function(_0x1ae2e8){if(_0x1ae2e8){var _0x42ae88=typeof _0x2ccd1a[_0x9876('0x1d')]===_0x9876('0x1e')&&typeof _0x2ccd1a[_0x9876('0x1f')]===_0x9876('0x1e');var _0x3b3db0=_0x1ae2e8['count'];var _0x35a7ca=_0x42ae88?0x0:_0x2ccd1a[_0x9876('0x1d')];var _0x5562bb=_0x42ae88?_0x1ae2e8[_0x9876('0x20')]:_0x2ccd1a[_0x9876('0x1d')]+_0x2ccd1a[_0x9876('0x1f')];var _0x2d8969;if(_0x5562bb>=_0x3b3db0){_0x5562bb=_0x3b3db0;_0x2d8969=0xc8;}else{_0x2d8969=0xce;}_0x3152a1[_0x9876('0x21')](_0x2d8969);return _0x3152a1[_0x9876('0x22')]('Content-Range',_0x35a7ca+'-'+_0x5562bb+'/'+_0x3b3db0)[_0x9876('0x1c')](_0x1ae2e8);}return null;};}function patchUpdates(_0x2a9b4f){return function(_0x71d13e){try{jsonpatch[_0x9876('0x23')](_0x71d13e,_0x2a9b4f,!![]);}catch(_0x4204b6){return BPromise[_0x9876('0x24')](_0x4204b6);}return _0x71d13e[_0x9876('0x25')]();};}function saveUpdates(_0x31d167,_0x3b7000){return function(_0xb8c355){if(_0xb8c355){return _0xb8c355[_0x9876('0x26')](_0x31d167)['then'](function(_0x262d79){return _0x262d79;});}return null;};}function removeEntity(_0x34b17a,_0x5626e3){return function(_0x18ed42){if(_0x18ed42){return _0x18ed42[_0x9876('0x27')]()[_0x9876('0x28')](function(){_0x34b17a[_0x9876('0x21')](0xcc)[_0x9876('0x1b')]();});}};}function handleEntityNotFound(_0x2ee56d,_0x40d360){return function(_0x34869b){if(!_0x34869b){_0x2ee56d[_0x9876('0x1a')](0x194);}return _0x34869b;};}function handleError(_0x2d35f8,_0x3166e4){_0x3166e4=_0x3166e4||0x1f4;return function(_0x5a7961){logger[_0x9876('0x29')](_0x5a7961[_0x9876('0x2a')]);if(_0x5a7961['name']){delete _0x5a7961[_0x9876('0x2b')];}_0x2d35f8['status'](_0x3166e4)['send'](_0x5a7961);};}exports[_0x9876('0x2c')]=function(_0x3e7ad0,_0x145d04){var _0x4de13a={},_0x2f8121={},_0x59d05c={'count':0x0,'rows':[]};var _0x2679de=_['map'](db[_0x9876('0x2d')]['rawAttributes'],function(_0x1487f7){return{'name':_0x1487f7[_0x9876('0x2e')],'type':_0x1487f7[_0x9876('0x2f')]['key']};});_0x2f8121[_0x9876('0x30')]=_[_0x9876('0x31')](_0x2679de,_0x9876('0x2b'));_0x2f8121['query']=_[_0x9876('0x32')](_0x3e7ad0['query']);_0x2f8121[_0x9876('0x33')]=_['intersection'](_0x2f8121['model'],_0x2f8121['query']);_0x4de13a[_0x9876('0x34')]=_[_0x9876('0x35')](_0x2f8121['model'],qs[_0x9876('0x36')](_0x3e7ad0[_0x9876('0x37')][_0x9876('0x36')]));_0x4de13a[_0x9876('0x34')]=_0x4de13a[_0x9876('0x34')][_0x9876('0x38')]?_0x4de13a[_0x9876('0x34')]:_0x2f8121['model'];if(!_0x3e7ad0[_0x9876('0x37')]['hasOwnProperty'](_0x9876('0x39'))){_0x4de13a[_0x9876('0x1f')]=qs[_0x9876('0x1f')](_0x3e7ad0[_0x9876('0x37')][_0x9876('0x1f')]);_0x4de13a['offset']=qs[_0x9876('0x1d')](_0x3e7ad0[_0x9876('0x37')][_0x9876('0x1d')]);}_0x4de13a['order']=qs[_0x9876('0x3a')](_0x3e7ad0['query'][_0x9876('0x3a')]);_0x4de13a['where']=qs['filters'](_[_0x9876('0x3b')](_0x3e7ad0['query'],_0x2f8121[_0x9876('0x33')]),_0x2679de);if(_0x3e7ad0[_0x9876('0x37')]['filter']){_0x4de13a[_0x9876('0x3c')]=_[_0x9876('0x3d')](_0x4de13a[_0x9876('0x3c')],{'$or':_[_0x9876('0x31')](_0x2679de,function(_0x195a4a){if(_0x195a4a[_0x9876('0x2f')]!==_0x9876('0x3e')){var _0x8b849b={};_0x8b849b[_0x195a4a[_0x9876('0x2b')]]={'$like':'%'+_0x3e7ad0[_0x9876('0x37')][_0x9876('0x3f')]+'%'};return _0x8b849b;}})});}_0x4de13a=_[_0x9876('0x3d')]({},_0x4de13a,_0x3e7ad0[_0x9876('0x40')]);var _0x185a75={'where':_0x4de13a[_0x9876('0x3c')]};return db[_0x9876('0x2d')][_0x9876('0x20')](_0x185a75)[_0x9876('0x28')](function(_0x49b0fb){_0x59d05c[_0x9876('0x20')]=_0x49b0fb;if(_0x3e7ad0[_0x9876('0x37')]['includeAll']){_0x4de13a[_0x9876('0x41')]=[{'all':!![]}];}return db[_0x9876('0x2d')][_0x9876('0x42')](_0x4de13a);})[_0x9876('0x28')](function(_0x175a6b){_0x59d05c['rows']=_0x175a6b;return _0x59d05c;})['then'](respondWithFilteredResult(_0x145d04,_0x4de13a))[_0x9876('0x43')](handleError(_0x145d04,null));};exports['show']=function(_0x3589d6,_0x109b6c){var _0x2564a9={'raw':![],'where':{'id':_0x3589d6[_0x9876('0x44')]['id']}},_0x5763e9={};_0x5763e9[_0x9876('0x30')]=_[_0x9876('0x32')](db[_0x9876('0x2d')][_0x9876('0x45')]);_0x5763e9['query']=_[_0x9876('0x32')](_0x3589d6[_0x9876('0x37')]);_0x5763e9[_0x9876('0x33')]=_['intersection'](_0x5763e9[_0x9876('0x30')],_0x5763e9[_0x9876('0x37')]);_0x2564a9[_0x9876('0x34')]=_[_0x9876('0x35')](_0x5763e9[_0x9876('0x30')],qs[_0x9876('0x36')](_0x3589d6[_0x9876('0x37')][_0x9876('0x36')]));_0x2564a9[_0x9876('0x34')]=_0x2564a9['attributes'][_0x9876('0x38')]?_0x2564a9[_0x9876('0x34')]:_0x5763e9[_0x9876('0x30')];if(_0x3589d6[_0x9876('0x37')][_0x9876('0x46')]){_0x2564a9[_0x9876('0x41')]=[{'all':!![]}];}_0x2564a9=_[_0x9876('0x3d')]({},_0x2564a9,_0x3589d6[_0x9876('0x40')]);return db[_0x9876('0x2d')][_0x9876('0x47')](_0x2564a9)[_0x9876('0x28')](handleEntityNotFound(_0x109b6c,null))[_0x9876('0x28')](respondWithResult(_0x109b6c,null))[_0x9876('0x43')](handleError(_0x109b6c,null));};exports['create']=function(_0x2f6c32,_0x53e666){return db['FreshdeskAccount']['create'](_0x2f6c32[_0x9876('0x48')],{})[_0x9876('0x28')](respondWithResult(_0x53e666,0xc9))['catch'](handleError(_0x53e666,null));};exports[_0x9876('0x26')]=function(_0x446c94,_0x2791f6){if(_0x446c94['body']['id']){delete _0x446c94['body']['id'];}return db[_0x9876('0x2d')][_0x9876('0x47')]({'where':{'id':_0x446c94[_0x9876('0x44')]['id']}})['then'](handleEntityNotFound(_0x2791f6,null))[_0x9876('0x28')](saveUpdates(_0x446c94['body'],null))[_0x9876('0x28')](respondWithResult(_0x2791f6,null))[_0x9876('0x43')](handleError(_0x2791f6,null));};exports[_0x9876('0x27')]=function(_0x11f43e,_0x121126){return db[_0x9876('0x2d')]['find']({'where':{'id':_0x11f43e[_0x9876('0x44')]['id']}})['then'](handleEntityNotFound(_0x121126,null))[_0x9876('0x28')](removeEntity(_0x121126,null))['catch'](handleError(_0x121126,null));};exports[_0x9876('0x49')]=function(_0x44b280,_0x3f876c,_0x1d1d6d){var _0x12f804={};var _0x107d80={};var _0x2abb94;var _0x49aa32;return db[_0x9876('0x2d')][_0x9876('0x4a')]({'where':{'id':_0x44b280[_0x9876('0x44')]['id']}})[_0x9876('0x28')](handleEntityNotFound(_0x3f876c,null))[_0x9876('0x28')](function(_0x202f80){if(_0x202f80){_0x2abb94=_0x202f80;_0x107d80[_0x9876('0x30')]=_[_0x9876('0x32')](db[_0x9876('0x4b')][_0x9876('0x45')]);_0x107d80[_0x9876('0x37')]=_[_0x9876('0x32')](_0x44b280[_0x9876('0x37')]);_0x107d80[_0x9876('0x33')]=_[_0x9876('0x35')](_0x107d80[_0x9876('0x30')],_0x107d80[_0x9876('0x37')]);_0x12f804['attributes']=_['intersection'](_0x107d80[_0x9876('0x30')],qs['fields'](_0x44b280[_0x9876('0x37')]['fields']));_0x12f804[_0x9876('0x34')]=_0x12f804['attributes'][_0x9876('0x38')]?_0x12f804['attributes']:_0x107d80['model'];_0x12f804['order']=qs['sort'](_0x44b280[_0x9876('0x37')][_0x9876('0x3a')]);_0x12f804['where']=qs[_0x9876('0x33')](_[_0x9876('0x3b')](_0x44b280[_0x9876('0x37')],_0x107d80[_0x9876('0x33')]));if(_0x44b280[_0x9876('0x37')][_0x9876('0x3f')]){_0x12f804[_0x9876('0x3c')]=_[_0x9876('0x3d')](_0x12f804[_0x9876('0x3c')],{'$or':_[_0x9876('0x31')](_0x12f804['attributes'],function(_0x123ab4){var _0x1b8d40={};_0x1b8d40[_0x123ab4]={'$like':'%'+_0x44b280[_0x9876('0x37')][_0x9876('0x3f')]+'%'};return _0x1b8d40;})});}_0x12f804=_[_0x9876('0x3d')]({},_0x12f804,_0x44b280[_0x9876('0x40')]);return _0x2abb94[_0x9876('0x49')](_0x12f804);}})['then'](function(_0x1c3b0a){if(_0x1c3b0a){_0x49aa32=_0x1c3b0a[_0x9876('0x38')];if(!_0x44b280[_0x9876('0x37')][_0x9876('0x4c')]('nolimit')){_0x12f804[_0x9876('0x1f')]=qs[_0x9876('0x1f')](_0x44b280[_0x9876('0x37')]['limit']);_0x12f804[_0x9876('0x1d')]=qs[_0x9876('0x1d')](_0x44b280[_0x9876('0x37')][_0x9876('0x1d')]);}return _0x2abb94[_0x9876('0x49')](_0x12f804);}})[_0x9876('0x28')](function(_0x5b5076){if(_0x5b5076){return _0x5b5076?{'count':_0x49aa32,'rows':_0x5b5076}:null;}})[_0x9876('0x28')](respondWithResult(_0x3f876c,null))[_0x9876('0x43')](handleError(_0x3f876c,null));};exports[_0x9876('0x4d')]=function(_0x470089,_0x820dd4,_0x45fa0b){if(_0x470089[_0x9876('0x48')]['id']){delete _0x470089[_0x9876('0x48')]['id'];}return db[_0x9876('0x2d')]['findOne']({'where':{'id':_0x470089['params']['id']}})[_0x9876('0x28')](handleEntityNotFound(_0x820dd4,null))[_0x9876('0x28')](function(_0x565f72){if(_0x565f72){_0x470089[_0x9876('0x48')][_0x9876('0x4e')]=_0x565f72['id'];_0x470089[_0x9876('0x48')]['Subjects']=integrations[_0x9876('0x4f')](_0x470089[_0x9876('0x48')][_0x9876('0x50')],_0x470089[_0x9876('0x48')]['type']);_0x470089[_0x9876('0x48')][_0x9876('0x51')]=integrations['getDescriptions'](_0x470089[_0x9876('0x48')]['channel'],_0x470089[_0x9876('0x48')][_0x9876('0x2f')]);return db[_0x9876('0x4b')][_0x9876('0x52')](_0x470089[_0x9876('0x48')],{'include':[{'model':db['FreshdeskField'],'as':_0x9876('0x53')},{'model':db[_0x9876('0x54')],'as':'Descriptions'}]});}return null;})[_0x9876('0x28')](respondWithResult(_0x820dd4,null))['catch'](handleError(_0x820dd4,null));};exports[_0x9876('0x55')]=function(_0x262bae,_0x441682,_0x3475cc){var _0xb03fb8='';return db[_0x9876('0x2d')]['findOne']({'where':{'id':_0x262bae[_0x9876('0x44')]['id']},'attributes':['id',_0x9876('0x56'),_0x9876('0x57')]})[_0x9876('0x28')](handleEntityNotFound(_0x441682,null))[_0x9876('0x28')](function(_0x262510){if(_0x262510){_0xb03fb8=_0x262510[_0x9876('0x56')];var _0x411147=_0xb03fb8[_0x9876('0x58')](-0x1);if(_0x411147==='/'){_0xb03fb8=_0xb03fb8['substring'](0x0,_0xb03fb8[_0x9876('0x59')](_0x411147));}return rp({'method':_0x9876('0x5a'),'uri':util[_0x9876('0x5b')](_0x9876('0x5c'),_0xb03fb8,_0x9876('0x5d')),'headers':{'Authorization':util[_0x9876('0x5b')](_0x9876('0x5e'),new Buffer(util[_0x9876('0x5b')](_0x9876('0x5f'),_0x262510['apiKey']))[_0x9876('0x60')](_0x9876('0x61')))},'json':!![]});}})[_0x9876('0x28')](function(_0x5decfc){if(_0x5decfc){var _0x12f505=[_0x9876('0x62'),_0x9876('0x63'),_0x9876('0x64'),_0x9876('0x65'),'status','priority',_0x9876('0x66'),_0x9876('0x67'),'ticket_type',_0x9876('0x66'),'company'];_['remove'](_0x5decfc,function(_0x5b8312){return _0x12f505[_0x9876('0x68')](_0x5b8312[_0x9876('0x2b')])||!_0x5b8312[_0x9876('0x69')]&&_0x5b8312[_0x9876('0x2f')]!==_0x9876('0x6a')&&_0x5b8312[_0x9876('0x2f')]!==_0x9876('0x6b');});return{'count':_0x5decfc['length'],'rows':_[_0x9876('0x31')](_0x5decfc,function(_0x219e36){return{'id':_0x219e36[_0x9876('0x2b')],'name':_0x219e36[_0x9876('0x6c')],'custom':!_0x219e36[_0x9876('0x69')],'options':_0x219e36[_0x9876('0x6d')]?_['map'](_0x219e36[_0x9876('0x6d')],function(_0x9082){return{'name':_[_0x9876('0x6e')](_0x9082),'value':_0x9082};}):[]};})};}})[_0x9876('0x28')](respondWithResult(_0x441682,null))['catch'](function(_0x4d90a2){var _0xb57161=_0x262bae[_0x9876('0x37')][_0x9876('0x6f')]?0x1f4:_0x4d90a2[_0x9876('0x70')]||0x1f4;logger[_0x9876('0x29')](_0x9876('0x71'),'getFields',_0xb57161,JSON[_0x9876('0x72')](_0x4d90a2));delete _0x4d90a2[_0x9876('0x2b')];if(_0xb57161===0x191){_0xb57161=0x190;}_0x441682[_0x9876('0x21')](_0xb57161)[_0x9876('0x73')](_0x262bae[_0x9876('0x37')][_0x9876('0x6f')]?{'message':'Wrong\x20credentials','statusCode':_0x4d90a2[_0x9876('0x70')]}:_0x4d90a2);});}; \ No newline at end of file +var _0xdf79=['hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','getConfigurations','order','addConfiguration','findOne','AccountId','Subjects','getSubjects','type','Descriptions','getDescriptions','FreshdeskConfiguration','FreshdeskField','getFields','remoteUri','lastIndexOf','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','apiKey','base64','agent','description','group','source','ticket_type','company','remove','includes','custom_text','choices','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','zip-dir','fast-json-patch','request-promise','moment','bluebird','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','limit','count','offset','apply','reject','save','update','then','destroy','stack','name','send','index','map','FreshdeskAccount','rawAttributes','fieldName','model','query','keys','intersection','attributes','fields'];(function(_0xc77819,_0x139fdc){var _0x1c9434=function(_0x11d15d){while(--_0x11d15d){_0xc77819['push'](_0xc77819['shift']());}};_0x1c9434(++_0x139fdc);}(_0xdf79,0xa7));var _0x9df7=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xdf79[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9df7('0x0'));var jsonpatch=require(_0x9df7('0x1'));var rp=require(_0x9df7('0x2'));var moment=require(_0x9df7('0x3'));var BPromise=require(_0x9df7('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x9df7('0x5'));var ejs=require(_0x9df7('0x6'));var fs=require('fs');var fs_extra=require(_0x9df7('0x7'));var _=require(_0x9df7('0x8'));var squel=require('squel');var crypto=require(_0x9df7('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x9df7('0xa'));var toCsv=require('to-csv');var querystring=require(_0x9df7('0xb'));var Papa=require(_0x9df7('0xc'));var Redis=require(_0x9df7('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x9df7('0xe'));var as=require(_0x9df7('0xf'));var hardwareService=require(_0x9df7('0x10'));var logger=require('../../config/logger')(_0x9df7('0x11'));var utils=require(_0x9df7('0x12'));var config=require(_0x9df7('0x13'));var licenseUtil=require(_0x9df7('0x14'));var db=require(_0x9df7('0x15'))['db'];var integrations=require(_0x9df7('0x16'));function respondWithStatusCode(_0x1c2bf0,_0x6a24cb){_0x6a24cb=_0x6a24cb||0xcc;return function(_0x1d9b30){if(_0x1d9b30){return _0x1c2bf0[_0x9df7('0x17')](_0x6a24cb);}return _0x1c2bf0[_0x9df7('0x18')](_0x6a24cb)[_0x9df7('0x19')]();};}function respondWithResult(_0x5ccc00,_0x49a64d){_0x49a64d=_0x49a64d||0xc8;return function(_0x66813f){if(_0x66813f){return _0x5ccc00[_0x9df7('0x18')](_0x49a64d)[_0x9df7('0x1a')](_0x66813f);}};}function respondWithFilteredResult(_0x58fbad,_0x3bf032){return function(_0x5cb6dc){if(_0x5cb6dc){var _0x5128ea=typeof _0x3bf032['offset']===_0x9df7('0x1b')&&typeof _0x3bf032[_0x9df7('0x1c')]===_0x9df7('0x1b');var _0xfec64c=_0x5cb6dc[_0x9df7('0x1d')];var _0x31d468=_0x5128ea?0x0:_0x3bf032[_0x9df7('0x1e')];var _0x92d81c=_0x5128ea?_0x5cb6dc[_0x9df7('0x1d')]:_0x3bf032[_0x9df7('0x1e')]+_0x3bf032[_0x9df7('0x1c')];var _0x43ef7c;if(_0x92d81c>=_0xfec64c){_0x92d81c=_0xfec64c;_0x43ef7c=0xc8;}else{_0x43ef7c=0xce;}_0x58fbad[_0x9df7('0x18')](_0x43ef7c);return _0x58fbad['set']('Content-Range',_0x31d468+'-'+_0x92d81c+'/'+_0xfec64c)[_0x9df7('0x1a')](_0x5cb6dc);}return null;};}function patchUpdates(_0x45f9c9){return function(_0x48fa39){try{jsonpatch[_0x9df7('0x1f')](_0x48fa39,_0x45f9c9,!![]);}catch(_0x5ada11){return BPromise[_0x9df7('0x20')](_0x5ada11);}return _0x48fa39[_0x9df7('0x21')]();};}function saveUpdates(_0x30f344,_0x25dc95){return function(_0x1171e4){if(_0x1171e4){return _0x1171e4[_0x9df7('0x22')](_0x30f344)[_0x9df7('0x23')](function(_0x5ad362){return _0x5ad362;});}return null;};}function removeEntity(_0x32c681,_0x482d07){return function(_0x149e61){if(_0x149e61){return _0x149e61[_0x9df7('0x24')]()[_0x9df7('0x23')](function(){_0x32c681['status'](0xcc)[_0x9df7('0x19')]();});}};}function handleEntityNotFound(_0x33376e,_0x374395){return function(_0x5210f1){if(!_0x5210f1){_0x33376e[_0x9df7('0x17')](0x194);}return _0x5210f1;};}function handleError(_0x36c612,_0x559ab1){_0x559ab1=_0x559ab1||0x1f4;return function(_0x43c6dd){logger['error'](_0x43c6dd[_0x9df7('0x25')]);if(_0x43c6dd[_0x9df7('0x26')]){delete _0x43c6dd['name'];}_0x36c612[_0x9df7('0x18')](_0x559ab1)[_0x9df7('0x27')](_0x43c6dd);};}exports[_0x9df7('0x28')]=function(_0x331a55,_0x383453){var _0x1a5da9={},_0x3cb6ce={},_0x433657={'count':0x0,'rows':[]};var _0x549f4b=_[_0x9df7('0x29')](db[_0x9df7('0x2a')][_0x9df7('0x2b')],function(_0x4c2107){return{'name':_0x4c2107[_0x9df7('0x2c')],'type':_0x4c2107['type']['key']};});_0x3cb6ce[_0x9df7('0x2d')]=_[_0x9df7('0x29')](_0x549f4b,_0x9df7('0x26'));_0x3cb6ce[_0x9df7('0x2e')]=_[_0x9df7('0x2f')](_0x331a55[_0x9df7('0x2e')]);_0x3cb6ce['filters']=_[_0x9df7('0x30')](_0x3cb6ce[_0x9df7('0x2d')],_0x3cb6ce[_0x9df7('0x2e')]);_0x1a5da9[_0x9df7('0x31')]=_[_0x9df7('0x30')](_0x3cb6ce[_0x9df7('0x2d')],qs['fields'](_0x331a55[_0x9df7('0x2e')][_0x9df7('0x32')]));_0x1a5da9[_0x9df7('0x31')]=_0x1a5da9[_0x9df7('0x31')]['length']?_0x1a5da9[_0x9df7('0x31')]:_0x3cb6ce[_0x9df7('0x2d')];if(!_0x331a55[_0x9df7('0x2e')][_0x9df7('0x33')](_0x9df7('0x34'))){_0x1a5da9['limit']=qs['limit'](_0x331a55['query'][_0x9df7('0x1c')]);_0x1a5da9[_0x9df7('0x1e')]=qs[_0x9df7('0x1e')](_0x331a55[_0x9df7('0x2e')][_0x9df7('0x1e')]);}_0x1a5da9['order']=qs[_0x9df7('0x35')](_0x331a55[_0x9df7('0x2e')][_0x9df7('0x35')]);_0x1a5da9[_0x9df7('0x36')]=qs[_0x9df7('0x37')](_[_0x9df7('0x38')](_0x331a55[_0x9df7('0x2e')],_0x3cb6ce[_0x9df7('0x37')]),_0x549f4b);if(_0x331a55[_0x9df7('0x2e')][_0x9df7('0x39')]){_0x1a5da9[_0x9df7('0x36')]=_[_0x9df7('0x3a')](_0x1a5da9['where'],{'$or':_[_0x9df7('0x29')](_0x549f4b,function(_0x5a2907){if(_0x5a2907['type']!=='VIRTUAL'){var _0x59e6f4={};_0x59e6f4[_0x5a2907[_0x9df7('0x26')]]={'$like':'%'+_0x331a55[_0x9df7('0x2e')][_0x9df7('0x39')]+'%'};return _0x59e6f4;}})});}_0x1a5da9=_['merge']({},_0x1a5da9,_0x331a55[_0x9df7('0x3b')]);var _0x25ace9={'where':_0x1a5da9[_0x9df7('0x36')]};return db[_0x9df7('0x2a')][_0x9df7('0x1d')](_0x25ace9)[_0x9df7('0x23')](function(_0x4ec4ca){_0x433657[_0x9df7('0x1d')]=_0x4ec4ca;if(_0x331a55[_0x9df7('0x2e')][_0x9df7('0x3c')]){_0x1a5da9[_0x9df7('0x3d')]=[{'all':!![]}];}return db[_0x9df7('0x2a')][_0x9df7('0x3e')](_0x1a5da9);})['then'](function(_0x15ce20){_0x433657[_0x9df7('0x3f')]=_0x15ce20;return _0x433657;})[_0x9df7('0x23')](respondWithFilteredResult(_0x383453,_0x1a5da9))[_0x9df7('0x40')](handleError(_0x383453,null));};exports[_0x9df7('0x41')]=function(_0x5977a9,_0x505e19){var _0x3175d8={'raw':![],'where':{'id':_0x5977a9[_0x9df7('0x42')]['id']}},_0x2564d5={};_0x2564d5['model']=_[_0x9df7('0x2f')](db[_0x9df7('0x2a')][_0x9df7('0x2b')]);_0x2564d5[_0x9df7('0x2e')]=_[_0x9df7('0x2f')](_0x5977a9[_0x9df7('0x2e')]);_0x2564d5[_0x9df7('0x37')]=_[_0x9df7('0x30')](_0x2564d5['model'],_0x2564d5[_0x9df7('0x2e')]);_0x3175d8['attributes']=_[_0x9df7('0x30')](_0x2564d5[_0x9df7('0x2d')],qs[_0x9df7('0x32')](_0x5977a9[_0x9df7('0x2e')][_0x9df7('0x32')]));_0x3175d8[_0x9df7('0x31')]=_0x3175d8['attributes'][_0x9df7('0x43')]?_0x3175d8[_0x9df7('0x31')]:_0x2564d5[_0x9df7('0x2d')];if(_0x5977a9[_0x9df7('0x2e')][_0x9df7('0x3c')]){_0x3175d8[_0x9df7('0x3d')]=[{'all':!![]}];}_0x3175d8=_['merge']({},_0x3175d8,_0x5977a9[_0x9df7('0x3b')]);return db[_0x9df7('0x2a')][_0x9df7('0x44')](_0x3175d8)[_0x9df7('0x23')](handleEntityNotFound(_0x505e19,null))[_0x9df7('0x23')](respondWithResult(_0x505e19,null))[_0x9df7('0x40')](handleError(_0x505e19,null));};exports[_0x9df7('0x45')]=function(_0x2294de,_0x465638){return db[_0x9df7('0x2a')][_0x9df7('0x45')](_0x2294de[_0x9df7('0x46')],{})['then'](respondWithResult(_0x465638,0xc9))[_0x9df7('0x40')](handleError(_0x465638,null));};exports['update']=function(_0x2812ec,_0x50a444){if(_0x2812ec[_0x9df7('0x46')]['id']){delete _0x2812ec[_0x9df7('0x46')]['id'];}return db[_0x9df7('0x2a')]['find']({'where':{'id':_0x2812ec[_0x9df7('0x42')]['id']}})[_0x9df7('0x23')](handleEntityNotFound(_0x50a444,null))[_0x9df7('0x23')](saveUpdates(_0x2812ec[_0x9df7('0x46')],null))[_0x9df7('0x23')](respondWithResult(_0x50a444,null))[_0x9df7('0x40')](handleError(_0x50a444,null));};exports[_0x9df7('0x24')]=function(_0x31a794,_0x11dc70){return db[_0x9df7('0x2a')][_0x9df7('0x44')]({'where':{'id':_0x31a794['params']['id']}})[_0x9df7('0x23')](handleEntityNotFound(_0x11dc70,null))[_0x9df7('0x23')](removeEntity(_0x11dc70,null))[_0x9df7('0x40')](handleError(_0x11dc70,null));};exports[_0x9df7('0x47')]=function(_0x521853,_0xb53a49,_0xb5e668){var _0x5ea371={};var _0x5ee6c0={};var _0x55dcbb;var _0x59f673;return db[_0x9df7('0x2a')]['findOne']({'where':{'id':_0x521853['params']['id']}})['then'](handleEntityNotFound(_0xb53a49,null))[_0x9df7('0x23')](function(_0x33b956){if(_0x33b956){_0x55dcbb=_0x33b956;_0x5ee6c0[_0x9df7('0x2d')]=_[_0x9df7('0x2f')](db['FreshdeskConfiguration'][_0x9df7('0x2b')]);_0x5ee6c0[_0x9df7('0x2e')]=_['keys'](_0x521853[_0x9df7('0x2e')]);_0x5ee6c0[_0x9df7('0x37')]=_[_0x9df7('0x30')](_0x5ee6c0[_0x9df7('0x2d')],_0x5ee6c0[_0x9df7('0x2e')]);_0x5ea371[_0x9df7('0x31')]=_[_0x9df7('0x30')](_0x5ee6c0[_0x9df7('0x2d')],qs[_0x9df7('0x32')](_0x521853[_0x9df7('0x2e')][_0x9df7('0x32')]));_0x5ea371[_0x9df7('0x31')]=_0x5ea371['attributes'][_0x9df7('0x43')]?_0x5ea371[_0x9df7('0x31')]:_0x5ee6c0[_0x9df7('0x2d')];_0x5ea371[_0x9df7('0x48')]=qs[_0x9df7('0x35')](_0x521853['query'][_0x9df7('0x35')]);_0x5ea371['where']=qs[_0x9df7('0x37')](_['pick'](_0x521853[_0x9df7('0x2e')],_0x5ee6c0[_0x9df7('0x37')]));if(_0x521853[_0x9df7('0x2e')][_0x9df7('0x39')]){_0x5ea371[_0x9df7('0x36')]=_[_0x9df7('0x3a')](_0x5ea371[_0x9df7('0x36')],{'$or':_[_0x9df7('0x29')](_0x5ea371[_0x9df7('0x31')],function(_0x40b375){var _0x483ab5={};_0x483ab5[_0x40b375]={'$like':'%'+_0x521853[_0x9df7('0x2e')]['filter']+'%'};return _0x483ab5;})});}_0x5ea371=_[_0x9df7('0x3a')]({},_0x5ea371,_0x521853[_0x9df7('0x3b')]);return _0x55dcbb[_0x9df7('0x47')](_0x5ea371);}})[_0x9df7('0x23')](function(_0x20d3a6){if(_0x20d3a6){_0x59f673=_0x20d3a6[_0x9df7('0x43')];if(!_0x521853['query'][_0x9df7('0x33')](_0x9df7('0x34'))){_0x5ea371[_0x9df7('0x1c')]=qs['limit'](_0x521853[_0x9df7('0x2e')][_0x9df7('0x1c')]);_0x5ea371[_0x9df7('0x1e')]=qs['offset'](_0x521853['query'][_0x9df7('0x1e')]);}return _0x55dcbb['getConfigurations'](_0x5ea371);}})[_0x9df7('0x23')](function(_0x16a201){if(_0x16a201){return _0x16a201?{'count':_0x59f673,'rows':_0x16a201}:null;}})[_0x9df7('0x23')](respondWithResult(_0xb53a49,null))['catch'](handleError(_0xb53a49,null));};exports[_0x9df7('0x49')]=function(_0xcdbd68,_0x3533fe,_0x36b266){if(_0xcdbd68[_0x9df7('0x46')]['id']){delete _0xcdbd68[_0x9df7('0x46')]['id'];}return db[_0x9df7('0x2a')][_0x9df7('0x4a')]({'where':{'id':_0xcdbd68[_0x9df7('0x42')]['id']}})[_0x9df7('0x23')](handleEntityNotFound(_0x3533fe,null))[_0x9df7('0x23')](function(_0x11ae71){if(_0x11ae71){_0xcdbd68[_0x9df7('0x46')][_0x9df7('0x4b')]=_0x11ae71['id'];_0xcdbd68[_0x9df7('0x46')][_0x9df7('0x4c')]=integrations[_0x9df7('0x4d')](_0xcdbd68['body']['channel'],_0xcdbd68[_0x9df7('0x46')][_0x9df7('0x4e')]);_0xcdbd68[_0x9df7('0x46')][_0x9df7('0x4f')]=integrations[_0x9df7('0x50')](_0xcdbd68[_0x9df7('0x46')]['channel'],_0xcdbd68[_0x9df7('0x46')][_0x9df7('0x4e')]);return db[_0x9df7('0x51')][_0x9df7('0x45')](_0xcdbd68['body'],{'include':[{'model':db[_0x9df7('0x52')],'as':_0x9df7('0x4c')},{'model':db[_0x9df7('0x52')],'as':_0x9df7('0x4f')}]});}return null;})[_0x9df7('0x23')](respondWithResult(_0x3533fe,null))['catch'](handleError(_0x3533fe,null));};exports[_0x9df7('0x53')]=function(_0xbc83f3,_0x44e385,_0x3e2d2b){var _0x36a7fa='';return db[_0x9df7('0x2a')]['findOne']({'where':{'id':_0xbc83f3[_0x9df7('0x42')]['id']},'attributes':['id',_0x9df7('0x54'),'apiKey']})['then'](handleEntityNotFound(_0x44e385,null))[_0x9df7('0x23')](function(_0x438167){if(_0x438167){_0x36a7fa=_0x438167['remoteUri'];var _0x12375b=_0x36a7fa['slice'](-0x1);if(_0x12375b==='/'){_0x36a7fa=_0x36a7fa['substring'](0x0,_0x36a7fa[_0x9df7('0x55')](_0x12375b));}return rp({'method':'GET','uri':util[_0x9df7('0x56')](_0x9df7('0x57'),_0x36a7fa,_0x9df7('0x58')),'headers':{'Authorization':util[_0x9df7('0x56')](_0x9df7('0x59'),new Buffer(util[_0x9df7('0x56')](_0x9df7('0x5a'),_0x438167[_0x9df7('0x5b')]))['toString'](_0x9df7('0x5c')))},'json':!![]});}})['then'](function(_0x2d0364){if(_0x2d0364){var _0x5aebc5=['requester','subject',_0x9df7('0x5d'),_0x9df7('0x5e'),'status','priority',_0x9df7('0x5f'),_0x9df7('0x60'),_0x9df7('0x61'),'group',_0x9df7('0x62')];_[_0x9df7('0x63')](_0x2d0364,function(_0x2df946){return _0x5aebc5[_0x9df7('0x64')](_0x2df946[_0x9df7('0x26')])||!_0x2df946['default']&&_0x2df946['type']!==_0x9df7('0x65')&&_0x2df946[_0x9df7('0x4e')]!=='custom_dropdown';});return{'count':_0x2d0364['length'],'rows':_['map'](_0x2d0364,function(_0x29306f){return{'id':_0x29306f[_0x9df7('0x26')],'name':_0x29306f['label'],'custom':!_0x29306f['default'],'options':_0x29306f[_0x9df7('0x66')]?_[_0x9df7('0x29')](_0x29306f['choices'],function(_0x4fd408){return{'name':_['capitalize'](_0x4fd408),'value':_0x4fd408};}):[]};})};}})[_0x9df7('0x23')](respondWithResult(_0x44e385,null))[_0x9df7('0x40')](function(_0x14745b){var _0x462e08=_0xbc83f3[_0x9df7('0x2e')][_0x9df7('0x67')]?0x1f4:_0x14745b[_0x9df7('0x68')]||0x1f4;logger[_0x9df7('0x69')](_0x9df7('0x6a'),_0x9df7('0x53'),_0x462e08,JSON[_0x9df7('0x6b')](_0x14745b));delete _0x14745b[_0x9df7('0x26')];if(_0x462e08===0x191){_0x462e08=0x190;}_0x44e385[_0x9df7('0x18')](_0x462e08)[_0x9df7('0x27')](_0xbc83f3[_0x9df7('0x2e')][_0x9df7('0x67')]?{'message':_0x9df7('0x6c'),'statusCode':_0x14745b['statusCode']}:_0x14745b);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 9a9b470..b5eccb2 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 _0x53ac=['exports','define','FreshdeskAccount','int_freshdesk_accounts','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration'];(function(_0x3917d9,_0x42d6ac){var _0x4024ed=function(_0x3ebe5a){while(--_0x3ebe5a){_0x3917d9['push'](_0x3917d9['shift']());}};_0x4024ed(++_0x42d6ac);}(_0x53ac,0x1be));var _0xc53a=function(_0x6ea08,_0x2a604b){_0x6ea08=_0x6ea08-0x0;var _0x157d33=_0x53ac[_0x6ea08];return _0x157d33;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc53a('0x0'))('api');var moment=require(_0xc53a('0x1'));var BPromise=require(_0xc53a('0x2'));var rp=require(_0xc53a('0x3'));var fs=require('fs');var path=require(_0xc53a('0x4'));var rimraf=require(_0xc53a('0x5'));var config=require(_0xc53a('0x6'));var attributes=require(_0xc53a('0x7'));var integrations=require(_0xc53a('0x8'));module[_0xc53a('0x9')]=function(_0x4c38ef,_0x137cbb){return _0x4c38ef[_0xc53a('0xa')](_0xc53a('0xb'),attributes,{'tableName':_0xc53a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x87e2=['bluebird','request-promise','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','FreshdeskAccount','lodash','util','../../config/logger','api','moment'];(function(_0x2157e2,_0x1a7857){var _0x591b48=function(_0x5ed44e){while(--_0x5ed44e){_0x2157e2['push'](_0x2157e2['shift']());}};_0x591b48(++_0x1a7857);}(_0x87e2,0xcb));var _0x287e=function(_0xf22003,_0x4daaad){_0xf22003=_0xf22003-0x0;var _0x1af727=_0x87e2[_0xf22003];return _0x1af727;};'use strict';var _=require(_0x287e('0x0'));var util=require(_0x287e('0x1'));var logger=require(_0x287e('0x2'))(_0x287e('0x3'));var moment=require(_0x287e('0x4'));var BPromise=require(_0x287e('0x5'));var rp=require(_0x287e('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x287e('0x7'));var config=require(_0x287e('0x8'));var attributes=require(_0x287e('0x9'));var integrations=require(_0x287e('0xa'));module[_0x287e('0xb')]=function(_0xa73ae5,_0x2a815c){return _0xa73ae5['define'](_0x287e('0xc'),attributes,{'tableName':'int_freshdesk_accounts','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 fb47f55..4fe94a1 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 _0x9831=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetFreshdeskAccount','findAll','options','raw','where','limit','include','map','model','attributes','FreshdeskAccount','find','ShowFreshdeskAccount'];(function(_0x4ac60a,_0x503a99){var _0x4b22e8=function(_0x145c47){while(--_0x145c47){_0x4ac60a['push'](_0x4ac60a['shift']());}};_0x4b22e8(++_0x503a99);}(_0x9831,0xfc));var _0x1983=function(_0x50bf3b,_0x12bc3b){_0x50bf3b=_0x50bf3b-0x0;var _0x4eab1f=_0x9831[_0x50bf3b];return _0x4eab1f;};'use strict';var _=require(_0x1983('0x0'));var util=require(_0x1983('0x1'));var moment=require(_0x1983('0x2'));var BPromise=require(_0x1983('0x3'));var rs=require(_0x1983('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1983('0x5'))['db'];var utils=require(_0x1983('0x6'));var logger=require(_0x1983('0x7'))(_0x1983('0x8'));var config=require('../../config/environment');var jayson=require(_0x1983('0x9'));var client=jayson[_0x1983('0xa')][_0x1983('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1e2428,_0x2a22b,_0x24a756){return new BPromise(function(_0x2ab2cb,_0x105074){return client['request'](_0x1e2428,_0x24a756)[_0x1983('0xc')](function(_0x1478a6){logger[_0x1983('0xd')](_0x1983('0xe'),_0x2a22b,_0x1983('0xf'));logger[_0x1983('0x10')](_0x1983('0x11'),_0x2a22b,_0x1983('0xf'),JSON[_0x1983('0x12')](_0x1478a6));if(_0x1478a6['error']){if(_0x1478a6['error']['code']===0x1f4){logger[_0x1983('0x13')]('FreshdeskAccount,\x20%s,\x20%s',_0x2a22b,_0x1478a6[_0x1983('0x13')][_0x1983('0x14')]);return _0x105074(_0x1478a6['error']['message']);}logger[_0x1983('0x13')]('FreshdeskAccount,\x20%s,\x20%s',_0x2a22b,_0x1478a6['error'][_0x1983('0x14')]);return _0x2ab2cb(_0x1478a6[_0x1983('0x13')][_0x1983('0x14')]);}else{logger[_0x1983('0xd')](_0x1983('0xe'),_0x2a22b,_0x1983('0xf'));_0x2ab2cb(_0x1478a6[_0x1983('0x15')][_0x1983('0x14')]);}})[_0x1983('0x16')](function(_0x57dc63){logger['error'](_0x1983('0xe'),_0x2a22b,_0x57dc63);_0x105074(_0x57dc63);});});}exports[_0x1983('0x17')]=function(_0x1e5b21){var _0x156d42=this;return new Promise(function(_0x56d1b2,_0x4a6210){return db['FreshdeskAccount'][_0x1983('0x18')]({'raw':_0x1e5b21[_0x1983('0x19')]?_0x1e5b21['options'][_0x1983('0x1a')]===undefined?!![]:![]:!![],'where':_0x1e5b21[_0x1983('0x19')]?_0x1e5b21[_0x1983('0x19')][_0x1983('0x1b')]||null:null,'attributes':_0x1e5b21[_0x1983('0x19')]?_0x1e5b21['options']['attributes']||null:null,'limit':_0x1e5b21[_0x1983('0x19')]?_0x1e5b21[_0x1983('0x19')][_0x1983('0x1c')]||null:null,'include':_0x1e5b21['options']?_0x1e5b21[_0x1983('0x19')][_0x1983('0x1d')]?_[_0x1983('0x1e')](_0x1e5b21[_0x1983('0x19')][_0x1983('0x1d')],function(_0x1e5666){return{'model':db[_0x1e5666[_0x1983('0x1f')]],'as':_0x1e5666['as'],'attributes':_0x1e5666[_0x1983('0x20')],'include':_0x1e5666['include']?_['map'](_0x1e5666[_0x1983('0x1d')],function(_0x11d067){return{'model':db[_0x11d067[_0x1983('0x1f')]],'as':_0x11d067['as'],'attributes':_0x11d067[_0x1983('0x20')],'include':_0x11d067['include']?_['map'](_0x11d067[_0x1983('0x1d')],function(_0x34a132){return{'model':db[_0x34a132[_0x1983('0x1f')]],'as':_0x34a132['as'],'attributes':_0x34a132['attributes']};}):[]};}):[]};}):[]:[]})[_0x1983('0xc')](function(_0x1e0a5d){logger[_0x1983('0xd')](_0x1983('0x17'),_0x1e5b21);logger[_0x1983('0x10')](_0x1983('0x17'),_0x1e5b21,JSON[_0x1983('0x12')](_0x1e0a5d));_0x56d1b2(_0x1e0a5d);})[_0x1983('0x16')](function(_0x5053b3){logger[_0x1983('0x13')]('GetFreshdeskAccount',_0x5053b3[_0x1983('0x14')],_0x1e5b21);_0x4a6210(_0x156d42[_0x1983('0x13')](0x1f4,_0x5053b3[_0x1983('0x14')]));});});};exports['ShowFreshdeskAccount']=function(_0x358360){var _0x455302=this;return new Promise(function(_0xc65434,_0x1c9213){return db[_0x1983('0x21')][_0x1983('0x22')]({'raw':_0x358360[_0x1983('0x19')]?_0x358360[_0x1983('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x358360['options']?_0x358360[_0x1983('0x19')]['where']||null:null,'attributes':_0x358360[_0x1983('0x19')]?_0x358360['options'][_0x1983('0x20')]||null:null,'include':_0x358360[_0x1983('0x19')]?_0x358360[_0x1983('0x19')][_0x1983('0x1d')]?_[_0x1983('0x1e')](_0x358360[_0x1983('0x19')][_0x1983('0x1d')],function(_0x46a421){return{'model':db[_0x46a421[_0x1983('0x1f')]],'as':_0x46a421['as'],'attributes':_0x46a421[_0x1983('0x20')],'include':_0x46a421[_0x1983('0x1d')]?_['map'](_0x46a421[_0x1983('0x1d')],function(_0x4f4e26){return{'model':db[_0x4f4e26[_0x1983('0x1f')]],'as':_0x4f4e26['as'],'attributes':_0x4f4e26[_0x1983('0x20')],'include':_0x4f4e26[_0x1983('0x1d')]?_[_0x1983('0x1e')](_0x4f4e26[_0x1983('0x1d')],function(_0x1bd197){return{'model':db[_0x1bd197[_0x1983('0x1f')]],'as':_0x1bd197['as'],'attributes':_0x1bd197[_0x1983('0x20')]};}):[]};}):[]};}):[]:[]})[_0x1983('0xc')](function(_0x1fd08b){logger[_0x1983('0xd')](_0x1983('0x23'),_0x358360);logger[_0x1983('0x10')](_0x1983('0x23'),_0x358360,JSON['stringify'](_0x1fd08b));_0xc65434(_0x1fd08b);})[_0x1983('0x16')](function(_0xb50318){logger['error'](_0x1983('0x23'),_0xb50318[_0x1983('0x14')],_0x358360);_0x1c9213(_0x455302[_0x1983('0x13')](0x1f4,_0xb50318[_0x1983('0x14')]));});});}; \ No newline at end of file +var _0x31aa=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshdeskAccount,\x20%s,\x20%s','message','result','catch','GetFreshdeskAccount','FreshdeskAccount','options','raw','where','include','attributes','map','model','ShowFreshdeskAccount'];(function(_0x148acb,_0x2694f7){var _0x3b9378=function(_0x5bb255){while(--_0x5bb255){_0x148acb['push'](_0x148acb['shift']());}};_0x3b9378(++_0x2694f7);}(_0x31aa,0x198));var _0xa31a=function(_0x1c9de7,_0x725f35){_0x1c9de7=_0x1c9de7-0x0;var _0x506056=_0x31aa[_0x1c9de7];return _0x506056;};'use strict';var _=require('lodash');var util=require(_0xa31a('0x0'));var moment=require('moment');var BPromise=require(_0xa31a('0x1'));var rs=require(_0xa31a('0x2'));var fs=require('fs');var Redis=require(_0xa31a('0x3'));var db=require(_0xa31a('0x4'))['db'];var utils=require(_0xa31a('0x5'));var logger=require(_0xa31a('0x6'))(_0xa31a('0x7'));var config=require(_0xa31a('0x8'));var jayson=require(_0xa31a('0x9'));var client=jayson['client'][_0xa31a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41abce,_0x51e242,_0x228e15){return new BPromise(function(_0x3775c7,_0x1393e6){return client[_0xa31a('0xb')](_0x41abce,_0x228e15)[_0xa31a('0xc')](function(_0x50affc){logger[_0xa31a('0xd')]('FreshdeskAccount,\x20%s,\x20%s',_0x51e242,_0xa31a('0xe'));logger[_0xa31a('0xf')](_0xa31a('0x10'),_0x51e242,_0xa31a('0xe'),JSON[_0xa31a('0x11')](_0x50affc));if(_0x50affc[_0xa31a('0x12')]){if(_0x50affc['error'][_0xa31a('0x13')]===0x1f4){logger[_0xa31a('0x12')](_0xa31a('0x14'),_0x51e242,_0x50affc[_0xa31a('0x12')][_0xa31a('0x15')]);return _0x1393e6(_0x50affc[_0xa31a('0x12')][_0xa31a('0x15')]);}logger[_0xa31a('0x12')](_0xa31a('0x14'),_0x51e242,_0x50affc[_0xa31a('0x12')][_0xa31a('0x15')]);return _0x3775c7(_0x50affc[_0xa31a('0x12')][_0xa31a('0x15')]);}else{logger[_0xa31a('0xd')]('FreshdeskAccount,\x20%s,\x20%s',_0x51e242,'request\x20sent');_0x3775c7(_0x50affc[_0xa31a('0x16')]['message']);}})[_0xa31a('0x17')](function(_0x2bf483){logger[_0xa31a('0x12')](_0xa31a('0x14'),_0x51e242,_0x2bf483);_0x1393e6(_0x2bf483);});});}exports[_0xa31a('0x18')]=function(_0x1f9fd2){var _0x237525=this;return new Promise(function(_0x31ab54,_0x52d30c){return db[_0xa31a('0x19')]['findAll']({'raw':_0x1f9fd2['options']?_0x1f9fd2[_0xa31a('0x1a')][_0xa31a('0x1b')]===undefined?!![]:![]:!![],'where':_0x1f9fd2[_0xa31a('0x1a')]?_0x1f9fd2['options'][_0xa31a('0x1c')]||null:null,'attributes':_0x1f9fd2['options']?_0x1f9fd2['options']['attributes']||null:null,'limit':_0x1f9fd2['options']?_0x1f9fd2[_0xa31a('0x1a')]['limit']||null:null,'include':_0x1f9fd2[_0xa31a('0x1a')]?_0x1f9fd2[_0xa31a('0x1a')][_0xa31a('0x1d')]?_['map'](_0x1f9fd2[_0xa31a('0x1a')][_0xa31a('0x1d')],function(_0x1983a8){return{'model':db[_0x1983a8['model']],'as':_0x1983a8['as'],'attributes':_0x1983a8[_0xa31a('0x1e')],'include':_0x1983a8[_0xa31a('0x1d')]?_[_0xa31a('0x1f')](_0x1983a8['include'],function(_0x6d559){return{'model':db[_0x6d559[_0xa31a('0x20')]],'as':_0x6d559['as'],'attributes':_0x6d559[_0xa31a('0x1e')],'include':_0x6d559[_0xa31a('0x1d')]?_['map'](_0x6d559[_0xa31a('0x1d')],function(_0x1234a7){return{'model':db[_0x1234a7[_0xa31a('0x20')]],'as':_0x1234a7['as'],'attributes':_0x1234a7[_0xa31a('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x50171f){logger[_0xa31a('0xd')](_0xa31a('0x18'),_0x1f9fd2);logger[_0xa31a('0xf')](_0xa31a('0x18'),_0x1f9fd2,JSON[_0xa31a('0x11')](_0x50171f));_0x31ab54(_0x50171f);})['catch'](function(_0x482049){logger['error']('GetFreshdeskAccount',_0x482049[_0xa31a('0x15')],_0x1f9fd2);_0x52d30c(_0x237525[_0xa31a('0x12')](0x1f4,_0x482049['message']));});});};exports['ShowFreshdeskAccount']=function(_0x92f37e){var _0x451f1a=this;return new Promise(function(_0x244d24,_0x2d8397){return db[_0xa31a('0x19')]['find']({'raw':_0x92f37e[_0xa31a('0x1a')]?_0x92f37e[_0xa31a('0x1a')][_0xa31a('0x1b')]===undefined?!![]:![]:!![],'where':_0x92f37e[_0xa31a('0x1a')]?_0x92f37e['options'][_0xa31a('0x1c')]||null:null,'attributes':_0x92f37e[_0xa31a('0x1a')]?_0x92f37e[_0xa31a('0x1a')][_0xa31a('0x1e')]||null:null,'include':_0x92f37e[_0xa31a('0x1a')]?_0x92f37e[_0xa31a('0x1a')][_0xa31a('0x1d')]?_[_0xa31a('0x1f')](_0x92f37e[_0xa31a('0x1a')][_0xa31a('0x1d')],function(_0x166e04){return{'model':db[_0x166e04[_0xa31a('0x20')]],'as':_0x166e04['as'],'attributes':_0x166e04[_0xa31a('0x1e')],'include':_0x166e04['include']?_[_0xa31a('0x1f')](_0x166e04[_0xa31a('0x1d')],function(_0xb35590){return{'model':db[_0xb35590[_0xa31a('0x20')]],'as':_0xb35590['as'],'attributes':_0xb35590[_0xa31a('0x1e')],'include':_0xb35590[_0xa31a('0x1d')]?_[_0xa31a('0x1f')](_0xb35590[_0xa31a('0x1d')],function(_0x356186){return{'model':db[_0x356186[_0xa31a('0x20')]],'as':_0x356186['as'],'attributes':_0x356186[_0xa31a('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xa31a('0xc')](function(_0x25c2e6){logger[_0xa31a('0xd')](_0xa31a('0x21'),_0x92f37e);logger[_0xa31a('0xf')]('ShowFreshdeskAccount',_0x92f37e,JSON[_0xa31a('0x11')](_0x25c2e6));_0x244d24(_0x25c2e6);})[_0xa31a('0x17')](function(_0x3193fb){logger[_0xa31a('0x12')](_0xa31a('0x21'),_0x3193fb[_0xa31a('0x15')],_0x92f37e);_0x2d8397(_0x451f1a[_0xa31a('0x12')](0x1f4,_0x3193fb[_0xa31a('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index f090494..fe02e9e 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 _0x3db2=['show','/:id/fields','/:id/subjects','/:id/descriptions','/:id/tags','getTags','post','create','setTags','put','delete','/:id','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x528bb5,_0x119c5b){var _0x58e8ca=function(_0x5a8077){while(--_0x5a8077){_0x528bb5['push'](_0x528bb5['shift']());}};_0x58e8ca(++_0x119c5b);}(_0x3db2,0x15d));var _0x23db=function(_0x3edc8b,_0x1996cb){_0x3edc8b=_0x3edc8b-0x0;var _0xbf74e5=_0x3db2[_0x3edc8b];return _0xbf74e5;};'use strict';var multer=require(_0x23db('0x0'));var util=require(_0x23db('0x1'));var path=require(_0x23db('0x2'));var timeout=require(_0x23db('0x3'));var express=require('express');var router=express[_0x23db('0x4')]();var fs_extra=require(_0x23db('0x5'));var auth=require(_0x23db('0x6'));var interaction=require(_0x23db('0x7'));var config=require('../../config/environment');var controller=require('./intFreshdeskConfiguration.controller');router[_0x23db('0x8')]('/',auth[_0x23db('0x9')](),controller[_0x23db('0xa')]);router[_0x23db('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x23db('0xb')]);router['get'](_0x23db('0xc'),auth[_0x23db('0x9')](),controller['getFields']);router[_0x23db('0x8')](_0x23db('0xd'),auth[_0x23db('0x9')](),controller['getSubjects']);router[_0x23db('0x8')](_0x23db('0xe'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0x23db('0x8')](_0x23db('0xf'),auth[_0x23db('0x9')](),controller[_0x23db('0x10')]);router[_0x23db('0x11')]('/',auth[_0x23db('0x9')](),controller[_0x23db('0x12')]);router[_0x23db('0x11')]('/:id/tags',auth[_0x23db('0x9')](),controller[_0x23db('0x13')]);router[_0x23db('0x14')]('/:id',auth[_0x23db('0x9')](),controller['update']);router[_0x23db('0x15')](_0x23db('0x16'),auth[_0x23db('0x9')](),controller['destroy']);module[_0x23db('0x17')]=router; \ No newline at end of file +var _0x0ecd=['/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','/:id/tags','setTags','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','show'];(function(_0x1daebd,_0x79a89){var _0x462a89=function(_0x32f800){while(--_0x32f800){_0x1daebd['push'](_0x1daebd['shift']());}};_0x462a89(++_0x79a89);}(_0x0ecd,0x1f1));var _0xd0ec=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0ecd[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xd0ec('0x0'));var util=require(_0xd0ec('0x1'));var path=require(_0xd0ec('0x2'));var timeout=require(_0xd0ec('0x3'));var express=require(_0xd0ec('0x4'));var router=express[_0xd0ec('0x5')]();var fs_extra=require(_0xd0ec('0x6'));var auth=require(_0xd0ec('0x7'));var interaction=require(_0xd0ec('0x8'));var config=require(_0xd0ec('0x9'));var controller=require(_0xd0ec('0xa'));router[_0xd0ec('0xb')]('/',auth[_0xd0ec('0xc')](),controller[_0xd0ec('0xd')]);router[_0xd0ec('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xd0ec('0xe')]);router['get'](_0xd0ec('0xf'),auth[_0xd0ec('0xc')](),controller[_0xd0ec('0x10')]);router['get'](_0xd0ec('0x11'),auth[_0xd0ec('0xc')](),controller[_0xd0ec('0x12')]);router[_0xd0ec('0xb')](_0xd0ec('0x13'),auth[_0xd0ec('0xc')](),controller[_0xd0ec('0x14')]);router[_0xd0ec('0xb')]('/:id/tags',auth['isAuthenticated'](),controller[_0xd0ec('0x15')]);router[_0xd0ec('0x16')]('/',auth[_0xd0ec('0xc')](),controller[_0xd0ec('0x17')]);router[_0xd0ec('0x16')](_0xd0ec('0x18'),auth[_0xd0ec('0xc')](),controller[_0xd0ec('0x19')]);router[_0xd0ec('0x1a')](_0xd0ec('0x1b'),auth['isAuthenticated'](),controller[_0xd0ec('0x1c')]);router[_0xd0ec('0x1d')]('/:id',auth[_0xd0ec('0xc')](),controller[_0xd0ec('0x1e')]);module[_0xd0ec('0x1f')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 495ed08..8bf5101 100644 --- a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js +++ b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x188a=['exports','STRING','sequelize'];(function(_0x456b57,_0x58691a){var _0x18f49f=function(_0x1dc195){while(--_0x1dc195){_0x456b57['push'](_0x456b57['shift']());}};_0x18f49f(++_0x58691a);}(_0x188a,0x1c4));var _0xa188=function(_0x397cc4,_0x38251e){_0x397cc4=_0x397cc4-0x0;var _0x55b8be=_0x188a[_0x397cc4];return _0x55b8be;};'use strict';var Sequelize=require(_0xa188('0x0'));module[_0xa188('0x1')]={'name':{'type':Sequelize[_0xa188('0x2')]},'description':{'type':Sequelize[_0xa188('0x2')]}}; \ No newline at end of file +var _0x73e1=['exports','STRING','sequelize'];(function(_0x1c4558,_0x3b56c3){var _0x2fd667=function(_0x37966d){while(--_0x37966d){_0x1c4558['push'](_0x1c4558['shift']());}};_0x2fd667(++_0x3b56c3);}(_0x73e1,0xce));var _0x173e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x73e1[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x173e('0x0'));module[_0x173e('0x1')]={'name':{'type':Sequelize[_0x173e('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index e278a4c..330da29 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 _0xd47e=['VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','update','destroy','findOne','getFields','getSubjects','FreshdeskField','getDescriptions','Tag','getTags','ids','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','limit','undefined','count','Content-Range','reject','save','then','end','error','stack','name','send','index','map','FreshdeskConfiguration','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge'];(function(_0x42a778,_0x3cde9f){var _0x216581=function(_0x357948){while(--_0x357948){_0x42a778['push'](_0x42a778['shift']());}};_0x216581(++_0x3cde9f);}(_0xd47e,0x1aa));var _0xed47=function(_0x3ff57d,_0x2c85d4){_0x3ff57d=_0x3ff57d-0x0;var _0xa7bf40=_0xd47e[_0x3ff57d];return _0xa7bf40;};'use strict';var emlformat=require(_0xed47('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xed47('0x1'));var jsonpatch=require(_0xed47('0x2'));var rp=require(_0xed47('0x3'));var moment=require('moment');var BPromise=require(_0xed47('0x4'));var Mustache=require(_0xed47('0x5'));var util=require('util');var path=require(_0xed47('0x6'));var sox=require(_0xed47('0x7'));var csv=require(_0xed47('0x8'));var ejs=require(_0xed47('0x9'));var fs=require('fs');var fs_extra=require(_0xed47('0xa'));var _=require(_0xed47('0xb'));var squel=require(_0xed47('0xc'));var crypto=require('crypto');var jsforce=require(_0xed47('0xd'));var deskjs=require(_0xed47('0xe'));var toCsv=require(_0xed47('0x8'));var querystring=require(_0xed47('0xf'));var Papa=require(_0xed47('0x10'));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')(_0xed47('0x11'));var utils=require(_0xed47('0x12'));var config=require(_0xed47('0x13'));var licenseUtil=require(_0xed47('0x14'));var db=require(_0xed47('0x15'))['db'];function respondWithStatusCode(_0x4287f9,_0x4ab8c2){_0x4ab8c2=_0x4ab8c2||0xcc;return function(_0x324886){if(_0x324886){return _0x4287f9['sendStatus'](_0x4ab8c2);}return _0x4287f9[_0xed47('0x16')](_0x4ab8c2)['end']();};}function respondWithResult(_0x1dd718,_0xd486c3){_0xd486c3=_0xd486c3||0xc8;return function(_0x7a93e3){if(_0x7a93e3){return _0x1dd718[_0xed47('0x16')](_0xd486c3)[_0xed47('0x17')](_0x7a93e3);}};}function respondWithFilteredResult(_0x2a892f,_0x1a321a){return function(_0x449765){if(_0x449765){var _0x3e4295=typeof _0x1a321a[_0xed47('0x18')]==='undefined'&&typeof _0x1a321a[_0xed47('0x19')]===_0xed47('0x1a');var _0x1d9f45=_0x449765[_0xed47('0x1b')];var _0x15fb8c=_0x3e4295?0x0:_0x1a321a[_0xed47('0x18')];var _0x2671b4=_0x3e4295?_0x449765[_0xed47('0x1b')]:_0x1a321a['offset']+_0x1a321a[_0xed47('0x19')];var _0xb6a228;if(_0x2671b4>=_0x1d9f45){_0x2671b4=_0x1d9f45;_0xb6a228=0xc8;}else{_0xb6a228=0xce;}_0x2a892f[_0xed47('0x16')](_0xb6a228);return _0x2a892f['set'](_0xed47('0x1c'),_0x15fb8c+'-'+_0x2671b4+'/'+_0x1d9f45)[_0xed47('0x17')](_0x449765);}return null;};}function patchUpdates(_0x4fdc76){return function(_0x572d17){try{jsonpatch['apply'](_0x572d17,_0x4fdc76,!![]);}catch(_0x3ac143){return BPromise[_0xed47('0x1d')](_0x3ac143);}return _0x572d17[_0xed47('0x1e')]();};}function saveUpdates(_0x487585,_0x57d0a6){return function(_0x115f3b){if(_0x115f3b){return _0x115f3b['update'](_0x487585)[_0xed47('0x1f')](function(_0x3cbe39){return _0x3cbe39;});}return null;};}function removeEntity(_0x45b0ee,_0x5bc366){return function(_0x5cea66){if(_0x5cea66){return _0x5cea66['destroy']()['then'](function(){_0x45b0ee[_0xed47('0x16')](0xcc)[_0xed47('0x20')]();});}};}function handleEntityNotFound(_0x430120,_0x193ac4){return function(_0x114e1b){if(!_0x114e1b){_0x430120['sendStatus'](0x194);}return _0x114e1b;};}function handleError(_0x4d846c,_0x40f4fa){_0x40f4fa=_0x40f4fa||0x1f4;return function(_0x10a5f6){logger[_0xed47('0x21')](_0x10a5f6[_0xed47('0x22')]);if(_0x10a5f6[_0xed47('0x23')]){delete _0x10a5f6[_0xed47('0x23')];}_0x4d846c[_0xed47('0x16')](_0x40f4fa)[_0xed47('0x24')](_0x10a5f6);};}exports[_0xed47('0x25')]=function(_0x52866e,_0x22bb73){var _0x3d3f63={},_0x2b542b={},_0x555d6a={'count':0x0,'rows':[]};var _0x3c1014=_[_0xed47('0x26')](db[_0xed47('0x27')][_0xed47('0x28')],function(_0x1f6965){return{'name':_0x1f6965[_0xed47('0x29')],'type':_0x1f6965[_0xed47('0x2a')][_0xed47('0x2b')]};});_0x2b542b[_0xed47('0x2c')]=_[_0xed47('0x26')](_0x3c1014,_0xed47('0x23'));_0x2b542b['query']=_[_0xed47('0x2d')](_0x52866e[_0xed47('0x2e')]);_0x2b542b[_0xed47('0x2f')]=_[_0xed47('0x30')](_0x2b542b['model'],_0x2b542b[_0xed47('0x2e')]);_0x3d3f63[_0xed47('0x31')]=_['intersection'](_0x2b542b[_0xed47('0x2c')],qs[_0xed47('0x32')](_0x52866e[_0xed47('0x2e')][_0xed47('0x32')]));_0x3d3f63[_0xed47('0x31')]=_0x3d3f63[_0xed47('0x31')][_0xed47('0x33')]?_0x3d3f63[_0xed47('0x31')]:_0x2b542b[_0xed47('0x2c')];if(!_0x52866e['query'][_0xed47('0x34')](_0xed47('0x35'))){_0x3d3f63[_0xed47('0x19')]=qs[_0xed47('0x19')](_0x52866e['query'][_0xed47('0x19')]);_0x3d3f63[_0xed47('0x18')]=qs[_0xed47('0x18')](_0x52866e[_0xed47('0x2e')][_0xed47('0x18')]);}_0x3d3f63[_0xed47('0x36')]=qs[_0xed47('0x37')](_0x52866e[_0xed47('0x2e')][_0xed47('0x37')]);_0x3d3f63[_0xed47('0x38')]=qs[_0xed47('0x2f')](_[_0xed47('0x39')](_0x52866e[_0xed47('0x2e')],_0x2b542b[_0xed47('0x2f')]),_0x3c1014);if(_0x52866e[_0xed47('0x2e')][_0xed47('0x3a')]){_0x3d3f63['where']=_[_0xed47('0x3b')](_0x3d3f63[_0xed47('0x38')],{'$or':_[_0xed47('0x26')](_0x3c1014,function(_0x3eb3aa){if(_0x3eb3aa[_0xed47('0x2a')]!==_0xed47('0x3c')){var _0x562b36={};_0x562b36[_0x3eb3aa['name']]={'$like':'%'+_0x52866e[_0xed47('0x2e')][_0xed47('0x3a')]+'%'};return _0x562b36;}})});}_0x3d3f63=_['merge']({},_0x3d3f63,_0x52866e[_0xed47('0x3d')]);var _0xce9f62={'where':_0x3d3f63[_0xed47('0x38')]};return db[_0xed47('0x27')][_0xed47('0x1b')](_0xce9f62)['then'](function(_0x12d6ee){_0x555d6a[_0xed47('0x1b')]=_0x12d6ee;if(_0x52866e[_0xed47('0x2e')][_0xed47('0x3e')]){_0x3d3f63[_0xed47('0x3f')]=[{'all':!![]}];}return db[_0xed47('0x27')]['findAll'](_0x3d3f63);})[_0xed47('0x1f')](function(_0x1004cc){_0x555d6a[_0xed47('0x40')]=_0x1004cc;return _0x555d6a;})['then'](respondWithFilteredResult(_0x22bb73,_0x3d3f63))[_0xed47('0x41')](handleError(_0x22bb73,null));};exports[_0xed47('0x42')]=function(_0xad4541,_0x26f706){var _0x2e805c={'raw':![],'where':{'id':_0xad4541[_0xed47('0x43')]['id']}},_0x54b2c0={};_0x54b2c0[_0xed47('0x2c')]=_[_0xed47('0x2d')](db['FreshdeskConfiguration']['rawAttributes']);_0x54b2c0[_0xed47('0x2e')]=_[_0xed47('0x2d')](_0xad4541[_0xed47('0x2e')]);_0x54b2c0[_0xed47('0x2f')]=_['intersection'](_0x54b2c0[_0xed47('0x2c')],_0x54b2c0[_0xed47('0x2e')]);_0x2e805c[_0xed47('0x31')]=_['intersection'](_0x54b2c0[_0xed47('0x2c')],qs[_0xed47('0x32')](_0xad4541['query'][_0xed47('0x32')]));_0x2e805c[_0xed47('0x31')]=_0x2e805c[_0xed47('0x31')]['length']?_0x2e805c['attributes']:_0x54b2c0[_0xed47('0x2c')];if(_0xad4541['query']['includeAll']){_0x2e805c[_0xed47('0x3f')]=[{'all':!![]}];}_0x2e805c=_[_0xed47('0x3b')]({},_0x2e805c,_0xad4541[_0xed47('0x3d')]);return db[_0xed47('0x27')][_0xed47('0x44')](_0x2e805c)[_0xed47('0x1f')](handleEntityNotFound(_0x26f706,null))[_0xed47('0x1f')](respondWithResult(_0x26f706,null))[_0xed47('0x41')](handleError(_0x26f706,null));};exports[_0xed47('0x45')]=function(_0x57404a,_0x1d79f8){return db['FreshdeskConfiguration'][_0xed47('0x45')](_0x57404a[_0xed47('0x46')],{})[_0xed47('0x1f')](respondWithResult(_0x1d79f8,0xc9))[_0xed47('0x41')](handleError(_0x1d79f8,null));};exports[_0xed47('0x47')]=function(_0x5c15e2,_0x1a9a3c){if(_0x5c15e2[_0xed47('0x46')]['id']){delete _0x5c15e2[_0xed47('0x46')]['id'];}return db[_0xed47('0x27')][_0xed47('0x44')]({'where':{'id':_0x5c15e2[_0xed47('0x43')]['id']}})[_0xed47('0x1f')](handleEntityNotFound(_0x1a9a3c,null))[_0xed47('0x1f')](saveUpdates(_0x5c15e2[_0xed47('0x46')],null))[_0xed47('0x1f')](respondWithResult(_0x1a9a3c,null))[_0xed47('0x41')](handleError(_0x1a9a3c,null));};exports[_0xed47('0x48')]=function(_0x5f16d0,_0x5880d6){return db['FreshdeskConfiguration'][_0xed47('0x44')]({'where':{'id':_0x5f16d0[_0xed47('0x43')]['id']}})[_0xed47('0x1f')](handleEntityNotFound(_0x5880d6,null))[_0xed47('0x1f')](removeEntity(_0x5880d6,null))[_0xed47('0x41')](handleError(_0x5880d6,null));};exports['getFields']=function(_0x17a0cf,_0x31c44c,_0x3d8d51){var _0x2a1357={};var _0x5327a6={};var _0x4a0bf1;var _0x49b669;return db[_0xed47('0x27')][_0xed47('0x49')]({'where':{'id':_0x17a0cf[_0xed47('0x43')]['id']}})[_0xed47('0x1f')](handleEntityNotFound(_0x31c44c,null))[_0xed47('0x1f')](function(_0x1057d4){if(_0x1057d4){_0x4a0bf1=_0x1057d4;_0x5327a6['model']=_[_0xed47('0x2d')](db['FreshdeskField'][_0xed47('0x28')]);_0x5327a6['query']=_[_0xed47('0x2d')](_0x17a0cf[_0xed47('0x2e')]);_0x5327a6[_0xed47('0x2f')]=_[_0xed47('0x30')](_0x5327a6[_0xed47('0x2c')],_0x5327a6[_0xed47('0x2e')]);_0x2a1357[_0xed47('0x31')]=_[_0xed47('0x30')](_0x5327a6[_0xed47('0x2c')],qs['fields'](_0x17a0cf[_0xed47('0x2e')][_0xed47('0x32')]));_0x2a1357['attributes']=_0x2a1357[_0xed47('0x31')][_0xed47('0x33')]?_0x2a1357[_0xed47('0x31')]:_0x5327a6[_0xed47('0x2c')];_0x2a1357[_0xed47('0x36')]=qs[_0xed47('0x37')](_0x17a0cf['query'][_0xed47('0x37')]);_0x2a1357[_0xed47('0x38')]=qs[_0xed47('0x2f')](_[_0xed47('0x39')](_0x17a0cf[_0xed47('0x2e')],_0x5327a6[_0xed47('0x2f')]));if(_0x17a0cf[_0xed47('0x2e')]['filter']){_0x2a1357[_0xed47('0x38')]=_[_0xed47('0x3b')](_0x2a1357[_0xed47('0x38')],{'$or':_[_0xed47('0x26')](_0x2a1357[_0xed47('0x31')],function(_0x4fde96){var _0x4a0751={};_0x4a0751[_0x4fde96]={'$like':'%'+_0x17a0cf['query'][_0xed47('0x3a')]+'%'};return _0x4a0751;})});}_0x2a1357=_[_0xed47('0x3b')]({},_0x2a1357,_0x17a0cf[_0xed47('0x3d')]);return _0x4a0bf1['getFields'](_0x2a1357);}})[_0xed47('0x1f')](function(_0xe04195){if(_0xe04195){_0x49b669=_0xe04195[_0xed47('0x33')];if(!_0x17a0cf[_0xed47('0x2e')][_0xed47('0x34')](_0xed47('0x35'))){_0x2a1357[_0xed47('0x19')]=qs[_0xed47('0x19')](_0x17a0cf[_0xed47('0x2e')][_0xed47('0x19')]);_0x2a1357[_0xed47('0x18')]=qs[_0xed47('0x18')](_0x17a0cf[_0xed47('0x2e')]['offset']);}return _0x4a0bf1[_0xed47('0x4a')](_0x2a1357);}})[_0xed47('0x1f')](function(_0x1daf90){if(_0x1daf90){return _0x1daf90?{'count':_0x49b669,'rows':_0x1daf90}:null;}})[_0xed47('0x1f')](respondWithResult(_0x31c44c,null))[_0xed47('0x41')](handleError(_0x31c44c,null));};exports[_0xed47('0x4b')]=function(_0x1d7afb,_0x33c306,_0x1b0aaf){var _0x30e942={};var _0x51e5db={};var _0x325323;var _0x2b4910;return db['FreshdeskConfiguration'][_0xed47('0x49')]({'where':{'id':_0x1d7afb[_0xed47('0x43')]['id']}})['then'](handleEntityNotFound(_0x33c306,null))[_0xed47('0x1f')](function(_0x1d7376){if(_0x1d7376){_0x325323=_0x1d7376;_0x51e5db['model']=_['keys'](db[_0xed47('0x4c')]['rawAttributes']);_0x51e5db[_0xed47('0x2e')]=_[_0xed47('0x2d')](_0x1d7afb[_0xed47('0x2e')]);_0x51e5db[_0xed47('0x2f')]=_[_0xed47('0x30')](_0x51e5db[_0xed47('0x2c')],_0x51e5db[_0xed47('0x2e')]);_0x30e942[_0xed47('0x31')]=_['intersection'](_0x51e5db[_0xed47('0x2c')],qs[_0xed47('0x32')](_0x1d7afb[_0xed47('0x2e')][_0xed47('0x32')]));_0x30e942[_0xed47('0x31')]=_0x30e942[_0xed47('0x31')][_0xed47('0x33')]?_0x30e942[_0xed47('0x31')]:_0x51e5db[_0xed47('0x2c')];_0x30e942[_0xed47('0x36')]=qs[_0xed47('0x37')](_0x1d7afb['query'][_0xed47('0x37')]);_0x30e942['where']=qs['filters'](_[_0xed47('0x39')](_0x1d7afb['query'],_0x51e5db['filters']));if(_0x1d7afb[_0xed47('0x2e')][_0xed47('0x3a')]){_0x30e942['where']=_[_0xed47('0x3b')](_0x30e942[_0xed47('0x38')],{'$or':_['map'](_0x30e942['attributes'],function(_0x5d8da3){var _0xbed2fe={};_0xbed2fe[_0x5d8da3]={'$like':'%'+_0x1d7afb['query'][_0xed47('0x3a')]+'%'};return _0xbed2fe;})});}_0x30e942=_['merge']({},_0x30e942,_0x1d7afb[_0xed47('0x3d')]);return _0x325323[_0xed47('0x4b')](_0x30e942);}})[_0xed47('0x1f')](function(_0x2a1cfb){if(_0x2a1cfb){_0x2b4910=_0x2a1cfb[_0xed47('0x33')];if(!_0x1d7afb[_0xed47('0x2e')][_0xed47('0x34')](_0xed47('0x35'))){_0x30e942[_0xed47('0x19')]=qs[_0xed47('0x19')](_0x1d7afb[_0xed47('0x2e')][_0xed47('0x19')]);_0x30e942[_0xed47('0x18')]=qs[_0xed47('0x18')](_0x1d7afb['query']['offset']);}return _0x325323[_0xed47('0x4b')](_0x30e942);}})[_0xed47('0x1f')](function(_0x2c9237){if(_0x2c9237){return _0x2c9237?{'count':_0x2b4910,'rows':_0x2c9237}:null;}})[_0xed47('0x1f')](respondWithResult(_0x33c306,null))[_0xed47('0x41')](handleError(_0x33c306,null));};exports['getDescriptions']=function(_0x39f2c1,_0x2cf55b,_0x3e782d){var _0x58829e={};var _0x2b35e0={};var _0x24053b;var _0x2cd323;return db['FreshdeskConfiguration'][_0xed47('0x49')]({'where':{'id':_0x39f2c1[_0xed47('0x43')]['id']}})['then'](handleEntityNotFound(_0x2cf55b,null))[_0xed47('0x1f')](function(_0x1b4aa2){if(_0x1b4aa2){_0x24053b=_0x1b4aa2;_0x2b35e0['model']=_[_0xed47('0x2d')](db[_0xed47('0x4c')][_0xed47('0x28')]);_0x2b35e0['query']=_[_0xed47('0x2d')](_0x39f2c1[_0xed47('0x2e')]);_0x2b35e0[_0xed47('0x2f')]=_[_0xed47('0x30')](_0x2b35e0['model'],_0x2b35e0[_0xed47('0x2e')]);_0x58829e[_0xed47('0x31')]=_[_0xed47('0x30')](_0x2b35e0['model'],qs[_0xed47('0x32')](_0x39f2c1['query']['fields']));_0x58829e[_0xed47('0x31')]=_0x58829e[_0xed47('0x31')][_0xed47('0x33')]?_0x58829e[_0xed47('0x31')]:_0x2b35e0[_0xed47('0x2c')];_0x58829e[_0xed47('0x36')]=qs[_0xed47('0x37')](_0x39f2c1['query']['sort']);_0x58829e[_0xed47('0x38')]=qs[_0xed47('0x2f')](_[_0xed47('0x39')](_0x39f2c1[_0xed47('0x2e')],_0x2b35e0['filters']));if(_0x39f2c1[_0xed47('0x2e')][_0xed47('0x3a')]){_0x58829e[_0xed47('0x38')]=_[_0xed47('0x3b')](_0x58829e[_0xed47('0x38')],{'$or':_[_0xed47('0x26')](_0x58829e[_0xed47('0x31')],function(_0x343161){var _0xc4da0c={};_0xc4da0c[_0x343161]={'$like':'%'+_0x39f2c1['query'][_0xed47('0x3a')]+'%'};return _0xc4da0c;})});}_0x58829e=_[_0xed47('0x3b')]({},_0x58829e,_0x39f2c1['options']);return _0x24053b[_0xed47('0x4d')](_0x58829e);}})[_0xed47('0x1f')](function(_0x2bad52){if(_0x2bad52){_0x2cd323=_0x2bad52[_0xed47('0x33')];if(!_0x39f2c1[_0xed47('0x2e')][_0xed47('0x34')](_0xed47('0x35'))){_0x58829e[_0xed47('0x19')]=qs['limit'](_0x39f2c1[_0xed47('0x2e')]['limit']);_0x58829e[_0xed47('0x18')]=qs['offset'](_0x39f2c1[_0xed47('0x2e')]['offset']);}return _0x24053b[_0xed47('0x4d')](_0x58829e);}})[_0xed47('0x1f')](function(_0x1c6e0e){if(_0x1c6e0e){return _0x1c6e0e?{'count':_0x2cd323,'rows':_0x1c6e0e}:null;}})[_0xed47('0x1f')](respondWithResult(_0x2cf55b,null))[_0xed47('0x41')](handleError(_0x2cf55b,null));};exports['getTags']=function(_0x5c6911,_0x3d2a8c,_0x182a01){var _0x2bfcb2={};var _0x2578ee={};var _0x3120c4;var _0x22f5f6;return db[_0xed47('0x27')][_0xed47('0x49')]({'where':{'id':_0x5c6911['params']['id']}})[_0xed47('0x1f')](handleEntityNotFound(_0x3d2a8c,null))[_0xed47('0x1f')](function(_0x259f63){if(_0x259f63){_0x3120c4=_0x259f63;_0x2578ee[_0xed47('0x2c')]=_[_0xed47('0x2d')](db[_0xed47('0x4e')][_0xed47('0x28')]);_0x2578ee[_0xed47('0x2e')]=_['keys'](_0x5c6911[_0xed47('0x2e')]);_0x2578ee['filters']=_[_0xed47('0x30')](_0x2578ee[_0xed47('0x2c')],_0x2578ee['query']);_0x2bfcb2['attributes']=_['intersection'](_0x2578ee[_0xed47('0x2c')],qs[_0xed47('0x32')](_0x5c6911[_0xed47('0x2e')]['fields']));_0x2bfcb2[_0xed47('0x31')]=_0x2bfcb2['attributes'][_0xed47('0x33')]?_0x2bfcb2[_0xed47('0x31')]:_0x2578ee[_0xed47('0x2c')];_0x2bfcb2['order']=qs[_0xed47('0x37')](_0x5c6911[_0xed47('0x2e')]['sort']);_0x2bfcb2['where']=qs['filters'](_[_0xed47('0x39')](_0x5c6911[_0xed47('0x2e')],_0x2578ee[_0xed47('0x2f')]));if(_0x5c6911['query'][_0xed47('0x3a')]){_0x2bfcb2[_0xed47('0x38')]=_['merge'](_0x2bfcb2['where'],{'$or':_[_0xed47('0x26')](_0x2bfcb2[_0xed47('0x31')],function(_0x5cb7e8){var _0x527491={};_0x527491[_0x5cb7e8]={'$like':'%'+_0x5c6911['query'][_0xed47('0x3a')]+'%'};return _0x527491;})});}_0x2bfcb2=_[_0xed47('0x3b')]({},_0x2bfcb2,_0x5c6911[_0xed47('0x3d')]);return _0x3120c4[_0xed47('0x4f')](_0x2bfcb2);}})[_0xed47('0x1f')](function(_0x5556bb){if(_0x5556bb){_0x22f5f6=_0x5556bb[_0xed47('0x33')];if(!_0x5c6911[_0xed47('0x2e')][_0xed47('0x34')](_0xed47('0x35'))){_0x2bfcb2['limit']=qs['limit'](_0x5c6911[_0xed47('0x2e')][_0xed47('0x19')]);_0x2bfcb2[_0xed47('0x18')]=qs[_0xed47('0x18')](_0x5c6911[_0xed47('0x2e')][_0xed47('0x18')]);}return _0x3120c4[_0xed47('0x4f')](_0x2bfcb2);}})[_0xed47('0x1f')](function(_0x1936cd){if(_0x1936cd){return _0x1936cd?{'count':_0x22f5f6,'rows':_0x1936cd}:null;}})[_0xed47('0x1f')](respondWithResult(_0x3d2a8c,null))[_0xed47('0x41')](handleError(_0x3d2a8c,null));};exports['setTags']=function(_0x3d8c85,_0x43a4cb,_0x3855fe){if(_0x3d8c85['body']['id']){delete _0x3d8c85['body']['id'];}return db[_0xed47('0x27')][_0xed47('0x49')]({'where':{'id':_0x3d8c85[_0xed47('0x43')]['id']}})['then'](handleEntityNotFound(_0x43a4cb,null))[_0xed47('0x1f')](function(_0x46e34a){if(_0x46e34a){return _0x46e34a['setTags'](_0x3d8c85[_0xed47('0x46')][_0xed47('0x50')]||[]);}return null;})['then'](respondWithResult(_0x43a4cb,null))[_0xed47('0x41')](handleError(_0x43a4cb,null));}; \ No newline at end of file +var _0x5a39=['bluebird','mustache','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','count','set','json','apply','reject','update','then','destroy','end','error','stack','name','send','index','map','FreshdeskConfiguration','rawAttributes','type','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','keys','find','create','body','getFields','findOne','FreshdeskField','order','getSubjects','getDescriptions','getTags','Tag','setTags','ids','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x3a814f,_0x553e5b){var _0x150de1=function(_0x162bed){while(--_0x162bed){_0x3a814f['push'](_0x3a814f['shift']());}};_0x150de1(++_0x553e5b);}(_0x5a39,0x13b));var _0x95a3=function(_0x45554b,_0x58161e){_0x45554b=_0x45554b-0x0;var _0x244d85=_0x5a39[_0x45554b];return _0x244d85;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x95a3('0x0'));var zipdir=require(_0x95a3('0x1'));var jsonpatch=require(_0x95a3('0x2'));var rp=require(_0x95a3('0x3'));var moment=require(_0x95a3('0x4'));var BPromise=require(_0x95a3('0x5'));var Mustache=require(_0x95a3('0x6'));var util=require('util');var path=require('path');var sox=require(_0x95a3('0x7'));var csv=require(_0x95a3('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x95a3('0x9'));var squel=require('squel');var crypto=require(_0x95a3('0xa'));var jsforce=require(_0x95a3('0xb'));var deskjs=require(_0x95a3('0xc'));var toCsv=require('to-csv');var querystring=require(_0x95a3('0xd'));var Papa=require(_0x95a3('0xe'));var Redis=require(_0x95a3('0xf'));var authService=require(_0x95a3('0x10'));var qs=require(_0x95a3('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x95a3('0x12'))(_0x95a3('0x13'));var utils=require(_0x95a3('0x14'));var config=require(_0x95a3('0x15'));var licenseUtil=require(_0x95a3('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x99daf4,_0x5ef4da){_0x5ef4da=_0x5ef4da||0xcc;return function(_0x308702){if(_0x308702){return _0x99daf4[_0x95a3('0x17')](_0x5ef4da);}return _0x99daf4[_0x95a3('0x18')](_0x5ef4da)['end']();};}function respondWithResult(_0x335abc,_0x384b2c){_0x384b2c=_0x384b2c||0xc8;return function(_0x3c4a58){if(_0x3c4a58){return _0x335abc[_0x95a3('0x18')](_0x384b2c)['json'](_0x3c4a58);}};}function respondWithFilteredResult(_0x16cea9,_0x5898a5){return function(_0x155bf3){if(_0x155bf3){var _0x583923=typeof _0x5898a5[_0x95a3('0x19')]==='undefined'&&typeof _0x5898a5['limit']==='undefined';var _0x4a21db=_0x155bf3[_0x95a3('0x1a')];var _0x29d55f=_0x583923?0x0:_0x5898a5[_0x95a3('0x19')];var _0x1ab114=_0x583923?_0x155bf3[_0x95a3('0x1a')]:_0x5898a5[_0x95a3('0x19')]+_0x5898a5['limit'];var _0x4bc9de;if(_0x1ab114>=_0x4a21db){_0x1ab114=_0x4a21db;_0x4bc9de=0xc8;}else{_0x4bc9de=0xce;}_0x16cea9[_0x95a3('0x18')](_0x4bc9de);return _0x16cea9[_0x95a3('0x1b')]('Content-Range',_0x29d55f+'-'+_0x1ab114+'/'+_0x4a21db)[_0x95a3('0x1c')](_0x155bf3);}return null;};}function patchUpdates(_0x242a26){return function(_0x5423ac){try{jsonpatch[_0x95a3('0x1d')](_0x5423ac,_0x242a26,!![]);}catch(_0x50e179){return BPromise[_0x95a3('0x1e')](_0x50e179);}return _0x5423ac['save']();};}function saveUpdates(_0xcc781b,_0x13b5b0){return function(_0x238633){if(_0x238633){return _0x238633[_0x95a3('0x1f')](_0xcc781b)[_0x95a3('0x20')](function(_0x39ec17){return _0x39ec17;});}return null;};}function removeEntity(_0x52bd97,_0x24fa59){return function(_0x533b6c){if(_0x533b6c){return _0x533b6c[_0x95a3('0x21')]()[_0x95a3('0x20')](function(){_0x52bd97[_0x95a3('0x18')](0xcc)[_0x95a3('0x22')]();});}};}function handleEntityNotFound(_0x17f2af,_0x4b835c){return function(_0x20101d){if(!_0x20101d){_0x17f2af[_0x95a3('0x17')](0x194);}return _0x20101d;};}function handleError(_0x2a210f,_0x3e68e2){_0x3e68e2=_0x3e68e2||0x1f4;return function(_0x3f94aa){logger[_0x95a3('0x23')](_0x3f94aa[_0x95a3('0x24')]);if(_0x3f94aa[_0x95a3('0x25')]){delete _0x3f94aa['name'];}_0x2a210f['status'](_0x3e68e2)[_0x95a3('0x26')](_0x3f94aa);};}exports[_0x95a3('0x27')]=function(_0x2803d4,_0x45c3ef){var _0x47f204={},_0x5493c1={},_0x345db7={'count':0x0,'rows':[]};var _0x56021a=_[_0x95a3('0x28')](db[_0x95a3('0x29')][_0x95a3('0x2a')],function(_0x18dbd3){return{'name':_0x18dbd3['fieldName'],'type':_0x18dbd3[_0x95a3('0x2b')]['key']};});_0x5493c1[_0x95a3('0x2c')]=_[_0x95a3('0x28')](_0x56021a,'name');_0x5493c1['query']=_['keys'](_0x2803d4[_0x95a3('0x2d')]);_0x5493c1['filters']=_[_0x95a3('0x2e')](_0x5493c1[_0x95a3('0x2c')],_0x5493c1[_0x95a3('0x2d')]);_0x47f204[_0x95a3('0x2f')]=_[_0x95a3('0x2e')](_0x5493c1['model'],qs['fields'](_0x2803d4[_0x95a3('0x2d')][_0x95a3('0x30')]));_0x47f204[_0x95a3('0x2f')]=_0x47f204[_0x95a3('0x2f')][_0x95a3('0x31')]?_0x47f204[_0x95a3('0x2f')]:_0x5493c1[_0x95a3('0x2c')];if(!_0x2803d4[_0x95a3('0x2d')][_0x95a3('0x32')](_0x95a3('0x33'))){_0x47f204[_0x95a3('0x34')]=qs[_0x95a3('0x34')](_0x2803d4['query']['limit']);_0x47f204[_0x95a3('0x19')]=qs[_0x95a3('0x19')](_0x2803d4['query'][_0x95a3('0x19')]);}_0x47f204['order']=qs[_0x95a3('0x35')](_0x2803d4[_0x95a3('0x2d')][_0x95a3('0x35')]);_0x47f204[_0x95a3('0x36')]=qs[_0x95a3('0x37')](_[_0x95a3('0x38')](_0x2803d4[_0x95a3('0x2d')],_0x5493c1[_0x95a3('0x37')]),_0x56021a);if(_0x2803d4[_0x95a3('0x2d')][_0x95a3('0x39')]){_0x47f204[_0x95a3('0x36')]=_[_0x95a3('0x3a')](_0x47f204[_0x95a3('0x36')],{'$or':_[_0x95a3('0x28')](_0x56021a,function(_0x5b7236){if(_0x5b7236[_0x95a3('0x2b')]!=='VIRTUAL'){var _0x25c7a6={};_0x25c7a6[_0x5b7236[_0x95a3('0x25')]]={'$like':'%'+_0x2803d4[_0x95a3('0x2d')][_0x95a3('0x39')]+'%'};return _0x25c7a6;}})});}_0x47f204=_[_0x95a3('0x3a')]({},_0x47f204,_0x2803d4[_0x95a3('0x3b')]);var _0x13dedf={'where':_0x47f204[_0x95a3('0x36')]};return db[_0x95a3('0x29')][_0x95a3('0x1a')](_0x13dedf)[_0x95a3('0x20')](function(_0x20ac29){_0x345db7[_0x95a3('0x1a')]=_0x20ac29;if(_0x2803d4[_0x95a3('0x2d')][_0x95a3('0x3c')]){_0x47f204[_0x95a3('0x3d')]=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0x95a3('0x3e')](_0x47f204);})[_0x95a3('0x20')](function(_0x4a6a22){_0x345db7['rows']=_0x4a6a22;return _0x345db7;})[_0x95a3('0x20')](respondWithFilteredResult(_0x45c3ef,_0x47f204))[_0x95a3('0x3f')](handleError(_0x45c3ef,null));};exports[_0x95a3('0x40')]=function(_0x18215b,_0x90ba91){var _0x1c5235={'raw':![],'where':{'id':_0x18215b[_0x95a3('0x41')]['id']}},_0xcbf8e0={};_0xcbf8e0[_0x95a3('0x2c')]=_['keys'](db[_0x95a3('0x29')]['rawAttributes']);_0xcbf8e0[_0x95a3('0x2d')]=_[_0x95a3('0x42')](_0x18215b[_0x95a3('0x2d')]);_0xcbf8e0[_0x95a3('0x37')]=_[_0x95a3('0x2e')](_0xcbf8e0[_0x95a3('0x2c')],_0xcbf8e0[_0x95a3('0x2d')]);_0x1c5235['attributes']=_['intersection'](_0xcbf8e0['model'],qs[_0x95a3('0x30')](_0x18215b['query'][_0x95a3('0x30')]));_0x1c5235[_0x95a3('0x2f')]=_0x1c5235[_0x95a3('0x2f')][_0x95a3('0x31')]?_0x1c5235[_0x95a3('0x2f')]:_0xcbf8e0[_0x95a3('0x2c')];if(_0x18215b['query'][_0x95a3('0x3c')]){_0x1c5235['include']=[{'all':!![]}];}_0x1c5235=_['merge']({},_0x1c5235,_0x18215b[_0x95a3('0x3b')]);return db[_0x95a3('0x29')][_0x95a3('0x43')](_0x1c5235)[_0x95a3('0x20')](handleEntityNotFound(_0x90ba91,null))['then'](respondWithResult(_0x90ba91,null))['catch'](handleError(_0x90ba91,null));};exports[_0x95a3('0x44')]=function(_0x522144,_0x15fc0b){return db['FreshdeskConfiguration'][_0x95a3('0x44')](_0x522144[_0x95a3('0x45')],{})[_0x95a3('0x20')](respondWithResult(_0x15fc0b,0xc9))[_0x95a3('0x3f')](handleError(_0x15fc0b,null));};exports[_0x95a3('0x1f')]=function(_0x273764,_0x382f89){if(_0x273764[_0x95a3('0x45')]['id']){delete _0x273764[_0x95a3('0x45')]['id'];}return db[_0x95a3('0x29')][_0x95a3('0x43')]({'where':{'id':_0x273764[_0x95a3('0x41')]['id']}})['then'](handleEntityNotFound(_0x382f89,null))['then'](saveUpdates(_0x273764[_0x95a3('0x45')],null))['then'](respondWithResult(_0x382f89,null))[_0x95a3('0x3f')](handleError(_0x382f89,null));};exports[_0x95a3('0x21')]=function(_0x65f738,_0x2e9670){return db[_0x95a3('0x29')][_0x95a3('0x43')]({'where':{'id':_0x65f738['params']['id']}})[_0x95a3('0x20')](handleEntityNotFound(_0x2e9670,null))['then'](removeEntity(_0x2e9670,null))[_0x95a3('0x3f')](handleError(_0x2e9670,null));};exports[_0x95a3('0x46')]=function(_0x213c8b,_0x4c587,_0x258df8){var _0x3f9a2b={};var _0x2bd468={};var _0x22412c;var _0x4fa9f9;return db['FreshdeskConfiguration'][_0x95a3('0x47')]({'where':{'id':_0x213c8b['params']['id']}})[_0x95a3('0x20')](handleEntityNotFound(_0x4c587,null))[_0x95a3('0x20')](function(_0x200723){if(_0x200723){_0x22412c=_0x200723;_0x2bd468[_0x95a3('0x2c')]=_[_0x95a3('0x42')](db[_0x95a3('0x48')][_0x95a3('0x2a')]);_0x2bd468[_0x95a3('0x2d')]=_[_0x95a3('0x42')](_0x213c8b[_0x95a3('0x2d')]);_0x2bd468[_0x95a3('0x37')]=_[_0x95a3('0x2e')](_0x2bd468[_0x95a3('0x2c')],_0x2bd468[_0x95a3('0x2d')]);_0x3f9a2b[_0x95a3('0x2f')]=_[_0x95a3('0x2e')](_0x2bd468[_0x95a3('0x2c')],qs[_0x95a3('0x30')](_0x213c8b[_0x95a3('0x2d')]['fields']));_0x3f9a2b[_0x95a3('0x2f')]=_0x3f9a2b[_0x95a3('0x2f')]['length']?_0x3f9a2b['attributes']:_0x2bd468[_0x95a3('0x2c')];_0x3f9a2b[_0x95a3('0x49')]=qs[_0x95a3('0x35')](_0x213c8b[_0x95a3('0x2d')][_0x95a3('0x35')]);_0x3f9a2b[_0x95a3('0x36')]=qs[_0x95a3('0x37')](_[_0x95a3('0x38')](_0x213c8b[_0x95a3('0x2d')],_0x2bd468['filters']));if(_0x213c8b[_0x95a3('0x2d')][_0x95a3('0x39')]){_0x3f9a2b[_0x95a3('0x36')]=_[_0x95a3('0x3a')](_0x3f9a2b[_0x95a3('0x36')],{'$or':_[_0x95a3('0x28')](_0x3f9a2b[_0x95a3('0x2f')],function(_0x3571aa){var _0x1c550b={};_0x1c550b[_0x3571aa]={'$like':'%'+_0x213c8b[_0x95a3('0x2d')][_0x95a3('0x39')]+'%'};return _0x1c550b;})});}_0x3f9a2b=_[_0x95a3('0x3a')]({},_0x3f9a2b,_0x213c8b[_0x95a3('0x3b')]);return _0x22412c[_0x95a3('0x46')](_0x3f9a2b);}})[_0x95a3('0x20')](function(_0x5dcfb6){if(_0x5dcfb6){_0x4fa9f9=_0x5dcfb6[_0x95a3('0x31')];if(!_0x213c8b[_0x95a3('0x2d')]['hasOwnProperty'](_0x95a3('0x33'))){_0x3f9a2b[_0x95a3('0x34')]=qs['limit'](_0x213c8b[_0x95a3('0x2d')][_0x95a3('0x34')]);_0x3f9a2b[_0x95a3('0x19')]=qs[_0x95a3('0x19')](_0x213c8b[_0x95a3('0x2d')][_0x95a3('0x19')]);}return _0x22412c[_0x95a3('0x46')](_0x3f9a2b);}})['then'](function(_0x275ccc){if(_0x275ccc){return _0x275ccc?{'count':_0x4fa9f9,'rows':_0x275ccc}:null;}})['then'](respondWithResult(_0x4c587,null))[_0x95a3('0x3f')](handleError(_0x4c587,null));};exports[_0x95a3('0x4a')]=function(_0x507497,_0x37db30,_0x50a4f8){var _0x4d165f={};var _0xe19e88={};var _0x3c4568;var _0x24ebf8;return db[_0x95a3('0x29')][_0x95a3('0x47')]({'where':{'id':_0x507497[_0x95a3('0x41')]['id']}})[_0x95a3('0x20')](handleEntityNotFound(_0x37db30,null))[_0x95a3('0x20')](function(_0x4db5e2){if(_0x4db5e2){_0x3c4568=_0x4db5e2;_0xe19e88['model']=_[_0x95a3('0x42')](db[_0x95a3('0x48')][_0x95a3('0x2a')]);_0xe19e88[_0x95a3('0x2d')]=_[_0x95a3('0x42')](_0x507497['query']);_0xe19e88[_0x95a3('0x37')]=_[_0x95a3('0x2e')](_0xe19e88[_0x95a3('0x2c')],_0xe19e88['query']);_0x4d165f['attributes']=_[_0x95a3('0x2e')](_0xe19e88[_0x95a3('0x2c')],qs['fields'](_0x507497[_0x95a3('0x2d')][_0x95a3('0x30')]));_0x4d165f[_0x95a3('0x2f')]=_0x4d165f['attributes'][_0x95a3('0x31')]?_0x4d165f['attributes']:_0xe19e88[_0x95a3('0x2c')];_0x4d165f[_0x95a3('0x49')]=qs[_0x95a3('0x35')](_0x507497[_0x95a3('0x2d')][_0x95a3('0x35')]);_0x4d165f[_0x95a3('0x36')]=qs['filters'](_[_0x95a3('0x38')](_0x507497[_0x95a3('0x2d')],_0xe19e88['filters']));if(_0x507497[_0x95a3('0x2d')][_0x95a3('0x39')]){_0x4d165f['where']=_['merge'](_0x4d165f[_0x95a3('0x36')],{'$or':_['map'](_0x4d165f['attributes'],function(_0xdf4c00){var _0x2b5530={};_0x2b5530[_0xdf4c00]={'$like':'%'+_0x507497[_0x95a3('0x2d')][_0x95a3('0x39')]+'%'};return _0x2b5530;})});}_0x4d165f=_[_0x95a3('0x3a')]({},_0x4d165f,_0x507497[_0x95a3('0x3b')]);return _0x3c4568[_0x95a3('0x4a')](_0x4d165f);}})['then'](function(_0x24942c){if(_0x24942c){_0x24ebf8=_0x24942c[_0x95a3('0x31')];if(!_0x507497[_0x95a3('0x2d')][_0x95a3('0x32')]('nolimit')){_0x4d165f[_0x95a3('0x34')]=qs[_0x95a3('0x34')](_0x507497[_0x95a3('0x2d')][_0x95a3('0x34')]);_0x4d165f['offset']=qs[_0x95a3('0x19')](_0x507497[_0x95a3('0x2d')][_0x95a3('0x19')]);}return _0x3c4568[_0x95a3('0x4a')](_0x4d165f);}})['then'](function(_0x173db9){if(_0x173db9){return _0x173db9?{'count':_0x24ebf8,'rows':_0x173db9}:null;}})[_0x95a3('0x20')](respondWithResult(_0x37db30,null))[_0x95a3('0x3f')](handleError(_0x37db30,null));};exports[_0x95a3('0x4b')]=function(_0x3878e3,_0x1dcc15,_0x57a461){var _0x2d3ff7={};var _0x2f204f={};var _0x521ee9;var _0x444f65;return db[_0x95a3('0x29')][_0x95a3('0x47')]({'where':{'id':_0x3878e3[_0x95a3('0x41')]['id']}})[_0x95a3('0x20')](handleEntityNotFound(_0x1dcc15,null))[_0x95a3('0x20')](function(_0x368e66){if(_0x368e66){_0x521ee9=_0x368e66;_0x2f204f[_0x95a3('0x2c')]=_['keys'](db[_0x95a3('0x48')][_0x95a3('0x2a')]);_0x2f204f[_0x95a3('0x2d')]=_[_0x95a3('0x42')](_0x3878e3[_0x95a3('0x2d')]);_0x2f204f[_0x95a3('0x37')]=_[_0x95a3('0x2e')](_0x2f204f[_0x95a3('0x2c')],_0x2f204f[_0x95a3('0x2d')]);_0x2d3ff7[_0x95a3('0x2f')]=_[_0x95a3('0x2e')](_0x2f204f[_0x95a3('0x2c')],qs['fields'](_0x3878e3['query'][_0x95a3('0x30')]));_0x2d3ff7[_0x95a3('0x2f')]=_0x2d3ff7[_0x95a3('0x2f')][_0x95a3('0x31')]?_0x2d3ff7[_0x95a3('0x2f')]:_0x2f204f[_0x95a3('0x2c')];_0x2d3ff7['order']=qs[_0x95a3('0x35')](_0x3878e3['query'][_0x95a3('0x35')]);_0x2d3ff7[_0x95a3('0x36')]=qs[_0x95a3('0x37')](_[_0x95a3('0x38')](_0x3878e3[_0x95a3('0x2d')],_0x2f204f['filters']));if(_0x3878e3[_0x95a3('0x2d')][_0x95a3('0x39')]){_0x2d3ff7[_0x95a3('0x36')]=_['merge'](_0x2d3ff7[_0x95a3('0x36')],{'$or':_['map'](_0x2d3ff7['attributes'],function(_0x5471d8){var _0x28f50d={};_0x28f50d[_0x5471d8]={'$like':'%'+_0x3878e3['query'][_0x95a3('0x39')]+'%'};return _0x28f50d;})});}_0x2d3ff7=_[_0x95a3('0x3a')]({},_0x2d3ff7,_0x3878e3['options']);return _0x521ee9[_0x95a3('0x4b')](_0x2d3ff7);}})[_0x95a3('0x20')](function(_0x45af84){if(_0x45af84){_0x444f65=_0x45af84['length'];if(!_0x3878e3[_0x95a3('0x2d')]['hasOwnProperty']('nolimit')){_0x2d3ff7[_0x95a3('0x34')]=qs['limit'](_0x3878e3[_0x95a3('0x2d')][_0x95a3('0x34')]);_0x2d3ff7[_0x95a3('0x19')]=qs[_0x95a3('0x19')](_0x3878e3[_0x95a3('0x2d')]['offset']);}return _0x521ee9[_0x95a3('0x4b')](_0x2d3ff7);}})[_0x95a3('0x20')](function(_0x1e6c9c){if(_0x1e6c9c){return _0x1e6c9c?{'count':_0x444f65,'rows':_0x1e6c9c}:null;}})['then'](respondWithResult(_0x1dcc15,null))[_0x95a3('0x3f')](handleError(_0x1dcc15,null));};exports[_0x95a3('0x4c')]=function(_0x4c032c,_0x478c04,_0x5267ac){var _0x1f4f64={};var _0xf774e5={};var _0x5aa12d;var _0x2b63ac;return db[_0x95a3('0x29')][_0x95a3('0x47')]({'where':{'id':_0x4c032c['params']['id']}})['then'](handleEntityNotFound(_0x478c04,null))[_0x95a3('0x20')](function(_0x17d2c1){if(_0x17d2c1){_0x5aa12d=_0x17d2c1;_0xf774e5[_0x95a3('0x2c')]=_['keys'](db[_0x95a3('0x4d')][_0x95a3('0x2a')]);_0xf774e5[_0x95a3('0x2d')]=_[_0x95a3('0x42')](_0x4c032c[_0x95a3('0x2d')]);_0xf774e5[_0x95a3('0x37')]=_[_0x95a3('0x2e')](_0xf774e5[_0x95a3('0x2c')],_0xf774e5[_0x95a3('0x2d')]);_0x1f4f64[_0x95a3('0x2f')]=_[_0x95a3('0x2e')](_0xf774e5[_0x95a3('0x2c')],qs[_0x95a3('0x30')](_0x4c032c[_0x95a3('0x2d')][_0x95a3('0x30')]));_0x1f4f64['attributes']=_0x1f4f64[_0x95a3('0x2f')][_0x95a3('0x31')]?_0x1f4f64[_0x95a3('0x2f')]:_0xf774e5['model'];_0x1f4f64[_0x95a3('0x49')]=qs['sort'](_0x4c032c[_0x95a3('0x2d')][_0x95a3('0x35')]);_0x1f4f64[_0x95a3('0x36')]=qs[_0x95a3('0x37')](_['pick'](_0x4c032c[_0x95a3('0x2d')],_0xf774e5[_0x95a3('0x37')]));if(_0x4c032c[_0x95a3('0x2d')][_0x95a3('0x39')]){_0x1f4f64[_0x95a3('0x36')]=_[_0x95a3('0x3a')](_0x1f4f64[_0x95a3('0x36')],{'$or':_[_0x95a3('0x28')](_0x1f4f64[_0x95a3('0x2f')],function(_0x201dd7){var _0x3878d0={};_0x3878d0[_0x201dd7]={'$like':'%'+_0x4c032c[_0x95a3('0x2d')][_0x95a3('0x39')]+'%'};return _0x3878d0;})});}_0x1f4f64=_['merge']({},_0x1f4f64,_0x4c032c['options']);return _0x5aa12d[_0x95a3('0x4c')](_0x1f4f64);}})['then'](function(_0x352ecd){if(_0x352ecd){_0x2b63ac=_0x352ecd[_0x95a3('0x31')];if(!_0x4c032c[_0x95a3('0x2d')][_0x95a3('0x32')](_0x95a3('0x33'))){_0x1f4f64[_0x95a3('0x34')]=qs[_0x95a3('0x34')](_0x4c032c['query'][_0x95a3('0x34')]);_0x1f4f64[_0x95a3('0x19')]=qs[_0x95a3('0x19')](_0x4c032c[_0x95a3('0x2d')][_0x95a3('0x19')]);}return _0x5aa12d[_0x95a3('0x4c')](_0x1f4f64);}})[_0x95a3('0x20')](function(_0xa99280){if(_0xa99280){return _0xa99280?{'count':_0x2b63ac,'rows':_0xa99280}:null;}})['then'](respondWithResult(_0x478c04,null))['catch'](handleError(_0x478c04,null));};exports[_0x95a3('0x4e')]=function(_0x98a6e9,_0xc61ecd,_0x60a03b){if(_0x98a6e9['body']['id']){delete _0x98a6e9[_0x95a3('0x45')]['id'];}return db[_0x95a3('0x29')][_0x95a3('0x47')]({'where':{'id':_0x98a6e9[_0x95a3('0x41')]['id']}})[_0x95a3('0x20')](handleEntityNotFound(_0xc61ecd,null))['then'](function(_0x294a73){if(_0x294a73){return _0x294a73['setTags'](_0x98a6e9[_0x95a3('0x45')][_0x95a3('0x4f')]||[]);}return null;})[_0x95a3('0x20')](respondWithResult(_0xc61ecd,null))[_0x95a3('0x3f')](handleError(_0xc61ecd,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 0a1e25d..ea80723 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 _0xd04f=['exports','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intFreshdeskConfiguration.attributes'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0xd04f,0xba));var _0xfd04=function(_0x5ccc1e,_0x176db7){_0x5ccc1e=_0x5ccc1e-0x0;var _0xb8aa61=_0xd04f[_0x5ccc1e];return _0xb8aa61;};'use strict';var _=require(_0xfd04('0x0'));var util=require(_0xfd04('0x1'));var logger=require(_0xfd04('0x2'))(_0xfd04('0x3'));var moment=require(_0xfd04('0x4'));var BPromise=require(_0xfd04('0x5'));var rp=require(_0xfd04('0x6'));var fs=require('fs');var path=require(_0xfd04('0x7'));var rimraf=require('rimraf');var config=require(_0xfd04('0x8'));var attributes=require(_0xfd04('0x9'));module[_0xfd04('0xa')]=function(_0x486186,_0x37386b){return _0x486186[_0xfd04('0xb')](_0xfd04('0xc'),attributes,{'tableName':_0xfd04('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa091=['../../config/logger','moment','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa091,0x116));var _0x1a09=function(_0x3ca3f8,_0x4bb9cb){_0x3ca3f8=_0x3ca3f8-0x0;var _0x3a96e6=_0xa091[_0x3ca3f8];return _0x3a96e6;};'use strict';var _=require(_0x1a09('0x0'));var util=require(_0x1a09('0x1'));var logger=require(_0x1a09('0x2'))('api');var moment=require(_0x1a09('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1a09('0x4'));var attributes=require(_0x1a09('0x5'));module[_0x1a09('0x6')]=function(_0x1ef51c,_0x536db1){return _0x1ef51c[_0x1a09('0x7')](_0x1a09('0x8'),attributes,{'tableName':_0x1a09('0x9'),'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 5da430b..c339a36 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 _0x0f23=['../../config/utils','jayson/promise','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','error','code','message','request\x20sent','result','lodash','util','moment','bluebird'];(function(_0x369534,_0x5557c4){var _0x524bf9=function(_0x24c6fb){while(--_0x24c6fb){_0x369534['push'](_0x369534['shift']());}};_0x524bf9(++_0x5557c4);}(_0x0f23,0x19c));var _0x30f2=function(_0x4099ee,_0x38495a){_0x4099ee=_0x4099ee-0x0;var _0x1b7bfc=_0x0f23[_0x4099ee];return _0x1b7bfc;};'use strict';var _=require(_0x30f2('0x0'));var util=require(_0x30f2('0x1'));var moment=require(_0x30f2('0x2'));var BPromise=require(_0x30f2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x30f2('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x30f2('0x5'));var client=jayson['client'][_0x30f2('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x3728a4,_0x5d7bd3,_0x405008){return new BPromise(function(_0x5016ea,_0x11b57d){return client[_0x30f2('0x7')](_0x3728a4,_0x405008)[_0x30f2('0x8')](function(_0x5794f3){logger[_0x30f2('0x9')](_0x30f2('0xa'),_0x5d7bd3,'request\x20sent');logger['debug']('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x5d7bd3,'request\x20sent',JSON['stringify'](_0x5794f3));if(_0x5794f3[_0x30f2('0xb')]){if(_0x5794f3['error'][_0x30f2('0xc')]===0x1f4){logger[_0x30f2('0xb')](_0x30f2('0xa'),_0x5d7bd3,_0x5794f3['error'][_0x30f2('0xd')]);return _0x11b57d(_0x5794f3['error'][_0x30f2('0xd')]);}logger[_0x30f2('0xb')](_0x30f2('0xa'),_0x5d7bd3,_0x5794f3[_0x30f2('0xb')][_0x30f2('0xd')]);return _0x5016ea(_0x5794f3[_0x30f2('0xb')][_0x30f2('0xd')]);}else{logger['info'](_0x30f2('0xa'),_0x5d7bd3,_0x30f2('0xe'));_0x5016ea(_0x5794f3[_0x30f2('0xf')]['message']);}})['catch'](function(_0x1444b4){logger[_0x30f2('0xb')](_0x30f2('0xa'),_0x5d7bd3,_0x1444b4);_0x11b57d(_0x1444b4);});});} \ No newline at end of file +var _0x5339=['info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x282dcb,_0x521fd6){var _0x22d529=function(_0x16ce12){while(--_0x16ce12){_0x282dcb['push'](_0x282dcb['shift']());}};_0x22d529(++_0x521fd6);}(_0x5339,0x14f));var _0x9533=function(_0x9302a2,_0x3f8889){_0x9302a2=_0x9302a2-0x0;var _0x4cb973=_0x5339[_0x9302a2];return _0x4cb973;};'use strict';var _=require(_0x9533('0x0'));var util=require(_0x9533('0x1'));var moment=require(_0x9533('0x2'));var BPromise=require(_0x9533('0x3'));var rs=require(_0x9533('0x4'));var fs=require('fs');var Redis=require(_0x9533('0x5'));var db=require(_0x9533('0x6'))['db'];var utils=require(_0x9533('0x7'));var logger=require(_0x9533('0x8'))(_0x9533('0x9'));var config=require('../../config/environment');var jayson=require(_0x9533('0xa'));var client=jayson[_0x9533('0xb')][_0x9533('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x524e9b,_0x226cd5,_0x4e2a05){return new BPromise(function(_0x17ce1e,_0x35dcda){return client[_0x9533('0xd')](_0x524e9b,_0x4e2a05)[_0x9533('0xe')](function(_0x59d30b){logger[_0x9533('0xf')](_0x9533('0x10'),_0x226cd5,_0x9533('0x11'));logger[_0x9533('0x12')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x226cd5,_0x9533('0x11'),JSON[_0x9533('0x13')](_0x59d30b));if(_0x59d30b['error']){if(_0x59d30b[_0x9533('0x14')][_0x9533('0x15')]===0x1f4){logger[_0x9533('0x14')](_0x9533('0x10'),_0x226cd5,_0x59d30b['error'][_0x9533('0x16')]);return _0x35dcda(_0x59d30b[_0x9533('0x14')]['message']);}logger[_0x9533('0x14')](_0x9533('0x10'),_0x226cd5,_0x59d30b[_0x9533('0x14')][_0x9533('0x16')]);return _0x17ce1e(_0x59d30b['error'][_0x9533('0x16')]);}else{logger[_0x9533('0xf')](_0x9533('0x10'),_0x226cd5,'request\x20sent');_0x17ce1e(_0x59d30b[_0x9533('0x17')]['message']);}})[_0x9533('0x18')](function(_0x5a96ce){logger[_0x9533('0x14')](_0x9533('0x10'),_0x226cd5,_0x5a96ce);_0x35dcda(_0x5a96ce);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 55d20cb..499fdc4 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 _0x2e4e=['put','update','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','index','/:id','post','create'];(function(_0x3ec471,_0x1b46ca){var _0x42f8e7=function(_0x577dad){while(--_0x577dad){_0x3ec471['push'](_0x3ec471['shift']());}};_0x42f8e7(++_0x1b46ca);}(_0x2e4e,0x1cc));var _0xe2e4=function(_0x5573f9,_0x54d2f0){_0x5573f9=_0x5573f9-0x0;var _0x10ede0=_0x2e4e[_0x5573f9];return _0x10ede0;};'use strict';var multer=require(_0xe2e4('0x0'));var util=require(_0xe2e4('0x1'));var path=require(_0xe2e4('0x2'));var timeout=require('connect-timeout');var express=require(_0xe2e4('0x3'));var router=express['Router']();var fs_extra=require(_0xe2e4('0x4'));var auth=require(_0xe2e4('0x5'));var interaction=require(_0xe2e4('0x6'));var config=require(_0xe2e4('0x7'));var controller=require(_0xe2e4('0x8'));router[_0xe2e4('0x9')]('/',auth[_0xe2e4('0xa')](),controller[_0xe2e4('0xb')]);router[_0xe2e4('0x9')](_0xe2e4('0xc'),auth[_0xe2e4('0xa')](),controller['show']);router[_0xe2e4('0xd')]('/',auth['isAuthenticated'](),controller[_0xe2e4('0xe')]);router[_0xe2e4('0xf')](_0xe2e4('0xc'),auth[_0xe2e4('0xa')](),controller[_0xe2e4('0x10')]);router['delete']('/:id',auth[_0xe2e4('0xa')](),controller[_0xe2e4('0x11')]);module[_0xe2e4('0x12')]=router; \ No newline at end of file +var _0xd70a=['../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','index','/:id','isAuthenticated','post','put','update','delete','multer','util','express','Router','fs-extra','../../components/auth/service'];(function(_0x19898f,_0x28b936){var _0x46dc32=function(_0xffd923){while(--_0xffd923){_0x19898f['push'](_0x19898f['shift']());}};_0x46dc32(++_0x28b936);}(_0xd70a,0x1b4));var _0xad70=function(_0x49e584,_0x2886f8){_0x49e584=_0x49e584-0x0;var _0x58b1be=_0xd70a[_0x49e584];return _0x58b1be;};'use strict';var multer=require(_0xad70('0x0'));var util=require(_0xad70('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xad70('0x2'));var router=express[_0xad70('0x3')]();var fs_extra=require(_0xad70('0x4'));var auth=require(_0xad70('0x5'));var interaction=require(_0xad70('0x6'));var config=require(_0xad70('0x7'));var controller=require(_0xad70('0x8'));router[_0xad70('0x9')]('/',auth['isAuthenticated'](),controller[_0xad70('0xa')]);router[_0xad70('0x9')](_0xad70('0xb'),auth[_0xad70('0xc')](),controller['show']);router[_0xad70('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xad70('0xe')](_0xad70('0xb'),auth['isAuthenticated'](),controller[_0xad70('0xf')]);router[_0xad70('0x10')]('/:id',auth[_0xad70('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 7e42176..1be1fc2 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 _0x4560=['exports','ENUM','variable','keyValue','string','STRING','BOOLEAN','sequelize'];(function(_0x5d5a74,_0x14e31c){var _0x87dbf=function(_0x30e18a){while(--_0x30e18a){_0x5d5a74['push'](_0x5d5a74['shift']());}};_0x87dbf(++_0x14e31c);}(_0x4560,0x167));var _0x0456=function(_0x34cca0,_0x6bd5de){_0x34cca0=_0x34cca0-0x0;var _0x29d53f=_0x4560[_0x34cca0];return _0x29d53f;};'use strict';var Sequelize=require(_0x0456('0x0'));module[_0x0456('0x1')]={'type':{'type':Sequelize[_0x0456('0x2')]('string',_0x0456('0x3'),'customVariable',_0x0456('0x4'),'picklist'),'defaultValue':_0x0456('0x5')},'content':{'type':Sequelize[_0x0456('0x6')]},'key':{'type':Sequelize[_0x0456('0x6')]},'keyType':{'type':Sequelize[_0x0456('0x2')](_0x0456('0x5'),_0x0456('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x0456('0x6')]},'idField':{'type':Sequelize[_0x0456('0x6')]},'nameField':{'type':Sequelize[_0x0456('0x6')]},'customField':{'type':Sequelize[_0x0456('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0456('0x6')]}}; \ No newline at end of file +var _0x00b9=['exports','ENUM','string','variable','keyValue','picklist','STRING','customVariable','BOOLEAN'];(function(_0x320909,_0x17e27a){var _0x3b19b5=function(_0x5268c7){while(--_0x5268c7){_0x320909['push'](_0x320909['shift']());}};_0x3b19b5(++_0x17e27a);}(_0x00b9,0x19e));var _0x900b=function(_0x1375c1,_0x325ee5){_0x1375c1=_0x1375c1-0x0;var _0x278b6b=_0x00b9[_0x1375c1];return _0x278b6b;};'use strict';var Sequelize=require('sequelize');module[_0x900b('0x0')]={'type':{'type':Sequelize[_0x900b('0x1')](_0x900b('0x2'),_0x900b('0x3'),'customVariable',_0x900b('0x4'),_0x900b('0x5')),'defaultValue':_0x900b('0x2')},'content':{'type':Sequelize[_0x900b('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM']('string','variable',_0x900b('0x7'))},'keyContent':{'type':Sequelize[_0x900b('0x6')]},'idField':{'type':Sequelize[_0x900b('0x6')]},'nameField':{'type':Sequelize[_0x900b('0x6')]},'customField':{'type':Sequelize[_0x900b('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x900b('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index b56a6fa..994e191 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 _0x57f8=['query','intersection','attributes','fields','hasOwnProperty','sort','filters','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','destroy','then','error','stack','name','send','index','map','FreshdeskField','rawAttributes','fieldName','type','key','model','keys'];(function(_0x148250,_0x2b8bcb){var _0x5c8521=function(_0x21044e){while(--_0x21044e){_0x148250['push'](_0x148250['shift']());}};_0x5c8521(++_0x2b8bcb);}(_0x57f8,0x198));var _0x857f=function(_0x73aef5,_0x5b2293){_0x73aef5=_0x73aef5-0x0;var _0x29be73=_0x57f8[_0x73aef5];return _0x29be73;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x857f('0x0'));var zipdir=require(_0x857f('0x1'));var jsonpatch=require(_0x857f('0x2'));var rp=require(_0x857f('0x3'));var moment=require(_0x857f('0x4'));var BPromise=require(_0x857f('0x5'));var Mustache=require(_0x857f('0x6'));var util=require(_0x857f('0x7'));var path=require(_0x857f('0x8'));var sox=require(_0x857f('0x9'));var csv=require(_0x857f('0xa'));var ejs=require(_0x857f('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x857f('0xc'));var squel=require(_0x857f('0xd'));var crypto=require(_0x857f('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x857f('0xf'));var toCsv=require(_0x857f('0xa'));var querystring=require(_0x857f('0x10'));var Papa=require('papaparse');var Redis=require(_0x857f('0x11'));var authService=require(_0x857f('0x12'));var qs=require(_0x857f('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x857f('0x14'));var logger=require(_0x857f('0x15'))(_0x857f('0x16'));var utils=require(_0x857f('0x17'));var config=require(_0x857f('0x18'));var licenseUtil=require(_0x857f('0x19'));var db=require(_0x857f('0x1a'))['db'];function respondWithStatusCode(_0x533631,_0x2e1eda){_0x2e1eda=_0x2e1eda||0xcc;return function(_0x2d5e26){if(_0x2d5e26){return _0x533631[_0x857f('0x1b')](_0x2e1eda);}return _0x533631[_0x857f('0x1c')](_0x2e1eda)[_0x857f('0x1d')]();};}function respondWithResult(_0x4a25ec,_0x4bc590){_0x4bc590=_0x4bc590||0xc8;return function(_0x3b09d9){if(_0x3b09d9){return _0x4a25ec['status'](_0x4bc590)[_0x857f('0x1e')](_0x3b09d9);}};}function respondWithFilteredResult(_0x4ac81f,_0x1d47bf){return function(_0x134a4f){if(_0x134a4f){var _0x5c3a69=typeof _0x1d47bf[_0x857f('0x1f')]===_0x857f('0x20')&&typeof _0x1d47bf[_0x857f('0x21')]===_0x857f('0x20');var _0x279e74=_0x134a4f[_0x857f('0x22')];var _0x1a9ef8=_0x5c3a69?0x0:_0x1d47bf[_0x857f('0x1f')];var _0x1014ca=_0x5c3a69?_0x134a4f[_0x857f('0x22')]:_0x1d47bf[_0x857f('0x1f')]+_0x1d47bf['limit'];var _0x1729d8;if(_0x1014ca>=_0x279e74){_0x1014ca=_0x279e74;_0x1729d8=0xc8;}else{_0x1729d8=0xce;}_0x4ac81f[_0x857f('0x1c')](_0x1729d8);return _0x4ac81f['set'](_0x857f('0x23'),_0x1a9ef8+'-'+_0x1014ca+'/'+_0x279e74)[_0x857f('0x1e')](_0x134a4f);}return null;};}function patchUpdates(_0x377587){return function(_0x484035){try{jsonpatch['apply'](_0x484035,_0x377587,!![]);}catch(_0x12ee77){return BPromise[_0x857f('0x24')](_0x12ee77);}return _0x484035[_0x857f('0x25')]();};}function saveUpdates(_0x4fa031,_0x118237){return function(_0x17a98e){if(_0x17a98e){return _0x17a98e[_0x857f('0x26')](_0x4fa031)['then'](function(_0x1961ea){return _0x1961ea;});}return null;};}function removeEntity(_0x14a8ce,_0x50bfb7){return function(_0x3bc543){if(_0x3bc543){return _0x3bc543[_0x857f('0x27')]()[_0x857f('0x28')](function(){_0x14a8ce[_0x857f('0x1c')](0xcc)[_0x857f('0x1d')]();});}};}function handleEntityNotFound(_0x3b23a7,_0x233a68){return function(_0x2a89ba){if(!_0x2a89ba){_0x3b23a7[_0x857f('0x1b')](0x194);}return _0x2a89ba;};}function handleError(_0xcd1ee9,_0x72f0aa){_0x72f0aa=_0x72f0aa||0x1f4;return function(_0x4782ab){logger[_0x857f('0x29')](_0x4782ab[_0x857f('0x2a')]);if(_0x4782ab['name']){delete _0x4782ab[_0x857f('0x2b')];}_0xcd1ee9[_0x857f('0x1c')](_0x72f0aa)[_0x857f('0x2c')](_0x4782ab);};}exports[_0x857f('0x2d')]=function(_0x58c2de,_0x40c306){var _0x57ceaa={},_0x1b405a={},_0x234048={'count':0x0,'rows':[]};var _0x45a37f=_[_0x857f('0x2e')](db[_0x857f('0x2f')][_0x857f('0x30')],function(_0x1c4fff){return{'name':_0x1c4fff[_0x857f('0x31')],'type':_0x1c4fff[_0x857f('0x32')][_0x857f('0x33')]};});_0x1b405a[_0x857f('0x34')]=_[_0x857f('0x2e')](_0x45a37f,_0x857f('0x2b'));_0x1b405a['query']=_[_0x857f('0x35')](_0x58c2de[_0x857f('0x36')]);_0x1b405a['filters']=_[_0x857f('0x37')](_0x1b405a[_0x857f('0x34')],_0x1b405a['query']);_0x57ceaa[_0x857f('0x38')]=_[_0x857f('0x37')](_0x1b405a['model'],qs[_0x857f('0x39')](_0x58c2de[_0x857f('0x36')][_0x857f('0x39')]));_0x57ceaa[_0x857f('0x38')]=_0x57ceaa['attributes']['length']?_0x57ceaa[_0x857f('0x38')]:_0x1b405a[_0x857f('0x34')];if(!_0x58c2de['query'][_0x857f('0x3a')]('nolimit')){_0x57ceaa[_0x857f('0x21')]=qs[_0x857f('0x21')](_0x58c2de[_0x857f('0x36')][_0x857f('0x21')]);_0x57ceaa[_0x857f('0x1f')]=qs['offset'](_0x58c2de['query'][_0x857f('0x1f')]);}_0x57ceaa['order']=qs[_0x857f('0x3b')](_0x58c2de[_0x857f('0x36')][_0x857f('0x3b')]);_0x57ceaa['where']=qs[_0x857f('0x3c')](_[_0x857f('0x3d')](_0x58c2de[_0x857f('0x36')],_0x1b405a[_0x857f('0x3c')]),_0x45a37f);if(_0x58c2de[_0x857f('0x36')][_0x857f('0x3e')]){_0x57ceaa[_0x857f('0x3f')]=_['merge'](_0x57ceaa[_0x857f('0x3f')],{'$or':_[_0x857f('0x2e')](_0x45a37f,function(_0x1f285c){if(_0x1f285c[_0x857f('0x32')]!==_0x857f('0x40')){var _0x2356fb={};_0x2356fb[_0x1f285c[_0x857f('0x2b')]]={'$like':'%'+_0x58c2de['query'][_0x857f('0x3e')]+'%'};return _0x2356fb;}})});}_0x57ceaa=_[_0x857f('0x41')]({},_0x57ceaa,_0x58c2de[_0x857f('0x42')]);var _0xc2ac41={'where':_0x57ceaa[_0x857f('0x3f')]};return db[_0x857f('0x2f')]['count'](_0xc2ac41)[_0x857f('0x28')](function(_0x354678){_0x234048[_0x857f('0x22')]=_0x354678;if(_0x58c2de[_0x857f('0x36')][_0x857f('0x43')]){_0x57ceaa[_0x857f('0x44')]=[{'all':!![]}];}return db[_0x857f('0x2f')][_0x857f('0x45')](_0x57ceaa);})['then'](function(_0x40fb37){_0x234048[_0x857f('0x46')]=_0x40fb37;return _0x234048;})[_0x857f('0x28')](respondWithFilteredResult(_0x40c306,_0x57ceaa))[_0x857f('0x47')](handleError(_0x40c306,null));};exports[_0x857f('0x48')]=function(_0x1bbf9f,_0x374b9f){var _0x42d922={'raw':!![],'where':{'id':_0x1bbf9f[_0x857f('0x49')]['id']}},_0xb4d7c2={};_0xb4d7c2[_0x857f('0x34')]=_[_0x857f('0x35')](db[_0x857f('0x2f')][_0x857f('0x30')]);_0xb4d7c2['query']=_[_0x857f('0x35')](_0x1bbf9f['query']);_0xb4d7c2[_0x857f('0x3c')]=_[_0x857f('0x37')](_0xb4d7c2[_0x857f('0x34')],_0xb4d7c2[_0x857f('0x36')]);_0x42d922[_0x857f('0x38')]=_[_0x857f('0x37')](_0xb4d7c2[_0x857f('0x34')],qs[_0x857f('0x39')](_0x1bbf9f[_0x857f('0x36')][_0x857f('0x39')]));_0x42d922[_0x857f('0x38')]=_0x42d922['attributes']['length']?_0x42d922[_0x857f('0x38')]:_0xb4d7c2['model'];if(_0x1bbf9f[_0x857f('0x36')]['includeAll']){_0x42d922[_0x857f('0x44')]=[{'all':!![]}];}_0x42d922=_[_0x857f('0x41')]({},_0x42d922,_0x1bbf9f[_0x857f('0x42')]);return db[_0x857f('0x2f')][_0x857f('0x4a')](_0x42d922)[_0x857f('0x28')](handleEntityNotFound(_0x374b9f,null))[_0x857f('0x28')](respondWithResult(_0x374b9f,null))[_0x857f('0x47')](handleError(_0x374b9f,null));};exports['create']=function(_0x42cf05,_0x3b431d){return db[_0x857f('0x2f')][_0x857f('0x4b')](_0x42cf05['body'],{})[_0x857f('0x28')](respondWithResult(_0x3b431d,0xc9))[_0x857f('0x47')](handleError(_0x3b431d,null));};exports[_0x857f('0x26')]=function(_0x736ef6,_0x67563){if(_0x736ef6['body']['id']){delete _0x736ef6[_0x857f('0x4c')]['id'];}return db[_0x857f('0x2f')]['find']({'where':{'id':_0x736ef6[_0x857f('0x49')]['id']}})[_0x857f('0x28')](handleEntityNotFound(_0x67563,null))['then'](saveUpdates(_0x736ef6[_0x857f('0x4c')],null))['then'](respondWithResult(_0x67563,null))[_0x857f('0x47')](handleError(_0x67563,null));};exports[_0x857f('0x27')]=function(_0x446fe9,_0x2008d5){return db[_0x857f('0x2f')][_0x857f('0x4a')]({'where':{'id':_0x446fe9[_0x857f('0x49')]['id']}})[_0x857f('0x28')](handleEntityNotFound(_0x2008d5,null))[_0x857f('0x28')](removeEntity(_0x2008d5,null))[_0x857f('0x47')](handleError(_0x2008d5,null));}; \ No newline at end of file +var _0x765e=['sort','pick','filter','where','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','rawAttributes','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','sendStatus','end','status','undefined','limit','count','offset','set','json','apply','update','then','destroy','error','stack','index','map','FreshdeskField','fieldName','key','model','name','query','filters','intersection','attributes','fields','length','order'];(function(_0x2a9a54,_0xc93f1e){var _0x29730c=function(_0x3a0e50){while(--_0x3a0e50){_0x2a9a54['push'](_0x2a9a54['shift']());}};_0x29730c(++_0xc93f1e);}(_0x765e,0x131));var _0xe765=function(_0x4e9d12,_0x2209fe){_0x4e9d12=_0x4e9d12-0x0;var _0x58c2dd=_0x765e[_0x4e9d12];return _0x58c2dd;};'use strict';var emlformat=require(_0xe765('0x0'));var rimraf=require(_0xe765('0x1'));var zipdir=require(_0xe765('0x2'));var jsonpatch=require(_0xe765('0x3'));var rp=require(_0xe765('0x4'));var moment=require(_0xe765('0x5'));var BPromise=require(_0xe765('0x6'));var Mustache=require(_0xe765('0x7'));var util=require(_0xe765('0x8'));var path=require(_0xe765('0x9'));var sox=require(_0xe765('0xa'));var csv=require(_0xe765('0xb'));var ejs=require(_0xe765('0xc'));var fs=require('fs');var fs_extra=require(_0xe765('0xd'));var _=require(_0xe765('0xe'));var squel=require('squel');var crypto=require(_0xe765('0xf'));var jsforce=require(_0xe765('0x10'));var deskjs=require(_0xe765('0x11'));var toCsv=require(_0xe765('0xb'));var querystring=require(_0xe765('0x12'));var Papa=require(_0xe765('0x13'));var Redis=require(_0xe765('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xe765('0x15'));var as=require(_0xe765('0x16'));var hardwareService=require(_0xe765('0x17'));var logger=require('../../config/logger')(_0xe765('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe765('0x19'))['db'];function respondWithStatusCode(_0x18177f,_0x9411a0){_0x9411a0=_0x9411a0||0xcc;return function(_0x27456b){if(_0x27456b){return _0x18177f[_0xe765('0x1a')](_0x9411a0);}return _0x18177f['status'](_0x9411a0)[_0xe765('0x1b')]();};}function respondWithResult(_0x3a26d8,_0x395312){_0x395312=_0x395312||0xc8;return function(_0x58dc37){if(_0x58dc37){return _0x3a26d8[_0xe765('0x1c')](_0x395312)['json'](_0x58dc37);}};}function respondWithFilteredResult(_0x50e2ab,_0x2f673b){return function(_0x1b1cfe){if(_0x1b1cfe){var _0x3c887b=typeof _0x2f673b['offset']===_0xe765('0x1d')&&typeof _0x2f673b[_0xe765('0x1e')]===_0xe765('0x1d');var _0x1db3ca=_0x1b1cfe[_0xe765('0x1f')];var _0xf93371=_0x3c887b?0x0:_0x2f673b[_0xe765('0x20')];var _0x2a95a9=_0x3c887b?_0x1b1cfe[_0xe765('0x1f')]:_0x2f673b['offset']+_0x2f673b[_0xe765('0x1e')];var _0x56905c;if(_0x2a95a9>=_0x1db3ca){_0x2a95a9=_0x1db3ca;_0x56905c=0xc8;}else{_0x56905c=0xce;}_0x50e2ab[_0xe765('0x1c')](_0x56905c);return _0x50e2ab[_0xe765('0x21')]('Content-Range',_0xf93371+'-'+_0x2a95a9+'/'+_0x1db3ca)[_0xe765('0x22')](_0x1b1cfe);}return null;};}function patchUpdates(_0x59118f){return function(_0x1c73c8){try{jsonpatch[_0xe765('0x23')](_0x1c73c8,_0x59118f,!![]);}catch(_0x1efb96){return BPromise['reject'](_0x1efb96);}return _0x1c73c8['save']();};}function saveUpdates(_0x4b789b,_0x1c6de4){return function(_0x2a4427){if(_0x2a4427){return _0x2a4427[_0xe765('0x24')](_0x4b789b)[_0xe765('0x25')](function(_0x54b59c){return _0x54b59c;});}return null;};}function removeEntity(_0x50cfcb,_0x18ba77){return function(_0x2e2a34){if(_0x2e2a34){return _0x2e2a34[_0xe765('0x26')]()[_0xe765('0x25')](function(){_0x50cfcb[_0xe765('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1aacbc,_0x5464b4){return function(_0x2b1f66){if(!_0x2b1f66){_0x1aacbc[_0xe765('0x1a')](0x194);}return _0x2b1f66;};}function handleError(_0xd877f3,_0x357f4e){_0x357f4e=_0x357f4e||0x1f4;return function(_0x40492d){logger[_0xe765('0x27')](_0x40492d[_0xe765('0x28')]);if(_0x40492d['name']){delete _0x40492d['name'];}_0xd877f3[_0xe765('0x1c')](_0x357f4e)['send'](_0x40492d);};}exports[_0xe765('0x29')]=function(_0x3f7493,_0x2fcbc9){var _0x64ffd4={},_0x1a8c01={},_0x4fce2c={'count':0x0,'rows':[]};var _0x43349b=_[_0xe765('0x2a')](db[_0xe765('0x2b')]['rawAttributes'],function(_0x5947c1){return{'name':_0x5947c1[_0xe765('0x2c')],'type':_0x5947c1['type'][_0xe765('0x2d')]};});_0x1a8c01[_0xe765('0x2e')]=_[_0xe765('0x2a')](_0x43349b,_0xe765('0x2f'));_0x1a8c01[_0xe765('0x30')]=_['keys'](_0x3f7493['query']);_0x1a8c01[_0xe765('0x31')]=_[_0xe765('0x32')](_0x1a8c01[_0xe765('0x2e')],_0x1a8c01[_0xe765('0x30')]);_0x64ffd4[_0xe765('0x33')]=_['intersection'](_0x1a8c01['model'],qs[_0xe765('0x34')](_0x3f7493['query'][_0xe765('0x34')]));_0x64ffd4[_0xe765('0x33')]=_0x64ffd4[_0xe765('0x33')][_0xe765('0x35')]?_0x64ffd4[_0xe765('0x33')]:_0x1a8c01[_0xe765('0x2e')];if(!_0x3f7493[_0xe765('0x30')]['hasOwnProperty']('nolimit')){_0x64ffd4['limit']=qs[_0xe765('0x1e')](_0x3f7493[_0xe765('0x30')][_0xe765('0x1e')]);_0x64ffd4[_0xe765('0x20')]=qs['offset'](_0x3f7493[_0xe765('0x30')][_0xe765('0x20')]);}_0x64ffd4[_0xe765('0x36')]=qs[_0xe765('0x37')](_0x3f7493['query'][_0xe765('0x37')]);_0x64ffd4['where']=qs[_0xe765('0x31')](_[_0xe765('0x38')](_0x3f7493[_0xe765('0x30')],_0x1a8c01[_0xe765('0x31')]),_0x43349b);if(_0x3f7493[_0xe765('0x30')][_0xe765('0x39')]){_0x64ffd4[_0xe765('0x3a')]=_[_0xe765('0x3b')](_0x64ffd4[_0xe765('0x3a')],{'$or':_[_0xe765('0x2a')](_0x43349b,function(_0x5e21ae){if(_0x5e21ae[_0xe765('0x3c')]!==_0xe765('0x3d')){var _0x11b459={};_0x11b459[_0x5e21ae['name']]={'$like':'%'+_0x3f7493['query']['filter']+'%'};return _0x11b459;}})});}_0x64ffd4=_[_0xe765('0x3b')]({},_0x64ffd4,_0x3f7493['options']);var _0x1f0db1={'where':_0x64ffd4[_0xe765('0x3a')]};return db[_0xe765('0x2b')][_0xe765('0x1f')](_0x1f0db1)['then'](function(_0x363f59){_0x4fce2c[_0xe765('0x1f')]=_0x363f59;if(_0x3f7493[_0xe765('0x30')][_0xe765('0x3e')]){_0x64ffd4[_0xe765('0x3f')]=[{'all':!![]}];}return db[_0xe765('0x2b')][_0xe765('0x40')](_0x64ffd4);})[_0xe765('0x25')](function(_0xb92246){_0x4fce2c[_0xe765('0x41')]=_0xb92246;return _0x4fce2c;})['then'](respondWithFilteredResult(_0x2fcbc9,_0x64ffd4))[_0xe765('0x42')](handleError(_0x2fcbc9,null));};exports['show']=function(_0x1248ea,_0x1d2b24){var _0x4d2814={'raw':!![],'where':{'id':_0x1248ea['params']['id']}},_0x3977e5={};_0x3977e5['model']=_['keys'](db[_0xe765('0x2b')][_0xe765('0x43')]);_0x3977e5[_0xe765('0x30')]=_['keys'](_0x1248ea[_0xe765('0x30')]);_0x3977e5[_0xe765('0x31')]=_[_0xe765('0x32')](_0x3977e5[_0xe765('0x2e')],_0x3977e5[_0xe765('0x30')]);_0x4d2814[_0xe765('0x33')]=_[_0xe765('0x32')](_0x3977e5[_0xe765('0x2e')],qs[_0xe765('0x34')](_0x1248ea['query'][_0xe765('0x34')]));_0x4d2814['attributes']=_0x4d2814['attributes'][_0xe765('0x35')]?_0x4d2814['attributes']:_0x3977e5[_0xe765('0x2e')];if(_0x1248ea[_0xe765('0x30')][_0xe765('0x3e')]){_0x4d2814['include']=[{'all':!![]}];}_0x4d2814=_[_0xe765('0x3b')]({},_0x4d2814,_0x1248ea['options']);return db[_0xe765('0x2b')][_0xe765('0x44')](_0x4d2814)[_0xe765('0x25')](handleEntityNotFound(_0x1d2b24,null))['then'](respondWithResult(_0x1d2b24,null))[_0xe765('0x42')](handleError(_0x1d2b24,null));};exports[_0xe765('0x45')]=function(_0x115f16,_0x2d360e){return db['FreshdeskField']['create'](_0x115f16['body'],{})[_0xe765('0x25')](respondWithResult(_0x2d360e,0xc9))[_0xe765('0x42')](handleError(_0x2d360e,null));};exports[_0xe765('0x24')]=function(_0x58310d,_0x14834c){if(_0x58310d['body']['id']){delete _0x58310d[_0xe765('0x46')]['id'];}return db[_0xe765('0x2b')][_0xe765('0x44')]({'where':{'id':_0x58310d[_0xe765('0x47')]['id']}})[_0xe765('0x25')](handleEntityNotFound(_0x14834c,null))[_0xe765('0x25')](saveUpdates(_0x58310d['body'],null))[_0xe765('0x25')](respondWithResult(_0x14834c,null))[_0xe765('0x42')](handleError(_0x14834c,null));};exports[_0xe765('0x26')]=function(_0x1214a8,_0x14c3b5){return db[_0xe765('0x2b')]['find']({'where':{'id':_0x1214a8['params']['id']}})[_0xe765('0x25')](handleEntityNotFound(_0x14c3b5,null))[_0xe765('0x25')](removeEntity(_0x14c3b5,null))[_0xe765('0x42')](handleError(_0x14c3b5,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 2b2d794..c922856 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 _0xafb4=['lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./intFreshdeskField.attributes','int_freshdesk_fields','idField','FieldId'];(function(_0x15f12f,_0x2aad65){var _0x8aefb7=function(_0x410efe){while(--_0x410efe){_0x15f12f['push'](_0x15f12f['shift']());}};_0x8aefb7(++_0x2aad65);}(_0xafb4,0x78));var _0x4afb=function(_0x5314af,_0x35ee8f){_0x5314af=_0x5314af-0x0;var _0x261556=_0xafb4[_0x5314af];return _0x261556;};'use strict';var _=require(_0x4afb('0x0'));var util=require(_0x4afb('0x1'));var logger=require('../../config/logger')(_0x4afb('0x2'));var moment=require(_0x4afb('0x3'));var BPromise=require(_0x4afb('0x4'));var rp=require(_0x4afb('0x5'));var fs=require('fs');var path=require(_0x4afb('0x6'));var rimraf=require('rimraf');var config=require(_0x4afb('0x7'));var attributes=require(_0x4afb('0x8'));module['exports']=function(_0x5923c4,_0x9c3c30){return _0x5923c4['define']('FreshdeskField',attributes,{'tableName':_0x4afb('0x9'),'paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':[_0x4afb('0xa'),_0x4afb('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x91d9=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId'];(function(_0x151647,_0x9d2650){var _0x46437f=function(_0x10a463){while(--_0x10a463){_0x151647['push'](_0x151647['shift']());}};_0x46437f(++_0x9d2650);}(_0x91d9,0xe0));var _0x991d=function(_0x3421c8,_0x4a2576){_0x3421c8=_0x3421c8-0x0;var _0x3962cc=_0x91d9[_0x3421c8];return _0x3962cc;};'use strict';var _=require('lodash');var util=require(_0x991d('0x0'));var logger=require(_0x991d('0x1'))(_0x991d('0x2'));var moment=require(_0x991d('0x3'));var BPromise=require(_0x991d('0x4'));var rp=require(_0x991d('0x5'));var fs=require('fs');var path=require(_0x991d('0x6'));var rimraf=require('rimraf');var config=require(_0x991d('0x7'));var attributes=require(_0x991d('0x8'));module[_0x991d('0x9')]=function(_0x97de63,_0x5d4715){return _0x97de63[_0x991d('0xa')](_0x991d('0xb'),attributes,{'tableName':_0x991d('0xc'),'paranoid':![],'indexes':[{'name':_0x991d('0xd'),'fields':[_0x991d('0xe'),_0x991d('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index a9885e7..ae65f71 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 _0x91b5=['debug','stringify','error','code','message','FreshdeskField,\x20%s,\x20%s','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','info','request\x20sent'];(function(_0x13b4e8,_0x4036d1){var _0x299f36=function(_0x3daf13){while(--_0x3daf13){_0x13b4e8['push'](_0x13b4e8['shift']());}};_0x299f36(++_0x4036d1);}(_0x91b5,0x194));var _0x591b=function(_0x3f095d,_0x545844){_0x3f095d=_0x3f095d-0x0;var _0x226008=_0x91b5[_0x3f095d];return _0x226008;};'use strict';var _=require('lodash');var util=require(_0x591b('0x0'));var moment=require(_0x591b('0x1'));var BPromise=require(_0x591b('0x2'));var rs=require(_0x591b('0x3'));var fs=require('fs');var Redis=require(_0x591b('0x4'));var db=require(_0x591b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x591b('0x6'))('rpc');var config=require(_0x591b('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3ccb89,_0x1df330,_0x47930c){return new BPromise(function(_0x4f4519,_0x2cbe2c){return client['request'](_0x3ccb89,_0x47930c)['then'](function(_0x3dcbab){logger[_0x591b('0x8')]('FreshdeskField,\x20%s,\x20%s',_0x1df330,_0x591b('0x9'));logger[_0x591b('0xa')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x1df330,'request\x20sent',JSON[_0x591b('0xb')](_0x3dcbab));if(_0x3dcbab[_0x591b('0xc')]){if(_0x3dcbab[_0x591b('0xc')][_0x591b('0xd')]===0x1f4){logger[_0x591b('0xc')]('FreshdeskField,\x20%s,\x20%s',_0x1df330,_0x3dcbab['error'][_0x591b('0xe')]);return _0x2cbe2c(_0x3dcbab['error']['message']);}logger['error'](_0x591b('0xf'),_0x1df330,_0x3dcbab[_0x591b('0xc')]['message']);return _0x4f4519(_0x3dcbab['error'][_0x591b('0xe')]);}else{logger[_0x591b('0x8')](_0x591b('0xf'),_0x1df330,'request\x20sent');_0x4f4519(_0x3dcbab[_0x591b('0x10')]['message']);}})[_0x591b('0x11')](function(_0xafa5dd){logger['error'](_0x591b('0xf'),_0x1df330,_0xafa5dd);_0x2cbe2c(_0xafa5dd);});});} \ No newline at end of file +var _0xc94c=['info','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x5ef718,_0x32bfa5){var _0x559929=function(_0x4d6507){while(--_0x4d6507){_0x5ef718['push'](_0x5ef718['shift']());}};_0x559929(++_0x32bfa5);}(_0xc94c,0x1cf));var _0xcc94=function(_0x2a9614,_0x43aecf){_0x2a9614=_0x2a9614-0x0;var _0x1d4ab9=_0xc94c[_0x2a9614];return _0x1d4ab9;};'use strict';var _=require(_0xcc94('0x0'));var util=require(_0xcc94('0x1'));var moment=require(_0xcc94('0x2'));var BPromise=require(_0xcc94('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcc94('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xcc94('0x5'))(_0xcc94('0x6'));var config=require(_0xcc94('0x7'));var jayson=require(_0xcc94('0x8'));var client=jayson[_0xcc94('0x9')][_0xcc94('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1fe4fe,_0x484f98,_0x3a82b8){return new BPromise(function(_0x15f7cc,_0x5ccd70){return client[_0xcc94('0xb')](_0x1fe4fe,_0x3a82b8)[_0xcc94('0xc')](function(_0x4de7ec){logger['info'](_0xcc94('0xd'),_0x484f98,_0xcc94('0xe'));logger[_0xcc94('0xf')](_0xcc94('0x10'),_0x484f98,_0xcc94('0xe'),JSON[_0xcc94('0x11')](_0x4de7ec));if(_0x4de7ec[_0xcc94('0x12')]){if(_0x4de7ec[_0xcc94('0x12')][_0xcc94('0x13')]===0x1f4){logger[_0xcc94('0x12')](_0xcc94('0xd'),_0x484f98,_0x4de7ec['error']['message']);return _0x5ccd70(_0x4de7ec[_0xcc94('0x12')][_0xcc94('0x14')]);}logger[_0xcc94('0x12')](_0xcc94('0xd'),_0x484f98,_0x4de7ec[_0xcc94('0x12')][_0xcc94('0x14')]);return _0x15f7cc(_0x4de7ec[_0xcc94('0x12')][_0xcc94('0x14')]);}else{logger[_0xcc94('0x15')]('FreshdeskField,\x20%s,\x20%s',_0x484f98,'request\x20sent');_0x15f7cc(_0x4de7ec['result'][_0xcc94('0x14')]);}})['catch'](function(_0x2c3c5f){logger['error'](_0xcc94('0xd'),_0x484f98,_0x2c3c5f);_0x5ccd70(_0x2c3c5f);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 07ad859..6ed393b 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 _0xbc9d=['express','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','show','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','update','delete','/:id','destroy','multer','util','path','connect-timeout'];(function(_0x48eae2,_0x38d782){var _0x37e6ac=function(_0x31fe5b){while(--_0x31fe5b){_0x48eae2['push'](_0x48eae2['shift']());}};_0x37e6ac(++_0x38d782);}(_0xbc9d,0xb4));var _0xdbc9=function(_0x58a9b8,_0x396d18){_0x58a9b8=_0x58a9b8-0x0;var _0x1f44e2=_0xbc9d[_0x58a9b8];return _0x1f44e2;};'use strict';var multer=require(_0xdbc9('0x0'));var util=require(_0xdbc9('0x1'));var path=require(_0xdbc9('0x2'));var timeout=require(_0xdbc9('0x3'));var express=require(_0xdbc9('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xdbc9('0x5'));var config=require(_0xdbc9('0x6'));var controller=require(_0xdbc9('0x7'));router[_0xdbc9('0x8')]('/',auth[_0xdbc9('0x9')](),controller[_0xdbc9('0xa')]);router[_0xdbc9('0x8')]('/:id',auth[_0xdbc9('0x9')](),controller[_0xdbc9('0xb')]);router[_0xdbc9('0x8')]('/:id/configurations',auth[_0xdbc9('0x9')](),controller['getConfigurations']);router['get'](_0xdbc9('0xc'),auth[_0xdbc9('0x9')](),controller[_0xdbc9('0xd')]);router[_0xdbc9('0xe')]('/',auth['isAuthenticated'](),controller[_0xdbc9('0xf')]);router[_0xdbc9('0xe')](_0xdbc9('0x10'),auth[_0xdbc9('0x9')](),controller[_0xdbc9('0x11')]);router[_0xdbc9('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xdbc9('0x13')]);router[_0xdbc9('0x14')](_0xdbc9('0x15'),auth[_0xdbc9('0x9')](),controller[_0xdbc9('0x16')]);module['exports']=router; \ No newline at end of file +var _0xa74f=['post','create','/:id/configurations','put','update','destroy','exports','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshsalesAccount.controller','index','get','/:id','isAuthenticated','show','getConfigurations','/:id/fields','getFields'];(function(_0xe66b90,_0x234632){var _0x104441=function(_0x32f92f){while(--_0x32f92f){_0xe66b90['push'](_0xe66b90['shift']());}};_0x104441(++_0x234632);}(_0xa74f,0x9a));var _0xfa74=function(_0x1c6089,_0x3816e2){_0x1c6089=_0x1c6089-0x0;var _0x4d97c1=_0xa74f[_0x1c6089];return _0x4d97c1;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xfa74('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xfa74('0x1')]();var fs_extra=require(_0xfa74('0x2'));var auth=require(_0xfa74('0x3'));var interaction=require(_0xfa74('0x4'));var config=require('../../config/environment');var controller=require(_0xfa74('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0xfa74('0x6')]);router[_0xfa74('0x7')](_0xfa74('0x8'),auth[_0xfa74('0x9')](),controller[_0xfa74('0xa')]);router[_0xfa74('0x7')]('/:id/configurations',auth[_0xfa74('0x9')](),controller[_0xfa74('0xb')]);router[_0xfa74('0x7')](_0xfa74('0xc'),auth['isAuthenticated'](),controller[_0xfa74('0xd')]);router[_0xfa74('0xe')]('/',auth['isAuthenticated'](),controller[_0xfa74('0xf')]);router[_0xfa74('0xe')](_0xfa74('0x10'),auth[_0xfa74('0x9')](),controller['addConfiguration']);router[_0xfa74('0x11')](_0xfa74('0x8'),auth[_0xfa74('0x9')](),controller[_0xfa74('0x12')]);router['delete'](_0xfa74('0x8'),auth[_0xfa74('0x9')](),controller[_0xfa74('0x13')]);module[_0xfa74('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 6f1a373..1114bd5 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 _0x32b6=['remoteUri','sequelize','exports','STRING'];(function(_0x1399d6,_0x2c1661){var _0x4a9db4=function(_0x4666b8){while(--_0x4666b8){_0x1399d6['push'](_0x1399d6['shift']());}};_0x4a9db4(++_0x2c1661);}(_0x32b6,0x1d1));var _0x632b=function(_0x4f9aad,_0xe8a84b){_0x4f9aad=_0x4f9aad-0x0;var _0x550492=_0x32b6[_0x4f9aad];return _0x550492;};'use strict';var Sequelize=require(_0x632b('0x0'));module[_0x632b('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x632b('0x2')]},'username':{'type':Sequelize[_0x632b('0x2')],'unique':'username'},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x632b('0x2')],'unique':_0x632b('0x3')},'serverUrl':{'type':Sequelize[_0x632b('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x28f2=['exports','STRING','remoteUri','sequelize'];(function(_0x4a8eaf,_0x39ce59){var _0x5a658f=function(_0x4d935a){while(--_0x4d935a){_0x4a8eaf['push'](_0x4a8eaf['shift']());}};_0x5a658f(++_0x39ce59);}(_0x28f2,0x193));var _0x228f=function(_0x2ae040,_0x31362f){_0x2ae040=_0x2ae040-0x0;var _0x524702=_0x28f2[_0x2ae040];return _0x524702;};'use strict';var Sequelize=require(_0x228f('0x0'));module[_0x228f('0x1')]={'name':{'type':Sequelize[_0x228f('0x2')]},'description':{'type':Sequelize[_0x228f('0x2')]},'username':{'type':Sequelize[_0x228f('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0x228f('0x2')]},'remoteUri':{'type':Sequelize[_0x228f('0x2')],'unique':_0x228f('0x3')},'serverUrl':{'type':Sequelize[_0x228f('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 038e576..2f09965 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 _0xdc22=['substring','lastIndexOf','GET','format','%s%s','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','error','stringify','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','name','send','index','FreshsalesAccount','rawAttributes','fieldName','type','key','model','map','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','where','filters','pick','merge','VIRTUAL','options','findAll','show','params','includeAll','include','find','catch','create','body','getConfigurations','findOne','order','sort','filter','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','FreshsalesField','getFields','username','remoteUri','apiKey','slice'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xdc22,0xda));var _0x2dc2=function(_0x69c0c2,_0x2af0bf){_0x69c0c2=_0x69c0c2-0x0;var _0x3422f6=_0xdc22[_0x69c0c2];return _0x3422f6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2dc2('0x0'));var zipdir=require(_0x2dc2('0x1'));var jsonpatch=require(_0x2dc2('0x2'));var rp=require(_0x2dc2('0x3'));var moment=require(_0x2dc2('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2dc2('0x5'));var path=require(_0x2dc2('0x6'));var sox=require(_0x2dc2('0x7'));var csv=require(_0x2dc2('0x8'));var ejs=require(_0x2dc2('0x9'));var fs=require('fs');var fs_extra=require(_0x2dc2('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2dc2('0xb'));var deskjs=require(_0x2dc2('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2dc2('0xd'));var Redis=require(_0x2dc2('0xe'));var authService=require(_0x2dc2('0xf'));var qs=require(_0x2dc2('0x10'));var as=require(_0x2dc2('0x11'));var hardwareService=require(_0x2dc2('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x2dc2('0x13'));var config=require(_0x2dc2('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x2dc2('0x15'));function respondWithStatusCode(_0x13717d,_0x1621b7){_0x1621b7=_0x1621b7||0xcc;return function(_0x442252){if(_0x442252){return _0x13717d[_0x2dc2('0x16')](_0x1621b7);}return _0x13717d[_0x2dc2('0x17')](_0x1621b7)[_0x2dc2('0x18')]();};}function respondWithResult(_0x37621a,_0x584345){_0x584345=_0x584345||0xc8;return function(_0x4ea6f9){if(_0x4ea6f9){return _0x37621a['status'](_0x584345)['json'](_0x4ea6f9);}};}function respondWithFilteredResult(_0x5e2d5a,_0x5d9207){return function(_0x38d9e3){if(_0x38d9e3){var _0x2943c2=typeof _0x5d9207[_0x2dc2('0x19')]===_0x2dc2('0x1a')&&typeof _0x5d9207[_0x2dc2('0x1b')]===_0x2dc2('0x1a');var _0x195bba=_0x38d9e3[_0x2dc2('0x1c')];var _0x27cd44=_0x2943c2?0x0:_0x5d9207[_0x2dc2('0x19')];var _0x121a9e=_0x2943c2?_0x38d9e3[_0x2dc2('0x1c')]:_0x5d9207[_0x2dc2('0x19')]+_0x5d9207[_0x2dc2('0x1b')];var _0x43219b;if(_0x121a9e>=_0x195bba){_0x121a9e=_0x195bba;_0x43219b=0xc8;}else{_0x43219b=0xce;}_0x5e2d5a['status'](_0x43219b);return _0x5e2d5a[_0x2dc2('0x1d')](_0x2dc2('0x1e'),_0x27cd44+'-'+_0x121a9e+'/'+_0x195bba)[_0x2dc2('0x1f')](_0x38d9e3);}return null;};}function patchUpdates(_0x5ad368){return function(_0x16d437){try{jsonpatch[_0x2dc2('0x20')](_0x16d437,_0x5ad368,!![]);}catch(_0xaee233){return BPromise[_0x2dc2('0x21')](_0xaee233);}return _0x16d437[_0x2dc2('0x22')]();};}function saveUpdates(_0x5ac84a,_0x6b925f){return function(_0x329445){if(_0x329445){return _0x329445[_0x2dc2('0x23')](_0x5ac84a)[_0x2dc2('0x24')](function(_0x2a41bd){return _0x2a41bd;});}return null;};}function removeEntity(_0xd4de9f,_0x393e42){return function(_0x186f24){if(_0x186f24){return _0x186f24[_0x2dc2('0x25')]()['then'](function(){_0xd4de9f[_0x2dc2('0x17')](0xcc)[_0x2dc2('0x18')]();});}};}function handleEntityNotFound(_0x2ecba4,_0x27c1e4){return function(_0x10c951){if(!_0x10c951){_0x2ecba4[_0x2dc2('0x16')](0x194);}return _0x10c951;};}function handleError(_0x34521d,_0x398121){_0x398121=_0x398121||0x1f4;return function(_0x1bb600){logger['error'](_0x1bb600['stack']);if(_0x1bb600['name']){delete _0x1bb600[_0x2dc2('0x26')];}_0x34521d[_0x2dc2('0x17')](_0x398121)[_0x2dc2('0x27')](_0x1bb600);};}exports[_0x2dc2('0x28')]=function(_0x5ee57c,_0xadae8d){var _0x3981ef={},_0x531055={},_0x9f1cba={'count':0x0,'rows':[]};var _0x3d04ad=_['map'](db[_0x2dc2('0x29')][_0x2dc2('0x2a')],function(_0x24fa98){return{'name':_0x24fa98[_0x2dc2('0x2b')],'type':_0x24fa98[_0x2dc2('0x2c')][_0x2dc2('0x2d')]};});_0x531055[_0x2dc2('0x2e')]=_[_0x2dc2('0x2f')](_0x3d04ad,_0x2dc2('0x26'));_0x531055[_0x2dc2('0x30')]=_[_0x2dc2('0x31')](_0x5ee57c[_0x2dc2('0x30')]);_0x531055['filters']=_['intersection'](_0x531055[_0x2dc2('0x2e')],_0x531055[_0x2dc2('0x30')]);_0x3981ef[_0x2dc2('0x32')]=_[_0x2dc2('0x33')](_0x531055['model'],qs[_0x2dc2('0x34')](_0x5ee57c[_0x2dc2('0x30')][_0x2dc2('0x34')]));_0x3981ef[_0x2dc2('0x32')]=_0x3981ef[_0x2dc2('0x32')][_0x2dc2('0x35')]?_0x3981ef['attributes']:_0x531055[_0x2dc2('0x2e')];if(!_0x5ee57c['query'][_0x2dc2('0x36')](_0x2dc2('0x37'))){_0x3981ef[_0x2dc2('0x1b')]=qs[_0x2dc2('0x1b')](_0x5ee57c['query'][_0x2dc2('0x1b')]);_0x3981ef[_0x2dc2('0x19')]=qs['offset'](_0x5ee57c[_0x2dc2('0x30')][_0x2dc2('0x19')]);}_0x3981ef['order']=qs['sort'](_0x5ee57c[_0x2dc2('0x30')]['sort']);_0x3981ef[_0x2dc2('0x38')]=qs[_0x2dc2('0x39')](_[_0x2dc2('0x3a')](_0x5ee57c[_0x2dc2('0x30')],_0x531055[_0x2dc2('0x39')]),_0x3d04ad);if(_0x5ee57c['query']['filter']){_0x3981ef[_0x2dc2('0x38')]=_[_0x2dc2('0x3b')](_0x3981ef[_0x2dc2('0x38')],{'$or':_[_0x2dc2('0x2f')](_0x3d04ad,function(_0x3c5e77){if(_0x3c5e77[_0x2dc2('0x2c')]!==_0x2dc2('0x3c')){var _0x2afd8e={};_0x2afd8e[_0x3c5e77['name']]={'$like':'%'+_0x5ee57c[_0x2dc2('0x30')]['filter']+'%'};return _0x2afd8e;}})});}_0x3981ef=_[_0x2dc2('0x3b')]({},_0x3981ef,_0x5ee57c[_0x2dc2('0x3d')]);var _0x256269={'where':_0x3981ef[_0x2dc2('0x38')]};return db['FreshsalesAccount'][_0x2dc2('0x1c')](_0x256269)[_0x2dc2('0x24')](function(_0xf20024){_0x9f1cba['count']=_0xf20024;if(_0x5ee57c[_0x2dc2('0x30')]['includeAll']){_0x3981ef['include']=[{'all':!![]}];}return db[_0x2dc2('0x29')][_0x2dc2('0x3e')](_0x3981ef);})['then'](function(_0x177887){_0x9f1cba['rows']=_0x177887;return _0x9f1cba;})[_0x2dc2('0x24')](respondWithFilteredResult(_0xadae8d,_0x3981ef))['catch'](handleError(_0xadae8d,null));};exports[_0x2dc2('0x3f')]=function(_0x2a45ae,_0x588384){var _0x5db044={'raw':![],'where':{'id':_0x2a45ae[_0x2dc2('0x40')]['id']}},_0x3dedb6={};_0x3dedb6[_0x2dc2('0x2e')]=_[_0x2dc2('0x31')](db[_0x2dc2('0x29')][_0x2dc2('0x2a')]);_0x3dedb6[_0x2dc2('0x30')]=_[_0x2dc2('0x31')](_0x2a45ae[_0x2dc2('0x30')]);_0x3dedb6['filters']=_[_0x2dc2('0x33')](_0x3dedb6['model'],_0x3dedb6[_0x2dc2('0x30')]);_0x5db044['attributes']=_['intersection'](_0x3dedb6[_0x2dc2('0x2e')],qs['fields'](_0x2a45ae[_0x2dc2('0x30')][_0x2dc2('0x34')]));_0x5db044[_0x2dc2('0x32')]=_0x5db044[_0x2dc2('0x32')][_0x2dc2('0x35')]?_0x5db044['attributes']:_0x3dedb6[_0x2dc2('0x2e')];if(_0x2a45ae['query'][_0x2dc2('0x41')]){_0x5db044[_0x2dc2('0x42')]=[{'all':!![]}];}_0x5db044=_[_0x2dc2('0x3b')]({},_0x5db044,_0x2a45ae['options']);return db[_0x2dc2('0x29')][_0x2dc2('0x43')](_0x5db044)[_0x2dc2('0x24')](handleEntityNotFound(_0x588384,null))['then'](respondWithResult(_0x588384,null))[_0x2dc2('0x44')](handleError(_0x588384,null));};exports[_0x2dc2('0x45')]=function(_0x1fdfcd,_0x31f72b){return db[_0x2dc2('0x29')][_0x2dc2('0x45')](_0x1fdfcd[_0x2dc2('0x46')],{})[_0x2dc2('0x24')](respondWithResult(_0x31f72b,0xc9))[_0x2dc2('0x44')](handleError(_0x31f72b,null));};exports[_0x2dc2('0x23')]=function(_0x373a3b,_0x5600bc){if(_0x373a3b[_0x2dc2('0x46')]['id']){delete _0x373a3b[_0x2dc2('0x46')]['id'];}return db[_0x2dc2('0x29')]['find']({'where':{'id':_0x373a3b[_0x2dc2('0x40')]['id']}})[_0x2dc2('0x24')](handleEntityNotFound(_0x5600bc,null))[_0x2dc2('0x24')](saveUpdates(_0x373a3b[_0x2dc2('0x46')],null))[_0x2dc2('0x24')](respondWithResult(_0x5600bc,null))['catch'](handleError(_0x5600bc,null));};exports['destroy']=function(_0x320cad,_0x25a4c5){return db[_0x2dc2('0x29')]['find']({'where':{'id':_0x320cad[_0x2dc2('0x40')]['id']}})[_0x2dc2('0x24')](handleEntityNotFound(_0x25a4c5,null))[_0x2dc2('0x24')](removeEntity(_0x25a4c5,null))[_0x2dc2('0x44')](handleError(_0x25a4c5,null));};exports[_0x2dc2('0x47')]=function(_0x209ba7,_0x40d11d,_0x44c5d9){var _0x661114={};var _0x5a4fe1={};var _0x24143b;var _0x402c03;return db['FreshsalesAccount'][_0x2dc2('0x48')]({'where':{'id':_0x209ba7[_0x2dc2('0x40')]['id']}})[_0x2dc2('0x24')](handleEntityNotFound(_0x40d11d,null))[_0x2dc2('0x24')](function(_0x4cc124){if(_0x4cc124){_0x24143b=_0x4cc124;_0x5a4fe1['model']=_['keys'](db['FreshsalesConfiguration']['rawAttributes']);_0x5a4fe1[_0x2dc2('0x30')]=_[_0x2dc2('0x31')](_0x209ba7[_0x2dc2('0x30')]);_0x5a4fe1['filters']=_[_0x2dc2('0x33')](_0x5a4fe1[_0x2dc2('0x2e')],_0x5a4fe1[_0x2dc2('0x30')]);_0x661114[_0x2dc2('0x32')]=_[_0x2dc2('0x33')](_0x5a4fe1['model'],qs[_0x2dc2('0x34')](_0x209ba7['query'][_0x2dc2('0x34')]));_0x661114['attributes']=_0x661114[_0x2dc2('0x32')]['length']?_0x661114[_0x2dc2('0x32')]:_0x5a4fe1[_0x2dc2('0x2e')];_0x661114[_0x2dc2('0x49')]=qs['sort'](_0x209ba7[_0x2dc2('0x30')][_0x2dc2('0x4a')]);_0x661114[_0x2dc2('0x38')]=qs[_0x2dc2('0x39')](_[_0x2dc2('0x3a')](_0x209ba7[_0x2dc2('0x30')],_0x5a4fe1[_0x2dc2('0x39')]));if(_0x209ba7[_0x2dc2('0x30')][_0x2dc2('0x4b')]){_0x661114[_0x2dc2('0x38')]=_[_0x2dc2('0x3b')](_0x661114['where'],{'$or':_[_0x2dc2('0x2f')](_0x661114[_0x2dc2('0x32')],function(_0x5ee18d){var _0x1590a3={};_0x1590a3[_0x5ee18d]={'$like':'%'+_0x209ba7['query'][_0x2dc2('0x4b')]+'%'};return _0x1590a3;})});}_0x661114=_['merge']({},_0x661114,_0x209ba7[_0x2dc2('0x3d')]);return _0x24143b[_0x2dc2('0x47')](_0x661114);}})['then'](function(_0x4c7f88){if(_0x4c7f88){_0x402c03=_0x4c7f88['length'];if(!_0x209ba7[_0x2dc2('0x30')][_0x2dc2('0x36')]('nolimit')){_0x661114[_0x2dc2('0x1b')]=qs[_0x2dc2('0x1b')](_0x209ba7[_0x2dc2('0x30')]['limit']);_0x661114[_0x2dc2('0x19')]=qs['offset'](_0x209ba7[_0x2dc2('0x30')][_0x2dc2('0x19')]);}return _0x24143b[_0x2dc2('0x47')](_0x661114);}})[_0x2dc2('0x24')](function(_0x33e3ea){if(_0x33e3ea){return _0x33e3ea?{'count':_0x402c03,'rows':_0x33e3ea}:null;}})[_0x2dc2('0x24')](respondWithResult(_0x40d11d,null))[_0x2dc2('0x44')](handleError(_0x40d11d,null));};exports[_0x2dc2('0x4c')]=function(_0x4cb39f,_0x14abd9,_0x55fc0f){if(_0x4cb39f[_0x2dc2('0x46')]['id']){delete _0x4cb39f['body']['id'];}return db[_0x2dc2('0x29')][_0x2dc2('0x48')]({'where':{'id':_0x4cb39f[_0x2dc2('0x40')]['id']}})[_0x2dc2('0x24')](handleEntityNotFound(_0x14abd9,null))[_0x2dc2('0x24')](function(_0x6c0760){if(_0x6c0760){_0x4cb39f[_0x2dc2('0x46')][_0x2dc2('0x4d')]=_0x6c0760['id'];_0x4cb39f[_0x2dc2('0x46')][_0x2dc2('0x4e')]=integrations[_0x2dc2('0x4f')](_0x4cb39f[_0x2dc2('0x46')][_0x2dc2('0x50')],_0x4cb39f['body'][_0x2dc2('0x2c')]);_0x4cb39f[_0x2dc2('0x46')][_0x2dc2('0x51')]=integrations['getDescriptions'](_0x4cb39f[_0x2dc2('0x46')][_0x2dc2('0x50')],_0x4cb39f[_0x2dc2('0x46')][_0x2dc2('0x2c')]);return db['FreshsalesConfiguration'][_0x2dc2('0x45')](_0x4cb39f['body'],{'include':[{'model':db[_0x2dc2('0x52')],'as':_0x2dc2('0x4e')},{'model':db[_0x2dc2('0x52')],'as':_0x2dc2('0x51')}]});}return null;})['then'](respondWithResult(_0x14abd9,null))[_0x2dc2('0x44')](handleError(_0x14abd9,null));};exports[_0x2dc2('0x53')]=function(_0x53595d,_0xfb24cf,_0x484ebd){var _0x211de9='';var _0x3e88e3='';return db[_0x2dc2('0x29')]['findOne']({'where':{'id':_0x53595d[_0x2dc2('0x40')]['id']},'attributes':['id',_0x2dc2('0x54'),_0x2dc2('0x55'),_0x2dc2('0x56')]})['then'](handleEntityNotFound(_0xfb24cf,null))[_0x2dc2('0x24')](function(_0x5f4956){if(_0x5f4956){_0x3e88e3=_0x5f4956['username'];_0x211de9=_0x5f4956['remoteUri'];var _0x4a6e15=_0x5f4956[_0x2dc2('0x55')][_0x2dc2('0x57')](-0x1);if(_0x4a6e15==='/'){_0x211de9=_0x211de9[_0x2dc2('0x58')](0x0,_0x211de9[_0x2dc2('0x59')](_0x4a6e15));}return rp({'method':_0x2dc2('0x5a'),'uri':util[_0x2dc2('0x5b')](_0x2dc2('0x5c'),_0x211de9,'/api/selector/owners'),'headers':{'Authorization':_0x2dc2('0x5d')+_0x5f4956[_0x2dc2('0x56')]},'json':!![]});}})[_0x2dc2('0x24')](function(_0x2cea33){if(_0x2cea33){var _0x53cdd9=_0x2cea33[_0x2dc2('0x5e')];var _0x27be93=![];var _0x45fe6b=null;for(_0x45fe6b=0x0;_0x45fe6b<_0x53cdd9[_0x2dc2('0x35')];_0x45fe6b++){if(_0x53cdd9[_0x45fe6b][_0x2dc2('0x5f')]===_0x3e88e3){_0x27be93=!![];}}if(_0x27be93){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x2dc2('0x60')});}}})[_0x2dc2('0x24')](respondWithResult(_0xfb24cf,null))[_0x2dc2('0x44')](function(_0x1ae684){var _0x28677c=_0x53595d[_0x2dc2('0x30')][_0x2dc2('0x61')]?0x1f4:_0x1ae684[_0x2dc2('0x62')]||0x1f4;logger[_0x2dc2('0x63')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x28677c,JSON[_0x2dc2('0x64')](_0x1ae684));delete _0x1ae684[_0x2dc2('0x26')];if(_0x28677c===0x191){_0x28677c=0x190;}_0xfb24cf['status'](_0x28677c)[_0x2dc2('0x27')](_0x53595d[_0x2dc2('0x30')][_0x2dc2('0x61')]?{'message':_0x2dc2('0x65'),'statusCode':_0x1ae684[_0x2dc2('0x62')]}:_0x1ae684);});}; \ No newline at end of file +var _0x36bd=['status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','end','error','name','map','FreshsalesAccount','rawAttributes','fieldName','type','key','query','keys','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','sort','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','destroy','getConfigurations','findOne','FreshsalesConfiguration','order','pick','AccountId','Subjects','getSubjects','channel','Descriptions','FreshsalesField','getFields','username','remoteUri','slice','lastIndexOf','GET','format','%s%s','/api/selector/owners','apiKey','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus'];(function(_0x21bcb7,_0x659b85){var _0xf02118=function(_0x13ac68){while(--_0x13ac68){_0x21bcb7['push'](_0x21bcb7['shift']());}};_0xf02118(++_0x659b85);}(_0x36bd,0xb8));var _0xd36b=function(_0xe47e86,_0x130609){_0xe47e86=_0xe47e86-0x0;var _0x4e4c9f=_0x36bd[_0xe47e86];return _0x4e4c9f;};'use strict';var emlformat=require(_0xd36b('0x0'));var rimraf=require(_0xd36b('0x1'));var zipdir=require(_0xd36b('0x2'));var jsonpatch=require(_0xd36b('0x3'));var rp=require('request-promise');var moment=require(_0xd36b('0x4'));var BPromise=require(_0xd36b('0x5'));var Mustache=require(_0xd36b('0x6'));var util=require(_0xd36b('0x7'));var path=require(_0xd36b('0x8'));var sox=require(_0xd36b('0x9'));var csv=require(_0xd36b('0xa'));var ejs=require(_0xd36b('0xb'));var fs=require('fs');var fs_extra=require(_0xd36b('0xc'));var _=require('lodash');var squel=require(_0xd36b('0xd'));var crypto=require(_0xd36b('0xe'));var jsforce=require(_0xd36b('0xf'));var deskjs=require(_0xd36b('0x10'));var toCsv=require(_0xd36b('0xa'));var querystring=require('querystring');var Papa=require(_0xd36b('0x11'));var Redis=require(_0xd36b('0x12'));var authService=require(_0xd36b('0x13'));var qs=require(_0xd36b('0x14'));var as=require(_0xd36b('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd36b('0x16'))(_0xd36b('0x17'));var utils=require(_0xd36b('0x18'));var config=require(_0xd36b('0x19'));var licenseUtil=require(_0xd36b('0x1a'));var db=require(_0xd36b('0x1b'))['db'];var integrations=require(_0xd36b('0x1c'));function respondWithStatusCode(_0x4a8391,_0x524745){_0x524745=_0x524745||0xcc;return function(_0x19d73b){if(_0x19d73b){return _0x4a8391[_0xd36b('0x1d')](_0x524745);}return _0x4a8391[_0xd36b('0x1e')](_0x524745)['end']();};}function respondWithResult(_0x52cb55,_0x5d6691){_0x5d6691=_0x5d6691||0xc8;return function(_0x1a98ba){if(_0x1a98ba){return _0x52cb55['status'](_0x5d6691)[_0xd36b('0x1f')](_0x1a98ba);}};}function respondWithFilteredResult(_0x3ce985,_0x2749e8){return function(_0x240dc3){if(_0x240dc3){var _0x41063f=typeof _0x2749e8[_0xd36b('0x20')]===_0xd36b('0x21')&&typeof _0x2749e8[_0xd36b('0x22')]===_0xd36b('0x21');var _0x2a814f=_0x240dc3[_0xd36b('0x23')];var _0x251e78=_0x41063f?0x0:_0x2749e8['offset'];var _0x2b7ad8=_0x41063f?_0x240dc3[_0xd36b('0x23')]:_0x2749e8[_0xd36b('0x20')]+_0x2749e8['limit'];var _0xe52b44;if(_0x2b7ad8>=_0x2a814f){_0x2b7ad8=_0x2a814f;_0xe52b44=0xc8;}else{_0xe52b44=0xce;}_0x3ce985['status'](_0xe52b44);return _0x3ce985[_0xd36b('0x24')](_0xd36b('0x25'),_0x251e78+'-'+_0x2b7ad8+'/'+_0x2a814f)['json'](_0x240dc3);}return null;};}function patchUpdates(_0x504c69){return function(_0x6aa378){try{jsonpatch['apply'](_0x6aa378,_0x504c69,!![]);}catch(_0x218ab0){return BPromise[_0xd36b('0x26')](_0x218ab0);}return _0x6aa378[_0xd36b('0x27')]();};}function saveUpdates(_0x1dcee8,_0x12a7b7){return function(_0x594ef9){if(_0x594ef9){return _0x594ef9[_0xd36b('0x28')](_0x1dcee8)[_0xd36b('0x29')](function(_0x3ddfab){return _0x3ddfab;});}return null;};}function removeEntity(_0x282c24,_0x2e5434){return function(_0x23f8a6){if(_0x23f8a6){return _0x23f8a6['destroy']()[_0xd36b('0x29')](function(){_0x282c24[_0xd36b('0x1e')](0xcc)[_0xd36b('0x2a')]();});}};}function handleEntityNotFound(_0x37c266,_0x22e052){return function(_0x4c884e){if(!_0x4c884e){_0x37c266[_0xd36b('0x1d')](0x194);}return _0x4c884e;};}function handleError(_0x3487ba,_0x38540a){_0x38540a=_0x38540a||0x1f4;return function(_0x41bee7){logger[_0xd36b('0x2b')](_0x41bee7['stack']);if(_0x41bee7[_0xd36b('0x2c')]){delete _0x41bee7[_0xd36b('0x2c')];}_0x3487ba[_0xd36b('0x1e')](_0x38540a)['send'](_0x41bee7);};}exports['index']=function(_0x307bd1,_0x3c4cd2){var _0x373576={},_0x3337a5={},_0x1ea2c8={'count':0x0,'rows':[]};var _0x6ff7ef=_[_0xd36b('0x2d')](db[_0xd36b('0x2e')][_0xd36b('0x2f')],function(_0x3f3092){return{'name':_0x3f3092[_0xd36b('0x30')],'type':_0x3f3092[_0xd36b('0x31')][_0xd36b('0x32')]};});_0x3337a5['model']=_['map'](_0x6ff7ef,_0xd36b('0x2c'));_0x3337a5[_0xd36b('0x33')]=_[_0xd36b('0x34')](_0x307bd1[_0xd36b('0x33')]);_0x3337a5[_0xd36b('0x35')]=_['intersection'](_0x3337a5['model'],_0x3337a5[_0xd36b('0x33')]);_0x373576[_0xd36b('0x36')]=_[_0xd36b('0x37')](_0x3337a5[_0xd36b('0x38')],qs[_0xd36b('0x39')](_0x307bd1[_0xd36b('0x33')][_0xd36b('0x39')]));_0x373576[_0xd36b('0x36')]=_0x373576['attributes'][_0xd36b('0x3a')]?_0x373576[_0xd36b('0x36')]:_0x3337a5[_0xd36b('0x38')];if(!_0x307bd1[_0xd36b('0x33')][_0xd36b('0x3b')](_0xd36b('0x3c'))){_0x373576[_0xd36b('0x22')]=qs[_0xd36b('0x22')](_0x307bd1['query'][_0xd36b('0x22')]);_0x373576[_0xd36b('0x20')]=qs[_0xd36b('0x20')](_0x307bd1[_0xd36b('0x33')][_0xd36b('0x20')]);}_0x373576['order']=qs[_0xd36b('0x3d')](_0x307bd1['query'][_0xd36b('0x3d')]);_0x373576['where']=qs['filters'](_['pick'](_0x307bd1[_0xd36b('0x33')],_0x3337a5[_0xd36b('0x35')]),_0x6ff7ef);if(_0x307bd1[_0xd36b('0x33')][_0xd36b('0x3e')]){_0x373576[_0xd36b('0x3f')]=_['merge'](_0x373576[_0xd36b('0x3f')],{'$or':_[_0xd36b('0x2d')](_0x6ff7ef,function(_0x3394ad){if(_0x3394ad[_0xd36b('0x31')]!==_0xd36b('0x40')){var _0x10e00a={};_0x10e00a[_0x3394ad['name']]={'$like':'%'+_0x307bd1[_0xd36b('0x33')]['filter']+'%'};return _0x10e00a;}})});}_0x373576=_[_0xd36b('0x41')]({},_0x373576,_0x307bd1[_0xd36b('0x42')]);var _0x1c953b={'where':_0x373576[_0xd36b('0x3f')]};return db[_0xd36b('0x2e')][_0xd36b('0x23')](_0x1c953b)['then'](function(_0x23f2cb){_0x1ea2c8[_0xd36b('0x23')]=_0x23f2cb;if(_0x307bd1['query'][_0xd36b('0x43')]){_0x373576[_0xd36b('0x44')]=[{'all':!![]}];}return db[_0xd36b('0x2e')][_0xd36b('0x45')](_0x373576);})['then'](function(_0x259c1a){_0x1ea2c8[_0xd36b('0x46')]=_0x259c1a;return _0x1ea2c8;})[_0xd36b('0x29')](respondWithFilteredResult(_0x3c4cd2,_0x373576))[_0xd36b('0x47')](handleError(_0x3c4cd2,null));};exports[_0xd36b('0x48')]=function(_0x14b9b4,_0x2a019b){var _0x11794e={'raw':![],'where':{'id':_0x14b9b4[_0xd36b('0x49')]['id']}},_0x28975={};_0x28975[_0xd36b('0x38')]=_[_0xd36b('0x34')](db[_0xd36b('0x2e')]['rawAttributes']);_0x28975[_0xd36b('0x33')]=_[_0xd36b('0x34')](_0x14b9b4[_0xd36b('0x33')]);_0x28975['filters']=_[_0xd36b('0x37')](_0x28975[_0xd36b('0x38')],_0x28975['query']);_0x11794e['attributes']=_[_0xd36b('0x37')](_0x28975[_0xd36b('0x38')],qs['fields'](_0x14b9b4[_0xd36b('0x33')]['fields']));_0x11794e[_0xd36b('0x36')]=_0x11794e[_0xd36b('0x36')][_0xd36b('0x3a')]?_0x11794e['attributes']:_0x28975['model'];if(_0x14b9b4[_0xd36b('0x33')][_0xd36b('0x43')]){_0x11794e[_0xd36b('0x44')]=[{'all':!![]}];}_0x11794e=_[_0xd36b('0x41')]({},_0x11794e,_0x14b9b4[_0xd36b('0x42')]);return db[_0xd36b('0x2e')]['find'](_0x11794e)[_0xd36b('0x29')](handleEntityNotFound(_0x2a019b,null))['then'](respondWithResult(_0x2a019b,null))[_0xd36b('0x47')](handleError(_0x2a019b,null));};exports[_0xd36b('0x4a')]=function(_0x14e262,_0x3e7497){return db['FreshsalesAccount'][_0xd36b('0x4a')](_0x14e262[_0xd36b('0x4b')],{})[_0xd36b('0x29')](respondWithResult(_0x3e7497,0xc9))[_0xd36b('0x47')](handleError(_0x3e7497,null));};exports[_0xd36b('0x28')]=function(_0x32285a,_0x1a8070){if(_0x32285a[_0xd36b('0x4b')]['id']){delete _0x32285a[_0xd36b('0x4b')]['id'];}return db['FreshsalesAccount'][_0xd36b('0x4c')]({'where':{'id':_0x32285a[_0xd36b('0x49')]['id']}})['then'](handleEntityNotFound(_0x1a8070,null))[_0xd36b('0x29')](saveUpdates(_0x32285a['body'],null))[_0xd36b('0x29')](respondWithResult(_0x1a8070,null))['catch'](handleError(_0x1a8070,null));};exports[_0xd36b('0x4d')]=function(_0x214e69,_0x4e4e24){return db[_0xd36b('0x2e')][_0xd36b('0x4c')]({'where':{'id':_0x214e69[_0xd36b('0x49')]['id']}})[_0xd36b('0x29')](handleEntityNotFound(_0x4e4e24,null))['then'](removeEntity(_0x4e4e24,null))['catch'](handleError(_0x4e4e24,null));};exports[_0xd36b('0x4e')]=function(_0x173c6c,_0x58a1f8,_0x5e7968){var _0x413fad={};var _0x2a37f9={};var _0x32db86;var _0xee1323;return db[_0xd36b('0x2e')][_0xd36b('0x4f')]({'where':{'id':_0x173c6c['params']['id']}})[_0xd36b('0x29')](handleEntityNotFound(_0x58a1f8,null))['then'](function(_0x2ca94f){if(_0x2ca94f){_0x32db86=_0x2ca94f;_0x2a37f9['model']=_[_0xd36b('0x34')](db[_0xd36b('0x50')][_0xd36b('0x2f')]);_0x2a37f9[_0xd36b('0x33')]=_[_0xd36b('0x34')](_0x173c6c[_0xd36b('0x33')]);_0x2a37f9[_0xd36b('0x35')]=_['intersection'](_0x2a37f9[_0xd36b('0x38')],_0x2a37f9['query']);_0x413fad[_0xd36b('0x36')]=_[_0xd36b('0x37')](_0x2a37f9[_0xd36b('0x38')],qs[_0xd36b('0x39')](_0x173c6c['query']['fields']));_0x413fad[_0xd36b('0x36')]=_0x413fad['attributes']['length']?_0x413fad[_0xd36b('0x36')]:_0x2a37f9[_0xd36b('0x38')];_0x413fad[_0xd36b('0x51')]=qs[_0xd36b('0x3d')](_0x173c6c['query'][_0xd36b('0x3d')]);_0x413fad[_0xd36b('0x3f')]=qs[_0xd36b('0x35')](_[_0xd36b('0x52')](_0x173c6c[_0xd36b('0x33')],_0x2a37f9[_0xd36b('0x35')]));if(_0x173c6c[_0xd36b('0x33')][_0xd36b('0x3e')]){_0x413fad[_0xd36b('0x3f')]=_[_0xd36b('0x41')](_0x413fad[_0xd36b('0x3f')],{'$or':_[_0xd36b('0x2d')](_0x413fad['attributes'],function(_0xf07f16){var _0x11c26b={};_0x11c26b[_0xf07f16]={'$like':'%'+_0x173c6c[_0xd36b('0x33')]['filter']+'%'};return _0x11c26b;})});}_0x413fad=_[_0xd36b('0x41')]({},_0x413fad,_0x173c6c['options']);return _0x32db86[_0xd36b('0x4e')](_0x413fad);}})[_0xd36b('0x29')](function(_0x1977e3){if(_0x1977e3){_0xee1323=_0x1977e3[_0xd36b('0x3a')];if(!_0x173c6c[_0xd36b('0x33')][_0xd36b('0x3b')](_0xd36b('0x3c'))){_0x413fad[_0xd36b('0x22')]=qs[_0xd36b('0x22')](_0x173c6c[_0xd36b('0x33')]['limit']);_0x413fad[_0xd36b('0x20')]=qs[_0xd36b('0x20')](_0x173c6c[_0xd36b('0x33')][_0xd36b('0x20')]);}return _0x32db86[_0xd36b('0x4e')](_0x413fad);}})[_0xd36b('0x29')](function(_0x92ec40){if(_0x92ec40){return _0x92ec40?{'count':_0xee1323,'rows':_0x92ec40}:null;}})['then'](respondWithResult(_0x58a1f8,null))['catch'](handleError(_0x58a1f8,null));};exports['addConfiguration']=function(_0x1f9fab,_0x16cbd0,_0x302bff){if(_0x1f9fab[_0xd36b('0x4b')]['id']){delete _0x1f9fab[_0xd36b('0x4b')]['id'];}return db[_0xd36b('0x2e')][_0xd36b('0x4f')]({'where':{'id':_0x1f9fab[_0xd36b('0x49')]['id']}})[_0xd36b('0x29')](handleEntityNotFound(_0x16cbd0,null))[_0xd36b('0x29')](function(_0x2332f5){if(_0x2332f5){_0x1f9fab[_0xd36b('0x4b')][_0xd36b('0x53')]=_0x2332f5['id'];_0x1f9fab[_0xd36b('0x4b')][_0xd36b('0x54')]=integrations[_0xd36b('0x55')](_0x1f9fab['body'][_0xd36b('0x56')],_0x1f9fab[_0xd36b('0x4b')]['type']);_0x1f9fab[_0xd36b('0x4b')][_0xd36b('0x57')]=integrations['getDescriptions'](_0x1f9fab[_0xd36b('0x4b')][_0xd36b('0x56')],_0x1f9fab['body'][_0xd36b('0x31')]);return db['FreshsalesConfiguration'][_0xd36b('0x4a')](_0x1f9fab['body'],{'include':[{'model':db[_0xd36b('0x58')],'as':'Subjects'},{'model':db[_0xd36b('0x58')],'as':_0xd36b('0x57')}]});}return null;})[_0xd36b('0x29')](respondWithResult(_0x16cbd0,null))[_0xd36b('0x47')](handleError(_0x16cbd0,null));};exports[_0xd36b('0x59')]=function(_0x427a35,_0x7e8377,_0x4617aa){var _0x1b8257='';var _0x20bf1e='';return db[_0xd36b('0x2e')]['findOne']({'where':{'id':_0x427a35[_0xd36b('0x49')]['id']},'attributes':['id',_0xd36b('0x5a'),'remoteUri','apiKey']})[_0xd36b('0x29')](handleEntityNotFound(_0x7e8377,null))[_0xd36b('0x29')](function(_0x254a32){if(_0x254a32){_0x20bf1e=_0x254a32['username'];_0x1b8257=_0x254a32[_0xd36b('0x5b')];var _0x266eeb=_0x254a32[_0xd36b('0x5b')][_0xd36b('0x5c')](-0x1);if(_0x266eeb==='/'){_0x1b8257=_0x1b8257['substring'](0x0,_0x1b8257[_0xd36b('0x5d')](_0x266eeb));}return rp({'method':_0xd36b('0x5e'),'uri':util[_0xd36b('0x5f')](_0xd36b('0x60'),_0x1b8257,_0xd36b('0x61')),'headers':{'Authorization':'Token\x20token='+_0x254a32[_0xd36b('0x62')]},'json':!![]});}})['then'](function(_0x1948b0){if(_0x1948b0){var _0x33cce0=_0x1948b0[_0xd36b('0x63')];var _0xcc9204=![];var _0xcd217f=null;for(_0xcd217f=0x0;_0xcd217f<_0x33cce0['length'];_0xcd217f++){if(_0x33cce0[_0xcd217f][_0xd36b('0x64')]===_0x20bf1e){_0xcc9204=!![];}}if(_0xcc9204){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xd36b('0x65')});}}})[_0xd36b('0x29')](respondWithResult(_0x7e8377,null))[_0xd36b('0x47')](function(_0x56ad48){var _0x10cd13=_0x427a35[_0xd36b('0x33')][_0xd36b('0x66')]?0x1f4:_0x56ad48[_0xd36b('0x67')]||0x1f4;logger[_0xd36b('0x2b')](_0xd36b('0x68'),'getFields',_0x10cd13,JSON['stringify'](_0x56ad48));delete _0x56ad48[_0xd36b('0x2c')];if(_0x10cd13===0x191){_0x10cd13=0x190;}_0x7e8377[_0xd36b('0x1e')](_0x10cd13)[_0xd36b('0x69')](_0x427a35[_0xd36b('0x33')][_0xd36b('0x66')]?{'message':_0xd36b('0x6a'),'statusCode':_0x56ad48['statusCode']}:_0x56ad48);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 36a5089..e5ed282 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 _0x687b=['./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','int_freshsales_accounts','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0x205e0f,_0x132b77){var _0x1e3710=function(_0x1772fa){while(--_0x1772fa){_0x205e0f['push'](_0x205e0f['shift']());}};_0x1e3710(++_0x132b77);}(_0x687b,0x14a));var _0xb687=function(_0x114749,_0x9b572a){_0x114749=_0x114749-0x0;var _0x499080=_0x687b[_0x114749];return _0x499080;};'use strict';var _=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var logger=require(_0xb687('0x2'))(_0xb687('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb687('0x4'));var fs=require('fs');var path=require(_0xb687('0x5'));var rimraf=require(_0xb687('0x6'));var config=require(_0xb687('0x7'));var attributes=require(_0xb687('0x8'));var integrations=require(_0xb687('0x9'));module[_0xb687('0xa')]=function(_0xf43a1f,_0x47ffea){return _0xf43a1f[_0xb687('0xb')]('FreshsalesAccount',attributes,{'tableName':_0xb687('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7880=['bluebird','request-promise','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','FreshsalesAccount','int_freshsales_accounts','util','../../config/logger','api','moment'];(function(_0x199358,_0x4bda84){var _0x210caa=function(_0x4c4050){while(--_0x4c4050){_0x199358['push'](_0x199358['shift']());}};_0x210caa(++_0x4bda84);}(_0x7880,0x1f4));var _0x0788=function(_0x458dd2,_0xb2c6e6){_0x458dd2=_0x458dd2-0x0;var _0x470f65=_0x7880[_0x458dd2];return _0x470f65;};'use strict';var _=require('lodash');var util=require(_0x0788('0x0'));var logger=require(_0x0788('0x1'))(_0x0788('0x2'));var moment=require(_0x0788('0x3'));var BPromise=require(_0x0788('0x4'));var rp=require(_0x0788('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0788('0x6'));var config=require(_0x0788('0x7'));var attributes=require(_0x0788('0x8'));var integrations=require(_0x0788('0x9'));module[_0x0788('0xa')]=function(_0x775629,_0x3f9cb8){return _0x775629[_0x0788('0xb')](_0x0788('0xc'),attributes,{'tableName':_0x0788('0xd'),'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 bef58ad..e3b6f04 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 _0xb145=['stringify','error','FreshsalesAccount,\x20%s,\x20%s','message','result','catch','FreshsalesAccount','findAll','options','raw','attributes','limit','include','map','model','then','GetFreshsalesAccount','where','ShowFreshsalesAccount','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xb145,0xa3));var _0x5b14=function(_0x1bf9ce,_0x34fa4a){_0x1bf9ce=_0x1bf9ce-0x0;var _0xde4f2b=_0xb145[_0x1bf9ce];return _0xde4f2b;};'use strict';var _=require('lodash');var util=require(_0x5b14('0x0'));var moment=require(_0x5b14('0x1'));var BPromise=require(_0x5b14('0x2'));var rs=require(_0x5b14('0x3'));var fs=require('fs');var Redis=require(_0x5b14('0x4'));var db=require(_0x5b14('0x5'))['db'];var utils=require(_0x5b14('0x6'));var logger=require(_0x5b14('0x7'))('rpc');var config=require(_0x5b14('0x8'));var jayson=require(_0x5b14('0x9'));var client=jayson[_0x5b14('0xa')][_0x5b14('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x50fd91,_0x1d12ed,_0x2a3921){return new BPromise(function(_0x34530a,_0x62cdcd){return client[_0x5b14('0xc')](_0x50fd91,_0x2a3921)['then'](function(_0x32d729){logger[_0x5b14('0xd')]('FreshsalesAccount,\x20%s,\x20%s',_0x1d12ed,_0x5b14('0xe'));logger[_0x5b14('0xf')](_0x5b14('0x10'),_0x1d12ed,_0x5b14('0xe'),JSON[_0x5b14('0x11')](_0x32d729));if(_0x32d729['error']){if(_0x32d729[_0x5b14('0x12')]['code']===0x1f4){logger[_0x5b14('0x12')](_0x5b14('0x13'),_0x1d12ed,_0x32d729[_0x5b14('0x12')][_0x5b14('0x14')]);return _0x62cdcd(_0x32d729[_0x5b14('0x12')][_0x5b14('0x14')]);}logger['error'](_0x5b14('0x13'),_0x1d12ed,_0x32d729[_0x5b14('0x12')][_0x5b14('0x14')]);return _0x34530a(_0x32d729[_0x5b14('0x12')][_0x5b14('0x14')]);}else{logger[_0x5b14('0xd')](_0x5b14('0x13'),_0x1d12ed,_0x5b14('0xe'));_0x34530a(_0x32d729[_0x5b14('0x15')][_0x5b14('0x14')]);}})[_0x5b14('0x16')](function(_0x2c3efb){logger['error'](_0x5b14('0x13'),_0x1d12ed,_0x2c3efb);_0x62cdcd(_0x2c3efb);});});}exports['GetFreshsalesAccount']=function(_0x48d395){var _0x58bf3c=this;return new Promise(function(_0x3f397d,_0x3035b5){return db[_0x5b14('0x17')][_0x5b14('0x18')]({'raw':_0x48d395[_0x5b14('0x19')]?_0x48d395[_0x5b14('0x19')][_0x5b14('0x1a')]===undefined?!![]:![]:!![],'where':_0x48d395['options']?_0x48d395['options']['where']||null:null,'attributes':_0x48d395[_0x5b14('0x19')]?_0x48d395[_0x5b14('0x19')][_0x5b14('0x1b')]||null:null,'limit':_0x48d395[_0x5b14('0x19')]?_0x48d395['options'][_0x5b14('0x1c')]||null:null,'include':_0x48d395[_0x5b14('0x19')]?_0x48d395['options'][_0x5b14('0x1d')]?_[_0x5b14('0x1e')](_0x48d395['options'][_0x5b14('0x1d')],function(_0x54073f){return{'model':db[_0x54073f['model']],'as':_0x54073f['as'],'attributes':_0x54073f['attributes'],'include':_0x54073f['include']?_[_0x5b14('0x1e')](_0x54073f[_0x5b14('0x1d')],function(_0x153a25){return{'model':db[_0x153a25['model']],'as':_0x153a25['as'],'attributes':_0x153a25[_0x5b14('0x1b')],'include':_0x153a25[_0x5b14('0x1d')]?_[_0x5b14('0x1e')](_0x153a25[_0x5b14('0x1d')],function(_0xe6851b){return{'model':db[_0xe6851b[_0x5b14('0x1f')]],'as':_0xe6851b['as'],'attributes':_0xe6851b[_0x5b14('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x5b14('0x20')](function(_0x296d65){logger[_0x5b14('0xd')](_0x5b14('0x21'),_0x48d395);logger[_0x5b14('0xf')](_0x5b14('0x21'),_0x48d395,JSON[_0x5b14('0x11')](_0x296d65));_0x3f397d(_0x296d65);})['catch'](function(_0x370fcd){logger[_0x5b14('0x12')]('GetFreshsalesAccount',_0x370fcd['message'],_0x48d395);_0x3035b5(_0x58bf3c[_0x5b14('0x12')](0x1f4,_0x370fcd[_0x5b14('0x14')]));});});};exports['ShowFreshsalesAccount']=function(_0x4c1f0e){var _0x21b43b=this;return new Promise(function(_0x4d3905,_0x38c665){return db[_0x5b14('0x17')]['find']({'raw':_0x4c1f0e['options']?_0x4c1f0e[_0x5b14('0x19')][_0x5b14('0x1a')]===undefined?!![]:![]:!![],'where':_0x4c1f0e[_0x5b14('0x19')]?_0x4c1f0e['options'][_0x5b14('0x22')]||null:null,'attributes':_0x4c1f0e['options']?_0x4c1f0e[_0x5b14('0x19')][_0x5b14('0x1b')]||null:null,'include':_0x4c1f0e[_0x5b14('0x19')]?_0x4c1f0e[_0x5b14('0x19')]['include']?_[_0x5b14('0x1e')](_0x4c1f0e[_0x5b14('0x19')][_0x5b14('0x1d')],function(_0x37f62c){return{'model':db[_0x37f62c['model']],'as':_0x37f62c['as'],'attributes':_0x37f62c[_0x5b14('0x1b')],'include':_0x37f62c[_0x5b14('0x1d')]?_[_0x5b14('0x1e')](_0x37f62c['include'],function(_0x2fe74d){return{'model':db[_0x2fe74d['model']],'as':_0x2fe74d['as'],'attributes':_0x2fe74d[_0x5b14('0x1b')],'include':_0x2fe74d[_0x5b14('0x1d')]?_['map'](_0x2fe74d[_0x5b14('0x1d')],function(_0x2a83d4){return{'model':db[_0x2a83d4['model']],'as':_0x2a83d4['as'],'attributes':_0x2a83d4[_0x5b14('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1ce6bb){logger[_0x5b14('0xd')](_0x5b14('0x23'),_0x4c1f0e);logger[_0x5b14('0xf')]('ShowFreshsalesAccount',_0x4c1f0e,JSON[_0x5b14('0x11')](_0x1ce6bb));_0x4d3905(_0x1ce6bb);})[_0x5b14('0x16')](function(_0x15d4c4){logger[_0x5b14('0x12')](_0x5b14('0x23'),_0x15d4c4[_0x5b14('0x14')],_0x4c1f0e);_0x38c665(_0x21b43b[_0x5b14('0x12')](0x1f4,_0x15d4c4[_0x5b14('0x14')]));});});}; \ No newline at end of file +var _0x1883=['GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','attributes','limit','include','map','model','then','info','find','where','ShowFreshsalesAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch'];(function(_0x4000c4,_0x370170){var _0x48728f=function(_0x215851){while(--_0x215851){_0x4000c4['push'](_0x4000c4['shift']());}};_0x48728f(++_0x370170);}(_0x1883,0xab));var _0x3188=function(_0x2af739,_0x522d97){_0x2af739=_0x2af739-0x0;var _0xf420a3=_0x1883[_0x2af739];return _0xf420a3;};'use strict';var _=require(_0x3188('0x0'));var util=require(_0x3188('0x1'));var moment=require(_0x3188('0x2'));var BPromise=require(_0x3188('0x3'));var rs=require(_0x3188('0x4'));var fs=require('fs');var Redis=require(_0x3188('0x5'));var db=require(_0x3188('0x6'))['db'];var utils=require(_0x3188('0x7'));var logger=require(_0x3188('0x8'))(_0x3188('0x9'));var config=require(_0x3188('0xa'));var jayson=require(_0x3188('0xb'));var client=jayson[_0x3188('0xc')][_0x3188('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x24f2f1,_0x3ce7fd,_0x3e3afb){return new BPromise(function(_0x5c8f26,_0x446ab7){return client[_0x3188('0xe')](_0x24f2f1,_0x3e3afb)['then'](function(_0x2213b5){logger['info'](_0x3188('0xf'),_0x3ce7fd,_0x3188('0x10'));logger[_0x3188('0x11')](_0x3188('0x12'),_0x3ce7fd,'request\x20sent',JSON[_0x3188('0x13')](_0x2213b5));if(_0x2213b5[_0x3188('0x14')]){if(_0x2213b5['error']['code']===0x1f4){logger[_0x3188('0x14')](_0x3188('0xf'),_0x3ce7fd,_0x2213b5[_0x3188('0x14')][_0x3188('0x15')]);return _0x446ab7(_0x2213b5[_0x3188('0x14')][_0x3188('0x15')]);}logger['error'](_0x3188('0xf'),_0x3ce7fd,_0x2213b5['error']['message']);return _0x5c8f26(_0x2213b5[_0x3188('0x14')]['message']);}else{logger['info'](_0x3188('0xf'),_0x3ce7fd,_0x3188('0x10'));_0x5c8f26(_0x2213b5[_0x3188('0x16')][_0x3188('0x15')]);}})[_0x3188('0x17')](function(_0x259321){logger['error'](_0x3188('0xf'),_0x3ce7fd,_0x259321);_0x446ab7(_0x259321);});});}exports[_0x3188('0x18')]=function(_0x3f5b35){var _0x37e646=this;return new Promise(function(_0x18a71a,_0x4f27b0){return db[_0x3188('0x19')][_0x3188('0x1a')]({'raw':_0x3f5b35['options']?_0x3f5b35[_0x3188('0x1b')][_0x3188('0x1c')]===undefined?!![]:![]:!![],'where':_0x3f5b35['options']?_0x3f5b35['options']['where']||null:null,'attributes':_0x3f5b35[_0x3188('0x1b')]?_0x3f5b35[_0x3188('0x1b')][_0x3188('0x1d')]||null:null,'limit':_0x3f5b35['options']?_0x3f5b35['options'][_0x3188('0x1e')]||null:null,'include':_0x3f5b35[_0x3188('0x1b')]?_0x3f5b35[_0x3188('0x1b')][_0x3188('0x1f')]?_[_0x3188('0x20')](_0x3f5b35['options'][_0x3188('0x1f')],function(_0x33f882){return{'model':db[_0x33f882['model']],'as':_0x33f882['as'],'attributes':_0x33f882[_0x3188('0x1d')],'include':_0x33f882['include']?_['map'](_0x33f882[_0x3188('0x1f')],function(_0x129bd7){return{'model':db[_0x129bd7[_0x3188('0x21')]],'as':_0x129bd7['as'],'attributes':_0x129bd7[_0x3188('0x1d')],'include':_0x129bd7[_0x3188('0x1f')]?_[_0x3188('0x20')](_0x129bd7[_0x3188('0x1f')],function(_0x11021c){return{'model':db[_0x11021c['model']],'as':_0x11021c['as'],'attributes':_0x11021c[_0x3188('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x3188('0x22')](function(_0x52bb13){logger[_0x3188('0x23')](_0x3188('0x18'),_0x3f5b35);logger[_0x3188('0x11')](_0x3188('0x18'),_0x3f5b35,JSON[_0x3188('0x13')](_0x52bb13));_0x18a71a(_0x52bb13);})[_0x3188('0x17')](function(_0x8f810f){logger[_0x3188('0x14')]('GetFreshsalesAccount',_0x8f810f[_0x3188('0x15')],_0x3f5b35);_0x4f27b0(_0x37e646['error'](0x1f4,_0x8f810f[_0x3188('0x15')]));});});};exports['ShowFreshsalesAccount']=function(_0x3f82ce){var _0x80f9a8=this;return new Promise(function(_0x3be4f7,_0xacdad7){return db[_0x3188('0x19')][_0x3188('0x24')]({'raw':_0x3f82ce[_0x3188('0x1b')]?_0x3f82ce[_0x3188('0x1b')][_0x3188('0x1c')]===undefined?!![]:![]:!![],'where':_0x3f82ce[_0x3188('0x1b')]?_0x3f82ce[_0x3188('0x1b')][_0x3188('0x25')]||null:null,'attributes':_0x3f82ce[_0x3188('0x1b')]?_0x3f82ce[_0x3188('0x1b')][_0x3188('0x1d')]||null:null,'include':_0x3f82ce[_0x3188('0x1b')]?_0x3f82ce[_0x3188('0x1b')][_0x3188('0x1f')]?_['map'](_0x3f82ce[_0x3188('0x1b')]['include'],function(_0x1c945e){return{'model':db[_0x1c945e[_0x3188('0x21')]],'as':_0x1c945e['as'],'attributes':_0x1c945e['attributes'],'include':_0x1c945e[_0x3188('0x1f')]?_[_0x3188('0x20')](_0x1c945e[_0x3188('0x1f')],function(_0x6d503d){return{'model':db[_0x6d503d[_0x3188('0x21')]],'as':_0x6d503d['as'],'attributes':_0x6d503d[_0x3188('0x1d')],'include':_0x6d503d[_0x3188('0x1f')]?_['map'](_0x6d503d['include'],function(_0xa876c8){return{'model':db[_0xa876c8[_0x3188('0x21')]],'as':_0xa876c8['as'],'attributes':_0xa876c8[_0x3188('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x3188('0x22')](function(_0x4a64a4){logger[_0x3188('0x23')](_0x3188('0x26'),_0x3f82ce);logger[_0x3188('0x11')](_0x3188('0x26'),_0x3f82ce,JSON['stringify'](_0x4a64a4));_0x3be4f7(_0x4a64a4);})[_0x3188('0x17')](function(_0x4a290f){logger[_0x3188('0x14')]('ShowFreshsalesAccount',_0x4a290f[_0x3188('0x15')],_0x3f82ce);_0xacdad7(_0x80f9a8[_0x3188('0x14')](0x1f4,_0x4a290f[_0x3188('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 8f8101e..a2ef05b 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 _0x982d=['../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/descriptions','getDescriptions','getFields','post','put','update','delete','exports','multer','util','path','express','Router','fs-extra'];(function(_0x5bc977,_0x38f404){var _0x2ba355=function(_0x5f1e98){while(--_0x5f1e98){_0x5bc977['push'](_0x5bc977['shift']());}};_0x2ba355(++_0x38f404);}(_0x982d,0x1f4));var _0xd982=function(_0x3495fb,_0x569886){_0x3495fb=_0x3495fb-0x0;var _0x31f65b=_0x982d[_0x3495fb];return _0x31f65b;};'use strict';var multer=require(_0xd982('0x0'));var util=require(_0xd982('0x1'));var path=require(_0xd982('0x2'));var timeout=require('connect-timeout');var express=require(_0xd982('0x3'));var router=express[_0xd982('0x4')]();var fs_extra=require(_0xd982('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd982('0x6'));var config=require(_0xd982('0x7'));var controller=require(_0xd982('0x8'));router[_0xd982('0x9')]('/',auth[_0xd982('0xa')](),controller[_0xd982('0xb')]);router[_0xd982('0x9')](_0xd982('0xc'),auth[_0xd982('0xa')](),controller[_0xd982('0xd')]);router[_0xd982('0x9')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0xd982('0x9')](_0xd982('0xe'),auth[_0xd982('0xa')](),controller[_0xd982('0xf')]);router['get']('/:id/fields',auth['isAuthenticated'](),controller[_0xd982('0x10')]);router[_0xd982('0x11')]('/',auth[_0xd982('0xa')](),controller['create']);router[_0xd982('0x12')](_0xd982('0xc'),auth[_0xd982('0xa')](),controller[_0xd982('0x13')]);router[_0xd982('0x14')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xd982('0x15')]=router; \ No newline at end of file +var _0x5649=['util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./intFreshsalesConfiguration.controller','get','/:id','isAuthenticated','show','/:id/subjects','getSubjects','/:id/descriptions','/:id/fields','getFields','post','put','update','delete','destroy','exports','multer'];(function(_0x4fb122,_0x38df6a){var _0x78527=function(_0x193d37){while(--_0x193d37){_0x4fb122['push'](_0x4fb122['shift']());}};_0x78527(++_0x38df6a);}(_0x5649,0xa0));var _0x9564=function(_0x515be2,_0x51b3ff){_0x515be2=_0x515be2-0x0;var _0x514679=_0x5649[_0x515be2];return _0x514679;};'use strict';var multer=require(_0x9564('0x0'));var util=require(_0x9564('0x1'));var path=require(_0x9564('0x2'));var timeout=require(_0x9564('0x3'));var express=require('express');var router=express[_0x9564('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9564('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9564('0x6'));var controller=require(_0x9564('0x7'));router[_0x9564('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x9564('0x9'),auth[_0x9564('0xa')](),controller[_0x9564('0xb')]);router['get'](_0x9564('0xc'),auth['isAuthenticated'](),controller[_0x9564('0xd')]);router[_0x9564('0x8')](_0x9564('0xe'),auth[_0x9564('0xa')](),controller['getDescriptions']);router['get'](_0x9564('0xf'),auth['isAuthenticated'](),controller[_0x9564('0x10')]);router[_0x9564('0x11')]('/',auth[_0x9564('0xa')](),controller['create']);router[_0x9564('0x12')]('/:id',auth[_0x9564('0xa')](),controller[_0x9564('0x13')]);router[_0x9564('0x14')](_0x9564('0x9'),auth['isAuthenticated'](),controller[_0x9564('0x15')]);module[_0x9564('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 9790022..8fdbf31 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 _0xc7ee=['sequelize','exports','STRING'];(function(_0x477b42,_0x1c141f){var _0x13998e=function(_0x24f3c6){while(--_0x24f3c6){_0x477b42['push'](_0x477b42['shift']());}};_0x13998e(++_0x1c141f);}(_0xc7ee,0x18f));var _0xec7e=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xc7ee[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require(_0xec7e('0x0'));module[_0xec7e('0x1')]={'name':{'type':Sequelize[_0xec7e('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xbf72=['exports','STRING','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbf72,0x134));var _0x2bf7=function(_0xb5d52f,_0x1f876c){_0xb5d52f=_0xb5d52f-0x0;var _0x28dca3=_0xbf72[_0xb5d52f];return _0x28dca3;};'use strict';var Sequelize=require(_0x2bf7('0x0'));module[_0x2bf7('0x1')]={'name':{'type':Sequelize[_0x2bf7('0x2')]},'description':{'type':Sequelize[_0x2bf7('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index b091105..1226088 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 _0xa240=['sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','reject','save','update','destroy','then','error','stack','name','send','index','map','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','FreshsalesConfiguration','include','findAll','rows','catch','show','params','rawAttributes','includeAll','options','find','create','body','getSubjects','findOne','getDescriptions','FreshsalesField','pick','getFields','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','ioredis','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x1895b7,_0x21fbc7){var _0x1aecdc=function(_0x44682a){while(--_0x44682a){_0x1895b7['push'](_0x1895b7['shift']());}};_0x1aecdc(++_0x21fbc7);}(_0xa240,0xd7));var _0x0a24=function(_0x5c5c52,_0x36d085){_0x5c5c52=_0x5c5c52-0x0;var _0x4229ff=_0xa240[_0x5c5c52];return _0x4229ff;};'use strict';var emlformat=require(_0x0a24('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0a24('0x1'));var jsonpatch=require(_0x0a24('0x2'));var rp=require(_0x0a24('0x3'));var moment=require(_0x0a24('0x4'));var BPromise=require(_0x0a24('0x5'));var Mustache=require(_0x0a24('0x6'));var util=require(_0x0a24('0x7'));var path=require('path');var sox=require(_0x0a24('0x8'));var csv=require(_0x0a24('0x9'));var ejs=require(_0x0a24('0xa'));var fs=require('fs');var fs_extra=require(_0x0a24('0xb'));var _=require('lodash');var squel=require(_0x0a24('0xc'));var crypto=require('crypto');var jsforce=require(_0x0a24('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x0a24('0x9'));var querystring=require(_0x0a24('0xe'));var Papa=require('papaparse');var Redis=require(_0x0a24('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0a24('0x10'));var logger=require('../../config/logger')(_0x0a24('0x11'));var utils=require(_0x0a24('0x12'));var config=require(_0x0a24('0x13'));var licenseUtil=require(_0x0a24('0x14'));var db=require(_0x0a24('0x15'))['db'];function respondWithStatusCode(_0xcf7449,_0x18b774){_0x18b774=_0x18b774||0xcc;return function(_0x521dd9){if(_0x521dd9){return _0xcf7449[_0x0a24('0x16')](_0x18b774);}return _0xcf7449[_0x0a24('0x17')](_0x18b774)[_0x0a24('0x18')]();};}function respondWithResult(_0x269f57,_0x2bfcfd){_0x2bfcfd=_0x2bfcfd||0xc8;return function(_0x42e765){if(_0x42e765){return _0x269f57[_0x0a24('0x17')](_0x2bfcfd)[_0x0a24('0x19')](_0x42e765);}};}function respondWithFilteredResult(_0xad9964,_0xf7b1d4){return function(_0x1b41f9){if(_0x1b41f9){var _0x578aa6=typeof _0xf7b1d4['offset']===_0x0a24('0x1a')&&typeof _0xf7b1d4[_0x0a24('0x1b')]===_0x0a24('0x1a');var _0x791896=_0x1b41f9['count'];var _0x51907b=_0x578aa6?0x0:_0xf7b1d4[_0x0a24('0x1c')];var _0x1efdd5=_0x578aa6?_0x1b41f9[_0x0a24('0x1d')]:_0xf7b1d4[_0x0a24('0x1c')]+_0xf7b1d4['limit'];var _0x13e091;if(_0x1efdd5>=_0x791896){_0x1efdd5=_0x791896;_0x13e091=0xc8;}else{_0x13e091=0xce;}_0xad9964[_0x0a24('0x17')](_0x13e091);return _0xad9964[_0x0a24('0x1e')](_0x0a24('0x1f'),_0x51907b+'-'+_0x1efdd5+'/'+_0x791896)[_0x0a24('0x19')](_0x1b41f9);}return null;};}function patchUpdates(_0x5272fe){return function(_0x431b18){try{jsonpatch['apply'](_0x431b18,_0x5272fe,!![]);}catch(_0x155158){return BPromise[_0x0a24('0x20')](_0x155158);}return _0x431b18[_0x0a24('0x21')]();};}function saveUpdates(_0x5ef7b1,_0x1c188d){return function(_0x46975e){if(_0x46975e){return _0x46975e[_0x0a24('0x22')](_0x5ef7b1)['then'](function(_0x365182){return _0x365182;});}return null;};}function removeEntity(_0x3988c9,_0x2f7717){return function(_0x1d90b9){if(_0x1d90b9){return _0x1d90b9[_0x0a24('0x23')]()[_0x0a24('0x24')](function(){_0x3988c9[_0x0a24('0x17')](0xcc)[_0x0a24('0x18')]();});}};}function handleEntityNotFound(_0x340800,_0x39a9e7){return function(_0x9fa928){if(!_0x9fa928){_0x340800['sendStatus'](0x194);}return _0x9fa928;};}function handleError(_0x302326,_0x3532d5){_0x3532d5=_0x3532d5||0x1f4;return function(_0x222547){logger[_0x0a24('0x25')](_0x222547[_0x0a24('0x26')]);if(_0x222547[_0x0a24('0x27')]){delete _0x222547[_0x0a24('0x27')];}_0x302326['status'](_0x3532d5)[_0x0a24('0x28')](_0x222547);};}exports[_0x0a24('0x29')]=function(_0x5e1cce,_0x11d752){var _0x83de4={},_0x1c9130={},_0x2daef3={'count':0x0,'rows':[]};var _0x53828b=_[_0x0a24('0x2a')](db['FreshsalesConfiguration']['rawAttributes'],function(_0xe4bbc6){return{'name':_0xe4bbc6[_0x0a24('0x2b')],'type':_0xe4bbc6['type']['key']};});_0x1c9130[_0x0a24('0x2c')]=_[_0x0a24('0x2a')](_0x53828b,'name');_0x1c9130[_0x0a24('0x2d')]=_[_0x0a24('0x2e')](_0x5e1cce[_0x0a24('0x2d')]);_0x1c9130[_0x0a24('0x2f')]=_[_0x0a24('0x30')](_0x1c9130['model'],_0x1c9130[_0x0a24('0x2d')]);_0x83de4[_0x0a24('0x31')]=_[_0x0a24('0x30')](_0x1c9130[_0x0a24('0x2c')],qs[_0x0a24('0x32')](_0x5e1cce['query'][_0x0a24('0x32')]));_0x83de4[_0x0a24('0x31')]=_0x83de4[_0x0a24('0x31')][_0x0a24('0x33')]?_0x83de4[_0x0a24('0x31')]:_0x1c9130[_0x0a24('0x2c')];if(!_0x5e1cce[_0x0a24('0x2d')][_0x0a24('0x34')](_0x0a24('0x35'))){_0x83de4[_0x0a24('0x1b')]=qs['limit'](_0x5e1cce[_0x0a24('0x2d')][_0x0a24('0x1b')]);_0x83de4['offset']=qs[_0x0a24('0x1c')](_0x5e1cce[_0x0a24('0x2d')]['offset']);}_0x83de4[_0x0a24('0x36')]=qs[_0x0a24('0x37')](_0x5e1cce['query'][_0x0a24('0x37')]);_0x83de4[_0x0a24('0x38')]=qs['filters'](_['pick'](_0x5e1cce['query'],_0x1c9130[_0x0a24('0x2f')]),_0x53828b);if(_0x5e1cce[_0x0a24('0x2d')][_0x0a24('0x39')]){_0x83de4[_0x0a24('0x38')]=_['merge'](_0x83de4[_0x0a24('0x38')],{'$or':_['map'](_0x53828b,function(_0x524134){if(_0x524134['type']!==_0x0a24('0x3a')){var _0x47301a={};_0x47301a[_0x524134[_0x0a24('0x27')]]={'$like':'%'+_0x5e1cce[_0x0a24('0x2d')][_0x0a24('0x39')]+'%'};return _0x47301a;}})});}_0x83de4=_[_0x0a24('0x3b')]({},_0x83de4,_0x5e1cce['options']);var _0x5e8c89={'where':_0x83de4['where']};return db[_0x0a24('0x3c')]['count'](_0x5e8c89)[_0x0a24('0x24')](function(_0x40b252){_0x2daef3[_0x0a24('0x1d')]=_0x40b252;if(_0x5e1cce[_0x0a24('0x2d')]['includeAll']){_0x83de4[_0x0a24('0x3d')]=[{'all':!![]}];}return db[_0x0a24('0x3c')][_0x0a24('0x3e')](_0x83de4);})['then'](function(_0x21333f){_0x2daef3[_0x0a24('0x3f')]=_0x21333f;return _0x2daef3;})[_0x0a24('0x24')](respondWithFilteredResult(_0x11d752,_0x83de4))[_0x0a24('0x40')](handleError(_0x11d752,null));};exports[_0x0a24('0x41')]=function(_0x26f5f2,_0x5908ca){var _0x56301a={'raw':![],'where':{'id':_0x26f5f2[_0x0a24('0x42')]['id']}},_0x2cdcc2={};_0x2cdcc2[_0x0a24('0x2c')]=_[_0x0a24('0x2e')](db['FreshsalesConfiguration'][_0x0a24('0x43')]);_0x2cdcc2[_0x0a24('0x2d')]=_[_0x0a24('0x2e')](_0x26f5f2[_0x0a24('0x2d')]);_0x2cdcc2[_0x0a24('0x2f')]=_[_0x0a24('0x30')](_0x2cdcc2[_0x0a24('0x2c')],_0x2cdcc2[_0x0a24('0x2d')]);_0x56301a['attributes']=_[_0x0a24('0x30')](_0x2cdcc2['model'],qs[_0x0a24('0x32')](_0x26f5f2[_0x0a24('0x2d')]['fields']));_0x56301a[_0x0a24('0x31')]=_0x56301a[_0x0a24('0x31')][_0x0a24('0x33')]?_0x56301a['attributes']:_0x2cdcc2[_0x0a24('0x2c')];if(_0x26f5f2[_0x0a24('0x2d')][_0x0a24('0x44')]){_0x56301a[_0x0a24('0x3d')]=[{'all':!![]}];}_0x56301a=_[_0x0a24('0x3b')]({},_0x56301a,_0x26f5f2[_0x0a24('0x45')]);return db[_0x0a24('0x3c')][_0x0a24('0x46')](_0x56301a)[_0x0a24('0x24')](handleEntityNotFound(_0x5908ca,null))[_0x0a24('0x24')](respondWithResult(_0x5908ca,null))['catch'](handleError(_0x5908ca,null));};exports[_0x0a24('0x47')]=function(_0x255653,_0x2dccef){return db[_0x0a24('0x3c')][_0x0a24('0x47')](_0x255653['body'],{})[_0x0a24('0x24')](respondWithResult(_0x2dccef,0xc9))['catch'](handleError(_0x2dccef,null));};exports[_0x0a24('0x22')]=function(_0x2dbdea,_0x3e734c){if(_0x2dbdea[_0x0a24('0x48')]['id']){delete _0x2dbdea[_0x0a24('0x48')]['id'];}return db[_0x0a24('0x3c')][_0x0a24('0x46')]({'where':{'id':_0x2dbdea[_0x0a24('0x42')]['id']}})[_0x0a24('0x24')](handleEntityNotFound(_0x3e734c,null))[_0x0a24('0x24')](saveUpdates(_0x2dbdea['body'],null))['then'](respondWithResult(_0x3e734c,null))[_0x0a24('0x40')](handleError(_0x3e734c,null));};exports[_0x0a24('0x23')]=function(_0x1449f6,_0x5d2ecd){return db['FreshsalesConfiguration'][_0x0a24('0x46')]({'where':{'id':_0x1449f6[_0x0a24('0x42')]['id']}})['then'](handleEntityNotFound(_0x5d2ecd,null))[_0x0a24('0x24')](removeEntity(_0x5d2ecd,null))['catch'](handleError(_0x5d2ecd,null));};exports[_0x0a24('0x49')]=function(_0x24dfc0,_0x2a5490,_0x2ceb1a){var _0x213e0a={};var _0x5e07a3={};var _0x3e1dd0;var _0x4703cd;return db[_0x0a24('0x3c')][_0x0a24('0x4a')]({'where':{'id':_0x24dfc0['params']['id']}})[_0x0a24('0x24')](handleEntityNotFound(_0x2a5490,null))[_0x0a24('0x24')](function(_0x189d64){if(_0x189d64){_0x3e1dd0=_0x189d64;_0x5e07a3['model']=_[_0x0a24('0x2e')](db['FreshsalesField']['rawAttributes']);_0x5e07a3[_0x0a24('0x2d')]=_['keys'](_0x24dfc0['query']);_0x5e07a3[_0x0a24('0x2f')]=_['intersection'](_0x5e07a3[_0x0a24('0x2c')],_0x5e07a3[_0x0a24('0x2d')]);_0x213e0a['attributes']=_[_0x0a24('0x30')](_0x5e07a3[_0x0a24('0x2c')],qs[_0x0a24('0x32')](_0x24dfc0['query'][_0x0a24('0x32')]));_0x213e0a['attributes']=_0x213e0a[_0x0a24('0x31')]['length']?_0x213e0a[_0x0a24('0x31')]:_0x5e07a3[_0x0a24('0x2c')];_0x213e0a[_0x0a24('0x36')]=qs[_0x0a24('0x37')](_0x24dfc0[_0x0a24('0x2d')]['sort']);_0x213e0a[_0x0a24('0x38')]=qs[_0x0a24('0x2f')](_['pick'](_0x24dfc0['query'],_0x5e07a3[_0x0a24('0x2f')]));if(_0x24dfc0[_0x0a24('0x2d')][_0x0a24('0x39')]){_0x213e0a[_0x0a24('0x38')]=_[_0x0a24('0x3b')](_0x213e0a['where'],{'$or':_[_0x0a24('0x2a')](_0x213e0a[_0x0a24('0x31')],function(_0x10b043){var _0x302ca9={};_0x302ca9[_0x10b043]={'$like':'%'+_0x24dfc0[_0x0a24('0x2d')][_0x0a24('0x39')]+'%'};return _0x302ca9;})});}_0x213e0a=_[_0x0a24('0x3b')]({},_0x213e0a,_0x24dfc0['options']);return _0x3e1dd0['getSubjects'](_0x213e0a);}})['then'](function(_0x3128bb){if(_0x3128bb){_0x4703cd=_0x3128bb[_0x0a24('0x33')];if(!_0x24dfc0[_0x0a24('0x2d')][_0x0a24('0x34')]('nolimit')){_0x213e0a[_0x0a24('0x1b')]=qs[_0x0a24('0x1b')](_0x24dfc0['query']['limit']);_0x213e0a[_0x0a24('0x1c')]=qs[_0x0a24('0x1c')](_0x24dfc0[_0x0a24('0x2d')][_0x0a24('0x1c')]);}return _0x3e1dd0[_0x0a24('0x49')](_0x213e0a);}})[_0x0a24('0x24')](function(_0x207349){if(_0x207349){return _0x207349?{'count':_0x4703cd,'rows':_0x207349}:null;}})[_0x0a24('0x24')](respondWithResult(_0x2a5490,null))[_0x0a24('0x40')](handleError(_0x2a5490,null));};exports[_0x0a24('0x4b')]=function(_0x44b402,_0x50ddb6,_0x3ab223){var _0x2c4030={};var _0x5bbd2b={};var _0x111c81;var _0x2c59c2;return db[_0x0a24('0x3c')][_0x0a24('0x4a')]({'where':{'id':_0x44b402['params']['id']}})[_0x0a24('0x24')](handleEntityNotFound(_0x50ddb6,null))['then'](function(_0x106555){if(_0x106555){_0x111c81=_0x106555;_0x5bbd2b[_0x0a24('0x2c')]=_[_0x0a24('0x2e')](db['FreshsalesField']['rawAttributes']);_0x5bbd2b[_0x0a24('0x2d')]=_[_0x0a24('0x2e')](_0x44b402[_0x0a24('0x2d')]);_0x5bbd2b['filters']=_[_0x0a24('0x30')](_0x5bbd2b[_0x0a24('0x2c')],_0x5bbd2b[_0x0a24('0x2d')]);_0x2c4030[_0x0a24('0x31')]=_[_0x0a24('0x30')](_0x5bbd2b[_0x0a24('0x2c')],qs[_0x0a24('0x32')](_0x44b402[_0x0a24('0x2d')][_0x0a24('0x32')]));_0x2c4030['attributes']=_0x2c4030[_0x0a24('0x31')]['length']?_0x2c4030[_0x0a24('0x31')]:_0x5bbd2b[_0x0a24('0x2c')];_0x2c4030['order']=qs[_0x0a24('0x37')](_0x44b402['query'][_0x0a24('0x37')]);_0x2c4030[_0x0a24('0x38')]=qs['filters'](_['pick'](_0x44b402[_0x0a24('0x2d')],_0x5bbd2b[_0x0a24('0x2f')]));if(_0x44b402[_0x0a24('0x2d')][_0x0a24('0x39')]){_0x2c4030[_0x0a24('0x38')]=_[_0x0a24('0x3b')](_0x2c4030[_0x0a24('0x38')],{'$or':_[_0x0a24('0x2a')](_0x2c4030['attributes'],function(_0x12949e){var _0x36b4bf={};_0x36b4bf[_0x12949e]={'$like':'%'+_0x44b402[_0x0a24('0x2d')][_0x0a24('0x39')]+'%'};return _0x36b4bf;})});}_0x2c4030=_[_0x0a24('0x3b')]({},_0x2c4030,_0x44b402[_0x0a24('0x45')]);return _0x111c81[_0x0a24('0x4b')](_0x2c4030);}})['then'](function(_0x816175){if(_0x816175){_0x2c59c2=_0x816175[_0x0a24('0x33')];if(!_0x44b402['query']['hasOwnProperty'](_0x0a24('0x35'))){_0x2c4030[_0x0a24('0x1b')]=qs[_0x0a24('0x1b')](_0x44b402[_0x0a24('0x2d')][_0x0a24('0x1b')]);_0x2c4030[_0x0a24('0x1c')]=qs[_0x0a24('0x1c')](_0x44b402[_0x0a24('0x2d')][_0x0a24('0x1c')]);}return _0x111c81[_0x0a24('0x4b')](_0x2c4030);}})[_0x0a24('0x24')](function(_0x32c9d7){if(_0x32c9d7){return _0x32c9d7?{'count':_0x2c59c2,'rows':_0x32c9d7}:null;}})[_0x0a24('0x24')](respondWithResult(_0x50ddb6,null))[_0x0a24('0x40')](handleError(_0x50ddb6,null));};exports['getFields']=function(_0x5e3008,_0x340b23,_0x2a148f){var _0x10580e={};var _0xc0613c={};var _0x13b122;var _0x4b970e;return db[_0x0a24('0x3c')][_0x0a24('0x4a')]({'where':{'id':_0x5e3008['params']['id']}})[_0x0a24('0x24')](handleEntityNotFound(_0x340b23,null))['then'](function(_0x1b9207){if(_0x1b9207){_0x13b122=_0x1b9207;_0xc0613c[_0x0a24('0x2c')]=_['keys'](db[_0x0a24('0x4c')][_0x0a24('0x43')]);_0xc0613c['query']=_[_0x0a24('0x2e')](_0x5e3008[_0x0a24('0x2d')]);_0xc0613c[_0x0a24('0x2f')]=_[_0x0a24('0x30')](_0xc0613c['model'],_0xc0613c['query']);_0x10580e['attributes']=_['intersection'](_0xc0613c['model'],qs[_0x0a24('0x32')](_0x5e3008[_0x0a24('0x2d')][_0x0a24('0x32')]));_0x10580e[_0x0a24('0x31')]=_0x10580e['attributes'][_0x0a24('0x33')]?_0x10580e[_0x0a24('0x31')]:_0xc0613c[_0x0a24('0x2c')];_0x10580e[_0x0a24('0x36')]=qs[_0x0a24('0x37')](_0x5e3008[_0x0a24('0x2d')]['sort']);_0x10580e['where']=qs['filters'](_[_0x0a24('0x4d')](_0x5e3008['query'],_0xc0613c[_0x0a24('0x2f')]));if(_0x5e3008[_0x0a24('0x2d')][_0x0a24('0x39')]){_0x10580e[_0x0a24('0x38')]=_[_0x0a24('0x3b')](_0x10580e[_0x0a24('0x38')],{'$or':_[_0x0a24('0x2a')](_0x10580e[_0x0a24('0x31')],function(_0x3c3b2c){var _0x15ba80={};_0x15ba80[_0x3c3b2c]={'$like':'%'+_0x5e3008[_0x0a24('0x2d')][_0x0a24('0x39')]+'%'};return _0x15ba80;})});}_0x10580e=_[_0x0a24('0x3b')]({},_0x10580e,_0x5e3008[_0x0a24('0x45')]);return _0x13b122[_0x0a24('0x4e')](_0x10580e);}})[_0x0a24('0x24')](function(_0x833bdb){if(_0x833bdb){_0x4b970e=_0x833bdb[_0x0a24('0x33')];if(!_0x5e3008[_0x0a24('0x2d')][_0x0a24('0x34')](_0x0a24('0x35'))){_0x10580e[_0x0a24('0x1b')]=qs[_0x0a24('0x1b')](_0x5e3008['query'][_0x0a24('0x1b')]);_0x10580e[_0x0a24('0x1c')]=qs['offset'](_0x5e3008[_0x0a24('0x2d')][_0x0a24('0x1c')]);}return _0x13b122[_0x0a24('0x4e')](_0x10580e);}})[_0x0a24('0x24')](function(_0x151c28){if(_0x151c28){return _0x151c28?{'count':_0x4b970e,'rows':_0x151c28}:null;}})[_0x0a24('0x24')](respondWithResult(_0x340b23,null))[_0x0a24('0x40')](handleError(_0x340b23,null));}; \ No newline at end of file +var _0x86f8=['keys','length','create','body','find','getSubjects','FreshsalesField','rawAttributes','pick','getDescriptions','getFields','findOne','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','FreshsalesConfiguration','fieldName','type','key','map','query','filters','intersection','model','fields','attributes','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','params'];(function(_0x521f06,_0xb7547){var _0x464188=function(_0x356690){while(--_0x356690){_0x521f06['push'](_0x521f06['shift']());}};_0x464188(++_0xb7547);}(_0x86f8,0x1e6));var _0x886f=function(_0x81f000,_0x15df85){_0x81f000=_0x81f000-0x0;var _0x337aa2=_0x86f8[_0x81f000];return _0x337aa2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x886f('0x0'));var zipdir=require(_0x886f('0x1'));var jsonpatch=require(_0x886f('0x2'));var rp=require(_0x886f('0x3'));var moment=require(_0x886f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x886f('0x5'));var util=require(_0x886f('0x6'));var path=require(_0x886f('0x7'));var sox=require(_0x886f('0x8'));var csv=require(_0x886f('0x9'));var ejs=require(_0x886f('0xa'));var fs=require('fs');var fs_extra=require(_0x886f('0xb'));var _=require(_0x886f('0xc'));var squel=require(_0x886f('0xd'));var crypto=require(_0x886f('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x886f('0x9'));var querystring=require('querystring');var Papa=require(_0x886f('0xf'));var Redis=require(_0x886f('0x10'));var authService=require(_0x886f('0x11'));var qs=require(_0x886f('0x12'));var as=require(_0x886f('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x886f('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x886f('0x15'));var db=require(_0x886f('0x16'))['db'];function respondWithStatusCode(_0x338fd3,_0x34c9a5){_0x34c9a5=_0x34c9a5||0xcc;return function(_0x4cf67b){if(_0x4cf67b){return _0x338fd3[_0x886f('0x17')](_0x34c9a5);}return _0x338fd3[_0x886f('0x18')](_0x34c9a5)[_0x886f('0x19')]();};}function respondWithResult(_0x423f0a,_0x81f2fd){_0x81f2fd=_0x81f2fd||0xc8;return function(_0x1791ec){if(_0x1791ec){return _0x423f0a[_0x886f('0x18')](_0x81f2fd)[_0x886f('0x1a')](_0x1791ec);}};}function respondWithFilteredResult(_0x4a8266,_0x438893){return function(_0xc4e9ad){if(_0xc4e9ad){var _0x24b678=typeof _0x438893[_0x886f('0x1b')]===_0x886f('0x1c')&&typeof _0x438893[_0x886f('0x1d')]===_0x886f('0x1c');var _0x4dd5af=_0xc4e9ad[_0x886f('0x1e')];var _0x26cdaa=_0x24b678?0x0:_0x438893[_0x886f('0x1b')];var _0x3ab69c=_0x24b678?_0xc4e9ad['count']:_0x438893[_0x886f('0x1b')]+_0x438893[_0x886f('0x1d')];var _0x29ab;if(_0x3ab69c>=_0x4dd5af){_0x3ab69c=_0x4dd5af;_0x29ab=0xc8;}else{_0x29ab=0xce;}_0x4a8266[_0x886f('0x18')](_0x29ab);return _0x4a8266[_0x886f('0x1f')](_0x886f('0x20'),_0x26cdaa+'-'+_0x3ab69c+'/'+_0x4dd5af)[_0x886f('0x1a')](_0xc4e9ad);}return null;};}function patchUpdates(_0x1bf518){return function(_0x1e482d){try{jsonpatch['apply'](_0x1e482d,_0x1bf518,!![]);}catch(_0x4115b3){return BPromise[_0x886f('0x21')](_0x4115b3);}return _0x1e482d[_0x886f('0x22')]();};}function saveUpdates(_0x3e5de3,_0xfe479){return function(_0x256c75){if(_0x256c75){return _0x256c75[_0x886f('0x23')](_0x3e5de3)[_0x886f('0x24')](function(_0x327c16){return _0x327c16;});}return null;};}function removeEntity(_0x3eb43e,_0x3294eb){return function(_0x57784d){if(_0x57784d){return _0x57784d[_0x886f('0x25')]()[_0x886f('0x24')](function(){_0x3eb43e['status'](0xcc)[_0x886f('0x19')]();});}};}function handleEntityNotFound(_0x20be07,_0x59e199){return function(_0x4ca835){if(!_0x4ca835){_0x20be07[_0x886f('0x17')](0x194);}return _0x4ca835;};}function handleError(_0x12d77b,_0x35e92f){_0x35e92f=_0x35e92f||0x1f4;return function(_0x269734){logger[_0x886f('0x26')](_0x269734[_0x886f('0x27')]);if(_0x269734[_0x886f('0x28')]){delete _0x269734[_0x886f('0x28')];}_0x12d77b[_0x886f('0x18')](_0x35e92f)[_0x886f('0x29')](_0x269734);};}exports[_0x886f('0x2a')]=function(_0x3adb05,_0x46989e){var _0x2a2dfc={},_0x1917aa={},_0x274395={'count':0x0,'rows':[]};var _0x5f39a5=_['map'](db[_0x886f('0x2b')]['rawAttributes'],function(_0x278800){return{'name':_0x278800[_0x886f('0x2c')],'type':_0x278800[_0x886f('0x2d')][_0x886f('0x2e')]};});_0x1917aa['model']=_[_0x886f('0x2f')](_0x5f39a5,'name');_0x1917aa['query']=_['keys'](_0x3adb05[_0x886f('0x30')]);_0x1917aa[_0x886f('0x31')]=_[_0x886f('0x32')](_0x1917aa[_0x886f('0x33')],_0x1917aa[_0x886f('0x30')]);_0x2a2dfc['attributes']=_[_0x886f('0x32')](_0x1917aa[_0x886f('0x33')],qs[_0x886f('0x34')](_0x3adb05[_0x886f('0x30')]['fields']));_0x2a2dfc[_0x886f('0x35')]=_0x2a2dfc[_0x886f('0x35')]['length']?_0x2a2dfc[_0x886f('0x35')]:_0x1917aa[_0x886f('0x33')];if(!_0x3adb05[_0x886f('0x30')]['hasOwnProperty'](_0x886f('0x36'))){_0x2a2dfc[_0x886f('0x1d')]=qs['limit'](_0x3adb05[_0x886f('0x30')]['limit']);_0x2a2dfc[_0x886f('0x1b')]=qs[_0x886f('0x1b')](_0x3adb05[_0x886f('0x30')][_0x886f('0x1b')]);}_0x2a2dfc[_0x886f('0x37')]=qs[_0x886f('0x38')](_0x3adb05['query'][_0x886f('0x38')]);_0x2a2dfc[_0x886f('0x39')]=qs['filters'](_['pick'](_0x3adb05[_0x886f('0x30')],_0x1917aa[_0x886f('0x31')]),_0x5f39a5);if(_0x3adb05['query'][_0x886f('0x3a')]){_0x2a2dfc[_0x886f('0x39')]=_[_0x886f('0x3b')](_0x2a2dfc['where'],{'$or':_[_0x886f('0x2f')](_0x5f39a5,function(_0x29d904){if(_0x29d904[_0x886f('0x2d')]!==_0x886f('0x3c')){var _0x55d877={};_0x55d877[_0x29d904[_0x886f('0x28')]]={'$like':'%'+_0x3adb05[_0x886f('0x30')][_0x886f('0x3a')]+'%'};return _0x55d877;}})});}_0x2a2dfc=_[_0x886f('0x3b')]({},_0x2a2dfc,_0x3adb05[_0x886f('0x3d')]);var _0x2403f8={'where':_0x2a2dfc[_0x886f('0x39')]};return db[_0x886f('0x2b')][_0x886f('0x1e')](_0x2403f8)['then'](function(_0x295a2e){_0x274395[_0x886f('0x1e')]=_0x295a2e;if(_0x3adb05['query'][_0x886f('0x3e')]){_0x2a2dfc[_0x886f('0x3f')]=[{'all':!![]}];}return db[_0x886f('0x2b')]['findAll'](_0x2a2dfc);})[_0x886f('0x24')](function(_0x3356bb){_0x274395[_0x886f('0x40')]=_0x3356bb;return _0x274395;})[_0x886f('0x24')](respondWithFilteredResult(_0x46989e,_0x2a2dfc))[_0x886f('0x41')](handleError(_0x46989e,null));};exports['show']=function(_0x533c00,_0x42e90b){var _0x25f246={'raw':![],'where':{'id':_0x533c00[_0x886f('0x42')]['id']}},_0x286225={};_0x286225['model']=_[_0x886f('0x43')](db[_0x886f('0x2b')]['rawAttributes']);_0x286225[_0x886f('0x30')]=_['keys'](_0x533c00[_0x886f('0x30')]);_0x286225['filters']=_[_0x886f('0x32')](_0x286225[_0x886f('0x33')],_0x286225[_0x886f('0x30')]);_0x25f246[_0x886f('0x35')]=_[_0x886f('0x32')](_0x286225[_0x886f('0x33')],qs['fields'](_0x533c00['query'][_0x886f('0x34')]));_0x25f246[_0x886f('0x35')]=_0x25f246[_0x886f('0x35')][_0x886f('0x44')]?_0x25f246[_0x886f('0x35')]:_0x286225[_0x886f('0x33')];if(_0x533c00[_0x886f('0x30')]['includeAll']){_0x25f246['include']=[{'all':!![]}];}_0x25f246=_[_0x886f('0x3b')]({},_0x25f246,_0x533c00['options']);return db[_0x886f('0x2b')]['find'](_0x25f246)['then'](handleEntityNotFound(_0x42e90b,null))[_0x886f('0x24')](respondWithResult(_0x42e90b,null))[_0x886f('0x41')](handleError(_0x42e90b,null));};exports[_0x886f('0x45')]=function(_0x26e26f,_0x5ef4e4){return db['FreshsalesConfiguration'][_0x886f('0x45')](_0x26e26f[_0x886f('0x46')],{})[_0x886f('0x24')](respondWithResult(_0x5ef4e4,0xc9))[_0x886f('0x41')](handleError(_0x5ef4e4,null));};exports[_0x886f('0x23')]=function(_0x5e721a,_0x5a2520){if(_0x5e721a[_0x886f('0x46')]['id']){delete _0x5e721a[_0x886f('0x46')]['id'];}return db[_0x886f('0x2b')][_0x886f('0x47')]({'where':{'id':_0x5e721a[_0x886f('0x42')]['id']}})[_0x886f('0x24')](handleEntityNotFound(_0x5a2520,null))[_0x886f('0x24')](saveUpdates(_0x5e721a[_0x886f('0x46')],null))[_0x886f('0x24')](respondWithResult(_0x5a2520,null))[_0x886f('0x41')](handleError(_0x5a2520,null));};exports[_0x886f('0x25')]=function(_0x2f3c9c,_0x27e59a){return db['FreshsalesConfiguration'][_0x886f('0x47')]({'where':{'id':_0x2f3c9c[_0x886f('0x42')]['id']}})[_0x886f('0x24')](handleEntityNotFound(_0x27e59a,null))[_0x886f('0x24')](removeEntity(_0x27e59a,null))[_0x886f('0x41')](handleError(_0x27e59a,null));};exports[_0x886f('0x48')]=function(_0x3dec71,_0x20053b,_0x1f7fa3){var _0x15b7b={};var _0x52b57f={};var _0x26b6fc;var _0x41ac79;return db[_0x886f('0x2b')]['findOne']({'where':{'id':_0x3dec71[_0x886f('0x42')]['id']}})[_0x886f('0x24')](handleEntityNotFound(_0x20053b,null))[_0x886f('0x24')](function(_0x34587a){if(_0x34587a){_0x26b6fc=_0x34587a;_0x52b57f[_0x886f('0x33')]=_[_0x886f('0x43')](db[_0x886f('0x49')][_0x886f('0x4a')]);_0x52b57f[_0x886f('0x30')]=_[_0x886f('0x43')](_0x3dec71[_0x886f('0x30')]);_0x52b57f[_0x886f('0x31')]=_[_0x886f('0x32')](_0x52b57f[_0x886f('0x33')],_0x52b57f[_0x886f('0x30')]);_0x15b7b['attributes']=_[_0x886f('0x32')](_0x52b57f[_0x886f('0x33')],qs[_0x886f('0x34')](_0x3dec71['query'][_0x886f('0x34')]));_0x15b7b[_0x886f('0x35')]=_0x15b7b[_0x886f('0x35')][_0x886f('0x44')]?_0x15b7b[_0x886f('0x35')]:_0x52b57f['model'];_0x15b7b[_0x886f('0x37')]=qs[_0x886f('0x38')](_0x3dec71[_0x886f('0x30')]['sort']);_0x15b7b[_0x886f('0x39')]=qs[_0x886f('0x31')](_['pick'](_0x3dec71[_0x886f('0x30')],_0x52b57f[_0x886f('0x31')]));if(_0x3dec71[_0x886f('0x30')][_0x886f('0x3a')]){_0x15b7b[_0x886f('0x39')]=_[_0x886f('0x3b')](_0x15b7b[_0x886f('0x39')],{'$or':_['map'](_0x15b7b['attributes'],function(_0x5d25e4){var _0x22daba={};_0x22daba[_0x5d25e4]={'$like':'%'+_0x3dec71[_0x886f('0x30')][_0x886f('0x3a')]+'%'};return _0x22daba;})});}_0x15b7b=_[_0x886f('0x3b')]({},_0x15b7b,_0x3dec71['options']);return _0x26b6fc[_0x886f('0x48')](_0x15b7b);}})[_0x886f('0x24')](function(_0x5ef761){if(_0x5ef761){_0x41ac79=_0x5ef761[_0x886f('0x44')];if(!_0x3dec71['query']['hasOwnProperty']('nolimit')){_0x15b7b[_0x886f('0x1d')]=qs[_0x886f('0x1d')](_0x3dec71[_0x886f('0x30')][_0x886f('0x1d')]);_0x15b7b[_0x886f('0x1b')]=qs[_0x886f('0x1b')](_0x3dec71[_0x886f('0x30')]['offset']);}return _0x26b6fc['getSubjects'](_0x15b7b);}})[_0x886f('0x24')](function(_0x29d6e6){if(_0x29d6e6){return _0x29d6e6?{'count':_0x41ac79,'rows':_0x29d6e6}:null;}})[_0x886f('0x24')](respondWithResult(_0x20053b,null))[_0x886f('0x41')](handleError(_0x20053b,null));};exports['getDescriptions']=function(_0x6d55bc,_0x468d67,_0x52e2ba){var _0x9cd78d={};var _0x1502e1={};var _0xa40745;var _0x53ad7f;return db[_0x886f('0x2b')]['findOne']({'where':{'id':_0x6d55bc[_0x886f('0x42')]['id']}})['then'](handleEntityNotFound(_0x468d67,null))[_0x886f('0x24')](function(_0x572627){if(_0x572627){_0xa40745=_0x572627;_0x1502e1[_0x886f('0x33')]=_[_0x886f('0x43')](db[_0x886f('0x49')]['rawAttributes']);_0x1502e1[_0x886f('0x30')]=_[_0x886f('0x43')](_0x6d55bc[_0x886f('0x30')]);_0x1502e1[_0x886f('0x31')]=_[_0x886f('0x32')](_0x1502e1['model'],_0x1502e1[_0x886f('0x30')]);_0x9cd78d[_0x886f('0x35')]=_['intersection'](_0x1502e1[_0x886f('0x33')],qs[_0x886f('0x34')](_0x6d55bc[_0x886f('0x30')][_0x886f('0x34')]));_0x9cd78d['attributes']=_0x9cd78d[_0x886f('0x35')][_0x886f('0x44')]?_0x9cd78d['attributes']:_0x1502e1[_0x886f('0x33')];_0x9cd78d[_0x886f('0x37')]=qs['sort'](_0x6d55bc[_0x886f('0x30')][_0x886f('0x38')]);_0x9cd78d[_0x886f('0x39')]=qs[_0x886f('0x31')](_[_0x886f('0x4b')](_0x6d55bc[_0x886f('0x30')],_0x1502e1['filters']));if(_0x6d55bc['query'][_0x886f('0x3a')]){_0x9cd78d['where']=_[_0x886f('0x3b')](_0x9cd78d[_0x886f('0x39')],{'$or':_[_0x886f('0x2f')](_0x9cd78d[_0x886f('0x35')],function(_0x4b6ba2){var _0x587131={};_0x587131[_0x4b6ba2]={'$like':'%'+_0x6d55bc[_0x886f('0x30')][_0x886f('0x3a')]+'%'};return _0x587131;})});}_0x9cd78d=_[_0x886f('0x3b')]({},_0x9cd78d,_0x6d55bc[_0x886f('0x3d')]);return _0xa40745[_0x886f('0x4c')](_0x9cd78d);}})[_0x886f('0x24')](function(_0x33c8de){if(_0x33c8de){_0x53ad7f=_0x33c8de[_0x886f('0x44')];if(!_0x6d55bc[_0x886f('0x30')]['hasOwnProperty'](_0x886f('0x36'))){_0x9cd78d[_0x886f('0x1d')]=qs[_0x886f('0x1d')](_0x6d55bc['query'][_0x886f('0x1d')]);_0x9cd78d[_0x886f('0x1b')]=qs['offset'](_0x6d55bc[_0x886f('0x30')]['offset']);}return _0xa40745[_0x886f('0x4c')](_0x9cd78d);}})[_0x886f('0x24')](function(_0x5de86f){if(_0x5de86f){return _0x5de86f?{'count':_0x53ad7f,'rows':_0x5de86f}:null;}})[_0x886f('0x24')](respondWithResult(_0x468d67,null))['catch'](handleError(_0x468d67,null));};exports[_0x886f('0x4d')]=function(_0x23f8c1,_0x5e63d5,_0x4931ae){var _0x4fcbc1={};var _0x586c48={};var _0x27aadd;var _0xe94b1b;return db[_0x886f('0x2b')][_0x886f('0x4e')]({'where':{'id':_0x23f8c1[_0x886f('0x42')]['id']}})[_0x886f('0x24')](handleEntityNotFound(_0x5e63d5,null))[_0x886f('0x24')](function(_0x1a06d8){if(_0x1a06d8){_0x27aadd=_0x1a06d8;_0x586c48[_0x886f('0x33')]=_['keys'](db[_0x886f('0x49')][_0x886f('0x4a')]);_0x586c48[_0x886f('0x30')]=_[_0x886f('0x43')](_0x23f8c1['query']);_0x586c48[_0x886f('0x31')]=_[_0x886f('0x32')](_0x586c48['model'],_0x586c48[_0x886f('0x30')]);_0x4fcbc1[_0x886f('0x35')]=_[_0x886f('0x32')](_0x586c48[_0x886f('0x33')],qs['fields'](_0x23f8c1[_0x886f('0x30')][_0x886f('0x34')]));_0x4fcbc1[_0x886f('0x35')]=_0x4fcbc1['attributes'][_0x886f('0x44')]?_0x4fcbc1[_0x886f('0x35')]:_0x586c48['model'];_0x4fcbc1['order']=qs[_0x886f('0x38')](_0x23f8c1[_0x886f('0x30')][_0x886f('0x38')]);_0x4fcbc1[_0x886f('0x39')]=qs['filters'](_[_0x886f('0x4b')](_0x23f8c1[_0x886f('0x30')],_0x586c48[_0x886f('0x31')]));if(_0x23f8c1['query'][_0x886f('0x3a')]){_0x4fcbc1[_0x886f('0x39')]=_['merge'](_0x4fcbc1[_0x886f('0x39')],{'$or':_[_0x886f('0x2f')](_0x4fcbc1[_0x886f('0x35')],function(_0x3f6c60){var _0x30c59f={};_0x30c59f[_0x3f6c60]={'$like':'%'+_0x23f8c1['query'][_0x886f('0x3a')]+'%'};return _0x30c59f;})});}_0x4fcbc1=_[_0x886f('0x3b')]({},_0x4fcbc1,_0x23f8c1['options']);return _0x27aadd[_0x886f('0x4d')](_0x4fcbc1);}})[_0x886f('0x24')](function(_0x553e62){if(_0x553e62){_0xe94b1b=_0x553e62[_0x886f('0x44')];if(!_0x23f8c1['query']['hasOwnProperty'](_0x886f('0x36'))){_0x4fcbc1[_0x886f('0x1d')]=qs[_0x886f('0x1d')](_0x23f8c1[_0x886f('0x30')][_0x886f('0x1d')]);_0x4fcbc1[_0x886f('0x1b')]=qs[_0x886f('0x1b')](_0x23f8c1['query'][_0x886f('0x1b')]);}return _0x27aadd[_0x886f('0x4d')](_0x4fcbc1);}})['then'](function(_0x3c7d1e){if(_0x3c7d1e){return _0x3c7d1e?{'count':_0xe94b1b,'rows':_0x3c7d1e}:null;}})[_0x886f('0x24')](respondWithResult(_0x5e63d5,null))[_0x886f('0x41')](handleError(_0x5e63d5,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 90ce474..283c62d 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 _0xa0c3=['./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','lodash','util','../../config/logger','api','moment','bluebird','rimraf'];(function(_0x2f74e1,_0x330175){var _0x5ca718=function(_0x417ba7){while(--_0x417ba7){_0x2f74e1['push'](_0x2f74e1['shift']());}};_0x5ca718(++_0x330175);}(_0xa0c3,0xa9));var _0x3a0c=function(_0x17ec85,_0x546a65){_0x17ec85=_0x17ec85-0x0;var _0x904424=_0xa0c3[_0x17ec85];return _0x904424;};'use strict';var _=require(_0x3a0c('0x0'));var util=require(_0x3a0c('0x1'));var logger=require(_0x3a0c('0x2'))(_0x3a0c('0x3'));var moment=require(_0x3a0c('0x4'));var BPromise=require(_0x3a0c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3a0c('0x6'));var config=require('../../config/environment');var attributes=require(_0x3a0c('0x7'));module[_0x3a0c('0x8')]=function(_0x4d06f2,_0xb3d33b){return _0x4d06f2[_0x3a0c('0x9')](_0x3a0c('0xa'),attributes,{'tableName':'int_freshsales_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf434=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','int_freshsales_configurations','util'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xf434,0x117));var _0x4f43=function(_0x2a91bf,_0x1cf9b1){_0x2a91bf=_0x2a91bf-0x0;var _0x430d62=_0xf434[_0x2a91bf];return _0x430d62;};'use strict';var _=require('lodash');var util=require(_0x4f43('0x0'));var logger=require(_0x4f43('0x1'))(_0x4f43('0x2'));var moment=require(_0x4f43('0x3'));var BPromise=require(_0x4f43('0x4'));var rp=require(_0x4f43('0x5'));var fs=require('fs');var path=require(_0x4f43('0x6'));var rimraf=require(_0x4f43('0x7'));var config=require(_0x4f43('0x8'));var attributes=require(_0x4f43('0x9'));module[_0x4f43('0xa')]=function(_0x48cef9,_0x32167c){return _0x48cef9[_0x4f43('0xb')](_0x4f43('0xc'),attributes,{'tableName':_0x4f43('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index dcdb579..8095097 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 _0x9ec4=['../../config/utils','rpc','jayson/promise','client','http','request','then','FreshsalesConfiguration,\x20%s,\x20%s','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x268d73,_0xf47e29){var _0x23b1e1=function(_0x2e3776){while(--_0x2e3776){_0x268d73['push'](_0x268d73['shift']());}};_0x23b1e1(++_0xf47e29);}(_0x9ec4,0x1a9));var _0x49ec=function(_0x5c3d92,_0x5d8a7e){_0x5c3d92=_0x5c3d92-0x0;var _0x54af60=_0x9ec4[_0x5c3d92];return _0x54af60;};'use strict';var _=require(_0x49ec('0x0'));var util=require(_0x49ec('0x1'));var moment=require(_0x49ec('0x2'));var BPromise=require(_0x49ec('0x3'));var rs=require(_0x49ec('0x4'));var fs=require('fs');var Redis=require(_0x49ec('0x5'));var db=require(_0x49ec('0x6'))['db'];var utils=require(_0x49ec('0x7'));var logger=require('../../config/logger')(_0x49ec('0x8'));var config=require('../../config/environment');var jayson=require(_0x49ec('0x9'));var client=jayson[_0x49ec('0xa')][_0x49ec('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x25ccb7,_0x58a367,_0x1e1cf4){return new BPromise(function(_0x3a0c99,_0x4c0b93){return client[_0x49ec('0xc')](_0x25ccb7,_0x1e1cf4)[_0x49ec('0xd')](function(_0x40a58b){logger['info'](_0x49ec('0xe'),_0x58a367,'request\x20sent');logger[_0x49ec('0xf')](_0x49ec('0x10'),_0x58a367,_0x49ec('0x11'),JSON[_0x49ec('0x12')](_0x40a58b));if(_0x40a58b[_0x49ec('0x13')]){if(_0x40a58b[_0x49ec('0x13')][_0x49ec('0x14')]===0x1f4){logger['error'](_0x49ec('0xe'),_0x58a367,_0x40a58b['error']['message']);return _0x4c0b93(_0x40a58b[_0x49ec('0x13')]['message']);}logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x58a367,_0x40a58b[_0x49ec('0x13')][_0x49ec('0x15')]);return _0x3a0c99(_0x40a58b[_0x49ec('0x13')]['message']);}else{logger[_0x49ec('0x16')](_0x49ec('0xe'),_0x58a367,_0x49ec('0x11'));_0x3a0c99(_0x40a58b[_0x49ec('0x17')][_0x49ec('0x15')]);}})['catch'](function(_0x50f3ec){logger['error'](_0x49ec('0xe'),_0x58a367,_0x50f3ec);_0x4c0b93(_0x50f3ec);});});} \ No newline at end of file +var _0xc9aa=['error','message','FreshsalesConfiguration,\x20%s,\x20%s','lodash','util','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','info','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x576e2b,_0x328953){var _0x46461a=function(_0xce4d9e){while(--_0xce4d9e){_0x576e2b['push'](_0x576e2b['shift']());}};_0x46461a(++_0x328953);}(_0xc9aa,0xb3));var _0xac9a=function(_0x45d1fd,_0x463212){_0x45d1fd=_0x45d1fd-0x0;var _0xd0e542=_0xc9aa[_0x45d1fd];return _0xd0e542;};'use strict';var _=require(_0xac9a('0x0'));var util=require(_0xac9a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xac9a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xac9a('0x3'))['db'];var utils=require(_0xac9a('0x4'));var logger=require('../../config/logger')(_0xac9a('0x5'));var config=require(_0xac9a('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xac9a('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x38926b,_0x16ec30,_0x54ccf9){return new BPromise(function(_0x2aea7a,_0x3dbdbf){return client[_0xac9a('0x8')](_0x38926b,_0x54ccf9)['then'](function(_0x3933bb){logger[_0xac9a('0x9')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x16ec30,_0xac9a('0xa'));logger[_0xac9a('0xb')](_0xac9a('0xc'),_0x16ec30,_0xac9a('0xa'),JSON['stringify'](_0x3933bb));if(_0x3933bb[_0xac9a('0xd')]){if(_0x3933bb[_0xac9a('0xd')]['code']===0x1f4){logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x16ec30,_0x3933bb['error'][_0xac9a('0xe')]);return _0x3dbdbf(_0x3933bb[_0xac9a('0xd')][_0xac9a('0xe')]);}logger[_0xac9a('0xd')](_0xac9a('0xf'),_0x16ec30,_0x3933bb[_0xac9a('0xd')]['message']);return _0x2aea7a(_0x3933bb[_0xac9a('0xd')]['message']);}else{logger[_0xac9a('0x9')](_0xac9a('0xf'),_0x16ec30,'request\x20sent');_0x2aea7a(_0x3933bb['result'][_0xac9a('0xe')]);}})['catch'](function(_0x504911){logger['error'](_0xac9a('0xf'),_0x16ec30,_0x504911);_0x3dbdbf(_0x504911);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index e40d7e2..1153597 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 _0xb469=['Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','create','put','delete','exports','multer','util','path','connect-timeout','express'];(function(_0x476b65,_0x555ebf){var _0x55ae77=function(_0xae518f){while(--_0xae518f){_0x476b65['push'](_0x476b65['shift']());}};_0x55ae77(++_0x555ebf);}(_0xb469,0x13b));var _0x9b46=function(_0x2537dd,_0x3c629f){_0x2537dd=_0x2537dd-0x0;var _0x18c743=_0xb469[_0x2537dd];return _0x18c743;};'use strict';var multer=require(_0x9b46('0x0'));var util=require(_0x9b46('0x1'));var path=require(_0x9b46('0x2'));var timeout=require(_0x9b46('0x3'));var express=require(_0x9b46('0x4'));var router=express[_0x9b46('0x5')]();var fs_extra=require(_0x9b46('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x9b46('0x7'));var config=require(_0x9b46('0x8'));var controller=require('./intFreshsalesField.controller');router[_0x9b46('0x9')]('/',auth[_0x9b46('0xa')](),controller['index']);router[_0x9b46('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x9b46('0xb')]);router['post']('/',auth[_0x9b46('0xa')](),controller[_0x9b46('0xc')]);router[_0x9b46('0xd')]('/:id',auth[_0x9b46('0xa')](),controller['update']);router[_0x9b46('0xe')]('/:id',auth[_0x9b46('0xa')](),controller['destroy']);module[_0x9b46('0xf')]=router; \ No newline at end of file +var _0xa9e0=['isAuthenticated','update','delete','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','index','/:id','post','put'];(function(_0x125bbd,_0x392ff2){var _0x48c7a0=function(_0x247733){while(--_0x247733){_0x125bbd['push'](_0x125bbd['shift']());}};_0x48c7a0(++_0x392ff2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'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('0xc')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index f08f858..8843093 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 _0xd41b=['keyValue','picklist','customVariable','STRING','BOOLEAN','sequelize','ENUM','string','variable'];(function(_0x3829a5,_0x1780de){var _0x5a8a50=function(_0x887f7b){while(--_0x887f7b){_0x3829a5['push'](_0x3829a5['shift']());}};_0x5a8a50(++_0x1780de);}(_0xd41b,0x140));var _0xbd41=function(_0x351323,_0x46b1c5){_0x351323=_0x351323-0x0;var _0x4df6a5=_0xd41b[_0x351323];return _0x4df6a5;};'use strict';var Sequelize=require(_0xbd41('0x0'));module['exports']={'type':{'type':Sequelize[_0xbd41('0x1')](_0xbd41('0x2'),_0xbd41('0x3'),'customVariable',_0xbd41('0x4'),_0xbd41('0x5')),'defaultValue':_0xbd41('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xbd41('0x1')]('string','variable',_0xbd41('0x6'))},'keyContent':{'type':Sequelize[_0xbd41('0x7')]},'idField':{'type':Sequelize[_0xbd41('0x7')]},'nameField':{'type':Sequelize[_0xbd41('0x7')]},'customField':{'type':Sequelize[_0xbd41('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xbd41('0x7')]}}; \ No newline at end of file +var _0xfa66=['BOOLEAN','sequelize','exports','string','variable','customVariable','keyValue','picklist','STRING','ENUM'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0xfa66,0x10f));var _0x6fa6=function(_0x4109bf,_0x3f5184){_0x4109bf=_0x4109bf-0x0;var _0x5cddc8=_0xfa66[_0x4109bf];return _0x5cddc8;};'use strict';var Sequelize=require(_0x6fa6('0x0'));module[_0x6fa6('0x1')]={'type':{'type':Sequelize['ENUM'](_0x6fa6('0x2'),_0x6fa6('0x3'),_0x6fa6('0x4'),_0x6fa6('0x5'),_0x6fa6('0x6')),'defaultValue':_0x6fa6('0x2')},'content':{'type':Sequelize[_0x6fa6('0x7')]},'key':{'type':Sequelize[_0x6fa6('0x7')]},'keyType':{'type':Sequelize[_0x6fa6('0x8')](_0x6fa6('0x2'),_0x6fa6('0x3'),_0x6fa6('0x4'))},'keyContent':{'type':Sequelize[_0x6fa6('0x7')]},'idField':{'type':Sequelize[_0x6fa6('0x7')]},'nameField':{'type':Sequelize[_0x6fa6('0x7')]},'customField':{'type':Sequelize[_0x6fa6('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index d00ebf1..222b453 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 _0xe6fd=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','end','error','name','send','index','map','FreshsalesField','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service'];(function(_0x20008a,_0x362490){var _0x5d0f1c=function(_0x122ecf){while(--_0x122ecf){_0x20008a['push'](_0x20008a['shift']());}};_0x5d0f1c(++_0x362490);}(_0xe6fd,0x85));var _0xde6f=function(_0x1b38fc,_0x3b985e){_0x1b38fc=_0x1b38fc-0x0;var _0x3740ba=_0xe6fd[_0x1b38fc];return _0x3740ba;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xde6f('0x0'));var zipdir=require(_0xde6f('0x1'));var jsonpatch=require(_0xde6f('0x2'));var rp=require(_0xde6f('0x3'));var moment=require(_0xde6f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xde6f('0x5'));var util=require(_0xde6f('0x6'));var path=require(_0xde6f('0x7'));var sox=require(_0xde6f('0x8'));var csv=require(_0xde6f('0x9'));var ejs=require(_0xde6f('0xa'));var fs=require('fs');var fs_extra=require(_0xde6f('0xb'));var _=require(_0xde6f('0xc'));var squel=require(_0xde6f('0xd'));var crypto=require(_0xde6f('0xe'));var jsforce=require(_0xde6f('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xde6f('0x9'));var querystring=require(_0xde6f('0x10'));var Papa=require('papaparse');var Redis=require(_0xde6f('0x11'));var authService=require(_0xde6f('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xde6f('0x13'));var hardwareService=require(_0xde6f('0x14'));var logger=require(_0xde6f('0x15'))(_0xde6f('0x16'));var utils=require('../../config/utils');var config=require(_0xde6f('0x17'));var licenseUtil=require(_0xde6f('0x18'));var db=require(_0xde6f('0x19'))['db'];function respondWithStatusCode(_0x1b6624,_0x2e749b){_0x2e749b=_0x2e749b||0xcc;return function(_0x4f27cf){if(_0x4f27cf){return _0x1b6624[_0xde6f('0x1a')](_0x2e749b);}return _0x1b6624['status'](_0x2e749b)['end']();};}function respondWithResult(_0x2fe390,_0x7594d5){_0x7594d5=_0x7594d5||0xc8;return function(_0x59cb6d){if(_0x59cb6d){return _0x2fe390[_0xde6f('0x1b')](_0x7594d5)[_0xde6f('0x1c')](_0x59cb6d);}};}function respondWithFilteredResult(_0x257fe7,_0x45d925){return function(_0x4f3570){if(_0x4f3570){var _0x233a9c=typeof _0x45d925[_0xde6f('0x1d')]===_0xde6f('0x1e')&&typeof _0x45d925[_0xde6f('0x1f')]===_0xde6f('0x1e');var _0x5dee75=_0x4f3570['count'];var _0x3a015d=_0x233a9c?0x0:_0x45d925['offset'];var _0x55e5de=_0x233a9c?_0x4f3570[_0xde6f('0x20')]:_0x45d925[_0xde6f('0x1d')]+_0x45d925['limit'];var _0x5540b5;if(_0x55e5de>=_0x5dee75){_0x55e5de=_0x5dee75;_0x5540b5=0xc8;}else{_0x5540b5=0xce;}_0x257fe7[_0xde6f('0x1b')](_0x5540b5);return _0x257fe7[_0xde6f('0x21')]('Content-Range',_0x3a015d+'-'+_0x55e5de+'/'+_0x5dee75)[_0xde6f('0x1c')](_0x4f3570);}return null;};}function patchUpdates(_0x13928d){return function(_0x487eb9){try{jsonpatch[_0xde6f('0x22')](_0x487eb9,_0x13928d,!![]);}catch(_0x1e8072){return BPromise[_0xde6f('0x23')](_0x1e8072);}return _0x487eb9[_0xde6f('0x24')]();};}function saveUpdates(_0x393dfb,_0x3946d8){return function(_0x3b9848){if(_0x3b9848){return _0x3b9848[_0xde6f('0x25')](_0x393dfb)['then'](function(_0x5611a3){return _0x5611a3;});}return null;};}function removeEntity(_0x1fdaab,_0x59d62a){return function(_0x320004){if(_0x320004){return _0x320004[_0xde6f('0x26')]()[_0xde6f('0x27')](function(){_0x1fdaab[_0xde6f('0x1b')](0xcc)[_0xde6f('0x28')]();});}};}function handleEntityNotFound(_0x2a4b93,_0x3f574e){return function(_0x443f59){if(!_0x443f59){_0x2a4b93[_0xde6f('0x1a')](0x194);}return _0x443f59;};}function handleError(_0x1009dd,_0x389c7a){_0x389c7a=_0x389c7a||0x1f4;return function(_0x1ff62a){logger[_0xde6f('0x29')](_0x1ff62a['stack']);if(_0x1ff62a['name']){delete _0x1ff62a[_0xde6f('0x2a')];}_0x1009dd[_0xde6f('0x1b')](_0x389c7a)[_0xde6f('0x2b')](_0x1ff62a);};}exports[_0xde6f('0x2c')]=function(_0xad9c8d,_0x33ad5b){var _0x59a1fe={},_0x58f44d={},_0x4c3c05={'count':0x0,'rows':[]};var _0x298797=_[_0xde6f('0x2d')](db[_0xde6f('0x2e')]['rawAttributes'],function(_0x483976){return{'name':_0x483976[_0xde6f('0x2f')],'type':_0x483976[_0xde6f('0x30')][_0xde6f('0x31')]};});_0x58f44d[_0xde6f('0x32')]=_[_0xde6f('0x2d')](_0x298797,'name');_0x58f44d[_0xde6f('0x33')]=_[_0xde6f('0x34')](_0xad9c8d[_0xde6f('0x33')]);_0x58f44d[_0xde6f('0x35')]=_[_0xde6f('0x36')](_0x58f44d[_0xde6f('0x32')],_0x58f44d['query']);_0x59a1fe[_0xde6f('0x37')]=_['intersection'](_0x58f44d[_0xde6f('0x32')],qs[_0xde6f('0x38')](_0xad9c8d[_0xde6f('0x33')]['fields']));_0x59a1fe[_0xde6f('0x37')]=_0x59a1fe[_0xde6f('0x37')]['length']?_0x59a1fe[_0xde6f('0x37')]:_0x58f44d[_0xde6f('0x32')];if(!_0xad9c8d[_0xde6f('0x33')][_0xde6f('0x39')](_0xde6f('0x3a'))){_0x59a1fe['limit']=qs[_0xde6f('0x1f')](_0xad9c8d[_0xde6f('0x33')][_0xde6f('0x1f')]);_0x59a1fe['offset']=qs[_0xde6f('0x1d')](_0xad9c8d['query'][_0xde6f('0x1d')]);}_0x59a1fe['order']=qs[_0xde6f('0x3b')](_0xad9c8d[_0xde6f('0x33')][_0xde6f('0x3b')]);_0x59a1fe['where']=qs['filters'](_[_0xde6f('0x3c')](_0xad9c8d[_0xde6f('0x33')],_0x58f44d[_0xde6f('0x35')]),_0x298797);if(_0xad9c8d[_0xde6f('0x33')][_0xde6f('0x3d')]){_0x59a1fe[_0xde6f('0x3e')]=_[_0xde6f('0x3f')](_0x59a1fe[_0xde6f('0x3e')],{'$or':_['map'](_0x298797,function(_0x561d14){if(_0x561d14[_0xde6f('0x30')]!=='VIRTUAL'){var _0x5e396e={};_0x5e396e[_0x561d14[_0xde6f('0x2a')]]={'$like':'%'+_0xad9c8d[_0xde6f('0x33')][_0xde6f('0x3d')]+'%'};return _0x5e396e;}})});}_0x59a1fe=_['merge']({},_0x59a1fe,_0xad9c8d[_0xde6f('0x40')]);var _0xab39b8={'where':_0x59a1fe[_0xde6f('0x3e')]};return db[_0xde6f('0x2e')][_0xde6f('0x20')](_0xab39b8)[_0xde6f('0x27')](function(_0x3c6948){_0x4c3c05['count']=_0x3c6948;if(_0xad9c8d['query'][_0xde6f('0x41')]){_0x59a1fe[_0xde6f('0x42')]=[{'all':!![]}];}return db[_0xde6f('0x2e')][_0xde6f('0x43')](_0x59a1fe);})[_0xde6f('0x27')](function(_0x59452e){_0x4c3c05[_0xde6f('0x44')]=_0x59452e;return _0x4c3c05;})[_0xde6f('0x27')](respondWithFilteredResult(_0x33ad5b,_0x59a1fe))[_0xde6f('0x45')](handleError(_0x33ad5b,null));};exports[_0xde6f('0x46')]=function(_0x1b206b,_0x545bb5){var _0x387367={'raw':!![],'where':{'id':_0x1b206b['params']['id']}},_0x29c12f={};_0x29c12f[_0xde6f('0x32')]=_[_0xde6f('0x34')](db['FreshsalesField'][_0xde6f('0x47')]);_0x29c12f[_0xde6f('0x33')]=_['keys'](_0x1b206b[_0xde6f('0x33')]);_0x29c12f[_0xde6f('0x35')]=_[_0xde6f('0x36')](_0x29c12f[_0xde6f('0x32')],_0x29c12f[_0xde6f('0x33')]);_0x387367[_0xde6f('0x37')]=_['intersection'](_0x29c12f['model'],qs[_0xde6f('0x38')](_0x1b206b[_0xde6f('0x33')][_0xde6f('0x38')]));_0x387367[_0xde6f('0x37')]=_0x387367[_0xde6f('0x37')]['length']?_0x387367[_0xde6f('0x37')]:_0x29c12f[_0xde6f('0x32')];if(_0x1b206b['query'][_0xde6f('0x41')]){_0x387367[_0xde6f('0x42')]=[{'all':!![]}];}_0x387367=_['merge']({},_0x387367,_0x1b206b['options']);return db['FreshsalesField'][_0xde6f('0x48')](_0x387367)[_0xde6f('0x27')](handleEntityNotFound(_0x545bb5,null))['then'](respondWithResult(_0x545bb5,null))['catch'](handleError(_0x545bb5,null));};exports[_0xde6f('0x49')]=function(_0x33d382,_0x3ac12a){return db[_0xde6f('0x2e')][_0xde6f('0x49')](_0x33d382['body'],{})[_0xde6f('0x27')](respondWithResult(_0x3ac12a,0xc9))[_0xde6f('0x45')](handleError(_0x3ac12a,null));};exports[_0xde6f('0x25')]=function(_0x5a61c9,_0x361bd1){if(_0x5a61c9[_0xde6f('0x4a')]['id']){delete _0x5a61c9[_0xde6f('0x4a')]['id'];}return db[_0xde6f('0x2e')]['find']({'where':{'id':_0x5a61c9[_0xde6f('0x4b')]['id']}})[_0xde6f('0x27')](handleEntityNotFound(_0x361bd1,null))[_0xde6f('0x27')](saveUpdates(_0x5a61c9[_0xde6f('0x4a')],null))[_0xde6f('0x27')](respondWithResult(_0x361bd1,null))['catch'](handleError(_0x361bd1,null));};exports[_0xde6f('0x26')]=function(_0x497161,_0x55fc96){return db[_0xde6f('0x2e')][_0xde6f('0x48')]({'where':{'id':_0x497161[_0xde6f('0x4b')]['id']}})[_0xde6f('0x27')](handleEntityNotFound(_0x55fc96,null))[_0xde6f('0x27')](removeEntity(_0x55fc96,null))[_0xde6f('0x45')](handleError(_0x55fc96,null));}; \ No newline at end of file +var _0xd7b6=['stack','name','send','index','map','FreshsalesField','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xd7b6,0xf7));var _0x6d7b=function(_0x40e386,_0x3679bb){_0x40e386=_0x40e386-0x0;var _0x164cb3=_0xd7b6[_0x40e386];return _0x164cb3;};'use strict';var emlformat=require(_0x6d7b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6d7b('0x1'));var jsonpatch=require(_0x6d7b('0x2'));var rp=require(_0x6d7b('0x3'));var moment=require(_0x6d7b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6d7b('0x5'));var util=require(_0x6d7b('0x6'));var path=require('path');var sox=require(_0x6d7b('0x7'));var csv=require(_0x6d7b('0x8'));var ejs=require(_0x6d7b('0x9'));var fs=require('fs');var fs_extra=require(_0x6d7b('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6d7b('0xb'));var deskjs=require(_0x6d7b('0xc'));var toCsv=require('to-csv');var querystring=require(_0x6d7b('0xd'));var Papa=require(_0x6d7b('0xe'));var Redis=require('ioredis');var authService=require(_0x6d7b('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x6d7b('0x10'));var hardwareService=require(_0x6d7b('0x11'));var logger=require(_0x6d7b('0x12'))('api');var utils=require(_0x6d7b('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x6d7b('0x14'));var db=require(_0x6d7b('0x15'))['db'];function respondWithStatusCode(_0x16ec7d,_0x3292bb){_0x3292bb=_0x3292bb||0xcc;return function(_0x32f1d0){if(_0x32f1d0){return _0x16ec7d[_0x6d7b('0x16')](_0x3292bb);}return _0x16ec7d[_0x6d7b('0x17')](_0x3292bb)[_0x6d7b('0x18')]();};}function respondWithResult(_0x426383,_0xa78b1b){_0xa78b1b=_0xa78b1b||0xc8;return function(_0x1d2f76){if(_0x1d2f76){return _0x426383[_0x6d7b('0x17')](_0xa78b1b)[_0x6d7b('0x19')](_0x1d2f76);}};}function respondWithFilteredResult(_0x22fc5f,_0xf015bb){return function(_0x1f9679){if(_0x1f9679){var _0x2df1cf=typeof _0xf015bb['offset']===_0x6d7b('0x1a')&&typeof _0xf015bb[_0x6d7b('0x1b')]===_0x6d7b('0x1a');var _0x2a20c4=_0x1f9679[_0x6d7b('0x1c')];var _0x283ded=_0x2df1cf?0x0:_0xf015bb[_0x6d7b('0x1d')];var _0x58df70=_0x2df1cf?_0x1f9679[_0x6d7b('0x1c')]:_0xf015bb['offset']+_0xf015bb['limit'];var _0x490a5b;if(_0x58df70>=_0x2a20c4){_0x58df70=_0x2a20c4;_0x490a5b=0xc8;}else{_0x490a5b=0xce;}_0x22fc5f[_0x6d7b('0x17')](_0x490a5b);return _0x22fc5f[_0x6d7b('0x1e')](_0x6d7b('0x1f'),_0x283ded+'-'+_0x58df70+'/'+_0x2a20c4)[_0x6d7b('0x19')](_0x1f9679);}return null;};}function patchUpdates(_0x30aa58){return function(_0x16c085){try{jsonpatch[_0x6d7b('0x20')](_0x16c085,_0x30aa58,!![]);}catch(_0x457845){return BPromise[_0x6d7b('0x21')](_0x457845);}return _0x16c085[_0x6d7b('0x22')]();};}function saveUpdates(_0x2c1e3b,_0x4ebbc0){return function(_0x26acb1){if(_0x26acb1){return _0x26acb1['update'](_0x2c1e3b)[_0x6d7b('0x23')](function(_0x1fa1f3){return _0x1fa1f3;});}return null;};}function removeEntity(_0x35732a,_0x533115){return function(_0x478b9f){if(_0x478b9f){return _0x478b9f[_0x6d7b('0x24')]()[_0x6d7b('0x23')](function(){_0x35732a[_0x6d7b('0x17')](0xcc)[_0x6d7b('0x18')]();});}};}function handleEntityNotFound(_0x2a7f51,_0x67fb3a){return function(_0x55bc2f){if(!_0x55bc2f){_0x2a7f51[_0x6d7b('0x16')](0x194);}return _0x55bc2f;};}function handleError(_0x2513ac,_0x1dd113){_0x1dd113=_0x1dd113||0x1f4;return function(_0x3e0fb8){logger['error'](_0x3e0fb8[_0x6d7b('0x25')]);if(_0x3e0fb8[_0x6d7b('0x26')]){delete _0x3e0fb8['name'];}_0x2513ac['status'](_0x1dd113)[_0x6d7b('0x27')](_0x3e0fb8);};}exports[_0x6d7b('0x28')]=function(_0x312aa7,_0x4bbb71){var _0xde6282={},_0x551037={},_0xc25144={'count':0x0,'rows':[]};var _0x1a25a0=_[_0x6d7b('0x29')](db[_0x6d7b('0x2a')][_0x6d7b('0x2b')],function(_0x581762){return{'name':_0x581762[_0x6d7b('0x2c')],'type':_0x581762[_0x6d7b('0x2d')]['key']};});_0x551037[_0x6d7b('0x2e')]=_[_0x6d7b('0x29')](_0x1a25a0,_0x6d7b('0x26'));_0x551037[_0x6d7b('0x2f')]=_[_0x6d7b('0x30')](_0x312aa7[_0x6d7b('0x2f')]);_0x551037[_0x6d7b('0x31')]=_['intersection'](_0x551037[_0x6d7b('0x2e')],_0x551037[_0x6d7b('0x2f')]);_0xde6282[_0x6d7b('0x32')]=_[_0x6d7b('0x33')](_0x551037[_0x6d7b('0x2e')],qs[_0x6d7b('0x34')](_0x312aa7[_0x6d7b('0x2f')][_0x6d7b('0x34')]));_0xde6282[_0x6d7b('0x32')]=_0xde6282[_0x6d7b('0x32')][_0x6d7b('0x35')]?_0xde6282['attributes']:_0x551037[_0x6d7b('0x2e')];if(!_0x312aa7[_0x6d7b('0x2f')][_0x6d7b('0x36')](_0x6d7b('0x37'))){_0xde6282[_0x6d7b('0x1b')]=qs[_0x6d7b('0x1b')](_0x312aa7[_0x6d7b('0x2f')][_0x6d7b('0x1b')]);_0xde6282[_0x6d7b('0x1d')]=qs[_0x6d7b('0x1d')](_0x312aa7[_0x6d7b('0x2f')][_0x6d7b('0x1d')]);}_0xde6282['order']=qs['sort'](_0x312aa7[_0x6d7b('0x2f')][_0x6d7b('0x38')]);_0xde6282[_0x6d7b('0x39')]=qs[_0x6d7b('0x31')](_['pick'](_0x312aa7[_0x6d7b('0x2f')],_0x551037[_0x6d7b('0x31')]),_0x1a25a0);if(_0x312aa7[_0x6d7b('0x2f')][_0x6d7b('0x3a')]){_0xde6282['where']=_[_0x6d7b('0x3b')](_0xde6282['where'],{'$or':_[_0x6d7b('0x29')](_0x1a25a0,function(_0x161c81){if(_0x161c81['type']!==_0x6d7b('0x3c')){var _0x4fcd2f={};_0x4fcd2f[_0x161c81[_0x6d7b('0x26')]]={'$like':'%'+_0x312aa7[_0x6d7b('0x2f')][_0x6d7b('0x3a')]+'%'};return _0x4fcd2f;}})});}_0xde6282=_[_0x6d7b('0x3b')]({},_0xde6282,_0x312aa7[_0x6d7b('0x3d')]);var _0x5cd5e3={'where':_0xde6282['where']};return db[_0x6d7b('0x2a')][_0x6d7b('0x1c')](_0x5cd5e3)[_0x6d7b('0x23')](function(_0x5e7749){_0xc25144[_0x6d7b('0x1c')]=_0x5e7749;if(_0x312aa7[_0x6d7b('0x2f')][_0x6d7b('0x3e')]){_0xde6282[_0x6d7b('0x3f')]=[{'all':!![]}];}return db['FreshsalesField'][_0x6d7b('0x40')](_0xde6282);})[_0x6d7b('0x23')](function(_0x5c0275){_0xc25144['rows']=_0x5c0275;return _0xc25144;})[_0x6d7b('0x23')](respondWithFilteredResult(_0x4bbb71,_0xde6282))[_0x6d7b('0x41')](handleError(_0x4bbb71,null));};exports[_0x6d7b('0x42')]=function(_0x5b3f03,_0x30c7e5){var _0x53cfb3={'raw':!![],'where':{'id':_0x5b3f03[_0x6d7b('0x43')]['id']}},_0x277ed1={};_0x277ed1['model']=_['keys'](db['FreshsalesField'][_0x6d7b('0x2b')]);_0x277ed1[_0x6d7b('0x2f')]=_[_0x6d7b('0x30')](_0x5b3f03[_0x6d7b('0x2f')]);_0x277ed1[_0x6d7b('0x31')]=_[_0x6d7b('0x33')](_0x277ed1[_0x6d7b('0x2e')],_0x277ed1['query']);_0x53cfb3['attributes']=_[_0x6d7b('0x33')](_0x277ed1['model'],qs['fields'](_0x5b3f03[_0x6d7b('0x2f')][_0x6d7b('0x34')]));_0x53cfb3['attributes']=_0x53cfb3[_0x6d7b('0x32')][_0x6d7b('0x35')]?_0x53cfb3['attributes']:_0x277ed1[_0x6d7b('0x2e')];if(_0x5b3f03[_0x6d7b('0x2f')][_0x6d7b('0x3e')]){_0x53cfb3[_0x6d7b('0x3f')]=[{'all':!![]}];}_0x53cfb3=_[_0x6d7b('0x3b')]({},_0x53cfb3,_0x5b3f03['options']);return db[_0x6d7b('0x2a')][_0x6d7b('0x44')](_0x53cfb3)[_0x6d7b('0x23')](handleEntityNotFound(_0x30c7e5,null))[_0x6d7b('0x23')](respondWithResult(_0x30c7e5,null))['catch'](handleError(_0x30c7e5,null));};exports[_0x6d7b('0x45')]=function(_0x418267,_0x5d4cf7){return db[_0x6d7b('0x2a')][_0x6d7b('0x45')](_0x418267[_0x6d7b('0x46')],{})[_0x6d7b('0x23')](respondWithResult(_0x5d4cf7,0xc9))[_0x6d7b('0x41')](handleError(_0x5d4cf7,null));};exports['update']=function(_0x5a33ab,_0x443eb9){if(_0x5a33ab[_0x6d7b('0x46')]['id']){delete _0x5a33ab['body']['id'];}return db['FreshsalesField']['find']({'where':{'id':_0x5a33ab[_0x6d7b('0x43')]['id']}})[_0x6d7b('0x23')](handleEntityNotFound(_0x443eb9,null))[_0x6d7b('0x23')](saveUpdates(_0x5a33ab[_0x6d7b('0x46')],null))[_0x6d7b('0x23')](respondWithResult(_0x443eb9,null))['catch'](handleError(_0x443eb9,null));};exports[_0x6d7b('0x24')]=function(_0x14ff6c,_0x1c4e22){return db[_0x6d7b('0x2a')][_0x6d7b('0x44')]({'where':{'id':_0x14ff6c[_0x6d7b('0x43')]['id']}})[_0x6d7b('0x23')](handleEntityNotFound(_0x1c4e22,null))['then'](removeEntity(_0x1c4e22,null))[_0x6d7b('0x41')](handleError(_0x1c4e22,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index f3aa896..8f5003a 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 _0xcf37=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','int_freshsales_fields','freshsales_unique_index','idField','util'];(function(_0x2e4f25,_0x136e96){var _0x5a77cf=function(_0x16d7a0){while(--_0x16d7a0){_0x2e4f25['push'](_0x2e4f25['shift']());}};_0x5a77cf(++_0x136e96);}(_0xcf37,0xdc));var _0x7cf3=function(_0x40b036,_0x23178c){_0x40b036=_0x40b036-0x0;var _0x20348e=_0xcf37[_0x40b036];return _0x20348e;};'use strict';var _=require('lodash');var util=require(_0x7cf3('0x0'));var logger=require(_0x7cf3('0x1'))(_0x7cf3('0x2'));var moment=require(_0x7cf3('0x3'));var BPromise=require(_0x7cf3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7cf3('0x5'));var rimraf=require(_0x7cf3('0x6'));var config=require(_0x7cf3('0x7'));var attributes=require(_0x7cf3('0x8'));module[_0x7cf3('0x9')]=function(_0x48c7cf,_0x488938){return _0x48c7cf['define']('FreshsalesField',attributes,{'tableName':_0x7cf3('0xa'),'paranoid':![],'indexes':[{'name':_0x7cf3('0xb'),'fields':[_0x7cf3('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xef0f=['request-promise','path','rimraf','./intFreshsalesField.attributes','exports','define','FreshsalesField','freshsales_unique_index','FieldId','lodash','../../config/logger','api','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xef0f,0x168));var _0xfef0=function(_0x2234b5,_0x35e94d){_0x2234b5=_0x2234b5-0x0;var _0x2803b5=_0xef0f[_0x2234b5];return _0x2803b5;};'use strict';var _=require(_0xfef0('0x0'));var util=require('util');var logger=require(_0xfef0('0x1'))(_0xfef0('0x2'));var moment=require(_0xfef0('0x3'));var BPromise=require('bluebird');var rp=require(_0xfef0('0x4'));var fs=require('fs');var path=require(_0xfef0('0x5'));var rimraf=require(_0xfef0('0x6'));var config=require('../../config/environment');var attributes=require(_0xfef0('0x7'));module[_0xfef0('0x8')]=function(_0x2697df,_0x315a8c){return _0x2697df[_0xfef0('0x9')](_0xfef0('0xa'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':_0xfef0('0xb'),'fields':['idField',_0xfef0('0xc')],'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 c5499c9..9536462 100644 --- a/server/api/intFreshsalesField/intFreshsalesField.rpc.js +++ b/server/api/intFreshsalesField/intFreshsalesField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x01d9=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x5e5ffc,_0x2529dd){var _0x3041c6=function(_0x5511f4){while(--_0x5511f4){_0x5e5ffc['push'](_0x5e5ffc['shift']());}};_0x3041c6(++_0x2529dd);}(_0x01d9,0x6c));var _0x901d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x01d9[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x901d('0x0'));var util=require(_0x901d('0x1'));var moment=require(_0x901d('0x2'));var BPromise=require(_0x901d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x901d('0x4'));var db=require(_0x901d('0x5'))['db'];var utils=require(_0x901d('0x6'));var logger=require(_0x901d('0x7'))(_0x901d('0x8'));var config=require(_0x901d('0x9'));var jayson=require(_0x901d('0xa'));var client=jayson['client'][_0x901d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x6c9ac8,_0x21e1d7,_0x12c39f){return new BPromise(function(_0x313f85,_0x39fc94){return client[_0x901d('0xc')](_0x6c9ac8,_0x12c39f)[_0x901d('0xd')](function(_0x15076e){logger[_0x901d('0xe')](_0x901d('0xf'),_0x21e1d7,_0x901d('0x10'));logger[_0x901d('0x11')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x21e1d7,_0x901d('0x10'),JSON['stringify'](_0x15076e));if(_0x15076e[_0x901d('0x12')]){if(_0x15076e[_0x901d('0x12')][_0x901d('0x13')]===0x1f4){logger[_0x901d('0x12')](_0x901d('0xf'),_0x21e1d7,_0x15076e['error'][_0x901d('0x14')]);return _0x39fc94(_0x15076e[_0x901d('0x12')][_0x901d('0x14')]);}logger[_0x901d('0x12')](_0x901d('0xf'),_0x21e1d7,_0x15076e[_0x901d('0x12')]['message']);return _0x313f85(_0x15076e[_0x901d('0x12')][_0x901d('0x14')]);}else{logger[_0x901d('0xe')](_0x901d('0xf'),_0x21e1d7,_0x901d('0x10'));_0x313f85(_0x15076e[_0x901d('0x15')][_0x901d('0x14')]);}})[_0x901d('0x16')](function(_0x3368fc){logger[_0x901d('0x12')](_0x901d('0xf'),_0x21e1d7,_0x3368fc);_0x39fc94(_0x3368fc);});});} \ No newline at end of file +var _0xe2fe=['then','info','FreshsalesField,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request'];(function(_0x41c1d4,_0x270db8){var _0x58f496=function(_0x4c9dda){while(--_0x4c9dda){_0x41c1d4['push'](_0x41c1d4['shift']());}};_0x58f496(++_0x270db8);}(_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 moment=require('moment');var BPromise=require(_0xee2f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xee2f('0x2'));var db=require(_0xee2f('0x3'))['db'];var utils=require(_0xee2f('0x4'));var logger=require(_0xee2f('0x5'))(_0xee2f('0x6'));var config=require('../../config/environment');var jayson=require(_0xee2f('0x7'));var client=jayson[_0xee2f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1533a0,_0x2e1c8c,_0x5a7975){return new BPromise(function(_0x3c4095,_0x5ea796){return client[_0xee2f('0x9')](_0x1533a0,_0x5a7975)[_0xee2f('0xa')](function(_0x53f7dd){logger[_0xee2f('0xb')](_0xee2f('0xc'),_0x2e1c8c,'request\x20sent');logger['debug']('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x2e1c8c,'request\x20sent',JSON[_0xee2f('0xd')](_0x53f7dd));if(_0x53f7dd['error']){if(_0x53f7dd['error']['code']===0x1f4){logger[_0xee2f('0xe')](_0xee2f('0xc'),_0x2e1c8c,_0x53f7dd[_0xee2f('0xe')][_0xee2f('0xf')]);return _0x5ea796(_0x53f7dd[_0xee2f('0xe')][_0xee2f('0xf')]);}logger['error'](_0xee2f('0xc'),_0x2e1c8c,_0x53f7dd['error'][_0xee2f('0xf')]);return _0x3c4095(_0x53f7dd[_0xee2f('0xe')]['message']);}else{logger[_0xee2f('0xb')](_0xee2f('0xc'),_0x2e1c8c,_0xee2f('0x10'));_0x3c4095(_0x53f7dd[_0xee2f('0x11')][_0xee2f('0xf')]);}})['catch'](function(_0x3f6372){logger['error'](_0xee2f('0xc'),_0x2e1c8c,_0x3f6372);_0x5ea796(_0x3f6372);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index fc39882..a444331 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(_0x546ab5,_0x2a1c97){var _0x10ee4c=function(_0x4cfbf3){while(--_0x4cfbf3){_0x546ab5['push'](_0x546ab5['shift']());}};_0x10ee4c(++_0x2a1c97);}(_0xa9e0,0x123));var _0x0a9e=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xa9e0[_0x521929];return _0x632436;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +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(_0x6ba183,_0x342a98){var _0x5e0957=function(_0xb9ea5b){while(--_0xb9ea5b){_0x6ba183['push'](_0x6ba183['shift']());}};_0x5e0957(++_0x342a98);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index dbe318b..5dcaf6d 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 _0xc6a2=['sequelize','exports','STRING','username','ENUM','integrationTab','newTab'];(function(_0xc4fbc8,_0x455d7c){var _0xe1f707=function(_0x1b3685){while(--_0x1b3685){_0xc4fbc8['push'](_0xc4fbc8['shift']());}};_0xe1f707(++_0x455d7c);}(_0xc6a2,0x69));var _0x2c6a=function(_0x3762df,_0x5364b2){_0x3762df=_0x3762df-0x0;var _0x1ff781=_0xc6a2[_0x3762df];return _0x1ff781;};'use strict';var Sequelize=require(_0x2c6a('0x0'));module[_0x2c6a('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2c6a('0x2')]},'username':{'type':Sequelize[_0x2c6a('0x2')],'unique':_0x2c6a('0x3')},'remoteUri':{'type':Sequelize[_0x2c6a('0x2')]},'password':{'type':Sequelize[_0x2c6a('0x2')]},'clientId':{'type':Sequelize[_0x2c6a('0x2')]},'clientSecret':{'type':Sequelize[_0x2c6a('0x2')]},'securityToken':{'type':Sequelize[_0x2c6a('0x2')]},'serverUrl':{'type':Sequelize[_0x2c6a('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x2c6a('0x4')](_0x2c6a('0x5'),_0x2c6a('0x6')),'defaultValue':_0x2c6a('0x5')}}; \ No newline at end of file +var _0xe9ef=['integrationTab','sequelize','STRING','username','ENUM'];(function(_0x529167,_0x426891){var _0x1adee1=function(_0x2017bb){while(--_0x2017bb){_0x529167['push'](_0x529167['shift']());}};_0x1adee1(++_0x426891);}(_0xe9ef,0x16e));var _0xfe9e=function(_0x4ab3fb,_0x776775){_0x4ab3fb=_0x4ab3fb-0x0;var _0x34fe1e=_0xe9ef[_0x4ab3fb];return _0x34fe1e;};'use strict';var Sequelize=require(_0xfe9e('0x0'));module['exports']={'name':{'type':Sequelize[_0xfe9e('0x1')]},'description':{'type':Sequelize[_0xfe9e('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0xfe9e('0x2')},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xfe9e('0x1')]},'clientId':{'type':Sequelize[_0xfe9e('0x1')]},'clientSecret':{'type':Sequelize[_0xfe9e('0x1')]},'securityToken':{'type':Sequelize[_0xfe9e('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xfe9e('0x3')](_0xfe9e('0x4'),'newTab'),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index da806bd..a882085 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 _0x0620=['securityToken','slice','substring','Connection','username','concat','isNil','ticketType','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','string','int','picklist','boolean','email','textarea','phone','remove','includes','label','picklistValues','True','true','False','false','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../mysqldb','../../components/integrations/configuration','status','end','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','stack','send','SalesforceAccount','rawAttributes','type','model','map','name','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','merge','VIRTUAL','filter','options','include','rows','catch','show','params','includeAll','find','create','body','destroy','getConfigurations','SalesforceConfiguration','hasOwnProperty','nolimit','addConfiguration','findOne','Subjects','channel','Descriptions','getDescriptions','SalesforceField','getFields','remoteUri','clientId','clientSecret','password'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0620,0x10d));var _0x0062=function(_0x5c29eb,_0x88572){_0x5c29eb=_0x5c29eb-0x0;var _0x5d5ce1=_0x0620[_0x5c29eb];return _0x5d5ce1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0062('0x0'));var zipdir=require(_0x0062('0x1'));var jsonpatch=require(_0x0062('0x2'));var rp=require(_0x0062('0x3'));var moment=require(_0x0062('0x4'));var BPromise=require(_0x0062('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x0062('0x6'));var sox=require('sox');var csv=require(_0x0062('0x7'));var ejs=require(_0x0062('0x8'));var fs=require('fs');var fs_extra=require(_0x0062('0x9'));var _=require(_0x0062('0xa'));var squel=require(_0x0062('0xb'));var crypto=require(_0x0062('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x0062('0xd'));var toCsv=require('to-csv');var querystring=require(_0x0062('0xe'));var Papa=require('papaparse');var Redis=require(_0x0062('0xf'));var authService=require(_0x0062('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0062('0x11'));var logger=require(_0x0062('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0062('0x13'))['db'];var integrations=require(_0x0062('0x14'));function respondWithStatusCode(_0x18a774,_0x36447e){_0x36447e=_0x36447e||0xcc;return function(_0x3a6648){if(_0x3a6648){return _0x18a774['sendStatus'](_0x36447e);}return _0x18a774[_0x0062('0x15')](_0x36447e)[_0x0062('0x16')]();};}function respondWithResult(_0xa5841c,_0xd137d2){_0xd137d2=_0xd137d2||0xc8;return function(_0x291313){if(_0x291313){return _0xa5841c[_0x0062('0x15')](_0xd137d2)['json'](_0x291313);}};}function respondWithFilteredResult(_0x272eb0,_0x9b70cf){return function(_0x3ad9e5){if(_0x3ad9e5){var _0x1e6126=typeof _0x9b70cf[_0x0062('0x17')]===_0x0062('0x18')&&typeof _0x9b70cf[_0x0062('0x19')]===_0x0062('0x18');var _0x3e7aee=_0x3ad9e5[_0x0062('0x1a')];var _0x103a9b=_0x1e6126?0x0:_0x9b70cf[_0x0062('0x17')];var _0xacd795=_0x1e6126?_0x3ad9e5[_0x0062('0x1a')]:_0x9b70cf[_0x0062('0x17')]+_0x9b70cf['limit'];var _0x4ae219;if(_0xacd795>=_0x3e7aee){_0xacd795=_0x3e7aee;_0x4ae219=0xc8;}else{_0x4ae219=0xce;}_0x272eb0[_0x0062('0x15')](_0x4ae219);return _0x272eb0[_0x0062('0x1b')](_0x0062('0x1c'),_0x103a9b+'-'+_0xacd795+'/'+_0x3e7aee)['json'](_0x3ad9e5);}return null;};}function patchUpdates(_0x8adb0b){return function(_0x5421e2){try{jsonpatch['apply'](_0x5421e2,_0x8adb0b,!![]);}catch(_0x4b5ed4){return BPromise[_0x0062('0x1d')](_0x4b5ed4);}return _0x5421e2[_0x0062('0x1e')]();};}function saveUpdates(_0x3bb8c3,_0x234af4){return function(_0x3d27b4){if(_0x3d27b4){return _0x3d27b4[_0x0062('0x1f')](_0x3bb8c3)[_0x0062('0x20')](function(_0x4b1b84){return _0x4b1b84;});}return null;};}function removeEntity(_0x1d2758,_0xc71a2d){return function(_0x3c99be){if(_0x3c99be){return _0x3c99be['destroy']()[_0x0062('0x20')](function(){_0x1d2758[_0x0062('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa1c8f9,_0xdfa944){return function(_0x505e50){if(!_0x505e50){_0xa1c8f9['sendStatus'](0x194);}return _0x505e50;};}function handleError(_0x3b06fc,_0xcd9fa4){_0xcd9fa4=_0xcd9fa4||0x1f4;return function(_0x1719ed){logger['error'](_0x1719ed[_0x0062('0x21')]);if(_0x1719ed['name']){delete _0x1719ed['name'];}_0x3b06fc[_0x0062('0x15')](_0xcd9fa4)[_0x0062('0x22')](_0x1719ed);};}exports['index']=function(_0x3fcbab,_0x3f1232){var _0x828b6e={},_0x53ed7d={},_0x2d3c1d={'count':0x0,'rows':[]};var _0x5cb851=_['map'](db[_0x0062('0x23')][_0x0062('0x24')],function(_0x30320b){return{'name':_0x30320b['fieldName'],'type':_0x30320b[_0x0062('0x25')]['key']};});_0x53ed7d[_0x0062('0x26')]=_[_0x0062('0x27')](_0x5cb851,_0x0062('0x28'));_0x53ed7d[_0x0062('0x29')]=_[_0x0062('0x2a')](_0x3fcbab['query']);_0x53ed7d[_0x0062('0x2b')]=_[_0x0062('0x2c')](_0x53ed7d[_0x0062('0x26')],_0x53ed7d['query']);_0x828b6e[_0x0062('0x2d')]=_[_0x0062('0x2c')](_0x53ed7d[_0x0062('0x26')],qs['fields'](_0x3fcbab[_0x0062('0x29')][_0x0062('0x2e')]));_0x828b6e[_0x0062('0x2d')]=_0x828b6e[_0x0062('0x2d')][_0x0062('0x2f')]?_0x828b6e['attributes']:_0x53ed7d[_0x0062('0x26')];if(!_0x3fcbab[_0x0062('0x29')]['hasOwnProperty']('nolimit')){_0x828b6e[_0x0062('0x19')]=qs[_0x0062('0x19')](_0x3fcbab[_0x0062('0x29')][_0x0062('0x19')]);_0x828b6e[_0x0062('0x17')]=qs[_0x0062('0x17')](_0x3fcbab[_0x0062('0x29')][_0x0062('0x17')]);}_0x828b6e[_0x0062('0x30')]=qs[_0x0062('0x31')](_0x3fcbab[_0x0062('0x29')][_0x0062('0x31')]);_0x828b6e[_0x0062('0x32')]=qs[_0x0062('0x2b')](_[_0x0062('0x33')](_0x3fcbab[_0x0062('0x29')],_0x53ed7d[_0x0062('0x2b')]),_0x5cb851);if(_0x3fcbab['query']['filter']){_0x828b6e[_0x0062('0x32')]=_[_0x0062('0x34')](_0x828b6e[_0x0062('0x32')],{'$or':_['map'](_0x5cb851,function(_0x2da261){if(_0x2da261['type']!==_0x0062('0x35')){var _0x48f05c={};_0x48f05c[_0x2da261[_0x0062('0x28')]]={'$like':'%'+_0x3fcbab['query'][_0x0062('0x36')]+'%'};return _0x48f05c;}})});}_0x828b6e=_[_0x0062('0x34')]({},_0x828b6e,_0x3fcbab[_0x0062('0x37')]);var _0x384081={'where':_0x828b6e['where']};return db[_0x0062('0x23')][_0x0062('0x1a')](_0x384081)['then'](function(_0x190094){_0x2d3c1d[_0x0062('0x1a')]=_0x190094;if(_0x3fcbab['query']['includeAll']){_0x828b6e[_0x0062('0x38')]=[{'all':!![]}];}return db['SalesforceAccount']['findAll'](_0x828b6e);})[_0x0062('0x20')](function(_0x2c8ddd){_0x2d3c1d[_0x0062('0x39')]=_0x2c8ddd;return _0x2d3c1d;})[_0x0062('0x20')](respondWithFilteredResult(_0x3f1232,_0x828b6e))[_0x0062('0x3a')](handleError(_0x3f1232,null));};exports[_0x0062('0x3b')]=function(_0x15357d,_0x46e3ff){var _0x3238f9={'raw':![],'where':{'id':_0x15357d[_0x0062('0x3c')]['id']}},_0x26e5ea={};_0x26e5ea[_0x0062('0x26')]=_[_0x0062('0x2a')](db['SalesforceAccount'][_0x0062('0x24')]);_0x26e5ea['query']=_[_0x0062('0x2a')](_0x15357d[_0x0062('0x29')]);_0x26e5ea[_0x0062('0x2b')]=_[_0x0062('0x2c')](_0x26e5ea[_0x0062('0x26')],_0x26e5ea[_0x0062('0x29')]);_0x3238f9[_0x0062('0x2d')]=_[_0x0062('0x2c')](_0x26e5ea[_0x0062('0x26')],qs[_0x0062('0x2e')](_0x15357d[_0x0062('0x29')][_0x0062('0x2e')]));_0x3238f9[_0x0062('0x2d')]=_0x3238f9[_0x0062('0x2d')][_0x0062('0x2f')]?_0x3238f9[_0x0062('0x2d')]:_0x26e5ea[_0x0062('0x26')];if(_0x15357d[_0x0062('0x29')][_0x0062('0x3d')]){_0x3238f9[_0x0062('0x38')]=[{'all':!![]}];}_0x3238f9=_['merge']({},_0x3238f9,_0x15357d['options']);return db[_0x0062('0x23')][_0x0062('0x3e')](_0x3238f9)[_0x0062('0x20')](handleEntityNotFound(_0x46e3ff,null))[_0x0062('0x20')](respondWithResult(_0x46e3ff,null))[_0x0062('0x3a')](handleError(_0x46e3ff,null));};exports[_0x0062('0x3f')]=function(_0x5d8c04,_0x471791){return db[_0x0062('0x23')]['create'](_0x5d8c04['body'],{})[_0x0062('0x20')](respondWithResult(_0x471791,0xc9))[_0x0062('0x3a')](handleError(_0x471791,null));};exports[_0x0062('0x1f')]=function(_0x19cc15,_0x1c5d19){if(_0x19cc15[_0x0062('0x40')]['id']){delete _0x19cc15[_0x0062('0x40')]['id'];}return db[_0x0062('0x23')][_0x0062('0x3e')]({'where':{'id':_0x19cc15[_0x0062('0x3c')]['id']}})[_0x0062('0x20')](handleEntityNotFound(_0x1c5d19,null))['then'](saveUpdates(_0x19cc15[_0x0062('0x40')],null))[_0x0062('0x20')](respondWithResult(_0x1c5d19,null))[_0x0062('0x3a')](handleError(_0x1c5d19,null));};exports[_0x0062('0x41')]=function(_0x2cc96e,_0x414905){return db[_0x0062('0x23')][_0x0062('0x3e')]({'where':{'id':_0x2cc96e[_0x0062('0x3c')]['id']}})[_0x0062('0x20')](handleEntityNotFound(_0x414905,null))[_0x0062('0x20')](removeEntity(_0x414905,null))[_0x0062('0x3a')](handleError(_0x414905,null));};exports[_0x0062('0x42')]=function(_0x120601,_0x224c23,_0x121b85){var _0x18f2da={};var _0x4af4cc={};var _0x45a5ab;var _0xaca091;return db[_0x0062('0x23')]['findOne']({'where':{'id':_0x120601[_0x0062('0x3c')]['id']}})['then'](handleEntityNotFound(_0x224c23,null))['then'](function(_0x415cee){if(_0x415cee){_0x45a5ab=_0x415cee;_0x4af4cc['model']=_[_0x0062('0x2a')](db[_0x0062('0x43')][_0x0062('0x24')]);_0x4af4cc[_0x0062('0x29')]=_[_0x0062('0x2a')](_0x120601[_0x0062('0x29')]);_0x4af4cc['filters']=_[_0x0062('0x2c')](_0x4af4cc['model'],_0x4af4cc[_0x0062('0x29')]);_0x18f2da[_0x0062('0x2d')]=_[_0x0062('0x2c')](_0x4af4cc[_0x0062('0x26')],qs['fields'](_0x120601[_0x0062('0x29')][_0x0062('0x2e')]));_0x18f2da['attributes']=_0x18f2da['attributes'][_0x0062('0x2f')]?_0x18f2da[_0x0062('0x2d')]:_0x4af4cc['model'];_0x18f2da['order']=qs[_0x0062('0x31')](_0x120601[_0x0062('0x29')][_0x0062('0x31')]);_0x18f2da[_0x0062('0x32')]=qs[_0x0062('0x2b')](_['pick'](_0x120601[_0x0062('0x29')],_0x4af4cc[_0x0062('0x2b')]));if(_0x120601['query'][_0x0062('0x36')]){_0x18f2da['where']=_['merge'](_0x18f2da[_0x0062('0x32')],{'$or':_[_0x0062('0x27')](_0x18f2da[_0x0062('0x2d')],function(_0x5a4360){var _0x21b75c={};_0x21b75c[_0x5a4360]={'$like':'%'+_0x120601[_0x0062('0x29')]['filter']+'%'};return _0x21b75c;})});}_0x18f2da=_[_0x0062('0x34')]({},_0x18f2da,_0x120601[_0x0062('0x37')]);return _0x45a5ab['getConfigurations'](_0x18f2da);}})[_0x0062('0x20')](function(_0x3de737){if(_0x3de737){_0xaca091=_0x3de737[_0x0062('0x2f')];if(!_0x120601['query'][_0x0062('0x44')](_0x0062('0x45'))){_0x18f2da[_0x0062('0x19')]=qs['limit'](_0x120601[_0x0062('0x29')][_0x0062('0x19')]);_0x18f2da[_0x0062('0x17')]=qs[_0x0062('0x17')](_0x120601[_0x0062('0x29')]['offset']);}return _0x45a5ab[_0x0062('0x42')](_0x18f2da);}})['then'](function(_0x16d823){if(_0x16d823){return _0x16d823?{'count':_0xaca091,'rows':_0x16d823}:null;}})[_0x0062('0x20')](respondWithResult(_0x224c23,null))[_0x0062('0x3a')](handleError(_0x224c23,null));};exports[_0x0062('0x46')]=function(_0x1b32c5,_0x44670a,_0x55f9cf){if(_0x1b32c5[_0x0062('0x40')]['id']){delete _0x1b32c5['body']['id'];}return db['SalesforceAccount'][_0x0062('0x47')]({'where':{'id':_0x1b32c5[_0x0062('0x3c')]['id']}})['then'](handleEntityNotFound(_0x44670a,null))[_0x0062('0x20')](function(_0x482f07){if(_0x482f07){_0x1b32c5[_0x0062('0x40')]['AccountId']=_0x482f07['id'];_0x1b32c5[_0x0062('0x40')][_0x0062('0x48')]=integrations['getSubjects'](_0x1b32c5[_0x0062('0x40')][_0x0062('0x49')],_0x1b32c5['body'][_0x0062('0x25')]);_0x1b32c5[_0x0062('0x40')][_0x0062('0x4a')]=integrations[_0x0062('0x4b')](_0x1b32c5['body'][_0x0062('0x49')],_0x1b32c5[_0x0062('0x40')][_0x0062('0x25')]);return db[_0x0062('0x43')][_0x0062('0x3f')](_0x1b32c5[_0x0062('0x40')],{'include':[{'model':db['SalesforceField'],'as':_0x0062('0x48')},{'model':db[_0x0062('0x4c')],'as':_0x0062('0x4a')}]});}return null;})[_0x0062('0x20')](respondWithResult(_0x44670a,null))[_0x0062('0x3a')](handleError(_0x44670a,null));};exports[_0x0062('0x4d')]=function(_0x42ed3d,_0xab14a0,_0x42ebdc){var _0x3ef51b;var _0x3b75d2='';var _0x41f8a0='Task';return db['SalesforceAccount'][_0x0062('0x47')]({'where':{'id':_0x42ed3d[_0x0062('0x3c')]['id']},'attributes':['id',_0x0062('0x4e'),_0x0062('0x4f'),_0x0062('0x50'),'username',_0x0062('0x51'),_0x0062('0x52')]})[_0x0062('0x20')](handleEntityNotFound(_0xab14a0,null))[_0x0062('0x20')](function(_0x48d837){if(_0x48d837){_0x3b75d2=_0x48d837[_0x0062('0x4e')];var _0x5c03ef=_0x3b75d2[_0x0062('0x53')](-0x1);if(_0x5c03ef==='/'){_0x3b75d2=_0x3b75d2[_0x0062('0x54')](0x0,_0x3b75d2['lastIndexOf'](_0x5c03ef));}_0x3ef51b=new jsforce[(_0x0062('0x55'))]({'oauth2':{'loginUrl':_0x3b75d2,'clientId':_0x48d837[_0x0062('0x4f')],'clientSecret':_0x48d837['clientSecret']}});return _0x3ef51b['login'](_0x48d837[_0x0062('0x56')],_0x48d837[_0x0062('0x51')][_0x0062('0x57')](_0x48d837[_0x0062('0x52')]));}})[_0x0062('0x20')](function(_0x3e0331){if(_0x3e0331){if(!_[_0x0062('0x58')](_0x42ed3d[_0x0062('0x29')][_0x0062('0x59')])){_0x41f8a0=_0x42ed3d[_0x0062('0x29')]['ticketType'];}return _0x3ef51b['sobject'](_0x41f8a0)['describe']();}})['then'](function(_0x2793ad){var _0xd59c00=[_0x0062('0x5a'),_0x0062('0x5b'),_0x0062('0x5c'),_0x0062('0x5d'),_0x0062('0x5e'),_0x0062('0x5f')];var _0x47b2b4=[_0x0062('0x60'),_0x0062('0x61'),_0x0062('0x62'),_0x0062('0x63'),_0x0062('0x64'),_0x0062('0x65'),_0x0062('0x66')];if(_0x2793ad){_[_0x0062('0x67')](_0x2793ad[_0x0062('0x2e')],function(_0x3ebf4b){return _0xd59c00[_0x0062('0x68')](_0x3ebf4b['name'])||!_0x47b2b4[_0x0062('0x68')](_0x3ebf4b['type']);});return{'count':_0x2793ad['fields']['length'],'rows':_[_0x0062('0x27')](_0x2793ad[_0x0062('0x2e')],function(_0x2f1c25){return{'id':_0x2f1c25[_0x0062('0x28')],'name':_0x2f1c25[_0x0062('0x69')],'custom':_0x2f1c25['custom'],'options':_0x2f1c25[_0x0062('0x6a')][_0x0062('0x2f')]>0x0?_[_0x0062('0x27')](_0x2f1c25[_0x0062('0x6a')],function(_0x1a57fd){return{'name':_0x1a57fd['label'],'value':_0x1a57fd['value']};}):_0x2f1c25[_0x0062('0x25')]==_0x0062('0x63')?[{'name':_0x0062('0x6b'),'value':_0x0062('0x6c')},{'name':_0x0062('0x6d'),'value':_0x0062('0x6e')}]:[]};})};}})['then'](respondWithResult(_0xab14a0,null))[_0x0062('0x3a')](function(_0x57e6b0){var _0x390211=_0x42ed3d[_0x0062('0x29')][_0x0062('0x6f')]?0x1f4:_0x57e6b0[_0x0062('0x70')]||0x1f4;logger[_0x0062('0x71')](_0x0062('0x72'),'getFields',_0x390211,JSON[_0x0062('0x73')](_0x57e6b0));delete _0x57e6b0[_0x0062('0x28')];if(_0x390211===0x191){_0x390211=0x190;}_0xab14a0[_0x0062('0x15')](_0x390211)[_0x0062('0x22')](_0x42ed3d[_0x0062('0x29')]['test']?{'message':_0x0062('0x74'),'statusCode':_0x57e6b0['statusCode']}:_0x57e6b0);});}; \ No newline at end of file +var _0xa7bb=['lastIndexOf','Connection','concat','isNil','ticketType','sobject','describe','IsRecurrence','Subject','Description','string','picklist','boolean','phone','includes','label','custom','picklistValues','value','True','true','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','then','destroy','stack','name','send','map','rawAttributes','fieldName','type','key','model','filters','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','options','include','SalesforceAccount','findAll','rows','show','params','keys','catch','create','body','update','find','getConfigurations','findOne','SalesforceConfiguration','pick','filter','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','Task','remoteUri','clientId','clientSecret','username','password','securityToken','slice','substring'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0xa7bb,0x197));var _0xba7b=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0xa7bb[_0x5608a3];return _0x1ed50a;};'use strict';var emlformat=require(_0xba7b('0x0'));var rimraf=require(_0xba7b('0x1'));var zipdir=require(_0xba7b('0x2'));var jsonpatch=require(_0xba7b('0x3'));var rp=require(_0xba7b('0x4'));var moment=require(_0xba7b('0x5'));var BPromise=require(_0xba7b('0x6'));var Mustache=require(_0xba7b('0x7'));var util=require('util');var path=require('path');var sox=require(_0xba7b('0x8'));var csv=require(_0xba7b('0x9'));var ejs=require(_0xba7b('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xba7b('0xb'));var squel=require(_0xba7b('0xc'));var crypto=require(_0xba7b('0xd'));var jsforce=require(_0xba7b('0xe'));var deskjs=require(_0xba7b('0xf'));var toCsv=require(_0xba7b('0x9'));var querystring=require(_0xba7b('0x10'));var Papa=require(_0xba7b('0x11'));var Redis=require(_0xba7b('0x12'));var authService=require(_0xba7b('0x13'));var qs=require(_0xba7b('0x14'));var as=require(_0xba7b('0x15'));var hardwareService=require(_0xba7b('0x16'));var logger=require(_0xba7b('0x17'))(_0xba7b('0x18'));var utils=require('../../config/utils');var config=require(_0xba7b('0x19'));var licenseUtil=require(_0xba7b('0x1a'));var db=require(_0xba7b('0x1b'))['db'];var integrations=require(_0xba7b('0x1c'));function respondWithStatusCode(_0x424f7d,_0x43d100){_0x43d100=_0x43d100||0xcc;return function(_0x4d655c){if(_0x4d655c){return _0x424f7d[_0xba7b('0x1d')](_0x43d100);}return _0x424f7d[_0xba7b('0x1e')](_0x43d100)[_0xba7b('0x1f')]();};}function respondWithResult(_0x2adc9c,_0x39b606){_0x39b606=_0x39b606||0xc8;return function(_0x4cb51e){if(_0x4cb51e){return _0x2adc9c[_0xba7b('0x1e')](_0x39b606)[_0xba7b('0x20')](_0x4cb51e);}};}function respondWithFilteredResult(_0x5906c6,_0x2b20cd){return function(_0x149476){if(_0x149476){var _0x3cbec1=typeof _0x2b20cd[_0xba7b('0x21')]===_0xba7b('0x22')&&typeof _0x2b20cd[_0xba7b('0x23')]===_0xba7b('0x22');var _0x2acb96=_0x149476[_0xba7b('0x24')];var _0x264c27=_0x3cbec1?0x0:_0x2b20cd[_0xba7b('0x21')];var _0xd8ab18=_0x3cbec1?_0x149476[_0xba7b('0x24')]:_0x2b20cd['offset']+_0x2b20cd['limit'];var _0x4c2022;if(_0xd8ab18>=_0x2acb96){_0xd8ab18=_0x2acb96;_0x4c2022=0xc8;}else{_0x4c2022=0xce;}_0x5906c6[_0xba7b('0x1e')](_0x4c2022);return _0x5906c6['set']('Content-Range',_0x264c27+'-'+_0xd8ab18+'/'+_0x2acb96)[_0xba7b('0x20')](_0x149476);}return null;};}function patchUpdates(_0xce008b){return function(_0x101e43){try{jsonpatch[_0xba7b('0x25')](_0x101e43,_0xce008b,!![]);}catch(_0xc82365){return BPromise[_0xba7b('0x26')](_0xc82365);}return _0x101e43[_0xba7b('0x27')]();};}function saveUpdates(_0x109fb9,_0x44220b){return function(_0x57239a){if(_0x57239a){return _0x57239a['update'](_0x109fb9)[_0xba7b('0x28')](function(_0xe03f63){return _0xe03f63;});}return null;};}function removeEntity(_0x5e63f9,_0x490d54){return function(_0x30d5b7){if(_0x30d5b7){return _0x30d5b7[_0xba7b('0x29')]()[_0xba7b('0x28')](function(){_0x5e63f9[_0xba7b('0x1e')](0xcc)[_0xba7b('0x1f')]();});}};}function handleEntityNotFound(_0x48cb84,_0x1d1eea){return function(_0x43ecdb){if(!_0x43ecdb){_0x48cb84[_0xba7b('0x1d')](0x194);}return _0x43ecdb;};}function handleError(_0x475c52,_0x123078){_0x123078=_0x123078||0x1f4;return function(_0x13039e){logger['error'](_0x13039e[_0xba7b('0x2a')]);if(_0x13039e[_0xba7b('0x2b')]){delete _0x13039e['name'];}_0x475c52['status'](_0x123078)[_0xba7b('0x2c')](_0x13039e);};}exports['index']=function(_0xefcf7e,_0x549a2e){var _0x5dc814={},_0x1b6273={},_0x587753={'count':0x0,'rows':[]};var _0x4dc8b1=_[_0xba7b('0x2d')](db['SalesforceAccount'][_0xba7b('0x2e')],function(_0xb596f8){return{'name':_0xb596f8[_0xba7b('0x2f')],'type':_0xb596f8[_0xba7b('0x30')][_0xba7b('0x31')]};});_0x1b6273[_0xba7b('0x32')]=_[_0xba7b('0x2d')](_0x4dc8b1,_0xba7b('0x2b'));_0x1b6273['query']=_['keys'](_0xefcf7e['query']);_0x1b6273[_0xba7b('0x33')]=_[_0xba7b('0x34')](_0x1b6273[_0xba7b('0x32')],_0x1b6273['query']);_0x5dc814[_0xba7b('0x35')]=_['intersection'](_0x1b6273['model'],qs[_0xba7b('0x36')](_0xefcf7e[_0xba7b('0x37')][_0xba7b('0x36')]));_0x5dc814['attributes']=_0x5dc814[_0xba7b('0x35')][_0xba7b('0x38')]?_0x5dc814[_0xba7b('0x35')]:_0x1b6273[_0xba7b('0x32')];if(!_0xefcf7e[_0xba7b('0x37')][_0xba7b('0x39')](_0xba7b('0x3a'))){_0x5dc814[_0xba7b('0x23')]=qs[_0xba7b('0x23')](_0xefcf7e[_0xba7b('0x37')][_0xba7b('0x23')]);_0x5dc814[_0xba7b('0x21')]=qs['offset'](_0xefcf7e[_0xba7b('0x37')][_0xba7b('0x21')]);}_0x5dc814[_0xba7b('0x3b')]=qs[_0xba7b('0x3c')](_0xefcf7e[_0xba7b('0x37')][_0xba7b('0x3c')]);_0x5dc814[_0xba7b('0x3d')]=qs[_0xba7b('0x33')](_['pick'](_0xefcf7e[_0xba7b('0x37')],_0x1b6273[_0xba7b('0x33')]),_0x4dc8b1);if(_0xefcf7e[_0xba7b('0x37')]['filter']){_0x5dc814[_0xba7b('0x3d')]=_[_0xba7b('0x3e')](_0x5dc814[_0xba7b('0x3d')],{'$or':_[_0xba7b('0x2d')](_0x4dc8b1,function(_0x5a24a9){if(_0x5a24a9[_0xba7b('0x30')]!==_0xba7b('0x3f')){var _0x3797dd={};_0x3797dd[_0x5a24a9[_0xba7b('0x2b')]]={'$like':'%'+_0xefcf7e['query']['filter']+'%'};return _0x3797dd;}})});}_0x5dc814=_[_0xba7b('0x3e')]({},_0x5dc814,_0xefcf7e[_0xba7b('0x40')]);var _0xb322cd={'where':_0x5dc814['where']};return db['SalesforceAccount']['count'](_0xb322cd)[_0xba7b('0x28')](function(_0x3ba576){_0x587753[_0xba7b('0x24')]=_0x3ba576;if(_0xefcf7e[_0xba7b('0x37')]['includeAll']){_0x5dc814[_0xba7b('0x41')]=[{'all':!![]}];}return db[_0xba7b('0x42')][_0xba7b('0x43')](_0x5dc814);})[_0xba7b('0x28')](function(_0x126eb6){_0x587753[_0xba7b('0x44')]=_0x126eb6;return _0x587753;})['then'](respondWithFilteredResult(_0x549a2e,_0x5dc814))['catch'](handleError(_0x549a2e,null));};exports[_0xba7b('0x45')]=function(_0x22f786,_0x34336){var _0x5685d6={'raw':![],'where':{'id':_0x22f786[_0xba7b('0x46')]['id']}},_0x430e00={};_0x430e00[_0xba7b('0x32')]=_[_0xba7b('0x47')](db[_0xba7b('0x42')]['rawAttributes']);_0x430e00[_0xba7b('0x37')]=_[_0xba7b('0x47')](_0x22f786[_0xba7b('0x37')]);_0x430e00[_0xba7b('0x33')]=_[_0xba7b('0x34')](_0x430e00[_0xba7b('0x32')],_0x430e00[_0xba7b('0x37')]);_0x5685d6['attributes']=_[_0xba7b('0x34')](_0x430e00[_0xba7b('0x32')],qs['fields'](_0x22f786[_0xba7b('0x37')][_0xba7b('0x36')]));_0x5685d6[_0xba7b('0x35')]=_0x5685d6[_0xba7b('0x35')][_0xba7b('0x38')]?_0x5685d6[_0xba7b('0x35')]:_0x430e00[_0xba7b('0x32')];if(_0x22f786[_0xba7b('0x37')]['includeAll']){_0x5685d6[_0xba7b('0x41')]=[{'all':!![]}];}_0x5685d6=_['merge']({},_0x5685d6,_0x22f786[_0xba7b('0x40')]);return db[_0xba7b('0x42')]['find'](_0x5685d6)[_0xba7b('0x28')](handleEntityNotFound(_0x34336,null))['then'](respondWithResult(_0x34336,null))[_0xba7b('0x48')](handleError(_0x34336,null));};exports[_0xba7b('0x49')]=function(_0x11d204,_0x3d0276){return db[_0xba7b('0x42')]['create'](_0x11d204[_0xba7b('0x4a')],{})[_0xba7b('0x28')](respondWithResult(_0x3d0276,0xc9))[_0xba7b('0x48')](handleError(_0x3d0276,null));};exports[_0xba7b('0x4b')]=function(_0x57aa0e,_0x5b2999){if(_0x57aa0e['body']['id']){delete _0x57aa0e[_0xba7b('0x4a')]['id'];}return db[_0xba7b('0x42')][_0xba7b('0x4c')]({'where':{'id':_0x57aa0e[_0xba7b('0x46')]['id']}})['then'](handleEntityNotFound(_0x5b2999,null))['then'](saveUpdates(_0x57aa0e[_0xba7b('0x4a')],null))[_0xba7b('0x28')](respondWithResult(_0x5b2999,null))[_0xba7b('0x48')](handleError(_0x5b2999,null));};exports[_0xba7b('0x29')]=function(_0x2190c3,_0x20d229){return db[_0xba7b('0x42')][_0xba7b('0x4c')]({'where':{'id':_0x2190c3[_0xba7b('0x46')]['id']}})['then'](handleEntityNotFound(_0x20d229,null))[_0xba7b('0x28')](removeEntity(_0x20d229,null))['catch'](handleError(_0x20d229,null));};exports[_0xba7b('0x4d')]=function(_0x1fda69,_0x67da83,_0x5afc71){var _0x4843dd={};var _0x4c2980={};var _0x547aa2;var _0x1ccbcd;return db[_0xba7b('0x42')][_0xba7b('0x4e')]({'where':{'id':_0x1fda69['params']['id']}})[_0xba7b('0x28')](handleEntityNotFound(_0x67da83,null))['then'](function(_0x11bb6e){if(_0x11bb6e){_0x547aa2=_0x11bb6e;_0x4c2980[_0xba7b('0x32')]=_[_0xba7b('0x47')](db[_0xba7b('0x4f')]['rawAttributes']);_0x4c2980[_0xba7b('0x37')]=_[_0xba7b('0x47')](_0x1fda69[_0xba7b('0x37')]);_0x4c2980[_0xba7b('0x33')]=_[_0xba7b('0x34')](_0x4c2980[_0xba7b('0x32')],_0x4c2980['query']);_0x4843dd[_0xba7b('0x35')]=_[_0xba7b('0x34')](_0x4c2980['model'],qs[_0xba7b('0x36')](_0x1fda69[_0xba7b('0x37')][_0xba7b('0x36')]));_0x4843dd[_0xba7b('0x35')]=_0x4843dd[_0xba7b('0x35')][_0xba7b('0x38')]?_0x4843dd[_0xba7b('0x35')]:_0x4c2980[_0xba7b('0x32')];_0x4843dd['order']=qs[_0xba7b('0x3c')](_0x1fda69[_0xba7b('0x37')]['sort']);_0x4843dd['where']=qs[_0xba7b('0x33')](_[_0xba7b('0x50')](_0x1fda69['query'],_0x4c2980[_0xba7b('0x33')]));if(_0x1fda69[_0xba7b('0x37')][_0xba7b('0x51')]){_0x4843dd[_0xba7b('0x3d')]=_[_0xba7b('0x3e')](_0x4843dd['where'],{'$or':_[_0xba7b('0x2d')](_0x4843dd[_0xba7b('0x35')],function(_0x199eb9){var _0x54befd={};_0x54befd[_0x199eb9]={'$like':'%'+_0x1fda69[_0xba7b('0x37')]['filter']+'%'};return _0x54befd;})});}_0x4843dd=_['merge']({},_0x4843dd,_0x1fda69[_0xba7b('0x40')]);return _0x547aa2[_0xba7b('0x4d')](_0x4843dd);}})[_0xba7b('0x28')](function(_0x245d3f){if(_0x245d3f){_0x1ccbcd=_0x245d3f[_0xba7b('0x38')];if(!_0x1fda69[_0xba7b('0x37')][_0xba7b('0x39')](_0xba7b('0x3a'))){_0x4843dd['limit']=qs['limit'](_0x1fda69[_0xba7b('0x37')][_0xba7b('0x23')]);_0x4843dd[_0xba7b('0x21')]=qs[_0xba7b('0x21')](_0x1fda69[_0xba7b('0x37')][_0xba7b('0x21')]);}return _0x547aa2[_0xba7b('0x4d')](_0x4843dd);}})['then'](function(_0x1a43c2){if(_0x1a43c2){return _0x1a43c2?{'count':_0x1ccbcd,'rows':_0x1a43c2}:null;}})[_0xba7b('0x28')](respondWithResult(_0x67da83,null))[_0xba7b('0x48')](handleError(_0x67da83,null));};exports[_0xba7b('0x52')]=function(_0x54be05,_0x6d1637,_0x2efe9c){if(_0x54be05[_0xba7b('0x4a')]['id']){delete _0x54be05[_0xba7b('0x4a')]['id'];}return db[_0xba7b('0x42')][_0xba7b('0x4e')]({'where':{'id':_0x54be05[_0xba7b('0x46')]['id']}})[_0xba7b('0x28')](handleEntityNotFound(_0x6d1637,null))[_0xba7b('0x28')](function(_0x5a5838){if(_0x5a5838){_0x54be05[_0xba7b('0x4a')]['AccountId']=_0x5a5838['id'];_0x54be05['body'][_0xba7b('0x53')]=integrations[_0xba7b('0x54')](_0x54be05[_0xba7b('0x4a')][_0xba7b('0x55')],_0x54be05['body'][_0xba7b('0x30')]);_0x54be05['body'][_0xba7b('0x56')]=integrations[_0xba7b('0x57')](_0x54be05['body']['channel'],_0x54be05[_0xba7b('0x4a')][_0xba7b('0x30')]);return db[_0xba7b('0x4f')][_0xba7b('0x49')](_0x54be05['body'],{'include':[{'model':db['SalesforceField'],'as':_0xba7b('0x53')},{'model':db['SalesforceField'],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x6d1637,null))[_0xba7b('0x48')](handleError(_0x6d1637,null));};exports['getFields']=function(_0x4f10e6,_0x2ece7c,_0xbffac6){var _0x2b6cb8;var _0xfafae5='';var _0x5818f1=_0xba7b('0x58');return db['SalesforceAccount'][_0xba7b('0x4e')]({'where':{'id':_0x4f10e6[_0xba7b('0x46')]['id']},'attributes':['id',_0xba7b('0x59'),_0xba7b('0x5a'),_0xba7b('0x5b'),_0xba7b('0x5c'),_0xba7b('0x5d'),_0xba7b('0x5e')]})[_0xba7b('0x28')](handleEntityNotFound(_0x2ece7c,null))['then'](function(_0x5865ba){if(_0x5865ba){_0xfafae5=_0x5865ba[_0xba7b('0x59')];var _0x5cdd0d=_0xfafae5[_0xba7b('0x5f')](-0x1);if(_0x5cdd0d==='/'){_0xfafae5=_0xfafae5[_0xba7b('0x60')](0x0,_0xfafae5[_0xba7b('0x61')](_0x5cdd0d));}_0x2b6cb8=new jsforce[(_0xba7b('0x62'))]({'oauth2':{'loginUrl':_0xfafae5,'clientId':_0x5865ba[_0xba7b('0x5a')],'clientSecret':_0x5865ba[_0xba7b('0x5b')]}});return _0x2b6cb8['login'](_0x5865ba['username'],_0x5865ba[_0xba7b('0x5d')][_0xba7b('0x63')](_0x5865ba[_0xba7b('0x5e')]));}})['then'](function(_0x3a7955){if(_0x3a7955){if(!_[_0xba7b('0x64')](_0x4f10e6['query']['ticketType'])){_0x5818f1=_0x4f10e6[_0xba7b('0x37')][_0xba7b('0x65')];}return _0x2b6cb8[_0xba7b('0x66')](_0x5818f1)[_0xba7b('0x67')]();}})[_0xba7b('0x28')](function(_0x16be23){var _0x39c69f=['OwnerId','ActivityDate','IsReminderSet',_0xba7b('0x68'),_0xba7b('0x69'),_0xba7b('0x6a')];var _0x271b0d=[_0xba7b('0x6b'),'int',_0xba7b('0x6c'),_0xba7b('0x6d'),'email','textarea',_0xba7b('0x6e')];if(_0x16be23){_['remove'](_0x16be23[_0xba7b('0x36')],function(_0xf8efb9){return _0x39c69f['includes'](_0xf8efb9[_0xba7b('0x2b')])||!_0x271b0d[_0xba7b('0x6f')](_0xf8efb9[_0xba7b('0x30')]);});return{'count':_0x16be23[_0xba7b('0x36')][_0xba7b('0x38')],'rows':_[_0xba7b('0x2d')](_0x16be23[_0xba7b('0x36')],function(_0x1733b){return{'id':_0x1733b[_0xba7b('0x2b')],'name':_0x1733b[_0xba7b('0x70')],'custom':_0x1733b[_0xba7b('0x71')],'options':_0x1733b[_0xba7b('0x72')]['length']>0x0?_['map'](_0x1733b[_0xba7b('0x72')],function(_0x9ed1d6){return{'name':_0x9ed1d6[_0xba7b('0x70')],'value':_0x9ed1d6[_0xba7b('0x73')]};}):_0x1733b[_0xba7b('0x30')]==_0xba7b('0x6d')?[{'name':_0xba7b('0x74'),'value':_0xba7b('0x75')},{'name':_0xba7b('0x76'),'value':_0xba7b('0x77')}]:[]};})};}})[_0xba7b('0x28')](respondWithResult(_0x2ece7c,null))[_0xba7b('0x48')](function(_0x167340){var _0x151b6d=_0x4f10e6[_0xba7b('0x37')][_0xba7b('0x78')]?0x1f4:_0x167340[_0xba7b('0x79')]||0x1f4;logger['error'](_0xba7b('0x7a'),_0xba7b('0x7b'),_0x151b6d,JSON[_0xba7b('0x7c')](_0x167340));delete _0x167340[_0xba7b('0x2b')];if(_0x151b6d===0x191){_0x151b6d=0x190;}_0x2ece7c[_0xba7b('0x1e')](_0x151b6d)[_0xba7b('0x2c')](_0x4f10e6[_0xba7b('0x37')][_0xba7b('0x78')]?{'message':_0xba7b('0x7d'),'statusCode':_0x167340['statusCode']}:_0x167340);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 8281128..bc19945 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 _0x90b2=['SalesforceAccount','int_salesforce_accounts','lodash','moment','bluebird','request-promise','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x515004,_0x28d8b8){var _0x4492e4=function(_0x347d79){while(--_0x347d79){_0x515004['push'](_0x515004['shift']());}};_0x4492e4(++_0x28d8b8);}(_0x90b2,0x14c));var _0x290b=function(_0x372ee1,_0x45c637){_0x372ee1=_0x372ee1-0x0;var _0x31ea06=_0x90b2[_0x372ee1];return _0x31ea06;};'use strict';var _=require(_0x290b('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x290b('0x1'));var BPromise=require(_0x290b('0x2'));var rp=require(_0x290b('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x290b('0x4'));var attributes=require(_0x290b('0x5'));var integrations=require(_0x290b('0x6'));module[_0x290b('0x7')]=function(_0xc2eb63,_0x2d78d){return _0xc2eb63['define'](_0x290b('0x8'),attributes,{'tableName':_0x290b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8d7e=['../../components/integrations/configuration','define','SalesforceAccount','int_salesforce_accounts','lodash','../../config/logger','moment','bluebird','request-promise','../../config/environment','./intSalesforceAccount.attributes'];(function(_0x2b7908,_0x53b8d5){var _0x4ddbb7=function(_0x299ac5){while(--_0x299ac5){_0x2b7908['push'](_0x2b7908['shift']());}};_0x4ddbb7(++_0x53b8d5);}(_0x8d7e,0x7d));var _0xe8d7=function(_0xb41512,_0x1fcf02){_0xb41512=_0xb41512-0x0;var _0x33944e=_0x8d7e[_0xb41512];return _0x33944e;};'use strict';var _=require(_0xe8d7('0x0'));var util=require('util');var logger=require(_0xe8d7('0x1'))('api');var moment=require(_0xe8d7('0x2'));var BPromise=require(_0xe8d7('0x3'));var rp=require(_0xe8d7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe8d7('0x5'));var attributes=require(_0xe8d7('0x6'));var integrations=require(_0xe8d7('0x7'));module['exports']=function(_0x1d8a65,_0x135217){return _0x1d8a65[_0xe8d7('0x8')](_0xe8d7('0x9'),attributes,{'tableName':_0xe8d7('0xa'),'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 c929152..63c33d2 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 _0x531f=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','GetSalesforceAccount','SalesforceAccount','options','raw','attributes','limit','include','map','model','ShowSalesforceAccount','where'];(function(_0x2df5df,_0x1fe53b){var _0x290dd8=function(_0xde8300){while(--_0xde8300){_0x2df5df['push'](_0x2df5df['shift']());}};_0x290dd8(++_0x1fe53b);}(_0x531f,0xba));var _0xf531=function(_0x3bfdde,_0x306be4){_0x3bfdde=_0x3bfdde-0x0;var _0x3f752a=_0x531f[_0x3bfdde];return _0x3f752a;};'use strict';var _=require(_0xf531('0x0'));var util=require('util');var moment=require(_0xf531('0x1'));var BPromise=require(_0xf531('0x2'));var rs=require(_0xf531('0x3'));var fs=require('fs');var Redis=require(_0xf531('0x4'));var db=require(_0xf531('0x5'))['db'];var utils=require(_0xf531('0x6'));var logger=require(_0xf531('0x7'))('rpc');var config=require(_0xf531('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf531('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x48db0a,_0x3f88c7,_0x2054cd){return new BPromise(function(_0x2ed4a7,_0x444864){return client[_0xf531('0xa')](_0x48db0a,_0x2054cd)[_0xf531('0xb')](function(_0xbe44da){logger['info'](_0xf531('0xc'),_0x3f88c7,_0xf531('0xd'));logger[_0xf531('0xe')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x3f88c7,'request\x20sent',JSON[_0xf531('0xf')](_0xbe44da));if(_0xbe44da[_0xf531('0x10')]){if(_0xbe44da[_0xf531('0x10')]['code']===0x1f4){logger[_0xf531('0x10')]('SalesforceAccount,\x20%s,\x20%s',_0x3f88c7,_0xbe44da['error'][_0xf531('0x11')]);return _0x444864(_0xbe44da['error'][_0xf531('0x11')]);}logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x3f88c7,_0xbe44da[_0xf531('0x10')][_0xf531('0x11')]);return _0x2ed4a7(_0xbe44da[_0xf531('0x10')][_0xf531('0x11')]);}else{logger[_0xf531('0x12')]('SalesforceAccount,\x20%s,\x20%s',_0x3f88c7,_0xf531('0xd'));_0x2ed4a7(_0xbe44da[_0xf531('0x13')][_0xf531('0x11')]);}})['catch'](function(_0x3d36e1){logger['error'](_0xf531('0xc'),_0x3f88c7,_0x3d36e1);_0x444864(_0x3d36e1);});});}exports[_0xf531('0x14')]=function(_0x27980e){var _0x4d1bd3=this;return new Promise(function(_0x53d4fa,_0xb5ab43){return db[_0xf531('0x15')]['findAll']({'raw':_0x27980e[_0xf531('0x16')]?_0x27980e[_0xf531('0x16')][_0xf531('0x17')]===undefined?!![]:![]:!![],'where':_0x27980e[_0xf531('0x16')]?_0x27980e[_0xf531('0x16')]['where']||null:null,'attributes':_0x27980e[_0xf531('0x16')]?_0x27980e[_0xf531('0x16')][_0xf531('0x18')]||null:null,'limit':_0x27980e[_0xf531('0x16')]?_0x27980e[_0xf531('0x16')][_0xf531('0x19')]||null:null,'include':_0x27980e[_0xf531('0x16')]?_0x27980e['options'][_0xf531('0x1a')]?_[_0xf531('0x1b')](_0x27980e['options'][_0xf531('0x1a')],function(_0x3716d7){return{'model':db[_0x3716d7[_0xf531('0x1c')]],'as':_0x3716d7['as'],'attributes':_0x3716d7[_0xf531('0x18')],'include':_0x3716d7[_0xf531('0x1a')]?_[_0xf531('0x1b')](_0x3716d7[_0xf531('0x1a')],function(_0x4cf26){return{'model':db[_0x4cf26[_0xf531('0x1c')]],'as':_0x4cf26['as'],'attributes':_0x4cf26[_0xf531('0x18')],'include':_0x4cf26[_0xf531('0x1a')]?_[_0xf531('0x1b')](_0x4cf26[_0xf531('0x1a')],function(_0x6f5c04){return{'model':db[_0x6f5c04[_0xf531('0x1c')]],'as':_0x6f5c04['as'],'attributes':_0x6f5c04[_0xf531('0x18')]};}):[]};}):[]};}):[]:[]})[_0xf531('0xb')](function(_0x4af3ec){logger[_0xf531('0x12')]('GetSalesforceAccount',_0x27980e);logger['debug'](_0xf531('0x14'),_0x27980e,JSON[_0xf531('0xf')](_0x4af3ec));_0x53d4fa(_0x4af3ec);})['catch'](function(_0x3006d3){logger[_0xf531('0x10')](_0xf531('0x14'),_0x3006d3[_0xf531('0x11')],_0x27980e);_0xb5ab43(_0x4d1bd3[_0xf531('0x10')](0x1f4,_0x3006d3[_0xf531('0x11')]));});});};exports[_0xf531('0x1d')]=function(_0x58583a){var _0x3c64fa=this;return new Promise(function(_0xba204b,_0xfa4e78){return db['SalesforceAccount']['find']({'raw':_0x58583a['options']?_0x58583a[_0xf531('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x58583a[_0xf531('0x16')]?_0x58583a['options'][_0xf531('0x1e')]||null:null,'attributes':_0x58583a[_0xf531('0x16')]?_0x58583a[_0xf531('0x16')][_0xf531('0x18')]||null:null,'include':_0x58583a[_0xf531('0x16')]?_0x58583a['options'][_0xf531('0x1a')]?_['map'](_0x58583a['options'][_0xf531('0x1a')],function(_0x394345){return{'model':db[_0x394345[_0xf531('0x1c')]],'as':_0x394345['as'],'attributes':_0x394345['attributes'],'include':_0x394345[_0xf531('0x1a')]?_[_0xf531('0x1b')](_0x394345[_0xf531('0x1a')],function(_0x34a67a){return{'model':db[_0x34a67a[_0xf531('0x1c')]],'as':_0x34a67a['as'],'attributes':_0x34a67a[_0xf531('0x18')],'include':_0x34a67a[_0xf531('0x1a')]?_[_0xf531('0x1b')](_0x34a67a[_0xf531('0x1a')],function(_0x1ae496){return{'model':db[_0x1ae496[_0xf531('0x1c')]],'as':_0x1ae496['as'],'attributes':_0x1ae496['attributes']};}):[]};}):[]};}):[]:[]})[_0xf531('0xb')](function(_0x4718be){logger['info'](_0xf531('0x1d'),_0x58583a);logger[_0xf531('0xe')](_0xf531('0x1d'),_0x58583a,JSON[_0xf531('0xf')](_0x4718be));_0xba204b(_0x4718be);})['catch'](function(_0x4387b2){logger[_0xf531('0x10')](_0xf531('0x1d'),_0x4387b2[_0xf531('0x11')],_0x58583a);_0xfa4e78(_0x3c64fa['error'](0x1f4,_0x4387b2[_0xf531('0x11')]));});});}; \ No newline at end of file +var _0x86f3=['http','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','findAll','options','where','attributes','include','map','model','debug','catch','GetSalesforceAccount','ShowSalesforceAccount','SalesforceAccount','find','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','jayson/promise','client'];(function(_0x4bf519,_0x6895ea){var _0x358b9a=function(_0x4abfff){while(--_0x4abfff){_0x4bf519['push'](_0x4bf519['shift']());}};_0x358b9a(++_0x6895ea);}(_0x86f3,0x1c6));var _0x386f=function(_0x2daef6,_0xcac228){_0x2daef6=_0x2daef6-0x0;var _0x62d030=_0x86f3[_0x2daef6];return _0x62d030;};'use strict';var _=require(_0x386f('0x0'));var util=require(_0x386f('0x1'));var moment=require(_0x386f('0x2'));var BPromise=require('bluebird');var rs=require(_0x386f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x386f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x386f('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x386f('0x6'));var client=jayson[_0x386f('0x7')][_0x386f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4bea02,_0x44dd69,_0x218b38){return new BPromise(function(_0x47d34b,_0x209912){return client[_0x386f('0x9')](_0x4bea02,_0x218b38)[_0x386f('0xa')](function(_0xd85555){logger[_0x386f('0xb')](_0x386f('0xc'),_0x44dd69,_0x386f('0xd'));logger['debug'](_0x386f('0xe'),_0x44dd69,_0x386f('0xd'),JSON[_0x386f('0xf')](_0xd85555));if(_0xd85555[_0x386f('0x10')]){if(_0xd85555['error'][_0x386f('0x11')]===0x1f4){logger[_0x386f('0x10')](_0x386f('0xc'),_0x44dd69,_0xd85555[_0x386f('0x10')][_0x386f('0x12')]);return _0x209912(_0xd85555[_0x386f('0x10')][_0x386f('0x12')]);}logger[_0x386f('0x10')](_0x386f('0xc'),_0x44dd69,_0xd85555['error']['message']);return _0x47d34b(_0xd85555[_0x386f('0x10')][_0x386f('0x12')]);}else{logger['info'](_0x386f('0xc'),_0x44dd69,'request\x20sent');_0x47d34b(_0xd85555[_0x386f('0x13')][_0x386f('0x12')]);}})['catch'](function(_0x1f0290){logger[_0x386f('0x10')](_0x386f('0xc'),_0x44dd69,_0x1f0290);_0x209912(_0x1f0290);});});}exports['GetSalesforceAccount']=function(_0xd2c716){var _0x390a4a=this;return new Promise(function(_0xeac6a0,_0x1066ce){return db['SalesforceAccount'][_0x386f('0x14')]({'raw':_0xd2c716[_0x386f('0x15')]?_0xd2c716['options']['raw']===undefined?!![]:![]:!![],'where':_0xd2c716[_0x386f('0x15')]?_0xd2c716[_0x386f('0x15')][_0x386f('0x16')]||null:null,'attributes':_0xd2c716['options']?_0xd2c716[_0x386f('0x15')][_0x386f('0x17')]||null:null,'limit':_0xd2c716['options']?_0xd2c716['options']['limit']||null:null,'include':_0xd2c716[_0x386f('0x15')]?_0xd2c716[_0x386f('0x15')][_0x386f('0x18')]?_[_0x386f('0x19')](_0xd2c716['options'][_0x386f('0x18')],function(_0x9100cf){return{'model':db[_0x9100cf['model']],'as':_0x9100cf['as'],'attributes':_0x9100cf['attributes'],'include':_0x9100cf[_0x386f('0x18')]?_[_0x386f('0x19')](_0x9100cf[_0x386f('0x18')],function(_0x233f2b){return{'model':db[_0x233f2b[_0x386f('0x1a')]],'as':_0x233f2b['as'],'attributes':_0x233f2b[_0x386f('0x17')],'include':_0x233f2b[_0x386f('0x18')]?_[_0x386f('0x19')](_0x233f2b[_0x386f('0x18')],function(_0x100238){return{'model':db[_0x100238[_0x386f('0x1a')]],'as':_0x100238['as'],'attributes':_0x100238[_0x386f('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x425e14){logger[_0x386f('0xb')]('GetSalesforceAccount',_0xd2c716);logger[_0x386f('0x1b')]('GetSalesforceAccount',_0xd2c716,JSON[_0x386f('0xf')](_0x425e14));_0xeac6a0(_0x425e14);})[_0x386f('0x1c')](function(_0xd91365){logger[_0x386f('0x10')](_0x386f('0x1d'),_0xd91365[_0x386f('0x12')],_0xd2c716);_0x1066ce(_0x390a4a[_0x386f('0x10')](0x1f4,_0xd91365[_0x386f('0x12')]));});});};exports[_0x386f('0x1e')]=function(_0x59a360){var _0x23a44d=this;return new Promise(function(_0x374c5a,_0x411033){return db[_0x386f('0x1f')][_0x386f('0x20')]({'raw':_0x59a360[_0x386f('0x15')]?_0x59a360[_0x386f('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x59a360[_0x386f('0x15')]?_0x59a360[_0x386f('0x15')][_0x386f('0x16')]||null:null,'attributes':_0x59a360[_0x386f('0x15')]?_0x59a360[_0x386f('0x15')][_0x386f('0x17')]||null:null,'include':_0x59a360['options']?_0x59a360[_0x386f('0x15')][_0x386f('0x18')]?_[_0x386f('0x19')](_0x59a360[_0x386f('0x15')]['include'],function(_0x1de8ec){return{'model':db[_0x1de8ec['model']],'as':_0x1de8ec['as'],'attributes':_0x1de8ec['attributes'],'include':_0x1de8ec[_0x386f('0x18')]?_[_0x386f('0x19')](_0x1de8ec[_0x386f('0x18')],function(_0x202973){return{'model':db[_0x202973['model']],'as':_0x202973['as'],'attributes':_0x202973['attributes'],'include':_0x202973['include']?_[_0x386f('0x19')](_0x202973[_0x386f('0x18')],function(_0x25c445){return{'model':db[_0x25c445['model']],'as':_0x25c445['as'],'attributes':_0x25c445['attributes']};}):[]};}):[]};}):[]:[]})[_0x386f('0xa')](function(_0x23bd5b){logger['info'](_0x386f('0x1e'),_0x59a360);logger[_0x386f('0x1b')]('ShowSalesforceAccount',_0x59a360,JSON[_0x386f('0xf')](_0x23bd5b));_0x374c5a(_0x23bd5b);})['catch'](function(_0x3a4266){logger[_0x386f('0x10')]('ShowSalesforceAccount',_0x3a4266[_0x386f('0x12')],_0x59a360);_0x411033(_0x23a44d[_0x386f('0x10')](0x1f4,_0x3a4266[_0x386f('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 5206004..c4b45dd 100644 --- a/server/api/intSalesforceConfiguration/index.js +++ b/server/api/intSalesforceConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intSalesforceConfiguration.controller','get','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','exports','multer','util','path'];(function(_0x37a938,_0x5e328b){var _0x3b304b=function(_0x4e99bf){while(--_0x4e99bf){_0x37a938['push'](_0x37a938['shift']());}};_0x3b304b(++_0x5e328b);}(_0x2ef3,0xba));var _0x32ef=function(_0x5285ff,_0x39b96a){_0x5285ff=_0x5285ff-0x0;var _0x3d4f61=_0x2ef3[_0x5285ff];return _0x3d4f61;};'use strict';var multer=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var path=require(_0x32ef('0x2'));var timeout=require(_0x32ef('0x3'));var express=require(_0x32ef('0x4'));var router=express[_0x32ef('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x32ef('0x6'));var interaction=require(_0x32ef('0x7'));var config=require('../../config/environment');var controller=require(_0x32ef('0x8'));router[_0x32ef('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x32ef('0x9')](_0x32ef('0xa'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x9')](_0x32ef('0xd'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xe')]);router[_0x32ef('0x9')](_0x32ef('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x32ef('0x9')](_0x32ef('0x10'),auth[_0x32ef('0xb')](),controller[_0x32ef('0x11')]);router['post']('/',auth[_0x32ef('0xb')](),controller['create']);router[_0x32ef('0x12')]('/:id',auth[_0x32ef('0xb')](),controller[_0x32ef('0x13')]);router['delete']('/:id',auth[_0x32ef('0xb')](),controller['destroy']);module[_0x32ef('0x14')]=router; \ No newline at end of file +var _0x5f66=['express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','/:id/subjects','getSubjects','put','update','delete','destroy','exports','util','connect-timeout'];(function(_0x30f289,_0x1bdfa5){var _0x911094=function(_0x54e159){while(--_0x54e159){_0x30f289['push'](_0x30f289['shift']());}};_0x911094(++_0x1bdfa5);}(_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('./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 13751b0..8b59dd9 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 _0xeb9a=['contact','account','ENUM','nothing','lead','sequelize','exports','STRING','Task','Case','contact_lead'];(function(_0x124217,_0x1e557d){var _0x131102=function(_0x3255da){while(--_0x3255da){_0x124217['push'](_0x124217['shift']());}};_0x131102(++_0x1e557d);}(_0xeb9a,0xcb));var _0xaeb9=function(_0x1573ea,_0x434f02){_0x1573ea=_0x1573ea-0x0;var _0x51c0e2=_0xeb9a[_0x1573ea];return _0x51c0e2;};'use strict';var Sequelize=require(_0xaeb9('0x0'));module[_0xaeb9('0x1')]={'name':{'type':Sequelize[_0xaeb9('0x2')]},'description':{'type':Sequelize[_0xaeb9('0x2')]},'ticketType':{'type':Sequelize['ENUM'](_0xaeb9('0x3'),_0xaeb9('0x4')),'defaultValue':_0xaeb9('0x3')},'moduleSearch':{'type':Sequelize['ENUM'](_0xaeb9('0x5'),_0xaeb9('0x6'),'lead','account_contact_lead',_0xaeb9('0x7')),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0xaeb9('0x8')](_0xaeb9('0x9'),_0xaeb9('0x6'),_0xaeb9('0xa'),_0xaeb9('0x7')),'defaultValue':_0xaeb9('0xa')},'leadId':{'type':Sequelize[_0xaeb9('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0xaeb9('0x2')]},'additionalSearchContact':{'type':Sequelize[_0xaeb9('0x2')]},'additionalSearchLead':{'type':Sequelize[_0xaeb9('0x2')]}}; \ No newline at end of file +var _0xd96d=['exports','STRING','ENUM','Task','Case','contact_lead','contact','lead','account_contact_lead','account','nothing','sequelize'];(function(_0x2762d5,_0x7c1a0a){var _0x3c0ae6=function(_0x1ee9b4){while(--_0x1ee9b4){_0x2762d5['push'](_0x2762d5['shift']());}};_0x3c0ae6(++_0x7c1a0a);}(_0xd96d,0xe3));var _0xdd96=function(_0x2cf2e9,_0xd58ea1){_0x2cf2e9=_0x2cf2e9-0x0;var _0xd3670d=_0xd96d[_0x2cf2e9];return _0xd3670d;};'use strict';var Sequelize=require(_0xdd96('0x0'));module[_0xdd96('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xdd96('0x2')]},'ticketType':{'type':Sequelize[_0xdd96('0x3')](_0xdd96('0x4'),_0xdd96('0x5')),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize[_0xdd96('0x3')](_0xdd96('0x6'),_0xdd96('0x7'),_0xdd96('0x8'),_0xdd96('0x9'),_0xdd96('0xa')),'defaultValue':_0xdd96('0x6')},'moduleCreate':{'type':Sequelize[_0xdd96('0x3')](_0xdd96('0xb'),_0xdd96('0x7'),_0xdd96('0x8'),_0xdd96('0xa')),'defaultValue':_0xdd96('0x8')},'leadId':{'type':Sequelize[_0xdd96('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0xdd96('0x2')]},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize[_0xdd96('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 5a1a1d7..2804b8e 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 _0x527c=['zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','update','then','destroy','error','name','send','index','SalesforceConfiguration','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','map','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','find','create','body','getFields','SalesforceField','filter','nolimit','getSubjects','getDescriptions','findOne','eml-format'];(function(_0x9d639c,_0x524dbe){var _0x1671de=function(_0x27888e){while(--_0x27888e){_0x9d639c['push'](_0x9d639c['shift']());}};_0x1671de(++_0x524dbe);}(_0x527c,0x194));var _0xc527=function(_0x48f038,_0x2bde84){_0x48f038=_0x48f038-0x0;var _0x2edc62=_0x527c[_0x48f038];return _0x2edc62;};'use strict';var emlformat=require(_0xc527('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc527('0x1'));var jsonpatch=require(_0xc527('0x2'));var rp=require(_0xc527('0x3'));var moment=require(_0xc527('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc527('0x5'));var util=require(_0xc527('0x6'));var path=require(_0xc527('0x7'));var sox=require(_0xc527('0x8'));var csv=require(_0xc527('0x9'));var ejs=require(_0xc527('0xa'));var fs=require('fs');var fs_extra=require(_0xc527('0xb'));var _=require(_0xc527('0xc'));var squel=require('squel');var crypto=require(_0xc527('0xd'));var jsforce=require(_0xc527('0xe'));var deskjs=require(_0xc527('0xf'));var toCsv=require(_0xc527('0x9'));var querystring=require(_0xc527('0x10'));var Papa=require('papaparse');var Redis=require(_0xc527('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xc527('0x12'));var as=require(_0xc527('0x13'));var hardwareService=require(_0xc527('0x14'));var logger=require(_0xc527('0x15'))(_0xc527('0x16'));var utils=require(_0xc527('0x17'));var config=require(_0xc527('0x18'));var licenseUtil=require(_0xc527('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x588f43,_0x4631d8){_0x4631d8=_0x4631d8||0xcc;return function(_0x150f7a){if(_0x150f7a){return _0x588f43[_0xc527('0x1a')](_0x4631d8);}return _0x588f43[_0xc527('0x1b')](_0x4631d8)[_0xc527('0x1c')]();};}function respondWithResult(_0x4a29f4,_0x2cbca4){_0x2cbca4=_0x2cbca4||0xc8;return function(_0x179f58){if(_0x179f58){return _0x4a29f4[_0xc527('0x1b')](_0x2cbca4)[_0xc527('0x1d')](_0x179f58);}};}function respondWithFilteredResult(_0x32316f,_0x29e520){return function(_0x442601){if(_0x442601){var _0x5f2cc2=typeof _0x29e520['offset']==='undefined'&&typeof _0x29e520[_0xc527('0x1e')]===_0xc527('0x1f');var _0x19512b=_0x442601[_0xc527('0x20')];var _0x5615fa=_0x5f2cc2?0x0:_0x29e520[_0xc527('0x21')];var _0x15f08b=_0x5f2cc2?_0x442601[_0xc527('0x20')]:_0x29e520[_0xc527('0x21')]+_0x29e520[_0xc527('0x1e')];var _0x7df657;if(_0x15f08b>=_0x19512b){_0x15f08b=_0x19512b;_0x7df657=0xc8;}else{_0x7df657=0xce;}_0x32316f['status'](_0x7df657);return _0x32316f[_0xc527('0x22')](_0xc527('0x23'),_0x5615fa+'-'+_0x15f08b+'/'+_0x19512b)['json'](_0x442601);}return null;};}function patchUpdates(_0x1c6016){return function(_0x429583){try{jsonpatch[_0xc527('0x24')](_0x429583,_0x1c6016,!![]);}catch(_0x3caf08){return BPromise[_0xc527('0x25')](_0x3caf08);}return _0x429583['save']();};}function saveUpdates(_0x1a9d85,_0xb29ffc){return function(_0x2b43d9){if(_0x2b43d9){return _0x2b43d9[_0xc527('0x26')](_0x1a9d85)[_0xc527('0x27')](function(_0x20042d){return _0x20042d;});}return null;};}function removeEntity(_0x3f3ac1,_0x25f010){return function(_0x7914cb){if(_0x7914cb){return _0x7914cb[_0xc527('0x28')]()['then'](function(){_0x3f3ac1[_0xc527('0x1b')](0xcc)[_0xc527('0x1c')]();});}};}function handleEntityNotFound(_0x3745a9,_0x4ac92e){return function(_0x5c1aee){if(!_0x5c1aee){_0x3745a9['sendStatus'](0x194);}return _0x5c1aee;};}function handleError(_0x526b55,_0x516f40){_0x516f40=_0x516f40||0x1f4;return function(_0x424994){logger[_0xc527('0x29')](_0x424994['stack']);if(_0x424994[_0xc527('0x2a')]){delete _0x424994['name'];}_0x526b55[_0xc527('0x1b')](_0x516f40)[_0xc527('0x2b')](_0x424994);};}exports[_0xc527('0x2c')]=function(_0x25a77c,_0x3d6cc4){var _0x30af14={},_0x3c5af6={},_0x3ca31a={'count':0x0,'rows':[]};var _0x2b80de=_['map'](db[_0xc527('0x2d')][_0xc527('0x2e')],function(_0x2efef4){return{'name':_0x2efef4['fieldName'],'type':_0x2efef4['type']['key']};});_0x3c5af6[_0xc527('0x2f')]=_['map'](_0x2b80de,_0xc527('0x2a'));_0x3c5af6[_0xc527('0x30')]=_[_0xc527('0x31')](_0x25a77c[_0xc527('0x30')]);_0x3c5af6[_0xc527('0x32')]=_[_0xc527('0x33')](_0x3c5af6[_0xc527('0x2f')],_0x3c5af6[_0xc527('0x30')]);_0x30af14[_0xc527('0x34')]=_[_0xc527('0x33')](_0x3c5af6[_0xc527('0x2f')],qs[_0xc527('0x35')](_0x25a77c['query'][_0xc527('0x35')]));_0x30af14[_0xc527('0x34')]=_0x30af14[_0xc527('0x34')][_0xc527('0x36')]?_0x30af14[_0xc527('0x34')]:_0x3c5af6[_0xc527('0x2f')];if(!_0x25a77c['query'][_0xc527('0x37')]('nolimit')){_0x30af14[_0xc527('0x1e')]=qs[_0xc527('0x1e')](_0x25a77c['query'][_0xc527('0x1e')]);_0x30af14[_0xc527('0x21')]=qs[_0xc527('0x21')](_0x25a77c[_0xc527('0x30')][_0xc527('0x21')]);}_0x30af14[_0xc527('0x38')]=qs[_0xc527('0x39')](_0x25a77c[_0xc527('0x30')][_0xc527('0x39')]);_0x30af14[_0xc527('0x3a')]=qs[_0xc527('0x32')](_[_0xc527('0x3b')](_0x25a77c[_0xc527('0x30')],_0x3c5af6['filters']),_0x2b80de);if(_0x25a77c[_0xc527('0x30')]['filter']){_0x30af14[_0xc527('0x3a')]=_['merge'](_0x30af14[_0xc527('0x3a')],{'$or':_[_0xc527('0x3c')](_0x2b80de,function(_0x118ac7){if(_0x118ac7[_0xc527('0x3d')]!==_0xc527('0x3e')){var _0x289003={};_0x289003[_0x118ac7[_0xc527('0x2a')]]={'$like':'%'+_0x25a77c[_0xc527('0x30')]['filter']+'%'};return _0x289003;}})});}_0x30af14=_[_0xc527('0x3f')]({},_0x30af14,_0x25a77c[_0xc527('0x40')]);var _0x34e142={'where':_0x30af14[_0xc527('0x3a')]};return db[_0xc527('0x2d')][_0xc527('0x20')](_0x34e142)[_0xc527('0x27')](function(_0x1524da){_0x3ca31a[_0xc527('0x20')]=_0x1524da;if(_0x25a77c[_0xc527('0x30')][_0xc527('0x41')]){_0x30af14[_0xc527('0x42')]=[{'all':!![]}];}return db[_0xc527('0x2d')][_0xc527('0x43')](_0x30af14);})['then'](function(_0x630e9f){_0x3ca31a[_0xc527('0x44')]=_0x630e9f;return _0x3ca31a;})[_0xc527('0x27')](respondWithFilteredResult(_0x3d6cc4,_0x30af14))[_0xc527('0x45')](handleError(_0x3d6cc4,null));};exports['show']=function(_0xbf61d0,_0x20011e){var _0x402766={'raw':![],'where':{'id':_0xbf61d0[_0xc527('0x46')]['id']}},_0xf309e1={};_0xf309e1[_0xc527('0x2f')]=_[_0xc527('0x31')](db[_0xc527('0x2d')][_0xc527('0x2e')]);_0xf309e1[_0xc527('0x30')]=_[_0xc527('0x31')](_0xbf61d0[_0xc527('0x30')]);_0xf309e1[_0xc527('0x32')]=_[_0xc527('0x33')](_0xf309e1[_0xc527('0x2f')],_0xf309e1[_0xc527('0x30')]);_0x402766['attributes']=_[_0xc527('0x33')](_0xf309e1[_0xc527('0x2f')],qs[_0xc527('0x35')](_0xbf61d0[_0xc527('0x30')][_0xc527('0x35')]));_0x402766[_0xc527('0x34')]=_0x402766[_0xc527('0x34')]['length']?_0x402766[_0xc527('0x34')]:_0xf309e1[_0xc527('0x2f')];if(_0xbf61d0[_0xc527('0x30')]['includeAll']){_0x402766[_0xc527('0x42')]=[{'all':!![]}];}_0x402766=_[_0xc527('0x3f')]({},_0x402766,_0xbf61d0[_0xc527('0x40')]);return db[_0xc527('0x2d')][_0xc527('0x47')](_0x402766)[_0xc527('0x27')](handleEntityNotFound(_0x20011e,null))['then'](respondWithResult(_0x20011e,null))[_0xc527('0x45')](handleError(_0x20011e,null));};exports[_0xc527('0x48')]=function(_0x57c709,_0x27cd77){return db['SalesforceConfiguration'][_0xc527('0x48')](_0x57c709[_0xc527('0x49')],{})[_0xc527('0x27')](respondWithResult(_0x27cd77,0xc9))[_0xc527('0x45')](handleError(_0x27cd77,null));};exports[_0xc527('0x26')]=function(_0x22e4ec,_0x1b60d5){if(_0x22e4ec[_0xc527('0x49')]['id']){delete _0x22e4ec[_0xc527('0x49')]['id'];}return db[_0xc527('0x2d')][_0xc527('0x47')]({'where':{'id':_0x22e4ec[_0xc527('0x46')]['id']}})['then'](handleEntityNotFound(_0x1b60d5,null))[_0xc527('0x27')](saveUpdates(_0x22e4ec[_0xc527('0x49')],null))['then'](respondWithResult(_0x1b60d5,null))['catch'](handleError(_0x1b60d5,null));};exports['destroy']=function(_0x1e9721,_0x2dc307){return db[_0xc527('0x2d')][_0xc527('0x47')]({'where':{'id':_0x1e9721[_0xc527('0x46')]['id']}})['then'](handleEntityNotFound(_0x2dc307,null))[_0xc527('0x27')](removeEntity(_0x2dc307,null))[_0xc527('0x45')](handleError(_0x2dc307,null));};exports[_0xc527('0x4a')]=function(_0x619178,_0x849a39,_0x522d3f){var _0x25c4d7={};var _0x16d81e={};var _0x29cfdd;var _0x2fb917;return db[_0xc527('0x2d')]['findOne']({'where':{'id':_0x619178['params']['id']}})[_0xc527('0x27')](handleEntityNotFound(_0x849a39,null))[_0xc527('0x27')](function(_0x5c626a){if(_0x5c626a){_0x29cfdd=_0x5c626a;_0x16d81e['model']=_[_0xc527('0x31')](db[_0xc527('0x4b')][_0xc527('0x2e')]);_0x16d81e[_0xc527('0x30')]=_[_0xc527('0x31')](_0x619178['query']);_0x16d81e[_0xc527('0x32')]=_[_0xc527('0x33')](_0x16d81e[_0xc527('0x2f')],_0x16d81e['query']);_0x25c4d7[_0xc527('0x34')]=_[_0xc527('0x33')](_0x16d81e[_0xc527('0x2f')],qs['fields'](_0x619178[_0xc527('0x30')][_0xc527('0x35')]));_0x25c4d7[_0xc527('0x34')]=_0x25c4d7[_0xc527('0x34')][_0xc527('0x36')]?_0x25c4d7[_0xc527('0x34')]:_0x16d81e[_0xc527('0x2f')];_0x25c4d7['order']=qs[_0xc527('0x39')](_0x619178[_0xc527('0x30')][_0xc527('0x39')]);_0x25c4d7[_0xc527('0x3a')]=qs[_0xc527('0x32')](_[_0xc527('0x3b')](_0x619178[_0xc527('0x30')],_0x16d81e[_0xc527('0x32')]));if(_0x619178[_0xc527('0x30')][_0xc527('0x4c')]){_0x25c4d7[_0xc527('0x3a')]=_[_0xc527('0x3f')](_0x25c4d7[_0xc527('0x3a')],{'$or':_['map'](_0x25c4d7['attributes'],function(_0x225d0c){var _0x2ee5b8={};_0x2ee5b8[_0x225d0c]={'$like':'%'+_0x619178[_0xc527('0x30')]['filter']+'%'};return _0x2ee5b8;})});}_0x25c4d7=_[_0xc527('0x3f')]({},_0x25c4d7,_0x619178[_0xc527('0x40')]);return _0x29cfdd[_0xc527('0x4a')](_0x25c4d7);}})[_0xc527('0x27')](function(_0x1ade09){if(_0x1ade09){_0x2fb917=_0x1ade09[_0xc527('0x36')];if(!_0x619178[_0xc527('0x30')][_0xc527('0x37')](_0xc527('0x4d'))){_0x25c4d7[_0xc527('0x1e')]=qs['limit'](_0x619178['query'][_0xc527('0x1e')]);_0x25c4d7[_0xc527('0x21')]=qs[_0xc527('0x21')](_0x619178[_0xc527('0x30')][_0xc527('0x21')]);}return _0x29cfdd[_0xc527('0x4a')](_0x25c4d7);}})[_0xc527('0x27')](function(_0x35c670){if(_0x35c670){return _0x35c670?{'count':_0x2fb917,'rows':_0x35c670}:null;}})[_0xc527('0x27')](respondWithResult(_0x849a39,null))['catch'](handleError(_0x849a39,null));};exports[_0xc527('0x4e')]=function(_0x2bfeda,_0x2fef72,_0x486918){var _0x2fd2ef={};var _0x3d216a={};var _0x277040;var _0x14c8ae;return db[_0xc527('0x2d')]['findOne']({'where':{'id':_0x2bfeda[_0xc527('0x46')]['id']}})[_0xc527('0x27')](handleEntityNotFound(_0x2fef72,null))[_0xc527('0x27')](function(_0x106ab7){if(_0x106ab7){_0x277040=_0x106ab7;_0x3d216a['model']=_['keys'](db[_0xc527('0x4b')][_0xc527('0x2e')]);_0x3d216a[_0xc527('0x30')]=_[_0xc527('0x31')](_0x2bfeda['query']);_0x3d216a[_0xc527('0x32')]=_[_0xc527('0x33')](_0x3d216a['model'],_0x3d216a['query']);_0x2fd2ef[_0xc527('0x34')]=_[_0xc527('0x33')](_0x3d216a[_0xc527('0x2f')],qs[_0xc527('0x35')](_0x2bfeda[_0xc527('0x30')][_0xc527('0x35')]));_0x2fd2ef[_0xc527('0x34')]=_0x2fd2ef[_0xc527('0x34')]['length']?_0x2fd2ef['attributes']:_0x3d216a[_0xc527('0x2f')];_0x2fd2ef[_0xc527('0x38')]=qs['sort'](_0x2bfeda[_0xc527('0x30')]['sort']);_0x2fd2ef[_0xc527('0x3a')]=qs['filters'](_['pick'](_0x2bfeda[_0xc527('0x30')],_0x3d216a[_0xc527('0x32')]));if(_0x2bfeda['query'][_0xc527('0x4c')]){_0x2fd2ef['where']=_['merge'](_0x2fd2ef[_0xc527('0x3a')],{'$or':_[_0xc527('0x3c')](_0x2fd2ef[_0xc527('0x34')],function(_0x3bc710){var _0x43171b={};_0x43171b[_0x3bc710]={'$like':'%'+_0x2bfeda['query'][_0xc527('0x4c')]+'%'};return _0x43171b;})});}_0x2fd2ef=_[_0xc527('0x3f')]({},_0x2fd2ef,_0x2bfeda['options']);return _0x277040[_0xc527('0x4e')](_0x2fd2ef);}})[_0xc527('0x27')](function(_0x1737bd){if(_0x1737bd){_0x14c8ae=_0x1737bd[_0xc527('0x36')];if(!_0x2bfeda[_0xc527('0x30')][_0xc527('0x37')]('nolimit')){_0x2fd2ef[_0xc527('0x1e')]=qs[_0xc527('0x1e')](_0x2bfeda[_0xc527('0x30')][_0xc527('0x1e')]);_0x2fd2ef[_0xc527('0x21')]=qs['offset'](_0x2bfeda[_0xc527('0x30')][_0xc527('0x21')]);}return _0x277040['getSubjects'](_0x2fd2ef);}})[_0xc527('0x27')](function(_0x2f2f0a){if(_0x2f2f0a){return _0x2f2f0a?{'count':_0x14c8ae,'rows':_0x2f2f0a}:null;}})[_0xc527('0x27')](respondWithResult(_0x2fef72,null))[_0xc527('0x45')](handleError(_0x2fef72,null));};exports[_0xc527('0x4f')]=function(_0x27f3fe,_0x130800,_0xaa25ae){var _0x7420cf={};var _0x246fbe={};var _0x129f2c;var _0x4100d8;return db[_0xc527('0x2d')][_0xc527('0x50')]({'where':{'id':_0x27f3fe[_0xc527('0x46')]['id']}})[_0xc527('0x27')](handleEntityNotFound(_0x130800,null))[_0xc527('0x27')](function(_0x4266bb){if(_0x4266bb){_0x129f2c=_0x4266bb;_0x246fbe[_0xc527('0x2f')]=_[_0xc527('0x31')](db[_0xc527('0x4b')][_0xc527('0x2e')]);_0x246fbe['query']=_[_0xc527('0x31')](_0x27f3fe[_0xc527('0x30')]);_0x246fbe[_0xc527('0x32')]=_['intersection'](_0x246fbe[_0xc527('0x2f')],_0x246fbe[_0xc527('0x30')]);_0x7420cf[_0xc527('0x34')]=_[_0xc527('0x33')](_0x246fbe['model'],qs[_0xc527('0x35')](_0x27f3fe[_0xc527('0x30')][_0xc527('0x35')]));_0x7420cf[_0xc527('0x34')]=_0x7420cf['attributes']['length']?_0x7420cf['attributes']:_0x246fbe[_0xc527('0x2f')];_0x7420cf[_0xc527('0x38')]=qs[_0xc527('0x39')](_0x27f3fe[_0xc527('0x30')]['sort']);_0x7420cf[_0xc527('0x3a')]=qs[_0xc527('0x32')](_[_0xc527('0x3b')](_0x27f3fe[_0xc527('0x30')],_0x246fbe[_0xc527('0x32')]));if(_0x27f3fe[_0xc527('0x30')]['filter']){_0x7420cf[_0xc527('0x3a')]=_[_0xc527('0x3f')](_0x7420cf['where'],{'$or':_[_0xc527('0x3c')](_0x7420cf[_0xc527('0x34')],function(_0x8bac65){var _0x2d48aa={};_0x2d48aa[_0x8bac65]={'$like':'%'+_0x27f3fe[_0xc527('0x30')][_0xc527('0x4c')]+'%'};return _0x2d48aa;})});}_0x7420cf=_[_0xc527('0x3f')]({},_0x7420cf,_0x27f3fe['options']);return _0x129f2c['getDescriptions'](_0x7420cf);}})[_0xc527('0x27')](function(_0x566dec){if(_0x566dec){_0x4100d8=_0x566dec[_0xc527('0x36')];if(!_0x27f3fe[_0xc527('0x30')][_0xc527('0x37')]('nolimit')){_0x7420cf[_0xc527('0x1e')]=qs[_0xc527('0x1e')](_0x27f3fe[_0xc527('0x30')]['limit']);_0x7420cf[_0xc527('0x21')]=qs[_0xc527('0x21')](_0x27f3fe[_0xc527('0x30')]['offset']);}return _0x129f2c[_0xc527('0x4f')](_0x7420cf);}})[_0xc527('0x27')](function(_0x373d2f){if(_0x373d2f){return _0x373d2f?{'count':_0x4100d8,'rows':_0x373d2f}:null;}})[_0xc527('0x27')](respondWithResult(_0x130800,null))[_0xc527('0x45')](handleError(_0x130800,null));}; \ No newline at end of file +var _0x19be=['zip-dir','fast-json-patch','moment','mustache','util','sox','lodash','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','then','stack','name','send','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','sort','where','pick','filter','merge','VIRTUAL','SalesforceConfiguration','count','rows','catch','show','includeAll','options','find','create','body','update','destroy','getFields','findOne','params','SalesforceField','order','hasOwnProperty','getSubjects','nolimit','getDescriptions','eml-format','rimraf'];(function(_0x2bf466,_0x4929a5){var _0x856885=function(_0x102ef1){while(--_0x102ef1){_0x2bf466['push'](_0x2bf466['shift']());}};_0x856885(++_0x4929a5);}(_0x19be,0x1de));var _0xe19b=function(_0x178494,_0x178b84){_0x178494=_0x178494-0x0;var _0x338c1f=_0x19be[_0x178494];return _0x338c1f;};'use strict';var emlformat=require(_0xe19b('0x0'));var rimraf=require(_0xe19b('0x1'));var zipdir=require(_0xe19b('0x2'));var jsonpatch=require(_0xe19b('0x3'));var rp=require('request-promise');var moment=require(_0xe19b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe19b('0x5'));var util=require(_0xe19b('0x6'));var path=require('path');var sox=require(_0xe19b('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe19b('0x8'));var squel=require('squel');var crypto=require(_0xe19b('0x9'));var jsforce=require(_0xe19b('0xa'));var deskjs=require(_0xe19b('0xb'));var toCsv=require(_0xe19b('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe19b('0xd'));var authService=require(_0xe19b('0xe'));var qs=require(_0xe19b('0xf'));var as=require(_0xe19b('0x10'));var hardwareService=require(_0xe19b('0x11'));var logger=require(_0xe19b('0x12'))(_0xe19b('0x13'));var utils=require(_0xe19b('0x14'));var config=require(_0xe19b('0x15'));var licenseUtil=require(_0xe19b('0x16'));var db=require(_0xe19b('0x17'))['db'];function respondWithStatusCode(_0xc0cfbc,_0xfe565f){_0xfe565f=_0xfe565f||0xcc;return function(_0x29d7f5){if(_0x29d7f5){return _0xc0cfbc[_0xe19b('0x18')](_0xfe565f);}return _0xc0cfbc[_0xe19b('0x19')](_0xfe565f)[_0xe19b('0x1a')]();};}function respondWithResult(_0x1bd3dd,_0x530f7d){_0x530f7d=_0x530f7d||0xc8;return function(_0x5451dd){if(_0x5451dd){return _0x1bd3dd[_0xe19b('0x19')](_0x530f7d)[_0xe19b('0x1b')](_0x5451dd);}};}function respondWithFilteredResult(_0x244a43,_0x3e94f3){return function(_0x1eaa9b){if(_0x1eaa9b){var _0x2d4271=typeof _0x3e94f3[_0xe19b('0x1c')]===_0xe19b('0x1d')&&typeof _0x3e94f3[_0xe19b('0x1e')]===_0xe19b('0x1d');var _0x5407bf=_0x1eaa9b['count'];var _0x32adb4=_0x2d4271?0x0:_0x3e94f3[_0xe19b('0x1c')];var _0x449e68=_0x2d4271?_0x1eaa9b['count']:_0x3e94f3[_0xe19b('0x1c')]+_0x3e94f3[_0xe19b('0x1e')];var _0x54dcd7;if(_0x449e68>=_0x5407bf){_0x449e68=_0x5407bf;_0x54dcd7=0xc8;}else{_0x54dcd7=0xce;}_0x244a43['status'](_0x54dcd7);return _0x244a43[_0xe19b('0x1f')](_0xe19b('0x20'),_0x32adb4+'-'+_0x449e68+'/'+_0x5407bf)[_0xe19b('0x1b')](_0x1eaa9b);}return null;};}function patchUpdates(_0xe3dc1b){return function(_0x54c32d){try{jsonpatch[_0xe19b('0x21')](_0x54c32d,_0xe3dc1b,!![]);}catch(_0x2f7f3b){return BPromise[_0xe19b('0x22')](_0x2f7f3b);}return _0x54c32d[_0xe19b('0x23')]();};}function saveUpdates(_0x29950b,_0x3b8905){return function(_0x1e7e45){if(_0x1e7e45){return _0x1e7e45['update'](_0x29950b)[_0xe19b('0x24')](function(_0x3352e4){return _0x3352e4;});}return null;};}function removeEntity(_0x4dfe6f,_0xef87){return function(_0x7d35ab){if(_0x7d35ab){return _0x7d35ab['destroy']()[_0xe19b('0x24')](function(){_0x4dfe6f[_0xe19b('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2adfed,_0x541f04){return function(_0x2f64ee){if(!_0x2f64ee){_0x2adfed[_0xe19b('0x18')](0x194);}return _0x2f64ee;};}function handleError(_0x34d390,_0x273bbb){_0x273bbb=_0x273bbb||0x1f4;return function(_0x284338){logger['error'](_0x284338[_0xe19b('0x25')]);if(_0x284338['name']){delete _0x284338[_0xe19b('0x26')];}_0x34d390[_0xe19b('0x19')](_0x273bbb)[_0xe19b('0x27')](_0x284338);};}exports['index']=function(_0x20fcdf,_0x3678a2){var _0x48b834={},_0x2f525b={},_0x19f2bf={'count':0x0,'rows':[]};var _0x51b550=_['map'](db['SalesforceConfiguration'][_0xe19b('0x28')],function(_0x2e7677){return{'name':_0x2e7677[_0xe19b('0x29')],'type':_0x2e7677[_0xe19b('0x2a')][_0xe19b('0x2b')]};});_0x2f525b[_0xe19b('0x2c')]=_[_0xe19b('0x2d')](_0x51b550,'name');_0x2f525b[_0xe19b('0x2e')]=_[_0xe19b('0x2f')](_0x20fcdf[_0xe19b('0x2e')]);_0x2f525b[_0xe19b('0x30')]=_[_0xe19b('0x31')](_0x2f525b[_0xe19b('0x2c')],_0x2f525b[_0xe19b('0x2e')]);_0x48b834[_0xe19b('0x32')]=_['intersection'](_0x2f525b[_0xe19b('0x2c')],qs[_0xe19b('0x33')](_0x20fcdf['query'][_0xe19b('0x33')]));_0x48b834[_0xe19b('0x32')]=_0x48b834[_0xe19b('0x32')][_0xe19b('0x34')]?_0x48b834[_0xe19b('0x32')]:_0x2f525b[_0xe19b('0x2c')];if(!_0x20fcdf[_0xe19b('0x2e')]['hasOwnProperty']('nolimit')){_0x48b834['limit']=qs[_0xe19b('0x1e')](_0x20fcdf[_0xe19b('0x2e')][_0xe19b('0x1e')]);_0x48b834[_0xe19b('0x1c')]=qs[_0xe19b('0x1c')](_0x20fcdf['query']['offset']);}_0x48b834['order']=qs[_0xe19b('0x35')](_0x20fcdf[_0xe19b('0x2e')][_0xe19b('0x35')]);_0x48b834[_0xe19b('0x36')]=qs['filters'](_[_0xe19b('0x37')](_0x20fcdf['query'],_0x2f525b[_0xe19b('0x30')]),_0x51b550);if(_0x20fcdf['query'][_0xe19b('0x38')]){_0x48b834[_0xe19b('0x36')]=_[_0xe19b('0x39')](_0x48b834[_0xe19b('0x36')],{'$or':_[_0xe19b('0x2d')](_0x51b550,function(_0x5394c2){if(_0x5394c2[_0xe19b('0x2a')]!==_0xe19b('0x3a')){var _0x39d706={};_0x39d706[_0x5394c2[_0xe19b('0x26')]]={'$like':'%'+_0x20fcdf[_0xe19b('0x2e')][_0xe19b('0x38')]+'%'};return _0x39d706;}})});}_0x48b834=_[_0xe19b('0x39')]({},_0x48b834,_0x20fcdf['options']);var _0x26781c={'where':_0x48b834['where']};return db[_0xe19b('0x3b')][_0xe19b('0x3c')](_0x26781c)[_0xe19b('0x24')](function(_0x5c2bd0){_0x19f2bf[_0xe19b('0x3c')]=_0x5c2bd0;if(_0x20fcdf['query']['includeAll']){_0x48b834['include']=[{'all':!![]}];}return db['SalesforceConfiguration']['findAll'](_0x48b834);})[_0xe19b('0x24')](function(_0x51ed36){_0x19f2bf[_0xe19b('0x3d')]=_0x51ed36;return _0x19f2bf;})[_0xe19b('0x24')](respondWithFilteredResult(_0x3678a2,_0x48b834))[_0xe19b('0x3e')](handleError(_0x3678a2,null));};exports[_0xe19b('0x3f')]=function(_0x3b6f96,_0x10a39a){var _0xd5055b={'raw':![],'where':{'id':_0x3b6f96['params']['id']}},_0x23e34e={};_0x23e34e[_0xe19b('0x2c')]=_['keys'](db['SalesforceConfiguration'][_0xe19b('0x28')]);_0x23e34e[_0xe19b('0x2e')]=_[_0xe19b('0x2f')](_0x3b6f96[_0xe19b('0x2e')]);_0x23e34e[_0xe19b('0x30')]=_['intersection'](_0x23e34e[_0xe19b('0x2c')],_0x23e34e[_0xe19b('0x2e')]);_0xd5055b[_0xe19b('0x32')]=_[_0xe19b('0x31')](_0x23e34e[_0xe19b('0x2c')],qs['fields'](_0x3b6f96[_0xe19b('0x2e')][_0xe19b('0x33')]));_0xd5055b[_0xe19b('0x32')]=_0xd5055b[_0xe19b('0x32')][_0xe19b('0x34')]?_0xd5055b['attributes']:_0x23e34e['model'];if(_0x3b6f96[_0xe19b('0x2e')][_0xe19b('0x40')]){_0xd5055b['include']=[{'all':!![]}];}_0xd5055b=_[_0xe19b('0x39')]({},_0xd5055b,_0x3b6f96[_0xe19b('0x41')]);return db['SalesforceConfiguration'][_0xe19b('0x42')](_0xd5055b)[_0xe19b('0x24')](handleEntityNotFound(_0x10a39a,null))[_0xe19b('0x24')](respondWithResult(_0x10a39a,null))[_0xe19b('0x3e')](handleError(_0x10a39a,null));};exports[_0xe19b('0x43')]=function(_0x107480,_0x2d09ff){return db[_0xe19b('0x3b')][_0xe19b('0x43')](_0x107480[_0xe19b('0x44')],{})[_0xe19b('0x24')](respondWithResult(_0x2d09ff,0xc9))[_0xe19b('0x3e')](handleError(_0x2d09ff,null));};exports[_0xe19b('0x45')]=function(_0x477e92,_0x9c46c){if(_0x477e92['body']['id']){delete _0x477e92[_0xe19b('0x44')]['id'];}return db[_0xe19b('0x3b')][_0xe19b('0x42')]({'where':{'id':_0x477e92['params']['id']}})[_0xe19b('0x24')](handleEntityNotFound(_0x9c46c,null))[_0xe19b('0x24')](saveUpdates(_0x477e92[_0xe19b('0x44')],null))[_0xe19b('0x24')](respondWithResult(_0x9c46c,null))['catch'](handleError(_0x9c46c,null));};exports[_0xe19b('0x46')]=function(_0x25688e,_0xa710a0){return db['SalesforceConfiguration'][_0xe19b('0x42')]({'where':{'id':_0x25688e['params']['id']}})[_0xe19b('0x24')](handleEntityNotFound(_0xa710a0,null))[_0xe19b('0x24')](removeEntity(_0xa710a0,null))['catch'](handleError(_0xa710a0,null));};exports[_0xe19b('0x47')]=function(_0x2d7ce8,_0x1b12c4,_0x4e048c){var _0x108a53={};var _0x2f34bd={};var _0x1f45ca;var _0x2310bd;return db[_0xe19b('0x3b')][_0xe19b('0x48')]({'where':{'id':_0x2d7ce8[_0xe19b('0x49')]['id']}})[_0xe19b('0x24')](handleEntityNotFound(_0x1b12c4,null))[_0xe19b('0x24')](function(_0x25221b){if(_0x25221b){_0x1f45ca=_0x25221b;_0x2f34bd['model']=_[_0xe19b('0x2f')](db[_0xe19b('0x4a')][_0xe19b('0x28')]);_0x2f34bd['query']=_[_0xe19b('0x2f')](_0x2d7ce8['query']);_0x2f34bd[_0xe19b('0x30')]=_['intersection'](_0x2f34bd[_0xe19b('0x2c')],_0x2f34bd[_0xe19b('0x2e')]);_0x108a53[_0xe19b('0x32')]=_[_0xe19b('0x31')](_0x2f34bd[_0xe19b('0x2c')],qs[_0xe19b('0x33')](_0x2d7ce8[_0xe19b('0x2e')][_0xe19b('0x33')]));_0x108a53['attributes']=_0x108a53[_0xe19b('0x32')][_0xe19b('0x34')]?_0x108a53[_0xe19b('0x32')]:_0x2f34bd['model'];_0x108a53[_0xe19b('0x4b')]=qs[_0xe19b('0x35')](_0x2d7ce8['query'][_0xe19b('0x35')]);_0x108a53[_0xe19b('0x36')]=qs['filters'](_[_0xe19b('0x37')](_0x2d7ce8[_0xe19b('0x2e')],_0x2f34bd[_0xe19b('0x30')]));if(_0x2d7ce8['query'][_0xe19b('0x38')]){_0x108a53['where']=_['merge'](_0x108a53[_0xe19b('0x36')],{'$or':_[_0xe19b('0x2d')](_0x108a53[_0xe19b('0x32')],function(_0x42085b){var _0x1ca19b={};_0x1ca19b[_0x42085b]={'$like':'%'+_0x2d7ce8[_0xe19b('0x2e')]['filter']+'%'};return _0x1ca19b;})});}_0x108a53=_[_0xe19b('0x39')]({},_0x108a53,_0x2d7ce8['options']);return _0x1f45ca[_0xe19b('0x47')](_0x108a53);}})[_0xe19b('0x24')](function(_0x2eeec3){if(_0x2eeec3){_0x2310bd=_0x2eeec3[_0xe19b('0x34')];if(!_0x2d7ce8[_0xe19b('0x2e')][_0xe19b('0x4c')]('nolimit')){_0x108a53[_0xe19b('0x1e')]=qs[_0xe19b('0x1e')](_0x2d7ce8[_0xe19b('0x2e')][_0xe19b('0x1e')]);_0x108a53[_0xe19b('0x1c')]=qs[_0xe19b('0x1c')](_0x2d7ce8[_0xe19b('0x2e')][_0xe19b('0x1c')]);}return _0x1f45ca[_0xe19b('0x47')](_0x108a53);}})['then'](function(_0x5da74c){if(_0x5da74c){return _0x5da74c?{'count':_0x2310bd,'rows':_0x5da74c}:null;}})[_0xe19b('0x24')](respondWithResult(_0x1b12c4,null))[_0xe19b('0x3e')](handleError(_0x1b12c4,null));};exports[_0xe19b('0x4d')]=function(_0x4e8da0,_0x370c85,_0x91f160){var _0x25056b={};var _0x40487c={};var _0x185600;var _0x2c7276;return db[_0xe19b('0x3b')][_0xe19b('0x48')]({'where':{'id':_0x4e8da0['params']['id']}})[_0xe19b('0x24')](handleEntityNotFound(_0x370c85,null))[_0xe19b('0x24')](function(_0x3ab35d){if(_0x3ab35d){_0x185600=_0x3ab35d;_0x40487c[_0xe19b('0x2c')]=_[_0xe19b('0x2f')](db[_0xe19b('0x4a')][_0xe19b('0x28')]);_0x40487c[_0xe19b('0x2e')]=_[_0xe19b('0x2f')](_0x4e8da0[_0xe19b('0x2e')]);_0x40487c['filters']=_[_0xe19b('0x31')](_0x40487c[_0xe19b('0x2c')],_0x40487c['query']);_0x25056b[_0xe19b('0x32')]=_[_0xe19b('0x31')](_0x40487c[_0xe19b('0x2c')],qs['fields'](_0x4e8da0['query']['fields']));_0x25056b[_0xe19b('0x32')]=_0x25056b[_0xe19b('0x32')][_0xe19b('0x34')]?_0x25056b[_0xe19b('0x32')]:_0x40487c['model'];_0x25056b['order']=qs['sort'](_0x4e8da0[_0xe19b('0x2e')][_0xe19b('0x35')]);_0x25056b[_0xe19b('0x36')]=qs['filters'](_['pick'](_0x4e8da0['query'],_0x40487c[_0xe19b('0x30')]));if(_0x4e8da0[_0xe19b('0x2e')][_0xe19b('0x38')]){_0x25056b['where']=_['merge'](_0x25056b['where'],{'$or':_[_0xe19b('0x2d')](_0x25056b[_0xe19b('0x32')],function(_0x6548bd){var _0x5026e9={};_0x5026e9[_0x6548bd]={'$like':'%'+_0x4e8da0[_0xe19b('0x2e')][_0xe19b('0x38')]+'%'};return _0x5026e9;})});}_0x25056b=_['merge']({},_0x25056b,_0x4e8da0['options']);return _0x185600['getSubjects'](_0x25056b);}})['then'](function(_0x5edcb6){if(_0x5edcb6){_0x2c7276=_0x5edcb6[_0xe19b('0x34')];if(!_0x4e8da0[_0xe19b('0x2e')]['hasOwnProperty'](_0xe19b('0x4e'))){_0x25056b['limit']=qs[_0xe19b('0x1e')](_0x4e8da0['query'][_0xe19b('0x1e')]);_0x25056b[_0xe19b('0x1c')]=qs[_0xe19b('0x1c')](_0x4e8da0['query'][_0xe19b('0x1c')]);}return _0x185600[_0xe19b('0x4d')](_0x25056b);}})[_0xe19b('0x24')](function(_0x4f0c25){if(_0x4f0c25){return _0x4f0c25?{'count':_0x2c7276,'rows':_0x4f0c25}:null;}})[_0xe19b('0x24')](respondWithResult(_0x370c85,null))[_0xe19b('0x3e')](handleError(_0x370c85,null));};exports[_0xe19b('0x4f')]=function(_0x2b2f3b,_0x36f920,_0x55c0d1){var _0x11aad9={};var _0x5cf6d0={};var _0x1169f5;var _0x3acb2a;return db['SalesforceConfiguration'][_0xe19b('0x48')]({'where':{'id':_0x2b2f3b[_0xe19b('0x49')]['id']}})[_0xe19b('0x24')](handleEntityNotFound(_0x36f920,null))[_0xe19b('0x24')](function(_0x29d61b){if(_0x29d61b){_0x1169f5=_0x29d61b;_0x5cf6d0[_0xe19b('0x2c')]=_[_0xe19b('0x2f')](db[_0xe19b('0x4a')][_0xe19b('0x28')]);_0x5cf6d0['query']=_['keys'](_0x2b2f3b['query']);_0x5cf6d0['filters']=_[_0xe19b('0x31')](_0x5cf6d0[_0xe19b('0x2c')],_0x5cf6d0['query']);_0x11aad9[_0xe19b('0x32')]=_[_0xe19b('0x31')](_0x5cf6d0[_0xe19b('0x2c')],qs[_0xe19b('0x33')](_0x2b2f3b['query']['fields']));_0x11aad9[_0xe19b('0x32')]=_0x11aad9[_0xe19b('0x32')][_0xe19b('0x34')]?_0x11aad9[_0xe19b('0x32')]:_0x5cf6d0['model'];_0x11aad9['order']=qs[_0xe19b('0x35')](_0x2b2f3b[_0xe19b('0x2e')][_0xe19b('0x35')]);_0x11aad9[_0xe19b('0x36')]=qs[_0xe19b('0x30')](_[_0xe19b('0x37')](_0x2b2f3b[_0xe19b('0x2e')],_0x5cf6d0[_0xe19b('0x30')]));if(_0x2b2f3b[_0xe19b('0x2e')]['filter']){_0x11aad9[_0xe19b('0x36')]=_[_0xe19b('0x39')](_0x11aad9['where'],{'$or':_[_0xe19b('0x2d')](_0x11aad9['attributes'],function(_0x428f54){var _0x1e8e17={};_0x1e8e17[_0x428f54]={'$like':'%'+_0x2b2f3b[_0xe19b('0x2e')][_0xe19b('0x38')]+'%'};return _0x1e8e17;})});}_0x11aad9=_[_0xe19b('0x39')]({},_0x11aad9,_0x2b2f3b['options']);return _0x1169f5[_0xe19b('0x4f')](_0x11aad9);}})['then'](function(_0x503982){if(_0x503982){_0x3acb2a=_0x503982[_0xe19b('0x34')];if(!_0x2b2f3b[_0xe19b('0x2e')][_0xe19b('0x4c')](_0xe19b('0x4e'))){_0x11aad9[_0xe19b('0x1e')]=qs['limit'](_0x2b2f3b[_0xe19b('0x2e')]['limit']);_0x11aad9[_0xe19b('0x1c')]=qs[_0xe19b('0x1c')](_0x2b2f3b[_0xe19b('0x2e')]['offset']);}return _0x1169f5['getDescriptions'](_0x11aad9);}})[_0xe19b('0x24')](function(_0x33b198){if(_0x33b198){return _0x33b198?{'count':_0x3acb2a,'rows':_0x33b198}:null;}})[_0xe19b('0x24')](respondWithResult(_0x36f920,null))[_0xe19b('0x3e')](handleError(_0x36f920,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index e7b9665..1d5d08d 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 _0xe8f0=['lodash','api','moment','bluebird','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration'];(function(_0x58dc25,_0x49b9d5){var _0x21b0a7=function(_0x38a186){while(--_0x38a186){_0x58dc25['push'](_0x58dc25['shift']());}};_0x21b0a7(++_0x49b9d5);}(_0xe8f0,0x18c));var _0x0e8f=function(_0x26f49f,_0x4881d4){_0x26f49f=_0x26f49f-0x0;var _0x8a5f47=_0xe8f0[_0x26f49f];return _0x8a5f47;};'use strict';var _=require(_0x0e8f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x0e8f('0x1'));var moment=require(_0x0e8f('0x2'));var BPromise=require(_0x0e8f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0e8f('0x4'));var rimraf=require(_0x0e8f('0x5'));var config=require(_0x0e8f('0x6'));var attributes=require(_0x0e8f('0x7'));module[_0x0e8f('0x8')]=function(_0x244c60,_0x2aa792){return _0x244c60[_0x0e8f('0x9')](_0x0e8f('0xa'),attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2c35=['exports','SalesforceConfiguration','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes'];(function(_0x15aaa0,_0x4bf5e1){var _0x457d23=function(_0x52ba59){while(--_0x52ba59){_0x15aaa0['push'](_0x15aaa0['shift']());}};_0x457d23(++_0x4bf5e1);}(_0x2c35,0xf2));var _0x52c3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2c35[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x52c3('0x0'));var util=require('util');var logger=require(_0x52c3('0x1'))(_0x52c3('0x2'));var moment=require(_0x52c3('0x3'));var BPromise=require(_0x52c3('0x4'));var rp=require(_0x52c3('0x5'));var fs=require('fs');var path=require(_0x52c3('0x6'));var rimraf=require(_0x52c3('0x7'));var config=require(_0x52c3('0x8'));var attributes=require(_0x52c3('0x9'));module[_0x52c3('0xa')]=function(_0x233a83,_0x260928){return _0x233a83['define'](_0x52c3('0xb'),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 20568dd..5964a8b 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 _0xa263=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash'];(function(_0x486d7c,_0x25f99d){var _0x2bc318=function(_0x494474){while(--_0x494474){_0x486d7c['push'](_0x486d7c['shift']());}};_0x2bc318(++_0x25f99d);}(_0xa263,0xc5));var _0x3a26=function(_0x466a85,_0x27cf29){_0x466a85=_0x466a85-0x0;var _0x396ca7=_0xa263[_0x466a85];return _0x396ca7;};'use strict';var _=require(_0x3a26('0x0'));var util=require(_0x3a26('0x1'));var moment=require(_0x3a26('0x2'));var BPromise=require(_0x3a26('0x3'));var rs=require(_0x3a26('0x4'));var fs=require('fs');var Redis=require(_0x3a26('0x5'));var db=require(_0x3a26('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x3a26('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3a26('0x8'));var client=jayson[_0x3a26('0x9')][_0x3a26('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1f6f1d,_0x2ff182,_0x5d482e){return new BPromise(function(_0x4dd986,_0x3348f8){return client['request'](_0x1f6f1d,_0x5d482e)[_0x3a26('0xb')](function(_0x4e07dc){logger[_0x3a26('0xc')](_0x3a26('0xd'),_0x2ff182,_0x3a26('0xe'));logger[_0x3a26('0xf')](_0x3a26('0x10'),_0x2ff182,_0x3a26('0xe'),JSON[_0x3a26('0x11')](_0x4e07dc));if(_0x4e07dc[_0x3a26('0x12')]){if(_0x4e07dc[_0x3a26('0x12')][_0x3a26('0x13')]===0x1f4){logger[_0x3a26('0x12')](_0x3a26('0xd'),_0x2ff182,_0x4e07dc[_0x3a26('0x12')][_0x3a26('0x14')]);return _0x3348f8(_0x4e07dc[_0x3a26('0x12')][_0x3a26('0x14')]);}logger[_0x3a26('0x12')]('SalesforceConfiguration,\x20%s,\x20%s',_0x2ff182,_0x4e07dc[_0x3a26('0x12')][_0x3a26('0x14')]);return _0x4dd986(_0x4e07dc['error'][_0x3a26('0x14')]);}else{logger[_0x3a26('0xc')](_0x3a26('0xd'),_0x2ff182,_0x3a26('0xe'));_0x4dd986(_0x4e07dc['result'][_0x3a26('0x14')]);}})[_0x3a26('0x15')](function(_0x5ee926){logger[_0x3a26('0x12')](_0x3a26('0xd'),_0x2ff182,_0x5ee926);_0x3348f8(_0x5ee926);});});} \ No newline at end of file +var _0xc995=['debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc995,0x85));var _0x5c99=function(_0x17ed19,_0x593337){_0x17ed19=_0x17ed19-0x0;var _0x3e9041=_0xc995[_0x17ed19];return _0x3e9041;};'use strict';var _=require(_0x5c99('0x0'));var util=require(_0x5c99('0x1'));var moment=require(_0x5c99('0x2'));var BPromise=require('bluebird');var rs=require(_0x5c99('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5c99('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5c99('0x5'))(_0x5c99('0x6'));var config=require(_0x5c99('0x7'));var jayson=require(_0x5c99('0x8'));var client=jayson[_0x5c99('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3a2425,_0x1e4ae6,_0x668583){return new BPromise(function(_0x34dc63,_0x1e92ac){return client['request'](_0x3a2425,_0x668583)[_0x5c99('0xa')](function(_0x1999e2){logger[_0x5c99('0xb')](_0x5c99('0xc'),_0x1e4ae6,_0x5c99('0xd'));logger[_0x5c99('0xe')](_0x5c99('0xf'),_0x1e4ae6,_0x5c99('0xd'),JSON[_0x5c99('0x10')](_0x1999e2));if(_0x1999e2[_0x5c99('0x11')]){if(_0x1999e2[_0x5c99('0x11')][_0x5c99('0x12')]===0x1f4){logger[_0x5c99('0x11')](_0x5c99('0xc'),_0x1e4ae6,_0x1999e2[_0x5c99('0x11')]['message']);return _0x1e92ac(_0x1999e2[_0x5c99('0x11')][_0x5c99('0x13')]);}logger[_0x5c99('0x11')](_0x5c99('0xc'),_0x1e4ae6,_0x1999e2[_0x5c99('0x11')][_0x5c99('0x13')]);return _0x34dc63(_0x1999e2[_0x5c99('0x11')][_0x5c99('0x13')]);}else{logger[_0x5c99('0xb')](_0x5c99('0xc'),_0x1e4ae6,_0x5c99('0xd'));_0x34dc63(_0x1999e2['result'][_0x5c99('0x13')]);}})[_0x5c99('0x14')](function(_0x16f263){logger[_0x5c99('0x11')](_0x5c99('0xc'),_0x1e4ae6,_0x16f263);_0x1e92ac(_0x16f263);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index fbbdcfa..ecca725 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 _0xaefd=['./intSalesforceField.controller','isAuthenticated','index','get','/:id','show','post','create','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x4063a4,_0x19d730){var _0x17908d=function(_0x3ce714){while(--_0x3ce714){_0x4063a4['push'](_0x4063a4['shift']());}};_0x17908d(++_0x19d730);}(_0xaefd,0x1c3));var _0xdaef=function(_0x4da196,_0x357dc9){_0x4da196=_0x4da196-0x0;var _0x375df3=_0xaefd[_0x4da196];return _0x375df3;};'use strict';var multer=require(_0xdaef('0x0'));var util=require(_0xdaef('0x1'));var path=require(_0xdaef('0x2'));var timeout=require(_0xdaef('0x3'));var express=require(_0xdaef('0x4'));var router=express[_0xdaef('0x5')]();var fs_extra=require(_0xdaef('0x6'));var auth=require(_0xdaef('0x7'));var interaction=require(_0xdaef('0x8'));var config=require('../../config/environment');var controller=require(_0xdaef('0x9'));router['get']('/',auth[_0xdaef('0xa')](),controller[_0xdaef('0xb')]);router[_0xdaef('0xc')](_0xdaef('0xd'),auth[_0xdaef('0xa')](),controller[_0xdaef('0xe')]);router[_0xdaef('0xf')]('/',auth['isAuthenticated'](),controller[_0xdaef('0x10')]);router['put'](_0xdaef('0xd'),auth[_0xdaef('0xa')](),controller[_0xdaef('0x11')]);router[_0xdaef('0x12')](_0xdaef('0xd'),auth['isAuthenticated'](),controller[_0xdaef('0x13')]);module['exports']=router; \ No newline at end of file +var _0x6400=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','multer','connect-timeout','express'];(function(_0x3369ba,_0x4aea54){var _0x32bb01=function(_0x219be4){while(--_0x219be4){_0x3369ba['push'](_0x3369ba['shift']());}};_0x32bb01(++_0x4aea54);}(_0x6400,0x107));var _0x0640=function(_0x154bd6,_0x3413ad){_0x154bd6=_0x154bd6-0x0;var _0x454637=_0x6400[_0x154bd6];return _0x454637;};'use strict';var multer=require(_0x0640('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x0640('0x1'));var express=require(_0x0640('0x2'));var router=express[_0x0640('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0640('0x4'));var interaction=require(_0x0640('0x5'));var config=require(_0x0640('0x6'));var controller=require(_0x0640('0x7'));router[_0x0640('0x8')]('/',auth[_0x0640('0x9')](),controller[_0x0640('0xa')]);router['get'](_0x0640('0xb'),auth[_0x0640('0x9')](),controller[_0x0640('0xc')]);router[_0x0640('0xd')]('/',auth[_0x0640('0x9')](),controller[_0x0640('0xe')]);router[_0x0640('0xf')](_0x0640('0xb'),auth[_0x0640('0x9')](),controller[_0x0640('0x10')]);router[_0x0640('0x11')](_0x0640('0xb'),auth[_0x0640('0x9')](),controller[_0x0640('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 133de07..447dd1b 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 _0x4398=['sequelize','variable','customVariable','picklist','string','STRING','ENUM'];(function(_0x12fcbd,_0x884804){var _0x28ec2a=function(_0xa5ff99){while(--_0xa5ff99){_0x12fcbd['push'](_0x12fcbd['shift']());}};_0x28ec2a(++_0x884804);}(_0x4398,0x8c));var _0x8439=function(_0x457ffa,_0x428d0c){_0x457ffa=_0x457ffa-0x0;var _0x58257a=_0x4398[_0x457ffa];return _0x58257a;};'use strict';var Sequelize=require(_0x8439('0x0'));module['exports']={'type':{'type':Sequelize['ENUM']('string',_0x8439('0x1'),_0x8439('0x2'),'keyValue',_0x8439('0x3')),'defaultValue':_0x8439('0x4')},'content':{'type':Sequelize[_0x8439('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x8439('0x6')](_0x8439('0x4'),_0x8439('0x1'),_0x8439('0x2'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x8439('0x5')]},'variableName':{'type':Sequelize[_0x8439('0x5')]}}; \ No newline at end of file +var _0x042a=['ENUM','exports','string','variable','customVariable','picklist','STRING'];(function(_0x400e00,_0x425430){var _0x3c057f=function(_0x1de680){while(--_0x1de680){_0x400e00['push'](_0x400e00['shift']());}};_0x3c057f(++_0x425430);}(_0x042a,0x182));var _0xa042=function(_0x321900,_0xdc99bb){_0x321900=_0x321900-0x0;var _0x2211c2=_0x042a[_0x321900];return _0x2211c2;};'use strict';var Sequelize=require('sequelize');module[_0xa042('0x0')]={'type':{'type':Sequelize['ENUM'](_0xa042('0x1'),_0xa042('0x2'),_0xa042('0x3'),'keyValue',_0xa042('0x4')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xa042('0x5')]},'keyType':{'type':Sequelize[_0xa042('0x6')]('string',_0xa042('0x2'),_0xa042('0x3'))},'keyContent':{'type':Sequelize[_0xa042('0x5')]},'idField':{'type':Sequelize[_0xa042('0x5')]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 187fe3e..71ffaed 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 _0x37e6=['findAll','rows','catch','show','params','length','includeAll','merge','find','create','body','destroy','zip-dir','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/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','set','apply','save','update','then','status','error','name','index','SalesforceField','rawAttributes','fieldName','map','keys','query','filters','intersection','model','attributes','fields','order','sort','where','pick','type','options','count','include'];(function(_0x164af1,_0x3cf772){var _0x5d81a2=function(_0xa57547){while(--_0xa57547){_0x164af1['push'](_0x164af1['shift']());}};_0x5d81a2(++_0x3cf772);}(_0x37e6,0x1c8));var _0x637e=function(_0x578e6d,_0x39437c){_0x578e6d=_0x578e6d-0x0;var _0x222b48=_0x37e6[_0x578e6d];return _0x222b48;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x637e('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x637e('0x1'));var moment=require(_0x637e('0x2'));var BPromise=require(_0x637e('0x3'));var Mustache=require(_0x637e('0x4'));var util=require(_0x637e('0x5'));var path=require(_0x637e('0x6'));var sox=require(_0x637e('0x7'));var csv=require(_0x637e('0x8'));var ejs=require(_0x637e('0x9'));var fs=require('fs');var fs_extra=require(_0x637e('0xa'));var _=require('lodash');var squel=require(_0x637e('0xb'));var crypto=require(_0x637e('0xc'));var jsforce=require(_0x637e('0xd'));var deskjs=require(_0x637e('0xe'));var toCsv=require(_0x637e('0x8'));var querystring=require(_0x637e('0xf'));var Papa=require(_0x637e('0x10'));var Redis=require(_0x637e('0x11'));var authService=require(_0x637e('0x12'));var qs=require(_0x637e('0x13'));var as=require(_0x637e('0x14'));var hardwareService=require(_0x637e('0x15'));var logger=require(_0x637e('0x16'))(_0x637e('0x17'));var utils=require(_0x637e('0x18'));var config=require(_0x637e('0x19'));var licenseUtil=require(_0x637e('0x1a'));var db=require(_0x637e('0x1b'))['db'];function respondWithStatusCode(_0xd8038e,_0x35bcf5){_0x35bcf5=_0x35bcf5||0xcc;return function(_0x12066c){if(_0x12066c){return _0xd8038e[_0x637e('0x1c')](_0x35bcf5);}return _0xd8038e['status'](_0x35bcf5)[_0x637e('0x1d')]();};}function respondWithResult(_0x48c611,_0x517866){_0x517866=_0x517866||0xc8;return function(_0x41419c){if(_0x41419c){return _0x48c611['status'](_0x517866)[_0x637e('0x1e')](_0x41419c);}};}function respondWithFilteredResult(_0x254c9e,_0x595470){return function(_0x48e925){if(_0x48e925){var _0x5acbf0=typeof _0x595470[_0x637e('0x1f')]===_0x637e('0x20')&&typeof _0x595470[_0x637e('0x21')]===_0x637e('0x20');var _0x48d2cf=_0x48e925['count'];var _0x3a8368=_0x5acbf0?0x0:_0x595470[_0x637e('0x1f')];var _0x4f6353=_0x5acbf0?_0x48e925['count']:_0x595470['offset']+_0x595470[_0x637e('0x21')];var _0x72208d;if(_0x4f6353>=_0x48d2cf){_0x4f6353=_0x48d2cf;_0x72208d=0xc8;}else{_0x72208d=0xce;}_0x254c9e['status'](_0x72208d);return _0x254c9e[_0x637e('0x22')]('Content-Range',_0x3a8368+'-'+_0x4f6353+'/'+_0x48d2cf)[_0x637e('0x1e')](_0x48e925);}return null;};}function patchUpdates(_0x1bc5fc){return function(_0x3667e9){try{jsonpatch[_0x637e('0x23')](_0x3667e9,_0x1bc5fc,!![]);}catch(_0x191bb2){return BPromise['reject'](_0x191bb2);}return _0x3667e9[_0x637e('0x24')]();};}function saveUpdates(_0x401adc,_0x334bb7){return function(_0x386521){if(_0x386521){return _0x386521[_0x637e('0x25')](_0x401adc)[_0x637e('0x26')](function(_0x43a5d4){return _0x43a5d4;});}return null;};}function removeEntity(_0x169ec8,_0x2fb010){return function(_0x31c4e9){if(_0x31c4e9){return _0x31c4e9['destroy']()['then'](function(){_0x169ec8[_0x637e('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e425e,_0x226425){return function(_0x92c59e){if(!_0x92c59e){_0x4e425e[_0x637e('0x1c')](0x194);}return _0x92c59e;};}function handleError(_0x213111,_0x53855d){_0x53855d=_0x53855d||0x1f4;return function(_0x4e15fd){logger[_0x637e('0x28')](_0x4e15fd['stack']);if(_0x4e15fd[_0x637e('0x29')]){delete _0x4e15fd['name'];}_0x213111['status'](_0x53855d)['send'](_0x4e15fd);};}exports[_0x637e('0x2a')]=function(_0x1c12f2,_0x4170ff){var _0x490ea5={},_0x30b039={},_0x32d402={'count':0x0,'rows':[]};var _0xf995d0=_['map'](db[_0x637e('0x2b')][_0x637e('0x2c')],function(_0xaf6b58){return{'name':_0xaf6b58[_0x637e('0x2d')],'type':_0xaf6b58['type']['key']};});_0x30b039['model']=_[_0x637e('0x2e')](_0xf995d0,_0x637e('0x29'));_0x30b039['query']=_[_0x637e('0x2f')](_0x1c12f2[_0x637e('0x30')]);_0x30b039[_0x637e('0x31')]=_[_0x637e('0x32')](_0x30b039[_0x637e('0x33')],_0x30b039[_0x637e('0x30')]);_0x490ea5[_0x637e('0x34')]=_['intersection'](_0x30b039[_0x637e('0x33')],qs[_0x637e('0x35')](_0x1c12f2[_0x637e('0x30')][_0x637e('0x35')]));_0x490ea5[_0x637e('0x34')]=_0x490ea5[_0x637e('0x34')]['length']?_0x490ea5[_0x637e('0x34')]:_0x30b039[_0x637e('0x33')];if(!_0x1c12f2[_0x637e('0x30')]['hasOwnProperty']('nolimit')){_0x490ea5[_0x637e('0x21')]=qs['limit'](_0x1c12f2[_0x637e('0x30')]['limit']);_0x490ea5[_0x637e('0x1f')]=qs[_0x637e('0x1f')](_0x1c12f2['query'][_0x637e('0x1f')]);}_0x490ea5[_0x637e('0x36')]=qs[_0x637e('0x37')](_0x1c12f2['query'][_0x637e('0x37')]);_0x490ea5[_0x637e('0x38')]=qs[_0x637e('0x31')](_[_0x637e('0x39')](_0x1c12f2[_0x637e('0x30')],_0x30b039[_0x637e('0x31')]),_0xf995d0);if(_0x1c12f2[_0x637e('0x30')]['filter']){_0x490ea5[_0x637e('0x38')]=_['merge'](_0x490ea5[_0x637e('0x38')],{'$or':_['map'](_0xf995d0,function(_0x436b29){if(_0x436b29[_0x637e('0x3a')]!=='VIRTUAL'){var _0x54ef2f={};_0x54ef2f[_0x436b29[_0x637e('0x29')]]={'$like':'%'+_0x1c12f2[_0x637e('0x30')]['filter']+'%'};return _0x54ef2f;}})});}_0x490ea5=_['merge']({},_0x490ea5,_0x1c12f2[_0x637e('0x3b')]);var _0x1a4f63={'where':_0x490ea5[_0x637e('0x38')]};return db['SalesforceField'][_0x637e('0x3c')](_0x1a4f63)[_0x637e('0x26')](function(_0x429d81){_0x32d402['count']=_0x429d81;if(_0x1c12f2['query']['includeAll']){_0x490ea5[_0x637e('0x3d')]=[{'all':!![]}];}return db[_0x637e('0x2b')][_0x637e('0x3e')](_0x490ea5);})[_0x637e('0x26')](function(_0x2982e8){_0x32d402[_0x637e('0x3f')]=_0x2982e8;return _0x32d402;})[_0x637e('0x26')](respondWithFilteredResult(_0x4170ff,_0x490ea5))[_0x637e('0x40')](handleError(_0x4170ff,null));};exports[_0x637e('0x41')]=function(_0x267210,_0x1b76d9){var _0x575df3={'raw':!![],'where':{'id':_0x267210[_0x637e('0x42')]['id']}},_0x2089d2={};_0x2089d2[_0x637e('0x33')]=_[_0x637e('0x2f')](db['SalesforceField'][_0x637e('0x2c')]);_0x2089d2[_0x637e('0x30')]=_[_0x637e('0x2f')](_0x267210[_0x637e('0x30')]);_0x2089d2[_0x637e('0x31')]=_[_0x637e('0x32')](_0x2089d2[_0x637e('0x33')],_0x2089d2[_0x637e('0x30')]);_0x575df3[_0x637e('0x34')]=_['intersection'](_0x2089d2[_0x637e('0x33')],qs[_0x637e('0x35')](_0x267210[_0x637e('0x30')]['fields']));_0x575df3[_0x637e('0x34')]=_0x575df3[_0x637e('0x34')][_0x637e('0x43')]?_0x575df3['attributes']:_0x2089d2[_0x637e('0x33')];if(_0x267210['query'][_0x637e('0x44')]){_0x575df3[_0x637e('0x3d')]=[{'all':!![]}];}_0x575df3=_[_0x637e('0x45')]({},_0x575df3,_0x267210[_0x637e('0x3b')]);return db[_0x637e('0x2b')][_0x637e('0x46')](_0x575df3)[_0x637e('0x26')](handleEntityNotFound(_0x1b76d9,null))['then'](respondWithResult(_0x1b76d9,null))[_0x637e('0x40')](handleError(_0x1b76d9,null));};exports['create']=function(_0x369a7b,_0x26e3d9){return db[_0x637e('0x2b')][_0x637e('0x47')](_0x369a7b[_0x637e('0x48')],{})[_0x637e('0x26')](respondWithResult(_0x26e3d9,0xc9))[_0x637e('0x40')](handleError(_0x26e3d9,null));};exports[_0x637e('0x25')]=function(_0x3fbb56,_0x59ab62){if(_0x3fbb56['body']['id']){delete _0x3fbb56[_0x637e('0x48')]['id'];}return db[_0x637e('0x2b')]['find']({'where':{'id':_0x3fbb56['params']['id']}})['then'](handleEntityNotFound(_0x59ab62,null))[_0x637e('0x26')](saveUpdates(_0x3fbb56['body'],null))[_0x637e('0x26')](respondWithResult(_0x59ab62,null))[_0x637e('0x40')](handleError(_0x59ab62,null));};exports[_0x637e('0x49')]=function(_0x229843,_0x1e386e){return db[_0x637e('0x2b')][_0x637e('0x46')]({'where':{'id':_0x229843[_0x637e('0x42')]['id']}})[_0x637e('0x26')](handleEntityNotFound(_0x1e386e,null))[_0x637e('0x26')](removeEntity(_0x1e386e,null))[_0x637e('0x40')](handleError(_0x1e386e,null));}; \ No newline at end of file +var _0x5813=['reject','save','update','then','destroy','error','stack','name','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','SalesforceField','count','includeAll','include','findAll','rows','catch','show','params','keys','options','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply'];(function(_0x41291d,_0x158e04){var _0x184db5=function(_0x3a3532){while(--_0x3a3532){_0x41291d['push'](_0x41291d['shift']());}};_0x184db5(++_0x158e04);}(_0x5813,0x19f));var _0x3581=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x5813[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require(_0x3581('0x0'));var rimraf=require(_0x3581('0x1'));var zipdir=require(_0x3581('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3581('0x3'));var moment=require(_0x3581('0x4'));var BPromise=require(_0x3581('0x5'));var Mustache=require(_0x3581('0x6'));var util=require('util');var path=require(_0x3581('0x7'));var sox=require(_0x3581('0x8'));var csv=require(_0x3581('0x9'));var ejs=require(_0x3581('0xa'));var fs=require('fs');var fs_extra=require(_0x3581('0xb'));var _=require(_0x3581('0xc'));var squel=require(_0x3581('0xd'));var crypto=require(_0x3581('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3581('0x9'));var querystring=require(_0x3581('0xf'));var Papa=require('papaparse');var Redis=require(_0x3581('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x3581('0x11'));var as=require(_0x3581('0x12'));var hardwareService=require(_0x3581('0x13'));var logger=require(_0x3581('0x14'))(_0x3581('0x15'));var utils=require(_0x3581('0x16'));var config=require(_0x3581('0x17'));var licenseUtil=require(_0x3581('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x82636a,_0x40f2e4){_0x40f2e4=_0x40f2e4||0xcc;return function(_0x575499){if(_0x575499){return _0x82636a[_0x3581('0x19')](_0x40f2e4);}return _0x82636a[_0x3581('0x1a')](_0x40f2e4)[_0x3581('0x1b')]();};}function respondWithResult(_0x25fa4f,_0x16a597){_0x16a597=_0x16a597||0xc8;return function(_0x455390){if(_0x455390){return _0x25fa4f[_0x3581('0x1a')](_0x16a597)[_0x3581('0x1c')](_0x455390);}};}function respondWithFilteredResult(_0x343d10,_0x58e98b){return function(_0x2660fe){if(_0x2660fe){var _0x5321b6=typeof _0x58e98b[_0x3581('0x1d')]===_0x3581('0x1e')&&typeof _0x58e98b[_0x3581('0x1f')]===_0x3581('0x1e');var _0x4460d3=_0x2660fe['count'];var _0x4fa142=_0x5321b6?0x0:_0x58e98b[_0x3581('0x1d')];var _0x793906=_0x5321b6?_0x2660fe['count']:_0x58e98b['offset']+_0x58e98b[_0x3581('0x1f')];var _0x28fb46;if(_0x793906>=_0x4460d3){_0x793906=_0x4460d3;_0x28fb46=0xc8;}else{_0x28fb46=0xce;}_0x343d10[_0x3581('0x1a')](_0x28fb46);return _0x343d10[_0x3581('0x20')](_0x3581('0x21'),_0x4fa142+'-'+_0x793906+'/'+_0x4460d3)[_0x3581('0x1c')](_0x2660fe);}return null;};}function patchUpdates(_0x2d6a97){return function(_0x25127b){try{jsonpatch[_0x3581('0x22')](_0x25127b,_0x2d6a97,!![]);}catch(_0x1a372e){return BPromise[_0x3581('0x23')](_0x1a372e);}return _0x25127b[_0x3581('0x24')]();};}function saveUpdates(_0x53ab1e,_0x33844f){return function(_0x486414){if(_0x486414){return _0x486414[_0x3581('0x25')](_0x53ab1e)[_0x3581('0x26')](function(_0x4ba785){return _0x4ba785;});}return null;};}function removeEntity(_0x1051b9,_0xae1c19){return function(_0x5abd80){if(_0x5abd80){return _0x5abd80[_0x3581('0x27')]()[_0x3581('0x26')](function(){_0x1051b9[_0x3581('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24dd95,_0x3ae900){return function(_0x4e024a){if(!_0x4e024a){_0x24dd95[_0x3581('0x19')](0x194);}return _0x4e024a;};}function handleError(_0x438965,_0x357d85){_0x357d85=_0x357d85||0x1f4;return function(_0x3dadd0){logger[_0x3581('0x28')](_0x3dadd0[_0x3581('0x29')]);if(_0x3dadd0[_0x3581('0x2a')]){delete _0x3dadd0[_0x3581('0x2a')];}_0x438965[_0x3581('0x1a')](_0x357d85)['send'](_0x3dadd0);};}exports['index']=function(_0x28eaf6,_0x550187){var _0x214137={},_0x58a248={},_0x29dfb8={'count':0x0,'rows':[]};var _0x44995d=_['map'](db['SalesforceField'][_0x3581('0x2b')],function(_0x2e3fa9){return{'name':_0x2e3fa9[_0x3581('0x2c')],'type':_0x2e3fa9[_0x3581('0x2d')]['key']};});_0x58a248[_0x3581('0x2e')]=_['map'](_0x44995d,_0x3581('0x2a'));_0x58a248['query']=_['keys'](_0x28eaf6[_0x3581('0x2f')]);_0x58a248[_0x3581('0x30')]=_[_0x3581('0x31')](_0x58a248[_0x3581('0x2e')],_0x58a248['query']);_0x214137[_0x3581('0x32')]=_[_0x3581('0x31')](_0x58a248[_0x3581('0x2e')],qs[_0x3581('0x33')](_0x28eaf6['query'][_0x3581('0x33')]));_0x214137[_0x3581('0x32')]=_0x214137['attributes'][_0x3581('0x34')]?_0x214137[_0x3581('0x32')]:_0x58a248[_0x3581('0x2e')];if(!_0x28eaf6[_0x3581('0x2f')][_0x3581('0x35')](_0x3581('0x36'))){_0x214137['limit']=qs[_0x3581('0x1f')](_0x28eaf6[_0x3581('0x2f')]['limit']);_0x214137[_0x3581('0x1d')]=qs[_0x3581('0x1d')](_0x28eaf6['query'][_0x3581('0x1d')]);}_0x214137[_0x3581('0x37')]=qs[_0x3581('0x38')](_0x28eaf6[_0x3581('0x2f')][_0x3581('0x38')]);_0x214137[_0x3581('0x39')]=qs[_0x3581('0x30')](_['pick'](_0x28eaf6[_0x3581('0x2f')],_0x58a248[_0x3581('0x30')]),_0x44995d);if(_0x28eaf6[_0x3581('0x2f')][_0x3581('0x3a')]){_0x214137[_0x3581('0x39')]=_[_0x3581('0x3b')](_0x214137[_0x3581('0x39')],{'$or':_['map'](_0x44995d,function(_0x593d51){if(_0x593d51[_0x3581('0x2d')]!==_0x3581('0x3c')){var _0x5cafca={};_0x5cafca[_0x593d51[_0x3581('0x2a')]]={'$like':'%'+_0x28eaf6[_0x3581('0x2f')][_0x3581('0x3a')]+'%'};return _0x5cafca;}})});}_0x214137=_[_0x3581('0x3b')]({},_0x214137,_0x28eaf6['options']);var _0x422eca={'where':_0x214137[_0x3581('0x39')]};return db[_0x3581('0x3d')][_0x3581('0x3e')](_0x422eca)[_0x3581('0x26')](function(_0x3d1835){_0x29dfb8[_0x3581('0x3e')]=_0x3d1835;if(_0x28eaf6[_0x3581('0x2f')][_0x3581('0x3f')]){_0x214137[_0x3581('0x40')]=[{'all':!![]}];}return db[_0x3581('0x3d')][_0x3581('0x41')](_0x214137);})[_0x3581('0x26')](function(_0x406bb1){_0x29dfb8[_0x3581('0x42')]=_0x406bb1;return _0x29dfb8;})['then'](respondWithFilteredResult(_0x550187,_0x214137))[_0x3581('0x43')](handleError(_0x550187,null));};exports[_0x3581('0x44')]=function(_0x1622d1,_0x2f27af){var _0x2f72c6={'raw':!![],'where':{'id':_0x1622d1[_0x3581('0x45')]['id']}},_0x2f5e7c={};_0x2f5e7c[_0x3581('0x2e')]=_[_0x3581('0x46')](db[_0x3581('0x3d')][_0x3581('0x2b')]);_0x2f5e7c[_0x3581('0x2f')]=_['keys'](_0x1622d1[_0x3581('0x2f')]);_0x2f5e7c[_0x3581('0x30')]=_[_0x3581('0x31')](_0x2f5e7c[_0x3581('0x2e')],_0x2f5e7c['query']);_0x2f72c6[_0x3581('0x32')]=_[_0x3581('0x31')](_0x2f5e7c[_0x3581('0x2e')],qs['fields'](_0x1622d1[_0x3581('0x2f')][_0x3581('0x33')]));_0x2f72c6[_0x3581('0x32')]=_0x2f72c6['attributes'][_0x3581('0x34')]?_0x2f72c6[_0x3581('0x32')]:_0x2f5e7c['model'];if(_0x1622d1[_0x3581('0x2f')]['includeAll']){_0x2f72c6[_0x3581('0x40')]=[{'all':!![]}];}_0x2f72c6=_['merge']({},_0x2f72c6,_0x1622d1[_0x3581('0x47')]);return db[_0x3581('0x3d')][_0x3581('0x48')](_0x2f72c6)[_0x3581('0x26')](handleEntityNotFound(_0x2f27af,null))[_0x3581('0x26')](respondWithResult(_0x2f27af,null))[_0x3581('0x43')](handleError(_0x2f27af,null));};exports[_0x3581('0x49')]=function(_0x54a906,_0x52f40b){return db[_0x3581('0x3d')][_0x3581('0x49')](_0x54a906[_0x3581('0x4a')],{})[_0x3581('0x26')](respondWithResult(_0x52f40b,0xc9))['catch'](handleError(_0x52f40b,null));};exports[_0x3581('0x25')]=function(_0x4261b2,_0x1b29db){if(_0x4261b2[_0x3581('0x4a')]['id']){delete _0x4261b2['body']['id'];}return db['SalesforceField']['find']({'where':{'id':_0x4261b2[_0x3581('0x45')]['id']}})[_0x3581('0x26')](handleEntityNotFound(_0x1b29db,null))['then'](saveUpdates(_0x4261b2['body'],null))[_0x3581('0x26')](respondWithResult(_0x1b29db,null))[_0x3581('0x43')](handleError(_0x1b29db,null));};exports[_0x3581('0x27')]=function(_0x153af9,_0x2f16d9){return db[_0x3581('0x3d')]['find']({'where':{'id':_0x153af9[_0x3581('0x45')]['id']}})['then'](handleEntityNotFound(_0x2f16d9,null))[_0x3581('0x26')](removeEntity(_0x2f16d9,null))['catch'](handleError(_0x2f16d9,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 775e286..554981e 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 _0xa3fa=['util','../../config/logger','api','moment','bluebird','rimraf','./intSalesforceField.attributes','exports','define','int_salesforce_fields','idField','lodash'];(function(_0x525c25,_0x362fc4){var _0x39c3f2=function(_0x3799de){while(--_0x3799de){_0x525c25['push'](_0x525c25['shift']());}};_0x39c3f2(++_0x362fc4);}(_0xa3fa,0x1af));var _0xaa3f=function(_0x12a3d7,_0xb16e76){_0x12a3d7=_0x12a3d7-0x0;var _0x23612a=_0xa3fa[_0x12a3d7];return _0x23612a;};'use strict';var _=require(_0xaa3f('0x0'));var util=require(_0xaa3f('0x1'));var logger=require(_0xaa3f('0x2'))(_0xaa3f('0x3'));var moment=require(_0xaa3f('0x4'));var BPromise=require(_0xaa3f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xaa3f('0x6'));var config=require('../../config/environment');var attributes=require(_0xaa3f('0x7'));module[_0xaa3f('0x8')]=function(_0x4cc006,_0x3579a8){return _0x4cc006[_0xaa3f('0x9')]('SalesforceField',attributes,{'tableName':_0xaa3f('0xa'),'paranoid':![],'indexes':[{'name':'salesforce_unique_index','fields':[_0xaa3f('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7c24=['path','rimraf','../../config/environment','./intSalesforceField.attributes','exports','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','FieldId','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x25a39b,_0x332db9){var _0x47af24=function(_0x29bb18){while(--_0x29bb18){_0x25a39b['push'](_0x25a39b['shift']());}};_0x47af24(++_0x332db9);}(_0x7c24,0x181));var _0x47c2=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0x7c24[_0x2dadb9];return _0x2f0097;};'use strict';var _=require('lodash');var util=require(_0x47c2('0x0'));var logger=require(_0x47c2('0x1'))('api');var moment=require(_0x47c2('0x2'));var BPromise=require(_0x47c2('0x3'));var rp=require(_0x47c2('0x4'));var fs=require('fs');var path=require(_0x47c2('0x5'));var rimraf=require(_0x47c2('0x6'));var config=require(_0x47c2('0x7'));var attributes=require(_0x47c2('0x8'));module[_0x47c2('0x9')]=function(_0x2579a7,_0x38604c){return _0x2579a7['define'](_0x47c2('0xa'),attributes,{'tableName':_0x47c2('0xb'),'paranoid':![],'indexes':[{'name':_0x47c2('0xc'),'fields':[_0x47c2('0xd'),_0x47c2('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index 01aff29..847d45b 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 _0xb5a5=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x8a8097,_0x49786e){var _0x3472d1=function(_0x143b44){while(--_0x143b44){_0x8a8097['push'](_0x8a8097['shift']());}};_0x3472d1(++_0x49786e);}(_0xb5a5,0x126));var _0x5b5a=function(_0x14eae2,_0x221a17){_0x14eae2=_0x14eae2-0x0;var _0x19e250=_0xb5a5[_0x14eae2];return _0x19e250;};'use strict';var _=require('lodash');var util=require(_0x5b5a('0x0'));var moment=require(_0x5b5a('0x1'));var BPromise=require(_0x5b5a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5b5a('0x3'));var db=require(_0x5b5a('0x4'))['db'];var utils=require(_0x5b5a('0x5'));var logger=require(_0x5b5a('0x6'))('rpc');var config=require(_0x5b5a('0x7'));var jayson=require(_0x5b5a('0x8'));var client=jayson[_0x5b5a('0x9')][_0x5b5a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4a4dcf,_0xf85316,_0x192551){return new BPromise(function(_0x421d5d,_0x11ab69){return client[_0x5b5a('0xb')](_0x4a4dcf,_0x192551)[_0x5b5a('0xc')](function(_0x162254){logger[_0x5b5a('0xd')](_0x5b5a('0xe'),_0xf85316,_0x5b5a('0xf'));logger[_0x5b5a('0x10')](_0x5b5a('0x11'),_0xf85316,_0x5b5a('0xf'),JSON[_0x5b5a('0x12')](_0x162254));if(_0x162254[_0x5b5a('0x13')]){if(_0x162254[_0x5b5a('0x13')][_0x5b5a('0x14')]===0x1f4){logger[_0x5b5a('0x13')]('SalesforceField,\x20%s,\x20%s',_0xf85316,_0x162254['error']['message']);return _0x11ab69(_0x162254[_0x5b5a('0x13')][_0x5b5a('0x15')]);}logger[_0x5b5a('0x13')](_0x5b5a('0xe'),_0xf85316,_0x162254[_0x5b5a('0x13')][_0x5b5a('0x15')]);return _0x421d5d(_0x162254[_0x5b5a('0x13')][_0x5b5a('0x15')]);}else{logger[_0x5b5a('0xd')]('SalesforceField,\x20%s,\x20%s',_0xf85316,_0x5b5a('0xf'));_0x421d5d(_0x162254[_0x5b5a('0x16')]['message']);}})['catch'](function(_0xd213dd){logger[_0x5b5a('0x13')]('SalesforceField,\x20%s,\x20%s',_0xf85316,_0xd213dd);_0x11ab69(_0xd213dd);});});} \ No newline at end of file +var _0xe40d=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','error','message','info','catch','lodash','bluebird','randomstring'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xe40d,0xe4));var _0xde40=function(_0x3b7bac,_0x4126af){_0x3b7bac=_0x3b7bac-0x0;var _0x59d623=_0xe40d[_0x3b7bac];return _0x59d623;};'use strict';var _=require(_0xde40('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xde40('0x1'));var rs=require(_0xde40('0x2'));var fs=require('fs');var Redis=require(_0xde40('0x3'));var db=require(_0xde40('0x4'))['db'];var utils=require(_0xde40('0x5'));var logger=require(_0xde40('0x6'))(_0xde40('0x7'));var config=require(_0xde40('0x8'));var jayson=require(_0xde40('0x9'));var client=jayson[_0xde40('0xa')][_0xde40('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3b3e4e,_0x572881,_0x1e1f91){return new BPromise(function(_0x3ca290,_0x45bb35){return client[_0xde40('0xc')](_0x3b3e4e,_0x1e1f91)['then'](function(_0x499d49){logger['info'](_0xde40('0xd'),_0x572881,_0xde40('0xe'));logger[_0xde40('0xf')](_0xde40('0x10'),_0x572881,_0xde40('0xe'),JSON['stringify'](_0x499d49));if(_0x499d49[_0xde40('0x11')]){if(_0x499d49[_0xde40('0x11')]['code']===0x1f4){logger[_0xde40('0x11')]('SalesforceField,\x20%s,\x20%s',_0x572881,_0x499d49[_0xde40('0x11')][_0xde40('0x12')]);return _0x45bb35(_0x499d49['error']['message']);}logger[_0xde40('0x11')]('SalesforceField,\x20%s,\x20%s',_0x572881,_0x499d49[_0xde40('0x11')][_0xde40('0x12')]);return _0x3ca290(_0x499d49[_0xde40('0x11')][_0xde40('0x12')]);}else{logger[_0xde40('0x13')](_0xde40('0xd'),_0x572881,_0xde40('0xe'));_0x3ca290(_0x499d49['result'][_0xde40('0x12')]);}})[_0xde40('0x14')](function(_0x2c678b){logger[_0xde40('0x11')](_0xde40('0xd'),_0x572881,_0x2c678b);_0x45bb35(_0x2c678b);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 0979ad2..4b4484a 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 _0x6b7b=['destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','/:id','update'];(function(_0x571e42,_0x5f1232){var _0x5339a2=function(_0x174b4d){while(--_0x174b4d){_0x571e42['push'](_0x571e42['shift']());}};_0x5339a2(++_0x5f1232);}(_0x6b7b,0xe7));var _0xb6b7=function(_0xd60a07,_0x2cd529){_0xd60a07=_0xd60a07-0x0;var _0xac5735=_0x6b7b[_0xd60a07];return _0xac5735;};'use strict';var multer=require(_0xb6b7('0x0'));var util=require(_0xb6b7('0x1'));var path=require(_0xb6b7('0x2'));var timeout=require(_0xb6b7('0x3'));var express=require(_0xb6b7('0x4'));var router=express['Router']();var fs_extra=require(_0xb6b7('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb6b7('0x6'));var config=require(_0xb6b7('0x7'));var controller=require(_0xb6b7('0x8'));router[_0xb6b7('0x9')]('/',auth[_0xb6b7('0xa')](),controller[_0xb6b7('0xb')]);router[_0xb6b7('0x9')]('/:id',auth[_0xb6b7('0xa')](),controller[_0xb6b7('0xc')]);router[_0xb6b7('0x9')](_0xb6b7('0xd'),auth[_0xb6b7('0xa')](),controller[_0xb6b7('0xe')]);router['get'](_0xb6b7('0xf'),auth[_0xb6b7('0xa')](),controller['getFields']);router[_0xb6b7('0x10')]('/',auth[_0xb6b7('0xa')](),controller[_0xb6b7('0x11')]);router[_0xb6b7('0x10')](_0xb6b7('0xd'),auth['isAuthenticated'](),controller[_0xb6b7('0x12')]);router[_0xb6b7('0x13')](_0xb6b7('0x14'),auth['isAuthenticated'](),controller[_0xb6b7('0x15')]);router['delete'](_0xb6b7('0x14'),auth['isAuthenticated'](),controller[_0xb6b7('0x16')]);module['exports']=router; \ No newline at end of file +var _0x2d4d=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','express'];(function(_0x37cd1b,_0x4ce56a){var _0x345cd6=function(_0xe98657){while(--_0xe98657){_0x37cd1b['push'](_0x37cd1b['shift']());}};_0x345cd6(++_0x4ce56a);}(_0x2d4d,0x94));var _0xd2d4=function(_0x420e65,_0x4d594d){_0x420e65=_0x420e65-0x0;var _0x2b3288=_0x2d4d[_0x420e65];return _0x2b3288;};'use strict';var multer=require(_0xd2d4('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd2d4('0x1'));var router=express[_0xd2d4('0x2')]();var fs_extra=require(_0xd2d4('0x3'));var auth=require(_0xd2d4('0x4'));var interaction=require(_0xd2d4('0x5'));var config=require(_0xd2d4('0x6'));var controller=require(_0xd2d4('0x7'));router[_0xd2d4('0x8')]('/',auth[_0xd2d4('0x9')](),controller[_0xd2d4('0xa')]);router['get'](_0xd2d4('0xb'),auth['isAuthenticated'](),controller[_0xd2d4('0xc')]);router[_0xd2d4('0x8')](_0xd2d4('0xd'),auth[_0xd2d4('0x9')](),controller[_0xd2d4('0xe')]);router[_0xd2d4('0x8')](_0xd2d4('0xf'),auth[_0xd2d4('0x9')](),controller[_0xd2d4('0x10')]);router[_0xd2d4('0x11')]('/',auth[_0xd2d4('0x9')](),controller[_0xd2d4('0x12')]);router[_0xd2d4('0x11')](_0xd2d4('0xd'),auth[_0xd2d4('0x9')](),controller[_0xd2d4('0x13')]);router[_0xd2d4('0x14')](_0xd2d4('0xb'),auth[_0xd2d4('0x9')](),controller[_0xd2d4('0x15')]);router[_0xd2d4('0x16')](_0xd2d4('0xb'),auth[_0xd2d4('0x9')](),controller[_0xd2d4('0x17')]);module[_0xd2d4('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 e9f08dd..41c0fe5 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 _0x7b5d=['STRING','remoteUri','sequelize','exports'];(function(_0x50fcea,_0x4e239a){var _0x56cd92=function(_0x27343e){while(--_0x27343e){_0x50fcea['push'](_0x50fcea['shift']());}};_0x56cd92(++_0x4e239a);}(_0x7b5d,0x1f2));var _0xd7b5=function(_0x2db725,_0x222bc6){_0x2db725=_0x2db725-0x0;var _0x8f03ad=_0x7b5d[_0x2db725];return _0x8f03ad;};'use strict';var Sequelize=require(_0xd7b5('0x0'));module[_0xd7b5('0x1')]={'name':{'type':Sequelize[_0xd7b5('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xd7b5('0x2')],'unique':'username'},'password':{'type':Sequelize[_0xd7b5('0x2')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xd7b5('0x2')],'unique':_0xd7b5('0x3')},'serverUrl':{'type':Sequelize[_0xd7b5('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x387e=['remoteUri','exports','STRING','username'];(function(_0x272b9b,_0x19633a){var _0x4ac019=function(_0x46f2c2){while(--_0x46f2c2){_0x272b9b['push'](_0x272b9b['shift']());}};_0x4ac019(++_0x19633a);}(_0x387e,0x71));var _0xe387=function(_0x231dda,_0x5b04cc){_0x231dda=_0x231dda-0x0;var _0x3f88cb=_0x387e[_0x231dda];return _0x3f88cb;};'use strict';var Sequelize=require('sequelize');module[_0xe387('0x0')]={'name':{'type':Sequelize[_0xe387('0x1')]},'description':{'type':Sequelize[_0xe387('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0xe387('0x2')},'password':{'type':Sequelize[_0xe387('0x1')]},'email':{'type':Sequelize[_0xe387('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xe387('0x3')},'serverUrl':{'type':Sequelize[_0xe387('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 4a2c30e..7ec3827 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 _0x1f8c=['reject','save','update','then','sendStatus','error','stack','name','index','map','ServicenowAccount','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','findAll','rows','show','params','keys','rawAttributes','include','find','catch','create','body','destroy','getConfigurations','findOne','ServicenowConfiguration','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','ServicenowField','Subjects','getFields','made_sla','hold_reason','subcategory','close_code','notify','incident_state','severity','category','parent','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','approval_history','number','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','state','knowledge','calendar_stc','closed_at','cmdb_ci','impact','work_notes_list','business_service','sys_domain_path','expected_start','opened_at','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','description','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','parent_incident','sys_id','reopened_by','urgency','company','comments','sla_due','approval','comments_and_work_notes','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','correlation_id','location','username','password','serverUrl','remoteUri','slice','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','result','log','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','push','all','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','label','concat','statusCode','send','test','True','False','false','sys_choice?sysparm_query=name=incident^element=','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','end','status','json','offset','undefined','limit','count','set','Content-Range','apply'];(function(_0x4a0f16,_0x21ba18){var _0x45d653=function(_0x137e2c){while(--_0x137e2c){_0x4a0f16['push'](_0x4a0f16['shift']());}};_0x45d653(++_0x21ba18);}(_0x1f8c,0x9c));var _0xc1f8=function(_0x363ef8,_0x4ecb1a){_0x363ef8=_0x363ef8-0x0;var _0x148822=_0x1f8c[_0x363ef8];return _0x148822;};'use strict';var emlformat=require(_0xc1f8('0x0'));var rimraf=require(_0xc1f8('0x1'));var zipdir=require(_0xc1f8('0x2'));var jsonpatch=require(_0xc1f8('0x3'));var rp=require('request-promise');var moment=require(_0xc1f8('0x4'));var BPromise=require(_0xc1f8('0x5'));var Mustache=require(_0xc1f8('0x6'));var util=require(_0xc1f8('0x7'));var path=require(_0xc1f8('0x8'));var sox=require(_0xc1f8('0x9'));var csv=require(_0xc1f8('0xa'));var ejs=require(_0xc1f8('0xb'));var fs=require('fs');var fs_extra=require(_0xc1f8('0xc'));var _=require(_0xc1f8('0xd'));var squel=require(_0xc1f8('0xe'));var crypto=require(_0xc1f8('0xf'));var jsforce=require(_0xc1f8('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xc1f8('0xa'));var querystring=require(_0xc1f8('0x11'));var Papa=require('papaparse');var Redis=require(_0xc1f8('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc1f8('0x13'));var logger=require(_0xc1f8('0x14'))(_0xc1f8('0x15'));var utils=require('../../config/utils');var config=require(_0xc1f8('0x16'));var licenseUtil=require(_0xc1f8('0x17'));var db=require(_0xc1f8('0x18'))['db'];var integrations=require(_0xc1f8('0x19'));function respondWithStatusCode(_0x212457,_0x213be0){_0x213be0=_0x213be0||0xcc;return function(_0x2803c7){if(_0x2803c7){return _0x212457['sendStatus'](_0x213be0);}return _0x212457['status'](_0x213be0)[_0xc1f8('0x1a')]();};}function respondWithResult(_0xfc5c9a,_0xb6cbf8){_0xb6cbf8=_0xb6cbf8||0xc8;return function(_0x172370){if(_0x172370){return _0xfc5c9a[_0xc1f8('0x1b')](_0xb6cbf8)[_0xc1f8('0x1c')](_0x172370);}};}function respondWithFilteredResult(_0x88c112,_0x107ae5){return function(_0x3adcba){if(_0x3adcba){var _0x34ceeb=typeof _0x107ae5[_0xc1f8('0x1d')]===_0xc1f8('0x1e')&&typeof _0x107ae5[_0xc1f8('0x1f')]===_0xc1f8('0x1e');var _0x55e44f=_0x3adcba[_0xc1f8('0x20')];var _0x2d4bef=_0x34ceeb?0x0:_0x107ae5['offset'];var _0x2fd490=_0x34ceeb?_0x3adcba[_0xc1f8('0x20')]:_0x107ae5[_0xc1f8('0x1d')]+_0x107ae5[_0xc1f8('0x1f')];var _0x14aa27;if(_0x2fd490>=_0x55e44f){_0x2fd490=_0x55e44f;_0x14aa27=0xc8;}else{_0x14aa27=0xce;}_0x88c112[_0xc1f8('0x1b')](_0x14aa27);return _0x88c112[_0xc1f8('0x21')](_0xc1f8('0x22'),_0x2d4bef+'-'+_0x2fd490+'/'+_0x55e44f)[_0xc1f8('0x1c')](_0x3adcba);}return null;};}function patchUpdates(_0x19e35e){return function(_0x33a03e){try{jsonpatch[_0xc1f8('0x23')](_0x33a03e,_0x19e35e,!![]);}catch(_0x334c3a){return BPromise[_0xc1f8('0x24')](_0x334c3a);}return _0x33a03e[_0xc1f8('0x25')]();};}function saveUpdates(_0x20e9b7,_0x21dcf9){return function(_0x5428ed){if(_0x5428ed){return _0x5428ed[_0xc1f8('0x26')](_0x20e9b7)[_0xc1f8('0x27')](function(_0x317209){return _0x317209;});}return null;};}function removeEntity(_0x16cfa0,_0x2cbc61){return function(_0x6ab1d0){if(_0x6ab1d0){return _0x6ab1d0['destroy']()['then'](function(){_0x16cfa0[_0xc1f8('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x573d3f,_0x3b37e8){return function(_0x5ba5c2){if(!_0x5ba5c2){_0x573d3f[_0xc1f8('0x28')](0x194);}return _0x5ba5c2;};}function handleError(_0x1c9434,_0x2149f5){_0x2149f5=_0x2149f5||0x1f4;return function(_0x12ecb7){logger[_0xc1f8('0x29')](_0x12ecb7[_0xc1f8('0x2a')]);if(_0x12ecb7[_0xc1f8('0x2b')]){delete _0x12ecb7[_0xc1f8('0x2b')];}_0x1c9434['status'](_0x2149f5)['send'](_0x12ecb7);};}exports[_0xc1f8('0x2c')]=function(_0x1df1fd,_0x3b594b){var _0x39749a={},_0x42661b={},_0x1258d6={'count':0x0,'rows':[]};var _0x1518bf=_[_0xc1f8('0x2d')](db[_0xc1f8('0x2e')]['rawAttributes'],function(_0x333244){return{'name':_0x333244[_0xc1f8('0x2f')],'type':_0x333244[_0xc1f8('0x30')][_0xc1f8('0x31')]};});_0x42661b[_0xc1f8('0x32')]=_[_0xc1f8('0x2d')](_0x1518bf,_0xc1f8('0x2b'));_0x42661b['query']=_['keys'](_0x1df1fd[_0xc1f8('0x33')]);_0x42661b[_0xc1f8('0x34')]=_[_0xc1f8('0x35')](_0x42661b[_0xc1f8('0x32')],_0x42661b[_0xc1f8('0x33')]);_0x39749a[_0xc1f8('0x36')]=_[_0xc1f8('0x35')](_0x42661b[_0xc1f8('0x32')],qs['fields'](_0x1df1fd[_0xc1f8('0x33')][_0xc1f8('0x37')]));_0x39749a[_0xc1f8('0x36')]=_0x39749a[_0xc1f8('0x36')][_0xc1f8('0x38')]?_0x39749a[_0xc1f8('0x36')]:_0x42661b[_0xc1f8('0x32')];if(!_0x1df1fd[_0xc1f8('0x33')][_0xc1f8('0x39')](_0xc1f8('0x3a'))){_0x39749a['limit']=qs['limit'](_0x1df1fd['query'][_0xc1f8('0x1f')]);_0x39749a['offset']=qs[_0xc1f8('0x1d')](_0x1df1fd[_0xc1f8('0x33')]['offset']);}_0x39749a[_0xc1f8('0x3b')]=qs['sort'](_0x1df1fd[_0xc1f8('0x33')][_0xc1f8('0x3c')]);_0x39749a[_0xc1f8('0x3d')]=qs[_0xc1f8('0x34')](_[_0xc1f8('0x3e')](_0x1df1fd['query'],_0x42661b[_0xc1f8('0x34')]),_0x1518bf);if(_0x1df1fd[_0xc1f8('0x33')]['filter']){_0x39749a[_0xc1f8('0x3d')]=_['merge'](_0x39749a[_0xc1f8('0x3d')],{'$or':_[_0xc1f8('0x2d')](_0x1518bf,function(_0x3226cc){if(_0x3226cc[_0xc1f8('0x30')]!==_0xc1f8('0x3f')){var _0x55242b={};_0x55242b[_0x3226cc[_0xc1f8('0x2b')]]={'$like':'%'+_0x1df1fd[_0xc1f8('0x33')][_0xc1f8('0x40')]+'%'};return _0x55242b;}})});}_0x39749a=_[_0xc1f8('0x41')]({},_0x39749a,_0x1df1fd[_0xc1f8('0x42')]);var _0x598383={'where':_0x39749a[_0xc1f8('0x3d')]};return db[_0xc1f8('0x2e')]['count'](_0x598383)['then'](function(_0xb07713){_0x1258d6['count']=_0xb07713;if(_0x1df1fd[_0xc1f8('0x33')][_0xc1f8('0x43')]){_0x39749a['include']=[{'all':!![]}];}return db[_0xc1f8('0x2e')][_0xc1f8('0x44')](_0x39749a);})[_0xc1f8('0x27')](function(_0x49a643){_0x1258d6[_0xc1f8('0x45')]=_0x49a643;return _0x1258d6;})['then'](respondWithFilteredResult(_0x3b594b,_0x39749a))['catch'](handleError(_0x3b594b,null));};exports[_0xc1f8('0x46')]=function(_0x210aad,_0x195d58){var _0x127224={'raw':![],'where':{'id':_0x210aad[_0xc1f8('0x47')]['id']}},_0x3a2524={};_0x3a2524[_0xc1f8('0x32')]=_[_0xc1f8('0x48')](db['ServicenowAccount'][_0xc1f8('0x49')]);_0x3a2524['query']=_[_0xc1f8('0x48')](_0x210aad[_0xc1f8('0x33')]);_0x3a2524[_0xc1f8('0x34')]=_[_0xc1f8('0x35')](_0x3a2524[_0xc1f8('0x32')],_0x3a2524['query']);_0x127224['attributes']=_['intersection'](_0x3a2524[_0xc1f8('0x32')],qs[_0xc1f8('0x37')](_0x210aad[_0xc1f8('0x33')]['fields']));_0x127224[_0xc1f8('0x36')]=_0x127224[_0xc1f8('0x36')]['length']?_0x127224[_0xc1f8('0x36')]:_0x3a2524['model'];if(_0x210aad['query']['includeAll']){_0x127224[_0xc1f8('0x4a')]=[{'all':!![]}];}_0x127224=_[_0xc1f8('0x41')]({},_0x127224,_0x210aad[_0xc1f8('0x42')]);return db['ServicenowAccount'][_0xc1f8('0x4b')](_0x127224)[_0xc1f8('0x27')](handleEntityNotFound(_0x195d58,null))[_0xc1f8('0x27')](respondWithResult(_0x195d58,null))[_0xc1f8('0x4c')](handleError(_0x195d58,null));};exports[_0xc1f8('0x4d')]=function(_0x37dc07,_0x227bd7){return db['ServicenowAccount'][_0xc1f8('0x4d')](_0x37dc07['body'],{})['then'](respondWithResult(_0x227bd7,0xc9))[_0xc1f8('0x4c')](handleError(_0x227bd7,null));};exports[_0xc1f8('0x26')]=function(_0x3ba171,_0x54e8c2){if(_0x3ba171['body']['id']){delete _0x3ba171[_0xc1f8('0x4e')]['id'];}return db[_0xc1f8('0x2e')][_0xc1f8('0x4b')]({'where':{'id':_0x3ba171[_0xc1f8('0x47')]['id']}})[_0xc1f8('0x27')](handleEntityNotFound(_0x54e8c2,null))[_0xc1f8('0x27')](saveUpdates(_0x3ba171[_0xc1f8('0x4e')],null))[_0xc1f8('0x27')](respondWithResult(_0x54e8c2,null))[_0xc1f8('0x4c')](handleError(_0x54e8c2,null));};exports[_0xc1f8('0x4f')]=function(_0x128b9d,_0x2eb6a4){return db[_0xc1f8('0x2e')][_0xc1f8('0x4b')]({'where':{'id':_0x128b9d[_0xc1f8('0x47')]['id']}})['then'](handleEntityNotFound(_0x2eb6a4,null))[_0xc1f8('0x27')](removeEntity(_0x2eb6a4,null))[_0xc1f8('0x4c')](handleError(_0x2eb6a4,null));};exports[_0xc1f8('0x50')]=function(_0x2177fc,_0x599b58,_0x59699c){var _0xf16f08={};var _0x5e692f={};var _0x63c352;var _0x19abd0;return db[_0xc1f8('0x2e')][_0xc1f8('0x51')]({'where':{'id':_0x2177fc[_0xc1f8('0x47')]['id']}})[_0xc1f8('0x27')](handleEntityNotFound(_0x599b58,null))[_0xc1f8('0x27')](function(_0x19ad41){if(_0x19ad41){_0x63c352=_0x19ad41;_0x5e692f[_0xc1f8('0x32')]=_['keys'](db[_0xc1f8('0x52')][_0xc1f8('0x49')]);_0x5e692f[_0xc1f8('0x33')]=_['keys'](_0x2177fc[_0xc1f8('0x33')]);_0x5e692f[_0xc1f8('0x34')]=_[_0xc1f8('0x35')](_0x5e692f[_0xc1f8('0x32')],_0x5e692f[_0xc1f8('0x33')]);_0xf16f08[_0xc1f8('0x36')]=_['intersection'](_0x5e692f[_0xc1f8('0x32')],qs[_0xc1f8('0x37')](_0x2177fc[_0xc1f8('0x33')][_0xc1f8('0x37')]));_0xf16f08[_0xc1f8('0x36')]=_0xf16f08['attributes'][_0xc1f8('0x38')]?_0xf16f08[_0xc1f8('0x36')]:_0x5e692f[_0xc1f8('0x32')];_0xf16f08[_0xc1f8('0x3b')]=qs['sort'](_0x2177fc[_0xc1f8('0x33')][_0xc1f8('0x3c')]);_0xf16f08[_0xc1f8('0x3d')]=qs[_0xc1f8('0x34')](_[_0xc1f8('0x3e')](_0x2177fc[_0xc1f8('0x33')],_0x5e692f[_0xc1f8('0x34')]));if(_0x2177fc[_0xc1f8('0x33')][_0xc1f8('0x40')]){_0xf16f08[_0xc1f8('0x3d')]=_[_0xc1f8('0x41')](_0xf16f08['where'],{'$or':_[_0xc1f8('0x2d')](_0xf16f08[_0xc1f8('0x36')],function(_0x5177d0){var _0x5ba21f={};_0x5ba21f[_0x5177d0]={'$like':'%'+_0x2177fc[_0xc1f8('0x33')][_0xc1f8('0x40')]+'%'};return _0x5ba21f;})});}_0xf16f08=_[_0xc1f8('0x41')]({},_0xf16f08,_0x2177fc['options']);return _0x63c352[_0xc1f8('0x50')](_0xf16f08);}})[_0xc1f8('0x27')](function(_0x5730db){if(_0x5730db){_0x19abd0=_0x5730db[_0xc1f8('0x38')];if(!_0x2177fc[_0xc1f8('0x33')]['hasOwnProperty'](_0xc1f8('0x3a'))){_0xf16f08[_0xc1f8('0x1f')]=qs['limit'](_0x2177fc[_0xc1f8('0x33')]['limit']);_0xf16f08[_0xc1f8('0x1d')]=qs[_0xc1f8('0x1d')](_0x2177fc[_0xc1f8('0x33')][_0xc1f8('0x1d')]);}return _0x63c352[_0xc1f8('0x50')](_0xf16f08);}})['then'](function(_0x3cba4f){if(_0x3cba4f){return _0x3cba4f?{'count':_0x19abd0,'rows':_0x3cba4f}:null;}})['then'](respondWithResult(_0x599b58,null))[_0xc1f8('0x4c')](handleError(_0x599b58,null));};exports[_0xc1f8('0x53')]=function(_0x554481,_0x4fb7be,_0x592485){if(_0x554481[_0xc1f8('0x4e')]['id']){delete _0x554481['body']['id'];}return db['ServicenowAccount'][_0xc1f8('0x51')]({'where':{'id':_0x554481['params']['id']}})[_0xc1f8('0x27')](handleEntityNotFound(_0x4fb7be,null))['then'](function(_0x5dcf45){if(_0x5dcf45){_0x554481[_0xc1f8('0x4e')][_0xc1f8('0x54')]=_0x5dcf45['id'];_0x554481['body']['Subjects']=integrations[_0xc1f8('0x55')](_0x554481['body'][_0xc1f8('0x56')],_0x554481[_0xc1f8('0x4e')][_0xc1f8('0x30')]);_0x554481['body'][_0xc1f8('0x57')]=integrations[_0xc1f8('0x58')](_0x554481['body'][_0xc1f8('0x56')],_0x554481[_0xc1f8('0x4e')][_0xc1f8('0x30')]);return db['ServicenowConfiguration'][_0xc1f8('0x4d')](_0x554481[_0xc1f8('0x4e')],{'include':[{'model':db[_0xc1f8('0x59')],'as':_0xc1f8('0x5a')},{'model':db[_0xc1f8('0x59')],'as':_0xc1f8('0x57')}]});}return null;})['then'](respondWithResult(_0x4fb7be,null))['catch'](handleError(_0x4fb7be,null));};exports[_0xc1f8('0x5b')]=function(_0x170985,_0x4bd8e8,_0x2f9d6d){var _0x8ab523=[_0xc1f8('0x5c'),_0xc1f8('0x5d'),'knowledge',_0xc1f8('0x5e'),_0xc1f8('0x5f'),_0xc1f8('0x60'),_0xc1f8('0x61'),_0xc1f8('0x62'),_0xc1f8('0x63')];var _0x4fc347=[_0xc1f8('0x64'),_0xc1f8('0x5c'),_0xc1f8('0x65'),_0xc1f8('0x66'),_0xc1f8('0x67'),_0xc1f8('0x68'),_0xc1f8('0x69'),_0xc1f8('0x5d'),_0xc1f8('0x6a'),_0xc1f8('0x6b'),_0xc1f8('0x6c'),_0xc1f8('0x6d'),_0xc1f8('0x6e'),_0xc1f8('0x6f'),_0xc1f8('0x70'),_0xc1f8('0x71'),_0xc1f8('0x72'),'sys_created_by',_0xc1f8('0x73'),_0xc1f8('0x3b'),_0xc1f8('0x74'),_0xc1f8('0x75'),_0xc1f8('0x76'),'delivery_plan',_0xc1f8('0x77'),'active',_0xc1f8('0x78'),_0xc1f8('0x79'),'priority',_0xc1f8('0x7a'),'rfc','time_worked',_0xc1f8('0x7b'),_0xc1f8('0x7c'),_0xc1f8('0x7d'),_0xc1f8('0x7e'),_0xc1f8('0x7f'),_0xc1f8('0x80'),_0xc1f8('0x81'),_0xc1f8('0x82'),_0xc1f8('0x83'),_0xc1f8('0x5e'),_0xc1f8('0x84'),_0xc1f8('0x85'),'close_code','correlation_display',_0xc1f8('0x86'),_0xc1f8('0x87'),_0xc1f8('0x88'),_0xc1f8('0x89'),_0xc1f8('0x8a'),_0xc1f8('0x8b'),_0xc1f8('0x8c'),'notify',_0xc1f8('0x8d'),_0xc1f8('0x8e'),_0xc1f8('0x8f'),_0xc1f8('0x90'),_0xc1f8('0x91'),_0xc1f8('0x92'),'contact_type',_0xc1f8('0x93'),_0xc1f8('0x61'),_0xc1f8('0x94'),'problem_id',_0xc1f8('0x95'),'reassignment_count','activity_due','assigned_to',_0xc1f8('0x62'),_0xc1f8('0x96'),_0xc1f8('0x97'),_0xc1f8('0x98'),_0xc1f8('0x99'),'due_date',_0xc1f8('0x9a'),_0xc1f8('0x9b'),_0xc1f8('0x9c'),_0xc1f8('0x9d'),_0xc1f8('0x9e'),_0xc1f8('0x9f'),_0xc1f8('0xa0'),_0xc1f8('0x63')];var _0x50d218='';var _0x5b2285='';var _0x2a1c3e=[];var _0x4f5aa5='';var _0x49ba09='';var _0xc17140=[];var _0xe8d037='';var _0x68a440='';var _0x4e93c5={};var _0x4e62f1='';return db['ServicenowAccount'][_0xc1f8('0x51')]({'where':{'id':_0x170985[_0xc1f8('0x47')]['id']},'attributes':['id',_0xc1f8('0xa1'),_0xc1f8('0xa2'),'email','remoteUri',_0xc1f8('0xa3')]})[_0xc1f8('0x27')](handleEntityNotFound(_0x4bd8e8,null))[_0xc1f8('0x27')](function(_0x13f272){if(_0x13f272){_0x4e62f1=_0x13f272[_0xc1f8('0xa4')];var _0xd4cf74=_0x4e62f1[_0xc1f8('0xa5')](-0x1);if(_0xd4cf74==='/'){_0x4e62f1=_0x4e62f1['substring'](0x0,_0x4e62f1[_0xc1f8('0xa6')](_0xd4cf74));}_0x68a440=util[_0xc1f8('0xa7')](_0xc1f8('0xa8'),_0x4e62f1);_0xe8d037=util[_0xc1f8('0xa7')](_0xc1f8('0xa9'),_0x4e62f1);_0x4e93c5={'user':_0x13f272[_0xc1f8('0xa1')],'pass':_0x13f272[_0xc1f8('0xa2')]};var _0x5f5c36={'method':_0xc1f8('0xaa'),'uri':_0x68a440+'incident?sysparm_display_value=all','auth':_0x4e93c5,'json':!![]};return rp(_0x5f5c36);}})[_0xc1f8('0x27')](function(_0x462b38){if(_0x462b38['result'][_0xc1f8('0x38')]>0x0){_0x50d218=_0x462b38[_0xc1f8('0xab')];}console[_0xc1f8('0xac')](_0xc1f8('0xad'),_0x50d218);_0xc17140=[];_0x5b2285=Object[_0xc1f8('0xae')]([],_0x50d218);_[_0xc1f8('0xaf')](_0x5b2285,function(_0x4deaff){return!_0x8ab523[_0xc1f8('0xb0')](_0x4deaff['name']);});_0x5b2285[_0xc1f8('0xb1')](function(_0x2bba74){var _0x19bf0c=createFieldObject(_0xe8d037,_0x4e93c5,_0x2bba74[_0xc1f8('0xb2')],_0x2bba74[_0xc1f8('0x2b')],_0x2bba74['label'],![]);_0xc17140[_0xc1f8('0xb3')](_0x19bf0c);});return Promise[_0xc1f8('0xb4')](_0xc17140);})[_0xc1f8('0x27')](function(_0x19a526){_0x2a1c3e=_0x19a526;_0x4f5aa5=Object[_0xc1f8('0xae')]([],_0x50d218);console['log'](_0xc1f8('0xb5'),_0x50d218);_[_0xc1f8('0xaf')](_0x4f5aa5,function(_0x30f5ee){return _0x4fc347[_0xc1f8('0xb0')](_0x30f5ee[_0xc1f8('0x2b')]);});console[_0xc1f8('0xac')](_0xc1f8('0xb6'),_0x4f5aa5);_0xc17140=[];_0x4f5aa5[_0xc1f8('0xb1')](function(_0x1b283a){var _0x2c27c2=createFieldObject(_0xe8d037,_0x4e93c5,_0x1b283a[_0xc1f8('0xb2')],_0x1b283a[_0xc1f8('0x2b')],_0x1b283a[_0xc1f8('0xb7')],!![]);_0xc17140[_0xc1f8('0xb3')](_0x2c27c2);});return Promise[_0xc1f8('0xb4')](_0xc17140);})[_0xc1f8('0x27')](function(_0x9ac159){_0x49ba09=_0x9ac159;var _0x3a8c2a=_0x2a1c3e[_0xc1f8('0xb8')](_0x49ba09);return{'count':_0x3a8c2a[_0xc1f8('0x38')],'rows':_0x3a8c2a};})[_0xc1f8('0x27')](respondWithResult(_0x4bd8e8,null))[_0xc1f8('0x4c')](function(_0x4cce46){console[_0xc1f8('0xac')]('ServiceNow\x20error:\x20'+_0x4cce46);var _0x48380a=_0x170985[_0xc1f8('0x33')]['test']?0x1f4:_0x4cce46[_0xc1f8('0xb9')]||0x1f4;logger[_0xc1f8('0x29')](_0x4cce46[_0xc1f8('0x2a')]);delete _0x4cce46[_0xc1f8('0x2b')];if(_0x48380a===0x191){_0x48380a=0x190;}_0x4bd8e8[_0xc1f8('0x1b')](_0x48380a)[_0xc1f8('0xba')](_0x170985[_0xc1f8('0x33')][_0xc1f8('0xbb')]?{'message':'Wrong\x20credentials','statusCode':_0x4cce46[_0xc1f8('0xb9')]}:_0x4cce46);});};function createFieldObject(_0x201c07,_0x1facdc,_0x3e21f7,_0x26c25c,_0x3b41f4,_0x5e25ab){return new Promise(function(_0x216387,_0x14c5a4){var _0x22690b={'id':_0x26c25c,'name':_0x3b41f4,'custom':_0x5e25ab};if(_0x3e21f7==='boolean'){_0x22690b[_0xc1f8('0x42')]=[{'name':_0xc1f8('0xbc'),'value':'true'},{'name':_0xc1f8('0xbd'),'value':_0xc1f8('0xbe')}];_0x216387(_0x22690b);}else{var _0x303f68={'method':_0xc1f8('0xaa'),'uri':_0x201c07+_0xc1f8('0xbf')+_0x26c25c,'auth':_0x1facdc,'json':!![]};return rp(_0x303f68)[_0xc1f8('0x27')](function(_0x43a038){var _0x1e90e1=[];if(_0x43a038[_0xc1f8('0xab')][_0xc1f8('0x38')]>0x0){_0x43a038[_0xc1f8('0xab')]['forEach'](function(_0x4d766c){if(_0x4d766c['inactive']===_0xc1f8('0xbe')){var _0x362c93={'name':_0x4d766c['label'],'value':_0x4d766c['value']};_0x1e90e1[_0xc1f8('0xb3')](_0x362c93);}});}_0x22690b[_0xc1f8('0x42')]=_0x1e90e1;if(_0x22690b[_0xc1f8('0x42')][_0xc1f8('0x38')]>0x0){_0x216387(_0x22690b);}else{if(_0x5e25ab==![]){_0x216387();}else{_0x216387(_0x22690b);}}});}});} \ No newline at end of file +var _0xeffe=['filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','params','rawAttributes','keys','find','create','body','getConfigurations','findOne','sort','length','addConfiguration','AccountId','Subjects','Descriptions','getDescriptions','channel','ServicenowField','getFields','hold_reason','knowledge','subcategory','close_code','notify','incident_state','severity','category','parent','made_sla','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','resolved_by','sys_updated_by','user_input','sys_created_on','sys_domain','state','sys_created_by','calendar_stc','cmdb_ci','active','priority','sys_domain_path','rfc','time_worked','opened_at','business_duration','group_list','resolved_at','caller_id','approval_set','correlation_display','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','close_notes','closed_by','follow_up','parent_incident','sys_id','contact_type','reopened_by','urgency','problem_id','company','reassignment_count','assigned_to','comments','sla_due','due_date','sys_mod_count','reopen_count','sys_tags','correlation_id','location','username','password','email','serverUrl','remoteUri','slice','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','label','push','all','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','test','statusCode','Wrong\x20credentials','boolean','True','true','False','sys_choice?sysparm_query=name=incident^element=','inactive','false','value','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','error','stack','name','send','index','ServicenowAccount','fieldName','key','map','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','where','pick'];(function(_0x55536c,_0x54aff9){var _0x92d91f=function(_0x26500c){while(--_0x26500c){_0x55536c['push'](_0x55536c['shift']());}};_0x92d91f(++_0x54aff9);}(_0xeffe,0x1ef));var _0xeeff=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0xeffe[_0x4c12ec];return _0x3ae42c;};'use strict';var emlformat=require(_0xeeff('0x0'));var rimraf=require(_0xeeff('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xeeff('0x2'));var rp=require(_0xeeff('0x3'));var moment=require(_0xeeff('0x4'));var BPromise=require(_0xeeff('0x5'));var Mustache=require(_0xeeff('0x6'));var util=require(_0xeeff('0x7'));var path=require(_0xeeff('0x8'));var sox=require(_0xeeff('0x9'));var csv=require(_0xeeff('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xeeff('0xb'));var _=require(_0xeeff('0xc'));var squel=require(_0xeeff('0xd'));var crypto=require('crypto');var jsforce=require(_0xeeff('0xe'));var deskjs=require(_0xeeff('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xeeff('0x10'));var Redis=require(_0xeeff('0x11'));var authService=require(_0xeeff('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xeeff('0x13'));var hardwareService=require(_0xeeff('0x14'));var logger=require('../../config/logger')(_0xeeff('0x15'));var utils=require(_0xeeff('0x16'));var config=require(_0xeeff('0x17'));var licenseUtil=require(_0xeeff('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0xeeff('0x19'));function respondWithStatusCode(_0x21df44,_0x3281c3){_0x3281c3=_0x3281c3||0xcc;return function(_0x242a97){if(_0x242a97){return _0x21df44[_0xeeff('0x1a')](_0x3281c3);}return _0x21df44[_0xeeff('0x1b')](_0x3281c3)[_0xeeff('0x1c')]();};}function respondWithResult(_0x375d0b,_0x3ec77d){_0x3ec77d=_0x3ec77d||0xc8;return function(_0x39d421){if(_0x39d421){return _0x375d0b['status'](_0x3ec77d)[_0xeeff('0x1d')](_0x39d421);}};}function respondWithFilteredResult(_0x2c4abc,_0x16af6f){return function(_0x406af4){if(_0x406af4){var _0x2dde6c=typeof _0x16af6f['offset']===_0xeeff('0x1e')&&typeof _0x16af6f[_0xeeff('0x1f')]===_0xeeff('0x1e');var _0xd3e8bc=_0x406af4[_0xeeff('0x20')];var _0x454539=_0x2dde6c?0x0:_0x16af6f[_0xeeff('0x21')];var _0x3daad9=_0x2dde6c?_0x406af4[_0xeeff('0x20')]:_0x16af6f[_0xeeff('0x21')]+_0x16af6f[_0xeeff('0x1f')];var _0x4093a2;if(_0x3daad9>=_0xd3e8bc){_0x3daad9=_0xd3e8bc;_0x4093a2=0xc8;}else{_0x4093a2=0xce;}_0x2c4abc[_0xeeff('0x1b')](_0x4093a2);return _0x2c4abc[_0xeeff('0x22')](_0xeeff('0x23'),_0x454539+'-'+_0x3daad9+'/'+_0xd3e8bc)[_0xeeff('0x1d')](_0x406af4);}return null;};}function patchUpdates(_0x51e8cb){return function(_0x130634){try{jsonpatch[_0xeeff('0x24')](_0x130634,_0x51e8cb,!![]);}catch(_0x1ca53b){return BPromise[_0xeeff('0x25')](_0x1ca53b);}return _0x130634['save']();};}function saveUpdates(_0xd53b7b,_0x4bf695){return function(_0x37ad07){if(_0x37ad07){return _0x37ad07[_0xeeff('0x26')](_0xd53b7b)['then'](function(_0x5999c7){return _0x5999c7;});}return null;};}function removeEntity(_0x3d43f4,_0x1ff964){return function(_0xed5bb5){if(_0xed5bb5){return _0xed5bb5['destroy']()[_0xeeff('0x27')](function(){_0x3d43f4[_0xeeff('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x549fb5,_0x161213){return function(_0xb6040f){if(!_0xb6040f){_0x549fb5[_0xeeff('0x1a')](0x194);}return _0xb6040f;};}function handleError(_0x546bf5,_0x5cf86b){_0x5cf86b=_0x5cf86b||0x1f4;return function(_0x591be1){logger[_0xeeff('0x28')](_0x591be1[_0xeeff('0x29')]);if(_0x591be1[_0xeeff('0x2a')]){delete _0x591be1[_0xeeff('0x2a')];}_0x546bf5[_0xeeff('0x1b')](_0x5cf86b)[_0xeeff('0x2b')](_0x591be1);};}exports[_0xeeff('0x2c')]=function(_0x6f7c27,_0x260678){var _0x44a201={},_0x341b9f={},_0x1b9475={'count':0x0,'rows':[]};var _0x5d4183=_['map'](db[_0xeeff('0x2d')]['rawAttributes'],function(_0x47c724){return{'name':_0x47c724[_0xeeff('0x2e')],'type':_0x47c724['type'][_0xeeff('0x2f')]};});_0x341b9f['model']=_[_0xeeff('0x30')](_0x5d4183,_0xeeff('0x2a'));_0x341b9f['query']=_['keys'](_0x6f7c27[_0xeeff('0x31')]);_0x341b9f[_0xeeff('0x32')]=_[_0xeeff('0x33')](_0x341b9f[_0xeeff('0x34')],_0x341b9f[_0xeeff('0x31')]);_0x44a201[_0xeeff('0x35')]=_[_0xeeff('0x33')](_0x341b9f[_0xeeff('0x34')],qs[_0xeeff('0x36')](_0x6f7c27[_0xeeff('0x31')]['fields']));_0x44a201[_0xeeff('0x35')]=_0x44a201[_0xeeff('0x35')]['length']?_0x44a201[_0xeeff('0x35')]:_0x341b9f[_0xeeff('0x34')];if(!_0x6f7c27[_0xeeff('0x31')][_0xeeff('0x37')](_0xeeff('0x38'))){_0x44a201[_0xeeff('0x1f')]=qs[_0xeeff('0x1f')](_0x6f7c27[_0xeeff('0x31')]['limit']);_0x44a201[_0xeeff('0x21')]=qs[_0xeeff('0x21')](_0x6f7c27[_0xeeff('0x31')][_0xeeff('0x21')]);}_0x44a201[_0xeeff('0x39')]=qs['sort'](_0x6f7c27[_0xeeff('0x31')]['sort']);_0x44a201[_0xeeff('0x3a')]=qs[_0xeeff('0x32')](_[_0xeeff('0x3b')](_0x6f7c27[_0xeeff('0x31')],_0x341b9f[_0xeeff('0x32')]),_0x5d4183);if(_0x6f7c27['query'][_0xeeff('0x3c')]){_0x44a201[_0xeeff('0x3a')]=_[_0xeeff('0x3d')](_0x44a201[_0xeeff('0x3a')],{'$or':_['map'](_0x5d4183,function(_0x83dae){if(_0x83dae[_0xeeff('0x3e')]!==_0xeeff('0x3f')){var _0x38bae2={};_0x38bae2[_0x83dae[_0xeeff('0x2a')]]={'$like':'%'+_0x6f7c27[_0xeeff('0x31')][_0xeeff('0x3c')]+'%'};return _0x38bae2;}})});}_0x44a201=_[_0xeeff('0x3d')]({},_0x44a201,_0x6f7c27[_0xeeff('0x40')]);var _0x5f3f53={'where':_0x44a201[_0xeeff('0x3a')]};return db[_0xeeff('0x2d')][_0xeeff('0x20')](_0x5f3f53)[_0xeeff('0x27')](function(_0x13502c){_0x1b9475['count']=_0x13502c;if(_0x6f7c27[_0xeeff('0x31')][_0xeeff('0x41')]){_0x44a201[_0xeeff('0x42')]=[{'all':!![]}];}return db[_0xeeff('0x2d')][_0xeeff('0x43')](_0x44a201);})[_0xeeff('0x27')](function(_0x5b038f){_0x1b9475['rows']=_0x5b038f;return _0x1b9475;})[_0xeeff('0x27')](respondWithFilteredResult(_0x260678,_0x44a201))[_0xeeff('0x44')](handleError(_0x260678,null));};exports[_0xeeff('0x45')]=function(_0x5cf4d7,_0x544375){var _0x144083={'raw':![],'where':{'id':_0x5cf4d7[_0xeeff('0x46')]['id']}},_0x542d43={};_0x542d43[_0xeeff('0x34')]=_['keys'](db[_0xeeff('0x2d')][_0xeeff('0x47')]);_0x542d43[_0xeeff('0x31')]=_[_0xeeff('0x48')](_0x5cf4d7[_0xeeff('0x31')]);_0x542d43[_0xeeff('0x32')]=_['intersection'](_0x542d43['model'],_0x542d43[_0xeeff('0x31')]);_0x144083['attributes']=_[_0xeeff('0x33')](_0x542d43[_0xeeff('0x34')],qs['fields'](_0x5cf4d7[_0xeeff('0x31')][_0xeeff('0x36')]));_0x144083[_0xeeff('0x35')]=_0x144083['attributes']['length']?_0x144083[_0xeeff('0x35')]:_0x542d43[_0xeeff('0x34')];if(_0x5cf4d7['query']['includeAll']){_0x144083['include']=[{'all':!![]}];}_0x144083=_[_0xeeff('0x3d')]({},_0x144083,_0x5cf4d7[_0xeeff('0x40')]);return db[_0xeeff('0x2d')][_0xeeff('0x49')](_0x144083)[_0xeeff('0x27')](handleEntityNotFound(_0x544375,null))[_0xeeff('0x27')](respondWithResult(_0x544375,null))[_0xeeff('0x44')](handleError(_0x544375,null));};exports[_0xeeff('0x4a')]=function(_0x30de8b,_0x41a0ea){return db[_0xeeff('0x2d')][_0xeeff('0x4a')](_0x30de8b[_0xeeff('0x4b')],{})[_0xeeff('0x27')](respondWithResult(_0x41a0ea,0xc9))[_0xeeff('0x44')](handleError(_0x41a0ea,null));};exports[_0xeeff('0x26')]=function(_0x10ec60,_0x25b483){if(_0x10ec60['body']['id']){delete _0x10ec60[_0xeeff('0x4b')]['id'];}return db[_0xeeff('0x2d')][_0xeeff('0x49')]({'where':{'id':_0x10ec60[_0xeeff('0x46')]['id']}})[_0xeeff('0x27')](handleEntityNotFound(_0x25b483,null))[_0xeeff('0x27')](saveUpdates(_0x10ec60[_0xeeff('0x4b')],null))[_0xeeff('0x27')](respondWithResult(_0x25b483,null))[_0xeeff('0x44')](handleError(_0x25b483,null));};exports['destroy']=function(_0x2e3438,_0x4f8a69){return db['ServicenowAccount'][_0xeeff('0x49')]({'where':{'id':_0x2e3438[_0xeeff('0x46')]['id']}})['then'](handleEntityNotFound(_0x4f8a69,null))[_0xeeff('0x27')](removeEntity(_0x4f8a69,null))[_0xeeff('0x44')](handleError(_0x4f8a69,null));};exports[_0xeeff('0x4c')]=function(_0x516cb1,_0x2d8715,_0x237161){var _0x139764={};var _0x302f99={};var _0x426f5d;var _0x191695;return db[_0xeeff('0x2d')][_0xeeff('0x4d')]({'where':{'id':_0x516cb1[_0xeeff('0x46')]['id']}})[_0xeeff('0x27')](handleEntityNotFound(_0x2d8715,null))[_0xeeff('0x27')](function(_0x42e84c){if(_0x42e84c){_0x426f5d=_0x42e84c;_0x302f99[_0xeeff('0x34')]=_['keys'](db['ServicenowConfiguration'][_0xeeff('0x47')]);_0x302f99[_0xeeff('0x31')]=_[_0xeeff('0x48')](_0x516cb1[_0xeeff('0x31')]);_0x302f99['filters']=_[_0xeeff('0x33')](_0x302f99[_0xeeff('0x34')],_0x302f99[_0xeeff('0x31')]);_0x139764[_0xeeff('0x35')]=_[_0xeeff('0x33')](_0x302f99['model'],qs[_0xeeff('0x36')](_0x516cb1[_0xeeff('0x31')][_0xeeff('0x36')]));_0x139764[_0xeeff('0x35')]=_0x139764[_0xeeff('0x35')]['length']?_0x139764[_0xeeff('0x35')]:_0x302f99[_0xeeff('0x34')];_0x139764[_0xeeff('0x39')]=qs[_0xeeff('0x4e')](_0x516cb1['query'][_0xeeff('0x4e')]);_0x139764['where']=qs[_0xeeff('0x32')](_[_0xeeff('0x3b')](_0x516cb1[_0xeeff('0x31')],_0x302f99['filters']));if(_0x516cb1[_0xeeff('0x31')]['filter']){_0x139764['where']=_[_0xeeff('0x3d')](_0x139764[_0xeeff('0x3a')],{'$or':_[_0xeeff('0x30')](_0x139764['attributes'],function(_0x3f0d9a){var _0x425885={};_0x425885[_0x3f0d9a]={'$like':'%'+_0x516cb1['query'][_0xeeff('0x3c')]+'%'};return _0x425885;})});}_0x139764=_['merge']({},_0x139764,_0x516cb1[_0xeeff('0x40')]);return _0x426f5d[_0xeeff('0x4c')](_0x139764);}})[_0xeeff('0x27')](function(_0x302a3e){if(_0x302a3e){_0x191695=_0x302a3e[_0xeeff('0x4f')];if(!_0x516cb1[_0xeeff('0x31')]['hasOwnProperty'](_0xeeff('0x38'))){_0x139764[_0xeeff('0x1f')]=qs[_0xeeff('0x1f')](_0x516cb1[_0xeeff('0x31')][_0xeeff('0x1f')]);_0x139764[_0xeeff('0x21')]=qs[_0xeeff('0x21')](_0x516cb1[_0xeeff('0x31')][_0xeeff('0x21')]);}return _0x426f5d[_0xeeff('0x4c')](_0x139764);}})['then'](function(_0x593905){if(_0x593905){return _0x593905?{'count':_0x191695,'rows':_0x593905}:null;}})[_0xeeff('0x27')](respondWithResult(_0x2d8715,null))[_0xeeff('0x44')](handleError(_0x2d8715,null));};exports[_0xeeff('0x50')]=function(_0x57b342,_0x3c90ac,_0x1400c2){if(_0x57b342[_0xeeff('0x4b')]['id']){delete _0x57b342[_0xeeff('0x4b')]['id'];}return db['ServicenowAccount'][_0xeeff('0x4d')]({'where':{'id':_0x57b342['params']['id']}})[_0xeeff('0x27')](handleEntityNotFound(_0x3c90ac,null))[_0xeeff('0x27')](function(_0x3c7557){if(_0x3c7557){_0x57b342[_0xeeff('0x4b')][_0xeeff('0x51')]=_0x3c7557['id'];_0x57b342[_0xeeff('0x4b')][_0xeeff('0x52')]=integrations['getSubjects'](_0x57b342[_0xeeff('0x4b')]['channel'],_0x57b342['body'][_0xeeff('0x3e')]);_0x57b342[_0xeeff('0x4b')][_0xeeff('0x53')]=integrations[_0xeeff('0x54')](_0x57b342['body'][_0xeeff('0x55')],_0x57b342[_0xeeff('0x4b')][_0xeeff('0x3e')]);return db['ServicenowConfiguration']['create'](_0x57b342['body'],{'include':[{'model':db[_0xeeff('0x56')],'as':_0xeeff('0x52')},{'model':db['ServicenowField'],'as':_0xeeff('0x53')}]});}return null;})[_0xeeff('0x27')](respondWithResult(_0x3c90ac,null))[_0xeeff('0x44')](handleError(_0x3c90ac,null));};exports[_0xeeff('0x57')]=function(_0x2c41b5,_0x832347,_0x524ea5){var _0x5d8640=['made_sla',_0xeeff('0x58'),_0xeeff('0x59'),_0xeeff('0x5a'),_0xeeff('0x5b'),_0xeeff('0x5c'),_0xeeff('0x5d'),_0xeeff('0x5e'),_0xeeff('0x5f')];var _0x230da5=[_0xeeff('0x60'),_0xeeff('0x61'),_0xeeff('0x62'),_0xeeff('0x63'),_0xeeff('0x64'),_0xeeff('0x65'),_0xeeff('0x66'),_0xeeff('0x58'),'approval_history','number',_0xeeff('0x67'),_0xeeff('0x68'),'opened_by',_0xeeff('0x69'),_0xeeff('0x6a'),_0xeeff('0x6b'),_0xeeff('0x6c'),_0xeeff('0x6d'),'knowledge',_0xeeff('0x39'),_0xeeff('0x6e'),'closed_at',_0xeeff('0x6f'),'delivery_plan','impact',_0xeeff('0x70'),'work_notes_list','business_service',_0xeeff('0x71'),_0xeeff('0x72'),_0xeeff('0x73'),_0xeeff('0x74'),'expected_start',_0xeeff('0x75'),_0xeeff('0x76'),_0xeeff('0x77'),'work_end','reopened_time',_0xeeff('0x78'),_0xeeff('0x79'),_0xeeff('0x7a'),_0xeeff('0x5a'),'work_notes','short_description',_0xeeff('0x5b'),_0xeeff('0x7b'),'delivery_task','work_start',_0xeeff('0x7c'),_0xeeff('0x7d'),_0xeeff('0x7e'),_0xeeff('0x7f'),_0xeeff('0x80'),'notify','sys_class_name',_0xeeff('0x81'),_0xeeff('0x82'),_0xeeff('0x83'),_0xeeff('0x84'),_0xeeff('0x85'),_0xeeff('0x86'),_0xeeff('0x87'),'incident_state',_0xeeff('0x88'),_0xeeff('0x89'),_0xeeff('0x8a'),_0xeeff('0x8b'),'activity_due',_0xeeff('0x8c'),_0xeeff('0x5e'),_0xeeff('0x8d'),_0xeeff('0x8e'),'approval','comments_and_work_notes',_0xeeff('0x8f'),_0xeeff('0x90'),_0xeeff('0x91'),_0xeeff('0x92'),'escalation','upon_approval',_0xeeff('0x93'),_0xeeff('0x94'),_0xeeff('0x5f')];var _0xf63cae='';var _0x275b36='';var _0x3dfbf8=[];var _0x3e7ca8='';var _0x1c8018='';var _0x41bfe1=[];var _0x482d24='';var _0x50b13a='';var _0x3c9f9c={};var _0x31423f='';return db[_0xeeff('0x2d')][_0xeeff('0x4d')]({'where':{'id':_0x2c41b5[_0xeeff('0x46')]['id']},'attributes':['id',_0xeeff('0x95'),_0xeeff('0x96'),_0xeeff('0x97'),'remoteUri',_0xeeff('0x98')]})[_0xeeff('0x27')](handleEntityNotFound(_0x832347,null))[_0xeeff('0x27')](function(_0x258cf8){if(_0x258cf8){_0x31423f=_0x258cf8[_0xeeff('0x99')];var _0x514d5d=_0x31423f[_0xeeff('0x9a')](-0x1);if(_0x514d5d==='/'){_0x31423f=_0x31423f['substring'](0x0,_0x31423f[_0xeeff('0x9b')](_0x514d5d));}_0x50b13a=util[_0xeeff('0x9c')](_0xeeff('0x9d'),_0x31423f);_0x482d24=util[_0xeeff('0x9c')](_0xeeff('0x9e'),_0x31423f);_0x3c9f9c={'user':_0x258cf8[_0xeeff('0x95')],'pass':_0x258cf8[_0xeeff('0x96')]};var _0x9235f9={'method':_0xeeff('0x9f'),'uri':_0x50b13a+_0xeeff('0xa0'),'auth':_0x3c9f9c,'json':!![]};return rp(_0x9235f9);}})[_0xeeff('0x27')](function(_0x340fda){if(_0x340fda['result'][_0xeeff('0x4f')]>0x0){_0xf63cae=_0x340fda[_0xeeff('0xa1')];}console[_0xeeff('0xa2')](_0xeeff('0xa3'),_0xf63cae);_0x41bfe1=[];_0x275b36=Object[_0xeeff('0xa4')]([],_0xf63cae);_[_0xeeff('0xa5')](_0x275b36,function(_0x315010){return!_0x5d8640[_0xeeff('0xa6')](_0x315010[_0xeeff('0x2a')]);});_0x275b36[_0xeeff('0xa7')](function(_0x363345){var _0x22e72d=createFieldObject(_0x482d24,_0x3c9f9c,_0x363345[_0xeeff('0xa8')],_0x363345['name'],_0x363345[_0xeeff('0xa9')],![]);_0x41bfe1[_0xeeff('0xaa')](_0x22e72d);});return Promise[_0xeeff('0xab')](_0x41bfe1);})[_0xeeff('0x27')](function(_0x75484f){_0x3dfbf8=_0x75484f;_0x3e7ca8=Object[_0xeeff('0xa4')]([],_0xf63cae);console[_0xeeff('0xa2')](_0xeeff('0xac'),_0xf63cae);_[_0xeeff('0xa5')](_0x3e7ca8,function(_0x567367){return _0x230da5[_0xeeff('0xa6')](_0x567367[_0xeeff('0x2a')]);});console[_0xeeff('0xa2')](_0xeeff('0xad'),_0x3e7ca8);_0x41bfe1=[];_0x3e7ca8[_0xeeff('0xa7')](function(_0x54499a){var _0x3f869c=createFieldObject(_0x482d24,_0x3c9f9c,_0x54499a['internalType'],_0x54499a[_0xeeff('0x2a')],_0x54499a[_0xeeff('0xa9')],!![]);_0x41bfe1['push'](_0x3f869c);});return Promise[_0xeeff('0xab')](_0x41bfe1);})['then'](function(_0x25f25a){_0x1c8018=_0x25f25a;var _0x364e1d=_0x3dfbf8['concat'](_0x1c8018);return{'count':_0x364e1d[_0xeeff('0x4f')],'rows':_0x364e1d};})[_0xeeff('0x27')](respondWithResult(_0x832347,null))[_0xeeff('0x44')](function(_0x119d65){console[_0xeeff('0xa2')]('ServiceNow\x20error:\x20'+_0x119d65);var _0x52f6c5=_0x2c41b5[_0xeeff('0x31')][_0xeeff('0xae')]?0x1f4:_0x119d65[_0xeeff('0xaf')]||0x1f4;logger[_0xeeff('0x28')](_0x119d65[_0xeeff('0x29')]);delete _0x119d65[_0xeeff('0x2a')];if(_0x52f6c5===0x191){_0x52f6c5=0x190;}_0x832347['status'](_0x52f6c5)['send'](_0x2c41b5[_0xeeff('0x31')]['test']?{'message':_0xeeff('0xb0'),'statusCode':_0x119d65[_0xeeff('0xaf')]}:_0x119d65);});};function createFieldObject(_0x501d01,_0x497692,_0x49d4a3,_0x53afb7,_0x219423,_0x3171b8){return new Promise(function(_0x2136df,_0x34705d){var _0xabbfb0={'id':_0x53afb7,'name':_0x219423,'custom':_0x3171b8};if(_0x49d4a3===_0xeeff('0xb1')){_0xabbfb0[_0xeeff('0x40')]=[{'name':_0xeeff('0xb2'),'value':_0xeeff('0xb3')},{'name':_0xeeff('0xb4'),'value':'false'}];_0x2136df(_0xabbfb0);}else{var _0x36d410={'method':'GET','uri':_0x501d01+_0xeeff('0xb5')+_0x53afb7,'auth':_0x497692,'json':!![]};return rp(_0x36d410)[_0xeeff('0x27')](function(_0x398931){var _0x28f652=[];if(_0x398931[_0xeeff('0xa1')][_0xeeff('0x4f')]>0x0){_0x398931['result'][_0xeeff('0xa7')](function(_0x4f47fc){if(_0x4f47fc[_0xeeff('0xb6')]===_0xeeff('0xb7')){var _0x5633e9={'name':_0x4f47fc[_0xeeff('0xa9')],'value':_0x4f47fc[_0xeeff('0xb8')]};_0x28f652[_0xeeff('0xaa')](_0x5633e9);}});}_0xabbfb0[_0xeeff('0x40')]=_0x28f652;if(_0xabbfb0[_0xeeff('0x40')][_0xeeff('0x4f')]>0x0){_0x2136df(_0xabbfb0);}else{if(_0x3171b8==![]){_0x2136df();}else{_0x2136df(_0xabbfb0);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 7871552..610178d 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 _0x5496=['util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./intServicenowAccount.attributes','ServicenowAccount','int_servicenow_accounts','lodash'];(function(_0xe896bf,_0x4f8e5e){var _0x4c7a8a=function(_0x410ff2){while(--_0x410ff2){_0xe896bf['push'](_0xe896bf['shift']());}};_0x4c7a8a(++_0x4f8e5e);}(_0x5496,0x175));var _0x6549=function(_0x3d3a42,_0x3819c2){_0x3d3a42=_0x3d3a42-0x0;var _0x2dc217=_0x5496[_0x3d3a42];return _0x2dc217;};'use strict';var _=require(_0x6549('0x0'));var util=require(_0x6549('0x1'));var logger=require(_0x6549('0x2'))(_0x6549('0x3'));var moment=require(_0x6549('0x4'));var BPromise=require('bluebird');var rp=require(_0x6549('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6549('0x6'));var config=require(_0x6549('0x7'));var attributes=require(_0x6549('0x8'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x43cb17,_0x1d8cea){return _0x43cb17['define'](_0x6549('0x9'),attributes,{'tableName':_0x6549('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4819=['request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','exports','define','ServicenowAccount','int_servicenow_accounts','util','../../config/logger','api','moment','bluebird'];(function(_0x2451c9,_0x75adac){var _0x1e5305=function(_0x33fbd0){while(--_0x33fbd0){_0x2451c9['push'](_0x2451c9['shift']());}};_0x1e5305(++_0x75adac);}(_0x4819,0xcd));var _0x9481=function(_0x28b930,_0x19b05f){_0x28b930=_0x28b930-0x0;var _0x112256=_0x4819[_0x28b930];return _0x112256;};'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'));var integrations=require('../../components/integrations/configuration');module[_0x9481('0xa')]=function(_0x5def07,_0x54cc78){return _0x5def07[_0x9481('0xb')](_0x9481('0xc'),attributes,{'tableName':_0x9481('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index a8ba54c..1cdd366 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 _0x5e46=['debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','ServicenowAccount,\x20%s,\x20%s','message','result','GetServicenowAccount','ServicenowAccount','options','raw','where','limit','map','include','model','attributes','catch','find','ShowServicenowAccount','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x5e46,0x14f));var _0x65e4=function(_0x47dbb5,_0x43ccaa){_0x47dbb5=_0x47dbb5-0x0;var _0x4ded5d=_0x5e46[_0x47dbb5];return _0x4ded5d;};'use strict';var _=require(_0x65e4('0x0'));var util=require('util');var moment=require(_0x65e4('0x1'));var BPromise=require(_0x65e4('0x2'));var rs=require(_0x65e4('0x3'));var fs=require('fs');var Redis=require(_0x65e4('0x4'));var db=require(_0x65e4('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x65e4('0x6'));var config=require(_0x65e4('0x7'));var jayson=require(_0x65e4('0x8'));var client=jayson[_0x65e4('0x9')][_0x65e4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5bc0cb,_0xc24a38,_0x26e8e9){return new BPromise(function(_0x85315,_0x369874){return client[_0x65e4('0xb')](_0x5bc0cb,_0x26e8e9)[_0x65e4('0xc')](function(_0x5e1666){logger[_0x65e4('0xd')]('ServicenowAccount,\x20%s,\x20%s',_0xc24a38,_0x65e4('0xe'));logger[_0x65e4('0xf')](_0x65e4('0x10'),_0xc24a38,_0x65e4('0xe'),JSON[_0x65e4('0x11')](_0x5e1666));if(_0x5e1666[_0x65e4('0x12')]){if(_0x5e1666[_0x65e4('0x12')]['code']===0x1f4){logger[_0x65e4('0x12')](_0x65e4('0x13'),_0xc24a38,_0x5e1666['error'][_0x65e4('0x14')]);return _0x369874(_0x5e1666[_0x65e4('0x12')]['message']);}logger[_0x65e4('0x12')]('ServicenowAccount,\x20%s,\x20%s',_0xc24a38,_0x5e1666['error']['message']);return _0x85315(_0x5e1666[_0x65e4('0x12')]['message']);}else{logger[_0x65e4('0xd')](_0x65e4('0x13'),_0xc24a38,'request\x20sent');_0x85315(_0x5e1666[_0x65e4('0x15')][_0x65e4('0x14')]);}})['catch'](function(_0x53e996){logger[_0x65e4('0x12')](_0x65e4('0x13'),_0xc24a38,_0x53e996);_0x369874(_0x53e996);});});}exports[_0x65e4('0x16')]=function(_0x3e30ee){var _0x4b9823=this;return new Promise(function(_0x1f1338,_0x17b3b9){return db[_0x65e4('0x17')]['findAll']({'raw':_0x3e30ee[_0x65e4('0x18')]?_0x3e30ee[_0x65e4('0x18')][_0x65e4('0x19')]===undefined?!![]:![]:!![],'where':_0x3e30ee[_0x65e4('0x18')]?_0x3e30ee['options'][_0x65e4('0x1a')]||null:null,'attributes':_0x3e30ee[_0x65e4('0x18')]?_0x3e30ee['options']['attributes']||null:null,'limit':_0x3e30ee['options']?_0x3e30ee[_0x65e4('0x18')][_0x65e4('0x1b')]||null:null,'include':_0x3e30ee[_0x65e4('0x18')]?_0x3e30ee[_0x65e4('0x18')]['include']?_[_0x65e4('0x1c')](_0x3e30ee['options'][_0x65e4('0x1d')],function(_0x3d230e){return{'model':db[_0x3d230e[_0x65e4('0x1e')]],'as':_0x3d230e['as'],'attributes':_0x3d230e[_0x65e4('0x1f')],'include':_0x3d230e[_0x65e4('0x1d')]?_[_0x65e4('0x1c')](_0x3d230e[_0x65e4('0x1d')],function(_0x5a5cc8){return{'model':db[_0x5a5cc8[_0x65e4('0x1e')]],'as':_0x5a5cc8['as'],'attributes':_0x5a5cc8['attributes'],'include':_0x5a5cc8[_0x65e4('0x1d')]?_[_0x65e4('0x1c')](_0x5a5cc8['include'],function(_0x188213){return{'model':db[_0x188213['model']],'as':_0x188213['as'],'attributes':_0x188213[_0x65e4('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x47ad50){logger[_0x65e4('0xd')]('GetServicenowAccount',_0x3e30ee);logger[_0x65e4('0xf')]('GetServicenowAccount',_0x3e30ee,JSON[_0x65e4('0x11')](_0x47ad50));_0x1f1338(_0x47ad50);})[_0x65e4('0x20')](function(_0x3bdb47){logger[_0x65e4('0x12')]('GetServicenowAccount',_0x3bdb47[_0x65e4('0x14')],_0x3e30ee);_0x17b3b9(_0x4b9823[_0x65e4('0x12')](0x1f4,_0x3bdb47[_0x65e4('0x14')]));});});};exports['ShowServicenowAccount']=function(_0x5da4f0){var _0x558c66=this;return new Promise(function(_0x527c54,_0x1dfcea){return db[_0x65e4('0x17')][_0x65e4('0x21')]({'raw':_0x5da4f0['options']?_0x5da4f0[_0x65e4('0x18')][_0x65e4('0x19')]===undefined?!![]:![]:!![],'where':_0x5da4f0[_0x65e4('0x18')]?_0x5da4f0[_0x65e4('0x18')]['where']||null:null,'attributes':_0x5da4f0[_0x65e4('0x18')]?_0x5da4f0['options'][_0x65e4('0x1f')]||null:null,'include':_0x5da4f0[_0x65e4('0x18')]?_0x5da4f0[_0x65e4('0x18')]['include']?_[_0x65e4('0x1c')](_0x5da4f0[_0x65e4('0x18')]['include'],function(_0xce4859){return{'model':db[_0xce4859[_0x65e4('0x1e')]],'as':_0xce4859['as'],'attributes':_0xce4859[_0x65e4('0x1f')],'include':_0xce4859[_0x65e4('0x1d')]?_[_0x65e4('0x1c')](_0xce4859[_0x65e4('0x1d')],function(_0x2936dd){return{'model':db[_0x2936dd['model']],'as':_0x2936dd['as'],'attributes':_0x2936dd['attributes'],'include':_0x2936dd[_0x65e4('0x1d')]?_[_0x65e4('0x1c')](_0x2936dd[_0x65e4('0x1d')],function(_0x5caa34){return{'model':db[_0x5caa34[_0x65e4('0x1e')]],'as':_0x5caa34['as'],'attributes':_0x5caa34[_0x65e4('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x533cf5){logger['info'](_0x65e4('0x22'),_0x5da4f0);logger[_0x65e4('0xf')](_0x65e4('0x22'),_0x5da4f0,JSON[_0x65e4('0x11')](_0x533cf5));_0x527c54(_0x533cf5);})[_0x65e4('0x20')](function(_0x491513){logger[_0x65e4('0x12')](_0x65e4('0x22'),_0x491513[_0x65e4('0x14')],_0x5da4f0);_0x1dfcea(_0x558c66[_0x65e4('0x12')](0x1f4,_0x491513[_0x65e4('0x14')]));});});}; \ No newline at end of file +var _0xc9d4=['request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw','where','attributes','include','map','model','ShowServicenowAccount','find','then','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','http','request','info','ServicenowAccount,\x20%s,\x20%s'];(function(_0x38009e,_0x256beb){var _0x17545d=function(_0x237100){while(--_0x237100){_0x38009e['push'](_0x38009e['shift']());}};_0x17545d(++_0x256beb);}(_0xc9d4,0x75));var _0x4c9d=function(_0x39a1a7,_0x1b87ee){_0x39a1a7=_0x39a1a7-0x0;var _0x327792=_0xc9d4[_0x39a1a7];return _0x327792;};'use strict';var _=require(_0x4c9d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4c9d('0x1'));var rs=require(_0x4c9d('0x2'));var fs=require('fs');var Redis=require(_0x4c9d('0x3'));var db=require(_0x4c9d('0x4'))['db'];var utils=require(_0x4c9d('0x5'));var logger=require(_0x4c9d('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x4c9d('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x43db10,_0x21fa5c,_0xb50ca2){return new BPromise(function(_0x503b0f,_0x3f1342){return client[_0x4c9d('0x8')](_0x43db10,_0xb50ca2)['then'](function(_0x1008fb){logger[_0x4c9d('0x9')](_0x4c9d('0xa'),_0x21fa5c,_0x4c9d('0xb'));logger[_0x4c9d('0xc')](_0x4c9d('0xd'),_0x21fa5c,'request\x20sent',JSON[_0x4c9d('0xe')](_0x1008fb));if(_0x1008fb[_0x4c9d('0xf')]){if(_0x1008fb['error']['code']===0x1f4){logger[_0x4c9d('0xf')]('ServicenowAccount,\x20%s,\x20%s',_0x21fa5c,_0x1008fb[_0x4c9d('0xf')][_0x4c9d('0x10')]);return _0x3f1342(_0x1008fb['error']['message']);}logger[_0x4c9d('0xf')](_0x4c9d('0xa'),_0x21fa5c,_0x1008fb['error'][_0x4c9d('0x10')]);return _0x503b0f(_0x1008fb[_0x4c9d('0xf')][_0x4c9d('0x10')]);}else{logger[_0x4c9d('0x9')](_0x4c9d('0xa'),_0x21fa5c,_0x4c9d('0xb'));_0x503b0f(_0x1008fb[_0x4c9d('0x11')][_0x4c9d('0x10')]);}})[_0x4c9d('0x12')](function(_0x126e51){logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x21fa5c,_0x126e51);_0x3f1342(_0x126e51);});});}exports[_0x4c9d('0x13')]=function(_0x8ff4fa){var _0x155358=this;return new Promise(function(_0x440f63,_0x4503f3){return db[_0x4c9d('0x14')][_0x4c9d('0x15')]({'raw':_0x8ff4fa[_0x4c9d('0x16')]?_0x8ff4fa[_0x4c9d('0x16')][_0x4c9d('0x17')]===undefined?!![]:![]:!![],'where':_0x8ff4fa['options']?_0x8ff4fa[_0x4c9d('0x16')][_0x4c9d('0x18')]||null:null,'attributes':_0x8ff4fa[_0x4c9d('0x16')]?_0x8ff4fa[_0x4c9d('0x16')][_0x4c9d('0x19')]||null:null,'limit':_0x8ff4fa[_0x4c9d('0x16')]?_0x8ff4fa[_0x4c9d('0x16')]['limit']||null:null,'include':_0x8ff4fa[_0x4c9d('0x16')]?_0x8ff4fa[_0x4c9d('0x16')][_0x4c9d('0x1a')]?_[_0x4c9d('0x1b')](_0x8ff4fa[_0x4c9d('0x16')]['include'],function(_0x5be6e4){return{'model':db[_0x5be6e4[_0x4c9d('0x1c')]],'as':_0x5be6e4['as'],'attributes':_0x5be6e4[_0x4c9d('0x19')],'include':_0x5be6e4[_0x4c9d('0x1a')]?_['map'](_0x5be6e4[_0x4c9d('0x1a')],function(_0x520466){return{'model':db[_0x520466[_0x4c9d('0x1c')]],'as':_0x520466['as'],'attributes':_0x520466[_0x4c9d('0x19')],'include':_0x520466['include']?_[_0x4c9d('0x1b')](_0x520466[_0x4c9d('0x1a')],function(_0x4d9dca){return{'model':db[_0x4d9dca['model']],'as':_0x4d9dca['as'],'attributes':_0x4d9dca[_0x4c9d('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x522cf2){logger[_0x4c9d('0x9')](_0x4c9d('0x13'),_0x8ff4fa);logger[_0x4c9d('0xc')](_0x4c9d('0x13'),_0x8ff4fa,JSON[_0x4c9d('0xe')](_0x522cf2));_0x440f63(_0x522cf2);})[_0x4c9d('0x12')](function(_0x2d4a1d){logger[_0x4c9d('0xf')](_0x4c9d('0x13'),_0x2d4a1d[_0x4c9d('0x10')],_0x8ff4fa);_0x4503f3(_0x155358[_0x4c9d('0xf')](0x1f4,_0x2d4a1d[_0x4c9d('0x10')]));});});};exports[_0x4c9d('0x1d')]=function(_0x43b3c5){var _0x5aebc3=this;return new Promise(function(_0x4475f6,_0x5b9ae8){return db['ServicenowAccount'][_0x4c9d('0x1e')]({'raw':_0x43b3c5['options']?_0x43b3c5[_0x4c9d('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x43b3c5[_0x4c9d('0x16')]?_0x43b3c5['options']['where']||null:null,'attributes':_0x43b3c5[_0x4c9d('0x16')]?_0x43b3c5['options'][_0x4c9d('0x19')]||null:null,'include':_0x43b3c5[_0x4c9d('0x16')]?_0x43b3c5[_0x4c9d('0x16')][_0x4c9d('0x1a')]?_[_0x4c9d('0x1b')](_0x43b3c5[_0x4c9d('0x16')][_0x4c9d('0x1a')],function(_0x579835){return{'model':db[_0x579835[_0x4c9d('0x1c')]],'as':_0x579835['as'],'attributes':_0x579835['attributes'],'include':_0x579835['include']?_[_0x4c9d('0x1b')](_0x579835[_0x4c9d('0x1a')],function(_0xc99484){return{'model':db[_0xc99484[_0x4c9d('0x1c')]],'as':_0xc99484['as'],'attributes':_0xc99484[_0x4c9d('0x19')],'include':_0xc99484[_0x4c9d('0x1a')]?_[_0x4c9d('0x1b')](_0xc99484[_0x4c9d('0x1a')],function(_0x30991f){return{'model':db[_0x30991f[_0x4c9d('0x1c')]],'as':_0x30991f['as'],'attributes':_0x30991f[_0x4c9d('0x19')]};}):[]};}):[]};}):[]:[]})[_0x4c9d('0x1f')](function(_0x364d71){logger['info'](_0x4c9d('0x1d'),_0x43b3c5);logger['debug'](_0x4c9d('0x1d'),_0x43b3c5,JSON[_0x4c9d('0xe')](_0x364d71));_0x4475f6(_0x364d71);})['catch'](function(_0x5f3e30){logger[_0x4c9d('0xf')](_0x4c9d('0x1d'),_0x5f3e30[_0x4c9d('0x10')],_0x43b3c5);_0x5b9ae8(_0x5aebc3[_0x4c9d('0xf')](0x1f4,_0x5f3e30[_0x4c9d('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 669f045..9876c8e 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 _0x2e3f=['../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','/:id','destroy','exports','multer','util','path','express','Router','../../components/auth/service'];(function(_0x181d33,_0x2ddeee){var _0x2748e8=function(_0x8a3ae1){while(--_0x8a3ae1){_0x181d33['push'](_0x181d33['shift']());}};_0x2748e8(++_0x2ddeee);}(_0x2e3f,0xba));var _0xf2e3=function(_0x200313,_0x41b21a){_0x200313=_0x200313-0x0;var _0x49540e=_0x2e3f[_0x200313];return _0x49540e;};'use strict';var multer=require(_0xf2e3('0x0'));var util=require(_0xf2e3('0x1'));var path=require(_0xf2e3('0x2'));var timeout=require('connect-timeout');var express=require(_0xf2e3('0x3'));var router=express[_0xf2e3('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf2e3('0x5'));var interaction=require(_0xf2e3('0x6'));var config=require(_0xf2e3('0x7'));var controller=require(_0xf2e3('0x8'));router[_0xf2e3('0x9')]('/',auth[_0xf2e3('0xa')](),controller[_0xf2e3('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0xf2e3('0x9')](_0xf2e3('0xc'),auth[_0xf2e3('0xa')](),controller[_0xf2e3('0xd')]);router[_0xf2e3('0x9')](_0xf2e3('0xe'),auth[_0xf2e3('0xa')](),controller[_0xf2e3('0xf')]);router['get'](_0xf2e3('0x10'),auth['isAuthenticated'](),controller[_0xf2e3('0x11')]);router[_0xf2e3('0x12')]('/',auth[_0xf2e3('0xa')](),controller[_0xf2e3('0x13')]);router[_0xf2e3('0x14')](_0xf2e3('0x15'),auth[_0xf2e3('0xa')](),controller['update']);router['delete'](_0xf2e3('0x15'),auth[_0xf2e3('0xa')](),controller[_0xf2e3('0x16')]);module[_0xf2e3('0x17')]=router; \ No newline at end of file +var _0xff7c=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','create','update','delete','multer','util','path','express','../../components/auth/service'];(function(_0x503197,_0x4a2de6){var _0x11c0eb=function(_0xc6aa9){while(--_0xc6aa9){_0x503197['push'](_0x503197['shift']());}};_0x11c0eb(++_0x4a2de6);}(_0xff7c,0x18b));var _0xcff7=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0xff7c[_0xaa1b3e];return _0x454d7d;};'use strict';var multer=require(_0xcff7('0x0'));var util=require(_0xcff7('0x1'));var path=require(_0xcff7('0x2'));var timeout=require('connect-timeout');var express=require(_0xcff7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xcff7('0x4'));var interaction=require(_0xcff7('0x5'));var config=require(_0xcff7('0x6'));var controller=require('./intServicenowConfiguration.controller');router[_0xcff7('0x7')]('/',auth[_0xcff7('0x8')](),controller[_0xcff7('0x9')]);router[_0xcff7('0x7')](_0xcff7('0xa'),auth[_0xcff7('0x8')](),controller[_0xcff7('0xb')]);router['get'](_0xcff7('0xc'),auth[_0xcff7('0x8')](),controller[_0xcff7('0xd')]);router['get'](_0xcff7('0xe'),auth[_0xcff7('0x8')](),controller['getSubjects']);router[_0xcff7('0x7')](_0xcff7('0xf'),auth[_0xcff7('0x8')](),controller[_0xcff7('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0xcff7('0x11')]);router['put']('/:id',auth[_0xcff7('0x8')](),controller[_0xcff7('0x12')]);router[_0xcff7('0x13')](_0xcff7('0xa'),auth[_0xcff7('0x8')](),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 533b193..e5f5fc9 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 _0x16df=['sequelize','exports','STRING'];(function(_0x4e75c5,_0x5eeb93){var _0x872171=function(_0x137973){while(--_0x137973){_0x4e75c5['push'](_0x4e75c5['shift']());}};_0x872171(++_0x5eeb93);}(_0x16df,0xd8));var _0xf16d=function(_0x158d7b,_0xb29901){_0x158d7b=_0x158d7b-0x0;var _0x4c2af8=_0x16df[_0x158d7b];return _0x4c2af8;};'use strict';var Sequelize=require(_0xf16d('0x0'));module[_0xf16d('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf16d('0x2')]}}; \ No newline at end of file +var _0xd0e0=['STRING','sequelize'];(function(_0x450d62,_0x43bda4){var _0x39d501=function(_0x30ef91){while(--_0x30ef91){_0x450d62['push'](_0x450d62['shift']());}};_0x39d501(++_0x43bda4);}(_0xd0e0,0x1a7));var _0x0d0e=function(_0x42766a,_0xd23627){_0x42766a=_0x42766a-0x0;var _0x201fb6=_0xd0e0[_0x42766a];return _0x201fb6;};'use strict';var Sequelize=require(_0x0d0e('0x0'));module['exports']={'name':{'type':Sequelize[_0x0d0e('0x1')]},'description':{'type':Sequelize[_0x0d0e('0x1')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index ac87403..ccebf63 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 _0x1c40=['../../mysqldb','sendStatus','status','end','json','limit','undefined','count','set','Content-Range','save','update','then','destroy','error','name','send','map','rawAttributes','type','key','keys','filters','model','attributes','intersection','fields','query','length','nolimit','offset','sort','where','pick','filter','merge','ServicenowConfiguration','includeAll','include','findAll','rows','show','params','find','catch','create','body','getFields','findOne','ServicenowField','order','options','getSubjects','hasOwnProperty','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util'];(function(_0x4f2801,_0x366dd1){var _0x3ac22a=function(_0x39862a){while(--_0x39862a){_0x4f2801['push'](_0x4f2801['shift']());}};_0x3ac22a(++_0x366dd1);}(_0x1c40,0x177));var _0x01c4=function(_0x11ce46,_0x177a85){_0x11ce46=_0x11ce46-0x0;var _0x368a1e=_0x1c40[_0x11ce46];return _0x368a1e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x01c4('0x0'));var zipdir=require(_0x01c4('0x1'));var jsonpatch=require(_0x01c4('0x2'));var rp=require(_0x01c4('0x3'));var moment=require(_0x01c4('0x4'));var BPromise=require(_0x01c4('0x5'));var Mustache=require(_0x01c4('0x6'));var util=require('util');var path=require(_0x01c4('0x7'));var sox=require(_0x01c4('0x8'));var csv=require(_0x01c4('0x9'));var ejs=require(_0x01c4('0xa'));var fs=require('fs');var fs_extra=require(_0x01c4('0xb'));var _=require(_0x01c4('0xc'));var squel=require(_0x01c4('0xd'));var crypto=require(_0x01c4('0xe'));var jsforce=require(_0x01c4('0xf'));var deskjs=require(_0x01c4('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x01c4('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x01c4('0x12'));var as=require(_0x01c4('0x13'));var hardwareService=require(_0x01c4('0x14'));var logger=require(_0x01c4('0x15'))(_0x01c4('0x16'));var utils=require(_0x01c4('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x01c4('0x18'));var db=require(_0x01c4('0x19'))['db'];function respondWithStatusCode(_0x3da7d5,_0x112322){_0x112322=_0x112322||0xcc;return function(_0x3cac72){if(_0x3cac72){return _0x3da7d5[_0x01c4('0x1a')](_0x112322);}return _0x3da7d5[_0x01c4('0x1b')](_0x112322)[_0x01c4('0x1c')]();};}function respondWithResult(_0x50a1fd,_0xcb2c3){_0xcb2c3=_0xcb2c3||0xc8;return function(_0x418ea9){if(_0x418ea9){return _0x50a1fd[_0x01c4('0x1b')](_0xcb2c3)[_0x01c4('0x1d')](_0x418ea9);}};}function respondWithFilteredResult(_0x2e0e6f,_0x226779){return function(_0x10dc61){if(_0x10dc61){var _0x52589a=typeof _0x226779['offset']==='undefined'&&typeof _0x226779[_0x01c4('0x1e')]===_0x01c4('0x1f');var _0x5ac70d=_0x10dc61['count'];var _0x4092b3=_0x52589a?0x0:_0x226779['offset'];var _0x520343=_0x52589a?_0x10dc61[_0x01c4('0x20')]:_0x226779['offset']+_0x226779[_0x01c4('0x1e')];var _0x207551;if(_0x520343>=_0x5ac70d){_0x520343=_0x5ac70d;_0x207551=0xc8;}else{_0x207551=0xce;}_0x2e0e6f['status'](_0x207551);return _0x2e0e6f[_0x01c4('0x21')](_0x01c4('0x22'),_0x4092b3+'-'+_0x520343+'/'+_0x5ac70d)['json'](_0x10dc61);}return null;};}function patchUpdates(_0x4dcb9f){return function(_0x1275c3){try{jsonpatch['apply'](_0x1275c3,_0x4dcb9f,!![]);}catch(_0x3be096){return BPromise['reject'](_0x3be096);}return _0x1275c3[_0x01c4('0x23')]();};}function saveUpdates(_0x3c65c9,_0x5f53f5){return function(_0xc67fe5){if(_0xc67fe5){return _0xc67fe5[_0x01c4('0x24')](_0x3c65c9)[_0x01c4('0x25')](function(_0x429e12){return _0x429e12;});}return null;};}function removeEntity(_0x5bc25d,_0x41f750){return function(_0x573784){if(_0x573784){return _0x573784[_0x01c4('0x26')]()['then'](function(){_0x5bc25d[_0x01c4('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x231e37,_0x22594c){return function(_0x536a6e){if(!_0x536a6e){_0x231e37['sendStatus'](0x194);}return _0x536a6e;};}function handleError(_0x283dbe,_0xa42c50){_0xa42c50=_0xa42c50||0x1f4;return function(_0x5df1c3){logger[_0x01c4('0x27')](_0x5df1c3['stack']);if(_0x5df1c3[_0x01c4('0x28')]){delete _0x5df1c3['name'];}_0x283dbe[_0x01c4('0x1b')](_0xa42c50)[_0x01c4('0x29')](_0x5df1c3);};}exports['index']=function(_0x4a1c21,_0x441da9){var _0x21f157={},_0x191823={},_0x28c134={'count':0x0,'rows':[]};var _0xc1bbfa=_[_0x01c4('0x2a')](db['ServicenowConfiguration'][_0x01c4('0x2b')],function(_0x502c79){return{'name':_0x502c79['fieldName'],'type':_0x502c79[_0x01c4('0x2c')][_0x01c4('0x2d')]};});_0x191823['model']=_[_0x01c4('0x2a')](_0xc1bbfa,_0x01c4('0x28'));_0x191823['query']=_[_0x01c4('0x2e')](_0x4a1c21['query']);_0x191823[_0x01c4('0x2f')]=_['intersection'](_0x191823[_0x01c4('0x30')],_0x191823['query']);_0x21f157[_0x01c4('0x31')]=_[_0x01c4('0x32')](_0x191823[_0x01c4('0x30')],qs[_0x01c4('0x33')](_0x4a1c21[_0x01c4('0x34')]['fields']));_0x21f157[_0x01c4('0x31')]=_0x21f157[_0x01c4('0x31')][_0x01c4('0x35')]?_0x21f157[_0x01c4('0x31')]:_0x191823['model'];if(!_0x4a1c21[_0x01c4('0x34')]['hasOwnProperty'](_0x01c4('0x36'))){_0x21f157[_0x01c4('0x1e')]=qs[_0x01c4('0x1e')](_0x4a1c21[_0x01c4('0x34')][_0x01c4('0x1e')]);_0x21f157[_0x01c4('0x37')]=qs[_0x01c4('0x37')](_0x4a1c21[_0x01c4('0x34')][_0x01c4('0x37')]);}_0x21f157['order']=qs[_0x01c4('0x38')](_0x4a1c21[_0x01c4('0x34')][_0x01c4('0x38')]);_0x21f157[_0x01c4('0x39')]=qs[_0x01c4('0x2f')](_[_0x01c4('0x3a')](_0x4a1c21['query'],_0x191823['filters']),_0xc1bbfa);if(_0x4a1c21[_0x01c4('0x34')][_0x01c4('0x3b')]){_0x21f157[_0x01c4('0x39')]=_[_0x01c4('0x3c')](_0x21f157[_0x01c4('0x39')],{'$or':_[_0x01c4('0x2a')](_0xc1bbfa,function(_0x11add3){if(_0x11add3[_0x01c4('0x2c')]!=='VIRTUAL'){var _0x4ad91f={};_0x4ad91f[_0x11add3['name']]={'$like':'%'+_0x4a1c21[_0x01c4('0x34')][_0x01c4('0x3b')]+'%'};return _0x4ad91f;}})});}_0x21f157=_[_0x01c4('0x3c')]({},_0x21f157,_0x4a1c21['options']);var _0x4102fd={'where':_0x21f157[_0x01c4('0x39')]};return db[_0x01c4('0x3d')][_0x01c4('0x20')](_0x4102fd)[_0x01c4('0x25')](function(_0x40244d){_0x28c134['count']=_0x40244d;if(_0x4a1c21['query'][_0x01c4('0x3e')]){_0x21f157[_0x01c4('0x3f')]=[{'all':!![]}];}return db[_0x01c4('0x3d')][_0x01c4('0x40')](_0x21f157);})[_0x01c4('0x25')](function(_0x43d7d1){_0x28c134[_0x01c4('0x41')]=_0x43d7d1;return _0x28c134;})[_0x01c4('0x25')](respondWithFilteredResult(_0x441da9,_0x21f157))['catch'](handleError(_0x441da9,null));};exports[_0x01c4('0x42')]=function(_0x163fe5,_0x24bdfe){var _0x380137={'raw':![],'where':{'id':_0x163fe5[_0x01c4('0x43')]['id']}},_0xac85e7={};_0xac85e7[_0x01c4('0x30')]=_[_0x01c4('0x2e')](db[_0x01c4('0x3d')][_0x01c4('0x2b')]);_0xac85e7[_0x01c4('0x34')]=_[_0x01c4('0x2e')](_0x163fe5[_0x01c4('0x34')]);_0xac85e7[_0x01c4('0x2f')]=_['intersection'](_0xac85e7[_0x01c4('0x30')],_0xac85e7[_0x01c4('0x34')]);_0x380137[_0x01c4('0x31')]=_['intersection'](_0xac85e7[_0x01c4('0x30')],qs[_0x01c4('0x33')](_0x163fe5[_0x01c4('0x34')][_0x01c4('0x33')]));_0x380137[_0x01c4('0x31')]=_0x380137[_0x01c4('0x31')][_0x01c4('0x35')]?_0x380137[_0x01c4('0x31')]:_0xac85e7[_0x01c4('0x30')];if(_0x163fe5['query'][_0x01c4('0x3e')]){_0x380137[_0x01c4('0x3f')]=[{'all':!![]}];}_0x380137=_[_0x01c4('0x3c')]({},_0x380137,_0x163fe5['options']);return db[_0x01c4('0x3d')][_0x01c4('0x44')](_0x380137)[_0x01c4('0x25')](handleEntityNotFound(_0x24bdfe,null))['then'](respondWithResult(_0x24bdfe,null))[_0x01c4('0x45')](handleError(_0x24bdfe,null));};exports[_0x01c4('0x46')]=function(_0x7144b1,_0x528c7f){return db['ServicenowConfiguration'][_0x01c4('0x46')](_0x7144b1['body'],{})[_0x01c4('0x25')](respondWithResult(_0x528c7f,0xc9))['catch'](handleError(_0x528c7f,null));};exports[_0x01c4('0x24')]=function(_0xf18702,_0x1dccb0){if(_0xf18702[_0x01c4('0x47')]['id']){delete _0xf18702[_0x01c4('0x47')]['id'];}return db['ServicenowConfiguration'][_0x01c4('0x44')]({'where':{'id':_0xf18702[_0x01c4('0x43')]['id']}})[_0x01c4('0x25')](handleEntityNotFound(_0x1dccb0,null))['then'](saveUpdates(_0xf18702[_0x01c4('0x47')],null))[_0x01c4('0x25')](respondWithResult(_0x1dccb0,null))[_0x01c4('0x45')](handleError(_0x1dccb0,null));};exports[_0x01c4('0x26')]=function(_0x105523,_0x3251d2){return db[_0x01c4('0x3d')][_0x01c4('0x44')]({'where':{'id':_0x105523[_0x01c4('0x43')]['id']}})[_0x01c4('0x25')](handleEntityNotFound(_0x3251d2,null))[_0x01c4('0x25')](removeEntity(_0x3251d2,null))['catch'](handleError(_0x3251d2,null));};exports[_0x01c4('0x48')]=function(_0x73c6f7,_0x734c26,_0x485b1b){var _0x249617={};var _0x461660={};var _0x4edf37;var _0x35a48c;return db[_0x01c4('0x3d')][_0x01c4('0x49')]({'where':{'id':_0x73c6f7[_0x01c4('0x43')]['id']}})['then'](handleEntityNotFound(_0x734c26,null))['then'](function(_0x1d1d23){if(_0x1d1d23){_0x4edf37=_0x1d1d23;_0x461660['model']=_[_0x01c4('0x2e')](db[_0x01c4('0x4a')][_0x01c4('0x2b')]);_0x461660['query']=_[_0x01c4('0x2e')](_0x73c6f7[_0x01c4('0x34')]);_0x461660['filters']=_[_0x01c4('0x32')](_0x461660[_0x01c4('0x30')],_0x461660['query']);_0x249617['attributes']=_[_0x01c4('0x32')](_0x461660['model'],qs['fields'](_0x73c6f7[_0x01c4('0x34')][_0x01c4('0x33')]));_0x249617[_0x01c4('0x31')]=_0x249617['attributes'][_0x01c4('0x35')]?_0x249617[_0x01c4('0x31')]:_0x461660['model'];_0x249617[_0x01c4('0x4b')]=qs[_0x01c4('0x38')](_0x73c6f7[_0x01c4('0x34')][_0x01c4('0x38')]);_0x249617['where']=qs['filters'](_[_0x01c4('0x3a')](_0x73c6f7[_0x01c4('0x34')],_0x461660[_0x01c4('0x2f')]));if(_0x73c6f7['query']['filter']){_0x249617[_0x01c4('0x39')]=_['merge'](_0x249617[_0x01c4('0x39')],{'$or':_[_0x01c4('0x2a')](_0x249617[_0x01c4('0x31')],function(_0x445311){var _0x5a2fc3={};_0x5a2fc3[_0x445311]={'$like':'%'+_0x73c6f7['query'][_0x01c4('0x3b')]+'%'};return _0x5a2fc3;})});}_0x249617=_['merge']({},_0x249617,_0x73c6f7[_0x01c4('0x4c')]);return _0x4edf37[_0x01c4('0x48')](_0x249617);}})['then'](function(_0x4b52b6){if(_0x4b52b6){_0x35a48c=_0x4b52b6['length'];if(!_0x73c6f7[_0x01c4('0x34')]['hasOwnProperty'](_0x01c4('0x36'))){_0x249617[_0x01c4('0x1e')]=qs[_0x01c4('0x1e')](_0x73c6f7['query'][_0x01c4('0x1e')]);_0x249617[_0x01c4('0x37')]=qs[_0x01c4('0x37')](_0x73c6f7[_0x01c4('0x34')][_0x01c4('0x37')]);}return _0x4edf37[_0x01c4('0x48')](_0x249617);}})[_0x01c4('0x25')](function(_0x48e475){if(_0x48e475){return _0x48e475?{'count':_0x35a48c,'rows':_0x48e475}:null;}})[_0x01c4('0x25')](respondWithResult(_0x734c26,null))[_0x01c4('0x45')](handleError(_0x734c26,null));};exports[_0x01c4('0x4d')]=function(_0x298842,_0x4f1b43,_0xfddbc5){var _0x2c2944={};var _0x4069a9={};var _0x182598;var _0x47ef25;return db[_0x01c4('0x3d')][_0x01c4('0x49')]({'where':{'id':_0x298842[_0x01c4('0x43')]['id']}})[_0x01c4('0x25')](handleEntityNotFound(_0x4f1b43,null))[_0x01c4('0x25')](function(_0x1b0b14){if(_0x1b0b14){_0x182598=_0x1b0b14;_0x4069a9[_0x01c4('0x30')]=_[_0x01c4('0x2e')](db[_0x01c4('0x4a')][_0x01c4('0x2b')]);_0x4069a9[_0x01c4('0x34')]=_[_0x01c4('0x2e')](_0x298842[_0x01c4('0x34')]);_0x4069a9['filters']=_[_0x01c4('0x32')](_0x4069a9[_0x01c4('0x30')],_0x4069a9[_0x01c4('0x34')]);_0x2c2944['attributes']=_[_0x01c4('0x32')](_0x4069a9[_0x01c4('0x30')],qs[_0x01c4('0x33')](_0x298842['query']['fields']));_0x2c2944[_0x01c4('0x31')]=_0x2c2944[_0x01c4('0x31')]['length']?_0x2c2944[_0x01c4('0x31')]:_0x4069a9[_0x01c4('0x30')];_0x2c2944[_0x01c4('0x4b')]=qs['sort'](_0x298842[_0x01c4('0x34')]['sort']);_0x2c2944[_0x01c4('0x39')]=qs[_0x01c4('0x2f')](_[_0x01c4('0x3a')](_0x298842[_0x01c4('0x34')],_0x4069a9[_0x01c4('0x2f')]));if(_0x298842[_0x01c4('0x34')]['filter']){_0x2c2944[_0x01c4('0x39')]=_[_0x01c4('0x3c')](_0x2c2944[_0x01c4('0x39')],{'$or':_[_0x01c4('0x2a')](_0x2c2944[_0x01c4('0x31')],function(_0x2a6edf){var _0x859a6={};_0x859a6[_0x2a6edf]={'$like':'%'+_0x298842[_0x01c4('0x34')][_0x01c4('0x3b')]+'%'};return _0x859a6;})});}_0x2c2944=_['merge']({},_0x2c2944,_0x298842[_0x01c4('0x4c')]);return _0x182598[_0x01c4('0x4d')](_0x2c2944);}})[_0x01c4('0x25')](function(_0x38e21d){if(_0x38e21d){_0x47ef25=_0x38e21d['length'];if(!_0x298842[_0x01c4('0x34')][_0x01c4('0x4e')](_0x01c4('0x36'))){_0x2c2944[_0x01c4('0x1e')]=qs[_0x01c4('0x1e')](_0x298842[_0x01c4('0x34')][_0x01c4('0x1e')]);_0x2c2944[_0x01c4('0x37')]=qs['offset'](_0x298842[_0x01c4('0x34')]['offset']);}return _0x182598[_0x01c4('0x4d')](_0x2c2944);}})[_0x01c4('0x25')](function(_0x572bb2){if(_0x572bb2){return _0x572bb2?{'count':_0x47ef25,'rows':_0x572bb2}:null;}})[_0x01c4('0x25')](respondWithResult(_0x4f1b43,null))['catch'](handleError(_0x4f1b43,null));};exports['getDescriptions']=function(_0x417598,_0x1de4f3,_0x472a57){var _0x428b39={};var _0x15d569={};var _0x5c323c;var _0x5b9bb8;return db[_0x01c4('0x3d')]['findOne']({'where':{'id':_0x417598['params']['id']}})[_0x01c4('0x25')](handleEntityNotFound(_0x1de4f3,null))[_0x01c4('0x25')](function(_0x5721d3){if(_0x5721d3){_0x5c323c=_0x5721d3;_0x15d569[_0x01c4('0x30')]=_[_0x01c4('0x2e')](db['ServicenowField']['rawAttributes']);_0x15d569[_0x01c4('0x34')]=_['keys'](_0x417598['query']);_0x15d569[_0x01c4('0x2f')]=_[_0x01c4('0x32')](_0x15d569[_0x01c4('0x30')],_0x15d569[_0x01c4('0x34')]);_0x428b39[_0x01c4('0x31')]=_['intersection'](_0x15d569[_0x01c4('0x30')],qs[_0x01c4('0x33')](_0x417598[_0x01c4('0x34')][_0x01c4('0x33')]));_0x428b39['attributes']=_0x428b39[_0x01c4('0x31')][_0x01c4('0x35')]?_0x428b39['attributes']:_0x15d569['model'];_0x428b39[_0x01c4('0x4b')]=qs['sort'](_0x417598['query'][_0x01c4('0x38')]);_0x428b39[_0x01c4('0x39')]=qs[_0x01c4('0x2f')](_[_0x01c4('0x3a')](_0x417598[_0x01c4('0x34')],_0x15d569[_0x01c4('0x2f')]));if(_0x417598[_0x01c4('0x34')][_0x01c4('0x3b')]){_0x428b39[_0x01c4('0x39')]=_[_0x01c4('0x3c')](_0x428b39[_0x01c4('0x39')],{'$or':_[_0x01c4('0x2a')](_0x428b39[_0x01c4('0x31')],function(_0x3bbe22){var _0x2bd7b6={};_0x2bd7b6[_0x3bbe22]={'$like':'%'+_0x417598['query'][_0x01c4('0x3b')]+'%'};return _0x2bd7b6;})});}_0x428b39=_[_0x01c4('0x3c')]({},_0x428b39,_0x417598[_0x01c4('0x4c')]);return _0x5c323c[_0x01c4('0x4f')](_0x428b39);}})['then'](function(_0x459f72){if(_0x459f72){_0x5b9bb8=_0x459f72['length'];if(!_0x417598[_0x01c4('0x34')]['hasOwnProperty']('nolimit')){_0x428b39[_0x01c4('0x1e')]=qs[_0x01c4('0x1e')](_0x417598[_0x01c4('0x34')]['limit']);_0x428b39[_0x01c4('0x37')]=qs[_0x01c4('0x37')](_0x417598[_0x01c4('0x34')][_0x01c4('0x37')]);}return _0x5c323c[_0x01c4('0x4f')](_0x428b39);}})[_0x01c4('0x25')](function(_0x149e66){if(_0x149e66){return _0x149e66?{'count':_0x5b9bb8,'rows':_0x149e66}:null;}})[_0x01c4('0x25')](respondWithResult(_0x1de4f3,null))[_0x01c4('0x45')](handleError(_0x1de4f3,null));}; \ No newline at end of file +var _0x6b72=['to-csv','ejs','fs-extra','lodash','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','stack','name','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','include','rows','catch','show','params','keys','includeAll','options','find','create','body','ServicenowField','getFields','nolimit','findOne','pick','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path'];(function(_0x137b23,_0x4e2d3c){var _0x198bb9=function(_0x121a4c){while(--_0x121a4c){_0x137b23['push'](_0x137b23['shift']());}};_0x198bb9(++_0x4e2d3c);}(_0x6b72,0x1c5));var _0x26b7=function(_0x202025,_0x539840){_0x202025=_0x202025-0x0;var _0x16bc50=_0x6b72[_0x202025];return _0x16bc50;};'use strict';var emlformat=require(_0x26b7('0x0'));var rimraf=require(_0x26b7('0x1'));var zipdir=require(_0x26b7('0x2'));var jsonpatch=require(_0x26b7('0x3'));var rp=require(_0x26b7('0x4'));var moment=require(_0x26b7('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x26b7('0x6'));var util=require(_0x26b7('0x7'));var path=require(_0x26b7('0x8'));var sox=require('sox');var csv=require(_0x26b7('0x9'));var ejs=require(_0x26b7('0xa'));var fs=require('fs');var fs_extra=require(_0x26b7('0xb'));var _=require(_0x26b7('0xc'));var squel=require('squel');var crypto=require(_0x26b7('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x26b7('0x9'));var querystring=require('querystring');var Papa=require(_0x26b7('0xe'));var Redis=require(_0x26b7('0xf'));var authService=require(_0x26b7('0x10'));var qs=require(_0x26b7('0x11'));var as=require(_0x26b7('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x26b7('0x13'));var utils=require('../../config/utils');var config=require(_0x26b7('0x14'));var licenseUtil=require(_0x26b7('0x15'));var db=require(_0x26b7('0x16'))['db'];function respondWithStatusCode(_0x1cc647,_0x55a988){_0x55a988=_0x55a988||0xcc;return function(_0x55094c){if(_0x55094c){return _0x1cc647[_0x26b7('0x17')](_0x55a988);}return _0x1cc647[_0x26b7('0x18')](_0x55a988)['end']();};}function respondWithResult(_0x2c885e,_0x38e831){_0x38e831=_0x38e831||0xc8;return function(_0x5b3afb){if(_0x5b3afb){return _0x2c885e[_0x26b7('0x18')](_0x38e831)[_0x26b7('0x19')](_0x5b3afb);}};}function respondWithFilteredResult(_0x309211,_0x5dc888){return function(_0x1c2f07){if(_0x1c2f07){var _0x11d8af=typeof _0x5dc888[_0x26b7('0x1a')]===_0x26b7('0x1b')&&typeof _0x5dc888[_0x26b7('0x1c')]===_0x26b7('0x1b');var _0x7811b0=_0x1c2f07[_0x26b7('0x1d')];var _0x164864=_0x11d8af?0x0:_0x5dc888['offset'];var _0x5b9744=_0x11d8af?_0x1c2f07['count']:_0x5dc888[_0x26b7('0x1a')]+_0x5dc888[_0x26b7('0x1c')];var _0x239732;if(_0x5b9744>=_0x7811b0){_0x5b9744=_0x7811b0;_0x239732=0xc8;}else{_0x239732=0xce;}_0x309211[_0x26b7('0x18')](_0x239732);return _0x309211[_0x26b7('0x1e')]('Content-Range',_0x164864+'-'+_0x5b9744+'/'+_0x7811b0)[_0x26b7('0x19')](_0x1c2f07);}return null;};}function patchUpdates(_0x22922d){return function(_0x38f7fd){try{jsonpatch[_0x26b7('0x1f')](_0x38f7fd,_0x22922d,!![]);}catch(_0x45ff9a){return BPromise[_0x26b7('0x20')](_0x45ff9a);}return _0x38f7fd['save']();};}function saveUpdates(_0xb80f84,_0x102d23){return function(_0x26d7c9){if(_0x26d7c9){return _0x26d7c9[_0x26b7('0x21')](_0xb80f84)[_0x26b7('0x22')](function(_0x8b726c){return _0x8b726c;});}return null;};}function removeEntity(_0x5798c4,_0xfb1f5d){return function(_0x29ed87){if(_0x29ed87){return _0x29ed87[_0x26b7('0x23')]()[_0x26b7('0x22')](function(){_0x5798c4[_0x26b7('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b9929,_0x1304ad){return function(_0x962d6){if(!_0x962d6){_0x1b9929[_0x26b7('0x17')](0x194);}return _0x962d6;};}function handleError(_0x409560,_0x5e050e){_0x5e050e=_0x5e050e||0x1f4;return function(_0x1b4da3){logger['error'](_0x1b4da3[_0x26b7('0x24')]);if(_0x1b4da3[_0x26b7('0x25')]){delete _0x1b4da3[_0x26b7('0x25')];}_0x409560[_0x26b7('0x18')](_0x5e050e)['send'](_0x1b4da3);};}exports[_0x26b7('0x26')]=function(_0x1ce7c1,_0x268d1a){var _0x33cc67={},_0x2d3f4c={},_0x113699={'count':0x0,'rows':[]};var _0x96aa3e=_[_0x26b7('0x27')](db[_0x26b7('0x28')][_0x26b7('0x29')],function(_0x35aa67){return{'name':_0x35aa67[_0x26b7('0x2a')],'type':_0x35aa67[_0x26b7('0x2b')][_0x26b7('0x2c')]};});_0x2d3f4c[_0x26b7('0x2d')]=_[_0x26b7('0x27')](_0x96aa3e,_0x26b7('0x25'));_0x2d3f4c['query']=_['keys'](_0x1ce7c1[_0x26b7('0x2e')]);_0x2d3f4c[_0x26b7('0x2f')]=_['intersection'](_0x2d3f4c[_0x26b7('0x2d')],_0x2d3f4c[_0x26b7('0x2e')]);_0x33cc67['attributes']=_[_0x26b7('0x30')](_0x2d3f4c[_0x26b7('0x2d')],qs[_0x26b7('0x31')](_0x1ce7c1[_0x26b7('0x2e')][_0x26b7('0x31')]));_0x33cc67[_0x26b7('0x32')]=_0x33cc67[_0x26b7('0x32')][_0x26b7('0x33')]?_0x33cc67[_0x26b7('0x32')]:_0x2d3f4c[_0x26b7('0x2d')];if(!_0x1ce7c1[_0x26b7('0x2e')][_0x26b7('0x34')]('nolimit')){_0x33cc67[_0x26b7('0x1c')]=qs['limit'](_0x1ce7c1[_0x26b7('0x2e')][_0x26b7('0x1c')]);_0x33cc67[_0x26b7('0x1a')]=qs['offset'](_0x1ce7c1[_0x26b7('0x2e')][_0x26b7('0x1a')]);}_0x33cc67[_0x26b7('0x35')]=qs[_0x26b7('0x36')](_0x1ce7c1[_0x26b7('0x2e')][_0x26b7('0x36')]);_0x33cc67[_0x26b7('0x37')]=qs[_0x26b7('0x2f')](_['pick'](_0x1ce7c1['query'],_0x2d3f4c['filters']),_0x96aa3e);if(_0x1ce7c1[_0x26b7('0x2e')][_0x26b7('0x38')]){_0x33cc67[_0x26b7('0x37')]=_[_0x26b7('0x39')](_0x33cc67[_0x26b7('0x37')],{'$or':_[_0x26b7('0x27')](_0x96aa3e,function(_0xa9e1fb){if(_0xa9e1fb[_0x26b7('0x2b')]!==_0x26b7('0x3a')){var _0x32a24d={};_0x32a24d[_0xa9e1fb[_0x26b7('0x25')]]={'$like':'%'+_0x1ce7c1[_0x26b7('0x2e')][_0x26b7('0x38')]+'%'};return _0x32a24d;}})});}_0x33cc67=_[_0x26b7('0x39')]({},_0x33cc67,_0x1ce7c1['options']);var _0x3a64fe={'where':_0x33cc67[_0x26b7('0x37')]};return db[_0x26b7('0x28')][_0x26b7('0x1d')](_0x3a64fe)[_0x26b7('0x22')](function(_0x2625ee){_0x113699[_0x26b7('0x1d')]=_0x2625ee;if(_0x1ce7c1[_0x26b7('0x2e')]['includeAll']){_0x33cc67[_0x26b7('0x3b')]=[{'all':!![]}];}return db['ServicenowConfiguration']['findAll'](_0x33cc67);})[_0x26b7('0x22')](function(_0x5d2ef2){_0x113699[_0x26b7('0x3c')]=_0x5d2ef2;return _0x113699;})[_0x26b7('0x22')](respondWithFilteredResult(_0x268d1a,_0x33cc67))[_0x26b7('0x3d')](handleError(_0x268d1a,null));};exports[_0x26b7('0x3e')]=function(_0x23676b,_0x445d18){var _0x5811eb={'raw':![],'where':{'id':_0x23676b[_0x26b7('0x3f')]['id']}},_0xf2081d={};_0xf2081d[_0x26b7('0x2d')]=_[_0x26b7('0x40')](db['ServicenowConfiguration']['rawAttributes']);_0xf2081d[_0x26b7('0x2e')]=_[_0x26b7('0x40')](_0x23676b[_0x26b7('0x2e')]);_0xf2081d[_0x26b7('0x2f')]=_['intersection'](_0xf2081d[_0x26b7('0x2d')],_0xf2081d[_0x26b7('0x2e')]);_0x5811eb[_0x26b7('0x32')]=_['intersection'](_0xf2081d[_0x26b7('0x2d')],qs[_0x26b7('0x31')](_0x23676b[_0x26b7('0x2e')]['fields']));_0x5811eb[_0x26b7('0x32')]=_0x5811eb[_0x26b7('0x32')]['length']?_0x5811eb[_0x26b7('0x32')]:_0xf2081d[_0x26b7('0x2d')];if(_0x23676b[_0x26b7('0x2e')][_0x26b7('0x41')]){_0x5811eb['include']=[{'all':!![]}];}_0x5811eb=_['merge']({},_0x5811eb,_0x23676b[_0x26b7('0x42')]);return db['ServicenowConfiguration'][_0x26b7('0x43')](_0x5811eb)[_0x26b7('0x22')](handleEntityNotFound(_0x445d18,null))[_0x26b7('0x22')](respondWithResult(_0x445d18,null))[_0x26b7('0x3d')](handleError(_0x445d18,null));};exports[_0x26b7('0x44')]=function(_0x27409c,_0x58dd4f){return db['ServicenowConfiguration'][_0x26b7('0x44')](_0x27409c[_0x26b7('0x45')],{})['then'](respondWithResult(_0x58dd4f,0xc9))[_0x26b7('0x3d')](handleError(_0x58dd4f,null));};exports['update']=function(_0x3b96a5,_0x1e1aa){if(_0x3b96a5['body']['id']){delete _0x3b96a5['body']['id'];}return db['ServicenowConfiguration']['find']({'where':{'id':_0x3b96a5['params']['id']}})[_0x26b7('0x22')](handleEntityNotFound(_0x1e1aa,null))['then'](saveUpdates(_0x3b96a5[_0x26b7('0x45')],null))[_0x26b7('0x22')](respondWithResult(_0x1e1aa,null))[_0x26b7('0x3d')](handleError(_0x1e1aa,null));};exports[_0x26b7('0x23')]=function(_0xdd25f3,_0x1e7849){return db[_0x26b7('0x28')]['find']({'where':{'id':_0xdd25f3[_0x26b7('0x3f')]['id']}})['then'](handleEntityNotFound(_0x1e7849,null))['then'](removeEntity(_0x1e7849,null))[_0x26b7('0x3d')](handleError(_0x1e7849,null));};exports['getFields']=function(_0x2129f7,_0x471578,_0x23908d){var _0x1b6f88={};var _0x11ea9d={};var _0x1aec8d;var _0x339187;return db[_0x26b7('0x28')]['findOne']({'where':{'id':_0x2129f7[_0x26b7('0x3f')]['id']}})[_0x26b7('0x22')](handleEntityNotFound(_0x471578,null))[_0x26b7('0x22')](function(_0x3b9e99){if(_0x3b9e99){_0x1aec8d=_0x3b9e99;_0x11ea9d['model']=_[_0x26b7('0x40')](db[_0x26b7('0x46')][_0x26b7('0x29')]);_0x11ea9d['query']=_[_0x26b7('0x40')](_0x2129f7[_0x26b7('0x2e')]);_0x11ea9d[_0x26b7('0x2f')]=_[_0x26b7('0x30')](_0x11ea9d[_0x26b7('0x2d')],_0x11ea9d[_0x26b7('0x2e')]);_0x1b6f88[_0x26b7('0x32')]=_[_0x26b7('0x30')](_0x11ea9d[_0x26b7('0x2d')],qs['fields'](_0x2129f7[_0x26b7('0x2e')][_0x26b7('0x31')]));_0x1b6f88['attributes']=_0x1b6f88[_0x26b7('0x32')]['length']?_0x1b6f88['attributes']:_0x11ea9d[_0x26b7('0x2d')];_0x1b6f88['order']=qs['sort'](_0x2129f7[_0x26b7('0x2e')][_0x26b7('0x36')]);_0x1b6f88[_0x26b7('0x37')]=qs['filters'](_['pick'](_0x2129f7['query'],_0x11ea9d[_0x26b7('0x2f')]));if(_0x2129f7[_0x26b7('0x2e')][_0x26b7('0x38')]){_0x1b6f88['where']=_[_0x26b7('0x39')](_0x1b6f88[_0x26b7('0x37')],{'$or':_[_0x26b7('0x27')](_0x1b6f88[_0x26b7('0x32')],function(_0x1b8f0a){var _0x447eee={};_0x447eee[_0x1b8f0a]={'$like':'%'+_0x2129f7[_0x26b7('0x2e')][_0x26b7('0x38')]+'%'};return _0x447eee;})});}_0x1b6f88=_['merge']({},_0x1b6f88,_0x2129f7[_0x26b7('0x42')]);return _0x1aec8d[_0x26b7('0x47')](_0x1b6f88);}})[_0x26b7('0x22')](function(_0x9278b2){if(_0x9278b2){_0x339187=_0x9278b2['length'];if(!_0x2129f7[_0x26b7('0x2e')]['hasOwnProperty'](_0x26b7('0x48'))){_0x1b6f88[_0x26b7('0x1c')]=qs[_0x26b7('0x1c')](_0x2129f7[_0x26b7('0x2e')][_0x26b7('0x1c')]);_0x1b6f88[_0x26b7('0x1a')]=qs['offset'](_0x2129f7[_0x26b7('0x2e')][_0x26b7('0x1a')]);}return _0x1aec8d[_0x26b7('0x47')](_0x1b6f88);}})[_0x26b7('0x22')](function(_0x62a5f5){if(_0x62a5f5){return _0x62a5f5?{'count':_0x339187,'rows':_0x62a5f5}:null;}})['then'](respondWithResult(_0x471578,null))[_0x26b7('0x3d')](handleError(_0x471578,null));};exports['getSubjects']=function(_0xf5e755,_0x578842,_0x4fbae3){var _0x556fcc={};var _0x540a88={};var _0x1e7ad5;var _0x521ac8;return db[_0x26b7('0x28')][_0x26b7('0x49')]({'where':{'id':_0xf5e755[_0x26b7('0x3f')]['id']}})['then'](handleEntityNotFound(_0x578842,null))[_0x26b7('0x22')](function(_0x4c0a99){if(_0x4c0a99){_0x1e7ad5=_0x4c0a99;_0x540a88[_0x26b7('0x2d')]=_['keys'](db[_0x26b7('0x46')]['rawAttributes']);_0x540a88[_0x26b7('0x2e')]=_['keys'](_0xf5e755[_0x26b7('0x2e')]);_0x540a88[_0x26b7('0x2f')]=_[_0x26b7('0x30')](_0x540a88['model'],_0x540a88[_0x26b7('0x2e')]);_0x556fcc['attributes']=_[_0x26b7('0x30')](_0x540a88[_0x26b7('0x2d')],qs['fields'](_0xf5e755['query'][_0x26b7('0x31')]));_0x556fcc['attributes']=_0x556fcc[_0x26b7('0x32')]['length']?_0x556fcc[_0x26b7('0x32')]:_0x540a88[_0x26b7('0x2d')];_0x556fcc['order']=qs['sort'](_0xf5e755[_0x26b7('0x2e')][_0x26b7('0x36')]);_0x556fcc[_0x26b7('0x37')]=qs[_0x26b7('0x2f')](_[_0x26b7('0x4a')](_0xf5e755[_0x26b7('0x2e')],_0x540a88['filters']));if(_0xf5e755[_0x26b7('0x2e')][_0x26b7('0x38')]){_0x556fcc[_0x26b7('0x37')]=_[_0x26b7('0x39')](_0x556fcc[_0x26b7('0x37')],{'$or':_['map'](_0x556fcc['attributes'],function(_0x26f40f){var _0x100675={};_0x100675[_0x26f40f]={'$like':'%'+_0xf5e755[_0x26b7('0x2e')][_0x26b7('0x38')]+'%'};return _0x100675;})});}_0x556fcc=_[_0x26b7('0x39')]({},_0x556fcc,_0xf5e755[_0x26b7('0x42')]);return _0x1e7ad5[_0x26b7('0x4b')](_0x556fcc);}})['then'](function(_0x4c05a4){if(_0x4c05a4){_0x521ac8=_0x4c05a4['length'];if(!_0xf5e755[_0x26b7('0x2e')][_0x26b7('0x34')]('nolimit')){_0x556fcc[_0x26b7('0x1c')]=qs[_0x26b7('0x1c')](_0xf5e755[_0x26b7('0x2e')][_0x26b7('0x1c')]);_0x556fcc[_0x26b7('0x1a')]=qs[_0x26b7('0x1a')](_0xf5e755[_0x26b7('0x2e')][_0x26b7('0x1a')]);}return _0x1e7ad5['getSubjects'](_0x556fcc);}})[_0x26b7('0x22')](function(_0x174698){if(_0x174698){return _0x174698?{'count':_0x521ac8,'rows':_0x174698}:null;}})[_0x26b7('0x22')](respondWithResult(_0x578842,null))[_0x26b7('0x3d')](handleError(_0x578842,null));};exports['getDescriptions']=function(_0x5c4cc6,_0x195f1c,_0x345f7c){var _0x4182f5={};var _0x4fe680={};var _0xde9ead;var _0x4e955a;return db[_0x26b7('0x28')][_0x26b7('0x49')]({'where':{'id':_0x5c4cc6[_0x26b7('0x3f')]['id']}})[_0x26b7('0x22')](handleEntityNotFound(_0x195f1c,null))[_0x26b7('0x22')](function(_0x4f1a22){if(_0x4f1a22){_0xde9ead=_0x4f1a22;_0x4fe680['model']=_['keys'](db[_0x26b7('0x46')][_0x26b7('0x29')]);_0x4fe680[_0x26b7('0x2e')]=_[_0x26b7('0x40')](_0x5c4cc6['query']);_0x4fe680[_0x26b7('0x2f')]=_[_0x26b7('0x30')](_0x4fe680[_0x26b7('0x2d')],_0x4fe680['query']);_0x4182f5[_0x26b7('0x32')]=_[_0x26b7('0x30')](_0x4fe680[_0x26b7('0x2d')],qs[_0x26b7('0x31')](_0x5c4cc6[_0x26b7('0x2e')]['fields']));_0x4182f5[_0x26b7('0x32')]=_0x4182f5['attributes'][_0x26b7('0x33')]?_0x4182f5[_0x26b7('0x32')]:_0x4fe680[_0x26b7('0x2d')];_0x4182f5[_0x26b7('0x35')]=qs[_0x26b7('0x36')](_0x5c4cc6['query'][_0x26b7('0x36')]);_0x4182f5[_0x26b7('0x37')]=qs['filters'](_['pick'](_0x5c4cc6[_0x26b7('0x2e')],_0x4fe680[_0x26b7('0x2f')]));if(_0x5c4cc6[_0x26b7('0x2e')][_0x26b7('0x38')]){_0x4182f5[_0x26b7('0x37')]=_[_0x26b7('0x39')](_0x4182f5[_0x26b7('0x37')],{'$or':_[_0x26b7('0x27')](_0x4182f5[_0x26b7('0x32')],function(_0x501107){var _0x14a6b8={};_0x14a6b8[_0x501107]={'$like':'%'+_0x5c4cc6['query'][_0x26b7('0x38')]+'%'};return _0x14a6b8;})});}_0x4182f5=_[_0x26b7('0x39')]({},_0x4182f5,_0x5c4cc6['options']);return _0xde9ead['getDescriptions'](_0x4182f5);}})[_0x26b7('0x22')](function(_0x5c014f){if(_0x5c014f){_0x4e955a=_0x5c014f['length'];if(!_0x5c4cc6[_0x26b7('0x2e')][_0x26b7('0x34')](_0x26b7('0x48'))){_0x4182f5[_0x26b7('0x1c')]=qs[_0x26b7('0x1c')](_0x5c4cc6[_0x26b7('0x2e')][_0x26b7('0x1c')]);_0x4182f5[_0x26b7('0x1a')]=qs['offset'](_0x5c4cc6[_0x26b7('0x2e')][_0x26b7('0x1a')]);}return _0xde9ead[_0x26b7('0x4c')](_0x4182f5);}})['then'](function(_0x3bff63){if(_0x3bff63){return _0x3bff63?{'count':_0x4e955a,'rows':_0x3bff63}:null;}})[_0x26b7('0x22')](respondWithResult(_0x195f1c,null))[_0x26b7('0x3d')](handleError(_0x195f1c,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 5796bbb..752075f 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 _0x1df7=['rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','define','int_servicenow_configurations','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x51b2e4,_0x2f0e88){var _0x511c79=function(_0x4568f6){while(--_0x4568f6){_0x51b2e4['push'](_0x51b2e4['shift']());}};_0x511c79(++_0x2f0e88);}(_0x1df7,0x6e));var _0x71df=function(_0x2c4260,_0x19882c){_0x2c4260=_0x2c4260-0x0;var _0x13972e=_0x1df7[_0x2c4260];return _0x13972e;};'use strict';var _=require('lodash');var util=require(_0x71df('0x0'));var logger=require(_0x71df('0x1'))(_0x71df('0x2'));var moment=require(_0x71df('0x3'));var BPromise=require(_0x71df('0x4'));var rp=require(_0x71df('0x5'));var fs=require('fs');var path=require(_0x71df('0x6'));var rimraf=require(_0x71df('0x7'));var config=require(_0x71df('0x8'));var attributes=require(_0x71df('0x9'));module[_0x71df('0xa')]=function(_0x4364ea,_0x481a2f){return _0x4364ea[_0x71df('0xb')]('ServicenowConfiguration',attributes,{'tableName':_0x71df('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4dd3=['rimraf','../../config/environment','exports','define','ServicenowConfiguration','lodash','util','../../config/logger','bluebird','path'];(function(_0x308509,_0xe1759e){var _0x3c7993=function(_0x4d384e){while(--_0x4d384e){_0x308509['push'](_0x308509['shift']());}};_0x3c7993(++_0xe1759e);}(_0x4dd3,0xf5));var _0x34dd=function(_0x211bc3,_0x5860c8){_0x211bc3=_0x211bc3-0x0;var _0x34c9a2=_0x4dd3[_0x211bc3];return _0x34c9a2;};'use strict';var _=require(_0x34dd('0x0'));var util=require(_0x34dd('0x1'));var logger=require(_0x34dd('0x2'))('api');var moment=require('moment');var BPromise=require(_0x34dd('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x34dd('0x4'));var rimraf=require(_0x34dd('0x5'));var config=require(_0x34dd('0x6'));var attributes=require('./intServicenowConfiguration.attributes');module[_0x34dd('0x7')]=function(_0x704165,_0x37ce1d){return _0x704165[_0x34dd('0x8')](_0x34dd('0x9'),attributes,{'tableName':'int_servicenow_configurations','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 5f63d79..bdbb78b 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 _0x5692=['jayson/promise','client','http','request','then','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','ServicenowConfiguration,\x20%s,\x20%s','message','info','request\x20sent','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x523adf,_0x3e1620){var _0x283870=function(_0xa0e816){while(--_0xa0e816){_0x523adf['push'](_0x523adf['shift']());}};_0x283870(++_0x3e1620);}(_0x5692,0x8b));var _0x2569=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x5692[_0x6c993a];return _0x27f547;};'use strict';var _=require('lodash');var util=require(_0x2569('0x0'));var moment=require(_0x2569('0x1'));var BPromise=require('bluebird');var rs=require(_0x2569('0x2'));var fs=require('fs');var Redis=require(_0x2569('0x3'));var db=require(_0x2569('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2569('0x5'))(_0x2569('0x6'));var config=require(_0x2569('0x7'));var jayson=require(_0x2569('0x8'));var client=jayson[_0x2569('0x9')][_0x2569('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x9dcedb,_0x55aaf0,_0x685269){return new BPromise(function(_0x184722,_0x510b08){return client[_0x2569('0xb')](_0x9dcedb,_0x685269)[_0x2569('0xc')](function(_0x1de6c5){logger['info']('ServicenowConfiguration,\x20%s,\x20%s',_0x55aaf0,'request\x20sent');logger['debug'](_0x2569('0xd'),_0x55aaf0,'request\x20sent',JSON[_0x2569('0xe')](_0x1de6c5));if(_0x1de6c5[_0x2569('0xf')]){if(_0x1de6c5['error']['code']===0x1f4){logger[_0x2569('0xf')](_0x2569('0x10'),_0x55aaf0,_0x1de6c5['error'][_0x2569('0x11')]);return _0x510b08(_0x1de6c5['error'][_0x2569('0x11')]);}logger[_0x2569('0xf')](_0x2569('0x10'),_0x55aaf0,_0x1de6c5[_0x2569('0xf')][_0x2569('0x11')]);return _0x184722(_0x1de6c5[_0x2569('0xf')][_0x2569('0x11')]);}else{logger[_0x2569('0x12')](_0x2569('0x10'),_0x55aaf0,_0x2569('0x13'));_0x184722(_0x1de6c5['result'][_0x2569('0x11')]);}})[_0x2569('0x14')](function(_0x4ef9ca){logger[_0x2569('0xf')](_0x2569('0x10'),_0x55aaf0,_0x4ef9ca);_0x510b08(_0x4ef9ca);});});} \ No newline at end of file +var _0x4c6f=['rpc','../../config/environment','jayson/promise','client','http','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x2acb39,_0x5dde83){var _0x24e99c=function(_0x4a362b){while(--_0x4a362b){_0x2acb39['push'](_0x2acb39['shift']());}};_0x24e99c(++_0x5dde83);}(_0x4c6f,0x7e));var _0xf4c6=function(_0x3d8ba1,_0x5ba1fd){_0x3d8ba1=_0x3d8ba1-0x0;var _0x87804e=_0x4c6f[_0x3d8ba1];return _0x87804e;};'use strict';var _=require(_0xf4c6('0x0'));var util=require(_0xf4c6('0x1'));var moment=require(_0xf4c6('0x2'));var BPromise=require(_0xf4c6('0x3'));var rs=require(_0xf4c6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf4c6('0x5'))['db'];var utils=require(_0xf4c6('0x6'));var logger=require('../../config/logger')(_0xf4c6('0x7'));var config=require(_0xf4c6('0x8'));var jayson=require(_0xf4c6('0x9'));var client=jayson[_0xf4c6('0xa')][_0xf4c6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5decf7,_0x182f9d,_0x5afcf7){return new BPromise(function(_0x4dfd88,_0x532952){return client['request'](_0x5decf7,_0x5afcf7)['then'](function(_0x227198){logger[_0xf4c6('0xc')](_0xf4c6('0xd'),_0x182f9d,_0xf4c6('0xe'));logger['debug'](_0xf4c6('0xf'),_0x182f9d,_0xf4c6('0xe'),JSON[_0xf4c6('0x10')](_0x227198));if(_0x227198[_0xf4c6('0x11')]){if(_0x227198[_0xf4c6('0x11')]['code']===0x1f4){logger[_0xf4c6('0x11')](_0xf4c6('0xd'),_0x182f9d,_0x227198[_0xf4c6('0x11')][_0xf4c6('0x12')]);return _0x532952(_0x227198[_0xf4c6('0x11')][_0xf4c6('0x12')]);}logger['error'](_0xf4c6('0xd'),_0x182f9d,_0x227198[_0xf4c6('0x11')][_0xf4c6('0x12')]);return _0x4dfd88(_0x227198[_0xf4c6('0x11')]['message']);}else{logger[_0xf4c6('0xc')](_0xf4c6('0xd'),_0x182f9d,_0xf4c6('0xe'));_0x4dfd88(_0x227198['result']['message']);}})['catch'](function(_0xca09b4){logger[_0xf4c6('0x11')](_0xf4c6('0xd'),_0x182f9d,_0xca09b4);_0x532952(_0xca09b4);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index faaab9d..79c0d8f 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 _0x64b9=['post','create','put','update','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment','./intServicenowField.controller','isAuthenticated','index','get','show'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x64b9,0x15c));var _0x964b=function(_0xf555b9,_0x28a0fa){_0xf555b9=_0xf555b9-0x0;var _0x3f2a39=_0x64b9[_0xf555b9];return _0x3f2a39;};'use strict';var multer=require(_0x964b('0x0'));var util=require(_0x964b('0x1'));var path=require(_0x964b('0x2'));var timeout=require(_0x964b('0x3'));var express=require('express');var router=express[_0x964b('0x4')]();var fs_extra=require(_0x964b('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x964b('0x6'));var controller=require(_0x964b('0x7'));router['get']('/',auth[_0x964b('0x8')](),controller[_0x964b('0x9')]);router[_0x964b('0xa')]('/:id',auth[_0x964b('0x8')](),controller[_0x964b('0xb')]);router[_0x964b('0xc')]('/',auth['isAuthenticated'](),controller[_0x964b('0xd')]);router[_0x964b('0xe')]('/:id',auth[_0x964b('0x8')](),controller[_0x964b('0xf')]);router[_0x964b('0x10')]('/:id',auth[_0x964b('0x8')](),controller[_0x964b('0x11')]);module['exports']=router; \ No newline at end of file +var _0xff3a=['/:id','update','destroy','multer','path','connect-timeout','express','fs-extra','./intServicenowField.controller','isAuthenticated','get','show','create','put'];(function(_0x3bb99b,_0x19dcb9){var _0x5a0bfd=function(_0x108cd1){while(--_0x108cd1){_0x3bb99b['push'](_0x3bb99b['shift']());}};_0x5a0bfd(++_0x19dcb9);}(_0xff3a,0x81));var _0xaff3=function(_0x34856f,_0x213ed6){_0x34856f=_0x34856f-0x0;var _0xac5aa5=_0xff3a[_0x34856f];return _0xac5aa5;};'use strict';var multer=require(_0xaff3('0x0'));var util=require('util');var path=require(_0xaff3('0x1'));var timeout=require(_0xaff3('0x2'));var express=require(_0xaff3('0x3'));var router=express['Router']();var fs_extra=require(_0xaff3('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xaff3('0x5'));router['get']('/',auth[_0xaff3('0x6')](),controller['index']);router[_0xaff3('0x7')]('/:id',auth[_0xaff3('0x6')](),controller[_0xaff3('0x8')]);router['post']('/',auth[_0xaff3('0x6')](),controller[_0xaff3('0x9')]);router[_0xaff3('0xa')](_0xaff3('0xb'),auth[_0xaff3('0x6')](),controller[_0xaff3('0xc')]);router['delete']('/:id',auth[_0xaff3('0x6')](),controller[_0xaff3('0xd')]);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 5f68815..7fb9153 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 _0xec97=['variable','BOOLEAN','exports','ENUM','string','customVariable','keyValue','picklist','STRING'];(function(_0x9f1097,_0x4eb3bb){var _0xb168eb=function(_0x1ea6c9){while(--_0x1ea6c9){_0x9f1097['push'](_0x9f1097['shift']());}};_0xb168eb(++_0x4eb3bb);}(_0xec97,0x1cd));var _0x7ec9=function(_0x565485,_0x1434e4){_0x565485=_0x565485-0x0;var _0x47d36a=_0xec97[_0x565485];return _0x47d36a;};'use strict';var Sequelize=require('sequelize');module[_0x7ec9('0x0')]={'type':{'type':Sequelize[_0x7ec9('0x1')](_0x7ec9('0x2'),'variable',_0x7ec9('0x3'),_0x7ec9('0x4'),_0x7ec9('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x7ec9('0x6')]},'key':{'type':Sequelize[_0x7ec9('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x7ec9('0x2'),_0x7ec9('0x7'),_0x7ec9('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x7ec9('0x6')]},'nameField':{'type':Sequelize[_0x7ec9('0x6')]},'customField':{'type':Sequelize[_0x7ec9('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7ec9('0x6')]}}; \ No newline at end of file +var _0xd112=['ENUM','string','customVariable','keyValue','picklist','STRING','variable','sequelize'];(function(_0x2f965f,_0x100aca){var _0x73f2b9=function(_0x25705d){while(--_0x25705d){_0x2f965f['push'](_0x2f965f['shift']());}};_0x73f2b9(++_0x100aca);}(_0xd112,0x6f));var _0x2d11=function(_0x19d24c,_0x62bc50){_0x19d24c=_0x19d24c-0x0;var _0x2fae8d=_0xd112[_0x19d24c];return _0x2fae8d;};'use strict';var Sequelize=require(_0x2d11('0x0'));module['exports']={'type':{'type':Sequelize[_0x2d11('0x1')](_0x2d11('0x2'),'variable',_0x2d11('0x3'),_0x2d11('0x4'),_0x2d11('0x5')),'defaultValue':_0x2d11('0x2')},'content':{'type':Sequelize[_0x2d11('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x2d11('0x1')]('string',_0x2d11('0x7'),_0x2d11('0x3'))},'keyContent':{'type':Sequelize[_0x2d11('0x6')]},'idField':{'type':Sequelize[_0x2d11('0x6')]},'nameField':{'type':Sequelize[_0x2d11('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2d11('0x6')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 0a0107a..f1752ab 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 _0x631b=['../../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','undefined','count','offset','limit','Content-Range','save','then','sendStatus','error','stack','index','map','ServicenowField','rawAttributes','fieldName','type','key','model','name','query','keys','intersection','fields','attributes','length','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','find','create','body','update','params','destroy','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis'];(function(_0x59fa95,_0x5667c9){var _0x20d08f=function(_0x4e4d27){while(--_0x4e4d27){_0x59fa95['push'](_0x59fa95['shift']());}};_0x20d08f(++_0x5667c9);}(_0x631b,0xd3));var _0xb631=function(_0x431c26,_0x4b8f47){_0x431c26=_0x431c26-0x0;var _0x3092fd=_0x631b[_0x431c26];return _0x3092fd;};'use strict';var emlformat=require(_0xb631('0x0'));var rimraf=require(_0xb631('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb631('0x2'));var rp=require(_0xb631('0x3'));var moment=require('moment');var BPromise=require(_0xb631('0x4'));var Mustache=require(_0xb631('0x5'));var util=require('util');var path=require(_0xb631('0x6'));var sox=require(_0xb631('0x7'));var csv=require(_0xb631('0x8'));var ejs=require(_0xb631('0x9'));var fs=require('fs');var fs_extra=require(_0xb631('0xa'));var _=require(_0xb631('0xb'));var squel=require('squel');var crypto=require(_0xb631('0xc'));var jsforce=require(_0xb631('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb631('0xe'));var Papa=require(_0xb631('0xf'));var Redis=require(_0xb631('0x10'));var authService=require(_0xb631('0x11'));var qs=require(_0xb631('0x12'));var as=require(_0xb631('0x13'));var hardwareService=require(_0xb631('0x14'));var logger=require(_0xb631('0x15'))(_0xb631('0x16'));var utils=require(_0xb631('0x17'));var config=require(_0xb631('0x18'));var licenseUtil=require(_0xb631('0x19'));var db=require(_0xb631('0x1a'))['db'];function respondWithStatusCode(_0x2085f6,_0x49efaf){_0x49efaf=_0x49efaf||0xcc;return function(_0x57573d){if(_0x57573d){return _0x2085f6['sendStatus'](_0x49efaf);}return _0x2085f6[_0xb631('0x1b')](_0x49efaf)[_0xb631('0x1c')]();};}function respondWithResult(_0x253be7,_0x2d20cb){_0x2d20cb=_0x2d20cb||0xc8;return function(_0x23d547){if(_0x23d547){return _0x253be7[_0xb631('0x1b')](_0x2d20cb)[_0xb631('0x1d')](_0x23d547);}};}function respondWithFilteredResult(_0x534e59,_0x295a4b){return function(_0x410ac7){if(_0x410ac7){var _0x4d3d6a=typeof _0x295a4b['offset']===_0xb631('0x1e')&&typeof _0x295a4b['limit']===_0xb631('0x1e');var _0x419a76=_0x410ac7[_0xb631('0x1f')];var _0x11f543=_0x4d3d6a?0x0:_0x295a4b['offset'];var _0x36624a=_0x4d3d6a?_0x410ac7[_0xb631('0x1f')]:_0x295a4b[_0xb631('0x20')]+_0x295a4b[_0xb631('0x21')];var _0x1dbede;if(_0x36624a>=_0x419a76){_0x36624a=_0x419a76;_0x1dbede=0xc8;}else{_0x1dbede=0xce;}_0x534e59['status'](_0x1dbede);return _0x534e59['set'](_0xb631('0x22'),_0x11f543+'-'+_0x36624a+'/'+_0x419a76)[_0xb631('0x1d')](_0x410ac7);}return null;};}function patchUpdates(_0x6efdcf){return function(_0xeb7dce){try{jsonpatch['apply'](_0xeb7dce,_0x6efdcf,!![]);}catch(_0xa46d99){return BPromise['reject'](_0xa46d99);}return _0xeb7dce[_0xb631('0x23')]();};}function saveUpdates(_0x55ad9b,_0x3cae21){return function(_0x49a8e9){if(_0x49a8e9){return _0x49a8e9['update'](_0x55ad9b)[_0xb631('0x24')](function(_0xeb7100){return _0xeb7100;});}return null;};}function removeEntity(_0x2b7840,_0x23a744){return function(_0x535cb6){if(_0x535cb6){return _0x535cb6['destroy']()['then'](function(){_0x2b7840['status'](0xcc)[_0xb631('0x1c')]();});}};}function handleEntityNotFound(_0x1b0fee,_0x42c444){return function(_0x3bab94){if(!_0x3bab94){_0x1b0fee[_0xb631('0x25')](0x194);}return _0x3bab94;};}function handleError(_0x1cf7cc,_0x12a7aa){_0x12a7aa=_0x12a7aa||0x1f4;return function(_0x103266){logger[_0xb631('0x26')](_0x103266[_0xb631('0x27')]);if(_0x103266['name']){delete _0x103266['name'];}_0x1cf7cc[_0xb631('0x1b')](_0x12a7aa)['send'](_0x103266);};}exports[_0xb631('0x28')]=function(_0x228cd8,_0x46bac9){var _0xf1d0e1={},_0x1b4e59={},_0x4e1fcb={'count':0x0,'rows':[]};var _0x6e8c2f=_[_0xb631('0x29')](db[_0xb631('0x2a')][_0xb631('0x2b')],function(_0x3699ff){return{'name':_0x3699ff[_0xb631('0x2c')],'type':_0x3699ff[_0xb631('0x2d')][_0xb631('0x2e')]};});_0x1b4e59[_0xb631('0x2f')]=_['map'](_0x6e8c2f,_0xb631('0x30'));_0x1b4e59[_0xb631('0x31')]=_[_0xb631('0x32')](_0x228cd8[_0xb631('0x31')]);_0x1b4e59['filters']=_[_0xb631('0x33')](_0x1b4e59[_0xb631('0x2f')],_0x1b4e59[_0xb631('0x31')]);_0xf1d0e1['attributes']=_[_0xb631('0x33')](_0x1b4e59[_0xb631('0x2f')],qs[_0xb631('0x34')](_0x228cd8['query'][_0xb631('0x34')]));_0xf1d0e1['attributes']=_0xf1d0e1[_0xb631('0x35')][_0xb631('0x36')]?_0xf1d0e1[_0xb631('0x35')]:_0x1b4e59[_0xb631('0x2f')];if(!_0x228cd8['query']['hasOwnProperty'](_0xb631('0x37'))){_0xf1d0e1[_0xb631('0x21')]=qs[_0xb631('0x21')](_0x228cd8[_0xb631('0x31')][_0xb631('0x21')]);_0xf1d0e1[_0xb631('0x20')]=qs[_0xb631('0x20')](_0x228cd8[_0xb631('0x31')][_0xb631('0x20')]);}_0xf1d0e1[_0xb631('0x38')]=qs[_0xb631('0x39')](_0x228cd8[_0xb631('0x31')][_0xb631('0x39')]);_0xf1d0e1['where']=qs[_0xb631('0x3a')](_[_0xb631('0x3b')](_0x228cd8[_0xb631('0x31')],_0x1b4e59[_0xb631('0x3a')]),_0x6e8c2f);if(_0x228cd8[_0xb631('0x31')][_0xb631('0x3c')]){_0xf1d0e1[_0xb631('0x3d')]=_[_0xb631('0x3e')](_0xf1d0e1[_0xb631('0x3d')],{'$or':_['map'](_0x6e8c2f,function(_0xd3f269){if(_0xd3f269[_0xb631('0x2d')]!==_0xb631('0x3f')){var _0x383004={};_0x383004[_0xd3f269['name']]={'$like':'%'+_0x228cd8[_0xb631('0x31')][_0xb631('0x3c')]+'%'};return _0x383004;}})});}_0xf1d0e1=_[_0xb631('0x3e')]({},_0xf1d0e1,_0x228cd8[_0xb631('0x40')]);var _0x50d400={'where':_0xf1d0e1[_0xb631('0x3d')]};return db[_0xb631('0x2a')][_0xb631('0x1f')](_0x50d400)[_0xb631('0x24')](function(_0x2d8c5b){_0x4e1fcb[_0xb631('0x1f')]=_0x2d8c5b;if(_0x228cd8[_0xb631('0x31')][_0xb631('0x41')]){_0xf1d0e1[_0xb631('0x42')]=[{'all':!![]}];}return db['ServicenowField'][_0xb631('0x43')](_0xf1d0e1);})[_0xb631('0x24')](function(_0x20b94c){_0x4e1fcb[_0xb631('0x44')]=_0x20b94c;return _0x4e1fcb;})[_0xb631('0x24')](respondWithFilteredResult(_0x46bac9,_0xf1d0e1))[_0xb631('0x45')](handleError(_0x46bac9,null));};exports['show']=function(_0x2ef93e,_0x1feab1){var _0x50fe8b={'raw':!![],'where':{'id':_0x2ef93e['params']['id']}},_0x9c1c73={};_0x9c1c73[_0xb631('0x2f')]=_[_0xb631('0x32')](db[_0xb631('0x2a')][_0xb631('0x2b')]);_0x9c1c73['query']=_['keys'](_0x2ef93e[_0xb631('0x31')]);_0x9c1c73[_0xb631('0x3a')]=_[_0xb631('0x33')](_0x9c1c73[_0xb631('0x2f')],_0x9c1c73[_0xb631('0x31')]);_0x50fe8b[_0xb631('0x35')]=_[_0xb631('0x33')](_0x9c1c73['model'],qs[_0xb631('0x34')](_0x2ef93e[_0xb631('0x31')]['fields']));_0x50fe8b[_0xb631('0x35')]=_0x50fe8b[_0xb631('0x35')][_0xb631('0x36')]?_0x50fe8b[_0xb631('0x35')]:_0x9c1c73['model'];if(_0x2ef93e['query'][_0xb631('0x41')]){_0x50fe8b['include']=[{'all':!![]}];}_0x50fe8b=_[_0xb631('0x3e')]({},_0x50fe8b,_0x2ef93e[_0xb631('0x40')]);return db[_0xb631('0x2a')][_0xb631('0x46')](_0x50fe8b)['then'](handleEntityNotFound(_0x1feab1,null))[_0xb631('0x24')](respondWithResult(_0x1feab1,null))['catch'](handleError(_0x1feab1,null));};exports[_0xb631('0x47')]=function(_0x129c63,_0x271104){return db[_0xb631('0x2a')][_0xb631('0x47')](_0x129c63[_0xb631('0x48')],{})[_0xb631('0x24')](respondWithResult(_0x271104,0xc9))[_0xb631('0x45')](handleError(_0x271104,null));};exports[_0xb631('0x49')]=function(_0x205ff6,_0x412aad){if(_0x205ff6[_0xb631('0x48')]['id']){delete _0x205ff6['body']['id'];}return db[_0xb631('0x2a')][_0xb631('0x46')]({'where':{'id':_0x205ff6[_0xb631('0x4a')]['id']}})[_0xb631('0x24')](handleEntityNotFound(_0x412aad,null))['then'](saveUpdates(_0x205ff6['body'],null))['then'](respondWithResult(_0x412aad,null))[_0xb631('0x45')](handleError(_0x412aad,null));};exports[_0xb631('0x4b')]=function(_0xe3c595,_0x39b338){return db['ServicenowField'][_0xb631('0x46')]({'where':{'id':_0xe3c595[_0xb631('0x4a')]['id']}})[_0xb631('0x24')](handleEntityNotFound(_0x39b338,null))[_0xb631('0x24')](removeEntity(_0x39b338,null))['catch'](handleError(_0x39b338,null));}; \ No newline at end of file +var _0x1d24=['rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','length','find','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','limit','count','offset','set','apply','reject','update','then','destroy','end','sendStatus','error','name','send','index','map','ServicenowField'];(function(_0x23f04f,_0x200962){var _0x1c1a08=function(_0x332b6a){while(--_0x332b6a){_0x23f04f['push'](_0x23f04f['shift']());}};_0x1c1a08(++_0x200962);}(_0x1d24,0xfa));var _0x41d2=function(_0x3f09a9,_0x2a1758){_0x3f09a9=_0x3f09a9-0x0;var _0x854a6d=_0x1d24[_0x3f09a9];return _0x854a6d;};'use strict';var emlformat=require(_0x41d2('0x0'));var rimraf=require(_0x41d2('0x1'));var zipdir=require(_0x41d2('0x2'));var jsonpatch=require(_0x41d2('0x3'));var rp=require(_0x41d2('0x4'));var moment=require(_0x41d2('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x41d2('0x6'));var util=require(_0x41d2('0x7'));var path=require(_0x41d2('0x8'));var sox=require(_0x41d2('0x9'));var csv=require(_0x41d2('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x41d2('0xb'));var squel=require(_0x41d2('0xc'));var crypto=require(_0x41d2('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x41d2('0xe'));var toCsv=require(_0x41d2('0xa'));var querystring=require('querystring');var Papa=require(_0x41d2('0xf'));var Redis=require(_0x41d2('0x10'));var authService=require(_0x41d2('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x41d2('0x12'));var hardwareService=require(_0x41d2('0x13'));var logger=require(_0x41d2('0x14'))(_0x41d2('0x15'));var utils=require(_0x41d2('0x16'));var config=require(_0x41d2('0x17'));var licenseUtil=require(_0x41d2('0x18'));var db=require(_0x41d2('0x19'))['db'];function respondWithStatusCode(_0x425d0f,_0x219a42){_0x219a42=_0x219a42||0xcc;return function(_0x32a55c){if(_0x32a55c){return _0x425d0f['sendStatus'](_0x219a42);}return _0x425d0f['status'](_0x219a42)['end']();};}function respondWithResult(_0x26737f,_0x38c941){_0x38c941=_0x38c941||0xc8;return function(_0x4e31e7){if(_0x4e31e7){return _0x26737f[_0x41d2('0x1a')](_0x38c941)[_0x41d2('0x1b')](_0x4e31e7);}};}function respondWithFilteredResult(_0x5a5a24,_0x3348c7){return function(_0x193e99){if(_0x193e99){var _0x4e4c16=typeof _0x3348c7['offset']===_0x41d2('0x1c')&&typeof _0x3348c7[_0x41d2('0x1d')]===_0x41d2('0x1c');var _0x29172f=_0x193e99[_0x41d2('0x1e')];var _0x48ea08=_0x4e4c16?0x0:_0x3348c7['offset'];var _0x223adc=_0x4e4c16?_0x193e99[_0x41d2('0x1e')]:_0x3348c7[_0x41d2('0x1f')]+_0x3348c7[_0x41d2('0x1d')];var _0x1b6955;if(_0x223adc>=_0x29172f){_0x223adc=_0x29172f;_0x1b6955=0xc8;}else{_0x1b6955=0xce;}_0x5a5a24[_0x41d2('0x1a')](_0x1b6955);return _0x5a5a24[_0x41d2('0x20')]('Content-Range',_0x48ea08+'-'+_0x223adc+'/'+_0x29172f)[_0x41d2('0x1b')](_0x193e99);}return null;};}function patchUpdates(_0x365c8d){return function(_0x20192e){try{jsonpatch[_0x41d2('0x21')](_0x20192e,_0x365c8d,!![]);}catch(_0xbf7208){return BPromise[_0x41d2('0x22')](_0xbf7208);}return _0x20192e['save']();};}function saveUpdates(_0x57bd6e,_0x549618){return function(_0xcc54f5){if(_0xcc54f5){return _0xcc54f5[_0x41d2('0x23')](_0x57bd6e)[_0x41d2('0x24')](function(_0x30890e){return _0x30890e;});}return null;};}function removeEntity(_0x52098c,_0x28a4d0){return function(_0x471b51){if(_0x471b51){return _0x471b51[_0x41d2('0x25')]()[_0x41d2('0x24')](function(){_0x52098c['status'](0xcc)[_0x41d2('0x26')]();});}};}function handleEntityNotFound(_0x388f03,_0x4552cd){return function(_0x34167d){if(!_0x34167d){_0x388f03[_0x41d2('0x27')](0x194);}return _0x34167d;};}function handleError(_0x52a5bd,_0x26dfd){_0x26dfd=_0x26dfd||0x1f4;return function(_0x3161b9){logger[_0x41d2('0x28')](_0x3161b9['stack']);if(_0x3161b9[_0x41d2('0x29')]){delete _0x3161b9[_0x41d2('0x29')];}_0x52a5bd['status'](_0x26dfd)[_0x41d2('0x2a')](_0x3161b9);};}exports[_0x41d2('0x2b')]=function(_0xf8ce2e,_0x3e9edb){var _0x46bf56={},_0xee0aff={},_0x2f2bfb={'count':0x0,'rows':[]};var _0x4a33e3=_[_0x41d2('0x2c')](db[_0x41d2('0x2d')][_0x41d2('0x2e')],function(_0x3bfd25){return{'name':_0x3bfd25[_0x41d2('0x2f')],'type':_0x3bfd25[_0x41d2('0x30')]['key']};});_0xee0aff[_0x41d2('0x31')]=_['map'](_0x4a33e3,_0x41d2('0x29'));_0xee0aff[_0x41d2('0x32')]=_[_0x41d2('0x33')](_0xf8ce2e[_0x41d2('0x32')]);_0xee0aff[_0x41d2('0x34')]=_[_0x41d2('0x35')](_0xee0aff[_0x41d2('0x31')],_0xee0aff[_0x41d2('0x32')]);_0x46bf56[_0x41d2('0x36')]=_[_0x41d2('0x35')](_0xee0aff['model'],qs['fields'](_0xf8ce2e['query'][_0x41d2('0x37')]));_0x46bf56[_0x41d2('0x36')]=_0x46bf56['attributes']['length']?_0x46bf56[_0x41d2('0x36')]:_0xee0aff[_0x41d2('0x31')];if(!_0xf8ce2e[_0x41d2('0x32')]['hasOwnProperty'](_0x41d2('0x38'))){_0x46bf56['limit']=qs[_0x41d2('0x1d')](_0xf8ce2e[_0x41d2('0x32')][_0x41d2('0x1d')]);_0x46bf56[_0x41d2('0x1f')]=qs[_0x41d2('0x1f')](_0xf8ce2e['query'][_0x41d2('0x1f')]);}_0x46bf56[_0x41d2('0x39')]=qs[_0x41d2('0x3a')](_0xf8ce2e['query'][_0x41d2('0x3a')]);_0x46bf56[_0x41d2('0x3b')]=qs['filters'](_[_0x41d2('0x3c')](_0xf8ce2e[_0x41d2('0x32')],_0xee0aff[_0x41d2('0x34')]),_0x4a33e3);if(_0xf8ce2e[_0x41d2('0x32')][_0x41d2('0x3d')]){_0x46bf56[_0x41d2('0x3b')]=_[_0x41d2('0x3e')](_0x46bf56[_0x41d2('0x3b')],{'$or':_['map'](_0x4a33e3,function(_0x2be59f){if(_0x2be59f[_0x41d2('0x30')]!=='VIRTUAL'){var _0x112223={};_0x112223[_0x2be59f[_0x41d2('0x29')]]={'$like':'%'+_0xf8ce2e[_0x41d2('0x32')]['filter']+'%'};return _0x112223;}})});}_0x46bf56=_[_0x41d2('0x3e')]({},_0x46bf56,_0xf8ce2e[_0x41d2('0x3f')]);var _0x5a7bf8={'where':_0x46bf56[_0x41d2('0x3b')]};return db[_0x41d2('0x2d')][_0x41d2('0x1e')](_0x5a7bf8)['then'](function(_0x2c3c82){_0x2f2bfb[_0x41d2('0x1e')]=_0x2c3c82;if(_0xf8ce2e[_0x41d2('0x32')][_0x41d2('0x40')]){_0x46bf56[_0x41d2('0x41')]=[{'all':!![]}];}return db['ServicenowField'][_0x41d2('0x42')](_0x46bf56);})[_0x41d2('0x24')](function(_0x1b585a){_0x2f2bfb[_0x41d2('0x43')]=_0x1b585a;return _0x2f2bfb;})[_0x41d2('0x24')](respondWithFilteredResult(_0x3e9edb,_0x46bf56))[_0x41d2('0x44')](handleError(_0x3e9edb,null));};exports[_0x41d2('0x45')]=function(_0x423d07,_0xe65635){var _0x2f031e={'raw':!![],'where':{'id':_0x423d07[_0x41d2('0x46')]['id']}},_0x59a294={};_0x59a294[_0x41d2('0x31')]=_[_0x41d2('0x33')](db[_0x41d2('0x2d')]['rawAttributes']);_0x59a294[_0x41d2('0x32')]=_[_0x41d2('0x33')](_0x423d07['query']);_0x59a294[_0x41d2('0x34')]=_[_0x41d2('0x35')](_0x59a294[_0x41d2('0x31')],_0x59a294['query']);_0x2f031e[_0x41d2('0x36')]=_[_0x41d2('0x35')](_0x59a294[_0x41d2('0x31')],qs[_0x41d2('0x37')](_0x423d07[_0x41d2('0x32')][_0x41d2('0x37')]));_0x2f031e[_0x41d2('0x36')]=_0x2f031e['attributes'][_0x41d2('0x47')]?_0x2f031e[_0x41d2('0x36')]:_0x59a294[_0x41d2('0x31')];if(_0x423d07[_0x41d2('0x32')][_0x41d2('0x40')]){_0x2f031e[_0x41d2('0x41')]=[{'all':!![]}];}_0x2f031e=_[_0x41d2('0x3e')]({},_0x2f031e,_0x423d07[_0x41d2('0x3f')]);return db['ServicenowField'][_0x41d2('0x48')](_0x2f031e)[_0x41d2('0x24')](handleEntityNotFound(_0xe65635,null))[_0x41d2('0x24')](respondWithResult(_0xe65635,null))['catch'](handleError(_0xe65635,null));};exports['create']=function(_0x451cd9,_0x3a2a3e){return db['ServicenowField']['create'](_0x451cd9[_0x41d2('0x49')],{})[_0x41d2('0x24')](respondWithResult(_0x3a2a3e,0xc9))['catch'](handleError(_0x3a2a3e,null));};exports['update']=function(_0x44055d,_0x51ba58){if(_0x44055d['body']['id']){delete _0x44055d['body']['id'];}return db[_0x41d2('0x2d')][_0x41d2('0x48')]({'where':{'id':_0x44055d['params']['id']}})[_0x41d2('0x24')](handleEntityNotFound(_0x51ba58,null))['then'](saveUpdates(_0x44055d[_0x41d2('0x49')],null))['then'](respondWithResult(_0x51ba58,null))['catch'](handleError(_0x51ba58,null));};exports['destroy']=function(_0x2ce7a1,_0x430ec6){return db['ServicenowField']['find']({'where':{'id':_0x2ce7a1[_0x41d2('0x46')]['id']}})[_0x41d2('0x24')](handleEntityNotFound(_0x430ec6,null))['then'](removeEntity(_0x430ec6,null))[_0x41d2('0x44')](handleError(_0x430ec6,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 35dd134..bddda18 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 _0x10ed=['define','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./intServicenowField.attributes','exports'];(function(_0x46e23e,_0x42bdae){var _0x11de1b=function(_0x1697e4){while(--_0x1697e4){_0x46e23e['push'](_0x46e23e['shift']());}};_0x11de1b(++_0x42bdae);}(_0x10ed,0x147));var _0xd10e=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x10ed[_0x4b055c];return _0x4b62bb;};'use strict';var _=require('lodash');var util=require(_0xd10e('0x0'));var logger=require(_0xd10e('0x1'))(_0xd10e('0x2'));var moment=require(_0xd10e('0x3'));var BPromise=require(_0xd10e('0x4'));var rp=require(_0xd10e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd10e('0x6'));var attributes=require(_0xd10e('0x7'));module[_0xd10e('0x8')]=function(_0x2e53c8,_0x59d60d){return _0x2e53c8[_0xd10e('0x9')](_0xd10e('0xa'),attributes,{'tableName':_0xd10e('0xb'),'paranoid':![],'indexes':[{'name':_0xd10e('0xc'),'fields':[_0xd10e('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5d9b=['idField','lodash','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowField.attributes','exports','ServicenowField','servicenow_unique_index'];(function(_0xf49de7,_0x5c45e6){var _0xb9ea94=function(_0xaa4221){while(--_0xaa4221){_0xf49de7['push'](_0xf49de7['shift']());}};_0xb9ea94(++_0x5c45e6);}(_0x5d9b,0x85));var _0xb5d9=function(_0x5a3ad3,_0x569fdb){_0x5a3ad3=_0x5a3ad3-0x0;var _0x4de348=_0x5d9b[_0x5a3ad3];return _0x4de348;};'use strict';var _=require(_0xb5d9('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xb5d9('0x1'));var BPromise=require(_0xb5d9('0x2'));var rp=require(_0xb5d9('0x3'));var fs=require('fs');var path=require(_0xb5d9('0x4'));var rimraf=require(_0xb5d9('0x5'));var config=require(_0xb5d9('0x6'));var attributes=require(_0xb5d9('0x7'));module[_0xb5d9('0x8')]=function(_0x101212,_0x5bae82){return _0x101212['define'](_0xb5d9('0x9'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0xb5d9('0xa'),'fields':[_0xb5d9('0xb'),'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 57bafe7..880babb 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 _0xf4eb=['ServicenowField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x3af68e,_0x384315){var _0x3e6d5b=function(_0x21e40c){while(--_0x21e40c){_0x3af68e['push'](_0x3af68e['shift']());}};_0x3e6d5b(++_0x384315);}(_0xf4eb,0xec));var _0xbf4e=function(_0xda1d52,_0x5e610d){_0xda1d52=_0xda1d52-0x0;var _0x115a5b=_0xf4eb[_0xda1d52];return _0x115a5b;};'use strict';var _=require(_0xbf4e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf4e('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbf4e('0x2'))(_0xbf4e('0x3'));var config=require(_0xbf4e('0x4'));var jayson=require(_0xbf4e('0x5'));var client=jayson[_0xbf4e('0x6')][_0xbf4e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x15b99f,_0x540736,_0x449d55){return new BPromise(function(_0x5013c2,_0x5e23d4){return client[_0xbf4e('0x8')](_0x15b99f,_0x449d55)[_0xbf4e('0x9')](function(_0xcc4097){logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));logger[_0xbf4e('0xd')]('ServicenowField,\x20%s,\x20%s,\x20%s',_0x540736,'request\x20sent',JSON[_0xbf4e('0xe')](_0xcc4097));if(_0xcc4097['error']){if(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x10')]===0x1f4){logger['error'](_0xbf4e('0xb'),_0x540736,_0xcc4097['error']['message']);return _0x5e23d4(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);}logger[_0xbf4e('0xf')](_0xbf4e('0xb'),_0x540736,_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);return _0x5013c2(_0xcc4097['error']['message']);}else{logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));_0x5013c2(_0xcc4097['result'][_0xbf4e('0x11')]);}})[_0xbf4e('0x12')](function(_0x912fc0){logger[_0xbf4e('0xf')]('ServicenowField,\x20%s,\x20%s',_0x540736,_0x912fc0);_0x5e23d4(_0x912fc0);});});} \ No newline at end of file +var _0xb7e7=['ServicenowField,\x20%s,\x20%s','debug','ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info'];(function(_0x35bdde,_0x1e6e28){var _0xd93cc7=function(_0x57569d){while(--_0x57569d){_0x35bdde['push'](_0x35bdde['shift']());}};_0xd93cc7(++_0x1e6e28);}(_0xb7e7,0x121));var _0x7b7e=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0xb7e7[_0xd1d19a];return _0x52a79d;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var moment=require(_0x7b7e('0x1'));var BPromise=require('bluebird');var rs=require(_0x7b7e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7b7e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7b7e('0x4'))(_0x7b7e('0x5'));var config=require(_0x7b7e('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7b7e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x372bde,_0x7f87e0,_0x55ce81){return new BPromise(function(_0x42b871,_0x223587){return client[_0x7b7e('0x8')](_0x372bde,_0x55ce81)[_0x7b7e('0x9')](function(_0x148964){logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');logger[_0x7b7e('0xc')](_0x7b7e('0xd'),_0x7f87e0,_0x7b7e('0xe'),JSON[_0x7b7e('0xf')](_0x148964));if(_0x148964[_0x7b7e('0x10')]){if(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x11')]===0x1f4){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x223587(_0x148964[_0x7b7e('0x10')]['message']);}logger[_0x7b7e('0x10')]('ServicenowField,\x20%s,\x20%s',_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x42b871(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x12')]);}else{logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');_0x42b871(_0x148964['result'][_0x7b7e('0x12')]);}})[_0x7b7e('0x13')](function(_0x27f999){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x27f999);_0x223587(_0x27f999);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index a4b82b4..d4afdb5 100644 --- a/server/api/intSugarcrmAccount/index.js +++ b/server/api/intSugarcrmAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x57b909,_0x3587ad){var _0xb4405=function(_0x319869){while(--_0x319869){_0x57b909['push'](_0x57b909['shift']());}};_0xb4405(++_0x3587ad);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x4802f8,_0x3534a8){var _0x253afe=function(_0x3f0cca){while(--_0x3f0cca){_0x4802f8['push'](_0x4802f8['shift']());}};_0x253afe(++_0x3534a8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa9e0[_0x46aff0];return _0x9d78cf;};'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 53cbf73..4130a65 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(_0xded5dd,_0x7a01ba){var _0x4031e2=function(_0x2a2c94){while(--_0x2a2c94){_0xded5dd['push'](_0xded5dd['shift']());}};_0x4031e2(++_0x7a01ba);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'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(_0x3324ac,_0x455517){var _0x1ed401=function(_0x2f9010){while(--_0x2f9010){_0x3324ac['push'](_0x3324ac['shift']());}};_0x1ed401(++_0x455517);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'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 1a247cd..fde7336 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 _0x60e1=['username','password','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','JSON','stringify','xCALLY\x20Motion\x20Integration','Invalid\x20Login','get_module_fields','Calls','values','module_fields','remove','includes','label','endsWith','value','test','statusCode','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','jsforce','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','offset','undefined','count','set','Content-Range','json','apply','save','then','error','stack','name','send','map','SugarcrmAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','rows','catch','show','params','length','includeAll','find','create','body','destroy','getConfigurations','SugarcrmConfiguration','hasOwnProperty','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SugarcrmField','getFields','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction'];(function(_0xab0515,_0x4b8ab2){var _0x443d59=function(_0xfd6c59){while(--_0xfd6c59){_0xab0515['push'](_0xab0515['shift']());}};_0x443d59(++_0x4b8ab2);}(_0x60e1,0x92));var _0x160e=function(_0x390747,_0x4a9422){_0x390747=_0x390747-0x0;var _0x1cfe82=_0x60e1[_0x390747];return _0x1cfe82;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x160e('0x0'));var zipdir=require(_0x160e('0x1'));var jsonpatch=require(_0x160e('0x2'));var rp=require(_0x160e('0x3'));var moment=require('moment');var BPromise=require(_0x160e('0x4'));var Mustache=require(_0x160e('0x5'));var util=require(_0x160e('0x6'));var path=require('path');var sox=require(_0x160e('0x7'));var csv=require(_0x160e('0x8'));var ejs=require(_0x160e('0x9'));var fs=require('fs');var fs_extra=require(_0x160e('0xa'));var _=require(_0x160e('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x160e('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x160e('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x160e('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x160e('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x160e('0xf'));var logger=require(_0x160e('0x10'))(_0x160e('0x11'));var utils=require(_0x160e('0x12'));var config=require(_0x160e('0x13'));var licenseUtil=require(_0x160e('0x14'));var db=require(_0x160e('0x15'))['db'];var integrations=require(_0x160e('0x16'));function respondWithStatusCode(_0x47fc94,_0x2757a7){_0x2757a7=_0x2757a7||0xcc;return function(_0x16dfe7){if(_0x16dfe7){return _0x47fc94[_0x160e('0x17')](_0x2757a7);}return _0x47fc94['status'](_0x2757a7)[_0x160e('0x18')]();};}function respondWithResult(_0x11447a,_0x4b78bc){_0x4b78bc=_0x4b78bc||0xc8;return function(_0x51be40){if(_0x51be40){return _0x11447a[_0x160e('0x19')](_0x4b78bc)['json'](_0x51be40);}};}function respondWithFilteredResult(_0x5d77b6,_0x262fec){return function(_0x2161ef){if(_0x2161ef){var _0x458fc0=typeof _0x262fec[_0x160e('0x1a')]===_0x160e('0x1b')&&typeof _0x262fec['limit']===_0x160e('0x1b');var _0x4e64a8=_0x2161ef[_0x160e('0x1c')];var _0x1f2ce3=_0x458fc0?0x0:_0x262fec[_0x160e('0x1a')];var _0x58bbea=_0x458fc0?_0x2161ef[_0x160e('0x1c')]:_0x262fec[_0x160e('0x1a')]+_0x262fec['limit'];var _0x217bfc;if(_0x58bbea>=_0x4e64a8){_0x58bbea=_0x4e64a8;_0x217bfc=0xc8;}else{_0x217bfc=0xce;}_0x5d77b6[_0x160e('0x19')](_0x217bfc);return _0x5d77b6[_0x160e('0x1d')](_0x160e('0x1e'),_0x1f2ce3+'-'+_0x58bbea+'/'+_0x4e64a8)[_0x160e('0x1f')](_0x2161ef);}return null;};}function patchUpdates(_0x18e994){return function(_0x43aee4){try{jsonpatch[_0x160e('0x20')](_0x43aee4,_0x18e994,!![]);}catch(_0x2a320e){return BPromise['reject'](_0x2a320e);}return _0x43aee4[_0x160e('0x21')]();};}function saveUpdates(_0x19a3e7,_0x4e2622){return function(_0x4585d5){if(_0x4585d5){return _0x4585d5['update'](_0x19a3e7)[_0x160e('0x22')](function(_0x1186aa){return _0x1186aa;});}return null;};}function removeEntity(_0x2e3fc4,_0x29e761){return function(_0x254ffd){if(_0x254ffd){return _0x254ffd['destroy']()[_0x160e('0x22')](function(){_0x2e3fc4[_0x160e('0x19')](0xcc)[_0x160e('0x18')]();});}};}function handleEntityNotFound(_0x5010bf,_0x330b5d){return function(_0x402478){if(!_0x402478){_0x5010bf[_0x160e('0x17')](0x194);}return _0x402478;};}function handleError(_0x3cb8ee,_0x333098){_0x333098=_0x333098||0x1f4;return function(_0x18c899){logger[_0x160e('0x23')](_0x18c899[_0x160e('0x24')]);if(_0x18c899[_0x160e('0x25')]){delete _0x18c899[_0x160e('0x25')];}_0x3cb8ee[_0x160e('0x19')](_0x333098)[_0x160e('0x26')](_0x18c899);};}exports['index']=function(_0x56dc23,_0x1f5a4b){var _0x31743a={},_0x3e249c={},_0x4a9e46={'count':0x0,'rows':[]};var _0x415411=_[_0x160e('0x27')](db[_0x160e('0x28')][_0x160e('0x29')],function(_0x2ca448){return{'name':_0x2ca448[_0x160e('0x2a')],'type':_0x2ca448[_0x160e('0x2b')]['key']};});_0x3e249c[_0x160e('0x2c')]=_[_0x160e('0x27')](_0x415411,_0x160e('0x25'));_0x3e249c[_0x160e('0x2d')]=_[_0x160e('0x2e')](_0x56dc23[_0x160e('0x2d')]);_0x3e249c[_0x160e('0x2f')]=_[_0x160e('0x30')](_0x3e249c['model'],_0x3e249c[_0x160e('0x2d')]);_0x31743a[_0x160e('0x31')]=_[_0x160e('0x30')](_0x3e249c[_0x160e('0x2c')],qs[_0x160e('0x32')](_0x56dc23['query'][_0x160e('0x32')]));_0x31743a[_0x160e('0x31')]=_0x31743a[_0x160e('0x31')]['length']?_0x31743a[_0x160e('0x31')]:_0x3e249c[_0x160e('0x2c')];if(!_0x56dc23['query']['hasOwnProperty']('nolimit')){_0x31743a[_0x160e('0x33')]=qs['limit'](_0x56dc23[_0x160e('0x2d')][_0x160e('0x33')]);_0x31743a[_0x160e('0x1a')]=qs[_0x160e('0x1a')](_0x56dc23[_0x160e('0x2d')][_0x160e('0x1a')]);}_0x31743a[_0x160e('0x34')]=qs[_0x160e('0x35')](_0x56dc23['query'][_0x160e('0x35')]);_0x31743a['where']=qs[_0x160e('0x2f')](_[_0x160e('0x36')](_0x56dc23[_0x160e('0x2d')],_0x3e249c['filters']),_0x415411);if(_0x56dc23[_0x160e('0x2d')][_0x160e('0x37')]){_0x31743a[_0x160e('0x38')]=_[_0x160e('0x39')](_0x31743a['where'],{'$or':_[_0x160e('0x27')](_0x415411,function(_0x31ce6e){if(_0x31ce6e[_0x160e('0x2b')]!==_0x160e('0x3a')){var _0x343b8c={};_0x343b8c[_0x31ce6e['name']]={'$like':'%'+_0x56dc23[_0x160e('0x2d')]['filter']+'%'};return _0x343b8c;}})});}_0x31743a=_[_0x160e('0x39')]({},_0x31743a,_0x56dc23[_0x160e('0x3b')]);var _0x322a79={'where':_0x31743a[_0x160e('0x38')]};return db['SugarcrmAccount']['count'](_0x322a79)[_0x160e('0x22')](function(_0x32b2e0){_0x4a9e46[_0x160e('0x1c')]=_0x32b2e0;if(_0x56dc23[_0x160e('0x2d')]['includeAll']){_0x31743a[_0x160e('0x3c')]=[{'all':!![]}];}return db[_0x160e('0x28')]['findAll'](_0x31743a);})[_0x160e('0x22')](function(_0x15d3bc){_0x4a9e46[_0x160e('0x3d')]=_0x15d3bc;return _0x4a9e46;})[_0x160e('0x22')](respondWithFilteredResult(_0x1f5a4b,_0x31743a))[_0x160e('0x3e')](handleError(_0x1f5a4b,null));};exports[_0x160e('0x3f')]=function(_0x1876bf,_0x44199a){var _0x3dff38={'raw':![],'where':{'id':_0x1876bf[_0x160e('0x40')]['id']}},_0x13d445={};_0x13d445[_0x160e('0x2c')]=_[_0x160e('0x2e')](db[_0x160e('0x28')][_0x160e('0x29')]);_0x13d445[_0x160e('0x2d')]=_[_0x160e('0x2e')](_0x1876bf[_0x160e('0x2d')]);_0x13d445[_0x160e('0x2f')]=_[_0x160e('0x30')](_0x13d445[_0x160e('0x2c')],_0x13d445['query']);_0x3dff38[_0x160e('0x31')]=_['intersection'](_0x13d445[_0x160e('0x2c')],qs[_0x160e('0x32')](_0x1876bf['query'][_0x160e('0x32')]));_0x3dff38[_0x160e('0x31')]=_0x3dff38[_0x160e('0x31')][_0x160e('0x41')]?_0x3dff38[_0x160e('0x31')]:_0x13d445[_0x160e('0x2c')];if(_0x1876bf[_0x160e('0x2d')][_0x160e('0x42')]){_0x3dff38[_0x160e('0x3c')]=[{'all':!![]}];}_0x3dff38=_[_0x160e('0x39')]({},_0x3dff38,_0x1876bf['options']);return db[_0x160e('0x28')][_0x160e('0x43')](_0x3dff38)[_0x160e('0x22')](handleEntityNotFound(_0x44199a,null))[_0x160e('0x22')](respondWithResult(_0x44199a,null))['catch'](handleError(_0x44199a,null));};exports[_0x160e('0x44')]=function(_0x43037d,_0x29194b){return db[_0x160e('0x28')][_0x160e('0x44')](_0x43037d['body'],{})[_0x160e('0x22')](respondWithResult(_0x29194b,0xc9))[_0x160e('0x3e')](handleError(_0x29194b,null));};exports['update']=function(_0x1ba489,_0x2eb499){if(_0x1ba489[_0x160e('0x45')]['id']){delete _0x1ba489[_0x160e('0x45')]['id'];}return db[_0x160e('0x28')]['find']({'where':{'id':_0x1ba489[_0x160e('0x40')]['id']}})[_0x160e('0x22')](handleEntityNotFound(_0x2eb499,null))[_0x160e('0x22')](saveUpdates(_0x1ba489[_0x160e('0x45')],null))[_0x160e('0x22')](respondWithResult(_0x2eb499,null))[_0x160e('0x3e')](handleError(_0x2eb499,null));};exports[_0x160e('0x46')]=function(_0x4bc821,_0x455890){return db['SugarcrmAccount'][_0x160e('0x43')]({'where':{'id':_0x4bc821[_0x160e('0x40')]['id']}})[_0x160e('0x22')](handleEntityNotFound(_0x455890,null))[_0x160e('0x22')](removeEntity(_0x455890,null))[_0x160e('0x3e')](handleError(_0x455890,null));};exports[_0x160e('0x47')]=function(_0x3bdac4,_0x55ae83,_0x3c80d2){var _0x397edc={};var _0x2bd4e4={};var _0x3dbe9c;var _0xd9a5a6;return db[_0x160e('0x28')]['findOne']({'where':{'id':_0x3bdac4[_0x160e('0x40')]['id']}})[_0x160e('0x22')](handleEntityNotFound(_0x55ae83,null))[_0x160e('0x22')](function(_0x3c6a19){if(_0x3c6a19){_0x3dbe9c=_0x3c6a19;_0x2bd4e4['model']=_['keys'](db[_0x160e('0x48')][_0x160e('0x29')]);_0x2bd4e4[_0x160e('0x2d')]=_[_0x160e('0x2e')](_0x3bdac4[_0x160e('0x2d')]);_0x2bd4e4[_0x160e('0x2f')]=_[_0x160e('0x30')](_0x2bd4e4['model'],_0x2bd4e4[_0x160e('0x2d')]);_0x397edc[_0x160e('0x31')]=_[_0x160e('0x30')](_0x2bd4e4[_0x160e('0x2c')],qs[_0x160e('0x32')](_0x3bdac4[_0x160e('0x2d')][_0x160e('0x32')]));_0x397edc['attributes']=_0x397edc[_0x160e('0x31')][_0x160e('0x41')]?_0x397edc['attributes']:_0x2bd4e4['model'];_0x397edc['order']=qs[_0x160e('0x35')](_0x3bdac4['query'][_0x160e('0x35')]);_0x397edc[_0x160e('0x38')]=qs[_0x160e('0x2f')](_['pick'](_0x3bdac4[_0x160e('0x2d')],_0x2bd4e4['filters']));if(_0x3bdac4[_0x160e('0x2d')][_0x160e('0x37')]){_0x397edc[_0x160e('0x38')]=_['merge'](_0x397edc['where'],{'$or':_[_0x160e('0x27')](_0x397edc['attributes'],function(_0xae1c1f){var _0x1f369b={};_0x1f369b[_0xae1c1f]={'$like':'%'+_0x3bdac4[_0x160e('0x2d')][_0x160e('0x37')]+'%'};return _0x1f369b;})});}_0x397edc=_[_0x160e('0x39')]({},_0x397edc,_0x3bdac4[_0x160e('0x3b')]);return _0x3dbe9c['getConfigurations'](_0x397edc);}})[_0x160e('0x22')](function(_0x33a997){if(_0x33a997){_0xd9a5a6=_0x33a997[_0x160e('0x41')];if(!_0x3bdac4[_0x160e('0x2d')][_0x160e('0x49')](_0x160e('0x4a'))){_0x397edc[_0x160e('0x33')]=qs[_0x160e('0x33')](_0x3bdac4['query'][_0x160e('0x33')]);_0x397edc[_0x160e('0x1a')]=qs[_0x160e('0x1a')](_0x3bdac4['query'][_0x160e('0x1a')]);}return _0x3dbe9c[_0x160e('0x47')](_0x397edc);}})[_0x160e('0x22')](function(_0x283eee){if(_0x283eee){return _0x283eee?{'count':_0xd9a5a6,'rows':_0x283eee}:null;}})[_0x160e('0x22')](respondWithResult(_0x55ae83,null))['catch'](handleError(_0x55ae83,null));};exports[_0x160e('0x4b')]=function(_0x7dde80,_0x315803,_0x1312db){if(_0x7dde80[_0x160e('0x45')]['id']){delete _0x7dde80['body']['id'];}return db[_0x160e('0x28')]['findOne']({'where':{'id':_0x7dde80['params']['id']}})['then'](handleEntityNotFound(_0x315803,null))['then'](function(_0xa2ec0d){if(_0xa2ec0d){_0x7dde80[_0x160e('0x45')][_0x160e('0x4c')]=_0xa2ec0d['id'];_0x7dde80[_0x160e('0x45')][_0x160e('0x4d')]=integrations[_0x160e('0x4e')](_0x7dde80[_0x160e('0x45')][_0x160e('0x4f')],_0x7dde80[_0x160e('0x45')]['type']);_0x7dde80['body'][_0x160e('0x50')]=integrations[_0x160e('0x51')](_0x7dde80[_0x160e('0x45')]['channel'],_0x7dde80[_0x160e('0x45')]['type']);return db[_0x160e('0x48')]['create'](_0x7dde80[_0x160e('0x45')],{'include':[{'model':db[_0x160e('0x52')],'as':'Subjects'},{'model':db[_0x160e('0x52')],'as':_0x160e('0x50')}]});}return null;})[_0x160e('0x22')](respondWithResult(_0x315803,null))['catch'](handleError(_0x315803,null));};exports[_0x160e('0x53')]=function(_0x348349,_0x5b145a,_0x14f245){var _0x37dc75='';var _0x4f22b2=['id',_0x160e('0x25'),_0x160e('0x54'),_0x160e('0x55'),_0x160e('0x56'),_0x160e('0x57'),_0x160e('0x58'),_0x160e('0x59'),_0x160e('0x5a'),_0x160e('0x5b'),_0x160e('0x5c'),_0x160e('0x5d')];return db[_0x160e('0x28')]['findOne']({'where':{'id':_0x348349[_0x160e('0x40')]['id']},'attributes':['id',_0x160e('0x5e'),_0x160e('0x5f'),'remoteUri']})[_0x160e('0x22')](handleEntityNotFound(_0x5b145a,null))[_0x160e('0x22')](function(_0x438f9e){if(_0x438f9e){_0x37dc75=_0x438f9e[_0x160e('0x60')];var _0x160829=_0x37dc75[_0x160e('0x61')](-0x1);if(_0x160829==='/'){_0x37dc75=_0x37dc75[_0x160e('0x62')](0x0,_0x37dc75[_0x160e('0x63')](_0x160829));}return rp({'method':_0x160e('0x64'),'uri':util[_0x160e('0x65')](_0x160e('0x66'),_0x37dc75,_0x160e('0x67')),'json':!![],'form':{'method':'login','input_type':_0x160e('0x68'),'response_type':_0x160e('0x68'),'rest_data':JSON[_0x160e('0x69')]({'user_auth':{'user_name':_0x438f9e[_0x160e('0x5e')],'password':_0x438f9e[_0x160e('0x5f')],'encryption':'PLAIN'},'application':_0x160e('0x6a')})}});}})[_0x160e('0x22')](function(_0x412a4c){if(_0x412a4c&&_0x412a4c[_0x160e('0x25')]!==_0x160e('0x6b')&&_0x412a4c[_0x160e('0x25')]!=='Password\x20Expired'){return rp({'method':_0x160e('0x64'),'uri':util[_0x160e('0x65')](_0x160e('0x66'),_0x37dc75,_0x160e('0x67')),'json':!![],'form':{'method':_0x160e('0x6c'),'input_type':_0x160e('0x68'),'response_type':_0x160e('0x68'),'rest_data':JSON[_0x160e('0x69')]({'session':_0x412a4c['id'],'module_name':_0x160e('0x6d')})}})[_0x160e('0x22')](function(_0x33f87c){if(_0x33f87c){var _0x47d7ff=_[_0x160e('0x6e')](_0x33f87c[_0x160e('0x6f')]);_[_0x160e('0x70')](_0x47d7ff,function(_0x3746b6){return _0x4f22b2[_0x160e('0x71')](_0x3746b6[_0x160e('0x25')]);});return{'count':_0x47d7ff[_0x160e('0x41')],'rows':_[_0x160e('0x27')](_0x47d7ff,function(_0x460194){return{'id':_0x460194['name'],'name':_0x460194[_0x160e('0x72')],'custom':_[_0x160e('0x73')](_0x460194[_0x160e('0x25')],'_c')?!![]:![],'options':_0x460194[_0x160e('0x3b')]?_[_0x160e('0x27')](_[_0x160e('0x6e')](_0x460194['options']),function(_0x258ef2){return{'name':_0x258ef2[_0x160e('0x74')],'value':_0x258ef2[_0x160e('0x25')]};}):[]};})};}})['then'](respondWithResult(_0x5b145a,null))[_0x160e('0x3e')](function(_0x35eb8d){var _0x38c8fb=_0x348349['query'][_0x160e('0x75')]?0x1f4:_0x35eb8d[_0x160e('0x76')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x160e('0x53'),_0x38c8fb,JSON[_0x160e('0x69')](_0x35eb8d));delete _0x35eb8d[_0x160e('0x25')];if(_0x38c8fb===0x191){_0x38c8fb=0x190;}_0x5b145a[_0x160e('0x19')](_0x38c8fb)[_0x160e('0x26')](_0x348349['query'][_0x160e('0x75')]?{'message':_0x160e('0x77'),'statusCode':_0x35eb8d[_0x160e('0x76')]}:_0x35eb8d);});}else{var _0x42c7ec=0x1f4;_0x5b145a[_0x160e('0x19')](_0x42c7ec)[_0x160e('0x26')]({'message':_0x160e('0x77'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x2dba=['SugarcrmAccount','fieldName','type','key','model','map','query','filters','attributes','fields','hasOwnProperty','nolimit','sort','pick','where','merge','options','includeAll','findAll','rows','catch','show','params','keys','intersection','find','create','body','destroy','findOne','SugarcrmConfiguration','rawAttributes','length','order','filter','getConfigurations','AccountId','getSubjects','getDescriptions','channel','SugarcrmField','Descriptions','getFields','assigned_user_id','created_by','duration_hours','duration_minutes','parent_type','parent_name','direction','username','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','login','JSON','stringify','password','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','/service/v4_1/rest.php','get_module_fields','Calls','values','module_fields','remove','includes','label','endsWith','value','statusCode','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','rimraf','zip-dir','request-promise','moment','bluebird','mustache','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','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','end','error','name','send'];(function(_0x439f3c,_0x2a5eab){var _0x3c6ef9=function(_0x25d697){while(--_0x25d697){_0x439f3c['push'](_0x439f3c['shift']());}};_0x3c6ef9(++_0x2a5eab);}(_0x2dba,0x145));var _0xa2db=function(_0x1d7f18,_0x1010fa){_0x1d7f18=_0x1d7f18-0x0;var _0x2caa7f=_0x2dba[_0x1d7f18];return _0x2caa7f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa2db('0x0'));var zipdir=require(_0xa2db('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa2db('0x2'));var moment=require(_0xa2db('0x3'));var BPromise=require(_0xa2db('0x4'));var Mustache=require(_0xa2db('0x5'));var util=require(_0xa2db('0x6'));var path=require('path');var sox=require(_0xa2db('0x7'));var csv=require('to-csv');var ejs=require(_0xa2db('0x8'));var fs=require('fs');var fs_extra=require(_0xa2db('0x9'));var _=require(_0xa2db('0xa'));var squel=require('squel');var crypto=require(_0xa2db('0xb'));var jsforce=require(_0xa2db('0xc'));var deskjs=require(_0xa2db('0xd'));var toCsv=require(_0xa2db('0xe'));var querystring=require(_0xa2db('0xf'));var Papa=require(_0xa2db('0x10'));var Redis=require('ioredis');var authService=require(_0xa2db('0x11'));var qs=require(_0xa2db('0x12'));var as=require(_0xa2db('0x13'));var hardwareService=require(_0xa2db('0x14'));var logger=require(_0xa2db('0x15'))('api');var utils=require(_0xa2db('0x16'));var config=require(_0xa2db('0x17'));var licenseUtil=require(_0xa2db('0x18'));var db=require(_0xa2db('0x19'))['db'];var integrations=require(_0xa2db('0x1a'));function respondWithStatusCode(_0x1c0a33,_0x254864){_0x254864=_0x254864||0xcc;return function(_0x3c750b){if(_0x3c750b){return _0x1c0a33[_0xa2db('0x1b')](_0x254864);}return _0x1c0a33['status'](_0x254864)['end']();};}function respondWithResult(_0x11b7bd,_0x3bb19a){_0x3bb19a=_0x3bb19a||0xc8;return function(_0xc74eb3){if(_0xc74eb3){return _0x11b7bd[_0xa2db('0x1c')](_0x3bb19a)['json'](_0xc74eb3);}};}function respondWithFilteredResult(_0x54a5c8,_0xbf0e77){return function(_0x5db396){if(_0x5db396){var _0x36dc57=typeof _0xbf0e77[_0xa2db('0x1d')]===_0xa2db('0x1e')&&typeof _0xbf0e77[_0xa2db('0x1f')]===_0xa2db('0x1e');var _0x4ce0a0=_0x5db396[_0xa2db('0x20')];var _0x46dec9=_0x36dc57?0x0:_0xbf0e77[_0xa2db('0x1d')];var _0x200159=_0x36dc57?_0x5db396[_0xa2db('0x20')]:_0xbf0e77[_0xa2db('0x1d')]+_0xbf0e77[_0xa2db('0x1f')];var _0x8fef9a;if(_0x200159>=_0x4ce0a0){_0x200159=_0x4ce0a0;_0x8fef9a=0xc8;}else{_0x8fef9a=0xce;}_0x54a5c8[_0xa2db('0x1c')](_0x8fef9a);return _0x54a5c8[_0xa2db('0x21')](_0xa2db('0x22'),_0x46dec9+'-'+_0x200159+'/'+_0x4ce0a0)['json'](_0x5db396);}return null;};}function patchUpdates(_0x26df67){return function(_0x98075e){try{jsonpatch[_0xa2db('0x23')](_0x98075e,_0x26df67,!![]);}catch(_0x498065){return BPromise[_0xa2db('0x24')](_0x498065);}return _0x98075e[_0xa2db('0x25')]();};}function saveUpdates(_0x547700,_0x4627cc){return function(_0x1a6750){if(_0x1a6750){return _0x1a6750[_0xa2db('0x26')](_0x547700)[_0xa2db('0x27')](function(_0x33ee7a){return _0x33ee7a;});}return null;};}function removeEntity(_0x57382a,_0x2d3329){return function(_0x220ae8){if(_0x220ae8){return _0x220ae8['destroy']()[_0xa2db('0x27')](function(){_0x57382a[_0xa2db('0x1c')](0xcc)[_0xa2db('0x28')]();});}};}function handleEntityNotFound(_0x13bfff,_0x25f5ee){return function(_0x1a374a){if(!_0x1a374a){_0x13bfff[_0xa2db('0x1b')](0x194);}return _0x1a374a;};}function handleError(_0x5113c4,_0x563994){_0x563994=_0x563994||0x1f4;return function(_0x5e7bfa){logger[_0xa2db('0x29')](_0x5e7bfa['stack']);if(_0x5e7bfa[_0xa2db('0x2a')]){delete _0x5e7bfa[_0xa2db('0x2a')];}_0x5113c4[_0xa2db('0x1c')](_0x563994)[_0xa2db('0x2b')](_0x5e7bfa);};}exports['index']=function(_0x1e0ceb,_0x22ceaf){var _0x29faf7={},_0x3db2ed={},_0x582101={'count':0x0,'rows':[]};var _0x33b32e=_['map'](db[_0xa2db('0x2c')]['rawAttributes'],function(_0x4b8f24){return{'name':_0x4b8f24[_0xa2db('0x2d')],'type':_0x4b8f24[_0xa2db('0x2e')][_0xa2db('0x2f')]};});_0x3db2ed[_0xa2db('0x30')]=_[_0xa2db('0x31')](_0x33b32e,_0xa2db('0x2a'));_0x3db2ed[_0xa2db('0x32')]=_['keys'](_0x1e0ceb[_0xa2db('0x32')]);_0x3db2ed[_0xa2db('0x33')]=_['intersection'](_0x3db2ed[_0xa2db('0x30')],_0x3db2ed[_0xa2db('0x32')]);_0x29faf7[_0xa2db('0x34')]=_['intersection'](_0x3db2ed['model'],qs['fields'](_0x1e0ceb[_0xa2db('0x32')][_0xa2db('0x35')]));_0x29faf7[_0xa2db('0x34')]=_0x29faf7[_0xa2db('0x34')]['length']?_0x29faf7[_0xa2db('0x34')]:_0x3db2ed[_0xa2db('0x30')];if(!_0x1e0ceb[_0xa2db('0x32')][_0xa2db('0x36')](_0xa2db('0x37'))){_0x29faf7[_0xa2db('0x1f')]=qs[_0xa2db('0x1f')](_0x1e0ceb[_0xa2db('0x32')][_0xa2db('0x1f')]);_0x29faf7[_0xa2db('0x1d')]=qs[_0xa2db('0x1d')](_0x1e0ceb[_0xa2db('0x32')][_0xa2db('0x1d')]);}_0x29faf7['order']=qs['sort'](_0x1e0ceb[_0xa2db('0x32')][_0xa2db('0x38')]);_0x29faf7['where']=qs[_0xa2db('0x33')](_[_0xa2db('0x39')](_0x1e0ceb[_0xa2db('0x32')],_0x3db2ed[_0xa2db('0x33')]),_0x33b32e);if(_0x1e0ceb[_0xa2db('0x32')]['filter']){_0x29faf7[_0xa2db('0x3a')]=_['merge'](_0x29faf7[_0xa2db('0x3a')],{'$or':_[_0xa2db('0x31')](_0x33b32e,function(_0x29d958){if(_0x29d958[_0xa2db('0x2e')]!=='VIRTUAL'){var _0x355e3a={};_0x355e3a[_0x29d958['name']]={'$like':'%'+_0x1e0ceb[_0xa2db('0x32')]['filter']+'%'};return _0x355e3a;}})});}_0x29faf7=_[_0xa2db('0x3b')]({},_0x29faf7,_0x1e0ceb[_0xa2db('0x3c')]);var _0x26988b={'where':_0x29faf7[_0xa2db('0x3a')]};return db[_0xa2db('0x2c')]['count'](_0x26988b)[_0xa2db('0x27')](function(_0x2541bb){_0x582101['count']=_0x2541bb;if(_0x1e0ceb[_0xa2db('0x32')][_0xa2db('0x3d')]){_0x29faf7['include']=[{'all':!![]}];}return db[_0xa2db('0x2c')][_0xa2db('0x3e')](_0x29faf7);})[_0xa2db('0x27')](function(_0x5698d1){_0x582101[_0xa2db('0x3f')]=_0x5698d1;return _0x582101;})['then'](respondWithFilteredResult(_0x22ceaf,_0x29faf7))[_0xa2db('0x40')](handleError(_0x22ceaf,null));};exports[_0xa2db('0x41')]=function(_0x2aa795,_0x1614f2){var _0x4ddcca={'raw':![],'where':{'id':_0x2aa795[_0xa2db('0x42')]['id']}},_0x5531c8={};_0x5531c8[_0xa2db('0x30')]=_['keys'](db[_0xa2db('0x2c')]['rawAttributes']);_0x5531c8[_0xa2db('0x32')]=_[_0xa2db('0x43')](_0x2aa795[_0xa2db('0x32')]);_0x5531c8[_0xa2db('0x33')]=_[_0xa2db('0x44')](_0x5531c8[_0xa2db('0x30')],_0x5531c8[_0xa2db('0x32')]);_0x4ddcca['attributes']=_[_0xa2db('0x44')](_0x5531c8[_0xa2db('0x30')],qs['fields'](_0x2aa795['query'][_0xa2db('0x35')]));_0x4ddcca[_0xa2db('0x34')]=_0x4ddcca['attributes']['length']?_0x4ddcca[_0xa2db('0x34')]:_0x5531c8[_0xa2db('0x30')];if(_0x2aa795[_0xa2db('0x32')][_0xa2db('0x3d')]){_0x4ddcca['include']=[{'all':!![]}];}_0x4ddcca=_[_0xa2db('0x3b')]({},_0x4ddcca,_0x2aa795[_0xa2db('0x3c')]);return db[_0xa2db('0x2c')][_0xa2db('0x45')](_0x4ddcca)[_0xa2db('0x27')](handleEntityNotFound(_0x1614f2,null))[_0xa2db('0x27')](respondWithResult(_0x1614f2,null))[_0xa2db('0x40')](handleError(_0x1614f2,null));};exports[_0xa2db('0x46')]=function(_0x2c582d,_0x10307e){return db[_0xa2db('0x2c')]['create'](_0x2c582d[_0xa2db('0x47')],{})['then'](respondWithResult(_0x10307e,0xc9))['catch'](handleError(_0x10307e,null));};exports['update']=function(_0x24fac4,_0x462287){if(_0x24fac4['body']['id']){delete _0x24fac4[_0xa2db('0x47')]['id'];}return db[_0xa2db('0x2c')][_0xa2db('0x45')]({'where':{'id':_0x24fac4[_0xa2db('0x42')]['id']}})[_0xa2db('0x27')](handleEntityNotFound(_0x462287,null))[_0xa2db('0x27')](saveUpdates(_0x24fac4[_0xa2db('0x47')],null))[_0xa2db('0x27')](respondWithResult(_0x462287,null))[_0xa2db('0x40')](handleError(_0x462287,null));};exports[_0xa2db('0x48')]=function(_0x21b15d,_0x45edd7){return db[_0xa2db('0x2c')][_0xa2db('0x45')]({'where':{'id':_0x21b15d[_0xa2db('0x42')]['id']}})[_0xa2db('0x27')](handleEntityNotFound(_0x45edd7,null))['then'](removeEntity(_0x45edd7,null))[_0xa2db('0x40')](handleError(_0x45edd7,null));};exports['getConfigurations']=function(_0xc46ea7,_0x51dc9c,_0x23e06a){var _0x50673f={};var _0x193955={};var _0x44462c;var _0x155e35;return db[_0xa2db('0x2c')][_0xa2db('0x49')]({'where':{'id':_0xc46ea7['params']['id']}})['then'](handleEntityNotFound(_0x51dc9c,null))[_0xa2db('0x27')](function(_0x39e917){if(_0x39e917){_0x44462c=_0x39e917;_0x193955[_0xa2db('0x30')]=_[_0xa2db('0x43')](db[_0xa2db('0x4a')][_0xa2db('0x4b')]);_0x193955[_0xa2db('0x32')]=_[_0xa2db('0x43')](_0xc46ea7[_0xa2db('0x32')]);_0x193955[_0xa2db('0x33')]=_[_0xa2db('0x44')](_0x193955[_0xa2db('0x30')],_0x193955[_0xa2db('0x32')]);_0x50673f[_0xa2db('0x34')]=_[_0xa2db('0x44')](_0x193955[_0xa2db('0x30')],qs[_0xa2db('0x35')](_0xc46ea7['query'][_0xa2db('0x35')]));_0x50673f[_0xa2db('0x34')]=_0x50673f[_0xa2db('0x34')][_0xa2db('0x4c')]?_0x50673f[_0xa2db('0x34')]:_0x193955[_0xa2db('0x30')];_0x50673f[_0xa2db('0x4d')]=qs['sort'](_0xc46ea7[_0xa2db('0x32')][_0xa2db('0x38')]);_0x50673f[_0xa2db('0x3a')]=qs[_0xa2db('0x33')](_[_0xa2db('0x39')](_0xc46ea7['query'],_0x193955[_0xa2db('0x33')]));if(_0xc46ea7[_0xa2db('0x32')][_0xa2db('0x4e')]){_0x50673f[_0xa2db('0x3a')]=_[_0xa2db('0x3b')](_0x50673f[_0xa2db('0x3a')],{'$or':_[_0xa2db('0x31')](_0x50673f[_0xa2db('0x34')],function(_0x5befd2){var _0x61bb34={};_0x61bb34[_0x5befd2]={'$like':'%'+_0xc46ea7[_0xa2db('0x32')][_0xa2db('0x4e')]+'%'};return _0x61bb34;})});}_0x50673f=_[_0xa2db('0x3b')]({},_0x50673f,_0xc46ea7['options']);return _0x44462c[_0xa2db('0x4f')](_0x50673f);}})[_0xa2db('0x27')](function(_0x1028bd){if(_0x1028bd){_0x155e35=_0x1028bd['length'];if(!_0xc46ea7['query'][_0xa2db('0x36')](_0xa2db('0x37'))){_0x50673f[_0xa2db('0x1f')]=qs['limit'](_0xc46ea7[_0xa2db('0x32')][_0xa2db('0x1f')]);_0x50673f['offset']=qs['offset'](_0xc46ea7[_0xa2db('0x32')][_0xa2db('0x1d')]);}return _0x44462c[_0xa2db('0x4f')](_0x50673f);}})[_0xa2db('0x27')](function(_0x1c162e){if(_0x1c162e){return _0x1c162e?{'count':_0x155e35,'rows':_0x1c162e}:null;}})[_0xa2db('0x27')](respondWithResult(_0x51dc9c,null))['catch'](handleError(_0x51dc9c,null));};exports['addConfiguration']=function(_0x3c0f65,_0x365a3e,_0x87e395){if(_0x3c0f65[_0xa2db('0x47')]['id']){delete _0x3c0f65['body']['id'];}return db[_0xa2db('0x2c')][_0xa2db('0x49')]({'where':{'id':_0x3c0f65['params']['id']}})[_0xa2db('0x27')](handleEntityNotFound(_0x365a3e,null))['then'](function(_0x39dac0){if(_0x39dac0){_0x3c0f65[_0xa2db('0x47')][_0xa2db('0x50')]=_0x39dac0['id'];_0x3c0f65['body']['Subjects']=integrations[_0xa2db('0x51')](_0x3c0f65['body']['channel'],_0x3c0f65[_0xa2db('0x47')]['type']);_0x3c0f65[_0xa2db('0x47')]['Descriptions']=integrations[_0xa2db('0x52')](_0x3c0f65[_0xa2db('0x47')][_0xa2db('0x53')],_0x3c0f65[_0xa2db('0x47')][_0xa2db('0x2e')]);return db['SugarcrmConfiguration'][_0xa2db('0x46')](_0x3c0f65[_0xa2db('0x47')],{'include':[{'model':db[_0xa2db('0x54')],'as':'Subjects'},{'model':db[_0xa2db('0x54')],'as':_0xa2db('0x55')}]});}return null;})[_0xa2db('0x27')](respondWithResult(_0x365a3e,null))['catch'](handleError(_0x365a3e,null));};exports[_0xa2db('0x56')]=function(_0x5f1b20,_0x86e8db,_0x4272e6){var _0x3a4505='';var _0x388363=['id',_0xa2db('0x2a'),_0xa2db('0x57'),_0xa2db('0x58'),'description','date_start',_0xa2db('0x59'),_0xa2db('0x5a'),'parent_id',_0xa2db('0x5b'),_0xa2db('0x5c'),_0xa2db('0x5d')];return db[_0xa2db('0x2c')]['findOne']({'where':{'id':_0x5f1b20[_0xa2db('0x42')]['id']},'attributes':['id',_0xa2db('0x5e'),'password',_0xa2db('0x5f')]})[_0xa2db('0x27')](handleEntityNotFound(_0x86e8db,null))[_0xa2db('0x27')](function(_0xb65c46){if(_0xb65c46){_0x3a4505=_0xb65c46[_0xa2db('0x5f')];var _0x8739de=_0x3a4505[_0xa2db('0x60')](-0x1);if(_0x8739de==='/'){_0x3a4505=_0x3a4505[_0xa2db('0x61')](0x0,_0x3a4505[_0xa2db('0x62')](_0x8739de));}return rp({'method':_0xa2db('0x63'),'uri':util[_0xa2db('0x64')](_0xa2db('0x65'),_0x3a4505,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0xa2db('0x66'),'input_type':'JSON','response_type':_0xa2db('0x67'),'rest_data':JSON[_0xa2db('0x68')]({'user_auth':{'user_name':_0xb65c46[_0xa2db('0x5e')],'password':_0xb65c46[_0xa2db('0x69')],'encryption':'PLAIN'},'application':_0xa2db('0x6a')})}});}})['then'](function(_0x143a11){if(_0x143a11&&_0x143a11[_0xa2db('0x2a')]!==_0xa2db('0x6b')&&_0x143a11['name']!==_0xa2db('0x6c')){return rp({'method':_0xa2db('0x63'),'uri':util['format']('%s%s',_0x3a4505,_0xa2db('0x6d')),'json':!![],'form':{'method':_0xa2db('0x6e'),'input_type':'JSON','response_type':'JSON','rest_data':JSON['stringify']({'session':_0x143a11['id'],'module_name':_0xa2db('0x6f')})}})[_0xa2db('0x27')](function(_0x1b0edd){if(_0x1b0edd){var _0x5f0a83=_[_0xa2db('0x70')](_0x1b0edd[_0xa2db('0x71')]);_[_0xa2db('0x72')](_0x5f0a83,function(_0x5ebb4e){return _0x388363[_0xa2db('0x73')](_0x5ebb4e[_0xa2db('0x2a')]);});return{'count':_0x5f0a83[_0xa2db('0x4c')],'rows':_['map'](_0x5f0a83,function(_0x3d79f2){return{'id':_0x3d79f2['name'],'name':_0x3d79f2[_0xa2db('0x74')],'custom':_[_0xa2db('0x75')](_0x3d79f2['name'],'_c')?!![]:![],'options':_0x3d79f2[_0xa2db('0x3c')]?_[_0xa2db('0x31')](_[_0xa2db('0x70')](_0x3d79f2[_0xa2db('0x3c')]),function(_0x567ea3){return{'name':_0x567ea3[_0xa2db('0x76')],'value':_0x567ea3['name']};}):[]};})};}})[_0xa2db('0x27')](respondWithResult(_0x86e8db,null))[_0xa2db('0x40')](function(_0xaa12c7){var _0x5c6044=_0x5f1b20[_0xa2db('0x32')]['test']?0x1f4:_0xaa12c7[_0xa2db('0x77')]||0x1f4;logger[_0xa2db('0x29')](_0xa2db('0x78'),_0xa2db('0x56'),_0x5c6044,JSON[_0xa2db('0x68')](_0xaa12c7));delete _0xaa12c7[_0xa2db('0x2a')];if(_0x5c6044===0x191){_0x5c6044=0x190;}_0x86e8db[_0xa2db('0x1c')](_0x5c6044)[_0xa2db('0x2b')](_0x5f1b20['query'][_0xa2db('0x79')]?{'message':'Wrong\x20credentials','statusCode':_0xaa12c7[_0xa2db('0x77')]}:_0xaa12c7);});}else{var _0x2fb137=0x1f4;_0x86e8db[_0xa2db('0x1c')](_0x2fb137)['send']({'message':_0xa2db('0x7a'),'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 cff6895..acd74c9 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 _0xa9a9=['int_sugarcrm_accounts','lodash','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','SugarcrmAccount'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xa9a9,0x12c));var _0x9a9a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa9a9[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x9a9a('0x0'));var util=require('util');var logger=require(_0x9a9a('0x1'))(_0x9a9a('0x2'));var moment=require(_0x9a9a('0x3'));var BPromise=require('bluebird');var rp=require(_0x9a9a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9a9a('0x5'));var config=require(_0x9a9a('0x6'));var attributes=require(_0x9a9a('0x7'));var integrations=require(_0x9a9a('0x8'));module[_0x9a9a('0x9')]=function(_0x1ad3e8,_0x4f13b5){return _0x1ad3e8[_0x9a9a('0xa')](_0x9a9a('0xb'),attributes,{'tableName':_0x9a9a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4d1f=['define','SugarcrmAccount','lodash','util','../../config/logger','api','moment','bluebird','rimraf','./intSugarcrmAccount.attributes','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4d1f,0x141));var _0xf4d1=function(_0x1dfbf4,_0x31d1fa){_0x1dfbf4=_0x1dfbf4-0x0;var _0x1aca1c=_0x4d1f[_0x1dfbf4];return _0x1aca1c;};'use strict';var _=require(_0xf4d1('0x0'));var util=require(_0xf4d1('0x1'));var logger=require(_0xf4d1('0x2'))(_0xf4d1('0x3'));var moment=require(_0xf4d1('0x4'));var BPromise=require(_0xf4d1('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf4d1('0x6'));var config=require('../../config/environment');var attributes=require(_0xf4d1('0x7'));var integrations=require('../../components/integrations/configuration');module[_0xf4d1('0x8')]=function(_0x27c00f,_0xa14873){return _0x27c00f[_0xf4d1('0x9')](_0xf4d1('0xa'),attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index 0e7e3bc..05a4cf9 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 _0x945f=['map','include','model','info','ShowSugarcrmAccount','find','raw','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetSugarcrmAccount','SugarcrmAccount','findAll','options','where','attributes','limit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x945f,0x1d0));var _0xf945=function(_0x22ff45,_0xa09a8f){_0x22ff45=_0x22ff45-0x0;var _0xcdd51c=_0x945f[_0x22ff45];return _0xcdd51c;};'use strict';var _=require(_0xf945('0x0'));var util=require(_0xf945('0x1'));var moment=require(_0xf945('0x2'));var BPromise=require('bluebird');var rs=require(_0xf945('0x3'));var fs=require('fs');var Redis=require(_0xf945('0x4'));var db=require(_0xf945('0x5'))['db'];var utils=require(_0xf945('0x6'));var logger=require(_0xf945('0x7'))(_0xf945('0x8'));var config=require(_0xf945('0x9'));var jayson=require(_0xf945('0xa'));var client=jayson[_0xf945('0xb')][_0xf945('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x15e2ba,_0x2e6dc8,_0x587161){return new BPromise(function(_0x5e471e,_0x177b19){return client['request'](_0x15e2ba,_0x587161)[_0xf945('0xd')](function(_0x454b8e){logger['info'](_0xf945('0xe'),_0x2e6dc8,_0xf945('0xf'));logger[_0xf945('0x10')](_0xf945('0x11'),_0x2e6dc8,'request\x20sent',JSON[_0xf945('0x12')](_0x454b8e));if(_0x454b8e[_0xf945('0x13')]){if(_0x454b8e[_0xf945('0x13')][_0xf945('0x14')]===0x1f4){logger[_0xf945('0x13')](_0xf945('0xe'),_0x2e6dc8,_0x454b8e[_0xf945('0x13')]['message']);return _0x177b19(_0x454b8e[_0xf945('0x13')][_0xf945('0x15')]);}logger[_0xf945('0x13')](_0xf945('0xe'),_0x2e6dc8,_0x454b8e[_0xf945('0x13')][_0xf945('0x15')]);return _0x5e471e(_0x454b8e[_0xf945('0x13')][_0xf945('0x15')]);}else{logger['info'](_0xf945('0xe'),_0x2e6dc8,'request\x20sent');_0x5e471e(_0x454b8e[_0xf945('0x16')][_0xf945('0x15')]);}})['catch'](function(_0x1e4322){logger[_0xf945('0x13')]('SugarcrmAccount,\x20%s,\x20%s',_0x2e6dc8,_0x1e4322);_0x177b19(_0x1e4322);});});}exports[_0xf945('0x17')]=function(_0x307363){var _0x15d4aa=this;return new Promise(function(_0x36c872,_0x371cd5){return db[_0xf945('0x18')][_0xf945('0x19')]({'raw':_0x307363[_0xf945('0x1a')]?_0x307363['options']['raw']===undefined?!![]:![]:!![],'where':_0x307363[_0xf945('0x1a')]?_0x307363['options'][_0xf945('0x1b')]||null:null,'attributes':_0x307363[_0xf945('0x1a')]?_0x307363[_0xf945('0x1a')][_0xf945('0x1c')]||null:null,'limit':_0x307363[_0xf945('0x1a')]?_0x307363[_0xf945('0x1a')][_0xf945('0x1d')]||null:null,'include':_0x307363['options']?_0x307363[_0xf945('0x1a')]['include']?_[_0xf945('0x1e')](_0x307363[_0xf945('0x1a')][_0xf945('0x1f')],function(_0x8a69d3){return{'model':db[_0x8a69d3[_0xf945('0x20')]],'as':_0x8a69d3['as'],'attributes':_0x8a69d3[_0xf945('0x1c')],'include':_0x8a69d3['include']?_[_0xf945('0x1e')](_0x8a69d3[_0xf945('0x1f')],function(_0x437961){return{'model':db[_0x437961[_0xf945('0x20')]],'as':_0x437961['as'],'attributes':_0x437961[_0xf945('0x1c')],'include':_0x437961[_0xf945('0x1f')]?_['map'](_0x437961[_0xf945('0x1f')],function(_0x441d5b){return{'model':db[_0x441d5b[_0xf945('0x20')]],'as':_0x441d5b['as'],'attributes':_0x441d5b[_0xf945('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xf945('0xd')](function(_0x1ffb0a){logger[_0xf945('0x21')](_0xf945('0x17'),_0x307363);logger[_0xf945('0x10')](_0xf945('0x17'),_0x307363,JSON['stringify'](_0x1ffb0a));_0x36c872(_0x1ffb0a);})['catch'](function(_0x8d4e26){logger['error'](_0xf945('0x17'),_0x8d4e26[_0xf945('0x15')],_0x307363);_0x371cd5(_0x15d4aa['error'](0x1f4,_0x8d4e26[_0xf945('0x15')]));});});};exports[_0xf945('0x22')]=function(_0x24168b){var _0x51f27e=this;return new Promise(function(_0x10ec92,_0x3acfdf){return db[_0xf945('0x18')][_0xf945('0x23')]({'raw':_0x24168b['options']?_0x24168b['options'][_0xf945('0x24')]===undefined?!![]:![]:!![],'where':_0x24168b['options']?_0x24168b['options'][_0xf945('0x1b')]||null:null,'attributes':_0x24168b[_0xf945('0x1a')]?_0x24168b[_0xf945('0x1a')][_0xf945('0x1c')]||null:null,'include':_0x24168b['options']?_0x24168b[_0xf945('0x1a')][_0xf945('0x1f')]?_['map'](_0x24168b[_0xf945('0x1a')][_0xf945('0x1f')],function(_0x2a3842){return{'model':db[_0x2a3842[_0xf945('0x20')]],'as':_0x2a3842['as'],'attributes':_0x2a3842[_0xf945('0x1c')],'include':_0x2a3842['include']?_[_0xf945('0x1e')](_0x2a3842[_0xf945('0x1f')],function(_0x453a1e){return{'model':db[_0x453a1e[_0xf945('0x20')]],'as':_0x453a1e['as'],'attributes':_0x453a1e[_0xf945('0x1c')],'include':_0x453a1e['include']?_[_0xf945('0x1e')](_0x453a1e['include'],function(_0x499f74){return{'model':db[_0x499f74[_0xf945('0x20')]],'as':_0x499f74['as'],'attributes':_0x499f74[_0xf945('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xf945('0xd')](function(_0x7d716d){logger[_0xf945('0x21')](_0xf945('0x22'),_0x24168b);logger[_0xf945('0x10')](_0xf945('0x22'),_0x24168b,JSON[_0xf945('0x12')](_0x7d716d));_0x10ec92(_0x7d716d);})[_0xf945('0x25')](function(_0x539227){logger['error'](_0xf945('0x22'),_0x539227[_0xf945('0x15')],_0x24168b);_0x3acfdf(_0x51f27e['error'](0x1f4,_0x539227['message']));});});}; \ No newline at end of file +var _0x75ed=['map','model','attributes','then','ShowSugarcrmAccount','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','limit','include'];(function(_0x5286c5,_0x1b910c){var _0x227472=function(_0x56277c){while(--_0x56277c){_0x5286c5['push'](_0x5286c5['shift']());}};_0x227472(++_0x1b910c);}(_0x75ed,0x1e7));var _0xd75e=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x75ed[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xd75e('0x0'));var util=require(_0xd75e('0x1'));var moment=require(_0xd75e('0x2'));var BPromise=require(_0xd75e('0x3'));var rs=require(_0xd75e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd75e('0x5'))['db'];var utils=require(_0xd75e('0x6'));var logger=require(_0xd75e('0x7'))(_0xd75e('0x8'));var config=require('../../config/environment');var jayson=require(_0xd75e('0x9'));var client=jayson[_0xd75e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2b558e,_0xfad87f,_0x2f402e){return new BPromise(function(_0x1628ab,_0x3c177a){return client[_0xd75e('0xb')](_0x2b558e,_0x2f402e)['then'](function(_0xa31ecb){logger[_0xd75e('0xc')](_0xd75e('0xd'),_0xfad87f,_0xd75e('0xe'));logger[_0xd75e('0xf')](_0xd75e('0x10'),_0xfad87f,_0xd75e('0xe'),JSON[_0xd75e('0x11')](_0xa31ecb));if(_0xa31ecb[_0xd75e('0x12')]){if(_0xa31ecb['error'][_0xd75e('0x13')]===0x1f4){logger[_0xd75e('0x12')](_0xd75e('0xd'),_0xfad87f,_0xa31ecb[_0xd75e('0x12')]['message']);return _0x3c177a(_0xa31ecb[_0xd75e('0x12')]['message']);}logger['error'](_0xd75e('0xd'),_0xfad87f,_0xa31ecb['error'][_0xd75e('0x14')]);return _0x1628ab(_0xa31ecb[_0xd75e('0x12')]['message']);}else{logger[_0xd75e('0xc')](_0xd75e('0xd'),_0xfad87f,_0xd75e('0xe'));_0x1628ab(_0xa31ecb[_0xd75e('0x15')]['message']);}})[_0xd75e('0x16')](function(_0x39daef){logger[_0xd75e('0x12')]('SugarcrmAccount,\x20%s,\x20%s',_0xfad87f,_0x39daef);_0x3c177a(_0x39daef);});});}exports[_0xd75e('0x17')]=function(_0x12aa0d){var _0x398ecf=this;return new Promise(function(_0x3554f5,_0x14d34e){return db[_0xd75e('0x18')][_0xd75e('0x19')]({'raw':_0x12aa0d[_0xd75e('0x1a')]?_0x12aa0d[_0xd75e('0x1a')][_0xd75e('0x1b')]===undefined?!![]:![]:!![],'where':_0x12aa0d[_0xd75e('0x1a')]?_0x12aa0d[_0xd75e('0x1a')][_0xd75e('0x1c')]||null:null,'attributes':_0x12aa0d[_0xd75e('0x1a')]?_0x12aa0d[_0xd75e('0x1a')]['attributes']||null:null,'limit':_0x12aa0d[_0xd75e('0x1a')]?_0x12aa0d[_0xd75e('0x1a')][_0xd75e('0x1d')]||null:null,'include':_0x12aa0d['options']?_0x12aa0d[_0xd75e('0x1a')][_0xd75e('0x1e')]?_[_0xd75e('0x1f')](_0x12aa0d['options'][_0xd75e('0x1e')],function(_0x1143fc){return{'model':db[_0x1143fc[_0xd75e('0x20')]],'as':_0x1143fc['as'],'attributes':_0x1143fc[_0xd75e('0x21')],'include':_0x1143fc['include']?_['map'](_0x1143fc[_0xd75e('0x1e')],function(_0xd09274){return{'model':db[_0xd09274[_0xd75e('0x20')]],'as':_0xd09274['as'],'attributes':_0xd09274['attributes'],'include':_0xd09274[_0xd75e('0x1e')]?_[_0xd75e('0x1f')](_0xd09274[_0xd75e('0x1e')],function(_0x578e0c){return{'model':db[_0x578e0c[_0xd75e('0x20')]],'as':_0x578e0c['as'],'attributes':_0x578e0c['attributes']};}):[]};}):[]};}):[]:[]})[_0xd75e('0x22')](function(_0x5e4053){logger[_0xd75e('0xc')](_0xd75e('0x17'),_0x12aa0d);logger[_0xd75e('0xf')]('GetSugarcrmAccount',_0x12aa0d,JSON[_0xd75e('0x11')](_0x5e4053));_0x3554f5(_0x5e4053);})[_0xd75e('0x16')](function(_0x3eab25){logger[_0xd75e('0x12')](_0xd75e('0x17'),_0x3eab25[_0xd75e('0x14')],_0x12aa0d);_0x14d34e(_0x398ecf[_0xd75e('0x12')](0x1f4,_0x3eab25[_0xd75e('0x14')]));});});};exports[_0xd75e('0x23')]=function(_0x3dab71){var _0x1f49aa=this;return new Promise(function(_0x45f53f,_0x2f0f1b){return db[_0xd75e('0x18')][_0xd75e('0x24')]({'raw':_0x3dab71['options']?_0x3dab71[_0xd75e('0x1a')][_0xd75e('0x1b')]===undefined?!![]:![]:!![],'where':_0x3dab71[_0xd75e('0x1a')]?_0x3dab71[_0xd75e('0x1a')][_0xd75e('0x1c')]||null:null,'attributes':_0x3dab71['options']?_0x3dab71[_0xd75e('0x1a')]['attributes']||null:null,'include':_0x3dab71[_0xd75e('0x1a')]?_0x3dab71[_0xd75e('0x1a')][_0xd75e('0x1e')]?_[_0xd75e('0x1f')](_0x3dab71['options'][_0xd75e('0x1e')],function(_0x1dda92){return{'model':db[_0x1dda92[_0xd75e('0x20')]],'as':_0x1dda92['as'],'attributes':_0x1dda92[_0xd75e('0x21')],'include':_0x1dda92[_0xd75e('0x1e')]?_[_0xd75e('0x1f')](_0x1dda92[_0xd75e('0x1e')],function(_0x515543){return{'model':db[_0x515543[_0xd75e('0x20')]],'as':_0x515543['as'],'attributes':_0x515543[_0xd75e('0x21')],'include':_0x515543[_0xd75e('0x1e')]?_[_0xd75e('0x1f')](_0x515543[_0xd75e('0x1e')],function(_0x5ec791){return{'model':db[_0x5ec791[_0xd75e('0x20')]],'as':_0x5ec791['as'],'attributes':_0x5ec791['attributes']};}):[]};}):[]};}):[]:[]})[_0xd75e('0x22')](function(_0x21907c){logger[_0xd75e('0xc')]('ShowSugarcrmAccount',_0x3dab71);logger['debug'](_0xd75e('0x23'),_0x3dab71,JSON[_0xd75e('0x11')](_0x21907c));_0x45f53f(_0x21907c);})[_0xd75e('0x16')](function(_0xdc335b){logger['error'](_0xd75e('0x23'),_0xdc335b[_0xd75e('0x14')],_0x3dab71);_0x2f0f1b(_0x1f49aa[_0xd75e('0x12')](0x1f4,_0xdc335b[_0xd75e('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index a9559b7..9d967be 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 _0xa186=['show','/:id/fields','/:id/descriptions','getDescriptions','post','create','put','update','delete','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','/:id','isAuthenticated'];(function(_0x4e8928,_0x2d279e){var _0x38e70b=function(_0x327b57){while(--_0x327b57){_0x4e8928['push'](_0x4e8928['shift']());}};_0x38e70b(++_0x2d279e);}(_0xa186,0xf1));var _0x6a18=function(_0x292ee7,_0x262e6e){_0x292ee7=_0x292ee7-0x0;var _0x5133bf=_0xa186[_0x292ee7];return _0x5133bf;};'use strict';var multer=require('multer');var util=require(_0x6a18('0x0'));var path=require(_0x6a18('0x1'));var timeout=require('connect-timeout');var express=require(_0x6a18('0x2'));var router=express[_0x6a18('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x6a18('0x4'));var interaction=require(_0x6a18('0x5'));var config=require(_0x6a18('0x6'));var controller=require(_0x6a18('0x7'));router[_0x6a18('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6a18('0x8')](_0x6a18('0x9'),auth[_0x6a18('0xa')](),controller[_0x6a18('0xb')]);router[_0x6a18('0x8')](_0x6a18('0xc'),auth[_0x6a18('0xa')](),controller['getFields']);router[_0x6a18('0x8')]('/:id/subjects',auth[_0x6a18('0xa')](),controller['getSubjects']);router[_0x6a18('0x8')](_0x6a18('0xd'),auth[_0x6a18('0xa')](),controller[_0x6a18('0xe')]);router[_0x6a18('0xf')]('/',auth[_0x6a18('0xa')](),controller[_0x6a18('0x10')]);router[_0x6a18('0x11')](_0x6a18('0x9'),auth['isAuthenticated'](),controller[_0x6a18('0x12')]);router[_0x6a18('0x13')](_0x6a18('0x9'),auth[_0x6a18('0xa')](),controller['destroy']);module[_0x6a18('0x14')]=router; \ No newline at end of file +var _0xb935=['delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','put'];(function(_0x5b3d4d,_0x5013bb){var _0x2c99ef=function(_0x39d871){while(--_0x39d871){_0x5b3d4d['push'](_0x5b3d4d['shift']());}};_0x2c99ef(++_0x5013bb);}(_0xb935,0x12f));var _0x5b93=function(_0x4149ea,_0x28fd05){_0x4149ea=_0x4149ea-0x0;var _0x12dd64=_0xb935[_0x4149ea];return _0x12dd64;};'use strict';var multer=require('multer');var util=require(_0x5b93('0x0'));var path=require('path');var timeout=require(_0x5b93('0x1'));var express=require(_0x5b93('0x2'));var router=express[_0x5b93('0x3')]();var fs_extra=require(_0x5b93('0x4'));var auth=require(_0x5b93('0x5'));var interaction=require(_0x5b93('0x6'));var config=require(_0x5b93('0x7'));var controller=require(_0x5b93('0x8'));router[_0x5b93('0x9')]('/',auth[_0x5b93('0xa')](),controller[_0x5b93('0xb')]);router[_0x5b93('0x9')](_0x5b93('0xc'),auth[_0x5b93('0xa')](),controller[_0x5b93('0xd')]);router[_0x5b93('0x9')](_0x5b93('0xe'),auth[_0x5b93('0xa')](),controller[_0x5b93('0xf')]);router[_0x5b93('0x9')](_0x5b93('0x10'),auth[_0x5b93('0xa')](),controller[_0x5b93('0x11')]);router[_0x5b93('0x9')](_0x5b93('0x12'),auth[_0x5b93('0xa')](),controller[_0x5b93('0x13')]);router['post']('/',auth[_0x5b93('0xa')](),controller[_0x5b93('0x14')]);router[_0x5b93('0x15')](_0x5b93('0xc'),auth[_0x5b93('0xa')](),controller['update']);router[_0x5b93('0x16')](_0x5b93('0xc'),auth[_0x5b93('0xa')](),controller[_0x5b93('0x17')]);module[_0x5b93('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 98a912b..c971c73 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 _0x2169=['sequelize','exports','STRING'];(function(_0x1ffeac,_0x39b7fc){var _0x3a2914=function(_0x2f3273){while(--_0x2f3273){_0x1ffeac['push'](_0x1ffeac['shift']());}};_0x3a2914(++_0x39b7fc);}(_0x2169,0x126));var _0x9216=function(_0x38f5fe,_0x53da89){_0x38f5fe=_0x38f5fe-0x0;var _0x54ab60=_0x2169[_0x38f5fe];return _0x54ab60;};'use strict';var Sequelize=require(_0x9216('0x0'));module[_0x9216('0x1')]={'name':{'type':Sequelize[_0x9216('0x2')]},'description':{'type':Sequelize[_0x9216('0x2')]}}; \ No newline at end of file +var _0xad2e=['STRING','sequelize','exports'];(function(_0x31b5b2,_0x5ab927){var _0x364f13=function(_0x163bd0){while(--_0x163bd0){_0x31b5b2['push'](_0x31b5b2['shift']());}};_0x364f13(++_0x5ab927);}(_0xad2e,0x1b1));var _0xead2=function(_0x4d0fee,_0x275d96){_0x4d0fee=_0x4d0fee-0x0;var _0x384284=_0xad2e[_0x4d0fee];return _0x384284;};'use strict';var Sequelize=require(_0xead2('0x0'));module[_0xead2('0x1')]={'name':{'type':Sequelize[_0xead2('0x2')]},'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 a26097a..30e9216 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 _0x4235=['filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','filter','merge','include','rows','catch','show','params','options','create','body','find','getFields','findOne','SugarcrmField','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','count','Content-Range','apply','save','update','then','destroy','error','stack','name','send','map','SugarcrmConfiguration','rawAttributes','fieldName','type','model','query','keys'];(function(_0xf0f7a5,_0x346252){var _0x2b7860=function(_0x354650){while(--_0x354650){_0xf0f7a5['push'](_0xf0f7a5['shift']());}};_0x2b7860(++_0x346252);}(_0x4235,0x148));var _0x5423=function(_0x4237dc,_0x171899){_0x4237dc=_0x4237dc-0x0;var _0x35ed7f=_0x4235[_0x4237dc];return _0x35ed7f;};'use strict';var emlformat=require(_0x5423('0x0'));var rimraf=require(_0x5423('0x1'));var zipdir=require(_0x5423('0x2'));var jsonpatch=require(_0x5423('0x3'));var rp=require(_0x5423('0x4'));var moment=require(_0x5423('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x5423('0x6'));var util=require('util');var path=require(_0x5423('0x7'));var sox=require(_0x5423('0x8'));var csv=require('to-csv');var ejs=require(_0x5423('0x9'));var fs=require('fs');var fs_extra=require(_0x5423('0xa'));var _=require(_0x5423('0xb'));var squel=require('squel');var crypto=require(_0x5423('0xc'));var jsforce=require(_0x5423('0xd'));var deskjs=require(_0x5423('0xe'));var toCsv=require('to-csv');var querystring=require(_0x5423('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x5423('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5423('0x11'));var logger=require(_0x5423('0x12'))('api');var utils=require(_0x5423('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x5423('0x14'));var db=require(_0x5423('0x15'))['db'];function respondWithStatusCode(_0x26262b,_0x3d5f48){_0x3d5f48=_0x3d5f48||0xcc;return function(_0x4efb27){if(_0x4efb27){return _0x26262b[_0x5423('0x16')](_0x3d5f48);}return _0x26262b['status'](_0x3d5f48)[_0x5423('0x17')]();};}function respondWithResult(_0x2952d1,_0x4f0bd6){_0x4f0bd6=_0x4f0bd6||0xc8;return function(_0x53e587){if(_0x53e587){return _0x2952d1[_0x5423('0x18')](_0x4f0bd6)[_0x5423('0x19')](_0x53e587);}};}function respondWithFilteredResult(_0x4e826b,_0x57edfe){return function(_0x596fdf){if(_0x596fdf){var _0x257c9b=typeof _0x57edfe[_0x5423('0x1a')]==='undefined'&&typeof _0x57edfe[_0x5423('0x1b')]==='undefined';var _0x4d3cc5=_0x596fdf[_0x5423('0x1c')];var _0x2983d8=_0x257c9b?0x0:_0x57edfe[_0x5423('0x1a')];var _0xb2471e=_0x257c9b?_0x596fdf['count']:_0x57edfe[_0x5423('0x1a')]+_0x57edfe['limit'];var _0x339813;if(_0xb2471e>=_0x4d3cc5){_0xb2471e=_0x4d3cc5;_0x339813=0xc8;}else{_0x339813=0xce;}_0x4e826b[_0x5423('0x18')](_0x339813);return _0x4e826b['set'](_0x5423('0x1d'),_0x2983d8+'-'+_0xb2471e+'/'+_0x4d3cc5)['json'](_0x596fdf);}return null;};}function patchUpdates(_0x35ca67){return function(_0x3796d0){try{jsonpatch[_0x5423('0x1e')](_0x3796d0,_0x35ca67,!![]);}catch(_0x4374ac){return BPromise['reject'](_0x4374ac);}return _0x3796d0[_0x5423('0x1f')]();};}function saveUpdates(_0x4f032c,_0x5c7d48){return function(_0x42f30f){if(_0x42f30f){return _0x42f30f[_0x5423('0x20')](_0x4f032c)[_0x5423('0x21')](function(_0xd3e848){return _0xd3e848;});}return null;};}function removeEntity(_0x4acdae,_0x22e24b){return function(_0x36580a){if(_0x36580a){return _0x36580a[_0x5423('0x22')]()['then'](function(){_0x4acdae['status'](0xcc)[_0x5423('0x17')]();});}};}function handleEntityNotFound(_0x541e52,_0x3aa262){return function(_0x39764d){if(!_0x39764d){_0x541e52[_0x5423('0x16')](0x194);}return _0x39764d;};}function handleError(_0x4a6e5c,_0x2246ef){_0x2246ef=_0x2246ef||0x1f4;return function(_0x133f52){logger[_0x5423('0x23')](_0x133f52[_0x5423('0x24')]);if(_0x133f52[_0x5423('0x25')]){delete _0x133f52[_0x5423('0x25')];}_0x4a6e5c[_0x5423('0x18')](_0x2246ef)[_0x5423('0x26')](_0x133f52);};}exports['index']=function(_0x3f7144,_0x539f19){var _0x4d377d={},_0x25d7d4={},_0x516793={'count':0x0,'rows':[]};var _0x2f37e0=_[_0x5423('0x27')](db[_0x5423('0x28')][_0x5423('0x29')],function(_0x47dec7){return{'name':_0x47dec7[_0x5423('0x2a')],'type':_0x47dec7[_0x5423('0x2b')]['key']};});_0x25d7d4[_0x5423('0x2c')]=_['map'](_0x2f37e0,_0x5423('0x25'));_0x25d7d4[_0x5423('0x2d')]=_[_0x5423('0x2e')](_0x3f7144[_0x5423('0x2d')]);_0x25d7d4[_0x5423('0x2f')]=_['intersection'](_0x25d7d4[_0x5423('0x2c')],_0x25d7d4[_0x5423('0x2d')]);_0x4d377d['attributes']=_[_0x5423('0x30')](_0x25d7d4['model'],qs[_0x5423('0x31')](_0x3f7144[_0x5423('0x2d')][_0x5423('0x31')]));_0x4d377d[_0x5423('0x32')]=_0x4d377d[_0x5423('0x32')][_0x5423('0x33')]?_0x4d377d[_0x5423('0x32')]:_0x25d7d4[_0x5423('0x2c')];if(!_0x3f7144[_0x5423('0x2d')][_0x5423('0x34')](_0x5423('0x35'))){_0x4d377d['limit']=qs['limit'](_0x3f7144[_0x5423('0x2d')]['limit']);_0x4d377d['offset']=qs[_0x5423('0x1a')](_0x3f7144[_0x5423('0x2d')][_0x5423('0x1a')]);}_0x4d377d[_0x5423('0x36')]=qs[_0x5423('0x37')](_0x3f7144[_0x5423('0x2d')][_0x5423('0x37')]);_0x4d377d['where']=qs['filters'](_[_0x5423('0x38')](_0x3f7144[_0x5423('0x2d')],_0x25d7d4[_0x5423('0x2f')]),_0x2f37e0);if(_0x3f7144['query']['filter']){_0x4d377d[_0x5423('0x39')]=_['merge'](_0x4d377d[_0x5423('0x39')],{'$or':_[_0x5423('0x27')](_0x2f37e0,function(_0x756cd1){if(_0x756cd1[_0x5423('0x2b')]!==_0x5423('0x3a')){var _0x2469d3={};_0x2469d3[_0x756cd1['name']]={'$like':'%'+_0x3f7144['query'][_0x5423('0x3b')]+'%'};return _0x2469d3;}})});}_0x4d377d=_[_0x5423('0x3c')]({},_0x4d377d,_0x3f7144['options']);var _0x2830e7={'where':_0x4d377d[_0x5423('0x39')]};return db[_0x5423('0x28')]['count'](_0x2830e7)['then'](function(_0x5567a1){_0x516793[_0x5423('0x1c')]=_0x5567a1;if(_0x3f7144[_0x5423('0x2d')]['includeAll']){_0x4d377d[_0x5423('0x3d')]=[{'all':!![]}];}return db['SugarcrmConfiguration']['findAll'](_0x4d377d);})[_0x5423('0x21')](function(_0x29a439){_0x516793[_0x5423('0x3e')]=_0x29a439;return _0x516793;})[_0x5423('0x21')](respondWithFilteredResult(_0x539f19,_0x4d377d))[_0x5423('0x3f')](handleError(_0x539f19,null));};exports[_0x5423('0x40')]=function(_0x465b92,_0x13955f){var _0x1f01b6={'raw':![],'where':{'id':_0x465b92[_0x5423('0x41')]['id']}},_0x381391={};_0x381391[_0x5423('0x2c')]=_[_0x5423('0x2e')](db[_0x5423('0x28')][_0x5423('0x29')]);_0x381391[_0x5423('0x2d')]=_[_0x5423('0x2e')](_0x465b92[_0x5423('0x2d')]);_0x381391[_0x5423('0x2f')]=_['intersection'](_0x381391[_0x5423('0x2c')],_0x381391['query']);_0x1f01b6[_0x5423('0x32')]=_[_0x5423('0x30')](_0x381391[_0x5423('0x2c')],qs[_0x5423('0x31')](_0x465b92[_0x5423('0x2d')]['fields']));_0x1f01b6[_0x5423('0x32')]=_0x1f01b6[_0x5423('0x32')][_0x5423('0x33')]?_0x1f01b6[_0x5423('0x32')]:_0x381391[_0x5423('0x2c')];if(_0x465b92[_0x5423('0x2d')]['includeAll']){_0x1f01b6[_0x5423('0x3d')]=[{'all':!![]}];}_0x1f01b6=_['merge']({},_0x1f01b6,_0x465b92[_0x5423('0x42')]);return db[_0x5423('0x28')]['find'](_0x1f01b6)[_0x5423('0x21')](handleEntityNotFound(_0x13955f,null))[_0x5423('0x21')](respondWithResult(_0x13955f,null))[_0x5423('0x3f')](handleError(_0x13955f,null));};exports['create']=function(_0x5f1e3f,_0x1c5835){return db[_0x5423('0x28')][_0x5423('0x43')](_0x5f1e3f[_0x5423('0x44')],{})[_0x5423('0x21')](respondWithResult(_0x1c5835,0xc9))[_0x5423('0x3f')](handleError(_0x1c5835,null));};exports[_0x5423('0x20')]=function(_0x1a0391,_0x7c0127){if(_0x1a0391[_0x5423('0x44')]['id']){delete _0x1a0391[_0x5423('0x44')]['id'];}return db[_0x5423('0x28')][_0x5423('0x45')]({'where':{'id':_0x1a0391['params']['id']}})['then'](handleEntityNotFound(_0x7c0127,null))[_0x5423('0x21')](saveUpdates(_0x1a0391[_0x5423('0x44')],null))[_0x5423('0x21')](respondWithResult(_0x7c0127,null))[_0x5423('0x3f')](handleError(_0x7c0127,null));};exports['destroy']=function(_0x4189d3,_0x41927b){return db[_0x5423('0x28')][_0x5423('0x45')]({'where':{'id':_0x4189d3[_0x5423('0x41')]['id']}})['then'](handleEntityNotFound(_0x41927b,null))['then'](removeEntity(_0x41927b,null))[_0x5423('0x3f')](handleError(_0x41927b,null));};exports[_0x5423('0x46')]=function(_0x55d3ed,_0x1a8a7f,_0x43eb2d){var _0x13b6f4={};var _0x4c90e7={};var _0x357014;var _0x7fbdb7;return db[_0x5423('0x28')][_0x5423('0x47')]({'where':{'id':_0x55d3ed[_0x5423('0x41')]['id']}})['then'](handleEntityNotFound(_0x1a8a7f,null))[_0x5423('0x21')](function(_0x491d72){if(_0x491d72){_0x357014=_0x491d72;_0x4c90e7[_0x5423('0x2c')]=_[_0x5423('0x2e')](db[_0x5423('0x48')][_0x5423('0x29')]);_0x4c90e7['query']=_[_0x5423('0x2e')](_0x55d3ed[_0x5423('0x2d')]);_0x4c90e7[_0x5423('0x2f')]=_[_0x5423('0x30')](_0x4c90e7[_0x5423('0x2c')],_0x4c90e7[_0x5423('0x2d')]);_0x13b6f4[_0x5423('0x32')]=_[_0x5423('0x30')](_0x4c90e7['model'],qs[_0x5423('0x31')](_0x55d3ed[_0x5423('0x2d')]['fields']));_0x13b6f4[_0x5423('0x32')]=_0x13b6f4['attributes'][_0x5423('0x33')]?_0x13b6f4[_0x5423('0x32')]:_0x4c90e7['model'];_0x13b6f4[_0x5423('0x36')]=qs[_0x5423('0x37')](_0x55d3ed['query'][_0x5423('0x37')]);_0x13b6f4[_0x5423('0x39')]=qs[_0x5423('0x2f')](_['pick'](_0x55d3ed[_0x5423('0x2d')],_0x4c90e7[_0x5423('0x2f')]));if(_0x55d3ed['query']['filter']){_0x13b6f4['where']=_['merge'](_0x13b6f4[_0x5423('0x39')],{'$or':_[_0x5423('0x27')](_0x13b6f4[_0x5423('0x32')],function(_0x23840b){var _0x4b5255={};_0x4b5255[_0x23840b]={'$like':'%'+_0x55d3ed[_0x5423('0x2d')][_0x5423('0x3b')]+'%'};return _0x4b5255;})});}_0x13b6f4=_[_0x5423('0x3c')]({},_0x13b6f4,_0x55d3ed[_0x5423('0x42')]);return _0x357014[_0x5423('0x46')](_0x13b6f4);}})['then'](function(_0x49a917){if(_0x49a917){_0x7fbdb7=_0x49a917[_0x5423('0x33')];if(!_0x55d3ed[_0x5423('0x2d')][_0x5423('0x34')](_0x5423('0x35'))){_0x13b6f4['limit']=qs['limit'](_0x55d3ed[_0x5423('0x2d')][_0x5423('0x1b')]);_0x13b6f4['offset']=qs[_0x5423('0x1a')](_0x55d3ed[_0x5423('0x2d')][_0x5423('0x1a')]);}return _0x357014['getFields'](_0x13b6f4);}})[_0x5423('0x21')](function(_0x261134){if(_0x261134){return _0x261134?{'count':_0x7fbdb7,'rows':_0x261134}:null;}})[_0x5423('0x21')](respondWithResult(_0x1a8a7f,null))['catch'](handleError(_0x1a8a7f,null));};exports[_0x5423('0x49')]=function(_0x5b8d72,_0x5336aa,_0x2c37b7){var _0x628cec={};var _0x255a7e={};var _0x18284a;var _0x593f37;return db[_0x5423('0x28')][_0x5423('0x47')]({'where':{'id':_0x5b8d72[_0x5423('0x41')]['id']}})[_0x5423('0x21')](handleEntityNotFound(_0x5336aa,null))[_0x5423('0x21')](function(_0x1a7e8d){if(_0x1a7e8d){_0x18284a=_0x1a7e8d;_0x255a7e[_0x5423('0x2c')]=_['keys'](db[_0x5423('0x48')][_0x5423('0x29')]);_0x255a7e['query']=_[_0x5423('0x2e')](_0x5b8d72['query']);_0x255a7e['filters']=_[_0x5423('0x30')](_0x255a7e[_0x5423('0x2c')],_0x255a7e[_0x5423('0x2d')]);_0x628cec[_0x5423('0x32')]=_['intersection'](_0x255a7e[_0x5423('0x2c')],qs[_0x5423('0x31')](_0x5b8d72[_0x5423('0x2d')]['fields']));_0x628cec[_0x5423('0x32')]=_0x628cec[_0x5423('0x32')][_0x5423('0x33')]?_0x628cec[_0x5423('0x32')]:_0x255a7e['model'];_0x628cec['order']=qs[_0x5423('0x37')](_0x5b8d72['query'][_0x5423('0x37')]);_0x628cec[_0x5423('0x39')]=qs['filters'](_['pick'](_0x5b8d72[_0x5423('0x2d')],_0x255a7e['filters']));if(_0x5b8d72[_0x5423('0x2d')][_0x5423('0x3b')]){_0x628cec[_0x5423('0x39')]=_[_0x5423('0x3c')](_0x628cec[_0x5423('0x39')],{'$or':_['map'](_0x628cec[_0x5423('0x32')],function(_0x2b7e29){var _0xc49886={};_0xc49886[_0x2b7e29]={'$like':'%'+_0x5b8d72[_0x5423('0x2d')][_0x5423('0x3b')]+'%'};return _0xc49886;})});}_0x628cec=_[_0x5423('0x3c')]({},_0x628cec,_0x5b8d72[_0x5423('0x42')]);return _0x18284a[_0x5423('0x49')](_0x628cec);}})[_0x5423('0x21')](function(_0x55d89e){if(_0x55d89e){_0x593f37=_0x55d89e[_0x5423('0x33')];if(!_0x5b8d72[_0x5423('0x2d')][_0x5423('0x34')](_0x5423('0x35'))){_0x628cec[_0x5423('0x1b')]=qs['limit'](_0x5b8d72[_0x5423('0x2d')][_0x5423('0x1b')]);_0x628cec[_0x5423('0x1a')]=qs['offset'](_0x5b8d72[_0x5423('0x2d')][_0x5423('0x1a')]);}return _0x18284a['getSubjects'](_0x628cec);}})[_0x5423('0x21')](function(_0x5dec84){if(_0x5dec84){return _0x5dec84?{'count':_0x593f37,'rows':_0x5dec84}:null;}})[_0x5423('0x21')](respondWithResult(_0x5336aa,null))[_0x5423('0x3f')](handleError(_0x5336aa,null));};exports[_0x5423('0x4a')]=function(_0x77ea57,_0x37a27b,_0x5821f3){var _0xfe50bc={};var _0x18b0cd={};var _0x137ab7;var _0x492046;return db['SugarcrmConfiguration']['findOne']({'where':{'id':_0x77ea57[_0x5423('0x41')]['id']}})['then'](handleEntityNotFound(_0x37a27b,null))[_0x5423('0x21')](function(_0x5f3790){if(_0x5f3790){_0x137ab7=_0x5f3790;_0x18b0cd['model']=_[_0x5423('0x2e')](db[_0x5423('0x48')]['rawAttributes']);_0x18b0cd[_0x5423('0x2d')]=_[_0x5423('0x2e')](_0x77ea57[_0x5423('0x2d')]);_0x18b0cd[_0x5423('0x2f')]=_['intersection'](_0x18b0cd[_0x5423('0x2c')],_0x18b0cd['query']);_0xfe50bc[_0x5423('0x32')]=_[_0x5423('0x30')](_0x18b0cd['model'],qs[_0x5423('0x31')](_0x77ea57[_0x5423('0x2d')][_0x5423('0x31')]));_0xfe50bc[_0x5423('0x32')]=_0xfe50bc['attributes'][_0x5423('0x33')]?_0xfe50bc[_0x5423('0x32')]:_0x18b0cd[_0x5423('0x2c')];_0xfe50bc[_0x5423('0x36')]=qs['sort'](_0x77ea57[_0x5423('0x2d')][_0x5423('0x37')]);_0xfe50bc[_0x5423('0x39')]=qs[_0x5423('0x2f')](_[_0x5423('0x38')](_0x77ea57[_0x5423('0x2d')],_0x18b0cd['filters']));if(_0x77ea57[_0x5423('0x2d')][_0x5423('0x3b')]){_0xfe50bc[_0x5423('0x39')]=_[_0x5423('0x3c')](_0xfe50bc[_0x5423('0x39')],{'$or':_[_0x5423('0x27')](_0xfe50bc['attributes'],function(_0x58e553){var _0x4b6278={};_0x4b6278[_0x58e553]={'$like':'%'+_0x77ea57['query'][_0x5423('0x3b')]+'%'};return _0x4b6278;})});}_0xfe50bc=_[_0x5423('0x3c')]({},_0xfe50bc,_0x77ea57['options']);return _0x137ab7[_0x5423('0x4a')](_0xfe50bc);}})['then'](function(_0x3f5adb){if(_0x3f5adb){_0x492046=_0x3f5adb[_0x5423('0x33')];if(!_0x77ea57[_0x5423('0x2d')][_0x5423('0x34')](_0x5423('0x35'))){_0xfe50bc['limit']=qs[_0x5423('0x1b')](_0x77ea57[_0x5423('0x2d')]['limit']);_0xfe50bc[_0x5423('0x1a')]=qs[_0x5423('0x1a')](_0x77ea57[_0x5423('0x2d')][_0x5423('0x1a')]);}return _0x137ab7['getDescriptions'](_0xfe50bc);}})[_0x5423('0x21')](function(_0x29dfdf){if(_0x29dfdf){return _0x29dfdf?{'count':_0x492046,'rows':_0x29dfdf}:null;}})[_0x5423('0x21')](respondWithResult(_0x37a27b,null))[_0x5423('0x3f')](handleError(_0x37a27b,null));}; \ No newline at end of file +var _0xe24f=['type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','where','merge','filter','options','includeAll','rows','catch','find','create','body','destroy','params','getFields','findOne','order','pick','hasOwnProperty','getSubjects','SugarcrmField','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','stack','name','send','map','SugarcrmConfiguration','rawAttributes'];(function(_0x450bf6,_0x52db75){var _0x55b764=function(_0x85d649){while(--_0x85d649){_0x450bf6['push'](_0x450bf6['shift']());}};_0x55b764(++_0x52db75);}(_0xe24f,0xba));var _0xfe24=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe24f[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0xfe24('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfe24('0x1'));var jsonpatch=require(_0xfe24('0x2'));var rp=require(_0xfe24('0x3'));var moment=require(_0xfe24('0x4'));var BPromise=require(_0xfe24('0x5'));var Mustache=require('mustache');var util=require(_0xfe24('0x6'));var path=require(_0xfe24('0x7'));var sox=require(_0xfe24('0x8'));var csv=require(_0xfe24('0x9'));var ejs=require(_0xfe24('0xa'));var fs=require('fs');var fs_extra=require(_0xfe24('0xb'));var _=require(_0xfe24('0xc'));var squel=require(_0xfe24('0xd'));var crypto=require(_0xfe24('0xe'));var jsforce=require(_0xfe24('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xfe24('0x9'));var querystring=require(_0xfe24('0x10'));var Papa=require(_0xfe24('0x11'));var Redis=require(_0xfe24('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xfe24('0x13'));var as=require(_0xfe24('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfe24('0x15'))('api');var utils=require(_0xfe24('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xfe24('0x17'))['db'];function respondWithStatusCode(_0x230098,_0x14d991){_0x14d991=_0x14d991||0xcc;return function(_0x2eff2b){if(_0x2eff2b){return _0x230098[_0xfe24('0x18')](_0x14d991);}return _0x230098[_0xfe24('0x19')](_0x14d991)[_0xfe24('0x1a')]();};}function respondWithResult(_0x311e73,_0x1a7a5f){_0x1a7a5f=_0x1a7a5f||0xc8;return function(_0x2e2ec0){if(_0x2e2ec0){return _0x311e73[_0xfe24('0x19')](_0x1a7a5f)[_0xfe24('0x1b')](_0x2e2ec0);}};}function respondWithFilteredResult(_0x26d5a1,_0x2429fe){return function(_0x5ba94f){if(_0x5ba94f){var _0x5d21b1=typeof _0x2429fe[_0xfe24('0x1c')]===_0xfe24('0x1d')&&typeof _0x2429fe[_0xfe24('0x1e')]===_0xfe24('0x1d');var _0x3453c9=_0x5ba94f[_0xfe24('0x1f')];var _0x5cea52=_0x5d21b1?0x0:_0x2429fe[_0xfe24('0x1c')];var _0x3dc3aa=_0x5d21b1?_0x5ba94f['count']:_0x2429fe[_0xfe24('0x1c')]+_0x2429fe[_0xfe24('0x1e')];var _0x31c505;if(_0x3dc3aa>=_0x3453c9){_0x3dc3aa=_0x3453c9;_0x31c505=0xc8;}else{_0x31c505=0xce;}_0x26d5a1['status'](_0x31c505);return _0x26d5a1[_0xfe24('0x20')](_0xfe24('0x21'),_0x5cea52+'-'+_0x3dc3aa+'/'+_0x3453c9)[_0xfe24('0x1b')](_0x5ba94f);}return null;};}function patchUpdates(_0x317d98){return function(_0x1f01fc){try{jsonpatch[_0xfe24('0x22')](_0x1f01fc,_0x317d98,!![]);}catch(_0x596b5b){return BPromise[_0xfe24('0x23')](_0x596b5b);}return _0x1f01fc[_0xfe24('0x24')]();};}function saveUpdates(_0x68ef6f,_0x2d7041){return function(_0xbc611d){if(_0xbc611d){return _0xbc611d[_0xfe24('0x25')](_0x68ef6f)[_0xfe24('0x26')](function(_0xcf521a){return _0xcf521a;});}return null;};}function removeEntity(_0x527020,_0x197428){return function(_0x6fe7fd){if(_0x6fe7fd){return _0x6fe7fd['destroy']()[_0xfe24('0x26')](function(){_0x527020['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x29bc38,_0x1988a1){return function(_0x1b978f){if(!_0x1b978f){_0x29bc38['sendStatus'](0x194);}return _0x1b978f;};}function handleError(_0xb78815,_0x4829ec){_0x4829ec=_0x4829ec||0x1f4;return function(_0x19b1da){logger['error'](_0x19b1da[_0xfe24('0x27')]);if(_0x19b1da[_0xfe24('0x28')]){delete _0x19b1da['name'];}_0xb78815[_0xfe24('0x19')](_0x4829ec)[_0xfe24('0x29')](_0x19b1da);};}exports['index']=function(_0x4e0e84,_0x2a751f){var _0x44c1b6={},_0x209cba={},_0x335bc6={'count':0x0,'rows':[]};var _0x26bf58=_[_0xfe24('0x2a')](db[_0xfe24('0x2b')][_0xfe24('0x2c')],function(_0x5d02d9){return{'name':_0x5d02d9['fieldName'],'type':_0x5d02d9[_0xfe24('0x2d')][_0xfe24('0x2e')]};});_0x209cba[_0xfe24('0x2f')]=_[_0xfe24('0x2a')](_0x26bf58,'name');_0x209cba[_0xfe24('0x30')]=_[_0xfe24('0x31')](_0x4e0e84[_0xfe24('0x30')]);_0x209cba[_0xfe24('0x32')]=_[_0xfe24('0x33')](_0x209cba['model'],_0x209cba[_0xfe24('0x30')]);_0x44c1b6['attributes']=_[_0xfe24('0x33')](_0x209cba[_0xfe24('0x2f')],qs[_0xfe24('0x34')](_0x4e0e84[_0xfe24('0x30')][_0xfe24('0x34')]));_0x44c1b6[_0xfe24('0x35')]=_0x44c1b6[_0xfe24('0x35')][_0xfe24('0x36')]?_0x44c1b6['attributes']:_0x209cba['model'];if(!_0x4e0e84[_0xfe24('0x30')]['hasOwnProperty'](_0xfe24('0x37'))){_0x44c1b6['limit']=qs[_0xfe24('0x1e')](_0x4e0e84[_0xfe24('0x30')][_0xfe24('0x1e')]);_0x44c1b6[_0xfe24('0x1c')]=qs[_0xfe24('0x1c')](_0x4e0e84[_0xfe24('0x30')][_0xfe24('0x1c')]);}_0x44c1b6['order']=qs[_0xfe24('0x38')](_0x4e0e84[_0xfe24('0x30')][_0xfe24('0x38')]);_0x44c1b6[_0xfe24('0x39')]=qs[_0xfe24('0x32')](_['pick'](_0x4e0e84['query'],_0x209cba['filters']),_0x26bf58);if(_0x4e0e84[_0xfe24('0x30')]['filter']){_0x44c1b6['where']=_[_0xfe24('0x3a')](_0x44c1b6[_0xfe24('0x39')],{'$or':_[_0xfe24('0x2a')](_0x26bf58,function(_0x54c1a6){if(_0x54c1a6[_0xfe24('0x2d')]!=='VIRTUAL'){var _0x3a76e6={};_0x3a76e6[_0x54c1a6[_0xfe24('0x28')]]={'$like':'%'+_0x4e0e84[_0xfe24('0x30')][_0xfe24('0x3b')]+'%'};return _0x3a76e6;}})});}_0x44c1b6=_[_0xfe24('0x3a')]({},_0x44c1b6,_0x4e0e84[_0xfe24('0x3c')]);var _0x2885fe={'where':_0x44c1b6[_0xfe24('0x39')]};return db[_0xfe24('0x2b')][_0xfe24('0x1f')](_0x2885fe)['then'](function(_0x222fe0){_0x335bc6[_0xfe24('0x1f')]=_0x222fe0;if(_0x4e0e84[_0xfe24('0x30')][_0xfe24('0x3d')]){_0x44c1b6['include']=[{'all':!![]}];}return db[_0xfe24('0x2b')]['findAll'](_0x44c1b6);})[_0xfe24('0x26')](function(_0x5e0c19){_0x335bc6[_0xfe24('0x3e')]=_0x5e0c19;return _0x335bc6;})['then'](respondWithFilteredResult(_0x2a751f,_0x44c1b6))[_0xfe24('0x3f')](handleError(_0x2a751f,null));};exports['show']=function(_0x2778c8,_0x40ca44){var _0x1388c5={'raw':![],'where':{'id':_0x2778c8['params']['id']}},_0x4a7d37={};_0x4a7d37[_0xfe24('0x2f')]=_[_0xfe24('0x31')](db['SugarcrmConfiguration']['rawAttributes']);_0x4a7d37[_0xfe24('0x30')]=_[_0xfe24('0x31')](_0x2778c8[_0xfe24('0x30')]);_0x4a7d37['filters']=_[_0xfe24('0x33')](_0x4a7d37[_0xfe24('0x2f')],_0x4a7d37[_0xfe24('0x30')]);_0x1388c5[_0xfe24('0x35')]=_[_0xfe24('0x33')](_0x4a7d37[_0xfe24('0x2f')],qs[_0xfe24('0x34')](_0x2778c8['query']['fields']));_0x1388c5['attributes']=_0x1388c5['attributes'][_0xfe24('0x36')]?_0x1388c5['attributes']:_0x4a7d37[_0xfe24('0x2f')];if(_0x2778c8[_0xfe24('0x30')]['includeAll']){_0x1388c5['include']=[{'all':!![]}];}_0x1388c5=_[_0xfe24('0x3a')]({},_0x1388c5,_0x2778c8[_0xfe24('0x3c')]);return db[_0xfe24('0x2b')][_0xfe24('0x40')](_0x1388c5)['then'](handleEntityNotFound(_0x40ca44,null))[_0xfe24('0x26')](respondWithResult(_0x40ca44,null))[_0xfe24('0x3f')](handleError(_0x40ca44,null));};exports[_0xfe24('0x41')]=function(_0x4a2013,_0x23aed9){return db[_0xfe24('0x2b')]['create'](_0x4a2013['body'],{})[_0xfe24('0x26')](respondWithResult(_0x23aed9,0xc9))[_0xfe24('0x3f')](handleError(_0x23aed9,null));};exports['update']=function(_0x343818,_0x3c7107){if(_0x343818['body']['id']){delete _0x343818[_0xfe24('0x42')]['id'];}return db[_0xfe24('0x2b')][_0xfe24('0x40')]({'where':{'id':_0x343818['params']['id']}})[_0xfe24('0x26')](handleEntityNotFound(_0x3c7107,null))[_0xfe24('0x26')](saveUpdates(_0x343818[_0xfe24('0x42')],null))[_0xfe24('0x26')](respondWithResult(_0x3c7107,null))['catch'](handleError(_0x3c7107,null));};exports[_0xfe24('0x43')]=function(_0x781ff3,_0x2993a6){return db[_0xfe24('0x2b')][_0xfe24('0x40')]({'where':{'id':_0x781ff3[_0xfe24('0x44')]['id']}})['then'](handleEntityNotFound(_0x2993a6,null))[_0xfe24('0x26')](removeEntity(_0x2993a6,null))[_0xfe24('0x3f')](handleError(_0x2993a6,null));};exports[_0xfe24('0x45')]=function(_0xb3798e,_0x1097f8,_0x2d2a1f){var _0x4ebd3f={};var _0x2099a0={};var _0x47ccc1;var _0x3e3ded;return db[_0xfe24('0x2b')][_0xfe24('0x46')]({'where':{'id':_0xb3798e[_0xfe24('0x44')]['id']}})[_0xfe24('0x26')](handleEntityNotFound(_0x1097f8,null))[_0xfe24('0x26')](function(_0x5197d7){if(_0x5197d7){_0x47ccc1=_0x5197d7;_0x2099a0[_0xfe24('0x2f')]=_['keys'](db['SugarcrmField']['rawAttributes']);_0x2099a0['query']=_[_0xfe24('0x31')](_0xb3798e['query']);_0x2099a0[_0xfe24('0x32')]=_['intersection'](_0x2099a0['model'],_0x2099a0[_0xfe24('0x30')]);_0x4ebd3f[_0xfe24('0x35')]=_[_0xfe24('0x33')](_0x2099a0[_0xfe24('0x2f')],qs[_0xfe24('0x34')](_0xb3798e[_0xfe24('0x30')]['fields']));_0x4ebd3f[_0xfe24('0x35')]=_0x4ebd3f['attributes'][_0xfe24('0x36')]?_0x4ebd3f[_0xfe24('0x35')]:_0x2099a0['model'];_0x4ebd3f[_0xfe24('0x47')]=qs[_0xfe24('0x38')](_0xb3798e[_0xfe24('0x30')]['sort']);_0x4ebd3f[_0xfe24('0x39')]=qs['filters'](_[_0xfe24('0x48')](_0xb3798e['query'],_0x2099a0[_0xfe24('0x32')]));if(_0xb3798e[_0xfe24('0x30')][_0xfe24('0x3b')]){_0x4ebd3f['where']=_[_0xfe24('0x3a')](_0x4ebd3f[_0xfe24('0x39')],{'$or':_[_0xfe24('0x2a')](_0x4ebd3f['attributes'],function(_0x4c2f4b){var _0x35c861={};_0x35c861[_0x4c2f4b]={'$like':'%'+_0xb3798e['query'][_0xfe24('0x3b')]+'%'};return _0x35c861;})});}_0x4ebd3f=_[_0xfe24('0x3a')]({},_0x4ebd3f,_0xb3798e[_0xfe24('0x3c')]);return _0x47ccc1[_0xfe24('0x45')](_0x4ebd3f);}})[_0xfe24('0x26')](function(_0x4a779f){if(_0x4a779f){_0x3e3ded=_0x4a779f[_0xfe24('0x36')];if(!_0xb3798e[_0xfe24('0x30')][_0xfe24('0x49')]('nolimit')){_0x4ebd3f[_0xfe24('0x1e')]=qs['limit'](_0xb3798e[_0xfe24('0x30')][_0xfe24('0x1e')]);_0x4ebd3f['offset']=qs[_0xfe24('0x1c')](_0xb3798e[_0xfe24('0x30')]['offset']);}return _0x47ccc1['getFields'](_0x4ebd3f);}})['then'](function(_0xee9f9c){if(_0xee9f9c){return _0xee9f9c?{'count':_0x3e3ded,'rows':_0xee9f9c}:null;}})[_0xfe24('0x26')](respondWithResult(_0x1097f8,null))[_0xfe24('0x3f')](handleError(_0x1097f8,null));};exports[_0xfe24('0x4a')]=function(_0x13afbe,_0x1d2210,_0x46246b){var _0x246af4={};var _0x1df6e5={};var _0x2806e9;var _0x1871c6;return db[_0xfe24('0x2b')][_0xfe24('0x46')]({'where':{'id':_0x13afbe[_0xfe24('0x44')]['id']}})[_0xfe24('0x26')](handleEntityNotFound(_0x1d2210,null))[_0xfe24('0x26')](function(_0x3668b2){if(_0x3668b2){_0x2806e9=_0x3668b2;_0x1df6e5[_0xfe24('0x2f')]=_['keys'](db[_0xfe24('0x4b')]['rawAttributes']);_0x1df6e5[_0xfe24('0x30')]=_['keys'](_0x13afbe[_0xfe24('0x30')]);_0x1df6e5['filters']=_[_0xfe24('0x33')](_0x1df6e5[_0xfe24('0x2f')],_0x1df6e5['query']);_0x246af4[_0xfe24('0x35')]=_['intersection'](_0x1df6e5['model'],qs[_0xfe24('0x34')](_0x13afbe['query'][_0xfe24('0x34')]));_0x246af4[_0xfe24('0x35')]=_0x246af4['attributes'][_0xfe24('0x36')]?_0x246af4[_0xfe24('0x35')]:_0x1df6e5[_0xfe24('0x2f')];_0x246af4[_0xfe24('0x47')]=qs[_0xfe24('0x38')](_0x13afbe[_0xfe24('0x30')]['sort']);_0x246af4[_0xfe24('0x39')]=qs[_0xfe24('0x32')](_['pick'](_0x13afbe['query'],_0x1df6e5['filters']));if(_0x13afbe[_0xfe24('0x30')][_0xfe24('0x3b')]){_0x246af4['where']=_[_0xfe24('0x3a')](_0x246af4['where'],{'$or':_[_0xfe24('0x2a')](_0x246af4[_0xfe24('0x35')],function(_0x4ec738){var _0x5b4cc9={};_0x5b4cc9[_0x4ec738]={'$like':'%'+_0x13afbe['query']['filter']+'%'};return _0x5b4cc9;})});}_0x246af4=_[_0xfe24('0x3a')]({},_0x246af4,_0x13afbe['options']);return _0x2806e9[_0xfe24('0x4a')](_0x246af4);}})[_0xfe24('0x26')](function(_0x16016b){if(_0x16016b){_0x1871c6=_0x16016b[_0xfe24('0x36')];if(!_0x13afbe[_0xfe24('0x30')][_0xfe24('0x49')](_0xfe24('0x37'))){_0x246af4[_0xfe24('0x1e')]=qs['limit'](_0x13afbe['query'][_0xfe24('0x1e')]);_0x246af4[_0xfe24('0x1c')]=qs[_0xfe24('0x1c')](_0x13afbe[_0xfe24('0x30')]['offset']);}return _0x2806e9[_0xfe24('0x4a')](_0x246af4);}})[_0xfe24('0x26')](function(_0x1a50b7){if(_0x1a50b7){return _0x1a50b7?{'count':_0x1871c6,'rows':_0x1a50b7}:null;}})[_0xfe24('0x26')](respondWithResult(_0x1d2210,null))[_0xfe24('0x3f')](handleError(_0x1d2210,null));};exports['getDescriptions']=function(_0x2664ed,_0x4a8c4c,_0x3d324c){var _0xdc2883={};var _0x561028={};var _0x395727;var _0x480df;return db[_0xfe24('0x2b')][_0xfe24('0x46')]({'where':{'id':_0x2664ed[_0xfe24('0x44')]['id']}})['then'](handleEntityNotFound(_0x4a8c4c,null))['then'](function(_0xa3e699){if(_0xa3e699){_0x395727=_0xa3e699;_0x561028['model']=_['keys'](db[_0xfe24('0x4b')][_0xfe24('0x2c')]);_0x561028[_0xfe24('0x30')]=_[_0xfe24('0x31')](_0x2664ed['query']);_0x561028['filters']=_['intersection'](_0x561028['model'],_0x561028['query']);_0xdc2883[_0xfe24('0x35')]=_[_0xfe24('0x33')](_0x561028['model'],qs[_0xfe24('0x34')](_0x2664ed[_0xfe24('0x30')][_0xfe24('0x34')]));_0xdc2883[_0xfe24('0x35')]=_0xdc2883[_0xfe24('0x35')][_0xfe24('0x36')]?_0xdc2883[_0xfe24('0x35')]:_0x561028[_0xfe24('0x2f')];_0xdc2883[_0xfe24('0x47')]=qs[_0xfe24('0x38')](_0x2664ed[_0xfe24('0x30')]['sort']);_0xdc2883[_0xfe24('0x39')]=qs[_0xfe24('0x32')](_['pick'](_0x2664ed[_0xfe24('0x30')],_0x561028[_0xfe24('0x32')]));if(_0x2664ed['query'][_0xfe24('0x3b')]){_0xdc2883[_0xfe24('0x39')]=_[_0xfe24('0x3a')](_0xdc2883[_0xfe24('0x39')],{'$or':_[_0xfe24('0x2a')](_0xdc2883['attributes'],function(_0x2f060d){var _0x14e17a={};_0x14e17a[_0x2f060d]={'$like':'%'+_0x2664ed['query'][_0xfe24('0x3b')]+'%'};return _0x14e17a;})});}_0xdc2883=_['merge']({},_0xdc2883,_0x2664ed[_0xfe24('0x3c')]);return _0x395727[_0xfe24('0x4c')](_0xdc2883);}})[_0xfe24('0x26')](function(_0xd1308){if(_0xd1308){_0x480df=_0xd1308[_0xfe24('0x36')];if(!_0x2664ed[_0xfe24('0x30')][_0xfe24('0x49')]('nolimit')){_0xdc2883[_0xfe24('0x1e')]=qs[_0xfe24('0x1e')](_0x2664ed[_0xfe24('0x30')][_0xfe24('0x1e')]);_0xdc2883[_0xfe24('0x1c')]=qs[_0xfe24('0x1c')](_0x2664ed['query']['offset']);}return _0x395727[_0xfe24('0x4c')](_0xdc2883);}})[_0xfe24('0x26')](function(_0x45ab9f){if(_0x45ab9f){return _0x45ab9f?{'count':_0x480df,'rows':_0x45ab9f}:null;}})[_0xfe24('0x26')](respondWithResult(_0x4a8c4c,null))[_0xfe24('0x3f')](handleError(_0x4a8c4c,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 98375f3..5bc873a 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 _0xbb9d=['util','api','moment','request-promise','path','rimraf','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash'];(function(_0x2e3c8b,_0xe974db){var _0x24d172=function(_0x5bd16d){while(--_0x5bd16d){_0x2e3c8b['push'](_0x2e3c8b['shift']());}};_0x24d172(++_0xe974db);}(_0xbb9d,0x113));var _0xdbb9=function(_0x384458,_0x527dca){_0x384458=_0x384458-0x0;var _0x1a186b=_0xbb9d[_0x384458];return _0x1a186b;};'use strict';var _=require(_0xdbb9('0x0'));var util=require(_0xdbb9('0x1'));var logger=require('../../config/logger')(_0xdbb9('0x2'));var moment=require(_0xdbb9('0x3'));var BPromise=require('bluebird');var rp=require(_0xdbb9('0x4'));var fs=require('fs');var path=require(_0xdbb9('0x5'));var rimraf=require(_0xdbb9('0x6'));var config=require('../../config/environment');var attributes=require(_0xdbb9('0x7'));module[_0xdbb9('0x8')]=function(_0x5c2f76,_0x35278a){return _0x5c2f76[_0xdbb9('0x9')](_0xdbb9('0xa'),attributes,{'tableName':_0xdbb9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x694a=['define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports'];(function(_0x2239bb,_0x3531c1){var _0x344874=function(_0x3e52fa){while(--_0x3e52fa){_0x2239bb['push'](_0x2239bb['shift']());}};_0x344874(++_0x3531c1);}(_0x694a,0x121));var _0xa694=function(_0x1f6775,_0x46110c){_0x1f6775=_0x1f6775-0x0;var _0x908991=_0x694a[_0x1f6775];return _0x908991;};'use strict';var _=require(_0xa694('0x0'));var util=require('util');var logger=require(_0xa694('0x1'))(_0xa694('0x2'));var moment=require('moment');var BPromise=require(_0xa694('0x3'));var rp=require(_0xa694('0x4'));var fs=require('fs');var path=require(_0xa694('0x5'));var rimraf=require(_0xa694('0x6'));var config=require(_0xa694('0x7'));var attributes=require(_0xa694('0x8'));module[_0xa694('0x9')]=function(_0x50af83,_0x2eeff5){return _0x50af83[_0xa694('0xa')](_0xa694('0xb'),attributes,{'tableName':_0xa694('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index 511be06..9fb989c 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 _0x5b3e=['../../config/environment','jayson/promise','client','http','request','then','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x33f5c8,_0x5202bb){var _0x4ea43f=function(_0x16be2b){while(--_0x16be2b){_0x33f5c8['push'](_0x33f5c8['shift']());}};_0x4ea43f(++_0x5202bb);}(_0x5b3e,0x1f0));var _0xe5b3=function(_0x2bd7b6,_0x2e6c14){_0x2bd7b6=_0x2bd7b6-0x0;var _0x19c192=_0x5b3e[_0x2bd7b6];return _0x19c192;};'use strict';var _=require(_0xe5b3('0x0'));var util=require(_0xe5b3('0x1'));var moment=require(_0xe5b3('0x2'));var BPromise=require(_0xe5b3('0x3'));var rs=require(_0xe5b3('0x4'));var fs=require('fs');var Redis=require(_0xe5b3('0x5'));var db=require(_0xe5b3('0x6'))['db'];var utils=require(_0xe5b3('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xe5b3('0x8'));var jayson=require(_0xe5b3('0x9'));var client=jayson[_0xe5b3('0xa')][_0xe5b3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x157037,_0x5f5ca9,_0x56c538){return new BPromise(function(_0x15a49f,_0x4c7d6b){return client[_0xe5b3('0xc')](_0x157037,_0x56c538)[_0xe5b3('0xd')](function(_0x4f30d3){logger['info'](_0xe5b3('0xe'),_0x5f5ca9,_0xe5b3('0xf'));logger['debug']('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x5f5ca9,_0xe5b3('0xf'),JSON['stringify'](_0x4f30d3));if(_0x4f30d3[_0xe5b3('0x10')]){if(_0x4f30d3[_0xe5b3('0x10')][_0xe5b3('0x11')]===0x1f4){logger['error'](_0xe5b3('0xe'),_0x5f5ca9,_0x4f30d3[_0xe5b3('0x10')][_0xe5b3('0x12')]);return _0x4c7d6b(_0x4f30d3['error'][_0xe5b3('0x12')]);}logger[_0xe5b3('0x10')](_0xe5b3('0xe'),_0x5f5ca9,_0x4f30d3[_0xe5b3('0x10')]['message']);return _0x15a49f(_0x4f30d3[_0xe5b3('0x10')][_0xe5b3('0x12')]);}else{logger['info'](_0xe5b3('0xe'),_0x5f5ca9,_0xe5b3('0xf'));_0x15a49f(_0x4f30d3[_0xe5b3('0x13')]['message']);}})[_0xe5b3('0x14')](function(_0x26da73){logger[_0xe5b3('0x10')](_0xe5b3('0xe'),_0x5f5ca9,_0x26da73);_0x4c7d6b(_0x26da73);});});} \ No newline at end of file +var _0xda83=['request\x20sent','error','code','message','result','catch','lodash','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x1d9341,_0x361139){var _0x48a051=function(_0x54f7f8){while(--_0x54f7f8){_0x1d9341['push'](_0x1d9341['shift']());}};_0x48a051(++_0x361139);}(_0xda83,0xd7));var _0x3da8=function(_0x406715,_0x8fd20c){_0x406715=_0x406715-0x0;var _0x56e1e8=_0xda83[_0x406715];return _0x56e1e8;};'use strict';var _=require(_0x3da8('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3da8('0x1'));var fs=require('fs');var Redis=require(_0x3da8('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x3da8('0x3'));var logger=require(_0x3da8('0x4'))('rpc');var config=require(_0x3da8('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x3da8('0x6')][_0x3da8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x15ee98,_0x540c6e,_0x415d77){return new BPromise(function(_0x1ec78d,_0x588b83){return client[_0x3da8('0x8')](_0x15ee98,_0x415d77)[_0x3da8('0x9')](function(_0x272bd5){logger[_0x3da8('0xa')](_0x3da8('0xb'),_0x540c6e,'request\x20sent');logger['debug'](_0x3da8('0xc'),_0x540c6e,_0x3da8('0xd'),JSON['stringify'](_0x272bd5));if(_0x272bd5['error']){if(_0x272bd5[_0x3da8('0xe')][_0x3da8('0xf')]===0x1f4){logger[_0x3da8('0xe')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x540c6e,_0x272bd5[_0x3da8('0xe')][_0x3da8('0x10')]);return _0x588b83(_0x272bd5['error']['message']);}logger[_0x3da8('0xe')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x540c6e,_0x272bd5[_0x3da8('0xe')][_0x3da8('0x10')]);return _0x1ec78d(_0x272bd5[_0x3da8('0xe')][_0x3da8('0x10')]);}else{logger['info'](_0x3da8('0xb'),_0x540c6e,_0x3da8('0xd'));_0x1ec78d(_0x272bd5[_0x3da8('0x11')][_0x3da8('0x10')]);}})[_0x3da8('0x12')](function(_0x83624e){logger[_0x3da8('0xe')](_0x3da8('0xb'),_0x540c6e,_0x83624e);_0x588b83(_0x83624e);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 24218fb..8d2442b 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 _0x0fe8=['create','update','delete','/:id','destroy','exports','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','index','show','post'];(function(_0xcd9ec8,_0x27699f){var _0x5aa31b=function(_0x32f922){while(--_0x32f922){_0xcd9ec8['push'](_0xcd9ec8['shift']());}};_0x5aa31b(++_0x27699f);}(_0x0fe8,0x102));var _0x80fe=function(_0x71891a,_0x18758b){_0x71891a=_0x71891a-0x0;var _0x38405a=_0x0fe8[_0x71891a];return _0x38405a;};'use strict';var multer=require('multer');var util=require(_0x80fe('0x0'));var path=require('path');var timeout=require(_0x80fe('0x1'));var express=require('express');var router=express[_0x80fe('0x2')]();var fs_extra=require(_0x80fe('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x80fe('0x4'));var config=require(_0x80fe('0x5'));var controller=require(_0x80fe('0x6'));router[_0x80fe('0x7')]('/',auth[_0x80fe('0x8')](),controller[_0x80fe('0x9')]);router['get']('/:id',auth[_0x80fe('0x8')](),controller[_0x80fe('0xa')]);router[_0x80fe('0xb')]('/',auth['isAuthenticated'](),controller[_0x80fe('0xc')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x80fe('0xd')]);router[_0x80fe('0xe')](_0x80fe('0xf'),auth['isAuthenticated'](),controller[_0x80fe('0x10')]);module[_0x80fe('0x11')]=router; \ No newline at end of file +var _0xd074=['util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./intSugarcrmField.controller','get','isAuthenticated','create','put','/:id','update','delete','destroy','exports','multer'];(function(_0xee0936,_0x229e9b){var _0x93c116=function(_0x2d18cc){while(--_0x2d18cc){_0xee0936['push'](_0xee0936['shift']());}};_0x93c116(++_0x229e9b);}(_0xd074,0xdc));var _0x4d07=function(_0x5bd7d0,_0x535f62){_0x5bd7d0=_0x5bd7d0-0x0;var _0x4dfccb=_0xd074[_0x5bd7d0];return _0x4dfccb;};'use strict';var multer=require(_0x4d07('0x0'));var util=require(_0x4d07('0x1'));var path=require('path');var timeout=require(_0x4d07('0x2'));var express=require(_0x4d07('0x3'));var router=express[_0x4d07('0x4')]();var fs_extra=require(_0x4d07('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x4d07('0x6'));var config=require('../../config/environment');var controller=require(_0x4d07('0x7'));router[_0x4d07('0x8')]('/',auth[_0x4d07('0x9')](),controller['index']);router[_0x4d07('0x8')]('/:id',auth[_0x4d07('0x9')](),controller['show']);router['post']('/',auth[_0x4d07('0x9')](),controller[_0x4d07('0xa')]);router[_0x4d07('0xb')](_0x4d07('0xc'),auth['isAuthenticated'](),controller[_0x4d07('0xd')]);router[_0x4d07('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x4d07('0xf')]);module[_0x4d07('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 1515d99..bbac350 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 _0x9908=['keyValue','string','variable','STRING','sequelize','ENUM','customVariable'];(function(_0x35f15b,_0x387db3){var _0x262619=function(_0x4467b9){while(--_0x4467b9){_0x35f15b['push'](_0x35f15b['shift']());}};_0x262619(++_0x387db3);}(_0x9908,0x7b));var _0x8990=function(_0x92a3d9,_0xcf3970){_0x92a3d9=_0x92a3d9-0x0;var _0x56458b=_0x9908[_0x92a3d9];return _0x56458b;};'use strict';var Sequelize=require(_0x8990('0x0'));module['exports']={'type':{'type':Sequelize[_0x8990('0x1')]('string','variable',_0x8990('0x2'),_0x8990('0x3'),'picklist'),'defaultValue':_0x8990('0x4')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x8990('0x1')]('string',_0x8990('0x5'),_0x8990('0x2'))},'keyContent':{'type':Sequelize[_0x8990('0x6')]},'idField':{'type':Sequelize[_0x8990('0x6')]},'nameField':{'type':Sequelize[_0x8990('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8990('0x6')]}}; \ No newline at end of file +var _0x1e6e=['keyValue','string','STRING','ENUM','exports','variable','customVariable'];(function(_0x1e0999,_0x5a644a){var _0x214142=function(_0x14cf90){while(--_0x14cf90){_0x1e0999['push'](_0x1e0999['shift']());}};_0x214142(++_0x5a644a);}(_0x1e6e,0x170));var _0xe1e6=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0x1e6e[_0x36884e];return _0x1cc367;};'use strict';var Sequelize=require('sequelize');module[_0xe1e6('0x0')]={'type':{'type':Sequelize['ENUM']('string',_0xe1e6('0x1'),_0xe1e6('0x2'),_0xe1e6('0x3'),'picklist'),'defaultValue':_0xe1e6('0x4')},'content':{'type':Sequelize[_0xe1e6('0x5')]},'key':{'type':Sequelize[_0xe1e6('0x5')]},'keyType':{'type':Sequelize[_0xe1e6('0x6')]('string',_0xe1e6('0x1'),_0xe1e6('0x2'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xe1e6('0x5')]},'nameField':{'type':Sequelize[_0xe1e6('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe1e6('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index c85e8b1..43a7af3 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 _0xcc8a=['type','VIRTUAL','findAll','catch','show','includeAll','include','options','find','create','body','update','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','destroy','then','stack','name','send','map','SugarcrmField','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge'];(function(_0x3e9802,_0x484b2e){var _0xad74e4=function(_0x1b7fe2){while(--_0x1b7fe2){_0x3e9802['push'](_0x3e9802['shift']());}};_0xad74e4(++_0x484b2e);}(_0xcc8a,0xa1));var _0xacc8=function(_0x534dc7,_0x2ba317){_0x534dc7=_0x534dc7-0x0;var _0x49d3e4=_0xcc8a[_0x534dc7];return _0x49d3e4;};'use strict';var emlformat=require(_0xacc8('0x0'));var rimraf=require(_0xacc8('0x1'));var zipdir=require(_0xacc8('0x2'));var jsonpatch=require(_0xacc8('0x3'));var rp=require(_0xacc8('0x4'));var moment=require(_0xacc8('0x5'));var BPromise=require(_0xacc8('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xacc8('0x7'));var sox=require('sox');var csv=require(_0xacc8('0x8'));var ejs=require(_0xacc8('0x9'));var fs=require('fs');var fs_extra=require(_0xacc8('0xa'));var _=require(_0xacc8('0xb'));var squel=require(_0xacc8('0xc'));var crypto=require(_0xacc8('0xd'));var jsforce=require(_0xacc8('0xe'));var deskjs=require(_0xacc8('0xf'));var toCsv=require(_0xacc8('0x8'));var querystring=require(_0xacc8('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xacc8('0x11'));var qs=require(_0xacc8('0x12'));var as=require(_0xacc8('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xacc8('0x14'))(_0xacc8('0x15'));var utils=require(_0xacc8('0x16'));var config=require(_0xacc8('0x17'));var licenseUtil=require(_0xacc8('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x38d50b,_0x551253){_0x551253=_0x551253||0xcc;return function(_0x29b856){if(_0x29b856){return _0x38d50b[_0xacc8('0x19')](_0x551253);}return _0x38d50b[_0xacc8('0x1a')](_0x551253)[_0xacc8('0x1b')]();};}function respondWithResult(_0xb254f1,_0x26a580){_0x26a580=_0x26a580||0xc8;return function(_0x43cac4){if(_0x43cac4){return _0xb254f1[_0xacc8('0x1a')](_0x26a580)[_0xacc8('0x1c')](_0x43cac4);}};}function respondWithFilteredResult(_0x11121f,_0x309144){return function(_0xceeb55){if(_0xceeb55){var _0x14ed45=typeof _0x309144[_0xacc8('0x1d')]===_0xacc8('0x1e')&&typeof _0x309144[_0xacc8('0x1f')]===_0xacc8('0x1e');var _0x47a552=_0xceeb55[_0xacc8('0x20')];var _0x4d10ad=_0x14ed45?0x0:_0x309144['offset'];var _0x34583a=_0x14ed45?_0xceeb55[_0xacc8('0x20')]:_0x309144[_0xacc8('0x1d')]+_0x309144[_0xacc8('0x1f')];var _0x2fc5d8;if(_0x34583a>=_0x47a552){_0x34583a=_0x47a552;_0x2fc5d8=0xc8;}else{_0x2fc5d8=0xce;}_0x11121f[_0xacc8('0x1a')](_0x2fc5d8);return _0x11121f[_0xacc8('0x21')](_0xacc8('0x22'),_0x4d10ad+'-'+_0x34583a+'/'+_0x47a552)[_0xacc8('0x1c')](_0xceeb55);}return null;};}function patchUpdates(_0x3caae3){return function(_0x26244b){try{jsonpatch['apply'](_0x26244b,_0x3caae3,!![]);}catch(_0x32878f){return BPromise[_0xacc8('0x23')](_0x32878f);}return _0x26244b[_0xacc8('0x24')]();};}function saveUpdates(_0x4a31c3,_0x26dd40){return function(_0x901ce){if(_0x901ce){return _0x901ce['update'](_0x4a31c3)['then'](function(_0x15d960){return _0x15d960;});}return null;};}function removeEntity(_0x543c15,_0x49946f){return function(_0x5c8684){if(_0x5c8684){return _0x5c8684[_0xacc8('0x25')]()[_0xacc8('0x26')](function(){_0x543c15[_0xacc8('0x1a')](0xcc)[_0xacc8('0x1b')]();});}};}function handleEntityNotFound(_0x19b9b6,_0x4fb1f9){return function(_0x371c99){if(!_0x371c99){_0x19b9b6[_0xacc8('0x19')](0x194);}return _0x371c99;};}function handleError(_0x1bcc25,_0x515d8d){_0x515d8d=_0x515d8d||0x1f4;return function(_0x5c3a42){logger['error'](_0x5c3a42[_0xacc8('0x27')]);if(_0x5c3a42['name']){delete _0x5c3a42[_0xacc8('0x28')];}_0x1bcc25['status'](_0x515d8d)[_0xacc8('0x29')](_0x5c3a42);};}exports['index']=function(_0x36e06c,_0x16f1c2){var _0x3c3d60={},_0x774f2f={},_0x2cc9b1={'count':0x0,'rows':[]};var _0x2405d7=_[_0xacc8('0x2a')](db[_0xacc8('0x2b')][_0xacc8('0x2c')],function(_0x17416d){return{'name':_0x17416d[_0xacc8('0x2d')],'type':_0x17416d['type'][_0xacc8('0x2e')]};});_0x774f2f['model']=_[_0xacc8('0x2a')](_0x2405d7,_0xacc8('0x28'));_0x774f2f[_0xacc8('0x2f')]=_[_0xacc8('0x30')](_0x36e06c[_0xacc8('0x2f')]);_0x774f2f[_0xacc8('0x31')]=_[_0xacc8('0x32')](_0x774f2f[_0xacc8('0x33')],_0x774f2f['query']);_0x3c3d60[_0xacc8('0x34')]=_[_0xacc8('0x32')](_0x774f2f['model'],qs[_0xacc8('0x35')](_0x36e06c[_0xacc8('0x2f')][_0xacc8('0x35')]));_0x3c3d60[_0xacc8('0x34')]=_0x3c3d60[_0xacc8('0x34')]['length']?_0x3c3d60['attributes']:_0x774f2f['model'];if(!_0x36e06c[_0xacc8('0x2f')][_0xacc8('0x36')](_0xacc8('0x37'))){_0x3c3d60[_0xacc8('0x1f')]=qs[_0xacc8('0x1f')](_0x36e06c[_0xacc8('0x2f')][_0xacc8('0x1f')]);_0x3c3d60[_0xacc8('0x1d')]=qs[_0xacc8('0x1d')](_0x36e06c[_0xacc8('0x2f')]['offset']);}_0x3c3d60[_0xacc8('0x38')]=qs['sort'](_0x36e06c[_0xacc8('0x2f')][_0xacc8('0x39')]);_0x3c3d60[_0xacc8('0x3a')]=qs[_0xacc8('0x31')](_['pick'](_0x36e06c[_0xacc8('0x2f')],_0x774f2f['filters']),_0x2405d7);if(_0x36e06c[_0xacc8('0x2f')][_0xacc8('0x3b')]){_0x3c3d60[_0xacc8('0x3a')]=_[_0xacc8('0x3c')](_0x3c3d60[_0xacc8('0x3a')],{'$or':_[_0xacc8('0x2a')](_0x2405d7,function(_0x4b2263){if(_0x4b2263[_0xacc8('0x3d')]!==_0xacc8('0x3e')){var _0x409372={};_0x409372[_0x4b2263[_0xacc8('0x28')]]={'$like':'%'+_0x36e06c[_0xacc8('0x2f')][_0xacc8('0x3b')]+'%'};return _0x409372;}})});}_0x3c3d60=_[_0xacc8('0x3c')]({},_0x3c3d60,_0x36e06c['options']);var _0x2f95d1={'where':_0x3c3d60['where']};return db[_0xacc8('0x2b')][_0xacc8('0x20')](_0x2f95d1)[_0xacc8('0x26')](function(_0xa15770){_0x2cc9b1['count']=_0xa15770;if(_0x36e06c[_0xacc8('0x2f')]['includeAll']){_0x3c3d60['include']=[{'all':!![]}];}return db['SugarcrmField'][_0xacc8('0x3f')](_0x3c3d60);})[_0xacc8('0x26')](function(_0x79a31c){_0x2cc9b1['rows']=_0x79a31c;return _0x2cc9b1;})[_0xacc8('0x26')](respondWithFilteredResult(_0x16f1c2,_0x3c3d60))[_0xacc8('0x40')](handleError(_0x16f1c2,null));};exports[_0xacc8('0x41')]=function(_0x10cdcd,_0x393dfc){var _0x4ff661={'raw':!![],'where':{'id':_0x10cdcd['params']['id']}},_0x318267={};_0x318267[_0xacc8('0x33')]=_['keys'](db[_0xacc8('0x2b')][_0xacc8('0x2c')]);_0x318267['query']=_[_0xacc8('0x30')](_0x10cdcd[_0xacc8('0x2f')]);_0x318267[_0xacc8('0x31')]=_[_0xacc8('0x32')](_0x318267['model'],_0x318267[_0xacc8('0x2f')]);_0x4ff661[_0xacc8('0x34')]=_[_0xacc8('0x32')](_0x318267['model'],qs[_0xacc8('0x35')](_0x10cdcd[_0xacc8('0x2f')][_0xacc8('0x35')]));_0x4ff661[_0xacc8('0x34')]=_0x4ff661[_0xacc8('0x34')]['length']?_0x4ff661['attributes']:_0x318267['model'];if(_0x10cdcd[_0xacc8('0x2f')][_0xacc8('0x42')]){_0x4ff661[_0xacc8('0x43')]=[{'all':!![]}];}_0x4ff661=_[_0xacc8('0x3c')]({},_0x4ff661,_0x10cdcd[_0xacc8('0x44')]);return db[_0xacc8('0x2b')][_0xacc8('0x45')](_0x4ff661)[_0xacc8('0x26')](handleEntityNotFound(_0x393dfc,null))['then'](respondWithResult(_0x393dfc,null))[_0xacc8('0x40')](handleError(_0x393dfc,null));};exports[_0xacc8('0x46')]=function(_0x2f2d3b,_0x3b2e51){return db['SugarcrmField'][_0xacc8('0x46')](_0x2f2d3b[_0xacc8('0x47')],{})[_0xacc8('0x26')](respondWithResult(_0x3b2e51,0xc9))[_0xacc8('0x40')](handleError(_0x3b2e51,null));};exports[_0xacc8('0x48')]=function(_0x96a2aa,_0xe71b3f){if(_0x96a2aa[_0xacc8('0x47')]['id']){delete _0x96a2aa[_0xacc8('0x47')]['id'];}return db[_0xacc8('0x2b')]['find']({'where':{'id':_0x96a2aa['params']['id']}})['then'](handleEntityNotFound(_0xe71b3f,null))[_0xacc8('0x26')](saveUpdates(_0x96a2aa['body'],null))[_0xacc8('0x26')](respondWithResult(_0xe71b3f,null))['catch'](handleError(_0xe71b3f,null));};exports[_0xacc8('0x25')]=function(_0x32e062,_0x4fdd5a){return db[_0xacc8('0x2b')][_0xacc8('0x45')]({'where':{'id':_0x32e062[_0xacc8('0x49')]['id']}})['then'](handleEntityNotFound(_0x4fdd5a,null))['then'](removeEntity(_0x4fdd5a,null))['catch'](handleError(_0x4fdd5a,null));}; \ No newline at end of file +var _0xee0f=['fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','json','apply','reject','save','update','then','destroy','stack','name','map','SugarcrmField','rawAttributes','key','model','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','type','VIRTUAL','filter','merge','options','includeAll','include','findAll','catch','show','fields','find','create','body','params','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','to-csv'];(function(_0x5c2054,_0x4c46d3){var _0x4000d5=function(_0x31ba4d){while(--_0x31ba4d){_0x5c2054['push'](_0x5c2054['shift']());}};_0x4000d5(++_0x4c46d3);}(_0xee0f,0x118));var _0xfee0=function(_0x52598d,_0x10fb73){_0x52598d=_0x52598d-0x0;var _0x170309=_0xee0f[_0x52598d];return _0x170309;};'use strict';var emlformat=require(_0xfee0('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xfee0('0x1'));var rp=require(_0xfee0('0x2'));var moment=require(_0xfee0('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xfee0('0x4'));var util=require(_0xfee0('0x5'));var path=require(_0xfee0('0x6'));var sox=require('sox');var csv=require(_0xfee0('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfee0('0x8'));var _=require(_0xfee0('0x9'));var squel=require(_0xfee0('0xa'));var crypto=require('crypto');var jsforce=require(_0xfee0('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xfee0('0x7'));var querystring=require(_0xfee0('0xc'));var Papa=require(_0xfee0('0xd'));var Redis=require(_0xfee0('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xfee0('0xf'));var as=require(_0xfee0('0x10'));var hardwareService=require(_0xfee0('0x11'));var logger=require(_0xfee0('0x12'))(_0xfee0('0x13'));var utils=require(_0xfee0('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xfee0('0x15'));var db=require(_0xfee0('0x16'))['db'];function respondWithStatusCode(_0x45d920,_0x101a4c){_0x101a4c=_0x101a4c||0xcc;return function(_0x44f2bb){if(_0x44f2bb){return _0x45d920[_0xfee0('0x17')](_0x101a4c);}return _0x45d920[_0xfee0('0x18')](_0x101a4c)[_0xfee0('0x19')]();};}function respondWithResult(_0x193ebb,_0x2126d3){_0x2126d3=_0x2126d3||0xc8;return function(_0x22b34e){if(_0x22b34e){return _0x193ebb['status'](_0x2126d3)['json'](_0x22b34e);}};}function respondWithFilteredResult(_0x4faace,_0x4f27bd){return function(_0x35892e){if(_0x35892e){var _0x4ab7d7=typeof _0x4f27bd[_0xfee0('0x1a')]===_0xfee0('0x1b')&&typeof _0x4f27bd['limit']==='undefined';var _0x3c9aeb=_0x35892e[_0xfee0('0x1c')];var _0x2bd53a=_0x4ab7d7?0x0:_0x4f27bd[_0xfee0('0x1a')];var _0xd9ed68=_0x4ab7d7?_0x35892e['count']:_0x4f27bd[_0xfee0('0x1a')]+_0x4f27bd[_0xfee0('0x1d')];var _0x1d4ef5;if(_0xd9ed68>=_0x3c9aeb){_0xd9ed68=_0x3c9aeb;_0x1d4ef5=0xc8;}else{_0x1d4ef5=0xce;}_0x4faace[_0xfee0('0x18')](_0x1d4ef5);return _0x4faace[_0xfee0('0x1e')]('Content-Range',_0x2bd53a+'-'+_0xd9ed68+'/'+_0x3c9aeb)[_0xfee0('0x1f')](_0x35892e);}return null;};}function patchUpdates(_0x244e6a){return function(_0x3dc186){try{jsonpatch[_0xfee0('0x20')](_0x3dc186,_0x244e6a,!![]);}catch(_0x28381c){return BPromise[_0xfee0('0x21')](_0x28381c);}return _0x3dc186[_0xfee0('0x22')]();};}function saveUpdates(_0x4a3dd0,_0x42829c){return function(_0x2a0146){if(_0x2a0146){return _0x2a0146[_0xfee0('0x23')](_0x4a3dd0)[_0xfee0('0x24')](function(_0x1d14da){return _0x1d14da;});}return null;};}function removeEntity(_0x451e22,_0x3a43f3){return function(_0x200cac){if(_0x200cac){return _0x200cac[_0xfee0('0x25')]()[_0xfee0('0x24')](function(){_0x451e22[_0xfee0('0x18')](0xcc)[_0xfee0('0x19')]();});}};}function handleEntityNotFound(_0x240297,_0x3fffca){return function(_0x4c18dc){if(!_0x4c18dc){_0x240297[_0xfee0('0x17')](0x194);}return _0x4c18dc;};}function handleError(_0xa76203,_0x1814fd){_0x1814fd=_0x1814fd||0x1f4;return function(_0x4bee28){logger['error'](_0x4bee28[_0xfee0('0x26')]);if(_0x4bee28[_0xfee0('0x27')]){delete _0x4bee28['name'];}_0xa76203[_0xfee0('0x18')](_0x1814fd)['send'](_0x4bee28);};}exports['index']=function(_0x515848,_0x3d51a8){var _0x5d5349={},_0x1a7782={},_0x2affe0={'count':0x0,'rows':[]};var _0x728760=_[_0xfee0('0x28')](db[_0xfee0('0x29')][_0xfee0('0x2a')],function(_0x38b1db){return{'name':_0x38b1db['fieldName'],'type':_0x38b1db['type'][_0xfee0('0x2b')]};});_0x1a7782[_0xfee0('0x2c')]=_[_0xfee0('0x28')](_0x728760,_0xfee0('0x27'));_0x1a7782[_0xfee0('0x2d')]=_[_0xfee0('0x2e')](_0x515848[_0xfee0('0x2d')]);_0x1a7782['filters']=_[_0xfee0('0x2f')](_0x1a7782['model'],_0x1a7782[_0xfee0('0x2d')]);_0x5d5349[_0xfee0('0x30')]=_[_0xfee0('0x2f')](_0x1a7782[_0xfee0('0x2c')],qs['fields'](_0x515848[_0xfee0('0x2d')]['fields']));_0x5d5349[_0xfee0('0x30')]=_0x5d5349[_0xfee0('0x30')][_0xfee0('0x31')]?_0x5d5349['attributes']:_0x1a7782[_0xfee0('0x2c')];if(!_0x515848[_0xfee0('0x2d')][_0xfee0('0x32')](_0xfee0('0x33'))){_0x5d5349[_0xfee0('0x1d')]=qs[_0xfee0('0x1d')](_0x515848[_0xfee0('0x2d')][_0xfee0('0x1d')]);_0x5d5349[_0xfee0('0x1a')]=qs[_0xfee0('0x1a')](_0x515848[_0xfee0('0x2d')][_0xfee0('0x1a')]);}_0x5d5349[_0xfee0('0x34')]=qs['sort'](_0x515848[_0xfee0('0x2d')][_0xfee0('0x35')]);_0x5d5349[_0xfee0('0x36')]=qs[_0xfee0('0x37')](_[_0xfee0('0x38')](_0x515848[_0xfee0('0x2d')],_0x1a7782[_0xfee0('0x37')]),_0x728760);if(_0x515848[_0xfee0('0x2d')]['filter']){_0x5d5349[_0xfee0('0x36')]=_['merge'](_0x5d5349['where'],{'$or':_[_0xfee0('0x28')](_0x728760,function(_0x42e8b3){if(_0x42e8b3[_0xfee0('0x39')]!==_0xfee0('0x3a')){var _0x1f4c25={};_0x1f4c25[_0x42e8b3[_0xfee0('0x27')]]={'$like':'%'+_0x515848[_0xfee0('0x2d')][_0xfee0('0x3b')]+'%'};return _0x1f4c25;}})});}_0x5d5349=_[_0xfee0('0x3c')]({},_0x5d5349,_0x515848[_0xfee0('0x3d')]);var _0x408b43={'where':_0x5d5349[_0xfee0('0x36')]};return db[_0xfee0('0x29')][_0xfee0('0x1c')](_0x408b43)[_0xfee0('0x24')](function(_0x8719fc){_0x2affe0['count']=_0x8719fc;if(_0x515848['query'][_0xfee0('0x3e')]){_0x5d5349[_0xfee0('0x3f')]=[{'all':!![]}];}return db['SugarcrmField'][_0xfee0('0x40')](_0x5d5349);})['then'](function(_0x51a694){_0x2affe0['rows']=_0x51a694;return _0x2affe0;})['then'](respondWithFilteredResult(_0x3d51a8,_0x5d5349))[_0xfee0('0x41')](handleError(_0x3d51a8,null));};exports[_0xfee0('0x42')]=function(_0x206ad9,_0x3cf834){var _0x2ed07b={'raw':!![],'where':{'id':_0x206ad9['params']['id']}},_0x347bb1={};_0x347bb1[_0xfee0('0x2c')]=_[_0xfee0('0x2e')](db[_0xfee0('0x29')][_0xfee0('0x2a')]);_0x347bb1[_0xfee0('0x2d')]=_['keys'](_0x206ad9[_0xfee0('0x2d')]);_0x347bb1[_0xfee0('0x37')]=_[_0xfee0('0x2f')](_0x347bb1['model'],_0x347bb1[_0xfee0('0x2d')]);_0x2ed07b[_0xfee0('0x30')]=_['intersection'](_0x347bb1['model'],qs[_0xfee0('0x43')](_0x206ad9['query']['fields']));_0x2ed07b['attributes']=_0x2ed07b['attributes'][_0xfee0('0x31')]?_0x2ed07b['attributes']:_0x347bb1[_0xfee0('0x2c')];if(_0x206ad9['query']['includeAll']){_0x2ed07b[_0xfee0('0x3f')]=[{'all':!![]}];}_0x2ed07b=_['merge']({},_0x2ed07b,_0x206ad9[_0xfee0('0x3d')]);return db[_0xfee0('0x29')][_0xfee0('0x44')](_0x2ed07b)[_0xfee0('0x24')](handleEntityNotFound(_0x3cf834,null))[_0xfee0('0x24')](respondWithResult(_0x3cf834,null))[_0xfee0('0x41')](handleError(_0x3cf834,null));};exports[_0xfee0('0x45')]=function(_0x52804a,_0x533475){return db['SugarcrmField']['create'](_0x52804a['body'],{})[_0xfee0('0x24')](respondWithResult(_0x533475,0xc9))[_0xfee0('0x41')](handleError(_0x533475,null));};exports[_0xfee0('0x23')]=function(_0x524ad6,_0x6f7a){if(_0x524ad6[_0xfee0('0x46')]['id']){delete _0x524ad6['body']['id'];}return db[_0xfee0('0x29')]['find']({'where':{'id':_0x524ad6[_0xfee0('0x47')]['id']}})['then'](handleEntityNotFound(_0x6f7a,null))['then'](saveUpdates(_0x524ad6[_0xfee0('0x46')],null))[_0xfee0('0x24')](respondWithResult(_0x6f7a,null))[_0xfee0('0x41')](handleError(_0x6f7a,null));};exports['destroy']=function(_0x2a1772,_0x3f3662){return db[_0xfee0('0x29')][_0xfee0('0x44')]({'where':{'id':_0x2a1772['params']['id']}})[_0xfee0('0x24')](handleEntityNotFound(_0x3f3662,null))[_0xfee0('0x24')](removeEntity(_0x3f3662,null))[_0xfee0('0x41')](handleError(_0x3f3662,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 08681eb..9ebac0d 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 _0x9b6f=['./intSugarcrmField.attributes','exports','int_sugarcrm_fields','sugarcrm_unique_index','idField','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x3da72b,_0x4fd809){var _0xc64ac4=function(_0x387e50){while(--_0x387e50){_0x3da72b['push'](_0x3da72b['shift']());}};_0xc64ac4(++_0x4fd809);}(_0x9b6f,0x157));var _0xf9b6=function(_0x1abbaa,_0x1b7a38){_0x1abbaa=_0x1abbaa-0x0;var _0x40ed52=_0x9b6f[_0x1abbaa];return _0x40ed52;};'use strict';var _=require(_0xf9b6('0x0'));var util=require(_0xf9b6('0x1'));var logger=require(_0xf9b6('0x2'))('api');var moment=require(_0xf9b6('0x3'));var BPromise=require('bluebird');var rp=require(_0xf9b6('0x4'));var fs=require('fs');var path=require(_0xf9b6('0x5'));var rimraf=require(_0xf9b6('0x6'));var config=require(_0xf9b6('0x7'));var attributes=require(_0xf9b6('0x8'));module[_0xf9b6('0x9')]=function(_0x4f3976,_0xdf58eb){return _0x4f3976['define']('SugarcrmField',attributes,{'tableName':_0xf9b6('0xa'),'paranoid':![],'indexes':[{'name':_0xf9b6('0xb'),'fields':[_0xf9b6('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x876a=['define','int_sugarcrm_fields','sugarcrm_unique_index','idField','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports'];(function(_0x2d89ce,_0x24d58d){var _0x3fad10=function(_0xad0ec){while(--_0xad0ec){_0x2d89ce['push'](_0x2d89ce['shift']());}};_0x3fad10(++_0x24d58d);}(_0x876a,0x1c6));var _0xa876=function(_0x448804,_0x560064){_0x448804=_0x448804-0x0;var _0x3c3eb5=_0x876a[_0x448804];return _0x3c3eb5;};'use strict';var _=require(_0xa876('0x0'));var util=require('util');var logger=require(_0xa876('0x1'))(_0xa876('0x2'));var moment=require(_0xa876('0x3'));var BPromise=require(_0xa876('0x4'));var rp=require(_0xa876('0x5'));var fs=require('fs');var path=require(_0xa876('0x6'));var rimraf=require(_0xa876('0x7'));var config=require(_0xa876('0x8'));var attributes=require(_0xa876('0x9'));module[_0xa876('0xa')]=function(_0x135eb1,_0x3503f0){return _0x135eb1[_0xa876('0xb')]('SugarcrmField',attributes,{'tableName':_0xa876('0xc'),'paranoid':![],'indexes':[{'name':_0xa876('0xd'),'fields':[_0xa876('0xe'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index 3203808..72c80b1 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 _0xb273=['stringify','error','message','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','SugarcrmField,\x20%s,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb273,0x190));var _0x3b27=function(_0x2445ee,_0x5da31f){_0x2445ee=_0x2445ee-0x0;var _0x200494=_0xb273[_0x2445ee];return _0x200494;};'use strict';var _=require(_0x3b27('0x0'));var util=require('util');var moment=require(_0x3b27('0x1'));var BPromise=require('bluebird');var rs=require(_0x3b27('0x2'));var fs=require('fs');var Redis=require(_0x3b27('0x3'));var db=require(_0x3b27('0x4'))['db'];var utils=require(_0x3b27('0x5'));var logger=require('../../config/logger')(_0x3b27('0x6'));var config=require(_0x3b27('0x7'));var jayson=require(_0x3b27('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3bb688,_0x18033d,_0x5b89d8){return new BPromise(function(_0x24bf98,_0x3baa7a){return client[_0x3b27('0x9')](_0x3bb688,_0x5b89d8)['then'](function(_0x512b5a){logger[_0x3b27('0xa')](_0x3b27('0xb'),_0x18033d,_0x3b27('0xc'));logger['debug'](_0x3b27('0xd'),_0x18033d,_0x3b27('0xc'),JSON[_0x3b27('0xe')](_0x512b5a));if(_0x512b5a[_0x3b27('0xf')]){if(_0x512b5a['error']['code']===0x1f4){logger[_0x3b27('0xf')]('SugarcrmField,\x20%s,\x20%s',_0x18033d,_0x512b5a[_0x3b27('0xf')][_0x3b27('0x10')]);return _0x3baa7a(_0x512b5a['error'][_0x3b27('0x10')]);}logger[_0x3b27('0xf')](_0x3b27('0xb'),_0x18033d,_0x512b5a[_0x3b27('0xf')][_0x3b27('0x10')]);return _0x24bf98(_0x512b5a['error'][_0x3b27('0x10')]);}else{logger['info'](_0x3b27('0xb'),_0x18033d,_0x3b27('0xc'));_0x24bf98(_0x512b5a['result'][_0x3b27('0x10')]);}})[_0x3b27('0x11')](function(_0x31ed57){logger[_0x3b27('0xf')](_0x3b27('0xb'),_0x18033d,_0x31ed57);_0x3baa7a(_0x31ed57);});});} \ No newline at end of file +var _0x9b01=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x9b01,0x123));var _0x19b0=function(_0x3b5ad9,_0x223867){_0x3b5ad9=_0x3b5ad9-0x0;var _0x611ae9=_0x9b01[_0x3b5ad9];return _0x611ae9;};'use strict';var _=require(_0x19b0('0x0'));var util=require(_0x19b0('0x1'));var moment=require(_0x19b0('0x2'));var BPromise=require(_0x19b0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x19b0('0x4'));var db=require(_0x19b0('0x5'))['db'];var utils=require(_0x19b0('0x6'));var logger=require('../../config/logger')(_0x19b0('0x7'));var config=require(_0x19b0('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x19b0('0x9')][_0x19b0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3781c9,_0x190a76,_0x31df5e){return new BPromise(function(_0x4e041a,_0x31a445){return client[_0x19b0('0xb')](_0x3781c9,_0x31df5e)[_0x19b0('0xc')](function(_0x3de62e){logger[_0x19b0('0xd')](_0x19b0('0xe'),_0x190a76,_0x19b0('0xf'));logger[_0x19b0('0x10')](_0x19b0('0x11'),_0x190a76,_0x19b0('0xf'),JSON[_0x19b0('0x12')](_0x3de62e));if(_0x3de62e[_0x19b0('0x13')]){if(_0x3de62e['error'][_0x19b0('0x14')]===0x1f4){logger[_0x19b0('0x13')]('SugarcrmField,\x20%s,\x20%s',_0x190a76,_0x3de62e[_0x19b0('0x13')][_0x19b0('0x15')]);return _0x31a445(_0x3de62e['error'][_0x19b0('0x15')]);}logger['error']('SugarcrmField,\x20%s,\x20%s',_0x190a76,_0x3de62e[_0x19b0('0x13')]['message']);return _0x4e041a(_0x3de62e[_0x19b0('0x13')][_0x19b0('0x15')]);}else{logger['info'](_0x19b0('0xe'),_0x190a76,_0x19b0('0xf'));_0x4e041a(_0x3de62e[_0x19b0('0x16')][_0x19b0('0x15')]);}})[_0x19b0('0x17')](function(_0x58b1bf){logger[_0x19b0('0x13')](_0x19b0('0xe'),_0x190a76,_0x58b1bf);_0x31a445(_0x58b1bf);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index f6ffc57..963a791 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 _0x7314=['create','addConfiguration','put','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post'];(function(_0x268b41,_0x5eec3c){var _0x532ecc=function(_0x183c10){while(--_0x183c10){_0x268b41['push'](_0x268b41['shift']());}};_0x532ecc(++_0x5eec3c);}(_0x7314,0x100));var _0x4731=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7314[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x4731('0x0'));var util=require(_0x4731('0x1'));var path=require('path');var timeout=require(_0x4731('0x2'));var express=require(_0x4731('0x3'));var router=express[_0x4731('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4731('0x5'));var interaction=require(_0x4731('0x6'));var config=require(_0x4731('0x7'));var controller=require('./intVtigerAccount.controller');router[_0x4731('0x8')]('/',auth[_0x4731('0x9')](),controller['index']);router[_0x4731('0x8')](_0x4731('0xa'),auth[_0x4731('0x9')](),controller[_0x4731('0xb')]);router['get'](_0x4731('0xc'),auth['isAuthenticated'](),controller[_0x4731('0xd')]);router[_0x4731('0x8')](_0x4731('0xe'),auth['isAuthenticated'](),controller[_0x4731('0xf')]);router[_0x4731('0x10')]('/',auth[_0x4731('0x9')](),controller[_0x4731('0x11')]);router[_0x4731('0x10')](_0x4731('0xc'),auth[_0x4731('0x9')](),controller[_0x4731('0x12')]);router[_0x4731('0x13')](_0x4731('0xa'),auth[_0x4731('0x9')](),controller['update']);router['delete'](_0x4731('0xa'),auth[_0x4731('0x9')](),controller['destroy']);module[_0x4731('0x14')]=router; \ No newline at end of file +var _0xa4de=['../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','/:id','delete','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0xb324da,_0x1feac2){var _0x4f5300=function(_0x538252){while(--_0x538252){_0xb324da['push'](_0xb324da['shift']());}};_0x4f5300(++_0x1feac2);}(_0xa4de,0x10d));var _0xea4d=function(_0x33b295,_0x32fa89){_0x33b295=_0x33b295-0x0;var _0x225279=_0xa4de[_0x33b295];return _0x225279;};'use strict';var multer=require(_0xea4d('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xea4d('0x1'));var express=require(_0xea4d('0x2'));var router=express[_0xea4d('0x3')]();var fs_extra=require(_0xea4d('0x4'));var auth=require(_0xea4d('0x5'));var interaction=require(_0xea4d('0x6'));var config=require(_0xea4d('0x7'));var controller=require(_0xea4d('0x8'));router[_0xea4d('0x9')]('/',auth[_0xea4d('0xa')](),controller[_0xea4d('0xb')]);router[_0xea4d('0x9')]('/:id',auth[_0xea4d('0xa')](),controller['show']);router[_0xea4d('0x9')](_0xea4d('0xc'),auth[_0xea4d('0xa')](),controller[_0xea4d('0xd')]);router[_0xea4d('0x9')](_0xea4d('0xe'),auth[_0xea4d('0xa')](),controller[_0xea4d('0xf')]);router[_0xea4d('0x10')]('/',auth[_0xea4d('0xa')](),controller[_0xea4d('0x11')]);router[_0xea4d('0x10')]('/:id/configurations',auth[_0xea4d('0xa')](),controller[_0xea4d('0x12')]);router[_0xea4d('0x13')](_0xea4d('0x14'),auth[_0xea4d('0xa')](),controller['update']);router[_0xea4d('0x15')](_0xea4d('0x14'),auth['isAuthenticated'](),controller['destroy']);module[_0xea4d('0x16')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index c967b26..a0d2505 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 _0xa3f8=['STRING','exports'];(function(_0x3e3ee1,_0x145541){var _0x519de8=function(_0x59c066){while(--_0x59c066){_0x3e3ee1['push'](_0x3e3ee1['shift']());}};_0x519de8(++_0x145541);}(_0xa3f8,0x187));var _0x8a3f=function(_0x29ce14,_0x334166){_0x29ce14=_0x29ce14-0x0;var _0x48f289=_0xa3f8[_0x29ce14];return _0x48f289;};'use strict';var Sequelize=require('sequelize');module[_0x8a3f('0x0')]={'name':{'type':Sequelize[_0x8a3f('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x8a3f('0x1')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0x8a3f('0x1')],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize[_0x8a3f('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x8a3f('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x8a3f('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x2de0=['exports','STRING','HelpDesk','sequelize'];(function(_0x1dec60,_0x4dec46){var _0x2ef52f=function(_0x5d1bac){while(--_0x5d1bac){_0x1dec60['push'](_0x1dec60['shift']());}};_0x2ef52f(++_0x4dec46);}(_0x2de0,0x173));var _0x02de=function(_0x5c22a3,_0x141d8e){_0x5c22a3=_0x5c22a3-0x0;var _0x53b56d=_0x2de0[_0x5c22a3];return _0x53b56d;};'use strict';var Sequelize=require(_0x02de('0x0'));module[_0x02de('0x1')]={'name':{'type':Sequelize[_0x02de('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x02de('0x2')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0x02de('0x2')],'allowNull':![],'defaultValue':_0x02de('0x3')},'remoteUri':{'type':Sequelize[_0x02de('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize[_0x02de('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 084195c..5d44003 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 _0xb260=['test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','VtigerAccount','rawAttributes','fieldName','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','catch','show','params','keys','filters','includeAll','find','create','body','getConfigurations','VtigerConfiguration','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','VtigerField','Descriptions','md5','getFields','username','description','moduleName','accessKey','slice','substring','lastIndexOf','format','%s/webservice.php','GET','success','login','result','token','sessionName','autogenerated','reference','owner','remove','includes','editable','false','startsWith','cf_','picklist','picklistValues','label','log'];(function(_0x4402dc,_0x29b22a){var _0x2403b9=function(_0xdd7335){while(--_0xdd7335){_0x4402dc['push'](_0x4402dc['shift']());}};_0x2403b9(++_0x29b22a);}(_0xb260,0x176));var _0x0b26=function(_0x2a789d,_0x1cf4d4){_0x2a789d=_0x2a789d-0x0;var _0x5dc7f5=_0xb260[_0x2a789d];return _0x5dc7f5;};'use strict';var emlformat=require(_0x0b26('0x0'));var rimraf=require(_0x0b26('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0b26('0x2'));var rp=require(_0x0b26('0x3'));var moment=require(_0x0b26('0x4'));var BPromise=require(_0x0b26('0x5'));var Mustache=require(_0x0b26('0x6'));var util=require(_0x0b26('0x7'));var path=require('path');var sox=require(_0x0b26('0x8'));var csv=require(_0x0b26('0x9'));var ejs=require(_0x0b26('0xa'));var fs=require('fs');var fs_extra=require(_0x0b26('0xb'));var _=require(_0x0b26('0xc'));var squel=require(_0x0b26('0xd'));var crypto=require('crypto');var jsforce=require(_0x0b26('0xe'));var deskjs=require(_0x0b26('0xf'));var toCsv=require(_0x0b26('0x9'));var querystring=require('querystring');var Papa=require(_0x0b26('0x10'));var Redis=require(_0x0b26('0x11'));var authService=require(_0x0b26('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x0b26('0x13'));var hardwareService=require(_0x0b26('0x14'));var logger=require(_0x0b26('0x15'))('api');var utils=require(_0x0b26('0x16'));var config=require(_0x0b26('0x17'));var licenseUtil=require(_0x0b26('0x18'));var db=require(_0x0b26('0x19'))['db'];var integrations=require(_0x0b26('0x1a'));function respondWithStatusCode(_0x1a431a,_0xfb642a){_0xfb642a=_0xfb642a||0xcc;return function(_0x351661){if(_0x351661){return _0x1a431a[_0x0b26('0x1b')](_0xfb642a);}return _0x1a431a[_0x0b26('0x1c')](_0xfb642a)[_0x0b26('0x1d')]();};}function respondWithResult(_0x576df8,_0x302383){_0x302383=_0x302383||0xc8;return function(_0x565723){if(_0x565723){return _0x576df8['status'](_0x302383)[_0x0b26('0x1e')](_0x565723);}};}function respondWithFilteredResult(_0x3fadca,_0x5667ec){return function(_0x262671){if(_0x262671){var _0x1a525d=typeof _0x5667ec[_0x0b26('0x1f')]==='undefined'&&typeof _0x5667ec[_0x0b26('0x20')]===_0x0b26('0x21');var _0x1b2320=_0x262671[_0x0b26('0x22')];var _0x1a63aa=_0x1a525d?0x0:_0x5667ec['offset'];var _0x5e3c28=_0x1a525d?_0x262671['count']:_0x5667ec['offset']+_0x5667ec[_0x0b26('0x20')];var _0x3512ac;if(_0x5e3c28>=_0x1b2320){_0x5e3c28=_0x1b2320;_0x3512ac=0xc8;}else{_0x3512ac=0xce;}_0x3fadca[_0x0b26('0x1c')](_0x3512ac);return _0x3fadca[_0x0b26('0x23')](_0x0b26('0x24'),_0x1a63aa+'-'+_0x5e3c28+'/'+_0x1b2320)[_0x0b26('0x1e')](_0x262671);}return null;};}function patchUpdates(_0x2421c9){return function(_0x132fa2){try{jsonpatch[_0x0b26('0x25')](_0x132fa2,_0x2421c9,!![]);}catch(_0x41e763){return BPromise['reject'](_0x41e763);}return _0x132fa2[_0x0b26('0x26')]();};}function saveUpdates(_0x59fccb,_0x408b95){return function(_0x27d37e){if(_0x27d37e){return _0x27d37e[_0x0b26('0x27')](_0x59fccb)[_0x0b26('0x28')](function(_0x16aca9){return _0x16aca9;});}return null;};}function removeEntity(_0x10087a,_0x1524af){return function(_0x20e035){if(_0x20e035){return _0x20e035[_0x0b26('0x29')]()[_0x0b26('0x28')](function(){_0x10087a[_0x0b26('0x1c')](0xcc)[_0x0b26('0x1d')]();});}};}function handleEntityNotFound(_0x4a4f6d,_0x49a8af){return function(_0x50060e){if(!_0x50060e){_0x4a4f6d[_0x0b26('0x1b')](0x194);}return _0x50060e;};}function handleError(_0x442c41,_0x2f8ce9){_0x2f8ce9=_0x2f8ce9||0x1f4;return function(_0x4d6acd){logger[_0x0b26('0x2a')](_0x4d6acd[_0x0b26('0x2b')]);if(_0x4d6acd['name']){delete _0x4d6acd[_0x0b26('0x2c')];}_0x442c41[_0x0b26('0x1c')](_0x2f8ce9)[_0x0b26('0x2d')](_0x4d6acd);};}exports[_0x0b26('0x2e')]=function(_0x4bf482,_0x21d427){var _0x31da21={},_0x4d0a0a={},_0x115748={'count':0x0,'rows':[]};var _0x14427f=_[_0x0b26('0x2f')](db[_0x0b26('0x30')][_0x0b26('0x31')],function(_0x426a41){return{'name':_0x426a41[_0x0b26('0x32')],'type':_0x426a41[_0x0b26('0x33')][_0x0b26('0x34')]};});_0x4d0a0a[_0x0b26('0x35')]=_[_0x0b26('0x2f')](_0x14427f,_0x0b26('0x2c'));_0x4d0a0a[_0x0b26('0x36')]=_['keys'](_0x4bf482[_0x0b26('0x36')]);_0x4d0a0a['filters']=_['intersection'](_0x4d0a0a['model'],_0x4d0a0a[_0x0b26('0x36')]);_0x31da21[_0x0b26('0x37')]=_[_0x0b26('0x38')](_0x4d0a0a[_0x0b26('0x35')],qs[_0x0b26('0x39')](_0x4bf482[_0x0b26('0x36')][_0x0b26('0x39')]));_0x31da21[_0x0b26('0x37')]=_0x31da21[_0x0b26('0x37')][_0x0b26('0x3a')]?_0x31da21[_0x0b26('0x37')]:_0x4d0a0a[_0x0b26('0x35')];if(!_0x4bf482[_0x0b26('0x36')][_0x0b26('0x3b')]('nolimit')){_0x31da21[_0x0b26('0x20')]=qs[_0x0b26('0x20')](_0x4bf482['query'][_0x0b26('0x20')]);_0x31da21[_0x0b26('0x1f')]=qs[_0x0b26('0x1f')](_0x4bf482[_0x0b26('0x36')][_0x0b26('0x1f')]);}_0x31da21[_0x0b26('0x3c')]=qs[_0x0b26('0x3d')](_0x4bf482[_0x0b26('0x36')]['sort']);_0x31da21[_0x0b26('0x3e')]=qs['filters'](_[_0x0b26('0x3f')](_0x4bf482[_0x0b26('0x36')],_0x4d0a0a['filters']),_0x14427f);if(_0x4bf482[_0x0b26('0x36')][_0x0b26('0x40')]){_0x31da21['where']=_[_0x0b26('0x41')](_0x31da21[_0x0b26('0x3e')],{'$or':_[_0x0b26('0x2f')](_0x14427f,function(_0x3ab3a5){if(_0x3ab3a5[_0x0b26('0x33')]!==_0x0b26('0x42')){var _0x2bcb2b={};_0x2bcb2b[_0x3ab3a5[_0x0b26('0x2c')]]={'$like':'%'+_0x4bf482[_0x0b26('0x36')][_0x0b26('0x40')]+'%'};return _0x2bcb2b;}})});}_0x31da21=_['merge']({},_0x31da21,_0x4bf482['options']);var _0x4c39c3={'where':_0x31da21[_0x0b26('0x3e')]};return db[_0x0b26('0x30')][_0x0b26('0x22')](_0x4c39c3)[_0x0b26('0x28')](function(_0x4a2dc8){_0x115748['count']=_0x4a2dc8;if(_0x4bf482[_0x0b26('0x36')]['includeAll']){_0x31da21[_0x0b26('0x43')]=[{'all':!![]}];}return db['VtigerAccount'][_0x0b26('0x44')](_0x31da21);})['then'](function(_0x96e5e4){_0x115748['rows']=_0x96e5e4;return _0x115748;})[_0x0b26('0x28')](respondWithFilteredResult(_0x21d427,_0x31da21))[_0x0b26('0x45')](handleError(_0x21d427,null));};exports[_0x0b26('0x46')]=function(_0x4e614f,_0x44586c){var _0x23a804={'raw':![],'where':{'id':_0x4e614f[_0x0b26('0x47')]['id']}},_0x4d08e9={};_0x4d08e9[_0x0b26('0x35')]=_[_0x0b26('0x48')](db[_0x0b26('0x30')]['rawAttributes']);_0x4d08e9[_0x0b26('0x36')]=_[_0x0b26('0x48')](_0x4e614f[_0x0b26('0x36')]);_0x4d08e9[_0x0b26('0x49')]=_['intersection'](_0x4d08e9['model'],_0x4d08e9[_0x0b26('0x36')]);_0x23a804['attributes']=_[_0x0b26('0x38')](_0x4d08e9[_0x0b26('0x35')],qs[_0x0b26('0x39')](_0x4e614f[_0x0b26('0x36')][_0x0b26('0x39')]));_0x23a804[_0x0b26('0x37')]=_0x23a804[_0x0b26('0x37')][_0x0b26('0x3a')]?_0x23a804[_0x0b26('0x37')]:_0x4d08e9[_0x0b26('0x35')];if(_0x4e614f[_0x0b26('0x36')][_0x0b26('0x4a')]){_0x23a804['include']=[{'all':!![]}];}_0x23a804=_[_0x0b26('0x41')]({},_0x23a804,_0x4e614f['options']);return db[_0x0b26('0x30')][_0x0b26('0x4b')](_0x23a804)['then'](handleEntityNotFound(_0x44586c,null))[_0x0b26('0x28')](respondWithResult(_0x44586c,null))[_0x0b26('0x45')](handleError(_0x44586c,null));};exports['create']=function(_0x1743e4,_0x585697){return db[_0x0b26('0x30')][_0x0b26('0x4c')](_0x1743e4[_0x0b26('0x4d')],{})[_0x0b26('0x28')](respondWithResult(_0x585697,0xc9))[_0x0b26('0x45')](handleError(_0x585697,null));};exports[_0x0b26('0x27')]=function(_0x2b815b,_0x2c891c){if(_0x2b815b[_0x0b26('0x4d')]['id']){delete _0x2b815b[_0x0b26('0x4d')]['id'];}return db[_0x0b26('0x30')][_0x0b26('0x4b')]({'where':{'id':_0x2b815b[_0x0b26('0x47')]['id']}})[_0x0b26('0x28')](handleEntityNotFound(_0x2c891c,null))[_0x0b26('0x28')](saveUpdates(_0x2b815b[_0x0b26('0x4d')],null))['then'](respondWithResult(_0x2c891c,null))[_0x0b26('0x45')](handleError(_0x2c891c,null));};exports[_0x0b26('0x29')]=function(_0x1ba4f6,_0x43dcd8){return db['VtigerAccount'][_0x0b26('0x4b')]({'where':{'id':_0x1ba4f6[_0x0b26('0x47')]['id']}})[_0x0b26('0x28')](handleEntityNotFound(_0x43dcd8,null))[_0x0b26('0x28')](removeEntity(_0x43dcd8,null))[_0x0b26('0x45')](handleError(_0x43dcd8,null));};exports[_0x0b26('0x4e')]=function(_0x4f67e8,_0x24940b,_0x172e42){var _0x54182a={};var _0x5cd895={};var _0x23cb10;var _0x2f34e4;return db['VtigerAccount']['findOne']({'where':{'id':_0x4f67e8['params']['id']}})[_0x0b26('0x28')](handleEntityNotFound(_0x24940b,null))[_0x0b26('0x28')](function(_0xca8657){if(_0xca8657){_0x23cb10=_0xca8657;_0x5cd895[_0x0b26('0x35')]=_[_0x0b26('0x48')](db[_0x0b26('0x4f')][_0x0b26('0x31')]);_0x5cd895[_0x0b26('0x36')]=_['keys'](_0x4f67e8[_0x0b26('0x36')]);_0x5cd895[_0x0b26('0x49')]=_['intersection'](_0x5cd895[_0x0b26('0x35')],_0x5cd895[_0x0b26('0x36')]);_0x54182a[_0x0b26('0x37')]=_[_0x0b26('0x38')](_0x5cd895[_0x0b26('0x35')],qs[_0x0b26('0x39')](_0x4f67e8['query']['fields']));_0x54182a[_0x0b26('0x37')]=_0x54182a[_0x0b26('0x37')][_0x0b26('0x3a')]?_0x54182a['attributes']:_0x5cd895[_0x0b26('0x35')];_0x54182a[_0x0b26('0x3c')]=qs[_0x0b26('0x3d')](_0x4f67e8['query'][_0x0b26('0x3d')]);_0x54182a[_0x0b26('0x3e')]=qs[_0x0b26('0x49')](_['pick'](_0x4f67e8['query'],_0x5cd895[_0x0b26('0x49')]));if(_0x4f67e8[_0x0b26('0x36')]['filter']){_0x54182a[_0x0b26('0x3e')]=_[_0x0b26('0x41')](_0x54182a['where'],{'$or':_[_0x0b26('0x2f')](_0x54182a[_0x0b26('0x37')],function(_0x166826){var _0x307922={};_0x307922[_0x166826]={'$like':'%'+_0x4f67e8['query'][_0x0b26('0x40')]+'%'};return _0x307922;})});}_0x54182a=_[_0x0b26('0x41')]({},_0x54182a,_0x4f67e8['options']);return _0x23cb10['getConfigurations'](_0x54182a);}})['then'](function(_0x580944){if(_0x580944){_0x2f34e4=_0x580944[_0x0b26('0x3a')];if(!_0x4f67e8['query']['hasOwnProperty']('nolimit')){_0x54182a[_0x0b26('0x20')]=qs[_0x0b26('0x20')](_0x4f67e8['query'][_0x0b26('0x20')]);_0x54182a[_0x0b26('0x1f')]=qs[_0x0b26('0x1f')](_0x4f67e8[_0x0b26('0x36')]['offset']);}return _0x23cb10['getConfigurations'](_0x54182a);}})[_0x0b26('0x28')](function(_0x12d5f7){if(_0x12d5f7){return _0x12d5f7?{'count':_0x2f34e4,'rows':_0x12d5f7}:null;}})[_0x0b26('0x28')](respondWithResult(_0x24940b,null))['catch'](handleError(_0x24940b,null));};exports[_0x0b26('0x50')]=function(_0x133618,_0x85347b,_0x2be5f1){if(_0x133618[_0x0b26('0x4d')]['id']){delete _0x133618['body']['id'];}return db[_0x0b26('0x30')][_0x0b26('0x51')]({'where':{'id':_0x133618[_0x0b26('0x47')]['id']}})[_0x0b26('0x28')](handleEntityNotFound(_0x85347b,null))['then'](function(_0x3783a3){if(_0x3783a3){_0x133618['body'][_0x0b26('0x52')]=_0x3783a3['id'];_0x133618[_0x0b26('0x4d')][_0x0b26('0x53')]=integrations[_0x0b26('0x54')](_0x133618[_0x0b26('0x4d')][_0x0b26('0x55')],_0x133618[_0x0b26('0x4d')]['type']);_0x133618['body']['Descriptions']=integrations['getDescriptions'](_0x133618['body'][_0x0b26('0x55')],_0x133618['body']['type']);return db[_0x0b26('0x4f')][_0x0b26('0x4c')](_0x133618[_0x0b26('0x4d')],{'include':[{'model':db[_0x0b26('0x56')],'as':'Subjects'},{'model':db[_0x0b26('0x56')],'as':_0x0b26('0x57')}]});}return null;})[_0x0b26('0x28')](respondWithResult(_0x85347b,null))[_0x0b26('0x45')](handleError(_0x85347b,null));};var md5=require(_0x0b26('0x58'));exports[_0x0b26('0x59')]=function(_0x4dc4ae,_0xfad2eb,_0x1f4a34){var _0x542817=null;var _0x527b18=null;var _0x372d40=null;var _0x37c535=null;var _0x38d40a='';return db[_0x0b26('0x30')][_0x0b26('0x51')]({'where':{'id':_0x4dc4ae['params']['id']},'attributes':['id','name',_0x0b26('0x5a'),_0x0b26('0x5b'),_0x0b26('0x5c'),'remoteUri','serverUrl',_0x0b26('0x5d')]})[_0x0b26('0x28')](handleEntityNotFound(_0xfad2eb,null))[_0x0b26('0x28')](function(_0x1bbec1){if(_0x1bbec1){_0x542817=_0x1bbec1[_0x0b26('0x5a')];_0x527b18=_0x1bbec1[_0x0b26('0x5d')];_0x372d40=_0x1bbec1['moduleName'];_0x38d40a=_0x1bbec1['remoteUri'];var _0x2499fe=_0x38d40a[_0x0b26('0x5e')](-0x1);if(_0x2499fe==='/'){_0x38d40a=_0x38d40a[_0x0b26('0x5f')](0x0,_0x38d40a[_0x0b26('0x60')](_0x2499fe));}_0x37c535=util[_0x0b26('0x61')](_0x0b26('0x62'),_0x38d40a);var _0x423511={'method':_0x0b26('0x63'),'uri':_0x37c535,'qs':{'operation':'getchallenge','username':_0x1bbec1[_0x0b26('0x5a')]},'json':!![]};return rp(_0x423511);}})['then'](function(_0x3ff18d){if(_0x3ff18d[_0x0b26('0x64')]){var _0x4b8251={'method':'POST','uri':_0x37c535,'form':{'operation':_0x0b26('0x65'),'username':_0x542817,'accessKey':md5(_0x3ff18d[_0x0b26('0x66')][_0x0b26('0x67')]+_0x527b18)},'json':!![]};return rp(_0x4b8251);}})[_0x0b26('0x28')](function(_0x51e7c2){if(_0x51e7c2[_0x0b26('0x64')]){var _0x5a7ee2={'method':_0x0b26('0x63'),'uri':_0x37c535,'qs':{'operation':'describe','username':_0x542817,'sessionName':_0x51e7c2[_0x0b26('0x66')][_0x0b26('0x68')],'elementType':_0x372d40},'json':!![]};return rp(_0x5a7ee2);}})[_0x0b26('0x28')](function(_0x1b647c){if(_0x1b647c['success']){var _0x3a2b73=[_0x0b26('0x69'),_0x0b26('0x6a'),_0x0b26('0x6b')];_[_0x0b26('0x6c')](_0x1b647c[_0x0b26('0x66')]['fields'],function(_0x1b3e2e){return _0x3a2b73[_0x0b26('0x6d')](_0x1b3e2e[_0x0b26('0x33')][_0x0b26('0x2c')]);});_['remove'](_0x1b647c[_0x0b26('0x66')][_0x0b26('0x39')],function(_0x596833){return _0x596833[_0x0b26('0x6e')]===_0x0b26('0x6f');});return{'count':_0x1b647c[_0x0b26('0x66')][_0x0b26('0x39')]['length'],'rows':_[_0x0b26('0x2f')](_0x1b647c['result'][_0x0b26('0x39')],function(_0x3c532e){return{'id':_0x3c532e[_0x0b26('0x2c')],'name':_0x3c532e['label'],'custom':_[_0x0b26('0x70')](_0x3c532e[_0x0b26('0x2c')],_0x0b26('0x71'))?!![]:![],'options':_0x3c532e[_0x0b26('0x33')][_0x0b26('0x2c')]===_0x0b26('0x72')&&_0x3c532e[_0x0b26('0x33')][_0x0b26('0x73')][_0x0b26('0x3a')]>0x0?_[_0x0b26('0x2f')](_0x3c532e[_0x0b26('0x33')][_0x0b26('0x73')],function(_0x24f291){return{'name':_0x24f291[_0x0b26('0x74')],'value':_0x24f291['value']};}):[]};})};}})[_0x0b26('0x28')](respondWithResult(_0xfad2eb,null))['catch'](function(_0x27c8ca){console[_0x0b26('0x75')]('vTiger\x20error:\x20'+_0x27c8ca);var _0x3bea9e=_0x4dc4ae['query'][_0x0b26('0x76')]?0x1f4:_0x27c8ca[_0x0b26('0x77')]||0x1f4;logger[_0x0b26('0x2a')](_0x0b26('0x78'),_0x0b26('0x59'),_0x3bea9e,JSON[_0x0b26('0x79')](_0x27c8ca));delete _0x27c8ca[_0x0b26('0x2c')];if(_0x3bea9e===0x191){_0x3bea9e=0x190;}_0xfad2eb['status'](_0x3bea9e)[_0x0b26('0x2d')](_0x4dc4ae['query']['test']?{'message':_0x0b26('0x7a'),'statusCode':_0x27c8ca['statusCode']}:_0x27c8ca);});}; \ No newline at end of file +var _0x87a4=['test','statusCode','getFields,\x20%s,\x20%s,\x20%s','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','update','destroy','then','send','VtigerAccount','rawAttributes','fieldName','type','model','name','filters','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','find','body','getConfigurations','findOne','VtigerConfiguration','order','addConfiguration','getSubjects','channel','Descriptions','getDescriptions','create','VtigerField','Subjects','md5','getFields','username','description','moduleName','serverUrl','accessKey','remoteUri','slice','substring','lastIndexOf','format','%s/webservice.php','success','POST','login','result','token','describe','sessionName','reference','remove','includes','editable','false','label','startsWith','picklist','picklistValues','value','vTiger\x20error:\x20'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0x87a4,0x77));var _0x487a=function(_0xe68852,_0x34e40f){_0xe68852=_0xe68852-0x0;var _0x4db421=_0x87a4[_0xe68852];return _0x4db421;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x487a('0x0'));var zipdir=require(_0x487a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x487a('0x2'));var moment=require(_0x487a('0x3'));var BPromise=require(_0x487a('0x4'));var Mustache=require(_0x487a('0x5'));var util=require(_0x487a('0x6'));var path=require(_0x487a('0x7'));var sox=require(_0x487a('0x8'));var csv=require('to-csv');var ejs=require(_0x487a('0x9'));var fs=require('fs');var fs_extra=require(_0x487a('0xa'));var _=require(_0x487a('0xb'));var squel=require(_0x487a('0xc'));var crypto=require(_0x487a('0xd'));var jsforce=require(_0x487a('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x487a('0xf'));var querystring=require(_0x487a('0x10'));var Papa=require(_0x487a('0x11'));var Redis=require(_0x487a('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x487a('0x13'));var as=require(_0x487a('0x14'));var hardwareService=require(_0x487a('0x15'));var logger=require('../../config/logger')(_0x487a('0x16'));var utils=require(_0x487a('0x17'));var config=require(_0x487a('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x487a('0x19'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x2d2dd1,_0xd8b34e){_0xd8b34e=_0xd8b34e||0xcc;return function(_0x5b06c5){if(_0x5b06c5){return _0x2d2dd1[_0x487a('0x1a')](_0xd8b34e);}return _0x2d2dd1[_0x487a('0x1b')](_0xd8b34e)['end']();};}function respondWithResult(_0x2333ad,_0x301b96){_0x301b96=_0x301b96||0xc8;return function(_0x3c593f){if(_0x3c593f){return _0x2333ad[_0x487a('0x1b')](_0x301b96)[_0x487a('0x1c')](_0x3c593f);}};}function respondWithFilteredResult(_0x3b9e28,_0x365f52){return function(_0x2eb317){if(_0x2eb317){var _0x625ef1=typeof _0x365f52[_0x487a('0x1d')]===_0x487a('0x1e')&&typeof _0x365f52[_0x487a('0x1f')]===_0x487a('0x1e');var _0x19d830=_0x2eb317[_0x487a('0x20')];var _0x4eeb3b=_0x625ef1?0x0:_0x365f52['offset'];var _0x9d1317=_0x625ef1?_0x2eb317[_0x487a('0x20')]:_0x365f52['offset']+_0x365f52['limit'];var _0x1044d1;if(_0x9d1317>=_0x19d830){_0x9d1317=_0x19d830;_0x1044d1=0xc8;}else{_0x1044d1=0xce;}_0x3b9e28[_0x487a('0x1b')](_0x1044d1);return _0x3b9e28['set'](_0x487a('0x21'),_0x4eeb3b+'-'+_0x9d1317+'/'+_0x19d830)[_0x487a('0x1c')](_0x2eb317);}return null;};}function patchUpdates(_0x2b7024){return function(_0x3fd253){try{jsonpatch[_0x487a('0x22')](_0x3fd253,_0x2b7024,!![]);}catch(_0x260448){return BPromise['reject'](_0x260448);}return _0x3fd253['save']();};}function saveUpdates(_0x1c72a9,_0x26d7a9){return function(_0xa61d3e){if(_0xa61d3e){return _0xa61d3e[_0x487a('0x23')](_0x1c72a9)['then'](function(_0xf1ce76){return _0xf1ce76;});}return null;};}function removeEntity(_0x265bca,_0x581875){return function(_0x1dacee){if(_0x1dacee){return _0x1dacee[_0x487a('0x24')]()[_0x487a('0x25')](function(){_0x265bca[_0x487a('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x320833,_0x50b6fb){return function(_0x20adf3){if(!_0x20adf3){_0x320833[_0x487a('0x1a')](0x194);}return _0x20adf3;};}function handleError(_0xd4b78d,_0x18aa45){_0x18aa45=_0x18aa45||0x1f4;return function(_0x170462){logger['error'](_0x170462['stack']);if(_0x170462['name']){delete _0x170462['name'];}_0xd4b78d['status'](_0x18aa45)[_0x487a('0x26')](_0x170462);};}exports['index']=function(_0x1980bd,_0x284cf5){var _0x3276e9={},_0x5afddf={},_0x2bee68={'count':0x0,'rows':[]};var _0x32601f=_['map'](db[_0x487a('0x27')][_0x487a('0x28')],function(_0x78b055){return{'name':_0x78b055[_0x487a('0x29')],'type':_0x78b055[_0x487a('0x2a')]['key']};});_0x5afddf[_0x487a('0x2b')]=_['map'](_0x32601f,_0x487a('0x2c'));_0x5afddf['query']=_['keys'](_0x1980bd['query']);_0x5afddf[_0x487a('0x2d')]=_['intersection'](_0x5afddf[_0x487a('0x2b')],_0x5afddf[_0x487a('0x2e')]);_0x3276e9['attributes']=_[_0x487a('0x2f')](_0x5afddf[_0x487a('0x2b')],qs['fields'](_0x1980bd[_0x487a('0x2e')][_0x487a('0x30')]));_0x3276e9[_0x487a('0x31')]=_0x3276e9['attributes'][_0x487a('0x32')]?_0x3276e9[_0x487a('0x31')]:_0x5afddf[_0x487a('0x2b')];if(!_0x1980bd[_0x487a('0x2e')][_0x487a('0x33')](_0x487a('0x34'))){_0x3276e9[_0x487a('0x1f')]=qs[_0x487a('0x1f')](_0x1980bd['query'][_0x487a('0x1f')]);_0x3276e9['offset']=qs[_0x487a('0x1d')](_0x1980bd['query'][_0x487a('0x1d')]);}_0x3276e9['order']=qs[_0x487a('0x35')](_0x1980bd['query'][_0x487a('0x35')]);_0x3276e9[_0x487a('0x36')]=qs[_0x487a('0x2d')](_[_0x487a('0x37')](_0x1980bd[_0x487a('0x2e')],_0x5afddf[_0x487a('0x2d')]),_0x32601f);if(_0x1980bd[_0x487a('0x2e')][_0x487a('0x38')]){_0x3276e9[_0x487a('0x36')]=_[_0x487a('0x39')](_0x3276e9[_0x487a('0x36')],{'$or':_[_0x487a('0x3a')](_0x32601f,function(_0x2addd8){if(_0x2addd8[_0x487a('0x2a')]!==_0x487a('0x3b')){var _0x1a1dde={};_0x1a1dde[_0x2addd8[_0x487a('0x2c')]]={'$like':'%'+_0x1980bd['query'][_0x487a('0x38')]+'%'};return _0x1a1dde;}})});}_0x3276e9=_[_0x487a('0x39')]({},_0x3276e9,_0x1980bd[_0x487a('0x3c')]);var _0x37267f={'where':_0x3276e9[_0x487a('0x36')]};return db[_0x487a('0x27')][_0x487a('0x20')](_0x37267f)[_0x487a('0x25')](function(_0x3bd2e9){_0x2bee68['count']=_0x3bd2e9;if(_0x1980bd['query'][_0x487a('0x3d')]){_0x3276e9[_0x487a('0x3e')]=[{'all':!![]}];}return db['VtigerAccount'][_0x487a('0x3f')](_0x3276e9);})[_0x487a('0x25')](function(_0x5ea7f0){_0x2bee68[_0x487a('0x40')]=_0x5ea7f0;return _0x2bee68;})[_0x487a('0x25')](respondWithFilteredResult(_0x284cf5,_0x3276e9))[_0x487a('0x41')](handleError(_0x284cf5,null));};exports['show']=function(_0x58bf9a,_0x55e1da){var _0x236a39={'raw':![],'where':{'id':_0x58bf9a[_0x487a('0x42')]['id']}},_0x3cb1ae={};_0x3cb1ae[_0x487a('0x2b')]=_[_0x487a('0x43')](db[_0x487a('0x27')][_0x487a('0x28')]);_0x3cb1ae['query']=_[_0x487a('0x43')](_0x58bf9a[_0x487a('0x2e')]);_0x3cb1ae[_0x487a('0x2d')]=_[_0x487a('0x2f')](_0x3cb1ae[_0x487a('0x2b')],_0x3cb1ae['query']);_0x236a39[_0x487a('0x31')]=_[_0x487a('0x2f')](_0x3cb1ae[_0x487a('0x2b')],qs[_0x487a('0x30')](_0x58bf9a[_0x487a('0x2e')]['fields']));_0x236a39[_0x487a('0x31')]=_0x236a39[_0x487a('0x31')]['length']?_0x236a39['attributes']:_0x3cb1ae[_0x487a('0x2b')];if(_0x58bf9a[_0x487a('0x2e')][_0x487a('0x3d')]){_0x236a39[_0x487a('0x3e')]=[{'all':!![]}];}_0x236a39=_[_0x487a('0x39')]({},_0x236a39,_0x58bf9a[_0x487a('0x3c')]);return db[_0x487a('0x27')][_0x487a('0x44')](_0x236a39)[_0x487a('0x25')](handleEntityNotFound(_0x55e1da,null))[_0x487a('0x25')](respondWithResult(_0x55e1da,null))[_0x487a('0x41')](handleError(_0x55e1da,null));};exports['create']=function(_0x4eb3c9,_0xa6d120){return db[_0x487a('0x27')]['create'](_0x4eb3c9[_0x487a('0x45')],{})[_0x487a('0x25')](respondWithResult(_0xa6d120,0xc9))['catch'](handleError(_0xa6d120,null));};exports[_0x487a('0x23')]=function(_0x591b9f,_0x1c6494){if(_0x591b9f[_0x487a('0x45')]['id']){delete _0x591b9f['body']['id'];}return db['VtigerAccount'][_0x487a('0x44')]({'where':{'id':_0x591b9f[_0x487a('0x42')]['id']}})['then'](handleEntityNotFound(_0x1c6494,null))['then'](saveUpdates(_0x591b9f[_0x487a('0x45')],null))[_0x487a('0x25')](respondWithResult(_0x1c6494,null))[_0x487a('0x41')](handleError(_0x1c6494,null));};exports[_0x487a('0x24')]=function(_0x558a7c,_0x1c1e02){return db[_0x487a('0x27')][_0x487a('0x44')]({'where':{'id':_0x558a7c[_0x487a('0x42')]['id']}})[_0x487a('0x25')](handleEntityNotFound(_0x1c1e02,null))[_0x487a('0x25')](removeEntity(_0x1c1e02,null))[_0x487a('0x41')](handleError(_0x1c1e02,null));};exports[_0x487a('0x46')]=function(_0x2f1126,_0x1be602,_0x4565c6){var _0x3fb971={};var _0x4253b5={};var _0x32cac9;var _0x211b78;return db[_0x487a('0x27')][_0x487a('0x47')]({'where':{'id':_0x2f1126[_0x487a('0x42')]['id']}})['then'](handleEntityNotFound(_0x1be602,null))[_0x487a('0x25')](function(_0x1aec48){if(_0x1aec48){_0x32cac9=_0x1aec48;_0x4253b5['model']=_['keys'](db[_0x487a('0x48')]['rawAttributes']);_0x4253b5[_0x487a('0x2e')]=_[_0x487a('0x43')](_0x2f1126[_0x487a('0x2e')]);_0x4253b5[_0x487a('0x2d')]=_[_0x487a('0x2f')](_0x4253b5[_0x487a('0x2b')],_0x4253b5[_0x487a('0x2e')]);_0x3fb971[_0x487a('0x31')]=_[_0x487a('0x2f')](_0x4253b5['model'],qs[_0x487a('0x30')](_0x2f1126['query'][_0x487a('0x30')]));_0x3fb971['attributes']=_0x3fb971['attributes'][_0x487a('0x32')]?_0x3fb971[_0x487a('0x31')]:_0x4253b5['model'];_0x3fb971[_0x487a('0x49')]=qs[_0x487a('0x35')](_0x2f1126[_0x487a('0x2e')][_0x487a('0x35')]);_0x3fb971[_0x487a('0x36')]=qs['filters'](_[_0x487a('0x37')](_0x2f1126[_0x487a('0x2e')],_0x4253b5[_0x487a('0x2d')]));if(_0x2f1126[_0x487a('0x2e')][_0x487a('0x38')]){_0x3fb971[_0x487a('0x36')]=_[_0x487a('0x39')](_0x3fb971[_0x487a('0x36')],{'$or':_[_0x487a('0x3a')](_0x3fb971['attributes'],function(_0x3ddc27){var _0x27600e={};_0x27600e[_0x3ddc27]={'$like':'%'+_0x2f1126['query'][_0x487a('0x38')]+'%'};return _0x27600e;})});}_0x3fb971=_[_0x487a('0x39')]({},_0x3fb971,_0x2f1126[_0x487a('0x3c')]);return _0x32cac9[_0x487a('0x46')](_0x3fb971);}})[_0x487a('0x25')](function(_0x5eefbe){if(_0x5eefbe){_0x211b78=_0x5eefbe[_0x487a('0x32')];if(!_0x2f1126[_0x487a('0x2e')][_0x487a('0x33')](_0x487a('0x34'))){_0x3fb971[_0x487a('0x1f')]=qs[_0x487a('0x1f')](_0x2f1126[_0x487a('0x2e')][_0x487a('0x1f')]);_0x3fb971['offset']=qs['offset'](_0x2f1126[_0x487a('0x2e')][_0x487a('0x1d')]);}return _0x32cac9['getConfigurations'](_0x3fb971);}})[_0x487a('0x25')](function(_0x12b2b9){if(_0x12b2b9){return _0x12b2b9?{'count':_0x211b78,'rows':_0x12b2b9}:null;}})[_0x487a('0x25')](respondWithResult(_0x1be602,null))[_0x487a('0x41')](handleError(_0x1be602,null));};exports[_0x487a('0x4a')]=function(_0x4edfd0,_0x4a1bb3,_0x52e593){if(_0x4edfd0[_0x487a('0x45')]['id']){delete _0x4edfd0[_0x487a('0x45')]['id'];}return db[_0x487a('0x27')]['findOne']({'where':{'id':_0x4edfd0[_0x487a('0x42')]['id']}})[_0x487a('0x25')](handleEntityNotFound(_0x4a1bb3,null))[_0x487a('0x25')](function(_0x5a5c59){if(_0x5a5c59){_0x4edfd0[_0x487a('0x45')]['AccountId']=_0x5a5c59['id'];_0x4edfd0[_0x487a('0x45')]['Subjects']=integrations[_0x487a('0x4b')](_0x4edfd0[_0x487a('0x45')][_0x487a('0x4c')],_0x4edfd0[_0x487a('0x45')][_0x487a('0x2a')]);_0x4edfd0['body'][_0x487a('0x4d')]=integrations[_0x487a('0x4e')](_0x4edfd0[_0x487a('0x45')][_0x487a('0x4c')],_0x4edfd0['body'][_0x487a('0x2a')]);return db[_0x487a('0x48')][_0x487a('0x4f')](_0x4edfd0[_0x487a('0x45')],{'include':[{'model':db[_0x487a('0x50')],'as':_0x487a('0x51')},{'model':db['VtigerField'],'as':_0x487a('0x4d')}]});}return null;})[_0x487a('0x25')](respondWithResult(_0x4a1bb3,null))[_0x487a('0x41')](handleError(_0x4a1bb3,null));};var md5=require(_0x487a('0x52'));exports[_0x487a('0x53')]=function(_0x47e0c7,_0xb7b12,_0x1dc9ed){var _0x51cc49=null;var _0x37abb4=null;var _0x345c38=null;var _0x407e76=null;var _0x3e7cd3='';return db[_0x487a('0x27')]['findOne']({'where':{'id':_0x47e0c7[_0x487a('0x42')]['id']},'attributes':['id',_0x487a('0x2c'),_0x487a('0x54'),_0x487a('0x55'),_0x487a('0x56'),'remoteUri',_0x487a('0x57'),_0x487a('0x58')]})[_0x487a('0x25')](handleEntityNotFound(_0xb7b12,null))[_0x487a('0x25')](function(_0x46e071){if(_0x46e071){_0x51cc49=_0x46e071[_0x487a('0x54')];_0x37abb4=_0x46e071[_0x487a('0x58')];_0x345c38=_0x46e071[_0x487a('0x56')];_0x3e7cd3=_0x46e071[_0x487a('0x59')];var _0x14eccf=_0x3e7cd3[_0x487a('0x5a')](-0x1);if(_0x14eccf==='/'){_0x3e7cd3=_0x3e7cd3[_0x487a('0x5b')](0x0,_0x3e7cd3[_0x487a('0x5c')](_0x14eccf));}_0x407e76=util[_0x487a('0x5d')](_0x487a('0x5e'),_0x3e7cd3);var _0x7f81cf={'method':'GET','uri':_0x407e76,'qs':{'operation':'getchallenge','username':_0x46e071['username']},'json':!![]};return rp(_0x7f81cf);}})[_0x487a('0x25')](function(_0xb9604f){if(_0xb9604f[_0x487a('0x5f')]){var _0xd8e7da={'method':_0x487a('0x60'),'uri':_0x407e76,'form':{'operation':_0x487a('0x61'),'username':_0x51cc49,'accessKey':md5(_0xb9604f[_0x487a('0x62')][_0x487a('0x63')]+_0x37abb4)},'json':!![]};return rp(_0xd8e7da);}})[_0x487a('0x25')](function(_0x3d372c){if(_0x3d372c['success']){var _0x37c8f3={'method':'GET','uri':_0x407e76,'qs':{'operation':_0x487a('0x64'),'username':_0x51cc49,'sessionName':_0x3d372c[_0x487a('0x62')][_0x487a('0x65')],'elementType':_0x345c38},'json':!![]};return rp(_0x37c8f3);}})['then'](function(_0x27b0ae){if(_0x27b0ae[_0x487a('0x5f')]){var _0xa193f9=['autogenerated',_0x487a('0x66'),'owner'];_[_0x487a('0x67')](_0x27b0ae[_0x487a('0x62')][_0x487a('0x30')],function(_0x29a2ad){return _0xa193f9[_0x487a('0x68')](_0x29a2ad[_0x487a('0x2a')]['name']);});_['remove'](_0x27b0ae['result']['fields'],function(_0xe506a7){return _0xe506a7[_0x487a('0x69')]===_0x487a('0x6a');});return{'count':_0x27b0ae[_0x487a('0x62')][_0x487a('0x30')][_0x487a('0x32')],'rows':_[_0x487a('0x3a')](_0x27b0ae[_0x487a('0x62')][_0x487a('0x30')],function(_0x4fef63){return{'id':_0x4fef63[_0x487a('0x2c')],'name':_0x4fef63[_0x487a('0x6b')],'custom':_[_0x487a('0x6c')](_0x4fef63[_0x487a('0x2c')],'cf_')?!![]:![],'options':_0x4fef63[_0x487a('0x2a')][_0x487a('0x2c')]===_0x487a('0x6d')&&_0x4fef63['type']['picklistValues'][_0x487a('0x32')]>0x0?_[_0x487a('0x3a')](_0x4fef63[_0x487a('0x2a')][_0x487a('0x6e')],function(_0x2f58b4){return{'name':_0x2f58b4[_0x487a('0x6b')],'value':_0x2f58b4[_0x487a('0x6f')]};}):[]};})};}})[_0x487a('0x25')](respondWithResult(_0xb7b12,null))[_0x487a('0x41')](function(_0x1ddcac){console['log'](_0x487a('0x70')+_0x1ddcac);var _0x114a65=_0x47e0c7['query'][_0x487a('0x71')]?0x1f4:_0x1ddcac[_0x487a('0x72')]||0x1f4;logger['error'](_0x487a('0x73'),_0x487a('0x53'),_0x114a65,JSON['stringify'](_0x1ddcac));delete _0x1ddcac[_0x487a('0x2c')];if(_0x114a65===0x191){_0x114a65=0x190;}_0xb7b12[_0x487a('0x1b')](_0x114a65)[_0x487a('0x26')](_0x47e0c7[_0x487a('0x2e')][_0x487a('0x71')]?{'message':'Wrong\x20credentials','statusCode':_0x1ddcac['statusCode']}:_0x1ddcac);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 4c86532..3ab2d96 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 _0xad96=['../../config/environment','./intVtigerAccount.attributes','define','VtigerAccount','int_vtiger_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x558c42,_0x870477){var _0x1536dd=function(_0x14fdd0){while(--_0x14fdd0){_0x558c42['push'](_0x558c42['shift']());}};_0x1536dd(++_0x870477);}(_0xad96,0x164));var _0x6ad9=function(_0x4b0a6d,_0x3d4e91){_0x4b0a6d=_0x4b0a6d-0x0;var _0x2a60e2=_0xad96[_0x4b0a6d];return _0x2a60e2;};'use strict';var _=require(_0x6ad9('0x0'));var util=require('util');var logger=require(_0x6ad9('0x1'))(_0x6ad9('0x2'));var moment=require(_0x6ad9('0x3'));var BPromise=require(_0x6ad9('0x4'));var rp=require(_0x6ad9('0x5'));var fs=require('fs');var path=require(_0x6ad9('0x6'));var rimraf=require(_0x6ad9('0x7'));var config=require(_0x6ad9('0x8'));var attributes=require(_0x6ad9('0x9'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x17a2a0,_0x31c8df){return _0x17a2a0[_0x6ad9('0xa')](_0x6ad9('0xb'),attributes,{'tableName':_0x6ad9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7dc8=['./intVtigerAccount.attributes','../../components/integrations/configuration','define','VtigerAccount','int_vtiger_accounts','lodash','../../config/logger','moment','rimraf','../../config/environment'];(function(_0x3bc282,_0x3b67cf){var _0x120092=function(_0x4043fd){while(--_0x4043fd){_0x3bc282['push'](_0x3bc282['shift']());}};_0x120092(++_0x3b67cf);}(_0x7dc8,0x1db));var _0x87dc=function(_0x120c36,_0x5a43be){_0x120c36=_0x120c36-0x0;var _0x3ff5d3=_0x7dc8[_0x120c36];return _0x3ff5d3;};'use strict';var _=require(_0x87dc('0x0'));var util=require('util');var logger=require(_0x87dc('0x1'))('api');var moment=require(_0x87dc('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x87dc('0x3'));var config=require(_0x87dc('0x4'));var attributes=require(_0x87dc('0x5'));var integrations=require(_0x87dc('0x6'));module['exports']=function(_0x334f72,_0x2fd445){return _0x334f72[_0x87dc('0x7')](_0x87dc('0x8'),attributes,{'tableName':_0x87dc('0x9'),'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 d9094b1..686a609 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 _0xea28=['code','message','result','catch','GetVtigerAccount','VtigerAccount','findAll','options','where','attributes','limit','include','map','model','ShowVtigerAccount','find','raw','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x2fbb5c,_0x3ecbcc){var _0x581a52=function(_0x3ca627){while(--_0x3ca627){_0x2fbb5c['push'](_0x2fbb5c['shift']());}};_0x581a52(++_0x3ecbcc);}(_0xea28,0x13a));var _0x8ea2=function(_0x2c4d28,_0x2842db){_0x2c4d28=_0x2c4d28-0x0;var _0x2e93a0=_0xea28[_0x2c4d28];return _0x2e93a0;};'use strict';var _=require(_0x8ea2('0x0'));var util=require(_0x8ea2('0x1'));var moment=require(_0x8ea2('0x2'));var BPromise=require(_0x8ea2('0x3'));var rs=require(_0x8ea2('0x4'));var fs=require('fs');var Redis=require(_0x8ea2('0x5'));var db=require(_0x8ea2('0x6'))['db'];var utils=require(_0x8ea2('0x7'));var logger=require('../../config/logger')(_0x8ea2('0x8'));var config=require(_0x8ea2('0x9'));var jayson=require(_0x8ea2('0xa'));var client=jayson['client'][_0x8ea2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x435d78,_0xb7f278,_0x39b1fa){return new BPromise(function(_0x28b5b8,_0x929304){return client[_0x8ea2('0xc')](_0x435d78,_0x39b1fa)[_0x8ea2('0xd')](function(_0x3de4a1){logger[_0x8ea2('0xe')](_0x8ea2('0xf'),_0xb7f278,_0x8ea2('0x10'));logger['debug']('VtigerAccount,\x20%s,\x20%s,\x20%s',_0xb7f278,_0x8ea2('0x10'),JSON[_0x8ea2('0x11')](_0x3de4a1));if(_0x3de4a1[_0x8ea2('0x12')]){if(_0x3de4a1['error'][_0x8ea2('0x13')]===0x1f4){logger[_0x8ea2('0x12')](_0x8ea2('0xf'),_0xb7f278,_0x3de4a1[_0x8ea2('0x12')][_0x8ea2('0x14')]);return _0x929304(_0x3de4a1['error'][_0x8ea2('0x14')]);}logger['error']('VtigerAccount,\x20%s,\x20%s',_0xb7f278,_0x3de4a1[_0x8ea2('0x12')][_0x8ea2('0x14')]);return _0x28b5b8(_0x3de4a1[_0x8ea2('0x12')][_0x8ea2('0x14')]);}else{logger[_0x8ea2('0xe')](_0x8ea2('0xf'),_0xb7f278,_0x8ea2('0x10'));_0x28b5b8(_0x3de4a1[_0x8ea2('0x15')][_0x8ea2('0x14')]);}})[_0x8ea2('0x16')](function(_0x2dfa7c){logger[_0x8ea2('0x12')](_0x8ea2('0xf'),_0xb7f278,_0x2dfa7c);_0x929304(_0x2dfa7c);});});}exports[_0x8ea2('0x17')]=function(_0x1b64cf){var _0x174ef2=this;return new Promise(function(_0x467045,_0x2a0329){return db[_0x8ea2('0x18')][_0x8ea2('0x19')]({'raw':_0x1b64cf[_0x8ea2('0x1a')]?_0x1b64cf[_0x8ea2('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x1b64cf['options']?_0x1b64cf[_0x8ea2('0x1a')][_0x8ea2('0x1b')]||null:null,'attributes':_0x1b64cf[_0x8ea2('0x1a')]?_0x1b64cf['options'][_0x8ea2('0x1c')]||null:null,'limit':_0x1b64cf[_0x8ea2('0x1a')]?_0x1b64cf['options'][_0x8ea2('0x1d')]||null:null,'include':_0x1b64cf[_0x8ea2('0x1a')]?_0x1b64cf[_0x8ea2('0x1a')][_0x8ea2('0x1e')]?_[_0x8ea2('0x1f')](_0x1b64cf[_0x8ea2('0x1a')][_0x8ea2('0x1e')],function(_0x1e4cc9){return{'model':db[_0x1e4cc9[_0x8ea2('0x20')]],'as':_0x1e4cc9['as'],'attributes':_0x1e4cc9['attributes'],'include':_0x1e4cc9[_0x8ea2('0x1e')]?_['map'](_0x1e4cc9[_0x8ea2('0x1e')],function(_0x42bec8){return{'model':db[_0x42bec8[_0x8ea2('0x20')]],'as':_0x42bec8['as'],'attributes':_0x42bec8['attributes'],'include':_0x42bec8['include']?_[_0x8ea2('0x1f')](_0x42bec8['include'],function(_0x200a49){return{'model':db[_0x200a49['model']],'as':_0x200a49['as'],'attributes':_0x200a49[_0x8ea2('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x8ea2('0xd')](function(_0x21c526){logger[_0x8ea2('0xe')]('GetVtigerAccount',_0x1b64cf);logger['debug'](_0x8ea2('0x17'),_0x1b64cf,JSON['stringify'](_0x21c526));_0x467045(_0x21c526);})[_0x8ea2('0x16')](function(_0x287078){logger[_0x8ea2('0x12')](_0x8ea2('0x17'),_0x287078[_0x8ea2('0x14')],_0x1b64cf);_0x2a0329(_0x174ef2[_0x8ea2('0x12')](0x1f4,_0x287078[_0x8ea2('0x14')]));});});};exports[_0x8ea2('0x21')]=function(_0x19e868){var _0x9c5fac=this;return new Promise(function(_0x56d914,_0x5b7ff9){return db[_0x8ea2('0x18')][_0x8ea2('0x22')]({'raw':_0x19e868['options']?_0x19e868['options'][_0x8ea2('0x23')]===undefined?!![]:![]:!![],'where':_0x19e868['options']?_0x19e868[_0x8ea2('0x1a')][_0x8ea2('0x1b')]||null:null,'attributes':_0x19e868['options']?_0x19e868[_0x8ea2('0x1a')][_0x8ea2('0x1c')]||null:null,'include':_0x19e868[_0x8ea2('0x1a')]?_0x19e868['options']['include']?_['map'](_0x19e868[_0x8ea2('0x1a')][_0x8ea2('0x1e')],function(_0x3fc785){return{'model':db[_0x3fc785['model']],'as':_0x3fc785['as'],'attributes':_0x3fc785[_0x8ea2('0x1c')],'include':_0x3fc785[_0x8ea2('0x1e')]?_[_0x8ea2('0x1f')](_0x3fc785[_0x8ea2('0x1e')],function(_0x253031){return{'model':db[_0x253031[_0x8ea2('0x20')]],'as':_0x253031['as'],'attributes':_0x253031[_0x8ea2('0x1c')],'include':_0x253031[_0x8ea2('0x1e')]?_['map'](_0x253031[_0x8ea2('0x1e')],function(_0x29e3f5){return{'model':db[_0x29e3f5[_0x8ea2('0x20')]],'as':_0x29e3f5['as'],'attributes':_0x29e3f5[_0x8ea2('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2a1f14){logger['info'](_0x8ea2('0x21'),_0x19e868);logger[_0x8ea2('0x24')](_0x8ea2('0x21'),_0x19e868,JSON[_0x8ea2('0x11')](_0x2a1f14));_0x56d914(_0x2a1f14);})['catch'](function(_0x2bed24){logger['error']('ShowVtigerAccount',_0x2bed24[_0x8ea2('0x14')],_0x19e868);_0x5b7ff9(_0x9c5fac['error'](0x1f4,_0x2bed24[_0x8ea2('0x14')]));});});}; \ No newline at end of file +var _0x282b=['map','model','ShowVtigerAccount','VtigerAccount','debug','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','VtigerAccount,\x20%s,\x20%s','VtigerAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetVtigerAccount','findAll','options','raw','where','attributes','include'];(function(_0xf0ec0c,_0x44dbf8){var _0x410e0d=function(_0xa83a82){while(--_0xa83a82){_0xf0ec0c['push'](_0xf0ec0c['shift']());}};_0x410e0d(++_0x44dbf8);}(_0x282b,0xec));var _0xb282=function(_0x1ab648,_0x37bcb1){_0x1ab648=_0x1ab648-0x0;var _0x4c141b=_0x282b[_0x1ab648];return _0x4c141b;};'use strict';var _=require(_0xb282('0x0'));var util=require(_0xb282('0x1'));var moment=require(_0xb282('0x2'));var BPromise=require(_0xb282('0x3'));var rs=require(_0xb282('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb282('0x5'));var logger=require('../../config/logger')(_0xb282('0x6'));var config=require(_0xb282('0x7'));var jayson=require(_0xb282('0x8'));var client=jayson[_0xb282('0x9')][_0xb282('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x33635f,_0x4f0410,_0x4a0d28){return new BPromise(function(_0x17fba1,_0x436eaa){return client['request'](_0x33635f,_0x4a0d28)[_0xb282('0xb')](function(_0x20f517){logger[_0xb282('0xc')](_0xb282('0xd'),_0x4f0410,'request\x20sent');logger['debug'](_0xb282('0xe'),_0x4f0410,_0xb282('0xf'),JSON[_0xb282('0x10')](_0x20f517));if(_0x20f517[_0xb282('0x11')]){if(_0x20f517[_0xb282('0x11')]['code']===0x1f4){logger['error'](_0xb282('0xd'),_0x4f0410,_0x20f517[_0xb282('0x11')][_0xb282('0x12')]);return _0x436eaa(_0x20f517[_0xb282('0x11')][_0xb282('0x12')]);}logger['error'](_0xb282('0xd'),_0x4f0410,_0x20f517['error'][_0xb282('0x12')]);return _0x17fba1(_0x20f517[_0xb282('0x11')]['message']);}else{logger['info']('VtigerAccount,\x20%s,\x20%s',_0x4f0410,_0xb282('0xf'));_0x17fba1(_0x20f517[_0xb282('0x13')][_0xb282('0x12')]);}})[_0xb282('0x14')](function(_0x438a05){logger['error'](_0xb282('0xd'),_0x4f0410,_0x438a05);_0x436eaa(_0x438a05);});});}exports[_0xb282('0x15')]=function(_0xca5f12){var _0x45b070=this;return new Promise(function(_0x3f8a3f,_0x492d20){return db['VtigerAccount'][_0xb282('0x16')]({'raw':_0xca5f12[_0xb282('0x17')]?_0xca5f12['options'][_0xb282('0x18')]===undefined?!![]:![]:!![],'where':_0xca5f12[_0xb282('0x17')]?_0xca5f12[_0xb282('0x17')][_0xb282('0x19')]||null:null,'attributes':_0xca5f12[_0xb282('0x17')]?_0xca5f12['options'][_0xb282('0x1a')]||null:null,'limit':_0xca5f12[_0xb282('0x17')]?_0xca5f12[_0xb282('0x17')]['limit']||null:null,'include':_0xca5f12[_0xb282('0x17')]?_0xca5f12[_0xb282('0x17')][_0xb282('0x1b')]?_[_0xb282('0x1c')](_0xca5f12[_0xb282('0x17')]['include'],function(_0x4d624f){return{'model':db[_0x4d624f[_0xb282('0x1d')]],'as':_0x4d624f['as'],'attributes':_0x4d624f[_0xb282('0x1a')],'include':_0x4d624f['include']?_['map'](_0x4d624f[_0xb282('0x1b')],function(_0x114f77){return{'model':db[_0x114f77[_0xb282('0x1d')]],'as':_0x114f77['as'],'attributes':_0x114f77[_0xb282('0x1a')],'include':_0x114f77[_0xb282('0x1b')]?_[_0xb282('0x1c')](_0x114f77['include'],function(_0xa0d7fb){return{'model':db[_0xa0d7fb[_0xb282('0x1d')]],'as':_0xa0d7fb['as'],'attributes':_0xa0d7fb['attributes']};}):[]};}):[]};}):[]:[]})[_0xb282('0xb')](function(_0x38a1f8){logger[_0xb282('0xc')](_0xb282('0x15'),_0xca5f12);logger['debug'](_0xb282('0x15'),_0xca5f12,JSON[_0xb282('0x10')](_0x38a1f8));_0x3f8a3f(_0x38a1f8);})[_0xb282('0x14')](function(_0x433ad5){logger[_0xb282('0x11')](_0xb282('0x15'),_0x433ad5[_0xb282('0x12')],_0xca5f12);_0x492d20(_0x45b070['error'](0x1f4,_0x433ad5[_0xb282('0x12')]));});});};exports[_0xb282('0x1e')]=function(_0x3eb294){var _0xd8780b=this;return new Promise(function(_0x42ef75,_0x5f3ddf){return db[_0xb282('0x1f')]['find']({'raw':_0x3eb294[_0xb282('0x17')]?_0x3eb294[_0xb282('0x17')][_0xb282('0x18')]===undefined?!![]:![]:!![],'where':_0x3eb294['options']?_0x3eb294[_0xb282('0x17')]['where']||null:null,'attributes':_0x3eb294[_0xb282('0x17')]?_0x3eb294[_0xb282('0x17')][_0xb282('0x1a')]||null:null,'include':_0x3eb294[_0xb282('0x17')]?_0x3eb294[_0xb282('0x17')][_0xb282('0x1b')]?_['map'](_0x3eb294[_0xb282('0x17')][_0xb282('0x1b')],function(_0x4ede9d){return{'model':db[_0x4ede9d['model']],'as':_0x4ede9d['as'],'attributes':_0x4ede9d[_0xb282('0x1a')],'include':_0x4ede9d[_0xb282('0x1b')]?_[_0xb282('0x1c')](_0x4ede9d['include'],function(_0x4a76ce){return{'model':db[_0x4a76ce['model']],'as':_0x4a76ce['as'],'attributes':_0x4a76ce[_0xb282('0x1a')],'include':_0x4a76ce[_0xb282('0x1b')]?_[_0xb282('0x1c')](_0x4a76ce[_0xb282('0x1b')],function(_0x17c1e4){return{'model':db[_0x17c1e4[_0xb282('0x1d')]],'as':_0x17c1e4['as'],'attributes':_0x17c1e4[_0xb282('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3dc171){logger['info'](_0xb282('0x1e'),_0x3eb294);logger[_0xb282('0x20')](_0xb282('0x1e'),_0x3eb294,JSON['stringify'](_0x3dc171));_0x42ef75(_0x3dc171);})[_0xb282('0x14')](function(_0x4beef2){logger[_0xb282('0x11')](_0xb282('0x1e'),_0x4beef2[_0xb282('0x12')],_0x3eb294);_0x5f3ddf(_0xd8780b[_0xb282('0x11')](0x1f4,_0x4beef2['message']));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index a08d455..4e01023 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 _0xc2b0=['/:id','show','getFields','/:id/subjects','getSubjects','create','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','index'];(function(_0x555479,_0x3aa2b4){var _0x560c8e=function(_0x5168ef){while(--_0x5168ef){_0x555479['push'](_0x555479['shift']());}};_0x560c8e(++_0x3aa2b4);}(_0xc2b0,0xe5));var _0x0c2b=function(_0x517648,_0x3e4708){_0x517648=_0x517648-0x0;var _0xb5372a=_0xc2b0[_0x517648];return _0xb5372a;};'use strict';var multer=require(_0x0c2b('0x0'));var util=require(_0x0c2b('0x1'));var path=require(_0x0c2b('0x2'));var timeout=require(_0x0c2b('0x3'));var express=require(_0x0c2b('0x4'));var router=express[_0x0c2b('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0c2b('0x6'));var controller=require(_0x0c2b('0x7'));router[_0x0c2b('0x8')]('/',auth[_0x0c2b('0x9')](),controller[_0x0c2b('0xa')]);router['get'](_0x0c2b('0xb'),auth[_0x0c2b('0x9')](),controller[_0x0c2b('0xc')]);router[_0x0c2b('0x8')]('/:id/fields',auth['isAuthenticated'](),controller[_0x0c2b('0xd')]);router['get'](_0x0c2b('0xe'),auth[_0x0c2b('0x9')](),controller[_0x0c2b('0xf')]);router[_0x0c2b('0x8')]('/:id/descriptions',auth[_0x0c2b('0x9')](),controller['getDescriptions']);router['post']('/',auth['isAuthenticated'](),controller[_0x0c2b('0x10')]);router['put'](_0x0c2b('0xb'),auth[_0x0c2b('0x9')](),controller[_0x0c2b('0x11')]);router['delete'](_0x0c2b('0xb'),auth[_0x0c2b('0x9')](),controller[_0x0c2b('0x12')]);module[_0x0c2b('0x13')]=router; \ No newline at end of file +var _0xd59b=['./intVtigerConfiguration.controller','get','index','/:id','/:id/fields','isAuthenticated','getFields','/:id/subjects','getSubjects','create','put','update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x37b7a0,_0x2ee4f5){var _0x4fb461=function(_0x4970a3){while(--_0x4970a3){_0x37b7a0['push'](_0x37b7a0['shift']());}};_0x4fb461(++_0x2ee4f5);}(_0xd59b,0xf5));var _0xbd59=function(_0x39ef20,_0x42b961){_0x39ef20=_0x39ef20-0x0;var _0x42a611=_0xd59b[_0x39ef20];return _0x42a611;};'use strict';var multer=require('multer');var util=require(_0xbd59('0x0'));var path=require('path');var timeout=require(_0xbd59('0x1'));var express=require(_0xbd59('0x2'));var router=express[_0xbd59('0x3')]();var fs_extra=require(_0xbd59('0x4'));var auth=require(_0xbd59('0x5'));var interaction=require(_0xbd59('0x6'));var config=require(_0xbd59('0x7'));var controller=require(_0xbd59('0x8'));router[_0xbd59('0x9')]('/',auth['isAuthenticated'](),controller[_0xbd59('0xa')]);router[_0xbd59('0x9')](_0xbd59('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xbd59('0x9')](_0xbd59('0xc'),auth[_0xbd59('0xd')](),controller[_0xbd59('0xe')]);router[_0xbd59('0x9')](_0xbd59('0xf'),auth[_0xbd59('0xd')](),controller[_0xbd59('0x10')]);router[_0xbd59('0x9')]('/:id/descriptions',auth[_0xbd59('0xd')](),controller['getDescriptions']);router['post']('/',auth[_0xbd59('0xd')](),controller[_0xbd59('0x11')]);router[_0xbd59('0x12')](_0xbd59('0xb'),auth['isAuthenticated'](),controller[_0xbd59('0x13')]);router[_0xbd59('0x14')](_0xbd59('0xb'),auth[_0xbd59('0xd')](),controller[_0xbd59('0x15')]);module[_0xbd59('0x16')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 4195131..d4c5f36 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 _0x45ec=['STRING','sequelize'];(function(_0x488ca1,_0xf6858e){var _0x4dd0a4=function(_0x40fb65){while(--_0x40fb65){_0x488ca1['push'](_0x488ca1['shift']());}};_0x4dd0a4(++_0xf6858e);}(_0x45ec,0x169));var _0xc45e=function(_0x57687a,_0x49f298){_0x57687a=_0x57687a-0x0;var _0x21cbae=_0x45ec[_0x57687a];return _0x21cbae;};'use strict';var Sequelize=require(_0xc45e('0x0'));module['exports']={'name':{'type':Sequelize[_0xc45e('0x1')]},'description':{'type':Sequelize[_0xc45e('0x1')]}}; \ No newline at end of file +var _0x4da4=['sequelize','exports','STRING'];(function(_0x462c14,_0x13851c){var _0x3cdd45=function(_0x55d930){while(--_0x55d930){_0x462c14['push'](_0x462c14['shift']());}};_0x3cdd45(++_0x13851c);}(_0x4da4,0xae));var _0x44da=function(_0x2067e3,_0x19bcb2){_0x2067e3=_0x2067e3-0x0;var _0x180c44=_0x4da4[_0x2067e3];return _0x180c44;};'use strict';var Sequelize=require(_0x44da('0x0'));module[_0x44da('0x1')]={'name':{'type':Sequelize[_0x44da('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index d95a562..070a47e 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 _0xc200=['length','query','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','show','params','body','catch','find','getFields','findOne','VtigerField','getSubjects','hasOwnProperty','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','save','update','then','destroy','error','stack','name','send','index','map','VtigerConfiguration','rawAttributes','fieldName','type','key','model','keys','filters','intersection','fields','attributes'];(function(_0x4b1496,_0x5ce950){var _0x4d967b=function(_0x384f16){while(--_0x384f16){_0x4b1496['push'](_0x4b1496['shift']());}};_0x4d967b(++_0x5ce950);}(_0xc200,0x19e));var _0x0c20=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0xc200[_0x4a53d];return _0x27410e;};'use strict';var emlformat=require(_0x0c20('0x0'));var rimraf=require(_0x0c20('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0c20('0x2'));var rp=require(_0x0c20('0x3'));var moment=require(_0x0c20('0x4'));var BPromise=require(_0x0c20('0x5'));var Mustache=require(_0x0c20('0x6'));var util=require(_0x0c20('0x7'));var path=require(_0x0c20('0x8'));var sox=require('sox');var csv=require(_0x0c20('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0c20('0xa'));var _=require('lodash');var squel=require(_0x0c20('0xb'));var crypto=require(_0x0c20('0xc'));var jsforce=require(_0x0c20('0xd'));var deskjs=require(_0x0c20('0xe'));var toCsv=require(_0x0c20('0x9'));var querystring=require(_0x0c20('0xf'));var Papa=require(_0x0c20('0x10'));var Redis=require(_0x0c20('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x0c20('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x0c20('0x13'))(_0x0c20('0x14'));var utils=require(_0x0c20('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0c20('0x16'))['db'];function respondWithStatusCode(_0x2b30a7,_0x1bf16e){_0x1bf16e=_0x1bf16e||0xcc;return function(_0x2c796e){if(_0x2c796e){return _0x2b30a7[_0x0c20('0x17')](_0x1bf16e);}return _0x2b30a7[_0x0c20('0x18')](_0x1bf16e)[_0x0c20('0x19')]();};}function respondWithResult(_0x3e99d9,_0x175b9a){_0x175b9a=_0x175b9a||0xc8;return function(_0x2dc38e){if(_0x2dc38e){return _0x3e99d9[_0x0c20('0x18')](_0x175b9a)[_0x0c20('0x1a')](_0x2dc38e);}};}function respondWithFilteredResult(_0x1126c9,_0x4f507a){return function(_0x5f2b1e){if(_0x5f2b1e){var _0x26e276=typeof _0x4f507a['offset']===_0x0c20('0x1b')&&typeof _0x4f507a[_0x0c20('0x1c')]===_0x0c20('0x1b');var _0x37cb5f=_0x5f2b1e[_0x0c20('0x1d')];var _0x44f945=_0x26e276?0x0:_0x4f507a[_0x0c20('0x1e')];var _0x16d56e=_0x26e276?_0x5f2b1e[_0x0c20('0x1d')]:_0x4f507a[_0x0c20('0x1e')]+_0x4f507a[_0x0c20('0x1c')];var _0x12ed48;if(_0x16d56e>=_0x37cb5f){_0x16d56e=_0x37cb5f;_0x12ed48=0xc8;}else{_0x12ed48=0xce;}_0x1126c9[_0x0c20('0x18')](_0x12ed48);return _0x1126c9[_0x0c20('0x1f')](_0x0c20('0x20'),_0x44f945+'-'+_0x16d56e+'/'+_0x37cb5f)[_0x0c20('0x1a')](_0x5f2b1e);}return null;};}function patchUpdates(_0x1b690d){return function(_0x4d9f74){try{jsonpatch['apply'](_0x4d9f74,_0x1b690d,!![]);}catch(_0x27d51e){return BPromise['reject'](_0x27d51e);}return _0x4d9f74[_0x0c20('0x21')]();};}function saveUpdates(_0x318ac2,_0xd724f5){return function(_0x55d93b){if(_0x55d93b){return _0x55d93b[_0x0c20('0x22')](_0x318ac2)[_0x0c20('0x23')](function(_0x655781){return _0x655781;});}return null;};}function removeEntity(_0x32de68,_0x3dd36c){return function(_0xf8f8f2){if(_0xf8f8f2){return _0xf8f8f2[_0x0c20('0x24')]()[_0x0c20('0x23')](function(){_0x32de68[_0x0c20('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x33261a,_0x29f5c0){return function(_0x3e1d9e){if(!_0x3e1d9e){_0x33261a[_0x0c20('0x17')](0x194);}return _0x3e1d9e;};}function handleError(_0x33bcfd,_0x854a9e){_0x854a9e=_0x854a9e||0x1f4;return function(_0x50f057){logger[_0x0c20('0x25')](_0x50f057[_0x0c20('0x26')]);if(_0x50f057['name']){delete _0x50f057[_0x0c20('0x27')];}_0x33bcfd['status'](_0x854a9e)[_0x0c20('0x28')](_0x50f057);};}exports[_0x0c20('0x29')]=function(_0x23b6a1,_0x30e6df){var _0x4e024f={},_0x5b3f51={},_0x24c622={'count':0x0,'rows':[]};var _0x94b8c2=_[_0x0c20('0x2a')](db[_0x0c20('0x2b')][_0x0c20('0x2c')],function(_0x2787dc){return{'name':_0x2787dc[_0x0c20('0x2d')],'type':_0x2787dc[_0x0c20('0x2e')][_0x0c20('0x2f')]};});_0x5b3f51[_0x0c20('0x30')]=_[_0x0c20('0x2a')](_0x94b8c2,_0x0c20('0x27'));_0x5b3f51['query']=_[_0x0c20('0x31')](_0x23b6a1['query']);_0x5b3f51[_0x0c20('0x32')]=_['intersection'](_0x5b3f51[_0x0c20('0x30')],_0x5b3f51['query']);_0x4e024f['attributes']=_[_0x0c20('0x33')](_0x5b3f51[_0x0c20('0x30')],qs[_0x0c20('0x34')](_0x23b6a1['query'][_0x0c20('0x34')]));_0x4e024f[_0x0c20('0x35')]=_0x4e024f[_0x0c20('0x35')][_0x0c20('0x36')]?_0x4e024f[_0x0c20('0x35')]:_0x5b3f51[_0x0c20('0x30')];if(!_0x23b6a1[_0x0c20('0x37')]['hasOwnProperty'](_0x0c20('0x38'))){_0x4e024f['limit']=qs[_0x0c20('0x1c')](_0x23b6a1[_0x0c20('0x37')]['limit']);_0x4e024f[_0x0c20('0x1e')]=qs['offset'](_0x23b6a1[_0x0c20('0x37')][_0x0c20('0x1e')]);}_0x4e024f[_0x0c20('0x39')]=qs[_0x0c20('0x3a')](_0x23b6a1['query']['sort']);_0x4e024f[_0x0c20('0x3b')]=qs[_0x0c20('0x32')](_[_0x0c20('0x3c')](_0x23b6a1[_0x0c20('0x37')],_0x5b3f51[_0x0c20('0x32')]),_0x94b8c2);if(_0x23b6a1[_0x0c20('0x37')][_0x0c20('0x3d')]){_0x4e024f[_0x0c20('0x3b')]=_[_0x0c20('0x3e')](_0x4e024f['where'],{'$or':_[_0x0c20('0x2a')](_0x94b8c2,function(_0x41ed5a){if(_0x41ed5a[_0x0c20('0x2e')]!=='VIRTUAL'){var _0x7bca55={};_0x7bca55[_0x41ed5a[_0x0c20('0x27')]]={'$like':'%'+_0x23b6a1['query'][_0x0c20('0x3d')]+'%'};return _0x7bca55;}})});}_0x4e024f=_[_0x0c20('0x3e')]({},_0x4e024f,_0x23b6a1[_0x0c20('0x3f')]);var _0x1eaaaa={'where':_0x4e024f[_0x0c20('0x3b')]};return db[_0x0c20('0x2b')]['count'](_0x1eaaaa)[_0x0c20('0x23')](function(_0x3b1980){_0x24c622[_0x0c20('0x1d')]=_0x3b1980;if(_0x23b6a1['query'][_0x0c20('0x40')]){_0x4e024f[_0x0c20('0x41')]=[{'all':!![]}];}return db['VtigerConfiguration'][_0x0c20('0x42')](_0x4e024f);})[_0x0c20('0x23')](function(_0x5ef739){_0x24c622['rows']=_0x5ef739;return _0x24c622;})['then'](respondWithFilteredResult(_0x30e6df,_0x4e024f))['catch'](handleError(_0x30e6df,null));};exports[_0x0c20('0x43')]=function(_0x2ff2b1,_0x8ae269){var _0x393db0={'raw':![],'where':{'id':_0x2ff2b1[_0x0c20('0x44')]['id']}},_0x554df4={};_0x554df4[_0x0c20('0x30')]=_[_0x0c20('0x31')](db[_0x0c20('0x2b')][_0x0c20('0x2c')]);_0x554df4['query']=_[_0x0c20('0x31')](_0x2ff2b1[_0x0c20('0x37')]);_0x554df4['filters']=_[_0x0c20('0x33')](_0x554df4[_0x0c20('0x30')],_0x554df4[_0x0c20('0x37')]);_0x393db0['attributes']=_[_0x0c20('0x33')](_0x554df4[_0x0c20('0x30')],qs[_0x0c20('0x34')](_0x2ff2b1[_0x0c20('0x37')]['fields']));_0x393db0[_0x0c20('0x35')]=_0x393db0[_0x0c20('0x35')][_0x0c20('0x36')]?_0x393db0['attributes']:_0x554df4[_0x0c20('0x30')];if(_0x2ff2b1[_0x0c20('0x37')][_0x0c20('0x40')]){_0x393db0[_0x0c20('0x41')]=[{'all':!![]}];}_0x393db0=_[_0x0c20('0x3e')]({},_0x393db0,_0x2ff2b1[_0x0c20('0x3f')]);return db[_0x0c20('0x2b')]['find'](_0x393db0)['then'](handleEntityNotFound(_0x8ae269,null))[_0x0c20('0x23')](respondWithResult(_0x8ae269,null))['catch'](handleError(_0x8ae269,null));};exports['create']=function(_0x40115d,_0x195cc5){return db[_0x0c20('0x2b')]['create'](_0x40115d[_0x0c20('0x45')],{})[_0x0c20('0x23')](respondWithResult(_0x195cc5,0xc9))[_0x0c20('0x46')](handleError(_0x195cc5,null));};exports[_0x0c20('0x22')]=function(_0x4dd77c,_0x3f7570){if(_0x4dd77c[_0x0c20('0x45')]['id']){delete _0x4dd77c[_0x0c20('0x45')]['id'];}return db['VtigerConfiguration']['find']({'where':{'id':_0x4dd77c[_0x0c20('0x44')]['id']}})['then'](handleEntityNotFound(_0x3f7570,null))[_0x0c20('0x23')](saveUpdates(_0x4dd77c[_0x0c20('0x45')],null))[_0x0c20('0x23')](respondWithResult(_0x3f7570,null))[_0x0c20('0x46')](handleError(_0x3f7570,null));};exports[_0x0c20('0x24')]=function(_0x3f949c,_0x494c91){return db[_0x0c20('0x2b')][_0x0c20('0x47')]({'where':{'id':_0x3f949c[_0x0c20('0x44')]['id']}})[_0x0c20('0x23')](handleEntityNotFound(_0x494c91,null))[_0x0c20('0x23')](removeEntity(_0x494c91,null))[_0x0c20('0x46')](handleError(_0x494c91,null));};exports[_0x0c20('0x48')]=function(_0x536743,_0x47363f,_0x4bb95a){var _0x1f29dd={};var _0x51c8e9={};var _0x2a7cf6;var _0x170c83;return db['VtigerConfiguration'][_0x0c20('0x49')]({'where':{'id':_0x536743['params']['id']}})[_0x0c20('0x23')](handleEntityNotFound(_0x47363f,null))[_0x0c20('0x23')](function(_0x5220ca){if(_0x5220ca){_0x2a7cf6=_0x5220ca;_0x51c8e9[_0x0c20('0x30')]=_[_0x0c20('0x31')](db[_0x0c20('0x4a')][_0x0c20('0x2c')]);_0x51c8e9[_0x0c20('0x37')]=_['keys'](_0x536743[_0x0c20('0x37')]);_0x51c8e9[_0x0c20('0x32')]=_['intersection'](_0x51c8e9['model'],_0x51c8e9['query']);_0x1f29dd[_0x0c20('0x35')]=_[_0x0c20('0x33')](_0x51c8e9[_0x0c20('0x30')],qs[_0x0c20('0x34')](_0x536743[_0x0c20('0x37')]['fields']));_0x1f29dd[_0x0c20('0x35')]=_0x1f29dd[_0x0c20('0x35')][_0x0c20('0x36')]?_0x1f29dd[_0x0c20('0x35')]:_0x51c8e9[_0x0c20('0x30')];_0x1f29dd[_0x0c20('0x39')]=qs[_0x0c20('0x3a')](_0x536743[_0x0c20('0x37')][_0x0c20('0x3a')]);_0x1f29dd['where']=qs[_0x0c20('0x32')](_[_0x0c20('0x3c')](_0x536743['query'],_0x51c8e9[_0x0c20('0x32')]));if(_0x536743['query'][_0x0c20('0x3d')]){_0x1f29dd[_0x0c20('0x3b')]=_[_0x0c20('0x3e')](_0x1f29dd[_0x0c20('0x3b')],{'$or':_['map'](_0x1f29dd['attributes'],function(_0x577f84){var _0x3a2a9e={};_0x3a2a9e[_0x577f84]={'$like':'%'+_0x536743[_0x0c20('0x37')]['filter']+'%'};return _0x3a2a9e;})});}_0x1f29dd=_[_0x0c20('0x3e')]({},_0x1f29dd,_0x536743[_0x0c20('0x3f')]);return _0x2a7cf6[_0x0c20('0x48')](_0x1f29dd);}})[_0x0c20('0x23')](function(_0xfba55f){if(_0xfba55f){_0x170c83=_0xfba55f[_0x0c20('0x36')];if(!_0x536743[_0x0c20('0x37')]['hasOwnProperty'](_0x0c20('0x38'))){_0x1f29dd[_0x0c20('0x1c')]=qs[_0x0c20('0x1c')](_0x536743['query'][_0x0c20('0x1c')]);_0x1f29dd['offset']=qs['offset'](_0x536743[_0x0c20('0x37')][_0x0c20('0x1e')]);}return _0x2a7cf6[_0x0c20('0x48')](_0x1f29dd);}})['then'](function(_0x532bd5){if(_0x532bd5){return _0x532bd5?{'count':_0x170c83,'rows':_0x532bd5}:null;}})['then'](respondWithResult(_0x47363f,null))['catch'](handleError(_0x47363f,null));};exports[_0x0c20('0x4b')]=function(_0x5a77f3,_0x27c490,_0x306a85){var _0x4eccdf={};var _0x57d7d3={};var _0x38b951;var _0x5f47c6;return db[_0x0c20('0x2b')][_0x0c20('0x49')]({'where':{'id':_0x5a77f3[_0x0c20('0x44')]['id']}})['then'](handleEntityNotFound(_0x27c490,null))[_0x0c20('0x23')](function(_0x228896){if(_0x228896){_0x38b951=_0x228896;_0x57d7d3[_0x0c20('0x30')]=_['keys'](db[_0x0c20('0x4a')][_0x0c20('0x2c')]);_0x57d7d3[_0x0c20('0x37')]=_['keys'](_0x5a77f3[_0x0c20('0x37')]);_0x57d7d3[_0x0c20('0x32')]=_[_0x0c20('0x33')](_0x57d7d3[_0x0c20('0x30')],_0x57d7d3['query']);_0x4eccdf[_0x0c20('0x35')]=_[_0x0c20('0x33')](_0x57d7d3[_0x0c20('0x30')],qs[_0x0c20('0x34')](_0x5a77f3[_0x0c20('0x37')]['fields']));_0x4eccdf['attributes']=_0x4eccdf[_0x0c20('0x35')][_0x0c20('0x36')]?_0x4eccdf['attributes']:_0x57d7d3[_0x0c20('0x30')];_0x4eccdf['order']=qs['sort'](_0x5a77f3[_0x0c20('0x37')][_0x0c20('0x3a')]);_0x4eccdf[_0x0c20('0x3b')]=qs[_0x0c20('0x32')](_['pick'](_0x5a77f3['query'],_0x57d7d3[_0x0c20('0x32')]));if(_0x5a77f3[_0x0c20('0x37')][_0x0c20('0x3d')]){_0x4eccdf[_0x0c20('0x3b')]=_[_0x0c20('0x3e')](_0x4eccdf[_0x0c20('0x3b')],{'$or':_[_0x0c20('0x2a')](_0x4eccdf[_0x0c20('0x35')],function(_0x9e3508){var _0x9cc81a={};_0x9cc81a[_0x9e3508]={'$like':'%'+_0x5a77f3[_0x0c20('0x37')]['filter']+'%'};return _0x9cc81a;})});}_0x4eccdf=_[_0x0c20('0x3e')]({},_0x4eccdf,_0x5a77f3[_0x0c20('0x3f')]);return _0x38b951[_0x0c20('0x4b')](_0x4eccdf);}})[_0x0c20('0x23')](function(_0x5cbddd){if(_0x5cbddd){_0x5f47c6=_0x5cbddd[_0x0c20('0x36')];if(!_0x5a77f3[_0x0c20('0x37')][_0x0c20('0x4c')]('nolimit')){_0x4eccdf['limit']=qs[_0x0c20('0x1c')](_0x5a77f3[_0x0c20('0x37')][_0x0c20('0x1c')]);_0x4eccdf[_0x0c20('0x1e')]=qs[_0x0c20('0x1e')](_0x5a77f3[_0x0c20('0x37')][_0x0c20('0x1e')]);}return _0x38b951[_0x0c20('0x4b')](_0x4eccdf);}})[_0x0c20('0x23')](function(_0x3b5668){if(_0x3b5668){return _0x3b5668?{'count':_0x5f47c6,'rows':_0x3b5668}:null;}})[_0x0c20('0x23')](respondWithResult(_0x27c490,null))[_0x0c20('0x46')](handleError(_0x27c490,null));};exports['getDescriptions']=function(_0x52d7ad,_0x5567e0,_0x3cb545){var _0x1e8888={};var _0x22c422={};var _0x316ff8;var _0x484e9d;return db[_0x0c20('0x2b')][_0x0c20('0x49')]({'where':{'id':_0x52d7ad[_0x0c20('0x44')]['id']}})[_0x0c20('0x23')](handleEntityNotFound(_0x5567e0,null))['then'](function(_0x4e31b4){if(_0x4e31b4){_0x316ff8=_0x4e31b4;_0x22c422[_0x0c20('0x30')]=_[_0x0c20('0x31')](db['VtigerField']['rawAttributes']);_0x22c422[_0x0c20('0x37')]=_['keys'](_0x52d7ad[_0x0c20('0x37')]);_0x22c422[_0x0c20('0x32')]=_[_0x0c20('0x33')](_0x22c422[_0x0c20('0x30')],_0x22c422['query']);_0x1e8888[_0x0c20('0x35')]=_[_0x0c20('0x33')](_0x22c422['model'],qs['fields'](_0x52d7ad['query']['fields']));_0x1e8888['attributes']=_0x1e8888['attributes'][_0x0c20('0x36')]?_0x1e8888[_0x0c20('0x35')]:_0x22c422[_0x0c20('0x30')];_0x1e8888[_0x0c20('0x39')]=qs[_0x0c20('0x3a')](_0x52d7ad[_0x0c20('0x37')]['sort']);_0x1e8888[_0x0c20('0x3b')]=qs['filters'](_[_0x0c20('0x3c')](_0x52d7ad[_0x0c20('0x37')],_0x22c422[_0x0c20('0x32')]));if(_0x52d7ad['query']['filter']){_0x1e8888[_0x0c20('0x3b')]=_[_0x0c20('0x3e')](_0x1e8888[_0x0c20('0x3b')],{'$or':_[_0x0c20('0x2a')](_0x1e8888[_0x0c20('0x35')],function(_0x199abe){var _0x152d81={};_0x152d81[_0x199abe]={'$like':'%'+_0x52d7ad[_0x0c20('0x37')]['filter']+'%'};return _0x152d81;})});}_0x1e8888=_[_0x0c20('0x3e')]({},_0x1e8888,_0x52d7ad[_0x0c20('0x3f')]);return _0x316ff8[_0x0c20('0x4d')](_0x1e8888);}})[_0x0c20('0x23')](function(_0x2c01dd){if(_0x2c01dd){_0x484e9d=_0x2c01dd[_0x0c20('0x36')];if(!_0x52d7ad[_0x0c20('0x37')][_0x0c20('0x4c')](_0x0c20('0x38'))){_0x1e8888[_0x0c20('0x1c')]=qs['limit'](_0x52d7ad[_0x0c20('0x37')]['limit']);_0x1e8888[_0x0c20('0x1e')]=qs['offset'](_0x52d7ad[_0x0c20('0x37')][_0x0c20('0x1e')]);}return _0x316ff8[_0x0c20('0x4d')](_0x1e8888);}})[_0x0c20('0x23')](function(_0x37098c){if(_0x37098c){return _0x37098c?{'count':_0x484e9d,'rows':_0x37098c}:null;}})[_0x0c20('0x23')](respondWithResult(_0x5567e0,null))[_0x0c20('0x46')](handleError(_0x5567e0,null));}; \ No newline at end of file +var _0xee22=['undefined','count','limit','set','Content-Range','apply','reject','update','then','sendStatus','error','stack','name','send','index','map','VtigerConfiguration','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','params','include','find','catch','create','body','destroy','getFields','findOne','VtigerField','getSubjects','length','nolimit','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset'];(function(_0x17406a,_0x1e2320){var _0x1501ff=function(_0x4b075a){while(--_0x4b075a){_0x17406a['push'](_0x17406a['shift']());}};_0x1501ff(++_0x1e2320);}(_0xee22,0x8a));var _0x2ee2=function(_0x2ac4af,_0x288c53){_0x2ac4af=_0x2ac4af-0x0;var _0x3a36df=_0xee22[_0x2ac4af];return _0x3a36df;};'use strict';var emlformat=require(_0x2ee2('0x0'));var rimraf=require(_0x2ee2('0x1'));var zipdir=require(_0x2ee2('0x2'));var jsonpatch=require(_0x2ee2('0x3'));var rp=require(_0x2ee2('0x4'));var moment=require('moment');var BPromise=require(_0x2ee2('0x5'));var Mustache=require(_0x2ee2('0x6'));var util=require(_0x2ee2('0x7'));var path=require(_0x2ee2('0x8'));var sox=require(_0x2ee2('0x9'));var csv=require(_0x2ee2('0xa'));var ejs=require(_0x2ee2('0xb'));var fs=require('fs');var fs_extra=require(_0x2ee2('0xc'));var _=require(_0x2ee2('0xd'));var squel=require(_0x2ee2('0xe'));var crypto=require(_0x2ee2('0xf'));var jsforce=require(_0x2ee2('0x10'));var deskjs=require(_0x2ee2('0x11'));var toCsv=require('to-csv');var querystring=require(_0x2ee2('0x12'));var Papa=require('papaparse');var Redis=require(_0x2ee2('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x2ee2('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2ee2('0x15'));var logger=require(_0x2ee2('0x16'))(_0x2ee2('0x17'));var utils=require(_0x2ee2('0x18'));var config=require(_0x2ee2('0x19'));var licenseUtil=require(_0x2ee2('0x1a'));var db=require(_0x2ee2('0x1b'))['db'];function respondWithStatusCode(_0x2e249b,_0x1b2012){_0x1b2012=_0x1b2012||0xcc;return function(_0x355774){if(_0x355774){return _0x2e249b['sendStatus'](_0x1b2012);}return _0x2e249b[_0x2ee2('0x1c')](_0x1b2012)[_0x2ee2('0x1d')]();};}function respondWithResult(_0x4c07af,_0x1305e7){_0x1305e7=_0x1305e7||0xc8;return function(_0x2e7821){if(_0x2e7821){return _0x4c07af[_0x2ee2('0x1c')](_0x1305e7)[_0x2ee2('0x1e')](_0x2e7821);}};}function respondWithFilteredResult(_0x10e08a,_0x17d3fe){return function(_0x38c88a){if(_0x38c88a){var _0x475645=typeof _0x17d3fe[_0x2ee2('0x1f')]===_0x2ee2('0x20')&&typeof _0x17d3fe['limit']===_0x2ee2('0x20');var _0x420776=_0x38c88a['count'];var _0x2c5de1=_0x475645?0x0:_0x17d3fe[_0x2ee2('0x1f')];var _0x20dca2=_0x475645?_0x38c88a[_0x2ee2('0x21')]:_0x17d3fe[_0x2ee2('0x1f')]+_0x17d3fe[_0x2ee2('0x22')];var _0x2331b3;if(_0x20dca2>=_0x420776){_0x20dca2=_0x420776;_0x2331b3=0xc8;}else{_0x2331b3=0xce;}_0x10e08a['status'](_0x2331b3);return _0x10e08a[_0x2ee2('0x23')](_0x2ee2('0x24'),_0x2c5de1+'-'+_0x20dca2+'/'+_0x420776)[_0x2ee2('0x1e')](_0x38c88a);}return null;};}function patchUpdates(_0x3227d6){return function(_0x5096c1){try{jsonpatch[_0x2ee2('0x25')](_0x5096c1,_0x3227d6,!![]);}catch(_0x512741){return BPromise[_0x2ee2('0x26')](_0x512741);}return _0x5096c1['save']();};}function saveUpdates(_0x401051,_0x494de5){return function(_0x3f6f2b){if(_0x3f6f2b){return _0x3f6f2b[_0x2ee2('0x27')](_0x401051)[_0x2ee2('0x28')](function(_0x13468b){return _0x13468b;});}return null;};}function removeEntity(_0x378095,_0x388aea){return function(_0x559b41){if(_0x559b41){return _0x559b41['destroy']()['then'](function(){_0x378095[_0x2ee2('0x1c')](0xcc)[_0x2ee2('0x1d')]();});}};}function handleEntityNotFound(_0xa684f3,_0x234cd6){return function(_0x7fc9e3){if(!_0x7fc9e3){_0xa684f3[_0x2ee2('0x29')](0x194);}return _0x7fc9e3;};}function handleError(_0x24fc4a,_0x4430d7){_0x4430d7=_0x4430d7||0x1f4;return function(_0x412a83){logger[_0x2ee2('0x2a')](_0x412a83[_0x2ee2('0x2b')]);if(_0x412a83[_0x2ee2('0x2c')]){delete _0x412a83['name'];}_0x24fc4a[_0x2ee2('0x1c')](_0x4430d7)[_0x2ee2('0x2d')](_0x412a83);};}exports[_0x2ee2('0x2e')]=function(_0x2545ab,_0x3c750){var _0x303601={},_0x21ac10={},_0x1b5a0a={'count':0x0,'rows':[]};var _0x2e2b54=_[_0x2ee2('0x2f')](db[_0x2ee2('0x30')][_0x2ee2('0x31')],function(_0x50bc02){return{'name':_0x50bc02[_0x2ee2('0x32')],'type':_0x50bc02[_0x2ee2('0x33')][_0x2ee2('0x34')]};});_0x21ac10[_0x2ee2('0x35')]=_[_0x2ee2('0x2f')](_0x2e2b54,'name');_0x21ac10['query']=_[_0x2ee2('0x36')](_0x2545ab[_0x2ee2('0x37')]);_0x21ac10[_0x2ee2('0x38')]=_[_0x2ee2('0x39')](_0x21ac10['model'],_0x21ac10[_0x2ee2('0x37')]);_0x303601[_0x2ee2('0x3a')]=_['intersection'](_0x21ac10['model'],qs[_0x2ee2('0x3b')](_0x2545ab[_0x2ee2('0x37')][_0x2ee2('0x3b')]));_0x303601[_0x2ee2('0x3a')]=_0x303601[_0x2ee2('0x3a')]['length']?_0x303601[_0x2ee2('0x3a')]:_0x21ac10['model'];if(!_0x2545ab['query'][_0x2ee2('0x3c')]('nolimit')){_0x303601[_0x2ee2('0x22')]=qs[_0x2ee2('0x22')](_0x2545ab[_0x2ee2('0x37')]['limit']);_0x303601[_0x2ee2('0x1f')]=qs[_0x2ee2('0x1f')](_0x2545ab[_0x2ee2('0x37')]['offset']);}_0x303601[_0x2ee2('0x3d')]=qs[_0x2ee2('0x3e')](_0x2545ab[_0x2ee2('0x37')][_0x2ee2('0x3e')]);_0x303601[_0x2ee2('0x3f')]=qs[_0x2ee2('0x38')](_[_0x2ee2('0x40')](_0x2545ab['query'],_0x21ac10[_0x2ee2('0x38')]),_0x2e2b54);if(_0x2545ab[_0x2ee2('0x37')][_0x2ee2('0x41')]){_0x303601[_0x2ee2('0x3f')]=_[_0x2ee2('0x42')](_0x303601[_0x2ee2('0x3f')],{'$or':_['map'](_0x2e2b54,function(_0x44c25b){if(_0x44c25b[_0x2ee2('0x33')]!==_0x2ee2('0x43')){var _0x44dfe6={};_0x44dfe6[_0x44c25b['name']]={'$like':'%'+_0x2545ab[_0x2ee2('0x37')][_0x2ee2('0x41')]+'%'};return _0x44dfe6;}})});}_0x303601=_[_0x2ee2('0x42')]({},_0x303601,_0x2545ab[_0x2ee2('0x44')]);var _0x36da79={'where':_0x303601[_0x2ee2('0x3f')]};return db[_0x2ee2('0x30')]['count'](_0x36da79)['then'](function(_0x594a26){_0x1b5a0a[_0x2ee2('0x21')]=_0x594a26;if(_0x2545ab[_0x2ee2('0x37')][_0x2ee2('0x45')]){_0x303601['include']=[{'all':!![]}];}return db['VtigerConfiguration']['findAll'](_0x303601);})[_0x2ee2('0x28')](function(_0x3f6e04){_0x1b5a0a[_0x2ee2('0x46')]=_0x3f6e04;return _0x1b5a0a;})[_0x2ee2('0x28')](respondWithFilteredResult(_0x3c750,_0x303601))['catch'](handleError(_0x3c750,null));};exports['show']=function(_0x4017fd,_0x1ed357){var _0x4dbe63={'raw':![],'where':{'id':_0x4017fd[_0x2ee2('0x47')]['id']}},_0x302898={};_0x302898[_0x2ee2('0x35')]=_[_0x2ee2('0x36')](db['VtigerConfiguration'][_0x2ee2('0x31')]);_0x302898['query']=_[_0x2ee2('0x36')](_0x4017fd['query']);_0x302898[_0x2ee2('0x38')]=_['intersection'](_0x302898[_0x2ee2('0x35')],_0x302898[_0x2ee2('0x37')]);_0x4dbe63[_0x2ee2('0x3a')]=_['intersection'](_0x302898[_0x2ee2('0x35')],qs[_0x2ee2('0x3b')](_0x4017fd[_0x2ee2('0x37')][_0x2ee2('0x3b')]));_0x4dbe63[_0x2ee2('0x3a')]=_0x4dbe63['attributes']['length']?_0x4dbe63['attributes']:_0x302898[_0x2ee2('0x35')];if(_0x4017fd[_0x2ee2('0x37')][_0x2ee2('0x45')]){_0x4dbe63[_0x2ee2('0x48')]=[{'all':!![]}];}_0x4dbe63=_[_0x2ee2('0x42')]({},_0x4dbe63,_0x4017fd[_0x2ee2('0x44')]);return db[_0x2ee2('0x30')][_0x2ee2('0x49')](_0x4dbe63)['then'](handleEntityNotFound(_0x1ed357,null))['then'](respondWithResult(_0x1ed357,null))[_0x2ee2('0x4a')](handleError(_0x1ed357,null));};exports['create']=function(_0x5dc7df,_0x3aac1b){return db[_0x2ee2('0x30')][_0x2ee2('0x4b')](_0x5dc7df[_0x2ee2('0x4c')],{})[_0x2ee2('0x28')](respondWithResult(_0x3aac1b,0xc9))[_0x2ee2('0x4a')](handleError(_0x3aac1b,null));};exports[_0x2ee2('0x27')]=function(_0x2a8762,_0x53f237){if(_0x2a8762[_0x2ee2('0x4c')]['id']){delete _0x2a8762['body']['id'];}return db['VtigerConfiguration'][_0x2ee2('0x49')]({'where':{'id':_0x2a8762[_0x2ee2('0x47')]['id']}})['then'](handleEntityNotFound(_0x53f237,null))['then'](saveUpdates(_0x2a8762[_0x2ee2('0x4c')],null))[_0x2ee2('0x28')](respondWithResult(_0x53f237,null))[_0x2ee2('0x4a')](handleError(_0x53f237,null));};exports[_0x2ee2('0x4d')]=function(_0x395f78,_0x528343){return db[_0x2ee2('0x30')][_0x2ee2('0x49')]({'where':{'id':_0x395f78[_0x2ee2('0x47')]['id']}})[_0x2ee2('0x28')](handleEntityNotFound(_0x528343,null))[_0x2ee2('0x28')](removeEntity(_0x528343,null))[_0x2ee2('0x4a')](handleError(_0x528343,null));};exports[_0x2ee2('0x4e')]=function(_0x58d32c,_0x2439eb,_0x5dc497){var _0x1e026a={};var _0x4c51a0={};var _0x20e45e;var _0x2dbf8c;return db['VtigerConfiguration'][_0x2ee2('0x4f')]({'where':{'id':_0x58d32c[_0x2ee2('0x47')]['id']}})[_0x2ee2('0x28')](handleEntityNotFound(_0x2439eb,null))[_0x2ee2('0x28')](function(_0xdc06ab){if(_0xdc06ab){_0x20e45e=_0xdc06ab;_0x4c51a0[_0x2ee2('0x35')]=_[_0x2ee2('0x36')](db[_0x2ee2('0x50')]['rawAttributes']);_0x4c51a0['query']=_[_0x2ee2('0x36')](_0x58d32c[_0x2ee2('0x37')]);_0x4c51a0[_0x2ee2('0x38')]=_[_0x2ee2('0x39')](_0x4c51a0[_0x2ee2('0x35')],_0x4c51a0['query']);_0x1e026a[_0x2ee2('0x3a')]=_[_0x2ee2('0x39')](_0x4c51a0['model'],qs[_0x2ee2('0x3b')](_0x58d32c[_0x2ee2('0x37')][_0x2ee2('0x3b')]));_0x1e026a['attributes']=_0x1e026a[_0x2ee2('0x3a')]['length']?_0x1e026a['attributes']:_0x4c51a0[_0x2ee2('0x35')];_0x1e026a[_0x2ee2('0x3d')]=qs[_0x2ee2('0x3e')](_0x58d32c['query'][_0x2ee2('0x3e')]);_0x1e026a['where']=qs[_0x2ee2('0x38')](_[_0x2ee2('0x40')](_0x58d32c[_0x2ee2('0x37')],_0x4c51a0[_0x2ee2('0x38')]));if(_0x58d32c['query'][_0x2ee2('0x41')]){_0x1e026a['where']=_[_0x2ee2('0x42')](_0x1e026a['where'],{'$or':_[_0x2ee2('0x2f')](_0x1e026a['attributes'],function(_0x5f2845){var _0x2b04d2={};_0x2b04d2[_0x5f2845]={'$like':'%'+_0x58d32c['query'][_0x2ee2('0x41')]+'%'};return _0x2b04d2;})});}_0x1e026a=_[_0x2ee2('0x42')]({},_0x1e026a,_0x58d32c['options']);return _0x20e45e['getFields'](_0x1e026a);}})[_0x2ee2('0x28')](function(_0x541d13){if(_0x541d13){_0x2dbf8c=_0x541d13['length'];if(!_0x58d32c[_0x2ee2('0x37')][_0x2ee2('0x3c')]('nolimit')){_0x1e026a['limit']=qs[_0x2ee2('0x22')](_0x58d32c['query'][_0x2ee2('0x22')]);_0x1e026a['offset']=qs[_0x2ee2('0x1f')](_0x58d32c[_0x2ee2('0x37')][_0x2ee2('0x1f')]);}return _0x20e45e['getFields'](_0x1e026a);}})['then'](function(_0x5ebf34){if(_0x5ebf34){return _0x5ebf34?{'count':_0x2dbf8c,'rows':_0x5ebf34}:null;}})['then'](respondWithResult(_0x2439eb,null))['catch'](handleError(_0x2439eb,null));};exports[_0x2ee2('0x51')]=function(_0x2cfc71,_0xc7f76a,_0xd00727){var _0x9d0f3b={};var _0x3bc56a={};var _0x495f42;var _0x1235e2;return db[_0x2ee2('0x30')][_0x2ee2('0x4f')]({'where':{'id':_0x2cfc71[_0x2ee2('0x47')]['id']}})[_0x2ee2('0x28')](handleEntityNotFound(_0xc7f76a,null))[_0x2ee2('0x28')](function(_0x1b9507){if(_0x1b9507){_0x495f42=_0x1b9507;_0x3bc56a[_0x2ee2('0x35')]=_[_0x2ee2('0x36')](db[_0x2ee2('0x50')][_0x2ee2('0x31')]);_0x3bc56a[_0x2ee2('0x37')]=_['keys'](_0x2cfc71[_0x2ee2('0x37')]);_0x3bc56a[_0x2ee2('0x38')]=_['intersection'](_0x3bc56a[_0x2ee2('0x35')],_0x3bc56a[_0x2ee2('0x37')]);_0x9d0f3b['attributes']=_['intersection'](_0x3bc56a[_0x2ee2('0x35')],qs[_0x2ee2('0x3b')](_0x2cfc71['query'][_0x2ee2('0x3b')]));_0x9d0f3b[_0x2ee2('0x3a')]=_0x9d0f3b['attributes'][_0x2ee2('0x52')]?_0x9d0f3b[_0x2ee2('0x3a')]:_0x3bc56a[_0x2ee2('0x35')];_0x9d0f3b[_0x2ee2('0x3d')]=qs[_0x2ee2('0x3e')](_0x2cfc71[_0x2ee2('0x37')][_0x2ee2('0x3e')]);_0x9d0f3b[_0x2ee2('0x3f')]=qs['filters'](_[_0x2ee2('0x40')](_0x2cfc71[_0x2ee2('0x37')],_0x3bc56a[_0x2ee2('0x38')]));if(_0x2cfc71[_0x2ee2('0x37')][_0x2ee2('0x41')]){_0x9d0f3b['where']=_[_0x2ee2('0x42')](_0x9d0f3b[_0x2ee2('0x3f')],{'$or':_[_0x2ee2('0x2f')](_0x9d0f3b[_0x2ee2('0x3a')],function(_0x2460ae){var _0x514e98={};_0x514e98[_0x2460ae]={'$like':'%'+_0x2cfc71[_0x2ee2('0x37')][_0x2ee2('0x41')]+'%'};return _0x514e98;})});}_0x9d0f3b=_[_0x2ee2('0x42')]({},_0x9d0f3b,_0x2cfc71[_0x2ee2('0x44')]);return _0x495f42[_0x2ee2('0x51')](_0x9d0f3b);}})[_0x2ee2('0x28')](function(_0x27fe4a){if(_0x27fe4a){_0x1235e2=_0x27fe4a[_0x2ee2('0x52')];if(!_0x2cfc71['query'][_0x2ee2('0x3c')](_0x2ee2('0x53'))){_0x9d0f3b[_0x2ee2('0x22')]=qs['limit'](_0x2cfc71[_0x2ee2('0x37')]['limit']);_0x9d0f3b[_0x2ee2('0x1f')]=qs[_0x2ee2('0x1f')](_0x2cfc71['query'][_0x2ee2('0x1f')]);}return _0x495f42[_0x2ee2('0x51')](_0x9d0f3b);}})[_0x2ee2('0x28')](function(_0x4b463e){if(_0x4b463e){return _0x4b463e?{'count':_0x1235e2,'rows':_0x4b463e}:null;}})[_0x2ee2('0x28')](respondWithResult(_0xc7f76a,null))['catch'](handleError(_0xc7f76a,null));};exports[_0x2ee2('0x54')]=function(_0x32f29e,_0x19a0a5,_0x176471){var _0x42bf1e={};var _0x3d347a={};var _0x56055f;var _0x575c00;return db[_0x2ee2('0x30')]['findOne']({'where':{'id':_0x32f29e[_0x2ee2('0x47')]['id']}})[_0x2ee2('0x28')](handleEntityNotFound(_0x19a0a5,null))['then'](function(_0x42b614){if(_0x42b614){_0x56055f=_0x42b614;_0x3d347a[_0x2ee2('0x35')]=_['keys'](db[_0x2ee2('0x50')]['rawAttributes']);_0x3d347a[_0x2ee2('0x37')]=_[_0x2ee2('0x36')](_0x32f29e[_0x2ee2('0x37')]);_0x3d347a['filters']=_[_0x2ee2('0x39')](_0x3d347a[_0x2ee2('0x35')],_0x3d347a[_0x2ee2('0x37')]);_0x42bf1e['attributes']=_[_0x2ee2('0x39')](_0x3d347a['model'],qs[_0x2ee2('0x3b')](_0x32f29e[_0x2ee2('0x37')][_0x2ee2('0x3b')]));_0x42bf1e[_0x2ee2('0x3a')]=_0x42bf1e[_0x2ee2('0x3a')][_0x2ee2('0x52')]?_0x42bf1e[_0x2ee2('0x3a')]:_0x3d347a[_0x2ee2('0x35')];_0x42bf1e[_0x2ee2('0x3d')]=qs[_0x2ee2('0x3e')](_0x32f29e[_0x2ee2('0x37')][_0x2ee2('0x3e')]);_0x42bf1e[_0x2ee2('0x3f')]=qs[_0x2ee2('0x38')](_[_0x2ee2('0x40')](_0x32f29e[_0x2ee2('0x37')],_0x3d347a['filters']));if(_0x32f29e[_0x2ee2('0x37')][_0x2ee2('0x41')]){_0x42bf1e['where']=_[_0x2ee2('0x42')](_0x42bf1e[_0x2ee2('0x3f')],{'$or':_[_0x2ee2('0x2f')](_0x42bf1e[_0x2ee2('0x3a')],function(_0x402510){var _0x485dbb={};_0x485dbb[_0x402510]={'$like':'%'+_0x32f29e['query']['filter']+'%'};return _0x485dbb;})});}_0x42bf1e=_[_0x2ee2('0x42')]({},_0x42bf1e,_0x32f29e[_0x2ee2('0x44')]);return _0x56055f['getDescriptions'](_0x42bf1e);}})[_0x2ee2('0x28')](function(_0x5a3432){if(_0x5a3432){_0x575c00=_0x5a3432[_0x2ee2('0x52')];if(!_0x32f29e[_0x2ee2('0x37')][_0x2ee2('0x3c')](_0x2ee2('0x53'))){_0x42bf1e['limit']=qs[_0x2ee2('0x22')](_0x32f29e[_0x2ee2('0x37')]['limit']);_0x42bf1e['offset']=qs[_0x2ee2('0x1f')](_0x32f29e[_0x2ee2('0x37')][_0x2ee2('0x1f')]);}return _0x56055f[_0x2ee2('0x54')](_0x42bf1e);}})[_0x2ee2('0x28')](function(_0x4ec95d){if(_0x4ec95d){return _0x4ec95d?{'count':_0x575c00,'rows':_0x4ec95d}:null;}})[_0x2ee2('0x28')](respondWithResult(_0x19a0a5,null))[_0x2ee2('0x4a')](handleError(_0x19a0a5,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index cee3683..3e449af 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 _0x4071=['exports','define','VtigerConfiguration','int_vtiger_configurations','lodash','util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./intVtigerConfiguration.attributes'];(function(_0x2cf9b3,_0x4463c1){var _0x54f6ca=function(_0x556579){while(--_0x556579){_0x2cf9b3['push'](_0x2cf9b3['shift']());}};_0x54f6ca(++_0x4463c1);}(_0x4071,0xc4));var _0x1407=function(_0x3717b6,_0x39e18c){_0x3717b6=_0x3717b6-0x0;var _0x3b3e6a=_0x4071[_0x3717b6];return _0x3b3e6a;};'use strict';var _=require(_0x1407('0x0'));var util=require(_0x1407('0x1'));var logger=require(_0x1407('0x2'))('api');var moment=require('moment');var BPromise=require(_0x1407('0x3'));var rp=require(_0x1407('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1407('0x5'));var config=require(_0x1407('0x6'));var attributes=require(_0x1407('0x7'));module[_0x1407('0x8')]=function(_0x303be8,_0x219653){return _0x303be8[_0x1407('0x9')](_0x1407('0xa'),attributes,{'tableName':_0x1407('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb470=['bluebird','request-promise','rimraf','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','lodash','../../config/logger','api','moment'];(function(_0x1a37e3,_0x5db8f6){var _0x4db78a=function(_0x15e6c1){while(--_0x15e6c1){_0x1a37e3['push'](_0x1a37e3['shift']());}};_0x4db78a(++_0x5db8f6);}(_0xb470,0xa1));var _0x0b47=function(_0x16ad3a,_0x5d50fc){_0x16ad3a=_0x16ad3a-0x0;var _0x69bf88=_0xb470[_0x16ad3a];return _0x69bf88;};'use strict';var _=require(_0x0b47('0x0'));var util=require('util');var logger=require(_0x0b47('0x1'))(_0x0b47('0x2'));var moment=require(_0x0b47('0x3'));var BPromise=require(_0x0b47('0x4'));var rp=require(_0x0b47('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0b47('0x6'));var config=require('../../config/environment');var attributes=require(_0x0b47('0x7'));module[_0x0b47('0x8')]=function(_0x1711e9,_0x460849){return _0x1711e9[_0x0b47('0x9')](_0x0b47('0xa'),attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index 74b425c..fb1a8ab 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 _0xa291=['util','moment','randomstring','../../config/utils','jayson/promise','request','VtigerConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','catch','lodash'];(function(_0x2b3073,_0x434646){var _0x343f69=function(_0x133b71){while(--_0x133b71){_0x2b3073['push'](_0x2b3073['shift']());}};_0x343f69(++_0x434646);}(_0xa291,0xba));var _0x1a29=function(_0x1af0e5,_0x152990){_0x1af0e5=_0x1af0e5-0x0;var _0x3c444a=_0xa291[_0x1af0e5];return _0x3c444a;};'use strict';var _=require(_0x1a29('0x0'));var util=require(_0x1a29('0x1'));var moment=require(_0x1a29('0x2'));var BPromise=require('bluebird');var rs=require(_0x1a29('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1a29('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x1a29('0x5'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x372da9,_0x27ca22,_0x19fd10){return new BPromise(function(_0x5c01fc,_0x5ac1cb){return client[_0x1a29('0x6')](_0x372da9,_0x19fd10)['then'](function(_0x11cfc2){logger['info'](_0x1a29('0x7'),_0x27ca22,'request\x20sent');logger[_0x1a29('0x8')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x27ca22,_0x1a29('0x9'),JSON[_0x1a29('0xa')](_0x11cfc2));if(_0x11cfc2[_0x1a29('0xb')]){if(_0x11cfc2[_0x1a29('0xb')][_0x1a29('0xc')]===0x1f4){logger['error'](_0x1a29('0x7'),_0x27ca22,_0x11cfc2[_0x1a29('0xb')][_0x1a29('0xd')]);return _0x5ac1cb(_0x11cfc2[_0x1a29('0xb')]['message']);}logger['error'](_0x1a29('0x7'),_0x27ca22,_0x11cfc2[_0x1a29('0xb')][_0x1a29('0xd')]);return _0x5c01fc(_0x11cfc2[_0x1a29('0xb')][_0x1a29('0xd')]);}else{logger[_0x1a29('0xe')](_0x1a29('0x7'),_0x27ca22,_0x1a29('0x9'));_0x5c01fc(_0x11cfc2[_0x1a29('0xf')][_0x1a29('0xd')]);}})[_0x1a29('0x10')](function(_0x1654fd){logger['error'](_0x1a29('0x7'),_0x27ca22,_0x1654fd);_0x5ac1cb(_0x1654fd);});});} \ No newline at end of file +var _0x8368=['then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x4bacb6,_0x2b299d){var _0x58c029=function(_0x2faaf5){while(--_0x2faaf5){_0x4bacb6['push'](_0x4bacb6['shift']());}};_0x58c029(++_0x2b299d);}(_0x8368,0x144));var _0x8836=function(_0x23e94e,_0x5b2cea){_0x23e94e=_0x23e94e-0x0;var _0x1d3c05=_0x8368[_0x23e94e];return _0x1d3c05;};'use strict';var _=require(_0x8836('0x0'));var util=require(_0x8836('0x1'));var moment=require(_0x8836('0x2'));var BPromise=require(_0x8836('0x3'));var rs=require(_0x8836('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8836('0x5'))['db'];var utils=require(_0x8836('0x6'));var logger=require('../../config/logger')(_0x8836('0x7'));var config=require(_0x8836('0x8'));var jayson=require(_0x8836('0x9'));var client=jayson['client'][_0x8836('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1bcb32,_0x372dc2,_0x465040){return new BPromise(function(_0x190f5d,_0x2f8d53){return client[_0x8836('0xb')](_0x1bcb32,_0x465040)[_0x8836('0xc')](function(_0x2320ee){logger[_0x8836('0xd')](_0x8836('0xe'),_0x372dc2,_0x8836('0xf'));logger[_0x8836('0x10')](_0x8836('0x11'),_0x372dc2,_0x8836('0xf'),JSON[_0x8836('0x12')](_0x2320ee));if(_0x2320ee[_0x8836('0x13')]){if(_0x2320ee[_0x8836('0x13')][_0x8836('0x14')]===0x1f4){logger[_0x8836('0x13')](_0x8836('0xe'),_0x372dc2,_0x2320ee[_0x8836('0x13')][_0x8836('0x15')]);return _0x2f8d53(_0x2320ee['error'][_0x8836('0x15')]);}logger[_0x8836('0x13')](_0x8836('0xe'),_0x372dc2,_0x2320ee[_0x8836('0x13')]['message']);return _0x190f5d(_0x2320ee[_0x8836('0x13')][_0x8836('0x15')]);}else{logger['info'](_0x8836('0xe'),_0x372dc2,_0x8836('0xf'));_0x190f5d(_0x2320ee[_0x8836('0x16')]['message']);}})[_0x8836('0x17')](function(_0x4c5036){logger[_0x8836('0x13')](_0x8836('0xe'),_0x372dc2,_0x4c5036);_0x2f8d53(_0x4c5036);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 4e4f578..8d0757f 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 _0xfea0=['multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfea0,0xe4));var _0x0fea=function(_0x509bb9,_0x494317){_0x509bb9=_0x509bb9-0x0;var _0x5c2eb8=_0xfea0[_0x509bb9];return _0x5c2eb8;};'use strict';var multer=require(_0x0fea('0x0'));var util=require('util');var path=require(_0x0fea('0x1'));var timeout=require(_0x0fea('0x2'));var express=require(_0x0fea('0x3'));var router=express[_0x0fea('0x4')]();var fs_extra=require(_0x0fea('0x5'));var auth=require(_0x0fea('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intVtigerField.controller');router[_0x0fea('0x7')]('/',auth[_0x0fea('0x8')](),controller[_0x0fea('0x9')]);router[_0x0fea('0x7')](_0x0fea('0xa'),auth['isAuthenticated'](),controller[_0x0fea('0xb')]);router[_0x0fea('0xc')]('/',auth[_0x0fea('0x8')](),controller[_0x0fea('0xd')]);router[_0x0fea('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x0fea('0xf')]);router[_0x0fea('0x10')](_0x0fea('0xa'),auth['isAuthenticated'](),controller[_0x0fea('0x11')]);module[_0x0fea('0x12')]=router; \ No newline at end of file +var _0x99bf=['../../components/interaction/service','../../config/environment','./intVtigerField.controller','isAuthenticated','index','get','/:id','show','post','create','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x19ac6e,_0x435862){var _0x1cdcf3=function(_0x23151c){while(--_0x23151c){_0x19ac6e['push'](_0x19ac6e['shift']());}};_0x1cdcf3(++_0x435862);}(_0x99bf,0x85));var _0xf99b=function(_0x133ee2,_0x1365ff){_0x133ee2=_0x133ee2-0x0;var _0x28e86f=_0x99bf[_0x133ee2];return _0x28e86f;};'use strict';var multer=require(_0xf99b('0x0'));var util=require(_0xf99b('0x1'));var path=require(_0xf99b('0x2'));var timeout=require(_0xf99b('0x3'));var express=require(_0xf99b('0x4'));var router=express['Router']();var fs_extra=require(_0xf99b('0x5'));var auth=require(_0xf99b('0x6'));var interaction=require(_0xf99b('0x7'));var config=require(_0xf99b('0x8'));var controller=require(_0xf99b('0x9'));router['get']('/',auth[_0xf99b('0xa')](),controller[_0xf99b('0xb')]);router[_0xf99b('0xc')](_0xf99b('0xd'),auth[_0xf99b('0xa')](),controller[_0xf99b('0xe')]);router[_0xf99b('0xf')]('/',auth[_0xf99b('0xa')](),controller[_0xf99b('0x10')]);router['put'](_0xf99b('0xd'),auth[_0xf99b('0xa')](),controller[_0xf99b('0x11')]);router[_0xf99b('0x12')](_0xf99b('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xf99b('0x13')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 615242a..225d172 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 _0xe02e=['exports','ENUM','keyValue','picklist','string','STRING','sequelize'];(function(_0x3ba907,_0x5197f3){var _0x25518d=function(_0x211f26){while(--_0x211f26){_0x3ba907['push'](_0x3ba907['shift']());}};_0x25518d(++_0x5197f3);}(_0xe02e,0x148));var _0xee02=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xe02e[_0x29b609];return _0x54c952;};'use strict';var Sequelize=require(_0xee02('0x0'));module[_0xee02('0x1')]={'type':{'type':Sequelize[_0xee02('0x2')]('string','variable','customVariable',_0xee02('0x3'),_0xee02('0x4')),'defaultValue':_0xee02('0x5')},'content':{'type':Sequelize[_0xee02('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xee02('0x2')](_0xee02('0x5'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0xee02('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xee02('0x6')]}}; \ No newline at end of file +var _0x016f=['sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x580fb0,_0x2a5456){var _0x2cd452=function(_0x53005a){while(--_0x53005a){_0x580fb0['push'](_0x580fb0['shift']());}};_0x2cd452(++_0x2a5456);}(_0x016f,0x1b9));var _0xf016=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x016f[_0x2b4411];return _0x8e41ef;};'use strict';var Sequelize=require(_0xf016('0x0'));module[_0xf016('0x1')]={'type':{'type':Sequelize[_0xf016('0x2')](_0xf016('0x3'),_0xf016('0x4'),_0xf016('0x5'),_0xf016('0x6'),_0xf016('0x7')),'defaultValue':_0xf016('0x3')},'content':{'type':Sequelize[_0xf016('0x8')]},'key':{'type':Sequelize[_0xf016('0x8')]},'keyType':{'type':Sequelize['ENUM'](_0xf016('0x3'),_0xf016('0x4'),_0xf016('0x5'))},'keyContent':{'type':Sequelize[_0xf016('0x8')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xf016('0x8')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf016('0x8')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 9755f57..4bedd50 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 _0x3647=['merge','VIRTUAL','options','findAll','catch','show','params','includeAll','include','find','body','destroy','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','error','name','send','index','VtigerField','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter'];(function(_0x1f1a50,_0x1d4fb0){var _0x414118=function(_0xbd57b8){while(--_0xbd57b8){_0x1f1a50['push'](_0x1f1a50['shift']());}};_0x414118(++_0x1d4fb0);}(_0x3647,0x17e));var _0x7364=function(_0x356a25,_0x42833d){_0x356a25=_0x356a25-0x0;var _0xedb710=_0x3647[_0x356a25];return _0xedb710;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7364('0x0'));var zipdir=require(_0x7364('0x1'));var jsonpatch=require(_0x7364('0x2'));var rp=require(_0x7364('0x3'));var moment=require('moment');var BPromise=require(_0x7364('0x4'));var Mustache=require(_0x7364('0x5'));var util=require(_0x7364('0x6'));var path=require(_0x7364('0x7'));var sox=require(_0x7364('0x8'));var csv=require(_0x7364('0x9'));var ejs=require(_0x7364('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7364('0xb'));var squel=require(_0x7364('0xc'));var crypto=require(_0x7364('0xd'));var jsforce=require(_0x7364('0xe'));var deskjs=require(_0x7364('0xf'));var toCsv=require(_0x7364('0x9'));var querystring=require(_0x7364('0x10'));var Papa=require(_0x7364('0x11'));var Redis=require(_0x7364('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7364('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x7364('0x14'));var config=require(_0x7364('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x7364('0x16'))['db'];function respondWithStatusCode(_0x1274a7,_0x3d2348){_0x3d2348=_0x3d2348||0xcc;return function(_0x2da62d){if(_0x2da62d){return _0x1274a7[_0x7364('0x17')](_0x3d2348);}return _0x1274a7[_0x7364('0x18')](_0x3d2348)[_0x7364('0x19')]();};}function respondWithResult(_0x3dfcc6,_0x910417){_0x910417=_0x910417||0xc8;return function(_0x59cca2){if(_0x59cca2){return _0x3dfcc6[_0x7364('0x18')](_0x910417)['json'](_0x59cca2);}};}function respondWithFilteredResult(_0x3058fa,_0x2392d2){return function(_0x5003d4){if(_0x5003d4){var _0x54c492=typeof _0x2392d2['offset']===_0x7364('0x1a')&&typeof _0x2392d2['limit']===_0x7364('0x1a');var _0x292732=_0x5003d4[_0x7364('0x1b')];var _0x2d388f=_0x54c492?0x0:_0x2392d2[_0x7364('0x1c')];var _0x48fba4=_0x54c492?_0x5003d4[_0x7364('0x1b')]:_0x2392d2[_0x7364('0x1c')]+_0x2392d2[_0x7364('0x1d')];var _0x132ca9;if(_0x48fba4>=_0x292732){_0x48fba4=_0x292732;_0x132ca9=0xc8;}else{_0x132ca9=0xce;}_0x3058fa[_0x7364('0x18')](_0x132ca9);return _0x3058fa[_0x7364('0x1e')](_0x7364('0x1f'),_0x2d388f+'-'+_0x48fba4+'/'+_0x292732)[_0x7364('0x20')](_0x5003d4);}return null;};}function patchUpdates(_0x187b88){return function(_0x1a1ed3){try{jsonpatch[_0x7364('0x21')](_0x1a1ed3,_0x187b88,!![]);}catch(_0x41f5aa){return BPromise[_0x7364('0x22')](_0x41f5aa);}return _0x1a1ed3[_0x7364('0x23')]();};}function saveUpdates(_0x4b922a,_0x5db722){return function(_0xe59c31){if(_0xe59c31){return _0xe59c31[_0x7364('0x24')](_0x4b922a)[_0x7364('0x25')](function(_0x32e96a){return _0x32e96a;});}return null;};}function removeEntity(_0x35d827,_0x21ca2b){return function(_0x236232){if(_0x236232){return _0x236232['destroy']()[_0x7364('0x25')](function(){_0x35d827[_0x7364('0x18')](0xcc)[_0x7364('0x19')]();});}};}function handleEntityNotFound(_0x3b359c,_0xe8a17){return function(_0x552339){if(!_0x552339){_0x3b359c[_0x7364('0x17')](0x194);}return _0x552339;};}function handleError(_0x4922,_0x410ebd){_0x410ebd=_0x410ebd||0x1f4;return function(_0x19f02c){logger[_0x7364('0x26')](_0x19f02c['stack']);if(_0x19f02c[_0x7364('0x27')]){delete _0x19f02c[_0x7364('0x27')];}_0x4922['status'](_0x410ebd)[_0x7364('0x28')](_0x19f02c);};}exports[_0x7364('0x29')]=function(_0x539e6b,_0x8b2956){var _0x803811={},_0x694ad8={},_0x2cceed={'count':0x0,'rows':[]};var _0xc66c1a=_['map'](db[_0x7364('0x2a')][_0x7364('0x2b')],function(_0x57ffed){return{'name':_0x57ffed[_0x7364('0x2c')],'type':_0x57ffed[_0x7364('0x2d')][_0x7364('0x2e')]};});_0x694ad8[_0x7364('0x2f')]=_[_0x7364('0x30')](_0xc66c1a,'name');_0x694ad8[_0x7364('0x31')]=_[_0x7364('0x32')](_0x539e6b[_0x7364('0x31')]);_0x694ad8['filters']=_[_0x7364('0x33')](_0x694ad8[_0x7364('0x2f')],_0x694ad8[_0x7364('0x31')]);_0x803811[_0x7364('0x34')]=_[_0x7364('0x33')](_0x694ad8['model'],qs['fields'](_0x539e6b[_0x7364('0x31')][_0x7364('0x35')]));_0x803811[_0x7364('0x34')]=_0x803811[_0x7364('0x34')][_0x7364('0x36')]?_0x803811['attributes']:_0x694ad8['model'];if(!_0x539e6b[_0x7364('0x31')]['hasOwnProperty'](_0x7364('0x37'))){_0x803811[_0x7364('0x1d')]=qs['limit'](_0x539e6b[_0x7364('0x31')][_0x7364('0x1d')]);_0x803811[_0x7364('0x1c')]=qs[_0x7364('0x1c')](_0x539e6b[_0x7364('0x31')][_0x7364('0x1c')]);}_0x803811[_0x7364('0x38')]=qs[_0x7364('0x39')](_0x539e6b[_0x7364('0x31')][_0x7364('0x39')]);_0x803811[_0x7364('0x3a')]=qs[_0x7364('0x3b')](_[_0x7364('0x3c')](_0x539e6b[_0x7364('0x31')],_0x694ad8[_0x7364('0x3b')]),_0xc66c1a);if(_0x539e6b['query'][_0x7364('0x3d')]){_0x803811[_0x7364('0x3a')]=_[_0x7364('0x3e')](_0x803811[_0x7364('0x3a')],{'$or':_[_0x7364('0x30')](_0xc66c1a,function(_0x1bcb3d){if(_0x1bcb3d['type']!==_0x7364('0x3f')){var _0x4ad774={};_0x4ad774[_0x1bcb3d['name']]={'$like':'%'+_0x539e6b[_0x7364('0x31')]['filter']+'%'};return _0x4ad774;}})});}_0x803811=_[_0x7364('0x3e')]({},_0x803811,_0x539e6b[_0x7364('0x40')]);var _0x308237={'where':_0x803811[_0x7364('0x3a')]};return db[_0x7364('0x2a')]['count'](_0x308237)[_0x7364('0x25')](function(_0x1af4b5){_0x2cceed['count']=_0x1af4b5;if(_0x539e6b[_0x7364('0x31')]['includeAll']){_0x803811['include']=[{'all':!![]}];}return db['VtigerField'][_0x7364('0x41')](_0x803811);})[_0x7364('0x25')](function(_0x59dce1){_0x2cceed['rows']=_0x59dce1;return _0x2cceed;})[_0x7364('0x25')](respondWithFilteredResult(_0x8b2956,_0x803811))[_0x7364('0x42')](handleError(_0x8b2956,null));};exports[_0x7364('0x43')]=function(_0xce61fc,_0x26bc81){var _0x2e182d={'raw':!![],'where':{'id':_0xce61fc[_0x7364('0x44')]['id']}},_0x5016fb={};_0x5016fb[_0x7364('0x2f')]=_[_0x7364('0x32')](db[_0x7364('0x2a')]['rawAttributes']);_0x5016fb[_0x7364('0x31')]=_['keys'](_0xce61fc[_0x7364('0x31')]);_0x5016fb['filters']=_[_0x7364('0x33')](_0x5016fb[_0x7364('0x2f')],_0x5016fb[_0x7364('0x31')]);_0x2e182d[_0x7364('0x34')]=_[_0x7364('0x33')](_0x5016fb[_0x7364('0x2f')],qs['fields'](_0xce61fc[_0x7364('0x31')][_0x7364('0x35')]));_0x2e182d['attributes']=_0x2e182d[_0x7364('0x34')]['length']?_0x2e182d[_0x7364('0x34')]:_0x5016fb[_0x7364('0x2f')];if(_0xce61fc['query'][_0x7364('0x45')]){_0x2e182d[_0x7364('0x46')]=[{'all':!![]}];}_0x2e182d=_[_0x7364('0x3e')]({},_0x2e182d,_0xce61fc[_0x7364('0x40')]);return db['VtigerField'][_0x7364('0x47')](_0x2e182d)[_0x7364('0x25')](handleEntityNotFound(_0x26bc81,null))[_0x7364('0x25')](respondWithResult(_0x26bc81,null))[_0x7364('0x42')](handleError(_0x26bc81,null));};exports['create']=function(_0x496c75,_0x2932a0){return db[_0x7364('0x2a')]['create'](_0x496c75[_0x7364('0x48')],{})['then'](respondWithResult(_0x2932a0,0xc9))[_0x7364('0x42')](handleError(_0x2932a0,null));};exports[_0x7364('0x24')]=function(_0x513a97,_0xba409a){if(_0x513a97[_0x7364('0x48')]['id']){delete _0x513a97[_0x7364('0x48')]['id'];}return db[_0x7364('0x2a')]['find']({'where':{'id':_0x513a97[_0x7364('0x44')]['id']}})[_0x7364('0x25')](handleEntityNotFound(_0xba409a,null))['then'](saveUpdates(_0x513a97[_0x7364('0x48')],null))['then'](respondWithResult(_0xba409a,null))[_0x7364('0x42')](handleError(_0xba409a,null));};exports[_0x7364('0x49')]=function(_0x559dc,_0x14b921){return db[_0x7364('0x2a')][_0x7364('0x47')]({'where':{'id':_0x559dc[_0x7364('0x44')]['id']}})[_0x7364('0x25')](handleEntityNotFound(_0x14b921,null))[_0x7364('0x25')](removeEntity(_0x14b921,null))[_0x7364('0x42')](handleError(_0x14b921,null));}; \ No newline at end of file +var _0x3c1c=['path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','reject','save','update','destroy','then','error','stack','name','index','VtigerField','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','options','findAll','rows','show','params','find','catch','create','body','eml-format','rimraf','zip-dir','request-promise','moment','mustache'];(function(_0x324d9f,_0x5a5653){var _0x4aa064=function(_0x5a0f31){while(--_0x5a0f31){_0x324d9f['push'](_0x324d9f['shift']());}};_0x4aa064(++_0x5a5653);}(_0x3c1c,0x162));var _0xc3c1=function(_0xf66a25,_0x527689){_0xf66a25=_0xf66a25-0x0;var _0x231422=_0x3c1c[_0xf66a25];return _0x231422;};'use strict';var emlformat=require(_0xc3c1('0x0'));var rimraf=require(_0xc3c1('0x1'));var zipdir=require(_0xc3c1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc3c1('0x3'));var moment=require(_0xc3c1('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc3c1('0x5'));var util=require('util');var path=require(_0xc3c1('0x6'));var sox=require(_0xc3c1('0x7'));var csv=require('to-csv');var ejs=require(_0xc3c1('0x8'));var fs=require('fs');var fs_extra=require(_0xc3c1('0x9'));var _=require('lodash');var squel=require(_0xc3c1('0xa'));var crypto=require(_0xc3c1('0xb'));var jsforce=require(_0xc3c1('0xc'));var deskjs=require(_0xc3c1('0xd'));var toCsv=require(_0xc3c1('0xe'));var querystring=require(_0xc3c1('0xf'));var Papa=require(_0xc3c1('0x10'));var Redis=require(_0xc3c1('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xc3c1('0x12'));var as=require(_0xc3c1('0x13'));var hardwareService=require(_0xc3c1('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xc3c1('0x15'));var config=require(_0xc3c1('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xc3c1('0x17'))['db'];function respondWithStatusCode(_0xee7370,_0x3b0861){_0x3b0861=_0x3b0861||0xcc;return function(_0x32d26a){if(_0x32d26a){return _0xee7370[_0xc3c1('0x18')](_0x3b0861);}return _0xee7370[_0xc3c1('0x19')](_0x3b0861)[_0xc3c1('0x1a')]();};}function respondWithResult(_0x318c3f,_0x45283e){_0x45283e=_0x45283e||0xc8;return function(_0x5efd00){if(_0x5efd00){return _0x318c3f[_0xc3c1('0x19')](_0x45283e)[_0xc3c1('0x1b')](_0x5efd00);}};}function respondWithFilteredResult(_0x434d33,_0x4d886e){return function(_0x678a95){if(_0x678a95){var _0x34dc53=typeof _0x4d886e[_0xc3c1('0x1c')]==='undefined'&&typeof _0x4d886e[_0xc3c1('0x1d')]===_0xc3c1('0x1e');var _0x42a977=_0x678a95[_0xc3c1('0x1f')];var _0x3d5db4=_0x34dc53?0x0:_0x4d886e['offset'];var _0x5011df=_0x34dc53?_0x678a95[_0xc3c1('0x1f')]:_0x4d886e[_0xc3c1('0x1c')]+_0x4d886e['limit'];var _0x3b3be0;if(_0x5011df>=_0x42a977){_0x5011df=_0x42a977;_0x3b3be0=0xc8;}else{_0x3b3be0=0xce;}_0x434d33[_0xc3c1('0x19')](_0x3b3be0);return _0x434d33['set'](_0xc3c1('0x20'),_0x3d5db4+'-'+_0x5011df+'/'+_0x42a977)[_0xc3c1('0x1b')](_0x678a95);}return null;};}function patchUpdates(_0x281675){return function(_0xded318){try{jsonpatch['apply'](_0xded318,_0x281675,!![]);}catch(_0x5cb3c1){return BPromise[_0xc3c1('0x21')](_0x5cb3c1);}return _0xded318[_0xc3c1('0x22')]();};}function saveUpdates(_0x7df35a,_0x5dc89d){return function(_0x4d8bfa){if(_0x4d8bfa){return _0x4d8bfa[_0xc3c1('0x23')](_0x7df35a)['then'](function(_0x59ab0c){return _0x59ab0c;});}return null;};}function removeEntity(_0x2d53d5,_0x2e609f){return function(_0x6b8da2){if(_0x6b8da2){return _0x6b8da2[_0xc3c1('0x24')]()[_0xc3c1('0x25')](function(){_0x2d53d5[_0xc3c1('0x19')](0xcc)[_0xc3c1('0x1a')]();});}};}function handleEntityNotFound(_0x37ff6f,_0x6910aa){return function(_0x12142d){if(!_0x12142d){_0x37ff6f[_0xc3c1('0x18')](0x194);}return _0x12142d;};}function handleError(_0x53b869,_0x23f762){_0x23f762=_0x23f762||0x1f4;return function(_0xe39549){logger[_0xc3c1('0x26')](_0xe39549[_0xc3c1('0x27')]);if(_0xe39549[_0xc3c1('0x28')]){delete _0xe39549[_0xc3c1('0x28')];}_0x53b869[_0xc3c1('0x19')](_0x23f762)['send'](_0xe39549);};}exports[_0xc3c1('0x29')]=function(_0x156d40,_0x3cc10e){var _0x5c7e53={},_0x12d5cc={},_0x47c623={'count':0x0,'rows':[]};var _0x4906d2=_['map'](db[_0xc3c1('0x2a')][_0xc3c1('0x2b')],function(_0x330a8a){return{'name':_0x330a8a[_0xc3c1('0x2c')],'type':_0x330a8a[_0xc3c1('0x2d')][_0xc3c1('0x2e')]};});_0x12d5cc[_0xc3c1('0x2f')]=_[_0xc3c1('0x30')](_0x4906d2,'name');_0x12d5cc[_0xc3c1('0x31')]=_[_0xc3c1('0x32')](_0x156d40[_0xc3c1('0x31')]);_0x12d5cc['filters']=_[_0xc3c1('0x33')](_0x12d5cc['model'],_0x12d5cc[_0xc3c1('0x31')]);_0x5c7e53[_0xc3c1('0x34')]=_['intersection'](_0x12d5cc['model'],qs['fields'](_0x156d40['query'][_0xc3c1('0x35')]));_0x5c7e53[_0xc3c1('0x34')]=_0x5c7e53[_0xc3c1('0x34')][_0xc3c1('0x36')]?_0x5c7e53['attributes']:_0x12d5cc[_0xc3c1('0x2f')];if(!_0x156d40[_0xc3c1('0x31')][_0xc3c1('0x37')](_0xc3c1('0x38'))){_0x5c7e53['limit']=qs[_0xc3c1('0x1d')](_0x156d40[_0xc3c1('0x31')][_0xc3c1('0x1d')]);_0x5c7e53[_0xc3c1('0x1c')]=qs[_0xc3c1('0x1c')](_0x156d40[_0xc3c1('0x31')]['offset']);}_0x5c7e53[_0xc3c1('0x39')]=qs[_0xc3c1('0x3a')](_0x156d40[_0xc3c1('0x31')][_0xc3c1('0x3a')]);_0x5c7e53[_0xc3c1('0x3b')]=qs[_0xc3c1('0x3c')](_[_0xc3c1('0x3d')](_0x156d40[_0xc3c1('0x31')],_0x12d5cc[_0xc3c1('0x3c')]),_0x4906d2);if(_0x156d40[_0xc3c1('0x31')]['filter']){_0x5c7e53[_0xc3c1('0x3b')]=_[_0xc3c1('0x3e')](_0x5c7e53[_0xc3c1('0x3b')],{'$or':_['map'](_0x4906d2,function(_0x570f91){if(_0x570f91[_0xc3c1('0x2d')]!=='VIRTUAL'){var _0x2e05a0={};_0x2e05a0[_0x570f91[_0xc3c1('0x28')]]={'$like':'%'+_0x156d40[_0xc3c1('0x31')]['filter']+'%'};return _0x2e05a0;}})});}_0x5c7e53=_[_0xc3c1('0x3e')]({},_0x5c7e53,_0x156d40[_0xc3c1('0x3f')]);var _0x5f49ad={'where':_0x5c7e53[_0xc3c1('0x3b')]};return db[_0xc3c1('0x2a')][_0xc3c1('0x1f')](_0x5f49ad)[_0xc3c1('0x25')](function(_0x406a28){_0x47c623['count']=_0x406a28;if(_0x156d40[_0xc3c1('0x31')]['includeAll']){_0x5c7e53['include']=[{'all':!![]}];}return db[_0xc3c1('0x2a')][_0xc3c1('0x40')](_0x5c7e53);})[_0xc3c1('0x25')](function(_0x5b1195){_0x47c623[_0xc3c1('0x41')]=_0x5b1195;return _0x47c623;})[_0xc3c1('0x25')](respondWithFilteredResult(_0x3cc10e,_0x5c7e53))['catch'](handleError(_0x3cc10e,null));};exports[_0xc3c1('0x42')]=function(_0x50310b,_0x5678f5){var _0x561aac={'raw':!![],'where':{'id':_0x50310b[_0xc3c1('0x43')]['id']}},_0x847b70={};_0x847b70[_0xc3c1('0x2f')]=_[_0xc3c1('0x32')](db[_0xc3c1('0x2a')][_0xc3c1('0x2b')]);_0x847b70[_0xc3c1('0x31')]=_[_0xc3c1('0x32')](_0x50310b[_0xc3c1('0x31')]);_0x847b70[_0xc3c1('0x3c')]=_[_0xc3c1('0x33')](_0x847b70[_0xc3c1('0x2f')],_0x847b70[_0xc3c1('0x31')]);_0x561aac[_0xc3c1('0x34')]=_['intersection'](_0x847b70[_0xc3c1('0x2f')],qs[_0xc3c1('0x35')](_0x50310b[_0xc3c1('0x31')][_0xc3c1('0x35')]));_0x561aac[_0xc3c1('0x34')]=_0x561aac[_0xc3c1('0x34')][_0xc3c1('0x36')]?_0x561aac['attributes']:_0x847b70[_0xc3c1('0x2f')];if(_0x50310b[_0xc3c1('0x31')]['includeAll']){_0x561aac['include']=[{'all':!![]}];}_0x561aac=_[_0xc3c1('0x3e')]({},_0x561aac,_0x50310b[_0xc3c1('0x3f')]);return db[_0xc3c1('0x2a')][_0xc3c1('0x44')](_0x561aac)[_0xc3c1('0x25')](handleEntityNotFound(_0x5678f5,null))[_0xc3c1('0x25')](respondWithResult(_0x5678f5,null))[_0xc3c1('0x45')](handleError(_0x5678f5,null));};exports[_0xc3c1('0x46')]=function(_0x37d583,_0x569cce){return db[_0xc3c1('0x2a')][_0xc3c1('0x46')](_0x37d583[_0xc3c1('0x47')],{})[_0xc3c1('0x25')](respondWithResult(_0x569cce,0xc9))[_0xc3c1('0x45')](handleError(_0x569cce,null));};exports[_0xc3c1('0x23')]=function(_0x544b8c,_0x44967e){if(_0x544b8c[_0xc3c1('0x47')]['id']){delete _0x544b8c[_0xc3c1('0x47')]['id'];}return db[_0xc3c1('0x2a')][_0xc3c1('0x44')]({'where':{'id':_0x544b8c[_0xc3c1('0x43')]['id']}})['then'](handleEntityNotFound(_0x44967e,null))[_0xc3c1('0x25')](saveUpdates(_0x544b8c[_0xc3c1('0x47')],null))[_0xc3c1('0x25')](respondWithResult(_0x44967e,null))[_0xc3c1('0x45')](handleError(_0x44967e,null));};exports[_0xc3c1('0x24')]=function(_0x5f049c,_0x1535a3){return db[_0xc3c1('0x2a')][_0xc3c1('0x44')]({'where':{'id':_0x5f049c['params']['id']}})['then'](handleEntityNotFound(_0x1535a3,null))[_0xc3c1('0x25')](removeEntity(_0x1535a3,null))[_0xc3c1('0x45')](handleError(_0x1535a3,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 41aa6df..8f100da 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 _0x3d45=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerField.attributes','exports','define','int_vtiger_fields','vtiger_unique_index','idField','FieldId','util','../../config/logger'];(function(_0x4bd839,_0x4f14d){var _0x50695a=function(_0x2e8ffd){while(--_0x2e8ffd){_0x4bd839['push'](_0x4bd839['shift']());}};_0x50695a(++_0x4f14d);}(_0x3d45,0x13e));var _0x53d4=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0x3d45[_0x2b5eae];return _0x5f3ac9;};'use strict';var _=require('lodash');var util=require(_0x53d4('0x0'));var logger=require(_0x53d4('0x1'))(_0x53d4('0x2'));var moment=require(_0x53d4('0x3'));var BPromise=require(_0x53d4('0x4'));var rp=require(_0x53d4('0x5'));var fs=require('fs');var path=require(_0x53d4('0x6'));var rimraf=require(_0x53d4('0x7'));var config=require(_0x53d4('0x8'));var attributes=require(_0x53d4('0x9'));module[_0x53d4('0xa')]=function(_0xa92fd7,_0x31dba1){return _0xa92fd7[_0x53d4('0xb')]('VtigerField',attributes,{'tableName':_0x53d4('0xc'),'paranoid':![],'indexes':[{'name':_0x53d4('0xd'),'fields':[_0x53d4('0xe'),_0x53d4('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3426=['../../config/environment','./intVtigerField.attributes','exports','define','VtigerField','vtiger_unique_index','lodash','api','moment','path','rimraf'];(function(_0x15c421,_0x6366f7){var _0x5e5ed5=function(_0x206e66){while(--_0x206e66){_0x15c421['push'](_0x15c421['shift']());}};_0x5e5ed5(++_0x6366f7);}(_0x3426,0x192));var _0x6342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3426[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6342('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6342('0x1'));var moment=require(_0x6342('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6342('0x3'));var rimraf=require(_0x6342('0x4'));var config=require(_0x6342('0x5'));var attributes=require(_0x6342('0x6'));module[_0x6342('0x7')]=function(_0x5a97ef,_0x44ee33){return _0x5a97ef[_0x6342('0x8')](_0x6342('0x9'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0x6342('0xa'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index 87771a3..1425c7c 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 _0x0504=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','then','VtigerField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','util'];(function(_0x57326a,_0x4682f5){var _0x24b1e7=function(_0x465727){while(--_0x465727){_0x57326a['push'](_0x57326a['shift']());}};_0x24b1e7(++_0x4682f5);}(_0x0504,0x18d));var _0x4050=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x0504[_0x618414];return _0x21c19a;};'use strict';var _=require(_0x4050('0x0'));var util=require(_0x4050('0x1'));var moment=require('moment');var BPromise=require(_0x4050('0x2'));var rs=require(_0x4050('0x3'));var fs=require('fs');var Redis=require(_0x4050('0x4'));var db=require(_0x4050('0x5'))['db'];var utils=require(_0x4050('0x6'));var logger=require(_0x4050('0x7'))('rpc');var config=require(_0x4050('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4050('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x306f09,_0x3691af,_0x2cb8ba){return new BPromise(function(_0x4baf9d,_0x5117d9){return client['request'](_0x306f09,_0x2cb8ba)[_0x4050('0xa')](function(_0x5aa76a){logger['info'](_0x4050('0xb'),_0x3691af,_0x4050('0xc'));logger[_0x4050('0xd')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x3691af,_0x4050('0xc'),JSON[_0x4050('0xe')](_0x5aa76a));if(_0x5aa76a[_0x4050('0xf')]){if(_0x5aa76a[_0x4050('0xf')][_0x4050('0x10')]===0x1f4){logger[_0x4050('0xf')](_0x4050('0xb'),_0x3691af,_0x5aa76a['error'][_0x4050('0x11')]);return _0x5117d9(_0x5aa76a[_0x4050('0xf')][_0x4050('0x11')]);}logger[_0x4050('0xf')](_0x4050('0xb'),_0x3691af,_0x5aa76a[_0x4050('0xf')][_0x4050('0x11')]);return _0x4baf9d(_0x5aa76a['error'][_0x4050('0x11')]);}else{logger[_0x4050('0x12')](_0x4050('0xb'),_0x3691af,_0x4050('0xc'));_0x4baf9d(_0x5aa76a[_0x4050('0x13')][_0x4050('0x11')]);}})[_0x4050('0x14')](function(_0x33732a){logger[_0x4050('0xf')]('VtigerField,\x20%s,\x20%s',_0x3691af,_0x33732a);_0x5117d9(_0x33732a);});});} \ No newline at end of file +var _0xd635=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','debug','stringify','error','VtigerField,\x20%s,\x20%s','message','info'];(function(_0xd34d4e,_0x104b35){var _0x32587f=function(_0x483fbd){while(--_0x483fbd){_0xd34d4e['push'](_0xd34d4e['shift']());}};_0x32587f(++_0x104b35);}(_0xd635,0xdd));var _0x5d63=function(_0x2077c2,_0x275ab5){_0x2077c2=_0x2077c2-0x0;var _0x312f9f=_0xd635[_0x2077c2];return _0x312f9f;};'use strict';var _=require(_0x5d63('0x0'));var util=require(_0x5d63('0x1'));var moment=require(_0x5d63('0x2'));var BPromise=require(_0x5d63('0x3'));var rs=require(_0x5d63('0x4'));var fs=require('fs');var Redis=require(_0x5d63('0x5'));var db=require(_0x5d63('0x6'))['db'];var utils=require(_0x5d63('0x7'));var logger=require(_0x5d63('0x8'))(_0x5d63('0x9'));var config=require(_0x5d63('0xa'));var jayson=require(_0x5d63('0xb'));var client=jayson[_0x5d63('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5eff28,_0x15c6bb,_0x53b3c5){return new BPromise(function(_0x961220,_0x4d2452){return client[_0x5d63('0xd')](_0x5eff28,_0x53b3c5)[_0x5d63('0xe')](function(_0x25cfbf){logger['info']('VtigerField,\x20%s,\x20%s',_0x15c6bb,'request\x20sent');logger[_0x5d63('0xf')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x15c6bb,'request\x20sent',JSON[_0x5d63('0x10')](_0x25cfbf));if(_0x25cfbf[_0x5d63('0x11')]){if(_0x25cfbf['error']['code']===0x1f4){logger[_0x5d63('0x11')](_0x5d63('0x12'),_0x15c6bb,_0x25cfbf[_0x5d63('0x11')][_0x5d63('0x13')]);return _0x4d2452(_0x25cfbf[_0x5d63('0x11')]['message']);}logger[_0x5d63('0x11')]('VtigerField,\x20%s,\x20%s',_0x15c6bb,_0x25cfbf[_0x5d63('0x11')][_0x5d63('0x13')]);return _0x961220(_0x25cfbf[_0x5d63('0x11')]['message']);}else{logger[_0x5d63('0x14')](_0x5d63('0x12'),_0x15c6bb,'request\x20sent');_0x961220(_0x25cfbf['result'][_0x5d63('0x13')]);}})[_0x5d63('0x15')](function(_0x40bd8f){logger[_0x5d63('0x11')](_0x5d63('0x12'),_0x15c6bb,_0x40bd8f);_0x4d2452(_0x40bd8f);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 29d6948..67ad5d5 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 _0xcd9b=['/:id','/:id/fields','post','create','/:id/configurations','addConfiguration','update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated'];(function(_0x22222d,_0x113e9b){var _0x4297f7=function(_0xd3d29c){while(--_0xd3d29c){_0x22222d['push'](_0x22222d['shift']());}};_0x4297f7(++_0x113e9b);}(_0xcd9b,0x14d));var _0xbcd9=function(_0x13416b,_0x294e2c){_0x13416b=_0x13416b-0x0;var _0x274801=_0xcd9b[_0x13416b];return _0x274801;};'use strict';var multer=require(_0xbcd9('0x0'));var util=require(_0xbcd9('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbcd9('0x2'));var router=express[_0xbcd9('0x3')]();var fs_extra=require(_0xbcd9('0x4'));var auth=require(_0xbcd9('0x5'));var interaction=require(_0xbcd9('0x6'));var config=require('../../config/environment');var controller=require('./intZendeskAccount.controller');router[_0xbcd9('0x7')]('/',auth[_0xbcd9('0x8')](),controller['index']);router[_0xbcd9('0x7')](_0xbcd9('0x9'),auth[_0xbcd9('0x8')](),controller['show']);router[_0xbcd9('0x7')]('/:id/configurations',auth['isAuthenticated'](),controller['getConfigurations']);router[_0xbcd9('0x7')](_0xbcd9('0xa'),auth['isAuthenticated'](),controller['getFields']);router[_0xbcd9('0xb')]('/',auth['isAuthenticated'](),controller[_0xbcd9('0xc')]);router[_0xbcd9('0xb')](_0xbcd9('0xd'),auth[_0xbcd9('0x8')](),controller[_0xbcd9('0xe')]);router['put']('/:id',auth[_0xbcd9('0x8')](),controller[_0xbcd9('0xf')]);router[_0xbcd9('0x10')](_0xbcd9('0x9'),auth[_0xbcd9('0x8')](),controller[_0xbcd9('0x11')]);module[_0xbcd9('0x12')]=router; \ No newline at end of file +var _0x2ceb=['addConfiguration','put','update','delete','destroy','exports','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./intZendeskAccount.controller','isAuthenticated','index','get','/:id','/:id/fields','getFields','post','create','/:id/configurations'];(function(_0x5e804f,_0xd2ba4){var _0x215ac2=function(_0x32be15){while(--_0x32be15){_0x5e804f['push'](_0x5e804f['shift']());}};_0x215ac2(++_0xd2ba4);}(_0x2ceb,0x1aa));var _0xb2ce=function(_0x35b437,_0x1133d9){_0x35b437=_0x35b437-0x0;var _0x23c9a2=_0x2ceb[_0x35b437];return _0x23c9a2;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb2ce('0x0'));var timeout=require(_0xb2ce('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xb2ce('0x2'));var auth=require(_0xb2ce('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xb2ce('0x4'));var controller=require(_0xb2ce('0x5'));router['get']('/',auth[_0xb2ce('0x6')](),controller[_0xb2ce('0x7')]);router[_0xb2ce('0x8')](_0xb2ce('0x9'),auth[_0xb2ce('0x6')](),controller['show']);router[_0xb2ce('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller['getConfigurations']);router[_0xb2ce('0x8')](_0xb2ce('0xa'),auth[_0xb2ce('0x6')](),controller[_0xb2ce('0xb')]);router[_0xb2ce('0xc')]('/',auth[_0xb2ce('0x6')](),controller[_0xb2ce('0xd')]);router[_0xb2ce('0xc')](_0xb2ce('0xe'),auth[_0xb2ce('0x6')](),controller[_0xb2ce('0xf')]);router[_0xb2ce('0x10')]('/:id',auth[_0xb2ce('0x6')](),controller[_0xb2ce('0x11')]);router[_0xb2ce('0x12')]('/:id',auth[_0xb2ce('0x6')](),controller[_0xb2ce('0x13')]);module[_0xb2ce('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 5d5d8b1..697ea3b 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 _0xbc36=['newTab','sequelize','STRING','username','remoteUri','ENUM','token','password','integrationTab'];(function(_0x34d6af,_0x2851d4){var _0x1ef6a8=function(_0x230e42){while(--_0x230e42){_0x34d6af['push'](_0x34d6af['shift']());}};_0x1ef6a8(++_0x2851d4);}(_0xbc36,0x169));var _0x6bc3=function(_0x259e02,_0x3cb426){_0x259e02=_0x259e02-0x0;var _0x2f5b8e=_0xbc36[_0x259e02];return _0x2f5b8e;};'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 +var _0x6dc0=['integrationTab','newTab','sequelize','exports','STRING','username','remoteUri','ENUM','token'];(function(_0x219165,_0x51d7a6){var _0x17066c=function(_0x31354f){while(--_0x31354f){_0x219165['push'](_0x219165['shift']());}};_0x17066c(++_0x51d7a6);}(_0x6dc0,0xb6));var _0x06dc=function(_0x36b96d,_0x19adb1){_0x36b96d=_0x36b96d-0x0;var _0x3f22a7=_0x6dc0[_0x36b96d];return _0x3f22a7;};'use strict';var Sequelize=require(_0x06dc('0x0'));module[_0x06dc('0x1')]={'name':{'type':Sequelize[_0x06dc('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x06dc('0x2')],'unique':_0x06dc('0x3')},'password':{'type':Sequelize[_0x06dc('0x2')]},'token':{'type':Sequelize[_0x06dc('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x06dc('0x4')},'authType':{'type':Sequelize[_0x06dc('0x5')]('password',_0x06dc('0x6')),'defaultValue':'password'},'serverUrl':{'type':Sequelize[_0x06dc('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x06dc('0x5')](_0x06dc('0x7'),_0x06dc('0x8')),'defaultValue':_0x06dc('0x7')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index a7d3473..cd46375 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 _0x5c00=['getDescriptions','username','token','authType','remoteUri','slice','substring','GET','%s/%s','ticket_fields','password','%s:%s','toString','headers','format','Basic\x20%s','base64','Sequelize','ValidationError','Unknown\x20authentication\x20type','description','group','assignee','includes','title','system_field_options','custom_field_options','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','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','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','set','json','reject','save','update','then','stack','name','send','index','map','ZendeskAccount','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','count','includeAll','include','findAll','rows','show','options','find','catch','create','body','destroy','params','getConfigurations','findOne','ZendeskConfiguration','AccountId','channel'];(function(_0x3b085,_0x250543){var _0x476a57=function(_0x480941){while(--_0x480941){_0x3b085['push'](_0x3b085['shift']());}};_0x476a57(++_0x250543);}(_0x5c00,0x17e));var _0x05c0=function(_0x5b2096,_0x213141){_0x5b2096=_0x5b2096-0x0;var _0x198357=_0x5c00[_0x5b2096];return _0x198357;};'use strict';var emlformat=require(_0x05c0('0x0'));var rimraf=require(_0x05c0('0x1'));var zipdir=require(_0x05c0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x05c0('0x3'));var moment=require('moment');var BPromise=require(_0x05c0('0x4'));var Mustache=require(_0x05c0('0x5'));var util=require(_0x05c0('0x6'));var path=require(_0x05c0('0x7'));var sox=require('sox');var csv=require(_0x05c0('0x8'));var ejs=require(_0x05c0('0x9'));var fs=require('fs');var fs_extra=require(_0x05c0('0xa'));var _=require(_0x05c0('0xb'));var squel=require('squel');var crypto=require(_0x05c0('0xc'));var jsforce=require(_0x05c0('0xd'));var deskjs=require(_0x05c0('0xe'));var toCsv=require('to-csv');var querystring=require(_0x05c0('0xf'));var Papa=require(_0x05c0('0x10'));var Redis=require(_0x05c0('0x11'));var authService=require(_0x05c0('0x12'));var qs=require(_0x05c0('0x13'));var as=require(_0x05c0('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x05c0('0x15'));var utils=require('../../config/utils');var config=require(_0x05c0('0x16'));var licenseUtil=require(_0x05c0('0x17'));var db=require(_0x05c0('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x4e39d4,_0x5eec41){_0x5eec41=_0x5eec41||0xcc;return function(_0x16a290){if(_0x16a290){return _0x4e39d4[_0x05c0('0x19')](_0x5eec41);}return _0x4e39d4[_0x05c0('0x1a')](_0x5eec41)[_0x05c0('0x1b')]();};}function respondWithResult(_0x25764b,_0xe57ed0){_0xe57ed0=_0xe57ed0||0xc8;return function(_0x331799){if(_0x331799){return _0x25764b[_0x05c0('0x1a')](_0xe57ed0)['json'](_0x331799);}};}function respondWithFilteredResult(_0x238e25,_0x161a5f){return function(_0x4bb164){if(_0x4bb164){var _0x29e6b0=typeof _0x161a5f[_0x05c0('0x1c')]===_0x05c0('0x1d')&&typeof _0x161a5f[_0x05c0('0x1e')]===_0x05c0('0x1d');var _0x38f994=_0x4bb164['count'];var _0x422401=_0x29e6b0?0x0:_0x161a5f[_0x05c0('0x1c')];var _0x4613c0=_0x29e6b0?_0x4bb164['count']:_0x161a5f[_0x05c0('0x1c')]+_0x161a5f[_0x05c0('0x1e')];var _0x10685b;if(_0x4613c0>=_0x38f994){_0x4613c0=_0x38f994;_0x10685b=0xc8;}else{_0x10685b=0xce;}_0x238e25[_0x05c0('0x1a')](_0x10685b);return _0x238e25[_0x05c0('0x1f')]('Content-Range',_0x422401+'-'+_0x4613c0+'/'+_0x38f994)[_0x05c0('0x20')](_0x4bb164);}return null;};}function patchUpdates(_0x1014ef){return function(_0x5313b0){try{jsonpatch['apply'](_0x5313b0,_0x1014ef,!![]);}catch(_0x5e4b80){return BPromise[_0x05c0('0x21')](_0x5e4b80);}return _0x5313b0[_0x05c0('0x22')]();};}function saveUpdates(_0x83f29,_0x8e2d4){return function(_0x5b3acb){if(_0x5b3acb){return _0x5b3acb[_0x05c0('0x23')](_0x83f29)[_0x05c0('0x24')](function(_0x5b4eef){return _0x5b4eef;});}return null;};}function removeEntity(_0x9b4930,_0x1abbf3){return function(_0x4ba978){if(_0x4ba978){return _0x4ba978['destroy']()['then'](function(){_0x9b4930['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3df135,_0x15b497){return function(_0x48b56f){if(!_0x48b56f){_0x3df135[_0x05c0('0x19')](0x194);}return _0x48b56f;};}function handleError(_0x336e1b,_0x3617dc){_0x3617dc=_0x3617dc||0x1f4;return function(_0x889c75){logger['error'](_0x889c75[_0x05c0('0x25')]);if(_0x889c75[_0x05c0('0x26')]){delete _0x889c75[_0x05c0('0x26')];}_0x336e1b[_0x05c0('0x1a')](_0x3617dc)[_0x05c0('0x27')](_0x889c75);};}exports[_0x05c0('0x28')]=function(_0x57886b,_0x56ba64){var _0x2df109={},_0xbe7d9e={},_0x2053d5={'count':0x0,'rows':[]};var _0xd6574e=_[_0x05c0('0x29')](db[_0x05c0('0x2a')][_0x05c0('0x2b')],function(_0x3c9eb1){return{'name':_0x3c9eb1[_0x05c0('0x2c')],'type':_0x3c9eb1[_0x05c0('0x2d')][_0x05c0('0x2e')]};});_0xbe7d9e[_0x05c0('0x2f')]=_['map'](_0xd6574e,'name');_0xbe7d9e[_0x05c0('0x30')]=_[_0x05c0('0x31')](_0x57886b[_0x05c0('0x30')]);_0xbe7d9e['filters']=_[_0x05c0('0x32')](_0xbe7d9e[_0x05c0('0x2f')],_0xbe7d9e['query']);_0x2df109[_0x05c0('0x33')]=_['intersection'](_0xbe7d9e[_0x05c0('0x2f')],qs[_0x05c0('0x34')](_0x57886b[_0x05c0('0x30')][_0x05c0('0x34')]));_0x2df109[_0x05c0('0x33')]=_0x2df109[_0x05c0('0x33')][_0x05c0('0x35')]?_0x2df109[_0x05c0('0x33')]:_0xbe7d9e[_0x05c0('0x2f')];if(!_0x57886b[_0x05c0('0x30')][_0x05c0('0x36')](_0x05c0('0x37'))){_0x2df109[_0x05c0('0x1e')]=qs[_0x05c0('0x1e')](_0x57886b[_0x05c0('0x30')][_0x05c0('0x1e')]);_0x2df109[_0x05c0('0x1c')]=qs[_0x05c0('0x1c')](_0x57886b[_0x05c0('0x30')][_0x05c0('0x1c')]);}_0x2df109[_0x05c0('0x38')]=qs[_0x05c0('0x39')](_0x57886b[_0x05c0('0x30')][_0x05c0('0x39')]);_0x2df109[_0x05c0('0x3a')]=qs[_0x05c0('0x3b')](_[_0x05c0('0x3c')](_0x57886b[_0x05c0('0x30')],_0xbe7d9e[_0x05c0('0x3b')]),_0xd6574e);if(_0x57886b[_0x05c0('0x30')][_0x05c0('0x3d')]){_0x2df109[_0x05c0('0x3a')]=_[_0x05c0('0x3e')](_0x2df109['where'],{'$or':_[_0x05c0('0x29')](_0xd6574e,function(_0x249101){if(_0x249101[_0x05c0('0x2d')]!==_0x05c0('0x3f')){var _0x49f829={};_0x49f829[_0x249101['name']]={'$like':'%'+_0x57886b[_0x05c0('0x30')][_0x05c0('0x3d')]+'%'};return _0x49f829;}})});}_0x2df109=_[_0x05c0('0x3e')]({},_0x2df109,_0x57886b['options']);var _0x29dc87={'where':_0x2df109[_0x05c0('0x3a')]};return db[_0x05c0('0x2a')][_0x05c0('0x40')](_0x29dc87)['then'](function(_0x152c6a){_0x2053d5[_0x05c0('0x40')]=_0x152c6a;if(_0x57886b['query'][_0x05c0('0x41')]){_0x2df109[_0x05c0('0x42')]=[{'all':!![]}];}return db[_0x05c0('0x2a')][_0x05c0('0x43')](_0x2df109);})[_0x05c0('0x24')](function(_0x398a6e){_0x2053d5[_0x05c0('0x44')]=_0x398a6e;return _0x2053d5;})['then'](respondWithFilteredResult(_0x56ba64,_0x2df109))['catch'](handleError(_0x56ba64,null));};exports[_0x05c0('0x45')]=function(_0x1d1d94,_0xaa5d53){var _0x11f079={'raw':![],'where':{'id':_0x1d1d94['params']['id']}},_0x14aba3={};_0x14aba3[_0x05c0('0x2f')]=_[_0x05c0('0x31')](db[_0x05c0('0x2a')][_0x05c0('0x2b')]);_0x14aba3[_0x05c0('0x30')]=_[_0x05c0('0x31')](_0x1d1d94[_0x05c0('0x30')]);_0x14aba3['filters']=_[_0x05c0('0x32')](_0x14aba3[_0x05c0('0x2f')],_0x14aba3[_0x05c0('0x30')]);_0x11f079[_0x05c0('0x33')]=_[_0x05c0('0x32')](_0x14aba3[_0x05c0('0x2f')],qs[_0x05c0('0x34')](_0x1d1d94[_0x05c0('0x30')][_0x05c0('0x34')]));_0x11f079[_0x05c0('0x33')]=_0x11f079[_0x05c0('0x33')]['length']?_0x11f079['attributes']:_0x14aba3[_0x05c0('0x2f')];if(_0x1d1d94[_0x05c0('0x30')][_0x05c0('0x41')]){_0x11f079[_0x05c0('0x42')]=[{'all':!![]}];}_0x11f079=_[_0x05c0('0x3e')]({},_0x11f079,_0x1d1d94[_0x05c0('0x46')]);return db['ZendeskAccount'][_0x05c0('0x47')](_0x11f079)[_0x05c0('0x24')](handleEntityNotFound(_0xaa5d53,null))[_0x05c0('0x24')](respondWithResult(_0xaa5d53,null))[_0x05c0('0x48')](handleError(_0xaa5d53,null));};exports['create']=function(_0x34e94e,_0x2440e8){return db[_0x05c0('0x2a')][_0x05c0('0x49')](_0x34e94e['body'],{})[_0x05c0('0x24')](respondWithResult(_0x2440e8,0xc9))[_0x05c0('0x48')](handleError(_0x2440e8,null));};exports[_0x05c0('0x23')]=function(_0x9b521b,_0x5ef6cf){if(_0x9b521b[_0x05c0('0x4a')]['id']){delete _0x9b521b[_0x05c0('0x4a')]['id'];}return db['ZendeskAccount'][_0x05c0('0x47')]({'where':{'id':_0x9b521b['params']['id']}})['then'](handleEntityNotFound(_0x5ef6cf,null))[_0x05c0('0x24')](saveUpdates(_0x9b521b['body'],null))[_0x05c0('0x24')](respondWithResult(_0x5ef6cf,null))[_0x05c0('0x48')](handleError(_0x5ef6cf,null));};exports[_0x05c0('0x4b')]=function(_0x371aff,_0x3ccae9){return db[_0x05c0('0x2a')]['find']({'where':{'id':_0x371aff[_0x05c0('0x4c')]['id']}})['then'](handleEntityNotFound(_0x3ccae9,null))[_0x05c0('0x24')](removeEntity(_0x3ccae9,null))[_0x05c0('0x48')](handleError(_0x3ccae9,null));};exports[_0x05c0('0x4d')]=function(_0x13ad38,_0x1496d4,_0x37ad50){var _0x156087={};var _0x551b7b={};var _0x5215b4;var _0x523153;return db[_0x05c0('0x2a')][_0x05c0('0x4e')]({'where':{'id':_0x13ad38['params']['id']}})['then'](handleEntityNotFound(_0x1496d4,null))[_0x05c0('0x24')](function(_0x1a72d6){if(_0x1a72d6){_0x5215b4=_0x1a72d6;_0x551b7b[_0x05c0('0x2f')]=_[_0x05c0('0x31')](db[_0x05c0('0x4f')][_0x05c0('0x2b')]);_0x551b7b[_0x05c0('0x30')]=_['keys'](_0x13ad38[_0x05c0('0x30')]);_0x551b7b[_0x05c0('0x3b')]=_[_0x05c0('0x32')](_0x551b7b[_0x05c0('0x2f')],_0x551b7b['query']);_0x156087[_0x05c0('0x33')]=_['intersection'](_0x551b7b[_0x05c0('0x2f')],qs[_0x05c0('0x34')](_0x13ad38['query'][_0x05c0('0x34')]));_0x156087['attributes']=_0x156087[_0x05c0('0x33')][_0x05c0('0x35')]?_0x156087[_0x05c0('0x33')]:_0x551b7b[_0x05c0('0x2f')];_0x156087[_0x05c0('0x38')]=qs[_0x05c0('0x39')](_0x13ad38['query'][_0x05c0('0x39')]);_0x156087[_0x05c0('0x3a')]=qs[_0x05c0('0x3b')](_[_0x05c0('0x3c')](_0x13ad38[_0x05c0('0x30')],_0x551b7b[_0x05c0('0x3b')]));if(_0x13ad38['query'][_0x05c0('0x3d')]){_0x156087[_0x05c0('0x3a')]=_[_0x05c0('0x3e')](_0x156087[_0x05c0('0x3a')],{'$or':_[_0x05c0('0x29')](_0x156087[_0x05c0('0x33')],function(_0xf5e123){var _0x866523={};_0x866523[_0xf5e123]={'$like':'%'+_0x13ad38[_0x05c0('0x30')][_0x05c0('0x3d')]+'%'};return _0x866523;})});}_0x156087=_[_0x05c0('0x3e')]({},_0x156087,_0x13ad38[_0x05c0('0x46')]);return _0x5215b4['getConfigurations'](_0x156087);}})['then'](function(_0x5269b4){if(_0x5269b4){_0x523153=_0x5269b4[_0x05c0('0x35')];if(!_0x13ad38[_0x05c0('0x30')][_0x05c0('0x36')]('nolimit')){_0x156087[_0x05c0('0x1e')]=qs[_0x05c0('0x1e')](_0x13ad38[_0x05c0('0x30')][_0x05c0('0x1e')]);_0x156087[_0x05c0('0x1c')]=qs[_0x05c0('0x1c')](_0x13ad38[_0x05c0('0x30')]['offset']);}return _0x5215b4[_0x05c0('0x4d')](_0x156087);}})[_0x05c0('0x24')](function(_0x355b44){if(_0x355b44){return _0x355b44?{'count':_0x523153,'rows':_0x355b44}:null;}})[_0x05c0('0x24')](respondWithResult(_0x1496d4,null))['catch'](handleError(_0x1496d4,null));};exports['addConfiguration']=function(_0x5e4941,_0x3b74c5,_0x2b8a13){if(_0x5e4941[_0x05c0('0x4a')]['id']){delete _0x5e4941[_0x05c0('0x4a')]['id'];}return db[_0x05c0('0x2a')][_0x05c0('0x4e')]({'where':{'id':_0x5e4941[_0x05c0('0x4c')]['id']}})['then'](handleEntityNotFound(_0x3b74c5,null))[_0x05c0('0x24')](function(_0x225397){if(_0x225397){_0x5e4941[_0x05c0('0x4a')][_0x05c0('0x50')]=_0x225397['id'];_0x5e4941[_0x05c0('0x4a')]['Subjects']=integrations['getSubjects'](_0x5e4941[_0x05c0('0x4a')][_0x05c0('0x51')],_0x5e4941['body'][_0x05c0('0x2d')]);_0x5e4941['body']['Descriptions']=integrations[_0x05c0('0x52')](_0x5e4941[_0x05c0('0x4a')][_0x05c0('0x51')],_0x5e4941['body']['type']);return db[_0x05c0('0x4f')][_0x05c0('0x49')](_0x5e4941[_0x05c0('0x4a')],{'include':[{'model':db['ZendeskField'],'as':'Subjects'},{'model':db['ZendeskField'],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x3b74c5,null))[_0x05c0('0x48')](handleError(_0x3b74c5,null));};exports['getFields']=function(_0x496acf,_0x5bb9ef,_0xd7a2f3){var _0x1a6dc4='';return db[_0x05c0('0x2a')]['findOne']({'where':{'id':_0x496acf[_0x05c0('0x4c')]['id']},'attributes':['id',_0x05c0('0x53'),'password',_0x05c0('0x54'),_0x05c0('0x55'),_0x05c0('0x56')]})[_0x05c0('0x24')](handleEntityNotFound(_0x5bb9ef,null))['then'](function(_0x35ef76){if(_0x35ef76){_0x1a6dc4=_0x35ef76[_0x05c0('0x56')];var _0xc150e3=_0x1a6dc4[_0x05c0('0x57')](-0x1);if(_0xc150e3==='/'){_0x1a6dc4=_0x1a6dc4[_0x05c0('0x58')](0x0,_0x1a6dc4['lastIndexOf'](_0xc150e3));}var _0x4aee38={'method':_0x05c0('0x59'),'uri':util['format'](_0x05c0('0x5a'),_0x1a6dc4,_0x05c0('0x5b')),'json':!![]};switch(_0x35ef76['authType']){case _0x05c0('0x5c'):_0x4aee38['headers']={'Authorization':util['format']('Basic\x20%s',new Buffer(util['format'](_0x05c0('0x5d'),_0x35ef76[_0x05c0('0x53')],_0x35ef76[_0x05c0('0x5c')]))[_0x05c0('0x5e')]('base64'))};break;case _0x05c0('0x54'):_0x4aee38[_0x05c0('0x5f')]={'Authorization':util[_0x05c0('0x60')](_0x05c0('0x61'),new Buffer(util[_0x05c0('0x60')]('%s/token:%s',_0x35ef76[_0x05c0('0x53')],_0x35ef76['token']))['toString'](_0x05c0('0x62')))};break;default:throw new db[(_0x05c0('0x63'))][(_0x05c0('0x64'))](_0x05c0('0x65'));}return rp(_0x4aee38);}})[_0x05c0('0x24')](function(_0x4577ee){if(_0x4577ee){var _0x4c3c73=['subject',_0x05c0('0x66'),_0x05c0('0x67'),_0x05c0('0x68')];_['remove'](_0x4577ee[_0x05c0('0x5b')],function(_0x7c5ce6){return _0x4c3c73[_0x05c0('0x69')](_0x7c5ce6[_0x05c0('0x2d')]);});return{'count':_0x4577ee[_0x05c0('0x5b')][_0x05c0('0x35')],'rows':_['map'](_0x4577ee[_0x05c0('0x5b')],function(_0x464ae0){return{'id':_0x464ae0['id'],'name':_0x464ae0['position']>0x7?_0x464ae0[_0x05c0('0x6a')]:_0x464ae0[_0x05c0('0x2d')],'custom':_0x464ae0['position']>0x7?!![]:![],'options':_0x464ae0[_0x05c0('0x6b')]?_0x464ae0[_0x05c0('0x6b')]:_0x464ae0[_0x05c0('0x6c')]?_0x464ae0[_0x05c0('0x6c')]:[]};})};}})[_0x05c0('0x24')](respondWithResult(_0x5bb9ef,null))[_0x05c0('0x48')](function(_0x544d6c){var _0x63f20=_0x496acf['query'][_0x05c0('0x6d')]?0x1f4:_0x544d6c[_0x05c0('0x6e')]||0x1f4;logger[_0x05c0('0x6f')](_0x05c0('0x70'),_0x05c0('0x71'),_0x63f20,JSON[_0x05c0('0x72')](_0x544d6c));delete _0x544d6c[_0x05c0('0x26')];if(_0x63f20===0x191){_0x63f20=0x190;}_0x5bb9ef[_0x05c0('0x1a')](_0x63f20)[_0x05c0('0x27')](_0x496acf[_0x05c0('0x30')]['test']?{'message':_0x05c0('0x73'),'statusCode':_0x544d6c['statusCode']}:_0x544d6c);});}; \ No newline at end of file +var _0xbaf0=['findAll','rows','catch','show','params','create','body','find','getConfigurations','findOne','ZendeskConfiguration','pick','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZendeskField','getFields','username','password','token','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','ticket_fields','authType','%s:%s','toString','headers','%s/token:%s','base64','Sequelize','ValidationError','subject','description','assignee','remove','includes','position','title','system_field_options','custom_field_options','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../components/integrations/configuration','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','end','sendStatus','error','stack','name','send','index','map','ZendeskAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','merge','where','VIRTUAL','filter','options','includeAll','include'];(function(_0x2d54a3,_0x551ca2){var _0x2771cd=function(_0x5d9ccf){while(--_0x5d9ccf){_0x2d54a3['push'](_0x2d54a3['shift']());}};_0x2771cd(++_0x551ca2);}(_0xbaf0,0x12a));var _0x0baf=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xbaf0[_0x465028];return _0xb783d4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0baf('0x0'));var zipdir=require(_0x0baf('0x1'));var jsonpatch=require(_0x0baf('0x2'));var rp=require(_0x0baf('0x3'));var moment=require(_0x0baf('0x4'));var BPromise=require(_0x0baf('0x5'));var Mustache=require('mustache');var util=require(_0x0baf('0x6'));var path=require(_0x0baf('0x7'));var sox=require(_0x0baf('0x8'));var csv=require(_0x0baf('0x9'));var ejs=require(_0x0baf('0xa'));var fs=require('fs');var fs_extra=require(_0x0baf('0xb'));var _=require(_0x0baf('0xc'));var squel=require(_0x0baf('0xd'));var crypto=require(_0x0baf('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x0baf('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0baf('0x10'));var Papa=require(_0x0baf('0x11'));var Redis=require(_0x0baf('0x12'));var authService=require(_0x0baf('0x13'));var qs=require(_0x0baf('0x14'));var as=require(_0x0baf('0x15'));var hardwareService=require(_0x0baf('0x16'));var logger=require(_0x0baf('0x17'))(_0x0baf('0x18'));var utils=require(_0x0baf('0x19'));var config=require(_0x0baf('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x0baf('0x1b'));function respondWithStatusCode(_0xe4378c,_0x5db689){_0x5db689=_0x5db689||0xcc;return function(_0x13df17){if(_0x13df17){return _0xe4378c['sendStatus'](_0x5db689);}return _0xe4378c[_0x0baf('0x1c')](_0x5db689)['end']();};}function respondWithResult(_0x1c76a8,_0x1f50c3){_0x1f50c3=_0x1f50c3||0xc8;return function(_0x7fbf67){if(_0x7fbf67){return _0x1c76a8[_0x0baf('0x1c')](_0x1f50c3)[_0x0baf('0x1d')](_0x7fbf67);}};}function respondWithFilteredResult(_0x469599,_0x4f80a8){return function(_0x4cd79d){if(_0x4cd79d){var _0x2312c7=typeof _0x4f80a8[_0x0baf('0x1e')]===_0x0baf('0x1f')&&typeof _0x4f80a8[_0x0baf('0x20')]===_0x0baf('0x1f');var _0x288a98=_0x4cd79d['count'];var _0x63c820=_0x2312c7?0x0:_0x4f80a8[_0x0baf('0x1e')];var _0x1ef0e5=_0x2312c7?_0x4cd79d[_0x0baf('0x21')]:_0x4f80a8[_0x0baf('0x1e')]+_0x4f80a8[_0x0baf('0x20')];var _0x4ff793;if(_0x1ef0e5>=_0x288a98){_0x1ef0e5=_0x288a98;_0x4ff793=0xc8;}else{_0x4ff793=0xce;}_0x469599['status'](_0x4ff793);return _0x469599[_0x0baf('0x22')](_0x0baf('0x23'),_0x63c820+'-'+_0x1ef0e5+'/'+_0x288a98)[_0x0baf('0x1d')](_0x4cd79d);}return null;};}function patchUpdates(_0x1848e8){return function(_0x1fa92b){try{jsonpatch[_0x0baf('0x24')](_0x1fa92b,_0x1848e8,!![]);}catch(_0x210cd8){return BPromise[_0x0baf('0x25')](_0x210cd8);}return _0x1fa92b[_0x0baf('0x26')]();};}function saveUpdates(_0x15a2c3,_0x54f2fa){return function(_0x334bd6){if(_0x334bd6){return _0x334bd6['update'](_0x15a2c3)[_0x0baf('0x27')](function(_0x5dbf00){return _0x5dbf00;});}return null;};}function removeEntity(_0x4de74c,_0x2ef0aa){return function(_0x48a0e9){if(_0x48a0e9){return _0x48a0e9['destroy']()[_0x0baf('0x27')](function(){_0x4de74c[_0x0baf('0x1c')](0xcc)[_0x0baf('0x28')]();});}};}function handleEntityNotFound(_0x19d9fd,_0x3a1ba1){return function(_0x56b299){if(!_0x56b299){_0x19d9fd[_0x0baf('0x29')](0x194);}return _0x56b299;};}function handleError(_0x4681c5,_0x1ca35a){_0x1ca35a=_0x1ca35a||0x1f4;return function(_0x366e71){logger[_0x0baf('0x2a')](_0x366e71[_0x0baf('0x2b')]);if(_0x366e71[_0x0baf('0x2c')]){delete _0x366e71['name'];}_0x4681c5[_0x0baf('0x1c')](_0x1ca35a)[_0x0baf('0x2d')](_0x366e71);};}exports[_0x0baf('0x2e')]=function(_0x265915,_0x55c715){var _0x29dbdf={},_0x34a58a={},_0x5d9d7f={'count':0x0,'rows':[]};var _0x44ec31=_[_0x0baf('0x2f')](db[_0x0baf('0x30')][_0x0baf('0x31')],function(_0xd14f0f){return{'name':_0xd14f0f[_0x0baf('0x32')],'type':_0xd14f0f[_0x0baf('0x33')]['key']};});_0x34a58a[_0x0baf('0x34')]=_[_0x0baf('0x2f')](_0x44ec31,_0x0baf('0x2c'));_0x34a58a[_0x0baf('0x35')]=_[_0x0baf('0x36')](_0x265915[_0x0baf('0x35')]);_0x34a58a[_0x0baf('0x37')]=_[_0x0baf('0x38')](_0x34a58a[_0x0baf('0x34')],_0x34a58a[_0x0baf('0x35')]);_0x29dbdf[_0x0baf('0x39')]=_[_0x0baf('0x38')](_0x34a58a[_0x0baf('0x34')],qs[_0x0baf('0x3a')](_0x265915['query'][_0x0baf('0x3a')]));_0x29dbdf['attributes']=_0x29dbdf[_0x0baf('0x39')][_0x0baf('0x3b')]?_0x29dbdf[_0x0baf('0x39')]:_0x34a58a[_0x0baf('0x34')];if(!_0x265915['query'][_0x0baf('0x3c')](_0x0baf('0x3d'))){_0x29dbdf['limit']=qs[_0x0baf('0x20')](_0x265915[_0x0baf('0x35')][_0x0baf('0x20')]);_0x29dbdf[_0x0baf('0x1e')]=qs[_0x0baf('0x1e')](_0x265915[_0x0baf('0x35')][_0x0baf('0x1e')]);}_0x29dbdf[_0x0baf('0x3e')]=qs['sort'](_0x265915[_0x0baf('0x35')][_0x0baf('0x3f')]);_0x29dbdf['where']=qs[_0x0baf('0x37')](_['pick'](_0x265915['query'],_0x34a58a[_0x0baf('0x37')]),_0x44ec31);if(_0x265915[_0x0baf('0x35')]['filter']){_0x29dbdf['where']=_[_0x0baf('0x40')](_0x29dbdf[_0x0baf('0x41')],{'$or':_[_0x0baf('0x2f')](_0x44ec31,function(_0xb2d9ab){if(_0xb2d9ab[_0x0baf('0x33')]!==_0x0baf('0x42')){var _0x290464={};_0x290464[_0xb2d9ab[_0x0baf('0x2c')]]={'$like':'%'+_0x265915[_0x0baf('0x35')][_0x0baf('0x43')]+'%'};return _0x290464;}})});}_0x29dbdf=_[_0x0baf('0x40')]({},_0x29dbdf,_0x265915[_0x0baf('0x44')]);var _0x354cb1={'where':_0x29dbdf[_0x0baf('0x41')]};return db['ZendeskAccount'][_0x0baf('0x21')](_0x354cb1)[_0x0baf('0x27')](function(_0x4f1de9){_0x5d9d7f[_0x0baf('0x21')]=_0x4f1de9;if(_0x265915[_0x0baf('0x35')][_0x0baf('0x45')]){_0x29dbdf[_0x0baf('0x46')]=[{'all':!![]}];}return db[_0x0baf('0x30')][_0x0baf('0x47')](_0x29dbdf);})['then'](function(_0x23ad34){_0x5d9d7f[_0x0baf('0x48')]=_0x23ad34;return _0x5d9d7f;})['then'](respondWithFilteredResult(_0x55c715,_0x29dbdf))[_0x0baf('0x49')](handleError(_0x55c715,null));};exports[_0x0baf('0x4a')]=function(_0x45c6aa,_0x57903e){var _0x504031={'raw':![],'where':{'id':_0x45c6aa[_0x0baf('0x4b')]['id']}},_0x193fd3={};_0x193fd3[_0x0baf('0x34')]=_[_0x0baf('0x36')](db[_0x0baf('0x30')][_0x0baf('0x31')]);_0x193fd3[_0x0baf('0x35')]=_[_0x0baf('0x36')](_0x45c6aa[_0x0baf('0x35')]);_0x193fd3[_0x0baf('0x37')]=_['intersection'](_0x193fd3[_0x0baf('0x34')],_0x193fd3[_0x0baf('0x35')]);_0x504031[_0x0baf('0x39')]=_[_0x0baf('0x38')](_0x193fd3[_0x0baf('0x34')],qs['fields'](_0x45c6aa[_0x0baf('0x35')][_0x0baf('0x3a')]));_0x504031[_0x0baf('0x39')]=_0x504031[_0x0baf('0x39')][_0x0baf('0x3b')]?_0x504031['attributes']:_0x193fd3[_0x0baf('0x34')];if(_0x45c6aa[_0x0baf('0x35')][_0x0baf('0x45')]){_0x504031[_0x0baf('0x46')]=[{'all':!![]}];}_0x504031=_[_0x0baf('0x40')]({},_0x504031,_0x45c6aa[_0x0baf('0x44')]);return db[_0x0baf('0x30')]['find'](_0x504031)[_0x0baf('0x27')](handleEntityNotFound(_0x57903e,null))[_0x0baf('0x27')](respondWithResult(_0x57903e,null))[_0x0baf('0x49')](handleError(_0x57903e,null));};exports['create']=function(_0x3c9de3,_0x2222b6){return db[_0x0baf('0x30')][_0x0baf('0x4c')](_0x3c9de3[_0x0baf('0x4d')],{})[_0x0baf('0x27')](respondWithResult(_0x2222b6,0xc9))[_0x0baf('0x49')](handleError(_0x2222b6,null));};exports['update']=function(_0x22c451,_0x428c9b){if(_0x22c451[_0x0baf('0x4d')]['id']){delete _0x22c451[_0x0baf('0x4d')]['id'];}return db[_0x0baf('0x30')][_0x0baf('0x4e')]({'where':{'id':_0x22c451[_0x0baf('0x4b')]['id']}})[_0x0baf('0x27')](handleEntityNotFound(_0x428c9b,null))[_0x0baf('0x27')](saveUpdates(_0x22c451[_0x0baf('0x4d')],null))[_0x0baf('0x27')](respondWithResult(_0x428c9b,null))['catch'](handleError(_0x428c9b,null));};exports['destroy']=function(_0x354329,_0x3d6b19){return db[_0x0baf('0x30')][_0x0baf('0x4e')]({'where':{'id':_0x354329[_0x0baf('0x4b')]['id']}})[_0x0baf('0x27')](handleEntityNotFound(_0x3d6b19,null))[_0x0baf('0x27')](removeEntity(_0x3d6b19,null))['catch'](handleError(_0x3d6b19,null));};exports[_0x0baf('0x4f')]=function(_0x2ef4c1,_0xf2424,_0x16d9fb){var _0x3fdb41={};var _0x1e2671={};var _0x5e1849;var _0x3eebe5;return db['ZendeskAccount'][_0x0baf('0x50')]({'where':{'id':_0x2ef4c1['params']['id']}})[_0x0baf('0x27')](handleEntityNotFound(_0xf2424,null))['then'](function(_0x35b1a5){if(_0x35b1a5){_0x5e1849=_0x35b1a5;_0x1e2671['model']=_[_0x0baf('0x36')](db[_0x0baf('0x51')][_0x0baf('0x31')]);_0x1e2671[_0x0baf('0x35')]=_[_0x0baf('0x36')](_0x2ef4c1['query']);_0x1e2671[_0x0baf('0x37')]=_[_0x0baf('0x38')](_0x1e2671[_0x0baf('0x34')],_0x1e2671[_0x0baf('0x35')]);_0x3fdb41[_0x0baf('0x39')]=_[_0x0baf('0x38')](_0x1e2671['model'],qs[_0x0baf('0x3a')](_0x2ef4c1[_0x0baf('0x35')][_0x0baf('0x3a')]));_0x3fdb41[_0x0baf('0x39')]=_0x3fdb41[_0x0baf('0x39')][_0x0baf('0x3b')]?_0x3fdb41[_0x0baf('0x39')]:_0x1e2671['model'];_0x3fdb41['order']=qs[_0x0baf('0x3f')](_0x2ef4c1[_0x0baf('0x35')][_0x0baf('0x3f')]);_0x3fdb41[_0x0baf('0x41')]=qs[_0x0baf('0x37')](_[_0x0baf('0x52')](_0x2ef4c1[_0x0baf('0x35')],_0x1e2671[_0x0baf('0x37')]));if(_0x2ef4c1[_0x0baf('0x35')]['filter']){_0x3fdb41[_0x0baf('0x41')]=_[_0x0baf('0x40')](_0x3fdb41[_0x0baf('0x41')],{'$or':_[_0x0baf('0x2f')](_0x3fdb41[_0x0baf('0x39')],function(_0xebfc0c){var _0x26f5c9={};_0x26f5c9[_0xebfc0c]={'$like':'%'+_0x2ef4c1['query'][_0x0baf('0x43')]+'%'};return _0x26f5c9;})});}_0x3fdb41=_[_0x0baf('0x40')]({},_0x3fdb41,_0x2ef4c1[_0x0baf('0x44')]);return _0x5e1849[_0x0baf('0x4f')](_0x3fdb41);}})[_0x0baf('0x27')](function(_0x1a6d22){if(_0x1a6d22){_0x3eebe5=_0x1a6d22[_0x0baf('0x3b')];if(!_0x2ef4c1[_0x0baf('0x35')]['hasOwnProperty'](_0x0baf('0x3d'))){_0x3fdb41['limit']=qs[_0x0baf('0x20')](_0x2ef4c1['query']['limit']);_0x3fdb41[_0x0baf('0x1e')]=qs['offset'](_0x2ef4c1[_0x0baf('0x35')][_0x0baf('0x1e')]);}return _0x5e1849['getConfigurations'](_0x3fdb41);}})[_0x0baf('0x27')](function(_0xfb6708){if(_0xfb6708){return _0xfb6708?{'count':_0x3eebe5,'rows':_0xfb6708}:null;}})[_0x0baf('0x27')](respondWithResult(_0xf2424,null))['catch'](handleError(_0xf2424,null));};exports['addConfiguration']=function(_0x2438df,_0x7e8946,_0x6d789f){if(_0x2438df[_0x0baf('0x4d')]['id']){delete _0x2438df[_0x0baf('0x4d')]['id'];}return db['ZendeskAccount'][_0x0baf('0x50')]({'where':{'id':_0x2438df['params']['id']}})['then'](handleEntityNotFound(_0x7e8946,null))['then'](function(_0x427ed1){if(_0x427ed1){_0x2438df['body']['AccountId']=_0x427ed1['id'];_0x2438df[_0x0baf('0x4d')][_0x0baf('0x53')]=integrations[_0x0baf('0x54')](_0x2438df[_0x0baf('0x4d')][_0x0baf('0x55')],_0x2438df[_0x0baf('0x4d')]['type']);_0x2438df[_0x0baf('0x4d')][_0x0baf('0x56')]=integrations[_0x0baf('0x57')](_0x2438df[_0x0baf('0x4d')][_0x0baf('0x55')],_0x2438df[_0x0baf('0x4d')]['type']);return db[_0x0baf('0x51')][_0x0baf('0x4c')](_0x2438df[_0x0baf('0x4d')],{'include':[{'model':db['ZendeskField'],'as':_0x0baf('0x53')},{'model':db[_0x0baf('0x58')],'as':_0x0baf('0x56')}]});}return null;})[_0x0baf('0x27')](respondWithResult(_0x7e8946,null))[_0x0baf('0x49')](handleError(_0x7e8946,null));};exports[_0x0baf('0x59')]=function(_0x4cc046,_0x5874cc,_0x54353a){var _0x4b7caa='';return db[_0x0baf('0x30')][_0x0baf('0x50')]({'where':{'id':_0x4cc046[_0x0baf('0x4b')]['id']},'attributes':['id',_0x0baf('0x5a'),_0x0baf('0x5b'),_0x0baf('0x5c'),'authType','remoteUri']})[_0x0baf('0x27')](handleEntityNotFound(_0x5874cc,null))['then'](function(_0x22cd07){if(_0x22cd07){_0x4b7caa=_0x22cd07[_0x0baf('0x5d')];var _0x4cca39=_0x4b7caa[_0x0baf('0x5e')](-0x1);if(_0x4cca39==='/'){_0x4b7caa=_0x4b7caa[_0x0baf('0x5f')](0x0,_0x4b7caa[_0x0baf('0x60')](_0x4cca39));}var _0xb1d719={'method':_0x0baf('0x61'),'uri':util[_0x0baf('0x62')](_0x0baf('0x63'),_0x4b7caa,_0x0baf('0x64')),'json':!![]};switch(_0x22cd07[_0x0baf('0x65')]){case'password':_0xb1d719['headers']={'Authorization':util['format']('Basic\x20%s',new Buffer(util['format'](_0x0baf('0x66'),_0x22cd07[_0x0baf('0x5a')],_0x22cd07[_0x0baf('0x5b')]))[_0x0baf('0x67')]('base64'))};break;case _0x0baf('0x5c'):_0xb1d719[_0x0baf('0x68')]={'Authorization':util['format']('Basic\x20%s',new Buffer(util[_0x0baf('0x62')](_0x0baf('0x69'),_0x22cd07[_0x0baf('0x5a')],_0x22cd07[_0x0baf('0x5c')]))[_0x0baf('0x67')](_0x0baf('0x6a')))};break;default:throw new db[(_0x0baf('0x6b'))][(_0x0baf('0x6c'))]('Unknown\x20authentication\x20type');}return rp(_0xb1d719);}})[_0x0baf('0x27')](function(_0x1a3b7b){if(_0x1a3b7b){var _0x560c0f=[_0x0baf('0x6d'),_0x0baf('0x6e'),'group',_0x0baf('0x6f')];_[_0x0baf('0x70')](_0x1a3b7b[_0x0baf('0x64')],function(_0x2baede){return _0x560c0f[_0x0baf('0x71')](_0x2baede['type']);});return{'count':_0x1a3b7b['ticket_fields'][_0x0baf('0x3b')],'rows':_[_0x0baf('0x2f')](_0x1a3b7b['ticket_fields'],function(_0x28bc1c){return{'id':_0x28bc1c['id'],'name':_0x28bc1c[_0x0baf('0x72')]>0x7?_0x28bc1c[_0x0baf('0x73')]:_0x28bc1c['type'],'custom':_0x28bc1c[_0x0baf('0x72')]>0x7?!![]:![],'options':_0x28bc1c[_0x0baf('0x74')]?_0x28bc1c[_0x0baf('0x74')]:_0x28bc1c['custom_field_options']?_0x28bc1c[_0x0baf('0x75')]:[]};})};}})['then'](respondWithResult(_0x5874cc,null))[_0x0baf('0x49')](function(_0x3fee46){var _0x3fd039=_0x4cc046[_0x0baf('0x35')][_0x0baf('0x76')]?0x1f4:_0x3fee46['statusCode']||0x1f4;logger[_0x0baf('0x2a')](_0x0baf('0x77'),'getFields',_0x3fd039,JSON[_0x0baf('0x78')](_0x3fee46));delete _0x3fee46[_0x0baf('0x2c')];if(_0x3fd039===0x191){_0x3fd039=0x190;}_0x5874cc[_0x0baf('0x1c')](_0x3fd039)[_0x0baf('0x2d')](_0x4cc046[_0x0baf('0x35')][_0x0baf('0x76')]?{'message':_0x0baf('0x79'),'statusCode':_0x3fee46[_0x0baf('0x7a')]}:_0x3fee46);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 7ba8aad..a902e20 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 _0x8b3a=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','ZendeskAccount','int_zendesk_accounts'];(function(_0x5e0ada,_0x7be0fd){var _0x283c57=function(_0x18b022){while(--_0x18b022){_0x5e0ada['push'](_0x5e0ada['shift']());}};_0x283c57(++_0x7be0fd);}(_0x8b3a,0x16c));var _0xa8b3=function(_0x191f9d,_0x21976f){_0x191f9d=_0x191f9d-0x0;var _0x58e60d=_0x8b3a[_0x191f9d];return _0x58e60d;};'use strict';var _=require('lodash');var util=require(_0xa8b3('0x0'));var logger=require(_0xa8b3('0x1'))(_0xa8b3('0x2'));var moment=require('moment');var BPromise=require(_0xa8b3('0x3'));var rp=require(_0xa8b3('0x4'));var fs=require('fs');var path=require(_0xa8b3('0x5'));var rimraf=require(_0xa8b3('0x6'));var config=require(_0xa8b3('0x7'));var attributes=require(_0xa8b3('0x8'));var integrations=require(_0xa8b3('0x9'));module[_0xa8b3('0xa')]=function(_0x376469,_0x4039c9){return _0x376469[_0xa8b3('0xb')](_0xa8b3('0xc'),attributes,{'tableName':_0xa8b3('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc651=['rimraf','../../config/environment','./intZendeskAccount.attributes','exports','define','int_zendesk_accounts','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xc651,0x1b3));var _0x1c65=function(_0xfba697,_0x28149e){_0xfba697=_0xfba697-0x0;var _0x3976bc=_0xc651[_0xfba697];return _0x3976bc;};'use strict';var _=require(_0x1c65('0x0'));var util=require(_0x1c65('0x1'));var logger=require(_0x1c65('0x2'))(_0x1c65('0x3'));var moment=require('moment');var BPromise=require(_0x1c65('0x4'));var rp=require(_0x1c65('0x5'));var fs=require('fs');var path=require(_0x1c65('0x6'));var rimraf=require(_0x1c65('0x7'));var config=require(_0x1c65('0x8'));var attributes=require(_0x1c65('0x9'));var integrations=require('../../components/integrations/configuration');module[_0x1c65('0xa')]=function(_0x20b8c1,_0x479cab){return _0x20b8c1[_0x1c65('0xb')]('ZendeskAccount',attributes,{'tableName':_0x1c65('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index 9bafc7b..c8b6b6c 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 _0xf74e=['model','stringify','ShowZendeskAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','error','ZendeskAccount,\x20%s,\x20%s','message','result','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','where','attributes','limit','include','map'];(function(_0x1a9204,_0x1c9e00){var _0x17ca68=function(_0x1f4399){while(--_0x1f4399){_0x1a9204['push'](_0x1a9204['shift']());}};_0x17ca68(++_0x1c9e00);}(_0xf74e,0x98));var _0xef74=function(_0xc0e093,_0x17d86a){_0xc0e093=_0xc0e093-0x0;var _0x58a253=_0xf74e[_0xc0e093];return _0x58a253;};'use strict';var _=require(_0xef74('0x0'));var util=require(_0xef74('0x1'));var moment=require(_0xef74('0x2'));var BPromise=require(_0xef74('0x3'));var rs=require(_0xef74('0x4'));var fs=require('fs');var Redis=require(_0xef74('0x5'));var db=require(_0xef74('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xef74('0x7'))(_0xef74('0x8'));var config=require(_0xef74('0x9'));var jayson=require(_0xef74('0xa'));var client=jayson[_0xef74('0xb')][_0xef74('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x768690,_0xc46ac0,_0x288980){return new BPromise(function(_0x2f3a6b,_0xfc9ef1){return client['request'](_0x768690,_0x288980)[_0xef74('0xd')](function(_0x4cb47b){logger[_0xef74('0xe')]('ZendeskAccount,\x20%s,\x20%s',_0xc46ac0,_0xef74('0xf'));logger[_0xef74('0x10')](_0xef74('0x11'),_0xc46ac0,_0xef74('0xf'),JSON['stringify'](_0x4cb47b));if(_0x4cb47b[_0xef74('0x12')]){if(_0x4cb47b[_0xef74('0x12')]['code']===0x1f4){logger['error'](_0xef74('0x13'),_0xc46ac0,_0x4cb47b[_0xef74('0x12')][_0xef74('0x14')]);return _0xfc9ef1(_0x4cb47b[_0xef74('0x12')][_0xef74('0x14')]);}logger['error'](_0xef74('0x13'),_0xc46ac0,_0x4cb47b[_0xef74('0x12')]['message']);return _0x2f3a6b(_0x4cb47b['error'][_0xef74('0x14')]);}else{logger[_0xef74('0xe')](_0xef74('0x13'),_0xc46ac0,'request\x20sent');_0x2f3a6b(_0x4cb47b[_0xef74('0x15')][_0xef74('0x14')]);}})[_0xef74('0x16')](function(_0x345429){logger[_0xef74('0x12')](_0xef74('0x13'),_0xc46ac0,_0x345429);_0xfc9ef1(_0x345429);});});}exports[_0xef74('0x17')]=function(_0x525a63){var _0x58a876=this;return new Promise(function(_0x3cf2c8,_0x6d654c){return db[_0xef74('0x18')][_0xef74('0x19')]({'raw':_0x525a63[_0xef74('0x1a')]?_0x525a63['options'][_0xef74('0x1b')]===undefined?!![]:![]:!![],'where':_0x525a63[_0xef74('0x1a')]?_0x525a63['options'][_0xef74('0x1c')]||null:null,'attributes':_0x525a63[_0xef74('0x1a')]?_0x525a63['options'][_0xef74('0x1d')]||null:null,'limit':_0x525a63[_0xef74('0x1a')]?_0x525a63[_0xef74('0x1a')][_0xef74('0x1e')]||null:null,'include':_0x525a63['options']?_0x525a63[_0xef74('0x1a')][_0xef74('0x1f')]?_['map'](_0x525a63[_0xef74('0x1a')][_0xef74('0x1f')],function(_0x54e213){return{'model':db[_0x54e213['model']],'as':_0x54e213['as'],'attributes':_0x54e213[_0xef74('0x1d')],'include':_0x54e213[_0xef74('0x1f')]?_[_0xef74('0x20')](_0x54e213[_0xef74('0x1f')],function(_0x414300){return{'model':db[_0x414300[_0xef74('0x21')]],'as':_0x414300['as'],'attributes':_0x414300['attributes'],'include':_0x414300[_0xef74('0x1f')]?_[_0xef74('0x20')](_0x414300[_0xef74('0x1f')],function(_0x28a803){return{'model':db[_0x28a803['model']],'as':_0x28a803['as'],'attributes':_0x28a803[_0xef74('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xef74('0xd')](function(_0x5f0a3a){logger[_0xef74('0xe')]('GetZendeskAccount',_0x525a63);logger[_0xef74('0x10')](_0xef74('0x17'),_0x525a63,JSON[_0xef74('0x22')](_0x5f0a3a));_0x3cf2c8(_0x5f0a3a);})[_0xef74('0x16')](function(_0x591bea){logger['error'](_0xef74('0x17'),_0x591bea[_0xef74('0x14')],_0x525a63);_0x6d654c(_0x58a876[_0xef74('0x12')](0x1f4,_0x591bea[_0xef74('0x14')]));});});};exports[_0xef74('0x23')]=function(_0x32aeb9){var _0x5982a0=this;return new Promise(function(_0x188e70,_0x34b5d3){return db[_0xef74('0x18')][_0xef74('0x24')]({'raw':_0x32aeb9[_0xef74('0x1a')]?_0x32aeb9[_0xef74('0x1a')][_0xef74('0x1b')]===undefined?!![]:![]:!![],'where':_0x32aeb9[_0xef74('0x1a')]?_0x32aeb9['options'][_0xef74('0x1c')]||null:null,'attributes':_0x32aeb9['options']?_0x32aeb9[_0xef74('0x1a')][_0xef74('0x1d')]||null:null,'include':_0x32aeb9[_0xef74('0x1a')]?_0x32aeb9[_0xef74('0x1a')][_0xef74('0x1f')]?_['map'](_0x32aeb9[_0xef74('0x1a')][_0xef74('0x1f')],function(_0x23ffb8){return{'model':db[_0x23ffb8['model']],'as':_0x23ffb8['as'],'attributes':_0x23ffb8[_0xef74('0x1d')],'include':_0x23ffb8[_0xef74('0x1f')]?_[_0xef74('0x20')](_0x23ffb8[_0xef74('0x1f')],function(_0x52c6ee){return{'model':db[_0x52c6ee[_0xef74('0x21')]],'as':_0x52c6ee['as'],'attributes':_0x52c6ee[_0xef74('0x1d')],'include':_0x52c6ee[_0xef74('0x1f')]?_['map'](_0x52c6ee[_0xef74('0x1f')],function(_0x41763c){return{'model':db[_0x41763c[_0xef74('0x21')]],'as':_0x41763c['as'],'attributes':_0x41763c['attributes']};}):[]};}):[]};}):[]:[]})[_0xef74('0xd')](function(_0x31f88b){logger[_0xef74('0xe')](_0xef74('0x23'),_0x32aeb9);logger['debug'](_0xef74('0x23'),_0x32aeb9,JSON[_0xef74('0x22')](_0x31f88b));_0x188e70(_0x31f88b);})[_0xef74('0x16')](function(_0x228fe9){logger[_0xef74('0x12')]('ShowZendeskAccount',_0x228fe9[_0xef74('0x14')],_0x32aeb9);_0x34b5d3(_0x5982a0[_0xef74('0x12')](0x1f4,_0x228fe9[_0xef74('0x14')]));});});}; \ No newline at end of file +var _0xbf98=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','ZendeskAccount,\x20%s,\x20%s','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetZendeskAccount','ZendeskAccount','options','raw','where','limit','include','map','attributes','model','find','ShowZendeskAccount'];(function(_0x180f33,_0x3787a3){var _0x51eb47=function(_0x1d34a1){while(--_0x1d34a1){_0x180f33['push'](_0x180f33['shift']());}};_0x51eb47(++_0x3787a3);}(_0xbf98,0x132));var _0x8bf9=function(_0x468339,_0x4ffa70){_0x468339=_0x468339-0x0;var _0x1657c0=_0xbf98[_0x468339];return _0x1657c0;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x8bf9('0x0'));var rs=require(_0x8bf9('0x1'));var fs=require('fs');var Redis=require(_0x8bf9('0x2'));var db=require(_0x8bf9('0x3'))['db'];var utils=require(_0x8bf9('0x4'));var logger=require(_0x8bf9('0x5'))('rpc');var config=require(_0x8bf9('0x6'));var jayson=require(_0x8bf9('0x7'));var client=jayson[_0x8bf9('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5ab09a,_0x13856b,_0x140d5f){return new BPromise(function(_0x36caa4,_0x288b2d){return client[_0x8bf9('0x9')](_0x5ab09a,_0x140d5f)[_0x8bf9('0xa')](function(_0x138ee0){logger[_0x8bf9('0xb')](_0x8bf9('0xc'),_0x13856b,'request\x20sent');logger[_0x8bf9('0xd')](_0x8bf9('0xe'),_0x13856b,_0x8bf9('0xf'),JSON[_0x8bf9('0x10')](_0x138ee0));if(_0x138ee0[_0x8bf9('0x11')]){if(_0x138ee0[_0x8bf9('0x11')][_0x8bf9('0x12')]===0x1f4){logger[_0x8bf9('0x11')](_0x8bf9('0xc'),_0x13856b,_0x138ee0['error']['message']);return _0x288b2d(_0x138ee0[_0x8bf9('0x11')]['message']);}logger[_0x8bf9('0x11')](_0x8bf9('0xc'),_0x13856b,_0x138ee0[_0x8bf9('0x11')][_0x8bf9('0x13')]);return _0x36caa4(_0x138ee0[_0x8bf9('0x11')][_0x8bf9('0x13')]);}else{logger[_0x8bf9('0xb')](_0x8bf9('0xc'),_0x13856b,_0x8bf9('0xf'));_0x36caa4(_0x138ee0[_0x8bf9('0x14')][_0x8bf9('0x13')]);}})[_0x8bf9('0x15')](function(_0xb6ebde){logger[_0x8bf9('0x11')](_0x8bf9('0xc'),_0x13856b,_0xb6ebde);_0x288b2d(_0xb6ebde);});});}exports[_0x8bf9('0x16')]=function(_0x5c1ea5){var _0x37986b=this;return new Promise(function(_0x104fe8,_0x2b89f6){return db[_0x8bf9('0x17')]['findAll']({'raw':_0x5c1ea5[_0x8bf9('0x18')]?_0x5c1ea5['options'][_0x8bf9('0x19')]===undefined?!![]:![]:!![],'where':_0x5c1ea5['options']?_0x5c1ea5[_0x8bf9('0x18')][_0x8bf9('0x1a')]||null:null,'attributes':_0x5c1ea5[_0x8bf9('0x18')]?_0x5c1ea5['options']['attributes']||null:null,'limit':_0x5c1ea5[_0x8bf9('0x18')]?_0x5c1ea5[_0x8bf9('0x18')][_0x8bf9('0x1b')]||null:null,'include':_0x5c1ea5['options']?_0x5c1ea5[_0x8bf9('0x18')][_0x8bf9('0x1c')]?_[_0x8bf9('0x1d')](_0x5c1ea5[_0x8bf9('0x18')]['include'],function(_0x4e0566){return{'model':db[_0x4e0566['model']],'as':_0x4e0566['as'],'attributes':_0x4e0566[_0x8bf9('0x1e')],'include':_0x4e0566['include']?_['map'](_0x4e0566[_0x8bf9('0x1c')],function(_0xb64eb){return{'model':db[_0xb64eb['model']],'as':_0xb64eb['as'],'attributes':_0xb64eb[_0x8bf9('0x1e')],'include':_0xb64eb[_0x8bf9('0x1c')]?_['map'](_0xb64eb[_0x8bf9('0x1c')],function(_0x4262b6){return{'model':db[_0x4262b6[_0x8bf9('0x1f')]],'as':_0x4262b6['as'],'attributes':_0x4262b6['attributes']};}):[]};}):[]};}):[]:[]})[_0x8bf9('0xa')](function(_0x328163){logger[_0x8bf9('0xb')]('GetZendeskAccount',_0x5c1ea5);logger[_0x8bf9('0xd')](_0x8bf9('0x16'),_0x5c1ea5,JSON[_0x8bf9('0x10')](_0x328163));_0x104fe8(_0x328163);})[_0x8bf9('0x15')](function(_0x280c7b){logger[_0x8bf9('0x11')]('GetZendeskAccount',_0x280c7b['message'],_0x5c1ea5);_0x2b89f6(_0x37986b[_0x8bf9('0x11')](0x1f4,_0x280c7b[_0x8bf9('0x13')]));});});};exports['ShowZendeskAccount']=function(_0x537a29){var _0x388146=this;return new Promise(function(_0x248fd2,_0x4e7930){return db[_0x8bf9('0x17')][_0x8bf9('0x20')]({'raw':_0x537a29[_0x8bf9('0x18')]?_0x537a29['options'][_0x8bf9('0x19')]===undefined?!![]:![]:!![],'where':_0x537a29[_0x8bf9('0x18')]?_0x537a29[_0x8bf9('0x18')]['where']||null:null,'attributes':_0x537a29['options']?_0x537a29[_0x8bf9('0x18')][_0x8bf9('0x1e')]||null:null,'include':_0x537a29[_0x8bf9('0x18')]?_0x537a29[_0x8bf9('0x18')]['include']?_[_0x8bf9('0x1d')](_0x537a29['options'][_0x8bf9('0x1c')],function(_0x5d3d6e){return{'model':db[_0x5d3d6e['model']],'as':_0x5d3d6e['as'],'attributes':_0x5d3d6e[_0x8bf9('0x1e')],'include':_0x5d3d6e[_0x8bf9('0x1c')]?_['map'](_0x5d3d6e[_0x8bf9('0x1c')],function(_0x1f4557){return{'model':db[_0x1f4557[_0x8bf9('0x1f')]],'as':_0x1f4557['as'],'attributes':_0x1f4557[_0x8bf9('0x1e')],'include':_0x1f4557['include']?_['map'](_0x1f4557[_0x8bf9('0x1c')],function(_0x493cbd){return{'model':db[_0x493cbd[_0x8bf9('0x1f')]],'as':_0x493cbd['as'],'attributes':_0x493cbd[_0x8bf9('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x8bf9('0xa')](function(_0x35734f){logger[_0x8bf9('0xb')](_0x8bf9('0x21'),_0x537a29);logger['debug'](_0x8bf9('0x21'),_0x537a29,JSON[_0x8bf9('0x10')](_0x35734f));_0x248fd2(_0x35734f);})[_0x8bf9('0x15')](function(_0x131471){logger[_0x8bf9('0x11')](_0x8bf9('0x21'),_0x131471[_0x8bf9('0x13')],_0x537a29);_0x4e7930(_0x388146[_0x8bf9('0x11')](0x1f4,_0x131471['message']));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 86bd249..778191f 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 _0x9ffd=['update','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intZendeskConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/fields','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','create','post','put'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x33c26d,_0x1e0601){_0x33c26d=_0x33c26d-0x0;var _0xe27fd3=_0x9ffd[_0x33c26d];return _0xe27fd3;};'use strict';var multer=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var path=require(_0xd9ff('0x2'));var timeout=require('connect-timeout');var express=require(_0xd9ff('0x3'));var router=express[_0xd9ff('0x4')]();var fs_extra=require(_0xd9ff('0x5'));var auth=require(_0xd9ff('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd9ff('0x7'));var controller=require(_0xd9ff('0x8'));router['get']('/',auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xa')]);router[_0xd9ff('0xb')](_0xd9ff('0xc'),auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xd')]);router[_0xd9ff('0xb')](_0xd9ff('0xe'),auth[_0xd9ff('0x9')](),controller['getFields']);router['get']('/:id/subjects',auth['isAuthenticated'](),controller[_0xd9ff('0xf')]);router[_0xd9ff('0xb')](_0xd9ff('0x10'),auth[_0xd9ff('0x9')](),controller[_0xd9ff('0x11')]);router[_0xd9ff('0xb')](_0xd9ff('0x12'),auth[_0xd9ff('0x9')](),controller['getTags']);router['post']('/',auth[_0xd9ff('0x9')](),controller[_0xd9ff('0x13')]);router[_0xd9ff('0x14')](_0xd9ff('0x12'),auth[_0xd9ff('0x9')](),controller['setTags']);router[_0xd9ff('0x15')](_0xd9ff('0xc'),auth['isAuthenticated'](),controller[_0xd9ff('0x16')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xd9ff('0x17')]=router; \ No newline at end of file +var _0xb688=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','update','exports','util'];(function(_0x4ad0f7,_0x1920b0){var _0x30f5c8=function(_0x2aa6b6){while(--_0x2aa6b6){_0x4ad0f7['push'](_0x4ad0f7['shift']());}};_0x30f5c8(++_0x1920b0);}(_0xb688,0xcf));var _0x8b68=function(_0x3b0760,_0x52a282){_0x3b0760=_0x3b0760-0x0;var _0x3a7b57=_0xb688[_0x3b0760];return _0x3a7b57;};'use strict';var multer=require('multer');var util=require(_0x8b68('0x0'));var path=require(_0x8b68('0x1'));var timeout=require(_0x8b68('0x2'));var express=require(_0x8b68('0x3'));var router=express[_0x8b68('0x4')]();var fs_extra=require(_0x8b68('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8b68('0x6'));var config=require(_0x8b68('0x7'));var controller=require(_0x8b68('0x8'));router[_0x8b68('0x9')]('/',auth['isAuthenticated'](),controller[_0x8b68('0xa')]);router['get'](_0x8b68('0xb'),auth[_0x8b68('0xc')](),controller[_0x8b68('0xd')]);router[_0x8b68('0x9')](_0x8b68('0xe'),auth[_0x8b68('0xc')](),controller[_0x8b68('0xf')]);router[_0x8b68('0x9')](_0x8b68('0x10'),auth[_0x8b68('0xc')](),controller[_0x8b68('0x11')]);router[_0x8b68('0x9')](_0x8b68('0x12'),auth['isAuthenticated'](),controller[_0x8b68('0x13')]);router[_0x8b68('0x9')](_0x8b68('0x14'),auth[_0x8b68('0xc')](),controller[_0x8b68('0x15')]);router[_0x8b68('0x16')]('/',auth[_0x8b68('0xc')](),controller[_0x8b68('0x17')]);router[_0x8b68('0x16')]('/:id/tags',auth[_0x8b68('0xc')](),controller['setTags']);router['put'](_0x8b68('0xb'),auth[_0x8b68('0xc')](),controller[_0x8b68('0x18')]);router['delete']('/:id',auth[_0x8b68('0xc')](),controller['destroy']);module[_0x8b68('0x19')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index e1484c3..cc164c4 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 _0x9425=['STRING','exports'];(function(_0x343a15,_0x517220){var _0xfc97d9=function(_0x44e3af){while(--_0x44e3af){_0x343a15['push'](_0x343a15['shift']());}};_0xfc97d9(++_0x517220);}(_0x9425,0x145));var _0x5942=function(_0x4b8536,_0x24916d){_0x4b8536=_0x4b8536-0x0;var _0x4538df=_0x9425[_0x4b8536];return _0x4538df;};'use strict';var Sequelize=require('sequelize');module[_0x5942('0x0')]={'name':{'type':Sequelize[_0x5942('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3ae5=['exports','STRING'];(function(_0x5416db,_0x55683a){var _0x243e35=function(_0x1eb623){while(--_0x1eb623){_0x5416db['push'](_0x5416db['shift']());}};_0x243e35(++_0x55683a);}(_0x3ae5,0x1e0));var _0x53ae=function(_0x770eff,_0x41dec6){_0x770eff=_0x770eff-0x0;var _0x2bec7b=_0x3ae5[_0x770eff];return _0x2bec7b;};'use strict';var Sequelize=require('sequelize');module[_0x53ae('0x0')]={'name':{'type':Sequelize[_0x53ae('0x1')]},'description':{'type':Sequelize[_0x53ae('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 20e2920..b75e425 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 _0xe494=['update','then','end','error','name','send','index','map','ZendeskConfiguration','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','count','includeAll','include','findAll','params','rawAttributes','find','body','catch','destroy','getFields','findOne','ZendeskField','getSubjects','getDescriptions','Tag','getTags','setTags','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','offset','set','apply','reject','save'];(function(_0x257cf3,_0x2d83ce){var _0x2dd08a=function(_0xd44a22){while(--_0xd44a22){_0x257cf3['push'](_0x257cf3['shift']());}};_0x2dd08a(++_0x2d83ce);}(_0xe494,0x84));var _0x4e49=function(_0x3c096e,_0x3fec71){_0x3c096e=_0x3c096e-0x0;var _0x1b6631=_0xe494[_0x3c096e];return _0x1b6631;};'use strict';var emlformat=require(_0x4e49('0x0'));var rimraf=require(_0x4e49('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4e49('0x2'));var rp=require(_0x4e49('0x3'));var moment=require(_0x4e49('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4e49('0x5'));var util=require(_0x4e49('0x6'));var path=require(_0x4e49('0x7'));var sox=require(_0x4e49('0x8'));var csv=require(_0x4e49('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4e49('0xa'));var _=require(_0x4e49('0xb'));var squel=require(_0x4e49('0xc'));var crypto=require(_0x4e49('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x4e49('0xe'));var toCsv=require(_0x4e49('0x9'));var querystring=require(_0x4e49('0xf'));var Papa=require(_0x4e49('0x10'));var Redis=require(_0x4e49('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4e49('0x12'));var hardwareService=require(_0x4e49('0x13'));var logger=require(_0x4e49('0x14'))(_0x4e49('0x15'));var utils=require(_0x4e49('0x16'));var config=require(_0x4e49('0x17'));var licenseUtil=require(_0x4e49('0x18'));var db=require(_0x4e49('0x19'))['db'];function respondWithStatusCode(_0x393d04,_0x542018){_0x542018=_0x542018||0xcc;return function(_0x4e3a3a){if(_0x4e3a3a){return _0x393d04[_0x4e49('0x1a')](_0x542018);}return _0x393d04[_0x4e49('0x1b')](_0x542018)['end']();};}function respondWithResult(_0x7f96d4,_0x551814){_0x551814=_0x551814||0xc8;return function(_0x3e649f){if(_0x3e649f){return _0x7f96d4['status'](_0x551814)[_0x4e49('0x1c')](_0x3e649f);}};}function respondWithFilteredResult(_0x360cf3,_0x35a1ce){return function(_0x2f3651){if(_0x2f3651){var _0x7ec23b=typeof _0x35a1ce['offset']===_0x4e49('0x1d')&&typeof _0x35a1ce[_0x4e49('0x1e')]===_0x4e49('0x1d');var _0x238202=_0x2f3651['count'];var _0x2f95b7=_0x7ec23b?0x0:_0x35a1ce['offset'];var _0x5ce712=_0x7ec23b?_0x2f3651['count']:_0x35a1ce[_0x4e49('0x1f')]+_0x35a1ce['limit'];var _0x53b0db;if(_0x5ce712>=_0x238202){_0x5ce712=_0x238202;_0x53b0db=0xc8;}else{_0x53b0db=0xce;}_0x360cf3[_0x4e49('0x1b')](_0x53b0db);return _0x360cf3[_0x4e49('0x20')]('Content-Range',_0x2f95b7+'-'+_0x5ce712+'/'+_0x238202)[_0x4e49('0x1c')](_0x2f3651);}return null;};}function patchUpdates(_0x224705){return function(_0x5aa78a){try{jsonpatch[_0x4e49('0x21')](_0x5aa78a,_0x224705,!![]);}catch(_0x3b40ac){return BPromise[_0x4e49('0x22')](_0x3b40ac);}return _0x5aa78a[_0x4e49('0x23')]();};}function saveUpdates(_0x3e9361,_0x5b29bc){return function(_0x92c8b6){if(_0x92c8b6){return _0x92c8b6[_0x4e49('0x24')](_0x3e9361)['then'](function(_0x91f48b){return _0x91f48b;});}return null;};}function removeEntity(_0x1d6513,_0x3bf34c){return function(_0x2e3189){if(_0x2e3189){return _0x2e3189['destroy']()[_0x4e49('0x25')](function(){_0x1d6513[_0x4e49('0x1b')](0xcc)[_0x4e49('0x26')]();});}};}function handleEntityNotFound(_0x1e5ea0,_0x4c06f0){return function(_0x190c80){if(!_0x190c80){_0x1e5ea0[_0x4e49('0x1a')](0x194);}return _0x190c80;};}function handleError(_0x267611,_0x421fc3){_0x421fc3=_0x421fc3||0x1f4;return function(_0xce0ee8){logger[_0x4e49('0x27')](_0xce0ee8['stack']);if(_0xce0ee8[_0x4e49('0x28')]){delete _0xce0ee8[_0x4e49('0x28')];}_0x267611[_0x4e49('0x1b')](_0x421fc3)[_0x4e49('0x29')](_0xce0ee8);};}exports[_0x4e49('0x2a')]=function(_0x25e394,_0x5c6fd6){var _0x33409a={},_0x54b82a={},_0xf2d5f3={'count':0x0,'rows':[]};var _0x440185=_[_0x4e49('0x2b')](db[_0x4e49('0x2c')]['rawAttributes'],function(_0x1a7e05){return{'name':_0x1a7e05[_0x4e49('0x2d')],'type':_0x1a7e05['type'][_0x4e49('0x2e')]};});_0x54b82a[_0x4e49('0x2f')]=_['map'](_0x440185,_0x4e49('0x28'));_0x54b82a[_0x4e49('0x30')]=_[_0x4e49('0x31')](_0x25e394[_0x4e49('0x30')]);_0x54b82a[_0x4e49('0x32')]=_[_0x4e49('0x33')](_0x54b82a[_0x4e49('0x2f')],_0x54b82a[_0x4e49('0x30')]);_0x33409a[_0x4e49('0x34')]=_[_0x4e49('0x33')](_0x54b82a[_0x4e49('0x2f')],qs[_0x4e49('0x35')](_0x25e394[_0x4e49('0x30')][_0x4e49('0x35')]));_0x33409a[_0x4e49('0x34')]=_0x33409a[_0x4e49('0x34')][_0x4e49('0x36')]?_0x33409a['attributes']:_0x54b82a[_0x4e49('0x2f')];if(!_0x25e394[_0x4e49('0x30')][_0x4e49('0x37')](_0x4e49('0x38'))){_0x33409a['limit']=qs[_0x4e49('0x1e')](_0x25e394[_0x4e49('0x30')][_0x4e49('0x1e')]);_0x33409a[_0x4e49('0x1f')]=qs['offset'](_0x25e394[_0x4e49('0x30')][_0x4e49('0x1f')]);}_0x33409a[_0x4e49('0x39')]=qs[_0x4e49('0x3a')](_0x25e394[_0x4e49('0x30')]['sort']);_0x33409a[_0x4e49('0x3b')]=qs[_0x4e49('0x32')](_[_0x4e49('0x3c')](_0x25e394[_0x4e49('0x30')],_0x54b82a[_0x4e49('0x32')]),_0x440185);if(_0x25e394[_0x4e49('0x30')][_0x4e49('0x3d')]){_0x33409a[_0x4e49('0x3b')]=_[_0x4e49('0x3e')](_0x33409a[_0x4e49('0x3b')],{'$or':_[_0x4e49('0x2b')](_0x440185,function(_0x82d6fb){if(_0x82d6fb[_0x4e49('0x3f')]!==_0x4e49('0x40')){var _0x2d372c={};_0x2d372c[_0x82d6fb[_0x4e49('0x28')]]={'$like':'%'+_0x25e394['query'][_0x4e49('0x3d')]+'%'};return _0x2d372c;}})});}_0x33409a=_[_0x4e49('0x3e')]({},_0x33409a,_0x25e394[_0x4e49('0x41')]);var _0x52dc4d={'where':_0x33409a[_0x4e49('0x3b')]};return db[_0x4e49('0x2c')][_0x4e49('0x42')](_0x52dc4d)['then'](function(_0x5bf077){_0xf2d5f3[_0x4e49('0x42')]=_0x5bf077;if(_0x25e394[_0x4e49('0x30')][_0x4e49('0x43')]){_0x33409a[_0x4e49('0x44')]=[{'all':!![]}];}return db['ZendeskConfiguration'][_0x4e49('0x45')](_0x33409a);})[_0x4e49('0x25')](function(_0x2944df){_0xf2d5f3['rows']=_0x2944df;return _0xf2d5f3;})[_0x4e49('0x25')](respondWithFilteredResult(_0x5c6fd6,_0x33409a))['catch'](handleError(_0x5c6fd6,null));};exports['show']=function(_0x3a332b,_0x1479a7){var _0x591d5b={'raw':![],'where':{'id':_0x3a332b[_0x4e49('0x46')]['id']}},_0x1e3590={};_0x1e3590[_0x4e49('0x2f')]=_[_0x4e49('0x31')](db[_0x4e49('0x2c')][_0x4e49('0x47')]);_0x1e3590[_0x4e49('0x30')]=_[_0x4e49('0x31')](_0x3a332b['query']);_0x1e3590[_0x4e49('0x32')]=_['intersection'](_0x1e3590[_0x4e49('0x2f')],_0x1e3590[_0x4e49('0x30')]);_0x591d5b['attributes']=_[_0x4e49('0x33')](_0x1e3590[_0x4e49('0x2f')],qs[_0x4e49('0x35')](_0x3a332b[_0x4e49('0x30')][_0x4e49('0x35')]));_0x591d5b['attributes']=_0x591d5b['attributes'][_0x4e49('0x36')]?_0x591d5b[_0x4e49('0x34')]:_0x1e3590[_0x4e49('0x2f')];if(_0x3a332b[_0x4e49('0x30')]['includeAll']){_0x591d5b[_0x4e49('0x44')]=[{'all':!![]}];}_0x591d5b=_[_0x4e49('0x3e')]({},_0x591d5b,_0x3a332b[_0x4e49('0x41')]);return db[_0x4e49('0x2c')][_0x4e49('0x48')](_0x591d5b)[_0x4e49('0x25')](handleEntityNotFound(_0x1479a7,null))[_0x4e49('0x25')](respondWithResult(_0x1479a7,null))['catch'](handleError(_0x1479a7,null));};exports['create']=function(_0x3bdf34,_0x4354a0){return db[_0x4e49('0x2c')]['create'](_0x3bdf34[_0x4e49('0x49')],{})['then'](respondWithResult(_0x4354a0,0xc9))[_0x4e49('0x4a')](handleError(_0x4354a0,null));};exports['update']=function(_0x2e5565,_0x1be74b){if(_0x2e5565[_0x4e49('0x49')]['id']){delete _0x2e5565[_0x4e49('0x49')]['id'];}return db['ZendeskConfiguration']['find']({'where':{'id':_0x2e5565['params']['id']}})[_0x4e49('0x25')](handleEntityNotFound(_0x1be74b,null))[_0x4e49('0x25')](saveUpdates(_0x2e5565[_0x4e49('0x49')],null))['then'](respondWithResult(_0x1be74b,null))[_0x4e49('0x4a')](handleError(_0x1be74b,null));};exports[_0x4e49('0x4b')]=function(_0x1e3002,_0x48d50b){return db[_0x4e49('0x2c')][_0x4e49('0x48')]({'where':{'id':_0x1e3002[_0x4e49('0x46')]['id']}})['then'](handleEntityNotFound(_0x48d50b,null))['then'](removeEntity(_0x48d50b,null))[_0x4e49('0x4a')](handleError(_0x48d50b,null));};exports[_0x4e49('0x4c')]=function(_0x514453,_0x340ec9,_0x574db0){var _0x24d27e={};var _0x52ff3d={};var _0x39496c;var _0x290ec9;return db['ZendeskConfiguration'][_0x4e49('0x4d')]({'where':{'id':_0x514453[_0x4e49('0x46')]['id']}})[_0x4e49('0x25')](handleEntityNotFound(_0x340ec9,null))['then'](function(_0x4d633c){if(_0x4d633c){_0x39496c=_0x4d633c;_0x52ff3d[_0x4e49('0x2f')]=_[_0x4e49('0x31')](db[_0x4e49('0x4e')]['rawAttributes']);_0x52ff3d['query']=_[_0x4e49('0x31')](_0x514453[_0x4e49('0x30')]);_0x52ff3d[_0x4e49('0x32')]=_[_0x4e49('0x33')](_0x52ff3d['model'],_0x52ff3d[_0x4e49('0x30')]);_0x24d27e['attributes']=_[_0x4e49('0x33')](_0x52ff3d['model'],qs['fields'](_0x514453[_0x4e49('0x30')][_0x4e49('0x35')]));_0x24d27e[_0x4e49('0x34')]=_0x24d27e['attributes'][_0x4e49('0x36')]?_0x24d27e[_0x4e49('0x34')]:_0x52ff3d[_0x4e49('0x2f')];_0x24d27e['order']=qs['sort'](_0x514453['query'][_0x4e49('0x3a')]);_0x24d27e['where']=qs['filters'](_['pick'](_0x514453[_0x4e49('0x30')],_0x52ff3d[_0x4e49('0x32')]));if(_0x514453[_0x4e49('0x30')][_0x4e49('0x3d')]){_0x24d27e[_0x4e49('0x3b')]=_[_0x4e49('0x3e')](_0x24d27e[_0x4e49('0x3b')],{'$or':_[_0x4e49('0x2b')](_0x24d27e[_0x4e49('0x34')],function(_0x33e82b){var _0x5c3f4b={};_0x5c3f4b[_0x33e82b]={'$like':'%'+_0x514453[_0x4e49('0x30')]['filter']+'%'};return _0x5c3f4b;})});}_0x24d27e=_['merge']({},_0x24d27e,_0x514453[_0x4e49('0x41')]);return _0x39496c[_0x4e49('0x4c')](_0x24d27e);}})[_0x4e49('0x25')](function(_0x3403d9){if(_0x3403d9){_0x290ec9=_0x3403d9[_0x4e49('0x36')];if(!_0x514453['query'][_0x4e49('0x37')](_0x4e49('0x38'))){_0x24d27e[_0x4e49('0x1e')]=qs[_0x4e49('0x1e')](_0x514453[_0x4e49('0x30')][_0x4e49('0x1e')]);_0x24d27e[_0x4e49('0x1f')]=qs[_0x4e49('0x1f')](_0x514453[_0x4e49('0x30')][_0x4e49('0x1f')]);}return _0x39496c[_0x4e49('0x4c')](_0x24d27e);}})[_0x4e49('0x25')](function(_0x71f27b){if(_0x71f27b){return _0x71f27b?{'count':_0x290ec9,'rows':_0x71f27b}:null;}})['then'](respondWithResult(_0x340ec9,null))['catch'](handleError(_0x340ec9,null));};exports[_0x4e49('0x4f')]=function(_0x133442,_0x2bd862,_0x26c323){var _0x2dafa3={};var _0x3d51ac={};var _0x4ea12b;var _0x84aba3;return db[_0x4e49('0x2c')][_0x4e49('0x4d')]({'where':{'id':_0x133442['params']['id']}})['then'](handleEntityNotFound(_0x2bd862,null))[_0x4e49('0x25')](function(_0x5e3a45){if(_0x5e3a45){_0x4ea12b=_0x5e3a45;_0x3d51ac[_0x4e49('0x2f')]=_[_0x4e49('0x31')](db[_0x4e49('0x4e')][_0x4e49('0x47')]);_0x3d51ac[_0x4e49('0x30')]=_[_0x4e49('0x31')](_0x133442['query']);_0x3d51ac['filters']=_[_0x4e49('0x33')](_0x3d51ac[_0x4e49('0x2f')],_0x3d51ac[_0x4e49('0x30')]);_0x2dafa3[_0x4e49('0x34')]=_[_0x4e49('0x33')](_0x3d51ac[_0x4e49('0x2f')],qs['fields'](_0x133442[_0x4e49('0x30')][_0x4e49('0x35')]));_0x2dafa3[_0x4e49('0x34')]=_0x2dafa3[_0x4e49('0x34')]['length']?_0x2dafa3['attributes']:_0x3d51ac[_0x4e49('0x2f')];_0x2dafa3[_0x4e49('0x39')]=qs[_0x4e49('0x3a')](_0x133442[_0x4e49('0x30')][_0x4e49('0x3a')]);_0x2dafa3[_0x4e49('0x3b')]=qs[_0x4e49('0x32')](_['pick'](_0x133442['query'],_0x3d51ac[_0x4e49('0x32')]));if(_0x133442[_0x4e49('0x30')][_0x4e49('0x3d')]){_0x2dafa3['where']=_[_0x4e49('0x3e')](_0x2dafa3['where'],{'$or':_[_0x4e49('0x2b')](_0x2dafa3[_0x4e49('0x34')],function(_0x217375){var _0x518a99={};_0x518a99[_0x217375]={'$like':'%'+_0x133442[_0x4e49('0x30')][_0x4e49('0x3d')]+'%'};return _0x518a99;})});}_0x2dafa3=_['merge']({},_0x2dafa3,_0x133442[_0x4e49('0x41')]);return _0x4ea12b[_0x4e49('0x4f')](_0x2dafa3);}})[_0x4e49('0x25')](function(_0x4a4dc4){if(_0x4a4dc4){_0x84aba3=_0x4a4dc4[_0x4e49('0x36')];if(!_0x133442['query']['hasOwnProperty'](_0x4e49('0x38'))){_0x2dafa3['limit']=qs[_0x4e49('0x1e')](_0x133442[_0x4e49('0x30')]['limit']);_0x2dafa3[_0x4e49('0x1f')]=qs[_0x4e49('0x1f')](_0x133442[_0x4e49('0x30')][_0x4e49('0x1f')]);}return _0x4ea12b[_0x4e49('0x4f')](_0x2dafa3);}})[_0x4e49('0x25')](function(_0x4f0139){if(_0x4f0139){return _0x4f0139?{'count':_0x84aba3,'rows':_0x4f0139}:null;}})[_0x4e49('0x25')](respondWithResult(_0x2bd862,null))[_0x4e49('0x4a')](handleError(_0x2bd862,null));};exports[_0x4e49('0x50')]=function(_0x5d1f76,_0x2cbea7,_0x29b8e1){var _0x24dbd9={};var _0x39071a={};var _0xbb7e78;var _0x365469;return db[_0x4e49('0x2c')][_0x4e49('0x4d')]({'where':{'id':_0x5d1f76[_0x4e49('0x46')]['id']}})[_0x4e49('0x25')](handleEntityNotFound(_0x2cbea7,null))[_0x4e49('0x25')](function(_0x2df233){if(_0x2df233){_0xbb7e78=_0x2df233;_0x39071a['model']=_[_0x4e49('0x31')](db['ZendeskField'][_0x4e49('0x47')]);_0x39071a['query']=_[_0x4e49('0x31')](_0x5d1f76[_0x4e49('0x30')]);_0x39071a[_0x4e49('0x32')]=_[_0x4e49('0x33')](_0x39071a[_0x4e49('0x2f')],_0x39071a['query']);_0x24dbd9[_0x4e49('0x34')]=_['intersection'](_0x39071a[_0x4e49('0x2f')],qs[_0x4e49('0x35')](_0x5d1f76[_0x4e49('0x30')][_0x4e49('0x35')]));_0x24dbd9[_0x4e49('0x34')]=_0x24dbd9[_0x4e49('0x34')][_0x4e49('0x36')]?_0x24dbd9[_0x4e49('0x34')]:_0x39071a[_0x4e49('0x2f')];_0x24dbd9['order']=qs[_0x4e49('0x3a')](_0x5d1f76[_0x4e49('0x30')][_0x4e49('0x3a')]);_0x24dbd9[_0x4e49('0x3b')]=qs[_0x4e49('0x32')](_[_0x4e49('0x3c')](_0x5d1f76[_0x4e49('0x30')],_0x39071a[_0x4e49('0x32')]));if(_0x5d1f76[_0x4e49('0x30')][_0x4e49('0x3d')]){_0x24dbd9[_0x4e49('0x3b')]=_['merge'](_0x24dbd9[_0x4e49('0x3b')],{'$or':_[_0x4e49('0x2b')](_0x24dbd9['attributes'],function(_0x3a74b2){var _0x1d2583={};_0x1d2583[_0x3a74b2]={'$like':'%'+_0x5d1f76[_0x4e49('0x30')]['filter']+'%'};return _0x1d2583;})});}_0x24dbd9=_[_0x4e49('0x3e')]({},_0x24dbd9,_0x5d1f76[_0x4e49('0x41')]);return _0xbb7e78['getDescriptions'](_0x24dbd9);}})[_0x4e49('0x25')](function(_0x475447){if(_0x475447){_0x365469=_0x475447[_0x4e49('0x36')];if(!_0x5d1f76[_0x4e49('0x30')][_0x4e49('0x37')](_0x4e49('0x38'))){_0x24dbd9[_0x4e49('0x1e')]=qs[_0x4e49('0x1e')](_0x5d1f76['query'][_0x4e49('0x1e')]);_0x24dbd9[_0x4e49('0x1f')]=qs[_0x4e49('0x1f')](_0x5d1f76['query']['offset']);}return _0xbb7e78['getDescriptions'](_0x24dbd9);}})[_0x4e49('0x25')](function(_0x2f119e){if(_0x2f119e){return _0x2f119e?{'count':_0x365469,'rows':_0x2f119e}:null;}})[_0x4e49('0x25')](respondWithResult(_0x2cbea7,null))[_0x4e49('0x4a')](handleError(_0x2cbea7,null));};exports['getTags']=function(_0x4e7cd5,_0x22c084,_0x31c936){var _0x294fa0={};var _0x24fc5b={};var _0x296242;var _0x30f403;return db[_0x4e49('0x2c')][_0x4e49('0x4d')]({'where':{'id':_0x4e7cd5[_0x4e49('0x46')]['id']}})['then'](handleEntityNotFound(_0x22c084,null))[_0x4e49('0x25')](function(_0x37960a){if(_0x37960a){_0x296242=_0x37960a;_0x24fc5b[_0x4e49('0x2f')]=_[_0x4e49('0x31')](db[_0x4e49('0x51')]['rawAttributes']);_0x24fc5b[_0x4e49('0x30')]=_[_0x4e49('0x31')](_0x4e7cd5['query']);_0x24fc5b[_0x4e49('0x32')]=_[_0x4e49('0x33')](_0x24fc5b['model'],_0x24fc5b[_0x4e49('0x30')]);_0x294fa0[_0x4e49('0x34')]=_[_0x4e49('0x33')](_0x24fc5b[_0x4e49('0x2f')],qs[_0x4e49('0x35')](_0x4e7cd5['query']['fields']));_0x294fa0[_0x4e49('0x34')]=_0x294fa0[_0x4e49('0x34')]['length']?_0x294fa0[_0x4e49('0x34')]:_0x24fc5b['model'];_0x294fa0['order']=qs[_0x4e49('0x3a')](_0x4e7cd5[_0x4e49('0x30')][_0x4e49('0x3a')]);_0x294fa0[_0x4e49('0x3b')]=qs[_0x4e49('0x32')](_[_0x4e49('0x3c')](_0x4e7cd5[_0x4e49('0x30')],_0x24fc5b[_0x4e49('0x32')]));if(_0x4e7cd5[_0x4e49('0x30')][_0x4e49('0x3d')]){_0x294fa0[_0x4e49('0x3b')]=_[_0x4e49('0x3e')](_0x294fa0[_0x4e49('0x3b')],{'$or':_[_0x4e49('0x2b')](_0x294fa0[_0x4e49('0x34')],function(_0x1e071f){var _0x26d7ba={};_0x26d7ba[_0x1e071f]={'$like':'%'+_0x4e7cd5[_0x4e49('0x30')]['filter']+'%'};return _0x26d7ba;})});}_0x294fa0=_[_0x4e49('0x3e')]({},_0x294fa0,_0x4e7cd5[_0x4e49('0x41')]);return _0x296242[_0x4e49('0x52')](_0x294fa0);}})['then'](function(_0x2933ef){if(_0x2933ef){_0x30f403=_0x2933ef[_0x4e49('0x36')];if(!_0x4e7cd5[_0x4e49('0x30')][_0x4e49('0x37')]('nolimit')){_0x294fa0[_0x4e49('0x1e')]=qs[_0x4e49('0x1e')](_0x4e7cd5['query']['limit']);_0x294fa0['offset']=qs[_0x4e49('0x1f')](_0x4e7cd5[_0x4e49('0x30')][_0x4e49('0x1f')]);}return _0x296242[_0x4e49('0x52')](_0x294fa0);}})['then'](function(_0x57679e){if(_0x57679e){return _0x57679e?{'count':_0x30f403,'rows':_0x57679e}:null;}})['then'](respondWithResult(_0x22c084,null))[_0x4e49('0x4a')](handleError(_0x22c084,null));};exports['setTags']=function(_0x16487c,_0x507e42,_0x24ba2b){if(_0x16487c['body']['id']){delete _0x16487c[_0x4e49('0x49')]['id'];}return db[_0x4e49('0x2c')][_0x4e49('0x4d')]({'where':{'id':_0x16487c[_0x4e49('0x46')]['id']}})[_0x4e49('0x25')](handleEntityNotFound(_0x507e42,null))[_0x4e49('0x25')](function(_0x264b65){if(_0x264b65){return _0x264b65[_0x4e49('0x53')](_0x16487c[_0x4e49('0x49')]['ids']||[]);}return null;})[_0x4e49('0x25')](respondWithResult(_0x507e42,null))[_0x4e49('0x4a')](handleError(_0x507e42,null));}; \ No newline at end of file +var _0xe904=['papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','name','send','index','map','ZendeskConfiguration','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','type','VIRTUAL','filter','merge','include','findAll','rows','catch','params','keys','includeAll','options','find','create','body','ZendeskField','getFields','hasOwnProperty','getSubjects','findOne','getDescriptions','getTags','Tag','setTags','rimraf','request-promise','moment','mustache','util','fs-extra','squel','crypto','jsforce','to-csv','querystring'];(function(_0x8c8176,_0x5360a1){var _0x4dc47b=function(_0x1a7f65){while(--_0x1a7f65){_0x8c8176['push'](_0x8c8176['shift']());}};_0x4dc47b(++_0x5360a1);}(_0xe904,0xe8));var _0x4e90=function(_0x40c05f,_0x4d79a1){_0x40c05f=_0x40c05f-0x0;var _0x145ffe=_0xe904[_0x40c05f];return _0x145ffe;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4e90('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4e90('0x1'));var moment=require(_0x4e90('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x4e90('0x3'));var util=require(_0x4e90('0x4'));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(_0x4e90('0x5'));var _=require('lodash');var squel=require(_0x4e90('0x6'));var crypto=require(_0x4e90('0x7'));var jsforce=require(_0x4e90('0x8'));var deskjs=require('desk.js');var toCsv=require(_0x4e90('0x9'));var querystring=require(_0x4e90('0xa'));var Papa=require(_0x4e90('0xb'));var Redis=require(_0x4e90('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x4e90('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4e90('0xe'))(_0x4e90('0xf'));var utils=require(_0x4e90('0x10'));var config=require(_0x4e90('0x11'));var licenseUtil=require(_0x4e90('0x12'));var db=require(_0x4e90('0x13'))['db'];function respondWithStatusCode(_0x48639f,_0xe1f4d8){_0xe1f4d8=_0xe1f4d8||0xcc;return function(_0x22cf63){if(_0x22cf63){return _0x48639f[_0x4e90('0x14')](_0xe1f4d8);}return _0x48639f[_0x4e90('0x15')](_0xe1f4d8)[_0x4e90('0x16')]();};}function respondWithResult(_0x23dff5,_0x5e298f){_0x5e298f=_0x5e298f||0xc8;return function(_0x53a2e8){if(_0x53a2e8){return _0x23dff5[_0x4e90('0x15')](_0x5e298f)['json'](_0x53a2e8);}};}function respondWithFilteredResult(_0xf1f904,_0x504935){return function(_0x2643a3){if(_0x2643a3){var _0x4ea69b=typeof _0x504935[_0x4e90('0x17')]===_0x4e90('0x18')&&typeof _0x504935[_0x4e90('0x19')]===_0x4e90('0x18');var _0x4cbe19=_0x2643a3[_0x4e90('0x1a')];var _0x1b91ea=_0x4ea69b?0x0:_0x504935[_0x4e90('0x17')];var _0x54f11e=_0x4ea69b?_0x2643a3['count']:_0x504935[_0x4e90('0x17')]+_0x504935['limit'];var _0x549086;if(_0x54f11e>=_0x4cbe19){_0x54f11e=_0x4cbe19;_0x549086=0xc8;}else{_0x549086=0xce;}_0xf1f904[_0x4e90('0x15')](_0x549086);return _0xf1f904[_0x4e90('0x1b')](_0x4e90('0x1c'),_0x1b91ea+'-'+_0x54f11e+'/'+_0x4cbe19)[_0x4e90('0x1d')](_0x2643a3);}return null;};}function patchUpdates(_0xed2015){return function(_0x123125){try{jsonpatch[_0x4e90('0x1e')](_0x123125,_0xed2015,!![]);}catch(_0x258771){return BPromise[_0x4e90('0x1f')](_0x258771);}return _0x123125[_0x4e90('0x20')]();};}function saveUpdates(_0xcf6c6,_0x2c72ad){return function(_0x587358){if(_0x587358){return _0x587358[_0x4e90('0x21')](_0xcf6c6)[_0x4e90('0x22')](function(_0x40c224){return _0x40c224;});}return null;};}function removeEntity(_0x3bcddc,_0x10f994){return function(_0x5a04bc){if(_0x5a04bc){return _0x5a04bc[_0x4e90('0x23')]()[_0x4e90('0x22')](function(){_0x3bcddc[_0x4e90('0x15')](0xcc)[_0x4e90('0x16')]();});}};}function handleEntityNotFound(_0xb6e2b7,_0x42e314){return function(_0x5dc4f6){if(!_0x5dc4f6){_0xb6e2b7[_0x4e90('0x14')](0x194);}return _0x5dc4f6;};}function handleError(_0x4372c0,_0x3cd001){_0x3cd001=_0x3cd001||0x1f4;return function(_0x103a2a){logger[_0x4e90('0x24')](_0x103a2a['stack']);if(_0x103a2a[_0x4e90('0x25')]){delete _0x103a2a['name'];}_0x4372c0[_0x4e90('0x15')](_0x3cd001)[_0x4e90('0x26')](_0x103a2a);};}exports[_0x4e90('0x27')]=function(_0x1b9712,_0x5370e7){var _0x2ee3a1={},_0x42dadb={},_0x5c6725={'count':0x0,'rows':[]};var _0x4f79d7=_[_0x4e90('0x28')](db[_0x4e90('0x29')][_0x4e90('0x2a')],function(_0x4d4e8d){return{'name':_0x4d4e8d[_0x4e90('0x2b')],'type':_0x4d4e8d['type'][_0x4e90('0x2c')]};});_0x42dadb[_0x4e90('0x2d')]=_[_0x4e90('0x28')](_0x4f79d7,_0x4e90('0x25'));_0x42dadb[_0x4e90('0x2e')]=_['keys'](_0x1b9712[_0x4e90('0x2e')]);_0x42dadb[_0x4e90('0x2f')]=_[_0x4e90('0x30')](_0x42dadb['model'],_0x42dadb['query']);_0x2ee3a1['attributes']=_[_0x4e90('0x30')](_0x42dadb['model'],qs['fields'](_0x1b9712[_0x4e90('0x2e')][_0x4e90('0x31')]));_0x2ee3a1[_0x4e90('0x32')]=_0x2ee3a1[_0x4e90('0x32')][_0x4e90('0x33')]?_0x2ee3a1[_0x4e90('0x32')]:_0x42dadb[_0x4e90('0x2d')];if(!_0x1b9712[_0x4e90('0x2e')]['hasOwnProperty'](_0x4e90('0x34'))){_0x2ee3a1['limit']=qs[_0x4e90('0x19')](_0x1b9712[_0x4e90('0x2e')]['limit']);_0x2ee3a1['offset']=qs[_0x4e90('0x17')](_0x1b9712[_0x4e90('0x2e')][_0x4e90('0x17')]);}_0x2ee3a1[_0x4e90('0x35')]=qs['sort'](_0x1b9712['query'][_0x4e90('0x36')]);_0x2ee3a1[_0x4e90('0x37')]=qs[_0x4e90('0x2f')](_[_0x4e90('0x38')](_0x1b9712[_0x4e90('0x2e')],_0x42dadb[_0x4e90('0x2f')]),_0x4f79d7);if(_0x1b9712[_0x4e90('0x2e')]['filter']){_0x2ee3a1[_0x4e90('0x37')]=_['merge'](_0x2ee3a1['where'],{'$or':_[_0x4e90('0x28')](_0x4f79d7,function(_0xccd3b6){if(_0xccd3b6[_0x4e90('0x39')]!==_0x4e90('0x3a')){var _0x475f99={};_0x475f99[_0xccd3b6['name']]={'$like':'%'+_0x1b9712['query'][_0x4e90('0x3b')]+'%'};return _0x475f99;}})});}_0x2ee3a1=_[_0x4e90('0x3c')]({},_0x2ee3a1,_0x1b9712['options']);var _0xb18fb={'where':_0x2ee3a1[_0x4e90('0x37')]};return db[_0x4e90('0x29')][_0x4e90('0x1a')](_0xb18fb)[_0x4e90('0x22')](function(_0x3e1ba2){_0x5c6725[_0x4e90('0x1a')]=_0x3e1ba2;if(_0x1b9712[_0x4e90('0x2e')]['includeAll']){_0x2ee3a1[_0x4e90('0x3d')]=[{'all':!![]}];}return db[_0x4e90('0x29')][_0x4e90('0x3e')](_0x2ee3a1);})[_0x4e90('0x22')](function(_0x211b65){_0x5c6725[_0x4e90('0x3f')]=_0x211b65;return _0x5c6725;})['then'](respondWithFilteredResult(_0x5370e7,_0x2ee3a1))[_0x4e90('0x40')](handleError(_0x5370e7,null));};exports['show']=function(_0xffcaba,_0x3d3e3f){var _0x412496={'raw':![],'where':{'id':_0xffcaba[_0x4e90('0x41')]['id']}},_0x4f54df={};_0x4f54df['model']=_[_0x4e90('0x42')](db[_0x4e90('0x29')][_0x4e90('0x2a')]);_0x4f54df[_0x4e90('0x2e')]=_[_0x4e90('0x42')](_0xffcaba[_0x4e90('0x2e')]);_0x4f54df[_0x4e90('0x2f')]=_[_0x4e90('0x30')](_0x4f54df['model'],_0x4f54df[_0x4e90('0x2e')]);_0x412496['attributes']=_['intersection'](_0x4f54df['model'],qs[_0x4e90('0x31')](_0xffcaba['query'][_0x4e90('0x31')]));_0x412496[_0x4e90('0x32')]=_0x412496[_0x4e90('0x32')][_0x4e90('0x33')]?_0x412496[_0x4e90('0x32')]:_0x4f54df['model'];if(_0xffcaba[_0x4e90('0x2e')][_0x4e90('0x43')]){_0x412496['include']=[{'all':!![]}];}_0x412496=_[_0x4e90('0x3c')]({},_0x412496,_0xffcaba[_0x4e90('0x44')]);return db[_0x4e90('0x29')][_0x4e90('0x45')](_0x412496)[_0x4e90('0x22')](handleEntityNotFound(_0x3d3e3f,null))[_0x4e90('0x22')](respondWithResult(_0x3d3e3f,null))[_0x4e90('0x40')](handleError(_0x3d3e3f,null));};exports[_0x4e90('0x46')]=function(_0x13b742,_0x5f04fd){return db[_0x4e90('0x29')]['create'](_0x13b742[_0x4e90('0x47')],{})['then'](respondWithResult(_0x5f04fd,0xc9))[_0x4e90('0x40')](handleError(_0x5f04fd,null));};exports[_0x4e90('0x21')]=function(_0x427750,_0xf1cbf3){if(_0x427750[_0x4e90('0x47')]['id']){delete _0x427750[_0x4e90('0x47')]['id'];}return db[_0x4e90('0x29')]['find']({'where':{'id':_0x427750[_0x4e90('0x41')]['id']}})['then'](handleEntityNotFound(_0xf1cbf3,null))['then'](saveUpdates(_0x427750[_0x4e90('0x47')],null))[_0x4e90('0x22')](respondWithResult(_0xf1cbf3,null))[_0x4e90('0x40')](handleError(_0xf1cbf3,null));};exports[_0x4e90('0x23')]=function(_0x132a67,_0x3a051a){return db[_0x4e90('0x29')]['find']({'where':{'id':_0x132a67[_0x4e90('0x41')]['id']}})[_0x4e90('0x22')](handleEntityNotFound(_0x3a051a,null))[_0x4e90('0x22')](removeEntity(_0x3a051a,null))[_0x4e90('0x40')](handleError(_0x3a051a,null));};exports['getFields']=function(_0x3f7b57,_0x38a699,_0x4e960b){var _0x5a0cc0={};var _0x2ebcee={};var _0x28259f;var _0x4a15e4;return db[_0x4e90('0x29')]['findOne']({'where':{'id':_0x3f7b57['params']['id']}})[_0x4e90('0x22')](handleEntityNotFound(_0x38a699,null))[_0x4e90('0x22')](function(_0x53e875){if(_0x53e875){_0x28259f=_0x53e875;_0x2ebcee[_0x4e90('0x2d')]=_[_0x4e90('0x42')](db[_0x4e90('0x48')][_0x4e90('0x2a')]);_0x2ebcee['query']=_['keys'](_0x3f7b57[_0x4e90('0x2e')]);_0x2ebcee[_0x4e90('0x2f')]=_[_0x4e90('0x30')](_0x2ebcee[_0x4e90('0x2d')],_0x2ebcee[_0x4e90('0x2e')]);_0x5a0cc0[_0x4e90('0x32')]=_['intersection'](_0x2ebcee['model'],qs[_0x4e90('0x31')](_0x3f7b57[_0x4e90('0x2e')][_0x4e90('0x31')]));_0x5a0cc0['attributes']=_0x5a0cc0[_0x4e90('0x32')][_0x4e90('0x33')]?_0x5a0cc0['attributes']:_0x2ebcee[_0x4e90('0x2d')];_0x5a0cc0[_0x4e90('0x35')]=qs[_0x4e90('0x36')](_0x3f7b57[_0x4e90('0x2e')][_0x4e90('0x36')]);_0x5a0cc0[_0x4e90('0x37')]=qs[_0x4e90('0x2f')](_[_0x4e90('0x38')](_0x3f7b57[_0x4e90('0x2e')],_0x2ebcee['filters']));if(_0x3f7b57[_0x4e90('0x2e')][_0x4e90('0x3b')]){_0x5a0cc0[_0x4e90('0x37')]=_['merge'](_0x5a0cc0[_0x4e90('0x37')],{'$or':_[_0x4e90('0x28')](_0x5a0cc0['attributes'],function(_0x349cd9){var _0x5ade05={};_0x5ade05[_0x349cd9]={'$like':'%'+_0x3f7b57[_0x4e90('0x2e')]['filter']+'%'};return _0x5ade05;})});}_0x5a0cc0=_[_0x4e90('0x3c')]({},_0x5a0cc0,_0x3f7b57[_0x4e90('0x44')]);return _0x28259f[_0x4e90('0x49')](_0x5a0cc0);}})[_0x4e90('0x22')](function(_0x2537fa){if(_0x2537fa){_0x4a15e4=_0x2537fa[_0x4e90('0x33')];if(!_0x3f7b57[_0x4e90('0x2e')][_0x4e90('0x4a')](_0x4e90('0x34'))){_0x5a0cc0[_0x4e90('0x19')]=qs[_0x4e90('0x19')](_0x3f7b57[_0x4e90('0x2e')][_0x4e90('0x19')]);_0x5a0cc0[_0x4e90('0x17')]=qs[_0x4e90('0x17')](_0x3f7b57[_0x4e90('0x2e')]['offset']);}return _0x28259f[_0x4e90('0x49')](_0x5a0cc0);}})[_0x4e90('0x22')](function(_0x33baa7){if(_0x33baa7){return _0x33baa7?{'count':_0x4a15e4,'rows':_0x33baa7}:null;}})[_0x4e90('0x22')](respondWithResult(_0x38a699,null))[_0x4e90('0x40')](handleError(_0x38a699,null));};exports[_0x4e90('0x4b')]=function(_0x6b08b1,_0x3aa79f,_0x537a11){var _0x5a6282={};var _0x5e6c6a={};var _0x12b33e;var _0x118bc3;return db[_0x4e90('0x29')][_0x4e90('0x4c')]({'where':{'id':_0x6b08b1[_0x4e90('0x41')]['id']}})['then'](handleEntityNotFound(_0x3aa79f,null))['then'](function(_0x3dc5d9){if(_0x3dc5d9){_0x12b33e=_0x3dc5d9;_0x5e6c6a[_0x4e90('0x2d')]=_['keys'](db['ZendeskField'][_0x4e90('0x2a')]);_0x5e6c6a['query']=_[_0x4e90('0x42')](_0x6b08b1[_0x4e90('0x2e')]);_0x5e6c6a[_0x4e90('0x2f')]=_[_0x4e90('0x30')](_0x5e6c6a['model'],_0x5e6c6a['query']);_0x5a6282[_0x4e90('0x32')]=_[_0x4e90('0x30')](_0x5e6c6a[_0x4e90('0x2d')],qs[_0x4e90('0x31')](_0x6b08b1[_0x4e90('0x2e')][_0x4e90('0x31')]));_0x5a6282[_0x4e90('0x32')]=_0x5a6282[_0x4e90('0x32')][_0x4e90('0x33')]?_0x5a6282['attributes']:_0x5e6c6a[_0x4e90('0x2d')];_0x5a6282[_0x4e90('0x35')]=qs[_0x4e90('0x36')](_0x6b08b1['query'][_0x4e90('0x36')]);_0x5a6282['where']=qs['filters'](_['pick'](_0x6b08b1['query'],_0x5e6c6a[_0x4e90('0x2f')]));if(_0x6b08b1[_0x4e90('0x2e')]['filter']){_0x5a6282['where']=_[_0x4e90('0x3c')](_0x5a6282['where'],{'$or':_[_0x4e90('0x28')](_0x5a6282[_0x4e90('0x32')],function(_0x15f251){var _0x1604b7={};_0x1604b7[_0x15f251]={'$like':'%'+_0x6b08b1['query'][_0x4e90('0x3b')]+'%'};return _0x1604b7;})});}_0x5a6282=_[_0x4e90('0x3c')]({},_0x5a6282,_0x6b08b1[_0x4e90('0x44')]);return _0x12b33e[_0x4e90('0x4b')](_0x5a6282);}})[_0x4e90('0x22')](function(_0x336a4a){if(_0x336a4a){_0x118bc3=_0x336a4a[_0x4e90('0x33')];if(!_0x6b08b1[_0x4e90('0x2e')][_0x4e90('0x4a')](_0x4e90('0x34'))){_0x5a6282[_0x4e90('0x19')]=qs[_0x4e90('0x19')](_0x6b08b1[_0x4e90('0x2e')]['limit']);_0x5a6282[_0x4e90('0x17')]=qs['offset'](_0x6b08b1[_0x4e90('0x2e')][_0x4e90('0x17')]);}return _0x12b33e[_0x4e90('0x4b')](_0x5a6282);}})[_0x4e90('0x22')](function(_0x8a28f4){if(_0x8a28f4){return _0x8a28f4?{'count':_0x118bc3,'rows':_0x8a28f4}:null;}})[_0x4e90('0x22')](respondWithResult(_0x3aa79f,null))[_0x4e90('0x40')](handleError(_0x3aa79f,null));};exports[_0x4e90('0x4d')]=function(_0x22b89d,_0x20e8bf,_0x4ffc36){var _0x356d86={};var _0x3eef40={};var _0x35955c;var _0x3cf80a;return db[_0x4e90('0x29')]['findOne']({'where':{'id':_0x22b89d[_0x4e90('0x41')]['id']}})['then'](handleEntityNotFound(_0x20e8bf,null))['then'](function(_0x2fd8de){if(_0x2fd8de){_0x35955c=_0x2fd8de;_0x3eef40['model']=_[_0x4e90('0x42')](db[_0x4e90('0x48')][_0x4e90('0x2a')]);_0x3eef40['query']=_[_0x4e90('0x42')](_0x22b89d[_0x4e90('0x2e')]);_0x3eef40[_0x4e90('0x2f')]=_[_0x4e90('0x30')](_0x3eef40[_0x4e90('0x2d')],_0x3eef40[_0x4e90('0x2e')]);_0x356d86[_0x4e90('0x32')]=_['intersection'](_0x3eef40['model'],qs[_0x4e90('0x31')](_0x22b89d[_0x4e90('0x2e')][_0x4e90('0x31')]));_0x356d86[_0x4e90('0x32')]=_0x356d86['attributes']['length']?_0x356d86['attributes']:_0x3eef40[_0x4e90('0x2d')];_0x356d86['order']=qs[_0x4e90('0x36')](_0x22b89d[_0x4e90('0x2e')][_0x4e90('0x36')]);_0x356d86['where']=qs[_0x4e90('0x2f')](_['pick'](_0x22b89d[_0x4e90('0x2e')],_0x3eef40[_0x4e90('0x2f')]));if(_0x22b89d[_0x4e90('0x2e')][_0x4e90('0x3b')]){_0x356d86[_0x4e90('0x37')]=_[_0x4e90('0x3c')](_0x356d86[_0x4e90('0x37')],{'$or':_[_0x4e90('0x28')](_0x356d86[_0x4e90('0x32')],function(_0x4faac6){var _0x50dec0={};_0x50dec0[_0x4faac6]={'$like':'%'+_0x22b89d[_0x4e90('0x2e')][_0x4e90('0x3b')]+'%'};return _0x50dec0;})});}_0x356d86=_[_0x4e90('0x3c')]({},_0x356d86,_0x22b89d[_0x4e90('0x44')]);return _0x35955c[_0x4e90('0x4d')](_0x356d86);}})[_0x4e90('0x22')](function(_0x35902){if(_0x35902){_0x3cf80a=_0x35902[_0x4e90('0x33')];if(!_0x22b89d[_0x4e90('0x2e')]['hasOwnProperty']('nolimit')){_0x356d86['limit']=qs[_0x4e90('0x19')](_0x22b89d['query'][_0x4e90('0x19')]);_0x356d86['offset']=qs['offset'](_0x22b89d[_0x4e90('0x2e')][_0x4e90('0x17')]);}return _0x35955c[_0x4e90('0x4d')](_0x356d86);}})[_0x4e90('0x22')](function(_0x4c5d16){if(_0x4c5d16){return _0x4c5d16?{'count':_0x3cf80a,'rows':_0x4c5d16}:null;}})[_0x4e90('0x22')](respondWithResult(_0x20e8bf,null))[_0x4e90('0x40')](handleError(_0x20e8bf,null));};exports[_0x4e90('0x4e')]=function(_0x1f39f1,_0x3ed76c,_0xe6b244){var _0x48ad19={};var _0xd201ef={};var _0xf11b5;var _0x463b24;return db[_0x4e90('0x29')][_0x4e90('0x4c')]({'where':{'id':_0x1f39f1[_0x4e90('0x41')]['id']}})['then'](handleEntityNotFound(_0x3ed76c,null))[_0x4e90('0x22')](function(_0x33d0e6){if(_0x33d0e6){_0xf11b5=_0x33d0e6;_0xd201ef[_0x4e90('0x2d')]=_['keys'](db[_0x4e90('0x4f')]['rawAttributes']);_0xd201ef['query']=_[_0x4e90('0x42')](_0x1f39f1['query']);_0xd201ef['filters']=_[_0x4e90('0x30')](_0xd201ef[_0x4e90('0x2d')],_0xd201ef[_0x4e90('0x2e')]);_0x48ad19[_0x4e90('0x32')]=_['intersection'](_0xd201ef[_0x4e90('0x2d')],qs[_0x4e90('0x31')](_0x1f39f1[_0x4e90('0x2e')][_0x4e90('0x31')]));_0x48ad19['attributes']=_0x48ad19['attributes']['length']?_0x48ad19['attributes']:_0xd201ef[_0x4e90('0x2d')];_0x48ad19[_0x4e90('0x35')]=qs['sort'](_0x1f39f1[_0x4e90('0x2e')][_0x4e90('0x36')]);_0x48ad19[_0x4e90('0x37')]=qs[_0x4e90('0x2f')](_[_0x4e90('0x38')](_0x1f39f1[_0x4e90('0x2e')],_0xd201ef[_0x4e90('0x2f')]));if(_0x1f39f1[_0x4e90('0x2e')][_0x4e90('0x3b')]){_0x48ad19[_0x4e90('0x37')]=_[_0x4e90('0x3c')](_0x48ad19[_0x4e90('0x37')],{'$or':_[_0x4e90('0x28')](_0x48ad19['attributes'],function(_0xe38aac){var _0x2d9ef3={};_0x2d9ef3[_0xe38aac]={'$like':'%'+_0x1f39f1[_0x4e90('0x2e')][_0x4e90('0x3b')]+'%'};return _0x2d9ef3;})});}_0x48ad19=_[_0x4e90('0x3c')]({},_0x48ad19,_0x1f39f1[_0x4e90('0x44')]);return _0xf11b5[_0x4e90('0x4e')](_0x48ad19);}})['then'](function(_0x117e1f){if(_0x117e1f){_0x463b24=_0x117e1f[_0x4e90('0x33')];if(!_0x1f39f1[_0x4e90('0x2e')][_0x4e90('0x4a')](_0x4e90('0x34'))){_0x48ad19[_0x4e90('0x19')]=qs['limit'](_0x1f39f1[_0x4e90('0x2e')][_0x4e90('0x19')]);_0x48ad19[_0x4e90('0x17')]=qs[_0x4e90('0x17')](_0x1f39f1['query'][_0x4e90('0x17')]);}return _0xf11b5[_0x4e90('0x4e')](_0x48ad19);}})[_0x4e90('0x22')](function(_0x197bb7){if(_0x197bb7){return _0x197bb7?{'count':_0x463b24,'rows':_0x197bb7}:null;}})['then'](respondWithResult(_0x3ed76c,null))[_0x4e90('0x40')](handleError(_0x3ed76c,null));};exports[_0x4e90('0x50')]=function(_0x4b5336,_0x2b29e7,_0x263b06){if(_0x4b5336[_0x4e90('0x47')]['id']){delete _0x4b5336[_0x4e90('0x47')]['id'];}return db[_0x4e90('0x29')]['findOne']({'where':{'id':_0x4b5336[_0x4e90('0x41')]['id']}})[_0x4e90('0x22')](handleEntityNotFound(_0x2b29e7,null))[_0x4e90('0x22')](function(_0x55ebc5){if(_0x55ebc5){return _0x55ebc5[_0x4e90('0x50')](_0x4b5336['body']['ids']||[]);}return null;})['then'](respondWithResult(_0x2b29e7,null))[_0x4e90('0x40')](handleError(_0x2b29e7,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 3312e14..99ee229 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 _0xcf66=['exports','ZendeskConfiguration','int_zendesk_configurations','lodash','util','../../config/logger','moment','bluebird','rimraf','../../config/environment'];(function(_0x1cf025,_0x433fc2){var _0x2d9fec=function(_0x4e61ed){while(--_0x4e61ed){_0x1cf025['push'](_0x1cf025['shift']());}};_0x2d9fec(++_0x433fc2);}(_0xcf66,0x71));var _0x6cf6=function(_0x136ee7,_0x2c1b7a){_0x136ee7=_0x136ee7-0x0;var _0x533952=_0xcf66[_0x136ee7];return _0x533952;};'use strict';var _=require(_0x6cf6('0x0'));var util=require(_0x6cf6('0x1'));var logger=require(_0x6cf6('0x2'))('api');var moment=require(_0x6cf6('0x3'));var BPromise=require(_0x6cf6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6cf6('0x5'));var config=require(_0x6cf6('0x6'));var attributes=require('./intZendeskConfiguration.attributes');module[_0x6cf6('0x7')]=function(_0x1fbedd,_0x2a573e){return _0x1fbedd['define'](_0x6cf6('0x8'),attributes,{'tableName':_0x6cf6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd914=['util','api','moment','bluebird','request-promise','path','rimraf','./intZendeskConfiguration.attributes','define','ZendeskConfiguration','int_zendesk_configurations','lodash'];(function(_0x368eb1,_0x11343a){var _0xbf8b62=function(_0xa3d625){while(--_0xa3d625){_0x368eb1['push'](_0x368eb1['shift']());}};_0xbf8b62(++_0x11343a);}(_0xd914,0x17f));var _0x4d91=function(_0x2f1114,_0x4561f1){_0x2f1114=_0x2f1114-0x0;var _0x2fe856=_0xd914[_0x2f1114];return _0x2fe856;};'use strict';var _=require(_0x4d91('0x0'));var util=require(_0x4d91('0x1'));var logger=require('../../config/logger')(_0x4d91('0x2'));var moment=require(_0x4d91('0x3'));var BPromise=require(_0x4d91('0x4'));var rp=require(_0x4d91('0x5'));var fs=require('fs');var path=require(_0x4d91('0x6'));var rimraf=require(_0x4d91('0x7'));var config=require('../../config/environment');var attributes=require(_0x4d91('0x8'));module['exports']=function(_0x3ab6f8,_0x42d7ae){return _0x3ab6f8[_0x4d91('0x9')](_0x4d91('0xa'),attributes,{'tableName':_0x4d91('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index 4170c20..701d0fa 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 _0xb926=['debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','ZendeskConfiguration,\x20%s,\x20%s'];(function(_0x432d53,_0x579666){var _0xbe2390=function(_0x28b673){while(--_0x28b673){_0x432d53['push'](_0x432d53['shift']());}};_0xbe2390(++_0x579666);}(_0xb926,0x106));var _0x6b92=function(_0x5536d3,_0x58dc3f){_0x5536d3=_0x5536d3-0x0;var _0x52e4b8=_0xb926[_0x5536d3];return _0x52e4b8;};'use strict';var _=require(_0x6b92('0x0'));var util=require(_0x6b92('0x1'));var moment=require(_0x6b92('0x2'));var BPromise=require(_0x6b92('0x3'));var rs=require(_0x6b92('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6b92('0x5'))['db'];var utils=require(_0x6b92('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x6b92('0x7'));var jayson=require(_0x6b92('0x8'));var client=jayson[_0x6b92('0x9')][_0x6b92('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x38061e,_0x24f7a9,_0x26e8c5){return new BPromise(function(_0xb8f325,_0x139db0){return client['request'](_0x38061e,_0x26e8c5)[_0x6b92('0xb')](function(_0x3faa97){logger[_0x6b92('0xc')](_0x6b92('0xd'),_0x24f7a9,'request\x20sent');logger[_0x6b92('0xe')](_0x6b92('0xf'),_0x24f7a9,_0x6b92('0x10'),JSON[_0x6b92('0x11')](_0x3faa97));if(_0x3faa97['error']){if(_0x3faa97[_0x6b92('0x12')][_0x6b92('0x13')]===0x1f4){logger[_0x6b92('0x12')](_0x6b92('0xd'),_0x24f7a9,_0x3faa97[_0x6b92('0x12')]['message']);return _0x139db0(_0x3faa97[_0x6b92('0x12')][_0x6b92('0x14')]);}logger[_0x6b92('0x12')]('ZendeskConfiguration,\x20%s,\x20%s',_0x24f7a9,_0x3faa97[_0x6b92('0x12')][_0x6b92('0x14')]);return _0xb8f325(_0x3faa97[_0x6b92('0x12')][_0x6b92('0x14')]);}else{logger[_0x6b92('0xc')](_0x6b92('0xd'),_0x24f7a9,'request\x20sent');_0xb8f325(_0x3faa97[_0x6b92('0x15')][_0x6b92('0x14')]);}})[_0x6b92('0x16')](function(_0x213001){logger[_0x6b92('0x12')](_0x6b92('0xd'),_0x24f7a9,_0x213001);_0x139db0(_0x213001);});});} \ No newline at end of file +var _0x0771=['code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1dfc78,_0x3f1b7b){var _0x1d18fa=function(_0x5cb2c3){while(--_0x5cb2c3){_0x1dfc78['push'](_0x1dfc78['shift']());}};_0x1d18fa(++_0x3f1b7b);}(_0x0771,0x13f));var _0x1077=function(_0xd07e81,_0x1ccacd){_0xd07e81=_0xd07e81-0x0;var _0x379364=_0x0771[_0xd07e81];return _0x379364;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1077('0x0'));var BPromise=require(_0x1077('0x1'));var rs=require(_0x1077('0x2'));var fs=require('fs');var Redis=require(_0x1077('0x3'));var db=require(_0x1077('0x4'))['db'];var utils=require(_0x1077('0x5'));var logger=require(_0x1077('0x6'))(_0x1077('0x7'));var config=require(_0x1077('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1077('0x9')][_0x1077('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x559544,_0x5c9b30,_0x256203){return new BPromise(function(_0x957f56,_0x3b489a){return client['request'](_0x559544,_0x256203)['then'](function(_0x74d633){logger[_0x1077('0xb')](_0x1077('0xc'),_0x5c9b30,_0x1077('0xd'));logger['debug'](_0x1077('0xe'),_0x5c9b30,_0x1077('0xd'),JSON[_0x1077('0xf')](_0x74d633));if(_0x74d633[_0x1077('0x10')]){if(_0x74d633[_0x1077('0x10')][_0x1077('0x11')]===0x1f4){logger[_0x1077('0x10')](_0x1077('0xc'),_0x5c9b30,_0x74d633[_0x1077('0x10')][_0x1077('0x12')]);return _0x3b489a(_0x74d633[_0x1077('0x10')][_0x1077('0x12')]);}logger[_0x1077('0x10')](_0x1077('0xc'),_0x5c9b30,_0x74d633[_0x1077('0x10')][_0x1077('0x12')]);return _0x957f56(_0x74d633['error']['message']);}else{logger['info']('ZendeskConfiguration,\x20%s,\x20%s',_0x5c9b30,_0x1077('0xd'));_0x957f56(_0x74d633[_0x1077('0x13')][_0x1077('0x12')]);}})[_0x1077('0x14')](function(_0x3d768f){logger[_0x1077('0x10')](_0x1077('0xc'),_0x5c9b30,_0x3d768f);_0x3b489a(_0x3d768f);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 14f5c63..1d99403 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 _0xc3f4=['index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x1f760e,_0x354937){var _0x391ac8=function(_0x372426){while(--_0x372426){_0x1f760e['push'](_0x1f760e['shift']());}};_0x391ac8(++_0x354937);}(_0xc3f4,0x145));var _0x4c3f=function(_0x46d536,_0x24408e){_0x46d536=_0x46d536-0x0;var _0x38f380=_0xc3f4[_0x46d536];return _0x38f380;};'use strict';var multer=require(_0x4c3f('0x0'));var util=require(_0x4c3f('0x1'));var path=require(_0x4c3f('0x2'));var timeout=require(_0x4c3f('0x3'));var express=require(_0x4c3f('0x4'));var router=express[_0x4c3f('0x5')]();var fs_extra=require(_0x4c3f('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x4c3f('0x7'));var config=require(_0x4c3f('0x8'));var controller=require('./intZendeskField.controller');router[_0x4c3f('0x9')]('/',auth[_0x4c3f('0xa')](),controller[_0x4c3f('0xb')]);router[_0x4c3f('0x9')](_0x4c3f('0xc'),auth[_0x4c3f('0xa')](),controller[_0x4c3f('0xd')]);router[_0x4c3f('0xe')]('/',auth[_0x4c3f('0xa')](),controller[_0x4c3f('0xf')]);router[_0x4c3f('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x4c3f('0x11')]);router[_0x4c3f('0x12')](_0x4c3f('0xc'),auth[_0x4c3f('0xa')](),controller[_0x4c3f('0x13')]);module[_0x4c3f('0x14')]=router; \ No newline at end of file +var _0xf011=['exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./intZendeskField.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy'];(function(_0x18e1ef,_0x3f7cc3){var _0xf5ece=function(_0xe8590b){while(--_0xe8590b){_0x18e1ef['push'](_0x18e1ef['shift']());}};_0xf5ece(++_0x3f7cc3);}(_0xf011,0x73));var _0x1f01=function(_0x3fb36d,_0x221073){_0x3fb36d=_0x3fb36d-0x0;var _0x2ff49a=_0xf011[_0x3fb36d];return _0x2ff49a;};'use strict';var multer=require(_0x1f01('0x0'));var util=require(_0x1f01('0x1'));var path=require(_0x1f01('0x2'));var timeout=require(_0x1f01('0x3'));var express=require('express');var router=express[_0x1f01('0x4')]();var fs_extra=require(_0x1f01('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1f01('0x6'));var config=require('../../config/environment');var controller=require(_0x1f01('0x7'));router[_0x1f01('0x8')]('/',auth[_0x1f01('0x9')](),controller['index']);router[_0x1f01('0x8')](_0x1f01('0xa'),auth[_0x1f01('0x9')](),controller[_0x1f01('0xb')]);router[_0x1f01('0xc')]('/',auth[_0x1f01('0x9')](),controller[_0x1f01('0xd')]);router[_0x1f01('0xe')](_0x1f01('0xa'),auth[_0x1f01('0x9')](),controller[_0x1f01('0xf')]);router[_0x1f01('0x10')](_0x1f01('0xa'),auth['isAuthenticated'](),controller[_0x1f01('0x11')]);module[_0x1f01('0x12')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 586c4ae..dea1610 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 _0x35a2=['BOOLEAN','exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x1f5a63,_0x511504){var _0x30bb7a=function(_0x476310){while(--_0x476310){_0x1f5a63['push'](_0x1f5a63['shift']());}};_0x30bb7a(++_0x511504);}(_0x35a2,0x64));var _0x235a=function(_0x5c263b,_0x22a20b){_0x5c263b=_0x5c263b-0x0;var _0x4c695d=_0x35a2[_0x5c263b];return _0x4c695d;};'use strict';var Sequelize=require('sequelize');module[_0x235a('0x0')]={'type':{'type':Sequelize[_0x235a('0x1')](_0x235a('0x2'),_0x235a('0x3'),_0x235a('0x4'),_0x235a('0x5'),_0x235a('0x6')),'defaultValue':_0x235a('0x2')},'content':{'type':Sequelize[_0x235a('0x7')]},'key':{'type':Sequelize[_0x235a('0x7')]},'keyType':{'type':Sequelize[_0x235a('0x1')](_0x235a('0x2'),'variable','customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x235a('0x7')]},'nameField':{'type':Sequelize[_0x235a('0x7')]},'customField':{'type':Sequelize[_0x235a('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x235a('0x7')]}}; \ No newline at end of file +var _0x80be=['variable','BOOLEAN','exports','customVariable','keyValue','picklist','string','STRING','ENUM'];(function(_0x2bf39f,_0x4836ae){var _0x13cd1d=function(_0x2293f5){while(--_0x2293f5){_0x2bf39f['push'](_0x2bf39f['shift']());}};_0x13cd1d(++_0x4836ae);}(_0x80be,0x197));var _0xe80b=function(_0x329734,_0x55c70d){_0x329734=_0x329734-0x0;var _0xd1c57c=_0x80be[_0x329734];return _0xd1c57c;};'use strict';var Sequelize=require('sequelize');module[_0xe80b('0x0')]={'type':{'type':Sequelize['ENUM']('string','variable',_0xe80b('0x1'),_0xe80b('0x2'),_0xe80b('0x3')),'defaultValue':_0xe80b('0x4')},'content':{'type':Sequelize[_0xe80b('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xe80b('0x6')](_0xe80b('0x4'),_0xe80b('0x7'),_0xe80b('0x1'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xe80b('0x5')]},'nameField':{'type':Sequelize[_0xe80b('0x5')]},'customField':{'type':Sequelize[_0xe80b('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 72fc6e6..265f8ef 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 _0x3aec=['order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','keys','create','body','update','find','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','apply','reject','save','then','destroy','error','name','send','index','map','ZendeskField','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length'];(function(_0x28ffed,_0x310f20){var _0x1b381b=function(_0x426c82){while(--_0x426c82){_0x28ffed['push'](_0x28ffed['shift']());}};_0x1b381b(++_0x310f20);}(_0x3aec,0xa8));var _0xc3ae=function(_0x8854f2,_0x79542c){_0x8854f2=_0x8854f2-0x0;var _0x38505d=_0x3aec[_0x8854f2];return _0x38505d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc3ae('0x0'));var zipdir=require(_0xc3ae('0x1'));var jsonpatch=require(_0xc3ae('0x2'));var rp=require(_0xc3ae('0x3'));var moment=require(_0xc3ae('0x4'));var BPromise=require(_0xc3ae('0x5'));var Mustache=require(_0xc3ae('0x6'));var util=require(_0xc3ae('0x7'));var path=require(_0xc3ae('0x8'));var sox=require(_0xc3ae('0x9'));var csv=require('to-csv');var ejs=require(_0xc3ae('0xa'));var fs=require('fs');var fs_extra=require(_0xc3ae('0xb'));var _=require(_0xc3ae('0xc'));var squel=require(_0xc3ae('0xd'));var crypto=require(_0xc3ae('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc3ae('0xf'));var toCsv=require('to-csv');var querystring=require(_0xc3ae('0x10'));var Papa=require(_0xc3ae('0x11'));var Redis=require(_0xc3ae('0x12'));var authService=require(_0xc3ae('0x13'));var qs=require(_0xc3ae('0x14'));var as=require(_0xc3ae('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc3ae('0x16'));var utils=require(_0xc3ae('0x17'));var config=require(_0xc3ae('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xc3ae('0x19'))['db'];function respondWithStatusCode(_0x1f95f8,_0x3ff149){_0x3ff149=_0x3ff149||0xcc;return function(_0x20e62c){if(_0x20e62c){return _0x1f95f8[_0xc3ae('0x1a')](_0x3ff149);}return _0x1f95f8[_0xc3ae('0x1b')](_0x3ff149)[_0xc3ae('0x1c')]();};}function respondWithResult(_0x3afe44,_0x49fd20){_0x49fd20=_0x49fd20||0xc8;return function(_0x17982e){if(_0x17982e){return _0x3afe44[_0xc3ae('0x1b')](_0x49fd20)[_0xc3ae('0x1d')](_0x17982e);}};}function respondWithFilteredResult(_0x1cf237,_0x55f2e2){return function(_0x5793be){if(_0x5793be){var _0x2913f8=typeof _0x55f2e2['offset']===_0xc3ae('0x1e')&&typeof _0x55f2e2['limit']==='undefined';var _0x3ac73a=_0x5793be[_0xc3ae('0x1f')];var _0x5046ee=_0x2913f8?0x0:_0x55f2e2['offset'];var _0x5f7136=_0x2913f8?_0x5793be[_0xc3ae('0x1f')]:_0x55f2e2[_0xc3ae('0x20')]+_0x55f2e2[_0xc3ae('0x21')];var _0x6e1ae3;if(_0x5f7136>=_0x3ac73a){_0x5f7136=_0x3ac73a;_0x6e1ae3=0xc8;}else{_0x6e1ae3=0xce;}_0x1cf237[_0xc3ae('0x1b')](_0x6e1ae3);return _0x1cf237['set'](_0xc3ae('0x22'),_0x5046ee+'-'+_0x5f7136+'/'+_0x3ac73a)[_0xc3ae('0x1d')](_0x5793be);}return null;};}function patchUpdates(_0x2bc03e){return function(_0x5e2ad0){try{jsonpatch[_0xc3ae('0x23')](_0x5e2ad0,_0x2bc03e,!![]);}catch(_0x26d08e){return BPromise[_0xc3ae('0x24')](_0x26d08e);}return _0x5e2ad0[_0xc3ae('0x25')]();};}function saveUpdates(_0x528167,_0x28ae0d){return function(_0x54db84){if(_0x54db84){return _0x54db84['update'](_0x528167)[_0xc3ae('0x26')](function(_0xaafb0f){return _0xaafb0f;});}return null;};}function removeEntity(_0xa1d210,_0x566de3){return function(_0x51f04){if(_0x51f04){return _0x51f04[_0xc3ae('0x27')]()['then'](function(){_0xa1d210[_0xc3ae('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e09f9,_0x418f42){return function(_0xda685d){if(!_0xda685d){_0x1e09f9[_0xc3ae('0x1a')](0x194);}return _0xda685d;};}function handleError(_0x52158c,_0x4def94){_0x4def94=_0x4def94||0x1f4;return function(_0xa3d523){logger[_0xc3ae('0x28')](_0xa3d523['stack']);if(_0xa3d523['name']){delete _0xa3d523[_0xc3ae('0x29')];}_0x52158c[_0xc3ae('0x1b')](_0x4def94)[_0xc3ae('0x2a')](_0xa3d523);};}exports[_0xc3ae('0x2b')]=function(_0x5e5b82,_0x3f79b4){var _0x765814={},_0x54e0fb={},_0x9b2d6b={'count':0x0,'rows':[]};var _0x40796f=_[_0xc3ae('0x2c')](db[_0xc3ae('0x2d')][_0xc3ae('0x2e')],function(_0x2484e5){return{'name':_0x2484e5[_0xc3ae('0x2f')],'type':_0x2484e5[_0xc3ae('0x30')][_0xc3ae('0x31')]};});_0x54e0fb[_0xc3ae('0x32')]=_['map'](_0x40796f,_0xc3ae('0x29'));_0x54e0fb[_0xc3ae('0x33')]=_['keys'](_0x5e5b82[_0xc3ae('0x33')]);_0x54e0fb[_0xc3ae('0x34')]=_[_0xc3ae('0x35')](_0x54e0fb['model'],_0x54e0fb[_0xc3ae('0x33')]);_0x765814[_0xc3ae('0x36')]=_['intersection'](_0x54e0fb['model'],qs[_0xc3ae('0x37')](_0x5e5b82[_0xc3ae('0x33')]['fields']));_0x765814['attributes']=_0x765814[_0xc3ae('0x36')][_0xc3ae('0x38')]?_0x765814[_0xc3ae('0x36')]:_0x54e0fb[_0xc3ae('0x32')];if(!_0x5e5b82[_0xc3ae('0x33')]['hasOwnProperty']('nolimit')){_0x765814[_0xc3ae('0x21')]=qs[_0xc3ae('0x21')](_0x5e5b82['query'][_0xc3ae('0x21')]);_0x765814[_0xc3ae('0x20')]=qs[_0xc3ae('0x20')](_0x5e5b82[_0xc3ae('0x33')][_0xc3ae('0x20')]);}_0x765814[_0xc3ae('0x39')]=qs['sort'](_0x5e5b82[_0xc3ae('0x33')][_0xc3ae('0x3a')]);_0x765814[_0xc3ae('0x3b')]=qs[_0xc3ae('0x34')](_['pick'](_0x5e5b82['query'],_0x54e0fb['filters']),_0x40796f);if(_0x5e5b82['query'][_0xc3ae('0x3c')]){_0x765814['where']=_['merge'](_0x765814[_0xc3ae('0x3b')],{'$or':_['map'](_0x40796f,function(_0x3b9c59){if(_0x3b9c59[_0xc3ae('0x30')]!==_0xc3ae('0x3d')){var _0x8c8379={};_0x8c8379[_0x3b9c59['name']]={'$like':'%'+_0x5e5b82[_0xc3ae('0x33')][_0xc3ae('0x3c')]+'%'};return _0x8c8379;}})});}_0x765814=_[_0xc3ae('0x3e')]({},_0x765814,_0x5e5b82[_0xc3ae('0x3f')]);var _0x14b7b9={'where':_0x765814[_0xc3ae('0x3b')]};return db[_0xc3ae('0x2d')][_0xc3ae('0x1f')](_0x14b7b9)['then'](function(_0x3679b8){_0x9b2d6b[_0xc3ae('0x1f')]=_0x3679b8;if(_0x5e5b82[_0xc3ae('0x33')][_0xc3ae('0x40')]){_0x765814[_0xc3ae('0x41')]=[{'all':!![]}];}return db[_0xc3ae('0x2d')]['findAll'](_0x765814);})[_0xc3ae('0x26')](function(_0x330233){_0x9b2d6b[_0xc3ae('0x42')]=_0x330233;return _0x9b2d6b;})['then'](respondWithFilteredResult(_0x3f79b4,_0x765814))[_0xc3ae('0x43')](handleError(_0x3f79b4,null));};exports[_0xc3ae('0x44')]=function(_0x9634,_0x497bdd){var _0xe9b681={'raw':!![],'where':{'id':_0x9634['params']['id']}},_0x5ebc22={};_0x5ebc22[_0xc3ae('0x32')]=_[_0xc3ae('0x45')](db[_0xc3ae('0x2d')][_0xc3ae('0x2e')]);_0x5ebc22[_0xc3ae('0x33')]=_['keys'](_0x9634['query']);_0x5ebc22['filters']=_['intersection'](_0x5ebc22['model'],_0x5ebc22[_0xc3ae('0x33')]);_0xe9b681[_0xc3ae('0x36')]=_[_0xc3ae('0x35')](_0x5ebc22[_0xc3ae('0x32')],qs['fields'](_0x9634[_0xc3ae('0x33')][_0xc3ae('0x37')]));_0xe9b681[_0xc3ae('0x36')]=_0xe9b681['attributes']['length']?_0xe9b681[_0xc3ae('0x36')]:_0x5ebc22[_0xc3ae('0x32')];if(_0x9634['query'][_0xc3ae('0x40')]){_0xe9b681[_0xc3ae('0x41')]=[{'all':!![]}];}_0xe9b681=_[_0xc3ae('0x3e')]({},_0xe9b681,_0x9634['options']);return db[_0xc3ae('0x2d')]['find'](_0xe9b681)[_0xc3ae('0x26')](handleEntityNotFound(_0x497bdd,null))[_0xc3ae('0x26')](respondWithResult(_0x497bdd,null))['catch'](handleError(_0x497bdd,null));};exports[_0xc3ae('0x46')]=function(_0x4d897a,_0xf29ecd){return db[_0xc3ae('0x2d')][_0xc3ae('0x46')](_0x4d897a[_0xc3ae('0x47')],{})[_0xc3ae('0x26')](respondWithResult(_0xf29ecd,0xc9))[_0xc3ae('0x43')](handleError(_0xf29ecd,null));};exports[_0xc3ae('0x48')]=function(_0x2b1b80,_0x2b7fc8){if(_0x2b1b80['body']['id']){delete _0x2b1b80[_0xc3ae('0x47')]['id'];}return db[_0xc3ae('0x2d')][_0xc3ae('0x49')]({'where':{'id':_0x2b1b80[_0xc3ae('0x4a')]['id']}})[_0xc3ae('0x26')](handleEntityNotFound(_0x2b7fc8,null))['then'](saveUpdates(_0x2b1b80[_0xc3ae('0x47')],null))[_0xc3ae('0x26')](respondWithResult(_0x2b7fc8,null))[_0xc3ae('0x43')](handleError(_0x2b7fc8,null));};exports[_0xc3ae('0x27')]=function(_0x573ffb,_0x2e5426){return db[_0xc3ae('0x2d')][_0xc3ae('0x49')]({'where':{'id':_0x573ffb[_0xc3ae('0x4a')]['id']}})[_0xc3ae('0x26')](handleEntityNotFound(_0x2e5426,null))[_0xc3ae('0x26')](removeEntity(_0x2e5426,null))[_0xc3ae('0x43')](handleError(_0x2e5426,null));}; \ No newline at end of file +var _0x29a5=['keys','intersection','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','params','filters','fields','include','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','index','map','ZendeskField','rawAttributes','fieldName','type','model','query'];(function(_0x573b50,_0xabdde0){var _0x32329e=function(_0x38116b){while(--_0x38116b){_0x573b50['push'](_0x573b50['shift']());}};_0x32329e(++_0xabdde0);}(_0x29a5,0x1e0));var _0x529a=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0x29a5[_0x1e4360];return _0x31e6b4;};'use strict';var emlformat=require(_0x529a('0x0'));var rimraf=require(_0x529a('0x1'));var zipdir=require(_0x529a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x529a('0x3'));var moment=require(_0x529a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x529a('0x5'));var util=require(_0x529a('0x6'));var path=require('path');var sox=require(_0x529a('0x7'));var csv=require(_0x529a('0x8'));var ejs=require(_0x529a('0x9'));var fs=require('fs');var fs_extra=require(_0x529a('0xa'));var _=require(_0x529a('0xb'));var squel=require(_0x529a('0xc'));var crypto=require(_0x529a('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x529a('0xe'));var toCsv=require(_0x529a('0x8'));var querystring=require(_0x529a('0xf'));var Papa=require('papaparse');var Redis=require(_0x529a('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x529a('0x11'));var hardwareService=require(_0x529a('0x12'));var logger=require(_0x529a('0x13'))(_0x529a('0x14'));var utils=require(_0x529a('0x15'));var config=require(_0x529a('0x16'));var licenseUtil=require(_0x529a('0x17'));var db=require(_0x529a('0x18'))['db'];function respondWithStatusCode(_0x439479,_0x20d47a){_0x20d47a=_0x20d47a||0xcc;return function(_0x7e6328){if(_0x7e6328){return _0x439479[_0x529a('0x19')](_0x20d47a);}return _0x439479[_0x529a('0x1a')](_0x20d47a)[_0x529a('0x1b')]();};}function respondWithResult(_0x6be25d,_0x7450ab){_0x7450ab=_0x7450ab||0xc8;return function(_0x55009c){if(_0x55009c){return _0x6be25d[_0x529a('0x1a')](_0x7450ab)[_0x529a('0x1c')](_0x55009c);}};}function respondWithFilteredResult(_0x3fc3fa,_0x4db1d8){return function(_0x2f18ce){if(_0x2f18ce){var _0x155062=typeof _0x4db1d8[_0x529a('0x1d')]===_0x529a('0x1e')&&typeof _0x4db1d8[_0x529a('0x1f')]===_0x529a('0x1e');var _0x4b0a98=_0x2f18ce[_0x529a('0x20')];var _0x34fa5c=_0x155062?0x0:_0x4db1d8[_0x529a('0x1d')];var _0x543b56=_0x155062?_0x2f18ce[_0x529a('0x20')]:_0x4db1d8[_0x529a('0x1d')]+_0x4db1d8[_0x529a('0x1f')];var _0x1b1093;if(_0x543b56>=_0x4b0a98){_0x543b56=_0x4b0a98;_0x1b1093=0xc8;}else{_0x1b1093=0xce;}_0x3fc3fa['status'](_0x1b1093);return _0x3fc3fa[_0x529a('0x21')](_0x529a('0x22'),_0x34fa5c+'-'+_0x543b56+'/'+_0x4b0a98)[_0x529a('0x1c')](_0x2f18ce);}return null;};}function patchUpdates(_0x31210b){return function(_0x467834){try{jsonpatch[_0x529a('0x23')](_0x467834,_0x31210b,!![]);}catch(_0x1358fd){return BPromise[_0x529a('0x24')](_0x1358fd);}return _0x467834[_0x529a('0x25')]();};}function saveUpdates(_0x4e748f,_0x2407e7){return function(_0x45448d){if(_0x45448d){return _0x45448d[_0x529a('0x26')](_0x4e748f)['then'](function(_0x51c483){return _0x51c483;});}return null;};}function removeEntity(_0x4192cb,_0x18f9b4){return function(_0xcc8db1){if(_0xcc8db1){return _0xcc8db1[_0x529a('0x27')]()[_0x529a('0x28')](function(){_0x4192cb[_0x529a('0x1a')](0xcc)[_0x529a('0x1b')]();});}};}function handleEntityNotFound(_0x40eac6,_0x4e3726){return function(_0x37dbb2){if(!_0x37dbb2){_0x40eac6[_0x529a('0x19')](0x194);}return _0x37dbb2;};}function handleError(_0x1d2786,_0x1ddab9){_0x1ddab9=_0x1ddab9||0x1f4;return function(_0x3d91f5){logger['error'](_0x3d91f5[_0x529a('0x29')]);if(_0x3d91f5[_0x529a('0x2a')]){delete _0x3d91f5[_0x529a('0x2a')];}_0x1d2786[_0x529a('0x1a')](_0x1ddab9)[_0x529a('0x2b')](_0x3d91f5);};}exports[_0x529a('0x2c')]=function(_0x4cb1cd,_0x4cee7b){var _0x3914ea={},_0x1e1727={},_0xfe2cf9={'count':0x0,'rows':[]};var _0x19ea47=_[_0x529a('0x2d')](db[_0x529a('0x2e')][_0x529a('0x2f')],function(_0x15836b){return{'name':_0x15836b[_0x529a('0x30')],'type':_0x15836b[_0x529a('0x31')]['key']};});_0x1e1727[_0x529a('0x32')]=_[_0x529a('0x2d')](_0x19ea47,_0x529a('0x2a'));_0x1e1727[_0x529a('0x33')]=_[_0x529a('0x34')](_0x4cb1cd[_0x529a('0x33')]);_0x1e1727['filters']=_['intersection'](_0x1e1727[_0x529a('0x32')],_0x1e1727['query']);_0x3914ea['attributes']=_[_0x529a('0x35')](_0x1e1727[_0x529a('0x32')],qs['fields'](_0x4cb1cd[_0x529a('0x33')]['fields']));_0x3914ea[_0x529a('0x36')]=_0x3914ea[_0x529a('0x36')][_0x529a('0x37')]?_0x3914ea[_0x529a('0x36')]:_0x1e1727[_0x529a('0x32')];if(!_0x4cb1cd[_0x529a('0x33')][_0x529a('0x38')]('nolimit')){_0x3914ea[_0x529a('0x1f')]=qs[_0x529a('0x1f')](_0x4cb1cd[_0x529a('0x33')][_0x529a('0x1f')]);_0x3914ea[_0x529a('0x1d')]=qs['offset'](_0x4cb1cd[_0x529a('0x33')][_0x529a('0x1d')]);}_0x3914ea[_0x529a('0x39')]=qs[_0x529a('0x3a')](_0x4cb1cd[_0x529a('0x33')]['sort']);_0x3914ea[_0x529a('0x3b')]=qs['filters'](_[_0x529a('0x3c')](_0x4cb1cd[_0x529a('0x33')],_0x1e1727['filters']),_0x19ea47);if(_0x4cb1cd['query'][_0x529a('0x3d')]){_0x3914ea['where']=_[_0x529a('0x3e')](_0x3914ea[_0x529a('0x3b')],{'$or':_[_0x529a('0x2d')](_0x19ea47,function(_0x17dbaa){if(_0x17dbaa[_0x529a('0x31')]!==_0x529a('0x3f')){var _0x4c5c47={};_0x4c5c47[_0x17dbaa[_0x529a('0x2a')]]={'$like':'%'+_0x4cb1cd[_0x529a('0x33')][_0x529a('0x3d')]+'%'};return _0x4c5c47;}})});}_0x3914ea=_[_0x529a('0x3e')]({},_0x3914ea,_0x4cb1cd[_0x529a('0x40')]);var _0x415f61={'where':_0x3914ea[_0x529a('0x3b')]};return db['ZendeskField'][_0x529a('0x20')](_0x415f61)[_0x529a('0x28')](function(_0x1926bf){_0xfe2cf9[_0x529a('0x20')]=_0x1926bf;if(_0x4cb1cd['query'][_0x529a('0x41')]){_0x3914ea['include']=[{'all':!![]}];}return db['ZendeskField']['findAll'](_0x3914ea);})[_0x529a('0x28')](function(_0x96139c){_0xfe2cf9[_0x529a('0x42')]=_0x96139c;return _0xfe2cf9;})[_0x529a('0x28')](respondWithFilteredResult(_0x4cee7b,_0x3914ea))[_0x529a('0x43')](handleError(_0x4cee7b,null));};exports[_0x529a('0x44')]=function(_0x3a0e28,_0x31d204){var _0x133eb9={'raw':!![],'where':{'id':_0x3a0e28[_0x529a('0x45')]['id']}},_0x10429c={};_0x10429c['model']=_['keys'](db[_0x529a('0x2e')][_0x529a('0x2f')]);_0x10429c['query']=_['keys'](_0x3a0e28[_0x529a('0x33')]);_0x10429c[_0x529a('0x46')]=_[_0x529a('0x35')](_0x10429c[_0x529a('0x32')],_0x10429c[_0x529a('0x33')]);_0x133eb9['attributes']=_[_0x529a('0x35')](_0x10429c[_0x529a('0x32')],qs[_0x529a('0x47')](_0x3a0e28['query'][_0x529a('0x47')]));_0x133eb9['attributes']=_0x133eb9['attributes'][_0x529a('0x37')]?_0x133eb9[_0x529a('0x36')]:_0x10429c[_0x529a('0x32')];if(_0x3a0e28[_0x529a('0x33')]['includeAll']){_0x133eb9[_0x529a('0x48')]=[{'all':!![]}];}_0x133eb9=_[_0x529a('0x3e')]({},_0x133eb9,_0x3a0e28['options']);return db['ZendeskField'][_0x529a('0x49')](_0x133eb9)[_0x529a('0x28')](handleEntityNotFound(_0x31d204,null))['then'](respondWithResult(_0x31d204,null))[_0x529a('0x43')](handleError(_0x31d204,null));};exports[_0x529a('0x4a')]=function(_0x204a01,_0x4f2b13){return db[_0x529a('0x2e')]['create'](_0x204a01[_0x529a('0x4b')],{})['then'](respondWithResult(_0x4f2b13,0xc9))[_0x529a('0x43')](handleError(_0x4f2b13,null));};exports[_0x529a('0x26')]=function(_0xe44d47,_0xe96f4c){if(_0xe44d47[_0x529a('0x4b')]['id']){delete _0xe44d47[_0x529a('0x4b')]['id'];}return db[_0x529a('0x2e')][_0x529a('0x49')]({'where':{'id':_0xe44d47[_0x529a('0x45')]['id']}})[_0x529a('0x28')](handleEntityNotFound(_0xe96f4c,null))[_0x529a('0x28')](saveUpdates(_0xe44d47[_0x529a('0x4b')],null))[_0x529a('0x28')](respondWithResult(_0xe96f4c,null))[_0x529a('0x43')](handleError(_0xe96f4c,null));};exports['destroy']=function(_0x5953c0,_0x5430f2){return db[_0x529a('0x2e')][_0x529a('0x49')]({'where':{'id':_0x5953c0[_0x529a('0x45')]['id']}})[_0x529a('0x28')](handleEntityNotFound(_0x5430f2,null))[_0x529a('0x28')](removeEntity(_0x5430f2,null))['catch'](handleError(_0x5430f2,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index b49bfe6..9142c63 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 _0x0af1=['api','moment','path','rimraf','../../config/environment','exports','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','FieldId','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0af1,0xbf));var _0x10af=function(_0x3904e2,_0x36623c){_0x3904e2=_0x3904e2-0x0;var _0x3a51e9=_0x0af1[_0x3904e2];return _0x3a51e9;};'use strict';var _=require(_0x10af('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x10af('0x1'));var moment=require(_0x10af('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x10af('0x3'));var rimraf=require(_0x10af('0x4'));var config=require(_0x10af('0x5'));var attributes=require('./intZendeskField.attributes');module[_0x10af('0x6')]=function(_0x10bbb1,_0x7f1d2c){return _0x10bbb1['define'](_0x10af('0x7'),attributes,{'tableName':_0x10af('0x8'),'paranoid':![],'indexes':[{'name':_0x10af('0x9'),'fields':[_0x10af('0xa'),_0x10af('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6b9e=['idField','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intZendeskField.attributes','exports','define','ZendeskField','int_zendesk_fields','zendesk_unique_index'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6b9e,0x10f));var _0xe6b9=function(_0x92b1de,_0x4b515b){_0x92b1de=_0x92b1de-0x0;var _0x200c2a=_0x6b9e[_0x92b1de];return _0x200c2a;};'use strict';var _=require(_0xe6b9('0x0'));var util=require('util');var logger=require(_0xe6b9('0x1'))(_0xe6b9('0x2'));var moment=require(_0xe6b9('0x3'));var BPromise=require(_0xe6b9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe6b9('0x5'));var rimraf=require(_0xe6b9('0x6'));var config=require(_0xe6b9('0x7'));var attributes=require(_0xe6b9('0x8'));module[_0xe6b9('0x9')]=function(_0x42c462,_0x4d457e){return _0x42c462[_0xe6b9('0xa')](_0xe6b9('0xb'),attributes,{'tableName':_0xe6b9('0xc'),'paranoid':![],'indexes':[{'name':_0xe6b9('0xd'),'fields':[_0xe6b9('0xe'),'FieldId'],'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 2ee00d9..31a55ad 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 _0xb8d6=['request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','then','info','ZendeskField,\x20%s,\x20%s'];(function(_0x4f0d8a,_0x51816a){var _0x31a004=function(_0x4b5404){while(--_0x4b5404){_0x4f0d8a['push'](_0x4f0d8a['shift']());}};_0x31a004(++_0x51816a);}(_0xb8d6,0xa9));var _0x6b8d=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xb8d6[_0x3635ce];return _0x97ecd0;};'use strict';var _=require(_0x6b8d('0x0'));var util=require(_0x6b8d('0x1'));var moment=require(_0x6b8d('0x2'));var BPromise=require(_0x6b8d('0x3'));var rs=require(_0x6b8d('0x4'));var fs=require('fs');var Redis=require(_0x6b8d('0x5'));var db=require(_0x6b8d('0x6'))['db'];var utils=require(_0x6b8d('0x7'));var logger=require(_0x6b8d('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6b8d('0x9'));var client=jayson[_0x6b8d('0xa')][_0x6b8d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x514737,_0x575fc2,_0x3604b1){return new BPromise(function(_0x3ff059,_0x448880){return client['request'](_0x514737,_0x3604b1)[_0x6b8d('0xc')](function(_0x35fb54){logger[_0x6b8d('0xd')](_0x6b8d('0xe'),_0x575fc2,_0x6b8d('0xf'));logger[_0x6b8d('0x10')](_0x6b8d('0x11'),_0x575fc2,_0x6b8d('0xf'),JSON[_0x6b8d('0x12')](_0x35fb54));if(_0x35fb54['error']){if(_0x35fb54[_0x6b8d('0x13')]['code']===0x1f4){logger[_0x6b8d('0x13')](_0x6b8d('0xe'),_0x575fc2,_0x35fb54['error'][_0x6b8d('0x14')]);return _0x448880(_0x35fb54[_0x6b8d('0x13')][_0x6b8d('0x14')]);}logger['error']('ZendeskField,\x20%s,\x20%s',_0x575fc2,_0x35fb54[_0x6b8d('0x13')][_0x6b8d('0x14')]);return _0x3ff059(_0x35fb54['error'][_0x6b8d('0x14')]);}else{logger[_0x6b8d('0xd')](_0x6b8d('0xe'),_0x575fc2,_0x6b8d('0xf'));_0x3ff059(_0x35fb54[_0x6b8d('0x15')]['message']);}})[_0x6b8d('0x16')](function(_0x1e194b){logger[_0x6b8d('0x13')]('ZendeskField,\x20%s,\x20%s',_0x575fc2,_0x1e194b);_0x448880(_0x1e194b);});});} \ No newline at end of file +var _0xe045=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','ZendeskField,\x20%s,\x20%s','debug','ZendeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result'];(function(_0x52101d,_0x48848d){var _0x423cf5=function(_0x307107){while(--_0x307107){_0x52101d['push'](_0x52101d['shift']());}};_0x423cf5(++_0x48848d);}(_0xe045,0xf2));var _0x5e04=function(_0x21b5bb,_0x48d7a){_0x21b5bb=_0x21b5bb-0x0;var _0x29e528=_0xe045[_0x21b5bb];return _0x29e528;};'use strict';var _=require(_0x5e04('0x0'));var util=require(_0x5e04('0x1'));var moment=require(_0x5e04('0x2'));var BPromise=require('bluebird');var rs=require(_0x5e04('0x3'));var fs=require('fs');var Redis=require(_0x5e04('0x4'));var db=require(_0x5e04('0x5'))['db'];var utils=require(_0x5e04('0x6'));var logger=require(_0x5e04('0x7'))(_0x5e04('0x8'));var config=require(_0x5e04('0x9'));var jayson=require(_0x5e04('0xa'));var client=jayson['client'][_0x5e04('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x518b5a,_0x487552,_0xb48913){return new BPromise(function(_0x529103,_0x47652d){return client[_0x5e04('0xc')](_0x518b5a,_0xb48913)['then'](function(_0x2440c5){logger[_0x5e04('0xd')](_0x5e04('0xe'),_0x487552,'request\x20sent');logger[_0x5e04('0xf')](_0x5e04('0x10'),_0x487552,_0x5e04('0x11'),JSON[_0x5e04('0x12')](_0x2440c5));if(_0x2440c5['error']){if(_0x2440c5[_0x5e04('0x13')]['code']===0x1f4){logger[_0x5e04('0x13')](_0x5e04('0xe'),_0x487552,_0x2440c5[_0x5e04('0x13')][_0x5e04('0x14')]);return _0x47652d(_0x2440c5[_0x5e04('0x13')][_0x5e04('0x14')]);}logger[_0x5e04('0x13')](_0x5e04('0xe'),_0x487552,_0x2440c5[_0x5e04('0x13')][_0x5e04('0x14')]);return _0x529103(_0x2440c5[_0x5e04('0x13')][_0x5e04('0x14')]);}else{logger[_0x5e04('0xd')](_0x5e04('0xe'),_0x487552,_0x5e04('0x11'));_0x529103(_0x2440c5[_0x5e04('0x15')][_0x5e04('0x14')]);}})['catch'](function(_0x366afe){logger[_0x5e04('0x13')](_0x5e04('0xe'),_0x487552,_0x366afe);_0x47652d(_0x366afe);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 5edc611..c4bbaa2 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 _0x4b43=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','index','get','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','create','post','/:id/configurations','addConfiguration','put','update','delete','destroy','exports','util','path','connect-timeout','Router'];(function(_0x47d408,_0x581ad4){var _0x700cd2=function(_0x17c587){while(--_0x17c587){_0x47d408['push'](_0x47d408['shift']());}};_0x700cd2(++_0x581ad4);}(_0x4b43,0xa4));var _0x34b4=function(_0x5b553a,_0x52b9ce){_0x5b553a=_0x5b553a-0x0;var _0x1ca1c9=_0x4b43[_0x5b553a];return _0x1ca1c9;};'use strict';var multer=require('multer');var util=require(_0x34b4('0x0'));var path=require(_0x34b4('0x1'));var timeout=require(_0x34b4('0x2'));var express=require('express');var router=express[_0x34b4('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x34b4('0x4'));var interaction=require(_0x34b4('0x5'));var config=require(_0x34b4('0x6'));var controller=require(_0x34b4('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x34b4('0x8')]);router[_0x34b4('0x9')](_0x34b4('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x34b4('0x9')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x34b4('0xb')]);router[_0x34b4('0x9')](_0x34b4('0xc'),auth[_0x34b4('0xd')](),controller[_0x34b4('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x34b4('0xf')]);router[_0x34b4('0x10')](_0x34b4('0x11'),auth[_0x34b4('0xd')](),controller[_0x34b4('0x12')]);router[_0x34b4('0x13')](_0x34b4('0xa'),auth['isAuthenticated'](),controller[_0x34b4('0x14')]);router[_0x34b4('0x15')](_0x34b4('0xa'),auth[_0x34b4('0xd')](),controller[_0x34b4('0x16')]);module[_0x34b4('0x17')]=router; \ No newline at end of file +var _0x826c=['/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x826c,0x16b));var _0xc826=function(_0x107c3c,_0xd0aea){_0x107c3c=_0x107c3c-0x0;var _0x43dcb8=_0x826c[_0x107c3c];return _0x43dcb8;};'use strict';var multer=require(_0xc826('0x0'));var util=require(_0xc826('0x1'));var path=require(_0xc826('0x2'));var timeout=require(_0xc826('0x3'));var express=require(_0xc826('0x4'));var router=express[_0xc826('0x5')]();var fs_extra=require(_0xc826('0x6'));var auth=require(_0xc826('0x7'));var interaction=require(_0xc826('0x8'));var config=require(_0xc826('0x9'));var controller=require('./intZohoAccount.controller');router[_0xc826('0xa')]('/',auth[_0xc826('0xb')](),controller['index']);router[_0xc826('0xa')](_0xc826('0xc'),auth[_0xc826('0xb')](),controller[_0xc826('0xd')]);router[_0xc826('0xa')](_0xc826('0xe'),auth[_0xc826('0xb')](),controller[_0xc826('0xf')]);router[_0xc826('0xa')](_0xc826('0x10'),auth['isAuthenticated'](),controller[_0xc826('0x11')]);router[_0xc826('0x12')]('/',auth[_0xc826('0xb')](),controller[_0xc826('0x13')]);router[_0xc826('0x12')](_0xc826('0xe'),auth[_0xc826('0xb')](),controller[_0xc826('0x14')]);router[_0xc826('0x15')](_0xc826('0xc'),auth[_0xc826('0xb')](),controller['update']);router[_0xc826('0x16')](_0xc826('0xc'),auth[_0xc826('0xb')](),controller[_0xc826('0x17')]);module[_0xc826('0x18')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 7c71a57..edecc24 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 _0xbec5=['STRING','sequelize','exports'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xbec5,0xe5));var _0x5bec=function(_0x4c4037,_0x15054b){_0x4c4037=_0x4c4037-0x0;var _0x357862=_0xbec5[_0x4c4037];return _0x357862;};'use strict';var Sequelize=require(_0x5bec('0x0'));module[_0x5bec('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5bec('0x2')]},'host':{'type':Sequelize[_0x5bec('0x2')]},'zone':{'type':Sequelize[_0x5bec('0x2')]},'clientId':{'type':Sequelize[_0x5bec('0x2')]},'clientSecret':{'type':Sequelize[_0x5bec('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'code':{'type':Sequelize[_0x5bec('0x2')]},'refreshToken':{'type':Sequelize[_0x5bec('0x2')]}}; \ No newline at end of file +var _0xb4e6=['sequelize','STRING'];(function(_0xe22d84,_0x46d3dc){var _0x29a9ed=function(_0x5bd1ce){while(--_0x5bd1ce){_0xe22d84['push'](_0xe22d84['shift']());}};_0x29a9ed(++_0x46d3dc);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x456032,_0x1a799d){_0x456032=_0x456032-0x0;var _0x1a53cd=_0xb4e6[_0x456032];return _0x1a53cd;};'use strict';var Sequelize=require(_0x6b4e('0x0'));module['exports']={'name':{'type':Sequelize[_0x6b4e('0x1')]},'description':{'type':Sequelize[_0x6b4e('0x1')]},'host':{'type':Sequelize[_0x6b4e('0x1')]},'zone':{'type':Sequelize[_0x6b4e('0x1')]},'clientId':{'type':Sequelize[_0x6b4e('0x1')]},'clientSecret':{'type':Sequelize[_0x6b4e('0x1')]},'serverUrl':{'type':Sequelize[_0x6b4e('0x1')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0x6b4e('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 9572da0..bde4f89 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 _0x9f4e=['to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','save','then','destroy','name','send','index','rawAttributes','fieldName','type','key','map','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','ZohoAccount','findAll','rows','catch','show','params','include','create','body','update','find','getConfigurations','findOne','ZohoConfiguration','pick','addConfiguration','Subjects','getSubjects','channel','ZohoField','Descriptions','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','clientId','clientSecret','refresh_token','access_token','getFields','host','serverUrl','refreshToken','zoho.eu','substring','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','https://www.zohoapis.%s/crm/v2/settings/fields','Zoho-oauthtoken\x20','response','error','message','Owner','Subject','Description','WhoId','Call_Result','Call_Start_Time','remove','api_name','system_mandatory','push','custom_field','picklist','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0x9f4e,0x1e5));var _0xe9f4=function(_0x2a0183,_0x3fc93c){_0x2a0183=_0x2a0183-0x0;var _0x158c3a=_0x9f4e[_0x2a0183];return _0x158c3a;};'use strict';var emlformat=require(_0xe9f4('0x0'));var rimraf=require(_0xe9f4('0x1'));var zipdir=require(_0xe9f4('0x2'));var jsonpatch=require(_0xe9f4('0x3'));var rp=require(_0xe9f4('0x4'));var moment=require('moment');var BPromise=require(_0xe9f4('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xe9f4('0x6'));var sox=require(_0xe9f4('0x7'));var csv=require('to-csv');var ejs=require(_0xe9f4('0x8'));var fs=require('fs');var fs_extra=require(_0xe9f4('0x9'));var _=require(_0xe9f4('0xa'));var squel=require(_0xe9f4('0xb'));var crypto=require(_0xe9f4('0xc'));var jsforce=require(_0xe9f4('0xd'));var deskjs=require(_0xe9f4('0xe'));var toCsv=require(_0xe9f4('0xf'));var querystring=require(_0xe9f4('0x10'));var Papa=require(_0xe9f4('0x11'));var Redis=require(_0xe9f4('0x12'));var authService=require(_0xe9f4('0x13'));var qs=require(_0xe9f4('0x14'));var as=require(_0xe9f4('0x15'));var hardwareService=require(_0xe9f4('0x16'));var logger=require(_0xe9f4('0x17'))(_0xe9f4('0x18'));var utils=require(_0xe9f4('0x19'));var config=require(_0xe9f4('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xe9f4('0x1b'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x18725e,_0x41a4d8){_0x41a4d8=_0x41a4d8||0xcc;return function(_0x173d3a){if(_0x173d3a){return _0x18725e['sendStatus'](_0x41a4d8);}return _0x18725e[_0xe9f4('0x1c')](_0x41a4d8)[_0xe9f4('0x1d')]();};}function respondWithResult(_0x381873,_0x4b8f0a){_0x4b8f0a=_0x4b8f0a||0xc8;return function(_0x33a7a4){if(_0x33a7a4){return _0x381873[_0xe9f4('0x1c')](_0x4b8f0a)[_0xe9f4('0x1e')](_0x33a7a4);}};}function respondWithFilteredResult(_0x174d71,_0x53525e){return function(_0x1b84fb){if(_0x1b84fb){var _0x25a58b=typeof _0x53525e[_0xe9f4('0x1f')]==='undefined'&&typeof _0x53525e[_0xe9f4('0x20')]===_0xe9f4('0x21');var _0x5c8ea7=_0x1b84fb[_0xe9f4('0x22')];var _0x4f6cc3=_0x25a58b?0x0:_0x53525e[_0xe9f4('0x1f')];var _0x19ed09=_0x25a58b?_0x1b84fb[_0xe9f4('0x22')]:_0x53525e[_0xe9f4('0x1f')]+_0x53525e['limit'];var _0x5cae6e;if(_0x19ed09>=_0x5c8ea7){_0x19ed09=_0x5c8ea7;_0x5cae6e=0xc8;}else{_0x5cae6e=0xce;}_0x174d71[_0xe9f4('0x1c')](_0x5cae6e);return _0x174d71[_0xe9f4('0x23')](_0xe9f4('0x24'),_0x4f6cc3+'-'+_0x19ed09+'/'+_0x5c8ea7)['json'](_0x1b84fb);}return null;};}function patchUpdates(_0x1eb032){return function(_0x2e6350){try{jsonpatch['apply'](_0x2e6350,_0x1eb032,!![]);}catch(_0x273803){return BPromise['reject'](_0x273803);}return _0x2e6350[_0xe9f4('0x25')]();};}function saveUpdates(_0x37f1a6,_0x22448c){return function(_0x52e057){if(_0x52e057){return _0x52e057['update'](_0x37f1a6)[_0xe9f4('0x26')](function(_0x458167){return _0x458167;});}return null;};}function removeEntity(_0x39e6f2,_0x48475d){return function(_0x11f46d){if(_0x11f46d){return _0x11f46d[_0xe9f4('0x27')]()[_0xe9f4('0x26')](function(){_0x39e6f2['status'](0xcc)[_0xe9f4('0x1d')]();});}};}function handleEntityNotFound(_0xdbd341,_0x2764c9){return function(_0x2aff68){if(!_0x2aff68){_0xdbd341['sendStatus'](0x194);}return _0x2aff68;};}function handleError(_0x42de34,_0x2a6a39){_0x2a6a39=_0x2a6a39||0x1f4;return function(_0x12101c){logger['error'](_0x12101c['stack']);if(_0x12101c[_0xe9f4('0x28')]){delete _0x12101c[_0xe9f4('0x28')];}_0x42de34[_0xe9f4('0x1c')](_0x2a6a39)[_0xe9f4('0x29')](_0x12101c);};}exports[_0xe9f4('0x2a')]=function(_0x541fb0,_0x12e9cd){var _0x4a087f={},_0x3d7913={},_0x3defda={'count':0x0,'rows':[]};var _0x32054b=_['map'](db['ZohoAccount'][_0xe9f4('0x2b')],function(_0xb61caf){return{'name':_0xb61caf[_0xe9f4('0x2c')],'type':_0xb61caf[_0xe9f4('0x2d')][_0xe9f4('0x2e')]};});_0x3d7913['model']=_[_0xe9f4('0x2f')](_0x32054b,_0xe9f4('0x28'));_0x3d7913['query']=_[_0xe9f4('0x30')](_0x541fb0[_0xe9f4('0x31')]);_0x3d7913[_0xe9f4('0x32')]=_[_0xe9f4('0x33')](_0x3d7913[_0xe9f4('0x34')],_0x3d7913['query']);_0x4a087f[_0xe9f4('0x35')]=_[_0xe9f4('0x33')](_0x3d7913[_0xe9f4('0x34')],qs[_0xe9f4('0x36')](_0x541fb0[_0xe9f4('0x31')][_0xe9f4('0x36')]));_0x4a087f[_0xe9f4('0x35')]=_0x4a087f[_0xe9f4('0x35')][_0xe9f4('0x37')]?_0x4a087f['attributes']:_0x3d7913['model'];if(!_0x541fb0[_0xe9f4('0x31')][_0xe9f4('0x38')](_0xe9f4('0x39'))){_0x4a087f[_0xe9f4('0x20')]=qs[_0xe9f4('0x20')](_0x541fb0[_0xe9f4('0x31')][_0xe9f4('0x20')]);_0x4a087f[_0xe9f4('0x1f')]=qs[_0xe9f4('0x1f')](_0x541fb0[_0xe9f4('0x31')][_0xe9f4('0x1f')]);}_0x4a087f[_0xe9f4('0x3a')]=qs[_0xe9f4('0x3b')](_0x541fb0['query'][_0xe9f4('0x3b')]);_0x4a087f[_0xe9f4('0x3c')]=qs[_0xe9f4('0x32')](_['pick'](_0x541fb0['query'],_0x3d7913['filters']),_0x32054b);if(_0x541fb0[_0xe9f4('0x31')][_0xe9f4('0x3d')]){_0x4a087f[_0xe9f4('0x3c')]=_[_0xe9f4('0x3e')](_0x4a087f[_0xe9f4('0x3c')],{'$or':_[_0xe9f4('0x2f')](_0x32054b,function(_0x3c22de){if(_0x3c22de['type']!==_0xe9f4('0x3f')){var _0xb9557c={};_0xb9557c[_0x3c22de['name']]={'$like':'%'+_0x541fb0[_0xe9f4('0x31')][_0xe9f4('0x3d')]+'%'};return _0xb9557c;}})});}_0x4a087f=_[_0xe9f4('0x3e')]({},_0x4a087f,_0x541fb0[_0xe9f4('0x40')]);var _0xced495={'where':_0x4a087f[_0xe9f4('0x3c')]};return db['ZohoAccount'][_0xe9f4('0x22')](_0xced495)['then'](function(_0x9dbad6){_0x3defda[_0xe9f4('0x22')]=_0x9dbad6;if(_0x541fb0[_0xe9f4('0x31')][_0xe9f4('0x41')]){_0x4a087f['include']=[{'all':!![]}];}return db[_0xe9f4('0x42')][_0xe9f4('0x43')](_0x4a087f);})['then'](function(_0x29c743){_0x3defda[_0xe9f4('0x44')]=_0x29c743;return _0x3defda;})[_0xe9f4('0x26')](respondWithFilteredResult(_0x12e9cd,_0x4a087f))[_0xe9f4('0x45')](handleError(_0x12e9cd,null));};exports[_0xe9f4('0x46')]=function(_0x35a349,_0x2504b8){var _0x569a61={'raw':![],'where':{'id':_0x35a349[_0xe9f4('0x47')]['id']}},_0x38c627={};_0x38c627[_0xe9f4('0x34')]=_[_0xe9f4('0x30')](db[_0xe9f4('0x42')][_0xe9f4('0x2b')]);_0x38c627[_0xe9f4('0x31')]=_[_0xe9f4('0x30')](_0x35a349[_0xe9f4('0x31')]);_0x38c627[_0xe9f4('0x32')]=_[_0xe9f4('0x33')](_0x38c627['model'],_0x38c627['query']);_0x569a61[_0xe9f4('0x35')]=_[_0xe9f4('0x33')](_0x38c627['model'],qs[_0xe9f4('0x36')](_0x35a349[_0xe9f4('0x31')][_0xe9f4('0x36')]));_0x569a61['attributes']=_0x569a61[_0xe9f4('0x35')][_0xe9f4('0x37')]?_0x569a61[_0xe9f4('0x35')]:_0x38c627[_0xe9f4('0x34')];if(_0x35a349[_0xe9f4('0x31')]['includeAll']){_0x569a61[_0xe9f4('0x48')]=[{'all':!![]}];}_0x569a61=_[_0xe9f4('0x3e')]({},_0x569a61,_0x35a349[_0xe9f4('0x40')]);return db[_0xe9f4('0x42')]['find'](_0x569a61)[_0xe9f4('0x26')](handleEntityNotFound(_0x2504b8,null))[_0xe9f4('0x26')](respondWithResult(_0x2504b8,null))['catch'](handleError(_0x2504b8,null));};exports['create']=function(_0x3b7661,_0x4c8135){return db[_0xe9f4('0x42')][_0xe9f4('0x49')](_0x3b7661[_0xe9f4('0x4a')],{})[_0xe9f4('0x26')](respondWithResult(_0x4c8135,0xc9))['catch'](handleError(_0x4c8135,null));};exports[_0xe9f4('0x4b')]=function(_0x8892d8,_0x5e18ce){if(_0x8892d8[_0xe9f4('0x4a')]['id']){delete _0x8892d8[_0xe9f4('0x4a')]['id'];}return db[_0xe9f4('0x42')][_0xe9f4('0x4c')]({'where':{'id':_0x8892d8[_0xe9f4('0x47')]['id']}})[_0xe9f4('0x26')](handleEntityNotFound(_0x5e18ce,null))[_0xe9f4('0x26')](saveUpdates(_0x8892d8[_0xe9f4('0x4a')],null))[_0xe9f4('0x26')](respondWithResult(_0x5e18ce,null))[_0xe9f4('0x45')](handleError(_0x5e18ce,null));};exports[_0xe9f4('0x27')]=function(_0x193cb1,_0x544334){return db['ZohoAccount'][_0xe9f4('0x4c')]({'where':{'id':_0x193cb1[_0xe9f4('0x47')]['id']}})[_0xe9f4('0x26')](handleEntityNotFound(_0x544334,null))['then'](removeEntity(_0x544334,null))[_0xe9f4('0x45')](handleError(_0x544334,null));};exports[_0xe9f4('0x4d')]=function(_0x2f0a10,_0x279c0d,_0x339821){var _0x3dedd4={};var _0x39a18f={};var _0x3a6988;var _0x319303;return db[_0xe9f4('0x42')][_0xe9f4('0x4e')]({'where':{'id':_0x2f0a10[_0xe9f4('0x47')]['id']}})[_0xe9f4('0x26')](handleEntityNotFound(_0x279c0d,null))[_0xe9f4('0x26')](function(_0x4d742b){if(_0x4d742b){_0x3a6988=_0x4d742b;_0x39a18f[_0xe9f4('0x34')]=_[_0xe9f4('0x30')](db[_0xe9f4('0x4f')][_0xe9f4('0x2b')]);_0x39a18f[_0xe9f4('0x31')]=_[_0xe9f4('0x30')](_0x2f0a10['query']);_0x39a18f[_0xe9f4('0x32')]=_[_0xe9f4('0x33')](_0x39a18f[_0xe9f4('0x34')],_0x39a18f[_0xe9f4('0x31')]);_0x3dedd4[_0xe9f4('0x35')]=_[_0xe9f4('0x33')](_0x39a18f[_0xe9f4('0x34')],qs[_0xe9f4('0x36')](_0x2f0a10['query'][_0xe9f4('0x36')]));_0x3dedd4[_0xe9f4('0x35')]=_0x3dedd4[_0xe9f4('0x35')]['length']?_0x3dedd4[_0xe9f4('0x35')]:_0x39a18f[_0xe9f4('0x34')];_0x3dedd4['order']=qs[_0xe9f4('0x3b')](_0x2f0a10[_0xe9f4('0x31')][_0xe9f4('0x3b')]);_0x3dedd4[_0xe9f4('0x3c')]=qs[_0xe9f4('0x32')](_[_0xe9f4('0x50')](_0x2f0a10[_0xe9f4('0x31')],_0x39a18f[_0xe9f4('0x32')]));if(_0x2f0a10[_0xe9f4('0x31')]['filter']){_0x3dedd4[_0xe9f4('0x3c')]=_['merge'](_0x3dedd4[_0xe9f4('0x3c')],{'$or':_[_0xe9f4('0x2f')](_0x3dedd4[_0xe9f4('0x35')],function(_0x41f21a){var _0x156d06={};_0x156d06[_0x41f21a]={'$like':'%'+_0x2f0a10[_0xe9f4('0x31')][_0xe9f4('0x3d')]+'%'};return _0x156d06;})});}_0x3dedd4=_['merge']({},_0x3dedd4,_0x2f0a10[_0xe9f4('0x40')]);return _0x3a6988[_0xe9f4('0x4d')](_0x3dedd4);}})[_0xe9f4('0x26')](function(_0x135a28){if(_0x135a28){_0x319303=_0x135a28[_0xe9f4('0x37')];if(!_0x2f0a10[_0xe9f4('0x31')][_0xe9f4('0x38')](_0xe9f4('0x39'))){_0x3dedd4['limit']=qs[_0xe9f4('0x20')](_0x2f0a10[_0xe9f4('0x31')][_0xe9f4('0x20')]);_0x3dedd4[_0xe9f4('0x1f')]=qs[_0xe9f4('0x1f')](_0x2f0a10['query'][_0xe9f4('0x1f')]);}return _0x3a6988[_0xe9f4('0x4d')](_0x3dedd4);}})[_0xe9f4('0x26')](function(_0x1cda5){if(_0x1cda5){return _0x1cda5?{'count':_0x319303,'rows':_0x1cda5}:null;}})[_0xe9f4('0x26')](respondWithResult(_0x279c0d,null))[_0xe9f4('0x45')](handleError(_0x279c0d,null));};exports[_0xe9f4('0x51')]=function(_0x45b683,_0xa3aedd,_0x22cf68){if(_0x45b683['body']['id']){delete _0x45b683[_0xe9f4('0x4a')]['id'];}return db['ZohoAccount'][_0xe9f4('0x4e')]({'where':{'id':_0x45b683[_0xe9f4('0x47')]['id']}})[_0xe9f4('0x26')](handleEntityNotFound(_0xa3aedd,null))[_0xe9f4('0x26')](function(_0x57341f){if(_0x57341f){_0x45b683[_0xe9f4('0x4a')]['AccountId']=_0x57341f['id'];_0x45b683[_0xe9f4('0x4a')][_0xe9f4('0x52')]=integrations[_0xe9f4('0x53')](_0x45b683['body'][_0xe9f4('0x54')],_0x45b683[_0xe9f4('0x4a')][_0xe9f4('0x2d')]);_0x45b683[_0xe9f4('0x4a')]['Descriptions']=integrations['getDescriptions'](_0x45b683['body']['channel'],_0x45b683['body'][_0xe9f4('0x2d')]);return db[_0xe9f4('0x4f')][_0xe9f4('0x49')](_0x45b683['body'],{'include':[{'model':db[_0xe9f4('0x55')],'as':_0xe9f4('0x52')},{'model':db[_0xe9f4('0x55')],'as':_0xe9f4('0x56')}]});}return null;})[_0xe9f4('0x26')](respondWithResult(_0xa3aedd,null))[_0xe9f4('0x45')](handleError(_0xa3aedd,null));};function getAccessToken(_0x26c2de){return new Promise(function(_0xcc7786,_0x32afc5){var _0xf3bfff;switch(_0x26c2de['zone']){case'US':_0xf3bfff=_0xe9f4('0x57');break;case'AU':_0xf3bfff='https://accounts.zoho.com.au';break;case'EU':_0xf3bfff=_0xe9f4('0x58');break;case'IN':_0xf3bfff=_0xe9f4('0x59');break;case'CN':_0xf3bfff=_0xe9f4('0x5a');break;default:_0xf3bfff=_0xe9f4('0x58');break;}var _0x30d6ac={'method':_0xe9f4('0x5b'),'uri':_0xf3bfff+'/oauth/v2/token','qs':{'refresh_token':_0x26c2de['refreshToken'],'client_id':_0x26c2de[_0xe9f4('0x5c')],'client_secret':_0x26c2de[_0xe9f4('0x5d')],'grant_type':_0xe9f4('0x5e')},'json':!![]};return rp(_0x30d6ac)['then'](function(_0x402eb1){if(_0x402eb1[_0xe9f4('0x5f')]){_0xcc7786(_0x402eb1[_0xe9f4('0x5f')]);}else{_0x32afc5('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0xe9f4('0x45')](function(_0x2d557e){_0x32afc5(_0x2d557e);});});}exports[_0xe9f4('0x60')]=function(_0x4be1d7,_0x4403f0,_0x5f4885){var _0x46372a,_0x21957f,_0x3c1061,_0x38256b,_0x14dc55;return db['ZohoAccount'][_0xe9f4('0x4e')]({'where':{'id':_0x4be1d7['params']['id']},'attributes':['id',_0xe9f4('0x61'),'zone','clientId',_0xe9f4('0x5d'),_0xe9f4('0x62'),'code',_0xe9f4('0x63')]})[_0xe9f4('0x26')](handleEntityNotFound(_0x4403f0,null))[_0xe9f4('0x26')](function(_0x45634b){_0x14dc55=_0x45634b;_0x46372a=_0x14dc55['host'];_0x21957f=_0x46372a===_0xe9f4('0x64')?'eu':'com';_0x3c1061=_0x14dc55[_0xe9f4('0x62')];var _0x2c873d=_0x3c1061['slice'](-0x1);if(_0x2c873d==='/'||_0x2c873d==='\x5c'||_0x2c873d===':'){_0x3c1061=_0x3c1061[_0xe9f4('0x65')](0x0,_0x3c1061['lastIndexOf'](_0x2c873d));}if(!_0x14dc55[_0xe9f4('0x63')]){throw new Error(_0xe9f4('0x66'));}return getAccessToken(_0x14dc55);})[_0xe9f4('0x26')](function(_0x890b2d){if(_0x890b2d){return rp({'method':'GET','uri':util['format'](_0xe9f4('0x67'),_0x21957f),'qs':{'module':'Calls'},'headers':{'Authorization':_0xe9f4('0x68')+_0x890b2d},'json':!![]});}})['then'](function(_0xd21e4f){if(_0xd21e4f){if(_0xd21e4f[_0xe9f4('0x69')]&&_0xd21e4f[_0xe9f4('0x69')][_0xe9f4('0x6a')]){throw new Error(_0xd21e4f[_0xe9f4('0x69')]['error'][_0xe9f4('0x6b')]);}var _0x5a20c6=[];var _0x110280=[];var _0x1e0bb5=[_0xe9f4('0x6c'),_0xe9f4('0x6d'),_0xe9f4('0x6e'),_0xe9f4('0x6f'),'Call_Duration',_0xe9f4('0x70'),_0xe9f4('0x71'),'Call_Type'];_0x110280=_[_0xe9f4('0x72')](_0xd21e4f[_0xe9f4('0x36')],function(_0x3e37b5){return _0x1e0bb5['includes'](_0x3e37b5[_0xe9f4('0x73')]);});for(var _0xb668bf=0x0;_0xb668bf<_0x110280[_0xe9f4('0x37')];_0xb668bf++){if(_0x110280[_0xb668bf][_0xe9f4('0x74')]===![]){_0x5a20c6[_0xe9f4('0x75')]({'id':_0x110280[_0xb668bf]['id'],'name':_0x110280[_0xb668bf]['display_label'],'custom':_0x110280[_0xb668bf][_0xe9f4('0x76')],'options':_0x110280[_0xb668bf]['data_type']===_0xe9f4('0x77')&&_0x110280[_0xb668bf]['pick_list_values']['length']>-0x1?_[_0xe9f4('0x2f')](_0x110280[_0xb668bf]['pick_list_values'],function(_0x758f2a){return{'name':_0x758f2a,'value':_0x758f2a};}):[]});}}return{'count':_0x5a20c6['length'],'rows':_0x5a20c6};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x4403f0,null))['catch'](function(_0x3871ae){var _0x3ec98f=_0x4be1d7[_0xe9f4('0x31')][_0xe9f4('0x78')]?0x1f4:_0x3871ae[_0xe9f4('0x79')]||0x1f4;logger['error'](_0xe9f4('0x7a'),_0xe9f4('0x60'),_0x3ec98f,JSON[_0xe9f4('0x7b')](_0x3871ae));delete _0x3871ae[_0xe9f4('0x28')];if(_0x3ec98f===0x191){_0x3ec98f=0x190;}_0x4403f0[_0xe9f4('0x1c')](_0x3ec98f)[_0xe9f4('0x29')](_0x4be1d7[_0xe9f4('0x31')][_0xe9f4('0x78')]?{'message':_0xe9f4('0x7c'),'statusCode':_0x3871ae[_0xe9f4('0x79')]}:_0x3871ae);});}; \ No newline at end of file +var _0x2848=['custom_field','picklist','statusCode','getFields','stringify','Wrong\x20credentials','eml-format','zip-dir','request-promise','moment','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','sendStatus','stack','send','index','ZohoAccount','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','name','options','includeAll','findAll','rows','catch','show','params','keys','length','find','create','body','getConfigurations','findOne','ZohoConfiguration','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','/oauth/v2/token','refreshToken','clientId','refresh_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','host','serverUrl','code','zoho.eu','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','error','message','Owner','WhoId','Call_Duration','Call_Start_Time','Call_Type','includes','api_name','push','display_label'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x2848,0x189));var _0x8284=function(_0x54ac7e,_0x380994){_0x54ac7e=_0x54ac7e-0x0;var _0x59c3ed=_0x2848[_0x54ac7e];return _0x59c3ed;};'use strict';var emlformat=require(_0x8284('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8284('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8284('0x2'));var moment=require(_0x8284('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8284('0x4'));var path=require(_0x8284('0x5'));var sox=require('sox');var csv=require(_0x8284('0x6'));var ejs=require(_0x8284('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8284('0x8'));var squel=require(_0x8284('0x9'));var crypto=require(_0x8284('0xa'));var jsforce=require(_0x8284('0xb'));var deskjs=require(_0x8284('0xc'));var toCsv=require(_0x8284('0x6'));var querystring=require(_0x8284('0xd'));var Papa=require(_0x8284('0xe'));var Redis=require(_0x8284('0xf'));var authService=require(_0x8284('0x10'));var qs=require(_0x8284('0x11'));var as=require(_0x8284('0x12'));var hardwareService=require(_0x8284('0x13'));var logger=require(_0x8284('0x14'))(_0x8284('0x15'));var utils=require(_0x8284('0x16'));var config=require(_0x8284('0x17'));var licenseUtil=require(_0x8284('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0x8284('0x19'));function respondWithStatusCode(_0x5ee81b,_0xbd689d){_0xbd689d=_0xbd689d||0xcc;return function(_0x369fba){if(_0x369fba){return _0x5ee81b['sendStatus'](_0xbd689d);}return _0x5ee81b[_0x8284('0x1a')](_0xbd689d)[_0x8284('0x1b')]();};}function respondWithResult(_0x2bb467,_0x4d593a){_0x4d593a=_0x4d593a||0xc8;return function(_0x436871){if(_0x436871){return _0x2bb467[_0x8284('0x1a')](_0x4d593a)[_0x8284('0x1c')](_0x436871);}};}function respondWithFilteredResult(_0x234d1c,_0x1cefe3){return function(_0x2be868){if(_0x2be868){var _0x249635=typeof _0x1cefe3[_0x8284('0x1d')]==='undefined'&&typeof _0x1cefe3[_0x8284('0x1e')]===_0x8284('0x1f');var _0x497fca=_0x2be868[_0x8284('0x20')];var _0xc156ce=_0x249635?0x0:_0x1cefe3['offset'];var _0x2056c8=_0x249635?_0x2be868[_0x8284('0x20')]:_0x1cefe3['offset']+_0x1cefe3[_0x8284('0x1e')];var _0x466fbf;if(_0x2056c8>=_0x497fca){_0x2056c8=_0x497fca;_0x466fbf=0xc8;}else{_0x466fbf=0xce;}_0x234d1c[_0x8284('0x1a')](_0x466fbf);return _0x234d1c[_0x8284('0x21')](_0x8284('0x22'),_0xc156ce+'-'+_0x2056c8+'/'+_0x497fca)[_0x8284('0x1c')](_0x2be868);}return null;};}function patchUpdates(_0x40187c){return function(_0xdd081d){try{jsonpatch[_0x8284('0x23')](_0xdd081d,_0x40187c,!![]);}catch(_0x5b9be0){return BPromise[_0x8284('0x24')](_0x5b9be0);}return _0xdd081d['save']();};}function saveUpdates(_0x1dca94,_0x1eac53){return function(_0x3da701){if(_0x3da701){return _0x3da701[_0x8284('0x25')](_0x1dca94)[_0x8284('0x26')](function(_0x4a21c3){return _0x4a21c3;});}return null;};}function removeEntity(_0x55ed94,_0x3c9ac2){return function(_0x26644b){if(_0x26644b){return _0x26644b[_0x8284('0x27')]()[_0x8284('0x26')](function(){_0x55ed94[_0x8284('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b3e7d,_0x49e07b){return function(_0x2f5947){if(!_0x2f5947){_0x4b3e7d[_0x8284('0x28')](0x194);}return _0x2f5947;};}function handleError(_0x296833,_0x59ed21){_0x59ed21=_0x59ed21||0x1f4;return function(_0x5a1675){logger['error'](_0x5a1675[_0x8284('0x29')]);if(_0x5a1675['name']){delete _0x5a1675['name'];}_0x296833[_0x8284('0x1a')](_0x59ed21)[_0x8284('0x2a')](_0x5a1675);};}exports[_0x8284('0x2b')]=function(_0x433aa0,_0x4328cc){var _0x427cc8={},_0x5b3d5a={},_0x2dcc1d={'count':0x0,'rows':[]};var _0x12462a=_['map'](db[_0x8284('0x2c')][_0x8284('0x2d')],function(_0x279f8b){return{'name':_0x279f8b[_0x8284('0x2e')],'type':_0x279f8b[_0x8284('0x2f')]['key']};});_0x5b3d5a[_0x8284('0x30')]=_[_0x8284('0x31')](_0x12462a,'name');_0x5b3d5a[_0x8284('0x32')]=_['keys'](_0x433aa0[_0x8284('0x32')]);_0x5b3d5a[_0x8284('0x33')]=_[_0x8284('0x34')](_0x5b3d5a[_0x8284('0x30')],_0x5b3d5a[_0x8284('0x32')]);_0x427cc8[_0x8284('0x35')]=_['intersection'](_0x5b3d5a['model'],qs[_0x8284('0x36')](_0x433aa0[_0x8284('0x32')]['fields']));_0x427cc8['attributes']=_0x427cc8[_0x8284('0x35')]['length']?_0x427cc8[_0x8284('0x35')]:_0x5b3d5a[_0x8284('0x30')];if(!_0x433aa0[_0x8284('0x32')]['hasOwnProperty'](_0x8284('0x37'))){_0x427cc8[_0x8284('0x1e')]=qs['limit'](_0x433aa0['query'][_0x8284('0x1e')]);_0x427cc8[_0x8284('0x1d')]=qs[_0x8284('0x1d')](_0x433aa0[_0x8284('0x32')]['offset']);}_0x427cc8[_0x8284('0x38')]=qs[_0x8284('0x39')](_0x433aa0[_0x8284('0x32')][_0x8284('0x39')]);_0x427cc8[_0x8284('0x3a')]=qs['filters'](_[_0x8284('0x3b')](_0x433aa0[_0x8284('0x32')],_0x5b3d5a[_0x8284('0x33')]),_0x12462a);if(_0x433aa0[_0x8284('0x32')][_0x8284('0x3c')]){_0x427cc8[_0x8284('0x3a')]=_[_0x8284('0x3d')](_0x427cc8[_0x8284('0x3a')],{'$or':_[_0x8284('0x31')](_0x12462a,function(_0x4a2ba4){if(_0x4a2ba4[_0x8284('0x2f')]!==_0x8284('0x3e')){var _0x28aa13={};_0x28aa13[_0x4a2ba4[_0x8284('0x3f')]]={'$like':'%'+_0x433aa0['query'][_0x8284('0x3c')]+'%'};return _0x28aa13;}})});}_0x427cc8=_['merge']({},_0x427cc8,_0x433aa0[_0x8284('0x40')]);var _0x307c0a={'where':_0x427cc8[_0x8284('0x3a')]};return db[_0x8284('0x2c')][_0x8284('0x20')](_0x307c0a)[_0x8284('0x26')](function(_0x35b45c){_0x2dcc1d[_0x8284('0x20')]=_0x35b45c;if(_0x433aa0['query'][_0x8284('0x41')]){_0x427cc8['include']=[{'all':!![]}];}return db['ZohoAccount'][_0x8284('0x42')](_0x427cc8);})[_0x8284('0x26')](function(_0x2f8bdd){_0x2dcc1d[_0x8284('0x43')]=_0x2f8bdd;return _0x2dcc1d;})[_0x8284('0x26')](respondWithFilteredResult(_0x4328cc,_0x427cc8))[_0x8284('0x44')](handleError(_0x4328cc,null));};exports[_0x8284('0x45')]=function(_0x692704,_0x5d25b9){var _0xd5c4b={'raw':![],'where':{'id':_0x692704[_0x8284('0x46')]['id']}},_0x3c5bf2={};_0x3c5bf2[_0x8284('0x30')]=_[_0x8284('0x47')](db['ZohoAccount'][_0x8284('0x2d')]);_0x3c5bf2[_0x8284('0x32')]=_[_0x8284('0x47')](_0x692704[_0x8284('0x32')]);_0x3c5bf2['filters']=_[_0x8284('0x34')](_0x3c5bf2[_0x8284('0x30')],_0x3c5bf2[_0x8284('0x32')]);_0xd5c4b[_0x8284('0x35')]=_[_0x8284('0x34')](_0x3c5bf2[_0x8284('0x30')],qs[_0x8284('0x36')](_0x692704[_0x8284('0x32')][_0x8284('0x36')]));_0xd5c4b[_0x8284('0x35')]=_0xd5c4b[_0x8284('0x35')][_0x8284('0x48')]?_0xd5c4b['attributes']:_0x3c5bf2[_0x8284('0x30')];if(_0x692704[_0x8284('0x32')][_0x8284('0x41')]){_0xd5c4b['include']=[{'all':!![]}];}_0xd5c4b=_[_0x8284('0x3d')]({},_0xd5c4b,_0x692704[_0x8284('0x40')]);return db['ZohoAccount'][_0x8284('0x49')](_0xd5c4b)['then'](handleEntityNotFound(_0x5d25b9,null))['then'](respondWithResult(_0x5d25b9,null))[_0x8284('0x44')](handleError(_0x5d25b9,null));};exports[_0x8284('0x4a')]=function(_0x259a7f,_0x4bf6ea){return db[_0x8284('0x2c')][_0x8284('0x4a')](_0x259a7f['body'],{})['then'](respondWithResult(_0x4bf6ea,0xc9))['catch'](handleError(_0x4bf6ea,null));};exports[_0x8284('0x25')]=function(_0x5de239,_0x3d8f82){if(_0x5de239[_0x8284('0x4b')]['id']){delete _0x5de239[_0x8284('0x4b')]['id'];}return db[_0x8284('0x2c')][_0x8284('0x49')]({'where':{'id':_0x5de239[_0x8284('0x46')]['id']}})[_0x8284('0x26')](handleEntityNotFound(_0x3d8f82,null))[_0x8284('0x26')](saveUpdates(_0x5de239['body'],null))['then'](respondWithResult(_0x3d8f82,null))[_0x8284('0x44')](handleError(_0x3d8f82,null));};exports[_0x8284('0x27')]=function(_0x5bbc67,_0x7fab56){return db[_0x8284('0x2c')][_0x8284('0x49')]({'where':{'id':_0x5bbc67[_0x8284('0x46')]['id']}})[_0x8284('0x26')](handleEntityNotFound(_0x7fab56,null))[_0x8284('0x26')](removeEntity(_0x7fab56,null))[_0x8284('0x44')](handleError(_0x7fab56,null));};exports[_0x8284('0x4c')]=function(_0x58634e,_0x27c596,_0x246d37){var _0xbd7d5b={};var _0x42ae04={};var _0x40d012;var _0x5a26e5;return db[_0x8284('0x2c')][_0x8284('0x4d')]({'where':{'id':_0x58634e['params']['id']}})['then'](handleEntityNotFound(_0x27c596,null))[_0x8284('0x26')](function(_0x41432d){if(_0x41432d){_0x40d012=_0x41432d;_0x42ae04[_0x8284('0x30')]=_['keys'](db[_0x8284('0x4e')][_0x8284('0x2d')]);_0x42ae04[_0x8284('0x32')]=_['keys'](_0x58634e[_0x8284('0x32')]);_0x42ae04['filters']=_[_0x8284('0x34')](_0x42ae04[_0x8284('0x30')],_0x42ae04[_0x8284('0x32')]);_0xbd7d5b[_0x8284('0x35')]=_['intersection'](_0x42ae04[_0x8284('0x30')],qs['fields'](_0x58634e[_0x8284('0x32')][_0x8284('0x36')]));_0xbd7d5b[_0x8284('0x35')]=_0xbd7d5b['attributes'][_0x8284('0x48')]?_0xbd7d5b[_0x8284('0x35')]:_0x42ae04['model'];_0xbd7d5b[_0x8284('0x38')]=qs[_0x8284('0x39')](_0x58634e[_0x8284('0x32')]['sort']);_0xbd7d5b[_0x8284('0x3a')]=qs[_0x8284('0x33')](_['pick'](_0x58634e[_0x8284('0x32')],_0x42ae04[_0x8284('0x33')]));if(_0x58634e[_0x8284('0x32')]['filter']){_0xbd7d5b[_0x8284('0x3a')]=_[_0x8284('0x3d')](_0xbd7d5b[_0x8284('0x3a')],{'$or':_[_0x8284('0x31')](_0xbd7d5b[_0x8284('0x35')],function(_0x11cb2a){var _0x1a1308={};_0x1a1308[_0x11cb2a]={'$like':'%'+_0x58634e[_0x8284('0x32')][_0x8284('0x3c')]+'%'};return _0x1a1308;})});}_0xbd7d5b=_[_0x8284('0x3d')]({},_0xbd7d5b,_0x58634e['options']);return _0x40d012[_0x8284('0x4c')](_0xbd7d5b);}})[_0x8284('0x26')](function(_0x35fbc0){if(_0x35fbc0){_0x5a26e5=_0x35fbc0[_0x8284('0x48')];if(!_0x58634e[_0x8284('0x32')][_0x8284('0x4f')]('nolimit')){_0xbd7d5b[_0x8284('0x1e')]=qs['limit'](_0x58634e['query']['limit']);_0xbd7d5b['offset']=qs[_0x8284('0x1d')](_0x58634e['query'][_0x8284('0x1d')]);}return _0x40d012[_0x8284('0x4c')](_0xbd7d5b);}})['then'](function(_0x5da299){if(_0x5da299){return _0x5da299?{'count':_0x5a26e5,'rows':_0x5da299}:null;}})[_0x8284('0x26')](respondWithResult(_0x27c596,null))[_0x8284('0x44')](handleError(_0x27c596,null));};exports[_0x8284('0x50')]=function(_0x17cfcf,_0xb02d9d,_0x593289){if(_0x17cfcf[_0x8284('0x4b')]['id']){delete _0x17cfcf[_0x8284('0x4b')]['id'];}return db[_0x8284('0x2c')][_0x8284('0x4d')]({'where':{'id':_0x17cfcf[_0x8284('0x46')]['id']}})[_0x8284('0x26')](handleEntityNotFound(_0xb02d9d,null))[_0x8284('0x26')](function(_0x491193){if(_0x491193){_0x17cfcf[_0x8284('0x4b')][_0x8284('0x51')]=_0x491193['id'];_0x17cfcf[_0x8284('0x4b')][_0x8284('0x52')]=integrations[_0x8284('0x53')](_0x17cfcf[_0x8284('0x4b')][_0x8284('0x54')],_0x17cfcf['body'][_0x8284('0x2f')]);_0x17cfcf[_0x8284('0x4b')][_0x8284('0x55')]=integrations[_0x8284('0x56')](_0x17cfcf['body']['channel'],_0x17cfcf['body'][_0x8284('0x2f')]);return db[_0x8284('0x4e')][_0x8284('0x4a')](_0x17cfcf[_0x8284('0x4b')],{'include':[{'model':db[_0x8284('0x57')],'as':_0x8284('0x52')},{'model':db[_0x8284('0x57')],'as':_0x8284('0x55')}]});}return null;})[_0x8284('0x26')](respondWithResult(_0xb02d9d,null))['catch'](handleError(_0xb02d9d,null));};function getAccessToken(_0x277da2){return new Promise(function(_0x1813db,_0x50970b){var _0x4aa17c;switch(_0x277da2[_0x8284('0x58')]){case'US':_0x4aa17c=_0x8284('0x59');break;case'AU':_0x4aa17c='https://accounts.zoho.com.au';break;case'EU':_0x4aa17c='https://accounts.zoho.eu';break;case'IN':_0x4aa17c=_0x8284('0x5a');break;case'CN':_0x4aa17c=_0x8284('0x5b');break;default:_0x4aa17c=_0x8284('0x5c');break;}var _0x39b740={'method':'POST','uri':_0x4aa17c+_0x8284('0x5d'),'qs':{'refresh_token':_0x277da2[_0x8284('0x5e')],'client_id':_0x277da2[_0x8284('0x5f')],'client_secret':_0x277da2['clientSecret'],'grant_type':_0x8284('0x60')},'json':!![]};return rp(_0x39b740)['then'](function(_0x5678c5){if(_0x5678c5['access_token']){_0x1813db(_0x5678c5['access_token']);}else{_0x50970b(_0x8284('0x61'));}})[_0x8284('0x44')](function(_0x5adcab){_0x50970b(_0x5adcab);});});}exports['getFields']=function(_0x20dfe5,_0x33cb69,_0x2afa26){var _0x46e39c,_0x17c62a,_0x367382,_0x24c4a2,_0x26ec0e;return db['ZohoAccount']['findOne']({'where':{'id':_0x20dfe5['params']['id']},'attributes':['id',_0x8284('0x62'),_0x8284('0x58'),'clientId','clientSecret',_0x8284('0x63'),_0x8284('0x64'),_0x8284('0x5e')]})[_0x8284('0x26')](handleEntityNotFound(_0x33cb69,null))[_0x8284('0x26')](function(_0x287c76){_0x26ec0e=_0x287c76;_0x46e39c=_0x26ec0e['host'];_0x17c62a=_0x46e39c===_0x8284('0x65')?'eu':_0x8284('0x66');_0x367382=_0x26ec0e[_0x8284('0x63')];var _0x84c130=_0x367382[_0x8284('0x67')](-0x1);if(_0x84c130==='/'||_0x84c130==='\x5c'||_0x84c130===':'){_0x367382=_0x367382[_0x8284('0x68')](0x0,_0x367382[_0x8284('0x69')](_0x84c130));}if(!_0x26ec0e[_0x8284('0x5e')]){throw new Error(_0x8284('0x6a'));}return getAccessToken(_0x26ec0e);})[_0x8284('0x26')](function(_0x43b862){if(_0x43b862){return rp({'method':'GET','uri':util[_0x8284('0x6b')](_0x8284('0x6c'),_0x17c62a),'qs':{'module':_0x8284('0x6d')},'headers':{'Authorization':_0x8284('0x6e')+_0x43b862},'json':!![]});}})[_0x8284('0x26')](function(_0x52d998){if(_0x52d998){if(_0x52d998[_0x8284('0x6f')]&&_0x52d998[_0x8284('0x6f')][_0x8284('0x70')]){throw new Error(_0x52d998[_0x8284('0x6f')][_0x8284('0x70')][_0x8284('0x71')]);}var _0x441c43=[];var _0x2c1b56=[];var _0x332d66=[_0x8284('0x72'),'Subject','Description',_0x8284('0x73'),_0x8284('0x74'),'Call_Result',_0x8284('0x75'),_0x8284('0x76')];_0x2c1b56=_['remove'](_0x52d998[_0x8284('0x36')],function(_0xba8d85){return _0x332d66[_0x8284('0x77')](_0xba8d85[_0x8284('0x78')]);});for(var _0x36d369=0x0;_0x36d369<_0x2c1b56[_0x8284('0x48')];_0x36d369++){if(_0x2c1b56[_0x36d369]['system_mandatory']===![]){_0x441c43[_0x8284('0x79')]({'id':_0x2c1b56[_0x36d369]['id'],'name':_0x2c1b56[_0x36d369][_0x8284('0x7a')],'custom':_0x2c1b56[_0x36d369][_0x8284('0x7b')],'options':_0x2c1b56[_0x36d369]['data_type']===_0x8284('0x7c')&&_0x2c1b56[_0x36d369]['pick_list_values'][_0x8284('0x48')]>-0x1?_[_0x8284('0x31')](_0x2c1b56[_0x36d369]['pick_list_values'],function(_0x1c23d4){return{'name':_0x1c23d4,'value':_0x1c23d4};}):[]});}}return{'count':_0x441c43[_0x8284('0x48')],'rows':_0x441c43};}else{return{'count':0x0,'rows':[]};}})[_0x8284('0x26')](respondWithResult(_0x33cb69,null))['catch'](function(_0x5a245f){var _0x48a5bf=_0x20dfe5[_0x8284('0x32')]['test']?0x1f4:_0x5a245f[_0x8284('0x7d')]||0x1f4;logger[_0x8284('0x70')]('getFields,\x20%s,\x20%s,\x20%s',_0x8284('0x7e'),_0x48a5bf,JSON[_0x8284('0x7f')](_0x5a245f));delete _0x5a245f[_0x8284('0x3f')];if(_0x48a5bf===0x191){_0x48a5bf=0x190;}_0x33cb69[_0x8284('0x1a')](_0x48a5bf)[_0x8284('0x2a')](_0x20dfe5[_0x8284('0x32')]['test']?{'message':_0x8284('0x80'),'statusCode':_0x5a245f[_0x8284('0x7d')]}:_0x5a245f);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 3049958..ed9820d 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 _0x2188=['https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','clientId','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','info','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','format','host','substring','/oauth/v2/token','authorization_code','catch','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientSecret','code','slice','lastIndexOf','https://accounts.zoho.com'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2188,0x176));var _0x8218=function(_0x3b7d25,_0x5d450f){_0x3b7d25=_0x3b7d25-0x0;var _0x409834=_0x2188[_0x3b7d25];return _0x409834;};'use strict';var _=require(_0x8218('0x0'));var util=require(_0x8218('0x1'));var logger=require(_0x8218('0x2'))(_0x8218('0x3'));var moment=require(_0x8218('0x4'));var BPromise=require(_0x8218('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8218('0x6'));var config=require(_0x8218('0x7'));var attributes=require(_0x8218('0x8'));var integrations=require(_0x8218('0x9'));module[_0x8218('0xa')]=function(_0xd511f0,_0xda42c9){return _0xd511f0[_0x8218('0xb')](_0x8218('0xc'),attributes,{'tableName':_0x8218('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2a112c,_0x5cbf87,_0x2dc660){if(_0x2a112c[_0x8218('0xe')](_0x8218('0xf'))||_0x2a112c[_0x8218('0xe')](_0x8218('0x10'))||_0x2a112c[_0x8218('0xe')]('clientId')||_0x2a112c[_0x8218('0xe')](_0x8218('0x11'))||_0x2a112c[_0x8218('0xe')](_0x8218('0x12'))||_0x2a112c[_0x8218('0xe')]('host')){var _0xee4857,_0x4d6b53;_0xee4857=_0x2a112c[_0x8218('0x10')];var _0x248152=_0xee4857[_0x8218('0x13')](-0x1);if(_0x248152==='/'||_0x248152==='\x5c'||_0x248152===':'){_0xee4857=_0xee4857['substring'](0x0,_0xee4857[_0x8218('0x14')](_0x248152));}switch(_0x2a112c[_0x8218('0xf')]){case'US':_0x4d6b53=_0x8218('0x15');break;case'AU':_0x4d6b53='https://accounts.zoho.com.au';break;case'IN':_0x4d6b53=_0x8218('0x16');break;case'CN':_0x4d6b53=_0x8218('0x17');break;default:_0x4d6b53=_0x8218('0x18');break;}var _0x37dbd1={'method':_0x8218('0x19'),'uri':_0x4d6b53+'/oauth/v2/token','form':{'grant_type':'authorization_code','client_id':_0x2a112c[_0x8218('0x1a')],'client_secret':_0x2a112c[_0x8218('0x11')],'redirect_uri':_0x2a112c[_0x8218('0x10')],'code':_0x2a112c['code']},'headers':{'Content-Type':_0x8218('0x1b')}};return rp(_0x37dbd1)[_0x8218('0x1c')](function(_0x1fed82){var _0x2a7d1e=JSON[_0x8218('0x1d')](_0x1fed82);if(_0x2a7d1e[_0x8218('0x1e')]){_0x2a112c[_0x8218('0x1f')]=_0x2a7d1e[_0x8218('0x1e')];logger[_0x8218('0x20')](util['format'](_0x8218('0x21'),_0x2a112c[_0x8218('0x22')],_0x2a112c['id']));}else{logger[_0x8218('0x23')](util['format'](_0x8218('0x24'),_0x2a112c[_0x8218('0x22')],_0x2a112c['id']),util[_0x8218('0x25')](_0x2a7d1e,{'showHidden':![],'depth':null}));}return _0x2dc660(null,_0x5cbf87);})['catch'](function(_0x4dda62){logger[_0x8218('0x23')](util[_0x8218('0x26')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x2a112c[_0x8218('0x22')],_0x2a112c['id']),util[_0x8218('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x2dc660(_0x4dda62);});}else{return _0x2dc660(null,_0x5cbf87);}},'beforeUpdate':function(_0x56dd26,_0xc92950,_0x6c24f){if(_0x56dd26[_0x8218('0xe')](_0x8218('0xf'))||_0x56dd26[_0x8218('0xe')]('serverUrl')||_0x56dd26['changed']('clientId')||_0x56dd26[_0x8218('0xe')](_0x8218('0x11'))||_0x56dd26[_0x8218('0xe')](_0x8218('0x12'))||_0x56dd26[_0x8218('0xe')](_0x8218('0x27'))){var _0x1338b9,_0x18fa5b;_0x1338b9=_0x56dd26['serverUrl'];var _0x2452c1=_0x1338b9[_0x8218('0x13')](-0x1);if(_0x2452c1==='/'||_0x2452c1==='\x5c'||_0x2452c1===':'){_0x1338b9=_0x1338b9[_0x8218('0x28')](0x0,_0x1338b9['lastIndexOf'](_0x2452c1));}switch(_0x56dd26[_0x8218('0xf')]){case'US':_0x18fa5b=_0x8218('0x15');break;case'AU':_0x18fa5b='https://accounts.zoho.com.au';break;case'IN':_0x18fa5b=_0x8218('0x16');break;case'CN':_0x18fa5b=_0x8218('0x17');break;default:_0x18fa5b='https://accounts.zoho.eu';break;}var _0x2f28d6={'method':_0x8218('0x19'),'uri':_0x18fa5b+_0x8218('0x29'),'form':{'grant_type':_0x8218('0x2a'),'client_id':_0x56dd26[_0x8218('0x1a')],'client_secret':_0x56dd26[_0x8218('0x11')],'redirect_uri':_0x56dd26[_0x8218('0x10')],'code':_0x56dd26['code']},'headers':{'Content-Type':_0x8218('0x1b')}};return rp(_0x2f28d6)[_0x8218('0x1c')](function(_0x501d63){var _0x5f099d=JSON[_0x8218('0x1d')](_0x501d63);if(_0x5f099d[_0x8218('0x1e')]){_0x56dd26[_0x8218('0x1f')]=_0x5f099d[_0x8218('0x1e')];logger['info'](util[_0x8218('0x26')](_0x8218('0x21'),_0x56dd26[_0x8218('0x22')],_0x56dd26['id']));}else{logger[_0x8218('0x23')](util[_0x8218('0x26')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x56dd26[_0x8218('0x22')],_0x56dd26['id']),util[_0x8218('0x25')](_0x5f099d,{'showHidden':![],'depth':null}));}return _0x6c24f(null,_0xc92950);})[_0x8218('0x2b')](function(_0x1c2011){logger['error'](util[_0x8218('0x26')](_0x8218('0x24'),_0x56dd26[_0x8218('0x22')],_0x56dd26['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x6c24f(_0x1c2011);});}else{return _0x6c24f(null,_0xc92950);}}}});}; \ No newline at end of file +var _0xfc23=['host','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','clientId','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','define','ZohoAccount','changed','zone','serverUrl','clientSecret','code'];(function(_0x13c3ff,_0x4c6731){var _0x2a681a=function(_0x499a8f){while(--_0x499a8f){_0x13c3ff['push'](_0x13c3ff['shift']());}};_0x2a681a(++_0x4c6731);}(_0xfc23,0xb3));var _0x3fc2=function(_0x142d5a,_0x70e272){_0x142d5a=_0x142d5a-0x0;var _0x155434=_0xfc23[_0x142d5a];return _0x155434;};'use strict';var _=require('lodash');var util=require(_0x3fc2('0x0'));var logger=require(_0x3fc2('0x1'))('api');var moment=require(_0x3fc2('0x2'));var BPromise=require(_0x3fc2('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3fc2('0x4'));var rimraf=require(_0x3fc2('0x5'));var config=require(_0x3fc2('0x6'));var attributes=require(_0x3fc2('0x7'));var integrations=require(_0x3fc2('0x8'));module['exports']=function(_0x19c400,_0x479626){return _0x19c400[_0x3fc2('0x9')](_0x3fc2('0xa'),attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x41560f,_0x53d41c,_0x46dfaf){if(_0x41560f[_0x3fc2('0xb')](_0x3fc2('0xc'))||_0x41560f[_0x3fc2('0xb')](_0x3fc2('0xd'))||_0x41560f[_0x3fc2('0xb')]('clientId')||_0x41560f[_0x3fc2('0xb')](_0x3fc2('0xe'))||_0x41560f[_0x3fc2('0xb')](_0x3fc2('0xf'))||_0x41560f['changed'](_0x3fc2('0x10'))){var _0x2e3b31,_0x97a4ec;_0x2e3b31=_0x41560f[_0x3fc2('0xd')];var _0x93c79f=_0x2e3b31['slice'](-0x1);if(_0x93c79f==='/'||_0x93c79f==='\x5c'||_0x93c79f===':'){_0x2e3b31=_0x2e3b31[_0x3fc2('0x11')](0x0,_0x2e3b31[_0x3fc2('0x12')](_0x93c79f));}switch(_0x41560f[_0x3fc2('0xc')]){case'US':_0x97a4ec=_0x3fc2('0x13');break;case'AU':_0x97a4ec=_0x3fc2('0x14');break;case'IN':_0x97a4ec=_0x3fc2('0x15');break;case'CN':_0x97a4ec=_0x3fc2('0x16');break;default:_0x97a4ec=_0x3fc2('0x17');break;}var _0xa73dd4={'method':_0x3fc2('0x18'),'uri':_0x97a4ec+_0x3fc2('0x19'),'form':{'grant_type':_0x3fc2('0x1a'),'client_id':_0x41560f[_0x3fc2('0x1b')],'client_secret':_0x41560f['clientSecret'],'redirect_uri':_0x41560f[_0x3fc2('0xd')],'code':_0x41560f[_0x3fc2('0xf')]},'headers':{'Content-Type':_0x3fc2('0x1c')}};return rp(_0xa73dd4)[_0x3fc2('0x1d')](function(_0x491a6a){var _0x42e636=JSON[_0x3fc2('0x1e')](_0x491a6a);if(_0x42e636[_0x3fc2('0x1f')]){_0x41560f[_0x3fc2('0x20')]=_0x42e636[_0x3fc2('0x1f')];logger['info'](util[_0x3fc2('0x21')](_0x3fc2('0x22'),_0x41560f[_0x3fc2('0x23')],_0x41560f['id']));}else{logger[_0x3fc2('0x24')](util[_0x3fc2('0x21')](_0x3fc2('0x25'),_0x41560f[_0x3fc2('0x23')],_0x41560f['id']),util['inspect'](_0x42e636,{'showHidden':![],'depth':null}));}return _0x46dfaf(null,_0x53d41c);})['catch'](function(_0x4fa848){logger[_0x3fc2('0x24')](util[_0x3fc2('0x21')](_0x3fc2('0x25'),_0x41560f[_0x3fc2('0x23')],_0x41560f['id']),util[_0x3fc2('0x26')](parsedResult,{'showHidden':![],'depth':null}));return _0x46dfaf(_0x4fa848);});}else{return _0x46dfaf(null,_0x53d41c);}},'beforeUpdate':function(_0x200c51,_0x3d3bc8,_0x2db527){if(_0x200c51['changed']('zone')||_0x200c51['changed'](_0x3fc2('0xd'))||_0x200c51['changed'](_0x3fc2('0x1b'))||_0x200c51['changed'](_0x3fc2('0xe'))||_0x200c51[_0x3fc2('0xb')](_0x3fc2('0xf'))||_0x200c51[_0x3fc2('0xb')]('host')){var _0x1717c5,_0x14bf07;_0x1717c5=_0x200c51[_0x3fc2('0xd')];var _0x5670a2=_0x1717c5['slice'](-0x1);if(_0x5670a2==='/'||_0x5670a2==='\x5c'||_0x5670a2===':'){_0x1717c5=_0x1717c5[_0x3fc2('0x11')](0x0,_0x1717c5[_0x3fc2('0x12')](_0x5670a2));}switch(_0x200c51[_0x3fc2('0xc')]){case'US':_0x14bf07=_0x3fc2('0x13');break;case'AU':_0x14bf07='https://accounts.zoho.com.au';break;case'IN':_0x14bf07=_0x3fc2('0x15');break;case'CN':_0x14bf07=_0x3fc2('0x16');break;default:_0x14bf07='https://accounts.zoho.eu';break;}var _0x5106bb={'method':_0x3fc2('0x18'),'uri':_0x14bf07+_0x3fc2('0x19'),'form':{'grant_type':_0x3fc2('0x1a'),'client_id':_0x200c51[_0x3fc2('0x1b')],'client_secret':_0x200c51[_0x3fc2('0xe')],'redirect_uri':_0x200c51['serverUrl'],'code':_0x200c51[_0x3fc2('0xf')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x5106bb)[_0x3fc2('0x1d')](function(_0x31a4be){var _0xfa7277=JSON[_0x3fc2('0x1e')](_0x31a4be);if(_0xfa7277[_0x3fc2('0x1f')]){_0x200c51['refreshToken']=_0xfa7277['refresh_token'];logger['info'](util[_0x3fc2('0x21')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x200c51[_0x3fc2('0x23')],_0x200c51['id']));}else{logger[_0x3fc2('0x24')](util[_0x3fc2('0x21')](_0x3fc2('0x25'),_0x200c51[_0x3fc2('0x23')],_0x200c51['id']),util['inspect'](_0xfa7277,{'showHidden':![],'depth':null}));}return _0x2db527(null,_0x3d3bc8);})['catch'](function(_0x1585f5){logger[_0x3fc2('0x24')](util[_0x3fc2('0x21')](_0x3fc2('0x25'),_0x200c51[_0x3fc2('0x23')],_0x200c51['id']),util[_0x3fc2('0x26')](parsedResult,{'showHidden':![],'depth':null}));return _0x2db527(_0x1585f5);});}else{return _0x2db527(null,_0x3d3bc8);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index db3a554..742eb9f 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 _0x0447=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','error','ZohoAccount,\x20%s,\x20%s','message','result','GetZohoAccount','ZohoAccount','findAll','options','where','include','map','model','attributes','then','stringify','ShowZohoAccount','raw','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x4515bb,_0x5e527c){var _0x44311e=function(_0x35a851){while(--_0x35a851){_0x4515bb['push'](_0x4515bb['shift']());}};_0x44311e(++_0x5e527c);}(_0x0447,0x8b));var _0x7044=function(_0x315add,_0x5e9ace){_0x315add=_0x315add-0x0;var _0x40956b=_0x0447[_0x315add];return _0x40956b;};'use strict';var _=require(_0x7044('0x0'));var util=require(_0x7044('0x1'));var moment=require(_0x7044('0x2'));var BPromise=require(_0x7044('0x3'));var rs=require(_0x7044('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7044('0x5'))['db'];var utils=require(_0x7044('0x6'));var logger=require(_0x7044('0x7'))(_0x7044('0x8'));var config=require(_0x7044('0x9'));var jayson=require(_0x7044('0xa'));var client=jayson[_0x7044('0xb')][_0x7044('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x66b8cb,_0x51de50,_0x72d341){return new BPromise(function(_0x42d53b,_0x2a2b36){return client[_0x7044('0xd')](_0x66b8cb,_0x72d341)['then'](function(_0x41616d){logger[_0x7044('0xe')]('ZohoAccount,\x20%s,\x20%s',_0x51de50,_0x7044('0xf'));logger[_0x7044('0x10')](_0x7044('0x11'),_0x51de50,_0x7044('0xf'),JSON['stringify'](_0x41616d));if(_0x41616d[_0x7044('0x12')]){if(_0x41616d['error']['code']===0x1f4){logger['error'](_0x7044('0x13'),_0x51de50,_0x41616d[_0x7044('0x12')][_0x7044('0x14')]);return _0x2a2b36(_0x41616d[_0x7044('0x12')]['message']);}logger['error'](_0x7044('0x13'),_0x51de50,_0x41616d[_0x7044('0x12')]['message']);return _0x42d53b(_0x41616d['error'][_0x7044('0x14')]);}else{logger[_0x7044('0xe')](_0x7044('0x13'),_0x51de50,_0x7044('0xf'));_0x42d53b(_0x41616d[_0x7044('0x15')][_0x7044('0x14')]);}})['catch'](function(_0xdae8a){logger[_0x7044('0x12')](_0x7044('0x13'),_0x51de50,_0xdae8a);_0x2a2b36(_0xdae8a);});});}exports[_0x7044('0x16')]=function(_0x219486){var _0x3f373c=this;return new Promise(function(_0x4df89b,_0x1f300e){return db[_0x7044('0x17')][_0x7044('0x18')]({'raw':_0x219486['options']?_0x219486['options']['raw']===undefined?!![]:![]:!![],'where':_0x219486[_0x7044('0x19')]?_0x219486[_0x7044('0x19')][_0x7044('0x1a')]||null:null,'attributes':_0x219486[_0x7044('0x19')]?_0x219486[_0x7044('0x19')]['attributes']||null:null,'limit':_0x219486[_0x7044('0x19')]?_0x219486['options']['limit']||null:null,'include':_0x219486[_0x7044('0x19')]?_0x219486[_0x7044('0x19')][_0x7044('0x1b')]?_[_0x7044('0x1c')](_0x219486[_0x7044('0x19')][_0x7044('0x1b')],function(_0x41a079){return{'model':db[_0x41a079[_0x7044('0x1d')]],'as':_0x41a079['as'],'attributes':_0x41a079[_0x7044('0x1e')],'include':_0x41a079['include']?_['map'](_0x41a079[_0x7044('0x1b')],function(_0x16c18b){return{'model':db[_0x16c18b[_0x7044('0x1d')]],'as':_0x16c18b['as'],'attributes':_0x16c18b[_0x7044('0x1e')],'include':_0x16c18b[_0x7044('0x1b')]?_[_0x7044('0x1c')](_0x16c18b[_0x7044('0x1b')],function(_0x45ae52){return{'model':db[_0x45ae52[_0x7044('0x1d')]],'as':_0x45ae52['as'],'attributes':_0x45ae52[_0x7044('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x7044('0x1f')](function(_0x115d5c){logger['info'](_0x7044('0x16'),_0x219486);logger[_0x7044('0x10')](_0x7044('0x16'),_0x219486,JSON[_0x7044('0x20')](_0x115d5c));_0x4df89b(_0x115d5c);})['catch'](function(_0x2261af){logger['error']('GetZohoAccount',_0x2261af['message'],_0x219486);_0x1f300e(_0x3f373c[_0x7044('0x12')](0x1f4,_0x2261af['message']));});});};exports[_0x7044('0x21')]=function(_0x37a70f){var _0x5849fd=this;return new Promise(function(_0x4c8e27,_0x11fdeb){return db['ZohoAccount']['find']({'raw':_0x37a70f['options']?_0x37a70f[_0x7044('0x19')][_0x7044('0x22')]===undefined?!![]:![]:!![],'where':_0x37a70f['options']?_0x37a70f[_0x7044('0x19')][_0x7044('0x1a')]||null:null,'attributes':_0x37a70f[_0x7044('0x19')]?_0x37a70f[_0x7044('0x19')][_0x7044('0x1e')]||null:null,'include':_0x37a70f['options']?_0x37a70f[_0x7044('0x19')][_0x7044('0x1b')]?_[_0x7044('0x1c')](_0x37a70f[_0x7044('0x19')][_0x7044('0x1b')],function(_0x4c2864){return{'model':db[_0x4c2864[_0x7044('0x1d')]],'as':_0x4c2864['as'],'attributes':_0x4c2864[_0x7044('0x1e')],'include':_0x4c2864['include']?_[_0x7044('0x1c')](_0x4c2864[_0x7044('0x1b')],function(_0x1636fd){return{'model':db[_0x1636fd[_0x7044('0x1d')]],'as':_0x1636fd['as'],'attributes':_0x1636fd[_0x7044('0x1e')],'include':_0x1636fd[_0x7044('0x1b')]?_['map'](_0x1636fd['include'],function(_0x470ad6){return{'model':db[_0x470ad6[_0x7044('0x1d')]],'as':_0x470ad6['as'],'attributes':_0x470ad6['attributes']};}):[]};}):[]};}):[]:[]})[_0x7044('0x1f')](function(_0x4232ce){logger[_0x7044('0xe')](_0x7044('0x21'),_0x37a70f);logger[_0x7044('0x10')](_0x7044('0x21'),_0x37a70f,JSON[_0x7044('0x20')](_0x4232ce));_0x4c8e27(_0x4232ce);})[_0x7044('0x23')](function(_0x5cae78){logger['error'](_0x7044('0x21'),_0x5cae78[_0x7044('0x14')],_0x37a70f);_0x11fdeb(_0x5849fd[_0x7044('0x12')](0x1f4,_0x5cae78[_0x7044('0x14')]));});});}; \ No newline at end of file +var _0xd4ad=['stringify','ShowZohoAccount','find','raw','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','http','request','then','info','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','error','message','ZohoAccount,\x20%s,\x20%s','result','catch','GetZohoAccount','ZohoAccount','options','where','attributes','limit','include','map','model'];(function(_0x4c3dc3,_0x10d8bc){var _0x265aaa=function(_0x3d98cd){while(--_0x3d98cd){_0x4c3dc3['push'](_0x4c3dc3['shift']());}};_0x265aaa(++_0x10d8bc);}(_0xd4ad,0x1e4));var _0xdd4a=function(_0x522fa6,_0x1cf79f){_0x522fa6=_0x522fa6-0x0;var _0x17cdef=_0xd4ad[_0x522fa6];return _0x17cdef;};'use strict';var _=require(_0xdd4a('0x0'));var util=require(_0xdd4a('0x1'));var moment=require(_0xdd4a('0x2'));var BPromise=require(_0xdd4a('0x3'));var rs=require(_0xdd4a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xdd4a('0x5'));var logger=require(_0xdd4a('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xdd4a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4fdfa2,_0x2f0952,_0x5b5ab3){return new BPromise(function(_0x3c7a01,_0x45647c){return client[_0xdd4a('0x8')](_0x4fdfa2,_0x5b5ab3)[_0xdd4a('0x9')](function(_0xd1ee35){logger[_0xdd4a('0xa')]('ZohoAccount,\x20%s,\x20%s',_0x2f0952,_0xdd4a('0xb'));logger[_0xdd4a('0xc')](_0xdd4a('0xd'),_0x2f0952,'request\x20sent',JSON['stringify'](_0xd1ee35));if(_0xd1ee35[_0xdd4a('0xe')]){if(_0xd1ee35[_0xdd4a('0xe')]['code']===0x1f4){logger[_0xdd4a('0xe')]('ZohoAccount,\x20%s,\x20%s',_0x2f0952,_0xd1ee35[_0xdd4a('0xe')][_0xdd4a('0xf')]);return _0x45647c(_0xd1ee35[_0xdd4a('0xe')][_0xdd4a('0xf')]);}logger[_0xdd4a('0xe')](_0xdd4a('0x10'),_0x2f0952,_0xd1ee35[_0xdd4a('0xe')]['message']);return _0x3c7a01(_0xd1ee35[_0xdd4a('0xe')][_0xdd4a('0xf')]);}else{logger[_0xdd4a('0xa')](_0xdd4a('0x10'),_0x2f0952,_0xdd4a('0xb'));_0x3c7a01(_0xd1ee35[_0xdd4a('0x11')][_0xdd4a('0xf')]);}})[_0xdd4a('0x12')](function(_0x42bc93){logger[_0xdd4a('0xe')](_0xdd4a('0x10'),_0x2f0952,_0x42bc93);_0x45647c(_0x42bc93);});});}exports[_0xdd4a('0x13')]=function(_0x95c5ec){var _0xdf7dd6=this;return new Promise(function(_0x20fb04,_0x15f6ab){return db[_0xdd4a('0x14')]['findAll']({'raw':_0x95c5ec[_0xdd4a('0x15')]?_0x95c5ec['options']['raw']===undefined?!![]:![]:!![],'where':_0x95c5ec[_0xdd4a('0x15')]?_0x95c5ec['options'][_0xdd4a('0x16')]||null:null,'attributes':_0x95c5ec['options']?_0x95c5ec['options'][_0xdd4a('0x17')]||null:null,'limit':_0x95c5ec[_0xdd4a('0x15')]?_0x95c5ec[_0xdd4a('0x15')][_0xdd4a('0x18')]||null:null,'include':_0x95c5ec['options']?_0x95c5ec['options'][_0xdd4a('0x19')]?_[_0xdd4a('0x1a')](_0x95c5ec['options']['include'],function(_0x3d2b3a){return{'model':db[_0x3d2b3a['model']],'as':_0x3d2b3a['as'],'attributes':_0x3d2b3a[_0xdd4a('0x17')],'include':_0x3d2b3a[_0xdd4a('0x19')]?_[_0xdd4a('0x1a')](_0x3d2b3a[_0xdd4a('0x19')],function(_0x3527d1){return{'model':db[_0x3527d1[_0xdd4a('0x1b')]],'as':_0x3527d1['as'],'attributes':_0x3527d1[_0xdd4a('0x17')],'include':_0x3527d1[_0xdd4a('0x19')]?_['map'](_0x3527d1[_0xdd4a('0x19')],function(_0x313454){return{'model':db[_0x313454[_0xdd4a('0x1b')]],'as':_0x313454['as'],'attributes':_0x313454[_0xdd4a('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x40c8cf){logger['info']('GetZohoAccount',_0x95c5ec);logger['debug'](_0xdd4a('0x13'),_0x95c5ec,JSON[_0xdd4a('0x1c')](_0x40c8cf));_0x20fb04(_0x40c8cf);})[_0xdd4a('0x12')](function(_0x3a5033){logger[_0xdd4a('0xe')](_0xdd4a('0x13'),_0x3a5033[_0xdd4a('0xf')],_0x95c5ec);_0x15f6ab(_0xdf7dd6[_0xdd4a('0xe')](0x1f4,_0x3a5033['message']));});});};exports[_0xdd4a('0x1d')]=function(_0x2c574f){var _0x19619b=this;return new Promise(function(_0x33c767,_0x543970){return db[_0xdd4a('0x14')][_0xdd4a('0x1e')]({'raw':_0x2c574f[_0xdd4a('0x15')]?_0x2c574f[_0xdd4a('0x15')][_0xdd4a('0x1f')]===undefined?!![]:![]:!![],'where':_0x2c574f['options']?_0x2c574f[_0xdd4a('0x15')][_0xdd4a('0x16')]||null:null,'attributes':_0x2c574f[_0xdd4a('0x15')]?_0x2c574f[_0xdd4a('0x15')]['attributes']||null:null,'include':_0x2c574f['options']?_0x2c574f['options'][_0xdd4a('0x19')]?_[_0xdd4a('0x1a')](_0x2c574f['options']['include'],function(_0x1546cd){return{'model':db[_0x1546cd[_0xdd4a('0x1b')]],'as':_0x1546cd['as'],'attributes':_0x1546cd[_0xdd4a('0x17')],'include':_0x1546cd['include']?_['map'](_0x1546cd[_0xdd4a('0x19')],function(_0x4e94a7){return{'model':db[_0x4e94a7[_0xdd4a('0x1b')]],'as':_0x4e94a7['as'],'attributes':_0x4e94a7[_0xdd4a('0x17')],'include':_0x4e94a7['include']?_[_0xdd4a('0x1a')](_0x4e94a7['include'],function(_0x54f366){return{'model':db[_0x54f366['model']],'as':_0x54f366['as'],'attributes':_0x54f366[_0xdd4a('0x17')]};}):[]};}):[]};}):[]:[]})[_0xdd4a('0x9')](function(_0x33f778){logger[_0xdd4a('0xa')](_0xdd4a('0x1d'),_0x2c574f);logger[_0xdd4a('0xc')](_0xdd4a('0x1d'),_0x2c574f,JSON[_0xdd4a('0x1c')](_0x33f778));_0x33c767(_0x33f778);})['catch'](function(_0x2db628){logger['error']('ShowZohoAccount',_0x2db628[_0xdd4a('0xf')],_0x2c574f);_0x543970(_0x19619b[_0xdd4a('0xe')](0x1f4,_0x2db628[_0xdd4a('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 3eb9794..ab036ba 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 _0x0775=['put','/:id','update','delete','exports','util','path','express','Router','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create'];(function(_0x3adc5a,_0x1ee4ad){var _0x225912=function(_0x485e7d){while(--_0x485e7d){_0x3adc5a['push'](_0x3adc5a['shift']());}};_0x225912(++_0x1ee4ad);}(_0x0775,0x1d3));var _0x5077=function(_0x321ee8,_0x47cda7){_0x321ee8=_0x321ee8-0x0;var _0x5b6ded=_0x0775[_0x321ee8];return _0x5b6ded;};'use strict';var multer=require('multer');var util=require(_0x5077('0x0'));var path=require(_0x5077('0x1'));var timeout=require('connect-timeout');var express=require(_0x5077('0x2'));var router=express[_0x5077('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x5077('0x4'));var config=require(_0x5077('0x5'));var controller=require('./intZohoConfiguration.controller');router[_0x5077('0x6')]('/',auth['isAuthenticated'](),controller[_0x5077('0x7')]);router[_0x5077('0x6')]('/:id',auth[_0x5077('0x8')](),controller['show']);router[_0x5077('0x6')]('/:id/fields',auth[_0x5077('0x8')](),controller[_0x5077('0x9')]);router[_0x5077('0x6')](_0x5077('0xa'),auth[_0x5077('0x8')](),controller[_0x5077('0xb')]);router[_0x5077('0x6')](_0x5077('0xc'),auth[_0x5077('0x8')](),controller[_0x5077('0xd')]);router[_0x5077('0xe')]('/',auth[_0x5077('0x8')](),controller[_0x5077('0xf')]);router[_0x5077('0x10')](_0x5077('0x11'),auth[_0x5077('0x8')](),controller[_0x5077('0x12')]);router[_0x5077('0x13')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x5077('0x14')]=router; \ No newline at end of file +var _0x9b58=['get','isAuthenticated','index','/:id','show','/:id/fields','/:id/subjects','/:id/descriptions','getDescriptions','create','delete','destroy','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller'];(function(_0x43e7d9,_0x5e35bb){var _0x397425=function(_0x50bea5){while(--_0x50bea5){_0x43e7d9['push'](_0x43e7d9['shift']());}};_0x397425(++_0x5e35bb);}(_0x9b58,0x1b0));var _0x89b5=function(_0x3e7d62,_0x293f4e){_0x3e7d62=_0x3e7d62-0x0;var _0x512f5a=_0x9b58[_0x3e7d62];return _0x512f5a;};'use strict';var multer=require(_0x89b5('0x0'));var util=require(_0x89b5('0x1'));var path=require(_0x89b5('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x89b5('0x3')]();var fs_extra=require(_0x89b5('0x4'));var auth=require(_0x89b5('0x5'));var interaction=require(_0x89b5('0x6'));var config=require(_0x89b5('0x7'));var controller=require(_0x89b5('0x8'));router[_0x89b5('0x9')]('/',auth[_0x89b5('0xa')](),controller[_0x89b5('0xb')]);router[_0x89b5('0x9')](_0x89b5('0xc'),auth[_0x89b5('0xa')](),controller[_0x89b5('0xd')]);router[_0x89b5('0x9')](_0x89b5('0xe'),auth['isAuthenticated'](),controller['getFields']);router['get'](_0x89b5('0xf'),auth[_0x89b5('0xa')](),controller['getSubjects']);router[_0x89b5('0x9')](_0x89b5('0x10'),auth[_0x89b5('0xa')](),controller[_0x89b5('0x11')]);router['post']('/',auth[_0x89b5('0xa')](),controller[_0x89b5('0x12')]);router['put'](_0x89b5('0xc'),auth[_0x89b5('0xa')](),controller['update']);router[_0x89b5('0x13')](_0x89b5('0xc'),auth[_0x89b5('0xa')](),controller[_0x89b5('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 2d53f0c..770667b 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 _0xd0f9=['lead','contact','contact_lead','sequelize','exports','STRING','ENUM'];(function(_0x19dd7a,_0x51de21){var _0x3feb6a=function(_0x4a3c84){while(--_0x4a3c84){_0x19dd7a['push'](_0x19dd7a['shift']());}};_0x3feb6a(++_0x51de21);}(_0xd0f9,0xdc));var _0x9d0f=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0xd0f9[_0x40220a];return _0x3903cc;};'use strict';var Sequelize=require(_0x9d0f('0x0'));module[_0x9d0f('0x1')]={'name':{'type':Sequelize[_0x9d0f('0x2')]},'moduleCreate':{'type':Sequelize[_0x9d0f('0x3')](_0x9d0f('0x4'),_0x9d0f('0x5'),'nothing'),'defaultValue':_0x9d0f('0x4')},'moduleSearch':{'type':Sequelize['ENUM'](_0x9d0f('0x6'),_0x9d0f('0x5'),'lead'),'defaultValue':_0x9d0f('0x6')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x534b=['lead','contact_lead','sequelize','exports','STRING','ENUM','contact','nothing'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x534b,0x1da));var _0xb534=function(_0x4fe211,_0x326da3){_0x4fe211=_0x4fe211-0x0;var _0x592094=_0x534b[_0x4fe211];return _0x592094;};'use strict';var Sequelize=require(_0xb534('0x0'));module[_0xb534('0x1')]={'name':{'type':Sequelize[_0xb534('0x2')]},'moduleCreate':{'type':Sequelize[_0xb534('0x3')]('lead',_0xb534('0x4'),_0xb534('0x5')),'defaultValue':_0xb534('0x6')},'moduleSearch':{'type':Sequelize['ENUM'](_0xb534('0x7'),_0xb534('0x4'),'lead'),'defaultValue':'contact_lead'},'description':{'type':Sequelize[_0xb534('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 0152304..e936c87 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 _0x0712=['findAll','rows','params','rawAttributes','includeAll','find','catch','create','body','getFields','findOne','ZohoField','getSubjects','options','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','limit','undefined','count','set','Content-Range','json','apply','reject','update','then','destroy','error','stack','name','send','index','map','ZohoConfiguration','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','include'];(function(_0x361e5d,_0x15e1a4){var _0x4c303d=function(_0x504f9f){while(--_0x504f9f){_0x361e5d['push'](_0x361e5d['shift']());}};_0x4c303d(++_0x15e1a4);}(_0x0712,0x1a4));var _0x2071=function(_0xb0f60a,_0x268ec2){_0xb0f60a=_0xb0f60a-0x0;var _0x3c73a6=_0x0712[_0xb0f60a];return _0x3c73a6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2071('0x0'));var zipdir=require(_0x2071('0x1'));var jsonpatch=require(_0x2071('0x2'));var rp=require(_0x2071('0x3'));var moment=require(_0x2071('0x4'));var BPromise=require(_0x2071('0x5'));var Mustache=require(_0x2071('0x6'));var util=require('util');var path=require(_0x2071('0x7'));var sox=require('sox');var csv=require(_0x2071('0x8'));var ejs=require(_0x2071('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2071('0xa'));var squel=require(_0x2071('0xb'));var crypto=require(_0x2071('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2071('0x8'));var querystring=require(_0x2071('0xd'));var Papa=require(_0x2071('0xe'));var Redis=require(_0x2071('0xf'));var authService=require(_0x2071('0x10'));var qs=require(_0x2071('0x11'));var as=require(_0x2071('0x12'));var hardwareService=require(_0x2071('0x13'));var logger=require(_0x2071('0x14'))(_0x2071('0x15'));var utils=require('../../config/utils');var config=require(_0x2071('0x16'));var licenseUtil=require(_0x2071('0x17'));var db=require(_0x2071('0x18'))['db'];function respondWithStatusCode(_0x3131a9,_0x1058ba){_0x1058ba=_0x1058ba||0xcc;return function(_0x52a4e2){if(_0x52a4e2){return _0x3131a9[_0x2071('0x19')](_0x1058ba);}return _0x3131a9['status'](_0x1058ba)[_0x2071('0x1a')]();};}function respondWithResult(_0x18929d,_0x2a4b20){_0x2a4b20=_0x2a4b20||0xc8;return function(_0x281471){if(_0x281471){return _0x18929d[_0x2071('0x1b')](_0x2a4b20)['json'](_0x281471);}};}function respondWithFilteredResult(_0x50c29b,_0x7a7701){return function(_0x52fb4e){if(_0x52fb4e){var _0x57f710=typeof _0x7a7701[_0x2071('0x1c')]==='undefined'&&typeof _0x7a7701[_0x2071('0x1d')]===_0x2071('0x1e');var _0x5dc842=_0x52fb4e['count'];var _0x40085a=_0x57f710?0x0:_0x7a7701[_0x2071('0x1c')];var _0x8b26a4=_0x57f710?_0x52fb4e[_0x2071('0x1f')]:_0x7a7701['offset']+_0x7a7701[_0x2071('0x1d')];var _0x2bb1a0;if(_0x8b26a4>=_0x5dc842){_0x8b26a4=_0x5dc842;_0x2bb1a0=0xc8;}else{_0x2bb1a0=0xce;}_0x50c29b[_0x2071('0x1b')](_0x2bb1a0);return _0x50c29b[_0x2071('0x20')](_0x2071('0x21'),_0x40085a+'-'+_0x8b26a4+'/'+_0x5dc842)[_0x2071('0x22')](_0x52fb4e);}return null;};}function patchUpdates(_0xed585f){return function(_0x34b6d6){try{jsonpatch[_0x2071('0x23')](_0x34b6d6,_0xed585f,!![]);}catch(_0x4e2d79){return BPromise[_0x2071('0x24')](_0x4e2d79);}return _0x34b6d6['save']();};}function saveUpdates(_0x42cc1c,_0x4657bd){return function(_0x26e56d){if(_0x26e56d){return _0x26e56d[_0x2071('0x25')](_0x42cc1c)[_0x2071('0x26')](function(_0x14fef1){return _0x14fef1;});}return null;};}function removeEntity(_0x1309ef,_0x5a6321){return function(_0x5914f0){if(_0x5914f0){return _0x5914f0[_0x2071('0x27')]()[_0x2071('0x26')](function(){_0x1309ef[_0x2071('0x1b')](0xcc)[_0x2071('0x1a')]();});}};}function handleEntityNotFound(_0xd273d8,_0x49df2b){return function(_0x56604e){if(!_0x56604e){_0xd273d8[_0x2071('0x19')](0x194);}return _0x56604e;};}function handleError(_0x44e2e8,_0x4f96fe){_0x4f96fe=_0x4f96fe||0x1f4;return function(_0x507fb4){logger[_0x2071('0x28')](_0x507fb4[_0x2071('0x29')]);if(_0x507fb4[_0x2071('0x2a')]){delete _0x507fb4['name'];}_0x44e2e8['status'](_0x4f96fe)[_0x2071('0x2b')](_0x507fb4);};}exports[_0x2071('0x2c')]=function(_0x15c3f9,_0x4dba7d){var _0x21284d={},_0x51ea7b={},_0xe9331e={'count':0x0,'rows':[]};var _0x308f24=_[_0x2071('0x2d')](db[_0x2071('0x2e')]['rawAttributes'],function(_0x323ef9){return{'name':_0x323ef9[_0x2071('0x2f')],'type':_0x323ef9[_0x2071('0x30')]['key']};});_0x51ea7b[_0x2071('0x31')]=_[_0x2071('0x2d')](_0x308f24,'name');_0x51ea7b[_0x2071('0x32')]=_[_0x2071('0x33')](_0x15c3f9[_0x2071('0x32')]);_0x51ea7b[_0x2071('0x34')]=_['intersection'](_0x51ea7b[_0x2071('0x31')],_0x51ea7b[_0x2071('0x32')]);_0x21284d[_0x2071('0x35')]=_[_0x2071('0x36')](_0x51ea7b[_0x2071('0x31')],qs[_0x2071('0x37')](_0x15c3f9['query'][_0x2071('0x37')]));_0x21284d[_0x2071('0x35')]=_0x21284d[_0x2071('0x35')][_0x2071('0x38')]?_0x21284d[_0x2071('0x35')]:_0x51ea7b[_0x2071('0x31')];if(!_0x15c3f9[_0x2071('0x32')][_0x2071('0x39')](_0x2071('0x3a'))){_0x21284d[_0x2071('0x1d')]=qs[_0x2071('0x1d')](_0x15c3f9['query'][_0x2071('0x1d')]);_0x21284d['offset']=qs[_0x2071('0x1c')](_0x15c3f9['query'][_0x2071('0x1c')]);}_0x21284d[_0x2071('0x3b')]=qs[_0x2071('0x3c')](_0x15c3f9['query'][_0x2071('0x3c')]);_0x21284d[_0x2071('0x3d')]=qs[_0x2071('0x34')](_[_0x2071('0x3e')](_0x15c3f9[_0x2071('0x32')],_0x51ea7b[_0x2071('0x34')]),_0x308f24);if(_0x15c3f9['query'][_0x2071('0x3f')]){_0x21284d[_0x2071('0x3d')]=_[_0x2071('0x40')](_0x21284d[_0x2071('0x3d')],{'$or':_[_0x2071('0x2d')](_0x308f24,function(_0x10b583){if(_0x10b583[_0x2071('0x30')]!=='VIRTUAL'){var _0x414745={};_0x414745[_0x10b583[_0x2071('0x2a')]]={'$like':'%'+_0x15c3f9[_0x2071('0x32')][_0x2071('0x3f')]+'%'};return _0x414745;}})});}_0x21284d=_[_0x2071('0x40')]({},_0x21284d,_0x15c3f9['options']);var _0x3ae734={'where':_0x21284d[_0x2071('0x3d')]};return db[_0x2071('0x2e')][_0x2071('0x1f')](_0x3ae734)[_0x2071('0x26')](function(_0x51d1a0){_0xe9331e['count']=_0x51d1a0;if(_0x15c3f9[_0x2071('0x32')]['includeAll']){_0x21284d[_0x2071('0x41')]=[{'all':!![]}];}return db[_0x2071('0x2e')][_0x2071('0x42')](_0x21284d);})['then'](function(_0xa6b256){_0xe9331e[_0x2071('0x43')]=_0xa6b256;return _0xe9331e;})[_0x2071('0x26')](respondWithFilteredResult(_0x4dba7d,_0x21284d))['catch'](handleError(_0x4dba7d,null));};exports['show']=function(_0x14d1e9,_0x3003b0){var _0x3e1e2b={'raw':![],'where':{'id':_0x14d1e9[_0x2071('0x44')]['id']}},_0x122dae={};_0x122dae[_0x2071('0x31')]=_['keys'](db[_0x2071('0x2e')][_0x2071('0x45')]);_0x122dae[_0x2071('0x32')]=_[_0x2071('0x33')](_0x14d1e9[_0x2071('0x32')]);_0x122dae['filters']=_[_0x2071('0x36')](_0x122dae['model'],_0x122dae['query']);_0x3e1e2b[_0x2071('0x35')]=_[_0x2071('0x36')](_0x122dae[_0x2071('0x31')],qs[_0x2071('0x37')](_0x14d1e9[_0x2071('0x32')][_0x2071('0x37')]));_0x3e1e2b[_0x2071('0x35')]=_0x3e1e2b[_0x2071('0x35')][_0x2071('0x38')]?_0x3e1e2b[_0x2071('0x35')]:_0x122dae['model'];if(_0x14d1e9['query'][_0x2071('0x46')]){_0x3e1e2b[_0x2071('0x41')]=[{'all':!![]}];}_0x3e1e2b=_['merge']({},_0x3e1e2b,_0x14d1e9['options']);return db[_0x2071('0x2e')][_0x2071('0x47')](_0x3e1e2b)[_0x2071('0x26')](handleEntityNotFound(_0x3003b0,null))[_0x2071('0x26')](respondWithResult(_0x3003b0,null))[_0x2071('0x48')](handleError(_0x3003b0,null));};exports['create']=function(_0x4a26e9,_0x4bd546){return db[_0x2071('0x2e')][_0x2071('0x49')](_0x4a26e9['body'],{})[_0x2071('0x26')](respondWithResult(_0x4bd546,0xc9))[_0x2071('0x48')](handleError(_0x4bd546,null));};exports['update']=function(_0x2ab3e9,_0x5ddc38){if(_0x2ab3e9[_0x2071('0x4a')]['id']){delete _0x2ab3e9['body']['id'];}return db['ZohoConfiguration']['find']({'where':{'id':_0x2ab3e9[_0x2071('0x44')]['id']}})[_0x2071('0x26')](handleEntityNotFound(_0x5ddc38,null))['then'](saveUpdates(_0x2ab3e9['body'],null))[_0x2071('0x26')](respondWithResult(_0x5ddc38,null))[_0x2071('0x48')](handleError(_0x5ddc38,null));};exports[_0x2071('0x27')]=function(_0x3c9fca,_0x47f139){return db[_0x2071('0x2e')]['find']({'where':{'id':_0x3c9fca[_0x2071('0x44')]['id']}})['then'](handleEntityNotFound(_0x47f139,null))['then'](removeEntity(_0x47f139,null))[_0x2071('0x48')](handleError(_0x47f139,null));};exports[_0x2071('0x4b')]=function(_0x39b105,_0x4e95da,_0x200ea4){var _0x3ed651={};var _0x4ffc3a={};var _0x2e2e5d;var _0x531a24;return db[_0x2071('0x2e')][_0x2071('0x4c')]({'where':{'id':_0x39b105['params']['id']}})[_0x2071('0x26')](handleEntityNotFound(_0x4e95da,null))[_0x2071('0x26')](function(_0x4a9b57){if(_0x4a9b57){_0x2e2e5d=_0x4a9b57;_0x4ffc3a[_0x2071('0x31')]=_[_0x2071('0x33')](db[_0x2071('0x4d')][_0x2071('0x45')]);_0x4ffc3a['query']=_[_0x2071('0x33')](_0x39b105[_0x2071('0x32')]);_0x4ffc3a['filters']=_['intersection'](_0x4ffc3a[_0x2071('0x31')],_0x4ffc3a[_0x2071('0x32')]);_0x3ed651['attributes']=_[_0x2071('0x36')](_0x4ffc3a[_0x2071('0x31')],qs[_0x2071('0x37')](_0x39b105[_0x2071('0x32')][_0x2071('0x37')]));_0x3ed651[_0x2071('0x35')]=_0x3ed651[_0x2071('0x35')][_0x2071('0x38')]?_0x3ed651[_0x2071('0x35')]:_0x4ffc3a['model'];_0x3ed651[_0x2071('0x3b')]=qs[_0x2071('0x3c')](_0x39b105['query'][_0x2071('0x3c')]);_0x3ed651['where']=qs[_0x2071('0x34')](_[_0x2071('0x3e')](_0x39b105['query'],_0x4ffc3a[_0x2071('0x34')]));if(_0x39b105[_0x2071('0x32')][_0x2071('0x3f')]){_0x3ed651[_0x2071('0x3d')]=_[_0x2071('0x40')](_0x3ed651[_0x2071('0x3d')],{'$or':_[_0x2071('0x2d')](_0x3ed651[_0x2071('0x35')],function(_0x154caf){var _0x3a42d0={};_0x3a42d0[_0x154caf]={'$like':'%'+_0x39b105['query']['filter']+'%'};return _0x3a42d0;})});}_0x3ed651=_[_0x2071('0x40')]({},_0x3ed651,_0x39b105['options']);return _0x2e2e5d[_0x2071('0x4b')](_0x3ed651);}})['then'](function(_0x57ff23){if(_0x57ff23){_0x531a24=_0x57ff23[_0x2071('0x38')];if(!_0x39b105['query'][_0x2071('0x39')](_0x2071('0x3a'))){_0x3ed651[_0x2071('0x1d')]=qs[_0x2071('0x1d')](_0x39b105['query'][_0x2071('0x1d')]);_0x3ed651[_0x2071('0x1c')]=qs['offset'](_0x39b105[_0x2071('0x32')][_0x2071('0x1c')]);}return _0x2e2e5d['getFields'](_0x3ed651);}})[_0x2071('0x26')](function(_0x26f941){if(_0x26f941){return _0x26f941?{'count':_0x531a24,'rows':_0x26f941}:null;}})[_0x2071('0x26')](respondWithResult(_0x4e95da,null))['catch'](handleError(_0x4e95da,null));};exports[_0x2071('0x4e')]=function(_0x5b5985,_0x276cb9,_0x2cb071){var _0x5301ac={};var _0x2b30e9={};var _0x538556;var _0x1b866e;return db[_0x2071('0x2e')][_0x2071('0x4c')]({'where':{'id':_0x5b5985[_0x2071('0x44')]['id']}})['then'](handleEntityNotFound(_0x276cb9,null))[_0x2071('0x26')](function(_0x3a7405){if(_0x3a7405){_0x538556=_0x3a7405;_0x2b30e9[_0x2071('0x31')]=_[_0x2071('0x33')](db[_0x2071('0x4d')]['rawAttributes']);_0x2b30e9[_0x2071('0x32')]=_['keys'](_0x5b5985['query']);_0x2b30e9[_0x2071('0x34')]=_['intersection'](_0x2b30e9[_0x2071('0x31')],_0x2b30e9[_0x2071('0x32')]);_0x5301ac['attributes']=_[_0x2071('0x36')](_0x2b30e9[_0x2071('0x31')],qs[_0x2071('0x37')](_0x5b5985[_0x2071('0x32')]['fields']));_0x5301ac[_0x2071('0x35')]=_0x5301ac[_0x2071('0x35')][_0x2071('0x38')]?_0x5301ac['attributes']:_0x2b30e9[_0x2071('0x31')];_0x5301ac[_0x2071('0x3b')]=qs[_0x2071('0x3c')](_0x5b5985[_0x2071('0x32')][_0x2071('0x3c')]);_0x5301ac[_0x2071('0x3d')]=qs[_0x2071('0x34')](_['pick'](_0x5b5985[_0x2071('0x32')],_0x2b30e9[_0x2071('0x34')]));if(_0x5b5985[_0x2071('0x32')][_0x2071('0x3f')]){_0x5301ac['where']=_[_0x2071('0x40')](_0x5301ac[_0x2071('0x3d')],{'$or':_[_0x2071('0x2d')](_0x5301ac['attributes'],function(_0x4538eb){var _0x1a5cf0={};_0x1a5cf0[_0x4538eb]={'$like':'%'+_0x5b5985[_0x2071('0x32')][_0x2071('0x3f')]+'%'};return _0x1a5cf0;})});}_0x5301ac=_[_0x2071('0x40')]({},_0x5301ac,_0x5b5985[_0x2071('0x4f')]);return _0x538556[_0x2071('0x4e')](_0x5301ac);}})[_0x2071('0x26')](function(_0x279b33){if(_0x279b33){_0x1b866e=_0x279b33[_0x2071('0x38')];if(!_0x5b5985['query'][_0x2071('0x39')]('nolimit')){_0x5301ac[_0x2071('0x1d')]=qs[_0x2071('0x1d')](_0x5b5985[_0x2071('0x32')][_0x2071('0x1d')]);_0x5301ac['offset']=qs[_0x2071('0x1c')](_0x5b5985[_0x2071('0x32')]['offset']);}return _0x538556[_0x2071('0x4e')](_0x5301ac);}})[_0x2071('0x26')](function(_0x2f510d){if(_0x2f510d){return _0x2f510d?{'count':_0x1b866e,'rows':_0x2f510d}:null;}})[_0x2071('0x26')](respondWithResult(_0x276cb9,null))[_0x2071('0x48')](handleError(_0x276cb9,null));};exports[_0x2071('0x50')]=function(_0x12c15b,_0x3307f4,_0x3f5c88){var _0x4f83a9={};var _0x12eb54={};var _0x5939e0;var _0x367af9;return db[_0x2071('0x2e')][_0x2071('0x4c')]({'where':{'id':_0x12c15b[_0x2071('0x44')]['id']}})['then'](handleEntityNotFound(_0x3307f4,null))[_0x2071('0x26')](function(_0x59f3fe){if(_0x59f3fe){_0x5939e0=_0x59f3fe;_0x12eb54[_0x2071('0x31')]=_[_0x2071('0x33')](db[_0x2071('0x4d')][_0x2071('0x45')]);_0x12eb54[_0x2071('0x32')]=_[_0x2071('0x33')](_0x12c15b[_0x2071('0x32')]);_0x12eb54[_0x2071('0x34')]=_[_0x2071('0x36')](_0x12eb54[_0x2071('0x31')],_0x12eb54['query']);_0x4f83a9[_0x2071('0x35')]=_[_0x2071('0x36')](_0x12eb54['model'],qs['fields'](_0x12c15b[_0x2071('0x32')][_0x2071('0x37')]));_0x4f83a9[_0x2071('0x35')]=_0x4f83a9[_0x2071('0x35')][_0x2071('0x38')]?_0x4f83a9['attributes']:_0x12eb54[_0x2071('0x31')];_0x4f83a9[_0x2071('0x3b')]=qs[_0x2071('0x3c')](_0x12c15b[_0x2071('0x32')][_0x2071('0x3c')]);_0x4f83a9[_0x2071('0x3d')]=qs['filters'](_[_0x2071('0x3e')](_0x12c15b['query'],_0x12eb54['filters']));if(_0x12c15b['query'][_0x2071('0x3f')]){_0x4f83a9[_0x2071('0x3d')]=_[_0x2071('0x40')](_0x4f83a9[_0x2071('0x3d')],{'$or':_[_0x2071('0x2d')](_0x4f83a9[_0x2071('0x35')],function(_0x571e43){var _0x15ba09={};_0x15ba09[_0x571e43]={'$like':'%'+_0x12c15b[_0x2071('0x32')][_0x2071('0x3f')]+'%'};return _0x15ba09;})});}_0x4f83a9=_[_0x2071('0x40')]({},_0x4f83a9,_0x12c15b[_0x2071('0x4f')]);return _0x5939e0[_0x2071('0x50')](_0x4f83a9);}})[_0x2071('0x26')](function(_0x4e1c76){if(_0x4e1c76){_0x367af9=_0x4e1c76[_0x2071('0x38')];if(!_0x12c15b[_0x2071('0x32')][_0x2071('0x39')](_0x2071('0x3a'))){_0x4f83a9['limit']=qs[_0x2071('0x1d')](_0x12c15b[_0x2071('0x32')][_0x2071('0x1d')]);_0x4f83a9[_0x2071('0x1c')]=qs[_0x2071('0x1c')](_0x12c15b['query']['offset']);}return _0x5939e0['getDescriptions'](_0x4f83a9);}})[_0x2071('0x26')](function(_0x321515){if(_0x321515){return _0x321515?{'count':_0x367af9,'rows':_0x321515}:null;}})['then'](respondWithResult(_0x3307f4,null))[_0x2071('0x48')](handleError(_0x3307f4,null));}; \ No newline at end of file +var _0x9eb8=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','include','body','update','getFields','findOne','getSubjects','ZohoField','pick','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','then','destroy','stack','name','send','index','map','ZohoConfiguration','rawAttributes','fieldName','type','key','model','query','filters','intersection'];(function(_0x4d4c8b,_0x32ade1){var _0x5d202f=function(_0x4e9b9a){while(--_0x4e9b9a){_0x4d4c8b['push'](_0x4d4c8b['shift']());}};_0x5d202f(++_0x32ade1);}(_0x9eb8,0x158));var _0x89eb=function(_0xe58fe,_0x20c95d){_0xe58fe=_0xe58fe-0x0;var _0x3efe2e=_0x9eb8[_0xe58fe];return _0x3efe2e;};'use strict';var emlformat=require(_0x89eb('0x0'));var rimraf=require(_0x89eb('0x1'));var zipdir=require(_0x89eb('0x2'));var jsonpatch=require(_0x89eb('0x3'));var rp=require(_0x89eb('0x4'));var moment=require(_0x89eb('0x5'));var BPromise=require(_0x89eb('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x89eb('0x7'));var sox=require(_0x89eb('0x8'));var csv=require('to-csv');var ejs=require(_0x89eb('0x9'));var fs=require('fs');var fs_extra=require(_0x89eb('0xa'));var _=require(_0x89eb('0xb'));var squel=require('squel');var crypto=require(_0x89eb('0xc'));var jsforce=require(_0x89eb('0xd'));var deskjs=require(_0x89eb('0xe'));var toCsv=require('to-csv');var querystring=require(_0x89eb('0xf'));var Papa=require('papaparse');var Redis=require(_0x89eb('0x10'));var authService=require(_0x89eb('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x89eb('0x12'));var hardwareService=require(_0x89eb('0x13'));var logger=require(_0x89eb('0x14'))(_0x89eb('0x15'));var utils=require('../../config/utils');var config=require(_0x89eb('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x89eb('0x17'))['db'];function respondWithStatusCode(_0x13b2fe,_0xde6aa){_0xde6aa=_0xde6aa||0xcc;return function(_0x4c6568){if(_0x4c6568){return _0x13b2fe[_0x89eb('0x18')](_0xde6aa);}return _0x13b2fe[_0x89eb('0x19')](_0xde6aa)[_0x89eb('0x1a')]();};}function respondWithResult(_0x1ad0c1,_0x141b8d){_0x141b8d=_0x141b8d||0xc8;return function(_0xcbd2d2){if(_0xcbd2d2){return _0x1ad0c1['status'](_0x141b8d)[_0x89eb('0x1b')](_0xcbd2d2);}};}function respondWithFilteredResult(_0x891a14,_0x71b87e){return function(_0x53a2a6){if(_0x53a2a6){var _0x59aaeb=typeof _0x71b87e[_0x89eb('0x1c')]===_0x89eb('0x1d')&&typeof _0x71b87e[_0x89eb('0x1e')]===_0x89eb('0x1d');var _0x3a1873=_0x53a2a6[_0x89eb('0x1f')];var _0x353f94=_0x59aaeb?0x0:_0x71b87e[_0x89eb('0x1c')];var _0x4468f2=_0x59aaeb?_0x53a2a6['count']:_0x71b87e[_0x89eb('0x1c')]+_0x71b87e[_0x89eb('0x1e')];var _0x9e1541;if(_0x4468f2>=_0x3a1873){_0x4468f2=_0x3a1873;_0x9e1541=0xc8;}else{_0x9e1541=0xce;}_0x891a14['status'](_0x9e1541);return _0x891a14['set'](_0x89eb('0x20'),_0x353f94+'-'+_0x4468f2+'/'+_0x3a1873)[_0x89eb('0x1b')](_0x53a2a6);}return null;};}function patchUpdates(_0x1c3656){return function(_0x228fa7){try{jsonpatch['apply'](_0x228fa7,_0x1c3656,!![]);}catch(_0x3d39aa){return BPromise[_0x89eb('0x21')](_0x3d39aa);}return _0x228fa7[_0x89eb('0x22')]();};}function saveUpdates(_0x2a9e6e,_0x141277){return function(_0x2e7a9d){if(_0x2e7a9d){return _0x2e7a9d['update'](_0x2a9e6e)[_0x89eb('0x23')](function(_0x26d645){return _0x26d645;});}return null;};}function removeEntity(_0x38432e,_0x51b7f5){return function(_0x4b03c5){if(_0x4b03c5){return _0x4b03c5[_0x89eb('0x24')]()[_0x89eb('0x23')](function(){_0x38432e[_0x89eb('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xde75bf,_0x30d82e){return function(_0x2eeae7){if(!_0x2eeae7){_0xde75bf[_0x89eb('0x18')](0x194);}return _0x2eeae7;};}function handleError(_0xfb4572,_0x234cb3){_0x234cb3=_0x234cb3||0x1f4;return function(_0x587515){logger['error'](_0x587515[_0x89eb('0x25')]);if(_0x587515[_0x89eb('0x26')]){delete _0x587515[_0x89eb('0x26')];}_0xfb4572[_0x89eb('0x19')](_0x234cb3)[_0x89eb('0x27')](_0x587515);};}exports[_0x89eb('0x28')]=function(_0x2c9ddb,_0x19fe6a){var _0x2a9a41={},_0x132bbe={},_0x3fc209={'count':0x0,'rows':[]};var _0x59513b=_[_0x89eb('0x29')](db[_0x89eb('0x2a')][_0x89eb('0x2b')],function(_0x36f921){return{'name':_0x36f921[_0x89eb('0x2c')],'type':_0x36f921[_0x89eb('0x2d')][_0x89eb('0x2e')]};});_0x132bbe[_0x89eb('0x2f')]=_[_0x89eb('0x29')](_0x59513b,_0x89eb('0x26'));_0x132bbe[_0x89eb('0x30')]=_['keys'](_0x2c9ddb[_0x89eb('0x30')]);_0x132bbe[_0x89eb('0x31')]=_[_0x89eb('0x32')](_0x132bbe[_0x89eb('0x2f')],_0x132bbe[_0x89eb('0x30')]);_0x2a9a41[_0x89eb('0x33')]=_[_0x89eb('0x32')](_0x132bbe[_0x89eb('0x2f')],qs['fields'](_0x2c9ddb['query'][_0x89eb('0x34')]));_0x2a9a41[_0x89eb('0x33')]=_0x2a9a41[_0x89eb('0x33')][_0x89eb('0x35')]?_0x2a9a41[_0x89eb('0x33')]:_0x132bbe['model'];if(!_0x2c9ddb[_0x89eb('0x30')][_0x89eb('0x36')](_0x89eb('0x37'))){_0x2a9a41[_0x89eb('0x1e')]=qs[_0x89eb('0x1e')](_0x2c9ddb[_0x89eb('0x30')]['limit']);_0x2a9a41[_0x89eb('0x1c')]=qs[_0x89eb('0x1c')](_0x2c9ddb[_0x89eb('0x30')][_0x89eb('0x1c')]);}_0x2a9a41[_0x89eb('0x38')]=qs[_0x89eb('0x39')](_0x2c9ddb[_0x89eb('0x30')][_0x89eb('0x39')]);_0x2a9a41[_0x89eb('0x3a')]=qs['filters'](_['pick'](_0x2c9ddb[_0x89eb('0x30')],_0x132bbe[_0x89eb('0x31')]),_0x59513b);if(_0x2c9ddb[_0x89eb('0x30')][_0x89eb('0x3b')]){_0x2a9a41[_0x89eb('0x3a')]=_[_0x89eb('0x3c')](_0x2a9a41[_0x89eb('0x3a')],{'$or':_['map'](_0x59513b,function(_0x56d65d){if(_0x56d65d[_0x89eb('0x2d')]!==_0x89eb('0x3d')){var _0x2631b7={};_0x2631b7[_0x56d65d[_0x89eb('0x26')]]={'$like':'%'+_0x2c9ddb[_0x89eb('0x30')][_0x89eb('0x3b')]+'%'};return _0x2631b7;}})});}_0x2a9a41=_['merge']({},_0x2a9a41,_0x2c9ddb[_0x89eb('0x3e')]);var _0x37c7a4={'where':_0x2a9a41[_0x89eb('0x3a')]};return db[_0x89eb('0x2a')][_0x89eb('0x1f')](_0x37c7a4)[_0x89eb('0x23')](function(_0x1983f9){_0x3fc209[_0x89eb('0x1f')]=_0x1983f9;if(_0x2c9ddb[_0x89eb('0x30')][_0x89eb('0x3f')]){_0x2a9a41['include']=[{'all':!![]}];}return db[_0x89eb('0x2a')][_0x89eb('0x40')](_0x2a9a41);})[_0x89eb('0x23')](function(_0xca0195){_0x3fc209[_0x89eb('0x41')]=_0xca0195;return _0x3fc209;})[_0x89eb('0x23')](respondWithFilteredResult(_0x19fe6a,_0x2a9a41))[_0x89eb('0x42')](handleError(_0x19fe6a,null));};exports[_0x89eb('0x43')]=function(_0x59da30,_0x11fa36){var _0x324e3a={'raw':![],'where':{'id':_0x59da30[_0x89eb('0x44')]['id']}},_0x44a977={};_0x44a977[_0x89eb('0x2f')]=_[_0x89eb('0x45')](db[_0x89eb('0x2a')]['rawAttributes']);_0x44a977[_0x89eb('0x30')]=_[_0x89eb('0x45')](_0x59da30[_0x89eb('0x30')]);_0x44a977['filters']=_['intersection'](_0x44a977[_0x89eb('0x2f')],_0x44a977[_0x89eb('0x30')]);_0x324e3a[_0x89eb('0x33')]=_['intersection'](_0x44a977[_0x89eb('0x2f')],qs[_0x89eb('0x34')](_0x59da30[_0x89eb('0x30')][_0x89eb('0x34')]));_0x324e3a[_0x89eb('0x33')]=_0x324e3a[_0x89eb('0x33')]['length']?_0x324e3a[_0x89eb('0x33')]:_0x44a977[_0x89eb('0x2f')];if(_0x59da30[_0x89eb('0x30')][_0x89eb('0x3f')]){_0x324e3a[_0x89eb('0x46')]=[{'all':!![]}];}_0x324e3a=_[_0x89eb('0x3c')]({},_0x324e3a,_0x59da30['options']);return db['ZohoConfiguration']['find'](_0x324e3a)['then'](handleEntityNotFound(_0x11fa36,null))[_0x89eb('0x23')](respondWithResult(_0x11fa36,null))[_0x89eb('0x42')](handleError(_0x11fa36,null));};exports['create']=function(_0x5b7565,_0xeeb69e){return db[_0x89eb('0x2a')]['create'](_0x5b7565[_0x89eb('0x47')],{})[_0x89eb('0x23')](respondWithResult(_0xeeb69e,0xc9))[_0x89eb('0x42')](handleError(_0xeeb69e,null));};exports[_0x89eb('0x48')]=function(_0x5f5bca,_0x528248){if(_0x5f5bca[_0x89eb('0x47')]['id']){delete _0x5f5bca['body']['id'];}return db[_0x89eb('0x2a')]['find']({'where':{'id':_0x5f5bca['params']['id']}})[_0x89eb('0x23')](handleEntityNotFound(_0x528248,null))[_0x89eb('0x23')](saveUpdates(_0x5f5bca[_0x89eb('0x47')],null))[_0x89eb('0x23')](respondWithResult(_0x528248,null))['catch'](handleError(_0x528248,null));};exports[_0x89eb('0x24')]=function(_0x159d00,_0x228c76){return db['ZohoConfiguration']['find']({'where':{'id':_0x159d00[_0x89eb('0x44')]['id']}})[_0x89eb('0x23')](handleEntityNotFound(_0x228c76,null))[_0x89eb('0x23')](removeEntity(_0x228c76,null))['catch'](handleError(_0x228c76,null));};exports[_0x89eb('0x49')]=function(_0x23fef0,_0x13f522,_0x29b664){var _0x26bac5={};var _0x5e8008={};var _0x2a9fa6;var _0x398358;return db['ZohoConfiguration'][_0x89eb('0x4a')]({'where':{'id':_0x23fef0[_0x89eb('0x44')]['id']}})['then'](handleEntityNotFound(_0x13f522,null))[_0x89eb('0x23')](function(_0x4e50a8){if(_0x4e50a8){_0x2a9fa6=_0x4e50a8;_0x5e8008[_0x89eb('0x2f')]=_['keys'](db['ZohoField'][_0x89eb('0x2b')]);_0x5e8008['query']=_[_0x89eb('0x45')](_0x23fef0[_0x89eb('0x30')]);_0x5e8008['filters']=_[_0x89eb('0x32')](_0x5e8008['model'],_0x5e8008[_0x89eb('0x30')]);_0x26bac5['attributes']=_[_0x89eb('0x32')](_0x5e8008[_0x89eb('0x2f')],qs[_0x89eb('0x34')](_0x23fef0[_0x89eb('0x30')][_0x89eb('0x34')]));_0x26bac5[_0x89eb('0x33')]=_0x26bac5[_0x89eb('0x33')][_0x89eb('0x35')]?_0x26bac5[_0x89eb('0x33')]:_0x5e8008[_0x89eb('0x2f')];_0x26bac5['order']=qs[_0x89eb('0x39')](_0x23fef0[_0x89eb('0x30')][_0x89eb('0x39')]);_0x26bac5[_0x89eb('0x3a')]=qs[_0x89eb('0x31')](_['pick'](_0x23fef0[_0x89eb('0x30')],_0x5e8008[_0x89eb('0x31')]));if(_0x23fef0[_0x89eb('0x30')][_0x89eb('0x3b')]){_0x26bac5['where']=_[_0x89eb('0x3c')](_0x26bac5[_0x89eb('0x3a')],{'$or':_[_0x89eb('0x29')](_0x26bac5[_0x89eb('0x33')],function(_0x8032f9){var _0x25304d={};_0x25304d[_0x8032f9]={'$like':'%'+_0x23fef0[_0x89eb('0x30')][_0x89eb('0x3b')]+'%'};return _0x25304d;})});}_0x26bac5=_[_0x89eb('0x3c')]({},_0x26bac5,_0x23fef0['options']);return _0x2a9fa6[_0x89eb('0x49')](_0x26bac5);}})[_0x89eb('0x23')](function(_0x35ec5c){if(_0x35ec5c){_0x398358=_0x35ec5c[_0x89eb('0x35')];if(!_0x23fef0[_0x89eb('0x30')][_0x89eb('0x36')](_0x89eb('0x37'))){_0x26bac5[_0x89eb('0x1e')]=qs['limit'](_0x23fef0[_0x89eb('0x30')]['limit']);_0x26bac5[_0x89eb('0x1c')]=qs[_0x89eb('0x1c')](_0x23fef0[_0x89eb('0x30')]['offset']);}return _0x2a9fa6[_0x89eb('0x49')](_0x26bac5);}})[_0x89eb('0x23')](function(_0x29a177){if(_0x29a177){return _0x29a177?{'count':_0x398358,'rows':_0x29a177}:null;}})[_0x89eb('0x23')](respondWithResult(_0x13f522,null))['catch'](handleError(_0x13f522,null));};exports[_0x89eb('0x4b')]=function(_0xc7521b,_0x5dcdbc,_0x39025a){var _0x458eee={};var _0x194f4d={};var _0x2a671d;var _0x2079a1;return db[_0x89eb('0x2a')][_0x89eb('0x4a')]({'where':{'id':_0xc7521b[_0x89eb('0x44')]['id']}})[_0x89eb('0x23')](handleEntityNotFound(_0x5dcdbc,null))[_0x89eb('0x23')](function(_0x30d38c){if(_0x30d38c){_0x2a671d=_0x30d38c;_0x194f4d[_0x89eb('0x2f')]=_[_0x89eb('0x45')](db[_0x89eb('0x4c')][_0x89eb('0x2b')]);_0x194f4d[_0x89eb('0x30')]=_[_0x89eb('0x45')](_0xc7521b[_0x89eb('0x30')]);_0x194f4d['filters']=_[_0x89eb('0x32')](_0x194f4d[_0x89eb('0x2f')],_0x194f4d[_0x89eb('0x30')]);_0x458eee['attributes']=_['intersection'](_0x194f4d[_0x89eb('0x2f')],qs[_0x89eb('0x34')](_0xc7521b[_0x89eb('0x30')][_0x89eb('0x34')]));_0x458eee[_0x89eb('0x33')]=_0x458eee[_0x89eb('0x33')][_0x89eb('0x35')]?_0x458eee[_0x89eb('0x33')]:_0x194f4d[_0x89eb('0x2f')];_0x458eee[_0x89eb('0x38')]=qs[_0x89eb('0x39')](_0xc7521b[_0x89eb('0x30')][_0x89eb('0x39')]);_0x458eee[_0x89eb('0x3a')]=qs[_0x89eb('0x31')](_[_0x89eb('0x4d')](_0xc7521b[_0x89eb('0x30')],_0x194f4d[_0x89eb('0x31')]));if(_0xc7521b[_0x89eb('0x30')][_0x89eb('0x3b')]){_0x458eee['where']=_['merge'](_0x458eee['where'],{'$or':_[_0x89eb('0x29')](_0x458eee[_0x89eb('0x33')],function(_0xff2a65){var _0x3aa527={};_0x3aa527[_0xff2a65]={'$like':'%'+_0xc7521b[_0x89eb('0x30')][_0x89eb('0x3b')]+'%'};return _0x3aa527;})});}_0x458eee=_[_0x89eb('0x3c')]({},_0x458eee,_0xc7521b[_0x89eb('0x3e')]);return _0x2a671d[_0x89eb('0x4b')](_0x458eee);}})[_0x89eb('0x23')](function(_0x1b56bf){if(_0x1b56bf){_0x2079a1=_0x1b56bf[_0x89eb('0x35')];if(!_0xc7521b[_0x89eb('0x30')][_0x89eb('0x36')](_0x89eb('0x37'))){_0x458eee['limit']=qs[_0x89eb('0x1e')](_0xc7521b['query'][_0x89eb('0x1e')]);_0x458eee[_0x89eb('0x1c')]=qs[_0x89eb('0x1c')](_0xc7521b[_0x89eb('0x30')]['offset']);}return _0x2a671d['getSubjects'](_0x458eee);}})[_0x89eb('0x23')](function(_0x21ea9a){if(_0x21ea9a){return _0x21ea9a?{'count':_0x2079a1,'rows':_0x21ea9a}:null;}})[_0x89eb('0x23')](respondWithResult(_0x5dcdbc,null))[_0x89eb('0x42')](handleError(_0x5dcdbc,null));};exports[_0x89eb('0x4e')]=function(_0x4ab71c,_0x208fd2,_0x2d6dad){var _0x39d34a={};var _0x534cbe={};var _0x3f6814;var _0xa4831;return db['ZohoConfiguration']['findOne']({'where':{'id':_0x4ab71c['params']['id']}})[_0x89eb('0x23')](handleEntityNotFound(_0x208fd2,null))[_0x89eb('0x23')](function(_0x149396){if(_0x149396){_0x3f6814=_0x149396;_0x534cbe[_0x89eb('0x2f')]=_[_0x89eb('0x45')](db[_0x89eb('0x4c')][_0x89eb('0x2b')]);_0x534cbe[_0x89eb('0x30')]=_[_0x89eb('0x45')](_0x4ab71c['query']);_0x534cbe[_0x89eb('0x31')]=_[_0x89eb('0x32')](_0x534cbe['model'],_0x534cbe['query']);_0x39d34a[_0x89eb('0x33')]=_[_0x89eb('0x32')](_0x534cbe[_0x89eb('0x2f')],qs[_0x89eb('0x34')](_0x4ab71c[_0x89eb('0x30')][_0x89eb('0x34')]));_0x39d34a[_0x89eb('0x33')]=_0x39d34a[_0x89eb('0x33')][_0x89eb('0x35')]?_0x39d34a[_0x89eb('0x33')]:_0x534cbe[_0x89eb('0x2f')];_0x39d34a['order']=qs['sort'](_0x4ab71c[_0x89eb('0x30')]['sort']);_0x39d34a[_0x89eb('0x3a')]=qs[_0x89eb('0x31')](_['pick'](_0x4ab71c['query'],_0x534cbe[_0x89eb('0x31')]));if(_0x4ab71c['query']['filter']){_0x39d34a[_0x89eb('0x3a')]=_[_0x89eb('0x3c')](_0x39d34a[_0x89eb('0x3a')],{'$or':_[_0x89eb('0x29')](_0x39d34a[_0x89eb('0x33')],function(_0x52a820){var _0x4bc1e9={};_0x4bc1e9[_0x52a820]={'$like':'%'+_0x4ab71c[_0x89eb('0x30')]['filter']+'%'};return _0x4bc1e9;})});}_0x39d34a=_['merge']({},_0x39d34a,_0x4ab71c[_0x89eb('0x3e')]);return _0x3f6814['getDescriptions'](_0x39d34a);}})['then'](function(_0x363b12){if(_0x363b12){_0xa4831=_0x363b12[_0x89eb('0x35')];if(!_0x4ab71c[_0x89eb('0x30')][_0x89eb('0x36')](_0x89eb('0x37'))){_0x39d34a[_0x89eb('0x1e')]=qs['limit'](_0x4ab71c[_0x89eb('0x30')][_0x89eb('0x1e')]);_0x39d34a['offset']=qs[_0x89eb('0x1c')](_0x4ab71c[_0x89eb('0x30')][_0x89eb('0x1c')]);}return _0x3f6814[_0x89eb('0x4e')](_0x39d34a);}})['then'](function(_0x1f5226){if(_0x1f5226){return _0x1f5226?{'count':_0xa4831,'rows':_0x1f5226}:null;}})[_0x89eb('0x23')](respondWithResult(_0x208fd2,null))['catch'](handleError(_0x208fd2,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index c7dd77a..bd057e3 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 _0x6e96=['exports','define','int_zoho_configurations','util','../../config/logger','moment','request-promise','../../config/environment'];(function(_0x29f7b4,_0x53e8a5){var _0x53c14f=function(_0x405c9e){while(--_0x405c9e){_0x29f7b4['push'](_0x29f7b4['shift']());}};_0x53c14f(++_0x53e8a5);}(_0x6e96,0x1cb));var _0x66e9=function(_0x46291a,_0x2cafb4){_0x46291a=_0x46291a-0x0;var _0x135e87=_0x6e96[_0x46291a];return _0x135e87;};'use strict';var _=require('lodash');var util=require(_0x66e9('0x0'));var logger=require(_0x66e9('0x1'))('api');var moment=require(_0x66e9('0x2'));var BPromise=require('bluebird');var rp=require(_0x66e9('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x66e9('0x4'));var attributes=require('./intZohoConfiguration.attributes');module[_0x66e9('0x5')]=function(_0x51c30e,_0x1fd8e4){return _0x51c30e[_0x66e9('0x6')]('ZohoConfiguration',attributes,{'tableName':_0x66e9('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa4c9=['bluebird','path','../../config/environment','./intZohoConfiguration.attributes','exports','int_zoho_configurations','lodash','util','../../config/logger','api'];(function(_0x251e8c,_0x277c33){var _0x1e0c1d=function(_0x20b89c){while(--_0x20b89c){_0x251e8c['push'](_0x251e8c['shift']());}};_0x1e0c1d(++_0x277c33);}(_0xa4c9,0x196));var _0x9a4c=function(_0x53d520,_0x35c166){_0x53d520=_0x53d520-0x0;var _0x488a7e=_0xa4c9[_0x53d520];return _0x488a7e;};'use strict';var _=require(_0x9a4c('0x0'));var util=require(_0x9a4c('0x1'));var logger=require(_0x9a4c('0x2'))(_0x9a4c('0x3'));var moment=require('moment');var BPromise=require(_0x9a4c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9a4c('0x5'));var rimraf=require('rimraf');var config=require(_0x9a4c('0x6'));var attributes=require(_0x9a4c('0x7'));module[_0x9a4c('0x8')]=function(_0x1de01c,_0x61b9bb){return _0x1de01c['define']('ZohoConfiguration',attributes,{'tableName':_0x9a4c('0x9'),'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 e0c5d52..54b0ed7 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 _0x4bb1=['request\x20sent','result','catch','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','ZohoConfiguration,\x20%s,\x20%s'];(function(_0x509fb2,_0x541f31){var _0x1b1072=function(_0x2b4283){while(--_0x2b4283){_0x509fb2['push'](_0x509fb2['shift']());}};_0x1b1072(++_0x541f31);}(_0x4bb1,0x1bb));var _0x14bb=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0x4bb1[_0x36884e];return _0x1cc367;};'use strict';var _=require('lodash');var util=require(_0x14bb('0x0'));var moment=require(_0x14bb('0x1'));var BPromise=require('bluebird');var rs=require(_0x14bb('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x14bb('0x3'))['db'];var utils=require(_0x14bb('0x4'));var logger=require(_0x14bb('0x5'))('rpc');var config=require(_0x14bb('0x6'));var jayson=require(_0x14bb('0x7'));var client=jayson[_0x14bb('0x8')][_0x14bb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x460b2f,_0x327b0b,_0xb21f38){return new BPromise(function(_0xead0fd,_0x4d02c0){return client[_0x14bb('0xa')](_0x460b2f,_0xb21f38)[_0x14bb('0xb')](function(_0x4eb1c1){logger[_0x14bb('0xc')]('ZohoConfiguration,\x20%s,\x20%s',_0x327b0b,'request\x20sent');logger[_0x14bb('0xd')](_0x14bb('0xe'),_0x327b0b,'request\x20sent',JSON[_0x14bb('0xf')](_0x4eb1c1));if(_0x4eb1c1[_0x14bb('0x10')]){if(_0x4eb1c1[_0x14bb('0x10')]['code']===0x1f4){logger[_0x14bb('0x10')]('ZohoConfiguration,\x20%s,\x20%s',_0x327b0b,_0x4eb1c1[_0x14bb('0x10')][_0x14bb('0x11')]);return _0x4d02c0(_0x4eb1c1[_0x14bb('0x10')]['message']);}logger[_0x14bb('0x10')](_0x14bb('0x12'),_0x327b0b,_0x4eb1c1[_0x14bb('0x10')][_0x14bb('0x11')]);return _0xead0fd(_0x4eb1c1['error'][_0x14bb('0x11')]);}else{logger[_0x14bb('0xc')](_0x14bb('0x12'),_0x327b0b,_0x14bb('0x13'));_0xead0fd(_0x4eb1c1[_0x14bb('0x14')][_0x14bb('0x11')]);}})[_0x14bb('0x15')](function(_0x24db63){logger[_0x14bb('0x10')](_0x14bb('0x12'),_0x327b0b,_0x24db63);_0x4d02c0(_0x24db63);});});} \ No newline at end of file +var _0xf5e6=['info','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xf5e6,0x12d));var _0x6f5e=function(_0x4fbc83,_0x4af5c0){_0x4fbc83=_0x4fbc83-0x0;var _0xe2a04a=_0xf5e6[_0x4fbc83];return _0xe2a04a;};'use strict';var _=require(_0x6f5e('0x0'));var util=require(_0x6f5e('0x1'));var moment=require(_0x6f5e('0x2'));var BPromise=require(_0x6f5e('0x3'));var rs=require(_0x6f5e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6f5e('0x5'))['db'];var utils=require(_0x6f5e('0x6'));var logger=require(_0x6f5e('0x7'))(_0x6f5e('0x8'));var config=require(_0x6f5e('0x9'));var jayson=require(_0x6f5e('0xa'));var client=jayson[_0x6f5e('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5c2f4f,_0x24d6f6,_0x4c4ab4){return new BPromise(function(_0x463de0,_0x5825dc){return client[_0x6f5e('0xc')](_0x5c2f4f,_0x4c4ab4)[_0x6f5e('0xd')](function(_0x99371a){logger['info'](_0x6f5e('0xe'),_0x24d6f6,_0x6f5e('0xf'));logger[_0x6f5e('0x10')](_0x6f5e('0x11'),_0x24d6f6,_0x6f5e('0xf'),JSON[_0x6f5e('0x12')](_0x99371a));if(_0x99371a['error']){if(_0x99371a['error']['code']===0x1f4){logger[_0x6f5e('0x13')](_0x6f5e('0xe'),_0x24d6f6,_0x99371a[_0x6f5e('0x13')][_0x6f5e('0x14')]);return _0x5825dc(_0x99371a[_0x6f5e('0x13')]['message']);}logger['error'](_0x6f5e('0xe'),_0x24d6f6,_0x99371a[_0x6f5e('0x13')]['message']);return _0x463de0(_0x99371a[_0x6f5e('0x13')]['message']);}else{logger[_0x6f5e('0x15')](_0x6f5e('0xe'),_0x24d6f6,_0x6f5e('0xf'));_0x463de0(_0x99371a['result'][_0x6f5e('0x14')]);}})[_0x6f5e('0x16')](function(_0x32b93a){logger[_0x6f5e('0x13')](_0x6f5e('0xe'),_0x24d6f6,_0x32b93a);_0x5825dc(_0x32b93a);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 61bd376..9146694 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 _0xe5ad=['put','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','index','show','post','create'];(function(_0x5c811c,_0x313b25){var _0x5df3af=function(_0x3460de){while(--_0x3460de){_0x5c811c['push'](_0x5c811c['shift']());}};_0x5df3af(++_0x313b25);}(_0xe5ad,0xb8));var _0xde5a=function(_0x3e5b05,_0xc8c1fe){_0x3e5b05=_0x3e5b05-0x0;var _0x599ec0=_0xe5ad[_0x3e5b05];return _0x599ec0;};'use strict';var multer=require(_0xde5a('0x0'));var util=require(_0xde5a('0x1'));var path=require(_0xde5a('0x2'));var timeout=require('connect-timeout');var express=require(_0xde5a('0x3'));var router=express[_0xde5a('0x4')]();var fs_extra=require(_0xde5a('0x5'));var auth=require(_0xde5a('0x6'));var interaction=require(_0xde5a('0x7'));var config=require(_0xde5a('0x8'));var controller=require(_0xde5a('0x9'));router[_0xde5a('0xa')]('/',auth[_0xde5a('0xb')](),controller[_0xde5a('0xc')]);router['get']('/:id',auth[_0xde5a('0xb')](),controller[_0xde5a('0xd')]);router[_0xde5a('0xe')]('/',auth['isAuthenticated'](),controller[_0xde5a('0xf')]);router[_0xde5a('0x10')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xde5a('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xde5a('0x12')]);module[_0xde5a('0x13')]=router; \ No newline at end of file +var _0xea23=['create','put','update','delete','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','index','/:id','show'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0xea23,0x136));var _0x3ea2=function(_0x2232b9,_0x5c91a3){_0x2232b9=_0x2232b9-0x0;var _0x4d3f3d=_0xea23[_0x2232b9];return _0x4d3f3d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3ea2('0x0'));var timeout=require(_0x3ea2('0x1'));var express=require(_0x3ea2('0x2'));var router=express[_0x3ea2('0x3')]();var fs_extra=require(_0x3ea2('0x4'));var auth=require(_0x3ea2('0x5'));var interaction=require(_0x3ea2('0x6'));var config=require(_0x3ea2('0x7'));var controller=require(_0x3ea2('0x8'));router[_0x3ea2('0x9')]('/',auth[_0x3ea2('0xa')](),controller[_0x3ea2('0xb')]);router[_0x3ea2('0x9')](_0x3ea2('0xc'),auth[_0x3ea2('0xa')](),controller[_0x3ea2('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x3ea2('0xe')]);router[_0x3ea2('0xf')]('/:id',auth[_0x3ea2('0xa')](),controller[_0x3ea2('0x10')]);router[_0x3ea2('0x11')](_0x3ea2('0xc'),auth[_0x3ea2('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index e77408f..2b195ac 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 _0xb5f6=['keyValue','picklist','STRING','BOOLEAN','exports','string','variable','customVariable'];(function(_0x2b4ce,_0x36c269){var _0x18f403=function(_0x590adf){while(--_0x590adf){_0x2b4ce['push'](_0x2b4ce['shift']());}};_0x18f403(++_0x36c269);}(_0xb5f6,0xec));var _0x6b5f=function(_0x277721,_0x46971e){_0x277721=_0x277721-0x0;var _0x286051=_0xb5f6[_0x277721];return _0x286051;};'use strict';var Sequelize=require('sequelize');module[_0x6b5f('0x0')]={'type':{'type':Sequelize['ENUM'](_0x6b5f('0x1'),_0x6b5f('0x2'),_0x6b5f('0x3'),_0x6b5f('0x4'),_0x6b5f('0x5')),'defaultValue':_0x6b5f('0x1')},'content':{'type':Sequelize[_0x6b5f('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x6b5f('0x1'),_0x6b5f('0x2'),_0x6b5f('0x3'))},'keyContent':{'type':Sequelize[_0x6b5f('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x6b5f('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6b5f('0x6')]}}; \ No newline at end of file +var _0x704d=['sequelize','exports','ENUM','string','variable','customVariable','picklist','STRING','BOOLEAN'];(function(_0x382276,_0x2d37e5){var _0x260e02=function(_0x3b6208){while(--_0x3b6208){_0x382276['push'](_0x382276['shift']());}};_0x260e02(++_0x2d37e5);}(_0x704d,0x120));var _0xd704=function(_0x14f141,_0x5356f7){_0x14f141=_0x14f141-0x0;var _0x4c10c9=_0x704d[_0x14f141];return _0x4c10c9;};'use strict';var Sequelize=require(_0xd704('0x0'));module[_0xd704('0x1')]={'type':{'type':Sequelize[_0xd704('0x2')](_0xd704('0x3'),_0xd704('0x4'),_0xd704('0x5'),'keyValue',_0xd704('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0xd704('0x7')]},'key':{'type':Sequelize[_0xd704('0x7')]},'keyType':{'type':Sequelize[_0xd704('0x2')](_0xd704('0x3'),_0xd704('0x4'),_0xd704('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xd704('0x7')]},'nameField':{'type':Sequelize[_0xd704('0x7')]},'customField':{'type':Sequelize[_0xd704('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index fca7290..fbe90e0 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 _0xfdb5=['end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','name','send','index','map','ZohoField','rawAttributes','type','key','query','filters','intersection','model','attributes','fields','length','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x443fe6,_0xcc1e25){var _0x1dfbee=function(_0x4263a0){while(--_0x4263a0){_0x443fe6['push'](_0x443fe6['shift']());}};_0x1dfbee(++_0xcc1e25);}(_0xfdb5,0x18f));var _0x5fdb=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xfdb5[_0x3e5086];return _0xfeb102;};'use strict';var emlformat=require(_0x5fdb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5fdb('0x1'));var jsonpatch=require(_0x5fdb('0x2'));var rp=require(_0x5fdb('0x3'));var moment=require(_0x5fdb('0x4'));var BPromise=require(_0x5fdb('0x5'));var Mustache=require(_0x5fdb('0x6'));var util=require(_0x5fdb('0x7'));var path=require(_0x5fdb('0x8'));var sox=require('sox');var csv=require(_0x5fdb('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5fdb('0xa'));var _=require(_0x5fdb('0xb'));var squel=require(_0x5fdb('0xc'));var crypto=require(_0x5fdb('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x5fdb('0xe'));var toCsv=require('to-csv');var querystring=require(_0x5fdb('0xf'));var Papa=require(_0x5fdb('0x10'));var Redis=require(_0x5fdb('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x5fdb('0x12'));var as=require(_0x5fdb('0x13'));var hardwareService=require(_0x5fdb('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x5fdb('0x15'));var config=require(_0x5fdb('0x16'));var licenseUtil=require(_0x5fdb('0x17'));var db=require(_0x5fdb('0x18'))['db'];function respondWithStatusCode(_0x3ee18f,_0x321fc6){_0x321fc6=_0x321fc6||0xcc;return function(_0x58ae7b){if(_0x58ae7b){return _0x3ee18f[_0x5fdb('0x19')](_0x321fc6);}return _0x3ee18f[_0x5fdb('0x1a')](_0x321fc6)[_0x5fdb('0x1b')]();};}function respondWithResult(_0x15fd60,_0x27ac29){_0x27ac29=_0x27ac29||0xc8;return function(_0x4beba0){if(_0x4beba0){return _0x15fd60[_0x5fdb('0x1a')](_0x27ac29)[_0x5fdb('0x1c')](_0x4beba0);}};}function respondWithFilteredResult(_0x5a7cc4,_0x18ccfb){return function(_0x374b9c){if(_0x374b9c){var _0x20d284=typeof _0x18ccfb[_0x5fdb('0x1d')]===_0x5fdb('0x1e')&&typeof _0x18ccfb[_0x5fdb('0x1f')]==='undefined';var _0x48c22f=_0x374b9c[_0x5fdb('0x20')];var _0x1c04bf=_0x20d284?0x0:_0x18ccfb['offset'];var _0x407281=_0x20d284?_0x374b9c[_0x5fdb('0x20')]:_0x18ccfb[_0x5fdb('0x1d')]+_0x18ccfb[_0x5fdb('0x1f')];var _0x2eb087;if(_0x407281>=_0x48c22f){_0x407281=_0x48c22f;_0x2eb087=0xc8;}else{_0x2eb087=0xce;}_0x5a7cc4[_0x5fdb('0x1a')](_0x2eb087);return _0x5a7cc4[_0x5fdb('0x21')](_0x5fdb('0x22'),_0x1c04bf+'-'+_0x407281+'/'+_0x48c22f)[_0x5fdb('0x1c')](_0x374b9c);}return null;};}function patchUpdates(_0x3f5198){return function(_0x5afd57){try{jsonpatch['apply'](_0x5afd57,_0x3f5198,!![]);}catch(_0x558f7b){return BPromise[_0x5fdb('0x23')](_0x558f7b);}return _0x5afd57['save']();};}function saveUpdates(_0xc53b2c,_0x3c2dbf){return function(_0x3c4257){if(_0x3c4257){return _0x3c4257[_0x5fdb('0x24')](_0xc53b2c)[_0x5fdb('0x25')](function(_0x50cf4f){return _0x50cf4f;});}return null;};}function removeEntity(_0x32b9e7,_0x1079c0){return function(_0x367382){if(_0x367382){return _0x367382[_0x5fdb('0x26')]()[_0x5fdb('0x25')](function(){_0x32b9e7[_0x5fdb('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ab9a5,_0xafda3f){return function(_0x559585){if(!_0x559585){_0x4ab9a5[_0x5fdb('0x19')](0x194);}return _0x559585;};}function handleError(_0x51b57d,_0x2c14e8){_0x2c14e8=_0x2c14e8||0x1f4;return function(_0x272f1f){logger['error'](_0x272f1f['stack']);if(_0x272f1f[_0x5fdb('0x27')]){delete _0x272f1f[_0x5fdb('0x27')];}_0x51b57d[_0x5fdb('0x1a')](_0x2c14e8)[_0x5fdb('0x28')](_0x272f1f);};}exports[_0x5fdb('0x29')]=function(_0x106f69,_0x41cfdc){var _0x443fb6={},_0x234038={},_0xec019b={'count':0x0,'rows':[]};var _0x99afa4=_[_0x5fdb('0x2a')](db[_0x5fdb('0x2b')][_0x5fdb('0x2c')],function(_0x3be51e){return{'name':_0x3be51e['fieldName'],'type':_0x3be51e[_0x5fdb('0x2d')][_0x5fdb('0x2e')]};});_0x234038['model']=_['map'](_0x99afa4,_0x5fdb('0x27'));_0x234038[_0x5fdb('0x2f')]=_['keys'](_0x106f69[_0x5fdb('0x2f')]);_0x234038[_0x5fdb('0x30')]=_[_0x5fdb('0x31')](_0x234038[_0x5fdb('0x32')],_0x234038[_0x5fdb('0x2f')]);_0x443fb6[_0x5fdb('0x33')]=_[_0x5fdb('0x31')](_0x234038[_0x5fdb('0x32')],qs['fields'](_0x106f69['query'][_0x5fdb('0x34')]));_0x443fb6[_0x5fdb('0x33')]=_0x443fb6[_0x5fdb('0x33')][_0x5fdb('0x35')]?_0x443fb6[_0x5fdb('0x33')]:_0x234038['model'];if(!_0x106f69['query']['hasOwnProperty']('nolimit')){_0x443fb6[_0x5fdb('0x1f')]=qs[_0x5fdb('0x1f')](_0x106f69[_0x5fdb('0x2f')][_0x5fdb('0x1f')]);_0x443fb6[_0x5fdb('0x1d')]=qs['offset'](_0x106f69['query']['offset']);}_0x443fb6[_0x5fdb('0x36')]=qs[_0x5fdb('0x37')](_0x106f69[_0x5fdb('0x2f')][_0x5fdb('0x37')]);_0x443fb6[_0x5fdb('0x38')]=qs[_0x5fdb('0x30')](_['pick'](_0x106f69[_0x5fdb('0x2f')],_0x234038[_0x5fdb('0x30')]),_0x99afa4);if(_0x106f69[_0x5fdb('0x2f')][_0x5fdb('0x39')]){_0x443fb6[_0x5fdb('0x38')]=_['merge'](_0x443fb6[_0x5fdb('0x38')],{'$or':_['map'](_0x99afa4,function(_0x1faead){if(_0x1faead['type']!=='VIRTUAL'){var _0x5cca93={};_0x5cca93[_0x1faead['name']]={'$like':'%'+_0x106f69[_0x5fdb('0x2f')][_0x5fdb('0x39')]+'%'};return _0x5cca93;}})});}_0x443fb6=_[_0x5fdb('0x3a')]({},_0x443fb6,_0x106f69[_0x5fdb('0x3b')]);var _0x33434f={'where':_0x443fb6[_0x5fdb('0x38')]};return db[_0x5fdb('0x2b')]['count'](_0x33434f)[_0x5fdb('0x25')](function(_0x349724){_0xec019b['count']=_0x349724;if(_0x106f69[_0x5fdb('0x2f')][_0x5fdb('0x3c')]){_0x443fb6[_0x5fdb('0x3d')]=[{'all':!![]}];}return db['ZohoField'][_0x5fdb('0x3e')](_0x443fb6);})['then'](function(_0x1c16ee){_0xec019b[_0x5fdb('0x3f')]=_0x1c16ee;return _0xec019b;})[_0x5fdb('0x25')](respondWithFilteredResult(_0x41cfdc,_0x443fb6))[_0x5fdb('0x40')](handleError(_0x41cfdc,null));};exports[_0x5fdb('0x41')]=function(_0x356c27,_0x27e912){var _0x36ea68={'raw':!![],'where':{'id':_0x356c27[_0x5fdb('0x42')]['id']}},_0x27eb61={};_0x27eb61[_0x5fdb('0x32')]=_['keys'](db['ZohoField']['rawAttributes']);_0x27eb61['query']=_[_0x5fdb('0x43')](_0x356c27[_0x5fdb('0x2f')]);_0x27eb61['filters']=_['intersection'](_0x27eb61[_0x5fdb('0x32')],_0x27eb61[_0x5fdb('0x2f')]);_0x36ea68[_0x5fdb('0x33')]=_[_0x5fdb('0x31')](_0x27eb61[_0x5fdb('0x32')],qs[_0x5fdb('0x34')](_0x356c27[_0x5fdb('0x2f')][_0x5fdb('0x34')]));_0x36ea68[_0x5fdb('0x33')]=_0x36ea68[_0x5fdb('0x33')][_0x5fdb('0x35')]?_0x36ea68[_0x5fdb('0x33')]:_0x27eb61['model'];if(_0x356c27[_0x5fdb('0x2f')][_0x5fdb('0x3c')]){_0x36ea68[_0x5fdb('0x3d')]=[{'all':!![]}];}_0x36ea68=_[_0x5fdb('0x3a')]({},_0x36ea68,_0x356c27[_0x5fdb('0x3b')]);return db[_0x5fdb('0x2b')][_0x5fdb('0x44')](_0x36ea68)[_0x5fdb('0x25')](handleEntityNotFound(_0x27e912,null))[_0x5fdb('0x25')](respondWithResult(_0x27e912,null))[_0x5fdb('0x40')](handleError(_0x27e912,null));};exports[_0x5fdb('0x45')]=function(_0x3e644f,_0x375156){return db[_0x5fdb('0x2b')][_0x5fdb('0x45')](_0x3e644f[_0x5fdb('0x46')],{})[_0x5fdb('0x25')](respondWithResult(_0x375156,0xc9))[_0x5fdb('0x40')](handleError(_0x375156,null));};exports[_0x5fdb('0x24')]=function(_0x88d1f0,_0x224fb1){if(_0x88d1f0['body']['id']){delete _0x88d1f0[_0x5fdb('0x46')]['id'];}return db[_0x5fdb('0x2b')][_0x5fdb('0x44')]({'where':{'id':_0x88d1f0['params']['id']}})[_0x5fdb('0x25')](handleEntityNotFound(_0x224fb1,null))[_0x5fdb('0x25')](saveUpdates(_0x88d1f0[_0x5fdb('0x46')],null))['then'](respondWithResult(_0x224fb1,null))[_0x5fdb('0x40')](handleError(_0x224fb1,null));};exports[_0x5fdb('0x26')]=function(_0x442f2c,_0x3cce5e){return db[_0x5fdb('0x2b')][_0x5fdb('0x44')]({'where':{'id':_0x442f2c[_0x5fdb('0x42')]['id']}})[_0x5fdb('0x25')](handleEntityNotFound(_0x3cce5e,null))[_0x5fdb('0x25')](removeEntity(_0x3cce5e,null))[_0x5fdb('0x40')](handleError(_0x3cce5e,null));}; \ No newline at end of file +var _0x5349=['../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','name','send','map','ZohoField','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','length','nolimit','sort','where','filter','VIRTUAL','options','include','findAll','rows','catch','show','params','fields','includeAll','merge','find','create','body','update','eml-format','zip-dir','moment','bluebird','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','../../config/utils','../../config/environment'];(function(_0x3da075,_0xc7306c){var _0x1c0974=function(_0x7bb1ef){while(--_0x7bb1ef){_0x3da075['push'](_0x3da075['shift']());}};_0x1c0974(++_0xc7306c);}(_0x5349,0x141));var _0x9534=function(_0x58afd5,_0x534a48){_0x58afd5=_0x58afd5-0x0;var _0x3e503b=_0x5349[_0x58afd5];return _0x3e503b;};'use strict';var emlformat=require(_0x9534('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9534('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9534('0x2'));var BPromise=require(_0x9534('0x3'));var Mustache=require('mustache');var util=require(_0x9534('0x4'));var path=require(_0x9534('0x5'));var sox=require('sox');var csv=require(_0x9534('0x6'));var ejs=require(_0x9534('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9534('0x8'));var squel=require('squel');var crypto=require(_0x9534('0x9'));var jsforce=require(_0x9534('0xa'));var deskjs=require(_0x9534('0xb'));var toCsv=require(_0x9534('0x6'));var querystring=require(_0x9534('0xc'));var Papa=require(_0x9534('0xd'));var Redis=require(_0x9534('0xe'));var authService=require(_0x9534('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9534('0x10'))('api');var utils=require(_0x9534('0x11'));var config=require(_0x9534('0x12'));var licenseUtil=require(_0x9534('0x13'));var db=require(_0x9534('0x14'))['db'];function respondWithStatusCode(_0x35a001,_0x578a84){_0x578a84=_0x578a84||0xcc;return function(_0x3652e9){if(_0x3652e9){return _0x35a001[_0x9534('0x15')](_0x578a84);}return _0x35a001[_0x9534('0x16')](_0x578a84)['end']();};}function respondWithResult(_0x17d24d,_0x15eb90){_0x15eb90=_0x15eb90||0xc8;return function(_0x1ff9d6){if(_0x1ff9d6){return _0x17d24d[_0x9534('0x16')](_0x15eb90)['json'](_0x1ff9d6);}};}function respondWithFilteredResult(_0x5b287c,_0x4793c1){return function(_0x1db872){if(_0x1db872){var _0x5bd4fe=typeof _0x4793c1[_0x9534('0x17')]===_0x9534('0x18')&&typeof _0x4793c1[_0x9534('0x19')]===_0x9534('0x18');var _0x32fca6=_0x1db872[_0x9534('0x1a')];var _0x4ec619=_0x5bd4fe?0x0:_0x4793c1[_0x9534('0x17')];var _0x2fe61c=_0x5bd4fe?_0x1db872[_0x9534('0x1a')]:_0x4793c1[_0x9534('0x17')]+_0x4793c1[_0x9534('0x19')];var _0x176278;if(_0x2fe61c>=_0x32fca6){_0x2fe61c=_0x32fca6;_0x176278=0xc8;}else{_0x176278=0xce;}_0x5b287c['status'](_0x176278);return _0x5b287c[_0x9534('0x1b')](_0x9534('0x1c'),_0x4ec619+'-'+_0x2fe61c+'/'+_0x32fca6)[_0x9534('0x1d')](_0x1db872);}return null;};}function patchUpdates(_0x115530){return function(_0x3b3ddf){try{jsonpatch[_0x9534('0x1e')](_0x3b3ddf,_0x115530,!![]);}catch(_0x54ab74){return BPromise[_0x9534('0x1f')](_0x54ab74);}return _0x3b3ddf[_0x9534('0x20')]();};}function saveUpdates(_0x54dbdc,_0x3a8211){return function(_0x2a6493){if(_0x2a6493){return _0x2a6493['update'](_0x54dbdc)[_0x9534('0x21')](function(_0x43620f){return _0x43620f;});}return null;};}function removeEntity(_0x1f6759,_0x3bd3df){return function(_0x5e9bec){if(_0x5e9bec){return _0x5e9bec['destroy']()[_0x9534('0x21')](function(){_0x1f6759[_0x9534('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x21729e,_0x298e86){return function(_0x90be6f){if(!_0x90be6f){_0x21729e[_0x9534('0x15')](0x194);}return _0x90be6f;};}function handleError(_0x552efa,_0x57e4e0){_0x57e4e0=_0x57e4e0||0x1f4;return function(_0x5dace1){logger['error'](_0x5dace1['stack']);if(_0x5dace1[_0x9534('0x22')]){delete _0x5dace1[_0x9534('0x22')];}_0x552efa['status'](_0x57e4e0)[_0x9534('0x23')](_0x5dace1);};}exports['index']=function(_0xb2b6eb,_0x14c835){var _0x43bb7a={},_0x50aa1c={},_0x1c5496={'count':0x0,'rows':[]};var _0x513a1c=_[_0x9534('0x24')](db[_0x9534('0x25')][_0x9534('0x26')],function(_0x3eb72a){return{'name':_0x3eb72a[_0x9534('0x27')],'type':_0x3eb72a[_0x9534('0x28')][_0x9534('0x29')]};});_0x50aa1c[_0x9534('0x2a')]=_['map'](_0x513a1c,_0x9534('0x22'));_0x50aa1c['query']=_[_0x9534('0x2b')](_0xb2b6eb['query']);_0x50aa1c[_0x9534('0x2c')]=_[_0x9534('0x2d')](_0x50aa1c['model'],_0x50aa1c[_0x9534('0x2e')]);_0x43bb7a['attributes']=_[_0x9534('0x2d')](_0x50aa1c['model'],qs['fields'](_0xb2b6eb[_0x9534('0x2e')]['fields']));_0x43bb7a[_0x9534('0x2f')]=_0x43bb7a[_0x9534('0x2f')][_0x9534('0x30')]?_0x43bb7a['attributes']:_0x50aa1c[_0x9534('0x2a')];if(!_0xb2b6eb[_0x9534('0x2e')]['hasOwnProperty'](_0x9534('0x31'))){_0x43bb7a[_0x9534('0x19')]=qs[_0x9534('0x19')](_0xb2b6eb[_0x9534('0x2e')][_0x9534('0x19')]);_0x43bb7a[_0x9534('0x17')]=qs[_0x9534('0x17')](_0xb2b6eb['query'][_0x9534('0x17')]);}_0x43bb7a['order']=qs[_0x9534('0x32')](_0xb2b6eb[_0x9534('0x2e')][_0x9534('0x32')]);_0x43bb7a[_0x9534('0x33')]=qs['filters'](_['pick'](_0xb2b6eb['query'],_0x50aa1c['filters']),_0x513a1c);if(_0xb2b6eb[_0x9534('0x2e')][_0x9534('0x34')]){_0x43bb7a['where']=_['merge'](_0x43bb7a[_0x9534('0x33')],{'$or':_['map'](_0x513a1c,function(_0x1c897d){if(_0x1c897d[_0x9534('0x28')]!==_0x9534('0x35')){var _0x1f910e={};_0x1f910e[_0x1c897d[_0x9534('0x22')]]={'$like':'%'+_0xb2b6eb['query'][_0x9534('0x34')]+'%'};return _0x1f910e;}})});}_0x43bb7a=_['merge']({},_0x43bb7a,_0xb2b6eb[_0x9534('0x36')]);var _0xdd9af1={'where':_0x43bb7a[_0x9534('0x33')]};return db[_0x9534('0x25')][_0x9534('0x1a')](_0xdd9af1)[_0x9534('0x21')](function(_0x38bc81){_0x1c5496['count']=_0x38bc81;if(_0xb2b6eb[_0x9534('0x2e')]['includeAll']){_0x43bb7a[_0x9534('0x37')]=[{'all':!![]}];}return db['ZohoField'][_0x9534('0x38')](_0x43bb7a);})[_0x9534('0x21')](function(_0x367603){_0x1c5496[_0x9534('0x39')]=_0x367603;return _0x1c5496;})[_0x9534('0x21')](respondWithFilteredResult(_0x14c835,_0x43bb7a))[_0x9534('0x3a')](handleError(_0x14c835,null));};exports[_0x9534('0x3b')]=function(_0x5107ee,_0x4a0d5e){var _0x5b55de={'raw':!![],'where':{'id':_0x5107ee[_0x9534('0x3c')]['id']}},_0x119b56={};_0x119b56['model']=_['keys'](db['ZohoField'][_0x9534('0x26')]);_0x119b56['query']=_[_0x9534('0x2b')](_0x5107ee[_0x9534('0x2e')]);_0x119b56[_0x9534('0x2c')]=_[_0x9534('0x2d')](_0x119b56[_0x9534('0x2a')],_0x119b56[_0x9534('0x2e')]);_0x5b55de[_0x9534('0x2f')]=_[_0x9534('0x2d')](_0x119b56[_0x9534('0x2a')],qs['fields'](_0x5107ee[_0x9534('0x2e')][_0x9534('0x3d')]));_0x5b55de[_0x9534('0x2f')]=_0x5b55de[_0x9534('0x2f')][_0x9534('0x30')]?_0x5b55de['attributes']:_0x119b56[_0x9534('0x2a')];if(_0x5107ee[_0x9534('0x2e')][_0x9534('0x3e')]){_0x5b55de[_0x9534('0x37')]=[{'all':!![]}];}_0x5b55de=_[_0x9534('0x3f')]({},_0x5b55de,_0x5107ee[_0x9534('0x36')]);return db[_0x9534('0x25')][_0x9534('0x40')](_0x5b55de)[_0x9534('0x21')](handleEntityNotFound(_0x4a0d5e,null))['then'](respondWithResult(_0x4a0d5e,null))[_0x9534('0x3a')](handleError(_0x4a0d5e,null));};exports[_0x9534('0x41')]=function(_0x52defa,_0x214fb0){return db[_0x9534('0x25')][_0x9534('0x41')](_0x52defa[_0x9534('0x42')],{})[_0x9534('0x21')](respondWithResult(_0x214fb0,0xc9))['catch'](handleError(_0x214fb0,null));};exports[_0x9534('0x43')]=function(_0x59c782,_0x26aff5){if(_0x59c782[_0x9534('0x42')]['id']){delete _0x59c782['body']['id'];}return db[_0x9534('0x25')]['find']({'where':{'id':_0x59c782[_0x9534('0x3c')]['id']}})[_0x9534('0x21')](handleEntityNotFound(_0x26aff5,null))[_0x9534('0x21')](saveUpdates(_0x59c782[_0x9534('0x42')],null))[_0x9534('0x21')](respondWithResult(_0x26aff5,null))['catch'](handleError(_0x26aff5,null));};exports['destroy']=function(_0xdb11d6,_0x5fb007){return db[_0x9534('0x25')][_0x9534('0x40')]({'where':{'id':_0xdb11d6[_0x9534('0x3c')]['id']}})[_0x9534('0x21')](handleEntityNotFound(_0x5fb007,null))['then'](removeEntity(_0x5fb007,null))[_0x9534('0x3a')](handleError(_0x5fb007,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 0848549..b2277c4 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 _0x71ab=['rimraf','../../config/environment','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','util','api','bluebird','request-promise','path'];(function(_0x4b70a2,_0x5d0fbd){var _0x2170fa=function(_0x245bf2){while(--_0x245bf2){_0x4b70a2['push'](_0x4b70a2['shift']());}};_0x2170fa(++_0x5d0fbd);}(_0x71ab,0x64));var _0xb71a=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x71ab[_0x465028];return _0xb783d4;};'use strict';var _=require('lodash');var util=require(_0xb71a('0x0'));var logger=require('../../config/logger')(_0xb71a('0x1'));var moment=require('moment');var BPromise=require(_0xb71a('0x2'));var rp=require(_0xb71a('0x3'));var fs=require('fs');var path=require(_0xb71a('0x4'));var rimraf=require(_0xb71a('0x5'));var config=require(_0xb71a('0x6'));var attributes=require(_0xb71a('0x7'));module[_0xb71a('0x8')]=function(_0x38d931,_0x22c072){return _0x38d931[_0xb71a('0x9')](_0xb71a('0xa'),attributes,{'tableName':_0xb71a('0xb'),'paranoid':![],'indexes':[{'name':_0xb71a('0xc'),'fields':[_0xb71a('0xd'),_0xb71a('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7046=['lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./intZohoField.attributes','exports','ZohoField','idField'];(function(_0x861dcd,_0x4932f4){var _0x26c19f=function(_0x24c5ec){while(--_0x24c5ec){_0x861dcd['push'](_0x861dcd['shift']());}};_0x26c19f(++_0x4932f4);}(_0x7046,0x144));var _0x6704=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x7046[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0x6704('0x0'));var util=require(_0x6704('0x1'));var logger=require(_0x6704('0x2'))(_0x6704('0x3'));var moment=require('moment');var BPromise=require(_0x6704('0x4'));var rp=require(_0x6704('0x5'));var fs=require('fs');var path=require(_0x6704('0x6'));var rimraf=require('rimraf');var config=require(_0x6704('0x7'));var attributes=require(_0x6704('0x8'));module[_0x6704('0x9')]=function(_0x626a14,_0x2917be){return _0x626a14['define'](_0x6704('0xa'),attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':[_0x6704('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index 1717bb2..96d115b 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 _0xb0dd=['debug','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','then','info','ZohoField,\x20%s,\x20%s','request\x20sent'];(function(_0x5eef05,_0x1be989){var _0x56d4b8=function(_0x57993d){while(--_0x57993d){_0x5eef05['push'](_0x5eef05['shift']());}};_0x56d4b8(++_0x1be989);}(_0xb0dd,0x180));var _0xdb0d=function(_0x127ba5,_0x3185d5){_0x127ba5=_0x127ba5-0x0;var _0x17f4d1=_0xb0dd[_0x127ba5];return _0x17f4d1;};'use strict';var _=require(_0xdb0d('0x0'));var util=require(_0xdb0d('0x1'));var moment=require(_0xdb0d('0x2'));var BPromise=require(_0xdb0d('0x3'));var rs=require(_0xdb0d('0x4'));var fs=require('fs');var Redis=require(_0xdb0d('0x5'));var db=require(_0xdb0d('0x6'))['db'];var utils=require(_0xdb0d('0x7'));var logger=require('../../config/logger')(_0xdb0d('0x8'));var config=require(_0xdb0d('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xdb0d('0xa')][_0xdb0d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x398ac8,_0x51da8b,_0x379b50){return new BPromise(function(_0x42d88a,_0x1faeef){return client['request'](_0x398ac8,_0x379b50)[_0xdb0d('0xc')](function(_0x868979){logger[_0xdb0d('0xd')](_0xdb0d('0xe'),_0x51da8b,_0xdb0d('0xf'));logger[_0xdb0d('0x10')]('ZohoField,\x20%s,\x20%s,\x20%s',_0x51da8b,_0xdb0d('0xf'),JSON['stringify'](_0x868979));if(_0x868979['error']){if(_0x868979[_0xdb0d('0x11')]['code']===0x1f4){logger[_0xdb0d('0x11')]('ZohoField,\x20%s,\x20%s',_0x51da8b,_0x868979[_0xdb0d('0x11')][_0xdb0d('0x12')]);return _0x1faeef(_0x868979[_0xdb0d('0x11')][_0xdb0d('0x12')]);}logger[_0xdb0d('0x11')](_0xdb0d('0xe'),_0x51da8b,_0x868979[_0xdb0d('0x11')][_0xdb0d('0x12')]);return _0x42d88a(_0x868979[_0xdb0d('0x11')][_0xdb0d('0x12')]);}else{logger[_0xdb0d('0xd')](_0xdb0d('0xe'),_0x51da8b,_0xdb0d('0xf'));_0x42d88a(_0x868979[_0xdb0d('0x13')][_0xdb0d('0x12')]);}})['catch'](function(_0x404e59){logger[_0xdb0d('0x11')](_0xdb0d('0xe'),_0x51da8b,_0x404e59);_0x1faeef(_0x404e59);});});} \ No newline at end of file +var _0xd89a=['error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','ZohoField,\x20%s,\x20%s','debug','ZohoField,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd89a,0x130));var _0xad89=function(_0x14a516,_0x5dee29){_0x14a516=_0x14a516-0x0;var _0x51a308=_0xd89a[_0x14a516];return _0x51a308;};'use strict';var _=require('lodash');var util=require(_0xad89('0x0'));var moment=require(_0xad89('0x1'));var BPromise=require(_0xad89('0x2'));var rs=require(_0xad89('0x3'));var fs=require('fs');var Redis=require(_0xad89('0x4'));var db=require(_0xad89('0x5'))['db'];var utils=require(_0xad89('0x6'));var logger=require(_0xad89('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xad89('0x8'));var client=jayson[_0xad89('0x9')][_0xad89('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4f91d0,_0x22919c,_0x2159a5){return new BPromise(function(_0x3d4fd4,_0x1039e1){return client[_0xad89('0xb')](_0x4f91d0,_0x2159a5)[_0xad89('0xc')](function(_0x27b785){logger[_0xad89('0xd')](_0xad89('0xe'),_0x22919c,'request\x20sent');logger[_0xad89('0xf')](_0xad89('0x10'),_0x22919c,_0xad89('0x11'),JSON['stringify'](_0x27b785));if(_0x27b785[_0xad89('0x12')]){if(_0x27b785[_0xad89('0x12')][_0xad89('0x13')]===0x1f4){logger[_0xad89('0x12')]('ZohoField,\x20%s,\x20%s',_0x22919c,_0x27b785[_0xad89('0x12')][_0xad89('0x14')]);return _0x1039e1(_0x27b785[_0xad89('0x12')][_0xad89('0x14')]);}logger[_0xad89('0x12')]('ZohoField,\x20%s,\x20%s',_0x22919c,_0x27b785['error']['message']);return _0x3d4fd4(_0x27b785['error'][_0xad89('0x14')]);}else{logger[_0xad89('0xd')](_0xad89('0xe'),_0x22919c,_0xad89('0x11'));_0x3d4fd4(_0x27b785[_0xad89('0x15')][_0xad89('0x14')]);}})[_0xad89('0x16')](function(_0x26040a){logger['error'](_0xad89('0xe'),_0x22919c,_0x26040a);_0x1039e1(_0x26040a);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 29487b8..10acf20 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x3d9312,_0x3363fc){var _0x3a0a42=function(_0x58cad2){while(--_0x58cad2){_0x3d9312['push'](_0x3d9312['shift']());}};_0x3a0a42(++_0x3363fc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x186605,_0x660628){var _0x4dee6a=function(_0x805444){while(--_0x805444){_0x186605['push'](_0x186605['shift']());}};_0x4dee6a(++_0x660628);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 3ebb424..5b74b7a 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 _0x726e=['sequelize','STRING','unique_name_and_version','BOOLEAN','state'];(function(_0x154fb5,_0x34cfd3){var _0xa1ea60=function(_0xf1ab1f){while(--_0xf1ab1f){_0x154fb5['push'](_0x154fb5['shift']());}};_0xa1ea60(++_0x34cfd3);}(_0x726e,0x186));var _0xe726=function(_0x400504,_0x19f905){_0x400504=_0x400504-0x0;var _0x342b83=_0x726e[_0x400504];return _0x342b83;};'use strict';var Sequelize=require(_0xe726('0x0'));module['exports']={'name':{'type':Sequelize[_0xe726('0x1')],'allowNull':![],'unique':_0xe726('0x2')},'version':{'type':Sequelize[_0xe726('0x1')],'allowNull':![],'unique':_0xe726('0x2')},'main':{'type':Sequelize[_0xe726('0x1')],'defaultValue':'app.js'},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize[_0xe726('0x1')]},'type':{'type':Sequelize[_0xe726('0x1')]},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize[_0xe726('0x3')],'defaultValue':![]},'author':{'type':Sequelize[_0xe726('0x1')]},'logo':{'type':Sequelize[_0xe726('0x1')]},'state':{'type':Sequelize[_0xe726('0x1')],'unique':_0xe726('0x4')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize[_0xe726('0x1')]},'remoteUri':{'type':Sequelize[_0xe726('0x1')]},'link':{'type':Sequelize[_0xe726('0x1')],'defaultValue':'#'}}; \ No newline at end of file +var _0xf6a5=['state','sequelize','exports','STRING','unique_name_and_version','app.js','BOOLEAN'];(function(_0x5a19fc,_0x58f9f4){var _0x34b413=function(_0x344feb){while(--_0x344feb){_0x5a19fc['push'](_0x5a19fc['shift']());}};_0x34b413(++_0x58f9f4);}(_0xf6a5,0x16d));var _0x5f6a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf6a5[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x5f6a('0x0'));module[_0x5f6a('0x1')]={'name':{'type':Sequelize[_0x5f6a('0x2')],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x5f6a('0x3')},'main':{'type':Sequelize[_0x5f6a('0x2')],'defaultValue':_0x5f6a('0x4')},'filename':{'type':Sequelize[_0x5f6a('0x2')]},'path':{'type':Sequelize[_0x5f6a('0x2')]},'type':{'type':Sequelize[_0x5f6a('0x2')]},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize[_0x5f6a('0x5')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0x5f6a('0x2')]},'state':{'type':Sequelize[_0x5f6a('0x2')],'unique':_0x5f6a('0x6')},'description':{'type':Sequelize[_0x5f6a('0x2')]},'title':{'type':Sequelize[_0x5f6a('0x2')]},'remoteUri':{'type':Sequelize[_0x5f6a('0x2')]},'link':{'type':Sequelize[_0x5f6a('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 f7b8e40..3a92e9e 100644 --- a/server/api/integration/integration.controller.js +++ b/server/api/integration/integration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4975=['path','sox','to-csv','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','fieldName','type','keys','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','sort','pick','filter','where','map','VIRTUAL','options','Integration','count','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x1af358,_0x21a954){var _0x347a1b=function(_0x111a43){while(--_0x111a43){_0x1af358['push'](_0x1af358['shift']());}};_0x347a1b(++_0x21a954);}(_0x4975,0x86));var _0x5497=function(_0x14c90f,_0x29e9c2){_0x14c90f=_0x14c90f-0x0;var _0x315b98=_0x4975[_0x14c90f];return _0x315b98;};'use strict';var emlformat=require(_0x5497('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5497('0x1'));var jsonpatch=require(_0x5497('0x2'));var rp=require(_0x5497('0x3'));var moment=require(_0x5497('0x4'));var BPromise=require(_0x5497('0x5'));var Mustache=require(_0x5497('0x6'));var util=require(_0x5497('0x7'));var path=require(_0x5497('0x8'));var sox=require(_0x5497('0x9'));var csv=require(_0x5497('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5497('0xb'));var _=require('lodash');var squel=require(_0x5497('0xc'));var crypto=require(_0x5497('0xd'));var jsforce=require(_0x5497('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5497('0xa'));var querystring=require('querystring');var Papa=require(_0x5497('0xf'));var Redis=require(_0x5497('0x10'));var authService=require(_0x5497('0x11'));var qs=require(_0x5497('0x12'));var as=require(_0x5497('0x13'));var hardwareService=require(_0x5497('0x14'));var logger=require(_0x5497('0x15'))(_0x5497('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5497('0x17'))['db'];function respondWithStatusCode(_0x1b23df,_0x1bb794){_0x1bb794=_0x1bb794||0xcc;return function(_0x984990){if(_0x984990){return _0x1b23df[_0x5497('0x18')](_0x1bb794);}return _0x1b23df[_0x5497('0x19')](_0x1bb794)[_0x5497('0x1a')]();};}function respondWithResult(_0xaca97d,_0x363a5b){_0x363a5b=_0x363a5b||0xc8;return function(_0x1a4c74){if(_0x1a4c74){return _0xaca97d['status'](_0x363a5b)[_0x5497('0x1b')](_0x1a4c74);}};}function respondWithFilteredResult(_0x4fb8e9,_0x4237a9){return function(_0x2bfd8a){if(_0x2bfd8a){var _0x19e5f3=typeof _0x4237a9[_0x5497('0x1c')]===_0x5497('0x1d')&&typeof _0x4237a9[_0x5497('0x1e')]===_0x5497('0x1d');var _0x575f6b=_0x2bfd8a['count'];var _0x3f4d20=_0x19e5f3?0x0:_0x4237a9[_0x5497('0x1c')];var _0x3a47fd=_0x19e5f3?_0x2bfd8a['count']:_0x4237a9[_0x5497('0x1c')]+_0x4237a9[_0x5497('0x1e')];var _0x18e8a8;if(_0x3a47fd>=_0x575f6b){_0x3a47fd=_0x575f6b;_0x18e8a8=0xc8;}else{_0x18e8a8=0xce;}_0x4fb8e9[_0x5497('0x19')](_0x18e8a8);return _0x4fb8e9[_0x5497('0x1f')](_0x5497('0x20'),_0x3f4d20+'-'+_0x3a47fd+'/'+_0x575f6b)[_0x5497('0x1b')](_0x2bfd8a);}return null;};}function patchUpdates(_0x10226f){return function(_0x2e3960){try{jsonpatch[_0x5497('0x21')](_0x2e3960,_0x10226f,!![]);}catch(_0x186065){return BPromise['reject'](_0x186065);}return _0x2e3960[_0x5497('0x22')]();};}function saveUpdates(_0x4d1b27,_0x19200a){return function(_0xd0868d){if(_0xd0868d){return _0xd0868d[_0x5497('0x23')](_0x4d1b27)[_0x5497('0x24')](function(_0x35ecd9){return _0x35ecd9;});}return null;};}function removeEntity(_0x3b2fbc,_0x5018fa){return function(_0x54043a){if(_0x54043a){return _0x54043a[_0x5497('0x25')]()[_0x5497('0x24')](function(){_0x3b2fbc[_0x5497('0x19')](0xcc)[_0x5497('0x1a')]();});}};}function handleEntityNotFound(_0x5223b5,_0x13b7a4){return function(_0x57268c){if(!_0x57268c){_0x5223b5[_0x5497('0x18')](0x194);}return _0x57268c;};}function handleError(_0x16a2b4,_0x429d36){_0x429d36=_0x429d36||0x1f4;return function(_0x34a1a5){logger[_0x5497('0x26')](_0x34a1a5[_0x5497('0x27')]);if(_0x34a1a5['name']){delete _0x34a1a5[_0x5497('0x28')];}_0x16a2b4['status'](_0x429d36)['send'](_0x34a1a5);};}exports['index']=function(_0x39a2b7,_0x48d146){var _0x5e9356={},_0xc3465={},_0xb14593={'count':0x0,'rows':[]};var _0x1cf908=_['map'](db['Integration']['rawAttributes'],function(_0x371874){return{'name':_0x371874[_0x5497('0x29')],'type':_0x371874[_0x5497('0x2a')]['key']};});_0xc3465['model']=_['map'](_0x1cf908,_0x5497('0x28'));_0xc3465['query']=_[_0x5497('0x2b')](_0x39a2b7[_0x5497('0x2c')]);_0xc3465[_0x5497('0x2d')]=_['intersection'](_0xc3465[_0x5497('0x2e')],_0xc3465[_0x5497('0x2c')]);_0x5e9356['attributes']=_[_0x5497('0x2f')](_0xc3465[_0x5497('0x2e')],qs[_0x5497('0x30')](_0x39a2b7['query'][_0x5497('0x30')]));_0x5e9356[_0x5497('0x31')]=_0x5e9356[_0x5497('0x31')][_0x5497('0x32')]?_0x5e9356[_0x5497('0x31')]:_0xc3465['model'];if(!_0x39a2b7[_0x5497('0x2c')][_0x5497('0x33')]('nolimit')){_0x5e9356[_0x5497('0x1e')]=qs[_0x5497('0x1e')](_0x39a2b7[_0x5497('0x2c')][_0x5497('0x1e')]);_0x5e9356[_0x5497('0x1c')]=qs[_0x5497('0x1c')](_0x39a2b7['query'][_0x5497('0x1c')]);}_0x5e9356['order']=qs[_0x5497('0x34')](_0x39a2b7[_0x5497('0x2c')][_0x5497('0x34')]);_0x5e9356['where']=qs['filters'](_[_0x5497('0x35')](_0x39a2b7[_0x5497('0x2c')],_0xc3465[_0x5497('0x2d')]),_0x1cf908);if(_0x39a2b7[_0x5497('0x2c')][_0x5497('0x36')]){_0x5e9356[_0x5497('0x37')]=_['merge'](_0x5e9356[_0x5497('0x37')],{'$or':_[_0x5497('0x38')](_0x1cf908,function(_0x3de8fe){if(_0x3de8fe[_0x5497('0x2a')]!==_0x5497('0x39')){var _0x468902={};_0x468902[_0x3de8fe[_0x5497('0x28')]]={'$like':'%'+_0x39a2b7[_0x5497('0x2c')][_0x5497('0x36')]+'%'};return _0x468902;}})});}_0x5e9356=_['merge']({},_0x5e9356,_0x39a2b7[_0x5497('0x3a')]);var _0x32fa2b={'where':_0x5e9356[_0x5497('0x37')]};return db[_0x5497('0x3b')][_0x5497('0x3c')](_0x32fa2b)[_0x5497('0x24')](function(_0x4299be){_0xb14593['count']=_0x4299be;if(_0x39a2b7[_0x5497('0x2c')][_0x5497('0x3d')]){_0x5e9356[_0x5497('0x3e')]=[{'all':!![]}];}return db[_0x5497('0x3b')][_0x5497('0x3f')](_0x5e9356);})[_0x5497('0x24')](function(_0x114471){_0xb14593['rows']=_0x114471;return _0xb14593;})[_0x5497('0x24')](respondWithFilteredResult(_0x48d146,_0x5e9356))[_0x5497('0x40')](handleError(_0x48d146,null));};exports[_0x5497('0x41')]=function(_0x1e6389,_0x20e947){var _0xd90608={'raw':![],'where':{'id':_0x1e6389[_0x5497('0x42')]['id']}},_0xc1a999={};_0xc1a999[_0x5497('0x2e')]=_[_0x5497('0x2b')](db['Integration'][_0x5497('0x43')]);_0xc1a999['query']=_[_0x5497('0x2b')](_0x1e6389[_0x5497('0x2c')]);_0xc1a999[_0x5497('0x2d')]=_[_0x5497('0x2f')](_0xc1a999[_0x5497('0x2e')],_0xc1a999['query']);_0xd90608[_0x5497('0x31')]=_[_0x5497('0x2f')](_0xc1a999['model'],qs[_0x5497('0x30')](_0x1e6389['query'][_0x5497('0x30')]));_0xd90608['attributes']=_0xd90608[_0x5497('0x31')][_0x5497('0x32')]?_0xd90608[_0x5497('0x31')]:_0xc1a999[_0x5497('0x2e')];if(_0x1e6389[_0x5497('0x2c')]['includeAll']){_0xd90608['include']=[{'all':!![]}];}_0xd90608=_['merge']({},_0xd90608,_0x1e6389['options']);return db[_0x5497('0x3b')][_0x5497('0x44')](_0xd90608)[_0x5497('0x24')](handleEntityNotFound(_0x20e947,null))[_0x5497('0x24')](respondWithResult(_0x20e947,null))[_0x5497('0x40')](handleError(_0x20e947,null));};exports[_0x5497('0x45')]=function(_0xc78abe,_0x466287){return db[_0x5497('0x3b')]['create'](_0xc78abe[_0x5497('0x46')],{})[_0x5497('0x24')](respondWithResult(_0x466287,0xc9))[_0x5497('0x40')](handleError(_0x466287,null));};exports['update']=function(_0x3e4da2,_0x530475){if(_0x3e4da2[_0x5497('0x46')]['id']){delete _0x3e4da2[_0x5497('0x46')]['id'];}return db[_0x5497('0x3b')]['find']({'where':{'id':_0x3e4da2[_0x5497('0x42')]['id']}})[_0x5497('0x24')](handleEntityNotFound(_0x530475,null))['then'](saveUpdates(_0x3e4da2[_0x5497('0x46')],null))['then'](respondWithResult(_0x530475,null))[_0x5497('0x40')](handleError(_0x530475,null));};exports['destroy']=function(_0x416f76,_0x400860){return db[_0x5497('0x3b')][_0x5497('0x44')]({'where':{'id':_0x416f76[_0x5497('0x42')]['id']}})[_0x5497('0x24')](handleEntityNotFound(_0x400860,null))[_0x5497('0x24')](removeEntity(_0x400860,null))[_0x5497('0x40')](handleError(_0x400860,null));}; \ No newline at end of file +var _0x33af=['merge','VIRTUAL','filter','includeAll','findAll','rows','catch','show','params','length','include','create','body','find','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','Integration','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','order','sort','where'];(function(_0x23c352,_0x45b76e){var _0x5bb9a0=function(_0x313e00){while(--_0x313e00){_0x23c352['push'](_0x23c352['shift']());}};_0x5bb9a0(++_0x45b76e);}(_0x33af,0xec));var _0xf33a=function(_0x38550,_0x1e36a6){_0x38550=_0x38550-0x0;var _0x556e2c=_0x33af[_0x38550];return _0x556e2c;};'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['Integration'][_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));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index dcab5d6..ffa3cb6 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 _0x6c9f=['util','../../config/logger','api','moment','request-promise','path','../../config/environment','exports','Integration','lodash'];(function(_0x321728,_0x1fbc48){var _0x211876=function(_0x5bf9fc){while(--_0x5bf9fc){_0x321728['push'](_0x321728['shift']());}};_0x211876(++_0x1fbc48);}(_0x6c9f,0x6d));var _0xf6c9=function(_0x320ad3,_0x3a773f){_0x320ad3=_0x320ad3-0x0;var _0x5e7937=_0x6c9f[_0x320ad3];return _0x5e7937;};'use strict';var _=require(_0xf6c9('0x0'));var util=require(_0xf6c9('0x1'));var logger=require(_0xf6c9('0x2'))(_0xf6c9('0x3'));var moment=require(_0xf6c9('0x4'));var BPromise=require('bluebird');var rp=require(_0xf6c9('0x5'));var fs=require('fs');var path=require(_0xf6c9('0x6'));var rimraf=require('rimraf');var config=require(_0xf6c9('0x7'));var attributes=require('./integration.attributes');module[_0xf6c9('0x8')]=function(_0x5d1e37,_0x445a0a){return _0x5d1e37['define'](_0xf6c9('0x9'),attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe854=['./integration.attributes','define','Integration','integrations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment'];(function(_0x3f1710,_0x3877a2){var _0x528458=function(_0x4b5d0f){while(--_0x4b5d0f){_0x3f1710['push'](_0x3f1710['shift']());}};_0x528458(++_0x3877a2);}(_0xe854,0x7c));var _0x4e85=function(_0x594e88,_0x442655){_0x594e88=_0x594e88-0x0;var _0x518fa8=_0xe854[_0x594e88];return _0x518fa8;};'use strict';var _=require(_0x4e85('0x0'));var util=require(_0x4e85('0x1'));var logger=require(_0x4e85('0x2'))(_0x4e85('0x3'));var moment=require(_0x4e85('0x4'));var BPromise=require(_0x4e85('0x5'));var rp=require(_0x4e85('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4e85('0x7'));var attributes=require(_0x4e85('0x8'));module['exports']=function(_0x503c47,_0x2813b9){return _0x503c47[_0x4e85('0x9')](_0x4e85('0xa'),attributes,{'tableName':_0x4e85('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 fd95999..88a832f 100644 --- a/server/api/integration/integration.rpc.js +++ b/server/api/integration/integration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','Integration,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x16f21c,_0x416fcf){var _0x14778c=function(_0xf02f21){while(--_0xf02f21){_0x16f21c['push'](_0x16f21c['shift']());}};_0x14778c(++_0x416fcf);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4684f9,_0x13deb3){_0x4684f9=_0x4684f9-0x0;var _0xd9a033=_0x5f2f[_0x4684f9];return _0xd9a033;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('Integration,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file +var _0x896e=['Integration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x4b7a68,_0x2d75b8){var _0x192677=function(_0x593a12){while(--_0x593a12){_0x4b7a68['push'](_0x4b7a68['shift']());}};_0x192677(++_0x2d75b8);}(_0x896e,0x1e9));var _0xe896=function(_0x143aa0,_0x4da8b5){_0x143aa0=_0x143aa0-0x0;var _0x35cc4c=_0x896e[_0x143aa0];return _0x35cc4c;};'use strict';var _=require(_0xe896('0x0'));var util=require(_0xe896('0x1'));var moment=require(_0xe896('0x2'));var BPromise=require(_0xe896('0x3'));var rs=require(_0xe896('0x4'));var fs=require('fs');var Redis=require(_0xe896('0x5'));var db=require(_0xe896('0x6'))['db'];var utils=require(_0xe896('0x7'));var logger=require(_0xe896('0x8'))(_0xe896('0x9'));var config=require(_0xe896('0xa'));var jayson=require(_0xe896('0xb'));var client=jayson['client'][_0xe896('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x7a0721,_0x3b902c,_0x264eeb){return new BPromise(function(_0x43c619,_0x5a1909){return client[_0xe896('0xd')](_0x7a0721,_0x264eeb)[_0xe896('0xe')](function(_0x37a90d){logger['info'](_0xe896('0xf'),_0x3b902c,'request\x20sent');logger[_0xe896('0x10')]('Integration,\x20%s,\x20%s,\x20%s',_0x3b902c,_0xe896('0x11'),JSON[_0xe896('0x12')](_0x37a90d));if(_0x37a90d[_0xe896('0x13')]){if(_0x37a90d['error'][_0xe896('0x14')]===0x1f4){logger[_0xe896('0x13')](_0xe896('0xf'),_0x3b902c,_0x37a90d['error'][_0xe896('0x15')]);return _0x5a1909(_0x37a90d[_0xe896('0x13')][_0xe896('0x15')]);}logger['error'](_0xe896('0xf'),_0x3b902c,_0x37a90d[_0xe896('0x13')][_0xe896('0x15')]);return _0x43c619(_0x37a90d['error']['message']);}else{logger[_0xe896('0x16')](_0xe896('0xf'),_0x3b902c,'request\x20sent');_0x43c619(_0x37a90d['result'][_0xe896('0x15')]);}})[_0xe896('0x17')](function(_0x57f04b){logger[_0xe896('0x13')]('Integration,\x20%s,\x20%s',_0x3b902c,_0x57f04b);_0x5a1909(_0x57f04b);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 8ff257e..a51c7f3 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 _0x187d=['/:id','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./integrationReport.controller','isAuthenticated','index','get','/describe','describe'];(function(_0x15e024,_0x552471){var _0x5747d5=function(_0x596a5d){while(--_0x596a5d){_0x15e024['push'](_0x15e024['shift']());}};_0x5747d5(++_0x552471);}(_0x187d,0x93));var _0xd187=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0x187d[_0x220dbb];return _0x2b77de;};'use strict';var multer=require(_0xd187('0x0'));var util=require('util');var path=require(_0xd187('0x1'));var timeout=require(_0xd187('0x2'));var express=require(_0xd187('0x3'));var router=express[_0xd187('0x4')]();var fs_extra=require(_0xd187('0x5'));var auth=require(_0xd187('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd187('0x7'));var controller=require(_0xd187('0x8'));router['get']('/',auth[_0xd187('0x9')](),controller[_0xd187('0xa')]);router[_0xd187('0xb')](_0xd187('0xc'),auth[_0xd187('0x9')](),controller[_0xd187('0xd')]);router[_0xd187('0xb')](_0xd187('0xe'),auth['isAuthenticated'](),controller[_0xd187('0xf')]);router[_0xd187('0x10')]('/',auth[_0xd187('0x9')](),controller[_0xd187('0x11')]);router[_0xd187('0x12')](_0xd187('0xe'),auth['isAuthenticated'](),controller[_0xd187('0x13')]);router[_0xd187('0x14')](_0xd187('0xe'),auth['isAuthenticated'](),controller[_0xd187('0x15')]);module[_0xd187('0x16')]=router; \ No newline at end of file +var _0xe2fe=['describe','/:id','post','update','destroy','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe'];(function(_0x53f37f,_0xfb0b18){var _0x2fe5f8=function(_0x76ef2d){while(--_0x76ef2d){_0x53f37f['push'](_0x53f37f['shift']());}};_0x2fe5f8(++_0xfb0b18);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xee2f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xee2f('0x1'));var express=require('express');var router=express[_0xee2f('0x2')]();var fs_extra=require(_0xee2f('0x3'));var auth=require(_0xee2f('0x4'));var interaction=require(_0xee2f('0x5'));var config=require(_0xee2f('0x6'));var controller=require('./integrationReport.controller');router[_0xee2f('0x7')]('/',auth[_0xee2f('0x8')](),controller['index']);router[_0xee2f('0x7')](_0xee2f('0x9'),auth['isAuthenticated'](),controller[_0xee2f('0xa')]);router['get'](_0xee2f('0xb'),auth[_0xee2f('0x8')](),controller['show']);router[_0xee2f('0xc')]('/',auth[_0xee2f('0x8')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0xee2f('0xd')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xee2f('0xe')]);module[_0xee2f('0xf')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 4cebf6d..4eb5994 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 _0xdf07=['TEXT','ENUM','FAILED','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN'];(function(_0x172747,_0x1732bd){var _0x509692=function(_0x448c56){while(--_0x448c56){_0x172747['push'](_0x172747['shift']());}};_0x509692(++_0x1732bd);}(_0xdf07,0x1f2));var _0x7df0=function(_0x1aa70d,_0x485346){_0x1aa70d=_0x1aa70d-0x0;var _0x2bc7b9=_0xdf07[_0x1aa70d];return _0x2bc7b9;};'use strict';var Sequelize=require(_0x7df0('0x0'));module[_0x7df0('0x1')]={'integration':{'type':Sequelize[_0x7df0('0x2')]},'eventChannel':{'type':Sequelize[_0x7df0('0x2')]},'exitStatus':{'type':Sequelize[_0x7df0('0x2')]},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize[_0x7df0('0x3')]},'contacts':{'type':Sequelize[_0x7df0('0x2')]},'uniqueid':{'type':Sequelize[_0x7df0('0x2')]},'calleridnum':{'type':Sequelize[_0x7df0('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x7df0('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x7df0('0x2')]},'agentcalledAt':{'type':Sequelize[_0x7df0('0x4')]},'agentconnectAt':{'type':Sequelize[_0x7df0('0x4')]},'holdtime':{'type':Sequelize[_0x7df0('0x3')]},'agentcomplete':{'type':Sequelize[_0x7df0('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x7df0('0x4')]},'talktime':{'type':Sequelize[_0x7df0('0x3')]},'agentacw':{'type':Sequelize[_0x7df0('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x7df0('0x3')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize[_0x7df0('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x7df0('0x4')]},'agentdump':{'type':Sequelize[_0x7df0('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x7df0('0x4')]},'lastevent':{'type':Sequelize[_0x7df0('0x2')]},'channel':{'type':Sequelize[_0x7df0('0x2')]},'channelstate':{'type':Sequelize[_0x7df0('0x3')]},'channelstatedesc':{'type':Sequelize[_0x7df0('0x2')]},'connectedlinenum':{'type':Sequelize[_0x7df0('0x2')]},'connectedlinename':{'type':Sequelize[_0x7df0('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x7df0('0x2')]},'context':{'type':Sequelize[_0x7df0('0x2')]},'exten':{'type':Sequelize[_0x7df0('0x2')]},'priority':{'type':Sequelize[_0x7df0('0x2')]},'destchannel':{'type':Sequelize[_0x7df0('0x2')]},'destchannelstate':{'type':Sequelize[_0x7df0('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x7df0('0x2')]},'destcalleridnum':{'type':Sequelize[_0x7df0('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x7df0('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x7df0('0x2')]},'destcontext':{'type':Sequelize[_0x7df0('0x2')]},'destexten':{'type':Sequelize[_0x7df0('0x2')]},'destpriority':{'type':Sequelize[_0x7df0('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0x7df0('0x2')]},'inReplyTo':{'type':Sequelize[_0x7df0('0x2')]},'subject':{'type':Sequelize[_0x7df0('0x2')]},'from':{'type':Sequelize[_0x7df0('0x2')]},'to':{'type':Sequelize[_0x7df0('0x2')]},'cc':{'type':Sequelize[_0x7df0('0x2')]},'attachment':{'type':Sequelize[_0x7df0('0x6')]},'html':{'type':Sequelize[_0x7df0('0x6')]},'text':{'type':Sequelize[_0x7df0('0x6')]},'status':{'type':Sequelize[_0x7df0('0x7')]('SENT','SENDING','RECEIVED',_0x7df0('0x8'))},'url':{'type':Sequelize[_0x7df0('0x2')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0x7df0('0x2')]},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x5fe6=['BOOLEAN','TEXT','ENUM','SENT','SENDING','sequelize','exports','STRING','INTEGER','DATE'];(function(_0xd09668,_0x1435b2){var _0x68726=function(_0x54a030){while(--_0x54a030){_0xd09668['push'](_0xd09668['shift']());}};_0x68726(++_0x1435b2);}(_0x5fe6,0xb9));var _0x65fe=function(_0x158d59,_0x1c54e3){_0x158d59=_0x158d59-0x0;var _0x5ab83b=_0x5fe6[_0x158d59];return _0x5ab83b;};'use strict';var Sequelize=require(_0x65fe('0x0'));module[_0x65fe('0x1')]={'integration':{'type':Sequelize[_0x65fe('0x2')]},'eventChannel':{'type':Sequelize[_0x65fe('0x2')]},'exitStatus':{'type':Sequelize[_0x65fe('0x2')]},'ticketId':{'type':Sequelize[_0x65fe('0x2')]},'integrationId':{'type':Sequelize[_0x65fe('0x3')]},'contacts':{'type':Sequelize[_0x65fe('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x65fe('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x65fe('0x2')]},'interface':{'type':Sequelize[_0x65fe('0x2')]},'membername':{'type':Sequelize[_0x65fe('0x2')]},'agentcalledAt':{'type':Sequelize[_0x65fe('0x4')]},'agentconnectAt':{'type':Sequelize[_0x65fe('0x4')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x65fe('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x65fe('0x4')]},'talktime':{'type':Sequelize[_0x65fe('0x3')]},'agentacw':{'type':Sequelize[_0x65fe('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x65fe('0x3')]},'reason':{'type':Sequelize[_0x65fe('0x2')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x65fe('0x4')]},'agentdump':{'type':Sequelize[_0x65fe('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x65fe('0x4')]},'lastevent':{'type':Sequelize[_0x65fe('0x2')]},'channel':{'type':Sequelize[_0x65fe('0x2')]},'channelstate':{'type':Sequelize[_0x65fe('0x3')]},'channelstatedesc':{'type':Sequelize[_0x65fe('0x2')]},'connectedlinenum':{'type':Sequelize[_0x65fe('0x2')]},'connectedlinename':{'type':Sequelize[_0x65fe('0x2')]},'language':{'type':Sequelize[_0x65fe('0x2')]},'accountcode':{'type':Sequelize[_0x65fe('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x65fe('0x2')]},'priority':{'type':Sequelize[_0x65fe('0x2')]},'destchannel':{'type':Sequelize[_0x65fe('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x65fe('0x2')]},'destcalleridnum':{'type':Sequelize[_0x65fe('0x2')]},'destcalleridname':{'type':Sequelize[_0x65fe('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x65fe('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x65fe('0x2')]},'destlanguage':{'type':Sequelize[_0x65fe('0x2')]},'destaccountcode':{'type':Sequelize[_0x65fe('0x2')]},'destcontext':{'type':Sequelize[_0x65fe('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x65fe('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0x65fe('0x2')]},'inReplyTo':{'type':Sequelize[_0x65fe('0x2')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize[_0x65fe('0x2')]},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x65fe('0x2')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0x65fe('0x6')]},'text':{'type':Sequelize[_0x65fe('0x6')]},'status':{'type':Sequelize[_0x65fe('0x7')](_0x65fe('0x8'),_0x65fe('0x9'),'RECEIVED','FAILED')},'url':{'type':Sequelize[_0x65fe('0x2')]},'app':{'type':Sequelize[_0x65fe('0x2')]},'appdata':{'type':Sequelize[_0x65fe('0x2')]},'projectId':{'type':Sequelize[_0x65fe('0x3')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index c7245f8..a5e8777 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 _0x855b=['destroy','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../config/license/hardware','api','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','apply','reject','update','then','stack','name','send','map','IntegrationReport','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','length','options','find','catch','create','body'];(function(_0xd92a00,_0x3cadb5){var _0x22aff5=function(_0x56d6df){while(--_0x56d6df){_0xd92a00['push'](_0xd92a00['shift']());}};_0x22aff5(++_0x3cadb5);}(_0x855b,0x92));var _0xb855=function(_0x3cf8e8,_0x4f393c){_0x3cf8e8=_0x3cf8e8-0x0;var _0x201110=_0x855b[_0x3cf8e8];return _0x201110;};'use strict';var emlformat=require(_0xb855('0x0'));var rimraf=require(_0xb855('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb855('0x2'));var rp=require('request-promise');var moment=require(_0xb855('0x3'));var BPromise=require(_0xb855('0x4'));var Mustache=require(_0xb855('0x5'));var util=require(_0xb855('0x6'));var path=require('path');var sox=require(_0xb855('0x7'));var csv=require(_0xb855('0x8'));var ejs=require(_0xb855('0x9'));var fs=require('fs');var fs_extra=require(_0xb855('0xa'));var _=require(_0xb855('0xb'));var squel=require(_0xb855('0xc'));var crypto=require(_0xb855('0xd'));var jsforce=require(_0xb855('0xe'));var deskjs=require(_0xb855('0xf'));var toCsv=require(_0xb855('0x8'));var querystring=require(_0xb855('0x10'));var Papa=require(_0xb855('0x11'));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(_0xb855('0x12'));var logger=require('../../config/logger')(_0xb855('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb855('0x14'));var db=require(_0xb855('0x15'))['db'];function respondWithStatusCode(_0x611e96,_0x2b26ff){_0x2b26ff=_0x2b26ff||0xcc;return function(_0x5573ba){if(_0x5573ba){return _0x611e96['sendStatus'](_0x2b26ff);}return _0x611e96[_0xb855('0x16')](_0x2b26ff)[_0xb855('0x17')]();};}function respondWithResult(_0x4f46aa,_0x57bad0){_0x57bad0=_0x57bad0||0xc8;return function(_0x332f53){if(_0x332f53){return _0x4f46aa['status'](_0x57bad0)[_0xb855('0x18')](_0x332f53);}};}function respondWithFilteredResult(_0xc92e43,_0x2d573a){return function(_0xd12eaa){if(_0xd12eaa){var _0x2a1159=typeof _0x2d573a['offset']===_0xb855('0x19')&&typeof _0x2d573a[_0xb855('0x1a')]==='undefined';var _0x1b9ed6=_0xd12eaa[_0xb855('0x1b')];var _0x1a34e3=_0x2a1159?0x0:_0x2d573a[_0xb855('0x1c')];var _0x5432a3=_0x2a1159?_0xd12eaa[_0xb855('0x1b')]:_0x2d573a[_0xb855('0x1c')]+_0x2d573a['limit'];var _0x72a2f7;if(_0x5432a3>=_0x1b9ed6){_0x5432a3=_0x1b9ed6;_0x72a2f7=0xc8;}else{_0x72a2f7=0xce;}_0xc92e43[_0xb855('0x16')](_0x72a2f7);return _0xc92e43[_0xb855('0x1d')]('Content-Range',_0x1a34e3+'-'+_0x5432a3+'/'+_0x1b9ed6)[_0xb855('0x18')](_0xd12eaa);}return null;};}function patchUpdates(_0x14c498){return function(_0x41e79b){try{jsonpatch[_0xb855('0x1e')](_0x41e79b,_0x14c498,!![]);}catch(_0x29b56c){return BPromise[_0xb855('0x1f')](_0x29b56c);}return _0x41e79b['save']();};}function saveUpdates(_0x9a8d2b,_0x374130){return function(_0x1f3905){if(_0x1f3905){return _0x1f3905[_0xb855('0x20')](_0x9a8d2b)[_0xb855('0x21')](function(_0x330a59){return _0x330a59;});}return null;};}function removeEntity(_0x2df3de,_0xddd4ac){return function(_0x35b4fa){if(_0x35b4fa){return _0x35b4fa['destroy']()['then'](function(){_0x2df3de[_0xb855('0x16')](0xcc)[_0xb855('0x17')]();});}};}function handleEntityNotFound(_0x48e9b7,_0x5352fc){return function(_0x1ce331){if(!_0x1ce331){_0x48e9b7['sendStatus'](0x194);}return _0x1ce331;};}function handleError(_0x3f3a6c,_0x53ec59){_0x53ec59=_0x53ec59||0x1f4;return function(_0x3f6914){logger['error'](_0x3f6914[_0xb855('0x22')]);if(_0x3f6914[_0xb855('0x23')]){delete _0x3f6914[_0xb855('0x23')];}_0x3f3a6c['status'](_0x53ec59)[_0xb855('0x24')](_0x3f6914);};}exports['index']=function(_0x3cdeb0,_0x53711d){var _0xf178bb={},_0x54606b={},_0xc40ec9={'count':0x0,'rows':[]};var _0x3c23a9=_[_0xb855('0x25')](db[_0xb855('0x26')][_0xb855('0x27')],function(_0x113b22){return{'name':_0x113b22[_0xb855('0x28')],'type':_0x113b22[_0xb855('0x29')]['key']};});_0x54606b['model']=_[_0xb855('0x25')](_0x3c23a9,_0xb855('0x23'));_0x54606b[_0xb855('0x2a')]=_[_0xb855('0x2b')](_0x3cdeb0[_0xb855('0x2a')]);_0x54606b[_0xb855('0x2c')]=_[_0xb855('0x2d')](_0x54606b[_0xb855('0x2e')],_0x54606b['query']);_0xf178bb['attributes']=_[_0xb855('0x2d')](_0x54606b[_0xb855('0x2e')],qs[_0xb855('0x2f')](_0x3cdeb0[_0xb855('0x2a')][_0xb855('0x2f')]));_0xf178bb['attributes']=_0xf178bb['attributes']['length']?_0xf178bb[_0xb855('0x30')]:_0x54606b[_0xb855('0x2e')];if(!_0x3cdeb0[_0xb855('0x2a')][_0xb855('0x31')](_0xb855('0x32'))){_0xf178bb[_0xb855('0x1a')]=qs[_0xb855('0x1a')](_0x3cdeb0[_0xb855('0x2a')]['limit']);_0xf178bb[_0xb855('0x1c')]=qs['offset'](_0x3cdeb0['query'][_0xb855('0x1c')]);}_0xf178bb[_0xb855('0x33')]=qs[_0xb855('0x34')](_0x3cdeb0[_0xb855('0x2a')]['sort']);_0xf178bb[_0xb855('0x35')]=qs['filters'](_[_0xb855('0x36')](_0x3cdeb0['query'],_0x54606b['filters']),_0x3c23a9);if(_0x3cdeb0['query'][_0xb855('0x37')]){_0xf178bb[_0xb855('0x35')]=_[_0xb855('0x38')](_0xf178bb[_0xb855('0x35')],{'$or':_[_0xb855('0x25')](_0x3c23a9,function(_0x5f3de0){if(_0x5f3de0[_0xb855('0x29')]!==_0xb855('0x39')){var _0x2897a5={};_0x2897a5[_0x5f3de0[_0xb855('0x23')]]={'$like':'%'+_0x3cdeb0['query'][_0xb855('0x37')]+'%'};return _0x2897a5;}})});}_0xf178bb=_['merge']({},_0xf178bb,_0x3cdeb0['options']);var _0x6194fe={'where':_0xf178bb[_0xb855('0x35')]};return db['IntegrationReport'][_0xb855('0x1b')](_0x6194fe)[_0xb855('0x21')](function(_0x2b88ac){_0xc40ec9[_0xb855('0x1b')]=_0x2b88ac;if(_0x3cdeb0[_0xb855('0x2a')][_0xb855('0x3a')]){_0xf178bb[_0xb855('0x3b')]=[{'all':!![]}];}return db[_0xb855('0x26')][_0xb855('0x3c')](_0xf178bb);})[_0xb855('0x21')](function(_0x2ab64a){_0xc40ec9[_0xb855('0x3d')]=_0x2ab64a;return _0xc40ec9;})[_0xb855('0x21')](respondWithFilteredResult(_0x53711d,_0xf178bb))['catch'](handleError(_0x53711d,null));};exports[_0xb855('0x3e')]=function(_0x5415ee,_0x1618c7){var _0x2dee52={'raw':![],'where':{'id':_0x5415ee[_0xb855('0x3f')]['id']}},_0x4610ae={};_0x4610ae['model']=_[_0xb855('0x2b')](db[_0xb855('0x26')][_0xb855('0x27')]);_0x4610ae['query']=_[_0xb855('0x2b')](_0x5415ee['query']);_0x4610ae[_0xb855('0x2c')]=_[_0xb855('0x2d')](_0x4610ae[_0xb855('0x2e')],_0x4610ae[_0xb855('0x2a')]);_0x2dee52[_0xb855('0x30')]=_[_0xb855('0x2d')](_0x4610ae[_0xb855('0x2e')],qs['fields'](_0x5415ee[_0xb855('0x2a')][_0xb855('0x2f')]));_0x2dee52['attributes']=_0x2dee52[_0xb855('0x30')][_0xb855('0x40')]?_0x2dee52[_0xb855('0x30')]:_0x4610ae['model'];if(_0x5415ee[_0xb855('0x2a')][_0xb855('0x3a')]){_0x2dee52[_0xb855('0x3b')]=[{'all':!![]}];}_0x2dee52=_[_0xb855('0x38')]({},_0x2dee52,_0x5415ee[_0xb855('0x41')]);return db[_0xb855('0x26')][_0xb855('0x42')](_0x2dee52)[_0xb855('0x21')](handleEntityNotFound(_0x1618c7,null))[_0xb855('0x21')](respondWithResult(_0x1618c7,null))[_0xb855('0x43')](handleError(_0x1618c7,null));};exports['create']=function(_0x1f5349,_0x3abc1d){return db[_0xb855('0x26')][_0xb855('0x44')](_0x1f5349[_0xb855('0x45')],{})[_0xb855('0x21')](respondWithResult(_0x3abc1d,0xc9))[_0xb855('0x43')](handleError(_0x3abc1d,null));};exports['update']=function(_0x2e3131,_0x260eb3){if(_0x2e3131[_0xb855('0x45')]['id']){delete _0x2e3131['body']['id'];}return db[_0xb855('0x26')][_0xb855('0x42')]({'where':{'id':_0x2e3131[_0xb855('0x3f')]['id']}})[_0xb855('0x21')](handleEntityNotFound(_0x260eb3,null))[_0xb855('0x21')](saveUpdates(_0x2e3131[_0xb855('0x45')],null))[_0xb855('0x21')](respondWithResult(_0x260eb3,null))['catch'](handleError(_0x260eb3,null));};exports[_0xb855('0x46')]=function(_0x4cda38,_0x4f6e78){return db[_0xb855('0x26')]['find']({'where':{'id':_0x4cda38[_0xb855('0x3f')]['id']}})[_0xb855('0x21')](handleEntityNotFound(_0x4f6e78,null))[_0xb855('0x21')](removeEntity(_0x4f6e78,null))['catch'](handleError(_0x4f6e78,null));};exports['describe']=function(_0x30cee5,_0x11f2b2){return db[_0xb855('0x26')][_0xb855('0x47')]()[_0xb855('0x21')](respondWithResult(_0x11f2b2,null))[_0xb855('0x43')](handleError(_0x11f2b2,null));}; \ No newline at end of file +var _0x96fd=['merge','options','include','findAll','rows','catch','show','params','keys','includeAll','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','count','set','Content-Range','reject','save','destroy','then','sendStatus','error','stack','name','send','index','map','IntegrationReport','rawAttributes','fieldName','key','model','query','attributes','intersection','fields','length','hasOwnProperty','sort','where','filters','VIRTUAL','filter'];(function(_0x4dbda8,_0xbce830){var _0x1149ed=function(_0x299a39){while(--_0x299a39){_0x4dbda8['push'](_0x4dbda8['shift']());}};_0x1149ed(++_0xbce830);}(_0x96fd,0x1d0));var _0xd96f=function(_0x4bf7d9,_0x56e614){_0x4bf7d9=_0x4bf7d9-0x0;var _0xa2ebf=_0x96fd[_0x4bf7d9];return _0xa2ebf;};'use strict';var emlformat=require(_0xd96f('0x0'));var rimraf=require(_0xd96f('0x1'));var zipdir=require(_0xd96f('0x2'));var jsonpatch=require(_0xd96f('0x3'));var rp=require('request-promise');var moment=require(_0xd96f('0x4'));var BPromise=require(_0xd96f('0x5'));var Mustache=require(_0xd96f('0x6'));var util=require('util');var path=require(_0xd96f('0x7'));var sox=require(_0xd96f('0x8'));var csv=require(_0xd96f('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd96f('0xa'));var squel=require(_0xd96f('0xb'));var crypto=require(_0xd96f('0xc'));var jsforce=require(_0xd96f('0xd'));var deskjs=require(_0xd96f('0xe'));var toCsv=require(_0xd96f('0x9'));var querystring=require(_0xd96f('0xf'));var Papa=require('papaparse');var Redis=require(_0xd96f('0x10'));var authService=require(_0xd96f('0x11'));var qs=require(_0xd96f('0x12'));var as=require(_0xd96f('0x13'));var hardwareService=require(_0xd96f('0x14'));var logger=require(_0xd96f('0x15'))('api');var utils=require(_0xd96f('0x16'));var config=require(_0xd96f('0x17'));var licenseUtil=require(_0xd96f('0x18'));var db=require(_0xd96f('0x19'))['db'];function respondWithStatusCode(_0x6c43f6,_0x3d5234){_0x3d5234=_0x3d5234||0xcc;return function(_0xdd0eeb){if(_0xdd0eeb){return _0x6c43f6['sendStatus'](_0x3d5234);}return _0x6c43f6[_0xd96f('0x1a')](_0x3d5234)[_0xd96f('0x1b')]();};}function respondWithResult(_0x17730c,_0x1a325a){_0x1a325a=_0x1a325a||0xc8;return function(_0x3e775d){if(_0x3e775d){return _0x17730c[_0xd96f('0x1a')](_0x1a325a)[_0xd96f('0x1c')](_0x3e775d);}};}function respondWithFilteredResult(_0x218896,_0xd1cdad){return function(_0x59ab16){if(_0x59ab16){var _0x4e6ced=typeof _0xd1cdad[_0xd96f('0x1d')]==='undefined'&&typeof _0xd1cdad[_0xd96f('0x1e')]==='undefined';var _0x18763c=_0x59ab16[_0xd96f('0x1f')];var _0x3b79d5=_0x4e6ced?0x0:_0xd1cdad['offset'];var _0x4d991f=_0x4e6ced?_0x59ab16['count']:_0xd1cdad[_0xd96f('0x1d')]+_0xd1cdad[_0xd96f('0x1e')];var _0xcd48b2;if(_0x4d991f>=_0x18763c){_0x4d991f=_0x18763c;_0xcd48b2=0xc8;}else{_0xcd48b2=0xce;}_0x218896[_0xd96f('0x1a')](_0xcd48b2);return _0x218896[_0xd96f('0x20')](_0xd96f('0x21'),_0x3b79d5+'-'+_0x4d991f+'/'+_0x18763c)[_0xd96f('0x1c')](_0x59ab16);}return null;};}function patchUpdates(_0xfa667b){return function(_0xd62952){try{jsonpatch['apply'](_0xd62952,_0xfa667b,!![]);}catch(_0x3c45f7){return BPromise[_0xd96f('0x22')](_0x3c45f7);}return _0xd62952[_0xd96f('0x23')]();};}function saveUpdates(_0x16e486,_0x2b1c1f){return function(_0x3c19bb){if(_0x3c19bb){return _0x3c19bb['update'](_0x16e486)['then'](function(_0x361403){return _0x361403;});}return null;};}function removeEntity(_0x313867,_0x55bb71){return function(_0x27ed84){if(_0x27ed84){return _0x27ed84[_0xd96f('0x24')]()[_0xd96f('0x25')](function(){_0x313867[_0xd96f('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45b7d3,_0x140c64){return function(_0x39a5fa){if(!_0x39a5fa){_0x45b7d3[_0xd96f('0x26')](0x194);}return _0x39a5fa;};}function handleError(_0x51ee20,_0x20cd6e){_0x20cd6e=_0x20cd6e||0x1f4;return function(_0x21065a){logger[_0xd96f('0x27')](_0x21065a[_0xd96f('0x28')]);if(_0x21065a['name']){delete _0x21065a[_0xd96f('0x29')];}_0x51ee20[_0xd96f('0x1a')](_0x20cd6e)[_0xd96f('0x2a')](_0x21065a);};}exports[_0xd96f('0x2b')]=function(_0x406ebc,_0x649695){var _0x36cbd4={},_0x9d035f={},_0x31b1da={'count':0x0,'rows':[]};var _0x48e47e=_[_0xd96f('0x2c')](db[_0xd96f('0x2d')][_0xd96f('0x2e')],function(_0x412ac9){return{'name':_0x412ac9[_0xd96f('0x2f')],'type':_0x412ac9['type'][_0xd96f('0x30')]};});_0x9d035f[_0xd96f('0x31')]=_[_0xd96f('0x2c')](_0x48e47e,_0xd96f('0x29'));_0x9d035f['query']=_['keys'](_0x406ebc[_0xd96f('0x32')]);_0x9d035f['filters']=_['intersection'](_0x9d035f[_0xd96f('0x31')],_0x9d035f[_0xd96f('0x32')]);_0x36cbd4[_0xd96f('0x33')]=_[_0xd96f('0x34')](_0x9d035f['model'],qs[_0xd96f('0x35')](_0x406ebc[_0xd96f('0x32')][_0xd96f('0x35')]));_0x36cbd4[_0xd96f('0x33')]=_0x36cbd4[_0xd96f('0x33')][_0xd96f('0x36')]?_0x36cbd4[_0xd96f('0x33')]:_0x9d035f[_0xd96f('0x31')];if(!_0x406ebc[_0xd96f('0x32')][_0xd96f('0x37')]('nolimit')){_0x36cbd4['limit']=qs[_0xd96f('0x1e')](_0x406ebc['query']['limit']);_0x36cbd4[_0xd96f('0x1d')]=qs[_0xd96f('0x1d')](_0x406ebc[_0xd96f('0x32')][_0xd96f('0x1d')]);}_0x36cbd4['order']=qs[_0xd96f('0x38')](_0x406ebc[_0xd96f('0x32')]['sort']);_0x36cbd4[_0xd96f('0x39')]=qs['filters'](_['pick'](_0x406ebc[_0xd96f('0x32')],_0x9d035f[_0xd96f('0x3a')]),_0x48e47e);if(_0x406ebc['query']['filter']){_0x36cbd4[_0xd96f('0x39')]=_['merge'](_0x36cbd4[_0xd96f('0x39')],{'$or':_['map'](_0x48e47e,function(_0x33fbe5){if(_0x33fbe5['type']!==_0xd96f('0x3b')){var _0x20f767={};_0x20f767[_0x33fbe5[_0xd96f('0x29')]]={'$like':'%'+_0x406ebc[_0xd96f('0x32')][_0xd96f('0x3c')]+'%'};return _0x20f767;}})});}_0x36cbd4=_[_0xd96f('0x3d')]({},_0x36cbd4,_0x406ebc[_0xd96f('0x3e')]);var _0x615dc7={'where':_0x36cbd4['where']};return db['IntegrationReport'][_0xd96f('0x1f')](_0x615dc7)[_0xd96f('0x25')](function(_0x2f2d85){_0x31b1da['count']=_0x2f2d85;if(_0x406ebc[_0xd96f('0x32')]['includeAll']){_0x36cbd4[_0xd96f('0x3f')]=[{'all':!![]}];}return db['IntegrationReport'][_0xd96f('0x40')](_0x36cbd4);})[_0xd96f('0x25')](function(_0x5d0524){_0x31b1da[_0xd96f('0x41')]=_0x5d0524;return _0x31b1da;})[_0xd96f('0x25')](respondWithFilteredResult(_0x649695,_0x36cbd4))[_0xd96f('0x42')](handleError(_0x649695,null));};exports[_0xd96f('0x43')]=function(_0x3dc601,_0x5efdb2){var _0x80feee={'raw':![],'where':{'id':_0x3dc601[_0xd96f('0x44')]['id']}},_0x1fcd58={};_0x1fcd58[_0xd96f('0x31')]=_[_0xd96f('0x45')](db[_0xd96f('0x2d')][_0xd96f('0x2e')]);_0x1fcd58[_0xd96f('0x32')]=_['keys'](_0x3dc601[_0xd96f('0x32')]);_0x1fcd58[_0xd96f('0x3a')]=_[_0xd96f('0x34')](_0x1fcd58['model'],_0x1fcd58['query']);_0x80feee[_0xd96f('0x33')]=_[_0xd96f('0x34')](_0x1fcd58[_0xd96f('0x31')],qs[_0xd96f('0x35')](_0x3dc601[_0xd96f('0x32')]['fields']));_0x80feee[_0xd96f('0x33')]=_0x80feee[_0xd96f('0x33')]['length']?_0x80feee[_0xd96f('0x33')]:_0x1fcd58[_0xd96f('0x31')];if(_0x3dc601[_0xd96f('0x32')][_0xd96f('0x46')]){_0x80feee['include']=[{'all':!![]}];}_0x80feee=_[_0xd96f('0x3d')]({},_0x80feee,_0x3dc601[_0xd96f('0x3e')]);return db[_0xd96f('0x2d')]['find'](_0x80feee)[_0xd96f('0x25')](handleEntityNotFound(_0x5efdb2,null))[_0xd96f('0x25')](respondWithResult(_0x5efdb2,null))[_0xd96f('0x42')](handleError(_0x5efdb2,null));};exports[_0xd96f('0x47')]=function(_0x178df1,_0x44acbe){return db[_0xd96f('0x2d')][_0xd96f('0x47')](_0x178df1[_0xd96f('0x48')],{})[_0xd96f('0x25')](respondWithResult(_0x44acbe,0xc9))[_0xd96f('0x42')](handleError(_0x44acbe,null));};exports['update']=function(_0x339741,_0x20bc7c){if(_0x339741[_0xd96f('0x48')]['id']){delete _0x339741[_0xd96f('0x48')]['id'];}return db[_0xd96f('0x2d')][_0xd96f('0x49')]({'where':{'id':_0x339741[_0xd96f('0x44')]['id']}})[_0xd96f('0x25')](handleEntityNotFound(_0x20bc7c,null))['then'](saveUpdates(_0x339741[_0xd96f('0x48')],null))['then'](respondWithResult(_0x20bc7c,null))[_0xd96f('0x42')](handleError(_0x20bc7c,null));};exports[_0xd96f('0x24')]=function(_0x46eeac,_0x1a4a8b){return db[_0xd96f('0x2d')][_0xd96f('0x49')]({'where':{'id':_0x46eeac[_0xd96f('0x44')]['id']}})[_0xd96f('0x25')](handleEntityNotFound(_0x1a4a8b,null))['then'](removeEntity(_0x1a4a8b,null))[_0xd96f('0x42')](handleError(_0x1a4a8b,null));};exports[_0xd96f('0x4a')]=function(_0x6dbd87,_0x181f47){return db[_0xd96f('0x2d')]['describe']()['then'](respondWithResult(_0x181f47,null))['catch'](handleError(_0x181f47,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 9690391..6d3065e 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 _0xe156=['lodash','../../config/logger','bluebird','path','rimraf','./integrationReport.attributes','define','IntegrationReport','report_integration'];(function(_0x3c5191,_0x2f6745){var _0x5415a7=function(_0x1d852d){while(--_0x1d852d){_0x3c5191['push'](_0x3c5191['shift']());}};_0x5415a7(++_0x2f6745);}(_0xe156,0x17a));var _0x6e15=function(_0x685346,_0x3ef2e5){_0x685346=_0x685346-0x0;var _0x52e15b=_0xe156[_0x685346];return _0x52e15b;};'use strict';var _=require(_0x6e15('0x0'));var util=require('util');var logger=require(_0x6e15('0x1'))('api');var moment=require('moment');var BPromise=require(_0x6e15('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6e15('0x3'));var rimraf=require(_0x6e15('0x4'));var config=require('../../config/environment');var attributes=require(_0x6e15('0x5'));module['exports']=function(_0x3a3524,_0x3aa0f9){return _0x3a3524[_0x6e15('0x6')](_0x6e15('0x7'),attributes,{'tableName':_0x6e15('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0a5e=['util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./integrationReport.attributes','define','IntegrationReport','report_integration','lodash'];(function(_0x30a204,_0x48370f){var _0x1a1350=function(_0x5844db){while(--_0x5844db){_0x30a204['push'](_0x30a204['shift']());}};_0x1a1350(++_0x48370f);}(_0x0a5e,0xb3));var _0xe0a5=function(_0x4093c5,_0x1143e4){_0x4093c5=_0x4093c5-0x0;var _0x35ee0d=_0x0a5e[_0x4093c5];return _0x35ee0d;};'use strict';var _=require(_0xe0a5('0x0'));var util=require(_0xe0a5('0x1'));var logger=require(_0xe0a5('0x2'))('api');var moment=require('moment');var BPromise=require(_0xe0a5('0x3'));var rp=require(_0xe0a5('0x4'));var fs=require('fs');var path=require(_0xe0a5('0x5'));var rimraf=require(_0xe0a5('0x6'));var config=require(_0xe0a5('0x7'));var attributes=require(_0xe0a5('0x8'));module['exports']=function(_0x445751,_0x4d889e){return _0x445751[_0xe0a5('0x9')](_0xe0a5('0xa'),attributes,{'tableName':_0xe0a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.rpc.js b/server/api/integrationReport/integrationReport.rpc.js index 3c124d3..4b183b8 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 _0x814b=['info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x59c301,_0x359c50){var _0x3866b9=function(_0x2d380e){while(--_0x2d380e){_0x59c301['push'](_0x59c301['shift']());}};_0x3866b9(++_0x359c50);}(_0x814b,0x1a2));var _0xb814=function(_0xe84805,_0x2702d9){_0xe84805=_0xe84805-0x0;var _0x398efd=_0x814b[_0xe84805];return _0x398efd;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var moment=require(_0xb814('0x2'));var BPromise=require(_0xb814('0x3'));var rs=require(_0xb814('0x4'));var fs=require('fs');var Redis=require(_0xb814('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb814('0x6'));var logger=require(_0xb814('0x7'))(_0xb814('0x8'));var config=require(_0xb814('0x9'));var jayson=require(_0xb814('0xa'));var client=jayson[_0xb814('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b0829,_0x2e6272,_0x5c8539){return new BPromise(function(_0x271af9,_0x2913a6){return client[_0xb814('0xc')](_0x3b0829,_0x5c8539)[_0xb814('0xd')](function(_0x1fea33){logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));logger[_0xb814('0x11')](_0xb814('0x12'),_0x2e6272,_0xb814('0x10'),JSON['stringify'](_0x1fea33));if(_0x1fea33[_0xb814('0x13')]){if(_0x1fea33['error'][_0xb814('0x14')]===0x1f4){logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x2913a6(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x271af9(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}else{logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));_0x271af9(_0x1fea33[_0xb814('0x16')][_0xb814('0x15')]);}})[_0xb814('0x17')](function(_0x21b73f){logger[_0xb814('0x13')]('IntegrationReport,\x20%s,\x20%s',_0x2e6272,_0x21b73f);_0x2913a6(_0x21b73f);});});} \ No newline at end of file +var _0x7a54=['info','IntegrationReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x7a54,0x106));var _0x47a5=function(_0x2ebba7,_0x5b2493){_0x2ebba7=_0x2ebba7-0x0;var _0x54f39f=_0x7a54[_0x2ebba7];return _0x54f39f;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('IntegrationReport,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 4a68436..4f6dca4 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 _0x0170=['isAuthenticated','index','/:id','show','getIntervals','post','create','/:id/sub_intervals','addInterval','/:id/sub_intervals/create_many','addIntervals','put','update','delete','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./interval.controller','get'];(function(_0x9188e2,_0x43089a){var _0x2e6fa4=function(_0x5bb8ec){while(--_0x5bb8ec){_0x9188e2['push'](_0x9188e2['shift']());}};_0x2e6fa4(++_0x43089a);}(_0x0170,0x1d6));var _0x0017=function(_0x2b66b6,_0x207384){_0x2b66b6=_0x2b66b6-0x0;var _0x3b9d03=_0x0170[_0x2b66b6];return _0x3b9d03;};'use strict';var multer=require(_0x0017('0x0'));var util=require(_0x0017('0x1'));var path=require('path');var timeout=require(_0x0017('0x2'));var express=require(_0x0017('0x3'));var router=express[_0x0017('0x4')]();var fs_extra=require(_0x0017('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0017('0x6'));var config=require(_0x0017('0x7'));var controller=require(_0x0017('0x8'));router[_0x0017('0x9')]('/',auth[_0x0017('0xa')](),controller[_0x0017('0xb')]);router[_0x0017('0x9')](_0x0017('0xc'),auth[_0x0017('0xa')](),controller[_0x0017('0xd')]);router[_0x0017('0x9')]('/:id/sub_intervals',auth['isAuthenticated'](),controller[_0x0017('0xe')]);router[_0x0017('0xf')]('/',auth[_0x0017('0xa')](),controller[_0x0017('0x10')]);router[_0x0017('0xf')](_0x0017('0x11'),auth[_0x0017('0xa')](),controller[_0x0017('0x12')]);router[_0x0017('0xf')](_0x0017('0x13'),auth[_0x0017('0xa')](),controller[_0x0017('0x14')]);router[_0x0017('0x15')]('/:id',auth[_0x0017('0xa')](),controller[_0x0017('0x16')]);router[_0x0017('0x17')](_0x0017('0xc'),auth[_0x0017('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xe49a=['getIntervals','post','/:id/sub_intervals/create_many','addIntervals','put','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./interval.controller','get','index','/:id','isAuthenticated','show','/:id/sub_intervals'];(function(_0xe4f3b,_0x40bea2){var _0x27a1a4=function(_0x1aa52b){while(--_0x1aa52b){_0xe4f3b['push'](_0xe4f3b['shift']());}};_0x27a1a4(++_0x40bea2);}(_0xe49a,0xd7));var _0xae49=function(_0xb5b366,_0x3a2412){_0xb5b366=_0xb5b366-0x0;var _0x188069=_0xe49a[_0xb5b366];return _0x188069;};'use strict';var multer=require('multer');var util=require(_0xae49('0x0'));var path=require(_0xae49('0x1'));var timeout=require(_0xae49('0x2'));var express=require(_0xae49('0x3'));var router=express[_0xae49('0x4')]();var fs_extra=require(_0xae49('0x5'));var auth=require(_0xae49('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xae49('0x7'));var controller=require(_0xae49('0x8'));router[_0xae49('0x9')]('/',auth['isAuthenticated'](),controller[_0xae49('0xa')]);router['get'](_0xae49('0xb'),auth[_0xae49('0xc')](),controller[_0xae49('0xd')]);router[_0xae49('0x9')](_0xae49('0xe'),auth[_0xae49('0xc')](),controller[_0xae49('0xf')]);router['post']('/',auth[_0xae49('0xc')](),controller['create']);router[_0xae49('0x10')](_0xae49('0xe'),auth[_0xae49('0xc')](),controller['addInterval']);router[_0xae49('0x10')](_0xae49('0x11'),auth[_0xae49('0xc')](),controller[_0xae49('0x12')]);router[_0xae49('0x13')](_0xae49('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xae49('0x14')](_0xae49('0xb'),auth[_0xae49('0xc')](),controller[_0xae49('0x15')]);module[_0xae49('0x16')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 159824e..ce9e755 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 _0xd43f=['sequelize','STRING'];(function(_0x18f565,_0x1a1d51){var _0x2af4b8=function(_0x44368e){while(--_0x44368e){_0x18f565['push'](_0x18f565['shift']());}};_0x2af4b8(++_0x1a1d51);}(_0xd43f,0x196));var _0xfd43=function(_0x300385,_0x31b65){_0x300385=_0x300385-0x0;var _0x442f17=_0xd43f[_0x300385];return _0x442f17;};'use strict';var Sequelize=require(_0xfd43('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xfd43('0x1')]},'interval':{'type':Sequelize[_0xfd43('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x3e20=['sequelize','exports'];(function(_0x7e5583,_0x499818){var _0x1ae187=function(_0x2f7b50){while(--_0x2f7b50){_0x7e5583['push'](_0x7e5583['shift']());}};_0x1ae187(++_0x499818);}(_0x3e20,0x114));var _0x03e2=function(_0x45e266,_0x11040a){_0x45e266=_0x45e266-0x0;var _0x2f4572=_0x3e20[_0x45e266];return _0x2f4572;};'use strict';var Sequelize=require(_0x03e2('0x0'));module[_0x03e2('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 83e108a..79ffb39 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 _0xbcdc=['type','VIRTUAL','name','filter','options','Interval','includeAll','include','findAll','rows','catch','show','params','length','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','IntervalId','getIntervals','findOne','order','addIntervals','transaction','bulkCreate','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','get','Intervals','UserProfileResource','send','map','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','filters','pick','merge'];(function(_0x318410,_0x451962){var _0x2898a3=function(_0x58e572){while(--_0x58e572){_0x318410['push'](_0x318410['shift']());}};_0x2898a3(++_0x451962);}(_0xbcdc,0x7e));var _0xcbcd=function(_0x32fb47,_0x4a2e5d){_0x32fb47=_0x32fb47-0x0;var _0x263f7c=_0xbcdc[_0x32fb47];return _0x263f7c;};'use strict';var emlformat=require(_0xcbcd('0x0'));var rimraf=require(_0xcbcd('0x1'));var zipdir=require(_0xcbcd('0x2'));var jsonpatch=require(_0xcbcd('0x3'));var rp=require(_0xcbcd('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xcbcd('0x5'));var util=require(_0xcbcd('0x6'));var path=require(_0xcbcd('0x7'));var sox=require(_0xcbcd('0x8'));var csv=require('to-csv');var ejs=require(_0xcbcd('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcbcd('0xa'));var squel=require(_0xcbcd('0xb'));var crypto=require(_0xcbcd('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xcbcd('0xd'));var toCsv=require('to-csv');var querystring=require(_0xcbcd('0xe'));var Papa=require('papaparse');var Redis=require(_0xcbcd('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xcbcd('0x10'));var hardwareService=require(_0xcbcd('0x11'));var logger=require(_0xcbcd('0x12'))(_0xcbcd('0x13'));var utils=require(_0xcbcd('0x14'));var config=require(_0xcbcd('0x15'));var licenseUtil=require(_0xcbcd('0x16'));var db=require(_0xcbcd('0x17'))['db'];var extensions=require(_0xcbcd('0x18'));function respondWithStatusCode(_0x3a6b90,_0x155c66){_0x155c66=_0x155c66||0xcc;return function(_0x50dafa){if(_0x50dafa){return _0x3a6b90[_0xcbcd('0x19')](_0x155c66);}return _0x3a6b90['status'](_0x155c66)[_0xcbcd('0x1a')]();};}function respondWithResult(_0x1e4fbd,_0x184446){_0x184446=_0x184446||0xc8;return function(_0x17a98a){if(_0x17a98a){return _0x1e4fbd[_0xcbcd('0x1b')](_0x184446)[_0xcbcd('0x1c')](_0x17a98a);}};}function respondWithFilteredResult(_0x553618,_0x34aa8c){return function(_0x53cb40){if(_0x53cb40){var _0x4c3e55=typeof _0x34aa8c[_0xcbcd('0x1d')]===_0xcbcd('0x1e')&&typeof _0x34aa8c[_0xcbcd('0x1f')]===_0xcbcd('0x1e');var _0x42f643=_0x53cb40[_0xcbcd('0x20')];var _0x2d6807=_0x4c3e55?0x0:_0x34aa8c[_0xcbcd('0x1d')];var _0x53abd6=_0x4c3e55?_0x53cb40['count']:_0x34aa8c['offset']+_0x34aa8c[_0xcbcd('0x1f')];var _0x1f134d;if(_0x53abd6>=_0x42f643){_0x53abd6=_0x42f643;_0x1f134d=0xc8;}else{_0x1f134d=0xce;}_0x553618['status'](_0x1f134d);return _0x553618[_0xcbcd('0x21')]('Content-Range',_0x2d6807+'-'+_0x53abd6+'/'+_0x42f643)[_0xcbcd('0x1c')](_0x53cb40);}return null;};}function patchUpdates(_0x21187a){return function(_0x189801){try{jsonpatch[_0xcbcd('0x22')](_0x189801,_0x21187a,!![]);}catch(_0x39fe22){return BPromise[_0xcbcd('0x23')](_0x39fe22);}return _0x189801['save']();};}function saveUpdates(_0xddb3c7,_0x447738){return function(_0x35b75e){if(_0x35b75e){return _0x35b75e[_0xcbcd('0x24')](_0xddb3c7)[_0xcbcd('0x25')](function(_0x5eafa8){return _0x5eafa8;});}return null;};}function removeEntity(_0x2db79c,_0x24e4bb){return function(_0x1f4089){if(_0x1f4089){return _0x1f4089[_0xcbcd('0x26')]()['then'](function(){var _0x48aba8=_0x1f4089[_0xcbcd('0x27')]({'plain':!![]});var _0x503101=_0xcbcd('0x28');return db[_0xcbcd('0x29')]['destroy']({'where':{'type':_0x503101,'resourceId':_0x48aba8['id']}})[_0xcbcd('0x25')](function(){return _0x1f4089;});})[_0xcbcd('0x25')](function(){_0x2db79c[_0xcbcd('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3439cf,_0x4956b1){return function(_0x3342c4){if(!_0x3342c4){_0x3439cf[_0xcbcd('0x19')](0x194);}return _0x3342c4;};}function handleError(_0x538158,_0x44b0b2){_0x44b0b2=_0x44b0b2||0x1f4;return function(_0x109110){logger['error'](_0x109110['stack']);if(_0x109110['name']){delete _0x109110['name'];}_0x538158[_0xcbcd('0x1b')](_0x44b0b2)[_0xcbcd('0x2a')](_0x109110);};}exports['index']=function(_0x57476c,_0x52d2de){var _0x598d0a={},_0xb685ab={},_0x34b887={'count':0x0,'rows':[]};var _0x1c801b=_[_0xcbcd('0x2b')](db['Interval'][_0xcbcd('0x2c')],function(_0x54a747){return{'name':_0x54a747[_0xcbcd('0x2d')],'type':_0x54a747['type'][_0xcbcd('0x2e')]};});_0xb685ab[_0xcbcd('0x2f')]=_[_0xcbcd('0x2b')](_0x1c801b,'name');_0xb685ab[_0xcbcd('0x30')]=_[_0xcbcd('0x31')](_0x57476c[_0xcbcd('0x30')]);_0xb685ab['filters']=_[_0xcbcd('0x32')](_0xb685ab[_0xcbcd('0x2f')],_0xb685ab[_0xcbcd('0x30')]);_0x598d0a['attributes']=_[_0xcbcd('0x32')](_0xb685ab[_0xcbcd('0x2f')],qs[_0xcbcd('0x33')](_0x57476c[_0xcbcd('0x30')][_0xcbcd('0x33')]));_0x598d0a[_0xcbcd('0x34')]=_0x598d0a[_0xcbcd('0x34')]['length']?_0x598d0a[_0xcbcd('0x34')]:_0xb685ab['model'];if(!_0x57476c['query'][_0xcbcd('0x35')](_0xcbcd('0x36'))){_0x598d0a[_0xcbcd('0x1f')]=qs[_0xcbcd('0x1f')](_0x57476c[_0xcbcd('0x30')][_0xcbcd('0x1f')]);_0x598d0a[_0xcbcd('0x1d')]=qs[_0xcbcd('0x1d')](_0x57476c[_0xcbcd('0x30')][_0xcbcd('0x1d')]);}_0x598d0a['order']=qs[_0xcbcd('0x37')](_0x57476c[_0xcbcd('0x30')]['sort']);_0x598d0a[_0xcbcd('0x38')]=qs[_0xcbcd('0x39')](_[_0xcbcd('0x3a')](_0x57476c[_0xcbcd('0x30')],_0xb685ab[_0xcbcd('0x39')]),_0x1c801b);if(_0x57476c['query']['filter']){_0x598d0a[_0xcbcd('0x38')]=_[_0xcbcd('0x3b')](_0x598d0a[_0xcbcd('0x38')],{'$or':_[_0xcbcd('0x2b')](_0x1c801b,function(_0x147297){if(_0x147297[_0xcbcd('0x3c')]!==_0xcbcd('0x3d')){var _0x52cd48={};_0x52cd48[_0x147297[_0xcbcd('0x3e')]]={'$like':'%'+_0x57476c[_0xcbcd('0x30')][_0xcbcd('0x3f')]+'%'};return _0x52cd48;}})});}_0x598d0a=_[_0xcbcd('0x3b')]({},_0x598d0a,_0x57476c[_0xcbcd('0x40')]);var _0x20988a={'where':_0x598d0a[_0xcbcd('0x38')]};return db[_0xcbcd('0x41')]['count'](_0x20988a)[_0xcbcd('0x25')](function(_0x49e52e){_0x34b887[_0xcbcd('0x20')]=_0x49e52e;if(_0x57476c[_0xcbcd('0x30')][_0xcbcd('0x42')]){_0x598d0a[_0xcbcd('0x43')]=[{'all':!![]}];}return db[_0xcbcd('0x41')][_0xcbcd('0x44')](_0x598d0a);})[_0xcbcd('0x25')](function(_0x2048bd){_0x34b887[_0xcbcd('0x45')]=_0x2048bd;return _0x34b887;})['then'](respondWithFilteredResult(_0x52d2de,_0x598d0a))[_0xcbcd('0x46')](handleError(_0x52d2de,null));};exports[_0xcbcd('0x47')]=function(_0x6fcd9b,_0x52daea){var _0x2bc6e3={'raw':!![],'where':{'id':_0x6fcd9b[_0xcbcd('0x48')]['id']}},_0x1c87a8={};_0x1c87a8[_0xcbcd('0x2f')]=_['keys'](db['Interval']['rawAttributes']);_0x1c87a8['query']=_[_0xcbcd('0x31')](_0x6fcd9b[_0xcbcd('0x30')]);_0x1c87a8['filters']=_[_0xcbcd('0x32')](_0x1c87a8[_0xcbcd('0x2f')],_0x1c87a8['query']);_0x2bc6e3[_0xcbcd('0x34')]=_[_0xcbcd('0x32')](_0x1c87a8['model'],qs[_0xcbcd('0x33')](_0x6fcd9b[_0xcbcd('0x30')][_0xcbcd('0x33')]));_0x2bc6e3[_0xcbcd('0x34')]=_0x2bc6e3[_0xcbcd('0x34')][_0xcbcd('0x49')]?_0x2bc6e3[_0xcbcd('0x34')]:_0x1c87a8[_0xcbcd('0x2f')];if(_0x6fcd9b[_0xcbcd('0x30')]['includeAll']){_0x2bc6e3[_0xcbcd('0x43')]=[{'all':!![]}];}_0x2bc6e3=_[_0xcbcd('0x3b')]({},_0x2bc6e3,_0x6fcd9b['options']);return db[_0xcbcd('0x41')][_0xcbcd('0x4a')](_0x2bc6e3)[_0xcbcd('0x25')](handleEntityNotFound(_0x52daea,null))[_0xcbcd('0x25')](respondWithResult(_0x52daea,null))[_0xcbcd('0x46')](handleError(_0x52daea,null));};exports['create']=function(_0x9288b0,_0x4436d5){return db['Interval']['create'](_0x9288b0[_0xcbcd('0x4b')],{})[_0xcbcd('0x25')](function(_0x25e48a){var _0x1c6e23=_0x9288b0[_0xcbcd('0x4c')][_0xcbcd('0x27')]({'plain':!![]});if(!_0x1c6e23)throw new Error(_0xcbcd('0x4d'));if(_0x1c6e23[_0xcbcd('0x4e')]===_0xcbcd('0x4c')){var _0x3a5ab0=_0x25e48a[_0xcbcd('0x27')]({'plain':!![]});var _0x3c4233='Intervals';return db[_0xcbcd('0x4f')][_0xcbcd('0x4a')]({'where':{'name':_0x3c4233,'userProfileId':_0x1c6e23[_0xcbcd('0x50')]},'raw':!![]})[_0xcbcd('0x25')](function(_0x48a872){if(_0x48a872&&_0x48a872[_0xcbcd('0x51')]===0x0){return db[_0xcbcd('0x29')][_0xcbcd('0x52')]({'name':_0x3a5ab0[_0xcbcd('0x3e')],'resourceId':_0x3a5ab0['id'],'type':_0x48a872[_0xcbcd('0x3e')],'sectionId':_0x48a872['id']},{})[_0xcbcd('0x25')](function(){return _0x25e48a;});}else{return _0x25e48a;}})[_0xcbcd('0x46')](function(_0x12b878){logger[_0xcbcd('0x53')](_0xcbcd('0x54'),_0x12b878);throw _0x12b878;});}return _0x25e48a;})[_0xcbcd('0x25')](respondWithResult(_0x4436d5,0xc9))[_0xcbcd('0x46')](handleError(_0x4436d5,null));};exports[_0xcbcd('0x24')]=function(_0x5a133e,_0x1c41e2){if(_0x5a133e[_0xcbcd('0x4b')]['id']){delete _0x5a133e['body']['id'];}return db['Interval'][_0xcbcd('0x4a')]({'where':{'id':_0x5a133e[_0xcbcd('0x48')]['id']}})[_0xcbcd('0x25')](handleEntityNotFound(_0x1c41e2,null))[_0xcbcd('0x25')](saveUpdates(_0x5a133e[_0xcbcd('0x4b')],null))[_0xcbcd('0x25')](respondWithResult(_0x1c41e2,null))['catch'](handleError(_0x1c41e2,null));};exports['destroy']=function(_0x226249,_0x6bbc1){return db[_0xcbcd('0x41')][_0xcbcd('0x4a')]({'where':{'id':_0x226249[_0xcbcd('0x48')]['id']}})[_0xcbcd('0x25')](handleEntityNotFound(_0x6bbc1,null))[_0xcbcd('0x25')](removeEntity(_0x6bbc1,null))[_0xcbcd('0x46')](handleError(_0x6bbc1,null));};exports[_0xcbcd('0x55')]=function(_0xb9a320,_0x471566,_0x4a1678){if(_0xb9a320[_0xcbcd('0x4b')]['id']){delete _0xb9a320[_0xcbcd('0x4b')]['id'];}return db[_0xcbcd('0x41')][_0xcbcd('0x4a')]({'where':{'id':_0xb9a320[_0xcbcd('0x48')]['id']}})[_0xcbcd('0x25')](handleEntityNotFound(_0x471566,null))['then'](function(_0x454429){if(_0x454429){_0xb9a320[_0xcbcd('0x4b')][_0xcbcd('0x56')]=_0x454429['id'];return db['Interval'][_0xcbcd('0x52')](_0xb9a320['body']);}})[_0xcbcd('0x25')](respondWithResult(_0x471566,null))[_0xcbcd('0x46')](handleError(_0x471566,null));};exports[_0xcbcd('0x57')]=function(_0x2dc9b0,_0x3365c7,_0x1c3f58){var _0x3f401d={};var _0xd9173a={};var _0x333c23;var _0x319b4f;return db['Interval'][_0xcbcd('0x58')]({'where':{'id':_0x2dc9b0[_0xcbcd('0x48')]['id']}})[_0xcbcd('0x25')](handleEntityNotFound(_0x3365c7,null))[_0xcbcd('0x25')](function(_0x2228b0){if(_0x2228b0){_0x333c23=_0x2228b0;_0xd9173a[_0xcbcd('0x2f')]=_[_0xcbcd('0x31')](db[_0xcbcd('0x41')][_0xcbcd('0x2c')]);_0xd9173a[_0xcbcd('0x30')]=_['keys'](_0x2dc9b0[_0xcbcd('0x30')]);_0xd9173a[_0xcbcd('0x39')]=_[_0xcbcd('0x32')](_0xd9173a[_0xcbcd('0x2f')],_0xd9173a[_0xcbcd('0x30')]);_0x3f401d['attributes']=_[_0xcbcd('0x32')](_0xd9173a[_0xcbcd('0x2f')],qs[_0xcbcd('0x33')](_0x2dc9b0[_0xcbcd('0x30')][_0xcbcd('0x33')]));_0x3f401d['attributes']=_0x3f401d['attributes'][_0xcbcd('0x49')]?_0x3f401d[_0xcbcd('0x34')]:_0xd9173a[_0xcbcd('0x2f')];_0x3f401d[_0xcbcd('0x59')]=qs['sort'](_0x2dc9b0[_0xcbcd('0x30')]['sort']);_0x3f401d[_0xcbcd('0x38')]=qs[_0xcbcd('0x39')](_[_0xcbcd('0x3a')](_0x2dc9b0['query'],_0xd9173a[_0xcbcd('0x39')]));if(_0x2dc9b0[_0xcbcd('0x30')][_0xcbcd('0x3f')]){_0x3f401d[_0xcbcd('0x38')]=_[_0xcbcd('0x3b')](_0x3f401d['where'],{'$or':_[_0xcbcd('0x2b')](_0x3f401d['attributes'],function(_0x136e28){var _0xac6eb3={};_0xac6eb3[_0x136e28]={'$like':'%'+_0x2dc9b0[_0xcbcd('0x30')][_0xcbcd('0x3f')]+'%'};return _0xac6eb3;})});}_0x3f401d=_[_0xcbcd('0x3b')]({},_0x3f401d,_0x2dc9b0[_0xcbcd('0x40')]);return _0x333c23[_0xcbcd('0x57')](_0x3f401d);}})[_0xcbcd('0x25')](function(_0xc6b6b4){if(_0xc6b6b4){_0x319b4f=_0xc6b6b4['length'];if(!_0x2dc9b0[_0xcbcd('0x30')][_0xcbcd('0x35')](_0xcbcd('0x36'))){_0x3f401d[_0xcbcd('0x1f')]=qs['limit'](_0x2dc9b0[_0xcbcd('0x30')][_0xcbcd('0x1f')]);_0x3f401d[_0xcbcd('0x1d')]=qs[_0xcbcd('0x1d')](_0x2dc9b0['query']['offset']);}return _0x333c23['getIntervals'](_0x3f401d);}})['then'](function(_0x508a7b){if(_0x508a7b){return _0x508a7b?{'count':_0x319b4f,'rows':_0x508a7b}:null;}})[_0xcbcd('0x25')](respondWithResult(_0x3365c7,null))['catch'](handleError(_0x3365c7,null));};exports[_0xcbcd('0x5a')]=function(_0xad77a7,_0x5730ac,_0x567bc2){return db[_0xcbcd('0x41')][_0xcbcd('0x58')]({'where':{'id':_0xad77a7[_0xcbcd('0x48')]['id']}})[_0xcbcd('0x25')](handleEntityNotFound(_0x5730ac,null))[_0xcbcd('0x25')](function(_0x20a9aa){if(_0x20a9aa){return db['sequelize'][_0xcbcd('0x5b')](function(_0x57a1e2){return db['Interval'][_0xcbcd('0x26')]({'where':{'IntervalId':_0xad77a7[_0xcbcd('0x48')]['id']},'transaction':_0x57a1e2})[_0xcbcd('0x25')](function(_0xe99ab4){var _0x5279b6=_[_0xcbcd('0x2b')](_0xad77a7[_0xcbcd('0x4b')],function(_0xbc6ffa){delete _0xbc6ffa['id'];_0xbc6ffa['IntervalId']=_0xad77a7[_0xcbcd('0x48')]['id'];return _0xbc6ffa;});return db[_0xcbcd('0x41')][_0xcbcd('0x5c')](_0x5279b6,{'transaction':_0x57a1e2});});})[_0xcbcd('0x25')](function(){return db[_0xcbcd('0x41')][_0xcbcd('0x44')]({'where':{'IntervalId':_0xad77a7[_0xcbcd('0x48')]['id']}});});}})['then'](respondWithResult(_0x5730ac,null))['catch'](handleError(_0x5730ac,null));}; \ No newline at end of file +var _0x4e3c=['desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','offset','undefined','limit','count','set','json','save','update','then','destroy','Intervals','UserProfileResource','error','stack','name','send','index','map','Interval','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','merge','where','filter','includeAll','include','show','params','options','find','catch','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addInterval','getIntervals','findOne','order','addIntervals','sequelize','transaction','IntervalId','bulkCreate','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x425419,_0xe8d075){var _0x52c87c=function(_0x3a34aa){while(--_0x3a34aa){_0x425419['push'](_0x425419['shift']());}};_0x52c87c(++_0xe8d075);}(_0x4e3c,0x164));var _0xc4e3=function(_0x1e97a5,_0x37a2e9){_0x1e97a5=_0x1e97a5-0x0;var _0x42915d=_0x4e3c[_0x1e97a5];return _0x42915d;};'use strict';var emlformat=require(_0xc4e3('0x0'));var rimraf=require(_0xc4e3('0x1'));var zipdir=require(_0xc4e3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc4e3('0x3'));var moment=require(_0xc4e3('0x4'));var BPromise=require(_0xc4e3('0x5'));var Mustache=require(_0xc4e3('0x6'));var util=require(_0xc4e3('0x7'));var path=require(_0xc4e3('0x8'));var sox=require(_0xc4e3('0x9'));var csv=require('to-csv');var ejs=require(_0xc4e3('0xa'));var fs=require('fs');var fs_extra=require(_0xc4e3('0xb'));var _=require(_0xc4e3('0xc'));var squel=require(_0xc4e3('0xd'));var crypto=require(_0xc4e3('0xe'));var jsforce=require(_0xc4e3('0xf'));var deskjs=require(_0xc4e3('0x10'));var toCsv=require(_0xc4e3('0x11'));var querystring=require(_0xc4e3('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xc4e3('0x13'));var qs=require(_0xc4e3('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc4e3('0x15'));var logger=require('../../config/logger')(_0xc4e3('0x16'));var utils=require(_0xc4e3('0x17'));var config=require(_0xc4e3('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xc4e3('0x19'))['db'];var extensions=require(_0xc4e3('0x1a'));function respondWithStatusCode(_0x1dcdca,_0x1331db){_0x1331db=_0x1331db||0xcc;return function(_0x473055){if(_0x473055){return _0x1dcdca[_0xc4e3('0x1b')](_0x1331db);}return _0x1dcdca[_0xc4e3('0x1c')](_0x1331db)[_0xc4e3('0x1d')]();};}function respondWithResult(_0xc4af46,_0x4d41c2){_0x4d41c2=_0x4d41c2||0xc8;return function(_0xa5e08c){if(_0xa5e08c){return _0xc4af46[_0xc4e3('0x1c')](_0x4d41c2)['json'](_0xa5e08c);}};}function respondWithFilteredResult(_0x4a34a1,_0xeeabf0){return function(_0x78adb0){if(_0x78adb0){var _0x574fb6=typeof _0xeeabf0[_0xc4e3('0x1e')]===_0xc4e3('0x1f')&&typeof _0xeeabf0[_0xc4e3('0x20')]===_0xc4e3('0x1f');var _0x3c64a7=_0x78adb0[_0xc4e3('0x21')];var _0x531a2d=_0x574fb6?0x0:_0xeeabf0['offset'];var _0x11319b=_0x574fb6?_0x78adb0['count']:_0xeeabf0[_0xc4e3('0x1e')]+_0xeeabf0[_0xc4e3('0x20')];var _0x633530;if(_0x11319b>=_0x3c64a7){_0x11319b=_0x3c64a7;_0x633530=0xc8;}else{_0x633530=0xce;}_0x4a34a1[_0xc4e3('0x1c')](_0x633530);return _0x4a34a1[_0xc4e3('0x22')]('Content-Range',_0x531a2d+'-'+_0x11319b+'/'+_0x3c64a7)[_0xc4e3('0x23')](_0x78adb0);}return null;};}function patchUpdates(_0x1931e5){return function(_0x29e991){try{jsonpatch['apply'](_0x29e991,_0x1931e5,!![]);}catch(_0xe6bdc7){return BPromise['reject'](_0xe6bdc7);}return _0x29e991[_0xc4e3('0x24')]();};}function saveUpdates(_0x42b9d3,_0x17816a){return function(_0x23382a){if(_0x23382a){return _0x23382a[_0xc4e3('0x25')](_0x42b9d3)[_0xc4e3('0x26')](function(_0x4254cc){return _0x4254cc;});}return null;};}function removeEntity(_0xb94052,_0x54b1ca){return function(_0x3a4466){if(_0x3a4466){return _0x3a4466[_0xc4e3('0x27')]()[_0xc4e3('0x26')](function(){var _0x570369=_0x3a4466['get']({'plain':!![]});var _0x5f1a5e=_0xc4e3('0x28');return db[_0xc4e3('0x29')][_0xc4e3('0x27')]({'where':{'type':_0x5f1a5e,'resourceId':_0x570369['id']}})[_0xc4e3('0x26')](function(){return _0x3a4466;});})[_0xc4e3('0x26')](function(){_0xb94052['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x56b41f,_0x59b864){return function(_0x4e3457){if(!_0x4e3457){_0x56b41f[_0xc4e3('0x1b')](0x194);}return _0x4e3457;};}function handleError(_0x159fe5,_0x179a40){_0x179a40=_0x179a40||0x1f4;return function(_0x4b688d){logger[_0xc4e3('0x2a')](_0x4b688d[_0xc4e3('0x2b')]);if(_0x4b688d[_0xc4e3('0x2c')]){delete _0x4b688d[_0xc4e3('0x2c')];}_0x159fe5['status'](_0x179a40)[_0xc4e3('0x2d')](_0x4b688d);};}exports[_0xc4e3('0x2e')]=function(_0x4a6815,_0x44be16){var _0x4cb8f7={},_0x5ae595={},_0x3a6c63={'count':0x0,'rows':[]};var _0x7da5a3=_[_0xc4e3('0x2f')](db[_0xc4e3('0x30')][_0xc4e3('0x31')],function(_0x3f88af){return{'name':_0x3f88af[_0xc4e3('0x32')],'type':_0x3f88af[_0xc4e3('0x33')][_0xc4e3('0x34')]};});_0x5ae595[_0xc4e3('0x35')]=_[_0xc4e3('0x2f')](_0x7da5a3,_0xc4e3('0x2c'));_0x5ae595['query']=_[_0xc4e3('0x36')](_0x4a6815[_0xc4e3('0x37')]);_0x5ae595[_0xc4e3('0x38')]=_[_0xc4e3('0x39')](_0x5ae595[_0xc4e3('0x35')],_0x5ae595[_0xc4e3('0x37')]);_0x4cb8f7[_0xc4e3('0x3a')]=_[_0xc4e3('0x39')](_0x5ae595[_0xc4e3('0x35')],qs['fields'](_0x4a6815[_0xc4e3('0x37')][_0xc4e3('0x3b')]));_0x4cb8f7[_0xc4e3('0x3a')]=_0x4cb8f7[_0xc4e3('0x3a')][_0xc4e3('0x3c')]?_0x4cb8f7[_0xc4e3('0x3a')]:_0x5ae595[_0xc4e3('0x35')];if(!_0x4a6815[_0xc4e3('0x37')][_0xc4e3('0x3d')](_0xc4e3('0x3e'))){_0x4cb8f7[_0xc4e3('0x20')]=qs['limit'](_0x4a6815['query']['limit']);_0x4cb8f7['offset']=qs[_0xc4e3('0x1e')](_0x4a6815[_0xc4e3('0x37')]['offset']);}_0x4cb8f7['order']=qs[_0xc4e3('0x3f')](_0x4a6815[_0xc4e3('0x37')]['sort']);_0x4cb8f7['where']=qs[_0xc4e3('0x38')](_[_0xc4e3('0x40')](_0x4a6815[_0xc4e3('0x37')],_0x5ae595[_0xc4e3('0x38')]),_0x7da5a3);if(_0x4a6815[_0xc4e3('0x37')]['filter']){_0x4cb8f7['where']=_[_0xc4e3('0x41')](_0x4cb8f7[_0xc4e3('0x42')],{'$or':_[_0xc4e3('0x2f')](_0x7da5a3,function(_0x4ffb96){if(_0x4ffb96[_0xc4e3('0x33')]!=='VIRTUAL'){var _0x1a6071={};_0x1a6071[_0x4ffb96[_0xc4e3('0x2c')]]={'$like':'%'+_0x4a6815['query'][_0xc4e3('0x43')]+'%'};return _0x1a6071;}})});}_0x4cb8f7=_[_0xc4e3('0x41')]({},_0x4cb8f7,_0x4a6815['options']);var _0x5dde41={'where':_0x4cb8f7['where']};return db[_0xc4e3('0x30')][_0xc4e3('0x21')](_0x5dde41)[_0xc4e3('0x26')](function(_0x594745){_0x3a6c63['count']=_0x594745;if(_0x4a6815[_0xc4e3('0x37')][_0xc4e3('0x44')]){_0x4cb8f7[_0xc4e3('0x45')]=[{'all':!![]}];}return db[_0xc4e3('0x30')]['findAll'](_0x4cb8f7);})['then'](function(_0x2d35b1){_0x3a6c63['rows']=_0x2d35b1;return _0x3a6c63;})[_0xc4e3('0x26')](respondWithFilteredResult(_0x44be16,_0x4cb8f7))['catch'](handleError(_0x44be16,null));};exports[_0xc4e3('0x46')]=function(_0x531a07,_0x1c9fd6){var _0x554189={'raw':!![],'where':{'id':_0x531a07[_0xc4e3('0x47')]['id']}},_0x2bb945={};_0x2bb945[_0xc4e3('0x35')]=_['keys'](db['Interval'][_0xc4e3('0x31')]);_0x2bb945[_0xc4e3('0x37')]=_['keys'](_0x531a07[_0xc4e3('0x37')]);_0x2bb945['filters']=_['intersection'](_0x2bb945[_0xc4e3('0x35')],_0x2bb945[_0xc4e3('0x37')]);_0x554189[_0xc4e3('0x3a')]=_[_0xc4e3('0x39')](_0x2bb945[_0xc4e3('0x35')],qs[_0xc4e3('0x3b')](_0x531a07[_0xc4e3('0x37')][_0xc4e3('0x3b')]));_0x554189[_0xc4e3('0x3a')]=_0x554189[_0xc4e3('0x3a')][_0xc4e3('0x3c')]?_0x554189['attributes']:_0x2bb945[_0xc4e3('0x35')];if(_0x531a07[_0xc4e3('0x37')][_0xc4e3('0x44')]){_0x554189[_0xc4e3('0x45')]=[{'all':!![]}];}_0x554189=_[_0xc4e3('0x41')]({},_0x554189,_0x531a07[_0xc4e3('0x48')]);return db[_0xc4e3('0x30')][_0xc4e3('0x49')](_0x554189)[_0xc4e3('0x26')](handleEntityNotFound(_0x1c9fd6,null))['then'](respondWithResult(_0x1c9fd6,null))[_0xc4e3('0x4a')](handleError(_0x1c9fd6,null));};exports[_0xc4e3('0x4b')]=function(_0x5f29b9,_0x4ccf7a){return db[_0xc4e3('0x30')][_0xc4e3('0x4b')](_0x5f29b9['body'],{})[_0xc4e3('0x26')](function(_0x3dbc16){var _0x5bbfba=_0x5f29b9[_0xc4e3('0x4c')][_0xc4e3('0x4d')]({'plain':!![]});if(!_0x5bbfba)throw new Error(_0xc4e3('0x4e'));if(_0x5bbfba[_0xc4e3('0x4f')]==='user'){var _0x1aed60=_0x3dbc16[_0xc4e3('0x4d')]({'plain':!![]});var _0x236455=_0xc4e3('0x28');return db['UserProfileSection'][_0xc4e3('0x49')]({'where':{'name':_0x236455,'userProfileId':_0x5bbfba[_0xc4e3('0x50')]},'raw':!![]})[_0xc4e3('0x26')](function(_0x324c87){if(_0x324c87&&_0x324c87[_0xc4e3('0x51')]===0x0){return db[_0xc4e3('0x29')]['create']({'name':_0x1aed60['name'],'resourceId':_0x1aed60['id'],'type':_0x324c87[_0xc4e3('0x2c')],'sectionId':_0x324c87['id']},{})[_0xc4e3('0x26')](function(){return _0x3dbc16;});}else{return _0x3dbc16;}})[_0xc4e3('0x4a')](function(_0x47fea4){logger[_0xc4e3('0x2a')](_0xc4e3('0x52'),_0x47fea4);throw _0x47fea4;});}return _0x3dbc16;})['then'](respondWithResult(_0x4ccf7a,0xc9))[_0xc4e3('0x4a')](handleError(_0x4ccf7a,null));};exports[_0xc4e3('0x25')]=function(_0xd58481,_0x22d928){if(_0xd58481[_0xc4e3('0x53')]['id']){delete _0xd58481[_0xc4e3('0x53')]['id'];}return db[_0xc4e3('0x30')][_0xc4e3('0x49')]({'where':{'id':_0xd58481[_0xc4e3('0x47')]['id']}})['then'](handleEntityNotFound(_0x22d928,null))[_0xc4e3('0x26')](saveUpdates(_0xd58481[_0xc4e3('0x53')],null))[_0xc4e3('0x26')](respondWithResult(_0x22d928,null))[_0xc4e3('0x4a')](handleError(_0x22d928,null));};exports[_0xc4e3('0x27')]=function(_0x3d7ead,_0x29295c){return db[_0xc4e3('0x30')]['find']({'where':{'id':_0x3d7ead['params']['id']}})['then'](handleEntityNotFound(_0x29295c,null))[_0xc4e3('0x26')](removeEntity(_0x29295c,null))[_0xc4e3('0x4a')](handleError(_0x29295c,null));};exports[_0xc4e3('0x54')]=function(_0x1cb254,_0x31df30,_0x46c91e){if(_0x1cb254[_0xc4e3('0x53')]['id']){delete _0x1cb254[_0xc4e3('0x53')]['id'];}return db[_0xc4e3('0x30')][_0xc4e3('0x49')]({'where':{'id':_0x1cb254[_0xc4e3('0x47')]['id']}})[_0xc4e3('0x26')](handleEntityNotFound(_0x31df30,null))[_0xc4e3('0x26')](function(_0x156abd){if(_0x156abd){_0x1cb254[_0xc4e3('0x53')]['IntervalId']=_0x156abd['id'];return db[_0xc4e3('0x30')]['create'](_0x1cb254[_0xc4e3('0x53')]);}})[_0xc4e3('0x26')](respondWithResult(_0x31df30,null))[_0xc4e3('0x4a')](handleError(_0x31df30,null));};exports[_0xc4e3('0x55')]=function(_0xdec7d8,_0xf2dd0b,_0x11e66d){var _0x5b296f={};var _0x193a1f={};var _0x55f91b;var _0x96313c;return db[_0xc4e3('0x30')][_0xc4e3('0x56')]({'where':{'id':_0xdec7d8[_0xc4e3('0x47')]['id']}})[_0xc4e3('0x26')](handleEntityNotFound(_0xf2dd0b,null))['then'](function(_0x4f19de){if(_0x4f19de){_0x55f91b=_0x4f19de;_0x193a1f[_0xc4e3('0x35')]=_[_0xc4e3('0x36')](db[_0xc4e3('0x30')][_0xc4e3('0x31')]);_0x193a1f['query']=_[_0xc4e3('0x36')](_0xdec7d8['query']);_0x193a1f[_0xc4e3('0x38')]=_['intersection'](_0x193a1f[_0xc4e3('0x35')],_0x193a1f[_0xc4e3('0x37')]);_0x5b296f[_0xc4e3('0x3a')]=_['intersection'](_0x193a1f[_0xc4e3('0x35')],qs[_0xc4e3('0x3b')](_0xdec7d8[_0xc4e3('0x37')][_0xc4e3('0x3b')]));_0x5b296f[_0xc4e3('0x3a')]=_0x5b296f['attributes'][_0xc4e3('0x3c')]?_0x5b296f['attributes']:_0x193a1f[_0xc4e3('0x35')];_0x5b296f[_0xc4e3('0x57')]=qs['sort'](_0xdec7d8[_0xc4e3('0x37')]['sort']);_0x5b296f[_0xc4e3('0x42')]=qs[_0xc4e3('0x38')](_[_0xc4e3('0x40')](_0xdec7d8[_0xc4e3('0x37')],_0x193a1f[_0xc4e3('0x38')]));if(_0xdec7d8[_0xc4e3('0x37')][_0xc4e3('0x43')]){_0x5b296f[_0xc4e3('0x42')]=_[_0xc4e3('0x41')](_0x5b296f['where'],{'$or':_[_0xc4e3('0x2f')](_0x5b296f[_0xc4e3('0x3a')],function(_0x22015d){var _0x3fc44c={};_0x3fc44c[_0x22015d]={'$like':'%'+_0xdec7d8[_0xc4e3('0x37')][_0xc4e3('0x43')]+'%'};return _0x3fc44c;})});}_0x5b296f=_[_0xc4e3('0x41')]({},_0x5b296f,_0xdec7d8[_0xc4e3('0x48')]);return _0x55f91b[_0xc4e3('0x55')](_0x5b296f);}})[_0xc4e3('0x26')](function(_0x5b98bd){if(_0x5b98bd){_0x96313c=_0x5b98bd[_0xc4e3('0x3c')];if(!_0xdec7d8[_0xc4e3('0x37')][_0xc4e3('0x3d')]('nolimit')){_0x5b296f[_0xc4e3('0x20')]=qs[_0xc4e3('0x20')](_0xdec7d8[_0xc4e3('0x37')][_0xc4e3('0x20')]);_0x5b296f[_0xc4e3('0x1e')]=qs['offset'](_0xdec7d8['query'][_0xc4e3('0x1e')]);}return _0x55f91b[_0xc4e3('0x55')](_0x5b296f);}})[_0xc4e3('0x26')](function(_0x43e981){if(_0x43e981){return _0x43e981?{'count':_0x96313c,'rows':_0x43e981}:null;}})[_0xc4e3('0x26')](respondWithResult(_0xf2dd0b,null))[_0xc4e3('0x4a')](handleError(_0xf2dd0b,null));};exports[_0xc4e3('0x58')]=function(_0x4f46a7,_0x3a5ff7,_0x5720d8){return db[_0xc4e3('0x30')][_0xc4e3('0x56')]({'where':{'id':_0x4f46a7[_0xc4e3('0x47')]['id']}})['then'](handleEntityNotFound(_0x3a5ff7,null))['then'](function(_0x25f25c){if(_0x25f25c){return db[_0xc4e3('0x59')][_0xc4e3('0x5a')](function(_0x4767ec){return db[_0xc4e3('0x30')]['destroy']({'where':{'IntervalId':_0x4f46a7[_0xc4e3('0x47')]['id']},'transaction':_0x4767ec})[_0xc4e3('0x26')](function(_0x340cae){var _0x9b14c6=_['map'](_0x4f46a7[_0xc4e3('0x53')],function(_0x4295c6){delete _0x4295c6['id'];_0x4295c6[_0xc4e3('0x5b')]=_0x4f46a7[_0xc4e3('0x47')]['id'];return _0x4295c6;});return db[_0xc4e3('0x30')][_0xc4e3('0x5c')](_0x9b14c6,{'transaction':_0x4767ec});});})[_0xc4e3('0x26')](function(){return db[_0xc4e3('0x30')]['findAll']({'where':{'IntervalId':_0x4f46a7['params']['id']}});});}})[_0xc4e3('0x26')](respondWithResult(_0x3a5ff7,null))['catch'](handleError(_0x3a5ff7,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index ab0215d..2662c6a 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 _0xaab2=['../../config/environment','./interval.attributes','../../components/extensions/rewrite','exports','define','Interval','tools_intervals','rewrite','lodash','util','../../config/logger','moment','path'];(function(_0x36ff78,_0x20e57a){var _0x4176b7=function(_0x56d4f2){while(--_0x56d4f2){_0x36ff78['push'](_0x36ff78['shift']());}};_0x4176b7(++_0x20e57a);}(_0xaab2,0x15a));var _0x2aab=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xaab2[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x2aab('0x0'));var util=require(_0x2aab('0x1'));var logger=require(_0x2aab('0x2'))('api');var moment=require(_0x2aab('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2aab('0x4'));var rimraf=require('rimraf');var config=require(_0x2aab('0x5'));var attributes=require(_0x2aab('0x6'));var extensions=require(_0x2aab('0x7'));module[_0x2aab('0x8')]=function(_0x560d39,_0x26ae63){return _0x560d39[_0x2aab('0x9')](_0x2aab('0xa'),attributes,{'tableName':_0x2aab('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x32ce8b,_0x48e9a2){extensions['rewrite'](_0x560d39,_0x32ce8b);},'afterBulkCreate':function(_0x362607,_0x47386a,_0x5985ec){_0x5985ec();extensions[_0x2aab('0xc')](_0x560d39,_0x362607[0x0]);},'afterUpdate':function(_0x3beaa9,_0x2ec0cd){extensions['rewrite'](_0x560d39,_0x3beaa9);},'afterDestroy':function(_0x586874,_0x2dd91b){extensions['rewrite'](_0x560d39,_0x586874);}}});}; \ No newline at end of file +var _0x2a8e=['./interval.attributes','exports','define','Interval','tools_intervals','rewrite','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x2a8e,0x132));var _0xe2a8=function(_0x53cdeb,_0x4a6faa){_0x53cdeb=_0x53cdeb-0x0;var _0x41369d=_0x2a8e[_0x53cdeb];return _0x41369d;};'use strict';var _=require(_0xe2a8('0x0'));var util=require('util');var logger=require(_0xe2a8('0x1'))(_0xe2a8('0x2'));var moment=require(_0xe2a8('0x3'));var BPromise=require(_0xe2a8('0x4'));var rp=require(_0xe2a8('0x5'));var fs=require('fs');var path=require(_0xe2a8('0x6'));var rimraf=require(_0xe2a8('0x7'));var config=require(_0xe2a8('0x8'));var attributes=require(_0xe2a8('0x9'));var extensions=require('../../components/extensions/rewrite');module[_0xe2a8('0xa')]=function(_0x3daee8,_0x36c030){return _0x3daee8[_0xe2a8('0xb')](_0xe2a8('0xc'),attributes,{'tableName':_0xe2a8('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3e7346,_0x6e9a1f){extensions['rewrite'](_0x3daee8,_0x3e7346);},'afterBulkCreate':function(_0x413f48,_0x37dcf2,_0x28b1ba){_0x28b1ba();extensions[_0xe2a8('0xe')](_0x3daee8,_0x413f48[0x0]);},'afterUpdate':function(_0x43fcbb,_0x4e2e29){extensions[_0xe2a8('0xe')](_0x3daee8,_0x43fcbb);},'afterDestroy':function(_0x3f1475,_0x240ab6){extensions[_0xe2a8('0xe')](_0x3daee8,_0x3f1475);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 2430c59..456088c 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(_0x7b5cdd,_0x8c88d8){var _0x3a29ae=function(_0x17859a){while(--_0x17859a){_0x7b5cdd['push'](_0x7b5cdd['shift']());}};_0x3a29ae(++_0x8c88d8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'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(_0x4409e7,_0x307f17){var _0x24c751=function(_0x3a7d33){while(--_0x3a7d33){_0x4409e7['push'](_0x4409e7['shift']());}};_0x24c751(++_0x307f17);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xa9e0[_0x1b828b];return _0x98da1a;};'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 89e01bd..5729583 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 _0xadb5=['post','isAuthenticated','exports','Router','./jira.controller'];(function(_0x26625a,_0xfe528d){var _0x27f8b5=function(_0x137503){while(--_0x137503){_0x26625a['push'](_0x26625a['shift']());}};_0x27f8b5(++_0xfe528d);}(_0xadb5,0xad));var _0x5adb=function(_0x183548,_0x24817f){_0x183548=_0x183548-0x0;var _0x864659=_0xadb5[_0x183548];return _0x864659;};'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 +var _0x5f2f=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller','post'];(function(_0x383339,_0x3d185b){var _0x1f5132=function(_0x4dfa59){while(--_0x4dfa59){_0x383339['push'](_0x383339['shift']());}};_0x1f5132(++_0x3d185b);}(_0x5f2f,0x73));var _0xf5f2=function(_0x467ad7,_0x69f24c){_0x467ad7=_0x467ad7-0x0;var _0x277320=_0x5f2f[_0x467ad7];return _0x277320;};'use strict';var express=require(_0xf5f2('0x0'));var router=express[_0xf5f2('0x1')]();var auth=require(_0xf5f2('0x2'));var controller=require(_0xf5f2('0x3'));router[_0xf5f2('0x4')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x6')]);module[_0xf5f2('0x7')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 6d66514..2c8cc99 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 _0xeab7=['base64','request','data','status','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','write','openIssue','headers','x-forwarded-for','socket','remoteAddress','connection','body','bluebird','https','../../config/logger','3eAmWpBVP0','key','summary','Report','\x20from\x20','description','issuetype','Bug','customfield_11500','fields','customfield_11501','oldToken','customfield_11502','newToken','customfield_11503','customfield_11504','reason','customfield_10102','track.xcallymotion.com','application/json','Basic\x20','toString'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xeab7,0x1b5));var _0x7eab=function(_0x10c229,_0x185050){_0x10c229=_0x10c229-0x0;var _0x489844=_0xeab7[_0x10c229];return _0x489844;};'use strict';var BPromise=require(_0x7eab('0x0'));var https=require(_0x7eab('0x1'));var logger=require(_0x7eab('0x2'))('api');var USERNAME='support';var PASSWORD=_0x7eab('0x3');function openIssue(_0x4a969d,_0x15abdc){var _0x29cbf4={'fields':{'project':{'key':_0x4a969d[_0x7eab('0x4')]||'MOTGUI'},'summary':(_0x4a969d[_0x7eab('0x5')]||_0x7eab('0x6'))+_0x7eab('0x7')+_0x4a969d['ip'],'description':_0x4a969d[_0x7eab('0x8')]||JSON['stringify'](_0x4a969d),'issuetype':{'name':_0x4a969d[_0x7eab('0x9')]||_0x7eab('0xa')}}};_0x29cbf4['fields'][_0x7eab('0xb')]=_0x4a969d['email'];_0x29cbf4[_0x7eab('0xc')][_0x7eab('0xd')]=_0x4a969d[_0x7eab('0xe')];_0x29cbf4[_0x7eab('0xc')][_0x7eab('0xf')]=_0x4a969d[_0x7eab('0x10')];_0x29cbf4[_0x7eab('0xc')][_0x7eab('0x11')]=_0x4a969d['name'];_0x29cbf4[_0x7eab('0xc')][_0x7eab('0x12')]=_0x4a969d[_0x7eab('0x13')];_0x29cbf4[_0x7eab('0xc')][_0x7eab('0x14')]=_0x4a969d['ip'];var _0x3a6f81={'host':_0x7eab('0x15'),'port':0x1bb,'path':'/rest/api/2/issue','method':'POST','timeout':0x4e20,'headers':{'Content-Type':_0x7eab('0x16'),'Authorization':_0x7eab('0x17')+new Buffer(USERNAME+':'+PASSWORD)[_0x7eab('0x18')](_0x7eab('0x19'))}};var _0x3cce30=JSON['stringify'](_0x29cbf4);var _0x5ca1d7=https[_0x7eab('0x1a')](_0x3a6f81,function(_0x52e611){_0x52e611['setEncoding']('utf8');var _0x3a16d7='';_0x52e611['on'](_0x7eab('0x1b'),function(_0x51573b){_0x3a16d7+=_0x51573b;});_0x52e611['on']('end',function(){if(_0x15abdc){return _0x15abdc[_0x7eab('0x1c')](_0x52e611[_0x7eab('0x1d')])[_0x7eab('0x1e')](JSON[_0x7eab('0x1f')](_0x3a16d7));}});});_0x5ca1d7['on'](_0x7eab('0x20'),function(_0x9ab704){if(_0x15abdc){return _0x15abdc[_0x7eab('0x1c')](0x1f4)[_0x7eab('0x1e')]({'errors':[{'message':_0x7eab('0x21'),'type':'api.jira'}]});}});_0x5ca1d7[_0x7eab('0x22')](_0x3cce30);_0x5ca1d7['end']();}exports[_0x7eab('0x23')]=openIssue;exports['send']=function(_0x26f7cf,_0x22feb1){_0x26f7cf['body']['ip']=_0x26f7cf[_0x7eab('0x24')][_0x7eab('0x25')]||_0x26f7cf['connection']['remoteAddress']||_0x26f7cf[_0x7eab('0x26')][_0x7eab('0x27')]||_0x26f7cf[_0x7eab('0x28')]['socket']['remoteAddress'];return openIssue(_0x26f7cf[_0x7eab('0x29')],_0x22feb1);}; \ No newline at end of file +var _0x8548=['\x20from\x20','description','stringify','Bug','fields','email','customfield_11501','customfield_11502','newToken','customfield_11503','name','reason','customfield_10102','/rest/api/2/issue','application/json','Basic\x20','toString','base64','request','setEncoding','utf8','end','status','json','error','api.jira','write','openIssue','body','headers','remoteAddress','socket','bluebird','https','../../config/logger','api','support','3eAmWpBVP0','MOTGUI','summary','Report'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x8548,0x13f));var _0x8854=function(_0x36dbd9,_0x381b98){_0x36dbd9=_0x36dbd9-0x0;var _0x125473=_0x8548[_0x36dbd9];return _0x125473;};'use strict';var BPromise=require(_0x8854('0x0'));var https=require(_0x8854('0x1'));var logger=require(_0x8854('0x2'))(_0x8854('0x3'));var USERNAME=_0x8854('0x4');var PASSWORD=_0x8854('0x5');function openIssue(_0x5820d7,_0x1efa4b){var _0x771a8c={'fields':{'project':{'key':_0x5820d7['key']||_0x8854('0x6')},'summary':(_0x5820d7[_0x8854('0x7')]||_0x8854('0x8'))+_0x8854('0x9')+_0x5820d7['ip'],'description':_0x5820d7[_0x8854('0xa')]||JSON[_0x8854('0xb')](_0x5820d7),'issuetype':{'name':_0x5820d7['issuetype']||_0x8854('0xc')}}};_0x771a8c[_0x8854('0xd')]['customfield_11500']=_0x5820d7[_0x8854('0xe')];_0x771a8c[_0x8854('0xd')][_0x8854('0xf')]=_0x5820d7['oldToken'];_0x771a8c[_0x8854('0xd')][_0x8854('0x10')]=_0x5820d7[_0x8854('0x11')];_0x771a8c[_0x8854('0xd')][_0x8854('0x12')]=_0x5820d7[_0x8854('0x13')];_0x771a8c[_0x8854('0xd')]['customfield_11504']=_0x5820d7[_0x8854('0x14')];_0x771a8c[_0x8854('0xd')][_0x8854('0x15')]=_0x5820d7['ip'];var _0x5f1238={'host':'track.xcallymotion.com','port':0x1bb,'path':_0x8854('0x16'),'method':'POST','timeout':0x4e20,'headers':{'Content-Type':_0x8854('0x17'),'Authorization':_0x8854('0x18')+new Buffer(USERNAME+':'+PASSWORD)[_0x8854('0x19')](_0x8854('0x1a'))}};var _0x144873=JSON['stringify'](_0x771a8c);var _0x4b8aeb=https[_0x8854('0x1b')](_0x5f1238,function(_0x14f7f2){_0x14f7f2[_0x8854('0x1c')](_0x8854('0x1d'));var _0x2c0462='';_0x14f7f2['on']('data',function(_0x472961){_0x2c0462+=_0x472961;});_0x14f7f2['on'](_0x8854('0x1e'),function(){if(_0x1efa4b){return _0x1efa4b[_0x8854('0x1f')](_0x14f7f2['statusCode'])[_0x8854('0x20')](JSON['parse'](_0x2c0462));}});});_0x4b8aeb['on'](_0x8854('0x21'),function(_0x50a917){if(_0x1efa4b){return _0x1efa4b[_0x8854('0x1f')](0x1f4)['json']({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0x8854('0x22')}]});}});_0x4b8aeb[_0x8854('0x23')](_0x144873);_0x4b8aeb[_0x8854('0x1e')]();}exports[_0x8854('0x24')]=openIssue;exports['send']=function(_0x393af8,_0x126d7f){_0x393af8[_0x8854('0x25')]['ip']=_0x393af8[_0x8854('0x26')]['x-forwarded-for']||_0x393af8['connection'][_0x8854('0x27')]||_0x393af8[_0x8854('0x28')][_0x8854('0x27')]||_0x393af8['connection']['socket'][_0x8854('0x27')];return openIssue(_0x393af8['body'],_0x126d7f);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index a173a0a..3cbc2f8 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 _0x1339=['../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x425fc0,_0x27cc46){var _0x2f6bd5=function(_0x3f86b8){while(--_0x3f86b8){_0x425fc0['push'](_0x425fc0['shift']());}};_0x2f6bd5(++_0x27cc46);}(_0x1339,0x1ed));var _0x9133=function(_0x1865f9,_0x5bf16a){_0x1865f9=_0x1865f9-0x0;var _0x59d16b=_0x1339[_0x1865f9];return _0x59d16b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9133('0x0'));var timeout=require(_0x9133('0x1'));var express=require(_0x9133('0x2'));var router=express[_0x9133('0x3')]();var fs_extra=require(_0x9133('0x4'));var auth=require(_0x9133('0x5'));var interaction=require(_0x9133('0x6'));var config=require(_0x9133('0x7'));var controller=require('./jscriptyAnswerReport.controller');router[_0x9133('0x8')]('/',auth[_0x9133('0x9')](),controller[_0x9133('0xa')]);router['get'](_0x9133('0xb'),auth[_0x9133('0x9')](),controller[_0x9133('0xc')]);router[_0x9133('0x8')](_0x9133('0xd'),auth[_0x9133('0x9')](),controller[_0x9133('0xe')]);router[_0x9133('0xf')]('/',auth[_0x9133('0x9')](),controller[_0x9133('0x10')]);router['put'](_0x9133('0xd'),auth[_0x9133('0x9')](),controller[_0x9133('0x11')]);router[_0x9133('0x12')](_0x9133('0xd'),auth[_0x9133('0x9')](),controller['destroy']);module[_0x9133('0x13')]=router; \ No newline at end of file +var _0x41bb=['show','post','create','put','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','get','isAuthenticated','describe','/:id'];(function(_0x21c001,_0xb01b9c){var _0x2ee97b=function(_0xb26016){while(--_0xb26016){_0x21c001['push'](_0x21c001['shift']());}};_0x2ee97b(++_0xb01b9c);}(_0x41bb,0xc5));var _0xb41b=function(_0x9311bd,_0x14aa6c){_0x9311bd=_0x9311bd-0x0;var _0x49870d=_0x41bb[_0x9311bd];return _0x49870d;};'use strict';var multer=require(_0xb41b('0x0'));var util=require(_0xb41b('0x1'));var path=require('path');var timeout=require(_0xb41b('0x2'));var express=require('express');var router=express[_0xb41b('0x3')]();var fs_extra=require(_0xb41b('0x4'));var auth=require(_0xb41b('0x5'));var interaction=require(_0xb41b('0x6'));var config=require('../../config/environment');var controller=require(_0xb41b('0x7'));router[_0xb41b('0x8')]('/',auth[_0xb41b('0x9')](),controller['index']);router['get']('/describe',auth[_0xb41b('0x9')](),controller[_0xb41b('0xa')]);router['get'](_0xb41b('0xb'),auth[_0xb41b('0x9')](),controller[_0xb41b('0xc')]);router[_0xb41b('0xd')]('/',auth[_0xb41b('0x9')](),controller[_0xb41b('0xe')]);router[_0xb41b('0xf')]('/:id',auth[_0xb41b('0x9')](),controller['update']);router[_0xb41b('0x10')](_0xb41b('0xb'),auth[_0xb41b('0x9')](),controller[_0xb41b('0x11')]);module[_0xb41b('0x12')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 2c6e32d..9256570 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(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x7a54,0x106));var _0x47a5=function(_0x3969a0,_0x48357d){_0x3969a0=_0x3969a0-0x0;var _0x5bbcf9=_0x7a54[_0x3969a0];return _0x5bbcf9;};'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(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x7a54,0x106));var _0x47a5=function(_0x8a715a,_0x35a999){_0x8a715a=_0x8a715a-0x0;var _0x408f33=_0x7a54[_0x8a715a];return _0x408f33;};'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 0701997..59d5812 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 _0x0689=['end','json','offset','undefined','count','limit','set','Content-Range','apply','then','destroy','error','name','send','index','map','JscriptyAnswerReport','fieldName','type','key','model','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','intersection','length','find','create','body','update','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status'];(function(_0x2258f7,_0x1696c0){var _0x3b8ded=function(_0xcd72d8){while(--_0xcd72d8){_0x2258f7['push'](_0x2258f7['shift']());}};_0x3b8ded(++_0x1696c0);}(_0x0689,0x161));var _0x9068=function(_0x5b1a21,_0x3f16e0){_0x5b1a21=_0x5b1a21-0x0;var _0x39728a=_0x0689[_0x5b1a21];return _0x39728a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9068('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9068('0x1'));var rp=require(_0x9068('0x2'));var moment=require(_0x9068('0x3'));var BPromise=require(_0x9068('0x4'));var Mustache=require(_0x9068('0x5'));var util=require(_0x9068('0x6'));var path=require(_0x9068('0x7'));var sox=require(_0x9068('0x8'));var csv=require(_0x9068('0x9'));var ejs=require(_0x9068('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9068('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9068('0xc'));var deskjs=require(_0x9068('0xd'));var toCsv=require(_0x9068('0x9'));var querystring=require(_0x9068('0xe'));var Papa=require(_0x9068('0xf'));var Redis=require(_0x9068('0x10'));var authService=require(_0x9068('0x11'));var qs=require(_0x9068('0x12'));var as=require(_0x9068('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9068('0x14'))(_0x9068('0x15'));var utils=require(_0x9068('0x16'));var config=require(_0x9068('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x9068('0x18'))['db'];function respondWithStatusCode(_0x1a89d4,_0x39eae8){_0x39eae8=_0x39eae8||0xcc;return function(_0x4ba797){if(_0x4ba797){return _0x1a89d4[_0x9068('0x19')](_0x39eae8);}return _0x1a89d4[_0x9068('0x1a')](_0x39eae8)[_0x9068('0x1b')]();};}function respondWithResult(_0x479675,_0x322640){_0x322640=_0x322640||0xc8;return function(_0x3ea030){if(_0x3ea030){return _0x479675['status'](_0x322640)[_0x9068('0x1c')](_0x3ea030);}};}function respondWithFilteredResult(_0x2952f8,_0x486714){return function(_0x1ad536){if(_0x1ad536){var _0x412dbf=typeof _0x486714[_0x9068('0x1d')]===_0x9068('0x1e')&&typeof _0x486714['limit']===_0x9068('0x1e');var _0x376f6d=_0x1ad536[_0x9068('0x1f')];var _0x36d591=_0x412dbf?0x0:_0x486714[_0x9068('0x1d')];var _0x1d09bf=_0x412dbf?_0x1ad536[_0x9068('0x1f')]:_0x486714[_0x9068('0x1d')]+_0x486714[_0x9068('0x20')];var _0x5844b6;if(_0x1d09bf>=_0x376f6d){_0x1d09bf=_0x376f6d;_0x5844b6=0xc8;}else{_0x5844b6=0xce;}_0x2952f8[_0x9068('0x1a')](_0x5844b6);return _0x2952f8[_0x9068('0x21')](_0x9068('0x22'),_0x36d591+'-'+_0x1d09bf+'/'+_0x376f6d)[_0x9068('0x1c')](_0x1ad536);}return null;};}function patchUpdates(_0xb6bf1e){return function(_0x427744){try{jsonpatch[_0x9068('0x23')](_0x427744,_0xb6bf1e,!![]);}catch(_0x1bc81b){return BPromise['reject'](_0x1bc81b);}return _0x427744['save']();};}function saveUpdates(_0x48a2de,_0x4537e7){return function(_0x5cab20){if(_0x5cab20){return _0x5cab20['update'](_0x48a2de)[_0x9068('0x24')](function(_0x290d94){return _0x290d94;});}return null;};}function removeEntity(_0x32231b,_0x3673b9){return function(_0x5d708a){if(_0x5d708a){return _0x5d708a[_0x9068('0x25')]()[_0x9068('0x24')](function(){_0x32231b[_0x9068('0x1a')](0xcc)[_0x9068('0x1b')]();});}};}function handleEntityNotFound(_0x12f17f,_0x28615e){return function(_0x4b93d9){if(!_0x4b93d9){_0x12f17f[_0x9068('0x19')](0x194);}return _0x4b93d9;};}function handleError(_0x3ee9aa,_0x4f48c3){_0x4f48c3=_0x4f48c3||0x1f4;return function(_0x12369a){logger[_0x9068('0x26')](_0x12369a['stack']);if(_0x12369a['name']){delete _0x12369a[_0x9068('0x27')];}_0x3ee9aa['status'](_0x4f48c3)[_0x9068('0x28')](_0x12369a);};}exports[_0x9068('0x29')]=function(_0x422e89,_0x1ceef5){var _0x2f14ab={},_0x4fd2e2={},_0x94b290={'count':0x0,'rows':[]};var _0x412b82=_[_0x9068('0x2a')](db[_0x9068('0x2b')]['rawAttributes'],function(_0x5a49b8){return{'name':_0x5a49b8[_0x9068('0x2c')],'type':_0x5a49b8[_0x9068('0x2d')][_0x9068('0x2e')]};});_0x4fd2e2[_0x9068('0x2f')]=_[_0x9068('0x2a')](_0x412b82,_0x9068('0x27'));_0x4fd2e2[_0x9068('0x30')]=_[_0x9068('0x31')](_0x422e89[_0x9068('0x30')]);_0x4fd2e2[_0x9068('0x32')]=_['intersection'](_0x4fd2e2[_0x9068('0x2f')],_0x4fd2e2[_0x9068('0x30')]);_0x2f14ab[_0x9068('0x33')]=_['intersection'](_0x4fd2e2[_0x9068('0x2f')],qs[_0x9068('0x34')](_0x422e89[_0x9068('0x30')][_0x9068('0x34')]));_0x2f14ab['attributes']=_0x2f14ab[_0x9068('0x33')]['length']?_0x2f14ab[_0x9068('0x33')]:_0x4fd2e2['model'];if(!_0x422e89[_0x9068('0x30')][_0x9068('0x35')](_0x9068('0x36'))){_0x2f14ab[_0x9068('0x20')]=qs[_0x9068('0x20')](_0x422e89['query'][_0x9068('0x20')]);_0x2f14ab[_0x9068('0x1d')]=qs[_0x9068('0x1d')](_0x422e89[_0x9068('0x30')][_0x9068('0x1d')]);}_0x2f14ab[_0x9068('0x37')]=qs[_0x9068('0x38')](_0x422e89[_0x9068('0x30')][_0x9068('0x38')]);_0x2f14ab['where']=qs[_0x9068('0x32')](_[_0x9068('0x39')](_0x422e89[_0x9068('0x30')],_0x4fd2e2[_0x9068('0x32')]),_0x412b82);if(_0x422e89['query']['filter']){_0x2f14ab[_0x9068('0x3a')]=_[_0x9068('0x3b')](_0x2f14ab[_0x9068('0x3a')],{'$or':_[_0x9068('0x2a')](_0x412b82,function(_0x108e98){if(_0x108e98[_0x9068('0x2d')]!==_0x9068('0x3c')){var _0x3e3dc0={};_0x3e3dc0[_0x108e98[_0x9068('0x27')]]={'$like':'%'+_0x422e89[_0x9068('0x30')][_0x9068('0x3d')]+'%'};return _0x3e3dc0;}})});}_0x2f14ab=_[_0x9068('0x3b')]({},_0x2f14ab,_0x422e89[_0x9068('0x3e')]);var _0x3749ff={'where':_0x2f14ab[_0x9068('0x3a')]};return db[_0x9068('0x2b')][_0x9068('0x1f')](_0x3749ff)[_0x9068('0x24')](function(_0x53201f){_0x94b290[_0x9068('0x1f')]=_0x53201f;if(_0x422e89[_0x9068('0x30')][_0x9068('0x3f')]){_0x2f14ab[_0x9068('0x40')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x9068('0x41')](_0x2f14ab);})['then'](function(_0x36bfb2){_0x94b290['rows']=_0x36bfb2;return _0x94b290;})[_0x9068('0x24')](respondWithFilteredResult(_0x1ceef5,_0x2f14ab))[_0x9068('0x42')](handleError(_0x1ceef5,null));};exports[_0x9068('0x43')]=function(_0x2a911a,_0x4a1efd){var _0x399dfd={'raw':!![],'where':{'id':_0x2a911a[_0x9068('0x44')]['id']}},_0x2e7480={};_0x2e7480[_0x9068('0x2f')]=_[_0x9068('0x31')](db[_0x9068('0x2b')]['rawAttributes']);_0x2e7480['query']=_[_0x9068('0x31')](_0x2a911a[_0x9068('0x30')]);_0x2e7480[_0x9068('0x32')]=_[_0x9068('0x45')](_0x2e7480[_0x9068('0x2f')],_0x2e7480[_0x9068('0x30')]);_0x399dfd[_0x9068('0x33')]=_[_0x9068('0x45')](_0x2e7480[_0x9068('0x2f')],qs[_0x9068('0x34')](_0x2a911a['query'][_0x9068('0x34')]));_0x399dfd[_0x9068('0x33')]=_0x399dfd['attributes'][_0x9068('0x46')]?_0x399dfd['attributes']:_0x2e7480[_0x9068('0x2f')];if(_0x2a911a['query'][_0x9068('0x3f')]){_0x399dfd[_0x9068('0x40')]=[{'all':!![]}];}_0x399dfd=_['merge']({},_0x399dfd,_0x2a911a[_0x9068('0x3e')]);return db[_0x9068('0x2b')][_0x9068('0x47')](_0x399dfd)[_0x9068('0x24')](handleEntityNotFound(_0x4a1efd,null))['then'](respondWithResult(_0x4a1efd,null))[_0x9068('0x42')](handleError(_0x4a1efd,null));};exports[_0x9068('0x48')]=function(_0x5ace24,_0x18430f){return db[_0x9068('0x2b')][_0x9068('0x48')](_0x5ace24[_0x9068('0x49')],{})[_0x9068('0x24')](respondWithResult(_0x18430f,0xc9))[_0x9068('0x42')](handleError(_0x18430f,null));};exports[_0x9068('0x4a')]=function(_0x552933,_0x49513f){if(_0x552933['body']['id']){delete _0x552933['body']['id'];}return db['JscriptyAnswerReport'][_0x9068('0x47')]({'where':{'id':_0x552933[_0x9068('0x44')]['id']}})[_0x9068('0x24')](handleEntityNotFound(_0x49513f,null))[_0x9068('0x24')](saveUpdates(_0x552933[_0x9068('0x49')],null))[_0x9068('0x24')](respondWithResult(_0x49513f,null))['catch'](handleError(_0x49513f,null));};exports[_0x9068('0x25')]=function(_0x4cea5d,_0x146964){return db[_0x9068('0x2b')]['find']({'where':{'id':_0x4cea5d[_0x9068('0x44')]['id']}})[_0x9068('0x24')](handleEntityNotFound(_0x146964,null))[_0x9068('0x24')](removeEntity(_0x146964,null))[_0x9068('0x42')](handleError(_0x146964,null));};exports[_0x9068('0x4b')]=function(_0x2a6deb,_0x228f22){return db[_0x9068('0x2b')][_0x9068('0x4b')]()[_0x9068('0x24')](respondWithResult(_0x228f22,null))[_0x9068('0x42')](handleError(_0x228f22,null));}; \ No newline at end of file +var _0x5785=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','index','map','JscriptyAnswerReport','rawAttributes','fieldName','type','query','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','options','includeAll','findAll','rows','catch','show','keys','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5785,0x119));var _0x5578=function(_0x87b0ff,_0x314389){_0x87b0ff=_0x87b0ff-0x0;var _0x3bc0b2=_0x5785[_0x87b0ff];return _0x3bc0b2;};'use strict';var emlformat=require(_0x5578('0x0'));var rimraf=require(_0x5578('0x1'));var zipdir=require(_0x5578('0x2'));var jsonpatch=require(_0x5578('0x3'));var rp=require(_0x5578('0x4'));var moment=require('moment');var BPromise=require(_0x5578('0x5'));var Mustache=require(_0x5578('0x6'));var util=require(_0x5578('0x7'));var path=require(_0x5578('0x8'));var sox=require(_0x5578('0x9'));var csv=require(_0x5578('0xa'));var ejs=require(_0x5578('0xb'));var fs=require('fs');var fs_extra=require(_0x5578('0xc'));var _=require(_0x5578('0xd'));var squel=require(_0x5578('0xe'));var crypto=require('crypto');var jsforce=require(_0x5578('0xf'));var deskjs=require(_0x5578('0x10'));var toCsv=require(_0x5578('0xa'));var querystring=require('querystring');var Papa=require(_0x5578('0x11'));var Redis=require('ioredis');var authService=require(_0x5578('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x5578('0x13'));var hardwareService=require(_0x5578('0x14'));var logger=require(_0x5578('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x5578('0x16'));var licenseUtil=require(_0x5578('0x17'));var db=require(_0x5578('0x18'))['db'];function respondWithStatusCode(_0x1506ac,_0x4592df){_0x4592df=_0x4592df||0xcc;return function(_0xa355d3){if(_0xa355d3){return _0x1506ac[_0x5578('0x19')](_0x4592df);}return _0x1506ac[_0x5578('0x1a')](_0x4592df)[_0x5578('0x1b')]();};}function respondWithResult(_0x34bacc,_0x4f6d2a){_0x4f6d2a=_0x4f6d2a||0xc8;return function(_0xe7ea50){if(_0xe7ea50){return _0x34bacc[_0x5578('0x1a')](_0x4f6d2a)[_0x5578('0x1c')](_0xe7ea50);}};}function respondWithFilteredResult(_0x21df98,_0x44ef23){return function(_0xb8e9c8){if(_0xb8e9c8){var _0x3fa05b=typeof _0x44ef23[_0x5578('0x1d')]===_0x5578('0x1e')&&typeof _0x44ef23[_0x5578('0x1f')]==='undefined';var _0x24b5b1=_0xb8e9c8[_0x5578('0x20')];var _0x5db57a=_0x3fa05b?0x0:_0x44ef23['offset'];var _0x3826b9=_0x3fa05b?_0xb8e9c8[_0x5578('0x20')]:_0x44ef23['offset']+_0x44ef23[_0x5578('0x1f')];var _0x2021b6;if(_0x3826b9>=_0x24b5b1){_0x3826b9=_0x24b5b1;_0x2021b6=0xc8;}else{_0x2021b6=0xce;}_0x21df98[_0x5578('0x1a')](_0x2021b6);return _0x21df98[_0x5578('0x21')](_0x5578('0x22'),_0x5db57a+'-'+_0x3826b9+'/'+_0x24b5b1)[_0x5578('0x1c')](_0xb8e9c8);}return null;};}function patchUpdates(_0x3dfadd){return function(_0x3a6b68){try{jsonpatch[_0x5578('0x23')](_0x3a6b68,_0x3dfadd,!![]);}catch(_0x38d06f){return BPromise[_0x5578('0x24')](_0x38d06f);}return _0x3a6b68[_0x5578('0x25')]();};}function saveUpdates(_0x2542eb,_0x10dd37){return function(_0x5d0a54){if(_0x5d0a54){return _0x5d0a54[_0x5578('0x26')](_0x2542eb)['then'](function(_0x208952){return _0x208952;});}return null;};}function removeEntity(_0x2d57b5,_0x394421){return function(_0x199853){if(_0x199853){return _0x199853[_0x5578('0x27')]()[_0x5578('0x28')](function(){_0x2d57b5['status'](0xcc)[_0x5578('0x1b')]();});}};}function handleEntityNotFound(_0x5d2c0c,_0x4c4d89){return function(_0x16cea){if(!_0x16cea){_0x5d2c0c['sendStatus'](0x194);}return _0x16cea;};}function handleError(_0x1d1861,_0x43adbd){_0x43adbd=_0x43adbd||0x1f4;return function(_0x2a752e){logger['error'](_0x2a752e[_0x5578('0x29')]);if(_0x2a752e[_0x5578('0x2a')]){delete _0x2a752e['name'];}_0x1d1861['status'](_0x43adbd)[_0x5578('0x2b')](_0x2a752e);};}exports[_0x5578('0x2c')]=function(_0x807da6,_0x25fb3b){var _0x44f200={},_0x593423={},_0x2d28d5={'count':0x0,'rows':[]};var _0xbe03a3=_[_0x5578('0x2d')](db[_0x5578('0x2e')][_0x5578('0x2f')],function(_0xe44d1b){return{'name':_0xe44d1b[_0x5578('0x30')],'type':_0xe44d1b[_0x5578('0x31')]['key']};});_0x593423['model']=_['map'](_0xbe03a3,_0x5578('0x2a'));_0x593423['query']=_['keys'](_0x807da6[_0x5578('0x32')]);_0x593423['filters']=_[_0x5578('0x33')](_0x593423[_0x5578('0x34')],_0x593423[_0x5578('0x32')]);_0x44f200[_0x5578('0x35')]=_['intersection'](_0x593423[_0x5578('0x34')],qs[_0x5578('0x36')](_0x807da6[_0x5578('0x32')][_0x5578('0x36')]));_0x44f200['attributes']=_0x44f200[_0x5578('0x35')][_0x5578('0x37')]?_0x44f200[_0x5578('0x35')]:_0x593423['model'];if(!_0x807da6[_0x5578('0x32')][_0x5578('0x38')]('nolimit')){_0x44f200[_0x5578('0x1f')]=qs['limit'](_0x807da6[_0x5578('0x32')][_0x5578('0x1f')]);_0x44f200['offset']=qs[_0x5578('0x1d')](_0x807da6[_0x5578('0x32')][_0x5578('0x1d')]);}_0x44f200[_0x5578('0x39')]=qs['sort'](_0x807da6[_0x5578('0x32')][_0x5578('0x3a')]);_0x44f200[_0x5578('0x3b')]=qs[_0x5578('0x3c')](_['pick'](_0x807da6[_0x5578('0x32')],_0x593423[_0x5578('0x3c')]),_0xbe03a3);if(_0x807da6[_0x5578('0x32')]['filter']){_0x44f200[_0x5578('0x3b')]=_['merge'](_0x44f200['where'],{'$or':_[_0x5578('0x2d')](_0xbe03a3,function(_0x2ee835){if(_0x2ee835[_0x5578('0x31')]!=='VIRTUAL'){var _0x55e2be={};_0x55e2be[_0x2ee835[_0x5578('0x2a')]]={'$like':'%'+_0x807da6[_0x5578('0x32')][_0x5578('0x3d')]+'%'};return _0x55e2be;}})});}_0x44f200=_[_0x5578('0x3e')]({},_0x44f200,_0x807da6[_0x5578('0x3f')]);var _0x5a3c64={'where':_0x44f200['where']};return db[_0x5578('0x2e')]['count'](_0x5a3c64)['then'](function(_0x2084a8){_0x2d28d5[_0x5578('0x20')]=_0x2084a8;if(_0x807da6[_0x5578('0x32')][_0x5578('0x40')]){_0x44f200['include']=[{'all':!![]}];}return db[_0x5578('0x2e')][_0x5578('0x41')](_0x44f200);})[_0x5578('0x28')](function(_0xade035){_0x2d28d5[_0x5578('0x42')]=_0xade035;return _0x2d28d5;})['then'](respondWithFilteredResult(_0x25fb3b,_0x44f200))[_0x5578('0x43')](handleError(_0x25fb3b,null));};exports[_0x5578('0x44')]=function(_0x535fdd,_0x410909){var _0x677d99={'raw':!![],'where':{'id':_0x535fdd['params']['id']}},_0x23ee49={};_0x23ee49[_0x5578('0x34')]=_[_0x5578('0x45')](db[_0x5578('0x2e')][_0x5578('0x2f')]);_0x23ee49['query']=_[_0x5578('0x45')](_0x535fdd[_0x5578('0x32')]);_0x23ee49[_0x5578('0x3c')]=_['intersection'](_0x23ee49['model'],_0x23ee49[_0x5578('0x32')]);_0x677d99[_0x5578('0x35')]=_['intersection'](_0x23ee49[_0x5578('0x34')],qs[_0x5578('0x36')](_0x535fdd[_0x5578('0x32')][_0x5578('0x36')]));_0x677d99[_0x5578('0x35')]=_0x677d99[_0x5578('0x35')][_0x5578('0x37')]?_0x677d99['attributes']:_0x23ee49['model'];if(_0x535fdd[_0x5578('0x32')][_0x5578('0x40')]){_0x677d99['include']=[{'all':!![]}];}_0x677d99=_['merge']({},_0x677d99,_0x535fdd[_0x5578('0x3f')]);return db[_0x5578('0x2e')][_0x5578('0x46')](_0x677d99)[_0x5578('0x28')](handleEntityNotFound(_0x410909,null))[_0x5578('0x28')](respondWithResult(_0x410909,null))[_0x5578('0x43')](handleError(_0x410909,null));};exports['create']=function(_0x5bb12c,_0x2ed4f9){return db[_0x5578('0x2e')][_0x5578('0x47')](_0x5bb12c[_0x5578('0x48')],{})[_0x5578('0x28')](respondWithResult(_0x2ed4f9,0xc9))[_0x5578('0x43')](handleError(_0x2ed4f9,null));};exports['update']=function(_0x1da278,_0x4da7bd){if(_0x1da278[_0x5578('0x48')]['id']){delete _0x1da278['body']['id'];}return db['JscriptyAnswerReport'][_0x5578('0x46')]({'where':{'id':_0x1da278[_0x5578('0x49')]['id']}})[_0x5578('0x28')](handleEntityNotFound(_0x4da7bd,null))['then'](saveUpdates(_0x1da278[_0x5578('0x48')],null))[_0x5578('0x28')](respondWithResult(_0x4da7bd,null))[_0x5578('0x43')](handleError(_0x4da7bd,null));};exports[_0x5578('0x27')]=function(_0x4cc550,_0x34c9fd){return db[_0x5578('0x2e')]['find']({'where':{'id':_0x4cc550[_0x5578('0x49')]['id']}})[_0x5578('0x28')](handleEntityNotFound(_0x34c9fd,null))['then'](removeEntity(_0x34c9fd,null))[_0x5578('0x43')](handleError(_0x34c9fd,null));};exports['describe']=function(_0x8fdb59,_0x205275){return db[_0x5578('0x2e')][_0x5578('0x4a')]()[_0x5578('0x28')](respondWithResult(_0x205275,null))[_0x5578('0x43')](handleError(_0x205275,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 80fb925..bd334a1 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 _0x4457=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','define','JscriptyAnswerReport','util','../../config/logger'];(function(_0x49a0ff,_0x4f8800){var _0x308edf=function(_0x561238){while(--_0x561238){_0x49a0ff['push'](_0x49a0ff['shift']());}};_0x308edf(++_0x4f8800);}(_0x4457,0x82));var _0x7445=function(_0x1b2b02,_0x3e3c49){_0x1b2b02=_0x1b2b02-0x0;var _0x173b44=_0x4457[_0x1b2b02];return _0x173b44;};'use strict';var _=require('lodash');var util=require(_0x7445('0x0'));var logger=require(_0x7445('0x1'))('api');var moment=require(_0x7445('0x2'));var BPromise=require(_0x7445('0x3'));var rp=require(_0x7445('0x4'));var fs=require('fs');var path=require(_0x7445('0x5'));var rimraf=require(_0x7445('0x6'));var config=require(_0x7445('0x7'));var attributes=require(_0x7445('0x8'));module['exports']=function(_0x3b1360,_0x1b9484){return _0x3b1360[_0x7445('0x9')](_0x7445('0xa'),attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb985=['../../config/environment','./jscriptyAnswerReport.attributes','define','JscriptyAnswerReport','report_jscripty_answers','lodash','util','../../config/logger','moment','path'];(function(_0x35339c,_0x3e3a3d){var _0x16bcd1=function(_0x9d36a9){while(--_0x9d36a9){_0x35339c['push'](_0x35339c['shift']());}};_0x16bcd1(++_0x3e3a3d);}(_0xb985,0x1c7));var _0x5b98=function(_0x409deb,_0x2b731){_0x409deb=_0x409deb-0x0;var _0x15a4f7=_0xb985[_0x409deb];return _0x15a4f7;};'use strict';var _=require(_0x5b98('0x0'));var util=require(_0x5b98('0x1'));var logger=require(_0x5b98('0x2'))('api');var moment=require(_0x5b98('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5b98('0x4'));var rimraf=require('rimraf');var config=require(_0x5b98('0x5'));var attributes=require(_0x5b98('0x6'));module['exports']=function(_0x2a1c70,_0x3413dd){return _0x2a1c70[_0x5b98('0x7')](_0x5b98('0x8'),attributes,{'tableName':_0x5b98('0x9'),'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 04bc49a..eedf0e9 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 _0xcd2f=['message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','then','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x4c9854,_0x44531e){var _0x3b78bb=function(_0x677d72){while(--_0x677d72){_0x4c9854['push'](_0x4c9854['shift']());}};_0x3b78bb(++_0x44531e);}(_0xcd2f,0x66));var _0xfcd2=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0xcd2f[_0x164eca];return _0x2ce562;};'use strict';var _=require(_0xfcd2('0x0'));var util=require(_0xfcd2('0x1'));var moment=require(_0xfcd2('0x2'));var BPromise=require(_0xfcd2('0x3'));var rs=require(_0xfcd2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfcd2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xfcd2('0x6'))(_0xfcd2('0x7'));var config=require(_0xfcd2('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xfcd2('0x9')][_0xfcd2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x42ff99,_0xbf04b9,_0x38e62c){return new BPromise(function(_0x1d4a4a,_0x396f3b){return client['request'](_0x42ff99,_0x38e62c)[_0xfcd2('0xb')](function(_0x412183){logger['info'](_0xfcd2('0xc'),_0xbf04b9,_0xfcd2('0xd'));logger[_0xfcd2('0xe')](_0xfcd2('0xf'),_0xbf04b9,_0xfcd2('0xd'),JSON[_0xfcd2('0x10')](_0x412183));if(_0x412183[_0xfcd2('0x11')]){if(_0x412183[_0xfcd2('0x11')]['code']===0x1f4){logger['error'](_0xfcd2('0xc'),_0xbf04b9,_0x412183['error'][_0xfcd2('0x12')]);return _0x396f3b(_0x412183[_0xfcd2('0x11')][_0xfcd2('0x12')]);}logger[_0xfcd2('0x11')](_0xfcd2('0xc'),_0xbf04b9,_0x412183[_0xfcd2('0x11')][_0xfcd2('0x12')]);return _0x1d4a4a(_0x412183[_0xfcd2('0x11')][_0xfcd2('0x12')]);}else{logger['info'](_0xfcd2('0xc'),_0xbf04b9,'request\x20sent');_0x1d4a4a(_0x412183[_0xfcd2('0x13')][_0xfcd2('0x12')]);}})['catch'](function(_0x8948d6){logger[_0xfcd2('0x11')]('JscriptyAnswerReport,\x20%s,\x20%s',_0xbf04b9,_0x8948d6);_0x396f3b(_0x8948d6);});});} \ No newline at end of file +var _0x514d=['catch','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x514d,0xb1));var _0xd514=function(_0x13beca,_0x53b572){_0x13beca=_0x13beca-0x0;var _0x178489=_0x514d[_0x13beca];return _0x178489;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd514('0x0'));var BPromise=require('bluebird');var rs=require(_0xd514('0x1'));var fs=require('fs');var Redis=require(_0xd514('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xd514('0x3'));var logger=require(_0xd514('0x4'))('rpc');var config=require(_0xd514('0x5'));var jayson=require(_0xd514('0x6'));var client=jayson[_0xd514('0x7')][_0xd514('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x115ab3,_0x1d0218,_0x4bcc3e){return new BPromise(function(_0x4e8a01,_0xc6463c){return client[_0xd514('0x9')](_0x115ab3,_0x4bcc3e)[_0xd514('0xa')](function(_0x1480c4){logger[_0xd514('0xb')](_0xd514('0xc'),_0x1d0218,_0xd514('0xd'));logger[_0xd514('0xe')](_0xd514('0xf'),_0x1d0218,'request\x20sent',JSON[_0xd514('0x10')](_0x1480c4));if(_0x1480c4[_0xd514('0x11')]){if(_0x1480c4[_0xd514('0x11')][_0xd514('0x12')]===0x1f4){logger[_0xd514('0x11')](_0xd514('0xc'),_0x1d0218,_0x1480c4[_0xd514('0x11')][_0xd514('0x13')]);return _0xc6463c(_0x1480c4[_0xd514('0x11')][_0xd514('0x13')]);}logger[_0xd514('0x11')](_0xd514('0xc'),_0x1d0218,_0x1480c4[_0xd514('0x11')][_0xd514('0x13')]);return _0x4e8a01(_0x1480c4[_0xd514('0x11')]['message']);}else{logger[_0xd514('0xb')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x1d0218,_0xd514('0xd'));_0x4e8a01(_0x1480c4[_0xd514('0x14')][_0xd514('0x13')]);}})[_0xd514('0x15')](function(_0x166fac){logger[_0xd514('0x11')](_0xd514('0xc'),_0x1d0218,_0x166fac);_0xc6463c(_0x166fac);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index e5f3174..e4af1ca 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 _0x0498=['get','isAuthenticated','index','/:id','show','/:id/sessions','getSessions','getAnswers','getSummary','create','/:id/clone','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x5c0a59,_0x4643d0){var _0x412605=function(_0x38522b){while(--_0x38522b){_0x5c0a59['push'](_0x5c0a59['shift']());}};_0x412605(++_0x4643d0);}(_0x0498,0x196));var _0x8049=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x0498[_0x3e5086];return _0xfeb102;};'use strict';var multer=require('multer');var util=require(_0x8049('0x0'));var path=require(_0x8049('0x1'));var timeout=require(_0x8049('0x2'));var express=require(_0x8049('0x3'));var router=express[_0x8049('0x4')]();var fs_extra=require(_0x8049('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8049('0x6'));var config=require(_0x8049('0x7'));var controller=require('./jscriptyProject.controller');router[_0x8049('0x8')]('/',auth[_0x8049('0x9')](),controller[_0x8049('0xa')]);router[_0x8049('0x8')](_0x8049('0xb'),auth[_0x8049('0x9')](),controller[_0x8049('0xc')]);router[_0x8049('0x8')](_0x8049('0xd'),auth['isAuthenticated'](),controller[_0x8049('0xe')]);router[_0x8049('0x8')]('/:id/answers',auth[_0x8049('0x9')](),controller[_0x8049('0xf')]);router['get']('/:id/summary',auth[_0x8049('0x9')](),timeout('30s'),controller[_0x8049('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x8049('0x11')]);router['post'](_0x8049('0x12'),auth['isAuthenticated'](),controller['clone']);router['put'](_0x8049('0xb'),auth[_0x8049('0x9')](),controller[_0x8049('0x13')]);router[_0x8049('0x14')]('/:id',auth[_0x8049('0x9')](),controller[_0x8049('0x15')]);module[_0x8049('0x16')]=router; \ No newline at end of file +var _0x47d4=['post','/:id/clone','clone','update','delete','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/sessions','getSessions','getAnswers','/:id/summary','30s','getSummary'];(function(_0xdd9664,_0x2ab871){var _0x42e89e=function(_0x4817e9){while(--_0x4817e9){_0xdd9664['push'](_0xdd9664['shift']());}};_0x42e89e(++_0x2ab871);}(_0x47d4,0xff));var _0x447d=function(_0x4d31c9,_0x2fbc37){_0x4d31c9=_0x4d31c9-0x0;var _0x1518d9=_0x47d4[_0x4d31c9];return _0x1518d9;};'use strict';var multer=require(_0x447d('0x0'));var util=require(_0x447d('0x1'));var path=require(_0x447d('0x2'));var timeout=require('connect-timeout');var express=require(_0x447d('0x3'));var router=express[_0x447d('0x4')]();var fs_extra=require(_0x447d('0x5'));var auth=require(_0x447d('0x6'));var interaction=require(_0x447d('0x7'));var config=require(_0x447d('0x8'));var controller=require('./jscriptyProject.controller');router[_0x447d('0x9')]('/',auth[_0x447d('0xa')](),controller[_0x447d('0xb')]);router[_0x447d('0x9')](_0x447d('0xc'),auth[_0x447d('0xa')](),controller[_0x447d('0xd')]);router[_0x447d('0x9')](_0x447d('0xe'),auth[_0x447d('0xa')](),controller[_0x447d('0xf')]);router[_0x447d('0x9')]('/:id/answers',auth['isAuthenticated'](),controller[_0x447d('0x10')]);router[_0x447d('0x9')](_0x447d('0x11'),auth[_0x447d('0xa')](),timeout(_0x447d('0x12')),controller[_0x447d('0x13')]);router[_0x447d('0x14')]('/',auth[_0x447d('0xa')](),controller['create']);router[_0x447d('0x14')](_0x447d('0x15'),auth['isAuthenticated'](),controller[_0x447d('0x16')]);router['put'](_0x447d('0xc'),auth[_0x447d('0xa')](),controller[_0x447d('0x17')]);router[_0x447d('0x18')](_0x447d('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index bde5497..31e8666 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 _0x1b37=['exports','STRING','name','long','isObjectLike','setDataValue','formData','stringify','isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','BOOLEAN','sequelize','lodash','util'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1b37,0x1cd));var _0x71b3=function(_0x4815e2,_0x2097d0){_0x4815e2=_0x4815e2-0x0;var _0x43c670=_0x1b37[_0x4815e2];return _0x43c670;};'use strict';var Sequelize=require(_0x71b3('0x0'));var _=require(_0x71b3('0x1'));var util=require(_0x71b3('0x2'));module[_0x71b3('0x3')]={'name':{'type':Sequelize[_0x71b3('0x4')],'unique':_0x71b3('0x5')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize['TEXT'](_0x71b3('0x6')),'set':function(_0x5d07e0){if(_[_0x71b3('0x7')](_0x5d07e0)){this[_0x71b3('0x8')](_0x71b3('0x9'),JSON[_0x71b3('0xa')](_0x5d07e0));}else if(_[_0x71b3('0xb')](_0x5d07e0)){this['setDataValue'](_0x71b3('0x9'),_0x5d07e0);}else{this['setDataValue'](_0x71b3('0x9'),util[_0x71b3('0xc')](_0x71b3('0xd'),this[_0x71b3('0xe')]('name')||'',this['getDataValue']('description')||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x71b3('0xf')],'defaultValue':![]}}; \ No newline at end of file +var _0xe87f=['BOOLEAN','sequelize','lodash','exports','STRING','name','TEXT','long','isObjectLike','setDataValue','formData','stringify','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description'];(function(_0x17c283,_0x587fcc){var _0x4e0800=function(_0x537bc3){while(--_0x537bc3){_0x17c283['push'](_0x17c283['shift']());}};_0x4e0800(++_0x587fcc);}(_0xe87f,0x151));var _0xfe87=function(_0x2d132d,_0x5a589b){_0x2d132d=_0x2d132d-0x0;var _0x331b85=_0xe87f[_0x2d132d];return _0x331b85;};'use strict';var Sequelize=require(_0xfe87('0x0'));var _=require(_0xfe87('0x1'));var util=require('util');module[_0xfe87('0x2')]={'name':{'type':Sequelize[_0xfe87('0x3')],'unique':_0xfe87('0x4')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0xfe87('0x5')](_0xfe87('0x6')),'set':function(_0x10fe68){if(_[_0xfe87('0x7')](_0x10fe68)){this[_0xfe87('0x8')](_0xfe87('0x9'),JSON[_0xfe87('0xa')](_0x10fe68));}else if(_['isString'](_0x10fe68)){this[_0xfe87('0x8')](_0xfe87('0x9'),_0x10fe68);}else{this[_0xfe87('0x8')](_0xfe87('0x9'),util[_0xfe87('0xb')](_0xfe87('0xc'),this['getDataValue']('name')||'',this[_0xfe87('0xd')](_0xfe87('0xe'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xfe87('0xf')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xfe87('0xf')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index df2f7d5..7edbcae 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 _0x9123=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','Projects','UserProfileResource','destroy','error','name','map','JscriptyProject','rawAttributes','fieldName','type','model','query','attributes','fields','nolimit','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','keys','intersection','length','find','create','body','user','role','get','UserProfileSection','userProfileId','autoAssociation','catch','clone','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findOne','JscriptySessionReport','hasOwnProperty','order','getAnswers','JscriptyAnswerReport','ProjectId','number','fromCharCode','indexOf','toString','getSummary','starttime','JscriptyQuestionReport','-createdAt','questionId','question','format','SessionId','answer','isEmpty','now','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','eml-format','request-promise','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x47eba9,_0xcf5034){var _0x320463=function(_0x2fcb7f){while(--_0x2fcb7f){_0x47eba9['push'](_0x47eba9['shift']());}};_0x320463(++_0xcf5034);}(_0x9123,0x140));var _0x3912=function(_0x52ec1f,_0x1f46ae){_0x52ec1f=_0x52ec1f-0x0;var _0x48766e=_0x9123[_0x52ec1f];return _0x48766e;};'use strict';var emlformat=require(_0x3912('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3912('0x1'));var moment=require('moment');var BPromise=require(_0x3912('0x2'));var Mustache=require(_0x3912('0x3'));var util=require(_0x3912('0x4'));var path=require(_0x3912('0x5'));var sox=require('sox');var csv=require(_0x3912('0x6'));var ejs=require(_0x3912('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x3912('0x8'));var crypto=require(_0x3912('0x9'));var jsforce=require(_0x3912('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x3912('0x6'));var querystring=require(_0x3912('0xb'));var Papa=require(_0x3912('0xc'));var Redis=require(_0x3912('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x3912('0xe'));var as=require(_0x3912('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3912('0x10'))(_0x3912('0x11'));var utils=require(_0x3912('0x12'));var config=require(_0x3912('0x13'));var licenseUtil=require(_0x3912('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x59f22e,_0x475841){_0x475841=_0x475841||0xcc;return function(_0x220215){if(_0x220215){return _0x59f22e[_0x3912('0x15')](_0x475841);}return _0x59f22e['status'](_0x475841)[_0x3912('0x16')]();};}function respondWithResult(_0x2d9986,_0x4bac4a){_0x4bac4a=_0x4bac4a||0xc8;return function(_0x37fdf1){if(_0x37fdf1){return _0x2d9986[_0x3912('0x17')](_0x4bac4a)[_0x3912('0x18')](_0x37fdf1);}};}function respondWithFilteredResult(_0x474fc8,_0x50a76a){return function(_0x1129da){if(_0x1129da){var _0x2b0b8a=typeof _0x50a76a[_0x3912('0x19')]===_0x3912('0x1a')&&typeof _0x50a76a[_0x3912('0x1b')]==='undefined';var _0x23e7a2=_0x1129da[_0x3912('0x1c')];var _0x2e4649=_0x2b0b8a?0x0:_0x50a76a[_0x3912('0x19')];var _0x2b48b1=_0x2b0b8a?_0x1129da['count']:_0x50a76a[_0x3912('0x19')]+_0x50a76a[_0x3912('0x1b')];var _0x135c4a;if(_0x2b48b1>=_0x23e7a2){_0x2b48b1=_0x23e7a2;_0x135c4a=0xc8;}else{_0x135c4a=0xce;}_0x474fc8['status'](_0x135c4a);return _0x474fc8[_0x3912('0x1d')](_0x3912('0x1e'),_0x2e4649+'-'+_0x2b48b1+'/'+_0x23e7a2)[_0x3912('0x18')](_0x1129da);}return null;};}function patchUpdates(_0x3a06ef){return function(_0x344fc3){try{jsonpatch[_0x3912('0x1f')](_0x344fc3,_0x3a06ef,!![]);}catch(_0xc6471f){return BPromise['reject'](_0xc6471f);}return _0x344fc3['save']();};}function saveUpdates(_0x33b507,_0x1a4486){return function(_0x3007c9){if(_0x3007c9){return _0x3007c9[_0x3912('0x20')](_0x33b507)[_0x3912('0x21')](function(_0x11bb54){return _0x11bb54;});}return null;};}function removeEntity(_0x3fd425,_0x40f601){return function(_0x1e21ab){if(_0x1e21ab){return _0x1e21ab['destroy']()[_0x3912('0x21')](function(){var _0x1f5766=_0x1e21ab['get']({'plain':!![]});var _0x2af8cf=_0x3912('0x22');return db[_0x3912('0x23')][_0x3912('0x24')]({'where':{'type':_0x2af8cf,'resourceId':_0x1f5766['id']}})['then'](function(){return _0x1e21ab;});})['then'](function(){_0x3fd425[_0x3912('0x17')](0xcc)[_0x3912('0x16')]();});}};}function handleEntityNotFound(_0x1a4eb1,_0x42f36d){return function(_0x43f9de){if(!_0x43f9de){_0x1a4eb1[_0x3912('0x15')](0x194);}return _0x43f9de;};}function handleError(_0x3abefa,_0x2e51c9){_0x2e51c9=_0x2e51c9||0x1f4;return function(_0x289111){logger[_0x3912('0x25')](_0x289111['stack']);if(_0x289111['name']){delete _0x289111[_0x3912('0x26')];}_0x3abefa[_0x3912('0x17')](_0x2e51c9)['send'](_0x289111);};}exports['index']=function(_0x8d01b6,_0x31c4cf){var _0x26c49c={},_0x596d45={},_0x3da782={'count':0x0,'rows':[]};var _0x38fd42=_[_0x3912('0x27')](db[_0x3912('0x28')][_0x3912('0x29')],function(_0x179144){return{'name':_0x179144[_0x3912('0x2a')],'type':_0x179144[_0x3912('0x2b')]['key']};});_0x596d45[_0x3912('0x2c')]=_[_0x3912('0x27')](_0x38fd42,'name');_0x596d45[_0x3912('0x2d')]=_['keys'](_0x8d01b6[_0x3912('0x2d')]);_0x596d45['filters']=_['intersection'](_0x596d45[_0x3912('0x2c')],_0x596d45['query']);_0x26c49c[_0x3912('0x2e')]=_['intersection'](_0x596d45[_0x3912('0x2c')],qs[_0x3912('0x2f')](_0x8d01b6['query'][_0x3912('0x2f')]));_0x26c49c[_0x3912('0x2e')]=_0x26c49c[_0x3912('0x2e')]['length']?_0x26c49c[_0x3912('0x2e')]:_0x596d45['model'];if(!_0x8d01b6[_0x3912('0x2d')]['hasOwnProperty'](_0x3912('0x30'))){_0x26c49c[_0x3912('0x1b')]=qs[_0x3912('0x1b')](_0x8d01b6[_0x3912('0x2d')][_0x3912('0x1b')]);_0x26c49c[_0x3912('0x19')]=qs[_0x3912('0x19')](_0x8d01b6['query']['offset']);}_0x26c49c['order']=qs[_0x3912('0x31')](_0x8d01b6[_0x3912('0x2d')][_0x3912('0x31')]);_0x26c49c[_0x3912('0x32')]=qs[_0x3912('0x33')](_[_0x3912('0x34')](_0x8d01b6[_0x3912('0x2d')],_0x596d45[_0x3912('0x33')]),_0x38fd42);if(_0x8d01b6[_0x3912('0x2d')][_0x3912('0x35')]){_0x26c49c[_0x3912('0x32')]=_['merge'](_0x26c49c[_0x3912('0x32')],{'$or':_[_0x3912('0x27')](_0x38fd42,function(_0xe257f3){if(_0xe257f3[_0x3912('0x2b')]!==_0x3912('0x36')){var _0x26f48c={};_0x26f48c[_0xe257f3[_0x3912('0x26')]]={'$like':'%'+_0x8d01b6[_0x3912('0x2d')][_0x3912('0x35')]+'%'};return _0x26f48c;}})});}_0x26c49c=_[_0x3912('0x37')]({},_0x26c49c,_0x8d01b6[_0x3912('0x38')]);var _0x5f50ca={'where':_0x26c49c[_0x3912('0x32')]};return db['JscriptyProject'][_0x3912('0x1c')](_0x5f50ca)[_0x3912('0x21')](function(_0x1a02a7){_0x3da782[_0x3912('0x1c')]=_0x1a02a7;if(_0x8d01b6['query'][_0x3912('0x39')]){_0x26c49c[_0x3912('0x3a')]=[{'all':!![]}];}return db['JscriptyProject'][_0x3912('0x3b')](_0x26c49c);})[_0x3912('0x21')](function(_0x4fdee0){_0x3da782[_0x3912('0x3c')]=_0x4fdee0;return _0x3da782;})[_0x3912('0x21')](respondWithFilteredResult(_0x31c4cf,_0x26c49c))['catch'](handleError(_0x31c4cf,null));};exports[_0x3912('0x3d')]=function(_0x294a9a,_0x2df518){var _0x431aad={'raw':![],'where':{'id':_0x294a9a[_0x3912('0x3e')]['id']}},_0x330974={};_0x330974['model']=_[_0x3912('0x3f')](db[_0x3912('0x28')][_0x3912('0x29')]);_0x330974[_0x3912('0x2d')]=_[_0x3912('0x3f')](_0x294a9a[_0x3912('0x2d')]);_0x330974[_0x3912('0x33')]=_[_0x3912('0x40')](_0x330974[_0x3912('0x2c')],_0x330974['query']);_0x431aad['attributes']=_[_0x3912('0x40')](_0x330974['model'],qs[_0x3912('0x2f')](_0x294a9a[_0x3912('0x2d')][_0x3912('0x2f')]));_0x431aad[_0x3912('0x2e')]=_0x431aad[_0x3912('0x2e')][_0x3912('0x41')]?_0x431aad[_0x3912('0x2e')]:_0x330974[_0x3912('0x2c')];if(_0x294a9a[_0x3912('0x2d')]['includeAll']){_0x431aad[_0x3912('0x3a')]=[{'all':!![]}];}_0x431aad=_['merge']({},_0x431aad,_0x294a9a[_0x3912('0x38')]);return db[_0x3912('0x28')][_0x3912('0x42')](_0x431aad)[_0x3912('0x21')](handleEntityNotFound(_0x2df518,null))[_0x3912('0x21')](respondWithResult(_0x2df518,null))['catch'](handleError(_0x2df518,null));};exports[_0x3912('0x43')]=function(_0x6b94df,_0x3dfc03){return db['JscriptyProject'][_0x3912('0x43')](_0x6b94df[_0x3912('0x44')],{})[_0x3912('0x21')](function(_0x4999be){var _0x50f010=_0x6b94df[_0x3912('0x45')]['get']({'plain':!![]});if(!_0x50f010)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x50f010[_0x3912('0x46')]===_0x3912('0x45')){var _0x4e3c08=_0x4999be[_0x3912('0x47')]({'plain':!![]});var _0x4cfdbb=_0x3912('0x22');return db[_0x3912('0x48')]['find']({'where':{'name':_0x4cfdbb,'userProfileId':_0x50f010[_0x3912('0x49')]},'raw':!![]})['then'](function(_0x274532){if(_0x274532&&_0x274532[_0x3912('0x4a')]===0x0){return db[_0x3912('0x23')][_0x3912('0x43')]({'name':_0x4e3c08[_0x3912('0x26')],'resourceId':_0x4e3c08['id'],'type':_0x274532[_0x3912('0x26')],'sectionId':_0x274532['id']},{})['then'](function(){return _0x4999be;});}else{return _0x4999be;}})['catch'](function(_0xb587f0){logger[_0x3912('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xb587f0);throw _0xb587f0;});}return _0x4999be;})[_0x3912('0x21')](respondWithResult(_0x3dfc03,0xc9))[_0x3912('0x4b')](handleError(_0x3dfc03,null));};exports[_0x3912('0x4c')]=function(_0x595b3c,_0x5aed4f){var _0x36c550={'where':{'id':_0x595b3c[_0x3912('0x3e')]['id']}},_0x9ea0d3={};_0x9ea0d3[_0x3912('0x2c')]=_[_0x3912('0x3f')](db[_0x3912('0x28')]['rawAttributes']);_0x36c550[_0x3912('0x2e')]=_[_0x3912('0x40')](_0x9ea0d3[_0x3912('0x2c')],qs[_0x3912('0x2f')](_0x595b3c[_0x3912('0x2d')][_0x3912('0x2f')]));_0x36c550['attributes']=_0x36c550[_0x3912('0x2e')][_0x3912('0x41')]?_0x36c550[_0x3912('0x2e')]:_0x9ea0d3['model'];if(_0x595b3c[_0x3912('0x2d')][_0x3912('0x39')]){_0x36c550[_0x3912('0x3a')]=[{'all':!![]}];}_0x36c550=_[_0x3912('0x37')]({},_0x36c550,_0x595b3c['options']);return db['JscriptyProject'][_0x3912('0x42')](_0x36c550)['then'](handleEntityNotFound(_0x5aed4f,null))[_0x3912('0x21')](function(_0x50a440){if(_0x50a440){var _0x3308f7=_0x50a440[_0x3912('0x47')]({'plain':!![]});_0x3308f7=qs[_0x3912('0x4d')](_0x3308f7,['id',_0x3912('0x4e'),'updatedAt']);_0x595b3c[_0x3912('0x44')]=_[_0x3912('0x4d')](_0x595b3c['body'],['id','createdAt',_0x3912('0x4f')]);return db['JscriptyProject'][_0x3912('0x43')](_[_0x3912('0x37')](_0x3308f7,_0x595b3c[_0x3912('0x44')]),{'include':_0x595b3c['query'][_0x3912('0x39')]?[{'all':!![]}]:undefined})[_0x3912('0x21')](function(_0x464b67){var _0x2f9ebe=_0x595b3c[_0x3912('0x45')][_0x3912('0x47')]({'plain':!![]});if(!_0x2f9ebe)throw new Error(_0x3912('0x50'));if(_0x2f9ebe[_0x3912('0x46')]===_0x3912('0x45')){var _0x2ca713=_0x464b67[_0x3912('0x47')]({'plain':!![]});var _0x59fbc1=_0x3912('0x22');return db[_0x3912('0x48')][_0x3912('0x42')]({'where':{'name':_0x59fbc1,'userProfileId':_0x2f9ebe[_0x3912('0x49')]},'raw':!![]})['then'](function(_0xab13df){if(_0xab13df&&_0xab13df[_0x3912('0x4a')]===0x0){return db[_0x3912('0x23')][_0x3912('0x43')]({'name':_0x2ca713[_0x3912('0x26')],'resourceId':_0x2ca713['id'],'type':_0xab13df[_0x3912('0x26')],'sectionId':_0xab13df['id']},{})['then'](function(){return _0x464b67;});}else{return _0x464b67;}})[_0x3912('0x4b')](function(_0x400ff4){logger[_0x3912('0x25')](_0x3912('0x51'),_0x400ff4);throw _0x400ff4;});}return _0x464b67;});}})['then'](respondWithResult(_0x5aed4f,0xc9))[_0x3912('0x4b')](handleError(_0x5aed4f,null));};exports[_0x3912('0x20')]=function(_0x182df9,_0x357386){if(_0x182df9[_0x3912('0x44')]['id']){delete _0x182df9[_0x3912('0x44')]['id'];}return db['JscriptyProject'][_0x3912('0x42')]({'where':{'id':_0x182df9[_0x3912('0x3e')]['id']}})[_0x3912('0x21')](handleEntityNotFound(_0x357386,null))[_0x3912('0x21')](saveUpdates(_0x182df9['body'],null))['then'](respondWithResult(_0x357386,null))[_0x3912('0x4b')](handleError(_0x357386,null));};exports[_0x3912('0x24')]=function(_0x1086ae,_0x28e40d){return db[_0x3912('0x28')][_0x3912('0x42')]({'where':{'id':_0x1086ae['params']['id']}})[_0x3912('0x21')](handleEntityNotFound(_0x28e40d,null))['then'](removeEntity(_0x28e40d,null))[_0x3912('0x4b')](handleError(_0x28e40d,null));};exports['getSessions']=function(_0x50739d,_0x301a25,_0x8f88b3){var _0x5c11de={'raw':!![],'where':{}};var _0x13ba85={};var _0x484e6d={'count':0x0,'rows':[]};return db[_0x3912('0x28')][_0x3912('0x52')]({'where':{'id':_0x50739d[_0x3912('0x3e')]['id']}})[_0x3912('0x21')](handleEntityNotFound(_0x301a25,null))['then'](function(_0x55c6c1){if(_0x55c6c1){_0x13ba85[_0x3912('0x2c')]=_[_0x3912('0x3f')](db[_0x3912('0x53')][_0x3912('0x29')]);_0x13ba85[_0x3912('0x2d')]=_[_0x3912('0x3f')](_0x50739d[_0x3912('0x2d')]);_0x13ba85[_0x3912('0x33')]=_[_0x3912('0x40')](_0x13ba85[_0x3912('0x2c')],_0x13ba85[_0x3912('0x2d')]);_0x5c11de[_0x3912('0x2e')]=_[_0x3912('0x40')](_0x13ba85[_0x3912('0x2c')],qs['fields'](_0x50739d['query'][_0x3912('0x2f')]));_0x5c11de[_0x3912('0x2e')]=_0x5c11de[_0x3912('0x2e')][_0x3912('0x41')]?_0x5c11de[_0x3912('0x2e')]:_0x13ba85[_0x3912('0x2c')];if(!_0x50739d['query'][_0x3912('0x54')](_0x3912('0x30'))){_0x5c11de[_0x3912('0x1b')]=qs[_0x3912('0x1b')](_0x50739d[_0x3912('0x2d')][_0x3912('0x1b')]);_0x5c11de['offset']=qs[_0x3912('0x19')](_0x50739d[_0x3912('0x2d')][_0x3912('0x19')]);}_0x5c11de[_0x3912('0x55')]=qs[_0x3912('0x31')](_0x50739d[_0x3912('0x2d')][_0x3912('0x31')]);_0x5c11de['where']=qs[_0x3912('0x33')](_['pick'](_0x50739d[_0x3912('0x2d')],_0x13ba85[_0x3912('0x33')]));_0x5c11de[_0x3912('0x32')]['ProjectId']=_0x55c6c1['id'];if(_0x50739d[_0x3912('0x2d')][_0x3912('0x35')]){_0x5c11de['where']=_[_0x3912('0x37')](_0x5c11de[_0x3912('0x32')],{'$or':_[_0x3912('0x27')](_0x5c11de[_0x3912('0x2e')],function(_0x199cd1){var _0x48214a={};_0x48214a[_0x199cd1]={'$like':'%'+_0x50739d[_0x3912('0x2d')]['filter']+'%'};return _0x48214a;})});}_0x5c11de=_[_0x3912('0x37')]({},_0x5c11de,_0x50739d[_0x3912('0x38')]);return db[_0x3912('0x53')]['count']({'where':_0x5c11de[_0x3912('0x32')]})[_0x3912('0x21')](function(_0x272328){_0x484e6d[_0x3912('0x1c')]=_0x272328;if(_0x50739d[_0x3912('0x2d')][_0x3912('0x39')]){_0x5c11de[_0x3912('0x3a')]=[{'all':!![]}];}return db[_0x3912('0x53')][_0x3912('0x3b')](_0x5c11de);})['then'](function(_0x544069){_0x484e6d[_0x3912('0x3c')]=_0x544069;return _0x484e6d;});}})[_0x3912('0x21')](respondWithFilteredResult(_0x301a25,_0x5c11de))[_0x3912('0x4b')](handleError(_0x301a25,null));};exports[_0x3912('0x56')]=function(_0x4f9090,_0x18bb55,_0x552817){var _0x705050={'raw':!![],'where':{}};var _0x57442f={};var _0x469ea6={'count':0x0,'rows':[]};return db[_0x3912('0x28')][_0x3912('0x52')]({'where':{'id':_0x4f9090[_0x3912('0x3e')]['id']}})[_0x3912('0x21')](handleEntityNotFound(_0x18bb55,null))[_0x3912('0x21')](function(_0x3ba483){if(_0x3ba483){_0x57442f[_0x3912('0x2c')]=_[_0x3912('0x3f')](db[_0x3912('0x57')][_0x3912('0x29')]);_0x57442f['query']=_[_0x3912('0x3f')](_0x4f9090[_0x3912('0x2d')]);_0x57442f[_0x3912('0x33')]=_[_0x3912('0x40')](_0x57442f[_0x3912('0x2c')],_0x57442f[_0x3912('0x2d')]);_0x705050['attributes']=_[_0x3912('0x40')](_0x57442f[_0x3912('0x2c')],qs[_0x3912('0x2f')](_0x4f9090['query'][_0x3912('0x2f')]));_0x705050[_0x3912('0x2e')]=_0x705050['attributes']['length']?_0x705050[_0x3912('0x2e')]:_0x57442f[_0x3912('0x2c')];if(!_0x4f9090[_0x3912('0x2d')][_0x3912('0x54')](_0x3912('0x30'))){_0x705050[_0x3912('0x1b')]=qs[_0x3912('0x1b')](_0x4f9090[_0x3912('0x2d')]['limit']);_0x705050[_0x3912('0x19')]=qs[_0x3912('0x19')](_0x4f9090[_0x3912('0x2d')]['offset']);}_0x705050[_0x3912('0x55')]=qs[_0x3912('0x31')](_0x4f9090[_0x3912('0x2d')][_0x3912('0x31')]);_0x705050[_0x3912('0x32')]=qs[_0x3912('0x33')](_['pick'](_0x4f9090[_0x3912('0x2d')],_0x57442f[_0x3912('0x33')]));_0x705050[_0x3912('0x32')][_0x3912('0x58')]=_0x3ba483['id'];if(_0x4f9090['query'][_0x3912('0x35')]){_0x705050[_0x3912('0x32')]=_['merge'](_0x705050[_0x3912('0x32')],{'$or':_['map'](_0x705050[_0x3912('0x2e')],function(_0x2c4216){var _0x31048c={};_0x31048c[_0x2c4216]={'$like':'%'+_0x4f9090[_0x3912('0x2d')][_0x3912('0x35')]+'%'};return _0x31048c;})});}_0x705050=_[_0x3912('0x37')]({},_0x705050,_0x4f9090[_0x3912('0x38')]);return db[_0x3912('0x57')][_0x3912('0x1c')]({'where':_0x705050[_0x3912('0x32')]})[_0x3912('0x21')](function(_0x7612ab){_0x469ea6[_0x3912('0x1c')]=_0x7612ab;if(_0x4f9090[_0x3912('0x2d')]['includeAll']){_0x705050['include']=[{'all':!![]}];}return db[_0x3912('0x57')][_0x3912('0x3b')](_0x705050);})['then'](function(_0x31d472){_0x469ea6['rows']=_0x31d472;return _0x469ea6;});}})[_0x3912('0x21')](respondWithFilteredResult(_0x18bb55,_0x705050))[_0x3912('0x4b')](handleError(_0x18bb55,null));};function char(_0x47d220){return _0x3912('0x59')===typeof _0x47d220?String[_0x3912('0x5a')][_0x3912('0x1f')](null,arguments):_0x47d220;}function needsEncapsulation(_0x33ec77){return!!_0x33ec77&&(_0x33ec77['toString']()[_0x3912('0x5b')](char(0xd))>=0x0||_0x33ec77[_0x3912('0x5c')]()[_0x3912('0x5b')](char(0xa))>=0x0||_0x33ec77[_0x3912('0x5c')]()[_0x3912('0x5b')](char(0x2c))>=0x0||_0x33ec77[_0x3912('0x5c')]()[_0x3912('0x5b')](char(0x22))>=0x0);}function encapsulate(_0x42de94){var _0x3ea2e5=char(0x22),_0x547106='\x5c'+char(0x22),_0x5d9a79=_0x42de94[_0x3912('0x5c')]()['replace'](new RegExp(_0x3ea2e5,'g'),_0x547106);return _0x3ea2e5+_0x5d9a79+_0x3ea2e5;}exports[_0x3912('0x5d')]=function(_0xdba538,_0xd0382c,_0x2cd677){var _0x4a219b,_0x1347a7;var _0x5d422c={'where':{'ProjectId':_0xdba538[_0x3912('0x3e')]['id']}};if(_0xdba538[_0x3912('0x2d')]['startTime']){_0x5d422c['where'][_0x3912('0x5e')]=JSON['parse'](_0xdba538[_0x3912('0x2d')]['startTime']);}return db[_0x3912('0x53')][_0x3912('0x3b')](_0x5d422c)[_0x3912('0x21')](handleEntityNotFound(_0xd0382c,null))['then'](function(_0x54f8ee){if(_0x54f8ee){_0x4a219b=_0x54f8ee;return db[_0x3912('0x5f')]['findAll']({'where':{'SessionId':{'$in':_[_0x3912('0x27')](_0x4a219b,'id')},'ProjectId':_0xdba538['params']['id']},'order':_0x3912('0x60')});}})[_0x3912('0x21')](handleEntityNotFound(_0xd0382c,null))[_0x3912('0x21')](function(_0x57a650){if(_0x57a650){_0x1347a7=_0x57a650;var _0x5e076a={};for(var _0x12ddf1=0x0,_0x416a4a=_0x1347a7['length'];_0x12ddf1<_0x416a4a;_0x12ddf1++){if(!_0x5e076a[_0x3912('0x54')](_0x1347a7[_0x12ddf1][_0x3912('0x61')])){_0x5e076a[_0x1347a7[_0x12ddf1][_0x3912('0x61')]]=needsEncapsulation(_0x1347a7[_0x12ddf1][_0x3912('0x62')])?encapsulate(_0x1347a7[_0x12ddf1][_0x3912('0x62')]):_0x1347a7[_0x12ddf1][_0x3912('0x62')];}}var _0xb2d5c=[],_0x38a1b5={};for(var _0x180339=0x0,_0x286606=_0x4a219b[_0x3912('0x41')];_0x180339<_0x286606;_0x180339++){_0x38a1b5={'ProjectId':_0xdba538[_0x3912('0x3e')]['id'],'SessionId':_0x4a219b[_0x180339]['id'],'StartTime':moment(_0x4a219b[_0x180339][_0x3912('0x5e')])[_0x3912('0x63')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x4ac0c5=0x0,_0x5b9f2d=_0x1347a7[_0x3912('0x41')];_0x4ac0c5<_0x5b9f2d;_0x4ac0c5++){if(_0x1347a7[_0x4ac0c5][_0x3912('0x64')]==_0x4a219b[_0x180339]['id']&&_0x5e076a['hasOwnProperty'](_0x1347a7[_0x4ac0c5][_0x3912('0x61')])){_0x38a1b5[_0x5e076a[_0x1347a7[_0x4ac0c5][_0x3912('0x61')]]]=_0x1347a7[_0x4ac0c5][_0x3912('0x65')];}}for(var _0x1b1bd2 in _0x5e076a){if(!_0x38a1b5[_0x3912('0x54')](_0x5e076a[_0x1b1bd2])){_0x38a1b5[_0x5e076a[_0x1b1bd2]]=null;}}_0xb2d5c['push'](_0x38a1b5);}return _0xb2d5c;}})[_0x3912('0x21')](function(_0x271b4c){if(!_[_0x3912('0x66')](_0x271b4c)){var _0x408c3d=toCsv(_0x271b4c);var _0x702305=Date[_0x3912('0x67')]();fs['writeFileSync'](util[_0x3912('0x63')](_0x3912('0x68'),_0xdba538[_0x3912('0x3e')]['id'],_0x702305),_0x408c3d);_0xd0382c[_0x3912('0x69')](_0x3912('0x6a'),_0x3912('0x6b')+util[_0x3912('0x63')](_0x3912('0x6c'),_0xdba538['params']['id'],_0x702305));_0xd0382c['setHeader'](_0x3912('0x6d'),_0x3912('0x6e'));return _0xd0382c[_0x3912('0x6f')](util['format'](_0x3912('0x68'),_0xdba538['params']['id'],_0x702305));}else{return _0xd0382c['sendStatus'](0xcc);}})[_0x3912('0x4b')](handleError(_0xd0382c,null));}; \ No newline at end of file +var _0xe1e8=['question','format','answer','now','/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','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','then','destroy','get','Projects','UserProfileResource','error','name','send','index','JscriptyProject','rawAttributes','fieldName','type','key','map','keys','filters','intersection','model','query','fields','attributes','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','getSessions','findOne','nolimit','ProjectId','JscriptySessionReport','findAll','getAnswers','JscriptyAnswerReport','pick','number','indexOf','toString','replace','getSummary','startTime','starttime','parse','JscriptyQuestionReport','-createdAt','questionId'];(function(_0x195015,_0x449e01){var _0xcb5d73=function(_0x371aaf){while(--_0x371aaf){_0x195015['push'](_0x195015['shift']());}};_0xcb5d73(++_0x449e01);}(_0xe1e8,0x1cb));var _0x8e1e=function(_0x513501,_0xf8efb6){_0x513501=_0x513501-0x0;var _0x3bbc31=_0xe1e8[_0x513501];return _0x3bbc31;};'use strict';var emlformat=require(_0x8e1e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8e1e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8e1e('0x2'));var BPromise=require(_0x8e1e('0x3'));var Mustache=require(_0x8e1e('0x4'));var util=require(_0x8e1e('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x8e1e('0x6'));var ejs=require(_0x8e1e('0x7'));var fs=require('fs');var fs_extra=require(_0x8e1e('0x8'));var _=require(_0x8e1e('0x9'));var squel=require('squel');var crypto=require(_0x8e1e('0xa'));var jsforce=require(_0x8e1e('0xb'));var deskjs=require(_0x8e1e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8e1e('0xd'));var Redis=require(_0x8e1e('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x8e1e('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8e1e('0x10'));var logger=require(_0x8e1e('0x11'))(_0x8e1e('0x12'));var utils=require(_0x8e1e('0x13'));var config=require(_0x8e1e('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x8e1e('0x15'))['db'];function respondWithStatusCode(_0x206783,_0x3d0265){_0x3d0265=_0x3d0265||0xcc;return function(_0x57919e){if(_0x57919e){return _0x206783[_0x8e1e('0x16')](_0x3d0265);}return _0x206783[_0x8e1e('0x17')](_0x3d0265)[_0x8e1e('0x18')]();};}function respondWithResult(_0x161bb7,_0x5cb057){_0x5cb057=_0x5cb057||0xc8;return function(_0x5b8fd1){if(_0x5b8fd1){return _0x161bb7['status'](_0x5cb057)[_0x8e1e('0x19')](_0x5b8fd1);}};}function respondWithFilteredResult(_0x120903,_0x2d2d4f){return function(_0x1bd383){if(_0x1bd383){var _0xf439a=typeof _0x2d2d4f['offset']==='undefined'&&typeof _0x2d2d4f[_0x8e1e('0x1a')]===_0x8e1e('0x1b');var _0x31a1f4=_0x1bd383[_0x8e1e('0x1c')];var _0x4738f3=_0xf439a?0x0:_0x2d2d4f[_0x8e1e('0x1d')];var _0x5bbfde=_0xf439a?_0x1bd383[_0x8e1e('0x1c')]:_0x2d2d4f[_0x8e1e('0x1d')]+_0x2d2d4f['limit'];var _0x4e9fd4;if(_0x5bbfde>=_0x31a1f4){_0x5bbfde=_0x31a1f4;_0x4e9fd4=0xc8;}else{_0x4e9fd4=0xce;}_0x120903[_0x8e1e('0x17')](_0x4e9fd4);return _0x120903[_0x8e1e('0x1e')](_0x8e1e('0x1f'),_0x4738f3+'-'+_0x5bbfde+'/'+_0x31a1f4)[_0x8e1e('0x19')](_0x1bd383);}return null;};}function patchUpdates(_0x325028){return function(_0xa5c182){try{jsonpatch['apply'](_0xa5c182,_0x325028,!![]);}catch(_0x7ad0a5){return BPromise['reject'](_0x7ad0a5);}return _0xa5c182['save']();};}function saveUpdates(_0x4e2e6d,_0x849b18){return function(_0x342ae1){if(_0x342ae1){return _0x342ae1['update'](_0x4e2e6d)[_0x8e1e('0x20')](function(_0x47972b){return _0x47972b;});}return null;};}function removeEntity(_0x323286,_0x499c31){return function(_0x4e5a22){if(_0x4e5a22){return _0x4e5a22[_0x8e1e('0x21')]()[_0x8e1e('0x20')](function(){var _0x309fbd=_0x4e5a22[_0x8e1e('0x22')]({'plain':!![]});var _0x584bb6=_0x8e1e('0x23');return db[_0x8e1e('0x24')][_0x8e1e('0x21')]({'where':{'type':_0x584bb6,'resourceId':_0x309fbd['id']}})['then'](function(){return _0x4e5a22;});})['then'](function(){_0x323286[_0x8e1e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x170eeb,_0x3e797d){return function(_0x7e733f){if(!_0x7e733f){_0x170eeb[_0x8e1e('0x16')](0x194);}return _0x7e733f;};}function handleError(_0x16ae7d,_0x1fc3da){_0x1fc3da=_0x1fc3da||0x1f4;return function(_0x1764b4){logger[_0x8e1e('0x25')](_0x1764b4['stack']);if(_0x1764b4['name']){delete _0x1764b4[_0x8e1e('0x26')];}_0x16ae7d[_0x8e1e('0x17')](_0x1fc3da)[_0x8e1e('0x27')](_0x1764b4);};}exports[_0x8e1e('0x28')]=function(_0x50dbb9,_0x227fd3){var _0x46caaa={},_0xf88ecb={},_0x17b260={'count':0x0,'rows':[]};var _0x2d5c0e=_['map'](db[_0x8e1e('0x29')][_0x8e1e('0x2a')],function(_0x68e293){return{'name':_0x68e293[_0x8e1e('0x2b')],'type':_0x68e293[_0x8e1e('0x2c')][_0x8e1e('0x2d')]};});_0xf88ecb['model']=_[_0x8e1e('0x2e')](_0x2d5c0e,_0x8e1e('0x26'));_0xf88ecb['query']=_[_0x8e1e('0x2f')](_0x50dbb9['query']);_0xf88ecb[_0x8e1e('0x30')]=_[_0x8e1e('0x31')](_0xf88ecb[_0x8e1e('0x32')],_0xf88ecb[_0x8e1e('0x33')]);_0x46caaa['attributes']=_['intersection'](_0xf88ecb[_0x8e1e('0x32')],qs[_0x8e1e('0x34')](_0x50dbb9[_0x8e1e('0x33')]['fields']));_0x46caaa['attributes']=_0x46caaa[_0x8e1e('0x35')][_0x8e1e('0x36')]?_0x46caaa[_0x8e1e('0x35')]:_0xf88ecb['model'];if(!_0x50dbb9[_0x8e1e('0x33')][_0x8e1e('0x37')]('nolimit')){_0x46caaa[_0x8e1e('0x1a')]=qs[_0x8e1e('0x1a')](_0x50dbb9[_0x8e1e('0x33')]['limit']);_0x46caaa[_0x8e1e('0x1d')]=qs[_0x8e1e('0x1d')](_0x50dbb9[_0x8e1e('0x33')]['offset']);}_0x46caaa[_0x8e1e('0x38')]=qs[_0x8e1e('0x39')](_0x50dbb9[_0x8e1e('0x33')][_0x8e1e('0x39')]);_0x46caaa[_0x8e1e('0x3a')]=qs['filters'](_['pick'](_0x50dbb9[_0x8e1e('0x33')],_0xf88ecb[_0x8e1e('0x30')]),_0x2d5c0e);if(_0x50dbb9[_0x8e1e('0x33')][_0x8e1e('0x3b')]){_0x46caaa[_0x8e1e('0x3a')]=_[_0x8e1e('0x3c')](_0x46caaa[_0x8e1e('0x3a')],{'$or':_[_0x8e1e('0x2e')](_0x2d5c0e,function(_0x3c023b){if(_0x3c023b[_0x8e1e('0x2c')]!==_0x8e1e('0x3d')){var _0x31f2fa={};_0x31f2fa[_0x3c023b[_0x8e1e('0x26')]]={'$like':'%'+_0x50dbb9[_0x8e1e('0x33')][_0x8e1e('0x3b')]+'%'};return _0x31f2fa;}})});}_0x46caaa=_[_0x8e1e('0x3c')]({},_0x46caaa,_0x50dbb9[_0x8e1e('0x3e')]);var _0x37241e={'where':_0x46caaa[_0x8e1e('0x3a')]};return db['JscriptyProject'][_0x8e1e('0x1c')](_0x37241e)['then'](function(_0x28517b){_0x17b260[_0x8e1e('0x1c')]=_0x28517b;if(_0x50dbb9['query'][_0x8e1e('0x3f')]){_0x46caaa[_0x8e1e('0x40')]=[{'all':!![]}];}return db[_0x8e1e('0x29')]['findAll'](_0x46caaa);})[_0x8e1e('0x20')](function(_0x50f510){_0x17b260[_0x8e1e('0x41')]=_0x50f510;return _0x17b260;})['then'](respondWithFilteredResult(_0x227fd3,_0x46caaa))[_0x8e1e('0x42')](handleError(_0x227fd3,null));};exports[_0x8e1e('0x43')]=function(_0x231885,_0x30832a){var _0x36cb1c={'raw':![],'where':{'id':_0x231885[_0x8e1e('0x44')]['id']}},_0x432366={};_0x432366[_0x8e1e('0x32')]=_[_0x8e1e('0x2f')](db[_0x8e1e('0x29')][_0x8e1e('0x2a')]);_0x432366[_0x8e1e('0x33')]=_[_0x8e1e('0x2f')](_0x231885[_0x8e1e('0x33')]);_0x432366[_0x8e1e('0x30')]=_[_0x8e1e('0x31')](_0x432366[_0x8e1e('0x32')],_0x432366[_0x8e1e('0x33')]);_0x36cb1c['attributes']=_['intersection'](_0x432366['model'],qs['fields'](_0x231885['query'][_0x8e1e('0x34')]));_0x36cb1c[_0x8e1e('0x35')]=_0x36cb1c[_0x8e1e('0x35')]['length']?_0x36cb1c[_0x8e1e('0x35')]:_0x432366[_0x8e1e('0x32')];if(_0x231885[_0x8e1e('0x33')]['includeAll']){_0x36cb1c[_0x8e1e('0x40')]=[{'all':!![]}];}_0x36cb1c=_[_0x8e1e('0x3c')]({},_0x36cb1c,_0x231885['options']);return db[_0x8e1e('0x29')][_0x8e1e('0x45')](_0x36cb1c)[_0x8e1e('0x20')](handleEntityNotFound(_0x30832a,null))[_0x8e1e('0x20')](respondWithResult(_0x30832a,null))['catch'](handleError(_0x30832a,null));};exports[_0x8e1e('0x46')]=function(_0x16d169,_0x26a8dd){return db[_0x8e1e('0x29')]['create'](_0x16d169[_0x8e1e('0x47')],{})[_0x8e1e('0x20')](function(_0x5082c6){var _0x3b2275=_0x16d169[_0x8e1e('0x48')][_0x8e1e('0x22')]({'plain':!![]});if(!_0x3b2275)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3b2275[_0x8e1e('0x49')]==='user'){var _0x517dc3=_0x5082c6[_0x8e1e('0x22')]({'plain':!![]});var _0x790457=_0x8e1e('0x23');return db[_0x8e1e('0x4a')][_0x8e1e('0x45')]({'where':{'name':_0x790457,'userProfileId':_0x3b2275[_0x8e1e('0x4b')]},'raw':!![]})[_0x8e1e('0x20')](function(_0x35fffe){if(_0x35fffe&&_0x35fffe[_0x8e1e('0x4c')]===0x0){return db['UserProfileResource'][_0x8e1e('0x46')]({'name':_0x517dc3[_0x8e1e('0x26')],'resourceId':_0x517dc3['id'],'type':_0x35fffe[_0x8e1e('0x26')],'sectionId':_0x35fffe['id']},{})['then'](function(){return _0x5082c6;});}else{return _0x5082c6;}})[_0x8e1e('0x42')](function(_0x4d129c){logger[_0x8e1e('0x25')](_0x8e1e('0x4d'),_0x4d129c);throw _0x4d129c;});}return _0x5082c6;})[_0x8e1e('0x20')](respondWithResult(_0x26a8dd,0xc9))[_0x8e1e('0x42')](handleError(_0x26a8dd,null));};exports[_0x8e1e('0x4e')]=function(_0x3217d3,_0x1808c3){var _0x24ca2a={'where':{'id':_0x3217d3[_0x8e1e('0x44')]['id']}},_0x49146e={};_0x49146e[_0x8e1e('0x32')]=_['keys'](db[_0x8e1e('0x29')]['rawAttributes']);_0x24ca2a[_0x8e1e('0x35')]=_[_0x8e1e('0x31')](_0x49146e[_0x8e1e('0x32')],qs[_0x8e1e('0x34')](_0x3217d3['query'][_0x8e1e('0x34')]));_0x24ca2a[_0x8e1e('0x35')]=_0x24ca2a[_0x8e1e('0x35')][_0x8e1e('0x36')]?_0x24ca2a[_0x8e1e('0x35')]:_0x49146e['model'];if(_0x3217d3[_0x8e1e('0x33')][_0x8e1e('0x3f')]){_0x24ca2a['include']=[{'all':!![]}];}_0x24ca2a=_['merge']({},_0x24ca2a,_0x3217d3[_0x8e1e('0x3e')]);return db[_0x8e1e('0x29')]['find'](_0x24ca2a)[_0x8e1e('0x20')](handleEntityNotFound(_0x1808c3,null))[_0x8e1e('0x20')](function(_0x15704d){if(_0x15704d){var _0xf96bd4=_0x15704d[_0x8e1e('0x22')]({'plain':!![]});_0xf96bd4=qs['omit'](_0xf96bd4,['id',_0x8e1e('0x4f'),'updatedAt']);_0x3217d3[_0x8e1e('0x47')]=_['omit'](_0x3217d3[_0x8e1e('0x47')],['id',_0x8e1e('0x4f'),'updatedAt']);return db[_0x8e1e('0x29')][_0x8e1e('0x46')](_[_0x8e1e('0x3c')](_0xf96bd4,_0x3217d3[_0x8e1e('0x47')]),{'include':_0x3217d3[_0x8e1e('0x33')]['includeAll']?[{'all':!![]}]:undefined})[_0x8e1e('0x20')](function(_0xf8abf4){var _0x2dfab2=_0x3217d3[_0x8e1e('0x48')][_0x8e1e('0x22')]({'plain':!![]});if(!_0x2dfab2)throw new Error(_0x8e1e('0x50'));if(_0x2dfab2[_0x8e1e('0x49')]===_0x8e1e('0x48')){var _0xfbf6f2=_0xf8abf4[_0x8e1e('0x22')]({'plain':!![]});var _0x4bb833=_0x8e1e('0x23');return db[_0x8e1e('0x4a')][_0x8e1e('0x45')]({'where':{'name':_0x4bb833,'userProfileId':_0x2dfab2[_0x8e1e('0x4b')]},'raw':!![]})[_0x8e1e('0x20')](function(_0x4b4c25){if(_0x4b4c25&&_0x4b4c25[_0x8e1e('0x4c')]===0x0){return db['UserProfileResource']['create']({'name':_0xfbf6f2['name'],'resourceId':_0xfbf6f2['id'],'type':_0x4b4c25[_0x8e1e('0x26')],'sectionId':_0x4b4c25['id']},{})[_0x8e1e('0x20')](function(){return _0xf8abf4;});}else{return _0xf8abf4;}})[_0x8e1e('0x42')](function(_0x75b23d){logger[_0x8e1e('0x25')](_0x8e1e('0x4d'),_0x75b23d);throw _0x75b23d;});}return _0xf8abf4;});}})[_0x8e1e('0x20')](respondWithResult(_0x1808c3,0xc9))[_0x8e1e('0x42')](handleError(_0x1808c3,null));};exports['update']=function(_0x14dc1d,_0x13f752){if(_0x14dc1d[_0x8e1e('0x47')]['id']){delete _0x14dc1d[_0x8e1e('0x47')]['id'];}return db[_0x8e1e('0x29')]['find']({'where':{'id':_0x14dc1d[_0x8e1e('0x44')]['id']}})[_0x8e1e('0x20')](handleEntityNotFound(_0x13f752,null))['then'](saveUpdates(_0x14dc1d['body'],null))[_0x8e1e('0x20')](respondWithResult(_0x13f752,null))[_0x8e1e('0x42')](handleError(_0x13f752,null));};exports[_0x8e1e('0x21')]=function(_0x1543fc,_0x53650b){return db[_0x8e1e('0x29')][_0x8e1e('0x45')]({'where':{'id':_0x1543fc[_0x8e1e('0x44')]['id']}})[_0x8e1e('0x20')](handleEntityNotFound(_0x53650b,null))[_0x8e1e('0x20')](removeEntity(_0x53650b,null))[_0x8e1e('0x42')](handleError(_0x53650b,null));};exports[_0x8e1e('0x51')]=function(_0x36a7a9,_0x11c324,_0x3c2d74){var _0x206a58={'raw':!![],'where':{}};var _0x4e8e35={};var _0x273d3f={'count':0x0,'rows':[]};return db[_0x8e1e('0x29')][_0x8e1e('0x52')]({'where':{'id':_0x36a7a9[_0x8e1e('0x44')]['id']}})[_0x8e1e('0x20')](handleEntityNotFound(_0x11c324,null))[_0x8e1e('0x20')](function(_0x228993){if(_0x228993){_0x4e8e35[_0x8e1e('0x32')]=_[_0x8e1e('0x2f')](db['JscriptySessionReport'][_0x8e1e('0x2a')]);_0x4e8e35[_0x8e1e('0x33')]=_[_0x8e1e('0x2f')](_0x36a7a9[_0x8e1e('0x33')]);_0x4e8e35[_0x8e1e('0x30')]=_['intersection'](_0x4e8e35[_0x8e1e('0x32')],_0x4e8e35[_0x8e1e('0x33')]);_0x206a58['attributes']=_['intersection'](_0x4e8e35[_0x8e1e('0x32')],qs[_0x8e1e('0x34')](_0x36a7a9[_0x8e1e('0x33')]['fields']));_0x206a58[_0x8e1e('0x35')]=_0x206a58[_0x8e1e('0x35')]['length']?_0x206a58[_0x8e1e('0x35')]:_0x4e8e35[_0x8e1e('0x32')];if(!_0x36a7a9[_0x8e1e('0x33')][_0x8e1e('0x37')](_0x8e1e('0x53'))){_0x206a58[_0x8e1e('0x1a')]=qs[_0x8e1e('0x1a')](_0x36a7a9[_0x8e1e('0x33')]['limit']);_0x206a58[_0x8e1e('0x1d')]=qs[_0x8e1e('0x1d')](_0x36a7a9[_0x8e1e('0x33')][_0x8e1e('0x1d')]);}_0x206a58[_0x8e1e('0x38')]=qs[_0x8e1e('0x39')](_0x36a7a9['query']['sort']);_0x206a58['where']=qs[_0x8e1e('0x30')](_['pick'](_0x36a7a9[_0x8e1e('0x33')],_0x4e8e35[_0x8e1e('0x30')]));_0x206a58['where'][_0x8e1e('0x54')]=_0x228993['id'];if(_0x36a7a9[_0x8e1e('0x33')][_0x8e1e('0x3b')]){_0x206a58[_0x8e1e('0x3a')]=_[_0x8e1e('0x3c')](_0x206a58[_0x8e1e('0x3a')],{'$or':_['map'](_0x206a58[_0x8e1e('0x35')],function(_0x12e927){var _0x2b8ee5={};_0x2b8ee5[_0x12e927]={'$like':'%'+_0x36a7a9[_0x8e1e('0x33')]['filter']+'%'};return _0x2b8ee5;})});}_0x206a58=_['merge']({},_0x206a58,_0x36a7a9['options']);return db[_0x8e1e('0x55')][_0x8e1e('0x1c')]({'where':_0x206a58[_0x8e1e('0x3a')]})['then'](function(_0x404323){_0x273d3f[_0x8e1e('0x1c')]=_0x404323;if(_0x36a7a9[_0x8e1e('0x33')][_0x8e1e('0x3f')]){_0x206a58[_0x8e1e('0x40')]=[{'all':!![]}];}return db[_0x8e1e('0x55')][_0x8e1e('0x56')](_0x206a58);})[_0x8e1e('0x20')](function(_0x33cc24){_0x273d3f[_0x8e1e('0x41')]=_0x33cc24;return _0x273d3f;});}})[_0x8e1e('0x20')](respondWithFilteredResult(_0x11c324,_0x206a58))[_0x8e1e('0x42')](handleError(_0x11c324,null));};exports[_0x8e1e('0x57')]=function(_0x45638b,_0x242c23,_0x52a36a){var _0x4069d0={'raw':!![],'where':{}};var _0x2ad075={};var _0x35f24e={'count':0x0,'rows':[]};return db['JscriptyProject']['findOne']({'where':{'id':_0x45638b[_0x8e1e('0x44')]['id']}})[_0x8e1e('0x20')](handleEntityNotFound(_0x242c23,null))['then'](function(_0x4c142e){if(_0x4c142e){_0x2ad075[_0x8e1e('0x32')]=_['keys'](db[_0x8e1e('0x58')][_0x8e1e('0x2a')]);_0x2ad075['query']=_[_0x8e1e('0x2f')](_0x45638b[_0x8e1e('0x33')]);_0x2ad075[_0x8e1e('0x30')]=_[_0x8e1e('0x31')](_0x2ad075['model'],_0x2ad075[_0x8e1e('0x33')]);_0x4069d0[_0x8e1e('0x35')]=_['intersection'](_0x2ad075[_0x8e1e('0x32')],qs['fields'](_0x45638b[_0x8e1e('0x33')][_0x8e1e('0x34')]));_0x4069d0['attributes']=_0x4069d0['attributes'][_0x8e1e('0x36')]?_0x4069d0['attributes']:_0x2ad075['model'];if(!_0x45638b['query'][_0x8e1e('0x37')](_0x8e1e('0x53'))){_0x4069d0['limit']=qs[_0x8e1e('0x1a')](_0x45638b[_0x8e1e('0x33')][_0x8e1e('0x1a')]);_0x4069d0[_0x8e1e('0x1d')]=qs[_0x8e1e('0x1d')](_0x45638b[_0x8e1e('0x33')][_0x8e1e('0x1d')]);}_0x4069d0[_0x8e1e('0x38')]=qs['sort'](_0x45638b[_0x8e1e('0x33')][_0x8e1e('0x39')]);_0x4069d0[_0x8e1e('0x3a')]=qs[_0x8e1e('0x30')](_[_0x8e1e('0x59')](_0x45638b[_0x8e1e('0x33')],_0x2ad075['filters']));_0x4069d0[_0x8e1e('0x3a')]['ProjectId']=_0x4c142e['id'];if(_0x45638b[_0x8e1e('0x33')]['filter']){_0x4069d0[_0x8e1e('0x3a')]=_['merge'](_0x4069d0['where'],{'$or':_['map'](_0x4069d0['attributes'],function(_0x350768){var _0x283956={};_0x283956[_0x350768]={'$like':'%'+_0x45638b['query'][_0x8e1e('0x3b')]+'%'};return _0x283956;})});}_0x4069d0=_[_0x8e1e('0x3c')]({},_0x4069d0,_0x45638b[_0x8e1e('0x3e')]);return db[_0x8e1e('0x58')][_0x8e1e('0x1c')]({'where':_0x4069d0[_0x8e1e('0x3a')]})[_0x8e1e('0x20')](function(_0x14170f){_0x35f24e[_0x8e1e('0x1c')]=_0x14170f;if(_0x45638b[_0x8e1e('0x33')]['includeAll']){_0x4069d0[_0x8e1e('0x40')]=[{'all':!![]}];}return db[_0x8e1e('0x58')][_0x8e1e('0x56')](_0x4069d0);})[_0x8e1e('0x20')](function(_0x5b999e){_0x35f24e[_0x8e1e('0x41')]=_0x5b999e;return _0x35f24e;});}})[_0x8e1e('0x20')](respondWithFilteredResult(_0x242c23,_0x4069d0))[_0x8e1e('0x42')](handleError(_0x242c23,null));};function char(_0x10ab36){return _0x8e1e('0x5a')===typeof _0x10ab36?String['fromCharCode']['apply'](null,arguments):_0x10ab36;}function needsEncapsulation(_0x4bbdef){return!!_0x4bbdef&&(_0x4bbdef['toString']()[_0x8e1e('0x5b')](char(0xd))>=0x0||_0x4bbdef[_0x8e1e('0x5c')]()[_0x8e1e('0x5b')](char(0xa))>=0x0||_0x4bbdef[_0x8e1e('0x5c')]()['indexOf'](char(0x2c))>=0x0||_0x4bbdef['toString']()[_0x8e1e('0x5b')](char(0x22))>=0x0);}function encapsulate(_0x12e50e){var _0x6c8aad=char(0x22),_0x31eaef='\x5c'+char(0x22),_0x21d4ed=_0x12e50e['toString']()[_0x8e1e('0x5d')](new RegExp(_0x6c8aad,'g'),_0x31eaef);return _0x6c8aad+_0x21d4ed+_0x6c8aad;}exports[_0x8e1e('0x5e')]=function(_0x7a2c95,_0x1789b4,_0x4ce905){var _0x12c416,_0xe659d7;var _0x1b1092={'where':{'ProjectId':_0x7a2c95[_0x8e1e('0x44')]['id']}};if(_0x7a2c95['query'][_0x8e1e('0x5f')]){_0x1b1092[_0x8e1e('0x3a')][_0x8e1e('0x60')]=JSON[_0x8e1e('0x61')](_0x7a2c95[_0x8e1e('0x33')][_0x8e1e('0x5f')]);}return db[_0x8e1e('0x55')][_0x8e1e('0x56')](_0x1b1092)[_0x8e1e('0x20')](handleEntityNotFound(_0x1789b4,null))[_0x8e1e('0x20')](function(_0xe6ba8c){if(_0xe6ba8c){_0x12c416=_0xe6ba8c;return db[_0x8e1e('0x62')][_0x8e1e('0x56')]({'where':{'SessionId':{'$in':_[_0x8e1e('0x2e')](_0x12c416,'id')},'ProjectId':_0x7a2c95[_0x8e1e('0x44')]['id']},'order':_0x8e1e('0x63')});}})[_0x8e1e('0x20')](handleEntityNotFound(_0x1789b4,null))[_0x8e1e('0x20')](function(_0x4aea17){if(_0x4aea17){_0xe659d7=_0x4aea17;var _0x1ac36c={};for(var _0x43a392=0x0,_0x202177=_0xe659d7[_0x8e1e('0x36')];_0x43a392<_0x202177;_0x43a392++){if(!_0x1ac36c[_0x8e1e('0x37')](_0xe659d7[_0x43a392][_0x8e1e('0x64')])){_0x1ac36c[_0xe659d7[_0x43a392][_0x8e1e('0x64')]]=needsEncapsulation(_0xe659d7[_0x43a392]['question'])?encapsulate(_0xe659d7[_0x43a392][_0x8e1e('0x65')]):_0xe659d7[_0x43a392]['question'];}}var _0x15250f=[],_0x3e840a={};for(var _0x4a83bf=0x0,_0x5d6f2a=_0x12c416[_0x8e1e('0x36')];_0x4a83bf<_0x5d6f2a;_0x4a83bf++){_0x3e840a={'ProjectId':_0x7a2c95[_0x8e1e('0x44')]['id'],'SessionId':_0x12c416[_0x4a83bf]['id'],'StartTime':moment(_0x12c416[_0x4a83bf][_0x8e1e('0x60')])[_0x8e1e('0x66')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x3c88a0=0x0,_0x5a87c8=_0xe659d7[_0x8e1e('0x36')];_0x3c88a0<_0x5a87c8;_0x3c88a0++){if(_0xe659d7[_0x3c88a0]['SessionId']==_0x12c416[_0x4a83bf]['id']&&_0x1ac36c[_0x8e1e('0x37')](_0xe659d7[_0x3c88a0][_0x8e1e('0x64')])){_0x3e840a[_0x1ac36c[_0xe659d7[_0x3c88a0][_0x8e1e('0x64')]]]=_0xe659d7[_0x3c88a0][_0x8e1e('0x67')];}}for(var _0x5a7521 in _0x1ac36c){if(!_0x3e840a['hasOwnProperty'](_0x1ac36c[_0x5a7521])){_0x3e840a[_0x1ac36c[_0x5a7521]]=null;}}_0x15250f['push'](_0x3e840a);}return _0x15250f;}})[_0x8e1e('0x20')](function(_0x52d06b){if(!_['isEmpty'](_0x52d06b)){var _0x171a7c=toCsv(_0x52d06b);var _0x2f626c=Date[_0x8e1e('0x68')]();fs['writeFileSync'](util['format'](_0x8e1e('0x69'),_0x7a2c95[_0x8e1e('0x44')]['id'],_0x2f626c),_0x171a7c);_0x1789b4[_0x8e1e('0x6a')]('Content-disposition',_0x8e1e('0x6b')+util[_0x8e1e('0x66')](_0x8e1e('0x6c'),_0x7a2c95[_0x8e1e('0x44')]['id'],_0x2f626c));_0x1789b4['setHeader'](_0x8e1e('0x6d'),_0x8e1e('0x6e'));return _0x1789b4[_0x8e1e('0x6f')](util[_0x8e1e('0x66')](_0x8e1e('0x69'),_0x7a2c95['params']['id'],_0x2f626c));}else{return _0x1789b4[_0x8e1e('0x16')](0xcc);}})['catch'](handleError(_0x1789b4,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 55d1482..a347bde 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 _0x2f74=['define','JscriptyProject','jscripty_projects','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3c6e9b,_0x3e58e1){var _0x28db52=function(_0x125682){while(--_0x125682){_0x3c6e9b['push'](_0x3c6e9b['shift']());}};_0x28db52(++_0x3e58e1);}(_0x2f74,0x7b));var _0x42f7=function(_0x5b78fe,_0x44542c){_0x5b78fe=_0x5b78fe-0x0;var _0x24ac3c=_0x2f74[_0x5b78fe];return _0x24ac3c;};'use strict';var _=require(_0x42f7('0x0'));var util=require('util');var logger=require(_0x42f7('0x1'))(_0x42f7('0x2'));var moment=require(_0x42f7('0x3'));var BPromise=require(_0x42f7('0x4'));var rp=require(_0x42f7('0x5'));var fs=require('fs');var path=require(_0x42f7('0x6'));var rimraf=require(_0x42f7('0x7'));var config=require(_0x42f7('0x8'));var attributes=require('./jscriptyProject.attributes');module['exports']=function(_0x540e53,_0x250aa9){return _0x540e53[_0x42f7('0x9')](_0x42f7('0xa'),attributes,{'tableName':_0x42f7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x038b=['jscripty_projects','util','../../config/logger','api','bluebird','path','rimraf','./jscriptyProject.attributes','exports','define','JscriptyProject'];(function(_0x1ef875,_0x268372){var _0xd56da=function(_0x25d0ff){while(--_0x25d0ff){_0x1ef875['push'](_0x1ef875['shift']());}};_0xd56da(++_0x268372);}(_0x038b,0x114));var _0xb038=function(_0x24f81e,_0x2f144b){_0x24f81e=_0x24f81e-0x0;var _0x38e098=_0x038b[_0x24f81e];return _0x38e098;};'use strict';var _=require('lodash');var util=require(_0xb038('0x0'));var logger=require(_0xb038('0x1'))(_0xb038('0x2'));var moment=require('moment');var BPromise=require(_0xb038('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb038('0x4'));var rimraf=require(_0xb038('0x5'));var config=require('../../config/environment');var attributes=require(_0xb038('0x6'));module[_0xb038('0x7')]=function(_0x4fe092,_0x54e1e7){return _0x4fe092[_0xb038('0x8')](_0xb038('0x9'),attributes,{'tableName':_0xb038('0xa'),'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 fdccc66..1608b71 100644 --- a/server/api/jscriptyProject/jscriptyProject.rpc.js +++ b/server/api/jscriptyProject/jscriptyProject.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbdb7=['request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','info','JscriptyProject,\x20%s,\x20%s'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x2e9b61,_0x2120cf){_0x2e9b61=_0x2e9b61-0x0;var _0x597ccd=_0xbdb7[_0x2e9b61];return _0x597ccd;};'use strict';var _=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var moment=require(_0x7bdb('0x2'));var BPromise=require(_0x7bdb('0x3'));var rs=require(_0x7bdb('0x4'));var fs=require('fs');var Redis=require(_0x7bdb('0x5'));var db=require(_0x7bdb('0x6'))['db'];var utils=require(_0x7bdb('0x7'));var logger=require(_0x7bdb('0x8'))('rpc');var config=require(_0x7bdb('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7bdb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e23a3,_0x493bde,_0x513cba){return new BPromise(function(_0x468041,_0x11a877){return client['request'](_0x1e23a3,_0x513cba)['then'](function(_0xdc2ffc){logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));logger[_0x7bdb('0xe')](_0x7bdb('0xf'),_0x493bde,_0x7bdb('0xd'),JSON[_0x7bdb('0x10')](_0xdc2ffc));if(_0xdc2ffc['error']){if(_0xdc2ffc['error']['code']===0x1f4){logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error'][_0x7bdb('0x12')]);return _0x11a877(_0xdc2ffc['error']['message']);}logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error']['message']);return _0x468041(_0xdc2ffc['error'][_0x7bdb('0x12')]);}else{logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));_0x468041(_0xdc2ffc[_0x7bdb('0x13')][_0x7bdb('0x12')]);}})[_0x7bdb('0x14')](function(_0x1b2d9b){logger['error'](_0x7bdb('0xc'),_0x493bde,_0x1b2d9b);_0x11a877(_0x1b2d9b);});});} \ No newline at end of file +var _0x70e0=['code','JscriptyProject,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x1cd2cb,_0x42c934){var _0x42d780=function(_0xdd2bb1){while(--_0xdd2bb1){_0x1cd2cb['push'](_0x1cd2cb['shift']());}};_0x42d780(++_0x42c934);}(_0x70e0,0x17b));var _0x070e=function(_0x4428e7,_0x55d1e9){_0x4428e7=_0x4428e7-0x0;var _0x40f90d=_0x70e0[_0x4428e7];return _0x40f90d;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('JscriptyProject,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('JscriptyProject,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index d66ef4b..2162060 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 _0xee00=['util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','/:id','post','create','put','delete','destroy','exports','multer'];(function(_0x4a0f2d,_0x3dac24){var _0xb6cdde=function(_0x791eab){while(--_0x791eab){_0x4a0f2d['push'](_0x4a0f2d['shift']());}};_0xb6cdde(++_0x3dac24);}(_0xee00,0x7d));var _0x0ee0=function(_0x2629ce,_0x2f7685){_0x2629ce=_0x2629ce-0x0;var _0x10c9db=_0xee00[_0x2629ce];return _0x10c9db;};'use strict';var multer=require(_0x0ee0('0x0'));var util=require(_0x0ee0('0x1'));var path=require('path');var timeout=require(_0x0ee0('0x2'));var express=require('express');var router=express[_0x0ee0('0x3')]();var fs_extra=require(_0x0ee0('0x4'));var auth=require(_0x0ee0('0x5'));var interaction=require(_0x0ee0('0x6'));var config=require(_0x0ee0('0x7'));var controller=require('./jscriptyQuestionReport.controller');router[_0x0ee0('0x8')]('/',auth[_0x0ee0('0x9')](),controller['index']);router[_0x0ee0('0x8')]('/describe',auth[_0x0ee0('0x9')](),controller[_0x0ee0('0xa')]);router[_0x0ee0('0x8')](_0x0ee0('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x0ee0('0xc')]('/',auth[_0x0ee0('0x9')](),controller[_0x0ee0('0xd')]);router[_0x0ee0('0xe')](_0x0ee0('0xb'),auth[_0x0ee0('0x9')](),controller['update']);router[_0x0ee0('0xf')](_0x0ee0('0xb'),auth['isAuthenticated'](),controller[_0x0ee0('0x10')]);module[_0x0ee0('0x11')]=router; \ No newline at end of file +var _0xd3ed=['get','/describe','isAuthenticated','describe','/:id','show','create','put','update','delete','exports','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','index'];(function(_0x5cffa9,_0x28767d){var _0x5a9b46=function(_0x3d4157){while(--_0x3d4157){_0x5cffa9['push'](_0x5cffa9['shift']());}};_0x5a9b46(++_0x28767d);}(_0xd3ed,0xef));var _0xdd3e=function(_0x119806,_0x35cd79){_0x119806=_0x119806-0x0;var _0x3b64ee=_0xd3ed[_0x119806];return _0x3b64ee;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xdd3e('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xdd3e('0x1')]();var fs_extra=require(_0xdd3e('0x2'));var auth=require(_0xdd3e('0x3'));var interaction=require(_0xdd3e('0x4'));var config=require(_0xdd3e('0x5'));var controller=require(_0xdd3e('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xdd3e('0x7')]);router[_0xdd3e('0x8')](_0xdd3e('0x9'),auth[_0xdd3e('0xa')](),controller[_0xdd3e('0xb')]);router[_0xdd3e('0x8')](_0xdd3e('0xc'),auth['isAuthenticated'](),controller[_0xdd3e('0xd')]);router['post']('/',auth[_0xdd3e('0xa')](),controller[_0xdd3e('0xe')]);router[_0xdd3e('0xf')]('/:id',auth[_0xdd3e('0xa')](),controller[_0xdd3e('0x10')]);router[_0xdd3e('0x11')](_0xdd3e('0xc'),auth[_0xdd3e('0xa')](),controller['destroy']);module[_0xdd3e('0x12')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 0e816e4..7fee193 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(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x7a54,0x106));var _0x47a5=function(_0x3dcc11,_0x465866){_0x3dcc11=_0x3dcc11-0x0;var _0x338b9e=_0x7a54[_0x3dcc11];return _0x338b9e;};'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(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x7a54,0x106));var _0x47a5=function(_0x305473,_0x242d02){_0x305473=_0x305473-0x0;var _0x342839=_0x7a54[_0x305473];return _0x342839;};'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 ac41e69..f5eac9b 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 _0x5d66=['filters','filter','where','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','fields','include','options','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','limit','count','Content-Range','reject','save','update','then','destroy','error','stack','name','send','map','JscriptyQuestionReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','length','hasOwnProperty','sort','pick'];(function(_0x40e0f7,_0x465e99){var _0x3f3f1d=function(_0x2e7260){while(--_0x2e7260){_0x40e0f7['push'](_0x40e0f7['shift']());}};_0x3f3f1d(++_0x465e99);}(_0x5d66,0xea));var _0x65d6=function(_0x1f05a1,_0x10ae66){_0x1f05a1=_0x1f05a1-0x0;var _0x2a52c5=_0x5d66[_0x1f05a1];return _0x2a52c5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x65d6('0x0'));var zipdir=require(_0x65d6('0x1'));var jsonpatch=require(_0x65d6('0x2'));var rp=require(_0x65d6('0x3'));var moment=require(_0x65d6('0x4'));var BPromise=require(_0x65d6('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x65d6('0x6'));var sox=require(_0x65d6('0x7'));var csv=require('to-csv');var ejs=require(_0x65d6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x65d6('0x9'));var squel=require('squel');var crypto=require(_0x65d6('0xa'));var jsforce=require(_0x65d6('0xb'));var deskjs=require(_0x65d6('0xc'));var toCsv=require(_0x65d6('0xd'));var querystring=require('querystring');var Papa=require(_0x65d6('0xe'));var Redis=require(_0x65d6('0xf'));var authService=require(_0x65d6('0x10'));var qs=require(_0x65d6('0x11'));var as=require(_0x65d6('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x65d6('0x13'))('api');var utils=require(_0x65d6('0x14'));var config=require(_0x65d6('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4fdc59,_0x55fc39){_0x55fc39=_0x55fc39||0xcc;return function(_0x3535f9){if(_0x3535f9){return _0x4fdc59[_0x65d6('0x16')](_0x55fc39);}return _0x4fdc59[_0x65d6('0x17')](_0x55fc39)[_0x65d6('0x18')]();};}function respondWithResult(_0x392525,_0x125ec4){_0x125ec4=_0x125ec4||0xc8;return function(_0x196a7d){if(_0x196a7d){return _0x392525[_0x65d6('0x17')](_0x125ec4)[_0x65d6('0x19')](_0x196a7d);}};}function respondWithFilteredResult(_0x85c3cc,_0x306ebf){return function(_0x558c1e){if(_0x558c1e){var _0x317f50=typeof _0x306ebf[_0x65d6('0x1a')]==='undefined'&&typeof _0x306ebf[_0x65d6('0x1b')]==='undefined';var _0x2100f8=_0x558c1e[_0x65d6('0x1c')];var _0x5f3c84=_0x317f50?0x0:_0x306ebf[_0x65d6('0x1a')];var _0x34bdbd=_0x317f50?_0x558c1e[_0x65d6('0x1c')]:_0x306ebf[_0x65d6('0x1a')]+_0x306ebf[_0x65d6('0x1b')];var _0x1752a6;if(_0x34bdbd>=_0x2100f8){_0x34bdbd=_0x2100f8;_0x1752a6=0xc8;}else{_0x1752a6=0xce;}_0x85c3cc['status'](_0x1752a6);return _0x85c3cc['set'](_0x65d6('0x1d'),_0x5f3c84+'-'+_0x34bdbd+'/'+_0x2100f8)[_0x65d6('0x19')](_0x558c1e);}return null;};}function patchUpdates(_0x5b98bf){return function(_0x4c3eff){try{jsonpatch['apply'](_0x4c3eff,_0x5b98bf,!![]);}catch(_0x21feef){return BPromise[_0x65d6('0x1e')](_0x21feef);}return _0x4c3eff[_0x65d6('0x1f')]();};}function saveUpdates(_0x56b166,_0x14d6c6){return function(_0x1e9e04){if(_0x1e9e04){return _0x1e9e04[_0x65d6('0x20')](_0x56b166)[_0x65d6('0x21')](function(_0x3fbe83){return _0x3fbe83;});}return null;};}function removeEntity(_0x13e474,_0xba2e72){return function(_0x55c916){if(_0x55c916){return _0x55c916[_0x65d6('0x22')]()[_0x65d6('0x21')](function(){_0x13e474[_0x65d6('0x17')](0xcc)[_0x65d6('0x18')]();});}};}function handleEntityNotFound(_0x187d96,_0x578f87){return function(_0x434a37){if(!_0x434a37){_0x187d96['sendStatus'](0x194);}return _0x434a37;};}function handleError(_0x19a2a9,_0x1cd35e){_0x1cd35e=_0x1cd35e||0x1f4;return function(_0x2abd91){logger[_0x65d6('0x23')](_0x2abd91[_0x65d6('0x24')]);if(_0x2abd91['name']){delete _0x2abd91[_0x65d6('0x25')];}_0x19a2a9['status'](_0x1cd35e)[_0x65d6('0x26')](_0x2abd91);};}exports['index']=function(_0x4fd95d,_0x1a4f02){var _0x57600f={},_0x20253c={},_0x48e37f={'count':0x0,'rows':[]};var _0x233b11=_[_0x65d6('0x27')](db[_0x65d6('0x28')][_0x65d6('0x29')],function(_0x34db44){return{'name':_0x34db44[_0x65d6('0x2a')],'type':_0x34db44[_0x65d6('0x2b')][_0x65d6('0x2c')]};});_0x20253c[_0x65d6('0x2d')]=_[_0x65d6('0x27')](_0x233b11,_0x65d6('0x25'));_0x20253c[_0x65d6('0x2e')]=_[_0x65d6('0x2f')](_0x4fd95d['query']);_0x20253c['filters']=_[_0x65d6('0x30')](_0x20253c[_0x65d6('0x2d')],_0x20253c['query']);_0x57600f['attributes']=_[_0x65d6('0x30')](_0x20253c[_0x65d6('0x2d')],qs['fields'](_0x4fd95d[_0x65d6('0x2e')]['fields']));_0x57600f[_0x65d6('0x31')]=_0x57600f[_0x65d6('0x31')][_0x65d6('0x32')]?_0x57600f['attributes']:_0x20253c[_0x65d6('0x2d')];if(!_0x4fd95d[_0x65d6('0x2e')][_0x65d6('0x33')]('nolimit')){_0x57600f[_0x65d6('0x1b')]=qs[_0x65d6('0x1b')](_0x4fd95d[_0x65d6('0x2e')]['limit']);_0x57600f[_0x65d6('0x1a')]=qs[_0x65d6('0x1a')](_0x4fd95d['query'][_0x65d6('0x1a')]);}_0x57600f['order']=qs[_0x65d6('0x34')](_0x4fd95d[_0x65d6('0x2e')][_0x65d6('0x34')]);_0x57600f['where']=qs['filters'](_[_0x65d6('0x35')](_0x4fd95d[_0x65d6('0x2e')],_0x20253c[_0x65d6('0x36')]),_0x233b11);if(_0x4fd95d[_0x65d6('0x2e')][_0x65d6('0x37')]){_0x57600f[_0x65d6('0x38')]=_[_0x65d6('0x39')](_0x57600f[_0x65d6('0x38')],{'$or':_[_0x65d6('0x27')](_0x233b11,function(_0x56f8ad){if(_0x56f8ad[_0x65d6('0x2b')]!==_0x65d6('0x3a')){var _0x46de04={};_0x46de04[_0x56f8ad[_0x65d6('0x25')]]={'$like':'%'+_0x4fd95d[_0x65d6('0x2e')][_0x65d6('0x37')]+'%'};return _0x46de04;}})});}_0x57600f=_[_0x65d6('0x39')]({},_0x57600f,_0x4fd95d['options']);var _0x359364={'where':_0x57600f[_0x65d6('0x38')]};return db['JscriptyQuestionReport'][_0x65d6('0x1c')](_0x359364)[_0x65d6('0x21')](function(_0xf27b8d){_0x48e37f[_0x65d6('0x1c')]=_0xf27b8d;if(_0x4fd95d[_0x65d6('0x2e')][_0x65d6('0x3b')]){_0x57600f['include']=[{'all':!![]}];}return db[_0x65d6('0x28')][_0x65d6('0x3c')](_0x57600f);})[_0x65d6('0x21')](function(_0x4b4332){_0x48e37f[_0x65d6('0x3d')]=_0x4b4332;return _0x48e37f;})[_0x65d6('0x21')](respondWithFilteredResult(_0x1a4f02,_0x57600f))[_0x65d6('0x3e')](handleError(_0x1a4f02,null));};exports[_0x65d6('0x3f')]=function(_0x557cef,_0x4e5632){var _0x27d374={'raw':!![],'where':{'id':_0x557cef[_0x65d6('0x40')]['id']}},_0x1268fb={};_0x1268fb[_0x65d6('0x2d')]=_['keys'](db[_0x65d6('0x28')][_0x65d6('0x29')]);_0x1268fb[_0x65d6('0x2e')]=_[_0x65d6('0x2f')](_0x557cef[_0x65d6('0x2e')]);_0x1268fb[_0x65d6('0x36')]=_[_0x65d6('0x30')](_0x1268fb[_0x65d6('0x2d')],_0x1268fb[_0x65d6('0x2e')]);_0x27d374[_0x65d6('0x31')]=_['intersection'](_0x1268fb[_0x65d6('0x2d')],qs['fields'](_0x557cef[_0x65d6('0x2e')][_0x65d6('0x41')]));_0x27d374['attributes']=_0x27d374[_0x65d6('0x31')]['length']?_0x27d374[_0x65d6('0x31')]:_0x1268fb[_0x65d6('0x2d')];if(_0x557cef['query']['includeAll']){_0x27d374[_0x65d6('0x42')]=[{'all':!![]}];}_0x27d374=_[_0x65d6('0x39')]({},_0x27d374,_0x557cef[_0x65d6('0x43')]);return db[_0x65d6('0x28')][_0x65d6('0x44')](_0x27d374)[_0x65d6('0x21')](handleEntityNotFound(_0x4e5632,null))[_0x65d6('0x21')](respondWithResult(_0x4e5632,null))[_0x65d6('0x3e')](handleError(_0x4e5632,null));};exports[_0x65d6('0x45')]=function(_0x116f02,_0x29ba9f){return db[_0x65d6('0x28')][_0x65d6('0x45')](_0x116f02[_0x65d6('0x46')],{})[_0x65d6('0x21')](respondWithResult(_0x29ba9f,0xc9))['catch'](handleError(_0x29ba9f,null));};exports[_0x65d6('0x20')]=function(_0xc17eff,_0x241f78){if(_0xc17eff[_0x65d6('0x46')]['id']){delete _0xc17eff[_0x65d6('0x46')]['id'];}return db[_0x65d6('0x28')]['find']({'where':{'id':_0xc17eff[_0x65d6('0x40')]['id']}})['then'](handleEntityNotFound(_0x241f78,null))['then'](saveUpdates(_0xc17eff[_0x65d6('0x46')],null))[_0x65d6('0x21')](respondWithResult(_0x241f78,null))[_0x65d6('0x3e')](handleError(_0x241f78,null));};exports[_0x65d6('0x22')]=function(_0x4d141e,_0x3a6075){return db[_0x65d6('0x28')][_0x65d6('0x44')]({'where':{'id':_0x4d141e[_0x65d6('0x40')]['id']}})[_0x65d6('0x21')](handleEntityNotFound(_0x3a6075,null))[_0x65d6('0x21')](removeEntity(_0x3a6075,null))[_0x65d6('0x3e')](handleError(_0x3a6075,null));};exports[_0x65d6('0x47')]=function(_0x3752e4,_0x4c36e5){return db[_0x65d6('0x28')]['describe']()[_0x65d6('0x21')](respondWithResult(_0x4c36e5,null))[_0x65d6('0x3e')](handleError(_0x4c36e5,null));}; \ No newline at end of file +var _0x3bf5=['to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','end','json','offset','undefined','limit','count','set','Content-Range','apply','then','destroy','sendStatus','error','stack','status','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type','key','model','name','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','where','pick','filter','options','include','findAll','rows','catch','keys','length','includeAll','merge','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','util','sox'];(function(_0x5a3cf0,_0x160a68){var _0x5a64ee=function(_0x34cd1d){while(--_0x34cd1d){_0x5a3cf0['push'](_0x5a3cf0['shift']());}};_0x5a64ee(++_0x160a68);}(_0x3bf5,0x8a));var _0x53bf=function(_0x24392f,_0x15a3e5){_0x24392f=_0x24392f-0x0;var _0x591e33=_0x3bf5[_0x24392f];return _0x591e33;};'use strict';var emlformat=require(_0x53bf('0x0'));var rimraf=require(_0x53bf('0x1'));var zipdir=require(_0x53bf('0x2'));var jsonpatch=require(_0x53bf('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x53bf('0x4'));var path=require('path');var sox=require(_0x53bf('0x5'));var csv=require(_0x53bf('0x6'));var ejs=require(_0x53bf('0x7'));var fs=require('fs');var fs_extra=require(_0x53bf('0x8'));var _=require(_0x53bf('0x9'));var squel=require(_0x53bf('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x53bf('0xb'));var toCsv=require('to-csv');var querystring=require(_0x53bf('0xc'));var Papa=require(_0x53bf('0xd'));var Redis=require(_0x53bf('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x53bf('0xf'));var as=require(_0x53bf('0x10'));var hardwareService=require(_0x53bf('0x11'));var logger=require('../../config/logger')(_0x53bf('0x12'));var utils=require(_0x53bf('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x53bf('0x14'));var db=require(_0x53bf('0x15'))['db'];function respondWithStatusCode(_0x11e2b6,_0x5917c0){_0x5917c0=_0x5917c0||0xcc;return function(_0x4f54ae){if(_0x4f54ae){return _0x11e2b6['sendStatus'](_0x5917c0);}return _0x11e2b6['status'](_0x5917c0)[_0x53bf('0x16')]();};}function respondWithResult(_0xefb184,_0x2cc8cc){_0x2cc8cc=_0x2cc8cc||0xc8;return function(_0x2c2bc0){if(_0x2c2bc0){return _0xefb184['status'](_0x2cc8cc)[_0x53bf('0x17')](_0x2c2bc0);}};}function respondWithFilteredResult(_0x224809,_0x1f63bb){return function(_0x3000f3){if(_0x3000f3){var _0x349a74=typeof _0x1f63bb[_0x53bf('0x18')]===_0x53bf('0x19')&&typeof _0x1f63bb[_0x53bf('0x1a')]===_0x53bf('0x19');var _0x5ae232=_0x3000f3['count'];var _0x181629=_0x349a74?0x0:_0x1f63bb['offset'];var _0x2ea5f0=_0x349a74?_0x3000f3[_0x53bf('0x1b')]:_0x1f63bb[_0x53bf('0x18')]+_0x1f63bb[_0x53bf('0x1a')];var _0x161cf8;if(_0x2ea5f0>=_0x5ae232){_0x2ea5f0=_0x5ae232;_0x161cf8=0xc8;}else{_0x161cf8=0xce;}_0x224809['status'](_0x161cf8);return _0x224809[_0x53bf('0x1c')](_0x53bf('0x1d'),_0x181629+'-'+_0x2ea5f0+'/'+_0x5ae232)[_0x53bf('0x17')](_0x3000f3);}return null;};}function patchUpdates(_0x5def36){return function(_0x5e8d32){try{jsonpatch[_0x53bf('0x1e')](_0x5e8d32,_0x5def36,!![]);}catch(_0x3d00f3){return BPromise['reject'](_0x3d00f3);}return _0x5e8d32['save']();};}function saveUpdates(_0x54fe96,_0x259dab){return function(_0x394005){if(_0x394005){return _0x394005['update'](_0x54fe96)[_0x53bf('0x1f')](function(_0x4c46e7){return _0x4c46e7;});}return null;};}function removeEntity(_0xa8b2a0,_0x2c3802){return function(_0x5e5eeb){if(_0x5e5eeb){return _0x5e5eeb[_0x53bf('0x20')]()[_0x53bf('0x1f')](function(){_0xa8b2a0['status'](0xcc)[_0x53bf('0x16')]();});}};}function handleEntityNotFound(_0x244f94,_0x198970){return function(_0x27af75){if(!_0x27af75){_0x244f94[_0x53bf('0x21')](0x194);}return _0x27af75;};}function handleError(_0x1d58c0,_0x392411){_0x392411=_0x392411||0x1f4;return function(_0x4bc8ef){logger[_0x53bf('0x22')](_0x4bc8ef[_0x53bf('0x23')]);if(_0x4bc8ef['name']){delete _0x4bc8ef['name'];}_0x1d58c0[_0x53bf('0x24')](_0x392411)[_0x53bf('0x25')](_0x4bc8ef);};}exports[_0x53bf('0x26')]=function(_0x226070,_0x42cc59){var _0x515b80={},_0xa755c5={},_0x13b5a3={'count':0x0,'rows':[]};var _0x53d9dc=_[_0x53bf('0x27')](db[_0x53bf('0x28')][_0x53bf('0x29')],function(_0x35dc21){return{'name':_0x35dc21[_0x53bf('0x2a')],'type':_0x35dc21[_0x53bf('0x2b')][_0x53bf('0x2c')]};});_0xa755c5[_0x53bf('0x2d')]=_[_0x53bf('0x27')](_0x53d9dc,_0x53bf('0x2e'));_0xa755c5['query']=_['keys'](_0x226070[_0x53bf('0x2f')]);_0xa755c5[_0x53bf('0x30')]=_[_0x53bf('0x31')](_0xa755c5[_0x53bf('0x2d')],_0xa755c5['query']);_0x515b80['attributes']=_['intersection'](_0xa755c5[_0x53bf('0x2d')],qs['fields'](_0x226070[_0x53bf('0x2f')][_0x53bf('0x32')]));_0x515b80[_0x53bf('0x33')]=_0x515b80['attributes']['length']?_0x515b80[_0x53bf('0x33')]:_0xa755c5[_0x53bf('0x2d')];if(!_0x226070[_0x53bf('0x2f')][_0x53bf('0x34')](_0x53bf('0x35'))){_0x515b80['limit']=qs[_0x53bf('0x1a')](_0x226070[_0x53bf('0x2f')][_0x53bf('0x1a')]);_0x515b80['offset']=qs['offset'](_0x226070['query'][_0x53bf('0x18')]);}_0x515b80[_0x53bf('0x36')]=qs['sort'](_0x226070[_0x53bf('0x2f')]['sort']);_0x515b80[_0x53bf('0x37')]=qs[_0x53bf('0x30')](_[_0x53bf('0x38')](_0x226070[_0x53bf('0x2f')],_0xa755c5[_0x53bf('0x30')]),_0x53d9dc);if(_0x226070[_0x53bf('0x2f')][_0x53bf('0x39')]){_0x515b80[_0x53bf('0x37')]=_['merge'](_0x515b80[_0x53bf('0x37')],{'$or':_[_0x53bf('0x27')](_0x53d9dc,function(_0x541205){if(_0x541205[_0x53bf('0x2b')]!=='VIRTUAL'){var _0x29aade={};_0x29aade[_0x541205[_0x53bf('0x2e')]]={'$like':'%'+_0x226070[_0x53bf('0x2f')]['filter']+'%'};return _0x29aade;}})});}_0x515b80=_['merge']({},_0x515b80,_0x226070[_0x53bf('0x3a')]);var _0x4e9e66={'where':_0x515b80['where']};return db['JscriptyQuestionReport'][_0x53bf('0x1b')](_0x4e9e66)[_0x53bf('0x1f')](function(_0x31cff9){_0x13b5a3[_0x53bf('0x1b')]=_0x31cff9;if(_0x226070[_0x53bf('0x2f')]['includeAll']){_0x515b80[_0x53bf('0x3b')]=[{'all':!![]}];}return db[_0x53bf('0x28')][_0x53bf('0x3c')](_0x515b80);})['then'](function(_0x2a49f6){_0x13b5a3[_0x53bf('0x3d')]=_0x2a49f6;return _0x13b5a3;})[_0x53bf('0x1f')](respondWithFilteredResult(_0x42cc59,_0x515b80))[_0x53bf('0x3e')](handleError(_0x42cc59,null));};exports['show']=function(_0x59dec8,_0x231154){var _0x1891bf={'raw':!![],'where':{'id':_0x59dec8['params']['id']}},_0x4ece35={};_0x4ece35[_0x53bf('0x2d')]=_[_0x53bf('0x3f')](db[_0x53bf('0x28')]['rawAttributes']);_0x4ece35[_0x53bf('0x2f')]=_['keys'](_0x59dec8['query']);_0x4ece35[_0x53bf('0x30')]=_['intersection'](_0x4ece35[_0x53bf('0x2d')],_0x4ece35[_0x53bf('0x2f')]);_0x1891bf[_0x53bf('0x33')]=_[_0x53bf('0x31')](_0x4ece35[_0x53bf('0x2d')],qs['fields'](_0x59dec8['query']['fields']));_0x1891bf['attributes']=_0x1891bf['attributes'][_0x53bf('0x40')]?_0x1891bf[_0x53bf('0x33')]:_0x4ece35['model'];if(_0x59dec8[_0x53bf('0x2f')][_0x53bf('0x41')]){_0x1891bf[_0x53bf('0x3b')]=[{'all':!![]}];}_0x1891bf=_[_0x53bf('0x42')]({},_0x1891bf,_0x59dec8['options']);return db[_0x53bf('0x28')][_0x53bf('0x43')](_0x1891bf)[_0x53bf('0x1f')](handleEntityNotFound(_0x231154,null))['then'](respondWithResult(_0x231154,null))[_0x53bf('0x3e')](handleError(_0x231154,null));};exports[_0x53bf('0x44')]=function(_0x6d31f4,_0x1557fd){return db[_0x53bf('0x28')]['create'](_0x6d31f4[_0x53bf('0x45')],{})[_0x53bf('0x1f')](respondWithResult(_0x1557fd,0xc9))[_0x53bf('0x3e')](handleError(_0x1557fd,null));};exports['update']=function(_0x19be81,_0x20a710){if(_0x19be81['body']['id']){delete _0x19be81[_0x53bf('0x45')]['id'];}return db[_0x53bf('0x28')][_0x53bf('0x43')]({'where':{'id':_0x19be81[_0x53bf('0x46')]['id']}})[_0x53bf('0x1f')](handleEntityNotFound(_0x20a710,null))[_0x53bf('0x1f')](saveUpdates(_0x19be81[_0x53bf('0x45')],null))[_0x53bf('0x1f')](respondWithResult(_0x20a710,null))[_0x53bf('0x3e')](handleError(_0x20a710,null));};exports[_0x53bf('0x20')]=function(_0x3d4c19,_0x1dd9f2){return db[_0x53bf('0x28')][_0x53bf('0x43')]({'where':{'id':_0x3d4c19[_0x53bf('0x46')]['id']}})['then'](handleEntityNotFound(_0x1dd9f2,null))['then'](removeEntity(_0x1dd9f2,null))[_0x53bf('0x3e')](handleError(_0x1dd9f2,null));};exports[_0x53bf('0x47')]=function(_0x2e5386,_0x1d34e3){return db[_0x53bf('0x28')][_0x53bf('0x47')]()[_0x53bf('0x1f')](respondWithResult(_0x1d34e3,null))[_0x53bf('0x3e')](handleError(_0x1d34e3,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index fe74a03..fa62033 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 _0x29d5=['bluebird','request-promise','path','../../config/environment','./jscriptyQuestionReport.attributes','lodash','util','api','moment'];(function(_0x57cc16,_0x444378){var _0x5421e5=function(_0xbcb1d3){while(--_0xbcb1d3){_0x57cc16['push'](_0x57cc16['shift']());}};_0x5421e5(++_0x444378);}(_0x29d5,0xb0));var _0x529d=function(_0x7891a5,_0x1c2057){_0x7891a5=_0x7891a5-0x0;var _0x2e57fe=_0x29d5[_0x7891a5];return _0x2e57fe;};'use strict';var _=require(_0x529d('0x0'));var util=require(_0x529d('0x1'));var logger=require('../../config/logger')(_0x529d('0x2'));var moment=require(_0x529d('0x3'));var BPromise=require(_0x529d('0x4'));var rp=require(_0x529d('0x5'));var fs=require('fs');var path=require(_0x529d('0x6'));var rimraf=require('rimraf');var config=require(_0x529d('0x7'));var attributes=require(_0x529d('0x8'));module['exports']=function(_0x1b5ba9,_0x1e23d4){return _0x1b5ba9['define']('JscriptyQuestionReport',attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcff0=['report_jscripty_questions','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','define','JscriptyQuestionReport'];(function(_0x13379f,_0x4c7f89){var _0x17caeb=function(_0x28bb88){while(--_0x28bb88){_0x13379f['push'](_0x13379f['shift']());}};_0x17caeb(++_0x4c7f89);}(_0xcff0,0x135));var _0x0cff=function(_0x28fe8a,_0x1b03e6){_0x28fe8a=_0x28fe8a-0x0;var _0x3433c1=_0xcff0[_0x28fe8a];return _0x3433c1;};'use strict';var _=require('lodash');var util=require(_0x0cff('0x0'));var logger=require(_0x0cff('0x1'))(_0x0cff('0x2'));var moment=require(_0x0cff('0x3'));var BPromise=require(_0x0cff('0x4'));var rp=require(_0x0cff('0x5'));var fs=require('fs');var path=require(_0x0cff('0x6'));var rimraf=require('rimraf');var config=require(_0x0cff('0x7'));var attributes=require('./jscriptyQuestionReport.attributes');module['exports']=function(_0x424be0,_0x5b7ce4){return _0x424be0[_0x0cff('0x8')](_0x0cff('0x9'),attributes,{'tableName':_0x0cff('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index 6355a65..cc58a24 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 _0xee8d=['request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','error','code','JscriptyQuestionReport,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then'];(function(_0x3918a4,_0x429798){var _0x1d3840=function(_0x4213bf){while(--_0x4213bf){_0x3918a4['push'](_0x3918a4['shift']());}};_0x1d3840(++_0x429798);}(_0xee8d,0x72));var _0xdee8=function(_0x1c3377,_0x28631d){_0x1c3377=_0x1c3377-0x0;var _0x4532d0=_0xee8d[_0x1c3377];return _0x4532d0;};'use strict';var _=require(_0xdee8('0x0'));var util=require(_0xdee8('0x1'));var moment=require('moment');var BPromise=require(_0xdee8('0x2'));var rs=require(_0xdee8('0x3'));var fs=require('fs');var Redis=require(_0xdee8('0x4'));var db=require(_0xdee8('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xdee8('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xdee8('0x7'));var client=jayson[_0xdee8('0x8')][_0xdee8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5c2178,_0x2f91a0,_0x5ade69){return new BPromise(function(_0x28ff4d,_0x211fb3){return client[_0xdee8('0xa')](_0x5c2178,_0x5ade69)[_0xdee8('0xb')](function(_0x2c6717){logger['info']('JscriptyQuestionReport,\x20%s,\x20%s',_0x2f91a0,_0xdee8('0xc'));logger[_0xdee8('0xd')](_0xdee8('0xe'),_0x2f91a0,'request\x20sent',JSON['stringify'](_0x2c6717));if(_0x2c6717[_0xdee8('0xf')]){if(_0x2c6717['error'][_0xdee8('0x10')]===0x1f4){logger[_0xdee8('0xf')](_0xdee8('0x11'),_0x2f91a0,_0x2c6717[_0xdee8('0xf')][_0xdee8('0x12')]);return _0x211fb3(_0x2c6717[_0xdee8('0xf')][_0xdee8('0x12')]);}logger['error']('JscriptyQuestionReport,\x20%s,\x20%s',_0x2f91a0,_0x2c6717[_0xdee8('0xf')]['message']);return _0x28ff4d(_0x2c6717[_0xdee8('0xf')][_0xdee8('0x12')]);}else{logger['info'](_0xdee8('0x11'),_0x2f91a0,'request\x20sent');_0x28ff4d(_0x2c6717[_0xdee8('0x13')][_0xdee8('0x12')]);}})[_0xdee8('0x14')](function(_0x14efc8){logger[_0xdee8('0xf')](_0xdee8('0x11'),_0x2f91a0,_0x14efc8);_0x211fb3(_0x14efc8);});});} \ No newline at end of file +var _0xe33f=['catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','code','error','message','result'];(function(_0x4d73b1,_0x91ab71){var _0xe394f9=function(_0x47dd5d){while(--_0x47dd5d){_0x4d73b1['push'](_0x4d73b1['shift']());}};_0xe394f9(++_0x91ab71);}(_0xe33f,0x13c));var _0xfe33=function(_0x597340,_0xdfd63b){_0x597340=_0x597340-0x0;var _0x5b260c=_0xe33f[_0x597340];return _0x5b260c;};'use strict';var _=require(_0xfe33('0x0'));var util=require('util');var moment=require(_0xfe33('0x1'));var BPromise=require(_0xfe33('0x2'));var rs=require(_0xfe33('0x3'));var fs=require('fs');var Redis=require(_0xfe33('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xfe33('0x5'));var logger=require(_0xfe33('0x6'))(_0xfe33('0x7'));var config=require(_0xfe33('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xfe33('0x9')][_0xfe33('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1625b1,_0x35d75f,_0x701fb2){return new BPromise(function(_0x12b446,_0xd26482){return client[_0xfe33('0xb')](_0x1625b1,_0x701fb2)[_0xfe33('0xc')](function(_0x38a2c4){logger[_0xfe33('0xd')](_0xfe33('0xe'),_0x35d75f,'request\x20sent');logger['debug']('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x35d75f,_0xfe33('0xf'),JSON['stringify'](_0x38a2c4));if(_0x38a2c4['error']){if(_0x38a2c4['error'][_0xfe33('0x10')]===0x1f4){logger[_0xfe33('0x11')](_0xfe33('0xe'),_0x35d75f,_0x38a2c4[_0xfe33('0x11')][_0xfe33('0x12')]);return _0xd26482(_0x38a2c4[_0xfe33('0x11')]['message']);}logger['error'](_0xfe33('0xe'),_0x35d75f,_0x38a2c4[_0xfe33('0x11')]['message']);return _0x12b446(_0x38a2c4[_0xfe33('0x11')]['message']);}else{logger[_0xfe33('0xd')](_0xfe33('0xe'),_0x35d75f,'request\x20sent');_0x12b446(_0x38a2c4[_0xfe33('0x13')][_0xfe33('0x12')]);}})[_0xfe33('0x14')](function(_0x11b99e){logger[_0xfe33('0x11')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x35d75f,_0x11b99e);_0xd26482(_0x11b99e);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index bbc113f..c51854f 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 _0x3969=['../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','/describe','/:id','/:id/questions','getQuestions','post','create','put','update','delete','destroy','exports','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x521344,_0x462b25){var _0x54e65e=function(_0x2c3563){while(--_0x2c3563){_0x521344['push'](_0x521344['shift']());}};_0x54e65e(++_0x462b25);}(_0x3969,0xb8));var _0x9396=function(_0xa9549e,_0x5149fd){_0xa9549e=_0xa9549e-0x0;var _0x13afe7=_0x3969[_0xa9549e];return _0x13afe7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9396('0x0'));var timeout=require('connect-timeout');var express=require(_0x9396('0x1'));var router=express[_0x9396('0x2')]();var fs_extra=require(_0x9396('0x3'));var auth=require(_0x9396('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x9396('0x5'));var controller=require(_0x9396('0x6'));router[_0x9396('0x7')]('/',auth[_0x9396('0x8')](),controller[_0x9396('0x9')]);router[_0x9396('0x7')](_0x9396('0xa'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x9396('0xb'),auth[_0x9396('0x8')](),controller['show']);router[_0x9396('0x7')](_0x9396('0xc'),auth[_0x9396('0x8')](),controller[_0x9396('0xd')]);router[_0x9396('0xe')]('/',auth['isAuthenticated'](),controller[_0x9396('0xf')]);router[_0x9396('0x10')](_0x9396('0xb'),auth[_0x9396('0x8')](),controller[_0x9396('0x11')]);router[_0x9396('0x12')](_0x9396('0xb'),auth[_0x9396('0x8')](),controller[_0x9396('0x13')]);module[_0x9396('0x14')]=router; \ No newline at end of file +var _0x6c89=['put','update','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','describe','/:id','show','/:id/questions','post','create'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x6c89,0x68));var _0x96c8=function(_0x5f070a,_0x1066fd){_0x5f070a=_0x5f070a-0x0;var _0x513d6e=_0x6c89[_0x5f070a];return _0x513d6e;};'use strict';var multer=require(_0x96c8('0x0'));var util=require(_0x96c8('0x1'));var path=require('path');var timeout=require(_0x96c8('0x2'));var express=require('express');var router=express[_0x96c8('0x3')]();var fs_extra=require(_0x96c8('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x96c8('0x5'));var config=require(_0x96c8('0x6'));var controller=require('./jscriptySessionReport.controller');router['get']('/',auth[_0x96c8('0x7')](),controller['index']);router[_0x96c8('0x8')](_0x96c8('0x9'),auth[_0x96c8('0x7')](),controller[_0x96c8('0xa')]);router['get'](_0x96c8('0xb'),auth[_0x96c8('0x7')](),controller[_0x96c8('0xc')]);router[_0x96c8('0x8')](_0x96c8('0xd'),auth['isAuthenticated'](),controller['getQuestions']);router[_0x96c8('0xe')]('/',auth[_0x96c8('0x7')](),controller[_0x96c8('0xf')]);router[_0x96c8('0x10')](_0x96c8('0xb'),auth[_0x96c8('0x7')](),controller[_0x96c8('0x11')]);router['delete'](_0x96c8('0xb'),auth[_0x96c8('0x7')](),controller[_0x96c8('0x12')]);module[_0x96c8('0x13')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index f9a197f..eed0bb9 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 _0xc73f=['BOOLEAN','moment','sequelize','DATE','setDataValue','starttime','endtime','YYYY-MM-DD\x20HH:mm:ss','STRING'];(function(_0x9831a7,_0x5ac391){var _0x59fb4e=function(_0x4bc442){while(--_0x4bc442){_0x9831a7['push'](_0x9831a7['shift']());}};_0x59fb4e(++_0x5ac391);}(_0xc73f,0xe2));var _0xfc73=function(_0x443b17,_0x4263e1){_0x443b17=_0x443b17-0x0;var _0x522264=_0xc73f[_0x443b17];return _0x522264;};'use strict';var moment=require(_0xfc73('0x0'));var Sequelize=require(_0xfc73('0x1'));module['exports']={'starttime':{'type':Sequelize[_0xfc73('0x2')],'set':function(_0x1e2d65){this[_0xfc73('0x3')](_0xfc73('0x4'),_0x1e2d65);this[_0xfc73('0x3')](_0xfc73('0x5'),moment()['format'](_0xfc73('0x6')));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize[_0xfc73('0x7')]},'projectname':{'type':Sequelize[_0xfc73('0x7')]},'queue':{'type':Sequelize[_0xfc73('0x7')]},'uniqueid':{'type':Sequelize[_0xfc73('0x7')]},'calleridname':{'type':Sequelize[_0xfc73('0x7')]},'calleridnum':{'type':Sequelize[_0xfc73('0x7')]},'completed':{'type':Sequelize[_0xfc73('0x8')],'defaultValue':![]}}; \ No newline at end of file +var _0x7e98=['BOOLEAN','moment','exports','setDataValue','endtime','format','YYYY-MM-DD\x20HH:mm:ss','DATE','STRING'];(function(_0x33355b,_0x40b7a6){var _0x5553da=function(_0xfdd33c){while(--_0xfdd33c){_0x33355b['push'](_0x33355b['shift']());}};_0x5553da(++_0x40b7a6);}(_0x7e98,0x1ba));var _0x87e9=function(_0x1abdd8,_0x38ebc2){_0x1abdd8=_0x1abdd8-0x0;var _0x4865d9=_0x7e98[_0x1abdd8];return _0x4865d9;};'use strict';var moment=require(_0x87e9('0x0'));var Sequelize=require('sequelize');module[_0x87e9('0x1')]={'starttime':{'type':Sequelize['DATE'],'set':function(_0x4c666c){this[_0x87e9('0x2')]('starttime',_0x4c666c);this[_0x87e9('0x2')](_0x87e9('0x3'),moment()[_0x87e9('0x4')](_0x87e9('0x5')));}},'endtime':{'type':Sequelize[_0x87e9('0x6')]},'membername':{'type':Sequelize[_0x87e9('0x7')]},'projectname':{'type':Sequelize[_0x87e9('0x7')]},'queue':{'type':Sequelize[_0x87e9('0x7')]},'uniqueid':{'type':Sequelize[_0x87e9('0x7')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0x87e9('0x8')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 095be1e..96700fd 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 _0xa358=['rawAttributes','fieldName','type','key','name','query','keys','intersection','attributes','model','fields','length','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','JscriptySessionReport','include','options','find','body','params','destroy','describe','getQuestions','findOne','JscriptyQuestionReport','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','ejs','fs-extra','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','count','Content-Range','json','apply','reject','update','then','error','stack','send','index','map'];(function(_0x2a570d,_0x403ff1){var _0x485fb6=function(_0xfbd711){while(--_0xfbd711){_0x2a570d['push'](_0x2a570d['shift']());}};_0x485fb6(++_0x403ff1);}(_0xa358,0x154));var _0x8a35=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa358[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x8a35('0x0'));var rimraf=require(_0x8a35('0x1'));var zipdir=require(_0x8a35('0x2'));var jsonpatch=require(_0x8a35('0x3'));var rp=require(_0x8a35('0x4'));var moment=require(_0x8a35('0x5'));var BPromise=require(_0x8a35('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x8a35('0x7'));var csv=require('to-csv');var ejs=require(_0x8a35('0x8'));var fs=require('fs');var fs_extra=require(_0x8a35('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8a35('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x8a35('0xb'));var querystring=require('querystring');var Papa=require(_0x8a35('0xc'));var Redis=require(_0x8a35('0xd'));var authService=require(_0x8a35('0xe'));var qs=require(_0x8a35('0xf'));var as=require(_0x8a35('0x10'));var hardwareService=require(_0x8a35('0x11'));var logger=require(_0x8a35('0x12'))('api');var utils=require(_0x8a35('0x13'));var config=require(_0x8a35('0x14'));var licenseUtil=require(_0x8a35('0x15'));var db=require(_0x8a35('0x16'))['db'];function respondWithStatusCode(_0x2cac8a,_0x282c46){_0x282c46=_0x282c46||0xcc;return function(_0x2dc41c){if(_0x2dc41c){return _0x2cac8a[_0x8a35('0x17')](_0x282c46);}return _0x2cac8a[_0x8a35('0x18')](_0x282c46)[_0x8a35('0x19')]();};}function respondWithResult(_0x4d770f,_0x23dd7d){_0x23dd7d=_0x23dd7d||0xc8;return function(_0x54d4cf){if(_0x54d4cf){return _0x4d770f[_0x8a35('0x18')](_0x23dd7d)['json'](_0x54d4cf);}};}function respondWithFilteredResult(_0x3927d9,_0x475909){return function(_0x188bc7){if(_0x188bc7){var _0x2e4d26=typeof _0x475909[_0x8a35('0x1a')]==='undefined'&&typeof _0x475909[_0x8a35('0x1b')]==='undefined';var _0x4c05ba=_0x188bc7[_0x8a35('0x1c')];var _0x22cd52=_0x2e4d26?0x0:_0x475909[_0x8a35('0x1a')];var _0x5388e0=_0x2e4d26?_0x188bc7[_0x8a35('0x1c')]:_0x475909[_0x8a35('0x1a')]+_0x475909[_0x8a35('0x1b')];var _0x4d21a6;if(_0x5388e0>=_0x4c05ba){_0x5388e0=_0x4c05ba;_0x4d21a6=0xc8;}else{_0x4d21a6=0xce;}_0x3927d9[_0x8a35('0x18')](_0x4d21a6);return _0x3927d9['set'](_0x8a35('0x1d'),_0x22cd52+'-'+_0x5388e0+'/'+_0x4c05ba)[_0x8a35('0x1e')](_0x188bc7);}return null;};}function patchUpdates(_0x42465b){return function(_0x46c52f){try{jsonpatch[_0x8a35('0x1f')](_0x46c52f,_0x42465b,!![]);}catch(_0x450807){return BPromise[_0x8a35('0x20')](_0x450807);}return _0x46c52f['save']();};}function saveUpdates(_0x1ba989,_0x424f86){return function(_0x1f2638){if(_0x1f2638){return _0x1f2638[_0x8a35('0x21')](_0x1ba989)[_0x8a35('0x22')](function(_0x3d9315){return _0x3d9315;});}return null;};}function removeEntity(_0x4c4a76,_0x2e38f4){return function(_0x504dee){if(_0x504dee){return _0x504dee['destroy']()[_0x8a35('0x22')](function(){_0x4c4a76[_0x8a35('0x18')](0xcc)[_0x8a35('0x19')]();});}};}function handleEntityNotFound(_0x57cd74,_0x5bdd5f){return function(_0x2c0202){if(!_0x2c0202){_0x57cd74[_0x8a35('0x17')](0x194);}return _0x2c0202;};}function handleError(_0x2e282e,_0x1b77ed){_0x1b77ed=_0x1b77ed||0x1f4;return function(_0x358a33){logger[_0x8a35('0x23')](_0x358a33[_0x8a35('0x24')]);if(_0x358a33['name']){delete _0x358a33['name'];}_0x2e282e[_0x8a35('0x18')](_0x1b77ed)[_0x8a35('0x25')](_0x358a33);};}exports[_0x8a35('0x26')]=function(_0x1cfbbb,_0x277ab0){var _0x563685={},_0x11b659={},_0x474997={'count':0x0,'rows':[]};var _0x521452=_[_0x8a35('0x27')](db['JscriptySessionReport'][_0x8a35('0x28')],function(_0x3a505d){return{'name':_0x3a505d[_0x8a35('0x29')],'type':_0x3a505d[_0x8a35('0x2a')][_0x8a35('0x2b')]};});_0x11b659['model']=_[_0x8a35('0x27')](_0x521452,_0x8a35('0x2c'));_0x11b659[_0x8a35('0x2d')]=_[_0x8a35('0x2e')](_0x1cfbbb[_0x8a35('0x2d')]);_0x11b659['filters']=_[_0x8a35('0x2f')](_0x11b659['model'],_0x11b659['query']);_0x563685[_0x8a35('0x30')]=_['intersection'](_0x11b659[_0x8a35('0x31')],qs[_0x8a35('0x32')](_0x1cfbbb[_0x8a35('0x2d')][_0x8a35('0x32')]));_0x563685[_0x8a35('0x30')]=_0x563685[_0x8a35('0x30')][_0x8a35('0x33')]?_0x563685['attributes']:_0x11b659[_0x8a35('0x31')];if(!_0x1cfbbb[_0x8a35('0x2d')]['hasOwnProperty'](_0x8a35('0x34'))){_0x563685['limit']=qs[_0x8a35('0x1b')](_0x1cfbbb[_0x8a35('0x2d')][_0x8a35('0x1b')]);_0x563685[_0x8a35('0x1a')]=qs[_0x8a35('0x1a')](_0x1cfbbb['query'][_0x8a35('0x1a')]);}_0x563685[_0x8a35('0x35')]=qs[_0x8a35('0x36')](_0x1cfbbb[_0x8a35('0x2d')][_0x8a35('0x36')]);_0x563685[_0x8a35('0x37')]=qs['filters'](_[_0x8a35('0x38')](_0x1cfbbb[_0x8a35('0x2d')],_0x11b659[_0x8a35('0x39')]),_0x521452);if(_0x1cfbbb[_0x8a35('0x2d')][_0x8a35('0x3a')]){_0x563685[_0x8a35('0x37')]=_[_0x8a35('0x3b')](_0x563685[_0x8a35('0x37')],{'$or':_['map'](_0x521452,function(_0x37e117){if(_0x37e117[_0x8a35('0x2a')]!==_0x8a35('0x3c')){var _0x32bff9={};_0x32bff9[_0x37e117[_0x8a35('0x2c')]]={'$like':'%'+_0x1cfbbb[_0x8a35('0x2d')][_0x8a35('0x3a')]+'%'};return _0x32bff9;}})});}_0x563685=_[_0x8a35('0x3b')]({},_0x563685,_0x1cfbbb['options']);var _0x762bae={'where':_0x563685['where']};return db['JscriptySessionReport'][_0x8a35('0x1c')](_0x762bae)[_0x8a35('0x22')](function(_0x56ecef){_0x474997[_0x8a35('0x1c')]=_0x56ecef;if(_0x1cfbbb[_0x8a35('0x2d')][_0x8a35('0x3d')]){_0x563685['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0x8a35('0x3e')](_0x563685);})['then'](function(_0x797af8){_0x474997[_0x8a35('0x3f')]=_0x797af8;return _0x474997;})[_0x8a35('0x22')](respondWithFilteredResult(_0x277ab0,_0x563685))[_0x8a35('0x40')](handleError(_0x277ab0,null));};exports['show']=function(_0x5c8828,_0x1e1067){var _0x45607b={'raw':!![],'where':{'id':_0x5c8828['params']['id']}},_0x39df15={};_0x39df15[_0x8a35('0x31')]=_[_0x8a35('0x2e')](db[_0x8a35('0x41')][_0x8a35('0x28')]);_0x39df15[_0x8a35('0x2d')]=_['keys'](_0x5c8828['query']);_0x39df15[_0x8a35('0x39')]=_[_0x8a35('0x2f')](_0x39df15[_0x8a35('0x31')],_0x39df15[_0x8a35('0x2d')]);_0x45607b['attributes']=_[_0x8a35('0x2f')](_0x39df15[_0x8a35('0x31')],qs[_0x8a35('0x32')](_0x5c8828[_0x8a35('0x2d')][_0x8a35('0x32')]));_0x45607b[_0x8a35('0x30')]=_0x45607b['attributes'][_0x8a35('0x33')]?_0x45607b[_0x8a35('0x30')]:_0x39df15[_0x8a35('0x31')];if(_0x5c8828[_0x8a35('0x2d')]['includeAll']){_0x45607b[_0x8a35('0x42')]=[{'all':!![]}];}_0x45607b=_[_0x8a35('0x3b')]({},_0x45607b,_0x5c8828[_0x8a35('0x43')]);return db[_0x8a35('0x41')][_0x8a35('0x44')](_0x45607b)['then'](handleEntityNotFound(_0x1e1067,null))[_0x8a35('0x22')](respondWithResult(_0x1e1067,null))['catch'](handleError(_0x1e1067,null));};exports['create']=function(_0xfdcef2,_0x3d0c18){return db[_0x8a35('0x41')]['create'](_0xfdcef2[_0x8a35('0x45')],{})[_0x8a35('0x22')](respondWithResult(_0x3d0c18,0xc9))[_0x8a35('0x40')](handleError(_0x3d0c18,null));};exports[_0x8a35('0x21')]=function(_0x2d583f,_0x5ebf6b){if(_0x2d583f[_0x8a35('0x45')]['id']){delete _0x2d583f[_0x8a35('0x45')]['id'];}return db['JscriptySessionReport'][_0x8a35('0x44')]({'where':{'id':_0x2d583f[_0x8a35('0x46')]['id']}})['then'](handleEntityNotFound(_0x5ebf6b,null))[_0x8a35('0x22')](saveUpdates(_0x2d583f[_0x8a35('0x45')],null))[_0x8a35('0x22')](respondWithResult(_0x5ebf6b,null))[_0x8a35('0x40')](handleError(_0x5ebf6b,null));};exports[_0x8a35('0x47')]=function(_0x6bc075,_0x33a741){return db[_0x8a35('0x41')][_0x8a35('0x44')]({'where':{'id':_0x6bc075[_0x8a35('0x46')]['id']}})[_0x8a35('0x22')](handleEntityNotFound(_0x33a741,null))[_0x8a35('0x22')](removeEntity(_0x33a741,null))[_0x8a35('0x40')](handleError(_0x33a741,null));};exports['describe']=function(_0x4f7048,_0x330864){return db[_0x8a35('0x41')][_0x8a35('0x48')]()[_0x8a35('0x22')](respondWithResult(_0x330864,null))[_0x8a35('0x40')](handleError(_0x330864,null));};exports[_0x8a35('0x49')]=function(_0x487b7d,_0x3e411f,_0x20360d){var _0x4184fe={'raw':!![],'where':{}};var _0x45172e={};var _0x2662e2={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0x8a35('0x4a')]({'where':{'id':_0x487b7d[_0x8a35('0x46')]['id']}})[_0x8a35('0x22')](handleEntityNotFound(_0x3e411f,null))[_0x8a35('0x22')](function(_0x52c3a5){if(_0x52c3a5){_0x45172e[_0x8a35('0x31')]=_[_0x8a35('0x2e')](db[_0x8a35('0x4b')][_0x8a35('0x28')]);_0x45172e[_0x8a35('0x2d')]=_[_0x8a35('0x2e')](_0x487b7d['query']);_0x45172e[_0x8a35('0x39')]=_['intersection'](_0x45172e['model'],_0x45172e[_0x8a35('0x2d')]);_0x4184fe[_0x8a35('0x30')]=_['intersection'](_0x45172e[_0x8a35('0x31')],qs['fields'](_0x487b7d['query']['fields']));_0x4184fe[_0x8a35('0x30')]=_0x4184fe[_0x8a35('0x30')][_0x8a35('0x33')]?_0x4184fe[_0x8a35('0x30')]:_0x45172e[_0x8a35('0x31')];if(!_0x487b7d['query']['hasOwnProperty'](_0x8a35('0x34'))){_0x4184fe[_0x8a35('0x1b')]=qs[_0x8a35('0x1b')](_0x487b7d[_0x8a35('0x2d')][_0x8a35('0x1b')]);_0x4184fe[_0x8a35('0x1a')]=qs[_0x8a35('0x1a')](_0x487b7d[_0x8a35('0x2d')][_0x8a35('0x1a')]);}_0x4184fe[_0x8a35('0x35')]=qs[_0x8a35('0x36')](_0x487b7d[_0x8a35('0x2d')][_0x8a35('0x36')]);_0x4184fe[_0x8a35('0x37')]=qs[_0x8a35('0x39')](_['pick'](_0x487b7d['query'],_0x45172e[_0x8a35('0x39')]));_0x4184fe['where']['SessionId']=_0x52c3a5['id'];if(_0x487b7d[_0x8a35('0x2d')][_0x8a35('0x3a')]){_0x4184fe[_0x8a35('0x37')]=_[_0x8a35('0x3b')](_0x4184fe[_0x8a35('0x37')],{'$or':_['map'](_0x4184fe['attributes'],function(_0x4f96c8){var _0x1ca06f={};_0x1ca06f[_0x4f96c8]={'$like':'%'+_0x487b7d[_0x8a35('0x2d')]['filter']+'%'};return _0x1ca06f;})});}_0x4184fe=_[_0x8a35('0x3b')]({},_0x4184fe,_0x487b7d[_0x8a35('0x43')]);return db[_0x8a35('0x4b')][_0x8a35('0x1c')]({'where':_0x4184fe[_0x8a35('0x37')]})[_0x8a35('0x22')](function(_0x2bc788){_0x2662e2[_0x8a35('0x1c')]=_0x2bc788;if(_0x487b7d[_0x8a35('0x2d')]['includeAll']){_0x4184fe[_0x8a35('0x42')]=[{'all':!![]}];}return db[_0x8a35('0x4b')]['findAll'](_0x4184fe);})[_0x8a35('0x22')](function(_0x597b17){_0x2662e2[_0x8a35('0x3f')]=_0x597b17;return _0x2662e2;});}})[_0x8a35('0x22')](respondWithFilteredResult(_0x3e411f,_0x4184fe))['catch'](handleError(_0x3e411f,null));}; \ No newline at end of file +var _0x7e74=['catch','update','describe','getQuestions','findOne','hasOwnProperty','nolimit','SessionId','JscriptyQuestionReport','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','send','map','rawAttributes','type','model','query','keys','filters','attributes','intersection','fields','length','order','sort','pick','filter','where','VIRTUAL','merge','options','JscriptySessionReport','include','findAll','rows','params','includeAll','find','create','body'];(function(_0x84dd15,_0x33acc5){var _0x749ec1=function(_0x1f09f6){while(--_0x1f09f6){_0x84dd15['push'](_0x84dd15['shift']());}};_0x749ec1(++_0x33acc5);}(_0x7e74,0x1e9));var _0x47e7=function(_0x2120d0,_0x2b4126){_0x2120d0=_0x2120d0-0x0;var _0x1c9b84=_0x7e74[_0x2120d0];return _0x1c9b84;};'use strict';var emlformat=require(_0x47e7('0x0'));var rimraf=require(_0x47e7('0x1'));var zipdir=require(_0x47e7('0x2'));var jsonpatch=require(_0x47e7('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x47e7('0x4'));var util=require(_0x47e7('0x5'));var path=require(_0x47e7('0x6'));var sox=require(_0x47e7('0x7'));var csv=require(_0x47e7('0x8'));var ejs=require(_0x47e7('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x47e7('0xa'));var jsforce=require(_0x47e7('0xb'));var deskjs=require(_0x47e7('0xc'));var toCsv=require('to-csv');var querystring=require(_0x47e7('0xd'));var Papa=require(_0x47e7('0xe'));var Redis=require(_0x47e7('0xf'));var authService=require(_0x47e7('0x10'));var qs=require(_0x47e7('0x11'));var as=require(_0x47e7('0x12'));var hardwareService=require(_0x47e7('0x13'));var logger=require(_0x47e7('0x14'))(_0x47e7('0x15'));var utils=require(_0x47e7('0x16'));var config=require(_0x47e7('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2e128,_0x126b24){_0x126b24=_0x126b24||0xcc;return function(_0x33394a){if(_0x33394a){return _0x2e128[_0x47e7('0x18')](_0x126b24);}return _0x2e128['status'](_0x126b24)[_0x47e7('0x19')]();};}function respondWithResult(_0x4849b1,_0x2ceb55){_0x2ceb55=_0x2ceb55||0xc8;return function(_0x5068d1){if(_0x5068d1){return _0x4849b1[_0x47e7('0x1a')](_0x2ceb55)['json'](_0x5068d1);}};}function respondWithFilteredResult(_0xe6228e,_0x567a6d){return function(_0x7f7fed){if(_0x7f7fed){var _0x4f75dc=typeof _0x567a6d[_0x47e7('0x1b')]==='undefined'&&typeof _0x567a6d['limit']===_0x47e7('0x1c');var _0x233c09=_0x7f7fed[_0x47e7('0x1d')];var _0x4c86de=_0x4f75dc?0x0:_0x567a6d[_0x47e7('0x1b')];var _0xc7e724=_0x4f75dc?_0x7f7fed[_0x47e7('0x1d')]:_0x567a6d[_0x47e7('0x1b')]+_0x567a6d[_0x47e7('0x1e')];var _0x38b628;if(_0xc7e724>=_0x233c09){_0xc7e724=_0x233c09;_0x38b628=0xc8;}else{_0x38b628=0xce;}_0xe6228e['status'](_0x38b628);return _0xe6228e[_0x47e7('0x1f')](_0x47e7('0x20'),_0x4c86de+'-'+_0xc7e724+'/'+_0x233c09)[_0x47e7('0x21')](_0x7f7fed);}return null;};}function patchUpdates(_0x4b432f){return function(_0x378ee3){try{jsonpatch[_0x47e7('0x22')](_0x378ee3,_0x4b432f,!![]);}catch(_0x2b8369){return BPromise[_0x47e7('0x23')](_0x2b8369);}return _0x378ee3[_0x47e7('0x24')]();};}function saveUpdates(_0x309f38,_0x2fe1c4){return function(_0x1039d3){if(_0x1039d3){return _0x1039d3['update'](_0x309f38)[_0x47e7('0x25')](function(_0x32f231){return _0x32f231;});}return null;};}function removeEntity(_0x2c6852,_0x5793b2){return function(_0x17f199){if(_0x17f199){return _0x17f199[_0x47e7('0x26')]()[_0x47e7('0x25')](function(){_0x2c6852[_0x47e7('0x1a')](0xcc)[_0x47e7('0x19')]();});}};}function handleEntityNotFound(_0x1b950f,_0x452a90){return function(_0xfe792f){if(!_0xfe792f){_0x1b950f['sendStatus'](0x194);}return _0xfe792f;};}function handleError(_0x21f350,_0x1003a6){_0x1003a6=_0x1003a6||0x1f4;return function(_0x3a1b0e){logger[_0x47e7('0x27')](_0x3a1b0e[_0x47e7('0x28')]);if(_0x3a1b0e['name']){delete _0x3a1b0e[_0x47e7('0x29')];}_0x21f350[_0x47e7('0x1a')](_0x1003a6)[_0x47e7('0x2a')](_0x3a1b0e);};}exports['index']=function(_0x14f482,_0x26f105){var _0x13284b={},_0x263952={},_0x4e19d8={'count':0x0,'rows':[]};var _0x59bca4=_[_0x47e7('0x2b')](db['JscriptySessionReport'][_0x47e7('0x2c')],function(_0x2c84b8){return{'name':_0x2c84b8['fieldName'],'type':_0x2c84b8[_0x47e7('0x2d')]['key']};});_0x263952[_0x47e7('0x2e')]=_['map'](_0x59bca4,_0x47e7('0x29'));_0x263952[_0x47e7('0x2f')]=_[_0x47e7('0x30')](_0x14f482[_0x47e7('0x2f')]);_0x263952[_0x47e7('0x31')]=_['intersection'](_0x263952[_0x47e7('0x2e')],_0x263952['query']);_0x13284b[_0x47e7('0x32')]=_[_0x47e7('0x33')](_0x263952[_0x47e7('0x2e')],qs['fields'](_0x14f482[_0x47e7('0x2f')][_0x47e7('0x34')]));_0x13284b[_0x47e7('0x32')]=_0x13284b[_0x47e7('0x32')][_0x47e7('0x35')]?_0x13284b[_0x47e7('0x32')]:_0x263952[_0x47e7('0x2e')];if(!_0x14f482[_0x47e7('0x2f')]['hasOwnProperty']('nolimit')){_0x13284b[_0x47e7('0x1e')]=qs[_0x47e7('0x1e')](_0x14f482[_0x47e7('0x2f')][_0x47e7('0x1e')]);_0x13284b[_0x47e7('0x1b')]=qs['offset'](_0x14f482['query'][_0x47e7('0x1b')]);}_0x13284b[_0x47e7('0x36')]=qs['sort'](_0x14f482[_0x47e7('0x2f')][_0x47e7('0x37')]);_0x13284b['where']=qs[_0x47e7('0x31')](_[_0x47e7('0x38')](_0x14f482[_0x47e7('0x2f')],_0x263952[_0x47e7('0x31')]),_0x59bca4);if(_0x14f482[_0x47e7('0x2f')][_0x47e7('0x39')]){_0x13284b[_0x47e7('0x3a')]=_['merge'](_0x13284b[_0x47e7('0x3a')],{'$or':_[_0x47e7('0x2b')](_0x59bca4,function(_0x110a6b){if(_0x110a6b['type']!==_0x47e7('0x3b')){var _0x1b935b={};_0x1b935b[_0x110a6b[_0x47e7('0x29')]]={'$like':'%'+_0x14f482[_0x47e7('0x2f')][_0x47e7('0x39')]+'%'};return _0x1b935b;}})});}_0x13284b=_[_0x47e7('0x3c')]({},_0x13284b,_0x14f482[_0x47e7('0x3d')]);var _0x4c7e38={'where':_0x13284b[_0x47e7('0x3a')]};return db[_0x47e7('0x3e')][_0x47e7('0x1d')](_0x4c7e38)[_0x47e7('0x25')](function(_0x3540f8){_0x4e19d8[_0x47e7('0x1d')]=_0x3540f8;if(_0x14f482[_0x47e7('0x2f')]['includeAll']){_0x13284b[_0x47e7('0x3f')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0x47e7('0x40')](_0x13284b);})[_0x47e7('0x25')](function(_0x20a6f4){_0x4e19d8[_0x47e7('0x41')]=_0x20a6f4;return _0x4e19d8;})['then'](respondWithFilteredResult(_0x26f105,_0x13284b))['catch'](handleError(_0x26f105,null));};exports['show']=function(_0x462ed6,_0x24184f){var _0x59b943={'raw':!![],'where':{'id':_0x462ed6[_0x47e7('0x42')]['id']}},_0x5256c1={};_0x5256c1[_0x47e7('0x2e')]=_[_0x47e7('0x30')](db['JscriptySessionReport'][_0x47e7('0x2c')]);_0x5256c1['query']=_[_0x47e7('0x30')](_0x462ed6[_0x47e7('0x2f')]);_0x5256c1[_0x47e7('0x31')]=_[_0x47e7('0x33')](_0x5256c1[_0x47e7('0x2e')],_0x5256c1[_0x47e7('0x2f')]);_0x59b943[_0x47e7('0x32')]=_['intersection'](_0x5256c1[_0x47e7('0x2e')],qs[_0x47e7('0x34')](_0x462ed6['query']['fields']));_0x59b943['attributes']=_0x59b943[_0x47e7('0x32')][_0x47e7('0x35')]?_0x59b943[_0x47e7('0x32')]:_0x5256c1[_0x47e7('0x2e')];if(_0x462ed6[_0x47e7('0x2f')][_0x47e7('0x43')]){_0x59b943['include']=[{'all':!![]}];}_0x59b943=_[_0x47e7('0x3c')]({},_0x59b943,_0x462ed6[_0x47e7('0x3d')]);return db['JscriptySessionReport'][_0x47e7('0x44')](_0x59b943)[_0x47e7('0x25')](handleEntityNotFound(_0x24184f,null))['then'](respondWithResult(_0x24184f,null))['catch'](handleError(_0x24184f,null));};exports[_0x47e7('0x45')]=function(_0x4118e0,_0xa25817){return db[_0x47e7('0x3e')][_0x47e7('0x45')](_0x4118e0[_0x47e7('0x46')],{})[_0x47e7('0x25')](respondWithResult(_0xa25817,0xc9))[_0x47e7('0x47')](handleError(_0xa25817,null));};exports[_0x47e7('0x48')]=function(_0x2ab19b,_0x4c83d2){if(_0x2ab19b[_0x47e7('0x46')]['id']){delete _0x2ab19b['body']['id'];}return db[_0x47e7('0x3e')][_0x47e7('0x44')]({'where':{'id':_0x2ab19b['params']['id']}})[_0x47e7('0x25')](handleEntityNotFound(_0x4c83d2,null))[_0x47e7('0x25')](saveUpdates(_0x2ab19b[_0x47e7('0x46')],null))[_0x47e7('0x25')](respondWithResult(_0x4c83d2,null))[_0x47e7('0x47')](handleError(_0x4c83d2,null));};exports[_0x47e7('0x26')]=function(_0x198499,_0x5595b8){return db[_0x47e7('0x3e')][_0x47e7('0x44')]({'where':{'id':_0x198499['params']['id']}})[_0x47e7('0x25')](handleEntityNotFound(_0x5595b8,null))[_0x47e7('0x25')](removeEntity(_0x5595b8,null))[_0x47e7('0x47')](handleError(_0x5595b8,null));};exports[_0x47e7('0x49')]=function(_0x33861c,_0x3d9a54){return db[_0x47e7('0x3e')][_0x47e7('0x49')]()['then'](respondWithResult(_0x3d9a54,null))[_0x47e7('0x47')](handleError(_0x3d9a54,null));};exports[_0x47e7('0x4a')]=function(_0x31c5a8,_0x2551d2,_0x6b9f00){var _0x16d06d={'raw':!![],'where':{}};var _0x1dbb9d={};var _0x439b7d={'count':0x0,'rows':[]};return db[_0x47e7('0x3e')][_0x47e7('0x4b')]({'where':{'id':_0x31c5a8[_0x47e7('0x42')]['id']}})['then'](handleEntityNotFound(_0x2551d2,null))[_0x47e7('0x25')](function(_0x43cb86){if(_0x43cb86){_0x1dbb9d['model']=_['keys'](db['JscriptyQuestionReport'][_0x47e7('0x2c')]);_0x1dbb9d['query']=_['keys'](_0x31c5a8[_0x47e7('0x2f')]);_0x1dbb9d[_0x47e7('0x31')]=_['intersection'](_0x1dbb9d[_0x47e7('0x2e')],_0x1dbb9d[_0x47e7('0x2f')]);_0x16d06d[_0x47e7('0x32')]=_[_0x47e7('0x33')](_0x1dbb9d[_0x47e7('0x2e')],qs[_0x47e7('0x34')](_0x31c5a8[_0x47e7('0x2f')]['fields']));_0x16d06d[_0x47e7('0x32')]=_0x16d06d[_0x47e7('0x32')][_0x47e7('0x35')]?_0x16d06d['attributes']:_0x1dbb9d[_0x47e7('0x2e')];if(!_0x31c5a8[_0x47e7('0x2f')][_0x47e7('0x4c')](_0x47e7('0x4d'))){_0x16d06d[_0x47e7('0x1e')]=qs[_0x47e7('0x1e')](_0x31c5a8[_0x47e7('0x2f')]['limit']);_0x16d06d[_0x47e7('0x1b')]=qs['offset'](_0x31c5a8[_0x47e7('0x2f')]['offset']);}_0x16d06d[_0x47e7('0x36')]=qs[_0x47e7('0x37')](_0x31c5a8[_0x47e7('0x2f')]['sort']);_0x16d06d[_0x47e7('0x3a')]=qs[_0x47e7('0x31')](_['pick'](_0x31c5a8[_0x47e7('0x2f')],_0x1dbb9d[_0x47e7('0x31')]));_0x16d06d[_0x47e7('0x3a')][_0x47e7('0x4e')]=_0x43cb86['id'];if(_0x31c5a8[_0x47e7('0x2f')][_0x47e7('0x39')]){_0x16d06d[_0x47e7('0x3a')]=_[_0x47e7('0x3c')](_0x16d06d[_0x47e7('0x3a')],{'$or':_[_0x47e7('0x2b')](_0x16d06d[_0x47e7('0x32')],function(_0x5ef238){var _0x433699={};_0x433699[_0x5ef238]={'$like':'%'+_0x31c5a8[_0x47e7('0x2f')][_0x47e7('0x39')]+'%'};return _0x433699;})});}_0x16d06d=_[_0x47e7('0x3c')]({},_0x16d06d,_0x31c5a8[_0x47e7('0x3d')]);return db['JscriptyQuestionReport'][_0x47e7('0x1d')]({'where':_0x16d06d[_0x47e7('0x3a')]})[_0x47e7('0x25')](function(_0x1e3669){_0x439b7d['count']=_0x1e3669;if(_0x31c5a8[_0x47e7('0x2f')][_0x47e7('0x43')]){_0x16d06d[_0x47e7('0x3f')]=[{'all':!![]}];}return db[_0x47e7('0x4f')][_0x47e7('0x40')](_0x16d06d);})[_0x47e7('0x25')](function(_0x324aa1){_0x439b7d[_0x47e7('0x41')]=_0x324aa1;return _0x439b7d;});}})[_0x47e7('0x25')](respondWithFilteredResult(_0x2551d2,_0x16d06d))[_0x47e7('0x47')](handleError(_0x2551d2,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 7f8eb83..bb37e32 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 _0x2eb2=['moment','bluebird','request-promise','rimraf','exports','define','JscriptySessionReport','report_jscripty_sessions','util','../../config/logger','api'];(function(_0x339f15,_0x217c3a){var _0xdab2a2=function(_0x5ad0bb){while(--_0x5ad0bb){_0x339f15['push'](_0x339f15['shift']());}};_0xdab2a2(++_0x217c3a);}(_0x2eb2,0x19f));var _0x22eb=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x2eb2[_0x5b644e];return _0x49c6bf;};'use strict';var _=require('lodash');var util=require(_0x22eb('0x0'));var logger=require(_0x22eb('0x1'))(_0x22eb('0x2'));var moment=require(_0x22eb('0x3'));var BPromise=require(_0x22eb('0x4'));var rp=require(_0x22eb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x22eb('0x6'));var config=require('../../config/environment');var attributes=require('./jscriptySessionReport.attributes');module[_0x22eb('0x7')]=function(_0x10e116,_0x35dd5b){return _0x10e116[_0x22eb('0x8')](_0x22eb('0x9'),attributes,{'tableName':_0x22eb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe3da=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport','lodash'];(function(_0x23cc76,_0x9c756b){var _0x2f5c13=function(_0x57c44b){while(--_0x57c44b){_0x23cc76['push'](_0x23cc76['shift']());}};_0x2f5c13(++_0x9c756b);}(_0xe3da,0x1cd));var _0xae3d=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xe3da[_0xfae23b];return _0x200640;};'use strict';var _=require(_0xae3d('0x0'));var util=require(_0xae3d('0x1'));var logger=require(_0xae3d('0x2'))(_0xae3d('0x3'));var moment=require(_0xae3d('0x4'));var BPromise=require(_0xae3d('0x5'));var rp=require(_0xae3d('0x6'));var fs=require('fs');var path=require(_0xae3d('0x7'));var rimraf=require(_0xae3d('0x8'));var config=require(_0xae3d('0x9'));var attributes=require(_0xae3d('0xa'));module[_0xae3d('0xb')]=function(_0xa9a1a,_0xa54808){return _0xa9a1a[_0xae3d('0xc')](_0xae3d('0xd'),attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index 1a13803..a0d0a29 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 _0x2a07=['catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info'];(function(_0x18e6c3,_0x3e0e47){var _0x195456=function(_0x213331){while(--_0x213331){_0x18e6c3['push'](_0x18e6c3['shift']());}};_0x195456(++_0x3e0e47);}(_0x2a07,0x74));var _0x72a0=function(_0x3bf04a,_0x56ed90){_0x3bf04a=_0x3bf04a-0x0;var _0x241e4b=_0x2a07[_0x3bf04a];return _0x241e4b;};'use strict';var _=require(_0x72a0('0x0'));var util=require(_0x72a0('0x1'));var moment=require(_0x72a0('0x2'));var BPromise=require(_0x72a0('0x3'));var rs=require(_0x72a0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x72a0('0x5'))['db'];var utils=require(_0x72a0('0x6'));var logger=require(_0x72a0('0x7'))(_0x72a0('0x8'));var config=require(_0x72a0('0x9'));var jayson=require(_0x72a0('0xa'));var client=jayson[_0x72a0('0xb')][_0x72a0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x193e3b,_0x287b06,_0x21c819){return new BPromise(function(_0x2c04eb,_0x22270e){return client[_0x72a0('0xd')](_0x193e3b,_0x21c819)[_0x72a0('0xe')](function(_0x2bc45b){logger['info'](_0x72a0('0xf'),_0x287b06,_0x72a0('0x10'));logger['debug'](_0x72a0('0x11'),_0x287b06,_0x72a0('0x10'),JSON[_0x72a0('0x12')](_0x2bc45b));if(_0x2bc45b[_0x72a0('0x13')]){if(_0x2bc45b[_0x72a0('0x13')]['code']===0x1f4){logger[_0x72a0('0x13')](_0x72a0('0xf'),_0x287b06,_0x2bc45b[_0x72a0('0x13')][_0x72a0('0x14')]);return _0x22270e(_0x2bc45b[_0x72a0('0x13')][_0x72a0('0x14')]);}logger[_0x72a0('0x13')]('JscriptySessionReport,\x20%s,\x20%s',_0x287b06,_0x2bc45b['error'][_0x72a0('0x14')]);return _0x2c04eb(_0x2bc45b[_0x72a0('0x13')][_0x72a0('0x14')]);}else{logger[_0x72a0('0x15')](_0x72a0('0xf'),_0x287b06,_0x72a0('0x10'));_0x2c04eb(_0x2bc45b['result'][_0x72a0('0x14')]);}})[_0x72a0('0x16')](function(_0x16ac70){logger[_0x72a0('0x13')](_0x72a0('0xf'),_0x287b06,_0x16ac70);_0x22270e(_0x16ac70);});});} \ No newline at end of file +var _0xfcf0=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','JscriptySessionReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','lodash','util','bluebird'];(function(_0x5ec453,_0x30b0ba){var _0x25548f=function(_0x387b62){while(--_0x387b62){_0x5ec453['push'](_0x5ec453['shift']());}};_0x25548f(++_0x30b0ba);}(_0xfcf0,0x138));var _0x0fcf=function(_0x2fe689,_0x5794e5){_0x2fe689=_0x2fe689-0x0;var _0x35ea44=_0xfcf0[_0x2fe689];return _0x35ea44;};'use strict';var _=require(_0x0fcf('0x0'));var util=require(_0x0fcf('0x1'));var moment=require('moment');var BPromise=require(_0x0fcf('0x2'));var rs=require(_0x0fcf('0x3'));var fs=require('fs');var Redis=require(_0x0fcf('0x4'));var db=require(_0x0fcf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0fcf('0x6'))(_0x0fcf('0x7'));var config=require(_0x0fcf('0x8'));var jayson=require(_0x0fcf('0x9'));var client=jayson[_0x0fcf('0xa')][_0x0fcf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x61bbb9,_0x2dfdf8,_0x50c575){return new BPromise(function(_0x1388d1,_0x6ced94){return client[_0x0fcf('0xc')](_0x61bbb9,_0x50c575)['then'](function(_0x69a840){logger[_0x0fcf('0xd')](_0x0fcf('0xe'),_0x2dfdf8,'request\x20sent');logger[_0x0fcf('0xf')]('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x2dfdf8,_0x0fcf('0x10'),JSON[_0x0fcf('0x11')](_0x69a840));if(_0x69a840[_0x0fcf('0x12')]){if(_0x69a840['error']['code']===0x1f4){logger[_0x0fcf('0x12')](_0x0fcf('0xe'),_0x2dfdf8,_0x69a840['error'][_0x0fcf('0x13')]);return _0x6ced94(_0x69a840[_0x0fcf('0x12')][_0x0fcf('0x13')]);}logger[_0x0fcf('0x12')](_0x0fcf('0xe'),_0x2dfdf8,_0x69a840['error'][_0x0fcf('0x13')]);return _0x1388d1(_0x69a840[_0x0fcf('0x12')][_0x0fcf('0x13')]);}else{logger['info'](_0x0fcf('0xe'),_0x2dfdf8,_0x0fcf('0x10'));_0x1388d1(_0x69a840[_0x0fcf('0x14')][_0x0fcf('0x13')]);}})['catch'](function(_0x3e78d0){logger[_0x0fcf('0x12')](_0x0fcf('0xe'),_0x2dfdf8,_0x3e78d0);_0x6ced94(_0x3e78d0);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 95e8471..349875d 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 _0xfae3=['Router','../../components/interaction/service','../../config/environment','./license.controller','get','index','/:id','isAuthenticated','update','/download_log_file','downloadLogFile','multer','connect-timeout','express'];(function(_0x41caef,_0x4a1bee){var _0x3d6545=function(_0x14d23e){while(--_0x14d23e){_0x41caef['push'](_0x41caef['shift']());}};_0x3d6545(++_0x4a1bee);}(_0xfae3,0x1bd));var _0x3fae=function(_0x5ec21d,_0x5d0772){_0x5ec21d=_0x5ec21d-0x0;var _0x43bde8=_0xfae3[_0x5ec21d];return _0x43bde8;};'use strict';var multer=require(_0x3fae('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3fae('0x1'));var express=require(_0x3fae('0x2'));var router=express[_0x3fae('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x3fae('0x4'));var config=require(_0x3fae('0x5'));var controller=require(_0x3fae('0x6'));router[_0x3fae('0x7')]('/',controller[_0x3fae('0x8')]);router['put'](_0x3fae('0x9'),auth[_0x3fae('0xa')](),controller[_0x3fae('0xb')]);router[_0x3fae('0x7')](_0x3fae('0xc'),auth['isAuthenticated'](),controller[_0x3fae('0xd')]);module['exports']=router; \ No newline at end of file +var _0xd8c5=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./license.controller','get','index','put','update','/download_log_file','isAuthenticated','downloadLogFile','exports'];(function(_0x387777,_0x356171){var _0x3f84c0=function(_0x4d4423){while(--_0x4d4423){_0x387777['push'](_0x387777['shift']());}};_0x3f84c0(++_0x356171);}(_0xd8c5,0x1ed));var _0x5d8c=function(_0x39ed13,_0x1f6c0a){_0x39ed13=_0x39ed13-0x0;var _0x1170ff=_0xd8c5[_0x39ed13];return _0x1170ff;};'use strict';var multer=require(_0x5d8c('0x0'));var util=require(_0x5d8c('0x1'));var path=require(_0x5d8c('0x2'));var timeout=require(_0x5d8c('0x3'));var express=require(_0x5d8c('0x4'));var router=express[_0x5d8c('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x5d8c('0x6'));var interaction=require(_0x5d8c('0x7'));var config=require('../../config/environment');var controller=require(_0x5d8c('0x8'));router[_0x5d8c('0x9')]('/',controller[_0x5d8c('0xa')]);router[_0x5d8c('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x5d8c('0xc')]);router[_0x5d8c('0x9')](_0x5d8c('0xd'),auth[_0x5d8c('0xe')](),controller[_0x5d8c('0xf')]);module[_0x5d8c('0x10')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index d96f889..df0e134 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 _0x6823=['INTEGER','exports','TEXT','STRING'];(function(_0x133ff0,_0x2ef965){var _0x4e13c2=function(_0x3a9e3e){while(--_0x3a9e3e){_0x133ff0['push'](_0x133ff0['shift']());}};_0x4e13c2(++_0x2ef965);}(_0x6823,0xd1));var _0x3682=function(_0x114d74,_0x540312){_0x114d74=_0x114d74-0x0;var _0x1977c7=_0x6823[_0x114d74];return _0x1977c7;};'use strict';var Sequelize=require('sequelize');module[_0x3682('0x0')]={'license':{'type':Sequelize[_0x3682('0x1')]},'data1':{'type':Sequelize[_0x3682('0x2')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize[_0x3682('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x588c=['exports','STRING','INTEGER'];(function(_0xdf2b29,_0x48d9f8){var _0x1c9422=function(_0x23a9c3){while(--_0x23a9c3){_0xdf2b29['push'](_0xdf2b29['shift']());}};_0x1c9422(++_0x48d9f8);}(_0x588c,0x8a));var _0xc588=function(_0x200994,_0x4a99ed){_0x200994=_0x200994-0x0;var _0x2a5042=_0x588c[_0x200994];return _0x2a5042;};'use strict';var Sequelize=require('sequelize');module[_0xc588('0x0')]={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize[_0xc588('0x1')]},'data2':{'type':Sequelize[_0xc588('0x1')]},'chatLicenseExceeded':{'type':Sequelize[_0xc588('0x2')],'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 b7da715..af12c76 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 _0x07b8=['reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','keys','rawAttributes','query','intersection','model','attributes','fields','length','merge','options','getLicense','catch','body','find','checkLicense','key','demo','downloadLogFile','license-info.log','join','/var','log','xcally','setHeader','Content-disposition','attachment;\x20filename=','set','Content-Type','text/plain','download','eml-format','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','end','offset','undefined','limit','count','Content-Range','json','apply'];(function(_0x4e18f4,_0x5c9630){var _0x3de49e=function(_0x3b8b21){while(--_0x3b8b21){_0x4e18f4['push'](_0x4e18f4['shift']());}};_0x3de49e(++_0x5c9630);}(_0x07b8,0x72));var _0x807b=function(_0x53c09b,_0x2aa155){_0x53c09b=_0x53c09b-0x0;var _0x474492=_0x07b8[_0x53c09b];return _0x474492;};'use strict';var emlformat=require(_0x807b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x807b('0x1'));var jsonpatch=require(_0x807b('0x2'));var rp=require('request-promise');var moment=require(_0x807b('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x807b('0x4'));var util=require('util');var path=require(_0x807b('0x5'));var sox=require(_0x807b('0x6'));var csv=require(_0x807b('0x7'));var ejs=require(_0x807b('0x8'));var fs=require('fs');var fs_extra=require(_0x807b('0x9'));var _=require(_0x807b('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x807b('0xb'));var deskjs=require(_0x807b('0xc'));var toCsv=require(_0x807b('0x7'));var querystring=require('querystring');var Papa=require(_0x807b('0xd'));var Redis=require(_0x807b('0xe'));var authService=require(_0x807b('0xf'));var qs=require(_0x807b('0x10'));var as=require(_0x807b('0x11'));var hardwareService=require(_0x807b('0x12'));var logger=require(_0x807b('0x13'))(_0x807b('0x14'));var utils=require('../../config/utils');var config=require(_0x807b('0x15'));var licenseUtil=require(_0x807b('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x37bf1c,_0x45eedf){_0x45eedf=_0x45eedf||0xcc;return function(_0x2f3b89){if(_0x2f3b89){return _0x37bf1c['sendStatus'](_0x45eedf);}return _0x37bf1c[_0x807b('0x17')](_0x45eedf)[_0x807b('0x18')]();};}function respondWithResult(_0x5c63c0,_0x3d3db0){_0x3d3db0=_0x3d3db0||0xc8;return function(_0x3cff9a){if(_0x3cff9a){return _0x5c63c0[_0x807b('0x17')](_0x3d3db0)['json'](_0x3cff9a);}};}function respondWithFilteredResult(_0x3d52ae,_0x5064c5){return function(_0x3c29c1){if(_0x3c29c1){var _0x22356d=typeof _0x5064c5[_0x807b('0x19')]===_0x807b('0x1a')&&typeof _0x5064c5[_0x807b('0x1b')]===_0x807b('0x1a');var _0x3f6ea7=_0x3c29c1[_0x807b('0x1c')];var _0x2138df=_0x22356d?0x0:_0x5064c5[_0x807b('0x19')];var _0x57c39c=_0x22356d?_0x3c29c1['count']:_0x5064c5['offset']+_0x5064c5['limit'];var _0x2a75bf;if(_0x57c39c>=_0x3f6ea7){_0x57c39c=_0x3f6ea7;_0x2a75bf=0xc8;}else{_0x2a75bf=0xce;}_0x3d52ae[_0x807b('0x17')](_0x2a75bf);return _0x3d52ae['set'](_0x807b('0x1d'),_0x2138df+'-'+_0x57c39c+'/'+_0x3f6ea7)[_0x807b('0x1e')](_0x3c29c1);}return null;};}function patchUpdates(_0x4214a0){return function(_0x289b7c){try{jsonpatch[_0x807b('0x1f')](_0x289b7c,_0x4214a0,!![]);}catch(_0x85156a){return BPromise[_0x807b('0x20')](_0x85156a);}return _0x289b7c[_0x807b('0x21')]();};}function saveUpdates(_0x4a65a0,_0x14bf1a){return function(_0x23f18d){if(_0x23f18d){return _0x23f18d[_0x807b('0x22')](_0x4a65a0)[_0x807b('0x23')](function(_0x3673ef){return _0x3673ef;});}return null;};}function removeEntity(_0x2b88fa,_0x137545){return function(_0x8c801d){if(_0x8c801d){return _0x8c801d[_0x807b('0x24')]()[_0x807b('0x23')](function(){_0x2b88fa[_0x807b('0x17')](0xcc)[_0x807b('0x18')]();});}};}function handleEntityNotFound(_0xff34c7,_0x494c6c){return function(_0x6ae90c){if(!_0x6ae90c){_0xff34c7[_0x807b('0x25')](0x194);}return _0x6ae90c;};}function handleError(_0x349642,_0x324d71){_0x324d71=_0x324d71||0x1f4;return function(_0x44e09e){logger[_0x807b('0x26')](_0x44e09e[_0x807b('0x27')]);if(_0x44e09e[_0x807b('0x28')]){delete _0x44e09e[_0x807b('0x28')];}_0x349642[_0x807b('0x17')](_0x324d71)[_0x807b('0x29')](_0x44e09e);};}var utilLicense=require('../../config/license/util');exports[_0x807b('0x2a')]=function(_0x36de28,_0x2949e8){var _0x28eea8={'raw':!![],'where':{'id':0x1}},_0x5f0573={};_0x5f0573['model']=_[_0x807b('0x2b')](db['License'][_0x807b('0x2c')]);_0x5f0573[_0x807b('0x2d')]=_[_0x807b('0x2b')](_0x36de28[_0x807b('0x2d')]);_0x5f0573['filters']=_[_0x807b('0x2e')](_0x5f0573[_0x807b('0x2f')],_0x5f0573[_0x807b('0x2d')]);_0x28eea8[_0x807b('0x30')]=_[_0x807b('0x2e')](_0x5f0573[_0x807b('0x2f')],qs[_0x807b('0x31')](_0x36de28['query'][_0x807b('0x31')]));_0x28eea8[_0x807b('0x30')]=_0x28eea8[_0x807b('0x30')][_0x807b('0x32')]?_0x28eea8[_0x807b('0x30')]:_0x5f0573[_0x807b('0x2f')];_0x28eea8=_[_0x807b('0x33')]({},_0x28eea8,_0x36de28[_0x807b('0x34')]);return utilLicense[_0x807b('0x35')](_0x28eea8)[_0x807b('0x23')](respondWithResult(_0x2949e8,null))[_0x807b('0x36')](handleError(_0x2949e8,null));};exports['update']=function(_0x3d222e,_0x319f31){if(_0x3d222e[_0x807b('0x37')]['id']){delete _0x3d222e[_0x807b('0x37')]['id'];}return db['License'][_0x807b('0x38')]({'where':{'id':_0x3d222e['params']['id']}})[_0x807b('0x23')](handleEntityNotFound(_0x319f31,null))['then'](function(_0x21cfa7){var _0x266933=_0x21cfa7['get']({'plain':!![]});return utilLicense[_0x807b('0x39')](_0x266933,_0x3d222e[_0x807b('0x37')][_0x807b('0x3a')]);})['then'](function(_0x4432d2){if(!_0x4432d2[_0x807b('0x3b')]){return saveUpdates(_0x3d222e['body'],null);}return _0x4432d2;})[_0x807b('0x23')](respondWithResult(_0x319f31,null))['catch'](handleError(_0x319f31,null));};exports[_0x807b('0x3c')]=function(_0x1506c8,_0x160faf){var _0x31b2b7=_0x807b('0x3d');var _0x514646=path[_0x807b('0x3e')](_0x807b('0x3f'),_0x807b('0x40'),_0x807b('0x41'),_0x31b2b7);_0x160faf[_0x807b('0x42')](_0x807b('0x43'),_0x807b('0x44')+_0x31b2b7);_0x160faf[_0x807b('0x45')](_0x807b('0x46'),_0x807b('0x47'));_0x160faf[_0x807b('0x48')](_0x514646);}; \ No newline at end of file +var _0x05eb=['index','keys','rawAttributes','query','filters','intersection','attributes','length','options','catch','body','find','params','key','demo','downloadLogFile','join','/var','log','attachment;\x20filename=','text/plain','download','eml-format','rimraf','fast-json-patch','moment','util','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','save','update','then','sendStatus','error','name','send'];(function(_0xd46fd6,_0x2dfa03){var _0x2af962=function(_0xab75a7){while(--_0xab75a7){_0xd46fd6['push'](_0xd46fd6['shift']());}};_0x2af962(++_0x2dfa03);}(_0x05eb,0xcd));var _0xb05e=function(_0x4c25d9,_0x551b93){_0x4c25d9=_0x4c25d9-0x0;var _0x4984a5=_0x05eb[_0x4c25d9];return _0x4984a5;};'use strict';var emlformat=require(_0xb05e('0x0'));var rimraf=require(_0xb05e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb05e('0x2'));var rp=require('request-promise');var moment=require(_0xb05e('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb05e('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0xb05e('0x5'));var ejs=require(_0xb05e('0x6'));var fs=require('fs');var fs_extra=require(_0xb05e('0x7'));var _=require('lodash');var squel=require(_0xb05e('0x8'));var crypto=require(_0xb05e('0x9'));var jsforce=require(_0xb05e('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb05e('0xb'));var Papa=require(_0xb05e('0xc'));var Redis=require(_0xb05e('0xd'));var authService=require(_0xb05e('0xe'));var qs=require(_0xb05e('0xf'));var as=require(_0xb05e('0x10'));var hardwareService=require(_0xb05e('0x11'));var logger=require('../../config/logger')(_0xb05e('0x12'));var utils=require(_0xb05e('0x13'));var config=require(_0xb05e('0x14'));var licenseUtil=require(_0xb05e('0x15'));var db=require(_0xb05e('0x16'))['db'];function respondWithStatusCode(_0xdb4ba3,_0x127b94){_0x127b94=_0x127b94||0xcc;return function(_0xb4e2fa){if(_0xb4e2fa){return _0xdb4ba3['sendStatus'](_0x127b94);}return _0xdb4ba3[_0xb05e('0x17')](_0x127b94)[_0xb05e('0x18')]();};}function respondWithResult(_0x412cd3,_0x5e7b17){_0x5e7b17=_0x5e7b17||0xc8;return function(_0x6dad34){if(_0x6dad34){return _0x412cd3[_0xb05e('0x17')](_0x5e7b17)[_0xb05e('0x19')](_0x6dad34);}};}function respondWithFilteredResult(_0x23954c,_0x1fa54e){return function(_0x4f15c1){if(_0x4f15c1){var _0x472324=typeof _0x1fa54e['offset']===_0xb05e('0x1a')&&typeof _0x1fa54e[_0xb05e('0x1b')]==='undefined';var _0x142cf7=_0x4f15c1[_0xb05e('0x1c')];var _0x1b48cf=_0x472324?0x0:_0x1fa54e['offset'];var _0x1ad9e0=_0x472324?_0x4f15c1[_0xb05e('0x1c')]:_0x1fa54e[_0xb05e('0x1d')]+_0x1fa54e[_0xb05e('0x1b')];var _0x2bff00;if(_0x1ad9e0>=_0x142cf7){_0x1ad9e0=_0x142cf7;_0x2bff00=0xc8;}else{_0x2bff00=0xce;}_0x23954c['status'](_0x2bff00);return _0x23954c[_0xb05e('0x1e')](_0xb05e('0x1f'),_0x1b48cf+'-'+_0x1ad9e0+'/'+_0x142cf7)[_0xb05e('0x19')](_0x4f15c1);}return null;};}function patchUpdates(_0x43bbfa){return function(_0x2148e5){try{jsonpatch['apply'](_0x2148e5,_0x43bbfa,!![]);}catch(_0x5aecf6){return BPromise['reject'](_0x5aecf6);}return _0x2148e5[_0xb05e('0x20')]();};}function saveUpdates(_0x364239,_0x9e83df){return function(_0x37efd5){if(_0x37efd5){return _0x37efd5[_0xb05e('0x21')](_0x364239)[_0xb05e('0x22')](function(_0x324df7){return _0x324df7;});}return null;};}function removeEntity(_0x2326ab,_0x233af8){return function(_0x2d80d9){if(_0x2d80d9){return _0x2d80d9['destroy']()[_0xb05e('0x22')](function(){_0x2326ab[_0xb05e('0x17')](0xcc)[_0xb05e('0x18')]();});}};}function handleEntityNotFound(_0x3872be,_0x7de20b){return function(_0x321644){if(!_0x321644){_0x3872be[_0xb05e('0x23')](0x194);}return _0x321644;};}function handleError(_0x201281,_0x271ee5){_0x271ee5=_0x271ee5||0x1f4;return function(_0x13a96d){logger[_0xb05e('0x24')](_0x13a96d['stack']);if(_0x13a96d[_0xb05e('0x25')]){delete _0x13a96d['name'];}_0x201281[_0xb05e('0x17')](_0x271ee5)[_0xb05e('0x26')](_0x13a96d);};}var utilLicense=require(_0xb05e('0x15'));exports[_0xb05e('0x27')]=function(_0x2fd23a,_0xec9226){var _0x4c05bd={'raw':!![],'where':{'id':0x1}},_0x1a79b0={};_0x1a79b0['model']=_[_0xb05e('0x28')](db['License'][_0xb05e('0x29')]);_0x1a79b0['query']=_['keys'](_0x2fd23a[_0xb05e('0x2a')]);_0x1a79b0[_0xb05e('0x2b')]=_['intersection'](_0x1a79b0['model'],_0x1a79b0[_0xb05e('0x2a')]);_0x4c05bd['attributes']=_[_0xb05e('0x2c')](_0x1a79b0['model'],qs['fields'](_0x2fd23a[_0xb05e('0x2a')]['fields']));_0x4c05bd['attributes']=_0x4c05bd[_0xb05e('0x2d')][_0xb05e('0x2e')]?_0x4c05bd[_0xb05e('0x2d')]:_0x1a79b0['model'];_0x4c05bd=_['merge']({},_0x4c05bd,_0x2fd23a[_0xb05e('0x2f')]);return utilLicense['getLicense'](_0x4c05bd)[_0xb05e('0x22')](respondWithResult(_0xec9226,null))[_0xb05e('0x30')](handleError(_0xec9226,null));};exports['update']=function(_0x5e6b3c,_0x531385){if(_0x5e6b3c['body']['id']){delete _0x5e6b3c[_0xb05e('0x31')]['id'];}return db['License'][_0xb05e('0x32')]({'where':{'id':_0x5e6b3c[_0xb05e('0x33')]['id']}})[_0xb05e('0x22')](handleEntityNotFound(_0x531385,null))[_0xb05e('0x22')](function(_0x697dca){var _0xa09af2=_0x697dca['get']({'plain':!![]});return utilLicense['checkLicense'](_0xa09af2,_0x5e6b3c[_0xb05e('0x31')][_0xb05e('0x34')]);})[_0xb05e('0x22')](function(_0x5a91a0){if(!_0x5a91a0[_0xb05e('0x35')]){return saveUpdates(_0x5e6b3c[_0xb05e('0x31')],null);}return _0x5a91a0;})[_0xb05e('0x22')](respondWithResult(_0x531385,null))['catch'](handleError(_0x531385,null));};exports[_0xb05e('0x36')]=function(_0x5c722b,_0x342e80){var _0x1866c4='license-info.log';var _0x81b3f2=path[_0xb05e('0x37')](_0xb05e('0x38'),_0xb05e('0x39'),'xcally',_0x1866c4);_0x342e80['setHeader']('Content-disposition',_0xb05e('0x3a')+_0x1866c4);_0x342e80['set']('Content-Type',_0xb05e('0x3b'));_0x342e80[_0xb05e('0x3c')](_0x81b3f2);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 3a7bbf8..06b569b 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 _0x9e37=['exports','define','License','license','lodash','util','../../config/logger','api','moment','path','../../config/environment','./license.attributes'];(function(_0x18a385,_0x487e93){var _0x999059=function(_0x1c6586){while(--_0x1c6586){_0x18a385['push'](_0x18a385['shift']());}};_0x999059(++_0x487e93);}(_0x9e37,0xf4));var _0x79e3=function(_0x216e72,_0x5cd161){_0x216e72=_0x216e72-0x0;var _0x2ff28d=_0x9e37[_0x216e72];return _0x2ff28d;};'use strict';var _=require(_0x79e3('0x0'));var util=require(_0x79e3('0x1'));var logger=require(_0x79e3('0x2'))(_0x79e3('0x3'));var moment=require(_0x79e3('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x79e3('0x5'));var rimraf=require('rimraf');var config=require(_0x79e3('0x6'));var attributes=require(_0x79e3('0x7'));module[_0x79e3('0x8')]=function(_0x5725d5,_0x2ac318){return _0x5725d5[_0x79e3('0x9')](_0x79e3('0xa'),attributes,{'tableName':_0x79e3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6f68=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./license.attributes','exports','define','License','license'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x6f68,0x1dc));var _0x86f6=function(_0x5285ec,_0x45d88b){_0x5285ec=_0x5285ec-0x0;var _0x25ee5d=_0x6f68[_0x5285ec];return _0x25ee5d;};'use strict';var _=require(_0x86f6('0x0'));var util=require(_0x86f6('0x1'));var logger=require(_0x86f6('0x2'))(_0x86f6('0x3'));var moment=require(_0x86f6('0x4'));var BPromise=require(_0x86f6('0x5'));var rp=require(_0x86f6('0x6'));var fs=require('fs');var path=require(_0x86f6('0x7'));var rimraf=require(_0x86f6('0x8'));var config=require('../../config/environment');var attributes=require(_0x86f6('0x9'));module[_0x86f6('0xa')]=function(_0xacea9f,_0x3a9ff5){return _0xacea9f[_0x86f6('0xb')](_0x86f6('0xc'),attributes,{'tableName':_0x86f6('0xd'),'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 89b6b87..66da4a2 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 _0xd06b=['rpc','jayson/promise','client','request','info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x558bb2,_0x6f252e){var _0x2364b8=function(_0x3ccd54){while(--_0x3ccd54){_0x558bb2['push'](_0x558bb2['shift']());}};_0x2364b8(++_0x6f252e);}(_0xd06b,0x1c4));var _0xbd06=function(_0x52eb14,_0x5485bc){_0x52eb14=_0x52eb14-0x0;var _0x6f1e2e=_0xd06b[_0x52eb14];return _0x6f1e2e;};'use strict';var _=require(_0xbd06('0x0'));var util=require(_0xbd06('0x1'));var moment=require(_0xbd06('0x2'));var BPromise=require(_0xbd06('0x3'));var rs=require(_0xbd06('0x4'));var fs=require('fs');var Redis=require(_0xbd06('0x5'));var db=require(_0xbd06('0x6'))['db'];var utils=require(_0xbd06('0x7'));var logger=require('../../config/logger')(_0xbd06('0x8'));var config=require('../../config/environment');var jayson=require(_0xbd06('0x9'));var client=jayson[_0xbd06('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d2e66,_0x28a2cc,_0x2acce8){return new BPromise(function(_0x25d3d2,_0x2ee88b){return client[_0xbd06('0xb')](_0x5d2e66,_0x2acce8)['then'](function(_0x432a15){logger[_0xbd06('0xc')](_0xbd06('0xd'),_0x28a2cc,_0xbd06('0xe'));logger[_0xbd06('0xf')](_0xbd06('0x10'),_0x28a2cc,_0xbd06('0xe'),JSON[_0xbd06('0x11')](_0x432a15));if(_0x432a15[_0xbd06('0x12')]){if(_0x432a15[_0xbd06('0x12')][_0xbd06('0x13')]===0x1f4){logger[_0xbd06('0x12')](_0xbd06('0xd'),_0x28a2cc,_0x432a15['error'][_0xbd06('0x14')]);return _0x2ee88b(_0x432a15[_0xbd06('0x12')][_0xbd06('0x14')]);}logger['error'](_0xbd06('0xd'),_0x28a2cc,_0x432a15[_0xbd06('0x12')][_0xbd06('0x14')]);return _0x25d3d2(_0x432a15['error']['message']);}else{logger[_0xbd06('0xc')](_0xbd06('0xd'),_0x28a2cc,'request\x20sent');_0x25d3d2(_0x432a15[_0xbd06('0x15')][_0xbd06('0x14')]);}})[_0xbd06('0x16')](function(_0x3dcb67){logger[_0xbd06('0x12')](_0xbd06('0xd'),_0x28a2cc,_0x3dcb67);_0x2ee88b(_0x3dcb67);});});} \ No newline at end of file +var _0x3606=['License,\x20%s,\x20%s','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','info','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x3606,0xae));var _0x6360=function(_0x22eb96,_0x3c2d8d){_0x22eb96=_0x22eb96-0x0;var _0x5e1adf=_0x3606[_0x22eb96];return _0x5e1adf;};'use strict';var _=require('lodash');var util=require(_0x6360('0x0'));var moment=require(_0x6360('0x1'));var BPromise=require(_0x6360('0x2'));var rs=require(_0x6360('0x3'));var fs=require('fs');var Redis=require(_0x6360('0x4'));var db=require(_0x6360('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6360('0x6'))('rpc');var config=require(_0x6360('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6360('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2de889,_0x39d8bf,_0xb93f29){return new BPromise(function(_0x3345a0,_0x7e0474){return client['request'](_0x2de889,_0xb93f29)['then'](function(_0x486cf0){logger[_0x6360('0x9')]('License,\x20%s,\x20%s',_0x39d8bf,_0x6360('0xa'));logger[_0x6360('0xb')](_0x6360('0xc'),_0x39d8bf,_0x6360('0xa'),JSON[_0x6360('0xd')](_0x486cf0));if(_0x486cf0['error']){if(_0x486cf0[_0x6360('0xe')][_0x6360('0xf')]===0x1f4){logger[_0x6360('0xe')](_0x6360('0x10'),_0x39d8bf,_0x486cf0[_0x6360('0xe')]['message']);return _0x7e0474(_0x486cf0['error'][_0x6360('0x11')]);}logger[_0x6360('0xe')]('License,\x20%s,\x20%s',_0x39d8bf,_0x486cf0['error'][_0x6360('0x11')]);return _0x3345a0(_0x486cf0[_0x6360('0xe')][_0x6360('0x11')]);}else{logger[_0x6360('0x9')]('License,\x20%s,\x20%s',_0x39d8bf,_0x6360('0xa'));_0x3345a0(_0x486cf0['result'][_0x6360('0x11')]);}})[_0x6360('0x12')](function(_0x42afb8){logger['error'](_0x6360('0x10'),_0x39d8bf,_0x42afb8);_0x7e0474(_0x42afb8);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 6b20e61..70f6b37 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 _0x7764=['addAnswer','addImap','/:id/out_servers','addSmtp','/:id/interactions','addInteraction','addApplications','/:id/send','send','/:id/users','addAgents','put','removeDispositions','removeAnswers','delete','removeSmtp','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getAnswers','/:id/in_servers','getImap','getInteractions','/:id/applications','getApplications','getMessages','/:id/verify','verifySmtp','addDisposition','post','/:id/canned_answers'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0x7764,0xec));var _0x4776=function(_0x1bbc08,_0x444008){_0x1bbc08=_0x1bbc08-0x0;var _0x5d825b=_0x7764[_0x1bbc08];return _0x5d825b;};'use strict';var multer=require(_0x4776('0x0'));var util=require('util');var path=require(_0x4776('0x1'));var timeout=require(_0x4776('0x2'));var express=require('express');var router=express[_0x4776('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x4776('0x4'));var interaction=require(_0x4776('0x5'));var config=require(_0x4776('0x6'));var controller=require(_0x4776('0x7'));router[_0x4776('0x8')]('/',auth[_0x4776('0x9')](),controller[_0x4776('0xa')]);router[_0x4776('0x8')](_0x4776('0xb'),auth['isAuthenticated'](),controller[_0x4776('0xc')]);router[_0x4776('0x8')](_0x4776('0xd'),auth[_0x4776('0x9')](),controller[_0x4776('0xe')]);router['get'](_0x4776('0xf'),auth['isAuthenticated'](),controller['getDispositions']);router[_0x4776('0x8')]('/:id/canned_answers',auth[_0x4776('0x9')](),controller[_0x4776('0x10')]);router[_0x4776('0x8')](_0x4776('0x11'),auth[_0x4776('0x9')](),controller[_0x4776('0x12')]);router[_0x4776('0x8')]('/:id/out_servers',auth[_0x4776('0x9')](),controller['getSmtp']);router[_0x4776('0x8')]('/:id/interactions',auth[_0x4776('0x9')](),controller[_0x4776('0x13')]);router[_0x4776('0x8')](_0x4776('0x14'),auth[_0x4776('0x9')](),controller[_0x4776('0x15')]);router['get']('/:id/messages',auth[_0x4776('0x9')](),controller[_0x4776('0x16')]);router[_0x4776('0x8')](_0x4776('0x17'),auth[_0x4776('0x9')](),controller[_0x4776('0x18')]);router[_0x4776('0x8')]('/:id/users',auth[_0x4776('0x9')](),controller['getAgents']);router['post']('/:id/dispositions',auth[_0x4776('0x9')](),controller[_0x4776('0x19')]);router[_0x4776('0x1a')](_0x4776('0x1b'),auth[_0x4776('0x9')](),controller[_0x4776('0x1c')]);router[_0x4776('0x1a')]('/',auth[_0x4776('0x9')](),controller['create']);router[_0x4776('0x1a')](_0x4776('0x11'),auth['isAuthenticated'](),controller[_0x4776('0x1d')]);router['post'](_0x4776('0x1e'),auth['isAuthenticated'](),controller[_0x4776('0x1f')]);router[_0x4776('0x1a')](_0x4776('0x20'),auth[_0x4776('0x9')](),controller[_0x4776('0x21')]);router[_0x4776('0x1a')](_0x4776('0x14'),auth[_0x4776('0x9')](),controller[_0x4776('0x22')]);router[_0x4776('0x1a')](_0x4776('0x23'),auth[_0x4776('0x9')](),controller[_0x4776('0x24')]);router[_0x4776('0x1a')](_0x4776('0x25'),auth['isAuthenticated'](),controller[_0x4776('0x26')]);router[_0x4776('0x27')](_0x4776('0xd'),auth[_0x4776('0x9')](),controller['update']);router['delete'](_0x4776('0xf'),auth[_0x4776('0x9')](),controller[_0x4776('0x28')]);router['delete']('/:id/canned_answers',auth[_0x4776('0x9')](),controller[_0x4776('0x29')]);router['delete'](_0x4776('0x11'),auth[_0x4776('0x9')](),controller['removeImap']);router[_0x4776('0x2a')](_0x4776('0x1e'),auth['isAuthenticated'](),controller[_0x4776('0x2b')]);router['delete'](_0x4776('0xd'),auth[_0x4776('0x9')](),controller['destroy']);router['delete'](_0x4776('0x25'),auth[_0x4776('0x9')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x3d81=['/:id/in_servers','getImap','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users','post','/:id/dispositions','addDisposition','addAnswer','create','addImap','addSmtp','addInteraction','/:id/send','addAgents','put','update','removeDispositions','delete','removeAnswers','/:id/out_servers','removeSmtp','destroy','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','index','isAuthenticated','describe','/:id','show','getDispositions','/:id/canned_answers'];(function(_0x35cb04,_0x16af9a){var _0x1fcb40=function(_0x39cd31){while(--_0x39cd31){_0x35cb04['push'](_0x35cb04['shift']());}};_0x1fcb40(++_0x16af9a);}(_0x3d81,0x1d8));var _0x13d8=function(_0x4c85cd,_0x4b054a){_0x4c85cd=_0x4c85cd-0x0;var _0x4b1038=_0x3d81[_0x4c85cd];return _0x4b1038;};'use strict';var multer=require(_0x13d8('0x0'));var util=require(_0x13d8('0x1'));var path=require(_0x13d8('0x2'));var timeout=require(_0x13d8('0x3'));var express=require('express');var router=express[_0x13d8('0x4')]();var fs_extra=require(_0x13d8('0x5'));var auth=require(_0x13d8('0x6'));var interaction=require(_0x13d8('0x7'));var config=require(_0x13d8('0x8'));var controller=require(_0x13d8('0x9'));router[_0x13d8('0xa')]('/',auth['isAuthenticated'](),controller[_0x13d8('0xb')]);router[_0x13d8('0xa')]('/describe',auth[_0x13d8('0xc')](),controller[_0x13d8('0xd')]);router[_0x13d8('0xa')](_0x13d8('0xe'),auth[_0x13d8('0xc')](),controller[_0x13d8('0xf')]);router[_0x13d8('0xa')]('/:id/dispositions',auth[_0x13d8('0xc')](),controller[_0x13d8('0x10')]);router['get'](_0x13d8('0x11'),auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x13d8('0x12'),auth[_0x13d8('0xc')](),controller[_0x13d8('0x13')]);router[_0x13d8('0xa')]('/:id/out_servers',auth[_0x13d8('0xc')](),controller['getSmtp']);router['get'](_0x13d8('0x14'),auth[_0x13d8('0xc')](),controller[_0x13d8('0x15')]);router[_0x13d8('0xa')](_0x13d8('0x16'),auth['isAuthenticated'](),controller[_0x13d8('0x17')]);router['get'](_0x13d8('0x18'),auth[_0x13d8('0xc')](),controller[_0x13d8('0x19')]);router[_0x13d8('0xa')](_0x13d8('0x1a'),auth[_0x13d8('0xc')](),controller[_0x13d8('0x1b')]);router[_0x13d8('0xa')](_0x13d8('0x1c'),auth['isAuthenticated'](),controller['getAgents']);router[_0x13d8('0x1d')](_0x13d8('0x1e'),auth[_0x13d8('0xc')](),controller[_0x13d8('0x1f')]);router[_0x13d8('0x1d')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x13d8('0x20')]);router[_0x13d8('0x1d')]('/',auth['isAuthenticated'](),controller[_0x13d8('0x21')]);router['post']('/:id/in_servers',auth[_0x13d8('0xc')](),controller[_0x13d8('0x22')]);router[_0x13d8('0x1d')]('/:id/out_servers',auth[_0x13d8('0xc')](),controller[_0x13d8('0x23')]);router[_0x13d8('0x1d')]('/:id/interactions',auth[_0x13d8('0xc')](),controller[_0x13d8('0x24')]);router[_0x13d8('0x1d')](_0x13d8('0x16'),auth['isAuthenticated'](),controller['addApplications']);router[_0x13d8('0x1d')](_0x13d8('0x25'),auth[_0x13d8('0xc')](),controller['send']);router[_0x13d8('0x1d')]('/:id/users',auth['isAuthenticated'](),controller[_0x13d8('0x26')]);router[_0x13d8('0x27')]('/:id',auth['isAuthenticated'](),controller[_0x13d8('0x28')]);router['delete'](_0x13d8('0x1e'),auth[_0x13d8('0xc')](),controller[_0x13d8('0x29')]);router[_0x13d8('0x2a')](_0x13d8('0x11'),auth['isAuthenticated'](),controller[_0x13d8('0x2b')]);router[_0x13d8('0x2a')](_0x13d8('0x12'),auth[_0x13d8('0xc')](),controller['removeImap']);router['delete'](_0x13d8('0x2c'),auth[_0x13d8('0xc')](),controller[_0x13d8('0x2d')]);router[_0x13d8('0x2a')](_0x13d8('0xe'),auth['isAuthenticated'](),controller[_0x13d8('0x2e')]);router['delete'](_0x13d8('0x1c'),auth[_0x13d8('0xc')](),controller[_0x13d8('0x2f')]);module[_0x13d8('0x30')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 3d2730e..6de2051 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 _0xda02=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','ENUM','hotmail','yahoo','outlook365','getDataValue','provider','custom','sequelize','exports','STRING','BOOLEAN','TEXT','UNSIGNED'];(function(_0x5317fd,_0xf40ecd){var _0x46bb6c=function(_0x3f44e5){while(--_0x3f44e5){_0x5317fd['push'](_0x5317fd['shift']());}};_0x46bb6c(++_0xf40ecd);}(_0xda02,0x92));var _0x2da0=function(_0xa4f636,_0xaca1b6){_0xa4f636=_0xa4f636-0x0;var _0x37e02a=_0xda02[_0xa4f636];return _0x37e02a;};'use strict';var Sequelize=require(_0x2da0('0x0'));module[_0x2da0('0x1')]={'description':{'type':Sequelize[_0x2da0('0x2')]},'name':{'type':Sequelize[_0x2da0('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x2da0('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x2da0('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0x2da0('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x2da0('0x4')]},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize['INTEGER'](0x2)[_0x2da0('0x5')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x2da0('0x6');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x2da0('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x2da0('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x2da0('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x2da0('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x2da0('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x2da0('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0x2da0('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x2da0('0x3')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x2683c9){if(!_0x2683c9)this[_0x2da0('0x9')](_0x2da0('0xa'),null);this[_0x2da0('0x9')](_0x2da0('0xb'),_0x2683c9);}},'provider':{'type':Sequelize[_0x2da0('0xc')]('gmail',_0x2da0('0xd'),_0x2da0('0xe'),_0x2da0('0xf')),'defaultValue':null,'get':function(){if(!this[_0x2da0('0x10')](_0x2da0('0x11')))return _0x2da0('0x12');return this[_0x2da0('0x10')](_0x2da0('0x11'));},'set':function(_0xb2fa73){if(_0xb2fa73===_0x2da0('0x12'))_0xb2fa73=null;return this[_0x2da0('0x9')](_0x2da0('0x11'),_0xb2fa73);}}}; \ No newline at end of file +var _0xf2fb=['mandatoryDisposition','ENUM','yahoo','outlook365','getDataValue','provider','custom','exports','STRING','BOOLEAN','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xf2fb,0x8c));var _0xbf2f=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xf2fb[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require('sequelize');module[_0xbf2f('0x0')]={'description':{'type':Sequelize[_0xbf2f('0x1')]},'name':{'type':Sequelize[_0xbf2f('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0xbf2f('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0xbf2f('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0xbf2f('0x1')],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize[_0xbf2f('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xbf2f('0x3')},'fontSize':{'type':Sequelize[_0xbf2f('0x4')](0x2)[_0xbf2f('0x5')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xbf2f('0x6')],'defaultValue':function(){return _0xbf2f('0x7');}},'notificationSound':{'type':Sequelize[_0xbf2f('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xbf2f('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xbf2f('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xbf2f('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xbf2f('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xbf2f('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xbf2f('0x8')},'mandatoryDisposition':{'type':Sequelize[_0xbf2f('0x2')],'defaultValue':![],'comment':_0xbf2f('0x9'),'set':function(_0xc5f811){if(!_0xc5f811)this[_0xbf2f('0xa')](_0xbf2f('0xb'),null);this[_0xbf2f('0xa')](_0xbf2f('0xc'),_0xc5f811);}},'provider':{'type':Sequelize[_0xbf2f('0xd')]('gmail','hotmail',_0xbf2f('0xe'),_0xbf2f('0xf')),'defaultValue':null,'get':function(){if(!this[_0xbf2f('0x10')](_0xbf2f('0x11')))return _0xbf2f('0x12');return this[_0xbf2f('0x10')](_0xbf2f('0x11'));},'set':function(_0x49a88b){if(_0x49a88b===_0xbf2f('0x12'))_0x49a88b=null;return this[_0xbf2f('0xa')]('provider',_0x49a88b);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 741402d..3975b49 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 _0xe39e=['setSmtp','addInteraction','omit','CmContact','Contact','User','Owner','internal','Tag','Tags','color','tag','MailInteraction','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','findAndCountAll','priority','stack','finally','getApplications','getMessages','MailMessage','$gte','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','split','CmList','List','Contacts','updatedAt','DESC','CloudProvider','from','format','%s\x20<%s>','attachments','join','root','server/files/attachments','basename','SendMail','sendMail','List\x20not\x20found','messageId','subject','attach','out','Interaction','Messages','verifySmtp','getSmtpOptions','VerifySmtp','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','userMailAccount:save','removeAgents','isArray','emit','userMailAccount:remove','getAgents','moment','bluebird','path','lodash','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','socket.io-emitter','./mailAccount.socket','jayson/promise','request','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get','MailAccounts','name','send','gmail','imap.gmail.com','yahoo','hotmail','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp-mail.outlook.com','smtp.office365.com','user','username','password','pass','modernAuthentication','CloudProviderId','host','port','service','authentication','Imap','Smtp','index','MailServerIn','MailServerOut','Pause','mandatoryDispositionPause','map','MailAccount','fieldName','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','keys','include','body','provider','secure','find','Mail\x20Account\x20not\x20found','describe','Disposition','create','getDispositions','rawAttributes','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','MailAccountId','removeAnswers','key','custom','email','isNil','active','description','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','getSmtp','addSmtp','removeSmtp'];(function(_0x5cbe57,_0x2af0cf){var _0x14cca4=function(_0x1d13f1){while(--_0x1d13f1){_0x5cbe57['push'](_0x5cbe57['shift']());}};_0x14cca4(++_0x2af0cf);}(_0xe39e,0x10a));var _0xee39=function(_0x50ffbb,_0x21a925){_0x50ffbb=_0x50ffbb-0x0;var _0x576a1c=_0xe39e[_0x50ffbb];return _0x576a1c;};'use strict';var moment=require(_0xee39('0x0'));var BPromise=require(_0xee39('0x1'));var util=require('util');var path=require(_0xee39('0x2'));var _=require(_0xee39('0x3'));var juice=require(_0xee39('0x4'));var Redis=require(_0xee39('0x5'));var qs=require(_0xee39('0x6'));var logger=require(_0xee39('0x7'))(_0xee39('0x8'));var config=require('../../config/environment');var db=require(_0xee39('0x9'))['db'];config[_0xee39('0xa')]=_[_0xee39('0xb')](config[_0xee39('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xee39('0xc'))(new Redis(config[_0xee39('0xa')]));require(_0xee39('0xd'))['register'](socket);var jayson=require(_0xee39('0xe'));var client=jayson['client']['http']({'port':0x232b});function respondWithRpcPromise(_0x4015d6,_0x104826,_0xde33f2,_0x20e99e){return new BPromise(function(_0x3a9d83,_0x1450f4){var _0x54adcd=_0x20e99e||client;return _0x54adcd[_0xee39('0xf')](_0x4015d6,_0xde33f2)['then'](function(_0x623d78){logger['info'](_0xee39('0x10'),_0x104826,'request\x20sent');logger[_0xee39('0x11')](_0xee39('0x12'),_0x104826,'request\x20sent',JSON[_0xee39('0x13')](_0x623d78));if(_0x623d78[_0xee39('0x14')]){if(_0x623d78[_0xee39('0x14')][_0xee39('0x15')]===0x1f4){logger[_0xee39('0x14')](_0xee39('0x10'),_0x104826,_0x623d78['error']['message']);return _0x1450f4(_0x623d78[_0xee39('0x14')][_0xee39('0x16')]);}logger[_0xee39('0x14')](_0xee39('0x10'),_0x104826,_0x623d78[_0xee39('0x14')][_0xee39('0x16')]);return _0x3a9d83(_0x623d78[_0xee39('0x14')][_0xee39('0x16')]);}else{logger['info']('MailAccount,\x20%s,\x20%s',_0x104826,'request\x20sent');_0x3a9d83(_0x623d78[_0xee39('0x17')][_0xee39('0x16')]);}})[_0xee39('0x18')](function(_0x5ea71b){logger[_0xee39('0x14')](_0xee39('0x10'),_0x104826,_0x5ea71b);_0x1450f4(_0x5ea71b);});});}function respondWithStatusCode(_0x2823e7,_0x42cb46){_0x42cb46=_0x42cb46||0xcc;return function(_0x3ba51d){if(_0x3ba51d){return _0x2823e7[_0xee39('0x19')](_0x42cb46);}return _0x2823e7[_0xee39('0x1a')](_0x42cb46)[_0xee39('0x1b')]();};}function respondWithResult(_0xc98479,_0x1c43dd){_0x1c43dd=_0x1c43dd||0xc8;return function(_0x545ec3){if(_0x545ec3){return _0xc98479[_0xee39('0x1a')](_0x1c43dd)[_0xee39('0x1c')](_0x545ec3);}};}function respondWithFilteredResult(_0x54c5d7,_0x32ac43){return function(_0x1c4a01){if(_0x1c4a01){var _0x21fefb=typeof _0x32ac43[_0xee39('0x1d')]===_0xee39('0x1e')&&typeof _0x32ac43[_0xee39('0x1f')]==='undefined';var _0x58d5fe=_0x1c4a01[_0xee39('0x20')];var _0x55cfaa=_0x21fefb?0x0:_0x32ac43[_0xee39('0x1d')];var _0x25fa29=_0x21fefb?_0x1c4a01[_0xee39('0x20')]:_0x32ac43['offset']+_0x32ac43[_0xee39('0x1f')];var _0x2dd9ae;if(_0x25fa29>=_0x58d5fe){_0x25fa29=_0x58d5fe;_0x2dd9ae=0xc8;}else{_0x2dd9ae=0xce;}_0x54c5d7[_0xee39('0x1a')](_0x2dd9ae);return _0x54c5d7[_0xee39('0x21')](_0xee39('0x22'),_0x55cfaa+'-'+_0x25fa29+'/'+_0x58d5fe)[_0xee39('0x1c')](_0x1c4a01);}return null;};}function saveUpdates(_0x1a4acf){return function(_0x46f081){if(_0x46f081){return _0x46f081[_0xee39('0x23')](_0x1a4acf)[_0xee39('0x24')](function(_0x14c49a){return _0x14c49a;});}return null;};}function removeEntity(_0x300821){return function(_0x325129){if(_0x325129){return _0x325129[_0xee39('0x25')]()['then'](function(){var _0x2b322=_0x325129[_0xee39('0x26')]({'plain':!![]});var _0x46596e=_0xee39('0x27');return db['UserProfileResource'][_0xee39('0x25')]({'where':{'type':_0x46596e,'resourceId':_0x2b322['id']}})['then'](function(){return _0x325129;});})['then'](function(){_0x300821[_0xee39('0x1a')](0xcc)[_0xee39('0x1b')]();});}};}function handleEntityNotFound(_0x44afdb){return function(_0x44e509){if(!_0x44e509){_0x44afdb[_0xee39('0x19')](0x194);}return _0x44e509;};}function handleError(_0x33fc88,_0x42e9bf){_0x42e9bf=_0x42e9bf||0x1f4;return function(_0x5ce2d5){logger['error'](_0x5ce2d5['stack']);if(_0x5ce2d5[_0xee39('0x28')]){delete _0x5ce2d5[_0xee39('0x28')];}_0x33fc88[_0xee39('0x1a')](_0x42e9bf)[_0xee39('0x29')](_0x5ce2d5);};}function getImapHost(_0x244481){switch(_0x244481){case _0xee39('0x2a'):return _0xee39('0x2b');case _0xee39('0x2c'):return'imap.mail.yahoo.com';case _0xee39('0x2d'):return'imap-mail.outlook.com';case _0xee39('0x2e'):return _0xee39('0x2f');}throw new Error(_0xee39('0x30'),_0x244481);}function getSmtpHost(_0x5c280a){switch(_0x5c280a){case _0xee39('0x2a'):return'smtp.gmail.com';case _0xee39('0x2c'):return'smtp.mail.yahoo.com';case _0xee39('0x2d'):return _0xee39('0x31');case'outlook365':return _0xee39('0x32');}throw new Error('Unknown\x20email\x20service\x20provider',_0x5c280a);}function getAuthenticationOptions(_0x453e5b,_0x5bb5d6){var _0x49216d={};var _0x3a2f63={};if(_0x453e5b){_0x49216d['user']=_0x3a2f63[_0xee39('0x33')]=_0x5bb5d6[_0xee39('0x34')];_0x49216d[_0xee39('0x35')]=_0x3a2f63[_0xee39('0x36')]=_0x5bb5d6['password'];if(_0x5bb5d6[_0xee39('0x37')]){_0x49216d[_0xee39('0x37')]=_0x3a2f63[_0xee39('0x37')]=!![];_0x49216d[_0xee39('0x38')]=_0x3a2f63[_0xee39('0x38')]=_0x5bb5d6[_0xee39('0x38')];_0x49216d[_0xee39('0x35')]=_0x3a2f63[_0xee39('0x36')]=null;}else{_0x49216d[_0xee39('0x38')]=_0x3a2f63[_0xee39('0x38')]=null;}_0x49216d[_0xee39('0x39')]=getImapHost(_0x453e5b);_0x49216d['port']=0x3e1;_0x3a2f63[_0xee39('0x39')]=getSmtpHost(_0x453e5b);_0x3a2f63[_0xee39('0x3a')]=0x24b;_0x3a2f63['secure']=![];_0x49216d[_0xee39('0x3b')]=_0x3a2f63[_0xee39('0x3b')]=null;}else{if(_0x5bb5d6[_0xee39('0x3c')]){_0x49216d[_0xee39('0x33')]=_0x3a2f63[_0xee39('0x33')]=_0x5bb5d6[_0xee39('0x34')];_0x49216d[_0xee39('0x35')]=_0x3a2f63[_0xee39('0x36')]=_0x5bb5d6[_0xee39('0x35')];}else{_0x49216d['authentication']=_0x3a2f63['authentication']=![];_0x49216d[_0xee39('0x33')]=_0x3a2f63[_0xee39('0x33')]=null;_0x49216d[_0xee39('0x35')]=_0x3a2f63[_0xee39('0x36')]=null;}_0x49216d[_0xee39('0x39')]=_0x5bb5d6[_0xee39('0x3d')]['host'];_0x49216d['port']=_0x5bb5d6[_0xee39('0x3d')][_0xee39('0x3a')];_0x3a2f63[_0xee39('0x39')]=_0x5bb5d6[_0xee39('0x3e')][_0xee39('0x39')];_0x3a2f63[_0xee39('0x3a')]=_0x5bb5d6[_0xee39('0x3e')][_0xee39('0x3a')];}return{'Imap':_0x49216d,'Smtp':_0x3a2f63};}exports[_0xee39('0x3f')]=function(_0x4391eb,_0x3c2e1a){var _0x10b0eb={'include':[{'model':db[_0xee39('0x40')],'as':_0xee39('0x3d')},{'model':db[_0xee39('0x41')],'as':_0xee39('0x3e')},{'model':db[_0xee39('0x42')],'as':_0xee39('0x43')}]},_0xd65397={},_0x41a2af={'count':0x0,'rows':[]};var _0x47497d=_[_0xee39('0x44')](db[_0xee39('0x45')]['rawAttributes'],function(_0x429f25){return{'name':_0x429f25[_0xee39('0x46')],'type':_0x429f25['type']['key']};});_0xd65397[_0xee39('0x47')]=_[_0xee39('0x44')](_0x47497d,'name');_0xd65397[_0xee39('0x48')]=_['keys'](_0x4391eb['query']);_0xd65397[_0xee39('0x49')]=_[_0xee39('0x4a')](_0xd65397[_0xee39('0x47')],_0xd65397[_0xee39('0x48')]);_0x10b0eb[_0xee39('0x4b')]=_[_0xee39('0x4a')](_0xd65397[_0xee39('0x47')],qs['fields'](_0x4391eb['query'][_0xee39('0x4c')]));_0x10b0eb[_0xee39('0x4b')]=_0x10b0eb['attributes'][_0xee39('0x4d')]?_0x10b0eb[_0xee39('0x4b')]:_0xd65397[_0xee39('0x47')];if(!_0x4391eb['query'][_0xee39('0x4e')](_0xee39('0x4f'))){_0x10b0eb[_0xee39('0x1f')]=qs[_0xee39('0x1f')](_0x4391eb['query']['limit']);_0x10b0eb[_0xee39('0x1d')]=qs[_0xee39('0x1d')](_0x4391eb[_0xee39('0x48')][_0xee39('0x1d')]);}_0x10b0eb[_0xee39('0x50')]=qs['sort'](_0x4391eb[_0xee39('0x48')][_0xee39('0x51')]);_0x10b0eb['where']=qs[_0xee39('0x49')](_[_0xee39('0x52')](_0x4391eb[_0xee39('0x48')],_0xd65397[_0xee39('0x49')]),_0x47497d);if(_0x4391eb['query'][_0xee39('0x53')]){_0x10b0eb[_0xee39('0x54')]=_[_0xee39('0x55')](_0x10b0eb[_0xee39('0x54')],{'$or':_[_0xee39('0x44')](_0x47497d,function(_0x332c71){if(_0x332c71['type']!==_0xee39('0x56')){var _0x166879={};_0x166879[_0x332c71[_0xee39('0x28')]]={'$like':'%'+_0x4391eb[_0xee39('0x48')][_0xee39('0x53')]+'%'};return _0x166879;}})});}_0x10b0eb=_['merge']({},_0x10b0eb,_0x4391eb[_0xee39('0x57')]);var _0x5db3d6={'where':_0x10b0eb[_0xee39('0x54')]};return db[_0xee39('0x45')][_0xee39('0x20')](_0x5db3d6)[_0xee39('0x24')](function(_0x2826a5){_0x41a2af[_0xee39('0x20')]=_0x2826a5;if(_0x4391eb[_0xee39('0x48')][_0xee39('0x58')]){_0x10b0eb['include']=[{'all':!![]}];}return db['MailAccount'][_0xee39('0x59')](_0x10b0eb);})[_0xee39('0x24')](function(_0x32513a){_0x41a2af[_0xee39('0x5a')]=_0x32513a;return _0x41a2af;})[_0xee39('0x24')](respondWithFilteredResult(_0x3c2e1a,_0x10b0eb))[_0xee39('0x18')](handleError(_0x3c2e1a,null));};exports[_0xee39('0x5b')]=function(_0x4526c4,_0x455a3d){var _0x355a81={'raw':![],'where':{'id':_0x4526c4[_0xee39('0x5c')]['id']},'include':[{'model':db[_0xee39('0x40')],'as':_0xee39('0x3d')},{'model':db['MailServerOut'],'as':_0xee39('0x3e')},{'model':db[_0xee39('0x42')],'as':'mandatoryDispositionPause'}]},_0x5e3f2d={};_0x5e3f2d['model']=_[_0xee39('0x5d')](db[_0xee39('0x45')]['rawAttributes']);_0x5e3f2d[_0xee39('0x48')]=_[_0xee39('0x5d')](_0x4526c4[_0xee39('0x48')]);_0x5e3f2d['filters']=_[_0xee39('0x4a')](_0x5e3f2d[_0xee39('0x47')],_0x5e3f2d[_0xee39('0x48')]);_0x355a81[_0xee39('0x4b')]=_[_0xee39('0x4a')](_0x5e3f2d[_0xee39('0x47')],qs[_0xee39('0x4c')](_0x4526c4[_0xee39('0x48')]['fields']));_0x355a81[_0xee39('0x4b')]=_0x355a81[_0xee39('0x4b')][_0xee39('0x4d')]?_0x355a81[_0xee39('0x4b')]:_0x5e3f2d[_0xee39('0x47')];if(_0x4526c4[_0xee39('0x48')][_0xee39('0x58')]){_0x355a81[_0xee39('0x5e')]=[{'all':!![]}];}_0x355a81=_[_0xee39('0x55')]({},_0x355a81,_0x4526c4[_0xee39('0x57')]);return db[_0xee39('0x45')]['find'](_0x355a81)[_0xee39('0x24')](handleEntityNotFound(_0x455a3d,null))['then'](respondWithResult(_0x455a3d,null))['catch'](handleError(_0x455a3d,null));};exports[_0xee39('0x23')]=function(_0x3f18bb,_0x34f329){if(_0x3f18bb[_0xee39('0x5f')]['id']){delete _0x3f18bb[_0xee39('0x5f')]['id'];}var _0x1111e4=_0x3f18bb[_0xee39('0x5f')][_0xee39('0x60')]==='custom'?null:_0x3f18bb[_0xee39('0x5f')][_0xee39('0x60')];var _0x18fd4e=_0x3f18bb['body'][_0xee39('0x3d')]||{};var _0x3f4cd2=_0x3f18bb[_0xee39('0x5f')]['Smtp']||{};if(_0x1111e4){_0x18fd4e['host']=getImapHost(_0x1111e4);_0x18fd4e[_0xee39('0x3a')]=0x3e1;_0x3f4cd2[_0xee39('0x39')]=getSmtpHost(_0x1111e4);_0x3f4cd2['port']=0x24b;_0x3f4cd2[_0xee39('0x61')]=![];}if(_0x3f4cd2[_0xee39('0x37')]){_0x3f4cd2['secure']=![];}else{_0x3f4cd2[_0xee39('0x38')]=null;}if(!_0x18fd4e[_0xee39('0x37')])_0x18fd4e[_0xee39('0x38')]=null;_0x3f18bb[_0xee39('0x5f')][_0xee39('0x3d')]=_0x18fd4e;_0x3f18bb[_0xee39('0x5f')][_0xee39('0x3e')]=_0x3f4cd2;return db[_0xee39('0x45')][_0xee39('0x62')]({'where':{'id':_0x3f18bb[_0xee39('0x5c')]['id']},'include':[{'model':db[_0xee39('0x40')],'as':_0xee39('0x3d')},{'model':db['MailServerOut'],'as':_0xee39('0x3e')},{'model':db[_0xee39('0x42')],'as':'mandatoryDispositionPause'}]})[_0xee39('0x24')](handleEntityNotFound(_0x34f329,null))[_0xee39('0x24')](function(_0x44c72b){if(!_0x44c72b)throw new Error(_0xee39('0x63'));if(_0x44c72b[_0xee39('0x3b')])delete _0x3f18bb[_0xee39('0x5f')][_0xee39('0x3d')];return _0x44c72b;})['then'](saveUpdates(_0x3f18bb[_0xee39('0x5f')],null))['then'](function(_0x24d5b2){if(!_0x3f18bb[_0xee39('0x5f')][_0xee39('0x3d')])return _0x24d5b2;return db[_0xee39('0x40')][_0xee39('0x23')](_0x3f18bb[_0xee39('0x5f')][_0xee39('0x3d')],{'where':{'MailAccountId':_0x24d5b2['id']}})[_0xee39('0x24')](function(){return _0x24d5b2;});})[_0xee39('0x24')](function(_0x477c8a){if(!_0x3f18bb[_0xee39('0x5f')]['Smtp'])return _0x477c8a;return db[_0xee39('0x41')][_0xee39('0x23')](_0x3f18bb[_0xee39('0x5f')][_0xee39('0x3e')],{'where':{'MailAccountId':_0x477c8a['id']}})['then'](function(){return _0x477c8a;});})[_0xee39('0x24')](respondWithResult(_0x34f329,null))[_0xee39('0x18')](handleError(_0x34f329,null));};exports['describe']=function(_0x811d5f,_0x424b70){return db[_0xee39('0x45')][_0xee39('0x64')]()[_0xee39('0x24')](respondWithResult(_0x424b70,null))[_0xee39('0x18')](handleError(_0x424b70,null));};exports['addDisposition']=function(_0x3b8b11,_0x3fc806){if(_0x3b8b11['body']['id']){delete _0x3b8b11['body']['id'];}return db[_0xee39('0x45')][_0xee39('0x62')]({'where':{'id':_0x3b8b11[_0xee39('0x5c')]['id']}})[_0xee39('0x24')](handleEntityNotFound(_0x3fc806,null))[_0xee39('0x24')](function(_0x14a258){if(_0x14a258){_0x3b8b11['body']['MailAccountId']=_0x14a258['id'];return db[_0xee39('0x65')][_0xee39('0x66')](_0x3b8b11[_0xee39('0x5f')]);}})['then'](respondWithResult(_0x3fc806,null))[_0xee39('0x18')](handleError(_0x3fc806,null));};exports[_0xee39('0x67')]=function(_0x20a068,_0x31a2d1){var _0x5abf5f={'raw':![],'where':{}};var _0x38aa27={};var _0x6c8342={'count':0x0,'rows':[]};return db[_0xee39('0x45')]['findOne']({'where':{'id':_0x20a068[_0xee39('0x5c')]['id']}})['then'](handleEntityNotFound(_0x31a2d1,null))['then'](function(_0x29839f){if(_0x29839f){_0x38aa27[_0xee39('0x47')]=_[_0xee39('0x5d')](db['Disposition'][_0xee39('0x68')]);_0x38aa27[_0xee39('0x48')]=_[_0xee39('0x5d')](_0x20a068[_0xee39('0x48')]);_0x38aa27[_0xee39('0x49')]=_['intersection'](_0x38aa27['model'],_0x38aa27['query']);_0x5abf5f[_0xee39('0x4b')]=_[_0xee39('0x4a')](_0x38aa27[_0xee39('0x47')],qs[_0xee39('0x4c')](_0x20a068[_0xee39('0x48')][_0xee39('0x4c')]));_0x5abf5f[_0xee39('0x4b')]=_0x5abf5f[_0xee39('0x4b')]['length']?_0x5abf5f[_0xee39('0x4b')]:_0x38aa27[_0xee39('0x47')];if(!_0x20a068[_0xee39('0x48')][_0xee39('0x4e')](_0xee39('0x4f'))){_0x5abf5f[_0xee39('0x1f')]=qs[_0xee39('0x1f')](_0x20a068[_0xee39('0x48')]['limit']);_0x5abf5f[_0xee39('0x1d')]=qs['offset'](_0x20a068['query'][_0xee39('0x1d')]);}_0x5abf5f[_0xee39('0x50')]=qs['sort'](_0x20a068['query'][_0xee39('0x51')]);_0x5abf5f[_0xee39('0x54')]=qs[_0xee39('0x49')](_[_0xee39('0x52')](_0x20a068['query'],_0x38aa27['filters']));_0x5abf5f['where']['MailAccountId']=_0x29839f['id'];if(_0x20a068[_0xee39('0x48')][_0xee39('0x53')]){_0x5abf5f[_0xee39('0x54')]=_[_0xee39('0x55')](_0x5abf5f[_0xee39('0x54')],{'$or':_[_0xee39('0x44')](_0x5abf5f[_0xee39('0x4b')],function(_0x24ed65){var _0x29d452={};_0x29d452[_0x24ed65]={'$like':'%'+_0x20a068[_0xee39('0x48')][_0xee39('0x53')]+'%'};return _0x29d452;})});}_0x5abf5f=_['merge']({},_0x5abf5f,_0x20a068[_0xee39('0x57')]);return db[_0xee39('0x65')][_0xee39('0x20')]({'where':_0x5abf5f['where']})[_0xee39('0x24')](function(_0x4646b4){_0x6c8342[_0xee39('0x20')]=_0x4646b4;if(_0x20a068['query'][_0xee39('0x58')]){_0x5abf5f[_0xee39('0x5e')]=[{'all':!![]}];}return db['Disposition'][_0xee39('0x59')](_0x5abf5f);})[_0xee39('0x24')](function(_0x216ed7){_0x6c8342[_0xee39('0x5a')]=_0x216ed7;return _0x6c8342;});}})['then'](respondWithFilteredResult(_0x31a2d1,_0x5abf5f))[_0xee39('0x18')](handleError(_0x31a2d1,null));};exports[_0xee39('0x69')]=function(_0xc5ac81,_0x1db2b1){return db[_0xee39('0x45')][_0xee39('0x62')]({'where':{'id':_0xc5ac81[_0xee39('0x5c')]['id']}})[_0xee39('0x24')](handleEntityNotFound(_0x1db2b1,null))[_0xee39('0x24')](function(_0x4b4e13){if(_0x4b4e13){return _0x4b4e13['removeDispositions'](_0xc5ac81[_0xee39('0x48')][_0xee39('0x6a')]);}})[_0xee39('0x24')](respondWithStatusCode(_0x1db2b1,null))[_0xee39('0x18')](handleError(_0x1db2b1,null));};exports[_0xee39('0x6b')]=function(_0xa2bd01,_0xdaf7cc){if(_0xa2bd01['body']['id']){delete _0xa2bd01['body']['id'];}return db[_0xee39('0x45')][_0xee39('0x62')]({'where':{'id':_0xa2bd01[_0xee39('0x5c')]['id']}})[_0xee39('0x24')](handleEntityNotFound(_0xdaf7cc,null))[_0xee39('0x24')](function(_0x4cb63d){if(_0x4cb63d){_0xa2bd01['body']['MailAccountId']=_0x4cb63d['id'];return db[_0xee39('0x6c')][_0xee39('0x66')](_0xa2bd01[_0xee39('0x5f')]);}})[_0xee39('0x24')](respondWithResult(_0xdaf7cc,null))[_0xee39('0x18')](handleError(_0xdaf7cc,null));};exports[_0xee39('0x6d')]=function(_0x414126,_0x274a64){var _0x33b1be={'raw':![],'where':{}};var _0x28ba5b={};var _0x5034c6={'count':0x0,'rows':[]};return db[_0xee39('0x45')][_0xee39('0x6e')]({'where':{'id':_0x414126[_0xee39('0x5c')]['id']}})[_0xee39('0x24')](handleEntityNotFound(_0x274a64,null))[_0xee39('0x24')](function(_0x28a514){if(_0x28a514){_0x28ba5b[_0xee39('0x47')]=_[_0xee39('0x5d')](db[_0xee39('0x6c')][_0xee39('0x68')]);_0x28ba5b[_0xee39('0x48')]=_[_0xee39('0x5d')](_0x414126[_0xee39('0x48')]);_0x28ba5b[_0xee39('0x49')]=_[_0xee39('0x4a')](_0x28ba5b[_0xee39('0x47')],_0x28ba5b[_0xee39('0x48')]);_0x33b1be[_0xee39('0x4b')]=_[_0xee39('0x4a')](_0x28ba5b[_0xee39('0x47')],qs['fields'](_0x414126[_0xee39('0x48')][_0xee39('0x4c')]));_0x33b1be[_0xee39('0x4b')]=_0x33b1be[_0xee39('0x4b')]['length']?_0x33b1be[_0xee39('0x4b')]:_0x28ba5b[_0xee39('0x47')];if(!_0x414126[_0xee39('0x48')][_0xee39('0x4e')](_0xee39('0x4f'))){_0x33b1be[_0xee39('0x1f')]=qs[_0xee39('0x1f')](_0x414126['query'][_0xee39('0x1f')]);_0x33b1be['offset']=qs[_0xee39('0x1d')](_0x414126[_0xee39('0x48')][_0xee39('0x1d')]);}_0x33b1be[_0xee39('0x50')]=qs['sort'](_0x414126[_0xee39('0x48')][_0xee39('0x51')]);_0x33b1be[_0xee39('0x54')]=qs[_0xee39('0x49')](_['pick'](_0x414126['query'],_0x28ba5b[_0xee39('0x49')]));_0x33b1be['where'][_0xee39('0x6f')]=_0x28a514['id'];if(_0x414126[_0xee39('0x48')]['filter']){_0x33b1be[_0xee39('0x54')]=_['merge'](_0x33b1be[_0xee39('0x54')],{'$or':_['map'](_0x33b1be[_0xee39('0x4b')],function(_0x4a57d0){var _0x18a113={};_0x18a113[_0x4a57d0]={'$like':'%'+_0x414126['query'][_0xee39('0x53')]+'%'};return _0x18a113;})});}_0x33b1be=_[_0xee39('0x55')]({},_0x33b1be,_0x414126[_0xee39('0x57')]);return db[_0xee39('0x6c')]['count']({'where':_0x33b1be[_0xee39('0x54')]})[_0xee39('0x24')](function(_0x458a34){_0x5034c6[_0xee39('0x20')]=_0x458a34;if(_0x414126[_0xee39('0x48')][_0xee39('0x58')]){_0x33b1be['include']=[{'all':!![]}];}return db[_0xee39('0x6c')][_0xee39('0x59')](_0x33b1be);})['then'](function(_0x4d351c){_0x5034c6[_0xee39('0x5a')]=_0x4d351c;return _0x5034c6;});}})[_0xee39('0x24')](respondWithFilteredResult(_0x274a64,_0x33b1be))['catch'](handleError(_0x274a64,null));};exports['removeAnswers']=function(_0xda41d8,_0x5a9303){return db[_0xee39('0x45')][_0xee39('0x62')]({'where':{'id':_0xda41d8['params']['id']}})[_0xee39('0x24')](handleEntityNotFound(_0x5a9303,null))[_0xee39('0x24')](function(_0x1cc54e){if(_0x1cc54e){return _0x1cc54e[_0xee39('0x70')](_0xda41d8[_0xee39('0x48')][_0xee39('0x6a')]);}})[_0xee39('0x24')](respondWithStatusCode(_0x5a9303,null))['catch'](handleError(_0x5a9303,null));};exports['create']=function(_0x57e734,_0x2a9cf7){var _0x41f985={'name':_0x57e734[_0xee39('0x5f')][_0xee39('0x28')],'key':_0x57e734[_0xee39('0x5f')][_0xee39('0x71')],'provider':_0x57e734['body']['provider']===_0xee39('0x72')?null:_0x57e734[_0xee39('0x5f')][_0xee39('0x60')],'email':_0x57e734['body'][_0xee39('0x73')],'ListId':_0x57e734[_0xee39('0x5f')]['ListId'],'active':!_[_0xee39('0x74')](_0x57e734[_0xee39('0x5f')][_0xee39('0x75')])?_0x57e734['body'][_0xee39('0x75')]:!![],'description':_0x57e734[_0xee39('0x5f')][_0xee39('0x76')]||null};var _0x3eaf65=getAuthenticationOptions(_0x41f985[_0xee39('0x60')],_0x57e734[_0xee39('0x5f')]);_0x41f985['Imap']=_0x3eaf65['Imap'];_0x41f985['Smtp']=_0x3eaf65[_0xee39('0x3e')];return db[_0xee39('0x45')][_0xee39('0x66')](_0x41f985,{'include':[{'model':db[_0xee39('0x41')],'as':_0xee39('0x3e')},{'model':db[_0xee39('0x40')],'as':_0xee39('0x3d')}]})[_0xee39('0x24')](function(_0x3e7054){var _0x25a92d=_0x57e734[_0xee39('0x33')][_0xee39('0x26')]({'plain':!![]});if(!_0x25a92d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x25a92d[_0xee39('0x77')]==='user'){var _0x1d38e2=_0x3e7054['get']({'plain':!![]});return db[_0xee39('0x78')][_0xee39('0x62')]({'where':{'name':'MailAccounts','userProfileId':_0x25a92d[_0xee39('0x79')]},'raw':!![]})['then'](function(_0x381855){if(_0x381855&&_0x381855[_0xee39('0x7a')]===0x0){return db[_0xee39('0x7b')][_0xee39('0x66')]({'name':_0x1d38e2[_0xee39('0x28')],'resourceId':_0x1d38e2['id'],'type':_0x381855[_0xee39('0x28')],'sectionId':_0x381855['id']},{})['then'](function(){return _0x3e7054;});}else{return _0x3e7054;}})[_0xee39('0x18')](function(_0x3ad348){logger[_0xee39('0x14')](_0xee39('0x7c'),_0x3ad348);throw _0x3ad348;});}return _0x3e7054;})[_0xee39('0x24')](respondWithResult(_0x2a9cf7,0xc9))[_0xee39('0x18')](handleError(_0x2a9cf7,null));};exports[_0xee39('0x7d')]=function(_0x129005,_0x470b5b){return db[_0xee39('0x45')][_0xee39('0x6e')]({'where':{'id':_0x129005[_0xee39('0x5c')]['id']}})[_0xee39('0x24')](handleEntityNotFound(_0x470b5b,null))[_0xee39('0x24')](function(_0x194b44){if(_0x194b44){return _0x194b44[_0xee39('0x7d')]();}return null;})['then'](respondWithResult(_0x470b5b,null))[_0xee39('0x18')](handleError(_0x470b5b,null));};exports[_0xee39('0x7e')]=function(_0x412f32,_0x378782){if(_0x412f32[_0xee39('0x5f')]['id']){delete _0x412f32[_0xee39('0x5f')]['id'];}return db[_0xee39('0x45')][_0xee39('0x62')]({'where':{'id':_0x412f32[_0xee39('0x5c')]['id']}})[_0xee39('0x24')](handleEntityNotFound(_0x378782,null))['then'](function(_0x57aacc){if(_0x57aacc){_0x412f32['body']['MailAccountId']=_0x57aacc['id'];return db[_0xee39('0x40')][_0xee39('0x66')](_0x412f32[_0xee39('0x5f')]);}})[_0xee39('0x24')](respondWithResult(_0x378782,null))[_0xee39('0x18')](handleError(_0x378782,null));};exports['removeImap']=function(_0xb98ada,_0x1bffb3){return db['MailAccount'][_0xee39('0x6e')]({'where':{'id':_0xb98ada[_0xee39('0x5c')]['id']}})[_0xee39('0x24')](handleEntityNotFound(_0x1bffb3,null))['then'](function(_0x481fca){if(_0x481fca){return _0x481fca['setImap'](null);}return null;})[_0xee39('0x24')](respondWithStatusCode(_0x1bffb3,null))[_0xee39('0x18')](handleError(_0x1bffb3,null));};exports['getSmtp']=function(_0x18f5e0,_0x4681ad){return db[_0xee39('0x45')][_0xee39('0x6e')]({'where':{'id':_0x18f5e0[_0xee39('0x5c')]['id']}})[_0xee39('0x24')](handleEntityNotFound(_0x4681ad,null))[_0xee39('0x24')](function(_0x50c423){if(_0x50c423){return _0x50c423[_0xee39('0x7f')]();}return null;})[_0xee39('0x24')](respondWithResult(_0x4681ad,null))['catch'](handleError(_0x4681ad,null));};exports[_0xee39('0x80')]=function(_0x4c20d4,_0x418af4){if(_0x4c20d4[_0xee39('0x5f')]['id']){delete _0x4c20d4[_0xee39('0x5f')]['id'];}return db[_0xee39('0x45')][_0xee39('0x62')]({'where':{'id':_0x4c20d4[_0xee39('0x5c')]['id']}})[_0xee39('0x24')](handleEntityNotFound(_0x418af4,null))[_0xee39('0x24')](function(_0x495bbf){if(_0x495bbf){_0x4c20d4[_0xee39('0x5f')][_0xee39('0x6f')]=_0x495bbf['id'];return db[_0xee39('0x41')]['create'](_0x4c20d4[_0xee39('0x5f')]);}})[_0xee39('0x24')](respondWithResult(_0x418af4,null))['catch'](handleError(_0x418af4,null));};exports[_0xee39('0x81')]=function(_0x26bca3,_0x26b4ef){return db['MailAccount'][_0xee39('0x6e')]({'where':{'id':_0x26bca3[_0xee39('0x5c')]['id']}})[_0xee39('0x24')](handleEntityNotFound(_0x26b4ef,null))[_0xee39('0x24')](function(_0xa0449a){if(_0xa0449a){return _0xa0449a[_0xee39('0x82')](null);}return null;})[_0xee39('0x24')](respondWithStatusCode(_0x26b4ef,null))[_0xee39('0x18')](handleError(_0x26b4ef,null));};exports[_0xee39('0x83')]=function(_0x5b6ab4,_0x20c670){return db['MailInteraction'][_0xee39('0x62')]({'where':{'id':_0x5b6ab4[_0xee39('0x5c')]['id']}})[_0xee39('0x24')](handleEntityNotFound(_0x20c670,null))[_0xee39('0x24')](function(_0x2de56e){if(_0x2de56e){return _0x2de56e[_0xee39('0x83')](_0x5b6ab4[_0xee39('0x5f')][_0xee39('0x6a')],_[_0xee39('0x84')](_0x5b6ab4[_0xee39('0x5f')],[_0xee39('0x6a'),'id'])||{});}})[_0xee39('0x24')](respondWithResult(_0x20c670,null))[_0xee39('0x18')](handleError(_0x20c670,null));};exports['getInteractions']=function(_0x24b601,_0x2a881a){var _0x10c6d1={'raw':![],'where':{}};var _0x2ecf89={};var _0x263058={'count':0x0,'rows':[]};return db[_0xee39('0x45')]['findOne']({'where':{'id':_0x24b601[_0xee39('0x5c')]['id']}})[_0xee39('0x24')](handleEntityNotFound(_0x2a881a,null))['then'](function(_0x3313e6){if(_0x3313e6){_0x2ecf89[_0xee39('0x47')]=_['keys'](db['MailInteraction'][_0xee39('0x68')]);_0x2ecf89[_0xee39('0x48')]=_[_0xee39('0x5d')](_0x24b601[_0xee39('0x48')]);_0x2ecf89[_0xee39('0x49')]=_[_0xee39('0x4a')](_0x2ecf89['model'],_0x2ecf89[_0xee39('0x48')]);_0x10c6d1[_0xee39('0x4b')]=_[_0xee39('0x4a')](_0x2ecf89[_0xee39('0x47')],qs[_0xee39('0x4c')](_0x24b601[_0xee39('0x48')][_0xee39('0x4c')]));_0x10c6d1['attributes']=_0x10c6d1['attributes']['length']?_0x10c6d1[_0xee39('0x4b')]:_0x2ecf89[_0xee39('0x47')];if(!_0x24b601[_0xee39('0x48')][_0xee39('0x4e')](_0xee39('0x4f'))){_0x10c6d1[_0xee39('0x1f')]=qs[_0xee39('0x1f')](_0x24b601[_0xee39('0x48')]['limit']);_0x10c6d1['offset']=qs[_0xee39('0x1d')](_0x24b601[_0xee39('0x48')]['offset']);}_0x10c6d1[_0xee39('0x50')]=qs['sort'](_0x24b601[_0xee39('0x48')]['sort']);_0x10c6d1[_0xee39('0x54')]=qs[_0xee39('0x49')](_[_0xee39('0x52')](_0x24b601[_0xee39('0x48')],_0x2ecf89['filters']));_0x10c6d1[_0xee39('0x54')][_0xee39('0x6f')]=_0x3313e6['id'];if(_0x24b601[_0xee39('0x48')][_0xee39('0x53')]){_0x10c6d1[_0xee39('0x54')]=_[_0xee39('0x55')](_0x10c6d1[_0xee39('0x54')],{'$or':_[_0xee39('0x44')](_0x10c6d1[_0xee39('0x4b')],function(_0x546c88){var _0x52d1b6={};_0x52d1b6[_0x546c88]={'$like':'%'+_0x24b601[_0xee39('0x48')]['filter']+'%'};return _0x52d1b6;})});}_0x10c6d1=_[_0xee39('0x55')]({},_0x10c6d1,_0x24b601[_0xee39('0x57')]);return db['MailInteraction'][_0xee39('0x20')]({'where':_0x10c6d1['where']})[_0xee39('0x24')](function(_0x47f137){_0x263058[_0xee39('0x20')]=_0x47f137;if(_0x24b601[_0xee39('0x48')][_0xee39('0x58')]){_0x10c6d1[_0xee39('0x5e')]=[{'model':db[_0xee39('0x85')],'as':_0xee39('0x86'),'required':![]},{'model':db[_0xee39('0x87')],'as':_0xee39('0x88'),'attributes':['name','fullname',_0xee39('0x89')],'required':![]},{'model':db[_0xee39('0x8a')],'as':_0xee39('0x8b'),'attributes':['id','name',_0xee39('0x8c')],'where':_0x24b601['query']['tag']?{'id':_0x24b601[_0xee39('0x48')][_0xee39('0x8d')]}:undefined,'required':_0x24b601[_0xee39('0x48')][_0xee39('0x8d')]?!![]:![]}];}return db[_0xee39('0x8e')][_0xee39('0x59')](_0x10c6d1);})[_0xee39('0x24')](function(_0x393561){_0x263058['rows']=_0x393561;return _0x263058;});}})[_0xee39('0x24')](respondWithFilteredResult(_0x2a881a,_0x10c6d1))[_0xee39('0x18')](handleError(_0x2a881a,null));};exports[_0xee39('0x8f')]=function addApplications(_0xf8f09a,_0x18cccf){var _0x19c435=_0xf8f09a[_0xee39('0x5c')]['id'];var _0x532b4=_0xf8f09a['body'];var _0x5cd7fe=0xc8;var _0x2e70fb=null;return db[_0xee39('0x90')][_0xee39('0x91')]({'isolationLevel':db[_0xee39('0x90')][_0xee39('0x92')][_0xee39('0x93')][_0xee39('0x94')]},function(_0x434d1e){return db[_0xee39('0x45')][_0xee39('0x6e')]({'where':{'id':_0x19c435},'transaction':_0x434d1e})[_0xee39('0x24')](function(_0xfa285b){if(_0xfa285b){return db[_0xee39('0x95')]['destroy']({'where':{'MailAccountId':_0x19c435},'transaction':_0x434d1e})[_0xee39('0x24')](function(){var _0x25817f=_['map'](_0x532b4,function(_0x42b37c){_0x42b37c[_0xee39('0x6f')]=_0x19c435;return _0x42b37c;});return db[_0xee39('0x95')]['bulkCreate'](_0x25817f,{'transaction':_0x434d1e});});}else{_0x5cd7fe=0x194;_0x2e70fb=[];}});})['then'](function(){if(_0x5cd7fe!==0x194){return db[_0xee39('0x95')][_0xee39('0x96')]({'where':{'MailAccountId':_0x19c435},'order':_0xee39('0x97')})['then'](function(_0x337610){_0x2e70fb=_0x337610;});}})[_0xee39('0x18')](function(_0x374c99){_0x5cd7fe=0x1f4;logger[_0xee39('0x14')](_0x374c99[_0xee39('0x98')]);if(_0x374c99['name']){delete _0x374c99[_0xee39('0x28')];}_0x2e70fb=_0x374c99;})[_0xee39('0x99')](function(){if(_0x2e70fb===null){_0x18cccf[_0xee39('0x19')](_0x5cd7fe);}else{if(_0x5cd7fe===0x1f4){_0x18cccf[_0xee39('0x1a')](_0x5cd7fe)[_0xee39('0x29')](_0x2e70fb);}else{_0x18cccf[_0xee39('0x1a')](_0x5cd7fe)[_0xee39('0x1c')](_0x2e70fb);}}});};exports[_0xee39('0x9a')]=function(_0x40c2a8,_0x4254d4){var _0x2d9388={};var _0x52d122={};var _0x4fa5aa;var _0x24cfcb;return db[_0xee39('0x45')][_0xee39('0x6e')]({'where':{'id':_0x40c2a8[_0xee39('0x5c')]['id']}})[_0xee39('0x24')](handleEntityNotFound(_0x4254d4,null))['then'](function(_0x46e34c){if(_0x46e34c){_0x4fa5aa=_0x46e34c;_0x52d122[_0xee39('0x47')]=_[_0xee39('0x5d')](db[_0xee39('0x95')]['rawAttributes']);_0x52d122[_0xee39('0x48')]=_[_0xee39('0x5d')](_0x40c2a8[_0xee39('0x48')]);_0x52d122[_0xee39('0x49')]=_[_0xee39('0x4a')](_0x52d122[_0xee39('0x47')],_0x52d122[_0xee39('0x48')]);_0x2d9388[_0xee39('0x4b')]=_[_0xee39('0x4a')](_0x52d122[_0xee39('0x47')],qs[_0xee39('0x4c')](_0x40c2a8['query']['fields']));_0x2d9388['attributes']=_0x2d9388[_0xee39('0x4b')][_0xee39('0x4d')]?_0x2d9388[_0xee39('0x4b')]:_0x52d122['model'];_0x2d9388['order']=qs[_0xee39('0x51')](_0x40c2a8[_0xee39('0x48')][_0xee39('0x51')]);_0x2d9388[_0xee39('0x54')]=qs[_0xee39('0x49')](_['pick'](_0x40c2a8[_0xee39('0x48')],_0x52d122[_0xee39('0x49')]));if(_0x40c2a8[_0xee39('0x48')][_0xee39('0x53')]){_0x2d9388['where']=_[_0xee39('0x55')](_0x2d9388['where'],{'$or':_[_0xee39('0x44')](_0x2d9388[_0xee39('0x4b')],function(_0x1b5b5b){var _0x2fb83a={};_0x2fb83a[_0x1b5b5b]={'$like':'%'+_0x40c2a8[_0xee39('0x48')][_0xee39('0x53')]+'%'};return _0x2fb83a;})});}_0x2d9388=_[_0xee39('0x55')]({},_0x2d9388,_0x40c2a8['options']);return _0x4fa5aa[_0xee39('0x9a')](_0x2d9388);}})[_0xee39('0x24')](function(_0x19864a){if(_0x19864a){_0x24cfcb=_0x19864a[_0xee39('0x4d')];if(!_0x40c2a8[_0xee39('0x48')]['hasOwnProperty'](_0xee39('0x4f'))){_0x2d9388['limit']=qs[_0xee39('0x1f')](_0x40c2a8[_0xee39('0x48')][_0xee39('0x1f')]);_0x2d9388['offset']=qs['offset'](_0x40c2a8[_0xee39('0x48')]['offset']);}return _0x4fa5aa['getApplications'](_0x2d9388);}})[_0xee39('0x24')](function(_0x571961){if(_0x571961){return _0x571961?{'count':_0x24cfcb,'rows':_0x571961}:null;}})[_0xee39('0x24')](respondWithResult(_0x4254d4,null))['catch'](handleError(_0x4254d4,null));};exports[_0xee39('0x9b')]=function(_0x45f575,_0x34f91e){var _0x313412={'raw':!![],'where':{}};var _0x48be84={};var _0x5ef9bd={'count':0x0,'rows':[]};return db[_0xee39('0x45')][_0xee39('0x6e')]({'where':{'id':_0x45f575[_0xee39('0x5c')]['id']}})[_0xee39('0x24')](handleEntityNotFound(_0x34f91e,null))[_0xee39('0x24')](function(_0x25cc65){if(_0x25cc65){_0x48be84['model']=_[_0xee39('0x5d')](db[_0xee39('0x9c')]['rawAttributes']);_0x48be84[_0xee39('0x48')]=_[_0xee39('0x5d')](_0x45f575[_0xee39('0x48')]);_0x48be84[_0xee39('0x49')]=_[_0xee39('0x4a')](_0x48be84['model'],_0x48be84[_0xee39('0x48')]);_0x313412['attributes']=_[_0xee39('0x4a')](_0x48be84[_0xee39('0x47')],qs[_0xee39('0x4c')](_0x45f575['query'][_0xee39('0x4c')]));_0x313412[_0xee39('0x4b')]=_0x313412['attributes'][_0xee39('0x4d')]?_0x313412['attributes']:_0x48be84[_0xee39('0x47')];if(!_0x45f575[_0xee39('0x48')][_0xee39('0x4e')](_0xee39('0x4f'))){_0x313412[_0xee39('0x1f')]=qs[_0xee39('0x1f')](_0x45f575['query'][_0xee39('0x1f')]);_0x313412['offset']=qs[_0xee39('0x1d')](_0x45f575[_0xee39('0x48')][_0xee39('0x1d')]);}_0x313412[_0xee39('0x50')]=qs[_0xee39('0x51')](_0x45f575[_0xee39('0x48')][_0xee39('0x51')]);_0x313412[_0xee39('0x54')]=qs[_0xee39('0x49')](_['pick'](_0x45f575['query'],_0x48be84[_0xee39('0x49')]));_0x313412[_0xee39('0x54')][_0xee39('0x6f')]=_0x25cc65['id'];if(_0x45f575[_0xee39('0x48')][_0xee39('0x53')]){_0x313412[_0xee39('0x54')]=_[_0xee39('0x55')](_0x313412[_0xee39('0x54')],{'$or':_[_0xee39('0x44')](_0x313412[_0xee39('0x4b')],function(_0xa33037){var _0x43caf5={};_0x43caf5[_0xa33037]={'$like':'%'+_0x45f575['query'][_0xee39('0x53')]+'%'};return _0x43caf5;})});}if(_0x45f575[_0xee39('0x48')][_0xee39('0x9d')]){var _0x4ac50e=_0x45f575['query'][_0xee39('0x9d')]['split'](',');var _0x359627={};_0x359627[_0x4ac50e[0x0]]={'$gte':moment(_0x4ac50e[0x1])['format'](_0xee39('0x9e'))};_0x313412[_0xee39('0x54')]=_['merge'](_0x313412[_0xee39('0x54')],_0x359627);}_0x313412=_[_0xee39('0x55')]({},_0x313412,_0x45f575[_0xee39('0x57')]);return db[_0xee39('0x9c')][_0xee39('0x20')]({'where':_0x313412['where']})[_0xee39('0x24')](function(_0x29eba8){_0x5ef9bd[_0xee39('0x20')]=_0x29eba8;if(_0x45f575['query'][_0xee39('0x58')]){_0x313412[_0xee39('0x5e')]=[{'all':!![]}];}return db[_0xee39('0x9c')][_0xee39('0x59')](_0x313412);})[_0xee39('0x24')](function(_0x193937){if(_0x45f575[_0xee39('0x48')][_0xee39('0x9f')]===_0xee39('0xa0')){for(var _0x15fec4=0x0;_0x15fec4<_0x193937['length'];_0x15fec4++){_0x193937[_0x15fec4][_0xee39('0x5f')]=juice(_0x193937[_0x15fec4][_0xee39('0x5f')]);}}_0x5ef9bd[_0xee39('0x5a')]=_0x193937;return _0x5ef9bd;});}})[_0xee39('0x24')](respondWithFilteredResult(_0x34f91e,_0x313412))[_0xee39('0x18')](handleError(_0x34f91e,null));};exports['send']=function(_0x461d21,_0x2f3143){var _0x5e94e9,_0x16905c={},_0x250b49;if(_0x461d21[_0xee39('0x5f')]['to']){_0x250b49=_0x461d21[_0xee39('0x5f')]['to'][_0xee39('0xa1')](',')[0x0];}return db[_0xee39('0x45')][_0xee39('0x62')]({'where':{'id':_0x461d21[_0xee39('0x5c')]['id']},'include':[{'model':db[_0xee39('0xa2')],'as':_0xee39('0xa3'),'include':[{'model':db[_0xee39('0x85')],'as':_0xee39('0xa4'),'where':{'email':_0x250b49},'limit':0x1,'order':[[_0xee39('0xa5'),_0xee39('0xa6')]]}]},{'model':db['MailServerOut'],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xee39('0xa7'),'raw':!![]}]}]})[_0xee39('0x24')](handleEntityNotFound(_0x2f3143,null))[_0xee39('0x24')](function(_0x2c2282){if(!_0x2c2282)return;_0x5e94e9=_0x2c2282;if(!_0x2c2282[_0xee39('0x3e')])throw new Error('Smtp\x20configuration\x20not\x20found');if(_[_0xee39('0x74')](_0x461d21[_0xee39('0x5f')][_0xee39('0xa8')])){_0x461d21['body'][_0xee39('0xa8')]=util[_0xee39('0xa9')](_0xee39('0xaa'),_0x2c2282[_0xee39('0x28')],_0x2c2282[_0xee39('0x73')]||_0x2c2282[_0xee39('0x3e')][_0xee39('0x33')]);}if(_0x461d21[_0xee39('0x5f')]['attachments']&&_0x461d21[_0xee39('0x5f')]['attachments'][_0xee39('0x4d')]){for(var _0x140918=0x0;_0x140918<_0x461d21['body'][_0xee39('0xab')]['length'];_0x140918+=0x1){_0x461d21['body'][_0xee39('0xab')][_0x140918]={'filename':_0x461d21[_0xee39('0x5f')][_0xee39('0xab')][_0x140918]['name'],'path':path[_0xee39('0xac')](config[_0xee39('0xad')],_0xee39('0xae'),_0x461d21['body'][_0xee39('0xab')][_0x140918][_0xee39('0xaf')])};}}var _0x5b0ad1=_0x2c2282['getSmtpOptions']();return respondWithRpcPromise(_0xee39('0xb0'),_0xee39('0xb1'),{'account':_0x5b0ad1,'message':_0x461d21[_0xee39('0x5f')]});})[_0xee39('0x24')](function(_0x9c8e0d){if(!_0x9c8e0d)return;_0x16905c=_0x9c8e0d;if(!_0x5e94e9[_0xee39('0xa3')])throw new Error(_0xee39('0xb2'));if(_0x5e94e9['List'][_0xee39('0xa4')][_0xee39('0x4d')])return _0x5e94e9[_0xee39('0xa3')]['Contacts'][0x0];return db[_0xee39('0x85')][_0xee39('0x66')](_[_0xee39('0xb')](_0x461d21[_0xee39('0x5f')],{'firstName':_0x461d21[_0xee39('0x5f')]['to'],'email':_0x461d21[_0xee39('0x5f')]['to'],'phone':_0x461d21['body']['to'],'ListId':_0x5e94e9['ListId']}));})[_0xee39('0x24')](function(_0x4ed033){if(!_0x4ed033)return;var _0x1c6481={'UserId':_0x461d21['user']['id'],'ContactId':_0x4ed033['id'],'MailAccountId':_0x5e94e9['id'],'inReplyTo':_0x16905c[_0xee39('0xb3')],'to':_0x461d21[_0xee39('0x5f')][_0xee39('0xa8')],'cc':_0x461d21[_0xee39('0x5f')]['cc'],'subject':_0x461d21['body'][_0xee39('0xb4')],'attach':_0x461d21[_0xee39('0x5f')][_0xee39('0xb5')],'firstMsgDirection':_0xee39('0xb6'),'lastMsgAt':moment()[_0xee39('0xa9')](_0xee39('0x9e')),'lastMsgDirection':_0xee39('0xb6'),'Messages':[_['merge'](_0x461d21[_0xee39('0x5f')],{'messageId':_0x16905c[_0xee39('0xb3')],'sentAt':moment()['format'](_0xee39('0x9e')),'read':!![],'MailAccountId':_0x5e94e9['id'],'UserId':_0x461d21[_0xee39('0x33')]['id'],'ContactId':_0x4ed033['id']})]};if(_0x461d21[_0xee39('0x5f')]['Interaction']){_0x1c6481=_['merge'](_0x1c6481,_0x461d21[_0xee39('0x5f')][_0xee39('0xb7')]);}return db[_0xee39('0x8e')]['create'](_0x1c6481,{'include':[{'model':db[_0xee39('0x9c')],'as':_0xee39('0xb8')}]});})[_0xee39('0x24')](respondWithResult(_0x2f3143,null))[_0xee39('0x18')](handleError(_0x2f3143,null));};exports[_0xee39('0xb9')]=function(_0x30c71f,_0x1001af){return db[_0xee39('0x45')][_0xee39('0x62')]({'where':{'id':_0x30c71f['params']['id']},'include':[{'model':db[_0xee39('0x41')],'as':_0xee39('0x3e'),'raw':!![],'include':[{'model':db[_0xee39('0xa7')],'as':'CloudProvider','raw':!![]}]}]})[_0xee39('0x24')](handleEntityNotFound(_0x1001af,null))[_0xee39('0x24')](function(_0x2e711a){if(!_0x2e711a[_0xee39('0x3e')])return;var _0x29858e=_0x2e711a[_0xee39('0xba')]();return respondWithRpcPromise(_0xee39('0xbb'),_0xee39('0xb9'),{'account':_0x29858e});})[_0xee39('0x24')](respondWithResult(_0x1001af,null))[_0xee39('0x18')](handleError(_0x1001af,null));};exports['destroy']=function(_0x596d24,_0x53a514){return db[_0xee39('0x45')][_0xee39('0x62')]({'where':{'id':_0x596d24[_0xee39('0x5c')]['id']}})[_0xee39('0x24')](handleEntityNotFound(_0x53a514,null))['then'](function(_0x47ca1d){if(_0x47ca1d&&_0x47ca1d[_0xee39('0x3b')]){throw new db['Sequelize'][(_0xee39('0xbc'))](_0xee39('0xbd'));}return _0x47ca1d;})[_0xee39('0x24')](removeEntity(_0x53a514,null))['catch'](handleError(_0x53a514,null));};exports[_0xee39('0xbe')]=function(_0x314d47,_0x174ff0){return db[_0xee39('0x45')]['find']({'where':{'id':_0x314d47['params']['id']}})['then'](handleEntityNotFound(_0x174ff0,null))['then'](function(_0x37f797){if(_0x37f797){return _0x37f797[_0xee39('0xbe')](_0x314d47['body'][_0xee39('0x6a')],_[_0xee39('0x84')](_0x314d47[_0xee39('0x5f')],['ids','id'])||{})[_0xee39('0xbf')](function(_0x2815df){for(var _0x2ef0f3=0x0;_0x2ef0f3<_0x314d47[_0xee39('0x5f')][_0xee39('0x6a')][_0xee39('0x4d')];_0x2ef0f3+=0x1){socket['emit'](_0xee39('0xc0'),{'UserId':Number(_0x314d47[_0xee39('0x5f')][_0xee39('0x6a')][_0x2ef0f3]),'MailAccountId':Number(_0x314d47[_0xee39('0x5c')]['id'])});}return _0x2815df;});}})[_0xee39('0x24')](respondWithResult(_0x174ff0,null))[_0xee39('0x18')](handleError(_0x174ff0,null));};exports['removeAgents']=function(_0x33edd8,_0x1d5426){return db[_0xee39('0x45')][_0xee39('0x62')]({'where':{'id':_0x33edd8[_0xee39('0x5c')]['id']}})[_0xee39('0x24')](handleEntityNotFound(_0x1d5426,null))[_0xee39('0x24')](function(_0x4cc44f){if(_0x4cc44f){return _0x4cc44f[_0xee39('0xc1')](_0x33edd8[_0xee39('0x48')][_0xee39('0x6a')])[_0xee39('0x24')](function(){if(_[_0xee39('0xc2')](_0x33edd8[_0xee39('0x48')][_0xee39('0x6a')])){for(var _0x5d556a=0x0;_0x5d556a<_0x33edd8[_0xee39('0x48')]['ids'][_0xee39('0x4d')];_0x5d556a+=0x1){socket[_0xee39('0xc3')](_0xee39('0xc4'),{'UserId':Number(_0x33edd8[_0xee39('0x48')][_0xee39('0x6a')][_0x5d556a]),'MailAccountId':Number(_0x33edd8[_0xee39('0x5c')]['id'])});}}else{socket[_0xee39('0xc3')](_0xee39('0xc4'),{'UserId':Number(_0x33edd8[_0xee39('0x48')][_0xee39('0x6a')]),'MailAccountId':Number(_0x33edd8[_0xee39('0x5c')]['id'])});}});}})[_0xee39('0x24')](respondWithStatusCode(_0x1d5426,null))['catch'](handleError(_0x1d5426,null));};exports[_0xee39('0xc5')]=function(_0x18b155,_0x44b9b2){var _0x341259={};var _0x58b9af={};var _0x2097ba;var _0x238419;return db['MailAccount'][_0xee39('0x6e')]({'where':{'id':_0x18b155['params']['id']}})[_0xee39('0x24')](handleEntityNotFound(_0x44b9b2,null))[_0xee39('0x24')](function(_0x25b15d){if(_0x25b15d){_0x2097ba=_0x25b15d;_0x58b9af[_0xee39('0x47')]=_[_0xee39('0x5d')](db[_0xee39('0x87')]['rawAttributes']);_0x58b9af['query']=_[_0xee39('0x5d')](_0x18b155[_0xee39('0x48')]);_0x58b9af['filters']=_[_0xee39('0x4a')](_0x58b9af[_0xee39('0x47')],_0x58b9af[_0xee39('0x48')]);_0x341259['attributes']=_[_0xee39('0x4a')](_0x58b9af[_0xee39('0x47')],qs[_0xee39('0x4c')](_0x18b155[_0xee39('0x48')][_0xee39('0x4c')]));_0x341259[_0xee39('0x4b')]=_0x341259['attributes'][_0xee39('0x4d')]?_0x341259[_0xee39('0x4b')]:_0x58b9af[_0xee39('0x47')];_0x341259['order']=qs[_0xee39('0x51')](_0x18b155[_0xee39('0x48')][_0xee39('0x51')]);_0x341259[_0xee39('0x54')]=qs[_0xee39('0x49')](_[_0xee39('0x52')](_0x18b155[_0xee39('0x48')],_0x58b9af[_0xee39('0x49')]));if(_0x18b155[_0xee39('0x48')][_0xee39('0x53')]){_0x341259[_0xee39('0x54')]=_[_0xee39('0x55')](_0x341259[_0xee39('0x54')],{'$or':_[_0xee39('0x44')](_0x341259[_0xee39('0x4b')],function(_0x1d1d8b){var _0x49065f={};_0x49065f[_0x1d1d8b]={'$like':'%'+_0x18b155[_0xee39('0x48')][_0xee39('0x53')]+'%'};return _0x49065f;})});}_0x341259=_[_0xee39('0x55')]({},_0x341259,_0x18b155['options']);return _0x2097ba[_0xee39('0xc5')](_0x341259);}})[_0xee39('0x24')](function(_0x3434b0){if(_0x3434b0){_0x238419=_0x3434b0[_0xee39('0x4d')];if(!_0x18b155['query'][_0xee39('0x4e')](_0xee39('0x4f'))){_0x341259[_0xee39('0x1f')]=qs['limit'](_0x18b155['query'][_0xee39('0x1f')]);_0x341259[_0xee39('0x1d')]=qs[_0xee39('0x1d')](_0x18b155['query'][_0xee39('0x1d')]);}return _0x2097ba[_0xee39('0xc5')](_0x341259);}})[_0xee39('0x24')](function(_0x441cc0){if(_0x441cc0){return _0x441cc0?{'count':_0x238419,'rows':_0x441cc0}:null;}})[_0xee39('0x24')](respondWithResult(_0x44b9b2,null))[_0xee39('0x18')](handleError(_0x44b9b2,null));}; \ No newline at end of file +var _0x742e=['setImap','getSmtp','addSmtp','removeSmtp','MailInteraction','omit','getInteractions','CmContact','Contact','User','internal','Tag','Tags','color','tag','addApplications','sequelize','Transaction','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','priority','stack','finally','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','CmList','List','Contacts','DESC','CloudProvider','from','%s\x20<%s>','attachments','join','root','server/files/attachments','basename','getSmtpOptions','sendMail','List\x20not\x20found','ListId','messageId','subject','attach','out','Interaction','Messages','verifySmtp','VerifySmtp','Sequelize','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','getAgents','path','lodash','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','http','then','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','end','json','undefined','limit','count','offset','status','destroy','get','MailAccounts','UserProfileResource','sendStatus','name','send','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook.office365.com','Unknown\x20email\x20service\x20provider','gmail','smtp.gmail.com','smtp.office365.com','user','username','password','pass','modernAuthentication','CloudProviderId','host','port','secure','service','authentication','Imap','Smtp','index','MailServerOut','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','key','model','query','intersection','attributes','length','hasOwnProperty','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','show','params','Pause','keys','fields','include','find','update','body','provider','MailServerIn','describe','addDisposition','create','findOne','Disposition','order','MailAccountId','removeDispositions','ids','addAnswer','CannedAnswer','nolimit','removeAnswers','email','isNil','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap'];(function(_0x596624,_0x15f3f8){var _0x1f76eb=function(_0x11cca9){while(--_0x11cca9){_0x596624['push'](_0x596624['shift']());}};_0x1f76eb(++_0x15f3f8);}(_0x742e,0x101));var _0xe742=function(_0x4f8cef,_0x2a39a8){_0x4f8cef=_0x4f8cef-0x0;var _0x4ee1f3=_0x742e[_0x4f8cef];return _0x4ee1f3;};'use strict';var moment=require('moment');var BPromise=require('bluebird');var util=require('util');var path=require(_0xe742('0x0'));var _=require(_0xe742('0x1'));var juice=require('juice');var Redis=require(_0xe742('0x2'));var qs=require('../../components/parsers/qs');var logger=require(_0xe742('0x3'))(_0xe742('0x4'));var config=require(_0xe742('0x5'));var db=require(_0xe742('0x6'))['db'];config[_0xe742('0x7')]=_[_0xe742('0x8')](config[_0xe742('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0xe742('0x9'))(new Redis(config[_0xe742('0x7')]));require(_0xe742('0xa'))[_0xe742('0xb')](socket);var jayson=require(_0xe742('0xc'));var client=jayson[_0xe742('0xd')][_0xe742('0xe')]({'port':0x232b});function respondWithRpcPromise(_0x39b3a6,_0x31bad2,_0x6bc70,_0xd161ec){return new BPromise(function(_0x4ef44d,_0x4f822d){var _0x48a9f2=_0xd161ec||client;return _0x48a9f2['request'](_0x39b3a6,_0x6bc70)[_0xe742('0xf')](function(_0x4af9f1){logger[_0xe742('0x10')](_0xe742('0x11'),_0x31bad2,'request\x20sent');logger[_0xe742('0x12')](_0xe742('0x13'),_0x31bad2,'request\x20sent',JSON[_0xe742('0x14')](_0x4af9f1));if(_0x4af9f1[_0xe742('0x15')]){if(_0x4af9f1[_0xe742('0x15')][_0xe742('0x16')]===0x1f4){logger['error']('MailAccount,\x20%s,\x20%s',_0x31bad2,_0x4af9f1[_0xe742('0x15')]['message']);return _0x4f822d(_0x4af9f1[_0xe742('0x15')][_0xe742('0x17')]);}logger[_0xe742('0x15')](_0xe742('0x11'),_0x31bad2,_0x4af9f1['error'][_0xe742('0x17')]);return _0x4ef44d(_0x4af9f1[_0xe742('0x15')][_0xe742('0x17')]);}else{logger[_0xe742('0x10')](_0xe742('0x11'),_0x31bad2,_0xe742('0x18'));_0x4ef44d(_0x4af9f1[_0xe742('0x19')][_0xe742('0x17')]);}})[_0xe742('0x1a')](function(_0x4722e2){logger[_0xe742('0x15')](_0xe742('0x11'),_0x31bad2,_0x4722e2);_0x4f822d(_0x4722e2);});});}function respondWithStatusCode(_0x5832a9,_0x4bce91){_0x4bce91=_0x4bce91||0xcc;return function(_0x299e22){if(_0x299e22){return _0x5832a9['sendStatus'](_0x4bce91);}return _0x5832a9['status'](_0x4bce91)[_0xe742('0x1b')]();};}function respondWithResult(_0x4cfab3,_0x3bf021){_0x3bf021=_0x3bf021||0xc8;return function(_0x2c05be){if(_0x2c05be){return _0x4cfab3['status'](_0x3bf021)[_0xe742('0x1c')](_0x2c05be);}};}function respondWithFilteredResult(_0x201ff6,_0x128f65){return function(_0x4d224b){if(_0x4d224b){var _0x51ef81=typeof _0x128f65['offset']===_0xe742('0x1d')&&typeof _0x128f65[_0xe742('0x1e')]===_0xe742('0x1d');var _0x170179=_0x4d224b[_0xe742('0x1f')];var _0xd6c51c=_0x51ef81?0x0:_0x128f65[_0xe742('0x20')];var _0x34c1af=_0x51ef81?_0x4d224b[_0xe742('0x1f')]:_0x128f65[_0xe742('0x20')]+_0x128f65[_0xe742('0x1e')];var _0x284416;if(_0x34c1af>=_0x170179){_0x34c1af=_0x170179;_0x284416=0xc8;}else{_0x284416=0xce;}_0x201ff6[_0xe742('0x21')](_0x284416);return _0x201ff6['set']('Content-Range',_0xd6c51c+'-'+_0x34c1af+'/'+_0x170179)[_0xe742('0x1c')](_0x4d224b);}return null;};}function saveUpdates(_0x413f55){return function(_0x1b8c57){if(_0x1b8c57){return _0x1b8c57['update'](_0x413f55)[_0xe742('0xf')](function(_0x235caa){return _0x235caa;});}return null;};}function removeEntity(_0x9c5075){return function(_0x10aa16){if(_0x10aa16){return _0x10aa16[_0xe742('0x22')]()[_0xe742('0xf')](function(){var _0x3a3012=_0x10aa16[_0xe742('0x23')]({'plain':!![]});var _0x1b3a8d=_0xe742('0x24');return db[_0xe742('0x25')][_0xe742('0x22')]({'where':{'type':_0x1b3a8d,'resourceId':_0x3a3012['id']}})[_0xe742('0xf')](function(){return _0x10aa16;});})[_0xe742('0xf')](function(){_0x9c5075['status'](0xcc)[_0xe742('0x1b')]();});}};}function handleEntityNotFound(_0x33b41){return function(_0xd1c086){if(!_0xd1c086){_0x33b41[_0xe742('0x26')](0x194);}return _0xd1c086;};}function handleError(_0x2cdec0,_0x519e08){_0x519e08=_0x519e08||0x1f4;return function(_0x3e4896){logger['error'](_0x3e4896['stack']);if(_0x3e4896['name']){delete _0x3e4896[_0xe742('0x27')];}_0x2cdec0[_0xe742('0x21')](_0x519e08)[_0xe742('0x28')](_0x3e4896);};}function getImapHost(_0x279e25){switch(_0x279e25){case'gmail':return _0xe742('0x29');case _0xe742('0x2a'):return _0xe742('0x2b');case _0xe742('0x2c'):return _0xe742('0x2d');case'outlook365':return _0xe742('0x2e');}throw new Error(_0xe742('0x2f'),_0x279e25);}function getSmtpHost(_0x431594){switch(_0x431594){case _0xe742('0x30'):return _0xe742('0x31');case _0xe742('0x2a'):return'smtp.mail.yahoo.com';case _0xe742('0x2c'):return'smtp-mail.outlook.com';case'outlook365':return _0xe742('0x32');}throw new Error(_0xe742('0x2f'),_0x431594);}function getAuthenticationOptions(_0x4ed09e,_0x572a2b){var _0x34dc6d={};var _0x1c7eb2={};if(_0x4ed09e){_0x34dc6d[_0xe742('0x33')]=_0x1c7eb2[_0xe742('0x33')]=_0x572a2b[_0xe742('0x34')];_0x34dc6d[_0xe742('0x35')]=_0x1c7eb2[_0xe742('0x36')]=_0x572a2b[_0xe742('0x35')];if(_0x572a2b[_0xe742('0x37')]){_0x34dc6d[_0xe742('0x37')]=_0x1c7eb2[_0xe742('0x37')]=!![];_0x34dc6d[_0xe742('0x38')]=_0x1c7eb2['CloudProviderId']=_0x572a2b['CloudProviderId'];_0x34dc6d[_0xe742('0x35')]=_0x1c7eb2['pass']=null;}else{_0x34dc6d[_0xe742('0x38')]=_0x1c7eb2['CloudProviderId']=null;}_0x34dc6d['host']=getImapHost(_0x4ed09e);_0x34dc6d['port']=0x3e1;_0x1c7eb2[_0xe742('0x39')]=getSmtpHost(_0x4ed09e);_0x1c7eb2[_0xe742('0x3a')]=0x24b;_0x1c7eb2[_0xe742('0x3b')]=![];_0x34dc6d[_0xe742('0x3c')]=_0x1c7eb2[_0xe742('0x3c')]=null;}else{if(_0x572a2b['authentication']){_0x34dc6d[_0xe742('0x33')]=_0x1c7eb2[_0xe742('0x33')]=_0x572a2b['username'];_0x34dc6d[_0xe742('0x35')]=_0x1c7eb2[_0xe742('0x36')]=_0x572a2b[_0xe742('0x35')];}else{_0x34dc6d[_0xe742('0x3d')]=_0x1c7eb2[_0xe742('0x3d')]=![];_0x34dc6d[_0xe742('0x33')]=_0x1c7eb2['user']=null;_0x34dc6d[_0xe742('0x35')]=_0x1c7eb2[_0xe742('0x36')]=null;}_0x34dc6d[_0xe742('0x39')]=_0x572a2b[_0xe742('0x3e')]['host'];_0x34dc6d['port']=_0x572a2b[_0xe742('0x3e')][_0xe742('0x3a')];_0x1c7eb2[_0xe742('0x39')]=_0x572a2b[_0xe742('0x3f')][_0xe742('0x39')];_0x1c7eb2[_0xe742('0x3a')]=_0x572a2b[_0xe742('0x3f')][_0xe742('0x3a')];}return{'Imap':_0x34dc6d,'Smtp':_0x1c7eb2};}exports[_0xe742('0x40')]=function(_0x15c1e3,_0x4e2025){var _0x5c5819={'include':[{'model':db['MailServerIn'],'as':_0xe742('0x3e')},{'model':db[_0xe742('0x41')],'as':'Smtp'},{'model':db['Pause'],'as':_0xe742('0x42')}]},_0x4d4708={},_0x3313e2={'count':0x0,'rows':[]};var _0x50468e=_[_0xe742('0x43')](db[_0xe742('0x44')][_0xe742('0x45')],function(_0x141c4c){return{'name':_0x141c4c[_0xe742('0x46')],'type':_0x141c4c['type'][_0xe742('0x47')]};});_0x4d4708[_0xe742('0x48')]=_[_0xe742('0x43')](_0x50468e,'name');_0x4d4708[_0xe742('0x49')]=_['keys'](_0x15c1e3[_0xe742('0x49')]);_0x4d4708['filters']=_[_0xe742('0x4a')](_0x4d4708[_0xe742('0x48')],_0x4d4708['query']);_0x5c5819[_0xe742('0x4b')]=_['intersection'](_0x4d4708['model'],qs['fields'](_0x15c1e3[_0xe742('0x49')]['fields']));_0x5c5819[_0xe742('0x4b')]=_0x5c5819[_0xe742('0x4b')][_0xe742('0x4c')]?_0x5c5819[_0xe742('0x4b')]:_0x4d4708['model'];if(!_0x15c1e3[_0xe742('0x49')][_0xe742('0x4d')]('nolimit')){_0x5c5819[_0xe742('0x1e')]=qs[_0xe742('0x1e')](_0x15c1e3[_0xe742('0x49')]['limit']);_0x5c5819[_0xe742('0x20')]=qs['offset'](_0x15c1e3[_0xe742('0x49')][_0xe742('0x20')]);}_0x5c5819['order']=qs[_0xe742('0x4e')](_0x15c1e3['query'][_0xe742('0x4e')]);_0x5c5819[_0xe742('0x4f')]=qs[_0xe742('0x50')](_[_0xe742('0x51')](_0x15c1e3[_0xe742('0x49')],_0x4d4708[_0xe742('0x50')]),_0x50468e);if(_0x15c1e3['query'][_0xe742('0x52')]){_0x5c5819[_0xe742('0x4f')]=_['merge'](_0x5c5819[_0xe742('0x4f')],{'$or':_[_0xe742('0x43')](_0x50468e,function(_0x383913){if(_0x383913['type']!==_0xe742('0x53')){var _0x48a87a={};_0x48a87a[_0x383913[_0xe742('0x27')]]={'$like':'%'+_0x15c1e3['query'][_0xe742('0x52')]+'%'};return _0x48a87a;}})});}_0x5c5819=_[_0xe742('0x54')]({},_0x5c5819,_0x15c1e3[_0xe742('0x55')]);var _0x49ee1b={'where':_0x5c5819['where']};return db[_0xe742('0x44')]['count'](_0x49ee1b)[_0xe742('0xf')](function(_0x2da681){_0x3313e2['count']=_0x2da681;if(_0x15c1e3[_0xe742('0x49')][_0xe742('0x56')]){_0x5c5819['include']=[{'all':!![]}];}return db[_0xe742('0x44')][_0xe742('0x57')](_0x5c5819);})[_0xe742('0xf')](function(_0x21399d){_0x3313e2[_0xe742('0x58')]=_0x21399d;return _0x3313e2;})['then'](respondWithFilteredResult(_0x4e2025,_0x5c5819))[_0xe742('0x1a')](handleError(_0x4e2025,null));};exports[_0xe742('0x59')]=function(_0x4891a8,_0x51b2a2){var _0x130abe={'raw':![],'where':{'id':_0x4891a8[_0xe742('0x5a')]['id']},'include':[{'model':db['MailServerIn'],'as':_0xe742('0x3e')},{'model':db[_0xe742('0x41')],'as':_0xe742('0x3f')},{'model':db[_0xe742('0x5b')],'as':_0xe742('0x42')}]},_0x3a9763={};_0x3a9763['model']=_[_0xe742('0x5c')](db[_0xe742('0x44')][_0xe742('0x45')]);_0x3a9763[_0xe742('0x49')]=_[_0xe742('0x5c')](_0x4891a8[_0xe742('0x49')]);_0x3a9763['filters']=_[_0xe742('0x4a')](_0x3a9763[_0xe742('0x48')],_0x3a9763[_0xe742('0x49')]);_0x130abe[_0xe742('0x4b')]=_[_0xe742('0x4a')](_0x3a9763[_0xe742('0x48')],qs[_0xe742('0x5d')](_0x4891a8['query'][_0xe742('0x5d')]));_0x130abe['attributes']=_0x130abe[_0xe742('0x4b')][_0xe742('0x4c')]?_0x130abe[_0xe742('0x4b')]:_0x3a9763[_0xe742('0x48')];if(_0x4891a8[_0xe742('0x49')][_0xe742('0x56')]){_0x130abe[_0xe742('0x5e')]=[{'all':!![]}];}_0x130abe=_[_0xe742('0x54')]({},_0x130abe,_0x4891a8[_0xe742('0x55')]);return db[_0xe742('0x44')][_0xe742('0x5f')](_0x130abe)[_0xe742('0xf')](handleEntityNotFound(_0x51b2a2,null))[_0xe742('0xf')](respondWithResult(_0x51b2a2,null))[_0xe742('0x1a')](handleError(_0x51b2a2,null));};exports[_0xe742('0x60')]=function(_0x5c152d,_0x16c12e){if(_0x5c152d[_0xe742('0x61')]['id']){delete _0x5c152d[_0xe742('0x61')]['id'];}var _0x80ad82=_0x5c152d[_0xe742('0x61')][_0xe742('0x62')]==='custom'?null:_0x5c152d[_0xe742('0x61')][_0xe742('0x62')];var _0x404c8e=_0x5c152d[_0xe742('0x61')][_0xe742('0x3e')]||{};var _0x103ed4=_0x5c152d[_0xe742('0x61')][_0xe742('0x3f')]||{};if(_0x80ad82){_0x404c8e[_0xe742('0x39')]=getImapHost(_0x80ad82);_0x404c8e[_0xe742('0x3a')]=0x3e1;_0x103ed4[_0xe742('0x39')]=getSmtpHost(_0x80ad82);_0x103ed4[_0xe742('0x3a')]=0x24b;_0x103ed4[_0xe742('0x3b')]=![];}if(_0x103ed4['modernAuthentication']){_0x103ed4['secure']=![];}else{_0x103ed4[_0xe742('0x38')]=null;}if(!_0x404c8e['modernAuthentication'])_0x404c8e['CloudProviderId']=null;_0x5c152d['body'][_0xe742('0x3e')]=_0x404c8e;_0x5c152d['body'][_0xe742('0x3f')]=_0x103ed4;return db[_0xe742('0x44')][_0xe742('0x5f')]({'where':{'id':_0x5c152d[_0xe742('0x5a')]['id']},'include':[{'model':db[_0xe742('0x63')],'as':_0xe742('0x3e')},{'model':db[_0xe742('0x41')],'as':_0xe742('0x3f')},{'model':db['Pause'],'as':_0xe742('0x42')}]})[_0xe742('0xf')](handleEntityNotFound(_0x16c12e,null))[_0xe742('0xf')](function(_0x5b6659){if(!_0x5b6659)throw new Error('Mail\x20Account\x20not\x20found');if(_0x5b6659[_0xe742('0x3c')])delete _0x5c152d[_0xe742('0x61')][_0xe742('0x3e')];return _0x5b6659;})[_0xe742('0xf')](saveUpdates(_0x5c152d[_0xe742('0x61')],null))[_0xe742('0xf')](function(_0x57ecec){if(!_0x5c152d['body'][_0xe742('0x3e')])return _0x57ecec;return db[_0xe742('0x63')][_0xe742('0x60')](_0x5c152d['body'][_0xe742('0x3e')],{'where':{'MailAccountId':_0x57ecec['id']}})[_0xe742('0xf')](function(){return _0x57ecec;});})[_0xe742('0xf')](function(_0x5c01d5){if(!_0x5c152d['body'][_0xe742('0x3f')])return _0x5c01d5;return db[_0xe742('0x41')][_0xe742('0x60')](_0x5c152d['body'][_0xe742('0x3f')],{'where':{'MailAccountId':_0x5c01d5['id']}})[_0xe742('0xf')](function(){return _0x5c01d5;});})[_0xe742('0xf')](respondWithResult(_0x16c12e,null))['catch'](handleError(_0x16c12e,null));};exports[_0xe742('0x64')]=function(_0x557366,_0x559cb2){return db['MailAccount'][_0xe742('0x64')]()[_0xe742('0xf')](respondWithResult(_0x559cb2,null))[_0xe742('0x1a')](handleError(_0x559cb2,null));};exports[_0xe742('0x65')]=function(_0x4d671e,_0x26c258){if(_0x4d671e[_0xe742('0x61')]['id']){delete _0x4d671e[_0xe742('0x61')]['id'];}return db['MailAccount']['find']({'where':{'id':_0x4d671e['params']['id']}})[_0xe742('0xf')](handleEntityNotFound(_0x26c258,null))[_0xe742('0xf')](function(_0x28a6dd){if(_0x28a6dd){_0x4d671e[_0xe742('0x61')]['MailAccountId']=_0x28a6dd['id'];return db['Disposition'][_0xe742('0x66')](_0x4d671e[_0xe742('0x61')]);}})['then'](respondWithResult(_0x26c258,null))[_0xe742('0x1a')](handleError(_0x26c258,null));};exports['getDispositions']=function(_0x2445b1,_0x2c4d2c){var _0x2f0b05={'raw':![],'where':{}};var _0x202cf5={};var _0x2250f5={'count':0x0,'rows':[]};return db['MailAccount'][_0xe742('0x67')]({'where':{'id':_0x2445b1[_0xe742('0x5a')]['id']}})[_0xe742('0xf')](handleEntityNotFound(_0x2c4d2c,null))['then'](function(_0xdf07e7){if(_0xdf07e7){_0x202cf5[_0xe742('0x48')]=_[_0xe742('0x5c')](db[_0xe742('0x68')]['rawAttributes']);_0x202cf5[_0xe742('0x49')]=_[_0xe742('0x5c')](_0x2445b1[_0xe742('0x49')]);_0x202cf5[_0xe742('0x50')]=_[_0xe742('0x4a')](_0x202cf5[_0xe742('0x48')],_0x202cf5[_0xe742('0x49')]);_0x2f0b05[_0xe742('0x4b')]=_[_0xe742('0x4a')](_0x202cf5['model'],qs[_0xe742('0x5d')](_0x2445b1[_0xe742('0x49')][_0xe742('0x5d')]));_0x2f0b05['attributes']=_0x2f0b05[_0xe742('0x4b')][_0xe742('0x4c')]?_0x2f0b05[_0xe742('0x4b')]:_0x202cf5[_0xe742('0x48')];if(!_0x2445b1['query'][_0xe742('0x4d')]('nolimit')){_0x2f0b05[_0xe742('0x1e')]=qs[_0xe742('0x1e')](_0x2445b1['query']['limit']);_0x2f0b05['offset']=qs[_0xe742('0x20')](_0x2445b1[_0xe742('0x49')][_0xe742('0x20')]);}_0x2f0b05[_0xe742('0x69')]=qs[_0xe742('0x4e')](_0x2445b1[_0xe742('0x49')][_0xe742('0x4e')]);_0x2f0b05[_0xe742('0x4f')]=qs['filters'](_[_0xe742('0x51')](_0x2445b1['query'],_0x202cf5['filters']));_0x2f0b05[_0xe742('0x4f')][_0xe742('0x6a')]=_0xdf07e7['id'];if(_0x2445b1['query'][_0xe742('0x52')]){_0x2f0b05[_0xe742('0x4f')]=_[_0xe742('0x54')](_0x2f0b05[_0xe742('0x4f')],{'$or':_[_0xe742('0x43')](_0x2f0b05[_0xe742('0x4b')],function(_0x3e170f){var _0x481fe9={};_0x481fe9[_0x3e170f]={'$like':'%'+_0x2445b1[_0xe742('0x49')][_0xe742('0x52')]+'%'};return _0x481fe9;})});}_0x2f0b05=_[_0xe742('0x54')]({},_0x2f0b05,_0x2445b1[_0xe742('0x55')]);return db[_0xe742('0x68')][_0xe742('0x1f')]({'where':_0x2f0b05[_0xe742('0x4f')]})[_0xe742('0xf')](function(_0x540c0a){_0x2250f5[_0xe742('0x1f')]=_0x540c0a;if(_0x2445b1[_0xe742('0x49')][_0xe742('0x56')]){_0x2f0b05[_0xe742('0x5e')]=[{'all':!![]}];}return db[_0xe742('0x68')][_0xe742('0x57')](_0x2f0b05);})['then'](function(_0xf47578){_0x2250f5['rows']=_0xf47578;return _0x2250f5;});}})['then'](respondWithFilteredResult(_0x2c4d2c,_0x2f0b05))[_0xe742('0x1a')](handleError(_0x2c4d2c,null));};exports[_0xe742('0x6b')]=function(_0x172995,_0x2aa073){return db['MailAccount']['find']({'where':{'id':_0x172995[_0xe742('0x5a')]['id']}})['then'](handleEntityNotFound(_0x2aa073,null))[_0xe742('0xf')](function(_0x432e94){if(_0x432e94){return _0x432e94[_0xe742('0x6b')](_0x172995[_0xe742('0x49')][_0xe742('0x6c')]);}})[_0xe742('0xf')](respondWithStatusCode(_0x2aa073,null))['catch'](handleError(_0x2aa073,null));};exports[_0xe742('0x6d')]=function(_0x553c06,_0x3d8b79){if(_0x553c06[_0xe742('0x61')]['id']){delete _0x553c06[_0xe742('0x61')]['id'];}return db[_0xe742('0x44')][_0xe742('0x5f')]({'where':{'id':_0x553c06[_0xe742('0x5a')]['id']}})[_0xe742('0xf')](handleEntityNotFound(_0x3d8b79,null))[_0xe742('0xf')](function(_0x25f685){if(_0x25f685){_0x553c06[_0xe742('0x61')][_0xe742('0x6a')]=_0x25f685['id'];return db[_0xe742('0x6e')][_0xe742('0x66')](_0x553c06['body']);}})['then'](respondWithResult(_0x3d8b79,null))['catch'](handleError(_0x3d8b79,null));};exports['getAnswers']=function(_0x48d7da,_0x10b18e){var _0x9da311={'raw':![],'where':{}};var _0xbc90e3={};var _0x2ffaca={'count':0x0,'rows':[]};return db[_0xe742('0x44')][_0xe742('0x67')]({'where':{'id':_0x48d7da[_0xe742('0x5a')]['id']}})['then'](handleEntityNotFound(_0x10b18e,null))[_0xe742('0xf')](function(_0xac09ea){if(_0xac09ea){_0xbc90e3[_0xe742('0x48')]=_[_0xe742('0x5c')](db[_0xe742('0x6e')][_0xe742('0x45')]);_0xbc90e3[_0xe742('0x49')]=_[_0xe742('0x5c')](_0x48d7da[_0xe742('0x49')]);_0xbc90e3[_0xe742('0x50')]=_['intersection'](_0xbc90e3[_0xe742('0x48')],_0xbc90e3[_0xe742('0x49')]);_0x9da311[_0xe742('0x4b')]=_[_0xe742('0x4a')](_0xbc90e3[_0xe742('0x48')],qs[_0xe742('0x5d')](_0x48d7da[_0xe742('0x49')][_0xe742('0x5d')]));_0x9da311['attributes']=_0x9da311[_0xe742('0x4b')]['length']?_0x9da311['attributes']:_0xbc90e3['model'];if(!_0x48d7da[_0xe742('0x49')][_0xe742('0x4d')](_0xe742('0x6f'))){_0x9da311[_0xe742('0x1e')]=qs[_0xe742('0x1e')](_0x48d7da['query'][_0xe742('0x1e')]);_0x9da311['offset']=qs['offset'](_0x48d7da[_0xe742('0x49')][_0xe742('0x20')]);}_0x9da311[_0xe742('0x69')]=qs[_0xe742('0x4e')](_0x48d7da[_0xe742('0x49')]['sort']);_0x9da311[_0xe742('0x4f')]=qs[_0xe742('0x50')](_[_0xe742('0x51')](_0x48d7da[_0xe742('0x49')],_0xbc90e3[_0xe742('0x50')]));_0x9da311[_0xe742('0x4f')][_0xe742('0x6a')]=_0xac09ea['id'];if(_0x48d7da[_0xe742('0x49')][_0xe742('0x52')]){_0x9da311[_0xe742('0x4f')]=_['merge'](_0x9da311[_0xe742('0x4f')],{'$or':_[_0xe742('0x43')](_0x9da311[_0xe742('0x4b')],function(_0x4d8502){var _0x59eebc={};_0x59eebc[_0x4d8502]={'$like':'%'+_0x48d7da['query'][_0xe742('0x52')]+'%'};return _0x59eebc;})});}_0x9da311=_['merge']({},_0x9da311,_0x48d7da[_0xe742('0x55')]);return db[_0xe742('0x6e')][_0xe742('0x1f')]({'where':_0x9da311['where']})['then'](function(_0x33e8db){_0x2ffaca[_0xe742('0x1f')]=_0x33e8db;if(_0x48d7da[_0xe742('0x49')]['includeAll']){_0x9da311[_0xe742('0x5e')]=[{'all':!![]}];}return db[_0xe742('0x6e')][_0xe742('0x57')](_0x9da311);})['then'](function(_0x87c667){_0x2ffaca['rows']=_0x87c667;return _0x2ffaca;});}})[_0xe742('0xf')](respondWithFilteredResult(_0x10b18e,_0x9da311))['catch'](handleError(_0x10b18e,null));};exports[_0xe742('0x70')]=function(_0x41053b,_0x5dcf3a){return db['MailAccount'][_0xe742('0x5f')]({'where':{'id':_0x41053b[_0xe742('0x5a')]['id']}})[_0xe742('0xf')](handleEntityNotFound(_0x5dcf3a,null))[_0xe742('0xf')](function(_0x402de4){if(_0x402de4){return _0x402de4['removeAnswers'](_0x41053b[_0xe742('0x49')][_0xe742('0x6c')]);}})[_0xe742('0xf')](respondWithStatusCode(_0x5dcf3a,null))[_0xe742('0x1a')](handleError(_0x5dcf3a,null));};exports[_0xe742('0x66')]=function(_0x273818,_0x2e1d11){var _0x453a93={'name':_0x273818[_0xe742('0x61')]['name'],'key':_0x273818[_0xe742('0x61')][_0xe742('0x47')],'provider':_0x273818['body']['provider']==='custom'?null:_0x273818[_0xe742('0x61')][_0xe742('0x62')],'email':_0x273818[_0xe742('0x61')][_0xe742('0x71')],'ListId':_0x273818['body']['ListId'],'active':!_[_0xe742('0x72')](_0x273818['body']['active'])?_0x273818['body']['active']:!![],'description':_0x273818[_0xe742('0x61')][_0xe742('0x73')]||null};var _0xea2aec=getAuthenticationOptions(_0x453a93[_0xe742('0x62')],_0x273818[_0xe742('0x61')]);_0x453a93['Imap']=_0xea2aec[_0xe742('0x3e')];_0x453a93['Smtp']=_0xea2aec[_0xe742('0x3f')];return db[_0xe742('0x44')][_0xe742('0x66')](_0x453a93,{'include':[{'model':db['MailServerOut'],'as':_0xe742('0x3f')},{'model':db[_0xe742('0x63')],'as':_0xe742('0x3e')}]})['then'](function(_0xc91c42){var _0x1a3faf=_0x273818['user'][_0xe742('0x23')]({'plain':!![]});if(!_0x1a3faf)throw new Error(_0xe742('0x74'));if(_0x1a3faf['role']===_0xe742('0x33')){var _0x1cf61e=_0xc91c42[_0xe742('0x23')]({'plain':!![]});return db[_0xe742('0x75')][_0xe742('0x5f')]({'where':{'name':_0xe742('0x24'),'userProfileId':_0x1a3faf['userProfileId']},'raw':!![]})['then'](function(_0x1c7e3c){if(_0x1c7e3c&&_0x1c7e3c[_0xe742('0x76')]===0x0){return db[_0xe742('0x25')][_0xe742('0x66')]({'name':_0x1cf61e[_0xe742('0x27')],'resourceId':_0x1cf61e['id'],'type':_0x1c7e3c['name'],'sectionId':_0x1c7e3c['id']},{})[_0xe742('0xf')](function(){return _0xc91c42;});}else{return _0xc91c42;}})[_0xe742('0x1a')](function(_0x13d681){logger[_0xe742('0x15')](_0xe742('0x77'),_0x13d681);throw _0x13d681;});}return _0xc91c42;})[_0xe742('0xf')](respondWithResult(_0x2e1d11,0xc9))[_0xe742('0x1a')](handleError(_0x2e1d11,null));};exports[_0xe742('0x78')]=function(_0x9c2bb8,_0x53cae6){return db['MailAccount'][_0xe742('0x67')]({'where':{'id':_0x9c2bb8[_0xe742('0x5a')]['id']}})['then'](handleEntityNotFound(_0x53cae6,null))[_0xe742('0xf')](function(_0x5e7495){if(_0x5e7495){return _0x5e7495[_0xe742('0x78')]();}return null;})[_0xe742('0xf')](respondWithResult(_0x53cae6,null))[_0xe742('0x1a')](handleError(_0x53cae6,null));};exports[_0xe742('0x79')]=function(_0x1bcdd8,_0x375674){if(_0x1bcdd8[_0xe742('0x61')]['id']){delete _0x1bcdd8[_0xe742('0x61')]['id'];}return db[_0xe742('0x44')]['find']({'where':{'id':_0x1bcdd8[_0xe742('0x5a')]['id']}})[_0xe742('0xf')](handleEntityNotFound(_0x375674,null))[_0xe742('0xf')](function(_0x538c26){if(_0x538c26){_0x1bcdd8[_0xe742('0x61')][_0xe742('0x6a')]=_0x538c26['id'];return db[_0xe742('0x63')][_0xe742('0x66')](_0x1bcdd8[_0xe742('0x61')]);}})['then'](respondWithResult(_0x375674,null))[_0xe742('0x1a')](handleError(_0x375674,null));};exports[_0xe742('0x7a')]=function(_0x176be6,_0x29c483){return db[_0xe742('0x44')][_0xe742('0x67')]({'where':{'id':_0x176be6[_0xe742('0x5a')]['id']}})[_0xe742('0xf')](handleEntityNotFound(_0x29c483,null))['then'](function(_0x59f7ae){if(_0x59f7ae){return _0x59f7ae[_0xe742('0x7b')](null);}return null;})[_0xe742('0xf')](respondWithStatusCode(_0x29c483,null))[_0xe742('0x1a')](handleError(_0x29c483,null));};exports[_0xe742('0x7c')]=function(_0x11431f,_0x32c5d0){return db[_0xe742('0x44')][_0xe742('0x67')]({'where':{'id':_0x11431f['params']['id']}})[_0xe742('0xf')](handleEntityNotFound(_0x32c5d0,null))['then'](function(_0x3baa3f){if(_0x3baa3f){return _0x3baa3f[_0xe742('0x7c')]();}return null;})[_0xe742('0xf')](respondWithResult(_0x32c5d0,null))['catch'](handleError(_0x32c5d0,null));};exports[_0xe742('0x7d')]=function(_0x3ad9b6,_0x4acc02){if(_0x3ad9b6['body']['id']){delete _0x3ad9b6['body']['id'];}return db[_0xe742('0x44')][_0xe742('0x5f')]({'where':{'id':_0x3ad9b6[_0xe742('0x5a')]['id']}})[_0xe742('0xf')](handleEntityNotFound(_0x4acc02,null))[_0xe742('0xf')](function(_0x388150){if(_0x388150){_0x3ad9b6[_0xe742('0x61')]['MailAccountId']=_0x388150['id'];return db['MailServerOut'][_0xe742('0x66')](_0x3ad9b6[_0xe742('0x61')]);}})[_0xe742('0xf')](respondWithResult(_0x4acc02,null))[_0xe742('0x1a')](handleError(_0x4acc02,null));};exports[_0xe742('0x7e')]=function(_0x13f07f,_0xc06514){return db[_0xe742('0x44')]['findOne']({'where':{'id':_0x13f07f[_0xe742('0x5a')]['id']}})[_0xe742('0xf')](handleEntityNotFound(_0xc06514,null))[_0xe742('0xf')](function(_0x49123c){if(_0x49123c){return _0x49123c['setSmtp'](null);}return null;})[_0xe742('0xf')](respondWithStatusCode(_0xc06514,null))['catch'](handleError(_0xc06514,null));};exports['addInteraction']=function(_0x462820,_0x29a120){return db[_0xe742('0x7f')][_0xe742('0x5f')]({'where':{'id':_0x462820['params']['id']}})['then'](handleEntityNotFound(_0x29a120,null))[_0xe742('0xf')](function(_0x2b8768){if(_0x2b8768){return _0x2b8768['addInteraction'](_0x462820[_0xe742('0x61')][_0xe742('0x6c')],_[_0xe742('0x80')](_0x462820[_0xe742('0x61')],[_0xe742('0x6c'),'id'])||{});}})[_0xe742('0xf')](respondWithResult(_0x29a120,null))[_0xe742('0x1a')](handleError(_0x29a120,null));};exports[_0xe742('0x81')]=function(_0x41955b,_0x4afd0d){var _0x454596={'raw':![],'where':{}};var _0x9b7ac0={};var _0x22f275={'count':0x0,'rows':[]};return db[_0xe742('0x44')][_0xe742('0x67')]({'where':{'id':_0x41955b[_0xe742('0x5a')]['id']}})['then'](handleEntityNotFound(_0x4afd0d,null))[_0xe742('0xf')](function(_0x218f7b){if(_0x218f7b){_0x9b7ac0[_0xe742('0x48')]=_['keys'](db[_0xe742('0x7f')]['rawAttributes']);_0x9b7ac0[_0xe742('0x49')]=_['keys'](_0x41955b[_0xe742('0x49')]);_0x9b7ac0[_0xe742('0x50')]=_[_0xe742('0x4a')](_0x9b7ac0[_0xe742('0x48')],_0x9b7ac0[_0xe742('0x49')]);_0x454596[_0xe742('0x4b')]=_[_0xe742('0x4a')](_0x9b7ac0['model'],qs[_0xe742('0x5d')](_0x41955b['query']['fields']));_0x454596[_0xe742('0x4b')]=_0x454596[_0xe742('0x4b')][_0xe742('0x4c')]?_0x454596[_0xe742('0x4b')]:_0x9b7ac0[_0xe742('0x48')];if(!_0x41955b[_0xe742('0x49')][_0xe742('0x4d')]('nolimit')){_0x454596[_0xe742('0x1e')]=qs[_0xe742('0x1e')](_0x41955b[_0xe742('0x49')][_0xe742('0x1e')]);_0x454596[_0xe742('0x20')]=qs[_0xe742('0x20')](_0x41955b[_0xe742('0x49')][_0xe742('0x20')]);}_0x454596[_0xe742('0x69')]=qs[_0xe742('0x4e')](_0x41955b[_0xe742('0x49')][_0xe742('0x4e')]);_0x454596[_0xe742('0x4f')]=qs[_0xe742('0x50')](_[_0xe742('0x51')](_0x41955b[_0xe742('0x49')],_0x9b7ac0['filters']));_0x454596[_0xe742('0x4f')]['MailAccountId']=_0x218f7b['id'];if(_0x41955b['query']['filter']){_0x454596[_0xe742('0x4f')]=_[_0xe742('0x54')](_0x454596['where'],{'$or':_[_0xe742('0x43')](_0x454596[_0xe742('0x4b')],function(_0x57f2ac){var _0x477c4b={};_0x477c4b[_0x57f2ac]={'$like':'%'+_0x41955b[_0xe742('0x49')][_0xe742('0x52')]+'%'};return _0x477c4b;})});}_0x454596=_[_0xe742('0x54')]({},_0x454596,_0x41955b[_0xe742('0x55')]);return db[_0xe742('0x7f')][_0xe742('0x1f')]({'where':_0x454596[_0xe742('0x4f')]})[_0xe742('0xf')](function(_0x17571b){_0x22f275[_0xe742('0x1f')]=_0x17571b;if(_0x41955b[_0xe742('0x49')][_0xe742('0x56')]){_0x454596['include']=[{'model':db[_0xe742('0x82')],'as':_0xe742('0x83'),'required':![]},{'model':db[_0xe742('0x84')],'as':'Owner','attributes':[_0xe742('0x27'),'fullname',_0xe742('0x85')],'required':![]},{'model':db[_0xe742('0x86')],'as':_0xe742('0x87'),'attributes':['id',_0xe742('0x27'),_0xe742('0x88')],'where':_0x41955b[_0xe742('0x49')][_0xe742('0x89')]?{'id':_0x41955b['query']['tag']}:undefined,'required':_0x41955b['query'][_0xe742('0x89')]?!![]:![]}];}return db[_0xe742('0x7f')][_0xe742('0x57')](_0x454596);})[_0xe742('0xf')](function(_0x237193){_0x22f275[_0xe742('0x58')]=_0x237193;return _0x22f275;});}})[_0xe742('0xf')](respondWithFilteredResult(_0x4afd0d,_0x454596))[_0xe742('0x1a')](handleError(_0x4afd0d,null));};exports[_0xe742('0x8a')]=function addApplications(_0x30eaaf,_0x43c82b){var _0x23ca62=_0x30eaaf[_0xe742('0x5a')]['id'];var _0x49769c=_0x30eaaf[_0xe742('0x61')];var _0x59f099=0xc8;var _0x15da5e=null;return db['sequelize']['transaction']({'isolationLevel':db[_0xe742('0x8b')][_0xe742('0x8c')]['ISOLATION_LEVELS'][_0xe742('0x8d')]},function(_0x59288a){return db['MailAccount'][_0xe742('0x67')]({'where':{'id':_0x23ca62},'transaction':_0x59288a})['then'](function(_0x2c080b){if(_0x2c080b){return db[_0xe742('0x8e')]['destroy']({'where':{'MailAccountId':_0x23ca62},'transaction':_0x59288a})[_0xe742('0xf')](function(){var _0x42fc5e=_[_0xe742('0x43')](_0x49769c,function(_0x1d9f26){_0x1d9f26[_0xe742('0x6a')]=_0x23ca62;return _0x1d9f26;});return db[_0xe742('0x8e')][_0xe742('0x8f')](_0x42fc5e,{'transaction':_0x59288a});});}else{_0x59f099=0x194;_0x15da5e=[];}});})['then'](function(){if(_0x59f099!==0x194){return db[_0xe742('0x8e')][_0xe742('0x90')]({'where':{'MailAccountId':_0x23ca62},'order':_0xe742('0x91')})['then'](function(_0x23d749){_0x15da5e=_0x23d749;});}})[_0xe742('0x1a')](function(_0x5316b3){_0x59f099=0x1f4;logger['error'](_0x5316b3[_0xe742('0x92')]);if(_0x5316b3[_0xe742('0x27')]){delete _0x5316b3[_0xe742('0x27')];}_0x15da5e=_0x5316b3;})[_0xe742('0x93')](function(){if(_0x15da5e===null){_0x43c82b[_0xe742('0x26')](_0x59f099);}else{if(_0x59f099===0x1f4){_0x43c82b[_0xe742('0x21')](_0x59f099)[_0xe742('0x28')](_0x15da5e);}else{_0x43c82b[_0xe742('0x21')](_0x59f099)[_0xe742('0x1c')](_0x15da5e);}}});};exports['getApplications']=function(_0xa354ee,_0x2e22e1){var _0x299351={};var _0x4f374f={};var _0x27d467;var _0x2eacfa;return db[_0xe742('0x44')][_0xe742('0x67')]({'where':{'id':_0xa354ee[_0xe742('0x5a')]['id']}})[_0xe742('0xf')](handleEntityNotFound(_0x2e22e1,null))[_0xe742('0xf')](function(_0x1b5625){if(_0x1b5625){_0x27d467=_0x1b5625;_0x4f374f[_0xe742('0x48')]=_[_0xe742('0x5c')](db[_0xe742('0x8e')][_0xe742('0x45')]);_0x4f374f['query']=_['keys'](_0xa354ee[_0xe742('0x49')]);_0x4f374f[_0xe742('0x50')]=_[_0xe742('0x4a')](_0x4f374f['model'],_0x4f374f[_0xe742('0x49')]);_0x299351['attributes']=_[_0xe742('0x4a')](_0x4f374f[_0xe742('0x48')],qs[_0xe742('0x5d')](_0xa354ee[_0xe742('0x49')][_0xe742('0x5d')]));_0x299351[_0xe742('0x4b')]=_0x299351[_0xe742('0x4b')]['length']?_0x299351[_0xe742('0x4b')]:_0x4f374f[_0xe742('0x48')];_0x299351[_0xe742('0x69')]=qs['sort'](_0xa354ee[_0xe742('0x49')][_0xe742('0x4e')]);_0x299351[_0xe742('0x4f')]=qs[_0xe742('0x50')](_[_0xe742('0x51')](_0xa354ee[_0xe742('0x49')],_0x4f374f['filters']));if(_0xa354ee[_0xe742('0x49')]['filter']){_0x299351[_0xe742('0x4f')]=_[_0xe742('0x54')](_0x299351['where'],{'$or':_[_0xe742('0x43')](_0x299351['attributes'],function(_0x59c6ff){var _0x3e845b={};_0x3e845b[_0x59c6ff]={'$like':'%'+_0xa354ee[_0xe742('0x49')]['filter']+'%'};return _0x3e845b;})});}_0x299351=_[_0xe742('0x54')]({},_0x299351,_0xa354ee['options']);return _0x27d467[_0xe742('0x94')](_0x299351);}})['then'](function(_0x347dc1){if(_0x347dc1){_0x2eacfa=_0x347dc1[_0xe742('0x4c')];if(!_0xa354ee[_0xe742('0x49')]['hasOwnProperty'](_0xe742('0x6f'))){_0x299351['limit']=qs[_0xe742('0x1e')](_0xa354ee['query'][_0xe742('0x1e')]);_0x299351[_0xe742('0x20')]=qs['offset'](_0xa354ee['query'][_0xe742('0x20')]);}return _0x27d467[_0xe742('0x94')](_0x299351);}})[_0xe742('0xf')](function(_0x5d7501){if(_0x5d7501){return _0x5d7501?{'count':_0x2eacfa,'rows':_0x5d7501}:null;}})[_0xe742('0xf')](respondWithResult(_0x2e22e1,null))['catch'](handleError(_0x2e22e1,null));};exports[_0xe742('0x95')]=function(_0x526c4c,_0x310d9f){var _0x168f09={'raw':!![],'where':{}};var _0xc2736b={};var _0x80cb8f={'count':0x0,'rows':[]};return db[_0xe742('0x44')][_0xe742('0x67')]({'where':{'id':_0x526c4c[_0xe742('0x5a')]['id']}})['then'](handleEntityNotFound(_0x310d9f,null))[_0xe742('0xf')](function(_0x13775f){if(_0x13775f){_0xc2736b[_0xe742('0x48')]=_[_0xe742('0x5c')](db[_0xe742('0x96')]['rawAttributes']);_0xc2736b['query']=_['keys'](_0x526c4c[_0xe742('0x49')]);_0xc2736b[_0xe742('0x50')]=_[_0xe742('0x4a')](_0xc2736b['model'],_0xc2736b[_0xe742('0x49')]);_0x168f09['attributes']=_['intersection'](_0xc2736b[_0xe742('0x48')],qs[_0xe742('0x5d')](_0x526c4c[_0xe742('0x49')]['fields']));_0x168f09[_0xe742('0x4b')]=_0x168f09[_0xe742('0x4b')]['length']?_0x168f09[_0xe742('0x4b')]:_0xc2736b[_0xe742('0x48')];if(!_0x526c4c[_0xe742('0x49')][_0xe742('0x4d')](_0xe742('0x6f'))){_0x168f09['limit']=qs['limit'](_0x526c4c[_0xe742('0x49')]['limit']);_0x168f09[_0xe742('0x20')]=qs[_0xe742('0x20')](_0x526c4c[_0xe742('0x49')][_0xe742('0x20')]);}_0x168f09['order']=qs[_0xe742('0x4e')](_0x526c4c[_0xe742('0x49')][_0xe742('0x4e')]);_0x168f09['where']=qs['filters'](_['pick'](_0x526c4c[_0xe742('0x49')],_0xc2736b['filters']));_0x168f09[_0xe742('0x4f')]['MailAccountId']=_0x13775f['id'];if(_0x526c4c['query']['filter']){_0x168f09[_0xe742('0x4f')]=_[_0xe742('0x54')](_0x168f09['where'],{'$or':_[_0xe742('0x43')](_0x168f09[_0xe742('0x4b')],function(_0x1e3c03){var _0x5021ba={};_0x5021ba[_0x1e3c03]={'$like':'%'+_0x526c4c['query'][_0xe742('0x52')]+'%'};return _0x5021ba;})});}if(_0x526c4c[_0xe742('0x49')][_0xe742('0x97')]){var _0x41fa49=_0x526c4c[_0xe742('0x49')][_0xe742('0x97')][_0xe742('0x98')](',');var _0x1f1044={};_0x1f1044[_0x41fa49[0x0]]={'$gte':moment(_0x41fa49[0x1])[_0xe742('0x99')](_0xe742('0x9a'))};_0x168f09[_0xe742('0x4f')]=_['merge'](_0x168f09[_0xe742('0x4f')],_0x1f1044);}_0x168f09=_['merge']({},_0x168f09,_0x526c4c[_0xe742('0x55')]);return db[_0xe742('0x96')]['count']({'where':_0x168f09[_0xe742('0x4f')]})[_0xe742('0xf')](function(_0x2e2001){_0x80cb8f[_0xe742('0x1f')]=_0x2e2001;if(_0x526c4c[_0xe742('0x49')][_0xe742('0x56')]){_0x168f09['include']=[{'all':!![]}];}return db[_0xe742('0x96')][_0xe742('0x57')](_0x168f09);})['then'](function(_0x11f5c6){if(_0x526c4c[_0xe742('0x49')][_0xe742('0x9b')]===_0xe742('0x9c')){for(var _0x59aa80=0x0;_0x59aa80<_0x11f5c6[_0xe742('0x4c')];_0x59aa80++){_0x11f5c6[_0x59aa80]['body']=juice(_0x11f5c6[_0x59aa80][_0xe742('0x61')]);}}_0x80cb8f['rows']=_0x11f5c6;return _0x80cb8f;});}})[_0xe742('0xf')](respondWithFilteredResult(_0x310d9f,_0x168f09))[_0xe742('0x1a')](handleError(_0x310d9f,null));};exports[_0xe742('0x28')]=function(_0x4ffb92,_0xe9a5b1){var _0x107680,_0x23f56b={},_0x5eb93c;if(_0x4ffb92[_0xe742('0x61')]['to']){_0x5eb93c=_0x4ffb92[_0xe742('0x61')]['to'][_0xe742('0x98')](',')[0x0];}return db[_0xe742('0x44')][_0xe742('0x5f')]({'where':{'id':_0x4ffb92['params']['id']},'include':[{'model':db[_0xe742('0x9d')],'as':_0xe742('0x9e'),'include':[{'model':db['CmContact'],'as':_0xe742('0x9f'),'where':{'email':_0x5eb93c},'limit':0x1,'order':[['updatedAt',_0xe742('0xa0')]]}]},{'model':db[_0xe742('0x41')],'as':_0xe742('0x3f'),'raw':!![],'include':[{'model':db[_0xe742('0xa1')],'as':_0xe742('0xa1'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0xe9a5b1,null))[_0xe742('0xf')](function(_0x3f4a8a){if(!_0x3f4a8a)return;_0x107680=_0x3f4a8a;if(!_0x3f4a8a['Smtp'])throw new Error('Smtp\x20configuration\x20not\x20found');if(_[_0xe742('0x72')](_0x4ffb92[_0xe742('0x61')][_0xe742('0xa2')])){_0x4ffb92[_0xe742('0x61')]['from']=util[_0xe742('0x99')](_0xe742('0xa3'),_0x3f4a8a[_0xe742('0x27')],_0x3f4a8a[_0xe742('0x71')]||_0x3f4a8a[_0xe742('0x3f')]['user']);}if(_0x4ffb92[_0xe742('0x61')][_0xe742('0xa4')]&&_0x4ffb92[_0xe742('0x61')][_0xe742('0xa4')]['length']){for(var _0x57b661=0x0;_0x57b661<_0x4ffb92[_0xe742('0x61')][_0xe742('0xa4')][_0xe742('0x4c')];_0x57b661+=0x1){_0x4ffb92[_0xe742('0x61')][_0xe742('0xa4')][_0x57b661]={'filename':_0x4ffb92[_0xe742('0x61')][_0xe742('0xa4')][_0x57b661][_0xe742('0x27')],'path':path[_0xe742('0xa5')](config[_0xe742('0xa6')],_0xe742('0xa7'),_0x4ffb92[_0xe742('0x61')]['attachments'][_0x57b661][_0xe742('0xa8')])};}}var _0x1522df=_0x3f4a8a[_0xe742('0xa9')]();return respondWithRpcPromise('SendMail',_0xe742('0xaa'),{'account':_0x1522df,'message':_0x4ffb92[_0xe742('0x61')]});})['then'](function(_0x1ea414){if(!_0x1ea414)return;_0x23f56b=_0x1ea414;if(!_0x107680['List'])throw new Error(_0xe742('0xab'));if(_0x107680[_0xe742('0x9e')][_0xe742('0x9f')][_0xe742('0x4c')])return _0x107680['List'][_0xe742('0x9f')][0x0];return db['CmContact'][_0xe742('0x66')](_[_0xe742('0x8')](_0x4ffb92[_0xe742('0x61')],{'firstName':_0x4ffb92[_0xe742('0x61')]['to'],'email':_0x4ffb92['body']['to'],'phone':_0x4ffb92[_0xe742('0x61')]['to'],'ListId':_0x107680[_0xe742('0xac')]}));})[_0xe742('0xf')](function(_0x28bcd9){if(!_0x28bcd9)return;var _0x57b917={'UserId':_0x4ffb92[_0xe742('0x33')]['id'],'ContactId':_0x28bcd9['id'],'MailAccountId':_0x107680['id'],'inReplyTo':_0x23f56b[_0xe742('0xad')],'to':_0x4ffb92['body'][_0xe742('0xa2')],'cc':_0x4ffb92[_0xe742('0x61')]['cc'],'subject':_0x4ffb92['body'][_0xe742('0xae')],'attach':_0x4ffb92['body'][_0xe742('0xaf')],'firstMsgDirection':_0xe742('0xb0'),'lastMsgAt':moment()[_0xe742('0x99')](_0xe742('0x9a')),'lastMsgDirection':_0xe742('0xb0'),'Messages':[_['merge'](_0x4ffb92[_0xe742('0x61')],{'messageId':_0x23f56b['messageId'],'sentAt':moment()[_0xe742('0x99')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x107680['id'],'UserId':_0x4ffb92[_0xe742('0x33')]['id'],'ContactId':_0x28bcd9['id']})]};if(_0x4ffb92[_0xe742('0x61')]['Interaction']){_0x57b917=_['merge'](_0x57b917,_0x4ffb92[_0xe742('0x61')][_0xe742('0xb1')]);}return db[_0xe742('0x7f')][_0xe742('0x66')](_0x57b917,{'include':[{'model':db[_0xe742('0x96')],'as':_0xe742('0xb2')}]});})['then'](respondWithResult(_0xe9a5b1,null))[_0xe742('0x1a')](handleError(_0xe9a5b1,null));};exports[_0xe742('0xb3')]=function(_0x547224,_0x355667){return db[_0xe742('0x44')]['find']({'where':{'id':_0x547224[_0xe742('0x5a')]['id']},'include':[{'model':db['MailServerOut'],'as':_0xe742('0x3f'),'raw':!![],'include':[{'model':db[_0xe742('0xa1')],'as':_0xe742('0xa1'),'raw':!![]}]}]})[_0xe742('0xf')](handleEntityNotFound(_0x355667,null))[_0xe742('0xf')](function(_0x282edb){if(!_0x282edb[_0xe742('0x3f')])return;var _0x4e4162=_0x282edb[_0xe742('0xa9')]();return respondWithRpcPromise(_0xe742('0xb4'),'verifySmtp',{'account':_0x4e4162});})[_0xe742('0xf')](respondWithResult(_0x355667,null))[_0xe742('0x1a')](handleError(_0x355667,null));};exports[_0xe742('0x22')]=function(_0x799f9e,_0x1b1ba0){return db[_0xe742('0x44')]['find']({'where':{'id':_0x799f9e[_0xe742('0x5a')]['id']}})[_0xe742('0xf')](handleEntityNotFound(_0x1b1ba0,null))[_0xe742('0xf')](function(_0x5eb7cf){if(_0x5eb7cf&&_0x5eb7cf[_0xe742('0x3c')]){throw new db[(_0xe742('0xb5'))]['ValidationError'](_0xe742('0xb6'));}return _0x5eb7cf;})['then'](removeEntity(_0x1b1ba0,null))[_0xe742('0x1a')](handleError(_0x1b1ba0,null));};exports[_0xe742('0xb7')]=function(_0x105193,_0xe6d8cf){return db[_0xe742('0x44')]['find']({'where':{'id':_0x105193[_0xe742('0x5a')]['id']}})[_0xe742('0xf')](handleEntityNotFound(_0xe6d8cf,null))[_0xe742('0xf')](function(_0x568344){if(_0x568344){return _0x568344[_0xe742('0xb7')](_0x105193[_0xe742('0x61')]['ids'],_[_0xe742('0x80')](_0x105193[_0xe742('0x61')],[_0xe742('0x6c'),'id'])||{})[_0xe742('0xb8')](function(_0x34a99a){for(var _0x2bfe7b=0x0;_0x2bfe7b<_0x105193[_0xe742('0x61')][_0xe742('0x6c')][_0xe742('0x4c')];_0x2bfe7b+=0x1){socket[_0xe742('0xb9')](_0xe742('0xba'),{'UserId':Number(_0x105193[_0xe742('0x61')][_0xe742('0x6c')][_0x2bfe7b]),'MailAccountId':Number(_0x105193[_0xe742('0x5a')]['id'])});}return _0x34a99a;});}})[_0xe742('0xf')](respondWithResult(_0xe6d8cf,null))[_0xe742('0x1a')](handleError(_0xe6d8cf,null));};exports[_0xe742('0xbb')]=function(_0x2cb314,_0x396310){return db[_0xe742('0x44')]['find']({'where':{'id':_0x2cb314[_0xe742('0x5a')]['id']}})['then'](handleEntityNotFound(_0x396310,null))[_0xe742('0xf')](function(_0xd0fdfe){if(_0xd0fdfe){return _0xd0fdfe[_0xe742('0xbb')](_0x2cb314['query'][_0xe742('0x6c')])[_0xe742('0xf')](function(){if(_[_0xe742('0xbc')](_0x2cb314[_0xe742('0x49')][_0xe742('0x6c')])){for(var _0x291ce1=0x0;_0x291ce1<_0x2cb314['query']['ids'][_0xe742('0x4c')];_0x291ce1+=0x1){socket[_0xe742('0xb9')]('userMailAccount:remove',{'UserId':Number(_0x2cb314[_0xe742('0x49')][_0xe742('0x6c')][_0x291ce1]),'MailAccountId':Number(_0x2cb314[_0xe742('0x5a')]['id'])});}}else{socket['emit']('userMailAccount:remove',{'UserId':Number(_0x2cb314[_0xe742('0x49')][_0xe742('0x6c')]),'MailAccountId':Number(_0x2cb314[_0xe742('0x5a')]['id'])});}});}})['then'](respondWithStatusCode(_0x396310,null))[_0xe742('0x1a')](handleError(_0x396310,null));};exports[_0xe742('0xbd')]=function(_0x3c36a1,_0x5efbd4){var _0x388198={};var _0x101ebf={};var _0x4a7a6e;var _0x34851b;return db[_0xe742('0x44')][_0xe742('0x67')]({'where':{'id':_0x3c36a1['params']['id']}})['then'](handleEntityNotFound(_0x5efbd4,null))['then'](function(_0x5b738c){if(_0x5b738c){_0x4a7a6e=_0x5b738c;_0x101ebf[_0xe742('0x48')]=_[_0xe742('0x5c')](db[_0xe742('0x84')][_0xe742('0x45')]);_0x101ebf[_0xe742('0x49')]=_[_0xe742('0x5c')](_0x3c36a1['query']);_0x101ebf[_0xe742('0x50')]=_['intersection'](_0x101ebf[_0xe742('0x48')],_0x101ebf[_0xe742('0x49')]);_0x388198[_0xe742('0x4b')]=_[_0xe742('0x4a')](_0x101ebf[_0xe742('0x48')],qs[_0xe742('0x5d')](_0x3c36a1['query'][_0xe742('0x5d')]));_0x388198['attributes']=_0x388198[_0xe742('0x4b')]['length']?_0x388198[_0xe742('0x4b')]:_0x101ebf[_0xe742('0x48')];_0x388198[_0xe742('0x69')]=qs['sort'](_0x3c36a1[_0xe742('0x49')][_0xe742('0x4e')]);_0x388198[_0xe742('0x4f')]=qs[_0xe742('0x50')](_[_0xe742('0x51')](_0x3c36a1[_0xe742('0x49')],_0x101ebf[_0xe742('0x50')]));if(_0x3c36a1['query'][_0xe742('0x52')]){_0x388198[_0xe742('0x4f')]=_[_0xe742('0x54')](_0x388198[_0xe742('0x4f')],{'$or':_[_0xe742('0x43')](_0x388198[_0xe742('0x4b')],function(_0x3650ea){var _0x47a093={};_0x47a093[_0x3650ea]={'$like':'%'+_0x3c36a1[_0xe742('0x49')]['filter']+'%'};return _0x47a093;})});}_0x388198=_[_0xe742('0x54')]({},_0x388198,_0x3c36a1[_0xe742('0x55')]);return _0x4a7a6e[_0xe742('0xbd')](_0x388198);}})[_0xe742('0xf')](function(_0x3336ce){if(_0x3336ce){_0x34851b=_0x3336ce[_0xe742('0x4c')];if(!_0x3c36a1[_0xe742('0x49')][_0xe742('0x4d')](_0xe742('0x6f'))){_0x388198[_0xe742('0x1e')]=qs[_0xe742('0x1e')](_0x3c36a1[_0xe742('0x49')][_0xe742('0x1e')]);_0x388198[_0xe742('0x20')]=qs[_0xe742('0x20')](_0x3c36a1[_0xe742('0x49')][_0xe742('0x20')]);}return _0x4a7a6e['getAgents'](_0x388198);}})['then'](function(_0x4eb81b){if(_0x4eb81b){return _0x4eb81b?{'count':_0x34851b,'rows':_0x4eb81b}:null;}})[_0xe742('0xf')](respondWithResult(_0x5efbd4,null))[_0xe742('0x1a')](handleError(_0x5efbd4,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index e493636..40db3dc 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 _0x25d4=['hook','events','../../mysqldb','MailAccount','setMaxListeners','update','remove','emit'];(function(_0x7d9d62,_0x59061b){var _0x3ed57a=function(_0x55df71){while(--_0x55df71){_0x7d9d62['push'](_0x7d9d62['shift']());}};_0x3ed57a(++_0x59061b);}(_0x25d4,0xb1));var _0x425d=function(_0x276b49,_0x363cb8){_0x276b49=_0x276b49-0x0;var _0x523666=_0x25d4[_0x276b49];return _0x523666;};'use strict';var EventEmitter=require(_0x425d('0x0'));var MailAccount=require(_0x425d('0x1'))['db'][_0x425d('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x425d('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x425d('0x4'),'afterDestroy':_0x425d('0x5')};function emitEvent(_0x5b2f10){return function(_0x3d2112,_0x4fb35d,_0x179032){MailAccountEvents[_0x425d('0x6')](_0x5b2f10+':'+_0x3d2112['id'],_0x3d2112);MailAccountEvents[_0x425d('0x6')](_0x5b2f10,_0x3d2112);_0x179032(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount[_0x425d('0x7')](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file +var _0x8f53=['../../mysqldb','MailAccount','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x243ba8,_0x41b35c){var _0x759235=function(_0x47fb85){while(--_0x47fb85){_0x243ba8['push'](_0x243ba8['shift']());}};_0x759235(++_0x41b35c);}(_0x8f53,0x128));var _0x38f5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8f53[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require(_0x38f5('0x0'));var MailAccount=require(_0x38f5('0x1'))['db'][_0x38f5('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x38f5('0x3'),'afterDestroy':_0x38f5('0x4')};function emitEvent(_0x50c0b4){return function(_0x5d954b,_0x589f05,_0xb0e89f){MailAccountEvents[_0x38f5('0x5')](_0x50c0b4+':'+_0x5d954b['id'],_0x5d954b);MailAccountEvents[_0x38f5('0x5')](_0x50c0b4,_0x5d954b);_0xb0e89f(null);};}for(var e in events){if(events[_0x38f5('0x6')](e)){var event=events[e];MailAccount[_0x38f5('0x7')](e,emitEvent(event));}}module[_0x38f5('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 3a3ecb8..baed586 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 _0xdd2e=['CloudProvider','user','data5','auth','pass','./mailAccount.attributes','exports','MailAccount','mail_accounts','provider','Smtp','host','port','secure','authentication','modernAuthentication'];(function(_0x34caf0,_0x3376b9){var _0x2f8dfc=function(_0x481446){while(--_0x481446){_0x34caf0['push'](_0x34caf0['shift']());}};_0x2f8dfc(++_0x3376b9);}(_0xdd2e,0x125));var _0xedd2=function(_0x47d059,_0x1341df){_0x47d059=_0x47d059-0x0;var _0x5f2555=_0xdd2e[_0x47d059];return _0x5f2555;};'use strict';var attributes=require(_0xedd2('0x0'));module[_0xedd2('0x1')]=function(_0x5b6386){return _0x5b6386['define'](_0xedd2('0x2'),attributes,{'tableName':_0xedd2('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x4017af=this;var _0x3e414d={'id':_0x4017af['id'],'tls':{'rejectUnauthorized':![]}};if(_0x4017af[_0xedd2('0x4')]!=='custom'){_0x3e414d['service']=_0x4017af[_0xedd2('0x4')];}else{_0x3e414d['host']=_0x4017af[_0xedd2('0x5')][_0xedd2('0x6')];_0x3e414d[_0xedd2('0x7')]=_0x4017af['Smtp']['port'];_0x3e414d[_0xedd2('0x8')]=_0x4017af['Smtp'][_0xedd2('0x8')];}if(_0x4017af[_0xedd2('0x5')][_0xedd2('0x9')]){if(_0x4017af[_0xedd2('0x5')][_0xedd2('0xa')]){if(!_0x4017af['Smtp'][_0xedd2('0xb')])throw new Error('Cloud\x20Provider\x20configuration\x20not\x20found');_0x3e414d['auth']={'type':'OAuth2','user':_0x4017af[_0xedd2('0x5')][_0xedd2('0xc')],'accessToken':_0x4017af[_0xedd2('0x5')][_0xedd2('0xb')][_0xedd2('0xd')]};}else{_0x3e414d[_0xedd2('0xe')]={'user':_0x4017af[_0xedd2('0x5')][_0xedd2('0xc')],'pass':_0x4017af['Smtp'][_0xedd2('0xf')]};}}return _0x3e414d;}}});}; \ No newline at end of file +var _0x5d4f=['OAuth2','user','data5','./mailAccount.attributes','define','MailAccount','mail_accounts','provider','service','Smtp','host','secure','authentication','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','auth'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5d4f,0x168));var _0xf5d4=function(_0x905efb,_0x163106){_0x905efb=_0x905efb-0x0;var _0x3a4416=_0x5d4f[_0x905efb];return _0x3a4416;};'use strict';var attributes=require(_0xf5d4('0x0'));module['exports']=function(_0x11af75){return _0x11af75[_0xf5d4('0x1')](_0xf5d4('0x2'),attributes,{'tableName':_0xf5d4('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x56f6d3=this;var _0x10ec6f={'id':_0x56f6d3['id'],'tls':{'rejectUnauthorized':![]}};if(_0x56f6d3[_0xf5d4('0x4')]!=='custom'){_0x10ec6f[_0xf5d4('0x5')]=_0x56f6d3[_0xf5d4('0x4')];}else{_0x10ec6f['host']=_0x56f6d3[_0xf5d4('0x6')][_0xf5d4('0x7')];_0x10ec6f['port']=_0x56f6d3[_0xf5d4('0x6')]['port'];_0x10ec6f[_0xf5d4('0x8')]=_0x56f6d3[_0xf5d4('0x6')]['secure'];}if(_0x56f6d3[_0xf5d4('0x6')][_0xf5d4('0x9')]){if(_0x56f6d3[_0xf5d4('0x6')][_0xf5d4('0xa')]){if(!_0x56f6d3[_0xf5d4('0x6')][_0xf5d4('0xb')])throw new Error(_0xf5d4('0xc'));_0x10ec6f[_0xf5d4('0xd')]={'type':_0xf5d4('0xe'),'user':_0x56f6d3[_0xf5d4('0x6')][_0xf5d4('0xf')],'accessToken':_0x56f6d3[_0xf5d4('0x6')]['CloudProvider'][_0xf5d4('0x10')]};}else{_0x10ec6f[_0xf5d4('0xd')]={'user':_0x56f6d3[_0xf5d4('0x6')][_0xf5d4('0xf')],'pass':_0x56f6d3[_0xf5d4('0x6')]['pass']};}}return _0x10ec6f;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index c2e1b9a..0cfa603 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 _0x687b=['originTo','originCc','ChatWebsiteId','originChannel','Attachment','Attachments','UserId','agent','name','waitForTheAssignedAgent','Start','startRouting','lodash','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./mailAccount.socket','request','then','info','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','code','MailAccount,\x20%s,\x20%s','message','result','GetMailAccount','MailAccount','findAll','options','raw','where','attributes','limit','include','map','model','stringify','catch','ShowMailAccount','find','smtp','setDataValue','getSmtpOptions','NotifyMailAccount','mail','difference','keys','CmContact','rawAttributes','createdAt','CompanyId','body','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','from','account','Contacts','updatedAt','DESC','Applications','MailServerOut','Smtp','CloudProvider','List','omit','applications','list','orderBy','asc','length','close','autoclose','*,*,*,*','ListId','List\x20not\x20found','messageId','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','inReplyTo','create','spread','update','interaction','get','created','contact'];(function(_0x4576c4,_0x53236f){var _0x95a8be=function(_0x485516){while(--_0x485516){_0x4576c4['push'](_0x4576c4['shift']());}};_0x95a8be(++_0x53236f);}(_0x687b,0x14a));var _0xb687=function(_0x5df3ab,_0x4a0a7e){_0x5df3ab=_0x5df3ab-0x0;var _0x42cce5=_0x687b[_0x5df3ab];return _0x42cce5;};'use strict';var _=require(_0xb687('0x0'));var moment=require(_0xb687('0x1'));var BPromise=require(_0xb687('0x2'));var rs=require(_0xb687('0x3'));var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var logger=require(_0xb687('0x4'))(_0xb687('0x5'));var config=require(_0xb687('0x6'));var jayson=require(_0xb687('0x7'));var client=jayson[_0xb687('0x8')][_0xb687('0x9')]({'port':0x232c});config[_0xb687('0xa')]=_[_0xb687('0xb')](config[_0xb687('0xa')],{'host':_0xb687('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb687('0xa')]));require(_0xb687('0xd'))['register'](socket);function respondWithRpcPromise(_0x1a99c5,_0x21e3ab,_0x825ad){return new BPromise(function(_0x15dc9a,_0x404fdb){return client[_0xb687('0xe')](_0x1a99c5,_0x825ad)[_0xb687('0xf')](function(_0xaf4727){logger[_0xb687('0x10')]('MailAccount,\x20%s,\x20%s',_0x21e3ab,_0xb687('0x11'));logger[_0xb687('0x12')](_0xb687('0x13'),_0x21e3ab,_0xb687('0x11'),JSON['stringify'](_0xaf4727));if(_0xaf4727['error']){if(_0xaf4727[_0xb687('0x14')][_0xb687('0x15')]===0x1f4){logger['error'](_0xb687('0x16'),_0x21e3ab,_0xaf4727[_0xb687('0x14')][_0xb687('0x17')]);return _0x404fdb(_0xaf4727[_0xb687('0x14')][_0xb687('0x17')]);}logger[_0xb687('0x14')](_0xb687('0x16'),_0x21e3ab,_0xaf4727[_0xb687('0x14')][_0xb687('0x17')]);return _0x15dc9a(_0xaf4727[_0xb687('0x14')][_0xb687('0x17')]);}else{logger[_0xb687('0x10')]('MailAccount,\x20%s,\x20%s',_0x21e3ab,_0xb687('0x11'));_0x15dc9a(_0xaf4727[_0xb687('0x18')][_0xb687('0x17')]);}})['catch'](function(_0x48958d){logger[_0xb687('0x14')](_0xb687('0x16'),_0x21e3ab,_0x48958d);_0x404fdb(_0x48958d);});});}exports[_0xb687('0x19')]=function(_0x4b593b){var _0x42cdd2=this;return new Promise(function(_0x481f1d,_0x1bd2bf){return db[_0xb687('0x1a')][_0xb687('0x1b')]({'raw':_0x4b593b[_0xb687('0x1c')]?_0x4b593b['options'][_0xb687('0x1d')]===undefined?!![]:![]:!![],'where':_0x4b593b['options']?_0x4b593b[_0xb687('0x1c')][_0xb687('0x1e')]||null:null,'attributes':_0x4b593b[_0xb687('0x1c')]?_0x4b593b['options'][_0xb687('0x1f')]||null:null,'limit':_0x4b593b[_0xb687('0x1c')]?_0x4b593b[_0xb687('0x1c')][_0xb687('0x20')]||null:null,'include':_0x4b593b[_0xb687('0x1c')]?_0x4b593b[_0xb687('0x1c')][_0xb687('0x21')]?_[_0xb687('0x22')](_0x4b593b['options'][_0xb687('0x21')],function(_0x129347){return{'model':db[_0x129347[_0xb687('0x23')]],'as':_0x129347['as'],'attributes':_0x129347[_0xb687('0x1f')],'include':_0x129347[_0xb687('0x21')]?_[_0xb687('0x22')](_0x129347[_0xb687('0x21')],function(_0x3cb2f2){return{'model':db[_0x3cb2f2[_0xb687('0x23')]],'as':_0x3cb2f2['as'],'attributes':_0x3cb2f2[_0xb687('0x1f')],'include':_0x3cb2f2['include']?_[_0xb687('0x22')](_0x3cb2f2[_0xb687('0x21')],function(_0x392721){return{'model':db[_0x392721[_0xb687('0x23')]],'as':_0x392721['as'],'attributes':_0x392721[_0xb687('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xb687('0xf')](function(_0x4e9a06){logger[_0xb687('0x10')]('GetMailAccount',_0x4b593b);logger[_0xb687('0x12')](_0xb687('0x19'),_0x4b593b,JSON[_0xb687('0x24')](_0x4e9a06));_0x481f1d(_0x4e9a06);})[_0xb687('0x25')](function(_0x1ad3ef){logger[_0xb687('0x14')](_0xb687('0x19'),_0x1ad3ef['message'],_0x4b593b);_0x1bd2bf(_0x42cdd2[_0xb687('0x14')](0x1f4,_0x1ad3ef[_0xb687('0x17')]));});});};exports[_0xb687('0x26')]=function(_0x22cd1d){var _0xa18fec=this;return new Promise(function(_0x263834,_0x44be88){return db[_0xb687('0x1a')][_0xb687('0x27')]({'raw':_0x22cd1d[_0xb687('0x1c')]?_0x22cd1d[_0xb687('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x22cd1d['options']?_0x22cd1d[_0xb687('0x1c')][_0xb687('0x1e')]||null:null,'attributes':_0x22cd1d[_0xb687('0x1c')]?_0x22cd1d[_0xb687('0x1c')]['attributes']||null:null,'include':_0x22cd1d['options']?_0x22cd1d[_0xb687('0x1c')][_0xb687('0x21')]?_['map'](_0x22cd1d[_0xb687('0x1c')][_0xb687('0x21')],function(_0x548b83){return{'model':db[_0x548b83[_0xb687('0x23')]],'as':_0x548b83['as'],'attributes':_0x548b83['attributes'],'include':_0x548b83[_0xb687('0x21')]?_[_0xb687('0x22')](_0x548b83[_0xb687('0x21')],function(_0x3e146a){return{'model':db[_0x3e146a[_0xb687('0x23')]],'as':_0x3e146a['as'],'attributes':_0x3e146a[_0xb687('0x1f')],'include':_0x3e146a['include']?_[_0xb687('0x22')](_0x3e146a[_0xb687('0x21')],function(_0x2a73df){return{'model':db[_0x2a73df[_0xb687('0x23')]],'as':_0x2a73df['as'],'attributes':_0x2a73df['attributes']};}):[]};}):[]};}):[]:[]})[_0xb687('0xf')](function(_0x100f4a){if(_0x22cd1d[_0xb687('0x1c')][_0xb687('0x28')]===!![])_0x100f4a[_0xb687('0x29')]('smtpOptions',_0x100f4a[_0xb687('0x2a')]());logger[_0xb687('0x10')](_0xb687('0x26'),_0x22cd1d);logger[_0xb687('0x12')](_0xb687('0x26'),_0x22cd1d,JSON[_0xb687('0x24')](_0x100f4a));_0x263834(_0x100f4a);})['catch'](function(_0x5ad577){logger[_0xb687('0x14')]('ShowMailAccount',_0x5ad577[_0xb687('0x17')],_0x22cd1d);_0x44be88(_0xa18fec[_0xb687('0x14')](0x1f4,_0x5ad577['message']));});});};exports[_0xb687('0x2b')]=function(_0x2ce07a){var _0x57776b=this;return new Promise(function(_0x394b56,_0x28031e){var _0x127b25={'body':_0x2ce07a['body'],'channel':_0xb687('0x2c')};var _0x9cffb2=_[_0xb687('0x2d')](_[_0xb687('0x2e')](db[_0xb687('0x2f')][_0xb687('0x30')]),[_0xb687('0x31'),'updatedAt',_0xb687('0x32'),'ListId']);var _0x50fdb7=![];if(_0x2ce07a[_0xb687('0x33')]['id']){delete _0x2ce07a[_0xb687('0x33')]['id'];}if(_['isNil'](_0x2ce07a[_0xb687('0x33')]['from'])){return _0x28031e(_0x57776b[_0xb687('0x14')](0x1f4,_0xb687('0x34')));}if(_['isNil'](_0x2ce07a[_0xb687('0x33')][_0xb687('0x33')])||_0x2ce07a['body'][_0xb687('0x33')]===''){return _0x28031e(_0x57776b[_0xb687('0x14')](0x1f4,_0xb687('0x35')));}if(_[_0xb687('0x36')](_0x2ce07a[_0xb687('0x33')][_0xb687('0x37')])){return _0x28031e(_0x57776b[_0xb687('0x14')](0x1f4,_0xb687('0x38')+_0x9cffb2));}if(!_[_0xb687('0x39')](_0x9cffb2,_0x2ce07a[_0xb687('0x33')][_0xb687('0x37')])){return _0x28031e(_0x57776b[_0xb687('0x14')](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x9cffb2));}var _0x1ac373={};_0x1ac373[_0x2ce07a['body'][_0xb687('0x37')]]=_0x2ce07a[_0xb687('0x33')][_0xb687('0x3a')];return db[_0xb687('0x1a')][_0xb687('0x27')]({'where':{'id':_0x2ce07a[_0xb687('0x3b')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0xb687('0x2f')],'as':_0xb687('0x3c'),'where':_0x1ac373,'limit':0x1,'order':[[_0xb687('0x3d'),_0xb687('0x3e')]]}]},{'model':db['MailApplication'],'as':_0xb687('0x3f')},{'model':db[_0xb687('0x40')],'as':_0xb687('0x41'),'include':[{'model':db[_0xb687('0x42')],'as':'CloudProvider'}]}]})[_0xb687('0xf')](function(_0xfc4c5f){if(_0xfc4c5f&&_0xfc4c5f[_0xb687('0x43')]){var _0x401b99=_0xfc4c5f['get']({'plain':!![]});_0x127b25['account']=_[_0xb687('0x44')](_0x401b99,[_0xb687('0x3f'),_0xb687('0x43')]);_0x127b25['account']['smtpOptions']=_0xfc4c5f[_0xb687('0x2a')]();_0x127b25[_0xb687('0x45')]=_0x401b99[_0xb687('0x3f')];_0x127b25[_0xb687('0x46')]=_0x401b99[_0xb687('0x43')];_0x127b25[_0xb687('0x45')]=_[_0xb687('0x47')](_0x127b25[_0xb687('0x45')],['priority'],[_0xb687('0x48')]);if(_0x127b25[_0xb687('0x3b')]&&_0x127b25[_0xb687('0x3b')]['autoclose']){_0x127b25['applications']['push']({'id':0x0,'priority':_0x127b25['applications'][_0xb687('0x49')]+0x1,'app':_0xb687('0x4a'),'appdata':_0xb687('0x4b'),'interval':_0xb687('0x4c')});}if(_0x127b25[_0xb687('0x3b')][_0xb687('0x3f')]){delete _0x127b25[_0xb687('0x3b')][_0xb687('0x3f')];}if(_0x127b25[_0xb687('0x3b')][_0xb687('0x43')]){delete _0x127b25[_0xb687('0x3b')][_0xb687('0x43')];}if(_0x401b99[_0xb687('0x43')][_0xb687('0x3c')][_0xb687('0x49')]){return _0x401b99[_0xb687('0x43')][_0xb687('0x3c')][0x0];}var _0x4dca01=_['defaults'](_0x2ce07a[_0xb687('0x33')],{'firstName':_0x2ce07a[_0xb687('0x33')][_0xb687('0x3a')],'ListId':_0x401b99[_0xb687('0x4d')]});_0x4dca01[_0x2ce07a['body'][_0xb687('0x37')]]=_0x2ce07a[_0xb687('0x33')]['from'];return db[_0xb687('0x2f')]['create'](_0x4dca01);}else{throw new Error(_0xb687('0x4e'));}})[_0xb687('0xf')](function(_0x50fb31){_0x127b25['contact']=_0x50fb31;if(_0x50fb31){if(!_0x2ce07a[_0xb687('0x33')][_0xb687('0x17')]['messageId']){_0x2ce07a[_0xb687('0x33')][_0xb687('0x17')][_0xb687('0x4f')]=rs['generate']()+'\x20'+_0x2ce07a[_0xb687('0x33')]['message'][_0xb687('0x3a')];}var _0x1a31f6={'ContactId':_0x50fb31['id'],'MailAccountId':_0x2ce07a[_0xb687('0x3b')]['id'],'inReplyTo':_0x2ce07a[_0xb687('0x33')][_0xb687('0x17')]['messageId'],'to':_0x2ce07a['body'][_0xb687('0x17')]['from'],'cc':_0x2ce07a['body']['message']['cc'],'subject':_0x2ce07a['body'][_0xb687('0x17')][_0xb687('0x50')],'attach':_0x2ce07a[_0xb687('0x33')][_0xb687('0x17')][_0xb687('0x51')],'lastMsgAt':moment()[_0xb687('0x52')](_0xb687('0x53')),'lastMsgDirection':'in'};return db[_0xb687('0x54')][_0xb687('0x27')]({'where':{'closed':![],'MailAccountId':_0x2ce07a[_0xb687('0x3b')]['id']},'include':[{'model':db[_0xb687('0x55')],'as':'Messages','attributes':['messageId'],'where':{'messageId':_0x2ce07a[_0xb687('0x33')]['message'][_0xb687('0x56')]}}]})[_0xb687('0xf')](function(_0x1c031f){if(_0x1c031f){return[_0x1c031f,![]];}return db[_0xb687('0x54')][_0xb687('0x57')](_0x1a31f6)['then'](function(_0x22da49){return[_0x22da49,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xb687('0x58')](function(_0x293281,_0x18993a){if(_0x293281){_0x50fdb7=_0x18993a;if(!_0x18993a){return _0x293281[_0xb687('0x59')]({'inReplyTo':_0x2ce07a[_0xb687('0x33')][_0xb687('0x17')][_0xb687('0x4f')],'to':_0x2ce07a['body'][_0xb687('0x17')][_0xb687('0x3a')],'cc':_0x2ce07a[_0xb687('0x33')][_0xb687('0x17')]['cc'],'subject':_0x2ce07a[_0xb687('0x33')]['message'][_0xb687('0x50')],'attach':_0x293281[_0xb687('0x51')]?_0x293281[_0xb687('0x51')]:_0x2ce07a[_0xb687('0x33')][_0xb687('0x17')][_0xb687('0x51')],'substatus':null,'substatusAt':moment()[_0xb687('0x52')](_0xb687('0x53')),'lastMsgAt':moment()[_0xb687('0x52')](_0xb687('0x53')),'lastMsgDirection':'in'});}else{return _0x293281;}}})[_0xb687('0xf')](function(_0x48838a){_0x127b25[_0xb687('0x5a')]=_0x48838a[_0xb687('0x5b')]({'plain':!![]});_0x127b25[_0xb687('0x5a')][_0xb687('0x5c')]=_0x50fdb7;return db['MailMessage'][_0xb687('0x57')]({'body':_0x2ce07a[_0xb687('0x33')]['body'],'MailAccountId':_0x2ce07a[_0xb687('0x3b')]['id'],'MailInteractionId':_0x48838a['id'],'direction':'in','ContactId':_0x127b25[_0xb687('0x5d')]['id'],'messageId':_0x2ce07a[_0xb687('0x33')]['message'][_0xb687('0x4f')],'from':_0x2ce07a[_0xb687('0x33')]['message'][_0xb687('0x3a')],'to':_0x2ce07a[_0xb687('0x33')][_0xb687('0x17')]['to'],'cc':_0x2ce07a[_0xb687('0x33')]['message']['cc'],'subject':_0x2ce07a[_0xb687('0x33')][_0xb687('0x17')]['subject'],'attach':_0x2ce07a[_0xb687('0x33')][_0xb687('0x17')]['attach'],'Attachments':_0x2ce07a['body'][_0xb687('0x17')]['attachments'],'originTo':_0x2ce07a[_0xb687('0x33')][_0xb687('0x17')][_0xb687('0x5e')],'originCc':_0x2ce07a[_0xb687('0x33')][_0xb687('0x17')][_0xb687('0x5f')],'bcc':_0x2ce07a[_0xb687('0x33')][_0xb687('0x17')]['bcc'],'ChatWebsiteId':_0x2ce07a[_0xb687('0x33')][_0xb687('0x17')][_0xb687('0x60')]||null,'originChannel':_0x2ce07a[_0xb687('0x33')][_0xb687('0x17')][_0xb687('0x61')]||'Email','ChatOfflineMessageId':_0x2ce07a[_0xb687('0x33')][_0xb687('0x17')]['ChatOfflineMessageId']||null},{'include':[{'model':db[_0xb687('0x62')],'as':_0xb687('0x63')}]});})[_0xb687('0xf')](function(_0x1227fe){_0x127b25['message']=_0x1227fe;if(_0x127b25[_0xb687('0x5a')]['UserId']){return db['User'][_0xb687('0x27')]({'attributes':['id','name'],'where':{'id':_0x127b25['interaction'][_0xb687('0x64')]}})['then'](function(_0x137631){if(_0x137631){_0x127b25[_0xb687('0x45')]['unshift']({'id':0x0,'priority':0x0,'app':_0xb687('0x65'),'appdata':_0x137631[_0xb687('0x66')]+','+(_0x127b25['account'][_0xb687('0x67')]||0xa),'interval':_0xb687('0x4c')});}return respondWithRpcPromise(_0xb687('0x68'),_0xb687('0x69'),_0x127b25);});}return respondWithRpcPromise(_0xb687('0x68'),_0xb687('0x69'),_0x127b25);})[_0xb687('0xf')](function(_0x2ce516){_0x394b56(_0x2ce516);})[_0xb687('0x25')](function(_0x4092a0){_0x28031e(_0x57776b[_0xb687('0x14')](0x1f4,_0x4092a0['message']));});});}; \ No newline at end of file +var _0x5f2f=['Attachments','UserId','User','agent','name','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','redis','defaults','localhost','./mailAccount.socket','register','request','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetMailAccount','options','where','limit','include','model','attributes','map','MailAccount','find','raw','then','smtp','smtpOptions','getSmtpOptions','ShowMailAccount','NotifyMailAccount','body','mail','difference','keys','rawAttributes','createdAt','updatedAt','from','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','CmContact','DESC','MailApplication','MailServerOut','Smtp','CloudProvider','get','omit','applications','Applications','priority','asc','autoclose','push','close','Contacts','length','create','messageId','subject','format','MailMessage','Messages','inReplyTo','MailInteraction','spread','update','attach','YYYY-MM-DD\x20HH:mm:ss','interaction','contact','attachments','originCc','originChannel','Email','ChatOfflineMessageId','Attachment'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4015ad,_0x55a277){_0x4015ad=_0x4015ad-0x0;var _0x1d60a0=_0x5f2f[_0x4015ad];return _0x1d60a0;};'use strict';var _=require(_0xf5f2('0x0'));var moment=require(_0xf5f2('0x1'));var BPromise=require(_0xf5f2('0x2'));var rs=require(_0xf5f2('0x3'));var Redis=require(_0xf5f2('0x4'));var db=require(_0xf5f2('0x5'))['db'];var logger=require(_0xf5f2('0x6'))(_0xf5f2('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf5f2('0x8')][_0xf5f2('0x9')]({'port':0x232c});config[_0xf5f2('0xa')]=_[_0xf5f2('0xb')](config[_0xf5f2('0xa')],{'host':_0xf5f2('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf5f2('0xa')]));require(_0xf5f2('0xd'))[_0xf5f2('0xe')](socket);function respondWithRpcPromise(_0x56a69f,_0x375da4,_0x15dd7c){return new BPromise(function(_0x218ae3,_0x4e0e6b){return client[_0xf5f2('0xf')](_0x56a69f,_0x15dd7c)['then'](function(_0x53fb33){logger[_0xf5f2('0x10')](_0xf5f2('0x11'),_0x375da4,'request\x20sent');logger[_0xf5f2('0x12')](_0xf5f2('0x13'),_0x375da4,_0xf5f2('0x14'),JSON[_0xf5f2('0x15')](_0x53fb33));if(_0x53fb33[_0xf5f2('0x16')]){if(_0x53fb33[_0xf5f2('0x16')]['code']===0x1f4){logger[_0xf5f2('0x16')](_0xf5f2('0x11'),_0x375da4,_0x53fb33[_0xf5f2('0x16')][_0xf5f2('0x17')]);return _0x4e0e6b(_0x53fb33[_0xf5f2('0x16')]['message']);}logger[_0xf5f2('0x16')](_0xf5f2('0x11'),_0x375da4,_0x53fb33[_0xf5f2('0x16')][_0xf5f2('0x17')]);return _0x218ae3(_0x53fb33[_0xf5f2('0x16')][_0xf5f2('0x17')]);}else{logger[_0xf5f2('0x10')](_0xf5f2('0x11'),_0x375da4,_0xf5f2('0x14'));_0x218ae3(_0x53fb33[_0xf5f2('0x18')][_0xf5f2('0x17')]);}})[_0xf5f2('0x19')](function(_0x4ff59b){logger[_0xf5f2('0x16')](_0xf5f2('0x11'),_0x375da4,_0x4ff59b);_0x4e0e6b(_0x4ff59b);});});}exports[_0xf5f2('0x1a')]=function(_0x1bf655){var _0x56acc5=this;return new Promise(function(_0x34706d,_0x47101e){return db['MailAccount']['findAll']({'raw':_0x1bf655[_0xf5f2('0x1b')]?_0x1bf655[_0xf5f2('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x1bf655[_0xf5f2('0x1b')]?_0x1bf655[_0xf5f2('0x1b')][_0xf5f2('0x1c')]||null:null,'attributes':_0x1bf655[_0xf5f2('0x1b')]?_0x1bf655[_0xf5f2('0x1b')]['attributes']||null:null,'limit':_0x1bf655[_0xf5f2('0x1b')]?_0x1bf655[_0xf5f2('0x1b')][_0xf5f2('0x1d')]||null:null,'include':_0x1bf655[_0xf5f2('0x1b')]?_0x1bf655[_0xf5f2('0x1b')]['include']?_['map'](_0x1bf655[_0xf5f2('0x1b')][_0xf5f2('0x1e')],function(_0x13da6f){return{'model':db[_0x13da6f[_0xf5f2('0x1f')]],'as':_0x13da6f['as'],'attributes':_0x13da6f[_0xf5f2('0x20')],'include':_0x13da6f[_0xf5f2('0x1e')]?_[_0xf5f2('0x21')](_0x13da6f[_0xf5f2('0x1e')],function(_0x294414){return{'model':db[_0x294414['model']],'as':_0x294414['as'],'attributes':_0x294414[_0xf5f2('0x20')],'include':_0x294414[_0xf5f2('0x1e')]?_[_0xf5f2('0x21')](_0x294414[_0xf5f2('0x1e')],function(_0x198c73){return{'model':db[_0x198c73[_0xf5f2('0x1f')]],'as':_0x198c73['as'],'attributes':_0x198c73['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x22c826){logger[_0xf5f2('0x10')](_0xf5f2('0x1a'),_0x1bf655);logger['debug']('GetMailAccount',_0x1bf655,JSON[_0xf5f2('0x15')](_0x22c826));_0x34706d(_0x22c826);})[_0xf5f2('0x19')](function(_0x17394a){logger[_0xf5f2('0x16')](_0xf5f2('0x1a'),_0x17394a['message'],_0x1bf655);_0x47101e(_0x56acc5['error'](0x1f4,_0x17394a[_0xf5f2('0x17')]));});});};exports['ShowMailAccount']=function(_0xb744b9){var _0x58a4df=this;return new Promise(function(_0x45b643,_0x31087c){return db[_0xf5f2('0x22')][_0xf5f2('0x23')]({'raw':_0xb744b9[_0xf5f2('0x1b')]?_0xb744b9[_0xf5f2('0x1b')][_0xf5f2('0x24')]===undefined?!![]:![]:!![],'where':_0xb744b9[_0xf5f2('0x1b')]?_0xb744b9['options'][_0xf5f2('0x1c')]||null:null,'attributes':_0xb744b9[_0xf5f2('0x1b')]?_0xb744b9[_0xf5f2('0x1b')][_0xf5f2('0x20')]||null:null,'include':_0xb744b9[_0xf5f2('0x1b')]?_0xb744b9[_0xf5f2('0x1b')][_0xf5f2('0x1e')]?_['map'](_0xb744b9[_0xf5f2('0x1b')][_0xf5f2('0x1e')],function(_0x55989d){return{'model':db[_0x55989d[_0xf5f2('0x1f')]],'as':_0x55989d['as'],'attributes':_0x55989d['attributes'],'include':_0x55989d[_0xf5f2('0x1e')]?_[_0xf5f2('0x21')](_0x55989d[_0xf5f2('0x1e')],function(_0x2e3cca){return{'model':db[_0x2e3cca['model']],'as':_0x2e3cca['as'],'attributes':_0x2e3cca['attributes'],'include':_0x2e3cca[_0xf5f2('0x1e')]?_[_0xf5f2('0x21')](_0x2e3cca[_0xf5f2('0x1e')],function(_0x4ec8fb){return{'model':db[_0x4ec8fb[_0xf5f2('0x1f')]],'as':_0x4ec8fb['as'],'attributes':_0x4ec8fb['attributes']};}):[]};}):[]};}):[]:[]})[_0xf5f2('0x25')](function(_0x566c47){if(_0xb744b9[_0xf5f2('0x1b')][_0xf5f2('0x26')]===!![])_0x566c47['setDataValue'](_0xf5f2('0x27'),_0x566c47[_0xf5f2('0x28')]());logger[_0xf5f2('0x10')](_0xf5f2('0x29'),_0xb744b9);logger['debug']('ShowMailAccount',_0xb744b9,JSON[_0xf5f2('0x15')](_0x566c47));_0x45b643(_0x566c47);})[_0xf5f2('0x19')](function(_0x22b20c){logger[_0xf5f2('0x16')](_0xf5f2('0x29'),_0x22b20c[_0xf5f2('0x17')],_0xb744b9);_0x31087c(_0x58a4df[_0xf5f2('0x16')](0x1f4,_0x22b20c['message']));});});};exports[_0xf5f2('0x2a')]=function(_0x3b4ea6){var _0x536501=this;return new Promise(function(_0xc6a1ae,_0x3f3895){var _0x71b0e7={'body':_0x3b4ea6[_0xf5f2('0x2b')],'channel':_0xf5f2('0x2c')};var _0x3b6372=_[_0xf5f2('0x2d')](_[_0xf5f2('0x2e')](db['CmContact'][_0xf5f2('0x2f')]),[_0xf5f2('0x30'),_0xf5f2('0x31'),'CompanyId','ListId']);var _0x59eb00=![];if(_0x3b4ea6[_0xf5f2('0x2b')]['id']){delete _0x3b4ea6[_0xf5f2('0x2b')]['id'];}if(_['isNil'](_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x32')])){return _0x3f3895(_0x536501[_0xf5f2('0x16')](0x1f4,_0xf5f2('0x33')));}if(_[_0xf5f2('0x34')](_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x2b')])||_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x2b')]===''){return _0x3f3895(_0x536501[_0xf5f2('0x16')](0x1f4,_0xf5f2('0x35')));}if(_[_0xf5f2('0x34')](_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x36')])){return _0x3f3895(_0x536501['error'](0x1f4,_0xf5f2('0x37')+_0x3b6372));}if(!_['includes'](_0x3b6372,_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x36')])){return _0x3f3895(_0x536501[_0xf5f2('0x16')](0x1f4,_0xf5f2('0x38')+_0x3b6372));}var _0x31bf0e={};_0x31bf0e[_0x3b4ea6[_0xf5f2('0x2b')]['mapKey']]=_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x32')];return db[_0xf5f2('0x22')][_0xf5f2('0x23')]({'where':{'id':_0x3b4ea6[_0xf5f2('0x39')]['id']},'include':[{'model':db[_0xf5f2('0x3a')],'as':_0xf5f2('0x3b'),'include':[{'model':db[_0xf5f2('0x3c')],'as':'Contacts','where':_0x31bf0e,'limit':0x1,'order':[[_0xf5f2('0x31'),_0xf5f2('0x3d')]]}]},{'model':db[_0xf5f2('0x3e')],'as':'Applications'},{'model':db[_0xf5f2('0x3f')],'as':_0xf5f2('0x40'),'include':[{'model':db[_0xf5f2('0x41')],'as':'CloudProvider'}]}]})['then'](function(_0x7bb942){if(_0x7bb942&&_0x7bb942[_0xf5f2('0x3b')]){var _0x5db519=_0x7bb942[_0xf5f2('0x42')]({'plain':!![]});_0x71b0e7['account']=_[_0xf5f2('0x43')](_0x5db519,['Applications',_0xf5f2('0x3b')]);_0x71b0e7['account'][_0xf5f2('0x27')]=_0x7bb942[_0xf5f2('0x28')]();_0x71b0e7[_0xf5f2('0x44')]=_0x5db519[_0xf5f2('0x45')];_0x71b0e7['list']=_0x5db519[_0xf5f2('0x3b')];_0x71b0e7[_0xf5f2('0x44')]=_['orderBy'](_0x71b0e7['applications'],[_0xf5f2('0x46')],[_0xf5f2('0x47')]);if(_0x71b0e7['account']&&_0x71b0e7[_0xf5f2('0x39')][_0xf5f2('0x48')]){_0x71b0e7[_0xf5f2('0x44')][_0xf5f2('0x49')]({'id':0x0,'priority':_0x71b0e7['applications']['length']+0x1,'app':_0xf5f2('0x4a'),'appdata':_0xf5f2('0x48'),'interval':'*,*,*,*'});}if(_0x71b0e7[_0xf5f2('0x39')][_0xf5f2('0x45')]){delete _0x71b0e7[_0xf5f2('0x39')][_0xf5f2('0x45')];}if(_0x71b0e7[_0xf5f2('0x39')][_0xf5f2('0x3b')]){delete _0x71b0e7[_0xf5f2('0x39')]['List'];}if(_0x5db519['List'][_0xf5f2('0x4b')][_0xf5f2('0x4c')]){return _0x5db519[_0xf5f2('0x3b')][_0xf5f2('0x4b')][0x0];}var _0x21b0d3=_['defaults'](_0x3b4ea6[_0xf5f2('0x2b')],{'firstName':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x32')],'ListId':_0x5db519['ListId']});_0x21b0d3[_0x3b4ea6[_0xf5f2('0x2b')]['mapKey']]=_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x32')];return db[_0xf5f2('0x3c')][_0xf5f2('0x4d')](_0x21b0d3);}else{throw new Error('List\x20not\x20found');}})['then'](function(_0x756f1f){_0x71b0e7['contact']=_0x756f1f;if(_0x756f1f){if(!_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')]['messageId']){_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')][_0xf5f2('0x4e')]=rs['generate']()+'\x20'+_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')][_0xf5f2('0x32')];}var _0x4579f4={'ContactId':_0x756f1f['id'],'MailAccountId':_0x3b4ea6['account']['id'],'inReplyTo':_0x3b4ea6[_0xf5f2('0x2b')]['message'][_0xf5f2('0x4e')],'to':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')][_0xf5f2('0x32')],'cc':_0x3b4ea6[_0xf5f2('0x2b')]['message']['cc'],'subject':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')][_0xf5f2('0x4f')],'attach':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')]['attach'],'lastMsgAt':moment()[_0xf5f2('0x50')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db['MailInteraction'][_0xf5f2('0x23')]({'where':{'closed':![],'MailAccountId':_0x3b4ea6['account']['id']},'include':[{'model':db[_0xf5f2('0x51')],'as':_0xf5f2('0x52'),'attributes':[_0xf5f2('0x4e')],'where':{'messageId':_0x3b4ea6[_0xf5f2('0x2b')]['message'][_0xf5f2('0x53')]}}]})[_0xf5f2('0x25')](function(_0x1ec682){if(_0x1ec682){return[_0x1ec682,![]];}return db[_0xf5f2('0x54')][_0xf5f2('0x4d')](_0x4579f4)[_0xf5f2('0x25')](function(_0x158768){return[_0x158768,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xf5f2('0x55')](function(_0x2d171d,_0xb39a6e){if(_0x2d171d){_0x59eb00=_0xb39a6e;if(!_0xb39a6e){return _0x2d171d[_0xf5f2('0x56')]({'inReplyTo':_0x3b4ea6['body'][_0xf5f2('0x17')]['messageId'],'to':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')]['from'],'cc':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')]['cc'],'subject':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')][_0xf5f2('0x4f')],'attach':_0x2d171d['attach']?_0x2d171d[_0xf5f2('0x57')]:_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')][_0xf5f2('0x57')],'substatus':null,'substatusAt':moment()[_0xf5f2('0x50')](_0xf5f2('0x58')),'lastMsgAt':moment()['format'](_0xf5f2('0x58')),'lastMsgDirection':'in'});}else{return _0x2d171d;}}})[_0xf5f2('0x25')](function(_0x4800fe){_0x71b0e7[_0xf5f2('0x59')]=_0x4800fe[_0xf5f2('0x42')]({'plain':!![]});_0x71b0e7[_0xf5f2('0x59')]['created']=_0x59eb00;return db['MailMessage']['create']({'body':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x2b')],'MailAccountId':_0x3b4ea6[_0xf5f2('0x39')]['id'],'MailInteractionId':_0x4800fe['id'],'direction':'in','ContactId':_0x71b0e7[_0xf5f2('0x5a')]['id'],'messageId':_0x3b4ea6[_0xf5f2('0x2b')]['message'][_0xf5f2('0x4e')],'from':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')][_0xf5f2('0x32')],'to':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')]['to'],'cc':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')]['cc'],'subject':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')][_0xf5f2('0x4f')],'attach':_0x3b4ea6['body']['message']['attach'],'Attachments':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')][_0xf5f2('0x5b')],'originTo':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')]['originTo'],'originCc':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')][_0xf5f2('0x5c')],'bcc':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')]['bcc'],'ChatWebsiteId':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')]['ChatWebsiteId']||null,'originChannel':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')][_0xf5f2('0x5d')]||_0xf5f2('0x5e'),'ChatOfflineMessageId':_0x3b4ea6['body'][_0xf5f2('0x17')][_0xf5f2('0x5f')]||null},{'include':[{'model':db[_0xf5f2('0x60')],'as':_0xf5f2('0x61')}]});})[_0xf5f2('0x25')](function(_0x4f47e1){_0x71b0e7['message']=_0x4f47e1;if(_0x71b0e7[_0xf5f2('0x59')][_0xf5f2('0x62')]){return db[_0xf5f2('0x63')][_0xf5f2('0x23')]({'attributes':['id','name'],'where':{'id':_0x71b0e7['interaction'][_0xf5f2('0x62')]}})['then'](function(_0x4c4420){if(_0x4c4420){_0x71b0e7['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0xf5f2('0x64'),'appdata':_0x4c4420[_0xf5f2('0x65')]+','+(_0x71b0e7[_0xf5f2('0x39')][_0xf5f2('0x66')]||0xa),'interval':_0xf5f2('0x67')});}return respondWithRpcPromise(_0xf5f2('0x68'),_0xf5f2('0x69'),_0x71b0e7);});}return respondWithRpcPromise(_0xf5f2('0x68'),_0xf5f2('0x69'),_0x71b0e7);})[_0xf5f2('0x25')](function(_0x9afb3c){_0xc6a1ae(_0x9afb3c);})[_0xf5f2('0x19')](function(_0x1ba503){_0x3f3895(_0x536501[_0xf5f2('0x16')](0x1f4,_0x1ba503[_0xf5f2('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 7768849..fb0288a 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 _0xed27=['register','length','mailAccount:','./mailAccount.events','save','remove','emit','removeListener'];(function(_0xe5b8f,_0x368331){var _0x4b6c0b=function(_0x3752e2){while(--_0x3752e2){_0xe5b8f['push'](_0xe5b8f['shift']());}};_0x4b6c0b(++_0x368331);}(_0xed27,0x183));var _0x7ed2=function(_0x29cb2c,_0x5b7456){_0x29cb2c=_0x29cb2c-0x0;var _0x5f5cc7=_0xed27[_0x29cb2c];return _0x5f5cc7;};'use strict';var MailAccountEvents=require(_0x7ed2('0x0'));var events=[_0x7ed2('0x1'),_0x7ed2('0x2'),'update'];function createListener(_0x569eee,_0x2f0448){return function(_0x14d20c){_0x2f0448[_0x7ed2('0x3')](_0x569eee,_0x14d20c);};}function removeListener(_0x2ceee1,_0x4a0c79){return function(){MailAccountEvents[_0x7ed2('0x4')](_0x2ceee1,_0x4a0c79);};}exports[_0x7ed2('0x5')]=function(_0x12e6bb){for(var _0x26bea2=0x0,_0x38d82a=events[_0x7ed2('0x6')];_0x26bea2<_0x38d82a;_0x26bea2++){var _0x3e362f=events[_0x26bea2];var _0x1e5d9f=createListener(_0x7ed2('0x7')+_0x3e362f,_0x12e6bb);MailAccountEvents['on'](_0x3e362f,_0x1e5d9f);}}; \ No newline at end of file +var _0x4be8=['mailAccount:','./mailAccount.events','save','remove','update','emit','removeListener','register','length'];(function(_0x17257f,_0x48bf4a){var _0x3d143f=function(_0xd9588e){while(--_0xd9588e){_0x17257f['push'](_0x17257f['shift']());}};_0x3d143f(++_0x48bf4a);}(_0x4be8,0x12a));var _0x84be=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x4be8[_0x209941];return _0x1e8729;};'use strict';var MailAccountEvents=require(_0x84be('0x0'));var events=[_0x84be('0x1'),_0x84be('0x2'),_0x84be('0x3')];function createListener(_0x52dfa1,_0x4ad86b){return function(_0x1c1667){_0x4ad86b[_0x84be('0x4')](_0x52dfa1,_0x1c1667);};}function removeListener(_0x4173e0,_0x2a805c){return function(){MailAccountEvents[_0x84be('0x5')](_0x4173e0,_0x2a805c);};}exports[_0x84be('0x6')]=function(_0x38d233){for(var _0x59ac51=0x0,_0x7589e8=events[_0x84be('0x7')];_0x59ac51<_0x7589e8;_0x59ac51++){var _0x21de55=events[_0x59ac51];var _0x134998=createListener(_0x84be('0x8')+_0x21de55,_0x38d233);MailAccountEvents['on'](_0x21de55,_0x134998);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 0b85030..2c14bb3 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 _0xf47b=['multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','/:id','show','put','isAuthenticated','update','destroy'];(function(_0xb86b5d,_0x262278){var _0x1997fd=function(_0x3dcad3){while(--_0x3dcad3){_0xb86b5d['push'](_0xb86b5d['shift']());}};_0x1997fd(++_0x262278);}(_0xf47b,0xd2));var _0xbf47=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0xf47b[_0x36eaaa];return _0x461349;};'use strict';var multer=require(_0xbf47('0x0'));var util=require(_0xbf47('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbf47('0x2'));var router=express[_0xbf47('0x3')]();var fs_extra=require(_0xbf47('0x4'));var auth=require(_0xbf47('0x5'));var interaction=require(_0xbf47('0x6'));var config=require(_0xbf47('0x7'));var controller=require('./mailApplication.controller');router['get'](_0xbf47('0x8'),auth['isAuthenticated'](),controller[_0xbf47('0x9')]);router[_0xbf47('0xa')](_0xbf47('0x8'),auth[_0xbf47('0xb')](),controller[_0xbf47('0xc')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xbf47('0xd')]);module['exports']=router; \ No newline at end of file +var _0x9da9=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','/:id','isAuthenticated','show','put','update','delete','destroy','exports','util'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x9da9,0x1db));var _0x99da=function(_0x1c688b,_0x4df102){_0x1c688b=_0x1c688b-0x0;var _0x4d4577=_0x9da9[_0x1c688b];return _0x4d4577;};'use strict';var multer=require('multer');var util=require(_0x99da('0x0'));var path=require(_0x99da('0x1'));var timeout=require(_0x99da('0x2'));var express=require(_0x99da('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x99da('0x4'));var interaction=require(_0x99da('0x5'));var config=require(_0x99da('0x6'));var controller=require(_0x99da('0x7'));router[_0x99da('0x8')](_0x99da('0x9'),auth[_0x99da('0xa')](),controller[_0x99da('0xb')]);router[_0x99da('0xc')](_0x99da('0x9'),auth[_0x99da('0xa')](),controller[_0x99da('0xd')]);router[_0x99da('0xe')](_0x99da('0x9'),auth[_0x99da('0xa')](),controller[_0x99da('0xf')]);module[_0x99da('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 f5b9b6b..9c93072 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 _0x1664=['sequelize','exports','INTEGER','STRING','noop','TEXT'];(function(_0x44644b,_0x24f637){var _0x50cb88=function(_0x3994f9){while(--_0x3994f9){_0x44644b['push'](_0x44644b['shift']());}};_0x50cb88(++_0x24f637);}(_0x1664,0x12c));var _0x4166=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0x1664[_0x2e4e19];return _0x9ba20b;};'use strict';var Sequelize=require(_0x4166('0x0'));module[_0x4166('0x1')]={'priority':{'type':Sequelize[_0x4166('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x4166('0x3')],'allowNull':![],'defaultValue':_0x4166('0x4')},'appdata':{'type':Sequelize[_0x4166('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x2bfc=['TEXT','*,*,*,*','STRING','noop'];(function(_0x2b3d1f,_0x40c8b6){var _0x187469=function(_0x23f359){while(--_0x23f359){_0x2b3d1f['push'](_0x2b3d1f['shift']());}};_0x187469(++_0x40c8b6);}(_0x2bfc,0x122));var _0xc2bf=function(_0x3d6d3e,_0x2e09b2){_0x3d6d3e=_0x3d6d3e-0x0;var _0x105ea1=_0x2bfc[_0x3d6d3e];return _0x105ea1;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xc2bf('0x0')],'allowNull':![],'defaultValue':_0xc2bf('0x1')},'appdata':{'type':Sequelize[_0xc2bf('0x2')]()},'description':{'type':Sequelize[_0xc2bf('0x0')]},'interval':{'type':Sequelize[_0xc2bf('0x0')],'defaultValue':_0xc2bf('0x3')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 2e3bb34..5c7ad49 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 _0x0713=['catch','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','stack','name','send','show','params','MailApplication','rawAttributes','query','keys','filters','intersection','model','fields','attributes','length','includeAll','include','merge','options','find','body'];(function(_0x35e531,_0x92428b){var _0x3647ba=function(_0x256dc4){while(--_0x256dc4){_0x35e531['push'](_0x35e531['shift']());}};_0x3647ba(++_0x92428b);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3071('0x0'));var jsonpatch=require(_0x3071('0x1'));var rp=require(_0x3071('0x2'));var moment=require(_0x3071('0x3'));var BPromise=require(_0x3071('0x4'));var Mustache=require('mustache');var util=require(_0x3071('0x5'));var path=require(_0x3071('0x6'));var sox=require(_0x3071('0x7'));var csv=require(_0x3071('0x8'));var ejs=require(_0x3071('0x9'));var fs=require('fs');var fs_extra=require(_0x3071('0xa'));var _=require(_0x3071('0xb'));var squel=require(_0x3071('0xc'));var crypto=require(_0x3071('0xd'));var jsforce=require(_0x3071('0xe'));var deskjs=require(_0x3071('0xf'));var toCsv=require(_0x3071('0x8'));var querystring=require(_0x3071('0x10'));var Papa=require('papaparse');var Redis=require(_0x3071('0x11'));var authService=require(_0x3071('0x12'));var qs=require(_0x3071('0x13'));var as=require(_0x3071('0x14'));var hardwareService=require(_0x3071('0x15'));var logger=require('../../config/logger')(_0x3071('0x16'));var utils=require(_0x3071('0x17'));var config=require(_0x3071('0x18'));var licenseUtil=require(_0x3071('0x19'));var db=require(_0x3071('0x1a'))['db'];function respondWithStatusCode(_0x4a8cc7,_0x5330a8){_0x5330a8=_0x5330a8||0xcc;return function(_0x1826ca){if(_0x1826ca){return _0x4a8cc7['sendStatus'](_0x5330a8);}return _0x4a8cc7[_0x3071('0x1b')](_0x5330a8)[_0x3071('0x1c')]();};}function respondWithResult(_0x5d4883,_0x104e73){_0x104e73=_0x104e73||0xc8;return function(_0x4e1219){if(_0x4e1219){return _0x5d4883[_0x3071('0x1b')](_0x104e73)[_0x3071('0x1d')](_0x4e1219);}};}function respondWithFilteredResult(_0x1271d0,_0x1f14e1){return function(_0x1caa5d){if(_0x1caa5d){var _0x2a6a4b=typeof _0x1f14e1[_0x3071('0x1e')]===_0x3071('0x1f')&&typeof _0x1f14e1[_0x3071('0x20')]===_0x3071('0x1f');var _0x5f3c22=_0x1caa5d[_0x3071('0x21')];var _0x17dbda=_0x2a6a4b?0x0:_0x1f14e1[_0x3071('0x1e')];var _0x108a83=_0x2a6a4b?_0x1caa5d[_0x3071('0x21')]:_0x1f14e1[_0x3071('0x1e')]+_0x1f14e1[_0x3071('0x20')];var _0x26f113;if(_0x108a83>=_0x5f3c22){_0x108a83=_0x5f3c22;_0x26f113=0xc8;}else{_0x26f113=0xce;}_0x1271d0['status'](_0x26f113);return _0x1271d0[_0x3071('0x22')](_0x3071('0x23'),_0x17dbda+'-'+_0x108a83+'/'+_0x5f3c22)[_0x3071('0x1d')](_0x1caa5d);}return null;};}function patchUpdates(_0x56c267){return function(_0xb8f4e3){try{jsonpatch['apply'](_0xb8f4e3,_0x56c267,!![]);}catch(_0x833074){return BPromise[_0x3071('0x24')](_0x833074);}return _0xb8f4e3[_0x3071('0x25')]();};}function saveUpdates(_0x457b57,_0x33090c){return function(_0x34c50e){if(_0x34c50e){return _0x34c50e[_0x3071('0x26')](_0x457b57)[_0x3071('0x27')](function(_0x542646){return _0x542646;});}return null;};}function removeEntity(_0x481a51,_0x2ce48a){return function(_0xb05b1d){if(_0xb05b1d){return _0xb05b1d[_0x3071('0x28')]()[_0x3071('0x27')](function(){_0x481a51[_0x3071('0x1b')](0xcc)[_0x3071('0x1c')]();});}};}function handleEntityNotFound(_0x7a4cb4,_0x1fe727){return function(_0x1de5fb){if(!_0x1de5fb){_0x7a4cb4['sendStatus'](0x194);}return _0x1de5fb;};}function handleError(_0x2e5f93,_0x3f1e6e){_0x3f1e6e=_0x3f1e6e||0x1f4;return function(_0x177138){logger['error'](_0x177138[_0x3071('0x29')]);if(_0x177138[_0x3071('0x2a')]){delete _0x177138[_0x3071('0x2a')];}_0x2e5f93[_0x3071('0x1b')](_0x3f1e6e)[_0x3071('0x2b')](_0x177138);};}exports[_0x3071('0x2c')]=function(_0x177b5f,_0x3921a1){var _0x32f1b4={'raw':!![],'where':{'id':_0x177b5f[_0x3071('0x2d')]['id']}},_0x292205={};_0x292205['model']=_['keys'](db[_0x3071('0x2e')][_0x3071('0x2f')]);_0x292205[_0x3071('0x30')]=_[_0x3071('0x31')](_0x177b5f[_0x3071('0x30')]);_0x292205[_0x3071('0x32')]=_[_0x3071('0x33')](_0x292205[_0x3071('0x34')],_0x292205['query']);_0x32f1b4['attributes']=_['intersection'](_0x292205[_0x3071('0x34')],qs[_0x3071('0x35')](_0x177b5f['query'][_0x3071('0x35')]));_0x32f1b4[_0x3071('0x36')]=_0x32f1b4[_0x3071('0x36')][_0x3071('0x37')]?_0x32f1b4['attributes']:_0x292205[_0x3071('0x34')];if(_0x177b5f[_0x3071('0x30')][_0x3071('0x38')]){_0x32f1b4[_0x3071('0x39')]=[{'all':!![]}];}_0x32f1b4=_[_0x3071('0x3a')]({},_0x32f1b4,_0x177b5f[_0x3071('0x3b')]);return db[_0x3071('0x2e')][_0x3071('0x3c')](_0x32f1b4)['then'](handleEntityNotFound(_0x3921a1,null))[_0x3071('0x27')](respondWithResult(_0x3921a1,null))['catch'](handleError(_0x3921a1,null));};exports['update']=function(_0x1a1a64,_0xa3a7ae){if(_0x1a1a64['body']['id']){delete _0x1a1a64[_0x3071('0x3d')]['id'];}return db[_0x3071('0x2e')][_0x3071('0x3c')]({'where':{'id':_0x1a1a64[_0x3071('0x2d')]['id']}})[_0x3071('0x27')](handleEntityNotFound(_0xa3a7ae,null))[_0x3071('0x27')](saveUpdates(_0x1a1a64['body'],null))[_0x3071('0x27')](respondWithResult(_0xa3a7ae,null))[_0x3071('0x3e')](handleError(_0xa3a7ae,null));};exports['destroy']=function(_0x44ad05,_0x5b1392){return db[_0x3071('0x2e')][_0x3071('0x3c')]({'where':{'id':_0x44ad05['params']['id']}})['then'](handleEntityNotFound(_0x5b1392,null))[_0x3071('0x27')](removeEntity(_0x5b1392,null))[_0x3071('0x3e')](handleError(_0x5b1392,null));}; \ No newline at end of file +var _0x9bde=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','then','destroy','error','name','send','show','model','keys','MailApplication','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','catch','update','body','params','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment'];(function(_0x1303b6,_0x3d7288){var _0x4a983f=function(_0x77db26){while(--_0x77db26){_0x1303b6['push'](_0x1303b6['shift']());}};_0x4a983f(++_0x3d7288);}(_0x9bde,0xe1));var _0xe9bd=function(_0x33a024,_0x25ff77){_0x33a024=_0x33a024-0x0;var _0x500555=_0x9bde[_0x33a024];return _0x500555;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe9bd('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe9bd('0x1'));var rp=require('request-promise');var moment=require(_0xe9bd('0x2'));var BPromise=require(_0xe9bd('0x3'));var Mustache=require(_0xe9bd('0x4'));var util=require(_0xe9bd('0x5'));var path=require(_0xe9bd('0x6'));var sox=require(_0xe9bd('0x7'));var csv=require(_0xe9bd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe9bd('0x9'));var _=require(_0xe9bd('0xa'));var squel=require(_0xe9bd('0xb'));var crypto=require(_0xe9bd('0xc'));var jsforce=require(_0xe9bd('0xd'));var deskjs=require(_0xe9bd('0xe'));var toCsv=require(_0xe9bd('0x8'));var querystring=require(_0xe9bd('0xf'));var Papa=require(_0xe9bd('0x10'));var Redis=require(_0xe9bd('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe9bd('0x12'));var hardwareService=require(_0xe9bd('0x13'));var logger=require(_0xe9bd('0x14'))('api');var utils=require(_0xe9bd('0x15'));var config=require(_0xe9bd('0x16'));var licenseUtil=require(_0xe9bd('0x17'));var db=require(_0xe9bd('0x18'))['db'];function respondWithStatusCode(_0x5e022a,_0x2c1d98){_0x2c1d98=_0x2c1d98||0xcc;return function(_0x4ac319){if(_0x4ac319){return _0x5e022a[_0xe9bd('0x19')](_0x2c1d98);}return _0x5e022a[_0xe9bd('0x1a')](_0x2c1d98)[_0xe9bd('0x1b')]();};}function respondWithResult(_0x51109f,_0x47ba5e){_0x47ba5e=_0x47ba5e||0xc8;return function(_0x46a95e){if(_0x46a95e){return _0x51109f[_0xe9bd('0x1a')](_0x47ba5e)[_0xe9bd('0x1c')](_0x46a95e);}};}function respondWithFilteredResult(_0x46a59b,_0x3360bd){return function(_0x389e7b){if(_0x389e7b){var _0x45a9f2=typeof _0x3360bd['offset']===_0xe9bd('0x1d')&&typeof _0x3360bd[_0xe9bd('0x1e')]===_0xe9bd('0x1d');var _0x494b27=_0x389e7b[_0xe9bd('0x1f')];var _0x3bae08=_0x45a9f2?0x0:_0x3360bd[_0xe9bd('0x20')];var _0x330733=_0x45a9f2?_0x389e7b['count']:_0x3360bd[_0xe9bd('0x20')]+_0x3360bd['limit'];var _0xc6b661;if(_0x330733>=_0x494b27){_0x330733=_0x494b27;_0xc6b661=0xc8;}else{_0xc6b661=0xce;}_0x46a59b['status'](_0xc6b661);return _0x46a59b[_0xe9bd('0x21')](_0xe9bd('0x22'),_0x3bae08+'-'+_0x330733+'/'+_0x494b27)[_0xe9bd('0x1c')](_0x389e7b);}return null;};}function patchUpdates(_0x3dda13){return function(_0x1acb82){try{jsonpatch[_0xe9bd('0x23')](_0x1acb82,_0x3dda13,!![]);}catch(_0x6593ce){return BPromise['reject'](_0x6593ce);}return _0x1acb82[_0xe9bd('0x24')]();};}function saveUpdates(_0x28cd17,_0x4ecaf5){return function(_0x37aec1){if(_0x37aec1){return _0x37aec1['update'](_0x28cd17)[_0xe9bd('0x25')](function(_0x1b9cc9){return _0x1b9cc9;});}return null;};}function removeEntity(_0x36f8c0,_0xf02209){return function(_0x5bc4bf){if(_0x5bc4bf){return _0x5bc4bf[_0xe9bd('0x26')]()[_0xe9bd('0x25')](function(){_0x36f8c0[_0xe9bd('0x1a')](0xcc)[_0xe9bd('0x1b')]();});}};}function handleEntityNotFound(_0x2641be,_0xb52d45){return function(_0x399f3c){if(!_0x399f3c){_0x2641be[_0xe9bd('0x19')](0x194);}return _0x399f3c;};}function handleError(_0x1ae889,_0x5987af){_0x5987af=_0x5987af||0x1f4;return function(_0x3c211a){logger[_0xe9bd('0x27')](_0x3c211a['stack']);if(_0x3c211a[_0xe9bd('0x28')]){delete _0x3c211a[_0xe9bd('0x28')];}_0x1ae889[_0xe9bd('0x1a')](_0x5987af)[_0xe9bd('0x29')](_0x3c211a);};}exports[_0xe9bd('0x2a')]=function(_0x183601,_0x519f48){var _0x5b7f1d={'raw':!![],'where':{'id':_0x183601['params']['id']}},_0x1de54c={};_0x1de54c[_0xe9bd('0x2b')]=_[_0xe9bd('0x2c')](db[_0xe9bd('0x2d')][_0xe9bd('0x2e')]);_0x1de54c[_0xe9bd('0x2f')]=_['keys'](_0x183601['query']);_0x1de54c[_0xe9bd('0x30')]=_[_0xe9bd('0x31')](_0x1de54c[_0xe9bd('0x2b')],_0x1de54c[_0xe9bd('0x2f')]);_0x5b7f1d[_0xe9bd('0x32')]=_[_0xe9bd('0x31')](_0x1de54c[_0xe9bd('0x2b')],qs[_0xe9bd('0x33')](_0x183601[_0xe9bd('0x2f')]['fields']));_0x5b7f1d[_0xe9bd('0x32')]=_0x5b7f1d[_0xe9bd('0x32')][_0xe9bd('0x34')]?_0x5b7f1d['attributes']:_0x1de54c['model'];if(_0x183601[_0xe9bd('0x2f')][_0xe9bd('0x35')]){_0x5b7f1d[_0xe9bd('0x36')]=[{'all':!![]}];}_0x5b7f1d=_[_0xe9bd('0x37')]({},_0x5b7f1d,_0x183601[_0xe9bd('0x38')]);return db[_0xe9bd('0x2d')][_0xe9bd('0x39')](_0x5b7f1d)[_0xe9bd('0x25')](handleEntityNotFound(_0x519f48,null))[_0xe9bd('0x25')](respondWithResult(_0x519f48,null))[_0xe9bd('0x3a')](handleError(_0x519f48,null));};exports[_0xe9bd('0x3b')]=function(_0x549dd1,_0x2ad46e){if(_0x549dd1[_0xe9bd('0x3c')]['id']){delete _0x549dd1[_0xe9bd('0x3c')]['id'];}return db[_0xe9bd('0x2d')][_0xe9bd('0x39')]({'where':{'id':_0x549dd1[_0xe9bd('0x3d')]['id']}})['then'](handleEntityNotFound(_0x2ad46e,null))[_0xe9bd('0x25')](saveUpdates(_0x549dd1[_0xe9bd('0x3c')],null))['then'](respondWithResult(_0x2ad46e,null))[_0xe9bd('0x3a')](handleError(_0x2ad46e,null));};exports[_0xe9bd('0x26')]=function(_0x4c7d47,_0x4b1da0){return db[_0xe9bd('0x2d')][_0xe9bd('0x39')]({'where':{'id':_0x4c7d47['params']['id']}})[_0xe9bd('0x25')](handleEntityNotFound(_0x4b1da0,null))[_0xe9bd('0x25')](removeEntity(_0x4b1da0,null))[_0xe9bd('0x3a')](handleError(_0x4b1da0,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index dff1ebf..8b19b33 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 _0x5c4b=['./mailApplication.attributes','exports','define','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x49a93b,_0x581d92){var _0x1d589d=function(_0x2de326){while(--_0x2de326){_0x49a93b['push'](_0x49a93b['shift']());}};_0x1d589d(++_0x581d92);}(_0x5c4b,0x1e7));var _0xb5c4=function(_0x412e42,_0x105790){_0x412e42=_0x412e42-0x0;var _0x81e413=_0x5c4b[_0x412e42];return _0x81e413;};'use strict';var _=require('lodash');var util=require(_0xb5c4('0x0'));var logger=require(_0xb5c4('0x1'))(_0xb5c4('0x2'));var moment=require(_0xb5c4('0x3'));var BPromise=require(_0xb5c4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb5c4('0x5'));var rimraf=require(_0xb5c4('0x6'));var config=require(_0xb5c4('0x7'));var attributes=require(_0xb5c4('0x8'));module[_0xb5c4('0x9')]=function(_0x4ea148,_0x4935c2){return _0x4ea148[_0xb5c4('0xa')](_0xb5c4('0xb'),attributes,{'tableName':_0xb5c4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb5c4('0xd'),'collate':_0xb5c4('0xe')});}; \ No newline at end of file +var _0xa2bb=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailApplication.attributes','define','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api'];(function(_0x2d2ca2,_0x51873f){var _0x48489d=function(_0x1a2cf7){while(--_0x1a2cf7){_0x2d2ca2['push'](_0x2d2ca2['shift']());}};_0x48489d(++_0x51873f);}(_0xa2bb,0x75));var _0xba2b=function(_0x98f6c3,_0x28639f){_0x98f6c3=_0x98f6c3-0x0;var _0x29238c=_0xa2bb[_0x98f6c3];return _0x29238c;};'use strict';var _=require('lodash');var util=require(_0xba2b('0x0'));var logger=require(_0xba2b('0x1'))(_0xba2b('0x2'));var moment=require(_0xba2b('0x3'));var BPromise=require(_0xba2b('0x4'));var rp=require(_0xba2b('0x5'));var fs=require('fs');var path=require(_0xba2b('0x6'));var rimraf=require(_0xba2b('0x7'));var config=require(_0xba2b('0x8'));var attributes=require(_0xba2b('0x9'));module['exports']=function(_0x4ff441,_0x49e77b){return _0x4ff441[_0xba2b('0xa')](_0xba2b('0xb'),attributes,{'tableName':_0xba2b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xba2b('0xd'),'collate':_0xba2b('0xe')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 488dc0e..98be960 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 _0xed01=['raw','where','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','UpdateMailApplication','MailApplication','update','body','options'];(function(_0x403fc7,_0x32931a){var _0x5d0827=function(_0x5ea698){while(--_0x5ea698){_0x403fc7['push'](_0x403fc7['shift']());}};_0x5d0827(++_0x32931a);}(_0xed01,0x1d1));var _0x1ed0=function(_0x4a6ae5,_0x9f6541){_0x4a6ae5=_0x4a6ae5-0x0;var _0x402486=_0xed01[_0x4a6ae5];return _0x402486;};'use strict';var _=require(_0x1ed0('0x0'));var util=require(_0x1ed0('0x1'));var moment=require(_0x1ed0('0x2'));var BPromise=require(_0x1ed0('0x3'));var rs=require(_0x1ed0('0x4'));var fs=require('fs');var Redis=require(_0x1ed0('0x5'));var db=require(_0x1ed0('0x6'))['db'];var utils=require(_0x1ed0('0x7'));var logger=require(_0x1ed0('0x8'))(_0x1ed0('0x9'));var config=require(_0x1ed0('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x1ed0('0xb')][_0x1ed0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x17b51f,_0x1447f3,_0x2f48bf){return new BPromise(function(_0x8634cd,_0x4fe1b5){return client[_0x1ed0('0xd')](_0x17b51f,_0x2f48bf)[_0x1ed0('0xe')](function(_0x43e5f8){logger['info'](_0x1ed0('0xf'),_0x1447f3,_0x1ed0('0x10'));logger[_0x1ed0('0x11')](_0x1ed0('0x12'),_0x1447f3,'request\x20sent',JSON[_0x1ed0('0x13')](_0x43e5f8));if(_0x43e5f8[_0x1ed0('0x14')]){if(_0x43e5f8[_0x1ed0('0x14')]['code']===0x1f4){logger[_0x1ed0('0x14')](_0x1ed0('0xf'),_0x1447f3,_0x43e5f8[_0x1ed0('0x14')]['message']);return _0x4fe1b5(_0x43e5f8[_0x1ed0('0x14')][_0x1ed0('0x15')]);}logger[_0x1ed0('0x14')](_0x1ed0('0xf'),_0x1447f3,_0x43e5f8[_0x1ed0('0x14')]['message']);return _0x8634cd(_0x43e5f8[_0x1ed0('0x14')]['message']);}else{logger[_0x1ed0('0x16')](_0x1ed0('0xf'),_0x1447f3,'request\x20sent');_0x8634cd(_0x43e5f8[_0x1ed0('0x17')][_0x1ed0('0x15')]);}})[_0x1ed0('0x18')](function(_0x241233){logger['error']('MailApplication,\x20%s,\x20%s',_0x1447f3,_0x241233);_0x4fe1b5(_0x241233);});});}exports[_0x1ed0('0x19')]=function(_0x131f0e){var _0x45b27d=this;return new Promise(function(_0x590ddf,_0x297fc8){return db[_0x1ed0('0x1a')][_0x1ed0('0x1b')](_0x131f0e[_0x1ed0('0x1c')],{'raw':_0x131f0e[_0x1ed0('0x1d')]?_0x131f0e[_0x1ed0('0x1d')][_0x1ed0('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x131f0e[_0x1ed0('0x1d')]?_0x131f0e[_0x1ed0('0x1d')][_0x1ed0('0x1f')]||null:null,'attributes':_0x131f0e[_0x1ed0('0x1d')]?_0x131f0e[_0x1ed0('0x1d')]['attributes']||null:null,'limit':_0x131f0e[_0x1ed0('0x1d')]?_0x131f0e[_0x1ed0('0x1d')][_0x1ed0('0x20')]||null:null})[_0x1ed0('0xe')](function(_0x179c1d){logger[_0x1ed0('0x16')](_0x1ed0('0x19'),_0x131f0e);logger[_0x1ed0('0x11')](_0x1ed0('0x19'),_0x131f0e,JSON['stringify'](_0x179c1d));_0x590ddf(_0x179c1d);})[_0x1ed0('0x18')](function(_0x1abae7){logger[_0x1ed0('0x14')](_0x1ed0('0x19'),_0x1abae7['message'],_0x131f0e);_0x297fc8(_0x45b27d[_0x1ed0('0x14')](0x1f4,_0x1abae7[_0x1ed0('0x15')]));});});}; \ No newline at end of file +var _0xde00=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailApplication,\x20%s,\x20%s','debug','MailApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','update','options','raw','attributes','UpdateMailApplication','lodash','util','moment','bluebird','randomstring'];(function(_0x33217a,_0x185b35){var _0x3d225f=function(_0x253aab){while(--_0x253aab){_0x33217a['push'](_0x33217a['shift']());}};_0x3d225f(++_0x185b35);}(_0xde00,0x19b));var _0x0de0=function(_0x1a5ad1,_0x357407){_0x1a5ad1=_0x1a5ad1-0x0;var _0x7b8b22=_0xde00[_0x1a5ad1];return _0x7b8b22;};'use strict';var _=require(_0x0de0('0x0'));var util=require(_0x0de0('0x1'));var moment=require(_0x0de0('0x2'));var BPromise=require(_0x0de0('0x3'));var rs=require(_0x0de0('0x4'));var fs=require('fs');var Redis=require(_0x0de0('0x5'));var db=require(_0x0de0('0x6'))['db'];var utils=require(_0x0de0('0x7'));var logger=require(_0x0de0('0x8'))(_0x0de0('0x9'));var config=require(_0x0de0('0xa'));var jayson=require(_0x0de0('0xb'));var client=jayson[_0x0de0('0xc')][_0x0de0('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x3a3168,_0x327437,_0x598a3b){return new BPromise(function(_0x5992f1,_0x3f1aef){return client[_0x0de0('0xe')](_0x3a3168,_0x598a3b)[_0x0de0('0xf')](function(_0xf20639){logger[_0x0de0('0x10')](_0x0de0('0x11'),_0x327437,'request\x20sent');logger[_0x0de0('0x12')](_0x0de0('0x13'),_0x327437,_0x0de0('0x14'),JSON[_0x0de0('0x15')](_0xf20639));if(_0xf20639['error']){if(_0xf20639['error'][_0x0de0('0x16')]===0x1f4){logger[_0x0de0('0x17')](_0x0de0('0x11'),_0x327437,_0xf20639['error'][_0x0de0('0x18')]);return _0x3f1aef(_0xf20639[_0x0de0('0x17')][_0x0de0('0x18')]);}logger[_0x0de0('0x17')](_0x0de0('0x11'),_0x327437,_0xf20639['error'][_0x0de0('0x18')]);return _0x5992f1(_0xf20639[_0x0de0('0x17')][_0x0de0('0x18')]);}else{logger[_0x0de0('0x10')](_0x0de0('0x11'),_0x327437,_0x0de0('0x14'));_0x5992f1(_0xf20639[_0x0de0('0x19')][_0x0de0('0x18')]);}})[_0x0de0('0x1a')](function(_0x5db632){logger[_0x0de0('0x17')](_0x0de0('0x11'),_0x327437,_0x5db632);_0x3f1aef(_0x5db632);});});}exports['UpdateMailApplication']=function(_0x3d4cde){var _0x360d95=this;return new Promise(function(_0x6c369b,_0x254adc){return db['MailApplication'][_0x0de0('0x1b')](_0x3d4cde['body'],{'raw':_0x3d4cde['options']?_0x3d4cde[_0x0de0('0x1c')][_0x0de0('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3d4cde[_0x0de0('0x1c')]?_0x3d4cde['options']['where']||null:null,'attributes':_0x3d4cde[_0x0de0('0x1c')]?_0x3d4cde[_0x0de0('0x1c')][_0x0de0('0x1e')]||null:null,'limit':_0x3d4cde[_0x0de0('0x1c')]?_0x3d4cde[_0x0de0('0x1c')]['limit']||null:null})[_0x0de0('0xf')](function(_0xb52934){logger['info'](_0x0de0('0x1f'),_0x3d4cde);logger[_0x0de0('0x12')]('UpdateMailApplication',_0x3d4cde,JSON[_0x0de0('0x15')](_0xb52934));_0x6c369b(_0xb52934);})['catch'](function(_0x529183){logger['error'](_0x0de0('0x1f'),_0x529183[_0x0de0('0x18')],_0x3d4cde);_0x254adc(_0x360d95['error'](0x1f4,_0x529183['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index f70188c..a4ad1fa 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 _0x0dc0=['delete','mailinteraction:destroy','destroy','removeTags','Router','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/messages','getMessages','/:id/download','post','create','addMessage','/:id/tags','tracked','mail','mailinteraction:addtags','put','mailinteraction:update'];(function(_0x32c012,_0xe3c576){var _0x48562e=function(_0x505228){while(--_0x505228){_0x32c012['push'](_0x32c012['shift']());}};_0x48562e(++_0xe3c576);}(_0x0dc0,0xfe));var _0x00dc=function(_0xfa716b,_0x1fa236){_0xfa716b=_0xfa716b-0x0;var _0xe946ab=_0x0dc0[_0xfa716b];return _0xe946ab;};'use strict';var express=require('express');var router=express[_0x00dc('0x0')]();var auth=require('../../components/auth/service');var interaction=require(_0x00dc('0x1'));var controller=require(_0x00dc('0x2'));router[_0x00dc('0x3')]('/',auth[_0x00dc('0x4')](),controller[_0x00dc('0x5')]);router[_0x00dc('0x3')](_0x00dc('0x6'),auth['isAuthenticated'](),controller[_0x00dc('0x7')]);router['get'](_0x00dc('0x8'),auth['isAuthenticated'](),controller['show']);router[_0x00dc('0x3')](_0x00dc('0x9'),auth[_0x00dc('0x4')](),controller[_0x00dc('0xa')]);router[_0x00dc('0x3')](_0x00dc('0xb'),auth['isAuthenticated'](),controller['download']);router[_0x00dc('0xc')]('/',auth[_0x00dc('0x4')](),controller[_0x00dc('0xd')]);router[_0x00dc('0xc')](_0x00dc('0x9'),auth['isAuthenticated'](),controller[_0x00dc('0xe')]);router['post'](_0x00dc('0xf'),auth[_0x00dc('0x4')](),interaction[_0x00dc('0x10')](_0x00dc('0x11'),_0x00dc('0x12')),controller['addTags']);router[_0x00dc('0x13')](_0x00dc('0x8'),auth[_0x00dc('0x4')](),interaction[_0x00dc('0x10')]('mail',_0x00dc('0x14')),controller['update']);router[_0x00dc('0x15')](_0x00dc('0x8'),auth[_0x00dc('0x4')](),interaction[_0x00dc('0x10')](_0x00dc('0x11'),_0x00dc('0x16')),controller[_0x00dc('0x17')]);router[_0x00dc('0x15')](_0x00dc('0xf'),auth[_0x00dc('0x4')](),controller[_0x00dc('0x18')]);module['exports']=router; \ No newline at end of file +var _0xf7d4=['addTags','put','tracked','mailinteraction:update','update','mailinteraction:destroy','destroy','delete','removeTags','exports','express','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','/describe','describe','/:id','show','getMessages','/:id/download','download','create','post','/:id/messages','addMessage','/:id/tags','mail'];(function(_0x2ca9d4,_0x51d5c6){var _0x258956=function(_0x47a0e5){while(--_0x47a0e5){_0x2ca9d4['push'](_0x2ca9d4['shift']());}};_0x258956(++_0x51d5c6);}(_0xf7d4,0x13e));var _0x4f7d=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xf7d4[_0x42cae2];return _0x5f256f;};'use strict';var express=require(_0x4f7d('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x4f7d('0x1'));var controller=require(_0x4f7d('0x2'));router[_0x4f7d('0x3')]('/',auth[_0x4f7d('0x4')](),controller['index']);router[_0x4f7d('0x3')](_0x4f7d('0x5'),auth[_0x4f7d('0x4')](),controller[_0x4f7d('0x6')]);router['get'](_0x4f7d('0x7'),auth['isAuthenticated'](),controller[_0x4f7d('0x8')]);router[_0x4f7d('0x3')]('/:id/messages',auth[_0x4f7d('0x4')](),controller[_0x4f7d('0x9')]);router['get'](_0x4f7d('0xa'),auth[_0x4f7d('0x4')](),controller[_0x4f7d('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4f7d('0xc')]);router[_0x4f7d('0xd')](_0x4f7d('0xe'),auth[_0x4f7d('0x4')](),controller[_0x4f7d('0xf')]);router[_0x4f7d('0xd')](_0x4f7d('0x10'),auth[_0x4f7d('0x4')](),interaction['tracked'](_0x4f7d('0x11'),'mailinteraction:addtags'),controller[_0x4f7d('0x12')]);router[_0x4f7d('0x13')](_0x4f7d('0x7'),auth[_0x4f7d('0x4')](),interaction[_0x4f7d('0x14')]('mail',_0x4f7d('0x15')),controller[_0x4f7d('0x16')]);router['delete']('/:id',auth['isAuthenticated'](),interaction[_0x4f7d('0x14')](_0x4f7d('0x11'),_0x4f7d('0x17')),controller[_0x4f7d('0x18')]);router[_0x4f7d('0x19')]('/:id/tags',auth[_0x4f7d('0x4')](),controller[_0x4f7d('0x1a')]);module[_0x4f7d('0x1b')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 8714746..7889b55 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 _0x8cdc=['TEXT','ENUM','out','BOOLEAN','sequelize','exports','DATE','STRING'];(function(_0x2db12b,_0x30ab1d){var _0x20990b=function(_0x589477){while(--_0x589477){_0x2db12b['push'](_0x2db12b['shift']());}};_0x20990b(++_0x30ab1d);}(_0x8cdc,0x1ec));var _0xc8cd=function(_0x80795e,_0x587d29){_0x80795e=_0x80795e-0x0;var _0xa750f5=_0x8cdc[_0x80795e];return _0xa750f5;};'use strict';var Sequelize=require(_0xc8cd('0x0'));var iconv=require('iconv');module[_0xc8cd('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xc8cd('0x2')]},'disposition':{'type':Sequelize[_0xc8cd('0x3')]},'secondDisposition':{'type':Sequelize[_0xc8cd('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xc8cd('0x3')]},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xc8cd('0x4')]('long')},'subject':{'type':Sequelize[_0xc8cd('0x4')]()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xc8cd('0x2')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0xc8cd('0x2')]},'firstMsgDirection':{'type':Sequelize[_0xc8cd('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xc8cd('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xc8cd('0x5')]('in',_0xc8cd('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xc8cd('0x7')],'defaultValue':![]}}; \ No newline at end of file +var _0x671b=['sequelize','iconv','exports','BOOLEAN','DATE','STRING','long','TEXT','out','ENUM'];(function(_0x5d8076,_0x2b476a){var _0x26811a=function(_0x434cbf){while(--_0x434cbf){_0x5d8076['push'](_0x5d8076['shift']());}};_0x26811a(++_0x2b476a);}(_0x671b,0x1e0));var _0xb671=function(_0x84293f,_0x1b4173){_0x84293f=_0x84293f-0x0;var _0x15a611=_0x671b[_0x84293f];return _0x15a611;};'use strict';var Sequelize=require(_0xb671('0x0'));var iconv=require(_0xb671('0x1'));module[_0xb671('0x2')]={'closed':{'type':Sequelize[_0xb671('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xb671('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xb671('0x5')]},'thirdDisposition':{'type':Sequelize[_0xb671('0x5')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0xb671('0x5')](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize['TEXT'](_0xb671('0x6'))},'subject':{'type':Sequelize[_0xb671('0x7')]()},'attach':{'type':Sequelize[_0xb671('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize[_0xb671('0x5')](0x3c)},'substatusAt':{'type':Sequelize[_0xb671('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xb671('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xb671('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xb671('0x9')]('in',_0xb671('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xb671('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 74bc426..bdaea7e 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 _0xe9b9=['../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','status','json','undefined','count','offset','limit','set','Content-Range','update','then','destroy','end','sendStatus','error','stack','name','send','index','rawAttributes','fieldName','key','getOptions','findAll','mail','user','catch','params','model','keys','MailInteraction','query','filters','intersection','attributes','fields','length','include','find','create','body','describe','addMessage','ids','omit','getMessages','findOne','MailMessage','hasOwnProperty','nolimit','order','sort','where','MailInteractionId','filter','merge','$gte','split','YYYY-MM-DD\x20HH:mm:ss','options','includeAll','inlineCss','true','rows','addTags','spread','Tag','emit','removeTags','unix','toString','join','root','files','tmp','server','attachments','push','Attachment','Attachments','subject','createdAt','Messages','get','each','format','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','basename','existsSync','writeFileSync','message%d.eml','download','unlinkSync','eml-format','rimraf','zip-dir','moment','bluebird','util','path','juice','../../components/parsers/qs','../../config/logger'];(function(_0x3c8733,_0x3438fc){var _0x476f30=function(_0x5812a7){while(--_0x5812a7){_0x3c8733['push'](_0x3c8733['shift']());}};_0x476f30(++_0x3438fc);}(_0xe9b9,0xd4));var _0x9e9b=function(_0x3e754a,_0x6d4db5){_0x3e754a=_0x3e754a-0x0;var _0x12325b=_0xe9b9[_0x3e754a];return _0x12325b;};'use strict';var emlformat=require(_0x9e9b('0x0'));var rimraf=require(_0x9e9b('0x1'));var zipdir=require(_0x9e9b('0x2'));var moment=require(_0x9e9b('0x3'));var BPromise=require(_0x9e9b('0x4'));var util=require(_0x9e9b('0x5'));var path=require(_0x9e9b('0x6'));var fs=require('fs');var _=require('lodash');var juice=require(_0x9e9b('0x7'));var Redis=require('ioredis');var interaction=require('../../components/interaction/service');var qs=require(_0x9e9b('0x8'));var logger=require(_0x9e9b('0x9'))('api');var config=require('../../config/environment');var db=require(_0x9e9b('0xa'))['db'];var htmlEntities=require('html-entities');config[_0x9e9b('0xb')]=_[_0x9e9b('0xc')](config['redis'],{'host':_0x9e9b('0xd'),'port':0x18eb});var socket=require(_0x9e9b('0xe'))(new Redis(config[_0x9e9b('0xb')]));require(_0x9e9b('0xf'))['register'](socket);function respondWithStatusCode(_0x54e13f,_0x46fa6e){_0x46fa6e=_0x46fa6e||0xcc;return function(_0x437bc1){if(_0x437bc1){return _0x54e13f['sendStatus'](_0x46fa6e);}return _0x54e13f[_0x9e9b('0x10')](_0x46fa6e)['end']();};}function respondWithResult(_0x357259,_0x5d7faa){_0x5d7faa=_0x5d7faa||0xc8;return function(_0x5a43ba){if(_0x5a43ba){return _0x357259[_0x9e9b('0x10')](_0x5d7faa)[_0x9e9b('0x11')](_0x5a43ba);}};}function respondWithFilteredResult(_0x20df67,_0x79b14c){return function(_0x28f91b){if(_0x28f91b){var _0x3b5b11=typeof _0x79b14c['offset']===_0x9e9b('0x12')&&typeof _0x79b14c['limit']==='undefined';var _0x3b4273=_0x28f91b[_0x9e9b('0x13')];var _0x429b61=_0x3b5b11?0x0:_0x79b14c[_0x9e9b('0x14')];var _0x3a0f10=_0x3b5b11?_0x28f91b[_0x9e9b('0x13')]:_0x79b14c[_0x9e9b('0x14')]+_0x79b14c[_0x9e9b('0x15')];var _0x35b933;if(_0x3a0f10>=_0x3b4273){_0x3a0f10=_0x3b4273;_0x35b933=0xc8;}else{_0x35b933=0xce;}_0x20df67[_0x9e9b('0x10')](_0x35b933);return _0x20df67[_0x9e9b('0x16')](_0x9e9b('0x17'),_0x429b61+'-'+_0x3a0f10+'/'+_0x3b4273)['json'](_0x28f91b);}return null;};}function saveUpdates(_0xaaebc1){return function(_0x5a0f38){if(_0x5a0f38){return _0x5a0f38[_0x9e9b('0x18')](_0xaaebc1)[_0x9e9b('0x19')](function(_0x7d58a){return _0x7d58a;});}return null;};}function removeEntity(_0x11ea58){return function(_0x5b27b9){if(_0x5b27b9){return _0x5b27b9[_0x9e9b('0x1a')]()['then'](function(){_0x11ea58[_0x9e9b('0x10')](0xcc)[_0x9e9b('0x1b')]();});}};}function handleEntityNotFound(_0x3f09ca){return function(_0x2c77cd){if(!_0x2c77cd){_0x3f09ca[_0x9e9b('0x1c')](0x194);}return _0x2c77cd;};}function handleError(_0x39704c,_0x56be5f){_0x56be5f=_0x56be5f||0x1f4;return function(_0xc7b149){logger[_0x9e9b('0x1d')](_0xc7b149[_0x9e9b('0x1e')]);if(_0xc7b149[_0x9e9b('0x1f')]){delete _0xc7b149[_0x9e9b('0x1f')];}_0x39704c['status'](_0x56be5f)[_0x9e9b('0x20')](_0xc7b149);};}exports[_0x9e9b('0x21')]=function(_0x553969,_0x2f3356){var _0x40fabc={};var _0x124633=_['map'](db['MailInteraction'][_0x9e9b('0x22')],function(_0x52e4e9){return{'name':_0x52e4e9[_0x9e9b('0x23')],'type':_0x52e4e9['type'][_0x9e9b('0x24')]};});_0x40fabc=qs[_0x9e9b('0x25')](_0x124633,_0x553969);return interaction[_0x9e9b('0x26')](_0x9e9b('0x27'),_0x553969['query'],_0x553969[_0x9e9b('0x28')],_0x40fabc,_0x124633)[_0x9e9b('0x19')](respondWithFilteredResult(_0x2f3356,_0x40fabc))[_0x9e9b('0x29')](handleError(_0x2f3356,null));};exports['show']=function(_0x4f5efc,_0x4b0556){var _0x115e9e={'raw':![],'where':{'id':_0x4f5efc[_0x9e9b('0x2a')]['id']}},_0x2c4f6f={};_0x2c4f6f[_0x9e9b('0x2b')]=_[_0x9e9b('0x2c')](db[_0x9e9b('0x2d')][_0x9e9b('0x22')]);_0x2c4f6f[_0x9e9b('0x2e')]=_[_0x9e9b('0x2c')](_0x4f5efc['query']);_0x2c4f6f[_0x9e9b('0x2f')]=_[_0x9e9b('0x30')](_0x2c4f6f[_0x9e9b('0x2b')],_0x2c4f6f[_0x9e9b('0x2e')]);_0x115e9e[_0x9e9b('0x31')]=_[_0x9e9b('0x30')](_0x2c4f6f['model'],qs[_0x9e9b('0x32')](_0x4f5efc[_0x9e9b('0x2e')][_0x9e9b('0x32')]));_0x115e9e['attributes']=_0x115e9e[_0x9e9b('0x31')][_0x9e9b('0x33')]?_0x115e9e[_0x9e9b('0x31')]:_0x2c4f6f['model'];if(_0x4f5efc['query']['includeAll']){_0x115e9e[_0x9e9b('0x34')]=[{'all':!![]}];}_0x115e9e=_['merge']({},_0x115e9e,_0x4f5efc['options']);return db['MailInteraction'][_0x9e9b('0x35')](_0x115e9e)[_0x9e9b('0x19')](handleEntityNotFound(_0x4b0556,null))[_0x9e9b('0x19')](respondWithResult(_0x4b0556,null))[_0x9e9b('0x29')](handleError(_0x4b0556,null));};exports[_0x9e9b('0x36')]=function(_0x4bdfa4,_0x727c66){return db[_0x9e9b('0x2d')][_0x9e9b('0x36')](_0x4bdfa4[_0x9e9b('0x37')],{})[_0x9e9b('0x19')](respondWithResult(_0x727c66,0xc9))['catch'](handleError(_0x727c66,null));};exports['update']=function(_0x597e74,_0x2b50cf){if(_0x597e74['body']['id']){delete _0x597e74[_0x9e9b('0x37')]['id'];}return db[_0x9e9b('0x2d')]['find']({'where':{'id':_0x597e74['params']['id']}})[_0x9e9b('0x19')](handleEntityNotFound(_0x2b50cf,null))['then'](saveUpdates(_0x597e74[_0x9e9b('0x37')],null))[_0x9e9b('0x19')](respondWithResult(_0x2b50cf,null))[_0x9e9b('0x29')](handleError(_0x2b50cf,null));};exports[_0x9e9b('0x1a')]=function(_0xfb98eb,_0xa8ffd0){return db[_0x9e9b('0x2d')][_0x9e9b('0x35')]({'where':{'id':_0xfb98eb[_0x9e9b('0x2a')]['id']}})[_0x9e9b('0x19')](handleEntityNotFound(_0xa8ffd0,null))[_0x9e9b('0x19')](removeEntity(_0xa8ffd0,null))[_0x9e9b('0x29')](handleError(_0xa8ffd0,null));};exports[_0x9e9b('0x38')]=function(_0x56539a,_0x8f1b4d){return db[_0x9e9b('0x2d')][_0x9e9b('0x38')]()[_0x9e9b('0x19')](respondWithResult(_0x8f1b4d,null))[_0x9e9b('0x29')](handleError(_0x8f1b4d,null));};exports[_0x9e9b('0x39')]=function(_0x68235e,_0x2d03b5){return db['MailMessage'][_0x9e9b('0x35')]({'where':{'id':_0x68235e[_0x9e9b('0x2a')]['id']}})[_0x9e9b('0x19')](handleEntityNotFound(_0x2d03b5,null))['then'](function(_0x519af6){if(_0x519af6){return _0x519af6['addMessage'](_0x68235e[_0x9e9b('0x37')][_0x9e9b('0x3a')],_[_0x9e9b('0x3b')](_0x68235e[_0x9e9b('0x37')],[_0x9e9b('0x3a'),'id'])||{});}})[_0x9e9b('0x19')](respondWithResult(_0x2d03b5,null))[_0x9e9b('0x29')](handleError(_0x2d03b5,null));};exports[_0x9e9b('0x3c')]=function(_0x2e8fdf,_0x8b4b17){var _0xb13916={'raw':![],'where':{}};var _0x5ace90={};var _0x42d1b7={'count':0x0,'rows':[]};return db['MailInteraction'][_0x9e9b('0x3d')]({'where':{'id':_0x2e8fdf[_0x9e9b('0x2a')]['id']}})[_0x9e9b('0x19')](handleEntityNotFound(_0x8b4b17,null))[_0x9e9b('0x19')](function(_0x4c1f40){if(_0x4c1f40){_0x5ace90[_0x9e9b('0x2b')]=_[_0x9e9b('0x2c')](db[_0x9e9b('0x3e')]['rawAttributes']);_0x5ace90[_0x9e9b('0x2e')]=_[_0x9e9b('0x2c')](_0x2e8fdf[_0x9e9b('0x2e')]);_0x5ace90['filters']=_[_0x9e9b('0x30')](_0x5ace90[_0x9e9b('0x2b')],_0x5ace90[_0x9e9b('0x2e')]);_0xb13916[_0x9e9b('0x31')]=_[_0x9e9b('0x30')](_0x5ace90['model'],qs[_0x9e9b('0x32')](_0x2e8fdf['query'][_0x9e9b('0x32')]));_0xb13916[_0x9e9b('0x31')]=_0xb13916['attributes'][_0x9e9b('0x33')]?_0xb13916[_0x9e9b('0x31')]:_0x5ace90[_0x9e9b('0x2b')];if(!_0x2e8fdf[_0x9e9b('0x2e')][_0x9e9b('0x3f')](_0x9e9b('0x40'))){_0xb13916[_0x9e9b('0x15')]=qs[_0x9e9b('0x15')](_0x2e8fdf[_0x9e9b('0x2e')]['limit']);_0xb13916[_0x9e9b('0x14')]=qs[_0x9e9b('0x14')](_0x2e8fdf[_0x9e9b('0x2e')][_0x9e9b('0x14')]);}_0xb13916[_0x9e9b('0x41')]=qs[_0x9e9b('0x42')](_0x2e8fdf[_0x9e9b('0x2e')][_0x9e9b('0x42')]);_0xb13916['where']=qs['filters'](_['pick'](_0x2e8fdf[_0x9e9b('0x2e')],_0x5ace90[_0x9e9b('0x2f')]));_0xb13916[_0x9e9b('0x43')][_0x9e9b('0x44')]=_0x4c1f40['id'];if(_0x2e8fdf[_0x9e9b('0x2e')][_0x9e9b('0x45')]){_0xb13916[_0x9e9b('0x43')]=_[_0x9e9b('0x46')](_0xb13916[_0x9e9b('0x43')],{'$or':_['map'](_0xb13916[_0x9e9b('0x31')],function(_0x52566b){var _0x1fcc2b={};_0x1fcc2b[_0x52566b]={'$like':'%'+_0x2e8fdf[_0x9e9b('0x2e')][_0x9e9b('0x45')]+'%'};return _0x1fcc2b;})});}if(_0x2e8fdf[_0x9e9b('0x2e')][_0x9e9b('0x47')]){var _0x5894c1=_0x2e8fdf['query']['$gte'][_0x9e9b('0x48')](',');var _0x4063f1={};_0x4063f1[_0x5894c1[0x0]]={'$gte':moment(_0x5894c1[0x1])['format'](_0x9e9b('0x49'))};_0xb13916[_0x9e9b('0x43')]=_[_0x9e9b('0x46')](_0xb13916[_0x9e9b('0x43')],_0x4063f1);}_0xb13916=_[_0x9e9b('0x46')]({},_0xb13916,_0x2e8fdf[_0x9e9b('0x4a')]);return db['MailMessage'][_0x9e9b('0x13')]({'where':_0xb13916[_0x9e9b('0x43')]})[_0x9e9b('0x19')](function(_0x291db3){_0x42d1b7[_0x9e9b('0x13')]=_0x291db3;if(_0x2e8fdf[_0x9e9b('0x2e')][_0x9e9b('0x4b')]){_0xb13916[_0x9e9b('0x34')]=[{'all':!![]}];}return db[_0x9e9b('0x3e')][_0x9e9b('0x26')](_0xb13916);})[_0x9e9b('0x19')](function(_0xb29cf6){if(_0x2e8fdf[_0x9e9b('0x2e')][_0x9e9b('0x4c')]===_0x9e9b('0x4d')){for(var _0x578320=0x0;_0x578320<_0xb29cf6[_0x9e9b('0x33')];_0x578320++){_0xb29cf6[_0x578320][_0x9e9b('0x37')]=juice(_0xb29cf6[_0x578320][_0x9e9b('0x37')]);}}_0x42d1b7[_0x9e9b('0x4e')]=_0xb29cf6;return _0x42d1b7;});}})[_0x9e9b('0x19')](respondWithFilteredResult(_0x8b4b17,_0xb13916))['catch'](handleError(_0x8b4b17,null));};exports[_0x9e9b('0x4f')]=function(_0x20aab5,_0xe58f5c){return db[_0x9e9b('0x2d')]['find']({'where':{'id':_0x20aab5[_0x9e9b('0x2a')]['id']}})[_0x9e9b('0x19')](handleEntityNotFound(_0xe58f5c,null))['then'](function(_0x165f81){if(_0x165f81){return _0x165f81['setTags'](_0x20aab5[_0x9e9b('0x37')][_0x9e9b('0x3a')],_[_0x9e9b('0x3b')](_0x20aab5[_0x9e9b('0x37')],[_0x9e9b('0x3a'),'id'])||{})[_0x9e9b('0x50')](function(){return db[_0x9e9b('0x51')][_0x9e9b('0x26')]({'attributes':['id',_0x9e9b('0x1f'),'color'],'where':{'id':_0x20aab5[_0x9e9b('0x37')][_0x9e9b('0x3a')]}});})[_0x9e9b('0x19')](function(_0xe318f){socket[_0x9e9b('0x52')]('mailInteractionTags:save',{'id':Number(_0x20aab5[_0x9e9b('0x2a')]['id']),'tags':_0xe318f||[]});return{'id':Number(_0x20aab5[_0x9e9b('0x2a')]['id']),'tags':_0xe318f||[]};});}})['then'](respondWithResult(_0xe58f5c,null))['catch'](handleError(_0xe58f5c,null));};exports[_0x9e9b('0x53')]=function(_0x25fac8,_0x4cb23c){return db[_0x9e9b('0x2d')][_0x9e9b('0x35')]({'where':{'id':_0x25fac8['params']['id']}})[_0x9e9b('0x19')](handleEntityNotFound(_0x4cb23c,null))[_0x9e9b('0x19')](function(_0x1fa32b){if(_0x1fa32b){return _0x1fa32b[_0x9e9b('0x53')](_0x25fac8[_0x9e9b('0x2e')]['ids']);}})[_0x9e9b('0x19')](respondWithStatusCode(_0x4cb23c,null))['catch'](handleError(_0x4cb23c,null));};exports['download']=function(_0x3f4f92,_0x17ff59){var _0x12bdf6=moment()[_0x9e9b('0x54')]()[_0x9e9b('0x55')]();var _0x34047d=path[_0x9e9b('0x56')](config[_0x9e9b('0x57')],'server',_0x9e9b('0x58'),_0x9e9b('0x59'));var _0x541ff6=path[_0x9e9b('0x56')](config[_0x9e9b('0x57')],_0x9e9b('0x5a'),_0x9e9b('0x58'),_0x9e9b('0x5b'));var _0x40a464=path['join'](_0x34047d,_0x12bdf6);var _0x304f61=util['format']('transcript-%d-%s.zip',_0x3f4f92['params']['id'],_0x12bdf6);var _0x1d7a72=path[_0x9e9b('0x56')](_0x34047d,_0x304f61);var _0x23c591=[];if(_0x3f4f92[_0x9e9b('0x2e')][_0x9e9b('0x5b')]){_0x23c591[_0x9e9b('0x5c')]({'model':db[_0x9e9b('0x5d')],'as':_0x9e9b('0x5e'),'raw':!![]});}var _0x39b05c=[{'model':db[_0x9e9b('0x3e')],'as':'Messages','attributes':['id',_0x9e9b('0x37'),'from','to','cc','bcc',_0x9e9b('0x5f'),_0x9e9b('0x60')],'where':{'secret':![]},'order':qs[_0x9e9b('0x42')]('id'),'include':_0x23c591}];return db[_0x9e9b('0x2d')][_0x9e9b('0x35')]({'where':{'id':_0x3f4f92[_0x9e9b('0x2a')]['id']},'include':_0x39b05c})['then'](handleEntityNotFound(_0x17ff59,null))['then'](function(_0xefa082){if(_0xefa082&&_0xefa082[_0x9e9b('0x61')]){var _0x293779=_0xefa082[_0x9e9b('0x62')]({'plain':!![]});fs['mkdirSync'](_0x40a464);return BPromise[_0x9e9b('0x63')](_0x293779[_0x9e9b('0x61')],function(_0x47a4a9,_0x5100e9){var _0x971366={'from':_0x47a4a9['from'],'to':_0x47a4a9['to'],'subject':_0x47a4a9['subject'],'html':htmlEntities['decode'](_0x47a4a9[_0x9e9b('0x37')]),'headers':{'Date':moment(_0x47a4a9[_0x9e9b('0x60')])[_0x9e9b('0x64')](_0x9e9b('0x65'))},'attachments':[]};if(_0x47a4a9['cc']){_0x971366[_0x9e9b('0x66')]['Cc']=_0x47a4a9['cc'];}if(_0x47a4a9[_0x9e9b('0x67')]){_0x971366[_0x9e9b('0x66')][_0x9e9b('0x68')]=_0x47a4a9[_0x9e9b('0x67')];}return new BPromise(function(_0x452e56,_0x31b203){if(_0x47a4a9[_0x9e9b('0x5e')]){for(var _0x30acbe=0x0;_0x30acbe<_0x47a4a9[_0x9e9b('0x5e')]['length'];_0x30acbe++){var _0x16e815=_0x47a4a9[_0x9e9b('0x5e')][_0x30acbe];var _0x423d78=path[_0x9e9b('0x56')](_0x541ff6,_0x16e815[_0x9e9b('0x69')]);if(fs[_0x9e9b('0x6a')](_0x423d78)){_0x971366[_0x9e9b('0x5b')][_0x9e9b('0x5c')]({'name':_0x16e815[_0x9e9b('0x1f')],'contentType':_0x16e815['type'],'data':fs['readFileSync'](_0x423d78)});}}}emlformat['build'](_0x971366,function(_0x4cdc34,_0x197aa4){if(_0x4cdc34)return _0x31b203(_0x4cdc34);fs[_0x9e9b('0x6b')](path[_0x9e9b('0x56')](_0x40a464,util['format'](_0x9e9b('0x6c'),_0x5100e9)),_0x197aa4);return _0x452e56(_0x197aa4);});});})[_0x9e9b('0x19')](function(){return new BPromise(function(_0x5cc2a2,_0x365a3c){zipdir(_0x40a464,{'saveTo':_0x1d7a72},function(_0x37bacd,_0x2708a1){if(_0x37bacd)return _0x365a3c(_0x37bacd);return _0x5cc2a2(_0x2708a1);});})['then'](function(){return new BPromise(function(_0x540c42,_0x4922d8){rimraf(_0x40a464,function(_0x467e9c){if(_0x467e9c)_0x4922d8(_0x467e9c);return _0x540c42();});});})[_0x9e9b('0x19')](function(){return _0x17ff59[_0x9e9b('0x6d')](_0x1d7a72,_0x304f61,function(_0x32d111){if(!_0x32d111)fs[_0x9e9b('0x6e')](_0x1d7a72);});});});}else{return _0x17ff59[_0x9e9b('0x1c')](0xc8);}})[_0x9e9b('0x29')](handleError(_0x17ff59,null));}; \ No newline at end of file +var _0x653d=['findAll','query','user','show','params','keys','rawAttributes','filters','model','attributes','intersection','fields','length','includeAll','include','merge','options','find','catch','create','body','describe','addMessage','ids','findOne','MailMessage','hasOwnProperty','nolimit','order','sort','filter','where','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','count','inlineCss','true','rows','addTags','setTags','spread','color','emit','mailInteractionTags:save','download','unix','join','server','files','tmp','root','attachments','transcript-%d-%s.zip','push','Attachment','Attachments','Messages','bcc','subject','createdAt','get','mkdirSync','each','from','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','existsSync','readFileSync','build','message%d.eml','unlinkSync','rimraf','zip-dir','moment','bluebird','util','path','lodash','juice','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','localhost','./mailInteraction.socket','register','sendStatus','status','end','offset','undefined','limit','set','Content-Range','json','update','then','destroy','error','stack','name','send','index','map','MailInteraction','fieldName','type','key','getOptions'];(function(_0x251b02,_0x38c0f7){var _0x14017c=function(_0x7a976a){while(--_0x7a976a){_0x251b02['push'](_0x251b02['shift']());}};_0x14017c(++_0x38c0f7);}(_0x653d,0x133));var _0xd653=function(_0x4fcfbe,_0x107dc6){_0x4fcfbe=_0x4fcfbe-0x0;var _0x50b203=_0x653d[_0x4fcfbe];return _0x50b203;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd653('0x0'));var zipdir=require(_0xd653('0x1'));var moment=require(_0xd653('0x2'));var BPromise=require(_0xd653('0x3'));var util=require(_0xd653('0x4'));var path=require(_0xd653('0x5'));var fs=require('fs');var _=require(_0xd653('0x6'));var juice=require(_0xd653('0x7'));var Redis=require(_0xd653('0x8'));var interaction=require(_0xd653('0x9'));var qs=require(_0xd653('0xa'));var logger=require(_0xd653('0xb'))(_0xd653('0xc'));var config=require(_0xd653('0xd'));var db=require('../../mysqldb')['db'];var htmlEntities=require('html-entities');config[_0xd653('0xe')]=_['defaults'](config[_0xd653('0xe')],{'host':_0xd653('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd653('0xe')]));require(_0xd653('0x10'))[_0xd653('0x11')](socket);function respondWithStatusCode(_0x4d2507,_0x2b4cad){_0x2b4cad=_0x2b4cad||0xcc;return function(_0x502401){if(_0x502401){return _0x4d2507[_0xd653('0x12')](_0x2b4cad);}return _0x4d2507[_0xd653('0x13')](_0x2b4cad)[_0xd653('0x14')]();};}function respondWithResult(_0xe293b7,_0x45eb44){_0x45eb44=_0x45eb44||0xc8;return function(_0x278ef3){if(_0x278ef3){return _0xe293b7[_0xd653('0x13')](_0x45eb44)['json'](_0x278ef3);}};}function respondWithFilteredResult(_0x47c1b4,_0xa0bcfd){return function(_0x17506b){if(_0x17506b){var _0x1324e4=typeof _0xa0bcfd[_0xd653('0x15')]===_0xd653('0x16')&&typeof _0xa0bcfd[_0xd653('0x17')]==='undefined';var _0x5593c4=_0x17506b['count'];var _0x90b2e0=_0x1324e4?0x0:_0xa0bcfd[_0xd653('0x15')];var _0x2a88bd=_0x1324e4?_0x17506b['count']:_0xa0bcfd[_0xd653('0x15')]+_0xa0bcfd[_0xd653('0x17')];var _0x84afbc;if(_0x2a88bd>=_0x5593c4){_0x2a88bd=_0x5593c4;_0x84afbc=0xc8;}else{_0x84afbc=0xce;}_0x47c1b4[_0xd653('0x13')](_0x84afbc);return _0x47c1b4[_0xd653('0x18')](_0xd653('0x19'),_0x90b2e0+'-'+_0x2a88bd+'/'+_0x5593c4)[_0xd653('0x1a')](_0x17506b);}return null;};}function saveUpdates(_0xc668b1){return function(_0x52aa44){if(_0x52aa44){return _0x52aa44[_0xd653('0x1b')](_0xc668b1)[_0xd653('0x1c')](function(_0x107ab9){return _0x107ab9;});}return null;};}function removeEntity(_0x5a7ae3){return function(_0x448110){if(_0x448110){return _0x448110[_0xd653('0x1d')]()[_0xd653('0x1c')](function(){_0x5a7ae3[_0xd653('0x13')](0xcc)[_0xd653('0x14')]();});}};}function handleEntityNotFound(_0x252514){return function(_0x4354fe){if(!_0x4354fe){_0x252514['sendStatus'](0x194);}return _0x4354fe;};}function handleError(_0x20bd13,_0x36b03b){_0x36b03b=_0x36b03b||0x1f4;return function(_0x3b413f){logger[_0xd653('0x1e')](_0x3b413f[_0xd653('0x1f')]);if(_0x3b413f[_0xd653('0x20')]){delete _0x3b413f[_0xd653('0x20')];}_0x20bd13[_0xd653('0x13')](_0x36b03b)[_0xd653('0x21')](_0x3b413f);};}exports[_0xd653('0x22')]=function(_0x211c1b,_0x59c9dc){var _0x335b03={};var _0x595707=_[_0xd653('0x23')](db[_0xd653('0x24')]['rawAttributes'],function(_0x5eef12){return{'name':_0x5eef12[_0xd653('0x25')],'type':_0x5eef12[_0xd653('0x26')][_0xd653('0x27')]};});_0x335b03=qs[_0xd653('0x28')](_0x595707,_0x211c1b);return interaction[_0xd653('0x29')]('mail',_0x211c1b[_0xd653('0x2a')],_0x211c1b[_0xd653('0x2b')],_0x335b03,_0x595707)[_0xd653('0x1c')](respondWithFilteredResult(_0x59c9dc,_0x335b03))['catch'](handleError(_0x59c9dc,null));};exports[_0xd653('0x2c')]=function(_0x3deeef,_0x59eb90){var _0xc3246e={'raw':![],'where':{'id':_0x3deeef[_0xd653('0x2d')]['id']}},_0x929e31={};_0x929e31['model']=_[_0xd653('0x2e')](db['MailInteraction'][_0xd653('0x2f')]);_0x929e31[_0xd653('0x2a')]=_[_0xd653('0x2e')](_0x3deeef[_0xd653('0x2a')]);_0x929e31[_0xd653('0x30')]=_['intersection'](_0x929e31[_0xd653('0x31')],_0x929e31[_0xd653('0x2a')]);_0xc3246e[_0xd653('0x32')]=_[_0xd653('0x33')](_0x929e31[_0xd653('0x31')],qs[_0xd653('0x34')](_0x3deeef[_0xd653('0x2a')][_0xd653('0x34')]));_0xc3246e[_0xd653('0x32')]=_0xc3246e[_0xd653('0x32')][_0xd653('0x35')]?_0xc3246e['attributes']:_0x929e31[_0xd653('0x31')];if(_0x3deeef[_0xd653('0x2a')][_0xd653('0x36')]){_0xc3246e[_0xd653('0x37')]=[{'all':!![]}];}_0xc3246e=_[_0xd653('0x38')]({},_0xc3246e,_0x3deeef[_0xd653('0x39')]);return db[_0xd653('0x24')][_0xd653('0x3a')](_0xc3246e)[_0xd653('0x1c')](handleEntityNotFound(_0x59eb90,null))[_0xd653('0x1c')](respondWithResult(_0x59eb90,null))[_0xd653('0x3b')](handleError(_0x59eb90,null));};exports['create']=function(_0x30bebd,_0x4dd065){return db['MailInteraction'][_0xd653('0x3c')](_0x30bebd[_0xd653('0x3d')],{})[_0xd653('0x1c')](respondWithResult(_0x4dd065,0xc9))[_0xd653('0x3b')](handleError(_0x4dd065,null));};exports[_0xd653('0x1b')]=function(_0x4ab5a4,_0x127eb3){if(_0x4ab5a4['body']['id']){delete _0x4ab5a4[_0xd653('0x3d')]['id'];}return db[_0xd653('0x24')][_0xd653('0x3a')]({'where':{'id':_0x4ab5a4[_0xd653('0x2d')]['id']}})[_0xd653('0x1c')](handleEntityNotFound(_0x127eb3,null))[_0xd653('0x1c')](saveUpdates(_0x4ab5a4[_0xd653('0x3d')],null))[_0xd653('0x1c')](respondWithResult(_0x127eb3,null))[_0xd653('0x3b')](handleError(_0x127eb3,null));};exports[_0xd653('0x1d')]=function(_0x55b14d,_0xa5b51f){return db[_0xd653('0x24')]['find']({'where':{'id':_0x55b14d[_0xd653('0x2d')]['id']}})[_0xd653('0x1c')](handleEntityNotFound(_0xa5b51f,null))[_0xd653('0x1c')](removeEntity(_0xa5b51f,null))[_0xd653('0x3b')](handleError(_0xa5b51f,null));};exports[_0xd653('0x3e')]=function(_0x4acd80,_0x1f85e9){return db[_0xd653('0x24')]['describe']()[_0xd653('0x1c')](respondWithResult(_0x1f85e9,null))[_0xd653('0x3b')](handleError(_0x1f85e9,null));};exports[_0xd653('0x3f')]=function(_0x3fc19a,_0x35cb76){return db['MailMessage'][_0xd653('0x3a')]({'where':{'id':_0x3fc19a['params']['id']}})[_0xd653('0x1c')](handleEntityNotFound(_0x35cb76,null))[_0xd653('0x1c')](function(_0x55926f){if(_0x55926f){return _0x55926f[_0xd653('0x3f')](_0x3fc19a[_0xd653('0x3d')][_0xd653('0x40')],_['omit'](_0x3fc19a[_0xd653('0x3d')],[_0xd653('0x40'),'id'])||{});}})[_0xd653('0x1c')](respondWithResult(_0x35cb76,null))[_0xd653('0x3b')](handleError(_0x35cb76,null));};exports['getMessages']=function(_0x1c14c6,_0x33cb28){var _0x4a3d24={'raw':![],'where':{}};var _0x179996={};var _0x31b44b={'count':0x0,'rows':[]};return db[_0xd653('0x24')][_0xd653('0x41')]({'where':{'id':_0x1c14c6[_0xd653('0x2d')]['id']}})[_0xd653('0x1c')](handleEntityNotFound(_0x33cb28,null))[_0xd653('0x1c')](function(_0xff451b){if(_0xff451b){_0x179996[_0xd653('0x31')]=_['keys'](db[_0xd653('0x42')][_0xd653('0x2f')]);_0x179996['query']=_['keys'](_0x1c14c6[_0xd653('0x2a')]);_0x179996[_0xd653('0x30')]=_['intersection'](_0x179996[_0xd653('0x31')],_0x179996[_0xd653('0x2a')]);_0x4a3d24[_0xd653('0x32')]=_[_0xd653('0x33')](_0x179996[_0xd653('0x31')],qs[_0xd653('0x34')](_0x1c14c6[_0xd653('0x2a')][_0xd653('0x34')]));_0x4a3d24['attributes']=_0x4a3d24[_0xd653('0x32')][_0xd653('0x35')]?_0x4a3d24['attributes']:_0x179996[_0xd653('0x31')];if(!_0x1c14c6[_0xd653('0x2a')][_0xd653('0x43')](_0xd653('0x44'))){_0x4a3d24[_0xd653('0x17')]=qs['limit'](_0x1c14c6[_0xd653('0x2a')][_0xd653('0x17')]);_0x4a3d24[_0xd653('0x15')]=qs[_0xd653('0x15')](_0x1c14c6[_0xd653('0x2a')][_0xd653('0x15')]);}_0x4a3d24[_0xd653('0x45')]=qs[_0xd653('0x46')](_0x1c14c6['query'][_0xd653('0x46')]);_0x4a3d24['where']=qs['filters'](_['pick'](_0x1c14c6['query'],_0x179996[_0xd653('0x30')]));_0x4a3d24['where']['MailInteractionId']=_0xff451b['id'];if(_0x1c14c6[_0xd653('0x2a')][_0xd653('0x47')]){_0x4a3d24[_0xd653('0x48')]=_[_0xd653('0x38')](_0x4a3d24[_0xd653('0x48')],{'$or':_[_0xd653('0x23')](_0x4a3d24['attributes'],function(_0x42ed84){var _0x1b5ff7={};_0x1b5ff7[_0x42ed84]={'$like':'%'+_0x1c14c6[_0xd653('0x2a')]['filter']+'%'};return _0x1b5ff7;})});}if(_0x1c14c6[_0xd653('0x2a')][_0xd653('0x49')]){var _0x471a33=_0x1c14c6['query']['$gte'][_0xd653('0x4a')](',');var _0x5d4c90={};_0x5d4c90[_0x471a33[0x0]]={'$gte':moment(_0x471a33[0x1])[_0xd653('0x4b')](_0xd653('0x4c'))};_0x4a3d24[_0xd653('0x48')]=_['merge'](_0x4a3d24[_0xd653('0x48')],_0x5d4c90);}_0x4a3d24=_[_0xd653('0x38')]({},_0x4a3d24,_0x1c14c6[_0xd653('0x39')]);return db[_0xd653('0x42')]['count']({'where':_0x4a3d24[_0xd653('0x48')]})[_0xd653('0x1c')](function(_0x41a158){_0x31b44b[_0xd653('0x4d')]=_0x41a158;if(_0x1c14c6['query'][_0xd653('0x36')]){_0x4a3d24[_0xd653('0x37')]=[{'all':!![]}];}return db[_0xd653('0x42')]['findAll'](_0x4a3d24);})['then'](function(_0x41a04a){if(_0x1c14c6['query'][_0xd653('0x4e')]===_0xd653('0x4f')){for(var _0x21ae6a=0x0;_0x21ae6a<_0x41a04a[_0xd653('0x35')];_0x21ae6a++){_0x41a04a[_0x21ae6a][_0xd653('0x3d')]=juice(_0x41a04a[_0x21ae6a][_0xd653('0x3d')]);}}_0x31b44b[_0xd653('0x50')]=_0x41a04a;return _0x31b44b;});}})[_0xd653('0x1c')](respondWithFilteredResult(_0x33cb28,_0x4a3d24))[_0xd653('0x3b')](handleError(_0x33cb28,null));};exports[_0xd653('0x51')]=function(_0x305b20,_0x80a8a2){return db['MailInteraction'][_0xd653('0x3a')]({'where':{'id':_0x305b20['params']['id']}})['then'](handleEntityNotFound(_0x80a8a2,null))[_0xd653('0x1c')](function(_0x4d4984){if(_0x4d4984){return _0x4d4984[_0xd653('0x52')](_0x305b20['body'][_0xd653('0x40')],_['omit'](_0x305b20[_0xd653('0x3d')],['ids','id'])||{})[_0xd653('0x53')](function(){return db['Tag'][_0xd653('0x29')]({'attributes':['id',_0xd653('0x20'),_0xd653('0x54')],'where':{'id':_0x305b20[_0xd653('0x3d')][_0xd653('0x40')]}});})[_0xd653('0x1c')](function(_0x41bac8){socket[_0xd653('0x55')](_0xd653('0x56'),{'id':Number(_0x305b20['params']['id']),'tags':_0x41bac8||[]});return{'id':Number(_0x305b20[_0xd653('0x2d')]['id']),'tags':_0x41bac8||[]};});}})[_0xd653('0x1c')](respondWithResult(_0x80a8a2,null))[_0xd653('0x3b')](handleError(_0x80a8a2,null));};exports['removeTags']=function(_0x196cb9,_0xc6c539){return db['MailInteraction'][_0xd653('0x3a')]({'where':{'id':_0x196cb9[_0xd653('0x2d')]['id']}})['then'](handleEntityNotFound(_0xc6c539,null))[_0xd653('0x1c')](function(_0x24da44){if(_0x24da44){return _0x24da44['removeTags'](_0x196cb9['query']['ids']);}})['then'](respondWithStatusCode(_0xc6c539,null))['catch'](handleError(_0xc6c539,null));};exports[_0xd653('0x57')]=function(_0x207b90,_0x33a8f5){var _0x10fca8=moment()[_0xd653('0x58')]()['toString']();var _0x32375d=path[_0xd653('0x59')](config['root'],_0xd653('0x5a'),_0xd653('0x5b'),_0xd653('0x5c'));var _0x315896=path['join'](config[_0xd653('0x5d')],_0xd653('0x5a'),_0xd653('0x5b'),_0xd653('0x5e'));var _0x3d0167=path[_0xd653('0x59')](_0x32375d,_0x10fca8);var _0x44438c=util['format'](_0xd653('0x5f'),_0x207b90['params']['id'],_0x10fca8);var _0x33f63f=path[_0xd653('0x59')](_0x32375d,_0x44438c);var _0x3893bc=[];if(_0x207b90[_0xd653('0x2a')][_0xd653('0x5e')]){_0x3893bc[_0xd653('0x60')]({'model':db[_0xd653('0x61')],'as':_0xd653('0x62'),'raw':!![]});}var _0x5ca03b=[{'model':db[_0xd653('0x42')],'as':_0xd653('0x63'),'attributes':['id',_0xd653('0x3d'),'from','to','cc',_0xd653('0x64'),_0xd653('0x65'),_0xd653('0x66')],'where':{'secret':![]},'order':qs[_0xd653('0x46')]('id'),'include':_0x3893bc}];return db[_0xd653('0x24')][_0xd653('0x3a')]({'where':{'id':_0x207b90['params']['id']},'include':_0x5ca03b})[_0xd653('0x1c')](handleEntityNotFound(_0x33a8f5,null))[_0xd653('0x1c')](function(_0x5c22e6){if(_0x5c22e6&&_0x5c22e6[_0xd653('0x63')]){var _0x5a4fd1=_0x5c22e6[_0xd653('0x67')]({'plain':!![]});fs[_0xd653('0x68')](_0x3d0167);return BPromise[_0xd653('0x69')](_0x5a4fd1[_0xd653('0x63')],function(_0x4a8ddb,_0x938c6f){var _0x2461b7={'from':_0x4a8ddb[_0xd653('0x6a')],'to':_0x4a8ddb['to'],'subject':_0x4a8ddb[_0xd653('0x65')],'html':htmlEntities['decode'](_0x4a8ddb[_0xd653('0x3d')]),'headers':{'Date':moment(_0x4a8ddb[_0xd653('0x66')])['format'](_0xd653('0x6b'))},'attachments':[]};if(_0x4a8ddb['cc']){_0x2461b7[_0xd653('0x6c')]['Cc']=_0x4a8ddb['cc'];}if(_0x4a8ddb['bcc']){_0x2461b7[_0xd653('0x6c')][_0xd653('0x6d')]=_0x4a8ddb['bcc'];}return new BPromise(function(_0x26573b,_0x1a9496){if(_0x4a8ddb[_0xd653('0x62')]){for(var _0x4d25c4=0x0;_0x4d25c4<_0x4a8ddb[_0xd653('0x62')][_0xd653('0x35')];_0x4d25c4++){var _0x21bb51=_0x4a8ddb[_0xd653('0x62')][_0x4d25c4];var _0x33da1d=path[_0xd653('0x59')](_0x315896,_0x21bb51[_0xd653('0x6e')]);if(fs[_0xd653('0x6f')](_0x33da1d)){_0x2461b7['attachments'][_0xd653('0x60')]({'name':_0x21bb51[_0xd653('0x20')],'contentType':_0x21bb51[_0xd653('0x26')],'data':fs[_0xd653('0x70')](_0x33da1d)});}}}emlformat[_0xd653('0x71')](_0x2461b7,function(_0x528217,_0x123de8){if(_0x528217)return _0x1a9496(_0x528217);fs['writeFileSync'](path[_0xd653('0x59')](_0x3d0167,util['format'](_0xd653('0x72'),_0x938c6f)),_0x123de8);return _0x26573b(_0x123de8);});});})[_0xd653('0x1c')](function(){return new BPromise(function(_0x16858d,_0x2b9572){zipdir(_0x3d0167,{'saveTo':_0x33f63f},function(_0x4dc4db,_0x25fb61){if(_0x4dc4db)return _0x2b9572(_0x4dc4db);return _0x16858d(_0x25fb61);});})[_0xd653('0x1c')](function(){return new BPromise(function(_0x134506,_0x4240d9){rimraf(_0x3d0167,function(_0x349919){if(_0x349919)_0x4240d9(_0x349919);return _0x134506();});});})[_0xd653('0x1c')](function(){return _0x33a8f5['download'](_0x33f63f,_0x44438c,function(_0x260fb4){if(!_0x260fb4)fs[_0xd653('0x73')](_0x33f63f);});});});}else{return _0x33a8f5[_0xd653('0x12')](0xc8);}})[_0xd653('0x3b')](handleError(_0x33a8f5,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 8499823..9c6fcdf 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 _0xabbf=['setDataValue','map','findAll','unreadMessages','emit','catch','exports','../../mysqldb','MailMessage','setMaxListeners','save','remove','getUsers'];(function(_0x148e27,_0x36e929){var _0x33f243=function(_0x37bcbc){while(--_0x37bcbc){_0x148e27['push'](_0x148e27['shift']());}};_0x33f243(++_0x36e929);}(_0xabbf,0x173));var _0xfabb=function(_0x2daef6,_0xcac228){_0x2daef6=_0x2daef6-0x0;var _0x62d030=_0xabbf[_0x2daef6];return _0x62d030;};'use strict';var EventEmitter=require('events');var MailInteraction=require(_0xfabb('0x0'))['db']['MailInteraction'];var MailMessage=require(_0xfabb('0x0'))['db'][_0xfabb('0x1')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xfabb('0x2')](0x0);var events={'afterCreate':_0xfabb('0x3'),'afterUpdate':'update','afterDestroy':_0xfabb('0x4')};function emitEvent(_0x3c7af5){return function(_0x2cc4a1,_0x25eb6c,_0x134675){_0x2cc4a1[_0xfabb('0x5')]({'attributes':['id'],'raw':!![]})['then'](function(_0x5a2ee0){_0x2cc4a1[_0xfabb('0x6')]('Users',_0x5a2ee0[_0xfabb('0x7')](function(_0x24d084){return{'id':_0x24d084['id']};}));return MailMessage[_0xfabb('0x8')]({'where':{'MailInteractionId':_0x2cc4a1['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x560c82){_0x2cc4a1[_0xfabb('0x6')](_0xfabb('0x9'),_0x560c82['length']);MailInteractionEvents[_0xfabb('0xa')](_0x3c7af5+':'+_0x2cc4a1['id'],_0x2cc4a1);MailInteractionEvents[_0xfabb('0xa')](_0x3c7af5,_0x2cc4a1);_0x134675(null);})[_0xfabb('0xb')](_0x134675(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module[_0xfabb('0xc')]=MailInteractionEvents; \ No newline at end of file +var _0x7b0b=['../../mysqldb','MailInteraction','MailMessage','setMaxListeners','save','update','remove','Users','map','findAll','then','unreadMessages','length','emit','catch','hasOwnProperty','hook','events'];(function(_0x433e75,_0x11bcde){var _0x3bdd9c=function(_0x742d70){while(--_0x742d70){_0x433e75['push'](_0x433e75['shift']());}};_0x3bdd9c(++_0x11bcde);}(_0x7b0b,0x1e5));var _0xb7b0=function(_0x21cdf3,_0x12a68d){_0x21cdf3=_0x21cdf3-0x0;var _0x3c8d50=_0x7b0b[_0x21cdf3];return _0x3c8d50;};'use strict';var EventEmitter=require(_0xb7b0('0x0'));var MailInteraction=require(_0xb7b0('0x1'))['db'][_0xb7b0('0x2')];var MailMessage=require('../../mysqldb')['db'][_0xb7b0('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xb7b0('0x4')](0x0);var events={'afterCreate':_0xb7b0('0x5'),'afterUpdate':_0xb7b0('0x6'),'afterDestroy':_0xb7b0('0x7')};function emitEvent(_0x1f3421){return function(_0x10caaf,_0x401005,_0x388c34){_0x10caaf['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x5b12bf){_0x10caaf['setDataValue'](_0xb7b0('0x8'),_0x5b12bf[_0xb7b0('0x9')](function(_0x4ae54c){return{'id':_0x4ae54c['id']};}));return MailMessage[_0xb7b0('0xa')]({'where':{'MailInteractionId':_0x10caaf['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb7b0('0xb')](function(_0x3b5a1e){_0x10caaf['setDataValue'](_0xb7b0('0xc'),_0x3b5a1e[_0xb7b0('0xd')]);MailInteractionEvents[_0xb7b0('0xe')](_0x1f3421+':'+_0x10caaf['id'],_0x10caaf);MailInteractionEvents['emit'](_0x1f3421,_0x10caaf);_0x388c34(null);})[_0xb7b0('0xf')](_0x388c34(null));};}for(var e in events){if(events[_0xb7b0('0x10')](e)){var event=events[e];MailInteraction[_0xb7b0('0x11')](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 5fb7c10..8953399 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 _0x08a8=['closed','YYYY-MM-DD\x20HH:mm:ss','changed','models','get','MailMessage','update','then','catch','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','define','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','substatusAt','format'];(function(_0xe0de39,_0x49e8da){var _0x50d1df=function(_0x3f8c1d){while(--_0x3f8c1d){_0xe0de39['push'](_0xe0de39['shift']());}};_0x50d1df(++_0x49e8da);}(_0x08a8,0x137));var _0x808a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x08a8[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x808a('0x0'));var logger=require(_0x808a('0x1'))(_0x808a('0x2'));var moment=require(_0x808a('0x3'));var BPromise=require(_0x808a('0x4'));var rp=require(_0x808a('0x5'));var fs=require('fs');var path=require(_0x808a('0x6'));var rimraf=require(_0x808a('0x7'));var config=require(_0x808a('0x8'));var attributes=require(_0x808a('0x9'));module['exports']=function(_0x5234b5,_0x519f9c){return _0x5234b5[_0x808a('0xa')](_0x808a('0xb'),attributes,{'tableName':_0x808a('0xc'),'paranoid':![],'indexes':[{'name':_0x808a('0xd'),'fields':[_0x808a('0xe'),'to'],'type':_0x808a('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4f8965,_0x4f8a0a,_0x1b1180){if(_0x4f8965[_0x808a('0x10')]){_0x4f8965[_0x808a('0x11')]=moment()[_0x808a('0x12')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x4f8965[_0x808a('0x13')]){_0x4f8965['closedAt']=moment()[_0x808a('0x12')](_0x808a('0x14'));}_0x1b1180(null,_0x4f8a0a);},'beforeUpdate':function(_0x2191a4,_0x3333a1,_0x2d8749){if(_0x2191a4['changed'](_0x808a('0x10'))){_0x2191a4[_0x808a('0x11')]=_0x2191a4[_0x808a('0x10')]?moment()[_0x808a('0x12')](_0x808a('0x14')):null;}if(_0x2191a4[_0x808a('0x15')](_0x808a('0x13'))){_0x2191a4['closedAt']=moment()[_0x808a('0x12')](_0x808a('0x14'));_0x2191a4[_0x808a('0x10')]=null;_0x2191a4[_0x808a('0x11')]=null;}_0x2d8749(null,_0x2191a4);},'afterUpdate':function(_0x54dc77,_0x5df2d4,_0x4bbd80){var _0x5a17cb=_0x5234b5[_0x808a('0x16')];var _0x22497c=_0x54dc77[_0x808a('0x17')]({'plain':!![]});if(_0x22497c[_0x808a('0x13')]){return _0x5a17cb[_0x808a('0x18')][_0x808a('0x19')]({'read':!![]},{'where':{'MailInteractionId':_0x22497c['id']}})[_0x808a('0x1a')](function(){_0x4bbd80();})[_0x808a('0x1b')](function(_0x5a4eba){_0x4bbd80(_0x5a4eba);});}else{_0x4bbd80();}}},'charset':_0x808a('0x1c'),'collate':_0x808a('0x1d')});}; \ No newline at end of file +var _0x2ce3=['update','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','MailInteraction','mail_interactions','FULLTEXT','substatus','substatusAt','YYYY-MM-DD\x20HH:mm:ss','closedAt','format','changed','get','closed','MailMessage'];(function(_0x12a93b,_0x43f156){var _0x22a740=function(_0x3357ad){while(--_0x3357ad){_0x12a93b['push'](_0x12a93b['shift']());}};_0x22a740(++_0x43f156);}(_0x2ce3,0x17e));var _0x32ce=function(_0x26c26b,_0x300742){_0x26c26b=_0x26c26b-0x0;var _0x371f70=_0x2ce3[_0x26c26b];return _0x371f70;};'use strict';var _=require(_0x32ce('0x0'));var util=require(_0x32ce('0x1'));var logger=require(_0x32ce('0x2'))('api');var moment=require(_0x32ce('0x3'));var BPromise=require(_0x32ce('0x4'));var rp=require(_0x32ce('0x5'));var fs=require('fs');var path=require(_0x32ce('0x6'));var rimraf=require(_0x32ce('0x7'));var config=require(_0x32ce('0x8'));var attributes=require('./mailInteraction.attributes');module[_0x32ce('0x9')]=function(_0x14ed49,_0xc3ec9){return _0x14ed49[_0x32ce('0xa')](_0x32ce('0xb'),attributes,{'tableName':_0x32ce('0xc'),'paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':['subject','to'],'type':_0x32ce('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x10d69a,_0x438469,_0x1726b2){if(_0x10d69a[_0x32ce('0xe')]){_0x10d69a[_0x32ce('0xf')]=moment()['format'](_0x32ce('0x10'));}if(_0x10d69a['closed']){_0x10d69a[_0x32ce('0x11')]=moment()[_0x32ce('0x12')](_0x32ce('0x10'));}_0x1726b2(null,_0x438469);},'beforeUpdate':function(_0x2a0354,_0xfbf6d,_0x96029b){if(_0x2a0354[_0x32ce('0x13')](_0x32ce('0xe'))){_0x2a0354['substatusAt']=_0x2a0354['substatus']?moment()[_0x32ce('0x12')]('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x2a0354[_0x32ce('0x13')]('closed')){_0x2a0354[_0x32ce('0x11')]=moment()[_0x32ce('0x12')](_0x32ce('0x10'));_0x2a0354[_0x32ce('0xe')]=null;_0x2a0354[_0x32ce('0xf')]=null;}_0x96029b(null,_0x2a0354);},'afterUpdate':function(_0x460077,_0x2f5305,_0x268ac9){var _0x4f240e=_0x14ed49['models'];var _0x40e326=_0x460077[_0x32ce('0x14')]({'plain':!![]});if(_0x40e326[_0x32ce('0x15')]){return _0x4f240e[_0x32ce('0x16')][_0x32ce('0x17')]({'read':!![]},{'where':{'MailInteractionId':_0x40e326['id']}})['then'](function(){_0x268ac9();})[_0x32ce('0x18')](function(_0x3090e2){_0x268ac9(_0x3090e2);});}else{_0x268ac9();}}},'charset':_0x32ce('0x19'),'collate':_0x32ce('0x1a')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index a53f70d..8b0ba6e 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 _0xc5c8=['MailInteraction','update','body','options','where','limit','catch','AddTagsToMailInteraction','find','addTags','ids','spread','debug','AddTags','lodash','util','moment','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request','then','MailInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','UpdateMailInteraction'];(function(_0x37815c,_0xeccdb5){var _0x3e9dab=function(_0x196614){while(--_0x196614){_0x37815c['push'](_0x37815c['shift']());}};_0x3e9dab(++_0xeccdb5);}(_0xc5c8,0x118));var _0x8c5c=function(_0x5035c9,_0x2eb1ad){_0x5035c9=_0x5035c9-0x0;var _0x451030=_0xc5c8[_0x5035c9];return _0x451030;};'use strict';var _=require(_0x8c5c('0x0'));var util=require(_0x8c5c('0x1'));var moment=require(_0x8c5c('0x2'));var BPromise=require('bluebird');var rs=require(_0x8c5c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8c5c('0x4'));var logger=require(_0x8c5c('0x5'))('rpc');var config=require(_0x8c5c('0x6'));var jayson=require(_0x8c5c('0x7'));var client=jayson[_0x8c5c('0x8')][_0x8c5c('0x9')]({'port':0x232a});config[_0x8c5c('0xa')]=_[_0x8c5c('0xb')](config[_0x8c5c('0xa')],{'host':_0x8c5c('0xc'),'port':0x18eb});var socket=require(_0x8c5c('0xd'))(new Redis(config[_0x8c5c('0xa')]));require('./mailInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x577081,_0x41b175,_0xffe42c){return new BPromise(function(_0x51f5fc,_0x5a24e8){return client[_0x8c5c('0xe')](_0x577081,_0xffe42c)[_0x8c5c('0xf')](function(_0x50bc7d){logger['info'](_0x8c5c('0x10'),_0x41b175,_0x8c5c('0x11'));logger['debug']('MailInteraction,\x20%s,\x20%s,\x20%s',_0x41b175,_0x8c5c('0x11'),JSON[_0x8c5c('0x12')](_0x50bc7d));if(_0x50bc7d[_0x8c5c('0x13')]){if(_0x50bc7d['error'][_0x8c5c('0x14')]===0x1f4){logger[_0x8c5c('0x13')]('MailInteraction,\x20%s,\x20%s',_0x41b175,_0x50bc7d['error'][_0x8c5c('0x15')]);return _0x5a24e8(_0x50bc7d['error'][_0x8c5c('0x15')]);}logger[_0x8c5c('0x13')](_0x8c5c('0x10'),_0x41b175,_0x50bc7d[_0x8c5c('0x13')][_0x8c5c('0x15')]);return _0x51f5fc(_0x50bc7d[_0x8c5c('0x13')][_0x8c5c('0x15')]);}else{logger[_0x8c5c('0x16')](_0x8c5c('0x10'),_0x41b175,_0x8c5c('0x11'));_0x51f5fc(_0x50bc7d['result']['message']);}})['catch'](function(_0x56a434){logger[_0x8c5c('0x13')]('MailInteraction,\x20%s,\x20%s',_0x41b175,_0x56a434);_0x5a24e8(_0x56a434);});});}exports[_0x8c5c('0x17')]=function(_0x31e782){var _0x15a9e2=this;return new Promise(function(_0x24d15c,_0x21d0de){return db[_0x8c5c('0x18')][_0x8c5c('0x19')](_0x31e782[_0x8c5c('0x1a')],{'raw':_0x31e782[_0x8c5c('0x1b')]?_0x31e782[_0x8c5c('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x31e782[_0x8c5c('0x1b')]?_0x31e782[_0x8c5c('0x1b')][_0x8c5c('0x1c')]||null:null,'attributes':_0x31e782['options']?_0x31e782[_0x8c5c('0x1b')]['attributes']||null:null,'limit':_0x31e782['options']?_0x31e782['options'][_0x8c5c('0x1d')]||null:null})[_0x8c5c('0xf')](function(_0x19389f){logger[_0x8c5c('0x16')](_0x8c5c('0x17'),_0x31e782);logger['debug']('UpdateMailInteraction',_0x31e782,JSON['stringify'](_0x19389f));_0x24d15c(_0x19389f);})[_0x8c5c('0x1e')](function(_0x1ca2da){logger[_0x8c5c('0x13')](_0x8c5c('0x17'),_0x1ca2da[_0x8c5c('0x15')],_0x31e782);_0x21d0de(_0x15a9e2[_0x8c5c('0x13')](0x1f4,_0x1ca2da[_0x8c5c('0x15')]));});});};exports[_0x8c5c('0x1f')]=function(_0x140c21){return new Promise(function(_0x3da1ce,_0x1f4fb9){return db[_0x8c5c('0x18')][_0x8c5c('0x20')]({'where':_0x140c21['options']?_0x140c21[_0x8c5c('0x1b')]['where']||null:null})[_0x8c5c('0xf')](function(_0x338c03){if(_0x338c03){return _0x338c03[_0x8c5c('0x21')](_0x140c21[_0x8c5c('0x1a')][_0x8c5c('0x22')],_['omit'](_0x140c21['body'],[_0x8c5c('0x22'),'id'])||{});}})[_0x8c5c('0x23')](function(_0x15836e){logger[_0x8c5c('0x16')]('AddTags',_0x140c21);logger[_0x8c5c('0x24')](_0x8c5c('0x25'),_0x140c21,JSON[_0x8c5c('0x12')](_0x15836e));_0x3da1ce(_0x15836e);})['catch'](function(_0x5bca61){logger[_0x8c5c('0x13')](_0x8c5c('0x25'),_0x5bca61[_0x8c5c('0x15')],_0x140c21);_0x1f4fb9(_this[_0x8c5c('0x13')](0x1f4,_0x5bca61['message']));});});}; \ No newline at end of file +var _0x3809=['client','http','redis','defaults','localhost','socket.io-emitter','register','request','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateMailInteraction','update','body','options','raw','where','attributes','limit','then','info','MailInteraction','addTags','ids','omit','spread','AddTags','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise'];(function(_0x5892af,_0x16299d){var _0x39086b=function(_0x37ed78){while(--_0x37ed78){_0x5892af['push'](_0x5892af['shift']());}};_0x39086b(++_0x16299d);}(_0x3809,0xca));var _0x9380=function(_0x33131c,_0x166d0f){_0x33131c=_0x33131c-0x0;var _0x937ee5=_0x3809[_0x33131c];return _0x937ee5;};'use strict';var _=require('lodash');var util=require(_0x9380('0x0'));var moment=require(_0x9380('0x1'));var BPromise=require(_0x9380('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9380('0x3'));var db=require(_0x9380('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9380('0x5'));var config=require(_0x9380('0x6'));var jayson=require(_0x9380('0x7'));var client=jayson[_0x9380('0x8')][_0x9380('0x9')]({'port':0x232a});config[_0x9380('0xa')]=_[_0x9380('0xb')](config[_0x9380('0xa')],{'host':_0x9380('0xc'),'port':0x18eb});var socket=require(_0x9380('0xd'))(new Redis(config[_0x9380('0xa')]));require('./mailInteraction.socket')[_0x9380('0xe')](socket);function respondWithRpcPromise(_0x1d13a5,_0x4bf486,_0xfee5a9){return new BPromise(function(_0x3ddf19,_0x50c0f6){return client[_0x9380('0xf')](_0x1d13a5,_0xfee5a9)['then'](function(_0x32193b){logger['info'](_0x9380('0x10'),_0x4bf486,_0x9380('0x11'));logger[_0x9380('0x12')](_0x9380('0x13'),_0x4bf486,_0x9380('0x11'),JSON[_0x9380('0x14')](_0x32193b));if(_0x32193b[_0x9380('0x15')]){if(_0x32193b[_0x9380('0x15')][_0x9380('0x16')]===0x1f4){logger['error']('MailInteraction,\x20%s,\x20%s',_0x4bf486,_0x32193b[_0x9380('0x15')][_0x9380('0x17')]);return _0x50c0f6(_0x32193b[_0x9380('0x15')][_0x9380('0x17')]);}logger[_0x9380('0x15')]('MailInteraction,\x20%s,\x20%s',_0x4bf486,_0x32193b['error'][_0x9380('0x17')]);return _0x3ddf19(_0x32193b[_0x9380('0x15')]['message']);}else{logger['info'](_0x9380('0x10'),_0x4bf486,_0x9380('0x11'));_0x3ddf19(_0x32193b[_0x9380('0x18')][_0x9380('0x17')]);}})[_0x9380('0x19')](function(_0x49802c){logger[_0x9380('0x15')](_0x9380('0x10'),_0x4bf486,_0x49802c);_0x50c0f6(_0x49802c);});});}exports[_0x9380('0x1a')]=function(_0x430017){var _0xb907dc=this;return new Promise(function(_0x1044d0,_0x51b45f){return db['MailInteraction'][_0x9380('0x1b')](_0x430017[_0x9380('0x1c')],{'raw':_0x430017[_0x9380('0x1d')]?_0x430017['options'][_0x9380('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x430017[_0x9380('0x1d')]?_0x430017[_0x9380('0x1d')][_0x9380('0x1f')]||null:null,'attributes':_0x430017['options']?_0x430017[_0x9380('0x1d')][_0x9380('0x20')]||null:null,'limit':_0x430017[_0x9380('0x1d')]?_0x430017[_0x9380('0x1d')][_0x9380('0x21')]||null:null})[_0x9380('0x22')](function(_0x13c6b9){logger[_0x9380('0x23')](_0x9380('0x1a'),_0x430017);logger[_0x9380('0x12')](_0x9380('0x1a'),_0x430017,JSON['stringify'](_0x13c6b9));_0x1044d0(_0x13c6b9);})[_0x9380('0x19')](function(_0x4d852a){logger[_0x9380('0x15')](_0x9380('0x1a'),_0x4d852a[_0x9380('0x17')],_0x430017);_0x51b45f(_0xb907dc[_0x9380('0x15')](0x1f4,_0x4d852a[_0x9380('0x17')]));});});};exports['AddTagsToMailInteraction']=function(_0xb53a72){return new Promise(function(_0x35d089,_0x27a95c){return db[_0x9380('0x24')]['find']({'where':_0xb53a72[_0x9380('0x1d')]?_0xb53a72[_0x9380('0x1d')][_0x9380('0x1f')]||null:null})['then'](function(_0x4ab43e){if(_0x4ab43e){return _0x4ab43e[_0x9380('0x25')](_0xb53a72[_0x9380('0x1c')][_0x9380('0x26')],_[_0x9380('0x27')](_0xb53a72[_0x9380('0x1c')],[_0x9380('0x26'),'id'])||{});}})[_0x9380('0x28')](function(_0x231ac8){logger[_0x9380('0x23')]('AddTags',_0xb53a72);logger[_0x9380('0x12')](_0x9380('0x29'),_0xb53a72,JSON[_0x9380('0x14')](_0x231ac8));_0x35d089(_0x231ac8);})[_0x9380('0x19')](function(_0x50b4bd){logger[_0x9380('0x15')](_0x9380('0x29'),_0x50b4bd[_0x9380('0x17')],_0xb53a72);_0x27a95c(_this['error'](0x1f4,_0x50b4bd['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 2767e18..2f3d69f 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 _0x031c=['removeListener','register','length','mailInteraction:','./mailInteraction.events','save','remove','emit'];(function(_0x174125,_0x542e78){var _0x513f0c=function(_0x5cb5ef){while(--_0x5cb5ef){_0x174125['push'](_0x174125['shift']());}};_0x513f0c(++_0x542e78);}(_0x031c,0x1d4));var _0xc031=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x031c[_0x5b644e];return _0x49c6bf;};'use strict';var MailInteractionEvents=require(_0xc031('0x0'));var events=[_0xc031('0x1'),_0xc031('0x2'),'update'];function createListener(_0x9df320,_0x1afe8b){return function(_0x4a037f){_0x1afe8b[_0xc031('0x3')](_0x9df320,_0x4a037f);};}function removeListener(_0x2a28cd,_0x5327e9){return function(){MailInteractionEvents[_0xc031('0x4')](_0x2a28cd,_0x5327e9);};}exports[_0xc031('0x5')]=function(_0x54aa13){for(var _0x5ab275=0x0,_0x182ba3=events[_0xc031('0x6')];_0x5ab275<_0x182ba3;_0x5ab275++){var _0x57d120=events[_0x5ab275];var _0x4c3010=createListener(_0xc031('0x7')+_0x57d120,_0x54aa13);MailInteractionEvents['on'](_0x57d120,_0x4c3010);}}; \ No newline at end of file +var _0x259b=['register','length','mailInteraction:','save','remove','update','emit'];(function(_0xe896bf,_0x4f8e5e){var _0x4c7a8a=function(_0x410ff2){while(--_0x410ff2){_0xe896bf['push'](_0xe896bf['shift']());}};_0x4c7a8a(++_0x4f8e5e);}(_0x259b,0x81));var _0xb259=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0x259b[_0x5037ab];return _0x512adb;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=[_0xb259('0x0'),_0xb259('0x1'),_0xb259('0x2')];function createListener(_0x45dd63,_0x2a53dc){return function(_0x5dfbc1){_0x2a53dc[_0xb259('0x3')](_0x45dd63,_0x5dfbc1);};}function removeListener(_0x1e39b4,_0x55e244){return function(){MailInteractionEvents['removeListener'](_0x1e39b4,_0x55e244);};}exports[_0xb259('0x4')]=function(_0x2cb4ba){for(var _0x2f834b=0x0,_0x24d33a=events[_0xb259('0x5')];_0x2f834b<_0x24d33a;_0x2f834b++){var _0x3135e7=events[_0x2f834b];var _0x5b9e88=createListener(_0xb259('0x6')+_0x3135e7,_0x2cb4ba);MailInteractionEvents['on'](_0x3135e7,_0x5b9e88);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 30a7ba1..ed7d099 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 _0x6037=['post','mail','put','/:id','update','accept','/:id/reject','reject','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../config/environment','./mailMessage.controller','isAuthenticated','index','get','/describe','describe','download'];(function(_0x31eb67,_0x9bc8c0){var _0x2a8cb8=function(_0xac1c5d){while(--_0xac1c5d){_0x31eb67['push'](_0x31eb67['shift']());}};_0x2a8cb8(++_0x9bc8c0);}(_0x6037,0xe2));var _0x7603=function(_0x1ec1b7,_0x21c85a){_0x1ec1b7=_0x1ec1b7-0x0;var _0x586cd6=_0x6037[_0x1ec1b7];return _0x586cd6;};'use strict';var multer=require(_0x7603('0x0'));var util=require(_0x7603('0x1'));var path=require(_0x7603('0x2'));var timeout=require('connect-timeout');var express=require(_0x7603('0x3'));var router=express['Router']();var fs_extra=require(_0x7603('0x4'));var auth=require(_0x7603('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7603('0x6'));var controller=require(_0x7603('0x7'));router['get']('/',auth[_0x7603('0x8')](),controller[_0x7603('0x9')]);router[_0x7603('0xa')](_0x7603('0xb'),auth[_0x7603('0x8')](),controller[_0x7603('0xc')]);router[_0x7603('0xa')]('/:id',auth[_0x7603('0x8')](),controller['show']);router[_0x7603('0xa')]('/:id/download',auth['isAuthenticated'](),controller[_0x7603('0xd')]);router[_0x7603('0xe')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x7603('0xf'),'mailmessage:create'),controller['create']);router[_0x7603('0x10')](_0x7603('0x11'),auth[_0x7603('0x8')](),controller[_0x7603('0x12')]);router[_0x7603('0x10')]('/:id/accept',auth[_0x7603('0x8')](),controller[_0x7603('0x13')]);router[_0x7603('0x10')](_0x7603('0x14'),auth['isAuthenticated'](),controller[_0x7603('0x15')]);router['delete'](_0x7603('0x11'),auth[_0x7603('0x8')](),controller[_0x7603('0x16')]);module[_0x7603('0x17')]=router; \ No newline at end of file +var _0x2b50=['/:id/reject','delete','destroy','exports','multer','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','/:id','show','/:id/download','download','post','tracked','mail','mailmessage:create','create','put','update','/:id/accept'];(function(_0x5e6d65,_0x5db89c){var _0x5e1f75=function(_0x3729a1){while(--_0x3729a1){_0x5e6d65['push'](_0x5e6d65['shift']());}};_0x5e1f75(++_0x5db89c);}(_0x2b50,0x68));var _0x02b5=function(_0x3d4b0f,_0x40cb9a){_0x3d4b0f=_0x3d4b0f-0x0;var _0x2daea7=_0x2b50[_0x3d4b0f];return _0x2daea7;};'use strict';var multer=require(_0x02b5('0x0'));var util=require('util');var path=require(_0x02b5('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x02b5('0x2'));var auth=require(_0x02b5('0x3'));var interaction=require(_0x02b5('0x4'));var config=require(_0x02b5('0x5'));var controller=require('./mailMessage.controller');router[_0x02b5('0x6')]('/',auth[_0x02b5('0x7')](),controller['index']);router['get']('/describe',auth[_0x02b5('0x7')](),controller[_0x02b5('0x8')]);router[_0x02b5('0x6')](_0x02b5('0x9'),auth[_0x02b5('0x7')](),controller[_0x02b5('0xa')]);router[_0x02b5('0x6')](_0x02b5('0xb'),auth[_0x02b5('0x7')](),controller[_0x02b5('0xc')]);router[_0x02b5('0xd')]('/',auth[_0x02b5('0x7')](),interaction[_0x02b5('0xe')](_0x02b5('0xf'),_0x02b5('0x10')),controller[_0x02b5('0x11')]);router[_0x02b5('0x12')](_0x02b5('0x9'),auth[_0x02b5('0x7')](),controller[_0x02b5('0x13')]);router[_0x02b5('0x12')](_0x02b5('0x14'),auth[_0x02b5('0x7')](),controller['accept']);router['put'](_0x02b5('0x15'),auth[_0x02b5('0x7')](),controller['reject']);router[_0x02b5('0x16')](_0x02b5('0x9'),auth[_0x02b5('0x7')](),controller[_0x02b5('0x17')]);module[_0x02b5('0x18')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 964c6ac..5283b0d 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 _0x18f3=['exports','TEXT','medium','ENUM','out','STRING','long','DATE','INTEGER','BOOLEAN','Email','Chat','lodash'];(function(_0x196d14,_0x8a3251){var _0x506a10=function(_0x591256){while(--_0x591256){_0x196d14['push'](_0x196d14['shift']());}};_0x506a10(++_0x8a3251);}(_0x18f3,0x19f));var _0x318f=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0x18f3[_0x2a6809];return _0x11c371;};'use strict';var Sequelize=require('sequelize');var _=require(_0x318f('0x0'));module[_0x318f('0x1')]={'body':{'type':Sequelize[_0x318f('0x2')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x318f('0x3'))},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x318f('0x4')]('in',_0x318f('0x5')),'defaultValue':_0x318f('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x318f('0x6')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x318f('0x2')](_0x318f('0x7'))},'cc':{'type':Sequelize['TEXT']('long')},'bcc':{'type':Sequelize[_0x318f('0x2')]('long')},'subject':{'type':Sequelize[_0x318f('0x2')]},'sentAt':{'type':Sequelize[_0x318f('0x8')]},'attach':{'type':Sequelize[_0x318f('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x318f('0xa')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x318f('0x8')]},'originTo':{'type':Sequelize[_0x318f('0x2')](_0x318f('0x7'))},'originCc':{'type':Sequelize[_0x318f('0x2')](_0x318f('0x7'))},'originChannel':{'type':Sequelize[_0x318f('0x4')](_0x318f('0xb'),_0x318f('0xc')),'defaultValue':_0x318f('0xb'),'allowNull':![]}}; \ No newline at end of file +var _0xfb0d=['BOOLEAN','ENUM','out','STRING','DATE','INTEGER','Chat','Email','lodash','exports','long','TEXT','medium'];(function(_0x1a457e,_0x51757a){var _0x3adde2=function(_0x4c4af1){while(--_0x4c4af1){_0x1a457e['push'](_0x1a457e['shift']());}};_0x3adde2(++_0x51757a);}(_0xfb0d,0x70));var _0xdfb0=function(_0xc9b253,_0x2224b0){_0xc9b253=_0xc9b253-0x0;var _0x1d18e5=_0xfb0d[_0xc9b253];return _0x1d18e5;};'use strict';var Sequelize=require('sequelize');var _=require(_0xdfb0('0x0'));module[_0xdfb0('0x1')]={'body':{'type':Sequelize['TEXT'](_0xdfb0('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xdfb0('0x3')](_0xdfb0('0x4'))},'read':{'type':Sequelize[_0xdfb0('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0xdfb0('0x6')]('in','out'),'defaultValue':_0xdfb0('0x7'),'allowNull':![]},'messageId':{'type':Sequelize[_0xdfb0('0x8')](0x1fe)},'from':{'type':Sequelize[_0xdfb0('0x8')]},'to':{'type':Sequelize[_0xdfb0('0x3')](_0xdfb0('0x2'))},'cc':{'type':Sequelize[_0xdfb0('0x3')]('long')},'bcc':{'type':Sequelize[_0xdfb0('0x3')]('long')},'subject':{'type':Sequelize[_0xdfb0('0x3')]},'sentAt':{'type':Sequelize[_0xdfb0('0x9')]},'attach':{'type':Sequelize[_0xdfb0('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xdfb0('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xdfb0('0x9')]},'originTo':{'type':Sequelize[_0xdfb0('0x3')](_0xdfb0('0x2'))},'originCc':{'type':Sequelize[_0xdfb0('0x3')](_0xdfb0('0x2'))},'originChannel':{'type':Sequelize['ENUM']('Email',_0xdfb0('0xb')),'defaultValue':_0xdfb0('0xc'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 5c19ef2..eebff3c 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 _0xc952=['sendStatus','name','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','include','findAll','rows','show','params','MailMessage','find','body','destroy','describe','create','out','split','MailAccount','findOne','MailAccountId','CmList','CmContact','Contacts','updatedAt','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','join','server/files/attachments','List','ListId','List\x20not\x20found','SendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read','readAt','UserId','agent','get','MailInteraction','MailInteractionId','read1stAt','interaction','user','role','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','email','reject','download','toString','server','files','tmp','root','from','bcc','subject','Attachment','decode','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','Attachments','basename','existsSync','push','build','writeFileSync','unlinkSync','eml-format','moment','bluebird','util','path','lodash','html-to-text','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','jayson/promise','client','http','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','offset','limit','undefined','count','set','Content-Range','json','update'];(function(_0x556d5e,_0x851fec){var _0x5be0bd=function(_0x1aee59){while(--_0x1aee59){_0x556d5e['push'](_0x556d5e['shift']());}};_0x5be0bd(++_0x851fec);}(_0xc952,0x10b));var _0x2c95=function(_0x227cfb,_0x4f42cf){_0x227cfb=_0x227cfb-0x0;var _0x131407=_0xc952[_0x227cfb];return _0x131407;};'use strict';var emlformat=require(_0x2c95('0x0'));var moment=require(_0x2c95('0x1'));var BPromise=require(_0x2c95('0x2'));var util=require(_0x2c95('0x3'));var path=require(_0x2c95('0x4'));var fs=require('fs');var _=require(_0x2c95('0x5'));var Redis=require('ioredis');var htmlToText=require(_0x2c95('0x6'));var qs=require(_0x2c95('0x7'));var logger=require(_0x2c95('0x8'))(_0x2c95('0x9'));var interaction_log=require('../../config/logger')(_0x2c95('0xa'));var config=require(_0x2c95('0xb'));var db=require(_0x2c95('0xc'))['db'];config[_0x2c95('0xd')]=_[_0x2c95('0xe')](config[_0x2c95('0xd')],{'host':_0x2c95('0xf'),'port':0x18eb});var socket=require(_0x2c95('0x10'))(new Redis(config[_0x2c95('0xd')]));var htmlEntities=require('html-entities');require(_0x2c95('0x11'))['register'](socket);var jayson=require(_0x2c95('0x12'));var client=jayson[_0x2c95('0x13')]['http']({'port':0x232c});var client9003=jayson['client'][_0x2c95('0x14')]({'port':0x232b});var client9002=jayson['client'][_0x2c95('0x14')]({'port':0x232a});function respondWithRpcPromise(_0x408303,_0x438373,_0x24d797,_0x4ff458){return new BPromise(function(_0x582d53,_0x22d433){var _0x2243c9=_0x4ff458||client;return _0x2243c9[_0x2c95('0x15')](_0x408303,_0x24d797)[_0x2c95('0x16')](function(_0x41c94d){logger[_0x2c95('0x17')](_0x2c95('0x18'),_0x438373,_0x2c95('0x19'));logger[_0x2c95('0x1a')](_0x2c95('0x1b'),_0x438373,_0x2c95('0x19'),JSON[_0x2c95('0x1c')](_0x41c94d));if(_0x41c94d['error']){if(_0x41c94d[_0x2c95('0x1d')][_0x2c95('0x1e')]===0x1f4){logger['error']('MailMessage,\x20%s,\x20%s',_0x438373,_0x41c94d[_0x2c95('0x1d')][_0x2c95('0x1f')]);return _0x22d433(_0x41c94d['error']['message']);}logger[_0x2c95('0x1d')]('MailMessage,\x20%s,\x20%s',_0x438373,_0x41c94d[_0x2c95('0x1d')][_0x2c95('0x1f')]);return _0x582d53(_0x41c94d['error'][_0x2c95('0x1f')]);}else{logger[_0x2c95('0x17')](_0x2c95('0x18'),_0x438373,'request\x20sent');_0x582d53(_0x41c94d[_0x2c95('0x20')][_0x2c95('0x1f')]);}})[_0x2c95('0x21')](function(_0x5908f7){logger[_0x2c95('0x1d')]('MailMessage,\x20%s,\x20%s',_0x438373,_0x5908f7);_0x22d433(_0x5908f7);});});}function respondWithResult(_0x43bb41,_0xb6819e){_0xb6819e=_0xb6819e||0xc8;return function(_0x2bc005){if(_0x2bc005){return _0x43bb41[_0x2c95('0x22')](_0xb6819e)['json'](_0x2bc005);}};}function respondWithFilteredResult(_0x3b009b,_0x3e21e0){return function(_0x3ed558){if(_0x3ed558){var _0x429a99=typeof _0x3e21e0[_0x2c95('0x23')]==='undefined'&&typeof _0x3e21e0[_0x2c95('0x24')]===_0x2c95('0x25');var _0xebacf2=_0x3ed558[_0x2c95('0x26')];var _0x95662f=_0x429a99?0x0:_0x3e21e0[_0x2c95('0x23')];var _0x243b80=_0x429a99?_0x3ed558['count']:_0x3e21e0['offset']+_0x3e21e0[_0x2c95('0x24')];var _0x42a9be;if(_0x243b80>=_0xebacf2){_0x243b80=_0xebacf2;_0x42a9be=0xc8;}else{_0x42a9be=0xce;}_0x3b009b[_0x2c95('0x22')](_0x42a9be);return _0x3b009b[_0x2c95('0x27')](_0x2c95('0x28'),_0x95662f+'-'+_0x243b80+'/'+_0xebacf2)[_0x2c95('0x29')](_0x3ed558);}return null;};}function saveUpdates(_0x253747){return function(_0x232553){if(_0x232553){return _0x232553[_0x2c95('0x2a')](_0x253747)[_0x2c95('0x16')](function(_0x39549c){return _0x39549c;});}return null;};}function removeEntity(_0x387ce0){return function(_0x36f648){if(_0x36f648){return _0x36f648['destroy']()['then'](function(){_0x387ce0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5452af){return function(_0x45009f){if(!_0x45009f){_0x5452af[_0x2c95('0x2b')](0x194);}return _0x45009f;};}function handleError(_0x4f75c7,_0x3d5b0e){_0x3d5b0e=_0x3d5b0e||0x1f4;return function(_0x50cc77){logger[_0x2c95('0x1d')](_0x50cc77['stack']);if(_0x50cc77[_0x2c95('0x2c')]){delete _0x50cc77['name'];}_0x4f75c7[_0x2c95('0x22')](_0x3d5b0e)['send'](_0x50cc77);};}exports['index']=function(_0x2cfec8,_0x18450a){var _0x2804a4={},_0x2bcf4c={},_0x395af2={'count':0x0,'rows':[]};var _0x30c75b=_['map'](db['MailMessage'][_0x2c95('0x2d')],function(_0x23d970){return{'name':_0x23d970['fieldName'],'type':_0x23d970[_0x2c95('0x2e')][_0x2c95('0x2f')]};});_0x2bcf4c[_0x2c95('0x30')]=_[_0x2c95('0x31')](_0x30c75b,_0x2c95('0x2c'));_0x2bcf4c[_0x2c95('0x32')]=_[_0x2c95('0x33')](_0x2cfec8[_0x2c95('0x32')]);_0x2bcf4c[_0x2c95('0x34')]=_[_0x2c95('0x35')](_0x2bcf4c[_0x2c95('0x30')],_0x2bcf4c[_0x2c95('0x32')]);_0x2804a4[_0x2c95('0x36')]=_[_0x2c95('0x35')](_0x2bcf4c[_0x2c95('0x30')],qs[_0x2c95('0x37')](_0x2cfec8[_0x2c95('0x32')]['fields']));_0x2804a4['attributes']=_0x2804a4[_0x2c95('0x36')][_0x2c95('0x38')]?_0x2804a4['attributes']:_0x2bcf4c['model'];if(!_0x2cfec8[_0x2c95('0x32')][_0x2c95('0x39')]('nolimit')){_0x2804a4['limit']=qs[_0x2c95('0x24')](_0x2cfec8[_0x2c95('0x32')][_0x2c95('0x24')]);_0x2804a4[_0x2c95('0x23')]=qs[_0x2c95('0x23')](_0x2cfec8[_0x2c95('0x32')][_0x2c95('0x23')]);}_0x2804a4[_0x2c95('0x3a')]=qs[_0x2c95('0x3b')](_0x2cfec8[_0x2c95('0x32')][_0x2c95('0x3b')]);_0x2804a4[_0x2c95('0x3c')]=qs[_0x2c95('0x34')](_[_0x2c95('0x3d')](_0x2cfec8[_0x2c95('0x32')],_0x2bcf4c[_0x2c95('0x34')]),_0x30c75b);if(_0x2cfec8['query'][_0x2c95('0x3e')]){_0x2804a4['where']=_[_0x2c95('0x3f')](_0x2804a4[_0x2c95('0x3c')],{'$or':_[_0x2c95('0x31')](_0x30c75b,function(_0x4866fe){if(_0x4866fe[_0x2c95('0x2e')]!=='VIRTUAL'){var _0x4fb923={};_0x4fb923[_0x4866fe[_0x2c95('0x2c')]]={'$like':'%'+_0x2cfec8[_0x2c95('0x32')]['filter']+'%'};return _0x4fb923;}})});}_0x2804a4=_['merge']({},_0x2804a4,_0x2cfec8[_0x2c95('0x40')]);var _0x45bb84={'where':_0x2804a4[_0x2c95('0x3c')]};return db['MailMessage'][_0x2c95('0x26')](_0x45bb84)['then'](function(_0x2cb286){_0x395af2[_0x2c95('0x26')]=_0x2cb286;if(_0x2cfec8[_0x2c95('0x32')]['includeAll']){_0x2804a4[_0x2c95('0x41')]=[{'all':!![]}];}return db['MailMessage'][_0x2c95('0x42')](_0x2804a4);})[_0x2c95('0x16')](function(_0xcff256){_0x395af2[_0x2c95('0x43')]=_0xcff256;return _0x395af2;})['then'](respondWithFilteredResult(_0x18450a,_0x2804a4))[_0x2c95('0x21')](handleError(_0x18450a,null));};exports[_0x2c95('0x44')]=function(_0x3d78e5,_0x6df598){var _0x14675f={'raw':!![],'where':{'id':_0x3d78e5[_0x2c95('0x45')]['id']}},_0x2902f3={};_0x2902f3['model']=_[_0x2c95('0x33')](db['MailMessage'][_0x2c95('0x2d')]);_0x2902f3[_0x2c95('0x32')]=_[_0x2c95('0x33')](_0x3d78e5[_0x2c95('0x32')]);_0x2902f3['filters']=_['intersection'](_0x2902f3['model'],_0x2902f3[_0x2c95('0x32')]);_0x14675f['attributes']=_[_0x2c95('0x35')](_0x2902f3[_0x2c95('0x30')],qs[_0x2c95('0x37')](_0x3d78e5[_0x2c95('0x32')]['fields']));_0x14675f['attributes']=_0x14675f[_0x2c95('0x36')][_0x2c95('0x38')]?_0x14675f[_0x2c95('0x36')]:_0x2902f3[_0x2c95('0x30')];if(_0x3d78e5[_0x2c95('0x32')]['includeAll']){_0x14675f[_0x2c95('0x41')]=[{'all':!![]}];}_0x14675f=_['merge']({},_0x14675f,_0x3d78e5[_0x2c95('0x40')]);return db[_0x2c95('0x46')][_0x2c95('0x47')](_0x14675f)['then'](handleEntityNotFound(_0x6df598,null))['then'](respondWithResult(_0x6df598,null))['catch'](handleError(_0x6df598,null));};exports['update']=function(_0x41d5fd,_0x5b5e85){if(_0x41d5fd[_0x2c95('0x48')]['id']){delete _0x41d5fd['body']['id'];}return db[_0x2c95('0x46')]['find']({'where':{'id':_0x41d5fd[_0x2c95('0x45')]['id']}})[_0x2c95('0x16')](handleEntityNotFound(_0x5b5e85,null))['then'](saveUpdates(_0x41d5fd[_0x2c95('0x48')],null))[_0x2c95('0x16')](respondWithResult(_0x5b5e85,null))[_0x2c95('0x21')](handleError(_0x5b5e85,null));};exports[_0x2c95('0x49')]=function(_0x407789,_0x2d6941){return db[_0x2c95('0x46')][_0x2c95('0x47')]({'where':{'id':_0x407789[_0x2c95('0x45')]['id']}})['then'](handleEntityNotFound(_0x2d6941,null))['then'](removeEntity(_0x2d6941,null))[_0x2c95('0x21')](handleError(_0x2d6941,null));};exports[_0x2c95('0x4a')]=function(_0x2528c9,_0x57c892){return db[_0x2c95('0x46')][_0x2c95('0x4a')]()[_0x2c95('0x16')](respondWithResult(_0x57c892,null))[_0x2c95('0x21')](handleError(_0x57c892,null));};exports[_0x2c95('0x4b')]=function(_0x2cb3df,_0xc3391b){return db['MailMessage'][_0x2c95('0x4b')](_0x2cb3df['body'])[_0x2c95('0x16')](function(_0x13e7dd){if(_0x13e7dd){if(_0x13e7dd['direction']===_0x2c95('0x4c')&&!_0x13e7dd['secret']){var _0x16202c,_0x1467b6,_0x11d136;if(_0x2cb3df[_0x2c95('0x48')]['to']){_0x1467b6=_0x2cb3df[_0x2c95('0x48')]['to'][_0x2c95('0x4d')](',')[0x0];}return db[_0x2c95('0x4e')][_0x2c95('0x4f')]({'where':{'id':_0x13e7dd[_0x2c95('0x50')]},'include':[{'model':db[_0x2c95('0x51')],'as':'List','include':[{'model':db[_0x2c95('0x52')],'as':_0x2c95('0x53'),'where':{'email':_0x1467b6},'limit':0x1,'order':[[_0x2c95('0x54'),'DESC']]}]},{'model':db[_0x2c95('0x55')],'as':_0x2c95('0x56'),'raw':!![],'include':[{'model':db[_0x2c95('0x57')],'as':_0x2c95('0x57'),'raw':!![]}]}]})[_0x2c95('0x16')](function(_0xdc44dd){_0x16202c=_0xdc44dd;if(!_0x16202c||!_0x16202c[_0x2c95('0x56')])return;var _0x1c6d1d=_0x16202c[_0x2c95('0x58')]();if(_0x2cb3df['body'][_0x2c95('0x59')]&&_0x2cb3df[_0x2c95('0x48')][_0x2c95('0x59')][_0x2c95('0x38')]){for(var _0x355ffd=0x0;_0x355ffd<_0x2cb3df['body'][_0x2c95('0x59')][_0x2c95('0x38')];_0x355ffd+=0x1){_0x2cb3df[_0x2c95('0x48')][_0x2c95('0x59')][_0x355ffd]={'filename':_0x2cb3df[_0x2c95('0x48')][_0x2c95('0x59')][_0x355ffd][_0x2c95('0x2c')],'path':path[_0x2c95('0x5a')](config['root'],_0x2c95('0x5b'),_0x2cb3df[_0x2c95('0x48')]['attachments'][_0x355ffd]['basename'])};}}_0x11d136={'account':_0x1c6d1d,'message':_0x2cb3df[_0x2c95('0x48')]};return;})[_0x2c95('0x16')](function(){if(_0x16202c[_0x2c95('0x5c')]){if(_0x16202c[_0x2c95('0x5c')][_0x2c95('0x53')][_0x2c95('0x38')]){return _0x16202c[_0x2c95('0x5c')][_0x2c95('0x53')][0x0];}else{return db[_0x2c95('0x52')][_0x2c95('0x4b')](_['defaults'](_0x2cb3df[_0x2c95('0x48')],{'firstName':_0x2cb3df['body']['to'],'email':_0x2cb3df['body']['to'],'phone':_0x2cb3df['body']['to'],'ListId':_0x16202c[_0x2c95('0x5d')]}));}}else{throw new Error(_0x2c95('0x5e'));}})['then'](function(){if(_0x11d136){return respondWithRpcPromise(_0x2c95('0x5f'),'sendMail',_0x11d136,client9003)[_0x2c95('0x16')](function(_0x123085){return _0x13e7dd[_0x2c95('0x2a')]({'read':!![],'messageId':_0x123085[_0x2c95('0x60')],'sentAt':moment()[_0x2c95('0x61')](_0x2c95('0x62'))});})[_0x2c95('0x21')](function(_0x437840){logger[_0x2c95('0x1d')]('%s',JSON[_0x2c95('0x1c')](_0x437840));return _0x13e7dd;});}return _0x13e7dd;});}return _0x13e7dd;}})['then'](respondWithResult(_0xc3391b,0xc9))['catch'](handleError(_0xc3391b,null));};exports[_0x2c95('0x63')]=function(_0x7c121b,_0x1bbb6d){var _0x2b24d4={'agent':{},'channel':_0x2c95('0x64')};if(_0x7c121b[_0x2c95('0x48')]['id']){delete _0x7c121b[_0x2c95('0x48')]['id'];}_0x7c121b['body'][_0x2c95('0x65')]=!![];_0x7c121b['body'][_0x2c95('0x66')]=moment()[_0x2c95('0x61')](_0x2c95('0x62'));_0x7c121b[_0x2c95('0x48')][_0x2c95('0x67')]=_0x7c121b[_0x2c95('0x48')]['UserId']||_0x7c121b['user']['id'];_0x2b24d4[_0x2c95('0x68')]['id']=_0x7c121b[_0x2c95('0x48')]['UserId'];return db[_0x2c95('0x46')]['find']({'where':{'id':_0x7c121b[_0x2c95('0x45')]['id'],'UserId':null}})[_0x2c95('0x16')](handleEntityNotFound(_0x1bbb6d,null))[_0x2c95('0x16')](saveUpdates(_0x7c121b[_0x2c95('0x48')],null))[_0x2c95('0x16')](function(_0x4667a9){if(_0x4667a9){_0x2b24d4['message']=_0x4667a9[_0x2c95('0x69')]({'plain':!![]});return db[_0x2c95('0x6a')][_0x2c95('0x47')]({'where':{'id':_0x4667a9[_0x2c95('0x6b')]}});}return null;})[_0x2c95('0x16')](handleEntityNotFound(_0x1bbb6d,null))[_0x2c95('0x16')](function(_0x3bf94b){if(_0x3bf94b){return _0x3bf94b['update']({'UserId':_0x7c121b['body'][_0x2c95('0x67')],'read1stAt':_['isNil'](_0x3bf94b[_0x2c95('0x6c')])?moment()[_0x2c95('0x61')](_0x2c95('0x62')):undefined});}return null;})[_0x2c95('0x16')](function(_0x235295){if(_0x235295){_0x2b24d4[_0x2c95('0x6d')]=_0x235295[_0x2c95('0x69')]({'plain':!![]});interaction_log['info']('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x7c121b['user']['id'],_0x7c121b[_0x2c95('0x6e')][_0x2c95('0x2c')],_0x7c121b[_0x2c95('0x6e')][_0x2c95('0x6f')],_0x2b24d4[_0x2c95('0x6d')]['id'],_0x7c121b[_0x2c95('0x48')]?JSON[_0x2c95('0x1c')](_0x7c121b[_0x2c95('0x48')]):'null');return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x2b24d4);}return null;})[_0x2c95('0x16')](function(_0x1de27d){var _0x194d3a='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x1de27d['message'][_0x2c95('0x70')];return db[_0x2c95('0x71')]['query'](_0x194d3a,{'type':db[_0x2c95('0x72')][_0x2c95('0x73')][_0x2c95('0x74')],'raw':!![]})[_0x2c95('0x16')](function(_0x3753da){return _0x3753da;});})[_0x2c95('0x16')](function(_0x50e4c6){if(_0x50e4c6){_0x2b24d4[_0x2c95('0x1f')][_0x2c95('0x75')]=_0x50e4c6[0x0];if(!_0x7c121b[_0x2c95('0x48')][_0x2c95('0x67')])return;return db[_0x2c95('0x76')][_0x2c95('0x47')]({'where':{'id':_0x7c121b[_0x2c95('0x48')]['UserId'],'role':'agent'},'attributes':['id',_0x2c95('0x2c'),_0x2c95('0x77'),'email',_0x2c95('0x78')],'raw':!![]});}return null;})[_0x2c95('0x16')](function(_0x3cfdd0){if(!_0x3cfdd0)return null;_0x2b24d4[_0x2c95('0x1f')]['agent']=_0x3cfdd0;return _0x2b24d4;})[_0x2c95('0x16')](function(_0x29e1df){if(_0x29e1df){if(_0x7c121b[_0x2c95('0x48')][_0x2c95('0x79')]){_0x2b24d4[_0x2c95('0x1f')][_0x2c95('0x7a')]=util[_0x2c95('0x61')](_0x2c95('0x7b'),_0x7c121b[_0x2c95('0x6e')][_0x2c95('0x2c')]);_0x2b24d4[_0x2c95('0x1f')][_0x2c95('0x7c')]=_0x2b24d4['channel'];_0x2b24d4[_0x2c95('0x1f')][_0x2c95('0x7d')]=_0x2b24d4[_0x2c95('0x7c')];_0x2b24d4[_0x2c95('0x1f')][_0x2c95('0x7e')]='accept';_0x2b24d4[_0x2c95('0x1f')][_0x2c95('0x48')]=htmlToText['fromString'](_0x2b24d4['message']['body']);return respondWithRpcPromise(_0x2c95('0x7f'),_0x2c95('0x7f'),{'event':'acceptmessage','message':_0x2b24d4[_0x2c95('0x1f')]},client9002)[_0x2c95('0x16')](function(){return _0x2b24d4;});}return _0x2b24d4;}return null;})['then'](respondWithResult(_0x1bbb6d,null))[_0x2c95('0x21')](handleError(_0x1bbb6d,null));};exports['reject']=function(_0x5e30c5,_0x532a73){var _0x368072={'agent':{},'channel':_0x2c95('0x64')};if(_0x5e30c5['body']['id']){delete _0x5e30c5[_0x2c95('0x48')]['id'];}_0x5e30c5['body'][_0x2c95('0x67')]=_0x5e30c5['body'][_0x2c95('0x67')]||_0x5e30c5['user']['id'];_0x368072[_0x2c95('0x68')]['id']=_0x5e30c5[_0x2c95('0x48')][_0x2c95('0x67')];return db['MailMessage'][_0x2c95('0x47')]({'where':{'id':_0x5e30c5[_0x2c95('0x45')]['id'],'UserId':null}})[_0x2c95('0x16')](handleEntityNotFound(_0x532a73,null))[_0x2c95('0x16')](function(_0x3e788c){if(_0x3e788c){_0x368072['message']=_0x3e788c[_0x2c95('0x69')]({'plain':!![]});return db[_0x2c95('0x6a')][_0x2c95('0x47')]({'where':{'id':_0x3e788c[_0x2c95('0x6b')]}});}return null;})[_0x2c95('0x16')](handleEntityNotFound(_0x532a73,null))['then'](function(_0x358fa1){if(_0x358fa1){_0x368072[_0x2c95('0x6d')]=_0x358fa1[_0x2c95('0x69')]({'plain':!![]});interaction_log[_0x2c95('0x17')](_0x2c95('0x80'),_0x5e30c5[_0x2c95('0x6e')]['id'],_0x5e30c5[_0x2c95('0x6e')]['name'],_0x5e30c5[_0x2c95('0x6e')][_0x2c95('0x6f')],_0x368072['interaction']['id'],_0x5e30c5['body']?JSON[_0x2c95('0x1c')](_0x5e30c5[_0x2c95('0x48')]):_0x2c95('0x81'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x368072);}return null;})['then'](function(_0x4f2f15){var _0x9b683a=_0x2c95('0x82')+_0x4f2f15[_0x2c95('0x1f')][_0x2c95('0x70')];return db[_0x2c95('0x71')][_0x2c95('0x32')](_0x9b683a,{'type':db[_0x2c95('0x72')][_0x2c95('0x73')][_0x2c95('0x74')],'raw':!![]})[_0x2c95('0x16')](function(_0x3d9ace){return _0x3d9ace;});})[_0x2c95('0x16')](function(_0x568f1d){if(_0x568f1d){_0x368072['message'][_0x2c95('0x75')]=_0x568f1d[0x0];if(!_0x5e30c5[_0x2c95('0x48')]['UserId'])return;return db[_0x2c95('0x76')]['find']({'where':{'id':_0x5e30c5[_0x2c95('0x48')][_0x2c95('0x67')],'role':_0x2c95('0x68')},'attributes':['id',_0x2c95('0x2c'),_0x2c95('0x77'),_0x2c95('0x83'),_0x2c95('0x78')],'raw':!![]});}return null;})[_0x2c95('0x16')](function(_0x144190){if(!_0x144190)return null;_0x368072[_0x2c95('0x1f')][_0x2c95('0x68')]=_0x144190;return _0x368072;})[_0x2c95('0x16')](function(_0x3030e1){if(_0x3030e1){_0x3030e1[_0x2c95('0x1f')][_0x2c95('0x7a')]=util[_0x2c95('0x61')](_0x2c95('0x7b'),_0x5e30c5['user'][_0x2c95('0x2c')]);_0x3030e1['message'][_0x2c95('0x7c')]=_0x368072[_0x2c95('0x7c')];_0x3030e1[_0x2c95('0x1f')]['motionChannel']=_0x368072[_0x2c95('0x7c')];_0x3030e1[_0x2c95('0x1f')]['event']=_0x2c95('0x84');_0x3030e1[_0x2c95('0x1f')]['body']=htmlToText['fromString'](_0x368072[_0x2c95('0x1f')][_0x2c95('0x48')]);respondWithRpcPromise(_0x2c95('0x7f'),'EventManager',{'event':'rejectmessage','message':_0x3030e1[_0x2c95('0x1f')]},client9002);return _0x368072;}return null;})['then'](respondWithResult(_0x532a73,null))['catch'](handleError(_0x532a73,null));};exports[_0x2c95('0x85')]=function(_0x20b8f3,_0x2ecb7a){var _0x13e38b=moment()['unix']()[_0x2c95('0x86')]();var _0x2f81fe=path[_0x2c95('0x5a')](config['root'],_0x2c95('0x87'),_0x2c95('0x88'),_0x2c95('0x89'));var _0x4539e6=path[_0x2c95('0x5a')](config[_0x2c95('0x8a')],_0x2c95('0x87'),_0x2c95('0x88'),_0x2c95('0x59'));var _0x1ce8d7=util['format']('message-%s.eml',_0x13e38b);return db[_0x2c95('0x46')][_0x2c95('0x47')]({'where':{'id':_0x20b8f3['params']['id']},'attributes':['id',_0x2c95('0x48'),_0x2c95('0x8b'),'to','cc',_0x2c95('0x8c'),_0x2c95('0x8d'),'createdAt'],'include':_0x20b8f3[_0x2c95('0x32')][_0x2c95('0x59')]?[{'model':db[_0x2c95('0x8e')],'as':'Attachments'}]:undefined})['then'](handleEntityNotFound(_0x2ecb7a,null))[_0x2c95('0x16')](function(_0x43a824){if(_0x43a824){var _0x2dd938=_0x43a824;var _0x129f15={'from':_0x2dd938[_0x2c95('0x8b')],'to':_0x2dd938['to'],'subject':_0x2dd938[_0x2c95('0x8d')],'html':htmlEntities[_0x2c95('0x8f')](_0x2dd938[_0x2c95('0x48')]),'headers':{'Date':moment(_0x2dd938[_0x2c95('0x90')])[_0x2c95('0x61')](_0x2c95('0x91'))},'attachments':[]};if(_0x43a824['cc']){_0x129f15[_0x2c95('0x92')]['Cc']=_0x43a824['cc'];}if(_0x43a824[_0x2c95('0x8c')]){_0x129f15[_0x2c95('0x92')][_0x2c95('0x93')]=_0x43a824[_0x2c95('0x8c')];}return new BPromise(function(_0x2c12f0,_0x3eab8b){if(_0x43a824[_0x2c95('0x94')]){for(var _0x4268d8=0x0;_0x4268d8<_0x43a824[_0x2c95('0x94')][_0x2c95('0x38')];_0x4268d8++){var _0x93a37e=_0x43a824[_0x2c95('0x94')][_0x4268d8];var _0xc5c4af=path['join'](_0x4539e6,_0x93a37e[_0x2c95('0x95')]);if(fs[_0x2c95('0x96')](_0xc5c4af)){_0x129f15[_0x2c95('0x59')][_0x2c95('0x97')]({'name':_0x93a37e[_0x2c95('0x2c')],'contentType':_0x93a37e[_0x2c95('0x2e')],'data':fs['readFileSync'](_0xc5c4af)});}}}emlformat[_0x2c95('0x98')](_0x129f15,function(_0x289a35,_0x8fb82c){if(_0x289a35)return _0x3eab8b(_0x289a35);fs[_0x2c95('0x99')](path[_0x2c95('0x5a')](_0x2f81fe,_0x1ce8d7),_0x8fb82c);return _0x2c12f0(_0x8fb82c);});});}})[_0x2c95('0x16')](function(_0x488f7d){if(_0x488f7d){return _0x2ecb7a[_0x2c95('0x85')](path[_0x2c95('0x5a')](_0x2f81fe,_0x1ce8d7),_0x1ce8d7,function(_0x516324){if(!_0x516324)fs[_0x2c95('0x9a')](path[_0x2c95('0x5a')](_0x2f81fe,_0x1ce8d7));});}})['catch'](handleError(_0x2ecb7a,null));}; \ No newline at end of file +var _0x442a=['defaults','localhost','socket.io-emitter','html-entities','./mailMessage.socket','register','jayson/promise','client','http','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','status','json','offset','limit','undefined','count','set','Content-Range','update','destroy','end','sendStatus','stack','name','send','index','MailMessage','fieldName','key','model','map','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','type','VIRTUAL','filter','merge','options','includeAll','include','rows','show','params','rawAttributes','find','body','describe','create','out','secret','split','MailAccount','findOne','CmList','CmContact','Contacts','updatedAt','Smtp','CloudProvider','getSmtpOptions','attachments','join','basename','List','ListId','List\x20not\x20found','sendMail','messageId','YYYY-MM-DD\x20HH:mm:ss','accept','mail','format','UserId','user','agent','get','MailInteraction','MailInteractionId','isNil','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','QueryTypes','SELECT','contact','User','email','internal','manual','interface','channel','motionChannel','event','EventManager','acceptmessage','reject','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','sequelize','Sequelize','fullname','SIP/%s','rejectmessage','server','tmp','root','files','bcc','subject','createdAt','from','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','Attachments','existsSync','readFileSync','writeFileSync','download','unlinkSync','eml-format','moment','bluebird','util','path','lodash','html-to-text','../../config/logger','api','mail-interactions','../../config/environment','redis'];(function(_0x306395,_0x1401df){var _0x5d2d90=function(_0x38e3f3){while(--_0x38e3f3){_0x306395['push'](_0x306395['shift']());}};_0x5d2d90(++_0x1401df);}(_0x442a,0x12e));var _0xa442=function(_0x202d24,_0x5e8641){_0x202d24=_0x202d24-0x0;var _0x2b3a8e=_0x442a[_0x202d24];return _0x2b3a8e;};'use strict';var emlformat=require(_0xa442('0x0'));var moment=require(_0xa442('0x1'));var BPromise=require(_0xa442('0x2'));var util=require(_0xa442('0x3'));var path=require(_0xa442('0x4'));var fs=require('fs');var _=require(_0xa442('0x5'));var Redis=require('ioredis');var htmlToText=require(_0xa442('0x6'));var qs=require('../../components/parsers/qs');var logger=require(_0xa442('0x7'))(_0xa442('0x8'));var interaction_log=require(_0xa442('0x7'))(_0xa442('0x9'));var config=require(_0xa442('0xa'));var db=require('../../mysqldb')['db'];config[_0xa442('0xb')]=_[_0xa442('0xc')](config[_0xa442('0xb')],{'host':_0xa442('0xd'),'port':0x18eb});var socket=require(_0xa442('0xe'))(new Redis(config[_0xa442('0xb')]));var htmlEntities=require(_0xa442('0xf'));require(_0xa442('0x10'))[_0xa442('0x11')](socket);var jayson=require(_0xa442('0x12'));var client=jayson[_0xa442('0x13')][_0xa442('0x14')]({'port':0x232c});var client9003=jayson[_0xa442('0x13')][_0xa442('0x14')]({'port':0x232b});var client9002=jayson[_0xa442('0x13')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4fde86,_0x280c3e,_0x150bb2,_0x232655){return new BPromise(function(_0x3b399a,_0x1a3278){var _0x25cb0c=_0x232655||client;return _0x25cb0c['request'](_0x4fde86,_0x150bb2)[_0xa442('0x15')](function(_0x2f833b){logger[_0xa442('0x16')](_0xa442('0x17'),_0x280c3e,_0xa442('0x18'));logger[_0xa442('0x19')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x280c3e,_0xa442('0x18'),JSON[_0xa442('0x1a')](_0x2f833b));if(_0x2f833b['error']){if(_0x2f833b[_0xa442('0x1b')][_0xa442('0x1c')]===0x1f4){logger[_0xa442('0x1b')](_0xa442('0x17'),_0x280c3e,_0x2f833b['error'][_0xa442('0x1d')]);return _0x1a3278(_0x2f833b[_0xa442('0x1b')][_0xa442('0x1d')]);}logger[_0xa442('0x1b')](_0xa442('0x17'),_0x280c3e,_0x2f833b['error'][_0xa442('0x1d')]);return _0x3b399a(_0x2f833b[_0xa442('0x1b')][_0xa442('0x1d')]);}else{logger[_0xa442('0x16')](_0xa442('0x17'),_0x280c3e,'request\x20sent');_0x3b399a(_0x2f833b[_0xa442('0x1e')][_0xa442('0x1d')]);}})[_0xa442('0x1f')](function(_0x5d779c){logger['error'](_0xa442('0x17'),_0x280c3e,_0x5d779c);_0x1a3278(_0x5d779c);});});}function respondWithResult(_0xdd5cbe,_0x269925){_0x269925=_0x269925||0xc8;return function(_0xf7291e){if(_0xf7291e){return _0xdd5cbe[_0xa442('0x20')](_0x269925)[_0xa442('0x21')](_0xf7291e);}};}function respondWithFilteredResult(_0x4332ca,_0x2c2eb2){return function(_0x30d938){if(_0x30d938){var _0x42ce28=typeof _0x2c2eb2[_0xa442('0x22')]==='undefined'&&typeof _0x2c2eb2[_0xa442('0x23')]===_0xa442('0x24');var _0x23266d=_0x30d938[_0xa442('0x25')];var _0x22ddde=_0x42ce28?0x0:_0x2c2eb2['offset'];var _0x2d6637=_0x42ce28?_0x30d938[_0xa442('0x25')]:_0x2c2eb2[_0xa442('0x22')]+_0x2c2eb2[_0xa442('0x23')];var _0xae3404;if(_0x2d6637>=_0x23266d){_0x2d6637=_0x23266d;_0xae3404=0xc8;}else{_0xae3404=0xce;}_0x4332ca['status'](_0xae3404);return _0x4332ca[_0xa442('0x26')](_0xa442('0x27'),_0x22ddde+'-'+_0x2d6637+'/'+_0x23266d)['json'](_0x30d938);}return null;};}function saveUpdates(_0x296064){return function(_0x30e94c){if(_0x30e94c){return _0x30e94c[_0xa442('0x28')](_0x296064)[_0xa442('0x15')](function(_0x1c92f2){return _0x1c92f2;});}return null;};}function removeEntity(_0x58eae0){return function(_0x4cab30){if(_0x4cab30){return _0x4cab30[_0xa442('0x29')]()['then'](function(){_0x58eae0['status'](0xcc)[_0xa442('0x2a')]();});}};}function handleEntityNotFound(_0x55ce29){return function(_0x18ef86){if(!_0x18ef86){_0x55ce29[_0xa442('0x2b')](0x194);}return _0x18ef86;};}function handleError(_0x45e201,_0x227ed6){_0x227ed6=_0x227ed6||0x1f4;return function(_0x793e74){logger[_0xa442('0x1b')](_0x793e74[_0xa442('0x2c')]);if(_0x793e74[_0xa442('0x2d')]){delete _0x793e74['name'];}_0x45e201[_0xa442('0x20')](_0x227ed6)[_0xa442('0x2e')](_0x793e74);};}exports[_0xa442('0x2f')]=function(_0x9a4c3c,_0x598c82){var _0x566793={},_0x40ec3a={},_0x170ee5={'count':0x0,'rows':[]};var _0x4c6de2=_['map'](db[_0xa442('0x30')]['rawAttributes'],function(_0x4aa6da){return{'name':_0x4aa6da[_0xa442('0x31')],'type':_0x4aa6da['type'][_0xa442('0x32')]};});_0x40ec3a[_0xa442('0x33')]=_[_0xa442('0x34')](_0x4c6de2,_0xa442('0x2d'));_0x40ec3a['query']=_[_0xa442('0x35')](_0x9a4c3c[_0xa442('0x36')]);_0x40ec3a[_0xa442('0x37')]=_['intersection'](_0x40ec3a[_0xa442('0x33')],_0x40ec3a[_0xa442('0x36')]);_0x566793[_0xa442('0x38')]=_[_0xa442('0x39')](_0x40ec3a[_0xa442('0x33')],qs['fields'](_0x9a4c3c[_0xa442('0x36')][_0xa442('0x3a')]));_0x566793['attributes']=_0x566793[_0xa442('0x38')][_0xa442('0x3b')]?_0x566793['attributes']:_0x40ec3a[_0xa442('0x33')];if(!_0x9a4c3c['query'][_0xa442('0x3c')](_0xa442('0x3d'))){_0x566793[_0xa442('0x23')]=qs[_0xa442('0x23')](_0x9a4c3c[_0xa442('0x36')][_0xa442('0x23')]);_0x566793[_0xa442('0x22')]=qs[_0xa442('0x22')](_0x9a4c3c[_0xa442('0x36')][_0xa442('0x22')]);}_0x566793[_0xa442('0x3e')]=qs[_0xa442('0x3f')](_0x9a4c3c[_0xa442('0x36')][_0xa442('0x3f')]);_0x566793[_0xa442('0x40')]=qs[_0xa442('0x37')](_['pick'](_0x9a4c3c[_0xa442('0x36')],_0x40ec3a[_0xa442('0x37')]),_0x4c6de2);if(_0x9a4c3c['query']['filter']){_0x566793[_0xa442('0x40')]=_['merge'](_0x566793[_0xa442('0x40')],{'$or':_[_0xa442('0x34')](_0x4c6de2,function(_0x2e6ee0){if(_0x2e6ee0[_0xa442('0x41')]!==_0xa442('0x42')){var _0x9dd227={};_0x9dd227[_0x2e6ee0[_0xa442('0x2d')]]={'$like':'%'+_0x9a4c3c[_0xa442('0x36')][_0xa442('0x43')]+'%'};return _0x9dd227;}})});}_0x566793=_[_0xa442('0x44')]({},_0x566793,_0x9a4c3c[_0xa442('0x45')]);var _0x2a8dfb={'where':_0x566793['where']};return db[_0xa442('0x30')]['count'](_0x2a8dfb)['then'](function(_0x143c6a){_0x170ee5[_0xa442('0x25')]=_0x143c6a;if(_0x9a4c3c[_0xa442('0x36')][_0xa442('0x46')]){_0x566793[_0xa442('0x47')]=[{'all':!![]}];}return db[_0xa442('0x30')]['findAll'](_0x566793);})[_0xa442('0x15')](function(_0x2773cc){_0x170ee5[_0xa442('0x48')]=_0x2773cc;return _0x170ee5;})[_0xa442('0x15')](respondWithFilteredResult(_0x598c82,_0x566793))[_0xa442('0x1f')](handleError(_0x598c82,null));};exports[_0xa442('0x49')]=function(_0x3efb80,_0x10075d){var _0x2a7a3f={'raw':!![],'where':{'id':_0x3efb80[_0xa442('0x4a')]['id']}},_0x294634={};_0x294634[_0xa442('0x33')]=_['keys'](db['MailMessage'][_0xa442('0x4b')]);_0x294634[_0xa442('0x36')]=_['keys'](_0x3efb80[_0xa442('0x36')]);_0x294634[_0xa442('0x37')]=_[_0xa442('0x39')](_0x294634[_0xa442('0x33')],_0x294634[_0xa442('0x36')]);_0x2a7a3f[_0xa442('0x38')]=_[_0xa442('0x39')](_0x294634[_0xa442('0x33')],qs[_0xa442('0x3a')](_0x3efb80[_0xa442('0x36')][_0xa442('0x3a')]));_0x2a7a3f[_0xa442('0x38')]=_0x2a7a3f['attributes'][_0xa442('0x3b')]?_0x2a7a3f['attributes']:_0x294634[_0xa442('0x33')];if(_0x3efb80['query'][_0xa442('0x46')]){_0x2a7a3f[_0xa442('0x47')]=[{'all':!![]}];}_0x2a7a3f=_[_0xa442('0x44')]({},_0x2a7a3f,_0x3efb80[_0xa442('0x45')]);return db[_0xa442('0x30')][_0xa442('0x4c')](_0x2a7a3f)[_0xa442('0x15')](handleEntityNotFound(_0x10075d,null))[_0xa442('0x15')](respondWithResult(_0x10075d,null))[_0xa442('0x1f')](handleError(_0x10075d,null));};exports[_0xa442('0x28')]=function(_0x9b25b8,_0x4a7c96){if(_0x9b25b8[_0xa442('0x4d')]['id']){delete _0x9b25b8[_0xa442('0x4d')]['id'];}return db['MailMessage'][_0xa442('0x4c')]({'where':{'id':_0x9b25b8[_0xa442('0x4a')]['id']}})[_0xa442('0x15')](handleEntityNotFound(_0x4a7c96,null))[_0xa442('0x15')](saveUpdates(_0x9b25b8['body'],null))[_0xa442('0x15')](respondWithResult(_0x4a7c96,null))[_0xa442('0x1f')](handleError(_0x4a7c96,null));};exports[_0xa442('0x29')]=function(_0x1d7ccf,_0x5d6120){return db[_0xa442('0x30')][_0xa442('0x4c')]({'where':{'id':_0x1d7ccf[_0xa442('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5d6120,null))[_0xa442('0x15')](removeEntity(_0x5d6120,null))[_0xa442('0x1f')](handleError(_0x5d6120,null));};exports[_0xa442('0x4e')]=function(_0x4cf80b,_0x3e2f7e){return db[_0xa442('0x30')][_0xa442('0x4e')]()[_0xa442('0x15')](respondWithResult(_0x3e2f7e,null))[_0xa442('0x1f')](handleError(_0x3e2f7e,null));};exports[_0xa442('0x4f')]=function(_0x4990da,_0x571682){return db[_0xa442('0x30')][_0xa442('0x4f')](_0x4990da[_0xa442('0x4d')])['then'](function(_0x8d8ee6){if(_0x8d8ee6){if(_0x8d8ee6['direction']===_0xa442('0x50')&&!_0x8d8ee6[_0xa442('0x51')]){var _0x32daf9,_0x2fbdd1,_0x1bcc27;if(_0x4990da[_0xa442('0x4d')]['to']){_0x2fbdd1=_0x4990da[_0xa442('0x4d')]['to'][_0xa442('0x52')](',')[0x0];}return db[_0xa442('0x53')][_0xa442('0x54')]({'where':{'id':_0x8d8ee6['MailAccountId']},'include':[{'model':db[_0xa442('0x55')],'as':'List','include':[{'model':db[_0xa442('0x56')],'as':_0xa442('0x57'),'where':{'email':_0x2fbdd1},'limit':0x1,'order':[[_0xa442('0x58'),'DESC']]}]},{'model':db['MailServerOut'],'as':_0xa442('0x59'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xa442('0x5a'),'raw':!![]}]}]})[_0xa442('0x15')](function(_0x327b25){_0x32daf9=_0x327b25;if(!_0x32daf9||!_0x32daf9[_0xa442('0x59')])return;var _0x5e8bba=_0x32daf9[_0xa442('0x5b')]();if(_0x4990da[_0xa442('0x4d')][_0xa442('0x5c')]&&_0x4990da[_0xa442('0x4d')][_0xa442('0x5c')][_0xa442('0x3b')]){for(var _0x35c264=0x0;_0x35c264<_0x4990da['body'][_0xa442('0x5c')][_0xa442('0x3b')];_0x35c264+=0x1){_0x4990da[_0xa442('0x4d')]['attachments'][_0x35c264]={'filename':_0x4990da[_0xa442('0x4d')][_0xa442('0x5c')][_0x35c264][_0xa442('0x2d')],'path':path[_0xa442('0x5d')](config['root'],'server/files/attachments',_0x4990da[_0xa442('0x4d')][_0xa442('0x5c')][_0x35c264][_0xa442('0x5e')])};}}_0x1bcc27={'account':_0x5e8bba,'message':_0x4990da[_0xa442('0x4d')]};return;})[_0xa442('0x15')](function(){if(_0x32daf9[_0xa442('0x5f')]){if(_0x32daf9[_0xa442('0x5f')]['Contacts'][_0xa442('0x3b')]){return _0x32daf9[_0xa442('0x5f')]['Contacts'][0x0];}else{return db[_0xa442('0x56')]['create'](_[_0xa442('0xc')](_0x4990da['body'],{'firstName':_0x4990da[_0xa442('0x4d')]['to'],'email':_0x4990da[_0xa442('0x4d')]['to'],'phone':_0x4990da[_0xa442('0x4d')]['to'],'ListId':_0x32daf9[_0xa442('0x60')]}));}}else{throw new Error(_0xa442('0x61'));}})[_0xa442('0x15')](function(){if(_0x1bcc27){return respondWithRpcPromise('SendMail',_0xa442('0x62'),_0x1bcc27,client9003)[_0xa442('0x15')](function(_0x4a4ccf){return _0x8d8ee6['update']({'read':!![],'messageId':_0x4a4ccf[_0xa442('0x63')],'sentAt':moment()['format'](_0xa442('0x64'))});})['catch'](function(_0x27a91c){logger['error']('%s',JSON[_0xa442('0x1a')](_0x27a91c));return _0x8d8ee6;});}return _0x8d8ee6;});}return _0x8d8ee6;}})[_0xa442('0x15')](respondWithResult(_0x571682,0xc9))[_0xa442('0x1f')](handleError(_0x571682,null));};exports[_0xa442('0x65')]=function(_0x5c4ed5,_0x1af51d){var _0x179dce={'agent':{},'channel':_0xa442('0x66')};if(_0x5c4ed5[_0xa442('0x4d')]['id']){delete _0x5c4ed5[_0xa442('0x4d')]['id'];}_0x5c4ed5[_0xa442('0x4d')]['read']=!![];_0x5c4ed5[_0xa442('0x4d')]['readAt']=moment()[_0xa442('0x67')](_0xa442('0x64'));_0x5c4ed5[_0xa442('0x4d')]['UserId']=_0x5c4ed5[_0xa442('0x4d')][_0xa442('0x68')]||_0x5c4ed5[_0xa442('0x69')]['id'];_0x179dce[_0xa442('0x6a')]['id']=_0x5c4ed5['body']['UserId'];return db[_0xa442('0x30')]['find']({'where':{'id':_0x5c4ed5[_0xa442('0x4a')]['id'],'UserId':null}})[_0xa442('0x15')](handleEntityNotFound(_0x1af51d,null))[_0xa442('0x15')](saveUpdates(_0x5c4ed5[_0xa442('0x4d')],null))[_0xa442('0x15')](function(_0x215b24){if(_0x215b24){_0x179dce['message']=_0x215b24[_0xa442('0x6b')]({'plain':!![]});return db[_0xa442('0x6c')][_0xa442('0x4c')]({'where':{'id':_0x215b24[_0xa442('0x6d')]}});}return null;})[_0xa442('0x15')](handleEntityNotFound(_0x1af51d,null))[_0xa442('0x15')](function(_0x1955ae){if(_0x1955ae){return _0x1955ae[_0xa442('0x28')]({'UserId':_0x5c4ed5[_0xa442('0x4d')][_0xa442('0x68')],'read1stAt':_[_0xa442('0x6e')](_0x1955ae[_0xa442('0x6f')])?moment()[_0xa442('0x67')](_0xa442('0x64')):undefined});}return null;})['then'](function(_0x5f4944){if(_0x5f4944){_0x179dce[_0xa442('0x70')]=_0x5f4944['get']({'plain':!![]});interaction_log[_0xa442('0x16')](_0xa442('0x71'),_0x5c4ed5['user']['id'],_0x5c4ed5[_0xa442('0x69')][_0xa442('0x2d')],_0x5c4ed5['user']['role'],_0x179dce[_0xa442('0x70')]['id'],_0x5c4ed5['body']?JSON['stringify'](_0x5c4ed5[_0xa442('0x4d')]):_0xa442('0x72'));return respondWithRpcPromise(_0xa442('0x73'),_0xa442('0x74'),_0x179dce);}return null;})[_0xa442('0x15')](function(_0x39000e){var _0x332ba8=_0xa442('0x75')+_0x39000e[_0xa442('0x1d')][_0xa442('0x76')];return db['sequelize']['query'](_0x332ba8,{'type':db['Sequelize'][_0xa442('0x77')][_0xa442('0x78')],'raw':!![]})[_0xa442('0x15')](function(_0xc56936){return _0xc56936;});})[_0xa442('0x15')](function(_0x5a32b5){if(_0x5a32b5){_0x179dce[_0xa442('0x1d')][_0xa442('0x79')]=_0x5a32b5[0x0];if(!_0x5c4ed5[_0xa442('0x4d')][_0xa442('0x68')])return;return db[_0xa442('0x7a')][_0xa442('0x4c')]({'where':{'id':_0x5c4ed5['body'][_0xa442('0x68')],'role':'agent'},'attributes':['id','name','fullname',_0xa442('0x7b'),_0xa442('0x7c')],'raw':!![]});}return null;})[_0xa442('0x15')](function(_0x90d6e2){if(!_0x90d6e2)return null;_0x179dce[_0xa442('0x1d')][_0xa442('0x6a')]=_0x90d6e2;return _0x179dce;})['then'](function(_0x4e49e9){if(_0x4e49e9){if(_0x5c4ed5[_0xa442('0x4d')][_0xa442('0x7d')]){_0x179dce[_0xa442('0x1d')][_0xa442('0x7e')]=util['format']('SIP/%s',_0x5c4ed5[_0xa442('0x69')]['name']);_0x179dce[_0xa442('0x1d')][_0xa442('0x7f')]=_0x179dce[_0xa442('0x7f')];_0x179dce[_0xa442('0x1d')][_0xa442('0x80')]=_0x179dce[_0xa442('0x7f')];_0x179dce[_0xa442('0x1d')][_0xa442('0x81')]='accept';_0x179dce[_0xa442('0x1d')][_0xa442('0x4d')]=htmlToText['fromString'](_0x179dce[_0xa442('0x1d')]['body']);return respondWithRpcPromise(_0xa442('0x82'),_0xa442('0x82'),{'event':_0xa442('0x83'),'message':_0x179dce[_0xa442('0x1d')]},client9002)['then'](function(){return _0x179dce;});}return _0x179dce;}return null;})['then'](respondWithResult(_0x1af51d,null))['catch'](handleError(_0x1af51d,null));};exports[_0xa442('0x84')]=function(_0x25f97c,_0x35ee44){var _0x9d6149={'agent':{},'channel':_0xa442('0x66')};if(_0x25f97c['body']['id']){delete _0x25f97c['body']['id'];}_0x25f97c[_0xa442('0x4d')]['UserId']=_0x25f97c[_0xa442('0x4d')]['UserId']||_0x25f97c[_0xa442('0x69')]['id'];_0x9d6149[_0xa442('0x6a')]['id']=_0x25f97c[_0xa442('0x4d')][_0xa442('0x68')];return db[_0xa442('0x30')][_0xa442('0x4c')]({'where':{'id':_0x25f97c[_0xa442('0x4a')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x35ee44,null))['then'](function(_0x3caa9f){if(_0x3caa9f){_0x9d6149[_0xa442('0x1d')]=_0x3caa9f['get']({'plain':!![]});return db[_0xa442('0x6c')][_0xa442('0x4c')]({'where':{'id':_0x3caa9f[_0xa442('0x6d')]}});}return null;})[_0xa442('0x15')](handleEntityNotFound(_0x35ee44,null))[_0xa442('0x15')](function(_0x1a64bc){if(_0x1a64bc){_0x9d6149[_0xa442('0x70')]=_0x1a64bc['get']({'plain':!![]});interaction_log[_0xa442('0x16')](_0xa442('0x85'),_0x25f97c[_0xa442('0x69')]['id'],_0x25f97c['user'][_0xa442('0x2d')],_0x25f97c[_0xa442('0x69')]['role'],_0x9d6149[_0xa442('0x70')]['id'],_0x25f97c[_0xa442('0x4d')]?JSON['stringify'](_0x25f97c['body']):_0xa442('0x72'));return respondWithRpcPromise('RejectMessage',_0xa442('0x86'),_0x9d6149);}return null;})['then'](function(_0x324637){var _0xf42599='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x324637[_0xa442('0x1d')][_0xa442('0x76')];return db[_0xa442('0x87')][_0xa442('0x36')](_0xf42599,{'type':db[_0xa442('0x88')]['QueryTypes'][_0xa442('0x78')],'raw':!![]})[_0xa442('0x15')](function(_0x47b8c7){return _0x47b8c7;});})[_0xa442('0x15')](function(_0x3099c7){if(_0x3099c7){_0x9d6149[_0xa442('0x1d')][_0xa442('0x79')]=_0x3099c7[0x0];if(!_0x25f97c[_0xa442('0x4d')]['UserId'])return;return db[_0xa442('0x7a')][_0xa442('0x4c')]({'where':{'id':_0x25f97c[_0xa442('0x4d')][_0xa442('0x68')],'role':_0xa442('0x6a')},'attributes':['id',_0xa442('0x2d'),_0xa442('0x89'),_0xa442('0x7b'),_0xa442('0x7c')],'raw':!![]});}return null;})[_0xa442('0x15')](function(_0x2a1438){if(!_0x2a1438)return null;_0x9d6149[_0xa442('0x1d')]['agent']=_0x2a1438;return _0x9d6149;})[_0xa442('0x15')](function(_0x584fb8){if(_0x584fb8){_0x584fb8[_0xa442('0x1d')][_0xa442('0x7e')]=util[_0xa442('0x67')](_0xa442('0x8a'),_0x25f97c[_0xa442('0x69')]['name']);_0x584fb8[_0xa442('0x1d')][_0xa442('0x7f')]=_0x9d6149[_0xa442('0x7f')];_0x584fb8['message']['motionChannel']=_0x9d6149['channel'];_0x584fb8[_0xa442('0x1d')][_0xa442('0x81')]='reject';_0x584fb8['message']['body']=htmlToText['fromString'](_0x9d6149[_0xa442('0x1d')]['body']);respondWithRpcPromise(_0xa442('0x82'),_0xa442('0x82'),{'event':_0xa442('0x8b'),'message':_0x584fb8[_0xa442('0x1d')]},client9002);return _0x9d6149;}return null;})[_0xa442('0x15')](respondWithResult(_0x35ee44,null))[_0xa442('0x1f')](handleError(_0x35ee44,null));};exports['download']=function(_0x245011,_0x56d1e5){var _0x1144c5=moment()['unix']()['toString']();var _0x358f39=path[_0xa442('0x5d')](config['root'],_0xa442('0x8c'),'files',_0xa442('0x8d'));var _0x4ffd3a=path[_0xa442('0x5d')](config[_0xa442('0x8e')],_0xa442('0x8c'),_0xa442('0x8f'),_0xa442('0x5c'));var _0x2b38d3=util['format']('message-%s.eml',_0x1144c5);return db[_0xa442('0x30')]['find']({'where':{'id':_0x245011[_0xa442('0x4a')]['id']},'attributes':['id',_0xa442('0x4d'),'from','to','cc',_0xa442('0x90'),_0xa442('0x91'),_0xa442('0x92')],'include':_0x245011[_0xa442('0x36')][_0xa442('0x5c')]?[{'model':db['Attachment'],'as':'Attachments'}]:undefined})['then'](handleEntityNotFound(_0x56d1e5,null))['then'](function(_0x56ce3d){if(_0x56ce3d){var _0x94128=_0x56ce3d;var _0x553f2d={'from':_0x94128[_0xa442('0x93')],'to':_0x94128['to'],'subject':_0x94128[_0xa442('0x91')],'html':htmlEntities['decode'](_0x94128[_0xa442('0x4d')]),'headers':{'Date':moment(_0x94128[_0xa442('0x92')])[_0xa442('0x67')](_0xa442('0x94'))},'attachments':[]};if(_0x56ce3d['cc']){_0x553f2d[_0xa442('0x95')]['Cc']=_0x56ce3d['cc'];}if(_0x56ce3d[_0xa442('0x90')]){_0x553f2d[_0xa442('0x95')][_0xa442('0x96')]=_0x56ce3d[_0xa442('0x90')];}return new BPromise(function(_0x5cffb0,_0x2b81b5){if(_0x56ce3d[_0xa442('0x97')]){for(var _0x4b01f0=0x0;_0x4b01f0<_0x56ce3d[_0xa442('0x97')][_0xa442('0x3b')];_0x4b01f0++){var _0x1113ec=_0x56ce3d[_0xa442('0x97')][_0x4b01f0];var _0x14239f=path['join'](_0x4ffd3a,_0x1113ec[_0xa442('0x5e')]);if(fs[_0xa442('0x98')](_0x14239f)){_0x553f2d['attachments']['push']({'name':_0x1113ec[_0xa442('0x2d')],'contentType':_0x1113ec[_0xa442('0x41')],'data':fs[_0xa442('0x99')](_0x14239f)});}}}emlformat['build'](_0x553f2d,function(_0x1821d0,_0x4785ef){if(_0x1821d0)return _0x2b81b5(_0x1821d0);fs[_0xa442('0x9a')](path[_0xa442('0x5d')](_0x358f39,_0x2b38d3),_0x4785ef);return _0x5cffb0(_0x4785ef);});});}})[_0xa442('0x15')](function(_0x2261ec){if(_0x2261ec){return _0x56d1e5[_0xa442('0x9b')](path[_0xa442('0x5d')](_0x358f39,_0x2b38d3),_0x2b38d3,function(_0x3a23b6){if(!_0x3a23b6)fs[_0xa442('0x9c')](path[_0xa442('0x5d')](_0x358f39,_0x2b38d3));});}})[_0xa442('0x1f')](handleError(_0x56d1e5,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 17ef35f..9d8bfa8 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 _0xfa67=['MailMessage','setMaxListeners','save','update','remove','emit','hook','exports','events'];(function(_0x46538b,_0x281e85){var _0x2328d6=function(_0x2e3973){while(--_0x2e3973){_0x46538b['push'](_0x46538b['shift']());}};_0x2328d6(++_0x281e85);}(_0xfa67,0xf2));var _0x7fa6=function(_0x145c74,_0x54f0cd){_0x145c74=_0x145c74-0x0;var _0x31aa8e=_0xfa67[_0x145c74];return _0x31aa8e;};'use strict';var EventEmitter=require(_0x7fa6('0x0'));var MailMessage=require('../../mysqldb')['db'][_0x7fa6('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x7fa6('0x2')](0x0);var events={'afterCreate':_0x7fa6('0x3'),'afterUpdate':_0x7fa6('0x4'),'afterDestroy':_0x7fa6('0x5')};function emitEvent(_0x167ff3){return function(_0x41a10b,_0x1ffaef,_0x2a5f66){MailMessageEvents[_0x7fa6('0x6')](_0x167ff3+':'+_0x41a10b['id'],_0x41a10b);MailMessageEvents[_0x7fa6('0x6')](_0x167ff3,_0x41a10b);_0x2a5f66(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0x7fa6('0x7')](e,emitEvent(event));}}module[_0x7fa6('0x8')]=MailMessageEvents; \ No newline at end of file +var _0x201f=['../../mysqldb','MailMessage','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x2e8d02,_0x1aea36){var _0x462edc=function(_0xa940b6){while(--_0xa940b6){_0x2e8d02['push'](_0x2e8d02['shift']());}};_0x462edc(++_0x1aea36);}(_0x201f,0x168));var _0xf201=function(_0x2ab58d,_0x263407){_0x2ab58d=_0x2ab58d-0x0;var _0x39b535=_0x201f[_0x2ab58d];return _0x39b535;};'use strict';var EventEmitter=require('events');var MailMessage=require(_0xf201('0x0'))['db'][_0xf201('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xf201('0x2')](0x0);var events={'afterCreate':_0xf201('0x3'),'afterUpdate':'update','afterDestroy':_0xf201('0x4')};function emitEvent(_0xb29083){return function(_0x341203,_0x360ab9,_0x577af1){MailMessageEvents[_0xf201('0x5')](_0xb29083+':'+_0x341203['id'],_0x341203);MailMessageEvents[_0xf201('0x5')](_0xb29083,_0x341203);_0x577af1(null);};}for(var e in events){if(events[_0xf201('0x6')](e)){var event=events[e];MailMessage[_0xf201('0x7')](e,emitEvent(event));}}module[_0xf201('0x8')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 6c4a6ac..9eeb98d 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 _0xa215=['MailMessage','mail_messages','messageId','plainBody','subject','FULLTEXT','body','fromString','models','get','direction','toLowerCase','out','secret','isNil','UserId','findOne','MailInteractionId','then','catch','error','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','request-promise','html-to-text','path','../../config/environment','exports'];(function(_0x2a427c,_0x4a7a54){var _0x30cf97=function(_0x31f451){while(--_0x31f451){_0x2a427c['push'](_0x2a427c['shift']());}};_0x30cf97(++_0x4a7a54);}(_0xa215,0x73));var _0x5a21=function(_0x332005,_0x24edf1){_0x332005=_0x332005-0x0;var _0x4393e1=_0xa215[_0x332005];return _0x4393e1;};'use strict';var _=require(_0x5a21('0x0'));var util=require(_0x5a21('0x1'));var logger=require(_0x5a21('0x2'))('api');var moment=require(_0x5a21('0x3'));var BPromise=require('bluebird');var rp=require(_0x5a21('0x4'));var htmlToText=require(_0x5a21('0x5'));var fs=require('fs');var path=require(_0x5a21('0x6'));var rimraf=require('rimraf');var config=require(_0x5a21('0x7'));var attributes=require('./mailMessage.attributes');module[_0x5a21('0x8')]=function(_0x675613,_0x46f63b){return _0x675613['define'](_0x5a21('0x9'),attributes,{'tableName':_0x5a21('0xa'),'paranoid':![],'indexes':[{'name':_0x5a21('0xb'),'fields':[_0x5a21('0xb')]},{'name':'fti_mail_messages','fields':[_0x5a21('0xc'),_0x5a21('0xd')],'type':_0x5a21('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1fd0fe,_0x54a5a7,_0x2f1405){if(_0x1fd0fe[_0x5a21('0xf')]){_0x1fd0fe[_0x5a21('0xc')]=htmlToText[_0x5a21('0x10')](_0x1fd0fe['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x2f1405(null,_0x54a5a7);},'afterCreate':function(_0x106a9c,_0x25034c,_0x1c5b08){var _0x4e3db3=_0x675613[_0x5a21('0x11')];var _0xcc92c8=_0x106a9c[_0x5a21('0x12')]({'plain':!![]});if(_0xcc92c8[_0x5a21('0x13')][_0x5a21('0x14')]()==='in'||_0xcc92c8[_0x5a21('0x13')][_0x5a21('0x14')]()===_0x5a21('0x15')&&!_0xcc92c8[_0x5a21('0x16')]&&!_[_0x5a21('0x17')](_0xcc92c8[_0x5a21('0x18')])){_0x4e3db3['MailInteraction'][_0x5a21('0x19')]({'where':{'id':_0xcc92c8[_0x5a21('0x1a')]}})[_0x5a21('0x1b')](function(_0x4992da){if(_0x4992da){_0x4992da['update']({'lastMsgAt':_0xcc92c8['createdAt'],'lastMsgDirection':_0xcc92c8['direction']['toLowerCase']()});}})[_0x5a21('0x1c')](function(_0x5b7d55){console[_0x5a21('0x1d')](_0x5b7d55);});}_0x1c5b08();}},'charset':'utf8mb4','collate':_0x5a21('0x1e')});}; \ No newline at end of file +var _0xab6a=['catch','error','lodash','util','api','moment','bluebird','request-promise','html-to-text','path','exports','MailMessage','mail_messages','messageId','fti_mail_messages','subject','FULLTEXT','body','plainBody','fromString','get','direction','toLowerCase','out','isNil','UserId','MailInteraction','findOne','MailInteractionId','update','createdAt'];(function(_0x286bdc,_0x2f6be4){var _0x56689e=function(_0x5386d2){while(--_0x5386d2){_0x286bdc['push'](_0x286bdc['shift']());}};_0x56689e(++_0x2f6be4);}(_0xab6a,0xfa));var _0xaab6=function(_0x33596e,_0x5d33ff){_0x33596e=_0x33596e-0x0;var _0x4040d3=_0xab6a[_0x33596e];return _0x4040d3;};'use strict';var _=require(_0xaab6('0x0'));var util=require(_0xaab6('0x1'));var logger=require('../../config/logger')(_0xaab6('0x2'));var moment=require(_0xaab6('0x3'));var BPromise=require(_0xaab6('0x4'));var rp=require(_0xaab6('0x5'));var htmlToText=require(_0xaab6('0x6'));var fs=require('fs');var path=require(_0xaab6('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./mailMessage.attributes');module[_0xaab6('0x8')]=function(_0x1fbf9a,_0x2cf4fd){return _0x1fbf9a['define'](_0xaab6('0x9'),attributes,{'tableName':_0xaab6('0xa'),'paranoid':![],'indexes':[{'name':_0xaab6('0xb'),'fields':[_0xaab6('0xb')]},{'name':_0xaab6('0xc'),'fields':['plainBody',_0xaab6('0xd')],'type':_0xaab6('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1f064d,_0x149212,_0x458b45){if(_0x1f064d[_0xaab6('0xf')]){_0x1f064d[_0xaab6('0x10')]=htmlToText[_0xaab6('0x11')](_0x1f064d[_0xaab6('0xf')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x458b45(null,_0x149212);},'afterCreate':function(_0x53f4bf,_0x394db1,_0x3eac80){var _0xf303bf=_0x1fbf9a['models'];var _0x1600d7=_0x53f4bf[_0xaab6('0x12')]({'plain':!![]});if(_0x1600d7[_0xaab6('0x13')]['toLowerCase']()==='in'||_0x1600d7[_0xaab6('0x13')][_0xaab6('0x14')]()===_0xaab6('0x15')&&!_0x1600d7['secret']&&!_[_0xaab6('0x16')](_0x1600d7[_0xaab6('0x17')])){_0xf303bf[_0xaab6('0x18')][_0xaab6('0x19')]({'where':{'id':_0x1600d7[_0xaab6('0x1a')]}})['then'](function(_0x5bb79a){if(_0x5bb79a){_0x5bb79a[_0xaab6('0x1b')]({'lastMsgAt':_0x1600d7[_0xaab6('0x1c')],'lastMsgDirection':_0x1600d7[_0xaab6('0x13')]['toLowerCase']()});}})[_0xaab6('0x1d')](function(_0xded600){console[_0xaab6('0x1e')](_0xded600);});}_0x3eac80();}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index e6353cb..cb08e8c 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 _0x84a0=['lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./mailMessage.socket','register','request','then','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','MailMessage,\x20%s,\x20%s','message','info','result','catch','CreateMailMessage','MailMessage','create','body','options','raw'];(function(_0xca4821,_0x3b632a){var _0x30a79c=function(_0x13ba8a){while(--_0x13ba8a){_0xca4821['push'](_0xca4821['shift']());}};_0x30a79c(++_0x3b632a);}(_0x84a0,0x66));var _0x084a=function(_0x264de4,_0x41f555){_0x264de4=_0x264de4-0x0;var _0x4e004e=_0x84a0[_0x264de4];return _0x4e004e;};'use strict';var _=require(_0x084a('0x0'));var util=require(_0x084a('0x1'));var moment=require(_0x084a('0x2'));var BPromise=require(_0x084a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x084a('0x4'));var db=require(_0x084a('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x084a('0x6'));var config=require(_0x084a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x084a('0x8')][_0x084a('0x9')]({'port':0x232a});config[_0x084a('0xa')]=_[_0x084a('0xb')](config[_0x084a('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x084a('0xc'))(new Redis(config[_0x084a('0xa')]));require(_0x084a('0xd'))[_0x084a('0xe')](socket);function respondWithRpcPromise(_0x142127,_0x4c1e29,_0x4dd423){return new BPromise(function(_0x3d9dc6,_0x853df){return client[_0x084a('0xf')](_0x142127,_0x4dd423)[_0x084a('0x10')](function(_0x2d7c90){logger['info']('MailMessage,\x20%s,\x20%s',_0x4c1e29,_0x084a('0x11'));logger[_0x084a('0x12')](_0x084a('0x13'),_0x4c1e29,_0x084a('0x11'),JSON[_0x084a('0x14')](_0x2d7c90));if(_0x2d7c90[_0x084a('0x15')]){if(_0x2d7c90[_0x084a('0x15')][_0x084a('0x16')]===0x1f4){logger['error'](_0x084a('0x17'),_0x4c1e29,_0x2d7c90['error'][_0x084a('0x18')]);return _0x853df(_0x2d7c90[_0x084a('0x15')][_0x084a('0x18')]);}logger[_0x084a('0x15')](_0x084a('0x17'),_0x4c1e29,_0x2d7c90['error'][_0x084a('0x18')]);return _0x3d9dc6(_0x2d7c90['error'][_0x084a('0x18')]);}else{logger[_0x084a('0x19')]('MailMessage,\x20%s,\x20%s',_0x4c1e29,_0x084a('0x11'));_0x3d9dc6(_0x2d7c90[_0x084a('0x1a')][_0x084a('0x18')]);}})[_0x084a('0x1b')](function(_0x33d3a6){logger[_0x084a('0x15')](_0x084a('0x17'),_0x4c1e29,_0x33d3a6);_0x853df(_0x33d3a6);});});}exports[_0x084a('0x1c')]=function(_0x3f60cf){var _0xcb5356=this;return new Promise(function(_0x3c7fd6,_0x279e25){return db[_0x084a('0x1d')][_0x084a('0x1e')](_0x3f60cf[_0x084a('0x1f')],{'raw':_0x3f60cf['options']?_0x3f60cf[_0x084a('0x20')][_0x084a('0x21')]===undefined?!![]:![]:!![]})[_0x084a('0x10')](function(_0x2d62bf){logger[_0x084a('0x19')]('CreateMailMessage',_0x3f60cf);logger[_0x084a('0x12')](_0x084a('0x1c'),_0x3f60cf,JSON[_0x084a('0x14')](_0x2d62bf));_0x3c7fd6(_0x2d62bf);})[_0x084a('0x1b')](function(_0x18b43d){logger[_0x084a('0x15')]('CreateMailMessage',_0x18b43d[_0x084a('0x18')],_0x3f60cf);_0x279e25(_0xcb5356[_0x084a('0x15')](0x1f4,_0x18b43d[_0x084a('0x18')]));});});}; \ No newline at end of file +var _0xed3c=['request','then','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','CreateMailMessage','MailMessage','options','raw','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','localhost','register'];(function(_0x3dfeae,_0x519ab9){var _0x241056=function(_0x1156ee){while(--_0x1156ee){_0x3dfeae['push'](_0x3dfeae['shift']());}};_0x241056(++_0x519ab9);}(_0xed3c,0x1a6));var _0xced3=function(_0x178f27,_0x26e5b0){_0x178f27=_0x178f27-0x0;var _0x1bef17=_0xed3c[_0x178f27];return _0x1bef17;};'use strict';var _=require(_0xced3('0x0'));var util=require(_0xced3('0x1'));var moment=require(_0xced3('0x2'));var BPromise=require(_0xced3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xced3('0x4'));var db=require(_0xced3('0x5'))['db'];var utils=require(_0xced3('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xced3('0x7'));var jayson=require(_0xced3('0x8'));var client=jayson[_0xced3('0x9')][_0xced3('0xa')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0xced3('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./mailMessage.socket')[_0xced3('0xc')](socket);function respondWithRpcPromise(_0x321c42,_0x3e5a04,_0x12612f){return new BPromise(function(_0x1cb639,_0x5934b2){return client[_0xced3('0xd')](_0x321c42,_0x12612f)[_0xced3('0xe')](function(_0x3da0ff){logger['info'](_0xced3('0xf'),_0x3e5a04,_0xced3('0x10'));logger[_0xced3('0x11')](_0xced3('0x12'),_0x3e5a04,_0xced3('0x10'),JSON[_0xced3('0x13')](_0x3da0ff));if(_0x3da0ff[_0xced3('0x14')]){if(_0x3da0ff['error'][_0xced3('0x15')]===0x1f4){logger['error'](_0xced3('0xf'),_0x3e5a04,_0x3da0ff[_0xced3('0x14')][_0xced3('0x16')]);return _0x5934b2(_0x3da0ff[_0xced3('0x14')]['message']);}logger[_0xced3('0x14')](_0xced3('0xf'),_0x3e5a04,_0x3da0ff['error'][_0xced3('0x16')]);return _0x1cb639(_0x3da0ff[_0xced3('0x14')][_0xced3('0x16')]);}else{logger[_0xced3('0x17')]('MailMessage,\x20%s,\x20%s',_0x3e5a04,_0xced3('0x10'));_0x1cb639(_0x3da0ff['result'][_0xced3('0x16')]);}})[_0xced3('0x18')](function(_0x32c402){logger[_0xced3('0x14')](_0xced3('0xf'),_0x3e5a04,_0x32c402);_0x5934b2(_0x32c402);});});}exports[_0xced3('0x19')]=function(_0xe0cf2e){var _0x16d30d=this;return new Promise(function(_0x3f688c,_0x17c011){return db[_0xced3('0x1a')]['create'](_0xe0cf2e['body'],{'raw':_0xe0cf2e['options']?_0xe0cf2e[_0xced3('0x1b')][_0xced3('0x1c')]===undefined?!![]:![]:!![]})[_0xced3('0xe')](function(_0x4bf915){logger[_0xced3('0x17')](_0xced3('0x19'),_0xe0cf2e);logger['debug']('CreateMailMessage',_0xe0cf2e,JSON[_0xced3('0x13')](_0x4bf915));_0x3f688c(_0x4bf915);})[_0xced3('0x18')](function(_0x219fa8){logger[_0xced3('0x14')]('CreateMailMessage',_0x219fa8[_0xced3('0x16')],_0xe0cf2e);_0x17c011(_0x16d30d[_0xced3('0x14')](0x1f4,_0x219fa8['message']));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index bf17fb8..46d7186 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 _0x6d8d=['register','length','mailMessage:','./mailMessage.events','remove','removeListener'];(function(_0x1da496,_0x5e8dcb){var _0x252b54=function(_0x358fe0){while(--_0x358fe0){_0x1da496['push'](_0x1da496['shift']());}};_0x252b54(++_0x5e8dcb);}(_0x6d8d,0x1cb));var _0xd6d8=function(_0x4d058c,_0x1e122d){_0x4d058c=_0x4d058c-0x0;var _0x5a4974=_0x6d8d[_0x4d058c];return _0x5a4974;};'use strict';var MailMessageEvents=require(_0xd6d8('0x0'));var events=['save',_0xd6d8('0x1'),'update'];function createListener(_0x44d21f,_0x4fdadc){return function(_0x48f568){_0x4fdadc['emit'](_0x44d21f,_0x48f568);};}function removeListener(_0x155811,_0x30f9f5){return function(){MailMessageEvents[_0xd6d8('0x2')](_0x155811,_0x30f9f5);};}exports[_0xd6d8('0x3')]=function(_0x129807){for(var _0x398013=0x0,_0x357527=events[_0xd6d8('0x4')];_0x398013<_0x357527;_0x398013++){var _0x3ff801=events[_0x398013];var _0x712dd=createListener(_0xd6d8('0x5')+_0x3ff801,_0x129807);MailMessageEvents['on'](_0x3ff801,_0x712dd);}}; \ No newline at end of file +var _0xdd89=['length','./mailMessage.events','save','remove','update','removeListener','register'];(function(_0x3b894c,_0x5947c3){var _0xd62ab0=function(_0x3e5203){while(--_0x3e5203){_0x3b894c['push'](_0x3b894c['shift']());}};_0xd62ab0(++_0x5947c3);}(_0xdd89,0xc5));var _0x9dd8=function(_0x291d3f,_0x3ef99f){_0x291d3f=_0x291d3f-0x0;var _0x242080=_0xdd89[_0x291d3f];return _0x242080;};'use strict';var MailMessageEvents=require(_0x9dd8('0x0'));var events=[_0x9dd8('0x1'),_0x9dd8('0x2'),_0x9dd8('0x3')];function createListener(_0x2d663f,_0x2373b2){return function(_0x588dfa){_0x2373b2['emit'](_0x2d663f,_0x588dfa);};}function removeListener(_0x318a66,_0x3b1c8e){return function(){MailMessageEvents[_0x9dd8('0x4')](_0x318a66,_0x3b1c8e);};}exports[_0x9dd8('0x5')]=function(_0x29fb5c){for(var _0x2be577=0x0,_0x3ebe31=events[_0x9dd8('0x6')];_0x2be577<_0x3ebe31;_0x2be577++){var _0x4198fe=events[_0x2be577];var _0xd2480b=createListener('mailMessage:'+_0x4198fe,_0x29fb5c);MailMessageEvents['on'](_0x4198fe,_0xd2480b);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index e3e8c4f..79a0907 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 _0x7baa=['/:id','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated'];(function(_0x24c7de,_0x1faed6){var _0x1a769c=function(_0x22bb25){while(--_0x22bb25){_0x24c7de['push'](_0x24c7de['shift']());}};_0x1a769c(++_0x1faed6);}(_0x7baa,0x101));var _0xa7ba=function(_0xfb0281,_0x3ff38b){_0xfb0281=_0xfb0281-0x0;var _0x408dd3=_0x7baa[_0xfb0281];return _0x408dd3;};'use strict';var multer=require(_0xa7ba('0x0'));var util=require(_0xa7ba('0x1'));var path=require(_0xa7ba('0x2'));var timeout=require(_0xa7ba('0x3'));var express=require(_0xa7ba('0x4'));var router=express[_0xa7ba('0x5')]();var fs_extra=require(_0xa7ba('0x6'));var auth=require(_0xa7ba('0x7'));var interaction=require(_0xa7ba('0x8'));var config=require(_0xa7ba('0x9'));var controller=require(_0xa7ba('0xa'));router[_0xa7ba('0xb')]('/',auth[_0xa7ba('0xc')](),controller['index']);router['get']('/describe',auth[_0xa7ba('0xc')](),controller['describe']);router[_0xa7ba('0xb')](_0xa7ba('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xa7ba('0xb')]('/:id/members',auth['isAuthenticated'](),controller['getMembers']);router['get'](_0xa7ba('0xe'),auth['isAuthenticated'](),controller[_0xa7ba('0xf')]);router[_0xa7ba('0xb')](_0xa7ba('0x10'),auth[_0xa7ba('0xc')](),controller[_0xa7ba('0x11')]);router[_0xa7ba('0x12')]('/',auth[_0xa7ba('0xc')](),controller[_0xa7ba('0x13')]);router[_0xa7ba('0x12')]('/:id/teams',auth[_0xa7ba('0xc')](),controller[_0xa7ba('0x14')]);router[_0xa7ba('0x12')](_0xa7ba('0x10'),auth[_0xa7ba('0xc')](),controller[_0xa7ba('0x15')]);router[_0xa7ba('0x16')](_0xa7ba('0xd'),auth[_0xa7ba('0xc')](),controller[_0xa7ba('0x17')]);router[_0xa7ba('0x18')](_0xa7ba('0xd'),auth['isAuthenticated'](),controller[_0xa7ba('0x19')]);router['delete'](_0xa7ba('0xe'),auth[_0xa7ba('0xc')](),controller['removeTeams']);router[_0xa7ba('0x18')](_0xa7ba('0x10'),auth[_0xa7ba('0xc')](),controller['removeAgents']);module[_0xa7ba('0x1a')]=router; \ No newline at end of file +var _0x0776=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','/describe','/:id/members','getTeams','/:id/users','create','/:id/teams','addTeams','addAgents','put','/:id','delete','destroy','multer','util','path','connect-timeout'];(function(_0x8fa43e,_0x2d1d8a){var _0x56e470=function(_0x288ef3){while(--_0x288ef3){_0x8fa43e['push'](_0x8fa43e['shift']());}};_0x56e470(++_0x2d1d8a);}(_0x0776,0xbc));var _0x6077=function(_0x4b1d73,_0x34151e){_0x4b1d73=_0x4b1d73-0x0;var _0xff413d=_0x0776[_0x4b1d73];return _0xff413d;};'use strict';var multer=require(_0x6077('0x0'));var util=require(_0x6077('0x1'));var path=require(_0x6077('0x2'));var timeout=require(_0x6077('0x3'));var express=require(_0x6077('0x4'));var router=express[_0x6077('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x6077('0x6'));var interaction=require(_0x6077('0x7'));var config=require(_0x6077('0x8'));var controller=require(_0x6077('0x9'));router[_0x6077('0xa')]('/',auth[_0x6077('0xb')](),controller['index']);router[_0x6077('0xa')](_0x6077('0xc'),auth[_0x6077('0xb')](),controller['describe']);router['get']('/:id',auth[_0x6077('0xb')](),controller['show']);router[_0x6077('0xa')](_0x6077('0xd'),auth[_0x6077('0xb')](),controller['getMembers']);router[_0x6077('0xa')]('/:id/teams',auth[_0x6077('0xb')](),controller[_0x6077('0xe')]);router[_0x6077('0xa')](_0x6077('0xf'),auth[_0x6077('0xb')](),controller['getAgents']);router['post']('/',auth['isAuthenticated'](),controller[_0x6077('0x10')]);router['post'](_0x6077('0x11'),auth[_0x6077('0xb')](),controller[_0x6077('0x12')]);router['post']('/:id/users',auth['isAuthenticated'](),controller[_0x6077('0x13')]);router[_0x6077('0x14')](_0x6077('0x15'),auth[_0x6077('0xb')](),controller['update']);router[_0x6077('0x16')](_0x6077('0x15'),auth[_0x6077('0xb')](),controller[_0x6077('0x17')]);router[_0x6077('0x16')](_0x6077('0x11'),auth['isAuthenticated'](),controller['removeTeams']);router[_0x6077('0x16')]('/:id/users',auth[_0x6077('0xb')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index de5d50f..26cd0cc 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 _0x7adc=['INTEGER','ENUM','rrmemory','roundrobin','sequelize','exports','name','STRING'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x7adc,0xdc));var _0xc7ad=function(_0x6dd5c,_0x4bfc19){_0x6dd5c=_0x6dd5c-0x0;var _0x5a87fa=_0x7adc[_0x6dd5c];return _0x5a87fa;};'use strict';var Sequelize=require(_0xc7ad('0x0'));module[_0xc7ad('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xc7ad('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xc7ad('0x3')]},'timeout':{'type':Sequelize[_0xc7ad('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc7ad('0x5')](_0xc7ad('0x6'),'beepall',_0xc7ad('0x7'))}}; \ No newline at end of file +var _0x8a87=['sequelize','name','STRING','INTEGER','roundrobin'];(function(_0x34996c,_0x4491e3){var _0xa6e0d5=function(_0x1c613e){while(--_0x1c613e){_0x34996c['push'](_0x34996c['shift']());}};_0xa6e0d5(++_0x4491e3);}(_0x8a87,0x19f));var _0x78a8=function(_0x229b99,_0xb6a166){_0x229b99=_0x229b99-0x0;var _0x13e10c=_0x8a87[_0x229b99];return _0x13e10c;};'use strict';var Sequelize=require(_0x78a8('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x78a8('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x78a8('0x2')]},'timeout':{'type':Sequelize[_0x78a8('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory','beepall',_0x78a8('0x4'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index e403999..d945744 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 _0xb781=['Agents','online','voicePause','interface','flatMap','sequelize','transaction','forEach','userMailQueue:save','removeTeams','select','tq.TeamId','from','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','compact','value','removeAgents','emit','userMailQueue:remove','addAgents','spread','findOne','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','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','redis','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','end','status','json','offset','undefined','count','limit','set','reject','save','update','destroy','then','get','MailQueues','UserProfileResource','error','stack','index','map','MailQueue','fieldName','key','model','query','filters','intersection','attributes','fields','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','name','options','includeAll','findAll','rows','catch','show','keys','length','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','params','describe','getMembers','UserMailQueue','rawAttributes','hasOwnProperty','User','findAndCountAll','UserId','mailPause','format','SIP','createdAt','updatedAt','getTeams','Team','addTeams','ids'];(function(_0x5bef0a,_0x1fb747){var _0x1a02ea=function(_0x51cc55){while(--_0x51cc55){_0x5bef0a['push'](_0x5bef0a['shift']());}};_0x1a02ea(++_0x1fb747);}(_0xb781,0x134));var _0x1b78=function(_0x23a846,_0xcf27ce){_0x23a846=_0x23a846-0x0;var _0x57b332=_0xb781[_0x23a846];return _0x57b332;};'use strict';var emlformat=require(_0x1b78('0x0'));var rimraf=require(_0x1b78('0x1'));var zipdir=require(_0x1b78('0x2'));var jsonpatch=require(_0x1b78('0x3'));var rp=require('request-promise');var moment=require(_0x1b78('0x4'));var BPromise=require(_0x1b78('0x5'));var Mustache=require(_0x1b78('0x6'));var util=require('util');var path=require(_0x1b78('0x7'));var sox=require(_0x1b78('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1b78('0x9'));var squel=require(_0x1b78('0xa'));var crypto=require(_0x1b78('0xb'));var jsforce=require(_0x1b78('0xc'));var deskjs=require(_0x1b78('0xd'));var toCsv=require(_0x1b78('0xe'));var querystring=require(_0x1b78('0xf'));var Papa=require(_0x1b78('0x10'));var Redis=require(_0x1b78('0x11'));var authService=require(_0x1b78('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1b78('0x13'));var logger=require(_0x1b78('0x14'))(_0x1b78('0x15'));var utils=require(_0x1b78('0x16'));var config=require(_0x1b78('0x17'));var licenseUtil=require(_0x1b78('0x18'));var db=require(_0x1b78('0x19'))['db'];config[_0x1b78('0x1a')]=_['defaults'](config['redis'],{'host':_0x1b78('0x1b'),'port':0x18eb});var socket=require(_0x1b78('0x1c'))(new Redis(config[_0x1b78('0x1a')]));require(_0x1b78('0x1d'))[_0x1b78('0x1e')](socket);function respondWithStatusCode(_0x5ad282,_0x8c4ad6){_0x8c4ad6=_0x8c4ad6||0xcc;return function(_0x2d79e4){if(_0x2d79e4){return _0x5ad282[_0x1b78('0x1f')](_0x8c4ad6);}return _0x5ad282['status'](_0x8c4ad6)[_0x1b78('0x20')]();};}function respondWithResult(_0x135162,_0x3a2b30){_0x3a2b30=_0x3a2b30||0xc8;return function(_0x569027){if(_0x569027){return _0x135162[_0x1b78('0x21')](_0x3a2b30)[_0x1b78('0x22')](_0x569027);}};}function respondWithFilteredResult(_0x5cc97f,_0x50972f){return function(_0x59d165){if(_0x59d165){var _0x4200c1=typeof _0x50972f[_0x1b78('0x23')]==='undefined'&&typeof _0x50972f['limit']===_0x1b78('0x24');var _0x5b37bc=_0x59d165[_0x1b78('0x25')];var _0x443d76=_0x4200c1?0x0:_0x50972f[_0x1b78('0x23')];var _0x5eef98=_0x4200c1?_0x59d165[_0x1b78('0x25')]:_0x50972f['offset']+_0x50972f[_0x1b78('0x26')];var _0x22570d;if(_0x5eef98>=_0x5b37bc){_0x5eef98=_0x5b37bc;_0x22570d=0xc8;}else{_0x22570d=0xce;}_0x5cc97f[_0x1b78('0x21')](_0x22570d);return _0x5cc97f[_0x1b78('0x27')]('Content-Range',_0x443d76+'-'+_0x5eef98+'/'+_0x5b37bc)['json'](_0x59d165);}return null;};}function patchUpdates(_0x4a3246){return function(_0x298292){try{jsonpatch['apply'](_0x298292,_0x4a3246,!![]);}catch(_0x3b3822){return BPromise[_0x1b78('0x28')](_0x3b3822);}return _0x298292[_0x1b78('0x29')]();};}function saveUpdates(_0x5ce2e5,_0xcc1c5b){return function(_0x9b0a0a){if(_0x9b0a0a){return _0x9b0a0a[_0x1b78('0x2a')](_0x5ce2e5)['then'](function(_0x7dd860){return _0x7dd860;});}return null;};}function removeEntity(_0x4c6bc2,_0x102bcc){return function(_0x26722c){if(_0x26722c){return _0x26722c[_0x1b78('0x2b')]()[_0x1b78('0x2c')](function(){var _0x2b4191=_0x26722c[_0x1b78('0x2d')]({'plain':!![]});var _0x2f89d7=_0x1b78('0x2e');return db[_0x1b78('0x2f')]['destroy']({'where':{'type':_0x2f89d7,'resourceId':_0x2b4191['id']}})[_0x1b78('0x2c')](function(){return _0x26722c;});})['then'](function(){_0x4c6bc2[_0x1b78('0x21')](0xcc)[_0x1b78('0x20')]();});}};}function handleEntityNotFound(_0x5a8b6f,_0x14b936){return function(_0x5908af){if(!_0x5908af){_0x5a8b6f['sendStatus'](0x194);}return _0x5908af;};}function handleError(_0x27257c,_0x935822){_0x935822=_0x935822||0x1f4;return function(_0x47c172){logger[_0x1b78('0x30')](_0x47c172[_0x1b78('0x31')]);if(_0x47c172['name']){delete _0x47c172['name'];}_0x27257c[_0x1b78('0x21')](_0x935822)['send'](_0x47c172);};}exports[_0x1b78('0x32')]=function(_0x14259c,_0x19e9b9){var _0x47c26e={},_0x557df3={},_0x90b5ec={'count':0x0,'rows':[]};var _0x1d1303=_[_0x1b78('0x33')](db[_0x1b78('0x34')]['rawAttributes'],function(_0x5ce224){return{'name':_0x5ce224[_0x1b78('0x35')],'type':_0x5ce224['type'][_0x1b78('0x36')]};});_0x557df3[_0x1b78('0x37')]=_[_0x1b78('0x33')](_0x1d1303,'name');_0x557df3[_0x1b78('0x38')]=_['keys'](_0x14259c[_0x1b78('0x38')]);_0x557df3[_0x1b78('0x39')]=_[_0x1b78('0x3a')](_0x557df3[_0x1b78('0x37')],_0x557df3[_0x1b78('0x38')]);_0x47c26e[_0x1b78('0x3b')]=_[_0x1b78('0x3a')](_0x557df3['model'],qs[_0x1b78('0x3c')](_0x14259c[_0x1b78('0x38')][_0x1b78('0x3c')]));_0x47c26e['attributes']=_0x47c26e[_0x1b78('0x3b')]['length']?_0x47c26e['attributes']:_0x557df3[_0x1b78('0x37')];if(!_0x14259c[_0x1b78('0x38')]['hasOwnProperty'](_0x1b78('0x3d'))){_0x47c26e['limit']=qs[_0x1b78('0x26')](_0x14259c['query'][_0x1b78('0x26')]);_0x47c26e[_0x1b78('0x23')]=qs[_0x1b78('0x23')](_0x14259c[_0x1b78('0x38')][_0x1b78('0x23')]);}_0x47c26e[_0x1b78('0x3e')]=qs[_0x1b78('0x3f')](_0x14259c[_0x1b78('0x38')][_0x1b78('0x3f')]);_0x47c26e['where']=qs['filters'](_[_0x1b78('0x40')](_0x14259c[_0x1b78('0x38')],_0x557df3['filters']),_0x1d1303);if(_0x14259c[_0x1b78('0x38')][_0x1b78('0x41')]){_0x47c26e[_0x1b78('0x42')]=_[_0x1b78('0x43')](_0x47c26e[_0x1b78('0x42')],{'$or':_['map'](_0x1d1303,function(_0x2391a0){if(_0x2391a0[_0x1b78('0x44')]!==_0x1b78('0x45')){var _0x3609ae={};_0x3609ae[_0x2391a0[_0x1b78('0x46')]]={'$like':'%'+_0x14259c[_0x1b78('0x38')][_0x1b78('0x41')]+'%'};return _0x3609ae;}})});}_0x47c26e=_[_0x1b78('0x43')]({},_0x47c26e,_0x14259c[_0x1b78('0x47')]);var _0x157de0={'where':_0x47c26e['where']};return db[_0x1b78('0x34')][_0x1b78('0x25')](_0x157de0)[_0x1b78('0x2c')](function(_0xb0e77a){_0x90b5ec[_0x1b78('0x25')]=_0xb0e77a;if(_0x14259c['query'][_0x1b78('0x48')]){_0x47c26e['include']=[{'all':!![]}];}return db[_0x1b78('0x34')][_0x1b78('0x49')](_0x47c26e);})[_0x1b78('0x2c')](function(_0x5005d3){_0x90b5ec[_0x1b78('0x4a')]=_0x5005d3;return _0x90b5ec;})[_0x1b78('0x2c')](respondWithFilteredResult(_0x19e9b9,_0x47c26e))[_0x1b78('0x4b')](handleError(_0x19e9b9,null));};exports[_0x1b78('0x4c')]=function(_0x5237b9,_0x2ebadf){var _0x145cb1={'raw':!![],'where':{'id':_0x5237b9['params']['id']}},_0x27ca90={};_0x27ca90[_0x1b78('0x37')]=_[_0x1b78('0x4d')](db[_0x1b78('0x34')]['rawAttributes']);_0x27ca90['query']=_[_0x1b78('0x4d')](_0x5237b9[_0x1b78('0x38')]);_0x27ca90[_0x1b78('0x39')]=_[_0x1b78('0x3a')](_0x27ca90[_0x1b78('0x37')],_0x27ca90['query']);_0x145cb1[_0x1b78('0x3b')]=_[_0x1b78('0x3a')](_0x27ca90['model'],qs['fields'](_0x5237b9[_0x1b78('0x38')][_0x1b78('0x3c')]));_0x145cb1['attributes']=_0x145cb1[_0x1b78('0x3b')][_0x1b78('0x4e')]?_0x145cb1['attributes']:_0x27ca90[_0x1b78('0x37')];if(_0x5237b9[_0x1b78('0x38')][_0x1b78('0x48')]){_0x145cb1[_0x1b78('0x4f')]=[{'all':!![]}];}_0x145cb1=_['merge']({},_0x145cb1,_0x5237b9[_0x1b78('0x47')]);return db[_0x1b78('0x34')][_0x1b78('0x50')](_0x145cb1)[_0x1b78('0x2c')](handleEntityNotFound(_0x2ebadf,null))['then'](respondWithResult(_0x2ebadf,null))[_0x1b78('0x4b')](handleError(_0x2ebadf,null));};exports[_0x1b78('0x51')]=function(_0x5ce937,_0x1f1967){return db[_0x1b78('0x34')][_0x1b78('0x51')](_0x5ce937[_0x1b78('0x52')],{})['then'](function(_0x35c93a){var _0x1b9e74=_0x5ce937[_0x1b78('0x53')][_0x1b78('0x2d')]({'plain':!![]});if(!_0x1b9e74)throw new Error(_0x1b78('0x54'));if(_0x1b9e74['role']==='user'){var _0x373d5e=_0x35c93a[_0x1b78('0x2d')]({'plain':!![]});var _0x4365e9='MailQueues';return db[_0x1b78('0x55')][_0x1b78('0x50')]({'where':{'name':_0x4365e9,'userProfileId':_0x1b9e74[_0x1b78('0x56')]},'raw':!![]})[_0x1b78('0x2c')](function(_0x51676e){if(_0x51676e&&_0x51676e[_0x1b78('0x57')]===0x0){return db[_0x1b78('0x2f')]['create']({'name':_0x373d5e[_0x1b78('0x46')],'resourceId':_0x373d5e['id'],'type':_0x51676e['name'],'sectionId':_0x51676e['id']},{})[_0x1b78('0x2c')](function(){return _0x35c93a;});}else{return _0x35c93a;}})['catch'](function(_0x478590){logger[_0x1b78('0x30')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x478590);throw _0x478590;});}return _0x35c93a;})[_0x1b78('0x2c')](respondWithResult(_0x1f1967,0xc9))[_0x1b78('0x4b')](handleError(_0x1f1967,null));};exports['update']=function(_0x34150a,_0xa2afcc){if(_0x34150a[_0x1b78('0x52')]['id']){delete _0x34150a['body']['id'];}return db[_0x1b78('0x34')][_0x1b78('0x50')]({'where':{'id':_0x34150a[_0x1b78('0x58')]['id']}})[_0x1b78('0x2c')](handleEntityNotFound(_0xa2afcc,null))['then'](saveUpdates(_0x34150a['body'],null))[_0x1b78('0x2c')](respondWithResult(_0xa2afcc,null))[_0x1b78('0x4b')](handleError(_0xa2afcc,null));};exports[_0x1b78('0x2b')]=function(_0x29b52f,_0x8db5d2){return db['MailQueue'][_0x1b78('0x50')]({'where':{'id':_0x29b52f['params']['id']}})['then'](handleEntityNotFound(_0x8db5d2,null))[_0x1b78('0x2c')](removeEntity(_0x8db5d2,null))['catch'](handleError(_0x8db5d2,null));};exports[_0x1b78('0x59')]=function(_0x142329,_0x1bf587){return db[_0x1b78('0x34')][_0x1b78('0x59')]()[_0x1b78('0x2c')](respondWithResult(_0x1bf587,null))[_0x1b78('0x4b')](handleError(_0x1bf587,null));};exports[_0x1b78('0x5a')]=function(_0x3b0437,_0x242d1d,_0x496d52){var _0x98ca18={'raw':!![],'where':{}},_0xc1e792={},_0x2b75e1;return db[_0x1b78('0x34')]['findOne']({'where':{'id':_0x3b0437['params']['id']}})[_0x1b78('0x2c')](handleEntityNotFound(_0x242d1d,null))['then'](function(_0x2a3c82){if(_0x2a3c82){_0x2b75e1=_0x2a3c82['get']({'plain':!![]});_0xc1e792[_0x1b78('0x37')]=_['keys'](db[_0x1b78('0x5b')][_0x1b78('0x5c')]);_0xc1e792['query']=_[_0x1b78('0x4d')](_0x3b0437['query']);_0xc1e792[_0x1b78('0x39')]=_[_0x1b78('0x3a')](_0xc1e792[_0x1b78('0x37')],_0xc1e792['query']);_0x98ca18[_0x1b78('0x3b')]=_['intersection'](_0xc1e792[_0x1b78('0x37')],qs[_0x1b78('0x3c')](_0x3b0437['query'][_0x1b78('0x3c')]));_0x98ca18[_0x1b78('0x3b')]=_0x98ca18[_0x1b78('0x3b')][_0x1b78('0x4e')]?_0x98ca18[_0x1b78('0x3b')]:_0xc1e792[_0x1b78('0x37')];if(!_0x3b0437['query'][_0x1b78('0x5d')]('nolimit')){_0x98ca18[_0x1b78('0x26')]=qs[_0x1b78('0x26')](_0x3b0437[_0x1b78('0x38')][_0x1b78('0x26')]);_0x98ca18[_0x1b78('0x23')]=qs[_0x1b78('0x23')](_0x3b0437[_0x1b78('0x38')][_0x1b78('0x23')]);}_0x98ca18['order']=qs[_0x1b78('0x3f')](_0x3b0437[_0x1b78('0x38')][_0x1b78('0x3f')]);_0x98ca18['where']=qs[_0x1b78('0x39')](_[_0x1b78('0x40')](_0x3b0437['query'],_0xc1e792[_0x1b78('0x39')]));_0x98ca18[_0x1b78('0x42')]['MailQueueId']=_0x2a3c82['id'];if(_0x3b0437[_0x1b78('0x38')]['filter']){_0x98ca18[_0x1b78('0x42')]=_[_0x1b78('0x43')](_0x98ca18[_0x1b78('0x42')],{'$or':_[_0x1b78('0x33')](_0x98ca18['attributes'],function(_0x512c47){var _0x3cf104={};_0x3cf104[_0x512c47]={'$like':'%'+_0x3b0437[_0x1b78('0x38')][_0x1b78('0x41')]+'%'};return _0x3cf104;})});}_0x98ca18=_[_0x1b78('0x43')]({},_0x98ca18,_0x3b0437[_0x1b78('0x47')]);return db[_0x1b78('0x5b')][_0x1b78('0x49')](_0x98ca18);}})[_0x1b78('0x2c')](function(_0x43635a){if(_0x43635a){return db[_0x1b78('0x5e')][_0x1b78('0x5f')]({'where':{'id':_[_0x1b78('0x33')](_0x43635a,_0x1b78('0x60')),'role':'agent'},'attributes':['id','name',_0x1b78('0x61'),'updatedAt','createdAt']});}})[_0x1b78('0x2c')](function(_0x5b2132){if(_0x5b2132){return{'count':_0x5b2132[_0x1b78('0x25')],'rows':_['map'](_0x5b2132[_0x1b78('0x4a')],function(_0x22e6f8){return{'membername':_0x22e6f8[_0x1b78('0x46')],'UserId':_0x22e6f8['id'],'queue_name':_0x2b75e1[_0x1b78('0x46')],'MailQueueId':_0x2b75e1['id'],'interface':util[_0x1b78('0x62')]('%s/%s',_0x1b78('0x63'),_0x22e6f8['name']),'penalty':0x0,'paused':_0x22e6f8['mailPause'],'createdAt':_0x22e6f8[_0x1b78('0x64')],'updatedAt':_0x22e6f8[_0x1b78('0x65')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x242d1d,_0x98ca18))['catch'](handleError(_0x242d1d,null));};exports[_0x1b78('0x66')]=function(_0x1f8508,_0x3ce107,_0x21da74){var _0x1911cc={};var _0x1b94bf={};var _0x3e4ca7;var _0x529181;return db[_0x1b78('0x34')]['findOne']({'where':{'id':_0x1f8508[_0x1b78('0x58')]['id']}})['then'](handleEntityNotFound(_0x3ce107,null))['then'](function(_0x31b313){if(_0x31b313){_0x3e4ca7=_0x31b313;_0x1b94bf[_0x1b78('0x37')]=_['keys'](db[_0x1b78('0x67')]['rawAttributes']);_0x1b94bf[_0x1b78('0x38')]=_[_0x1b78('0x4d')](_0x1f8508[_0x1b78('0x38')]);_0x1b94bf['filters']=_['intersection'](_0x1b94bf[_0x1b78('0x37')],_0x1b94bf[_0x1b78('0x38')]);_0x1911cc['attributes']=_['intersection'](_0x1b94bf[_0x1b78('0x37')],qs[_0x1b78('0x3c')](_0x1f8508[_0x1b78('0x38')][_0x1b78('0x3c')]));_0x1911cc[_0x1b78('0x3b')]=_0x1911cc[_0x1b78('0x3b')][_0x1b78('0x4e')]?_0x1911cc[_0x1b78('0x3b')]:_0x1b94bf[_0x1b78('0x37')];_0x1911cc[_0x1b78('0x3e')]=qs[_0x1b78('0x3f')](_0x1f8508[_0x1b78('0x38')]['sort']);_0x1911cc[_0x1b78('0x42')]=qs['filters'](_[_0x1b78('0x40')](_0x1f8508[_0x1b78('0x38')],_0x1b94bf[_0x1b78('0x39')]));if(_0x1f8508[_0x1b78('0x38')][_0x1b78('0x41')]){_0x1911cc[_0x1b78('0x42')]=_['merge'](_0x1911cc['where'],{'$or':_['map'](_0x1911cc[_0x1b78('0x3b')],function(_0x213255){var _0x296d3e={};_0x296d3e[_0x213255]={'$like':'%'+_0x1f8508['query'][_0x1b78('0x41')]+'%'};return _0x296d3e;})});}_0x1911cc=_[_0x1b78('0x43')]({},_0x1911cc,_0x1f8508[_0x1b78('0x47')]);return _0x3e4ca7['getTeams'](_0x1911cc);}})[_0x1b78('0x2c')](function(_0x3100e6){if(_0x3100e6){_0x529181=_0x3100e6[_0x1b78('0x4e')];if(!_0x1f8508['query'][_0x1b78('0x5d')](_0x1b78('0x3d'))){_0x1911cc[_0x1b78('0x26')]=qs[_0x1b78('0x26')](_0x1f8508[_0x1b78('0x38')][_0x1b78('0x26')]);_0x1911cc[_0x1b78('0x23')]=qs[_0x1b78('0x23')](_0x1f8508[_0x1b78('0x38')]['offset']);}return _0x3e4ca7[_0x1b78('0x66')](_0x1911cc);}})['then'](function(_0x29706f){if(_0x29706f){return _0x29706f?{'count':_0x529181,'rows':_0x29706f}:null;}})['then'](respondWithResult(_0x3ce107,null))[_0x1b78('0x4b')](handleError(_0x3ce107,null));};exports[_0x1b78('0x68')]=function(_0x4e0a61,_0x1a3fce,_0x1623b8){var _0x228f99=_0x4e0a61['body'][_0x1b78('0x69')];return db['Team'][_0x1b78('0x49')]({'where':{'id':_0x228f99},'attributes':['id'],'include':[{'model':db['User'],'as':_0x1b78('0x6a'),'attributes':['id',_0x1b78('0x46'),_0x1b78('0x6b'),_0x1b78('0x6c'),_0x1b78('0x6d')],'raw':!![]}]})[_0x1b78('0x2c')](function(_0x40a47d){if(_0x40a47d){var _0x48ccc8=_[_0x1b78('0x6e')](_0x40a47d,function(_0xd8ceae){var _0xa327d4=_0xd8ceae[_0x1b78('0x2d')]({'plain':!![]});return _0xa327d4[_0x1b78('0x6a')];});return db[_0x1b78('0x34')][_0x1b78('0x50')]({'where':{'id':_0x4e0a61[_0x1b78('0x58')]['id']}})[_0x1b78('0x2c')](function(_0x48f65c){return db[_0x1b78('0x6f')][_0x1b78('0x70')](function(_0x14b82a){return _0x48f65c[_0x1b78('0x68')](_0x228f99,{'transaction':_0x14b82a})[_0x1b78('0x2c')](function(){return BPromise['each'](_0x48ccc8,function(_0xca3082){return db[_0x1b78('0x5b')]['findOrCreate']({'where':{'UserId':_0xca3082['id'],'MailQueueId':_0x4e0a61[_0x1b78('0x58')]['id']},'transaction':_0x14b82a});});})[_0x1b78('0x2c')](function(){_0x48ccc8[_0x1b78('0x71')](function(_0x5d3a01){socket['emit'](_0x1b78('0x72'),{'UserId':_0x5d3a01['id'],'MailQueueId':_0x48f65c['id']});});});});});}})[_0x1b78('0x2c')](respondWithStatusCode(_0x1a3fce,null))[_0x1b78('0x4b')](handleError(_0x1a3fce,null));};exports[_0x1b78('0x73')]=function(_0x4c7949,_0x5052ce,_0x2b1942){return db[_0x1b78('0x67')]['findAll']({'where':{'id':_0x4c7949[_0x1b78('0x38')]['ids']},'attributes':['id'],'include':[{'model':db[_0x1b78('0x5e')],'as':_0x1b78('0x6a'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x5052ce,null))['then'](function(_0x137c7a){var _0x375986=_[_0x1b78('0x33')](_0x137c7a,'id');var _0x46cd15=[];var _0x403067=[];var _0x4e958d=squel[_0x1b78('0x74')]();_0x4e958d['field'](_0x1b78('0x75'))[_0x1b78('0x76')]('team_has_mail_queues','tq')['join']('user_has_teams','ut',_0x1b78('0x77'))['where'](_0x1b78('0x78'),_0x4c7949[_0x1b78('0x58')]['id']);for(var _0x2ce7d3=0x0;_0x2ce7d3<_0x137c7a[_0x1b78('0x4e')];_0x2ce7d3+=0x1){let _0x53c1ea=_0x137c7a[_0x2ce7d3];for(var _0x1ba925=0x0;_0x1ba925<_0x53c1ea[_0x1b78('0x6a')][_0x1b78('0x4e')];_0x1ba925+=0x1){let _0x365fb0=_0x53c1ea['Agents'][_0x1ba925];var _0x44ab96=_0x4e958d['clone']();_0x44ab96[_0x1b78('0x42')](_0x1b78('0x79'),_0x365fb0['id']);_0x403067[_0x1b78('0x7a')](db['sequelize'][_0x1b78('0x38')](_0x44ab96[_0x1b78('0x7b')](),{'type':db[_0x1b78('0x6f')][_0x1b78('0x7c')][_0x1b78('0x7d')]})['then'](function(_0x1cc669){if(_0x1cc669[_0x1b78('0x4e')]===0x1){return _0x365fb0['id'];}else{var _0x6109e8=_[_0x1b78('0x7e')](_[_0x1b78('0x33')](_0x1cc669,_0x1b78('0x7f')),function(_0x4738bb){return _['includes'](_0x375986,_0x4738bb);});if(_0x6109e8){return _0x365fb0['id'];}}}));}}return BPromise[_0x1b78('0x80')](_0x403067)['then'](function(_0x3aef77){_0x46cd15=_(_0x46cd15)['union'](_0x3aef77)[_0x1b78('0x81')]()[_0x1b78('0x82')]();return db[_0x1b78('0x34')][_0x1b78('0x50')]({'where':{'id':_0x4c7949[_0x1b78('0x58')]['id']}})[_0x1b78('0x2c')](function(_0x55bd73){return db[_0x1b78('0x6f')][_0x1b78('0x70')](function(_0x4b4734){return _0x55bd73[_0x1b78('0x73')](_0x4c7949[_0x1b78('0x38')][_0x1b78('0x69')],{'transaction':_0x4b4734})[_0x1b78('0x2c')](function(){if(!_['isEmpty'](_0x46cd15)){return _0x55bd73[_0x1b78('0x83')](_0x46cd15,{'transaction':_0x4b4734});}})['then'](function(){_0x46cd15['forEach'](function(_0x50b3b0){socket[_0x1b78('0x84')](_0x1b78('0x85'),{'UserId':_0x50b3b0,'MailQueueId':_0x55bd73['id']});});});});});});})[_0x1b78('0x2c')](respondWithStatusCode(_0x5052ce,null))[_0x1b78('0x4b')](handleError(_0x5052ce,null));};exports[_0x1b78('0x86')]=function(_0x4e7ead,_0x156e55,_0x33a38e){return db['MailQueue']['find']({'where':{'id':_0x4e7ead[_0x1b78('0x58')]['id']}})[_0x1b78('0x2c')](handleEntityNotFound(_0x156e55,null))['then'](function(_0xfb745f){if(_0xfb745f){return _0xfb745f[_0x1b78('0x86')](_0x4e7ead['body'][_0x1b78('0x69')],_['omit'](_0x4e7ead['body'],[_0x1b78('0x69'),'id'])||{})[_0x1b78('0x87')](function(_0x1ee978){for(var _0x5acf21=0x0;_0x5acf21<_0x4e7ead[_0x1b78('0x52')][_0x1b78('0x69')][_0x1b78('0x4e')];_0x5acf21+=0x1){socket[_0x1b78('0x84')](_0x1b78('0x72'),{'UserId':Number(_0x4e7ead[_0x1b78('0x52')][_0x1b78('0x69')][_0x5acf21]),'MailQueueId':Number(_0x4e7ead[_0x1b78('0x58')]['id'])});}return _0x1ee978;});}})['then'](respondWithResult(_0x156e55,null))[_0x1b78('0x4b')](handleError(_0x156e55,null));};exports['removeAgents']=function(_0x2bd7ea,_0x3a5e7b,_0x289d34){return db[_0x1b78('0x34')][_0x1b78('0x50')]({'where':{'id':_0x2bd7ea[_0x1b78('0x58')]['id']}})[_0x1b78('0x2c')](handleEntityNotFound(_0x3a5e7b,null))['then'](function(_0x14c5c4){if(_0x14c5c4){return _0x14c5c4['removeAgents'](_0x2bd7ea[_0x1b78('0x38')][_0x1b78('0x69')])['then'](function(){if(_['isArray'](_0x2bd7ea['query'][_0x1b78('0x69')])){for(var _0x42f151=0x0;_0x42f151<_0x2bd7ea[_0x1b78('0x38')][_0x1b78('0x69')][_0x1b78('0x4e')];_0x42f151+=0x1){socket[_0x1b78('0x84')](_0x1b78('0x85'),{'UserId':Number(_0x2bd7ea[_0x1b78('0x38')][_0x1b78('0x69')][_0x42f151]),'MailQueueId':Number(_0x2bd7ea[_0x1b78('0x58')]['id'])});}}else{socket[_0x1b78('0x84')]('userMailQueue:remove',{'UserId':Number(_0x2bd7ea[_0x1b78('0x38')]['ids']),'MailQueueId':Number(_0x2bd7ea[_0x1b78('0x58')]['id'])});}});}})[_0x1b78('0x2c')](respondWithStatusCode(_0x3a5e7b,null))[_0x1b78('0x4b')](handleError(_0x3a5e7b,null));};exports['getAgents']=function(_0x2def81,_0x5b9070,_0x1440bc){var _0x2f3337={};var _0x53093d={};var _0xde61b0;var _0x43964e;return db['MailQueue'][_0x1b78('0x88')]({'where':{'id':_0x2def81[_0x1b78('0x58')]['id']}})['then'](handleEntityNotFound(_0x5b9070,null))[_0x1b78('0x2c')](function(_0xecd4fb){if(_0xecd4fb){_0xde61b0=_0xecd4fb;_0x53093d['model']=_['keys'](db[_0x1b78('0x5e')][_0x1b78('0x5c')]);_0x53093d[_0x1b78('0x38')]=_[_0x1b78('0x4d')](_0x2def81[_0x1b78('0x38')]);_0x53093d[_0x1b78('0x39')]=_[_0x1b78('0x3a')](_0x53093d[_0x1b78('0x37')],_0x53093d['query']);_0x2f3337[_0x1b78('0x3b')]=_[_0x1b78('0x3a')](_0x53093d['model'],qs[_0x1b78('0x3c')](_0x2def81[_0x1b78('0x38')]['fields']));_0x2f3337[_0x1b78('0x3b')]=_0x2f3337['attributes'][_0x1b78('0x4e')]?_0x2f3337[_0x1b78('0x3b')]:_0x53093d[_0x1b78('0x37')];_0x2f3337[_0x1b78('0x3e')]=qs[_0x1b78('0x3f')](_0x2def81['query'][_0x1b78('0x3f')]);_0x2f3337[_0x1b78('0x42')]=qs[_0x1b78('0x39')](_['pick'](_0x2def81[_0x1b78('0x38')],_0x53093d[_0x1b78('0x39')]));if(_0x2def81[_0x1b78('0x38')]['filter']){_0x2f3337['where']=_[_0x1b78('0x43')](_0x2f3337[_0x1b78('0x42')],{'$or':_[_0x1b78('0x33')](_0x2f3337['attributes'],function(_0x414fb9){var _0x3142ad={};_0x3142ad[_0x414fb9]={'$like':'%'+_0x2def81[_0x1b78('0x38')][_0x1b78('0x41')]+'%'};return _0x3142ad;})});}_0x2f3337=_[_0x1b78('0x43')]({},_0x2f3337,_0x2def81[_0x1b78('0x47')]);return _0xde61b0['getAgents'](_0x2f3337);}})[_0x1b78('0x2c')](function(_0x3320e2){if(_0x3320e2){_0x43964e=_0x3320e2[_0x1b78('0x4e')];if(!_0x2def81[_0x1b78('0x38')]['hasOwnProperty'](_0x1b78('0x3d'))){_0x2f3337['limit']=qs[_0x1b78('0x26')](_0x2def81[_0x1b78('0x38')]['limit']);_0x2f3337[_0x1b78('0x23')]=qs[_0x1b78('0x23')](_0x2def81['query'][_0x1b78('0x23')]);}return _0xde61b0[_0x1b78('0x89')](_0x2f3337);}})[_0x1b78('0x2c')](function(_0x2acfd7){if(_0x2acfd7){return _0x2acfd7?{'count':_0x43964e,'rows':_0x2acfd7}:null;}})[_0x1b78('0x2c')](respondWithResult(_0x5b9070,null))[_0x1b78('0x4b')](handleError(_0x5b9070,null));}; \ No newline at end of file +var _0x899a=['%s/%s','SIP','mailPause','getTeams','findOne','addTeams','Agents','online','voicePause','flatMap','sequelize','transaction','forEach','emit','userMailQueue:save','removeTeams','Team','ids','select','from','team_has_mail_queues','join','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','TeamId','includes','all','union','removeAgents','userMailQueue:remove','omit','spread','isArray','getAgents','eml-format','rimraf','fast-json-patch','request-promise','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','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','offset','limit','count','set','json','apply','save','update','then','destroy','get','MailQueues','UserProfileResource','end','error','stack','name','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','filter','options','includeAll','MailQueue','findAll','rows','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserMailQueue','MailQueueId','User','findAndCountAll','UserId','agent','updatedAt','createdAt','format'];(function(_0xaf0a75,_0x1813c2){var _0x2cb448=function(_0x59db76){while(--_0x59db76){_0xaf0a75['push'](_0xaf0a75['shift']());}};_0x2cb448(++_0x1813c2);}(_0x899a,0x1b6));var _0xa899=function(_0x572947,_0x236e91){_0x572947=_0x572947-0x0;var _0xe69e66=_0x899a[_0x572947];return _0xe69e66;};'use strict';var emlformat=require(_0xa899('0x0'));var rimraf=require(_0xa899('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa899('0x2'));var rp=require(_0xa899('0x3'));var moment=require('moment');var BPromise=require(_0xa899('0x4'));var Mustache=require(_0xa899('0x5'));var util=require(_0xa899('0x6'));var path=require(_0xa899('0x7'));var sox=require('sox');var csv=require(_0xa899('0x8'));var ejs=require(_0xa899('0x9'));var fs=require('fs');var fs_extra=require(_0xa899('0xa'));var _=require(_0xa899('0xb'));var squel=require('squel');var crypto=require(_0xa899('0xc'));var jsforce=require(_0xa899('0xd'));var deskjs=require(_0xa899('0xe'));var toCsv=require(_0xa899('0x8'));var querystring=require(_0xa899('0xf'));var Papa=require(_0xa899('0x10'));var Redis=require(_0xa899('0x11'));var authService=require(_0xa899('0x12'));var qs=require(_0xa899('0x13'));var as=require(_0xa899('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa899('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xa899('0x16'))['db'];config[_0xa899('0x17')]=_[_0xa899('0x18')](config['redis'],{'host':_0xa899('0x19'),'port':0x18eb});var socket=require(_0xa899('0x1a'))(new Redis(config['redis']));require(_0xa899('0x1b'))[_0xa899('0x1c')](socket);function respondWithStatusCode(_0x104b42,_0xc05259){_0xc05259=_0xc05259||0xcc;return function(_0x5cb055){if(_0x5cb055){return _0x104b42[_0xa899('0x1d')](_0xc05259);}return _0x104b42[_0xa899('0x1e')](_0xc05259)['end']();};}function respondWithResult(_0xf809a7,_0x252611){_0x252611=_0x252611||0xc8;return function(_0x152d42){if(_0x152d42){return _0xf809a7['status'](_0x252611)['json'](_0x152d42);}};}function respondWithFilteredResult(_0x72e6b7,_0x373f68){return function(_0x3e8da5){if(_0x3e8da5){var _0x1ee1a8=typeof _0x373f68[_0xa899('0x1f')]==='undefined'&&typeof _0x373f68[_0xa899('0x20')]==='undefined';var _0x32882d=_0x3e8da5[_0xa899('0x21')];var _0x57a2b1=_0x1ee1a8?0x0:_0x373f68[_0xa899('0x1f')];var _0x1b4c9d=_0x1ee1a8?_0x3e8da5[_0xa899('0x21')]:_0x373f68[_0xa899('0x1f')]+_0x373f68[_0xa899('0x20')];var _0x5d7269;if(_0x1b4c9d>=_0x32882d){_0x1b4c9d=_0x32882d;_0x5d7269=0xc8;}else{_0x5d7269=0xce;}_0x72e6b7[_0xa899('0x1e')](_0x5d7269);return _0x72e6b7[_0xa899('0x22')]('Content-Range',_0x57a2b1+'-'+_0x1b4c9d+'/'+_0x32882d)[_0xa899('0x23')](_0x3e8da5);}return null;};}function patchUpdates(_0x224d45){return function(_0xbc9131){try{jsonpatch[_0xa899('0x24')](_0xbc9131,_0x224d45,!![]);}catch(_0x3453cd){return BPromise['reject'](_0x3453cd);}return _0xbc9131[_0xa899('0x25')]();};}function saveUpdates(_0x35983f,_0x9797e){return function(_0x5100b3){if(_0x5100b3){return _0x5100b3[_0xa899('0x26')](_0x35983f)[_0xa899('0x27')](function(_0xdacfa4){return _0xdacfa4;});}return null;};}function removeEntity(_0x5ae02f,_0x306fc8){return function(_0x1431ca){if(_0x1431ca){return _0x1431ca[_0xa899('0x28')]()[_0xa899('0x27')](function(){var _0x3d108c=_0x1431ca[_0xa899('0x29')]({'plain':!![]});var _0x3cecb3=_0xa899('0x2a');return db[_0xa899('0x2b')][_0xa899('0x28')]({'where':{'type':_0x3cecb3,'resourceId':_0x3d108c['id']}})['then'](function(){return _0x1431ca;});})['then'](function(){_0x5ae02f[_0xa899('0x1e')](0xcc)[_0xa899('0x2c')]();});}};}function handleEntityNotFound(_0x4cd259,_0x5d0362){return function(_0xcd9ced){if(!_0xcd9ced){_0x4cd259[_0xa899('0x1d')](0x194);}return _0xcd9ced;};}function handleError(_0x5d4134,_0x3591fa){_0x3591fa=_0x3591fa||0x1f4;return function(_0x125117){logger[_0xa899('0x2d')](_0x125117[_0xa899('0x2e')]);if(_0x125117[_0xa899('0x2f')]){delete _0x125117[_0xa899('0x2f')];}_0x5d4134['status'](_0x3591fa)['send'](_0x125117);};}exports['index']=function(_0x3b537b,_0x403199){var _0x35d25f={},_0x3421cc={},_0x575e6a={'count':0x0,'rows':[]};var _0x191877=_[_0xa899('0x30')](db['MailQueue'][_0xa899('0x31')],function(_0x4faaea){return{'name':_0x4faaea[_0xa899('0x32')],'type':_0x4faaea[_0xa899('0x33')]['key']};});_0x3421cc[_0xa899('0x34')]=_['map'](_0x191877,_0xa899('0x2f'));_0x3421cc[_0xa899('0x35')]=_[_0xa899('0x36')](_0x3b537b[_0xa899('0x35')]);_0x3421cc[_0xa899('0x37')]=_[_0xa899('0x38')](_0x3421cc[_0xa899('0x34')],_0x3421cc[_0xa899('0x35')]);_0x35d25f[_0xa899('0x39')]=_[_0xa899('0x38')](_0x3421cc['model'],qs[_0xa899('0x3a')](_0x3b537b[_0xa899('0x35')][_0xa899('0x3a')]));_0x35d25f['attributes']=_0x35d25f[_0xa899('0x39')][_0xa899('0x3b')]?_0x35d25f[_0xa899('0x39')]:_0x3421cc['model'];if(!_0x3b537b[_0xa899('0x35')][_0xa899('0x3c')](_0xa899('0x3d'))){_0x35d25f['limit']=qs[_0xa899('0x20')](_0x3b537b[_0xa899('0x35')][_0xa899('0x20')]);_0x35d25f[_0xa899('0x1f')]=qs[_0xa899('0x1f')](_0x3b537b[_0xa899('0x35')][_0xa899('0x1f')]);}_0x35d25f[_0xa899('0x3e')]=qs[_0xa899('0x3f')](_0x3b537b[_0xa899('0x35')][_0xa899('0x3f')]);_0x35d25f['where']=qs['filters'](_[_0xa899('0x40')](_0x3b537b[_0xa899('0x35')],_0x3421cc[_0xa899('0x37')]),_0x191877);if(_0x3b537b[_0xa899('0x35')]['filter']){_0x35d25f[_0xa899('0x41')]=_[_0xa899('0x42')](_0x35d25f[_0xa899('0x41')],{'$or':_[_0xa899('0x30')](_0x191877,function(_0x11f56b){if(_0x11f56b[_0xa899('0x33')]!=='VIRTUAL'){var _0x4ad78f={};_0x4ad78f[_0x11f56b['name']]={'$like':'%'+_0x3b537b[_0xa899('0x35')][_0xa899('0x43')]+'%'};return _0x4ad78f;}})});}_0x35d25f=_[_0xa899('0x42')]({},_0x35d25f,_0x3b537b[_0xa899('0x44')]);var _0x26d2aa={'where':_0x35d25f['where']};return db['MailQueue'][_0xa899('0x21')](_0x26d2aa)[_0xa899('0x27')](function(_0x5a4921){_0x575e6a[_0xa899('0x21')]=_0x5a4921;if(_0x3b537b[_0xa899('0x35')][_0xa899('0x45')]){_0x35d25f['include']=[{'all':!![]}];}return db[_0xa899('0x46')][_0xa899('0x47')](_0x35d25f);})[_0xa899('0x27')](function(_0x558406){_0x575e6a[_0xa899('0x48')]=_0x558406;return _0x575e6a;})['then'](respondWithFilteredResult(_0x403199,_0x35d25f))[_0xa899('0x49')](handleError(_0x403199,null));};exports[_0xa899('0x4a')]=function(_0x11af3f,_0x1cac6e){var _0x766bcc={'raw':!![],'where':{'id':_0x11af3f[_0xa899('0x4b')]['id']}},_0x1948e9={};_0x1948e9[_0xa899('0x34')]=_[_0xa899('0x36')](db[_0xa899('0x46')][_0xa899('0x31')]);_0x1948e9[_0xa899('0x35')]=_[_0xa899('0x36')](_0x11af3f[_0xa899('0x35')]);_0x1948e9[_0xa899('0x37')]=_[_0xa899('0x38')](_0x1948e9[_0xa899('0x34')],_0x1948e9['query']);_0x766bcc['attributes']=_[_0xa899('0x38')](_0x1948e9[_0xa899('0x34')],qs[_0xa899('0x3a')](_0x11af3f[_0xa899('0x35')][_0xa899('0x3a')]));_0x766bcc[_0xa899('0x39')]=_0x766bcc[_0xa899('0x39')][_0xa899('0x3b')]?_0x766bcc['attributes']:_0x1948e9[_0xa899('0x34')];if(_0x11af3f[_0xa899('0x35')][_0xa899('0x45')]){_0x766bcc['include']=[{'all':!![]}];}_0x766bcc=_[_0xa899('0x42')]({},_0x766bcc,_0x11af3f[_0xa899('0x44')]);return db[_0xa899('0x46')][_0xa899('0x4c')](_0x766bcc)[_0xa899('0x27')](handleEntityNotFound(_0x1cac6e,null))['then'](respondWithResult(_0x1cac6e,null))[_0xa899('0x49')](handleError(_0x1cac6e,null));};exports[_0xa899('0x4d')]=function(_0x1fece5,_0x4eff61){return db['MailQueue'][_0xa899('0x4d')](_0x1fece5[_0xa899('0x4e')],{})[_0xa899('0x27')](function(_0x43bceb){var _0x10c347=_0x1fece5['user'][_0xa899('0x29')]({'plain':!![]});if(!_0x10c347)throw new Error(_0xa899('0x4f'));if(_0x10c347[_0xa899('0x50')]==='user'){var _0x4a0bca=_0x43bceb[_0xa899('0x29')]({'plain':!![]});var _0xf3a2b8=_0xa899('0x2a');return db['UserProfileSection'][_0xa899('0x4c')]({'where':{'name':_0xf3a2b8,'userProfileId':_0x10c347[_0xa899('0x51')]},'raw':!![]})[_0xa899('0x27')](function(_0x50b7eb){if(_0x50b7eb&&_0x50b7eb['autoAssociation']===0x0){return db[_0xa899('0x2b')]['create']({'name':_0x4a0bca[_0xa899('0x2f')],'resourceId':_0x4a0bca['id'],'type':_0x50b7eb[_0xa899('0x2f')],'sectionId':_0x50b7eb['id']},{})['then'](function(){return _0x43bceb;});}else{return _0x43bceb;}})[_0xa899('0x49')](function(_0x1a8b1b){logger[_0xa899('0x2d')](_0xa899('0x52'),_0x1a8b1b);throw _0x1a8b1b;});}return _0x43bceb;})[_0xa899('0x27')](respondWithResult(_0x4eff61,0xc9))[_0xa899('0x49')](handleError(_0x4eff61,null));};exports[_0xa899('0x26')]=function(_0x102b75,_0x68197e){if(_0x102b75[_0xa899('0x4e')]['id']){delete _0x102b75[_0xa899('0x4e')]['id'];}return db[_0xa899('0x46')][_0xa899('0x4c')]({'where':{'id':_0x102b75[_0xa899('0x4b')]['id']}})[_0xa899('0x27')](handleEntityNotFound(_0x68197e,null))[_0xa899('0x27')](saveUpdates(_0x102b75[_0xa899('0x4e')],null))[_0xa899('0x27')](respondWithResult(_0x68197e,null))[_0xa899('0x49')](handleError(_0x68197e,null));};exports[_0xa899('0x28')]=function(_0x341037,_0x35681a){return db[_0xa899('0x46')][_0xa899('0x4c')]({'where':{'id':_0x341037[_0xa899('0x4b')]['id']}})[_0xa899('0x27')](handleEntityNotFound(_0x35681a,null))['then'](removeEntity(_0x35681a,null))['catch'](handleError(_0x35681a,null));};exports[_0xa899('0x53')]=function(_0x27b921,_0x5e73ec){return db[_0xa899('0x46')][_0xa899('0x53')]()[_0xa899('0x27')](respondWithResult(_0x5e73ec,null))[_0xa899('0x49')](handleError(_0x5e73ec,null));};exports[_0xa899('0x54')]=function(_0x1478bd,_0x201d6c,_0x37504e){var _0x47f7c0={'raw':!![],'where':{}},_0x10f1bf={},_0x3ef2d1;return db[_0xa899('0x46')]['findOne']({'where':{'id':_0x1478bd[_0xa899('0x4b')]['id']}})[_0xa899('0x27')](handleEntityNotFound(_0x201d6c,null))[_0xa899('0x27')](function(_0x36dc4a){if(_0x36dc4a){_0x3ef2d1=_0x36dc4a[_0xa899('0x29')]({'plain':!![]});_0x10f1bf[_0xa899('0x34')]=_[_0xa899('0x36')](db[_0xa899('0x55')]['rawAttributes']);_0x10f1bf[_0xa899('0x35')]=_['keys'](_0x1478bd[_0xa899('0x35')]);_0x10f1bf[_0xa899('0x37')]=_['intersection'](_0x10f1bf[_0xa899('0x34')],_0x10f1bf[_0xa899('0x35')]);_0x47f7c0['attributes']=_[_0xa899('0x38')](_0x10f1bf[_0xa899('0x34')],qs[_0xa899('0x3a')](_0x1478bd[_0xa899('0x35')][_0xa899('0x3a')]));_0x47f7c0[_0xa899('0x39')]=_0x47f7c0[_0xa899('0x39')][_0xa899('0x3b')]?_0x47f7c0[_0xa899('0x39')]:_0x10f1bf[_0xa899('0x34')];if(!_0x1478bd['query'][_0xa899('0x3c')](_0xa899('0x3d'))){_0x47f7c0[_0xa899('0x20')]=qs[_0xa899('0x20')](_0x1478bd[_0xa899('0x35')]['limit']);_0x47f7c0['offset']=qs['offset'](_0x1478bd[_0xa899('0x35')]['offset']);}_0x47f7c0[_0xa899('0x3e')]=qs[_0xa899('0x3f')](_0x1478bd['query'][_0xa899('0x3f')]);_0x47f7c0[_0xa899('0x41')]=qs[_0xa899('0x37')](_[_0xa899('0x40')](_0x1478bd[_0xa899('0x35')],_0x10f1bf[_0xa899('0x37')]));_0x47f7c0[_0xa899('0x41')][_0xa899('0x56')]=_0x36dc4a['id'];if(_0x1478bd[_0xa899('0x35')][_0xa899('0x43')]){_0x47f7c0[_0xa899('0x41')]=_[_0xa899('0x42')](_0x47f7c0[_0xa899('0x41')],{'$or':_[_0xa899('0x30')](_0x47f7c0[_0xa899('0x39')],function(_0x23e092){var _0x13b21a={};_0x13b21a[_0x23e092]={'$like':'%'+_0x1478bd[_0xa899('0x35')][_0xa899('0x43')]+'%'};return _0x13b21a;})});}_0x47f7c0=_['merge']({},_0x47f7c0,_0x1478bd[_0xa899('0x44')]);return db[_0xa899('0x55')][_0xa899('0x47')](_0x47f7c0);}})[_0xa899('0x27')](function(_0x5851c8){if(_0x5851c8){return db[_0xa899('0x57')][_0xa899('0x58')]({'where':{'id':_[_0xa899('0x30')](_0x5851c8,_0xa899('0x59')),'role':_0xa899('0x5a')},'attributes':['id','name','mailPause',_0xa899('0x5b'),_0xa899('0x5c')]});}})[_0xa899('0x27')](function(_0x19c83e){if(_0x19c83e){return{'count':_0x19c83e[_0xa899('0x21')],'rows':_[_0xa899('0x30')](_0x19c83e[_0xa899('0x48')],function(_0x2ffa57){return{'membername':_0x2ffa57[_0xa899('0x2f')],'UserId':_0x2ffa57['id'],'queue_name':_0x3ef2d1[_0xa899('0x2f')],'MailQueueId':_0x3ef2d1['id'],'interface':util[_0xa899('0x5d')](_0xa899('0x5e'),_0xa899('0x5f'),_0x2ffa57['name']),'penalty':0x0,'paused':_0x2ffa57[_0xa899('0x60')],'createdAt':_0x2ffa57['createdAt'],'updatedAt':_0x2ffa57[_0xa899('0x5b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xa899('0x27')](respondWithFilteredResult(_0x201d6c,_0x47f7c0))['catch'](handleError(_0x201d6c,null));};exports[_0xa899('0x61')]=function(_0xc80c36,_0x3e4402,_0x42940c){var _0x52ecb8={};var _0x47db51={};var _0x5125a0;var _0x25e33f;return db[_0xa899('0x46')][_0xa899('0x62')]({'where':{'id':_0xc80c36[_0xa899('0x4b')]['id']}})[_0xa899('0x27')](handleEntityNotFound(_0x3e4402,null))[_0xa899('0x27')](function(_0x164e31){if(_0x164e31){_0x5125a0=_0x164e31;_0x47db51[_0xa899('0x34')]=_[_0xa899('0x36')](db['Team'][_0xa899('0x31')]);_0x47db51['query']=_[_0xa899('0x36')](_0xc80c36[_0xa899('0x35')]);_0x47db51[_0xa899('0x37')]=_[_0xa899('0x38')](_0x47db51['model'],_0x47db51[_0xa899('0x35')]);_0x52ecb8[_0xa899('0x39')]=_['intersection'](_0x47db51['model'],qs[_0xa899('0x3a')](_0xc80c36[_0xa899('0x35')]['fields']));_0x52ecb8[_0xa899('0x39')]=_0x52ecb8['attributes']['length']?_0x52ecb8['attributes']:_0x47db51[_0xa899('0x34')];_0x52ecb8[_0xa899('0x3e')]=qs[_0xa899('0x3f')](_0xc80c36[_0xa899('0x35')][_0xa899('0x3f')]);_0x52ecb8[_0xa899('0x41')]=qs[_0xa899('0x37')](_[_0xa899('0x40')](_0xc80c36[_0xa899('0x35')],_0x47db51[_0xa899('0x37')]));if(_0xc80c36[_0xa899('0x35')]['filter']){_0x52ecb8[_0xa899('0x41')]=_[_0xa899('0x42')](_0x52ecb8[_0xa899('0x41')],{'$or':_['map'](_0x52ecb8[_0xa899('0x39')],function(_0xfc797b){var _0x4b2506={};_0x4b2506[_0xfc797b]={'$like':'%'+_0xc80c36[_0xa899('0x35')][_0xa899('0x43')]+'%'};return _0x4b2506;})});}_0x52ecb8=_['merge']({},_0x52ecb8,_0xc80c36[_0xa899('0x44')]);return _0x5125a0['getTeams'](_0x52ecb8);}})[_0xa899('0x27')](function(_0x221979){if(_0x221979){_0x25e33f=_0x221979[_0xa899('0x3b')];if(!_0xc80c36[_0xa899('0x35')][_0xa899('0x3c')](_0xa899('0x3d'))){_0x52ecb8['limit']=qs[_0xa899('0x20')](_0xc80c36[_0xa899('0x35')][_0xa899('0x20')]);_0x52ecb8['offset']=qs[_0xa899('0x1f')](_0xc80c36[_0xa899('0x35')][_0xa899('0x1f')]);}return _0x5125a0['getTeams'](_0x52ecb8);}})[_0xa899('0x27')](function(_0x479fbb){if(_0x479fbb){return _0x479fbb?{'count':_0x25e33f,'rows':_0x479fbb}:null;}})[_0xa899('0x27')](respondWithResult(_0x3e4402,null))[_0xa899('0x49')](handleError(_0x3e4402,null));};exports[_0xa899('0x63')]=function(_0x4fc16a,_0x3d794d,_0x2a415f){var _0xee116f=_0x4fc16a[_0xa899('0x4e')]['ids'];return db['Team'][_0xa899('0x47')]({'where':{'id':_0xee116f},'attributes':['id'],'include':[{'model':db[_0xa899('0x57')],'as':_0xa899('0x64'),'attributes':['id',_0xa899('0x2f'),_0xa899('0x65'),_0xa899('0x66'),'interface'],'raw':!![]}]})[_0xa899('0x27')](function(_0x2593f2){if(_0x2593f2){var _0x332081=_[_0xa899('0x67')](_0x2593f2,function(_0x5479e2){var _0x1f99c3=_0x5479e2[_0xa899('0x29')]({'plain':!![]});return _0x1f99c3[_0xa899('0x64')];});return db[_0xa899('0x46')][_0xa899('0x4c')]({'where':{'id':_0x4fc16a[_0xa899('0x4b')]['id']}})['then'](function(_0x3dea2e){return db[_0xa899('0x68')][_0xa899('0x69')](function(_0x5cedca){return _0x3dea2e[_0xa899('0x63')](_0xee116f,{'transaction':_0x5cedca})['then'](function(){return BPromise['each'](_0x332081,function(_0x30597c){return db[_0xa899('0x55')]['findOrCreate']({'where':{'UserId':_0x30597c['id'],'MailQueueId':_0x4fc16a['params']['id']},'transaction':_0x5cedca});});})[_0xa899('0x27')](function(){_0x332081[_0xa899('0x6a')](function(_0x1cbf1b){socket[_0xa899('0x6b')](_0xa899('0x6c'),{'UserId':_0x1cbf1b['id'],'MailQueueId':_0x3dea2e['id']});});});});});}})['then'](respondWithStatusCode(_0x3d794d,null))[_0xa899('0x49')](handleError(_0x3d794d,null));};exports[_0xa899('0x6d')]=function(_0x13e91f,_0x51f8d7,_0x733ba7){return db[_0xa899('0x6e')]['findAll']({'where':{'id':_0x13e91f[_0xa899('0x35')][_0xa899('0x6f')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xa899('0x64'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x51f8d7,null))[_0xa899('0x27')](function(_0x523af7){var _0x277011=_['map'](_0x523af7,'id');var _0x1129fb=[];var _0xd17856=[];var _0x440115=squel[_0xa899('0x70')]();_0x440115['field']('tq.TeamId')[_0xa899('0x71')](_0xa899('0x72'),'tq')[_0xa899('0x73')]('user_has_teams','ut',_0xa899('0x74'))[_0xa899('0x41')](_0xa899('0x75'),_0x13e91f['params']['id']);for(var _0x191ee0=0x0;_0x191ee0<_0x523af7['length'];_0x191ee0+=0x1){let _0x14b8fa=_0x523af7[_0x191ee0];for(var _0x19530c=0x0;_0x19530c<_0x14b8fa[_0xa899('0x64')]['length'];_0x19530c+=0x1){let _0x3beb76=_0x14b8fa[_0xa899('0x64')][_0x19530c];var _0x79a17d=_0x440115['clone']();_0x79a17d[_0xa899('0x41')](_0xa899('0x76'),_0x3beb76['id']);_0xd17856[_0xa899('0x77')](db[_0xa899('0x68')]['query'](_0x79a17d[_0xa899('0x78')](),{'type':db[_0xa899('0x68')][_0xa899('0x79')]['SELECT']})['then'](function(_0xd7dfe1){if(_0xd7dfe1[_0xa899('0x3b')]===0x1){return _0x3beb76['id'];}else{var _0x431c5a=_[_0xa899('0x7a')](_[_0xa899('0x30')](_0xd7dfe1,_0xa899('0x7b')),function(_0x1361e9){return _[_0xa899('0x7c')](_0x277011,_0x1361e9);});if(_0x431c5a){return _0x3beb76['id'];}}}));}}return BPromise[_0xa899('0x7d')](_0xd17856)[_0xa899('0x27')](function(_0x4e06ff){_0x1129fb=_(_0x1129fb)[_0xa899('0x7e')](_0x4e06ff)['compact']()['value']();return db[_0xa899('0x46')][_0xa899('0x4c')]({'where':{'id':_0x13e91f[_0xa899('0x4b')]['id']}})[_0xa899('0x27')](function(_0xec07c1){return db[_0xa899('0x68')]['transaction'](function(_0x543a3d){return _0xec07c1['removeTeams'](_0x13e91f[_0xa899('0x35')][_0xa899('0x6f')],{'transaction':_0x543a3d})['then'](function(){if(!_['isEmpty'](_0x1129fb)){return _0xec07c1[_0xa899('0x7f')](_0x1129fb,{'transaction':_0x543a3d});}})[_0xa899('0x27')](function(){_0x1129fb[_0xa899('0x6a')](function(_0x5615c9){socket[_0xa899('0x6b')](_0xa899('0x80'),{'UserId':_0x5615c9,'MailQueueId':_0xec07c1['id']});});});});});});})[_0xa899('0x27')](respondWithStatusCode(_0x51f8d7,null))[_0xa899('0x49')](handleError(_0x51f8d7,null));};exports['addAgents']=function(_0x44bf53,_0x372e11,_0x5d2a51){return db['MailQueue'][_0xa899('0x4c')]({'where':{'id':_0x44bf53[_0xa899('0x4b')]['id']}})[_0xa899('0x27')](handleEntityNotFound(_0x372e11,null))[_0xa899('0x27')](function(_0x38ba17){if(_0x38ba17){return _0x38ba17['addAgents'](_0x44bf53['body'][_0xa899('0x6f')],_[_0xa899('0x81')](_0x44bf53['body'],[_0xa899('0x6f'),'id'])||{})[_0xa899('0x82')](function(_0x51146f){for(var _0x225961=0x0;_0x225961<_0x44bf53[_0xa899('0x4e')]['ids'][_0xa899('0x3b')];_0x225961+=0x1){socket[_0xa899('0x6b')](_0xa899('0x6c'),{'UserId':Number(_0x44bf53['body'][_0xa899('0x6f')][_0x225961]),'MailQueueId':Number(_0x44bf53[_0xa899('0x4b')]['id'])});}return _0x51146f;});}})[_0xa899('0x27')](respondWithResult(_0x372e11,null))[_0xa899('0x49')](handleError(_0x372e11,null));};exports[_0xa899('0x7f')]=function(_0xd7bf60,_0x3309d5,_0x532509){return db[_0xa899('0x46')][_0xa899('0x4c')]({'where':{'id':_0xd7bf60[_0xa899('0x4b')]['id']}})[_0xa899('0x27')](handleEntityNotFound(_0x3309d5,null))[_0xa899('0x27')](function(_0x2f4f57){if(_0x2f4f57){return _0x2f4f57[_0xa899('0x7f')](_0xd7bf60[_0xa899('0x35')][_0xa899('0x6f')])[_0xa899('0x27')](function(){if(_[_0xa899('0x83')](_0xd7bf60[_0xa899('0x35')][_0xa899('0x6f')])){for(var _0x5aa6d2=0x0;_0x5aa6d2<_0xd7bf60[_0xa899('0x35')]['ids'][_0xa899('0x3b')];_0x5aa6d2+=0x1){socket[_0xa899('0x6b')](_0xa899('0x80'),{'UserId':Number(_0xd7bf60[_0xa899('0x35')]['ids'][_0x5aa6d2]),'MailQueueId':Number(_0xd7bf60['params']['id'])});}}else{socket[_0xa899('0x6b')](_0xa899('0x80'),{'UserId':Number(_0xd7bf60[_0xa899('0x35')][_0xa899('0x6f')]),'MailQueueId':Number(_0xd7bf60['params']['id'])});}});}})[_0xa899('0x27')](respondWithStatusCode(_0x3309d5,null))[_0xa899('0x49')](handleError(_0x3309d5,null));};exports['getAgents']=function(_0x359be8,_0xc6fbb9,_0x4fe00f){var _0xe286a4={};var _0x3d7b99={};var _0x7dec5e;var _0x28dcc1;return db[_0xa899('0x46')][_0xa899('0x62')]({'where':{'id':_0x359be8['params']['id']}})[_0xa899('0x27')](handleEntityNotFound(_0xc6fbb9,null))['then'](function(_0x54cce8){if(_0x54cce8){_0x7dec5e=_0x54cce8;_0x3d7b99[_0xa899('0x34')]=_[_0xa899('0x36')](db[_0xa899('0x57')]['rawAttributes']);_0x3d7b99[_0xa899('0x35')]=_[_0xa899('0x36')](_0x359be8[_0xa899('0x35')]);_0x3d7b99[_0xa899('0x37')]=_[_0xa899('0x38')](_0x3d7b99[_0xa899('0x34')],_0x3d7b99['query']);_0xe286a4[_0xa899('0x39')]=_[_0xa899('0x38')](_0x3d7b99[_0xa899('0x34')],qs[_0xa899('0x3a')](_0x359be8['query']['fields']));_0xe286a4[_0xa899('0x39')]=_0xe286a4[_0xa899('0x39')]['length']?_0xe286a4[_0xa899('0x39')]:_0x3d7b99[_0xa899('0x34')];_0xe286a4[_0xa899('0x3e')]=qs[_0xa899('0x3f')](_0x359be8[_0xa899('0x35')][_0xa899('0x3f')]);_0xe286a4[_0xa899('0x41')]=qs[_0xa899('0x37')](_[_0xa899('0x40')](_0x359be8[_0xa899('0x35')],_0x3d7b99[_0xa899('0x37')]));if(_0x359be8['query'][_0xa899('0x43')]){_0xe286a4[_0xa899('0x41')]=_['merge'](_0xe286a4[_0xa899('0x41')],{'$or':_[_0xa899('0x30')](_0xe286a4[_0xa899('0x39')],function(_0xa806c6){var _0x1030e1={};_0x1030e1[_0xa806c6]={'$like':'%'+_0x359be8[_0xa899('0x35')]['filter']+'%'};return _0x1030e1;})});}_0xe286a4=_['merge']({},_0xe286a4,_0x359be8[_0xa899('0x44')]);return _0x7dec5e[_0xa899('0x84')](_0xe286a4);}})[_0xa899('0x27')](function(_0x225a1d){if(_0x225a1d){_0x28dcc1=_0x225a1d[_0xa899('0x3b')];if(!_0x359be8['query'][_0xa899('0x3c')]('nolimit')){_0xe286a4[_0xa899('0x20')]=qs[_0xa899('0x20')](_0x359be8[_0xa899('0x35')][_0xa899('0x20')]);_0xe286a4[_0xa899('0x1f')]=qs[_0xa899('0x1f')](_0x359be8[_0xa899('0x35')]['offset']);}return _0x7dec5e['getAgents'](_0xe286a4);}})[_0xa899('0x27')](function(_0x5ddeb5){if(_0x5ddeb5){return _0x5ddeb5?{'count':_0x28dcc1,'rows':_0x5ddeb5}:null;}})[_0xa899('0x27')](respondWithResult(_0xc6fbb9,null))[_0xa899('0x49')](handleError(_0xc6fbb9,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 576a518..2f267b7 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 _0x44fe=['hook','events','../../mysqldb','MailQueue','setMaxListeners','save','update','remove','emit'];(function(_0x370852,_0x2c7e62){var _0x40cc7e=function(_0x34a439){while(--_0x34a439){_0x370852['push'](_0x370852['shift']());}};_0x40cc7e(++_0x2c7e62);}(_0x44fe,0xe2));var _0xe44f=function(_0x255879,_0x3ca7af){_0x255879=_0x255879-0x0;var _0x12e68c=_0x44fe[_0x255879];return _0x12e68c;};'use strict';var EventEmitter=require(_0xe44f('0x0'));var MailQueue=require(_0xe44f('0x1'))['db'][_0xe44f('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xe44f('0x3')](0x0);var events={'afterCreate':_0xe44f('0x4'),'afterUpdate':_0xe44f('0x5'),'afterDestroy':_0xe44f('0x6')};function emitEvent(_0x5615a1){return function(_0xed986b,_0x204b94,_0x30bb8d){MailQueueEvents[_0xe44f('0x7')](_0x5615a1+':'+_0xed986b['id'],_0xed986b);MailQueueEvents[_0xe44f('0x7')](_0x5615a1,_0xed986b);_0x30bb8d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0xe44f('0x8')](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file +var _0xc343=['hook','events','../../mysqldb','MailQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x59c63d,_0x1b923f){var _0x148287=function(_0x3e456c){while(--_0x3e456c){_0x59c63d['push'](_0x59c63d['shift']());}};_0x148287(++_0x1b923f);}(_0xc343,0xa1));var _0x3c34=function(_0x3a4bf4,_0x361d29){_0x3a4bf4=_0x3a4bf4-0x0;var _0x1855c9=_0xc343[_0x3a4bf4];return _0x1855c9;};'use strict';var EventEmitter=require(_0x3c34('0x0'));var MailQueue=require(_0x3c34('0x1'))['db'][_0x3c34('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x3c34('0x3')](0x0);var events={'afterCreate':_0x3c34('0x4'),'afterUpdate':_0x3c34('0x5'),'afterDestroy':_0x3c34('0x6')};function emitEvent(_0x4eb444){return function(_0x100606,_0x1c8be5,_0xf43b05){MailQueueEvents[_0x3c34('0x7')](_0x4eb444+':'+_0x100606['id'],_0x100606);MailQueueEvents[_0x3c34('0x7')](_0x4eb444,_0x100606);_0xf43b05(null);};}for(var e in events){if(events[_0x3c34('0x8')](e)){var event=events[e];MailQueue[_0x3c34('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 3042d00..585f82a 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 _0x7299=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./mailQueue.attributes','exports','mail_queues','util'];(function(_0x5575c1,_0x11b31a){var _0x50ea4e=function(_0x225d89){while(--_0x225d89){_0x5575c1['push'](_0x5575c1['shift']());}};_0x50ea4e(++_0x11b31a);}(_0x7299,0x196));var _0x9729=function(_0x57c06a,_0x616e1a){_0x57c06a=_0x57c06a-0x0;var _0x8dca31=_0x7299[_0x57c06a];return _0x8dca31;};'use strict';var _=require('lodash');var util=require(_0x9729('0x0'));var logger=require(_0x9729('0x1'))(_0x9729('0x2'));var moment=require(_0x9729('0x3'));var BPromise=require(_0x9729('0x4'));var rp=require(_0x9729('0x5'));var fs=require('fs');var path=require(_0x9729('0x6'));var rimraf=require('rimraf');var config=require(_0x9729('0x7'));var attributes=require(_0x9729('0x8'));module[_0x9729('0x9')]=function(_0x199140,_0x7ba0ea){return _0x199140['define']('MailQueue',attributes,{'tableName':_0x9729('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0420=['rimraf','../../config/environment','./mailQueue.attributes','exports','define','MailQueue','mail_queues','lodash','../../config/logger','moment','request-promise'];(function(_0x54bfa9,_0x424d55){var _0x160e13=function(_0xc77cb8){while(--_0xc77cb8){_0x54bfa9['push'](_0x54bfa9['shift']());}};_0x160e13(++_0x424d55);}(_0x0420,0x1bf));var _0x0042=function(_0x12cbd8,_0x8ef0ce){_0x12cbd8=_0x12cbd8-0x0;var _0x2fb1ab=_0x0420[_0x12cbd8];return _0x2fb1ab;};'use strict';var _=require(_0x0042('0x0'));var util=require('util');var logger=require(_0x0042('0x1'))('api');var moment=require(_0x0042('0x2'));var BPromise=require('bluebird');var rp=require(_0x0042('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0042('0x4'));var config=require(_0x0042('0x5'));var attributes=require(_0x0042('0x6'));module[_0x0042('0x7')]=function(_0x19f7f8,_0x293f7e){return _0x19f7f8[_0x0042('0x8')](_0x0042('0x9'),attributes,{'tableName':_0x0042('0xa'),'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 fb74564..94935a0 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 _0x0427=['socket.io-emitter','./mailQueue.socket','register','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetMailQueue','MailQueue','options','raw','attributes','include','map','model','catch','debug','ShowMailQueue','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost'];(function(_0x2d3d46,_0x4765b3){var _0x37d739=function(_0x4a0252){while(--_0x4a0252){_0x2d3d46['push'](_0x2d3d46['shift']());}};_0x37d739(++_0x4765b3);}(_0x0427,0x137));var _0x7042=function(_0x485035,_0x329334){_0x485035=_0x485035-0x0;var _0x46afd6=_0x0427[_0x485035];return _0x46afd6;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7042('0x0'));var BPromise=require(_0x7042('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7042('0x2'));var db=require(_0x7042('0x3'))['db'];var utils=require(_0x7042('0x4'));var logger=require(_0x7042('0x5'))(_0x7042('0x6'));var config=require(_0x7042('0x7'));var jayson=require(_0x7042('0x8'));var client=jayson['client'][_0x7042('0x9')]({'port':0x232a});config[_0x7042('0xa')]=_[_0x7042('0xb')](config[_0x7042('0xa')],{'host':_0x7042('0xc'),'port':0x18eb});var socket=require(_0x7042('0xd'))(new Redis(config[_0x7042('0xa')]));require(_0x7042('0xe'))[_0x7042('0xf')](socket);function respondWithRpcPromise(_0x5a29aa,_0x326210,_0x5c3f0f){return new BPromise(function(_0x5cf853,_0x50eefb){return client['request'](_0x5a29aa,_0x5c3f0f)[_0x7042('0x10')](function(_0x5636e8){logger[_0x7042('0x11')](_0x7042('0x12'),_0x326210,_0x7042('0x13'));logger['debug']('MailQueue,\x20%s,\x20%s,\x20%s',_0x326210,_0x7042('0x13'),JSON[_0x7042('0x14')](_0x5636e8));if(_0x5636e8[_0x7042('0x15')]){if(_0x5636e8[_0x7042('0x15')][_0x7042('0x16')]===0x1f4){logger[_0x7042('0x15')]('MailQueue,\x20%s,\x20%s',_0x326210,_0x5636e8[_0x7042('0x15')][_0x7042('0x17')]);return _0x50eefb(_0x5636e8[_0x7042('0x15')]['message']);}logger[_0x7042('0x15')](_0x7042('0x12'),_0x326210,_0x5636e8['error'][_0x7042('0x17')]);return _0x5cf853(_0x5636e8['error']['message']);}else{logger[_0x7042('0x11')](_0x7042('0x12'),_0x326210,_0x7042('0x13'));_0x5cf853(_0x5636e8[_0x7042('0x18')][_0x7042('0x17')]);}})['catch'](function(_0x438084){logger[_0x7042('0x15')](_0x7042('0x12'),_0x326210,_0x438084);_0x50eefb(_0x438084);});});}exports[_0x7042('0x19')]=function(_0x3e9b05){var _0x4a6101=this;return new Promise(function(_0x462d9c,_0x580f84){return db[_0x7042('0x1a')]['findAll']({'raw':_0x3e9b05[_0x7042('0x1b')]?_0x3e9b05[_0x7042('0x1b')][_0x7042('0x1c')]===undefined?!![]:![]:!![],'where':_0x3e9b05[_0x7042('0x1b')]?_0x3e9b05['options']['where']||null:null,'attributes':_0x3e9b05['options']?_0x3e9b05[_0x7042('0x1b')][_0x7042('0x1d')]||null:null,'limit':_0x3e9b05[_0x7042('0x1b')]?_0x3e9b05[_0x7042('0x1b')]['limit']||null:null,'include':_0x3e9b05[_0x7042('0x1b')]?_0x3e9b05[_0x7042('0x1b')][_0x7042('0x1e')]?_[_0x7042('0x1f')](_0x3e9b05[_0x7042('0x1b')]['include'],function(_0xc5fed3){return{'model':db[_0xc5fed3[_0x7042('0x20')]],'as':_0xc5fed3['as'],'attributes':_0xc5fed3[_0x7042('0x1d')],'include':_0xc5fed3[_0x7042('0x1e')]?_[_0x7042('0x1f')](_0xc5fed3[_0x7042('0x1e')],function(_0x162ac7){return{'model':db[_0x162ac7[_0x7042('0x20')]],'as':_0x162ac7['as'],'attributes':_0x162ac7[_0x7042('0x1d')],'include':_0x162ac7[_0x7042('0x1e')]?_[_0x7042('0x1f')](_0x162ac7[_0x7042('0x1e')],function(_0x88c156){return{'model':db[_0x88c156[_0x7042('0x20')]],'as':_0x88c156['as'],'attributes':_0x88c156[_0x7042('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x7042('0x10')](function(_0x477972){logger[_0x7042('0x11')](_0x7042('0x19'),_0x3e9b05);logger['debug']('GetMailQueue',_0x3e9b05,JSON[_0x7042('0x14')](_0x477972));_0x462d9c(_0x477972);})[_0x7042('0x21')](function(_0x300be2){logger[_0x7042('0x15')](_0x7042('0x19'),_0x300be2[_0x7042('0x17')],_0x3e9b05);_0x580f84(_0x4a6101[_0x7042('0x15')](0x1f4,_0x300be2['message']));});});};exports['ShowMailQueue']=function(_0x272579){var _0x141047=this;return new Promise(function(_0x4d211a,_0x1ddea1){return db[_0x7042('0x1a')]['find']({'raw':_0x272579[_0x7042('0x1b')]?_0x272579[_0x7042('0x1b')][_0x7042('0x1c')]===undefined?!![]:![]:!![],'where':_0x272579[_0x7042('0x1b')]?_0x272579[_0x7042('0x1b')]['where']||null:null,'attributes':_0x272579[_0x7042('0x1b')]?_0x272579['options']['attributes']||null:null,'include':_0x272579[_0x7042('0x1b')]?_0x272579['options'][_0x7042('0x1e')]?_[_0x7042('0x1f')](_0x272579['options'][_0x7042('0x1e')],function(_0x52c0ab){return{'model':db[_0x52c0ab[_0x7042('0x20')]],'as':_0x52c0ab['as'],'attributes':_0x52c0ab[_0x7042('0x1d')],'include':_0x52c0ab[_0x7042('0x1e')]?_[_0x7042('0x1f')](_0x52c0ab[_0x7042('0x1e')],function(_0xcefce0){return{'model':db[_0xcefce0[_0x7042('0x20')]],'as':_0xcefce0['as'],'attributes':_0xcefce0[_0x7042('0x1d')],'include':_0xcefce0[_0x7042('0x1e')]?_['map'](_0xcefce0[_0x7042('0x1e')],function(_0x39702f){return{'model':db[_0x39702f[_0x7042('0x20')]],'as':_0x39702f['as'],'attributes':_0x39702f['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1a1086){logger[_0x7042('0x11')]('ShowMailQueue',_0x272579);logger[_0x7042('0x22')](_0x7042('0x23'),_0x272579,JSON[_0x7042('0x14')](_0x1a1086));_0x4d211a(_0x1a1086);})[_0x7042('0x21')](function(_0x1957ff){logger[_0x7042('0x15')](_0x7042('0x23'),_0x1957ff[_0x7042('0x17')],_0x272579);_0x1ddea1(_0x141047[_0x7042('0x15')](0x1f4,_0x1957ff[_0x7042('0x17')]));});});}; \ No newline at end of file +var _0xc6a8=['limit','include','map','model','GetMailQueue','find','attributes','info','ShowMailQueue','debug','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','request','then','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','MailQueue,\x20%s,\x20%s','request\x20sent','result','catch','MailQueue','findAll','options','raw','where'];(function(_0x3fa6dd,_0x94a851){var _0x19da44=function(_0x39b9b0){while(--_0x39b9b0){_0x3fa6dd['push'](_0x3fa6dd['shift']());}};_0x19da44(++_0x94a851);}(_0xc6a8,0x106));var _0x8c6a=function(_0x326432,_0x35f878){_0x326432=_0x326432-0x0;var _0x4ddfaf=_0xc6a8[_0x326432];return _0x4ddfaf;};'use strict';var _=require(_0x8c6a('0x0'));var util=require(_0x8c6a('0x1'));var moment=require('moment');var BPromise=require(_0x8c6a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8c6a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x8c6a('0x4'));var logger=require(_0x8c6a('0x5'))(_0x8c6a('0x6'));var config=require(_0x8c6a('0x7'));var jayson=require(_0x8c6a('0x8'));var client=jayson[_0x8c6a('0x9')][_0x8c6a('0xa')]({'port':0x232a});config[_0x8c6a('0xb')]=_[_0x8c6a('0xc')](config[_0x8c6a('0xb')],{'host':_0x8c6a('0xd'),'port':0x18eb});var socket=require(_0x8c6a('0xe'))(new Redis(config[_0x8c6a('0xb')]));require(_0x8c6a('0xf'))[_0x8c6a('0x10')](socket);function respondWithRpcPromise(_0x5a6e15,_0x4620bf,_0xf5d92b){return new BPromise(function(_0x1f1a0d,_0x3488cb){return client[_0x8c6a('0x11')](_0x5a6e15,_0xf5d92b)[_0x8c6a('0x12')](function(_0x46a9bd){logger['info']('MailQueue,\x20%s,\x20%s',_0x4620bf,'request\x20sent');logger['debug'](_0x8c6a('0x13'),_0x4620bf,'request\x20sent',JSON[_0x8c6a('0x14')](_0x46a9bd));if(_0x46a9bd[_0x8c6a('0x15')]){if(_0x46a9bd[_0x8c6a('0x15')]['code']===0x1f4){logger['error']('MailQueue,\x20%s,\x20%s',_0x4620bf,_0x46a9bd[_0x8c6a('0x15')][_0x8c6a('0x16')]);return _0x3488cb(_0x46a9bd[_0x8c6a('0x15')][_0x8c6a('0x16')]);}logger[_0x8c6a('0x15')](_0x8c6a('0x17'),_0x4620bf,_0x46a9bd[_0x8c6a('0x15')][_0x8c6a('0x16')]);return _0x1f1a0d(_0x46a9bd[_0x8c6a('0x15')][_0x8c6a('0x16')]);}else{logger['info'](_0x8c6a('0x17'),_0x4620bf,_0x8c6a('0x18'));_0x1f1a0d(_0x46a9bd[_0x8c6a('0x19')][_0x8c6a('0x16')]);}})[_0x8c6a('0x1a')](function(_0x4a0d5d){logger[_0x8c6a('0x15')](_0x8c6a('0x17'),_0x4620bf,_0x4a0d5d);_0x3488cb(_0x4a0d5d);});});}exports['GetMailQueue']=function(_0x1b7d54){var _0x2742ca=this;return new Promise(function(_0x15d172,_0x3d09a1){return db[_0x8c6a('0x1b')][_0x8c6a('0x1c')]({'raw':_0x1b7d54[_0x8c6a('0x1d')]?_0x1b7d54[_0x8c6a('0x1d')][_0x8c6a('0x1e')]===undefined?!![]:![]:!![],'where':_0x1b7d54['options']?_0x1b7d54[_0x8c6a('0x1d')][_0x8c6a('0x1f')]||null:null,'attributes':_0x1b7d54[_0x8c6a('0x1d')]?_0x1b7d54['options']['attributes']||null:null,'limit':_0x1b7d54[_0x8c6a('0x1d')]?_0x1b7d54[_0x8c6a('0x1d')][_0x8c6a('0x20')]||null:null,'include':_0x1b7d54[_0x8c6a('0x1d')]?_0x1b7d54[_0x8c6a('0x1d')][_0x8c6a('0x21')]?_[_0x8c6a('0x22')](_0x1b7d54[_0x8c6a('0x1d')][_0x8c6a('0x21')],function(_0x231db3){return{'model':db[_0x231db3[_0x8c6a('0x23')]],'as':_0x231db3['as'],'attributes':_0x231db3['attributes'],'include':_0x231db3[_0x8c6a('0x21')]?_[_0x8c6a('0x22')](_0x231db3[_0x8c6a('0x21')],function(_0x2b443d){return{'model':db[_0x2b443d[_0x8c6a('0x23')]],'as':_0x2b443d['as'],'attributes':_0x2b443d['attributes'],'include':_0x2b443d['include']?_[_0x8c6a('0x22')](_0x2b443d['include'],function(_0x150a20){return{'model':db[_0x150a20[_0x8c6a('0x23')]],'as':_0x150a20['as'],'attributes':_0x150a20['attributes']};}):[]};}):[]};}):[]:[]})[_0x8c6a('0x12')](function(_0x1b0b5f){logger['info'](_0x8c6a('0x24'),_0x1b7d54);logger['debug'](_0x8c6a('0x24'),_0x1b7d54,JSON[_0x8c6a('0x14')](_0x1b0b5f));_0x15d172(_0x1b0b5f);})[_0x8c6a('0x1a')](function(_0x18d8d3){logger[_0x8c6a('0x15')](_0x8c6a('0x24'),_0x18d8d3[_0x8c6a('0x16')],_0x1b7d54);_0x3d09a1(_0x2742ca[_0x8c6a('0x15')](0x1f4,_0x18d8d3[_0x8c6a('0x16')]));});});};exports['ShowMailQueue']=function(_0x490643){var _0x1bd128=this;return new Promise(function(_0x55293d,_0x52a1dc){return db[_0x8c6a('0x1b')][_0x8c6a('0x25')]({'raw':_0x490643['options']?_0x490643[_0x8c6a('0x1d')][_0x8c6a('0x1e')]===undefined?!![]:![]:!![],'where':_0x490643[_0x8c6a('0x1d')]?_0x490643[_0x8c6a('0x1d')]['where']||null:null,'attributes':_0x490643[_0x8c6a('0x1d')]?_0x490643[_0x8c6a('0x1d')][_0x8c6a('0x26')]||null:null,'include':_0x490643[_0x8c6a('0x1d')]?_0x490643[_0x8c6a('0x1d')]['include']?_['map'](_0x490643[_0x8c6a('0x1d')][_0x8c6a('0x21')],function(_0x14333a){return{'model':db[_0x14333a[_0x8c6a('0x23')]],'as':_0x14333a['as'],'attributes':_0x14333a[_0x8c6a('0x26')],'include':_0x14333a[_0x8c6a('0x21')]?_[_0x8c6a('0x22')](_0x14333a[_0x8c6a('0x21')],function(_0x36c988){return{'model':db[_0x36c988['model']],'as':_0x36c988['as'],'attributes':_0x36c988[_0x8c6a('0x26')],'include':_0x36c988['include']?_[_0x8c6a('0x22')](_0x36c988['include'],function(_0x563f56){return{'model':db[_0x563f56[_0x8c6a('0x23')]],'as':_0x563f56['as'],'attributes':_0x563f56[_0x8c6a('0x26')]};}):[]};}):[]};}):[]:[]})[_0x8c6a('0x12')](function(_0x488033){logger[_0x8c6a('0x27')](_0x8c6a('0x28'),_0x490643);logger[_0x8c6a('0x29')](_0x8c6a('0x28'),_0x490643,JSON[_0x8c6a('0x14')](_0x488033));_0x55293d(_0x488033);})[_0x8c6a('0x1a')](function(_0x452a14){logger['error'](_0x8c6a('0x28'),_0x452a14[_0x8c6a('0x16')],_0x490643);_0x52a1dc(_0x1bd128[_0x8c6a('0x15')](0x1f4,_0x452a14[_0x8c6a('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index cc5809d..554098f 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 _0xa44d=['update','emit','removeListener','register','length','mailQueue:','./mailQueue.events','remove'];(function(_0x4fe082,_0x4ae8fd){var _0xcb714=function(_0x2a5d4a){while(--_0x2a5d4a){_0x4fe082['push'](_0x4fe082['shift']());}};_0xcb714(++_0x4ae8fd);}(_0xa44d,0x1ce));var _0xda44=function(_0x4c73ac,_0x46b73c){_0x4c73ac=_0x4c73ac-0x0;var _0x9839ee=_0xa44d[_0x4c73ac];return _0x9839ee;};'use strict';var MailQueueEvents=require(_0xda44('0x0'));var events=['save',_0xda44('0x1'),_0xda44('0x2')];function createListener(_0x200b84,_0x32de28){return function(_0x4458a3){_0x32de28[_0xda44('0x3')](_0x200b84,_0x4458a3);};}function removeListener(_0x34f5b8,_0x35a941){return function(){MailQueueEvents[_0xda44('0x4')](_0x34f5b8,_0x35a941);};}exports[_0xda44('0x5')]=function(_0x4ce9c3){for(var _0x30ba48=0x0,_0x5f267c=events[_0xda44('0x6')];_0x30ba48<_0x5f267c;_0x30ba48++){var _0x25fb63=events[_0x30ba48];var _0x3affe2=createListener(_0xda44('0x7')+_0x25fb63,_0x4ce9c3);MailQueueEvents['on'](_0x25fb63,_0x3affe2);}}; \ No newline at end of file +var _0x0ca5=['emit','removeListener','register','length','./mailQueue.events','save','remove','update'];(function(_0x16e95b,_0x41ebba){var _0x160dcc=function(_0x28b933){while(--_0x28b933){_0x16e95b['push'](_0x16e95b['shift']());}};_0x160dcc(++_0x41ebba);}(_0x0ca5,0xfc));var _0x50ca=function(_0xdbccf0,_0x3dba4d){_0xdbccf0=_0xdbccf0-0x0;var _0x162a01=_0x0ca5[_0xdbccf0];return _0x162a01;};'use strict';var MailQueueEvents=require(_0x50ca('0x0'));var events=[_0x50ca('0x1'),_0x50ca('0x2'),_0x50ca('0x3')];function createListener(_0x22ea32,_0x21d2d0){return function(_0x1326a7){_0x21d2d0[_0x50ca('0x4')](_0x22ea32,_0x1326a7);};}function removeListener(_0x4e3978,_0x38120b){return function(){MailQueueEvents[_0x50ca('0x5')](_0x4e3978,_0x38120b);};}exports[_0x50ca('0x6')]=function(_0x404ab9){for(var _0x4815d3=0x0,_0x4e7d2c=events[_0x50ca('0x7')];_0x4815d3<_0x4e7d2c;_0x4815d3++){var _0x47e1b1=events[_0x4815d3];var _0x14709d=createListener('mailQueue:'+_0x47e1b1,_0x404ab9);MailQueueEvents['on'](_0x47e1b1,_0x14709d);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 09b6bc5..5d1729e 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 _0xb8a5=['put','update','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','index','get','/describe','isAuthenticated','/:id','post','create'];(function(_0x447725,_0x49753b){var _0x399167=function(_0x1e47d9){while(--_0x1e47d9){_0x447725['push'](_0x447725['shift']());}};_0x399167(++_0x49753b);}(_0xb8a5,0x157));var _0x5b8a=function(_0x1b239f,_0x328950){_0x1b239f=_0x1b239f-0x0;var _0x578725=_0xb8a5[_0x1b239f];return _0x578725;};'use strict';var multer=require(_0x5b8a('0x0'));var util=require(_0x5b8a('0x1'));var path=require(_0x5b8a('0x2'));var timeout=require(_0x5b8a('0x3'));var express=require(_0x5b8a('0x4'));var router=express[_0x5b8a('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x5b8a('0x6'));var interaction=require(_0x5b8a('0x7'));var config=require(_0x5b8a('0x8'));var controller=require(_0x5b8a('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x5b8a('0xa')]);router[_0x5b8a('0xb')](_0x5b8a('0xc'),auth[_0x5b8a('0xd')](),controller['describe']);router[_0x5b8a('0xb')](_0x5b8a('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x5b8a('0xf')]('/',auth[_0x5b8a('0xd')](),controller[_0x5b8a('0x10')]);router[_0x5b8a('0x11')]('/:id',auth[_0x5b8a('0xd')](),controller[_0x5b8a('0x12')]);router['delete'](_0x5b8a('0xe'),auth['isAuthenticated'](),controller[_0x5b8a('0x13')]);module['exports']=router; \ No newline at end of file +var _0x60aa=['post','put','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x5ddb2c,_0x85e5ab){var _0x5d9def=function(_0xa0261e){while(--_0xa0261e){_0x5ddb2c['push'](_0x5ddb2c['shift']());}};_0x5d9def(++_0x85e5ab);}(_0x60aa,0x11c));var _0xa60a=function(_0x3c9a29,_0x532a7f){_0x3c9a29=_0x3c9a29-0x0;var _0x46f781=_0x60aa[_0x3c9a29];return _0x46f781;};'use strict';var multer=require(_0xa60a('0x0'));var util=require(_0xa60a('0x1'));var path=require(_0xa60a('0x2'));var timeout=require(_0xa60a('0x3'));var express=require(_0xa60a('0x4'));var router=express[_0xa60a('0x5')]();var fs_extra=require(_0xa60a('0x6'));var auth=require(_0xa60a('0x7'));var interaction=require(_0xa60a('0x8'));var config=require('../../config/environment');var controller=require('./mailQueueReport.controller');router[_0xa60a('0x9')]('/',auth[_0xa60a('0xa')](),controller[_0xa60a('0xb')]);router[_0xa60a('0x9')](_0xa60a('0xc'),auth[_0xa60a('0xa')](),controller[_0xa60a('0xd')]);router[_0xa60a('0x9')](_0xa60a('0xe'),auth[_0xa60a('0xa')](),controller[_0xa60a('0xf')]);router[_0xa60a('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa60a('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xa60a('0x12')]);router['delete'](_0xa60a('0xe'),auth[_0xa60a('0xa')](),controller[_0xa60a('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 6ff2dd7..b4c5d8c 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 _0xc2df=['DATE','STRING'];(function(_0x53b4d7,_0x25acf2){var _0x11c1bb=function(_0xe91ae7){while(--_0xe91ae7){_0x53b4d7['push'](_0x53b4d7['shift']());}};_0x11c1bb(++_0x25acf2);}(_0xc2df,0x1c7));var _0xfc2d=function(_0x3fa3d2,_0x2ae627){_0x3fa3d2=_0x3fa3d2-0x0;var _0x499e1a=_0xc2df[_0x3fa3d2];return _0x499e1a;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xfc2d('0x0')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xfc2d('0x1')]},'leaveAt':{'type':Sequelize[_0xfc2d('0x1')]},'acceptAt':{'type':Sequelize[_0xfc2d('0x1')]},'exitAt':{'type':Sequelize[_0xfc2d('0x1')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x356c=['sequelize','STRING','DATE','moment'];(function(_0x20ce6d,_0x3b9304){var _0x35520b=function(_0xf3dddd){while(--_0xf3dddd){_0x20ce6d['push'](_0x20ce6d['shift']());}};_0x35520b(++_0x3b9304);}(_0x356c,0x143));var _0xc356=function(_0x4a5c62,_0x409084){_0x4a5c62=_0x4a5c62-0x0;var _0x5736cb=_0x356c[_0x4a5c62];return _0x5736cb;};'use strict';var moment=require(_0xc356('0x0'));var Sequelize=require(_0xc356('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xc356('0x2')]},'joinAt':{'type':Sequelize[_0xc356('0x3')]},'leaveAt':{'type':Sequelize[_0xc356('0x3')]},'acceptAt':{'type':Sequelize[_0xc356('0x3')]},'exitAt':{'type':Sequelize[_0xc356('0x3')]},'reason':{'type':Sequelize[_0xc356('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index bd14ecc..7a89ee2 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 _0x32f4=['destroy','then','end','error','stack','name','send','map','MailQueueReport','rawAttributes','fieldName','type','query','keys','filters','attributes','intersection','fields','length','model','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','update'];(function(_0x1ebce2,_0x10e903){var _0x4a330c=function(_0x4fd810){while(--_0x4fd810){_0x1ebce2['push'](_0x1ebce2['shift']());}};_0x4a330c(++_0x10e903);}(_0x32f4,0x154));var _0x432f=function(_0xaa4aee,_0x5440b3){_0xaa4aee=_0xaa4aee-0x0;var _0x5de58b=_0x32f4[_0xaa4aee];return _0x5de58b;};'use strict';var emlformat=require(_0x432f('0x0'));var rimraf=require(_0x432f('0x1'));var zipdir=require(_0x432f('0x2'));var jsonpatch=require(_0x432f('0x3'));var rp=require('request-promise');var moment=require(_0x432f('0x4'));var BPromise=require(_0x432f('0x5'));var Mustache=require('mustache');var util=require(_0x432f('0x6'));var path=require(_0x432f('0x7'));var sox=require(_0x432f('0x8'));var csv=require(_0x432f('0x9'));var ejs=require(_0x432f('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x432f('0xb'));var crypto=require(_0x432f('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x432f('0xd'));var toCsv=require('to-csv');var querystring=require(_0x432f('0xe'));var Papa=require(_0x432f('0xf'));var Redis=require(_0x432f('0x10'));var authService=require(_0x432f('0x11'));var qs=require(_0x432f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x432f('0x13'));var logger=require('../../config/logger')(_0x432f('0x14'));var utils=require('../../config/utils');var config=require(_0x432f('0x15'));var licenseUtil=require(_0x432f('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x457389,_0x29f7d2){_0x29f7d2=_0x29f7d2||0xcc;return function(_0x52e40f){if(_0x52e40f){return _0x457389[_0x432f('0x17')](_0x29f7d2);}return _0x457389[_0x432f('0x18')](_0x29f7d2)['end']();};}function respondWithResult(_0x48a4db,_0x28d9e9){_0x28d9e9=_0x28d9e9||0xc8;return function(_0x44756d){if(_0x44756d){return _0x48a4db[_0x432f('0x18')](_0x28d9e9)[_0x432f('0x19')](_0x44756d);}};}function respondWithFilteredResult(_0x419bfe,_0x4f91c5){return function(_0x175ba7){if(_0x175ba7){var _0x2f0708=typeof _0x4f91c5[_0x432f('0x1a')]===_0x432f('0x1b')&&typeof _0x4f91c5['limit']===_0x432f('0x1b');var _0x30f231=_0x175ba7[_0x432f('0x1c')];var _0x243cf=_0x2f0708?0x0:_0x4f91c5[_0x432f('0x1a')];var _0x129582=_0x2f0708?_0x175ba7['count']:_0x4f91c5[_0x432f('0x1a')]+_0x4f91c5['limit'];var _0x3d545d;if(_0x129582>=_0x30f231){_0x129582=_0x30f231;_0x3d545d=0xc8;}else{_0x3d545d=0xce;}_0x419bfe[_0x432f('0x18')](_0x3d545d);return _0x419bfe[_0x432f('0x1d')](_0x432f('0x1e'),_0x243cf+'-'+_0x129582+'/'+_0x30f231)[_0x432f('0x19')](_0x175ba7);}return null;};}function patchUpdates(_0xf1f5d){return function(_0x10f39b){try{jsonpatch[_0x432f('0x1f')](_0x10f39b,_0xf1f5d,!![]);}catch(_0x693eb3){return BPromise[_0x432f('0x20')](_0x693eb3);}return _0x10f39b[_0x432f('0x21')]();};}function saveUpdates(_0x3446fd,_0x4dd230){return function(_0x5940bd){if(_0x5940bd){return _0x5940bd[_0x432f('0x22')](_0x3446fd)['then'](function(_0x28968e){return _0x28968e;});}return null;};}function removeEntity(_0x5b9c70,_0x37f136){return function(_0x175d1b){if(_0x175d1b){return _0x175d1b[_0x432f('0x23')]()[_0x432f('0x24')](function(){_0x5b9c70[_0x432f('0x18')](0xcc)[_0x432f('0x25')]();});}};}function handleEntityNotFound(_0x59f352,_0x252b3b){return function(_0x33edec){if(!_0x33edec){_0x59f352['sendStatus'](0x194);}return _0x33edec;};}function handleError(_0x2cbde9,_0x3e37ec){_0x3e37ec=_0x3e37ec||0x1f4;return function(_0x2bcbb4){logger[_0x432f('0x26')](_0x2bcbb4[_0x432f('0x27')]);if(_0x2bcbb4[_0x432f('0x28')]){delete _0x2bcbb4[_0x432f('0x28')];}_0x2cbde9['status'](_0x3e37ec)[_0x432f('0x29')](_0x2bcbb4);};}exports['index']=function(_0x1f1fdd,_0x573cc5){var _0x20404d={},_0x5a2c14={},_0x3f768b={'count':0x0,'rows':[]};var _0x489ba6=_[_0x432f('0x2a')](db[_0x432f('0x2b')][_0x432f('0x2c')],function(_0x59c1ab){return{'name':_0x59c1ab[_0x432f('0x2d')],'type':_0x59c1ab[_0x432f('0x2e')]['key']};});_0x5a2c14['model']=_[_0x432f('0x2a')](_0x489ba6,_0x432f('0x28'));_0x5a2c14[_0x432f('0x2f')]=_[_0x432f('0x30')](_0x1f1fdd[_0x432f('0x2f')]);_0x5a2c14[_0x432f('0x31')]=_['intersection'](_0x5a2c14['model'],_0x5a2c14[_0x432f('0x2f')]);_0x20404d[_0x432f('0x32')]=_[_0x432f('0x33')](_0x5a2c14['model'],qs[_0x432f('0x34')](_0x1f1fdd[_0x432f('0x2f')][_0x432f('0x34')]));_0x20404d[_0x432f('0x32')]=_0x20404d[_0x432f('0x32')][_0x432f('0x35')]?_0x20404d[_0x432f('0x32')]:_0x5a2c14[_0x432f('0x36')];if(!_0x1f1fdd['query']['hasOwnProperty'](_0x432f('0x37'))){_0x20404d[_0x432f('0x38')]=qs['limit'](_0x1f1fdd['query']['limit']);_0x20404d[_0x432f('0x1a')]=qs[_0x432f('0x1a')](_0x1f1fdd['query'][_0x432f('0x1a')]);}_0x20404d[_0x432f('0x39')]=qs[_0x432f('0x3a')](_0x1f1fdd['query'][_0x432f('0x3a')]);_0x20404d[_0x432f('0x3b')]=qs['filters'](_[_0x432f('0x3c')](_0x1f1fdd[_0x432f('0x2f')],_0x5a2c14['filters']),_0x489ba6);if(_0x1f1fdd[_0x432f('0x2f')][_0x432f('0x3d')]){_0x20404d[_0x432f('0x3b')]=_[_0x432f('0x3e')](_0x20404d[_0x432f('0x3b')],{'$or':_[_0x432f('0x2a')](_0x489ba6,function(_0xbef36e){if(_0xbef36e[_0x432f('0x2e')]!==_0x432f('0x3f')){var _0x2545b7={};_0x2545b7[_0xbef36e[_0x432f('0x28')]]={'$like':'%'+_0x1f1fdd['query'][_0x432f('0x3d')]+'%'};return _0x2545b7;}})});}_0x20404d=_['merge']({},_0x20404d,_0x1f1fdd[_0x432f('0x40')]);var _0x3e8a0a={'where':_0x20404d['where']};return db[_0x432f('0x2b')]['count'](_0x3e8a0a)[_0x432f('0x24')](function(_0x3aca68){_0x3f768b['count']=_0x3aca68;if(_0x1f1fdd['query'][_0x432f('0x41')]){_0x20404d[_0x432f('0x42')]=[{'all':!![]}];}return db[_0x432f('0x2b')][_0x432f('0x43')](_0x20404d);})[_0x432f('0x24')](function(_0x513a57){_0x3f768b['rows']=_0x513a57;return _0x3f768b;})['then'](respondWithFilteredResult(_0x573cc5,_0x20404d))[_0x432f('0x44')](handleError(_0x573cc5,null));};exports[_0x432f('0x45')]=function(_0x55d64c,_0x1f58af){var _0x841572={'raw':!![],'where':{'id':_0x55d64c[_0x432f('0x46')]['id']}},_0x41c90c={};_0x41c90c[_0x432f('0x36')]=_[_0x432f('0x30')](db[_0x432f('0x2b')][_0x432f('0x2c')]);_0x41c90c[_0x432f('0x2f')]=_['keys'](_0x55d64c[_0x432f('0x2f')]);_0x41c90c[_0x432f('0x31')]=_['intersection'](_0x41c90c[_0x432f('0x36')],_0x41c90c[_0x432f('0x2f')]);_0x841572[_0x432f('0x32')]=_[_0x432f('0x33')](_0x41c90c[_0x432f('0x36')],qs[_0x432f('0x34')](_0x55d64c[_0x432f('0x2f')][_0x432f('0x34')]));_0x841572[_0x432f('0x32')]=_0x841572[_0x432f('0x32')][_0x432f('0x35')]?_0x841572[_0x432f('0x32')]:_0x41c90c[_0x432f('0x36')];if(_0x55d64c[_0x432f('0x2f')]['includeAll']){_0x841572['include']=[{'all':!![]}];}_0x841572=_[_0x432f('0x3e')]({},_0x841572,_0x55d64c[_0x432f('0x40')]);return db[_0x432f('0x2b')][_0x432f('0x47')](_0x841572)[_0x432f('0x24')](handleEntityNotFound(_0x1f58af,null))['then'](respondWithResult(_0x1f58af,null))[_0x432f('0x44')](handleError(_0x1f58af,null));};exports[_0x432f('0x48')]=function(_0x46c5ee,_0x2f88d6){return db[_0x432f('0x2b')][_0x432f('0x48')](_0x46c5ee[_0x432f('0x49')],{})['then'](respondWithResult(_0x2f88d6,0xc9))[_0x432f('0x44')](handleError(_0x2f88d6,null));};exports[_0x432f('0x22')]=function(_0x359853,_0x547bd0){if(_0x359853[_0x432f('0x49')]['id']){delete _0x359853[_0x432f('0x49')]['id'];}return db['MailQueueReport']['find']({'where':{'id':_0x359853[_0x432f('0x46')]['id']}})[_0x432f('0x24')](handleEntityNotFound(_0x547bd0,null))['then'](saveUpdates(_0x359853['body'],null))[_0x432f('0x24')](respondWithResult(_0x547bd0,null))['catch'](handleError(_0x547bd0,null));};exports[_0x432f('0x23')]=function(_0x66b80e,_0x5df9b3){return db[_0x432f('0x2b')]['find']({'where':{'id':_0x66b80e[_0x432f('0x46')]['id']}})[_0x432f('0x24')](handleEntityNotFound(_0x5df9b3,null))[_0x432f('0x24')](removeEntity(_0x5df9b3,null))[_0x432f('0x44')](handleError(_0x5df9b3,null));};exports[_0x432f('0x4a')]=function(_0x2a4d36,_0x56f526){return db[_0x432f('0x2b')]['describe']()[_0x432f('0x24')](respondWithResult(_0x56f526,null))[_0x432f('0x44')](handleError(_0x56f526,null));}; \ No newline at end of file +var _0x3a6d=['keys','filters','intersection','attributes','model','fields','length','nolimit','order','sort','pick','filter','where','type','options','includeAll','rows','catch','params','rawAttributes','merge','find','create','body','update','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','limit','count','Content-Range','apply','save','then','error','stack','name','send','index','map','MailQueueReport','fieldName','key','query'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x3a6d,0x143));var _0xd3a6=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x3a6d[_0x53ccf2];return _0x5a2964;};'use strict';var emlformat=require(_0xd3a6('0x0'));var rimraf=require(_0xd3a6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd3a6('0x2'));var rp=require(_0xd3a6('0x3'));var moment=require(_0xd3a6('0x4'));var BPromise=require(_0xd3a6('0x5'));var Mustache=require(_0xd3a6('0x6'));var util=require('util');var path=require(_0xd3a6('0x7'));var sox=require(_0xd3a6('0x8'));var csv=require(_0xd3a6('0x9'));var ejs=require(_0xd3a6('0xa'));var fs=require('fs');var fs_extra=require(_0xd3a6('0xb'));var _=require(_0xd3a6('0xc'));var squel=require('squel');var crypto=require(_0xd3a6('0xd'));var jsforce=require(_0xd3a6('0xe'));var deskjs=require(_0xd3a6('0xf'));var toCsv=require(_0xd3a6('0x9'));var querystring=require(_0xd3a6('0x10'));var Papa=require(_0xd3a6('0x11'));var Redis=require(_0xd3a6('0x12'));var authService=require(_0xd3a6('0x13'));var qs=require(_0xd3a6('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd3a6('0x15'));var logger=require(_0xd3a6('0x16'))(_0xd3a6('0x17'));var utils=require(_0xd3a6('0x18'));var config=require(_0xd3a6('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4b0467,_0x1c6ad7){_0x1c6ad7=_0x1c6ad7||0xcc;return function(_0x671004){if(_0x671004){return _0x4b0467[_0xd3a6('0x1a')](_0x1c6ad7);}return _0x4b0467[_0xd3a6('0x1b')](_0x1c6ad7)[_0xd3a6('0x1c')]();};}function respondWithResult(_0x2911a0,_0xa56452){_0xa56452=_0xa56452||0xc8;return function(_0x4e67fb){if(_0x4e67fb){return _0x2911a0[_0xd3a6('0x1b')](_0xa56452)[_0xd3a6('0x1d')](_0x4e67fb);}};}function respondWithFilteredResult(_0x171a8f,_0x500a37){return function(_0x3c2399){if(_0x3c2399){var _0x305b61=typeof _0x500a37[_0xd3a6('0x1e')]==='undefined'&&typeof _0x500a37[_0xd3a6('0x1f')]==='undefined';var _0x518b6d=_0x3c2399[_0xd3a6('0x20')];var _0x8d1286=_0x305b61?0x0:_0x500a37[_0xd3a6('0x1e')];var _0xbe58b4=_0x305b61?_0x3c2399[_0xd3a6('0x20')]:_0x500a37[_0xd3a6('0x1e')]+_0x500a37[_0xd3a6('0x1f')];var _0x4ec27c;if(_0xbe58b4>=_0x518b6d){_0xbe58b4=_0x518b6d;_0x4ec27c=0xc8;}else{_0x4ec27c=0xce;}_0x171a8f[_0xd3a6('0x1b')](_0x4ec27c);return _0x171a8f['set'](_0xd3a6('0x21'),_0x8d1286+'-'+_0xbe58b4+'/'+_0x518b6d)[_0xd3a6('0x1d')](_0x3c2399);}return null;};}function patchUpdates(_0x12f2c1){return function(_0x20a34e){try{jsonpatch[_0xd3a6('0x22')](_0x20a34e,_0x12f2c1,!![]);}catch(_0x6ecd88){return BPromise['reject'](_0x6ecd88);}return _0x20a34e[_0xd3a6('0x23')]();};}function saveUpdates(_0x422f5c,_0x57cf15){return function(_0x543a6a){if(_0x543a6a){return _0x543a6a['update'](_0x422f5c)['then'](function(_0x5c9075){return _0x5c9075;});}return null;};}function removeEntity(_0x98a12a,_0x400982){return function(_0x3d0b28){if(_0x3d0b28){return _0x3d0b28['destroy']()[_0xd3a6('0x24')](function(){_0x98a12a['status'](0xcc)[_0xd3a6('0x1c')]();});}};}function handleEntityNotFound(_0x16afc8,_0x429079){return function(_0x4f6130){if(!_0x4f6130){_0x16afc8[_0xd3a6('0x1a')](0x194);}return _0x4f6130;};}function handleError(_0x3bc8d1,_0x1b09ac){_0x1b09ac=_0x1b09ac||0x1f4;return function(_0x219e32){logger[_0xd3a6('0x25')](_0x219e32[_0xd3a6('0x26')]);if(_0x219e32['name']){delete _0x219e32[_0xd3a6('0x27')];}_0x3bc8d1[_0xd3a6('0x1b')](_0x1b09ac)[_0xd3a6('0x28')](_0x219e32);};}exports[_0xd3a6('0x29')]=function(_0x30abc2,_0x45c628){var _0x5c2186={},_0x535bd4={},_0x1f4859={'count':0x0,'rows':[]};var _0x210aa1=_[_0xd3a6('0x2a')](db[_0xd3a6('0x2b')]['rawAttributes'],function(_0x3de3bb){return{'name':_0x3de3bb[_0xd3a6('0x2c')],'type':_0x3de3bb['type'][_0xd3a6('0x2d')]};});_0x535bd4['model']=_[_0xd3a6('0x2a')](_0x210aa1,_0xd3a6('0x27'));_0x535bd4[_0xd3a6('0x2e')]=_[_0xd3a6('0x2f')](_0x30abc2[_0xd3a6('0x2e')]);_0x535bd4[_0xd3a6('0x30')]=_[_0xd3a6('0x31')](_0x535bd4['model'],_0x535bd4['query']);_0x5c2186[_0xd3a6('0x32')]=_[_0xd3a6('0x31')](_0x535bd4[_0xd3a6('0x33')],qs['fields'](_0x30abc2[_0xd3a6('0x2e')][_0xd3a6('0x34')]));_0x5c2186[_0xd3a6('0x32')]=_0x5c2186[_0xd3a6('0x32')][_0xd3a6('0x35')]?_0x5c2186[_0xd3a6('0x32')]:_0x535bd4[_0xd3a6('0x33')];if(!_0x30abc2[_0xd3a6('0x2e')]['hasOwnProperty'](_0xd3a6('0x36'))){_0x5c2186[_0xd3a6('0x1f')]=qs[_0xd3a6('0x1f')](_0x30abc2[_0xd3a6('0x2e')][_0xd3a6('0x1f')]);_0x5c2186[_0xd3a6('0x1e')]=qs['offset'](_0x30abc2[_0xd3a6('0x2e')]['offset']);}_0x5c2186[_0xd3a6('0x37')]=qs[_0xd3a6('0x38')](_0x30abc2[_0xd3a6('0x2e')][_0xd3a6('0x38')]);_0x5c2186['where']=qs['filters'](_[_0xd3a6('0x39')](_0x30abc2[_0xd3a6('0x2e')],_0x535bd4[_0xd3a6('0x30')]),_0x210aa1);if(_0x30abc2['query'][_0xd3a6('0x3a')]){_0x5c2186[_0xd3a6('0x3b')]=_['merge'](_0x5c2186[_0xd3a6('0x3b')],{'$or':_['map'](_0x210aa1,function(_0x1e695a){if(_0x1e695a[_0xd3a6('0x3c')]!=='VIRTUAL'){var _0x219ba5={};_0x219ba5[_0x1e695a['name']]={'$like':'%'+_0x30abc2[_0xd3a6('0x2e')][_0xd3a6('0x3a')]+'%'};return _0x219ba5;}})});}_0x5c2186=_['merge']({},_0x5c2186,_0x30abc2[_0xd3a6('0x3d')]);var _0xfcef03={'where':_0x5c2186[_0xd3a6('0x3b')]};return db[_0xd3a6('0x2b')]['count'](_0xfcef03)[_0xd3a6('0x24')](function(_0x324dbd){_0x1f4859[_0xd3a6('0x20')]=_0x324dbd;if(_0x30abc2[_0xd3a6('0x2e')][_0xd3a6('0x3e')]){_0x5c2186['include']=[{'all':!![]}];}return db[_0xd3a6('0x2b')]['findAll'](_0x5c2186);})[_0xd3a6('0x24')](function(_0x1bc18a){_0x1f4859[_0xd3a6('0x3f')]=_0x1bc18a;return _0x1f4859;})['then'](respondWithFilteredResult(_0x45c628,_0x5c2186))[_0xd3a6('0x40')](handleError(_0x45c628,null));};exports['show']=function(_0x23aa99,_0x4cbf76){var _0x448213={'raw':!![],'where':{'id':_0x23aa99[_0xd3a6('0x41')]['id']}},_0x629153={};_0x629153[_0xd3a6('0x33')]=_[_0xd3a6('0x2f')](db[_0xd3a6('0x2b')][_0xd3a6('0x42')]);_0x629153['query']=_[_0xd3a6('0x2f')](_0x23aa99[_0xd3a6('0x2e')]);_0x629153[_0xd3a6('0x30')]=_[_0xd3a6('0x31')](_0x629153['model'],_0x629153[_0xd3a6('0x2e')]);_0x448213[_0xd3a6('0x32')]=_[_0xd3a6('0x31')](_0x629153[_0xd3a6('0x33')],qs[_0xd3a6('0x34')](_0x23aa99[_0xd3a6('0x2e')][_0xd3a6('0x34')]));_0x448213[_0xd3a6('0x32')]=_0x448213['attributes'][_0xd3a6('0x35')]?_0x448213[_0xd3a6('0x32')]:_0x629153[_0xd3a6('0x33')];if(_0x23aa99[_0xd3a6('0x2e')][_0xd3a6('0x3e')]){_0x448213['include']=[{'all':!![]}];}_0x448213=_[_0xd3a6('0x43')]({},_0x448213,_0x23aa99[_0xd3a6('0x3d')]);return db[_0xd3a6('0x2b')][_0xd3a6('0x44')](_0x448213)[_0xd3a6('0x24')](handleEntityNotFound(_0x4cbf76,null))[_0xd3a6('0x24')](respondWithResult(_0x4cbf76,null))[_0xd3a6('0x40')](handleError(_0x4cbf76,null));};exports[_0xd3a6('0x45')]=function(_0x4ac576,_0x7828c2){return db['MailQueueReport'][_0xd3a6('0x45')](_0x4ac576[_0xd3a6('0x46')],{})['then'](respondWithResult(_0x7828c2,0xc9))[_0xd3a6('0x40')](handleError(_0x7828c2,null));};exports[_0xd3a6('0x47')]=function(_0x3cf99a,_0x375067){if(_0x3cf99a[_0xd3a6('0x46')]['id']){delete _0x3cf99a[_0xd3a6('0x46')]['id'];}return db[_0xd3a6('0x2b')][_0xd3a6('0x44')]({'where':{'id':_0x3cf99a[_0xd3a6('0x41')]['id']}})[_0xd3a6('0x24')](handleEntityNotFound(_0x375067,null))['then'](saveUpdates(_0x3cf99a[_0xd3a6('0x46')],null))[_0xd3a6('0x24')](respondWithResult(_0x375067,null))[_0xd3a6('0x40')](handleError(_0x375067,null));};exports[_0xd3a6('0x48')]=function(_0x26bd65,_0x225393){return db[_0xd3a6('0x2b')][_0xd3a6('0x44')]({'where':{'id':_0x26bd65[_0xd3a6('0x41')]['id']}})[_0xd3a6('0x24')](handleEntityNotFound(_0x225393,null))['then'](removeEntity(_0x225393,null))[_0xd3a6('0x40')](handleError(_0x225393,null));};exports[_0xd3a6('0x49')]=function(_0x618b72,_0x4995b7){return db[_0xd3a6('0x2b')]['describe']()['then'](respondWithResult(_0x4995b7,null))['catch'](handleError(_0x4995b7,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 0f28fc8..1de6200 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 _0x0d0c=['./mailQueueReport.attributes','MailQueueReport','report_mail_queue','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x6ec86f,_0x20081d){var _0x37c711=function(_0x35ebad){while(--_0x35ebad){_0x6ec86f['push'](_0x6ec86f['shift']());}};_0x37c711(++_0x20081d);}(_0x0d0c,0x87));var _0xc0d0=function(_0x5b5973,_0x41ceda){_0x5b5973=_0x5b5973-0x0;var _0x4c7d81=_0x0d0c[_0x5b5973];return _0x4c7d81;};'use strict';var _=require(_0xc0d0('0x0'));var util=require(_0xc0d0('0x1'));var logger=require(_0xc0d0('0x2'))(_0xc0d0('0x3'));var moment=require(_0xc0d0('0x4'));var BPromise=require(_0xc0d0('0x5'));var rp=require(_0xc0d0('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc0d0('0x7'));var config=require(_0xc0d0('0x8'));var attributes=require(_0xc0d0('0x9'));module['exports']=function(_0x5a2ca9,_0x908e48){return _0x5a2ca9['define'](_0xc0d0('0xa'),attributes,{'tableName':_0xc0d0('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x667c=['./mailQueueReport.attributes','exports','MailQueueReport','report_mail_queue','uniqueid','lodash','api','moment','bluebird','request-promise','../../config/environment'];(function(_0x354a32,_0x23e779){var _0x5505aa=function(_0x59a82f){while(--_0x59a82f){_0x354a32['push'](_0x354a32['shift']());}};_0x5505aa(++_0x23e779);}(_0x667c,0xcb));var _0xc667=function(_0x2c148c,_0x4d216a){_0x2c148c=_0x2c148c-0x0;var _0x4078d8=_0x667c[_0x2c148c];return _0x4078d8;};'use strict';var _=require(_0xc667('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc667('0x1'));var moment=require(_0xc667('0x2'));var BPromise=require(_0xc667('0x3'));var rp=require(_0xc667('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc667('0x5'));var attributes=require(_0xc667('0x6'));module[_0xc667('0x7')]=function(_0x1ec4b6,_0x566cfb){return _0x1ec4b6['define'](_0xc667('0x8'),attributes,{'tableName':_0xc667('0x9'),'paranoid':![],'indexes':[{'name':_0xc667('0xa'),'fields':[_0xc667('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index b52abc8..5f82262 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 _0xc4aa=['create','body','options','raw','update','where','attributes','limit','UpdateMailQueueReport','stringify','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','CreateMailQueueReport','MailQueueReport'];(function(_0x70a86d,_0x40e783){var _0x1c8186=function(_0x4acf80){while(--_0x4acf80){_0x70a86d['push'](_0x70a86d['shift']());}};_0x1c8186(++_0x40e783);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0xc4aa[_0x1969a7];return _0x3d665f;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});}exports[_0xac4a('0x15')]=function(_0x28e304){var _0x44ec59=this;return new Promise(function(_0x546c5d,_0x5ac21e){return db[_0xac4a('0x16')][_0xac4a('0x17')](_0x28e304[_0xac4a('0x18')],{'raw':_0x28e304['options']?_0x28e304[_0xac4a('0x19')][_0xac4a('0x1a')]===undefined?!![]:![]:!![]})[_0xac4a('0xc')](function(_0x3a3cdb){logger[_0xac4a('0x13')](_0xac4a('0x15'),_0x28e304);logger[_0xac4a('0xf')](_0xac4a('0x15'),_0x28e304,JSON['stringify'](_0x3a3cdb));_0x546c5d(_0x3a3cdb);})[_0xac4a('0x14')](function(_0x3204ad){logger['error'](_0xac4a('0x15'),_0x3204ad[_0xac4a('0x12')],_0x28e304);_0x5ac21e(_0x44ec59[_0xac4a('0x10')](0x1f4,_0x3204ad[_0xac4a('0x12')]));});});};exports['UpdateMailQueueReport']=function(_0x1b7998){var _0x2503d8=this;return new Promise(function(_0x15435c,_0x412494){return db[_0xac4a('0x16')][_0xac4a('0x1b')](_0x1b7998[_0xac4a('0x18')],{'raw':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1c')]||null:null,'attributes':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1d')]||null:null,'limit':_0x1b7998['options']?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1e')]||null:null})[_0xac4a('0xc')](function(_0x2772fe){logger[_0xac4a('0x13')]('UpdateMailQueueReport',_0x1b7998);logger['debug'](_0xac4a('0x1f'),_0x1b7998,JSON[_0xac4a('0x20')](_0x2772fe));_0x15435c(_0x2772fe);})[_0xac4a('0x14')](function(_0x546b65){logger['error'](_0xac4a('0x1f'),_0x546b65[_0xac4a('0x12')],_0x1b7998);_0x412494(_0x2503d8[_0xac4a('0x10')](0x1f4,_0x546b65[_0xac4a('0x12')]));});});}; \ No newline at end of file +var _0x326f=['error','code','message','result','catch','CreateMailQueueReport','MailQueueReport','options','raw','stringify','UpdateMailQueueReport','body','attributes','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x9fd152,_0x5ddc35){var _0x3b1b35=function(_0x51b63b){while(--_0x51b63b){_0x9fd152['push'](_0x9fd152['shift']());}};_0x3b1b35(++_0x5ddc35);}(_0x326f,0xd1));var _0xf326=function(_0x554e6d,_0x10eee6){_0x554e6d=_0x554e6d-0x0;var _0x235c0d=_0x326f[_0x554e6d];return _0x235c0d;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf326('0x1'));var rs=require(_0xf326('0x2'));var fs=require('fs');var Redis=require(_0xf326('0x3'));var db=require(_0xf326('0x4'))['db'];var utils=require(_0xf326('0x5'));var logger=require(_0xf326('0x6'))(_0xf326('0x7'));var config=require(_0xf326('0x8'));var jayson=require(_0xf326('0x9'));var client=jayson[_0xf326('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c254d,_0x3851eb,_0x165f95){return new BPromise(function(_0x1e7b8a,_0x515bfa){return client['request'](_0x3c254d,_0x165f95)['then'](function(_0x3bacf2){logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));logger[_0xf326('0xe')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x3851eb,_0xf326('0xd'),JSON['stringify'](_0x3bacf2));if(_0x3bacf2[_0xf326('0xf')]){if(_0x3bacf2['error'][_0xf326('0x10')]===0x1f4){logger['error'](_0xf326('0xc'),_0x3851eb,_0x3bacf2[_0xf326('0xf')]['message']);return _0x515bfa(_0x3bacf2[_0xf326('0xf')][_0xf326('0x11')]);}logger[_0xf326('0xf')](_0xf326('0xc'),_0x3851eb,_0x3bacf2['error'][_0xf326('0x11')]);return _0x1e7b8a(_0x3bacf2['error']['message']);}else{logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));_0x1e7b8a(_0x3bacf2[_0xf326('0x12')][_0xf326('0x11')]);}})[_0xf326('0x13')](function(_0x34128e){logger[_0xf326('0xf')]('MailQueueReport,\x20%s,\x20%s',_0x3851eb,_0x34128e);_0x515bfa(_0x34128e);});});}exports[_0xf326('0x14')]=function(_0x453100){var _0x18bee3=this;return new Promise(function(_0x31ffb9,_0xcef2b5){return db[_0xf326('0x15')]['create'](_0x453100['body'],{'raw':_0x453100['options']?_0x453100[_0xf326('0x16')][_0xf326('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x4cabce){logger[_0xf326('0xb')]('CreateMailQueueReport',_0x453100);logger['debug'](_0xf326('0x14'),_0x453100,JSON[_0xf326('0x18')](_0x4cabce));_0x31ffb9(_0x4cabce);})['catch'](function(_0x5aa184){logger[_0xf326('0xf')](_0xf326('0x14'),_0x5aa184['message'],_0x453100);_0xcef2b5(_0x18bee3[_0xf326('0xf')](0x1f4,_0x5aa184[_0xf326('0x11')]));});});};exports[_0xf326('0x19')]=function(_0x295752){var _0x17c157=this;return new Promise(function(_0x2049ec,_0x5ce532){return db['MailQueueReport']['update'](_0x295752[_0xf326('0x1a')],{'raw':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')][_0xf326('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')]['where']||null:null,'attributes':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')][_0xf326('0x1b')]||null:null,'limit':_0x295752['options']?_0x295752[_0xf326('0x16')]['limit']||null:null})['then'](function(_0x6a8e89){logger[_0xf326('0xb')](_0xf326('0x19'),_0x295752);logger['debug'](_0xf326('0x19'),_0x295752,JSON[_0xf326('0x18')](_0x6a8e89));_0x2049ec(_0x6a8e89);})['catch'](function(_0x225776){logger[_0xf326('0xf')](_0xf326('0x19'),_0x225776[_0xf326('0x11')],_0x295752);_0x5ce532(_0x17c157[_0xf326('0xf')](0x1f4,_0x225776[_0xf326('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 6d798e0..b1a8676 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x19f025,_0x69c54b){var _0x5b553b=function(_0x15e6ad){while(--_0x15e6ad){_0x19f025['push'](_0x19f025['shift']());}};_0x5b553b(++_0x69c54b);}(_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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x344073,_0x443928){var _0x22aa0d=function(_0x35b44f){while(--_0x35b44f){_0x344073['push'](_0x344073['shift']());}};_0x22aa0d(++_0x443928);}(_0xa9e0,0x123));var _0x0a9e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 2d8abc8..9744aff 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 _0x7791=['INTEGER','INBOX','sequelize','exports','STRING'];(function(_0x3814a3,_0xf4a2c){var _0x7c2a3d=function(_0x3e8308){while(--_0x3e8308){_0x3814a3['push'](_0x3814a3['shift']());}};_0x7c2a3d(++_0xf4a2c);}(_0x7791,0xbb));var _0x1779=function(_0x675246,_0x1d0878){_0x675246=_0x675246-0x0;var _0x59e2c7=_0x7791[_0x675246];return _0x59e2c7;};'use strict';var Sequelize=require(_0x1779('0x0'));module[_0x1779('0x1')]={'description':{'type':Sequelize[_0x1779('0x2')]},'host':{'type':Sequelize[_0x1779('0x2')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize[_0x1779('0x2')]},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x1779('0x3')]},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x1779('0x2')],'defaultValue':_0x1779('0x4')},'connTimeout':{'type':Sequelize[_0x1779('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x1779('0x3')],'defaultValue':0x5},'service':{'type':Sequelize[_0x1779('0x2')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x0668=['INTEGER','sequelize','STRING','BOOLEAN','INBOX'];(function(_0x4aca33,_0x39ec61){var _0x14881c=function(_0x2626ef){while(--_0x2626ef){_0x4aca33['push'](_0x4aca33['shift']());}};_0x14881c(++_0x39ec61);}(_0x0668,0x146));var _0x8066=function(_0x4dcf14,_0x3d8d54){_0x4dcf14=_0x4dcf14-0x0;var _0x4b8c5b=_0x0668[_0x4dcf14];return _0x4b8c5b;};'use strict';var Sequelize=require(_0x8066('0x0'));module['exports']={'description':{'type':Sequelize[_0x8066('0x1')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x8066('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0x8066('0x1')]},'password':{'type':Sequelize[_0x8066('0x1')]},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x8066('0x1')],'defaultValue':_0x8066('0x3')},'connTimeout':{'type':Sequelize[_0x8066('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0x8066('0x1')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 73772b5..b132145 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 _0x917f=['./mailServerIn.attributes','exports','define','mail_servers_in','lodash','../../config/logger','api','moment','request-promise','path','../../config/environment'];(function(_0x172ca3,_0x5d663a){var _0x14414b=function(_0x222332){while(--_0x222332){_0x172ca3['push'](_0x172ca3['shift']());}};_0x14414b(++_0x5d663a);}(_0x917f,0x67));var _0xf917=function(_0x42e399,_0x4e1419){_0x42e399=_0x42e399-0x0;var _0x93149b=_0x917f[_0x42e399];return _0x93149b;};'use strict';var _=require(_0xf917('0x0'));var util=require('util');var logger=require(_0xf917('0x1'))(_0xf917('0x2'));var moment=require(_0xf917('0x3'));var BPromise=require('bluebird');var rp=require(_0xf917('0x4'));var fs=require('fs');var path=require(_0xf917('0x5'));var rimraf=require('rimraf');var config=require(_0xf917('0x6'));var attributes=require(_0xf917('0x7'));module[_0xf917('0x8')]=function(_0x5dd940,_0x27e019){return _0x5dd940[_0xf917('0x9')]('MailServerIn',attributes,{'tableName':_0xf917('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xca55=['util','../../config/logger','bluebird','request-promise','path','../../config/environment','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in','lodash'];(function(_0x3ac882,_0x370ae4){var _0x505c4c=function(_0x2abd9c){while(--_0x2abd9c){_0x3ac882['push'](_0x3ac882['shift']());}};_0x505c4c(++_0x370ae4);}(_0xca55,0x1af));var _0x5ca5=function(_0x435a26,_0x2c35c2){_0x435a26=_0x435a26-0x0;var _0x2f604a=_0xca55[_0x435a26];return _0x2f604a;};'use strict';var _=require(_0x5ca5('0x0'));var util=require(_0x5ca5('0x1'));var logger=require(_0x5ca5('0x2'))('api');var moment=require('moment');var BPromise=require(_0x5ca5('0x3'));var rp=require(_0x5ca5('0x4'));var fs=require('fs');var path=require(_0x5ca5('0x5'));var rimraf=require('rimraf');var config=require(_0x5ca5('0x6'));var attributes=require(_0x5ca5('0x7'));module[_0x5ca5('0x8')]=function(_0x3927ca,_0xc84b68){return _0x3927ca[_0x5ca5('0x9')](_0x5ca5('0xa'),attributes,{'tableName':_0x5ca5('0xb'),'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 d68dd9e..eabe7ca 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 _0x5ab4=['attributes','map','include','model','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','GetMailServerIn','findAll','options','raw'];(function(_0x55a186,_0x15442c){var _0x2eba5b=function(_0x50fd8d){while(--_0x50fd8d){_0x55a186['push'](_0x55a186['shift']());}};_0x2eba5b(++_0x15442c);}(_0x5ab4,0x9f));var _0x45ab=function(_0x1ec8dd,_0x1d57a0){_0x1ec8dd=_0x1ec8dd-0x0;var _0x569275=_0x5ab4[_0x1ec8dd];return _0x569275;};'use strict';var _=require(_0x45ab('0x0'));var util=require(_0x45ab('0x1'));var moment=require(_0x45ab('0x2'));var BPromise=require(_0x45ab('0x3'));var rs=require(_0x45ab('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x45ab('0x5'))['db'];var utils=require(_0x45ab('0x6'));var logger=require(_0x45ab('0x7'))(_0x45ab('0x8'));var config=require(_0x45ab('0x9'));var jayson=require(_0x45ab('0xa'));var client=jayson['client'][_0x45ab('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x22a033,_0x2941e8,_0x4250ec){return new BPromise(function(_0x2beb3a,_0x2b7264){return client[_0x45ab('0xc')](_0x22a033,_0x4250ec)[_0x45ab('0xd')](function(_0x292720){logger[_0x45ab('0xe')](_0x45ab('0xf'),_0x2941e8,_0x45ab('0x10'));logger[_0x45ab('0x11')]('MailServerIn,\x20%s,\x20%s,\x20%s',_0x2941e8,_0x45ab('0x10'),JSON[_0x45ab('0x12')](_0x292720));if(_0x292720[_0x45ab('0x13')]){if(_0x292720[_0x45ab('0x13')][_0x45ab('0x14')]===0x1f4){logger[_0x45ab('0x13')](_0x45ab('0xf'),_0x2941e8,_0x292720[_0x45ab('0x13')][_0x45ab('0x15')]);return _0x2b7264(_0x292720['error']['message']);}logger[_0x45ab('0x13')](_0x45ab('0xf'),_0x2941e8,_0x292720[_0x45ab('0x13')][_0x45ab('0x15')]);return _0x2beb3a(_0x292720[_0x45ab('0x13')][_0x45ab('0x15')]);}else{logger[_0x45ab('0xe')](_0x45ab('0xf'),_0x2941e8,'request\x20sent');_0x2beb3a(_0x292720[_0x45ab('0x16')][_0x45ab('0x15')]);}})['catch'](function(_0x3a9e8b){logger['error']('MailServerIn,\x20%s,\x20%s',_0x2941e8,_0x3a9e8b);_0x2b7264(_0x3a9e8b);});});}exports[_0x45ab('0x17')]=function(_0x46ef46){var _0x40e4d1=this;return new Promise(function(_0xac7ce0,_0x277352){return db['MailServerIn'][_0x45ab('0x18')]({'raw':_0x46ef46[_0x45ab('0x19')]?_0x46ef46[_0x45ab('0x19')][_0x45ab('0x1a')]===undefined?!![]:![]:!![],'where':_0x46ef46['options']?_0x46ef46[_0x45ab('0x19')]['where']||null:null,'attributes':_0x46ef46[_0x45ab('0x19')]?_0x46ef46[_0x45ab('0x19')][_0x45ab('0x1b')]||null:null,'limit':_0x46ef46[_0x45ab('0x19')]?_0x46ef46[_0x45ab('0x19')]['limit']||null:null,'include':_0x46ef46[_0x45ab('0x19')]?_0x46ef46[_0x45ab('0x19')]['include']?_[_0x45ab('0x1c')](_0x46ef46[_0x45ab('0x19')][_0x45ab('0x1d')],function(_0x5b4859){return{'model':db[_0x5b4859[_0x45ab('0x1e')]],'as':_0x5b4859['as'],'attributes':_0x5b4859['attributes'],'include':_0x5b4859['include']?_['map'](_0x5b4859[_0x45ab('0x1d')],function(_0x5d6aca){return{'model':db[_0x5d6aca['model']],'as':_0x5d6aca['as'],'attributes':_0x5d6aca[_0x45ab('0x1b')],'include':_0x5d6aca['include']?_[_0x45ab('0x1c')](_0x5d6aca[_0x45ab('0x1d')],function(_0x4711b1){return{'model':db[_0x4711b1[_0x45ab('0x1e')]],'as':_0x4711b1['as'],'attributes':_0x4711b1[_0x45ab('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x45ab('0xd')](function(_0x5027e8){logger['info'](_0x45ab('0x17'),_0x46ef46);logger[_0x45ab('0x11')](_0x45ab('0x17'),_0x46ef46,JSON[_0x45ab('0x12')](_0x5027e8));_0xac7ce0(_0x5027e8);})['catch'](function(_0x5ec4fa){logger['error'](_0x45ab('0x17'),_0x5ec4fa[_0x45ab('0x15')],_0x46ef46);_0x277352(_0x40e4d1[_0x45ab('0x13')](0x1f4,_0x5ec4fa[_0x45ab('0x15')]));});});}; \ No newline at end of file +var _0xdc91=['result','catch','GetMailServerIn','findAll','options','attributes','limit','include','map','model','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0xdc91,0x183));var _0x1dc9=function(_0x31a180,_0x3924b9){_0x31a180=_0x31a180-0x0;var _0x4b0502=_0xdc91[_0x31a180];return _0x4b0502;};'use strict';var _=require(_0x1dc9('0x0'));var util=require(_0x1dc9('0x1'));var moment=require(_0x1dc9('0x2'));var BPromise=require(_0x1dc9('0x3'));var rs=require(_0x1dc9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1dc9('0x5'))['db'];var utils=require(_0x1dc9('0x6'));var logger=require(_0x1dc9('0x7'))('rpc');var config=require(_0x1dc9('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1dc9('0x9')][_0x1dc9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x412d8e,_0x3c0b39,_0x290af7){return new BPromise(function(_0x507248,_0x1f63c7){return client['request'](_0x412d8e,_0x290af7)['then'](function(_0x5e0f40){logger[_0x1dc9('0xb')](_0x1dc9('0xc'),_0x3c0b39,_0x1dc9('0xd'));logger[_0x1dc9('0xe')]('MailServerIn,\x20%s,\x20%s,\x20%s',_0x3c0b39,_0x1dc9('0xd'),JSON[_0x1dc9('0xf')](_0x5e0f40));if(_0x5e0f40[_0x1dc9('0x10')]){if(_0x5e0f40[_0x1dc9('0x10')][_0x1dc9('0x11')]===0x1f4){logger['error'](_0x1dc9('0xc'),_0x3c0b39,_0x5e0f40[_0x1dc9('0x10')][_0x1dc9('0x12')]);return _0x1f63c7(_0x5e0f40[_0x1dc9('0x10')][_0x1dc9('0x12')]);}logger['error']('MailServerIn,\x20%s,\x20%s',_0x3c0b39,_0x5e0f40[_0x1dc9('0x10')]['message']);return _0x507248(_0x5e0f40[_0x1dc9('0x10')][_0x1dc9('0x12')]);}else{logger[_0x1dc9('0xb')](_0x1dc9('0xc'),_0x3c0b39,'request\x20sent');_0x507248(_0x5e0f40[_0x1dc9('0x13')][_0x1dc9('0x12')]);}})[_0x1dc9('0x14')](function(_0x2da7a9){logger[_0x1dc9('0x10')](_0x1dc9('0xc'),_0x3c0b39,_0x2da7a9);_0x1f63c7(_0x2da7a9);});});}exports[_0x1dc9('0x15')]=function(_0x9d3593){var _0x187922=this;return new Promise(function(_0x57e767,_0x4e3eb7){return db['MailServerIn'][_0x1dc9('0x16')]({'raw':_0x9d3593['options']?_0x9d3593[_0x1dc9('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x9d3593[_0x1dc9('0x17')]?_0x9d3593[_0x1dc9('0x17')]['where']||null:null,'attributes':_0x9d3593[_0x1dc9('0x17')]?_0x9d3593['options'][_0x1dc9('0x18')]||null:null,'limit':_0x9d3593[_0x1dc9('0x17')]?_0x9d3593[_0x1dc9('0x17')][_0x1dc9('0x19')]||null:null,'include':_0x9d3593[_0x1dc9('0x17')]?_0x9d3593[_0x1dc9('0x17')][_0x1dc9('0x1a')]?_[_0x1dc9('0x1b')](_0x9d3593[_0x1dc9('0x17')][_0x1dc9('0x1a')],function(_0x3fc0c6){return{'model':db[_0x3fc0c6[_0x1dc9('0x1c')]],'as':_0x3fc0c6['as'],'attributes':_0x3fc0c6[_0x1dc9('0x18')],'include':_0x3fc0c6[_0x1dc9('0x1a')]?_[_0x1dc9('0x1b')](_0x3fc0c6['include'],function(_0x174106){return{'model':db[_0x174106[_0x1dc9('0x1c')]],'as':_0x174106['as'],'attributes':_0x174106[_0x1dc9('0x18')],'include':_0x174106['include']?_[_0x1dc9('0x1b')](_0x174106['include'],function(_0xf13b6f){return{'model':db[_0xf13b6f[_0x1dc9('0x1c')]],'as':_0xf13b6f['as'],'attributes':_0xf13b6f['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3f5754){logger[_0x1dc9('0xb')](_0x1dc9('0x15'),_0x9d3593);logger[_0x1dc9('0xe')](_0x1dc9('0x15'),_0x9d3593,JSON['stringify'](_0x3f5754));_0x57e767(_0x3f5754);})[_0x1dc9('0x14')](function(_0x47ed2e){logger[_0x1dc9('0x10')](_0x1dc9('0x15'),_0x47ed2e[_0x1dc9('0x12')],_0x9d3593);_0x4e3eb7(_0x187922[_0x1dc9('0x10')](0x1f4,_0x47ed2e[_0x1dc9('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 3c5426e..2ea9676 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(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0x7a54,0x106));var _0x47a5=function(_0x1236c7,_0x26f500){_0x1236c7=_0x1236c7-0x0;var _0x4dcfc0=_0x7a54[_0x1236c7];return _0x4dcfc0;};'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(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0x7a54,0x106));var _0x47a5=function(_0x4c85a1,_0x5e6181){_0x4c85a1=_0x4c85a1-0x0;var _0x52fcba=_0x7a54[_0x4c85a1];return _0x52fcba;};'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 1d3bcbd..7a08fd1 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 _0x97c1=['STRING','INTEGER','BOOLEAN','sequelize','exports'];(function(_0x145b59,_0xe9b7f0){var _0x3b711c=function(_0x3f9e51){while(--_0x3f9e51){_0x145b59['push'](_0x145b59['shift']());}};_0x3b711c(++_0xe9b7f0);}(_0x97c1,0xdf));var _0x197c=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x97c1[_0x4a9fb1];return _0x348672;};'use strict';var Sequelize=require(_0x197c('0x0'));module[_0x197c('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x197c('0x2')]},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x197c('0x3')]},'secure':{'type':Sequelize[_0x197c('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0x197c('0x2')]},'authentication':{'type':Sequelize[_0x197c('0x4')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x197c('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xbc9d=['sequelize','exports','STRING','BOOLEAN'];(function(_0x564cd2,_0x3373de){var _0x29631c=function(_0x31b4cd){while(--_0x31b4cd){_0x564cd2['push'](_0x564cd2['shift']());}};_0x29631c(++_0x3373de);}(_0xbc9d,0xb4));var _0xdbc9=function(_0x3d183f,_0x114702){_0x3d183f=_0x3d183f-0x0;var _0x555746=_0xbc9d[_0x3d183f];return _0x555746;};'use strict';var Sequelize=require(_0xdbc9('0x0'));module[_0xdbc9('0x1')]={'description':{'type':Sequelize[_0xdbc9('0x2')]},'host':{'type':Sequelize[_0xdbc9('0x2')]},'user':{'type':Sequelize[_0xdbc9('0x2')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0xdbc9('0x2')]},'authentication':{'type':Sequelize[_0xdbc9('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0xdbc9('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 4d748c5..7c04e31 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 _0x88de=['stack','name','send','index','map','MailServerOut','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','order','sort','filter','where','merge','VIRTUAL','options','include','findAll','catch','show','length','find','create','body','params','destroy','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','apply','save','update','then','end'];(function(_0x340380,_0x4bd2a8){var _0x49ce1c=function(_0x4cb9e2){while(--_0x4cb9e2){_0x340380['push'](_0x340380['shift']());}};_0x49ce1c(++_0x4bd2a8);}(_0x88de,0x143));var _0xe88d=function(_0x1da37c,_0x5932ae){_0x1da37c=_0x1da37c-0x0;var _0x93b6d8=_0x88de[_0x1da37c];return _0x93b6d8;};'use strict';var emlformat=require(_0xe88d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe88d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe88d('0x2'));var moment=require(_0xe88d('0x3'));var BPromise=require(_0xe88d('0x4'));var Mustache=require(_0xe88d('0x5'));var util=require(_0xe88d('0x6'));var path=require('path');var sox=require(_0xe88d('0x7'));var csv=require(_0xe88d('0x8'));var ejs=require(_0xe88d('0x9'));var fs=require('fs');var fs_extra=require(_0xe88d('0xa'));var _=require('lodash');var squel=require(_0xe88d('0xb'));var crypto=require('crypto');var jsforce=require(_0xe88d('0xc'));var deskjs=require(_0xe88d('0xd'));var toCsv=require(_0xe88d('0x8'));var querystring=require(_0xe88d('0xe'));var Papa=require('papaparse');var Redis=require(_0xe88d('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xe88d('0x10'));var as=require(_0xe88d('0x11'));var hardwareService=require(_0xe88d('0x12'));var logger=require('../../config/logger')(_0xe88d('0x13'));var utils=require(_0xe88d('0x14'));var config=require(_0xe88d('0x15'));var licenseUtil=require(_0xe88d('0x16'));var db=require(_0xe88d('0x17'))['db'];function respondWithStatusCode(_0x109065,_0x2d5381){_0x2d5381=_0x2d5381||0xcc;return function(_0x2ce119){if(_0x2ce119){return _0x109065[_0xe88d('0x18')](_0x2d5381);}return _0x109065[_0xe88d('0x19')](_0x2d5381)['end']();};}function respondWithResult(_0x2a2733,_0x3731d4){_0x3731d4=_0x3731d4||0xc8;return function(_0x6bc5bc){if(_0x6bc5bc){return _0x2a2733[_0xe88d('0x19')](_0x3731d4)[_0xe88d('0x1a')](_0x6bc5bc);}};}function respondWithFilteredResult(_0x19367a,_0x4c9606){return function(_0x9cba52){if(_0x9cba52){var _0x51b8d3=typeof _0x4c9606[_0xe88d('0x1b')]===_0xe88d('0x1c')&&typeof _0x4c9606['limit']===_0xe88d('0x1c');var _0x29bac9=_0x9cba52[_0xe88d('0x1d')];var _0x59b2a6=_0x51b8d3?0x0:_0x4c9606[_0xe88d('0x1b')];var _0x4532c5=_0x51b8d3?_0x9cba52[_0xe88d('0x1d')]:_0x4c9606[_0xe88d('0x1b')]+_0x4c9606[_0xe88d('0x1e')];var _0x3639dd;if(_0x4532c5>=_0x29bac9){_0x4532c5=_0x29bac9;_0x3639dd=0xc8;}else{_0x3639dd=0xce;}_0x19367a[_0xe88d('0x19')](_0x3639dd);return _0x19367a[_0xe88d('0x1f')]('Content-Range',_0x59b2a6+'-'+_0x4532c5+'/'+_0x29bac9)[_0xe88d('0x1a')](_0x9cba52);}return null;};}function patchUpdates(_0x27ef5d){return function(_0x4cf8e9){try{jsonpatch[_0xe88d('0x20')](_0x4cf8e9,_0x27ef5d,!![]);}catch(_0x394181){return BPromise['reject'](_0x394181);}return _0x4cf8e9[_0xe88d('0x21')]();};}function saveUpdates(_0x43f8a5,_0x50260c){return function(_0x54c770){if(_0x54c770){return _0x54c770[_0xe88d('0x22')](_0x43f8a5)[_0xe88d('0x23')](function(_0x2ce829){return _0x2ce829;});}return null;};}function removeEntity(_0x20928b,_0x3863f4){return function(_0x3f2b19){if(_0x3f2b19){return _0x3f2b19['destroy']()[_0xe88d('0x23')](function(){_0x20928b[_0xe88d('0x19')](0xcc)[_0xe88d('0x24')]();});}};}function handleEntityNotFound(_0x507ad6,_0x4cbdfe){return function(_0x43394e){if(!_0x43394e){_0x507ad6[_0xe88d('0x18')](0x194);}return _0x43394e;};}function handleError(_0x2d82f2,_0x2af900){_0x2af900=_0x2af900||0x1f4;return function(_0x4458c7){logger['error'](_0x4458c7[_0xe88d('0x25')]);if(_0x4458c7[_0xe88d('0x26')]){delete _0x4458c7[_0xe88d('0x26')];}_0x2d82f2[_0xe88d('0x19')](_0x2af900)[_0xe88d('0x27')](_0x4458c7);};}exports[_0xe88d('0x28')]=function(_0x5aaf8e,_0xf74a2e){var _0x2bb4c5={},_0x36af03={},_0x50a3c9={'count':0x0,'rows':[]};var _0x13aa54=_[_0xe88d('0x29')](db[_0xe88d('0x2a')][_0xe88d('0x2b')],function(_0x53dc0c){return{'name':_0x53dc0c[_0xe88d('0x2c')],'type':_0x53dc0c[_0xe88d('0x2d')][_0xe88d('0x2e')]};});_0x36af03[_0xe88d('0x2f')]=_[_0xe88d('0x29')](_0x13aa54,_0xe88d('0x26'));_0x36af03['query']=_[_0xe88d('0x30')](_0x5aaf8e[_0xe88d('0x31')]);_0x36af03[_0xe88d('0x32')]=_[_0xe88d('0x33')](_0x36af03[_0xe88d('0x2f')],_0x36af03[_0xe88d('0x31')]);_0x2bb4c5['attributes']=_[_0xe88d('0x33')](_0x36af03['model'],qs[_0xe88d('0x34')](_0x5aaf8e[_0xe88d('0x31')]['fields']));_0x2bb4c5[_0xe88d('0x35')]=_0x2bb4c5['attributes']['length']?_0x2bb4c5['attributes']:_0x36af03[_0xe88d('0x2f')];if(!_0x5aaf8e['query'][_0xe88d('0x36')]('nolimit')){_0x2bb4c5[_0xe88d('0x1e')]=qs[_0xe88d('0x1e')](_0x5aaf8e[_0xe88d('0x31')][_0xe88d('0x1e')]);_0x2bb4c5[_0xe88d('0x1b')]=qs['offset'](_0x5aaf8e[_0xe88d('0x31')]['offset']);}_0x2bb4c5[_0xe88d('0x37')]=qs[_0xe88d('0x38')](_0x5aaf8e[_0xe88d('0x31')][_0xe88d('0x38')]);_0x2bb4c5['where']=qs[_0xe88d('0x32')](_['pick'](_0x5aaf8e[_0xe88d('0x31')],_0x36af03[_0xe88d('0x32')]),_0x13aa54);if(_0x5aaf8e[_0xe88d('0x31')][_0xe88d('0x39')]){_0x2bb4c5[_0xe88d('0x3a')]=_[_0xe88d('0x3b')](_0x2bb4c5[_0xe88d('0x3a')],{'$or':_[_0xe88d('0x29')](_0x13aa54,function(_0x4be5b8){if(_0x4be5b8[_0xe88d('0x2d')]!==_0xe88d('0x3c')){var _0x16ffa8={};_0x16ffa8[_0x4be5b8[_0xe88d('0x26')]]={'$like':'%'+_0x5aaf8e['query'][_0xe88d('0x39')]+'%'};return _0x16ffa8;}})});}_0x2bb4c5=_[_0xe88d('0x3b')]({},_0x2bb4c5,_0x5aaf8e[_0xe88d('0x3d')]);var _0x2a836e={'where':_0x2bb4c5['where']};return db['MailServerOut']['count'](_0x2a836e)[_0xe88d('0x23')](function(_0x2b1e6){_0x50a3c9['count']=_0x2b1e6;if(_0x5aaf8e[_0xe88d('0x31')]['includeAll']){_0x2bb4c5[_0xe88d('0x3e')]=[{'all':!![]}];}return db[_0xe88d('0x2a')][_0xe88d('0x3f')](_0x2bb4c5);})[_0xe88d('0x23')](function(_0x31fdee){_0x50a3c9['rows']=_0x31fdee;return _0x50a3c9;})['then'](respondWithFilteredResult(_0xf74a2e,_0x2bb4c5))[_0xe88d('0x40')](handleError(_0xf74a2e,null));};exports[_0xe88d('0x41')]=function(_0x466dcf,_0x5f51c8){var _0x38896e={'raw':!![],'where':{'id':_0x466dcf['params']['id']}},_0x1f9032={};_0x1f9032[_0xe88d('0x2f')]=_[_0xe88d('0x30')](db['MailServerOut'][_0xe88d('0x2b')]);_0x1f9032[_0xe88d('0x31')]=_[_0xe88d('0x30')](_0x466dcf[_0xe88d('0x31')]);_0x1f9032[_0xe88d('0x32')]=_[_0xe88d('0x33')](_0x1f9032['model'],_0x1f9032['query']);_0x38896e[_0xe88d('0x35')]=_['intersection'](_0x1f9032[_0xe88d('0x2f')],qs[_0xe88d('0x34')](_0x466dcf[_0xe88d('0x31')][_0xe88d('0x34')]));_0x38896e[_0xe88d('0x35')]=_0x38896e[_0xe88d('0x35')][_0xe88d('0x42')]?_0x38896e['attributes']:_0x1f9032[_0xe88d('0x2f')];if(_0x466dcf[_0xe88d('0x31')]['includeAll']){_0x38896e['include']=[{'all':!![]}];}_0x38896e=_[_0xe88d('0x3b')]({},_0x38896e,_0x466dcf[_0xe88d('0x3d')]);return db[_0xe88d('0x2a')][_0xe88d('0x43')](_0x38896e)[_0xe88d('0x23')](handleEntityNotFound(_0x5f51c8,null))[_0xe88d('0x23')](respondWithResult(_0x5f51c8,null))[_0xe88d('0x40')](handleError(_0x5f51c8,null));};exports[_0xe88d('0x44')]=function(_0x517b8c,_0x458114){return db[_0xe88d('0x2a')][_0xe88d('0x44')](_0x517b8c[_0xe88d('0x45')],{})[_0xe88d('0x23')](respondWithResult(_0x458114,0xc9))[_0xe88d('0x40')](handleError(_0x458114,null));};exports['update']=function(_0x5d186,_0x584419){if(_0x5d186[_0xe88d('0x45')]['id']){delete _0x5d186['body']['id'];}return db[_0xe88d('0x2a')][_0xe88d('0x43')]({'where':{'id':_0x5d186[_0xe88d('0x46')]['id']}})[_0xe88d('0x23')](handleEntityNotFound(_0x584419,null))[_0xe88d('0x23')](saveUpdates(_0x5d186[_0xe88d('0x45')],null))[_0xe88d('0x23')](respondWithResult(_0x584419,null))[_0xe88d('0x40')](handleError(_0x584419,null));};exports[_0xe88d('0x47')]=function(_0x29a34e,_0x7b0b8c){return db[_0xe88d('0x2a')][_0xe88d('0x43')]({'where':{'id':_0x29a34e['params']['id']}})[_0xe88d('0x23')](handleEntityNotFound(_0x7b0b8c,null))[_0xe88d('0x23')](removeEntity(_0x7b0b8c,null))['catch'](handleError(_0x7b0b8c,null));}; \ No newline at end of file +var _0x936a=['index','map','MailServerOut','rawAttributes','fieldName','key','query','filters','model','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','then','catch','show','params','keys','find','create','body','update','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','apply','save','destroy','end','error','stack','name'];(function(_0x47df5b,_0x3b3036){var _0x3e7208=function(_0x4cb5c9){while(--_0x4cb5c9){_0x47df5b['push'](_0x47df5b['shift']());}};_0x3e7208(++_0x3b3036);}(_0x936a,0xb2));var _0xa936=function(_0x4248d9,_0x2b3066){_0x4248d9=_0x4248d9-0x0;var _0x5b2efa=_0x936a[_0x4248d9];return _0x5b2efa;};'use strict';var emlformat=require(_0xa936('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa936('0x1'));var jsonpatch=require(_0xa936('0x2'));var rp=require(_0xa936('0x3'));var moment=require(_0xa936('0x4'));var BPromise=require(_0xa936('0x5'));var Mustache=require(_0xa936('0x6'));var util=require(_0xa936('0x7'));var path=require(_0xa936('0x8'));var sox=require('sox');var csv=require(_0xa936('0x9'));var ejs=require(_0xa936('0xa'));var fs=require('fs');var fs_extra=require(_0xa936('0xb'));var _=require(_0xa936('0xc'));var squel=require('squel');var crypto=require(_0xa936('0xd'));var jsforce=require(_0xa936('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa936('0x9'));var querystring=require('querystring');var Papa=require(_0xa936('0xf'));var Redis=require(_0xa936('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xa936('0x11'));var as=require(_0xa936('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa936('0x13'));var utils=require(_0xa936('0x14'));var config=require(_0xa936('0x15'));var licenseUtil=require(_0xa936('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x42d8da,_0x53c48a){_0x53c48a=_0x53c48a||0xcc;return function(_0x52abd1){if(_0x52abd1){return _0x42d8da[_0xa936('0x17')](_0x53c48a);}return _0x42d8da[_0xa936('0x18')](_0x53c48a)['end']();};}function respondWithResult(_0x14f0e0,_0x2186eb){_0x2186eb=_0x2186eb||0xc8;return function(_0x4cfd83){if(_0x4cfd83){return _0x14f0e0['status'](_0x2186eb)[_0xa936('0x19')](_0x4cfd83);}};}function respondWithFilteredResult(_0x5312f5,_0x2ed30d){return function(_0x3069b3){if(_0x3069b3){var _0x9bdfd5=typeof _0x2ed30d[_0xa936('0x1a')]===_0xa936('0x1b')&&typeof _0x2ed30d[_0xa936('0x1c')]===_0xa936('0x1b');var _0x5d19c5=_0x3069b3[_0xa936('0x1d')];var _0x1d7bdb=_0x9bdfd5?0x0:_0x2ed30d[_0xa936('0x1a')];var _0x37905d=_0x9bdfd5?_0x3069b3[_0xa936('0x1d')]:_0x2ed30d[_0xa936('0x1a')]+_0x2ed30d[_0xa936('0x1c')];var _0x43569f;if(_0x37905d>=_0x5d19c5){_0x37905d=_0x5d19c5;_0x43569f=0xc8;}else{_0x43569f=0xce;}_0x5312f5[_0xa936('0x18')](_0x43569f);return _0x5312f5[_0xa936('0x1e')]('Content-Range',_0x1d7bdb+'-'+_0x37905d+'/'+_0x5d19c5)['json'](_0x3069b3);}return null;};}function patchUpdates(_0x482712){return function(_0x3f106b){try{jsonpatch[_0xa936('0x1f')](_0x3f106b,_0x482712,!![]);}catch(_0x3a3490){return BPromise['reject'](_0x3a3490);}return _0x3f106b[_0xa936('0x20')]();};}function saveUpdates(_0x1129e7,_0x1aca54){return function(_0x7e0d8f){if(_0x7e0d8f){return _0x7e0d8f['update'](_0x1129e7)['then'](function(_0x23789a){return _0x23789a;});}return null;};}function removeEntity(_0x5afb90,_0x5386d9){return function(_0x2b6a4f){if(_0x2b6a4f){return _0x2b6a4f[_0xa936('0x21')]()['then'](function(){_0x5afb90[_0xa936('0x18')](0xcc)[_0xa936('0x22')]();});}};}function handleEntityNotFound(_0x4e28c4,_0x166d9e){return function(_0x1f0e64){if(!_0x1f0e64){_0x4e28c4['sendStatus'](0x194);}return _0x1f0e64;};}function handleError(_0x5bc744,_0x30bc22){_0x30bc22=_0x30bc22||0x1f4;return function(_0x149ae8){logger[_0xa936('0x23')](_0x149ae8[_0xa936('0x24')]);if(_0x149ae8['name']){delete _0x149ae8[_0xa936('0x25')];}_0x5bc744[_0xa936('0x18')](_0x30bc22)['send'](_0x149ae8);};}exports[_0xa936('0x26')]=function(_0x29abbe,_0x28fc6c){var _0x5a6114={},_0x33fe10={},_0x1a4b3c={'count':0x0,'rows':[]};var _0x2ab8a7=_[_0xa936('0x27')](db[_0xa936('0x28')][_0xa936('0x29')],function(_0x5b6f97){return{'name':_0x5b6f97[_0xa936('0x2a')],'type':_0x5b6f97['type'][_0xa936('0x2b')]};});_0x33fe10['model']=_[_0xa936('0x27')](_0x2ab8a7,_0xa936('0x25'));_0x33fe10['query']=_['keys'](_0x29abbe[_0xa936('0x2c')]);_0x33fe10[_0xa936('0x2d')]=_['intersection'](_0x33fe10[_0xa936('0x2e')],_0x33fe10['query']);_0x5a6114[_0xa936('0x2f')]=_[_0xa936('0x30')](_0x33fe10['model'],qs[_0xa936('0x31')](_0x29abbe[_0xa936('0x2c')][_0xa936('0x31')]));_0x5a6114['attributes']=_0x5a6114[_0xa936('0x2f')][_0xa936('0x32')]?_0x5a6114['attributes']:_0x33fe10[_0xa936('0x2e')];if(!_0x29abbe['query']['hasOwnProperty'](_0xa936('0x33'))){_0x5a6114[_0xa936('0x1c')]=qs['limit'](_0x29abbe['query'][_0xa936('0x1c')]);_0x5a6114[_0xa936('0x1a')]=qs[_0xa936('0x1a')](_0x29abbe['query'][_0xa936('0x1a')]);}_0x5a6114[_0xa936('0x34')]=qs[_0xa936('0x35')](_0x29abbe[_0xa936('0x2c')][_0xa936('0x35')]);_0x5a6114[_0xa936('0x36')]=qs[_0xa936('0x2d')](_[_0xa936('0x37')](_0x29abbe[_0xa936('0x2c')],_0x33fe10[_0xa936('0x2d')]),_0x2ab8a7);if(_0x29abbe[_0xa936('0x2c')][_0xa936('0x38')]){_0x5a6114['where']=_['merge'](_0x5a6114[_0xa936('0x36')],{'$or':_['map'](_0x2ab8a7,function(_0x27efa3){if(_0x27efa3[_0xa936('0x39')]!==_0xa936('0x3a')){var _0x14e37a={};_0x14e37a[_0x27efa3[_0xa936('0x25')]]={'$like':'%'+_0x29abbe[_0xa936('0x2c')][_0xa936('0x38')]+'%'};return _0x14e37a;}})});}_0x5a6114=_[_0xa936('0x3b')]({},_0x5a6114,_0x29abbe[_0xa936('0x3c')]);var _0x503c72={'where':_0x5a6114[_0xa936('0x36')]};return db['MailServerOut']['count'](_0x503c72)['then'](function(_0x2d6ec3){_0x1a4b3c[_0xa936('0x1d')]=_0x2d6ec3;if(_0x29abbe[_0xa936('0x2c')][_0xa936('0x3d')]){_0x5a6114[_0xa936('0x3e')]=[{'all':!![]}];}return db['MailServerOut']['findAll'](_0x5a6114);})[_0xa936('0x3f')](function(_0xf2ab8b){_0x1a4b3c['rows']=_0xf2ab8b;return _0x1a4b3c;})[_0xa936('0x3f')](respondWithFilteredResult(_0x28fc6c,_0x5a6114))[_0xa936('0x40')](handleError(_0x28fc6c,null));};exports[_0xa936('0x41')]=function(_0x5d4146,_0x1923a0){var _0xa1d5e2={'raw':!![],'where':{'id':_0x5d4146[_0xa936('0x42')]['id']}},_0x1f27e7={};_0x1f27e7[_0xa936('0x2e')]=_[_0xa936('0x43')](db[_0xa936('0x28')][_0xa936('0x29')]);_0x1f27e7[_0xa936('0x2c')]=_[_0xa936('0x43')](_0x5d4146[_0xa936('0x2c')]);_0x1f27e7['filters']=_[_0xa936('0x30')](_0x1f27e7[_0xa936('0x2e')],_0x1f27e7[_0xa936('0x2c')]);_0xa1d5e2[_0xa936('0x2f')]=_[_0xa936('0x30')](_0x1f27e7['model'],qs[_0xa936('0x31')](_0x5d4146[_0xa936('0x2c')][_0xa936('0x31')]));_0xa1d5e2[_0xa936('0x2f')]=_0xa1d5e2[_0xa936('0x2f')][_0xa936('0x32')]?_0xa1d5e2[_0xa936('0x2f')]:_0x1f27e7[_0xa936('0x2e')];if(_0x5d4146[_0xa936('0x2c')][_0xa936('0x3d')]){_0xa1d5e2[_0xa936('0x3e')]=[{'all':!![]}];}_0xa1d5e2=_[_0xa936('0x3b')]({},_0xa1d5e2,_0x5d4146[_0xa936('0x3c')]);return db['MailServerOut'][_0xa936('0x44')](_0xa1d5e2)['then'](handleEntityNotFound(_0x1923a0,null))[_0xa936('0x3f')](respondWithResult(_0x1923a0,null))['catch'](handleError(_0x1923a0,null));};exports[_0xa936('0x45')]=function(_0x18d7b5,_0x3e95be){return db[_0xa936('0x28')][_0xa936('0x45')](_0x18d7b5[_0xa936('0x46')],{})[_0xa936('0x3f')](respondWithResult(_0x3e95be,0xc9))[_0xa936('0x40')](handleError(_0x3e95be,null));};exports[_0xa936('0x47')]=function(_0x550839,_0x514091){if(_0x550839[_0xa936('0x46')]['id']){delete _0x550839[_0xa936('0x46')]['id'];}return db[_0xa936('0x28')][_0xa936('0x44')]({'where':{'id':_0x550839['params']['id']}})['then'](handleEntityNotFound(_0x514091,null))['then'](saveUpdates(_0x550839[_0xa936('0x46')],null))[_0xa936('0x3f')](respondWithResult(_0x514091,null))[_0xa936('0x40')](handleError(_0x514091,null));};exports[_0xa936('0x21')]=function(_0x3e3f47,_0x12451d){return db[_0xa936('0x28')][_0xa936('0x44')]({'where':{'id':_0x3e3f47[_0xa936('0x42')]['id']}})[_0xa936('0x3f')](handleEntityNotFound(_0x12451d,null))[_0xa936('0x3f')](removeEntity(_0x12451d,null))[_0xa936('0x40')](handleError(_0x12451d,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index fc5b760..709e913 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 _0x59f7=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes','exports','MailServerOut','lodash','util','api'];(function(_0x476bf4,_0x2a3755){var _0x788ffe=function(_0x13fa11){while(--_0x13fa11){_0x476bf4['push'](_0x476bf4['shift']());}};_0x788ffe(++_0x2a3755);}(_0x59f7,0x75));var _0x759f=function(_0x5e422b,_0x4c3363){_0x5e422b=_0x5e422b-0x0;var _0x484cf2=_0x59f7[_0x5e422b];return _0x484cf2;};'use strict';var _=require(_0x759f('0x0'));var util=require(_0x759f('0x1'));var logger=require('../../config/logger')(_0x759f('0x2'));var moment=require(_0x759f('0x3'));var BPromise=require(_0x759f('0x4'));var rp=require(_0x759f('0x5'));var fs=require('fs');var path=require(_0x759f('0x6'));var rimraf=require(_0x759f('0x7'));var config=require(_0x759f('0x8'));var attributes=require(_0x759f('0x9'));module[_0x759f('0xa')]=function(_0x5b35c6,_0x5bb63a){return _0x5b35c6['define'](_0x759f('0xb'),attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe2f7=['request-promise','path','rimraf','./mailServerOut.attributes','exports','mail_servers_out','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x4233e6,_0x2802d2){var _0x560b0d=function(_0x25bfdb){while(--_0x25bfdb){_0x4233e6['push'](_0x4233e6['shift']());}};_0x560b0d(++_0x2802d2);}(_0xe2f7,0x14a));var _0x7e2f=function(_0x44f95b,_0x2a0e31){_0x44f95b=_0x44f95b-0x0;var _0x19dcfc=_0xe2f7[_0x44f95b];return _0x19dcfc;};'use strict';var _=require(_0x7e2f('0x0'));var util=require(_0x7e2f('0x1'));var logger=require(_0x7e2f('0x2'))(_0x7e2f('0x3'));var moment=require(_0x7e2f('0x4'));var BPromise=require(_0x7e2f('0x5'));var rp=require(_0x7e2f('0x6'));var fs=require('fs');var path=require(_0x7e2f('0x7'));var rimraf=require(_0x7e2f('0x8'));var config=require('../../config/environment');var attributes=require(_0x7e2f('0x9'));module[_0x7e2f('0xa')]=function(_0x356887,_0x414fc4){return _0x356887['define']('MailServerOut',attributes,{'tableName':_0x7e2f('0xb'),'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 fee61af..b299b63 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 _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x4e3d92,_0x2af6b1){var _0xe36664=function(_0x228cca){while(--_0x228cca){_0x4e3d92['push'](_0x4e3d92['shift']());}};_0xe36664(++_0x2af6b1);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xc4aa[_0x199572];return _0x13cfa3;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file +var _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x18557f,_0x3ea9f8){var _0x2881c8=function(_0xa9da77){while(--_0xa9da77){_0x18557f['push'](_0x18557f['shift']());}};_0x2881c8(++_0x3ea9f8);}(_0xdb28,0x106));var _0x8db2=function(_0xdb0f61,_0x1b24ae){_0xdb0f61=_0xdb0f61-0x0;var _0x483b2f=_0xdb28[_0xdb0f61];return _0x483b2f;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index d738321..26016e8 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 _0xbd24=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','update','delete','destroy','multer'];(function(_0x7cbc3c,_0x2bad4d){var _0x4c4433=function(_0x3f6cbd){while(--_0x3f6cbd){_0x7cbc3c['push'](_0x7cbc3c['shift']());}};_0x4c4433(++_0x2bad4d);}(_0xbd24,0x97));var _0x4bd2=function(_0x32443e,_0x2d7d32){_0x32443e=_0x32443e-0x0;var _0x2aa089=_0xbd24[_0x32443e];return _0x2aa089;};'use strict';var multer=require(_0x4bd2('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4bd2('0x1'));var express=require(_0x4bd2('0x2'));var router=express[_0x4bd2('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x4bd2('0x4'));var interaction=require(_0x4bd2('0x5'));var config=require(_0x4bd2('0x6'));var controller=require(_0x4bd2('0x7'));router[_0x4bd2('0x8')]('/',auth[_0x4bd2('0x9')](),controller[_0x4bd2('0xa')]);router[_0x4bd2('0x8')](_0x4bd2('0xb'),auth[_0x4bd2('0x9')](),controller[_0x4bd2('0xc')]);router[_0x4bd2('0x8')](_0x4bd2('0xd'),auth[_0x4bd2('0x9')](),controller[_0x4bd2('0xe')]);router[_0x4bd2('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x4bd2('0xd'),auth[_0x4bd2('0x9')](),controller[_0x4bd2('0x10')]);router[_0x4bd2('0x11')](_0x4bd2('0xd'),auth[_0x4bd2('0x9')](),controller[_0x4bd2('0x12')]);module['exports']=router; \ No newline at end of file +var _0xa91d=['multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/describe','/:id','show','post','create','put','update','delete'];(function(_0x450f20,_0x159bb3){var _0x15bd66=function(_0x304648){while(--_0x304648){_0x450f20['push'](_0x450f20['shift']());}};_0x15bd66(++_0x159bb3);}(_0xa91d,0x165));var _0xda91=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa91d[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xda91('0x0'));var util=require(_0xda91('0x1'));var path=require(_0xda91('0x2'));var timeout=require(_0xda91('0x3'));var express=require(_0xda91('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xda91('0x5'));var interaction=require(_0xda91('0x6'));var config=require('../../config/environment');var controller=require('./mailSubstatus.controller');router[_0xda91('0x7')]('/',auth[_0xda91('0x8')](),controller['index']);router[_0xda91('0x7')](_0xda91('0x9'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xda91('0xa'),auth[_0xda91('0x8')](),controller[_0xda91('0xb')]);router[_0xda91('0xc')]('/',auth[_0xda91('0x8')](),controller[_0xda91('0xd')]);router[_0xda91('0xe')](_0xda91('0xa'),auth[_0xda91('0x8')](),controller[_0xda91('0xf')]);router[_0xda91('0x10')](_0xda91('0xa'),auth[_0xda91('0x8')](),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 da981e8..dc6b638 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 _0x7046=['sequelize','exports','STRING','name'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x7046,0x144));var _0x6704=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x7046[_0xfae23b];return _0x200640;};'use strict';var Sequelize=require(_0x6704('0x0'));module[_0x6704('0x1')]={'name':{'type':Sequelize[_0x6704('0x2')],'unique':_0x6704('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc7a3=['exports','STRING','name'];(function(_0x2adf9e,_0x28c2a1){var _0x4ab33c=function(_0x23b0c7){while(--_0x23b0c7){_0x2adf9e['push'](_0x2adf9e['shift']());}};_0x4ab33c(++_0x28c2a1);}(_0xc7a3,0xbd));var _0x3c7a=function(_0x15a0fe,_0x1ff601){_0x15a0fe=_0x15a0fe-0x0;var _0x830aa6=_0xc7a3[_0x15a0fe];return _0x830aa6;};'use strict';var Sequelize=require('sequelize');module[_0x3c7a('0x0')]={'name':{'type':Sequelize[_0x3c7a('0x1')],'unique':_0x3c7a('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x3c7a('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 96da5da..4130f8b 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 _0xa92f=['lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','MailSubstatus','rawAttributes','fieldName','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','merge','type','VIRTUAL','filter','options','where','includeAll','include','findAll','rows','catch','show','params','find','body','describe','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','to-csv','ejs'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa92f,0xd8));var _0xfa92=function(_0x544d8b,_0x5e294c){_0x544d8b=_0x544d8b-0x0;var _0x9f854d=_0xa92f[_0x544d8b];return _0x9f854d;};'use strict';var emlformat=require(_0xfa92('0x0'));var rimraf=require(_0xfa92('0x1'));var zipdir=require(_0xfa92('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfa92('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xfa92('0x4'));var util=require(_0xfa92('0x5'));var path=require(_0xfa92('0x6'));var sox=require('sox');var csv=require(_0xfa92('0x7'));var ejs=require(_0xfa92('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfa92('0x9'));var squel=require(_0xfa92('0xa'));var crypto=require('crypto');var jsforce=require(_0xfa92('0xb'));var deskjs=require(_0xfa92('0xc'));var toCsv=require(_0xfa92('0x7'));var querystring=require('querystring');var Papa=require(_0xfa92('0xd'));var Redis=require('ioredis');var authService=require(_0xfa92('0xe'));var qs=require(_0xfa92('0xf'));var as=require(_0xfa92('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfa92('0x11'))(_0xfa92('0x12'));var utils=require(_0xfa92('0x13'));var config=require(_0xfa92('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xfa92('0x15'))['db'];function respondWithStatusCode(_0x1a478b,_0x5d1caa){_0x5d1caa=_0x5d1caa||0xcc;return function(_0x461262){if(_0x461262){return _0x1a478b[_0xfa92('0x16')](_0x5d1caa);}return _0x1a478b[_0xfa92('0x17')](_0x5d1caa)[_0xfa92('0x18')]();};}function respondWithResult(_0x3654a0,_0x1738dd){_0x1738dd=_0x1738dd||0xc8;return function(_0x5550a0){if(_0x5550a0){return _0x3654a0[_0xfa92('0x17')](_0x1738dd)[_0xfa92('0x19')](_0x5550a0);}};}function respondWithFilteredResult(_0x10d3a9,_0x512d86){return function(_0x295a7e){if(_0x295a7e){var _0x345bb3=typeof _0x512d86[_0xfa92('0x1a')]==='undefined'&&typeof _0x512d86[_0xfa92('0x1b')]===_0xfa92('0x1c');var _0x290014=_0x295a7e[_0xfa92('0x1d')];var _0x14c119=_0x345bb3?0x0:_0x512d86[_0xfa92('0x1a')];var _0x480cc3=_0x345bb3?_0x295a7e[_0xfa92('0x1d')]:_0x512d86['offset']+_0x512d86[_0xfa92('0x1b')];var _0x39b1d5;if(_0x480cc3>=_0x290014){_0x480cc3=_0x290014;_0x39b1d5=0xc8;}else{_0x39b1d5=0xce;}_0x10d3a9['status'](_0x39b1d5);return _0x10d3a9['set'](_0xfa92('0x1e'),_0x14c119+'-'+_0x480cc3+'/'+_0x290014)['json'](_0x295a7e);}return null;};}function patchUpdates(_0x4384dc){return function(_0x27025f){try{jsonpatch[_0xfa92('0x1f')](_0x27025f,_0x4384dc,!![]);}catch(_0xa9c2da){return BPromise[_0xfa92('0x20')](_0xa9c2da);}return _0x27025f[_0xfa92('0x21')]();};}function saveUpdates(_0x5da015,_0x2ee80a){return function(_0x16708d){if(_0x16708d){return _0x16708d[_0xfa92('0x22')](_0x5da015)[_0xfa92('0x23')](function(_0x42922e){return _0x42922e;});}return null;};}function removeEntity(_0x290097,_0xb8c52a){return function(_0x2eb3d9){if(_0x2eb3d9){return _0x2eb3d9[_0xfa92('0x24')]()[_0xfa92('0x23')](function(){_0x290097['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xe4c848,_0xb21b93){return function(_0x48e33d){if(!_0x48e33d){_0xe4c848[_0xfa92('0x16')](0x194);}return _0x48e33d;};}function handleError(_0x253e74,_0x1e5931){_0x1e5931=_0x1e5931||0x1f4;return function(_0x4473cf){logger['error'](_0x4473cf[_0xfa92('0x25')]);if(_0x4473cf['name']){delete _0x4473cf[_0xfa92('0x26')];}_0x253e74[_0xfa92('0x17')](_0x1e5931)[_0xfa92('0x27')](_0x4473cf);};}exports[_0xfa92('0x28')]=function(_0x413b98,_0x5cd5e4){var _0x2d0175={},_0x5a1831={},_0x15b9b3={'count':0x0,'rows':[]};var _0x1955e8=_[_0xfa92('0x29')](db[_0xfa92('0x2a')][_0xfa92('0x2b')],function(_0x1e07a5){return{'name':_0x1e07a5[_0xfa92('0x2c')],'type':_0x1e07a5['type'][_0xfa92('0x2d')]};});_0x5a1831['model']=_['map'](_0x1955e8,_0xfa92('0x26'));_0x5a1831['query']=_[_0xfa92('0x2e')](_0x413b98[_0xfa92('0x2f')]);_0x5a1831[_0xfa92('0x30')]=_[_0xfa92('0x31')](_0x5a1831[_0xfa92('0x32')],_0x5a1831[_0xfa92('0x2f')]);_0x2d0175[_0xfa92('0x33')]=_[_0xfa92('0x31')](_0x5a1831[_0xfa92('0x32')],qs['fields'](_0x413b98[_0xfa92('0x2f')][_0xfa92('0x34')]));_0x2d0175[_0xfa92('0x33')]=_0x2d0175[_0xfa92('0x33')][_0xfa92('0x35')]?_0x2d0175['attributes']:_0x5a1831[_0xfa92('0x32')];if(!_0x413b98[_0xfa92('0x2f')][_0xfa92('0x36')](_0xfa92('0x37'))){_0x2d0175[_0xfa92('0x1b')]=qs[_0xfa92('0x1b')](_0x413b98['query'][_0xfa92('0x1b')]);_0x2d0175[_0xfa92('0x1a')]=qs[_0xfa92('0x1a')](_0x413b98[_0xfa92('0x2f')][_0xfa92('0x1a')]);}_0x2d0175[_0xfa92('0x38')]=qs[_0xfa92('0x39')](_0x413b98[_0xfa92('0x2f')][_0xfa92('0x39')]);_0x2d0175['where']=qs[_0xfa92('0x30')](_[_0xfa92('0x3a')](_0x413b98[_0xfa92('0x2f')],_0x5a1831[_0xfa92('0x30')]),_0x1955e8);if(_0x413b98['query']['filter']){_0x2d0175['where']=_[_0xfa92('0x3b')](_0x2d0175['where'],{'$or':_[_0xfa92('0x29')](_0x1955e8,function(_0x3c2bab){if(_0x3c2bab[_0xfa92('0x3c')]!==_0xfa92('0x3d')){var _0x480000={};_0x480000[_0x3c2bab['name']]={'$like':'%'+_0x413b98['query'][_0xfa92('0x3e')]+'%'};return _0x480000;}})});}_0x2d0175=_[_0xfa92('0x3b')]({},_0x2d0175,_0x413b98[_0xfa92('0x3f')]);var _0x4be00a={'where':_0x2d0175[_0xfa92('0x40')]};return db[_0xfa92('0x2a')][_0xfa92('0x1d')](_0x4be00a)[_0xfa92('0x23')](function(_0x16d80e){_0x15b9b3[_0xfa92('0x1d')]=_0x16d80e;if(_0x413b98[_0xfa92('0x2f')][_0xfa92('0x41')]){_0x2d0175[_0xfa92('0x42')]=[{'all':!![]}];}return db[_0xfa92('0x2a')][_0xfa92('0x43')](_0x2d0175);})[_0xfa92('0x23')](function(_0x2b4296){_0x15b9b3[_0xfa92('0x44')]=_0x2b4296;return _0x15b9b3;})['then'](respondWithFilteredResult(_0x5cd5e4,_0x2d0175))[_0xfa92('0x45')](handleError(_0x5cd5e4,null));};exports[_0xfa92('0x46')]=function(_0x2f0139,_0x22b132){var _0x11d780={'raw':!![],'where':{'id':_0x2f0139[_0xfa92('0x47')]['id']}},_0x16d46f={};_0x16d46f[_0xfa92('0x32')]=_['keys'](db[_0xfa92('0x2a')][_0xfa92('0x2b')]);_0x16d46f['query']=_[_0xfa92('0x2e')](_0x2f0139[_0xfa92('0x2f')]);_0x16d46f['filters']=_[_0xfa92('0x31')](_0x16d46f[_0xfa92('0x32')],_0x16d46f[_0xfa92('0x2f')]);_0x11d780[_0xfa92('0x33')]=_['intersection'](_0x16d46f['model'],qs['fields'](_0x2f0139[_0xfa92('0x2f')][_0xfa92('0x34')]));_0x11d780[_0xfa92('0x33')]=_0x11d780[_0xfa92('0x33')][_0xfa92('0x35')]?_0x11d780[_0xfa92('0x33')]:_0x16d46f[_0xfa92('0x32')];if(_0x2f0139[_0xfa92('0x2f')]['includeAll']){_0x11d780[_0xfa92('0x42')]=[{'all':!![]}];}_0x11d780=_[_0xfa92('0x3b')]({},_0x11d780,_0x2f0139[_0xfa92('0x3f')]);return db[_0xfa92('0x2a')][_0xfa92('0x48')](_0x11d780)[_0xfa92('0x23')](handleEntityNotFound(_0x22b132,null))[_0xfa92('0x23')](respondWithResult(_0x22b132,null))[_0xfa92('0x45')](handleError(_0x22b132,null));};exports['create']=function(_0x12fc1e,_0x208121){return db['MailSubstatus']['create'](_0x12fc1e[_0xfa92('0x49')],{})[_0xfa92('0x23')](respondWithResult(_0x208121,0xc9))[_0xfa92('0x45')](handleError(_0x208121,null));};exports['update']=function(_0x25826f,_0x58d1fb){if(_0x25826f['body']['id']){delete _0x25826f[_0xfa92('0x49')]['id'];}return db[_0xfa92('0x2a')][_0xfa92('0x48')]({'where':{'id':_0x25826f[_0xfa92('0x47')]['id']}})[_0xfa92('0x23')](handleEntityNotFound(_0x58d1fb,null))['then'](saveUpdates(_0x25826f[_0xfa92('0x49')],null))[_0xfa92('0x23')](respondWithResult(_0x58d1fb,null))['catch'](handleError(_0x58d1fb,null));};exports['destroy']=function(_0x43326c,_0x337462){return db[_0xfa92('0x2a')][_0xfa92('0x48')]({'where':{'id':_0x43326c[_0xfa92('0x47')]['id']}})['then'](handleEntityNotFound(_0x337462,null))['then'](removeEntity(_0x337462,null))[_0xfa92('0x45')](handleError(_0x337462,null));};exports[_0xfa92('0x4a')]=function(_0xf5f971,_0x45d63d){return db[_0xfa92('0x2a')][_0xfa92('0x4a')]()['then'](respondWithResult(_0x45d63d,null))[_0xfa92('0x45')](handleError(_0x45d63d,null));}; \ No newline at end of file +var _0x29a8=['attributes','length','hasOwnProperty','order','where','pick','filter','merge','type','options','MailSubstatus','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/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','then','destroy','stack','name','index','map','fieldName','key','query','keys','filters','intersection','model','fields'];(function(_0x14764d,_0x4a456d){var _0x1c6a41=function(_0x343353){while(--_0x343353){_0x14764d['push'](_0x14764d['shift']());}};_0x1c6a41(++_0x4a456d);}(_0x29a8,0x158));var _0x829a=function(_0x2b8a92,_0x192f64){_0x2b8a92=_0x2b8a92-0x0;var _0x31f0da=_0x29a8[_0x2b8a92];return _0x31f0da;};'use strict';var emlformat=require(_0x829a('0x0'));var rimraf=require(_0x829a('0x1'));var zipdir=require(_0x829a('0x2'));var jsonpatch=require(_0x829a('0x3'));var rp=require(_0x829a('0x4'));var moment=require(_0x829a('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x829a('0x6'));var util=require(_0x829a('0x7'));var path=require(_0x829a('0x8'));var sox=require(_0x829a('0x9'));var csv=require(_0x829a('0xa'));var ejs=require(_0x829a('0xb'));var fs=require('fs');var fs_extra=require(_0x829a('0xc'));var _=require(_0x829a('0xd'));var squel=require(_0x829a('0xe'));var crypto=require('crypto');var jsforce=require(_0x829a('0xf'));var deskjs=require(_0x829a('0x10'));var toCsv=require('to-csv');var querystring=require(_0x829a('0x11'));var Papa=require('papaparse');var Redis=require(_0x829a('0x12'));var authService=require(_0x829a('0x13'));var qs=require(_0x829a('0x14'));var as=require(_0x829a('0x15'));var hardwareService=require(_0x829a('0x16'));var logger=require(_0x829a('0x17'))(_0x829a('0x18'));var utils=require(_0x829a('0x19'));var config=require(_0x829a('0x1a'));var licenseUtil=require(_0x829a('0x1b'));var db=require(_0x829a('0x1c'))['db'];function respondWithStatusCode(_0x32e9df,_0x34c9d8){_0x34c9d8=_0x34c9d8||0xcc;return function(_0x5299e8){if(_0x5299e8){return _0x32e9df[_0x829a('0x1d')](_0x34c9d8);}return _0x32e9df[_0x829a('0x1e')](_0x34c9d8)[_0x829a('0x1f')]();};}function respondWithResult(_0x29ba5f,_0x2a7e34){_0x2a7e34=_0x2a7e34||0xc8;return function(_0x33ab01){if(_0x33ab01){return _0x29ba5f[_0x829a('0x1e')](_0x2a7e34)[_0x829a('0x20')](_0x33ab01);}};}function respondWithFilteredResult(_0xd06385,_0x2dcf91){return function(_0x5947ca){if(_0x5947ca){var _0x4e4315=typeof _0x2dcf91[_0x829a('0x21')]==='undefined'&&typeof _0x2dcf91[_0x829a('0x22')]===_0x829a('0x23');var _0xb7fab0=_0x5947ca[_0x829a('0x24')];var _0x51495f=_0x4e4315?0x0:_0x2dcf91['offset'];var _0x576e44=_0x4e4315?_0x5947ca[_0x829a('0x24')]:_0x2dcf91[_0x829a('0x21')]+_0x2dcf91[_0x829a('0x22')];var _0x5e958b;if(_0x576e44>=_0xb7fab0){_0x576e44=_0xb7fab0;_0x5e958b=0xc8;}else{_0x5e958b=0xce;}_0xd06385[_0x829a('0x1e')](_0x5e958b);return _0xd06385[_0x829a('0x25')](_0x829a('0x26'),_0x51495f+'-'+_0x576e44+'/'+_0xb7fab0)[_0x829a('0x20')](_0x5947ca);}return null;};}function patchUpdates(_0x4edd62){return function(_0xc2021c){try{jsonpatch[_0x829a('0x27')](_0xc2021c,_0x4edd62,!![]);}catch(_0x4b4a80){return BPromise[_0x829a('0x28')](_0x4b4a80);}return _0xc2021c[_0x829a('0x29')]();};}function saveUpdates(_0xdee665,_0x57a714){return function(_0x202248){if(_0x202248){return _0x202248['update'](_0xdee665)[_0x829a('0x2a')](function(_0x1b5970){return _0x1b5970;});}return null;};}function removeEntity(_0x38b627,_0x567741){return function(_0x59081c){if(_0x59081c){return _0x59081c[_0x829a('0x2b')]()[_0x829a('0x2a')](function(){_0x38b627[_0x829a('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x337201,_0x2a302e){return function(_0x5104c7){if(!_0x5104c7){_0x337201['sendStatus'](0x194);}return _0x5104c7;};}function handleError(_0x19d9e3,_0x40f545){_0x40f545=_0x40f545||0x1f4;return function(_0x220ca3){logger['error'](_0x220ca3[_0x829a('0x2c')]);if(_0x220ca3[_0x829a('0x2d')]){delete _0x220ca3[_0x829a('0x2d')];}_0x19d9e3[_0x829a('0x1e')](_0x40f545)['send'](_0x220ca3);};}exports[_0x829a('0x2e')]=function(_0x26d324,_0x1f4dc5){var _0x2c41e6={},_0x50fc3e={},_0x538373={'count':0x0,'rows':[]};var _0x30ecc4=_[_0x829a('0x2f')](db['MailSubstatus']['rawAttributes'],function(_0x156ae2){return{'name':_0x156ae2[_0x829a('0x30')],'type':_0x156ae2['type'][_0x829a('0x31')]};});_0x50fc3e['model']=_[_0x829a('0x2f')](_0x30ecc4,_0x829a('0x2d'));_0x50fc3e[_0x829a('0x32')]=_[_0x829a('0x33')](_0x26d324[_0x829a('0x32')]);_0x50fc3e[_0x829a('0x34')]=_['intersection'](_0x50fc3e['model'],_0x50fc3e[_0x829a('0x32')]);_0x2c41e6['attributes']=_[_0x829a('0x35')](_0x50fc3e[_0x829a('0x36')],qs['fields'](_0x26d324[_0x829a('0x32')][_0x829a('0x37')]));_0x2c41e6[_0x829a('0x38')]=_0x2c41e6[_0x829a('0x38')][_0x829a('0x39')]?_0x2c41e6[_0x829a('0x38')]:_0x50fc3e[_0x829a('0x36')];if(!_0x26d324[_0x829a('0x32')][_0x829a('0x3a')]('nolimit')){_0x2c41e6[_0x829a('0x22')]=qs[_0x829a('0x22')](_0x26d324['query'][_0x829a('0x22')]);_0x2c41e6[_0x829a('0x21')]=qs['offset'](_0x26d324[_0x829a('0x32')][_0x829a('0x21')]);}_0x2c41e6[_0x829a('0x3b')]=qs['sort'](_0x26d324['query']['sort']);_0x2c41e6[_0x829a('0x3c')]=qs[_0x829a('0x34')](_[_0x829a('0x3d')](_0x26d324[_0x829a('0x32')],_0x50fc3e[_0x829a('0x34')]),_0x30ecc4);if(_0x26d324[_0x829a('0x32')][_0x829a('0x3e')]){_0x2c41e6[_0x829a('0x3c')]=_[_0x829a('0x3f')](_0x2c41e6[_0x829a('0x3c')],{'$or':_['map'](_0x30ecc4,function(_0x529842){if(_0x529842[_0x829a('0x40')]!=='VIRTUAL'){var _0x46ac8e={};_0x46ac8e[_0x529842[_0x829a('0x2d')]]={'$like':'%'+_0x26d324[_0x829a('0x32')][_0x829a('0x3e')]+'%'};return _0x46ac8e;}})});}_0x2c41e6=_[_0x829a('0x3f')]({},_0x2c41e6,_0x26d324[_0x829a('0x41')]);var _0x42ed96={'where':_0x2c41e6[_0x829a('0x3c')]};return db[_0x829a('0x42')][_0x829a('0x24')](_0x42ed96)[_0x829a('0x2a')](function(_0x5b17ef){_0x538373[_0x829a('0x24')]=_0x5b17ef;if(_0x26d324[_0x829a('0x32')][_0x829a('0x43')]){_0x2c41e6[_0x829a('0x44')]=[{'all':!![]}];}return db['MailSubstatus'][_0x829a('0x45')](_0x2c41e6);})[_0x829a('0x2a')](function(_0x2eae46){_0x538373[_0x829a('0x46')]=_0x2eae46;return _0x538373;})[_0x829a('0x2a')](respondWithFilteredResult(_0x1f4dc5,_0x2c41e6))[_0x829a('0x47')](handleError(_0x1f4dc5,null));};exports[_0x829a('0x48')]=function(_0x19d300,_0xea2e54){var _0x13fabe={'raw':!![],'where':{'id':_0x19d300[_0x829a('0x49')]['id']}},_0x79cda8={};_0x79cda8[_0x829a('0x36')]=_[_0x829a('0x33')](db[_0x829a('0x42')][_0x829a('0x4a')]);_0x79cda8['query']=_[_0x829a('0x33')](_0x19d300[_0x829a('0x32')]);_0x79cda8['filters']=_[_0x829a('0x35')](_0x79cda8[_0x829a('0x36')],_0x79cda8[_0x829a('0x32')]);_0x13fabe[_0x829a('0x38')]=_[_0x829a('0x35')](_0x79cda8[_0x829a('0x36')],qs[_0x829a('0x37')](_0x19d300[_0x829a('0x32')]['fields']));_0x13fabe['attributes']=_0x13fabe['attributes'][_0x829a('0x39')]?_0x13fabe['attributes']:_0x79cda8[_0x829a('0x36')];if(_0x19d300[_0x829a('0x32')][_0x829a('0x43')]){_0x13fabe[_0x829a('0x44')]=[{'all':!![]}];}_0x13fabe=_[_0x829a('0x3f')]({},_0x13fabe,_0x19d300[_0x829a('0x41')]);return db[_0x829a('0x42')][_0x829a('0x4b')](_0x13fabe)['then'](handleEntityNotFound(_0xea2e54,null))[_0x829a('0x2a')](respondWithResult(_0xea2e54,null))['catch'](handleError(_0xea2e54,null));};exports[_0x829a('0x4c')]=function(_0x48ee7d,_0x21d564){return db['MailSubstatus']['create'](_0x48ee7d[_0x829a('0x4d')],{})[_0x829a('0x2a')](respondWithResult(_0x21d564,0xc9))[_0x829a('0x47')](handleError(_0x21d564,null));};exports[_0x829a('0x4e')]=function(_0x5ad9d7,_0x41ecad){if(_0x5ad9d7[_0x829a('0x4d')]['id']){delete _0x5ad9d7[_0x829a('0x4d')]['id'];}return db[_0x829a('0x42')][_0x829a('0x4b')]({'where':{'id':_0x5ad9d7['params']['id']}})['then'](handleEntityNotFound(_0x41ecad,null))[_0x829a('0x2a')](saveUpdates(_0x5ad9d7[_0x829a('0x4d')],null))['then'](respondWithResult(_0x41ecad,null))[_0x829a('0x47')](handleError(_0x41ecad,null));};exports[_0x829a('0x2b')]=function(_0x2e930f,_0x46494a){return db[_0x829a('0x42')][_0x829a('0x4b')]({'where':{'id':_0x2e930f[_0x829a('0x49')]['id']}})[_0x829a('0x2a')](handleEntityNotFound(_0x46494a,null))[_0x829a('0x2a')](removeEntity(_0x46494a,null))[_0x829a('0x47')](handleError(_0x46494a,null));};exports['describe']=function(_0x48f5d2,_0x25011e){return db[_0x829a('0x42')][_0x829a('0x4f')]()[_0x829a('0x2a')](respondWithResult(_0x25011e,null))['catch'](handleError(_0x25011e,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index 6f56c29..b8e56b4 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 _0x927c=['setMaxListeners','update','emit','hook','exports','events','MailSubstatus'];(function(_0x1508e9,_0x5dfaec){var _0x5a0bf5=function(_0x1e2a64){while(--_0x1e2a64){_0x1508e9['push'](_0x1508e9['shift']());}};_0x5a0bf5(++_0x5dfaec);}(_0x927c,0x6e));var _0xc927=function(_0x5b486d,_0x2d63ec){_0x5b486d=_0x5b486d-0x0;var _0x2113c0=_0x927c[_0x5b486d];return _0x2113c0;};'use strict';var EventEmitter=require(_0xc927('0x0'));var MailSubstatus=require('../../mysqldb')['db'][_0xc927('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0xc927('0x2')](0x0);var events={'afterUpdate':_0xc927('0x3')};function emitEvent(_0x1abd3a){return function(_0x1a861e,_0x528a08,_0x16fa6){MailSubstatusEvents[_0xc927('0x4')](_0x1abd3a+':'+_0x1a861e['id'],_0x1a861e);MailSubstatusEvents[_0xc927('0x4')](_0x1abd3a,_0x1a861e);_0x16fa6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailSubstatus[_0xc927('0x5')](e,emitEvent(event));}}module[_0xc927('0x6')]=MailSubstatusEvents; \ No newline at end of file +var _0x45d2=['events','../../mysqldb','MailSubstatus','setMaxListeners','update','emit','hook'];(function(_0x2d89ce,_0x24d58d){var _0x3fad10=function(_0xad0ec){while(--_0xad0ec){_0x2d89ce['push'](_0x2d89ce['shift']());}};_0x3fad10(++_0x24d58d);}(_0x45d2,0x1d5));var _0x245d=function(_0x5b263f,_0x51088c){_0x5b263f=_0x5b263f-0x0;var _0x3184c2=_0x45d2[_0x5b263f];return _0x3184c2;};'use strict';var EventEmitter=require(_0x245d('0x0'));var MailSubstatus=require(_0x245d('0x1'))['db'][_0x245d('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x245d('0x3')](0x0);var events={'afterUpdate':_0x245d('0x4')};function emitEvent(_0x145a20){return function(_0x3d3efe,_0x491020,_0x541b71){MailSubstatusEvents[_0x245d('0x5')](_0x145a20+':'+_0x3d3efe['id'],_0x3d3efe);MailSubstatusEvents['emit'](_0x145a20,_0x3d3efe);_0x541b71(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailSubstatus[_0x245d('0x6')](e,emitEvent(event));}}module['exports']=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 707137b..af5456a 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 _0xa576=['define','MailSubstatus','mail_substatuses','update','name','_previousDataValues','catch','./mailSubstatus.attributes','exports'];(function(_0x3a9dcc,_0x3ecf00){var _0xec0d99=function(_0x2ed9a2){while(--_0x2ed9a2){_0x3a9dcc['push'](_0x3a9dcc['shift']());}};_0xec0d99(++_0x3ecf00);}(_0xa576,0x11e));var _0x6a57=function(_0x3454f,_0x5e24ee){_0x3454f=_0x3454f-0x0;var _0x5ac22f=_0xa576[_0x3454f];return _0x5ac22f;};'use strict';var attributes=require(_0x6a57('0x0'));module[_0x6a57('0x1')]=function(_0x246cef){var _0x62259b=_0x246cef['models'];return _0x246cef[_0x6a57('0x2')](_0x6a57('0x3'),attributes,{'tableName':_0x6a57('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x4dacab,_0x1d75f6,_0x5add24){return _0x62259b['Condition'][_0x6a57('0x5')]({'value':_0x4dacab[_0x6a57('0x6')]},{'where':{'field':'mailSubstatus','value':_0x4dacab[_0x6a57('0x7')][_0x6a57('0x6')]}})['then'](function(){_0x5add24();})[_0x6a57('0x8')](function(_0x529aa6){_0x5add24(_0x529aa6);});}}});}; \ No newline at end of file +var _0x3e9b=['mailSubstatus','_previousDataValues','then','catch','./mailSubstatus.attributes','exports','models','define','MailSubstatus','mail_substatuses','Condition','name'];(function(_0x543eac,_0x3a39a1){var _0x16c036=function(_0x446e5d){while(--_0x446e5d){_0x543eac['push'](_0x543eac['shift']());}};_0x16c036(++_0x3a39a1);}(_0x3e9b,0x1b4));var _0xb3e9=function(_0x55209e,_0x24b64b){_0x55209e=_0x55209e-0x0;var _0x5913c4=_0x3e9b[_0x55209e];return _0x5913c4;};'use strict';var attributes=require(_0xb3e9('0x0'));module[_0xb3e9('0x1')]=function(_0x4d5b68){var _0x5954ca=_0x4d5b68[_0xb3e9('0x2')];return _0x4d5b68[_0xb3e9('0x3')](_0xb3e9('0x4'),attributes,{'tableName':_0xb3e9('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x19890b,_0x2e3394,_0x17d200){return _0x5954ca[_0xb3e9('0x6')]['update']({'value':_0x19890b[_0xb3e9('0x7')]},{'where':{'field':_0xb3e9('0x8'),'value':_0x19890b[_0xb3e9('0x9')][_0xb3e9('0x7')]}})[_0xb3e9('0xa')](function(){_0x17d200();})[_0xb3e9('0xb')](function(_0x5c3176){_0x17d200(_0x5c3176);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 3fb02dd..25f8684 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 _0x22ba=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','stringify','error','code','MailSubstatus,\x20%s,\x20%s','message','catch','lodash','util','moment'];(function(_0x381292,_0x35e190){var _0x25318e=function(_0x152d8f){while(--_0x152d8f){_0x381292['push'](_0x381292['shift']());}};_0x25318e(++_0x35e190);}(_0x22ba,0x1b2));var _0xa22b=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0x22ba[_0x5037ab];return _0x512adb;};'use strict';var _=require(_0xa22b('0x0'));var util=require(_0xa22b('0x1'));var moment=require(_0xa22b('0x2'));var BPromise=require(_0xa22b('0x3'));var rs=require(_0xa22b('0x4'));var fs=require('fs');var Redis=require(_0xa22b('0x5'));var db=require(_0xa22b('0x6'))['db'];var utils=require(_0xa22b('0x7'));var logger=require(_0xa22b('0x8'))(_0xa22b('0x9'));var config=require(_0xa22b('0xa'));var jayson=require(_0xa22b('0xb'));var client=jayson['client'][_0xa22b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x297fed,_0x54167a,_0x5d02b7){return new BPromise(function(_0x2869fa,_0x53e0ec){return client[_0xa22b('0xd')](_0x297fed,_0x5d02b7)['then'](function(_0x5c00b1){logger[_0xa22b('0xe')]('MailSubstatus,\x20%s,\x20%s',_0x54167a,_0xa22b('0xf'));logger[_0xa22b('0x10')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x54167a,_0xa22b('0xf'),JSON[_0xa22b('0x11')](_0x5c00b1));if(_0x5c00b1[_0xa22b('0x12')]){if(_0x5c00b1[_0xa22b('0x12')][_0xa22b('0x13')]===0x1f4){logger[_0xa22b('0x12')](_0xa22b('0x14'),_0x54167a,_0x5c00b1[_0xa22b('0x12')][_0xa22b('0x15')]);return _0x53e0ec(_0x5c00b1[_0xa22b('0x12')][_0xa22b('0x15')]);}logger[_0xa22b('0x12')]('MailSubstatus,\x20%s,\x20%s',_0x54167a,_0x5c00b1[_0xa22b('0x12')]['message']);return _0x2869fa(_0x5c00b1[_0xa22b('0x12')][_0xa22b('0x15')]);}else{logger['info']('MailSubstatus,\x20%s,\x20%s',_0x54167a,'request\x20sent');_0x2869fa(_0x5c00b1['result'][_0xa22b('0x15')]);}})[_0xa22b('0x16')](function(_0x5b6651){logger[_0xa22b('0x12')]('MailSubstatus,\x20%s,\x20%s',_0x54167a,_0x5b6651);_0x53e0ec(_0x5b6651);});});} \ No newline at end of file +var _0xfed3=['MailSubstatus,\x20%s,\x20%s','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','then','info','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x2dee2f,_0x19572f){var _0x327c18=function(_0x130ec0){while(--_0x130ec0){_0x2dee2f['push'](_0x2dee2f['shift']());}};_0x327c18(++_0x19572f);}(_0xfed3,0x18f));var _0x3fed=function(_0x421263,_0x18187d){_0x421263=_0x421263-0x0;var _0x34e4b5=_0xfed3[_0x421263];return _0x34e4b5;};'use strict';var _=require(_0x3fed('0x0'));var util=require('util');var moment=require(_0x3fed('0x1'));var BPromise=require(_0x3fed('0x2'));var rs=require(_0x3fed('0x3'));var fs=require('fs');var Redis=require(_0x3fed('0x4'));var db=require(_0x3fed('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3fed('0x6'));var config=require(_0x3fed('0x7'));var jayson=require(_0x3fed('0x8'));var client=jayson[_0x3fed('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x43aeb6,_0x41a218,_0x7a40df){return new BPromise(function(_0x1c2d98,_0x51c09a){return client[_0x3fed('0xa')](_0x43aeb6,_0x7a40df)[_0x3fed('0xb')](function(_0x47c5c2){logger[_0x3fed('0xc')]('MailSubstatus,\x20%s,\x20%s',_0x41a218,'request\x20sent');logger[_0x3fed('0xd')](_0x3fed('0xe'),_0x41a218,_0x3fed('0xf'),JSON[_0x3fed('0x10')](_0x47c5c2));if(_0x47c5c2[_0x3fed('0x11')]){if(_0x47c5c2[_0x3fed('0x11')][_0x3fed('0x12')]===0x1f4){logger['error'](_0x3fed('0x13'),_0x41a218,_0x47c5c2[_0x3fed('0x11')][_0x3fed('0x14')]);return _0x51c09a(_0x47c5c2[_0x3fed('0x11')][_0x3fed('0x14')]);}logger[_0x3fed('0x11')](_0x3fed('0x13'),_0x41a218,_0x47c5c2['error'][_0x3fed('0x14')]);return _0x1c2d98(_0x47c5c2[_0x3fed('0x11')][_0x3fed('0x14')]);}else{logger[_0x3fed('0xc')](_0x3fed('0x13'),_0x41a218,_0x3fed('0xf'));_0x1c2d98(_0x47c5c2['result'][_0x3fed('0x14')]);}})[_0x3fed('0x15')](function(_0x57c6f8){logger[_0x3fed('0x11')](_0x3fed('0x13'),_0x41a218,_0x57c6f8);_0x51c09a(_0x57c6f8);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 5c4c912..15bd9d2 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 _0xc9df=['../../config/environment','./mailTransferReport.controller','isAuthenticated','index','get','/:id','show','post','put','update','delete','destroy','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x12a55c,_0xe4a9a7){var _0x393f2f=function(_0x3b6aa){while(--_0x3b6aa){_0x12a55c['push'](_0x12a55c['shift']());}};_0x393f2f(++_0xe4a9a7);}(_0xc9df,0x174));var _0xfc9d=function(_0x413228,_0x562585){_0x413228=_0x413228-0x0;var _0x1970ee=_0xc9df[_0x413228];return _0x1970ee;};'use strict';var multer=require(_0xfc9d('0x0'));var util=require(_0xfc9d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xfc9d('0x2')]();var fs_extra=require(_0xfc9d('0x3'));var auth=require(_0xfc9d('0x4'));var interaction=require(_0xfc9d('0x5'));var config=require(_0xfc9d('0x6'));var controller=require(_0xfc9d('0x7'));router['get']('/',auth[_0xfc9d('0x8')](),controller[_0xfc9d('0x9')]);router[_0xfc9d('0xa')]('/describe',auth[_0xfc9d('0x8')](),controller['describe']);router[_0xfc9d('0xa')](_0xfc9d('0xb'),auth[_0xfc9d('0x8')](),controller[_0xfc9d('0xc')]);router[_0xfc9d('0xd')]('/',auth[_0xfc9d('0x8')](),controller['create']);router[_0xfc9d('0xe')](_0xfc9d('0xb'),auth[_0xfc9d('0x8')](),controller[_0xfc9d('0xf')]);router[_0xfc9d('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xfc9d('0x11')]);module['exports']=router; \ No newline at end of file +var _0xfc3e=['../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','put','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x268b17,_0x29d18c){var _0x2dc53d=function(_0x2e4a11){while(--_0x2e4a11){_0x268b17['push'](_0x268b17['shift']());}};_0x2dc53d(++_0x29d18c);}(_0xfc3e,0x149));var _0xefc3=function(_0x2adf59,_0x561aaf){_0x2adf59=_0x2adf59-0x0;var _0x1d8d3e=_0xfc3e[_0x2adf59];return _0x1d8d3e;};'use strict';var multer=require('multer');var util=require(_0xefc3('0x0'));var path=require(_0xefc3('0x1'));var timeout=require(_0xefc3('0x2'));var express=require(_0xefc3('0x3'));var router=express[_0xefc3('0x4')]();var fs_extra=require(_0xefc3('0x5'));var auth=require(_0xefc3('0x6'));var interaction=require(_0xefc3('0x7'));var config=require(_0xefc3('0x8'));var controller=require(_0xefc3('0x9'));router[_0xefc3('0xa')]('/',auth[_0xefc3('0xb')](),controller['index']);router['get'](_0xefc3('0xc'),auth[_0xefc3('0xb')](),controller[_0xefc3('0xd')]);router[_0xefc3('0xa')](_0xefc3('0xe'),auth['isAuthenticated'](),controller[_0xefc3('0xf')]);router[_0xefc3('0x10')]('/',auth[_0xefc3('0xb')](),controller['create']);router[_0xefc3('0x11')](_0xefc3('0xe'),auth[_0xefc3('0xb')](),controller[_0xefc3('0x12')]);router[_0xefc3('0x13')](_0xefc3('0xe'),auth[_0xefc3('0xb')](),controller[_0xefc3('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index fec5a79..6b506e8 100644 --- a/server/api/mailTransferReport/mailTransferReport.attributes.js +++ b/server/api/mailTransferReport/mailTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x41cec7,_0x2e1f4a){var _0x5ed26a=function(_0x447ad7){while(--_0x447ad7){_0x41cec7['push'](_0x41cec7['shift']());}};_0x5ed26a(++_0x2e1f4a);}(_0x34e8,0x12c));var _0x834e=function(_0x54cb56,_0xe43057){_0x54cb56=_0x54cb56-0x0;var _0x48ff22=_0x34e8[_0x54cb56];return _0x48ff22;};'use strict';var moment=require(_0x834e('0x0'));var Sequelize=require(_0x834e('0x1'));module[_0x834e('0x2')]={'uniqueid':{'type':Sequelize[_0x834e('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6')),'allowNull':![],'defaultValue':_0x834e('0x6')},'transferredAt':{'type':Sequelize[_0x834e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x834e('0x8')]}}; \ No newline at end of file +var _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0xa03538,_0x4f3719){var _0x5a7b4a=function(_0x2e2731){while(--_0x2e2731){_0xa03538['push'](_0xa03538['shift']());}};_0x5a7b4a(++_0x4f3719);}(_0x70e0,0x17b));var _0x070e=function(_0x7ad2bd,_0x54858f){_0x7ad2bd=_0x7ad2bd-0x0;var _0x142331=_0x70e0[_0x7ad2bd];return _0x142331;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 057837c..cccbc82 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 _0xbe5b=['catch','show','params','length','find','create','body','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','merge','map','type','filter','options','MailTransferReport','includeAll','rows'];(function(_0x31b990,_0x4310c4){var _0x30d0ce=function(_0x4d5a9e){while(--_0x4d5a9e){_0x31b990['push'](_0x31b990['shift']());}};_0x30d0ce(++_0x4310c4);}(_0xbe5b,0x1c9));var _0xbbe5=function(_0x17cdd9,_0x33e50a){_0x17cdd9=_0x17cdd9-0x0;var _0x33a9df=_0xbe5b[_0x17cdd9];return _0x33a9df;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbbe5('0x0'));var zipdir=require(_0xbbe5('0x1'));var jsonpatch=require(_0xbbe5('0x2'));var rp=require('request-promise');var moment=require(_0xbbe5('0x3'));var BPromise=require(_0xbbe5('0x4'));var Mustache=require(_0xbbe5('0x5'));var util=require(_0xbbe5('0x6'));var path=require(_0xbbe5('0x7'));var sox=require(_0xbbe5('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbbe5('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xbbe5('0xa'));var deskjs=require(_0xbbe5('0xb'));var toCsv=require(_0xbbe5('0xc'));var querystring=require(_0xbbe5('0xd'));var Papa=require(_0xbbe5('0xe'));var Redis=require(_0xbbe5('0xf'));var authService=require(_0xbbe5('0x10'));var qs=require(_0xbbe5('0x11'));var as=require(_0xbbe5('0x12'));var hardwareService=require(_0xbbe5('0x13'));var logger=require(_0xbbe5('0x14'))(_0xbbe5('0x15'));var utils=require(_0xbbe5('0x16'));var config=require(_0xbbe5('0x17'));var licenseUtil=require(_0xbbe5('0x18'));var db=require(_0xbbe5('0x19'))['db'];function respondWithStatusCode(_0x6f9757,_0x4241cc){_0x4241cc=_0x4241cc||0xcc;return function(_0x1fbca3){if(_0x1fbca3){return _0x6f9757[_0xbbe5('0x1a')](_0x4241cc);}return _0x6f9757[_0xbbe5('0x1b')](_0x4241cc)[_0xbbe5('0x1c')]();};}function respondWithResult(_0x3ef0a1,_0x11bdc6){_0x11bdc6=_0x11bdc6||0xc8;return function(_0x4112c7){if(_0x4112c7){return _0x3ef0a1[_0xbbe5('0x1b')](_0x11bdc6)['json'](_0x4112c7);}};}function respondWithFilteredResult(_0x158eb9,_0x4e2d4b){return function(_0x4e914b){if(_0x4e914b){var _0x346c4f=typeof _0x4e2d4b[_0xbbe5('0x1d')]===_0xbbe5('0x1e')&&typeof _0x4e2d4b[_0xbbe5('0x1f')]===_0xbbe5('0x1e');var _0x2cec91=_0x4e914b[_0xbbe5('0x20')];var _0x2e9383=_0x346c4f?0x0:_0x4e2d4b[_0xbbe5('0x1d')];var _0x5c570b=_0x346c4f?_0x4e914b[_0xbbe5('0x20')]:_0x4e2d4b[_0xbbe5('0x1d')]+_0x4e2d4b[_0xbbe5('0x1f')];var _0x5bf9ad;if(_0x5c570b>=_0x2cec91){_0x5c570b=_0x2cec91;_0x5bf9ad=0xc8;}else{_0x5bf9ad=0xce;}_0x158eb9[_0xbbe5('0x1b')](_0x5bf9ad);return _0x158eb9[_0xbbe5('0x21')](_0xbbe5('0x22'),_0x2e9383+'-'+_0x5c570b+'/'+_0x2cec91)[_0xbbe5('0x23')](_0x4e914b);}return null;};}function patchUpdates(_0x287f59){return function(_0xb6b65b){try{jsonpatch[_0xbbe5('0x24')](_0xb6b65b,_0x287f59,!![]);}catch(_0x2503e4){return BPromise[_0xbbe5('0x25')](_0x2503e4);}return _0xb6b65b[_0xbbe5('0x26')]();};}function saveUpdates(_0x76e793,_0x4ceb55){return function(_0x8ee43){if(_0x8ee43){return _0x8ee43[_0xbbe5('0x27')](_0x76e793)[_0xbbe5('0x28')](function(_0x17e911){return _0x17e911;});}return null;};}function removeEntity(_0x5b8c84,_0x340039){return function(_0x56ef19){if(_0x56ef19){return _0x56ef19[_0xbbe5('0x29')]()[_0xbbe5('0x28')](function(){_0x5b8c84[_0xbbe5('0x1b')](0xcc)[_0xbbe5('0x1c')]();});}};}function handleEntityNotFound(_0x30c457,_0x5f224c){return function(_0x3d0f49){if(!_0x3d0f49){_0x30c457[_0xbbe5('0x1a')](0x194);}return _0x3d0f49;};}function handleError(_0x58cae9,_0x545ccd){_0x545ccd=_0x545ccd||0x1f4;return function(_0x13508e){logger[_0xbbe5('0x2a')](_0x13508e[_0xbbe5('0x2b')]);if(_0x13508e[_0xbbe5('0x2c')]){delete _0x13508e[_0xbbe5('0x2c')];}_0x58cae9[_0xbbe5('0x1b')](_0x545ccd)[_0xbbe5('0x2d')](_0x13508e);};}exports['index']=function(_0xa7f156,_0x498c59){var _0x10bc18={},_0x16677f={},_0x2431f3={'count':0x0,'rows':[]};var _0x19aace=_['map'](db['MailTransferReport'][_0xbbe5('0x2e')],function(_0x3d1325){return{'name':_0x3d1325['fieldName'],'type':_0x3d1325['type'][_0xbbe5('0x2f')]};});_0x16677f[_0xbbe5('0x30')]=_['map'](_0x19aace,_0xbbe5('0x2c'));_0x16677f[_0xbbe5('0x31')]=_[_0xbbe5('0x32')](_0xa7f156[_0xbbe5('0x31')]);_0x16677f[_0xbbe5('0x33')]=_[_0xbbe5('0x34')](_0x16677f[_0xbbe5('0x30')],_0x16677f[_0xbbe5('0x31')]);_0x10bc18['attributes']=_['intersection'](_0x16677f[_0xbbe5('0x30')],qs[_0xbbe5('0x35')](_0xa7f156['query'][_0xbbe5('0x35')]));_0x10bc18[_0xbbe5('0x36')]=_0x10bc18[_0xbbe5('0x36')]['length']?_0x10bc18[_0xbbe5('0x36')]:_0x16677f['model'];if(!_0xa7f156[_0xbbe5('0x31')][_0xbbe5('0x37')](_0xbbe5('0x38'))){_0x10bc18[_0xbbe5('0x1f')]=qs[_0xbbe5('0x1f')](_0xa7f156[_0xbbe5('0x31')][_0xbbe5('0x1f')]);_0x10bc18[_0xbbe5('0x1d')]=qs[_0xbbe5('0x1d')](_0xa7f156['query'][_0xbbe5('0x1d')]);}_0x10bc18[_0xbbe5('0x39')]=qs[_0xbbe5('0x3a')](_0xa7f156['query'][_0xbbe5('0x3a')]);_0x10bc18[_0xbbe5('0x3b')]=qs[_0xbbe5('0x33')](_['pick'](_0xa7f156['query'],_0x16677f[_0xbbe5('0x33')]),_0x19aace);if(_0xa7f156['query']['filter']){_0x10bc18['where']=_[_0xbbe5('0x3c')](_0x10bc18['where'],{'$or':_[_0xbbe5('0x3d')](_0x19aace,function(_0x5d54b2){if(_0x5d54b2[_0xbbe5('0x3e')]!=='VIRTUAL'){var _0x4175a2={};_0x4175a2[_0x5d54b2[_0xbbe5('0x2c')]]={'$like':'%'+_0xa7f156[_0xbbe5('0x31')][_0xbbe5('0x3f')]+'%'};return _0x4175a2;}})});}_0x10bc18=_['merge']({},_0x10bc18,_0xa7f156[_0xbbe5('0x40')]);var _0x2bcc60={'where':_0x10bc18[_0xbbe5('0x3b')]};return db[_0xbbe5('0x41')]['count'](_0x2bcc60)['then'](function(_0x5169d1){_0x2431f3['count']=_0x5169d1;if(_0xa7f156['query'][_0xbbe5('0x42')]){_0x10bc18['include']=[{'all':!![]}];}return db[_0xbbe5('0x41')]['findAll'](_0x10bc18);})[_0xbbe5('0x28')](function(_0x19dd85){_0x2431f3[_0xbbe5('0x43')]=_0x19dd85;return _0x2431f3;})[_0xbbe5('0x28')](respondWithFilteredResult(_0x498c59,_0x10bc18))[_0xbbe5('0x44')](handleError(_0x498c59,null));};exports[_0xbbe5('0x45')]=function(_0x3602ea,_0x256769){var _0xde8776={'raw':!![],'where':{'id':_0x3602ea[_0xbbe5('0x46')]['id']}},_0xba4262={};_0xba4262[_0xbbe5('0x30')]=_[_0xbbe5('0x32')](db[_0xbbe5('0x41')]['rawAttributes']);_0xba4262['query']=_[_0xbbe5('0x32')](_0x3602ea[_0xbbe5('0x31')]);_0xba4262[_0xbbe5('0x33')]=_['intersection'](_0xba4262['model'],_0xba4262[_0xbbe5('0x31')]);_0xde8776[_0xbbe5('0x36')]=_['intersection'](_0xba4262[_0xbbe5('0x30')],qs[_0xbbe5('0x35')](_0x3602ea['query']['fields']));_0xde8776[_0xbbe5('0x36')]=_0xde8776[_0xbbe5('0x36')][_0xbbe5('0x47')]?_0xde8776['attributes']:_0xba4262[_0xbbe5('0x30')];if(_0x3602ea['query'][_0xbbe5('0x42')]){_0xde8776['include']=[{'all':!![]}];}_0xde8776=_[_0xbbe5('0x3c')]({},_0xde8776,_0x3602ea[_0xbbe5('0x40')]);return db['MailTransferReport'][_0xbbe5('0x48')](_0xde8776)['then'](handleEntityNotFound(_0x256769,null))[_0xbbe5('0x28')](respondWithResult(_0x256769,null))[_0xbbe5('0x44')](handleError(_0x256769,null));};exports['create']=function(_0x2684fb,_0x28585c){return db[_0xbbe5('0x41')][_0xbbe5('0x49')](_0x2684fb['body'],{})[_0xbbe5('0x28')](respondWithResult(_0x28585c,0xc9))[_0xbbe5('0x44')](handleError(_0x28585c,null));};exports[_0xbbe5('0x27')]=function(_0x85f622,_0x5a765e){if(_0x85f622[_0xbbe5('0x4a')]['id']){delete _0x85f622[_0xbbe5('0x4a')]['id'];}return db[_0xbbe5('0x41')][_0xbbe5('0x48')]({'where':{'id':_0x85f622['params']['id']}})['then'](handleEntityNotFound(_0x5a765e,null))[_0xbbe5('0x28')](saveUpdates(_0x85f622['body'],null))['then'](respondWithResult(_0x5a765e,null))['catch'](handleError(_0x5a765e,null));};exports[_0xbbe5('0x29')]=function(_0x7470af,_0x3a8f87){return db[_0xbbe5('0x41')][_0xbbe5('0x48')]({'where':{'id':_0x7470af[_0xbbe5('0x46')]['id']}})[_0xbbe5('0x28')](handleEntityNotFound(_0x3a8f87,null))[_0xbbe5('0x28')](removeEntity(_0x3a8f87,null))[_0xbbe5('0x44')](handleError(_0x3a8f87,null));};exports['describe']=function(_0x605eb8,_0x5a50ab){return db[_0xbbe5('0x41')]['describe']()[_0xbbe5('0x28')](respondWithResult(_0x5a50ab,null))['catch'](handleError(_0x5a50ab,null));}; \ No newline at end of file +var _0x1b89=['include','findAll','rows','catch','params','length','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','offset','count','limit','set','Content-Range','apply','reject','destroy','error','stack','name','send','index','map','MailTransferReport','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','nolimit','order','sort','filters','pick','filter','where','merge','options','then','includeAll'];(function(_0x454018,_0x46e33a){var _0x24697d=function(_0x3ec647){while(--_0x3ec647){_0x454018['push'](_0x454018['shift']());}};_0x24697d(++_0x46e33a);}(_0x1b89,0x1df));var _0x91b8=function(_0xe2070e,_0x3a8903){_0xe2070e=_0xe2070e-0x0;var _0x377eee=_0x1b89[_0xe2070e];return _0x377eee;};'use strict';var emlformat=require(_0x91b8('0x0'));var rimraf=require(_0x91b8('0x1'));var zipdir=require(_0x91b8('0x2'));var jsonpatch=require(_0x91b8('0x3'));var rp=require(_0x91b8('0x4'));var moment=require(_0x91b8('0x5'));var BPromise=require(_0x91b8('0x6'));var Mustache=require(_0x91b8('0x7'));var util=require(_0x91b8('0x8'));var path=require(_0x91b8('0x9'));var sox=require(_0x91b8('0xa'));var csv=require(_0x91b8('0xb'));var ejs=require(_0x91b8('0xc'));var fs=require('fs');var fs_extra=require(_0x91b8('0xd'));var _=require(_0x91b8('0xe'));var squel=require(_0x91b8('0xf'));var crypto=require(_0x91b8('0x10'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x91b8('0xb'));var querystring=require(_0x91b8('0x11'));var Papa=require(_0x91b8('0x12'));var Redis=require(_0x91b8('0x13'));var authService=require(_0x91b8('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x91b8('0x15'));var hardwareService=require(_0x91b8('0x16'));var logger=require('../../config/logger')(_0x91b8('0x17'));var utils=require('../../config/utils');var config=require(_0x91b8('0x18'));var licenseUtil=require(_0x91b8('0x19'));var db=require(_0x91b8('0x1a'))['db'];function respondWithStatusCode(_0x4f4aec,_0x4fd754){_0x4fd754=_0x4fd754||0xcc;return function(_0x2408c4){if(_0x2408c4){return _0x4f4aec[_0x91b8('0x1b')](_0x4fd754);}return _0x4f4aec[_0x91b8('0x1c')](_0x4fd754)[_0x91b8('0x1d')]();};}function respondWithResult(_0x4e22c4,_0x131602){_0x131602=_0x131602||0xc8;return function(_0x3c3eae){if(_0x3c3eae){return _0x4e22c4[_0x91b8('0x1c')](_0x131602)[_0x91b8('0x1e')](_0x3c3eae);}};}function respondWithFilteredResult(_0x4473bb,_0x570ad6){return function(_0x43a97b){if(_0x43a97b){var _0x4eb9bb=typeof _0x570ad6['offset']===_0x91b8('0x1f')&&typeof _0x570ad6['limit']===_0x91b8('0x1f');var _0x413546=_0x43a97b['count'];var _0x26e820=_0x4eb9bb?0x0:_0x570ad6[_0x91b8('0x20')];var _0x38aa53=_0x4eb9bb?_0x43a97b[_0x91b8('0x21')]:_0x570ad6[_0x91b8('0x20')]+_0x570ad6[_0x91b8('0x22')];var _0x1db48d;if(_0x38aa53>=_0x413546){_0x38aa53=_0x413546;_0x1db48d=0xc8;}else{_0x1db48d=0xce;}_0x4473bb['status'](_0x1db48d);return _0x4473bb[_0x91b8('0x23')](_0x91b8('0x24'),_0x26e820+'-'+_0x38aa53+'/'+_0x413546)[_0x91b8('0x1e')](_0x43a97b);}return null;};}function patchUpdates(_0x4bf8b0){return function(_0x378bc7){try{jsonpatch[_0x91b8('0x25')](_0x378bc7,_0x4bf8b0,!![]);}catch(_0x3ecf0c){return BPromise[_0x91b8('0x26')](_0x3ecf0c);}return _0x378bc7['save']();};}function saveUpdates(_0x59ee81,_0xa0524){return function(_0x4797cc){if(_0x4797cc){return _0x4797cc['update'](_0x59ee81)['then'](function(_0x2d26cc){return _0x2d26cc;});}return null;};}function removeEntity(_0x3786df,_0xd11a04){return function(_0x2d26b6){if(_0x2d26b6){return _0x2d26b6[_0x91b8('0x27')]()['then'](function(){_0x3786df[_0x91b8('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1fc226,_0x4cb424){return function(_0x1a8407){if(!_0x1a8407){_0x1fc226[_0x91b8('0x1b')](0x194);}return _0x1a8407;};}function handleError(_0x5915e8,_0xbfa7f3){_0xbfa7f3=_0xbfa7f3||0x1f4;return function(_0x4afba1){logger[_0x91b8('0x28')](_0x4afba1[_0x91b8('0x29')]);if(_0x4afba1[_0x91b8('0x2a')]){delete _0x4afba1[_0x91b8('0x2a')];}_0x5915e8['status'](_0xbfa7f3)[_0x91b8('0x2b')](_0x4afba1);};}exports[_0x91b8('0x2c')]=function(_0x371bfe,_0x4df12d){var _0x468179={},_0x19597a={},_0x2163b2={'count':0x0,'rows':[]};var _0x783272=_[_0x91b8('0x2d')](db[_0x91b8('0x2e')][_0x91b8('0x2f')],function(_0xae649f){return{'name':_0xae649f['fieldName'],'type':_0xae649f[_0x91b8('0x30')][_0x91b8('0x31')]};});_0x19597a[_0x91b8('0x32')]=_['map'](_0x783272,_0x91b8('0x2a'));_0x19597a[_0x91b8('0x33')]=_[_0x91b8('0x34')](_0x371bfe[_0x91b8('0x33')]);_0x19597a['filters']=_[_0x91b8('0x35')](_0x19597a[_0x91b8('0x32')],_0x19597a[_0x91b8('0x33')]);_0x468179[_0x91b8('0x36')]=_[_0x91b8('0x35')](_0x19597a[_0x91b8('0x32')],qs[_0x91b8('0x37')](_0x371bfe[_0x91b8('0x33')]['fields']));_0x468179[_0x91b8('0x36')]=_0x468179[_0x91b8('0x36')]['length']?_0x468179[_0x91b8('0x36')]:_0x19597a['model'];if(!_0x371bfe['query']['hasOwnProperty'](_0x91b8('0x38'))){_0x468179[_0x91b8('0x22')]=qs[_0x91b8('0x22')](_0x371bfe['query'][_0x91b8('0x22')]);_0x468179[_0x91b8('0x20')]=qs[_0x91b8('0x20')](_0x371bfe[_0x91b8('0x33')]['offset']);}_0x468179[_0x91b8('0x39')]=qs[_0x91b8('0x3a')](_0x371bfe[_0x91b8('0x33')][_0x91b8('0x3a')]);_0x468179['where']=qs[_0x91b8('0x3b')](_[_0x91b8('0x3c')](_0x371bfe[_0x91b8('0x33')],_0x19597a['filters']),_0x783272);if(_0x371bfe[_0x91b8('0x33')][_0x91b8('0x3d')]){_0x468179[_0x91b8('0x3e')]=_[_0x91b8('0x3f')](_0x468179[_0x91b8('0x3e')],{'$or':_[_0x91b8('0x2d')](_0x783272,function(_0x3534a6){if(_0x3534a6[_0x91b8('0x30')]!=='VIRTUAL'){var _0x5d8e79={};_0x5d8e79[_0x3534a6[_0x91b8('0x2a')]]={'$like':'%'+_0x371bfe[_0x91b8('0x33')][_0x91b8('0x3d')]+'%'};return _0x5d8e79;}})});}_0x468179=_['merge']({},_0x468179,_0x371bfe[_0x91b8('0x40')]);var _0x3c2a21={'where':_0x468179[_0x91b8('0x3e')]};return db[_0x91b8('0x2e')][_0x91b8('0x21')](_0x3c2a21)[_0x91b8('0x41')](function(_0xfdbb33){_0x2163b2[_0x91b8('0x21')]=_0xfdbb33;if(_0x371bfe[_0x91b8('0x33')][_0x91b8('0x42')]){_0x468179[_0x91b8('0x43')]=[{'all':!![]}];}return db[_0x91b8('0x2e')][_0x91b8('0x44')](_0x468179);})['then'](function(_0x29878c){_0x2163b2[_0x91b8('0x45')]=_0x29878c;return _0x2163b2;})['then'](respondWithFilteredResult(_0x4df12d,_0x468179))[_0x91b8('0x46')](handleError(_0x4df12d,null));};exports['show']=function(_0x1c78cf,_0x179c8d){var _0x32224d={'raw':!![],'where':{'id':_0x1c78cf[_0x91b8('0x47')]['id']}},_0x1e9160={};_0x1e9160[_0x91b8('0x32')]=_[_0x91b8('0x34')](db['MailTransferReport'][_0x91b8('0x2f')]);_0x1e9160[_0x91b8('0x33')]=_[_0x91b8('0x34')](_0x1c78cf[_0x91b8('0x33')]);_0x1e9160['filters']=_[_0x91b8('0x35')](_0x1e9160[_0x91b8('0x32')],_0x1e9160['query']);_0x32224d['attributes']=_['intersection'](_0x1e9160[_0x91b8('0x32')],qs[_0x91b8('0x37')](_0x1c78cf[_0x91b8('0x33')][_0x91b8('0x37')]));_0x32224d[_0x91b8('0x36')]=_0x32224d['attributes'][_0x91b8('0x48')]?_0x32224d[_0x91b8('0x36')]:_0x1e9160[_0x91b8('0x32')];if(_0x1c78cf['query'][_0x91b8('0x42')]){_0x32224d[_0x91b8('0x43')]=[{'all':!![]}];}_0x32224d=_[_0x91b8('0x3f')]({},_0x32224d,_0x1c78cf[_0x91b8('0x40')]);return db['MailTransferReport'][_0x91b8('0x49')](_0x32224d)[_0x91b8('0x41')](handleEntityNotFound(_0x179c8d,null))['then'](respondWithResult(_0x179c8d,null))[_0x91b8('0x46')](handleError(_0x179c8d,null));};exports[_0x91b8('0x4a')]=function(_0x3e4591,_0x4db18e){return db[_0x91b8('0x2e')]['create'](_0x3e4591[_0x91b8('0x4b')],{})[_0x91b8('0x41')](respondWithResult(_0x4db18e,0xc9))[_0x91b8('0x46')](handleError(_0x4db18e,null));};exports[_0x91b8('0x4c')]=function(_0x37801d,_0x401c06){if(_0x37801d[_0x91b8('0x4b')]['id']){delete _0x37801d[_0x91b8('0x4b')]['id'];}return db[_0x91b8('0x2e')]['find']({'where':{'id':_0x37801d['params']['id']}})[_0x91b8('0x41')](handleEntityNotFound(_0x401c06,null))['then'](saveUpdates(_0x37801d[_0x91b8('0x4b')],null))['then'](respondWithResult(_0x401c06,null))[_0x91b8('0x46')](handleError(_0x401c06,null));};exports[_0x91b8('0x27')]=function(_0x5b1496,_0x2d8571){return db[_0x91b8('0x2e')][_0x91b8('0x49')]({'where':{'id':_0x5b1496['params']['id']}})[_0x91b8('0x41')](handleEntityNotFound(_0x2d8571,null))['then'](removeEntity(_0x2d8571,null))[_0x91b8('0x46')](handleError(_0x2d8571,null));};exports[_0x91b8('0x4d')]=function(_0x1e98eb,_0x4c7411){return db[_0x91b8('0x2e')]['describe']()[_0x91b8('0x41')](respondWithResult(_0x4c7411,null))[_0x91b8('0x46')](handleError(_0x4c7411,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 14021a3..ae119cd 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 _0xa1a9=['uniqueid','lodash','api','bluebird','request-promise','./mailTransferReport.attributes','MailTransferReport'];(function(_0x30ee2a,_0x582ec2){var _0x1815c1=function(_0x4ee13d){while(--_0x4ee13d){_0x30ee2a['push'](_0x30ee2a['shift']());}};_0x1815c1(++_0x582ec2);}(_0xa1a9,0x9b));var _0x9a1a=function(_0x162dd3,_0x22f9bd){_0x162dd3=_0x162dd3-0x0;var _0x7e9f41=_0xa1a9[_0x162dd3];return _0x7e9f41;};'use strict';var _=require(_0x9a1a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x9a1a('0x1'));var moment=require('moment');var BPromise=require(_0x9a1a('0x2'));var rp=require(_0x9a1a('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9a1a('0x4'));module['exports']=function(_0x433b6e,_0x412c30){return _0x433b6e['define'](_0x9a1a('0x5'),attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x9a1a('0x6')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8743=['uniqueid','lodash','util','../../config/logger','moment','bluebird','rimraf','../../config/environment','./mailTransferReport.attributes','define','report_mail_transfer'];(function(_0x386c73,_0x52798c){var _0x12615e=function(_0x1ccc24){while(--_0x1ccc24){_0x386c73['push'](_0x386c73['shift']());}};_0x12615e(++_0x52798c);}(_0x8743,0x7a));var _0x3874=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x8743[_0x311c35];return _0x5cc50c;};'use strict';var _=require(_0x3874('0x0'));var util=require(_0x3874('0x1'));var logger=require(_0x3874('0x2'))('api');var moment=require(_0x3874('0x3'));var BPromise=require(_0x3874('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3874('0x5'));var config=require(_0x3874('0x6'));var attributes=require(_0x3874('0x7'));module['exports']=function(_0x597a79,_0x4b242a){return _0x597a79[_0x3874('0x8')]('MailTransferReport',attributes,{'tableName':_0x3874('0x9'),'paranoid':![],'indexes':[{'name':_0x3874('0xa'),'fields':[_0x3874('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index baaa1a6..bceb361 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 _0x7bd2=['catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x243acf,_0x40a42f){var _0x24f5cf=function(_0x28470a){while(--_0x28470a){_0x243acf['push'](_0x243acf['shift']());}};_0x24f5cf(++_0x40a42f);}(_0x7bd2,0xe8));var _0x27bd=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7bd2[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x27bd('0x0'));var moment=require(_0x27bd('0x1'));var BPromise=require(_0x27bd('0x2'));var rs=require(_0x27bd('0x3'));var fs=require('fs');var Redis=require(_0x27bd('0x4'));var db=require(_0x27bd('0x5'))['db'];var utils=require(_0x27bd('0x6'));var logger=require(_0x27bd('0x7'))(_0x27bd('0x8'));var config=require('../../config/environment');var jayson=require(_0x27bd('0x9'));var client=jayson[_0x27bd('0xa')][_0x27bd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54b0a4,_0xd85157,_0x1a3e29){return new BPromise(function(_0x129b16,_0x2265c0){return client[_0x27bd('0xc')](_0x54b0a4,_0x1a3e29)['then'](function(_0x13975c){logger[_0x27bd('0xd')](_0x27bd('0xe'),_0xd85157,_0x27bd('0xf'));logger['debug'](_0x27bd('0x10'),_0xd85157,_0x27bd('0xf'),JSON[_0x27bd('0x11')](_0x13975c));if(_0x13975c[_0x27bd('0x12')]){if(_0x13975c[_0x27bd('0x12')]['code']===0x1f4){logger['error'](_0x27bd('0xe'),_0xd85157,_0x13975c['error'][_0x27bd('0x13')]);return _0x2265c0(_0x13975c[_0x27bd('0x12')][_0x27bd('0x13')]);}logger[_0x27bd('0x12')]('MailTransferReport,\x20%s,\x20%s',_0xd85157,_0x13975c[_0x27bd('0x12')][_0x27bd('0x13')]);return _0x129b16(_0x13975c[_0x27bd('0x12')][_0x27bd('0x13')]);}else{logger[_0x27bd('0xd')]('MailTransferReport,\x20%s,\x20%s',_0xd85157,_0x27bd('0xf'));_0x129b16(_0x13975c['result'][_0x27bd('0x13')]);}})[_0x27bd('0x14')](function(_0x268d55){logger[_0x27bd('0x12')](_0x27bd('0xe'),_0xd85157,_0x268d55);_0x2265c0(_0x268d55);});});} \ No newline at end of file +var _0x0d09=['rpc','../../config/environment','jayson/promise','request','then','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1a4d56,_0x1a7a70){var _0x24e4aa=function(_0x803330){while(--_0x803330){_0x1a4d56['push'](_0x1a4d56['shift']());}};_0x24e4aa(++_0x1a7a70);}(_0x0d09,0x100));var _0x90d0=function(_0x3a9661,_0x530b12){_0x3a9661=_0x3a9661-0x0;var _0x5bb119=_0x0d09[_0x3a9661];return _0x5bb119;};'use strict';var _=require(_0x90d0('0x0'));var util=require('util');var moment=require(_0x90d0('0x1'));var BPromise=require(_0x90d0('0x2'));var rs=require(_0x90d0('0x3'));var fs=require('fs');var Redis=require(_0x90d0('0x4'));var db=require(_0x90d0('0x5'))['db'];var utils=require(_0x90d0('0x6'));var logger=require(_0x90d0('0x7'))(_0x90d0('0x8'));var config=require(_0x90d0('0x9'));var jayson=require(_0x90d0('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2d7dba,_0x2cd13b,_0x1df7ba){return new BPromise(function(_0x340f7a,_0xa469ff){return client[_0x90d0('0xb')](_0x2d7dba,_0x1df7ba)[_0x90d0('0xc')](function(_0x10ed0c){logger['info'](_0x90d0('0xd'),_0x2cd13b,_0x90d0('0xe'));logger[_0x90d0('0xf')](_0x90d0('0x10'),_0x2cd13b,'request\x20sent',JSON[_0x90d0('0x11')](_0x10ed0c));if(_0x10ed0c['error']){if(_0x10ed0c[_0x90d0('0x12')][_0x90d0('0x13')]===0x1f4){logger[_0x90d0('0x12')](_0x90d0('0xd'),_0x2cd13b,_0x10ed0c[_0x90d0('0x12')][_0x90d0('0x14')]);return _0xa469ff(_0x10ed0c['error'][_0x90d0('0x14')]);}logger[_0x90d0('0x12')](_0x90d0('0xd'),_0x2cd13b,_0x10ed0c[_0x90d0('0x12')][_0x90d0('0x14')]);return _0x340f7a(_0x10ed0c[_0x90d0('0x12')][_0x90d0('0x14')]);}else{logger[_0x90d0('0x15')](_0x90d0('0xd'),_0x2cd13b,'request\x20sent');_0x340f7a(_0x10ed0c[_0x90d0('0x16')][_0x90d0('0x14')]);}})[_0x90d0('0x17')](function(_0x573a21){logger[_0x90d0('0x12')](_0x90d0('0xd'),_0x2cd13b,_0x573a21);_0xa469ff(_0x573a21);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index bcdbf00..ba4d255 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 _0x0a2b=['../../config/environment','./memberReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','put','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service'];(function(_0x4fa364,_0x3b3fee){var _0xa56421=function(_0x42a623){while(--_0x42a623){_0x4fa364['push'](_0x4fa364['shift']());}};_0xa56421(++_0x3b3fee);}(_0x0a2b,0x15f));var _0xb0a2=function(_0x45bf86,_0x75586e){_0x45bf86=_0x45bf86-0x0;var _0x1f02b7=_0x0a2b[_0x45bf86];return _0x1f02b7;};'use strict';var multer=require(_0xb0a2('0x0'));var util=require('util');var path=require(_0xb0a2('0x1'));var timeout=require(_0xb0a2('0x2'));var express=require('express');var router=express[_0xb0a2('0x3')]();var fs_extra=require(_0xb0a2('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xb0a2('0x5'));var config=require(_0xb0a2('0x6'));var controller=require(_0xb0a2('0x7'));router['get']('/',auth[_0xb0a2('0x8')](),controller[_0xb0a2('0x9')]);router[_0xb0a2('0xa')](_0xb0a2('0xb'),auth[_0xb0a2('0x8')](),controller[_0xb0a2('0xc')]);router[_0xb0a2('0xa')](_0xb0a2('0xd'),auth['isAuthenticated'](),controller[_0xb0a2('0xe')]);router[_0xb0a2('0xf')]('/',auth[_0xb0a2('0x8')](),controller['create']);router[_0xb0a2('0x10')]('/:id',auth[_0xb0a2('0x8')](),controller[_0xb0a2('0x11')]);router[_0xb0a2('0x12')](_0xb0a2('0xd'),auth[_0xb0a2('0x8')](),controller[_0xb0a2('0x13')]);module[_0xb0a2('0x14')]=router; \ No newline at end of file +var _0xae26=['../../config/environment','./memberReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service'];(function(_0x52c4e4,_0x4978e3){var _0x4d154e=function(_0x461e20){while(--_0x461e20){_0x52c4e4['push'](_0x52c4e4['shift']());}};_0x4d154e(++_0x4978e3);}(_0xae26,0x174));var _0x6ae2=function(_0x5a3f93,_0x3cd13d){_0x5a3f93=_0x5a3f93-0x0;var _0x155ea2=_0xae26[_0x5a3f93];return _0x155ea2;};'use strict';var multer=require(_0x6ae2('0x0'));var util=require(_0x6ae2('0x1'));var path=require(_0x6ae2('0x2'));var timeout=require('connect-timeout');var express=require(_0x6ae2('0x3'));var router=express[_0x6ae2('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6ae2('0x5'));var config=require(_0x6ae2('0x6'));var controller=require(_0x6ae2('0x7'));router[_0x6ae2('0x8')]('/',auth[_0x6ae2('0x9')](),controller[_0x6ae2('0xa')]);router[_0x6ae2('0x8')](_0x6ae2('0xb'),auth['isAuthenticated'](),controller[_0x6ae2('0xc')]);router['get'](_0x6ae2('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x6ae2('0xe')]('/',auth[_0x6ae2('0x9')](),controller[_0x6ae2('0xf')]);router[_0x6ae2('0x10')](_0x6ae2('0xd'),auth[_0x6ae2('0x9')](),controller[_0x6ae2('0x11')]);router[_0x6ae2('0x12')](_0x6ae2('0xd'),auth[_0x6ae2('0x9')](),controller[_0x6ae2('0x13')]);module[_0x6ae2('0x14')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 681a23b..1e863c3 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 _0xb700=['seconds','setDataValue','exitAt','duration','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','getDataValue','enterAt','diff'];(function(_0x1c5e2f,_0x372a8d){var _0x5defd1=function(_0x189fa3){while(--_0x189fa3){_0x1c5e2f['push'](_0x1c5e2f['shift']());}};_0x5defd1(++_0x372a8d);}(_0xb700,0x1d3));var _0x0b70=function(_0xb7a459,_0xc13228){_0xb7a459=_0xb7a459-0x0;var _0x104ab5=_0xb700[_0xb7a459];return _0x104ab5;};'use strict';var Sequelize=require(_0x0b70('0x0'));var moment=require('moment');module[_0x0b70('0x1')]={'channel':{'type':Sequelize[_0x0b70('0x2')]},'membername':{'type':Sequelize[_0x0b70('0x2')]},'interface':{'type':Sequelize[_0x0b70('0x2')]},'type':{'type':Sequelize[_0x0b70('0x2')],'defaultValue':_0x0b70('0x3'),'comment':_0x0b70('0x4')},'duration':{'type':Sequelize[_0x0b70('0x5')]},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x5818a1){var _0x186d93=moment(_0x5818a1);var _0x4094aa=moment(this[_0x0b70('0x6')](_0x0b70('0x7')));var _0x51e82a=_0x186d93[_0x0b70('0x8')](_0x4094aa,_0x0b70('0x9'));this[_0x0b70('0xa')](_0x0b70('0xb'),_0x5818a1);this[_0x0b70('0xa')](_0x0b70('0xc'),_0x51e82a>=0x0?_0x51e82a:null);}},'data1':{'type':Sequelize[_0x0b70('0x2')],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0x0b70('0x2')],'comment':_0x0b70('0xd')},'data3':{'type':Sequelize['STRING'],'comment':_0x0b70('0xe')},'data4':{'type':Sequelize['STRING'],'comment':_0x0b70('0xf')},'data5':{'type':Sequelize[_0x0b70('0x2')],'comment':_0x0b70('0x10')},'role':{'type':Sequelize[_0x0b70('0x2')]},'internal':{'type':Sequelize[_0x0b70('0x5')]},'uniqueid':{'type':Sequelize[_0x0b70('0x2')]}}; \ No newline at end of file +var _0xf293=['getDataValue','enterAt','setDataValue','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xf293,0x71));var _0x3f29=function(_0x5ee59a,_0x219703){_0x5ee59a=_0x5ee59a-0x0;var _0x5629b6=_0xf293[_0x5ee59a];return _0x5629b6;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x3f29('0x0'));module[_0x3f29('0x1')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x3f29('0x2')]},'type':{'type':Sequelize[_0x3f29('0x2')],'defaultValue':_0x3f29('0x3'),'comment':_0x3f29('0x4')},'duration':{'type':Sequelize[_0x3f29('0x5')]},'enterAt':{'type':Sequelize[_0x3f29('0x6')]},'exitAt':{'type':Sequelize[_0x3f29('0x6')],'set':function(_0x3475cd){var _0x3db732=moment(_0x3475cd);var _0xcc0c77=moment(this[_0x3f29('0x7')](_0x3f29('0x8')));var _0x3c57ce=_0x3db732['diff'](_0xcc0c77,'seconds');this[_0x3f29('0x9')]('exitAt',_0x3475cd);this[_0x3f29('0x9')]('duration',_0x3c57ce>=0x0?_0x3c57ce:null);}},'data1':{'type':Sequelize[_0x3f29('0x2')],'comment':_0x3f29('0xa')},'data2':{'type':Sequelize[_0x3f29('0x2')],'comment':_0x3f29('0xb')},'data3':{'type':Sequelize[_0x3f29('0x2')],'comment':_0x3f29('0xc')},'data4':{'type':Sequelize['STRING'],'comment':_0x3f29('0xd')},'data5':{'type':Sequelize['STRING'],'comment':_0x3f29('0xe')},'role':{'type':Sequelize[_0x3f29('0x2')]},'internal':{'type':Sequelize[_0x3f29('0x5')]},'uniqueid':{'type':Sequelize[_0x3f29('0x2')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 06fc77e..f80f149 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 _0x55ca=['merge','filter','includeAll','include','findAll','rawAttributes','options','create','body','find','params','catch','destroy','describe','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','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','reject','update','then','end','sendStatus','error','stack','name','send','index','map','MemberReport','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x55ca,0x126));var _0xa55c=function(_0x52ab0a,_0xf641d5){_0x52ab0a=_0x52ab0a-0x0;var _0x1d2cab=_0x55ca[_0x52ab0a];return _0x1d2cab;};'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(){_0x1fc828['status'](0xcc)[_0xa55c('0x21')]();});}};}function handleEntityNotFound(_0x190757,_0x3f64de){return function(_0xf0e574){if(!_0xf0e574){_0x190757[_0xa55c('0x22')](0x194);}return _0xf0e574;};}function handleError(_0x170ba4,_0x1da633){_0x1da633=_0x1da633||0x1f4;return function(_0x11e7f7){logger[_0xa55c('0x23')](_0x11e7f7[_0xa55c('0x24')]);if(_0x11e7f7[_0xa55c('0x25')]){delete _0x11e7f7['name'];}_0x170ba4[_0xa55c('0x18')](_0x1da633)[_0xa55c('0x26')](_0x11e7f7);};}exports[_0xa55c('0x27')]=function(_0x906caa,_0x5d940d){var _0x1377b0={},_0x22f6b6={},_0x1b8388={'count':0x0,'rows':[]};var _0x201941=_[_0xa55c('0x28')](db[_0xa55c('0x29')]['rawAttributes'],function(_0x23e698){return{'name':_0x23e698['fieldName'],'type':_0x23e698[_0xa55c('0x2a')][_0xa55c('0x2b')]};});_0x22f6b6[_0xa55c('0x2c')]=_[_0xa55c('0x28')](_0x201941,'name');_0x22f6b6[_0xa55c('0x2d')]=_[_0xa55c('0x2e')](_0x906caa[_0xa55c('0x2d')]);_0x22f6b6[_0xa55c('0x2f')]=_[_0xa55c('0x30')](_0x22f6b6[_0xa55c('0x2c')],_0x22f6b6[_0xa55c('0x2d')]);_0x1377b0[_0xa55c('0x31')]=_[_0xa55c('0x30')](_0x22f6b6[_0xa55c('0x2c')],qs[_0xa55c('0x32')](_0x906caa['query']['fields']));_0x1377b0[_0xa55c('0x31')]=_0x1377b0[_0xa55c('0x31')]['length']?_0x1377b0[_0xa55c('0x31')]:_0x22f6b6[_0xa55c('0x2c')];if(!_0x906caa[_0xa55c('0x2d')][_0xa55c('0x33')](_0xa55c('0x34'))){_0x1377b0[_0xa55c('0x1c')]=qs[_0xa55c('0x1c')](_0x906caa[_0xa55c('0x2d')][_0xa55c('0x1c')]);_0x1377b0['offset']=qs['offset'](_0x906caa['query'][_0xa55c('0x1a')]);}_0x1377b0[_0xa55c('0x35')]=qs[_0xa55c('0x36')](_0x906caa['query'][_0xa55c('0x36')]);_0x1377b0['where']=qs[_0xa55c('0x2f')](_['pick'](_0x906caa[_0xa55c('0x2d')],_0x22f6b6[_0xa55c('0x2f')]),_0x201941);if(_0x906caa[_0xa55c('0x2d')]['filter']){_0x1377b0[_0xa55c('0x37')]=_[_0xa55c('0x38')](_0x1377b0['where'],{'$or':_[_0xa55c('0x28')](_0x201941,function(_0x194e78){if(_0x194e78['type']!=='VIRTUAL'){var _0x235f6b={};_0x235f6b[_0x194e78['name']]={'$like':'%'+_0x906caa[_0xa55c('0x2d')][_0xa55c('0x39')]+'%'};return _0x235f6b;}})});}_0x1377b0=_['merge']({},_0x1377b0,_0x906caa['options']);var _0x5e50b6={'where':_0x1377b0['where']};return db[_0xa55c('0x29')][_0xa55c('0x1d')](_0x5e50b6)[_0xa55c('0x20')](function(_0x99c4f8){_0x1b8388[_0xa55c('0x1d')]=_0x99c4f8;if(_0x906caa['query'][_0xa55c('0x3a')]){_0x1377b0[_0xa55c('0x3b')]=[{'all':!![]}];}return db[_0xa55c('0x29')][_0xa55c('0x3c')](_0x1377b0);})[_0xa55c('0x20')](function(_0x23cef5){_0x1b8388['rows']=_0x23cef5;return _0x1b8388;})[_0xa55c('0x20')](respondWithFilteredResult(_0x5d940d,_0x1377b0))['catch'](handleError(_0x5d940d,null));};exports['show']=function(_0x404e7f,_0x1f63d8){var _0x496920={'raw':!![],'where':{'id':_0x404e7f['params']['id']}},_0x2bd98b={};_0x2bd98b['model']=_[_0xa55c('0x2e')](db[_0xa55c('0x29')][_0xa55c('0x3d')]);_0x2bd98b['query']=_[_0xa55c('0x2e')](_0x404e7f[_0xa55c('0x2d')]);_0x2bd98b['filters']=_[_0xa55c('0x30')](_0x2bd98b['model'],_0x2bd98b[_0xa55c('0x2d')]);_0x496920[_0xa55c('0x31')]=_['intersection'](_0x2bd98b[_0xa55c('0x2c')],qs[_0xa55c('0x32')](_0x404e7f['query'][_0xa55c('0x32')]));_0x496920[_0xa55c('0x31')]=_0x496920[_0xa55c('0x31')]['length']?_0x496920[_0xa55c('0x31')]:_0x2bd98b['model'];if(_0x404e7f[_0xa55c('0x2d')][_0xa55c('0x3a')]){_0x496920[_0xa55c('0x3b')]=[{'all':!![]}];}_0x496920=_['merge']({},_0x496920,_0x404e7f[_0xa55c('0x3e')]);return db[_0xa55c('0x29')]['find'](_0x496920)[_0xa55c('0x20')](handleEntityNotFound(_0x1f63d8,null))[_0xa55c('0x20')](respondWithResult(_0x1f63d8,null))['catch'](handleError(_0x1f63d8,null));};exports[_0xa55c('0x3f')]=function(_0xd3fe78,_0x52f9a7){return db[_0xa55c('0x29')][_0xa55c('0x3f')](_0xd3fe78[_0xa55c('0x40')],{})[_0xa55c('0x20')](respondWithResult(_0x52f9a7,0xc9))['catch'](handleError(_0x52f9a7,null));};exports[_0xa55c('0x1f')]=function(_0x58a7ea,_0x2157d6){if(_0x58a7ea[_0xa55c('0x40')]['id']){delete _0x58a7ea[_0xa55c('0x40')]['id'];}return db['MemberReport'][_0xa55c('0x41')]({'where':{'id':_0x58a7ea[_0xa55c('0x42')]['id']}})['then'](handleEntityNotFound(_0x2157d6,null))[_0xa55c('0x20')](saveUpdates(_0x58a7ea[_0xa55c('0x40')],null))[_0xa55c('0x20')](respondWithResult(_0x2157d6,null))[_0xa55c('0x43')](handleError(_0x2157d6,null));};exports[_0xa55c('0x44')]=function(_0x1c84d9,_0x1e1293){return db[_0xa55c('0x29')][_0xa55c('0x41')]({'where':{'id':_0x1c84d9[_0xa55c('0x42')]['id']}})['then'](handleEntityNotFound(_0x1e1293,null))[_0xa55c('0x20')](removeEntity(_0x1e1293,null))[_0xa55c('0x43')](handleError(_0x1e1293,null));};exports[_0xa55c('0x45')]=function(_0x4f73b6,_0x4c3095){return db[_0xa55c('0x29')]['describe']()[_0xa55c('0x20')](respondWithResult(_0x4c3095,null))['catch'](handleError(_0x4c3095,null));}; \ No newline at end of file +var _0x3e74=['show','params','options','find','catch','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','json','undefined','limit','offset','count','status','set','Content-Range','apply','save','update','then','destroy','sendStatus','name','send','index','map','MemberReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows'];(function(_0xebea9,_0x9f0401){var _0x5bd599=function(_0x5e4bdc){while(--_0x5e4bdc){_0xebea9['push'](_0xebea9['shift']());}};_0x5bd599(++_0x9f0401);}(_0x3e74,0x175));var _0x43e7=function(_0x4354b2,_0x91746){_0x4354b2=_0x4354b2-0x0;var _0x31bfb7=_0x3e74[_0x4354b2];return _0x31bfb7;};'use strict';var emlformat=require(_0x43e7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x43e7('0x1'));var jsonpatch=require(_0x43e7('0x2'));var rp=require(_0x43e7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x43e7('0x4'));var util=require('util');var path=require(_0x43e7('0x5'));var sox=require(_0x43e7('0x6'));var csv=require(_0x43e7('0x7'));var ejs=require(_0x43e7('0x8'));var fs=require('fs');var fs_extra=require(_0x43e7('0x9'));var _=require('lodash');var squel=require(_0x43e7('0xa'));var crypto=require(_0x43e7('0xb'));var jsforce=require(_0x43e7('0xc'));var deskjs=require(_0x43e7('0xd'));var toCsv=require(_0x43e7('0x7'));var querystring=require('querystring');var Papa=require(_0x43e7('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x43e7('0xf'));var as=require(_0x43e7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x43e7('0x11'))('api');var utils=require(_0x43e7('0x12'));var config=require(_0x43e7('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x43e7('0x14'))['db'];function respondWithStatusCode(_0xc960ea,_0x2718d3){_0x2718d3=_0x2718d3||0xcc;return function(_0x3bb83f){if(_0x3bb83f){return _0xc960ea['sendStatus'](_0x2718d3);}return _0xc960ea['status'](_0x2718d3)[_0x43e7('0x15')]();};}function respondWithResult(_0x21fdd3,_0x44b0bd){_0x44b0bd=_0x44b0bd||0xc8;return function(_0x51b974){if(_0x51b974){return _0x21fdd3['status'](_0x44b0bd)[_0x43e7('0x16')](_0x51b974);}};}function respondWithFilteredResult(_0x14c146,_0x203378){return function(_0x328445){if(_0x328445){var _0x4de324=typeof _0x203378['offset']===_0x43e7('0x17')&&typeof _0x203378[_0x43e7('0x18')]===_0x43e7('0x17');var _0x5d346f=_0x328445['count'];var _0x446986=_0x4de324?0x0:_0x203378[_0x43e7('0x19')];var _0x9037d3=_0x4de324?_0x328445[_0x43e7('0x1a')]:_0x203378[_0x43e7('0x19')]+_0x203378[_0x43e7('0x18')];var _0x619236;if(_0x9037d3>=_0x5d346f){_0x9037d3=_0x5d346f;_0x619236=0xc8;}else{_0x619236=0xce;}_0x14c146[_0x43e7('0x1b')](_0x619236);return _0x14c146[_0x43e7('0x1c')](_0x43e7('0x1d'),_0x446986+'-'+_0x9037d3+'/'+_0x5d346f)[_0x43e7('0x16')](_0x328445);}return null;};}function patchUpdates(_0x177ee1){return function(_0x4b5d64){try{jsonpatch[_0x43e7('0x1e')](_0x4b5d64,_0x177ee1,!![]);}catch(_0x3c6625){return BPromise['reject'](_0x3c6625);}return _0x4b5d64[_0x43e7('0x1f')]();};}function saveUpdates(_0x3e281e,_0x3945bb){return function(_0x28aacc){if(_0x28aacc){return _0x28aacc[_0x43e7('0x20')](_0x3e281e)[_0x43e7('0x21')](function(_0x54a9e7){return _0x54a9e7;});}return null;};}function removeEntity(_0x454359,_0x4eea52){return function(_0x4c9df3){if(_0x4c9df3){return _0x4c9df3[_0x43e7('0x22')]()[_0x43e7('0x21')](function(){_0x454359['status'](0xcc)[_0x43e7('0x15')]();});}};}function handleEntityNotFound(_0x4ca5cf,_0x326dab){return function(_0x5c5e67){if(!_0x5c5e67){_0x4ca5cf[_0x43e7('0x23')](0x194);}return _0x5c5e67;};}function handleError(_0x1b5f50,_0x20888b){_0x20888b=_0x20888b||0x1f4;return function(_0x405f85){logger['error'](_0x405f85['stack']);if(_0x405f85[_0x43e7('0x24')]){delete _0x405f85['name'];}_0x1b5f50[_0x43e7('0x1b')](_0x20888b)[_0x43e7('0x25')](_0x405f85);};}exports[_0x43e7('0x26')]=function(_0xb1fc63,_0x5087d7){var _0x33a1a5={},_0x4690a6={},_0x45b675={'count':0x0,'rows':[]};var _0x50f9f5=_[_0x43e7('0x27')](db[_0x43e7('0x28')][_0x43e7('0x29')],function(_0x31b2a6){return{'name':_0x31b2a6[_0x43e7('0x2a')],'type':_0x31b2a6[_0x43e7('0x2b')][_0x43e7('0x2c')]};});_0x4690a6[_0x43e7('0x2d')]=_[_0x43e7('0x27')](_0x50f9f5,_0x43e7('0x24'));_0x4690a6['query']=_[_0x43e7('0x2e')](_0xb1fc63[_0x43e7('0x2f')]);_0x4690a6[_0x43e7('0x30')]=_[_0x43e7('0x31')](_0x4690a6[_0x43e7('0x2d')],_0x4690a6['query']);_0x33a1a5[_0x43e7('0x32')]=_[_0x43e7('0x31')](_0x4690a6[_0x43e7('0x2d')],qs[_0x43e7('0x33')](_0xb1fc63['query']['fields']));_0x33a1a5['attributes']=_0x33a1a5[_0x43e7('0x32')][_0x43e7('0x34')]?_0x33a1a5[_0x43e7('0x32')]:_0x4690a6[_0x43e7('0x2d')];if(!_0xb1fc63[_0x43e7('0x2f')][_0x43e7('0x35')]('nolimit')){_0x33a1a5['limit']=qs['limit'](_0xb1fc63['query']['limit']);_0x33a1a5['offset']=qs['offset'](_0xb1fc63[_0x43e7('0x2f')]['offset']);}_0x33a1a5[_0x43e7('0x36')]=qs[_0x43e7('0x37')](_0xb1fc63[_0x43e7('0x2f')][_0x43e7('0x37')]);_0x33a1a5[_0x43e7('0x38')]=qs[_0x43e7('0x30')](_[_0x43e7('0x39')](_0xb1fc63['query'],_0x4690a6['filters']),_0x50f9f5);if(_0xb1fc63['query'][_0x43e7('0x3a')]){_0x33a1a5[_0x43e7('0x38')]=_[_0x43e7('0x3b')](_0x33a1a5[_0x43e7('0x38')],{'$or':_[_0x43e7('0x27')](_0x50f9f5,function(_0x1ed538){if(_0x1ed538[_0x43e7('0x2b')]!==_0x43e7('0x3c')){var _0x55c798={};_0x55c798[_0x1ed538[_0x43e7('0x24')]]={'$like':'%'+_0xb1fc63[_0x43e7('0x2f')]['filter']+'%'};return _0x55c798;}})});}_0x33a1a5=_[_0x43e7('0x3b')]({},_0x33a1a5,_0xb1fc63['options']);var _0x44d8e4={'where':_0x33a1a5[_0x43e7('0x38')]};return db[_0x43e7('0x28')][_0x43e7('0x1a')](_0x44d8e4)[_0x43e7('0x21')](function(_0x234d8f){_0x45b675['count']=_0x234d8f;if(_0xb1fc63['query'][_0x43e7('0x3d')]){_0x33a1a5[_0x43e7('0x3e')]=[{'all':!![]}];}return db[_0x43e7('0x28')][_0x43e7('0x3f')](_0x33a1a5);})[_0x43e7('0x21')](function(_0x4a4a85){_0x45b675[_0x43e7('0x40')]=_0x4a4a85;return _0x45b675;})[_0x43e7('0x21')](respondWithFilteredResult(_0x5087d7,_0x33a1a5))['catch'](handleError(_0x5087d7,null));};exports[_0x43e7('0x41')]=function(_0x51a69c,_0x2ad8ef){var _0x504101={'raw':!![],'where':{'id':_0x51a69c[_0x43e7('0x42')]['id']}},_0x3d81ae={};_0x3d81ae[_0x43e7('0x2d')]=_[_0x43e7('0x2e')](db['MemberReport']['rawAttributes']);_0x3d81ae[_0x43e7('0x2f')]=_[_0x43e7('0x2e')](_0x51a69c[_0x43e7('0x2f')]);_0x3d81ae[_0x43e7('0x30')]=_['intersection'](_0x3d81ae['model'],_0x3d81ae['query']);_0x504101[_0x43e7('0x32')]=_['intersection'](_0x3d81ae[_0x43e7('0x2d')],qs['fields'](_0x51a69c['query'][_0x43e7('0x33')]));_0x504101['attributes']=_0x504101[_0x43e7('0x32')][_0x43e7('0x34')]?_0x504101[_0x43e7('0x32')]:_0x3d81ae[_0x43e7('0x2d')];if(_0x51a69c['query'][_0x43e7('0x3d')]){_0x504101[_0x43e7('0x3e')]=[{'all':!![]}];}_0x504101=_[_0x43e7('0x3b')]({},_0x504101,_0x51a69c[_0x43e7('0x43')]);return db[_0x43e7('0x28')][_0x43e7('0x44')](_0x504101)['then'](handleEntityNotFound(_0x2ad8ef,null))['then'](respondWithResult(_0x2ad8ef,null))[_0x43e7('0x45')](handleError(_0x2ad8ef,null));};exports[_0x43e7('0x46')]=function(_0x212841,_0x4c00a8){return db['MemberReport']['create'](_0x212841[_0x43e7('0x47')],{})[_0x43e7('0x21')](respondWithResult(_0x4c00a8,0xc9))['catch'](handleError(_0x4c00a8,null));};exports[_0x43e7('0x20')]=function(_0x47686e,_0x3c96fe){if(_0x47686e['body']['id']){delete _0x47686e['body']['id'];}return db['MemberReport']['find']({'where':{'id':_0x47686e[_0x43e7('0x42')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x3c96fe,null))['then'](saveUpdates(_0x47686e[_0x43e7('0x47')],null))[_0x43e7('0x21')](respondWithResult(_0x3c96fe,null))[_0x43e7('0x45')](handleError(_0x3c96fe,null));};exports[_0x43e7('0x22')]=function(_0x4a0ce5,_0x2718d5){return db['MemberReport']['find']({'where':{'id':_0x4a0ce5[_0x43e7('0x42')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x2718d5,null))[_0x43e7('0x21')](removeEntity(_0x2718d5,null))[_0x43e7('0x45')](handleError(_0x2718d5,null));};exports[_0x43e7('0x48')]=function(_0x2351cf,_0x1cd87c){return db[_0x43e7('0x28')][_0x43e7('0x48')]()[_0x43e7('0x21')](respondWithResult(_0x1cd87c,null))['catch'](handleError(_0x1cd87c,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 3c85a95..1819125 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 _0x2c79=['membername','interface','lodash','util','../../config/logger','moment','bluebird','path','../../config/environment','./memberReport.attributes','exports','MemberReport','report_member'];(function(_0x266cae,_0x59ef84){var _0x4bb0bf=function(_0x51285c){while(--_0x51285c){_0x266cae['push'](_0x266cae['shift']());}};_0x4bb0bf(++_0x59ef84);}(_0x2c79,0x106));var _0x92c7=function(_0x491cb6,_0x19e75a){_0x491cb6=_0x491cb6-0x0;var _0x5903ed=_0x2c79[_0x491cb6];return _0x5903ed;};'use strict';var _=require(_0x92c7('0x0'));var util=require(_0x92c7('0x1'));var logger=require(_0x92c7('0x2'))('api');var moment=require(_0x92c7('0x3'));var BPromise=require(_0x92c7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x92c7('0x5'));var rimraf=require('rimraf');var config=require(_0x92c7('0x6'));var attributes=require(_0x92c7('0x7'));module[_0x92c7('0x8')]=function(_0x4bfccd,_0x13e9e7){return _0x4bfccd['define'](_0x92c7('0x9'),attributes,{'tableName':_0x92c7('0xa'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0x92c7('0xb'),_0x92c7('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8ae2=['MemberReport','report_member','membername','interface','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./memberReport.attributes','exports','define'];(function(_0x22b68a,_0x2bffc3){var _0x1ac67a=function(_0x25f9d5){while(--_0x25f9d5){_0x22b68a['push'](_0x22b68a['shift']());}};_0x1ac67a(++_0x2bffc3);}(_0x8ae2,0x121));var _0x28ae=function(_0x5a1c3f,_0x227fcd){_0x5a1c3f=_0x5a1c3f-0x0;var _0x13a8c8=_0x8ae2[_0x5a1c3f];return _0x13a8c8;};'use strict';var _=require(_0x28ae('0x0'));var util=require(_0x28ae('0x1'));var logger=require(_0x28ae('0x2'))('api');var moment=require(_0x28ae('0x3'));var BPromise=require('bluebird');var rp=require(_0x28ae('0x4'));var fs=require('fs');var path=require(_0x28ae('0x5'));var rimraf=require(_0x28ae('0x6'));var config=require(_0x28ae('0x7'));var attributes=require(_0x28ae('0x8'));module[_0x28ae('0x9')]=function(_0x3cc359,_0x49a92d){return _0x3cc359[_0x28ae('0xa')](_0x28ae('0xb'),attributes,{'tableName':_0x28ae('0xc'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0x28ae('0xd'),_0x28ae('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 02a31b5..a421099 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 _0x7fd6=['message','info','result','GetMemberReport','findAll','options','where','attributes','limit','include','map','model','catch','CreateMemberReport','MemberReport','body','raw','UpdateMemberReport','update','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','request','then','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0xce1bee,_0x2beef7){var _0x49e656=function(_0x1c847a){while(--_0x1c847a){_0xce1bee['push'](_0xce1bee['shift']());}};_0x49e656(++_0x2beef7);}(_0x7fd6,0x157));var _0x67fd=function(_0x5ceb49,_0x4ea199){_0x5ceb49=_0x5ceb49-0x0;var _0x5e92b2=_0x7fd6[_0x5ceb49];return _0x5e92b2;};'use strict';var _=require(_0x67fd('0x0'));var util=require('util');var moment=require(_0x67fd('0x1'));var BPromise=require(_0x67fd('0x2'));var rs=require(_0x67fd('0x3'));var fs=require('fs');var Redis=require(_0x67fd('0x4'));var db=require(_0x67fd('0x5'))['db'];var utils=require(_0x67fd('0x6'));var logger=require('../../config/logger')(_0x67fd('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x440518,_0x23e1d6,_0x21d7b1){return new BPromise(function(_0x1bbae4,_0x74be46){return client[_0x67fd('0x8')](_0x440518,_0x21d7b1)[_0x67fd('0x9')](function(_0x3d233d){logger['info'](_0x67fd('0xa'),_0x23e1d6,_0x67fd('0xb'));logger[_0x67fd('0xc')](_0x67fd('0xd'),_0x23e1d6,_0x67fd('0xb'),JSON[_0x67fd('0xe')](_0x3d233d));if(_0x3d233d['error']){if(_0x3d233d[_0x67fd('0xf')][_0x67fd('0x10')]===0x1f4){logger[_0x67fd('0xf')](_0x67fd('0xa'),_0x23e1d6,_0x3d233d[_0x67fd('0xf')][_0x67fd('0x11')]);return _0x74be46(_0x3d233d[_0x67fd('0xf')][_0x67fd('0x11')]);}logger[_0x67fd('0xf')](_0x67fd('0xa'),_0x23e1d6,_0x3d233d[_0x67fd('0xf')]['message']);return _0x1bbae4(_0x3d233d[_0x67fd('0xf')][_0x67fd('0x11')]);}else{logger[_0x67fd('0x12')](_0x67fd('0xa'),_0x23e1d6,'request\x20sent');_0x1bbae4(_0x3d233d[_0x67fd('0x13')][_0x67fd('0x11')]);}})['catch'](function(_0x285828){logger[_0x67fd('0xf')](_0x67fd('0xa'),_0x23e1d6,_0x285828);_0x74be46(_0x285828);});});}exports[_0x67fd('0x14')]=function(_0x412a1c){var _0x30cb2c=this;return new Promise(function(_0x1f019e,_0xf21e09){return db['MemberReport'][_0x67fd('0x15')]({'raw':_0x412a1c['options']?_0x412a1c[_0x67fd('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x412a1c[_0x67fd('0x16')]?_0x412a1c[_0x67fd('0x16')][_0x67fd('0x17')]||null:null,'attributes':_0x412a1c['options']?_0x412a1c[_0x67fd('0x16')][_0x67fd('0x18')]||null:null,'limit':_0x412a1c['options']?_0x412a1c[_0x67fd('0x16')][_0x67fd('0x19')]||null:null,'include':_0x412a1c[_0x67fd('0x16')]?_0x412a1c[_0x67fd('0x16')][_0x67fd('0x1a')]?_[_0x67fd('0x1b')](_0x412a1c[_0x67fd('0x16')][_0x67fd('0x1a')],function(_0x311c1d){return{'model':db[_0x311c1d[_0x67fd('0x1c')]],'as':_0x311c1d['as'],'attributes':_0x311c1d['attributes'],'include':_0x311c1d[_0x67fd('0x1a')]?_[_0x67fd('0x1b')](_0x311c1d['include'],function(_0x5ce47b){return{'model':db[_0x5ce47b[_0x67fd('0x1c')]],'as':_0x5ce47b['as'],'attributes':_0x5ce47b[_0x67fd('0x18')],'include':_0x5ce47b[_0x67fd('0x1a')]?_[_0x67fd('0x1b')](_0x5ce47b[_0x67fd('0x1a')],function(_0x8d4eff){return{'model':db[_0x8d4eff['model']],'as':_0x8d4eff['as'],'attributes':_0x8d4eff[_0x67fd('0x18')]};}):[]};}):[]};}):[]:[]})[_0x67fd('0x9')](function(_0x157640){logger['info']('GetMemberReport',_0x412a1c);logger[_0x67fd('0xc')](_0x67fd('0x14'),_0x412a1c,JSON[_0x67fd('0xe')](_0x157640));_0x1f019e(_0x157640);})[_0x67fd('0x1d')](function(_0x383ef){logger[_0x67fd('0xf')]('GetMemberReport',_0x383ef[_0x67fd('0x11')],_0x412a1c);_0xf21e09(_0x30cb2c['error'](0x1f4,_0x383ef[_0x67fd('0x11')]));});});};exports[_0x67fd('0x1e')]=function(_0x4b2c5c){var _0x184629=this;return new Promise(function(_0x497291,_0x50679e){return db[_0x67fd('0x1f')]['create'](_0x4b2c5c[_0x67fd('0x20')],{'raw':_0x4b2c5c['options']?_0x4b2c5c['options'][_0x67fd('0x21')]===undefined?!![]:![]:!![]})[_0x67fd('0x9')](function(_0x200d79){logger[_0x67fd('0x12')](_0x67fd('0x1e'),_0x4b2c5c);logger[_0x67fd('0xc')](_0x67fd('0x1e'),_0x4b2c5c,JSON['stringify'](_0x200d79));_0x497291(_0x200d79);})['catch'](function(_0x9b3b68){logger[_0x67fd('0xf')]('CreateMemberReport',_0x9b3b68['message'],_0x4b2c5c);_0x50679e(_0x184629[_0x67fd('0xf')](0x1f4,_0x9b3b68[_0x67fd('0x11')]));});});};exports[_0x67fd('0x22')]=function(_0x469c8b){var _0x3eceeb=this;return new Promise(function(_0x1045a4,_0x19afe9){return db[_0x67fd('0x1f')][_0x67fd('0x23')](_0x469c8b[_0x67fd('0x20')],{'raw':_0x469c8b[_0x67fd('0x16')]?_0x469c8b['options'][_0x67fd('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x469c8b[_0x67fd('0x16')]?_0x469c8b['options']['where']||null:null,'attributes':_0x469c8b[_0x67fd('0x16')]?_0x469c8b['options'][_0x67fd('0x18')]||null:null,'limit':_0x469c8b[_0x67fd('0x16')]?_0x469c8b['options'][_0x67fd('0x19')]||null:null})[_0x67fd('0x9')](function(_0x66a7bf){logger[_0x67fd('0x12')](_0x67fd('0x22'),_0x469c8b);logger[_0x67fd('0xc')](_0x67fd('0x22'),_0x469c8b,JSON[_0x67fd('0xe')](_0x66a7bf));_0x1045a4(_0x66a7bf);})[_0x67fd('0x1d')](function(_0x332af3){logger['error'](_0x67fd('0x22'),_0x332af3[_0x67fd('0x11')],_0x469c8b);_0x19afe9(_0x3eceeb[_0x67fd('0xf')](0x1f4,_0x332af3[_0x67fd('0x11')]));});});}; \ No newline at end of file +var _0x806b=['request\x20sent','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','MemberReport,\x20%s,\x20%s','message','GetMemberReport','MemberReport','findAll','options','raw','where','attributes','limit','map','include','model','debug','catch','CreateMemberReport','body','UpdateMemberReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x16cd0f,_0x1c7184){var _0x595bac=function(_0x2ce8b4){while(--_0x2ce8b4){_0x16cd0f['push'](_0x16cd0f['shift']());}};_0x595bac(++_0x1c7184);}(_0x806b,0x163));var _0xb806=function(_0x2276f4,_0x1d4780){_0x2276f4=_0x2276f4-0x0;var _0x6aeeb0=_0x806b[_0x2276f4];return _0x6aeeb0;};'use strict';var _=require(_0xb806('0x0'));var util=require(_0xb806('0x1'));var moment=require(_0xb806('0x2'));var BPromise=require(_0xb806('0x3'));var rs=require(_0xb806('0x4'));var fs=require('fs');var Redis=require(_0xb806('0x5'));var db=require(_0xb806('0x6'))['db'];var utils=require(_0xb806('0x7'));var logger=require('../../config/logger')(_0xb806('0x8'));var config=require(_0xb806('0x9'));var jayson=require(_0xb806('0xa'));var client=jayson[_0xb806('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x9b2858,_0x46050f,_0x4fdc38){return new BPromise(function(_0x3525e8,_0x116ef4){return client[_0xb806('0xc')](_0x9b2858,_0x4fdc38)[_0xb806('0xd')](function(_0x5511f4){logger[_0xb806('0xe')]('MemberReport,\x20%s,\x20%s',_0x46050f,_0xb806('0xf'));logger['debug'](_0xb806('0x10'),_0x46050f,'request\x20sent',JSON[_0xb806('0x11')](_0x5511f4));if(_0x5511f4[_0xb806('0x12')]){if(_0x5511f4[_0xb806('0x12')]['code']===0x1f4){logger[_0xb806('0x12')](_0xb806('0x13'),_0x46050f,_0x5511f4['error'][_0xb806('0x14')]);return _0x116ef4(_0x5511f4[_0xb806('0x12')]['message']);}logger[_0xb806('0x12')](_0xb806('0x13'),_0x46050f,_0x5511f4['error'][_0xb806('0x14')]);return _0x3525e8(_0x5511f4[_0xb806('0x12')][_0xb806('0x14')]);}else{logger[_0xb806('0xe')](_0xb806('0x13'),_0x46050f,'request\x20sent');_0x3525e8(_0x5511f4['result'][_0xb806('0x14')]);}})['catch'](function(_0x131447){logger[_0xb806('0x12')](_0xb806('0x13'),_0x46050f,_0x131447);_0x116ef4(_0x131447);});});}exports[_0xb806('0x15')]=function(_0x5375c1){var _0x40635c=this;return new Promise(function(_0x1e17d2,_0x269e2b){return db[_0xb806('0x16')][_0xb806('0x17')]({'raw':_0x5375c1[_0xb806('0x18')]?_0x5375c1['options'][_0xb806('0x19')]===undefined?!![]:![]:!![],'where':_0x5375c1[_0xb806('0x18')]?_0x5375c1['options'][_0xb806('0x1a')]||null:null,'attributes':_0x5375c1[_0xb806('0x18')]?_0x5375c1[_0xb806('0x18')][_0xb806('0x1b')]||null:null,'limit':_0x5375c1['options']?_0x5375c1[_0xb806('0x18')][_0xb806('0x1c')]||null:null,'include':_0x5375c1[_0xb806('0x18')]?_0x5375c1['options']['include']?_[_0xb806('0x1d')](_0x5375c1[_0xb806('0x18')]['include'],function(_0x570837){return{'model':db[_0x570837['model']],'as':_0x570837['as'],'attributes':_0x570837[_0xb806('0x1b')],'include':_0x570837['include']?_['map'](_0x570837[_0xb806('0x1e')],function(_0x3c4556){return{'model':db[_0x3c4556[_0xb806('0x1f')]],'as':_0x3c4556['as'],'attributes':_0x3c4556[_0xb806('0x1b')],'include':_0x3c4556[_0xb806('0x1e')]?_[_0xb806('0x1d')](_0x3c4556[_0xb806('0x1e')],function(_0xcd8bb7){return{'model':db[_0xcd8bb7[_0xb806('0x1f')]],'as':_0xcd8bb7['as'],'attributes':_0xcd8bb7['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x481826){logger['info'](_0xb806('0x15'),_0x5375c1);logger[_0xb806('0x20')]('GetMemberReport',_0x5375c1,JSON[_0xb806('0x11')](_0x481826));_0x1e17d2(_0x481826);})[_0xb806('0x21')](function(_0x34d9e1){logger['error'](_0xb806('0x15'),_0x34d9e1[_0xb806('0x14')],_0x5375c1);_0x269e2b(_0x40635c['error'](0x1f4,_0x34d9e1[_0xb806('0x14')]));});});};exports[_0xb806('0x22')]=function(_0x249ec5){var _0x4471c5=this;return new Promise(function(_0x4342bf,_0xb24e1c){return db[_0xb806('0x16')]['create'](_0x249ec5[_0xb806('0x23')],{'raw':_0x249ec5[_0xb806('0x18')]?_0x249ec5[_0xb806('0x18')]['raw']===undefined?!![]:![]:!![]})[_0xb806('0xd')](function(_0x28aecf){logger['info'](_0xb806('0x22'),_0x249ec5);logger['debug'](_0xb806('0x22'),_0x249ec5,JSON[_0xb806('0x11')](_0x28aecf));_0x4342bf(_0x28aecf);})[_0xb806('0x21')](function(_0x2fa01e){logger[_0xb806('0x12')]('CreateMemberReport',_0x2fa01e[_0xb806('0x14')],_0x249ec5);_0xb24e1c(_0x4471c5[_0xb806('0x12')](0x1f4,_0x2fa01e[_0xb806('0x14')]));});});};exports[_0xb806('0x24')]=function(_0x38c579){var _0x15e4e6=this;return new Promise(function(_0x287c56,_0x65645a){return db[_0xb806('0x16')]['update'](_0x38c579[_0xb806('0x23')],{'raw':_0x38c579[_0xb806('0x18')]?_0x38c579[_0xb806('0x18')][_0xb806('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x38c579[_0xb806('0x18')]?_0x38c579[_0xb806('0x18')][_0xb806('0x1a')]||null:null,'attributes':_0x38c579[_0xb806('0x18')]?_0x38c579[_0xb806('0x18')]['attributes']||null:null,'limit':_0x38c579[_0xb806('0x18')]?_0x38c579[_0xb806('0x18')][_0xb806('0x1c')]||null:null})[_0xb806('0xd')](function(_0x8b4ac2){logger[_0xb806('0xe')](_0xb806('0x24'),_0x38c579);logger[_0xb806('0x20')](_0xb806('0x24'),_0x38c579,JSON[_0xb806('0x11')](_0x8b4ac2));_0x287c56(_0x8b4ac2);})[_0xb806('0x21')](function(_0xb21b08){logger[_0xb806('0x12')](_0xb806('0x24'),_0xb21b08[_0xb806('0x14')],_0x38c579);_0x65645a(_0x15e4e6['error'](0x1f4,_0xb21b08[_0xb806('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index f2d3f26..c71d25b 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 _0xc117=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc117,0x12a));var _0x7c11=function(_0x5e2c85,_0x116455){_0x5e2c85=_0x5e2c85-0x0;var _0x595c67=_0xc117[_0x5e2c85];return _0x595c67;};'use strict';var multer=require('multer');var util=require(_0x7c11('0x0'));var path=require(_0x7c11('0x1'));var timeout=require(_0x7c11('0x2'));var express=require(_0x7c11('0x3'));var router=express[_0x7c11('0x4')]();var fs_extra=require(_0x7c11('0x5'));var auth=require(_0x7c11('0x6'));var interaction=require(_0x7c11('0x7'));var config=require(_0x7c11('0x8'));var controller=require('./migration.controller');router[_0x7c11('0x9')]('/',controller['index']);module[_0x7c11('0xa')]=router; \ No newline at end of file +var _0x1caa=['index','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./migration.controller','get'];(function(_0x5316c9,_0x1599b8){var _0x4b7507=function(_0x49dc0c){while(--_0x49dc0c){_0x5316c9['push'](_0x5316c9['shift']());}};_0x4b7507(++_0x1599b8);}(_0x1caa,0xbf));var _0xa1ca=function(_0x823ca6,_0x40a144){_0x823ca6=_0x823ca6-0x0;var _0x16a3e2=_0x1caa[_0x823ca6];return _0x16a3e2;};'use strict';var multer=require(_0xa1ca('0x0'));var util=require('util');var path=require(_0xa1ca('0x1'));var timeout=require('connect-timeout');var express=require(_0xa1ca('0x2'));var router=express[_0xa1ca('0x3')]();var fs_extra=require(_0xa1ca('0x4'));var auth=require(_0xa1ca('0x5'));var interaction=require(_0xa1ca('0x6'));var config=require('../../config/environment');var controller=require(_0xa1ca('0x7'));router[_0xa1ca('0x8')]('/',controller[_0xa1ca('0x9')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 3eb7047..995decf 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 _0xef13=['version','sequelize'];(function(_0x3ed6f1,_0x264b14){var _0x14fc1b=function(_0x4bc4bd){while(--_0x4bc4bd){_0x3ed6f1['push'](_0x3ed6f1['shift']());}};_0x14fc1b(++_0x264b14);}(_0xef13,0xa3));var _0x3ef1=function(_0x50e0ed,_0x3cdbed){_0x50e0ed=_0x50e0ed-0x0;var _0x542a34=_0xef13[_0x50e0ed];return _0x542a34;};'use strict';var Sequelize=require(_0x3ef1('0x0'));module['exports']={'version':{'type':Sequelize['STRING'],'unique':_0x3ef1('0x1')}}; \ No newline at end of file +var _0xab5f=['sequelize','exports','STRING','version'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xab5f,0x138));var _0xfab5=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0xab5f[_0x344a3f];return _0x264712;};'use strict';var Sequelize=require(_0xfab5('0x0'));module[_0xfab5('0x1')]={'version':{'type':Sequelize[_0xfab5('0x2')],'unique':_0xfab5('0x3')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 8ea004a..08ccb67 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 _0xedf5=['end','error','stack','name','send','index','map','Migration','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','fs-extra','squel','crypto','to-csv','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy'];(function(_0x141095,_0x510a54){var _0x3c8711=function(_0x2ef3bc){while(--_0x2ef3bc){_0x141095['push'](_0x141095['shift']());}};_0x3c8711(++_0x510a54);}(_0xedf5,0xa7));var _0x5edf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xedf5[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x5edf('0x0'));var rimraf=require(_0x5edf('0x1'));var zipdir=require(_0x5edf('0x2'));var jsonpatch=require(_0x5edf('0x3'));var rp=require(_0x5edf('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5edf('0x5'));var path=require(_0x5edf('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5edf('0x7'));var _=require('lodash');var squel=require(_0x5edf('0x8'));var crypto=require(_0x5edf('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5edf('0xa'));var querystring=require('querystring');var Papa=require(_0x5edf('0xb'));var Redis=require(_0x5edf('0xc'));var authService=require(_0x5edf('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5edf('0xe'));var logger=require('../../config/logger')(_0x5edf('0xf'));var utils=require(_0x5edf('0x10'));var config=require(_0x5edf('0x11'));var licenseUtil=require(_0x5edf('0x12'));var db=require(_0x5edf('0x13'))['db'];function respondWithStatusCode(_0x4900e3,_0xcb89ac){_0xcb89ac=_0xcb89ac||0xcc;return function(_0x409d65){if(_0x409d65){return _0x4900e3[_0x5edf('0x14')](_0xcb89ac);}return _0x4900e3[_0x5edf('0x15')](_0xcb89ac)['end']();};}function respondWithResult(_0x285eec,_0x2e8948){_0x2e8948=_0x2e8948||0xc8;return function(_0x3d746e){if(_0x3d746e){return _0x285eec[_0x5edf('0x15')](_0x2e8948)[_0x5edf('0x16')](_0x3d746e);}};}function respondWithFilteredResult(_0x5aedb2,_0x4660d2){return function(_0x9a6365){if(_0x9a6365){var _0x5db92f=typeof _0x4660d2['offset']===_0x5edf('0x17')&&typeof _0x4660d2[_0x5edf('0x18')]==='undefined';var _0x12d953=_0x9a6365[_0x5edf('0x19')];var _0x2bb380=_0x5db92f?0x0:_0x4660d2[_0x5edf('0x1a')];var _0x690a03=_0x5db92f?_0x9a6365[_0x5edf('0x19')]:_0x4660d2[_0x5edf('0x1a')]+_0x4660d2[_0x5edf('0x18')];var _0x2b8b8d;if(_0x690a03>=_0x12d953){_0x690a03=_0x12d953;_0x2b8b8d=0xc8;}else{_0x2b8b8d=0xce;}_0x5aedb2['status'](_0x2b8b8d);return _0x5aedb2['set'](_0x5edf('0x1b'),_0x2bb380+'-'+_0x690a03+'/'+_0x12d953)['json'](_0x9a6365);}return null;};}function patchUpdates(_0x113b08){return function(_0xfb8023){try{jsonpatch[_0x5edf('0x1c')](_0xfb8023,_0x113b08,!![]);}catch(_0x5a01ac){return BPromise[_0x5edf('0x1d')](_0x5a01ac);}return _0xfb8023[_0x5edf('0x1e')]();};}function saveUpdates(_0x3876ec,_0x3bb322){return function(_0xc3f7f7){if(_0xc3f7f7){return _0xc3f7f7[_0x5edf('0x1f')](_0x3876ec)[_0x5edf('0x20')](function(_0x265f1f){return _0x265f1f;});}return null;};}function removeEntity(_0x48b789,_0x5233db){return function(_0x4dc338){if(_0x4dc338){return _0x4dc338[_0x5edf('0x21')]()['then'](function(){_0x48b789['status'](0xcc)[_0x5edf('0x22')]();});}};}function handleEntityNotFound(_0x53d6d9,_0x22576c){return function(_0x5e953a){if(!_0x5e953a){_0x53d6d9[_0x5edf('0x14')](0x194);}return _0x5e953a;};}function handleError(_0x1e5210,_0x3490bf){_0x3490bf=_0x3490bf||0x1f4;return function(_0x37ec1a){logger[_0x5edf('0x23')](_0x37ec1a[_0x5edf('0x24')]);if(_0x37ec1a[_0x5edf('0x25')]){delete _0x37ec1a[_0x5edf('0x25')];}_0x1e5210[_0x5edf('0x15')](_0x3490bf)[_0x5edf('0x26')](_0x37ec1a);};}exports[_0x5edf('0x27')]=function(_0x2596bc,_0x26e7f5){var _0x53e9bf={},_0x48d88f={},_0x1b874d={'count':0x0,'rows':[]};var _0x52c050=_[_0x5edf('0x28')](db[_0x5edf('0x29')][_0x5edf('0x2a')],function(_0x3edec0){return{'name':_0x3edec0[_0x5edf('0x2b')],'type':_0x3edec0[_0x5edf('0x2c')][_0x5edf('0x2d')]};});_0x48d88f[_0x5edf('0x2e')]=_[_0x5edf('0x28')](_0x52c050,'name');_0x48d88f[_0x5edf('0x2f')]=_[_0x5edf('0x30')](_0x2596bc[_0x5edf('0x2f')]);_0x48d88f['filters']=_[_0x5edf('0x31')](_0x48d88f[_0x5edf('0x2e')],_0x48d88f[_0x5edf('0x2f')]);_0x53e9bf[_0x5edf('0x32')]=_[_0x5edf('0x31')](_0x48d88f['model'],qs[_0x5edf('0x33')](_0x2596bc[_0x5edf('0x2f')][_0x5edf('0x33')]));_0x53e9bf[_0x5edf('0x32')]=_0x53e9bf[_0x5edf('0x32')]['length']?_0x53e9bf[_0x5edf('0x32')]:_0x48d88f[_0x5edf('0x2e')];if(!_0x2596bc['query'][_0x5edf('0x34')]('nolimit')){_0x53e9bf[_0x5edf('0x18')]=qs[_0x5edf('0x18')](_0x2596bc[_0x5edf('0x2f')][_0x5edf('0x18')]);_0x53e9bf[_0x5edf('0x1a')]=qs[_0x5edf('0x1a')](_0x2596bc[_0x5edf('0x2f')][_0x5edf('0x1a')]);}_0x53e9bf[_0x5edf('0x35')]=qs[_0x5edf('0x36')](_0x2596bc[_0x5edf('0x2f')][_0x5edf('0x36')]);_0x53e9bf[_0x5edf('0x37')]=qs[_0x5edf('0x38')](_[_0x5edf('0x39')](_0x2596bc[_0x5edf('0x2f')],_0x48d88f[_0x5edf('0x38')]),_0x52c050);if(_0x2596bc[_0x5edf('0x2f')]['filter']){_0x53e9bf[_0x5edf('0x37')]=_[_0x5edf('0x3a')](_0x53e9bf[_0x5edf('0x37')],{'$or':_['map'](_0x52c050,function(_0x317783){if(_0x317783[_0x5edf('0x2c')]!==_0x5edf('0x3b')){var _0x20f209={};_0x20f209[_0x317783['name']]={'$like':'%'+_0x2596bc[_0x5edf('0x2f')][_0x5edf('0x3c')]+'%'};return _0x20f209;}})});}_0x53e9bf=_[_0x5edf('0x3a')]({},_0x53e9bf,_0x2596bc[_0x5edf('0x3d')]);var _0x46b905={'where':_0x53e9bf[_0x5edf('0x37')]};return db[_0x5edf('0x29')][_0x5edf('0x19')](_0x46b905)[_0x5edf('0x20')](function(_0x76954f){_0x1b874d['count']=_0x76954f;if(_0x2596bc['query'][_0x5edf('0x3e')]){_0x53e9bf[_0x5edf('0x3f')]=[{'all':!![]}];}return db[_0x5edf('0x29')][_0x5edf('0x40')](_0x53e9bf);})[_0x5edf('0x20')](function(_0x38c159){_0x1b874d[_0x5edf('0x41')]=_0x38c159;return _0x1b874d;})[_0x5edf('0x20')](respondWithFilteredResult(_0x26e7f5,_0x53e9bf))[_0x5edf('0x42')](handleError(_0x26e7f5,null));}; \ No newline at end of file +var _0xf26f=['../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','offset','set','reject','save','update','destroy','end','error','index','Migration','rawAttributes','fieldName','key','model','map','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','then','includeAll','include','rows','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','papaparse'];(function(_0x269988,_0x6c5940){var _0x172812=function(_0x3ccac5){while(--_0x3ccac5){_0x269988['push'](_0x269988['shift']());}};_0x172812(++_0x6c5940);}(_0xf26f,0x142));var _0xff26=function(_0x609c5f,_0xa0e9bb){_0x609c5f=_0x609c5f-0x0;var _0x476853=_0xf26f[_0x609c5f];return _0x476853;};'use strict';var emlformat=require(_0xff26('0x0'));var rimraf=require(_0xff26('0x1'));var zipdir=require(_0xff26('0x2'));var jsonpatch=require(_0xff26('0x3'));var rp=require(_0xff26('0x4'));var moment=require(_0xff26('0x5'));var BPromise=require(_0xff26('0x6'));var Mustache=require(_0xff26('0x7'));var util=require('util');var path=require(_0xff26('0x8'));var sox=require(_0xff26('0x9'));var csv=require('to-csv');var ejs=require(_0xff26('0xa'));var fs=require('fs');var fs_extra=require(_0xff26('0xb'));var _=require(_0xff26('0xc'));var squel=require(_0xff26('0xd'));var crypto=require('crypto');var jsforce=require(_0xff26('0xe'));var deskjs=require(_0xff26('0xf'));var toCsv=require(_0xff26('0x10'));var querystring=require('querystring');var Papa=require(_0xff26('0x11'));var Redis=require('ioredis');var authService=require(_0xff26('0x12'));var qs=require(_0xff26('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xff26('0x14'));var logger=require('../../config/logger')(_0xff26('0x15'));var utils=require(_0xff26('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xff26('0x17'));var db=require(_0xff26('0x18'))['db'];function respondWithStatusCode(_0x5d1d79,_0x4da55e){_0x4da55e=_0x4da55e||0xcc;return function(_0x2e8c1e){if(_0x2e8c1e){return _0x5d1d79[_0xff26('0x19')](_0x4da55e);}return _0x5d1d79['status'](_0x4da55e)['end']();};}function respondWithResult(_0x1b7786,_0x153c40){_0x153c40=_0x153c40||0xc8;return function(_0x17e168){if(_0x17e168){return _0x1b7786[_0xff26('0x1a')](_0x153c40)['json'](_0x17e168);}};}function respondWithFilteredResult(_0x47ad74,_0x4b7a9c){return function(_0x54ed47){if(_0x54ed47){var _0x35070b=typeof _0x4b7a9c['offset']===_0xff26('0x1b')&&typeof _0x4b7a9c[_0xff26('0x1c')]===_0xff26('0x1b');var _0x3a13a0=_0x54ed47[_0xff26('0x1d')];var _0x4ad03d=_0x35070b?0x0:_0x4b7a9c[_0xff26('0x1e')];var _0x3142f3=_0x35070b?_0x54ed47[_0xff26('0x1d')]:_0x4b7a9c[_0xff26('0x1e')]+_0x4b7a9c[_0xff26('0x1c')];var _0x3b9882;if(_0x3142f3>=_0x3a13a0){_0x3142f3=_0x3a13a0;_0x3b9882=0xc8;}else{_0x3b9882=0xce;}_0x47ad74[_0xff26('0x1a')](_0x3b9882);return _0x47ad74[_0xff26('0x1f')]('Content-Range',_0x4ad03d+'-'+_0x3142f3+'/'+_0x3a13a0)['json'](_0x54ed47);}return null;};}function patchUpdates(_0x204692){return function(_0x198102){try{jsonpatch['apply'](_0x198102,_0x204692,!![]);}catch(_0x34f8fa){return BPromise[_0xff26('0x20')](_0x34f8fa);}return _0x198102[_0xff26('0x21')]();};}function saveUpdates(_0x2e8e11,_0x2e5a22){return function(_0x486018){if(_0x486018){return _0x486018[_0xff26('0x22')](_0x2e8e11)['then'](function(_0x5b6517){return _0x5b6517;});}return null;};}function removeEntity(_0x31c6e6,_0x2fa44d){return function(_0x5be979){if(_0x5be979){return _0x5be979[_0xff26('0x23')]()['then'](function(){_0x31c6e6['status'](0xcc)[_0xff26('0x24')]();});}};}function handleEntityNotFound(_0xa0c0be,_0x21c269){return function(_0x28706d){if(!_0x28706d){_0xa0c0be[_0xff26('0x19')](0x194);}return _0x28706d;};}function handleError(_0x3db896,_0x428fa7){_0x428fa7=_0x428fa7||0x1f4;return function(_0x3f5d1b){logger[_0xff26('0x25')](_0x3f5d1b['stack']);if(_0x3f5d1b['name']){delete _0x3f5d1b['name'];}_0x3db896[_0xff26('0x1a')](_0x428fa7)['send'](_0x3f5d1b);};}exports[_0xff26('0x26')]=function(_0x2df28d,_0x4ed22e){var _0x1f69f7={},_0x534c26={},_0x12392c={'count':0x0,'rows':[]};var _0x576f6b=_['map'](db[_0xff26('0x27')][_0xff26('0x28')],function(_0xca1ccc){return{'name':_0xca1ccc[_0xff26('0x29')],'type':_0xca1ccc['type'][_0xff26('0x2a')]};});_0x534c26[_0xff26('0x2b')]=_[_0xff26('0x2c')](_0x576f6b,_0xff26('0x2d'));_0x534c26[_0xff26('0x2e')]=_[_0xff26('0x2f')](_0x2df28d[_0xff26('0x2e')]);_0x534c26[_0xff26('0x30')]=_[_0xff26('0x31')](_0x534c26[_0xff26('0x2b')],_0x534c26['query']);_0x1f69f7['attributes']=_[_0xff26('0x31')](_0x534c26[_0xff26('0x2b')],qs[_0xff26('0x32')](_0x2df28d[_0xff26('0x2e')]['fields']));_0x1f69f7[_0xff26('0x33')]=_0x1f69f7[_0xff26('0x33')][_0xff26('0x34')]?_0x1f69f7[_0xff26('0x33')]:_0x534c26[_0xff26('0x2b')];if(!_0x2df28d['query'][_0xff26('0x35')](_0xff26('0x36'))){_0x1f69f7['limit']=qs[_0xff26('0x1c')](_0x2df28d[_0xff26('0x2e')][_0xff26('0x1c')]);_0x1f69f7[_0xff26('0x1e')]=qs['offset'](_0x2df28d[_0xff26('0x2e')][_0xff26('0x1e')]);}_0x1f69f7[_0xff26('0x37')]=qs[_0xff26('0x38')](_0x2df28d[_0xff26('0x2e')][_0xff26('0x38')]);_0x1f69f7[_0xff26('0x39')]=qs[_0xff26('0x30')](_[_0xff26('0x3a')](_0x2df28d[_0xff26('0x2e')],_0x534c26['filters']),_0x576f6b);if(_0x2df28d['query'][_0xff26('0x3b')]){_0x1f69f7[_0xff26('0x39')]=_[_0xff26('0x3c')](_0x1f69f7[_0xff26('0x39')],{'$or':_[_0xff26('0x2c')](_0x576f6b,function(_0x2628af){if(_0x2628af[_0xff26('0x3d')]!==_0xff26('0x3e')){var _0xacd16b={};_0xacd16b[_0x2628af[_0xff26('0x2d')]]={'$like':'%'+_0x2df28d[_0xff26('0x2e')][_0xff26('0x3b')]+'%'};return _0xacd16b;}})});}_0x1f69f7=_['merge']({},_0x1f69f7,_0x2df28d['options']);var _0x2cfbb2={'where':_0x1f69f7[_0xff26('0x39')]};return db[_0xff26('0x27')][_0xff26('0x1d')](_0x2cfbb2)[_0xff26('0x3f')](function(_0x294e09){_0x12392c[_0xff26('0x1d')]=_0x294e09;if(_0x2df28d[_0xff26('0x2e')][_0xff26('0x40')]){_0x1f69f7[_0xff26('0x41')]=[{'all':!![]}];}return db[_0xff26('0x27')]['findAll'](_0x1f69f7);})[_0xff26('0x3f')](function(_0x4b2679){_0x12392c[_0xff26('0x42')]=_0x4b2679;return _0x12392c;})['then'](respondWithFilteredResult(_0x4ed22e,_0x1f69f7))[_0xff26('0x43')](handleError(_0x4ed22e,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 07948ca..b57f72f 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 _0x2555=['../../config/environment','exports','define','Migration','migrations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x71d5c4,_0x3f26fe){var _0x5333a0=function(_0xcaa715){while(--_0xcaa715){_0x71d5c4['push'](_0x71d5c4['shift']());}};_0x5333a0(++_0x3f26fe);}(_0x2555,0xc9));var _0x5255=function(_0x84fc25,_0x33d620){_0x84fc25=_0x84fc25-0x0;var _0x19c4cb=_0x2555[_0x84fc25];return _0x19c4cb;};'use strict';var _=require(_0x5255('0x0'));var util=require(_0x5255('0x1'));var logger=require(_0x5255('0x2'))(_0x5255('0x3'));var moment=require(_0x5255('0x4'));var BPromise=require(_0x5255('0x5'));var rp=require(_0x5255('0x6'));var fs=require('fs');var path=require(_0x5255('0x7'));var rimraf=require(_0x5255('0x8'));var config=require(_0x5255('0x9'));var attributes=require('./migration.attributes');module[_0x5255('0xa')]=function(_0x58a39a,_0x1a8da8){return _0x58a39a[_0x5255('0xb')](_0x5255('0xc'),attributes,{'tableName':_0x5255('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3c8b=['define','Migration','migrations','util','api','moment','bluebird','request-promise','rimraf','./migration.attributes'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0x3c8b,0x193));var _0xb3c8=function(_0x12cc58,_0x55faaa){_0x12cc58=_0x12cc58-0x0;var _0x6c6a45=_0x3c8b[_0x12cc58];return _0x6c6a45;};'use strict';var _=require('lodash');var util=require(_0xb3c8('0x0'));var logger=require('../../config/logger')(_0xb3c8('0x1'));var moment=require(_0xb3c8('0x2'));var BPromise=require(_0xb3c8('0x3'));var rp=require(_0xb3c8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb3c8('0x5'));var config=require('../../config/environment');var attributes=require(_0xb3c8('0x6'));module['exports']=function(_0x2e64ad,_0x4c1515){return _0x2e64ad[_0xb3c8('0x7')](_0xb3c8('0x8'),attributes,{'tableName':_0xb3c8('0x9'),'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 3d8d1f8..e4bddfd 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 _0xe829=['request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','Migration,\x20%s,\x20%s','message','info','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then'];(function(_0x255c48,_0x2a4449){var _0xaebda3=function(_0x12a04e){while(--_0x12a04e){_0x255c48['push'](_0x255c48['shift']());}};_0xaebda3(++_0x2a4449);}(_0xe829,0x1d8));var _0x9e82=function(_0x4a8072,_0x435bab){_0x4a8072=_0x4a8072-0x0;var _0x11a4fe=_0xe829[_0x4a8072];return _0x11a4fe;};'use strict';var _=require(_0x9e82('0x0'));var util=require(_0x9e82('0x1'));var moment=require(_0x9e82('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9e82('0x3'));var db=require(_0x9e82('0x4'))['db'];var utils=require(_0x9e82('0x5'));var logger=require(_0x9e82('0x6'))(_0x9e82('0x7'));var config=require(_0x9e82('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9e82('0x9')][_0x9e82('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1a63b3,_0x7cebd4,_0x2d91ba){return new BPromise(function(_0x5c4c57,_0x149f39){return client['request'](_0x1a63b3,_0x2d91ba)[_0x9e82('0xb')](function(_0x13070b){logger['info']('Migration,\x20%s,\x20%s',_0x7cebd4,_0x9e82('0xc'));logger[_0x9e82('0xd')](_0x9e82('0xe'),_0x7cebd4,_0x9e82('0xc'),JSON[_0x9e82('0xf')](_0x13070b));if(_0x13070b[_0x9e82('0x10')]){if(_0x13070b[_0x9e82('0x10')][_0x9e82('0x11')]===0x1f4){logger[_0x9e82('0x10')](_0x9e82('0x12'),_0x7cebd4,_0x13070b[_0x9e82('0x10')][_0x9e82('0x13')]);return _0x149f39(_0x13070b['error']['message']);}logger[_0x9e82('0x10')](_0x9e82('0x12'),_0x7cebd4,_0x13070b[_0x9e82('0x10')][_0x9e82('0x13')]);return _0x5c4c57(_0x13070b['error'][_0x9e82('0x13')]);}else{logger[_0x9e82('0x14')](_0x9e82('0x12'),_0x7cebd4,_0x9e82('0xc'));_0x5c4c57(_0x13070b['result'][_0x9e82('0x13')]);}})[_0x9e82('0x15')](function(_0x3f70a3){logger[_0x9e82('0x10')]('Migration,\x20%s,\x20%s',_0x7cebd4,_0x3f70a3);_0x149f39(_0x3f70a3);});});} \ No newline at end of file +var _0xd66c=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','Migration,\x20%s,\x20%s,\x20%s','error','code','Migration,\x20%s,\x20%s','message','info','result','lodash','moment'];(function(_0x1d1614,_0x28da74){var _0x18897f=function(_0x225deb){while(--_0x225deb){_0x1d1614['push'](_0x1d1614['shift']());}};_0x18897f(++_0x28da74);}(_0xd66c,0x106));var _0xcd66=function(_0x2ef7d5,_0x198404){_0x2ef7d5=_0x2ef7d5-0x0;var _0x9d1fe6=_0xd66c[_0x2ef7d5];return _0x9d1fe6;};'use strict';var _=require(_0xcd66('0x0'));var util=require('util');var moment=require(_0xcd66('0x1'));var BPromise=require(_0xcd66('0x2'));var rs=require(_0xcd66('0x3'));var fs=require('fs');var Redis=require(_0xcd66('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xcd66('0x5'));var logger=require(_0xcd66('0x6'))(_0xcd66('0x7'));var config=require(_0xcd66('0x8'));var jayson=require(_0xcd66('0x9'));var client=jayson[_0xcd66('0xa')][_0xcd66('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x29e76e,_0x5ac1ed,_0x42e328){return new BPromise(function(_0x220746,_0x45d71f){return client[_0xcd66('0xc')](_0x29e76e,_0x42e328)[_0xcd66('0xd')](function(_0x9aafc5){logger['info']('Migration,\x20%s,\x20%s',_0x5ac1ed,_0xcd66('0xe'));logger['debug'](_0xcd66('0xf'),_0x5ac1ed,_0xcd66('0xe'),JSON['stringify'](_0x9aafc5));if(_0x9aafc5[_0xcd66('0x10')]){if(_0x9aafc5['error'][_0xcd66('0x11')]===0x1f4){logger[_0xcd66('0x10')](_0xcd66('0x12'),_0x5ac1ed,_0x9aafc5[_0xcd66('0x10')][_0xcd66('0x13')]);return _0x45d71f(_0x9aafc5['error']['message']);}logger[_0xcd66('0x10')]('Migration,\x20%s,\x20%s',_0x5ac1ed,_0x9aafc5[_0xcd66('0x10')]['message']);return _0x220746(_0x9aafc5['error'][_0xcd66('0x13')]);}else{logger[_0xcd66('0x14')](_0xcd66('0x12'),_0x5ac1ed,_0xcd66('0xe'));_0x220746(_0x9aafc5[_0xcd66('0x15')][_0xcd66('0x13')]);}})['catch'](function(_0x25648e){logger['error'](_0xcd66('0x12'),_0x5ac1ed,_0x25648e);_0x45d71f(_0x25648e);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 01876e9..d943b04 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 _0x1115=['post','create','put','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/:id'];(function(_0x9df686,_0x2f5bef){var _0x1084a9=function(_0x33c9ee){while(--_0x33c9ee){_0x9df686['push'](_0x9df686['shift']());}};_0x1084a9(++_0x2f5bef);}(_0x1115,0x1b6));var _0x5111=function(_0xff53cb,_0x3aa322){_0xff53cb=_0xff53cb-0x0;var _0x198fbd=_0x1115[_0xff53cb];return _0x198fbd;};'use strict';var multer=require('multer');var util=require(_0x5111('0x0'));var path=require(_0x5111('0x1'));var timeout=require(_0x5111('0x2'));var express=require(_0x5111('0x3'));var router=express[_0x5111('0x4')]();var fs_extra=require(_0x5111('0x5'));var auth=require(_0x5111('0x6'));var interaction=require(_0x5111('0x7'));var config=require(_0x5111('0x8'));var controller=require('./network.controller');router['get']('/',auth[_0x5111('0x9')](),controller[_0x5111('0xa')]);router['get'](_0x5111('0xb'),auth[_0x5111('0x9')](),controller['show']);router[_0x5111('0xc')]('/',auth['isAuthenticated'](),controller[_0x5111('0xd')]);router[_0x5111('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x5111('0xf')]);router['delete'](_0x5111('0xb'),auth['isAuthenticated'](),controller[_0x5111('0x10')]);module[_0x5111('0x11')]=router; \ No newline at end of file +var _0x36d3=['exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy'];(function(_0x2fa8be,_0x5691af){var _0x3d9bd5=function(_0x508287){while(--_0x508287){_0x2fa8be['push'](_0x2fa8be['shift']());}};_0x3d9bd5(++_0x5691af);}(_0x36d3,0xb5));var _0x336d=function(_0x49479d,_0x40ee18){_0x49479d=_0x49479d-0x0;var _0x260248=_0x36d3[_0x49479d];return _0x260248;};'use strict';var multer=require(_0x336d('0x0'));var util=require(_0x336d('0x1'));var path=require(_0x336d('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x336d('0x3')]();var fs_extra=require(_0x336d('0x4'));var auth=require(_0x336d('0x5'));var interaction=require(_0x336d('0x6'));var config=require(_0x336d('0x7'));var controller=require(_0x336d('0x8'));router[_0x336d('0x9')]('/',auth[_0x336d('0xa')](),controller[_0x336d('0xb')]);router[_0x336d('0x9')](_0x336d('0xc'),auth[_0x336d('0xa')](),controller[_0x336d('0xd')]);router[_0x336d('0xe')]('/',auth[_0x336d('0xa')](),controller[_0x336d('0xf')]);router['put'](_0x336d('0xc'),auth[_0x336d('0xa')](),controller[_0x336d('0x10')]);router[_0x336d('0x11')]('/:id',auth[_0x336d('0xa')](),controller[_0x336d('0x12')]);module[_0x336d('0x13')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 6e90093..6349bc5 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 _0xf8de=['turn','sequelize','localnet','externip','stun'];(function(_0x8560d3,_0x26a504){var _0x33b1b5=function(_0x3a2cad){while(--_0x3a2cad){_0x8560d3['push'](_0x8560d3['shift']());}};_0x33b1b5(++_0x26a504);}(_0xf8de,0x9c));var _0xef8d=function(_0x99f7c,_0x4ce71e){_0x99f7c=_0x99f7c-0x0;var _0x214edb=_0xf8de[_0x99f7c];return _0x214edb;};'use strict';var Sequelize=require(_0xef8d('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0xef8d('0x1'),_0xef8d('0x2'),_0xef8d('0x3'),_0xef8d('0x4'))},'value':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe4fb=['externip','stun','STRING','sequelize','exports','ENUM','localnet'];(function(_0x2d3bdc,_0xa317e5){var _0x91daae=function(_0x37852a){while(--_0x37852a){_0x2d3bdc['push'](_0x2d3bdc['shift']());}};_0x91daae(++_0xa317e5);}(_0xe4fb,0xc7));var _0xbe4f=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xe4fb[_0x3bf83f];return _0x22c4a9;};'use strict';var Sequelize=require(_0xbe4f('0x0'));module[_0xbe4f('0x1')]={'type':{'type':Sequelize[_0xbe4f('0x2')](_0xbe4f('0x3'),_0xbe4f('0x4'),_0xbe4f('0x5'),'turn')},'value':{'type':Sequelize[_0xbe4f('0x6')]},'username':{'type':Sequelize[_0xbe4f('0x6')]},'password':{'type':Sequelize[_0xbe4f('0x6')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index f06a059..5ec43af 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 _0x3d76=['root','server/files/templates/network.ejs','writeFileSync','format','/etc/asterisk/sip_xcally_%s.conf','chan_sip.so','toUpperCase','server/files/templates/turn_multiple.ejs','toLowerCase','util','lodash','../../components/parsers/qs','api','../../mysqldb','http','request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','status','json','offset','undefined','limit','count','set','update','destroy','end','sendStatus','stack','name','index','map','Network','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','find','create','body','STUN','readFileSync','join','server/files/templates/stun_multiple.ejs','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','utf8','render','/etc/asterisk/turn_xcally.conf'];(function(_0x4c308a,_0x12cbce){var _0x4f7884=function(_0x30eb8b){while(--_0x30eb8b){_0x4c308a['push'](_0x4c308a['shift']());}};_0x4f7884(++_0x12cbce);}(_0x3d76,0x1ad));var _0x63d7=function(_0x6d6a66,_0x2924af){_0x6d6a66=_0x6d6a66-0x0;var _0x11eb6e=_0x3d76[_0x6d6a66];return _0x11eb6e;};'use strict';var util=require(_0x63d7('0x0'));var path=require('path');var ejs=require('ejs');var fs=require('fs');var _=require(_0x63d7('0x1'));var qs=require(_0x63d7('0x2'));var logger=require('../../config/logger')(_0x63d7('0x3'));var config=require('../../config/environment');var db=require(_0x63d7('0x4'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x63d7('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x5bff92,_0x68b45e,_0x161d38,_0x1ba5f4){return new Promise(function(_0x129e4a,_0x3dffb6){var _0x27f946=_0x1ba5f4||client;return _0x27f946[_0x63d7('0x6')](_0x5bff92,_0x161d38)[_0x63d7('0x7')](function(_0x24491c){logger[_0x63d7('0x8')](_0x63d7('0x9'),_0x68b45e,_0x63d7('0xa'));logger[_0x63d7('0xb')]('Network,\x20%s,\x20%s,\x20%s',_0x68b45e,_0x63d7('0xa'),JSON['stringify'](_0x24491c));if(_0x24491c['error']){if(_0x24491c[_0x63d7('0xc')][_0x63d7('0xd')]===0x1f4){logger[_0x63d7('0xc')](_0x63d7('0x9'),_0x68b45e,_0x24491c[_0x63d7('0xc')][_0x63d7('0xe')]);return _0x3dffb6(_0x24491c[_0x63d7('0xc')][_0x63d7('0xe')]);}logger[_0x63d7('0xc')](_0x63d7('0x9'),_0x68b45e,_0x24491c[_0x63d7('0xc')][_0x63d7('0xe')]);return _0x129e4a(_0x24491c[_0x63d7('0xc')]['message']);}else{logger[_0x63d7('0x8')]('Network,\x20%s,\x20%s',_0x68b45e,'request\x20sent');_0x129e4a(_0x24491c[_0x63d7('0xf')]['message']);}})[_0x63d7('0x10')](function(_0x2c6172){logger[_0x63d7('0xc')](_0x63d7('0x9'),_0x68b45e,_0x2c6172);_0x3dffb6(_0x2c6172);});});}function respondWithResult(_0xbf1dd4,_0x5c264e){_0x5c264e=_0x5c264e||0xc8;return function(_0x25b8b3){if(_0x25b8b3){return _0xbf1dd4[_0x63d7('0x11')](_0x5c264e)[_0x63d7('0x12')](_0x25b8b3);}};}function respondWithFilteredResult(_0x146db5,_0x389841){return function(_0x4132df){if(_0x4132df){var _0x412ad5=typeof _0x389841[_0x63d7('0x13')]===_0x63d7('0x14')&&typeof _0x389841[_0x63d7('0x15')]===_0x63d7('0x14');var _0x57a316=_0x4132df['count'];var _0x54d0de=_0x412ad5?0x0:_0x389841[_0x63d7('0x13')];var _0x108fda=_0x412ad5?_0x4132df[_0x63d7('0x16')]:_0x389841[_0x63d7('0x13')]+_0x389841['limit'];var _0x3c1827;if(_0x108fda>=_0x57a316){_0x108fda=_0x57a316;_0x3c1827=0xc8;}else{_0x3c1827=0xce;}_0x146db5[_0x63d7('0x11')](_0x3c1827);return _0x146db5[_0x63d7('0x17')]('Content-Range',_0x54d0de+'-'+_0x108fda+'/'+_0x57a316)[_0x63d7('0x12')](_0x4132df);}return null;};}function saveUpdates(_0x5641fa){return function(_0x22f066){if(_0x22f066){return _0x22f066[_0x63d7('0x18')](_0x5641fa)[_0x63d7('0x7')](function(_0xc61e54){return _0xc61e54;});}return null;};}function removeEntity(_0x560e23){return function(_0x32c3f2){if(_0x32c3f2){return _0x32c3f2[_0x63d7('0x19')]()[_0x63d7('0x7')](function(){_0x560e23['status'](0xcc)[_0x63d7('0x1a')]();});}};}function handleEntityNotFound(_0x4a364a){return function(_0x5279ce){if(!_0x5279ce){_0x4a364a[_0x63d7('0x1b')](0x194);}return _0x5279ce;};}function handleError(_0x350bf5,_0x2f38f8){_0x2f38f8=_0x2f38f8||0x1f4;return function(_0x11970f){logger[_0x63d7('0xc')](_0x11970f[_0x63d7('0x1c')]);if(_0x11970f[_0x63d7('0x1d')]){delete _0x11970f[_0x63d7('0x1d')];}_0x350bf5['status'](_0x2f38f8)['send'](_0x11970f);};}exports[_0x63d7('0x1e')]=function(_0x54c63b,_0xd2d5ee){var _0x4c5135={},_0x7f733f={},_0x21030d={'count':0x0,'rows':[]};var _0x48ddc1=_[_0x63d7('0x1f')](db[_0x63d7('0x20')][_0x63d7('0x21')],function(_0x4c0d13){return{'name':_0x4c0d13[_0x63d7('0x22')],'type':_0x4c0d13[_0x63d7('0x23')][_0x63d7('0x24')]};});_0x7f733f[_0x63d7('0x25')]=_[_0x63d7('0x1f')](_0x48ddc1,_0x63d7('0x1d'));_0x7f733f[_0x63d7('0x26')]=_[_0x63d7('0x27')](_0x54c63b[_0x63d7('0x26')]);_0x7f733f['filters']=_[_0x63d7('0x28')](_0x7f733f[_0x63d7('0x25')],_0x7f733f[_0x63d7('0x26')]);_0x4c5135[_0x63d7('0x29')]=_['intersection'](_0x7f733f[_0x63d7('0x25')],qs[_0x63d7('0x2a')](_0x54c63b[_0x63d7('0x26')][_0x63d7('0x2a')]));_0x4c5135[_0x63d7('0x29')]=_0x4c5135[_0x63d7('0x29')][_0x63d7('0x2b')]?_0x4c5135[_0x63d7('0x29')]:_0x7f733f[_0x63d7('0x25')];if(!_0x54c63b[_0x63d7('0x26')][_0x63d7('0x2c')](_0x63d7('0x2d'))){_0x4c5135['limit']=qs[_0x63d7('0x15')](_0x54c63b[_0x63d7('0x26')][_0x63d7('0x15')]);_0x4c5135[_0x63d7('0x13')]=qs[_0x63d7('0x13')](_0x54c63b['query'][_0x63d7('0x13')]);}_0x4c5135[_0x63d7('0x2e')]=qs['sort'](_0x54c63b[_0x63d7('0x26')][_0x63d7('0x2f')]);_0x4c5135[_0x63d7('0x30')]=qs[_0x63d7('0x31')](_[_0x63d7('0x32')](_0x54c63b['query'],_0x7f733f[_0x63d7('0x31')]),_0x48ddc1);if(_0x54c63b[_0x63d7('0x26')][_0x63d7('0x33')]){_0x4c5135[_0x63d7('0x30')]=_['merge'](_0x4c5135[_0x63d7('0x30')],{'$or':_[_0x63d7('0x1f')](_0x48ddc1,function(_0x48e484){if(_0x48e484[_0x63d7('0x23')]!==_0x63d7('0x34')){var _0x46ecf7={};_0x46ecf7[_0x48e484[_0x63d7('0x1d')]]={'$like':'%'+_0x54c63b[_0x63d7('0x26')]['filter']+'%'};return _0x46ecf7;}})});}_0x4c5135=_[_0x63d7('0x35')]({},_0x4c5135,_0x54c63b[_0x63d7('0x36')]);var _0x4b295b={'where':_0x4c5135[_0x63d7('0x30')]};return db[_0x63d7('0x20')][_0x63d7('0x16')](_0x4b295b)['then'](function(_0x1f5af7){_0x21030d[_0x63d7('0x16')]=_0x1f5af7;if(_0x54c63b[_0x63d7('0x26')][_0x63d7('0x37')]){_0x4c5135[_0x63d7('0x38')]=[{'all':!![]}];}return db['Network'][_0x63d7('0x39')](_0x4c5135);})[_0x63d7('0x7')](function(_0x4848ae){_0x21030d[_0x63d7('0x3a')]=_0x4848ae;return _0x21030d;})[_0x63d7('0x7')](respondWithFilteredResult(_0xd2d5ee,_0x4c5135))[_0x63d7('0x10')](handleError(_0xd2d5ee,null));};exports[_0x63d7('0x3b')]=function(_0x29f7d1,_0x2890df){var _0x2d09e2={'raw':!![],'where':{'id':_0x29f7d1[_0x63d7('0x3c')]['id']}},_0xed24d6={};_0xed24d6[_0x63d7('0x25')]=_[_0x63d7('0x27')](db[_0x63d7('0x20')][_0x63d7('0x21')]);_0xed24d6[_0x63d7('0x26')]=_[_0x63d7('0x27')](_0x29f7d1[_0x63d7('0x26')]);_0xed24d6['filters']=_[_0x63d7('0x28')](_0xed24d6['model'],_0xed24d6[_0x63d7('0x26')]);_0x2d09e2[_0x63d7('0x29')]=_['intersection'](_0xed24d6[_0x63d7('0x25')],qs[_0x63d7('0x2a')](_0x29f7d1[_0x63d7('0x26')][_0x63d7('0x2a')]));_0x2d09e2[_0x63d7('0x29')]=_0x2d09e2[_0x63d7('0x29')][_0x63d7('0x2b')]?_0x2d09e2[_0x63d7('0x29')]:_0xed24d6[_0x63d7('0x25')];if(_0x29f7d1[_0x63d7('0x26')]['includeAll']){_0x2d09e2[_0x63d7('0x38')]=[{'all':!![]}];}_0x2d09e2=_[_0x63d7('0x35')]({},_0x2d09e2,_0x29f7d1['options']);return db[_0x63d7('0x20')][_0x63d7('0x3d')](_0x2d09e2)[_0x63d7('0x7')](handleEntityNotFound(_0x2890df,null))[_0x63d7('0x7')](respondWithResult(_0x2890df,null))[_0x63d7('0x10')](handleError(_0x2890df,null));};exports[_0x63d7('0x3e')]=function(_0x43cb46,_0x42d65f){var _0x46b144;return db[_0x63d7('0x20')]['create'](_0x43cb46[_0x63d7('0x3f')],{'raw':!![]})['then'](function(_0xe7643){_0x46b144=_0xe7643;return db[_0x63d7('0x20')]['findAll']({'where':{'type':_0x43cb46['body'][_0x63d7('0x23')]},'raw':!![]});})['then'](function(_0x14450a){if(_0x46b144['type']['toUpperCase']()==_0x63d7('0x40')){var _0x3bfe16=fs[_0x63d7('0x41')](path[_0x63d7('0x42')](config['root'],_0x63d7('0x43')),'utf8');var _0x313179=ejs['render'](_0x3bfe16,{'networks':_0x14450a||[]});fs['writeFileSync'](_0x63d7('0x44'),_0x313179);return respondWithRpcPromise(_0x63d7('0x45'),_0x63d7('0x3e'),{'module':_0x63d7('0x46')});}else if(_0x46b144[_0x63d7('0x23')]['toUpperCase']()==_0x63d7('0x47')){var _0x1164d1=fs[_0x63d7('0x41')](path[_0x63d7('0x42')](config['root'],'server/files/templates/turn_multiple.ejs'),_0x63d7('0x48'));var _0x2a61d5=ejs[_0x63d7('0x49')](_0x1164d1,{'networks':_0x14450a||[]});fs['writeFileSync'](_0x63d7('0x4a'),_0x2a61d5);return respondWithRpcPromise(_0x63d7('0x45'),_0x63d7('0x3e'),{'module':_0x63d7('0x46')});}else{var _0x405146=fs[_0x63d7('0x41')](path[_0x63d7('0x42')](config[_0x63d7('0x4b')],_0x63d7('0x4c')),_0x63d7('0x48'));var _0x2cb359=ejs['render'](_0x405146,{'networks':_0x14450a||[]});fs[_0x63d7('0x4d')](util[_0x63d7('0x4e')](_0x63d7('0x4f'),_0x43cb46['body'][_0x63d7('0x23')]['toLowerCase']()),_0x2cb359);return respondWithRpcPromise('Reload',_0x63d7('0x3e'),{'module':_0x63d7('0x50')});}})['then'](function(){return _0x46b144;})[_0x63d7('0x7')](respondWithResult(_0x42d65f,0xc9))['catch'](handleError(_0x42d65f,null));};exports[_0x63d7('0x18')]=function(_0x5f4de0,_0x9a51de){var _0x30aa14;return db['Network'][_0x63d7('0x3d')]({'where':{'id':_0x5f4de0['params']['id']}})[_0x63d7('0x7')](handleEntityNotFound(_0x9a51de,null))['then'](saveUpdates(_0x5f4de0[_0x63d7('0x3f')],null))[_0x63d7('0x7')](function(_0x3f2f12){if(_0x3f2f12){_0x30aa14=_0x3f2f12;return db['Network']['findAll']({'where':{'type':_0x30aa14[_0x63d7('0x23')]},'raw':!![]});}return null;})[_0x63d7('0x7')](function(_0x5470cc){if(_0x30aa14[_0x63d7('0x23')]['toUpperCase']()==_0x63d7('0x40')){var _0x5d455b=fs['readFileSync'](path[_0x63d7('0x42')](config[_0x63d7('0x4b')],_0x63d7('0x43')),'utf8');var _0x1cde44=ejs[_0x63d7('0x49')](_0x5d455b,{'networks':_0x5470cc||[]});fs['writeFileSync']('/etc/asterisk/stun_xcally.conf',_0x1cde44);return respondWithRpcPromise(_0x63d7('0x45'),_0x63d7('0x18'),{'module':_0x63d7('0x46')});}else if(_0x30aa14['type'][_0x63d7('0x51')]()==_0x63d7('0x47')){var _0x31001b=fs[_0x63d7('0x41')](path[_0x63d7('0x42')](config[_0x63d7('0x4b')],_0x63d7('0x52')),_0x63d7('0x48'));var _0x37ad99=ejs[_0x63d7('0x49')](_0x31001b,{'networks':_0x5470cc||[]});fs[_0x63d7('0x4d')]('/etc/asterisk/turn_xcally.conf',_0x37ad99);return respondWithRpcPromise(_0x63d7('0x45'),_0x63d7('0x18'),{'module':_0x63d7('0x46')});}else{var _0x50b3e8=fs[_0x63d7('0x41')](path[_0x63d7('0x42')](config['root'],'server/files/templates/network.ejs'),_0x63d7('0x48'));var _0x42ce96=ejs[_0x63d7('0x49')](_0x50b3e8,{'networks':_0x5470cc||[]});fs[_0x63d7('0x4d')](util[_0x63d7('0x4e')](_0x63d7('0x4f'),_0x5f4de0[_0x63d7('0x3f')][_0x63d7('0x23')]['toLowerCase']()),_0x42ce96);return respondWithRpcPromise(_0x63d7('0x45'),'update',{'module':'chan_sip.so'});}})['then'](function(_0x15fed5){if(_0x15fed5){return _0x30aa14;}return null;})[_0x63d7('0x7')](respondWithResult(_0x9a51de,null))[_0x63d7('0x10')](handleError(_0x9a51de,null));};exports[_0x63d7('0x19')]=function(_0x36d45d,_0x34e4c1){var _0x3566eb;return db[_0x63d7('0x20')][_0x63d7('0x3d')]({'where':{'id':_0x36d45d[_0x63d7('0x3c')]['id']}})[_0x63d7('0x7')](function(_0x3e4302){_0x3566eb=_0x3e4302;return _0x3e4302;})['then'](handleEntityNotFound(_0x34e4c1,null))[_0x63d7('0x7')](removeEntity(_0x34e4c1,null))[_0x63d7('0x7')](function(){if(_0x3566eb){return db['Network'][_0x63d7('0x39')]({'where':{'type':_0x3566eb[_0x63d7('0x23')]},'raw':!![]});}})[_0x63d7('0x7')](function(_0x22452b){if(_0x3566eb[_0x63d7('0x23')][_0x63d7('0x51')]()==_0x63d7('0x40')){var _0x322d19=fs[_0x63d7('0x41')](path[_0x63d7('0x42')](config['root'],_0x63d7('0x43')),_0x63d7('0x48'));var _0x4d6cc9=ejs[_0x63d7('0x49')](_0x322d19,{'networks':_0x22452b||[]});fs[_0x63d7('0x4d')](_0x63d7('0x44'),_0x4d6cc9);return respondWithRpcPromise(_0x63d7('0x45'),_0x63d7('0x19'),{'module':_0x63d7('0x46')});}else if(_0x3566eb[_0x63d7('0x23')][_0x63d7('0x51')]()==_0x63d7('0x47')){var _0x492b70=fs[_0x63d7('0x41')](path[_0x63d7('0x42')](config[_0x63d7('0x4b')],'server/files/templates/turn_multiple.ejs'),_0x63d7('0x48'));var _0x172f1f=ejs[_0x63d7('0x49')](_0x492b70,{'networks':_0x22452b||[]});fs[_0x63d7('0x4d')](_0x63d7('0x4a'),_0x172f1f);return respondWithRpcPromise('Reload',_0x63d7('0x19'),{'module':_0x63d7('0x46')});}else{var _0x107b0e=fs['readFileSync'](path['join'](config[_0x63d7('0x4b')],_0x63d7('0x4c')),'utf8');var _0x107d29=ejs[_0x63d7('0x49')](_0x107b0e,{'networks':_0x22452b||[]});fs['writeFileSync'](util[_0x63d7('0x4e')](_0x63d7('0x4f'),_0x3566eb[_0x63d7('0x23')][_0x63d7('0x53')]()),_0x107d29);return respondWithRpcPromise(_0x63d7('0x45'),_0x63d7('0x19'),{'module':'chan_sip.so'});}})[_0x63d7('0x10')](handleError(_0x34e4c1,null));}; \ No newline at end of file +var _0xe75f=['util','path','lodash','../../components/parsers/qs','../../config/logger','jayson/promise','client','http','request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','status','undefined','limit','count','offset','set','json','destroy','end','sendStatus','stack','name','index','map','Network','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','params','length','find','create','body','STUN','readFileSync','join','server/files/templates/stun_multiple.ejs','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','toUpperCase','TURN','root','server/files/templates/turn_multiple.ejs','utf8','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','update','findAll'];(function(_0x41c81f,_0x2b557e){var _0xf9b821=function(_0x30449d){while(--_0x30449d){_0x41c81f['push'](_0x41c81f['shift']());}};_0xf9b821(++_0x2b557e);}(_0xe75f,0x150));var _0xfe75=function(_0x1a7947,_0x55e010){_0x1a7947=_0x1a7947-0x0;var _0x43c322=_0xe75f[_0x1a7947];return _0x43c322;};'use strict';var util=require(_0xfe75('0x0'));var path=require(_0xfe75('0x1'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xfe75('0x2'));var qs=require(_0xfe75('0x3'));var logger=require(_0xfe75('0x4'))('api');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var jayson=require(_0xfe75('0x5'));var client=jayson[_0xfe75('0x6')][_0xfe75('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4cfa10,_0x102787,_0x4f3974,_0x49b15b){return new Promise(function(_0x195d51,_0x565a19){var _0x14cabf=_0x49b15b||client;return _0x14cabf[_0xfe75('0x8')](_0x4cfa10,_0x4f3974)[_0xfe75('0x9')](function(_0x5d99f4){logger[_0xfe75('0xa')](_0xfe75('0xb'),_0x102787,_0xfe75('0xc'));logger[_0xfe75('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x102787,_0xfe75('0xc'),JSON[_0xfe75('0xe')](_0x5d99f4));if(_0x5d99f4['error']){if(_0x5d99f4[_0xfe75('0xf')][_0xfe75('0x10')]===0x1f4){logger[_0xfe75('0xf')](_0xfe75('0xb'),_0x102787,_0x5d99f4[_0xfe75('0xf')][_0xfe75('0x11')]);return _0x565a19(_0x5d99f4['error']['message']);}logger[_0xfe75('0xf')](_0xfe75('0xb'),_0x102787,_0x5d99f4[_0xfe75('0xf')][_0xfe75('0x11')]);return _0x195d51(_0x5d99f4[_0xfe75('0xf')][_0xfe75('0x11')]);}else{logger[_0xfe75('0xa')](_0xfe75('0xb'),_0x102787,_0xfe75('0xc'));_0x195d51(_0x5d99f4[_0xfe75('0x12')]['message']);}})['catch'](function(_0x82db20){logger['error']('Network,\x20%s,\x20%s',_0x102787,_0x82db20);_0x565a19(_0x82db20);});});}function respondWithResult(_0xe0a2d1,_0x5c4c9c){_0x5c4c9c=_0x5c4c9c||0xc8;return function(_0x1394e7){if(_0x1394e7){return _0xe0a2d1[_0xfe75('0x13')](_0x5c4c9c)['json'](_0x1394e7);}};}function respondWithFilteredResult(_0x5481ea,_0x4c10a1){return function(_0x2ab7b6){if(_0x2ab7b6){var _0x43c0bb=typeof _0x4c10a1['offset']===_0xfe75('0x14')&&typeof _0x4c10a1[_0xfe75('0x15')]==='undefined';var _0x3f4193=_0x2ab7b6[_0xfe75('0x16')];var _0x2d1259=_0x43c0bb?0x0:_0x4c10a1[_0xfe75('0x17')];var _0x52edb3=_0x43c0bb?_0x2ab7b6[_0xfe75('0x16')]:_0x4c10a1[_0xfe75('0x17')]+_0x4c10a1[_0xfe75('0x15')];var _0x5a7a23;if(_0x52edb3>=_0x3f4193){_0x52edb3=_0x3f4193;_0x5a7a23=0xc8;}else{_0x5a7a23=0xce;}_0x5481ea['status'](_0x5a7a23);return _0x5481ea[_0xfe75('0x18')]('Content-Range',_0x2d1259+'-'+_0x52edb3+'/'+_0x3f4193)[_0xfe75('0x19')](_0x2ab7b6);}return null;};}function saveUpdates(_0x2fba82){return function(_0x45ff3e){if(_0x45ff3e){return _0x45ff3e['update'](_0x2fba82)[_0xfe75('0x9')](function(_0x3cf00b){return _0x3cf00b;});}return null;};}function removeEntity(_0x12c62b){return function(_0x2d8ff1){if(_0x2d8ff1){return _0x2d8ff1[_0xfe75('0x1a')]()['then'](function(){_0x12c62b['status'](0xcc)[_0xfe75('0x1b')]();});}};}function handleEntityNotFound(_0x2d57a9){return function(_0x5a2390){if(!_0x5a2390){_0x2d57a9[_0xfe75('0x1c')](0x194);}return _0x5a2390;};}function handleError(_0x835bac,_0x1d0728){_0x1d0728=_0x1d0728||0x1f4;return function(_0x5b0e1b){logger['error'](_0x5b0e1b[_0xfe75('0x1d')]);if(_0x5b0e1b[_0xfe75('0x1e')]){delete _0x5b0e1b[_0xfe75('0x1e')];}_0x835bac[_0xfe75('0x13')](_0x1d0728)['send'](_0x5b0e1b);};}exports[_0xfe75('0x1f')]=function(_0x3c31f2,_0x9963d3){var _0x4bd159={},_0x4be9c4={},_0x15d5fb={'count':0x0,'rows':[]};var _0x275da0=_[_0xfe75('0x20')](db[_0xfe75('0x21')][_0xfe75('0x22')],function(_0x343fd0){return{'name':_0x343fd0[_0xfe75('0x23')],'type':_0x343fd0[_0xfe75('0x24')][_0xfe75('0x25')]};});_0x4be9c4[_0xfe75('0x26')]=_[_0xfe75('0x20')](_0x275da0,_0xfe75('0x1e'));_0x4be9c4['query']=_['keys'](_0x3c31f2[_0xfe75('0x27')]);_0x4be9c4[_0xfe75('0x28')]=_[_0xfe75('0x29')](_0x4be9c4[_0xfe75('0x26')],_0x4be9c4[_0xfe75('0x27')]);_0x4bd159[_0xfe75('0x2a')]=_[_0xfe75('0x29')](_0x4be9c4[_0xfe75('0x26')],qs[_0xfe75('0x2b')](_0x3c31f2[_0xfe75('0x27')]['fields']));_0x4bd159[_0xfe75('0x2a')]=_0x4bd159[_0xfe75('0x2a')]['length']?_0x4bd159[_0xfe75('0x2a')]:_0x4be9c4['model'];if(!_0x3c31f2[_0xfe75('0x27')][_0xfe75('0x2c')](_0xfe75('0x2d'))){_0x4bd159[_0xfe75('0x15')]=qs[_0xfe75('0x15')](_0x3c31f2['query'][_0xfe75('0x15')]);_0x4bd159[_0xfe75('0x17')]=qs[_0xfe75('0x17')](_0x3c31f2[_0xfe75('0x27')][_0xfe75('0x17')]);}_0x4bd159['order']=qs['sort'](_0x3c31f2[_0xfe75('0x27')][_0xfe75('0x2e')]);_0x4bd159[_0xfe75('0x2f')]=qs['filters'](_[_0xfe75('0x30')](_0x3c31f2[_0xfe75('0x27')],_0x4be9c4[_0xfe75('0x28')]),_0x275da0);if(_0x3c31f2['query'][_0xfe75('0x31')]){_0x4bd159[_0xfe75('0x2f')]=_[_0xfe75('0x32')](_0x4bd159['where'],{'$or':_[_0xfe75('0x20')](_0x275da0,function(_0x5d0052){if(_0x5d0052[_0xfe75('0x24')]!==_0xfe75('0x33')){var _0x200762={};_0x200762[_0x5d0052[_0xfe75('0x1e')]]={'$like':'%'+_0x3c31f2[_0xfe75('0x27')][_0xfe75('0x31')]+'%'};return _0x200762;}})});}_0x4bd159=_['merge']({},_0x4bd159,_0x3c31f2[_0xfe75('0x34')]);var _0x544aae={'where':_0x4bd159[_0xfe75('0x2f')]};return db[_0xfe75('0x21')][_0xfe75('0x16')](_0x544aae)[_0xfe75('0x9')](function(_0x59e6fa){_0x15d5fb['count']=_0x59e6fa;if(_0x3c31f2[_0xfe75('0x27')][_0xfe75('0x35')]){_0x4bd159[_0xfe75('0x36')]=[{'all':!![]}];}return db['Network']['findAll'](_0x4bd159);})[_0xfe75('0x9')](function(_0x272307){_0x15d5fb[_0xfe75('0x37')]=_0x272307;return _0x15d5fb;})[_0xfe75('0x9')](respondWithFilteredResult(_0x9963d3,_0x4bd159))[_0xfe75('0x38')](handleError(_0x9963d3,null));};exports['show']=function(_0xe33762,_0xd5afef){var _0x531bcc={'raw':!![],'where':{'id':_0xe33762[_0xfe75('0x39')]['id']}},_0xd2a9aa={};_0xd2a9aa['model']=_['keys'](db[_0xfe75('0x21')]['rawAttributes']);_0xd2a9aa['query']=_['keys'](_0xe33762[_0xfe75('0x27')]);_0xd2a9aa[_0xfe75('0x28')]=_[_0xfe75('0x29')](_0xd2a9aa[_0xfe75('0x26')],_0xd2a9aa['query']);_0x531bcc[_0xfe75('0x2a')]=_[_0xfe75('0x29')](_0xd2a9aa['model'],qs[_0xfe75('0x2b')](_0xe33762['query'][_0xfe75('0x2b')]));_0x531bcc[_0xfe75('0x2a')]=_0x531bcc['attributes'][_0xfe75('0x3a')]?_0x531bcc[_0xfe75('0x2a')]:_0xd2a9aa[_0xfe75('0x26')];if(_0xe33762['query'][_0xfe75('0x35')]){_0x531bcc[_0xfe75('0x36')]=[{'all':!![]}];}_0x531bcc=_[_0xfe75('0x32')]({},_0x531bcc,_0xe33762['options']);return db['Network'][_0xfe75('0x3b')](_0x531bcc)['then'](handleEntityNotFound(_0xd5afef,null))[_0xfe75('0x9')](respondWithResult(_0xd5afef,null))[_0xfe75('0x38')](handleError(_0xd5afef,null));};exports[_0xfe75('0x3c')]=function(_0x3b9fc5,_0x51b0d0){var _0x1c0e0e;return db[_0xfe75('0x21')]['create'](_0x3b9fc5[_0xfe75('0x3d')],{'raw':!![]})[_0xfe75('0x9')](function(_0x49721c){_0x1c0e0e=_0x49721c;return db[_0xfe75('0x21')]['findAll']({'where':{'type':_0x3b9fc5['body'][_0xfe75('0x24')]},'raw':!![]});})[_0xfe75('0x9')](function(_0x7d0687){if(_0x1c0e0e['type']['toUpperCase']()==_0xfe75('0x3e')){var _0x53fda3=fs[_0xfe75('0x3f')](path[_0xfe75('0x40')](config['root'],_0xfe75('0x41')),'utf8');var _0x1db30b=ejs[_0xfe75('0x42')](_0x53fda3,{'networks':_0x7d0687||[]});fs[_0xfe75('0x43')](_0xfe75('0x44'),_0x1db30b);return respondWithRpcPromise(_0xfe75('0x45'),'create',{'module':_0xfe75('0x46')});}else if(_0x1c0e0e[_0xfe75('0x24')][_0xfe75('0x47')]()==_0xfe75('0x48')){var _0x229919=fs[_0xfe75('0x3f')](path[_0xfe75('0x40')](config[_0xfe75('0x49')],_0xfe75('0x4a')),_0xfe75('0x4b'));var _0x4a330b=ejs[_0xfe75('0x42')](_0x229919,{'networks':_0x7d0687||[]});fs[_0xfe75('0x43')](_0xfe75('0x4c'),_0x4a330b);return respondWithRpcPromise(_0xfe75('0x45'),_0xfe75('0x3c'),{'module':'res_stun_monitor.so'});}else{var _0x3c79cb=fs[_0xfe75('0x3f')](path['join'](config[_0xfe75('0x49')],_0xfe75('0x4d')),_0xfe75('0x4b'));var _0x138d66=ejs[_0xfe75('0x42')](_0x3c79cb,{'networks':_0x7d0687||[]});fs[_0xfe75('0x43')](util[_0xfe75('0x4e')](_0xfe75('0x4f'),_0x3b9fc5[_0xfe75('0x3d')][_0xfe75('0x24')][_0xfe75('0x50')]()),_0x138d66);return respondWithRpcPromise(_0xfe75('0x45'),_0xfe75('0x3c'),{'module':_0xfe75('0x51')});}})['then'](function(){return _0x1c0e0e;})[_0xfe75('0x9')](respondWithResult(_0x51b0d0,0xc9))[_0xfe75('0x38')](handleError(_0x51b0d0,null));};exports[_0xfe75('0x52')]=function(_0xcb516a,_0x50e5ed){var _0x40381f;return db['Network'][_0xfe75('0x3b')]({'where':{'id':_0xcb516a[_0xfe75('0x39')]['id']}})[_0xfe75('0x9')](handleEntityNotFound(_0x50e5ed,null))[_0xfe75('0x9')](saveUpdates(_0xcb516a['body'],null))['then'](function(_0x5cae5c){if(_0x5cae5c){_0x40381f=_0x5cae5c;return db[_0xfe75('0x21')][_0xfe75('0x53')]({'where':{'type':_0x40381f[_0xfe75('0x24')]},'raw':!![]});}return null;})[_0xfe75('0x9')](function(_0x2800ec){if(_0x40381f[_0xfe75('0x24')][_0xfe75('0x47')]()=='STUN'){var _0x221fb2=fs[_0xfe75('0x3f')](path[_0xfe75('0x40')](config[_0xfe75('0x49')],_0xfe75('0x41')),_0xfe75('0x4b'));var _0x219769=ejs[_0xfe75('0x42')](_0x221fb2,{'networks':_0x2800ec||[]});fs[_0xfe75('0x43')](_0xfe75('0x44'),_0x219769);return respondWithRpcPromise('Reload','update',{'module':_0xfe75('0x46')});}else if(_0x40381f[_0xfe75('0x24')][_0xfe75('0x47')]()==_0xfe75('0x48')){var _0x1d4538=fs[_0xfe75('0x3f')](path[_0xfe75('0x40')](config[_0xfe75('0x49')],_0xfe75('0x4a')),'utf8');var _0x4d0d1f=ejs[_0xfe75('0x42')](_0x1d4538,{'networks':_0x2800ec||[]});fs[_0xfe75('0x43')]('/etc/asterisk/turn_xcally.conf',_0x4d0d1f);return respondWithRpcPromise(_0xfe75('0x45'),_0xfe75('0x52'),{'module':_0xfe75('0x46')});}else{var _0x2fd899=fs[_0xfe75('0x3f')](path[_0xfe75('0x40')](config['root'],_0xfe75('0x4d')),'utf8');var _0x35f018=ejs['render'](_0x2fd899,{'networks':_0x2800ec||[]});fs[_0xfe75('0x43')](util[_0xfe75('0x4e')]('/etc/asterisk/sip_xcally_%s.conf',_0xcb516a[_0xfe75('0x3d')][_0xfe75('0x24')][_0xfe75('0x50')]()),_0x35f018);return respondWithRpcPromise(_0xfe75('0x45'),_0xfe75('0x52'),{'module':_0xfe75('0x51')});}})[_0xfe75('0x9')](function(_0x3bb671){if(_0x3bb671){return _0x40381f;}return null;})[_0xfe75('0x9')](respondWithResult(_0x50e5ed,null))['catch'](handleError(_0x50e5ed,null));};exports[_0xfe75('0x1a')]=function(_0x4e9306,_0x31fb63){var _0x322bc2;return db[_0xfe75('0x21')][_0xfe75('0x3b')]({'where':{'id':_0x4e9306[_0xfe75('0x39')]['id']}})['then'](function(_0x292b90){_0x322bc2=_0x292b90;return _0x292b90;})[_0xfe75('0x9')](handleEntityNotFound(_0x31fb63,null))['then'](removeEntity(_0x31fb63,null))['then'](function(){if(_0x322bc2){return db[_0xfe75('0x21')]['findAll']({'where':{'type':_0x322bc2[_0xfe75('0x24')]},'raw':!![]});}})[_0xfe75('0x9')](function(_0x2c3244){if(_0x322bc2['type']['toUpperCase']()=='STUN'){var _0xaec9f3=fs[_0xfe75('0x3f')](path[_0xfe75('0x40')](config['root'],'server/files/templates/stun_multiple.ejs'),_0xfe75('0x4b'));var _0x1c35cc=ejs[_0xfe75('0x42')](_0xaec9f3,{'networks':_0x2c3244||[]});fs[_0xfe75('0x43')](_0xfe75('0x44'),_0x1c35cc);return respondWithRpcPromise(_0xfe75('0x45'),'destroy',{'module':'res_stun_monitor.so'});}else if(_0x322bc2[_0xfe75('0x24')][_0xfe75('0x47')]()==_0xfe75('0x48')){var _0x33e66f=fs[_0xfe75('0x3f')](path[_0xfe75('0x40')](config[_0xfe75('0x49')],_0xfe75('0x4a')),_0xfe75('0x4b'));var _0x1e5f3b=ejs[_0xfe75('0x42')](_0x33e66f,{'networks':_0x2c3244||[]});fs[_0xfe75('0x43')](_0xfe75('0x4c'),_0x1e5f3b);return respondWithRpcPromise(_0xfe75('0x45'),_0xfe75('0x1a'),{'module':_0xfe75('0x46')});}else{var _0x50e837=fs['readFileSync'](path[_0xfe75('0x40')](config[_0xfe75('0x49')],_0xfe75('0x4d')),_0xfe75('0x4b'));var _0x5713ef=ejs['render'](_0x50e837,{'networks':_0x2c3244||[]});fs[_0xfe75('0x43')](util[_0xfe75('0x4e')]('/etc/asterisk/sip_xcally_%s.conf',_0x322bc2[_0xfe75('0x24')][_0xfe75('0x50')]()),_0x5713ef);return respondWithRpcPromise(_0xfe75('0x45'),_0xfe75('0x1a'),{'module':_0xfe75('0x51')});}})[_0xfe75('0x38')](handleError(_0x31fb63,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index a2ee171..71a7e13 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 _0x6b24=['api','moment','rimraf','./network.attributes','Network','network','util','../../config/logger'];(function(_0x4c15f1,_0x2f056c){var _0xc81295=function(_0x1f1eae){while(--_0x1f1eae){_0x4c15f1['push'](_0x4c15f1['shift']());}};_0xc81295(++_0x2f056c);}(_0x6b24,0x1ce));var _0x46b2=function(_0x254d9f,_0x54ddb5){_0x254d9f=_0x254d9f-0x0;var _0x1eedb9=_0x6b24[_0x254d9f];return _0x1eedb9;};'use strict';var _=require('lodash');var util=require(_0x46b2('0x0'));var logger=require(_0x46b2('0x1'))(_0x46b2('0x2'));var moment=require(_0x46b2('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x46b2('0x4'));var config=require('../../config/environment');var attributes=require(_0x46b2('0x5'));module['exports']=function(_0x2e5227,_0x5598df){return _0x2e5227['define'](_0x46b2('0x6'),attributes,{'tableName':_0x46b2('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7980=['Network','network','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./network.attributes','define'];(function(_0x72378,_0x6a3c3a){var _0x124932=function(_0x23b746){while(--_0x23b746){_0x72378['push'](_0x72378['shift']());}};_0x124932(++_0x6a3c3a);}(_0x7980,0xab));var _0x0798=function(_0xa4cf49,_0x3b1d1e){_0xa4cf49=_0xa4cf49-0x0;var _0x2d1920=_0x7980[_0xa4cf49];return _0x2d1920;};'use strict';var _=require(_0x0798('0x0'));var util=require(_0x0798('0x1'));var logger=require(_0x0798('0x2'))(_0x0798('0x3'));var moment=require(_0x0798('0x4'));var BPromise=require('bluebird');var rp=require(_0x0798('0x5'));var fs=require('fs');var path=require(_0x0798('0x6'));var rimraf=require(_0x0798('0x7'));var config=require(_0x0798('0x8'));var attributes=require(_0x0798('0x9'));module['exports']=function(_0x22a0f0,_0x557325){return _0x22a0f0[_0x0798('0xa')](_0x0798('0xb'),attributes,{'tableName':_0x0798('0xc'),'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 843a8d7..e876c98 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(_0x20f7d9,_0x4d424e){var _0x3ad64b=function(_0x315bb9){while(--_0x315bb9){_0x20f7d9['push'](_0x20f7d9['shift']());}};_0x3ad64b(++_0x4d424e);}(_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 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(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7a54,0x106));var _0x47a5=function(_0x297526,_0xadb178){_0x297526=_0x297526-0x0;var _0x198c88=_0x7a54[_0x297526];return _0x198c88;};'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 42f4c0f..cf280c6 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 _0x8f8e=['isAuthenticated','index','/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','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get'];(function(_0x3c5e68,_0x1f14c7){var _0x296855=function(_0x31ee81){while(--_0x31ee81){_0x3c5e68['push'](_0x3c5e68['shift']());}};_0x296855(++_0x1f14c7);}(_0x8f8e,0x11d));var _0xe8f8=function(_0x5b5eb4,_0x117c87){_0x5b5eb4=_0x5b5eb4-0x0;var _0x42af53=_0x8f8e[_0x5b5eb4];return _0x42af53;};'use strict';var multer=require(_0xe8f8('0x0'));var util=require('util');var path=require(_0xe8f8('0x1'));var timeout=require(_0xe8f8('0x2'));var express=require(_0xe8f8('0x3'));var router=express[_0xe8f8('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xe8f8('0x5'));var config=require(_0xe8f8('0x6'));var controller=require(_0xe8f8('0x7'));router[_0xe8f8('0x8')]('/',auth[_0xe8f8('0x9')](),controller[_0xe8f8('0xa')]);router[_0xe8f8('0x8')](_0xe8f8('0xb'),auth[_0xe8f8('0x9')](),controller[_0xe8f8('0xc')]);router[_0xe8f8('0x8')](_0xe8f8('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xe8f8('0x8')](_0xe8f8('0xe'),auth[_0xe8f8('0x9')](),controller[_0xe8f8('0xf')]);router['get'](_0xe8f8('0x10'),auth[_0xe8f8('0x9')](),controller[_0xe8f8('0x11')]);router[_0xe8f8('0x8')](_0xe8f8('0x12'),auth[_0xe8f8('0x9')](),controller[_0xe8f8('0x13')]);router[_0xe8f8('0x8')](_0xe8f8('0x14'),auth['isAuthenticated'](),controller[_0xe8f8('0x15')]);router[_0xe8f8('0x8')](_0xe8f8('0x16'),auth[_0xe8f8('0x9')](),controller[_0xe8f8('0x17')]);router[_0xe8f8('0x18')]('/',auth[_0xe8f8('0x9')](),controller[_0xe8f8('0x19')]);router[_0xe8f8('0x18')](_0xe8f8('0xe'),auth[_0xe8f8('0x9')](),controller[_0xe8f8('0x1a')]);router[_0xe8f8('0x18')](_0xe8f8('0x10'),auth[_0xe8f8('0x9')](),controller[_0xe8f8('0x1b')]);router['post'](_0xe8f8('0x1c'),controller[_0xe8f8('0x1d')]);router[_0xe8f8('0x18')]('/:id/applications',auth[_0xe8f8('0x9')](),controller[_0xe8f8('0x1e')]);router[_0xe8f8('0x18')](_0xe8f8('0x16'),auth['isAuthenticated'](),controller[_0xe8f8('0x1f')]);router[_0xe8f8('0x18')](_0xe8f8('0x20'),auth[_0xe8f8('0x9')](),controller[_0xe8f8('0x21')]);router[_0xe8f8('0x22')](_0xe8f8('0xd'),auth[_0xe8f8('0x9')](),controller[_0xe8f8('0x23')]);router[_0xe8f8('0x24')](_0xe8f8('0xd'),auth[_0xe8f8('0x9')](),controller[_0xe8f8('0x25')]);router[_0xe8f8('0x24')]('/:id/dispositions',auth[_0xe8f8('0x9')](),controller[_0xe8f8('0x26')]);router[_0xe8f8('0x24')](_0xe8f8('0x10'),auth['isAuthenticated'](),controller[_0xe8f8('0x27')]);router[_0xe8f8('0x24')](_0xe8f8('0x16'),auth[_0xe8f8('0x9')](),controller[_0xe8f8('0x28')]);module[_0xe8f8('0x29')]=router; \ No newline at end of file +var _0x0eda=['/:id/canned_answers','addAnswer','/:id/notify','notify','/:id/applications','addApplications','/:id/send','send','put','update','destroy','delete','removeDispositions','exports','multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getAnswers','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','post','addDisposition'];(function(_0x1fb31d,_0x2f1320){var _0x6b1cea=function(_0x4ab9a6){while(--_0x4ab9a6){_0x1fb31d['push'](_0x1fb31d['shift']());}};_0x6b1cea(++_0x2f1320);}(_0x0eda,0x164));var _0xa0ed=function(_0x14b15c,_0x10b2f2){_0x14b15c=_0x14b15c-0x0;var _0x401a20=_0x0eda[_0x14b15c];return _0x401a20;};'use strict';var multer=require(_0xa0ed('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xa0ed('0x1'));var express=require(_0xa0ed('0x2'));var router=express[_0xa0ed('0x3')]();var fs_extra=require(_0xa0ed('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xa0ed('0x5'));var config=require(_0xa0ed('0x6'));var controller=require(_0xa0ed('0x7'));router[_0xa0ed('0x8')]('/',auth[_0xa0ed('0x9')](),controller[_0xa0ed('0xa')]);router[_0xa0ed('0x8')](_0xa0ed('0xb'),auth[_0xa0ed('0x9')](),controller[_0xa0ed('0xc')]);router[_0xa0ed('0x8')](_0xa0ed('0xd'),auth[_0xa0ed('0x9')](),controller[_0xa0ed('0xe')]);router[_0xa0ed('0x8')](_0xa0ed('0xf'),auth[_0xa0ed('0x9')](),controller['getDispositions']);router['get']('/:id/canned_answers',auth[_0xa0ed('0x9')](),controller[_0xa0ed('0x10')]);router[_0xa0ed('0x8')]('/:id/applications',auth[_0xa0ed('0x9')](),controller[_0xa0ed('0x11')]);router[_0xa0ed('0x8')](_0xa0ed('0x12'),auth[_0xa0ed('0x9')](),controller[_0xa0ed('0x13')]);router['get'](_0xa0ed('0x14'),auth[_0xa0ed('0x9')](),controller[_0xa0ed('0x15')]);router[_0xa0ed('0x16')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/dispositions',auth[_0xa0ed('0x9')](),controller[_0xa0ed('0x17')]);router[_0xa0ed('0x16')](_0xa0ed('0x18'),auth['isAuthenticated'](),controller[_0xa0ed('0x19')]);router[_0xa0ed('0x16')](_0xa0ed('0x1a'),controller[_0xa0ed('0x1b')]);router[_0xa0ed('0x16')](_0xa0ed('0x1c'),auth[_0xa0ed('0x9')](),controller[_0xa0ed('0x1d')]);router[_0xa0ed('0x16')](_0xa0ed('0x14'),auth['isAuthenticated'](),controller['addAgents']);router[_0xa0ed('0x16')](_0xa0ed('0x1e'),auth[_0xa0ed('0x9')](),controller[_0xa0ed('0x1f')]);router[_0xa0ed('0x20')](_0xa0ed('0xd'),auth[_0xa0ed('0x9')](),controller[_0xa0ed('0x21')]);router['delete'](_0xa0ed('0xd'),auth[_0xa0ed('0x9')](),controller[_0xa0ed('0x22')]);router[_0xa0ed('0x23')]('/:id/dispositions',auth[_0xa0ed('0x9')](),controller[_0xa0ed('0x24')]);router[_0xa0ed('0x23')](_0xa0ed('0x18'),auth[_0xa0ed('0x9')](),controller['removeAnswers']);router[_0xa0ed('0x23')]('/:id/users',auth[_0xa0ed('0x9')](),controller['removeAgents']);module[_0xa0ed('0x25')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index e6dc5f8..a3fe8d7 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 _0xa71a=['BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','name','STRING','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x550cc6,_0x218eac){var _0x2b32f8=function(_0x531106){while(--_0x531106){_0x550cc6['push'](_0x550cc6['shift']());}};_0x2b32f8(++_0x218eac);}(_0xa71a,0x96));var _0xaa71=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xa71a[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xaa71('0x0'),'allowNull':![]},'description':{'type':Sequelize[_0xaa71('0x1')]},'token':{'type':Sequelize[_0xaa71('0x1')],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xaa71('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xaa71('0x2')],'defaultValue':function(){return _0xaa71('0x3');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xaa71('0x4')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xaa71('0x1')]},'queueTransfer':{'type':Sequelize[_0xaa71('0x4')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xaa71('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xaa71('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xaa71('0x6')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xaa71('0x7'),'set':function(_0x5b9b58){if(!_0x5b9b58)this[_0xaa71('0x8')](_0xaa71('0x9'),null);this['setDataValue'](_0xaa71('0xa'),_0x5b9b58);}}}; \ No newline at end of file +var _0x0eba=['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','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING','name'];(function(_0x8fdc79,_0x1b72b5){var _0x5c1112=function(_0x1e90c5){while(--_0x1e90c5){_0x8fdc79['push'](_0x8fdc79['shift']());}};_0x5c1112(++_0x1b72b5);}(_0x0eba,0x11b));var _0xa0eb=function(_0x29a71c,_0x2bcef7){_0x29a71c=_0x29a71c-0x0;var _0x255eda=_0x0eba[_0x29a71c];return _0x255eda;};'use strict';var Sequelize=require(_0xa0eb('0x0'));var rs=require(_0xa0eb('0x1'));module[_0xa0eb('0x2')]={'name':{'type':Sequelize[_0xa0eb('0x3')],'unique':_0xa0eb('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0xa0eb('0x3')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xa0eb('0x5')]();}},'replyUri':{'type':Sequelize[_0xa0eb('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xa0eb('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xa0eb('0x6');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xa0eb('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xa0eb('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xa0eb('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa0eb('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xa0eb('0x9')},'mandatoryDisposition':{'type':Sequelize[_0xa0eb('0x7')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x94770c){if(!_0x94770c)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0xa0eb('0xa')](_0xa0eb('0xb'),_0x94770c);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 5782a8e..606e5e1 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 _0xefe5=['account','list','List','applications','orderBy','priority','asc','lastName','threadId','OpenchannelInteraction','spread','contact','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','notify','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','OpenchannelApplication','findAndCountAll','getApplications','Contact','User','Owner','fullname','internal','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','out','Messages','dataValues','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','OpenchannelAccounts','UserProfileResource','name','send','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','show','params','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','OpenchannelAccountId','Disposition','getDispositions','rawAttributes','options','removeDispositions','ids','addAnswer','CannedAnswer','findOne','removeAnswers','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','ListId','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','Applications'];(function(_0x18248f,_0x34f489){var _0x51543c=function(_0x270421){while(--_0x270421){_0x18248f['push'](_0x18248f['shift']());}};_0x51543c(++_0x34f489);}(_0xefe5,0xf6));var _0x5efe=function(_0x4aefc7,_0x582812){_0x4aefc7=_0x4aefc7-0x0;var _0x4d0264=_0xefe5[_0x4aefc7];return _0x4d0264;};'use strict';var emlformat=require(_0x5efe('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5efe('0x1'));var jsonpatch=require(_0x5efe('0x2'));var rp=require('request-promise');var moment=require(_0x5efe('0x3'));var BPromise=require(_0x5efe('0x4'));var Mustache=require('mustache');var util=require(_0x5efe('0x5'));var path=require('path');var sox=require(_0x5efe('0x6'));var csv=require(_0x5efe('0x7'));var ejs=require(_0x5efe('0x8'));var fs=require('fs');var fs_extra=require(_0x5efe('0x9'));var _=require(_0x5efe('0xa'));var squel=require('squel');var crypto=require(_0x5efe('0xb'));var jsforce=require(_0x5efe('0xc'));var deskjs=require(_0x5efe('0xd'));var toCsv=require(_0x5efe('0x7'));var querystring=require(_0x5efe('0xe'));var Papa=require(_0x5efe('0xf'));var Redis=require(_0x5efe('0x10'));var authService=require(_0x5efe('0x11'));var qs=require(_0x5efe('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5efe('0x13'));var logger=require(_0x5efe('0x14'))(_0x5efe('0x15'));var utils=require(_0x5efe('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x5efe('0x17')]=_[_0x5efe('0x18')](config[_0x5efe('0x17')],{'host':_0x5efe('0x19'),'port':0x18eb});var socket=require(_0x5efe('0x1a'))(new Redis(config[_0x5efe('0x17')]));require(_0x5efe('0x1b'))[_0x5efe('0x1c')](socket);var jayson=require(_0x5efe('0x1d'));var client=jayson[_0x5efe('0x1e')][_0x5efe('0x1f')]({'port':0x232c});var client9002=jayson['client'][_0x5efe('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0xe69cfa,_0x649b61,_0x46644a,_0x5b49b4){return new BPromise(function(_0xf1c770,_0x222af7){var _0x502784=_0x5b49b4||client;return _0x502784[_0x5efe('0x20')](_0xe69cfa,_0x46644a)[_0x5efe('0x21')](function(_0x4ef776){logger[_0x5efe('0x22')](_0x5efe('0x23'),_0x649b61,'request\x20sent');logger['debug'](_0x5efe('0x24'),_0x649b61,_0x5efe('0x25'),JSON[_0x5efe('0x26')](_0x4ef776));if(_0x4ef776[_0x5efe('0x27')]){if(_0x4ef776['error']['code']===0x1f4){logger[_0x5efe('0x27')](_0x5efe('0x23'),_0x649b61,_0x4ef776[_0x5efe('0x27')][_0x5efe('0x28')]);return _0x222af7(_0x4ef776[_0x5efe('0x27')]['message']);}logger[_0x5efe('0x27')]('OpenchannelAccount,\x20%s,\x20%s',_0x649b61,_0x4ef776['error'][_0x5efe('0x28')]);return _0xf1c770(_0x4ef776['error'][_0x5efe('0x28')]);}else{logger[_0x5efe('0x22')](_0x5efe('0x23'),_0x649b61,'request\x20sent');_0xf1c770(_0x4ef776[_0x5efe('0x29')]['message']);}})[_0x5efe('0x2a')](function(_0x1a2754){logger[_0x5efe('0x27')](_0x5efe('0x23'),_0x649b61,_0x1a2754);_0x222af7(_0x1a2754);});});}function respondWithStatusCode(_0x38b264,_0x377c9a){_0x377c9a=_0x377c9a||0xcc;return function(_0x442c34){if(_0x442c34){return _0x38b264[_0x5efe('0x2b')](_0x377c9a);}return _0x38b264['status'](_0x377c9a)[_0x5efe('0x2c')]();};}function respondWithResult(_0x29e78d,_0x56407f){_0x56407f=_0x56407f||0xc8;return function(_0x2bb0c1){if(_0x2bb0c1){return _0x29e78d[_0x5efe('0x2d')](_0x56407f)[_0x5efe('0x2e')](_0x2bb0c1);}};}function respondWithFilteredResult(_0x53ea04,_0x14b530){return function(_0x4aeac7){if(_0x4aeac7){var _0x23e796=typeof _0x14b530['offset']===_0x5efe('0x2f')&&typeof _0x14b530[_0x5efe('0x30')]===_0x5efe('0x2f');var _0x440c26=_0x4aeac7[_0x5efe('0x31')];var _0x4fcabf=_0x23e796?0x0:_0x14b530['offset'];var _0x41e113=_0x23e796?_0x4aeac7['count']:_0x14b530[_0x5efe('0x32')]+_0x14b530['limit'];var _0xfbda43;if(_0x41e113>=_0x440c26){_0x41e113=_0x440c26;_0xfbda43=0xc8;}else{_0xfbda43=0xce;}_0x53ea04[_0x5efe('0x2d')](_0xfbda43);return _0x53ea04[_0x5efe('0x33')](_0x5efe('0x34'),_0x4fcabf+'-'+_0x41e113+'/'+_0x440c26)[_0x5efe('0x2e')](_0x4aeac7);}return null;};}function patchUpdates(_0x1157be){return function(_0x5099a5){try{jsonpatch[_0x5efe('0x35')](_0x5099a5,_0x1157be,!![]);}catch(_0x5f0690){return BPromise[_0x5efe('0x36')](_0x5f0690);}return _0x5099a5[_0x5efe('0x37')]();};}function saveUpdates(_0x4cb973,_0x407dd5){return function(_0x292e1d){if(_0x292e1d){return _0x292e1d[_0x5efe('0x38')](_0x4cb973)['then'](function(_0x5b9484){return _0x5b9484;});}return null;};}function removeEntity(_0x3aea2b,_0xda61a8){return function(_0x51082b){if(_0x51082b){return _0x51082b[_0x5efe('0x39')]()[_0x5efe('0x21')](function(){var _0x48baa2=_0x51082b['get']({'plain':!![]});var _0x4255ff=_0x5efe('0x3a');return db[_0x5efe('0x3b')]['destroy']({'where':{'type':_0x4255ff,'resourceId':_0x48baa2['id']}})[_0x5efe('0x21')](function(){return _0x51082b;});})['then'](function(){_0x3aea2b['status'](0xcc)[_0x5efe('0x2c')]();});}};}function handleEntityNotFound(_0x1d17ef,_0x4cd895){return function(_0x13fa56){if(!_0x13fa56){_0x1d17ef[_0x5efe('0x2b')](0x194);}return _0x13fa56;};}function handleError(_0xb70f2f,_0x1d95f3){_0x1d95f3=_0x1d95f3||0x1f4;return function(_0x1a6fdb){logger['error'](_0x1a6fdb['stack']);if(_0x1a6fdb[_0x5efe('0x3c')]){delete _0x1a6fdb[_0x5efe('0x3c')];}_0xb70f2f[_0x5efe('0x2d')](_0x1d95f3)[_0x5efe('0x3d')](_0x1a6fdb);};}exports[_0x5efe('0x3e')]=function(_0x4a722b,_0x16e2cb){var _0x4bf305={'include':[{'model':db[_0x5efe('0x3f')],'as':_0x5efe('0x40')}]},_0x307b34={},_0x35e1b6={'count':0x0,'rows':[]};var _0x5f5d03=_[_0x5efe('0x41')](db[_0x5efe('0x42')]['rawAttributes'],function(_0x4880e2){return{'name':_0x4880e2[_0x5efe('0x43')],'type':_0x4880e2[_0x5efe('0x44')][_0x5efe('0x45')]};});_0x307b34[_0x5efe('0x46')]=_['map'](_0x5f5d03,_0x5efe('0x3c'));_0x307b34[_0x5efe('0x47')]=_[_0x5efe('0x48')](_0x4a722b[_0x5efe('0x47')]);_0x307b34[_0x5efe('0x49')]=_[_0x5efe('0x4a')](_0x307b34[_0x5efe('0x46')],_0x307b34[_0x5efe('0x47')]);_0x4bf305[_0x5efe('0x4b')]=_[_0x5efe('0x4a')](_0x307b34[_0x5efe('0x46')],qs[_0x5efe('0x4c')](_0x4a722b[_0x5efe('0x47')][_0x5efe('0x4c')]));_0x4bf305['attributes']=_0x4bf305[_0x5efe('0x4b')]['length']?_0x4bf305['attributes']:_0x307b34['model'];if(!_0x4a722b[_0x5efe('0x47')][_0x5efe('0x4d')](_0x5efe('0x4e'))){_0x4bf305[_0x5efe('0x30')]=qs[_0x5efe('0x30')](_0x4a722b[_0x5efe('0x47')]['limit']);_0x4bf305[_0x5efe('0x32')]=qs[_0x5efe('0x32')](_0x4a722b[_0x5efe('0x47')][_0x5efe('0x32')]);}_0x4bf305[_0x5efe('0x4f')]=qs[_0x5efe('0x50')](_0x4a722b[_0x5efe('0x47')]['sort']);_0x4bf305[_0x5efe('0x51')]=qs[_0x5efe('0x49')](_[_0x5efe('0x52')](_0x4a722b[_0x5efe('0x47')],_0x307b34[_0x5efe('0x49')]),_0x5f5d03);if(_0x4a722b[_0x5efe('0x47')][_0x5efe('0x53')]){_0x4bf305[_0x5efe('0x51')]=_['merge'](_0x4bf305[_0x5efe('0x51')],{'$or':_['map'](_0x5f5d03,function(_0x5b5589){if(_0x5b5589[_0x5efe('0x44')]!=='VIRTUAL'){var _0x155819={};_0x155819[_0x5b5589[_0x5efe('0x3c')]]={'$like':'%'+_0x4a722b[_0x5efe('0x47')][_0x5efe('0x53')]+'%'};return _0x155819;}})});}_0x4bf305=_[_0x5efe('0x54')]({},_0x4bf305,_0x4a722b['options']);var _0x4675bf={'where':_0x4bf305[_0x5efe('0x51')]};return db[_0x5efe('0x42')][_0x5efe('0x31')](_0x4675bf)[_0x5efe('0x21')](function(_0x42c0db){_0x35e1b6['count']=_0x42c0db;if(_0x4a722b[_0x5efe('0x47')][_0x5efe('0x55')]){_0x4bf305[_0x5efe('0x56')]=[{'all':!![]}];}return db['OpenchannelAccount'][_0x5efe('0x57')](_0x4bf305);})[_0x5efe('0x21')](function(_0x4a296b){_0x35e1b6[_0x5efe('0x58')]=_0x4a296b;return _0x35e1b6;})[_0x5efe('0x21')](respondWithFilteredResult(_0x16e2cb,_0x4bf305))[_0x5efe('0x2a')](handleError(_0x16e2cb,null));};exports[_0x5efe('0x59')]=function(_0x55f04d,_0x149d31){var _0x5f3234={'raw':![],'where':{'id':_0x55f04d[_0x5efe('0x5a')]['id']},'include':[{'model':db[_0x5efe('0x3f')],'as':_0x5efe('0x40')}]},_0x22cb60={};_0x22cb60['model']=_[_0x5efe('0x48')](db['OpenchannelAccount']['rawAttributes']);_0x22cb60[_0x5efe('0x47')]=_[_0x5efe('0x48')](_0x55f04d[_0x5efe('0x47')]);_0x22cb60[_0x5efe('0x49')]=_['intersection'](_0x22cb60[_0x5efe('0x46')],_0x22cb60[_0x5efe('0x47')]);_0x5f3234['attributes']=_[_0x5efe('0x4a')](_0x22cb60[_0x5efe('0x46')],qs[_0x5efe('0x4c')](_0x55f04d[_0x5efe('0x47')]['fields']));_0x5f3234[_0x5efe('0x4b')]=_0x5f3234['attributes'][_0x5efe('0x5b')]?_0x5f3234[_0x5efe('0x4b')]:_0x22cb60[_0x5efe('0x46')];if(_0x55f04d[_0x5efe('0x47')][_0x5efe('0x55')]){_0x5f3234['include']=[{'all':!![]}];}_0x5f3234=_[_0x5efe('0x54')]({},_0x5f3234,_0x55f04d['options']);return db[_0x5efe('0x42')][_0x5efe('0x5c')](_0x5f3234)[_0x5efe('0x21')](handleEntityNotFound(_0x149d31,null))[_0x5efe('0x21')](respondWithResult(_0x149d31,null))[_0x5efe('0x2a')](handleError(_0x149d31,null));};exports[_0x5efe('0x5d')]=function(_0xcd1ce2,_0x1cc2b3){return db[_0x5efe('0x42')]['create'](_0xcd1ce2[_0x5efe('0x5e')],{})[_0x5efe('0x21')](function(_0x1a490c){var _0x57c600=_0xcd1ce2[_0x5efe('0x5f')]['get']({'plain':!![]});if(!_0x57c600)throw new Error(_0x5efe('0x60'));if(_0x57c600[_0x5efe('0x61')]===_0x5efe('0x5f')){var _0x2cd870=_0x1a490c[_0x5efe('0x62')]({'plain':!![]});var _0x2a4c85=_0x5efe('0x3a');return db['UserProfileSection'][_0x5efe('0x5c')]({'where':{'name':_0x2a4c85,'userProfileId':_0x57c600[_0x5efe('0x63')]},'raw':!![]})[_0x5efe('0x21')](function(_0x45f712){if(_0x45f712&&_0x45f712[_0x5efe('0x64')]===0x0){return db[_0x5efe('0x3b')][_0x5efe('0x5d')]({'name':_0x2cd870[_0x5efe('0x3c')],'resourceId':_0x2cd870['id'],'type':_0x45f712['name'],'sectionId':_0x45f712['id']},{})[_0x5efe('0x21')](function(){return _0x1a490c;});}else{return _0x1a490c;}})[_0x5efe('0x2a')](function(_0x1f60bd){logger['error'](_0x5efe('0x65'),_0x1f60bd);throw _0x1f60bd;});}return _0x1a490c;})[_0x5efe('0x21')](respondWithResult(_0x1cc2b3,0xc9))[_0x5efe('0x2a')](handleError(_0x1cc2b3,null));};exports['update']=function(_0x2f0416,_0x519403){if(_0x2f0416[_0x5efe('0x5e')]['id']){delete _0x2f0416[_0x5efe('0x5e')]['id'];}return db['OpenchannelAccount'][_0x5efe('0x5c')]({'where':{'id':_0x2f0416['params']['id']},'include':[{'model':db['Pause'],'as':_0x5efe('0x40')}]})['then'](handleEntityNotFound(_0x519403,null))[_0x5efe('0x21')](saveUpdates(_0x2f0416[_0x5efe('0x5e')],null))[_0x5efe('0x21')](respondWithResult(_0x519403,null))[_0x5efe('0x2a')](handleError(_0x519403,null));};exports[_0x5efe('0x39')]=function(_0xcbc6c1,_0x486fea){return db[_0x5efe('0x42')][_0x5efe('0x5c')]({'where':{'id':_0xcbc6c1[_0x5efe('0x5a')]['id']}})['then'](handleEntityNotFound(_0x486fea,null))[_0x5efe('0x21')](removeEntity(_0x486fea,null))['catch'](handleError(_0x486fea,null));};exports[_0x5efe('0x66')]=function(_0x4987cc,_0x477025){return db['OpenchannelAccount']['describe']()[_0x5efe('0x21')](respondWithResult(_0x477025,null))[_0x5efe('0x2a')](handleError(_0x477025,null));};exports['addDisposition']=function(_0x51630a,_0x4cd7c5,_0x161901){if(_0x51630a['body']['id']){delete _0x51630a[_0x5efe('0x5e')]['id'];}return db[_0x5efe('0x42')][_0x5efe('0x5c')]({'where':{'id':_0x51630a[_0x5efe('0x5a')]['id']}})['then'](handleEntityNotFound(_0x4cd7c5,null))['then'](function(_0x742c38){if(_0x742c38){_0x51630a['body'][_0x5efe('0x67')]=_0x742c38['id'];return db[_0x5efe('0x68')][_0x5efe('0x5d')](_0x51630a['body']);}})['then'](respondWithResult(_0x4cd7c5,null))[_0x5efe('0x2a')](handleError(_0x4cd7c5,null));};exports[_0x5efe('0x69')]=function(_0x1df4f8,_0x3b945c,_0x233a13){var _0x10b6af={'raw':![],'where':{}};var _0x4115a9={};var _0x323a6e={'count':0x0,'rows':[]};return db[_0x5efe('0x42')]['findOne']({'where':{'id':_0x1df4f8['params']['id']}})[_0x5efe('0x21')](handleEntityNotFound(_0x3b945c,null))['then'](function(_0x3eecb6){if(_0x3eecb6){_0x4115a9[_0x5efe('0x46')]=_['keys'](db[_0x5efe('0x68')][_0x5efe('0x6a')]);_0x4115a9[_0x5efe('0x47')]=_[_0x5efe('0x48')](_0x1df4f8['query']);_0x4115a9['filters']=_[_0x5efe('0x4a')](_0x4115a9[_0x5efe('0x46')],_0x4115a9[_0x5efe('0x47')]);_0x10b6af[_0x5efe('0x4b')]=_[_0x5efe('0x4a')](_0x4115a9[_0x5efe('0x46')],qs[_0x5efe('0x4c')](_0x1df4f8[_0x5efe('0x47')][_0x5efe('0x4c')]));_0x10b6af[_0x5efe('0x4b')]=_0x10b6af['attributes'][_0x5efe('0x5b')]?_0x10b6af[_0x5efe('0x4b')]:_0x4115a9[_0x5efe('0x46')];if(!_0x1df4f8[_0x5efe('0x47')]['hasOwnProperty'](_0x5efe('0x4e'))){_0x10b6af['limit']=qs[_0x5efe('0x30')](_0x1df4f8[_0x5efe('0x47')][_0x5efe('0x30')]);_0x10b6af[_0x5efe('0x32')]=qs[_0x5efe('0x32')](_0x1df4f8[_0x5efe('0x47')][_0x5efe('0x32')]);}_0x10b6af[_0x5efe('0x4f')]=qs[_0x5efe('0x50')](_0x1df4f8[_0x5efe('0x47')][_0x5efe('0x50')]);_0x10b6af[_0x5efe('0x51')]=qs['filters'](_[_0x5efe('0x52')](_0x1df4f8[_0x5efe('0x47')],_0x4115a9[_0x5efe('0x49')]));_0x10b6af[_0x5efe('0x51')][_0x5efe('0x67')]=_0x3eecb6['id'];if(_0x1df4f8[_0x5efe('0x47')][_0x5efe('0x53')]){_0x10b6af[_0x5efe('0x51')]=_[_0x5efe('0x54')](_0x10b6af[_0x5efe('0x51')],{'$or':_['map'](_0x10b6af[_0x5efe('0x4b')],function(_0x20bca4){var _0x24a12c={};_0x24a12c[_0x20bca4]={'$like':'%'+_0x1df4f8[_0x5efe('0x47')][_0x5efe('0x53')]+'%'};return _0x24a12c;})});}_0x10b6af=_[_0x5efe('0x54')]({},_0x10b6af,_0x1df4f8[_0x5efe('0x6b')]);return db[_0x5efe('0x68')][_0x5efe('0x31')]({'where':_0x10b6af['where']})[_0x5efe('0x21')](function(_0x4d27d3){_0x323a6e[_0x5efe('0x31')]=_0x4d27d3;if(_0x1df4f8[_0x5efe('0x47')][_0x5efe('0x55')]){_0x10b6af[_0x5efe('0x56')]=[{'all':!![]}];}return db['Disposition'][_0x5efe('0x57')](_0x10b6af);})[_0x5efe('0x21')](function(_0x3e72c3){_0x323a6e[_0x5efe('0x58')]=_0x3e72c3;return _0x323a6e;});}})['then'](respondWithFilteredResult(_0x3b945c,_0x10b6af))['catch'](handleError(_0x3b945c,null));};exports['removeDispositions']=function(_0x2b6bde,_0x20cfb9,_0x993281){return db[_0x5efe('0x42')]['find']({'where':{'id':_0x2b6bde['params']['id']}})['then'](handleEntityNotFound(_0x20cfb9,null))[_0x5efe('0x21')](function(_0x2fc983){if(_0x2fc983){return _0x2fc983[_0x5efe('0x6c')](_0x2b6bde['query'][_0x5efe('0x6d')]);}})[_0x5efe('0x21')](respondWithStatusCode(_0x20cfb9,null))['catch'](handleError(_0x20cfb9,null));};exports[_0x5efe('0x6e')]=function(_0x3aab76,_0x3b8bc6,_0x1b84db){if(_0x3aab76['body']['id']){delete _0x3aab76[_0x5efe('0x5e')]['id'];}return db[_0x5efe('0x42')][_0x5efe('0x5c')]({'where':{'id':_0x3aab76[_0x5efe('0x5a')]['id']}})[_0x5efe('0x21')](handleEntityNotFound(_0x3b8bc6,null))['then'](function(_0x3a2c0b){if(_0x3a2c0b){_0x3aab76[_0x5efe('0x5e')][_0x5efe('0x67')]=_0x3a2c0b['id'];return db[_0x5efe('0x6f')][_0x5efe('0x5d')](_0x3aab76['body']);}})[_0x5efe('0x21')](respondWithResult(_0x3b8bc6,null))[_0x5efe('0x2a')](handleError(_0x3b8bc6,null));};exports['getAnswers']=function(_0x33d5de,_0x15f87c,_0x4ae9a5){var _0x113268={'raw':![],'where':{}};var _0x156e8e={};var _0x243c26={'count':0x0,'rows':[]};return db[_0x5efe('0x42')][_0x5efe('0x70')]({'where':{'id':_0x33d5de['params']['id']}})[_0x5efe('0x21')](handleEntityNotFound(_0x15f87c,null))[_0x5efe('0x21')](function(_0x750b47){if(_0x750b47){_0x156e8e[_0x5efe('0x46')]=_['keys'](db['CannedAnswer'][_0x5efe('0x6a')]);_0x156e8e['query']=_[_0x5efe('0x48')](_0x33d5de[_0x5efe('0x47')]);_0x156e8e['filters']=_[_0x5efe('0x4a')](_0x156e8e[_0x5efe('0x46')],_0x156e8e[_0x5efe('0x47')]);_0x113268[_0x5efe('0x4b')]=_['intersection'](_0x156e8e[_0x5efe('0x46')],qs[_0x5efe('0x4c')](_0x33d5de[_0x5efe('0x47')][_0x5efe('0x4c')]));_0x113268[_0x5efe('0x4b')]=_0x113268[_0x5efe('0x4b')][_0x5efe('0x5b')]?_0x113268[_0x5efe('0x4b')]:_0x156e8e['model'];if(!_0x33d5de[_0x5efe('0x47')][_0x5efe('0x4d')]('nolimit')){_0x113268[_0x5efe('0x30')]=qs[_0x5efe('0x30')](_0x33d5de[_0x5efe('0x47')][_0x5efe('0x30')]);_0x113268[_0x5efe('0x32')]=qs[_0x5efe('0x32')](_0x33d5de['query']['offset']);}_0x113268['order']=qs[_0x5efe('0x50')](_0x33d5de['query']['sort']);_0x113268['where']=qs[_0x5efe('0x49')](_[_0x5efe('0x52')](_0x33d5de[_0x5efe('0x47')],_0x156e8e[_0x5efe('0x49')]));_0x113268[_0x5efe('0x51')]['OpenchannelAccountId']=_0x750b47['id'];if(_0x33d5de['query'][_0x5efe('0x53')]){_0x113268[_0x5efe('0x51')]=_[_0x5efe('0x54')](_0x113268[_0x5efe('0x51')],{'$or':_[_0x5efe('0x41')](_0x113268[_0x5efe('0x4b')],function(_0x3cc565){var _0x2328da={};_0x2328da[_0x3cc565]={'$like':'%'+_0x33d5de[_0x5efe('0x47')][_0x5efe('0x53')]+'%'};return _0x2328da;})});}_0x113268=_[_0x5efe('0x54')]({},_0x113268,_0x33d5de['options']);return db[_0x5efe('0x6f')][_0x5efe('0x31')]({'where':_0x113268['where']})[_0x5efe('0x21')](function(_0x33216b){_0x243c26[_0x5efe('0x31')]=_0x33216b;if(_0x33d5de['query'][_0x5efe('0x55')]){_0x113268['include']=[{'all':!![]}];}return db[_0x5efe('0x6f')][_0x5efe('0x57')](_0x113268);})[_0x5efe('0x21')](function(_0x3daa1e){_0x243c26['rows']=_0x3daa1e;return _0x243c26;});}})[_0x5efe('0x21')](respondWithFilteredResult(_0x15f87c,_0x113268))[_0x5efe('0x2a')](handleError(_0x15f87c,null));};exports[_0x5efe('0x71')]=function(_0x9c34d9,_0x5afb4b,_0x5a1e50){return db[_0x5efe('0x42')][_0x5efe('0x5c')]({'where':{'id':_0x9c34d9['params']['id']}})['then'](handleEntityNotFound(_0x5afb4b,null))[_0x5efe('0x21')](function(_0x565496){if(_0x565496){return _0x565496[_0x5efe('0x71')](_0x9c34d9[_0x5efe('0x47')]['ids']);}})['then'](respondWithStatusCode(_0x5afb4b,null))[_0x5efe('0x2a')](handleError(_0x5afb4b,null));};exports['notify']=function(_0x537593,_0x6e6e79,_0x4a4f0c){var _0x4767dc={'body':_0x537593[_0x5efe('0x5e')],'channel':_0x5efe('0x72')};var _0x545db7=[];var _0x4c19c3=[];var _0x15867a={};var _0x2a3453=![];return db[_0x5efe('0x73')][_0x5efe('0x66')]()[_0x5efe('0x21')](function(_0x21e6f2){if(!_0x21e6f2){throw new db[(_0x5efe('0x74'))][(_0x5efe('0x75'))](_0x5efe('0x76'));}_0x545db7=_['difference'](_[_0x5efe('0x48')](_0x21e6f2),[_0x5efe('0x77'),_0x5efe('0x78')]);_0x4c19c3=_[_0x5efe('0x79')](_[_0x5efe('0x48')](_0x21e6f2),[_0x5efe('0x77'),'updatedAt',_0x5efe('0x7a'),_0x5efe('0x7b')]);if(_0x537593[_0x5efe('0x5e')]['id']){delete _0x537593['body']['id'];}if(_[_0x5efe('0x7c')](_0x537593[_0x5efe('0x5e')][_0x5efe('0x7d')])){throw new db['Sequelize'][(_0x5efe('0x75'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x537593[_0x5efe('0x5e')][_0x5efe('0x5e')])||_0x537593[_0x5efe('0x5e')][_0x5efe('0x5e')]===''){throw new db['Sequelize'][(_0x5efe('0x75'))](_0x5efe('0x7e'));}if(_[_0x5efe('0x7c')](_0x537593['body'][_0x5efe('0x7f')])){throw new db[(_0x5efe('0x74'))][(_0x5efe('0x75'))](_0x5efe('0x80')+_0x4c19c3);}if(!_['includes'](_0x4c19c3,_0x537593[_0x5efe('0x5e')]['mapKey'])){throw new db[(_0x5efe('0x74'))][(_0x5efe('0x75'))](_0x5efe('0x81')+_0x4c19c3);}_0x15867a[_0x537593[_0x5efe('0x5e')][_0x5efe('0x7f')]]=_0x537593[_0x5efe('0x5e')][_0x5efe('0x7d')];})[_0x5efe('0x21')](function(){return db[_0x5efe('0x42')][_0x5efe('0x5c')]({'where':{'id':_0x537593[_0x5efe('0x5a')]['id']},'include':[{'model':db[_0x5efe('0x82')],'as':'List','include':[{'model':db[_0x5efe('0x73')],'as':_0x5efe('0x83'),'where':_0x15867a,'limit':0x1,'order':[['updatedAt',_0x5efe('0x84')]]}]},{'model':db['OpenchannelApplication'],'as':_0x5efe('0x85')}]});})[_0x5efe('0x21')](handleEntityNotFound(_0x6e6e79,null))[_0x5efe('0x21')](function(_0x9dd25f){if(_0x9dd25f&&_0x9dd25f['List']){_0x4767dc[_0x5efe('0x86')]=_0x9dd25f;_0x4767dc['applications']=_0x9dd25f['Applications'];_0x4767dc[_0x5efe('0x87')]=_0x9dd25f[_0x5efe('0x88')];_0x4767dc[_0x5efe('0x89')]=_[_0x5efe('0x8a')](_0x4767dc['applications'],[_0x5efe('0x8b')],[_0x5efe('0x8c')]);if(_0x4767dc[_0x5efe('0x86')][_0x5efe('0x85')]){delete _0x4767dc[_0x5efe('0x86')]['Applications'];}if(_0x4767dc[_0x5efe('0x86')][_0x5efe('0x88')]&&_0x4767dc[_0x5efe('0x86')][_0x5efe('0x88')][_0x5efe('0x83')][_0x5efe('0x5b')]){return _0x4767dc['account'][_0x5efe('0x88')]['Contacts'][0x0];}var _0x324748=_['defaults'](_0x537593['body'],{'firstName':_0x537593[_0x5efe('0x5e')][_0x5efe('0x7d')],'ListId':_0x9dd25f[_0x5efe('0x7b')]});_0x324748[_0x537593['body']['mapKey']]=_0x537593['body'][_0x5efe('0x7d')];return db['CmContact'][_0x5efe('0x5d')](_0x324748,{'fields':_0x545db7,'raw':!![]});}})[_0x5efe('0x21')](handleEntityNotFound(_0x6e6e79,null))[_0x5efe('0x21')](function(_0x31e6ee){_0x4767dc['contact']=_0x31e6ee;if(_0x31e6ee){var _0x147e96={'ContactId':_0x31e6ee['id'],'OpenchannelAccountId':_0x537593['params']['id'],'from':(_0x31e6ee['firstName']||'')+'\x20'+(_0x31e6ee[_0x5efe('0x8d')]||'')};var _0x3af81f={'OpenchannelAccountId':_0x537593['params']['id'],'closed':![]};if(_0x537593[_0x5efe('0x5e')][_0x5efe('0x8e')]){_0x3af81f[_0x5efe('0x8e')]=_0x537593[_0x5efe('0x5e')]['threadId'];return db['OpenchannelInteraction'][_0x5efe('0x5c')]({'where':_0x3af81f})[_0x5efe('0x21')](function(_0x3e0b1d){if(_0x3e0b1d){return[_0x3e0b1d,![]];}_0x147e96['threadId']=_0x537593['body'][_0x5efe('0x8e')];_0x147e96['externalUrl']=_0x537593[_0x5efe('0x5e')]['externalUrl'];return db['OpenchannelInteraction'][_0x5efe('0x5d')](_0x147e96)[_0x5efe('0x21')](function(_0x1c39f3){return[_0x1c39f3,!![]];});});}else{_0x3af81f[_0x5efe('0x8e')]=null;}_0x3af81f['ContactId']=_0x31e6ee['id'];return db['OpenchannelInteraction'][_0x5efe('0x5c')]({'where':_0x3af81f})['then'](function(_0x50ba49){if(_0x50ba49){return[_0x50ba49,![]];}return db[_0x5efe('0x8f')]['create'](_0x147e96)[_0x5efe('0x21')](function(_0xff1dca){return[_0xff1dca,!![]];});});}})[_0x5efe('0x90')](function(_0x40d412,_0x22652c){if(_0x40d412){_0x2a3453=_0x22652c;if(!_0x22652c){var _0x3db0aa={'from':(_0x4767dc[_0x5efe('0x91')]['firstName']||'')+'\x20'+(_0x4767dc[_0x5efe('0x91')][_0x5efe('0x8d')]||'')};if(_0x537593[_0x5efe('0x5e')]['threadId']&&_0x537593[_0x5efe('0x5e')]['messageId']&&_0x537593[_0x5efe('0x5e')][_0x5efe('0x8e')]!=_0x537593[_0x5efe('0x5e')][_0x5efe('0x92')]){_0x3db0aa[_0x5efe('0x8e')]=_0x537593[_0x5efe('0x5e')][_0x5efe('0x92')];}return _0x40d412[_0x5efe('0x38')](_0x3db0aa);}else{return _0x40d412;}}})[_0x5efe('0x21')](function(_0x299bb4){_0x4767dc[_0x5efe('0x93')]=_0x299bb4[_0x5efe('0x62')]({'plain':!![]});_0x4767dc[_0x5efe('0x93')][_0x5efe('0x94')]=_0x2a3453;if(_0x4767dc[_0x5efe('0x93')][_0x5efe('0x94')]){if(_0x4767dc['account'][_0x5efe('0x95')]){_0x4767dc[_0x5efe('0x89')][_0x5efe('0x96')]({'id':0x0,'priority':_0x4767dc[_0x5efe('0x89')][_0x5efe('0x5b')]+0x1,'app':_0x5efe('0x97'),'appdata':_0x5efe('0x98'),'interval':_0x5efe('0x99')});}}return db[_0x5efe('0x9a')][_0x5efe('0x5d')]({'body':_0x537593['body'][_0x5efe('0x5e')],'OpenchannelAccountId':_0x537593[_0x5efe('0x5a')]['id'],'OpenchannelInteractionId':_0x299bb4['id'],'direction':'in','ContactId':_0x4767dc[_0x5efe('0x91')]['id'],'AttachmentId':_0x537593[_0x5efe('0x5e')][_0x5efe('0x9b')]});})['then'](function(_0x82e0b2){_0x4767dc[_0x5efe('0x28')]=_0x82e0b2;if(_0x4767dc[_0x5efe('0x93')][_0x5efe('0x9c')]){return db['User'][_0x5efe('0x5c')]({'attributes':['id','name'],'where':{'id':_0x4767dc[_0x5efe('0x93')][_0x5efe('0x9c')]}})[_0x5efe('0x21')](function(_0x5b4e43){if(_0x5b4e43){_0x4767dc[_0x5efe('0x89')]['unshift']({'id':0x0,'priority':0x0,'app':_0x5efe('0x9d'),'appdata':_0x5b4e43['name']+','+(_0x4767dc['account'][_0x5efe('0x9e')]||0xa),'interval':'*,*,*,*'});_0x4767dc[_0x5efe('0x9f')]=![];}return respondWithRpcPromise(_0x5efe('0xa0'),_0x5efe('0xa1'),_0x4767dc);});}return respondWithRpcPromise(_0x5efe('0xa0'),'startRouting',_0x4767dc);})[_0x5efe('0x21')](function(_0x5425e2){respondWithRpcPromise(_0x5efe('0xa2'),'EventManager',{'event':_0x5efe('0xa3'),'message':_0x5425e2},client9002);return _0x5425e2;})[_0x5efe('0x21')](respondWithResult(_0x6e6e79,null))[_0x5efe('0x2a')](handleError(_0x6e6e79,null));};exports[_0x5efe('0xa4')]=function(_0x15eebc,_0x24fdd7){var _0x567d46=_0x15eebc[_0x5efe('0x5a')]['id'];var _0x3d2592=_0x15eebc[_0x5efe('0x5e')];var _0x2bd601=0xc8;var _0x1176fe=null;return db[_0x5efe('0xa5')][_0x5efe('0xa6')]({'isolationLevel':db[_0x5efe('0xa5')][_0x5efe('0xa7')][_0x5efe('0xa8')]['READ_COMMITTED']},function(_0xd20dd3){return db[_0x5efe('0x42')]['findOne']({'where':{'id':_0x567d46},'transaction':_0xd20dd3})['then'](function(_0x3d294f){if(_0x3d294f){return db['OpenchannelApplication'][_0x5efe('0x39')]({'where':{'OpenchannelAccountId':_0x567d46},'transaction':_0xd20dd3})[_0x5efe('0x21')](function(){var _0x145ef3=_[_0x5efe('0x41')](_0x3d2592,function(_0x246c32){_0x246c32[_0x5efe('0x67')]=_0x567d46;return _0x246c32;});return db[_0x5efe('0xa9')]['bulkCreate'](_0x145ef3,{'transaction':_0xd20dd3});});}else{_0x2bd601=0x194;_0x1176fe=[];}});})['then'](function(){if(_0x2bd601!==0x194){return db[_0x5efe('0xa9')][_0x5efe('0xaa')]({'where':{'OpenchannelAccountId':_0x567d46},'order':_0x5efe('0x8b')})[_0x5efe('0x21')](function(_0x1041b2){_0x1176fe=_0x1041b2;});}})[_0x5efe('0x2a')](function(_0x4d5e4f){_0x2bd601=0x1f4;logger[_0x5efe('0x27')](_0x4d5e4f['stack']);if(_0x4d5e4f[_0x5efe('0x3c')]){delete _0x4d5e4f['name'];}_0x1176fe=_0x4d5e4f;})['finally'](function(){if(_0x1176fe===null){_0x24fdd7['sendStatus'](_0x2bd601);}else{if(_0x2bd601===0x1f4){_0x24fdd7['status'](_0x2bd601)[_0x5efe('0x3d')](_0x1176fe);}else{_0x24fdd7[_0x5efe('0x2d')](_0x2bd601)[_0x5efe('0x2e')](_0x1176fe);}}});};exports[_0x5efe('0xab')]=function(_0xc2441d,_0x5de2b5,_0x5ef795){var _0x5d2811={};var _0x267e51={};var _0x139bcb;var _0x1bcc6c;return db[_0x5efe('0x42')][_0x5efe('0x70')]({'where':{'id':_0xc2441d[_0x5efe('0x5a')]['id']}})[_0x5efe('0x21')](handleEntityNotFound(_0x5de2b5,null))[_0x5efe('0x21')](function(_0x1e50c1){if(_0x1e50c1){_0x139bcb=_0x1e50c1;_0x267e51[_0x5efe('0x46')]=_[_0x5efe('0x48')](db[_0x5efe('0xa9')][_0x5efe('0x6a')]);_0x267e51[_0x5efe('0x47')]=_[_0x5efe('0x48')](_0xc2441d[_0x5efe('0x47')]);_0x267e51[_0x5efe('0x49')]=_['intersection'](_0x267e51[_0x5efe('0x46')],_0x267e51['query']);_0x5d2811['attributes']=_['intersection'](_0x267e51[_0x5efe('0x46')],qs[_0x5efe('0x4c')](_0xc2441d['query']['fields']));_0x5d2811['attributes']=_0x5d2811[_0x5efe('0x4b')][_0x5efe('0x5b')]?_0x5d2811[_0x5efe('0x4b')]:_0x267e51['model'];_0x5d2811[_0x5efe('0x4f')]=qs['sort'](_0xc2441d[_0x5efe('0x47')]['sort']);_0x5d2811[_0x5efe('0x51')]=qs[_0x5efe('0x49')](_[_0x5efe('0x52')](_0xc2441d[_0x5efe('0x47')],_0x267e51[_0x5efe('0x49')]));if(_0xc2441d[_0x5efe('0x47')]['filter']){_0x5d2811[_0x5efe('0x51')]=_[_0x5efe('0x54')](_0x5d2811[_0x5efe('0x51')],{'$or':_[_0x5efe('0x41')](_0x5d2811[_0x5efe('0x4b')],function(_0x220adf){var _0x4266e8={};_0x4266e8[_0x220adf]={'$like':'%'+_0xc2441d['query'][_0x5efe('0x53')]+'%'};return _0x4266e8;})});}_0x5d2811=_[_0x5efe('0x54')]({},_0x5d2811,_0xc2441d[_0x5efe('0x6b')]);return _0x139bcb['getApplications'](_0x5d2811);}})['then'](function(_0x12876a){if(_0x12876a){_0x1bcc6c=_0x12876a[_0x5efe('0x5b')];if(!_0xc2441d[_0x5efe('0x47')][_0x5efe('0x4d')](_0x5efe('0x4e'))){_0x5d2811[_0x5efe('0x30')]=qs[_0x5efe('0x30')](_0xc2441d[_0x5efe('0x47')][_0x5efe('0x30')]);_0x5d2811[_0x5efe('0x32')]=qs[_0x5efe('0x32')](_0xc2441d[_0x5efe('0x47')][_0x5efe('0x32')]);}return _0x139bcb[_0x5efe('0xab')](_0x5d2811);}})[_0x5efe('0x21')](function(_0x4960f3){if(_0x4960f3){return _0x4960f3?{'count':_0x1bcc6c,'rows':_0x4960f3}:null;}})['then'](respondWithResult(_0x5de2b5,null))[_0x5efe('0x2a')](handleError(_0x5de2b5,null));};exports['getInteractions']=function(_0x4dedeb,_0x30aed2,_0x5b86c5){var _0x3baf12={'raw':![],'where':{}};var _0x583424={};var _0x48dd00={'count':0x0,'rows':[]};return db[_0x5efe('0x42')][_0x5efe('0x70')]({'where':{'id':_0x4dedeb[_0x5efe('0x5a')]['id']}})[_0x5efe('0x21')](handleEntityNotFound(_0x30aed2,null))[_0x5efe('0x21')](function(_0x315ce2){if(_0x315ce2){_0x583424[_0x5efe('0x46')]=_[_0x5efe('0x48')](db[_0x5efe('0x8f')][_0x5efe('0x6a')]);_0x583424['query']=_[_0x5efe('0x48')](_0x4dedeb[_0x5efe('0x47')]);_0x583424['filters']=_[_0x5efe('0x4a')](_0x583424[_0x5efe('0x46')],_0x583424[_0x5efe('0x47')]);_0x3baf12[_0x5efe('0x4b')]=_[_0x5efe('0x4a')](_0x583424[_0x5efe('0x46')],qs[_0x5efe('0x4c')](_0x4dedeb[_0x5efe('0x47')][_0x5efe('0x4c')]));_0x3baf12['attributes']=_0x3baf12[_0x5efe('0x4b')][_0x5efe('0x5b')]?_0x3baf12[_0x5efe('0x4b')]:_0x583424['model'];if(!_0x4dedeb['query'][_0x5efe('0x4d')](_0x5efe('0x4e'))){_0x3baf12[_0x5efe('0x30')]=qs['limit'](_0x4dedeb[_0x5efe('0x47')]['limit']);_0x3baf12[_0x5efe('0x32')]=qs[_0x5efe('0x32')](_0x4dedeb[_0x5efe('0x47')][_0x5efe('0x32')]);}_0x3baf12[_0x5efe('0x4f')]=qs['sort'](_0x4dedeb['query']['sort']);_0x3baf12[_0x5efe('0x51')]=qs[_0x5efe('0x49')](_[_0x5efe('0x52')](_0x4dedeb[_0x5efe('0x47')],_0x583424['filters']));_0x3baf12[_0x5efe('0x51')][_0x5efe('0x67')]=_0x315ce2['id'];if(_0x4dedeb[_0x5efe('0x47')][_0x5efe('0x53')]){_0x3baf12[_0x5efe('0x51')]=_[_0x5efe('0x54')](_0x3baf12[_0x5efe('0x51')],{'$or':_[_0x5efe('0x41')](_0x3baf12[_0x5efe('0x4b')],function(_0x372e4a){var _0x1dd151={};_0x1dd151[_0x372e4a]={'$like':'%'+_0x4dedeb['query']['filter']+'%'};return _0x1dd151;})});}_0x3baf12=_['merge']({},_0x3baf12,_0x4dedeb[_0x5efe('0x6b')]);return db[_0x5efe('0x8f')][_0x5efe('0x31')]({'where':_0x3baf12['where']})[_0x5efe('0x21')](function(_0x2c9b86){_0x48dd00['count']=_0x2c9b86;if(_0x4dedeb[_0x5efe('0x47')][_0x5efe('0x55')]){_0x3baf12['include']=[{'model':db[_0x5efe('0x73')],'as':_0x5efe('0xac'),'required':![]},{'model':db[_0x5efe('0xad')],'as':_0x5efe('0xae'),'attributes':[_0x5efe('0x3c'),_0x5efe('0xaf'),_0x5efe('0xb0')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x5efe('0x3c'),_0x5efe('0xb1')],'where':_0x4dedeb[_0x5efe('0x47')][_0x5efe('0xb2')]?{'id':_0x4dedeb[_0x5efe('0x47')][_0x5efe('0xb2')]}:undefined,'required':_0x4dedeb[_0x5efe('0x47')][_0x5efe('0xb2')]?!![]:![]}];}return db[_0x5efe('0x8f')][_0x5efe('0x57')](_0x3baf12);})[_0x5efe('0x21')](function(_0x195264){_0x48dd00[_0x5efe('0x58')]=_0x195264;return _0x48dd00;});}})[_0x5efe('0x21')](respondWithFilteredResult(_0x30aed2,_0x3baf12))['catch'](handleError(_0x30aed2,null));};exports[_0x5efe('0xb3')]=function(_0x4db7ca,_0x34df6d,_0x454e81){return db['OpenchannelAccount'][_0x5efe('0x5c')]({'where':{'id':_0x4db7ca[_0x5efe('0x5a')]['id']}})['then'](handleEntityNotFound(_0x34df6d,null))[_0x5efe('0x21')](function(_0x4d193b){if(_0x4d193b){return _0x4d193b[_0x5efe('0xb3')](_0x4db7ca[_0x5efe('0x5e')][_0x5efe('0x6d')],_[_0x5efe('0xb4')](_0x4db7ca['body'],['ids','id'])||{})[_0x5efe('0x90')](function(_0x20dd76){for(var _0x2361d3=0x0;_0x2361d3<_0x4db7ca[_0x5efe('0x5e')][_0x5efe('0x6d')][_0x5efe('0x5b')];_0x2361d3+=0x1){socket[_0x5efe('0xb5')](_0x5efe('0xb6'),{'UserId':Number(_0x4db7ca[_0x5efe('0x5e')]['ids'][_0x2361d3]),'OpenchannelAccountId':Number(_0x4db7ca[_0x5efe('0x5a')]['id'])});}return _0x20dd76;});}})[_0x5efe('0x21')](respondWithResult(_0x34df6d,null))['catch'](handleError(_0x34df6d,null));};exports[_0x5efe('0xb7')]=function(_0x7238ba,_0x5e0ab5,_0x601834){return db[_0x5efe('0x42')][_0x5efe('0x5c')]({'where':{'id':_0x7238ba[_0x5efe('0x5a')]['id']}})['then'](handleEntityNotFound(_0x5e0ab5,null))['then'](function(_0x3c4837){if(_0x3c4837){return _0x3c4837[_0x5efe('0xb7')](_0x7238ba['query']['ids'])[_0x5efe('0x21')](function(){if(_[_0x5efe('0xb8')](_0x7238ba[_0x5efe('0x47')][_0x5efe('0x6d')])){for(var _0xc3ae9f=0x0;_0xc3ae9f<_0x7238ba[_0x5efe('0x47')][_0x5efe('0x6d')][_0x5efe('0x5b')];_0xc3ae9f+=0x1){socket['emit'](_0x5efe('0xb9'),{'UserId':Number(_0x7238ba[_0x5efe('0x47')]['ids'][_0xc3ae9f]),'OpenchannelAccountId':Number(_0x7238ba[_0x5efe('0x5a')]['id'])});}}else{socket[_0x5efe('0xb5')](_0x5efe('0xb9'),{'UserId':Number(_0x7238ba[_0x5efe('0x47')]['ids']),'OpenchannelAccountId':Number(_0x7238ba[_0x5efe('0x5a')]['id'])});}});}})['then'](respondWithStatusCode(_0x5e0ab5,null))['catch'](handleError(_0x5e0ab5,null));};exports[_0x5efe('0xba')]=function(_0x58cf7f,_0xec37c8,_0x2b098b){var _0x2ecdf={};var _0xc3e997={};var _0x2d31de;var _0x59b595;return db['OpenchannelAccount'][_0x5efe('0x70')]({'where':{'id':_0x58cf7f[_0x5efe('0x5a')]['id']}})[_0x5efe('0x21')](handleEntityNotFound(_0xec37c8,null))[_0x5efe('0x21')](function(_0x2cb80c){if(_0x2cb80c){_0x2d31de=_0x2cb80c;_0xc3e997[_0x5efe('0x46')]=_['keys'](db[_0x5efe('0xad')][_0x5efe('0x6a')]);_0xc3e997[_0x5efe('0x47')]=_[_0x5efe('0x48')](_0x58cf7f['query']);_0xc3e997['filters']=_[_0x5efe('0x4a')](_0xc3e997['model'],_0xc3e997[_0x5efe('0x47')]);_0x2ecdf[_0x5efe('0x4b')]=_[_0x5efe('0x4a')](_0xc3e997[_0x5efe('0x46')],qs[_0x5efe('0x4c')](_0x58cf7f[_0x5efe('0x47')][_0x5efe('0x4c')]));_0x2ecdf[_0x5efe('0x4b')]=_0x2ecdf[_0x5efe('0x4b')][_0x5efe('0x5b')]?_0x2ecdf['attributes']:_0xc3e997['model'];_0x2ecdf[_0x5efe('0x4f')]=qs[_0x5efe('0x50')](_0x58cf7f[_0x5efe('0x47')][_0x5efe('0x50')]);_0x2ecdf['where']=qs[_0x5efe('0x49')](_[_0x5efe('0x52')](_0x58cf7f[_0x5efe('0x47')],_0xc3e997[_0x5efe('0x49')]));if(_0x58cf7f[_0x5efe('0x47')][_0x5efe('0x53')]){_0x2ecdf['where']=_[_0x5efe('0x54')](_0x2ecdf[_0x5efe('0x51')],{'$or':_[_0x5efe('0x41')](_0x2ecdf[_0x5efe('0x4b')],function(_0x2ed87f){var _0x2a6140={};_0x2a6140[_0x2ed87f]={'$like':'%'+_0x58cf7f[_0x5efe('0x47')][_0x5efe('0x53')]+'%'};return _0x2a6140;})});}_0x2ecdf=_[_0x5efe('0x54')]({},_0x2ecdf,_0x58cf7f['options']);return _0x2d31de[_0x5efe('0xba')](_0x2ecdf);}})[_0x5efe('0x21')](function(_0x6ae1b5){if(_0x6ae1b5){_0x59b595=_0x6ae1b5[_0x5efe('0x5b')];if(!_0x58cf7f['query'][_0x5efe('0x4d')](_0x5efe('0x4e'))){_0x2ecdf['limit']=qs[_0x5efe('0x30')](_0x58cf7f[_0x5efe('0x47')]['limit']);_0x2ecdf['offset']=qs[_0x5efe('0x32')](_0x58cf7f[_0x5efe('0x47')][_0x5efe('0x32')]);}return _0x2d31de['getAgents'](_0x2ecdf);}})[_0x5efe('0x21')](function(_0x28d422){if(_0x28d422){return _0x28d422?{'count':_0x59b595,'rows':_0x28d422}:null;}})[_0x5efe('0x21')](respondWithResult(_0xec37c8,null))['catch'](handleError(_0xec37c8,null));};exports['send']=function(_0x5736f8,_0x11b8c5,_0x2687d4){var _0x46861e,_0x3b7304,_0x1d6ac1;if(_['isNil'](_0x5736f8['body'][_0x5efe('0x5e')])||_0x5736f8[_0x5efe('0x5e')][_0x5efe('0x5e')]===''){throw new db[(_0x5efe('0x74'))][(_0x5efe('0x75'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x5736f8[_0x5efe('0x5e')]['to'])){}_0x46861e=_0x5736f8[_0x5efe('0x5e')]['to'];return db[_0x5efe('0x42')][_0x5efe('0x70')]({'where':{'id':_0x5736f8[_0x5efe('0x5a')]['id']}})[_0x5efe('0x21')](handleEntityNotFound(_0x11b8c5,null))[_0x5efe('0x21')](function(_0x362d98){if(_0x362d98){return db[_0x5efe('0x42')]['find']({'where':{'id':_0x362d98['id']},'include':[{'model':db[_0x5efe('0x82')],'as':_0x5efe('0x88'),'include':[{'model':db['CmContact'],'as':_0x5efe('0x83'),'where':{[_0x362d98[_0x5efe('0x7f')]]:_0x46861e},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})[_0x5efe('0x21')](handleEntityNotFound(_0x11b8c5,null))[_0x5efe('0x21')](function(_0x27e14a){if(_0x27e14a&&_0x27e14a['List']){_0x3b7304=_0x27e14a[_0x5efe('0x62')]({'plain':!![]});if(_0x3b7304[_0x5efe('0x88')]&&_0x3b7304['List']['Contacts'][_0x5efe('0x5b')]){return _0x3b7304['List'][_0x5efe('0x83')][0x0];}return db['CmContact'][_0x5efe('0x5d')](_[_0x5efe('0x18')](_0x5736f8[_0x5efe('0x5e')],{'firstName':_0x46861e,[_0x27e14a[_0x5efe('0x7f')]]:_0x46861e,'phone':_0x46861e,'ListId':_0x3b7304[_0x5efe('0x7b')]}));}})['then'](handleEntityNotFound(_0x11b8c5,null))[_0x5efe('0x21')](function(_0x365824){if(_0x365824){_0x1d6ac1=_0x365824;return db[_0x5efe('0x8f')][_0x5efe('0x5c')]({'where':{'ContactId':_0x1d6ac1['id'],'closed':![],'OpenchannelAccountId':_0x3b7304['id']}})[_0x5efe('0x21')](function(_0x2131f7){if(_0x2131f7){return[_0x2131f7,![]];}return db[_0x5efe('0x8f')][_0x5efe('0x5d')]({'UserId':_0x5736f8[_0x5efe('0x5f')]['id'],'ContactId':_0x1d6ac1['id'],'OpenchannelAccountId':_0x3b7304['id'],'lastMsgDirection':_0x5efe('0xbb'),'firstMsgDirection':_0x5efe('0xbb'),'Messages':[_[_0x5efe('0x54')](_0x5736f8[_0x5efe('0x5e')],{'read':![],'body':_0x5736f8[_0x5efe('0x5e')][_0x5efe('0x5e')],'OpenchannelAccountId':_0x3b7304['id'],'UserId':_0x5736f8[_0x5efe('0x5f')]['id'],'ContactId':_0x1d6ac1['id']})]},{'include':[{'model':db[_0x5efe('0x9a')],'as':_0x5efe('0xbc')}]})[_0x5efe('0x21')](function(_0x281651){return[_0x281651,!![]];});});}})[_0x5efe('0x90')](function(_0x3fa144,_0x494fc8){if(_0x494fc8){return _0x3fa144;}return db[_0x5efe('0x9a')][_0x5efe('0x5d')](_[_0x5efe('0x54')](_0x5736f8['body'],{'read':![],'body':_0x5736f8[_0x5efe('0x5e')][_0x5efe('0x5e')],'OpenchannelAccountId':_0x3b7304['id'],'OpenchannelInteractionId':_0x3fa144['id'],'UserId':_0x5736f8[_0x5efe('0x5f')]['id'],'ContactId':_0x1d6ac1['id']}))[_0x5efe('0x21')](function(_0x3e5fe4){_0x3fa144[_0x5efe('0xbd')][_0x5efe('0xbc')]=[];_0x3fa144[_0x5efe('0xbd')]['Messages'][_0x5efe('0x96')](_0x3e5fe4[_0x5efe('0xbd')]);return _0x3fa144;});});}})['then'](respondWithResult(_0x11b8c5,null))[_0x5efe('0x2a')](handleError(_0x11b8c5,null));}; \ No newline at end of file +var _0x590c=['map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','include','OpenchannelAccount','findAll','rows','show','params','length','includeAll','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','find','OpenchannelAccountId','Disposition','getDispositions','nolimit','pick','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','notify','openchannel','CmContact','describe','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','isNil','from','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','OpenchannelApplication','Applications','account','applications','list','priority','asc','ListId','contact','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','firstName','messageId','interaction','created','close','unmanaged','OpenchannelMessage','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','*,*,*,*','forcedOwnership','Start','startRouting','EventManager','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','bulkCreate','findAndCountAll','finally','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','tag','addAgents','omit','userOpenchannelAccount:save','removeAgents','isArray','emit','userOpenchannelAccount:remove','getAgents','DESC','out','Messages','dataValues','push','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','defaults','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','message','catch','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','get','OpenchannelAccounts','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','rawAttributes','fieldName','type','key','model'];(function(_0x47c30c,_0x5dddc8){var _0x122fad=function(_0x439c03){while(--_0x439c03){_0x47c30c['push'](_0x47c30c['shift']());}};_0x122fad(++_0x5dddc8);}(_0x590c,0x80));var _0xc590=function(_0x81acc5,_0x4ba174){_0x81acc5=_0x81acc5-0x0;var _0x13a5d9=_0x590c[_0x81acc5];return _0x13a5d9;};'use strict';var emlformat=require(_0xc590('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc590('0x1'));var rp=require(_0xc590('0x2'));var moment=require(_0xc590('0x3'));var BPromise=require(_0xc590('0x4'));var Mustache=require(_0xc590('0x5'));var util=require(_0xc590('0x6'));var path=require(_0xc590('0x7'));var sox=require(_0xc590('0x8'));var csv=require(_0xc590('0x9'));var ejs=require(_0xc590('0xa'));var fs=require('fs');var fs_extra=require(_0xc590('0xb'));var _=require(_0xc590('0xc'));var squel=require(_0xc590('0xd'));var crypto=require(_0xc590('0xe'));var jsforce=require(_0xc590('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc590('0x10'));var Papa=require(_0xc590('0x11'));var Redis=require('ioredis');var authService=require(_0xc590('0x12'));var qs=require(_0xc590('0x13'));var as=require(_0xc590('0x14'));var hardwareService=require(_0xc590('0x15'));var logger=require(_0xc590('0x16'))('api');var utils=require('../../config/utils');var config=require(_0xc590('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0xc590('0x18')](config[_0xc590('0x19')],{'host':_0xc590('0x1a'),'port':0x18eb});var socket=require(_0xc590('0x1b'))(new Redis(config[_0xc590('0x19')]));require(_0xc590('0x1c'))[_0xc590('0x1d')](socket);var jayson=require(_0xc590('0x1e'));var client=jayson[_0xc590('0x1f')][_0xc590('0x20')]({'port':0x232c});var client9002=jayson[_0xc590('0x1f')][_0xc590('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x3910ac,_0x4b5000,_0x2f3886,_0x472207){return new BPromise(function(_0xf38785,_0x22dc8f){var _0x4197c2=_0x472207||client;return _0x4197c2[_0xc590('0x21')](_0x3910ac,_0x2f3886)[_0xc590('0x22')](function(_0x1515f1){logger[_0xc590('0x23')](_0xc590('0x24'),_0x4b5000,_0xc590('0x25'));logger[_0xc590('0x26')](_0xc590('0x27'),_0x4b5000,_0xc590('0x25'),JSON['stringify'](_0x1515f1));if(_0x1515f1[_0xc590('0x28')]){if(_0x1515f1[_0xc590('0x28')]['code']===0x1f4){logger['error'](_0xc590('0x24'),_0x4b5000,_0x1515f1[_0xc590('0x28')][_0xc590('0x29')]);return _0x22dc8f(_0x1515f1['error'][_0xc590('0x29')]);}logger[_0xc590('0x28')]('OpenchannelAccount,\x20%s,\x20%s',_0x4b5000,_0x1515f1[_0xc590('0x28')][_0xc590('0x29')]);return _0xf38785(_0x1515f1[_0xc590('0x28')][_0xc590('0x29')]);}else{logger[_0xc590('0x23')]('OpenchannelAccount,\x20%s,\x20%s',_0x4b5000,'request\x20sent');_0xf38785(_0x1515f1['result'][_0xc590('0x29')]);}})[_0xc590('0x2a')](function(_0x1f7de3){logger[_0xc590('0x28')](_0xc590('0x24'),_0x4b5000,_0x1f7de3);_0x22dc8f(_0x1f7de3);});});}function respondWithStatusCode(_0x29e25b,_0x23abdd){_0x23abdd=_0x23abdd||0xcc;return function(_0x225481){if(_0x225481){return _0x29e25b[_0xc590('0x2b')](_0x23abdd);}return _0x29e25b[_0xc590('0x2c')](_0x23abdd)[_0xc590('0x2d')]();};}function respondWithResult(_0x245e2e,_0x5eaf4c){_0x5eaf4c=_0x5eaf4c||0xc8;return function(_0x24f9ef){if(_0x24f9ef){return _0x245e2e[_0xc590('0x2c')](_0x5eaf4c)[_0xc590('0x2e')](_0x24f9ef);}};}function respondWithFilteredResult(_0x5509da,_0x3f57e5){return function(_0x519664){if(_0x519664){var _0x226380=typeof _0x3f57e5[_0xc590('0x2f')]==='undefined'&&typeof _0x3f57e5[_0xc590('0x30')]===_0xc590('0x31');var _0x555497=_0x519664[_0xc590('0x32')];var _0xdffac9=_0x226380?0x0:_0x3f57e5[_0xc590('0x2f')];var _0x3383f7=_0x226380?_0x519664[_0xc590('0x32')]:_0x3f57e5[_0xc590('0x2f')]+_0x3f57e5[_0xc590('0x30')];var _0x198d4a;if(_0x3383f7>=_0x555497){_0x3383f7=_0x555497;_0x198d4a=0xc8;}else{_0x198d4a=0xce;}_0x5509da[_0xc590('0x2c')](_0x198d4a);return _0x5509da[_0xc590('0x33')](_0xc590('0x34'),_0xdffac9+'-'+_0x3383f7+'/'+_0x555497)['json'](_0x519664);}return null;};}function patchUpdates(_0x578ef7){return function(_0x192a47){try{jsonpatch[_0xc590('0x35')](_0x192a47,_0x578ef7,!![]);}catch(_0x1d2415){return BPromise[_0xc590('0x36')](_0x1d2415);}return _0x192a47[_0xc590('0x37')]();};}function saveUpdates(_0x5c9feb,_0x291cd0){return function(_0x20cd33){if(_0x20cd33){return _0x20cd33[_0xc590('0x38')](_0x5c9feb)[_0xc590('0x22')](function(_0x22ce2f){return _0x22ce2f;});}return null;};}function removeEntity(_0x3388a8,_0x36c81e){return function(_0x3a1b90){if(_0x3a1b90){return _0x3a1b90[_0xc590('0x39')]()['then'](function(){var _0x157818=_0x3a1b90[_0xc590('0x3a')]({'plain':!![]});var _0x2a3b82=_0xc590('0x3b');return db[_0xc590('0x3c')]['destroy']({'where':{'type':_0x2a3b82,'resourceId':_0x157818['id']}})[_0xc590('0x22')](function(){return _0x3a1b90;});})[_0xc590('0x22')](function(){_0x3388a8[_0xc590('0x2c')](0xcc)[_0xc590('0x2d')]();});}};}function handleEntityNotFound(_0x39e990,_0x3567bf){return function(_0xcc3b36){if(!_0xcc3b36){_0x39e990[_0xc590('0x2b')](0x194);}return _0xcc3b36;};}function handleError(_0x5cbf17,_0xf29f82){_0xf29f82=_0xf29f82||0x1f4;return function(_0x573285){logger['error'](_0x573285[_0xc590('0x3d')]);if(_0x573285['name']){delete _0x573285[_0xc590('0x3e')];}_0x5cbf17['status'](_0xf29f82)[_0xc590('0x3f')](_0x573285);};}exports[_0xc590('0x40')]=function(_0x266689,_0xd44ae6){var _0x16a7bf={'include':[{'model':db[_0xc590('0x41')],'as':_0xc590('0x42')}]},_0x543efc={},_0x2778e3={'count':0x0,'rows':[]};var _0x2a909d=_['map'](db['OpenchannelAccount'][_0xc590('0x43')],function(_0x1baa93){return{'name':_0x1baa93[_0xc590('0x44')],'type':_0x1baa93[_0xc590('0x45')][_0xc590('0x46')]};});_0x543efc[_0xc590('0x47')]=_[_0xc590('0x48')](_0x2a909d,_0xc590('0x3e'));_0x543efc[_0xc590('0x49')]=_[_0xc590('0x4a')](_0x266689[_0xc590('0x49')]);_0x543efc[_0xc590('0x4b')]=_['intersection'](_0x543efc[_0xc590('0x47')],_0x543efc[_0xc590('0x49')]);_0x16a7bf['attributes']=_[_0xc590('0x4c')](_0x543efc[_0xc590('0x47')],qs[_0xc590('0x4d')](_0x266689[_0xc590('0x49')][_0xc590('0x4d')]));_0x16a7bf['attributes']=_0x16a7bf[_0xc590('0x4e')]['length']?_0x16a7bf[_0xc590('0x4e')]:_0x543efc['model'];if(!_0x266689['query'][_0xc590('0x4f')]('nolimit')){_0x16a7bf['limit']=qs['limit'](_0x266689[_0xc590('0x49')][_0xc590('0x30')]);_0x16a7bf[_0xc590('0x2f')]=qs[_0xc590('0x2f')](_0x266689[_0xc590('0x49')]['offset']);}_0x16a7bf[_0xc590('0x50')]=qs[_0xc590('0x51')](_0x266689[_0xc590('0x49')]['sort']);_0x16a7bf[_0xc590('0x52')]=qs[_0xc590('0x4b')](_['pick'](_0x266689[_0xc590('0x49')],_0x543efc[_0xc590('0x4b')]),_0x2a909d);if(_0x266689[_0xc590('0x49')][_0xc590('0x53')]){_0x16a7bf[_0xc590('0x52')]=_[_0xc590('0x54')](_0x16a7bf[_0xc590('0x52')],{'$or':_[_0xc590('0x48')](_0x2a909d,function(_0x2cfb56){if(_0x2cfb56['type']!==_0xc590('0x55')){var _0x41435d={};_0x41435d[_0x2cfb56['name']]={'$like':'%'+_0x266689[_0xc590('0x49')][_0xc590('0x53')]+'%'};return _0x41435d;}})});}_0x16a7bf=_['merge']({},_0x16a7bf,_0x266689[_0xc590('0x56')]);var _0xc5cf8f={'where':_0x16a7bf['where']};return db['OpenchannelAccount'][_0xc590('0x32')](_0xc5cf8f)[_0xc590('0x22')](function(_0x2b5529){_0x2778e3[_0xc590('0x32')]=_0x2b5529;if(_0x266689['query']['includeAll']){_0x16a7bf[_0xc590('0x57')]=[{'all':!![]}];}return db[_0xc590('0x58')][_0xc590('0x59')](_0x16a7bf);})['then'](function(_0x193e0d){_0x2778e3[_0xc590('0x5a')]=_0x193e0d;return _0x2778e3;})[_0xc590('0x22')](respondWithFilteredResult(_0xd44ae6,_0x16a7bf))[_0xc590('0x2a')](handleError(_0xd44ae6,null));};exports[_0xc590('0x5b')]=function(_0x2086fc,_0x24eb8a){var _0x1a9949={'raw':![],'where':{'id':_0x2086fc[_0xc590('0x5c')]['id']},'include':[{'model':db[_0xc590('0x41')],'as':_0xc590('0x42')}]},_0x47d988={};_0x47d988[_0xc590('0x47')]=_[_0xc590('0x4a')](db['OpenchannelAccount']['rawAttributes']);_0x47d988[_0xc590('0x49')]=_[_0xc590('0x4a')](_0x2086fc[_0xc590('0x49')]);_0x47d988[_0xc590('0x4b')]=_[_0xc590('0x4c')](_0x47d988['model'],_0x47d988[_0xc590('0x49')]);_0x1a9949['attributes']=_['intersection'](_0x47d988[_0xc590('0x47')],qs[_0xc590('0x4d')](_0x2086fc[_0xc590('0x49')]['fields']));_0x1a9949['attributes']=_0x1a9949[_0xc590('0x4e')][_0xc590('0x5d')]?_0x1a9949[_0xc590('0x4e')]:_0x47d988[_0xc590('0x47')];if(_0x2086fc['query'][_0xc590('0x5e')]){_0x1a9949[_0xc590('0x57')]=[{'all':!![]}];}_0x1a9949=_[_0xc590('0x54')]({},_0x1a9949,_0x2086fc['options']);return db['OpenchannelAccount']['find'](_0x1a9949)[_0xc590('0x22')](handleEntityNotFound(_0x24eb8a,null))['then'](respondWithResult(_0x24eb8a,null))[_0xc590('0x2a')](handleError(_0x24eb8a,null));};exports[_0xc590('0x5f')]=function(_0x4f2048,_0xafd251){return db[_0xc590('0x58')][_0xc590('0x5f')](_0x4f2048[_0xc590('0x60')],{})[_0xc590('0x22')](function(_0x5d1417){var _0x547beb=_0x4f2048['user'][_0xc590('0x3a')]({'plain':!![]});if(!_0x547beb)throw new Error(_0xc590('0x61'));if(_0x547beb[_0xc590('0x62')]===_0xc590('0x63')){var _0x30a231=_0x5d1417[_0xc590('0x3a')]({'plain':!![]});var _0x3dc919=_0xc590('0x3b');return db[_0xc590('0x64')]['find']({'where':{'name':_0x3dc919,'userProfileId':_0x547beb[_0xc590('0x65')]},'raw':!![]})['then'](function(_0x4c7fec){if(_0x4c7fec&&_0x4c7fec[_0xc590('0x66')]===0x0){return db[_0xc590('0x3c')][_0xc590('0x5f')]({'name':_0x30a231['name'],'resourceId':_0x30a231['id'],'type':_0x4c7fec[_0xc590('0x3e')],'sectionId':_0x4c7fec['id']},{})['then'](function(){return _0x5d1417;});}else{return _0x5d1417;}})[_0xc590('0x2a')](function(_0x31a9e5){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x31a9e5);throw _0x31a9e5;});}return _0x5d1417;})[_0xc590('0x22')](respondWithResult(_0xafd251,0xc9))[_0xc590('0x2a')](handleError(_0xafd251,null));};exports[_0xc590('0x38')]=function(_0x43554c,_0x225478){if(_0x43554c[_0xc590('0x60')]['id']){delete _0x43554c[_0xc590('0x60')]['id'];}return db[_0xc590('0x58')][_0xc590('0x67')]({'where':{'id':_0x43554c[_0xc590('0x5c')]['id']},'include':[{'model':db[_0xc590('0x41')],'as':'mandatoryDispositionPause'}]})[_0xc590('0x22')](handleEntityNotFound(_0x225478,null))['then'](saveUpdates(_0x43554c[_0xc590('0x60')],null))[_0xc590('0x22')](respondWithResult(_0x225478,null))[_0xc590('0x2a')](handleError(_0x225478,null));};exports[_0xc590('0x39')]=function(_0x3e5b9c,_0x79470f){return db[_0xc590('0x58')]['find']({'where':{'id':_0x3e5b9c['params']['id']}})[_0xc590('0x22')](handleEntityNotFound(_0x79470f,null))[_0xc590('0x22')](removeEntity(_0x79470f,null))['catch'](handleError(_0x79470f,null));};exports['describe']=function(_0x554028,_0x42458d){return db[_0xc590('0x58')]['describe']()['then'](respondWithResult(_0x42458d,null))[_0xc590('0x2a')](handleError(_0x42458d,null));};exports['addDisposition']=function(_0x4a1bb9,_0x493553,_0xbe61e8){if(_0x4a1bb9['body']['id']){delete _0x4a1bb9[_0xc590('0x60')]['id'];}return db[_0xc590('0x58')][_0xc590('0x67')]({'where':{'id':_0x4a1bb9['params']['id']}})['then'](handleEntityNotFound(_0x493553,null))['then'](function(_0x6f7f8d){if(_0x6f7f8d){_0x4a1bb9[_0xc590('0x60')][_0xc590('0x68')]=_0x6f7f8d['id'];return db[_0xc590('0x69')][_0xc590('0x5f')](_0x4a1bb9[_0xc590('0x60')]);}})[_0xc590('0x22')](respondWithResult(_0x493553,null))[_0xc590('0x2a')](handleError(_0x493553,null));};exports[_0xc590('0x6a')]=function(_0x47c9f8,_0x3ac4ff,_0x57a10f){var _0x501600={'raw':![],'where':{}};var _0x58f7f2={};var _0x465fbb={'count':0x0,'rows':[]};return db[_0xc590('0x58')]['findOne']({'where':{'id':_0x47c9f8['params']['id']}})['then'](handleEntityNotFound(_0x3ac4ff,null))['then'](function(_0x3635d5){if(_0x3635d5){_0x58f7f2['model']=_[_0xc590('0x4a')](db[_0xc590('0x69')][_0xc590('0x43')]);_0x58f7f2[_0xc590('0x49')]=_['keys'](_0x47c9f8['query']);_0x58f7f2[_0xc590('0x4b')]=_[_0xc590('0x4c')](_0x58f7f2[_0xc590('0x47')],_0x58f7f2['query']);_0x501600[_0xc590('0x4e')]=_['intersection'](_0x58f7f2[_0xc590('0x47')],qs[_0xc590('0x4d')](_0x47c9f8[_0xc590('0x49')]['fields']));_0x501600['attributes']=_0x501600[_0xc590('0x4e')][_0xc590('0x5d')]?_0x501600[_0xc590('0x4e')]:_0x58f7f2[_0xc590('0x47')];if(!_0x47c9f8['query'][_0xc590('0x4f')](_0xc590('0x6b'))){_0x501600[_0xc590('0x30')]=qs[_0xc590('0x30')](_0x47c9f8[_0xc590('0x49')][_0xc590('0x30')]);_0x501600['offset']=qs[_0xc590('0x2f')](_0x47c9f8[_0xc590('0x49')]['offset']);}_0x501600[_0xc590('0x50')]=qs['sort'](_0x47c9f8[_0xc590('0x49')][_0xc590('0x51')]);_0x501600[_0xc590('0x52')]=qs['filters'](_[_0xc590('0x6c')](_0x47c9f8[_0xc590('0x49')],_0x58f7f2[_0xc590('0x4b')]));_0x501600[_0xc590('0x52')][_0xc590('0x68')]=_0x3635d5['id'];if(_0x47c9f8[_0xc590('0x49')]['filter']){_0x501600['where']=_[_0xc590('0x54')](_0x501600[_0xc590('0x52')],{'$or':_[_0xc590('0x48')](_0x501600[_0xc590('0x4e')],function(_0x182a5a){var _0x1c0178={};_0x1c0178[_0x182a5a]={'$like':'%'+_0x47c9f8[_0xc590('0x49')][_0xc590('0x53')]+'%'};return _0x1c0178;})});}_0x501600=_[_0xc590('0x54')]({},_0x501600,_0x47c9f8[_0xc590('0x56')]);return db[_0xc590('0x69')][_0xc590('0x32')]({'where':_0x501600[_0xc590('0x52')]})[_0xc590('0x22')](function(_0x5c262b){_0x465fbb[_0xc590('0x32')]=_0x5c262b;if(_0x47c9f8['query']['includeAll']){_0x501600[_0xc590('0x57')]=[{'all':!![]}];}return db[_0xc590('0x69')][_0xc590('0x59')](_0x501600);})[_0xc590('0x22')](function(_0x5a903c){_0x465fbb[_0xc590('0x5a')]=_0x5a903c;return _0x465fbb;});}})[_0xc590('0x22')](respondWithFilteredResult(_0x3ac4ff,_0x501600))[_0xc590('0x2a')](handleError(_0x3ac4ff,null));};exports[_0xc590('0x6d')]=function(_0x185d66,_0x14003d,_0x2255e6){return db['OpenchannelAccount'][_0xc590('0x67')]({'where':{'id':_0x185d66['params']['id']}})['then'](handleEntityNotFound(_0x14003d,null))[_0xc590('0x22')](function(_0x18781d){if(_0x18781d){return _0x18781d['removeDispositions'](_0x185d66[_0xc590('0x49')][_0xc590('0x6e')]);}})[_0xc590('0x22')](respondWithStatusCode(_0x14003d,null))[_0xc590('0x2a')](handleError(_0x14003d,null));};exports[_0xc590('0x6f')]=function(_0x57bdc9,_0x1552b7,_0x559b3e){if(_0x57bdc9['body']['id']){delete _0x57bdc9[_0xc590('0x60')]['id'];}return db[_0xc590('0x58')][_0xc590('0x67')]({'where':{'id':_0x57bdc9['params']['id']}})[_0xc590('0x22')](handleEntityNotFound(_0x1552b7,null))['then'](function(_0x107fa5){if(_0x107fa5){_0x57bdc9[_0xc590('0x60')][_0xc590('0x68')]=_0x107fa5['id'];return db[_0xc590('0x70')][_0xc590('0x5f')](_0x57bdc9[_0xc590('0x60')]);}})[_0xc590('0x22')](respondWithResult(_0x1552b7,null))[_0xc590('0x2a')](handleError(_0x1552b7,null));};exports[_0xc590('0x71')]=function(_0x1145a8,_0xb90c15,_0x59c595){var _0x425c9d={'raw':![],'where':{}};var _0x541163={};var _0x5398b8={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xc590('0x72')]({'where':{'id':_0x1145a8[_0xc590('0x5c')]['id']}})[_0xc590('0x22')](handleEntityNotFound(_0xb90c15,null))[_0xc590('0x22')](function(_0x171bf8){if(_0x171bf8){_0x541163[_0xc590('0x47')]=_[_0xc590('0x4a')](db[_0xc590('0x70')][_0xc590('0x43')]);_0x541163['query']=_['keys'](_0x1145a8[_0xc590('0x49')]);_0x541163[_0xc590('0x4b')]=_[_0xc590('0x4c')](_0x541163[_0xc590('0x47')],_0x541163['query']);_0x425c9d[_0xc590('0x4e')]=_['intersection'](_0x541163['model'],qs[_0xc590('0x4d')](_0x1145a8[_0xc590('0x49')]['fields']));_0x425c9d[_0xc590('0x4e')]=_0x425c9d[_0xc590('0x4e')]['length']?_0x425c9d[_0xc590('0x4e')]:_0x541163['model'];if(!_0x1145a8[_0xc590('0x49')][_0xc590('0x4f')]('nolimit')){_0x425c9d[_0xc590('0x30')]=qs[_0xc590('0x30')](_0x1145a8[_0xc590('0x49')][_0xc590('0x30')]);_0x425c9d['offset']=qs[_0xc590('0x2f')](_0x1145a8[_0xc590('0x49')]['offset']);}_0x425c9d[_0xc590('0x50')]=qs['sort'](_0x1145a8[_0xc590('0x49')][_0xc590('0x51')]);_0x425c9d['where']=qs[_0xc590('0x4b')](_[_0xc590('0x6c')](_0x1145a8[_0xc590('0x49')],_0x541163[_0xc590('0x4b')]));_0x425c9d['where']['OpenchannelAccountId']=_0x171bf8['id'];if(_0x1145a8[_0xc590('0x49')][_0xc590('0x53')]){_0x425c9d[_0xc590('0x52')]=_[_0xc590('0x54')](_0x425c9d[_0xc590('0x52')],{'$or':_[_0xc590('0x48')](_0x425c9d[_0xc590('0x4e')],function(_0x5da17a){var _0x4317aa={};_0x4317aa[_0x5da17a]={'$like':'%'+_0x1145a8[_0xc590('0x49')][_0xc590('0x53')]+'%'};return _0x4317aa;})});}_0x425c9d=_[_0xc590('0x54')]({},_0x425c9d,_0x1145a8[_0xc590('0x56')]);return db[_0xc590('0x70')][_0xc590('0x32')]({'where':_0x425c9d[_0xc590('0x52')]})[_0xc590('0x22')](function(_0x3fd303){_0x5398b8[_0xc590('0x32')]=_0x3fd303;if(_0x1145a8[_0xc590('0x49')][_0xc590('0x5e')]){_0x425c9d[_0xc590('0x57')]=[{'all':!![]}];}return db[_0xc590('0x70')]['findAll'](_0x425c9d);})[_0xc590('0x22')](function(_0x3a3de3){_0x5398b8[_0xc590('0x5a')]=_0x3a3de3;return _0x5398b8;});}})['then'](respondWithFilteredResult(_0xb90c15,_0x425c9d))[_0xc590('0x2a')](handleError(_0xb90c15,null));};exports[_0xc590('0x73')]=function(_0x46ecc5,_0x5a21f6,_0x50cc43){return db[_0xc590('0x58')][_0xc590('0x67')]({'where':{'id':_0x46ecc5[_0xc590('0x5c')]['id']}})['then'](handleEntityNotFound(_0x5a21f6,null))[_0xc590('0x22')](function(_0x510cbc){if(_0x510cbc){return _0x510cbc['removeAnswers'](_0x46ecc5[_0xc590('0x49')]['ids']);}})['then'](respondWithStatusCode(_0x5a21f6,null))[_0xc590('0x2a')](handleError(_0x5a21f6,null));};exports[_0xc590('0x74')]=function(_0x215045,_0x1386b2,_0x246cd5){var _0x403a83={'body':_0x215045[_0xc590('0x60')],'channel':_0xc590('0x75')};var _0xbb2f0=[];var _0x1d0166=[];var _0x926dba={};var _0x9e3795=![];return db[_0xc590('0x76')][_0xc590('0x77')]()[_0xc590('0x22')](function(_0x245086){if(!_0x245086){throw new db['Sequelize'][(_0xc590('0x78'))](_0xc590('0x79'));}_0xbb2f0=_[_0xc590('0x7a')](_[_0xc590('0x4a')](_0x245086),[_0xc590('0x7b'),_0xc590('0x7c')]);_0x1d0166=_['difference'](_[_0xc590('0x4a')](_0x245086),[_0xc590('0x7b'),_0xc590('0x7c'),_0xc590('0x7d'),'ListId']);if(_0x215045[_0xc590('0x60')]['id']){delete _0x215045['body']['id'];}if(_[_0xc590('0x7e')](_0x215045[_0xc590('0x60')][_0xc590('0x7f')])){throw new db[(_0xc590('0x80'))][(_0xc590('0x78'))](_0xc590('0x81'));}if(_[_0xc590('0x7e')](_0x215045['body'][_0xc590('0x60')])||_0x215045['body'][_0xc590('0x60')]===''){throw new db[(_0xc590('0x80'))]['ValidationError'](_0xc590('0x82'));}if(_[_0xc590('0x7e')](_0x215045[_0xc590('0x60')][_0xc590('0x83')])){throw new db['Sequelize'][(_0xc590('0x78'))](_0xc590('0x84')+_0x1d0166);}if(!_[_0xc590('0x85')](_0x1d0166,_0x215045['body'][_0xc590('0x83')])){throw new db[(_0xc590('0x80'))][(_0xc590('0x78'))](_0xc590('0x86')+_0x1d0166);}_0x926dba[_0x215045[_0xc590('0x60')][_0xc590('0x83')]]=_0x215045[_0xc590('0x60')][_0xc590('0x7f')];})[_0xc590('0x22')](function(){return db['OpenchannelAccount'][_0xc590('0x67')]({'where':{'id':_0x215045[_0xc590('0x5c')]['id']},'include':[{'model':db[_0xc590('0x87')],'as':_0xc590('0x88'),'include':[{'model':db['CmContact'],'as':_0xc590('0x89'),'where':_0x926dba,'limit':0x1,'order':[[_0xc590('0x7c'),'DESC']]}]},{'model':db[_0xc590('0x8a')],'as':_0xc590('0x8b')}]});})[_0xc590('0x22')](handleEntityNotFound(_0x1386b2,null))[_0xc590('0x22')](function(_0x279b8c){if(_0x279b8c&&_0x279b8c[_0xc590('0x88')]){_0x403a83[_0xc590('0x8c')]=_0x279b8c;_0x403a83[_0xc590('0x8d')]=_0x279b8c[_0xc590('0x8b')];_0x403a83[_0xc590('0x8e')]=_0x279b8c['List'];_0x403a83[_0xc590('0x8d')]=_['orderBy'](_0x403a83[_0xc590('0x8d')],[_0xc590('0x8f')],[_0xc590('0x90')]);if(_0x403a83['account'][_0xc590('0x8b')]){delete _0x403a83['account']['Applications'];}if(_0x403a83[_0xc590('0x8c')][_0xc590('0x88')]&&_0x403a83[_0xc590('0x8c')]['List'][_0xc590('0x89')][_0xc590('0x5d')]){return _0x403a83[_0xc590('0x8c')][_0xc590('0x88')][_0xc590('0x89')][0x0];}var _0x173a9c=_[_0xc590('0x18')](_0x215045[_0xc590('0x60')],{'firstName':_0x215045[_0xc590('0x60')]['from'],'ListId':_0x279b8c[_0xc590('0x91')]});_0x173a9c[_0x215045['body']['mapKey']]=_0x215045[_0xc590('0x60')][_0xc590('0x7f')];return db[_0xc590('0x76')][_0xc590('0x5f')](_0x173a9c,{'fields':_0xbb2f0,'raw':!![]});}})[_0xc590('0x22')](handleEntityNotFound(_0x1386b2,null))[_0xc590('0x22')](function(_0x271c17){_0x403a83[_0xc590('0x92')]=_0x271c17;if(_0x271c17){var _0x11be0a={'ContactId':_0x271c17['id'],'OpenchannelAccountId':_0x215045['params']['id'],'from':(_0x271c17['firstName']||'')+'\x20'+(_0x271c17[_0xc590('0x93')]||'')};var _0x2fe0bd={'OpenchannelAccountId':_0x215045[_0xc590('0x5c')]['id'],'closed':![]};if(_0x215045[_0xc590('0x60')]['threadId']){_0x2fe0bd[_0xc590('0x94')]=_0x215045[_0xc590('0x60')][_0xc590('0x94')];return db[_0xc590('0x95')][_0xc590('0x67')]({'where':_0x2fe0bd})[_0xc590('0x22')](function(_0x5d0086){if(_0x5d0086){return[_0x5d0086,![]];}_0x11be0a['threadId']=_0x215045[_0xc590('0x60')][_0xc590('0x94')];_0x11be0a[_0xc590('0x96')]=_0x215045[_0xc590('0x60')]['externalUrl'];return db['OpenchannelInteraction'][_0xc590('0x5f')](_0x11be0a)[_0xc590('0x22')](function(_0x1c5ac2){return[_0x1c5ac2,!![]];});});}else{_0x2fe0bd[_0xc590('0x94')]=null;}_0x2fe0bd[_0xc590('0x97')]=_0x271c17['id'];return db[_0xc590('0x95')][_0xc590('0x67')]({'where':_0x2fe0bd})[_0xc590('0x22')](function(_0x1f1ab6){if(_0x1f1ab6){return[_0x1f1ab6,![]];}return db[_0xc590('0x95')][_0xc590('0x5f')](_0x11be0a)[_0xc590('0x22')](function(_0x372cfb){return[_0x372cfb,!![]];});});}})[_0xc590('0x98')](function(_0x297668,_0x571d38){if(_0x297668){_0x9e3795=_0x571d38;if(!_0x571d38){var _0x32b159={'from':(_0x403a83[_0xc590('0x92')][_0xc590('0x99')]||'')+'\x20'+(_0x403a83[_0xc590('0x92')]['lastName']||'')};if(_0x215045['body'][_0xc590('0x94')]&&_0x215045['body'][_0xc590('0x9a')]&&_0x215045[_0xc590('0x60')][_0xc590('0x94')]!=_0x215045[_0xc590('0x60')][_0xc590('0x9a')]){_0x32b159['threadId']=_0x215045[_0xc590('0x60')][_0xc590('0x9a')];}return _0x297668[_0xc590('0x38')](_0x32b159);}else{return _0x297668;}}})[_0xc590('0x22')](function(_0x4eec01){_0x403a83[_0xc590('0x9b')]=_0x4eec01['get']({'plain':!![]});_0x403a83['interaction']['created']=_0x9e3795;if(_0x403a83[_0xc590('0x9b')][_0xc590('0x9c')]){if(_0x403a83['account']['autoclose']){_0x403a83['applications']['push']({'id':0x0,'priority':_0x403a83[_0xc590('0x8d')][_0xc590('0x5d')]+0x1,'app':_0xc590('0x9d'),'appdata':_0xc590('0x9e'),'interval':'*,*,*,*'});}}return db[_0xc590('0x9f')][_0xc590('0x5f')]({'body':_0x215045['body']['body'],'OpenchannelAccountId':_0x215045[_0xc590('0x5c')]['id'],'OpenchannelInteractionId':_0x4eec01['id'],'direction':'in','ContactId':_0x403a83[_0xc590('0x92')]['id'],'AttachmentId':_0x215045[_0xc590('0x60')][_0xc590('0xa0')]});})[_0xc590('0x22')](function(_0x41803a){_0x403a83[_0xc590('0x29')]=_0x41803a;if(_0x403a83['interaction'][_0xc590('0xa1')]){return db[_0xc590('0xa2')]['find']({'attributes':['id',_0xc590('0x3e')],'where':{'id':_0x403a83['interaction'][_0xc590('0xa1')]}})[_0xc590('0x22')](function(_0x9c122f){if(_0x9c122f){_0x403a83['applications'][_0xc590('0xa3')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x9c122f['name']+','+(_0x403a83[_0xc590('0x8c')][_0xc590('0xa4')]||0xa),'interval':_0xc590('0xa5')});_0x403a83[_0xc590('0xa6')]=![];}return respondWithRpcPromise(_0xc590('0xa7'),_0xc590('0xa8'),_0x403a83);});}return respondWithRpcPromise('Start',_0xc590('0xa8'),_0x403a83);})[_0xc590('0x22')](function(_0x561519){respondWithRpcPromise(_0xc590('0xa9'),_0xc590('0xa9'),{'event':'notify','message':_0x561519},client9002);return _0x561519;})[_0xc590('0x22')](respondWithResult(_0x1386b2,null))[_0xc590('0x2a')](handleError(_0x1386b2,null));};exports[_0xc590('0xaa')]=function(_0xf5cebf,_0x38aced){var _0x488d24=_0xf5cebf['params']['id'];var _0x3c9519=_0xf5cebf[_0xc590('0x60')];var _0x16a45d=0xc8;var _0x38206f=null;return db[_0xc590('0xab')][_0xc590('0xac')]({'isolationLevel':db[_0xc590('0xab')][_0xc590('0xad')][_0xc590('0xae')]['READ_COMMITTED']},function(_0xa7a48b){return db[_0xc590('0x58')][_0xc590('0x72')]({'where':{'id':_0x488d24},'transaction':_0xa7a48b})[_0xc590('0x22')](function(_0x41d943){if(_0x41d943){return db[_0xc590('0x8a')][_0xc590('0x39')]({'where':{'OpenchannelAccountId':_0x488d24},'transaction':_0xa7a48b})[_0xc590('0x22')](function(){var _0xdeeb98=_[_0xc590('0x48')](_0x3c9519,function(_0x452f06){_0x452f06[_0xc590('0x68')]=_0x488d24;return _0x452f06;});return db['OpenchannelApplication'][_0xc590('0xaf')](_0xdeeb98,{'transaction':_0xa7a48b});});}else{_0x16a45d=0x194;_0x38206f=[];}});})['then'](function(){if(_0x16a45d!==0x194){return db['OpenchannelApplication'][_0xc590('0xb0')]({'where':{'OpenchannelAccountId':_0x488d24},'order':_0xc590('0x8f')})['then'](function(_0x1b291d){_0x38206f=_0x1b291d;});}})[_0xc590('0x2a')](function(_0x220c6a){_0x16a45d=0x1f4;logger[_0xc590('0x28')](_0x220c6a[_0xc590('0x3d')]);if(_0x220c6a[_0xc590('0x3e')]){delete _0x220c6a['name'];}_0x38206f=_0x220c6a;})[_0xc590('0xb1')](function(){if(_0x38206f===null){_0x38aced[_0xc590('0x2b')](_0x16a45d);}else{if(_0x16a45d===0x1f4){_0x38aced[_0xc590('0x2c')](_0x16a45d)[_0xc590('0x3f')](_0x38206f);}else{_0x38aced[_0xc590('0x2c')](_0x16a45d)[_0xc590('0x2e')](_0x38206f);}}});};exports[_0xc590('0xb2')]=function(_0x2006c3,_0x518ecd,_0x3c9b22){var _0x54025d={};var _0x53f0e3={};var _0x792227;var _0x4b4e31;return db[_0xc590('0x58')][_0xc590('0x72')]({'where':{'id':_0x2006c3[_0xc590('0x5c')]['id']}})[_0xc590('0x22')](handleEntityNotFound(_0x518ecd,null))[_0xc590('0x22')](function(_0x108b9c){if(_0x108b9c){_0x792227=_0x108b9c;_0x53f0e3[_0xc590('0x47')]=_[_0xc590('0x4a')](db[_0xc590('0x8a')][_0xc590('0x43')]);_0x53f0e3['query']=_[_0xc590('0x4a')](_0x2006c3[_0xc590('0x49')]);_0x53f0e3[_0xc590('0x4b')]=_[_0xc590('0x4c')](_0x53f0e3[_0xc590('0x47')],_0x53f0e3[_0xc590('0x49')]);_0x54025d[_0xc590('0x4e')]=_[_0xc590('0x4c')](_0x53f0e3['model'],qs[_0xc590('0x4d')](_0x2006c3[_0xc590('0x49')]['fields']));_0x54025d[_0xc590('0x4e')]=_0x54025d[_0xc590('0x4e')]['length']?_0x54025d[_0xc590('0x4e')]:_0x53f0e3[_0xc590('0x47')];_0x54025d['order']=qs[_0xc590('0x51')](_0x2006c3[_0xc590('0x49')][_0xc590('0x51')]);_0x54025d[_0xc590('0x52')]=qs[_0xc590('0x4b')](_[_0xc590('0x6c')](_0x2006c3[_0xc590('0x49')],_0x53f0e3[_0xc590('0x4b')]));if(_0x2006c3['query']['filter']){_0x54025d[_0xc590('0x52')]=_['merge'](_0x54025d[_0xc590('0x52')],{'$or':_[_0xc590('0x48')](_0x54025d['attributes'],function(_0x55efc9){var _0x289b75={};_0x289b75[_0x55efc9]={'$like':'%'+_0x2006c3[_0xc590('0x49')][_0xc590('0x53')]+'%'};return _0x289b75;})});}_0x54025d=_[_0xc590('0x54')]({},_0x54025d,_0x2006c3[_0xc590('0x56')]);return _0x792227[_0xc590('0xb2')](_0x54025d);}})[_0xc590('0x22')](function(_0x3bc222){if(_0x3bc222){_0x4b4e31=_0x3bc222[_0xc590('0x5d')];if(!_0x2006c3['query']['hasOwnProperty'](_0xc590('0x6b'))){_0x54025d['limit']=qs[_0xc590('0x30')](_0x2006c3[_0xc590('0x49')][_0xc590('0x30')]);_0x54025d['offset']=qs['offset'](_0x2006c3['query'][_0xc590('0x2f')]);}return _0x792227[_0xc590('0xb2')](_0x54025d);}})['then'](function(_0x25590e){if(_0x25590e){return _0x25590e?{'count':_0x4b4e31,'rows':_0x25590e}:null;}})[_0xc590('0x22')](respondWithResult(_0x518ecd,null))[_0xc590('0x2a')](handleError(_0x518ecd,null));};exports[_0xc590('0xb3')]=function(_0x5f1105,_0x335698,_0x53131f){var _0x47f57c={'raw':![],'where':{}};var _0x158f0b={};var _0x3e5763={'count':0x0,'rows':[]};return db[_0xc590('0x58')][_0xc590('0x72')]({'where':{'id':_0x5f1105[_0xc590('0x5c')]['id']}})[_0xc590('0x22')](handleEntityNotFound(_0x335698,null))[_0xc590('0x22')](function(_0x554cf0){if(_0x554cf0){_0x158f0b[_0xc590('0x47')]=_[_0xc590('0x4a')](db[_0xc590('0x95')][_0xc590('0x43')]);_0x158f0b[_0xc590('0x49')]=_[_0xc590('0x4a')](_0x5f1105['query']);_0x158f0b[_0xc590('0x4b')]=_[_0xc590('0x4c')](_0x158f0b[_0xc590('0x47')],_0x158f0b[_0xc590('0x49')]);_0x47f57c[_0xc590('0x4e')]=_[_0xc590('0x4c')](_0x158f0b[_0xc590('0x47')],qs[_0xc590('0x4d')](_0x5f1105[_0xc590('0x49')][_0xc590('0x4d')]));_0x47f57c[_0xc590('0x4e')]=_0x47f57c['attributes']['length']?_0x47f57c[_0xc590('0x4e')]:_0x158f0b[_0xc590('0x47')];if(!_0x5f1105[_0xc590('0x49')]['hasOwnProperty']('nolimit')){_0x47f57c['limit']=qs[_0xc590('0x30')](_0x5f1105[_0xc590('0x49')][_0xc590('0x30')]);_0x47f57c[_0xc590('0x2f')]=qs['offset'](_0x5f1105[_0xc590('0x49')][_0xc590('0x2f')]);}_0x47f57c[_0xc590('0x50')]=qs['sort'](_0x5f1105[_0xc590('0x49')]['sort']);_0x47f57c['where']=qs['filters'](_[_0xc590('0x6c')](_0x5f1105['query'],_0x158f0b[_0xc590('0x4b')]));_0x47f57c[_0xc590('0x52')][_0xc590('0x68')]=_0x554cf0['id'];if(_0x5f1105[_0xc590('0x49')][_0xc590('0x53')]){_0x47f57c[_0xc590('0x52')]=_[_0xc590('0x54')](_0x47f57c[_0xc590('0x52')],{'$or':_[_0xc590('0x48')](_0x47f57c['attributes'],function(_0x35bfcf){var _0x1a12de={};_0x1a12de[_0x35bfcf]={'$like':'%'+_0x5f1105['query'][_0xc590('0x53')]+'%'};return _0x1a12de;})});}_0x47f57c=_['merge']({},_0x47f57c,_0x5f1105[_0xc590('0x56')]);return db['OpenchannelInteraction']['count']({'where':_0x47f57c[_0xc590('0x52')]})[_0xc590('0x22')](function(_0x5944a3){_0x3e5763[_0xc590('0x32')]=_0x5944a3;if(_0x5f1105[_0xc590('0x49')][_0xc590('0x5e')]){_0x47f57c[_0xc590('0x57')]=[{'model':db[_0xc590('0x76')],'as':_0xc590('0xb4'),'required':![]},{'model':db[_0xc590('0xa2')],'as':_0xc590('0xb5'),'attributes':['name',_0xc590('0xb6'),_0xc590('0xb7')],'required':![]},{'model':db[_0xc590('0xb8')],'as':_0xc590('0xb9'),'attributes':['id','name','color'],'where':_0x5f1105[_0xc590('0x49')][_0xc590('0xba')]?{'id':_0x5f1105[_0xc590('0x49')][_0xc590('0xba')]}:undefined,'required':_0x5f1105[_0xc590('0x49')]['tag']?!![]:![]}];}return db[_0xc590('0x95')][_0xc590('0x59')](_0x47f57c);})[_0xc590('0x22')](function(_0x4b4508){_0x3e5763[_0xc590('0x5a')]=_0x4b4508;return _0x3e5763;});}})[_0xc590('0x22')](respondWithFilteredResult(_0x335698,_0x47f57c))['catch'](handleError(_0x335698,null));};exports['addAgents']=function(_0x55a816,_0x26fa87,_0x3db1cc){return db[_0xc590('0x58')][_0xc590('0x67')]({'where':{'id':_0x55a816[_0xc590('0x5c')]['id']}})[_0xc590('0x22')](handleEntityNotFound(_0x26fa87,null))[_0xc590('0x22')](function(_0x32379a){if(_0x32379a){return _0x32379a[_0xc590('0xbb')](_0x55a816[_0xc590('0x60')][_0xc590('0x6e')],_[_0xc590('0xbc')](_0x55a816[_0xc590('0x60')],[_0xc590('0x6e'),'id'])||{})[_0xc590('0x98')](function(_0x37ad4a){for(var _0x14ab32=0x0;_0x14ab32<_0x55a816[_0xc590('0x60')][_0xc590('0x6e')][_0xc590('0x5d')];_0x14ab32+=0x1){socket['emit'](_0xc590('0xbd'),{'UserId':Number(_0x55a816['body'][_0xc590('0x6e')][_0x14ab32]),'OpenchannelAccountId':Number(_0x55a816[_0xc590('0x5c')]['id'])});}return _0x37ad4a;});}})[_0xc590('0x22')](respondWithResult(_0x26fa87,null))['catch'](handleError(_0x26fa87,null));};exports['removeAgents']=function(_0x554ed8,_0x488497,_0x4e85cb){return db[_0xc590('0x58')][_0xc590('0x67')]({'where':{'id':_0x554ed8[_0xc590('0x5c')]['id']}})['then'](handleEntityNotFound(_0x488497,null))[_0xc590('0x22')](function(_0x20b20a){if(_0x20b20a){return _0x20b20a[_0xc590('0xbe')](_0x554ed8['query'][_0xc590('0x6e')])['then'](function(){if(_[_0xc590('0xbf')](_0x554ed8[_0xc590('0x49')][_0xc590('0x6e')])){for(var _0x469cec=0x0;_0x469cec<_0x554ed8[_0xc590('0x49')][_0xc590('0x6e')][_0xc590('0x5d')];_0x469cec+=0x1){socket[_0xc590('0xc0')](_0xc590('0xc1'),{'UserId':Number(_0x554ed8[_0xc590('0x49')][_0xc590('0x6e')][_0x469cec]),'OpenchannelAccountId':Number(_0x554ed8[_0xc590('0x5c')]['id'])});}}else{socket['emit'](_0xc590('0xc1'),{'UserId':Number(_0x554ed8['query'][_0xc590('0x6e')]),'OpenchannelAccountId':Number(_0x554ed8[_0xc590('0x5c')]['id'])});}});}})[_0xc590('0x22')](respondWithStatusCode(_0x488497,null))['catch'](handleError(_0x488497,null));};exports[_0xc590('0xc2')]=function(_0x51b774,_0x4a10f3,_0x3e9965){var _0x4ef4ff={};var _0x257932={};var _0x3d9a7a;var _0x2c12e3;return db['OpenchannelAccount']['findOne']({'where':{'id':_0x51b774[_0xc590('0x5c')]['id']}})[_0xc590('0x22')](handleEntityNotFound(_0x4a10f3,null))[_0xc590('0x22')](function(_0x260123){if(_0x260123){_0x3d9a7a=_0x260123;_0x257932[_0xc590('0x47')]=_[_0xc590('0x4a')](db['User'][_0xc590('0x43')]);_0x257932[_0xc590('0x49')]=_[_0xc590('0x4a')](_0x51b774['query']);_0x257932[_0xc590('0x4b')]=_[_0xc590('0x4c')](_0x257932['model'],_0x257932['query']);_0x4ef4ff[_0xc590('0x4e')]=_['intersection'](_0x257932[_0xc590('0x47')],qs[_0xc590('0x4d')](_0x51b774[_0xc590('0x49')][_0xc590('0x4d')]));_0x4ef4ff['attributes']=_0x4ef4ff[_0xc590('0x4e')]['length']?_0x4ef4ff['attributes']:_0x257932[_0xc590('0x47')];_0x4ef4ff[_0xc590('0x50')]=qs[_0xc590('0x51')](_0x51b774['query'][_0xc590('0x51')]);_0x4ef4ff[_0xc590('0x52')]=qs[_0xc590('0x4b')](_[_0xc590('0x6c')](_0x51b774[_0xc590('0x49')],_0x257932[_0xc590('0x4b')]));if(_0x51b774[_0xc590('0x49')]['filter']){_0x4ef4ff[_0xc590('0x52')]=_[_0xc590('0x54')](_0x4ef4ff[_0xc590('0x52')],{'$or':_['map'](_0x4ef4ff[_0xc590('0x4e')],function(_0x33d377){var _0x2ff228={};_0x2ff228[_0x33d377]={'$like':'%'+_0x51b774[_0xc590('0x49')]['filter']+'%'};return _0x2ff228;})});}_0x4ef4ff=_[_0xc590('0x54')]({},_0x4ef4ff,_0x51b774[_0xc590('0x56')]);return _0x3d9a7a['getAgents'](_0x4ef4ff);}})[_0xc590('0x22')](function(_0x795fda){if(_0x795fda){_0x2c12e3=_0x795fda['length'];if(!_0x51b774['query'][_0xc590('0x4f')](_0xc590('0x6b'))){_0x4ef4ff[_0xc590('0x30')]=qs['limit'](_0x51b774[_0xc590('0x49')][_0xc590('0x30')]);_0x4ef4ff[_0xc590('0x2f')]=qs[_0xc590('0x2f')](_0x51b774['query'][_0xc590('0x2f')]);}return _0x3d9a7a[_0xc590('0xc2')](_0x4ef4ff);}})[_0xc590('0x22')](function(_0x1d12b5){if(_0x1d12b5){return _0x1d12b5?{'count':_0x2c12e3,'rows':_0x1d12b5}:null;}})['then'](respondWithResult(_0x4a10f3,null))[_0xc590('0x2a')](handleError(_0x4a10f3,null));};exports[_0xc590('0x3f')]=function(_0x21d7a3,_0x511820,_0x4f819d){var _0x5bb1d3,_0x51f0e9,_0x119d48;if(_[_0xc590('0x7e')](_0x21d7a3['body'][_0xc590('0x60')])||_0x21d7a3[_0xc590('0x60')][_0xc590('0x60')]===''){throw new db['Sequelize'][(_0xc590('0x78'))](_0xc590('0x82'));}if(_[_0xc590('0x7e')](_0x21d7a3[_0xc590('0x60')]['to'])){}_0x5bb1d3=_0x21d7a3[_0xc590('0x60')]['to'];return db[_0xc590('0x58')]['findOne']({'where':{'id':_0x21d7a3[_0xc590('0x5c')]['id']}})['then'](handleEntityNotFound(_0x511820,null))[_0xc590('0x22')](function(_0x51f6ba){if(_0x51f6ba){return db[_0xc590('0x58')]['find']({'where':{'id':_0x51f6ba['id']},'include':[{'model':db['CmList'],'as':_0xc590('0x88'),'include':[{'model':db[_0xc590('0x76')],'as':'Contacts','where':{[_0x51f6ba[_0xc590('0x83')]]:_0x5bb1d3},'limit':0x1,'order':[['updatedAt',_0xc590('0xc3')]]}]}]})[_0xc590('0x22')](handleEntityNotFound(_0x511820,null))['then'](function(_0x480492){if(_0x480492&&_0x480492[_0xc590('0x88')]){_0x51f0e9=_0x480492[_0xc590('0x3a')]({'plain':!![]});if(_0x51f0e9['List']&&_0x51f0e9[_0xc590('0x88')]['Contacts']['length']){return _0x51f0e9[_0xc590('0x88')][_0xc590('0x89')][0x0];}return db['CmContact'][_0xc590('0x5f')](_['defaults'](_0x21d7a3[_0xc590('0x60')],{'firstName':_0x5bb1d3,[_0x480492[_0xc590('0x83')]]:_0x5bb1d3,'phone':_0x5bb1d3,'ListId':_0x51f0e9['ListId']}));}})['then'](handleEntityNotFound(_0x511820,null))[_0xc590('0x22')](function(_0x1fdd43){if(_0x1fdd43){_0x119d48=_0x1fdd43;return db['OpenchannelInteraction'][_0xc590('0x67')]({'where':{'ContactId':_0x119d48['id'],'closed':![],'OpenchannelAccountId':_0x51f0e9['id']}})[_0xc590('0x22')](function(_0x11bc98){if(_0x11bc98){return[_0x11bc98,![]];}return db[_0xc590('0x95')][_0xc590('0x5f')]({'UserId':_0x21d7a3[_0xc590('0x63')]['id'],'ContactId':_0x119d48['id'],'OpenchannelAccountId':_0x51f0e9['id'],'lastMsgDirection':_0xc590('0xc4'),'firstMsgDirection':_0xc590('0xc4'),'Messages':[_[_0xc590('0x54')](_0x21d7a3['body'],{'read':![],'body':_0x21d7a3[_0xc590('0x60')]['body'],'OpenchannelAccountId':_0x51f0e9['id'],'UserId':_0x21d7a3[_0xc590('0x63')]['id'],'ContactId':_0x119d48['id']})]},{'include':[{'model':db[_0xc590('0x9f')],'as':_0xc590('0xc5')}]})[_0xc590('0x22')](function(_0x3cab3f){return[_0x3cab3f,!![]];});});}})[_0xc590('0x98')](function(_0x281aa3,_0xad4f01){if(_0xad4f01){return _0x281aa3;}return db[_0xc590('0x9f')][_0xc590('0x5f')](_[_0xc590('0x54')](_0x21d7a3[_0xc590('0x60')],{'read':![],'body':_0x21d7a3[_0xc590('0x60')][_0xc590('0x60')],'OpenchannelAccountId':_0x51f0e9['id'],'OpenchannelInteractionId':_0x281aa3['id'],'UserId':_0x21d7a3['user']['id'],'ContactId':_0x119d48['id']}))[_0xc590('0x22')](function(_0x360e44){_0x281aa3['dataValues'][_0xc590('0xc5')]=[];_0x281aa3[_0xc590('0xc6')][_0xc590('0xc5')][_0xc590('0xc7')](_0x360e44[_0xc590('0xc6')]);return _0x281aa3;});});}})['then'](respondWithResult(_0x511820,null))[_0xc590('0x2a')](handleError(_0x511820,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index d6de4f3..f9357af 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 _0x91a7=['../../mysqldb','OpenchannelAccount','setMaxListeners','update','emit','hasOwnProperty','exports'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x91a7,0xe7));var _0x791a=function(_0x5299c8,_0x27f2f5){_0x5299c8=_0x5299c8-0x0;var _0x24c8f2=_0x91a7[_0x5299c8];return _0x24c8f2;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0x791a('0x0'))['db'][_0x791a('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x791a('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x791a('0x3'),'afterDestroy':'remove'};function emitEvent(_0x2f6392){return function(_0x535640,_0x50ab29,_0x32fe2b){OpenchannelAccountEvents[_0x791a('0x4')](_0x2f6392+':'+_0x535640['id'],_0x535640);OpenchannelAccountEvents['emit'](_0x2f6392,_0x535640);_0x32fe2b(null);};}for(var e in events){if(events[_0x791a('0x5')](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module[_0x791a('0x6')]=OpenchannelAccountEvents; \ No newline at end of file +var _0xe5b5=['hook','exports','events','../../mysqldb','OpenchannelAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x1d0d59,_0x370c2a){var _0x20d4f6=function(_0xc6f963){while(--_0xc6f963){_0x1d0d59['push'](_0x1d0d59['shift']());}};_0x20d4f6(++_0x370c2a);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x91d019,_0x5223c4){_0x91d019=_0x91d019-0x0;var _0x19de1f=_0xe5b5[_0x91d019];return _0x19de1f;};'use strict';var EventEmitter=require(_0x5e5b('0x0'));var OpenchannelAccount=require(_0x5e5b('0x1'))['db'][_0x5e5b('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x5e5b('0x3')](0x0);var events={'afterCreate':_0x5e5b('0x4'),'afterUpdate':_0x5e5b('0x5'),'afterDestroy':_0x5e5b('0x6')};function emitEvent(_0x3dc763){return function(_0xf20c6a,_0x20a50c,_0xdc6616){OpenchannelAccountEvents[_0x5e5b('0x7')](_0x3dc763+':'+_0xf20c6a['id'],_0xf20c6a);OpenchannelAccountEvents[_0x5e5b('0x7')](_0x3dc763,_0xf20c6a);_0xdc6616(null);};}for(var e in events){if(events[_0x5e5b('0x8')](e)){var event=events[e];OpenchannelAccount[_0x5e5b('0x9')](e,emitEvent(event));}}module[_0x5e5b('0xa')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 340c3ae..aa5a703 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(_0xb093eb,_0x413652){var _0x2d2f1d=function(_0x3d7d4c){while(--_0x3d7d4c){_0xb093eb['push'](_0xb093eb['shift']());}};_0x2d2f1d(++_0x413652);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xa9e0[_0x2576d7];return _0x16a08c;};'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(_0x537bfb,_0x427ee9){var _0x192e2f=function(_0x5554e1){while(--_0x5554e1){_0x537bfb['push'](_0x537bfb['shift']());}};_0x192e2f(++_0x427ee9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'openchannel_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.rpc.js b/server/api/openchannelAccount/openchannelAccount.rpc.js index 64db31a..49966f2 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 _0x57f8=['message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./openchannelAccount.socket','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3b40c7,_0x4c7106){var _0x57941f=function(_0x46a3e1){while(--_0x46a3e1){_0x3b40c7['push'](_0x3b40c7['shift']());}};_0x57941f(++_0x4c7106);}(_0x57f8,0x198));var _0x857f=function(_0x51a0a9,_0x569499){_0x51a0a9=_0x51a0a9-0x0;var _0x4bd20c=_0x57f8[_0x51a0a9];return _0x4bd20c;};'use strict';var _=require('lodash');var util=require(_0x857f('0x0'));var moment=require(_0x857f('0x1'));var BPromise=require(_0x857f('0x2'));var rs=require(_0x857f('0x3'));var fs=require('fs');var Redis=require(_0x857f('0x4'));var db=require(_0x857f('0x5'))['db'];var utils=require(_0x857f('0x6'));var logger=require(_0x857f('0x7'))(_0x857f('0x8'));var config=require(_0x857f('0x9'));var jayson=require(_0x857f('0xa'));var client=jayson[_0x857f('0xb')]['http']({'port':0x232a});config[_0x857f('0xc')]=_[_0x857f('0xd')](config[_0x857f('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x857f('0xe'))(new Redis(config[_0x857f('0xc')]));require(_0x857f('0xf'))['register'](socket);function respondWithRpcPromise(_0x1e306e,_0x2ef315,_0x370126){return new BPromise(function(_0x5cc993,_0xefee53){return client[_0x857f('0x10')](_0x1e306e,_0x370126)[_0x857f('0x11')](function(_0x11adfd){logger[_0x857f('0x12')](_0x857f('0x13'),_0x2ef315,_0x857f('0x14'));logger['debug'](_0x857f('0x15'),_0x2ef315,_0x857f('0x14'),JSON[_0x857f('0x16')](_0x11adfd));if(_0x11adfd[_0x857f('0x17')]){if(_0x11adfd[_0x857f('0x17')]['code']===0x1f4){logger['error'](_0x857f('0x13'),_0x2ef315,_0x11adfd['error'][_0x857f('0x18')]);return _0xefee53(_0x11adfd['error'][_0x857f('0x18')]);}logger[_0x857f('0x17')]('OpenchannelAccount,\x20%s,\x20%s',_0x2ef315,_0x11adfd[_0x857f('0x17')][_0x857f('0x18')]);return _0x5cc993(_0x11adfd[_0x857f('0x17')][_0x857f('0x18')]);}else{logger[_0x857f('0x12')](_0x857f('0x13'),_0x2ef315,_0x857f('0x14'));_0x5cc993(_0x11adfd[_0x857f('0x19')][_0x857f('0x18')]);}})[_0x857f('0x1a')](function(_0x8e11f1){logger['error'](_0x857f('0x13'),_0x2ef315,_0x8e11f1);_0xefee53(_0x8e11f1);});});} \ No newline at end of file +var _0x8f59=['redis','localhost','socket.io-emitter','register','info','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','OpenchannelAccount,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8f59,0x11d));var _0x98f5=function(_0x18e5c7,_0x392a80){_0x18e5c7=_0x18e5c7-0x0;var _0x55f2f0=_0x8f59[_0x18e5c7];return _0x55f2f0;};'use strict';var _=require(_0x98f5('0x0'));var util=require(_0x98f5('0x1'));var moment=require(_0x98f5('0x2'));var BPromise=require(_0x98f5('0x3'));var rs=require(_0x98f5('0x4'));var fs=require('fs');var Redis=require(_0x98f5('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x98f5('0x6'));var logger=require(_0x98f5('0x7'))(_0x98f5('0x8'));var config=require(_0x98f5('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x98f5('0xa')][_0x98f5('0xb')]({'port':0x232a});config[_0x98f5('0xc')]=_['defaults'](config['redis'],{'host':_0x98f5('0xd'),'port':0x18eb});var socket=require(_0x98f5('0xe'))(new Redis(config[_0x98f5('0xc')]));require('./openchannelAccount.socket')[_0x98f5('0xf')](socket);function respondWithRpcPromise(_0x31b669,_0x227cf3,_0x39e85d){return new BPromise(function(_0x4c4abc,_0x26a0fc){return client['request'](_0x31b669,_0x39e85d)['then'](function(_0x3cf4b2){logger[_0x98f5('0x10')]('OpenchannelAccount,\x20%s,\x20%s',_0x227cf3,_0x98f5('0x11'));logger[_0x98f5('0x12')](_0x98f5('0x13'),_0x227cf3,_0x98f5('0x11'),JSON[_0x98f5('0x14')](_0x3cf4b2));if(_0x3cf4b2[_0x98f5('0x15')]){if(_0x3cf4b2['error'][_0x98f5('0x16')]===0x1f4){logger[_0x98f5('0x15')]('OpenchannelAccount,\x20%s,\x20%s',_0x227cf3,_0x3cf4b2[_0x98f5('0x15')][_0x98f5('0x17')]);return _0x26a0fc(_0x3cf4b2[_0x98f5('0x15')]['message']);}logger[_0x98f5('0x15')](_0x98f5('0x18'),_0x227cf3,_0x3cf4b2[_0x98f5('0x15')]['message']);return _0x4c4abc(_0x3cf4b2[_0x98f5('0x15')][_0x98f5('0x17')]);}else{logger['info'](_0x98f5('0x18'),_0x227cf3,'request\x20sent');_0x4c4abc(_0x3cf4b2[_0x98f5('0x19')][_0x98f5('0x17')]);}})[_0x98f5('0x1a')](function(_0x11b6d4){logger[_0x98f5('0x15')](_0x98f5('0x18'),_0x227cf3,_0x11b6d4);_0x26a0fc(_0x11b6d4);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 95e5c1e..2d7c2f2 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 _0x7846=['update','removeListener','register','openchannelAccount:','save','remove'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0x7846,0xf4));var _0x6784=function(_0x2cff4f,_0x21e344){_0x2cff4f=_0x2cff4f-0x0;var _0x3df848=_0x7846[_0x2cff4f];return _0x3df848;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=[_0x6784('0x0'),_0x6784('0x1'),_0x6784('0x2')];function createListener(_0xebf76a,_0x3c868d){return function(_0x7653ef){_0x3c868d['emit'](_0xebf76a,_0x7653ef);};}function removeListener(_0x13ba3e,_0x24c16b){return function(){OpenchannelAccountEvents[_0x6784('0x3')](_0x13ba3e,_0x24c16b);};}exports[_0x6784('0x4')]=function(_0x327e26){for(var _0x409fe1=0x0,_0x43df2a=events['length'];_0x409fe1<_0x43df2a;_0x409fe1++){var _0x560e3f=events[_0x409fe1];var _0x289ae9=createListener(_0x6784('0x5')+_0x560e3f,_0x327e26);OpenchannelAccountEvents['on'](_0x560e3f,_0x289ae9);}}; \ No newline at end of file +var _0x0a9a=['update','register','openchannelAccount:','save'];(function(_0x1c3ed8,_0x40849b){var _0x207388=function(_0x57954b){while(--_0x57954b){_0x1c3ed8['push'](_0x1c3ed8['shift']());}};_0x207388(++_0x40849b);}(_0x0a9a,0x183));var _0xa0a9=function(_0x55a39e,_0x4a5bb9){_0x55a39e=_0x55a39e-0x0;var _0x183782=_0x0a9a[_0x55a39e];return _0x183782;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=[_0xa0a9('0x0'),'remove',_0xa0a9('0x1')];function createListener(_0x3cff22,_0x34801b){return function(_0x49162f){_0x34801b['emit'](_0x3cff22,_0x49162f);};}function removeListener(_0x317a94,_0x360be5){return function(){OpenchannelAccountEvents['removeListener'](_0x317a94,_0x360be5);};}exports[_0xa0a9('0x2')]=function(_0xc65bbb){for(var _0x1aa717=0x0,_0x31d689=events['length'];_0x1aa717<_0x31d689;_0x1aa717++){var _0x2b2eb4=events[_0x1aa717];var _0x520f42=createListener(_0xa0a9('0x3')+_0x2b2eb4,_0xc65bbb);OpenchannelAccountEvents['on'](_0x2b2eb4,_0x520f42);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 81a14c7..cfce2b0 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 _0x8b98=['./openchannelApplication.controller','isAuthenticated','index','/:id','create','delete','destroy','multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2bf80d,_0x5874fd){var _0x24909d=function(_0x1bcb0b){while(--_0x1bcb0b){_0x2bf80d['push'](_0x2bf80d['shift']());}};_0x24909d(++_0x5874fd);}(_0x8b98,0x13b));var _0x88b9=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0x8b98[_0x134c2e];return _0x2825db;};'use strict';var multer=require(_0x88b9('0x0'));var util=require(_0x88b9('0x1'));var path=require(_0x88b9('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x88b9('0x3'));var auth=require(_0x88b9('0x4'));var interaction=require(_0x88b9('0x5'));var config=require(_0x88b9('0x6'));var controller=require(_0x88b9('0x7'));router['get']('/',auth[_0x88b9('0x8')](),controller[_0x88b9('0x9')]);router['get'](_0x88b9('0xa'),auth[_0x88b9('0x8')](),controller['show']);router['post']('/',auth[_0x88b9('0x8')](),controller[_0x88b9('0xb')]);router['put'](_0x88b9('0xa'),auth[_0x88b9('0x8')](),controller['update']);router[_0x88b9('0xc')](_0x88b9('0xa'),auth['isAuthenticated'](),controller[_0x88b9('0xd')]);module['exports']=router; \ No newline at end of file +var _0xa429=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelApplication.controller','get','isAuthenticated','index','show','post','put','/:id','update','delete','exports','multer'];(function(_0x349a9e,_0x473cb8){var _0x24c207=function(_0x22f148){while(--_0x22f148){_0x349a9e['push'](_0x349a9e['shift']());}};_0x24c207(++_0x473cb8);}(_0xa429,0xdb));var _0x9a42=function(_0x8ccfa5,_0x491de9){_0x8ccfa5=_0x8ccfa5-0x0;var _0x5b284d=_0xa429[_0x8ccfa5];return _0x5b284d;};'use strict';var multer=require(_0x9a42('0x0'));var util=require(_0x9a42('0x1'));var path=require(_0x9a42('0x2'));var timeout=require(_0x9a42('0x3'));var express=require(_0x9a42('0x4'));var router=express[_0x9a42('0x5')]();var fs_extra=require(_0x9a42('0x6'));var auth=require(_0x9a42('0x7'));var interaction=require(_0x9a42('0x8'));var config=require('../../config/environment');var controller=require(_0x9a42('0x9'));router[_0x9a42('0xa')]('/',auth[_0x9a42('0xb')](),controller[_0x9a42('0xc')]);router[_0x9a42('0xa')]('/:id',auth[_0x9a42('0xb')](),controller[_0x9a42('0xd')]);router[_0x9a42('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x9a42('0xf')](_0x9a42('0x10'),auth[_0x9a42('0xb')](),controller[_0x9a42('0x11')]);router[_0x9a42('0x12')](_0x9a42('0x10'),auth[_0x9a42('0xb')](),controller['destroy']);module[_0x9a42('0x13')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 4a9f1e8..b59b5bc 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 _0x2222=['exports','INTEGER','STRING','*,*,*,*','sequelize'];(function(_0x345da8,_0x2d6344){var _0x3a1dd2=function(_0x3d70e8){while(--_0x3d70e8){_0x345da8['push'](_0x345da8['shift']());}};_0x3a1dd2(++_0x2d6344);}(_0x2222,0xf4));var _0x2222=function(_0x1002f1,_0x408b12){_0x1002f1=_0x1002f1-0x0;var _0xe354fd=_0x2222[_0x1002f1];return _0xe354fd;};'use strict';var Sequelize=require(_0x2222('0x0'));module[_0x2222('0x1')]={'priority':{'type':Sequelize[_0x2222('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x2222('0x3')]},'interval':{'type':Sequelize[_0x2222('0x3')],'defaultValue':_0x2222('0x4')}}; \ No newline at end of file +var _0xfca0=['TEXT','*,*,*,*','sequelize','exports','STRING','noop'];(function(_0xf9dc0d,_0x420d45){var _0x4ffeea=function(_0x4fd7ed){while(--_0x4fd7ed){_0xf9dc0d['push'](_0xf9dc0d['shift']());}};_0x4ffeea(++_0x420d45);}(_0xfca0,0xaa));var _0x0fca=function(_0x175ef4,_0x1532a9){_0x175ef4=_0x175ef4-0x0;var _0x829eb4=_0xfca0[_0x175ef4];return _0x829eb4;};'use strict';var Sequelize=require(_0x0fca('0x0'));module[_0x0fca('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x0fca('0x2')],'allowNull':![],'defaultValue':_0x0fca('0x3')},'appdata':{'type':Sequelize[_0x0fca('0x4')]()},'description':{'type':Sequelize[_0x0fca('0x2')]},'interval':{'type':Sequelize[_0x0fca('0x2')],'defaultValue':_0x0fca('0x5')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 65bb56d..2ad98a1 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 _0x38e6=['sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','end','name','send','map','rawAttributes','type','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','OpenchannelApplication','includeAll','findAll','catch','show','params','length','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path'];(function(_0x138f59,_0x1b53fb){var _0x3d114d=function(_0x1f9461){while(--_0x1f9461){_0x138f59['push'](_0x138f59['shift']());}};_0x3d114d(++_0x1b53fb);}(_0x38e6,0x1ae));var _0x638e=function(_0x3d24af,_0x24e2bf){_0x3d24af=_0x3d24af-0x0;var _0x2cbfa8=_0x38e6[_0x3d24af];return _0x2cbfa8;};'use strict';var emlformat=require(_0x638e('0x0'));var rimraf=require(_0x638e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x638e('0x2'));var rp=require(_0x638e('0x3'));var moment=require(_0x638e('0x4'));var BPromise=require(_0x638e('0x5'));var Mustache=require(_0x638e('0x6'));var util=require('util');var path=require(_0x638e('0x7'));var sox=require(_0x638e('0x8'));var csv=require('to-csv');var ejs=require(_0x638e('0x9'));var fs=require('fs');var fs_extra=require(_0x638e('0xa'));var _=require(_0x638e('0xb'));var squel=require(_0x638e('0xc'));var crypto=require(_0x638e('0xd'));var jsforce=require(_0x638e('0xe'));var deskjs=require(_0x638e('0xf'));var toCsv=require(_0x638e('0x10'));var querystring=require('querystring');var Papa=require(_0x638e('0x11'));var Redis=require('ioredis');var authService=require(_0x638e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x638e('0x13'));var hardwareService=require(_0x638e('0x14'));var logger=require('../../config/logger')(_0x638e('0x15'));var utils=require('../../config/utils');var config=require(_0x638e('0x16'));var licenseUtil=require(_0x638e('0x17'));var db=require(_0x638e('0x18'))['db'];function respondWithStatusCode(_0x53a4cb,_0x362cd2){_0x362cd2=_0x362cd2||0xcc;return function(_0x28d930){if(_0x28d930){return _0x53a4cb[_0x638e('0x19')](_0x362cd2);}return _0x53a4cb[_0x638e('0x1a')](_0x362cd2)['end']();};}function respondWithResult(_0x468803,_0x4e0126){_0x4e0126=_0x4e0126||0xc8;return function(_0x2f05b3){if(_0x2f05b3){return _0x468803[_0x638e('0x1a')](_0x4e0126)['json'](_0x2f05b3);}};}function respondWithFilteredResult(_0x5cf9f3,_0xc425b6){return function(_0x5ee7df){if(_0x5ee7df){var _0x458ad4=typeof _0xc425b6[_0x638e('0x1b')]===_0x638e('0x1c')&&typeof _0xc425b6[_0x638e('0x1d')]==='undefined';var _0x2a7f83=_0x5ee7df[_0x638e('0x1e')];var _0x21fc01=_0x458ad4?0x0:_0xc425b6[_0x638e('0x1b')];var _0x6b1dd8=_0x458ad4?_0x5ee7df[_0x638e('0x1e')]:_0xc425b6[_0x638e('0x1b')]+_0xc425b6[_0x638e('0x1d')];var _0x27f277;if(_0x6b1dd8>=_0x2a7f83){_0x6b1dd8=_0x2a7f83;_0x27f277=0xc8;}else{_0x27f277=0xce;}_0x5cf9f3[_0x638e('0x1a')](_0x27f277);return _0x5cf9f3['set'](_0x638e('0x1f'),_0x21fc01+'-'+_0x6b1dd8+'/'+_0x2a7f83)[_0x638e('0x20')](_0x5ee7df);}return null;};}function patchUpdates(_0x2a44d8){return function(_0x5ec0c7){try{jsonpatch[_0x638e('0x21')](_0x5ec0c7,_0x2a44d8,!![]);}catch(_0x23ab96){return BPromise[_0x638e('0x22')](_0x23ab96);}return _0x5ec0c7[_0x638e('0x23')]();};}function saveUpdates(_0x33fe68,_0x488ca8){return function(_0x5da563){if(_0x5da563){return _0x5da563[_0x638e('0x24')](_0x33fe68)[_0x638e('0x25')](function(_0x392c7a){return _0x392c7a;});}return null;};}function removeEntity(_0x2b427d,_0x1d2d5e){return function(_0x104d45){if(_0x104d45){return _0x104d45[_0x638e('0x26')]()[_0x638e('0x25')](function(){_0x2b427d[_0x638e('0x1a')](0xcc)[_0x638e('0x27')]();});}};}function handleEntityNotFound(_0x53f247,_0x15767d){return function(_0x5654cc){if(!_0x5654cc){_0x53f247[_0x638e('0x19')](0x194);}return _0x5654cc;};}function handleError(_0x996f6,_0x33cabe){_0x33cabe=_0x33cabe||0x1f4;return function(_0x5f09d1){logger['error'](_0x5f09d1['stack']);if(_0x5f09d1['name']){delete _0x5f09d1[_0x638e('0x28')];}_0x996f6[_0x638e('0x1a')](_0x33cabe)[_0x638e('0x29')](_0x5f09d1);};}exports['index']=function(_0x232ee1,_0x189228){var _0x4e3338={},_0x640741={},_0x34670c={'count':0x0,'rows':[]};var _0x18ceb1=_[_0x638e('0x2a')](db['OpenchannelApplication'][_0x638e('0x2b')],function(_0x35bdbd){return{'name':_0x35bdbd['fieldName'],'type':_0x35bdbd[_0x638e('0x2c')][_0x638e('0x2d')]};});_0x640741[_0x638e('0x2e')]=_[_0x638e('0x2a')](_0x18ceb1,_0x638e('0x28'));_0x640741['query']=_[_0x638e('0x2f')](_0x232ee1[_0x638e('0x30')]);_0x640741[_0x638e('0x31')]=_[_0x638e('0x32')](_0x640741[_0x638e('0x2e')],_0x640741[_0x638e('0x30')]);_0x4e3338['attributes']=_[_0x638e('0x32')](_0x640741[_0x638e('0x2e')],qs[_0x638e('0x33')](_0x232ee1[_0x638e('0x30')][_0x638e('0x33')]));_0x4e3338['attributes']=_0x4e3338[_0x638e('0x34')]['length']?_0x4e3338[_0x638e('0x34')]:_0x640741[_0x638e('0x2e')];if(!_0x232ee1['query'][_0x638e('0x35')](_0x638e('0x36'))){_0x4e3338[_0x638e('0x1d')]=qs[_0x638e('0x1d')](_0x232ee1[_0x638e('0x30')][_0x638e('0x1d')]);_0x4e3338[_0x638e('0x1b')]=qs[_0x638e('0x1b')](_0x232ee1['query'][_0x638e('0x1b')]);}_0x4e3338[_0x638e('0x37')]=qs[_0x638e('0x38')](_0x232ee1[_0x638e('0x30')][_0x638e('0x38')]);_0x4e3338[_0x638e('0x39')]=qs[_0x638e('0x31')](_[_0x638e('0x3a')](_0x232ee1['query'],_0x640741[_0x638e('0x31')]),_0x18ceb1);if(_0x232ee1[_0x638e('0x30')][_0x638e('0x3b')]){_0x4e3338[_0x638e('0x39')]=_[_0x638e('0x3c')](_0x4e3338[_0x638e('0x39')],{'$or':_[_0x638e('0x2a')](_0x18ceb1,function(_0x2b7788){if(_0x2b7788[_0x638e('0x2c')]!==_0x638e('0x3d')){var _0x4a28fe={};_0x4a28fe[_0x2b7788[_0x638e('0x28')]]={'$like':'%'+_0x232ee1[_0x638e('0x30')]['filter']+'%'};return _0x4a28fe;}})});}_0x4e3338=_[_0x638e('0x3c')]({},_0x4e3338,_0x232ee1[_0x638e('0x3e')]);var _0x4b3a9d={'where':_0x4e3338[_0x638e('0x39')]};return db[_0x638e('0x3f')][_0x638e('0x1e')](_0x4b3a9d)[_0x638e('0x25')](function(_0x598994){_0x34670c[_0x638e('0x1e')]=_0x598994;if(_0x232ee1[_0x638e('0x30')][_0x638e('0x40')]){_0x4e3338['include']=[{'all':!![]}];}return db[_0x638e('0x3f')][_0x638e('0x41')](_0x4e3338);})[_0x638e('0x25')](function(_0x5da93e){_0x34670c['rows']=_0x5da93e;return _0x34670c;})['then'](respondWithFilteredResult(_0x189228,_0x4e3338))[_0x638e('0x42')](handleError(_0x189228,null));};exports[_0x638e('0x43')]=function(_0x39b5d0,_0x57cdfe){var _0x2966e7={'raw':!![],'where':{'id':_0x39b5d0[_0x638e('0x44')]['id']}},_0x3f12bc={};_0x3f12bc[_0x638e('0x2e')]=_[_0x638e('0x2f')](db[_0x638e('0x3f')][_0x638e('0x2b')]);_0x3f12bc[_0x638e('0x30')]=_[_0x638e('0x2f')](_0x39b5d0['query']);_0x3f12bc['filters']=_['intersection'](_0x3f12bc['model'],_0x3f12bc['query']);_0x2966e7[_0x638e('0x34')]=_[_0x638e('0x32')](_0x3f12bc[_0x638e('0x2e')],qs['fields'](_0x39b5d0[_0x638e('0x30')][_0x638e('0x33')]));_0x2966e7[_0x638e('0x34')]=_0x2966e7[_0x638e('0x34')][_0x638e('0x45')]?_0x2966e7[_0x638e('0x34')]:_0x3f12bc['model'];if(_0x39b5d0[_0x638e('0x30')][_0x638e('0x40')]){_0x2966e7['include']=[{'all':!![]}];}_0x2966e7=_['merge']({},_0x2966e7,_0x39b5d0[_0x638e('0x3e')]);return db[_0x638e('0x3f')][_0x638e('0x46')](_0x2966e7)[_0x638e('0x25')](handleEntityNotFound(_0x57cdfe,null))[_0x638e('0x25')](respondWithResult(_0x57cdfe,null))['catch'](handleError(_0x57cdfe,null));};exports[_0x638e('0x47')]=function(_0x51feee,_0x579344){return db[_0x638e('0x3f')][_0x638e('0x47')](_0x51feee[_0x638e('0x48')],{})[_0x638e('0x25')](respondWithResult(_0x579344,0xc9))[_0x638e('0x42')](handleError(_0x579344,null));};exports[_0x638e('0x24')]=function(_0x529b5d,_0x3d85c0){if(_0x529b5d[_0x638e('0x48')]['id']){delete _0x529b5d[_0x638e('0x48')]['id'];}return db[_0x638e('0x3f')][_0x638e('0x46')]({'where':{'id':_0x529b5d[_0x638e('0x44')]['id']}})[_0x638e('0x25')](handleEntityNotFound(_0x3d85c0,null))['then'](saveUpdates(_0x529b5d['body'],null))[_0x638e('0x25')](respondWithResult(_0x3d85c0,null))['catch'](handleError(_0x3d85c0,null));};exports[_0x638e('0x26')]=function(_0x48c84f,_0x2ee360){return db[_0x638e('0x3f')][_0x638e('0x46')]({'where':{'id':_0x48c84f[_0x638e('0x44')]['id']}})[_0x638e('0x25')](handleEntityNotFound(_0x2ee360,null))['then'](removeEntity(_0x2ee360,null))[_0x638e('0x42')](handleError(_0x2ee360,null));}; \ No newline at end of file +var _0xb190=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','save','update','destroy','then','sendStatus','error','name','send','index','map','OpenchannelApplication','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','where','pick','filter','merge','VIRTUAL','include','catch','show','params','options','find','create','body','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xb190,0xc3));var _0x0b19=function(_0x2750b6,_0x4225b5){_0x2750b6=_0x2750b6-0x0;var _0x2c70c3=_0xb190[_0x2750b6];return _0x2c70c3;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0b19('0x0'));var jsonpatch=require(_0x0b19('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0b19('0x2'));var Mustache=require(_0x0b19('0x3'));var util=require(_0x0b19('0x4'));var path=require(_0x0b19('0x5'));var sox=require('sox');var csv=require(_0x0b19('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0b19('0x7'));var _=require('lodash');var squel=require(_0x0b19('0x8'));var crypto=require(_0x0b19('0x9'));var jsforce=require(_0x0b19('0xa'));var deskjs=require(_0x0b19('0xb'));var toCsv=require('to-csv');var querystring=require(_0x0b19('0xc'));var Papa=require('papaparse');var Redis=require(_0x0b19('0xd'));var authService=require(_0x0b19('0xe'));var qs=require(_0x0b19('0xf'));var as=require(_0x0b19('0x10'));var hardwareService=require(_0x0b19('0x11'));var logger=require(_0x0b19('0x12'))(_0x0b19('0x13'));var utils=require(_0x0b19('0x14'));var config=require(_0x0b19('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x0b19('0x16'))['db'];function respondWithStatusCode(_0x239cd3,_0x1c4e40){_0x1c4e40=_0x1c4e40||0xcc;return function(_0x57b4e3){if(_0x57b4e3){return _0x239cd3['sendStatus'](_0x1c4e40);}return _0x239cd3[_0x0b19('0x17')](_0x1c4e40)[_0x0b19('0x18')]();};}function respondWithResult(_0x309cb8,_0x3f1a4b){_0x3f1a4b=_0x3f1a4b||0xc8;return function(_0x268d74){if(_0x268d74){return _0x309cb8[_0x0b19('0x17')](_0x3f1a4b)[_0x0b19('0x19')](_0x268d74);}};}function respondWithFilteredResult(_0x40788b,_0x3fde6f){return function(_0x2eae19){if(_0x2eae19){var _0x19db24=typeof _0x3fde6f[_0x0b19('0x1a')]===_0x0b19('0x1b')&&typeof _0x3fde6f[_0x0b19('0x1c')]===_0x0b19('0x1b');var _0x1d77a6=_0x2eae19[_0x0b19('0x1d')];var _0x57d94f=_0x19db24?0x0:_0x3fde6f[_0x0b19('0x1a')];var _0x77c1cb=_0x19db24?_0x2eae19[_0x0b19('0x1d')]:_0x3fde6f[_0x0b19('0x1a')]+_0x3fde6f[_0x0b19('0x1c')];var _0xa75455;if(_0x77c1cb>=_0x1d77a6){_0x77c1cb=_0x1d77a6;_0xa75455=0xc8;}else{_0xa75455=0xce;}_0x40788b[_0x0b19('0x17')](_0xa75455);return _0x40788b[_0x0b19('0x1e')]('Content-Range',_0x57d94f+'-'+_0x77c1cb+'/'+_0x1d77a6)[_0x0b19('0x19')](_0x2eae19);}return null;};}function patchUpdates(_0x17736f){return function(_0x494ea6){try{jsonpatch[_0x0b19('0x1f')](_0x494ea6,_0x17736f,!![]);}catch(_0xe79e5c){return BPromise['reject'](_0xe79e5c);}return _0x494ea6[_0x0b19('0x20')]();};}function saveUpdates(_0x41dda0,_0x3ec2cf){return function(_0x559049){if(_0x559049){return _0x559049[_0x0b19('0x21')](_0x41dda0)['then'](function(_0x48ad80){return _0x48ad80;});}return null;};}function removeEntity(_0x168072,_0x59af59){return function(_0x228dc9){if(_0x228dc9){return _0x228dc9[_0x0b19('0x22')]()[_0x0b19('0x23')](function(){_0x168072[_0x0b19('0x17')](0xcc)[_0x0b19('0x18')]();});}};}function handleEntityNotFound(_0x4bf55b,_0x3a0d5f){return function(_0x2c508e){if(!_0x2c508e){_0x4bf55b[_0x0b19('0x24')](0x194);}return _0x2c508e;};}function handleError(_0x1d7c0f,_0x9e77e8){_0x9e77e8=_0x9e77e8||0x1f4;return function(_0xdee2b2){logger[_0x0b19('0x25')](_0xdee2b2['stack']);if(_0xdee2b2[_0x0b19('0x26')]){delete _0xdee2b2[_0x0b19('0x26')];}_0x1d7c0f['status'](_0x9e77e8)[_0x0b19('0x27')](_0xdee2b2);};}exports[_0x0b19('0x28')]=function(_0x489ee5,_0x197eea){var _0xc9afdd={},_0x4b19c6={},_0x1e9202={'count':0x0,'rows':[]};var _0x5aa159=_[_0x0b19('0x29')](db[_0x0b19('0x2a')][_0x0b19('0x2b')],function(_0x14527e){return{'name':_0x14527e[_0x0b19('0x2c')],'type':_0x14527e[_0x0b19('0x2d')][_0x0b19('0x2e')]};});_0x4b19c6['model']=_['map'](_0x5aa159,_0x0b19('0x26'));_0x4b19c6['query']=_[_0x0b19('0x2f')](_0x489ee5[_0x0b19('0x30')]);_0x4b19c6[_0x0b19('0x31')]=_[_0x0b19('0x32')](_0x4b19c6[_0x0b19('0x33')],_0x4b19c6[_0x0b19('0x30')]);_0xc9afdd[_0x0b19('0x34')]=_[_0x0b19('0x32')](_0x4b19c6[_0x0b19('0x33')],qs['fields'](_0x489ee5['query'][_0x0b19('0x35')]));_0xc9afdd[_0x0b19('0x34')]=_0xc9afdd[_0x0b19('0x34')][_0x0b19('0x36')]?_0xc9afdd[_0x0b19('0x34')]:_0x4b19c6['model'];if(!_0x489ee5[_0x0b19('0x30')][_0x0b19('0x37')]('nolimit')){_0xc9afdd[_0x0b19('0x1c')]=qs[_0x0b19('0x1c')](_0x489ee5[_0x0b19('0x30')][_0x0b19('0x1c')]);_0xc9afdd[_0x0b19('0x1a')]=qs['offset'](_0x489ee5[_0x0b19('0x30')][_0x0b19('0x1a')]);}_0xc9afdd[_0x0b19('0x38')]=qs['sort'](_0x489ee5['query']['sort']);_0xc9afdd[_0x0b19('0x39')]=qs[_0x0b19('0x31')](_[_0x0b19('0x3a')](_0x489ee5['query'],_0x4b19c6[_0x0b19('0x31')]),_0x5aa159);if(_0x489ee5[_0x0b19('0x30')][_0x0b19('0x3b')]){_0xc9afdd[_0x0b19('0x39')]=_[_0x0b19('0x3c')](_0xc9afdd[_0x0b19('0x39')],{'$or':_[_0x0b19('0x29')](_0x5aa159,function(_0x3a0a57){if(_0x3a0a57[_0x0b19('0x2d')]!==_0x0b19('0x3d')){var _0x4c097a={};_0x4c097a[_0x3a0a57['name']]={'$like':'%'+_0x489ee5[_0x0b19('0x30')]['filter']+'%'};return _0x4c097a;}})});}_0xc9afdd=_[_0x0b19('0x3c')]({},_0xc9afdd,_0x489ee5['options']);var _0x47c0e5={'where':_0xc9afdd[_0x0b19('0x39')]};return db[_0x0b19('0x2a')][_0x0b19('0x1d')](_0x47c0e5)['then'](function(_0x3f0ff2){_0x1e9202[_0x0b19('0x1d')]=_0x3f0ff2;if(_0x489ee5['query']['includeAll']){_0xc9afdd[_0x0b19('0x3e')]=[{'all':!![]}];}return db[_0x0b19('0x2a')]['findAll'](_0xc9afdd);})[_0x0b19('0x23')](function(_0x485c52){_0x1e9202['rows']=_0x485c52;return _0x1e9202;})['then'](respondWithFilteredResult(_0x197eea,_0xc9afdd))[_0x0b19('0x3f')](handleError(_0x197eea,null));};exports[_0x0b19('0x40')]=function(_0x4a2a4d,_0x280bea){var _0x35864c={'raw':!![],'where':{'id':_0x4a2a4d[_0x0b19('0x41')]['id']}},_0x3b0b24={};_0x3b0b24[_0x0b19('0x33')]=_[_0x0b19('0x2f')](db[_0x0b19('0x2a')][_0x0b19('0x2b')]);_0x3b0b24[_0x0b19('0x30')]=_[_0x0b19('0x2f')](_0x4a2a4d[_0x0b19('0x30')]);_0x3b0b24[_0x0b19('0x31')]=_[_0x0b19('0x32')](_0x3b0b24[_0x0b19('0x33')],_0x3b0b24[_0x0b19('0x30')]);_0x35864c[_0x0b19('0x34')]=_['intersection'](_0x3b0b24[_0x0b19('0x33')],qs[_0x0b19('0x35')](_0x4a2a4d[_0x0b19('0x30')][_0x0b19('0x35')]));_0x35864c[_0x0b19('0x34')]=_0x35864c[_0x0b19('0x34')][_0x0b19('0x36')]?_0x35864c[_0x0b19('0x34')]:_0x3b0b24[_0x0b19('0x33')];if(_0x4a2a4d[_0x0b19('0x30')]['includeAll']){_0x35864c['include']=[{'all':!![]}];}_0x35864c=_['merge']({},_0x35864c,_0x4a2a4d[_0x0b19('0x42')]);return db[_0x0b19('0x2a')][_0x0b19('0x43')](_0x35864c)['then'](handleEntityNotFound(_0x280bea,null))['then'](respondWithResult(_0x280bea,null))[_0x0b19('0x3f')](handleError(_0x280bea,null));};exports[_0x0b19('0x44')]=function(_0x663a90,_0x22f816){return db[_0x0b19('0x2a')][_0x0b19('0x44')](_0x663a90['body'],{})[_0x0b19('0x23')](respondWithResult(_0x22f816,0xc9))[_0x0b19('0x3f')](handleError(_0x22f816,null));};exports['update']=function(_0x498fd7,_0x2e940f){if(_0x498fd7[_0x0b19('0x45')]['id']){delete _0x498fd7['body']['id'];}return db['OpenchannelApplication'][_0x0b19('0x43')]({'where':{'id':_0x498fd7[_0x0b19('0x41')]['id']}})[_0x0b19('0x23')](handleEntityNotFound(_0x2e940f,null))[_0x0b19('0x23')](saveUpdates(_0x498fd7[_0x0b19('0x45')],null))['then'](respondWithResult(_0x2e940f,null))[_0x0b19('0x3f')](handleError(_0x2e940f,null));};exports[_0x0b19('0x22')]=function(_0x36c381,_0x254dab){return db['OpenchannelApplication']['find']({'where':{'id':_0x36c381[_0x0b19('0x41')]['id']}})[_0x0b19('0x23')](handleEntityNotFound(_0x254dab,null))[_0x0b19('0x23')](removeEntity(_0x254dab,null))[_0x0b19('0x3f')](handleError(_0x254dab,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index c292d10..2bcc7db 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 _0xbcd6=['rimraf','../../config/environment','./openchannelApplication.attributes','define','OpenchannelApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','request-promise'];(function(_0x4e6853,_0x194a29){var _0x35c2ae=function(_0x288c45){while(--_0x288c45){_0x4e6853['push'](_0x4e6853['shift']());}};_0x35c2ae(++_0x194a29);}(_0xbcd6,0x10f));var _0x6bcd=function(_0x5daa5a,_0x519108){_0x5daa5a=_0x5daa5a-0x0;var _0x27b906=_0xbcd6[_0x5daa5a];return _0x27b906;};'use strict';var _=require(_0x6bcd('0x0'));var util=require(_0x6bcd('0x1'));var logger=require(_0x6bcd('0x2'))(_0x6bcd('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6bcd('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6bcd('0x5'));var config=require(_0x6bcd('0x6'));var attributes=require(_0x6bcd('0x7'));module['exports']=function(_0x3ae7dc,_0x1ef868){return _0x3ae7dc[_0x6bcd('0x8')](_0x6bcd('0x9'),attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6bcd('0xa'),'collate':_0x6bcd('0xb')});}; \ No newline at end of file +var _0xec00=['moment','request-promise','path','rimraf','./openchannelApplication.attributes','exports','define','OpenchannelApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x4bf463,_0x5e063f){var _0x50d9ac=function(_0x491234){while(--_0x491234){_0x4bf463['push'](_0x4bf463['shift']());}};_0x50d9ac(++_0x5e063f);}(_0xec00,0x114));var _0x0ec0=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0xec00[_0xdea41a];return _0x15d0d8;};'use strict';var _=require(_0x0ec0('0x0'));var util=require(_0x0ec0('0x1'));var logger=require(_0x0ec0('0x2'))(_0x0ec0('0x3'));var moment=require(_0x0ec0('0x4'));var BPromise=require('bluebird');var rp=require(_0x0ec0('0x5'));var fs=require('fs');var path=require(_0x0ec0('0x6'));var rimraf=require(_0x0ec0('0x7'));var config=require('../../config/environment');var attributes=require(_0x0ec0('0x8'));module[_0x0ec0('0x9')]=function(_0x56d2ff,_0x1d26ea){return _0x56d2ff[_0x0ec0('0xa')](_0x0ec0('0xb'),attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0ec0('0xc'),'collate':_0x0ec0('0xd')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index ec210e5..3fdafb1 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 _0xa13a=['result','catch','UpdateOpenchannelApplication','update','body','options','stringify','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','error','message'];(function(_0x3c1964,_0x4cb9e2){var _0xeb5d91=function(_0xb5ef55){while(--_0xb5ef55){_0x3c1964['push'](_0x3c1964['shift']());}};_0xeb5d91(++_0x4cb9e2);}(_0xa13a,0x1b7));var _0xaa13=function(_0x2c843c,_0x5cec23){_0x2c843c=_0x2c843c-0x0;var _0x24af20=_0xa13a[_0x2c843c];return _0x24af20;};'use strict';var _=require(_0xaa13('0x0'));var util=require(_0xaa13('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xaa13('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaa13('0x3'))['db'];var utils=require(_0xaa13('0x4'));var logger=require(_0xaa13('0x5'))(_0xaa13('0x6'));var config=require(_0xaa13('0x7'));var jayson=require(_0xaa13('0x8'));var client=jayson[_0xaa13('0x9')][_0xaa13('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x111522,_0x2b53d4,_0x268323){return new BPromise(function(_0x3efd29,_0x1c3dfb){return client[_0xaa13('0xb')](_0x111522,_0x268323)[_0xaa13('0xc')](function(_0x5ac9da){logger[_0xaa13('0xd')](_0xaa13('0xe'),_0x2b53d4,_0xaa13('0xf'));logger[_0xaa13('0x10')](_0xaa13('0x11'),_0x2b53d4,'request\x20sent',JSON['stringify'](_0x5ac9da));if(_0x5ac9da[_0xaa13('0x12')]){if(_0x5ac9da[_0xaa13('0x12')]['code']===0x1f4){logger[_0xaa13('0x12')](_0xaa13('0xe'),_0x2b53d4,_0x5ac9da[_0xaa13('0x12')][_0xaa13('0x13')]);return _0x1c3dfb(_0x5ac9da[_0xaa13('0x12')][_0xaa13('0x13')]);}logger['error'](_0xaa13('0xe'),_0x2b53d4,_0x5ac9da[_0xaa13('0x12')]['message']);return _0x3efd29(_0x5ac9da['error'][_0xaa13('0x13')]);}else{logger[_0xaa13('0xd')]('OpenchannelApplication,\x20%s,\x20%s',_0x2b53d4,'request\x20sent');_0x3efd29(_0x5ac9da[_0xaa13('0x14')][_0xaa13('0x13')]);}})[_0xaa13('0x15')](function(_0x450688){logger['error'](_0xaa13('0xe'),_0x2b53d4,_0x450688);_0x1c3dfb(_0x450688);});});}exports[_0xaa13('0x16')]=function(_0x111fae){var _0x15e108=this;return new Promise(function(_0x52979d,_0x1ecb4f){return db['OpenchannelApplication'][_0xaa13('0x17')](_0x111fae[_0xaa13('0x18')],{'raw':_0x111fae['options']?_0x111fae[_0xaa13('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x111fae[_0xaa13('0x19')]?_0x111fae[_0xaa13('0x19')]['where']||null:null,'attributes':_0x111fae[_0xaa13('0x19')]?_0x111fae[_0xaa13('0x19')]['attributes']||null:null,'limit':_0x111fae[_0xaa13('0x19')]?_0x111fae[_0xaa13('0x19')]['limit']||null:null})['then'](function(_0x161fbb){logger[_0xaa13('0xd')](_0xaa13('0x16'),_0x111fae);logger[_0xaa13('0x10')](_0xaa13('0x16'),_0x111fae,JSON[_0xaa13('0x1a')](_0x161fbb));_0x52979d(_0x161fbb);})[_0xaa13('0x15')](function(_0x1fb851){logger[_0xaa13('0x12')](_0xaa13('0x16'),_0x1fb851[_0xaa13('0x13')],_0x111fae);_0x1ecb4f(_0x15e108[_0xaa13('0x12')](0x1f4,_0x1fb851[_0xaa13('0x13')]));});});}; \ No newline at end of file +var _0x1294=['body','options','raw','where','attributes','limit','UpdateOpenchannelApplication','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','update'];(function(_0x3cebff,_0x20b43d){var _0x6e5423=function(_0x1043e1){while(--_0x1043e1){_0x3cebff['push'](_0x3cebff['shift']());}};_0x6e5423(++_0x20b43d);}(_0x1294,0x151));var _0x4129=function(_0x5d07e1,_0x418799){_0x5d07e1=_0x5d07e1-0x0;var _0x21617f=_0x1294[_0x5d07e1];return _0x21617f;};'use strict';var _=require(_0x4129('0x0'));var util=require(_0x4129('0x1'));var moment=require(_0x4129('0x2'));var BPromise=require(_0x4129('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4129('0x4'));var db=require(_0x4129('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4129('0x6'))(_0x4129('0x7'));var config=require(_0x4129('0x8'));var jayson=require(_0x4129('0x9'));var client=jayson[_0x4129('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x270573,_0x10a735,_0x4012f8){return new BPromise(function(_0x7c89a0,_0x57dc7c){return client['request'](_0x270573,_0x4012f8)[_0x4129('0xb')](function(_0x357397){logger[_0x4129('0xc')](_0x4129('0xd'),_0x10a735,_0x4129('0xe'));logger[_0x4129('0xf')](_0x4129('0x10'),_0x10a735,_0x4129('0xe'),JSON['stringify'](_0x357397));if(_0x357397['error']){if(_0x357397['error'][_0x4129('0x11')]===0x1f4){logger[_0x4129('0x12')]('OpenchannelApplication,\x20%s,\x20%s',_0x10a735,_0x357397[_0x4129('0x12')][_0x4129('0x13')]);return _0x57dc7c(_0x357397['error'][_0x4129('0x13')]);}logger[_0x4129('0x12')]('OpenchannelApplication,\x20%s,\x20%s',_0x10a735,_0x357397[_0x4129('0x12')][_0x4129('0x13')]);return _0x7c89a0(_0x357397['error'][_0x4129('0x13')]);}else{logger[_0x4129('0xc')](_0x4129('0xd'),_0x10a735,_0x4129('0xe'));_0x7c89a0(_0x357397[_0x4129('0x14')][_0x4129('0x13')]);}})[_0x4129('0x15')](function(_0x931d6e){logger[_0x4129('0x12')](_0x4129('0xd'),_0x10a735,_0x931d6e);_0x57dc7c(_0x931d6e);});});}exports['UpdateOpenchannelApplication']=function(_0x3381f5){var _0x16949f=this;return new Promise(function(_0x3697b4,_0xb3fc37){return db['OpenchannelApplication'][_0x4129('0x16')](_0x3381f5[_0x4129('0x17')],{'raw':_0x3381f5[_0x4129('0x18')]?_0x3381f5[_0x4129('0x18')][_0x4129('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3381f5[_0x4129('0x18')]?_0x3381f5[_0x4129('0x18')][_0x4129('0x1a')]||null:null,'attributes':_0x3381f5[_0x4129('0x18')]?_0x3381f5[_0x4129('0x18')][_0x4129('0x1b')]||null:null,'limit':_0x3381f5['options']?_0x3381f5['options'][_0x4129('0x1c')]||null:null})['then'](function(_0x5a5685){logger[_0x4129('0xc')](_0x4129('0x1d'),_0x3381f5);logger[_0x4129('0xf')](_0x4129('0x1d'),_0x3381f5,JSON['stringify'](_0x5a5685));_0x3697b4(_0x5a5685);})[_0x4129('0x15')](function(_0x30c069){logger[_0x4129('0x12')](_0x4129('0x1d'),_0x30c069['message'],_0x3381f5);_0xb3fc37(_0x16949f[_0x4129('0x12')](0x1f4,_0x30c069[_0x4129('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 3b60173..74400ed 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 _0xb37b=['openchannelinteraction:update','update','/:id','openchannel','openchannelinteraction:destroy','destroy','delete','/:id/tags','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelInteraction.controller','isAuthenticated','index','get','describe','/:id/messages','download','post','create','addMessage','openchannelinteraction:addtags','addTags','put','tracked'];(function(_0x532c76,_0x3a183f){var _0x6a78c2=function(_0x16cf69){while(--_0x16cf69){_0x532c76['push'](_0x532c76['shift']());}};_0x6a78c2(++_0x3a183f);}(_0xb37b,0x1da));var _0xbb37=function(_0x119da4,_0x27e195){_0x119da4=_0x119da4-0x0;var _0x5e581d=_0xb37b[_0x119da4];return _0x5e581d;};'use strict';var multer=require(_0xbb37('0x0'));var util=require(_0xbb37('0x1'));var path=require(_0xbb37('0x2'));var timeout=require(_0xbb37('0x3'));var express=require('express');var router=express[_0xbb37('0x4')]();var fs_extra=require(_0xbb37('0x5'));var auth=require(_0xbb37('0x6'));var interaction=require(_0xbb37('0x7'));var config=require('../../config/environment');var controller=require(_0xbb37('0x8'));router['get']('/',auth[_0xbb37('0x9')](),controller[_0xbb37('0xa')]);router[_0xbb37('0xb')]('/describe',auth[_0xbb37('0x9')](),controller[_0xbb37('0xc')]);router[_0xbb37('0xb')]('/:id',auth[_0xbb37('0x9')](),controller['show']);router[_0xbb37('0xb')](_0xbb37('0xd'),auth[_0xbb37('0x9')](),controller['getMessages']);router[_0xbb37('0xb')]('/:id/download',auth['isAuthenticated'](),controller[_0xbb37('0xe')]);router[_0xbb37('0xf')]('/',auth[_0xbb37('0x9')](),controller[_0xbb37('0x10')]);router[_0xbb37('0xf')](_0xbb37('0xd'),auth[_0xbb37('0x9')](),controller[_0xbb37('0x11')]);router[_0xbb37('0xf')]('/:id/tags',auth[_0xbb37('0x9')](),interaction['tracked']('openchannel',_0xbb37('0x12')),controller[_0xbb37('0x13')]);router[_0xbb37('0x14')]('/:id',auth[_0xbb37('0x9')](),interaction[_0xbb37('0x15')]('openchannel',_0xbb37('0x16')),controller[_0xbb37('0x17')]);router['delete'](_0xbb37('0x18'),auth[_0xbb37('0x9')](),interaction[_0xbb37('0x15')](_0xbb37('0x19'),_0xbb37('0x1a')),controller[_0xbb37('0x1b')]);router[_0xbb37('0x1c')](_0xbb37('0x1d'),auth['isAuthenticated'](),controller['removeTags']);module[_0xbb37('0x1e')]=router; \ No newline at end of file +var _0x152b=['addTags','put','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','removeTags','exports','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','/:id/messages','getMessages','download','create','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags'];(function(_0x168a88,_0x3cc193){var _0x40943b=function(_0x184270){while(--_0x184270){_0x168a88['push'](_0x168a88['shift']());}};_0x40943b(++_0x3cc193);}(_0x152b,0x170));var _0xb152=function(_0x4a45b4,_0x59804f){_0x4a45b4=_0x4a45b4-0x0;var _0x1a99c9=_0x152b[_0x4a45b4];return _0x1a99c9;};'use strict';var multer=require('multer');var util=require(_0xb152('0x0'));var path=require(_0xb152('0x1'));var timeout=require('connect-timeout');var express=require(_0xb152('0x2'));var router=express['Router']();var fs_extra=require(_0xb152('0x3'));var auth=require(_0xb152('0x4'));var interaction=require(_0xb152('0x5'));var config=require(_0xb152('0x6'));var controller=require('./openchannelInteraction.controller');router[_0xb152('0x7')]('/',auth[_0xb152('0x8')](),controller[_0xb152('0x9')]);router[_0xb152('0x7')](_0xb152('0xa'),auth[_0xb152('0x8')](),controller['describe']);router[_0xb152('0x7')](_0xb152('0xb'),auth[_0xb152('0x8')](),controller[_0xb152('0xc')]);router[_0xb152('0x7')](_0xb152('0xd'),auth[_0xb152('0x8')](),controller[_0xb152('0xe')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0xb152('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb152('0x10')]);router['post'](_0xb152('0xd'),auth['isAuthenticated'](),controller[_0xb152('0x11')]);router['post'](_0xb152('0x12'),auth[_0xb152('0x8')](),interaction[_0xb152('0x13')](_0xb152('0x14'),_0xb152('0x15')),controller[_0xb152('0x16')]);router[_0xb152('0x17')](_0xb152('0xb'),auth[_0xb152('0x8')](),interaction[_0xb152('0x13')](_0xb152('0x14'),_0xb152('0x18')),controller[_0xb152('0x19')]);router[_0xb152('0x1a')]('/:id',auth['isAuthenticated'](),interaction[_0xb152('0x13')](_0xb152('0x14'),_0xb152('0x1b')),controller['destroy']);router[_0xb152('0x1a')](_0xb152('0x12'),auth[_0xb152('0x8')](),controller[_0xb152('0x1c')]);module[_0xb152('0x1d')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 58eb7ca..1cb3aa4 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 _0xfb30=['STRING','DATE','ENUM','out','sequelize','exports'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0xfb30,0x88));var _0x0fb3=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xfb30[_0x432682];return _0x463d05;};'use strict';var Sequelize=require(_0x0fb3('0x0'));module[_0x0fb3('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x0fb3('0x2')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x0fb3('0x2')]},'note':{'type':Sequelize[_0x0fb3('0x2')]},'read1stAt':{'type':Sequelize[_0x0fb3('0x3')]},'threadId':{'type':Sequelize[_0x0fb3('0x2')]},'externalUrl':{'type':Sequelize[_0x0fb3('0x2')]},'lastMsgAt':{'type':Sequelize[_0x0fb3('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x0fb3('0x4')]('in',_0x0fb3('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x0fb3('0x4')]('in',_0x0fb3('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x0fb3('0x2')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x33a1=['STRING','DATE','ENUM','out','sequelize','exports'];(function(_0x21c646,_0x35d927){var _0x217f25=function(_0x4186c6){while(--_0x4186c6){_0x21c646['push'](_0x21c646['shift']());}};_0x217f25(++_0x35d927);}(_0x33a1,0x7c));var _0x133a=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x33a1[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require(_0x133a('0x0'));module[_0x133a('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x133a('0x2')]},'note':{'type':Sequelize[_0x133a('0x2')]},'read1stAt':{'type':Sequelize[_0x133a('0x3')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize[_0x133a('0x2')]},'lastMsgAt':{'type':Sequelize[_0x133a('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x133a('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x133a('0x4')]('in',_0x133a('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x133a('0x2')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index a2691f6..0de0e3a 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 _0xd2c0=['basename','existsSync','pipe','createWriteStream','out','firstName','lastName','value','renderFile','.pdf','Openchannel','createPdfFromHTML','Unable\x20to\x20delete\x20zip\x20file','rimraf','zip-dir','moment','util','path','ejs','ioredis','../../config/logger','api','../../mysqldb','redis','defaults','./openchannelInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','error','stack','name','index','map','OpenchannelInteraction','rawAttributes','fieldName','key','getOptions','openchannel','query','user','catch','show','type','from','params','keys','intersection','model','attributes','fields','includeAll','merge','options','create','body','find','describe','addMessage','OpenchannelMessage','ids','omit','getMessages','filters','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','include','findAll','rows','setTags','spread','Tag','color','emit','openchannelInteractionTags:save','removeTags','download','unix','toString','files','tmp','join','root','server','attachments','transcript-%d-%s.zip','User','push','Contact','Attachment','Messages','direction','secret','read','OpenchannelAccount','Account','Owner','fullname','get','mkdirSync','N.A.','createdAt','closed','closedAt','threadId','Public','Private'];(function(_0x1a8ff0,_0x20788d){var _0x3588bf=function(_0x3b5499){while(--_0x3b5499){_0x1a8ff0['push'](_0x1a8ff0['shift']());}};_0x3588bf(++_0x20788d);}(_0xd2c0,0x190));var _0x0d2c=function(_0x43ed38,_0x507af1){_0x43ed38=_0x43ed38-0x0;var _0x181497=_0xd2c0[_0x43ed38];return _0x181497;};'use strict';var rimraf=require(_0x0d2c('0x0'));var zipdir=require(_0x0d2c('0x1'));var moment=require(_0x0d2c('0x2'));var util=require(_0x0d2c('0x3'));var path=require(_0x0d2c('0x4'));var ejs=require(_0x0d2c('0x5'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x0d2c('0x6'));var interaction=require('../../components/interaction/service');var qs=require('../../components/parsers/qs');var pdf=require('../../components/export/pdf');var logger=require(_0x0d2c('0x7'))(_0x0d2c('0x8'));var config=require('../../config/environment');var db=require(_0x0d2c('0x9'))['db'];config[_0x0d2c('0xa')]=_[_0x0d2c('0xb')](config[_0x0d2c('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0d2c('0xa')]));require(_0x0d2c('0xc'))[_0x0d2c('0xd')](socket);function respondWithStatusCode(_0x4a91bf,_0x5eef73){_0x5eef73=_0x5eef73||0xcc;return function(_0x5a5bf9){if(_0x5a5bf9){return _0x4a91bf[_0x0d2c('0xe')](_0x5eef73);}return _0x4a91bf[_0x0d2c('0xf')](_0x5eef73)[_0x0d2c('0x10')]();};}function respondWithResult(_0x25574b,_0x184259){_0x184259=_0x184259||0xc8;return function(_0x139882){if(_0x139882){return _0x25574b[_0x0d2c('0xf')](_0x184259)[_0x0d2c('0x11')](_0x139882);}};}function respondWithFilteredResult(_0xc2cfe9,_0x54ee42){return function(_0x4544c7){if(_0x4544c7){var _0x395ac8=typeof _0x54ee42[_0x0d2c('0x12')]===_0x0d2c('0x13')&&typeof _0x54ee42[_0x0d2c('0x14')]===_0x0d2c('0x13');var _0x2bc73a=_0x4544c7['count'];var _0x46ff0c=_0x395ac8?0x0:_0x54ee42[_0x0d2c('0x12')];var _0x1f26e0=_0x395ac8?_0x4544c7[_0x0d2c('0x15')]:_0x54ee42[_0x0d2c('0x12')]+_0x54ee42[_0x0d2c('0x14')];var _0x28b100;if(_0x1f26e0>=_0x2bc73a){_0x1f26e0=_0x2bc73a;_0x28b100=0xc8;}else{_0x28b100=0xce;}_0xc2cfe9['status'](_0x28b100);return _0xc2cfe9[_0x0d2c('0x16')](_0x0d2c('0x17'),_0x46ff0c+'-'+_0x1f26e0+'/'+_0x2bc73a)[_0x0d2c('0x11')](_0x4544c7);}return null;};}function saveUpdates(_0x4781e5){return function(_0x1b28c7){if(_0x1b28c7){return _0x1b28c7[_0x0d2c('0x18')](_0x4781e5)[_0x0d2c('0x19')](function(_0x5dfcec){return _0x5dfcec;});}return null;};}function removeEntity(_0x369c99){return function(_0x9a6afc){if(_0x9a6afc){return _0x9a6afc[_0x0d2c('0x1a')]()[_0x0d2c('0x19')](function(){_0x369c99[_0x0d2c('0xf')](0xcc)['end']();});}};}function handleEntityNotFound(_0xad520d){return function(_0x1c3dfc){if(!_0x1c3dfc){_0xad520d[_0x0d2c('0xe')](0x194);}return _0x1c3dfc;};}function handleError(_0x1709a3,_0x4aff93){_0x4aff93=_0x4aff93||0x1f4;return function(_0x23ee7b){logger[_0x0d2c('0x1b')](_0x23ee7b[_0x0d2c('0x1c')]);if(_0x23ee7b[_0x0d2c('0x1d')]){delete _0x23ee7b[_0x0d2c('0x1d')];}_0x1709a3[_0x0d2c('0xf')](_0x4aff93)['send'](_0x23ee7b);};}exports[_0x0d2c('0x1e')]=function(_0x2654cd,_0xb9e023){var _0x152bcb={};var _0x544dee=_[_0x0d2c('0x1f')](db[_0x0d2c('0x20')][_0x0d2c('0x21')],function(_0x32b446){return{'name':_0x32b446[_0x0d2c('0x22')],'type':_0x32b446['type'][_0x0d2c('0x23')]};});_0x152bcb=qs[_0x0d2c('0x24')](_0x544dee,_0x2654cd);return interaction['findAll'](_0x0d2c('0x25'),_0x2654cd[_0x0d2c('0x26')],_0x2654cd[_0x0d2c('0x27')],_0x152bcb,_0x544dee)[_0x0d2c('0x19')](respondWithFilteredResult(_0xb9e023,_0x152bcb))[_0x0d2c('0x28')](handleError(_0xb9e023,null));};exports[_0x0d2c('0x29')]=function(_0x440f0a,_0x391597){var _0x4c8a49={};if(_0x440f0a['query'][_0x0d2c('0x2a')]&&_0x440f0a[_0x0d2c('0x26')]['type']===_0x0d2c('0x2b')){_0x4c8a49[_0x0d2c('0x2b')]=_0x440f0a[_0x0d2c('0x2c')]['id'];}else{_0x4c8a49['id']=_0x440f0a[_0x0d2c('0x2c')]['id'];}var _0x374c7f={'raw':![],'where':_0x4c8a49},_0x14f214={};_0x14f214['model']=_[_0x0d2c('0x2d')](db[_0x0d2c('0x20')][_0x0d2c('0x21')]);_0x14f214['query']=_[_0x0d2c('0x2d')](_0x440f0a[_0x0d2c('0x26')]);_0x14f214['filters']=_[_0x0d2c('0x2e')](_0x14f214[_0x0d2c('0x2f')],_0x14f214[_0x0d2c('0x26')]);_0x374c7f[_0x0d2c('0x30')]=_[_0x0d2c('0x2e')](_0x14f214[_0x0d2c('0x2f')],qs[_0x0d2c('0x31')](_0x440f0a[_0x0d2c('0x26')][_0x0d2c('0x31')]));_0x374c7f[_0x0d2c('0x30')]=_0x374c7f[_0x0d2c('0x30')]['length']?_0x374c7f[_0x0d2c('0x30')]:_0x14f214['model'];if(_0x440f0a[_0x0d2c('0x26')][_0x0d2c('0x32')]){_0x374c7f['include']=[{'all':!![]}];}_0x374c7f=_[_0x0d2c('0x33')]({},_0x374c7f,_0x440f0a[_0x0d2c('0x34')]);return db[_0x0d2c('0x20')]['find'](_0x374c7f)['then'](handleEntityNotFound(_0x391597,null))[_0x0d2c('0x19')](respondWithResult(_0x391597,null))[_0x0d2c('0x28')](handleError(_0x391597,null));};exports['create']=function(_0x433058,_0x19b58f){return db[_0x0d2c('0x20')][_0x0d2c('0x35')](_0x433058[_0x0d2c('0x36')],{})[_0x0d2c('0x19')](respondWithResult(_0x19b58f,0xc9))[_0x0d2c('0x28')](handleError(_0x19b58f,null));};exports[_0x0d2c('0x18')]=function(_0x1a4975,_0x29363c){if(_0x1a4975['body']['id']){delete _0x1a4975[_0x0d2c('0x36')]['id'];}return db[_0x0d2c('0x20')][_0x0d2c('0x37')]({'where':{'id':_0x1a4975['params']['id']}})[_0x0d2c('0x19')](handleEntityNotFound(_0x29363c,null))[_0x0d2c('0x19')](saveUpdates(_0x1a4975[_0x0d2c('0x36')],null))[_0x0d2c('0x19')](respondWithResult(_0x29363c,null))['catch'](handleError(_0x29363c,null));};exports[_0x0d2c('0x1a')]=function(_0x5fef2f,_0x528853){return db[_0x0d2c('0x20')][_0x0d2c('0x37')]({'where':{'id':_0x5fef2f[_0x0d2c('0x2c')]['id']}})[_0x0d2c('0x19')](handleEntityNotFound(_0x528853,null))['then'](removeEntity(_0x528853,null))[_0x0d2c('0x28')](handleError(_0x528853,null));};exports[_0x0d2c('0x38')]=function(_0x306ee5,_0x30c162){return db['OpenchannelInteraction'][_0x0d2c('0x38')]()['then'](respondWithResult(_0x30c162,null))[_0x0d2c('0x28')](handleError(_0x30c162,null));};exports[_0x0d2c('0x39')]=function(_0x12c204,_0x40378d){return db[_0x0d2c('0x3a')][_0x0d2c('0x37')]({'where':{'id':_0x12c204['params']['id']}})['then'](handleEntityNotFound(_0x40378d,null))[_0x0d2c('0x19')](function(_0x806610){if(_0x806610){return _0x806610[_0x0d2c('0x39')](_0x12c204[_0x0d2c('0x36')][_0x0d2c('0x3b')],_[_0x0d2c('0x3c')](_0x12c204[_0x0d2c('0x36')],['ids','id'])||{});}})['then'](respondWithResult(_0x40378d,null))['catch'](handleError(_0x40378d,null));};exports[_0x0d2c('0x3d')]=function(_0x25a7c0,_0x171c55){var _0x481f7c={'raw':![],'where':{}};var _0x5b2028={};var _0x45725e={'count':0x0,'rows':[]};return db[_0x0d2c('0x20')]['findOne']({'where':{'id':_0x25a7c0[_0x0d2c('0x2c')]['id']}})['then'](handleEntityNotFound(_0x171c55,null))[_0x0d2c('0x19')](function(_0x3f9f22){if(_0x3f9f22){_0x5b2028[_0x0d2c('0x2f')]=_[_0x0d2c('0x2d')](db[_0x0d2c('0x3a')][_0x0d2c('0x21')]);_0x5b2028[_0x0d2c('0x26')]=_[_0x0d2c('0x2d')](_0x25a7c0[_0x0d2c('0x26')]);_0x5b2028[_0x0d2c('0x3e')]=_[_0x0d2c('0x2e')](_0x5b2028[_0x0d2c('0x2f')],_0x5b2028[_0x0d2c('0x26')]);_0x481f7c['attributes']=_[_0x0d2c('0x2e')](_0x5b2028[_0x0d2c('0x2f')],qs['fields'](_0x25a7c0[_0x0d2c('0x26')][_0x0d2c('0x31')]));_0x481f7c['attributes']=_0x481f7c['attributes'][_0x0d2c('0x3f')]?_0x481f7c[_0x0d2c('0x30')]:_0x5b2028[_0x0d2c('0x2f')];if(!_0x25a7c0[_0x0d2c('0x26')][_0x0d2c('0x40')](_0x0d2c('0x41'))){_0x481f7c[_0x0d2c('0x14')]=qs[_0x0d2c('0x14')](_0x25a7c0[_0x0d2c('0x26')][_0x0d2c('0x14')]);_0x481f7c[_0x0d2c('0x12')]=qs[_0x0d2c('0x12')](_0x25a7c0['query']['offset']);}_0x481f7c[_0x0d2c('0x42')]=qs[_0x0d2c('0x43')](_0x25a7c0['query'][_0x0d2c('0x43')]);_0x481f7c[_0x0d2c('0x44')]=qs['filters'](_[_0x0d2c('0x45')](_0x25a7c0[_0x0d2c('0x26')],_0x5b2028[_0x0d2c('0x3e')]));_0x481f7c['where']['OpenchannelInteractionId']=_0x3f9f22['id'];if(_0x25a7c0[_0x0d2c('0x26')]['filter']){_0x481f7c['where']=_[_0x0d2c('0x33')](_0x481f7c['where'],{'$or':_['map'](_0x481f7c[_0x0d2c('0x30')],function(_0x4e476f){var _0x586cd7={};_0x586cd7[_0x4e476f]={'$like':'%'+_0x25a7c0[_0x0d2c('0x26')][_0x0d2c('0x46')]+'%'};return _0x586cd7;})});}if(_0x25a7c0['query'][_0x0d2c('0x47')]){var _0x219e9a=_0x25a7c0['query'][_0x0d2c('0x47')][_0x0d2c('0x48')](',');var _0x6013bd={};_0x6013bd[_0x219e9a[0x0]]={'$gte':moment(_0x219e9a[0x1])[_0x0d2c('0x49')](_0x0d2c('0x4a'))};_0x481f7c[_0x0d2c('0x44')]=_[_0x0d2c('0x33')](_0x481f7c['where'],_0x6013bd);}_0x481f7c=_[_0x0d2c('0x33')]({},_0x481f7c,_0x25a7c0['options']);return db['OpenchannelMessage']['count']({'where':_0x481f7c['where']})['then'](function(_0x4de35d){_0x45725e[_0x0d2c('0x15')]=_0x4de35d;if(_0x25a7c0[_0x0d2c('0x26')]['includeAll']){_0x481f7c[_0x0d2c('0x4b')]=[{'all':!![]}];}return db[_0x0d2c('0x3a')][_0x0d2c('0x4c')](_0x481f7c);})[_0x0d2c('0x19')](function(_0x391217){_0x45725e[_0x0d2c('0x4d')]=_0x391217;return _0x45725e;});}})[_0x0d2c('0x19')](respondWithFilteredResult(_0x171c55,_0x481f7c))[_0x0d2c('0x28')](handleError(_0x171c55,null));};exports['addTags']=function(_0x5cb6e4,_0x2a9836){return db[_0x0d2c('0x20')]['find']({'where':{'id':_0x5cb6e4[_0x0d2c('0x2c')]['id']}})[_0x0d2c('0x19')](handleEntityNotFound(_0x2a9836,null))[_0x0d2c('0x19')](function(_0x5e93a1){if(_0x5e93a1){return _0x5e93a1[_0x0d2c('0x4e')](_0x5cb6e4[_0x0d2c('0x36')][_0x0d2c('0x3b')],_[_0x0d2c('0x3c')](_0x5cb6e4[_0x0d2c('0x36')],[_0x0d2c('0x3b'),'id'])||{})[_0x0d2c('0x4f')](function(){return db[_0x0d2c('0x50')]['findAll']({'attributes':['id',_0x0d2c('0x1d'),_0x0d2c('0x51')],'where':{'id':_0x5cb6e4[_0x0d2c('0x36')][_0x0d2c('0x3b')]}});})['then'](function(_0x4864f3){socket[_0x0d2c('0x52')](_0x0d2c('0x53'),{'id':Number(_0x5cb6e4[_0x0d2c('0x2c')]['id']),'tags':_0x4864f3||[]});return{'id':Number(_0x5cb6e4[_0x0d2c('0x2c')]['id']),'tags':_0x4864f3||[]};});}})[_0x0d2c('0x19')](respondWithResult(_0x2a9836,null))[_0x0d2c('0x28')](handleError(_0x2a9836,null));};exports[_0x0d2c('0x54')]=function(_0x30d42c,_0xf8928f){return db[_0x0d2c('0x20')][_0x0d2c('0x37')]({'where':{'id':_0x30d42c[_0x0d2c('0x2c')]['id']}})[_0x0d2c('0x19')](handleEntityNotFound(_0xf8928f,null))[_0x0d2c('0x19')](function(_0x5e9339){if(_0x5e9339){return _0x5e9339[_0x0d2c('0x54')](_0x30d42c[_0x0d2c('0x26')][_0x0d2c('0x3b')]);}})[_0x0d2c('0x19')](respondWithStatusCode(_0xf8928f,null))[_0x0d2c('0x28')](handleError(_0xf8928f,null));};exports[_0x0d2c('0x55')]=function(_0x4cdac6,_0x39e367){var _0xcf8540=moment()[_0x0d2c('0x56')]()[_0x0d2c('0x57')]();var _0x599978=path['join'](config['root'],'server',_0x0d2c('0x58'),_0x0d2c('0x59'));var _0x3a2cf6=path[_0x0d2c('0x5a')](config[_0x0d2c('0x5b')],_0x0d2c('0x5c'),'files',_0x0d2c('0x5d'));var _0x104a2f=path[_0x0d2c('0x5a')](_0x599978,_0xcf8540);var _0x2a8f77=util[_0x0d2c('0x49')](_0x0d2c('0x5e'),_0x4cdac6[_0x0d2c('0x2c')]['id'],_0xcf8540);var _0x274310=path['join'](_0x599978,_0x2a8f77);var _0x36dab8=[];_0x36dab8['push']({'model':db[_0x0d2c('0x5f')],'as':_0x0d2c('0x5f'),'attributes':['id','fullname'],'raw':!![]});_0x36dab8[_0x0d2c('0x60')]({'model':db['CmContact'],'as':_0x0d2c('0x61'),'attributes':['id','firstName','lastName'],'raw':!![]});if(_0x4cdac6[_0x0d2c('0x26')][_0x0d2c('0x5d')]){_0x36dab8[_0x0d2c('0x60')]({'model':db['Attachment'],'as':_0x0d2c('0x62'),'raw':!![]});}var _0x65a9a6=[{'model':db[_0x0d2c('0x3a')],'as':_0x0d2c('0x63'),'attributes':['id',_0x0d2c('0x36'),'createdAt',_0x0d2c('0x64'),_0x0d2c('0x65'),_0x0d2c('0x66')],'include':_0x36dab8}];_0x65a9a6['push']({'model':db[_0x0d2c('0x67')],'as':_0x0d2c('0x68'),'attributes':['id',_0x0d2c('0x1d')]});_0x65a9a6['push']({'model':db[_0x0d2c('0x5f')],'as':_0x0d2c('0x69'),'attributes':['id',_0x0d2c('0x6a')]});return db[_0x0d2c('0x20')][_0x0d2c('0x37')]({'where':{'id':_0x4cdac6[_0x0d2c('0x2c')]['id']},'include':_0x65a9a6})[_0x0d2c('0x19')](handleEntityNotFound(_0x39e367,null))['then'](function(_0x35f64c){if(_0x35f64c){var _0x21d621=_0x35f64c[_0x0d2c('0x6b')]({'plain':!![]});fs[_0x0d2c('0x6c')](_0x104a2f);var _0x525d5d={'channel':'Openchannel','account':_0x21d621[_0x0d2c('0x68')]['name'],'agent':_0x21d621[_0x0d2c('0x69')]?_0x21d621[_0x0d2c('0x69')][_0x0d2c('0x6a')]:_0x0d2c('0x6d'),'createdAt':moment(_0x21d621[_0x0d2c('0x6e')])[_0x0d2c('0x49')](_0x0d2c('0x4a'))['toString'](),'closedAt':_0x21d621[_0x0d2c('0x6f')]?moment(_0x21d621[_0x0d2c('0x70')])[_0x0d2c('0x49')](_0x0d2c('0x4a'))[_0x0d2c('0x57')]():'','disposition':_0x21d621['disposition'],'visibility':_0x21d621[_0x0d2c('0x71')]?_0x0d2c('0x72'):_0x0d2c('0x73'),'messages':_(_0x21d621[_0x0d2c('0x63')])[_0x0d2c('0x46')]({'secret':![]})[_0x0d2c('0x1f')](function(_0x3def9a){if(_0x3def9a[_0x0d2c('0x62')]){var _0x1b95fd=path['join'](_0x3a2cf6,_0x3def9a['Attachment'][_0x0d2c('0x74')]);if(fs[_0x0d2c('0x75')](_0x1b95fd)){fs['createReadStream'](_0x1b95fd)[_0x0d2c('0x76')](fs[_0x0d2c('0x77')](path[_0x0d2c('0x5a')](_0x104a2f,_0x3def9a['Attachment'][_0x0d2c('0x74')])));}}return{'date':moment(_0x3def9a[_0x0d2c('0x6e')])['format'](_0x0d2c('0x4a'))['toString'](),'sender':_0x3def9a['direction']===_0x0d2c('0x78')?_0x3def9a[_0x0d2c('0x5f')]?_0x3def9a[_0x0d2c('0x5f')][_0x0d2c('0x6a')]:'System':_0x3def9a[_0x0d2c('0x61')][_0x0d2c('0x79')]+(_0x3def9a['Contact'][_0x0d2c('0x7a')]?'\x20'+_0x3def9a[_0x0d2c('0x61')][_0x0d2c('0x7a')]:''),'body':_0x3def9a[_0x0d2c('0x62')]?_0x3def9a[_0x0d2c('0x62')][_0x0d2c('0x74')]:_0x3def9a[_0x0d2c('0x36')],'direction':_0x3def9a[_0x0d2c('0x64')]===_0x0d2c('0x78')?'A':'C','secret':_0x3def9a[_0x0d2c('0x65')],'read':_0x3def9a[_0x0d2c('0x66')],'attachment':_0x3def9a[_0x0d2c('0x62')]};})[_0x0d2c('0x7b')]()};return ejs[_0x0d2c('0x7c')](path[_0x0d2c('0x5a')](config[_0x0d2c('0x5b')],_0x0d2c('0x5c'),'views','downloadInteraction.ejs'),{'interaction':_0x525d5d})[_0x0d2c('0x19')](function(_0x32b4a9){var _0x16cc02=path[_0x0d2c('0x5a')](_0x104a2f,'transcript-'+_0x21d621['id']+'-'+_0xcf8540+_0x0d2c('0x7d'));var _0x2ea3e0={'path':_0x16cc02,'channel':_0x0d2c('0x7e'),'interactionId':_0x21d621['id']};return pdf[_0x0d2c('0x7f')](_0x32b4a9,_0x2ea3e0);})[_0x0d2c('0x19')](function(){return new Promise(function(_0x43bd14,_0x156173){zipdir(_0x104a2f,{'saveTo':_0x274310},function(_0x3bebd0,_0x19e4d2){if(_0x3bebd0)return _0x156173(_0x3bebd0);return _0x43bd14(_0x19e4d2);});})[_0x0d2c('0x19')](function(){return new Promise(function(_0x582163,_0x511f60){rimraf(_0x104a2f,function(_0xabaef0){if(_0xabaef0)_0x511f60(_0xabaef0);return _0x582163();});});})['then'](function(){return _0x39e367[_0x0d2c('0x55')](_0x274310,_0x2a8f77,function(_0x2ff15){if(_0x2ff15){logger[_0x0d2c('0x1b')](_0x0d2c('0x80'),_0x2ff15);}else{fs['unlinkSync'](_0x274310);}});});});}else{return _0x39e367[_0x0d2c('0xe')](0xc8);}})[_0x0d2c('0x28')](handleError(_0x39e367,null));}; \ No newline at end of file +var _0x1634=['disposition','Public','Private','basename','pipe','createWriteStream','System','firstName','value','renderFile','views','downloadInteraction.ejs','transcript-','Openchannel','createPdfFromHTML','error','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','zip-dir','moment','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../mysqldb','redis','defaults','localhost','./openchannelInteraction.socket','register','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','update','then','destroy','stack','name','send','map','OpenchannelInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','query','user','show','from','params','keys','filters','intersection','model','attributes','fields','length','include','options','create','body','catch','find','describe','addMessage','OpenchannelMessage','ids','getMessages','hasOwnProperty','nolimit','order','sort','where','OpenchannelInteractionId','filter','merge','$gte','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','omit','Tag','emit','openchannelInteractionTags:save','removeTags','download','toString','join','root','files','server','attachments','push','User','CmContact','Contact','lastName','Attachment','Messages','createdAt','direction','secret','read','OpenchannelAccount','Owner','fullname','mkdirSync','Account','N.A.','closed','closedAt'];(function(_0x502e91,_0xca74d3){var _0x527789=function(_0x3387df){while(--_0x3387df){_0x502e91['push'](_0x502e91['shift']());}};_0x527789(++_0xca74d3);}(_0x1634,0x91));var _0x4163=function(_0x592225,_0x254636){_0x592225=_0x592225-0x0;var _0x3caf44=_0x1634[_0x592225];return _0x3caf44;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x4163('0x0'));var moment=require(_0x4163('0x1'));var util=require(_0x4163('0x2'));var path=require(_0x4163('0x3'));var ejs=require(_0x4163('0x4'));var fs=require('fs');var _=require(_0x4163('0x5'));var Redis=require(_0x4163('0x6'));var interaction=require(_0x4163('0x7'));var qs=require(_0x4163('0x8'));var pdf=require(_0x4163('0x9'));var logger=require(_0x4163('0xa'))(_0x4163('0xb'));var config=require('../../config/environment');var db=require(_0x4163('0xc'))['db'];config[_0x4163('0xd')]=_[_0x4163('0xe')](config[_0x4163('0xd')],{'host':_0x4163('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4163('0xd')]));require(_0x4163('0x10'))[_0x4163('0x11')](socket);function respondWithStatusCode(_0x312510,_0x533493){_0x533493=_0x533493||0xcc;return function(_0x117957){if(_0x117957){return _0x312510[_0x4163('0x12')](_0x533493);}return _0x312510['status'](_0x533493)[_0x4163('0x13')]();};}function respondWithResult(_0x4f78a7,_0x26d69a){_0x26d69a=_0x26d69a||0xc8;return function(_0x2433d2){if(_0x2433d2){return _0x4f78a7[_0x4163('0x14')](_0x26d69a)['json'](_0x2433d2);}};}function respondWithFilteredResult(_0x5a9557,_0x1f310a){return function(_0x315995){if(_0x315995){var _0x2c06bb=typeof _0x1f310a[_0x4163('0x15')]===_0x4163('0x16')&&typeof _0x1f310a[_0x4163('0x17')]===_0x4163('0x16');var _0x3e92ba=_0x315995['count'];var _0x4b454d=_0x2c06bb?0x0:_0x1f310a['offset'];var _0x1b9a76=_0x2c06bb?_0x315995[_0x4163('0x18')]:_0x1f310a[_0x4163('0x15')]+_0x1f310a['limit'];var _0x30468f;if(_0x1b9a76>=_0x3e92ba){_0x1b9a76=_0x3e92ba;_0x30468f=0xc8;}else{_0x30468f=0xce;}_0x5a9557[_0x4163('0x14')](_0x30468f);return _0x5a9557[_0x4163('0x19')](_0x4163('0x1a'),_0x4b454d+'-'+_0x1b9a76+'/'+_0x3e92ba)[_0x4163('0x1b')](_0x315995);}return null;};}function saveUpdates(_0x2fdbb1){return function(_0x23fac1){if(_0x23fac1){return _0x23fac1[_0x4163('0x1c')](_0x2fdbb1)[_0x4163('0x1d')](function(_0x3eed4d){return _0x3eed4d;});}return null;};}function removeEntity(_0x134316){return function(_0x1d7d3a){if(_0x1d7d3a){return _0x1d7d3a[_0x4163('0x1e')]()[_0x4163('0x1d')](function(){_0x134316['status'](0xcc)[_0x4163('0x13')]();});}};}function handleEntityNotFound(_0x27058e){return function(_0x1b803b){if(!_0x1b803b){_0x27058e[_0x4163('0x12')](0x194);}return _0x1b803b;};}function handleError(_0x4efeac,_0x3204ef){_0x3204ef=_0x3204ef||0x1f4;return function(_0x41405d){logger['error'](_0x41405d[_0x4163('0x1f')]);if(_0x41405d[_0x4163('0x20')]){delete _0x41405d['name'];}_0x4efeac[_0x4163('0x14')](_0x3204ef)[_0x4163('0x21')](_0x41405d);};}exports['index']=function(_0x3d573d,_0x1576fb){var _0x2d633c={};var _0x2653b8=_[_0x4163('0x22')](db[_0x4163('0x23')][_0x4163('0x24')],function(_0x36d438){return{'name':_0x36d438[_0x4163('0x25')],'type':_0x36d438[_0x4163('0x26')][_0x4163('0x27')]};});_0x2d633c=qs[_0x4163('0x28')](_0x2653b8,_0x3d573d);return interaction[_0x4163('0x29')]('openchannel',_0x3d573d[_0x4163('0x2a')],_0x3d573d[_0x4163('0x2b')],_0x2d633c,_0x2653b8)[_0x4163('0x1d')](respondWithFilteredResult(_0x1576fb,_0x2d633c))['catch'](handleError(_0x1576fb,null));};exports[_0x4163('0x2c')]=function(_0x446365,_0x51fb5e){var _0x51008a={};if(_0x446365[_0x4163('0x2a')][_0x4163('0x26')]&&_0x446365[_0x4163('0x2a')][_0x4163('0x26')]===_0x4163('0x2d')){_0x51008a['from']=_0x446365[_0x4163('0x2e')]['id'];}else{_0x51008a['id']=_0x446365[_0x4163('0x2e')]['id'];}var _0x3403a5={'raw':![],'where':_0x51008a},_0x496a98={};_0x496a98['model']=_['keys'](db[_0x4163('0x23')][_0x4163('0x24')]);_0x496a98[_0x4163('0x2a')]=_[_0x4163('0x2f')](_0x446365[_0x4163('0x2a')]);_0x496a98[_0x4163('0x30')]=_[_0x4163('0x31')](_0x496a98[_0x4163('0x32')],_0x496a98[_0x4163('0x2a')]);_0x3403a5[_0x4163('0x33')]=_[_0x4163('0x31')](_0x496a98[_0x4163('0x32')],qs[_0x4163('0x34')](_0x446365[_0x4163('0x2a')][_0x4163('0x34')]));_0x3403a5[_0x4163('0x33')]=_0x3403a5[_0x4163('0x33')][_0x4163('0x35')]?_0x3403a5['attributes']:_0x496a98['model'];if(_0x446365['query']['includeAll']){_0x3403a5[_0x4163('0x36')]=[{'all':!![]}];}_0x3403a5=_['merge']({},_0x3403a5,_0x446365[_0x4163('0x37')]);return db[_0x4163('0x23')]['find'](_0x3403a5)[_0x4163('0x1d')](handleEntityNotFound(_0x51fb5e,null))['then'](respondWithResult(_0x51fb5e,null))['catch'](handleError(_0x51fb5e,null));};exports[_0x4163('0x38')]=function(_0x3bc05e,_0x1762bc){return db[_0x4163('0x23')][_0x4163('0x38')](_0x3bc05e[_0x4163('0x39')],{})[_0x4163('0x1d')](respondWithResult(_0x1762bc,0xc9))[_0x4163('0x3a')](handleError(_0x1762bc,null));};exports['update']=function(_0x298df3,_0x423410){if(_0x298df3['body']['id']){delete _0x298df3['body']['id'];}return db['OpenchannelInteraction'][_0x4163('0x3b')]({'where':{'id':_0x298df3[_0x4163('0x2e')]['id']}})['then'](handleEntityNotFound(_0x423410,null))['then'](saveUpdates(_0x298df3[_0x4163('0x39')],null))[_0x4163('0x1d')](respondWithResult(_0x423410,null))[_0x4163('0x3a')](handleError(_0x423410,null));};exports['destroy']=function(_0x3ff6ff,_0x3676f1){return db[_0x4163('0x23')][_0x4163('0x3b')]({'where':{'id':_0x3ff6ff[_0x4163('0x2e')]['id']}})[_0x4163('0x1d')](handleEntityNotFound(_0x3676f1,null))[_0x4163('0x1d')](removeEntity(_0x3676f1,null))['catch'](handleError(_0x3676f1,null));};exports[_0x4163('0x3c')]=function(_0x32fc4b,_0x23b599){return db['OpenchannelInteraction'][_0x4163('0x3c')]()[_0x4163('0x1d')](respondWithResult(_0x23b599,null))['catch'](handleError(_0x23b599,null));};exports[_0x4163('0x3d')]=function(_0x2a8c16,_0x4a8cee){return db[_0x4163('0x3e')][_0x4163('0x3b')]({'where':{'id':_0x2a8c16['params']['id']}})[_0x4163('0x1d')](handleEntityNotFound(_0x4a8cee,null))[_0x4163('0x1d')](function(_0x1168bc){if(_0x1168bc){return _0x1168bc[_0x4163('0x3d')](_0x2a8c16[_0x4163('0x39')][_0x4163('0x3f')],_['omit'](_0x2a8c16[_0x4163('0x39')],[_0x4163('0x3f'),'id'])||{});}})[_0x4163('0x1d')](respondWithResult(_0x4a8cee,null))[_0x4163('0x3a')](handleError(_0x4a8cee,null));};exports[_0x4163('0x40')]=function(_0x1b4778,_0xd2a4f){var _0x4f86a8={'raw':![],'where':{}};var _0x4f46b1={};var _0x37ee42={'count':0x0,'rows':[]};return db['OpenchannelInteraction']['findOne']({'where':{'id':_0x1b4778[_0x4163('0x2e')]['id']}})[_0x4163('0x1d')](handleEntityNotFound(_0xd2a4f,null))[_0x4163('0x1d')](function(_0x2cac09){if(_0x2cac09){_0x4f46b1[_0x4163('0x32')]=_[_0x4163('0x2f')](db[_0x4163('0x3e')][_0x4163('0x24')]);_0x4f46b1[_0x4163('0x2a')]=_[_0x4163('0x2f')](_0x1b4778[_0x4163('0x2a')]);_0x4f46b1[_0x4163('0x30')]=_[_0x4163('0x31')](_0x4f46b1[_0x4163('0x32')],_0x4f46b1[_0x4163('0x2a')]);_0x4f86a8[_0x4163('0x33')]=_[_0x4163('0x31')](_0x4f46b1[_0x4163('0x32')],qs['fields'](_0x1b4778['query'][_0x4163('0x34')]));_0x4f86a8[_0x4163('0x33')]=_0x4f86a8[_0x4163('0x33')]['length']?_0x4f86a8['attributes']:_0x4f46b1['model'];if(!_0x1b4778[_0x4163('0x2a')][_0x4163('0x41')](_0x4163('0x42'))){_0x4f86a8['limit']=qs[_0x4163('0x17')](_0x1b4778[_0x4163('0x2a')]['limit']);_0x4f86a8['offset']=qs[_0x4163('0x15')](_0x1b4778[_0x4163('0x2a')]['offset']);}_0x4f86a8[_0x4163('0x43')]=qs[_0x4163('0x44')](_0x1b4778[_0x4163('0x2a')][_0x4163('0x44')]);_0x4f86a8[_0x4163('0x45')]=qs[_0x4163('0x30')](_['pick'](_0x1b4778[_0x4163('0x2a')],_0x4f46b1[_0x4163('0x30')]));_0x4f86a8['where'][_0x4163('0x46')]=_0x2cac09['id'];if(_0x1b4778[_0x4163('0x2a')][_0x4163('0x47')]){_0x4f86a8[_0x4163('0x45')]=_[_0x4163('0x48')](_0x4f86a8[_0x4163('0x45')],{'$or':_[_0x4163('0x22')](_0x4f86a8[_0x4163('0x33')],function(_0x1beb19){var _0xbf18c5={};_0xbf18c5[_0x1beb19]={'$like':'%'+_0x1b4778[_0x4163('0x2a')]['filter']+'%'};return _0xbf18c5;})});}if(_0x1b4778[_0x4163('0x2a')][_0x4163('0x49')]){var _0x2210ea=_0x1b4778[_0x4163('0x2a')][_0x4163('0x49')]['split'](',');var _0x209a99={};_0x209a99[_0x2210ea[0x0]]={'$gte':moment(_0x2210ea[0x1])[_0x4163('0x4a')](_0x4163('0x4b'))};_0x4f86a8['where']=_[_0x4163('0x48')](_0x4f86a8[_0x4163('0x45')],_0x209a99);}_0x4f86a8=_['merge']({},_0x4f86a8,_0x1b4778[_0x4163('0x37')]);return db[_0x4163('0x3e')]['count']({'where':_0x4f86a8[_0x4163('0x45')]})[_0x4163('0x1d')](function(_0x34b9fa){_0x37ee42[_0x4163('0x18')]=_0x34b9fa;if(_0x1b4778[_0x4163('0x2a')]['includeAll']){_0x4f86a8[_0x4163('0x36')]=[{'all':!![]}];}return db[_0x4163('0x3e')][_0x4163('0x29')](_0x4f86a8);})[_0x4163('0x1d')](function(_0x5e509f){_0x37ee42[_0x4163('0x4c')]=_0x5e509f;return _0x37ee42;});}})[_0x4163('0x1d')](respondWithFilteredResult(_0xd2a4f,_0x4f86a8))[_0x4163('0x3a')](handleError(_0xd2a4f,null));};exports[_0x4163('0x4d')]=function(_0x225bde,_0xca6d36){return db[_0x4163('0x23')][_0x4163('0x3b')]({'where':{'id':_0x225bde[_0x4163('0x2e')]['id']}})['then'](handleEntityNotFound(_0xca6d36,null))[_0x4163('0x1d')](function(_0xf3906){if(_0xf3906){return _0xf3906['setTags'](_0x225bde['body'][_0x4163('0x3f')],_[_0x4163('0x4e')](_0x225bde[_0x4163('0x39')],['ids','id'])||{})['spread'](function(){return db[_0x4163('0x4f')]['findAll']({'attributes':['id',_0x4163('0x20'),'color'],'where':{'id':_0x225bde[_0x4163('0x39')][_0x4163('0x3f')]}});})[_0x4163('0x1d')](function(_0x135adb){socket[_0x4163('0x50')](_0x4163('0x51'),{'id':Number(_0x225bde[_0x4163('0x2e')]['id']),'tags':_0x135adb||[]});return{'id':Number(_0x225bde[_0x4163('0x2e')]['id']),'tags':_0x135adb||[]};});}})[_0x4163('0x1d')](respondWithResult(_0xca6d36,null))['catch'](handleError(_0xca6d36,null));};exports[_0x4163('0x52')]=function(_0x3f54c4,_0x219b5b){return db['OpenchannelInteraction']['find']({'where':{'id':_0x3f54c4[_0x4163('0x2e')]['id']}})[_0x4163('0x1d')](handleEntityNotFound(_0x219b5b,null))['then'](function(_0x358ab9){if(_0x358ab9){return _0x358ab9[_0x4163('0x52')](_0x3f54c4[_0x4163('0x2a')]['ids']);}})[_0x4163('0x1d')](respondWithStatusCode(_0x219b5b,null))[_0x4163('0x3a')](handleError(_0x219b5b,null));};exports[_0x4163('0x53')]=function(_0x2e0638,_0x547544){var _0x44f1bb=moment()['unix']()[_0x4163('0x54')]();var _0x4e29c9=path[_0x4163('0x55')](config[_0x4163('0x56')],'server',_0x4163('0x57'),'tmp');var _0x571105=path[_0x4163('0x55')](config[_0x4163('0x56')],_0x4163('0x58'),'files',_0x4163('0x59'));var _0x533c13=path['join'](_0x4e29c9,_0x44f1bb);var _0x313fa2=util[_0x4163('0x4a')]('transcript-%d-%s.zip',_0x2e0638[_0x4163('0x2e')]['id'],_0x44f1bb);var _0x14861e=path['join'](_0x4e29c9,_0x313fa2);var _0x52403d=[];_0x52403d[_0x4163('0x5a')]({'model':db[_0x4163('0x5b')],'as':_0x4163('0x5b'),'attributes':['id','fullname'],'raw':!![]});_0x52403d['push']({'model':db[_0x4163('0x5c')],'as':_0x4163('0x5d'),'attributes':['id','firstName',_0x4163('0x5e')],'raw':!![]});if(_0x2e0638['query'][_0x4163('0x59')]){_0x52403d['push']({'model':db[_0x4163('0x5f')],'as':_0x4163('0x5f'),'raw':!![]});}var _0x40984f=[{'model':db[_0x4163('0x3e')],'as':_0x4163('0x60'),'attributes':['id',_0x4163('0x39'),_0x4163('0x61'),_0x4163('0x62'),_0x4163('0x63'),_0x4163('0x64')],'include':_0x52403d}];_0x40984f[_0x4163('0x5a')]({'model':db[_0x4163('0x65')],'as':'Account','attributes':['id',_0x4163('0x20')]});_0x40984f['push']({'model':db[_0x4163('0x5b')],'as':_0x4163('0x66'),'attributes':['id',_0x4163('0x67')]});return db[_0x4163('0x23')][_0x4163('0x3b')]({'where':{'id':_0x2e0638[_0x4163('0x2e')]['id']},'include':_0x40984f})[_0x4163('0x1d')](handleEntityNotFound(_0x547544,null))['then'](function(_0xba0402){if(_0xba0402){var _0x77cdf0=_0xba0402['get']({'plain':!![]});fs[_0x4163('0x68')](_0x533c13);var _0x5976f8={'channel':'Openchannel','account':_0x77cdf0[_0x4163('0x69')][_0x4163('0x20')],'agent':_0x77cdf0['Owner']?_0x77cdf0['Owner'][_0x4163('0x67')]:_0x4163('0x6a'),'createdAt':moment(_0x77cdf0[_0x4163('0x61')])[_0x4163('0x4a')](_0x4163('0x4b'))[_0x4163('0x54')](),'closedAt':_0x77cdf0[_0x4163('0x6b')]?moment(_0x77cdf0[_0x4163('0x6c')])['format'](_0x4163('0x4b'))[_0x4163('0x54')]():'','disposition':_0x77cdf0[_0x4163('0x6d')],'visibility':_0x77cdf0['threadId']?_0x4163('0x6e'):_0x4163('0x6f'),'messages':_(_0x77cdf0['Messages'])[_0x4163('0x47')]({'secret':![]})[_0x4163('0x22')](function(_0x5952c4){if(_0x5952c4[_0x4163('0x5f')]){var _0x2b60a2=path[_0x4163('0x55')](_0x571105,_0x5952c4[_0x4163('0x5f')][_0x4163('0x70')]);if(fs['existsSync'](_0x2b60a2)){fs['createReadStream'](_0x2b60a2)[_0x4163('0x71')](fs[_0x4163('0x72')](path['join'](_0x533c13,_0x5952c4[_0x4163('0x5f')][_0x4163('0x70')])));}}return{'date':moment(_0x5952c4[_0x4163('0x61')])[_0x4163('0x4a')](_0x4163('0x4b'))['toString'](),'sender':_0x5952c4[_0x4163('0x62')]==='out'?_0x5952c4[_0x4163('0x5b')]?_0x5952c4['User'][_0x4163('0x67')]:_0x4163('0x73'):_0x5952c4[_0x4163('0x5d')][_0x4163('0x74')]+(_0x5952c4[_0x4163('0x5d')][_0x4163('0x5e')]?'\x20'+_0x5952c4['Contact'][_0x4163('0x5e')]:''),'body':_0x5952c4['Attachment']?_0x5952c4[_0x4163('0x5f')][_0x4163('0x70')]:_0x5952c4[_0x4163('0x39')],'direction':_0x5952c4[_0x4163('0x62')]==='out'?'A':'C','secret':_0x5952c4[_0x4163('0x63')],'read':_0x5952c4[_0x4163('0x64')],'attachment':_0x5952c4[_0x4163('0x5f')]};})[_0x4163('0x75')]()};return ejs[_0x4163('0x76')](path[_0x4163('0x55')](config[_0x4163('0x56')],_0x4163('0x58'),_0x4163('0x77'),_0x4163('0x78')),{'interaction':_0x5976f8})['then'](function(_0x528069){var _0x50a9c4=path[_0x4163('0x55')](_0x533c13,_0x4163('0x79')+_0x77cdf0['id']+'-'+_0x44f1bb+'.pdf');var _0x231b2b={'path':_0x50a9c4,'channel':_0x4163('0x7a'),'interactionId':_0x77cdf0['id']};return pdf[_0x4163('0x7b')](_0x528069,_0x231b2b);})[_0x4163('0x1d')](function(){return new Promise(function(_0x20abb6,_0x4579d4){zipdir(_0x533c13,{'saveTo':_0x14861e},function(_0x12f04c,_0x3750a7){if(_0x12f04c)return _0x4579d4(_0x12f04c);return _0x20abb6(_0x3750a7);});})[_0x4163('0x1d')](function(){return new Promise(function(_0x3c31fe,_0x2e8a90){rimraf(_0x533c13,function(_0x168234){if(_0x168234)_0x2e8a90(_0x168234);return _0x3c31fe();});});})[_0x4163('0x1d')](function(){return _0x547544[_0x4163('0x53')](_0x14861e,_0x313fa2,function(_0x169aef){if(_0x169aef){logger[_0x4163('0x7c')](_0x4163('0x7d'),_0x169aef);}else{fs[_0x4163('0x7e')](_0x14861e);}});});});}else{return _0x547544['sendStatus'](0xc8);}})[_0x4163('0x3a')](handleError(_0x547544,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 61bc4a1..7ecf9d9 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 _0xe4f6=['exports','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','save','update','remove','getUsers','then','Users','map','setDataValue','unreadMessages','length','emit','hasOwnProperty','hook'];(function(_0x596c43,_0x28647a){var _0x4e1315=function(_0x58e910){while(--_0x58e910){_0x596c43['push'](_0x596c43['shift']());}};_0x4e1315(++_0x28647a);}(_0xe4f6,0xfd));var _0x6e4f=function(_0x11e4e4,_0x3714ed){_0x11e4e4=_0x11e4e4-0x0;var _0x3c7e74=_0xe4f6[_0x11e4e4];return _0x3c7e74;};'use strict';var EventEmitter=require(_0x6e4f('0x0'));var OpenchannelInteraction=require(_0x6e4f('0x1'))['db'][_0x6e4f('0x2')];var OpenchannelMessage=require(_0x6e4f('0x1'))['db'][_0x6e4f('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6e4f('0x4'),'afterUpdate':_0x6e4f('0x5'),'afterDestroy':_0x6e4f('0x6')};function emitEvent(_0x17e7dc){return function(_0x561a2a,_0x58bde4,_0x465785){_0x561a2a[_0x6e4f('0x7')]({'attributes':['id'],'raw':!![]})[_0x6e4f('0x8')](function(_0x12e0e2){_0x561a2a['setDataValue'](_0x6e4f('0x9'),_0x12e0e2[_0x6e4f('0xa')](function(_0x31e878){return{'id':_0x31e878['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x561a2a['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x1053c2){_0x561a2a[_0x6e4f('0xb')](_0x6e4f('0xc'),_0x1053c2[_0x6e4f('0xd')]);OpenchannelInteractionEvents['emit'](_0x17e7dc+':'+_0x561a2a['id'],_0x561a2a);OpenchannelInteractionEvents[_0x6e4f('0xe')](_0x17e7dc,_0x561a2a);_0x465785(null);})['catch'](_0x465785(null));};}for(var e in events){if(events[_0x6e4f('0xf')](e)){var event=events[e];OpenchannelInteraction[_0x6e4f('0x10')](e,emitEvent(event));}}module[_0x6e4f('0x11')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x0136=['unreadMessages','length','emit','hasOwnProperty','hook','events','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','getUsers','setDataValue','Users','findAll'];(function(_0x5502c7,_0x3149a8){var _0x28c396=function(_0x3d5b54){while(--_0x3d5b54){_0x5502c7['push'](_0x5502c7['shift']());}};_0x28c396(++_0x3149a8);}(_0x0136,0xe6));var _0x6013=function(_0x580409,_0x11a6e8){_0x580409=_0x580409-0x0;var _0x126a85=_0x0136[_0x580409];return _0x126a85;};'use strict';var EventEmitter=require(_0x6013('0x0'));var OpenchannelInteraction=require(_0x6013('0x1'))['db']['OpenchannelInteraction'];var OpenchannelMessage=require('../../mysqldb')['db'][_0x6013('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x6013('0x3')](0x0);var events={'afterCreate':_0x6013('0x4'),'afterUpdate':_0x6013('0x5'),'afterDestroy':'remove'};function emitEvent(_0x55688d){return function(_0x26bada,_0x484e34,_0x415f6e){_0x26bada[_0x6013('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x12ae18){_0x26bada[_0x6013('0x7')](_0x6013('0x8'),_0x12ae18['map'](function(_0x35b5d8){return{'id':_0x35b5d8['id']};}));return OpenchannelMessage[_0x6013('0x9')]({'where':{'OpenchannelInteractionId':_0x26bada['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x261622){_0x26bada[_0x6013('0x7')](_0x6013('0xa'),_0x261622[_0x6013('0xb')]);OpenchannelInteractionEvents[_0x6013('0xc')](_0x55688d+':'+_0x26bada['id'],_0x26bada);OpenchannelInteractionEvents[_0x6013('0xc')](_0x55688d,_0x26bada);_0x415f6e(null);})['catch'](_0x415f6e(null));};}for(var e in events){if(events[_0x6013('0xd')](e)){var event=events[e];OpenchannelInteraction[_0x6013('0xe')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 74b6d0f..b412322 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 _0x35c8=['changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','define','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci'];(function(_0x2fef36,_0x2d9657){var _0x36cb38=function(_0xe2d130){while(--_0xe2d130){_0x2fef36['push'](_0x2fef36['shift']());}};_0x36cb38(++_0x2d9657);}(_0x35c8,0xa6));var _0x835c=function(_0x2e2a2e,_0x3cced6){_0x2e2a2e=_0x2e2a2e-0x0;var _0xc65b85=_0x35c8[_0x2e2a2e];return _0xc65b85;};'use strict';var _=require(_0x835c('0x0'));var util=require(_0x835c('0x1'));var logger=require(_0x835c('0x2'))(_0x835c('0x3'));var moment=require(_0x835c('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x835c('0x5'));var rimraf=require(_0x835c('0x6'));var config=require(_0x835c('0x7'));var attributes=require(_0x835c('0x8'));module[_0x835c('0x9')]=function(_0x3c3f2f,_0x37b9ce){return _0x3c3f2f[_0x835c('0xa')]('OpenchannelInteraction',attributes,{'tableName':_0x835c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x835c('0xc'),'collate':_0x835c('0xd'),'hooks':{'beforeUpdate':function(_0x4daac6,_0x2d94ca,_0x17ff28){if(_0x4daac6[_0x835c('0xe')]('closed')){_0x4daac6[_0x835c('0xf')]=moment()[_0x835c('0x10')](_0x835c('0x11'));}_0x17ff28(null,_0x4daac6);}}});}; \ No newline at end of file +var _0x274e=['openchannel_interactions','utf8mb4_unicode_ci','closed','closedAt','util','../../config/logger','moment','request-promise','path','rimraf','./openchannelInteraction.attributes','define'];(function(_0x42bb6d,_0x412255){var _0x1db89b=function(_0x5da43a){while(--_0x5da43a){_0x42bb6d['push'](_0x42bb6d['shift']());}};_0x1db89b(++_0x412255);}(_0x274e,0x1c0));var _0xe274=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x274e[_0x1969a7];return _0x3d665f;};'use strict';var _=require('lodash');var util=require(_0xe274('0x0'));var logger=require(_0xe274('0x1'))('api');var moment=require(_0xe274('0x2'));var BPromise=require('bluebird');var rp=require(_0xe274('0x3'));var fs=require('fs');var path=require(_0xe274('0x4'));var rimraf=require(_0xe274('0x5'));var config=require('../../config/environment');var attributes=require(_0xe274('0x6'));module['exports']=function(_0x3d35d3,_0x42a0de){return _0x3d35d3[_0xe274('0x7')]('OpenchannelInteraction',attributes,{'tableName':_0xe274('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xe274('0x9'),'hooks':{'beforeUpdate':function(_0x132232,_0x4e6ad4,_0x36dac5){if(_0x132232['changed'](_0xe274('0xa'))){_0x132232[_0xe274('0xb')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x36dac5(null,_0x132232);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 2406f2b..3acc3e9 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 _0xce47=['AddTagsToOpenchannelInteraction','where','body','ids','omit','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','UpdateOpenchannelInteraction','OpenchannelInteraction','raw','options','catch'];(function(_0x1ea27e,_0xb3a713){var _0xfdbd44=function(_0x55af11){while(--_0x55af11){_0x1ea27e['push'](_0x1ea27e['shift']());}};_0xfdbd44(++_0xb3a713);}(_0xce47,0xfd));var _0x7ce4=function(_0x5f142e,_0x159dab){_0x5f142e=_0x5f142e-0x0;var _0x5c8af7=_0xce47[_0x5f142e];return _0x5c8af7;};'use strict';var _=require(_0x7ce4('0x0'));var util=require(_0x7ce4('0x1'));var moment=require(_0x7ce4('0x2'));var BPromise=require(_0x7ce4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7ce4('0x4'));var db=require(_0x7ce4('0x5'))['db'];var utils=require(_0x7ce4('0x6'));var logger=require(_0x7ce4('0x7'))(_0x7ce4('0x8'));var config=require('../../config/environment');var jayson=require(_0x7ce4('0x9'));var client=jayson[_0x7ce4('0xa')][_0x7ce4('0xb')]({'port':0x232a});config['redis']=_[_0x7ce4('0xc')](config[_0x7ce4('0xd')],{'host':_0x7ce4('0xe'),'port':0x18eb});var socket=require(_0x7ce4('0xf'))(new Redis(config[_0x7ce4('0xd')]));require(_0x7ce4('0x10'))[_0x7ce4('0x11')](socket);function respondWithRpcPromise(_0x4955ef,_0x249898,_0x25a174){return new BPromise(function(_0x4bf6a1,_0xae918c){return client[_0x7ce4('0x12')](_0x4955ef,_0x25a174)[_0x7ce4('0x13')](function(_0x5795ad){logger[_0x7ce4('0x14')](_0x7ce4('0x15'),_0x249898,'request\x20sent');logger[_0x7ce4('0x16')](_0x7ce4('0x17'),_0x249898,_0x7ce4('0x18'),JSON[_0x7ce4('0x19')](_0x5795ad));if(_0x5795ad[_0x7ce4('0x1a')]){if(_0x5795ad[_0x7ce4('0x1a')]['code']===0x1f4){logger[_0x7ce4('0x1a')](_0x7ce4('0x15'),_0x249898,_0x5795ad[_0x7ce4('0x1a')]['message']);return _0xae918c(_0x5795ad['error'][_0x7ce4('0x1b')]);}logger[_0x7ce4('0x1a')](_0x7ce4('0x15'),_0x249898,_0x5795ad[_0x7ce4('0x1a')][_0x7ce4('0x1b')]);return _0x4bf6a1(_0x5795ad[_0x7ce4('0x1a')]['message']);}else{logger[_0x7ce4('0x14')](_0x7ce4('0x15'),_0x249898,_0x7ce4('0x18'));_0x4bf6a1(_0x5795ad[_0x7ce4('0x1c')][_0x7ce4('0x1b')]);}})['catch'](function(_0x32b5fb){logger[_0x7ce4('0x1a')](_0x7ce4('0x15'),_0x249898,_0x32b5fb);_0xae918c(_0x32b5fb);});});}exports[_0x7ce4('0x1d')]=function(_0x156410){var _0x3f5ba7=this;return new Promise(function(_0x4a2389,_0x576f0a){return db[_0x7ce4('0x1e')]['update'](_0x156410['body'],{'raw':_0x156410['options']?_0x156410['options'][_0x7ce4('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x156410[_0x7ce4('0x20')]?_0x156410[_0x7ce4('0x20')]['where']||null:null,'attributes':_0x156410[_0x7ce4('0x20')]?_0x156410['options']['attributes']||null:null,'limit':_0x156410['options']?_0x156410['options']['limit']||null:null})[_0x7ce4('0x13')](function(_0x375f56){logger[_0x7ce4('0x14')](_0x7ce4('0x1d'),_0x156410);logger[_0x7ce4('0x16')](_0x7ce4('0x1d'),_0x156410,JSON[_0x7ce4('0x19')](_0x375f56));_0x4a2389(_0x375f56);})[_0x7ce4('0x21')](function(_0xe27152){logger[_0x7ce4('0x1a')](_0x7ce4('0x1d'),_0xe27152[_0x7ce4('0x1b')],_0x156410);_0x576f0a(_0x3f5ba7[_0x7ce4('0x1a')](0x1f4,_0xe27152[_0x7ce4('0x1b')]));});});};exports[_0x7ce4('0x22')]=function(_0x2ae668){return new Promise(function(_0x8279c2,_0x2d608a){return db[_0x7ce4('0x1e')]['find']({'where':_0x2ae668[_0x7ce4('0x20')]?_0x2ae668['options'][_0x7ce4('0x23')]||null:null})[_0x7ce4('0x13')](function(_0x58c24a){if(_0x58c24a){return _0x58c24a['addTags'](_0x2ae668[_0x7ce4('0x24')][_0x7ce4('0x25')],_[_0x7ce4('0x26')](_0x2ae668[_0x7ce4('0x24')],[_0x7ce4('0x25'),'id'])||{});}})[_0x7ce4('0x27')](function(_0x5dfe90){logger[_0x7ce4('0x14')](_0x7ce4('0x28'),_0x2ae668);logger['debug'](_0x7ce4('0x28'),_0x2ae668,JSON['stringify'](_0x5dfe90));_0x8279c2(_0x5dfe90);})[_0x7ce4('0x21')](function(_0x309400){logger[_0x7ce4('0x1a')](_0x7ce4('0x28'),_0x309400[_0x7ce4('0x1b')],_0x2ae668);_0x2d608a(_this['error'](0x1f4,_0x309400[_0x7ce4('0x1b')]));});});}; \ No newline at end of file +var _0x6a09=['bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','request','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','raw','options','attributes','limit','AddTagsToOpenchannelInteraction','find','where','then','ids','omit','debug','AddTags','util','moment'];(function(_0x10d575,_0x6edf30){var _0x21ce4a=function(_0x320e92){while(--_0x320e92){_0x10d575['push'](_0x10d575['shift']());}};_0x21ce4a(++_0x6edf30);}(_0x6a09,0xf4));var _0x96a0=function(_0x3eebec,_0x33de1d){_0x3eebec=_0x3eebec-0x0;var _0x422046=_0x6a09[_0x3eebec];return _0x422046;};'use strict';var _=require('lodash');var util=require(_0x96a0('0x0'));var moment=require(_0x96a0('0x1'));var BPromise=require(_0x96a0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x96a0('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x96a0('0x4'));var logger=require(_0x96a0('0x5'))(_0x96a0('0x6'));var config=require(_0x96a0('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x96a0('0x8')]['http']({'port':0x232a});config[_0x96a0('0x9')]=_[_0x96a0('0xa')](config[_0x96a0('0x9')],{'host':_0x96a0('0xb'),'port':0x18eb});var socket=require(_0x96a0('0xc'))(new Redis(config['redis']));require(_0x96a0('0xd'))['register'](socket);function respondWithRpcPromise(_0x1b04fc,_0x3ffb47,_0x53eed6){return new BPromise(function(_0x46d4d9,_0x4ca070){return client[_0x96a0('0xe')](_0x1b04fc,_0x53eed6)['then'](function(_0x22caa4){logger[_0x96a0('0xf')](_0x96a0('0x10'),_0x3ffb47,_0x96a0('0x11'));logger['debug'](_0x96a0('0x12'),_0x3ffb47,_0x96a0('0x11'),JSON[_0x96a0('0x13')](_0x22caa4));if(_0x22caa4['error']){if(_0x22caa4[_0x96a0('0x14')][_0x96a0('0x15')]===0x1f4){logger[_0x96a0('0x14')](_0x96a0('0x10'),_0x3ffb47,_0x22caa4[_0x96a0('0x14')]['message']);return _0x4ca070(_0x22caa4[_0x96a0('0x14')]['message']);}logger[_0x96a0('0x14')](_0x96a0('0x10'),_0x3ffb47,_0x22caa4[_0x96a0('0x14')][_0x96a0('0x16')]);return _0x46d4d9(_0x22caa4[_0x96a0('0x14')][_0x96a0('0x16')]);}else{logger[_0x96a0('0xf')](_0x96a0('0x10'),_0x3ffb47,_0x96a0('0x11'));_0x46d4d9(_0x22caa4[_0x96a0('0x17')][_0x96a0('0x16')]);}})[_0x96a0('0x18')](function(_0x2c99b9){logger[_0x96a0('0x14')](_0x96a0('0x10'),_0x3ffb47,_0x2c99b9);_0x4ca070(_0x2c99b9);});});}exports[_0x96a0('0x19')]=function(_0x5a4056){var _0x3c2c4e=this;return new Promise(function(_0x3c777c,_0x58ae40){return db[_0x96a0('0x1a')][_0x96a0('0x1b')](_0x5a4056[_0x96a0('0x1c')],{'raw':_0x5a4056['options']?_0x5a4056['options'][_0x96a0('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5a4056[_0x96a0('0x1e')]?_0x5a4056['options']['where']||null:null,'attributes':_0x5a4056[_0x96a0('0x1e')]?_0x5a4056['options'][_0x96a0('0x1f')]||null:null,'limit':_0x5a4056[_0x96a0('0x1e')]?_0x5a4056[_0x96a0('0x1e')][_0x96a0('0x20')]||null:null})['then'](function(_0x181300){logger[_0x96a0('0xf')](_0x96a0('0x19'),_0x5a4056);logger['debug']('UpdateOpenchannelInteraction',_0x5a4056,JSON[_0x96a0('0x13')](_0x181300));_0x3c777c(_0x181300);})[_0x96a0('0x18')](function(_0xbfa225){logger[_0x96a0('0x14')](_0x96a0('0x19'),_0xbfa225[_0x96a0('0x16')],_0x5a4056);_0x58ae40(_0x3c2c4e[_0x96a0('0x14')](0x1f4,_0xbfa225[_0x96a0('0x16')]));});});};exports[_0x96a0('0x21')]=function(_0x141160){return new Promise(function(_0x142063,_0x3eb14e){return db[_0x96a0('0x1a')][_0x96a0('0x22')]({'where':_0x141160[_0x96a0('0x1e')]?_0x141160[_0x96a0('0x1e')][_0x96a0('0x23')]||null:null})[_0x96a0('0x24')](function(_0x10a396){if(_0x10a396){return _0x10a396['addTags'](_0x141160[_0x96a0('0x1c')][_0x96a0('0x25')],_[_0x96a0('0x26')](_0x141160[_0x96a0('0x1c')],[_0x96a0('0x25'),'id'])||{});}})['spread'](function(_0x175d9b){logger['info']('AddTags',_0x141160);logger[_0x96a0('0x27')](_0x96a0('0x28'),_0x141160,JSON[_0x96a0('0x13')](_0x175d9b));_0x142063(_0x175d9b);})[_0x96a0('0x18')](function(_0x3f211b){logger['error'](_0x96a0('0x28'),_0x3f211b[_0x96a0('0x16')],_0x141160);_0x3eb14e(_this[_0x96a0('0x14')](0x1f4,_0x3f211b['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 103902a..94b4282 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 _0x4d46=['remove','removeListener','length','openchannelInteraction:','./openchannelInteraction.events'];(function(_0x17a675,_0x592946){var _0x75c146=function(_0x65f986){while(--_0x65f986){_0x17a675['push'](_0x17a675['shift']());}};_0x75c146(++_0x592946);}(_0x4d46,0xea));var _0x64d4=function(_0x167760,_0x504953){_0x167760=_0x167760-0x0;var _0xaf842d=_0x4d46[_0x167760];return _0xaf842d;};'use strict';var OpenchannelInteractionEvents=require(_0x64d4('0x0'));var events=['save',_0x64d4('0x1'),'update'];function createListener(_0x4e06ae,_0x396121){return function(_0x44a88b){_0x396121['emit'](_0x4e06ae,_0x44a88b);};}function removeListener(_0xb78434,_0x4eecfb){return function(){OpenchannelInteractionEvents[_0x64d4('0x2')](_0xb78434,_0x4eecfb);};}exports['register']=function(_0x2350cb){for(var _0x294cf7=0x0,_0x15dfc1=events[_0x64d4('0x3')];_0x294cf7<_0x15dfc1;_0x294cf7++){var _0x12a756=events[_0x294cf7];var _0x2abf20=createListener(_0x64d4('0x4')+_0x12a756,_0x2350cb);OpenchannelInteractionEvents['on'](_0x12a756,_0x2abf20);}}; \ No newline at end of file +var _0x5a11=['remove','update','removeListener','register','length','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5a11,0xb9));var _0x15a1=function(_0x5eea45,_0x51a003){_0x5eea45=_0x5eea45-0x0;var _0x12b09f=_0x5a11[_0x5eea45];return _0x12b09f;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0x15a1('0x0'),_0x15a1('0x1'),_0x15a1('0x2')];function createListener(_0x49f084,_0x3962e1){return function(_0x4b8ce4){_0x3962e1['emit'](_0x49f084,_0x4b8ce4);};}function removeListener(_0x335b49,_0x5f4418){return function(){OpenchannelInteractionEvents[_0x15a1('0x3')](_0x335b49,_0x5f4418);};}exports[_0x15a1('0x4')]=function(_0x271b09){for(var _0x5811e3=0x0,_0x4a3627=events[_0x15a1('0x5')];_0x5811e3<_0x4a3627;_0x5811e3++){var _0x5c6cdf=events[_0x5811e3];var _0x2f343c=createListener('openchannelInteraction:'+_0x5c6cdf,_0x271b09);OpenchannelInteractionEvents['on'](_0x5c6cdf,_0x2f343c);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index d60681c..9f4e843 100644 --- a/server/api/openchannelMessage/index.js +++ b/server/api/openchannelMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['index','/describe','show','post','isAuthenticated','tracked','openchannel','openchannelmessage:create','update','put','/:id/accept','accept','reject','delete','/:id','destroy','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get'];(function(_0x3a70da,_0x39798){var _0x23bb82=function(_0x264c2b){while(--_0x264c2b){_0x3a70da['push'](_0x3a70da['shift']());}};_0x23bb82(++_0x39798);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),interaction[_0x0a9e('0xe')](_0x0a9e('0xf'),_0x0a9e('0x10')),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0x11')]);router[_0x0a9e('0x12')](_0x0a9e('0x13'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);router[_0x0a9e('0x12')]('/:id/reject',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x15')]);router[_0x0a9e('0x16')](_0x0a9e('0x17'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x18')]);module['exports']=router; \ No newline at end of file +var _0x70e0=['put','update','/:id/accept','accept','destroy','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','isAuthenticated','describe','get','/:id','show','post','openchannel','openchannelmessage:create','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x70e0,0x17b));var _0x070e=function(_0x2e0357,_0x1473cb){_0x2e0357=_0x2e0357-0x0;var _0x3c4ec7=_0x70e0[_0x2e0357];return _0x3c4ec7;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');var controller=require(_0x070e('0x7'));router['get']('/',auth[_0x070e('0x8')](),controller['index']);router['get']('/describe',auth[_0x070e('0x8')](),controller[_0x070e('0x9')]);router[_0x070e('0xa')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0xc')]);router[_0x070e('0xd')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x070e('0xe'),_0x070e('0xf')),controller[_0x070e('0x10')]);router[_0x070e('0x11')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0x12')]);router[_0x070e('0x11')](_0x070e('0x13'),auth[_0x070e('0x8')](),controller[_0x070e('0x14')]);router['put']('/:id/reject',auth[_0x070e('0x8')](),controller['reject']);router['delete']('/:id',auth[_0x070e('0x8')](),controller[_0x070e('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 5d02fba..863517b 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 _0xcce8=['medium','BOOLEAN','ENUM','out','DATE','sequelize','exports','TEXT'];(function(_0x4fda99,_0x30a790){var _0x2fa306=function(_0x224c70){while(--_0x224c70){_0x4fda99['push'](_0x4fda99['shift']());}};_0x2fa306(++_0x30a790);}(_0xcce8,0x1a5));var _0x8cce=function(_0x3dd859,_0x3388ad){_0x3dd859=_0x3dd859-0x0;var _0x13501f=_0xcce8[_0x3dd859];return _0x13501f;};'use strict';var Sequelize=require(_0x8cce('0x0'));module[_0x8cce('0x1')]={'body':{'type':Sequelize[_0x8cce('0x2')](_0x8cce('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x8cce('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x8cce('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x8cce('0x5')]('in',_0x8cce('0x6')),'defaultValue':_0x8cce('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0x8cce('0x7')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x8cce('0x2')]}}; \ No newline at end of file +var _0x4c4d=['out','DATE','STRING','TEXT','sequelize','BOOLEAN'];(function(_0x42b21d,_0x58a3e7){var _0x590a15=function(_0x19b771){while(--_0x19b771){_0x42b21d['push'](_0x42b21d['shift']());}};_0x590a15(++_0x58a3e7);}(_0x4c4d,0x1a2));var _0xd4c4=function(_0x4941f1,_0x1f2c07){_0x4941f1=_0x4941f1-0x0;var _0x20dfba=_0x4c4d[_0x4941f1];return _0x20dfba;};'use strict';var Sequelize=require(_0xd4c4('0x0'));module['exports']={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0xd4c4('0x1')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xd4c4('0x2')),'defaultValue':_0xd4c4('0x2'),'allowNull':![]},'readAt':{'type':Sequelize[_0xd4c4('0x3')]},'providerName':{'type':Sequelize[_0xd4c4('0x4')]},'providerResponse':{'type':Sequelize[_0xd4c4('0x5')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 5b196b8..6d8b95d 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 _0x59cd=['SIP/%s','channel','event','accept','EventManager','acceptmessage','OpenchannelInteraction','RejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','QueryTypes','motionChannel','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','http','client','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','status','end','limit','undefined','count','offset','set','Content-Range','json','reject','save','update','destroy','sendStatus','stack','name','send','map','OpenchannelMessage','rawAttributes','type','key','model','query','filters','attributes','fields','length','nolimit','sort','filter','where','merge','VIRTUAL','options','show','params','keys','intersection','includeAll','include','find','create','body','describe','openchannel-interactions','openchannel','read','format','UserId','user','agent','get','OpenchannelInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','role','null','acceptMessage','ContactId','sequelize','Sequelize','SELECT','contact','User','fullname','email','internal','manual'];(function(_0x4a4922,_0x82cb8f){var _0x55a8c6=function(_0x59712e){while(--_0x59712e){_0x4a4922['push'](_0x4a4922['shift']());}};_0x55a8c6(++_0x82cb8f);}(_0x59cd,0x108));var _0xd59c=function(_0x2d72ab,_0x5a97f5){_0x2d72ab=_0x2d72ab-0x0;var _0x256423=_0x59cd[_0x2d72ab];return _0x256423;};'use strict';var emlformat=require(_0xd59c('0x0'));var rimraf=require(_0xd59c('0x1'));var zipdir=require(_0xd59c('0x2'));var jsonpatch=require(_0xd59c('0x3'));var rp=require(_0xd59c('0x4'));var moment=require(_0xd59c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xd59c('0x6'));var util=require(_0xd59c('0x7'));var path=require(_0xd59c('0x8'));var sox=require(_0xd59c('0x9'));var csv=require(_0xd59c('0xa'));var ejs=require(_0xd59c('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd59c('0xc'));var squel=require(_0xd59c('0xd'));var crypto=require(_0xd59c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xd59c('0xf'));var toCsv=require(_0xd59c('0xa'));var querystring=require(_0xd59c('0x10'));var Papa=require(_0xd59c('0x11'));var Redis=require(_0xd59c('0x12'));var authService=require(_0xd59c('0x13'));var qs=require(_0xd59c('0x14'));var as=require(_0xd59c('0x15'));var hardwareService=require(_0xd59c('0x16'));var logger=require(_0xd59c('0x17'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd59c('0x18'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xd59c('0x19')](config[_0xd59c('0x1a')],{'host':_0xd59c('0x1b'),'port':0x18eb});var socket=require(_0xd59c('0x1c'))(new Redis(config[_0xd59c('0x1a')]));require(_0xd59c('0x1d'))[_0xd59c('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xd59c('0x1f')]({'port':0x232c});var client9002=jayson[_0xd59c('0x20')][_0xd59c('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x24efe1,_0x53962c,_0x4bd545,_0x366924){return new BPromise(function(_0x4e41ce,_0x5f1b56){var _0x3be561=_0x366924||client;return _0x3be561['request'](_0x24efe1,_0x4bd545)[_0xd59c('0x21')](function(_0x23049d){logger[_0xd59c('0x22')](_0xd59c('0x23'),_0x53962c,_0xd59c('0x24'));logger[_0xd59c('0x25')](_0xd59c('0x26'),_0x53962c,_0xd59c('0x24'),JSON[_0xd59c('0x27')](_0x23049d));if(_0x23049d[_0xd59c('0x28')]){if(_0x23049d[_0xd59c('0x28')]['code']===0x1f4){logger[_0xd59c('0x28')](_0xd59c('0x23'),_0x53962c,_0x23049d[_0xd59c('0x28')][_0xd59c('0x29')]);return _0x5f1b56(_0x23049d[_0xd59c('0x28')][_0xd59c('0x29')]);}logger[_0xd59c('0x28')](_0xd59c('0x23'),_0x53962c,_0x23049d[_0xd59c('0x28')][_0xd59c('0x29')]);return _0x4e41ce(_0x23049d[_0xd59c('0x28')][_0xd59c('0x29')]);}else{logger[_0xd59c('0x22')](_0xd59c('0x23'),_0x53962c,'request\x20sent');_0x4e41ce(_0x23049d['result']['message']);}})[_0xd59c('0x2a')](function(_0x146ecf){logger[_0xd59c('0x28')]('OpenchannelMessage,\x20%s,\x20%s',_0x53962c,_0x146ecf);_0x5f1b56(_0x146ecf);});});}function respondWithStatusCode(_0x47cf46,_0x115e1f){_0x115e1f=_0x115e1f||0xcc;return function(_0x2fb932){if(_0x2fb932){return _0x47cf46['sendStatus'](_0x115e1f);}return _0x47cf46[_0xd59c('0x2b')](_0x115e1f)[_0xd59c('0x2c')]();};}function respondWithResult(_0x50dc58,_0x5d7ea1){_0x5d7ea1=_0x5d7ea1||0xc8;return function(_0x1e27ac){if(_0x1e27ac){return _0x50dc58['status'](_0x5d7ea1)['json'](_0x1e27ac);}};}function respondWithFilteredResult(_0x1e159d,_0x5af2a1){return function(_0x8478c7){if(_0x8478c7){var _0x4e7776=typeof _0x5af2a1['offset']==='undefined'&&typeof _0x5af2a1[_0xd59c('0x2d')]===_0xd59c('0x2e');var _0x4e2b2d=_0x8478c7[_0xd59c('0x2f')];var _0x497e33=_0x4e7776?0x0:_0x5af2a1[_0xd59c('0x30')];var _0x1723d9=_0x4e7776?_0x8478c7['count']:_0x5af2a1[_0xd59c('0x30')]+_0x5af2a1[_0xd59c('0x2d')];var _0x2f50bf;if(_0x1723d9>=_0x4e2b2d){_0x1723d9=_0x4e2b2d;_0x2f50bf=0xc8;}else{_0x2f50bf=0xce;}_0x1e159d[_0xd59c('0x2b')](_0x2f50bf);return _0x1e159d[_0xd59c('0x31')](_0xd59c('0x32'),_0x497e33+'-'+_0x1723d9+'/'+_0x4e2b2d)[_0xd59c('0x33')](_0x8478c7);}return null;};}function patchUpdates(_0x89b1a5){return function(_0x3beb78){try{jsonpatch['apply'](_0x3beb78,_0x89b1a5,!![]);}catch(_0x1eb67a){return BPromise[_0xd59c('0x34')](_0x1eb67a);}return _0x3beb78[_0xd59c('0x35')]();};}function saveUpdates(_0x5b721a,_0x2efa8a){return function(_0x55d13b){if(_0x55d13b){return _0x55d13b[_0xd59c('0x36')](_0x5b721a)[_0xd59c('0x21')](function(_0x4cdbe3){return _0x4cdbe3;});}return null;};}function removeEntity(_0x5e418c,_0x57a0f9){return function(_0x10d193){if(_0x10d193){return _0x10d193[_0xd59c('0x37')]()[_0xd59c('0x21')](function(){_0x5e418c[_0xd59c('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2bbb13,_0x5cd942){return function(_0x1392f5){if(!_0x1392f5){_0x2bbb13[_0xd59c('0x38')](0x194);}return _0x1392f5;};}function handleError(_0x2630ee,_0x4ddcfa){_0x4ddcfa=_0x4ddcfa||0x1f4;return function(_0x2863c3){logger[_0xd59c('0x28')](_0x2863c3[_0xd59c('0x39')]);if(_0x2863c3[_0xd59c('0x3a')]){delete _0x2863c3[_0xd59c('0x3a')];}_0x2630ee[_0xd59c('0x2b')](_0x4ddcfa)[_0xd59c('0x3b')](_0x2863c3);};}exports['index']=function(_0x3446cf,_0x236ef0){var _0x219dca={},_0x57e2d3={},_0x4824a5={'count':0x0,'rows':[]};var _0x260817=_[_0xd59c('0x3c')](db[_0xd59c('0x3d')][_0xd59c('0x3e')],function(_0x41eedb){return{'name':_0x41eedb['fieldName'],'type':_0x41eedb[_0xd59c('0x3f')][_0xd59c('0x40')]};});_0x57e2d3[_0xd59c('0x41')]=_[_0xd59c('0x3c')](_0x260817,_0xd59c('0x3a'));_0x57e2d3[_0xd59c('0x42')]=_['keys'](_0x3446cf[_0xd59c('0x42')]);_0x57e2d3[_0xd59c('0x43')]=_['intersection'](_0x57e2d3[_0xd59c('0x41')],_0x57e2d3[_0xd59c('0x42')]);_0x219dca[_0xd59c('0x44')]=_['intersection'](_0x57e2d3[_0xd59c('0x41')],qs['fields'](_0x3446cf[_0xd59c('0x42')][_0xd59c('0x45')]));_0x219dca[_0xd59c('0x44')]=_0x219dca[_0xd59c('0x44')][_0xd59c('0x46')]?_0x219dca['attributes']:_0x57e2d3['model'];if(!_0x3446cf[_0xd59c('0x42')]['hasOwnProperty'](_0xd59c('0x47'))){_0x219dca[_0xd59c('0x2d')]=qs[_0xd59c('0x2d')](_0x3446cf[_0xd59c('0x42')][_0xd59c('0x2d')]);_0x219dca['offset']=qs[_0xd59c('0x30')](_0x3446cf[_0xd59c('0x42')][_0xd59c('0x30')]);}_0x219dca['order']=qs[_0xd59c('0x48')](_0x3446cf[_0xd59c('0x42')][_0xd59c('0x48')]);_0x219dca['where']=qs[_0xd59c('0x43')](_['pick'](_0x3446cf[_0xd59c('0x42')],_0x57e2d3[_0xd59c('0x43')]),_0x260817);if(_0x3446cf[_0xd59c('0x42')][_0xd59c('0x49')]){_0x219dca[_0xd59c('0x4a')]=_[_0xd59c('0x4b')](_0x219dca[_0xd59c('0x4a')],{'$or':_[_0xd59c('0x3c')](_0x260817,function(_0x532b02){if(_0x532b02['type']!==_0xd59c('0x4c')){var _0x54e437={};_0x54e437[_0x532b02[_0xd59c('0x3a')]]={'$like':'%'+_0x3446cf['query']['filter']+'%'};return _0x54e437;}})});}_0x219dca=_['merge']({},_0x219dca,_0x3446cf[_0xd59c('0x4d')]);var _0x4797e2={'where':_0x219dca[_0xd59c('0x4a')]};return db[_0xd59c('0x3d')][_0xd59c('0x2f')](_0x4797e2)[_0xd59c('0x21')](function(_0x3f7a7b){_0x4824a5[_0xd59c('0x2f')]=_0x3f7a7b;if(_0x3446cf['query']['includeAll']){_0x219dca['include']=[{'all':!![]}];}return db[_0xd59c('0x3d')]['findAll'](_0x219dca);})[_0xd59c('0x21')](function(_0x55474c){_0x4824a5['rows']=_0x55474c;return _0x4824a5;})[_0xd59c('0x21')](respondWithFilteredResult(_0x236ef0,_0x219dca))['catch'](handleError(_0x236ef0,null));};exports[_0xd59c('0x4e')]=function(_0x36ef68,_0x8c8b4f){var _0x2e4cea={'raw':!![],'where':{'id':_0x36ef68[_0xd59c('0x4f')]['id']}},_0x77149e={};_0x77149e[_0xd59c('0x41')]=_[_0xd59c('0x50')](db[_0xd59c('0x3d')][_0xd59c('0x3e')]);_0x77149e['query']=_['keys'](_0x36ef68['query']);_0x77149e[_0xd59c('0x43')]=_[_0xd59c('0x51')](_0x77149e[_0xd59c('0x41')],_0x77149e[_0xd59c('0x42')]);_0x2e4cea['attributes']=_[_0xd59c('0x51')](_0x77149e[_0xd59c('0x41')],qs[_0xd59c('0x45')](_0x36ef68[_0xd59c('0x42')][_0xd59c('0x45')]));_0x2e4cea[_0xd59c('0x44')]=_0x2e4cea[_0xd59c('0x44')][_0xd59c('0x46')]?_0x2e4cea[_0xd59c('0x44')]:_0x77149e['model'];if(_0x36ef68[_0xd59c('0x42')][_0xd59c('0x52')]){_0x2e4cea[_0xd59c('0x53')]=[{'all':!![]}];}_0x2e4cea=_[_0xd59c('0x4b')]({},_0x2e4cea,_0x36ef68[_0xd59c('0x4d')]);return db[_0xd59c('0x3d')][_0xd59c('0x54')](_0x2e4cea)['then'](handleEntityNotFound(_0x8c8b4f,null))[_0xd59c('0x21')](respondWithResult(_0x8c8b4f,null))[_0xd59c('0x2a')](handleError(_0x8c8b4f,null));};exports[_0xd59c('0x55')]=function(_0x161f9b,_0x289245){return db[_0xd59c('0x3d')]['create'](_0x161f9b[_0xd59c('0x56')],{})[_0xd59c('0x21')](respondWithResult(_0x289245,0xc9))[_0xd59c('0x2a')](handleError(_0x289245,null));};exports[_0xd59c('0x36')]=function(_0x585870,_0x165dff){if(_0x585870[_0xd59c('0x56')]['id']){delete _0x585870[_0xd59c('0x56')]['id'];}return db[_0xd59c('0x3d')][_0xd59c('0x54')]({'where':{'id':_0x585870[_0xd59c('0x4f')]['id']}})['then'](handleEntityNotFound(_0x165dff,null))[_0xd59c('0x21')](saveUpdates(_0x585870['body'],null))['then'](respondWithResult(_0x165dff,null))['catch'](handleError(_0x165dff,null));};exports[_0xd59c('0x37')]=function(_0x5a4d49,_0x39369a){return db['OpenchannelMessage'][_0xd59c('0x54')]({'where':{'id':_0x5a4d49[_0xd59c('0x4f')]['id']}})[_0xd59c('0x21')](handleEntityNotFound(_0x39369a,null))[_0xd59c('0x21')](removeEntity(_0x39369a,null))['catch'](handleError(_0x39369a,null));};exports['describe']=function(_0x455143,_0x5b1ce1){return db[_0xd59c('0x3d')][_0xd59c('0x57')]()[_0xd59c('0x21')](respondWithResult(_0x5b1ce1,null))[_0xd59c('0x2a')](handleError(_0x5b1ce1,null));};var interaction_log=require('../../config/logger')(_0xd59c('0x58'));exports['accept']=function(_0x23cac6,_0x4f4a0f,_0x5b1299){var _0x42a7f5={'agent':{},'channel':_0xd59c('0x59')};if(_0x23cac6['body']['id']){delete _0x23cac6[_0xd59c('0x56')]['id'];}_0x23cac6[_0xd59c('0x56')][_0xd59c('0x5a')]=!![];_0x23cac6[_0xd59c('0x56')]['readAt']=moment()[_0xd59c('0x5b')]('YYYY-MM-DD\x20HH:mm:ss');_0x23cac6['body'][_0xd59c('0x5c')]=_0x23cac6['body']['UserId']||_0x23cac6[_0xd59c('0x5d')]['id'];_0x42a7f5[_0xd59c('0x5e')]['id']=_0x23cac6[_0xd59c('0x56')][_0xd59c('0x5c')];return db[_0xd59c('0x3d')][_0xd59c('0x54')]({'where':{'id':_0x23cac6[_0xd59c('0x4f')]['id'],'UserId':null}})[_0xd59c('0x21')](handleEntityNotFound(_0x4f4a0f,null))['then'](saveUpdates(_0x23cac6[_0xd59c('0x56')],null))[_0xd59c('0x21')](function(_0x17b2df){if(_0x17b2df){_0x42a7f5[_0xd59c('0x29')]=_0x17b2df[_0xd59c('0x5f')]({'plain':!![]});return db['OpenchannelInteraction'][_0xd59c('0x54')]({'where':{'id':_0x17b2df[_0xd59c('0x60')]}});}return null;})['then'](handleEntityNotFound(_0x4f4a0f,null))[_0xd59c('0x21')](function(_0x1b671d){if(_0x1b671d){return _0x1b671d[_0xd59c('0x36')]({'UserId':_0x23cac6['body'][_0xd59c('0x5c')],'read1stAt':_[_0xd59c('0x61')](_0x1b671d[_0xd59c('0x62')])?moment()[_0xd59c('0x5b')](_0xd59c('0x63')):undefined});}return null;})[_0xd59c('0x21')](function(_0x1f5708){if(_0x1f5708){_0x42a7f5[_0xd59c('0x64')]=_0x1f5708[_0xd59c('0x5f')]({'plain':!![]});interaction_log[_0xd59c('0x22')]('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x23cac6[_0xd59c('0x5d')]['id'],_0x23cac6[_0xd59c('0x5d')]['name'],_0x23cac6[_0xd59c('0x5d')][_0xd59c('0x65')],_0x42a7f5[_0xd59c('0x64')]['id'],_0x23cac6['body']?JSON[_0xd59c('0x27')](_0x23cac6[_0xd59c('0x56')]):_0xd59c('0x66'));return respondWithRpcPromise('AcceptMessage',_0xd59c('0x67'),_0x42a7f5);}return null;})['then'](function(_0x1f5a36){var _0x248416='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x1f5a36[_0xd59c('0x29')][_0xd59c('0x68')];return db[_0xd59c('0x69')][_0xd59c('0x42')](_0x248416,{'type':db[_0xd59c('0x6a')]['QueryTypes'][_0xd59c('0x6b')],'raw':!![]})[_0xd59c('0x21')](function(_0x5cd14e){return _0x5cd14e;});})[_0xd59c('0x21')](function(_0x8cb983){if(_0x8cb983){_0x42a7f5[_0xd59c('0x29')][_0xd59c('0x6c')]=_0x8cb983[0x0];if(!_0x23cac6[_0xd59c('0x56')]['UserId'])return;return db[_0xd59c('0x6d')][_0xd59c('0x54')]({'where':{'id':_0x23cac6['body']['UserId'],'role':_0xd59c('0x5e')},'attributes':['id',_0xd59c('0x3a'),_0xd59c('0x6e'),_0xd59c('0x6f'),_0xd59c('0x70')],'raw':!![]});}return null;})['then'](function(_0x3901f9){if(!_0x3901f9)return null;_0x42a7f5[_0xd59c('0x29')][_0xd59c('0x5e')]=_0x3901f9;return _0x42a7f5;})[_0xd59c('0x21')](function(_0x1e6d7e){if(_0x1e6d7e){if(_0x23cac6[_0xd59c('0x56')][_0xd59c('0x71')]){_0x42a7f5['message']['interface']=util[_0xd59c('0x5b')](_0xd59c('0x72'),_0x23cac6[_0xd59c('0x5d')][_0xd59c('0x3a')]);_0x42a7f5[_0xd59c('0x29')][_0xd59c('0x73')]=_0x42a7f5[_0xd59c('0x73')];_0x42a7f5[_0xd59c('0x29')]['motionChannel']=_0x42a7f5[_0xd59c('0x73')];_0x42a7f5[_0xd59c('0x29')][_0xd59c('0x74')]=_0xd59c('0x75');return respondWithRpcPromise(_0xd59c('0x76'),_0xd59c('0x76'),{'event':_0xd59c('0x77'),'message':_0x42a7f5[_0xd59c('0x29')]},client9002)[_0xd59c('0x21')](function(){return _0x42a7f5;});}return _0x42a7f5;}return null;})[_0xd59c('0x21')](respondWithResult(_0x4f4a0f,null))[_0xd59c('0x2a')](handleError(_0x4f4a0f,null));};var interaction_log=require(_0xd59c('0x17'))(_0xd59c('0x58'));exports[_0xd59c('0x34')]=function(_0x3add05,_0x5cc9bc,_0x59a226){var _0x31fc02={'agent':{},'channel':'openchannel'};if(_0x3add05[_0xd59c('0x56')]['id']){delete _0x3add05[_0xd59c('0x56')]['id'];}_0x3add05[_0xd59c('0x56')][_0xd59c('0x5c')]=_0x3add05[_0xd59c('0x56')][_0xd59c('0x5c')]||_0x3add05[_0xd59c('0x5d')]['id'];_0x31fc02[_0xd59c('0x5e')]['id']=_0x3add05[_0xd59c('0x56')][_0xd59c('0x5c')];return db[_0xd59c('0x3d')][_0xd59c('0x54')]({'where':{'id':_0x3add05[_0xd59c('0x4f')]['id'],'UserId':null}})[_0xd59c('0x21')](handleEntityNotFound(_0x5cc9bc,null))[_0xd59c('0x21')](function(_0x1654e9){if(_0x1654e9){_0x31fc02['message']=_0x1654e9[_0xd59c('0x5f')]({'plain':!![]});return db[_0xd59c('0x78')][_0xd59c('0x54')]({'where':{'id':_0x1654e9[_0xd59c('0x60')]}});}return null;})[_0xd59c('0x21')](handleEntityNotFound(_0x5cc9bc,null))[_0xd59c('0x21')](function(_0x47ebca){if(_0x47ebca){_0x31fc02[_0xd59c('0x64')]=_0x47ebca['get']({'plain':!![]});interaction_log[_0xd59c('0x22')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3add05['user']['id'],_0x3add05[_0xd59c('0x5d')][_0xd59c('0x3a')],_0x3add05[_0xd59c('0x5d')][_0xd59c('0x65')],_0x31fc02['interaction']['id'],_0x3add05[_0xd59c('0x56')]?JSON['stringify'](_0x3add05['body']):_0xd59c('0x66'));return respondWithRpcPromise(_0xd59c('0x79'),'rejectMessage',_0x31fc02);}return null;})['then'](function(_0xc6a2c8){var _0x136a97=_0xd59c('0x7a')+_0xc6a2c8[_0xd59c('0x29')][_0xd59c('0x68')];return db[_0xd59c('0x69')][_0xd59c('0x42')](_0x136a97,{'type':db['Sequelize'][_0xd59c('0x7b')][_0xd59c('0x6b')],'raw':!![]})['then'](function(_0x514b6d){return _0x514b6d;});})[_0xd59c('0x21')](function(_0x356485){if(_0x356485){_0x31fc02[_0xd59c('0x29')][_0xd59c('0x6c')]=_0x356485[0x0];if(!_0x3add05[_0xd59c('0x56')]['UserId'])return;return db[_0xd59c('0x6d')]['find']({'where':{'id':_0x3add05[_0xd59c('0x56')][_0xd59c('0x5c')],'role':_0xd59c('0x5e')},'attributes':['id',_0xd59c('0x3a'),_0xd59c('0x6e'),_0xd59c('0x6f'),_0xd59c('0x70')],'raw':!![]});}return null;})[_0xd59c('0x21')](function(_0x2e0d32){if(!_0x2e0d32)return null;_0x31fc02['message'][_0xd59c('0x5e')]=_0x2e0d32;return _0x31fc02;})[_0xd59c('0x21')](function(_0x1f4069){if(_0x1f4069){_0x1f4069['message']['interface']=util[_0xd59c('0x5b')](_0xd59c('0x72'),_0x3add05[_0xd59c('0x5d')][_0xd59c('0x3a')]);_0x1f4069[_0xd59c('0x29')]['channel']=_0x31fc02['channel'];_0x1f4069[_0xd59c('0x29')][_0xd59c('0x7c')]=_0x31fc02[_0xd59c('0x73')];_0x1f4069[_0xd59c('0x29')][_0xd59c('0x74')]=_0xd59c('0x34');respondWithRpcPromise(_0xd59c('0x76'),_0xd59c('0x76'),{'event':_0xd59c('0x7d'),'message':_0x1f4069[_0xd59c('0x29')]},client9002);return _0x31fc02;}return null;})['then'](respondWithResult(_0x5cc9bc,null))[_0xd59c('0x2a')](handleError(_0x5cc9bc,null));}; \ No newline at end of file +var _0xe49a=['../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','client','http','request','then','info','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','OpenchannelMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','OpenchannelMessage','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','merge','filter','options','includeAll','include','findAll','rows','show','params','length','find','create','body','describe','openchannel-interactions','accept','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','QueryTypes','SELECT','contact','User','fullname','email','internal','agent','manual','interface','SIP/%s','channel','EventManager','acceptmessage','get','stringify','rejectMessage','sequelize','event','rejectmessage','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','fs-extra','lodash','squel','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xe49a,0x6f));var _0xae49=function(_0x2b445a,_0x18924f){_0x2b445a=_0x2b445a-0x0;var _0x3faa42=_0xe49a[_0x2b445a];return _0x3faa42;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xae49('0x0'));var rp=require(_0xae49('0x1'));var moment=require(_0xae49('0x2'));var BPromise=require(_0xae49('0x3'));var Mustache=require('mustache');var util=require(_0xae49('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0xae49('0x5'));var ejs=require(_0xae49('0x6'));var fs=require('fs');var fs_extra=require(_0xae49('0x7'));var _=require(_0xae49('0x8'));var squel=require(_0xae49('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xae49('0x5'));var querystring=require(_0xae49('0xa'));var Papa=require(_0xae49('0xb'));var Redis=require(_0xae49('0xc'));var authService=require('../../components/auth/service');var qs=require(_0xae49('0xd'));var as=require(_0xae49('0xe'));var hardwareService=require(_0xae49('0xf'));var logger=require(_0xae49('0x10'))(_0xae49('0x11'));var utils=require(_0xae49('0x12'));var config=require(_0xae49('0x13'));var licenseUtil=require(_0xae49('0x14'));var db=require(_0xae49('0x15'))['db'];config[_0xae49('0x16')]=_['defaults'](config['redis'],{'host':_0xae49('0x17'),'port':0x18eb});var socket=require(_0xae49('0x18'))(new Redis(config[_0xae49('0x16')]));require(_0xae49('0x19'))[_0xae49('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson[_0xae49('0x1b')][_0xae49('0x1c')]({'port':0x232c});var client9002=jayson['client'][_0xae49('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x38bb04,_0x365dca,_0x4c08c8,_0x23625f){return new BPromise(function(_0x7a5e33,_0x229c5d){var _0x149159=_0x23625f||client;return _0x149159[_0xae49('0x1d')](_0x38bb04,_0x4c08c8)[_0xae49('0x1e')](function(_0x3f33a4){logger[_0xae49('0x1f')]('OpenchannelMessage,\x20%s,\x20%s',_0x365dca,_0xae49('0x20'));logger[_0xae49('0x21')](_0xae49('0x22'),_0x365dca,'request\x20sent',JSON['stringify'](_0x3f33a4));if(_0x3f33a4[_0xae49('0x23')]){if(_0x3f33a4[_0xae49('0x23')]['code']===0x1f4){logger[_0xae49('0x23')](_0xae49('0x24'),_0x365dca,_0x3f33a4['error'][_0xae49('0x25')]);return _0x229c5d(_0x3f33a4[_0xae49('0x23')]['message']);}logger['error'](_0xae49('0x24'),_0x365dca,_0x3f33a4[_0xae49('0x23')]['message']);return _0x7a5e33(_0x3f33a4[_0xae49('0x23')][_0xae49('0x25')]);}else{logger[_0xae49('0x1f')](_0xae49('0x24'),_0x365dca,_0xae49('0x20'));_0x7a5e33(_0x3f33a4[_0xae49('0x26')]['message']);}})[_0xae49('0x27')](function(_0x5c7b02){logger[_0xae49('0x23')](_0xae49('0x24'),_0x365dca,_0x5c7b02);_0x229c5d(_0x5c7b02);});});}function respondWithStatusCode(_0x59ad78,_0xb0ee37){_0xb0ee37=_0xb0ee37||0xcc;return function(_0x198f32){if(_0x198f32){return _0x59ad78[_0xae49('0x28')](_0xb0ee37);}return _0x59ad78[_0xae49('0x29')](_0xb0ee37)[_0xae49('0x2a')]();};}function respondWithResult(_0x57542e,_0x21eef2){_0x21eef2=_0x21eef2||0xc8;return function(_0x2508e2){if(_0x2508e2){return _0x57542e[_0xae49('0x29')](_0x21eef2)[_0xae49('0x2b')](_0x2508e2);}};}function respondWithFilteredResult(_0x3ba4cb,_0x67578c){return function(_0x539205){if(_0x539205){var _0x1e294a=typeof _0x67578c[_0xae49('0x2c')]===_0xae49('0x2d')&&typeof _0x67578c[_0xae49('0x2e')]===_0xae49('0x2d');var _0x5c4638=_0x539205[_0xae49('0x2f')];var _0x3516a6=_0x1e294a?0x0:_0x67578c['offset'];var _0x1630a4=_0x1e294a?_0x539205[_0xae49('0x2f')]:_0x67578c['offset']+_0x67578c[_0xae49('0x2e')];var _0x586f1e;if(_0x1630a4>=_0x5c4638){_0x1630a4=_0x5c4638;_0x586f1e=0xc8;}else{_0x586f1e=0xce;}_0x3ba4cb[_0xae49('0x29')](_0x586f1e);return _0x3ba4cb[_0xae49('0x30')](_0xae49('0x31'),_0x3516a6+'-'+_0x1630a4+'/'+_0x5c4638)[_0xae49('0x2b')](_0x539205);}return null;};}function patchUpdates(_0x516e11){return function(_0x4cb29c){try{jsonpatch[_0xae49('0x32')](_0x4cb29c,_0x516e11,!![]);}catch(_0x370c22){return BPromise[_0xae49('0x33')](_0x370c22);}return _0x4cb29c[_0xae49('0x34')]();};}function saveUpdates(_0x2eae15,_0x1c1631){return function(_0x500366){if(_0x500366){return _0x500366[_0xae49('0x35')](_0x2eae15)[_0xae49('0x1e')](function(_0x3bdae1){return _0x3bdae1;});}return null;};}function removeEntity(_0x279cc2,_0x2798e6){return function(_0x23f02c){if(_0x23f02c){return _0x23f02c[_0xae49('0x36')]()[_0xae49('0x1e')](function(){_0x279cc2[_0xae49('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0xb7720a,_0x47a40e){return function(_0x2b4e77){if(!_0x2b4e77){_0xb7720a['sendStatus'](0x194);}return _0x2b4e77;};}function handleError(_0x56c465,_0x50a250){_0x50a250=_0x50a250||0x1f4;return function(_0x2188f9){logger[_0xae49('0x23')](_0x2188f9[_0xae49('0x37')]);if(_0x2188f9[_0xae49('0x38')]){delete _0x2188f9['name'];}_0x56c465[_0xae49('0x29')](_0x50a250)[_0xae49('0x39')](_0x2188f9);};}exports[_0xae49('0x3a')]=function(_0x35390e,_0x5d7356){var _0x413aa5={},_0x55669f={},_0x243758={'count':0x0,'rows':[]};var _0x9b2242=_['map'](db[_0xae49('0x3b')][_0xae49('0x3c')],function(_0x214f09){return{'name':_0x214f09[_0xae49('0x3d')],'type':_0x214f09[_0xae49('0x3e')][_0xae49('0x3f')]};});_0x55669f[_0xae49('0x40')]=_[_0xae49('0x41')](_0x9b2242,_0xae49('0x38'));_0x55669f['query']=_[_0xae49('0x42')](_0x35390e[_0xae49('0x43')]);_0x55669f[_0xae49('0x44')]=_[_0xae49('0x45')](_0x55669f['model'],_0x55669f['query']);_0x413aa5['attributes']=_['intersection'](_0x55669f['model'],qs['fields'](_0x35390e[_0xae49('0x43')][_0xae49('0x46')]));_0x413aa5[_0xae49('0x47')]=_0x413aa5['attributes']['length']?_0x413aa5['attributes']:_0x55669f[_0xae49('0x40')];if(!_0x35390e['query'][_0xae49('0x48')](_0xae49('0x49'))){_0x413aa5['limit']=qs[_0xae49('0x2e')](_0x35390e[_0xae49('0x43')][_0xae49('0x2e')]);_0x413aa5[_0xae49('0x2c')]=qs[_0xae49('0x2c')](_0x35390e[_0xae49('0x43')]['offset']);}_0x413aa5[_0xae49('0x4a')]=qs[_0xae49('0x4b')](_0x35390e[_0xae49('0x43')]['sort']);_0x413aa5[_0xae49('0x4c')]=qs[_0xae49('0x44')](_['pick'](_0x35390e[_0xae49('0x43')],_0x55669f['filters']),_0x9b2242);if(_0x35390e['query']['filter']){_0x413aa5[_0xae49('0x4c')]=_[_0xae49('0x4d')](_0x413aa5[_0xae49('0x4c')],{'$or':_['map'](_0x9b2242,function(_0x1b51e5){if(_0x1b51e5[_0xae49('0x3e')]!=='VIRTUAL'){var _0x81ab1b={};_0x81ab1b[_0x1b51e5['name']]={'$like':'%'+_0x35390e[_0xae49('0x43')][_0xae49('0x4e')]+'%'};return _0x81ab1b;}})});}_0x413aa5=_['merge']({},_0x413aa5,_0x35390e[_0xae49('0x4f')]);var _0x529762={'where':_0x413aa5['where']};return db[_0xae49('0x3b')][_0xae49('0x2f')](_0x529762)[_0xae49('0x1e')](function(_0x5f3549){_0x243758[_0xae49('0x2f')]=_0x5f3549;if(_0x35390e[_0xae49('0x43')][_0xae49('0x50')]){_0x413aa5[_0xae49('0x51')]=[{'all':!![]}];}return db[_0xae49('0x3b')][_0xae49('0x52')](_0x413aa5);})[_0xae49('0x1e')](function(_0x397a60){_0x243758[_0xae49('0x53')]=_0x397a60;return _0x243758;})[_0xae49('0x1e')](respondWithFilteredResult(_0x5d7356,_0x413aa5))[_0xae49('0x27')](handleError(_0x5d7356,null));};exports[_0xae49('0x54')]=function(_0x5e9ae2,_0x19e942){var _0x66952f={'raw':!![],'where':{'id':_0x5e9ae2[_0xae49('0x55')]['id']}},_0x41048d={};_0x41048d[_0xae49('0x40')]=_[_0xae49('0x42')](db[_0xae49('0x3b')][_0xae49('0x3c')]);_0x41048d[_0xae49('0x43')]=_['keys'](_0x5e9ae2[_0xae49('0x43')]);_0x41048d[_0xae49('0x44')]=_[_0xae49('0x45')](_0x41048d[_0xae49('0x40')],_0x41048d[_0xae49('0x43')]);_0x66952f[_0xae49('0x47')]=_[_0xae49('0x45')](_0x41048d[_0xae49('0x40')],qs[_0xae49('0x46')](_0x5e9ae2[_0xae49('0x43')][_0xae49('0x46')]));_0x66952f[_0xae49('0x47')]=_0x66952f[_0xae49('0x47')][_0xae49('0x56')]?_0x66952f[_0xae49('0x47')]:_0x41048d[_0xae49('0x40')];if(_0x5e9ae2[_0xae49('0x43')][_0xae49('0x50')]){_0x66952f['include']=[{'all':!![]}];}_0x66952f=_['merge']({},_0x66952f,_0x5e9ae2[_0xae49('0x4f')]);return db[_0xae49('0x3b')][_0xae49('0x57')](_0x66952f)['then'](handleEntityNotFound(_0x19e942,null))[_0xae49('0x1e')](respondWithResult(_0x19e942,null))[_0xae49('0x27')](handleError(_0x19e942,null));};exports[_0xae49('0x58')]=function(_0x5d9229,_0x1d1132){return db[_0xae49('0x3b')][_0xae49('0x58')](_0x5d9229['body'],{})[_0xae49('0x1e')](respondWithResult(_0x1d1132,0xc9))[_0xae49('0x27')](handleError(_0x1d1132,null));};exports['update']=function(_0x11a98f,_0x1bf1a0){if(_0x11a98f[_0xae49('0x59')]['id']){delete _0x11a98f[_0xae49('0x59')]['id'];}return db['OpenchannelMessage'][_0xae49('0x57')]({'where':{'id':_0x11a98f[_0xae49('0x55')]['id']}})[_0xae49('0x1e')](handleEntityNotFound(_0x1bf1a0,null))['then'](saveUpdates(_0x11a98f[_0xae49('0x59')],null))[_0xae49('0x1e')](respondWithResult(_0x1bf1a0,null))[_0xae49('0x27')](handleError(_0x1bf1a0,null));};exports[_0xae49('0x36')]=function(_0x13bc97,_0x3e0277){return db[_0xae49('0x3b')]['find']({'where':{'id':_0x13bc97[_0xae49('0x55')]['id']}})[_0xae49('0x1e')](handleEntityNotFound(_0x3e0277,null))[_0xae49('0x1e')](removeEntity(_0x3e0277,null))['catch'](handleError(_0x3e0277,null));};exports[_0xae49('0x5a')]=function(_0xa25481,_0x5697c5){return db[_0xae49('0x3b')][_0xae49('0x5a')]()[_0xae49('0x1e')](respondWithResult(_0x5697c5,null))['catch'](handleError(_0x5697c5,null));};var interaction_log=require(_0xae49('0x10'))(_0xae49('0x5b'));exports[_0xae49('0x5c')]=function(_0x4b6db0,_0x2fa7e7,_0x421cf3){var _0x1c8348={'agent':{},'channel':_0xae49('0x5d')};if(_0x4b6db0['body']['id']){delete _0x4b6db0[_0xae49('0x59')]['id'];}_0x4b6db0[_0xae49('0x59')][_0xae49('0x5e')]=!![];_0x4b6db0[_0xae49('0x59')][_0xae49('0x5f')]=moment()[_0xae49('0x60')](_0xae49('0x61'));_0x4b6db0[_0xae49('0x59')]['UserId']=_0x4b6db0[_0xae49('0x59')][_0xae49('0x62')]||_0x4b6db0[_0xae49('0x63')]['id'];_0x1c8348['agent']['id']=_0x4b6db0[_0xae49('0x59')][_0xae49('0x62')];return db[_0xae49('0x3b')]['find']({'where':{'id':_0x4b6db0['params']['id'],'UserId':null}})[_0xae49('0x1e')](handleEntityNotFound(_0x2fa7e7,null))[_0xae49('0x1e')](saveUpdates(_0x4b6db0[_0xae49('0x59')],null))[_0xae49('0x1e')](function(_0x2afb0e){if(_0x2afb0e){_0x1c8348[_0xae49('0x25')]=_0x2afb0e['get']({'plain':!![]});return db[_0xae49('0x64')][_0xae49('0x57')]({'where':{'id':_0x2afb0e[_0xae49('0x65')]}});}return null;})['then'](handleEntityNotFound(_0x2fa7e7,null))['then'](function(_0x4a4a4b){if(_0x4a4a4b){return _0x4a4a4b['update']({'UserId':_0x4b6db0[_0xae49('0x59')][_0xae49('0x62')],'read1stAt':_[_0xae49('0x66')](_0x4a4a4b[_0xae49('0x67')])?moment()[_0xae49('0x60')](_0xae49('0x61')):undefined});}return null;})[_0xae49('0x1e')](function(_0xe1a0cd){if(_0xe1a0cd){_0x1c8348['interaction']=_0xe1a0cd['get']({'plain':!![]});interaction_log['info'](_0xae49('0x68'),_0x4b6db0[_0xae49('0x63')]['id'],_0x4b6db0['user'][_0xae49('0x38')],_0x4b6db0['user'][_0xae49('0x69')],_0x1c8348[_0xae49('0x6a')]['id'],_0x4b6db0[_0xae49('0x59')]?JSON['stringify'](_0x4b6db0[_0xae49('0x59')]):_0xae49('0x6b'));return respondWithRpcPromise(_0xae49('0x6c'),'acceptMessage',_0x1c8348);}return null;})[_0xae49('0x1e')](function(_0x515751){var _0x202ace=_0xae49('0x6d')+_0x515751[_0xae49('0x25')][_0xae49('0x6e')];return db['sequelize'][_0xae49('0x43')](_0x202ace,{'type':db['Sequelize'][_0xae49('0x6f')][_0xae49('0x70')],'raw':!![]})[_0xae49('0x1e')](function(_0x205845){return _0x205845;});})[_0xae49('0x1e')](function(_0x8f791e){if(_0x8f791e){_0x1c8348['message'][_0xae49('0x71')]=_0x8f791e[0x0];if(!_0x4b6db0[_0xae49('0x59')][_0xae49('0x62')])return;return db[_0xae49('0x72')]['find']({'where':{'id':_0x4b6db0['body'][_0xae49('0x62')],'role':'agent'},'attributes':['id',_0xae49('0x38'),_0xae49('0x73'),_0xae49('0x74'),_0xae49('0x75')],'raw':!![]});}return null;})['then'](function(_0xc345b6){if(!_0xc345b6)return null;_0x1c8348[_0xae49('0x25')][_0xae49('0x76')]=_0xc345b6;return _0x1c8348;})[_0xae49('0x1e')](function(_0x50c1d9){if(_0x50c1d9){if(_0x4b6db0[_0xae49('0x59')][_0xae49('0x77')]){_0x1c8348[_0xae49('0x25')][_0xae49('0x78')]=util[_0xae49('0x60')](_0xae49('0x79'),_0x4b6db0[_0xae49('0x63')][_0xae49('0x38')]);_0x1c8348[_0xae49('0x25')][_0xae49('0x7a')]=_0x1c8348[_0xae49('0x7a')];_0x1c8348[_0xae49('0x25')]['motionChannel']=_0x1c8348[_0xae49('0x7a')];_0x1c8348[_0xae49('0x25')]['event']=_0xae49('0x5c');return respondWithRpcPromise(_0xae49('0x7b'),_0xae49('0x7b'),{'event':_0xae49('0x7c'),'message':_0x1c8348[_0xae49('0x25')]},client9002)['then'](function(){return _0x1c8348;});}return _0x1c8348;}return null;})[_0xae49('0x1e')](respondWithResult(_0x2fa7e7,null))[_0xae49('0x27')](handleError(_0x2fa7e7,null));};var interaction_log=require(_0xae49('0x10'))(_0xae49('0x5b'));exports['reject']=function(_0x1de57d,_0x53bd84,_0x6f5257){var _0x5930ae={'agent':{},'channel':_0xae49('0x5d')};if(_0x1de57d[_0xae49('0x59')]['id']){delete _0x1de57d[_0xae49('0x59')]['id'];}_0x1de57d[_0xae49('0x59')][_0xae49('0x62')]=_0x1de57d['body'][_0xae49('0x62')]||_0x1de57d[_0xae49('0x63')]['id'];_0x5930ae[_0xae49('0x76')]['id']=_0x1de57d[_0xae49('0x59')][_0xae49('0x62')];return db[_0xae49('0x3b')][_0xae49('0x57')]({'where':{'id':_0x1de57d[_0xae49('0x55')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x53bd84,null))['then'](function(_0x4a832c){if(_0x4a832c){_0x5930ae['message']=_0x4a832c['get']({'plain':!![]});return db['OpenchannelInteraction'][_0xae49('0x57')]({'where':{'id':_0x4a832c['OpenchannelInteractionId']}});}return null;})[_0xae49('0x1e')](handleEntityNotFound(_0x53bd84,null))['then'](function(_0x179120){if(_0x179120){_0x5930ae[_0xae49('0x6a')]=_0x179120[_0xae49('0x7d')]({'plain':!![]});interaction_log[_0xae49('0x1f')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1de57d[_0xae49('0x63')]['id'],_0x1de57d['user'][_0xae49('0x38')],_0x1de57d['user'][_0xae49('0x69')],_0x5930ae[_0xae49('0x6a')]['id'],_0x1de57d['body']?JSON[_0xae49('0x7e')](_0x1de57d[_0xae49('0x59')]):_0xae49('0x6b'));return respondWithRpcPromise('RejectMessage',_0xae49('0x7f'),_0x5930ae);}return null;})[_0xae49('0x1e')](function(_0x5785fa){var _0x46d4d3=_0xae49('0x6d')+_0x5785fa[_0xae49('0x25')]['ContactId'];return db[_0xae49('0x80')][_0xae49('0x43')](_0x46d4d3,{'type':db['Sequelize']['QueryTypes'][_0xae49('0x70')],'raw':!![]})['then'](function(_0x10d46c){return _0x10d46c;});})['then'](function(_0x574061){if(_0x574061){_0x5930ae[_0xae49('0x25')]['contact']=_0x574061[0x0];if(!_0x1de57d['body']['UserId'])return;return db[_0xae49('0x72')][_0xae49('0x57')]({'where':{'id':_0x1de57d[_0xae49('0x59')]['UserId'],'role':_0xae49('0x76')},'attributes':['id','name',_0xae49('0x73'),'email',_0xae49('0x75')],'raw':!![]});}return null;})[_0xae49('0x1e')](function(_0x4a0abd){if(!_0x4a0abd)return null;_0x5930ae[_0xae49('0x25')][_0xae49('0x76')]=_0x4a0abd;return _0x5930ae;})[_0xae49('0x1e')](function(_0x3c2692){if(_0x3c2692){_0x3c2692['message'][_0xae49('0x78')]=util[_0xae49('0x60')]('SIP/%s',_0x1de57d[_0xae49('0x63')][_0xae49('0x38')]);_0x3c2692['message']['channel']=_0x5930ae[_0xae49('0x7a')];_0x3c2692[_0xae49('0x25')]['motionChannel']=_0x5930ae[_0xae49('0x7a')];_0x3c2692['message'][_0xae49('0x81')]=_0xae49('0x33');respondWithRpcPromise(_0xae49('0x7b'),_0xae49('0x7b'),{'event':_0xae49('0x82'),'message':_0x3c2692[_0xae49('0x25')]},client9002);return _0x5930ae;}return null;})[_0xae49('0x1e')](respondWithResult(_0x53bd84,null))[_0xae49('0x27')](handleError(_0x53bd84,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index ba55e24..7a776e2 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 _0xf21c=['events','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','remove','emit','hook','exports'];(function(_0x31d849,_0x3db9bc){var _0x1c55b3=function(_0x3b8040){while(--_0x3b8040){_0x31d849['push'](_0x31d849['shift']());}};_0x1c55b3(++_0x3db9bc);}(_0xf21c,0xa0));var _0xcf21=function(_0x48ae62,_0x3cfce7){_0x48ae62=_0x48ae62-0x0;var _0x2634a6=_0xf21c[_0x48ae62];return _0x2634a6;};'use strict';var EventEmitter=require(_0xcf21('0x0'));var OpenchannelMessage=require(_0xcf21('0x1'))['db'][_0xcf21('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xcf21('0x3')](0x0);var events={'afterCreate':_0xcf21('0x4'),'afterUpdate':_0xcf21('0x5'),'afterDestroy':_0xcf21('0x6')};function emitEvent(_0xdf12e1){return function(_0x2d2089,_0x5b6939,_0xe0f5c6){OpenchannelMessageEvents[_0xcf21('0x7')](_0xdf12e1+':'+_0x2d2089['id'],_0x2d2089);OpenchannelMessageEvents[_0xcf21('0x7')](_0xdf12e1,_0x2d2089);_0xe0f5c6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0xcf21('0x8')](e,emitEvent(event));}}module[_0xcf21('0x9')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x9b7d=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','OpenchannelMessage','save','update'];(function(_0x228ada,_0x141456){var _0x566636=function(_0x3f56ac){while(--_0x3f56ac){_0x228ada['push'](_0x228ada['shift']());}};_0x566636(++_0x141456);}(_0x9b7d,0x1cf));var _0xd9b7=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9b7d[_0x19e35c];return _0x3e1fe8;};'use strict';var EventEmitter=require(_0xd9b7('0x0'));var OpenchannelMessage=require(_0xd9b7('0x1'))['db'][_0xd9b7('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd9b7('0x3'),'afterUpdate':_0xd9b7('0x4'),'afterDestroy':_0xd9b7('0x5')};function emitEvent(_0x190d0b){return function(_0x9c09a7,_0x31dbfc,_0x227676){OpenchannelMessageEvents[_0xd9b7('0x6')](_0x190d0b+':'+_0x9c09a7['id'],_0x9c09a7);OpenchannelMessageEvents[_0xd9b7('0x6')](_0x190d0b,_0x9c09a7);_0x227676(null);};}for(var e in events){if(events[_0xd9b7('0x7')](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module[_0xd9b7('0x8')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 82c5508..e74df1a 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 _0x8b90=['Contact','keys','info','afterCreate','format','replyUri','length','Interaction','POST','method','GET','OpenchannelMessage,\x20%s,\x20%s','Message\x20%d\x20forwarded\x20to\x20%s','threadId','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','direction','toLowerCase','out','isNil','UserId','OpenchannelInteractionId','then','update','createdAt','catch','error','secret','describe','OpenchannelAccount','find','OpenchannelInteraction','Interactions','CmContact'];(function(_0x319e2e,_0x2f727f){var _0x302524=function(_0x5cad9d){while(--_0x5cad9d){_0x319e2e['push'](_0x319e2e['shift']());}};_0x302524(++_0x2f727f);}(_0x8b90,0x77));var _0x08b9=function(_0x13f105,_0x5ec253){_0x13f105=_0x13f105-0x0;var _0x38308e=_0x8b90[_0x13f105];return _0x38308e;};'use strict';var _=require(_0x08b9('0x0'));var util=require(_0x08b9('0x1'));var logger=require(_0x08b9('0x2'))(_0x08b9('0x3'));var moment=require(_0x08b9('0x4'));var BPromise=require('bluebird');var rp=require(_0x08b9('0x5'));var fs=require('fs');var path=require(_0x08b9('0x6'));var rimraf=require(_0x08b9('0x7'));var config=require('../../config/environment');var attributes=require('./openchannelMessage.attributes');module[_0x08b9('0x8')]=function(_0xfb3d68,_0x1507eb){return _0xfb3d68[_0x08b9('0x9')](_0x08b9('0xa'),attributes,{'tableName':_0x08b9('0xb'),'paranoid':![],'indexes':[{'name':_0x08b9('0xc'),'fields':[_0x08b9('0xd')],'type':_0x08b9('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x57d388,_0xae8c35,_0x206b1e){var _0x37cefb=_0xfb3d68[_0x08b9('0xf')];var _0xc1afbd=_0x57d388['get']({'plain':!![]});if(_0xc1afbd[_0x08b9('0x10')][_0x08b9('0x11')]()==='in'||_0xc1afbd[_0x08b9('0x10')][_0x08b9('0x11')]()===_0x08b9('0x12')&&!_0xc1afbd['secret']&&!_[_0x08b9('0x13')](_0xc1afbd[_0x08b9('0x14')])){_0x37cefb['OpenchannelInteraction']['findOne']({'where':{'id':_0xc1afbd[_0x08b9('0x15')]}})[_0x08b9('0x16')](function(_0x3a3d03){if(_0x3a3d03){_0x3a3d03[_0x08b9('0x17')]({'lastMsgAt':_0xc1afbd[_0x08b9('0x18')],'lastMsgDirection':_0xc1afbd[_0x08b9('0x10')]['toLowerCase']()});}})[_0x08b9('0x19')](function(_0x173beb){console[_0x08b9('0x1a')](_0x173beb);});}if(_0xc1afbd[_0x08b9('0x10')]==='out'&&!_0xc1afbd[_0x08b9('0x1b')]){var _0x587fb9;_0x37cefb['CmContact'][_0x08b9('0x1c')]()[_0x08b9('0x16')](function(_0x4002bd){return _0x37cefb[_0x08b9('0x1d')][_0x08b9('0x1e')]({'where':{'id':_0xc1afbd['OpenchannelAccountId']},'include':[{'model':_0x37cefb[_0x08b9('0x1f')],'as':_0x08b9('0x20'),'where':{'id':_0xc1afbd[_0x08b9('0x15')]},'limit':0x1,'include':[{'model':_0x37cefb[_0x08b9('0x21')],'as':_0x08b9('0x22'),'attributes':_[_0x08b9('0x23')](_0x4002bd)}]}]});})['then'](function(_0x513ebd){_0x587fb9=_0x513ebd['get']({'plain':!![]});if(_0x587fb9&&_0x587fb9['replyUri']){logger[_0x08b9('0x24')]('OpenchannelMessage,\x20%s,\x20%s',_0x08b9('0x25'),util[_0x08b9('0x26')]('Forwarding\x20message\x20%d\x20to\x20%s',_0xc1afbd['id'],_0x587fb9[_0x08b9('0x27')]));if(_0x587fb9[_0x08b9('0x20')]&&_0x587fb9['Interactions'][_0x08b9('0x28')]){_0xc1afbd[_0x08b9('0x29')]=_['omit'](_0x587fb9[_0x08b9('0x20')][0x0],_0x08b9('0x22'));_0xc1afbd[_0x08b9('0x22')]=_0x587fb9[_0x08b9('0x20')][0x0]['Contact'];}var _0xae8c35={'method':_0x08b9('0x2a'),'uri':encodeURI(_0x587fb9['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0xae8c35[_0x08b9('0x2b')]){case _0x08b9('0x2c'):_0xae8c35['qs']=_0xc1afbd;break;case _0x08b9('0x2a'):_0xae8c35[_0x08b9('0xd')]=_0xc1afbd;break;}return rp(_0xae8c35)['then'](function(_0x3fa5df){logger[_0x08b9('0x24')](_0x08b9('0x2d'),_0x08b9('0x25'),util[_0x08b9('0x26')](_0x08b9('0x2e'),_0xc1afbd['id'],_0x587fb9[_0x08b9('0x27')]));if(_0x3fa5df[_0x08b9('0xd')][_0x08b9('0x2f')]&&_0x3fa5df[_0x08b9('0xd')]['threadId']!=_0xc1afbd[_0x08b9('0x29')][_0x08b9('0x2f')]){return _0x37cefb[_0x08b9('0x1f')]['update']({'threadId':_0x3fa5df[_0x08b9('0xd')][_0x08b9('0x2f')]},{'where':{'id':_0xc1afbd[_0x08b9('0x29')]['id']}});}else{return;}})['then'](function(){return _0x57d388[_0x08b9('0x17')]({'read':!![]});})[_0x08b9('0x19')](function(_0x51dc7c){logger[_0x08b9('0x1a')]('OpenchannelMessage,\x20%s,\x20%s',_0x08b9('0x25'),util['inspect'](_0x51dc7c,{'showHidden':![],'depth':null}));_0x206b1e();});}else{_0x206b1e();}})[_0x08b9('0x30')](function(){_0x206b1e();});}else{_0x206b1e();}}},'charset':_0x08b9('0x31'),'collate':_0x08b9('0x32')});}; \ No newline at end of file +var _0xd46a=['path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','FULLTEXT','models','get','direction','toLowerCase','out','secret','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','createdAt','catch','describe','OpenchannelAccount','find','keys','replyUri','OpenchannelMessage,\x20%s,\x20%s','afterCreate','Forwarding\x20message\x20%d\x20to\x20%s','Interactions','length','Interaction','omit','Contact','POST','method','GET','body','info','format','Message\x20%d\x20forwarded\x20to\x20%s','threadId','error','inspect','utf8mb4','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x4d1320,_0x58fb9a){var _0x4c3fb0=function(_0x165341){while(--_0x165341){_0x4d1320['push'](_0x4d1320['shift']());}};_0x4c3fb0(++_0x58fb9a);}(_0xd46a,0x64));var _0xad46=function(_0x22419b,_0x55eb11){_0x22419b=_0x22419b-0x0;var _0x211154=_0xd46a[_0x22419b];return _0x211154;};'use strict';var _=require(_0xad46('0x0'));var util=require(_0xad46('0x1'));var logger=require(_0xad46('0x2'))(_0xad46('0x3'));var moment=require('moment');var BPromise=require(_0xad46('0x4'));var rp=require(_0xad46('0x5'));var fs=require('fs');var path=require(_0xad46('0x6'));var rimraf=require(_0xad46('0x7'));var config=require(_0xad46('0x8'));var attributes=require(_0xad46('0x9'));module[_0xad46('0xa')]=function(_0x2cf815,_0x5470ff){return _0x2cf815[_0xad46('0xb')](_0xad46('0xc'),attributes,{'tableName':_0xad46('0xd'),'paranoid':![],'indexes':[{'name':_0xad46('0xe'),'fields':['body'],'type':_0xad46('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x210288,_0x573ce2,_0xd2a739){var _0x5b205c=_0x2cf815[_0xad46('0x10')];var _0x226e8d=_0x210288[_0xad46('0x11')]({'plain':!![]});if(_0x226e8d[_0xad46('0x12')]['toLowerCase']()==='in'||_0x226e8d[_0xad46('0x12')][_0xad46('0x13')]()===_0xad46('0x14')&&!_0x226e8d[_0xad46('0x15')]&&!_['isNil'](_0x226e8d[_0xad46('0x16')])){_0x5b205c[_0xad46('0x17')][_0xad46('0x18')]({'where':{'id':_0x226e8d[_0xad46('0x19')]}})[_0xad46('0x1a')](function(_0x306b31){if(_0x306b31){_0x306b31['update']({'lastMsgAt':_0x226e8d[_0xad46('0x1b')],'lastMsgDirection':_0x226e8d['direction'][_0xad46('0x13')]()});}})[_0xad46('0x1c')](function(_0x5491af){console['error'](_0x5491af);});}if(_0x226e8d[_0xad46('0x12')]===_0xad46('0x14')&&!_0x226e8d[_0xad46('0x15')]){var _0x5d2b28;_0x5b205c['CmContact'][_0xad46('0x1d')]()['then'](function(_0x365e78){return _0x5b205c[_0xad46('0x1e')][_0xad46('0x1f')]({'where':{'id':_0x226e8d['OpenchannelAccountId']},'include':[{'model':_0x5b205c['OpenchannelInteraction'],'as':'Interactions','where':{'id':_0x226e8d['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x5b205c['CmContact'],'as':'Contact','attributes':_[_0xad46('0x20')](_0x365e78)}]}]});})[_0xad46('0x1a')](function(_0x262661){_0x5d2b28=_0x262661['get']({'plain':!![]});if(_0x5d2b28&&_0x5d2b28[_0xad46('0x21')]){logger['info'](_0xad46('0x22'),_0xad46('0x23'),util['format'](_0xad46('0x24'),_0x226e8d['id'],_0x5d2b28['replyUri']));if(_0x5d2b28[_0xad46('0x25')]&&_0x5d2b28['Interactions'][_0xad46('0x26')]){_0x226e8d[_0xad46('0x27')]=_[_0xad46('0x28')](_0x5d2b28[_0xad46('0x25')][0x0],_0xad46('0x29'));_0x226e8d[_0xad46('0x29')]=_0x5d2b28[_0xad46('0x25')][0x0][_0xad46('0x29')];}var _0x573ce2={'method':_0xad46('0x2a'),'uri':encodeURI(_0x5d2b28[_0xad46('0x21')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x573ce2[_0xad46('0x2b')]){case _0xad46('0x2c'):_0x573ce2['qs']=_0x226e8d;break;case _0xad46('0x2a'):_0x573ce2[_0xad46('0x2d')]=_0x226e8d;break;}return rp(_0x573ce2)[_0xad46('0x1a')](function(_0x491256){logger[_0xad46('0x2e')](_0xad46('0x22'),_0xad46('0x23'),util[_0xad46('0x2f')](_0xad46('0x30'),_0x226e8d['id'],_0x5d2b28['replyUri']));if(_0x491256['body']['threadId']&&_0x491256[_0xad46('0x2d')]['threadId']!=_0x226e8d[_0xad46('0x27')][_0xad46('0x31')]){return _0x5b205c['OpenchannelInteraction']['update']({'threadId':_0x491256[_0xad46('0x2d')]['threadId']},{'where':{'id':_0x226e8d[_0xad46('0x27')]['id']}});}else{return;}})[_0xad46('0x1a')](function(){return _0x210288['update']({'read':!![]});})[_0xad46('0x1c')](function(_0x36cf35){logger[_0xad46('0x32')](_0xad46('0x22'),_0xad46('0x23'),util[_0xad46('0x33')](_0x36cf35,{'showHidden':![],'depth':null}));_0xd2a739();});}else{_0xd2a739();}})['finally'](function(){_0xd2a739();});}else{_0xd2a739();}}},'charset':_0xad46('0x34'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index dd24858..fd4f6e7 100644 --- a/server/api/openchannelMessage/openchannelMessage.rpc.js +++ b/server/api/openchannelMessage/openchannelMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1261=['../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','localhost','socket.io-emitter','./openchannelMessage.socket','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','OpenchannelMessage','options','raw','then','CreateOpenchannelMessage','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x1d8701,_0x227970){var _0x6c4540=function(_0x3abb71){while(--_0x3abb71){_0x1d8701['push'](_0x1d8701['shift']());}};_0x6c4540(++_0x227970);}(_0x1261,0x144));var _0x1126=function(_0x48e885,_0x1b7f8a){_0x48e885=_0x48e885-0x0;var _0x3830a4=_0x1261[_0x48e885];return _0x3830a4;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});config[_0x1126('0xb')]=_['defaults'](config[_0x1126('0xb')],{'host':_0x1126('0xc'),'port':0x18eb});var socket=require(_0x1126('0xd'))(new Redis(config[_0x1126('0xb')]));require(_0x1126('0xe'))['register'](socket);function respondWithRpcPromise(_0x3f09ac,_0x18dbe6,_0x167ef1){return new BPromise(function(_0x5e72e2,_0x34571c){return client['request'](_0x3f09ac,_0x167ef1)['then'](function(_0x15c071){logger['info'](_0x1126('0xf'),_0x18dbe6,_0x1126('0x10'));logger[_0x1126('0x11')](_0x1126('0x12'),_0x18dbe6,_0x1126('0x10'),JSON[_0x1126('0x13')](_0x15c071));if(_0x15c071[_0x1126('0x14')]){if(_0x15c071[_0x1126('0x14')][_0x1126('0x15')]===0x1f4){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x18dbe6,_0x15c071[_0x1126('0x14')][_0x1126('0x16')]);return _0x34571c(_0x15c071[_0x1126('0x14')]['message']);}logger[_0x1126('0x14')]('OpenchannelMessage,\x20%s,\x20%s',_0x18dbe6,_0x15c071[_0x1126('0x14')][_0x1126('0x16')]);return _0x5e72e2(_0x15c071[_0x1126('0x14')]['message']);}else{logger[_0x1126('0x17')](_0x1126('0xf'),_0x18dbe6,'request\x20sent');_0x5e72e2(_0x15c071['result'][_0x1126('0x16')]);}})[_0x1126('0x18')](function(_0x58d11a){logger['error'](_0x1126('0xf'),_0x18dbe6,_0x58d11a);_0x34571c(_0x58d11a);});});}exports['CreateOpenchannelMessage']=function(_0x22ed37){var _0x1d6d19=this;return new Promise(function(_0x2f70ac,_0x54400a){return db[_0x1126('0x19')]['create'](_0x22ed37['body'],{'raw':_0x22ed37[_0x1126('0x1a')]?_0x22ed37[_0x1126('0x1a')][_0x1126('0x1b')]===undefined?!![]:![]:!![]})[_0x1126('0x1c')](function(_0x526ca1){logger[_0x1126('0x17')](_0x1126('0x1d'),_0x22ed37);logger['debug'](_0x1126('0x1d'),_0x22ed37,JSON['stringify'](_0x526ca1));_0x2f70ac(_0x526ca1);})['catch'](function(_0x4b57ab){logger[_0x1126('0x14')](_0x1126('0x1d'),_0x4b57ab[_0x1126('0x16')],_0x22ed37);_0x54400a(_0x1d6d19[_0x1126('0x14')](0x1f4,_0x4b57ab[_0x1126('0x16')]));});});}; \ No newline at end of file +var _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(_0x3b75e9,_0x5de0c4){var _0x23f493=function(_0xa41524){while(--_0xa41524){_0x3b75e9['push'](_0x3b75e9['shift']());}};_0x23f493(++_0x5de0c4);}(_0xadb5,0xad));var _0x5adb=function(_0x165d68,_0x318831){_0x165d68=_0x165d68-0x0;var _0x4cec3c=_0xadb5[_0x165d68];return _0x4cec3c;};'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 2ca2639..f50f312 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 _0x8e7b=['removeListener','register','openchannelMessage:','./openchannelMessage.events','remove','update','emit'];(function(_0x3733d6,_0x5cdc85){var _0x351d9d=function(_0x31ddc2){while(--_0x31ddc2){_0x3733d6['push'](_0x3733d6['shift']());}};_0x351d9d(++_0x5cdc85);}(_0x8e7b,0x184));var _0xb8e7=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x8e7b[_0x40a045];return _0x1a687c;};'use strict';var OpenchannelMessageEvents=require(_0xb8e7('0x0'));var events=['save',_0xb8e7('0x1'),_0xb8e7('0x2')];function createListener(_0x519768,_0x3acfa5){return function(_0x57548d){_0x3acfa5[_0xb8e7('0x3')](_0x519768,_0x57548d);};}function removeListener(_0x34911d,_0x2c9994){return function(){OpenchannelMessageEvents[_0xb8e7('0x4')](_0x34911d,_0x2c9994);};}exports[_0xb8e7('0x5')]=function(_0x48ba10){for(var _0x2ea2f8=0x0,_0x78cd62=events['length'];_0x2ea2f8<_0x78cd62;_0x2ea2f8++){var _0x33c814=events[_0x2ea2f8];var _0x39b3fb=createListener(_0xb8e7('0x6')+_0x33c814,_0x48ba10);OpenchannelMessageEvents['on'](_0x33c814,_0x39b3fb);}}; \ No newline at end of file +var _0xb4c9=['emit','removeListener','register','length','openchannelMessage:','save'];(function(_0x13e4c8,_0x1fedec){var _0x6a09d6=function(_0x590d23){while(--_0x590d23){_0x13e4c8['push'](_0x13e4c8['shift']());}};_0x6a09d6(++_0x1fedec);}(_0xb4c9,0xbf));var _0x9b4c=function(_0x3033b9,_0x414c8f){_0x3033b9=_0x3033b9-0x0;var _0x2cd07f=_0xb4c9[_0x3033b9];return _0x2cd07f;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=[_0x9b4c('0x0'),'remove','update'];function createListener(_0x978732,_0x5d8784){return function(_0x4b6b22){_0x5d8784[_0x9b4c('0x1')](_0x978732,_0x4b6b22);};}function removeListener(_0x79ba17,_0x72fd2b){return function(){OpenchannelMessageEvents[_0x9b4c('0x2')](_0x79ba17,_0x72fd2b);};}exports[_0x9b4c('0x3')]=function(_0x2c5460){for(var _0x859180=0x0,_0x1dcc08=events[_0x9b4c('0x4')];_0x859180<_0x1dcc08;_0x859180++){var _0x1e427d=events[_0x859180];var _0x24787c=createListener(_0x9b4c('0x5')+_0x1e427d,_0x2c5460);OpenchannelMessageEvents['on'](_0x1e427d,_0x24787c);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index a90d8d1..081ed11 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 _0xf554=['Router','../../components/interaction/service','./openchannelQueue.controller','get','index','/describe','isAuthenticated','/:id','show','/:id/members','/:id/teams','getTeams','getAgents','create','addTeams','post','/:id/users','addAgents','update','delete','destroy','removeAgents','exports','multer','connect-timeout','express'];(function(_0x40d7f3,_0x4e071d){var _0x1659c3=function(_0x152147){while(--_0x152147){_0x40d7f3['push'](_0x40d7f3['shift']());}};_0x1659c3(++_0x4e071d);}(_0xf554,0xe7));var _0x4f55=function(_0x1cd0c0,_0x4e6abe){_0x1cd0c0=_0x1cd0c0-0x0;var _0x33ad04=_0xf554[_0x1cd0c0];return _0x33ad04;};'use strict';var multer=require(_0x4f55('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4f55('0x1'));var express=require(_0x4f55('0x2'));var router=express[_0x4f55('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4f55('0x4'));var config=require('../../config/environment');var controller=require(_0x4f55('0x5'));router[_0x4f55('0x6')]('/',auth['isAuthenticated'](),controller[_0x4f55('0x7')]);router[_0x4f55('0x6')](_0x4f55('0x8'),auth[_0x4f55('0x9')](),controller['describe']);router[_0x4f55('0x6')](_0x4f55('0xa'),auth[_0x4f55('0x9')](),controller[_0x4f55('0xb')]);router[_0x4f55('0x6')](_0x4f55('0xc'),auth['isAuthenticated'](),controller['getMembers']);router[_0x4f55('0x6')](_0x4f55('0xd'),auth[_0x4f55('0x9')](),controller[_0x4f55('0xe')]);router[_0x4f55('0x6')]('/:id/users',auth[_0x4f55('0x9')](),controller[_0x4f55('0xf')]);router['post']('/',auth[_0x4f55('0x9')](),controller[_0x4f55('0x10')]);router['post'](_0x4f55('0xd'),auth['isAuthenticated'](),controller[_0x4f55('0x11')]);router[_0x4f55('0x12')](_0x4f55('0x13'),auth['isAuthenticated'](),controller[_0x4f55('0x14')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x4f55('0x15')]);router[_0x4f55('0x16')](_0x4f55('0xa'),auth[_0x4f55('0x9')](),controller[_0x4f55('0x17')]);router['delete']('/:id/teams',auth['isAuthenticated'](),controller['removeTeams']);router['delete'](_0x4f55('0x13'),auth[_0x4f55('0x9')](),controller[_0x4f55('0x18')]);module[_0x4f55('0x19')]=router; \ No newline at end of file +var _0xe298=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','getTeams','getAgents','/:id/teams','post','/:id/users','put','destroy','removeTeams','delete','removeAgents','exports','multer','util'];(function(_0x29cc56,_0x572e53){var _0x816a75=function(_0x452807){while(--_0x452807){_0x29cc56['push'](_0x29cc56['shift']());}};_0x816a75(++_0x572e53);}(_0xe298,0x1a7));var _0x8e29=function(_0x2f0187,_0x2452d6){_0x2f0187=_0x2f0187-0x0;var _0x2cacd0=_0xe298[_0x2f0187];return _0x2cacd0;};'use strict';var multer=require(_0x8e29('0x0'));var util=require(_0x8e29('0x1'));var path=require('path');var timeout=require(_0x8e29('0x2'));var express=require('express');var router=express[_0x8e29('0x3')]();var fs_extra=require(_0x8e29('0x4'));var auth=require(_0x8e29('0x5'));var interaction=require(_0x8e29('0x6'));var config=require(_0x8e29('0x7'));var controller=require('./openchannelQueue.controller');router[_0x8e29('0x8')]('/',auth[_0x8e29('0x9')](),controller['index']);router[_0x8e29('0x8')](_0x8e29('0xa'),auth[_0x8e29('0x9')](),controller[_0x8e29('0xb')]);router[_0x8e29('0x8')](_0x8e29('0xc'),auth['isAuthenticated'](),controller[_0x8e29('0xd')]);router[_0x8e29('0x8')]('/:id/members',auth[_0x8e29('0x9')](),controller['getMembers']);router[_0x8e29('0x8')]('/:id/teams',auth[_0x8e29('0x9')](),controller[_0x8e29('0xe')]);router[_0x8e29('0x8')]('/:id/users',auth[_0x8e29('0x9')](),controller[_0x8e29('0xf')]);router['post']('/',auth[_0x8e29('0x9')](),controller['create']);router['post'](_0x8e29('0x10'),auth['isAuthenticated'](),controller['addTeams']);router[_0x8e29('0x11')](_0x8e29('0x12'),auth[_0x8e29('0x9')](),controller['addAgents']);router[_0x8e29('0x13')](_0x8e29('0xc'),auth[_0x8e29('0x9')](),controller['update']);router['delete']('/:id',auth[_0x8e29('0x9')](),controller[_0x8e29('0x14')]);router['delete'](_0x8e29('0x10'),auth[_0x8e29('0x9')](),controller[_0x8e29('0x15')]);router[_0x8e29('0x16')](_0x8e29('0x12'),auth[_0x8e29('0x9')](),controller[_0x8e29('0x17')]);module[_0x8e29('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 434cee9..7af19f1 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 _0x3a1d=['exports','STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize'];(function(_0x46dc20,_0x381a06){var _0x4a3ad6=function(_0x3cadfa){while(--_0x3cadfa){_0x46dc20['push'](_0x46dc20['shift']());}};_0x4a3ad6(++_0x381a06);}(_0x3a1d,0xe0));var _0xd3a1=function(_0xce93c,_0x555be5){_0xce93c=_0xce93c-0x0;var _0x230720=_0x3a1d[_0xce93c];return _0x230720;};'use strict';var Sequelize=require(_0xd3a1('0x0'));module[_0xd3a1('0x1')]={'name':{'type':Sequelize[_0xd3a1('0x2')],'unique':_0xd3a1('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xd3a1('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xd3a1('0x5')](_0xd3a1('0x6'),_0xd3a1('0x7'),_0xd3a1('0x8'))}}; \ No newline at end of file +var _0x261b=['exports','STRING','name','INTEGER','ENUM','beepall'];(function(_0x48b677,_0x2b5ba3){var _0x1162c5=function(_0x38917e){while(--_0x38917e){_0x48b677['push'](_0x48b677['shift']());}};_0x1162c5(++_0x2b5ba3);}(_0x261b,0x19e));var _0xb261=function(_0x47cd4d,_0x439e9c){_0x47cd4d=_0x47cd4d-0x0;var _0x2a2595=_0x261b[_0x47cd4d];return _0x2a2595;};'use strict';var Sequelize=require('sequelize');module[_0xb261('0x0')]={'name':{'type':Sequelize[_0xb261('0x1')],'unique':_0xb261('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xb261('0x1')]},'timeout':{'type':Sequelize[_0xb261('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xb261('0x4')]('rrmemory',_0xb261('0x5'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index eb3dbd8..924f709 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 _0xbf6f=['rawAttributes','fieldName','type','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','getMembers','findOne','OpenchannelQueueId','UserOpenchannelQueue','findAndCountAll','UserId','openchannelPause','updatedAt','format','%s/%s','createdAt','getTeams','Team','addTeams','User','online','voicePause','Agents','sequelize','transaction','each','forEach','emit','userOpenchannelQueue:save','removeTeams','select','field','from','join','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','push','QueryTypes','SELECT','every','TeamId','includes','all','union','value','ids','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','spread','isArray','getAgents','rimraf','request-promise','moment','bluebird','util','path','sox','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','get','OpenchannelQueues','error','name','send','index','OpenchannelQueue'];(function(_0x13d580,_0x53a187){var _0x5e124b=function(_0x5abc88){while(--_0x5abc88){_0x13d580['push'](_0x13d580['shift']());}};_0x5e124b(++_0x53a187);}(_0xbf6f,0x1f4));var _0xfbf6=function(_0x2b6e7a,_0x1f5d66){_0x2b6e7a=_0x2b6e7a-0x0;var _0x473bb5=_0xbf6f[_0x2b6e7a];return _0x473bb5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfbf6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xfbf6('0x1'));var moment=require(_0xfbf6('0x2'));var BPromise=require(_0xfbf6('0x3'));var Mustache=require('mustache');var util=require(_0xfbf6('0x4'));var path=require(_0xfbf6('0x5'));var sox=require(_0xfbf6('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfbf6('0x7'));var _=require(_0xfbf6('0x8'));var squel=require(_0xfbf6('0x9'));var crypto=require('crypto');var jsforce=require(_0xfbf6('0xa'));var deskjs=require(_0xfbf6('0xb'));var toCsv=require(_0xfbf6('0xc'));var querystring=require(_0xfbf6('0xd'));var Papa=require(_0xfbf6('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xfbf6('0xf'));var hardwareService=require(_0xfbf6('0x10'));var logger=require(_0xfbf6('0x11'))(_0xfbf6('0x12'));var utils=require(_0xfbf6('0x13'));var config=require(_0xfbf6('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xfbf6('0x15')]=_[_0xfbf6('0x16')](config['redis'],{'host':_0xfbf6('0x17'),'port':0x18eb});var socket=require(_0xfbf6('0x18'))(new Redis(config['redis']));require(_0xfbf6('0x19'))['register'](socket);function respondWithStatusCode(_0x50901c,_0x335e64){_0x335e64=_0x335e64||0xcc;return function(_0x535d7b){if(_0x535d7b){return _0x50901c[_0xfbf6('0x1a')](_0x335e64);}return _0x50901c[_0xfbf6('0x1b')](_0x335e64)[_0xfbf6('0x1c')]();};}function respondWithResult(_0x7546a3,_0x5aa78c){_0x5aa78c=_0x5aa78c||0xc8;return function(_0x443d30){if(_0x443d30){return _0x7546a3[_0xfbf6('0x1b')](_0x5aa78c)[_0xfbf6('0x1d')](_0x443d30);}};}function respondWithFilteredResult(_0x3850c4,_0x1c1302){return function(_0x56aa1a){if(_0x56aa1a){var _0xa29b54=typeof _0x1c1302[_0xfbf6('0x1e')]===_0xfbf6('0x1f')&&typeof _0x1c1302[_0xfbf6('0x20')]==='undefined';var _0x55a0a7=_0x56aa1a[_0xfbf6('0x21')];var _0x1be671=_0xa29b54?0x0:_0x1c1302[_0xfbf6('0x1e')];var _0x5e81d8=_0xa29b54?_0x56aa1a[_0xfbf6('0x21')]:_0x1c1302[_0xfbf6('0x1e')]+_0x1c1302[_0xfbf6('0x20')];var _0x563ea7;if(_0x5e81d8>=_0x55a0a7){_0x5e81d8=_0x55a0a7;_0x563ea7=0xc8;}else{_0x563ea7=0xce;}_0x3850c4[_0xfbf6('0x1b')](_0x563ea7);return _0x3850c4[_0xfbf6('0x22')]('Content-Range',_0x1be671+'-'+_0x5e81d8+'/'+_0x55a0a7)[_0xfbf6('0x1d')](_0x56aa1a);}return null;};}function patchUpdates(_0x41b5a4){return function(_0x52d9f7){try{jsonpatch[_0xfbf6('0x23')](_0x52d9f7,_0x41b5a4,!![]);}catch(_0x35909d){return BPromise[_0xfbf6('0x24')](_0x35909d);}return _0x52d9f7[_0xfbf6('0x25')]();};}function saveUpdates(_0x349520,_0x4a9a00){return function(_0x4cd87c){if(_0x4cd87c){return _0x4cd87c[_0xfbf6('0x26')](_0x349520)['then'](function(_0x598f31){return _0x598f31;});}return null;};}function removeEntity(_0x281aad,_0x424388){return function(_0x232ddc){if(_0x232ddc){return _0x232ddc[_0xfbf6('0x27')]()[_0xfbf6('0x28')](function(){var _0x5921c3=_0x232ddc[_0xfbf6('0x29')]({'plain':!![]});var _0x411f4d=_0xfbf6('0x2a');return db['UserProfileResource'][_0xfbf6('0x27')]({'where':{'type':_0x411f4d,'resourceId':_0x5921c3['id']}})['then'](function(){return _0x232ddc;});})[_0xfbf6('0x28')](function(){_0x281aad[_0xfbf6('0x1b')](0xcc)[_0xfbf6('0x1c')]();});}};}function handleEntityNotFound(_0x447f62,_0x26b1d0){return function(_0x8add0b){if(!_0x8add0b){_0x447f62[_0xfbf6('0x1a')](0x194);}return _0x8add0b;};}function handleError(_0x5627bf,_0x56ebf1){_0x56ebf1=_0x56ebf1||0x1f4;return function(_0x2e1876){logger[_0xfbf6('0x2b')](_0x2e1876['stack']);if(_0x2e1876['name']){delete _0x2e1876[_0xfbf6('0x2c')];}_0x5627bf[_0xfbf6('0x1b')](_0x56ebf1)[_0xfbf6('0x2d')](_0x2e1876);};}exports[_0xfbf6('0x2e')]=function(_0x419e01,_0x263945){var _0x611ee0={},_0x129c73={},_0x59822a={'count':0x0,'rows':[]};var _0x2d8fa2=_['map'](db[_0xfbf6('0x2f')][_0xfbf6('0x30')],function(_0x1ccedc){return{'name':_0x1ccedc[_0xfbf6('0x31')],'type':_0x1ccedc[_0xfbf6('0x32')]['key']};});_0x129c73[_0xfbf6('0x33')]=_[_0xfbf6('0x34')](_0x2d8fa2,'name');_0x129c73['query']=_[_0xfbf6('0x35')](_0x419e01['query']);_0x129c73[_0xfbf6('0x36')]=_[_0xfbf6('0x37')](_0x129c73[_0xfbf6('0x33')],_0x129c73[_0xfbf6('0x38')]);_0x611ee0[_0xfbf6('0x39')]=_[_0xfbf6('0x37')](_0x129c73['model'],qs[_0xfbf6('0x3a')](_0x419e01[_0xfbf6('0x38')]['fields']));_0x611ee0[_0xfbf6('0x39')]=_0x611ee0[_0xfbf6('0x39')][_0xfbf6('0x3b')]?_0x611ee0[_0xfbf6('0x39')]:_0x129c73[_0xfbf6('0x33')];if(!_0x419e01['query'][_0xfbf6('0x3c')](_0xfbf6('0x3d'))){_0x611ee0[_0xfbf6('0x20')]=qs[_0xfbf6('0x20')](_0x419e01[_0xfbf6('0x38')]['limit']);_0x611ee0[_0xfbf6('0x1e')]=qs[_0xfbf6('0x1e')](_0x419e01[_0xfbf6('0x38')]['offset']);}_0x611ee0[_0xfbf6('0x3e')]=qs[_0xfbf6('0x3f')](_0x419e01['query'][_0xfbf6('0x3f')]);_0x611ee0[_0xfbf6('0x40')]=qs[_0xfbf6('0x36')](_[_0xfbf6('0x41')](_0x419e01[_0xfbf6('0x38')],_0x129c73[_0xfbf6('0x36')]),_0x2d8fa2);if(_0x419e01[_0xfbf6('0x38')][_0xfbf6('0x42')]){_0x611ee0[_0xfbf6('0x40')]=_['merge'](_0x611ee0[_0xfbf6('0x40')],{'$or':_[_0xfbf6('0x34')](_0x2d8fa2,function(_0x2a4a53){if(_0x2a4a53[_0xfbf6('0x32')]!==_0xfbf6('0x43')){var _0x153fff={};_0x153fff[_0x2a4a53[_0xfbf6('0x2c')]]={'$like':'%'+_0x419e01['query'][_0xfbf6('0x42')]+'%'};return _0x153fff;}})});}_0x611ee0=_[_0xfbf6('0x44')]({},_0x611ee0,_0x419e01[_0xfbf6('0x45')]);var _0x25bd27={'where':_0x611ee0['where']};return db[_0xfbf6('0x2f')][_0xfbf6('0x21')](_0x25bd27)[_0xfbf6('0x28')](function(_0x37c6fe){_0x59822a['count']=_0x37c6fe;if(_0x419e01['query'][_0xfbf6('0x46')]){_0x611ee0['include']=[{'all':!![]}];}return db[_0xfbf6('0x2f')][_0xfbf6('0x47')](_0x611ee0);})[_0xfbf6('0x28')](function(_0x2e8d67){_0x59822a[_0xfbf6('0x48')]=_0x2e8d67;return _0x59822a;})['then'](respondWithFilteredResult(_0x263945,_0x611ee0))[_0xfbf6('0x49')](handleError(_0x263945,null));};exports[_0xfbf6('0x4a')]=function(_0x36a792,_0x2017ab){var _0x5403a0={'raw':!![],'where':{'id':_0x36a792['params']['id']}},_0x10a232={};_0x10a232[_0xfbf6('0x33')]=_[_0xfbf6('0x35')](db[_0xfbf6('0x2f')][_0xfbf6('0x30')]);_0x10a232[_0xfbf6('0x38')]=_[_0xfbf6('0x35')](_0x36a792['query']);_0x10a232['filters']=_['intersection'](_0x10a232[_0xfbf6('0x33')],_0x10a232['query']);_0x5403a0['attributes']=_[_0xfbf6('0x37')](_0x10a232[_0xfbf6('0x33')],qs[_0xfbf6('0x3a')](_0x36a792['query'][_0xfbf6('0x3a')]));_0x5403a0[_0xfbf6('0x39')]=_0x5403a0[_0xfbf6('0x39')][_0xfbf6('0x3b')]?_0x5403a0['attributes']:_0x10a232[_0xfbf6('0x33')];if(_0x36a792['query'][_0xfbf6('0x46')]){_0x5403a0['include']=[{'all':!![]}];}_0x5403a0=_['merge']({},_0x5403a0,_0x36a792[_0xfbf6('0x45')]);return db[_0xfbf6('0x2f')][_0xfbf6('0x4b')](_0x5403a0)[_0xfbf6('0x28')](handleEntityNotFound(_0x2017ab,null))[_0xfbf6('0x28')](respondWithResult(_0x2017ab,null))['catch'](handleError(_0x2017ab,null));};exports[_0xfbf6('0x4c')]=function(_0x1e730b,_0x1289aa){return db[_0xfbf6('0x2f')][_0xfbf6('0x4c')](_0x1e730b['body'],{})[_0xfbf6('0x28')](function(_0x205db6){var _0x1bfed5=_0x1e730b[_0xfbf6('0x4d')][_0xfbf6('0x29')]({'plain':!![]});if(!_0x1bfed5)throw new Error(_0xfbf6('0x4e'));if(_0x1bfed5[_0xfbf6('0x4f')]===_0xfbf6('0x4d')){var _0x464605=_0x205db6['get']({'plain':!![]});var _0x484aeb='OpenchannelQueues';return db[_0xfbf6('0x50')][_0xfbf6('0x4b')]({'where':{'name':_0x484aeb,'userProfileId':_0x1bfed5[_0xfbf6('0x51')]},'raw':!![]})['then'](function(_0x3fd833){if(_0x3fd833&&_0x3fd833[_0xfbf6('0x52')]===0x0){return db[_0xfbf6('0x53')]['create']({'name':_0x464605[_0xfbf6('0x2c')],'resourceId':_0x464605['id'],'type':_0x3fd833[_0xfbf6('0x2c')],'sectionId':_0x3fd833['id']},{})[_0xfbf6('0x28')](function(){return _0x205db6;});}else{return _0x205db6;}})['catch'](function(_0x5516ae){logger[_0xfbf6('0x2b')](_0xfbf6('0x54'),_0x5516ae);throw _0x5516ae;});}return _0x205db6;})['then'](respondWithResult(_0x1289aa,0xc9))[_0xfbf6('0x49')](handleError(_0x1289aa,null));};exports['update']=function(_0x1f9ff8,_0x247f73){if(_0x1f9ff8['body']['id']){delete _0x1f9ff8[_0xfbf6('0x55')]['id'];}return db['OpenchannelQueue']['find']({'where':{'id':_0x1f9ff8[_0xfbf6('0x56')]['id']}})[_0xfbf6('0x28')](handleEntityNotFound(_0x247f73,null))['then'](saveUpdates(_0x1f9ff8[_0xfbf6('0x55')],null))['then'](respondWithResult(_0x247f73,null))[_0xfbf6('0x49')](handleError(_0x247f73,null));};exports[_0xfbf6('0x27')]=function(_0x42c515,_0x20c803){return db[_0xfbf6('0x2f')][_0xfbf6('0x4b')]({'where':{'id':_0x42c515[_0xfbf6('0x56')]['id']}})[_0xfbf6('0x28')](handleEntityNotFound(_0x20c803,null))[_0xfbf6('0x28')](removeEntity(_0x20c803,null))[_0xfbf6('0x49')](handleError(_0x20c803,null));};exports[_0xfbf6('0x57')]=function(_0x39a99c,_0x13fca7){return db[_0xfbf6('0x2f')][_0xfbf6('0x57')]()[_0xfbf6('0x28')](respondWithResult(_0x13fca7,null))[_0xfbf6('0x49')](handleError(_0x13fca7,null));};exports[_0xfbf6('0x58')]=function(_0x1d245b,_0x1ed72a,_0x255395){var _0x4a1ef6={'raw':!![],'where':{}},_0x468cd8={},_0x37c4b6;return db[_0xfbf6('0x2f')][_0xfbf6('0x59')]({'where':{'id':_0x1d245b[_0xfbf6('0x56')]['id']}})[_0xfbf6('0x28')](handleEntityNotFound(_0x1ed72a,null))[_0xfbf6('0x28')](function(_0x4334ee){if(_0x4334ee){_0x37c4b6=_0x4334ee['get']({'plain':!![]});_0x468cd8['model']=_[_0xfbf6('0x35')](db['UserOpenchannelQueue'][_0xfbf6('0x30')]);_0x468cd8[_0xfbf6('0x38')]=_[_0xfbf6('0x35')](_0x1d245b[_0xfbf6('0x38')]);_0x468cd8[_0xfbf6('0x36')]=_[_0xfbf6('0x37')](_0x468cd8[_0xfbf6('0x33')],_0x468cd8[_0xfbf6('0x38')]);_0x4a1ef6['attributes']=_[_0xfbf6('0x37')](_0x468cd8[_0xfbf6('0x33')],qs[_0xfbf6('0x3a')](_0x1d245b[_0xfbf6('0x38')][_0xfbf6('0x3a')]));_0x4a1ef6[_0xfbf6('0x39')]=_0x4a1ef6[_0xfbf6('0x39')][_0xfbf6('0x3b')]?_0x4a1ef6[_0xfbf6('0x39')]:_0x468cd8[_0xfbf6('0x33')];if(!_0x1d245b['query'][_0xfbf6('0x3c')](_0xfbf6('0x3d'))){_0x4a1ef6['limit']=qs['limit'](_0x1d245b[_0xfbf6('0x38')][_0xfbf6('0x20')]);_0x4a1ef6[_0xfbf6('0x1e')]=qs[_0xfbf6('0x1e')](_0x1d245b[_0xfbf6('0x38')][_0xfbf6('0x1e')]);}_0x4a1ef6['order']=qs[_0xfbf6('0x3f')](_0x1d245b[_0xfbf6('0x38')][_0xfbf6('0x3f')]);_0x4a1ef6['where']=qs[_0xfbf6('0x36')](_[_0xfbf6('0x41')](_0x1d245b[_0xfbf6('0x38')],_0x468cd8['filters']));_0x4a1ef6[_0xfbf6('0x40')][_0xfbf6('0x5a')]=_0x4334ee['id'];if(_0x1d245b['query'][_0xfbf6('0x42')]){_0x4a1ef6[_0xfbf6('0x40')]=_[_0xfbf6('0x44')](_0x4a1ef6[_0xfbf6('0x40')],{'$or':_[_0xfbf6('0x34')](_0x4a1ef6[_0xfbf6('0x39')],function(_0x596594){var _0x41d20d={};_0x41d20d[_0x596594]={'$like':'%'+_0x1d245b[_0xfbf6('0x38')]['filter']+'%'};return _0x41d20d;})});}_0x4a1ef6=_[_0xfbf6('0x44')]({},_0x4a1ef6,_0x1d245b[_0xfbf6('0x45')]);return db[_0xfbf6('0x5b')][_0xfbf6('0x47')](_0x4a1ef6);}})['then'](function(_0x64932){if(_0x64932){return db['User'][_0xfbf6('0x5c')]({'where':{'id':_['map'](_0x64932,_0xfbf6('0x5d')),'role':'agent'},'attributes':['id',_0xfbf6('0x2c'),_0xfbf6('0x5e'),_0xfbf6('0x5f'),'createdAt']});}})[_0xfbf6('0x28')](function(_0x59ad75){if(_0x59ad75){return{'count':_0x59ad75[_0xfbf6('0x21')],'rows':_[_0xfbf6('0x34')](_0x59ad75['rows'],function(_0x181e75){return{'membername':_0x181e75['name'],'UserId':_0x181e75['id'],'queue_name':_0x37c4b6[_0xfbf6('0x2c')],'OpenchannelQueueId':_0x37c4b6['id'],'interface':util[_0xfbf6('0x60')](_0xfbf6('0x61'),'SIP',_0x181e75[_0xfbf6('0x2c')]),'penalty':0x0,'paused':_0x181e75[_0xfbf6('0x5e')],'createdAt':_0x181e75[_0xfbf6('0x62')],'updatedAt':_0x181e75[_0xfbf6('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x1ed72a,_0x4a1ef6))[_0xfbf6('0x49')](handleError(_0x1ed72a,null));};exports[_0xfbf6('0x63')]=function(_0x431bb6,_0x5efd1f,_0x2555fd){var _0x3c0041={};var _0xffcdc3={};var _0x502ba3;var _0x4f4a94;return db[_0xfbf6('0x2f')][_0xfbf6('0x59')]({'where':{'id':_0x431bb6[_0xfbf6('0x56')]['id']}})[_0xfbf6('0x28')](handleEntityNotFound(_0x5efd1f,null))[_0xfbf6('0x28')](function(_0x2587ff){if(_0x2587ff){_0x502ba3=_0x2587ff;_0xffcdc3[_0xfbf6('0x33')]=_[_0xfbf6('0x35')](db[_0xfbf6('0x64')][_0xfbf6('0x30')]);_0xffcdc3[_0xfbf6('0x38')]=_[_0xfbf6('0x35')](_0x431bb6[_0xfbf6('0x38')]);_0xffcdc3[_0xfbf6('0x36')]=_[_0xfbf6('0x37')](_0xffcdc3[_0xfbf6('0x33')],_0xffcdc3['query']);_0x3c0041[_0xfbf6('0x39')]=_[_0xfbf6('0x37')](_0xffcdc3[_0xfbf6('0x33')],qs[_0xfbf6('0x3a')](_0x431bb6[_0xfbf6('0x38')]['fields']));_0x3c0041[_0xfbf6('0x39')]=_0x3c0041[_0xfbf6('0x39')][_0xfbf6('0x3b')]?_0x3c0041[_0xfbf6('0x39')]:_0xffcdc3[_0xfbf6('0x33')];_0x3c0041[_0xfbf6('0x3e')]=qs['sort'](_0x431bb6[_0xfbf6('0x38')]['sort']);_0x3c0041[_0xfbf6('0x40')]=qs['filters'](_[_0xfbf6('0x41')](_0x431bb6[_0xfbf6('0x38')],_0xffcdc3[_0xfbf6('0x36')]));if(_0x431bb6[_0xfbf6('0x38')][_0xfbf6('0x42')]){_0x3c0041['where']=_[_0xfbf6('0x44')](_0x3c0041['where'],{'$or':_[_0xfbf6('0x34')](_0x3c0041[_0xfbf6('0x39')],function(_0x56b74f){var _0x5a44f6={};_0x5a44f6[_0x56b74f]={'$like':'%'+_0x431bb6[_0xfbf6('0x38')][_0xfbf6('0x42')]+'%'};return _0x5a44f6;})});}_0x3c0041=_[_0xfbf6('0x44')]({},_0x3c0041,_0x431bb6[_0xfbf6('0x45')]);return _0x502ba3[_0xfbf6('0x63')](_0x3c0041);}})[_0xfbf6('0x28')](function(_0x4b2c49){if(_0x4b2c49){_0x4f4a94=_0x4b2c49[_0xfbf6('0x3b')];if(!_0x431bb6[_0xfbf6('0x38')][_0xfbf6('0x3c')](_0xfbf6('0x3d'))){_0x3c0041[_0xfbf6('0x20')]=qs['limit'](_0x431bb6[_0xfbf6('0x38')][_0xfbf6('0x20')]);_0x3c0041['offset']=qs[_0xfbf6('0x1e')](_0x431bb6[_0xfbf6('0x38')][_0xfbf6('0x1e')]);}return _0x502ba3['getTeams'](_0x3c0041);}})['then'](function(_0x9b4d1c){if(_0x9b4d1c){return _0x9b4d1c?{'count':_0x4f4a94,'rows':_0x9b4d1c}:null;}})['then'](respondWithResult(_0x5efd1f,null))[_0xfbf6('0x49')](handleError(_0x5efd1f,null));};exports[_0xfbf6('0x65')]=function(_0x3205ea,_0x563482,_0x591fd5){var _0x529171=_0x3205ea[_0xfbf6('0x55')]['ids'];return db[_0xfbf6('0x64')][_0xfbf6('0x47')]({'where':{'id':_0x529171},'attributes':['id'],'include':[{'model':db[_0xfbf6('0x66')],'as':'Agents','attributes':['id',_0xfbf6('0x2c'),_0xfbf6('0x67'),_0xfbf6('0x68'),'interface'],'raw':!![]}]})[_0xfbf6('0x28')](function(_0x17a9de){if(_0x17a9de){var _0x566cad=_['flatMap'](_0x17a9de,function(_0x12a3d3){var _0x9f51d5=_0x12a3d3[_0xfbf6('0x29')]({'plain':!![]});return _0x9f51d5[_0xfbf6('0x69')];});return db[_0xfbf6('0x2f')]['find']({'where':{'id':_0x3205ea[_0xfbf6('0x56')]['id']}})[_0xfbf6('0x28')](function(_0x34701f){return db[_0xfbf6('0x6a')][_0xfbf6('0x6b')](function(_0xa91ffd){return _0x34701f[_0xfbf6('0x65')](_0x529171,{'transaction':_0xa91ffd})[_0xfbf6('0x28')](function(){return BPromise[_0xfbf6('0x6c')](_0x566cad,function(_0x2d0da7){return db[_0xfbf6('0x5b')]['findOrCreate']({'where':{'UserId':_0x2d0da7['id'],'OpenchannelQueueId':_0x3205ea['params']['id']},'transaction':_0xa91ffd});});})['then'](function(){_0x566cad[_0xfbf6('0x6d')](function(_0x1b81f1){socket[_0xfbf6('0x6e')](_0xfbf6('0x6f'),{'UserId':_0x1b81f1['id'],'OpenchannelQueueId':_0x34701f['id']});});});});});}})[_0xfbf6('0x28')](respondWithStatusCode(_0x563482,null))[_0xfbf6('0x49')](handleError(_0x563482,null));};exports[_0xfbf6('0x70')]=function(_0x7a23ed,_0x495444,_0x177f0a){return db[_0xfbf6('0x64')][_0xfbf6('0x47')]({'where':{'id':_0x7a23ed[_0xfbf6('0x38')]['ids']},'attributes':['id'],'include':[{'model':db[_0xfbf6('0x66')],'as':_0xfbf6('0x69'),'attributes':['id'],'raw':!![]}]})[_0xfbf6('0x28')](handleEntityNotFound(_0x495444,null))['then'](function(_0xb2630a){var _0x398c1d=_[_0xfbf6('0x34')](_0xb2630a,'id');var _0xe336d3=[];var _0x404b58=[];var _0x9900d3=squel[_0xfbf6('0x71')]();_0x9900d3[_0xfbf6('0x72')]('tq.TeamId')[_0xfbf6('0x73')]('team_has_openchannel_queues','tq')[_0xfbf6('0x74')]('user_has_teams','ut',_0xfbf6('0x75'))['where'](_0xfbf6('0x76'),_0x7a23ed[_0xfbf6('0x56')]['id']);for(var _0x4fab91=0x0;_0x4fab91<_0xb2630a[_0xfbf6('0x3b')];_0x4fab91+=0x1){let _0x46dddf=_0xb2630a[_0x4fab91];for(var _0x18b19b=0x0;_0x18b19b<_0x46dddf[_0xfbf6('0x69')][_0xfbf6('0x3b')];_0x18b19b+=0x1){let _0x4b8225=_0x46dddf['Agents'][_0x18b19b];var _0x468b5e=_0x9900d3[_0xfbf6('0x77')]();_0x468b5e[_0xfbf6('0x40')]('ut.UserId\x20=\x20?',_0x4b8225['id']);_0x404b58[_0xfbf6('0x78')](db[_0xfbf6('0x6a')]['query'](_0x468b5e['toString'](),{'type':db[_0xfbf6('0x6a')][_0xfbf6('0x79')][_0xfbf6('0x7a')]})[_0xfbf6('0x28')](function(_0x5bd3f7){if(_0x5bd3f7['length']===0x1){return _0x4b8225['id'];}else{var _0x3be074=_[_0xfbf6('0x7b')](_[_0xfbf6('0x34')](_0x5bd3f7,_0xfbf6('0x7c')),function(_0x5efcc2){return _[_0xfbf6('0x7d')](_0x398c1d,_0x5efcc2);});if(_0x3be074){return _0x4b8225['id'];}}}));}}return BPromise[_0xfbf6('0x7e')](_0x404b58)[_0xfbf6('0x28')](function(_0x93fffd){_0xe336d3=_(_0xe336d3)[_0xfbf6('0x7f')](_0x93fffd)['compact']()[_0xfbf6('0x80')]();return db[_0xfbf6('0x2f')][_0xfbf6('0x4b')]({'where':{'id':_0x7a23ed['params']['id']}})[_0xfbf6('0x28')](function(_0x471cff){return db[_0xfbf6('0x6a')][_0xfbf6('0x6b')](function(_0x3e4e53){return _0x471cff[_0xfbf6('0x70')](_0x7a23ed['query'][_0xfbf6('0x81')],{'transaction':_0x3e4e53})[_0xfbf6('0x28')](function(){if(!_[_0xfbf6('0x82')](_0xe336d3)){return _0x471cff[_0xfbf6('0x83')](_0xe336d3,{'transaction':_0x3e4e53});}})[_0xfbf6('0x28')](function(){_0xe336d3[_0xfbf6('0x6d')](function(_0x26886a){socket[_0xfbf6('0x6e')](_0xfbf6('0x84'),{'UserId':_0x26886a,'OpenchannelQueueId':_0x471cff['id']});});});});});});})[_0xfbf6('0x28')](respondWithStatusCode(_0x495444,null))['catch'](handleError(_0x495444,null));};exports[_0xfbf6('0x85')]=function(_0x1384a6,_0x1d26b2,_0x2056fd){return db[_0xfbf6('0x2f')][_0xfbf6('0x4b')]({'where':{'id':_0x1384a6['params']['id']}})[_0xfbf6('0x28')](handleEntityNotFound(_0x1d26b2,null))[_0xfbf6('0x28')](function(_0x3141ab){if(_0x3141ab){return _0x3141ab[_0xfbf6('0x85')](_0x1384a6[_0xfbf6('0x55')][_0xfbf6('0x81')],_['omit'](_0x1384a6[_0xfbf6('0x55')],['ids','id'])||{})[_0xfbf6('0x86')](function(_0x2c6a74){for(var _0x5b5455=0x0;_0x5b5455<_0x1384a6[_0xfbf6('0x55')][_0xfbf6('0x81')]['length'];_0x5b5455+=0x1){socket[_0xfbf6('0x6e')](_0xfbf6('0x6f'),{'UserId':Number(_0x1384a6[_0xfbf6('0x55')][_0xfbf6('0x81')][_0x5b5455]),'OpenchannelQueueId':Number(_0x1384a6[_0xfbf6('0x56')]['id'])});}return _0x2c6a74;});}})['then'](respondWithResult(_0x1d26b2,null))[_0xfbf6('0x49')](handleError(_0x1d26b2,null));};exports['removeAgents']=function(_0x2fa7cb,_0x5e5a29,_0x4db5f6){return db[_0xfbf6('0x2f')][_0xfbf6('0x4b')]({'where':{'id':_0x2fa7cb[_0xfbf6('0x56')]['id']}})['then'](handleEntityNotFound(_0x5e5a29,null))['then'](function(_0x53f986){if(_0x53f986){return _0x53f986['removeAgents'](_0x2fa7cb[_0xfbf6('0x38')]['ids'])[_0xfbf6('0x28')](function(){if(_[_0xfbf6('0x87')](_0x2fa7cb[_0xfbf6('0x38')]['ids'])){for(var _0x92a668=0x0;_0x92a668<_0x2fa7cb['query'][_0xfbf6('0x81')]['length'];_0x92a668+=0x1){socket[_0xfbf6('0x6e')]('userOpenchannelQueue:remove',{'UserId':Number(_0x2fa7cb[_0xfbf6('0x38')][_0xfbf6('0x81')][_0x92a668]),'OpenchannelQueueId':Number(_0x2fa7cb['params']['id'])});}}else{socket[_0xfbf6('0x6e')](_0xfbf6('0x84'),{'UserId':Number(_0x2fa7cb[_0xfbf6('0x38')][_0xfbf6('0x81')]),'OpenchannelQueueId':Number(_0x2fa7cb[_0xfbf6('0x56')]['id'])});}});}})[_0xfbf6('0x28')](respondWithStatusCode(_0x5e5a29,null))[_0xfbf6('0x49')](handleError(_0x5e5a29,null));};exports['getAgents']=function(_0x2e284b,_0x58a9f9,_0x4a98ee){var _0x4b06dd={};var _0x1f2d12={};var _0x1368a1;var _0x1fdead;return db[_0xfbf6('0x2f')]['findOne']({'where':{'id':_0x2e284b[_0xfbf6('0x56')]['id']}})[_0xfbf6('0x28')](handleEntityNotFound(_0x58a9f9,null))[_0xfbf6('0x28')](function(_0x521a51){if(_0x521a51){_0x1368a1=_0x521a51;_0x1f2d12[_0xfbf6('0x33')]=_['keys'](db['User'][_0xfbf6('0x30')]);_0x1f2d12[_0xfbf6('0x38')]=_['keys'](_0x2e284b[_0xfbf6('0x38')]);_0x1f2d12['filters']=_[_0xfbf6('0x37')](_0x1f2d12[_0xfbf6('0x33')],_0x1f2d12['query']);_0x4b06dd['attributes']=_[_0xfbf6('0x37')](_0x1f2d12[_0xfbf6('0x33')],qs['fields'](_0x2e284b[_0xfbf6('0x38')]['fields']));_0x4b06dd[_0xfbf6('0x39')]=_0x4b06dd[_0xfbf6('0x39')][_0xfbf6('0x3b')]?_0x4b06dd[_0xfbf6('0x39')]:_0x1f2d12['model'];_0x4b06dd[_0xfbf6('0x3e')]=qs[_0xfbf6('0x3f')](_0x2e284b[_0xfbf6('0x38')][_0xfbf6('0x3f')]);_0x4b06dd['where']=qs[_0xfbf6('0x36')](_[_0xfbf6('0x41')](_0x2e284b[_0xfbf6('0x38')],_0x1f2d12[_0xfbf6('0x36')]));if(_0x2e284b[_0xfbf6('0x38')][_0xfbf6('0x42')]){_0x4b06dd[_0xfbf6('0x40')]=_[_0xfbf6('0x44')](_0x4b06dd[_0xfbf6('0x40')],{'$or':_[_0xfbf6('0x34')](_0x4b06dd['attributes'],function(_0x386270){var _0x254968={};_0x254968[_0x386270]={'$like':'%'+_0x2e284b[_0xfbf6('0x38')][_0xfbf6('0x42')]+'%'};return _0x254968;})});}_0x4b06dd=_[_0xfbf6('0x44')]({},_0x4b06dd,_0x2e284b[_0xfbf6('0x45')]);return _0x1368a1[_0xfbf6('0x88')](_0x4b06dd);}})['then'](function(_0x29e092){if(_0x29e092){_0x1fdead=_0x29e092[_0xfbf6('0x3b')];if(!_0x2e284b[_0xfbf6('0x38')][_0xfbf6('0x3c')](_0xfbf6('0x3d'))){_0x4b06dd[_0xfbf6('0x20')]=qs[_0xfbf6('0x20')](_0x2e284b[_0xfbf6('0x38')][_0xfbf6('0x20')]);_0x4b06dd[_0xfbf6('0x1e')]=qs['offset'](_0x2e284b[_0xfbf6('0x38')][_0xfbf6('0x1e')]);}return _0x1368a1[_0xfbf6('0x88')](_0x4b06dd);}})[_0xfbf6('0x28')](function(_0x38b539){if(_0x38b539){return _0x38b539?{'count':_0x1fdead,'rows':_0x38b539}:null;}})[_0xfbf6('0x28')](respondWithResult(_0x58a9f9,null))['catch'](handleError(_0x58a9f9,null));}; \ No newline at end of file +var _0xe04f=['show','params','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','describe','getMembers','UserOpenchannelQueue','hasOwnProperty','User','findAndCountAll','openchannelPause','updatedAt','createdAt','rows','format','%s/%s','SIP','getTeams','findOne','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','each','findOrCreate','forEach','userOpenchannelQueue:save','removeTeams','select','field','from','join','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','push','toString','QueryTypes','SELECT','TeamId','includes','all','union','compact','value','removeAgents','emit','userOpenchannelQueue:remove','addAgents','spread','isArray','getAgents','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','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','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','UserProfileResource','error','stack','name','send','index','map','OpenchannelQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','catch'];(function(_0xeedce1,_0xaad89f){var _0x3e6368=function(_0x3c1fdc){while(--_0x3c1fdc){_0xeedce1['push'](_0xeedce1['shift']());}};_0x3e6368(++_0xaad89f);}(_0xe04f,0x15a));var _0xfe04=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0xe04f[_0x5f3f88];return _0xd08119;};'use strict';var emlformat=require(_0xfe04('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xfe04('0x1'));var rp=require(_0xfe04('0x2'));var moment=require('moment');var BPromise=require(_0xfe04('0x3'));var Mustache=require(_0xfe04('0x4'));var util=require(_0xfe04('0x5'));var path=require(_0xfe04('0x6'));var sox=require(_0xfe04('0x7'));var csv=require('to-csv');var ejs=require(_0xfe04('0x8'));var fs=require('fs');var fs_extra=require(_0xfe04('0x9'));var _=require(_0xfe04('0xa'));var squel=require('squel');var crypto=require(_0xfe04('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xfe04('0xc'));var toCsv=require('to-csv');var querystring=require(_0xfe04('0xd'));var Papa=require(_0xfe04('0xe'));var Redis=require(_0xfe04('0xf'));var authService=require(_0xfe04('0x10'));var qs=require(_0xfe04('0x11'));var as=require(_0xfe04('0x12'));var hardwareService=require(_0xfe04('0x13'));var logger=require(_0xfe04('0x14'))(_0xfe04('0x15'));var utils=require('../../config/utils');var config=require(_0xfe04('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xfe04('0x17')]=_[_0xfe04('0x18')](config[_0xfe04('0x17')],{'host':_0xfe04('0x19'),'port':0x18eb});var socket=require(_0xfe04('0x1a'))(new Redis(config[_0xfe04('0x17')]));require(_0xfe04('0x1b'))[_0xfe04('0x1c')](socket);function respondWithStatusCode(_0x38d905,_0x5b5868){_0x5b5868=_0x5b5868||0xcc;return function(_0x123bc8){if(_0x123bc8){return _0x38d905[_0xfe04('0x1d')](_0x5b5868);}return _0x38d905[_0xfe04('0x1e')](_0x5b5868)[_0xfe04('0x1f')]();};}function respondWithResult(_0x4cedc8,_0x2aa08e){_0x2aa08e=_0x2aa08e||0xc8;return function(_0x1504dd){if(_0x1504dd){return _0x4cedc8[_0xfe04('0x1e')](_0x2aa08e)[_0xfe04('0x20')](_0x1504dd);}};}function respondWithFilteredResult(_0x4ba426,_0x5cbf31){return function(_0x1afc6e){if(_0x1afc6e){var _0x169f46=typeof _0x5cbf31[_0xfe04('0x21')]===_0xfe04('0x22')&&typeof _0x5cbf31[_0xfe04('0x23')]===_0xfe04('0x22');var _0x2237a8=_0x1afc6e['count'];var _0x582721=_0x169f46?0x0:_0x5cbf31[_0xfe04('0x21')];var _0xf75832=_0x169f46?_0x1afc6e[_0xfe04('0x24')]:_0x5cbf31[_0xfe04('0x21')]+_0x5cbf31['limit'];var _0x5b14d4;if(_0xf75832>=_0x2237a8){_0xf75832=_0x2237a8;_0x5b14d4=0xc8;}else{_0x5b14d4=0xce;}_0x4ba426['status'](_0x5b14d4);return _0x4ba426[_0xfe04('0x25')](_0xfe04('0x26'),_0x582721+'-'+_0xf75832+'/'+_0x2237a8)['json'](_0x1afc6e);}return null;};}function patchUpdates(_0x512eeb){return function(_0x5fb32c){try{jsonpatch[_0xfe04('0x27')](_0x5fb32c,_0x512eeb,!![]);}catch(_0x54821c){return BPromise[_0xfe04('0x28')](_0x54821c);}return _0x5fb32c[_0xfe04('0x29')]();};}function saveUpdates(_0x4a2536,_0x4b9b85){return function(_0xe84505){if(_0xe84505){return _0xe84505[_0xfe04('0x2a')](_0x4a2536)[_0xfe04('0x2b')](function(_0x35e3ca){return _0x35e3ca;});}return null;};}function removeEntity(_0x1b4ee7,_0x1371bb){return function(_0x392a31){if(_0x392a31){return _0x392a31[_0xfe04('0x2c')]()[_0xfe04('0x2b')](function(){var _0x392346=_0x392a31['get']({'plain':!![]});var _0x71733b='OpenchannelQueues';return db[_0xfe04('0x2d')][_0xfe04('0x2c')]({'where':{'type':_0x71733b,'resourceId':_0x392346['id']}})[_0xfe04('0x2b')](function(){return _0x392a31;});})[_0xfe04('0x2b')](function(){_0x1b4ee7[_0xfe04('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x52b82b,_0x50bf5f){return function(_0x513bfb){if(!_0x513bfb){_0x52b82b[_0xfe04('0x1d')](0x194);}return _0x513bfb;};}function handleError(_0x37dac9,_0x560f0b){_0x560f0b=_0x560f0b||0x1f4;return function(_0x81cd2a){logger[_0xfe04('0x2e')](_0x81cd2a[_0xfe04('0x2f')]);if(_0x81cd2a[_0xfe04('0x30')]){delete _0x81cd2a[_0xfe04('0x30')];}_0x37dac9[_0xfe04('0x1e')](_0x560f0b)[_0xfe04('0x31')](_0x81cd2a);};}exports[_0xfe04('0x32')]=function(_0xbbedbc,_0x202287){var _0x135aa4={},_0x2e5000={},_0x365682={'count':0x0,'rows':[]};var _0x5e971d=_[_0xfe04('0x33')](db[_0xfe04('0x34')][_0xfe04('0x35')],function(_0x949e46){return{'name':_0x949e46[_0xfe04('0x36')],'type':_0x949e46[_0xfe04('0x37')][_0xfe04('0x38')]};});_0x2e5000[_0xfe04('0x39')]=_[_0xfe04('0x33')](_0x5e971d,'name');_0x2e5000[_0xfe04('0x3a')]=_[_0xfe04('0x3b')](_0xbbedbc[_0xfe04('0x3a')]);_0x2e5000[_0xfe04('0x3c')]=_[_0xfe04('0x3d')](_0x2e5000[_0xfe04('0x39')],_0x2e5000['query']);_0x135aa4[_0xfe04('0x3e')]=_[_0xfe04('0x3d')](_0x2e5000[_0xfe04('0x39')],qs[_0xfe04('0x3f')](_0xbbedbc[_0xfe04('0x3a')]['fields']));_0x135aa4[_0xfe04('0x3e')]=_0x135aa4['attributes'][_0xfe04('0x40')]?_0x135aa4['attributes']:_0x2e5000['model'];if(!_0xbbedbc[_0xfe04('0x3a')]['hasOwnProperty'](_0xfe04('0x41'))){_0x135aa4[_0xfe04('0x23')]=qs[_0xfe04('0x23')](_0xbbedbc['query'][_0xfe04('0x23')]);_0x135aa4[_0xfe04('0x21')]=qs[_0xfe04('0x21')](_0xbbedbc['query'][_0xfe04('0x21')]);}_0x135aa4[_0xfe04('0x42')]=qs[_0xfe04('0x43')](_0xbbedbc['query']['sort']);_0x135aa4[_0xfe04('0x44')]=qs[_0xfe04('0x3c')](_[_0xfe04('0x45')](_0xbbedbc[_0xfe04('0x3a')],_0x2e5000[_0xfe04('0x3c')]),_0x5e971d);if(_0xbbedbc[_0xfe04('0x3a')][_0xfe04('0x46')]){_0x135aa4[_0xfe04('0x44')]=_[_0xfe04('0x47')](_0x135aa4['where'],{'$or':_[_0xfe04('0x33')](_0x5e971d,function(_0x42851e){if(_0x42851e[_0xfe04('0x37')]!==_0xfe04('0x48')){var _0x2b7cb6={};_0x2b7cb6[_0x42851e[_0xfe04('0x30')]]={'$like':'%'+_0xbbedbc['query']['filter']+'%'};return _0x2b7cb6;}})});}_0x135aa4=_[_0xfe04('0x47')]({},_0x135aa4,_0xbbedbc[_0xfe04('0x49')]);var _0x261812={'where':_0x135aa4[_0xfe04('0x44')]};return db[_0xfe04('0x34')][_0xfe04('0x24')](_0x261812)[_0xfe04('0x2b')](function(_0xbce0ba){_0x365682[_0xfe04('0x24')]=_0xbce0ba;if(_0xbbedbc['query']['includeAll']){_0x135aa4[_0xfe04('0x4a')]=[{'all':!![]}];}return db[_0xfe04('0x34')][_0xfe04('0x4b')](_0x135aa4);})[_0xfe04('0x2b')](function(_0x236c5b){_0x365682['rows']=_0x236c5b;return _0x365682;})[_0xfe04('0x2b')](respondWithFilteredResult(_0x202287,_0x135aa4))[_0xfe04('0x4c')](handleError(_0x202287,null));};exports[_0xfe04('0x4d')]=function(_0x158530,_0x7746aa){var _0x5f8909={'raw':!![],'where':{'id':_0x158530[_0xfe04('0x4e')]['id']}},_0x48cd4c={};_0x48cd4c['model']=_['keys'](db[_0xfe04('0x34')][_0xfe04('0x35')]);_0x48cd4c[_0xfe04('0x3a')]=_['keys'](_0x158530[_0xfe04('0x3a')]);_0x48cd4c[_0xfe04('0x3c')]=_[_0xfe04('0x3d')](_0x48cd4c[_0xfe04('0x39')],_0x48cd4c[_0xfe04('0x3a')]);_0x5f8909['attributes']=_[_0xfe04('0x3d')](_0x48cd4c[_0xfe04('0x39')],qs[_0xfe04('0x3f')](_0x158530[_0xfe04('0x3a')][_0xfe04('0x3f')]));_0x5f8909[_0xfe04('0x3e')]=_0x5f8909[_0xfe04('0x3e')][_0xfe04('0x40')]?_0x5f8909[_0xfe04('0x3e')]:_0x48cd4c['model'];if(_0x158530[_0xfe04('0x3a')]['includeAll']){_0x5f8909[_0xfe04('0x4a')]=[{'all':!![]}];}_0x5f8909=_['merge']({},_0x5f8909,_0x158530[_0xfe04('0x49')]);return db[_0xfe04('0x34')]['find'](_0x5f8909)[_0xfe04('0x2b')](handleEntityNotFound(_0x7746aa,null))[_0xfe04('0x2b')](respondWithResult(_0x7746aa,null))[_0xfe04('0x4c')](handleError(_0x7746aa,null));};exports['create']=function(_0x620c40,_0x23bc52){return db['OpenchannelQueue']['create'](_0x620c40['body'],{})[_0xfe04('0x2b')](function(_0x15cdf0){var _0x4e007b=_0x620c40['user'][_0xfe04('0x4f')]({'plain':!![]});if(!_0x4e007b)throw new Error(_0xfe04('0x50'));if(_0x4e007b[_0xfe04('0x51')]==='user'){var _0x5dfe63=_0x15cdf0[_0xfe04('0x4f')]({'plain':!![]});var _0x4a24ac='OpenchannelQueues';return db[_0xfe04('0x52')]['find']({'where':{'name':_0x4a24ac,'userProfileId':_0x4e007b[_0xfe04('0x53')]},'raw':!![]})[_0xfe04('0x2b')](function(_0x930e09){if(_0x930e09&&_0x930e09[_0xfe04('0x54')]===0x0){return db['UserProfileResource']['create']({'name':_0x5dfe63['name'],'resourceId':_0x5dfe63['id'],'type':_0x930e09[_0xfe04('0x30')],'sectionId':_0x930e09['id']},{})['then'](function(){return _0x15cdf0;});}else{return _0x15cdf0;}})[_0xfe04('0x4c')](function(_0x40fc71){logger[_0xfe04('0x2e')](_0xfe04('0x55'),_0x40fc71);throw _0x40fc71;});}return _0x15cdf0;})['then'](respondWithResult(_0x23bc52,0xc9))[_0xfe04('0x4c')](handleError(_0x23bc52,null));};exports[_0xfe04('0x2a')]=function(_0x4911c5,_0x2c278e){if(_0x4911c5[_0xfe04('0x56')]['id']){delete _0x4911c5[_0xfe04('0x56')]['id'];}return db[_0xfe04('0x34')][_0xfe04('0x57')]({'where':{'id':_0x4911c5[_0xfe04('0x4e')]['id']}})['then'](handleEntityNotFound(_0x2c278e,null))[_0xfe04('0x2b')](saveUpdates(_0x4911c5[_0xfe04('0x56')],null))[_0xfe04('0x2b')](respondWithResult(_0x2c278e,null))[_0xfe04('0x4c')](handleError(_0x2c278e,null));};exports[_0xfe04('0x2c')]=function(_0x24d86e,_0x2df5ef){return db[_0xfe04('0x34')][_0xfe04('0x57')]({'where':{'id':_0x24d86e[_0xfe04('0x4e')]['id']}})[_0xfe04('0x2b')](handleEntityNotFound(_0x2df5ef,null))[_0xfe04('0x2b')](removeEntity(_0x2df5ef,null))[_0xfe04('0x4c')](handleError(_0x2df5ef,null));};exports['describe']=function(_0x20d5d9,_0x58a766){return db[_0xfe04('0x34')][_0xfe04('0x58')]()[_0xfe04('0x2b')](respondWithResult(_0x58a766,null))[_0xfe04('0x4c')](handleError(_0x58a766,null));};exports[_0xfe04('0x59')]=function(_0x3e6320,_0x47d137,_0x3da889){var _0x2308c3={'raw':!![],'where':{}},_0xebb78f={},_0x874901;return db[_0xfe04('0x34')]['findOne']({'where':{'id':_0x3e6320[_0xfe04('0x4e')]['id']}})['then'](handleEntityNotFound(_0x47d137,null))[_0xfe04('0x2b')](function(_0x32b278){if(_0x32b278){_0x874901=_0x32b278[_0xfe04('0x4f')]({'plain':!![]});_0xebb78f[_0xfe04('0x39')]=_[_0xfe04('0x3b')](db[_0xfe04('0x5a')][_0xfe04('0x35')]);_0xebb78f[_0xfe04('0x3a')]=_[_0xfe04('0x3b')](_0x3e6320[_0xfe04('0x3a')]);_0xebb78f['filters']=_[_0xfe04('0x3d')](_0xebb78f['model'],_0xebb78f[_0xfe04('0x3a')]);_0x2308c3['attributes']=_['intersection'](_0xebb78f[_0xfe04('0x39')],qs[_0xfe04('0x3f')](_0x3e6320['query']['fields']));_0x2308c3[_0xfe04('0x3e')]=_0x2308c3[_0xfe04('0x3e')][_0xfe04('0x40')]?_0x2308c3[_0xfe04('0x3e')]:_0xebb78f['model'];if(!_0x3e6320[_0xfe04('0x3a')][_0xfe04('0x5b')]('nolimit')){_0x2308c3[_0xfe04('0x23')]=qs[_0xfe04('0x23')](_0x3e6320['query'][_0xfe04('0x23')]);_0x2308c3['offset']=qs[_0xfe04('0x21')](_0x3e6320[_0xfe04('0x3a')]['offset']);}_0x2308c3['order']=qs[_0xfe04('0x43')](_0x3e6320[_0xfe04('0x3a')][_0xfe04('0x43')]);_0x2308c3['where']=qs['filters'](_['pick'](_0x3e6320['query'],_0xebb78f[_0xfe04('0x3c')]));_0x2308c3['where']['OpenchannelQueueId']=_0x32b278['id'];if(_0x3e6320[_0xfe04('0x3a')][_0xfe04('0x46')]){_0x2308c3[_0xfe04('0x44')]=_[_0xfe04('0x47')](_0x2308c3['where'],{'$or':_['map'](_0x2308c3[_0xfe04('0x3e')],function(_0x9661f1){var _0x561fd8={};_0x561fd8[_0x9661f1]={'$like':'%'+_0x3e6320[_0xfe04('0x3a')][_0xfe04('0x46')]+'%'};return _0x561fd8;})});}_0x2308c3=_[_0xfe04('0x47')]({},_0x2308c3,_0x3e6320[_0xfe04('0x49')]);return db['UserOpenchannelQueue'][_0xfe04('0x4b')](_0x2308c3);}})[_0xfe04('0x2b')](function(_0x3542b3){if(_0x3542b3){return db[_0xfe04('0x5c')][_0xfe04('0x5d')]({'where':{'id':_['map'](_0x3542b3,'UserId'),'role':'agent'},'attributes':['id',_0xfe04('0x30'),_0xfe04('0x5e'),_0xfe04('0x5f'),_0xfe04('0x60')]});}})[_0xfe04('0x2b')](function(_0x10e238){if(_0x10e238){return{'count':_0x10e238[_0xfe04('0x24')],'rows':_[_0xfe04('0x33')](_0x10e238[_0xfe04('0x61')],function(_0x3505b3){return{'membername':_0x3505b3[_0xfe04('0x30')],'UserId':_0x3505b3['id'],'queue_name':_0x874901['name'],'OpenchannelQueueId':_0x874901['id'],'interface':util[_0xfe04('0x62')](_0xfe04('0x63'),_0xfe04('0x64'),_0x3505b3[_0xfe04('0x30')]),'penalty':0x0,'paused':_0x3505b3[_0xfe04('0x5e')],'createdAt':_0x3505b3['createdAt'],'updatedAt':_0x3505b3[_0xfe04('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xfe04('0x2b')](respondWithFilteredResult(_0x47d137,_0x2308c3))[_0xfe04('0x4c')](handleError(_0x47d137,null));};exports[_0xfe04('0x65')]=function(_0x10735a,_0x52547d,_0x47b19c){var _0x162967={};var _0x1e9855={};var _0x175b8b;var _0x29d8d3;return db['OpenchannelQueue'][_0xfe04('0x66')]({'where':{'id':_0x10735a['params']['id']}})[_0xfe04('0x2b')](handleEntityNotFound(_0x52547d,null))[_0xfe04('0x2b')](function(_0x15fe06){if(_0x15fe06){_0x175b8b=_0x15fe06;_0x1e9855['model']=_['keys'](db[_0xfe04('0x67')][_0xfe04('0x35')]);_0x1e9855[_0xfe04('0x3a')]=_['keys'](_0x10735a[_0xfe04('0x3a')]);_0x1e9855[_0xfe04('0x3c')]=_['intersection'](_0x1e9855['model'],_0x1e9855[_0xfe04('0x3a')]);_0x162967[_0xfe04('0x3e')]=_[_0xfe04('0x3d')](_0x1e9855[_0xfe04('0x39')],qs[_0xfe04('0x3f')](_0x10735a[_0xfe04('0x3a')][_0xfe04('0x3f')]));_0x162967[_0xfe04('0x3e')]=_0x162967[_0xfe04('0x3e')][_0xfe04('0x40')]?_0x162967[_0xfe04('0x3e')]:_0x1e9855[_0xfe04('0x39')];_0x162967[_0xfe04('0x42')]=qs[_0xfe04('0x43')](_0x10735a[_0xfe04('0x3a')][_0xfe04('0x43')]);_0x162967['where']=qs['filters'](_[_0xfe04('0x45')](_0x10735a[_0xfe04('0x3a')],_0x1e9855['filters']));if(_0x10735a[_0xfe04('0x3a')][_0xfe04('0x46')]){_0x162967['where']=_[_0xfe04('0x47')](_0x162967[_0xfe04('0x44')],{'$or':_[_0xfe04('0x33')](_0x162967[_0xfe04('0x3e')],function(_0x23c59b){var _0x25a7e0={};_0x25a7e0[_0x23c59b]={'$like':'%'+_0x10735a[_0xfe04('0x3a')][_0xfe04('0x46')]+'%'};return _0x25a7e0;})});}_0x162967=_[_0xfe04('0x47')]({},_0x162967,_0x10735a[_0xfe04('0x49')]);return _0x175b8b[_0xfe04('0x65')](_0x162967);}})[_0xfe04('0x2b')](function(_0xf2b55f){if(_0xf2b55f){_0x29d8d3=_0xf2b55f[_0xfe04('0x40')];if(!_0x10735a[_0xfe04('0x3a')][_0xfe04('0x5b')](_0xfe04('0x41'))){_0x162967[_0xfe04('0x23')]=qs[_0xfe04('0x23')](_0x10735a['query']['limit']);_0x162967[_0xfe04('0x21')]=qs[_0xfe04('0x21')](_0x10735a[_0xfe04('0x3a')][_0xfe04('0x21')]);}return _0x175b8b[_0xfe04('0x65')](_0x162967);}})[_0xfe04('0x2b')](function(_0x15ec88){if(_0x15ec88){return _0x15ec88?{'count':_0x29d8d3,'rows':_0x15ec88}:null;}})[_0xfe04('0x2b')](respondWithResult(_0x52547d,null))[_0xfe04('0x4c')](handleError(_0x52547d,null));};exports[_0xfe04('0x68')]=function(_0x5b4810,_0x507859,_0x5c6944){var _0x168203=_0x5b4810[_0xfe04('0x56')][_0xfe04('0x69')];return db[_0xfe04('0x67')][_0xfe04('0x4b')]({'where':{'id':_0x168203},'attributes':['id'],'include':[{'model':db['User'],'as':_0xfe04('0x6a'),'attributes':['id','name',_0xfe04('0x6b'),_0xfe04('0x6c'),_0xfe04('0x6d')],'raw':!![]}]})['then'](function(_0x33f977){if(_0x33f977){var _0x523cb4=_[_0xfe04('0x6e')](_0x33f977,function(_0x4c2139){var _0x177c63=_0x4c2139['get']({'plain':!![]});return _0x177c63[_0xfe04('0x6a')];});return db[_0xfe04('0x34')][_0xfe04('0x57')]({'where':{'id':_0x5b4810['params']['id']}})[_0xfe04('0x2b')](function(_0x3354a4){return db[_0xfe04('0x6f')]['transaction'](function(_0x446634){return _0x3354a4['addTeams'](_0x168203,{'transaction':_0x446634})['then'](function(){return BPromise[_0xfe04('0x70')](_0x523cb4,function(_0x513417){return db[_0xfe04('0x5a')][_0xfe04('0x71')]({'where':{'UserId':_0x513417['id'],'OpenchannelQueueId':_0x5b4810[_0xfe04('0x4e')]['id']},'transaction':_0x446634});});})[_0xfe04('0x2b')](function(){_0x523cb4[_0xfe04('0x72')](function(_0x11fb72){socket['emit'](_0xfe04('0x73'),{'UserId':_0x11fb72['id'],'OpenchannelQueueId':_0x3354a4['id']});});});});});}})[_0xfe04('0x2b')](respondWithStatusCode(_0x507859,null))[_0xfe04('0x4c')](handleError(_0x507859,null));};exports[_0xfe04('0x74')]=function(_0x6f8ca4,_0x95be1a,_0x226b66){return db[_0xfe04('0x67')][_0xfe04('0x4b')]({'where':{'id':_0x6f8ca4['query'][_0xfe04('0x69')]},'attributes':['id'],'include':[{'model':db[_0xfe04('0x5c')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xfe04('0x2b')](handleEntityNotFound(_0x95be1a,null))[_0xfe04('0x2b')](function(_0x1942e6){var _0x1c3ac1=_[_0xfe04('0x33')](_0x1942e6,'id');var _0x2287d3=[];var _0x4360c9=[];var _0x26f40c=squel[_0xfe04('0x75')]();_0x26f40c[_0xfe04('0x76')]('tq.TeamId')[_0xfe04('0x77')]('team_has_openchannel_queues','tq')[_0xfe04('0x78')]('user_has_teams','ut',_0xfe04('0x79'))[_0xfe04('0x44')](_0xfe04('0x7a'),_0x6f8ca4['params']['id']);for(var _0x488e84=0x0;_0x488e84<_0x1942e6[_0xfe04('0x40')];_0x488e84+=0x1){let _0x812046=_0x1942e6[_0x488e84];for(var _0x1d91e4=0x0;_0x1d91e4<_0x812046['Agents'][_0xfe04('0x40')];_0x1d91e4+=0x1){let _0x367200=_0x812046[_0xfe04('0x6a')][_0x1d91e4];var _0x57775f=_0x26f40c[_0xfe04('0x7b')]();_0x57775f['where']('ut.UserId\x20=\x20?',_0x367200['id']);_0x4360c9[_0xfe04('0x7c')](db[_0xfe04('0x6f')][_0xfe04('0x3a')](_0x57775f[_0xfe04('0x7d')](),{'type':db[_0xfe04('0x6f')][_0xfe04('0x7e')][_0xfe04('0x7f')]})[_0xfe04('0x2b')](function(_0x44e5a2){if(_0x44e5a2[_0xfe04('0x40')]===0x1){return _0x367200['id'];}else{var _0x40f361=_['every'](_[_0xfe04('0x33')](_0x44e5a2,_0xfe04('0x80')),function(_0x4add22){return _[_0xfe04('0x81')](_0x1c3ac1,_0x4add22);});if(_0x40f361){return _0x367200['id'];}}}));}}return BPromise[_0xfe04('0x82')](_0x4360c9)[_0xfe04('0x2b')](function(_0x4a2645){_0x2287d3=_(_0x2287d3)[_0xfe04('0x83')](_0x4a2645)[_0xfe04('0x84')]()[_0xfe04('0x85')]();return db[_0xfe04('0x34')][_0xfe04('0x57')]({'where':{'id':_0x6f8ca4[_0xfe04('0x4e')]['id']}})[_0xfe04('0x2b')](function(_0x3b971d){return db['sequelize']['transaction'](function(_0x13f891){return _0x3b971d[_0xfe04('0x74')](_0x6f8ca4[_0xfe04('0x3a')][_0xfe04('0x69')],{'transaction':_0x13f891})[_0xfe04('0x2b')](function(){if(!_['isEmpty'](_0x2287d3)){return _0x3b971d[_0xfe04('0x86')](_0x2287d3,{'transaction':_0x13f891});}})[_0xfe04('0x2b')](function(){_0x2287d3[_0xfe04('0x72')](function(_0x352b69){socket[_0xfe04('0x87')](_0xfe04('0x88'),{'UserId':_0x352b69,'OpenchannelQueueId':_0x3b971d['id']});});});});});});})[_0xfe04('0x2b')](respondWithStatusCode(_0x95be1a,null))['catch'](handleError(_0x95be1a,null));};exports[_0xfe04('0x89')]=function(_0x18412c,_0x52d289,_0x184ada){return db[_0xfe04('0x34')][_0xfe04('0x57')]({'where':{'id':_0x18412c[_0xfe04('0x4e')]['id']}})[_0xfe04('0x2b')](handleEntityNotFound(_0x52d289,null))[_0xfe04('0x2b')](function(_0x1d04ba){if(_0x1d04ba){return _0x1d04ba[_0xfe04('0x89')](_0x18412c[_0xfe04('0x56')][_0xfe04('0x69')],_['omit'](_0x18412c[_0xfe04('0x56')],['ids','id'])||{})[_0xfe04('0x8a')](function(_0x4ce363){for(var _0x288f3d=0x0;_0x288f3d<_0x18412c[_0xfe04('0x56')]['ids']['length'];_0x288f3d+=0x1){socket[_0xfe04('0x87')](_0xfe04('0x73'),{'UserId':Number(_0x18412c['body'][_0xfe04('0x69')][_0x288f3d]),'OpenchannelQueueId':Number(_0x18412c[_0xfe04('0x4e')]['id'])});}return _0x4ce363;});}})['then'](respondWithResult(_0x52d289,null))[_0xfe04('0x4c')](handleError(_0x52d289,null));};exports[_0xfe04('0x86')]=function(_0x88b2b,_0xb8b668,_0x46b8be){return db['OpenchannelQueue'][_0xfe04('0x57')]({'where':{'id':_0x88b2b['params']['id']}})[_0xfe04('0x2b')](handleEntityNotFound(_0xb8b668,null))['then'](function(_0x13e432){if(_0x13e432){return _0x13e432[_0xfe04('0x86')](_0x88b2b[_0xfe04('0x3a')][_0xfe04('0x69')])['then'](function(){if(_[_0xfe04('0x8b')](_0x88b2b['query'][_0xfe04('0x69')])){for(var _0x5485a5=0x0;_0x5485a5<_0x88b2b['query'][_0xfe04('0x69')][_0xfe04('0x40')];_0x5485a5+=0x1){socket[_0xfe04('0x87')](_0xfe04('0x88'),{'UserId':Number(_0x88b2b[_0xfe04('0x3a')][_0xfe04('0x69')][_0x5485a5]),'OpenchannelQueueId':Number(_0x88b2b['params']['id'])});}}else{socket[_0xfe04('0x87')](_0xfe04('0x88'),{'UserId':Number(_0x88b2b[_0xfe04('0x3a')][_0xfe04('0x69')]),'OpenchannelQueueId':Number(_0x88b2b['params']['id'])});}});}})[_0xfe04('0x2b')](respondWithStatusCode(_0xb8b668,null))[_0xfe04('0x4c')](handleError(_0xb8b668,null));};exports['getAgents']=function(_0x16385d,_0x389879,_0x2b3e3d){var _0x1a3445={};var _0x483708={};var _0x43448c;var _0x3354aa;return db['OpenchannelQueue'][_0xfe04('0x66')]({'where':{'id':_0x16385d[_0xfe04('0x4e')]['id']}})['then'](handleEntityNotFound(_0x389879,null))[_0xfe04('0x2b')](function(_0x2ab384){if(_0x2ab384){_0x43448c=_0x2ab384;_0x483708[_0xfe04('0x39')]=_[_0xfe04('0x3b')](db[_0xfe04('0x5c')][_0xfe04('0x35')]);_0x483708[_0xfe04('0x3a')]=_[_0xfe04('0x3b')](_0x16385d['query']);_0x483708[_0xfe04('0x3c')]=_['intersection'](_0x483708[_0xfe04('0x39')],_0x483708['query']);_0x1a3445['attributes']=_[_0xfe04('0x3d')](_0x483708[_0xfe04('0x39')],qs[_0xfe04('0x3f')](_0x16385d['query'][_0xfe04('0x3f')]));_0x1a3445[_0xfe04('0x3e')]=_0x1a3445[_0xfe04('0x3e')][_0xfe04('0x40')]?_0x1a3445['attributes']:_0x483708[_0xfe04('0x39')];_0x1a3445[_0xfe04('0x42')]=qs['sort'](_0x16385d[_0xfe04('0x3a')]['sort']);_0x1a3445[_0xfe04('0x44')]=qs[_0xfe04('0x3c')](_[_0xfe04('0x45')](_0x16385d['query'],_0x483708['filters']));if(_0x16385d[_0xfe04('0x3a')][_0xfe04('0x46')]){_0x1a3445[_0xfe04('0x44')]=_[_0xfe04('0x47')](_0x1a3445[_0xfe04('0x44')],{'$or':_[_0xfe04('0x33')](_0x1a3445[_0xfe04('0x3e')],function(_0x47038b){var _0x2c7805={};_0x2c7805[_0x47038b]={'$like':'%'+_0x16385d['query'][_0xfe04('0x46')]+'%'};return _0x2c7805;})});}_0x1a3445=_['merge']({},_0x1a3445,_0x16385d[_0xfe04('0x49')]);return _0x43448c[_0xfe04('0x8c')](_0x1a3445);}})[_0xfe04('0x2b')](function(_0x176221){if(_0x176221){_0x3354aa=_0x176221['length'];if(!_0x16385d['query'][_0xfe04('0x5b')](_0xfe04('0x41'))){_0x1a3445['limit']=qs[_0xfe04('0x23')](_0x16385d[_0xfe04('0x3a')][_0xfe04('0x23')]);_0x1a3445[_0xfe04('0x21')]=qs[_0xfe04('0x21')](_0x16385d[_0xfe04('0x3a')][_0xfe04('0x21')]);}return _0x43448c[_0xfe04('0x8c')](_0x1a3445);}})[_0xfe04('0x2b')](function(_0x4b47ac){if(_0x4b47ac){return _0x4b47ac?{'count':_0x3354aa,'rows':_0x4b47ac}:null;}})[_0xfe04('0x2b')](respondWithResult(_0x389879,null))[_0xfe04('0x4c')](handleError(_0x389879,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index b1f3bba..76923ef 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 _0x67a3=['hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelQueue','setMaxListeners','save','remove','emit'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x67a3,0x1e3));var _0x367a=function(_0x3f54ce,_0x46f954){_0x3f54ce=_0x3f54ce-0x0;var _0x3ec189=_0x67a3[_0x3f54ce];return _0x3ec189;};'use strict';var EventEmitter=require(_0x367a('0x0'));var OpenchannelQueue=require(_0x367a('0x1'))['db'][_0x367a('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x367a('0x3')](0x0);var events={'afterCreate':_0x367a('0x4'),'afterUpdate':'update','afterDestroy':_0x367a('0x5')};function emitEvent(_0x804642){return function(_0x55c597,_0x1abc26,_0x5c2400){OpenchannelQueueEvents[_0x367a('0x6')](_0x804642+':'+_0x55c597['id'],_0x55c597);OpenchannelQueueEvents[_0x367a('0x6')](_0x804642,_0x55c597);_0x5c2400(null);};}for(var e in events){if(events[_0x367a('0x7')](e)){var event=events[e];OpenchannelQueue[_0x367a('0x8')](e,emitEvent(event));}}module[_0x367a('0x9')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x3f4c=['OpenchannelQueue','setMaxListeners','update','emit','hasOwnProperty','hook','../../mysqldb'];(function(_0x232fa2,_0x1ddde5){var _0x7edafd=function(_0x102919){while(--_0x102919){_0x232fa2['push'](_0x232fa2['shift']());}};_0x7edafd(++_0x1ddde5);}(_0x3f4c,0x148));var _0xc3f4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3f4c[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require(_0xc3f4('0x0'))['db'][_0xc3f4('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xc3f4('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc3f4('0x3'),'afterDestroy':'remove'};function emitEvent(_0x567ad3){return function(_0xfe9a98,_0x219374,_0x54a6db){OpenchannelQueueEvents[_0xc3f4('0x4')](_0x567ad3+':'+_0xfe9a98['id'],_0xfe9a98);OpenchannelQueueEvents['emit'](_0x567ad3,_0xfe9a98);_0x54a6db(null);};}for(var e in events){if(events[_0xc3f4('0x5')](e)){var event=events[e];OpenchannelQueue[_0xc3f4('0x6')](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 740ebb4..e2f5e2f 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 _0x6a4a=['api','moment','bluebird','request-promise','rimraf','OpenchannelQueue','openchannel_queues','lodash','util','../../config/logger'];(function(_0x497595,_0x33b32f){var _0x49e5ff=function(_0x1f0d3b){while(--_0x1f0d3b){_0x497595['push'](_0x497595['shift']());}};_0x49e5ff(++_0x33b32f);}(_0x6a4a,0x1e7));var _0xa6a4=function(_0x186376,_0x5d988a){_0x186376=_0x186376-0x0;var _0x2dbdd9=_0x6a4a[_0x186376];return _0x2dbdd9;};'use strict';var _=require(_0xa6a4('0x0'));var util=require(_0xa6a4('0x1'));var logger=require(_0xa6a4('0x2'))(_0xa6a4('0x3'));var moment=require(_0xa6a4('0x4'));var BPromise=require(_0xa6a4('0x5'));var rp=require(_0xa6a4('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa6a4('0x7'));var config=require('../../config/environment');var attributes=require('./openchannelQueue.attributes');module['exports']=function(_0x4b02e6,_0x2f37f9){return _0x4b02e6['define'](_0xa6a4('0x8'),attributes,{'tableName':_0xa6a4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3cf4=['moment','request-promise','path','./openchannelQueue.attributes','exports','define','lodash','../../config/logger','api'];(function(_0x1fd89e,_0x4987d5){var _0x5efd7a=function(_0x50a39e){while(--_0x50a39e){_0x1fd89e['push'](_0x1fd89e['shift']());}};_0x5efd7a(++_0x4987d5);}(_0x3cf4,0x1ec));var _0x43cf=function(_0x5597be,_0x987673){_0x5597be=_0x5597be-0x0;var _0x3c0997=_0x3cf4[_0x5597be];return _0x3c0997;};'use strict';var _=require(_0x43cf('0x0'));var util=require('util');var logger=require(_0x43cf('0x1'))(_0x43cf('0x2'));var moment=require(_0x43cf('0x3'));var BPromise=require('bluebird');var rp=require(_0x43cf('0x4'));var fs=require('fs');var path=require(_0x43cf('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x43cf('0x6'));module[_0x43cf('0x7')]=function(_0x1f6a31,_0x187de3){return _0x1f6a31[_0x43cf('0x8')]('OpenchannelQueue',attributes,{'tableName':'openchannel_queues','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 0d08c40..c860bc0 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 _0x2f7c=['../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','then','info','request\x20sent','debug','stringify','error','OpenchannelQueue,\x20%s,\x20%s','message','result','catch','GetOpenchannelQueue','options','where','attributes','limit','include','map','model','ShowOpenchannelQueue','OpenchannelQueue','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x4191bc,_0x3096c5){var _0x1ffd4e=function(_0x36faed){while(--_0x36faed){_0x4191bc['push'](_0x4191bc['shift']());}};_0x1ffd4e(++_0x3096c5);}(_0x2f7c,0x1d9));var _0xc2f7=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x2f7c[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0xc2f7('0x0'));var moment=require(_0xc2f7('0x1'));var BPromise=require(_0xc2f7('0x2'));var rs=require(_0xc2f7('0x3'));var fs=require('fs');var Redis=require(_0xc2f7('0x4'));var db=require(_0xc2f7('0x5'))['db'];var utils=require(_0xc2f7('0x6'));var logger=require(_0xc2f7('0x7'))(_0xc2f7('0x8'));var config=require(_0xc2f7('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xc2f7('0xa')][_0xc2f7('0xb')]({'port':0x232a});config[_0xc2f7('0xc')]=_[_0xc2f7('0xd')](config[_0xc2f7('0xc')],{'host':_0xc2f7('0xe'),'port':0x18eb});var socket=require(_0xc2f7('0xf'))(new Redis(config[_0xc2f7('0xc')]));require(_0xc2f7('0x10'))[_0xc2f7('0x11')](socket);function respondWithRpcPromise(_0x59bb02,_0xfeeff2,_0x163bd1){return new BPromise(function(_0x4ec2d3,_0x2a03b8){return client[_0xc2f7('0x12')](_0x59bb02,_0x163bd1)[_0xc2f7('0x13')](function(_0x52177e){logger[_0xc2f7('0x14')]('OpenchannelQueue,\x20%s,\x20%s',_0xfeeff2,_0xc2f7('0x15'));logger[_0xc2f7('0x16')]('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0xfeeff2,'request\x20sent',JSON[_0xc2f7('0x17')](_0x52177e));if(_0x52177e[_0xc2f7('0x18')]){if(_0x52177e[_0xc2f7('0x18')]['code']===0x1f4){logger['error'](_0xc2f7('0x19'),_0xfeeff2,_0x52177e[_0xc2f7('0x18')][_0xc2f7('0x1a')]);return _0x2a03b8(_0x52177e[_0xc2f7('0x18')][_0xc2f7('0x1a')]);}logger[_0xc2f7('0x18')](_0xc2f7('0x19'),_0xfeeff2,_0x52177e[_0xc2f7('0x18')][_0xc2f7('0x1a')]);return _0x4ec2d3(_0x52177e[_0xc2f7('0x18')][_0xc2f7('0x1a')]);}else{logger[_0xc2f7('0x14')]('OpenchannelQueue,\x20%s,\x20%s',_0xfeeff2,_0xc2f7('0x15'));_0x4ec2d3(_0x52177e[_0xc2f7('0x1b')][_0xc2f7('0x1a')]);}})[_0xc2f7('0x1c')](function(_0x4dec89){logger[_0xc2f7('0x18')](_0xc2f7('0x19'),_0xfeeff2,_0x4dec89);_0x2a03b8(_0x4dec89);});});}exports[_0xc2f7('0x1d')]=function(_0x172842){var _0x23749e=this;return new Promise(function(_0x92900,_0x2e26d0){return db['OpenchannelQueue']['findAll']({'raw':_0x172842[_0xc2f7('0x1e')]?_0x172842[_0xc2f7('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x172842[_0xc2f7('0x1e')]?_0x172842['options'][_0xc2f7('0x1f')]||null:null,'attributes':_0x172842['options']?_0x172842[_0xc2f7('0x1e')][_0xc2f7('0x20')]||null:null,'limit':_0x172842[_0xc2f7('0x1e')]?_0x172842['options'][_0xc2f7('0x21')]||null:null,'include':_0x172842[_0xc2f7('0x1e')]?_0x172842['options'][_0xc2f7('0x22')]?_[_0xc2f7('0x23')](_0x172842[_0xc2f7('0x1e')][_0xc2f7('0x22')],function(_0x5cfeb4){return{'model':db[_0x5cfeb4[_0xc2f7('0x24')]],'as':_0x5cfeb4['as'],'attributes':_0x5cfeb4[_0xc2f7('0x20')],'include':_0x5cfeb4[_0xc2f7('0x22')]?_[_0xc2f7('0x23')](_0x5cfeb4[_0xc2f7('0x22')],function(_0x7dd4fd){return{'model':db[_0x7dd4fd['model']],'as':_0x7dd4fd['as'],'attributes':_0x7dd4fd[_0xc2f7('0x20')],'include':_0x7dd4fd[_0xc2f7('0x22')]?_[_0xc2f7('0x23')](_0x7dd4fd['include'],function(_0x4a9075){return{'model':db[_0x4a9075[_0xc2f7('0x24')]],'as':_0x4a9075['as'],'attributes':_0x4a9075[_0xc2f7('0x20')]};}):[]};}):[]};}):[]:[]})[_0xc2f7('0x13')](function(_0x2693ad){logger[_0xc2f7('0x14')](_0xc2f7('0x1d'),_0x172842);logger[_0xc2f7('0x16')](_0xc2f7('0x1d'),_0x172842,JSON['stringify'](_0x2693ad));_0x92900(_0x2693ad);})[_0xc2f7('0x1c')](function(_0x242ae3){logger[_0xc2f7('0x18')](_0xc2f7('0x1d'),_0x242ae3[_0xc2f7('0x1a')],_0x172842);_0x2e26d0(_0x23749e[_0xc2f7('0x18')](0x1f4,_0x242ae3[_0xc2f7('0x1a')]));});});};exports[_0xc2f7('0x25')]=function(_0x4c97dd){var _0x4ccce3=this;return new Promise(function(_0x2dc125,_0x14c97b){return db[_0xc2f7('0x26')][_0xc2f7('0x27')]({'raw':_0x4c97dd[_0xc2f7('0x1e')]?_0x4c97dd[_0xc2f7('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x4c97dd['options']?_0x4c97dd[_0xc2f7('0x1e')][_0xc2f7('0x1f')]||null:null,'attributes':_0x4c97dd[_0xc2f7('0x1e')]?_0x4c97dd[_0xc2f7('0x1e')]['attributes']||null:null,'include':_0x4c97dd[_0xc2f7('0x1e')]?_0x4c97dd['options']['include']?_[_0xc2f7('0x23')](_0x4c97dd['options'][_0xc2f7('0x22')],function(_0x59de1f){return{'model':db[_0x59de1f[_0xc2f7('0x24')]],'as':_0x59de1f['as'],'attributes':_0x59de1f[_0xc2f7('0x20')],'include':_0x59de1f[_0xc2f7('0x22')]?_[_0xc2f7('0x23')](_0x59de1f[_0xc2f7('0x22')],function(_0x57a851){return{'model':db[_0x57a851[_0xc2f7('0x24')]],'as':_0x57a851['as'],'attributes':_0x57a851['attributes'],'include':_0x57a851[_0xc2f7('0x22')]?_[_0xc2f7('0x23')](_0x57a851[_0xc2f7('0x22')],function(_0x16e27d){return{'model':db[_0x16e27d[_0xc2f7('0x24')]],'as':_0x16e27d['as'],'attributes':_0x16e27d['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x35e4c5){logger['info'](_0xc2f7('0x25'),_0x4c97dd);logger['debug'](_0xc2f7('0x25'),_0x4c97dd,JSON['stringify'](_0x35e4c5));_0x2dc125(_0x35e4c5);})[_0xc2f7('0x1c')](function(_0x1997f4){logger[_0xc2f7('0x18')](_0xc2f7('0x25'),_0x1997f4['message'],_0x4c97dd);_0x14c97b(_0x4ccce3['error'](0x1f4,_0x1997f4[_0xc2f7('0x1a')]));});});}; \ No newline at end of file +var _0xd95e=['result','catch','GetOpenchannelQueue','OpenchannelQueue','options','raw','attributes','limit','map','include','model','then','ShowOpenchannelQueue','find','where','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','OpenchannelQueue,\x20%s,\x20%s','message','info'];(function(_0x10a901,_0x499281){var _0x466be3=function(_0x19a1d1){while(--_0x19a1d1){_0x10a901['push'](_0x10a901['shift']());}};_0x466be3(++_0x499281);}(_0xd95e,0x8a));var _0xed95=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd95e[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0xed95('0x0'));var moment=require(_0xed95('0x1'));var BPromise=require('bluebird');var rs=require(_0xed95('0x2'));var fs=require('fs');var Redis=require(_0xed95('0x3'));var db=require(_0xed95('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xed95('0x5'))(_0xed95('0x6'));var config=require(_0xed95('0x7'));var jayson=require(_0xed95('0x8'));var client=jayson[_0xed95('0x9')][_0xed95('0xa')]({'port':0x232a});config[_0xed95('0xb')]=_[_0xed95('0xc')](config[_0xed95('0xb')],{'host':_0xed95('0xd'),'port':0x18eb});var socket=require(_0xed95('0xe'))(new Redis(config[_0xed95('0xb')]));require(_0xed95('0xf'))[_0xed95('0x10')](socket);function respondWithRpcPromise(_0x8578c8,_0x235dac,_0x1a3542){return new BPromise(function(_0x59f7c1,_0x491e87){return client[_0xed95('0x11')](_0x8578c8,_0x1a3542)['then'](function(_0xc21e6){logger['info']('OpenchannelQueue,\x20%s,\x20%s',_0x235dac,_0xed95('0x12'));logger[_0xed95('0x13')](_0xed95('0x14'),_0x235dac,_0xed95('0x12'),JSON[_0xed95('0x15')](_0xc21e6));if(_0xc21e6[_0xed95('0x16')]){if(_0xc21e6[_0xed95('0x16')]['code']===0x1f4){logger['error'](_0xed95('0x17'),_0x235dac,_0xc21e6[_0xed95('0x16')][_0xed95('0x18')]);return _0x491e87(_0xc21e6[_0xed95('0x16')][_0xed95('0x18')]);}logger[_0xed95('0x16')]('OpenchannelQueue,\x20%s,\x20%s',_0x235dac,_0xc21e6[_0xed95('0x16')]['message']);return _0x59f7c1(_0xc21e6['error'][_0xed95('0x18')]);}else{logger[_0xed95('0x19')]('OpenchannelQueue,\x20%s,\x20%s',_0x235dac,_0xed95('0x12'));_0x59f7c1(_0xc21e6[_0xed95('0x1a')]['message']);}})[_0xed95('0x1b')](function(_0x27b070){logger[_0xed95('0x16')](_0xed95('0x17'),_0x235dac,_0x27b070);_0x491e87(_0x27b070);});});}exports[_0xed95('0x1c')]=function(_0x1b7568){var _0x5605b6=this;return new Promise(function(_0x354fa3,_0x2f760b){return db[_0xed95('0x1d')]['findAll']({'raw':_0x1b7568[_0xed95('0x1e')]?_0x1b7568[_0xed95('0x1e')][_0xed95('0x1f')]===undefined?!![]:![]:!![],'where':_0x1b7568[_0xed95('0x1e')]?_0x1b7568[_0xed95('0x1e')]['where']||null:null,'attributes':_0x1b7568['options']?_0x1b7568[_0xed95('0x1e')][_0xed95('0x20')]||null:null,'limit':_0x1b7568['options']?_0x1b7568[_0xed95('0x1e')][_0xed95('0x21')]||null:null,'include':_0x1b7568[_0xed95('0x1e')]?_0x1b7568[_0xed95('0x1e')]['include']?_[_0xed95('0x22')](_0x1b7568[_0xed95('0x1e')][_0xed95('0x23')],function(_0x62bba2){return{'model':db[_0x62bba2[_0xed95('0x24')]],'as':_0x62bba2['as'],'attributes':_0x62bba2[_0xed95('0x20')],'include':_0x62bba2['include']?_[_0xed95('0x22')](_0x62bba2['include'],function(_0x110720){return{'model':db[_0x110720['model']],'as':_0x110720['as'],'attributes':_0x110720[_0xed95('0x20')],'include':_0x110720['include']?_[_0xed95('0x22')](_0x110720[_0xed95('0x23')],function(_0x518200){return{'model':db[_0x518200[_0xed95('0x24')]],'as':_0x518200['as'],'attributes':_0x518200['attributes']};}):[]};}):[]};}):[]:[]})[_0xed95('0x25')](function(_0xc75d39){logger[_0xed95('0x19')](_0xed95('0x1c'),_0x1b7568);logger[_0xed95('0x13')](_0xed95('0x1c'),_0x1b7568,JSON[_0xed95('0x15')](_0xc75d39));_0x354fa3(_0xc75d39);})['catch'](function(_0x327b40){logger[_0xed95('0x16')](_0xed95('0x1c'),_0x327b40[_0xed95('0x18')],_0x1b7568);_0x2f760b(_0x5605b6['error'](0x1f4,_0x327b40[_0xed95('0x18')]));});});};exports[_0xed95('0x26')]=function(_0x2f973d){var _0x2ce926=this;return new Promise(function(_0x2da12d,_0x1a69e3){return db[_0xed95('0x1d')][_0xed95('0x27')]({'raw':_0x2f973d['options']?_0x2f973d[_0xed95('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x2f973d[_0xed95('0x1e')]?_0x2f973d[_0xed95('0x1e')][_0xed95('0x28')]||null:null,'attributes':_0x2f973d[_0xed95('0x1e')]?_0x2f973d[_0xed95('0x1e')][_0xed95('0x20')]||null:null,'include':_0x2f973d[_0xed95('0x1e')]?_0x2f973d['options'][_0xed95('0x23')]?_['map'](_0x2f973d[_0xed95('0x1e')][_0xed95('0x23')],function(_0x4a071c){return{'model':db[_0x4a071c[_0xed95('0x24')]],'as':_0x4a071c['as'],'attributes':_0x4a071c[_0xed95('0x20')],'include':_0x4a071c[_0xed95('0x23')]?_[_0xed95('0x22')](_0x4a071c[_0xed95('0x23')],function(_0x5e49a7){return{'model':db[_0x5e49a7[_0xed95('0x24')]],'as':_0x5e49a7['as'],'attributes':_0x5e49a7[_0xed95('0x20')],'include':_0x5e49a7[_0xed95('0x23')]?_[_0xed95('0x22')](_0x5e49a7['include'],function(_0x1135bc){return{'model':db[_0x1135bc[_0xed95('0x24')]],'as':_0x1135bc['as'],'attributes':_0x1135bc[_0xed95('0x20')]};}):[]};}):[]};}):[]:[]})[_0xed95('0x25')](function(_0x17de8d){logger['info'](_0xed95('0x26'),_0x2f973d);logger[_0xed95('0x13')](_0xed95('0x26'),_0x2f973d,JSON[_0xed95('0x15')](_0x17de8d));_0x2da12d(_0x17de8d);})[_0xed95('0x1b')](function(_0x52ae20){logger[_0xed95('0x16')](_0xed95('0x26'),_0x52ae20[_0xed95('0x18')],_0x2f973d);_0x1a69e3(_0x2ce926[_0xed95('0x16')](0x1f4,_0x52ae20['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 1f04ad5..c2cf736 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 _0xb597=['register','length','save','update','emit','removeListener'];(function(_0x170dac,_0xae92ca){var _0x50ecaf=function(_0x610600){while(--_0x610600){_0x170dac['push'](_0x170dac['shift']());}};_0x50ecaf(++_0xae92ca);}(_0xb597,0x92));var _0x7b59=function(_0x4d9d19,_0x512dae){_0x4d9d19=_0x4d9d19-0x0;var _0x2695bb=_0xb597[_0x4d9d19];return _0x2695bb;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=[_0x7b59('0x0'),'remove',_0x7b59('0x1')];function createListener(_0x41c96c,_0x413ff8){return function(_0x2e8356){_0x413ff8[_0x7b59('0x2')](_0x41c96c,_0x2e8356);};}function removeListener(_0x76b421,_0xdb9b42){return function(){OpenchannelQueueEvents[_0x7b59('0x3')](_0x76b421,_0xdb9b42);};}exports[_0x7b59('0x4')]=function(_0x53dd70){for(var _0x5c9c72=0x0,_0x18f231=events[_0x7b59('0x5')];_0x5c9c72<_0x18f231;_0x5c9c72++){var _0x282b95=events[_0x5c9c72];var _0x88d6e3=createListener('openchannelQueue:'+_0x282b95,_0x53dd70);OpenchannelQueueEvents['on'](_0x282b95,_0x88d6e3);}}; \ No newline at end of file +var _0x5fae=['removeListener','register','openchannelQueue:','./openchannelQueue.events','remove','update','emit'];(function(_0x5d57ce,_0x461e8b){var _0x5960e0=function(_0x8d7bdd){while(--_0x8d7bdd){_0x5d57ce['push'](_0x5d57ce['shift']());}};_0x5960e0(++_0x461e8b);}(_0x5fae,0x192));var _0xe5fa=function(_0x327e75,_0x412461){_0x327e75=_0x327e75-0x0;var _0x2d6ff9=_0x5fae[_0x327e75];return _0x2d6ff9;};'use strict';var OpenchannelQueueEvents=require(_0xe5fa('0x0'));var events=['save',_0xe5fa('0x1'),_0xe5fa('0x2')];function createListener(_0x36f91c,_0x186a43){return function(_0x4255d7){_0x186a43[_0xe5fa('0x3')](_0x36f91c,_0x4255d7);};}function removeListener(_0x1f8df5,_0x10e775){return function(){OpenchannelQueueEvents[_0xe5fa('0x4')](_0x1f8df5,_0x10e775);};}exports[_0xe5fa('0x5')]=function(_0x516521){for(var _0x405d2b=0x0,_0x1509ce=events['length'];_0x405d2b<_0x1509ce;_0x405d2b++){var _0x2bfc2d=events[_0x405d2b];var _0x239cbf=createListener(_0xe5fa('0x6')+_0x2bfc2d,_0x516521);OpenchannelQueueEvents['on'](_0x2bfc2d,_0x239cbf);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 1d8d177..e7735fc 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 _0x3963=['fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelQueueReport.controller','get','index','isAuthenticated','describe','/:id','show','create','update','delete','destroy','exports','multer','path','connect-timeout','express','Router'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3963,0xff));var _0x3396=function(_0xaa6a4,_0x64b067){_0xaa6a4=_0xaa6a4-0x0;var _0xdc31a4=_0x3963[_0xaa6a4];return _0xdc31a4;};'use strict';var multer=require(_0x3396('0x0'));var util=require('util');var path=require(_0x3396('0x1'));var timeout=require(_0x3396('0x2'));var express=require(_0x3396('0x3'));var router=express[_0x3396('0x4')]();var fs_extra=require(_0x3396('0x5'));var auth=require(_0x3396('0x6'));var interaction=require(_0x3396('0x7'));var config=require('../../config/environment');var controller=require(_0x3396('0x8'));router[_0x3396('0x9')]('/',auth['isAuthenticated'](),controller[_0x3396('0xa')]);router[_0x3396('0x9')]('/describe',auth[_0x3396('0xb')](),controller[_0x3396('0xc')]);router[_0x3396('0x9')](_0x3396('0xd'),auth['isAuthenticated'](),controller[_0x3396('0xe')]);router['post']('/',auth[_0x3396('0xb')](),controller[_0x3396('0xf')]);router['put'](_0x3396('0xd'),auth[_0x3396('0xb')](),controller[_0x3396('0x10')]);router[_0x3396('0x11')](_0x3396('0xd'),auth['isAuthenticated'](),controller[_0x3396('0x12')]);module[_0x3396('0x13')]=router; \ No newline at end of file +var _0x3aa3=['show','create','delete','destroy','exports','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x4005fe,_0x1fc3c1){var _0x50022d=function(_0x2ce718){while(--_0x2ce718){_0x4005fe['push'](_0x4005fe['shift']());}};_0x50022d(++_0x1fc3c1);}(_0x3aa3,0x17f));var _0x33aa=function(_0x28b0a1,_0x99bd0a){_0x28b0a1=_0x28b0a1-0x0;var _0x21470c=_0x3aa3[_0x28b0a1];return _0x21470c;};'use strict';var multer=require('multer');var util=require(_0x33aa('0x0'));var path=require(_0x33aa('0x1'));var timeout=require('connect-timeout');var express=require(_0x33aa('0x2'));var router=express['Router']();var fs_extra=require(_0x33aa('0x3'));var auth=require(_0x33aa('0x4'));var interaction=require(_0x33aa('0x5'));var config=require('../../config/environment');var controller=require(_0x33aa('0x6'));router[_0x33aa('0x7')]('/',auth[_0x33aa('0x8')](),controller[_0x33aa('0x9')]);router[_0x33aa('0x7')](_0x33aa('0xa'),auth[_0x33aa('0x8')](),controller[_0x33aa('0xb')]);router[_0x33aa('0x7')](_0x33aa('0xc'),auth[_0x33aa('0x8')](),controller[_0x33aa('0xd')]);router['post']('/',auth[_0x33aa('0x8')](),controller[_0x33aa('0xe')]);router['put']('/:id',auth[_0x33aa('0x8')](),controller['update']);router[_0x33aa('0xf')](_0x33aa('0xc'),auth[_0x33aa('0x8')](),controller[_0x33aa('0x10')]);module[_0x33aa('0x11')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index cfdcaf2..b221adc 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 _0xf2cc=['moment','STRING','DATE'];(function(_0x1ad984,_0x562b28){var _0x40bc4c=function(_0x5c0a06){while(--_0x5c0a06){_0x1ad984['push'](_0x1ad984['shift']());}};_0x40bc4c(++_0x562b28);}(_0xf2cc,0x186));var _0xcf2c=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xf2cc[_0x47a7d0];return _0xb9bd08;};'use strict';var moment=require(_0xcf2c('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xcf2c('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0xcf2c('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xcf2c('0x2')]},'acceptAt':{'type':Sequelize[_0xcf2c('0x2')]},'exitAt':{'type':Sequelize[_0xcf2c('0x2')]},'reason':{'type':Sequelize[_0xcf2c('0x1')]}}; \ No newline at end of file +var _0x680e=['STRING','DATE','moment'];(function(_0x3e1740,_0x3a451c){var _0x587f5c=function(_0x1a434c){while(--_0x1a434c){_0x3e1740['push'](_0x3e1740['shift']());}};_0x587f5c(++_0x3a451c);}(_0x680e,0x170));var _0xe680=function(_0x1db3d4,_0x5a89f1){_0x1db3d4=_0x1db3d4-0x0;var _0x440622=_0x680e[_0x1db3d4];return _0x440622;};'use strict';var moment=require(_0xe680('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xe680('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0xe680('0x1')]},'joinAt':{'type':Sequelize[_0xe680('0x2')]},'leaveAt':{'type':Sequelize[_0xe680('0x2')]},'acceptAt':{'type':Sequelize[_0xe680('0x2')]},'exitAt':{'type':Sequelize[_0xe680('0x2')]},'reason':{'type':Sequelize[_0xe680('0x1')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index d00a900..0a468ff 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 _0xb606=['query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','options','catch','show','rawAttributes','length','includeAll','include','find','create','body','update','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','status','end','json','offset','limit','undefined','count','set','apply','save','then','destroy','sendStatus','error','name','send','map','OpenchannelQueueReport','fieldName','model'];(function(_0x5381cd,_0x10b636){var _0x463491=function(_0x2b5352){while(--_0x2b5352){_0x5381cd['push'](_0x5381cd['shift']());}};_0x463491(++_0x10b636);}(_0xb606,0x133));var _0x6b60=function(_0x174a72,_0x46034c){_0x174a72=_0x174a72-0x0;var _0x32cecd=_0xb606[_0x174a72];return _0x32cecd;};'use strict';var emlformat=require(_0x6b60('0x0'));var rimraf=require(_0x6b60('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6b60('0x2'));var rp=require(_0x6b60('0x3'));var moment=require(_0x6b60('0x4'));var BPromise=require(_0x6b60('0x5'));var Mustache=require(_0x6b60('0x6'));var util=require(_0x6b60('0x7'));var path=require(_0x6b60('0x8'));var sox=require(_0x6b60('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6b60('0xa'));var squel=require(_0x6b60('0xb'));var crypto=require(_0x6b60('0xc'));var jsforce=require(_0x6b60('0xd'));var deskjs=require(_0x6b60('0xe'));var toCsv=require(_0x6b60('0xf'));var querystring=require(_0x6b60('0x10'));var Papa=require(_0x6b60('0x11'));var Redis=require('ioredis');var authService=require(_0x6b60('0x12'));var qs=require(_0x6b60('0x13'));var as=require(_0x6b60('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6b60('0x15'));var utils=require('../../config/utils');var config=require(_0x6b60('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5cfe5d,_0x437c86){_0x437c86=_0x437c86||0xcc;return function(_0x4c1b06){if(_0x4c1b06){return _0x5cfe5d['sendStatus'](_0x437c86);}return _0x5cfe5d[_0x6b60('0x17')](_0x437c86)[_0x6b60('0x18')]();};}function respondWithResult(_0x433cbf,_0xa78de8){_0xa78de8=_0xa78de8||0xc8;return function(_0x27c046){if(_0x27c046){return _0x433cbf[_0x6b60('0x17')](_0xa78de8)[_0x6b60('0x19')](_0x27c046);}};}function respondWithFilteredResult(_0x29be28,_0x55b28a){return function(_0x32fc22){if(_0x32fc22){var _0x1f48fa=typeof _0x55b28a[_0x6b60('0x1a')]==='undefined'&&typeof _0x55b28a[_0x6b60('0x1b')]===_0x6b60('0x1c');var _0x759550=_0x32fc22['count'];var _0x4bd366=_0x1f48fa?0x0:_0x55b28a[_0x6b60('0x1a')];var _0x488bda=_0x1f48fa?_0x32fc22[_0x6b60('0x1d')]:_0x55b28a['offset']+_0x55b28a[_0x6b60('0x1b')];var _0x4c96d2;if(_0x488bda>=_0x759550){_0x488bda=_0x759550;_0x4c96d2=0xc8;}else{_0x4c96d2=0xce;}_0x29be28[_0x6b60('0x17')](_0x4c96d2);return _0x29be28[_0x6b60('0x1e')]('Content-Range',_0x4bd366+'-'+_0x488bda+'/'+_0x759550)[_0x6b60('0x19')](_0x32fc22);}return null;};}function patchUpdates(_0x16286a){return function(_0x1a1150){try{jsonpatch[_0x6b60('0x1f')](_0x1a1150,_0x16286a,!![]);}catch(_0x8ffc31){return BPromise['reject'](_0x8ffc31);}return _0x1a1150[_0x6b60('0x20')]();};}function saveUpdates(_0x56058f,_0xb794bd){return function(_0x104e1c){if(_0x104e1c){return _0x104e1c['update'](_0x56058f)[_0x6b60('0x21')](function(_0x41d900){return _0x41d900;});}return null;};}function removeEntity(_0x5bbf29,_0x2e0d2c){return function(_0x46631c){if(_0x46631c){return _0x46631c[_0x6b60('0x22')]()[_0x6b60('0x21')](function(){_0x5bbf29['status'](0xcc)[_0x6b60('0x18')]();});}};}function handleEntityNotFound(_0x45a113,_0x2a774){return function(_0x3d3024){if(!_0x3d3024){_0x45a113[_0x6b60('0x23')](0x194);}return _0x3d3024;};}function handleError(_0x1d8e49,_0x11feea){_0x11feea=_0x11feea||0x1f4;return function(_0x35435f){logger[_0x6b60('0x24')](_0x35435f['stack']);if(_0x35435f[_0x6b60('0x25')]){delete _0x35435f[_0x6b60('0x25')];}_0x1d8e49[_0x6b60('0x17')](_0x11feea)[_0x6b60('0x26')](_0x35435f);};}exports['index']=function(_0x489491,_0x7d3083){var _0x213293={},_0x21ef5c={},_0x5966a6={'count':0x0,'rows':[]};var _0x72197=_[_0x6b60('0x27')](db[_0x6b60('0x28')]['rawAttributes'],function(_0x4c0ae7){return{'name':_0x4c0ae7[_0x6b60('0x29')],'type':_0x4c0ae7['type']['key']};});_0x21ef5c[_0x6b60('0x2a')]=_['map'](_0x72197,_0x6b60('0x25'));_0x21ef5c[_0x6b60('0x2b')]=_[_0x6b60('0x2c')](_0x489491['query']);_0x21ef5c[_0x6b60('0x2d')]=_[_0x6b60('0x2e')](_0x21ef5c[_0x6b60('0x2a')],_0x21ef5c[_0x6b60('0x2b')]);_0x213293[_0x6b60('0x2f')]=_[_0x6b60('0x2e')](_0x21ef5c[_0x6b60('0x2a')],qs[_0x6b60('0x30')](_0x489491['query'][_0x6b60('0x30')]));_0x213293[_0x6b60('0x2f')]=_0x213293['attributes']['length']?_0x213293[_0x6b60('0x2f')]:_0x21ef5c[_0x6b60('0x2a')];if(!_0x489491[_0x6b60('0x2b')][_0x6b60('0x31')](_0x6b60('0x32'))){_0x213293[_0x6b60('0x1b')]=qs[_0x6b60('0x1b')](_0x489491['query']['limit']);_0x213293[_0x6b60('0x1a')]=qs[_0x6b60('0x1a')](_0x489491[_0x6b60('0x2b')]['offset']);}_0x213293[_0x6b60('0x33')]=qs[_0x6b60('0x34')](_0x489491[_0x6b60('0x2b')][_0x6b60('0x34')]);_0x213293[_0x6b60('0x35')]=qs[_0x6b60('0x2d')](_['pick'](_0x489491[_0x6b60('0x2b')],_0x21ef5c[_0x6b60('0x2d')]),_0x72197);if(_0x489491[_0x6b60('0x2b')][_0x6b60('0x36')]){_0x213293['where']=_[_0x6b60('0x37')](_0x213293[_0x6b60('0x35')],{'$or':_[_0x6b60('0x27')](_0x72197,function(_0x39d493){if(_0x39d493[_0x6b60('0x38')]!=='VIRTUAL'){var _0x35dda5={};_0x35dda5[_0x39d493[_0x6b60('0x25')]]={'$like':'%'+_0x489491[_0x6b60('0x2b')][_0x6b60('0x36')]+'%'};return _0x35dda5;}})});}_0x213293=_[_0x6b60('0x37')]({},_0x213293,_0x489491[_0x6b60('0x39')]);var _0x38049d={'where':_0x213293[_0x6b60('0x35')]};return db['OpenchannelQueueReport'][_0x6b60('0x1d')](_0x38049d)[_0x6b60('0x21')](function(_0x1ee793){_0x5966a6['count']=_0x1ee793;if(_0x489491['query']['includeAll']){_0x213293['include']=[{'all':!![]}];}return db[_0x6b60('0x28')]['findAll'](_0x213293);})[_0x6b60('0x21')](function(_0x45ad60){_0x5966a6['rows']=_0x45ad60;return _0x5966a6;})[_0x6b60('0x21')](respondWithFilteredResult(_0x7d3083,_0x213293))[_0x6b60('0x3a')](handleError(_0x7d3083,null));};exports[_0x6b60('0x3b')]=function(_0x37169c,_0x1044dc){var _0x57a30c={'raw':!![],'where':{'id':_0x37169c['params']['id']}},_0x403f7e={};_0x403f7e['model']=_[_0x6b60('0x2c')](db['OpenchannelQueueReport'][_0x6b60('0x3c')]);_0x403f7e[_0x6b60('0x2b')]=_[_0x6b60('0x2c')](_0x37169c['query']);_0x403f7e[_0x6b60('0x2d')]=_[_0x6b60('0x2e')](_0x403f7e['model'],_0x403f7e[_0x6b60('0x2b')]);_0x57a30c[_0x6b60('0x2f')]=_[_0x6b60('0x2e')](_0x403f7e['model'],qs[_0x6b60('0x30')](_0x37169c[_0x6b60('0x2b')][_0x6b60('0x30')]));_0x57a30c['attributes']=_0x57a30c['attributes'][_0x6b60('0x3d')]?_0x57a30c['attributes']:_0x403f7e[_0x6b60('0x2a')];if(_0x37169c[_0x6b60('0x2b')][_0x6b60('0x3e')]){_0x57a30c[_0x6b60('0x3f')]=[{'all':!![]}];}_0x57a30c=_[_0x6b60('0x37')]({},_0x57a30c,_0x37169c['options']);return db[_0x6b60('0x28')][_0x6b60('0x40')](_0x57a30c)[_0x6b60('0x21')](handleEntityNotFound(_0x1044dc,null))['then'](respondWithResult(_0x1044dc,null))[_0x6b60('0x3a')](handleError(_0x1044dc,null));};exports[_0x6b60('0x41')]=function(_0x3a483f,_0x49da61){return db[_0x6b60('0x28')]['create'](_0x3a483f[_0x6b60('0x42')],{})[_0x6b60('0x21')](respondWithResult(_0x49da61,0xc9))[_0x6b60('0x3a')](handleError(_0x49da61,null));};exports[_0x6b60('0x43')]=function(_0x34ed2c,_0x37cf4b){if(_0x34ed2c[_0x6b60('0x42')]['id']){delete _0x34ed2c[_0x6b60('0x42')]['id'];}return db['OpenchannelQueueReport'][_0x6b60('0x40')]({'where':{'id':_0x34ed2c[_0x6b60('0x44')]['id']}})[_0x6b60('0x21')](handleEntityNotFound(_0x37cf4b,null))[_0x6b60('0x21')](saveUpdates(_0x34ed2c[_0x6b60('0x42')],null))[_0x6b60('0x21')](respondWithResult(_0x37cf4b,null))['catch'](handleError(_0x37cf4b,null));};exports['destroy']=function(_0xb906ae,_0x14adde){return db[_0x6b60('0x28')]['find']({'where':{'id':_0xb906ae[_0x6b60('0x44')]['id']}})[_0x6b60('0x21')](handleEntityNotFound(_0x14adde,null))[_0x6b60('0x21')](removeEntity(_0x14adde,null))[_0x6b60('0x3a')](handleError(_0x14adde,null));};exports['describe']=function(_0x2e818a,_0x30ef0f){return db[_0x6b60('0x28')][_0x6b60('0x45')]()[_0x6b60('0x21')](respondWithResult(_0x30ef0f,null))[_0x6b60('0x3a')](handleError(_0x30ef0f,null));}; \ No newline at end of file +var _0xb795=['intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','create','body','find','destroy','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','count','limit','set','apply','reject','update','then','error','stack','name','send','index','OpenchannelQueueReport','rawAttributes','fieldName','type','model','map','query','keys','filters'];(function(_0x2e6b12,_0x2030c4){var _0x3bc76b=function(_0x47d041){while(--_0x47d041){_0x2e6b12['push'](_0x2e6b12['shift']());}};_0x3bc76b(++_0x2030c4);}(_0xb795,0xad));var _0x5b79=function(_0x56aa6c,_0x360d1c){_0x56aa6c=_0x56aa6c-0x0;var _0x580b72=_0xb795[_0x56aa6c];return _0x580b72;};'use strict';var emlformat=require(_0x5b79('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5b79('0x1'));var jsonpatch=require(_0x5b79('0x2'));var rp=require('request-promise');var moment=require(_0x5b79('0x3'));var BPromise=require(_0x5b79('0x4'));var Mustache=require(_0x5b79('0x5'));var util=require(_0x5b79('0x6'));var path=require(_0x5b79('0x7'));var sox=require(_0x5b79('0x8'));var csv=require('to-csv');var ejs=require(_0x5b79('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5b79('0xa'));var squel=require(_0x5b79('0xb'));var crypto=require(_0x5b79('0xc'));var jsforce=require(_0x5b79('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x5b79('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5b79('0xf'));var authService=require(_0x5b79('0x10'));var qs=require(_0x5b79('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5b79('0x12'))(_0x5b79('0x13'));var utils=require('../../config/utils');var config=require(_0x5b79('0x14'));var licenseUtil=require(_0x5b79('0x15'));var db=require(_0x5b79('0x16'))['db'];function respondWithStatusCode(_0xd75ca6,_0x1a1bb8){_0x1a1bb8=_0x1a1bb8||0xcc;return function(_0x460192){if(_0x460192){return _0xd75ca6[_0x5b79('0x17')](_0x1a1bb8);}return _0xd75ca6[_0x5b79('0x18')](_0x1a1bb8)[_0x5b79('0x19')]();};}function respondWithResult(_0x58d84b,_0x221fb8){_0x221fb8=_0x221fb8||0xc8;return function(_0x15d994){if(_0x15d994){return _0x58d84b[_0x5b79('0x18')](_0x221fb8)[_0x5b79('0x1a')](_0x15d994);}};}function respondWithFilteredResult(_0x716d0a,_0x2fd613){return function(_0x393d01){if(_0x393d01){var _0x144f24=typeof _0x2fd613[_0x5b79('0x1b')]==='undefined'&&typeof _0x2fd613['limit']==='undefined';var _0x4a2e97=_0x393d01['count'];var _0x3b3c1b=_0x144f24?0x0:_0x2fd613[_0x5b79('0x1b')];var _0x598fde=_0x144f24?_0x393d01[_0x5b79('0x1c')]:_0x2fd613[_0x5b79('0x1b')]+_0x2fd613[_0x5b79('0x1d')];var _0x51d4e9;if(_0x598fde>=_0x4a2e97){_0x598fde=_0x4a2e97;_0x51d4e9=0xc8;}else{_0x51d4e9=0xce;}_0x716d0a['status'](_0x51d4e9);return _0x716d0a[_0x5b79('0x1e')]('Content-Range',_0x3b3c1b+'-'+_0x598fde+'/'+_0x4a2e97)[_0x5b79('0x1a')](_0x393d01);}return null;};}function patchUpdates(_0x28dc23){return function(_0x540209){try{jsonpatch[_0x5b79('0x1f')](_0x540209,_0x28dc23,!![]);}catch(_0x459014){return BPromise[_0x5b79('0x20')](_0x459014);}return _0x540209['save']();};}function saveUpdates(_0x270f03,_0x4c7e51){return function(_0x3af5b5){if(_0x3af5b5){return _0x3af5b5[_0x5b79('0x21')](_0x270f03)[_0x5b79('0x22')](function(_0x3747fa){return _0x3747fa;});}return null;};}function removeEntity(_0x2f30b5,_0x56137c){return function(_0x357956){if(_0x357956){return _0x357956['destroy']()[_0x5b79('0x22')](function(){_0x2f30b5[_0x5b79('0x18')](0xcc)[_0x5b79('0x19')]();});}};}function handleEntityNotFound(_0x58e371,_0x198d50){return function(_0x3b6b24){if(!_0x3b6b24){_0x58e371[_0x5b79('0x17')](0x194);}return _0x3b6b24;};}function handleError(_0x5abbb9,_0x26cdd1){_0x26cdd1=_0x26cdd1||0x1f4;return function(_0x2e95da){logger[_0x5b79('0x23')](_0x2e95da[_0x5b79('0x24')]);if(_0x2e95da[_0x5b79('0x25')]){delete _0x2e95da['name'];}_0x5abbb9[_0x5b79('0x18')](_0x26cdd1)[_0x5b79('0x26')](_0x2e95da);};}exports[_0x5b79('0x27')]=function(_0x180aa8,_0x372a66){var _0x5ca3da={},_0x147e28={},_0x4f957c={'count':0x0,'rows':[]};var _0x4b7b99=_['map'](db[_0x5b79('0x28')][_0x5b79('0x29')],function(_0x3fb39b){return{'name':_0x3fb39b[_0x5b79('0x2a')],'type':_0x3fb39b[_0x5b79('0x2b')]['key']};});_0x147e28[_0x5b79('0x2c')]=_[_0x5b79('0x2d')](_0x4b7b99,_0x5b79('0x25'));_0x147e28[_0x5b79('0x2e')]=_[_0x5b79('0x2f')](_0x180aa8[_0x5b79('0x2e')]);_0x147e28[_0x5b79('0x30')]=_[_0x5b79('0x31')](_0x147e28['model'],_0x147e28['query']);_0x5ca3da['attributes']=_['intersection'](_0x147e28[_0x5b79('0x2c')],qs[_0x5b79('0x32')](_0x180aa8['query'][_0x5b79('0x32')]));_0x5ca3da[_0x5b79('0x33')]=_0x5ca3da[_0x5b79('0x33')][_0x5b79('0x34')]?_0x5ca3da[_0x5b79('0x33')]:_0x147e28[_0x5b79('0x2c')];if(!_0x180aa8[_0x5b79('0x2e')][_0x5b79('0x35')](_0x5b79('0x36'))){_0x5ca3da['limit']=qs[_0x5b79('0x1d')](_0x180aa8['query'][_0x5b79('0x1d')]);_0x5ca3da['offset']=qs[_0x5b79('0x1b')](_0x180aa8[_0x5b79('0x2e')][_0x5b79('0x1b')]);}_0x5ca3da[_0x5b79('0x37')]=qs[_0x5b79('0x38')](_0x180aa8['query'][_0x5b79('0x38')]);_0x5ca3da[_0x5b79('0x39')]=qs['filters'](_[_0x5b79('0x3a')](_0x180aa8['query'],_0x147e28[_0x5b79('0x30')]),_0x4b7b99);if(_0x180aa8['query']['filter']){_0x5ca3da[_0x5b79('0x39')]=_[_0x5b79('0x3b')](_0x5ca3da[_0x5b79('0x39')],{'$or':_[_0x5b79('0x2d')](_0x4b7b99,function(_0x39705b){if(_0x39705b[_0x5b79('0x2b')]!==_0x5b79('0x3c')){var _0x2741b8={};_0x2741b8[_0x39705b[_0x5b79('0x25')]]={'$like':'%'+_0x180aa8[_0x5b79('0x2e')][_0x5b79('0x3d')]+'%'};return _0x2741b8;}})});}_0x5ca3da=_[_0x5b79('0x3b')]({},_0x5ca3da,_0x180aa8[_0x5b79('0x3e')]);var _0x31d7a1={'where':_0x5ca3da[_0x5b79('0x39')]};return db[_0x5b79('0x28')]['count'](_0x31d7a1)[_0x5b79('0x22')](function(_0x143070){_0x4f957c[_0x5b79('0x1c')]=_0x143070;if(_0x180aa8[_0x5b79('0x2e')]['includeAll']){_0x5ca3da[_0x5b79('0x3f')]=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0x5b79('0x40')](_0x5ca3da);})[_0x5b79('0x22')](function(_0x11b266){_0x4f957c[_0x5b79('0x41')]=_0x11b266;return _0x4f957c;})[_0x5b79('0x22')](respondWithFilteredResult(_0x372a66,_0x5ca3da))[_0x5b79('0x42')](handleError(_0x372a66,null));};exports[_0x5b79('0x43')]=function(_0x18c20a,_0x4e167d){var _0x31d6da={'raw':!![],'where':{'id':_0x18c20a[_0x5b79('0x44')]['id']}},_0x4b9851={};_0x4b9851['model']=_['keys'](db[_0x5b79('0x28')][_0x5b79('0x29')]);_0x4b9851[_0x5b79('0x2e')]=_['keys'](_0x18c20a[_0x5b79('0x2e')]);_0x4b9851[_0x5b79('0x30')]=_[_0x5b79('0x31')](_0x4b9851['model'],_0x4b9851[_0x5b79('0x2e')]);_0x31d6da[_0x5b79('0x33')]=_['intersection'](_0x4b9851[_0x5b79('0x2c')],qs['fields'](_0x18c20a[_0x5b79('0x2e')]['fields']));_0x31d6da[_0x5b79('0x33')]=_0x31d6da[_0x5b79('0x33')][_0x5b79('0x34')]?_0x31d6da['attributes']:_0x4b9851[_0x5b79('0x2c')];if(_0x18c20a[_0x5b79('0x2e')]['includeAll']){_0x31d6da[_0x5b79('0x3f')]=[{'all':!![]}];}_0x31d6da=_[_0x5b79('0x3b')]({},_0x31d6da,_0x18c20a['options']);return db['OpenchannelQueueReport']['find'](_0x31d6da)[_0x5b79('0x22')](handleEntityNotFound(_0x4e167d,null))[_0x5b79('0x22')](respondWithResult(_0x4e167d,null))['catch'](handleError(_0x4e167d,null));};exports[_0x5b79('0x45')]=function(_0x217ad6,_0x2fcee1){return db[_0x5b79('0x28')]['create'](_0x217ad6[_0x5b79('0x46')],{})[_0x5b79('0x22')](respondWithResult(_0x2fcee1,0xc9))[_0x5b79('0x42')](handleError(_0x2fcee1,null));};exports[_0x5b79('0x21')]=function(_0xe7f4b,_0x1de427){if(_0xe7f4b['body']['id']){delete _0xe7f4b[_0x5b79('0x46')]['id'];}return db[_0x5b79('0x28')][_0x5b79('0x47')]({'where':{'id':_0xe7f4b[_0x5b79('0x44')]['id']}})[_0x5b79('0x22')](handleEntityNotFound(_0x1de427,null))[_0x5b79('0x22')](saveUpdates(_0xe7f4b['body'],null))['then'](respondWithResult(_0x1de427,null))['catch'](handleError(_0x1de427,null));};exports[_0x5b79('0x48')]=function(_0xeed72e,_0x557aab){return db[_0x5b79('0x28')][_0x5b79('0x47')]({'where':{'id':_0xeed72e[_0x5b79('0x44')]['id']}})[_0x5b79('0x22')](handleEntityNotFound(_0x557aab,null))[_0x5b79('0x22')](removeEntity(_0x557aab,null))[_0x5b79('0x42')](handleError(_0x557aab,null));};exports[_0x5b79('0x49')]=function(_0x2cdbe5,_0x36c87d){return db[_0x5b79('0x28')][_0x5b79('0x49')]()[_0x5b79('0x22')](respondWithResult(_0x36c87d,null))['catch'](handleError(_0x36c87d,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 4b608da..2b45a09 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(_0x2a0338,_0x44e2a9){var _0x1db7b0=function(_0x5cd315){while(--_0x5cd315){_0x2a0338['push'](_0x2a0338['shift']());}};_0x1db7b0(++_0x44e2a9);}(_0x1261,0x144));var _0x1126=function(_0x47a349,_0x4699d9){_0x47a349=_0x47a349-0x0;var _0x18ab75=_0x1261[_0x47a349];return _0x18ab75;};'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 _0xe14b=['bluebird','path','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','lodash','util','moment'];(function(_0x55ecc4,_0x1f6fc4){var _0x2b3f81=function(_0x1e1460){while(--_0x1e1460){_0x55ecc4['push'](_0x55ecc4['shift']());}};_0x2b3f81(++_0x1f6fc4);}(_0xe14b,0x93));var _0xbe14=function(_0x552bfd,_0x330a32){_0x552bfd=_0x552bfd-0x0;var _0x5579dd=_0xe14b[_0x552bfd];return _0x5579dd;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 7324ec7..5bb9d4b 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 _0x55f1=['debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','UpdateOpenchannelQueueReport','update','raw','where','attributes','limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent'];(function(_0x3c560a,_0x1c46d4){var _0x22e9be=function(_0xd72419){while(--_0xd72419){_0x3c560a['push'](_0x3c560a['shift']());}};_0x22e9be(++_0x1c46d4);}(_0x55f1,0x9b));var _0x155f=function(_0x1b4ddd,_0x200cba){_0x1b4ddd=_0x1b4ddd-0x0;var _0x1ddeb8=_0x55f1[_0x1b4ddd];return _0x1ddeb8;};'use strict';var _=require(_0x155f('0x0'));var util=require('util');var moment=require(_0x155f('0x1'));var BPromise=require(_0x155f('0x2'));var rs=require(_0x155f('0x3'));var fs=require('fs');var Redis=require(_0x155f('0x4'));var db=require(_0x155f('0x5'))['db'];var utils=require(_0x155f('0x6'));var logger=require(_0x155f('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x155f('0x8'));var client=jayson['client'][_0x155f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x22e07f,_0x39b14d,_0x1bcf84){return new BPromise(function(_0x2a0a02,_0x9fc06e){return client[_0x155f('0xa')](_0x22e07f,_0x1bcf84)[_0x155f('0xb')](function(_0x100e9a){logger[_0x155f('0xc')](_0x155f('0xd'),_0x39b14d,_0x155f('0xe'));logger[_0x155f('0xf')](_0x155f('0x10'),_0x39b14d,_0x155f('0xe'),JSON[_0x155f('0x11')](_0x100e9a));if(_0x100e9a[_0x155f('0x12')]){if(_0x100e9a['error'][_0x155f('0x13')]===0x1f4){logger[_0x155f('0x12')](_0x155f('0xd'),_0x39b14d,_0x100e9a['error']['message']);return _0x9fc06e(_0x100e9a[_0x155f('0x12')][_0x155f('0x14')]);}logger[_0x155f('0x12')](_0x155f('0xd'),_0x39b14d,_0x100e9a[_0x155f('0x12')][_0x155f('0x14')]);return _0x2a0a02(_0x100e9a[_0x155f('0x12')]['message']);}else{logger[_0x155f('0xc')](_0x155f('0xd'),_0x39b14d,'request\x20sent');_0x2a0a02(_0x100e9a[_0x155f('0x15')][_0x155f('0x14')]);}})[_0x155f('0x16')](function(_0x7ad1c2){logger[_0x155f('0x12')](_0x155f('0xd'),_0x39b14d,_0x7ad1c2);_0x9fc06e(_0x7ad1c2);});});}exports[_0x155f('0x17')]=function(_0x343a1e){var _0x2f5b83=this;return new Promise(function(_0x407e26,_0x2e248d){return db[_0x155f('0x18')][_0x155f('0x19')](_0x343a1e[_0x155f('0x1a')],{'raw':_0x343a1e[_0x155f('0x1b')]?_0x343a1e[_0x155f('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x155f('0xb')](function(_0x26a322){logger[_0x155f('0xc')](_0x155f('0x17'),_0x343a1e);logger['debug']('CreateOpenchannelQueueReport',_0x343a1e,JSON['stringify'](_0x26a322));_0x407e26(_0x26a322);})[_0x155f('0x16')](function(_0x3a40b4){logger[_0x155f('0x12')](_0x155f('0x17'),_0x3a40b4[_0x155f('0x14')],_0x343a1e);_0x2e248d(_0x2f5b83['error'](0x1f4,_0x3a40b4[_0x155f('0x14')]));});});};exports[_0x155f('0x1c')]=function(_0x172077){var _0x348240=this;return new Promise(function(_0xee4dbc,_0x2588f5){return db[_0x155f('0x18')][_0x155f('0x1d')](_0x172077[_0x155f('0x1a')],{'raw':_0x172077[_0x155f('0x1b')]?_0x172077[_0x155f('0x1b')][_0x155f('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x172077['options']?_0x172077['options'][_0x155f('0x1f')]||null:null,'attributes':_0x172077[_0x155f('0x1b')]?_0x172077[_0x155f('0x1b')][_0x155f('0x20')]||null:null,'limit':_0x172077['options']?_0x172077[_0x155f('0x1b')][_0x155f('0x21')]||null:null})[_0x155f('0xb')](function(_0x29e9dd){logger[_0x155f('0xc')](_0x155f('0x1c'),_0x172077);logger[_0x155f('0xf')]('UpdateOpenchannelQueueReport',_0x172077,JSON[_0x155f('0x11')](_0x29e9dd));_0xee4dbc(_0x29e9dd);})[_0x155f('0x16')](function(_0x154158){logger[_0x155f('0x12')](_0x155f('0x1c'),_0x154158[_0x155f('0x14')],_0x172077);_0x2588f5(_0x348240[_0x155f('0x12')](0x1f4,_0x154158[_0x155f('0x14')]));});});}; \ No newline at end of file +var _0x4af8=['catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','stringify','UpdateOpenchannelQueueReport','update','where','attributes','limit','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','OpenchannelQueueReport,\x20%s,\x20%s','result'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x4af8,0x1ad));var _0x84af=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0x4af8[_0x5e3b04];return _0x1fc44d;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x84af('0x0'));var fs=require('fs');var Redis=require(_0x84af('0x1'));var db=require(_0x84af('0x2'))['db'];var utils=require(_0x84af('0x3'));var logger=require('../../config/logger')(_0x84af('0x4'));var config=require(_0x84af('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x84af('0x6')][_0x84af('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x550ee6,_0x422c5b,_0x294bc8){return new BPromise(function(_0x483ecc,_0x5b5e45){return client[_0x84af('0x8')](_0x550ee6,_0x294bc8)[_0x84af('0x9')](function(_0x479e1b){logger[_0x84af('0xa')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x422c5b,_0x84af('0xb'));logger[_0x84af('0xc')](_0x84af('0xd'),_0x422c5b,_0x84af('0xb'),JSON['stringify'](_0x479e1b));if(_0x479e1b[_0x84af('0xe')]){if(_0x479e1b['error'][_0x84af('0xf')]===0x1f4){logger[_0x84af('0xe')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x422c5b,_0x479e1b[_0x84af('0xe')][_0x84af('0x10')]);return _0x5b5e45(_0x479e1b[_0x84af('0xe')][_0x84af('0x10')]);}logger['error'](_0x84af('0x11'),_0x422c5b,_0x479e1b['error'][_0x84af('0x10')]);return _0x483ecc(_0x479e1b[_0x84af('0xe')]['message']);}else{logger[_0x84af('0xa')](_0x84af('0x11'),_0x422c5b,'request\x20sent');_0x483ecc(_0x479e1b[_0x84af('0x12')]['message']);}})[_0x84af('0x13')](function(_0x33baf1){logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0x422c5b,_0x33baf1);_0x5b5e45(_0x33baf1);});});}exports[_0x84af('0x14')]=function(_0xd8120b){var _0x38a120=this;return new Promise(function(_0x4cf5b4,_0x4d0cf0){return db[_0x84af('0x15')][_0x84af('0x16')](_0xd8120b[_0x84af('0x17')],{'raw':_0xd8120b[_0x84af('0x18')]?_0xd8120b[_0x84af('0x18')][_0x84af('0x19')]===undefined?!![]:![]:!![]})[_0x84af('0x9')](function(_0x334875){logger[_0x84af('0xa')]('CreateOpenchannelQueueReport',_0xd8120b);logger[_0x84af('0xc')](_0x84af('0x14'),_0xd8120b,JSON[_0x84af('0x1a')](_0x334875));_0x4cf5b4(_0x334875);})['catch'](function(_0x2f40d6){logger[_0x84af('0xe')](_0x84af('0x14'),_0x2f40d6['message'],_0xd8120b);_0x4d0cf0(_0x38a120['error'](0x1f4,_0x2f40d6[_0x84af('0x10')]));});});};exports[_0x84af('0x1b')]=function(_0xf72093){var _0x24aa07=this;return new Promise(function(_0x21823e,_0x1b23fb){return db[_0x84af('0x15')][_0x84af('0x1c')](_0xf72093[_0x84af('0x17')],{'raw':_0xf72093[_0x84af('0x18')]?_0xf72093[_0x84af('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf72093[_0x84af('0x18')]?_0xf72093[_0x84af('0x18')][_0x84af('0x1d')]||null:null,'attributes':_0xf72093[_0x84af('0x18')]?_0xf72093[_0x84af('0x18')][_0x84af('0x1e')]||null:null,'limit':_0xf72093[_0x84af('0x18')]?_0xf72093['options'][_0x84af('0x1f')]||null:null})[_0x84af('0x9')](function(_0x59417e){logger[_0x84af('0xa')](_0x84af('0x1b'),_0xf72093);logger[_0x84af('0xc')](_0x84af('0x1b'),_0xf72093,JSON['stringify'](_0x59417e));_0x21823e(_0x59417e);})['catch'](function(_0x3f37a0){logger[_0x84af('0xe')](_0x84af('0x1b'),_0x3f37a0[_0x84af('0x10')],_0xf72093);_0x1b23fb(_0x24aa07[_0x84af('0xe')](0x1f4,_0x3f37a0[_0x84af('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index b75b480..d466fc8 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 _0xfaf8=['/:id','post','put','update','destroy','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','/describe','isAuthenticated','describe'];(function(_0x439d59,_0x11ccdf){var _0x3670c7=function(_0x11cfcb){while(--_0x11cfcb){_0x439d59['push'](_0x439d59['shift']());}};_0x3670c7(++_0x11ccdf);}(_0xfaf8,0xb9));var _0x8faf=function(_0x293c9d,_0x262daa){_0x293c9d=_0x293c9d-0x0;var _0x252a84=_0xfaf8[_0x293c9d];return _0x252a84;};'use strict';var multer=require(_0x8faf('0x0'));var util=require(_0x8faf('0x1'));var path=require(_0x8faf('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8faf('0x3')]();var fs_extra=require(_0x8faf('0x4'));var auth=require(_0x8faf('0x5'));var interaction=require(_0x8faf('0x6'));var config=require(_0x8faf('0x7'));var controller=require(_0x8faf('0x8'));router[_0x8faf('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x8faf('0x9')](_0x8faf('0xa'),auth[_0x8faf('0xb')](),controller[_0x8faf('0xc')]);router[_0x8faf('0x9')](_0x8faf('0xd'),auth[_0x8faf('0xb')](),controller['show']);router[_0x8faf('0xe')]('/',auth[_0x8faf('0xb')](),controller['create']);router[_0x8faf('0xf')](_0x8faf('0xd'),auth[_0x8faf('0xb')](),controller[_0x8faf('0x10')]);router['delete']('/:id',auth[_0x8faf('0xb')](),controller[_0x8faf('0x11')]);module['exports']=router; \ No newline at end of file +var _0xa180=['isAuthenticated','index','/describe','show','post','create','put','/:id','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../config/environment','./openchannelTransferReport.controller','get'];(function(_0x1aa93c,_0x18bc9b){var _0x4720e6=function(_0x1b1a97){while(--_0x1b1a97){_0x1aa93c['push'](_0x1aa93c['shift']());}};_0x4720e6(++_0x18bc9b);}(_0xa180,0x9a));var _0x0a18=function(_0x10d7f9,_0x7d446){_0x10d7f9=_0x10d7f9-0x0;var _0x3bb63c=_0xa180[_0x10d7f9];return _0x3bb63c;};'use strict';var multer=require(_0x0a18('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x0a18('0x1'));var express=require(_0x0a18('0x2'));var router=express[_0x0a18('0x3')]();var fs_extra=require(_0x0a18('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0a18('0x5'));var controller=require(_0x0a18('0x6'));router[_0x0a18('0x7')]('/',auth[_0x0a18('0x8')](),controller[_0x0a18('0x9')]);router[_0x0a18('0x7')](_0x0a18('0xa'),auth[_0x0a18('0x8')](),controller['describe']);router[_0x0a18('0x7')]('/:id',auth[_0x0a18('0x8')](),controller[_0x0a18('0xb')]);router[_0x0a18('0xc')]('/',auth[_0x0a18('0x8')](),controller[_0x0a18('0xd')]);router[_0x0a18('0xe')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x0a18('0xf'),auth['isAuthenticated'](),controller[_0x0a18('0x10')]);module[_0x0a18('0x11')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 66fbab7..e335a02 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 _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x301b5a,_0xfb349a){var _0x18badb=function(_0x3c1731){while(--_0x3c1731){_0x301b5a['push'](_0x301b5a['shift']());}};_0x18badb(++_0xfb349a);}(_0x008c,0x188));var _0xc008=function(_0x3b9d79,_0x42f721){_0x3b9d79=_0x3b9d79-0x0;var _0x16d93e=_0x008c[_0x3b9d79];return _0x16d93e;};'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 _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x54fa33,_0x1879f3){var _0xc3c0f0=function(_0x3402c2){while(--_0x3402c2){_0x54fa33['push'](_0x54fa33['shift']());}};_0xc3c0f0(++_0x1879f3);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x29d6e6,_0x264220){_0x29d6e6=_0x29d6e6-0x0;var _0xc75ff0=_0xf3cd[_0x29d6e6];return _0xc75ff0;};'use strict';var moment=require(_0xdf3c('0x0'));var Sequelize=require(_0xdf3c('0x1'));module[_0xdf3c('0x2')]={'uniqueid':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xdf3c('0x4')](_0xdf3c('0x5'),'agent',_0xdf3c('0x6')),'allowNull':![],'defaultValue':_0xdf3c('0x6')},'transferredAt':{'type':Sequelize[_0xdf3c('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 4bd9521..5eaeabc 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 _0x1860=['reject','save','update','then','destroy','error','stack','name','send','index','OpenchannelTransferReport','rawAttributes','fieldName','type','key','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','VIRTUAL','filter','merge','options','includeAll','include','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','Content-Range','apply'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x1860,0x76));var _0x0186=function(_0x34bbb8,_0x1e9804){_0x34bbb8=_0x34bbb8-0x0;var _0x16eddf=_0x1860[_0x34bbb8];return _0x16eddf;};'use strict';var emlformat=require(_0x0186('0x0'));var rimraf=require(_0x0186('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0186('0x2'));var rp=require(_0x0186('0x3'));var moment=require(_0x0186('0x4'));var BPromise=require(_0x0186('0x5'));var Mustache=require(_0x0186('0x6'));var util=require(_0x0186('0x7'));var path=require('path');var sox=require(_0x0186('0x8'));var csv=require(_0x0186('0x9'));var ejs=require(_0x0186('0xa'));var fs=require('fs');var fs_extra=require(_0x0186('0xb'));var _=require(_0x0186('0xc'));var squel=require('squel');var crypto=require(_0x0186('0xd'));var jsforce=require(_0x0186('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x0186('0x9'));var querystring=require('querystring');var Papa=require(_0x0186('0xf'));var Redis=require(_0x0186('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x0186('0x11'));var as=require(_0x0186('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0186('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x0186('0x14'));var licenseUtil=require(_0x0186('0x15'));var db=require(_0x0186('0x16'))['db'];function respondWithStatusCode(_0x16e6e0,_0x5176ce){_0x5176ce=_0x5176ce||0xcc;return function(_0x13b0bd){if(_0x13b0bd){return _0x16e6e0[_0x0186('0x17')](_0x5176ce);}return _0x16e6e0[_0x0186('0x18')](_0x5176ce)['end']();};}function respondWithResult(_0x4a03b9,_0x21db81){_0x21db81=_0x21db81||0xc8;return function(_0x8f8c2f){if(_0x8f8c2f){return _0x4a03b9[_0x0186('0x18')](_0x21db81)[_0x0186('0x19')](_0x8f8c2f);}};}function respondWithFilteredResult(_0x3ced14,_0x2f4d1e){return function(_0x41f13f){if(_0x41f13f){var _0x3db026=typeof _0x2f4d1e['offset']==='undefined'&&typeof _0x2f4d1e['limit']===_0x0186('0x1a');var _0x3c5ae8=_0x41f13f[_0x0186('0x1b')];var _0x3d04f8=_0x3db026?0x0:_0x2f4d1e[_0x0186('0x1c')];var _0x251eea=_0x3db026?_0x41f13f['count']:_0x2f4d1e[_0x0186('0x1c')]+_0x2f4d1e[_0x0186('0x1d')];var _0x4dd412;if(_0x251eea>=_0x3c5ae8){_0x251eea=_0x3c5ae8;_0x4dd412=0xc8;}else{_0x4dd412=0xce;}_0x3ced14[_0x0186('0x18')](_0x4dd412);return _0x3ced14['set'](_0x0186('0x1e'),_0x3d04f8+'-'+_0x251eea+'/'+_0x3c5ae8)['json'](_0x41f13f);}return null;};}function patchUpdates(_0xdce4e8){return function(_0xfb8965){try{jsonpatch[_0x0186('0x1f')](_0xfb8965,_0xdce4e8,!![]);}catch(_0x3b211f){return BPromise[_0x0186('0x20')](_0x3b211f);}return _0xfb8965[_0x0186('0x21')]();};}function saveUpdates(_0x361d81,_0x105231){return function(_0x1a6da0){if(_0x1a6da0){return _0x1a6da0[_0x0186('0x22')](_0x361d81)[_0x0186('0x23')](function(_0x30c806){return _0x30c806;});}return null;};}function removeEntity(_0x1c5a40,_0xa5bd62){return function(_0x223ef8){if(_0x223ef8){return _0x223ef8[_0x0186('0x24')]()[_0x0186('0x23')](function(){_0x1c5a40[_0x0186('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x30bf8e,_0x13ff52){return function(_0x466ecc){if(!_0x466ecc){_0x30bf8e[_0x0186('0x17')](0x194);}return _0x466ecc;};}function handleError(_0x5756b7,_0x5b1525){_0x5b1525=_0x5b1525||0x1f4;return function(_0x5b6b9e){logger[_0x0186('0x25')](_0x5b6b9e[_0x0186('0x26')]);if(_0x5b6b9e[_0x0186('0x27')]){delete _0x5b6b9e[_0x0186('0x27')];}_0x5756b7[_0x0186('0x18')](_0x5b1525)[_0x0186('0x28')](_0x5b6b9e);};}exports[_0x0186('0x29')]=function(_0x277441,_0x118fa4){var _0x231475={},_0x3dd98b={},_0x1cb8d2={'count':0x0,'rows':[]};var _0x5794e2=_['map'](db[_0x0186('0x2a')][_0x0186('0x2b')],function(_0x2797d2){return{'name':_0x2797d2[_0x0186('0x2c')],'type':_0x2797d2[_0x0186('0x2d')][_0x0186('0x2e')]};});_0x3dd98b['model']=_[_0x0186('0x2f')](_0x5794e2,_0x0186('0x27'));_0x3dd98b[_0x0186('0x30')]=_[_0x0186('0x31')](_0x277441[_0x0186('0x30')]);_0x3dd98b['filters']=_[_0x0186('0x32')](_0x3dd98b[_0x0186('0x33')],_0x3dd98b[_0x0186('0x30')]);_0x231475[_0x0186('0x34')]=_[_0x0186('0x32')](_0x3dd98b[_0x0186('0x33')],qs[_0x0186('0x35')](_0x277441[_0x0186('0x30')][_0x0186('0x35')]));_0x231475[_0x0186('0x34')]=_0x231475[_0x0186('0x34')][_0x0186('0x36')]?_0x231475[_0x0186('0x34')]:_0x3dd98b[_0x0186('0x33')];if(!_0x277441['query'][_0x0186('0x37')]('nolimit')){_0x231475[_0x0186('0x1d')]=qs['limit'](_0x277441['query'][_0x0186('0x1d')]);_0x231475[_0x0186('0x1c')]=qs[_0x0186('0x1c')](_0x277441[_0x0186('0x30')][_0x0186('0x1c')]);}_0x231475[_0x0186('0x38')]=qs[_0x0186('0x39')](_0x277441['query'][_0x0186('0x39')]);_0x231475[_0x0186('0x3a')]=qs[_0x0186('0x3b')](_[_0x0186('0x3c')](_0x277441['query'],_0x3dd98b[_0x0186('0x3b')]),_0x5794e2);if(_0x277441['query']['filter']){_0x231475['where']=_['merge'](_0x231475['where'],{'$or':_[_0x0186('0x2f')](_0x5794e2,function(_0x44ad40){if(_0x44ad40[_0x0186('0x2d')]!==_0x0186('0x3d')){var _0x374b21={};_0x374b21[_0x44ad40[_0x0186('0x27')]]={'$like':'%'+_0x277441['query'][_0x0186('0x3e')]+'%'};return _0x374b21;}})});}_0x231475=_[_0x0186('0x3f')]({},_0x231475,_0x277441[_0x0186('0x40')]);var _0x454d30={'where':_0x231475[_0x0186('0x3a')]};return db[_0x0186('0x2a')][_0x0186('0x1b')](_0x454d30)[_0x0186('0x23')](function(_0x589202){_0x1cb8d2[_0x0186('0x1b')]=_0x589202;if(_0x277441['query'][_0x0186('0x41')]){_0x231475[_0x0186('0x42')]=[{'all':!![]}];}return db[_0x0186('0x2a')]['findAll'](_0x231475);})['then'](function(_0x3080eb){_0x1cb8d2[_0x0186('0x43')]=_0x3080eb;return _0x1cb8d2;})[_0x0186('0x23')](respondWithFilteredResult(_0x118fa4,_0x231475))[_0x0186('0x44')](handleError(_0x118fa4,null));};exports[_0x0186('0x45')]=function(_0x4f2876,_0x568635){var _0x1ed38d={'raw':!![],'where':{'id':_0x4f2876[_0x0186('0x46')]['id']}},_0x5cd162={};_0x5cd162[_0x0186('0x33')]=_[_0x0186('0x31')](db[_0x0186('0x2a')][_0x0186('0x2b')]);_0x5cd162[_0x0186('0x30')]=_[_0x0186('0x31')](_0x4f2876[_0x0186('0x30')]);_0x5cd162['filters']=_[_0x0186('0x32')](_0x5cd162[_0x0186('0x33')],_0x5cd162[_0x0186('0x30')]);_0x1ed38d[_0x0186('0x34')]=_[_0x0186('0x32')](_0x5cd162[_0x0186('0x33')],qs[_0x0186('0x35')](_0x4f2876[_0x0186('0x30')][_0x0186('0x35')]));_0x1ed38d['attributes']=_0x1ed38d[_0x0186('0x34')][_0x0186('0x36')]?_0x1ed38d[_0x0186('0x34')]:_0x5cd162['model'];if(_0x4f2876['query']['includeAll']){_0x1ed38d[_0x0186('0x42')]=[{'all':!![]}];}_0x1ed38d=_[_0x0186('0x3f')]({},_0x1ed38d,_0x4f2876[_0x0186('0x40')]);return db['OpenchannelTransferReport'][_0x0186('0x47')](_0x1ed38d)['then'](handleEntityNotFound(_0x568635,null))['then'](respondWithResult(_0x568635,null))[_0x0186('0x44')](handleError(_0x568635,null));};exports[_0x0186('0x48')]=function(_0x116f64,_0x36d294){return db[_0x0186('0x2a')][_0x0186('0x48')](_0x116f64[_0x0186('0x49')],{})[_0x0186('0x23')](respondWithResult(_0x36d294,0xc9))[_0x0186('0x44')](handleError(_0x36d294,null));};exports[_0x0186('0x22')]=function(_0x1a4f59,_0x5dc685){if(_0x1a4f59[_0x0186('0x49')]['id']){delete _0x1a4f59[_0x0186('0x49')]['id'];}return db[_0x0186('0x2a')][_0x0186('0x47')]({'where':{'id':_0x1a4f59[_0x0186('0x46')]['id']}})['then'](handleEntityNotFound(_0x5dc685,null))[_0x0186('0x23')](saveUpdates(_0x1a4f59['body'],null))[_0x0186('0x23')](respondWithResult(_0x5dc685,null))[_0x0186('0x44')](handleError(_0x5dc685,null));};exports[_0x0186('0x24')]=function(_0x1190dc,_0x4732a0){return db['OpenchannelTransferReport'][_0x0186('0x47')]({'where':{'id':_0x1190dc[_0x0186('0x46')]['id']}})[_0x0186('0x23')](handleEntityNotFound(_0x4732a0,null))['then'](removeEntity(_0x4732a0,null))[_0x0186('0x44')](handleError(_0x4732a0,null));};exports[_0x0186('0x4a')]=function(_0x12eb47,_0x5efc2a){return db['OpenchannelTransferReport'][_0x0186('0x4a')]()[_0x0186('0x23')](respondWithResult(_0x5efc2a,null))[_0x0186('0x44')](handleError(_0x5efc2a,null));}; \ No newline at end of file +var _0x213f=['options','includeAll','include','findAll','rows','catch','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','index','map','OpenchannelTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','nolimit','sort','where','pick','filter','merge'];(function(_0xe66cf2,_0x32ba5f){var _0x2d84e7=function(_0x58a7d8){while(--_0x58a7d8){_0xe66cf2['push'](_0xe66cf2['shift']());}};_0x2d84e7(++_0x32ba5f);}(_0x213f,0x173));var _0xf213=function(_0x5cc4ec,_0x20ea5c){_0x5cc4ec=_0x5cc4ec-0x0;var _0x1a6490=_0x213f[_0x5cc4ec];return _0x1a6490;};'use strict';var emlformat=require(_0xf213('0x0'));var rimraf=require(_0xf213('0x1'));var zipdir=require(_0xf213('0x2'));var jsonpatch=require(_0xf213('0x3'));var rp=require(_0xf213('0x4'));var moment=require(_0xf213('0x5'));var BPromise=require(_0xf213('0x6'));var Mustache=require(_0xf213('0x7'));var util=require('util');var path=require(_0xf213('0x8'));var sox=require(_0xf213('0x9'));var csv=require(_0xf213('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf213('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf213('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xf213('0xa'));var querystring=require('querystring');var Papa=require(_0xf213('0xd'));var Redis=require(_0xf213('0xe'));var authService=require(_0xf213('0xf'));var qs=require(_0xf213('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf213('0x11'));var logger=require('../../config/logger')(_0xf213('0x12'));var utils=require(_0xf213('0x13'));var config=require(_0xf213('0x14'));var licenseUtil=require(_0xf213('0x15'));var db=require(_0xf213('0x16'))['db'];function respondWithStatusCode(_0x395bab,_0x4f71d9){_0x4f71d9=_0x4f71d9||0xcc;return function(_0x213d4a){if(_0x213d4a){return _0x395bab[_0xf213('0x17')](_0x4f71d9);}return _0x395bab[_0xf213('0x18')](_0x4f71d9)[_0xf213('0x19')]();};}function respondWithResult(_0x30eefa,_0x3e5dc7){_0x3e5dc7=_0x3e5dc7||0xc8;return function(_0x2ee902){if(_0x2ee902){return _0x30eefa[_0xf213('0x18')](_0x3e5dc7)[_0xf213('0x1a')](_0x2ee902);}};}function respondWithFilteredResult(_0x4acf0d,_0x4ac7a9){return function(_0x4ad789){if(_0x4ad789){var _0x1c053c=typeof _0x4ac7a9[_0xf213('0x1b')]==='undefined'&&typeof _0x4ac7a9[_0xf213('0x1c')]===_0xf213('0x1d');var _0x3bdd12=_0x4ad789[_0xf213('0x1e')];var _0x4c21f2=_0x1c053c?0x0:_0x4ac7a9[_0xf213('0x1b')];var _0x58512d=_0x1c053c?_0x4ad789['count']:_0x4ac7a9[_0xf213('0x1b')]+_0x4ac7a9[_0xf213('0x1c')];var _0x27fb2e;if(_0x58512d>=_0x3bdd12){_0x58512d=_0x3bdd12;_0x27fb2e=0xc8;}else{_0x27fb2e=0xce;}_0x4acf0d['status'](_0x27fb2e);return _0x4acf0d[_0xf213('0x1f')](_0xf213('0x20'),_0x4c21f2+'-'+_0x58512d+'/'+_0x3bdd12)[_0xf213('0x1a')](_0x4ad789);}return null;};}function patchUpdates(_0x44a1d5){return function(_0x40eaec){try{jsonpatch[_0xf213('0x21')](_0x40eaec,_0x44a1d5,!![]);}catch(_0x419b76){return BPromise[_0xf213('0x22')](_0x419b76);}return _0x40eaec[_0xf213('0x23')]();};}function saveUpdates(_0x3e73ab,_0x47c36a){return function(_0xa59e04){if(_0xa59e04){return _0xa59e04[_0xf213('0x24')](_0x3e73ab)[_0xf213('0x25')](function(_0x59dbae){return _0x59dbae;});}return null;};}function removeEntity(_0x39af88,_0x317a25){return function(_0x505003){if(_0x505003){return _0x505003[_0xf213('0x26')]()[_0xf213('0x25')](function(){_0x39af88[_0xf213('0x18')](0xcc)[_0xf213('0x19')]();});}};}function handleEntityNotFound(_0x2a7a2f,_0x524124){return function(_0x4fbc4f){if(!_0x4fbc4f){_0x2a7a2f[_0xf213('0x17')](0x194);}return _0x4fbc4f;};}function handleError(_0x27e02a,_0x50ff24){_0x50ff24=_0x50ff24||0x1f4;return function(_0x4e89f0){logger[_0xf213('0x27')](_0x4e89f0['stack']);if(_0x4e89f0[_0xf213('0x28')]){delete _0x4e89f0[_0xf213('0x28')];}_0x27e02a[_0xf213('0x18')](_0x50ff24)['send'](_0x4e89f0);};}exports[_0xf213('0x29')]=function(_0x7ef1f6,_0x35c5f5){var _0x450d9={},_0x141c09={},_0x5cb465={'count':0x0,'rows':[]};var _0x86264d=_[_0xf213('0x2a')](db[_0xf213('0x2b')][_0xf213('0x2c')],function(_0x339ef8){return{'name':_0x339ef8[_0xf213('0x2d')],'type':_0x339ef8[_0xf213('0x2e')][_0xf213('0x2f')]};});_0x141c09[_0xf213('0x30')]=_[_0xf213('0x2a')](_0x86264d,_0xf213('0x28'));_0x141c09[_0xf213('0x31')]=_[_0xf213('0x32')](_0x7ef1f6['query']);_0x141c09[_0xf213('0x33')]=_[_0xf213('0x34')](_0x141c09[_0xf213('0x30')],_0x141c09['query']);_0x450d9['attributes']=_[_0xf213('0x34')](_0x141c09[_0xf213('0x30')],qs[_0xf213('0x35')](_0x7ef1f6[_0xf213('0x31')][_0xf213('0x35')]));_0x450d9[_0xf213('0x36')]=_0x450d9['attributes']['length']?_0x450d9[_0xf213('0x36')]:_0x141c09[_0xf213('0x30')];if(!_0x7ef1f6[_0xf213('0x31')]['hasOwnProperty'](_0xf213('0x37'))){_0x450d9[_0xf213('0x1c')]=qs['limit'](_0x7ef1f6[_0xf213('0x31')]['limit']);_0x450d9[_0xf213('0x1b')]=qs['offset'](_0x7ef1f6['query'][_0xf213('0x1b')]);}_0x450d9['order']=qs[_0xf213('0x38')](_0x7ef1f6[_0xf213('0x31')][_0xf213('0x38')]);_0x450d9[_0xf213('0x39')]=qs[_0xf213('0x33')](_[_0xf213('0x3a')](_0x7ef1f6[_0xf213('0x31')],_0x141c09[_0xf213('0x33')]),_0x86264d);if(_0x7ef1f6['query'][_0xf213('0x3b')]){_0x450d9[_0xf213('0x39')]=_[_0xf213('0x3c')](_0x450d9['where'],{'$or':_[_0xf213('0x2a')](_0x86264d,function(_0x140849){if(_0x140849[_0xf213('0x2e')]!=='VIRTUAL'){var _0x51648a={};_0x51648a[_0x140849[_0xf213('0x28')]]={'$like':'%'+_0x7ef1f6[_0xf213('0x31')]['filter']+'%'};return _0x51648a;}})});}_0x450d9=_[_0xf213('0x3c')]({},_0x450d9,_0x7ef1f6[_0xf213('0x3d')]);var _0x20a9e0={'where':_0x450d9[_0xf213('0x39')]};return db[_0xf213('0x2b')][_0xf213('0x1e')](_0x20a9e0)[_0xf213('0x25')](function(_0x49f72d){_0x5cb465['count']=_0x49f72d;if(_0x7ef1f6['query'][_0xf213('0x3e')]){_0x450d9[_0xf213('0x3f')]=[{'all':!![]}];}return db['OpenchannelTransferReport'][_0xf213('0x40')](_0x450d9);})['then'](function(_0x32f1b1){_0x5cb465[_0xf213('0x41')]=_0x32f1b1;return _0x5cb465;})['then'](respondWithFilteredResult(_0x35c5f5,_0x450d9))[_0xf213('0x42')](handleError(_0x35c5f5,null));};exports['show']=function(_0x16264e,_0x22e4e0){var _0x25b89f={'raw':!![],'where':{'id':_0x16264e[_0xf213('0x43')]['id']}},_0x4df64f={};_0x4df64f[_0xf213('0x30')]=_['keys'](db[_0xf213('0x2b')][_0xf213('0x2c')]);_0x4df64f[_0xf213('0x31')]=_[_0xf213('0x32')](_0x16264e['query']);_0x4df64f['filters']=_[_0xf213('0x34')](_0x4df64f[_0xf213('0x30')],_0x4df64f[_0xf213('0x31')]);_0x25b89f['attributes']=_['intersection'](_0x4df64f[_0xf213('0x30')],qs[_0xf213('0x35')](_0x16264e[_0xf213('0x31')][_0xf213('0x35')]));_0x25b89f[_0xf213('0x36')]=_0x25b89f[_0xf213('0x36')]['length']?_0x25b89f['attributes']:_0x4df64f[_0xf213('0x30')];if(_0x16264e[_0xf213('0x31')]['includeAll']){_0x25b89f[_0xf213('0x3f')]=[{'all':!![]}];}_0x25b89f=_[_0xf213('0x3c')]({},_0x25b89f,_0x16264e['options']);return db['OpenchannelTransferReport'][_0xf213('0x44')](_0x25b89f)[_0xf213('0x25')](handleEntityNotFound(_0x22e4e0,null))[_0xf213('0x25')](respondWithResult(_0x22e4e0,null))[_0xf213('0x42')](handleError(_0x22e4e0,null));};exports[_0xf213('0x45')]=function(_0x26cc3c,_0x596c0d){return db[_0xf213('0x2b')]['create'](_0x26cc3c[_0xf213('0x46')],{})[_0xf213('0x25')](respondWithResult(_0x596c0d,0xc9))[_0xf213('0x42')](handleError(_0x596c0d,null));};exports[_0xf213('0x24')]=function(_0xa1b9ca,_0xa2e918){if(_0xa1b9ca[_0xf213('0x46')]['id']){delete _0xa1b9ca['body']['id'];}return db[_0xf213('0x2b')][_0xf213('0x44')]({'where':{'id':_0xa1b9ca['params']['id']}})[_0xf213('0x25')](handleEntityNotFound(_0xa2e918,null))['then'](saveUpdates(_0xa1b9ca['body'],null))['then'](respondWithResult(_0xa2e918,null))[_0xf213('0x42')](handleError(_0xa2e918,null));};exports['destroy']=function(_0x31baff,_0x1dc352){return db['OpenchannelTransferReport'][_0xf213('0x44')]({'where':{'id':_0x31baff[_0xf213('0x43')]['id']}})['then'](handleEntityNotFound(_0x1dc352,null))['then'](removeEntity(_0x1dc352,null))[_0xf213('0x42')](handleError(_0x1dc352,null));};exports[_0xf213('0x47')]=function(_0x44eceb,_0xe82946){return db[_0xf213('0x2b')][_0xf213('0x47')]()[_0xf213('0x25')](respondWithResult(_0xe82946,null))[_0xf213('0x42')](handleError(_0xe82946,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 6c2fec8..09a9514 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 _0xb1d0=['./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0xaae759,_0x2a27ee){var _0x518d12=function(_0x5b7bec){while(--_0x5b7bec){_0xaae759['push'](_0xaae759['shift']());}};_0x518d12(++_0x2a27ee);}(_0xb1d0,0x1aa));var _0x0b1d=function(_0x556634,_0x520958){_0x556634=_0x556634-0x0;var _0x4429fd=_0xb1d0[_0x556634];return _0x4429fd;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0b1d('0x0'))(_0x0b1d('0x1'));var moment=require(_0x0b1d('0x2'));var BPromise=require(_0x0b1d('0x3'));var rp=require(_0x0b1d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0b1d('0x5'));var config=require('../../config/environment');var attributes=require(_0x0b1d('0x6'));module[_0x0b1d('0x7')]=function(_0x4f9574,_0x420ebe){return _0x4f9574[_0x0b1d('0x8')](_0x0b1d('0x9'),attributes,{'tableName':_0x0b1d('0xa'),'paranoid':![],'indexes':[{'name':_0x0b1d('0xb'),'fields':[_0x0b1d('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6226=['rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','define','report_openchannel_transfer','uniqueid','lodash','util','../../config/logger','api','bluebird','path'];(function(_0x560e0a,_0x2502a8){var _0x59d53e=function(_0x22ff2f){while(--_0x22ff2f){_0x560e0a['push'](_0x560e0a['shift']());}};_0x59d53e(++_0x2502a8);}(_0x6226,0xa3));var _0x6622=function(_0x48af38,_0x4b59c0){_0x48af38=_0x48af38-0x0;var _0x3d2de7=_0x6226[_0x48af38];return _0x3d2de7;};'use strict';var _=require(_0x6622('0x0'));var util=require(_0x6622('0x1'));var logger=require(_0x6622('0x2'))(_0x6622('0x3'));var moment=require('moment');var BPromise=require(_0x6622('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6622('0x5'));var rimraf=require(_0x6622('0x6'));var config=require(_0x6622('0x7'));var attributes=require(_0x6622('0x8'));module[_0x6622('0x9')]=function(_0x5303f7,_0x1fcb7d){return _0x5303f7[_0x6622('0xa')]('OpenchannelTransferReport',attributes,{'tableName':_0x6622('0xb'),'paranoid':![],'indexes':[{'name':_0x6622('0xc'),'fields':[_0x6622('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 289094b..cd33185 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 _0x1db9=['../../config/utils','../../config/logger','jayson/promise','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x4bf0c5,_0x333c94){var _0x59aa46=function(_0x573011){while(--_0x573011){_0x4bf0c5['push'](_0x4bf0c5['shift']());}};_0x59aa46(++_0x333c94);}(_0x1db9,0x176));var _0x91db=function(_0x15ece7,_0x2f2407){_0x15ece7=_0x15ece7-0x0;var _0x8917c9=_0x1db9[_0x15ece7];return _0x8917c9;};'use strict';var _=require(_0x91db('0x0'));var util=require(_0x91db('0x1'));var moment=require(_0x91db('0x2'));var BPromise=require(_0x91db('0x3'));var rs=require(_0x91db('0x4'));var fs=require('fs');var Redis=require(_0x91db('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x91db('0x6'));var logger=require(_0x91db('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x91db('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x433c75,_0x3b0c53,_0x45fea0){return new BPromise(function(_0x2330c2,_0x2d89a1){return client['request'](_0x433c75,_0x45fea0)[_0x91db('0x9')](function(_0x58cda2){logger[_0x91db('0xa')](_0x91db('0xb'),_0x3b0c53,_0x91db('0xc'));logger['debug'](_0x91db('0xd'),_0x3b0c53,'request\x20sent',JSON['stringify'](_0x58cda2));if(_0x58cda2['error']){if(_0x58cda2[_0x91db('0xe')][_0x91db('0xf')]===0x1f4){logger['error']('OpenchannelTransferReport,\x20%s,\x20%s',_0x3b0c53,_0x58cda2[_0x91db('0xe')][_0x91db('0x10')]);return _0x2d89a1(_0x58cda2[_0x91db('0xe')][_0x91db('0x10')]);}logger[_0x91db('0xe')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x3b0c53,_0x58cda2[_0x91db('0xe')][_0x91db('0x10')]);return _0x2330c2(_0x58cda2[_0x91db('0xe')][_0x91db('0x10')]);}else{logger[_0x91db('0xa')](_0x91db('0xb'),_0x3b0c53,_0x91db('0xc'));_0x2330c2(_0x58cda2[_0x91db('0x11')][_0x91db('0x10')]);}})[_0x91db('0x12')](function(_0x1e9679){logger[_0x91db('0xe')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x3b0c53,_0x1e9679);_0x2d89a1(_0x1e9679);});});} \ No newline at end of file +var _0xc978=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xc978,0xcd));var _0x8c97=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc978[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x8c97('0x0'));var util=require(_0x8c97('0x1'));var moment=require(_0x8c97('0x2'));var BPromise=require(_0x8c97('0x3'));var rs=require(_0x8c97('0x4'));var fs=require('fs');var Redis=require(_0x8c97('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8c97('0x6'));var logger=require(_0x8c97('0x7'))(_0x8c97('0x8'));var config=require(_0x8c97('0x9'));var jayson=require(_0x8c97('0xa'));var client=jayson[_0x8c97('0xb')][_0x8c97('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x524196,_0x41a511,_0x1b5864){return new BPromise(function(_0x332cd1,_0x26ff40){return client[_0x8c97('0xd')](_0x524196,_0x1b5864)[_0x8c97('0xe')](function(_0x17aef0){logger['info'](_0x8c97('0xf'),_0x41a511,_0x8c97('0x10'));logger[_0x8c97('0x11')](_0x8c97('0x12'),_0x41a511,_0x8c97('0x10'),JSON[_0x8c97('0x13')](_0x17aef0));if(_0x17aef0[_0x8c97('0x14')]){if(_0x17aef0[_0x8c97('0x14')][_0x8c97('0x15')]===0x1f4){logger['error'](_0x8c97('0xf'),_0x41a511,_0x17aef0[_0x8c97('0x14')]['message']);return _0x26ff40(_0x17aef0[_0x8c97('0x14')][_0x8c97('0x16')]);}logger['error'](_0x8c97('0xf'),_0x41a511,_0x17aef0['error']['message']);return _0x332cd1(_0x17aef0['error'][_0x8c97('0x16')]);}else{logger[_0x8c97('0x17')](_0x8c97('0xf'),_0x41a511,_0x8c97('0x10'));_0x332cd1(_0x17aef0[_0x8c97('0x18')][_0x8c97('0x16')]);}})[_0x8c97('0x19')](function(_0xe3be1){logger[_0x8c97('0x14')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x41a511,_0xe3be1);_0x26ff40(_0xe3be1);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index a6a0562..361a423 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 _0xc3c8=['./pause.controller','isAuthenticated','index','create','put','/:id','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x54c820,_0xe1c4a7){var _0x33ea01=function(_0x5856dd){while(--_0x5856dd){_0x54c820['push'](_0x54c820['shift']());}};_0x33ea01(++_0xe1c4a7);}(_0xc3c8,0x7f));var _0x8c3c=function(_0x2272d7,_0x694f20){_0x2272d7=_0x2272d7-0x0;var _0x42697c=_0xc3c8[_0x2272d7];return _0x42697c;};'use strict';var multer=require(_0x8c3c('0x0'));var util=require(_0x8c3c('0x1'));var path=require(_0x8c3c('0x2'));var timeout=require(_0x8c3c('0x3'));var express=require(_0x8c3c('0x4'));var router=express[_0x8c3c('0x5')]();var fs_extra=require(_0x8c3c('0x6'));var auth=require(_0x8c3c('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8c3c('0x8'));router['get']('/',auth[_0x8c3c('0x9')](),controller[_0x8c3c('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x8c3c('0x9')](),controller[_0x8c3c('0xb')]);router[_0x8c3c('0xc')](_0x8c3c('0xd'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x8c3c('0xd'),auth[_0x8c3c('0x9')](),controller[_0x8c3c('0xe')]);module['exports']=router; \ No newline at end of file +var _0xa9b7=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','get','isAuthenticated','index','show','post','create','put','update','delete','/:id','destroy','multer','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9b7,0x18a));var _0x7a9b=function(_0x1d3e52,_0x27ef1a){_0x1d3e52=_0x1d3e52-0x0;var _0x1c3c7a=_0xa9b7[_0x1d3e52];return _0x1c3c7a;};'use strict';var multer=require(_0x7a9b('0x0'));var util=require(_0x7a9b('0x1'));var path=require(_0x7a9b('0x2'));var timeout=require(_0x7a9b('0x3'));var express=require(_0x7a9b('0x4'));var router=express[_0x7a9b('0x5')]();var fs_extra=require(_0x7a9b('0x6'));var auth=require(_0x7a9b('0x7'));var interaction=require(_0x7a9b('0x8'));var config=require(_0x7a9b('0x9'));var controller=require(_0x7a9b('0xa'));router[_0x7a9b('0xb')]('/',auth[_0x7a9b('0xc')](),controller[_0x7a9b('0xd')]);router['get']('/:id',auth[_0x7a9b('0xc')](),controller[_0x7a9b('0xe')]);router[_0x7a9b('0xf')]('/',auth[_0x7a9b('0xc')](),controller[_0x7a9b('0x10')]);router[_0x7a9b('0x11')]('/:id',auth[_0x7a9b('0xc')](),controller[_0x7a9b('0x12')]);router[_0x7a9b('0x13')](_0x7a9b('0x14'),auth[_0x7a9b('0xc')](),controller[_0x7a9b('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index ed5f609..9a96484 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 _0x85d1=['STRING','name'];(function(_0x228448,_0x4a786d){var _0x3ca5c4=function(_0x3af06b){while(--_0x3af06b){_0x228448['push'](_0x228448['shift']());}};_0x3ca5c4(++_0x4a786d);}(_0x85d1,0xde));var _0x185d=function(_0xbebf50,_0x44ec09){_0xbebf50=_0xbebf50-0x0;var _0xce1496=_0x85d1[_0xbebf50];return _0xce1496;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x185d('0x0')],'unique':_0x185d('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0x185d('0x0')]}}; \ No newline at end of file +var _0x5259=['STRING','name','sequelize'];(function(_0x1401ba,_0x84db9f){var _0x7b1dac=function(_0x37a8d6){while(--_0x37a8d6){_0x1401ba['push'](_0x1401ba['shift']());}};_0x7b1dac(++_0x84db9f);}(_0x5259,0x17f));var _0x9525=function(_0x11b7ee,_0x304f2c){_0x11b7ee=_0x11b7ee-0x0;var _0x118a1f=_0x5259[_0x11b7ee];return _0x118a1f;};'use strict';var Sequelize=require(_0x9525('0x0'));module['exports']={'name':{'type':Sequelize[_0x9525('0x1')],'unique':_0x9525('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x9525('0x1')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 062f338..17a8ca7 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 _0xa80e=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','get','Pauses','error','stack','name','send','index','map','Pause','rawAttributes','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0x39106e,_0x586f3d){var _0x892aec=function(_0xded1b5){while(--_0xded1b5){_0x39106e['push'](_0x39106e['shift']());}};_0x892aec(++_0x586f3d);}(_0xa80e,0x19d));var _0xea80=function(_0x3c1861,_0x532642){_0x3c1861=_0x3c1861-0x0;var _0x4e5a61=_0xa80e[_0x3c1861];return _0x4e5a61;};'use strict';var emlformat=require(_0xea80('0x0'));var rimraf=require(_0xea80('0x1'));var zipdir=require(_0xea80('0x2'));var jsonpatch=require(_0xea80('0x3'));var rp=require(_0xea80('0x4'));var moment=require('moment');var BPromise=require(_0xea80('0x5'));var Mustache=require(_0xea80('0x6'));var util=require(_0xea80('0x7'));var path=require(_0xea80('0x8'));var sox=require(_0xea80('0x9'));var csv=require(_0xea80('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xea80('0xb'));var _=require(_0xea80('0xc'));var squel=require(_0xea80('0xd'));var crypto=require(_0xea80('0xe'));var jsforce=require(_0xea80('0xf'));var deskjs=require(_0xea80('0x10'));var toCsv=require(_0xea80('0xa'));var querystring=require(_0xea80('0x11'));var Papa=require(_0xea80('0x12'));var Redis=require(_0xea80('0x13'));var authService=require(_0xea80('0x14'));var qs=require(_0xea80('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xea80('0x16'));var logger=require('../../config/logger')(_0xea80('0x17'));var utils=require(_0xea80('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xea80('0x19'));var db=require(_0xea80('0x1a'))['db'];function respondWithStatusCode(_0x17abbc,_0x540db6){_0x540db6=_0x540db6||0xcc;return function(_0x45625f){if(_0x45625f){return _0x17abbc[_0xea80('0x1b')](_0x540db6);}return _0x17abbc[_0xea80('0x1c')](_0x540db6)[_0xea80('0x1d')]();};}function respondWithResult(_0x3d85e3,_0x460e8f){_0x460e8f=_0x460e8f||0xc8;return function(_0x5cc221){if(_0x5cc221){return _0x3d85e3['status'](_0x460e8f)[_0xea80('0x1e')](_0x5cc221);}};}function respondWithFilteredResult(_0x486541,_0x1db341){return function(_0x45862e){if(_0x45862e){var _0x384249=typeof _0x1db341[_0xea80('0x1f')]===_0xea80('0x20')&&typeof _0x1db341[_0xea80('0x21')]==='undefined';var _0xd986d9=_0x45862e[_0xea80('0x22')];var _0x71cf33=_0x384249?0x0:_0x1db341[_0xea80('0x1f')];var _0x2c3f82=_0x384249?_0x45862e['count']:_0x1db341['offset']+_0x1db341['limit'];var _0xd3ccf0;if(_0x2c3f82>=_0xd986d9){_0x2c3f82=_0xd986d9;_0xd3ccf0=0xc8;}else{_0xd3ccf0=0xce;}_0x486541['status'](_0xd3ccf0);return _0x486541[_0xea80('0x23')](_0xea80('0x24'),_0x71cf33+'-'+_0x2c3f82+'/'+_0xd986d9)['json'](_0x45862e);}return null;};}function patchUpdates(_0x1de1f7){return function(_0x11c67f){try{jsonpatch['apply'](_0x11c67f,_0x1de1f7,!![]);}catch(_0x1af264){return BPromise[_0xea80('0x25')](_0x1af264);}return _0x11c67f[_0xea80('0x26')]();};}function saveUpdates(_0x3c885f,_0x1ba14f){return function(_0x21d3db){if(_0x21d3db){return _0x21d3db[_0xea80('0x27')](_0x3c885f)['then'](function(_0x32b535){return _0x32b535;});}return null;};}function removeEntity(_0x53a95a,_0x3f8585){return function(_0x4c1e34){if(_0x4c1e34){return _0x4c1e34[_0xea80('0x28')]()[_0xea80('0x29')](function(){var _0x7d6486=_0x4c1e34[_0xea80('0x2a')]({'plain':!![]});var _0x5d845e=_0xea80('0x2b');return db['UserProfileResource']['destroy']({'where':{'type':_0x5d845e,'resourceId':_0x7d6486['id']}})[_0xea80('0x29')](function(){return _0x4c1e34;});})['then'](function(){_0x53a95a[_0xea80('0x1c')](0xcc)[_0xea80('0x1d')]();});}};}function handleEntityNotFound(_0x26702e,_0x125cc0){return function(_0x56f922){if(!_0x56f922){_0x26702e[_0xea80('0x1b')](0x194);}return _0x56f922;};}function handleError(_0x31e65b,_0x18370a){_0x18370a=_0x18370a||0x1f4;return function(_0x4a6edc){logger[_0xea80('0x2c')](_0x4a6edc[_0xea80('0x2d')]);if(_0x4a6edc[_0xea80('0x2e')]){delete _0x4a6edc[_0xea80('0x2e')];}_0x31e65b[_0xea80('0x1c')](_0x18370a)[_0xea80('0x2f')](_0x4a6edc);};}exports[_0xea80('0x30')]=function(_0x19fc75,_0x16a8d5){var _0x4d3380={},_0x142397={},_0x6a723b={'count':0x0,'rows':[]};var _0x3f7bc2=_[_0xea80('0x31')](db[_0xea80('0x32')][_0xea80('0x33')],function(_0x2e3edd){return{'name':_0x2e3edd['fieldName'],'type':_0x2e3edd[_0xea80('0x34')]['key']};});_0x142397[_0xea80('0x35')]=_[_0xea80('0x31')](_0x3f7bc2,_0xea80('0x2e'));_0x142397['query']=_[_0xea80('0x36')](_0x19fc75[_0xea80('0x37')]);_0x142397[_0xea80('0x38')]=_[_0xea80('0x39')](_0x142397[_0xea80('0x35')],_0x142397[_0xea80('0x37')]);_0x4d3380[_0xea80('0x3a')]=_['intersection'](_0x142397[_0xea80('0x35')],qs[_0xea80('0x3b')](_0x19fc75[_0xea80('0x37')][_0xea80('0x3b')]));_0x4d3380[_0xea80('0x3a')]=_0x4d3380[_0xea80('0x3a')][_0xea80('0x3c')]?_0x4d3380[_0xea80('0x3a')]:_0x142397['model'];if(!_0x19fc75['query'][_0xea80('0x3d')](_0xea80('0x3e'))){_0x4d3380[_0xea80('0x21')]=qs[_0xea80('0x21')](_0x19fc75['query']['limit']);_0x4d3380[_0xea80('0x1f')]=qs[_0xea80('0x1f')](_0x19fc75[_0xea80('0x37')]['offset']);}_0x4d3380['order']=qs[_0xea80('0x3f')](_0x19fc75[_0xea80('0x37')]['sort']);_0x4d3380[_0xea80('0x40')]=qs[_0xea80('0x38')](_[_0xea80('0x41')](_0x19fc75['query'],_0x142397[_0xea80('0x38')]),_0x3f7bc2);if(_0x19fc75[_0xea80('0x37')][_0xea80('0x42')]){_0x4d3380['where']=_[_0xea80('0x43')](_0x4d3380[_0xea80('0x40')],{'$or':_[_0xea80('0x31')](_0x3f7bc2,function(_0x12d510){if(_0x12d510['type']!==_0xea80('0x44')){var _0x46db2d={};_0x46db2d[_0x12d510[_0xea80('0x2e')]]={'$like':'%'+_0x19fc75['query']['filter']+'%'};return _0x46db2d;}})});}_0x4d3380=_[_0xea80('0x43')]({},_0x4d3380,_0x19fc75[_0xea80('0x45')]);var _0x90af8c={'where':_0x4d3380[_0xea80('0x40')]};return db[_0xea80('0x32')][_0xea80('0x22')](_0x90af8c)[_0xea80('0x29')](function(_0x42bbe1){_0x6a723b['count']=_0x42bbe1;if(_0x19fc75[_0xea80('0x37')][_0xea80('0x46')]){_0x4d3380['include']=[{'all':!![]}];}return db[_0xea80('0x32')][_0xea80('0x47')](_0x4d3380);})[_0xea80('0x29')](function(_0x4bb8fd){_0x6a723b[_0xea80('0x48')]=_0x4bb8fd;return _0x6a723b;})[_0xea80('0x29')](respondWithFilteredResult(_0x16a8d5,_0x4d3380))[_0xea80('0x49')](handleError(_0x16a8d5,null));};exports[_0xea80('0x4a')]=function(_0x20de65,_0x228f72){var _0x386827={'raw':!![],'where':{'id':_0x20de65[_0xea80('0x4b')]['id']}},_0x1f4316={};_0x1f4316[_0xea80('0x35')]=_[_0xea80('0x36')](db['Pause'][_0xea80('0x33')]);_0x1f4316[_0xea80('0x37')]=_[_0xea80('0x36')](_0x20de65[_0xea80('0x37')]);_0x1f4316[_0xea80('0x38')]=_[_0xea80('0x39')](_0x1f4316[_0xea80('0x35')],_0x1f4316['query']);_0x386827[_0xea80('0x3a')]=_[_0xea80('0x39')](_0x1f4316['model'],qs['fields'](_0x20de65['query'][_0xea80('0x3b')]));_0x386827[_0xea80('0x3a')]=_0x386827[_0xea80('0x3a')][_0xea80('0x3c')]?_0x386827[_0xea80('0x3a')]:_0x1f4316[_0xea80('0x35')];if(_0x20de65[_0xea80('0x37')][_0xea80('0x46')]){_0x386827[_0xea80('0x4c')]=[{'all':!![]}];}_0x386827=_[_0xea80('0x43')]({},_0x386827,_0x20de65[_0xea80('0x45')]);return db['Pause'][_0xea80('0x4d')](_0x386827)[_0xea80('0x29')](handleEntityNotFound(_0x228f72,null))[_0xea80('0x29')](respondWithResult(_0x228f72,null))[_0xea80('0x49')](handleError(_0x228f72,null));};exports[_0xea80('0x4e')]=function(_0x291ace,_0x4ede4b){return db[_0xea80('0x32')][_0xea80('0x4e')](_0x291ace[_0xea80('0x4f')],{})[_0xea80('0x29')](function(_0x3a2619){var _0x46230d=_0x291ace['user']['get']({'plain':!![]});if(!_0x46230d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x46230d[_0xea80('0x50')]==='user'){var _0x1c7175=_0x3a2619['get']({'plain':!![]});var _0x58d7f5=_0xea80('0x2b');return db[_0xea80('0x51')][_0xea80('0x4d')]({'where':{'name':_0x58d7f5,'userProfileId':_0x46230d[_0xea80('0x52')]},'raw':!![]})[_0xea80('0x29')](function(_0x1c35c1){if(_0x1c35c1&&_0x1c35c1[_0xea80('0x53')]===0x0){return db[_0xea80('0x54')][_0xea80('0x4e')]({'name':_0x1c7175[_0xea80('0x2e')],'resourceId':_0x1c7175['id'],'type':_0x1c35c1[_0xea80('0x2e')],'sectionId':_0x1c35c1['id']},{})['then'](function(){return _0x3a2619;});}else{return _0x3a2619;}})[_0xea80('0x49')](function(_0x5d2f72){logger[_0xea80('0x2c')](_0xea80('0x55'),_0x5d2f72);throw _0x5d2f72;});}return _0x3a2619;})[_0xea80('0x29')](respondWithResult(_0x4ede4b,0xc9))[_0xea80('0x49')](handleError(_0x4ede4b,null));};exports[_0xea80('0x27')]=function(_0x420a0d,_0x5e30d7){if(_0x420a0d[_0xea80('0x4f')]['id']){delete _0x420a0d[_0xea80('0x4f')]['id'];}return db['Pause'][_0xea80('0x4d')]({'where':{'id':_0x420a0d[_0xea80('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5e30d7,null))['then'](saveUpdates(_0x420a0d[_0xea80('0x4f')],null))['then'](respondWithResult(_0x5e30d7,null))[_0xea80('0x49')](handleError(_0x5e30d7,null));};exports[_0xea80('0x28')]=function(_0x1e64ac,_0x41b583){return db[_0xea80('0x32')][_0xea80('0x4d')]({'where':{'id':_0x1e64ac[_0xea80('0x4b')]['id']}})[_0xea80('0x29')](handleEntityNotFound(_0x41b583,null))[_0xea80('0x29')](removeEntity(_0x41b583,null))[_0xea80('0x49')](handleError(_0x41b583,null));}; \ No newline at end of file +var _0x9296=['path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','offset','undefined','limit','count','Content-Range','apply','update','then','Pauses','UserProfileResource','destroy','error','stack','name','rawAttributes','fieldName','key','map','keys','query','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','options','Pause','include','rows','show','params','merge','find','create','user','get','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','moment','mustache','util'];(function(_0x220394,_0x2ac91c){var _0x2dd9b5=function(_0x45442a){while(--_0x45442a){_0x220394['push'](_0x220394['shift']());}};_0x2dd9b5(++_0x2ac91c);}(_0x9296,0x90));var _0x6929=function(_0x5a069f,_0x3ef3b6){_0x5a069f=_0x5a069f-0x0;var _0x186bfc=_0x9296[_0x5a069f];return _0x186bfc;};'use strict';var emlformat=require(_0x6929('0x0'));var rimraf=require(_0x6929('0x1'));var zipdir=require(_0x6929('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6929('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x6929('0x4'));var util=require(_0x6929('0x5'));var path=require(_0x6929('0x6'));var sox=require(_0x6929('0x7'));var csv=require(_0x6929('0x8'));var ejs=require(_0x6929('0x9'));var fs=require('fs');var fs_extra=require(_0x6929('0xa'));var _=require(_0x6929('0xb'));var squel=require(_0x6929('0xc'));var crypto=require(_0x6929('0xd'));var jsforce=require(_0x6929('0xe'));var deskjs=require(_0x6929('0xf'));var toCsv=require('to-csv');var querystring=require(_0x6929('0x10'));var Papa=require(_0x6929('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6929('0x12'));var hardwareService=require(_0x6929('0x13'));var logger=require(_0x6929('0x14'))(_0x6929('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6929('0x16'))['db'];function respondWithStatusCode(_0x2e72c0,_0x16f87c){_0x16f87c=_0x16f87c||0xcc;return function(_0xd98a7){if(_0xd98a7){return _0x2e72c0[_0x6929('0x17')](_0x16f87c);}return _0x2e72c0[_0x6929('0x18')](_0x16f87c)['end']();};}function respondWithResult(_0x59877,_0x2db1f8){_0x2db1f8=_0x2db1f8||0xc8;return function(_0x44b5ff){if(_0x44b5ff){return _0x59877[_0x6929('0x18')](_0x2db1f8)['json'](_0x44b5ff);}};}function respondWithFilteredResult(_0xa007d7,_0x44ae8d){return function(_0x3cf72a){if(_0x3cf72a){var _0x187325=typeof _0x44ae8d[_0x6929('0x19')]===_0x6929('0x1a')&&typeof _0x44ae8d[_0x6929('0x1b')]===_0x6929('0x1a');var _0x3d6616=_0x3cf72a[_0x6929('0x1c')];var _0x2b0afb=_0x187325?0x0:_0x44ae8d[_0x6929('0x19')];var _0x1ae957=_0x187325?_0x3cf72a[_0x6929('0x1c')]:_0x44ae8d['offset']+_0x44ae8d['limit'];var _0xa51125;if(_0x1ae957>=_0x3d6616){_0x1ae957=_0x3d6616;_0xa51125=0xc8;}else{_0xa51125=0xce;}_0xa007d7[_0x6929('0x18')](_0xa51125);return _0xa007d7['set'](_0x6929('0x1d'),_0x2b0afb+'-'+_0x1ae957+'/'+_0x3d6616)['json'](_0x3cf72a);}return null;};}function patchUpdates(_0x184588){return function(_0x1aaf00){try{jsonpatch[_0x6929('0x1e')](_0x1aaf00,_0x184588,!![]);}catch(_0x1f3c62){return BPromise['reject'](_0x1f3c62);}return _0x1aaf00['save']();};}function saveUpdates(_0x4b4868,_0x1fbebc){return function(_0x5b6172){if(_0x5b6172){return _0x5b6172[_0x6929('0x1f')](_0x4b4868)[_0x6929('0x20')](function(_0x4d84a0){return _0x4d84a0;});}return null;};}function removeEntity(_0x3a6e33,_0x5c77b8){return function(_0x4c32fa){if(_0x4c32fa){return _0x4c32fa['destroy']()[_0x6929('0x20')](function(){var _0x24f812=_0x4c32fa['get']({'plain':!![]});var _0xb89bb4=_0x6929('0x21');return db[_0x6929('0x22')][_0x6929('0x23')]({'where':{'type':_0xb89bb4,'resourceId':_0x24f812['id']}})[_0x6929('0x20')](function(){return _0x4c32fa;});})[_0x6929('0x20')](function(){_0x3a6e33['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b45cd,_0x39da44){return function(_0xa1c58){if(!_0xa1c58){_0x5b45cd['sendStatus'](0x194);}return _0xa1c58;};}function handleError(_0x485f5e,_0x558116){_0x558116=_0x558116||0x1f4;return function(_0x3b0056){logger[_0x6929('0x24')](_0x3b0056[_0x6929('0x25')]);if(_0x3b0056[_0x6929('0x26')]){delete _0x3b0056[_0x6929('0x26')];}_0x485f5e[_0x6929('0x18')](_0x558116)['send'](_0x3b0056);};}exports['index']=function(_0x5c7248,_0x16c048){var _0x5e63ef={},_0x42d326={},_0x5b1ef2={'count':0x0,'rows':[]};var _0x5bacf0=_['map'](db['Pause'][_0x6929('0x27')],function(_0x170afe){return{'name':_0x170afe[_0x6929('0x28')],'type':_0x170afe['type'][_0x6929('0x29')]};});_0x42d326['model']=_[_0x6929('0x2a')](_0x5bacf0,_0x6929('0x26'));_0x42d326['query']=_[_0x6929('0x2b')](_0x5c7248[_0x6929('0x2c')]);_0x42d326['filters']=_['intersection'](_0x42d326[_0x6929('0x2d')],_0x42d326[_0x6929('0x2c')]);_0x5e63ef['attributes']=_[_0x6929('0x2e')](_0x42d326[_0x6929('0x2d')],qs['fields'](_0x5c7248[_0x6929('0x2c')][_0x6929('0x2f')]));_0x5e63ef[_0x6929('0x30')]=_0x5e63ef[_0x6929('0x30')][_0x6929('0x31')]?_0x5e63ef[_0x6929('0x30')]:_0x42d326[_0x6929('0x2d')];if(!_0x5c7248[_0x6929('0x2c')][_0x6929('0x32')](_0x6929('0x33'))){_0x5e63ef['limit']=qs[_0x6929('0x1b')](_0x5c7248[_0x6929('0x2c')][_0x6929('0x1b')]);_0x5e63ef[_0x6929('0x19')]=qs[_0x6929('0x19')](_0x5c7248[_0x6929('0x2c')]['offset']);}_0x5e63ef[_0x6929('0x34')]=qs['sort'](_0x5c7248[_0x6929('0x2c')][_0x6929('0x35')]);_0x5e63ef[_0x6929('0x36')]=qs[_0x6929('0x37')](_['pick'](_0x5c7248[_0x6929('0x2c')],_0x42d326[_0x6929('0x37')]),_0x5bacf0);if(_0x5c7248['query'][_0x6929('0x38')]){_0x5e63ef['where']=_['merge'](_0x5e63ef[_0x6929('0x36')],{'$or':_[_0x6929('0x2a')](_0x5bacf0,function(_0x55ae65){if(_0x55ae65['type']!==_0x6929('0x39')){var _0x2b7e52={};_0x2b7e52[_0x55ae65[_0x6929('0x26')]]={'$like':'%'+_0x5c7248[_0x6929('0x2c')][_0x6929('0x38')]+'%'};return _0x2b7e52;}})});}_0x5e63ef=_['merge']({},_0x5e63ef,_0x5c7248[_0x6929('0x3a')]);var _0x5b820c={'where':_0x5e63ef[_0x6929('0x36')]};return db[_0x6929('0x3b')][_0x6929('0x1c')](_0x5b820c)['then'](function(_0x40d92a){_0x5b1ef2[_0x6929('0x1c')]=_0x40d92a;if(_0x5c7248[_0x6929('0x2c')]['includeAll']){_0x5e63ef[_0x6929('0x3c')]=[{'all':!![]}];}return db[_0x6929('0x3b')]['findAll'](_0x5e63ef);})[_0x6929('0x20')](function(_0x2047dc){_0x5b1ef2[_0x6929('0x3d')]=_0x2047dc;return _0x5b1ef2;})[_0x6929('0x20')](respondWithFilteredResult(_0x16c048,_0x5e63ef))['catch'](handleError(_0x16c048,null));};exports[_0x6929('0x3e')]=function(_0xf0fcc2,_0x306714){var _0x26f916={'raw':!![],'where':{'id':_0xf0fcc2[_0x6929('0x3f')]['id']}},_0x3a29c2={};_0x3a29c2[_0x6929('0x2d')]=_[_0x6929('0x2b')](db['Pause'][_0x6929('0x27')]);_0x3a29c2[_0x6929('0x2c')]=_[_0x6929('0x2b')](_0xf0fcc2[_0x6929('0x2c')]);_0x3a29c2[_0x6929('0x37')]=_[_0x6929('0x2e')](_0x3a29c2['model'],_0x3a29c2[_0x6929('0x2c')]);_0x26f916[_0x6929('0x30')]=_['intersection'](_0x3a29c2['model'],qs[_0x6929('0x2f')](_0xf0fcc2[_0x6929('0x2c')]['fields']));_0x26f916['attributes']=_0x26f916['attributes'][_0x6929('0x31')]?_0x26f916[_0x6929('0x30')]:_0x3a29c2[_0x6929('0x2d')];if(_0xf0fcc2['query']['includeAll']){_0x26f916[_0x6929('0x3c')]=[{'all':!![]}];}_0x26f916=_[_0x6929('0x40')]({},_0x26f916,_0xf0fcc2[_0x6929('0x3a')]);return db['Pause'][_0x6929('0x41')](_0x26f916)[_0x6929('0x20')](handleEntityNotFound(_0x306714,null))[_0x6929('0x20')](respondWithResult(_0x306714,null))['catch'](handleError(_0x306714,null));};exports[_0x6929('0x42')]=function(_0x53a40f,_0x2ad97c){return db['Pause'][_0x6929('0x42')](_0x53a40f['body'],{})[_0x6929('0x20')](function(_0x67c26b){var _0x33a79b=_0x53a40f[_0x6929('0x43')][_0x6929('0x44')]({'plain':!![]});if(!_0x33a79b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x33a79b['role']===_0x6929('0x43')){var _0x3545c5=_0x67c26b[_0x6929('0x44')]({'plain':!![]});var _0x3b9532=_0x6929('0x21');return db[_0x6929('0x45')][_0x6929('0x41')]({'where':{'name':_0x3b9532,'userProfileId':_0x33a79b[_0x6929('0x46')]},'raw':!![]})[_0x6929('0x20')](function(_0x2d693c){if(_0x2d693c&&_0x2d693c[_0x6929('0x47')]===0x0){return db[_0x6929('0x22')][_0x6929('0x42')]({'name':_0x3545c5[_0x6929('0x26')],'resourceId':_0x3545c5['id'],'type':_0x2d693c[_0x6929('0x26')],'sectionId':_0x2d693c['id']},{})['then'](function(){return _0x67c26b;});}else{return _0x67c26b;}})[_0x6929('0x48')](function(_0x446b60){logger['error'](_0x6929('0x49'),_0x446b60);throw _0x446b60;});}return _0x67c26b;})['then'](respondWithResult(_0x2ad97c,0xc9))[_0x6929('0x48')](handleError(_0x2ad97c,null));};exports[_0x6929('0x1f')]=function(_0x5d75e0,_0x3dfa3b){if(_0x5d75e0[_0x6929('0x4a')]['id']){delete _0x5d75e0[_0x6929('0x4a')]['id'];}return db[_0x6929('0x3b')][_0x6929('0x41')]({'where':{'id':_0x5d75e0[_0x6929('0x3f')]['id']}})[_0x6929('0x20')](handleEntityNotFound(_0x3dfa3b,null))[_0x6929('0x20')](saveUpdates(_0x5d75e0['body'],null))[_0x6929('0x20')](respondWithResult(_0x3dfa3b,null))[_0x6929('0x48')](handleError(_0x3dfa3b,null));};exports[_0x6929('0x23')]=function(_0x1423c6,_0x428634){return db['Pause'][_0x6929('0x41')]({'where':{'id':_0x1423c6['params']['id']}})[_0x6929('0x20')](handleEntityNotFound(_0x428634,null))[_0x6929('0x20')](removeEntity(_0x428634,null))[_0x6929('0x48')](handleError(_0x428634,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 319e8fb..c2c8f60 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(_0x5e26c9,_0x3c6eba){var _0x5410b6=function(_0xcaea37){while(--_0xcaea37){_0x5e26c9['push'](_0x5e26c9['shift']());}};_0x5410b6(++_0x3c6eba);}(_0xf494,0x1c6));var _0x4f49=function(_0x36804b,_0x5c9362){_0x36804b=_0x36804b-0x0;var _0x16ba34=_0xf494[_0x36804b];return _0x16ba34;};'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 _0x6aa7=['Pause','tools_pauses','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','define'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6aa7,0x178));var _0x76aa=function(_0x169232,_0x74a2db){_0x169232=_0x169232-0x0;var _0x481e43=_0x6aa7[_0x169232];return _0x481e43;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var logger=require(_0x76aa('0x1'))(_0x76aa('0x2'));var moment=require(_0x76aa('0x3'));var BPromise=require(_0x76aa('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x76aa('0x5'));var rimraf=require(_0x76aa('0x6'));var config=require(_0x76aa('0x7'));var attributes=require('./pause.attributes');module['exports']=function(_0x1aceaa,_0x4d53f6){return _0x1aceaa[_0x76aa('0x8')](_0x76aa('0x9'),attributes,{'tableName':_0x76aa('0xa'),'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 9f2535a..01f451a 100644 --- a/server/api/pause/pause.rpc.js +++ b/server/api/pause/pause.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x3b6046,_0x42e96d){var _0x23a73f=function(_0x23f42d){while(--_0x23f42d){_0x3b6046['push'](_0x3b6046['shift']());}};_0x23a73f(++_0x42e96d);}(_0x7a54,0x106));var _0x47a5=function(_0x5caf30,_0x232154){_0x5caf30=_0x5caf30-0x0;var _0xd8a2d0=_0x7a54[_0x5caf30];return _0xd8a2d0;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _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(_0x37e888,_0x2471aa){var _0x4718b1=function(_0x2705dd){while(--_0x2705dd){_0x37e888['push'](_0x37e888['shift']());}};_0x4718b1(++_0x2471aa);}(_0x7a54,0x106));var _0x47a5=function(_0x5adfb2,_0x1816fa){_0x5adfb2=_0x5adfb2-0x0;var _0x40abbb=_0x7a54[_0x5adfb2];return _0x40abbb;};'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 a687fce..9c5ab97 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 _0xe14d=['isAuthenticated','index','webhookGet','/:id','show','/:id/download','diskStorage','join','root','server/files/plugins','originalname','replace','format','%s-%s%s','extname','now','post','single','file','upload','/webhook','webhookPost','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./plugin.controller','get'];(function(_0x194c66,_0x4583de){var _0x1071a7=function(_0x3e1eb9){while(--_0x3e1eb9){_0x194c66['push'](_0x194c66['shift']());}};_0x1071a7(++_0x4583de);}(_0xe14d,0x1ee));var _0xde14=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xe14d[_0x4dbaad];return _0x226c72;};'use strict';var multer=require(_0xde14('0x0'));var util=require(_0xde14('0x1'));var path=require(_0xde14('0x2'));var timeout=require(_0xde14('0x3'));var express=require('express');var router=express[_0xde14('0x4')]();var fs_extra=require(_0xde14('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xde14('0x6'));var config=require(_0xde14('0x7'));var controller=require(_0xde14('0x8'));router[_0xde14('0x9')]('/',auth[_0xde14('0xa')](),controller[_0xde14('0xb')]);router['get']('/webhook',controller[_0xde14('0xc')]);router[_0xde14('0x9')](_0xde14('0xd'),auth[_0xde14('0xa')](),controller[_0xde14('0xe')]);router[_0xde14('0x9')](_0xde14('0xf'),auth[_0xde14('0xa')](),controller['download']);var upload=multer({'storage':multer[_0xde14('0x10')]({'destination':function(_0xe785fb,_0x417269,_0x4357c7){_0x4357c7(null,path[_0xde14('0x11')](config[_0xde14('0x12')],_0xde14('0x13')));},'filename':function(_0x3d5a29,_0x34e28f,_0x29e3ca){_0x34e28f[_0xde14('0x14')]=_0x34e28f[_0xde14('0x14')][_0xde14('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x29e3ca(null,util[_0xde14('0x16')](_0xde14('0x17'),path['basename'](_0x34e28f['originalname'],path[_0xde14('0x18')](_0x34e28f[_0xde14('0x14')])),Date[_0xde14('0x19')](),path['extname'](_0x34e28f[_0xde14('0x14')])));}})});router[_0xde14('0x1a')]('/',upload[_0xde14('0x1b')](_0xde14('0x1c')),controller[_0xde14('0x1d')]);router[_0xde14('0x1a')](_0xde14('0x1e'),controller[_0xde14('0x1f')]);router[_0xde14('0x20')](_0xde14('0xd'),auth['isAuthenticated'](),controller[_0xde14('0x21')]);router[_0xde14('0x22')](_0xde14('0xd'),auth[_0xde14('0xa')](),controller['delete']);module[_0xde14('0x23')]=router; \ No newline at end of file +var _0xb903=['replace','basename','originalname','now','extname','post','single','/webhook','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','index','webhookGet','/:id','isAuthenticated','join','root'];(function(_0x58849a,_0x4d091c){var _0x4a21d6=function(_0x2581f6){while(--_0x2581f6){_0x58849a['push'](_0x58849a['shift']());}};_0x4a21d6(++_0x4d091c);}(_0xb903,0x185));var _0x3b90=function(_0x530ef5,_0x20aa2d){_0x530ef5=_0x530ef5-0x0;var _0x36be1f=_0xb903[_0x530ef5];return _0x36be1f;};'use strict';var multer=require(_0x3b90('0x0'));var util=require(_0x3b90('0x1'));var path=require(_0x3b90('0x2'));var timeout=require(_0x3b90('0x3'));var express=require('express');var router=express[_0x3b90('0x4')]();var fs_extra=require(_0x3b90('0x5'));var auth=require(_0x3b90('0x6'));var interaction=require(_0x3b90('0x7'));var config=require(_0x3b90('0x8'));var controller=require(_0x3b90('0x9'));router[_0x3b90('0xa')]('/',auth['isAuthenticated'](),controller[_0x3b90('0xb')]);router['get']('/webhook',controller[_0x3b90('0xc')]);router[_0x3b90('0xa')](_0x3b90('0xd'),auth[_0x3b90('0xe')](),controller['show']);router['get']('/:id/download',auth['isAuthenticated'](),controller['download']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x336913,_0x5af39c,_0x574955){_0x574955(null,path[_0x3b90('0xf')](config[_0x3b90('0x10')],'server/files/plugins'));},'filename':function(_0x45b75f,_0x174c0d,_0x43c08c){_0x174c0d['originalname']=_0x174c0d['originalname'][_0x3b90('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x43c08c(null,util['format']('%s-%s%s',path[_0x3b90('0x12')](_0x174c0d[_0x3b90('0x13')],path['extname'](_0x174c0d['originalname'])),Date[_0x3b90('0x14')](),path[_0x3b90('0x15')](_0x174c0d[_0x3b90('0x13')])));}})});router[_0x3b90('0x16')]('/',upload[_0x3b90('0x17')]('file'),controller['upload']);router[_0x3b90('0x16')](_0x3b90('0x18'),controller['webhookPost']);router[_0x3b90('0x19')](_0x3b90('0xd'),auth[_0x3b90('0xe')](),controller[_0x3b90('0x1a')]);router['delete'](_0x3b90('0xd'),auth['isAuthenticated'](),controller[_0x3b90('0x1b')]);module[_0x3b90('0x1c')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index d746665..9b035f8 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 _0xbc38=['STRING','ENUM','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports'];(function(_0x2b4420,_0x301ccc){var _0x5d35fd=function(_0x294412){while(--_0x294412){_0x2b4420['push'](_0x2b4420['shift']());}};_0x5d35fd(++_0x301ccc);}(_0xbc38,0xde));var _0x8bc3=function(_0x5a6644,_0x45d612){_0x5a6644=_0x5a6644-0x0;var _0x3a2a5d=_0xbc38[_0x5a6644];return _0x3a2a5d;};'use strict';var Sequelize=require(_0x8bc3('0x0'));module[_0x8bc3('0x1')]={'name':{'type':Sequelize[_0x8bc3('0x2')]},'type':{'type':Sequelize[_0x8bc3('0x3')]('html',_0x8bc3('0x4'))},'description':{'type':Sequelize[_0x8bc3('0x5')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0x8bc3('0x2')],'comment':_0x8bc3('0x6')},'active':{'type':Sequelize[_0x8bc3('0x7')],'defaultValue':0x0,'comment':_0x8bc3('0x8')},'sidebar':{'type':Sequelize['ENUM'](_0x8bc3('0x9'),_0x8bc3('0xa'),_0x8bc3('0xb'),_0x8bc3('0xc')),'defaultValue':'always','comment':_0x8bc3('0xd')},'icon':{'type':Sequelize[_0x8bc3('0x2')]},'adminUrl':{'type':Sequelize[_0x8bc3('0x2')]},'agentUrl':{'type':Sequelize[_0x8bc3('0x2')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0x8bc3('0x2')]}}; \ No newline at end of file +var _0xf356=['adminOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','ENUM','html','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'];(function(_0x363940,_0x4bff01){var _0x27de5d=function(_0xab0473){while(--_0xab0473){_0x363940['push'](_0x363940['shift']());}};_0x27de5d(++_0x4bff01);}(_0xf356,0x115));var _0x6f35=function(_0x2b8e88,_0x1e2ed3){_0x2b8e88=_0x2b8e88-0x0;var _0x39ce35=_0xf356[_0x2b8e88];return _0x39ce35;};'use strict';var Sequelize=require(_0x6f35('0x0'));module[_0x6f35('0x1')]={'name':{'type':Sequelize[_0x6f35('0x2')]},'type':{'type':Sequelize[_0x6f35('0x3')](_0x6f35('0x4'),'script')},'description':{'type':Sequelize[_0x6f35('0x5')]},'version':{'type':Sequelize[_0x6f35('0x5')]},'path':{'type':Sequelize[_0x6f35('0x2')],'comment':_0x6f35('0x6')},'active':{'type':Sequelize[_0x6f35('0x7')],'defaultValue':0x0,'comment':_0x6f35('0x8')},'sidebar':{'type':Sequelize[_0x6f35('0x3')](_0x6f35('0x9'),'agentOnly',_0x6f35('0xa'),_0x6f35('0xb')),'defaultValue':_0x6f35('0xa'),'comment':_0x6f35('0xc')},'icon':{'type':Sequelize[_0x6f35('0x2')]},'adminUrl':{'type':Sequelize[_0x6f35('0x2')]},'agentUrl':{'type':Sequelize[_0x6f35('0x2')]},'scriptName':{'type':Sequelize[_0x6f35('0x2')]},'scriptPath':{'type':Sequelize[_0x6f35('0x2')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index bf0afe2..b313a66 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 _0xed3d=['Warning:\x20agent\x20view\x20not\x20specified','create','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','port','http://localhost:','encoding','%s%s','headers','content-length','content-type','set','statusCode','webhookPost','resolve','method','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','rimraf','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./plugin.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','reject','save','update','then','destroy','get','Plugins','UserProfileResource','error','name','send','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','map','type','VIRTUAL','merge','options','Plugin','includeAll','include','findAll','rows','show','params','find','download','join','root','format','%s.zip','basename','createWriteStream','zip','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','glob','**/*','server/files/plugins','dirname','node_modules/**/*','finalize','close','existsSync','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','catch','upload','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','isFile','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','Invalid\x20manifest:\x20parameters\x20missing','html','parameters','views','Invalid\x20manifest:\x20views\x20missing','agent','script','scriptName','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','admin','test','Warning:\x20admin\x20view\x20not\x20specified','plugins'];(function(_0x58243e,_0x1518fc){var _0x563877=function(_0x4ef09c){while(--_0x4ef09c){_0x58243e['push'](_0x58243e['shift']());}};_0x563877(++_0x1518fc);}(_0xed3d,0x17a));var _0xded3=function(_0x24af03,_0x2a1ad3){_0x24af03=_0x24af03-0x0;var _0x3895b8=_0xed3d[_0x24af03];return _0x3895b8;};'use strict';var emlformat=require(_0xded3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xded3('0x1'));var jsonpatch=require(_0xded3('0x2'));var rp=require(_0xded3('0x3'));var moment=require(_0xded3('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xded3('0x5'));var util=require(_0xded3('0x6'));var path=require(_0xded3('0x7'));var sox=require(_0xded3('0x8'));var csv=require(_0xded3('0x9'));var ejs=require(_0xded3('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xded3('0xb'));var squel=require(_0xded3('0xc'));var crypto=require(_0xded3('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xded3('0xe'));var toCsv=require(_0xded3('0x9'));var querystring=require(_0xded3('0xf'));var Papa=require(_0xded3('0x10'));var extract=require('extract-zip');var rimraf=require(_0xded3('0x11'));var archiver=require(_0xded3('0x12'));var Redis=require(_0xded3('0x13'));var authService=require(_0xded3('0x14'));var qs=require(_0xded3('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xded3('0x16'));var logger=require(_0xded3('0x17'))(_0xded3('0x18'));var utils=require('../../config/utils');var config=require(_0xded3('0x19'));var licenseUtil=require(_0xded3('0x1a'));var db=require(_0xded3('0x1b'))['db'];config[_0xded3('0x1c')]=_[_0xded3('0x1d')](config[_0xded3('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0xded3('0x1e'))(new Redis(config[_0xded3('0x1c')]));require(_0xded3('0x1f'))[_0xded3('0x20')](socket);function respondWithStatusCode(_0x5ccf56,_0x3d56da){_0x3d56da=_0x3d56da||0xcc;return function(_0x20682c){if(_0x20682c){return _0x5ccf56[_0xded3('0x21')](_0x3d56da);}return _0x5ccf56[_0xded3('0x22')](_0x3d56da)[_0xded3('0x23')]();};}function respondWithResult(_0x2c31fd,_0x43c11d){_0x43c11d=_0x43c11d||0xc8;return function(_0x41cc98){if(_0x41cc98){return _0x2c31fd[_0xded3('0x22')](_0x43c11d)[_0xded3('0x24')](_0x41cc98);}};}function respondWithFilteredResult(_0x375a5a,_0x3aab3a){return function(_0x1316a0){if(_0x1316a0){var _0x5f3001=typeof _0x3aab3a[_0xded3('0x25')]==='undefined'&&typeof _0x3aab3a['limit']===_0xded3('0x26');var _0x4b816c=_0x1316a0[_0xded3('0x27')];var _0x3b2f12=_0x5f3001?0x0:_0x3aab3a[_0xded3('0x25')];var _0x35a2a9=_0x5f3001?_0x1316a0[_0xded3('0x27')]:_0x3aab3a['offset']+_0x3aab3a[_0xded3('0x28')];var _0x50e81b;if(_0x35a2a9>=_0x4b816c){_0x35a2a9=_0x4b816c;_0x50e81b=0xc8;}else{_0x50e81b=0xce;}_0x375a5a[_0xded3('0x22')](_0x50e81b);return _0x375a5a['set'](_0xded3('0x29'),_0x3b2f12+'-'+_0x35a2a9+'/'+_0x4b816c)[_0xded3('0x24')](_0x1316a0);}return null;};}function patchUpdates(_0x3101e9){return function(_0x3b3f75){try{jsonpatch['apply'](_0x3b3f75,_0x3101e9,!![]);}catch(_0x401d2d){return BPromise[_0xded3('0x2a')](_0x401d2d);}return _0x3b3f75[_0xded3('0x2b')]();};}function saveUpdates(_0x1c1fa6,_0x3981b0){return function(_0x3fc80){if(_0x3fc80){return _0x3fc80[_0xded3('0x2c')](_0x1c1fa6)[_0xded3('0x2d')](function(_0x206d08){return _0x206d08;});}return null;};}function removeEntity(_0x1a9fa8,_0x1c0e22){return function(_0x15d925){if(_0x15d925){return _0x15d925[_0xded3('0x2e')]()[_0xded3('0x2d')](function(){var _0x2243df=_0x15d925[_0xded3('0x2f')]({'plain':!![]});var _0x3cc3a5=_0xded3('0x30');return db[_0xded3('0x31')][_0xded3('0x2e')]({'where':{'type':_0x3cc3a5,'resourceId':_0x2243df['id']}})[_0xded3('0x2d')](function(){return _0x15d925;});})[_0xded3('0x2d')](function(){_0x1a9fa8[_0xded3('0x22')](0xcc)[_0xded3('0x23')]();});}};}function handleEntityNotFound(_0x28e1e0,_0x16d803){return function(_0x25a260){if(!_0x25a260){_0x28e1e0[_0xded3('0x21')](0x194);}return _0x25a260;};}function handleError(_0x5d342c,_0x1b2fd5){_0x1b2fd5=_0x1b2fd5||0x1f4;return function(_0x21420c){logger[_0xded3('0x32')](_0x21420c['stack']);if(_0x21420c[_0xded3('0x33')]){delete _0x21420c['name'];}_0x5d342c[_0xded3('0x22')](_0x1b2fd5)[_0xded3('0x34')](_0x21420c);};}exports['index']=function(_0x1f67b4,_0x42f416){var _0x5bb5db={},_0x457bca={},_0x2113bd={'count':0x0,'rows':[]};var _0x151abc=_['map'](db['Plugin'][_0xded3('0x35')],function(_0x4361ce){return{'name':_0x4361ce[_0xded3('0x36')],'type':_0x4361ce['type'][_0xded3('0x37')]};});_0x457bca[_0xded3('0x38')]=_['map'](_0x151abc,'name');_0x457bca[_0xded3('0x39')]=_[_0xded3('0x3a')](_0x1f67b4[_0xded3('0x39')]);_0x457bca[_0xded3('0x3b')]=_[_0xded3('0x3c')](_0x457bca[_0xded3('0x38')],_0x457bca[_0xded3('0x39')]);_0x5bb5db[_0xded3('0x3d')]=_[_0xded3('0x3c')](_0x457bca[_0xded3('0x38')],qs[_0xded3('0x3e')](_0x1f67b4['query']['fields']));_0x5bb5db['attributes']=_0x5bb5db[_0xded3('0x3d')][_0xded3('0x3f')]?_0x5bb5db[_0xded3('0x3d')]:_0x457bca[_0xded3('0x38')];if(!_0x1f67b4[_0xded3('0x39')][_0xded3('0x40')](_0xded3('0x41'))){_0x5bb5db[_0xded3('0x28')]=qs[_0xded3('0x28')](_0x1f67b4[_0xded3('0x39')]['limit']);_0x5bb5db[_0xded3('0x25')]=qs[_0xded3('0x25')](_0x1f67b4[_0xded3('0x39')]['offset']);}_0x5bb5db[_0xded3('0x42')]=qs[_0xded3('0x43')](_0x1f67b4['query'][_0xded3('0x43')]);_0x5bb5db['where']=qs[_0xded3('0x3b')](_['pick'](_0x1f67b4['query'],_0x457bca['filters']),_0x151abc);if(_0x1f67b4[_0xded3('0x39')][_0xded3('0x44')]){_0x5bb5db['where']=_['merge'](_0x5bb5db[_0xded3('0x45')],{'$or':_[_0xded3('0x46')](_0x151abc,function(_0x32ec8f){if(_0x32ec8f[_0xded3('0x47')]!==_0xded3('0x48')){var _0x1d5ae2={};_0x1d5ae2[_0x32ec8f[_0xded3('0x33')]]={'$like':'%'+_0x1f67b4[_0xded3('0x39')][_0xded3('0x44')]+'%'};return _0x1d5ae2;}})});}_0x5bb5db=_[_0xded3('0x49')]({},_0x5bb5db,_0x1f67b4[_0xded3('0x4a')]);var _0x5828fa={'where':_0x5bb5db[_0xded3('0x45')]};return db[_0xded3('0x4b')]['count'](_0x5828fa)['then'](function(_0x44f956){_0x2113bd['count']=_0x44f956;if(_0x1f67b4[_0xded3('0x39')][_0xded3('0x4c')]){_0x5bb5db[_0xded3('0x4d')]=[{'all':!![]}];}return db[_0xded3('0x4b')][_0xded3('0x4e')](_0x5bb5db);})[_0xded3('0x2d')](function(_0x4eadf1){_0x2113bd[_0xded3('0x4f')]=_0x4eadf1;return _0x2113bd;})[_0xded3('0x2d')](respondWithFilteredResult(_0x42f416,_0x5bb5db))['catch'](handleError(_0x42f416,null));};exports[_0xded3('0x50')]=function(_0x46bb78,_0x530b5b){var _0x4f59bd={'raw':!![],'where':{'id':_0x46bb78[_0xded3('0x51')]['id']}},_0x59e87f={};_0x59e87f['model']=_[_0xded3('0x3a')](db[_0xded3('0x4b')][_0xded3('0x35')]);_0x59e87f[_0xded3('0x39')]=_['keys'](_0x46bb78[_0xded3('0x39')]);_0x59e87f['filters']=_[_0xded3('0x3c')](_0x59e87f['model'],_0x59e87f['query']);_0x4f59bd[_0xded3('0x3d')]=_[_0xded3('0x3c')](_0x59e87f[_0xded3('0x38')],qs[_0xded3('0x3e')](_0x46bb78[_0xded3('0x39')][_0xded3('0x3e')]));_0x4f59bd[_0xded3('0x3d')]=_0x4f59bd[_0xded3('0x3d')][_0xded3('0x3f')]?_0x4f59bd['attributes']:_0x59e87f[_0xded3('0x38')];if(_0x46bb78['query']['includeAll']){_0x4f59bd[_0xded3('0x4d')]=[{'all':!![]}];}_0x4f59bd=_[_0xded3('0x49')]({},_0x4f59bd,_0x46bb78['options']);return db[_0xded3('0x4b')][_0xded3('0x52')](_0x4f59bd)[_0xded3('0x2d')](handleEntityNotFound(_0x530b5b,null))[_0xded3('0x2d')](respondWithResult(_0x530b5b,null))['catch'](handleError(_0x530b5b,null));};exports[_0xded3('0x53')]=function(_0x33dba4,_0x1eab3c,_0x2af631){return db['Plugin']['find']({'where':{'id':_0x33dba4['params']['id']},'attributes':[_0xded3('0x33'),'path'],'raw':!![]})['then'](handleEntityNotFound(_0x1eab3c,null))[_0xded3('0x2d')](function(_0x4be810){if(_0x4be810){var _0x57c70b=path[_0xded3('0x54')](config[_0xded3('0x55')],'server/files/plugins',util[_0xded3('0x56')](_0xded3('0x57'),path[_0xded3('0x58')](_0x4be810[_0xded3('0x7')])));var _0x2229f9=fs[_0xded3('0x59')](_0x57c70b);var _0x2d2dc6=archiver(_0xded3('0x5a'),{'zlib':{'level':0x9}});_0x2d2dc6['on'](_0xded3('0x5b'),function(_0x5a29cb){if(_0x5a29cb[_0xded3('0x5c')]===_0xded3('0x5d')){logger['error'](_0x5a29cb);}else{throw new db[(_0xded3('0x5e'))][(_0xded3('0x5f'))](_0xded3('0x60'));}});_0x2d2dc6['on'](_0xded3('0x32'),function(_0x58679c){throw new db[(_0xded3('0x5e'))]['Error'](_0xded3('0x60'));});_0x2d2dc6['pipe'](_0x2229f9);_0x2d2dc6[_0xded3('0x61')](_0xded3('0x62'),{'cwd':path['join'](config['root'],_0xded3('0x63'),path[_0xded3('0x64')](_0x4be810[_0xded3('0x7')])),'ignore':[path['join'](path['basename'](_0x4be810[_0xded3('0x7')]),_0xded3('0x65')),path[_0xded3('0x54')](path[_0xded3('0x58')](_0x4be810[_0xded3('0x7')]),'attachments/**/*')],'nodir':!![]})[_0xded3('0x66')]();_0x2229f9['on'](_0xded3('0x67'),function(){if(!fs[_0xded3('0x68')](_0x57c70b)){throw new db[(_0xded3('0x5e'))][(_0xded3('0x5f'))]('Plugin\x20not\x20found');}return _0x1eab3c['download'](_0x57c70b,util[_0xded3('0x56')]('%s.zip',path[_0xded3('0x58')](_0x4be810[_0xded3('0x7')])),function(_0x3bc045){if(_0x3bc045){throw new db[(_0xded3('0x5e'))][(_0xded3('0x5f'))](_0xded3('0x69'));}fs[_0xded3('0x6a')](_0x57c70b);logger[_0xded3('0x6b')](_0xded3('0x6c'));logger[_0xded3('0x6b')](_0xded3('0x6d'));});});}return null;})[_0xded3('0x6e')](handleError(_0x1eab3c,null));};exports[_0xded3('0x6f')]=function(_0x4ff4a2,_0x5b24bc,_0x4749f7){var _0x3114d4=path['basename'](_0x4ff4a2[_0xded3('0x70')][_0xded3('0x71')],path[_0xded3('0x72')](_0x4ff4a2[_0xded3('0x70')][_0xded3('0x71')]));var _0x283148=path[_0xded3('0x54')](config[_0xded3('0x55')],'server/files/plugins',_0x4ff4a2[_0xded3('0x70')][_0xded3('0x71')]);var _0xe13b3c=path[_0xded3('0x54')](config[_0xded3('0x55')],'server/files/plugins',_0x3114d4);logger[_0xded3('0x6b')](_0xded3('0x73'),_0x283148);logger[_0xded3('0x6b')]('Plugin\x20upload\x20destination:\x20%s',_0xe13b3c);try{fs[_0xded3('0x74')](_0x283148,parseInt(_0xded3('0x75'),0x8));extract(_0x283148,{'dir':_0xe13b3c},function(_0x2a2f40){if(_0x2a2f40){logger['error'](_0x2a2f40);handleError(_0x2a2f40,!![]);};var _0x3a77f2=fs[_0xded3('0x76')](_0xe13b3c);if(_0x3a77f2[_0xded3('0x3f')]>0x1){removeReferences(_0x283148,_0xe13b3c);logger[_0xded3('0x32')](_0xded3('0x77'));return _0x4749f7(new Error('Invalid\x20plugin\x20structure'));}var _0x247bff=fs['lstatSync'](path[_0xded3('0x54')](_0xe13b3c,_0x3a77f2[0x0]));if(_0x247bff[_0xded3('0x78')]()){removeReferences(_0x283148,_0xe13b3c);logger[_0xded3('0x32')](_0xded3('0x77'));return _0x4749f7(new Error('Invalid\x20plugin\x20structure'));}if(_0x247bff[_0xded3('0x79')]()){var _0xe58a67=fs[_0xded3('0x76')](path[_0xded3('0x54')](_0xe13b3c,_0x3a77f2[0x0]));if(_0xe58a67[_0xded3('0x3f')]===0x0){removeReferences(_0x283148,_0xe13b3c);logger[_0xded3('0x32')]('Invalid\x20plugin\x20structure');return _0x4749f7(new Error(_0xded3('0x77')));}var _0x4270e9=_0xe58a67[_0xded3('0x7a')](function(_0x3ee4e3){return _0x3ee4e3===_0xded3('0x7b');});if(!_0x4270e9){return _0x4749f7(new Error(_0xded3('0x7c')));}var _0x1ba1e1=fs['readFileSync'](path[_0xded3('0x54')](_0xe13b3c,_0x3a77f2[0x0],_0xded3('0x7b')));var _0xbb5d9c=JSON[_0xded3('0x7d')](_0x1ba1e1);if('undefined'==typeof _0xbb5d9c[_0xded3('0x33')]){return _0x4749f7(new Error(_0xded3('0x7e')));}if(_0xded3('0x26')==typeof _0xbb5d9c[_0xded3('0x47')]){return _0x4749f7(new Error(_0xded3('0x7f')));}if(_0xded3('0x26')==typeof _0xbb5d9c[_0xded3('0x80')]){return _0x4749f7(new Error(_0xded3('0x81')));}if('undefined'==typeof _0xbb5d9c['parameters']){return _0x4749f7(new Error(_0xded3('0x82')));}if(_0xbb5d9c[_0xded3('0x47')]===_0xded3('0x83')){if(_0xded3('0x26')==typeof _0xbb5d9c[_0xded3('0x84')][_0xded3('0x85')]){return _0x4749f7(new Error(_0xded3('0x86')));}if(_0xded3('0x26')==typeof _0xbb5d9c[_0xded3('0x84')][_0xded3('0x85')]['admin']&&'undefined'==typeof _0xbb5d9c[_0xded3('0x84')]['views'][_0xded3('0x87')]){return _0x4749f7(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0xbb5d9c[_0xded3('0x47')]===_0xded3('0x88')){if(_0xded3('0x26')==typeof _0xbb5d9c['parameters'][_0xded3('0x89')]){return _0x4749f7(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0xded3('0x26')==typeof _0xbb5d9c[_0xded3('0x84')][_0xded3('0x8a')]){return _0x4749f7(new Error(_0xded3('0x8b')));}}else{return _0x4749f7(new Error(_0xded3('0x8c')));}var _0x49bede=_0xbb5d9c[_0xded3('0x33')];var _0x3f6e43=_0xbb5d9c[_0xded3('0x8d')];var _0x2ab2c9=_0xbb5d9c[_0xded3('0x47')];var _0x1b67bb=_0xbb5d9c['sidebar']?_0xbb5d9c[_0xded3('0x8e')]:_0xded3('0x8f');var _0x588ea2=_0xbb5d9c[_0xded3('0x90')]?_0xbb5d9c[_0xded3('0x90')]:_0xded3('0x91');var _0x1f6ef2='';var _0x15e4c6='';var _0x5406d4='';var _0x3f01e4='';var _0x1432a4=_0xbb5d9c[_0xded3('0x80')];if(_0x2ab2c9==='html'){if(_0xded3('0x26')!=typeof _0xbb5d9c['parameters'][_0xded3('0x85')][_0xded3('0x92')]){var _0x1e90e0=_0xbb5d9c[_0xded3('0x84')]['views'][_0xded3('0x92')];if(!/^(f|ht)tps?:\/\//i[_0xded3('0x93')](_0x1e90e0)){_0x1f6ef2=path[_0xded3('0x54')]('plugins',_0x3114d4,_0x3a77f2[0x0],_0x1e90e0);}else{_0x1f6ef2=_0x1e90e0;}}else{logger[_0xded3('0x6b')](_0xded3('0x94'));}if('undefined'!=typeof _0xbb5d9c['parameters'][_0xded3('0x85')][_0xded3('0x87')]){var _0x39f62e=_0xbb5d9c[_0xded3('0x84')][_0xded3('0x85')]['agent'];if(!/^(f|ht)tps?:\/\//i['test'](_0x39f62e)){_0x15e4c6=path['join'](_0xded3('0x95'),_0x3114d4,_0x3a77f2[0x0],_0x39f62e);}else{_0x15e4c6=_0x39f62e;}}else{logger['info'](_0xded3('0x96'));}}else if(_0x2ab2c9==='script'){_0x5406d4=_0xbb5d9c[_0xded3('0x84')][_0xded3('0x89')];_0x3f01e4=_0xbb5d9c[_0xded3('0x84')]['scriptPath'];if(_0xded3('0x26')!=typeof _0xbb5d9c[_0xded3('0x84')][_0xded3('0x85')]){if(_0xded3('0x26')!=typeof _0xbb5d9c[_0xded3('0x84')]['views'][_0xded3('0x92')]){var _0x1e90e0=_0xbb5d9c[_0xded3('0x84')][_0xded3('0x85')][_0xded3('0x92')];if(!/^(f|ht)tps?:\/\//i['test'](_0x1e90e0)){_0x1f6ef2=path['join'](_0xded3('0x95'),_0x3114d4,_0x3a77f2[0x0],_0x1e90e0);}else{_0x1f6ef2=_0x1e90e0;}}if(_0xded3('0x26')!=typeof _0xbb5d9c[_0xded3('0x84')]['views'][_0xded3('0x87')]){var _0x39f62e=_0xbb5d9c[_0xded3('0x84')][_0xded3('0x85')][_0xded3('0x87')];if(!/^(f|ht)tps?:\/\//i[_0xded3('0x93')](_0x39f62e)){_0x15e4c6=path[_0xded3('0x54')]('plugins',_0x3114d4,_0x3a77f2[0x0],_0x39f62e);}else{_0x15e4c6=_0x39f62e;}}}}var _0x24c3ac={'name':_0x49bede,'description':_0x3f6e43,'path':path[_0xded3('0x54')](_0x3114d4,_0x3a77f2[0x0]),'type':_0x2ab2c9,'sidebar':_0x1b67bb,'icon':_0x588ea2,'adminUrl':_0x1f6ef2,'agentUrl':_0x15e4c6,'scriptName':_0x5406d4,'scriptPath':_0x3f01e4,'version':_0x1432a4};removeReferences(_0x283148,null);return db[_0xded3('0x4b')][_0xded3('0x97')](_0x24c3ac)[_0xded3('0x2d')](function(_0x3c1f16){var _0x45788e={'role':_0x4ff4a2[_0xded3('0x98')][_0xded3('0x99')],'userProfileId':_0x4ff4a2[_0xded3('0x98')]['userProfileId']};if(!_0x45788e)throw new Error(_0xded3('0x9a'));if(_0x45788e[_0xded3('0x99')]===_0xded3('0x9b')){var _0x2f9beb=_0x3c1f16[_0xded3('0x2f')]({'plain':!![]});return db[_0xded3('0x9c')][_0xded3('0x52')]({'where':{'name':_0xded3('0x30'),'userProfileId':_0x45788e[_0xded3('0x9d')]},'raw':!![]})[_0xded3('0x2d')](function(_0x4db320){if(_0x4db320&&_0x4db320['autoAssociation']===0x0){return db[_0xded3('0x31')][_0xded3('0x97')]({'name':_0x2f9beb['name'],'resourceId':_0x2f9beb['id'],'type':_0x4db320[_0xded3('0x33')],'sectionId':_0x4db320['id']},{})[_0xded3('0x2d')](function(){return _0x3c1f16;});}else{return _0x3c1f16;}})['catch'](function(_0x29d6c5){logger['error'](_0xded3('0x9e'),_0x29d6c5);throw _0x29d6c5;});}return _0x3c1f16;})[_0xded3('0x2d')](respondWithResult(_0x5b24bc,null))[_0xded3('0x6e')](handleError(_0x5b24bc,null));}});}catch(_0xfd5f96){_0x5b24bc[_0xded3('0x22')](0x1f4)[_0xded3('0x34')](_0xfd5f96);}};function removeReferences(_0x4beb30,_0x46446b){try{if(_0x4beb30){fs[_0xded3('0x6a')](_0x4beb30);logger['info'](_0xded3('0x9f'));}if(_0x46446b){rimraf(_0x46446b,function(){});logger[_0xded3('0x6b')](_0xded3('0xa0'));}}catch(_0x1125ec){logger['error'](_0x1125ec);}}exports[_0xded3('0x2c')]=function(_0x54c9e2,_0x3210fa,_0xba4dd4){return db['Plugin']['find']({'where':{'id':_0x54c9e2[_0xded3('0x51')]['id']}})[_0xded3('0x2d')](handleEntityNotFound(_0x3210fa,null))['then'](saveUpdates(_0x54c9e2[_0xded3('0x98')],null))[_0xded3('0x2d')](respondWithResult(_0x3210fa,null))['catch'](handleError(_0x3210fa,null));};exports[_0xded3('0xa1')]=function(_0x278c89,_0x2e1467,_0x44ab5d){return db['Plugin'][_0xded3('0x52')]({'where':{'id':_0x278c89[_0xded3('0x51')]['id']}})[_0xded3('0x2d')](function(_0x48f0ab){if(_0x48f0ab){return _0x48f0ab[_0xded3('0x2e')]();}})[_0xded3('0x2d')](function(_0x1015c0){rimraf(path['join'](config[_0xded3('0x55')],'server/files/plugins',path[_0xded3('0x64')](_0x1015c0[_0xded3('0x7')])),function(){});return _0x1015c0;})[_0xded3('0x2d')](handleEntityNotFound(_0x2e1467,null))['then'](respondWithStatusCode(_0x2e1467,null))['catch'](handleError(_0x2e1467,null));};exports['webhookGet']=function(_0x480313,_0x17b909,_0xa269d5){return BPromise['resolve']()[_0xded3('0x2d')](function(){if(!_0x480313[_0xded3('0x39')]['path']){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x480313[_0xded3('0x39')]['port']){throw new Error(_0xded3('0xa2'));}var _0x26bc72=_0x480313[_0xded3('0x39')][_0xded3('0xa3')]?_0x480313[_0xded3('0x39')]['hostname']+':'+_0x480313[_0xded3('0x39')][_0xded3('0xa4')]:_0xded3('0xa5')+_0x480313[_0xded3('0x39')][_0xded3('0xa4')];var _0x5421b9=_0x480313[_0xded3('0x39')][_0xded3('0x24')]?_0x480313['query'][_0xded3('0x24')]:!![];var _0xe1eff2=_0x480313['query'][_0xded3('0xa6')]?_0x480313['query'][_0xded3('0xa6')]:null;var _0x29bf46={'method':_0x480313['method'],'uri':util['format'](_0xded3('0xa7'),_0x26bc72,_0x480313[_0xded3('0x39')][_0xded3('0x7')]),'json':_0x5421b9,'resolveWithFullResponse':!![],'encoding':_0xe1eff2,'qs':_0x480313['query']};if(_0x480313['headers']){_0x29bf46[_0xded3('0xa8')]=_0x480313[_0xded3('0xa8')];if(_0x29bf46[_0xded3('0xa8')]['content-length']){delete _0x29bf46['headers'][_0xded3('0xa9')];}}if(_0x29bf46[_0xded3('0xa8')][_0xded3('0xaa')]){delete _0x29bf46['headers']['content-type'];}return rp(_0x29bf46);})[_0xded3('0x2d')](function(_0x1d2891){if(_0x1d2891){_0x17b909[_0xded3('0xab')](_0x1d2891[_0xded3('0xa8')]);logger['info'](_0x1d2891[_0xded3('0x98')]);if(_['endsWith'](_0x480313[_0xded3('0x39')][_0xded3('0x7')],_0xded3('0x53'))&&_0x1d2891['statusCode']==0x1f4){return _0x17b909[_0xded3('0x21')](_0x1d2891['statusCode']);}else{return _0x17b909[_0xded3('0x22')](_0x1d2891[_0xded3('0xac')])['send'](_0x1d2891[_0xded3('0x98')]);}}else{return _0x17b909[_0xded3('0x21')](0xc8);}})['catch'](handleError(_0x17b909,null));};exports[_0xded3('0xad')]=function(_0xc4de81,_0x451d56,_0x34c8ac){return BPromise[_0xded3('0xae')]()[_0xded3('0x2d')](function(){if(!_0xc4de81['query'][_0xded3('0x7')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0xc4de81[_0xded3('0x39')]['port']){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x1e0e99=_0xc4de81[_0xded3('0x39')]['hostname']?_0xc4de81['query'][_0xded3('0xa3')]+':'+_0xc4de81[_0xded3('0x39')]['port']:_0xded3('0xa5')+_0xc4de81['query'][_0xded3('0xa4')];var _0x11d8ef=_0xc4de81[_0xded3('0x39')][_0xded3('0x24')]?_0xc4de81[_0xded3('0x39')][_0xded3('0x24')]:!![];var _0x4a6b22=_0xc4de81[_0xded3('0x39')]['encoding']?_0xc4de81[_0xded3('0x39')][_0xded3('0xa6')]:null;var _0x2402cc={'method':_0xc4de81[_0xded3('0xaf')],'uri':util['format'](_0xded3('0xa7'),_0x1e0e99,_0xc4de81[_0xded3('0x39')]['path']),'json':_0x11d8ef,'resolveWithFullResponse':!![],'encoding':_0x4a6b22,'body':_0xc4de81[_0xded3('0x98')]};if(_0xc4de81[_0xded3('0xa8')]){_0x2402cc[_0xded3('0xa8')]=_0xc4de81[_0xded3('0xa8')];if(_0x2402cc[_0xded3('0xa8')]['content-length']){delete _0x2402cc[_0xded3('0xa8')][_0xded3('0xa9')];}}if(_0x2402cc[_0xded3('0xa8')]['content-type']){delete _0x2402cc[_0xded3('0xa8')][_0xded3('0xaa')];}return rp(_0x2402cc);})['then'](function(_0x546f9c){if(_0x546f9c){_0x451d56['set'](_0x546f9c['headers']);logger['info'](_0x546f9c[_0xded3('0x98')]);return _0x451d56[_0xded3('0x22')](_0x546f9c['statusCode'])['send'](_0x546f9c[_0xded3('0x98')]);}else{return _0x451d56[_0xded3('0x21')](0xc8);}})[_0xded3('0x6e')](handleError(_0x451d56,null));}; \ No newline at end of file +var _0x21ca=['desk.js','querystring','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./plugin.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','get','Plugins','sendStatus','error','stack','name','send','index','map','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','Plugin','includeAll','include','rows','params','keys','rawAttributes','length','find','join','root','server/files/plugins','format','%s.zip','basename','createWriteStream','zip','code','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','glob','**/*','dirname','node_modules/**/*','attachments/**/*','close','existsSync','Sequelize','Plugin\x20not\x20found','download','unlinkSync','Download\x20completed','info','file','extname','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','Invalid\x20manifest:\x20parameters\x20missing','views','Invalid\x20manifest:\x20views\x20missing','parameters','admin','agent','scriptName','Invalid\x20manifest:\x20script\x20path\x20missing','description','sidebar','html','Warning:\x20admin\x20view\x20not\x20specified','test','plugins','script','scriptPath','create','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','hostname','encoding','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','method','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x21ca,0x1da));var _0xa21c=function(_0xa18834,_0x2bc658){_0xa18834=_0xa18834-0x0;var _0x2fbbce=_0x21ca[_0xa18834];return _0x2fbbce;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa21c('0x0'));var zipdir=require(_0xa21c('0x1'));var jsonpatch=require(_0xa21c('0x2'));var rp=require(_0xa21c('0x3'));var moment=require(_0xa21c('0x4'));var BPromise=require(_0xa21c('0x5'));var Mustache=require('mustache');var util=require(_0xa21c('0x6'));var path=require(_0xa21c('0x7'));var sox=require(_0xa21c('0x8'));var csv=require(_0xa21c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa21c('0xa'));var _=require(_0xa21c('0xb'));var squel=require(_0xa21c('0xc'));var crypto=require(_0xa21c('0xd'));var jsforce=require(_0xa21c('0xe'));var deskjs=require(_0xa21c('0xf'));var toCsv=require(_0xa21c('0x9'));var querystring=require(_0xa21c('0x10'));var Papa=require('papaparse');var extract=require(_0xa21c('0x11'));var rimraf=require('rimraf');var archiver=require(_0xa21c('0x12'));var Redis=require(_0xa21c('0x13'));var authService=require(_0xa21c('0x14'));var qs=require(_0xa21c('0x15'));var as=require(_0xa21c('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa21c('0x17'));var utils=require(_0xa21c('0x18'));var config=require(_0xa21c('0x19'));var licenseUtil=require(_0xa21c('0x1a'));var db=require('../../mysqldb')['db'];config[_0xa21c('0x1b')]=_[_0xa21c('0x1c')](config[_0xa21c('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0xa21c('0x1d'))(new Redis(config[_0xa21c('0x1b')]));require(_0xa21c('0x1e'))[_0xa21c('0x1f')](socket);function respondWithStatusCode(_0x211a70,_0x1e041f){_0x1e041f=_0x1e041f||0xcc;return function(_0x2c8126){if(_0x2c8126){return _0x211a70['sendStatus'](_0x1e041f);}return _0x211a70[_0xa21c('0x20')](_0x1e041f)[_0xa21c('0x21')]();};}function respondWithResult(_0x2e92e2,_0x1d585b){_0x1d585b=_0x1d585b||0xc8;return function(_0x26e447){if(_0x26e447){return _0x2e92e2[_0xa21c('0x20')](_0x1d585b)[_0xa21c('0x22')](_0x26e447);}};}function respondWithFilteredResult(_0x1482ce,_0x4f265f){return function(_0x2dcb76){if(_0x2dcb76){var _0x206284=typeof _0x4f265f[_0xa21c('0x23')]===_0xa21c('0x24')&&typeof _0x4f265f[_0xa21c('0x25')]===_0xa21c('0x24');var _0x5dda4f=_0x2dcb76[_0xa21c('0x26')];var _0x65a499=_0x206284?0x0:_0x4f265f[_0xa21c('0x23')];var _0x1e60b4=_0x206284?_0x2dcb76[_0xa21c('0x26')]:_0x4f265f[_0xa21c('0x23')]+_0x4f265f['limit'];var _0x34916b;if(_0x1e60b4>=_0x5dda4f){_0x1e60b4=_0x5dda4f;_0x34916b=0xc8;}else{_0x34916b=0xce;}_0x1482ce[_0xa21c('0x20')](_0x34916b);return _0x1482ce[_0xa21c('0x27')](_0xa21c('0x28'),_0x65a499+'-'+_0x1e60b4+'/'+_0x5dda4f)['json'](_0x2dcb76);}return null;};}function patchUpdates(_0x17f3ab){return function(_0x5e6d69){try{jsonpatch[_0xa21c('0x29')](_0x5e6d69,_0x17f3ab,!![]);}catch(_0x515ff9){return BPromise['reject'](_0x515ff9);}return _0x5e6d69['save']();};}function saveUpdates(_0x20e25f,_0x22abb7){return function(_0x1af165){if(_0x1af165){return _0x1af165[_0xa21c('0x2a')](_0x20e25f)[_0xa21c('0x2b')](function(_0x2027da){return _0x2027da;});}return null;};}function removeEntity(_0xfa6569,_0x171b98){return function(_0x1b8f74){if(_0x1b8f74){return _0x1b8f74[_0xa21c('0x2c')]()['then'](function(){var _0x5395d1=_0x1b8f74[_0xa21c('0x2d')]({'plain':!![]});var _0x1f2dd3=_0xa21c('0x2e');return db['UserProfileResource']['destroy']({'where':{'type':_0x1f2dd3,'resourceId':_0x5395d1['id']}})[_0xa21c('0x2b')](function(){return _0x1b8f74;});})[_0xa21c('0x2b')](function(){_0xfa6569[_0xa21c('0x20')](0xcc)[_0xa21c('0x21')]();});}};}function handleEntityNotFound(_0x35c5ca,_0x115cac){return function(_0x513586){if(!_0x513586){_0x35c5ca[_0xa21c('0x2f')](0x194);}return _0x513586;};}function handleError(_0x28fdbf,_0x2d4637){_0x2d4637=_0x2d4637||0x1f4;return function(_0x4a6abb){logger[_0xa21c('0x30')](_0x4a6abb[_0xa21c('0x31')]);if(_0x4a6abb[_0xa21c('0x32')]){delete _0x4a6abb[_0xa21c('0x32')];}_0x28fdbf[_0xa21c('0x20')](_0x2d4637)[_0xa21c('0x33')](_0x4a6abb);};}exports[_0xa21c('0x34')]=function(_0x407f48,_0x429617){var _0x51cf73={},_0x5646cf={},_0xf0769={'count':0x0,'rows':[]};var _0x5c66bd=_[_0xa21c('0x35')](db['Plugin']['rawAttributes'],function(_0x45294e){return{'name':_0x45294e['fieldName'],'type':_0x45294e[_0xa21c('0x36')][_0xa21c('0x37')]};});_0x5646cf[_0xa21c('0x38')]=_[_0xa21c('0x35')](_0x5c66bd,_0xa21c('0x32'));_0x5646cf[_0xa21c('0x39')]=_['keys'](_0x407f48['query']);_0x5646cf[_0xa21c('0x3a')]=_[_0xa21c('0x3b')](_0x5646cf['model'],_0x5646cf[_0xa21c('0x39')]);_0x51cf73[_0xa21c('0x3c')]=_[_0xa21c('0x3b')](_0x5646cf[_0xa21c('0x38')],qs[_0xa21c('0x3d')](_0x407f48[_0xa21c('0x39')][_0xa21c('0x3d')]));_0x51cf73[_0xa21c('0x3c')]=_0x51cf73['attributes']['length']?_0x51cf73['attributes']:_0x5646cf[_0xa21c('0x38')];if(!_0x407f48[_0xa21c('0x39')][_0xa21c('0x3e')](_0xa21c('0x3f'))){_0x51cf73['limit']=qs[_0xa21c('0x25')](_0x407f48[_0xa21c('0x39')][_0xa21c('0x25')]);_0x51cf73['offset']=qs[_0xa21c('0x23')](_0x407f48['query'][_0xa21c('0x23')]);}_0x51cf73[_0xa21c('0x40')]=qs['sort'](_0x407f48[_0xa21c('0x39')][_0xa21c('0x41')]);_0x51cf73['where']=qs[_0xa21c('0x3a')](_[_0xa21c('0x42')](_0x407f48[_0xa21c('0x39')],_0x5646cf['filters']),_0x5c66bd);if(_0x407f48[_0xa21c('0x39')][_0xa21c('0x43')]){_0x51cf73[_0xa21c('0x44')]=_[_0xa21c('0x45')](_0x51cf73[_0xa21c('0x44')],{'$or':_[_0xa21c('0x35')](_0x5c66bd,function(_0x25c6f4){if(_0x25c6f4[_0xa21c('0x36')]!==_0xa21c('0x46')){var _0x19e4af={};_0x19e4af[_0x25c6f4[_0xa21c('0x32')]]={'$like':'%'+_0x407f48[_0xa21c('0x39')]['filter']+'%'};return _0x19e4af;}})});}_0x51cf73=_[_0xa21c('0x45')]({},_0x51cf73,_0x407f48['options']);var _0x2803f5={'where':_0x51cf73['where']};return db[_0xa21c('0x47')][_0xa21c('0x26')](_0x2803f5)[_0xa21c('0x2b')](function(_0x512511){_0xf0769[_0xa21c('0x26')]=_0x512511;if(_0x407f48[_0xa21c('0x39')][_0xa21c('0x48')]){_0x51cf73[_0xa21c('0x49')]=[{'all':!![]}];}return db[_0xa21c('0x47')]['findAll'](_0x51cf73);})[_0xa21c('0x2b')](function(_0x5abaa8){_0xf0769[_0xa21c('0x4a')]=_0x5abaa8;return _0xf0769;})[_0xa21c('0x2b')](respondWithFilteredResult(_0x429617,_0x51cf73))['catch'](handleError(_0x429617,null));};exports['show']=function(_0x5ec017,_0x7fc6fa){var _0x421b85={'raw':!![],'where':{'id':_0x5ec017[_0xa21c('0x4b')]['id']}},_0x2b9c30={};_0x2b9c30['model']=_[_0xa21c('0x4c')](db[_0xa21c('0x47')][_0xa21c('0x4d')]);_0x2b9c30[_0xa21c('0x39')]=_['keys'](_0x5ec017['query']);_0x2b9c30[_0xa21c('0x3a')]=_[_0xa21c('0x3b')](_0x2b9c30['model'],_0x2b9c30['query']);_0x421b85['attributes']=_['intersection'](_0x2b9c30[_0xa21c('0x38')],qs[_0xa21c('0x3d')](_0x5ec017['query']['fields']));_0x421b85[_0xa21c('0x3c')]=_0x421b85[_0xa21c('0x3c')][_0xa21c('0x4e')]?_0x421b85['attributes']:_0x2b9c30['model'];if(_0x5ec017[_0xa21c('0x39')][_0xa21c('0x48')]){_0x421b85['include']=[{'all':!![]}];}_0x421b85=_[_0xa21c('0x45')]({},_0x421b85,_0x5ec017['options']);return db['Plugin'][_0xa21c('0x4f')](_0x421b85)[_0xa21c('0x2b')](handleEntityNotFound(_0x7fc6fa,null))[_0xa21c('0x2b')](respondWithResult(_0x7fc6fa,null))['catch'](handleError(_0x7fc6fa,null));};exports['download']=function(_0x32f03b,_0x4a32b9,_0x2d152d){return db[_0xa21c('0x47')][_0xa21c('0x4f')]({'where':{'id':_0x32f03b['params']['id']},'attributes':['name','path'],'raw':!![]})[_0xa21c('0x2b')](handleEntityNotFound(_0x4a32b9,null))[_0xa21c('0x2b')](function(_0x1cce0c){if(_0x1cce0c){var _0x42dfbd=path[_0xa21c('0x50')](config[_0xa21c('0x51')],_0xa21c('0x52'),util[_0xa21c('0x53')](_0xa21c('0x54'),path[_0xa21c('0x55')](_0x1cce0c['path'])));var _0x14c664=fs[_0xa21c('0x56')](_0x42dfbd);var _0x3d23b4=archiver(_0xa21c('0x57'),{'zlib':{'level':0x9}});_0x3d23b4['on']('warning',function(_0x3b2be2){if(_0x3b2be2[_0xa21c('0x58')]==='ENOENT'){logger[_0xa21c('0x30')](_0x3b2be2);}else{throw new db['Sequelize'][(_0xa21c('0x59'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0x3d23b4['on'](_0xa21c('0x30'),function(_0x3c0538){throw new db['Sequelize'][(_0xa21c('0x59'))](_0xa21c('0x5a'));});_0x3d23b4['pipe'](_0x14c664);_0x3d23b4[_0xa21c('0x5b')](_0xa21c('0x5c'),{'cwd':path[_0xa21c('0x50')](config[_0xa21c('0x51')],_0xa21c('0x52'),path[_0xa21c('0x5d')](_0x1cce0c[_0xa21c('0x7')])),'ignore':[path[_0xa21c('0x50')](path[_0xa21c('0x55')](_0x1cce0c[_0xa21c('0x7')]),_0xa21c('0x5e')),path[_0xa21c('0x50')](path[_0xa21c('0x55')](_0x1cce0c[_0xa21c('0x7')]),_0xa21c('0x5f'))],'nodir':!![]})['finalize']();_0x14c664['on'](_0xa21c('0x60'),function(){if(!fs[_0xa21c('0x61')](_0x42dfbd)){throw new db[(_0xa21c('0x62'))][(_0xa21c('0x59'))](_0xa21c('0x63'));}return _0x4a32b9[_0xa21c('0x64')](_0x42dfbd,util[_0xa21c('0x53')](_0xa21c('0x54'),path[_0xa21c('0x55')](_0x1cce0c[_0xa21c('0x7')])),function(_0x22f541){if(_0x22f541){throw new db[(_0xa21c('0x62'))]['Error']('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0xa21c('0x65')](_0x42dfbd);logger['info'](_0xa21c('0x66'));logger[_0xa21c('0x67')]('Temporary\x20file\x20removed');});});}return null;})['catch'](handleError(_0x4a32b9,null));};exports['upload']=function(_0x9af56d,_0x3e562a,_0x5a484d){var _0x547238=path[_0xa21c('0x55')](_0x9af56d[_0xa21c('0x68')]['filename'],path[_0xa21c('0x69')](_0x9af56d[_0xa21c('0x68')][_0xa21c('0x6a')]));var _0x2d2518=path[_0xa21c('0x50')](config['root'],_0xa21c('0x52'),_0x9af56d[_0xa21c('0x68')][_0xa21c('0x6a')]);var _0x5d395e=path[_0xa21c('0x50')](config[_0xa21c('0x51')],'server/files/plugins',_0x547238);logger[_0xa21c('0x67')](_0xa21c('0x6b'),_0x2d2518);logger[_0xa21c('0x67')](_0xa21c('0x6c'),_0x5d395e);try{fs['chmodSync'](_0x2d2518,parseInt('0777',0x8));extract(_0x2d2518,{'dir':_0x5d395e},function(_0x9bc4ca){if(_0x9bc4ca){logger[_0xa21c('0x30')](_0x9bc4ca);handleError(_0x9bc4ca,!![]);};var _0x1d15d0=fs[_0xa21c('0x6d')](_0x5d395e);if(_0x1d15d0[_0xa21c('0x4e')]>0x1){removeReferences(_0x2d2518,_0x5d395e);logger['error'](_0xa21c('0x6e'));return _0x5a484d(new Error(_0xa21c('0x6e')));}var _0x575f86=fs[_0xa21c('0x6f')](path[_0xa21c('0x50')](_0x5d395e,_0x1d15d0[0x0]));if(_0x575f86[_0xa21c('0x70')]()){removeReferences(_0x2d2518,_0x5d395e);logger[_0xa21c('0x30')](_0xa21c('0x6e'));return _0x5a484d(new Error('Invalid\x20plugin\x20structure'));}if(_0x575f86[_0xa21c('0x71')]()){var _0x25b90f=fs[_0xa21c('0x6d')](path[_0xa21c('0x50')](_0x5d395e,_0x1d15d0[0x0]));if(_0x25b90f['length']===0x0){removeReferences(_0x2d2518,_0x5d395e);logger['error'](_0xa21c('0x6e'));return _0x5a484d(new Error(_0xa21c('0x6e')));}var _0x312db5=_0x25b90f['some'](function(_0x1540c2){return _0x1540c2===_0xa21c('0x72');});if(!_0x312db5){return _0x5a484d(new Error(_0xa21c('0x73')));}var _0x8372f2=fs[_0xa21c('0x74')](path[_0xa21c('0x50')](_0x5d395e,_0x1d15d0[0x0],_0xa21c('0x72')));var _0x1008c9=JSON[_0xa21c('0x75')](_0x8372f2);if(_0xa21c('0x24')==typeof _0x1008c9[_0xa21c('0x32')]){return _0x5a484d(new Error('Invalid\x20manifest:\x20name\x20missing'));}if(_0xa21c('0x24')==typeof _0x1008c9[_0xa21c('0x36')]){return _0x5a484d(new Error(_0xa21c('0x76')));}if('undefined'==typeof _0x1008c9[_0xa21c('0x77')]){return _0x5a484d(new Error(_0xa21c('0x78')));}if(_0xa21c('0x24')==typeof _0x1008c9['parameters']){return _0x5a484d(new Error(_0xa21c('0x79')));}if(_0x1008c9[_0xa21c('0x36')]==='html'){if(_0xa21c('0x24')==typeof _0x1008c9['parameters'][_0xa21c('0x7a')]){return _0x5a484d(new Error(_0xa21c('0x7b')));}if('undefined'==typeof _0x1008c9[_0xa21c('0x7c')]['views'][_0xa21c('0x7d')]&&_0xa21c('0x24')==typeof _0x1008c9['parameters']['views'][_0xa21c('0x7e')]){return _0x5a484d(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x1008c9[_0xa21c('0x36')]==='script'){if(_0xa21c('0x24')==typeof _0x1008c9[_0xa21c('0x7c')][_0xa21c('0x7f')]){return _0x5a484d(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0xa21c('0x24')==typeof _0x1008c9[_0xa21c('0x7c')]['scriptPath']){return _0x5a484d(new Error(_0xa21c('0x80')));}}else{return _0x5a484d(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x3af1c8=_0x1008c9['name'];var _0x384632=_0x1008c9[_0xa21c('0x81')];var _0x96df02=_0x1008c9[_0xa21c('0x36')];var _0x17d449=_0x1008c9[_0xa21c('0x82')]?_0x1008c9[_0xa21c('0x82')]:'always';var _0x629daf=_0x1008c9['icon']?_0x1008c9['icon']:'icon-apps';var _0x2781c5='';var _0x15677b='';var _0x1165d2='';var _0x3190af='';var _0x4537af=_0x1008c9[_0xa21c('0x77')];if(_0x96df02===_0xa21c('0x83')){if(_0xa21c('0x24')!=typeof _0x1008c9['parameters'][_0xa21c('0x7a')][_0xa21c('0x7d')]){var _0x4b9506=_0x1008c9[_0xa21c('0x7c')][_0xa21c('0x7a')]['admin'];if(!/^(f|ht)tps?:\/\//i['test'](_0x4b9506)){_0x2781c5=path[_0xa21c('0x50')]('plugins',_0x547238,_0x1d15d0[0x0],_0x4b9506);}else{_0x2781c5=_0x4b9506;}}else{logger[_0xa21c('0x67')](_0xa21c('0x84'));}if(_0xa21c('0x24')!=typeof _0x1008c9['parameters'][_0xa21c('0x7a')][_0xa21c('0x7e')]){var _0x574f9e=_0x1008c9['parameters'][_0xa21c('0x7a')][_0xa21c('0x7e')];if(!/^(f|ht)tps?:\/\//i[_0xa21c('0x85')](_0x574f9e)){_0x15677b=path['join'](_0xa21c('0x86'),_0x547238,_0x1d15d0[0x0],_0x574f9e);}else{_0x15677b=_0x574f9e;}}else{logger[_0xa21c('0x67')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x96df02===_0xa21c('0x87')){_0x1165d2=_0x1008c9[_0xa21c('0x7c')]['scriptName'];_0x3190af=_0x1008c9[_0xa21c('0x7c')][_0xa21c('0x88')];if(_0xa21c('0x24')!=typeof _0x1008c9[_0xa21c('0x7c')][_0xa21c('0x7a')]){if(_0xa21c('0x24')!=typeof _0x1008c9[_0xa21c('0x7c')][_0xa21c('0x7a')][_0xa21c('0x7d')]){var _0x4b9506=_0x1008c9[_0xa21c('0x7c')][_0xa21c('0x7a')][_0xa21c('0x7d')];if(!/^(f|ht)tps?:\/\//i[_0xa21c('0x85')](_0x4b9506)){_0x2781c5=path[_0xa21c('0x50')](_0xa21c('0x86'),_0x547238,_0x1d15d0[0x0],_0x4b9506);}else{_0x2781c5=_0x4b9506;}}if(_0xa21c('0x24')!=typeof _0x1008c9[_0xa21c('0x7c')][_0xa21c('0x7a')][_0xa21c('0x7e')]){var _0x574f9e=_0x1008c9[_0xa21c('0x7c')]['views']['agent'];if(!/^(f|ht)tps?:\/\//i['test'](_0x574f9e)){_0x15677b=path[_0xa21c('0x50')]('plugins',_0x547238,_0x1d15d0[0x0],_0x574f9e);}else{_0x15677b=_0x574f9e;}}}}var _0x59315c={'name':_0x3af1c8,'description':_0x384632,'path':path[_0xa21c('0x50')](_0x547238,_0x1d15d0[0x0]),'type':_0x96df02,'sidebar':_0x17d449,'icon':_0x629daf,'adminUrl':_0x2781c5,'agentUrl':_0x15677b,'scriptName':_0x1165d2,'scriptPath':_0x3190af,'version':_0x4537af};removeReferences(_0x2d2518,null);return db['Plugin'][_0xa21c('0x89')](_0x59315c)[_0xa21c('0x2b')](function(_0x2d1de4){var _0x460901={'role':_0x9af56d[_0xa21c('0x8a')]['role'],'userProfileId':_0x9af56d[_0xa21c('0x8a')][_0xa21c('0x8b')]};if(!_0x460901)throw new Error(_0xa21c('0x8c'));if(_0x460901[_0xa21c('0x8d')]==='user'){var _0x24183d=_0x2d1de4[_0xa21c('0x2d')]({'plain':!![]});return db[_0xa21c('0x8e')]['find']({'where':{'name':_0xa21c('0x2e'),'userProfileId':_0x460901[_0xa21c('0x8b')]},'raw':!![]})[_0xa21c('0x2b')](function(_0x6b9d92){if(_0x6b9d92&&_0x6b9d92[_0xa21c('0x8f')]===0x0){return db[_0xa21c('0x90')][_0xa21c('0x89')]({'name':_0x24183d[_0xa21c('0x32')],'resourceId':_0x24183d['id'],'type':_0x6b9d92['name'],'sectionId':_0x6b9d92['id']},{})[_0xa21c('0x2b')](function(){return _0x2d1de4;});}else{return _0x2d1de4;}})[_0xa21c('0x91')](function(_0x17d5d4){logger[_0xa21c('0x30')](_0xa21c('0x92'),_0x17d5d4);throw _0x17d5d4;});}return _0x2d1de4;})[_0xa21c('0x2b')](respondWithResult(_0x3e562a,null))[_0xa21c('0x91')](handleError(_0x3e562a,null));}});}catch(_0x3b0977){_0x3e562a[_0xa21c('0x20')](0x1f4)[_0xa21c('0x33')](_0x3b0977);}};function removeReferences(_0x267153,_0x51100f){try{if(_0x267153){fs[_0xa21c('0x65')](_0x267153);logger[_0xa21c('0x67')](_0xa21c('0x93'));}if(_0x51100f){rimraf(_0x51100f,function(){});logger[_0xa21c('0x67')]('Extracted\x20folder\x20removed');}}catch(_0x537e7a){logger[_0xa21c('0x30')](_0x537e7a);}}exports[_0xa21c('0x2a')]=function(_0x36a7bb,_0x3ee81b,_0x3883e7){return db['Plugin'][_0xa21c('0x4f')]({'where':{'id':_0x36a7bb[_0xa21c('0x4b')]['id']}})[_0xa21c('0x2b')](handleEntityNotFound(_0x3ee81b,null))[_0xa21c('0x2b')](saveUpdates(_0x36a7bb[_0xa21c('0x8a')],null))[_0xa21c('0x2b')](respondWithResult(_0x3ee81b,null))[_0xa21c('0x91')](handleError(_0x3ee81b,null));};exports[_0xa21c('0x94')]=function(_0x492a82,_0xbf5af0,_0x1dccc4){return db[_0xa21c('0x47')][_0xa21c('0x4f')]({'where':{'id':_0x492a82['params']['id']}})[_0xa21c('0x2b')](function(_0x233477){if(_0x233477){return _0x233477[_0xa21c('0x2c')]();}})[_0xa21c('0x2b')](function(_0x1759c3){rimraf(path['join'](config[_0xa21c('0x51')],_0xa21c('0x52'),path[_0xa21c('0x5d')](_0x1759c3[_0xa21c('0x7')])),function(){});return _0x1759c3;})[_0xa21c('0x2b')](handleEntityNotFound(_0xbf5af0,null))[_0xa21c('0x2b')](respondWithStatusCode(_0xbf5af0,null))[_0xa21c('0x91')](handleError(_0xbf5af0,null));};exports[_0xa21c('0x95')]=function(_0x27f0a4,_0x5b3adb,_0x62685e){return BPromise[_0xa21c('0x96')]()['then'](function(){if(!_0x27f0a4[_0xa21c('0x39')][_0xa21c('0x7')]){throw new Error(_0xa21c('0x97'));}if(!_0x27f0a4[_0xa21c('0x39')][_0xa21c('0x98')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x9847d9=_0x27f0a4[_0xa21c('0x39')][_0xa21c('0x99')]?_0x27f0a4[_0xa21c('0x39')][_0xa21c('0x99')]+':'+_0x27f0a4[_0xa21c('0x39')][_0xa21c('0x98')]:'http://localhost:'+_0x27f0a4['query'][_0xa21c('0x98')];var _0x21a9e8=_0x27f0a4[_0xa21c('0x39')][_0xa21c('0x22')]?_0x27f0a4['query'][_0xa21c('0x22')]:!![];var _0x20442e=_0x27f0a4['query'][_0xa21c('0x9a')]?_0x27f0a4['query'][_0xa21c('0x9a')]:null;var _0x2cdba0={'method':_0x27f0a4['method'],'uri':util['format'](_0xa21c('0x9b'),_0x9847d9,_0x27f0a4[_0xa21c('0x39')][_0xa21c('0x7')]),'json':_0x21a9e8,'resolveWithFullResponse':!![],'encoding':_0x20442e,'qs':_0x27f0a4[_0xa21c('0x39')]};if(_0x27f0a4[_0xa21c('0x9c')]){_0x2cdba0['headers']=_0x27f0a4['headers'];if(_0x2cdba0['headers'][_0xa21c('0x9d')]){delete _0x2cdba0[_0xa21c('0x9c')][_0xa21c('0x9d')];}}if(_0x2cdba0[_0xa21c('0x9c')]['content-type']){delete _0x2cdba0['headers'][_0xa21c('0x9e')];}return rp(_0x2cdba0);})[_0xa21c('0x2b')](function(_0x55e38a){if(_0x55e38a){_0x5b3adb[_0xa21c('0x27')](_0x55e38a['headers']);logger[_0xa21c('0x67')](_0x55e38a[_0xa21c('0x8a')]);if(_[_0xa21c('0x9f')](_0x27f0a4['query'][_0xa21c('0x7')],_0xa21c('0x64'))&&_0x55e38a['statusCode']==0x1f4){return _0x5b3adb['sendStatus'](_0x55e38a[_0xa21c('0xa0')]);}else{return _0x5b3adb[_0xa21c('0x20')](_0x55e38a[_0xa21c('0xa0')])[_0xa21c('0x33')](_0x55e38a['body']);}}else{return _0x5b3adb['sendStatus'](0xc8);}})[_0xa21c('0x91')](handleError(_0x5b3adb,null));};exports[_0xa21c('0xa1')]=function(_0x264b53,_0x2be029,_0x55a975){return BPromise['resolve']()['then'](function(){if(!_0x264b53[_0xa21c('0x39')][_0xa21c('0x7')]){throw new Error(_0xa21c('0x97'));}if(!_0x264b53[_0xa21c('0x39')][_0xa21c('0x98')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x496323=_0x264b53['query']['hostname']?_0x264b53[_0xa21c('0x39')]['hostname']+':'+_0x264b53[_0xa21c('0x39')][_0xa21c('0x98')]:'http://localhost:'+_0x264b53['query'][_0xa21c('0x98')];var _0x5c1a3d=_0x264b53[_0xa21c('0x39')]['json']?_0x264b53[_0xa21c('0x39')][_0xa21c('0x22')]:!![];var _0x147af3=_0x264b53[_0xa21c('0x39')][_0xa21c('0x9a')]?_0x264b53[_0xa21c('0x39')][_0xa21c('0x9a')]:null;var _0x254894={'method':_0x264b53[_0xa21c('0xa2')],'uri':util[_0xa21c('0x53')](_0xa21c('0x9b'),_0x496323,_0x264b53[_0xa21c('0x39')][_0xa21c('0x7')]),'json':_0x5c1a3d,'resolveWithFullResponse':!![],'encoding':_0x147af3,'body':_0x264b53[_0xa21c('0x8a')]};if(_0x264b53['headers']){_0x254894[_0xa21c('0x9c')]=_0x264b53['headers'];if(_0x254894[_0xa21c('0x9c')]['content-length']){delete _0x254894['headers'][_0xa21c('0x9d')];}}if(_0x254894['headers'][_0xa21c('0x9e')]){delete _0x254894[_0xa21c('0x9c')][_0xa21c('0x9e')];}return rp(_0x254894);})[_0xa21c('0x2b')](function(_0x59e9e9){if(_0x59e9e9){_0x2be029[_0xa21c('0x27')](_0x59e9e9['headers']);logger[_0xa21c('0x67')](_0x59e9e9[_0xa21c('0x8a')]);return _0x2be029['status'](_0x59e9e9[_0xa21c('0xa0')])[_0xa21c('0x33')](_0x59e9e9['body']);}else{return _0x2be029[_0xa21c('0x2f')](0xc8);}})['catch'](handleError(_0x2be029,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index b09c618..53cfa00 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 _0x9b69=['hasOwnProperty','hook','exports','events','../../mysqldb','Plugin','update','emit'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0x9b69,0xa3));var _0x99b6=function(_0x29a16c,_0x3ab75d){_0x29a16c=_0x29a16c-0x0;var _0x2bdce1=_0x9b69[_0x29a16c];return _0x2bdce1;};'use strict';var EventEmitter=require(_0x99b6('0x0'));var Plugin=require(_0x99b6('0x1'))['db'][_0x99b6('0x2')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x99b6('0x3'),'afterDestroy':'remove'};function emitEvent(_0x2d5904){return function(_0x3a05b4,_0x293e09,_0x4a62c6){PluginEvents[_0x99b6('0x4')](_0x2d5904+':'+_0x3a05b4['id'],_0x3a05b4);PluginEvents['emit'](_0x2d5904,_0x3a05b4);_0x4a62c6(null);};}for(var e in events){if(events[_0x99b6('0x5')](e)){var event=events[e];Plugin[_0x99b6('0x6')](e,emitEvent(event));}}module[_0x99b6('0x7')]=PluginEvents; \ No newline at end of file +var _0xe714=['hasOwnProperty','hook','events','Plugin','setMaxListeners','save','update','emit'];(function(_0x75f869,_0x3690d6){var _0x10af8b=function(_0x22d3ff){while(--_0x22d3ff){_0x75f869['push'](_0x75f869['shift']());}};_0x10af8b(++_0x3690d6);}(_0xe714,0xe2));var _0x4e71=function(_0x5289ea,_0x6ab309){_0x5289ea=_0x5289ea-0x0;var _0xd318b8=_0xe714[_0x5289ea];return _0xd318b8;};'use strict';var EventEmitter=require(_0x4e71('0x0'));var Plugin=require('../../mysqldb')['db'][_0x4e71('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0x4e71('0x2')](0x0);var events={'afterCreate':_0x4e71('0x3'),'afterUpdate':_0x4e71('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2ae210){return function(_0x59a685,_0xad5224,_0x19e056){PluginEvents[_0x4e71('0x5')](_0x2ae210+':'+_0x59a685['id'],_0x59a685);PluginEvents[_0x4e71('0x5')](_0x2ae210,_0x59a685);_0x19e056(null);};}for(var e in events){if(events[_0x4e71('0x6')](e)){var event=events[e];Plugin[_0x4e71('0x7')](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index ea5d1a8..7553c4b 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 _0x66d0=['Plugin','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','exports','define'];(function(_0x1afddb,_0x5f3f9e){var _0x129bb5=function(_0x1625d5){while(--_0x1625d5){_0x1afddb['push'](_0x1afddb['shift']());}};_0x129bb5(++_0x5f3f9e);}(_0x66d0,0x135));var _0x066d=function(_0x836465,_0x5442ae){_0x836465=_0x836465-0x0;var _0x2150ea=_0x66d0[_0x836465];return _0x2150ea;};'use strict';var _=require(_0x066d('0x0'));var util=require(_0x066d('0x1'));var logger=require(_0x066d('0x2'))(_0x066d('0x3'));var moment=require(_0x066d('0x4'));var BPromise=require('bluebird');var rp=require(_0x066d('0x5'));var fs=require('fs');var path=require(_0x066d('0x6'));var rimraf=require('rimraf');var config=require(_0x066d('0x7'));var attributes=require('./plugin.attributes');module[_0x066d('0x8')]=function(_0x51d902,_0x1ccae9){return _0x51d902[_0x066d('0x9')](_0x066d('0xa'),attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xedb6=['moment','request-promise','../../config/environment','./plugin.attributes','exports','define','Plugin','plugins','lodash','util','../../config/logger','api'];(function(_0x293926,_0x323811){var _0x38aafa=function(_0x1b2a40){while(--_0x1b2a40){_0x293926['push'](_0x293926['shift']());}};_0x38aafa(++_0x323811);}(_0xedb6,0x14c));var _0x6edb=function(_0x58cbde,_0x4b0f62){_0x58cbde=_0x58cbde-0x0;var _0x5799f3=_0xedb6[_0x58cbde];return _0x5799f3;};'use strict';var _=require(_0x6edb('0x0'));var util=require(_0x6edb('0x1'));var logger=require(_0x6edb('0x2'))(_0x6edb('0x3'));var moment=require(_0x6edb('0x4'));var BPromise=require('bluebird');var rp=require(_0x6edb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6edb('0x6'));var attributes=require(_0x6edb('0x7'));module[_0x6edb('0x8')]=function(_0x469567,_0x265033){return _0x469567[_0x6edb('0x9')](_0x6edb('0xa'),attributes,{'tableName':_0x6edb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index b0e09aa..160e799 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 _0xcfa0=['bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./plugin.socket','register','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','Plugin','body','options','CreatePlugin','catch','lodash','moment'];(function(_0x462937,_0x4bff0e){var _0x2b6138=function(_0x26b99a){while(--_0x26b99a){_0x462937['push'](_0x462937['shift']());}};_0x2b6138(++_0x4bff0e);}(_0xcfa0,0xde));var _0x0cfa=function(_0x361b43,_0x134fc9){_0x361b43=_0x361b43-0x0;var _0x41b835=_0xcfa0[_0x361b43];return _0x41b835;};'use strict';var _=require(_0x0cfa('0x0'));var util=require('util');var moment=require(_0x0cfa('0x1'));var BPromise=require(_0x0cfa('0x2'));var rs=require(_0x0cfa('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0cfa('0x4'))['db'];var utils=require(_0x0cfa('0x5'));var logger=require('../../config/logger')(_0x0cfa('0x6'));var config=require(_0x0cfa('0x7'));var jayson=require(_0x0cfa('0x8'));var client=jayson['client'][_0x0cfa('0x9')]({'port':0x232a});config[_0x0cfa('0xa')]=_[_0x0cfa('0xb')](config[_0x0cfa('0xa')],{'host':_0x0cfa('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0cfa('0xa')]));require(_0x0cfa('0xd'))[_0x0cfa('0xe')](socket);function respondWithRpcPromise(_0x52f39a,_0x33ed83,_0xe76ff0){return new BPromise(function(_0x489dc0,_0x3c70d9){return client[_0x0cfa('0xf')](_0x52f39a,_0xe76ff0)[_0x0cfa('0x10')](function(_0x377f92){logger[_0x0cfa('0x11')](_0x0cfa('0x12'),_0x33ed83,_0x0cfa('0x13'));logger[_0x0cfa('0x14')](_0x0cfa('0x15'),_0x33ed83,_0x0cfa('0x13'),JSON[_0x0cfa('0x16')](_0x377f92));if(_0x377f92[_0x0cfa('0x17')]){if(_0x377f92[_0x0cfa('0x17')][_0x0cfa('0x18')]===0x1f4){logger[_0x0cfa('0x17')]('Plugin,\x20%s,\x20%s',_0x33ed83,_0x377f92['error'][_0x0cfa('0x19')]);return _0x3c70d9(_0x377f92[_0x0cfa('0x17')][_0x0cfa('0x19')]);}logger['error'](_0x0cfa('0x12'),_0x33ed83,_0x377f92['error'][_0x0cfa('0x19')]);return _0x489dc0(_0x377f92[_0x0cfa('0x17')]['message']);}else{logger[_0x0cfa('0x11')](_0x0cfa('0x12'),_0x33ed83,_0x0cfa('0x13'));_0x489dc0(_0x377f92[_0x0cfa('0x1a')][_0x0cfa('0x19')]);}})['catch'](function(_0x5a0c73){logger[_0x0cfa('0x17')](_0x0cfa('0x12'),_0x33ed83,_0x5a0c73);_0x3c70d9(_0x5a0c73);});});}exports['CreatePlugin']=function(_0x1ad825){var _0x5787f1=this;return new Promise(function(_0x568c40,_0x37f7d2){return db[_0x0cfa('0x1b')]['create'](_0x1ad825[_0x0cfa('0x1c')],{'raw':_0x1ad825[_0x0cfa('0x1d')]?_0x1ad825['options']['raw']===undefined?!![]:![]:!![]})[_0x0cfa('0x10')](function(_0x12cdfa){logger['info'](_0x0cfa('0x1e'),_0x1ad825);logger[_0x0cfa('0x14')](_0x0cfa('0x1e'),_0x1ad825,JSON[_0x0cfa('0x16')](_0x12cdfa));_0x568c40(_0x12cdfa);})[_0x0cfa('0x1f')](function(_0x3b0c7d){logger['error']('CreatePlugin',_0x3b0c7d[_0x0cfa('0x19')],_0x1ad825);_0x37f7d2(_0x5787f1[_0x0cfa('0x17')](0x1f4,_0x3b0c7d[_0x0cfa('0x19')]));});});}; \ No newline at end of file +var _0x834b=['options','raw','then','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./plugin.socket','register','request','Plugin,\x20%s,\x20%s','debug','Plugin,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','CreatePlugin','body'];(function(_0x16ac16,_0x45feff){var _0x4a6a29=function(_0x3aac8){while(--_0x3aac8){_0x16ac16['push'](_0x16ac16['shift']());}};_0x4a6a29(++_0x45feff);}(_0x834b,0x113));var _0xb834=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x834b[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0xb834('0x0'));var util=require(_0xb834('0x1'));var moment=require(_0xb834('0x2'));var BPromise=require('bluebird');var rs=require(_0xb834('0x3'));var fs=require('fs');var Redis=require(_0xb834('0x4'));var db=require(_0xb834('0x5'))['db'];var utils=require(_0xb834('0x6'));var logger=require(_0xb834('0x7'))(_0xb834('0x8'));var config=require(_0xb834('0x9'));var jayson=require(_0xb834('0xa'));var client=jayson[_0xb834('0xb')][_0xb834('0xc')]({'port':0x232a});config[_0xb834('0xd')]=_[_0xb834('0xe')](config[_0xb834('0xd')],{'host':_0xb834('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb834('0xd')]));require(_0xb834('0x10'))[_0xb834('0x11')](socket);function respondWithRpcPromise(_0xa2960,_0x796379,_0x5a89d3){return new BPromise(function(_0x1f0f69,_0x30cdee){return client[_0xb834('0x12')](_0xa2960,_0x5a89d3)['then'](function(_0x130aa2){logger['info'](_0xb834('0x13'),_0x796379,'request\x20sent');logger[_0xb834('0x14')](_0xb834('0x15'),_0x796379,_0xb834('0x16'),JSON[_0xb834('0x17')](_0x130aa2));if(_0x130aa2[_0xb834('0x18')]){if(_0x130aa2['error'][_0xb834('0x19')]===0x1f4){logger[_0xb834('0x18')](_0xb834('0x13'),_0x796379,_0x130aa2['error'][_0xb834('0x1a')]);return _0x30cdee(_0x130aa2[_0xb834('0x18')][_0xb834('0x1a')]);}logger[_0xb834('0x18')](_0xb834('0x13'),_0x796379,_0x130aa2[_0xb834('0x18')][_0xb834('0x1a')]);return _0x1f0f69(_0x130aa2[_0xb834('0x18')][_0xb834('0x1a')]);}else{logger[_0xb834('0x1b')](_0xb834('0x13'),_0x796379,_0xb834('0x16'));_0x1f0f69(_0x130aa2['result'][_0xb834('0x1a')]);}})[_0xb834('0x1c')](function(_0x121417){logger['error'](_0xb834('0x13'),_0x796379,_0x121417);_0x30cdee(_0x121417);});});}exports[_0xb834('0x1d')]=function(_0x5bc247){var _0x8387b5=this;return new Promise(function(_0x4226cb,_0x31f0e8){return db['Plugin']['create'](_0x5bc247[_0xb834('0x1e')],{'raw':_0x5bc247[_0xb834('0x1f')]?_0x5bc247[_0xb834('0x1f')][_0xb834('0x20')]===undefined?!![]:![]:!![]})[_0xb834('0x21')](function(_0x1c2bf1){logger[_0xb834('0x1b')](_0xb834('0x1d'),_0x5bc247);logger[_0xb834('0x14')]('CreatePlugin',_0x5bc247,JSON[_0xb834('0x17')](_0x1c2bf1));_0x4226cb(_0x1c2bf1);})['catch'](function(_0x3b220d){logger[_0xb834('0x18')]('CreatePlugin',_0x3b220d[_0xb834('0x1a')],_0x5bc247);_0x31f0e8(_0x8387b5[_0xb834('0x18')](0x1f4,_0x3b220d[_0xb834('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 8787ee5..7cb4054 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 _0xf5ca=['update','emit','length','plugin:','save','remove'];(function(_0x60b9b8,_0x5e9862){var _0xe66430=function(_0x321afa){while(--_0x321afa){_0x60b9b8['push'](_0x60b9b8['shift']());}};_0xe66430(++_0x5e9862);}(_0xf5ca,0x1cc));var _0xaf5c=function(_0x57de35,_0x2ef99a){_0x57de35=_0x57de35-0x0;var _0x2a94eb=_0xf5ca[_0x57de35];return _0x2a94eb;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0xaf5c('0x0'),_0xaf5c('0x1'),_0xaf5c('0x2')];function createListener(_0x4f773c,_0x4b10b5){return function(_0x2ea6a6){_0x4b10b5[_0xaf5c('0x3')](_0x4f773c,_0x2ea6a6);};}function removeListener(_0x10c7b5,_0x376336){return function(){PluginEvents['removeListener'](_0x10c7b5,_0x376336);};}exports['register']=function(_0x39a96e){for(var _0x2da9cb=0x0,_0x1b5344=events[_0xaf5c('0x4')];_0x2da9cb<_0x1b5344;_0x2da9cb++){var _0x4dc4a1=events[_0x2da9cb];var _0x19d18c=createListener(_0xaf5c('0x5')+_0x4dc4a1,_0x39a96e);PluginEvents['on'](_0x4dc4a1,_0x19d18c);}}; \ No newline at end of file +var _0x0225=['plugin:','./plugin.events','save','remove','update','emit','removeListener','register','length'];(function(_0x10dc94,_0x2fed4f){var _0x4a462d=function(_0x5181bd){while(--_0x5181bd){_0x10dc94['push'](_0x10dc94['shift']());}};_0x4a462d(++_0x2fed4f);}(_0x0225,0x88));var _0x5022=function(_0x2ac319,_0x4a0428){_0x2ac319=_0x2ac319-0x0;var _0x388930=_0x0225[_0x2ac319];return _0x388930;};'use strict';var PluginEvents=require(_0x5022('0x0'));var events=[_0x5022('0x1'),_0x5022('0x2'),_0x5022('0x3')];function createListener(_0x219983,_0x5b7f21){return function(_0x3dbcce){_0x5b7f21[_0x5022('0x4')](_0x219983,_0x3dbcce);};}function removeListener(_0x2ab52a,_0x12e57e){return function(){PluginEvents[_0x5022('0x5')](_0x2ab52a,_0x12e57e);};}exports[_0x5022('0x6')]=function(_0x1f04f6){for(var _0x5000c3=0x0,_0x7628a=events[_0x5022('0x7')];_0x5000c3<_0x7628a;_0x5000c3++){var _0x2c4571=events[_0x5000c3];var _0x33b9a9=createListener(_0x5022('0x8')+_0x2c4571,_0x1f04f6);PluginEvents['on'](_0x2c4571,_0x33b9a9);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 4e0bc89..cb144b8 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(_0x24e170,_0x16027a){var _0x4dc9a4=function(_0x238fb0){while(--_0x238fb0){_0x24e170['push'](_0x24e170['shift']());}};_0x4dc9a4(++_0x16027a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'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(_0x435063,_0x4ea50d){var _0x4cf2ae=function(_0x4cab2c){while(--_0x4cab2c){_0x435063['push'](_0x435063['shift']());}};_0x4cf2ae(++_0x4ea50d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'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 2df4025..86582cf 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 _0xdace=['path','exec','bluebird','sendStatus','status','json','error','stack','send','npm\x20install','info','index','list','then','reject','name','express','length','catch','show','create','body','script','join','../../files/plugins','chdir','dirname','start','dump','Missing\x20name\x20and/or\x20path','update','restart','stop','params','Unknown\x20status','destroy','Unknown\x20id','lodash','../../config/logger','api'];(function(_0x42bac8,_0x5e6653){var _0x4598aa=function(_0x527bd0){while(--_0x527bd0){_0x42bac8['push'](_0x42bac8['shift']());}};_0x4598aa(++_0x5e6653);}(_0xdace,0xc5));var _0xedac=function(_0x4a0e68,_0x45c08c){_0x4a0e68=_0x4a0e68-0x0;var _0x4fb274=_0xdace[_0x4a0e68];return _0x4fb274;};'use strict';var _=require(_0xedac('0x0'));var pm2=require('../../config/pm2');var logger=require(_0xedac('0x1'))(_0xedac('0x2'));var path=require(_0xedac('0x3'));var exec=require('child_process')[_0xedac('0x4')];var BPromise=require(_0xedac('0x5'));function handleEntityNotFound(_0x15d3bd,_0xefb142){return function(_0x5a97c0){if(!_0x5a97c0){_0x15d3bd[_0xedac('0x6')](0x194);;}return _0x5a97c0;};}function respondWithResult(_0x1cba89,_0x39328a){_0x39328a=_0x39328a||0xc8;return function(_0x5ecbd3){if(_0x5ecbd3){return _0x1cba89[_0xedac('0x7')](_0x39328a)[_0xedac('0x8')](_0x5ecbd3);}return null;};}function handleError(_0x162eea,_0x53fa43){_0x53fa43=_0x53fa43||0x1f4;return function(_0x27243f){logger[_0xedac('0x9')](_0x27243f[_0xedac('0xa')]);if(_0x27243f['name']){delete _0x27243f['name'];}_0x162eea[_0xedac('0x7')](_0x53fa43)[_0xedac('0xb')](_0x27243f);};}function execChildProcess(){return new BPromise(function(_0x57e1bf,_0x4d6a29){exec(_0xedac('0xc'),function(_0x25395d,_0x57f637,_0x261401){logger['info'](_0x57f637);logger[_0xedac('0xd')](_0x261401);if(_0x25395d){logger[_0xedac('0x9')](_0x25395d);return _0x4d6a29(_0x25395d);}return _0x57e1bf(_0x57f637);});});}exports[_0xedac('0xe')]=function(_0x342186,_0x9a79a0){return pm2[_0xedac('0xf')]()[_0xedac('0x10')](function(_0x11f0b0){if(_0x11f0b0){var _0x593030=_[_0xedac('0x11')](_0x11f0b0,function(_0x4651d4){return _0x4651d4[_0xedac('0x12')]===_0xedac('0x13')||_0x4651d4[_0xedac('0x12')]==='motion2';});return{'rows':_0x593030,'count':_0x593030[_0xedac('0x14')]};}return null;})['then'](respondWithResult(_0x9a79a0,null))[_0xedac('0x15')](handleError(_0x9a79a0,null));};exports[_0xedac('0x16')]=function(_0xdad128,_0xba0c93){return pm2['describe'](_0xdad128['params']['id'])[_0xedac('0x10')](respondWithResult(_0xba0c93,null))[_0xedac('0x10')](handleEntityNotFound(_0xba0c93,null))[_0xedac('0x15')](handleError(_0xba0c93,null));};exports[_0xedac('0x17')]=function(_0x5a5438,_0x4a699b){if(_0x5a5438[_0xedac('0x18')][_0xedac('0x12')]&&_0x5a5438[_0xedac('0x18')][_0xedac('0x19')]){var _0x2f5eee=path[_0xedac('0x1a')](__dirname,_0xedac('0x1b'),_0x5a5438[_0xedac('0x18')]['script']);var _0x4593e8=process['cwd']();process[_0xedac('0x1c')](path[_0xedac('0x1d')](_0x2f5eee));return execChildProcess()['then'](function(_0x46e09d){process[_0xedac('0x1c')](_0x4593e8);return pm2[_0xedac('0x1e')]({'name':_0x5a5438[_0xedac('0x18')][_0xedac('0x12')],'script':_0x2f5eee});})[_0xedac('0x10')](function(_0x5d7c31){pm2[_0xedac('0x1f')]();return _0x5d7c31[0x0];})[_0xedac('0x10')](respondWithResult(_0x4a699b,0xc9))[_0xedac('0x15')](handleError(_0x4a699b,null));}else{return _0x4a699b[_0xedac('0x7')](0x1f4)[_0xedac('0xb')]({'message':_0xedac('0x20')});}};exports[_0xedac('0x21')]=function(_0x26c6f7,_0x409825){if(_0x26c6f7[_0xedac('0x18')]['id']){delete _0x26c6f7['body']['id'];}var _0x25d7f5={'online':_0xedac('0x22'),'stopped':_0xedac('0x23')};if(_0x25d7f5['hasOwnProperty'](_0x26c6f7[_0xedac('0x18')]['status'])){return pm2[_0x25d7f5[_0x26c6f7['body'][_0xedac('0x7')]]](_0x26c6f7[_0xedac('0x24')]['id'])[_0xedac('0x10')](respondWithResult(_0x409825,0xc8))[_0xedac('0x15')](handleError(_0x409825,null));}else{return _0x409825['status'](0x1f4)['send']({'message':_0xedac('0x25')});}};exports[_0xedac('0x26')]=function(_0x24b182,_0x2ee8d7){if(_0x24b182[_0xedac('0x18')]['id']){delete _0x24b182[_0xedac('0x18')]['id'];}if(_0x24b182[_0xedac('0x24')]['id']){return pm2['delete'](_0x24b182[_0xedac('0x24')]['id'])[_0xedac('0x10')](function(_0x2cbe33){pm2['dump']();return _0x2cbe33[0x0];})[_0xedac('0x10')](respondWithResult(_0x2ee8d7,null))[_0xedac('0x15')](handleError(_0x2ee8d7,null));}else{return _0x2ee8d7['status'](0x1f4)[_0xedac('0xb')]({'message':_0xedac('0x27')});}}; \ No newline at end of file +var _0xb7c8=['start','Missing\x20name\x20and/or\x20path','update','restart','stop','hasOwnProperty','Unknown\x20status','destroy','delete','dump','Unknown\x20id','../../config/pm2','../../config/logger','api','path','child_process','exec','bluebird','sendStatus','status','json','error','name','send','npm\x20install','info','index','list','reject','express','motion2','length','then','catch','show','describe','params','create','body','script','join','../../files/plugins','cwd','chdir','dirname'];(function(_0x5d4a79,_0xc28b5e){var _0x40b667=function(_0x50b421){while(--_0x50b421){_0x5d4a79['push'](_0x5d4a79['shift']());}};_0x40b667(++_0xc28b5e);}(_0xb7c8,0x119));var _0x8b7c=function(_0x294566,_0xa956d1){_0x294566=_0x294566-0x0;var _0x22e77=_0xb7c8[_0x294566];return _0x22e77;};'use strict';var _=require('lodash');var pm2=require(_0x8b7c('0x0'));var logger=require(_0x8b7c('0x1'))(_0x8b7c('0x2'));var path=require(_0x8b7c('0x3'));var exec=require(_0x8b7c('0x4'))[_0x8b7c('0x5')];var BPromise=require(_0x8b7c('0x6'));function handleEntityNotFound(_0x50113e,_0x38672b){return function(_0x412f93){if(!_0x412f93){_0x50113e[_0x8b7c('0x7')](0x194);;}return _0x412f93;};}function respondWithResult(_0x440900,_0x107428){_0x107428=_0x107428||0xc8;return function(_0x12665c){if(_0x12665c){return _0x440900[_0x8b7c('0x8')](_0x107428)[_0x8b7c('0x9')](_0x12665c);}return null;};}function handleError(_0x6afb55,_0x30a924){_0x30a924=_0x30a924||0x1f4;return function(_0x187046){logger[_0x8b7c('0xa')](_0x187046['stack']);if(_0x187046[_0x8b7c('0xb')]){delete _0x187046['name'];}_0x6afb55[_0x8b7c('0x8')](_0x30a924)[_0x8b7c('0xc')](_0x187046);};}function execChildProcess(){return new BPromise(function(_0x5868ec,_0x189a25){exec(_0x8b7c('0xd'),function(_0x3594b1,_0x586826,_0x4adbe2){logger[_0x8b7c('0xe')](_0x586826);logger[_0x8b7c('0xe')](_0x4adbe2);if(_0x3594b1){logger[_0x8b7c('0xa')](_0x3594b1);return _0x189a25(_0x3594b1);}return _0x5868ec(_0x586826);});});}exports[_0x8b7c('0xf')]=function(_0x3e3e58,_0x247e3a){return pm2[_0x8b7c('0x10')]()['then'](function(_0x2b60a7){if(_0x2b60a7){var _0x19c63e=_[_0x8b7c('0x11')](_0x2b60a7,function(_0x52cfe7){return _0x52cfe7[_0x8b7c('0xb')]===_0x8b7c('0x12')||_0x52cfe7['name']===_0x8b7c('0x13');});return{'rows':_0x19c63e,'count':_0x19c63e[_0x8b7c('0x14')]};}return null;})[_0x8b7c('0x15')](respondWithResult(_0x247e3a,null))[_0x8b7c('0x16')](handleError(_0x247e3a,null));};exports[_0x8b7c('0x17')]=function(_0x4cc809,_0x402448){return pm2[_0x8b7c('0x18')](_0x4cc809[_0x8b7c('0x19')]['id'])[_0x8b7c('0x15')](respondWithResult(_0x402448,null))[_0x8b7c('0x15')](handleEntityNotFound(_0x402448,null))['catch'](handleError(_0x402448,null));};exports[_0x8b7c('0x1a')]=function(_0x2b0874,_0x450ab7){if(_0x2b0874[_0x8b7c('0x1b')][_0x8b7c('0xb')]&&_0x2b0874[_0x8b7c('0x1b')][_0x8b7c('0x1c')]){var _0xd0c3e6=path[_0x8b7c('0x1d')](__dirname,_0x8b7c('0x1e'),_0x2b0874[_0x8b7c('0x1b')][_0x8b7c('0x1c')]);var _0x53451d=process[_0x8b7c('0x1f')]();process[_0x8b7c('0x20')](path[_0x8b7c('0x21')](_0xd0c3e6));return execChildProcess()[_0x8b7c('0x15')](function(_0x9365e3){process[_0x8b7c('0x20')](_0x53451d);return pm2[_0x8b7c('0x22')]({'name':_0x2b0874[_0x8b7c('0x1b')][_0x8b7c('0xb')],'script':_0xd0c3e6});})[_0x8b7c('0x15')](function(_0x5e131c){pm2['dump']();return _0x5e131c[0x0];})[_0x8b7c('0x15')](respondWithResult(_0x450ab7,0xc9))['catch'](handleError(_0x450ab7,null));}else{return _0x450ab7[_0x8b7c('0x8')](0x1f4)[_0x8b7c('0xc')]({'message':_0x8b7c('0x23')});}};exports[_0x8b7c('0x24')]=function(_0x3e35b8,_0x3d2dfa){if(_0x3e35b8['body']['id']){delete _0x3e35b8[_0x8b7c('0x1b')]['id'];}var _0x31390d={'online':_0x8b7c('0x25'),'stopped':_0x8b7c('0x26')};if(_0x31390d[_0x8b7c('0x27')](_0x3e35b8[_0x8b7c('0x1b')][_0x8b7c('0x8')])){return pm2[_0x31390d[_0x3e35b8[_0x8b7c('0x1b')][_0x8b7c('0x8')]]](_0x3e35b8[_0x8b7c('0x19')]['id'])['then'](respondWithResult(_0x3d2dfa,0xc8))['catch'](handleError(_0x3d2dfa,null));}else{return _0x3d2dfa[_0x8b7c('0x8')](0x1f4)[_0x8b7c('0xc')]({'message':_0x8b7c('0x28')});}};exports[_0x8b7c('0x29')]=function(_0x3bfe78,_0x1f373f){if(_0x3bfe78[_0x8b7c('0x1b')]['id']){delete _0x3bfe78[_0x8b7c('0x1b')]['id'];}if(_0x3bfe78[_0x8b7c('0x19')]['id']){return pm2[_0x8b7c('0x2a')](_0x3bfe78['params']['id'])[_0x8b7c('0x15')](function(_0x5906bd){pm2[_0x8b7c('0x2b')]();return _0x5906bd[0x0];})[_0x8b7c('0x15')](respondWithResult(_0x1f373f,null))['catch'](handleError(_0x1f373f,null));}else{return _0x1f373f[_0x8b7c('0x8')](0x1f4)['send']({'message':_0x8b7c('0x2c')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index bf93d48..e00130c 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 _0xae9f=['getQueues','express','Router','./realtime.controller','get','/agents','isAuthenticated','getAgents','/queues'];(function(_0x339fe1,_0x5c41e8){var _0x5edc90=function(_0x17344f){while(--_0x17344f){_0x339fe1['push'](_0x339fe1['shift']());}};_0x5edc90(++_0x5c41e8);}(_0xae9f,0x18d));var _0xfae9=function(_0x1e5804,_0x5e5274){_0x1e5804=_0x1e5804-0x0;var _0x10a1b0=_0xae9f[_0x1e5804];return _0x10a1b0;};'use strict';var express=require(_0xfae9('0x0'));var router=express[_0xfae9('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xfae9('0x2'));router[_0xfae9('0x3')](_0xfae9('0x4'),auth[_0xfae9('0x5')](),controller[_0xfae9('0x6')]);router[_0xfae9('0x3')](_0xfae9('0x7'),auth['isAuthenticated'](),controller[_0xfae9('0x8')]);module['exports']=router; \ No newline at end of file +var _0xca65=['exports','Router','./realtime.controller','/agents','getAgents','/queues'];(function(_0x13c336,_0x3e91d9){var _0x53c1f5=function(_0x3eb95c){while(--_0x3eb95c){_0x13c336['push'](_0x13c336['shift']());}};_0x53c1f5(++_0x3e91d9);}(_0xca65,0x73));var _0x5ca6=function(_0x5896f3,_0x44c9d9){_0x5896f3=_0x5896f3-0x0;var _0x521168=_0xca65[_0x5896f3];return _0x521168;};'use strict';var express=require('express');var router=express[_0x5ca6('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x5ca6('0x1'));router['get'](_0x5ca6('0x2'),auth['isAuthenticated'](),controller[_0x5ca6('0x3')]);router['get'](_0x5ca6('0x4'),auth['isAuthenticated'](),controller['getQueues']);module[_0x5ca6('0x5')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index f407f67..778334b 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 _0xd643=['phoneBarEnableScreenRecordingByAgent','routealias','query','channel','sort','globalQueueFilter','rawAttributes','fieldName','role','agent','isEmpty','where','user','userProfileId','nolimit','findAndCountAll','rows','pick','omit','globalStatusFilter','pauseTypeFilter','resolve','Queue','type','getOptions','QueueCampaigns','getResources','util','jayson/promise','../../components/parsers/qs','../../config/logger','../../mysqldb','client','offset','undefined','limit','count','status','set','json','stack','name','send','request','Agents','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','catch','voice','startCase','Queues','VoiceQueuesChannels','Unable\x20to\x20retrieve\x20voice\x20queues\x20channels','loggedIn','available','talking','push','originated','dialActive','dialMethod','Trunk','startProgressive','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','map','get','agents','waiting','busy','outbound','pTalking','find','merge','filter','length','some','connectedlinenum','internal','toString','getMembers','UserId','accountcode','online','paused','loggedInDb','User','Pause','findAll','QueueId','idle','unavailable','isNil','chatPause','faxPause','mailPause','smsPause','voicePause','whatsappPause','every','voiceStatus','pause','chatStatus','faxStatus','openchannelStatus','smsStatus','whatsappStatus','*pause','mail','chat','openchannel','fax','whatsapp','includes','toLowerCase','Invalid\x20channel','findOne','getAgents','all','flatten','uniq','value','split','fields','globalStatus','order','startsWith','ASC','pauseType','DESC','userpic','lastLoginAt','lastPauseAt','address','openchannelPause','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','mailStatus','chatStatusTime','mailStatusTime','smsStatusTime','faxStatusTime','voiceStatusTime','queue','destconnectedlinenum','screenrecording'];(function(_0xbb9dbf,_0x5dafa4){var _0x30223c=function(_0xaa9ca){while(--_0xaa9ca){_0xbb9dbf['push'](_0xbb9dbf['shift']());}};_0x30223c(++_0x5dafa4);}(_0xd643,0xc0));var _0x3d64=function(_0x56a371,_0x9a3875){_0x56a371=_0x56a371-0x0;var _0x22afd5=_0xd643[_0x56a371];return _0x22afd5;};'use strict';var util=require(_0x3d64('0x0'));var _=require('lodash');var jayson=require(_0x3d64('0x1'));var qs=require(_0x3d64('0x2'));var logger=require(_0x3d64('0x3'))('api');var db=require(_0x3d64('0x4'))['db'];var amiClient=jayson['client']['http']({'port':0x232a});var routingClient=jayson[_0x3d64('0x5')]['http']({'port':0x232c});function respondWithFilteredResult(_0x4bf7af,_0x27f536){return function(_0x3cc0f4){if(_0x3cc0f4){var _0x1cbed3=typeof _0x27f536[_0x3d64('0x6')]===_0x3d64('0x7')&&typeof _0x27f536[_0x3d64('0x8')]==='undefined';var _0x35d4bf=_0x3cc0f4[_0x3d64('0x9')];var _0x181283=_0x1cbed3?0x0:_0x27f536[_0x3d64('0x6')];var _0xcc65d6=_0x1cbed3?_0x3cc0f4[_0x3d64('0x9')]:_0x27f536['offset']+_0x27f536['limit'];var _0x53af68;if(_0xcc65d6>=_0x35d4bf){_0xcc65d6=_0x35d4bf;_0x53af68=0xc8;}else{_0x53af68=0xce;}_0x4bf7af[_0x3d64('0xa')](_0x53af68);return _0x4bf7af[_0x3d64('0xb')]('Content-Range',_0x181283+'-'+_0xcc65d6+'/'+_0x35d4bf)[_0x3d64('0xc')](_0x3cc0f4);}return null;};}function handleError(_0x2b574f,_0xf83f49){_0xf83f49=_0xf83f49||0x1f4;return function(_0x5c2f33){logger['error'](_0x5c2f33[_0x3d64('0xd')]);if(_0x5c2f33[_0x3d64('0xe')]){delete _0x5c2f33['name'];}_0x2b574f[_0x3d64('0xa')](_0xf83f49)[_0x3d64('0xf')](_0x5c2f33);};}function getRealtimeAgents(){return new Promise(function(_0x19a2c1,_0x4dd404){return amiClient[_0x3d64('0x10')](_0x3d64('0x11'),{})[_0x3d64('0x12')](function(_0x55ac38){if(_0x55ac38['error'])throw new Error(_0x3d64('0x13'));var _0x39bf08=_0x55ac38[_0x3d64('0x14')];return routingClient[_0x3d64('0x10')](_0x3d64('0x11'),{})['then'](function(_0x252486){if(_0x252486[_0x3d64('0x15')])throw new Error(_0x3d64('0x16'));var _0x268a82=_0x252486[_0x3d64('0x14')];return _0x19a2c1(_['merge']({},_0x39bf08,_0x268a82));});})[_0x3d64('0x17')](function(_0x2f5060){_0x4dd404(_0x2f5060);});});}function getRealtimeQueues(_0x4b5995,_0x26063c){return new Promise(function(_0x4b643c,_0x1ae2b3){var _0x38bef1=_0x26063c===_0x3d64('0x18')?amiClient:routingClient;return _0x38bef1[_0x3d64('0x10')](_[_0x3d64('0x19')](_0x26063c)+_0x3d64('0x1a'),_0x4b5995)[_0x3d64('0x12')](function(_0x4408db){if(_0x4408db[_0x3d64('0x15')])throw new Error(util['format']('Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues',_0x26063c));return _0x4b643c(_0x4408db[_0x3d64('0x14')]);})[_0x3d64('0x17')](function(_0x18a48a){_0x1ae2b3(_0x18a48a);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x3d4bf9,_0x2caca2){return amiClient[_0x3d64('0x10')](_0x3d64('0x1b'),{})[_0x3d64('0x12')](function(_0x3f7032){if(_0x3f7032[_0x3d64('0x15')])throw new Error(_0x3d64('0x1c'));return _0x3d4bf9(_0x3f7032[_0x3d64('0x14')]);})[_0x3d64('0x17')](function(_0x2f6313){_0x2caca2(_0x2f6313);});});}function initializeQueues(_0x135898,_0x5ebe9a,_0x2c5906,_0x364346){var _0x1a1c85=[_0x3d64('0x1d'),_0x3d64('0x1e'),'waiting',_0x3d64('0x1f'),'paused'];if(_0x2c5906==='voice'&&_0x364346==='outbound'){_0x1a1c85[_0x3d64('0x20')]('pTalking',_0x3d64('0x21'),'message',_0x3d64('0x22'),_0x3d64('0x23'),_0x3d64('0x24'),'startPredictive',_0x3d64('0x25'),_0x3d64('0x26'),'erlangCallToSecond',_0x3d64('0x27'),_0x3d64('0x28'),_0x3d64('0x29'),_0x3d64('0x2a'),_0x3d64('0x2b'),'predictiveIntervalAvailable',_0x3d64('0x2c'),_0x3d64('0x2d'),'predictiveIntervalDroppedCallsTimeout',_0x3d64('0x2e'),_0x3d64('0x2f'),_0x3d64('0x30'));}return _0x135898[_0x3d64('0x31')](function(_0x3c8059){var _0x3942ac=_0x3c8059[_0x3d64('0x32')]({'plain':!![]});_0x3942ac[_0x3d64('0x33')]=[];_0x3942ac['paused']=0x0;_0x3942ac['loggedInDb']=0x0;_0x3942ac['loggedIn']=0x0;_0x3942ac[_0x3d64('0x1e')]=0x0;_0x3942ac[_0x3d64('0x34')]=0x0;if(_0x2c5906===_0x3d64('0x18')){_0x3942ac[_0x3d64('0x1f')]=0x0;_0x3942ac[_0x3d64('0x35')]=0x0;if(_0x364346===_0x3d64('0x36')){_0x3942ac[_0x3d64('0x37')]=0x0;_0x3942ac[_0x3d64('0x21')]=0x0;}}var _0x1ac643=_[_0x3d64('0x38')](_0x5ebe9a,['id',_0x3942ac['id']]);if(_0x1ac643)_[_0x3d64('0x39')](_0x3942ac,_['pick'](_0x1ac643,_0x1a1c85));return _0x3942ac;});}function updateAgentVoiceStatus(_0x159dad,_0x3b7931,_0x45014e){var _0x9afd7c=_[_0x3d64('0x3a')](_0x45014e,['queue',_0x3b7931[_0x3d64('0xe')]]);if(_0x9afd7c[_0x3d64('0x3b')]===0x0)return _0x159dad[_0x3d64('0x35')]=!![];if(_[_0x3d64('0x3c')](_0x9afd7c,[_0x3d64('0x3d'),_0x159dad[_0x3d64('0x3e')][_0x3d64('0x3f')]()]))return _0x159dad['talking']=!![];if(!_0x159dad['talking'])return _0x159dad[_0x3d64('0x35')]=!![];}function getVoiceQueueAgents(_0x39ffe0,_0x562f72,_0x2cf290,_0x3851b4){var _0x5819ae=_[_0x3d64('0x38')](_0x562f72,['id',_0x39ffe0['id']]);if(!_0x5819ae)return _0x39ffe0;return _0x5819ae[_0x3d64('0x40')]({'raw':!![]})[_0x3d64('0x12')](function(_0x2b83cd){for(var _0xafe0b2=0x0;_0xafe0b2<_0x2b83cd[_0x3d64('0x3b')];_0xafe0b2++){var _0x47f494=_['find'](_0x2cf290,['id',_0x2b83cd[_0xafe0b2][_0x3d64('0x41')]]);if(!_0x47f494){_0x47f494={'id':_0x2b83cd[_0xafe0b2]['UserId'],'name':_0x2b83cd[_0xafe0b2][_0x3d64('0x41')],'accountcode':'','online':![]};}var _0x4406ee={'id':_0x47f494['id'],'name':_0x47f494[_0x3d64('0xe')],'internal':_0x47f494[_0x3d64('0x42')],'online':Boolean(_0x47f494[_0x3d64('0x43')]),'paused':Boolean(_0x2b83cd[_0xafe0b2][_0x3d64('0x44')])};if(_0x47f494['voiceStatus']===_0x3d64('0x1f'))updateAgentVoiceStatus(_0x4406ee,_0x39ffe0,_0x3851b4);if(_0x4406ee[_0x3d64('0x43')])_0x39ffe0[_0x3d64('0x45')]++;if(_0x4406ee[_0x3d64('0x35')])_0x39ffe0[_0x3d64('0x35')]++;if(_0x4406ee[_0x3d64('0x44')]&&!_0x4406ee[_0x3d64('0x35')]&&!_0x4406ee[_0x3d64('0x1f')])_0x39ffe0[_0x3d64('0x44')]++;_0x39ffe0['agents']['push'](_0x4406ee);}return _0x39ffe0;});}function getQueueAgents(_0x5839e0,_0x35d5eb,_0x4ea01e){var _0x107891=_0x3d64('0x46')+_['startCase'](_0x4ea01e)+'Queue';var _0x1e7b4d=_0x4ea01e+_0x3d64('0x47');return db[_0x107891][_0x3d64('0x48')]({'where':{[_[_0x3d64('0x19')](_0x4ea01e)+_0x3d64('0x49')]:_0x5839e0['id']},'raw':!![]})[_0x3d64('0x12')](function(_0x419a90){for(var _0x54dbb8=0x0;_0x54dbb8<_0x419a90[_0x3d64('0x3b')];_0x54dbb8++){var _0x2d41cb=_['find'](_0x35d5eb,['id',_0x419a90[_0x54dbb8]['UserId']]);if(!_0x2d41cb){_0x2d41cb={'id':_0x419a90[_0x54dbb8][_0x3d64('0x41')],'name':_0x419a90[_0x54dbb8][_0x3d64('0x41')],'online':![],['pauseField']:![]};}var _0x5e4da3={'id':_0x2d41cb['id'],'name':_0x2d41cb[_0x3d64('0xe')],'online':Boolean(_0x2d41cb['online']),'paused':Boolean(_0x2d41cb[_0x1e7b4d])};if(_0x5e4da3[_0x3d64('0x43')])_0x5839e0[_0x3d64('0x45')]++;_0x5839e0[_0x3d64('0x33')]['push'](_0x5e4da3);}return _0x5839e0;});}function isIdle(_0x132133){return _0x132133===_0x3d64('0x4a')||_0x132133==='unknown'||_0x132133===_0x3d64('0x4b')||_0x132133==='ringing'||_[_0x3d64('0x4c')](_0x132133);}function isAgentPaused(_0x1273d8,_0x331ccf){var _0x453603=[_0x1273d8[_0x3d64('0x4d')],_0x1273d8[_0x3d64('0x4e')],_0x1273d8[_0x3d64('0x4f')],_0x1273d8['openchannelPause'],_0x1273d8[_0x3d64('0x50')],_0x1273d8[_0x3d64('0x51')],_0x1273d8[_0x3d64('0x52')]];if(!_0x331ccf)return _[_0x3d64('0x53')](_0x453603);var _0x52915d=_['filter'](_0x453603);return _0x52915d['length']>0x0&&_0x52915d[_0x3d64('0x3b')]<_0x453603['length']?!![]:![];}function isAgentIdle(_0x4cee8b){if(_0x4cee8b[_0x3d64('0x54')]!==_0x3d64('0x4a')&&_0x4cee8b[_0x3d64('0x51')]){_0x4cee8b[_0x3d64('0x54')]=_0x3d64('0x55');return![];}return _[_0x3d64('0x53')]([_0x4cee8b[_0x3d64('0x56')],_0x4cee8b[_0x3d64('0x57')],_0x4cee8b['mailStatus'],_0x4cee8b[_0x3d64('0x58')],_0x4cee8b[_0x3d64('0x59')],_0x4cee8b[_0x3d64('0x54')],_0x4cee8b[_0x3d64('0x5a')]],isIdle);}function getAgentStatus(_0xb1862){var _0x39c832='unknown';if(isAgentPaused(_0xb1862))_0x39c832=_0x3d64('0x55');else if(isAgentPaused(_0xb1862,!![]))_0x39c832=_0x3d64('0x5b');else if(isAgentIdle(_0xb1862))_0x39c832=_0x3d64('0x4a');else _0x39c832='busy';return _0x39c832;}function validateChannel(_0x30a599){var _0x413342=[_0x3d64('0x5c'),_0x3d64('0x5d'),'sms',_0x3d64('0x5e'),_0x3d64('0x5f'),_0x3d64('0x60'),_0x3d64('0x18')];if(!_[_0x3d64('0x61')](_0x413342,_0x30a599[_0x3d64('0x62')]()))throw new Error(_0x3d64('0x63'));return _0x30a599[_0x3d64('0x62')]();}function getFilteredAgentIds(_0x5c95f3,_0x326e66){var _0xb3fe39=_['isArray'](_0x5c95f3)?_0x5c95f3:[_0x5c95f3];var _0x370fe4=_['map'](_0xb3fe39,function(_0x52e181){return db[_0x326e66][_0x3d64('0x64')]({'where':{'name':_0x52e181}})['then'](function(_0x4ecb06){if(!_0x4ecb06)return[];return _0x4ecb06[_0x3d64('0x65')]({'attributes':['id'],'raw':!![]});});});return Promise[_0x3d64('0x66')](_0x370fe4)[_0x3d64('0x12')](function(_0xc80ee1){var _0x40bc47=_(_0xc80ee1)[_0x3d64('0x67')]()[_0x3d64('0x31')]('id')[_0x3d64('0x68')]()[_0x3d64('0x69')]();return _0x40bc47;});}function getUpdatedSortOptions(_0x3ad7d9){var _0x439811={'fields':[],'order':null};var _0x15835e=_0x3ad7d9[_0x3d64('0x6a')](',');_0x439811[_0x3d64('0x6b')]=_['filter'](_0x15835e,function(_0x1b4199){if(!_0x1b4199[_0x3d64('0x61')](_0x3d64('0x6c')))return!![];_0x439811[_0x3d64('0x6d')]=_[_0x3d64('0x6e')](_0x1b4199,'-')?'DESC':_0x3d64('0x6f');return![];});return _0x439811;}function orderAgentsByStatus(_0x84f6f6,_0x227b67){return _0x84f6f6['sort'](function(_0x45e098,_0x1ae426){if(_0x45e098[_0x3d64('0x6c')]===_0x1ae426['globalStatus']&&_0x45e098[_0x3d64('0x6c')]===_0x3d64('0x55')){if(_0x227b67==='DESC')return(_0x45e098['pauseType']||'')<(_0x1ae426[_0x3d64('0x70')]||'')?0x1:-0x1;return _0x45e098[_0x3d64('0x70')]<_0x1ae426['pauseType']?-0x1:0x1;}else{if(_0x227b67===_0x3d64('0x71'))return _0x45e098['globalStatus']<_0x1ae426[_0x3d64('0x6c')]?0x1:-0x1;return _0x45e098[_0x3d64('0x6c')]<_0x1ae426[_0x3d64('0x6c')]?-0x1:0x1;}});}exports[_0x3d64('0x65')]=function(_0xd6b2e9,_0xe3bd1){var _0x144961={'count':0x0,'rows':[]},_0x5f4415={},_0x4c9e93,_0xf5e172,_0x162b7c,_0x576c6c,_0x53b4a0=[_0x3d64('0x72'),_0x3d64('0x43'),_0x3d64('0x73'),_0x3d64('0x74'),'pauseType','lastPauseAt','internal',_0x3d64('0x75'),'chatPause',_0x3d64('0x76'),'mailPause','smsPause',_0x3d64('0x52'),'faxPause','voicePause',_0x3d64('0x77'),_0x3d64('0x78'),_0x3d64('0x79'),_0x3d64('0x7a'),_0x3d64('0x7b'),_0x3d64('0x7c'),_0x3d64('0x7d'),'openchannelCurrentCapacity','mailCurrentCapacity',_0x3d64('0x7e'),_0x3d64('0x7f'),_0x3d64('0x80'),_0x3d64('0x56'),_0x3d64('0x58'),_0x3d64('0x81'),'smsStatus',_0x3d64('0x5a'),_0x3d64('0x57'),_0x3d64('0x54'),_0x3d64('0x82'),'openchannelStatusTime',_0x3d64('0x83'),_0x3d64('0x84'),'whatsappStatusTime',_0x3d64('0x85'),_0x3d64('0x86'),_0x3d64('0x87'),_0x3d64('0x88'),_0x3d64('0x89'),_0x3d64('0x8a'),'phoneBarEnableAutomaticScreenRecording',_0x3d64('0x8b')],_0x249dc9=[_0x3d64('0x4d'),_0x3d64('0x76'),_0x3d64('0x4f'),'smsPause','whatsappPause',_0x3d64('0x4e'),_0x3d64('0x51'),_0x3d64('0x43')];Promise['resolve']()[_0x3d64('0x12')](function(){if(_0xd6b2e9[_0x3d64('0x8c')][_0x3d64('0x8d')])_0x4c9e93=validateChannel(_0xd6b2e9['query']['channel']);if(!_0xd6b2e9[_0x3d64('0x8c')][_0x3d64('0x8e')]||!_0xd6b2e9['query'][_0x3d64('0x8e')][_0x3d64('0x61')](_0x3d64('0x6c')))return;var _0x17f736=getUpdatedSortOptions(_0xd6b2e9['query'][_0x3d64('0x8e')]);_0xd6b2e9[_0x3d64('0x8c')][_0x3d64('0x8e')]=_0x17f736['fields']['join'](',');_0xf5e172=_0x17f736['order'];})['then'](function(){if(!_0xd6b2e9[_0x3d64('0x8c')]['globalQueueFilter'])return[];var _0x491038=_[_0x3d64('0x19')](_0x4c9e93)+'Queue';return getFilteredAgentIds(_0xd6b2e9[_0x3d64('0x8c')][_0x3d64('0x8f')],_0x491038);})[_0x3d64('0x12')](function(_0x2eb4e6){var _0x509a9e=_[_0x3d64('0x31')](db[_0x3d64('0x46')][_0x3d64('0x90')],function(_0x2a8e01){return{'name':_0x2a8e01[_0x3d64('0x91')],'type':_0x2a8e01['type']['key']};});_0xd6b2e9[_0x3d64('0x8c')][_0x3d64('0x92')]=_0x3d64('0x93');_0xd6b2e9[_0x3d64('0x8c')][_0x3d64('0x43')]=!![];_0x5f4415=qs['getOptions'](_0x509a9e,_0xd6b2e9);_0x5f4415['raw']=!![];if(!_[_0x3d64('0x94')](_0x2eb4e6)){_0x5f4415[_0x3d64('0x95')]=_[_0x3d64('0x39')](_0x5f4415[_0x3d64('0x95')],{'$and':[{'id':{'$in':_0x2eb4e6}}]});}else if(!_['isEmpty'](_0xd6b2e9[_0x3d64('0x8c')][_0x3d64('0x8f')])){return _0x144961;}if(_0xd6b2e9['user'][_0x3d64('0x92')]===_0x3d64('0x96')){var _0x930f4={'params':{'id':_0xd6b2e9[_0x3d64('0x96')][_0x3d64('0x97')]},'query':{'section':_0x3d64('0x11'),'role':_0x3d64('0x93'),'online':!![],'nolimit':_0xd6b2e9[_0x3d64('0x8c')][_0x3d64('0x98')],'sort':_0xd6b2e9[_0x3d64('0x8c')][_0x3d64('0x8e')],'filter':_0xd6b2e9[_0x3d64('0x8c')][_0x3d64('0x3a')],'raw':!![],'ids':_0x2eb4e6}};return db['UserProfile']['getResources'](_0x930f4);}return db[_0x3d64('0x46')][_0x3d64('0x99')](_0x5f4415);})[_0x3d64('0x12')](function(_0x5f0767){_0x144961[_0x3d64('0x9')]=_0x5f0767[_0x3d64('0x9')];_0x162b7c=_0x5f0767[_0x3d64('0x9a')];return getRealtimeAgents();})[_0x3d64('0x12')](function(_0x48ded3){_0x576c6c=_0x48ded3[_0x3d64('0x9a')];return _0x162b7c[_0x3d64('0x31')](function(_0x2f46b2){var _0x13e3b9=_[_0x3d64('0x38')](_0x576c6c,['id',_0x2f46b2['id']]);if(_0x13e3b9)_[_0x3d64('0x39')](_0x2f46b2,_[_0x3d64('0x9b')](_[_0x3d64('0x9c')](_0x13e3b9,_0x249dc9),_0x53b4a0));_0x2f46b2[_0x3d64('0x6c')]=getAgentStatus(_0x2f46b2);return _0x2f46b2;});})[_0x3d64('0x12')](function(_0x135892){var _0x5cb701;if(_0xd6b2e9[_0x3d64('0x8c')][_0x3d64('0x9d')]){_0x5cb701=_[_0x3d64('0x3a')](_0x135892,[_0x3d64('0x6c'),_0xd6b2e9[_0x3d64('0x8c')][_0x3d64('0x9d')]]);if(_0xd6b2e9[_0x3d64('0x8c')][_0x3d64('0x9e')]){_0x5cb701=_[_0x3d64('0x3a')](_0x5cb701,['pauseType',_0xd6b2e9[_0x3d64('0x8c')][_0x3d64('0x9e')]]);}}if(_0x5cb701)_0x135892=_0x5cb701;if(!_0xf5e172)return _0x135892;return orderAgentsByStatus(_0x135892,_0xf5e172);})[_0x3d64('0x12')](function(_0xb59f46){_0x144961[_0x3d64('0x9a')]=_0xb59f46;return _0x144961;})['then'](respondWithFilteredResult(_0xe3bd1,_0x5f4415))[_0x3d64('0x17')](handleError(_0xe3bd1,null));};exports['getQueues']=function(_0x48ea70,_0x12ebec){var _0x1203ad={'count':0x0,'rows':[]},_0x5baa18={},_0x3be338,_0x2e61b4,_0x75b04d,_0x3c5d93,_0x374760;Promise[_0x3d64('0x9f')]()[_0x3d64('0x12')](function(){if(_0x48ea70[_0x3d64('0x8c')][_0x3d64('0x8d')])_0x3be338=validateChannel(_0x48ea70[_0x3d64('0x8c')][_0x3d64('0x8d')]);var _0x46bc10=_[_0x3d64('0x19')](_0x3be338)+_0x3d64('0xa0');var _0x2f8078=_[_0x3d64('0x31')](db[_0x46bc10][_0x3d64('0x90')],function(_0xf5d5c4){return{'name':_0xf5d5c4[_0x3d64('0x91')],'type':_0xf5d5c4[_0x3d64('0xa1')]['key']};});_0x5baa18=qs[_0x3d64('0xa2')](_0x2f8078,_0x48ea70);if(_0x48ea70[_0x3d64('0x96')]['role']==='user'){var _0x2e682d={'params':{'id':_0x48ea70['user'][_0x3d64('0x97')]},'query':{'section':_0x3be338==='voice'&&_0x48ea70['query'][_0x3d64('0xa1')]==='outbound'?_0x3d64('0xa3'):_[_0x3d64('0x19')](_0x3be338)+_0x3d64('0x1a'),'type':_0x48ea70[_0x3d64('0x8c')][_0x3d64('0xa1')],'nolimit':!![],'sort':_0x3d64('0xe'),'filter':_0x48ea70[_0x3d64('0x8c')]['filter']}};return db['UserProfile'][_0x3d64('0xa4')](_0x2e682d);}return db[_0x46bc10]['findAndCountAll'](_0x5baa18);})[_0x3d64('0x12')](function(_0x3870c1){_0x1203ad[_0x3d64('0x9')]=_0x3870c1[_0x3d64('0x9')];_0x2e61b4=_0x3870c1['rows'];return getRealtimeQueues(_0x48ea70,_0x3be338);})['then'](function(_0x53e5b4){_0x3c5d93=_0x53e5b4[_0x3d64('0x9a')];return getRealtimeAgents();})[_0x3d64('0x12')](function(_0xfceb0){_0x75b04d=_0xfceb0[_0x3d64('0x9a')];if(_0x3be338!=_0x3d64('0x18'))return;return getRealtimeVoiceQueueChannels();})['then'](function(_0x2b1585){_0x374760=_0x2b1585?_0x2b1585['rows']:[];return initializeQueues(_0x2e61b4,_0x3c5d93,_0x3be338,_0x48ea70[_0x3d64('0x8c')][_0x3d64('0xa1')]);})[_0x3d64('0x12')](function(_0x162e25){var _0x277f0f=_0x162e25[_0x3d64('0x31')](function(_0x175d1d){if(_0x3be338===_0x3d64('0x18'))return getVoiceQueueAgents(_0x175d1d,_0x2e61b4,_0x75b04d,_0x374760);else return getQueueAgents(_0x175d1d,_0x75b04d,_0x3be338);});return Promise['all'](_0x277f0f);})[_0x3d64('0x12')](function(_0x9fb39d){_0x1203ad[_0x3d64('0x9a')]=_0x9fb39d;return _0x1203ad;})[_0x3d64('0x12')](respondWithFilteredResult(_0x12ebec,_0x5baa18))[_0x3d64('0x17')](handleError(_0x12ebec,null));}; \ No newline at end of file +var _0xf564=['format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','VoiceQueuesChannels','loggedIn','available','waiting','talking','paused','outbound','push','originated','dialMethod','Trunk','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialPredictiveIntervalMaxThreshold','predictiveIntervalAvailable','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','get','agents','loggedInDb','busy','pTalking','pick','queue','length','some','internal','toString','find','getMembers','UserId','accountcode','online','User','Queue','QueueId','idle','unknown','unavailable','ringing','chatPause','faxPause','mailPause','openchannelPause','whatsappPause','every','filter','voicePause','voiceStatus','pause','chatStatus','openchannelStatus','smsStatus','*pause','mail','chat','whatsapp','toLowerCase','isArray','findOne','getAgents','all','map','value','split','fields','includes','globalStatus','order','startsWith','DESC','ASC','sort','pauseType','userpic','lastLoginAt','lastPauseAt','address','smsPause','openchannelCapacity','mailCapacity','smsCapacity','chatCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','mailStatus','whatsappStatus','faxStatus','openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','query','channel','join','globalQueueFilter','startCase','fieldName','type','key','role','agent','raw','isEmpty','where','user','userProfileId','nolimit','UserProfile','getResources','findAndCountAll','rows','omit','globalStatusFilter','pauseTypeFilter','getQueues','resolve','rawAttributes','getOptions','QueueCampaigns','util','lodash','jayson/promise','../../components/parsers/qs','../../config/logger','client','undefined','limit','count','offset','status','set','Content-Range','json','stack','name','request','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','Agents','merge','catch','voice','Queues'];(function(_0x438578,_0xeccb24){var _0x55f90b=function(_0x2ef1fd){while(--_0x2ef1fd){_0x438578['push'](_0x438578['shift']());}};_0x55f90b(++_0xeccb24);}(_0xf564,0x126));var _0x4f56=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0xf564[_0x4e9628];return _0x27bc8c;};'use strict';var util=require(_0x4f56('0x0'));var _=require(_0x4f56('0x1'));var jayson=require(_0x4f56('0x2'));var qs=require(_0x4f56('0x3'));var logger=require(_0x4f56('0x4'))('api');var db=require('../../mysqldb')['db'];var amiClient=jayson[_0x4f56('0x5')]['http']({'port':0x232a});var routingClient=jayson['client']['http']({'port':0x232c});function respondWithFilteredResult(_0x3c0bcf,_0x38de50){return function(_0xba4e1d){if(_0xba4e1d){var _0x4fad1e=typeof _0x38de50['offset']===_0x4f56('0x6')&&typeof _0x38de50[_0x4f56('0x7')]===_0x4f56('0x6');var _0x108626=_0xba4e1d[_0x4f56('0x8')];var _0x24270f=_0x4fad1e?0x0:_0x38de50['offset'];var _0x1b785f=_0x4fad1e?_0xba4e1d[_0x4f56('0x8')]:_0x38de50[_0x4f56('0x9')]+_0x38de50[_0x4f56('0x7')];var _0x413bbf;if(_0x1b785f>=_0x108626){_0x1b785f=_0x108626;_0x413bbf=0xc8;}else{_0x413bbf=0xce;}_0x3c0bcf[_0x4f56('0xa')](_0x413bbf);return _0x3c0bcf[_0x4f56('0xb')](_0x4f56('0xc'),_0x24270f+'-'+_0x1b785f+'/'+_0x108626)[_0x4f56('0xd')](_0xba4e1d);}return null;};}function handleError(_0x498e2c,_0x19e819){_0x19e819=_0x19e819||0x1f4;return function(_0x3dab17){logger['error'](_0x3dab17[_0x4f56('0xe')]);if(_0x3dab17[_0x4f56('0xf')]){delete _0x3dab17[_0x4f56('0xf')];}_0x498e2c['status'](_0x19e819)['send'](_0x3dab17);};}function getRealtimeAgents(){return new Promise(function(_0x5a92b1,_0xe01fca){return amiClient[_0x4f56('0x10')]('Agents',{})[_0x4f56('0x11')](function(_0x34960d){if(_0x34960d[_0x4f56('0x12')])throw new Error(_0x4f56('0x13'));var _0x1c8cb7=_0x34960d[_0x4f56('0x14')];return routingClient['request'](_0x4f56('0x15'),{})[_0x4f56('0x11')](function(_0x40ffec){if(_0x40ffec['error'])throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)');var _0x34b464=_0x40ffec[_0x4f56('0x14')];return _0x5a92b1(_[_0x4f56('0x16')]({},_0x1c8cb7,_0x34b464));});})[_0x4f56('0x17')](function(_0x31d800){_0xe01fca(_0x31d800);});});}function getRealtimeQueues(_0x472fb1,_0xf3d759){return new Promise(function(_0x10561c,_0x5d85cc){var _0x32954e=_0xf3d759===_0x4f56('0x18')?amiClient:routingClient;return _0x32954e[_0x4f56('0x10')](_['startCase'](_0xf3d759)+_0x4f56('0x19'),_0x472fb1)[_0x4f56('0x11')](function(_0x4eb389){if(_0x4eb389['error'])throw new Error(util[_0x4f56('0x1a')](_0x4f56('0x1b'),_0xf3d759));return _0x10561c(_0x4eb389[_0x4f56('0x14')]);})[_0x4f56('0x17')](function(_0x2ea78d){_0x5d85cc(_0x2ea78d);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x58980a,_0x244190){return amiClient[_0x4f56('0x10')](_0x4f56('0x1c'),{})[_0x4f56('0x11')](function(_0x1ec15d){if(_0x1ec15d['error'])throw new Error('Unable\x20to\x20retrieve\x20voice\x20queues\x20channels');return _0x58980a(_0x1ec15d[_0x4f56('0x14')]);})[_0x4f56('0x17')](function(_0x1c8278){_0x244190(_0x1c8278);});});}function initializeQueues(_0x387761,_0xa7f42a,_0x127017,_0x1f4dc1){var _0x2d64a8=[_0x4f56('0x1d'),_0x4f56('0x1e'),_0x4f56('0x1f'),_0x4f56('0x20'),_0x4f56('0x21')];if(_0x127017===_0x4f56('0x18')&&_0x1f4dc1===_0x4f56('0x22')){_0x2d64a8[_0x4f56('0x23')]('pTalking',_0x4f56('0x24'),'message','dialActive',_0x4f56('0x25'),_0x4f56('0x26'),'startPredictive',_0x4f56('0x27'),_0x4f56('0x28'),_0x4f56('0x29'),_0x4f56('0x2a'),'erlangBusyFactor','dialPredictiveInterval',_0x4f56('0x2b'),'dialPredictiveIntervalMinThreshold',_0x4f56('0x2c'),'predictiveIntervalTotalCalls',_0x4f56('0x2d'),'predictiveIntervalDroppedCallsTimeout',_0x4f56('0x2e'),_0x4f56('0x2f'),'predictiveIntervalAvgTalktime');}return _0x387761['map'](function(_0x3bbf15){var _0x1c35d2=_0x3bbf15[_0x4f56('0x30')]({'plain':!![]});_0x1c35d2[_0x4f56('0x31')]=[];_0x1c35d2['paused']=0x0;_0x1c35d2[_0x4f56('0x32')]=0x0;_0x1c35d2[_0x4f56('0x1d')]=0x0;_0x1c35d2['available']=0x0;_0x1c35d2[_0x4f56('0x1f')]=0x0;if(_0x127017==='voice'){_0x1c35d2['talking']=0x0;_0x1c35d2[_0x4f56('0x33')]=0x0;if(_0x1f4dc1===_0x4f56('0x22')){_0x1c35d2[_0x4f56('0x34')]=0x0;_0x1c35d2['originated']=0x0;}}var _0x110072=_['find'](_0xa7f42a,['id',_0x1c35d2['id']]);if(_0x110072)_['merge'](_0x1c35d2,_[_0x4f56('0x35')](_0x110072,_0x2d64a8));return _0x1c35d2;});}function updateAgentVoiceStatus(_0x5e3d73,_0x18197e,_0x2b1038){var _0x4e5f89=_['filter'](_0x2b1038,[_0x4f56('0x36'),_0x18197e[_0x4f56('0xf')]]);if(_0x4e5f89[_0x4f56('0x37')]===0x0)return _0x5e3d73[_0x4f56('0x33')]=!![];if(_[_0x4f56('0x38')](_0x4e5f89,['connectedlinenum',_0x5e3d73[_0x4f56('0x39')][_0x4f56('0x3a')]()]))return _0x5e3d73['talking']=!![];if(!_0x5e3d73[_0x4f56('0x20')])return _0x5e3d73[_0x4f56('0x33')]=!![];}function getVoiceQueueAgents(_0x1a1849,_0x3ae5e6,_0x1edf4c,_0x10dc91){var _0x103169=_[_0x4f56('0x3b')](_0x3ae5e6,['id',_0x1a1849['id']]);if(!_0x103169)return _0x1a1849;return _0x103169[_0x4f56('0x3c')]({'raw':!![]})[_0x4f56('0x11')](function(_0xece1da){for(var _0x1bde0a=0x0;_0x1bde0a<_0xece1da[_0x4f56('0x37')];_0x1bde0a++){var _0x26e809=_[_0x4f56('0x3b')](_0x1edf4c,['id',_0xece1da[_0x1bde0a]['UserId']]);if(!_0x26e809){_0x26e809={'id':_0xece1da[_0x1bde0a][_0x4f56('0x3d')],'name':_0xece1da[_0x1bde0a][_0x4f56('0x3d')],'accountcode':'','online':![]};}var _0xc00292={'id':_0x26e809['id'],'name':_0x26e809[_0x4f56('0xf')],'internal':_0x26e809[_0x4f56('0x3e')],'online':Boolean(_0x26e809[_0x4f56('0x3f')]),'paused':Boolean(_0xece1da[_0x1bde0a][_0x4f56('0x21')])};if(_0x26e809['voiceStatus']==='talking')updateAgentVoiceStatus(_0xc00292,_0x1a1849,_0x10dc91);if(_0xc00292[_0x4f56('0x3f')])_0x1a1849['loggedInDb']++;if(_0xc00292[_0x4f56('0x33')])_0x1a1849[_0x4f56('0x33')]++;if(_0xc00292['paused']&&!_0xc00292['busy']&&!_0xc00292['talking'])_0x1a1849['paused']++;_0x1a1849['agents'][_0x4f56('0x23')](_0xc00292);}return _0x1a1849;});}function getQueueAgents(_0x2646c6,_0x400fb4,_0x365e6b){var _0x15c8f5=_0x4f56('0x40')+_['startCase'](_0x365e6b)+_0x4f56('0x41');var _0x4a1beb=_0x365e6b+'Pause';return db[_0x15c8f5]['findAll']({'where':{[_['startCase'](_0x365e6b)+_0x4f56('0x42')]:_0x2646c6['id']},'raw':!![]})[_0x4f56('0x11')](function(_0x42bc8f){for(var _0x395e91=0x0;_0x395e91<_0x42bc8f[_0x4f56('0x37')];_0x395e91++){var _0x5dd961=_[_0x4f56('0x3b')](_0x400fb4,['id',_0x42bc8f[_0x395e91][_0x4f56('0x3d')]]);if(!_0x5dd961){_0x5dd961={'id':_0x42bc8f[_0x395e91][_0x4f56('0x3d')],'name':_0x42bc8f[_0x395e91][_0x4f56('0x3d')],'online':![],['pauseField']:![]};}var _0x474273={'id':_0x5dd961['id'],'name':_0x5dd961[_0x4f56('0xf')],'online':Boolean(_0x5dd961[_0x4f56('0x3f')]),'paused':Boolean(_0x5dd961[_0x4a1beb])};if(_0x474273[_0x4f56('0x3f')])_0x2646c6[_0x4f56('0x32')]++;_0x2646c6[_0x4f56('0x31')]['push'](_0x474273);}return _0x2646c6;});}function isIdle(_0x1fec05){return _0x1fec05===_0x4f56('0x43')||_0x1fec05===_0x4f56('0x44')||_0x1fec05===_0x4f56('0x45')||_0x1fec05===_0x4f56('0x46')||_['isNil'](_0x1fec05);}function isAgentPaused(_0x19f03b,_0x435fdc){var _0x36c167=[_0x19f03b[_0x4f56('0x47')],_0x19f03b[_0x4f56('0x48')],_0x19f03b[_0x4f56('0x49')],_0x19f03b[_0x4f56('0x4a')],_0x19f03b['smsPause'],_0x19f03b['voicePause'],_0x19f03b[_0x4f56('0x4b')]];if(!_0x435fdc)return _[_0x4f56('0x4c')](_0x36c167);var _0x3200f5=_[_0x4f56('0x4d')](_0x36c167);return _0x3200f5[_0x4f56('0x37')]>0x0&&_0x3200f5['length']<_0x36c167[_0x4f56('0x37')]?!![]:![];}function isAgentIdle(_0x121b91){if(_0x121b91['voiceStatus']!==_0x4f56('0x43')&&_0x121b91[_0x4f56('0x4e')]){_0x121b91[_0x4f56('0x4f')]=_0x4f56('0x50');return![];}return _[_0x4f56('0x4c')]([_0x121b91[_0x4f56('0x51')],_0x121b91['faxStatus'],_0x121b91['mailStatus'],_0x121b91[_0x4f56('0x52')],_0x121b91[_0x4f56('0x53')],_0x121b91['voiceStatus'],_0x121b91['whatsappStatus']],isIdle);}function getAgentStatus(_0x4059f9){var _0x943cd0=_0x4f56('0x44');if(isAgentPaused(_0x4059f9))_0x943cd0='pause';else if(isAgentPaused(_0x4059f9,!![]))_0x943cd0=_0x4f56('0x54');else if(isAgentIdle(_0x4059f9))_0x943cd0=_0x4f56('0x43');else _0x943cd0=_0x4f56('0x33');return _0x943cd0;}function validateChannel(_0x354f5c){var _0x7e2a81=[_0x4f56('0x55'),_0x4f56('0x56'),'sms','openchannel','fax',_0x4f56('0x57'),'voice'];if(!_['includes'](_0x7e2a81,_0x354f5c[_0x4f56('0x58')]()))throw new Error('Invalid\x20channel');return _0x354f5c[_0x4f56('0x58')]();}function getFilteredAgentIds(_0x35a7d0,_0x2c0451){var _0x3a6738=_[_0x4f56('0x59')](_0x35a7d0)?_0x35a7d0:[_0x35a7d0];var _0x58d9b6=_['map'](_0x3a6738,function(_0x5d942b){return db[_0x2c0451][_0x4f56('0x5a')]({'where':{'name':_0x5d942b}})[_0x4f56('0x11')](function(_0x2a1c8c){if(!_0x2a1c8c)return[];return _0x2a1c8c[_0x4f56('0x5b')]({'attributes':['id'],'raw':!![]});});});return Promise[_0x4f56('0x5c')](_0x58d9b6)['then'](function(_0x9bf504){var _0x884955=_(_0x9bf504)['flatten']()[_0x4f56('0x5d')]('id')['uniq']()[_0x4f56('0x5e')]();return _0x884955;});}function getUpdatedSortOptions(_0x50d966){var _0x43ffc8={'fields':[],'order':null};var _0x5f05ce=_0x50d966[_0x4f56('0x5f')](',');_0x43ffc8[_0x4f56('0x60')]=_[_0x4f56('0x4d')](_0x5f05ce,function(_0x2cdc8d){if(!_0x2cdc8d[_0x4f56('0x61')](_0x4f56('0x62')))return!![];_0x43ffc8[_0x4f56('0x63')]=_[_0x4f56('0x64')](_0x2cdc8d,'-')?_0x4f56('0x65'):_0x4f56('0x66');return![];});return _0x43ffc8;}function orderAgentsByStatus(_0xde3267,_0x3633dd){return _0xde3267[_0x4f56('0x67')](function(_0x372f4b,_0x411af4){if(_0x372f4b['globalStatus']===_0x411af4['globalStatus']&&_0x372f4b[_0x4f56('0x62')]==='pause'){if(_0x3633dd===_0x4f56('0x65'))return(_0x372f4b[_0x4f56('0x68')]||'')<(_0x411af4['pauseType']||'')?0x1:-0x1;return _0x372f4b[_0x4f56('0x68')]<_0x411af4[_0x4f56('0x68')]?-0x1:0x1;}else{if(_0x3633dd===_0x4f56('0x65'))return _0x372f4b['globalStatus']<_0x411af4[_0x4f56('0x62')]?0x1:-0x1;return _0x372f4b['globalStatus']<_0x411af4[_0x4f56('0x62')]?-0x1:0x1;}});}exports[_0x4f56('0x5b')]=function(_0x2f9b22,_0x518b0b){var _0x1587c5={'count':0x0,'rows':[]},_0x39787d={},_0x2ab321,_0x2c55a9,_0xf2c6e2,_0x2770ae,_0x4a8029=[_0x4f56('0x69'),_0x4f56('0x3f'),_0x4f56('0x6a'),_0x4f56('0x6b'),_0x4f56('0x68'),_0x4f56('0x6b'),'internal',_0x4f56('0x6c'),_0x4f56('0x47'),_0x4f56('0x4a'),_0x4f56('0x49'),_0x4f56('0x6d'),'whatsappPause',_0x4f56('0x48'),'voicePause','chatCapacity',_0x4f56('0x6e'),_0x4f56('0x6f'),_0x4f56('0x70'),'whatsappCapacity','faxCapacity',_0x4f56('0x71'),'openchannelCurrentCapacity',_0x4f56('0x72'),_0x4f56('0x73'),_0x4f56('0x74'),_0x4f56('0x75'),'chatStatus','openchannelStatus',_0x4f56('0x76'),'smsStatus',_0x4f56('0x77'),_0x4f56('0x78'),_0x4f56('0x4f'),'chatStatusTime',_0x4f56('0x79'),_0x4f56('0x7a'),_0x4f56('0x7b'),_0x4f56('0x7c'),_0x4f56('0x7d'),_0x4f56('0x7e'),'queue',_0x4f56('0x7f'),_0x4f56('0x80'),_0x4f56('0x81'),_0x4f56('0x82'),_0x4f56('0x83')],_0x5b7d67=[_0x4f56('0x47'),'openchannelPause',_0x4f56('0x49'),'smsPause',_0x4f56('0x4b'),_0x4f56('0x48'),_0x4f56('0x4e'),_0x4f56('0x3f')];Promise['resolve']()[_0x4f56('0x11')](function(){if(_0x2f9b22[_0x4f56('0x84')][_0x4f56('0x85')])_0x2ab321=validateChannel(_0x2f9b22[_0x4f56('0x84')][_0x4f56('0x85')]);if(!_0x2f9b22[_0x4f56('0x84')]['sort']||!_0x2f9b22['query'][_0x4f56('0x67')][_0x4f56('0x61')]('globalStatus'))return;var _0x3af2d9=getUpdatedSortOptions(_0x2f9b22[_0x4f56('0x84')][_0x4f56('0x67')]);_0x2f9b22['query']['sort']=_0x3af2d9['fields'][_0x4f56('0x86')](',');_0x2c55a9=_0x3af2d9[_0x4f56('0x63')];})[_0x4f56('0x11')](function(){if(!_0x2f9b22[_0x4f56('0x84')][_0x4f56('0x87')])return[];var _0x4c322e=_[_0x4f56('0x88')](_0x2ab321)+_0x4f56('0x41');return getFilteredAgentIds(_0x2f9b22[_0x4f56('0x84')]['globalQueueFilter'],_0x4c322e);})[_0x4f56('0x11')](function(_0x1da712){var _0x4583f2=_[_0x4f56('0x5d')](db[_0x4f56('0x40')]['rawAttributes'],function(_0x2d50df){return{'name':_0x2d50df[_0x4f56('0x89')],'type':_0x2d50df[_0x4f56('0x8a')][_0x4f56('0x8b')]};});_0x2f9b22[_0x4f56('0x84')][_0x4f56('0x8c')]=_0x4f56('0x8d');_0x2f9b22[_0x4f56('0x84')][_0x4f56('0x3f')]=!![];_0x39787d=qs['getOptions'](_0x4583f2,_0x2f9b22);_0x39787d[_0x4f56('0x8e')]=!![];if(!_[_0x4f56('0x8f')](_0x1da712)){_0x39787d[_0x4f56('0x90')]=_['merge'](_0x39787d[_0x4f56('0x90')],{'$and':[{'id':{'$in':_0x1da712}}]});}else if(!_['isEmpty'](_0x2f9b22[_0x4f56('0x84')][_0x4f56('0x87')])){return _0x1587c5;}if(_0x2f9b22[_0x4f56('0x91')][_0x4f56('0x8c')]==='user'){var _0xf3bc52={'params':{'id':_0x2f9b22[_0x4f56('0x91')][_0x4f56('0x92')]},'query':{'section':_0x4f56('0x15'),'role':_0x4f56('0x8d'),'online':!![],'nolimit':_0x2f9b22[_0x4f56('0x84')][_0x4f56('0x93')],'sort':_0x2f9b22[_0x4f56('0x84')]['sort'],'filter':_0x2f9b22[_0x4f56('0x84')]['filter'],'raw':!![],'ids':_0x1da712}};return db[_0x4f56('0x94')][_0x4f56('0x95')](_0xf3bc52);}return db['User'][_0x4f56('0x96')](_0x39787d);})[_0x4f56('0x11')](function(_0x2537b8){_0x1587c5[_0x4f56('0x8')]=_0x2537b8['count'];_0xf2c6e2=_0x2537b8[_0x4f56('0x97')];return getRealtimeAgents();})['then'](function(_0x48748e){_0x2770ae=_0x48748e[_0x4f56('0x97')];return _0xf2c6e2[_0x4f56('0x5d')](function(_0x23e413){var _0x483176=_['find'](_0x2770ae,['id',_0x23e413['id']]);if(_0x483176)_['merge'](_0x23e413,_[_0x4f56('0x35')](_[_0x4f56('0x98')](_0x483176,_0x5b7d67),_0x4a8029));_0x23e413[_0x4f56('0x62')]=getAgentStatus(_0x23e413);return _0x23e413;});})['then'](function(_0x311606){var _0x14460d;if(_0x2f9b22[_0x4f56('0x84')][_0x4f56('0x99')]){_0x14460d=_[_0x4f56('0x4d')](_0x311606,[_0x4f56('0x62'),_0x2f9b22[_0x4f56('0x84')][_0x4f56('0x99')]]);if(_0x2f9b22[_0x4f56('0x84')][_0x4f56('0x9a')]){_0x14460d=_['filter'](_0x14460d,[_0x4f56('0x68'),_0x2f9b22[_0x4f56('0x84')][_0x4f56('0x9a')]]);}}if(_0x14460d)_0x311606=_0x14460d;if(!_0x2c55a9)return _0x311606;return orderAgentsByStatus(_0x311606,_0x2c55a9);})[_0x4f56('0x11')](function(_0x13db20){_0x1587c5[_0x4f56('0x97')]=_0x13db20;return _0x1587c5;})[_0x4f56('0x11')](respondWithFilteredResult(_0x518b0b,_0x39787d))[_0x4f56('0x17')](handleError(_0x518b0b,null));};exports[_0x4f56('0x9b')]=function(_0x18288f,_0x1941ff){var _0x4face7={'count':0x0,'rows':[]},_0x348e3c={},_0x169d4f,_0x1366df,_0x3d5f3e,_0x449696,_0x273ade;Promise[_0x4f56('0x9c')]()[_0x4f56('0x11')](function(){if(_0x18288f['query']['channel'])_0x169d4f=validateChannel(_0x18288f['query'][_0x4f56('0x85')]);var _0x571566=_[_0x4f56('0x88')](_0x169d4f)+_0x4f56('0x41');var _0x21642c=_[_0x4f56('0x5d')](db[_0x571566][_0x4f56('0x9d')],function(_0x408c3d){return{'name':_0x408c3d['fieldName'],'type':_0x408c3d[_0x4f56('0x8a')][_0x4f56('0x8b')]};});_0x348e3c=qs[_0x4f56('0x9e')](_0x21642c,_0x18288f);if(_0x18288f['user']['role']===_0x4f56('0x91')){var _0x40b1b4={'params':{'id':_0x18288f[_0x4f56('0x91')]['userProfileId']},'query':{'section':_0x169d4f===_0x4f56('0x18')&&_0x18288f[_0x4f56('0x84')]['type']==='outbound'?_0x4f56('0x9f'):_['startCase'](_0x169d4f)+_0x4f56('0x19'),'type':_0x18288f[_0x4f56('0x84')]['type'],'nolimit':!![],'sort':_0x4f56('0xf'),'filter':_0x18288f[_0x4f56('0x84')]['filter']}};return db[_0x4f56('0x94')]['getResources'](_0x40b1b4);}return db[_0x571566][_0x4f56('0x96')](_0x348e3c);})[_0x4f56('0x11')](function(_0x4ad948){_0x4face7[_0x4f56('0x8')]=_0x4ad948[_0x4f56('0x8')];_0x1366df=_0x4ad948[_0x4f56('0x97')];return getRealtimeQueues(_0x18288f,_0x169d4f);})[_0x4f56('0x11')](function(_0x207632){_0x449696=_0x207632['rows'];return getRealtimeAgents();})[_0x4f56('0x11')](function(_0x1880e0){_0x3d5f3e=_0x1880e0['rows'];if(_0x169d4f!=_0x4f56('0x18'))return;return getRealtimeVoiceQueueChannels();})[_0x4f56('0x11')](function(_0x4c7a5d){_0x273ade=_0x4c7a5d?_0x4c7a5d[_0x4f56('0x97')]:[];return initializeQueues(_0x1366df,_0x449696,_0x169d4f,_0x18288f['query'][_0x4f56('0x8a')]);})[_0x4f56('0x11')](function(_0x5c183d){var _0x542800=_0x5c183d[_0x4f56('0x5d')](function(_0x509124){if(_0x169d4f===_0x4f56('0x18'))return getVoiceQueueAgents(_0x509124,_0x1366df,_0x3d5f3e,_0x273ade);else return getQueueAgents(_0x509124,_0x3d5f3e,_0x169d4f);});return Promise['all'](_0x542800);})[_0x4f56('0x11')](function(_0xd2fbe2){_0x4face7[_0x4f56('0x97')]=_0xd2fbe2;return _0x4face7;})['then'](respondWithFilteredResult(_0x1941ff,_0x348e3c))['catch'](handleError(_0x1941ff,null));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 225d12c..2fff423 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x10ec47,_0x12702a){var _0x318a03=function(_0x5a0016){while(--_0x5a0016){_0x10ec47['push'](_0x10ec47['shift']());}};_0x318a03(++_0x12702a);}(_0xedd9,0xfc));var _0x9edd=function(_0x5ddc90,_0x1a9989){_0x5ddc90=_0x5ddc90-0x0;var _0x1f2b57=_0xedd9[_0x5ddc90];return _0x1f2b57;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x1ef093,_0x44e1ed){var _0x3728ca=function(_0x5225d3){while(--_0x5225d3){_0x1ef093['push'](_0x1ef093['shift']());}};_0x3728ca(++_0x44e1ed);}(_0x9c44,0x178));var _0x49c4=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x9c44[_0x15bc81];return _0x59440e;};'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 0b7988a..8c9444d 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 _0x12e9=['INTEGER','DATE','STRING'];(function(_0x3457c9,_0x440606){var _0x290e1b=function(_0x52c737){while(--_0x52c737){_0x3457c9['push'](_0x3457c9['shift']());}};_0x290e1b(++_0x440606);}(_0x12e9,0x66));var _0x912e=function(_0x25a381,_0x4d25c1){_0x25a381=_0x25a381-0x0;var _0x4bc62b=_0x12e9[_0x25a381];return _0x4bc62b;};'use strict';var Sequelize=require('sequelize');module['exports']={'state':{'type':Sequelize[_0x912e('0x0')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x912e('0x1')]},'uniqueid':{'type':Sequelize[_0x912e('0x2')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x912e('0x1')]},'ringtime':{'type':Sequelize[_0x912e('0x0')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x912e('0x2')]},'membername':{'type':Sequelize[_0x912e('0x2')]}}; \ No newline at end of file +var _0x8c46=['INTEGER','sequelize','STRING','DATE'];(function(_0x428c3d,_0x13f97f){var _0x1ef9fd=function(_0x422870){while(--_0x422870){_0x428c3d['push'](_0x428c3d['shift']());}};_0x1ef9fd(++_0x13f97f);}(_0x8c46,0x171));var _0x68c4=function(_0x2ce1f2,_0x1337df){_0x2ce1f2=_0x2ce1f2-0x0;var _0x5319a9=_0x8c46[_0x2ce1f2];return _0x5319a9;};'use strict';var Sequelize=require(_0x68c4('0x0'));module['exports']={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x68c4('0x1')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x68c4('0x2')]},'responsetime':{'type':Sequelize[_0x68c4('0x2')]},'ringtime':{'type':Sequelize[_0x68c4('0x3')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x68c4('0x1')]},'campaigntype':{'type':Sequelize[_0x68c4('0x1')]},'membername':{'type':Sequelize[_0x68c4('0x1')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index c374ffb..a70f270 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 _0xd337=['report_agent_preview','lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','exports','define'];(function(_0x30597e,_0x3d3e66){var _0x17b1cf=function(_0xa3d995){while(--_0xa3d995){_0x30597e['push'](_0x30597e['shift']());}};_0x17b1cf(++_0x3d3e66);}(_0xd337,0x191));var _0x7d33=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd337[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7d33('0x0'));var util=require('util');var logger=require(_0x7d33('0x1'))('api');var moment=require(_0x7d33('0x2'));var BPromise=require(_0x7d33('0x3'));var rp=require(_0x7d33('0x4'));var fs=require('fs');var path=require(_0x7d33('0x5'));var rimraf=require('rimraf');var config=require(_0x7d33('0x6'));var attributes=require('./reportAgentPreview.attributes');module[_0x7d33('0x7')]=function(_0x17d54b,_0x1dabca){return _0x17d54b[_0x7d33('0x8')]('ReportAgentPreview',attributes,{'tableName':_0x7d33('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x72b4=['define','ReportAgentPreview','report_agent_preview','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./reportAgentPreview.attributes'];(function(_0x1887ac,_0x2708da){var _0x2fafb9=function(_0x4bf940){while(--_0x4bf940){_0x1887ac['push'](_0x1887ac['shift']());}};_0x2fafb9(++_0x2708da);}(_0x72b4,0x177));var _0x472b=function(_0xd21fe7,_0x225a39){_0xd21fe7=_0xd21fe7-0x0;var _0x14d570=_0x72b4[_0xd21fe7];return _0x14d570;};'use strict';var _=require(_0x472b('0x0'));var util=require(_0x472b('0x1'));var logger=require(_0x472b('0x2'))('api');var moment=require('moment');var BPromise=require(_0x472b('0x3'));var rp=require(_0x472b('0x4'));var fs=require('fs');var path=require(_0x472b('0x5'));var rimraf=require(_0x472b('0x6'));var config=require(_0x472b('0x7'));var attributes=require(_0x472b('0x8'));module['exports']=function(_0x59904b,_0x548b60){return _0x59904b[_0x472b('0x9')](_0x472b('0xa'),attributes,{'tableName':_0x472b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index b31dc4b..6e86735 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 _0x300f=['options','stringify','moment','bluebird','randomstring','ioredis','rpc','jayson/promise','http','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','code','error','message','result','catch','CreateReportAgentPreview','body'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x300f,0x18e));var _0xf300=function(_0xca67b0,_0x33956f){_0xca67b0=_0xca67b0-0x0;var _0x4a001b=_0x300f[_0xca67b0];return _0x4a001b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf300('0x0'));var BPromise=require(_0xf300('0x1'));var rs=require(_0xf300('0x2'));var fs=require('fs');var Redis=require(_0xf300('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf300('0x4'));var config=require('../../config/environment');var jayson=require(_0xf300('0x5'));var client=jayson['client'][_0xf300('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x40fbbb,_0x5a4bac,_0x4e77b5){return new BPromise(function(_0x9f5c6b,_0xa91dc){return client[_0xf300('0x7')](_0x40fbbb,_0x4e77b5)[_0xf300('0x8')](function(_0x266483){logger[_0xf300('0x9')](_0xf300('0xa'),_0x5a4bac,_0xf300('0xb'));logger[_0xf300('0xc')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x5a4bac,_0xf300('0xb'),JSON['stringify'](_0x266483));if(_0x266483['error']){if(_0x266483['error'][_0xf300('0xd')]===0x1f4){logger[_0xf300('0xe')](_0xf300('0xa'),_0x5a4bac,_0x266483[_0xf300('0xe')][_0xf300('0xf')]);return _0xa91dc(_0x266483[_0xf300('0xe')]['message']);}logger[_0xf300('0xe')](_0xf300('0xa'),_0x5a4bac,_0x266483[_0xf300('0xe')]['message']);return _0x9f5c6b(_0x266483[_0xf300('0xe')][_0xf300('0xf')]);}else{logger[_0xf300('0x9')]('ReportAgentPreview,\x20%s,\x20%s',_0x5a4bac,'request\x20sent');_0x9f5c6b(_0x266483[_0xf300('0x10')][_0xf300('0xf')]);}})[_0xf300('0x11')](function(_0x18e0ef){logger[_0xf300('0xe')](_0xf300('0xa'),_0x5a4bac,_0x18e0ef);_0xa91dc(_0x18e0ef);});});}exports[_0xf300('0x12')]=function(_0x81f6fd){var _0x29f87c=this;return new Promise(function(_0x4faace,_0x8171da){return db['ReportAgentPreview']['create'](_0x81f6fd[_0xf300('0x13')],{'raw':_0x81f6fd['options']?_0x81f6fd[_0xf300('0x14')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x59bf3d){logger[_0xf300('0x9')]('CreateReportAgentPreview',_0x81f6fd);logger[_0xf300('0xc')]('CreateReportAgentPreview',_0x81f6fd,JSON[_0xf300('0x15')](_0x59bf3d));_0x4faace(_0x59bf3d);})[_0xf300('0x11')](function(_0x5ec276){logger[_0xf300('0xe')]('CreateReportAgentPreview',_0x5ec276[_0xf300('0xf')],_0x81f6fd);_0x8171da(_0x29f87c[_0xf300('0xe')](0x1f4,_0x5ec276[_0xf300('0xf')]));});});}; \ No newline at end of file +var _0x4d13=['debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','ReportAgentPreview,\x20%s,\x20%s'];(function(_0x23248c,_0x41c974){var _0x4f29cd=function(_0x29d781){while(--_0x29d781){_0x23248c['push'](_0x23248c['shift']());}};_0x4f29cd(++_0x41c974);}(_0x4d13,0xff));var _0x34d1=function(_0x2f92c7,_0x157fb5){_0x2f92c7=_0x2f92c7-0x0;var _0x524a62=_0x4d13[_0x2f92c7];return _0x524a62;};'use strict';var _=require(_0x34d1('0x0'));var util=require(_0x34d1('0x1'));var moment=require(_0x34d1('0x2'));var BPromise=require('bluebird');var rs=require(_0x34d1('0x3'));var fs=require('fs');var Redis=require(_0x34d1('0x4'));var db=require(_0x34d1('0x5'))['db'];var utils=require(_0x34d1('0x6'));var logger=require(_0x34d1('0x7'))(_0x34d1('0x8'));var config=require(_0x34d1('0x9'));var jayson=require(_0x34d1('0xa'));var client=jayson[_0x34d1('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3d672e,_0x1e7fca,_0x5eb63d){return new BPromise(function(_0xccf022,_0x12ecbe){return client['request'](_0x3d672e,_0x5eb63d)[_0x34d1('0xc')](function(_0x5a29f6){logger[_0x34d1('0xd')](_0x34d1('0xe'),_0x1e7fca,'request\x20sent');logger[_0x34d1('0xf')](_0x34d1('0x10'),_0x1e7fca,_0x34d1('0x11'),JSON[_0x34d1('0x12')](_0x5a29f6));if(_0x5a29f6['error']){if(_0x5a29f6[_0x34d1('0x13')][_0x34d1('0x14')]===0x1f4){logger[_0x34d1('0x13')]('ReportAgentPreview,\x20%s,\x20%s',_0x1e7fca,_0x5a29f6[_0x34d1('0x13')]['message']);return _0x12ecbe(_0x5a29f6['error'][_0x34d1('0x15')]);}logger['error']('ReportAgentPreview,\x20%s,\x20%s',_0x1e7fca,_0x5a29f6[_0x34d1('0x13')]['message']);return _0xccf022(_0x5a29f6[_0x34d1('0x13')][_0x34d1('0x15')]);}else{logger[_0x34d1('0xd')](_0x34d1('0xe'),_0x1e7fca,'request\x20sent');_0xccf022(_0x5a29f6[_0x34d1('0x16')][_0x34d1('0x15')]);}})[_0x34d1('0x17')](function(_0x450571){logger['error'](_0x34d1('0xe'),_0x1e7fca,_0x450571);_0x12ecbe(_0x450571);});});}exports[_0x34d1('0x18')]=function(_0x2d2351){var _0x4de639=this;return new Promise(function(_0x96da51,_0x3cf261){return db[_0x34d1('0x19')][_0x34d1('0x1a')](_0x2d2351[_0x34d1('0x1b')],{'raw':_0x2d2351[_0x34d1('0x1c')]?_0x2d2351[_0x34d1('0x1c')][_0x34d1('0x1d')]===undefined?!![]:![]:!![]})[_0x34d1('0xc')](function(_0x16d54b){logger[_0x34d1('0xd')](_0x34d1('0x18'),_0x2d2351);logger[_0x34d1('0xf')](_0x34d1('0x18'),_0x2d2351,JSON[_0x34d1('0x12')](_0x16d54b));_0x96da51(_0x16d54b);})[_0x34d1('0x17')](function(_0x164921){logger[_0x34d1('0x13')](_0x34d1('0x18'),_0x164921[_0x34d1('0x15')],_0x2d2351);_0x3cf261(_0x4de639[_0x34d1('0x13')](0x1f4,_0x164921[_0x34d1('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 2ecbc6c..5e56e6d 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 _0xc8a7=['voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','updateVoiceQueue','/outbound','outbound','/outbound/channels','/agents','agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','/chat/queues/:id/notify','showChatQueues','fax','/fax/queues/:id','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','/whatsapp/queues/:id/notify','whatsapp','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','multer','util','path','express','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','/voice/queues/channels/:uniqueid/redirect/:exten'];(function(_0x476f19,_0x70a415){var _0x326ec0=function(_0x421d7c){while(--_0x421d7c){_0x476f19['push'](_0x476f19['shift']());}};_0x326ec0(++_0x70a415);}(_0xc8a7,0x81));var _0x7c8a=function(_0x9be4d,_0x1e8977){_0x9be4d=_0x9be4d-0x0;var _0x2d6784=_0xc8a7[_0x9be4d];return _0x2d6784;};'use strict';var multer=require(_0x7c8a('0x0'));var util=require(_0x7c8a('0x1'));var path=require(_0x7c8a('0x2'));var express=require(_0x7c8a('0x3'));var router=express[_0x7c8a('0x4')]();var auth=require(_0x7c8a('0x5'));var controller=require(_0x7c8a('0x6'));router[_0x7c8a('0x7')](_0x7c8a('0x8'),auth[_0x7c8a('0x9')](),controller[_0x7c8a('0xa')]);router[_0x7c8a('0x7')](_0x7c8a('0xb'),auth[_0x7c8a('0x9')](),controller[_0x7c8a('0xc')]);router['get'](_0x7c8a('0xd'),auth[_0x7c8a('0x9')](),controller[_0x7c8a('0xe')]);router[_0x7c8a('0x7')](_0x7c8a('0xf'),auth[_0x7c8a('0x9')](),controller[_0x7c8a('0x10')]);router[_0x7c8a('0x7')](_0x7c8a('0x11'),auth[_0x7c8a('0x9')](),controller[_0x7c8a('0x12')]);router[_0x7c8a('0x7')]('/mail/queues',auth['isAuthenticated'](),controller[_0x7c8a('0x13')]);router[_0x7c8a('0x7')](_0x7c8a('0x14'),auth[_0x7c8a('0x9')](),controller[_0x7c8a('0x15')]);router['get'](_0x7c8a('0x16'),auth[_0x7c8a('0x9')](),controller[_0x7c8a('0x17')]);router[_0x7c8a('0x7')](_0x7c8a('0x18'),auth[_0x7c8a('0x9')](),controller[_0x7c8a('0x19')]);router[_0x7c8a('0x7')](_0x7c8a('0x1a'),auth[_0x7c8a('0x9')](),controller[_0x7c8a('0x1b')]);router[_0x7c8a('0x7')]('/fax/queues',auth[_0x7c8a('0x9')](),controller[_0x7c8a('0x1c')]);router[_0x7c8a('0x7')](_0x7c8a('0x1d'),auth[_0x7c8a('0x9')](),controller[_0x7c8a('0x1e')]);router['get'](_0x7c8a('0x1f'),auth[_0x7c8a('0x9')](),controller['voiceQueuesChannels']);router['get']('/voice/queues/channels/:uniqueid',auth['isAuthenticated'](),controller[_0x7c8a('0x20')]);router[_0x7c8a('0x7')](_0x7c8a('0x21'),auth[_0x7c8a('0x9')](),controller['voiceQueuesChannelHangup']);router['get'](_0x7c8a('0x22'),auth[_0x7c8a('0x9')](),controller[_0x7c8a('0x23')]);router['get'](_0x7c8a('0x24'),auth[_0x7c8a('0x9')](),controller[_0x7c8a('0x25')]);router['put'](_0x7c8a('0x24'),auth[_0x7c8a('0x9')](),controller[_0x7c8a('0x26')]);router[_0x7c8a('0x7')](_0x7c8a('0x27'),auth[_0x7c8a('0x9')](),controller[_0x7c8a('0x28')]);router[_0x7c8a('0x7')](_0x7c8a('0x29'),auth[_0x7c8a('0x9')](),controller['outboundChannels']);router['get'](_0x7c8a('0x2a'),auth[_0x7c8a('0x9')](),controller[_0x7c8a('0x2b')]);router['put'](_0x7c8a('0x2c'),auth[_0x7c8a('0x9')](),controller[_0x7c8a('0x2d')]);router['get'](_0x7c8a('0x2e'),auth[_0x7c8a('0x9')](),controller[_0x7c8a('0x2f')]);router[_0x7c8a('0x7')]('/trunks',auth['isAuthenticated'](),controller[_0x7c8a('0x30')]);router[_0x7c8a('0x7')](_0x7c8a('0x31'),auth[_0x7c8a('0x9')](),controller[_0x7c8a('0x32')]);router[_0x7c8a('0x7')](_0x7c8a('0x33'),auth[_0x7c8a('0x9')](),controller[_0x7c8a('0x34')]);router[_0x7c8a('0x7')](_0x7c8a('0x35'),auth[_0x7c8a('0x9')](),controller[_0x7c8a('0x36')]);router[_0x7c8a('0x7')](_0x7c8a('0x37'),auth['isAuthenticated'](),controller[_0x7c8a('0x38')]);router[_0x7c8a('0x7')](_0x7c8a('0x39'),auth[_0x7c8a('0x9')](),controller['openchannelQueuesWaitingInteractions']);router['get'](_0x7c8a('0x3a'),auth['isAuthenticated'](),controller[_0x7c8a('0x3b')]);router[_0x7c8a('0x7')](_0x7c8a('0x3c'),auth[_0x7c8a('0x9')](),controller['smsQueuesWaitingInteractions']);router[_0x7c8a('0x7')]('/whatsapp/queues/waitinginteractions',auth[_0x7c8a('0x9')](),controller[_0x7c8a('0x3d')]);router[_0x7c8a('0x7')](_0x7c8a('0x3e'),auth[_0x7c8a('0x9')](),controller[_0x7c8a('0x3f')]);router[_0x7c8a('0x40')](_0x7c8a('0x41'),auth[_0x7c8a('0x9')](),controller[_0x7c8a('0x42')](_0x7c8a('0x43')));router[_0x7c8a('0x7')](_0x7c8a('0x44'),auth['isAuthenticated'](),controller['showMailQueues']);router[_0x7c8a('0x40')](_0x7c8a('0x45'),auth[_0x7c8a('0x9')](),controller[_0x7c8a('0x42')]('chat'));router[_0x7c8a('0x7')]('/chat/queues/:id',auth[_0x7c8a('0x9')](),controller[_0x7c8a('0x46')]);router[_0x7c8a('0x40')]('/fax/queues/:id/notify',auth[_0x7c8a('0x9')](),controller['queueNotify'](_0x7c8a('0x47')));router[_0x7c8a('0x7')](_0x7c8a('0x48'),auth[_0x7c8a('0x9')](),controller['showFaxQueues']);router[_0x7c8a('0x40')](_0x7c8a('0x49'),auth[_0x7c8a('0x9')](),controller[_0x7c8a('0x42')](_0x7c8a('0x4a')));router[_0x7c8a('0x7')](_0x7c8a('0x4b'),auth[_0x7c8a('0x9')](),controller['showOpenchannelQueues']);router[_0x7c8a('0x40')]('/sms/queues/:id/notify',auth[_0x7c8a('0x9')](),controller['queueNotify']('sms'));router[_0x7c8a('0x40')](_0x7c8a('0x4c'),auth[_0x7c8a('0x9')](),controller[_0x7c8a('0x42')](_0x7c8a('0x4d')));router[_0x7c8a('0x7')]('/sms/queues/:id',auth[_0x7c8a('0x9')](),controller[_0x7c8a('0x4e')]);router[_0x7c8a('0x7')](_0x7c8a('0x4f'),auth[_0x7c8a('0x9')](),controller[_0x7c8a('0x50')]);router[_0x7c8a('0x40')](_0x7c8a('0x51'),auth['isAuthenticated'](),controller['agentNotify']);module['exports']=router; \ No newline at end of file +var _0x29d6=['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','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','multer','util','path','express','../../components/auth/service','./rpc.controller','get','/voice/channels','/voice/channels/:uniqueid/mixmonitor','isAuthenticated','voiceChannelStopMixMonitor','/voice/queues','/chat/queues','chatQueues','mailQueues','mailAccounts','/openchannel/queues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','/voice/queues/:id','put','/outbound','outbound','/outbound/channels','outboundChannels','/agents','agentCapacity','/telephones','trunks','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','/openchannel/queues/waitinginteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify'];(function(_0xefc237,_0x34b5d5){var _0x495e73=function(_0x257aab){while(--_0x257aab){_0xefc237['push'](_0xefc237['shift']());}};_0x495e73(++_0x34b5d5);}(_0x29d6,0xfc));var _0x629d=function(_0x23f2f2,_0x188817){_0x23f2f2=_0x23f2f2-0x0;var _0x56b17c=_0x29d6[_0x23f2f2];return _0x56b17c;};'use strict';var multer=require(_0x629d('0x0'));var util=require(_0x629d('0x1'));var path=require(_0x629d('0x2'));var express=require(_0x629d('0x3'));var router=express['Router']();var auth=require(_0x629d('0x4'));var controller=require(_0x629d('0x5'));router[_0x629d('0x6')](_0x629d('0x7'),auth['isAuthenticated'](),controller['voiceChannels']);router[_0x629d('0x6')](_0x629d('0x8'),auth[_0x629d('0x9')](),controller['voiceChannelMixMonitor']);router['get']('/voice/channels/:uniqueid/stopmixmonitor',auth[_0x629d('0x9')](),controller[_0x629d('0xa')]);router[_0x629d('0x6')](_0x629d('0xb'),auth[_0x629d('0x9')](),controller['voiceQueues']);router[_0x629d('0x6')](_0x629d('0xc'),auth[_0x629d('0x9')](),controller[_0x629d('0xd')]);router[_0x629d('0x6')]('/mail/queues',auth[_0x629d('0x9')](),controller[_0x629d('0xe')]);router[_0x629d('0x6')]('/mail/accounts',auth['isAuthenticated'](),controller[_0x629d('0xf')]);router['get'](_0x629d('0x10'),auth[_0x629d('0x9')](),controller['openchannelQueues']);router[_0x629d('0x6')](_0x629d('0x11'),auth[_0x629d('0x9')](),controller[_0x629d('0x12')]);router[_0x629d('0x6')](_0x629d('0x13'),auth[_0x629d('0x9')](),controller[_0x629d('0x14')]);router[_0x629d('0x6')](_0x629d('0x15'),auth['isAuthenticated'](),controller[_0x629d('0x16')]);router[_0x629d('0x6')]('/voice/queues/preview/:id',auth[_0x629d('0x9')](),controller[_0x629d('0x17')]);router['get'](_0x629d('0x18'),auth[_0x629d('0x9')](),controller[_0x629d('0x19')]);router[_0x629d('0x6')]('/voice/queues/channels/:uniqueid',auth[_0x629d('0x9')](),controller[_0x629d('0x1a')]);router[_0x629d('0x6')](_0x629d('0x1b'),auth[_0x629d('0x9')](),controller[_0x629d('0x1c')]);router[_0x629d('0x6')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth['isAuthenticated'](),controller[_0x629d('0x1d')]);router['get'](_0x629d('0x1e'),auth['isAuthenticated'](),controller['showVoiceQueues']);router[_0x629d('0x1f')](_0x629d('0x1e'),auth['isAuthenticated'](),controller['updateVoiceQueue']);router[_0x629d('0x6')](_0x629d('0x20'),auth[_0x629d('0x9')](),controller[_0x629d('0x21')]);router[_0x629d('0x6')](_0x629d('0x22'),auth[_0x629d('0x9')](),controller[_0x629d('0x23')]);router[_0x629d('0x6')](_0x629d('0x24'),auth['isAuthenticated'](),controller['agents']);router[_0x629d('0x1f')]('/agents/:id/capacity',auth[_0x629d('0x9')](),controller[_0x629d('0x25')]);router[_0x629d('0x6')](_0x629d('0x26'),auth[_0x629d('0x9')](),controller['telephones']);router[_0x629d('0x6')]('/trunks',auth['isAuthenticated'](),controller[_0x629d('0x27')]);router[_0x629d('0x6')]('/campaigns',auth[_0x629d('0x9')](),controller['campaigns']);router['get'](_0x629d('0x28'),auth[_0x629d('0x9')](),controller[_0x629d('0x29')]);router[_0x629d('0x6')](_0x629d('0x2a'),auth[_0x629d('0x9')](),controller[_0x629d('0x2b')]);router[_0x629d('0x6')](_0x629d('0x2c'),auth[_0x629d('0x9')](),controller['mailQueuesWaitingInteractions']);router[_0x629d('0x6')](_0x629d('0x2d'),auth['isAuthenticated'](),controller['openchannelQueuesWaitingInteractions']);router[_0x629d('0x6')](_0x629d('0x2e'),auth['isAuthenticated'](),controller[_0x629d('0x2f')]);router[_0x629d('0x6')]('/sms/queues/waitinginteractions',auth[_0x629d('0x9')](),controller[_0x629d('0x30')]);router['get'](_0x629d('0x31'),auth['isAuthenticated'](),controller[_0x629d('0x32')]);router[_0x629d('0x6')](_0x629d('0x33'),auth[_0x629d('0x9')](),controller[_0x629d('0x34')]);router[_0x629d('0x35')](_0x629d('0x36'),auth[_0x629d('0x9')](),controller[_0x629d('0x37')](_0x629d('0x38')));router[_0x629d('0x6')](_0x629d('0x39'),auth[_0x629d('0x9')](),controller[_0x629d('0x3a')]);router[_0x629d('0x35')](_0x629d('0x3b'),auth[_0x629d('0x9')](),controller[_0x629d('0x37')](_0x629d('0x3c')));router[_0x629d('0x6')](_0x629d('0x3d'),auth[_0x629d('0x9')](),controller[_0x629d('0x3e')]);router[_0x629d('0x35')](_0x629d('0x3f'),auth[_0x629d('0x9')](),controller[_0x629d('0x37')](_0x629d('0x40')));router['get'](_0x629d('0x41'),auth[_0x629d('0x9')](),controller[_0x629d('0x42')]);router[_0x629d('0x35')](_0x629d('0x43'),auth[_0x629d('0x9')](),controller[_0x629d('0x37')]('openchannel'));router[_0x629d('0x6')](_0x629d('0x44'),auth[_0x629d('0x9')](),controller[_0x629d('0x45')]);router['post'](_0x629d('0x46'),auth['isAuthenticated'](),controller['queueNotify']('sms'));router['post']('/whatsapp/queues/:id/notify',auth['isAuthenticated'](),controller['queueNotify'](_0x629d('0x47')));router[_0x629d('0x6')](_0x629d('0x48'),auth[_0x629d('0x9')](),controller[_0x629d('0x49')]);router[_0x629d('0x6')](_0x629d('0x4a'),auth[_0x629d('0x9')](),controller[_0x629d('0x4b')]);router[_0x629d('0x35')](_0x629d('0x4c'),auth[_0x629d('0x9')](),controller['agentNotify']);module['exports']=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 373baaf..26bd58a 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(_0x553150,_0x589ff3){var _0x18193d=function(_0x3a5ae6){while(--_0x3a5ae6){_0x553150['push'](_0x553150['shift']());}};_0x18193d(++_0x589ff3);}(_0xeff8,0x186));var _0x8eff=function(_0x365be9,_0x3c88b9){_0x365be9=_0x365be9-0x0;var _0x185c12=_0xeff8[_0x365be9];return _0x185c12;};'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 _0x425d=['http','request','then','error','code','message','result','catch','status','sendStatus','stack','name','isNil','rows','find','query','merge','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','VoiceQueuesChannelRedirect','outboundChannels','agents','Agents','agentCapacity','body','interaction','user','MemberReport','length','format','updateAttributes','findOrCreate','INTERACTION','interface','YYYY-MM-DD\x20HH:mm:ss','agent','internal','AgentCapacity','capacity','Telephones','trunks','campaigns','Campaigns','ChatQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','showOpenchannelQueues','OpenchannelQueues','smsQueues','SmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','OpenchannelQueuesWaitingInteractions','filter','map','queue_id','uniq','indexOf','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','Queue','findOne','Message','messageId','Interaction','\x20Message\x20not\x20found','MessageId','InteractionId','From','QueueId','TransferReport','Start','queue','queueTransferTimeout','*,*,*,*','agentNotify','Channel\x20field\x20is\x20mandatory','channel','User','update','agentTransferTimeout','bluebird','lodash','util','../../mysqldb','../../config/logger','api','jayson/promise','client'];(function(_0x5dfe43,_0x41c2ee){var _0x15cf7f=function(_0x33d189){while(--_0x33d189){_0x5dfe43['push'](_0x5dfe43['shift']());}};_0x15cf7f(++_0x41c2ee);}(_0x425d,0x1e0));var _0xd425=function(_0x1cba4c,_0x36a6cf){_0x1cba4c=_0x1cba4c-0x0;var _0x108270=_0x425d[_0x1cba4c];return _0x108270;};'use strict';var BPromise=require(_0xd425('0x0'));var moment=require('moment');var _=require(_0xd425('0x1'));var util=require(_0xd425('0x2'));var db=require(_0xd425('0x3'))['db'];var logger=require(_0xd425('0x4'))(_0xd425('0x5'));var jayson=require(_0xd425('0x6'));var amiClient=jayson[_0xd425('0x7')]['http']({'port':0x232a});var mailClient=jayson[_0xd425('0x7')][_0xd425('0x8')]({'port':0x232b});var routingClient=jayson[_0xd425('0x7')][_0xd425('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x1d97d9,_0x1d2ed0,_0x50b061){return new BPromise(function(_0xb6ba8e,_0x374c3d){var _0x262b02=_0x50b061?_0x50b061:amiClient;return _0x262b02[_0xd425('0x9')](_0x1d97d9,_0x1d2ed0)[_0xd425('0xa')](function(_0x2beb20){if(_0x2beb20[_0xd425('0xb')]){if(_0x2beb20[_0xd425('0xb')][_0xd425('0xc')]===0x1f4){return _0x374c3d(_0x2beb20[_0xd425('0xb')][_0xd425('0xd')]);}return _0xb6ba8e(_0x2beb20[_0xd425('0xb')][_0xd425('0xd')]);}else{_0xb6ba8e(_0x2beb20[_0xd425('0xe')]);}})[_0xd425('0xf')](function(_0x2385a5){_0x374c3d(_0x2385a5);});});}function respondWithResult(_0x9bb611,_0x3cacf7){_0x3cacf7=_0x3cacf7||0xc8;return function(_0x3b5de8){if(_0x3b5de8){return _0x9bb611[_0xd425('0x10')](_0x3cacf7)['json'](_0x3b5de8);}return _0x9bb611[_0xd425('0x11')](0x194);};}function handleError(_0x17a498,_0x336dc3){_0x336dc3=_0x336dc3||0x1f4;return function(_0x5d3d60){logger[_0xd425('0xb')](_0x5d3d60[_0xd425('0x12')]);if(_0x5d3d60[_0xd425('0x13')]){delete _0x5d3d60[_0xd425('0x13')];}_0x17a498[_0xd425('0x10')](_0x336dc3)['send'](_0x5d3d60);};}function findById(_0x278626){return function(_0x471267){if(!_[_0xd425('0x14')](_0x278626)&&!_[_0xd425('0x14')](_0x471267)&&!_['isNil'](_0x471267[_0xd425('0x15')])){return _[_0xd425('0x16')](_0x471267[_0xd425('0x15')],function(_0x1155bc){return _0x1155bc['id']==_0x278626;});}return null;};}exports['voiceChannels']=function(_0x58a0c1,_0x5debc3){return respondWithRpcPromise('VoiceChannels',_0x58a0c1[_0xd425('0x17')])[_0xd425('0xa')](respondWithResult(_0x5debc3,null))[_0xd425('0xf')](handleError(_0x5debc3,null));};exports['voiceChannelMixMonitor']=function(_0x355af0,_0x7e982e){return respondWithRpcPromise('VoiceChannelMixMonitor',_[_0xd425('0x18')](_0x355af0[_0xd425('0x17')],_0x355af0[_0xd425('0x19')]))[_0xd425('0xa')](respondWithResult(_0x7e982e,null))[_0xd425('0xf')](handleError(_0x7e982e,null));};exports[_0xd425('0x1a')]=function(_0x2480a0,_0x3500bb){return respondWithRpcPromise(_0xd425('0x1b'),_[_0xd425('0x18')](_0x2480a0[_0xd425('0x17')],_0x2480a0[_0xd425('0x19')]))['then'](respondWithResult(_0x3500bb,null))[_0xd425('0xf')](handleError(_0x3500bb,null));};exports[_0xd425('0x1c')]=function(_0x398985,_0x1908a5){return respondWithRpcPromise(_0xd425('0x1d'),_0x398985[_0xd425('0x17')])[_0xd425('0xa')](respondWithResult(_0x1908a5,null))['catch'](handleError(_0x1908a5,null));};exports[_0xd425('0x1e')]=function(_0x177de2,_0x1d8861){return respondWithRpcPromise('VoiceQueues',_0x177de2[_0xd425('0x17')])[_0xd425('0xa')](findById(_0x177de2[_0xd425('0x19')]['id']))[_0xd425('0xa')](respondWithResult(_0x1d8861,null))[_0xd425('0xf')](handleError(_0x1d8861,null));};exports[_0xd425('0x1f')]=function(_0x2fd17a,_0x37b63c){return respondWithRpcPromise(_0xd425('0x20'),_[_0xd425('0x18')](_0x2fd17a['body'],_0x2fd17a[_0xd425('0x19')]))[_0xd425('0xa')](respondWithResult(_0x37b63c,null))[_0xd425('0xf')](handleError(_0x37b63c,null));};exports[_0xd425('0x21')]=function(_0x3275b1,_0x1abf33){return respondWithRpcPromise(_0xd425('0x22'),_[_0xd425('0x18')](_0x3275b1[_0xd425('0x17')],_0x3275b1[_0xd425('0x19')]))[_0xd425('0xa')](respondWithResult(_0x1abf33,null))['catch'](handleError(_0x1abf33,null));};exports[_0xd425('0x23')]=function(_0x2a2a9b,_0x3120a4){return respondWithRpcPromise(_0xd425('0x24'),_0x2a2a9b[_0xd425('0x17')])['then'](respondWithResult(_0x3120a4,null))[_0xd425('0xf')](handleError(_0x3120a4,null));};exports[_0xd425('0x25')]=function(_0x4cfcd1,_0x574962){return respondWithRpcPromise('VoiceQueuesChannel',_[_0xd425('0x18')](_0x4cfcd1[_0xd425('0x17')],_0x4cfcd1[_0xd425('0x19')]))[_0xd425('0xa')](respondWithResult(_0x574962,null))['catch'](handleError(_0x574962,null));};exports[_0xd425('0x26')]=function(_0x1d4414,_0x30a9dc){return respondWithRpcPromise(_0xd425('0x27'),_[_0xd425('0x18')](_0x1d4414[_0xd425('0x17')],_0x1d4414[_0xd425('0x19')]))['then'](respondWithResult(_0x30a9dc,null))[_0xd425('0xf')](handleError(_0x30a9dc,null));};exports['voiceQueuesChannelRedirect']=function(_0x22df81,_0x29cca9){return respondWithRpcPromise(_0xd425('0x28'),_['merge'](_0x22df81[_0xd425('0x17')],_0x22df81[_0xd425('0x19')]))[_0xd425('0xa')](respondWithResult(_0x29cca9,null))[_0xd425('0xf')](handleError(_0x29cca9,null));};exports['outbound']=function(_0x1d38fa,_0x3cf540){return respondWithRpcPromise('Outbound',_0x1d38fa['query'])['then'](respondWithResult(_0x3cf540,null))[_0xd425('0xf')](handleError(_0x3cf540,null));};exports[_0xd425('0x29')]=function(_0x1f30c1,_0x588688){return respondWithRpcPromise('OutboundChannels',_0x1f30c1['query'])[_0xd425('0xa')](respondWithResult(_0x588688,null))[_0xd425('0xf')](handleError(_0x588688,null));};exports[_0xd425('0x2a')]=function(_0x1d5017,_0xa9fd7c){var _0x14f3be;return respondWithRpcPromise(_0xd425('0x2b'),_0x1d5017['query'])[_0xd425('0xa')](function(_0x3c88a8){_0x14f3be=_0x3c88a8;return respondWithRpcPromise(_0xd425('0x2b'),_0x1d5017['query'],routingClient);})[_0xd425('0xa')](function(_0x2dffc7){return _[_0xd425('0x18')]({},_0x2dffc7,_0x14f3be);})['then'](respondWithResult(_0xa9fd7c,null))[_0xd425('0xf')](handleError(_0xa9fd7c,null));};exports[_0xd425('0x2c')]=function(_0x1c5ba6,_0x2d7a2f){if(_0x1c5ba6['body']&&_0x1c5ba6[_0xd425('0x2d')][_0xd425('0x2e')]&&_0x1c5ba6[_0xd425('0x2f')]&&_0x1c5ba6[_0xd425('0x2f')][_0xd425('0x13')]){for(var _0x2f6bf7 in _0x1c5ba6[_0xd425('0x2d')]['interaction']){if(_0x1c5ba6[_0xd425('0x2d')][_0xd425('0x2e')]['hasOwnProperty'](_0x2f6bf7)){db[_0xd425('0x30')]['findAll']({'where':{'channel':_0x2f6bf7,'membername':_0x1c5ba6['user'][_0xd425('0x13')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x1c5ba6[_0xd425('0x2d')]['interaction'][_0x2f6bf7]&&_0x1c5ba6[_0xd425('0x2d')][_0xd425('0x2e')][_0x2f6bf7][_0xd425('0x31')]?{'$notIn':_0x1c5ba6[_0xd425('0x2d')][_0xd425('0x2e')][_0x2f6bf7]}:{'$ne':null}}})['then'](function(_0x2e4b21){var _0x5f3cfd=moment()[_0xd425('0x32')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x78ed9b=0x0,_0x16f61c=_0x2e4b21[_0xd425('0x31')];_0x78ed9b<_0x16f61c;_0x78ed9b+=0x1){_0x2e4b21[_0x78ed9b][_0xd425('0x33')]({'exitAt':_0x5f3cfd});}});for(var _0x624543=0x0;_0x624543<_0x1c5ba6['body'][_0xd425('0x2e')][_0x2f6bf7][_0xd425('0x31')];_0x624543+=0x1){db[_0xd425('0x30')][_0xd425('0x34')]({'where':{'channel':_0x2f6bf7,'membername':_0x1c5ba6[_0xd425('0x2f')]['name'],'type':_0xd425('0x35'),'uniqueid':_0x1c5ba6[_0xd425('0x2d')][_0xd425('0x2e')][_0x2f6bf7][_0x624543],'exitAt':null},'defaults':{'channel':_0x2f6bf7,'membername':_0x1c5ba6[_0xd425('0x2f')][_0xd425('0x13')],'interface':_[_0xd425('0x14')](_0x1c5ba6['user'][_0xd425('0x36')])?util[_0xd425('0x32')]('SIP/%s',_0x1c5ba6[_0xd425('0x2f')][_0xd425('0x13')]):_0x1c5ba6[_0xd425('0x2f')][_0xd425('0x36')],'type':'INTERACTION','enterAt':moment()[_0xd425('0x32')](_0xd425('0x37')),'role':_0xd425('0x38'),'internal':_0x1c5ba6[_0xd425('0x2f')][_0xd425('0x39')],'uniqueid':_0x1c5ba6['body']['interaction'][_0x2f6bf7][_0x624543]}});}}}}return respondWithRpcPromise(_0xd425('0x3a'),{'id':_0x1c5ba6['params']['id'],'capacity':_0x1c5ba6[_0xd425('0x2d')][_0xd425('0x3b')]},routingClient)['then'](respondWithResult(_0x2d7a2f,null))[_0xd425('0xf')](handleError(_0x2d7a2f,null));};exports['telephones']=function(_0x48d5b8,_0x39f588){return respondWithRpcPromise(_0xd425('0x3c'),_0x48d5b8[_0xd425('0x17')])[_0xd425('0xa')](respondWithResult(_0x39f588,null))[_0xd425('0xf')](handleError(_0x39f588,null));};exports[_0xd425('0x3d')]=function(_0xeb3586,_0x4118fe){return respondWithRpcPromise('Trunks',_0xeb3586[_0xd425('0x17')])[_0xd425('0xa')](respondWithResult(_0x4118fe,null))[_0xd425('0xf')](handleError(_0x4118fe,null));};exports[_0xd425('0x3e')]=function(_0x7b1080,_0x1c80c2){return respondWithRpcPromise(_0xd425('0x3f'),_0x7b1080[_0xd425('0x17')])['then'](respondWithResult(_0x1c80c2,null))['catch'](handleError(_0x1c80c2,null));};exports['chatQueues']=function(_0x145e76,_0x2c5d01){return respondWithRpcPromise(_0xd425('0x40'),_0x145e76[_0xd425('0x17')],routingClient)['then'](respondWithResult(_0x2c5d01,null))['catch'](handleError(_0x2c5d01,null));};exports['showChatQueues']=function(_0x5e1294,_0x254b8b){return respondWithRpcPromise(_0xd425('0x40'),_0x5e1294['query'],routingClient)[_0xd425('0xa')](findById(_0x5e1294[_0xd425('0x19')]['id']))[_0xd425('0xa')](respondWithResult(_0x254b8b,null))['catch'](handleError(_0x254b8b,null));};exports['mailQueues']=function(_0x599cb5,_0x49d75e){return respondWithRpcPromise('MailQueues',_0x599cb5['query'],routingClient)[_0xd425('0xa')](respondWithResult(_0x49d75e,null))[_0xd425('0xf')](handleError(_0x49d75e,null));};exports[_0xd425('0x41')]=function(_0x5b2323,_0x3395d8){return respondWithRpcPromise('MailQueues',_0x5b2323[_0xd425('0x17')],routingClient)[_0xd425('0xa')](findById(_0x5b2323[_0xd425('0x19')]['id']))[_0xd425('0xa')](respondWithResult(_0x3395d8,null))[_0xd425('0xf')](handleError(_0x3395d8,null));};exports[_0xd425('0x42')]=function(_0xa21f7c,_0x3ca6a6){return respondWithRpcPromise(_0xd425('0x43'),_0xa21f7c['query'],mailClient)[_0xd425('0xa')](respondWithResult(_0x3ca6a6,null))[_0xd425('0xf')](handleError(_0x3ca6a6,null));};exports[_0xd425('0x44')]=function(_0xf22906,_0x5c4df8){return respondWithRpcPromise('OpenchannelQueues',_0xf22906[_0xd425('0x17')],routingClient)[_0xd425('0xa')](respondWithResult(_0x5c4df8,null))[_0xd425('0xf')](handleError(_0x5c4df8,null));};exports[_0xd425('0x45')]=function(_0x464ed1,_0x2e0f00){return respondWithRpcPromise(_0xd425('0x46'),_0x464ed1[_0xd425('0x17')],routingClient)[_0xd425('0xa')](findById(_0x464ed1[_0xd425('0x19')]['id']))[_0xd425('0xa')](respondWithResult(_0x2e0f00,null))[_0xd425('0xf')](handleError(_0x2e0f00,null));};exports[_0xd425('0x47')]=function(_0x28979e,_0x5e72db){return respondWithRpcPromise(_0xd425('0x48'),_0x28979e[_0xd425('0x17')],routingClient)[_0xd425('0xa')](respondWithResult(_0x5e72db,null))['catch'](handleError(_0x5e72db,null));};exports['showSmsQueues']=function(_0x5ade1a,_0x403cb3){return respondWithRpcPromise(_0xd425('0x48'),_0x5ade1a[_0xd425('0x17')],routingClient)['then'](findById(_0x5ade1a[_0xd425('0x19')]['id']))['then'](respondWithResult(_0x403cb3,null))[_0xd425('0xf')](handleError(_0x403cb3,null));};exports[_0xd425('0x49')]=function(_0x21d26e,_0x5113fc){return respondWithRpcPromise(_0xd425('0x4a'),_0x21d26e[_0xd425('0x17')],routingClient)[_0xd425('0xa')](respondWithResult(_0x5113fc,null))[_0xd425('0xf')](handleError(_0x5113fc,null));};exports[_0xd425('0x4b')]=function(_0x43b1a9,_0x38a762){return respondWithRpcPromise(_0xd425('0x4a'),_0x43b1a9[_0xd425('0x17')],routingClient)[_0xd425('0xa')](findById(_0x43b1a9[_0xd425('0x19')]['id']))[_0xd425('0xa')](respondWithResult(_0x38a762,null))[_0xd425('0xf')](handleError(_0x38a762,null));};exports[_0xd425('0x4c')]=function(_0x445f98,_0x443126){return respondWithRpcPromise(_0xd425('0x4d'),_0x445f98[_0xd425('0x17')],routingClient)['then'](respondWithResult(_0x443126,null))['catch'](handleError(_0x443126,null));};exports[_0xd425('0x4e')]=function(_0x5c333a,_0x135048){return respondWithRpcPromise(_0xd425('0x4d'),_0x5c333a[_0xd425('0x17')],routingClient)[_0xd425('0xa')](findById(_0x5c333a['params']['id']))[_0xd425('0xa')](respondWithResult(_0x135048,null))[_0xd425('0xf')](handleError(_0x135048,null));};exports[_0xd425('0x4f')]=function(_0x689332,_0x2536bd){return respondWithRpcPromise(_0xd425('0x50'),_0x689332['query'])['then'](respondWithResult(_0x2536bd,null))[_0xd425('0xf')](handleError(_0x2536bd,null));};exports[_0xd425('0x51')]=function(_0x5e76f5,_0x174081){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x5e76f5[_0xd425('0x17')],routingClient)[_0xd425('0xa')](respondWithResult(_0x174081,null))[_0xd425('0xf')](handleError(_0x174081,null));};exports[_0xd425('0x52')]=function(_0x376134,_0x2514fa){return respondWithRpcPromise(_0xd425('0x53'),_0x376134['query'],routingClient)[_0xd425('0xa')](respondWithResult(_0x2514fa,null))[_0xd425('0xf')](handleError(_0x2514fa,null));};exports[_0xd425('0x54')]=function(_0x233efa,_0xfcba08){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x233efa[_0xd425('0x17')],routingClient)[_0xd425('0xa')](respondWithResult(_0xfcba08,null))['catch'](handleError(_0xfcba08,null));};exports[_0xd425('0x55')]=function(_0x4599b0,_0x48bed3){return respondWithRpcPromise(_0xd425('0x56'),_0x4599b0[_0xd425('0x17')],routingClient)[_0xd425('0xa')](function(_0xd923bb){if(_0x4599b0[_0xd425('0x17')]['type']!==undefined){var _0x454cce=_(_0xd923bb['rows'])[_0xd425('0x57')]([_0x4599b0[_0xd425('0x17')]['type'],_0x4599b0[_0xd425('0x19')]['id']])[_0xd425('0x58')](_0xd425('0x59'))[_0xd425('0x5a')]()['value']();return _0xd923bb['rows'][_0xd425('0x57')](function(_0x2312c1){return _0x454cce[_0xd425('0x5b')](_0x2312c1['queue_id'])>-0x1;});}else{return _0xd923bb[_0xd425('0x15')][_0xd425('0x57')](function(_0x5b932c){return _0x5b932c[_0xd425('0x59')]===parseInt(_0x4599b0['params']['id']);});}})[_0xd425('0xa')](respondWithResult(_0x48bed3,null))[_0xd425('0xf')](handleError(_0x48bed3,null));};exports[_0xd425('0x5c')]=function(_0x2493e7,_0x5750dc){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x2493e7[_0xd425('0x17')],routingClient)[_0xd425('0xa')](respondWithResult(_0x5750dc,null))['catch'](handleError(_0x5750dc,null));};exports[_0xd425('0x5d')]=function(_0x389099,_0x51c9ad){return respondWithRpcPromise(_0xd425('0x5e'),_0x389099[_0xd425('0x17')],routingClient)[_0xd425('0xa')](respondWithResult(_0x51c9ad,null))[_0xd425('0xf')](handleError(_0x51c9ad,null));};exports[_0xd425('0x5f')]=function(_0xf251e6,_0x302066){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0xf251e6['query'],routingClient)[_0xd425('0xa')](respondWithResult(_0x302066,null))['catch'](handleError(_0x302066,null));};exports[_0xd425('0x60')]=function(_0x236030){return function(_0x58cad5,_0x244789){var _0x1c1c77,_0x5dac05;var _0x592c40=_[_0xd425('0x61')](_0x236030);var _0x242ed8=_0x236030===_0xd425('0x62')?_0xd425('0x63'):_0xd425('0x64');return db[_0x592c40+_0xd425('0x65')][_0xd425('0x66')]({'raw':!![],'where':{'id':_0x58cad5[_0xd425('0x19')]['id']}})['then'](function(_0x2cff42){if(_[_0xd425('0x14')](_0x2cff42)){throw new Error(_0x592c40+'\x20Queue\x20not\x20found');}_0x1c1c77=_0x2cff42;return db[_0x592c40+_0xd425('0x67')][_0xd425('0x66')]({'where':{'id':_0x58cad5[_0xd425('0x2d')][_0xd425('0x68')]},'include':[{'model':db[_0x592c40+_0xd425('0x69')],'as':_0xd425('0x69')},{'model':db[_0x592c40+_0x242ed8],'as':_0xd425('0x64')}]});})[_0xd425('0xa')](function(_0x334062){if(_[_0xd425('0x14')](_0x334062)){throw new Error(_0x592c40+_0xd425('0x6a'));}_0x5dac05=_0x334062;return _0x334062['update']({'read':0x0,'readAt':null,'UserId':null});})[_0xd425('0xa')](function(){var _0x498e81={'uniqueid':_0x236030+'.'+_0x5dac05['id']+'.'+_0x5dac05['Interaction']['id'],'FromUserId':_0x58cad5[_0xd425('0x2f')]['id'],'type':'queue'};_0x498e81[_0x592c40+_0xd425('0x6b')]=_0x5dac05['id'];_0x498e81[_0x592c40+_0xd425('0x6c')]=_0x5dac05[_0xd425('0x69')]['id'];_0x498e81[_0xd425('0x6d')+_0x592c40+_0x242ed8+'Id']=_0x5dac05[_0xd425('0x64')]['id'];_0x498e81['To'+_0x592c40+_0xd425('0x6e')]=_0x1c1c77['id'];return db[_0x592c40+_0xd425('0x6f')]['create'](_0x498e81);})[_0xd425('0xa')](function(){return respondWithRpcPromise(_0xd425('0x70'),{'channel':_0x236030,'interaction':_0x5dac05[_0xd425('0x69')],'message':_0x5dac05,'account':_0x5dac05[_0xd425('0x64')],'applications':[{'id':0x0,'priority':0x1,'app':_0xd425('0x71'),'appdata':_0x1c1c77['name']+','+(_0x5dac05[_0xd425('0x64')][_0xd425('0x72')]||0x12c),'interval':_0xd425('0x73')}]},routingClient);})[_0xd425('0xa')](respondWithResult(_0x244789,null))[_0xd425('0xf')](handleError(_0x244789,null));};};exports[_0xd425('0x74')]=function(_0x409612,_0x4147eb){var _0x433e5d,_0x334226;if(_[_0xd425('0x14')](_0x409612[_0xd425('0x2d')]['channel'])){throw new Error(_0xd425('0x75'));}var _0x5d8a47=_0x409612[_0xd425('0x2d')][_0xd425('0x76')];var _0x1c03d6=_[_0xd425('0x61')](_0x5d8a47);var _0xf06395=_0x5d8a47==='chat'?_0xd425('0x63'):_0xd425('0x64');return db[_0xd425('0x77')][_0xd425('0x66')]({'raw':!![],'where':{'id':_0x409612[_0xd425('0x19')]['id'],'role':_0xd425('0x38')}})[_0xd425('0xa')](function(_0x568a83){if(_[_0xd425('0x14')](_0x568a83)){throw new Error('Agent\x20not\x20found');}_0x433e5d=_0x568a83;return db[_0x1c03d6+_0xd425('0x67')][_0xd425('0x66')]({'where':{'id':_0x409612['body'][_0xd425('0x68')]},'include':[{'model':db[_0x1c03d6+_0xd425('0x69')],'as':'Interaction'},{'model':db[_0x1c03d6+_0xf06395],'as':_0xd425('0x64')}]});})[_0xd425('0xa')](function(_0xca2955){if(_[_0xd425('0x14')](_0xca2955)){throw new Error(_0x1c03d6+_0xd425('0x6a'));}_0x334226=_0xca2955;return _0xca2955[_0xd425('0x78')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x3f1a48={'uniqueid':_0x5d8a47+'.'+_0x334226['id']+'.'+_0x334226['Interaction']['id'],'FromUserId':_0x409612[_0xd425('0x2f')]['id'],'type':'queue','ToUserId':_0x433e5d['id']};_0x3f1a48[_0x1c03d6+_0xd425('0x6b')]=_0x334226['id'];_0x3f1a48[_0x1c03d6+_0xd425('0x6c')]=_0x334226[_0xd425('0x69')]['id'];_0x3f1a48[_0xd425('0x6d')+_0x1c03d6+_0xf06395+'Id']=_0x334226['Account']['id'];return db[_0x1c03d6+'TransferReport']['create'](_0x3f1a48);})['then'](function(){return respondWithRpcPromise(_0xd425('0x70'),{'channel':_0x5d8a47,'interaction':_0x334226['Interaction'],'message':_0x334226,'account':_0x334226[_0xd425('0x64')],'applications':[{'id':0x0,'priority':0x1,'app':_0xd425('0x38'),'appdata':_0x433e5d[_0xd425('0x13')]+','+(_0x334226[_0xd425('0x64')][_0xd425('0x79')]||0x12c),'interval':_0xd425('0x73')}]},routingClient);})['then'](respondWithResult(_0x4147eb,null))[_0xd425('0xf')](handleError(_0x4147eb,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index e933597..ee468c3 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 _0xaecb=['/:id','show','run','put','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./schedule.controller','isAuthenticated','index','get'];(function(_0x18fd0b,_0xe0f9ed){var _0x3b19a3=function(_0xde37ae){while(--_0xde37ae){_0x18fd0b['push'](_0x18fd0b['shift']());}};_0x3b19a3(++_0xe0f9ed);}(_0xaecb,0xb9));var _0xbaec=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xaecb[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xbaec('0x0'));var util=require(_0xbaec('0x1'));var path=require(_0xbaec('0x2'));var timeout=require(_0xbaec('0x3'));var express=require(_0xbaec('0x4'));var router=express[_0xbaec('0x5')]();var fs_extra=require(_0xbaec('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xbaec('0x7'));var config=require(_0xbaec('0x8'));var controller=require(_0xbaec('0x9'));router['get']('/',auth[_0xbaec('0xa')](),controller[_0xbaec('0xb')]);router[_0xbaec('0xc')](_0xbaec('0xd'),auth[_0xbaec('0xa')](),controller[_0xbaec('0xe')]);router['get']('/:id/run',auth[_0xbaec('0xa')](),controller[_0xbaec('0xf')]);router['post']('/',auth[_0xbaec('0xa')](),controller['create']);router[_0xbaec('0x10')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0xbaec('0xd'),auth[_0xbaec('0xa')](),controller[_0xbaec('0x11')]);module['exports']=router; \ No newline at end of file +var _0x5c62=['path','express','Router','../../components/auth/service','./schedule.controller','isAuthenticated','index','get','/:id','/:id/run','run','post','create','put','update','delete','exports','multer','util'];(function(_0x462c1c,_0x4d6bc7){var _0x116d67=function(_0x313984){while(--_0x313984){_0x462c1c['push'](_0x462c1c['shift']());}};_0x116d67(++_0x4d6bc7);}(_0x5c62,0xe2));var _0x25c6=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5c62[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x25c6('0x0'));var util=require(_0x25c6('0x1'));var path=require(_0x25c6('0x2'));var timeout=require('connect-timeout');var express=require(_0x25c6('0x3'));var router=express[_0x25c6('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x25c6('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x25c6('0x6'));router['get']('/',auth[_0x25c6('0x7')](),controller[_0x25c6('0x8')]);router[_0x25c6('0x9')](_0x25c6('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x25c6('0x9')](_0x25c6('0xb'),auth[_0x25c6('0x7')](),controller[_0x25c6('0xc')]);router[_0x25c6('0xd')]('/',auth[_0x25c6('0x7')](),controller[_0x25c6('0xe')]);router[_0x25c6('0xf')](_0x25c6('0xa'),auth[_0x25c6('0x7')](),controller[_0x25c6('0x10')]);router[_0x25c6('0x11')](_0x25c6('0xa'),auth[_0x25c6('0x7')](),controller['destroy']);module[_0x25c6('0x12')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 4802c2b..69a0712 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 _0x8a90=['months','weeks','days','minutes','csv','xlsx','default','TEXT','sequelize','STRING','BOOLEAN','DATE','INTEGER','ENUM','years','quarters'];(function(_0x153eea,_0x2636f4){var _0x3660e5=function(_0x5d522f){while(--_0x5d522f){_0x153eea['push'](_0x153eea['shift']());}};_0x3660e5(++_0x2636f4);}(_0x8a90,0x1e8));var _0x08a9=function(_0x2f4ee6,_0x24a540){_0x2f4ee6=_0x2f4ee6-0x0;var _0x28f20e=_0x8a90[_0x2f4ee6];return _0x28f20e;};'use strict';var Sequelize=require(_0x08a9('0x0'));module['exports']={'name':{'type':Sequelize[_0x08a9('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x08a9('0x1')]},'active':{'type':Sequelize[_0x08a9('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x08a9('0x1')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0x08a9('0x3')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x08a9('0x4')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x08a9('0x5')](_0x08a9('0x6'),_0x08a9('0x7'),_0x08a9('0x8'),_0x08a9('0x9'),_0x08a9('0xa'),'hours',_0x08a9('0xb')),'allowNull':![],'defaultValue':_0x08a9('0xa')},'output':{'type':Sequelize[_0x08a9('0x5')](_0x08a9('0xc'),'pdf',_0x08a9('0xd')),'allowNull':![],'defaultValue':_0x08a9('0xc')},'type':{'type':Sequelize['ENUM']('custom',_0x08a9('0xe')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0x08a9('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x08a9('0x1')]},'cc':{'type':Sequelize[_0x08a9('0xf')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize[_0x08a9('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x6933=['csv','pdf','xlsx','default','custom','TEXT','BOOLEAN','STRING','0\x200\x20*\x20*\x20*','DATE','ENUM','quarters','months','weeks','days'];(function(_0x54b476,_0x2f927b){var _0x5bd516=function(_0x2028b6){while(--_0x2028b6){_0x54b476['push'](_0x54b476['shift']());}};_0x5bd516(++_0x2f927b);}(_0x6933,0x133));var _0x3693=function(_0x13cab2,_0x148058){_0x13cab2=_0x13cab2-0x0;var _0x292c90=_0x6933[_0x13cab2];return _0x292c90;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3693('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0x3693('0x0')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x3693('0x1')},'startAt':{'type':Sequelize[_0x3693('0x2')],'allowNull':![]},'endAt':{'type':Sequelize[_0x3693('0x2')],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x3693('0x3')]('years',_0x3693('0x4'),_0x3693('0x5'),_0x3693('0x6'),_0x3693('0x7'),'hours','minutes'),'allowNull':![],'defaultValue':_0x3693('0x7')},'output':{'type':Sequelize[_0x3693('0x3')](_0x3693('0x8'),_0x3693('0x9'),_0x3693('0xa')),'allowNull':![],'defaultValue':_0x3693('0x8')},'type':{'type':Sequelize[_0x3693('0x3')]('custom',_0x3693('0xb')),'allowNull':![],'defaultValue':_0x3693('0xc')},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x3693('0xd')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize[_0x3693('0xe')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index e012539..48cdb1b 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 _0x5e8d=['../../mysqldb','sendStatus','status','json','limit','count','offset','Content-Range','apply','reject','update','destroy','then','get','Scheduler','UserProfileResource','error','stack','name','send','map','Schedule','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','params','options','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','body','run','../../config/schedule','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util'];(function(_0x104856,_0x3cb4d2){var _0x12349a=function(_0x2e9892){while(--_0x2e9892){_0x104856['push'](_0x104856['shift']());}};_0x12349a(++_0x3cb4d2);}(_0x5e8d,0x185));var _0xd5e8=function(_0x4e1d3b,_0x4c52e1){_0x4e1d3b=_0x4e1d3b-0x0;var _0x1d9285=_0x5e8d[_0x4e1d3b];return _0x1d9285;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd5e8('0x0'));var zipdir=require(_0xd5e8('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd5e8('0x2'));var moment=require(_0xd5e8('0x3'));var BPromise=require(_0xd5e8('0x4'));var Mustache=require(_0xd5e8('0x5'));var util=require(_0xd5e8('0x6'));var path=require('path');var sox=require(_0xd5e8('0x7'));var csv=require(_0xd5e8('0x8'));var ejs=require(_0xd5e8('0x9'));var fs=require('fs');var fs_extra=require(_0xd5e8('0xa'));var _=require(_0xd5e8('0xb'));var squel=require(_0xd5e8('0xc'));var crypto=require(_0xd5e8('0xd'));var jsforce=require(_0xd5e8('0xe'));var deskjs=require(_0xd5e8('0xf'));var toCsv=require(_0xd5e8('0x8'));var querystring=require(_0xd5e8('0x10'));var Papa=require(_0xd5e8('0x11'));var Redis=require('ioredis');var authService=require(_0xd5e8('0x12'));var qs=require(_0xd5e8('0x13'));var as=require(_0xd5e8('0x14'));var hardwareService=require(_0xd5e8('0x15'));var logger=require(_0xd5e8('0x16'))(_0xd5e8('0x17'));var utils=require(_0xd5e8('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xd5e8('0x19'));var db=require(_0xd5e8('0x1a'))['db'];function respondWithStatusCode(_0x3d7551,_0x1845cc){_0x1845cc=_0x1845cc||0xcc;return function(_0x1d2b79){if(_0x1d2b79){return _0x3d7551[_0xd5e8('0x1b')](_0x1845cc);}return _0x3d7551['status'](_0x1845cc)['end']();};}function respondWithResult(_0x403cec,_0x1cfe9d){_0x1cfe9d=_0x1cfe9d||0xc8;return function(_0xedee73){if(_0xedee73){return _0x403cec[_0xd5e8('0x1c')](_0x1cfe9d)[_0xd5e8('0x1d')](_0xedee73);}};}function respondWithFilteredResult(_0x347130,_0x1e4b0a){return function(_0x305ccb){if(_0x305ccb){var _0x4381b4=typeof _0x1e4b0a['offset']==='undefined'&&typeof _0x1e4b0a[_0xd5e8('0x1e')]==='undefined';var _0x346bca=_0x305ccb[_0xd5e8('0x1f')];var _0xb1b60a=_0x4381b4?0x0:_0x1e4b0a['offset'];var _0xf59b5e=_0x4381b4?_0x305ccb[_0xd5e8('0x1f')]:_0x1e4b0a[_0xd5e8('0x20')]+_0x1e4b0a[_0xd5e8('0x1e')];var _0x261ecb;if(_0xf59b5e>=_0x346bca){_0xf59b5e=_0x346bca;_0x261ecb=0xc8;}else{_0x261ecb=0xce;}_0x347130[_0xd5e8('0x1c')](_0x261ecb);return _0x347130['set'](_0xd5e8('0x21'),_0xb1b60a+'-'+_0xf59b5e+'/'+_0x346bca)[_0xd5e8('0x1d')](_0x305ccb);}return null;};}function patchUpdates(_0x4cd55f){return function(_0x4ee3b5){try{jsonpatch[_0xd5e8('0x22')](_0x4ee3b5,_0x4cd55f,!![]);}catch(_0x2e3311){return BPromise[_0xd5e8('0x23')](_0x2e3311);}return _0x4ee3b5['save']();};}function saveUpdates(_0x3a6587,_0xaf3dd6){return function(_0x3f86fe){if(_0x3f86fe){return _0x3f86fe[_0xd5e8('0x24')](_0x3a6587)['then'](function(_0x58bec9){return _0x58bec9;});}return null;};}function removeEntity(_0x33fd22,_0x1b4e79){return function(_0x34edea){if(_0x34edea){return _0x34edea[_0xd5e8('0x25')]()[_0xd5e8('0x26')](function(){var _0x15725d=_0x34edea[_0xd5e8('0x27')]({'plain':!![]});var _0x5d611d=_0xd5e8('0x28');return db[_0xd5e8('0x29')][_0xd5e8('0x25')]({'where':{'type':_0x5d611d,'resourceId':_0x15725d['id']}})['then'](function(){return _0x34edea;});})['then'](function(){_0x33fd22[_0xd5e8('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3fcb16,_0x1c0d42){return function(_0x4851fa){if(!_0x4851fa){_0x3fcb16['sendStatus'](0x194);}return _0x4851fa;};}function handleError(_0x385e84,_0x2d068a){_0x2d068a=_0x2d068a||0x1f4;return function(_0x404232){logger[_0xd5e8('0x2a')](_0x404232[_0xd5e8('0x2b')]);if(_0x404232[_0xd5e8('0x2c')]){delete _0x404232['name'];}_0x385e84[_0xd5e8('0x1c')](_0x2d068a)[_0xd5e8('0x2d')](_0x404232);};}exports['index']=function(_0x5ccdbc,_0x48d231){var _0x537b1f={},_0x234659={},_0x127013={'count':0x0,'rows':[]};var _0x35347b=_[_0xd5e8('0x2e')](db[_0xd5e8('0x2f')][_0xd5e8('0x30')],function(_0x14e0f1){return{'name':_0x14e0f1[_0xd5e8('0x31')],'type':_0x14e0f1[_0xd5e8('0x32')]['key']};});_0x234659[_0xd5e8('0x33')]=_[_0xd5e8('0x2e')](_0x35347b,'name');_0x234659[_0xd5e8('0x34')]=_[_0xd5e8('0x35')](_0x5ccdbc[_0xd5e8('0x34')]);_0x234659[_0xd5e8('0x36')]=_[_0xd5e8('0x37')](_0x234659[_0xd5e8('0x33')],_0x234659['query']);_0x537b1f[_0xd5e8('0x38')]=_['intersection'](_0x234659[_0xd5e8('0x33')],qs[_0xd5e8('0x39')](_0x5ccdbc[_0xd5e8('0x34')][_0xd5e8('0x39')]));_0x537b1f[_0xd5e8('0x38')]=_0x537b1f['attributes'][_0xd5e8('0x3a')]?_0x537b1f['attributes']:_0x234659['model'];if(!_0x5ccdbc[_0xd5e8('0x34')]['hasOwnProperty'](_0xd5e8('0x3b'))){_0x537b1f[_0xd5e8('0x1e')]=qs[_0xd5e8('0x1e')](_0x5ccdbc[_0xd5e8('0x34')][_0xd5e8('0x1e')]);_0x537b1f[_0xd5e8('0x20')]=qs[_0xd5e8('0x20')](_0x5ccdbc[_0xd5e8('0x34')]['offset']);}_0x537b1f[_0xd5e8('0x3c')]=qs['sort'](_0x5ccdbc[_0xd5e8('0x34')][_0xd5e8('0x3d')]);_0x537b1f[_0xd5e8('0x3e')]=qs[_0xd5e8('0x36')](_[_0xd5e8('0x3f')](_0x5ccdbc[_0xd5e8('0x34')],_0x234659[_0xd5e8('0x36')]),_0x35347b);if(_0x5ccdbc[_0xd5e8('0x34')][_0xd5e8('0x40')]){_0x537b1f[_0xd5e8('0x3e')]=_[_0xd5e8('0x41')](_0x537b1f[_0xd5e8('0x3e')],{'$or':_['map'](_0x35347b,function(_0x29d244){if(_0x29d244['type']!=='VIRTUAL'){var _0x580846={};_0x580846[_0x29d244[_0xd5e8('0x2c')]]={'$like':'%'+_0x5ccdbc[_0xd5e8('0x34')]['filter']+'%'};return _0x580846;}})});}_0x537b1f=_[_0xd5e8('0x41')]({},_0x537b1f,_0x5ccdbc['options']);var _0x5ec314={'where':_0x537b1f[_0xd5e8('0x3e')]};return db[_0xd5e8('0x2f')][_0xd5e8('0x1f')](_0x5ec314)['then'](function(_0x41ba43){_0x127013[_0xd5e8('0x1f')]=_0x41ba43;if(_0x5ccdbc[_0xd5e8('0x34')][_0xd5e8('0x42')]){_0x537b1f[_0xd5e8('0x43')]=[{'all':!![]}];}return db[_0xd5e8('0x2f')][_0xd5e8('0x44')](_0x537b1f);})['then'](function(_0x344677){_0x127013[_0xd5e8('0x45')]=_0x344677;return _0x127013;})['then'](respondWithFilteredResult(_0x48d231,_0x537b1f))[_0xd5e8('0x46')](handleError(_0x48d231,null));};exports['show']=function(_0x31a550,_0x578629){var _0x434c9f={'raw':![],'where':{'id':_0x31a550[_0xd5e8('0x47')]['id']}},_0xf37a99={};_0xf37a99[_0xd5e8('0x33')]=_[_0xd5e8('0x35')](db[_0xd5e8('0x2f')][_0xd5e8('0x30')]);_0xf37a99[_0xd5e8('0x34')]=_[_0xd5e8('0x35')](_0x31a550[_0xd5e8('0x34')]);_0xf37a99[_0xd5e8('0x36')]=_[_0xd5e8('0x37')](_0xf37a99[_0xd5e8('0x33')],_0xf37a99[_0xd5e8('0x34')]);_0x434c9f[_0xd5e8('0x38')]=_[_0xd5e8('0x37')](_0xf37a99[_0xd5e8('0x33')],qs[_0xd5e8('0x39')](_0x31a550[_0xd5e8('0x34')][_0xd5e8('0x39')]));_0x434c9f[_0xd5e8('0x38')]=_0x434c9f[_0xd5e8('0x38')]['length']?_0x434c9f[_0xd5e8('0x38')]:_0xf37a99['model'];if(_0x31a550[_0xd5e8('0x34')][_0xd5e8('0x42')]){_0x434c9f['include']=[{'all':!![]}];}_0x434c9f=_[_0xd5e8('0x41')]({},_0x434c9f,_0x31a550[_0xd5e8('0x48')]);return db['Schedule']['find'](_0x434c9f)[_0xd5e8('0x26')](handleEntityNotFound(_0x578629,null))['then'](respondWithResult(_0x578629,null))[_0xd5e8('0x46')](handleError(_0x578629,null));};exports[_0xd5e8('0x49')]=function(_0x182ac0,_0x1456d5){return db[_0xd5e8('0x2f')]['create'](_0x182ac0['body'],{})[_0xd5e8('0x26')](function(_0x57c960){var _0x1c008b=_0x182ac0['user'][_0xd5e8('0x27')]({'plain':!![]});if(!_0x1c008b)throw new Error(_0xd5e8('0x4a'));if(_0x1c008b[_0xd5e8('0x4b')]==='user'){var _0xd94490=_0x57c960[_0xd5e8('0x27')]({'plain':!![]});var _0x53af7e=_0xd5e8('0x28');return db[_0xd5e8('0x4c')][_0xd5e8('0x4d')]({'where':{'name':_0x53af7e,'userProfileId':_0x1c008b[_0xd5e8('0x4e')]},'raw':!![]})['then'](function(_0x5e1d12){if(_0x5e1d12&&_0x5e1d12[_0xd5e8('0x4f')]===0x0){return db['UserProfileResource'][_0xd5e8('0x49')]({'name':_0xd94490[_0xd5e8('0x2c')],'resourceId':_0xd94490['id'],'type':_0x5e1d12[_0xd5e8('0x2c')],'sectionId':_0x5e1d12['id']},{})['then'](function(){return _0x57c960;});}else{return _0x57c960;}})[_0xd5e8('0x46')](function(_0x4bedb8){logger[_0xd5e8('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4bedb8);throw _0x4bedb8;});}return _0x57c960;})[_0xd5e8('0x26')](respondWithResult(_0x1456d5,0xc9))[_0xd5e8('0x46')](handleError(_0x1456d5,null));};exports[_0xd5e8('0x24')]=function(_0x5cd034,_0x21f91f){if(_0x5cd034[_0xd5e8('0x50')]['id']){delete _0x5cd034[_0xd5e8('0x50')]['id'];}return db['Schedule'][_0xd5e8('0x4d')]({'where':{'id':_0x5cd034[_0xd5e8('0x47')]['id']}})[_0xd5e8('0x26')](handleEntityNotFound(_0x21f91f,null))[_0xd5e8('0x26')](saveUpdates(_0x5cd034['body'],null))[_0xd5e8('0x26')](respondWithResult(_0x21f91f,null))['catch'](handleError(_0x21f91f,null));};exports[_0xd5e8('0x25')]=function(_0x1ec293,_0x4f0c44){return db[_0xd5e8('0x2f')][_0xd5e8('0x4d')]({'where':{'id':_0x1ec293[_0xd5e8('0x47')]['id']}})[_0xd5e8('0x26')](handleEntityNotFound(_0x4f0c44,null))[_0xd5e8('0x26')](removeEntity(_0x4f0c44,null))[_0xd5e8('0x46')](handleError(_0x4f0c44,null));};exports[_0xd5e8('0x51')]=function(_0x50cbb4,_0x4e15f1,_0x24c391){var _0x59a45c=require(_0xd5e8('0x52'));return db[_0xd5e8('0x2f')][_0xd5e8('0x4d')]({'where':{'id':_0x50cbb4[_0xd5e8('0x47')]['id']},'raw':!![]})[_0xd5e8('0x26')](handleEntityNotFound(_0x4e15f1,null))[_0xd5e8('0x26')](function(){_0x59a45c[_0xd5e8('0x51')](_0x50cbb4['params']['id']);})[_0xd5e8('0x26')](respondWithStatusCode(_0x4e15f1,null))[_0xd5e8('0x46')](handleError(_0x4e15f1,null));}; \ No newline at end of file +var _0xfd8e=['set','Content-Range','reject','save','update','then','get','Scheduler','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','includeAll','Schedule','findAll','rows','show','params','options','find','catch','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','run','../../config/schedule','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','count'];(function(_0x463a67,_0x52cad5){var _0x330175=function(_0x37528c){while(--_0x37528c){_0x463a67['push'](_0x463a67['shift']());}};_0x330175(++_0x52cad5);}(_0xfd8e,0xeb));var _0xefd8=function(_0x20bf47,_0x39818c){_0x20bf47=_0x20bf47-0x0;var _0x52c8f1=_0xfd8e[_0x20bf47];return _0x52c8f1;};'use strict';var emlformat=require(_0xefd8('0x0'));var rimraf=require(_0xefd8('0x1'));var zipdir=require(_0xefd8('0x2'));var jsonpatch=require(_0xefd8('0x3'));var rp=require(_0xefd8('0x4'));var moment=require(_0xefd8('0x5'));var BPromise=require(_0xefd8('0x6'));var Mustache=require(_0xefd8('0x7'));var util=require(_0xefd8('0x8'));var path=require(_0xefd8('0x9'));var sox=require('sox');var csv=require(_0xefd8('0xa'));var ejs=require(_0xefd8('0xb'));var fs=require('fs');var fs_extra=require(_0xefd8('0xc'));var _=require(_0xefd8('0xd'));var squel=require(_0xefd8('0xe'));var crypto=require(_0xefd8('0xf'));var jsforce=require(_0xefd8('0x10'));var deskjs=require(_0xefd8('0x11'));var toCsv=require(_0xefd8('0xa'));var querystring=require(_0xefd8('0x12'));var Papa=require(_0xefd8('0x13'));var Redis=require(_0xefd8('0x14'));var authService=require(_0xefd8('0x15'));var qs=require(_0xefd8('0x16'));var as=require(_0xefd8('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xefd8('0x18'))(_0xefd8('0x19'));var utils=require(_0xefd8('0x1a'));var config=require(_0xefd8('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0xefd8('0x1c'))['db'];function respondWithStatusCode(_0x469433,_0x1c0d19){_0x1c0d19=_0x1c0d19||0xcc;return function(_0x4f8cd9){if(_0x4f8cd9){return _0x469433[_0xefd8('0x1d')](_0x1c0d19);}return _0x469433[_0xefd8('0x1e')](_0x1c0d19)[_0xefd8('0x1f')]();};}function respondWithResult(_0x359b4f,_0x5853c0){_0x5853c0=_0x5853c0||0xc8;return function(_0x299555){if(_0x299555){return _0x359b4f[_0xefd8('0x1e')](_0x5853c0)['json'](_0x299555);}};}function respondWithFilteredResult(_0x1b8cc7,_0x206242){return function(_0x2a031b){if(_0x2a031b){var _0x44f81a=typeof _0x206242[_0xefd8('0x20')]==='undefined'&&typeof _0x206242[_0xefd8('0x21')]==='undefined';var _0x5bc534=_0x2a031b['count'];var _0x2db526=_0x44f81a?0x0:_0x206242[_0xefd8('0x20')];var _0x298b46=_0x44f81a?_0x2a031b[_0xefd8('0x22')]:_0x206242['offset']+_0x206242[_0xefd8('0x21')];var _0x3ece86;if(_0x298b46>=_0x5bc534){_0x298b46=_0x5bc534;_0x3ece86=0xc8;}else{_0x3ece86=0xce;}_0x1b8cc7[_0xefd8('0x1e')](_0x3ece86);return _0x1b8cc7[_0xefd8('0x23')](_0xefd8('0x24'),_0x2db526+'-'+_0x298b46+'/'+_0x5bc534)['json'](_0x2a031b);}return null;};}function patchUpdates(_0x3049cb){return function(_0x1d6995){try{jsonpatch['apply'](_0x1d6995,_0x3049cb,!![]);}catch(_0x1de63c){return BPromise[_0xefd8('0x25')](_0x1de63c);}return _0x1d6995[_0xefd8('0x26')]();};}function saveUpdates(_0x28a264,_0x585b5d){return function(_0x184d4a){if(_0x184d4a){return _0x184d4a[_0xefd8('0x27')](_0x28a264)['then'](function(_0x3f77e8){return _0x3f77e8;});}return null;};}function removeEntity(_0x583bf5,_0x1a8eab){return function(_0x45d1ef){if(_0x45d1ef){return _0x45d1ef['destroy']()[_0xefd8('0x28')](function(){var _0x4bbd51=_0x45d1ef[_0xefd8('0x29')]({'plain':!![]});var _0x55a112=_0xefd8('0x2a');return db[_0xefd8('0x2b')]['destroy']({'where':{'type':_0x55a112,'resourceId':_0x4bbd51['id']}})[_0xefd8('0x28')](function(){return _0x45d1ef;});})[_0xefd8('0x28')](function(){_0x583bf5['status'](0xcc)[_0xefd8('0x1f')]();});}};}function handleEntityNotFound(_0x10653e,_0x172ae1){return function(_0x2ceace){if(!_0x2ceace){_0x10653e[_0xefd8('0x1d')](0x194);}return _0x2ceace;};}function handleError(_0x468bbd,_0x339cfc){_0x339cfc=_0x339cfc||0x1f4;return function(_0x598831){logger[_0xefd8('0x2c')](_0x598831[_0xefd8('0x2d')]);if(_0x598831['name']){delete _0x598831[_0xefd8('0x2e')];}_0x468bbd['status'](_0x339cfc)[_0xefd8('0x2f')](_0x598831);};}exports[_0xefd8('0x30')]=function(_0x30cb94,_0x21f333){var _0x1bcccb={},_0x4795c8={},_0x5e8cc8={'count':0x0,'rows':[]};var _0x3844db=_[_0xefd8('0x31')](db['Schedule'][_0xefd8('0x32')],function(_0x1c0a8c){return{'name':_0x1c0a8c[_0xefd8('0x33')],'type':_0x1c0a8c[_0xefd8('0x34')][_0xefd8('0x35')]};});_0x4795c8[_0xefd8('0x36')]=_[_0xefd8('0x31')](_0x3844db,'name');_0x4795c8[_0xefd8('0x37')]=_[_0xefd8('0x38')](_0x30cb94[_0xefd8('0x37')]);_0x4795c8[_0xefd8('0x39')]=_[_0xefd8('0x3a')](_0x4795c8[_0xefd8('0x36')],_0x4795c8[_0xefd8('0x37')]);_0x1bcccb[_0xefd8('0x3b')]=_['intersection'](_0x4795c8[_0xefd8('0x36')],qs[_0xefd8('0x3c')](_0x30cb94[_0xefd8('0x37')][_0xefd8('0x3c')]));_0x1bcccb[_0xefd8('0x3b')]=_0x1bcccb[_0xefd8('0x3b')][_0xefd8('0x3d')]?_0x1bcccb[_0xefd8('0x3b')]:_0x4795c8[_0xefd8('0x36')];if(!_0x30cb94[_0xefd8('0x37')][_0xefd8('0x3e')](_0xefd8('0x3f'))){_0x1bcccb[_0xefd8('0x21')]=qs['limit'](_0x30cb94[_0xefd8('0x37')][_0xefd8('0x21')]);_0x1bcccb[_0xefd8('0x20')]=qs['offset'](_0x30cb94[_0xefd8('0x37')][_0xefd8('0x20')]);}_0x1bcccb[_0xefd8('0x40')]=qs[_0xefd8('0x41')](_0x30cb94['query']['sort']);_0x1bcccb[_0xefd8('0x42')]=qs['filters'](_['pick'](_0x30cb94[_0xefd8('0x37')],_0x4795c8[_0xefd8('0x39')]),_0x3844db);if(_0x30cb94[_0xefd8('0x37')][_0xefd8('0x43')]){_0x1bcccb[_0xefd8('0x42')]=_['merge'](_0x1bcccb[_0xefd8('0x42')],{'$or':_[_0xefd8('0x31')](_0x3844db,function(_0x2046d3){if(_0x2046d3['type']!==_0xefd8('0x44')){var _0x3e70a0={};_0x3e70a0[_0x2046d3[_0xefd8('0x2e')]]={'$like':'%'+_0x30cb94['query'][_0xefd8('0x43')]+'%'};return _0x3e70a0;}})});}_0x1bcccb=_[_0xefd8('0x45')]({},_0x1bcccb,_0x30cb94['options']);var _0x24b711={'where':_0x1bcccb[_0xefd8('0x42')]};return db['Schedule'][_0xefd8('0x22')](_0x24b711)[_0xefd8('0x28')](function(_0x262401){_0x5e8cc8[_0xefd8('0x22')]=_0x262401;if(_0x30cb94[_0xefd8('0x37')][_0xefd8('0x46')]){_0x1bcccb['include']=[{'all':!![]}];}return db[_0xefd8('0x47')][_0xefd8('0x48')](_0x1bcccb);})[_0xefd8('0x28')](function(_0x4ffb20){_0x5e8cc8[_0xefd8('0x49')]=_0x4ffb20;return _0x5e8cc8;})[_0xefd8('0x28')](respondWithFilteredResult(_0x21f333,_0x1bcccb))['catch'](handleError(_0x21f333,null));};exports[_0xefd8('0x4a')]=function(_0x562d96,_0x47fab1){var _0x56d139={'raw':![],'where':{'id':_0x562d96[_0xefd8('0x4b')]['id']}},_0x2e27e8={};_0x2e27e8[_0xefd8('0x36')]=_['keys'](db['Schedule'][_0xefd8('0x32')]);_0x2e27e8[_0xefd8('0x37')]=_[_0xefd8('0x38')](_0x562d96[_0xefd8('0x37')]);_0x2e27e8[_0xefd8('0x39')]=_[_0xefd8('0x3a')](_0x2e27e8[_0xefd8('0x36')],_0x2e27e8[_0xefd8('0x37')]);_0x56d139['attributes']=_[_0xefd8('0x3a')](_0x2e27e8['model'],qs[_0xefd8('0x3c')](_0x562d96['query'][_0xefd8('0x3c')]));_0x56d139['attributes']=_0x56d139[_0xefd8('0x3b')][_0xefd8('0x3d')]?_0x56d139[_0xefd8('0x3b')]:_0x2e27e8[_0xefd8('0x36')];if(_0x562d96[_0xefd8('0x37')][_0xefd8('0x46')]){_0x56d139['include']=[{'all':!![]}];}_0x56d139=_['merge']({},_0x56d139,_0x562d96[_0xefd8('0x4c')]);return db[_0xefd8('0x47')][_0xefd8('0x4d')](_0x56d139)[_0xefd8('0x28')](handleEntityNotFound(_0x47fab1,null))['then'](respondWithResult(_0x47fab1,null))[_0xefd8('0x4e')](handleError(_0x47fab1,null));};exports['create']=function(_0x453f80,_0x497648){return db[_0xefd8('0x47')]['create'](_0x453f80[_0xefd8('0x4f')],{})[_0xefd8('0x28')](function(_0x36e282){var _0xfc30b=_0x453f80[_0xefd8('0x50')][_0xefd8('0x29')]({'plain':!![]});if(!_0xfc30b)throw new Error(_0xefd8('0x51'));if(_0xfc30b[_0xefd8('0x52')]===_0xefd8('0x50')){var _0x1dee0f=_0x36e282[_0xefd8('0x29')]({'plain':!![]});var _0x4d2cbe=_0xefd8('0x2a');return db[_0xefd8('0x53')][_0xefd8('0x4d')]({'where':{'name':_0x4d2cbe,'userProfileId':_0xfc30b['userProfileId']},'raw':!![]})[_0xefd8('0x28')](function(_0xabd7ed){if(_0xabd7ed&&_0xabd7ed[_0xefd8('0x54')]===0x0){return db[_0xefd8('0x2b')][_0xefd8('0x55')]({'name':_0x1dee0f[_0xefd8('0x2e')],'resourceId':_0x1dee0f['id'],'type':_0xabd7ed[_0xefd8('0x2e')],'sectionId':_0xabd7ed['id']},{})[_0xefd8('0x28')](function(){return _0x36e282;});}else{return _0x36e282;}})[_0xefd8('0x4e')](function(_0x4283bb){logger[_0xefd8('0x2c')](_0xefd8('0x56'),_0x4283bb);throw _0x4283bb;});}return _0x36e282;})[_0xefd8('0x28')](respondWithResult(_0x497648,0xc9))['catch'](handleError(_0x497648,null));};exports[_0xefd8('0x27')]=function(_0x336a74,_0x1915ad){if(_0x336a74[_0xefd8('0x4f')]['id']){delete _0x336a74[_0xefd8('0x4f')]['id'];}return db[_0xefd8('0x47')][_0xefd8('0x4d')]({'where':{'id':_0x336a74[_0xefd8('0x4b')]['id']}})[_0xefd8('0x28')](handleEntityNotFound(_0x1915ad,null))['then'](saveUpdates(_0x336a74[_0xefd8('0x4f')],null))['then'](respondWithResult(_0x1915ad,null))['catch'](handleError(_0x1915ad,null));};exports[_0xefd8('0x57')]=function(_0x3bf544,_0x58b293){return db[_0xefd8('0x47')]['find']({'where':{'id':_0x3bf544['params']['id']}})[_0xefd8('0x28')](handleEntityNotFound(_0x58b293,null))[_0xefd8('0x28')](removeEntity(_0x58b293,null))[_0xefd8('0x4e')](handleError(_0x58b293,null));};exports[_0xefd8('0x58')]=function(_0x443e18,_0x114dec,_0x275b4e){var _0x1be502=require(_0xefd8('0x59'));return db['Schedule']['find']({'where':{'id':_0x443e18['params']['id']},'raw':!![]})['then'](handleEntityNotFound(_0x114dec,null))[_0xefd8('0x28')](function(){_0x1be502[_0xefd8('0x58')](_0x443e18['params']['id']);})[_0xefd8('0x28')](respondWithStatusCode(_0x114dec,null))[_0xefd8('0x4e')](handleError(_0x114dec,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 54530de..efcdf5c 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 _0xcb02=['bluebird','path','rimraf','../../config/environment','./schedule.attributes','exports','define','tools_schedules','lodash','util','api','moment'];(function(_0x2cbc5a,_0x4c2b28){var _0xb8a78e=function(_0xd242c3){while(--_0xd242c3){_0x2cbc5a['push'](_0x2cbc5a['shift']());}};_0xb8a78e(++_0x4c2b28);}(_0xcb02,0x1c4));var _0x2cb0=function(_0x9020f9,_0x22e3b6){_0x9020f9=_0x9020f9-0x0;var _0x116591=_0xcb02[_0x9020f9];return _0x116591;};'use strict';var _=require(_0x2cb0('0x0'));var util=require(_0x2cb0('0x1'));var logger=require('../../config/logger')(_0x2cb0('0x2'));var moment=require(_0x2cb0('0x3'));var BPromise=require(_0x2cb0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2cb0('0x5'));var rimraf=require(_0x2cb0('0x6'));var config=require(_0x2cb0('0x7'));var attributes=require(_0x2cb0('0x8'));module[_0x2cb0('0x9')]=function(_0x544180,_0x466b5d){return _0x544180[_0x2cb0('0xa')]('Schedule',attributes,{'tableName':_0x2cb0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x738a=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./schedule.attributes','define','Schedule','tools_schedules'];(function(_0x3a9cae,_0x29b84a){var _0x342f94=function(_0x910cdc){while(--_0x910cdc){_0x3a9cae['push'](_0x3a9cae['shift']());}};_0x342f94(++_0x29b84a);}(_0x738a,0xea));var _0xa738=function(_0x404c35,_0xedfe89){_0x404c35=_0x404c35-0x0;var _0x28c900=_0x738a[_0x404c35];return _0x28c900;};'use strict';var _=require(_0xa738('0x0'));var util=require(_0xa738('0x1'));var logger=require(_0xa738('0x2'))(_0xa738('0x3'));var moment=require(_0xa738('0x4'));var BPromise=require('bluebird');var rp=require(_0xa738('0x5'));var fs=require('fs');var path=require(_0xa738('0x6'));var rimraf=require(_0xa738('0x7'));var config=require(_0xa738('0x8'));var attributes=require(_0xa738('0x9'));module['exports']=function(_0x1393a9,_0x2bffed){return _0x1393a9[_0xa738('0xa')](_0xa738('0xb'),attributes,{'tableName':_0xa738('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index 46e36dd..94ae2cf 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 _0x4815=['client','http','request','then','info','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','Schedule,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment'];(function(_0x4276e1,_0x547409){var _0x55cc5c=function(_0x1f0867){while(--_0x1f0867){_0x4276e1['push'](_0x4276e1['shift']());}};_0x55cc5c(++_0x547409);}(_0x4815,0x19a));var _0x5481=function(_0x3b7928,_0x18cd70){_0x3b7928=_0x3b7928-0x0;var _0x3314b6=_0x4815[_0x3b7928];return _0x3314b6;};'use strict';var _=require(_0x5481('0x0'));var util=require(_0x5481('0x1'));var moment=require(_0x5481('0x2'));var BPromise=require('bluebird');var rs=require(_0x5481('0x3'));var fs=require('fs');var Redis=require(_0x5481('0x4'));var db=require(_0x5481('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5481('0x6'));var config=require(_0x5481('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5481('0x8')][_0x5481('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x59491c,_0x45a5a9,_0x13f7de){return new BPromise(function(_0x59f026,_0x5ad13a){return client[_0x5481('0xa')](_0x59491c,_0x13f7de)[_0x5481('0xb')](function(_0x3def0e){logger[_0x5481('0xc')]('Schedule,\x20%s,\x20%s',_0x45a5a9,_0x5481('0xd'));logger[_0x5481('0xe')](_0x5481('0xf'),_0x45a5a9,_0x5481('0xd'),JSON[_0x5481('0x10')](_0x3def0e));if(_0x3def0e[_0x5481('0x11')]){if(_0x3def0e['error']['code']===0x1f4){logger[_0x5481('0x11')](_0x5481('0x12'),_0x45a5a9,_0x3def0e[_0x5481('0x11')][_0x5481('0x13')]);return _0x5ad13a(_0x3def0e['error'][_0x5481('0x13')]);}logger[_0x5481('0x11')]('Schedule,\x20%s,\x20%s',_0x45a5a9,_0x3def0e[_0x5481('0x11')]['message']);return _0x59f026(_0x3def0e[_0x5481('0x11')][_0x5481('0x13')]);}else{logger[_0x5481('0xc')](_0x5481('0x12'),_0x45a5a9,_0x5481('0xd'));_0x59f026(_0x3def0e[_0x5481('0x14')][_0x5481('0x13')]);}})[_0x5481('0x15')](function(_0x1c3c38){logger[_0x5481('0x11')]('Schedule,\x20%s,\x20%s',_0x45a5a9,_0x1c3c38);_0x5ad13a(_0x1c3c38);});});} \ No newline at end of file +var _0x8439=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','randomstring','ioredis','../../mysqldb'];(function(_0x2761bf,_0xb2d3e7){var _0x15e498=function(_0x3ec585){while(--_0x3ec585){_0x2761bf['push'](_0x2761bf['shift']());}};_0x15e498(++_0xb2d3e7);}(_0x8439,0x1b4));var _0x9843=function(_0x172747,_0x1732bd){_0x172747=_0x172747-0x0;var _0x509692=_0x8439[_0x172747];return _0x509692;};'use strict';var _=require('lodash');var util=require(_0x9843('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9843('0x1'));var fs=require('fs');var Redis=require(_0x9843('0x2'));var db=require(_0x9843('0x3'))['db'];var utils=require(_0x9843('0x4'));var logger=require('../../config/logger')(_0x9843('0x5'));var config=require(_0x9843('0x6'));var jayson=require(_0x9843('0x7'));var client=jayson[_0x9843('0x8')][_0x9843('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3010ac,_0x17d5e1,_0x41d5b3){return new BPromise(function(_0x100d3e,_0x1ea13d){return client[_0x9843('0xa')](_0x3010ac,_0x41d5b3)[_0x9843('0xb')](function(_0x167d86){logger[_0x9843('0xc')](_0x9843('0xd'),_0x17d5e1,_0x9843('0xe'));logger[_0x9843('0xf')](_0x9843('0x10'),_0x17d5e1,_0x9843('0xe'),JSON[_0x9843('0x11')](_0x167d86));if(_0x167d86[_0x9843('0x12')]){if(_0x167d86[_0x9843('0x12')][_0x9843('0x13')]===0x1f4){logger[_0x9843('0x12')](_0x9843('0xd'),_0x17d5e1,_0x167d86[_0x9843('0x12')]['message']);return _0x1ea13d(_0x167d86[_0x9843('0x12')][_0x9843('0x14')]);}logger['error']('Schedule,\x20%s,\x20%s',_0x17d5e1,_0x167d86[_0x9843('0x12')][_0x9843('0x14')]);return _0x100d3e(_0x167d86['error'][_0x9843('0x14')]);}else{logger['info'](_0x9843('0xd'),_0x17d5e1,_0x9843('0xe'));_0x100d3e(_0x167d86[_0x9843('0x15')][_0x9843('0x14')]);}})['catch'](function(_0x26e3b0){logger[_0x9843('0x12')]('Schedule,\x20%s,\x20%s',_0x17d5e1,_0x26e3b0);_0x1ea13d(_0x26e3b0);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 002d89b..6c82247 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 _0x21ee=['download','post','create','update','delete','destroy','exports','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','index','describe','/:id','show','/:id/download','isAuthenticated'];(function(_0x398b52,_0x59d4bd){var _0x2de130=function(_0x2beeef){while(--_0x2beeef){_0x398b52['push'](_0x398b52['shift']());}};_0x2de130(++_0x59d4bd);}(_0x21ee,0xf9));var _0xe21e=function(_0x121ca6,_0x597c2d){_0x121ca6=_0x121ca6-0x0;var _0x3fd2d6=_0x21ee[_0x121ca6];return _0x3fd2d6;};'use strict';var multer=require('multer');var util=require(_0xe21e('0x0'));var path=require(_0xe21e('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe21e('0x2')]();var fs_extra=require(_0xe21e('0x3'));var auth=require(_0xe21e('0x4'));var interaction=require(_0xe21e('0x5'));var config=require(_0xe21e('0x6'));var controller=require(_0xe21e('0x7'));router[_0xe21e('0x8')]('/',auth['isAuthenticated'](),controller[_0xe21e('0x9')]);router[_0xe21e('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xe21e('0xa')]);router['get'](_0xe21e('0xb'),auth['isAuthenticated'](),controller[_0xe21e('0xc')]);router[_0xe21e('0x8')](_0xe21e('0xd'),auth[_0xe21e('0xe')](),controller[_0xe21e('0xf')]);router[_0xe21e('0x10')]('/',auth[_0xe21e('0xe')](),controller[_0xe21e('0x11')]);router['put'](_0xe21e('0xb'),auth['isAuthenticated'](),controller[_0xe21e('0x12')]);router[_0xe21e('0x13')](_0xe21e('0xb'),auth[_0xe21e('0xe')](),controller[_0xe21e('0x14')]);module[_0xe21e('0x15')]=router; \ No newline at end of file +var _0xd41f=['isAuthenticated','index','/describe','/:id','show','/:id/download','download','create','put','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get'];(function(_0x34ad72,_0x1e43f6){var _0x5c9aa8=function(_0x144388){while(--_0x144388){_0x34ad72['push'](_0x34ad72['shift']());}};_0x5c9aa8(++_0x1e43f6);}(_0xd41f,0x89));var _0xfd41=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd41f[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xfd41('0x0'));var util=require(_0xfd41('0x1'));var path=require(_0xfd41('0x2'));var timeout=require(_0xfd41('0x3'));var express=require(_0xfd41('0x4'));var router=express[_0xfd41('0x5')]();var fs_extra=require(_0xfd41('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xfd41('0x7'));var config=require(_0xfd41('0x8'));var controller=require('./screenRecording.controller');router[_0xfd41('0x9')]('/',auth[_0xfd41('0xa')](),controller[_0xfd41('0xb')]);router[_0xfd41('0x9')](_0xfd41('0xc'),auth[_0xfd41('0xa')](),controller['describe']);router[_0xfd41('0x9')](_0xfd41('0xd'),auth[_0xfd41('0xa')](),controller[_0xfd41('0xe')]);router[_0xfd41('0x9')](_0xfd41('0xf'),auth[_0xfd41('0xa')](),controller[_0xfd41('0x10')]);router['post']('/',auth[_0xfd41('0xa')](),controller[_0xfd41('0x11')]);router[_0xfd41('0x12')](_0xfd41('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xfd41('0x13')](_0xfd41('0xd'),auth[_0xfd41('0xa')](),controller['destroy']);module[_0xfd41('0x14')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 9f6af5d..0ee74b6 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 _0xd26f=['createdAt','updatedAt','sequelize','moment','exports','VIRTUAL','getDataValue','value','extname','STRING','replace','setDataValue','INTEGER','startedAt','subtract','closedAt','duration','format','MM-DD-YYYY\x20HH:mm','toString','DATE'];(function(_0x16ef0f,_0x35c42d){var _0x4f7ca4=function(_0x30ac8f){while(--_0x30ac8f){_0x16ef0f['push'](_0x16ef0f['shift']());}};_0x4f7ca4(++_0x35c42d);}(_0xd26f,0x113));var _0xfd26=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xd26f[_0x5c351c];return _0x26f3b3;};'use strict';var Sequelize=require(_0xfd26('0x0'));var moment=require(_0xfd26('0x1'));var path=require('path');var config=require('../../config/environment');module[_0xfd26('0x2')]={'format':{'type':Sequelize[_0xfd26('0x3')],'get':function(){return this[_0xfd26('0x4')](_0xfd26('0x5'))?path[_0xfd26('0x6')](this[_0xfd26('0x4')](_0xfd26('0x5'))):undefined;}},'interactionid':{'type':Sequelize[_0xfd26('0x7')]},'channel':{'type':Sequelize[_0xfd26('0x7')]},'value':{'type':Sequelize['STRING'],'set':function(_0x22b353){var _0x3c148d=_0x22b353[_0xfd26('0x8')](/\\/g,'/');this[_0xfd26('0x9')](_0xfd26('0x5'),_0x3c148d);}},'rating':{'type':Sequelize[_0xfd26('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0xcf2fdb){this[_0xfd26('0x9')](_0xfd26('0xb'),moment()[_0xfd26('0xc')](_0xcf2fdb,'ms'));this[_0xfd26('0x9')](_0xfd26('0xd'),moment());this['setDataValue'](_0xfd26('0xe'),_0xcf2fdb);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xfd26('0x4')]('startedAt'))['format']('MM-DD-YYYY\x20HH:mm')['toString']();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xfd26('0x4')](_0xfd26('0xd')))[_0xfd26('0xf')](_0xfd26('0x10'))[_0xfd26('0x11')]();}},'createdAt':{'type':Sequelize[_0xfd26('0x12')],'get':function(){return moment(this[_0xfd26('0x4')](_0xfd26('0x13')))[_0xfd26('0xf')](_0xfd26('0x10'))[_0xfd26('0x11')]();}},'updatedAt':{'type':Sequelize[_0xfd26('0x12')],'get':function(){return moment(this[_0xfd26('0x4')](_0xfd26('0x14')))[_0xfd26('0xf')]('MM-DD-YYYY\x20HH:mm')[_0xfd26('0x11')]();}}}; \ No newline at end of file +var _0xc1d3=['../../config/environment','exports','VIRTUAL','getDataValue','value','STRING','replace','setDataValue','INTEGER','startedAt','subtract','closedAt','duration','DATE','format','toString','createdAt','MM-DD-YYYY\x20HH:mm','updatedAt','sequelize','moment','path'];(function(_0x18ed75,_0x3af29b){var _0x463ed5=function(_0x12240d){while(--_0x12240d){_0x18ed75['push'](_0x18ed75['shift']());}};_0x463ed5(++_0x3af29b);}(_0xc1d3,0x147));var _0x3c1d=function(_0x19f3de,_0x53186f){_0x19f3de=_0x19f3de-0x0;var _0x279190=_0xc1d3[_0x19f3de];return _0x279190;};'use strict';var Sequelize=require(_0x3c1d('0x0'));var moment=require(_0x3c1d('0x1'));var path=require(_0x3c1d('0x2'));var config=require(_0x3c1d('0x3'));module[_0x3c1d('0x4')]={'format':{'type':Sequelize[_0x3c1d('0x5')],'get':function(){return this[_0x3c1d('0x6')]('value')?path['extname'](this[_0x3c1d('0x6')](_0x3c1d('0x7'))):undefined;}},'interactionid':{'type':Sequelize[_0x3c1d('0x8')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0x3c1d('0x8')],'set':function(_0x36863b){var _0x3bef1a=_0x36863b[_0x3c1d('0x9')](/\\/g,'/');this[_0x3c1d('0xa')]('value',_0x3bef1a);}},'rating':{'type':Sequelize[_0x3c1d('0xb')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x3c1d('0xb')],'set':function(_0x33cb1b){this[_0x3c1d('0xa')](_0x3c1d('0xc'),moment()[_0x3c1d('0xd')](_0x33cb1b,'ms'));this[_0x3c1d('0xa')](_0x3c1d('0xe'),moment());this['setDataValue'](_0x3c1d('0xf'),_0x33cb1b);}},'startedAt':{'type':Sequelize[_0x3c1d('0x10')],'get':function(){return moment(this[_0x3c1d('0x6')](_0x3c1d('0xc')))[_0x3c1d('0x11')]('MM-DD-YYYY\x20HH:mm')[_0x3c1d('0x12')]();}},'closedAt':{'type':Sequelize[_0x3c1d('0x10')],'get':function(){return moment(this['getDataValue'](_0x3c1d('0xe')))['format']('MM-DD-YYYY\x20HH:mm')['toString']();}},'createdAt':{'type':Sequelize[_0x3c1d('0x10')],'get':function(){return moment(this[_0x3c1d('0x6')](_0x3c1d('0x13')))[_0x3c1d('0x11')](_0x3c1d('0x14'))[_0x3c1d('0x12')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0x3c1d('0x15')))['format'](_0x3c1d('0x14'))[_0x3c1d('0x12')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 3277b98..32ce955 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 _0x0e85=['duration','createdAt','closedAt','params','describe','download','uniqueid','join','root','value','existsSync','secrets','recording','server/files/screen_recordings','filename','extname','unlink','message','Not\x20found','destroy','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','eml-format','rimraf','fast-json-patch','request-promise','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','error','stack','name','send','map','ScreenRecording','rawAttributes','fieldName','key','model','format','query','filters','intersection','attributes','length','nolimit','sort','filter','where','merge','type','options','include','findAll','rows','catch','keys','fields','find','create','body'];(function(_0xd63e3a,_0x1bd6eb){var _0x19c178=function(_0x56be0d){while(--_0x56be0d){_0xd63e3a['push'](_0xd63e3a['shift']());}};_0x19c178(++_0x1bd6eb);}(_0x0e85,0x7c));var _0x50e8=function(_0x47a349,_0x4699d9){_0x47a349=_0x47a349-0x0;var _0x18ab75=_0x0e85[_0x47a349];return _0x18ab75;};'use strict';var emlformat=require(_0x50e8('0x0'));var rimraf=require(_0x50e8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x50e8('0x2'));var rp=require(_0x50e8('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x50e8('0x4'));var path=require('path');var sox=require(_0x50e8('0x5'));var csv=require(_0x50e8('0x6'));var ejs=require(_0x50e8('0x7'));var fs=require('fs');var fs_extra=require(_0x50e8('0x8'));var _=require('lodash');var squel=require(_0x50e8('0x9'));var crypto=require(_0x50e8('0xa'));var jsforce=require(_0x50e8('0xb'));var deskjs=require(_0x50e8('0xc'));var toCsv=require(_0x50e8('0x6'));var querystring=require(_0x50e8('0xd'));var Papa=require('papaparse');var Redis=require(_0x50e8('0xe'));var authService=require(_0x50e8('0xf'));var qs=require(_0x50e8('0x10'));var as=require(_0x50e8('0x11'));var hardwareService=require(_0x50e8('0x12'));var logger=require(_0x50e8('0x13'))(_0x50e8('0x14'));var utils=require(_0x50e8('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x50e8('0x16'))['db'];function respondWithStatusCode(_0x24d381,_0x508377){_0x508377=_0x508377||0xcc;return function(_0x49e02f){if(_0x49e02f){return _0x24d381[_0x50e8('0x17')](_0x508377);}return _0x24d381[_0x50e8('0x18')](_0x508377)[_0x50e8('0x19')]();};}function respondWithResult(_0x473aa7,_0x54efd3){_0x54efd3=_0x54efd3||0xc8;return function(_0x18596f){if(_0x18596f){return _0x473aa7[_0x50e8('0x18')](_0x54efd3)[_0x50e8('0x1a')](_0x18596f);}};}function respondWithFilteredResult(_0x5c3baa,_0x5524a3){return function(_0x30a872){if(_0x30a872){var _0xf02b48=typeof _0x5524a3[_0x50e8('0x1b')]===_0x50e8('0x1c')&&typeof _0x5524a3[_0x50e8('0x1d')]===_0x50e8('0x1c');var _0x5642bf=_0x30a872['count'];var _0x441f25=_0xf02b48?0x0:_0x5524a3[_0x50e8('0x1b')];var _0x40d060=_0xf02b48?_0x30a872[_0x50e8('0x1e')]:_0x5524a3[_0x50e8('0x1b')]+_0x5524a3[_0x50e8('0x1d')];var _0x1a451d;if(_0x40d060>=_0x5642bf){_0x40d060=_0x5642bf;_0x1a451d=0xc8;}else{_0x1a451d=0xce;}_0x5c3baa['status'](_0x1a451d);return _0x5c3baa[_0x50e8('0x1f')]('Content-Range',_0x441f25+'-'+_0x40d060+'/'+_0x5642bf)[_0x50e8('0x1a')](_0x30a872);}return null;};}function patchUpdates(_0xe04a5c){return function(_0xd263d){try{jsonpatch[_0x50e8('0x20')](_0xd263d,_0xe04a5c,!![]);}catch(_0x46af8e){return BPromise['reject'](_0x46af8e);}return _0xd263d[_0x50e8('0x21')]();};}function saveUpdates(_0x1e4e0d,_0x58110d){return function(_0x31d23c){if(_0x31d23c){return _0x31d23c[_0x50e8('0x22')](_0x1e4e0d)['then'](function(_0x1ce7fc){return _0x1ce7fc;});}return null;};}function removeEntity(_0xe7e56c,_0x4f56b7){return function(_0x47a3d8){if(_0x47a3d8){return _0x47a3d8['destroy']()[_0x50e8('0x23')](function(){_0xe7e56c[_0x50e8('0x18')](0xcc)[_0x50e8('0x19')]();});}};}function handleEntityNotFound(_0x371a1f,_0xc2f832){return function(_0x13b6e9){if(!_0x13b6e9){_0x371a1f['sendStatus'](0x194);}return _0x13b6e9;};}function handleError(_0x3a6442,_0x396611){_0x396611=_0x396611||0x1f4;return function(_0x4b3a09){logger[_0x50e8('0x24')](_0x4b3a09[_0x50e8('0x25')]);if(_0x4b3a09[_0x50e8('0x26')]){delete _0x4b3a09[_0x50e8('0x26')];}_0x3a6442['status'](_0x396611)[_0x50e8('0x27')](_0x4b3a09);};}exports['index']=function(_0x30fedf,_0x39c0c6){var _0x42bbef={},_0x4f0b88={},_0x1041b9={'count':0x0,'rows':[]};var _0x126c99=_[_0x50e8('0x28')](db[_0x50e8('0x29')][_0x50e8('0x2a')],function(_0x18aa31){return{'name':_0x18aa31[_0x50e8('0x2b')],'type':_0x18aa31['type'][_0x50e8('0x2c')]};});_0x4f0b88[_0x50e8('0x2d')]=_['differenceBy'](_['map'](_0x126c99,_0x50e8('0x26')),[_0x50e8('0x2e')]);_0x4f0b88[_0x50e8('0x2f')]=_['keys'](_0x30fedf['query']);_0x4f0b88[_0x50e8('0x30')]=_[_0x50e8('0x31')](_0x4f0b88['model'],_0x4f0b88[_0x50e8('0x2f')]);_0x42bbef[_0x50e8('0x32')]=_[_0x50e8('0x31')](_0x4f0b88[_0x50e8('0x2d')],qs['fields'](_0x30fedf[_0x50e8('0x2f')]['fields']));_0x42bbef[_0x50e8('0x32')]=_0x42bbef[_0x50e8('0x32')][_0x50e8('0x33')]?_0x42bbef['attributes']:_0x4f0b88[_0x50e8('0x2d')];if(!_0x30fedf[_0x50e8('0x2f')]['hasOwnProperty'](_0x50e8('0x34'))){_0x42bbef[_0x50e8('0x1d')]=qs[_0x50e8('0x1d')](_0x30fedf[_0x50e8('0x2f')]['limit']);_0x42bbef[_0x50e8('0x1b')]=qs[_0x50e8('0x1b')](_0x30fedf[_0x50e8('0x2f')][_0x50e8('0x1b')]);}_0x42bbef['order']=qs[_0x50e8('0x35')](_0x30fedf[_0x50e8('0x2f')][_0x50e8('0x35')]);_0x42bbef['where']=qs['filters'](_['pick'](_0x30fedf[_0x50e8('0x2f')],_0x4f0b88[_0x50e8('0x30')]),_0x126c99);if(_0x30fedf[_0x50e8('0x2f')][_0x50e8('0x36')]){_0x42bbef[_0x50e8('0x37')]=_[_0x50e8('0x38')](_0x42bbef[_0x50e8('0x37')],{'$or':_[_0x50e8('0x28')](_0x126c99,function(_0x35f802){if(_0x35f802[_0x50e8('0x39')]!=='VIRTUAL'){var _0x3371a4={};_0x3371a4[_0x35f802[_0x50e8('0x26')]]={'$like':'%'+_0x30fedf[_0x50e8('0x2f')][_0x50e8('0x36')]+'%'};return _0x3371a4;}})});}_0x42bbef=_['merge']({},_0x42bbef,_0x30fedf[_0x50e8('0x3a')]);var _0x944e46={'where':_0x42bbef[_0x50e8('0x37')]};return db[_0x50e8('0x29')][_0x50e8('0x1e')](_0x944e46)['then'](function(_0x53b198){_0x1041b9[_0x50e8('0x1e')]=_0x53b198;if(_0x30fedf[_0x50e8('0x2f')]['includeAll']){_0x42bbef[_0x50e8('0x3b')]=[{'all':!![]}];}return db[_0x50e8('0x29')][_0x50e8('0x3c')](_0x42bbef);})[_0x50e8('0x23')](function(_0x251e1c){_0x1041b9[_0x50e8('0x3d')]=_0x251e1c;return _0x1041b9;})[_0x50e8('0x23')](respondWithFilteredResult(_0x39c0c6,_0x42bbef))[_0x50e8('0x3e')](handleError(_0x39c0c6,null));};exports['show']=function(_0x3d26bd,_0x44e0ca){var _0x3ea251={'raw':![],'where':{'id':_0x3d26bd['params']['id']}},_0x2adae0={};_0x2adae0[_0x50e8('0x2d')]=_[_0x50e8('0x3f')](db[_0x50e8('0x29')][_0x50e8('0x2a')]);_0x2adae0['query']=_[_0x50e8('0x3f')](_0x3d26bd['query']);_0x2adae0['filters']=_['intersection'](_0x2adae0[_0x50e8('0x2d')],_0x2adae0[_0x50e8('0x2f')]);_0x3ea251['attributes']=_[_0x50e8('0x31')](_0x2adae0[_0x50e8('0x2d')],qs[_0x50e8('0x40')](_0x3d26bd[_0x50e8('0x2f')][_0x50e8('0x40')]));_0x3ea251[_0x50e8('0x32')]=_0x3ea251['attributes'][_0x50e8('0x33')]?_0x3ea251['attributes']:_0x2adae0[_0x50e8('0x2d')];if(_0x3d26bd[_0x50e8('0x2f')]['includeAll']){_0x3ea251[_0x50e8('0x3b')]=[{'all':!![]}];}_0x3ea251=_['merge']({},_0x3ea251,_0x3d26bd[_0x50e8('0x3a')]);return db[_0x50e8('0x29')][_0x50e8('0x41')](_0x3ea251)[_0x50e8('0x23')](handleEntityNotFound(_0x44e0ca,null))[_0x50e8('0x23')](respondWithResult(_0x44e0ca,null))[_0x50e8('0x3e')](handleError(_0x44e0ca,null));};exports[_0x50e8('0x42')]=function(_0x3e52b3,_0x141bd4){return db[_0x50e8('0x29')][_0x50e8('0x42')](_0x3e52b3['body'],{})[_0x50e8('0x23')](respondWithResult(_0x141bd4,0xc9))[_0x50e8('0x3e')](handleError(_0x141bd4,null));};exports['update']=function(_0x3692ba,_0x58f14e){if(_0x3692ba[_0x50e8('0x43')]['id']){delete _0x3692ba['body']['id'];}delete _0x3692ba[_0x50e8('0x43')][_0x50e8('0x44')];delete _0x3692ba[_0x50e8('0x43')][_0x50e8('0x45')];delete _0x3692ba[_0x50e8('0x43')][_0x50e8('0x46')];delete _0x3692ba[_0x50e8('0x43')]['value'];return db[_0x50e8('0x29')][_0x50e8('0x41')]({'where':{'id':_0x3692ba[_0x50e8('0x47')]['id']}})[_0x50e8('0x23')](handleEntityNotFound(_0x58f14e,null))[_0x50e8('0x23')](saveUpdates(_0x3692ba[_0x50e8('0x43')],null))['then'](respondWithResult(_0x58f14e,null))[_0x50e8('0x3e')](handleError(_0x58f14e,null));};exports[_0x50e8('0x48')]=function(_0xff2e24,_0x27c80a){return db['ScreenRecording'][_0x50e8('0x48')]()[_0x50e8('0x23')](respondWithResult(_0x27c80a,null))[_0x50e8('0x3e')](handleError(_0x27c80a,null));};exports[_0x50e8('0x49')]=function(_0x207f06,_0x1372e3,_0x320b00){var _0x5f5220=require('../../components/encryptor');var _0x55083e=![];var _0x2b54ad={};if(_0x207f06[_0x50e8('0x2f')][_0x50e8('0x39')]&&_0x207f06[_0x50e8('0x2f')][_0x50e8('0x39')]===_0x50e8('0x4a')){_0x2b54ad['uniqueid']=_0x207f06[_0x50e8('0x47')]['id'];}else{_0x2b54ad['id']=_0x207f06[_0x50e8('0x47')]['id'];}return db[_0x50e8('0x29')][_0x50e8('0x41')]({'where':_0x2b54ad,'attributes':['id','value'],'raw':!![]})[_0x50e8('0x23')](handleEntityNotFound(_0x1372e3,null))[_0x50e8('0x23')](function(_0x373b41){if(_0x373b41){var _0x1cc5ba=path[_0x50e8('0x4b')](config[_0x50e8('0x4c')],'server/files/screen_recordings',_0x373b41[_0x50e8('0x4d')]);var _0x5d0d54=util['format']('%s.cypher',_0x1cc5ba);if(fs[_0x50e8('0x4e')](_0x5d0d54)){_0x55083e=!![];return _0x5f5220['decryptFile'](_0x5d0d54,_0x1cc5ba,config[_0x50e8('0x4f')][_0x50e8('0x50')])[_0x50e8('0x23')](function(){return _0x373b41;});}return _0x373b41;}})[_0x50e8('0x23')](function(_0x279cf4){if(_0x279cf4){var _0x12224d=path[_0x50e8('0x4b')](config['root'],_0x50e8('0x51'),_0x279cf4[_0x50e8('0x4d')]);if(!fs[_0x50e8('0x4e')](_0x12224d)){throw new db['Sequelize']['ValidationError']('ScreenRecording\x20not\x20found');}if(_0x279cf4[_0x50e8('0x52')]){return _0x1372e3[_0x50e8('0x49')](_0x12224d,_0x279cf4[_0x50e8('0x52')]+path[_0x50e8('0x53')](_0x12224d),function(){if(_0x55083e){fs[_0x50e8('0x54')](_0x12224d);}});}else{return _0x1372e3[_0x50e8('0x49')](_0x12224d,function(_0x583d6a){if(_0x55083e){fs[_0x50e8('0x54')](_0x12224d);}});}}})['catch'](function(_0x255b48){if(_0x255b48[_0x50e8('0x55')]==='ScreenRecording\x20not\x20found'){_0x1372e3['status'](0x194)['send'](_0x50e8('0x56'));}else{return handleError(_0x1372e3,null);}});};exports[_0x50e8('0x57')]=function(_0x5d1fc8,_0x351047){return db[_0x50e8('0x29')][_0x50e8('0x41')]({'where':{'id':_0x5d1fc8[_0x50e8('0x47')]['id']}})[_0x50e8('0x23')](function(_0x47b428){if(_[_0x50e8('0x58')](_0x47b428)){throw new ReferenceError(_0x50e8('0x59'));}return _0x47b428;})[_0x50e8('0x23')](function(_0x4b80ac){var _0x583e58=path[_0x50e8('0x4b')](config[_0x50e8('0x4c')],_0x50e8('0x51'),_0x4b80ac[_0x50e8('0x4d')]);logger[_0x50e8('0x5a')](_0x50e8('0x5b'),_0x583e58);if(!_['isNil'](_0x4b80ac['value'])&&fs[_0x50e8('0x4e')](_0x583e58)){logger['info'](_0x50e8('0x5c')+_0x583e58+_0x50e8('0x5d'));fs['unlinkSync'](_0x583e58);}_0x583e58=_0x583e58+_0x50e8('0x5e');if(!_['isNil'](_0x4b80ac['value'])&&fs['existsSync'](_0x583e58)){logger[_0x50e8('0x5a')](_0x50e8('0x5c')+_0x583e58+_0x50e8('0x5d'));fs[_0x50e8('0x5f')](_0x583e58);}return _0x4b80ac;})['then'](function(_0x480362){if(!_0x480362)throw new InternalError();return _0x480362[_0x50e8('0x57')]();})[_0x50e8('0x23')](function(){_0x351047[_0x50e8('0x18')](0xcc)[_0x50e8('0x19')]();})[_0x50e8('0x3e')](handleError(_0x351047,null));}; \ No newline at end of file +var _0x4c4e=['findAll','rows','catch','params','keys','find','create','body','duration','createdAt','closedAt','describe','download','../../components/encryptor','uniqueid','value','join','root','server/files/screen_recordings','%s.cypher','existsSync','secrets','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','send','Not\x20found','isNil','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','destroy','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','sendStatus','name','index','map','ScreenRecording','rawAttributes','type','key','model','differenceBy','format','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include'];(function(_0x2bd1ec,_0x3fe65f){var _0x2f7577=function(_0x5234fb){while(--_0x5234fb){_0x2bd1ec['push'](_0x2bd1ec['shift']());}};_0x2f7577(++_0x3fe65f);}(_0x4c4e,0x152));var _0xe4c4=function(_0x32f0eb,_0x32676c){_0x32f0eb=_0x32f0eb-0x0;var _0x407382=_0x4c4e[_0x32f0eb];return _0x407382;};'use strict';var emlformat=require(_0xe4c4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe4c4('0x1'));var jsonpatch=require(_0xe4c4('0x2'));var rp=require(_0xe4c4('0x3'));var moment=require('moment');var BPromise=require(_0xe4c4('0x4'));var Mustache=require(_0xe4c4('0x5'));var util=require(_0xe4c4('0x6'));var path=require('path');var sox=require(_0xe4c4('0x7'));var csv=require('to-csv');var ejs=require(_0xe4c4('0x8'));var fs=require('fs');var fs_extra=require(_0xe4c4('0x9'));var _=require(_0xe4c4('0xa'));var squel=require(_0xe4c4('0xb'));var crypto=require(_0xe4c4('0xc'));var jsforce=require(_0xe4c4('0xd'));var deskjs=require(_0xe4c4('0xe'));var toCsv=require(_0xe4c4('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe4c4('0x10'));var authService=require(_0xe4c4('0x11'));var qs=require(_0xe4c4('0x12'));var as=require(_0xe4c4('0x13'));var hardwareService=require(_0xe4c4('0x14'));var logger=require(_0xe4c4('0x15'))('api');var utils=require(_0xe4c4('0x16'));var config=require(_0xe4c4('0x17'));var licenseUtil=require(_0xe4c4('0x18'));var db=require(_0xe4c4('0x19'))['db'];function respondWithStatusCode(_0x50bfab,_0x262083){_0x262083=_0x262083||0xcc;return function(_0x115802){if(_0x115802){return _0x50bfab['sendStatus'](_0x262083);}return _0x50bfab[_0xe4c4('0x1a')](_0x262083)[_0xe4c4('0x1b')]();};}function respondWithResult(_0x5aa89b,_0x42ce9e){_0x42ce9e=_0x42ce9e||0xc8;return function(_0x29766a){if(_0x29766a){return _0x5aa89b['status'](_0x42ce9e)[_0xe4c4('0x1c')](_0x29766a);}};}function respondWithFilteredResult(_0x465c9b,_0x26ea05){return function(_0x40a36e){if(_0x40a36e){var _0x19e59b=typeof _0x26ea05[_0xe4c4('0x1d')]===_0xe4c4('0x1e')&&typeof _0x26ea05[_0xe4c4('0x1f')]===_0xe4c4('0x1e');var _0x36b10c=_0x40a36e[_0xe4c4('0x20')];var _0x42242c=_0x19e59b?0x0:_0x26ea05[_0xe4c4('0x1d')];var _0x43a9ce=_0x19e59b?_0x40a36e[_0xe4c4('0x20')]:_0x26ea05['offset']+_0x26ea05[_0xe4c4('0x1f')];var _0x24f946;if(_0x43a9ce>=_0x36b10c){_0x43a9ce=_0x36b10c;_0x24f946=0xc8;}else{_0x24f946=0xce;}_0x465c9b[_0xe4c4('0x1a')](_0x24f946);return _0x465c9b[_0xe4c4('0x21')]('Content-Range',_0x42242c+'-'+_0x43a9ce+'/'+_0x36b10c)[_0xe4c4('0x1c')](_0x40a36e);}return null;};}function patchUpdates(_0x1cad5d){return function(_0x1727eb){try{jsonpatch[_0xe4c4('0x22')](_0x1727eb,_0x1cad5d,!![]);}catch(_0x2c5aea){return BPromise[_0xe4c4('0x23')](_0x2c5aea);}return _0x1727eb[_0xe4c4('0x24')]();};}function saveUpdates(_0x393c96,_0x21bbb1){return function(_0x1a7690){if(_0x1a7690){return _0x1a7690[_0xe4c4('0x25')](_0x393c96)[_0xe4c4('0x26')](function(_0x138ead){return _0x138ead;});}return null;};}function removeEntity(_0x1db719,_0x15873e){return function(_0x59498e){if(_0x59498e){return _0x59498e['destroy']()[_0xe4c4('0x26')](function(){_0x1db719['status'](0xcc)[_0xe4c4('0x1b')]();});}};}function handleEntityNotFound(_0x5374fd,_0x3adfcb){return function(_0x5efc4c){if(!_0x5efc4c){_0x5374fd[_0xe4c4('0x27')](0x194);}return _0x5efc4c;};}function handleError(_0x583393,_0xba53ef){_0xba53ef=_0xba53ef||0x1f4;return function(_0x4a0199){logger['error'](_0x4a0199['stack']);if(_0x4a0199['name']){delete _0x4a0199[_0xe4c4('0x28')];}_0x583393['status'](_0xba53ef)['send'](_0x4a0199);};}exports[_0xe4c4('0x29')]=function(_0x11deab,_0x4bb911){var _0x57ba43={},_0x7428ad={},_0x33de43={'count':0x0,'rows':[]};var _0x4aa6c1=_[_0xe4c4('0x2a')](db[_0xe4c4('0x2b')][_0xe4c4('0x2c')],function(_0x48060e){return{'name':_0x48060e['fieldName'],'type':_0x48060e[_0xe4c4('0x2d')][_0xe4c4('0x2e')]};});_0x7428ad[_0xe4c4('0x2f')]=_[_0xe4c4('0x30')](_['map'](_0x4aa6c1,'name'),[_0xe4c4('0x31')]);_0x7428ad[_0xe4c4('0x32')]=_['keys'](_0x11deab[_0xe4c4('0x32')]);_0x7428ad[_0xe4c4('0x33')]=_[_0xe4c4('0x34')](_0x7428ad['model'],_0x7428ad[_0xe4c4('0x32')]);_0x57ba43['attributes']=_[_0xe4c4('0x34')](_0x7428ad[_0xe4c4('0x2f')],qs[_0xe4c4('0x35')](_0x11deab[_0xe4c4('0x32')][_0xe4c4('0x35')]));_0x57ba43[_0xe4c4('0x36')]=_0x57ba43[_0xe4c4('0x36')][_0xe4c4('0x37')]?_0x57ba43[_0xe4c4('0x36')]:_0x7428ad[_0xe4c4('0x2f')];if(!_0x11deab[_0xe4c4('0x32')][_0xe4c4('0x38')]('nolimit')){_0x57ba43[_0xe4c4('0x1f')]=qs[_0xe4c4('0x1f')](_0x11deab[_0xe4c4('0x32')]['limit']);_0x57ba43[_0xe4c4('0x1d')]=qs[_0xe4c4('0x1d')](_0x11deab[_0xe4c4('0x32')]['offset']);}_0x57ba43[_0xe4c4('0x39')]=qs[_0xe4c4('0x3a')](_0x11deab[_0xe4c4('0x32')][_0xe4c4('0x3a')]);_0x57ba43[_0xe4c4('0x3b')]=qs[_0xe4c4('0x33')](_[_0xe4c4('0x3c')](_0x11deab[_0xe4c4('0x32')],_0x7428ad[_0xe4c4('0x33')]),_0x4aa6c1);if(_0x11deab[_0xe4c4('0x32')]['filter']){_0x57ba43[_0xe4c4('0x3b')]=_[_0xe4c4('0x3d')](_0x57ba43[_0xe4c4('0x3b')],{'$or':_[_0xe4c4('0x2a')](_0x4aa6c1,function(_0x4c5551){if(_0x4c5551[_0xe4c4('0x2d')]!==_0xe4c4('0x3e')){var _0x4e6bd9={};_0x4e6bd9[_0x4c5551[_0xe4c4('0x28')]]={'$like':'%'+_0x11deab[_0xe4c4('0x32')]['filter']+'%'};return _0x4e6bd9;}})});}_0x57ba43=_[_0xe4c4('0x3d')]({},_0x57ba43,_0x11deab[_0xe4c4('0x3f')]);var _0x127bcd={'where':_0x57ba43[_0xe4c4('0x3b')]};return db[_0xe4c4('0x2b')][_0xe4c4('0x20')](_0x127bcd)[_0xe4c4('0x26')](function(_0x43201e){_0x33de43[_0xe4c4('0x20')]=_0x43201e;if(_0x11deab[_0xe4c4('0x32')][_0xe4c4('0x40')]){_0x57ba43[_0xe4c4('0x41')]=[{'all':!![]}];}return db['ScreenRecording'][_0xe4c4('0x42')](_0x57ba43);})[_0xe4c4('0x26')](function(_0x2b306d){_0x33de43[_0xe4c4('0x43')]=_0x2b306d;return _0x33de43;})[_0xe4c4('0x26')](respondWithFilteredResult(_0x4bb911,_0x57ba43))[_0xe4c4('0x44')](handleError(_0x4bb911,null));};exports['show']=function(_0x312a49,_0x526bef){var _0xca07dc={'raw':![],'where':{'id':_0x312a49[_0xe4c4('0x45')]['id']}},_0x3c067a={};_0x3c067a[_0xe4c4('0x2f')]=_[_0xe4c4('0x46')](db['ScreenRecording']['rawAttributes']);_0x3c067a[_0xe4c4('0x32')]=_[_0xe4c4('0x46')](_0x312a49[_0xe4c4('0x32')]);_0x3c067a['filters']=_[_0xe4c4('0x34')](_0x3c067a[_0xe4c4('0x2f')],_0x3c067a[_0xe4c4('0x32')]);_0xca07dc[_0xe4c4('0x36')]=_['intersection'](_0x3c067a[_0xe4c4('0x2f')],qs[_0xe4c4('0x35')](_0x312a49[_0xe4c4('0x32')][_0xe4c4('0x35')]));_0xca07dc[_0xe4c4('0x36')]=_0xca07dc[_0xe4c4('0x36')][_0xe4c4('0x37')]?_0xca07dc[_0xe4c4('0x36')]:_0x3c067a[_0xe4c4('0x2f')];if(_0x312a49['query'][_0xe4c4('0x40')]){_0xca07dc['include']=[{'all':!![]}];}_0xca07dc=_[_0xe4c4('0x3d')]({},_0xca07dc,_0x312a49[_0xe4c4('0x3f')]);return db[_0xe4c4('0x2b')][_0xe4c4('0x47')](_0xca07dc)[_0xe4c4('0x26')](handleEntityNotFound(_0x526bef,null))[_0xe4c4('0x26')](respondWithResult(_0x526bef,null))[_0xe4c4('0x44')](handleError(_0x526bef,null));};exports[_0xe4c4('0x48')]=function(_0x36f8ad,_0x18fb82){return db[_0xe4c4('0x2b')][_0xe4c4('0x48')](_0x36f8ad[_0xe4c4('0x49')],{})[_0xe4c4('0x26')](respondWithResult(_0x18fb82,0xc9))['catch'](handleError(_0x18fb82,null));};exports['update']=function(_0xe0e351,_0x198961){if(_0xe0e351['body']['id']){delete _0xe0e351[_0xe4c4('0x49')]['id'];}delete _0xe0e351[_0xe4c4('0x49')][_0xe4c4('0x4a')];delete _0xe0e351[_0xe4c4('0x49')][_0xe4c4('0x4b')];delete _0xe0e351['body'][_0xe4c4('0x4c')];delete _0xe0e351[_0xe4c4('0x49')]['value'];return db[_0xe4c4('0x2b')][_0xe4c4('0x47')]({'where':{'id':_0xe0e351['params']['id']}})[_0xe4c4('0x26')](handleEntityNotFound(_0x198961,null))['then'](saveUpdates(_0xe0e351[_0xe4c4('0x49')],null))[_0xe4c4('0x26')](respondWithResult(_0x198961,null))[_0xe4c4('0x44')](handleError(_0x198961,null));};exports[_0xe4c4('0x4d')]=function(_0x12eaed,_0x525534){return db[_0xe4c4('0x2b')][_0xe4c4('0x4d')]()[_0xe4c4('0x26')](respondWithResult(_0x525534,null))[_0xe4c4('0x44')](handleError(_0x525534,null));};exports[_0xe4c4('0x4e')]=function(_0x32a50e,_0x3ddcbe,_0x3aa205){var _0x1a96ba=require(_0xe4c4('0x4f'));var _0x1fe354=![];var _0x1940e3={};if(_0x32a50e[_0xe4c4('0x32')][_0xe4c4('0x2d')]&&_0x32a50e[_0xe4c4('0x32')][_0xe4c4('0x2d')]==='uniqueid'){_0x1940e3[_0xe4c4('0x50')]=_0x32a50e[_0xe4c4('0x45')]['id'];}else{_0x1940e3['id']=_0x32a50e[_0xe4c4('0x45')]['id'];}return db['ScreenRecording'][_0xe4c4('0x47')]({'where':_0x1940e3,'attributes':['id',_0xe4c4('0x51')],'raw':!![]})[_0xe4c4('0x26')](handleEntityNotFound(_0x3ddcbe,null))['then'](function(_0x45f959){if(_0x45f959){var _0x485c50=path[_0xe4c4('0x52')](config[_0xe4c4('0x53')],_0xe4c4('0x54'),_0x45f959['value']);var _0x479361=util[_0xe4c4('0x31')](_0xe4c4('0x55'),_0x485c50);if(fs[_0xe4c4('0x56')](_0x479361)){_0x1fe354=!![];return _0x1a96ba['decryptFile'](_0x479361,_0x485c50,config[_0xe4c4('0x57')]['recording'])['then'](function(){return _0x45f959;});}return _0x45f959;}})['then'](function(_0x4e08ec){if(_0x4e08ec){var _0x1ca931=path[_0xe4c4('0x52')](config[_0xe4c4('0x53')],_0xe4c4('0x54'),_0x4e08ec[_0xe4c4('0x51')]);if(!fs[_0xe4c4('0x56')](_0x1ca931)){throw new db['Sequelize'][(_0xe4c4('0x58'))](_0xe4c4('0x59'));}if(_0x4e08ec[_0xe4c4('0x5a')]){return _0x3ddcbe[_0xe4c4('0x4e')](_0x1ca931,_0x4e08ec[_0xe4c4('0x5a')]+path[_0xe4c4('0x5b')](_0x1ca931),function(){if(_0x1fe354){fs['unlink'](_0x1ca931);}});}else{return _0x3ddcbe['download'](_0x1ca931,function(_0x27599b){if(_0x1fe354){fs[_0xe4c4('0x5c')](_0x1ca931);}});}}})[_0xe4c4('0x44')](function(_0x3c8e44){if(_0x3c8e44[_0xe4c4('0x5d')]===_0xe4c4('0x59')){_0x3ddcbe[_0xe4c4('0x1a')](0x194)[_0xe4c4('0x5e')](_0xe4c4('0x5f'));}else{return handleError(_0x3ddcbe,null);}});};exports['destroy']=function(_0x59f033,_0x5a4138){return db['ScreenRecording'][_0xe4c4('0x47')]({'where':{'id':_0x59f033[_0xe4c4('0x45')]['id']}})[_0xe4c4('0x26')](function(_0x58f2dd){if(_[_0xe4c4('0x60')](_0x58f2dd)){throw new ReferenceError('Entity\x20not\x20found');}return _0x58f2dd;})[_0xe4c4('0x26')](function(_0x56ead3){var _0x5d6c0a=path[_0xe4c4('0x52')](config[_0xe4c4('0x53')],_0xe4c4('0x54'),_0x56ead3['value']);logger['info']('cancellazione\x20fisica\x20documento\x20%s',_0x5d6c0a);if(!_[_0xe4c4('0x60')](_0x56ead3[_0xe4c4('0x51')])&&fs['existsSync'](_0x5d6c0a)){logger[_0xe4c4('0x61')](_0xe4c4('0x62')+_0x5d6c0a+_0xe4c4('0x63'));fs['unlinkSync'](_0x5d6c0a);}_0x5d6c0a=_0x5d6c0a+'.cypher';if(!_[_0xe4c4('0x60')](_0x56ead3[_0xe4c4('0x51')])&&fs[_0xe4c4('0x56')](_0x5d6c0a)){logger[_0xe4c4('0x61')](_0xe4c4('0x62')+_0x5d6c0a+_0xe4c4('0x63'));fs['unlinkSync'](_0x5d6c0a);}return _0x56ead3;})[_0xe4c4('0x26')](function(_0x1bddd5){if(!_0x1bddd5)throw new InternalError();return _0x1bddd5[_0xe4c4('0x64')]();})['then'](function(){_0x5a4138[_0xe4c4('0x1a')](0xcc)[_0xe4c4('0x1b')]();})[_0xe4c4('0x44')](handleError(_0x5a4138,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 1c3ca4d..17e8dc2 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 _0xc26a=['./screenRecording.attributes','exports','ScreenRecording','screen_recordings','interactionid','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x10811a,_0x5bfaa7){var _0x149eb6=function(_0xc6ed6){while(--_0xc6ed6){_0x10811a['push'](_0x10811a['shift']());}};_0x149eb6(++_0x5bfaa7);}(_0xc26a,0x1cc));var _0xac26=function(_0x347097,_0x37a135){_0x347097=_0x347097-0x0;var _0x5dfd04=_0xc26a[_0x347097];return _0x5dfd04;};'use strict';var _=require(_0xac26('0x0'));var util=require('util');var logger=require(_0xac26('0x1'))(_0xac26('0x2'));var moment=require(_0xac26('0x3'));var BPromise=require(_0xac26('0x4'));var rp=require(_0xac26('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xac26('0x6'));var config=require(_0xac26('0x7'));var attributes=require(_0xac26('0x8'));module[_0xac26('0x9')]=function(_0x1d5b26,_0x294cad){return _0x1d5b26['define'](_0xac26('0xa'),attributes,{'tableName':_0xac26('0xb'),'paranoid':![],'indexes':[{'name':_0xac26('0xc'),'fields':[_0xac26('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0bdb=['interactionid','lodash','util','api','moment','bluebird','request-promise','../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording','screen_recordings'];(function(_0xb808df,_0x26e487){var _0x225282=function(_0x2598f8){while(--_0x2598f8){_0xb808df['push'](_0xb808df['shift']());}};_0x225282(++_0x26e487);}(_0x0bdb,0x187));var _0xb0bd=function(_0x4c37b0,_0x34a976){_0x4c37b0=_0x4c37b0-0x0;var _0xbc146c=_0x0bdb[_0x4c37b0];return _0xbc146c;};'use strict';var _=require(_0xb0bd('0x0'));var util=require(_0xb0bd('0x1'));var logger=require('../../config/logger')(_0xb0bd('0x2'));var moment=require(_0xb0bd('0x3'));var BPromise=require(_0xb0bd('0x4'));var rp=require(_0xb0bd('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb0bd('0x6'));var attributes=require(_0xb0bd('0x7'));module[_0xb0bd('0x8')]=function(_0x293377,_0x344669){return _0x293377[_0xb0bd('0x9')](_0xb0bd('0xa'),attributes,{'tableName':_0xb0bd('0xb'),'paranoid':![],'indexes':[{'name':'interactionid','fields':[_0xb0bd('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index f1d1779..3f1205f 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 _0x6d4e=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x3fe139,_0x1ce172){var _0x50ffdf=function(_0x2c11b5){while(--_0x2c11b5){_0x3fe139['push'](_0x3fe139['shift']());}};_0x50ffdf(++_0x1ce172);}(_0x6d4e,0x82));var _0xe6d4=function(_0x202c61,_0x3673e0){_0x202c61=_0x202c61-0x0;var _0x540691=_0x6d4e[_0x202c61];return _0x540691;};'use strict';var _=require(_0xe6d4('0x0'));var util=require(_0xe6d4('0x1'));var moment=require(_0xe6d4('0x2'));var BPromise=require(_0xe6d4('0x3'));var rs=require(_0xe6d4('0x4'));var fs=require('fs');var Redis=require(_0xe6d4('0x5'));var db=require(_0xe6d4('0x6'))['db'];var utils=require(_0xe6d4('0x7'));var logger=require(_0xe6d4('0x8'))(_0xe6d4('0x9'));var config=require(_0xe6d4('0xa'));var jayson=require(_0xe6d4('0xb'));var client=jayson['client'][_0xe6d4('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x15927e,_0x31f45b,_0x2c7361){return new BPromise(function(_0x21a51d,_0x183386){return client[_0xe6d4('0xd')](_0x15927e,_0x2c7361)[_0xe6d4('0xe')](function(_0x11157e){logger[_0xe6d4('0xf')](_0xe6d4('0x10'),_0x31f45b,_0xe6d4('0x11'));logger[_0xe6d4('0x12')]('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x31f45b,_0xe6d4('0x11'),JSON[_0xe6d4('0x13')](_0x11157e));if(_0x11157e[_0xe6d4('0x14')]){if(_0x11157e[_0xe6d4('0x14')]['code']===0x1f4){logger['error'](_0xe6d4('0x10'),_0x31f45b,_0x11157e[_0xe6d4('0x14')]['message']);return _0x183386(_0x11157e['error'][_0xe6d4('0x15')]);}logger[_0xe6d4('0x14')](_0xe6d4('0x10'),_0x31f45b,_0x11157e[_0xe6d4('0x14')][_0xe6d4('0x15')]);return _0x21a51d(_0x11157e[_0xe6d4('0x14')]['message']);}else{logger[_0xe6d4('0xf')](_0xe6d4('0x10'),_0x31f45b,_0xe6d4('0x11'));_0x21a51d(_0x11157e[_0xe6d4('0x16')][_0xe6d4('0x15')]);}})['catch'](function(_0x42ce0a){logger[_0xe6d4('0x14')]('ScreenRecording,\x20%s,\x20%s',_0x31f45b,_0x42ce0a);_0x183386(_0x42ce0a);});});} \ No newline at end of file +var _0x61ed=['message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0xbe5f58,_0xb76cbb){var _0x87b9b3=function(_0x1792fe){while(--_0x1792fe){_0xbe5f58['push'](_0xbe5f58['shift']());}};_0x87b9b3(++_0xb76cbb);}(_0x61ed,0xe9));var _0xd61e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x61ed[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require(_0xd61e('0x0'));var moment=require(_0xd61e('0x1'));var BPromise=require(_0xd61e('0x2'));var rs=require(_0xd61e('0x3'));var fs=require('fs');var Redis=require(_0xd61e('0x4'));var db=require(_0xd61e('0x5'))['db'];var utils=require(_0xd61e('0x6'));var logger=require(_0xd61e('0x7'))(_0xd61e('0x8'));var config=require(_0xd61e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd61e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x46b4f8,_0x3350ae,_0x58a0f3){return new BPromise(function(_0x3c4567,_0x4965aa){return client[_0xd61e('0xb')](_0x46b4f8,_0x58a0f3)[_0xd61e('0xc')](function(_0x30ecae){logger[_0xd61e('0xd')](_0xd61e('0xe'),_0x3350ae,_0xd61e('0xf'));logger[_0xd61e('0x10')](_0xd61e('0x11'),_0x3350ae,_0xd61e('0xf'),JSON[_0xd61e('0x12')](_0x30ecae));if(_0x30ecae[_0xd61e('0x13')]){if(_0x30ecae[_0xd61e('0x13')]['code']===0x1f4){logger[_0xd61e('0x13')](_0xd61e('0xe'),_0x3350ae,_0x30ecae[_0xd61e('0x13')]['message']);return _0x4965aa(_0x30ecae[_0xd61e('0x13')]['message']);}logger['error'](_0xd61e('0xe'),_0x3350ae,_0x30ecae[_0xd61e('0x13')][_0xd61e('0x14')]);return _0x3c4567(_0x30ecae[_0xd61e('0x13')][_0xd61e('0x14')]);}else{logger[_0xd61e('0xd')](_0xd61e('0xe'),_0x3350ae,_0xd61e('0xf'));_0x3c4567(_0x30ecae[_0xd61e('0x15')][_0xd61e('0x14')]);}})[_0xd61e('0x16')](function(_0x5c4b59){logger['error'](_0xd61e('0xe'),_0x3350ae,_0x5c4b59);_0x4965aa(_0x5c4b59);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index a51d8cd..c9482b1 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 _0x5ef2=['originalname','post','file','logologin','single','addLogoLogin','preferred','/:id/preferred','addPreferred','favicon','/:id/favicon','put','update','multer','util','path','express','Router','./setting.controller','isAuthenticated','index','get','/now','/:id','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','getPreferred','diskStorage','join','root','server/files/images/logos/','format','%s%s','logo','extname'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0x5ef2,0xf7));var _0x25ef=function(_0x4b949a,_0x38a57d){_0x4b949a=_0x4b949a-0x0;var _0x7d20b0=_0x5ef2[_0x4b949a];return _0x7d20b0;};'use strict';var multer=require(_0x25ef('0x0'));var util=require(_0x25ef('0x1'));var path=require(_0x25ef('0x2'));var timeout=require('connect-timeout');var express=require(_0x25ef('0x3'));var router=express[_0x25ef('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x25ef('0x5'));router['get']('/',auth[_0x25ef('0x6')](),controller[_0x25ef('0x7')]);router[_0x25ef('0x8')](_0x25ef('0x9'),controller['getDate']);router[_0x25ef('0x8')](_0x25ef('0xa'),controller['show']);router[_0x25ef('0x8')](_0x25ef('0xb'),controller[_0x25ef('0xc')]);router[_0x25ef('0x8')](_0x25ef('0xd'),controller[_0x25ef('0xe')]);router[_0x25ef('0x8')](_0x25ef('0xf'),controller[_0x25ef('0x10')]);router[_0x25ef('0x8')]('/:id/preferred',controller[_0x25ef('0x11')]);router['get']('/:id/favicon',controller['getFavicon']);var upload=multer({'storage':multer[_0x25ef('0x12')]({'destination':function(_0x372142,_0x3c2e8c,_0x41a0e4){_0x41a0e4(null,path[_0x25ef('0x13')](config[_0x25ef('0x14')],_0x25ef('0x15')));},'filename':function(_0x5efb55,_0x1a5118,_0x5e3d1e){_0x5e3d1e(null,util[_0x25ef('0x16')](_0x25ef('0x17'),_0x25ef('0x18'),path[_0x25ef('0x19')](_0x1a5118[_0x25ef('0x1a')])));}})});router[_0x25ef('0x1b')]('/:id/logo',upload['single'](_0x25ef('0x1c')),controller['addLogo']);var upload=multer({'storage':multer[_0x25ef('0x12')]({'destination':function(_0x29cda4,_0x126b92,_0x46d508){_0x46d508(null,path[_0x25ef('0x13')](config['root'],'server/files/images/logos/'));},'filename':function(_0x5811b3,_0x4c65ab,_0x3fcd0c){_0x3fcd0c(null,util[_0x25ef('0x16')](_0x25ef('0x17'),_0x25ef('0x1d'),path[_0x25ef('0x19')](_0x4c65ab[_0x25ef('0x1a')])));}})});router[_0x25ef('0x1b')](_0x25ef('0xd'),upload[_0x25ef('0x1e')](_0x25ef('0x1c')),controller[_0x25ef('0x1f')]);var upload=multer({'storage':multer[_0x25ef('0x12')]({'destination':function(_0x1e409a,_0x46b694,_0x43c895){_0x43c895(null,path[_0x25ef('0x13')](config[_0x25ef('0x14')],_0x25ef('0x15')));},'filename':function(_0x50fdfd,_0x3b4fcf,_0x12eb3a){_0x12eb3a(null,util[_0x25ef('0x16')]('%s%s',_0x25ef('0x20'),path['extname'](_0x3b4fcf[_0x25ef('0x1a')])));}})});router[_0x25ef('0x1b')](_0x25ef('0x21'),upload[_0x25ef('0x1e')](_0x25ef('0x1c')),controller[_0x25ef('0x22')]);var upload=multer({'storage':multer[_0x25ef('0x12')]({'destination':function(_0x443dbe,_0x593997,_0xc9b985){_0xc9b985(null,path[_0x25ef('0x13')](config[_0x25ef('0x14')],'server/files/images/logos/'));},'filename':function(_0x3328ab,_0x44cee2,_0x3fc674){_0x3fc674(null,util[_0x25ef('0x16')](_0x25ef('0x17'),_0x25ef('0x23'),path[_0x25ef('0x19')](_0x44cee2[_0x25ef('0x1a')])));}})});router[_0x25ef('0x1b')](_0x25ef('0x24'),upload['single']('file'),controller['addFavicon']);router[_0x25ef('0x25')](_0x25ef('0xa'),auth[_0x25ef('0x6')](),controller[_0x25ef('0x26')]);module['exports']=router; \ No newline at end of file +var _0xc322=['/:id/favicon','getFavicon','diskStorage','join','root','server/files/images/logos/','format','%s%s','logo','extname','originalname','post','logologin','single','file','preferred','addPreferred','favicon','addFavicon','update','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./setting.controller','get','index','getDate','/:id','/:id/logo','getLogo','/:id/logo_login','/:id/gdpr','gdpr','/:id/preferred','getPreferred'];(function(_0x31df8c,_0x357ff3){var _0x49d67f=function(_0x130f01){while(--_0x130f01){_0x31df8c['push'](_0x31df8c['shift']());}};_0x49d67f(++_0x357ff3);}(_0xc322,0x17d));var _0x2c32=function(_0xdd827a,_0x482ad2){_0xdd827a=_0xdd827a-0x0;var _0x2f46f1=_0xc322[_0xdd827a];return _0x2f46f1;};'use strict';var multer=require(_0x2c32('0x0'));var util=require(_0x2c32('0x1'));var path=require(_0x2c32('0x2'));var timeout=require(_0x2c32('0x3'));var express=require(_0x2c32('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x2c32('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2c32('0x6'));var controller=require(_0x2c32('0x7'));router[_0x2c32('0x8')]('/',auth['isAuthenticated'](),controller[_0x2c32('0x9')]);router[_0x2c32('0x8')]('/now',controller[_0x2c32('0xa')]);router[_0x2c32('0x8')](_0x2c32('0xb'),controller['show']);router[_0x2c32('0x8')](_0x2c32('0xc'),controller[_0x2c32('0xd')]);router[_0x2c32('0x8')](_0x2c32('0xe'),controller['getLogoLogin']);router[_0x2c32('0x8')](_0x2c32('0xf'),controller[_0x2c32('0x10')]);router[_0x2c32('0x8')](_0x2c32('0x11'),controller[_0x2c32('0x12')]);router[_0x2c32('0x8')](_0x2c32('0x13'),controller[_0x2c32('0x14')]);var upload=multer({'storage':multer[_0x2c32('0x15')]({'destination':function(_0x35c272,_0x5b0b03,_0x387a8c){_0x387a8c(null,path[_0x2c32('0x16')](config[_0x2c32('0x17')],_0x2c32('0x18')));},'filename':function(_0x4dc86c,_0x3d05d4,_0x48e35c){_0x48e35c(null,util[_0x2c32('0x19')](_0x2c32('0x1a'),_0x2c32('0x1b'),path[_0x2c32('0x1c')](_0x3d05d4[_0x2c32('0x1d')])));}})});router[_0x2c32('0x1e')](_0x2c32('0xc'),upload['single']('file'),controller['addLogo']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2b701e,_0x5ab35a,_0x3372bf){_0x3372bf(null,path[_0x2c32('0x16')](config[_0x2c32('0x17')],_0x2c32('0x18')));},'filename':function(_0x1fa234,_0x12d840,_0x4574d2){_0x4574d2(null,util[_0x2c32('0x19')](_0x2c32('0x1a'),_0x2c32('0x1f'),path[_0x2c32('0x1c')](_0x12d840[_0x2c32('0x1d')])));}})});router[_0x2c32('0x1e')](_0x2c32('0xe'),upload[_0x2c32('0x20')](_0x2c32('0x21')),controller['addLogoLogin']);var upload=multer({'storage':multer[_0x2c32('0x15')]({'destination':function(_0x43a4fb,_0x4d87a8,_0x2afc2a){_0x2afc2a(null,path['join'](config[_0x2c32('0x17')],'server/files/images/logos/'));},'filename':function(_0x50768f,_0x59b841,_0x17ceca){_0x17ceca(null,util[_0x2c32('0x19')](_0x2c32('0x1a'),_0x2c32('0x22'),path[_0x2c32('0x1c')](_0x59b841[_0x2c32('0x1d')])));}})});router[_0x2c32('0x1e')](_0x2c32('0x11'),upload[_0x2c32('0x20')](_0x2c32('0x21')),controller[_0x2c32('0x23')]);var upload=multer({'storage':multer[_0x2c32('0x15')]({'destination':function(_0x244937,_0x28bb10,_0x38b90a){_0x38b90a(null,path[_0x2c32('0x16')](config[_0x2c32('0x17')],'server/files/images/logos/'));},'filename':function(_0x331f2e,_0x459d31,_0xaec38b){_0xaec38b(null,util[_0x2c32('0x19')](_0x2c32('0x1a'),_0x2c32('0x24'),path[_0x2c32('0x1c')](_0x459d31['originalname'])));}})});router['post'](_0x2c32('0x13'),upload[_0x2c32('0x20')](_0x2c32('0x21')),controller[_0x2c32('0x25')]);router['put'](_0x2c32('0xb'),auth['isAuthenticated'](),controller[_0x2c32('0x26')]);module[_0x2c32('0x27')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 4c7abcf..a00ccae 100644 --- a/server/api/setting/setting.attributes.js +++ b/server/api/setting/setting.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x2ae96d,_0x1a5351){var _0xa18630=function(_0x25996a){while(--_0x25996a){_0x2ae96d['push'](_0x2ae96d['shift']());}};_0xa18630(++_0x1a5351);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x14}}; \ No newline at end of file +var _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x5a733d,_0x2b2047){var _0x51bf8e=function(_0x3240fe){while(--_0x3240fe){_0x5a733d['push'](_0x5a733d['shift']());}};_0x51bf8e(++_0x2b2047);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x14}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index f17ff2d..50b1f98 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 _0xb27d=['squel','crypto','jsforce','desk.js','to-csv','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','Setting,\x20%s,\x20%s','message','result','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','stack','name','send','map','Setting','fieldName','type','key','keys','filters','intersection','model','query','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','show','params','rawAttributes','fields','find','addLogo','file','filename','body','logo','loginLogo','getLogo','getLicense','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','existsSync','join','root','toLower','default','upperFirst','default_logo.svg','Sequelize','\x20not\x20found','download','getLogoLogin','server/files/images/logos','defaultFavicon','default_loginLogo.svg','custom','gdpr','default_preferred.png','ValidationError','addFavicon','default_favicon.ico','getDate','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','fs-extra'];(function(_0x677852,_0x1f10e3){var _0x3446c0=function(_0x55f682){while(--_0x55f682){_0x677852['push'](_0x677852['shift']());}};_0x3446c0(++_0x1f10e3);}(_0xb27d,0xe5));var _0xdb27=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0xb27d[_0x164eca];return _0x2ce562;};'use strict';var emlformat=require(_0xdb27('0x0'));var rimraf=require(_0xdb27('0x1'));var zipdir=require(_0xdb27('0x2'));var jsonpatch=require(_0xdb27('0x3'));var rp=require('request-promise');var moment=require(_0xdb27('0x4'));var BPromise=require(_0xdb27('0x5'));var Mustache=require(_0xdb27('0x6'));var util=require(_0xdb27('0x7'));var path=require(_0xdb27('0x8'));var sox=require(_0xdb27('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdb27('0xa'));var _=require('lodash');var squel=require(_0xdb27('0xb'));var crypto=require(_0xdb27('0xc'));var jsforce=require(_0xdb27('0xd'));var deskjs=require(_0xdb27('0xe'));var toCsv=require(_0xdb27('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xdb27('0x10'));var qs=require(_0xdb27('0x11'));var as=require(_0xdb27('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdb27('0x13'))(_0xdb27('0x14'));var utils=require('../../config/utils');var config=require(_0xdb27('0x15'));var licenseUtil=require(_0xdb27('0x16'));var db=require(_0xdb27('0x17'))['db'];var jayson=require(_0xdb27('0x18'));var client=jayson[_0xdb27('0x19')][_0xdb27('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x160afc,_0x352f10,_0x5f07dc,_0x2d6731){return new BPromise(function(_0x3da690,_0x578b82){var _0x519fd6=_0x2d6731||client;return _0x519fd6[_0xdb27('0x1b')](_0x160afc,_0x5f07dc)[_0xdb27('0x1c')](function(_0x27ddb6){logger[_0xdb27('0x1d')]('Setting,\x20%s,\x20%s',_0x352f10,_0xdb27('0x1e'));logger[_0xdb27('0x1f')]('Setting,\x20%s,\x20%s,\x20%s',_0x352f10,'request\x20sent',JSON[_0xdb27('0x20')](_0x27ddb6));if(_0x27ddb6[_0xdb27('0x21')]){if(_0x27ddb6['error']['code']===0x1f4){logger[_0xdb27('0x21')](_0xdb27('0x22'),_0x352f10,_0x27ddb6[_0xdb27('0x21')]['message']);return _0x578b82(_0x27ddb6['error'][_0xdb27('0x23')]);}logger[_0xdb27('0x21')](_0xdb27('0x22'),_0x352f10,_0x27ddb6['error'][_0xdb27('0x23')]);return _0x3da690(_0x27ddb6[_0xdb27('0x21')][_0xdb27('0x23')]);}else{logger[_0xdb27('0x1d')](_0xdb27('0x22'),_0x352f10,'request\x20sent');_0x3da690(_0x27ddb6[_0xdb27('0x24')][_0xdb27('0x23')]);}})['catch'](function(_0x92e460){logger[_0xdb27('0x21')](_0xdb27('0x22'),_0x352f10,_0x92e460);_0x578b82(_0x92e460);});});}function respondWithStatusCode(_0x289efe,_0x4f8efe){_0x4f8efe=_0x4f8efe||0xcc;return function(_0x11fd96){if(_0x11fd96){return _0x289efe[_0xdb27('0x25')](_0x4f8efe);}return _0x289efe[_0xdb27('0x26')](_0x4f8efe)[_0xdb27('0x27')]();};}function respondWithResult(_0x2e4a80,_0xb66181){_0xb66181=_0xb66181||0xc8;return function(_0x9cb222){if(_0x9cb222){return _0x2e4a80[_0xdb27('0x26')](_0xb66181)[_0xdb27('0x28')](_0x9cb222);}};}function respondWithFilteredResult(_0x326279,_0x2d146c){return function(_0x539840){if(_0x539840){var _0xe8773b=typeof _0x2d146c[_0xdb27('0x29')]===_0xdb27('0x2a')&&typeof _0x2d146c[_0xdb27('0x2b')]===_0xdb27('0x2a');var _0x9971bf=_0x539840[_0xdb27('0x2c')];var _0x192496=_0xe8773b?0x0:_0x2d146c[_0xdb27('0x29')];var _0x30cad=_0xe8773b?_0x539840[_0xdb27('0x2c')]:_0x2d146c[_0xdb27('0x29')]+_0x2d146c['limit'];var _0x3dca5f;if(_0x30cad>=_0x9971bf){_0x30cad=_0x9971bf;_0x3dca5f=0xc8;}else{_0x3dca5f=0xce;}_0x326279[_0xdb27('0x26')](_0x3dca5f);return _0x326279[_0xdb27('0x2d')]('Content-Range',_0x192496+'-'+_0x30cad+'/'+_0x9971bf)[_0xdb27('0x28')](_0x539840);}return null;};}function patchUpdates(_0x3347fc){return function(_0xbfd85c){try{jsonpatch[_0xdb27('0x2e')](_0xbfd85c,_0x3347fc,!![]);}catch(_0x5bdaf0){return BPromise[_0xdb27('0x2f')](_0x5bdaf0);}return _0xbfd85c[_0xdb27('0x30')]();};}function saveUpdates(_0x51bf7e,_0x361ff2){return function(_0x14587e){if(_0x14587e){return _0x14587e[_0xdb27('0x31')](_0x51bf7e)[_0xdb27('0x1c')](function(_0x1be926){return _0x1be926;});}return null;};}function removeEntity(_0x2b83a3,_0x1d83a8){return function(_0x49b5b4){if(_0x49b5b4){return _0x49b5b4[_0xdb27('0x32')]()[_0xdb27('0x1c')](function(){_0x2b83a3[_0xdb27('0x26')](0xcc)[_0xdb27('0x27')]();});}};}function handleEntityNotFound(_0x4fcdbb,_0x285078){return function(_0x4ba191){if(!_0x4ba191){_0x4fcdbb[_0xdb27('0x25')](0x194);}return _0x4ba191;};}function handleError(_0x5d0505,_0x6eed37){_0x6eed37=_0x6eed37||0x1f4;return function(_0x381311){logger['error'](_0x381311[_0xdb27('0x33')]);if(_0x381311['name']){delete _0x381311[_0xdb27('0x34')];}_0x5d0505['status'](_0x6eed37)[_0xdb27('0x35')](_0x381311);};}exports['index']=function(_0x989d2c,_0x4edcb4){var _0x487b0c={},_0x575924={},_0x1673ea={'count':0x0,'rows':[]};var _0x7d116a=_[_0xdb27('0x36')](db[_0xdb27('0x37')]['rawAttributes'],function(_0x309f2d){return{'name':_0x309f2d[_0xdb27('0x38')],'type':_0x309f2d[_0xdb27('0x39')][_0xdb27('0x3a')]};});_0x575924['model']=_[_0xdb27('0x36')](_0x7d116a,'name');_0x575924['query']=_[_0xdb27('0x3b')](_0x989d2c['query']);_0x575924[_0xdb27('0x3c')]=_[_0xdb27('0x3d')](_0x575924[_0xdb27('0x3e')],_0x575924[_0xdb27('0x3f')]);_0x487b0c[_0xdb27('0x40')]=_[_0xdb27('0x3d')](_0x575924[_0xdb27('0x3e')],qs['fields'](_0x989d2c[_0xdb27('0x3f')]['fields']));_0x487b0c[_0xdb27('0x40')]=_0x487b0c['attributes'][_0xdb27('0x41')]?_0x487b0c[_0xdb27('0x40')]:_0x575924[_0xdb27('0x3e')];if(!_0x989d2c[_0xdb27('0x3f')][_0xdb27('0x42')](_0xdb27('0x43'))){_0x487b0c[_0xdb27('0x2b')]=qs[_0xdb27('0x2b')](_0x989d2c[_0xdb27('0x3f')][_0xdb27('0x2b')]);_0x487b0c['offset']=qs[_0xdb27('0x29')](_0x989d2c[_0xdb27('0x3f')][_0xdb27('0x29')]);}_0x487b0c['order']=qs[_0xdb27('0x44')](_0x989d2c['query'][_0xdb27('0x44')]);_0x487b0c[_0xdb27('0x45')]=qs[_0xdb27('0x3c')](_[_0xdb27('0x46')](_0x989d2c[_0xdb27('0x3f')],_0x575924['filters']),_0x7d116a);if(_0x989d2c['query'][_0xdb27('0x47')]){_0x487b0c['where']=_['merge'](_0x487b0c[_0xdb27('0x45')],{'$or':_[_0xdb27('0x36')](_0x7d116a,function(_0xb0ea69){if(_0xb0ea69[_0xdb27('0x39')]!=='VIRTUAL'){var _0x290bce={};_0x290bce[_0xb0ea69[_0xdb27('0x34')]]={'$like':'%'+_0x989d2c[_0xdb27('0x3f')]['filter']+'%'};return _0x290bce;}})});}_0x487b0c=_[_0xdb27('0x48')]({},_0x487b0c,_0x989d2c[_0xdb27('0x49')]);var _0x30fb1e={'where':_0x487b0c['where']};return db[_0xdb27('0x37')][_0xdb27('0x2c')](_0x30fb1e)[_0xdb27('0x1c')](function(_0x246f78){_0x1673ea['count']=_0x246f78;if(_0x989d2c[_0xdb27('0x3f')][_0xdb27('0x4a')]){_0x487b0c[_0xdb27('0x4b')]=[{'all':!![]}];}return db[_0xdb27('0x37')]['findAll'](_0x487b0c);})[_0xdb27('0x1c')](function(_0x37439b){_0x1673ea[_0xdb27('0x4c')]=_0x37439b;return _0x1673ea;})[_0xdb27('0x1c')](respondWithFilteredResult(_0x4edcb4,_0x487b0c))[_0xdb27('0x4d')](handleError(_0x4edcb4,null));};exports[_0xdb27('0x4e')]=function(_0xe58818,_0x465fff){var _0x390532={'raw':![],'where':{'id':_0xe58818[_0xdb27('0x4f')]['id']}},_0x1b9754={};_0x1b9754[_0xdb27('0x3e')]=_[_0xdb27('0x3b')](db[_0xdb27('0x37')][_0xdb27('0x50')]);_0x1b9754[_0xdb27('0x3f')]=_[_0xdb27('0x3b')](_0xe58818[_0xdb27('0x3f')]);_0x1b9754[_0xdb27('0x3c')]=_[_0xdb27('0x3d')](_0x1b9754[_0xdb27('0x3e')],_0x1b9754[_0xdb27('0x3f')]);_0x390532[_0xdb27('0x40')]=_[_0xdb27('0x3d')](_0x1b9754[_0xdb27('0x3e')],qs[_0xdb27('0x51')](_0xe58818[_0xdb27('0x3f')]['fields']));_0x390532[_0xdb27('0x40')]=_0x390532['attributes']['length']?_0x390532[_0xdb27('0x40')]:_0x1b9754[_0xdb27('0x3e')];if(_0xe58818[_0xdb27('0x3f')]['includeAll']){_0x390532['include']=[{'all':!![]}];}_0x390532=_['merge']({},_0x390532,_0xe58818[_0xdb27('0x49')]);return db[_0xdb27('0x37')][_0xdb27('0x52')](_0x390532)[_0xdb27('0x1c')](handleEntityNotFound(_0x465fff,null))[_0xdb27('0x1c')](respondWithResult(_0x465fff,null))[_0xdb27('0x4d')](handleError(_0x465fff,null));};exports['update']=function(_0x367763,_0x5e3cf5){if(_0x367763['body']['id']){delete _0x367763['body']['id'];}return db[_0xdb27('0x37')][_0xdb27('0x52')]({'where':{'id':_0x367763[_0xdb27('0x4f')]['id']}})[_0xdb27('0x1c')](handleEntityNotFound(_0x5e3cf5,null))[_0xdb27('0x1c')](saveUpdates(_0x367763['body'],null))[_0xdb27('0x1c')](respondWithResult(_0x5e3cf5,null))[_0xdb27('0x4d')](handleError(_0x5e3cf5,null));};exports[_0xdb27('0x53')]=function(_0x2afd8f,_0x5846ae,_0x1ddd47){if(_0x2afd8f[_0xdb27('0x54')]&&_0x2afd8f[_0xdb27('0x54')][_0xdb27('0x55')]){_0x2afd8f[_0xdb27('0x56')][_0xdb27('0x57')]=_0x2afd8f[_0xdb27('0x54')][_0xdb27('0x55')];}return db[_0xdb27('0x37')][_0xdb27('0x52')]({'where':{'id':_0x2afd8f['params']['id']}})[_0xdb27('0x1c')](handleEntityNotFound(_0x5846ae,null))['then'](saveUpdates(_0x2afd8f[_0xdb27('0x56')],null))[_0xdb27('0x1c')](respondWithResult(_0x5846ae,null))[_0xdb27('0x4d')](handleError(_0x5846ae,null));};exports['addLogoLogin']=function(_0x2e7f61,_0x509fe3,_0x5ac9bb){if(_0x2e7f61[_0xdb27('0x54')]&&_0x2e7f61[_0xdb27('0x54')]['filename']){_0x2e7f61[_0xdb27('0x56')][_0xdb27('0x58')]=_0x2e7f61[_0xdb27('0x54')][_0xdb27('0x55')];}return db['Setting'][_0xdb27('0x52')]({'where':{'id':_0x2e7f61['params']['id']}})[_0xdb27('0x1c')](handleEntityNotFound(_0x509fe3,null))[_0xdb27('0x1c')](saveUpdates(_0x2e7f61[_0xdb27('0x56')],null))[_0xdb27('0x1c')](respondWithResult(_0x509fe3,null))[_0xdb27('0x4d')](handleError(_0x509fe3,null));};var utilLicense=require('../../config/license/util');exports[_0xdb27('0x59')]=function(_0x2dc483,_0x19d596,_0x56fcb8){var _0xe804d='server/files/images/logos';var _0x32d1d8={'custom':![]};return utilLicense[_0xdb27('0x5a')]()[_0xdb27('0x1c')](function(_0x4ce433){if(_0x4ce433){_0x32d1d8=_0x4ce433;}return db[_0xdb27('0x37')]['find']({'where':{'id':_0x2dc483['params']['id']},'attributes':[_0xdb27('0x57'),_0xdb27('0x58'),_0xdb27('0x5b'),_0xdb27('0x5c'),_0xdb27('0x5d'),_0xdb27('0x5e'),_0xdb27('0x5f'),'defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x19d596,null))[_0xdb27('0x1c')](function(_0x270970){if(_0x270970){var _0x15532a=_0x270970[_0xdb27('0x57')]&&fs[_0xdb27('0x60')](path[_0xdb27('0x61')](config[_0xdb27('0x62')],_0xe804d,_[_0xdb27('0x63')](_0x270970[_0xdb27('0x57')])))?path[_0xdb27('0x61')](config[_0xdb27('0x62')],_0xe804d,_[_0xdb27('0x63')](_0x270970['logo'])):path[_0xdb27('0x61')](config['root'],_0xe804d,_['toLower']('default_logo.svg'));var _0x245b64=_0xdb27('0x64')+_[_0xdb27('0x65')](_0xdb27('0x57'));if(_0x270970[_0x245b64]||!_0x32d1d8['custom']){_0x15532a=path[_0xdb27('0x61')](config[_0xdb27('0x62')],_0xe804d,_['toLower'](_0xdb27('0x66')));}if(!fs[_0xdb27('0x60')](_0x15532a)){throw new db[(_0xdb27('0x67'))]['ValidationError'](_[_0xdb27('0x65')]('logo')+_0xdb27('0x68'));}return _0x19d596[_0xdb27('0x69')](_0x15532a);}})[_0xdb27('0x4d')](handleError(_0x19d596,null));};var utilLicense=require(_0xdb27('0x16'));exports[_0xdb27('0x6a')]=function(_0x1a56a6,_0x1d905e,_0xd3282){var _0x40a569=_0xdb27('0x6b');var _0x218459={'custom':![]};return utilLicense[_0xdb27('0x5a')]()['then'](function(_0x405285){if(_0x405285){_0x218459=_0x405285;}return db['Setting'][_0xdb27('0x52')]({'where':{'id':_0x1a56a6['params']['id']},'attributes':[_0xdb27('0x57'),_0xdb27('0x58'),'preferred',_0xdb27('0x5c'),_0xdb27('0x5d'),_0xdb27('0x5e'),_0xdb27('0x5f'),_0xdb27('0x6c')],'raw':!![]});})[_0xdb27('0x1c')](handleEntityNotFound(_0x1d905e,null))[_0xdb27('0x1c')](function(_0x543546){if(_0x543546){var _0x236c9b=_0x543546['loginLogo']&&fs[_0xdb27('0x60')](path[_0xdb27('0x61')](config[_0xdb27('0x62')],_0x40a569,_[_0xdb27('0x63')](_0x543546[_0xdb27('0x58')])))?path[_0xdb27('0x61')](config[_0xdb27('0x62')],_0x40a569,_[_0xdb27('0x63')](_0x543546['loginLogo'])):path[_0xdb27('0x61')](config[_0xdb27('0x62')],_0x40a569,_[_0xdb27('0x63')](_0xdb27('0x6d')));var _0x1e249e='default'+_[_0xdb27('0x65')](_0xdb27('0x58'));if(_0x543546[_0x1e249e]||!_0x218459[_0xdb27('0x6e')]){_0x236c9b=path[_0xdb27('0x61')](config[_0xdb27('0x62')],_0x40a569,_[_0xdb27('0x63')]('default_loginLogo.svg'));}if(!fs[_0xdb27('0x60')](_0x236c9b)){throw new db['Sequelize']['ValidationError'](_[_0xdb27('0x65')](_0xdb27('0x58'))+_0xdb27('0x68'));}return _0x1d905e[_0xdb27('0x69')](_0x236c9b);}})[_0xdb27('0x4d')](handleError(_0x1d905e,null));};exports[_0xdb27('0x6f')]=function(_0x2f1d3f,_0x556c9b){return db[_0xdb27('0x37')][_0xdb27('0x52')]({'where':{'id':_0x2f1d3f[_0xdb27('0x4f')]['id']},'attributes':['securePassword']})[_0xdb27('0x1c')](respondWithResult(_0x556c9b,null))['catch'](handleError(_0x556c9b,null));};exports['addPreferred']=function(_0x43c589,_0x5173bd,_0x1244f3){if(_0x43c589[_0xdb27('0x54')]&&_0x43c589[_0xdb27('0x54')][_0xdb27('0x55')]){_0x43c589[_0xdb27('0x56')]['preferred']=_0x43c589['file']['filename'];}return db[_0xdb27('0x37')]['find']({'where':{'id':_0x43c589[_0xdb27('0x4f')]['id']}})[_0xdb27('0x1c')](handleEntityNotFound(_0x5173bd,null))[_0xdb27('0x1c')](saveUpdates(_0x43c589[_0xdb27('0x56')],null))['then'](respondWithResult(_0x5173bd,null))[_0xdb27('0x4d')](handleError(_0x5173bd,null));};var utilLicense=require(_0xdb27('0x16'));exports['getPreferred']=function(_0x5d9945,_0x1e5510,_0x4a493b){var _0x3435cb='server/files/images/logos';var _0x35b778={'custom':![]};return utilLicense[_0xdb27('0x5a')]()[_0xdb27('0x1c')](function(_0x55ce51){if(_0x55ce51){_0x35b778=_0x55ce51;}return db['Setting'][_0xdb27('0x52')]({'where':{'id':_0x5d9945[_0xdb27('0x4f')]['id']},'attributes':[_0xdb27('0x57'),_0xdb27('0x58'),'preferred',_0xdb27('0x5c'),'defaultLogo','defaultLoginLogo',_0xdb27('0x5f'),'defaultFavicon'],'raw':!![]});})[_0xdb27('0x1c')](handleEntityNotFound(_0x1e5510,null))[_0xdb27('0x1c')](function(_0x4e0995){if(_0x4e0995){var _0x50bf6e=_0x4e0995[_0xdb27('0x5b')]&&fs[_0xdb27('0x60')](path['join'](config['root'],_0x3435cb,_[_0xdb27('0x63')](_0x4e0995[_0xdb27('0x5b')])))?path[_0xdb27('0x61')](config[_0xdb27('0x62')],_0x3435cb,_[_0xdb27('0x63')](_0x4e0995[_0xdb27('0x5b')])):path[_0xdb27('0x61')](config['root'],_0x3435cb,_[_0xdb27('0x63')](_0xdb27('0x70')));var _0x1f132c=_0xdb27('0x64')+_[_0xdb27('0x65')](_0xdb27('0x5b'));if(_0x4e0995[_0x1f132c]||!_0x35b778[_0xdb27('0x6e')]||!_0x35b778[_0xdb27('0x5b')]){_0x50bf6e=path[_0xdb27('0x61')](config[_0xdb27('0x62')],_0x3435cb,_[_0xdb27('0x63')](_0xdb27('0x70')));}if(!fs['existsSync'](_0x50bf6e)){throw new db['Sequelize'][(_0xdb27('0x71'))](_[_0xdb27('0x65')](_0xdb27('0x5b'))+_0xdb27('0x68'));}return _0x1e5510[_0xdb27('0x69')](_0x50bf6e);}})[_0xdb27('0x4d')](handleError(_0x1e5510,null));};exports[_0xdb27('0x72')]=function(_0x42d911,_0x5e23b7,_0x20a399){if(_0x42d911['file']&&_0x42d911[_0xdb27('0x54')]['filename']){_0x42d911[_0xdb27('0x56')][_0xdb27('0x5c')]=_0x42d911[_0xdb27('0x54')][_0xdb27('0x55')];}return db[_0xdb27('0x37')][_0xdb27('0x52')]({'where':{'id':_0x42d911[_0xdb27('0x4f')]['id']}})[_0xdb27('0x1c')](handleEntityNotFound(_0x5e23b7,null))[_0xdb27('0x1c')](saveUpdates(_0x42d911[_0xdb27('0x56')],null))['then'](respondWithResult(_0x5e23b7,null))[_0xdb27('0x4d')](handleError(_0x5e23b7,null));};var utilLicense=require(_0xdb27('0x16'));exports['getFavicon']=function(_0xed0265,_0x3e612c,_0x2cbb87){var _0x55eb42='server/files/images/logos';var _0x564bcf={'custom':![]};return utilLicense['getLicense']()[_0xdb27('0x1c')](function(_0x4eda33){if(_0x4eda33){_0x564bcf=_0x4eda33;}return db[_0xdb27('0x37')][_0xdb27('0x52')]({'where':{'id':_0xed0265['params']['id']},'attributes':[_0xdb27('0x57'),_0xdb27('0x58'),'preferred',_0xdb27('0x5c'),'defaultLogo',_0xdb27('0x5e'),_0xdb27('0x5f'),_0xdb27('0x6c')],'raw':!![]});})[_0xdb27('0x1c')](handleEntityNotFound(_0x3e612c,null))[_0xdb27('0x1c')](function(_0xca9376){if(_0xca9376){var _0x5189ee=_0xca9376[_0xdb27('0x5c')]&&fs[_0xdb27('0x60')](path['join'](config['root'],_0x55eb42,_['toLower'](_0xca9376[_0xdb27('0x5c')])))?path[_0xdb27('0x61')](config['root'],_0x55eb42,_[_0xdb27('0x63')](_0xca9376[_0xdb27('0x5c')])):path[_0xdb27('0x61')](config[_0xdb27('0x62')],_0x55eb42,_['toLower'](_0xdb27('0x73')));var _0x16d86d=_0xdb27('0x64')+_[_0xdb27('0x65')](_0xdb27('0x5c'));if(_0xca9376[_0x16d86d]||!_0x564bcf[_0xdb27('0x6e')]){_0x5189ee=path[_0xdb27('0x61')](config[_0xdb27('0x62')],_0x55eb42,_[_0xdb27('0x63')](_0xdb27('0x73')));}if(!fs[_0xdb27('0x60')](_0x5189ee)){throw new db['Sequelize'][(_0xdb27('0x71'))](_[_0xdb27('0x65')]('favicon')+_0xdb27('0x68'));}return _0x3e612c[_0xdb27('0x69')](_0x5189ee);}})['catch'](handleError(_0x3e612c,null));};exports[_0xdb27('0x74')]=function(_0x351dd2,_0x37374b){var _0x5b1119={'offset':moment()['utcOffset']()};_0x5b1119['now']=moment()[_0xdb27('0x75')](_0x5b1119[_0xdb27('0x29')])[_0xdb27('0x76')](_0xdb27('0x77'));return _0x37374b[_0xdb27('0x26')](0xc8)['send'](_0x5b1119);}; \ No newline at end of file +var _0xca8d=['util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','client','http','request','then','Setting,\x20%s,\x20%s','Setting,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','sendStatus','end','status','json','offset','limit','undefined','set','Content-Range','apply','reject','save','update','destroy','stack','name','index','map','Setting','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','filter','where','VIRTUAL','merge','count','includeAll','include','rows','keys','options','find','body','params','addLogo','file','filename','logo','addLogoLogin','loginLogo','server/files/images/logos','getLicense','preferred','favicon','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','toLower','root','upperFirst','custom','default_logo.svg','Sequelize','ValidationError','\x20not\x20found','download','getLogoLogin','default_loginLogo.svg','default','gdpr','securePassword','getPreferred','default_preferred.png','addFavicon','getFavicon','defaultLogo','default_favicon.ico','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','send','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x2fdc86,_0x2ec860){var _0x5a3c77=function(_0x21985e){while(--_0x21985e){_0x2fdc86['push'](_0x2fdc86['shift']());}};_0x5a3c77(++_0x2ec860);}(_0xca8d,0x172));var _0xdca8=function(_0x2f4748,_0x24af55){_0x2f4748=_0x2f4748-0x0;var _0x18eece=_0xca8d[_0x2f4748];return _0x18eece;};'use strict';var emlformat=require(_0xdca8('0x0'));var rimraf=require(_0xdca8('0x1'));var zipdir=require(_0xdca8('0x2'));var jsonpatch=require(_0xdca8('0x3'));var rp=require(_0xdca8('0x4'));var moment=require(_0xdca8('0x5'));var BPromise=require(_0xdca8('0x6'));var Mustache=require(_0xdca8('0x7'));var util=require(_0xdca8('0x8'));var path=require(_0xdca8('0x9'));var sox=require(_0xdca8('0xa'));var csv=require(_0xdca8('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdca8('0xc'));var _=require(_0xdca8('0xd'));var squel=require(_0xdca8('0xe'));var crypto=require(_0xdca8('0xf'));var jsforce=require(_0xdca8('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xdca8('0xb'));var querystring=require(_0xdca8('0x11'));var Papa=require(_0xdca8('0x12'));var Redis=require('ioredis');var authService=require(_0xdca8('0x13'));var qs=require(_0xdca8('0x14'));var as=require(_0xdca8('0x15'));var hardwareService=require(_0xdca8('0x16'));var logger=require(_0xdca8('0x17'))(_0xdca8('0x18'));var utils=require(_0xdca8('0x19'));var config=require(_0xdca8('0x1a'));var licenseUtil=require(_0xdca8('0x1b'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0xdca8('0x1c')][_0xdca8('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x25a59c,_0x36012e,_0x30810a,_0x2d1cf3){return new BPromise(function(_0x3ea305,_0x198148){var _0x446974=_0x2d1cf3||client;return _0x446974[_0xdca8('0x1e')](_0x25a59c,_0x30810a)[_0xdca8('0x1f')](function(_0x5100bf){logger['info'](_0xdca8('0x20'),_0x36012e,'request\x20sent');logger['debug'](_0xdca8('0x21'),_0x36012e,'request\x20sent',JSON[_0xdca8('0x22')](_0x5100bf));if(_0x5100bf[_0xdca8('0x23')]){if(_0x5100bf[_0xdca8('0x23')]['code']===0x1f4){logger['error'](_0xdca8('0x20'),_0x36012e,_0x5100bf[_0xdca8('0x23')][_0xdca8('0x24')]);return _0x198148(_0x5100bf[_0xdca8('0x23')]['message']);}logger[_0xdca8('0x23')](_0xdca8('0x20'),_0x36012e,_0x5100bf['error'][_0xdca8('0x24')]);return _0x3ea305(_0x5100bf[_0xdca8('0x23')][_0xdca8('0x24')]);}else{logger['info']('Setting,\x20%s,\x20%s',_0x36012e,_0xdca8('0x25'));_0x3ea305(_0x5100bf[_0xdca8('0x26')][_0xdca8('0x24')]);}})[_0xdca8('0x27')](function(_0x19ce0c){logger[_0xdca8('0x23')](_0xdca8('0x20'),_0x36012e,_0x19ce0c);_0x198148(_0x19ce0c);});});}function respondWithStatusCode(_0x5e0cbb,_0x1e29eb){_0x1e29eb=_0x1e29eb||0xcc;return function(_0x3d013c){if(_0x3d013c){return _0x5e0cbb[_0xdca8('0x28')](_0x1e29eb);}return _0x5e0cbb['status'](_0x1e29eb)[_0xdca8('0x29')]();};}function respondWithResult(_0x1aefbd,_0x52cfcd){_0x52cfcd=_0x52cfcd||0xc8;return function(_0x108ead){if(_0x108ead){return _0x1aefbd[_0xdca8('0x2a')](_0x52cfcd)[_0xdca8('0x2b')](_0x108ead);}};}function respondWithFilteredResult(_0x4228d4,_0x2d9445){return function(_0x261c6c){if(_0x261c6c){var _0x5cbfff=typeof _0x2d9445[_0xdca8('0x2c')]==='undefined'&&typeof _0x2d9445[_0xdca8('0x2d')]===_0xdca8('0x2e');var _0x38d05a=_0x261c6c['count'];var _0x448fa3=_0x5cbfff?0x0:_0x2d9445['offset'];var _0x225fbf=_0x5cbfff?_0x261c6c['count']:_0x2d9445[_0xdca8('0x2c')]+_0x2d9445['limit'];var _0x1fb243;if(_0x225fbf>=_0x38d05a){_0x225fbf=_0x38d05a;_0x1fb243=0xc8;}else{_0x1fb243=0xce;}_0x4228d4['status'](_0x1fb243);return _0x4228d4[_0xdca8('0x2f')](_0xdca8('0x30'),_0x448fa3+'-'+_0x225fbf+'/'+_0x38d05a)[_0xdca8('0x2b')](_0x261c6c);}return null;};}function patchUpdates(_0x5eda19){return function(_0xaa227f){try{jsonpatch[_0xdca8('0x31')](_0xaa227f,_0x5eda19,!![]);}catch(_0xa070f6){return BPromise[_0xdca8('0x32')](_0xa070f6);}return _0xaa227f[_0xdca8('0x33')]();};}function saveUpdates(_0x509cc9,_0x5009bd){return function(_0x1ae002){if(_0x1ae002){return _0x1ae002[_0xdca8('0x34')](_0x509cc9)[_0xdca8('0x1f')](function(_0x2ebf82){return _0x2ebf82;});}return null;};}function removeEntity(_0x485c8b,_0x2974a0){return function(_0x18fd81){if(_0x18fd81){return _0x18fd81[_0xdca8('0x35')]()[_0xdca8('0x1f')](function(){_0x485c8b[_0xdca8('0x2a')](0xcc)[_0xdca8('0x29')]();});}};}function handleEntityNotFound(_0x5458b2,_0x2be4f1){return function(_0x300b24){if(!_0x300b24){_0x5458b2[_0xdca8('0x28')](0x194);}return _0x300b24;};}function handleError(_0x3b61fd,_0x567e33){_0x567e33=_0x567e33||0x1f4;return function(_0x4a5aad){logger['error'](_0x4a5aad[_0xdca8('0x36')]);if(_0x4a5aad[_0xdca8('0x37')]){delete _0x4a5aad[_0xdca8('0x37')];}_0x3b61fd[_0xdca8('0x2a')](_0x567e33)['send'](_0x4a5aad);};}exports[_0xdca8('0x38')]=function(_0x2f962d,_0x28e0f0){var _0x18d2cc={},_0x5c8b40={},_0xdcf5b8={'count':0x0,'rows':[]};var _0x233144=_[_0xdca8('0x39')](db[_0xdca8('0x3a')][_0xdca8('0x3b')],function(_0x4e604c){return{'name':_0x4e604c['fieldName'],'type':_0x4e604c[_0xdca8('0x3c')][_0xdca8('0x3d')]};});_0x5c8b40[_0xdca8('0x3e')]=_['map'](_0x233144,_0xdca8('0x37'));_0x5c8b40[_0xdca8('0x3f')]=_['keys'](_0x2f962d['query']);_0x5c8b40[_0xdca8('0x40')]=_[_0xdca8('0x41')](_0x5c8b40['model'],_0x5c8b40['query']);_0x18d2cc[_0xdca8('0x42')]=_[_0xdca8('0x41')](_0x5c8b40[_0xdca8('0x3e')],qs[_0xdca8('0x43')](_0x2f962d['query'][_0xdca8('0x43')]));_0x18d2cc[_0xdca8('0x42')]=_0x18d2cc[_0xdca8('0x42')][_0xdca8('0x44')]?_0x18d2cc[_0xdca8('0x42')]:_0x5c8b40[_0xdca8('0x3e')];if(!_0x2f962d['query']['hasOwnProperty'](_0xdca8('0x45'))){_0x18d2cc[_0xdca8('0x2d')]=qs['limit'](_0x2f962d[_0xdca8('0x3f')][_0xdca8('0x2d')]);_0x18d2cc[_0xdca8('0x2c')]=qs['offset'](_0x2f962d['query'][_0xdca8('0x2c')]);}_0x18d2cc[_0xdca8('0x46')]=qs[_0xdca8('0x47')](_0x2f962d[_0xdca8('0x3f')][_0xdca8('0x47')]);_0x18d2cc['where']=qs['filters'](_['pick'](_0x2f962d[_0xdca8('0x3f')],_0x5c8b40[_0xdca8('0x40')]),_0x233144);if(_0x2f962d['query'][_0xdca8('0x48')]){_0x18d2cc[_0xdca8('0x49')]=_['merge'](_0x18d2cc[_0xdca8('0x49')],{'$or':_[_0xdca8('0x39')](_0x233144,function(_0x2aad84){if(_0x2aad84['type']!==_0xdca8('0x4a')){var _0x3a00ef={};_0x3a00ef[_0x2aad84[_0xdca8('0x37')]]={'$like':'%'+_0x2f962d[_0xdca8('0x3f')][_0xdca8('0x48')]+'%'};return _0x3a00ef;}})});}_0x18d2cc=_[_0xdca8('0x4b')]({},_0x18d2cc,_0x2f962d['options']);var _0xd9ea85={'where':_0x18d2cc[_0xdca8('0x49')]};return db[_0xdca8('0x3a')][_0xdca8('0x4c')](_0xd9ea85)['then'](function(_0x4d63f6){_0xdcf5b8['count']=_0x4d63f6;if(_0x2f962d[_0xdca8('0x3f')][_0xdca8('0x4d')]){_0x18d2cc[_0xdca8('0x4e')]=[{'all':!![]}];}return db['Setting']['findAll'](_0x18d2cc);})['then'](function(_0xf7613b){_0xdcf5b8[_0xdca8('0x4f')]=_0xf7613b;return _0xdcf5b8;})[_0xdca8('0x1f')](respondWithFilteredResult(_0x28e0f0,_0x18d2cc))[_0xdca8('0x27')](handleError(_0x28e0f0,null));};exports['show']=function(_0x288e9b,_0x23a781){var _0x3708be={'raw':![],'where':{'id':_0x288e9b['params']['id']}},_0x24c11f={};_0x24c11f['model']=_[_0xdca8('0x50')](db['Setting'][_0xdca8('0x3b')]);_0x24c11f[_0xdca8('0x3f')]=_[_0xdca8('0x50')](_0x288e9b[_0xdca8('0x3f')]);_0x24c11f[_0xdca8('0x40')]=_[_0xdca8('0x41')](_0x24c11f[_0xdca8('0x3e')],_0x24c11f[_0xdca8('0x3f')]);_0x3708be['attributes']=_[_0xdca8('0x41')](_0x24c11f[_0xdca8('0x3e')],qs[_0xdca8('0x43')](_0x288e9b[_0xdca8('0x3f')][_0xdca8('0x43')]));_0x3708be[_0xdca8('0x42')]=_0x3708be[_0xdca8('0x42')]['length']?_0x3708be['attributes']:_0x24c11f[_0xdca8('0x3e')];if(_0x288e9b[_0xdca8('0x3f')][_0xdca8('0x4d')]){_0x3708be[_0xdca8('0x4e')]=[{'all':!![]}];}_0x3708be=_[_0xdca8('0x4b')]({},_0x3708be,_0x288e9b[_0xdca8('0x51')]);return db[_0xdca8('0x3a')][_0xdca8('0x52')](_0x3708be)[_0xdca8('0x1f')](handleEntityNotFound(_0x23a781,null))[_0xdca8('0x1f')](respondWithResult(_0x23a781,null))['catch'](handleError(_0x23a781,null));};exports[_0xdca8('0x34')]=function(_0x348bb5,_0x1d15cf){if(_0x348bb5['body']['id']){delete _0x348bb5[_0xdca8('0x53')]['id'];}return db[_0xdca8('0x3a')][_0xdca8('0x52')]({'where':{'id':_0x348bb5[_0xdca8('0x54')]['id']}})[_0xdca8('0x1f')](handleEntityNotFound(_0x1d15cf,null))['then'](saveUpdates(_0x348bb5['body'],null))[_0xdca8('0x1f')](respondWithResult(_0x1d15cf,null))[_0xdca8('0x27')](handleError(_0x1d15cf,null));};exports[_0xdca8('0x55')]=function(_0x4de64e,_0x26172c,_0xbb57ca){if(_0x4de64e['file']&&_0x4de64e[_0xdca8('0x56')][_0xdca8('0x57')]){_0x4de64e['body'][_0xdca8('0x58')]=_0x4de64e['file'][_0xdca8('0x57')];}return db[_0xdca8('0x3a')][_0xdca8('0x52')]({'where':{'id':_0x4de64e[_0xdca8('0x54')]['id']}})[_0xdca8('0x1f')](handleEntityNotFound(_0x26172c,null))[_0xdca8('0x1f')](saveUpdates(_0x4de64e[_0xdca8('0x53')],null))['then'](respondWithResult(_0x26172c,null))[_0xdca8('0x27')](handleError(_0x26172c,null));};exports[_0xdca8('0x59')]=function(_0x334e31,_0x21930e,_0x564b19){if(_0x334e31[_0xdca8('0x56')]&&_0x334e31[_0xdca8('0x56')][_0xdca8('0x57')]){_0x334e31['body'][_0xdca8('0x5a')]=_0x334e31[_0xdca8('0x56')][_0xdca8('0x57')];}return db[_0xdca8('0x3a')]['find']({'where':{'id':_0x334e31['params']['id']}})[_0xdca8('0x1f')](handleEntityNotFound(_0x21930e,null))[_0xdca8('0x1f')](saveUpdates(_0x334e31['body'],null))[_0xdca8('0x1f')](respondWithResult(_0x21930e,null))[_0xdca8('0x27')](handleError(_0x21930e,null));};var utilLicense=require(_0xdca8('0x1b'));exports['getLogo']=function(_0x499f30,_0x46b7ca,_0x26d361){var _0x48170f=_0xdca8('0x5b');var _0x4e4fc4={'custom':![]};return utilLicense[_0xdca8('0x5c')]()[_0xdca8('0x1f')](function(_0x58c143){if(_0x58c143){_0x4e4fc4=_0x58c143;}return db[_0xdca8('0x3a')]['find']({'where':{'id':_0x499f30[_0xdca8('0x54')]['id']},'attributes':['logo',_0xdca8('0x5a'),_0xdca8('0x5d'),_0xdca8('0x5e'),'defaultLogo',_0xdca8('0x5f'),_0xdca8('0x60'),_0xdca8('0x61')],'raw':!![]});})[_0xdca8('0x1f')](handleEntityNotFound(_0x46b7ca,null))[_0xdca8('0x1f')](function(_0xe6ed2e){if(_0xe6ed2e){var _0x55ed43=_0xe6ed2e[_0xdca8('0x58')]&&fs[_0xdca8('0x62')](path[_0xdca8('0x63')](config['root'],_0x48170f,_[_0xdca8('0x64')](_0xe6ed2e[_0xdca8('0x58')])))?path['join'](config[_0xdca8('0x65')],_0x48170f,_[_0xdca8('0x64')](_0xe6ed2e[_0xdca8('0x58')])):path['join'](config[_0xdca8('0x65')],_0x48170f,_[_0xdca8('0x64')]('default_logo.svg'));var _0x218121='default'+_[_0xdca8('0x66')](_0xdca8('0x58'));if(_0xe6ed2e[_0x218121]||!_0x4e4fc4[_0xdca8('0x67')]){_0x55ed43=path[_0xdca8('0x63')](config[_0xdca8('0x65')],_0x48170f,_[_0xdca8('0x64')](_0xdca8('0x68')));}if(!fs[_0xdca8('0x62')](_0x55ed43)){throw new db[(_0xdca8('0x69'))][(_0xdca8('0x6a'))](_[_0xdca8('0x66')](_0xdca8('0x58'))+_0xdca8('0x6b'));}return _0x46b7ca[_0xdca8('0x6c')](_0x55ed43);}})[_0xdca8('0x27')](handleError(_0x46b7ca,null));};var utilLicense=require(_0xdca8('0x1b'));exports[_0xdca8('0x6d')]=function(_0x1055e8,_0xc22a3,_0x47c252){var _0x3d6260=_0xdca8('0x5b');var _0x65cf4d={'custom':![]};return utilLicense[_0xdca8('0x5c')]()['then'](function(_0x4663c3){if(_0x4663c3){_0x65cf4d=_0x4663c3;}return db[_0xdca8('0x3a')]['find']({'where':{'id':_0x1055e8[_0xdca8('0x54')]['id']},'attributes':[_0xdca8('0x58'),_0xdca8('0x5a'),_0xdca8('0x5d'),_0xdca8('0x5e'),'defaultLogo',_0xdca8('0x5f'),_0xdca8('0x60'),_0xdca8('0x61')],'raw':!![]});})[_0xdca8('0x1f')](handleEntityNotFound(_0xc22a3,null))['then'](function(_0x339db6){if(_0x339db6){var _0x511313=_0x339db6[_0xdca8('0x5a')]&&fs[_0xdca8('0x62')](path[_0xdca8('0x63')](config[_0xdca8('0x65')],_0x3d6260,_['toLower'](_0x339db6[_0xdca8('0x5a')])))?path['join'](config[_0xdca8('0x65')],_0x3d6260,_[_0xdca8('0x64')](_0x339db6[_0xdca8('0x5a')])):path[_0xdca8('0x63')](config[_0xdca8('0x65')],_0x3d6260,_[_0xdca8('0x64')](_0xdca8('0x6e')));var _0x42d188=_0xdca8('0x6f')+_[_0xdca8('0x66')](_0xdca8('0x5a'));if(_0x339db6[_0x42d188]||!_0x65cf4d[_0xdca8('0x67')]){_0x511313=path['join'](config[_0xdca8('0x65')],_0x3d6260,_['toLower'](_0xdca8('0x6e')));}if(!fs[_0xdca8('0x62')](_0x511313)){throw new db[(_0xdca8('0x69'))][(_0xdca8('0x6a'))](_[_0xdca8('0x66')]('loginLogo')+_0xdca8('0x6b'));}return _0xc22a3['download'](_0x511313);}})[_0xdca8('0x27')](handleError(_0xc22a3,null));};exports[_0xdca8('0x70')]=function(_0x1d2a87,_0x2eb52a){return db[_0xdca8('0x3a')][_0xdca8('0x52')]({'where':{'id':_0x1d2a87[_0xdca8('0x54')]['id']},'attributes':[_0xdca8('0x71')]})[_0xdca8('0x1f')](respondWithResult(_0x2eb52a,null))[_0xdca8('0x27')](handleError(_0x2eb52a,null));};exports['addPreferred']=function(_0x4ab570,_0x4ee874,_0x32da1d){if(_0x4ab570['file']&&_0x4ab570[_0xdca8('0x56')][_0xdca8('0x57')]){_0x4ab570['body'][_0xdca8('0x5d')]=_0x4ab570['file']['filename'];}return db[_0xdca8('0x3a')][_0xdca8('0x52')]({'where':{'id':_0x4ab570[_0xdca8('0x54')]['id']}})[_0xdca8('0x1f')](handleEntityNotFound(_0x4ee874,null))[_0xdca8('0x1f')](saveUpdates(_0x4ab570[_0xdca8('0x53')],null))[_0xdca8('0x1f')](respondWithResult(_0x4ee874,null))[_0xdca8('0x27')](handleError(_0x4ee874,null));};var utilLicense=require(_0xdca8('0x1b'));exports[_0xdca8('0x72')]=function(_0x46f9a5,_0xae6ecb,_0x5eaecd){var _0x2979e7=_0xdca8('0x5b');var _0x37725d={'custom':![]};return utilLicense[_0xdca8('0x5c')]()[_0xdca8('0x1f')](function(_0x2c77aa){if(_0x2c77aa){_0x37725d=_0x2c77aa;}return db[_0xdca8('0x3a')][_0xdca8('0x52')]({'where':{'id':_0x46f9a5['params']['id']},'attributes':[_0xdca8('0x58'),_0xdca8('0x5a'),_0xdca8('0x5d'),_0xdca8('0x5e'),'defaultLogo','defaultLoginLogo',_0xdca8('0x60'),'defaultFavicon'],'raw':!![]});})[_0xdca8('0x1f')](handleEntityNotFound(_0xae6ecb,null))[_0xdca8('0x1f')](function(_0x13449a){if(_0x13449a){var _0x152713=_0x13449a['preferred']&&fs[_0xdca8('0x62')](path['join'](config[_0xdca8('0x65')],_0x2979e7,_[_0xdca8('0x64')](_0x13449a[_0xdca8('0x5d')])))?path[_0xdca8('0x63')](config[_0xdca8('0x65')],_0x2979e7,_[_0xdca8('0x64')](_0x13449a[_0xdca8('0x5d')])):path[_0xdca8('0x63')](config[_0xdca8('0x65')],_0x2979e7,_[_0xdca8('0x64')](_0xdca8('0x73')));var _0x4f22df=_0xdca8('0x6f')+_['upperFirst'](_0xdca8('0x5d'));if(_0x13449a[_0x4f22df]||!_0x37725d[_0xdca8('0x67')]||!_0x37725d[_0xdca8('0x5d')]){_0x152713=path[_0xdca8('0x63')](config[_0xdca8('0x65')],_0x2979e7,_[_0xdca8('0x64')](_0xdca8('0x73')));}if(!fs[_0xdca8('0x62')](_0x152713)){throw new db['Sequelize']['ValidationError'](_[_0xdca8('0x66')](_0xdca8('0x5d'))+_0xdca8('0x6b'));}return _0xae6ecb['download'](_0x152713);}})['catch'](handleError(_0xae6ecb,null));};exports[_0xdca8('0x74')]=function(_0x4bc7b7,_0x1ed4c8,_0x54b054){if(_0x4bc7b7['file']&&_0x4bc7b7[_0xdca8('0x56')]['filename']){_0x4bc7b7[_0xdca8('0x53')][_0xdca8('0x5e')]=_0x4bc7b7[_0xdca8('0x56')][_0xdca8('0x57')];}return db[_0xdca8('0x3a')][_0xdca8('0x52')]({'where':{'id':_0x4bc7b7[_0xdca8('0x54')]['id']}})['then'](handleEntityNotFound(_0x1ed4c8,null))[_0xdca8('0x1f')](saveUpdates(_0x4bc7b7[_0xdca8('0x53')],null))['then'](respondWithResult(_0x1ed4c8,null))[_0xdca8('0x27')](handleError(_0x1ed4c8,null));};var utilLicense=require('../../config/license/util');exports[_0xdca8('0x75')]=function(_0x3bd34a,_0x47a99b,_0x5a9656){var _0x5d953e=_0xdca8('0x5b');var _0x4e8dcf={'custom':![]};return utilLicense[_0xdca8('0x5c')]()['then'](function(_0x27a347){if(_0x27a347){_0x4e8dcf=_0x27a347;}return db[_0xdca8('0x3a')]['find']({'where':{'id':_0x3bd34a['params']['id']},'attributes':[_0xdca8('0x58'),'loginLogo',_0xdca8('0x5d'),'favicon',_0xdca8('0x76'),_0xdca8('0x5f'),_0xdca8('0x60'),_0xdca8('0x61')],'raw':!![]});})[_0xdca8('0x1f')](handleEntityNotFound(_0x47a99b,null))[_0xdca8('0x1f')](function(_0x2ef679){if(_0x2ef679){var _0x441efe=_0x2ef679[_0xdca8('0x5e')]&&fs['existsSync'](path['join'](config[_0xdca8('0x65')],_0x5d953e,_[_0xdca8('0x64')](_0x2ef679[_0xdca8('0x5e')])))?path[_0xdca8('0x63')](config[_0xdca8('0x65')],_0x5d953e,_['toLower'](_0x2ef679[_0xdca8('0x5e')])):path[_0xdca8('0x63')](config['root'],_0x5d953e,_[_0xdca8('0x64')]('default_favicon.ico'));var _0x7b4a8f=_0xdca8('0x6f')+_[_0xdca8('0x66')](_0xdca8('0x5e'));if(_0x2ef679[_0x7b4a8f]||!_0x4e8dcf[_0xdca8('0x67')]){_0x441efe=path[_0xdca8('0x63')](config[_0xdca8('0x65')],_0x5d953e,_[_0xdca8('0x64')](_0xdca8('0x77')));}if(!fs['existsSync'](_0x441efe)){throw new db['Sequelize'][(_0xdca8('0x6a'))](_[_0xdca8('0x66')](_0xdca8('0x5e'))+_0xdca8('0x6b'));}return _0x47a99b[_0xdca8('0x6c')](_0x441efe);}})[_0xdca8('0x27')](handleError(_0x47a99b,null));};exports[_0xdca8('0x78')]=function(_0x304441,_0x45ebbf){var _0x2da0d4={'offset':moment()[_0xdca8('0x79')]()};_0x2da0d4[_0xdca8('0x7a')]=moment()[_0xdca8('0x79')](_0x2da0d4[_0xdca8('0x2c')])[_0xdca8('0x7b')](_0xdca8('0x7c'));return _0x45ebbf[_0xdca8('0x2a')](0xc8)[_0xdca8('0x7d')](_0x2da0d4);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 87ba6ee..4a1403d 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 _0x34e8=['settings','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./setting.attributes','exports','Setting'];(function(_0x16da3f,_0x512891){var _0x63723d=function(_0x54b49c){while(--_0x54b49c){_0x16da3f['push'](_0x16da3f['shift']());}};_0x63723d(++_0x512891);}(_0x34e8,0x12c));var _0x834e=function(_0x4b3ec8,_0x1c1f96){_0x4b3ec8=_0x4b3ec8-0x0;var _0x2ea0c9=_0x34e8[_0x4b3ec8];return _0x2ea0c9;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var logger=require(_0x834e('0x2'))(_0x834e('0x3'));var moment=require('moment');var BPromise=require(_0x834e('0x4'));var rp=require(_0x834e('0x5'));var fs=require('fs');var path=require(_0x834e('0x6'));var rimraf=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var attributes=require(_0x834e('0x9'));module[_0x834e('0xa')]=function(_0x4a2018,_0x858aa1){return _0x4a2018['define'](_0x834e('0xb'),attributes,{'tableName':_0x834e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./setting.attributes','exports','Setting','util'];(function(_0x44d78d,_0xe65bad){var _0x3e7333=function(_0x5217c4){while(--_0x5217c4){_0x44d78d['push'](_0x44d78d['shift']());}};_0x3e7333(++_0xe65bad);}(_0xedd9,0xfc));var _0x9edd=function(_0x4294ad,_0x3fc48b){_0x4294ad=_0x4294ad-0x0;var _0x3c230a=_0xedd9[_0x4294ad];return _0x3c230a;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 6bf99f4..9f99b30 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 _0xaf05=['request','then','Setting,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','ShowSetting','Setting','find','options','raw','attributes','include','map','model','randomstring','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0xaf05,0x14c));var _0x5af0=function(_0x581204,_0x2a4679){_0x581204=_0x581204-0x0;var _0x527ec2=_0xaf05[_0x581204];return _0x527ec2;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5af0('0x0'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5af0('0x1'))('rpc');var config=require(_0x5af0('0x2'));var jayson=require(_0x5af0('0x3'));var client=jayson[_0x5af0('0x4')][_0x5af0('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x5d2e0c,_0x4dcb23,_0x2f5b9d){return new BPromise(function(_0x44475,_0x546e7e){return client[_0x5af0('0x6')](_0x5d2e0c,_0x2f5b9d)[_0x5af0('0x7')](function(_0x51b5ef){logger['info'](_0x5af0('0x8'),_0x4dcb23,_0x5af0('0x9'));logger[_0x5af0('0xa')]('Setting,\x20%s,\x20%s,\x20%s',_0x4dcb23,_0x5af0('0x9'),JSON[_0x5af0('0xb')](_0x51b5ef));if(_0x51b5ef[_0x5af0('0xc')]){if(_0x51b5ef[_0x5af0('0xc')][_0x5af0('0xd')]===0x1f4){logger[_0x5af0('0xc')](_0x5af0('0x8'),_0x4dcb23,_0x51b5ef[_0x5af0('0xc')][_0x5af0('0xe')]);return _0x546e7e(_0x51b5ef['error']['message']);}logger[_0x5af0('0xc')]('Setting,\x20%s,\x20%s',_0x4dcb23,_0x51b5ef[_0x5af0('0xc')][_0x5af0('0xe')]);return _0x44475(_0x51b5ef[_0x5af0('0xc')][_0x5af0('0xe')]);}else{logger[_0x5af0('0xf')](_0x5af0('0x8'),_0x4dcb23,_0x5af0('0x9'));_0x44475(_0x51b5ef['result'][_0x5af0('0xe')]);}})[_0x5af0('0x10')](function(_0x2214bd){logger[_0x5af0('0xc')](_0x5af0('0x8'),_0x4dcb23,_0x2214bd);_0x546e7e(_0x2214bd);});});}exports[_0x5af0('0x11')]=function(_0x6e6883){var _0x4d7f52=this;return new Promise(function(_0x59c6b8,_0x29e8ef){return db[_0x5af0('0x12')][_0x5af0('0x13')]({'raw':_0x6e6883[_0x5af0('0x14')]?_0x6e6883[_0x5af0('0x14')][_0x5af0('0x15')]===undefined?!![]:![]:!![],'where':_0x6e6883[_0x5af0('0x14')]?_0x6e6883[_0x5af0('0x14')]['where']||null:null,'attributes':_0x6e6883['options']?_0x6e6883[_0x5af0('0x14')][_0x5af0('0x16')]||null:null,'include':_0x6e6883[_0x5af0('0x14')]?_0x6e6883[_0x5af0('0x14')][_0x5af0('0x17')]?_[_0x5af0('0x18')](_0x6e6883[_0x5af0('0x14')][_0x5af0('0x17')],function(_0x16f88c){return{'model':db[_0x16f88c[_0x5af0('0x19')]],'as':_0x16f88c['as'],'attributes':_0x16f88c['attributes'],'include':_0x16f88c[_0x5af0('0x17')]?_[_0x5af0('0x18')](_0x16f88c[_0x5af0('0x17')],function(_0x17b119){return{'model':db[_0x17b119[_0x5af0('0x19')]],'as':_0x17b119['as'],'attributes':_0x17b119[_0x5af0('0x16')],'include':_0x17b119[_0x5af0('0x17')]?_[_0x5af0('0x18')](_0x17b119[_0x5af0('0x17')],function(_0x5eaa8d){return{'model':db[_0x5eaa8d['model']],'as':_0x5eaa8d['as'],'attributes':_0x5eaa8d[_0x5af0('0x16')]};}):[]};}):[]};}):[]:[]})[_0x5af0('0x7')](function(_0x671a17){logger[_0x5af0('0xf')](_0x5af0('0x11'),_0x6e6883);logger[_0x5af0('0xa')]('ShowSetting',_0x6e6883,JSON[_0x5af0('0xb')](_0x671a17));_0x59c6b8(_0x671a17);})[_0x5af0('0x10')](function(_0x2c515e){logger[_0x5af0('0xc')](_0x5af0('0x11'),_0x2c515e[_0x5af0('0xe')],_0x6e6883);_0x29e8ef(_0x4d7f52['error'](0x1f4,_0x2c515e[_0x5af0('0xe')]));});});}; \ No newline at end of file +var _0x4394=['client','request','info','Setting,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','ShowSetting','find','raw','options','attributes','include','map','model','then','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment'];(function(_0x5a2c8b,_0x35ba5d){var _0x388597=function(_0x3c254e){while(--_0x3c254e){_0x5a2c8b['push'](_0x5a2c8b['shift']());}};_0x388597(++_0x35ba5d);}(_0x4394,0x1c8));var _0x4439=function(_0x46ec32,_0x1e842f){_0x46ec32=_0x46ec32-0x0;var _0x338f60=_0x4394[_0x46ec32];return _0x338f60;};'use strict';var _=require(_0x4439('0x0'));var util=require('util');var moment=require(_0x4439('0x1'));var BPromise=require(_0x4439('0x2'));var rs=require(_0x4439('0x3'));var fs=require('fs');var Redis=require(_0x4439('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4439('0x5'));var logger=require(_0x4439('0x6'))('rpc');var config=require(_0x4439('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4439('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x553767,_0xf89155,_0x43fe31){return new BPromise(function(_0x1bd017,_0x703317){return client[_0x4439('0x9')](_0x553767,_0x43fe31)['then'](function(_0x108f38){logger[_0x4439('0xa')](_0x4439('0xb'),_0xf89155,'request\x20sent');logger[_0x4439('0xc')]('Setting,\x20%s,\x20%s,\x20%s',_0xf89155,_0x4439('0xd'),JSON[_0x4439('0xe')](_0x108f38));if(_0x108f38[_0x4439('0xf')]){if(_0x108f38[_0x4439('0xf')][_0x4439('0x10')]===0x1f4){logger[_0x4439('0xf')](_0x4439('0xb'),_0xf89155,_0x108f38[_0x4439('0xf')][_0x4439('0x11')]);return _0x703317(_0x108f38[_0x4439('0xf')][_0x4439('0x11')]);}logger['error'](_0x4439('0xb'),_0xf89155,_0x108f38[_0x4439('0xf')][_0x4439('0x11')]);return _0x1bd017(_0x108f38['error'][_0x4439('0x11')]);}else{logger[_0x4439('0xa')](_0x4439('0xb'),_0xf89155,_0x4439('0xd'));_0x1bd017(_0x108f38[_0x4439('0x12')]['message']);}})[_0x4439('0x13')](function(_0x384351){logger[_0x4439('0xf')](_0x4439('0xb'),_0xf89155,_0x384351);_0x703317(_0x384351);});});}exports[_0x4439('0x14')]=function(_0x552102){var _0x5f4271=this;return new Promise(function(_0x41d8f8,_0x295806){return db['Setting'][_0x4439('0x15')]({'raw':_0x552102['options']?_0x552102['options'][_0x4439('0x16')]===undefined?!![]:![]:!![],'where':_0x552102[_0x4439('0x17')]?_0x552102[_0x4439('0x17')]['where']||null:null,'attributes':_0x552102[_0x4439('0x17')]?_0x552102['options'][_0x4439('0x18')]||null:null,'include':_0x552102['options']?_0x552102['options'][_0x4439('0x19')]?_[_0x4439('0x1a')](_0x552102[_0x4439('0x17')]['include'],function(_0x3d7b13){return{'model':db[_0x3d7b13['model']],'as':_0x3d7b13['as'],'attributes':_0x3d7b13[_0x4439('0x18')],'include':_0x3d7b13['include']?_[_0x4439('0x1a')](_0x3d7b13['include'],function(_0x2e9672){return{'model':db[_0x2e9672[_0x4439('0x1b')]],'as':_0x2e9672['as'],'attributes':_0x2e9672[_0x4439('0x18')],'include':_0x2e9672['include']?_[_0x4439('0x1a')](_0x2e9672[_0x4439('0x19')],function(_0x38934c){return{'model':db[_0x38934c[_0x4439('0x1b')]],'as':_0x38934c['as'],'attributes':_0x38934c[_0x4439('0x18')]};}):[]};}):[]};}):[]:[]})[_0x4439('0x1c')](function(_0x51b98d){logger[_0x4439('0xa')](_0x4439('0x14'),_0x552102);logger[_0x4439('0xc')](_0x4439('0x14'),_0x552102,JSON[_0x4439('0xe')](_0x51b98d));_0x41d8f8(_0x51b98d);})[_0x4439('0x13')](function(_0x2c37d3){logger[_0x4439('0xf')](_0x4439('0x14'),_0x2c37d3['message'],_0x552102);_0x295806(_0x5f4271['error'](0x1f4,_0x2c37d3[_0x4439('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index e473f2c..c003044 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 _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(_0x61bb05,_0x47421f){var _0x3ceb3e=function(_0x54b8f7){while(--_0x54b8f7){_0x61bb05['push'](_0x61bb05['shift']());}};_0x3ceb3e(++_0x47421f);}(_0x814b,0x1a2));var _0xb814=function(_0x89a001,_0x3a9a8c){_0x89a001=_0x89a001-0x0;var _0x5f3ec2=_0x814b[_0x89a001];return _0x5f3ec2;};'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 +var _0x9957=['getInteractions','statusGet','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','addApplications','/:id/status','status','addAgents','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications','/:id/interactions'];(function(_0xe4034a,_0x3459b2){var _0x189750=function(_0x2d32ce){while(--_0x2d32ce){_0xe4034a['push'](_0xe4034a['shift']());}};_0x189750(++_0x3459b2);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/canned_answers',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x9')](_0x7995('0x14'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router['get']('/:id/status',controller[_0x7995('0x16')]);router[_0x7995('0x9')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x1a')]);router['post'](_0x7995('0xf'),auth['isAuthenticated'](),controller[_0x7995('0x1b')]);router[_0x7995('0x19')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router[_0x7995('0x19')]('/:id/notify',controller['notify']);router[_0x7995('0x19')]('/:id/applications',auth['isAuthenticated'](),controller[_0x7995('0x1e')]);router[_0x7995('0x19')]('/:id/send',auth[_0x7995('0xa')](),controller['send']);router['post'](_0x7995('0x1f'),controller[_0x7995('0x20')]);router[_0x7995('0x19')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x21')]);router['put'](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x23')]);router[_0x7995('0x24')](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x25')]);router[_0x7995('0x24')]('/:id/dispositions',auth[_0x7995('0xa')](),controller[_0x7995('0x26')]);router[_0x7995('0x24')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x27')]);router['delete'](_0x7995('0x17'),auth['isAuthenticated'](),controller[_0x7995('0x28')]);module[_0x7995('0x29')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index e6e5e6a..85e0936 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 _0x946f=['ENUM','twilio','plivo','clickatell','bandwidth','csc','infobip','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','sequelize','randomstring','STRING','generate'];(function(_0x1f5767,_0x7f1103){var _0x4d24ac=function(_0x5453b3){while(--_0x5453b3){_0x1f5767['push'](_0x1f5767['shift']());}};_0x4d24ac(++_0x7f1103);}(_0x946f,0x188));var _0xf946=function(_0x2ccc56,_0x5b5ede){_0x2ccc56=_0x2ccc56-0x0;var _0x4cccc5=_0x946f[_0x2ccc56];return _0x4cccc5;};'use strict';var Sequelize=require(_0xf946('0x0'));var rs=require(_0xf946('0x1'));module['exports']={'name':{'type':Sequelize[_0xf946('0x2')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0xf946('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0xf946('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0xf946('0x2')],'defaultValue':function(){return rs[_0xf946('0x3')]();}},'phone':{'type':Sequelize[_0xf946('0x2')]},'type':{'type':Sequelize[_0xf946('0x4')](_0xf946('0x5'),'skebby','connectel','clicksend',_0xf946('0x6'),_0xf946('0x7'),_0xf946('0x8'),_0xf946('0x9'),_0xf946('0xa'),'intelepeer')},'accountSid':{'type':Sequelize[_0xf946('0x2')]},'authId':{'type':Sequelize[_0xf946('0x2')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize[_0xf946('0x4')]('SI','TI','GP')},'username':{'type':Sequelize[_0xf946('0x2')]},'password':{'type':Sequelize[_0xf946('0x2')]},'apiKey':{'type':Sequelize[_0xf946('0x2')]},'applicationId':{'type':Sequelize[_0xf946('0x2')]},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0xf946('0x2')]},'notificationTemplate':{'type':Sequelize[_0xf946('0xb')],'defaultValue':function(){return _0xf946('0xc');}},'notificationSound':{'type':Sequelize[_0xf946('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xf946('0xd')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xf946('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xf946('0xd')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xf946('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xf946('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xf946('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xf946('0xf')},'mandatoryDisposition':{'type':Sequelize[_0xf946('0xd')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x4c2eba){if(!_0x4c2eba)this[_0xf946('0x10')](_0xf946('0x11'),null);this['setDataValue']('mandatoryDisposition',_0x4c2eba);}}}; \ No newline at end of file +var _0x34cd=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','ENUM','twilio','connectel','plivo','clickatell','csc','infobip','intelepeer','TEXT','BOOLEAN','INTEGER'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x34cd,0x193));var _0xd34c=function(_0x171156,_0xc03ed6){_0x171156=_0x171156-0x0;var _0x1def43=_0x34cd[_0x171156];return _0x1def43;};'use strict';var Sequelize=require(_0xd34c('0x0'));var rs=require(_0xd34c('0x1'));module[_0xd34c('0x2')]={'name':{'type':Sequelize[_0xd34c('0x3')],'unique':_0xd34c('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0xd34c('0x3')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0xd34c('0x3')],'defaultValue':function(){return rs[_0xd34c('0x5')]();}},'phone':{'type':Sequelize[_0xd34c('0x3')]},'type':{'type':Sequelize[_0xd34c('0x6')](_0xd34c('0x7'),'skebby',_0xd34c('0x8'),'clicksend',_0xd34c('0x9'),_0xd34c('0xa'),'bandwidth',_0xd34c('0xb'),_0xd34c('0xc'),_0xd34c('0xd'))},'accountSid':{'type':Sequelize[_0xd34c('0x3')]},'authId':{'type':Sequelize[_0xd34c('0x3')]},'authToken':{'type':Sequelize[_0xd34c('0x3')]},'smsMethod':{'type':Sequelize[_0xd34c('0x6')]('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xd34c('0x3')]},'apiKey':{'type':Sequelize[_0xd34c('0x3')]},'applicationId':{'type':Sequelize['STRING']},'accountId':{'type':Sequelize[_0xd34c('0x3')]},'senderString':{'type':Sequelize[_0xd34c('0x3')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0xd34c('0x3')]},'notificationTemplate':{'type':Sequelize[_0xd34c('0xe')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xd34c('0xf')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xd34c('0xf')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xd34c('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xd34c('0xf')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xd34c('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xd34c('0xf')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xd34c('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xd34c('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xd34c('0x11')},'mandatoryDisposition':{'type':Sequelize[_0xd34c('0xf')],'defaultValue':![],'comment':_0xd34c('0x12'),'set':function(_0x35e826){if(!_0x35e826)this[_0xd34c('0x13')]('mandatoryDispositionPauseId',null);this['setDataValue'](_0xd34c('0x14'),_0x35e826);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 5680200..9d48bd5 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 _0xbd7b=['UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','SmsAccount','rawAttributes','key','map','query','keys','intersection','fields','attributes','length','model','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','catch','params','include','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','SmsAccountId','getDispositions','findOne','Disposition','hasOwnProperty','findAll','rows','ids','addAnswer','CannedAnswer','removeAnswers','notify','Applications','orderBy','asc','account','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','type','twilio','from','From','messageId','MessageSid','skebby','sender','connectel','clicksend','message_id','plivo','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','text','bandwidth','intelepeer','isNil','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','CmContact','Contacts','list','omit','defaults','SmsInteraction','spread','interaction','created','autoclose','applications','push','close','*,*,*,*','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','Start','startRouting','SmsAccount,\x20%s,\x20%s,\x20%s','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','addApplications','sequelize','READ_COMMITTED','SmsApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','getInteractions','Contact','fullname','internal','Tag','color','tag','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','List','DESC','out','SmsMessage','dataValues','Messages','inspect','skebby_dispatch_id','requestid','statusInt','status_code','groupName','DELIVERED','redif','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','ACCEPTD','message-id','state','addAgents','emit','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','http','info','debug','request\x20sent','stringify','error','code','message','SmsAccount,\x20%s,\x20%s','result','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy'];(function(_0x5138a5,_0x3985e0){var _0x5496ac=function(_0x4acac9){while(--_0x4acac9){_0x5138a5['push'](_0x5138a5['shift']());}};_0x5496ac(++_0x3985e0);}(_0xbd7b,0xa9));var _0xbbd7=function(_0x496333,_0x1c47d6){_0x496333=_0x496333-0x0;var _0x44256e=_0xbd7b[_0x496333];return _0x44256e;};'use strict';var emlformat=require(_0xbbd7('0x0'));var rimraf=require(_0xbbd7('0x1'));var zipdir=require(_0xbbd7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbbd7('0x3'));var moment=require('moment');var BPromise=require(_0xbbd7('0x4'));var Mustache=require(_0xbbd7('0x5'));var util=require(_0xbbd7('0x6'));var path=require(_0xbbd7('0x7'));var sox=require('sox');var csv=require(_0xbbd7('0x8'));var ejs=require(_0xbbd7('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbbd7('0xa'));var squel=require('squel');var crypto=require(_0xbbd7('0xb'));var jsforce=require(_0xbbd7('0xc'));var deskjs=require(_0xbbd7('0xd'));var toCsv=require(_0xbbd7('0x8'));var querystring=require(_0xbbd7('0xe'));var Papa=require(_0xbbd7('0xf'));var Redis=require(_0xbbd7('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xbbd7('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xbbd7('0x12'))(_0xbbd7('0x13'));var utils=require(_0xbbd7('0x14'));var config=require(_0xbbd7('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xbbd7('0x16'))['db'];config[_0xbbd7('0x17')]=_['defaults'](config[_0xbbd7('0x17')],{'host':_0xbbd7('0x18'),'port':0x18eb});var socket=require(_0xbbd7('0x19'))(new Redis(config[_0xbbd7('0x17')]));require(_0xbbd7('0x1a'))[_0xbbd7('0x1b')](socket);var jayson=require(_0xbbd7('0x1c'));var client=jayson[_0xbbd7('0x1d')][_0xbbd7('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x404a55,_0x475f02,_0xafbf91,_0x3000f6){return new BPromise(function(_0x1953f3,_0x55a58f){var _0x1dea06=_0x3000f6||client;return _0x1dea06['request'](_0x404a55,_0xafbf91)['then'](function(_0x207d38){logger[_0xbbd7('0x1f')]('SmsAccount,\x20%s,\x20%s',_0x475f02,'request\x20sent');logger[_0xbbd7('0x20')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x475f02,_0xbbd7('0x21'),JSON[_0xbbd7('0x22')](_0x207d38));if(_0x207d38['error']){if(_0x207d38[_0xbbd7('0x23')][_0xbbd7('0x24')]===0x1f4){logger[_0xbbd7('0x23')]('SmsAccount,\x20%s,\x20%s',_0x475f02,_0x207d38[_0xbbd7('0x23')][_0xbbd7('0x25')]);return _0x55a58f(_0x207d38[_0xbbd7('0x23')]['message']);}logger[_0xbbd7('0x23')](_0xbbd7('0x26'),_0x475f02,_0x207d38[_0xbbd7('0x23')][_0xbbd7('0x25')]);return _0x1953f3(_0x207d38[_0xbbd7('0x23')]['message']);}else{logger[_0xbbd7('0x1f')](_0xbbd7('0x26'),_0x475f02,'request\x20sent');_0x1953f3(_0x207d38[_0xbbd7('0x27')][_0xbbd7('0x25')]);}})['catch'](function(_0x3f9528){logger[_0xbbd7('0x23')]('SmsAccount,\x20%s,\x20%s',_0x475f02,_0x3f9528);_0x55a58f(_0x3f9528);});});}function respondWithStatusCode(_0x296aec,_0x5939f5){_0x5939f5=_0x5939f5||0xcc;return function(_0x4c9b07){if(_0x4c9b07){return _0x296aec[_0xbbd7('0x28')](_0x5939f5);}return _0x296aec[_0xbbd7('0x29')](_0x5939f5)[_0xbbd7('0x2a')]();};}function respondWithResult(_0xb783ab,_0x176054){_0x176054=_0x176054||0xc8;return function(_0x2f5b95){if(_0x2f5b95){return _0xb783ab[_0xbbd7('0x29')](_0x176054)[_0xbbd7('0x2b')](_0x2f5b95);}};}function respondWithFilteredResult(_0x445dca,_0x5c8083){return function(_0x40cfcf){if(_0x40cfcf){var _0x32c070=typeof _0x5c8083[_0xbbd7('0x2c')]===_0xbbd7('0x2d')&&typeof _0x5c8083[_0xbbd7('0x2e')]===_0xbbd7('0x2d');var _0xa4d487=_0x40cfcf[_0xbbd7('0x2f')];var _0x36b809=_0x32c070?0x0:_0x5c8083[_0xbbd7('0x2c')];var _0x3df72f=_0x32c070?_0x40cfcf[_0xbbd7('0x2f')]:_0x5c8083[_0xbbd7('0x2c')]+_0x5c8083[_0xbbd7('0x2e')];var _0x24c218;if(_0x3df72f>=_0xa4d487){_0x3df72f=_0xa4d487;_0x24c218=0xc8;}else{_0x24c218=0xce;}_0x445dca[_0xbbd7('0x29')](_0x24c218);return _0x445dca[_0xbbd7('0x30')](_0xbbd7('0x31'),_0x36b809+'-'+_0x3df72f+'/'+_0xa4d487)[_0xbbd7('0x2b')](_0x40cfcf);}return null;};}function patchUpdates(_0x14d24b){return function(_0x3dfc04){try{jsonpatch[_0xbbd7('0x32')](_0x3dfc04,_0x14d24b,!![]);}catch(_0xebfe94){return BPromise[_0xbbd7('0x33')](_0xebfe94);}return _0x3dfc04['save']();};}function saveUpdates(_0x47d010,_0x1c6e56){return function(_0x453357){if(_0x453357){return _0x453357[_0xbbd7('0x34')](_0x47d010)[_0xbbd7('0x35')](function(_0x3144ad){return _0x3144ad;});}return null;};}function removeEntity(_0x3720f0,_0x42fa92){return function(_0x5e620e){if(_0x5e620e){return _0x5e620e[_0xbbd7('0x36')]()['then'](function(){var _0x2b7501=_0x5e620e['get']({'plain':!![]});var _0x2d407a='SmsAccounts';return db[_0xbbd7('0x37')]['destroy']({'where':{'type':_0x2d407a,'resourceId':_0x2b7501['id']}})[_0xbbd7('0x35')](function(){return _0x5e620e;});})[_0xbbd7('0x35')](function(){_0x3720f0[_0xbbd7('0x29')](0xcc)[_0xbbd7('0x2a')]();});}};}function handleEntityNotFound(_0x285e51,_0xf68893){return function(_0x4cc805){if(!_0x4cc805){_0x285e51['sendStatus'](0x194);}return _0x4cc805;};}function handleError(_0x213adf,_0x2f3d42){_0x2f3d42=_0x2f3d42||0x1f4;return function(_0xf0293e){logger[_0xbbd7('0x23')](_0xf0293e[_0xbbd7('0x38')]);if(_0xf0293e[_0xbbd7('0x39')]){delete _0xf0293e['name'];}_0x213adf['status'](_0x2f3d42)[_0xbbd7('0x3a')](_0xf0293e);};}exports[_0xbbd7('0x3b')]=function(_0x2ceb2d,_0xe9b4af){var _0x6a5b47={'include':[{'model':db[_0xbbd7('0x3c')],'as':_0xbbd7('0x3d')}]},_0x13861c={},_0x559d98={'count':0x0,'rows':[]};var _0x3a3ecb=_['map'](db[_0xbbd7('0x3e')][_0xbbd7('0x3f')],function(_0x645c43){return{'name':_0x645c43['fieldName'],'type':_0x645c43['type'][_0xbbd7('0x40')]};});_0x13861c['model']=_[_0xbbd7('0x41')](_0x3a3ecb,_0xbbd7('0x39'));_0x13861c[_0xbbd7('0x42')]=_[_0xbbd7('0x43')](_0x2ceb2d[_0xbbd7('0x42')]);_0x13861c['filters']=_[_0xbbd7('0x44')](_0x13861c['model'],_0x13861c[_0xbbd7('0x42')]);_0x6a5b47['attributes']=_['intersection'](_0x13861c['model'],qs[_0xbbd7('0x45')](_0x2ceb2d['query']['fields']));_0x6a5b47[_0xbbd7('0x46')]=_0x6a5b47['attributes'][_0xbbd7('0x47')]?_0x6a5b47['attributes']:_0x13861c[_0xbbd7('0x48')];if(!_0x2ceb2d[_0xbbd7('0x42')]['hasOwnProperty'](_0xbbd7('0x49'))){_0x6a5b47['limit']=qs['limit'](_0x2ceb2d[_0xbbd7('0x42')]['limit']);_0x6a5b47[_0xbbd7('0x2c')]=qs[_0xbbd7('0x2c')](_0x2ceb2d[_0xbbd7('0x42')]['offset']);}_0x6a5b47[_0xbbd7('0x4a')]=qs[_0xbbd7('0x4b')](_0x2ceb2d[_0xbbd7('0x42')][_0xbbd7('0x4b')]);_0x6a5b47[_0xbbd7('0x4c')]=qs[_0xbbd7('0x4d')](_[_0xbbd7('0x4e')](_0x2ceb2d['query'],_0x13861c[_0xbbd7('0x4d')]),_0x3a3ecb);if(_0x2ceb2d[_0xbbd7('0x42')][_0xbbd7('0x4f')]){_0x6a5b47[_0xbbd7('0x4c')]=_[_0xbbd7('0x50')](_0x6a5b47[_0xbbd7('0x4c')],{'$or':_[_0xbbd7('0x41')](_0x3a3ecb,function(_0x1bbe2b){if(_0x1bbe2b['type']!=='VIRTUAL'){var _0x51080e={};_0x51080e[_0x1bbe2b['name']]={'$like':'%'+_0x2ceb2d[_0xbbd7('0x42')][_0xbbd7('0x4f')]+'%'};return _0x51080e;}})});}_0x6a5b47=_['merge']({},_0x6a5b47,_0x2ceb2d[_0xbbd7('0x51')]);var _0x5cb8f5={'where':_0x6a5b47['where']};return db[_0xbbd7('0x3e')][_0xbbd7('0x2f')](_0x5cb8f5)[_0xbbd7('0x35')](function(_0x351c4c){_0x559d98[_0xbbd7('0x2f')]=_0x351c4c;if(_0x2ceb2d[_0xbbd7('0x42')][_0xbbd7('0x52')]){_0x6a5b47['include']=[{'all':!![]}];}return db['SmsAccount']['findAll'](_0x6a5b47);})['then'](function(_0x407834){_0x559d98['rows']=_0x407834;return _0x559d98;})['then'](respondWithFilteredResult(_0xe9b4af,_0x6a5b47))[_0xbbd7('0x53')](handleError(_0xe9b4af,null));};exports['show']=function(_0x3728bb,_0x287de4){var _0x4765f4={'raw':![],'where':{'id':_0x3728bb[_0xbbd7('0x54')]['id']},'include':[{'model':db[_0xbbd7('0x3c')],'as':_0xbbd7('0x3d')}]},_0x225fcf={};_0x225fcf['model']=_['keys'](db[_0xbbd7('0x3e')][_0xbbd7('0x3f')]);_0x225fcf[_0xbbd7('0x42')]=_['keys'](_0x3728bb['query']);_0x225fcf[_0xbbd7('0x4d')]=_['intersection'](_0x225fcf['model'],_0x225fcf[_0xbbd7('0x42')]);_0x4765f4['attributes']=_[_0xbbd7('0x44')](_0x225fcf[_0xbbd7('0x48')],qs[_0xbbd7('0x45')](_0x3728bb['query'][_0xbbd7('0x45')]));_0x4765f4['attributes']=_0x4765f4[_0xbbd7('0x46')][_0xbbd7('0x47')]?_0x4765f4[_0xbbd7('0x46')]:_0x225fcf[_0xbbd7('0x48')];if(_0x3728bb[_0xbbd7('0x42')][_0xbbd7('0x52')]){_0x4765f4[_0xbbd7('0x55')]=[{'all':!![]}];}_0x4765f4=_['merge']({},_0x4765f4,_0x3728bb[_0xbbd7('0x51')]);return db[_0xbbd7('0x3e')][_0xbbd7('0x56')](_0x4765f4)[_0xbbd7('0x35')](handleEntityNotFound(_0x287de4,null))[_0xbbd7('0x35')](respondWithResult(_0x287de4,null))['catch'](handleError(_0x287de4,null));};exports['create']=function(_0x19710f,_0x303328){return db[_0xbbd7('0x3e')][_0xbbd7('0x57')](_0x19710f['body'],{})[_0xbbd7('0x35')](function(_0xa76d0e){var _0x34fb72=_0x19710f[_0xbbd7('0x58')][_0xbbd7('0x59')]({'plain':!![]});if(!_0x34fb72)throw new Error(_0xbbd7('0x5a'));if(_0x34fb72['role']===_0xbbd7('0x58')){var _0x31a580=_0xa76d0e[_0xbbd7('0x59')]({'plain':!![]});var _0x114362='SmsAccounts';return db['UserProfileSection'][_0xbbd7('0x56')]({'where':{'name':_0x114362,'userProfileId':_0x34fb72[_0xbbd7('0x5b')]},'raw':!![]})[_0xbbd7('0x35')](function(_0x457e6f){if(_0x457e6f&&_0x457e6f[_0xbbd7('0x5c')]===0x0){return db[_0xbbd7('0x37')][_0xbbd7('0x57')]({'name':_0x31a580[_0xbbd7('0x39')],'resourceId':_0x31a580['id'],'type':_0x457e6f[_0xbbd7('0x39')],'sectionId':_0x457e6f['id']},{})['then'](function(){return _0xa76d0e;});}else{return _0xa76d0e;}})[_0xbbd7('0x53')](function(_0x40db64){logger['error'](_0xbbd7('0x5d'),_0x40db64);throw _0x40db64;});}return _0xa76d0e;})[_0xbbd7('0x35')](respondWithResult(_0x303328,0xc9))[_0xbbd7('0x53')](handleError(_0x303328,null));};exports[_0xbbd7('0x34')]=function(_0x5095b2,_0x509951){if(_0x5095b2['body']['id']){delete _0x5095b2[_0xbbd7('0x5e')]['id'];}return db['SmsAccount']['find']({'where':{'id':_0x5095b2[_0xbbd7('0x54')]['id']},'include':[{'model':db[_0xbbd7('0x3c')],'as':_0xbbd7('0x3d')}]})[_0xbbd7('0x35')](handleEntityNotFound(_0x509951,null))[_0xbbd7('0x35')](saveUpdates(_0x5095b2[_0xbbd7('0x5e')],null))[_0xbbd7('0x35')](respondWithResult(_0x509951,null))[_0xbbd7('0x53')](handleError(_0x509951,null));};exports[_0xbbd7('0x36')]=function(_0x2c33a1,_0x26dc8a){return db['SmsAccount'][_0xbbd7('0x56')]({'where':{'id':_0x2c33a1[_0xbbd7('0x54')]['id']}})['then'](handleEntityNotFound(_0x26dc8a,null))[_0xbbd7('0x35')](removeEntity(_0x26dc8a,null))[_0xbbd7('0x53')](handleError(_0x26dc8a,null));};exports[_0xbbd7('0x5f')]=function(_0x5d9203,_0xbf4778){return db[_0xbbd7('0x3e')]['describe']()['then'](respondWithResult(_0xbf4778,null))[_0xbbd7('0x53')](handleError(_0xbf4778,null));};exports[_0xbbd7('0x60')]=function(_0x49984b,_0x5af8dc,_0x321fc0){if(_0x49984b[_0xbbd7('0x5e')]['id']){delete _0x49984b[_0xbbd7('0x5e')]['id'];}return db[_0xbbd7('0x3e')][_0xbbd7('0x56')]({'where':{'id':_0x49984b['params']['id']}})[_0xbbd7('0x35')](handleEntityNotFound(_0x5af8dc,null))['then'](function(_0xa0377b){if(_0xa0377b){_0x49984b[_0xbbd7('0x5e')][_0xbbd7('0x61')]=_0xa0377b['id'];return db['Disposition'][_0xbbd7('0x57')](_0x49984b[_0xbbd7('0x5e')]);}})[_0xbbd7('0x35')](respondWithResult(_0x5af8dc,null))[_0xbbd7('0x53')](handleError(_0x5af8dc,null));};exports[_0xbbd7('0x62')]=function(_0x22cb0c,_0x5dd252,_0xf8909a){var _0x259b25={'raw':![],'where':{}};var _0x13bd21={};var _0x1d502c={'count':0x0,'rows':[]};return db[_0xbbd7('0x3e')][_0xbbd7('0x63')]({'where':{'id':_0x22cb0c[_0xbbd7('0x54')]['id']}})['then'](handleEntityNotFound(_0x5dd252,null))['then'](function(_0x5cfd01){if(_0x5cfd01){_0x13bd21[_0xbbd7('0x48')]=_['keys'](db[_0xbbd7('0x64')][_0xbbd7('0x3f')]);_0x13bd21[_0xbbd7('0x42')]=_[_0xbbd7('0x43')](_0x22cb0c[_0xbbd7('0x42')]);_0x13bd21[_0xbbd7('0x4d')]=_['intersection'](_0x13bd21[_0xbbd7('0x48')],_0x13bd21[_0xbbd7('0x42')]);_0x259b25['attributes']=_[_0xbbd7('0x44')](_0x13bd21[_0xbbd7('0x48')],qs[_0xbbd7('0x45')](_0x22cb0c[_0xbbd7('0x42')][_0xbbd7('0x45')]));_0x259b25[_0xbbd7('0x46')]=_0x259b25['attributes'][_0xbbd7('0x47')]?_0x259b25[_0xbbd7('0x46')]:_0x13bd21[_0xbbd7('0x48')];if(!_0x22cb0c[_0xbbd7('0x42')][_0xbbd7('0x65')](_0xbbd7('0x49'))){_0x259b25[_0xbbd7('0x2e')]=qs[_0xbbd7('0x2e')](_0x22cb0c[_0xbbd7('0x42')][_0xbbd7('0x2e')]);_0x259b25[_0xbbd7('0x2c')]=qs[_0xbbd7('0x2c')](_0x22cb0c['query'][_0xbbd7('0x2c')]);}_0x259b25[_0xbbd7('0x4a')]=qs[_0xbbd7('0x4b')](_0x22cb0c[_0xbbd7('0x42')]['sort']);_0x259b25[_0xbbd7('0x4c')]=qs[_0xbbd7('0x4d')](_['pick'](_0x22cb0c['query'],_0x13bd21[_0xbbd7('0x4d')]));_0x259b25[_0xbbd7('0x4c')][_0xbbd7('0x61')]=_0x5cfd01['id'];if(_0x22cb0c[_0xbbd7('0x42')]['filter']){_0x259b25[_0xbbd7('0x4c')]=_[_0xbbd7('0x50')](_0x259b25['where'],{'$or':_['map'](_0x259b25[_0xbbd7('0x46')],function(_0x34263f){var _0x105d6e={};_0x105d6e[_0x34263f]={'$like':'%'+_0x22cb0c['query']['filter']+'%'};return _0x105d6e;})});}_0x259b25=_['merge']({},_0x259b25,_0x22cb0c['options']);return db[_0xbbd7('0x64')][_0xbbd7('0x2f')]({'where':_0x259b25[_0xbbd7('0x4c')]})[_0xbbd7('0x35')](function(_0x5f1a27){_0x1d502c[_0xbbd7('0x2f')]=_0x5f1a27;if(_0x22cb0c[_0xbbd7('0x42')][_0xbbd7('0x52')]){_0x259b25[_0xbbd7('0x55')]=[{'all':!![]}];}return db[_0xbbd7('0x64')][_0xbbd7('0x66')](_0x259b25);})['then'](function(_0x5dd741){_0x1d502c[_0xbbd7('0x67')]=_0x5dd741;return _0x1d502c;});}})[_0xbbd7('0x35')](respondWithFilteredResult(_0x5dd252,_0x259b25))['catch'](handleError(_0x5dd252,null));};exports['removeDispositions']=function(_0x429568,_0xdefc88,_0x27d842){return db[_0xbbd7('0x3e')][_0xbbd7('0x56')]({'where':{'id':_0x429568[_0xbbd7('0x54')]['id']}})[_0xbbd7('0x35')](handleEntityNotFound(_0xdefc88,null))['then'](function(_0x1bad69){if(_0x1bad69){return _0x1bad69['removeDispositions'](_0x429568[_0xbbd7('0x42')][_0xbbd7('0x68')]);}})['then'](respondWithStatusCode(_0xdefc88,null))[_0xbbd7('0x53')](handleError(_0xdefc88,null));};exports[_0xbbd7('0x69')]=function(_0x5ce53a,_0x32efc9,_0xc93461){if(_0x5ce53a[_0xbbd7('0x5e')]['id']){delete _0x5ce53a['body']['id'];}return db[_0xbbd7('0x3e')]['find']({'where':{'id':_0x5ce53a['params']['id']}})[_0xbbd7('0x35')](handleEntityNotFound(_0x32efc9,null))[_0xbbd7('0x35')](function(_0x3d776a){if(_0x3d776a){_0x5ce53a[_0xbbd7('0x5e')][_0xbbd7('0x61')]=_0x3d776a['id'];return db['CannedAnswer'][_0xbbd7('0x57')](_0x5ce53a[_0xbbd7('0x5e')]);}})[_0xbbd7('0x35')](respondWithResult(_0x32efc9,null))[_0xbbd7('0x53')](handleError(_0x32efc9,null));};exports['getAnswers']=function(_0x12ec1f,_0xb36765,_0xe095){var _0x3d6f3d={'raw':![],'where':{}};var _0x1ac149={};var _0x295396={'count':0x0,'rows':[]};return db[_0xbbd7('0x3e')][_0xbbd7('0x63')]({'where':{'id':_0x12ec1f['params']['id']}})[_0xbbd7('0x35')](handleEntityNotFound(_0xb36765,null))['then'](function(_0x404de9){if(_0x404de9){_0x1ac149[_0xbbd7('0x48')]=_[_0xbbd7('0x43')](db[_0xbbd7('0x6a')][_0xbbd7('0x3f')]);_0x1ac149[_0xbbd7('0x42')]=_['keys'](_0x12ec1f[_0xbbd7('0x42')]);_0x1ac149[_0xbbd7('0x4d')]=_['intersection'](_0x1ac149[_0xbbd7('0x48')],_0x1ac149[_0xbbd7('0x42')]);_0x3d6f3d[_0xbbd7('0x46')]=_['intersection'](_0x1ac149[_0xbbd7('0x48')],qs[_0xbbd7('0x45')](_0x12ec1f[_0xbbd7('0x42')]['fields']));_0x3d6f3d['attributes']=_0x3d6f3d[_0xbbd7('0x46')][_0xbbd7('0x47')]?_0x3d6f3d[_0xbbd7('0x46')]:_0x1ac149[_0xbbd7('0x48')];if(!_0x12ec1f[_0xbbd7('0x42')]['hasOwnProperty'](_0xbbd7('0x49'))){_0x3d6f3d['limit']=qs[_0xbbd7('0x2e')](_0x12ec1f[_0xbbd7('0x42')][_0xbbd7('0x2e')]);_0x3d6f3d['offset']=qs[_0xbbd7('0x2c')](_0x12ec1f[_0xbbd7('0x42')]['offset']);}_0x3d6f3d['order']=qs['sort'](_0x12ec1f[_0xbbd7('0x42')][_0xbbd7('0x4b')]);_0x3d6f3d[_0xbbd7('0x4c')]=qs[_0xbbd7('0x4d')](_[_0xbbd7('0x4e')](_0x12ec1f[_0xbbd7('0x42')],_0x1ac149[_0xbbd7('0x4d')]));_0x3d6f3d[_0xbbd7('0x4c')][_0xbbd7('0x61')]=_0x404de9['id'];if(_0x12ec1f[_0xbbd7('0x42')][_0xbbd7('0x4f')]){_0x3d6f3d[_0xbbd7('0x4c')]=_['merge'](_0x3d6f3d[_0xbbd7('0x4c')],{'$or':_[_0xbbd7('0x41')](_0x3d6f3d[_0xbbd7('0x46')],function(_0x2eb136){var _0x13db13={};_0x13db13[_0x2eb136]={'$like':'%'+_0x12ec1f[_0xbbd7('0x42')]['filter']+'%'};return _0x13db13;})});}_0x3d6f3d=_['merge']({},_0x3d6f3d,_0x12ec1f['options']);return db[_0xbbd7('0x6a')][_0xbbd7('0x2f')]({'where':_0x3d6f3d[_0xbbd7('0x4c')]})[_0xbbd7('0x35')](function(_0x52fee7){_0x295396['count']=_0x52fee7;if(_0x12ec1f[_0xbbd7('0x42')][_0xbbd7('0x52')]){_0x3d6f3d[_0xbbd7('0x55')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x3d6f3d);})['then'](function(_0x3d8475){_0x295396[_0xbbd7('0x67')]=_0x3d8475;return _0x295396;});}})[_0xbbd7('0x35')](respondWithFilteredResult(_0xb36765,_0x3d6f3d))[_0xbbd7('0x53')](handleError(_0xb36765,null));};exports[_0xbbd7('0x6b')]=function(_0x3793fc,_0x1c95fb,_0x122b11){return db[_0xbbd7('0x3e')][_0xbbd7('0x56')]({'where':{'id':_0x3793fc[_0xbbd7('0x54')]['id']}})['then'](handleEntityNotFound(_0x1c95fb,null))[_0xbbd7('0x35')](function(_0x26afca){if(_0x26afca){return _0x26afca[_0xbbd7('0x6b')](_0x3793fc[_0xbbd7('0x42')][_0xbbd7('0x68')]);}})['then'](respondWithStatusCode(_0x1c95fb,null))[_0xbbd7('0x53')](handleError(_0x1c95fb,null));};exports[_0xbbd7('0x6c')]=function(_0x7859c5,_0x57a08b,_0xbc7dd2){var _0x1a1c26={'channel':'sms'};var _0x3e12c6=[];var _0x1625ae=[];var _0x131013={};return db[_0xbbd7('0x3e')][_0xbbd7('0x56')]({'where':{'id':_0x7859c5['params']['id']},'include':[{'model':db['SmsApplication'],'as':_0xbbd7('0x6d')}]})['then'](handleEntityNotFound(_0x57a08b,null))[_0xbbd7('0x35')](function(_0x27648c){_0x1a1c26['account']=_0x27648c;_0x1a1c26['applications']=_[_0xbbd7('0x6e')](_0x27648c[_0xbbd7('0x6d')],['priority'],[_0xbbd7('0x6f')]);if(_0x1a1c26[_0xbbd7('0x70')][_0xbbd7('0x6d')]){delete _0x1a1c26[_0xbbd7('0x70')][_0xbbd7('0x6d')];}return db['CmContact'][_0xbbd7('0x5f')]();})[_0xbbd7('0x35')](function(_0x250bdc){if(!_0x250bdc){throw new db[(_0xbbd7('0x71'))][(_0xbbd7('0x72'))](_0xbbd7('0x73'));}_0x3e12c6=_[_0xbbd7('0x74')](_[_0xbbd7('0x43')](_0x250bdc),[_0xbbd7('0x75'),_0xbbd7('0x76')]);_0x1625ae=_[_0xbbd7('0x74')](_['keys'](_0x250bdc),[_0xbbd7('0x75'),_0xbbd7('0x76'),_0xbbd7('0x77'),_0xbbd7('0x78')]);_0x1a1c26[_0xbbd7('0x5e')]={'mapKey':_0xbbd7('0x79')};if(_0x1a1c26[_0xbbd7('0x70')][_0xbbd7('0x7a')]){switch(_0x1a1c26[_0xbbd7('0x70')][_0xbbd7('0x7a')]){case _0xbbd7('0x7b'):_0x1a1c26[_0xbbd7('0x5e')][_0xbbd7('0x7c')]=_0x7859c5[_0xbbd7('0x5e')][_0xbbd7('0x7d')];_0x1a1c26[_0xbbd7('0x5e')][_0xbbd7('0x5e')]=_0x7859c5[_0xbbd7('0x5e')]['Body'];_0x1a1c26[_0xbbd7('0x5e')][_0xbbd7('0x7e')]=_0x7859c5[_0xbbd7('0x5e')][_0xbbd7('0x7f')];break;case _0xbbd7('0x80'):_0x1a1c26['body'][_0xbbd7('0x7c')]='+'+_0x7859c5['body'][_0xbbd7('0x81')];_0x1a1c26[_0xbbd7('0x5e')]['body']=_0x7859c5[_0xbbd7('0x5e')]['text'];break;case _0xbbd7('0x82'):_0x1a1c26[_0xbbd7('0x5e')][_0xbbd7('0x7c')]=_0x7859c5[_0xbbd7('0x5e')][_0xbbd7('0x7c')];_0x1a1c26[_0xbbd7('0x5e')]['body']=_0x7859c5['body'][_0xbbd7('0x25')];break;case _0xbbd7('0x83'):_0x1a1c26[_0xbbd7('0x5e')][_0xbbd7('0x7c')]=_0x7859c5[_0xbbd7('0x5e')]['from'];_0x1a1c26[_0xbbd7('0x5e')]['body']=_0x7859c5[_0xbbd7('0x5e')]['body'];_0x1a1c26[_0xbbd7('0x5e')][_0xbbd7('0x7e')]=_0x7859c5[_0xbbd7('0x5e')][_0xbbd7('0x84')];break;case _0xbbd7('0x85'):_0x1a1c26[_0xbbd7('0x5e')][_0xbbd7('0x7c')]=_0x7859c5['body'][_0xbbd7('0x7d')];_0x1a1c26[_0xbbd7('0x5e')][_0xbbd7('0x5e')]=_0x7859c5['body']['Text'];_0x1a1c26[_0xbbd7('0x5e')][_0xbbd7('0x7e')]=_0x7859c5[_0xbbd7('0x5e')][_0xbbd7('0x86')];break;case _0xbbd7('0x87'):_0x1a1c26['body'][_0xbbd7('0x7c')]='+'+_0x7859c5[_0xbbd7('0x5e')]['results'][0x0][_0xbbd7('0x7c')];_0x1a1c26[_0xbbd7('0x5e')][_0xbbd7('0x5e')]=_0x7859c5['body'][_0xbbd7('0x88')][0x0]['text'];_0x1a1c26[_0xbbd7('0x5e')][_0xbbd7('0x7e')]=_0x7859c5[_0xbbd7('0x5e')][_0xbbd7('0x88')][0x0][_0xbbd7('0x7e')];break;case _0xbbd7('0x89'):_0x1a1c26[_0xbbd7('0x5e')][_0xbbd7('0x7c')]=_0x7859c5[_0xbbd7('0x5e')][_0xbbd7('0x8a')];_0x1a1c26[_0xbbd7('0x5e')][_0xbbd7('0x5e')]=_0x7859c5[_0xbbd7('0x5e')][_0xbbd7('0x8b')]['message'];break;case _0xbbd7('0x8c'):_0x1a1c26[_0xbbd7('0x5e')][_0xbbd7('0x7c')]=_0x7859c5[_0xbbd7('0x5e')][_0xbbd7('0x8d')];_0x1a1c26[_0xbbd7('0x5e')][_0xbbd7('0x5e')]=_0x7859c5[_0xbbd7('0x5e')][_0xbbd7('0x8e')];_0x1a1c26[_0xbbd7('0x5e')][_0xbbd7('0x7e')]=_0x7859c5[_0xbbd7('0x5e')]['replyMessageId'];break;case _0xbbd7('0x8f'):_0x1a1c26['body'][_0xbbd7('0x7e')]=_0x7859c5[_0xbbd7('0x5e')][0x0]['message']['id'];_0x1a1c26['body'][_0xbbd7('0x7c')]=_0x7859c5[_0xbbd7('0x5e')][0x0][_0xbbd7('0x25')][_0xbbd7('0x7c')];_0x1a1c26[_0xbbd7('0x5e')][_0xbbd7('0x5e')]=_0x7859c5[_0xbbd7('0x5e')][0x0]['message'][_0xbbd7('0x8e')];break;case _0xbbd7('0x90'):_0x1a1c26[_0xbbd7('0x5e')][_0xbbd7('0x7c')]=_0x7859c5[_0xbbd7('0x5e')][_0xbbd7('0x7c')];_0x1a1c26[_0xbbd7('0x5e')][_0xbbd7('0x5e')]=_0x7859c5[_0xbbd7('0x5e')]['message'];_0x1a1c26['body'][_0xbbd7('0x7e')]=_0x7859c5[_0xbbd7('0x5e')]['refid'];break;}}if(_0x1a1c26[_0xbbd7('0x5e')]['id']){delete _0x1a1c26[_0xbbd7('0x5e')]['id'];}if(_[_0xbbd7('0x91')](_0x1a1c26[_0xbbd7('0x5e')]['from'])){throw new db['Sequelize']['ValidationError'](_0xbbd7('0x92'));}if(_[_0xbbd7('0x91')](_0x1a1c26[_0xbbd7('0x5e')]['body'])||_0x1a1c26[_0xbbd7('0x5e')][_0xbbd7('0x5e')]===''){throw new db[(_0xbbd7('0x71'))][(_0xbbd7('0x72'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xbbd7('0x91')](_0x1a1c26['body'][_0xbbd7('0x93')])){throw new db['Sequelize'][(_0xbbd7('0x72'))](_0xbbd7('0x94')+_0x1625ae);}if(!_['includes'](_0x1625ae,_0x1a1c26['body'][_0xbbd7('0x93')])){throw new db[(_0xbbd7('0x71'))][(_0xbbd7('0x72'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1625ae);}_0x131013[_0x1a1c26['body'][_0xbbd7('0x93')]]=_0x1a1c26[_0xbbd7('0x5e')][_0xbbd7('0x7c')];return db[_0xbbd7('0x95')][_0xbbd7('0x56')]({'where':{'id':_0x1a1c26[_0xbbd7('0x70')]['ListId']},'include':[{'model':db[_0xbbd7('0x96')],'as':_0xbbd7('0x97'),'where':_0x131013,'limit':0x1,'order':[[_0xbbd7('0x76'),'DESC']]}]});})[_0xbbd7('0x35')](handleEntityNotFound(_0x57a08b,null))[_0xbbd7('0x35')](function(_0xfc04bb){if(_0xfc04bb){_0x1a1c26[_0xbbd7('0x98')]=_[_0xbbd7('0x99')](_0xfc04bb,['Contacts']);if(_0xfc04bb[_0xbbd7('0x97')][_0xbbd7('0x47')]){return _0xfc04bb['Contacts'][0x0];}var _0x3e35ce=_[_0xbbd7('0x9a')](_0x1a1c26['body'],{'firstName':_0x1a1c26['body']['from'],'ListId':_0xfc04bb['id']});_0x3e35ce[_0x1a1c26[_0xbbd7('0x5e')]['mapKey']]=_0x1a1c26['body'][_0xbbd7('0x7c')];return db['CmContact'][_0xbbd7('0x57')](_0x3e35ce,{'fields':_0x3e12c6,'raw':!![]});}})[_0xbbd7('0x35')](handleEntityNotFound(_0x57a08b,null))[_0xbbd7('0x35')](function(_0x5b2d78){if(_0x5b2d78){_0x1a1c26['contact']=_0x5b2d78;var _0x1de175={'ContactId':_0x5b2d78['id'],'phone':_0x1a1c26[_0xbbd7('0x5e')][_0xbbd7('0x7c')],'SmsAccountId':_0x7859c5['params']['id']};var _0xf6f27={'ContactId':_0x5b2d78['id'],'SmsAccountId':_0x7859c5[_0xbbd7('0x54')]['id'],'closed':![]};return db['SmsInteraction']['find']({'where':_0xf6f27})[_0xbbd7('0x35')](function(_0x267e0f){if(_0x267e0f){return[_0x267e0f,![]];}return db[_0xbbd7('0x9b')]['create'](_0x1de175)[_0xbbd7('0x35')](function(_0x1a3469){return[_0x1a3469,!![]];});});}})[_0xbbd7('0x9c')](function(_0x1ee671,_0x53ea9a){_0x1a1c26[_0xbbd7('0x9d')]=_0x1ee671['get']({'plain':!![]});_0x1a1c26['interaction'][_0xbbd7('0x9e')]=![];if(_0x53ea9a){if(_0x1a1c26[_0xbbd7('0x70')][_0xbbd7('0x9f')]){_0x1a1c26[_0xbbd7('0xa0')][_0xbbd7('0xa1')]({'id':0x0,'priority':_0x1a1c26[_0xbbd7('0xa0')][_0xbbd7('0x47')]+0x1,'app':_0xbbd7('0xa2'),'appdata':'unmanaged','interval':_0xbbd7('0xa3')});}_0x1a1c26['interaction']['created']=!![];}return db['SmsMessage']['create']({'phone':_0x1a1c26['body'][_0xbbd7('0x7c')],'messageId':_0x1a1c26[_0xbbd7('0x5e')][_0xbbd7('0x7e')],'body':_0x1a1c26['body'][_0xbbd7('0x5e')],'SmsAccountId':_0x7859c5[_0xbbd7('0x54')]['id'],'SmsInteractionId':_0x1ee671['id'],'direction':'in','ContactId':_0x1ee671[_0xbbd7('0xa4')],'AttachmentId':_0x1a1c26[_0xbbd7('0x5e')][_0xbbd7('0xa5')]});})[_0xbbd7('0x35')](function(_0x4f3c68){_0x1a1c26['message']=_0x4f3c68;if(_0x1a1c26[_0xbbd7('0x9d')][_0xbbd7('0xa6')]){return db[_0xbbd7('0xa7')]['find']({'attributes':['id',_0xbbd7('0x39')],'where':{'id':_0x1a1c26[_0xbbd7('0x9d')][_0xbbd7('0xa6')]}})[_0xbbd7('0x35')](function(_0x13558a){if(_0x13558a){_0x1a1c26['applications'][_0xbbd7('0xa8')]({'id':0x0,'priority':0x0,'app':_0xbbd7('0xa9'),'appdata':_0x13558a[_0xbbd7('0x39')]+','+(_0x1a1c26['account'][_0xbbd7('0xaa')]||0xa),'interval':_0xbbd7('0xa3')});}return respondWithRpcPromise(_0xbbd7('0xab'),_0xbbd7('0xac'),_0x1a1c26);});}return respondWithRpcPromise(_0xbbd7('0xab'),_0xbbd7('0xac'),_0x1a1c26);})[_0xbbd7('0x35')](function(_0x2f0526){if(_0x2f0526){var _0x5e5240=0xc8;var _0x11b022='receiveMessage';logger[_0xbbd7('0x1f')](_0xbbd7('0xad'),_0x11b022,_0x5e5240,_0xbbd7('0xae'));logger[_0xbbd7('0x20')](_0xbbd7('0xaf'),_0x11b022,_0x5e5240,_0xbbd7('0xae'),JSON[_0xbbd7('0x22')](_0x2f0526));if(_0x1a1c26[_0xbbd7('0x70')]['type']==='twilio'){return _0x57a08b[_0xbbd7('0x29')](_0x5e5240)[_0xbbd7('0x30')](_0xbbd7('0xb0'),_0xbbd7('0xb1'))['send'](_0xbbd7('0xb2'));}else{return _0x57a08b['status'](_0x5e5240)['json'](_0x2f0526);}}})[_0xbbd7('0x53')](handleError(_0x57a08b,null));};exports[_0xbbd7('0xb3')]=function(_0x311111,_0x147209){var _0x525c66=_0x311111['params']['id'];var _0x23c9ef=_0x311111['body'];var _0x4566f3=0xc8;var _0x300376=null;return db[_0xbbd7('0xb4')]['transaction']({'isolationLevel':db['sequelize']['Transaction']['ISOLATION_LEVELS'][_0xbbd7('0xb5')]},function(_0x20f59b){return db[_0xbbd7('0x3e')][_0xbbd7('0x63')]({'where':{'id':_0x525c66},'transaction':_0x20f59b})[_0xbbd7('0x35')](function(_0xd285bc){if(_0xd285bc){return db[_0xbbd7('0xb6')][_0xbbd7('0x36')]({'where':{'SmsAccountId':_0x525c66},'transaction':_0x20f59b})['then'](function(){var _0x15290d=_[_0xbbd7('0x41')](_0x23c9ef,function(_0x5ab425){_0x5ab425[_0xbbd7('0x61')]=_0x525c66;return _0x5ab425;});return db[_0xbbd7('0xb6')][_0xbbd7('0xb7')](_0x15290d,{'transaction':_0x20f59b});});}else{_0x4566f3=0x194;_0x300376=[];}});})[_0xbbd7('0x35')](function(){if(_0x4566f3!==0x194){return db['SmsApplication'][_0xbbd7('0xb8')]({'where':{'SmsAccountId':_0x525c66},'order':_0xbbd7('0xb9')})[_0xbbd7('0x35')](function(_0x2b09f5){_0x300376=_0x2b09f5;});}})['catch'](function(_0x37ce06){_0x4566f3=0x1f4;logger[_0xbbd7('0x23')](_0x37ce06[_0xbbd7('0x38')]);if(_0x37ce06[_0xbbd7('0x39')]){delete _0x37ce06['name'];}_0x300376=_0x37ce06;})[_0xbbd7('0xba')](function(){if(_0x300376===null){_0x147209['sendStatus'](_0x4566f3);}else{if(_0x4566f3===0x1f4){_0x147209[_0xbbd7('0x29')](_0x4566f3)[_0xbbd7('0x3a')](_0x300376);}else{_0x147209['status'](_0x4566f3)[_0xbbd7('0x2b')](_0x300376);}}});};exports[_0xbbd7('0xbb')]=function(_0x5a658d,_0x4e4f17,_0x2b7fd8){var _0x47b2af={};var _0x2373c1={};var _0x26db40;var _0x460c34;return db[_0xbbd7('0x3e')][_0xbbd7('0x63')]({'where':{'id':_0x5a658d['params']['id']}})[_0xbbd7('0x35')](handleEntityNotFound(_0x4e4f17,null))[_0xbbd7('0x35')](function(_0x1b6a7c){if(_0x1b6a7c){_0x26db40=_0x1b6a7c;_0x2373c1[_0xbbd7('0x48')]=_[_0xbbd7('0x43')](db[_0xbbd7('0xb6')][_0xbbd7('0x3f')]);_0x2373c1['query']=_[_0xbbd7('0x43')](_0x5a658d[_0xbbd7('0x42')]);_0x2373c1[_0xbbd7('0x4d')]=_['intersection'](_0x2373c1[_0xbbd7('0x48')],_0x2373c1[_0xbbd7('0x42')]);_0x47b2af[_0xbbd7('0x46')]=_[_0xbbd7('0x44')](_0x2373c1[_0xbbd7('0x48')],qs[_0xbbd7('0x45')](_0x5a658d[_0xbbd7('0x42')][_0xbbd7('0x45')]));_0x47b2af[_0xbbd7('0x46')]=_0x47b2af[_0xbbd7('0x46')][_0xbbd7('0x47')]?_0x47b2af[_0xbbd7('0x46')]:_0x2373c1['model'];_0x47b2af[_0xbbd7('0x4a')]=qs['sort'](_0x5a658d[_0xbbd7('0x42')][_0xbbd7('0x4b')]);_0x47b2af[_0xbbd7('0x4c')]=qs[_0xbbd7('0x4d')](_[_0xbbd7('0x4e')](_0x5a658d[_0xbbd7('0x42')],_0x2373c1['filters']));if(_0x5a658d['query'][_0xbbd7('0x4f')]){_0x47b2af[_0xbbd7('0x4c')]=_['merge'](_0x47b2af[_0xbbd7('0x4c')],{'$or':_[_0xbbd7('0x41')](_0x47b2af[_0xbbd7('0x46')],function(_0xa32a05){var _0x2f15c8={};_0x2f15c8[_0xa32a05]={'$like':'%'+_0x5a658d[_0xbbd7('0x42')][_0xbbd7('0x4f')]+'%'};return _0x2f15c8;})});}_0x47b2af=_[_0xbbd7('0x50')]({},_0x47b2af,_0x5a658d[_0xbbd7('0x51')]);return _0x26db40[_0xbbd7('0xbb')](_0x47b2af);}})[_0xbbd7('0x35')](function(_0x1b37ea){if(_0x1b37ea){_0x460c34=_0x1b37ea[_0xbbd7('0x47')];if(!_0x5a658d[_0xbbd7('0x42')][_0xbbd7('0x65')](_0xbbd7('0x49'))){_0x47b2af[_0xbbd7('0x2e')]=qs[_0xbbd7('0x2e')](_0x5a658d['query'][_0xbbd7('0x2e')]);_0x47b2af['offset']=qs[_0xbbd7('0x2c')](_0x5a658d[_0xbbd7('0x42')][_0xbbd7('0x2c')]);}return _0x26db40['getApplications'](_0x47b2af);}})[_0xbbd7('0x35')](function(_0x19bacd){if(_0x19bacd){return _0x19bacd?{'count':_0x460c34,'rows':_0x19bacd}:null;}})['then'](respondWithResult(_0x4e4f17,null))['catch'](handleError(_0x4e4f17,null));};exports[_0xbbd7('0xbc')]=function(_0x47bd7b,_0x4bd366,_0x288df){var _0x1e3b69={'raw':![],'where':{}};var _0x17c13f={};var _0x33c076={'count':0x0,'rows':[]};return db[_0xbbd7('0x3e')][_0xbbd7('0x63')]({'where':{'id':_0x47bd7b[_0xbbd7('0x54')]['id']}})[_0xbbd7('0x35')](handleEntityNotFound(_0x4bd366,null))[_0xbbd7('0x35')](function(_0x1a61aa){if(_0x1a61aa){_0x17c13f[_0xbbd7('0x48')]=_[_0xbbd7('0x43')](db[_0xbbd7('0x9b')][_0xbbd7('0x3f')]);_0x17c13f[_0xbbd7('0x42')]=_[_0xbbd7('0x43')](_0x47bd7b[_0xbbd7('0x42')]);_0x17c13f['filters']=_[_0xbbd7('0x44')](_0x17c13f['model'],_0x17c13f[_0xbbd7('0x42')]);_0x1e3b69[_0xbbd7('0x46')]=_[_0xbbd7('0x44')](_0x17c13f['model'],qs[_0xbbd7('0x45')](_0x47bd7b['query'][_0xbbd7('0x45')]));_0x1e3b69[_0xbbd7('0x46')]=_0x1e3b69[_0xbbd7('0x46')][_0xbbd7('0x47')]?_0x1e3b69[_0xbbd7('0x46')]:_0x17c13f[_0xbbd7('0x48')];if(!_0x47bd7b[_0xbbd7('0x42')][_0xbbd7('0x65')](_0xbbd7('0x49'))){_0x1e3b69[_0xbbd7('0x2e')]=qs[_0xbbd7('0x2e')](_0x47bd7b['query'][_0xbbd7('0x2e')]);_0x1e3b69['offset']=qs[_0xbbd7('0x2c')](_0x47bd7b[_0xbbd7('0x42')][_0xbbd7('0x2c')]);}_0x1e3b69[_0xbbd7('0x4a')]=qs[_0xbbd7('0x4b')](_0x47bd7b[_0xbbd7('0x42')]['sort']);_0x1e3b69[_0xbbd7('0x4c')]=qs[_0xbbd7('0x4d')](_[_0xbbd7('0x4e')](_0x47bd7b[_0xbbd7('0x42')],_0x17c13f['filters']));_0x1e3b69[_0xbbd7('0x4c')][_0xbbd7('0x61')]=_0x1a61aa['id'];if(_0x47bd7b[_0xbbd7('0x42')][_0xbbd7('0x4f')]){_0x1e3b69[_0xbbd7('0x4c')]=_[_0xbbd7('0x50')](_0x1e3b69['where'],{'$or':_['map'](_0x1e3b69['attributes'],function(_0x3e2a0a){var _0x217c6e={};_0x217c6e[_0x3e2a0a]={'$like':'%'+_0x47bd7b['query'][_0xbbd7('0x4f')]+'%'};return _0x217c6e;})});}_0x1e3b69=_['merge']({},_0x1e3b69,_0x47bd7b[_0xbbd7('0x51')]);return db[_0xbbd7('0x9b')][_0xbbd7('0x2f')]({'where':_0x1e3b69[_0xbbd7('0x4c')]})[_0xbbd7('0x35')](function(_0x5e228b){_0x33c076[_0xbbd7('0x2f')]=_0x5e228b;if(_0x47bd7b['query']['includeAll']){_0x1e3b69['include']=[{'model':db[_0xbbd7('0x96')],'as':_0xbbd7('0xbd'),'required':![]},{'model':db[_0xbbd7('0xa7')],'as':'Owner','attributes':[_0xbbd7('0x39'),_0xbbd7('0xbe'),_0xbbd7('0xbf')],'required':![]},{'model':db[_0xbbd7('0xc0')],'as':'Tags','attributes':['id',_0xbbd7('0x39'),_0xbbd7('0xc1')],'where':_0x47bd7b[_0xbbd7('0x42')][_0xbbd7('0xc2')]?{'id':_0x47bd7b[_0xbbd7('0x42')][_0xbbd7('0xc2')]}:undefined,'required':_0x47bd7b['query'][_0xbbd7('0xc2')]?!![]:![]}];}return db[_0xbbd7('0x9b')][_0xbbd7('0x66')](_0x1e3b69);})[_0xbbd7('0x35')](function(_0x425d9){_0x33c076[_0xbbd7('0x67')]=_0x425d9;return _0x33c076;});}})[_0xbbd7('0x35')](respondWithFilteredResult(_0x4bd366,_0x1e3b69))['catch'](handleError(_0x4bd366,null));};exports[_0xbbd7('0x3a')]=function(_0x143899,_0x4b68d4,_0x41ad89){var _0x5692f5,_0x52ab87,_0x24baeb;if(_[_0xbbd7('0x91')](_0x143899[_0xbbd7('0x5e')][_0xbbd7('0x5e')])||_0x143899[_0xbbd7('0x5e')]['body']===''){throw new db[(_0xbbd7('0x71'))][(_0xbbd7('0x72'))](_0xbbd7('0xc3'));}if(_[_0xbbd7('0x91')](_0x143899[_0xbbd7('0x5e')]['to'])){throw new db[(_0xbbd7('0x71'))][(_0xbbd7('0x72'))](_0xbbd7('0xc4'));}_0x5692f5=_0x143899[_0xbbd7('0x5e')]['to'];return db[_0xbbd7('0x3e')][_0xbbd7('0x56')]({'where':{'id':_0x143899['params']['id']},'include':[{'model':db['CmList'],'as':_0xbbd7('0xc5'),'include':[{'model':db[_0xbbd7('0x96')],'as':_0xbbd7('0x97'),'where':{'mobile':_0x5692f5},'limit':0x1,'order':[[_0xbbd7('0x76'),_0xbbd7('0xc6')]]}]}]})[_0xbbd7('0x35')](handleEntityNotFound(_0x4b68d4,null))[_0xbbd7('0x35')](function(_0xa78a3d){if(_0xa78a3d&&_0xa78a3d[_0xbbd7('0xc5')]){_0x52ab87=_0xa78a3d[_0xbbd7('0x59')]({'plain':!![]});if(_0x52ab87['List']&&_0x52ab87[_0xbbd7('0xc5')][_0xbbd7('0x97')][_0xbbd7('0x47')]){return _0x52ab87[_0xbbd7('0xc5')][_0xbbd7('0x97')][0x0];}return db[_0xbbd7('0x96')]['create'](_[_0xbbd7('0x9a')](_0x143899[_0xbbd7('0x5e')],{'firstName':_0x5692f5,'mobile':_0x5692f5,'phone':_0x5692f5,'ListId':_0x52ab87[_0xbbd7('0x78')]}));}})[_0xbbd7('0x35')](handleEntityNotFound(_0x4b68d4,null))['then'](function(_0x85300c){if(_0x85300c){_0x24baeb=_0x85300c;return db[_0xbbd7('0x9b')][_0xbbd7('0x56')]({'where':{'ContactId':_0x24baeb['id'],'closed':![],'SmsAccountId':_0x52ab87['id']}})[_0xbbd7('0x35')](function(_0x226c6b){if(_0x226c6b){return[_0x226c6b,![]];}return db['SmsInteraction']['create']({'UserId':_0x143899[_0xbbd7('0x58')]['id'],'ContactId':_0x24baeb['id'],'SmsAccountId':_0x52ab87['id'],'phone':_0x5692f5,'firstMsgDirection':_0xbbd7('0xc7'),'Messages':[_[_0xbbd7('0x50')](_0x143899[_0xbbd7('0x5e')],{'read':![],'body':_0x143899[_0xbbd7('0x5e')][_0xbbd7('0x5e')],'phone':_0x5692f5,'SmsAccountId':_0x52ab87['id'],'UserId':_0x143899[_0xbbd7('0x58')]['id'],'ContactId':_0x24baeb['id']})]},{'include':[{'model':db['SmsMessage'],'as':'Messages'}]})[_0xbbd7('0x35')](function(_0x37fa82){return[_0x37fa82,!![]];});});}})[_0xbbd7('0x9c')](function(_0x3240a0,_0x31f564){if(_0x31f564){return _0x3240a0;}return db[_0xbbd7('0xc8')]['create'](_['merge'](_0x143899[_0xbbd7('0x5e')],{'read':![],'body':_0x143899[_0xbbd7('0x5e')][_0xbbd7('0x5e')],'phone':_0x5692f5,'SmsAccountId':_0x52ab87['id'],'SmsInteractionId':_0x3240a0['id'],'UserId':_0x143899[_0xbbd7('0x58')]['id'],'ContactId':_0x24baeb['id']}))[_0xbbd7('0x35')](function(_0x1bafba){_0x3240a0[_0xbbd7('0xc9')]['Messages']=[];_0x3240a0['dataValues'][_0xbbd7('0xca')][_0xbbd7('0xa1')](_0x1bafba[_0xbbd7('0xc9')]);return _0x3240a0;});})[_0xbbd7('0x35')](respondWithResult(_0x4b68d4,null))[_0xbbd7('0x53')](handleError(_0x4b68d4,null));};exports[_0xbbd7('0x29')]=function(_0x494ff6,_0x5bbda6,_0x336799){if(_0x494ff6[_0xbbd7('0x5e')]['id']){delete _0x494ff6[_0xbbd7('0x5e')]['id'];}var _0x14bb72,_0x3b04aa,_0x578f3e;return db['SmsAccount'][_0xbbd7('0x56')]({'where':{'id':_0x494ff6['params']['id']}})['then'](handleEntityNotFound(_0x5bbda6,null))[_0xbbd7('0x35')](function(_0x5c0cf3){if(_0x5c0cf3){_0x578f3e=_0x5c0cf3;logger[_0xbbd7('0x20')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xbbd7('0x29'),'received\x20delivery\x20report\x20from',_0x5c0cf3[_0xbbd7('0x7a')],util[_0xbbd7('0xcb')](_0x494ff6[_0xbbd7('0x5e')],{'showHidden':![],'depth':null}));switch(_0x5c0cf3[_0xbbd7('0x7a')]){case _0xbbd7('0x80'):if(_0x494ff6['body'][_0xbbd7('0xcc')]&&_0x494ff6['body'][_0xbbd7('0x29')]){_0x3b04aa=_0x494ff6[_0xbbd7('0x5e')][_0xbbd7('0x29')];return db['SmsMessage'][_0xbbd7('0x56')]({'where':{'messageId':_0x494ff6['body'][_0xbbd7('0xcc')]}});}break;case _0xbbd7('0x82'):if(_0x494ff6[_0xbbd7('0x5e')][_0xbbd7('0xcd')]&&_0x494ff6['body'][_0xbbd7('0xce')]){_0x3b04aa=_0x494ff6['body'][_0xbbd7('0xce')];return db[_0xbbd7('0xc8')]['find']({'where':{'messageId':_0x494ff6[_0xbbd7('0x5e')][_0xbbd7('0xcd')]}});}break;case _0xbbd7('0x83'):if(_0x494ff6[_0xbbd7('0x5e')][_0xbbd7('0x84')]&&_0x494ff6[_0xbbd7('0x5e')][_0xbbd7('0xcf')]){_0x3b04aa=_0x494ff6[_0xbbd7('0x5e')][_0xbbd7('0xcf')];return db[_0xbbd7('0xc8')][_0xbbd7('0x56')]({'where':{'messageId':_0x494ff6[_0xbbd7('0x5e')]['message_id']}});}break;case'infobip':var _0xa1c268=_0x494ff6['body'][_0xbbd7('0x88')][0x0];if(_0xa1c268[_0xbbd7('0x7e')]&&_0xa1c268[_0xbbd7('0x29')][_0xbbd7('0xd0')]===_0xbbd7('0xd1')){_0x3b04aa=_0xa1c268[_0xbbd7('0x29')][_0xbbd7('0xd0')];return db[_0xbbd7('0xc8')][_0xbbd7('0x56')]({'where':{'messageId':_0xa1c268[_0xbbd7('0x7e')]}});}break;case'clickatell':if(_0x494ff6['body'][_0xbbd7('0x7e')]&&_0x494ff6['body']['status']){_0x3b04aa=_0x494ff6[_0xbbd7('0x5e')]['status'];return db[_0xbbd7('0xc8')][_0xbbd7('0x56')]({'where':{'messageId':_0x494ff6[_0xbbd7('0x5e')][_0xbbd7('0x7e')]}});}break;case'bandwidth':if(_0x494ff6[_0xbbd7('0x5e')][0x0][_0xbbd7('0x25')]['id']){_0x3b04aa=_0x494ff6[_0xbbd7('0x5e')][0x0][_0xbbd7('0x7a')];return db[_0xbbd7('0xc8')][_0xbbd7('0x56')]({'where':{'messageId':_0x494ff6[_0xbbd7('0x5e')][0x0]['message']['id']}});}break;case _0xbbd7('0x90'):if(_0x494ff6['body'][_0xbbd7('0xd2')]&&_0x494ff6[_0xbbd7('0x5e')][_0xbbd7('0x29')]){_0x3b04aa=_0x494ff6[_0xbbd7('0x5e')]['status'];return db[_0xbbd7('0xc8')]['find']({'where':{'messageId':_0x494ff6[_0xbbd7('0x5e')][_0xbbd7('0xd2')]}});}break;}}})['then'](handleEntityNotFound(_0x5bbda6,null))['then'](function(_0x4d4dcd){if(_0x4d4dcd){_0x14bb72=_0x4d4dcd;switch(_0x578f3e['type']){case _0xbbd7('0x80'):if(_0x3b04aa==='DELIVERED'){return _0x14bb72['update']({'read':!![]});}else{logger[_0xbbd7('0x23')](_0xbbd7('0xad'),'status',_0xbbd7('0x80'),util[_0xbbd7('0xcb')](_0x494ff6['body'],{'showHidden':![],'depth':null}));}break;case _0xbbd7('0x82'):if(_0x3b04aa==='1'){return _0x14bb72['update']({'read':!![]});}else{logger[_0xbbd7('0x23')](_0xbbd7('0xad'),'status',_0xbbd7('0x80'),util['inspect'](_0x494ff6[_0xbbd7('0x5e')],{'showHidden':![],'depth':null}));}break;case _0xbbd7('0x83'):if(!_0x494ff6['body'][_0xbbd7('0xd3')]&&_0x3b04aa>=0xc8&&_0x3b04aa<=0xce){return _0x14bb72['update']({'read':!![]});}else{logger['error'](_0xbbd7('0xad'),_0xbbd7('0x29'),_0xbbd7('0x83'),util[_0xbbd7('0xcb')](_0x494ff6[_0xbbd7('0x5e')],{'showHidden':![],'depth':null}));}break;case _0xbbd7('0x87'):var _0xd98861=_0x494ff6[_0xbbd7('0x5e')][_0xbbd7('0x88')][0x0];if(_0xd98861[_0xbbd7('0x29')][_0xbbd7('0xd0')]===_0xbbd7('0xd1')){return _0x14bb72[_0xbbd7('0x34')]({'read':!![]});}else{logger[_0xbbd7('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xbbd7('0x29'),_0xbbd7('0x87'),util[_0xbbd7('0xcb')](_0x494ff6[_0xbbd7('0x5e')],{'showHidden':![],'depth':null}));}break;case _0xbbd7('0x8c'):if(_0x3b04aa==_0xbbd7('0xd4')||_0x3b04aa==_0xbbd7('0xd5')){return _0x14bb72[_0xbbd7('0x34')]({'read':!![]});}else{logger[_0xbbd7('0x23')](_0xbbd7('0xad'),_0xbbd7('0x29'),'clickatell',util['inspect'](_0x494ff6[_0xbbd7('0x5e')],{'showHidden':![],'depth':null}));}break;case _0xbbd7('0x8f'):if(_0x3b04aa==_0xbbd7('0xd6')){return _0x14bb72['update']({'read':!![]});}else{logger[_0xbbd7('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xbbd7('0x29'),_0xbbd7('0x8f'),util[_0xbbd7('0xcb')](_0x494ff6[_0xbbd7('0x5e')],{'showHidden':![],'depth':null}));}break;case _0xbbd7('0x90'):if(_0x3b04aa==='DELIVRD'||_0x3b04aa===_0xbbd7('0xd7')){return _0x14bb72[_0xbbd7('0x34')]({'read':!![]});}else{logger[_0xbbd7('0x23')](_0xbbd7('0xad'),_0xbbd7('0x29'),_0xbbd7('0x90'),util[_0xbbd7('0xcb')](_0x494ff6[_0xbbd7('0x5e')],{'showHidden':![],'depth':null}));}break;}return _0x14bb72;}})[_0xbbd7('0x35')](respondWithResult(_0x5bbda6,null))[_0xbbd7('0x53')](handleError(_0x5bbda6,null));};exports['statusGet']=function(_0x52c58b,_0xbfedd4,_0x308f54){var _0x72b86a,_0x1844d5,_0x5a483e;return db[_0xbbd7('0x3e')][_0xbbd7('0x56')]({'where':{'id':_0x52c58b[_0xbbd7('0x54')]['id']}})[_0xbbd7('0x35')](handleEntityNotFound(_0xbfedd4,null))[_0xbbd7('0x35')](function(_0x188803){if(_0x188803){_0x5a483e=_0x188803;logger[_0xbbd7('0x20')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xbbd7('0x29'),'received\x20delivery\x20report\x20from',_0x188803['type'],util[_0xbbd7('0xcb')](_0x52c58b['query'],{'showHidden':![],'depth':null}));switch(_0x188803['type']){case _0xbbd7('0x89'):if(_0x52c58b[_0xbbd7('0x42')][_0xbbd7('0xd8')]&&_0x52c58b[_0xbbd7('0x42')][_0xbbd7('0xd9')]){_0x1844d5=_0x52c58b[_0xbbd7('0x42')][_0xbbd7('0xd9')];return db[_0xbbd7('0xc8')][_0xbbd7('0x56')]({'where':{'messageId':_0x52c58b['query'][_0xbbd7('0xd8')]}});}break;}}})['then'](handleEntityNotFound(_0xbfedd4,null))[_0xbbd7('0x35')](function(_0x1ab63d){if(_0x1ab63d){_0x72b86a=_0x1ab63d;switch(_0x5a483e['type']){case _0xbbd7('0x89'):if(_0x1844d5==='2'||_0x1844d5==='6'){return _0x72b86a[_0xbbd7('0x34')]({'read':!![]});}else{logger[_0xbbd7('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0xbbd7('0x89'),util[_0xbbd7('0xcb')](_0x52c58b[_0xbbd7('0x42')],{'showHidden':![],'depth':null}));};break;}return _0x72b86a;}})[_0xbbd7('0x35')](respondWithResult(_0xbfedd4,null))[_0xbbd7('0x53')](handleError(_0xbfedd4,null));};exports[_0xbbd7('0xda')]=function(_0x36f606,_0x9f0bf4,_0x25afd3){return db['SmsAccount'][_0xbbd7('0x56')]({'where':{'id':_0x36f606[_0xbbd7('0x54')]['id']}})[_0xbbd7('0x35')](handleEntityNotFound(_0x9f0bf4,null))[_0xbbd7('0x35')](function(_0x447b79){if(_0x447b79){return _0x447b79[_0xbbd7('0xda')](_0x36f606[_0xbbd7('0x5e')][_0xbbd7('0x68')],_[_0xbbd7('0x99')](_0x36f606[_0xbbd7('0x5e')],[_0xbbd7('0x68'),'id'])||{})[_0xbbd7('0x9c')](function(_0x123d08){for(var _0x214a14=0x0;_0x214a14<_0x36f606[_0xbbd7('0x5e')][_0xbbd7('0x68')]['length'];_0x214a14+=0x1){socket[_0xbbd7('0xdb')]('userSmsAccount:save',{'UserId':Number(_0x36f606[_0xbbd7('0x5e')][_0xbbd7('0x68')][_0x214a14]),'SmsAccountId':Number(_0x36f606[_0xbbd7('0x54')]['id'])});}return _0x123d08;});}})[_0xbbd7('0x35')](respondWithResult(_0x9f0bf4,null))['catch'](handleError(_0x9f0bf4,null));};exports[_0xbbd7('0xdc')]=function(_0x53e205,_0x1523e9,_0x614902){return db['SmsAccount'][_0xbbd7('0x56')]({'where':{'id':_0x53e205[_0xbbd7('0x54')]['id']}})['then'](handleEntityNotFound(_0x1523e9,null))[_0xbbd7('0x35')](function(_0x4b4483){if(_0x4b4483){return _0x4b4483[_0xbbd7('0xdc')](_0x53e205[_0xbbd7('0x42')]['ids'])[_0xbbd7('0x35')](function(){if(_[_0xbbd7('0xdd')](_0x53e205[_0xbbd7('0x42')]['ids'])){for(var _0x4f84e4=0x0;_0x4f84e4<_0x53e205[_0xbbd7('0x42')][_0xbbd7('0x68')][_0xbbd7('0x47')];_0x4f84e4+=0x1){socket[_0xbbd7('0xdb')]('userSmsAccount:remove',{'UserId':Number(_0x53e205[_0xbbd7('0x42')][_0xbbd7('0x68')][_0x4f84e4]),'SmsAccountId':Number(_0x53e205[_0xbbd7('0x54')]['id'])});}}else{socket[_0xbbd7('0xdb')](_0xbbd7('0xde'),{'UserId':Number(_0x53e205[_0xbbd7('0x42')][_0xbbd7('0x68')]),'SmsAccountId':Number(_0x53e205[_0xbbd7('0x54')]['id'])});}});}})[_0xbbd7('0x35')](respondWithStatusCode(_0x1523e9,null))['catch'](handleError(_0x1523e9,null));};exports['getAgents']=function(_0x3c4fd7,_0xe9750d,_0x465491){var _0x4f0d77={};var _0x5a2b5d={};var _0x288d59;var _0x48dfe7;return db['SmsAccount'][_0xbbd7('0x63')]({'where':{'id':_0x3c4fd7[_0xbbd7('0x54')]['id']}})[_0xbbd7('0x35')](handleEntityNotFound(_0xe9750d,null))[_0xbbd7('0x35')](function(_0x321b00){if(_0x321b00){_0x288d59=_0x321b00;_0x5a2b5d[_0xbbd7('0x48')]=_[_0xbbd7('0x43')](db[_0xbbd7('0xa7')][_0xbbd7('0x3f')]);_0x5a2b5d[_0xbbd7('0x42')]=_[_0xbbd7('0x43')](_0x3c4fd7[_0xbbd7('0x42')]);_0x5a2b5d['filters']=_['intersection'](_0x5a2b5d[_0xbbd7('0x48')],_0x5a2b5d[_0xbbd7('0x42')]);_0x4f0d77['attributes']=_[_0xbbd7('0x44')](_0x5a2b5d[_0xbbd7('0x48')],qs[_0xbbd7('0x45')](_0x3c4fd7[_0xbbd7('0x42')]['fields']));_0x4f0d77[_0xbbd7('0x46')]=_0x4f0d77[_0xbbd7('0x46')][_0xbbd7('0x47')]?_0x4f0d77['attributes']:_0x5a2b5d[_0xbbd7('0x48')];_0x4f0d77[_0xbbd7('0x4a')]=qs[_0xbbd7('0x4b')](_0x3c4fd7['query'][_0xbbd7('0x4b')]);_0x4f0d77[_0xbbd7('0x4c')]=qs[_0xbbd7('0x4d')](_[_0xbbd7('0x4e')](_0x3c4fd7[_0xbbd7('0x42')],_0x5a2b5d[_0xbbd7('0x4d')]));if(_0x3c4fd7['query']['filter']){_0x4f0d77[_0xbbd7('0x4c')]=_['merge'](_0x4f0d77[_0xbbd7('0x4c')],{'$or':_['map'](_0x4f0d77[_0xbbd7('0x46')],function(_0x1e08d6){var _0x29857f={};_0x29857f[_0x1e08d6]={'$like':'%'+_0x3c4fd7[_0xbbd7('0x42')][_0xbbd7('0x4f')]+'%'};return _0x29857f;})});}_0x4f0d77=_['merge']({},_0x4f0d77,_0x3c4fd7['options']);return _0x288d59[_0xbbd7('0xdf')](_0x4f0d77);}})[_0xbbd7('0x35')](function(_0x1e0792){if(_0x1e0792){_0x48dfe7=_0x1e0792[_0xbbd7('0x47')];if(!_0x3c4fd7['query'][_0xbbd7('0x65')](_0xbbd7('0x49'))){_0x4f0d77['limit']=qs[_0xbbd7('0x2e')](_0x3c4fd7[_0xbbd7('0x42')][_0xbbd7('0x2e')]);_0x4f0d77[_0xbbd7('0x2c')]=qs[_0xbbd7('0x2c')](_0x3c4fd7[_0xbbd7('0x42')][_0xbbd7('0x2c')]);}return _0x288d59[_0xbbd7('0xdf')](_0x4f0d77);}})[_0xbbd7('0x35')](function(_0x49c2c9){if(_0x49c2c9){return _0x49c2c9?{'count':_0x48dfe7,'rows':_0x49c2c9}:null;}})[_0xbbd7('0x35')](respondWithResult(_0xe9750d,null))['catch'](handleError(_0xe9750d,null));}; \ No newline at end of file +var _0x99f0=['VIRTUAL','merge','options','SmsAccount','count','include','findAll','rows','show','Pause','mandatoryDispositionPause','keys','fields','find','create','body','user','role','UserProfileSection','update','params','describe','addDisposition','getDispositions','length','Disposition','removeDispositions','addAnswer','findOne','pick','SmsAccountId','CannedAnswer','removeAnswers','ids','notify','Applications','account','applications','orderBy','priority','asc','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','ListId','mobile','twilio','from','From','Body','messageId','connectel','message_id','plivo','Text','MessageUUID','infobip','results','text','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','refid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','CmContact','Contacts','list','omit','contact','SmsInteraction','spread','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','SmsMessage','AttachmentId','UserId','User','waitForTheAssignedAgent','startRouting','Start','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','set','Content-Type','text/xml','\x0a','transaction','sequelize','Transaction','READ_COMMITTED','SmsApplication','bulkCreate','finally','getApplications','getInteractions','includeAll','Tag','color','tag','to\x20is\x20mandatory','List','out','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','clicksend','status_code','groupName','DELIVERED','redif','skebby','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','ACCEPTD','statusGet','debug','csc','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','offset','undefined','limit','Content-Range','json','reject','destroy','get','SmsAccounts','UserProfileResource','name','send','index','map','rawAttributes','type','model','query','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','filter'];(function(_0x582796,_0x3cb810){var _0x396ffa=function(_0x363b6d){while(--_0x363b6d){_0x582796['push'](_0x582796['shift']());}};_0x396ffa(++_0x3cb810);}(_0x99f0,0x96));var _0x099f=function(_0x53b53e,_0x498437){_0x53b53e=_0x53b53e-0x0;var _0xbb6179=_0x99f0[_0x53b53e];return _0xbb6179;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x099f('0x0'));var jsonpatch=require(_0x099f('0x1'));var rp=require(_0x099f('0x2'));var moment=require(_0x099f('0x3'));var BPromise=require(_0x099f('0x4'));var Mustache=require(_0x099f('0x5'));var util=require(_0x099f('0x6'));var path=require(_0x099f('0x7'));var sox=require(_0x099f('0x8'));var csv=require(_0x099f('0x9'));var ejs=require(_0x099f('0xa'));var fs=require('fs');var fs_extra=require(_0x099f('0xb'));var _=require('lodash');var squel=require(_0x099f('0xc'));var crypto=require(_0x099f('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x099f('0xe'));var Papa=require(_0x099f('0xf'));var Redis=require(_0x099f('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x099f('0x11'));var as=require(_0x099f('0x12'));var hardwareService=require(_0x099f('0x13'));var logger=require(_0x099f('0x14'))(_0x099f('0x15'));var utils=require('../../config/utils');var config=require(_0x099f('0x16'));var licenseUtil=require(_0x099f('0x17'));var db=require(_0x099f('0x18'))['db'];config[_0x099f('0x19')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x099f('0x1a'))(new Redis(config[_0x099f('0x19')]));require(_0x099f('0x1b'))[_0x099f('0x1c')](socket);var jayson=require(_0x099f('0x1d'));var client=jayson[_0x099f('0x1e')]['http']({'port':0x232c});function respondWithRpcPromise(_0x53a611,_0x599347,_0xb33576,_0x1e604f){return new BPromise(function(_0x39f25d,_0x165cfc){var _0xd8d2a6=_0x1e604f||client;return _0xd8d2a6[_0x099f('0x1f')](_0x53a611,_0xb33576)[_0x099f('0x20')](function(_0x271823){logger[_0x099f('0x21')](_0x099f('0x22'),_0x599347,_0x099f('0x23'));logger['debug'](_0x099f('0x24'),_0x599347,_0x099f('0x23'),JSON[_0x099f('0x25')](_0x271823));if(_0x271823[_0x099f('0x26')]){if(_0x271823[_0x099f('0x26')][_0x099f('0x27')]===0x1f4){logger[_0x099f('0x26')](_0x099f('0x22'),_0x599347,_0x271823['error'][_0x099f('0x28')]);return _0x165cfc(_0x271823[_0x099f('0x26')][_0x099f('0x28')]);}logger['error'](_0x099f('0x22'),_0x599347,_0x271823[_0x099f('0x26')]['message']);return _0x39f25d(_0x271823[_0x099f('0x26')][_0x099f('0x28')]);}else{logger['info'](_0x099f('0x22'),_0x599347,'request\x20sent');_0x39f25d(_0x271823[_0x099f('0x29')][_0x099f('0x28')]);}})[_0x099f('0x2a')](function(_0xaf50c7){logger[_0x099f('0x26')](_0x099f('0x22'),_0x599347,_0xaf50c7);_0x165cfc(_0xaf50c7);});});}function respondWithStatusCode(_0x49ee05,_0xfbba72){_0xfbba72=_0xfbba72||0xcc;return function(_0x5c9c93){if(_0x5c9c93){return _0x49ee05[_0x099f('0x2b')](_0xfbba72);}return _0x49ee05[_0x099f('0x2c')](_0xfbba72)[_0x099f('0x2d')]();};}function respondWithResult(_0x4f9dec,_0x4e7f21){_0x4e7f21=_0x4e7f21||0xc8;return function(_0x5966a2){if(_0x5966a2){return _0x4f9dec['status'](_0x4e7f21)['json'](_0x5966a2);}};}function respondWithFilteredResult(_0x28674a,_0x19ec40){return function(_0x7a9f4f){if(_0x7a9f4f){var _0x401ca0=typeof _0x19ec40[_0x099f('0x2e')]===_0x099f('0x2f')&&typeof _0x19ec40[_0x099f('0x30')]===_0x099f('0x2f');var _0x2c6b33=_0x7a9f4f['count'];var _0x38c573=_0x401ca0?0x0:_0x19ec40[_0x099f('0x2e')];var _0x3d88b9=_0x401ca0?_0x7a9f4f['count']:_0x19ec40[_0x099f('0x2e')]+_0x19ec40[_0x099f('0x30')];var _0x36f6bf;if(_0x3d88b9>=_0x2c6b33){_0x3d88b9=_0x2c6b33;_0x36f6bf=0xc8;}else{_0x36f6bf=0xce;}_0x28674a['status'](_0x36f6bf);return _0x28674a['set'](_0x099f('0x31'),_0x38c573+'-'+_0x3d88b9+'/'+_0x2c6b33)[_0x099f('0x32')](_0x7a9f4f);}return null;};}function patchUpdates(_0x51633b){return function(_0x4f4609){try{jsonpatch['apply'](_0x4f4609,_0x51633b,!![]);}catch(_0x30190c){return BPromise[_0x099f('0x33')](_0x30190c);}return _0x4f4609['save']();};}function saveUpdates(_0xb657fb,_0x3d076e){return function(_0x47bb44){if(_0x47bb44){return _0x47bb44['update'](_0xb657fb)[_0x099f('0x20')](function(_0x5c8190){return _0x5c8190;});}return null;};}function removeEntity(_0x396917,_0x32d395){return function(_0x53dbf6){if(_0x53dbf6){return _0x53dbf6[_0x099f('0x34')]()['then'](function(){var _0xf23c40=_0x53dbf6[_0x099f('0x35')]({'plain':!![]});var _0x520bca=_0x099f('0x36');return db[_0x099f('0x37')][_0x099f('0x34')]({'where':{'type':_0x520bca,'resourceId':_0xf23c40['id']}})[_0x099f('0x20')](function(){return _0x53dbf6;});})[_0x099f('0x20')](function(){_0x396917[_0x099f('0x2c')](0xcc)[_0x099f('0x2d')]();});}};}function handleEntityNotFound(_0x5e1ce0,_0x23c863){return function(_0x3f25d2){if(!_0x3f25d2){_0x5e1ce0[_0x099f('0x2b')](0x194);}return _0x3f25d2;};}function handleError(_0x252def,_0x35a15b){_0x35a15b=_0x35a15b||0x1f4;return function(_0x438aa7){logger[_0x099f('0x26')](_0x438aa7['stack']);if(_0x438aa7[_0x099f('0x38')]){delete _0x438aa7[_0x099f('0x38')];}_0x252def['status'](_0x35a15b)[_0x099f('0x39')](_0x438aa7);};}exports[_0x099f('0x3a')]=function(_0x47b184,_0x527613){var _0x4340f0={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x452743={},_0x161f4e={'count':0x0,'rows':[]};var _0x46f088=_[_0x099f('0x3b')](db['SmsAccount'][_0x099f('0x3c')],function(_0x4727fc){return{'name':_0x4727fc['fieldName'],'type':_0x4727fc[_0x099f('0x3d')]['key']};});_0x452743[_0x099f('0x3e')]=_[_0x099f('0x3b')](_0x46f088,_0x099f('0x38'));_0x452743[_0x099f('0x3f')]=_['keys'](_0x47b184[_0x099f('0x3f')]);_0x452743[_0x099f('0x40')]=_[_0x099f('0x41')](_0x452743[_0x099f('0x3e')],_0x452743[_0x099f('0x3f')]);_0x4340f0[_0x099f('0x42')]=_['intersection'](_0x452743[_0x099f('0x3e')],qs['fields'](_0x47b184[_0x099f('0x3f')]['fields']));_0x4340f0[_0x099f('0x42')]=_0x4340f0[_0x099f('0x42')]['length']?_0x4340f0['attributes']:_0x452743[_0x099f('0x3e')];if(!_0x47b184['query'][_0x099f('0x43')](_0x099f('0x44'))){_0x4340f0[_0x099f('0x30')]=qs[_0x099f('0x30')](_0x47b184[_0x099f('0x3f')][_0x099f('0x30')]);_0x4340f0[_0x099f('0x2e')]=qs[_0x099f('0x2e')](_0x47b184[_0x099f('0x3f')][_0x099f('0x2e')]);}_0x4340f0[_0x099f('0x45')]=qs[_0x099f('0x46')](_0x47b184[_0x099f('0x3f')]['sort']);_0x4340f0[_0x099f('0x47')]=qs[_0x099f('0x40')](_['pick'](_0x47b184[_0x099f('0x3f')],_0x452743['filters']),_0x46f088);if(_0x47b184[_0x099f('0x3f')][_0x099f('0x48')]){_0x4340f0[_0x099f('0x47')]=_['merge'](_0x4340f0[_0x099f('0x47')],{'$or':_[_0x099f('0x3b')](_0x46f088,function(_0x550edd){if(_0x550edd[_0x099f('0x3d')]!==_0x099f('0x49')){var _0x569198={};_0x569198[_0x550edd[_0x099f('0x38')]]={'$like':'%'+_0x47b184['query'][_0x099f('0x48')]+'%'};return _0x569198;}})});}_0x4340f0=_[_0x099f('0x4a')]({},_0x4340f0,_0x47b184[_0x099f('0x4b')]);var _0x1a1ff0={'where':_0x4340f0[_0x099f('0x47')]};return db[_0x099f('0x4c')][_0x099f('0x4d')](_0x1a1ff0)[_0x099f('0x20')](function(_0x399e08){_0x161f4e['count']=_0x399e08;if(_0x47b184[_0x099f('0x3f')]['includeAll']){_0x4340f0[_0x099f('0x4e')]=[{'all':!![]}];}return db[_0x099f('0x4c')][_0x099f('0x4f')](_0x4340f0);})['then'](function(_0x162e27){_0x161f4e[_0x099f('0x50')]=_0x162e27;return _0x161f4e;})['then'](respondWithFilteredResult(_0x527613,_0x4340f0))[_0x099f('0x2a')](handleError(_0x527613,null));};exports[_0x099f('0x51')]=function(_0x297310,_0x326a64){var _0x52d9be={'raw':![],'where':{'id':_0x297310['params']['id']},'include':[{'model':db[_0x099f('0x52')],'as':_0x099f('0x53')}]},_0x251610={};_0x251610['model']=_[_0x099f('0x54')](db[_0x099f('0x4c')][_0x099f('0x3c')]);_0x251610[_0x099f('0x3f')]=_[_0x099f('0x54')](_0x297310[_0x099f('0x3f')]);_0x251610['filters']=_['intersection'](_0x251610['model'],_0x251610[_0x099f('0x3f')]);_0x52d9be[_0x099f('0x42')]=_[_0x099f('0x41')](_0x251610[_0x099f('0x3e')],qs[_0x099f('0x55')](_0x297310['query']['fields']));_0x52d9be[_0x099f('0x42')]=_0x52d9be['attributes']['length']?_0x52d9be['attributes']:_0x251610[_0x099f('0x3e')];if(_0x297310[_0x099f('0x3f')]['includeAll']){_0x52d9be[_0x099f('0x4e')]=[{'all':!![]}];}_0x52d9be=_[_0x099f('0x4a')]({},_0x52d9be,_0x297310['options']);return db[_0x099f('0x4c')][_0x099f('0x56')](_0x52d9be)['then'](handleEntityNotFound(_0x326a64,null))[_0x099f('0x20')](respondWithResult(_0x326a64,null))[_0x099f('0x2a')](handleError(_0x326a64,null));};exports['create']=function(_0x43b2ea,_0x368f39){return db[_0x099f('0x4c')][_0x099f('0x57')](_0x43b2ea[_0x099f('0x58')],{})[_0x099f('0x20')](function(_0x331c5b){var _0x5b103a=_0x43b2ea[_0x099f('0x59')]['get']({'plain':!![]});if(!_0x5b103a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5b103a[_0x099f('0x5a')]==='user'){var _0x13f162=_0x331c5b['get']({'plain':!![]});var _0x43a423='SmsAccounts';return db[_0x099f('0x5b')][_0x099f('0x56')]({'where':{'name':_0x43a423,'userProfileId':_0x5b103a['userProfileId']},'raw':!![]})[_0x099f('0x20')](function(_0x52fcae){if(_0x52fcae&&_0x52fcae['autoAssociation']===0x0){return db[_0x099f('0x37')][_0x099f('0x57')]({'name':_0x13f162[_0x099f('0x38')],'resourceId':_0x13f162['id'],'type':_0x52fcae[_0x099f('0x38')],'sectionId':_0x52fcae['id']},{})['then'](function(){return _0x331c5b;});}else{return _0x331c5b;}})['catch'](function(_0x1fc523){logger[_0x099f('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1fc523);throw _0x1fc523;});}return _0x331c5b;})['then'](respondWithResult(_0x368f39,0xc9))[_0x099f('0x2a')](handleError(_0x368f39,null));};exports[_0x099f('0x5c')]=function(_0x370ef3,_0x1aab9e){if(_0x370ef3[_0x099f('0x58')]['id']){delete _0x370ef3[_0x099f('0x58')]['id'];}return db[_0x099f('0x4c')][_0x099f('0x56')]({'where':{'id':_0x370ef3[_0x099f('0x5d')]['id']},'include':[{'model':db['Pause'],'as':_0x099f('0x53')}]})[_0x099f('0x20')](handleEntityNotFound(_0x1aab9e,null))[_0x099f('0x20')](saveUpdates(_0x370ef3[_0x099f('0x58')],null))[_0x099f('0x20')](respondWithResult(_0x1aab9e,null))[_0x099f('0x2a')](handleError(_0x1aab9e,null));};exports['destroy']=function(_0x247cc9,_0x5dff6c){return db[_0x099f('0x4c')][_0x099f('0x56')]({'where':{'id':_0x247cc9[_0x099f('0x5d')]['id']}})['then'](handleEntityNotFound(_0x5dff6c,null))[_0x099f('0x20')](removeEntity(_0x5dff6c,null))[_0x099f('0x2a')](handleError(_0x5dff6c,null));};exports[_0x099f('0x5e')]=function(_0x1729a1,_0x5c64c){return db[_0x099f('0x4c')][_0x099f('0x5e')]()[_0x099f('0x20')](respondWithResult(_0x5c64c,null))[_0x099f('0x2a')](handleError(_0x5c64c,null));};exports[_0x099f('0x5f')]=function(_0x29126b,_0x30e230,_0x389de1){if(_0x29126b['body']['id']){delete _0x29126b[_0x099f('0x58')]['id'];}return db[_0x099f('0x4c')][_0x099f('0x56')]({'where':{'id':_0x29126b[_0x099f('0x5d')]['id']}})[_0x099f('0x20')](handleEntityNotFound(_0x30e230,null))[_0x099f('0x20')](function(_0x45ac44){if(_0x45ac44){_0x29126b[_0x099f('0x58')]['SmsAccountId']=_0x45ac44['id'];return db['Disposition']['create'](_0x29126b[_0x099f('0x58')]);}})['then'](respondWithResult(_0x30e230,null))[_0x099f('0x2a')](handleError(_0x30e230,null));};exports[_0x099f('0x60')]=function(_0x344ee7,_0x4e8880,_0x69502b){var _0x2099b7={'raw':![],'where':{}};var _0x1f5a41={};var _0x5e15ac={'count':0x0,'rows':[]};return db[_0x099f('0x4c')]['findOne']({'where':{'id':_0x344ee7[_0x099f('0x5d')]['id']}})[_0x099f('0x20')](handleEntityNotFound(_0x4e8880,null))[_0x099f('0x20')](function(_0x4022f5){if(_0x4022f5){_0x1f5a41[_0x099f('0x3e')]=_['keys'](db['Disposition'][_0x099f('0x3c')]);_0x1f5a41[_0x099f('0x3f')]=_['keys'](_0x344ee7[_0x099f('0x3f')]);_0x1f5a41[_0x099f('0x40')]=_[_0x099f('0x41')](_0x1f5a41[_0x099f('0x3e')],_0x1f5a41[_0x099f('0x3f')]);_0x2099b7[_0x099f('0x42')]=_[_0x099f('0x41')](_0x1f5a41[_0x099f('0x3e')],qs[_0x099f('0x55')](_0x344ee7[_0x099f('0x3f')][_0x099f('0x55')]));_0x2099b7[_0x099f('0x42')]=_0x2099b7[_0x099f('0x42')][_0x099f('0x61')]?_0x2099b7[_0x099f('0x42')]:_0x1f5a41[_0x099f('0x3e')];if(!_0x344ee7[_0x099f('0x3f')][_0x099f('0x43')](_0x099f('0x44'))){_0x2099b7[_0x099f('0x30')]=qs['limit'](_0x344ee7[_0x099f('0x3f')][_0x099f('0x30')]);_0x2099b7['offset']=qs[_0x099f('0x2e')](_0x344ee7[_0x099f('0x3f')]['offset']);}_0x2099b7[_0x099f('0x45')]=qs[_0x099f('0x46')](_0x344ee7[_0x099f('0x3f')][_0x099f('0x46')]);_0x2099b7[_0x099f('0x47')]=qs['filters'](_['pick'](_0x344ee7[_0x099f('0x3f')],_0x1f5a41['filters']));_0x2099b7[_0x099f('0x47')]['SmsAccountId']=_0x4022f5['id'];if(_0x344ee7[_0x099f('0x3f')][_0x099f('0x48')]){_0x2099b7['where']=_[_0x099f('0x4a')](_0x2099b7[_0x099f('0x47')],{'$or':_[_0x099f('0x3b')](_0x2099b7[_0x099f('0x42')],function(_0x14b007){var _0xb02f29={};_0xb02f29[_0x14b007]={'$like':'%'+_0x344ee7[_0x099f('0x3f')][_0x099f('0x48')]+'%'};return _0xb02f29;})});}_0x2099b7=_[_0x099f('0x4a')]({},_0x2099b7,_0x344ee7['options']);return db[_0x099f('0x62')][_0x099f('0x4d')]({'where':_0x2099b7[_0x099f('0x47')]})[_0x099f('0x20')](function(_0xac1145){_0x5e15ac[_0x099f('0x4d')]=_0xac1145;if(_0x344ee7[_0x099f('0x3f')]['includeAll']){_0x2099b7[_0x099f('0x4e')]=[{'all':!![]}];}return db[_0x099f('0x62')][_0x099f('0x4f')](_0x2099b7);})[_0x099f('0x20')](function(_0x5708a7){_0x5e15ac['rows']=_0x5708a7;return _0x5e15ac;});}})[_0x099f('0x20')](respondWithFilteredResult(_0x4e8880,_0x2099b7))[_0x099f('0x2a')](handleError(_0x4e8880,null));};exports[_0x099f('0x63')]=function(_0x47935e,_0x81b4f4,_0x508b2c){return db[_0x099f('0x4c')]['find']({'where':{'id':_0x47935e['params']['id']}})[_0x099f('0x20')](handleEntityNotFound(_0x81b4f4,null))[_0x099f('0x20')](function(_0x18eeb8){if(_0x18eeb8){return _0x18eeb8[_0x099f('0x63')](_0x47935e[_0x099f('0x3f')]['ids']);}})[_0x099f('0x20')](respondWithStatusCode(_0x81b4f4,null))[_0x099f('0x2a')](handleError(_0x81b4f4,null));};exports[_0x099f('0x64')]=function(_0x410960,_0x37b84a,_0x524320){if(_0x410960[_0x099f('0x58')]['id']){delete _0x410960[_0x099f('0x58')]['id'];}return db[_0x099f('0x4c')][_0x099f('0x56')]({'where':{'id':_0x410960['params']['id']}})[_0x099f('0x20')](handleEntityNotFound(_0x37b84a,null))['then'](function(_0x3d204e){if(_0x3d204e){_0x410960['body']['SmsAccountId']=_0x3d204e['id'];return db['CannedAnswer'][_0x099f('0x57')](_0x410960['body']);}})[_0x099f('0x20')](respondWithResult(_0x37b84a,null))[_0x099f('0x2a')](handleError(_0x37b84a,null));};exports['getAnswers']=function(_0x3af034,_0x2decaf,_0x1ef0a8){var _0x1d1732={'raw':![],'where':{}};var _0x466ce2={};var _0x49d516={'count':0x0,'rows':[]};return db[_0x099f('0x4c')][_0x099f('0x65')]({'where':{'id':_0x3af034[_0x099f('0x5d')]['id']}})[_0x099f('0x20')](handleEntityNotFound(_0x2decaf,null))[_0x099f('0x20')](function(_0x2f769d){if(_0x2f769d){_0x466ce2[_0x099f('0x3e')]=_[_0x099f('0x54')](db['CannedAnswer'][_0x099f('0x3c')]);_0x466ce2[_0x099f('0x3f')]=_['keys'](_0x3af034[_0x099f('0x3f')]);_0x466ce2[_0x099f('0x40')]=_['intersection'](_0x466ce2[_0x099f('0x3e')],_0x466ce2[_0x099f('0x3f')]);_0x1d1732[_0x099f('0x42')]=_[_0x099f('0x41')](_0x466ce2['model'],qs[_0x099f('0x55')](_0x3af034['query'][_0x099f('0x55')]));_0x1d1732[_0x099f('0x42')]=_0x1d1732['attributes']['length']?_0x1d1732[_0x099f('0x42')]:_0x466ce2[_0x099f('0x3e')];if(!_0x3af034[_0x099f('0x3f')][_0x099f('0x43')]('nolimit')){_0x1d1732['limit']=qs[_0x099f('0x30')](_0x3af034[_0x099f('0x3f')][_0x099f('0x30')]);_0x1d1732[_0x099f('0x2e')]=qs[_0x099f('0x2e')](_0x3af034[_0x099f('0x3f')][_0x099f('0x2e')]);}_0x1d1732[_0x099f('0x45')]=qs[_0x099f('0x46')](_0x3af034[_0x099f('0x3f')][_0x099f('0x46')]);_0x1d1732[_0x099f('0x47')]=qs['filters'](_[_0x099f('0x66')](_0x3af034['query'],_0x466ce2[_0x099f('0x40')]));_0x1d1732[_0x099f('0x47')][_0x099f('0x67')]=_0x2f769d['id'];if(_0x3af034['query'][_0x099f('0x48')]){_0x1d1732[_0x099f('0x47')]=_[_0x099f('0x4a')](_0x1d1732[_0x099f('0x47')],{'$or':_[_0x099f('0x3b')](_0x1d1732[_0x099f('0x42')],function(_0x4e6a20){var _0x39a5e6={};_0x39a5e6[_0x4e6a20]={'$like':'%'+_0x3af034[_0x099f('0x3f')][_0x099f('0x48')]+'%'};return _0x39a5e6;})});}_0x1d1732=_[_0x099f('0x4a')]({},_0x1d1732,_0x3af034['options']);return db[_0x099f('0x68')][_0x099f('0x4d')]({'where':_0x1d1732[_0x099f('0x47')]})[_0x099f('0x20')](function(_0x377e3a){_0x49d516[_0x099f('0x4d')]=_0x377e3a;if(_0x3af034[_0x099f('0x3f')]['includeAll']){_0x1d1732[_0x099f('0x4e')]=[{'all':!![]}];}return db[_0x099f('0x68')][_0x099f('0x4f')](_0x1d1732);})[_0x099f('0x20')](function(_0x211ead){_0x49d516[_0x099f('0x50')]=_0x211ead;return _0x49d516;});}})['then'](respondWithFilteredResult(_0x2decaf,_0x1d1732))['catch'](handleError(_0x2decaf,null));};exports[_0x099f('0x69')]=function(_0x197fdb,_0x4bd8d5,_0x170fae){return db[_0x099f('0x4c')][_0x099f('0x56')]({'where':{'id':_0x197fdb[_0x099f('0x5d')]['id']}})[_0x099f('0x20')](handleEntityNotFound(_0x4bd8d5,null))[_0x099f('0x20')](function(_0xccd0dd){if(_0xccd0dd){return _0xccd0dd[_0x099f('0x69')](_0x197fdb['query'][_0x099f('0x6a')]);}})[_0x099f('0x20')](respondWithStatusCode(_0x4bd8d5,null))[_0x099f('0x2a')](handleError(_0x4bd8d5,null));};exports[_0x099f('0x6b')]=function(_0x471dd7,_0x431575,_0x3c501e){var _0x11a0a8={'channel':'sms'};var _0xfa3270=[];var _0x1d0b17=[];var _0x1dca67={};return db[_0x099f('0x4c')]['find']({'where':{'id':_0x471dd7[_0x099f('0x5d')]['id']},'include':[{'model':db['SmsApplication'],'as':_0x099f('0x6c')}]})[_0x099f('0x20')](handleEntityNotFound(_0x431575,null))[_0x099f('0x20')](function(_0x2aab2d){_0x11a0a8[_0x099f('0x6d')]=_0x2aab2d;_0x11a0a8[_0x099f('0x6e')]=_[_0x099f('0x6f')](_0x2aab2d[_0x099f('0x6c')],[_0x099f('0x70')],[_0x099f('0x71')]);if(_0x11a0a8[_0x099f('0x6d')][_0x099f('0x6c')]){delete _0x11a0a8[_0x099f('0x6d')][_0x099f('0x6c')];}return db['CmContact'][_0x099f('0x5e')]();})[_0x099f('0x20')](function(_0x359717){if(!_0x359717){throw new db[(_0x099f('0x72'))][(_0x099f('0x73'))](_0x099f('0x74'));}_0xfa3270=_['difference'](_['keys'](_0x359717),[_0x099f('0x75'),_0x099f('0x76')]);_0x1d0b17=_[_0x099f('0x77')](_[_0x099f('0x54')](_0x359717),['createdAt',_0x099f('0x76'),_0x099f('0x78'),_0x099f('0x79')]);_0x11a0a8[_0x099f('0x58')]={'mapKey':_0x099f('0x7a')};if(_0x11a0a8[_0x099f('0x6d')][_0x099f('0x3d')]){switch(_0x11a0a8[_0x099f('0x6d')][_0x099f('0x3d')]){case _0x099f('0x7b'):_0x11a0a8[_0x099f('0x58')][_0x099f('0x7c')]=_0x471dd7['body'][_0x099f('0x7d')];_0x11a0a8[_0x099f('0x58')][_0x099f('0x58')]=_0x471dd7[_0x099f('0x58')][_0x099f('0x7e')];_0x11a0a8[_0x099f('0x58')][_0x099f('0x7f')]=_0x471dd7[_0x099f('0x58')]['MessageSid'];break;case'skebby':_0x11a0a8[_0x099f('0x58')][_0x099f('0x7c')]='+'+_0x471dd7['body']['sender'];_0x11a0a8[_0x099f('0x58')][_0x099f('0x58')]=_0x471dd7['body']['text'];break;case _0x099f('0x80'):_0x11a0a8[_0x099f('0x58')][_0x099f('0x7c')]=_0x471dd7[_0x099f('0x58')][_0x099f('0x7c')];_0x11a0a8['body'][_0x099f('0x58')]=_0x471dd7['body'][_0x099f('0x28')];break;case'clicksend':_0x11a0a8[_0x099f('0x58')][_0x099f('0x7c')]=_0x471dd7[_0x099f('0x58')][_0x099f('0x7c')];_0x11a0a8[_0x099f('0x58')][_0x099f('0x58')]=_0x471dd7[_0x099f('0x58')][_0x099f('0x58')];_0x11a0a8[_0x099f('0x58')][_0x099f('0x7f')]=_0x471dd7[_0x099f('0x58')][_0x099f('0x81')];break;case _0x099f('0x82'):_0x11a0a8['body'][_0x099f('0x7c')]=_0x471dd7[_0x099f('0x58')][_0x099f('0x7d')];_0x11a0a8[_0x099f('0x58')][_0x099f('0x58')]=_0x471dd7[_0x099f('0x58')][_0x099f('0x83')];_0x11a0a8[_0x099f('0x58')][_0x099f('0x7f')]=_0x471dd7[_0x099f('0x58')][_0x099f('0x84')];break;case _0x099f('0x85'):_0x11a0a8[_0x099f('0x58')][_0x099f('0x7c')]='+'+_0x471dd7[_0x099f('0x58')]['results'][0x0]['from'];_0x11a0a8[_0x099f('0x58')][_0x099f('0x58')]=_0x471dd7[_0x099f('0x58')][_0x099f('0x86')][0x0][_0x099f('0x87')];_0x11a0a8[_0x099f('0x58')][_0x099f('0x7f')]=_0x471dd7[_0x099f('0x58')][_0x099f('0x86')][0x0][_0x099f('0x7f')];break;case'csc':_0x11a0a8[_0x099f('0x58')]['from']=_0x471dd7[_0x099f('0x58')][_0x099f('0x88')];_0x11a0a8[_0x099f('0x58')][_0x099f('0x58')]=_0x471dd7['body'][_0x099f('0x89')][_0x099f('0x28')];break;case _0x099f('0x8a'):_0x11a0a8[_0x099f('0x58')][_0x099f('0x7c')]=_0x471dd7['body'][_0x099f('0x8b')];_0x11a0a8[_0x099f('0x58')][_0x099f('0x58')]=_0x471dd7['body']['text'];_0x11a0a8[_0x099f('0x58')]['messageId']=_0x471dd7[_0x099f('0x58')][_0x099f('0x8c')];break;case _0x099f('0x8d'):_0x11a0a8[_0x099f('0x58')]['messageId']=_0x471dd7['body'][0x0][_0x099f('0x28')]['id'];_0x11a0a8[_0x099f('0x58')][_0x099f('0x7c')]=_0x471dd7[_0x099f('0x58')][0x0]['message']['from'];_0x11a0a8[_0x099f('0x58')]['body']=_0x471dd7['body'][0x0]['message'][_0x099f('0x87')];break;case _0x099f('0x8e'):_0x11a0a8[_0x099f('0x58')][_0x099f('0x7c')]=_0x471dd7['body'][_0x099f('0x7c')];_0x11a0a8[_0x099f('0x58')]['body']=_0x471dd7[_0x099f('0x58')][_0x099f('0x28')];_0x11a0a8['body'][_0x099f('0x7f')]=_0x471dd7[_0x099f('0x58')][_0x099f('0x8f')];break;}}if(_0x11a0a8[_0x099f('0x58')]['id']){delete _0x11a0a8[_0x099f('0x58')]['id'];}if(_[_0x099f('0x90')](_0x11a0a8['body'][_0x099f('0x7c')])){throw new db[(_0x099f('0x72'))][(_0x099f('0x73'))](_0x099f('0x91'));}if(_['isNil'](_0x11a0a8[_0x099f('0x58')][_0x099f('0x58')])||_0x11a0a8[_0x099f('0x58')]['body']===''){throw new db[(_0x099f('0x72'))][(_0x099f('0x73'))](_0x099f('0x92'));}if(_[_0x099f('0x90')](_0x11a0a8[_0x099f('0x58')][_0x099f('0x93')])){throw new db[(_0x099f('0x72'))][(_0x099f('0x73'))](_0x099f('0x94')+_0x1d0b17);}if(!_['includes'](_0x1d0b17,_0x11a0a8['body'][_0x099f('0x93')])){throw new db['Sequelize']['ValidationError'](_0x099f('0x95')+_0x1d0b17);}_0x1dca67[_0x11a0a8[_0x099f('0x58')][_0x099f('0x93')]]=_0x11a0a8[_0x099f('0x58')][_0x099f('0x7c')];return db[_0x099f('0x96')][_0x099f('0x56')]({'where':{'id':_0x11a0a8[_0x099f('0x6d')]['ListId']},'include':[{'model':db[_0x099f('0x97')],'as':_0x099f('0x98'),'where':_0x1dca67,'limit':0x1,'order':[[_0x099f('0x76'),'DESC']]}]});})[_0x099f('0x20')](handleEntityNotFound(_0x431575,null))[_0x099f('0x20')](function(_0x3fc899){if(_0x3fc899){_0x11a0a8[_0x099f('0x99')]=_[_0x099f('0x9a')](_0x3fc899,['Contacts']);if(_0x3fc899['Contacts'][_0x099f('0x61')]){return _0x3fc899[_0x099f('0x98')][0x0];}var _0x5283af=_['defaults'](_0x11a0a8[_0x099f('0x58')],{'firstName':_0x11a0a8[_0x099f('0x58')][_0x099f('0x7c')],'ListId':_0x3fc899['id']});_0x5283af[_0x11a0a8['body'][_0x099f('0x93')]]=_0x11a0a8[_0x099f('0x58')][_0x099f('0x7c')];return db[_0x099f('0x97')][_0x099f('0x57')](_0x5283af,{'fields':_0xfa3270,'raw':!![]});}})['then'](handleEntityNotFound(_0x431575,null))[_0x099f('0x20')](function(_0x491e31){if(_0x491e31){_0x11a0a8[_0x099f('0x9b')]=_0x491e31;var _0x38ae72={'ContactId':_0x491e31['id'],'phone':_0x11a0a8[_0x099f('0x58')][_0x099f('0x7c')],'SmsAccountId':_0x471dd7['params']['id']};var _0x1cf798={'ContactId':_0x491e31['id'],'SmsAccountId':_0x471dd7[_0x099f('0x5d')]['id'],'closed':![]};return db[_0x099f('0x9c')]['find']({'where':_0x1cf798})[_0x099f('0x20')](function(_0x5155de){if(_0x5155de){return[_0x5155de,![]];}return db['SmsInteraction'][_0x099f('0x57')](_0x38ae72)['then'](function(_0x1c1e00){return[_0x1c1e00,!![]];});});}})[_0x099f('0x9d')](function(_0x881576,_0x13cb80){_0x11a0a8[_0x099f('0x9e')]=_0x881576[_0x099f('0x35')]({'plain':!![]});_0x11a0a8['interaction'][_0x099f('0x9f')]=![];if(_0x13cb80){if(_0x11a0a8['account'][_0x099f('0xa0')]){_0x11a0a8[_0x099f('0x6e')][_0x099f('0xa1')]({'id':0x0,'priority':_0x11a0a8['applications'][_0x099f('0x61')]+0x1,'app':_0x099f('0xa2'),'appdata':_0x099f('0xa3'),'interval':_0x099f('0xa4')});}_0x11a0a8[_0x099f('0x9e')][_0x099f('0x9f')]=!![];}return db[_0x099f('0xa5')][_0x099f('0x57')]({'phone':_0x11a0a8[_0x099f('0x58')][_0x099f('0x7c')],'messageId':_0x11a0a8['body'][_0x099f('0x7f')],'body':_0x11a0a8['body']['body'],'SmsAccountId':_0x471dd7[_0x099f('0x5d')]['id'],'SmsInteractionId':_0x881576['id'],'direction':'in','ContactId':_0x881576['ContactId'],'AttachmentId':_0x11a0a8[_0x099f('0x58')][_0x099f('0xa6')]});})[_0x099f('0x20')](function(_0x122503){_0x11a0a8[_0x099f('0x28')]=_0x122503;if(_0x11a0a8[_0x099f('0x9e')][_0x099f('0xa7')]){return db[_0x099f('0xa8')][_0x099f('0x56')]({'attributes':['id',_0x099f('0x38')],'where':{'id':_0x11a0a8['interaction'][_0x099f('0xa7')]}})[_0x099f('0x20')](function(_0x25c065){if(_0x25c065){_0x11a0a8['applications']['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x25c065[_0x099f('0x38')]+','+(_0x11a0a8[_0x099f('0x6d')][_0x099f('0xa9')]||0xa),'interval':_0x099f('0xa4')});}return respondWithRpcPromise('Start',_0x099f('0xaa'),_0x11a0a8);});}return respondWithRpcPromise(_0x099f('0xab'),_0x099f('0xaa'),_0x11a0a8);})[_0x099f('0x20')](function(_0x2fac76){if(_0x2fac76){var _0x43f081=0xc8;var _0x3a2457='receiveMessage';logger[_0x099f('0x21')](_0x099f('0x24'),_0x3a2457,_0x43f081,_0x099f('0xac'));logger['debug'](_0x099f('0xad'),_0x3a2457,_0x43f081,_0x099f('0xac'),JSON['stringify'](_0x2fac76));if(_0x11a0a8[_0x099f('0x6d')]['type']===_0x099f('0x7b')){return _0x431575[_0x099f('0x2c')](_0x43f081)[_0x099f('0xae')](_0x099f('0xaf'),_0x099f('0xb0'))[_0x099f('0x39')](_0x099f('0xb1'));}else{return _0x431575[_0x099f('0x2c')](_0x43f081)[_0x099f('0x32')](_0x2fac76);}}})[_0x099f('0x2a')](handleError(_0x431575,null));};exports['addApplications']=function(_0x134bd2,_0x422dce){var _0x22cc27=_0x134bd2[_0x099f('0x5d')]['id'];var _0x29839f=_0x134bd2[_0x099f('0x58')];var _0x133bbc=0xc8;var _0x3d9f0f=null;return db['sequelize'][_0x099f('0xb2')]({'isolationLevel':db[_0x099f('0xb3')][_0x099f('0xb4')]['ISOLATION_LEVELS'][_0x099f('0xb5')]},function(_0xf5e65a){return db[_0x099f('0x4c')][_0x099f('0x65')]({'where':{'id':_0x22cc27},'transaction':_0xf5e65a})['then'](function(_0x2899b6){if(_0x2899b6){return db[_0x099f('0xb6')]['destroy']({'where':{'SmsAccountId':_0x22cc27},'transaction':_0xf5e65a})[_0x099f('0x20')](function(){var _0x5ab0f0=_[_0x099f('0x3b')](_0x29839f,function(_0x4b59e2){_0x4b59e2[_0x099f('0x67')]=_0x22cc27;return _0x4b59e2;});return db['SmsApplication'][_0x099f('0xb7')](_0x5ab0f0,{'transaction':_0xf5e65a});});}else{_0x133bbc=0x194;_0x3d9f0f=[];}});})[_0x099f('0x20')](function(){if(_0x133bbc!==0x194){return db[_0x099f('0xb6')]['findAndCountAll']({'where':{'SmsAccountId':_0x22cc27},'order':_0x099f('0x70')})[_0x099f('0x20')](function(_0x2d4ce0){_0x3d9f0f=_0x2d4ce0;});}})[_0x099f('0x2a')](function(_0x1ee619){_0x133bbc=0x1f4;logger[_0x099f('0x26')](_0x1ee619['stack']);if(_0x1ee619[_0x099f('0x38')]){delete _0x1ee619[_0x099f('0x38')];}_0x3d9f0f=_0x1ee619;})[_0x099f('0xb8')](function(){if(_0x3d9f0f===null){_0x422dce[_0x099f('0x2b')](_0x133bbc);}else{if(_0x133bbc===0x1f4){_0x422dce['status'](_0x133bbc)[_0x099f('0x39')](_0x3d9f0f);}else{_0x422dce[_0x099f('0x2c')](_0x133bbc)[_0x099f('0x32')](_0x3d9f0f);}}});};exports[_0x099f('0xb9')]=function(_0x44a8f1,_0x528c24,_0x2a88e2){var _0x518a9f={};var _0x493351={};var _0xfb36d5;var _0x82e0a9;return db[_0x099f('0x4c')][_0x099f('0x65')]({'where':{'id':_0x44a8f1['params']['id']}})[_0x099f('0x20')](handleEntityNotFound(_0x528c24,null))[_0x099f('0x20')](function(_0x2499ac){if(_0x2499ac){_0xfb36d5=_0x2499ac;_0x493351[_0x099f('0x3e')]=_[_0x099f('0x54')](db[_0x099f('0xb6')][_0x099f('0x3c')]);_0x493351[_0x099f('0x3f')]=_['keys'](_0x44a8f1['query']);_0x493351[_0x099f('0x40')]=_[_0x099f('0x41')](_0x493351[_0x099f('0x3e')],_0x493351[_0x099f('0x3f')]);_0x518a9f['attributes']=_['intersection'](_0x493351[_0x099f('0x3e')],qs[_0x099f('0x55')](_0x44a8f1[_0x099f('0x3f')][_0x099f('0x55')]));_0x518a9f['attributes']=_0x518a9f['attributes'][_0x099f('0x61')]?_0x518a9f['attributes']:_0x493351[_0x099f('0x3e')];_0x518a9f[_0x099f('0x45')]=qs[_0x099f('0x46')](_0x44a8f1['query'][_0x099f('0x46')]);_0x518a9f['where']=qs['filters'](_['pick'](_0x44a8f1[_0x099f('0x3f')],_0x493351['filters']));if(_0x44a8f1[_0x099f('0x3f')][_0x099f('0x48')]){_0x518a9f[_0x099f('0x47')]=_['merge'](_0x518a9f[_0x099f('0x47')],{'$or':_[_0x099f('0x3b')](_0x518a9f['attributes'],function(_0x4a8648){var _0x4879cb={};_0x4879cb[_0x4a8648]={'$like':'%'+_0x44a8f1['query'][_0x099f('0x48')]+'%'};return _0x4879cb;})});}_0x518a9f=_['merge']({},_0x518a9f,_0x44a8f1[_0x099f('0x4b')]);return _0xfb36d5[_0x099f('0xb9')](_0x518a9f);}})[_0x099f('0x20')](function(_0x487400){if(_0x487400){_0x82e0a9=_0x487400['length'];if(!_0x44a8f1[_0x099f('0x3f')][_0x099f('0x43')](_0x099f('0x44'))){_0x518a9f['limit']=qs[_0x099f('0x30')](_0x44a8f1[_0x099f('0x3f')][_0x099f('0x30')]);_0x518a9f[_0x099f('0x2e')]=qs[_0x099f('0x2e')](_0x44a8f1['query'][_0x099f('0x2e')]);}return _0xfb36d5[_0x099f('0xb9')](_0x518a9f);}})['then'](function(_0x191314){if(_0x191314){return _0x191314?{'count':_0x82e0a9,'rows':_0x191314}:null;}})[_0x099f('0x20')](respondWithResult(_0x528c24,null))[_0x099f('0x2a')](handleError(_0x528c24,null));};exports[_0x099f('0xba')]=function(_0x57d16b,_0x48b0be,_0x4a6992){var _0x2ed079={'raw':![],'where':{}};var _0x445ea5={};var _0x44d278={'count':0x0,'rows':[]};return db[_0x099f('0x4c')][_0x099f('0x65')]({'where':{'id':_0x57d16b[_0x099f('0x5d')]['id']}})[_0x099f('0x20')](handleEntityNotFound(_0x48b0be,null))['then'](function(_0x2bbe4f){if(_0x2bbe4f){_0x445ea5[_0x099f('0x3e')]=_[_0x099f('0x54')](db[_0x099f('0x9c')]['rawAttributes']);_0x445ea5['query']=_[_0x099f('0x54')](_0x57d16b[_0x099f('0x3f')]);_0x445ea5[_0x099f('0x40')]=_[_0x099f('0x41')](_0x445ea5[_0x099f('0x3e')],_0x445ea5[_0x099f('0x3f')]);_0x2ed079[_0x099f('0x42')]=_[_0x099f('0x41')](_0x445ea5[_0x099f('0x3e')],qs[_0x099f('0x55')](_0x57d16b[_0x099f('0x3f')][_0x099f('0x55')]));_0x2ed079[_0x099f('0x42')]=_0x2ed079[_0x099f('0x42')][_0x099f('0x61')]?_0x2ed079[_0x099f('0x42')]:_0x445ea5[_0x099f('0x3e')];if(!_0x57d16b[_0x099f('0x3f')][_0x099f('0x43')](_0x099f('0x44'))){_0x2ed079[_0x099f('0x30')]=qs[_0x099f('0x30')](_0x57d16b[_0x099f('0x3f')]['limit']);_0x2ed079[_0x099f('0x2e')]=qs[_0x099f('0x2e')](_0x57d16b[_0x099f('0x3f')]['offset']);}_0x2ed079['order']=qs[_0x099f('0x46')](_0x57d16b[_0x099f('0x3f')]['sort']);_0x2ed079[_0x099f('0x47')]=qs[_0x099f('0x40')](_[_0x099f('0x66')](_0x57d16b['query'],_0x445ea5[_0x099f('0x40')]));_0x2ed079['where'][_0x099f('0x67')]=_0x2bbe4f['id'];if(_0x57d16b['query'][_0x099f('0x48')]){_0x2ed079[_0x099f('0x47')]=_['merge'](_0x2ed079['where'],{'$or':_[_0x099f('0x3b')](_0x2ed079[_0x099f('0x42')],function(_0x1206da){var _0x4dd518={};_0x4dd518[_0x1206da]={'$like':'%'+_0x57d16b['query'][_0x099f('0x48')]+'%'};return _0x4dd518;})});}_0x2ed079=_['merge']({},_0x2ed079,_0x57d16b[_0x099f('0x4b')]);return db[_0x099f('0x9c')][_0x099f('0x4d')]({'where':_0x2ed079[_0x099f('0x47')]})[_0x099f('0x20')](function(_0x509345){_0x44d278[_0x099f('0x4d')]=_0x509345;if(_0x57d16b[_0x099f('0x3f')][_0x099f('0xbb')]){_0x2ed079[_0x099f('0x4e')]=[{'model':db[_0x099f('0x97')],'as':'Contact','required':![]},{'model':db[_0x099f('0xa8')],'as':'Owner','attributes':[_0x099f('0x38'),'fullname','internal'],'required':![]},{'model':db[_0x099f('0xbc')],'as':'Tags','attributes':['id',_0x099f('0x38'),_0x099f('0xbd')],'where':_0x57d16b[_0x099f('0x3f')][_0x099f('0xbe')]?{'id':_0x57d16b[_0x099f('0x3f')][_0x099f('0xbe')]}:undefined,'required':_0x57d16b[_0x099f('0x3f')][_0x099f('0xbe')]?!![]:![]}];}return db[_0x099f('0x9c')][_0x099f('0x4f')](_0x2ed079);})[_0x099f('0x20')](function(_0x111508){_0x44d278[_0x099f('0x50')]=_0x111508;return _0x44d278;});}})['then'](respondWithFilteredResult(_0x48b0be,_0x2ed079))[_0x099f('0x2a')](handleError(_0x48b0be,null));};exports['send']=function(_0xfe1e96,_0xa34e3a,_0xa163cc){var _0x5ad421,_0x1fbf93,_0x503404;if(_[_0x099f('0x90')](_0xfe1e96[_0x099f('0x58')]['body'])||_0xfe1e96[_0x099f('0x58')][_0x099f('0x58')]===''){throw new db['Sequelize']['ValidationError'](_0x099f('0x92'));}if(_[_0x099f('0x90')](_0xfe1e96[_0x099f('0x58')]['to'])){throw new db['Sequelize'][(_0x099f('0x73'))](_0x099f('0xbf'));}_0x5ad421=_0xfe1e96['body']['to'];return db['SmsAccount']['find']({'where':{'id':_0xfe1e96['params']['id']},'include':[{'model':db[_0x099f('0x96')],'as':_0x099f('0xc0'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{'mobile':_0x5ad421},'limit':0x1,'order':[[_0x099f('0x76'),'DESC']]}]}]})[_0x099f('0x20')](handleEntityNotFound(_0xa34e3a,null))[_0x099f('0x20')](function(_0x56cd4f){if(_0x56cd4f&&_0x56cd4f[_0x099f('0xc0')]){_0x1fbf93=_0x56cd4f['get']({'plain':!![]});if(_0x1fbf93[_0x099f('0xc0')]&&_0x1fbf93[_0x099f('0xc0')][_0x099f('0x98')][_0x099f('0x61')]){return _0x1fbf93[_0x099f('0xc0')]['Contacts'][0x0];}return db['CmContact'][_0x099f('0x57')](_['defaults'](_0xfe1e96[_0x099f('0x58')],{'firstName':_0x5ad421,'mobile':_0x5ad421,'phone':_0x5ad421,'ListId':_0x1fbf93['ListId']}));}})[_0x099f('0x20')](handleEntityNotFound(_0xa34e3a,null))[_0x099f('0x20')](function(_0x4cf525){if(_0x4cf525){_0x503404=_0x4cf525;return db[_0x099f('0x9c')][_0x099f('0x56')]({'where':{'ContactId':_0x503404['id'],'closed':![],'SmsAccountId':_0x1fbf93['id']}})[_0x099f('0x20')](function(_0x1e7421){if(_0x1e7421){return[_0x1e7421,![]];}return db[_0x099f('0x9c')][_0x099f('0x57')]({'UserId':_0xfe1e96[_0x099f('0x59')]['id'],'ContactId':_0x503404['id'],'SmsAccountId':_0x1fbf93['id'],'phone':_0x5ad421,'firstMsgDirection':_0x099f('0xc1'),'Messages':[_[_0x099f('0x4a')](_0xfe1e96[_0x099f('0x58')],{'read':![],'body':_0xfe1e96[_0x099f('0x58')][_0x099f('0x58')],'phone':_0x5ad421,'SmsAccountId':_0x1fbf93['id'],'UserId':_0xfe1e96[_0x099f('0x59')]['id'],'ContactId':_0x503404['id']})]},{'include':[{'model':db[_0x099f('0xa5')],'as':_0x099f('0xc2')}]})[_0x099f('0x20')](function(_0x4a3027){return[_0x4a3027,!![]];});});}})[_0x099f('0x9d')](function(_0x1c6c7a,_0x5207cd){if(_0x5207cd){return _0x1c6c7a;}return db[_0x099f('0xa5')][_0x099f('0x57')](_['merge'](_0xfe1e96[_0x099f('0x58')],{'read':![],'body':_0xfe1e96[_0x099f('0x58')]['body'],'phone':_0x5ad421,'SmsAccountId':_0x1fbf93['id'],'SmsInteractionId':_0x1c6c7a['id'],'UserId':_0xfe1e96[_0x099f('0x59')]['id'],'ContactId':_0x503404['id']}))['then'](function(_0x5e6d13){_0x1c6c7a[_0x099f('0xc3')][_0x099f('0xc2')]=[];_0x1c6c7a[_0x099f('0xc3')][_0x099f('0xc2')]['push'](_0x5e6d13[_0x099f('0xc3')]);return _0x1c6c7a;});})[_0x099f('0x20')](respondWithResult(_0xa34e3a,null))[_0x099f('0x2a')](handleError(_0xa34e3a,null));};exports[_0x099f('0x2c')]=function(_0x487887,_0x5b146f,_0x67ff14){if(_0x487887[_0x099f('0x58')]['id']){delete _0x487887[_0x099f('0x58')]['id'];}var _0x13ed58,_0x43cfd0,_0x545cc5;return db[_0x099f('0x4c')][_0x099f('0x56')]({'where':{'id':_0x487887[_0x099f('0x5d')]['id']}})[_0x099f('0x20')](handleEntityNotFound(_0x5b146f,null))[_0x099f('0x20')](function(_0xafb564){if(_0xafb564){_0x545cc5=_0xafb564;logger['debug'](_0x099f('0x24'),_0x099f('0x2c'),_0x099f('0xc4'),_0xafb564[_0x099f('0x3d')],util[_0x099f('0xc5')](_0x487887[_0x099f('0x58')],{'showHidden':![],'depth':null}));switch(_0xafb564[_0x099f('0x3d')]){case'skebby':if(_0x487887[_0x099f('0x58')][_0x099f('0xc6')]&&_0x487887[_0x099f('0x58')][_0x099f('0x2c')]){_0x43cfd0=_0x487887[_0x099f('0x58')][_0x099f('0x2c')];return db[_0x099f('0xa5')][_0x099f('0x56')]({'where':{'messageId':_0x487887[_0x099f('0x58')][_0x099f('0xc6')]}});}break;case _0x099f('0x80'):if(_0x487887['body'][_0x099f('0xc7')]&&_0x487887[_0x099f('0x58')][_0x099f('0xc8')]){_0x43cfd0=_0x487887[_0x099f('0x58')]['statusInt'];return db[_0x099f('0xa5')][_0x099f('0x56')]({'where':{'messageId':_0x487887[_0x099f('0x58')][_0x099f('0xc7')]}});}break;case _0x099f('0xc9'):if(_0x487887[_0x099f('0x58')]['message_id']&&_0x487887[_0x099f('0x58')][_0x099f('0xca')]){_0x43cfd0=_0x487887[_0x099f('0x58')][_0x099f('0xca')];return db[_0x099f('0xa5')]['find']({'where':{'messageId':_0x487887[_0x099f('0x58')][_0x099f('0x81')]}});}break;case _0x099f('0x85'):var _0x202822=_0x487887[_0x099f('0x58')][_0x099f('0x86')][0x0];if(_0x202822['messageId']&&_0x202822['status'][_0x099f('0xcb')]===_0x099f('0xcc')){_0x43cfd0=_0x202822['status'][_0x099f('0xcb')];return db['SmsMessage'][_0x099f('0x56')]({'where':{'messageId':_0x202822[_0x099f('0x7f')]}});}break;case _0x099f('0x8a'):if(_0x487887['body'][_0x099f('0x7f')]&&_0x487887[_0x099f('0x58')][_0x099f('0x2c')]){_0x43cfd0=_0x487887[_0x099f('0x58')][_0x099f('0x2c')];return db['SmsMessage'][_0x099f('0x56')]({'where':{'messageId':_0x487887['body'][_0x099f('0x7f')]}});}break;case'bandwidth':if(_0x487887[_0x099f('0x58')][0x0]['message']['id']){_0x43cfd0=_0x487887[_0x099f('0x58')][0x0][_0x099f('0x3d')];return db['SmsMessage'][_0x099f('0x56')]({'where':{'messageId':_0x487887[_0x099f('0x58')][0x0][_0x099f('0x28')]['id']}});}break;case _0x099f('0x8e'):if(_0x487887[_0x099f('0x58')]['redif']&&_0x487887[_0x099f('0x58')]['status']){_0x43cfd0=_0x487887['body'][_0x099f('0x2c')];return db[_0x099f('0xa5')][_0x099f('0x56')]({'where':{'messageId':_0x487887['body'][_0x099f('0xcd')]}});}break;}}})[_0x099f('0x20')](handleEntityNotFound(_0x5b146f,null))[_0x099f('0x20')](function(_0xe2b5d7){if(_0xe2b5d7){_0x13ed58=_0xe2b5d7;switch(_0x545cc5[_0x099f('0x3d')]){case _0x099f('0xce'):if(_0x43cfd0===_0x099f('0xcc')){return _0x13ed58[_0x099f('0x5c')]({'read':!![]});}else{logger[_0x099f('0x26')](_0x099f('0x24'),_0x099f('0x2c'),_0x099f('0xce'),util[_0x099f('0xc5')](_0x487887['body'],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x43cfd0==='1'){return _0x13ed58[_0x099f('0x5c')]({'read':!![]});}else{logger[_0x099f('0x26')](_0x099f('0x24'),'status','skebby',util[_0x099f('0xc5')](_0x487887[_0x099f('0x58')],{'showHidden':![],'depth':null}));}break;case _0x099f('0xc9'):if(!_0x487887[_0x099f('0x58')][_0x099f('0xcf')]&&_0x43cfd0>=0xc8&&_0x43cfd0<=0xce){return _0x13ed58[_0x099f('0x5c')]({'read':!![]});}else{logger[_0x099f('0x26')](_0x099f('0x24'),_0x099f('0x2c'),_0x099f('0xc9'),util[_0x099f('0xc5')](_0x487887[_0x099f('0x58')],{'showHidden':![],'depth':null}));}break;case _0x099f('0x85'):var _0x2275ba=_0x487887[_0x099f('0x58')][_0x099f('0x86')][0x0];if(_0x2275ba['status'][_0x099f('0xcb')]==='DELIVERED'){return _0x13ed58[_0x099f('0x5c')]({'read':!![]});}else{logger['error'](_0x099f('0x24'),_0x099f('0x2c'),_0x099f('0x85'),util[_0x099f('0xc5')](_0x487887['body'],{'showHidden':![],'depth':null}));}break;case _0x099f('0x8a'):if(_0x43cfd0==_0x099f('0xd0')||_0x43cfd0==_0x099f('0xd1')){return _0x13ed58[_0x099f('0x5c')]({'read':!![]});}else{logger[_0x099f('0x26')](_0x099f('0x24'),'status',_0x099f('0x8a'),util[_0x099f('0xc5')](_0x487887[_0x099f('0x58')],{'showHidden':![],'depth':null}));}break;case _0x099f('0x8d'):if(_0x43cfd0=='message-delivered'){return _0x13ed58['update']({'read':!![]});}else{logger[_0x099f('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x099f('0x2c'),'bandwidth',util['inspect'](_0x487887[_0x099f('0x58')],{'showHidden':![],'depth':null}));}break;case _0x099f('0x8e'):if(_0x43cfd0==='DELIVRD'||_0x43cfd0===_0x099f('0xd2')){return _0x13ed58['update']({'read':!![]});}else{logger[_0x099f('0x26')](_0x099f('0x24'),'status','intelepeer',util[_0x099f('0xc5')](_0x487887[_0x099f('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x13ed58;}})[_0x099f('0x20')](respondWithResult(_0x5b146f,null))[_0x099f('0x2a')](handleError(_0x5b146f,null));};exports[_0x099f('0xd3')]=function(_0x22dda8,_0xc23e7b,_0x17ee01){var _0x571415,_0x623cf6,_0xebb6eb;return db[_0x099f('0x4c')][_0x099f('0x56')]({'where':{'id':_0x22dda8[_0x099f('0x5d')]['id']}})[_0x099f('0x20')](handleEntityNotFound(_0xc23e7b,null))[_0x099f('0x20')](function(_0x406dbe){if(_0x406dbe){_0xebb6eb=_0x406dbe;logger[_0x099f('0xd4')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x099f('0x2c'),'received\x20delivery\x20report\x20from',_0x406dbe[_0x099f('0x3d')],util['inspect'](_0x22dda8[_0x099f('0x3f')],{'showHidden':![],'depth':null}));switch(_0x406dbe[_0x099f('0x3d')]){case _0x099f('0xd5'):if(_0x22dda8[_0x099f('0x3f')][_0x099f('0xd6')]&&_0x22dda8['query'][_0x099f('0xd7')]){_0x623cf6=_0x22dda8['query']['state'];return db['SmsMessage']['find']({'where':{'messageId':_0x22dda8[_0x099f('0x3f')][_0x099f('0xd6')]}});}break;}}})[_0x099f('0x20')](handleEntityNotFound(_0xc23e7b,null))[_0x099f('0x20')](function(_0x1e4a47){if(_0x1e4a47){_0x571415=_0x1e4a47;switch(_0xebb6eb[_0x099f('0x3d')]){case _0x099f('0xd5'):if(_0x623cf6==='2'||_0x623cf6==='6'){return _0x571415[_0x099f('0x5c')]({'read':!![]});}else{logger['error'](_0x099f('0x24'),_0x099f('0x2c'),'csc',util[_0x099f('0xc5')](_0x22dda8[_0x099f('0x3f')],{'showHidden':![],'depth':null}));};break;}return _0x571415;}})[_0x099f('0x20')](respondWithResult(_0xc23e7b,null))[_0x099f('0x2a')](handleError(_0xc23e7b,null));};exports[_0x099f('0xd8')]=function(_0x3874a0,_0x47a08d,_0x1c03dd){return db[_0x099f('0x4c')]['find']({'where':{'id':_0x3874a0[_0x099f('0x5d')]['id']}})[_0x099f('0x20')](handleEntityNotFound(_0x47a08d,null))[_0x099f('0x20')](function(_0x1cf026){if(_0x1cf026){return _0x1cf026['addAgents'](_0x3874a0[_0x099f('0x58')][_0x099f('0x6a')],_['omit'](_0x3874a0[_0x099f('0x58')],[_0x099f('0x6a'),'id'])||{})[_0x099f('0x9d')](function(_0x4a32e4){for(var _0xec8309=0x0;_0xec8309<_0x3874a0[_0x099f('0x58')][_0x099f('0x6a')][_0x099f('0x61')];_0xec8309+=0x1){socket[_0x099f('0xd9')](_0x099f('0xda'),{'UserId':Number(_0x3874a0[_0x099f('0x58')]['ids'][_0xec8309]),'SmsAccountId':Number(_0x3874a0['params']['id'])});}return _0x4a32e4;});}})[_0x099f('0x20')](respondWithResult(_0x47a08d,null))[_0x099f('0x2a')](handleError(_0x47a08d,null));};exports[_0x099f('0xdb')]=function(_0x39289d,_0x2fd172,_0xaad03f){return db[_0x099f('0x4c')][_0x099f('0x56')]({'where':{'id':_0x39289d[_0x099f('0x5d')]['id']}})[_0x099f('0x20')](handleEntityNotFound(_0x2fd172,null))[_0x099f('0x20')](function(_0x4e5294){if(_0x4e5294){return _0x4e5294[_0x099f('0xdb')](_0x39289d[_0x099f('0x3f')][_0x099f('0x6a')])['then'](function(){if(_[_0x099f('0xdc')](_0x39289d[_0x099f('0x3f')]['ids'])){for(var _0x3cd980=0x0;_0x3cd980<_0x39289d['query'][_0x099f('0x6a')][_0x099f('0x61')];_0x3cd980+=0x1){socket[_0x099f('0xd9')](_0x099f('0xdd'),{'UserId':Number(_0x39289d[_0x099f('0x3f')][_0x099f('0x6a')][_0x3cd980]),'SmsAccountId':Number(_0x39289d[_0x099f('0x5d')]['id'])});}}else{socket[_0x099f('0xd9')](_0x099f('0xdd'),{'UserId':Number(_0x39289d['query'][_0x099f('0x6a')]),'SmsAccountId':Number(_0x39289d[_0x099f('0x5d')]['id'])});}});}})[_0x099f('0x20')](respondWithStatusCode(_0x2fd172,null))[_0x099f('0x2a')](handleError(_0x2fd172,null));};exports[_0x099f('0xde')]=function(_0x2334c4,_0x36c702,_0x1b38db){var _0x1eb22b={};var _0x1e1343={};var _0x5c0d1a;var _0x1f598e;return db[_0x099f('0x4c')][_0x099f('0x65')]({'where':{'id':_0x2334c4['params']['id']}})[_0x099f('0x20')](handleEntityNotFound(_0x36c702,null))['then'](function(_0x258ecc){if(_0x258ecc){_0x5c0d1a=_0x258ecc;_0x1e1343[_0x099f('0x3e')]=_[_0x099f('0x54')](db[_0x099f('0xa8')][_0x099f('0x3c')]);_0x1e1343[_0x099f('0x3f')]=_[_0x099f('0x54')](_0x2334c4[_0x099f('0x3f')]);_0x1e1343['filters']=_[_0x099f('0x41')](_0x1e1343[_0x099f('0x3e')],_0x1e1343[_0x099f('0x3f')]);_0x1eb22b[_0x099f('0x42')]=_[_0x099f('0x41')](_0x1e1343[_0x099f('0x3e')],qs[_0x099f('0x55')](_0x2334c4[_0x099f('0x3f')][_0x099f('0x55')]));_0x1eb22b[_0x099f('0x42')]=_0x1eb22b['attributes'][_0x099f('0x61')]?_0x1eb22b['attributes']:_0x1e1343[_0x099f('0x3e')];_0x1eb22b[_0x099f('0x45')]=qs[_0x099f('0x46')](_0x2334c4[_0x099f('0x3f')][_0x099f('0x46')]);_0x1eb22b[_0x099f('0x47')]=qs[_0x099f('0x40')](_[_0x099f('0x66')](_0x2334c4['query'],_0x1e1343[_0x099f('0x40')]));if(_0x2334c4[_0x099f('0x3f')][_0x099f('0x48')]){_0x1eb22b[_0x099f('0x47')]=_[_0x099f('0x4a')](_0x1eb22b[_0x099f('0x47')],{'$or':_['map'](_0x1eb22b['attributes'],function(_0x2ac72b){var _0x43d14d={};_0x43d14d[_0x2ac72b]={'$like':'%'+_0x2334c4[_0x099f('0x3f')][_0x099f('0x48')]+'%'};return _0x43d14d;})});}_0x1eb22b=_[_0x099f('0x4a')]({},_0x1eb22b,_0x2334c4[_0x099f('0x4b')]);return _0x5c0d1a[_0x099f('0xde')](_0x1eb22b);}})[_0x099f('0x20')](function(_0x3a2ffe){if(_0x3a2ffe){_0x1f598e=_0x3a2ffe[_0x099f('0x61')];if(!_0x2334c4[_0x099f('0x3f')][_0x099f('0x43')](_0x099f('0x44'))){_0x1eb22b[_0x099f('0x30')]=qs[_0x099f('0x30')](_0x2334c4[_0x099f('0x3f')][_0x099f('0x30')]);_0x1eb22b[_0x099f('0x2e')]=qs[_0x099f('0x2e')](_0x2334c4['query'][_0x099f('0x2e')]);}return _0x5c0d1a[_0x099f('0xde')](_0x1eb22b);}})['then'](function(_0x19794d){if(_0x19794d){return _0x19794d?{'count':_0x1f598e,'rows':_0x19794d}:null;}})[_0x099f('0x20')](respondWithResult(_0x36c702,null))[_0x099f('0x2a')](handleError(_0x36c702,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index ca6feb6..1597e21 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 _0xdb2f=['update','emit','hasOwnProperty','hook','exports','events','SmsAccount','setMaxListeners'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0xdb2f,0x15d));var _0xfdb2=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xdb2f[_0x4fc9e6];return _0x551d28;};'use strict';var EventEmitter=require(_0xfdb2('0x0'));var SmsAccount=require('../../mysqldb')['db'][_0xfdb2('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xfdb2('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xfdb2('0x3'),'afterDestroy':'remove'};function emitEvent(_0x158c69){return function(_0x4920ab,_0x48a26a,_0x598f12){SmsAccountEvents[_0xfdb2('0x4')](_0x158c69+':'+_0x4920ab['id'],_0x4920ab);SmsAccountEvents[_0xfdb2('0x4')](_0x158c69,_0x4920ab);_0x598f12(null);};}for(var e in events){if(events[_0xfdb2('0x5')](e)){var event=events[e];SmsAccount[_0xfdb2('0x6')](e,emitEvent(event));}}module[_0xfdb2('0x7')]=SmsAccountEvents; \ No newline at end of file +var _0x7de8=['../../mysqldb','SmsAccount','update','remove','emit','hasOwnProperty','events'];(function(_0x54b684,_0x58a829){var _0x4a15f4=function(_0x43bc32){while(--_0x43bc32){_0x54b684['push'](_0x54b684['shift']());}};_0x4a15f4(++_0x58a829);}(_0x7de8,0x8b));var _0x87de=function(_0x5bed54,_0x383657){_0x5bed54=_0x5bed54-0x0;var _0x184b17=_0x7de8[_0x5bed54];return _0x184b17;};'use strict';var EventEmitter=require(_0x87de('0x0'));var SmsAccount=require(_0x87de('0x1'))['db'][_0x87de('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x87de('0x3'),'afterDestroy':_0x87de('0x4')};function emitEvent(_0x1e29ed){return function(_0x1bf792,_0xde3313,_0x55050b){SmsAccountEvents[_0x87de('0x5')](_0x1e29ed+':'+_0x1bf792['id'],_0x1bf792);SmsAccountEvents[_0x87de('0x5')](_0x1e29ed,_0x1bf792);_0x55050b(null);};}for(var e in events){if(events[_0x87de('0x6')](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index b428d65..af3baaf 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 _0xdee4=['rimraf','../../config/environment','define','SmsAccount','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdee4,0x9e));var _0x4dee=function(_0x27975e,_0x4856c2){_0x27975e=_0x27975e-0x0;var _0x383887=_0xdee4[_0x27975e];return _0x383887;};'use strict';var _=require(_0x4dee('0x0'));var util=require(_0x4dee('0x1'));var logger=require(_0x4dee('0x2'))('api');var moment=require(_0x4dee('0x3'));var BPromise=require(_0x4dee('0x4'));var rp=require(_0x4dee('0x5'));var fs=require('fs');var path=require(_0x4dee('0x6'));var rimraf=require(_0x4dee('0x7'));var config=require(_0x4dee('0x8'));var attributes=require('./smsAccount.attributes');module['exports']=function(_0x3d3c44,_0x5ea3ba){return _0x3d3c44[_0x4dee('0x9')](_0x4dee('0xa'),attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3abb=['request-promise','path','./smsAccount.attributes','exports','define','SmsAccount','sms_accounts','lodash','util','../../config/logger','api','moment'];(function(_0x3f14ee,_0x20ca8a){var _0x3a5359=function(_0xb4bf1d){while(--_0xb4bf1d){_0x3f14ee['push'](_0x3f14ee['shift']());}};_0x3a5359(++_0x20ca8a);}(_0x3abb,0xf7));var _0xb3ab=function(_0x39c734,_0x2f3e06){_0x39c734=_0x39c734-0x0;var _0xb2a2f9=_0x3abb[_0x39c734];return _0xb2a2f9;};'use strict';var _=require(_0xb3ab('0x0'));var util=require(_0xb3ab('0x1'));var logger=require(_0xb3ab('0x2'))(_0xb3ab('0x3'));var moment=require(_0xb3ab('0x4'));var BPromise=require('bluebird');var rp=require(_0xb3ab('0x5'));var fs=require('fs');var path=require(_0xb3ab('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb3ab('0x7'));module[_0xb3ab('0x8')]=function(_0xd6b16f,_0xa23e80){return _0xd6b16f[_0xb3ab('0x9')](_0xb3ab('0xa'),attributes,{'tableName':_0xb3ab('0xb'),'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 4f0afed..d0f9777 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 _0x571a=['SmsAccount','options','raw','where','include','model','attributes','map','info','debug','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','./smsAccount.socket','register','request','SmsAccount,\x20%s,\x20%s','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','ShowSmsAccount'];(function(_0xbb3c9d,_0x47885a){var _0x4e0cc3=function(_0x22dcb8){while(--_0x22dcb8){_0xbb3c9d['push'](_0xbb3c9d['shift']());}};_0x4e0cc3(++_0x47885a);}(_0x571a,0xaf));var _0xa571=function(_0x217bf3,_0x4731cf){_0x217bf3=_0x217bf3-0x0;var _0x5676dd=_0x571a[_0x217bf3];return _0x5676dd;};'use strict';var _=require(_0xa571('0x0'));var util=require('util');var moment=require(_0xa571('0x1'));var BPromise=require(_0xa571('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa571('0x3'));var db=require(_0xa571('0x4'))['db'];var utils=require(_0xa571('0x5'));var logger=require('../../config/logger')(_0xa571('0x6'));var config=require(_0xa571('0x7'));var jayson=require(_0xa571('0x8'));var client=jayson[_0xa571('0x9')]['http']({'port':0x232a});config[_0xa571('0xa')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xa571('0xb'))[_0xa571('0xc')](socket);function respondWithRpcPromise(_0x405cc5,_0x27f3d8,_0x547f4e){return new BPromise(function(_0x5105ce,_0x24e902){return client[_0xa571('0xd')](_0x405cc5,_0x547f4e)['then'](function(_0x33e01d){logger['info'](_0xa571('0xe'),_0x27f3d8,'request\x20sent');logger['debug'](_0xa571('0xf'),_0x27f3d8,_0xa571('0x10'),JSON[_0xa571('0x11')](_0x33e01d));if(_0x33e01d[_0xa571('0x12')]){if(_0x33e01d[_0xa571('0x12')][_0xa571('0x13')]===0x1f4){logger['error'](_0xa571('0xe'),_0x27f3d8,_0x33e01d[_0xa571('0x12')]['message']);return _0x24e902(_0x33e01d[_0xa571('0x12')][_0xa571('0x14')]);}logger['error'](_0xa571('0xe'),_0x27f3d8,_0x33e01d['error']['message']);return _0x5105ce(_0x33e01d[_0xa571('0x12')][_0xa571('0x14')]);}else{logger['info'](_0xa571('0xe'),_0x27f3d8,_0xa571('0x10'));_0x5105ce(_0x33e01d['result'][_0xa571('0x14')]);}})[_0xa571('0x15')](function(_0x409063){logger[_0xa571('0x12')](_0xa571('0xe'),_0x27f3d8,_0x409063);_0x24e902(_0x409063);});});}exports[_0xa571('0x16')]=function(_0x2c7474){var _0x30f132=this;return new Promise(function(_0x1e062b,_0x407972){return db[_0xa571('0x17')]['find']({'raw':_0x2c7474[_0xa571('0x18')]?_0x2c7474[_0xa571('0x18')][_0xa571('0x19')]===undefined?!![]:![]:!![],'where':_0x2c7474[_0xa571('0x18')]?_0x2c7474[_0xa571('0x18')][_0xa571('0x1a')]||null:null,'attributes':_0x2c7474[_0xa571('0x18')]?_0x2c7474[_0xa571('0x18')]['attributes']||null:null,'include':_0x2c7474[_0xa571('0x18')]?_0x2c7474['options'][_0xa571('0x1b')]?_['map'](_0x2c7474['options'][_0xa571('0x1b')],function(_0x59217a){return{'model':db[_0x59217a[_0xa571('0x1c')]],'as':_0x59217a['as'],'attributes':_0x59217a[_0xa571('0x1d')],'include':_0x59217a[_0xa571('0x1b')]?_[_0xa571('0x1e')](_0x59217a[_0xa571('0x1b')],function(_0x58519b){return{'model':db[_0x58519b[_0xa571('0x1c')]],'as':_0x58519b['as'],'attributes':_0x58519b[_0xa571('0x1d')],'include':_0x58519b['include']?_[_0xa571('0x1e')](_0x58519b[_0xa571('0x1b')],function(_0x433817){return{'model':db[_0x433817[_0xa571('0x1c')]],'as':_0x433817['as'],'attributes':_0x433817[_0xa571('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x151f28){logger[_0xa571('0x1f')](_0xa571('0x16'),_0x2c7474);logger[_0xa571('0x20')]('ShowSmsAccount',_0x2c7474,JSON[_0xa571('0x11')](_0x151f28));_0x1e062b(_0x151f28);})[_0xa571('0x15')](function(_0x2930e3){logger['error']('ShowSmsAccount',_0x2930e3['message'],_0x2c7474);_0x407972(_0x30f132['error'](0x1f4,_0x2930e3['message']));});});}; \ No newline at end of file +var _0x3172=['debug','stringify','lodash','moment','randomstring','../../mysqldb','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','ShowSmsAccount','SmsAccount','options','raw','where','attributes','map','include','model'];(function(_0x24c71f,_0x420225){var _0x36b469=function(_0x3e7688){while(--_0x3e7688){_0x24c71f['push'](_0x24c71f['shift']());}};_0x36b469(++_0x420225);}(_0x3172,0x183));var _0x2317=function(_0x29ce14,_0x334166){_0x29ce14=_0x29ce14-0x0;var _0x48f289=_0x3172[_0x29ce14];return _0x48f289;};'use strict';var _=require(_0x2317('0x0'));var util=require('util');var moment=require(_0x2317('0x1'));var BPromise=require('bluebird');var rs=require(_0x2317('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2317('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x2317('0x4'))('rpc');var config=require(_0x2317('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x2317('0x6')][_0x2317('0x7')]({'port':0x232a});config[_0x2317('0x8')]=_[_0x2317('0x9')](config[_0x2317('0x8')],{'host':_0x2317('0xa'),'port':0x18eb});var socket=require(_0x2317('0xb'))(new Redis(config[_0x2317('0x8')]));require(_0x2317('0xc'))[_0x2317('0xd')](socket);function respondWithRpcPromise(_0x564a90,_0x12d8b8,_0xd2b8fc){return new BPromise(function(_0x8ddf43,_0x5816de){return client[_0x2317('0xe')](_0x564a90,_0xd2b8fc)[_0x2317('0xf')](function(_0x428dce){logger[_0x2317('0x10')](_0x2317('0x11'),_0x12d8b8,'request\x20sent');logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x12d8b8,_0x2317('0x12'),JSON['stringify'](_0x428dce));if(_0x428dce[_0x2317('0x13')]){if(_0x428dce[_0x2317('0x13')][_0x2317('0x14')]===0x1f4){logger[_0x2317('0x13')](_0x2317('0x11'),_0x12d8b8,_0x428dce[_0x2317('0x13')]['message']);return _0x5816de(_0x428dce['error'][_0x2317('0x15')]);}logger[_0x2317('0x13')]('SmsAccount,\x20%s,\x20%s',_0x12d8b8,_0x428dce['error']['message']);return _0x8ddf43(_0x428dce[_0x2317('0x13')]['message']);}else{logger[_0x2317('0x10')](_0x2317('0x11'),_0x12d8b8,_0x2317('0x12'));_0x8ddf43(_0x428dce[_0x2317('0x16')][_0x2317('0x15')]);}})[_0x2317('0x17')](function(_0x3f336b){logger['error'](_0x2317('0x11'),_0x12d8b8,_0x3f336b);_0x5816de(_0x3f336b);});});}exports[_0x2317('0x18')]=function(_0x4d09f3){var _0x1524b2=this;return new Promise(function(_0x474db4,_0x2044c9){return db[_0x2317('0x19')]['find']({'raw':_0x4d09f3[_0x2317('0x1a')]?_0x4d09f3[_0x2317('0x1a')][_0x2317('0x1b')]===undefined?!![]:![]:!![],'where':_0x4d09f3[_0x2317('0x1a')]?_0x4d09f3['options'][_0x2317('0x1c')]||null:null,'attributes':_0x4d09f3[_0x2317('0x1a')]?_0x4d09f3[_0x2317('0x1a')][_0x2317('0x1d')]||null:null,'include':_0x4d09f3[_0x2317('0x1a')]?_0x4d09f3[_0x2317('0x1a')]['include']?_[_0x2317('0x1e')](_0x4d09f3[_0x2317('0x1a')][_0x2317('0x1f')],function(_0x4c577e){return{'model':db[_0x4c577e[_0x2317('0x20')]],'as':_0x4c577e['as'],'attributes':_0x4c577e[_0x2317('0x1d')],'include':_0x4c577e['include']?_['map'](_0x4c577e[_0x2317('0x1f')],function(_0x283c21){return{'model':db[_0x283c21[_0x2317('0x20')]],'as':_0x283c21['as'],'attributes':_0x283c21[_0x2317('0x1d')],'include':_0x283c21[_0x2317('0x1f')]?_[_0x2317('0x1e')](_0x283c21[_0x2317('0x1f')],function(_0x2d502a){return{'model':db[_0x2d502a[_0x2317('0x20')]],'as':_0x2d502a['as'],'attributes':_0x2d502a[_0x2317('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x2317('0xf')](function(_0x397f04){logger[_0x2317('0x10')](_0x2317('0x18'),_0x4d09f3);logger[_0x2317('0x21')](_0x2317('0x18'),_0x4d09f3,JSON[_0x2317('0x22')](_0x397f04));_0x474db4(_0x397f04);})[_0x2317('0x17')](function(_0x2bdd6d){logger[_0x2317('0x13')]('ShowSmsAccount',_0x2bdd6d[_0x2317('0x15')],_0x4d09f3);_0x2044c9(_0x1524b2[_0x2317('0x13')](0x1f4,_0x2bdd6d[_0x2317('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 4cb371f..f49578e 100644 --- a/server/api/smsAccount/smsAccount.socket.js +++ b/server/api/smsAccount/smsAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xa9e0[_0x55f8b4];return _0x2475f9;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index f6afefa..dd688c6 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 _0x7217=['Router','fs-extra','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x5d81ab,_0x4f9126){var _0x33e18b=function(_0x2e2009){while(--_0x2e2009){_0x5d81ab['push'](_0x5d81ab['shift']());}};_0x33e18b(++_0x4f9126);}(_0x7217,0x19e));var _0x7721=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x7217[_0x5ddb1c];return _0x354adc;};'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('0xd')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0xf')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller['update']);router[_0x7721('0x10')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0x11')]);module[_0x7721('0x12')]=router; \ No newline at end of file +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(_0x2d6071,_0x28eda4){var _0x4fcf9a=function(_0x2b7e3b){while(--_0x2b7e3b){_0x2d6071['push'](_0x2d6071['shift']());}};_0x4fcf9a(++_0x28eda4);}(_0x34e8,0x12c));var _0x834e=function(_0x1ae5a2,_0x576361){_0x1ae5a2=_0x1ae5a2-0x0;var _0x136b84=_0x34e8[_0x1ae5a2];return _0x136b84;};'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 diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 6b22e76..ca61f5a 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 _0x2d87=['*,*,*,*','sequelize','exports','INTEGER','STRING','noop','TEXT'];(function(_0x10ebe7,_0x116650){var _0xc03446=function(_0x46527c){while(--_0x46527c){_0x10ebe7['push'](_0x10ebe7['shift']());}};_0xc03446(++_0x116650);}(_0x2d87,0x94));var _0x72d8=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x2d87[_0x484e36];return _0xafc85d;};'use strict';var Sequelize=require(_0x72d8('0x0'));module[_0x72d8('0x1')]={'priority':{'type':Sequelize[_0x72d8('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x72d8('0x3')],'allowNull':![],'defaultValue':_0x72d8('0x4')},'appdata':{'type':Sequelize[_0x72d8('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x72d8('0x3')],'defaultValue':_0x72d8('0x6')}}; \ No newline at end of file +var _0x5140=['*,*,*,*','sequelize','INTEGER','STRING','noop'];(function(_0x32fc1c,_0x94d82d){var _0x45de91=function(_0x2d0e3f){while(--_0x2d0e3f){_0x32fc1c['push'](_0x32fc1c['shift']());}};_0x45de91(++_0x94d82d);}(_0x5140,0xa1));var _0x0514=function(_0x517184,_0x126918){_0x517184=_0x517184-0x0;var _0x1489a2=_0x5140[_0x517184];return _0x1489a2;};'use strict';var Sequelize=require(_0x0514('0x0'));module['exports']={'priority':{'type':Sequelize[_0x0514('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x0514('0x2')],'allowNull':![],'defaultValue':_0x0514('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x0514('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x0514('0x4')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 259218a..6464dbd 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 _0x9389=['request-promise','moment','bluebird','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','end','error','stack','name','send','index','map','SmsApplication','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','then','includeAll','include','findAll','rows','catch','params','find','create','body','eml-format','zip-dir'];(function(_0x3a893b,_0x1a8010){var _0x111903=function(_0x154274){while(--_0x154274){_0x3a893b['push'](_0x3a893b['shift']());}};_0x111903(++_0x1a8010);}(_0x9389,0xe8));var _0x9938=function(_0x2b097c,_0x26e0eb){_0x2b097c=_0x2b097c-0x0;var _0x335df=_0x9389[_0x2b097c];return _0x335df;};'use strict';var emlformat=require(_0x9938('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9938('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9938('0x2'));var moment=require(_0x9938('0x3'));var BPromise=require(_0x9938('0x4'));var Mustache=require('mustache');var util=require(_0x9938('0x5'));var path=require('path');var sox=require(_0x9938('0x6'));var csv=require(_0x9938('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9938('0x8'));var _=require(_0x9938('0x9'));var squel=require(_0x9938('0xa'));var crypto=require(_0x9938('0xb'));var jsforce=require(_0x9938('0xc'));var deskjs=require(_0x9938('0xd'));var toCsv=require(_0x9938('0x7'));var querystring=require(_0x9938('0xe'));var Papa=require('papaparse');var Redis=require(_0x9938('0xf'));var authService=require(_0x9938('0x10'));var qs=require(_0x9938('0x11'));var as=require(_0x9938('0x12'));var hardwareService=require(_0x9938('0x13'));var logger=require(_0x9938('0x14'))(_0x9938('0x15'));var utils=require(_0x9938('0x16'));var config=require(_0x9938('0x17'));var licenseUtil=require(_0x9938('0x18'));var db=require(_0x9938('0x19'))['db'];function respondWithStatusCode(_0x17939c,_0x4019b6){_0x4019b6=_0x4019b6||0xcc;return function(_0x5b7694){if(_0x5b7694){return _0x17939c[_0x9938('0x1a')](_0x4019b6);}return _0x17939c[_0x9938('0x1b')](_0x4019b6)['end']();};}function respondWithResult(_0x5377b0,_0x4bbbb3){_0x4bbbb3=_0x4bbbb3||0xc8;return function(_0x1f035c){if(_0x1f035c){return _0x5377b0[_0x9938('0x1b')](_0x4bbbb3)[_0x9938('0x1c')](_0x1f035c);}};}function respondWithFilteredResult(_0x146876,_0x2daf68){return function(_0x8eb68f){if(_0x8eb68f){var _0x3b1eb9=typeof _0x2daf68['offset']===_0x9938('0x1d')&&typeof _0x2daf68[_0x9938('0x1e')]===_0x9938('0x1d');var _0x31ea4b=_0x8eb68f[_0x9938('0x1f')];var _0x34f52a=_0x3b1eb9?0x0:_0x2daf68[_0x9938('0x20')];var _0x3e55b9=_0x3b1eb9?_0x8eb68f[_0x9938('0x1f')]:_0x2daf68['offset']+_0x2daf68[_0x9938('0x1e')];var _0x358fc1;if(_0x3e55b9>=_0x31ea4b){_0x3e55b9=_0x31ea4b;_0x358fc1=0xc8;}else{_0x358fc1=0xce;}_0x146876['status'](_0x358fc1);return _0x146876[_0x9938('0x21')](_0x9938('0x22'),_0x34f52a+'-'+_0x3e55b9+'/'+_0x31ea4b)[_0x9938('0x1c')](_0x8eb68f);}return null;};}function patchUpdates(_0x16366c){return function(_0x24f560){try{jsonpatch[_0x9938('0x23')](_0x24f560,_0x16366c,!![]);}catch(_0x1606e1){return BPromise[_0x9938('0x24')](_0x1606e1);}return _0x24f560[_0x9938('0x25')]();};}function saveUpdates(_0xb527ec,_0x524abf){return function(_0xd93f6d){if(_0xd93f6d){return _0xd93f6d[_0x9938('0x26')](_0xb527ec)['then'](function(_0x491a44){return _0x491a44;});}return null;};}function removeEntity(_0x2e9ac4,_0x4dd091){return function(_0x2b6386){if(_0x2b6386){return _0x2b6386[_0x9938('0x27')]()['then'](function(){_0x2e9ac4[_0x9938('0x1b')](0xcc)[_0x9938('0x28')]();});}};}function handleEntityNotFound(_0x3dd987,_0x4df8db){return function(_0x2bfe74){if(!_0x2bfe74){_0x3dd987[_0x9938('0x1a')](0x194);}return _0x2bfe74;};}function handleError(_0x125b11,_0x21da50){_0x21da50=_0x21da50||0x1f4;return function(_0x3eb57a){logger[_0x9938('0x29')](_0x3eb57a[_0x9938('0x2a')]);if(_0x3eb57a[_0x9938('0x2b')]){delete _0x3eb57a[_0x9938('0x2b')];}_0x125b11['status'](_0x21da50)[_0x9938('0x2c')](_0x3eb57a);};}exports[_0x9938('0x2d')]=function(_0x58b67b,_0x175b78){var _0x59bca3={},_0x23516a={},_0x5ad2d8={'count':0x0,'rows':[]};var _0x118f7d=_[_0x9938('0x2e')](db[_0x9938('0x2f')][_0x9938('0x30')],function(_0x232cd9){return{'name':_0x232cd9['fieldName'],'type':_0x232cd9[_0x9938('0x31')][_0x9938('0x32')]};});_0x23516a[_0x9938('0x33')]=_[_0x9938('0x2e')](_0x118f7d,_0x9938('0x2b'));_0x23516a[_0x9938('0x34')]=_[_0x9938('0x35')](_0x58b67b[_0x9938('0x34')]);_0x23516a['filters']=_[_0x9938('0x36')](_0x23516a[_0x9938('0x33')],_0x23516a[_0x9938('0x34')]);_0x59bca3[_0x9938('0x37')]=_[_0x9938('0x36')](_0x23516a[_0x9938('0x33')],qs['fields'](_0x58b67b[_0x9938('0x34')][_0x9938('0x38')]));_0x59bca3['attributes']=_0x59bca3['attributes'][_0x9938('0x39')]?_0x59bca3[_0x9938('0x37')]:_0x23516a[_0x9938('0x33')];if(!_0x58b67b[_0x9938('0x34')][_0x9938('0x3a')]('nolimit')){_0x59bca3[_0x9938('0x1e')]=qs[_0x9938('0x1e')](_0x58b67b[_0x9938('0x34')]['limit']);_0x59bca3[_0x9938('0x20')]=qs['offset'](_0x58b67b['query'][_0x9938('0x20')]);}_0x59bca3[_0x9938('0x3b')]=qs[_0x9938('0x3c')](_0x58b67b['query'][_0x9938('0x3c')]);_0x59bca3[_0x9938('0x3d')]=qs[_0x9938('0x3e')](_[_0x9938('0x3f')](_0x58b67b['query'],_0x23516a['filters']),_0x118f7d);if(_0x58b67b['query'][_0x9938('0x40')]){_0x59bca3[_0x9938('0x3d')]=_[_0x9938('0x41')](_0x59bca3[_0x9938('0x3d')],{'$or':_[_0x9938('0x2e')](_0x118f7d,function(_0x2be53c){if(_0x2be53c[_0x9938('0x31')]!==_0x9938('0x42')){var _0x1f5d31={};_0x1f5d31[_0x2be53c[_0x9938('0x2b')]]={'$like':'%'+_0x58b67b['query']['filter']+'%'};return _0x1f5d31;}})});}_0x59bca3=_[_0x9938('0x41')]({},_0x59bca3,_0x58b67b[_0x9938('0x43')]);var _0x2d12a0={'where':_0x59bca3[_0x9938('0x3d')]};return db[_0x9938('0x2f')][_0x9938('0x1f')](_0x2d12a0)[_0x9938('0x44')](function(_0x51680a){_0x5ad2d8[_0x9938('0x1f')]=_0x51680a;if(_0x58b67b[_0x9938('0x34')][_0x9938('0x45')]){_0x59bca3[_0x9938('0x46')]=[{'all':!![]}];}return db[_0x9938('0x2f')][_0x9938('0x47')](_0x59bca3);})[_0x9938('0x44')](function(_0x16eae1){_0x5ad2d8[_0x9938('0x48')]=_0x16eae1;return _0x5ad2d8;})[_0x9938('0x44')](respondWithFilteredResult(_0x175b78,_0x59bca3))[_0x9938('0x49')](handleError(_0x175b78,null));};exports['show']=function(_0x3af765,_0x39f807){var _0x443a4f={'raw':!![],'where':{'id':_0x3af765[_0x9938('0x4a')]['id']}},_0x28dd0b={};_0x28dd0b[_0x9938('0x33')]=_[_0x9938('0x35')](db[_0x9938('0x2f')][_0x9938('0x30')]);_0x28dd0b[_0x9938('0x34')]=_[_0x9938('0x35')](_0x3af765[_0x9938('0x34')]);_0x28dd0b['filters']=_[_0x9938('0x36')](_0x28dd0b['model'],_0x28dd0b[_0x9938('0x34')]);_0x443a4f[_0x9938('0x37')]=_[_0x9938('0x36')](_0x28dd0b[_0x9938('0x33')],qs[_0x9938('0x38')](_0x3af765[_0x9938('0x34')][_0x9938('0x38')]));_0x443a4f[_0x9938('0x37')]=_0x443a4f[_0x9938('0x37')][_0x9938('0x39')]?_0x443a4f[_0x9938('0x37')]:_0x28dd0b[_0x9938('0x33')];if(_0x3af765[_0x9938('0x34')][_0x9938('0x45')]){_0x443a4f[_0x9938('0x46')]=[{'all':!![]}];}_0x443a4f=_['merge']({},_0x443a4f,_0x3af765[_0x9938('0x43')]);return db[_0x9938('0x2f')][_0x9938('0x4b')](_0x443a4f)['then'](handleEntityNotFound(_0x39f807,null))[_0x9938('0x44')](respondWithResult(_0x39f807,null))[_0x9938('0x49')](handleError(_0x39f807,null));};exports['create']=function(_0x3adb73,_0x34776a){return db[_0x9938('0x2f')][_0x9938('0x4c')](_0x3adb73[_0x9938('0x4d')],{})['then'](respondWithResult(_0x34776a,0xc9))[_0x9938('0x49')](handleError(_0x34776a,null));};exports[_0x9938('0x26')]=function(_0x1eaad3,_0x50269c){if(_0x1eaad3[_0x9938('0x4d')]['id']){delete _0x1eaad3[_0x9938('0x4d')]['id'];}return db[_0x9938('0x2f')][_0x9938('0x4b')]({'where':{'id':_0x1eaad3['params']['id']}})['then'](handleEntityNotFound(_0x50269c,null))['then'](saveUpdates(_0x1eaad3[_0x9938('0x4d')],null))[_0x9938('0x44')](respondWithResult(_0x50269c,null))[_0x9938('0x49')](handleError(_0x50269c,null));};exports['destroy']=function(_0x320bd5,_0x10c95d){return db[_0x9938('0x2f')]['find']({'where':{'id':_0x320bd5[_0x9938('0x4a')]['id']}})['then'](handleEntityNotFound(_0x10c95d,null))['then'](removeEntity(_0x10c95d,null))[_0x9938('0x49')](handleError(_0x10c95d,null));}; \ No newline at end of file +var _0x188c=['includeAll','include','findAll','rows','show','find','catch','create','body','destroy','params','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','end','error','name','send','index','SmsApplication','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','VIRTUAL','filter','merge','options'];(function(_0x3247e6,_0x2ba462){var _0xa1beb6=function(_0x172d6d){while(--_0x172d6d){_0x3247e6['push'](_0x3247e6['shift']());}};_0xa1beb6(++_0x2ba462);}(_0x188c,0x9f));var _0xc188=function(_0x2ef60e,_0x35c32c){_0x2ef60e=_0x2ef60e-0x0;var _0x3be207=_0x188c[_0x2ef60e];return _0x3be207;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc188('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc188('0x1'));var moment=require('moment');var BPromise=require(_0xc188('0x2'));var Mustache=require(_0xc188('0x3'));var util=require(_0xc188('0x4'));var path=require(_0xc188('0x5'));var sox=require(_0xc188('0x6'));var csv=require(_0xc188('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc188('0x8'));var _=require(_0xc188('0x9'));var squel=require(_0xc188('0xa'));var crypto=require(_0xc188('0xb'));var jsforce=require(_0xc188('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xc188('0x7'));var querystring=require(_0xc188('0xd'));var Papa=require(_0xc188('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc188('0xf'));var hardwareService=require(_0xc188('0x10'));var logger=require(_0xc188('0x11'))(_0xc188('0x12'));var utils=require(_0xc188('0x13'));var config=require(_0xc188('0x14'));var licenseUtil=require(_0xc188('0x15'));var db=require(_0xc188('0x16'))['db'];function respondWithStatusCode(_0x4b11bc,_0x80402){_0x80402=_0x80402||0xcc;return function(_0xce3483){if(_0xce3483){return _0x4b11bc[_0xc188('0x17')](_0x80402);}return _0x4b11bc[_0xc188('0x18')](_0x80402)['end']();};}function respondWithResult(_0x54c8dd,_0x54fb53){_0x54fb53=_0x54fb53||0xc8;return function(_0x3b3009){if(_0x3b3009){return _0x54c8dd[_0xc188('0x18')](_0x54fb53)[_0xc188('0x19')](_0x3b3009);}};}function respondWithFilteredResult(_0x5d8cd3,_0x244957){return function(_0x5a9f7){if(_0x5a9f7){var _0x31d01f=typeof _0x244957[_0xc188('0x1a')]===_0xc188('0x1b')&&typeof _0x244957[_0xc188('0x1c')]===_0xc188('0x1b');var _0x16adce=_0x5a9f7[_0xc188('0x1d')];var _0x540423=_0x31d01f?0x0:_0x244957[_0xc188('0x1a')];var _0x56b1a2=_0x31d01f?_0x5a9f7['count']:_0x244957[_0xc188('0x1a')]+_0x244957['limit'];var _0x59cd73;if(_0x56b1a2>=_0x16adce){_0x56b1a2=_0x16adce;_0x59cd73=0xc8;}else{_0x59cd73=0xce;}_0x5d8cd3[_0xc188('0x18')](_0x59cd73);return _0x5d8cd3[_0xc188('0x1e')](_0xc188('0x1f'),_0x540423+'-'+_0x56b1a2+'/'+_0x16adce)[_0xc188('0x19')](_0x5a9f7);}return null;};}function patchUpdates(_0x934304){return function(_0x5e3ff7){try{jsonpatch[_0xc188('0x20')](_0x5e3ff7,_0x934304,!![]);}catch(_0x3b8a79){return BPromise[_0xc188('0x21')](_0x3b8a79);}return _0x5e3ff7[_0xc188('0x22')]();};}function saveUpdates(_0x5005d,_0x2499f8){return function(_0x19ec3c){if(_0x19ec3c){return _0x19ec3c[_0xc188('0x23')](_0x5005d)[_0xc188('0x24')](function(_0x3dec77){return _0x3dec77;});}return null;};}function removeEntity(_0x498712,_0x590cb9){return function(_0x3e662c){if(_0x3e662c){return _0x3e662c['destroy']()['then'](function(){_0x498712[_0xc188('0x18')](0xcc)[_0xc188('0x25')]();});}};}function handleEntityNotFound(_0xe74dcb,_0x25fb2e){return function(_0x4c31bc){if(!_0x4c31bc){_0xe74dcb['sendStatus'](0x194);}return _0x4c31bc;};}function handleError(_0x3493f7,_0x3a44d7){_0x3a44d7=_0x3a44d7||0x1f4;return function(_0x50a119){logger[_0xc188('0x26')](_0x50a119['stack']);if(_0x50a119[_0xc188('0x27')]){delete _0x50a119['name'];}_0x3493f7[_0xc188('0x18')](_0x3a44d7)[_0xc188('0x28')](_0x50a119);};}exports[_0xc188('0x29')]=function(_0xd2a560,_0x230591){var _0x162c30={},_0xaf7e8={},_0x2f9de7={'count':0x0,'rows':[]};var _0x23c245=_['map'](db[_0xc188('0x2a')]['rawAttributes'],function(_0xece17e){return{'name':_0xece17e[_0xc188('0x2b')],'type':_0xece17e['type'][_0xc188('0x2c')]};});_0xaf7e8[_0xc188('0x2d')]=_[_0xc188('0x2e')](_0x23c245,_0xc188('0x27'));_0xaf7e8[_0xc188('0x2f')]=_[_0xc188('0x30')](_0xd2a560[_0xc188('0x2f')]);_0xaf7e8[_0xc188('0x31')]=_[_0xc188('0x32')](_0xaf7e8[_0xc188('0x2d')],_0xaf7e8[_0xc188('0x2f')]);_0x162c30[_0xc188('0x33')]=_[_0xc188('0x32')](_0xaf7e8['model'],qs[_0xc188('0x34')](_0xd2a560[_0xc188('0x2f')][_0xc188('0x34')]));_0x162c30[_0xc188('0x33')]=_0x162c30[_0xc188('0x33')][_0xc188('0x35')]?_0x162c30['attributes']:_0xaf7e8[_0xc188('0x2d')];if(!_0xd2a560[_0xc188('0x2f')][_0xc188('0x36')]('nolimit')){_0x162c30[_0xc188('0x1c')]=qs[_0xc188('0x1c')](_0xd2a560[_0xc188('0x2f')][_0xc188('0x1c')]);_0x162c30[_0xc188('0x1a')]=qs['offset'](_0xd2a560[_0xc188('0x2f')][_0xc188('0x1a')]);}_0x162c30[_0xc188('0x37')]=qs['sort'](_0xd2a560['query'][_0xc188('0x38')]);_0x162c30[_0xc188('0x39')]=qs[_0xc188('0x31')](_[_0xc188('0x3a')](_0xd2a560['query'],_0xaf7e8[_0xc188('0x31')]),_0x23c245);if(_0xd2a560[_0xc188('0x2f')]['filter']){_0x162c30[_0xc188('0x39')]=_['merge'](_0x162c30[_0xc188('0x39')],{'$or':_['map'](_0x23c245,function(_0x4d02a3){if(_0x4d02a3['type']!==_0xc188('0x3b')){var _0x468c63={};_0x468c63[_0x4d02a3[_0xc188('0x27')]]={'$like':'%'+_0xd2a560[_0xc188('0x2f')][_0xc188('0x3c')]+'%'};return _0x468c63;}})});}_0x162c30=_[_0xc188('0x3d')]({},_0x162c30,_0xd2a560[_0xc188('0x3e')]);var _0x5edcfd={'where':_0x162c30['where']};return db[_0xc188('0x2a')][_0xc188('0x1d')](_0x5edcfd)[_0xc188('0x24')](function(_0x4d1698){_0x2f9de7[_0xc188('0x1d')]=_0x4d1698;if(_0xd2a560['query'][_0xc188('0x3f')]){_0x162c30[_0xc188('0x40')]=[{'all':!![]}];}return db[_0xc188('0x2a')][_0xc188('0x41')](_0x162c30);})[_0xc188('0x24')](function(_0x4eeacd){_0x2f9de7[_0xc188('0x42')]=_0x4eeacd;return _0x2f9de7;})[_0xc188('0x24')](respondWithFilteredResult(_0x230591,_0x162c30))['catch'](handleError(_0x230591,null));};exports[_0xc188('0x43')]=function(_0x8bca80,_0x14d2d9){var _0x87d050={'raw':!![],'where':{'id':_0x8bca80['params']['id']}},_0x5794a0={};_0x5794a0[_0xc188('0x2d')]=_[_0xc188('0x30')](db[_0xc188('0x2a')]['rawAttributes']);_0x5794a0[_0xc188('0x2f')]=_[_0xc188('0x30')](_0x8bca80[_0xc188('0x2f')]);_0x5794a0[_0xc188('0x31')]=_[_0xc188('0x32')](_0x5794a0[_0xc188('0x2d')],_0x5794a0[_0xc188('0x2f')]);_0x87d050[_0xc188('0x33')]=_[_0xc188('0x32')](_0x5794a0[_0xc188('0x2d')],qs[_0xc188('0x34')](_0x8bca80[_0xc188('0x2f')][_0xc188('0x34')]));_0x87d050[_0xc188('0x33')]=_0x87d050[_0xc188('0x33')][_0xc188('0x35')]?_0x87d050[_0xc188('0x33')]:_0x5794a0[_0xc188('0x2d')];if(_0x8bca80[_0xc188('0x2f')]['includeAll']){_0x87d050[_0xc188('0x40')]=[{'all':!![]}];}_0x87d050=_[_0xc188('0x3d')]({},_0x87d050,_0x8bca80[_0xc188('0x3e')]);return db[_0xc188('0x2a')][_0xc188('0x44')](_0x87d050)[_0xc188('0x24')](handleEntityNotFound(_0x14d2d9,null))['then'](respondWithResult(_0x14d2d9,null))[_0xc188('0x45')](handleError(_0x14d2d9,null));};exports[_0xc188('0x46')]=function(_0x5da01c,_0x55d51f){return db['SmsApplication'][_0xc188('0x46')](_0x5da01c[_0xc188('0x47')],{})[_0xc188('0x24')](respondWithResult(_0x55d51f,0xc9))[_0xc188('0x45')](handleError(_0x55d51f,null));};exports[_0xc188('0x23')]=function(_0x1c67c0,_0x4064a4){if(_0x1c67c0[_0xc188('0x47')]['id']){delete _0x1c67c0[_0xc188('0x47')]['id'];}return db[_0xc188('0x2a')][_0xc188('0x44')]({'where':{'id':_0x1c67c0['params']['id']}})['then'](handleEntityNotFound(_0x4064a4,null))[_0xc188('0x24')](saveUpdates(_0x1c67c0[_0xc188('0x47')],null))['then'](respondWithResult(_0x4064a4,null))[_0xc188('0x45')](handleError(_0x4064a4,null));};exports[_0xc188('0x48')]=function(_0x93e715,_0x1969ee){return db[_0xc188('0x2a')]['find']({'where':{'id':_0x93e715[_0xc188('0x49')]['id']}})[_0xc188('0x24')](handleEntityNotFound(_0x1969ee,null))[_0xc188('0x24')](removeEntity(_0x1969ee,null))[_0xc188('0x45')](handleError(_0x1969ee,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index e5ff786..0a5a0ec 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 _0xe091=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','SmsApplication','sms_applications','utf8mb4_unicode_ci','lodash','util','api'];(function(_0x451bc0,_0xb63ad5){var _0x425174=function(_0x1cc82b){while(--_0x1cc82b){_0x451bc0['push'](_0x451bc0['shift']());}};_0x425174(++_0xb63ad5);}(_0xe091,0x1de));var _0x1e09=function(_0x48d2a6,_0x37d686){_0x48d2a6=_0x48d2a6-0x0;var _0x506f00=_0xe091[_0x48d2a6];return _0x506f00;};'use strict';var _=require(_0x1e09('0x0'));var util=require(_0x1e09('0x1'));var logger=require('../../config/logger')(_0x1e09('0x2'));var moment=require(_0x1e09('0x3'));var BPromise=require(_0x1e09('0x4'));var rp=require(_0x1e09('0x5'));var fs=require('fs');var path=require(_0x1e09('0x6'));var rimraf=require(_0x1e09('0x7'));var config=require(_0x1e09('0x8'));var attributes=require('./smsApplication.attributes');module[_0x1e09('0x9')]=function(_0x3a3974,_0x44ae00){return _0x3a3974['define'](_0x1e09('0xa'),attributes,{'tableName':_0x1e09('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x1e09('0xc')});}; \ No newline at end of file +var _0x240d=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./smsApplication.attributes','exports','define','SmsApplication','sms_applications'];(function(_0x545795,_0x176bcf){var _0x4ad27f=function(_0x34a367){while(--_0x34a367){_0x545795['push'](_0x545795['shift']());}};_0x4ad27f(++_0x176bcf);}(_0x240d,0xa2));var _0xd240=function(_0x189e6f,_0x37001e){_0x189e6f=_0x189e6f-0x0;var _0x3f31ff=_0x240d[_0x189e6f];return _0x3f31ff;};'use strict';var _=require(_0xd240('0x0'));var util=require(_0xd240('0x1'));var logger=require(_0xd240('0x2'))(_0xd240('0x3'));var moment=require(_0xd240('0x4'));var BPromise=require(_0xd240('0x5'));var rp=require(_0xd240('0x6'));var fs=require('fs');var path=require(_0xd240('0x7'));var rimraf=require(_0xd240('0x8'));var config=require('../../config/environment');var attributes=require(_0xd240('0x9'));module[_0xd240('0xa')]=function(_0x2e4ae4,_0x16df4f){return _0x2e4ae4[_0xd240('0xb')](_0xd240('0xc'),attributes,{'tableName':_0xd240('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd240('0xe'),'collate':_0xd240('0xf')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 5dec8e7..00dc477 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 _0x46c1=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','util','moment'];(function(_0x4a9cdc,_0x1a9aec){var _0x261ee2=function(_0xe4354){while(--_0xe4354){_0x4a9cdc['push'](_0x4a9cdc['shift']());}};_0x261ee2(++_0x1a9aec);}(_0x46c1,0x7c));var _0x146c=function(_0x5bca79,_0x5703d5){_0x5bca79=_0x5bca79-0x0;var _0x72c2ee=_0x46c1[_0x5bca79];return _0x72c2ee;};'use strict';var _=require('lodash');var util=require(_0x146c('0x0'));var moment=require(_0x146c('0x1'));var BPromise=require(_0x146c('0x2'));var rs=require(_0x146c('0x3'));var fs=require('fs');var Redis=require(_0x146c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x146c('0x5'));var logger=require(_0x146c('0x6'))(_0x146c('0x7'));var config=require(_0x146c('0x8'));var jayson=require(_0x146c('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2e394f,_0x226480,_0x3bccd4){return new BPromise(function(_0x54f99b,_0x36a8c2){return client['request'](_0x2e394f,_0x3bccd4)[_0x146c('0xa')](function(_0x2c8c0a){logger['info'](_0x146c('0xb'),_0x226480,_0x146c('0xc'));logger[_0x146c('0xd')](_0x146c('0xe'),_0x226480,'request\x20sent',JSON[_0x146c('0xf')](_0x2c8c0a));if(_0x2c8c0a['error']){if(_0x2c8c0a[_0x146c('0x10')][_0x146c('0x11')]===0x1f4){logger[_0x146c('0x10')]('SmsApplication,\x20%s,\x20%s',_0x226480,_0x2c8c0a[_0x146c('0x10')]['message']);return _0x36a8c2(_0x2c8c0a[_0x146c('0x10')]['message']);}logger[_0x146c('0x10')](_0x146c('0xb'),_0x226480,_0x2c8c0a[_0x146c('0x10')][_0x146c('0x12')]);return _0x54f99b(_0x2c8c0a['error'][_0x146c('0x12')]);}else{logger[_0x146c('0x13')]('SmsApplication,\x20%s,\x20%s',_0x226480,_0x146c('0xc'));_0x54f99b(_0x2c8c0a['result']['message']);}})[_0x146c('0x14')](function(_0x512ac8){logger[_0x146c('0x10')](_0x146c('0xb'),_0x226480,_0x512ac8);_0x36a8c2(_0x512ac8);});});} \ No newline at end of file +var _0xd481=['catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x46422e,_0x30a360){var _0x1cc7d9=function(_0xcd413e){while(--_0xcd413e){_0x46422e['push'](_0x46422e['shift']());}};_0x1cc7d9(++_0x30a360);}(_0xd481,0x1e4));var _0x1d48=function(_0x19b6f0,_0xdc6f56){_0x19b6f0=_0x19b6f0-0x0;var _0x2e4bfb=_0xd481[_0x19b6f0];return _0x2e4bfb;};'use strict';var _=require(_0x1d48('0x0'));var util=require('util');var moment=require(_0x1d48('0x1'));var BPromise=require(_0x1d48('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1d48('0x3'));var db=require(_0x1d48('0x4'))['db'];var utils=require(_0x1d48('0x5'));var logger=require('../../config/logger')(_0x1d48('0x6'));var config=require('../../config/environment');var jayson=require(_0x1d48('0x7'));var client=jayson[_0x1d48('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x472584,_0x3099cc,_0x3b8bd4){return new BPromise(function(_0x27c383,_0x1fc969){return client[_0x1d48('0x9')](_0x472584,_0x3b8bd4)[_0x1d48('0xa')](function(_0x303dce){logger[_0x1d48('0xb')](_0x1d48('0xc'),_0x3099cc,_0x1d48('0xd'));logger[_0x1d48('0xe')]('SmsApplication,\x20%s,\x20%s,\x20%s',_0x3099cc,_0x1d48('0xd'),JSON[_0x1d48('0xf')](_0x303dce));if(_0x303dce[_0x1d48('0x10')]){if(_0x303dce[_0x1d48('0x10')][_0x1d48('0x11')]===0x1f4){logger[_0x1d48('0x10')](_0x1d48('0xc'),_0x3099cc,_0x303dce[_0x1d48('0x10')][_0x1d48('0x12')]);return _0x1fc969(_0x303dce[_0x1d48('0x10')]['message']);}logger[_0x1d48('0x10')]('SmsApplication,\x20%s,\x20%s',_0x3099cc,_0x303dce[_0x1d48('0x10')][_0x1d48('0x12')]);return _0x27c383(_0x303dce[_0x1d48('0x10')][_0x1d48('0x12')]);}else{logger['info'](_0x1d48('0xc'),_0x3099cc,_0x1d48('0xd'));_0x27c383(_0x303dce[_0x1d48('0x13')]['message']);}})[_0x1d48('0x14')](function(_0x433c92){logger[_0x1d48('0x10')](_0x1d48('0xc'),_0x3099cc,_0x433c92);_0x1fc969(_0x433c92);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 126556e..20054e4 100644 --- a/server/api/smsInteraction/index.js +++ b/server/api/smsInteraction/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xea28=['put','smsinteraction:update','update','delete','smsinteraction:destroy','destroy','/:id/tags','removeTags','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./smsInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/messages','/:id/download','download','create','post','tracked','sms','smsinteraction:addtags','addTags'];(function(_0x5a0628,_0x8491ee){var _0x265e14=function(_0x340ef9){while(--_0x340ef9){_0x5a0628['push'](_0x5a0628['shift']());}};_0x265e14(++_0x8491ee);}(_0xea28,0x13a));var _0x8ea2=function(_0x4528f3,_0x347aca){_0x4528f3=_0x4528f3-0x0;var _0x5480bf=_0xea28[_0x4528f3];return _0x5480bf;};'use strict';var multer=require(_0x8ea2('0x0'));var util=require(_0x8ea2('0x1'));var path=require(_0x8ea2('0x2'));var timeout=require(_0x8ea2('0x3'));var express=require(_0x8ea2('0x4'));var router=express[_0x8ea2('0x5')]();var fs_extra=require(_0x8ea2('0x6'));var auth=require(_0x8ea2('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x8ea2('0x8'));var controller=require(_0x8ea2('0x9'));router[_0x8ea2('0xa')]('/',auth['isAuthenticated'](),controller[_0x8ea2('0xb')]);router[_0x8ea2('0xa')](_0x8ea2('0xc'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0xe')]);router[_0x8ea2('0xa')](_0x8ea2('0xf'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x10')]);router[_0x8ea2('0xa')](_0x8ea2('0x11'),auth[_0x8ea2('0xd')](),controller['getMessages']);router['get'](_0x8ea2('0x12'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x13')]);router['post']('/',auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x14')]);router[_0x8ea2('0x15')](_0x8ea2('0x11'),auth[_0x8ea2('0xd')](),controller['addMessage']);router[_0x8ea2('0x15')]('/:id/tags',auth['isAuthenticated'](),interaction[_0x8ea2('0x16')](_0x8ea2('0x17'),_0x8ea2('0x18')),controller[_0x8ea2('0x19')]);router[_0x8ea2('0x1a')](_0x8ea2('0xf'),auth[_0x8ea2('0xd')](),interaction[_0x8ea2('0x16')](_0x8ea2('0x17'),_0x8ea2('0x1b')),controller[_0x8ea2('0x1c')]);router[_0x8ea2('0x1d')](_0x8ea2('0xf'),auth[_0x8ea2('0xd')](),interaction[_0x8ea2('0x16')](_0x8ea2('0x17'),_0x8ea2('0x1e')),controller[_0x8ea2('0x1f')]);router[_0x8ea2('0x1d')](_0x8ea2('0x20'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x21')]);module['exports']=router; \ No newline at end of file +var _0xe511=['addTags','put','update','smsinteraction:destroy','destroy','delete','exports','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','index','describe','show','/:id/messages','isAuthenticated','getMessages','download','post','create','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags'];(function(_0x2faddb,_0xc18b78){var _0x273c05=function(_0x1a3785){while(--_0x1a3785){_0x2faddb['push'](_0x2faddb['shift']());}};_0x273c05(++_0xc18b78);}(_0xe511,0x16f));var _0x1e51=function(_0x1db863,_0x8f181d){_0x1db863=_0x1db863-0x0;var _0x18b578=_0xe511[_0x1db863];return _0x18b578;};'use strict';var multer=require(_0x1e51('0x0'));var util=require(_0x1e51('0x1'));var path=require('path');var timeout=require(_0x1e51('0x2'));var express=require('express');var router=express[_0x1e51('0x3')]();var fs_extra=require(_0x1e51('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x1e51('0x5'));var config=require(_0x1e51('0x6'));var controller=require(_0x1e51('0x7'));router[_0x1e51('0x8')]('/',auth['isAuthenticated'](),controller[_0x1e51('0x9')]);router[_0x1e51('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x1e51('0xa')]);router[_0x1e51('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x1e51('0xb')]);router[_0x1e51('0x8')](_0x1e51('0xc'),auth[_0x1e51('0xd')](),controller[_0x1e51('0xe')]);router[_0x1e51('0x8')]('/:id/download',auth[_0x1e51('0xd')](),controller[_0x1e51('0xf')]);router[_0x1e51('0x10')]('/',auth[_0x1e51('0xd')](),controller[_0x1e51('0x11')]);router[_0x1e51('0x10')]('/:id/messages',auth[_0x1e51('0xd')](),controller[_0x1e51('0x12')]);router[_0x1e51('0x10')](_0x1e51('0x13'),auth[_0x1e51('0xd')](),interaction[_0x1e51('0x14')](_0x1e51('0x15'),_0x1e51('0x16')),controller[_0x1e51('0x17')]);router[_0x1e51('0x18')]('/:id',auth[_0x1e51('0xd')](),interaction[_0x1e51('0x14')](_0x1e51('0x15'),'smsinteraction:update'),controller[_0x1e51('0x19')]);router['delete']('/:id',auth[_0x1e51('0xd')](),interaction[_0x1e51('0x14')](_0x1e51('0x15'),_0x1e51('0x1a')),controller[_0x1e51('0x1b')]);router[_0x1e51('0x1c')]('/:id/tags',auth[_0x1e51('0xd')](),controller['removeTags']);module[_0x1e51('0x1d')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 1d178a8..76bbe97 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 _0xd634=['exports','STRING','DATE','ENUM','out','BOOLEAN','moment'];(function(_0x4abe1a,_0x307b8b){var _0x607d86=function(_0x1c2f7a){while(--_0x1c2f7a){_0x4abe1a['push'](_0x4abe1a['shift']());}};_0x607d86(++_0x307b8b);}(_0xd634,0xf4));var _0x4d63=function(_0x5a26f5,_0x196300){_0x5a26f5=_0x5a26f5-0x0;var _0x2e9ef7=_0xd634[_0x5a26f5];return _0x2e9ef7;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x4d63('0x0'));module[_0x4d63('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x4d63('0x2')]},'secondDisposition':{'type':Sequelize[_0x4d63('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x4d63('0x2')]},'read1stAt':{'type':Sequelize[_0x4d63('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x4d63('0x4')]('in',_0x4d63('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x4d63('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x4d63('0x4')]('in',_0x4d63('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x4d63('0x6')],'defaultValue':![]}}; \ No newline at end of file +var _0x1b94=['ENUM','out','sequelize','moment','exports','BOOLEAN','DATE','STRING'];(function(_0x487de7,_0x3952ed){var _0x496107=function(_0x2cd74d){while(--_0x2cd74d){_0x487de7['push'](_0x487de7['shift']());}};_0x496107(++_0x3952ed);}(_0x1b94,0x1f2));var _0x41b9=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0x1b94[_0x3070dc];return _0x431489;};'use strict';var Sequelize=require(_0x41b9('0x0'));var moment=require(_0x41b9('0x1'));module[_0x41b9('0x2')]={'closed':{'type':Sequelize[_0x41b9('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x41b9('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x41b9('0x5')]},'thirdDisposition':{'type':Sequelize[_0x41b9('0x5')]},'note':{'type':Sequelize[_0x41b9('0x5')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x41b9('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x41b9('0x6')]('in',_0x41b9('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x41b9('0x6')]('in',_0x41b9('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x41b9('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index d3febfb..9ba999d 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 _0x663b=['findOne','hasOwnProperty','nolimit','order','where','pick','SmsInteractionId','merge','filter','$gte','split','count','findAll','rows','addTags','setTags','spread','Tag','color','emit','smsInteractionTags:save','removeTags','toString','join','root','server','files','tmp','transcript-%d-%s.zip','push','User','fullname','CmContact','lastName','createdAt','direction','secret','Owner','get','mkdirSync','Sms','Account','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','out','Contact','read','value','renderFile','downloadInteraction.ejs','createPdfFromHTML','download','err','rimraf','zip-dir','moment','bluebird','util','path','ejs','../../components/interaction/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','then','error','stack','name','send','map','SmsInteraction','rawAttributes','fieldName','type','key','sms','query','catch','params','keys','filters','intersection','model','attributes','fields','length','includeAll','include','options','find','create','update','body','destroy','describe','addMessage','SmsMessage','ids','omit','getMessages'];(function(_0xe67e22,_0x547e07){var _0x39ff12=function(_0x4496d2){while(--_0x4496d2){_0xe67e22['push'](_0xe67e22['shift']());}};_0x39ff12(++_0x547e07);}(_0x663b,0x120));var _0xb663=function(_0x1b7368,_0x3286ed){_0x1b7368=_0x1b7368-0x0;var _0x25d54c=_0x663b[_0x1b7368];return _0x25d54c;};'use strict';var rimraf=require(_0xb663('0x0'));var zipdir=require(_0xb663('0x1'));var moment=require(_0xb663('0x2'));var BPromise=require(_0xb663('0x3'));var util=require(_0xb663('0x4'));var path=require(_0xb663('0x5'));var ejs=require(_0xb663('0x6'));var fs=require('fs');var _=require('lodash');var Redis=require('ioredis');var interaction=require(_0xb663('0x7'));var qs=require(_0xb663('0x8'));var pdf=require('../../components/export/pdf');var logger=require(_0xb663('0x9'))('api');var config=require(_0xb663('0xa'));var db=require(_0xb663('0xb'))['db'];config[_0xb663('0xc')]=_[_0xb663('0xd')](config['redis'],{'host':_0xb663('0xe'),'port':0x18eb});var socket=require(_0xb663('0xf'))(new Redis(config[_0xb663('0xc')]));require(_0xb663('0x10'))[_0xb663('0x11')](socket);function respondWithStatusCode(_0x7ec7d,_0x401664){_0x401664=_0x401664||0xcc;return function(_0x5542db){if(_0x5542db){return _0x7ec7d[_0xb663('0x12')](_0x401664);}return _0x7ec7d['status'](_0x401664)[_0xb663('0x13')]();};}function respondWithResult(_0x4d334a,_0x45c3b6){_0x45c3b6=_0x45c3b6||0xc8;return function(_0x35b2e2){if(_0x35b2e2){return _0x4d334a[_0xb663('0x14')](_0x45c3b6)[_0xb663('0x15')](_0x35b2e2);}};}function respondWithFilteredResult(_0x413eed,_0x5016f1){return function(_0x384a59){if(_0x384a59){var _0x364493=typeof _0x5016f1[_0xb663('0x16')]===_0xb663('0x17')&&typeof _0x5016f1[_0xb663('0x18')]===_0xb663('0x17');var _0xb28fab=_0x384a59['count'];var _0x35d89f=_0x364493?0x0:_0x5016f1['offset'];var _0x27fcbd=_0x364493?_0x384a59['count']:_0x5016f1[_0xb663('0x16')]+_0x5016f1[_0xb663('0x18')];var _0x2ca088;if(_0x27fcbd>=_0xb28fab){_0x27fcbd=_0xb28fab;_0x2ca088=0xc8;}else{_0x2ca088=0xce;}_0x413eed[_0xb663('0x14')](_0x2ca088);return _0x413eed[_0xb663('0x19')](_0xb663('0x1a'),_0x35d89f+'-'+_0x27fcbd+'/'+_0xb28fab)[_0xb663('0x15')](_0x384a59);}return null;};}function saveUpdates(_0x1ea008){return function(_0x574cc3){if(_0x574cc3){return _0x574cc3['update'](_0x1ea008)[_0xb663('0x1b')](function(_0x504900){return _0x504900;});}return null;};}function removeEntity(_0x2969df){return function(_0x316638){if(_0x316638){return _0x316638['destroy']()[_0xb663('0x1b')](function(){_0x2969df[_0xb663('0x14')](0xcc)[_0xb663('0x13')]();});}};}function handleEntityNotFound(_0x3308a1){return function(_0x19bbec){if(!_0x19bbec){_0x3308a1[_0xb663('0x12')](0x194);}return _0x19bbec;};}function handleError(_0x5206cb,_0x3af20f){_0x3af20f=_0x3af20f||0x1f4;return function(_0xdbe07d){logger[_0xb663('0x1c')](_0xdbe07d[_0xb663('0x1d')]);if(_0xdbe07d['name']){delete _0xdbe07d[_0xb663('0x1e')];}_0x5206cb['status'](_0x3af20f)[_0xb663('0x1f')](_0xdbe07d);};}exports['index']=function(_0x18c675,_0x3099ca){var _0x3d913d={};var _0x40d4b7=_[_0xb663('0x20')](db[_0xb663('0x21')][_0xb663('0x22')],function(_0x20cf11){return{'name':_0x20cf11[_0xb663('0x23')],'type':_0x20cf11[_0xb663('0x24')][_0xb663('0x25')]};});_0x3d913d=qs['getOptions'](_0x40d4b7,_0x18c675);return interaction['findAll'](_0xb663('0x26'),_0x18c675[_0xb663('0x27')],_0x18c675['user'],_0x3d913d,_0x40d4b7)['then'](respondWithFilteredResult(_0x3099ca,_0x3d913d))[_0xb663('0x28')](handleError(_0x3099ca,null));};exports['show']=function(_0x59dee4,_0x26efae){var _0x3e5315={'raw':![],'where':{'id':_0x59dee4[_0xb663('0x29')]['id']}},_0x353530={};_0x353530['model']=_[_0xb663('0x2a')](db[_0xb663('0x21')][_0xb663('0x22')]);_0x353530[_0xb663('0x27')]=_[_0xb663('0x2a')](_0x59dee4[_0xb663('0x27')]);_0x353530[_0xb663('0x2b')]=_[_0xb663('0x2c')](_0x353530[_0xb663('0x2d')],_0x353530[_0xb663('0x27')]);_0x3e5315[_0xb663('0x2e')]=_['intersection'](_0x353530[_0xb663('0x2d')],qs[_0xb663('0x2f')](_0x59dee4['query'][_0xb663('0x2f')]));_0x3e5315['attributes']=_0x3e5315[_0xb663('0x2e')][_0xb663('0x30')]?_0x3e5315[_0xb663('0x2e')]:_0x353530[_0xb663('0x2d')];if(_0x59dee4[_0xb663('0x27')][_0xb663('0x31')]){_0x3e5315[_0xb663('0x32')]=[{'all':!![]}];}_0x3e5315=_['merge']({},_0x3e5315,_0x59dee4[_0xb663('0x33')]);return db[_0xb663('0x21')][_0xb663('0x34')](_0x3e5315)[_0xb663('0x1b')](handleEntityNotFound(_0x26efae,null))['then'](respondWithResult(_0x26efae,null))[_0xb663('0x28')](handleError(_0x26efae,null));};exports['create']=function(_0x4cbd7d,_0x2f7c3f){return db[_0xb663('0x21')][_0xb663('0x35')](_0x4cbd7d['body'],{})[_0xb663('0x1b')](respondWithResult(_0x2f7c3f,0xc9))['catch'](handleError(_0x2f7c3f,null));};exports[_0xb663('0x36')]=function(_0x2e7751,_0xa63348){if(_0x2e7751[_0xb663('0x37')]['id']){delete _0x2e7751['body']['id'];}return db['SmsInteraction'][_0xb663('0x34')]({'where':{'id':_0x2e7751['params']['id']}})[_0xb663('0x1b')](handleEntityNotFound(_0xa63348,null))[_0xb663('0x1b')](saveUpdates(_0x2e7751[_0xb663('0x37')],null))['then'](respondWithResult(_0xa63348,null))[_0xb663('0x28')](handleError(_0xa63348,null));};exports[_0xb663('0x38')]=function(_0x9681b1,_0x243d86){return db[_0xb663('0x21')][_0xb663('0x34')]({'where':{'id':_0x9681b1['params']['id']}})['then'](handleEntityNotFound(_0x243d86,null))[_0xb663('0x1b')](removeEntity(_0x243d86,null))[_0xb663('0x28')](handleError(_0x243d86,null));};exports['describe']=function(_0x3522a0,_0x4cd6dd){return db['SmsInteraction'][_0xb663('0x39')]()[_0xb663('0x1b')](respondWithResult(_0x4cd6dd,null))['catch'](handleError(_0x4cd6dd,null));};exports[_0xb663('0x3a')]=function(_0x5f2c03,_0x524069){return db[_0xb663('0x3b')][_0xb663('0x34')]({'where':{'id':_0x5f2c03[_0xb663('0x29')]['id']}})[_0xb663('0x1b')](handleEntityNotFound(_0x524069,null))[_0xb663('0x1b')](function(_0x1fd5dd){if(_0x1fd5dd){return _0x1fd5dd[_0xb663('0x3a')](_0x5f2c03[_0xb663('0x37')][_0xb663('0x3c')],_[_0xb663('0x3d')](_0x5f2c03['body'],[_0xb663('0x3c'),'id'])||{});}})['then'](respondWithResult(_0x524069,null))[_0xb663('0x28')](handleError(_0x524069,null));};exports[_0xb663('0x3e')]=function(_0x4f31b1,_0x2f0218){var _0x39031a={'raw':![],'where':{}};var _0x4ed995={};var _0x5e8817={'count':0x0,'rows':[]};return db[_0xb663('0x21')][_0xb663('0x3f')]({'where':{'id':_0x4f31b1['params']['id']}})['then'](handleEntityNotFound(_0x2f0218,null))[_0xb663('0x1b')](function(_0x1ec2f9){if(_0x1ec2f9){_0x4ed995['model']=_[_0xb663('0x2a')](db[_0xb663('0x3b')][_0xb663('0x22')]);_0x4ed995[_0xb663('0x27')]=_[_0xb663('0x2a')](_0x4f31b1[_0xb663('0x27')]);_0x4ed995['filters']=_['intersection'](_0x4ed995['model'],_0x4ed995[_0xb663('0x27')]);_0x39031a[_0xb663('0x2e')]=_[_0xb663('0x2c')](_0x4ed995[_0xb663('0x2d')],qs[_0xb663('0x2f')](_0x4f31b1[_0xb663('0x27')]['fields']));_0x39031a[_0xb663('0x2e')]=_0x39031a[_0xb663('0x2e')]['length']?_0x39031a['attributes']:_0x4ed995['model'];if(!_0x4f31b1[_0xb663('0x27')][_0xb663('0x40')](_0xb663('0x41'))){_0x39031a['limit']=qs[_0xb663('0x18')](_0x4f31b1[_0xb663('0x27')]['limit']);_0x39031a[_0xb663('0x16')]=qs[_0xb663('0x16')](_0x4f31b1[_0xb663('0x27')][_0xb663('0x16')]);}_0x39031a[_0xb663('0x42')]=qs['sort'](_0x4f31b1['query']['sort']);_0x39031a[_0xb663('0x43')]=qs[_0xb663('0x2b')](_[_0xb663('0x44')](_0x4f31b1[_0xb663('0x27')],_0x4ed995[_0xb663('0x2b')]));_0x39031a['where'][_0xb663('0x45')]=_0x1ec2f9['id'];if(_0x4f31b1[_0xb663('0x27')]['filter']){_0x39031a[_0xb663('0x43')]=_[_0xb663('0x46')](_0x39031a[_0xb663('0x43')],{'$or':_[_0xb663('0x20')](_0x39031a[_0xb663('0x2e')],function(_0x204322){var _0x3b9237={};_0x3b9237[_0x204322]={'$like':'%'+_0x4f31b1[_0xb663('0x27')][_0xb663('0x47')]+'%'};return _0x3b9237;})});}if(_0x4f31b1[_0xb663('0x27')][_0xb663('0x48')]){var _0x591e35=_0x4f31b1[_0xb663('0x27')][_0xb663('0x48')][_0xb663('0x49')](',');var _0x1e2c57={};_0x1e2c57[_0x591e35[0x0]]={'$gte':moment(_0x591e35[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x39031a[_0xb663('0x43')]=_[_0xb663('0x46')](_0x39031a[_0xb663('0x43')],_0x1e2c57);}_0x39031a=_[_0xb663('0x46')]({},_0x39031a,_0x4f31b1['options']);return db['SmsMessage'][_0xb663('0x4a')]({'where':_0x39031a['where']})['then'](function(_0x387ee3){_0x5e8817[_0xb663('0x4a')]=_0x387ee3;if(_0x4f31b1[_0xb663('0x27')]['includeAll']){_0x39031a[_0xb663('0x32')]=[{'all':!![]}];}return db['SmsMessage'][_0xb663('0x4b')](_0x39031a);})[_0xb663('0x1b')](function(_0x4645cd){_0x5e8817[_0xb663('0x4c')]=_0x4645cd;return _0x5e8817;});}})[_0xb663('0x1b')](respondWithFilteredResult(_0x2f0218,_0x39031a))[_0xb663('0x28')](handleError(_0x2f0218,null));};exports[_0xb663('0x4d')]=function(_0x2a61d8,_0x935268){return db[_0xb663('0x21')][_0xb663('0x34')]({'where':{'id':_0x2a61d8[_0xb663('0x29')]['id']}})['then'](handleEntityNotFound(_0x935268,null))[_0xb663('0x1b')](function(_0x1b155d){if(_0x1b155d){return _0x1b155d[_0xb663('0x4e')](_0x2a61d8[_0xb663('0x37')][_0xb663('0x3c')],_[_0xb663('0x3d')](_0x2a61d8['body'],[_0xb663('0x3c'),'id'])||{})[_0xb663('0x4f')](function(){return db[_0xb663('0x50')][_0xb663('0x4b')]({'attributes':['id',_0xb663('0x1e'),_0xb663('0x51')],'where':{'id':_0x2a61d8[_0xb663('0x37')][_0xb663('0x3c')]}});})[_0xb663('0x1b')](function(_0x530a1c){socket[_0xb663('0x52')](_0xb663('0x53'),{'id':Number(_0x2a61d8[_0xb663('0x29')]['id']),'tags':_0x530a1c||[]});return{'id':Number(_0x2a61d8[_0xb663('0x29')]['id']),'tags':_0x530a1c||[]};});}})[_0xb663('0x1b')](respondWithResult(_0x935268,null))['catch'](handleError(_0x935268,null));};exports[_0xb663('0x54')]=function(_0x10c966,_0x18eab5){return db[_0xb663('0x21')]['find']({'where':{'id':_0x10c966[_0xb663('0x29')]['id']}})[_0xb663('0x1b')](handleEntityNotFound(_0x18eab5,null))[_0xb663('0x1b')](function(_0x51e62d){if(_0x51e62d){return _0x51e62d[_0xb663('0x54')](_0x10c966[_0xb663('0x27')][_0xb663('0x3c')]);}})[_0xb663('0x1b')](respondWithStatusCode(_0x18eab5,null))['catch'](handleError(_0x18eab5,null));};exports['download']=function(_0x3c8bf2,_0x5e7e5b){var _0x3c0e1c=moment()['unix']()[_0xb663('0x55')]();var _0x3a722e=path[_0xb663('0x56')](config[_0xb663('0x57')],_0xb663('0x58'),_0xb663('0x59'),_0xb663('0x5a'));var _0x398f81=path[_0xb663('0x56')](_0x3a722e,_0x3c0e1c);var _0x4e8991=util['format'](_0xb663('0x5b'),_0x3c8bf2[_0xb663('0x29')]['id'],_0x3c0e1c);var _0x5a41e5=path[_0xb663('0x56')](_0x3a722e,_0x4e8991);var _0x47964b=[];_0x47964b[_0xb663('0x5c')]({'model':db[_0xb663('0x5d')],'as':_0xb663('0x5d'),'attributes':['id',_0xb663('0x5e')],'raw':!![]});_0x47964b[_0xb663('0x5c')]({'model':db[_0xb663('0x5f')],'as':'Contact','attributes':['id','firstName',_0xb663('0x60')],'raw':!![]});var _0x3165bc=[{'model':db[_0xb663('0x3b')],'as':'Messages','attributes':['id','body',_0xb663('0x61'),_0xb663('0x62'),_0xb663('0x63'),'read'],'include':_0x47964b}];_0x3165bc[_0xb663('0x5c')]({'model':db['SmsAccount'],'as':'Account','attributes':['id',_0xb663('0x1e')]});_0x3165bc[_0xb663('0x5c')]({'model':db[_0xb663('0x5d')],'as':_0xb663('0x64'),'attributes':['id',_0xb663('0x5e')]});return db[_0xb663('0x21')]['find']({'where':{'id':_0x3c8bf2[_0xb663('0x29')]['id']},'include':_0x3165bc})['then'](handleEntityNotFound(_0x5e7e5b,null))[_0xb663('0x1b')](function(_0x1f80fe){if(_0x1f80fe){var _0x9c41dd=_0x1f80fe[_0xb663('0x65')]({'plain':!![]});fs[_0xb663('0x66')](_0x398f81);var _0x4e546a={'channel':_0xb663('0x67'),'account':_0x9c41dd[_0xb663('0x68')][_0xb663('0x1e')],'agent':_0x9c41dd['Owner']?_0x9c41dd[_0xb663('0x64')][_0xb663('0x5e')]:_0xb663('0x69'),'createdAt':moment(_0x9c41dd['createdAt'])['format'](_0xb663('0x6a'))[_0xb663('0x55')](),'closedAt':_0x9c41dd['closed']?moment(_0x9c41dd[_0xb663('0x6b')])['format'](_0xb663('0x6a'))[_0xb663('0x55')]():'','disposition':_0x9c41dd['disposition'],'messages':_(_0x9c41dd['Messages'])[_0xb663('0x47')]({'secret':![]})[_0xb663('0x20')](function(_0x2e647c){return{'date':moment(_0x2e647c['createdAt'])['format'](_0xb663('0x6a'))[_0xb663('0x55')](),'sender':_0x2e647c[_0xb663('0x62')]===_0xb663('0x6c')?_0x2e647c['User']?_0x2e647c['User'][_0xb663('0x5e')]:'System':_0x2e647c[_0xb663('0x6d')]['firstName']+(_0x2e647c['Contact'][_0xb663('0x60')]?'\x20'+_0x2e647c[_0xb663('0x6d')][_0xb663('0x60')]:''),'body':_0x2e647c['body'],'direction':_0x2e647c[_0xb663('0x62')]===_0xb663('0x6c')?'A':'C','secret':_0x2e647c[_0xb663('0x63')],'read':_0x2e647c[_0xb663('0x6e')]};})[_0xb663('0x6f')]()};return ejs[_0xb663('0x70')](path['join'](config[_0xb663('0x57')],_0xb663('0x58'),'views',_0xb663('0x71')),{'interaction':_0x4e546a})['then'](function(_0x228ac8){var _0x76efef=path[_0xb663('0x56')](_0x398f81,'transcript-'+_0x9c41dd['id']+'-'+_0x3c0e1c+'.pdf');var _0x55f6a8={'path':_0x76efef,'channel':_0xb663('0x67'),'interactionId':_0x9c41dd['id']};return pdf[_0xb663('0x72')](_0x228ac8,_0x55f6a8);})[_0xb663('0x1b')](function(){return new BPromise(function(_0x4d43b4,_0x3f7cc0){zipdir(_0x398f81,{'saveTo':_0x5a41e5},function(_0x5a58a4,_0x5f420d){if(_0x5a58a4)return _0x3f7cc0(_0x5a58a4);return _0x4d43b4(_0x5f420d);});})['then'](function(){return new BPromise(function(_0x50f272,_0x2123a9){rimraf(_0x398f81,function(_0x3fdf36){if(_0x3fdf36)_0x2123a9(_0x3fdf36);return _0x50f272();});});})[_0xb663('0x1b')](function(){return _0x5e7e5b[_0xb663('0x73')](_0x5a41e5,_0x4e8991,function(_0x5e0152){if(_0x5e0152){console['log'](_0xb663('0x74'),_0x5e0152);}else{fs['unlinkSync'](_0x5a41e5);}});});});}else{return _0x5e7e5b[_0xb663('0x12')](0xc8);}})[_0xb663('0x28')](handleError(_0x5e7e5b,null));}; \ No newline at end of file +var _0xfd20=['end','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','name','send','index','rawAttributes','type','key','getOptions','findAll','sms','query','user','show','model','keys','SmsInteraction','filters','intersection','fields','length','attributes','include','options','find','catch','create','body','params','describe','addMessage','SmsMessage','omit','getMessages','sort','where','pick','SmsInteractionId','merge','map','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','setTags','ids','spread','Tag','smsInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','transcript-%d-%s.zip','User','fullname','push','CmContact','Contact','firstName','lastName','Messages','createdAt','secret','read','SmsAccount','Account','Owner','get','mkdirSync','N.A.','closed','closedAt','toString','disposition','direction','out','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','Sms','createPdfFromHTML','err','unlinkSync','zip-dir','util','path','lodash','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','sendStatus'];(function(_0x21f956,_0x285933){var _0x5e0259=function(_0x3c91af){while(--_0x3c91af){_0x21f956['push'](_0x21f956['shift']());}};_0x5e0259(++_0x285933);}(_0xfd20,0x66));var _0x0fd2=function(_0xda0001,_0x5d3e28){_0xda0001=_0xda0001-0x0;var _0x3c1c06=_0xfd20[_0xda0001];return _0x3c1c06;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x0fd2('0x0'));var moment=require('moment');var BPromise=require('bluebird');var util=require(_0x0fd2('0x1'));var path=require(_0x0fd2('0x2'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x0fd2('0x3'));var Redis=require('ioredis');var interaction=require(_0x0fd2('0x4'));var qs=require(_0x0fd2('0x5'));var pdf=require(_0x0fd2('0x6'));var logger=require(_0x0fd2('0x7'))(_0x0fd2('0x8'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x0fd2('0x9')]=_[_0x0fd2('0xa')](config[_0x0fd2('0x9')],{'host':_0x0fd2('0xb'),'port':0x18eb});var socket=require(_0x0fd2('0xc'))(new Redis(config[_0x0fd2('0x9')]));require(_0x0fd2('0xd'))['register'](socket);function respondWithStatusCode(_0x39b9a7,_0x343e7a){_0x343e7a=_0x343e7a||0xcc;return function(_0x52b80c){if(_0x52b80c){return _0x39b9a7[_0x0fd2('0xe')](_0x343e7a);}return _0x39b9a7['status'](_0x343e7a)[_0x0fd2('0xf')]();};}function respondWithResult(_0x2222c4,_0x42ea5c){_0x42ea5c=_0x42ea5c||0xc8;return function(_0x32e965){if(_0x32e965){return _0x2222c4[_0x0fd2('0x10')](_0x42ea5c)[_0x0fd2('0x11')](_0x32e965);}};}function respondWithFilteredResult(_0x1f7a6e,_0x7b05c3){return function(_0x51390c){if(_0x51390c){var _0x48c2f1=typeof _0x7b05c3[_0x0fd2('0x12')]===_0x0fd2('0x13')&&typeof _0x7b05c3[_0x0fd2('0x14')]===_0x0fd2('0x13');var _0x52ab36=_0x51390c[_0x0fd2('0x15')];var _0x4f074a=_0x48c2f1?0x0:_0x7b05c3['offset'];var _0x2b6254=_0x48c2f1?_0x51390c['count']:_0x7b05c3[_0x0fd2('0x12')]+_0x7b05c3['limit'];var _0x42c9d5;if(_0x2b6254>=_0x52ab36){_0x2b6254=_0x52ab36;_0x42c9d5=0xc8;}else{_0x42c9d5=0xce;}_0x1f7a6e['status'](_0x42c9d5);return _0x1f7a6e[_0x0fd2('0x16')](_0x0fd2('0x17'),_0x4f074a+'-'+_0x2b6254+'/'+_0x52ab36)['json'](_0x51390c);}return null;};}function saveUpdates(_0x2b25d2){return function(_0x519500){if(_0x519500){return _0x519500[_0x0fd2('0x18')](_0x2b25d2)[_0x0fd2('0x19')](function(_0x3fb07e){return _0x3fb07e;});}return null;};}function removeEntity(_0x11b423){return function(_0x2977ef){if(_0x2977ef){return _0x2977ef[_0x0fd2('0x1a')]()[_0x0fd2('0x19')](function(){_0x11b423[_0x0fd2('0x10')](0xcc)[_0x0fd2('0xf')]();});}};}function handleEntityNotFound(_0x34225f){return function(_0x5c50ad){if(!_0x5c50ad){_0x34225f['sendStatus'](0x194);}return _0x5c50ad;};}function handleError(_0x4b70b7,_0x4156d2){_0x4156d2=_0x4156d2||0x1f4;return function(_0x36072a){logger['error'](_0x36072a['stack']);if(_0x36072a[_0x0fd2('0x1b')]){delete _0x36072a[_0x0fd2('0x1b')];}_0x4b70b7[_0x0fd2('0x10')](_0x4156d2)[_0x0fd2('0x1c')](_0x36072a);};}exports[_0x0fd2('0x1d')]=function(_0x5d15ed,_0x233b01){var _0x42e988={};var _0xd0a2cc=_['map'](db['SmsInteraction'][_0x0fd2('0x1e')],function(_0x2a45e1){return{'name':_0x2a45e1['fieldName'],'type':_0x2a45e1[_0x0fd2('0x1f')][_0x0fd2('0x20')]};});_0x42e988=qs[_0x0fd2('0x21')](_0xd0a2cc,_0x5d15ed);return interaction[_0x0fd2('0x22')](_0x0fd2('0x23'),_0x5d15ed[_0x0fd2('0x24')],_0x5d15ed[_0x0fd2('0x25')],_0x42e988,_0xd0a2cc)[_0x0fd2('0x19')](respondWithFilteredResult(_0x233b01,_0x42e988))['catch'](handleError(_0x233b01,null));};exports[_0x0fd2('0x26')]=function(_0x434018,_0x235c90){var _0x1ca259={'raw':![],'where':{'id':_0x434018['params']['id']}},_0x33cf1a={};_0x33cf1a[_0x0fd2('0x27')]=_[_0x0fd2('0x28')](db[_0x0fd2('0x29')][_0x0fd2('0x1e')]);_0x33cf1a[_0x0fd2('0x24')]=_[_0x0fd2('0x28')](_0x434018[_0x0fd2('0x24')]);_0x33cf1a[_0x0fd2('0x2a')]=_['intersection'](_0x33cf1a[_0x0fd2('0x27')],_0x33cf1a['query']);_0x1ca259['attributes']=_[_0x0fd2('0x2b')](_0x33cf1a['model'],qs[_0x0fd2('0x2c')](_0x434018['query'][_0x0fd2('0x2c')]));_0x1ca259['attributes']=_0x1ca259['attributes'][_0x0fd2('0x2d')]?_0x1ca259[_0x0fd2('0x2e')]:_0x33cf1a[_0x0fd2('0x27')];if(_0x434018['query']['includeAll']){_0x1ca259[_0x0fd2('0x2f')]=[{'all':!![]}];}_0x1ca259=_['merge']({},_0x1ca259,_0x434018[_0x0fd2('0x30')]);return db[_0x0fd2('0x29')][_0x0fd2('0x31')](_0x1ca259)[_0x0fd2('0x19')](handleEntityNotFound(_0x235c90,null))[_0x0fd2('0x19')](respondWithResult(_0x235c90,null))[_0x0fd2('0x32')](handleError(_0x235c90,null));};exports[_0x0fd2('0x33')]=function(_0x508baf,_0x3812fe){return db[_0x0fd2('0x29')]['create'](_0x508baf['body'],{})[_0x0fd2('0x19')](respondWithResult(_0x3812fe,0xc9))['catch'](handleError(_0x3812fe,null));};exports['update']=function(_0x29f34a,_0x7a4249){if(_0x29f34a[_0x0fd2('0x34')]['id']){delete _0x29f34a[_0x0fd2('0x34')]['id'];}return db[_0x0fd2('0x29')][_0x0fd2('0x31')]({'where':{'id':_0x29f34a[_0x0fd2('0x35')]['id']}})[_0x0fd2('0x19')](handleEntityNotFound(_0x7a4249,null))[_0x0fd2('0x19')](saveUpdates(_0x29f34a[_0x0fd2('0x34')],null))[_0x0fd2('0x19')](respondWithResult(_0x7a4249,null))[_0x0fd2('0x32')](handleError(_0x7a4249,null));};exports[_0x0fd2('0x1a')]=function(_0x3a3986,_0x4656e9){return db[_0x0fd2('0x29')]['find']({'where':{'id':_0x3a3986[_0x0fd2('0x35')]['id']}})[_0x0fd2('0x19')](handleEntityNotFound(_0x4656e9,null))[_0x0fd2('0x19')](removeEntity(_0x4656e9,null))[_0x0fd2('0x32')](handleError(_0x4656e9,null));};exports['describe']=function(_0x286543,_0x5c1297){return db[_0x0fd2('0x29')][_0x0fd2('0x36')]()['then'](respondWithResult(_0x5c1297,null))[_0x0fd2('0x32')](handleError(_0x5c1297,null));};exports[_0x0fd2('0x37')]=function(_0xe3f07e,_0x2a151b){return db[_0x0fd2('0x38')][_0x0fd2('0x31')]({'where':{'id':_0xe3f07e['params']['id']}})[_0x0fd2('0x19')](handleEntityNotFound(_0x2a151b,null))[_0x0fd2('0x19')](function(_0xf59fac){if(_0xf59fac){return _0xf59fac[_0x0fd2('0x37')](_0xe3f07e[_0x0fd2('0x34')]['ids'],_[_0x0fd2('0x39')](_0xe3f07e[_0x0fd2('0x34')],['ids','id'])||{});}})[_0x0fd2('0x19')](respondWithResult(_0x2a151b,null))[_0x0fd2('0x32')](handleError(_0x2a151b,null));};exports[_0x0fd2('0x3a')]=function(_0x9a1b36,_0x3b71a3){var _0x22c89d={'raw':![],'where':{}};var _0x2791a5={};var _0x2b397c={'count':0x0,'rows':[]};return db['SmsInteraction']['findOne']({'where':{'id':_0x9a1b36[_0x0fd2('0x35')]['id']}})[_0x0fd2('0x19')](handleEntityNotFound(_0x3b71a3,null))['then'](function(_0x1da384){if(_0x1da384){_0x2791a5['model']=_[_0x0fd2('0x28')](db[_0x0fd2('0x38')][_0x0fd2('0x1e')]);_0x2791a5[_0x0fd2('0x24')]=_[_0x0fd2('0x28')](_0x9a1b36[_0x0fd2('0x24')]);_0x2791a5['filters']=_['intersection'](_0x2791a5[_0x0fd2('0x27')],_0x2791a5['query']);_0x22c89d[_0x0fd2('0x2e')]=_[_0x0fd2('0x2b')](_0x2791a5[_0x0fd2('0x27')],qs[_0x0fd2('0x2c')](_0x9a1b36[_0x0fd2('0x24')]['fields']));_0x22c89d[_0x0fd2('0x2e')]=_0x22c89d['attributes'][_0x0fd2('0x2d')]?_0x22c89d[_0x0fd2('0x2e')]:_0x2791a5['model'];if(!_0x9a1b36[_0x0fd2('0x24')]['hasOwnProperty']('nolimit')){_0x22c89d[_0x0fd2('0x14')]=qs[_0x0fd2('0x14')](_0x9a1b36[_0x0fd2('0x24')]['limit']);_0x22c89d[_0x0fd2('0x12')]=qs[_0x0fd2('0x12')](_0x9a1b36[_0x0fd2('0x24')][_0x0fd2('0x12')]);}_0x22c89d['order']=qs[_0x0fd2('0x3b')](_0x9a1b36[_0x0fd2('0x24')][_0x0fd2('0x3b')]);_0x22c89d[_0x0fd2('0x3c')]=qs[_0x0fd2('0x2a')](_[_0x0fd2('0x3d')](_0x9a1b36[_0x0fd2('0x24')],_0x2791a5[_0x0fd2('0x2a')]));_0x22c89d[_0x0fd2('0x3c')][_0x0fd2('0x3e')]=_0x1da384['id'];if(_0x9a1b36[_0x0fd2('0x24')]['filter']){_0x22c89d[_0x0fd2('0x3c')]=_[_0x0fd2('0x3f')](_0x22c89d['where'],{'$or':_[_0x0fd2('0x40')](_0x22c89d['attributes'],function(_0x19650c){var _0x5193b7={};_0x5193b7[_0x19650c]={'$like':'%'+_0x9a1b36[_0x0fd2('0x24')][_0x0fd2('0x41')]+'%'};return _0x5193b7;})});}if(_0x9a1b36[_0x0fd2('0x24')]['$gte']){var _0x23a966=_0x9a1b36[_0x0fd2('0x24')][_0x0fd2('0x42')]['split'](',');var _0x488478={};_0x488478[_0x23a966[0x0]]={'$gte':moment(_0x23a966[0x1])[_0x0fd2('0x43')](_0x0fd2('0x44'))};_0x22c89d[_0x0fd2('0x3c')]=_[_0x0fd2('0x3f')](_0x22c89d[_0x0fd2('0x3c')],_0x488478);}_0x22c89d=_[_0x0fd2('0x3f')]({},_0x22c89d,_0x9a1b36['options']);return db[_0x0fd2('0x38')][_0x0fd2('0x15')]({'where':_0x22c89d[_0x0fd2('0x3c')]})[_0x0fd2('0x19')](function(_0x379524){_0x2b397c[_0x0fd2('0x15')]=_0x379524;if(_0x9a1b36[_0x0fd2('0x24')][_0x0fd2('0x45')]){_0x22c89d[_0x0fd2('0x2f')]=[{'all':!![]}];}return db[_0x0fd2('0x38')][_0x0fd2('0x22')](_0x22c89d);})[_0x0fd2('0x19')](function(_0xdac23c){_0x2b397c['rows']=_0xdac23c;return _0x2b397c;});}})[_0x0fd2('0x19')](respondWithFilteredResult(_0x3b71a3,_0x22c89d))[_0x0fd2('0x32')](handleError(_0x3b71a3,null));};exports['addTags']=function(_0x230d69,_0x43ac2f){return db[_0x0fd2('0x29')][_0x0fd2('0x31')]({'where':{'id':_0x230d69['params']['id']}})['then'](handleEntityNotFound(_0x43ac2f,null))['then'](function(_0x136b5c){if(_0x136b5c){return _0x136b5c[_0x0fd2('0x46')](_0x230d69[_0x0fd2('0x34')][_0x0fd2('0x47')],_[_0x0fd2('0x39')](_0x230d69[_0x0fd2('0x34')],[_0x0fd2('0x47'),'id'])||{})[_0x0fd2('0x48')](function(){return db[_0x0fd2('0x49')][_0x0fd2('0x22')]({'attributes':['id','name','color'],'where':{'id':_0x230d69['body']['ids']}});})['then'](function(_0x473380){socket['emit'](_0x0fd2('0x4a'),{'id':Number(_0x230d69['params']['id']),'tags':_0x473380||[]});return{'id':Number(_0x230d69[_0x0fd2('0x35')]['id']),'tags':_0x473380||[]};});}})['then'](respondWithResult(_0x43ac2f,null))[_0x0fd2('0x32')](handleError(_0x43ac2f,null));};exports[_0x0fd2('0x4b')]=function(_0x4556d8,_0x521a40){return db['SmsInteraction'][_0x0fd2('0x31')]({'where':{'id':_0x4556d8[_0x0fd2('0x35')]['id']}})[_0x0fd2('0x19')](handleEntityNotFound(_0x521a40,null))[_0x0fd2('0x19')](function(_0x87b84a){if(_0x87b84a){return _0x87b84a[_0x0fd2('0x4b')](_0x4556d8[_0x0fd2('0x24')][_0x0fd2('0x47')]);}})[_0x0fd2('0x19')](respondWithStatusCode(_0x521a40,null))['catch'](handleError(_0x521a40,null));};exports[_0x0fd2('0x4c')]=function(_0xa0619c,_0x293a32){var _0x5120ea=moment()[_0x0fd2('0x4d')]()['toString']();var _0x3659b6=path[_0x0fd2('0x4e')](config[_0x0fd2('0x4f')],_0x0fd2('0x50'),_0x0fd2('0x51'),_0x0fd2('0x52'));var _0xf82727=path[_0x0fd2('0x4e')](_0x3659b6,_0x5120ea);var _0x53bb88=util[_0x0fd2('0x43')](_0x0fd2('0x53'),_0xa0619c['params']['id'],_0x5120ea);var _0x401635=path[_0x0fd2('0x4e')](_0x3659b6,_0x53bb88);var _0x46f365=[];_0x46f365['push']({'model':db[_0x0fd2('0x54')],'as':_0x0fd2('0x54'),'attributes':['id',_0x0fd2('0x55')],'raw':!![]});_0x46f365[_0x0fd2('0x56')]({'model':db[_0x0fd2('0x57')],'as':_0x0fd2('0x58'),'attributes':['id',_0x0fd2('0x59'),_0x0fd2('0x5a')],'raw':!![]});var _0xd4cc53=[{'model':db['SmsMessage'],'as':_0x0fd2('0x5b'),'attributes':['id',_0x0fd2('0x34'),_0x0fd2('0x5c'),'direction',_0x0fd2('0x5d'),_0x0fd2('0x5e')],'include':_0x46f365}];_0xd4cc53[_0x0fd2('0x56')]({'model':db[_0x0fd2('0x5f')],'as':_0x0fd2('0x60'),'attributes':['id','name']});_0xd4cc53['push']({'model':db[_0x0fd2('0x54')],'as':_0x0fd2('0x61'),'attributes':['id',_0x0fd2('0x55')]});return db[_0x0fd2('0x29')][_0x0fd2('0x31')]({'where':{'id':_0xa0619c[_0x0fd2('0x35')]['id']},'include':_0xd4cc53})[_0x0fd2('0x19')](handleEntityNotFound(_0x293a32,null))[_0x0fd2('0x19')](function(_0x54aadc){if(_0x54aadc){var _0x14f6fb=_0x54aadc[_0x0fd2('0x62')]({'plain':!![]});fs[_0x0fd2('0x63')](_0xf82727);var _0x901c45={'channel':'Sms','account':_0x14f6fb[_0x0fd2('0x60')][_0x0fd2('0x1b')],'agent':_0x14f6fb[_0x0fd2('0x61')]?_0x14f6fb[_0x0fd2('0x61')][_0x0fd2('0x55')]:_0x0fd2('0x64'),'createdAt':moment(_0x14f6fb[_0x0fd2('0x5c')])[_0x0fd2('0x43')](_0x0fd2('0x44'))['toString'](),'closedAt':_0x14f6fb[_0x0fd2('0x65')]?moment(_0x14f6fb[_0x0fd2('0x66')])[_0x0fd2('0x43')](_0x0fd2('0x44'))[_0x0fd2('0x67')]():'','disposition':_0x14f6fb[_0x0fd2('0x68')],'messages':_(_0x14f6fb[_0x0fd2('0x5b')])[_0x0fd2('0x41')]({'secret':![]})['map'](function(_0x6660e4){return{'date':moment(_0x6660e4[_0x0fd2('0x5c')])[_0x0fd2('0x43')](_0x0fd2('0x44'))[_0x0fd2('0x67')](),'sender':_0x6660e4['direction']==='out'?_0x6660e4[_0x0fd2('0x54')]?_0x6660e4[_0x0fd2('0x54')][_0x0fd2('0x55')]:'System':_0x6660e4[_0x0fd2('0x58')][_0x0fd2('0x59')]+(_0x6660e4[_0x0fd2('0x58')][_0x0fd2('0x5a')]?'\x20'+_0x6660e4[_0x0fd2('0x58')][_0x0fd2('0x5a')]:''),'body':_0x6660e4[_0x0fd2('0x34')],'direction':_0x6660e4[_0x0fd2('0x69')]===_0x0fd2('0x6a')?'A':'C','secret':_0x6660e4[_0x0fd2('0x5d')],'read':_0x6660e4[_0x0fd2('0x5e')]};})[_0x0fd2('0x6b')]()};return ejs[_0x0fd2('0x6c')](path[_0x0fd2('0x4e')](config['root'],_0x0fd2('0x50'),_0x0fd2('0x6d'),_0x0fd2('0x6e')),{'interaction':_0x901c45})['then'](function(_0x45cec7){var _0x19c3af=path[_0x0fd2('0x4e')](_0xf82727,_0x0fd2('0x6f')+_0x14f6fb['id']+'-'+_0x5120ea+_0x0fd2('0x70'));var _0x137dde={'path':_0x19c3af,'channel':_0x0fd2('0x71'),'interactionId':_0x14f6fb['id']};return pdf[_0x0fd2('0x72')](_0x45cec7,_0x137dde);})[_0x0fd2('0x19')](function(){return new BPromise(function(_0x523bf5,_0x4f3f87){zipdir(_0xf82727,{'saveTo':_0x401635},function(_0x5c855a,_0x126232){if(_0x5c855a)return _0x4f3f87(_0x5c855a);return _0x523bf5(_0x126232);});})[_0x0fd2('0x19')](function(){return new BPromise(function(_0x1172cf,_0x130dbd){rimraf(_0xf82727,function(_0x104594){if(_0x104594)_0x130dbd(_0x104594);return _0x1172cf();});});})[_0x0fd2('0x19')](function(){return _0x293a32['download'](_0x401635,_0x53bb88,function(_0x2ce6d5){if(_0x2ce6d5){console['log'](_0x0fd2('0x73'),_0x2ce6d5);}else{fs[_0x0fd2('0x74')](_0x401635);}});});});}else{return _0x293a32['sendStatus'](0xc8);}})[_0x0fd2('0x32')](handleError(_0x293a32,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 65bd33d..07d2d99 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 _0x4e2e=['unreadMessages','emit','catch','hasOwnProperty','hook','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save','remove','getUsers','then','setDataValue','Users','map','findAll'];(function(_0x58b09a,_0x382f60){var _0xae01f7=function(_0x3ffd08){while(--_0x3ffd08){_0x58b09a['push'](_0x58b09a['shift']());}};_0xae01f7(++_0x382f60);}(_0x4e2e,0x1f2));var _0xe4e2=function(_0x222a34,_0x2987cf){_0x222a34=_0x222a34-0x0;var _0x43c89d=_0x4e2e[_0x222a34];return _0x43c89d;};'use strict';var EventEmitter=require('events');var SmsInteraction=require(_0xe4e2('0x0'))['db'][_0xe4e2('0x1')];var SmsMessage=require(_0xe4e2('0x0'))['db'][_0xe4e2('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xe4e2('0x3')](0x0);var events={'afterCreate':_0xe4e2('0x4'),'afterUpdate':'update','afterDestroy':_0xe4e2('0x5')};function emitEvent(_0x417dd4){return function(_0x2fb128,_0x38c84c,_0x48e83d){_0x2fb128[_0xe4e2('0x6')]({'attributes':['id'],'raw':!![]})[_0xe4e2('0x7')](function(_0x1c4e64){_0x2fb128[_0xe4e2('0x8')](_0xe4e2('0x9'),_0x1c4e64[_0xe4e2('0xa')](function(_0x1e9508){return{'id':_0x1e9508['id']};}));return SmsMessage[_0xe4e2('0xb')]({'where':{'SmsInteractionId':_0x2fb128['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0xd81011){_0x2fb128[_0xe4e2('0x8')](_0xe4e2('0xc'),_0xd81011['length']);SmsInteractionEvents[_0xe4e2('0xd')](_0x417dd4+':'+_0x2fb128['id'],_0x2fb128);SmsInteractionEvents[_0xe4e2('0xd')](_0x417dd4,_0x2fb128);_0x48e83d(null);})[_0xe4e2('0xe')](_0x48e83d(null));};}for(var e in events){if(events[_0xe4e2('0xf')](e)){var event=events[e];SmsInteraction[_0xe4e2('0x10')](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file +var _0x8952=['Users','map','findAll','unreadMessages','catch','hasOwnProperty','hook','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','update','remove','getUsers','setDataValue'];(function(_0x88d972,_0x2f3649){var _0x2a8c98=function(_0x19cb12){while(--_0x19cb12){_0x88d972['push'](_0x88d972['shift']());}};_0x2a8c98(++_0x2f3649);}(_0x8952,0x17e));var _0x2895=function(_0x362f2e,_0x2866b6){_0x362f2e=_0x362f2e-0x0;var _0x50d9ee=_0x8952[_0x362f2e];return _0x50d9ee;};'use strict';var EventEmitter=require('events');var SmsInteraction=require(_0x2895('0x0'))['db'][_0x2895('0x1')];var SmsMessage=require(_0x2895('0x0'))['db'][_0x2895('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x2895('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2895('0x4'),'afterDestroy':_0x2895('0x5')};function emitEvent(_0x1f69f6){return function(_0x5b28c6,_0x32429c,_0x73c245){_0x5b28c6[_0x2895('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x526c32){_0x5b28c6[_0x2895('0x7')](_0x2895('0x8'),_0x526c32[_0x2895('0x9')](function(_0x294446){return{'id':_0x294446['id']};}));return SmsMessage[_0x2895('0xa')]({'where':{'SmsInteractionId':_0x5b28c6['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x14fb67){_0x5b28c6['setDataValue'](_0x2895('0xb'),_0x14fb67['length']);SmsInteractionEvents['emit'](_0x1f69f6+':'+_0x5b28c6['id'],_0x5b28c6);SmsInteractionEvents['emit'](_0x1f69f6,_0x5b28c6);_0x73c245(null);})[_0x2895('0xc')](_0x73c245(null));};}for(var e in events){if(events[_0x2895('0xd')](e)){var event=events[e];SmsInteraction[_0x2895('0xe')](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 dcead61..170ce72 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 _0x4a21=['moment','bluebird','request-promise','path','../../config/environment','./smsInteraction.attributes','exports','define','sms_interactions','closed','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api'];(function(_0x1a314b,_0x39fdad){var _0x2452ad=function(_0x13783a){while(--_0x13783a){_0x1a314b['push'](_0x1a314b['shift']());}};_0x2452ad(++_0x39fdad);}(_0x4a21,0x155));var _0x14a2=function(_0x4dae00,_0x15b194){_0x4dae00=_0x4dae00-0x0;var _0x16bf42=_0x4a21[_0x4dae00];return _0x16bf42;};'use strict';var _=require(_0x14a2('0x0'));var util=require(_0x14a2('0x1'));var logger=require(_0x14a2('0x2'))(_0x14a2('0x3'));var moment=require(_0x14a2('0x4'));var BPromise=require(_0x14a2('0x5'));var rp=require(_0x14a2('0x6'));var fs=require('fs');var path=require(_0x14a2('0x7'));var rimraf=require('rimraf');var config=require(_0x14a2('0x8'));var attributes=require(_0x14a2('0x9'));module[_0x14a2('0xa')]=function(_0x1c5923,_0x174d4f){return _0x1c5923[_0x14a2('0xb')]('SmsInteraction',attributes,{'tableName':_0x14a2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2ac2cc,_0x111d6f,_0x3d2da1){if(_0x2ac2cc['changed'](_0x14a2('0xd'))){_0x2ac2cc['closedAt']=moment()['format'](_0x14a2('0xe'));}_0x3d2da1(null,_0x2ac2cc);}}});}; \ No newline at end of file +var _0xfd79=['../../config/environment','exports','define','SmsInteraction','sms_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','request-promise','path','rimraf'];(function(_0x5e8282,_0x1f2962){var _0x5cd37d=function(_0x208ec7){while(--_0x208ec7){_0x5e8282['push'](_0x5e8282['shift']());}};_0x5cd37d(++_0x1f2962);}(_0xfd79,0x135));var _0x9fd7=function(_0x2795d9,_0x550325){_0x2795d9=_0x2795d9-0x0;var _0x3388ee=_0xfd79[_0x2795d9];return _0x3388ee;};'use strict';var _=require(_0x9fd7('0x0'));var util=require(_0x9fd7('0x1'));var logger=require(_0x9fd7('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9fd7('0x3'));var fs=require('fs');var path=require(_0x9fd7('0x4'));var rimraf=require(_0x9fd7('0x5'));var config=require(_0x9fd7('0x6'));var attributes=require('./smsInteraction.attributes');module[_0x9fd7('0x7')]=function(_0x46f25c,_0x5cd7af){return _0x46f25c[_0x9fd7('0x8')](_0x9fd7('0x9'),attributes,{'tableName':_0x9fd7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x280adf,_0x57da3b,_0x3c7be7){if(_0x280adf[_0x9fd7('0xb')](_0x9fd7('0xc'))){_0x280adf[_0x9fd7('0xd')]=moment()['format'](_0x9fd7('0xe'));}_0x3c7be7(null,_0x280adf);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index e0f62f3..2836621 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 _0xc86e=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./smsInteraction.socket','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateSmsInteraction','SmsInteraction','body','options','raw','attributes','limit','find','where','addTags','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0xc86e,0x1b3));var _0xec86=function(_0x1afbdf,_0x265e40){_0x1afbdf=_0x1afbdf-0x0;var _0x238958=_0xc86e[_0x1afbdf];return _0x238958;};'use strict';var _=require(_0xec86('0x0'));var util=require(_0xec86('0x1'));var moment=require(_0xec86('0x2'));var BPromise=require(_0xec86('0x3'));var rs=require(_0xec86('0x4'));var fs=require('fs');var Redis=require(_0xec86('0x5'));var db=require(_0xec86('0x6'))['db'];var utils=require(_0xec86('0x7'));var logger=require(_0xec86('0x8'))(_0xec86('0x9'));var config=require(_0xec86('0xa'));var jayson=require(_0xec86('0xb'));var client=jayson[_0xec86('0xc')][_0xec86('0xd')]({'port':0x232a});config[_0xec86('0xe')]=_[_0xec86('0xf')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xec86('0x10'))(new Redis(config[_0xec86('0xe')]));require(_0xec86('0x11'))['register'](socket);function respondWithRpcPromise(_0x1a50ec,_0x3ba579,_0x9b79e9){return new BPromise(function(_0x583e6d,_0x51c5d4){return client[_0xec86('0x12')](_0x1a50ec,_0x9b79e9)[_0xec86('0x13')](function(_0x3adb54){logger[_0xec86('0x14')](_0xec86('0x15'),_0x3ba579,_0xec86('0x16'));logger[_0xec86('0x17')](_0xec86('0x18'),_0x3ba579,_0xec86('0x16'),JSON[_0xec86('0x19')](_0x3adb54));if(_0x3adb54[_0xec86('0x1a')]){if(_0x3adb54[_0xec86('0x1a')][_0xec86('0x1b')]===0x1f4){logger[_0xec86('0x1a')](_0xec86('0x15'),_0x3ba579,_0x3adb54[_0xec86('0x1a')][_0xec86('0x1c')]);return _0x51c5d4(_0x3adb54[_0xec86('0x1a')][_0xec86('0x1c')]);}logger[_0xec86('0x1a')](_0xec86('0x15'),_0x3ba579,_0x3adb54[_0xec86('0x1a')]['message']);return _0x583e6d(_0x3adb54[_0xec86('0x1a')][_0xec86('0x1c')]);}else{logger['info'](_0xec86('0x15'),_0x3ba579,_0xec86('0x16'));_0x583e6d(_0x3adb54[_0xec86('0x1d')][_0xec86('0x1c')]);}})[_0xec86('0x1e')](function(_0x178c15){logger[_0xec86('0x1a')]('SmsInteraction,\x20%s,\x20%s',_0x3ba579,_0x178c15);_0x51c5d4(_0x178c15);});});}exports[_0xec86('0x1f')]=function(_0x1fd51){var _0x5e06b3=this;return new Promise(function(_0x4dbd6c,_0x48ed91){return db[_0xec86('0x20')]['update'](_0x1fd51[_0xec86('0x21')],{'raw':_0x1fd51[_0xec86('0x22')]?_0x1fd51[_0xec86('0x22')][_0xec86('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1fd51['options']?_0x1fd51[_0xec86('0x22')]['where']||null:null,'attributes':_0x1fd51[_0xec86('0x22')]?_0x1fd51[_0xec86('0x22')][_0xec86('0x24')]||null:null,'limit':_0x1fd51[_0xec86('0x22')]?_0x1fd51[_0xec86('0x22')][_0xec86('0x25')]||null:null})[_0xec86('0x13')](function(_0x2a8db8){logger[_0xec86('0x14')](_0xec86('0x1f'),_0x1fd51);logger[_0xec86('0x17')](_0xec86('0x1f'),_0x1fd51,JSON['stringify'](_0x2a8db8));_0x4dbd6c(_0x2a8db8);})[_0xec86('0x1e')](function(_0x510f16){logger['error']('UpdateSmsInteraction',_0x510f16[_0xec86('0x1c')],_0x1fd51);_0x48ed91(_0x5e06b3[_0xec86('0x1a')](0x1f4,_0x510f16[_0xec86('0x1c')]));});});};exports['AddTagsToSmsInteraction']=function(_0x1d8aa7){return new Promise(function(_0x1eed43,_0x143eba){return db['SmsInteraction'][_0xec86('0x26')]({'where':_0x1d8aa7[_0xec86('0x22')]?_0x1d8aa7['options'][_0xec86('0x27')]||null:null})[_0xec86('0x13')](function(_0xf6979e){if(_0xf6979e){return _0xf6979e[_0xec86('0x28')](_0x1d8aa7[_0xec86('0x21')]['ids'],_['omit'](_0x1d8aa7['body'],[_0xec86('0x29'),'id'])||{});}})[_0xec86('0x2a')](function(_0x5c1eaf){logger['info'](_0xec86('0x2b'),_0x1d8aa7);logger[_0xec86('0x17')](_0xec86('0x2b'),_0x1d8aa7,JSON[_0xec86('0x19')](_0x5c1eaf));_0x1eed43(_0x5c1eaf);})[_0xec86('0x1e')](function(_0x27e82b){logger[_0xec86('0x1a')]('AddTags',_0x27e82b[_0xec86('0x1c')],_0x1d8aa7);_0x143eba(_this[_0xec86('0x1a')](0x1f4,_0x27e82b[_0xec86('0x1c')]));});});}; \ No newline at end of file +var _0x9ab1=['request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsInteraction,\x20%s,\x20%s','message','result','SmsInteraction','update','body','options','raw','where','attributes','then','UpdateSmsInteraction','AddTagsToSmsInteraction','ids','omit','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','socket.io-emitter','./smsInteraction.socket','register','info'];(function(_0x4a92a4,_0xb1c3b3){var _0x4b043f=function(_0x35f316){while(--_0x35f316){_0x4a92a4['push'](_0x4a92a4['shift']());}};_0x4b043f(++_0xb1c3b3);}(_0x9ab1,0xdf));var _0x19ab=function(_0x41681a,_0x397ea3){_0x41681a=_0x41681a-0x0;var _0xca3ee8=_0x9ab1[_0x41681a];return _0xca3ee8;};'use strict';var _=require(_0x19ab('0x0'));var util=require('util');var moment=require(_0x19ab('0x1'));var BPromise=require(_0x19ab('0x2'));var rs=require(_0x19ab('0x3'));var fs=require('fs');var Redis=require(_0x19ab('0x4'));var db=require(_0x19ab('0x5'))['db'];var utils=require(_0x19ab('0x6'));var logger=require(_0x19ab('0x7'))(_0x19ab('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x19ab('0x9')][_0x19ab('0xa')]({'port':0x232a});config[_0x19ab('0xb')]=_[_0x19ab('0xc')](config[_0x19ab('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x19ab('0xd'))(new Redis(config[_0x19ab('0xb')]));require(_0x19ab('0xe'))[_0x19ab('0xf')](socket);function respondWithRpcPromise(_0xaf3e86,_0x239e85,_0x4ccea6){return new BPromise(function(_0x493a14,_0x238aa8){return client['request'](_0xaf3e86,_0x4ccea6)['then'](function(_0x3343ba){logger[_0x19ab('0x10')]('SmsInteraction,\x20%s,\x20%s',_0x239e85,_0x19ab('0x11'));logger[_0x19ab('0x12')](_0x19ab('0x13'),_0x239e85,_0x19ab('0x11'),JSON[_0x19ab('0x14')](_0x3343ba));if(_0x3343ba[_0x19ab('0x15')]){if(_0x3343ba[_0x19ab('0x15')][_0x19ab('0x16')]===0x1f4){logger[_0x19ab('0x15')](_0x19ab('0x17'),_0x239e85,_0x3343ba[_0x19ab('0x15')][_0x19ab('0x18')]);return _0x238aa8(_0x3343ba[_0x19ab('0x15')][_0x19ab('0x18')]);}logger['error'](_0x19ab('0x17'),_0x239e85,_0x3343ba[_0x19ab('0x15')][_0x19ab('0x18')]);return _0x493a14(_0x3343ba[_0x19ab('0x15')][_0x19ab('0x18')]);}else{logger['info'](_0x19ab('0x17'),_0x239e85,_0x19ab('0x11'));_0x493a14(_0x3343ba[_0x19ab('0x19')][_0x19ab('0x18')]);}})['catch'](function(_0x418afe){logger[_0x19ab('0x15')]('SmsInteraction,\x20%s,\x20%s',_0x239e85,_0x418afe);_0x238aa8(_0x418afe);});});}exports['UpdateSmsInteraction']=function(_0xe4548){var _0x369b90=this;return new Promise(function(_0x3dc5b3,_0x26e099){return db[_0x19ab('0x1a')][_0x19ab('0x1b')](_0xe4548[_0x19ab('0x1c')],{'raw':_0xe4548[_0x19ab('0x1d')]?_0xe4548['options'][_0x19ab('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xe4548['options']?_0xe4548[_0x19ab('0x1d')][_0x19ab('0x1f')]||null:null,'attributes':_0xe4548['options']?_0xe4548[_0x19ab('0x1d')][_0x19ab('0x20')]||null:null,'limit':_0xe4548[_0x19ab('0x1d')]?_0xe4548[_0x19ab('0x1d')]['limit']||null:null})[_0x19ab('0x21')](function(_0x29e977){logger['info'](_0x19ab('0x22'),_0xe4548);logger['debug'](_0x19ab('0x22'),_0xe4548,JSON[_0x19ab('0x14')](_0x29e977));_0x3dc5b3(_0x29e977);})['catch'](function(_0x31226f){logger[_0x19ab('0x15')](_0x19ab('0x22'),_0x31226f['message'],_0xe4548);_0x26e099(_0x369b90['error'](0x1f4,_0x31226f[_0x19ab('0x18')]));});});};exports[_0x19ab('0x23')]=function(_0x12487e){return new Promise(function(_0x3d9a38,_0x523dc3){return db[_0x19ab('0x1a')]['find']({'where':_0x12487e[_0x19ab('0x1d')]?_0x12487e[_0x19ab('0x1d')][_0x19ab('0x1f')]||null:null})['then'](function(_0x5aa23f){if(_0x5aa23f){return _0x5aa23f['addTags'](_0x12487e['body'][_0x19ab('0x24')],_[_0x19ab('0x25')](_0x12487e[_0x19ab('0x1c')],[_0x19ab('0x24'),'id'])||{});}})[_0x19ab('0x26')](function(_0x42f41b){logger['info'](_0x19ab('0x27'),_0x12487e);logger[_0x19ab('0x12')](_0x19ab('0x27'),_0x12487e,JSON[_0x19ab('0x14')](_0x42f41b));_0x3d9a38(_0x42f41b);})['catch'](function(_0xecaee6){logger[_0x19ab('0x15')]('AddTags',_0xecaee6[_0x19ab('0x18')],_0x12487e);_0x523dc3(_this['error'](0x1f4,_0xecaee6['message']));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index d3e6514..b1d61de 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 _0x0f35=['remove','update','emit','register','length','smsInteraction:','./smsInteraction.events'];(function(_0x5134b8,_0x37e616){var _0xc07056=function(_0x85631f){while(--_0x85631f){_0x5134b8['push'](_0x5134b8['shift']());}};_0xc07056(++_0x37e616);}(_0x0f35,0x76));var _0x50f3=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x0f35[_0x2641f9];return _0x585741;};'use strict';var SmsInteractionEvents=require(_0x50f3('0x0'));var events=['save',_0x50f3('0x1'),_0x50f3('0x2')];function createListener(_0x576b7f,_0xef396a){return function(_0x4c7610){_0xef396a[_0x50f3('0x3')](_0x576b7f,_0x4c7610);};}function removeListener(_0x5def30,_0x3642c1){return function(){SmsInteractionEvents['removeListener'](_0x5def30,_0x3642c1);};}exports[_0x50f3('0x4')]=function(_0x2b42b0){for(var _0x4cb3f1=0x0,_0x23c71b=events[_0x50f3('0x5')];_0x4cb3f1<_0x23c71b;_0x4cb3f1++){var _0x36c064=events[_0x4cb3f1];var _0x373353=createListener(_0x50f3('0x6')+_0x36c064,_0x2b42b0);SmsInteractionEvents['on'](_0x36c064,_0x373353);}}; \ No newline at end of file +var _0xbf46=['emit','removeListener','length','smsInteraction:','./smsInteraction.events','save','remove','update'];(function(_0x1ba697,_0x186781){var _0x433b23=function(_0xe5df67){while(--_0xe5df67){_0x1ba697['push'](_0x1ba697['shift']());}};_0x433b23(++_0x186781);}(_0xbf46,0x114));var _0x6bf4=function(_0x23645f,_0x18c737){_0x23645f=_0x23645f-0x0;var _0x4c65d2=_0xbf46[_0x23645f];return _0x4c65d2;};'use strict';var SmsInteractionEvents=require(_0x6bf4('0x0'));var events=[_0x6bf4('0x1'),_0x6bf4('0x2'),_0x6bf4('0x3')];function createListener(_0x5a3381,_0x1fad76){return function(_0x7bfe6e){_0x1fad76[_0x6bf4('0x4')](_0x5a3381,_0x7bfe6e);};}function removeListener(_0x9f9d63,_0x12d9b5){return function(){SmsInteractionEvents[_0x6bf4('0x5')](_0x9f9d63,_0x12d9b5);};}exports['register']=function(_0x19c200){for(var _0x260e59=0x0,_0x245671=events[_0x6bf4('0x6')];_0x260e59<_0x245671;_0x260e59++){var _0x4ab130=events[_0x260e59];var _0xb219e=createListener(_0x6bf4('0x7')+_0x4ab130,_0x19c200);SmsInteractionEvents['on'](_0x4ab130,_0xb219e);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index fd05c7d..376c739 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 _0xe13a=['multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./smsMessage.controller','get','/describe','isAuthenticated','show','tracked','smsmessage:create','create','post','/:id/status','status','/:id','update','put','/:id/accept','accept','/:id/reject','delete','destroy'];(function(_0x122a7e,_0xd2b5ae){var _0x29660d=function(_0xc5d32e){while(--_0xc5d32e){_0x122a7e['push'](_0x122a7e['shift']());}};_0x29660d(++_0xd2b5ae);}(_0xe13a,0x15f));var _0xae13=function(_0x6c5b57,_0x46ce4d){_0x6c5b57=_0x6c5b57-0x0;var _0x41a7e2=_0xe13a[_0x6c5b57];return _0x41a7e2;};'use strict';var multer=require(_0xae13('0x0'));var util=require('util');var path=require(_0xae13('0x1'));var timeout=require(_0xae13('0x2'));var express=require(_0xae13('0x3'));var router=express[_0xae13('0x4')]();var fs_extra=require(_0xae13('0x5'));var auth=require(_0xae13('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xae13('0x7'));var controller=require(_0xae13('0x8'));router[_0xae13('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xae13('0x9')](_0xae13('0xa'),auth[_0xae13('0xb')](),controller['describe']);router[_0xae13('0x9')]('/:id',auth[_0xae13('0xb')](),controller[_0xae13('0xc')]);router['post']('/',auth[_0xae13('0xb')](),interaction[_0xae13('0xd')]('sms',_0xae13('0xe')),controller[_0xae13('0xf')]);router[_0xae13('0x10')](_0xae13('0x11'),controller[_0xae13('0x12')]);router['put'](_0xae13('0x13'),auth[_0xae13('0xb')](),controller[_0xae13('0x14')]);router[_0xae13('0x15')](_0xae13('0x16'),auth[_0xae13('0xb')](),controller[_0xae13('0x17')]);router['put'](_0xae13('0x18'),auth[_0xae13('0xb')](),controller['reject']);router[_0xae13('0x19')](_0xae13('0x13'),auth[_0xae13('0xb')](),controller[_0xae13('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x9fcd=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','index','isAuthenticated','describe','show','post','tracked','smsmessage:create','create','/:id/status','put','/:id','update','/:id/accept','accept','destroy','exports','multer','util','path','express'];(function(_0x232f2b,_0x393a37){var _0x124ad9=function(_0x5cccb1){while(--_0x5cccb1){_0x232f2b['push'](_0x232f2b['shift']());}};_0x124ad9(++_0x393a37);}(_0x9fcd,0x15b));var _0xd9fc=function(_0xe4603c,_0x5a4024){_0xe4603c=_0xe4603c-0x0;var _0x3c3cdc=_0x9fcd[_0xe4603c];return _0x3c3cdc;};'use strict';var multer=require(_0xd9fc('0x0'));var util=require(_0xd9fc('0x1'));var path=require(_0xd9fc('0x2'));var timeout=require('connect-timeout');var express=require(_0xd9fc('0x3'));var router=express[_0xd9fc('0x4')]();var fs_extra=require(_0xd9fc('0x5'));var auth=require(_0xd9fc('0x6'));var interaction=require(_0xd9fc('0x7'));var config=require(_0xd9fc('0x8'));var controller=require(_0xd9fc('0x9'));router[_0xd9fc('0xa')]('/',auth['isAuthenticated'](),controller[_0xd9fc('0xb')]);router[_0xd9fc('0xa')]('/describe',auth[_0xd9fc('0xc')](),controller[_0xd9fc('0xd')]);router[_0xd9fc('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xd9fc('0xe')]);router[_0xd9fc('0xf')]('/',auth[_0xd9fc('0xc')](),interaction[_0xd9fc('0x10')]('sms',_0xd9fc('0x11')),controller[_0xd9fc('0x12')]);router[_0xd9fc('0xf')](_0xd9fc('0x13'),controller['status']);router[_0xd9fc('0x14')](_0xd9fc('0x15'),auth['isAuthenticated'](),controller[_0xd9fc('0x16')]);router['put'](_0xd9fc('0x17'),auth[_0xd9fc('0xc')](),controller[_0xd9fc('0x18')]);router[_0xd9fc('0x14')]('/:id/reject',auth[_0xd9fc('0xc')](),controller['reject']);router['delete'](_0xd9fc('0x15'),auth[_0xd9fc('0xc')](),controller[_0xd9fc('0x19')]);module[_0xd9fc('0x1a')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index cb8d456..758f48a 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 _0xa832=['ENUM','out','DATE','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x44e120,_0x787096){var _0x53ab65=function(_0x3f4aa8){while(--_0x3f4aa8){_0x44e120['push'](_0x44e120['shift']());}};_0x53ab65(++_0x787096);}(_0xa832,0x1db));var _0x2a83=function(_0x54e475,_0x4e2f5d){_0x54e475=_0x54e475-0x0;var _0x8bd965=_0xa832[_0x54e475];return _0x8bd965;};'use strict';var Sequelize=require(_0x2a83('0x0'));module[_0x2a83('0x1')]={'body':{'type':Sequelize[_0x2a83('0x2')](_0x2a83('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x2a83('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x2a83('0x5')]('in','out'),'defaultValue':_0x2a83('0x6'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x2a83('0x7')]},'secret':{'type':Sequelize[_0x2a83('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x1529=['TEXT','medium','BOOLEAN','ENUM','out','STRING','exports'];(function(_0x5ff517,_0x3e4ee0){var _0x19a245=function(_0x4c00ac){while(--_0x4c00ac){_0x5ff517['push'](_0x5ff517['shift']());}};_0x19a245(++_0x3e4ee0);}(_0x1529,0x1d4));var _0x9152=function(_0x754f7f,_0x5a0753){_0x754f7f=_0x754f7f-0x0;var _0x20d21b=_0x1529[_0x754f7f];return _0x20d21b;};'use strict';var Sequelize=require('sequelize');module[_0x9152('0x0')]={'body':{'type':Sequelize[_0x9152('0x1')](_0x9152('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x9152('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x9152('0x4')]('in',_0x9152('0x5')),'defaultValue':_0x9152('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x9152('0x6')](0xbe)},'phone':{'type':Sequelize[_0x9152('0x6')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x9152('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x9152('0x6')]},'providerResponse':{'type':Sequelize[_0x9152('0x1')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 2c82585..5481a85 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 _0x57b7=['sort','where','filter','merge','VIRTUAL','options','SmsMessage','includeAll','include','findAll','rows','show','params','find','create','update','body','describe','accept','sms','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','SmsInteraction','SmsInteractionId','read1stAt','format','interaction','role','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','SELECT','contact','email','internal','interface','SIP/%s','channel','motionChannel','event','EventManager','sms-interactions','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','QueryTypes','User','fullname','rejectmessage','SmsAccount','SmsAccountId','inspect','MessageSid','messageId','twilio','plivo','MessageUUID','indexOf','Status','SmsAccount,\x20%s,\x20%s,\x20%s','plivio','infobip','results','groupName','DELIVERED','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','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','register','client','http','then','info','debug','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SmsMessage,\x20%s,\x20%s','message','result','catch','sendStatus','end','status','json','offset','count','limit','set','Content-Range','reject','save','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order'];(function(_0x5c078e,_0x564775){var _0x56dc90=function(_0x5ef32d){while(--_0x5ef32d){_0x5c078e['push'](_0x5c078e['shift']());}};_0x56dc90(++_0x564775);}(_0x57b7,0x160));var _0x757b=function(_0x2ecdc2,_0x1c2af7){_0x2ecdc2=_0x2ecdc2-0x0;var _0x4dc0de=_0x57b7[_0x2ecdc2];return _0x4dc0de;};'use strict';var emlformat=require(_0x757b('0x0'));var rimraf=require(_0x757b('0x1'));var zipdir=require(_0x757b('0x2'));var jsonpatch=require(_0x757b('0x3'));var rp=require(_0x757b('0x4'));var moment=require(_0x757b('0x5'));var BPromise=require(_0x757b('0x6'));var Mustache=require('mustache');var util=require(_0x757b('0x7'));var path=require(_0x757b('0x8'));var sox=require(_0x757b('0x9'));var csv=require(_0x757b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x757b('0xb'));var _=require(_0x757b('0xc'));var squel=require(_0x757b('0xd'));var crypto=require(_0x757b('0xe'));var jsforce=require(_0x757b('0xf'));var deskjs=require(_0x757b('0x10'));var toCsv=require(_0x757b('0xa'));var querystring=require(_0x757b('0x11'));var Papa=require('papaparse');var Redis=require(_0x757b('0x12'));var authService=require(_0x757b('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x757b('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x757b('0x15'))('api');var utils=require(_0x757b('0x16'));var config=require(_0x757b('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x757b('0x18'))['db'];config[_0x757b('0x19')]=_['defaults'](config[_0x757b('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x757b('0x1a'))(new Redis(config[_0x757b('0x19')]));require('./smsMessage.socket')[_0x757b('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0x757b('0x1c')][_0x757b('0x1d')]({'port':0x232c});var client9002=jayson[_0x757b('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1336e0,_0x585943,_0x5c338e,_0x268a27){return new BPromise(function(_0x493286,_0x5201dd){var _0x202560=_0x268a27||client;return _0x202560['request'](_0x1336e0,_0x5c338e)[_0x757b('0x1e')](function(_0x267b5d){logger[_0x757b('0x1f')]('SmsMessage,\x20%s,\x20%s',_0x585943,'request\x20sent');logger[_0x757b('0x20')](_0x757b('0x21'),_0x585943,_0x757b('0x22'),JSON[_0x757b('0x23')](_0x267b5d));if(_0x267b5d[_0x757b('0x24')]){if(_0x267b5d[_0x757b('0x24')][_0x757b('0x25')]===0x1f4){logger[_0x757b('0x24')](_0x757b('0x26'),_0x585943,_0x267b5d[_0x757b('0x24')]['message']);return _0x5201dd(_0x267b5d[_0x757b('0x24')][_0x757b('0x27')]);}logger[_0x757b('0x24')](_0x757b('0x26'),_0x585943,_0x267b5d[_0x757b('0x24')][_0x757b('0x27')]);return _0x493286(_0x267b5d['error'][_0x757b('0x27')]);}else{logger['info'](_0x757b('0x26'),_0x585943,_0x757b('0x22'));_0x493286(_0x267b5d[_0x757b('0x28')][_0x757b('0x27')]);}})[_0x757b('0x29')](function(_0x1181e8){logger['error']('SmsMessage,\x20%s,\x20%s',_0x585943,_0x1181e8);_0x5201dd(_0x1181e8);});});}function respondWithStatusCode(_0x4a7602,_0x1a8fb7){_0x1a8fb7=_0x1a8fb7||0xcc;return function(_0x21803a){if(_0x21803a){return _0x4a7602[_0x757b('0x2a')](_0x1a8fb7);}return _0x4a7602['status'](_0x1a8fb7)[_0x757b('0x2b')]();};}function respondWithResult(_0x108022,_0x1ef05b){_0x1ef05b=_0x1ef05b||0xc8;return function(_0x1f9312){if(_0x1f9312){return _0x108022[_0x757b('0x2c')](_0x1ef05b)[_0x757b('0x2d')](_0x1f9312);}};}function respondWithFilteredResult(_0x4f015b,_0x143e03){return function(_0x33d887){if(_0x33d887){var _0x176454=typeof _0x143e03[_0x757b('0x2e')]==='undefined'&&typeof _0x143e03['limit']==='undefined';var _0x2cff2f=_0x33d887[_0x757b('0x2f')];var _0x11ec53=_0x176454?0x0:_0x143e03[_0x757b('0x2e')];var _0x308820=_0x176454?_0x33d887[_0x757b('0x2f')]:_0x143e03[_0x757b('0x2e')]+_0x143e03[_0x757b('0x30')];var _0x304092;if(_0x308820>=_0x2cff2f){_0x308820=_0x2cff2f;_0x304092=0xc8;}else{_0x304092=0xce;}_0x4f015b[_0x757b('0x2c')](_0x304092);return _0x4f015b[_0x757b('0x31')](_0x757b('0x32'),_0x11ec53+'-'+_0x308820+'/'+_0x2cff2f)[_0x757b('0x2d')](_0x33d887);}return null;};}function patchUpdates(_0x371091){return function(_0x5aaf1c){try{jsonpatch['apply'](_0x5aaf1c,_0x371091,!![]);}catch(_0x716164){return BPromise[_0x757b('0x33')](_0x716164);}return _0x5aaf1c[_0x757b('0x34')]();};}function saveUpdates(_0x2afde7,_0xf8c19b){return function(_0x2aba98){if(_0x2aba98){return _0x2aba98['update'](_0x2afde7)['then'](function(_0x3e625b){return _0x3e625b;});}return null;};}function removeEntity(_0x62447f,_0x2db29f){return function(_0x4f96f1){if(_0x4f96f1){return _0x4f96f1['destroy']()[_0x757b('0x1e')](function(){_0x62447f[_0x757b('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x686ba2,_0x36dd88){return function(_0x3b53de){if(!_0x3b53de){_0x686ba2[_0x757b('0x2a')](0x194);}return _0x3b53de;};}function handleError(_0x358dbe,_0x2c16bb){_0x2c16bb=_0x2c16bb||0x1f4;return function(_0x13fa8c){logger[_0x757b('0x24')](_0x13fa8c[_0x757b('0x35')]);if(_0x13fa8c[_0x757b('0x36')]){delete _0x13fa8c[_0x757b('0x36')];}_0x358dbe[_0x757b('0x2c')](_0x2c16bb)[_0x757b('0x37')](_0x13fa8c);};}exports[_0x757b('0x38')]=function(_0x4df2b6,_0x2be604){var _0x56f89e={},_0x5d90ff={},_0x336ed2={'count':0x0,'rows':[]};var _0x25176f=_[_0x757b('0x39')](db['SmsMessage'][_0x757b('0x3a')],function(_0x17c036){return{'name':_0x17c036[_0x757b('0x3b')],'type':_0x17c036[_0x757b('0x3c')]['key']};});_0x5d90ff[_0x757b('0x3d')]=_[_0x757b('0x39')](_0x25176f,'name');_0x5d90ff[_0x757b('0x3e')]=_[_0x757b('0x3f')](_0x4df2b6[_0x757b('0x3e')]);_0x5d90ff[_0x757b('0x40')]=_['intersection'](_0x5d90ff[_0x757b('0x3d')],_0x5d90ff[_0x757b('0x3e')]);_0x56f89e[_0x757b('0x41')]=_[_0x757b('0x42')](_0x5d90ff[_0x757b('0x3d')],qs[_0x757b('0x43')](_0x4df2b6[_0x757b('0x3e')][_0x757b('0x43')]));_0x56f89e[_0x757b('0x41')]=_0x56f89e[_0x757b('0x41')][_0x757b('0x44')]?_0x56f89e[_0x757b('0x41')]:_0x5d90ff['model'];if(!_0x4df2b6[_0x757b('0x3e')]['hasOwnProperty'](_0x757b('0x45'))){_0x56f89e[_0x757b('0x30')]=qs['limit'](_0x4df2b6['query'][_0x757b('0x30')]);_0x56f89e[_0x757b('0x2e')]=qs[_0x757b('0x2e')](_0x4df2b6[_0x757b('0x3e')]['offset']);}_0x56f89e[_0x757b('0x46')]=qs['sort'](_0x4df2b6[_0x757b('0x3e')][_0x757b('0x47')]);_0x56f89e[_0x757b('0x48')]=qs[_0x757b('0x40')](_['pick'](_0x4df2b6[_0x757b('0x3e')],_0x5d90ff[_0x757b('0x40')]),_0x25176f);if(_0x4df2b6['query'][_0x757b('0x49')]){_0x56f89e['where']=_[_0x757b('0x4a')](_0x56f89e[_0x757b('0x48')],{'$or':_['map'](_0x25176f,function(_0x9c50e5){if(_0x9c50e5[_0x757b('0x3c')]!==_0x757b('0x4b')){var _0x575b9e={};_0x575b9e[_0x9c50e5[_0x757b('0x36')]]={'$like':'%'+_0x4df2b6[_0x757b('0x3e')]['filter']+'%'};return _0x575b9e;}})});}_0x56f89e=_['merge']({},_0x56f89e,_0x4df2b6[_0x757b('0x4c')]);var _0x5aa43d={'where':_0x56f89e['where']};return db[_0x757b('0x4d')][_0x757b('0x2f')](_0x5aa43d)[_0x757b('0x1e')](function(_0x17be7c){_0x336ed2['count']=_0x17be7c;if(_0x4df2b6[_0x757b('0x3e')][_0x757b('0x4e')]){_0x56f89e[_0x757b('0x4f')]=[{'all':!![]}];}return db[_0x757b('0x4d')][_0x757b('0x50')](_0x56f89e);})[_0x757b('0x1e')](function(_0x45582d){_0x336ed2[_0x757b('0x51')]=_0x45582d;return _0x336ed2;})[_0x757b('0x1e')](respondWithFilteredResult(_0x2be604,_0x56f89e))[_0x757b('0x29')](handleError(_0x2be604,null));};exports[_0x757b('0x52')]=function(_0x32034b,_0x568d4d){var _0x285032={'raw':!![],'where':{'id':_0x32034b[_0x757b('0x53')]['id']}},_0x4acb58={};_0x4acb58[_0x757b('0x3d')]=_[_0x757b('0x3f')](db[_0x757b('0x4d')][_0x757b('0x3a')]);_0x4acb58[_0x757b('0x3e')]=_['keys'](_0x32034b[_0x757b('0x3e')]);_0x4acb58[_0x757b('0x40')]=_[_0x757b('0x42')](_0x4acb58[_0x757b('0x3d')],_0x4acb58[_0x757b('0x3e')]);_0x285032['attributes']=_[_0x757b('0x42')](_0x4acb58[_0x757b('0x3d')],qs[_0x757b('0x43')](_0x32034b[_0x757b('0x3e')][_0x757b('0x43')]));_0x285032[_0x757b('0x41')]=_0x285032[_0x757b('0x41')][_0x757b('0x44')]?_0x285032[_0x757b('0x41')]:_0x4acb58[_0x757b('0x3d')];if(_0x32034b['query']['includeAll']){_0x285032['include']=[{'all':!![]}];}_0x285032=_[_0x757b('0x4a')]({},_0x285032,_0x32034b[_0x757b('0x4c')]);return db[_0x757b('0x4d')][_0x757b('0x54')](_0x285032)[_0x757b('0x1e')](handleEntityNotFound(_0x568d4d,null))[_0x757b('0x1e')](respondWithResult(_0x568d4d,null))[_0x757b('0x29')](handleError(_0x568d4d,null));};exports[_0x757b('0x55')]=function(_0x426f36,_0x1ed94f){return db[_0x757b('0x4d')][_0x757b('0x55')](_0x426f36['body'],{})[_0x757b('0x1e')](respondWithResult(_0x1ed94f,0xc9))[_0x757b('0x29')](handleError(_0x1ed94f,null));};exports[_0x757b('0x56')]=function(_0x59b20f,_0xd951cf){if(_0x59b20f[_0x757b('0x57')]['id']){delete _0x59b20f[_0x757b('0x57')]['id'];}return db[_0x757b('0x4d')][_0x757b('0x54')]({'where':{'id':_0x59b20f[_0x757b('0x53')]['id']}})['then'](handleEntityNotFound(_0xd951cf,null))['then'](saveUpdates(_0x59b20f['body'],null))[_0x757b('0x1e')](respondWithResult(_0xd951cf,null))[_0x757b('0x29')](handleError(_0xd951cf,null));};exports['destroy']=function(_0x5134e4,_0x223d9d){return db[_0x757b('0x4d')][_0x757b('0x54')]({'where':{'id':_0x5134e4[_0x757b('0x53')]['id']}})[_0x757b('0x1e')](handleEntityNotFound(_0x223d9d,null))[_0x757b('0x1e')](removeEntity(_0x223d9d,null))[_0x757b('0x29')](handleError(_0x223d9d,null));};exports[_0x757b('0x58')]=function(_0x51cb6a,_0x58f9fb){return db[_0x757b('0x4d')]['describe']()[_0x757b('0x1e')](respondWithResult(_0x58f9fb,null))['catch'](handleError(_0x58f9fb,null));};var interaction_log=require('../../config/logger')('sms-interactions');exports[_0x757b('0x59')]=function(_0xcd8369,_0x21c9df,_0x4f5956){var _0x369dfc={'agent':{},'channel':_0x757b('0x5a')};if(_0xcd8369[_0x757b('0x57')]['id']){delete _0xcd8369['body']['id'];}_0xcd8369['body']['read']=!![];_0xcd8369[_0x757b('0x57')]['readAt']=moment()['format'](_0x757b('0x5b'));_0xcd8369[_0x757b('0x57')][_0x757b('0x5c')]=_0xcd8369[_0x757b('0x57')][_0x757b('0x5c')]||_0xcd8369[_0x757b('0x5d')]['id'];_0x369dfc[_0x757b('0x5e')]['id']=_0xcd8369[_0x757b('0x57')]['UserId'];return db[_0x757b('0x4d')][_0x757b('0x54')]({'where':{'id':_0xcd8369[_0x757b('0x53')]['id'],'UserId':null}})[_0x757b('0x1e')](handleEntityNotFound(_0x21c9df,null))[_0x757b('0x1e')](saveUpdates(_0xcd8369['body'],null))[_0x757b('0x1e')](function(_0x257d23){if(_0x257d23){_0x369dfc[_0x757b('0x27')]=_0x257d23[_0x757b('0x5f')]({'plain':!![]});return db[_0x757b('0x60')][_0x757b('0x54')]({'where':{'id':_0x257d23[_0x757b('0x61')]}});}return null;})[_0x757b('0x1e')](handleEntityNotFound(_0x21c9df,null))['then'](function(_0x832644){if(_0x832644){return _0x832644[_0x757b('0x56')]({'UserId':_0xcd8369[_0x757b('0x57')][_0x757b('0x5c')],'read1stAt':_['isNil'](_0x832644[_0x757b('0x62')])?moment()[_0x757b('0x63')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x757b('0x1e')](function(_0x5cfcc0){if(_0x5cfcc0){_0x369dfc[_0x757b('0x64')]=_0x5cfcc0['get']({'plain':!![]});interaction_log['info']('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xcd8369[_0x757b('0x5d')]['id'],_0xcd8369[_0x757b('0x5d')][_0x757b('0x36')],_0xcd8369[_0x757b('0x5d')][_0x757b('0x65')],_0x369dfc[_0x757b('0x64')]['id'],_0xcd8369['body']?JSON[_0x757b('0x23')](_0xcd8369[_0x757b('0x57')]):_0x757b('0x66'));return respondWithRpcPromise('AcceptMessage',_0x757b('0x67'),_0x369dfc);}return null;})[_0x757b('0x1e')](function(_0x271d48){var _0xb9e917=_0x757b('0x68')+_0x271d48[_0x757b('0x27')][_0x757b('0x69')];return db['sequelize'][_0x757b('0x3e')](_0xb9e917,{'type':db[_0x757b('0x6a')]['QueryTypes'][_0x757b('0x6b')],'raw':!![]})[_0x757b('0x1e')](function(_0x27ace6){return _0x27ace6;});})[_0x757b('0x1e')](function(_0x3deaae){if(_0x3deaae){_0x369dfc['message'][_0x757b('0x6c')]=_0x3deaae[0x0];if(!_0xcd8369[_0x757b('0x57')][_0x757b('0x5c')])return;return db['User'][_0x757b('0x54')]({'where':{'id':_0xcd8369['body'][_0x757b('0x5c')],'role':'agent'},'attributes':['id',_0x757b('0x36'),'fullname',_0x757b('0x6d'),_0x757b('0x6e')],'raw':!![]});}return null;})[_0x757b('0x1e')](function(_0x51c4d2){if(!_0x51c4d2)return null;_0x369dfc[_0x757b('0x27')]['agent']=_0x51c4d2;return _0x369dfc;})[_0x757b('0x1e')](function(_0x1022ce){if(_0x1022ce){if(_0xcd8369['body']['manual']){_0x369dfc[_0x757b('0x27')][_0x757b('0x6f')]=util[_0x757b('0x63')](_0x757b('0x70'),_0xcd8369[_0x757b('0x5d')][_0x757b('0x36')]);_0x369dfc[_0x757b('0x27')][_0x757b('0x71')]=_0x369dfc[_0x757b('0x71')];_0x369dfc[_0x757b('0x27')][_0x757b('0x72')]=_0x369dfc[_0x757b('0x71')];_0x369dfc[_0x757b('0x27')][_0x757b('0x73')]=_0x757b('0x59');return respondWithRpcPromise(_0x757b('0x74'),_0x757b('0x74'),{'event':'acceptmessage','message':_0x369dfc[_0x757b('0x27')]},client9002)[_0x757b('0x1e')](function(){return _0x369dfc;});}return _0x369dfc;}return null;})['then'](respondWithResult(_0x21c9df,null))['catch'](handleError(_0x21c9df,null));};var interaction_log=require(_0x757b('0x15'))(_0x757b('0x75'));exports[_0x757b('0x33')]=function(_0x5a1c27,_0x48883f,_0x7f7bf6){var _0x44cb3a={'agent':{},'channel':_0x757b('0x5a')};if(_0x5a1c27[_0x757b('0x57')]['id']){delete _0x5a1c27[_0x757b('0x57')]['id'];}_0x5a1c27['body'][_0x757b('0x5c')]=_0x5a1c27[_0x757b('0x57')][_0x757b('0x5c')]||_0x5a1c27['user']['id'];_0x44cb3a['agent']['id']=_0x5a1c27[_0x757b('0x57')][_0x757b('0x5c')];return db[_0x757b('0x4d')][_0x757b('0x54')]({'where':{'id':_0x5a1c27['params']['id'],'UserId':null}})[_0x757b('0x1e')](handleEntityNotFound(_0x48883f,null))[_0x757b('0x1e')](function(_0x1aa551){if(_0x1aa551){_0x44cb3a['message']=_0x1aa551[_0x757b('0x5f')]({'plain':!![]});return db[_0x757b('0x60')][_0x757b('0x54')]({'where':{'id':_0x1aa551[_0x757b('0x61')]}});}return null;})[_0x757b('0x1e')](handleEntityNotFound(_0x48883f,null))[_0x757b('0x1e')](function(_0x36d310){if(_0x36d310){_0x44cb3a[_0x757b('0x64')]=_0x36d310[_0x757b('0x5f')]({'plain':!![]});interaction_log[_0x757b('0x1f')](_0x757b('0x76'),_0x5a1c27['user']['id'],_0x5a1c27[_0x757b('0x5d')]['name'],_0x5a1c27[_0x757b('0x5d')][_0x757b('0x65')],_0x44cb3a['interaction']['id'],_0x5a1c27[_0x757b('0x57')]?JSON[_0x757b('0x23')](_0x5a1c27[_0x757b('0x57')]):_0x757b('0x66'));return respondWithRpcPromise(_0x757b('0x77'),_0x757b('0x78'),_0x44cb3a);}return null;})[_0x757b('0x1e')](function(_0x284c41){var _0x322dbc=_0x757b('0x68')+_0x284c41[_0x757b('0x27')][_0x757b('0x69')];return db['sequelize']['query'](_0x322dbc,{'type':db['Sequelize'][_0x757b('0x79')][_0x757b('0x6b')],'raw':!![]})['then'](function(_0x11420c){return _0x11420c;});})[_0x757b('0x1e')](function(_0x2e93ab){if(_0x2e93ab){_0x44cb3a[_0x757b('0x27')][_0x757b('0x6c')]=_0x2e93ab[0x0];if(!_0x5a1c27[_0x757b('0x57')][_0x757b('0x5c')])return;return db[_0x757b('0x7a')][_0x757b('0x54')]({'where':{'id':_0x5a1c27['body'][_0x757b('0x5c')],'role':'agent'},'attributes':['id',_0x757b('0x36'),_0x757b('0x7b'),_0x757b('0x6d'),_0x757b('0x6e')],'raw':!![]});}return null;})[_0x757b('0x1e')](function(_0x39479d){if(!_0x39479d)return null;_0x44cb3a[_0x757b('0x27')][_0x757b('0x5e')]=_0x39479d;return _0x44cb3a;})['then'](function(_0x59f63d){if(_0x59f63d){_0x59f63d['message'][_0x757b('0x6f')]=util[_0x757b('0x63')](_0x757b('0x70'),_0x5a1c27[_0x757b('0x5d')][_0x757b('0x36')]);_0x59f63d[_0x757b('0x27')]['channel']=_0x44cb3a[_0x757b('0x71')];_0x59f63d['message'][_0x757b('0x72')]=_0x44cb3a[_0x757b('0x71')];_0x59f63d[_0x757b('0x27')]['event']='reject';respondWithRpcPromise('EventManager',_0x757b('0x74'),{'event':_0x757b('0x7c'),'message':_0x59f63d[_0x757b('0x27')]},client9002);return _0x44cb3a;}return null;})[_0x757b('0x1e')](respondWithResult(_0x48883f,null))[_0x757b('0x29')](handleError(_0x48883f,null));};exports[_0x757b('0x2c')]=function(_0x3984f9,_0x265464,_0x497c34){if(_0x3984f9[_0x757b('0x57')]['id']){delete _0x3984f9[_0x757b('0x57')]['id'];}var _0xb8210f;return db[_0x757b('0x4d')][_0x757b('0x54')]({'where':{'id':_0x3984f9[_0x757b('0x53')]['id']}})[_0x757b('0x1e')](handleEntityNotFound(_0x265464,null))[_0x757b('0x1e')](function(_0xb0fc4e){if(_0xb0fc4e){_0xb8210f=_0xb0fc4e;return db[_0x757b('0x7d')][_0x757b('0x54')]({'where':{'id':_0xb0fc4e[_0x757b('0x7e')]}});}})[_0x757b('0x1e')](handleEntityNotFound(_0x265464,null))[_0x757b('0x1e')](function(_0x44883c){if(_0x44883c){logger[_0x757b('0x20')](_0x757b('0x21'),_0x757b('0x2c'),'received\x20delivery\x20report\x20from',_0x44883c[_0x757b('0x3c')],util[_0x757b('0x7f')](_0x3984f9['body'],{'showHidden':![],'depth':null}));switch(_0x44883c[_0x757b('0x3c')]){case'twilio':if(_0x3984f9['body'][_0x757b('0x80')]&&_0x3984f9['body'][_0x757b('0x80')]===_0xb8210f[_0x757b('0x81')]){return _0xb8210f[_0x757b('0x56')]({'read':!![]});}else{logger[_0x757b('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x757b('0x2c'),_0x757b('0x82'),util['inspect'](_0x3984f9[_0x757b('0x57')],{'showHidden':![],'depth':null}));}break;case _0x757b('0x83'):if(_0x3984f9['body'][_0x757b('0x84')]&&_0x3984f9[_0x757b('0x57')]['MessageUUID']===_0xb8210f[_0x757b('0x81')]&&_[_0x757b('0x85')](['sent','delivered'],_0x3984f9['body'][_0x757b('0x86')])>=0x0){return _0xb8210f['update']({'read':!![]});}else{logger['error'](_0x757b('0x87'),_0x757b('0x2c'),_0x757b('0x88'),util[_0x757b('0x7f')](_0x3984f9[_0x757b('0x57')],{'showHidden':![],'depth':null}));}break;case _0x757b('0x89'):var _0x15b7e0=_0x3984f9['body'][_0x757b('0x8a')][0x0];if(_0x15b7e0[_0x757b('0x2c')][_0x757b('0x8b')]===_0x757b('0x8c')){return _0xb8210f[_0x757b('0x56')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x757b('0x2c'),_0x757b('0x89'),util[_0x757b('0x7f')](_0x3984f9[_0x757b('0x57')],{'showHidden':![],'depth':null}));}break;}return _0xb8210f;}})['then'](respondWithResult(_0x265464,null))[_0x757b('0x29')](handleError(_0x265464,null));}; \ No newline at end of file +var _0x7c7f=['type','VIRTUAL','includeAll','show','params','length','include','find','create','body','describe','sms-interactions','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','SmsInteraction','SmsInteractionId','isNil','interaction','info','[SMSMESSAGE: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','QueryTypes','SELECT','contact','User','fullname','internal','manual','interface','channel','motionChannel','event','EventManager','acceptmessage','../../config/logger','reject','sms','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','email','rejectmessage','SmsAccountId','SmsMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','messageId','sent','delivered','SmsAccount,\x20%s,\x20%s,\x20%s','plivio','infobip','results','groupName','DELIVERED','eml-format','rimraf','request-promise','moment','bluebird','util','path','ejs','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','register','client','http','request','request\x20sent','debug','stringify','error','code','SmsMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','save','update','then','destroy','stack','name','send','index','map','SmsMessage','rawAttributes','fieldName','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge'];(function(_0x2771eb,_0x58dd45){var _0x58c243=function(_0x876780){while(--_0x876780){_0x2771eb['push'](_0x2771eb['shift']());}};_0x58c243(++_0x58dd45);}(_0x7c7f,0x163));var _0xf7c7=function(_0x368fb9,_0x1a9895){_0x368fb9=_0x368fb9-0x0;var _0x4892fb=_0x7c7f[_0x368fb9];return _0x4892fb;};'use strict';var emlformat=require(_0xf7c7('0x0'));var rimraf=require(_0xf7c7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf7c7('0x2'));var moment=require(_0xf7c7('0x3'));var BPromise=require(_0xf7c7('0x4'));var Mustache=require('mustache');var util=require(_0xf7c7('0x5'));var path=require(_0xf7c7('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf7c7('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xf7c7('0x8'));var crypto=require(_0xf7c7('0x9'));var jsforce=require(_0xf7c7('0xa'));var deskjs=require(_0xf7c7('0xb'));var toCsv=require(_0xf7c7('0xc'));var querystring=require('querystring');var Papa=require(_0xf7c7('0xd'));var Redis=require('ioredis');var authService=require(_0xf7c7('0xe'));var qs=require(_0xf7c7('0xf'));var as=require(_0xf7c7('0x10'));var hardwareService=require(_0xf7c7('0x11'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xf7c7('0x12'));var licenseUtil=require(_0xf7c7('0x13'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xf7c7('0x14')](config[_0xf7c7('0x15')],{'host':_0xf7c7('0x16'),'port':0x18eb});var socket=require(_0xf7c7('0x17'))(new Redis(config['redis']));require('./smsMessage.socket')[_0xf7c7('0x18')](socket);var jayson=require('jayson/promise');var client=jayson[_0xf7c7('0x19')][_0xf7c7('0x1a')]({'port':0x232c});var client9002=jayson[_0xf7c7('0x19')]['http']({'port':0x232a});function respondWithRpcPromise(_0x9cd3d2,_0x75f675,_0x8b893f,_0x57d69f){return new BPromise(function(_0x20193e,_0x4a783e){var _0x36de35=_0x57d69f||client;return _0x36de35[_0xf7c7('0x1b')](_0x9cd3d2,_0x8b893f)['then'](function(_0x446146){logger['info']('SmsMessage,\x20%s,\x20%s',_0x75f675,_0xf7c7('0x1c'));logger[_0xf7c7('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x75f675,_0xf7c7('0x1c'),JSON[_0xf7c7('0x1e')](_0x446146));if(_0x446146[_0xf7c7('0x1f')]){if(_0x446146[_0xf7c7('0x1f')][_0xf7c7('0x20')]===0x1f4){logger[_0xf7c7('0x1f')](_0xf7c7('0x21'),_0x75f675,_0x446146[_0xf7c7('0x1f')][_0xf7c7('0x22')]);return _0x4a783e(_0x446146[_0xf7c7('0x1f')][_0xf7c7('0x22')]);}logger[_0xf7c7('0x1f')](_0xf7c7('0x21'),_0x75f675,_0x446146[_0xf7c7('0x1f')][_0xf7c7('0x22')]);return _0x20193e(_0x446146[_0xf7c7('0x1f')]['message']);}else{logger['info']('SmsMessage,\x20%s,\x20%s',_0x75f675,'request\x20sent');_0x20193e(_0x446146[_0xf7c7('0x23')]['message']);}})[_0xf7c7('0x24')](function(_0x46fff5){logger[_0xf7c7('0x1f')](_0xf7c7('0x21'),_0x75f675,_0x46fff5);_0x4a783e(_0x46fff5);});});}function respondWithStatusCode(_0x31f849,_0x5e5d87){_0x5e5d87=_0x5e5d87||0xcc;return function(_0x28adcd){if(_0x28adcd){return _0x31f849[_0xf7c7('0x25')](_0x5e5d87);}return _0x31f849[_0xf7c7('0x26')](_0x5e5d87)[_0xf7c7('0x27')]();};}function respondWithResult(_0x520b7a,_0x492799){_0x492799=_0x492799||0xc8;return function(_0x136833){if(_0x136833){return _0x520b7a[_0xf7c7('0x26')](_0x492799)['json'](_0x136833);}};}function respondWithFilteredResult(_0x212fae,_0x446350){return function(_0x21d90f){if(_0x21d90f){var _0x32fcef=typeof _0x446350[_0xf7c7('0x28')]===_0xf7c7('0x29')&&typeof _0x446350[_0xf7c7('0x2a')]===_0xf7c7('0x29');var _0x1106a1=_0x21d90f['count'];var _0x33b863=_0x32fcef?0x0:_0x446350[_0xf7c7('0x28')];var _0x5020b0=_0x32fcef?_0x21d90f[_0xf7c7('0x2b')]:_0x446350[_0xf7c7('0x28')]+_0x446350['limit'];var _0x20a12a;if(_0x5020b0>=_0x1106a1){_0x5020b0=_0x1106a1;_0x20a12a=0xc8;}else{_0x20a12a=0xce;}_0x212fae[_0xf7c7('0x26')](_0x20a12a);return _0x212fae[_0xf7c7('0x2c')]('Content-Range',_0x33b863+'-'+_0x5020b0+'/'+_0x1106a1)[_0xf7c7('0x2d')](_0x21d90f);}return null;};}function patchUpdates(_0x2a83a8){return function(_0x28e0c4){try{jsonpatch[_0xf7c7('0x2e')](_0x28e0c4,_0x2a83a8,!![]);}catch(_0x35d3ab){return BPromise['reject'](_0x35d3ab);}return _0x28e0c4[_0xf7c7('0x2f')]();};}function saveUpdates(_0x225923,_0x3a0b30){return function(_0x2e1d06){if(_0x2e1d06){return _0x2e1d06[_0xf7c7('0x30')](_0x225923)[_0xf7c7('0x31')](function(_0x5f220c){return _0x5f220c;});}return null;};}function removeEntity(_0xc329e4,_0x8c6b27){return function(_0xab8007){if(_0xab8007){return _0xab8007[_0xf7c7('0x32')]()[_0xf7c7('0x31')](function(){_0xc329e4['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5082a3,_0x43c95e){return function(_0x9dc9d0){if(!_0x9dc9d0){_0x5082a3[_0xf7c7('0x25')](0x194);}return _0x9dc9d0;};}function handleError(_0x2e68fc,_0x2dcc1d){_0x2dcc1d=_0x2dcc1d||0x1f4;return function(_0x311d3f){logger['error'](_0x311d3f[_0xf7c7('0x33')]);if(_0x311d3f[_0xf7c7('0x34')]){delete _0x311d3f[_0xf7c7('0x34')];}_0x2e68fc[_0xf7c7('0x26')](_0x2dcc1d)[_0xf7c7('0x35')](_0x311d3f);};}exports[_0xf7c7('0x36')]=function(_0x50f397,_0x350a8f){var _0x26a404={},_0x2effc1={},_0x502e74={'count':0x0,'rows':[]};var _0x326381=_[_0xf7c7('0x37')](db[_0xf7c7('0x38')][_0xf7c7('0x39')],function(_0x183b1c){return{'name':_0x183b1c[_0xf7c7('0x3a')],'type':_0x183b1c['type']['key']};});_0x2effc1['model']=_[_0xf7c7('0x37')](_0x326381,'name');_0x2effc1[_0xf7c7('0x3b')]=_[_0xf7c7('0x3c')](_0x50f397[_0xf7c7('0x3b')]);_0x2effc1[_0xf7c7('0x3d')]=_[_0xf7c7('0x3e')](_0x2effc1[_0xf7c7('0x3f')],_0x2effc1[_0xf7c7('0x3b')]);_0x26a404['attributes']=_[_0xf7c7('0x3e')](_0x2effc1[_0xf7c7('0x3f')],qs['fields'](_0x50f397[_0xf7c7('0x3b')][_0xf7c7('0x40')]));_0x26a404[_0xf7c7('0x41')]=_0x26a404[_0xf7c7('0x41')]['length']?_0x26a404[_0xf7c7('0x41')]:_0x2effc1['model'];if(!_0x50f397[_0xf7c7('0x3b')][_0xf7c7('0x42')](_0xf7c7('0x43'))){_0x26a404['limit']=qs['limit'](_0x50f397[_0xf7c7('0x3b')]['limit']);_0x26a404[_0xf7c7('0x28')]=qs[_0xf7c7('0x28')](_0x50f397[_0xf7c7('0x3b')][_0xf7c7('0x28')]);}_0x26a404[_0xf7c7('0x44')]=qs['sort'](_0x50f397[_0xf7c7('0x3b')][_0xf7c7('0x45')]);_0x26a404[_0xf7c7('0x46')]=qs[_0xf7c7('0x3d')](_[_0xf7c7('0x47')](_0x50f397['query'],_0x2effc1[_0xf7c7('0x3d')]),_0x326381);if(_0x50f397['query'][_0xf7c7('0x48')]){_0x26a404['where']=_[_0xf7c7('0x49')](_0x26a404[_0xf7c7('0x46')],{'$or':_[_0xf7c7('0x37')](_0x326381,function(_0x1f03bd){if(_0x1f03bd[_0xf7c7('0x4a')]!==_0xf7c7('0x4b')){var _0x4104cf={};_0x4104cf[_0x1f03bd[_0xf7c7('0x34')]]={'$like':'%'+_0x50f397[_0xf7c7('0x3b')]['filter']+'%'};return _0x4104cf;}})});}_0x26a404=_[_0xf7c7('0x49')]({},_0x26a404,_0x50f397['options']);var _0x4dd523={'where':_0x26a404[_0xf7c7('0x46')]};return db[_0xf7c7('0x38')][_0xf7c7('0x2b')](_0x4dd523)[_0xf7c7('0x31')](function(_0x41d2c5){_0x502e74['count']=_0x41d2c5;if(_0x50f397[_0xf7c7('0x3b')][_0xf7c7('0x4c')]){_0x26a404['include']=[{'all':!![]}];}return db['SmsMessage']['findAll'](_0x26a404);})[_0xf7c7('0x31')](function(_0x29e1b9){_0x502e74['rows']=_0x29e1b9;return _0x502e74;})[_0xf7c7('0x31')](respondWithFilteredResult(_0x350a8f,_0x26a404))[_0xf7c7('0x24')](handleError(_0x350a8f,null));};exports[_0xf7c7('0x4d')]=function(_0x5c46d3,_0x245fd3){var _0x509ab4={'raw':!![],'where':{'id':_0x5c46d3[_0xf7c7('0x4e')]['id']}},_0x6bcc8f={};_0x6bcc8f[_0xf7c7('0x3f')]=_[_0xf7c7('0x3c')](db['SmsMessage'][_0xf7c7('0x39')]);_0x6bcc8f[_0xf7c7('0x3b')]=_[_0xf7c7('0x3c')](_0x5c46d3[_0xf7c7('0x3b')]);_0x6bcc8f[_0xf7c7('0x3d')]=_[_0xf7c7('0x3e')](_0x6bcc8f[_0xf7c7('0x3f')],_0x6bcc8f['query']);_0x509ab4['attributes']=_[_0xf7c7('0x3e')](_0x6bcc8f['model'],qs['fields'](_0x5c46d3[_0xf7c7('0x3b')][_0xf7c7('0x40')]));_0x509ab4[_0xf7c7('0x41')]=_0x509ab4[_0xf7c7('0x41')][_0xf7c7('0x4f')]?_0x509ab4[_0xf7c7('0x41')]:_0x6bcc8f[_0xf7c7('0x3f')];if(_0x5c46d3[_0xf7c7('0x3b')][_0xf7c7('0x4c')]){_0x509ab4[_0xf7c7('0x50')]=[{'all':!![]}];}_0x509ab4=_[_0xf7c7('0x49')]({},_0x509ab4,_0x5c46d3['options']);return db[_0xf7c7('0x38')][_0xf7c7('0x51')](_0x509ab4)['then'](handleEntityNotFound(_0x245fd3,null))[_0xf7c7('0x31')](respondWithResult(_0x245fd3,null))[_0xf7c7('0x24')](handleError(_0x245fd3,null));};exports[_0xf7c7('0x52')]=function(_0x409b12,_0x1f9935){return db[_0xf7c7('0x38')][_0xf7c7('0x52')](_0x409b12[_0xf7c7('0x53')],{})['then'](respondWithResult(_0x1f9935,0xc9))[_0xf7c7('0x24')](handleError(_0x1f9935,null));};exports['update']=function(_0x139ea3,_0xe05a24){if(_0x139ea3[_0xf7c7('0x53')]['id']){delete _0x139ea3[_0xf7c7('0x53')]['id'];}return db['SmsMessage'][_0xf7c7('0x51')]({'where':{'id':_0x139ea3['params']['id']}})['then'](handleEntityNotFound(_0xe05a24,null))[_0xf7c7('0x31')](saveUpdates(_0x139ea3[_0xf7c7('0x53')],null))[_0xf7c7('0x31')](respondWithResult(_0xe05a24,null))[_0xf7c7('0x24')](handleError(_0xe05a24,null));};exports[_0xf7c7('0x32')]=function(_0x461952,_0x3f2911){return db[_0xf7c7('0x38')][_0xf7c7('0x51')]({'where':{'id':_0x461952[_0xf7c7('0x4e')]['id']}})[_0xf7c7('0x31')](handleEntityNotFound(_0x3f2911,null))[_0xf7c7('0x31')](removeEntity(_0x3f2911,null))['catch'](handleError(_0x3f2911,null));};exports[_0xf7c7('0x54')]=function(_0x4b4f37,_0x5b1e47){return db[_0xf7c7('0x38')][_0xf7c7('0x54')]()[_0xf7c7('0x31')](respondWithResult(_0x5b1e47,null))[_0xf7c7('0x24')](handleError(_0x5b1e47,null));};var interaction_log=require('../../config/logger')(_0xf7c7('0x55'));exports[_0xf7c7('0x56')]=function(_0x171e2d,_0x8ffa91,_0x234773){var _0x45e56c={'agent':{},'channel':'sms'};if(_0x171e2d[_0xf7c7('0x53')]['id']){delete _0x171e2d[_0xf7c7('0x53')]['id'];}_0x171e2d[_0xf7c7('0x53')][_0xf7c7('0x57')]=!![];_0x171e2d[_0xf7c7('0x53')][_0xf7c7('0x58')]=moment()[_0xf7c7('0x59')](_0xf7c7('0x5a'));_0x171e2d[_0xf7c7('0x53')][_0xf7c7('0x5b')]=_0x171e2d[_0xf7c7('0x53')][_0xf7c7('0x5b')]||_0x171e2d[_0xf7c7('0x5c')]['id'];_0x45e56c[_0xf7c7('0x5d')]['id']=_0x171e2d[_0xf7c7('0x53')][_0xf7c7('0x5b')];return db[_0xf7c7('0x38')][_0xf7c7('0x51')]({'where':{'id':_0x171e2d[_0xf7c7('0x4e')]['id'],'UserId':null}})[_0xf7c7('0x31')](handleEntityNotFound(_0x8ffa91,null))[_0xf7c7('0x31')](saveUpdates(_0x171e2d[_0xf7c7('0x53')],null))[_0xf7c7('0x31')](function(_0x4ec823){if(_0x4ec823){_0x45e56c['message']=_0x4ec823[_0xf7c7('0x5e')]({'plain':!![]});return db[_0xf7c7('0x5f')]['find']({'where':{'id':_0x4ec823[_0xf7c7('0x60')]}});}return null;})[_0xf7c7('0x31')](handleEntityNotFound(_0x8ffa91,null))[_0xf7c7('0x31')](function(_0x4b7b2f){if(_0x4b7b2f){return _0x4b7b2f['update']({'UserId':_0x171e2d['body'][_0xf7c7('0x5b')],'read1stAt':_[_0xf7c7('0x61')](_0x4b7b2f['read1stAt'])?moment()[_0xf7c7('0x59')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xf7c7('0x31')](function(_0x342f8c){if(_0x342f8c){_0x45e56c[_0xf7c7('0x62')]=_0x342f8c['get']({'plain':!![]});interaction_log[_0xf7c7('0x63')](_0xf7c7('0x64'),_0x171e2d[_0xf7c7('0x5c')]['id'],_0x171e2d[_0xf7c7('0x5c')][_0xf7c7('0x34')],_0x171e2d['user'][_0xf7c7('0x65')],_0x45e56c[_0xf7c7('0x62')]['id'],_0x171e2d[_0xf7c7('0x53')]?JSON[_0xf7c7('0x1e')](_0x171e2d[_0xf7c7('0x53')]):_0xf7c7('0x66'));return respondWithRpcPromise(_0xf7c7('0x67'),_0xf7c7('0x68'),_0x45e56c);}return null;})[_0xf7c7('0x31')](function(_0x343b12){var _0x2a7da5=_0xf7c7('0x69')+_0x343b12[_0xf7c7('0x22')][_0xf7c7('0x6a')];return db[_0xf7c7('0x6b')][_0xf7c7('0x3b')](_0x2a7da5,{'type':db[_0xf7c7('0x6c')][_0xf7c7('0x6d')][_0xf7c7('0x6e')],'raw':!![]})[_0xf7c7('0x31')](function(_0x387004){return _0x387004;});})[_0xf7c7('0x31')](function(_0x3100f4){if(_0x3100f4){_0x45e56c['message'][_0xf7c7('0x6f')]=_0x3100f4[0x0];if(!_0x171e2d[_0xf7c7('0x53')][_0xf7c7('0x5b')])return;return db[_0xf7c7('0x70')]['find']({'where':{'id':_0x171e2d[_0xf7c7('0x53')]['UserId'],'role':_0xf7c7('0x5d')},'attributes':['id',_0xf7c7('0x34'),_0xf7c7('0x71'),'email',_0xf7c7('0x72')],'raw':!![]});}return null;})[_0xf7c7('0x31')](function(_0x65acc9){if(!_0x65acc9)return null;_0x45e56c[_0xf7c7('0x22')][_0xf7c7('0x5d')]=_0x65acc9;return _0x45e56c;})[_0xf7c7('0x31')](function(_0x57241f){if(_0x57241f){if(_0x171e2d[_0xf7c7('0x53')][_0xf7c7('0x73')]){_0x45e56c[_0xf7c7('0x22')][_0xf7c7('0x74')]=util[_0xf7c7('0x59')]('SIP/%s',_0x171e2d['user'][_0xf7c7('0x34')]);_0x45e56c['message'][_0xf7c7('0x75')]=_0x45e56c[_0xf7c7('0x75')];_0x45e56c[_0xf7c7('0x22')][_0xf7c7('0x76')]=_0x45e56c[_0xf7c7('0x75')];_0x45e56c[_0xf7c7('0x22')][_0xf7c7('0x77')]=_0xf7c7('0x56');return respondWithRpcPromise(_0xf7c7('0x78'),_0xf7c7('0x78'),{'event':_0xf7c7('0x79'),'message':_0x45e56c[_0xf7c7('0x22')]},client9002)['then'](function(){return _0x45e56c;});}return _0x45e56c;}return null;})['then'](respondWithResult(_0x8ffa91,null))[_0xf7c7('0x24')](handleError(_0x8ffa91,null));};var interaction_log=require(_0xf7c7('0x7a'))(_0xf7c7('0x55'));exports[_0xf7c7('0x7b')]=function(_0x489b6a,_0xa6591a,_0x5d9cb6){var _0x6d3b74={'agent':{},'channel':_0xf7c7('0x7c')};if(_0x489b6a[_0xf7c7('0x53')]['id']){delete _0x489b6a[_0xf7c7('0x53')]['id'];}_0x489b6a[_0xf7c7('0x53')][_0xf7c7('0x5b')]=_0x489b6a['body']['UserId']||_0x489b6a['user']['id'];_0x6d3b74[_0xf7c7('0x5d')]['id']=_0x489b6a[_0xf7c7('0x53')][_0xf7c7('0x5b')];return db[_0xf7c7('0x38')][_0xf7c7('0x51')]({'where':{'id':_0x489b6a[_0xf7c7('0x4e')]['id'],'UserId':null}})[_0xf7c7('0x31')](handleEntityNotFound(_0xa6591a,null))[_0xf7c7('0x31')](function(_0x4f3f00){if(_0x4f3f00){_0x6d3b74['message']=_0x4f3f00['get']({'plain':!![]});return db[_0xf7c7('0x5f')][_0xf7c7('0x51')]({'where':{'id':_0x4f3f00[_0xf7c7('0x60')]}});}return null;})[_0xf7c7('0x31')](handleEntityNotFound(_0xa6591a,null))[_0xf7c7('0x31')](function(_0x379d37){if(_0x379d37){_0x6d3b74[_0xf7c7('0x62')]=_0x379d37[_0xf7c7('0x5e')]({'plain':!![]});interaction_log[_0xf7c7('0x63')](_0xf7c7('0x7d'),_0x489b6a[_0xf7c7('0x5c')]['id'],_0x489b6a[_0xf7c7('0x5c')][_0xf7c7('0x34')],_0x489b6a['user'][_0xf7c7('0x65')],_0x6d3b74[_0xf7c7('0x62')]['id'],_0x489b6a[_0xf7c7('0x53')]?JSON[_0xf7c7('0x1e')](_0x489b6a[_0xf7c7('0x53')]):'null');return respondWithRpcPromise(_0xf7c7('0x7e'),'rejectMessage',_0x6d3b74);}return null;})[_0xf7c7('0x31')](function(_0x4bcfec){var _0x211568=_0xf7c7('0x69')+_0x4bcfec[_0xf7c7('0x22')][_0xf7c7('0x6a')];return db['sequelize'][_0xf7c7('0x3b')](_0x211568,{'type':db[_0xf7c7('0x6c')][_0xf7c7('0x6d')][_0xf7c7('0x6e')],'raw':!![]})['then'](function(_0x41f1c5){return _0x41f1c5;});})['then'](function(_0x37ef4c){if(_0x37ef4c){_0x6d3b74[_0xf7c7('0x22')]['contact']=_0x37ef4c[0x0];if(!_0x489b6a[_0xf7c7('0x53')][_0xf7c7('0x5b')])return;return db['User'][_0xf7c7('0x51')]({'where':{'id':_0x489b6a['body'][_0xf7c7('0x5b')],'role':_0xf7c7('0x5d')},'attributes':['id',_0xf7c7('0x34'),_0xf7c7('0x71'),_0xf7c7('0x7f'),'internal'],'raw':!![]});}return null;})[_0xf7c7('0x31')](function(_0x5212ef){if(!_0x5212ef)return null;_0x6d3b74['message'][_0xf7c7('0x5d')]=_0x5212ef;return _0x6d3b74;})[_0xf7c7('0x31')](function(_0x128183){if(_0x128183){_0x128183[_0xf7c7('0x22')][_0xf7c7('0x74')]=util[_0xf7c7('0x59')]('SIP/%s',_0x489b6a[_0xf7c7('0x5c')][_0xf7c7('0x34')]);_0x128183[_0xf7c7('0x22')][_0xf7c7('0x75')]=_0x6d3b74['channel'];_0x128183[_0xf7c7('0x22')][_0xf7c7('0x76')]=_0x6d3b74['channel'];_0x128183[_0xf7c7('0x22')][_0xf7c7('0x77')]=_0xf7c7('0x7b');respondWithRpcPromise('EventManager',_0xf7c7('0x78'),{'event':_0xf7c7('0x80'),'message':_0x128183['message']},client9002);return _0x6d3b74;}return null;})[_0xf7c7('0x31')](respondWithResult(_0xa6591a,null))[_0xf7c7('0x24')](handleError(_0xa6591a,null));};exports['status']=function(_0x5f17cd,_0x1f016c,_0xc0aa4b){if(_0x5f17cd[_0xf7c7('0x53')]['id']){delete _0x5f17cd[_0xf7c7('0x53')]['id'];}var _0x2245b3;return db['SmsMessage'][_0xf7c7('0x51')]({'where':{'id':_0x5f17cd[_0xf7c7('0x4e')]['id']}})[_0xf7c7('0x31')](handleEntityNotFound(_0x1f016c,null))[_0xf7c7('0x31')](function(_0x4da167){if(_0x4da167){_0x2245b3=_0x4da167;return db['SmsAccount'][_0xf7c7('0x51')]({'where':{'id':_0x4da167[_0xf7c7('0x81')]}});}})['then'](handleEntityNotFound(_0x1f016c,null))['then'](function(_0xf266f4){if(_0xf266f4){logger[_0xf7c7('0x1d')](_0xf7c7('0x82'),_0xf7c7('0x26'),_0xf7c7('0x83'),_0xf266f4['type'],util[_0xf7c7('0x84')](_0x5f17cd['body'],{'showHidden':![],'depth':null}));switch(_0xf266f4[_0xf7c7('0x4a')]){case _0xf7c7('0x85'):if(_0x5f17cd[_0xf7c7('0x53')]['MessageSid']&&_0x5f17cd[_0xf7c7('0x53')]['MessageSid']===_0x2245b3[_0xf7c7('0x86')]){return _0x2245b3['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0xf7c7('0x85'),util[_0xf7c7('0x84')](_0x5f17cd[_0xf7c7('0x53')],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0x5f17cd[_0xf7c7('0x53')]['MessageUUID']&&_0x5f17cd['body']['MessageUUID']===_0x2245b3[_0xf7c7('0x86')]&&_['indexOf']([_0xf7c7('0x87'),_0xf7c7('0x88')],_0x5f17cd['body']['Status'])>=0x0){return _0x2245b3[_0xf7c7('0x30')]({'read':!![]});}else{logger[_0xf7c7('0x1f')](_0xf7c7('0x89'),_0xf7c7('0x26'),_0xf7c7('0x8a'),util[_0xf7c7('0x84')](_0x5f17cd[_0xf7c7('0x53')],{'showHidden':![],'depth':null}));}break;case _0xf7c7('0x8b'):var _0x37318c=_0x5f17cd[_0xf7c7('0x53')][_0xf7c7('0x8c')][0x0];if(_0x37318c[_0xf7c7('0x26')][_0xf7c7('0x8d')]===_0xf7c7('0x8e')){return _0x2245b3[_0xf7c7('0x30')]({'read':!![]});}else{logger[_0xf7c7('0x1f')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xf7c7('0x26'),'infobip',util[_0xf7c7('0x84')](_0x5f17cd[_0xf7c7('0x53')],{'showHidden':![],'depth':null}));}break;}return _0x2245b3;}})[_0xf7c7('0x31')](respondWithResult(_0x1f016c,null))[_0xf7c7('0x24')](handleError(_0x1f016c,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 357dbb7..39d4a10 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 _0xf188=['hasOwnProperty','hook','exports','events','../../mysqldb','SmsMessage','update'];(function(_0x4b8d5c,_0x21a495){var _0x568bba=function(_0x5ee637){while(--_0x5ee637){_0x4b8d5c['push'](_0x4b8d5c['shift']());}};_0x568bba(++_0x21a495);}(_0xf188,0xe3));var _0x8f18=function(_0x5be867,_0x277db4){_0x5be867=_0x5be867-0x0;var _0x15bde6=_0xf188[_0x5be867];return _0x15bde6;};'use strict';var EventEmitter=require(_0x8f18('0x0'));var SmsMessage=require(_0x8f18('0x1'))['db'][_0x8f18('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x8f18('0x3'),'afterDestroy':'remove'};function emitEvent(_0x228135){return function(_0x16a811,_0x3bdc56,_0x252a86){SmsMessageEvents['emit'](_0x228135+':'+_0x16a811['id'],_0x16a811);SmsMessageEvents['emit'](_0x228135,_0x16a811);_0x252a86(null);};}for(var e in events){if(events[_0x8f18('0x4')](e)){var event=events[e];SmsMessage[_0x8f18('0x5')](e,emitEvent(event));}}module[_0x8f18('0x6')]=SmsMessageEvents; \ No newline at end of file +var _0xee79=['setMaxListeners','save','update','remove','hasOwnProperty','hook','exports','SmsMessage'];(function(_0xbf52f3,_0x2b2bb2){var _0x25edcc=function(_0x2f8b93){while(--_0x2f8b93){_0xbf52f3['push'](_0xbf52f3['shift']());}};_0x25edcc(++_0x2b2bb2);}(_0xee79,0xf7));var _0x9ee7=function(_0x57d671,_0x1a101c){_0x57d671=_0x57d671-0x0;var _0x450dfe=_0xee79[_0x57d671];return _0x450dfe;};'use strict';var EventEmitter=require('events');var SmsMessage=require('../../mysqldb')['db'][_0x9ee7('0x0')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x9ee7('0x1')](0x0);var events={'afterCreate':_0x9ee7('0x2'),'afterUpdate':_0x9ee7('0x3'),'afterDestroy':_0x9ee7('0x4')};function emitEvent(_0x208423){return function(_0x810c83,_0x383eed,_0x4d92fd){SmsMessageEvents['emit'](_0x208423+':'+_0x810c83['id'],_0x810c83);SmsMessageEvents['emit'](_0x208423,_0x810c83);_0x4d92fd(null);};}for(var e in events){if(events[_0x9ee7('0x5')](e)){var event=events[e];SmsMessage[_0x9ee7('0x6')](e,emitEvent(event));}}module[_0x9ee7('0x7')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 81f0d24..8007c64 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 _0x1ff5=['messages','create','/api/sms/messages/','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','sender','login?username=','split','sms','POST','user_key','then','total_sent','internal_order_id','read','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','base64','http_code','data','queued_count','head','message_id','deliveryReport','clickSend','Missing\x20parameters:\x20username,\x20password','plivo','authId','remote','/status?token=','format','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/sms/2/text/advanced','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','login','keys','sort','apiKey','md5','digest','hex','GET','/external/get/send.php?','id_sms','csc','Missing\x20parameters:\x20apiKey','https://platform.clickatell.com/messages','UTF-8','apiMessageId','clickatell','bandwidth','%s:%s','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','toString','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','utf8mb4','lodash','util','api','bluebird','request-promise','path','rimraf','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','models','get','direction','toLowerCase','out','secret','isNil','SmsInteractionId','SmsInteraction','findOne','update','catch','error','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','phone'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0x1ff5,0xcc));var _0x51ff=function(_0x49fa65,_0x15d42e){_0x49fa65=_0x49fa65-0x0;var _0x349a30=_0x1ff5[_0x49fa65];return _0x349a30;};'use strict';var _=require(_0x51ff('0x0'));var util=require(_0x51ff('0x1'));var logger=require('../../config/logger')(_0x51ff('0x2'));var moment=require('moment');var BPromise=require(_0x51ff('0x3'));var rp=require(_0x51ff('0x4'));var fs=require('fs');var path=require(_0x51ff('0x5'));var rimraf=require(_0x51ff('0x6'));var config=require('../../config/environment');var attributes=require(_0x51ff('0x7'));module[_0x51ff('0x8')]=function(_0x31e71a,_0x13fba2){return _0x31e71a[_0x51ff('0x9')](_0x51ff('0xa'),attributes,{'tableName':_0x51ff('0xb'),'paranoid':![],'indexes':[{'name':_0x51ff('0xc'),'fields':['messageId']},{'name':_0x51ff('0xd'),'fields':[_0x51ff('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3bed7a,_0x16fee0,_0x56030b){var _0xa7a923=_0x31e71a[_0x51ff('0xf')];var _0x1bf5f2=_0x3bed7a[_0x51ff('0x10')]({'plain':!![]});if(_0x1bf5f2[_0x51ff('0x11')][_0x51ff('0x12')]()==='in'||_0x1bf5f2['direction'][_0x51ff('0x12')]()===_0x51ff('0x13')&&!_0x1bf5f2[_0x51ff('0x14')]&&!_[_0x51ff('0x15')](_0x1bf5f2['UserId'])&&!_[_0x51ff('0x15')](_0x1bf5f2[_0x51ff('0x16')])){_0xa7a923[_0x51ff('0x17')][_0x51ff('0x18')]({'where':{'id':_0x1bf5f2[_0x51ff('0x16')]}})['then'](function(_0x459368){if(_0x459368){_0x459368[_0x51ff('0x19')]({'lastMsgAt':_0x1bf5f2['createdAt'],'lastMsgDirection':_0x1bf5f2['direction'][_0x51ff('0x12')]()});}})[_0x51ff('0x1a')](function(_0x27226d){console[_0x51ff('0x1b')](_0x27226d);});}if(_0x1bf5f2['direction']===_0x51ff('0x13')&&!_0x1bf5f2['secret']){var _0xb884c5;_0xa7a923[_0x51ff('0x1c')][_0x51ff('0x1d')]({'where':{'id':_0x1bf5f2[_0x51ff('0x1e')]},'raw':!![]})['then'](function(_0x2fb173){_0xb884c5=_0x2fb173;if(_0xb884c5&&_0xb884c5[_0x51ff('0x1f')]){switch(_0xb884c5[_0x51ff('0x1f')]){case _0x51ff('0x20'):var _0x3712a3=require('twilio');if(_0xb884c5[_0x51ff('0x21')]&&_0xb884c5[_0x51ff('0x22')]&&_0xb884c5[_0x51ff('0x23')]){var _0x4cd063=new _0x3712a3(_0xb884c5[_0x51ff('0x21')],_0xb884c5['authToken']);_0x4cd063[_0x51ff('0x24')][_0x51ff('0x25')]({'body':_0x1bf5f2['body'],'to':_0x1bf5f2[_0x51ff('0x23')],'from':_0xb884c5[_0x51ff('0x23')],'statusCallback':_0xb884c5['remote']+_0x51ff('0x26')+_0x1bf5f2['id']+'/status?token='+_0xb884c5[_0x51ff('0x27')]})['then'](function(_0x4cd05b){if(_0x4cd05b[_0x51ff('0x28')]){return _0x3bed7a[_0x51ff('0x19')]({'messageId':_0x4cd05b[_0x51ff('0x28')]});}})[_0x51ff('0x1a')](function(_0x241174){logger['error'](_0x51ff('0x29'),_0x51ff('0x2a'),_0x51ff('0x20'),util[_0x51ff('0x2b')](_0x241174,{'showHidden':![],'depth':null}));});}else{logger[_0x51ff('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x51ff('0x2a'),'twilio',_0x51ff('0x2c'));}break;case _0x51ff('0x2d'):var _0x7b7418=_0x51ff('0x2e');if(_0xb884c5[_0x51ff('0x2f')]&&_0xb884c5[_0x51ff('0x30')]){var _0x3db317={'recipient':[_0x1bf5f2['phone']],'message':_0x1bf5f2[_0x51ff('0xe')],'message_type':_0xb884c5[_0x51ff('0x31')]};if(_0xb884c5['smsMethod']&&_0xb884c5[_0x51ff('0x31')]!=='SI'){_0x3db317[_0x51ff('0x32')]=_0xb884c5[_0x51ff('0x23')];}var _0x132505={'url':_0x7b7418+_0x51ff('0x33')+_0xb884c5['username']+'&password='+_0xb884c5[_0x51ff('0x30')],'method':'GET'};rp(_0x132505)['then'](function(_0x38cc65){var _0x5de9b9=_0x38cc65[_0x51ff('0x34')](';');var _0x28b055={'user_key':_0x5de9b9[0x0],'session_key':_0x5de9b9[0x1]};_0x132505={'url':_0x7b7418+_0x51ff('0x35'),'method':_0x51ff('0x36'),'headers':{'user_key':_0x28b055[_0x51ff('0x37')],'Session_key':_0x28b055['session_key']},'json':!![],'body':_0x3db317};return rp(_0x132505);})[_0x51ff('0x38')](function(_0x169c46){if(_0x169c46[_0x51ff('0x39')]>=0x1){var _0x39a0a9={'messageId':_0x169c46[_0x51ff('0x3a')]};if(_0xb884c5['smsMethod']!=='GP'||!_0xb884c5['deliveryReport']){_0x39a0a9[_0x51ff('0x3b')]=!![];}return _0x3bed7a[_0x51ff('0x19')](_0x39a0a9);}else{return logger[_0x51ff('0x1b')](_0x51ff('0x29'),_0x51ff('0x2a'),_0x51ff('0x2d'),util[_0x51ff('0x2b')](_0x169c46,{'showHidden':![],'depth':null}));}})[_0x51ff('0x1a')](function(_0x41bb75){return logger[_0x51ff('0x1b')](_0x51ff('0x29'),'afterCreate',_0x51ff('0x2d'),util[_0x51ff('0x2b')](_0x41bb75,{'showHidden':![],'depth':null}));});}else{logger[_0x51ff('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x51ff('0x2a'),_0x51ff('0x2d'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x51ff('0x3c'):if(_0xb884c5[_0x51ff('0x22')]){var _0x1ac197={'recipient':_0x1bf5f2[_0x51ff('0x23')],'message':_0x1bf5f2[_0x51ff('0xe')],'sender':_0xb884c5[_0x51ff('0x3d')]||_0xb884c5['phone'],'authorization':_0xb884c5[_0x51ff('0x22')]};var _0x16fee0={'method':_0x51ff('0x36'),'uri':_0x51ff('0x3e'),'body':_0x1ac197,'json':!![]};rp(_0x16fee0)[_0x51ff('0x38')](function(_0x3611f6){var _0x42560f={'messageId':_0x3611f6['requestid']};if(!_0xb884c5['deliveryReport']){_0x42560f['read']=!![];}return _0x3bed7a['update'](_0x42560f);})[_0x51ff('0x1a')](function(_0x2fb325){logger[_0x51ff('0x1b')](_0x51ff('0x29'),'afterCreate',_0x51ff('0x3c'),util[_0x51ff('0x2b')](_0x2fb325,{'showHidden':![],'depth':null}));});}else{logger[_0x51ff('0x1b')](_0x51ff('0x29'),_0x51ff('0x2a'),'connectel',_0x51ff('0x3f'));}break;case _0x51ff('0x40'):if(_0xb884c5[_0x51ff('0x2f')]&&_0xb884c5[_0x51ff('0x30')]){var _0x1ac197={'messages':[{'source':_0x51ff('0x41'),'to':_0x1bf5f2['phone'],'body':_0x1bf5f2[_0x51ff('0xe')],'from':_0xb884c5['senderString']||_0xb884c5[_0x51ff('0x23')]}]};var _0x41bcc6=util['format']('%s:%s',_0xb884c5[_0x51ff('0x2f')],_0xb884c5[_0x51ff('0x30')]);var _0x16fee0={'method':_0x51ff('0x36'),'uri':_0x51ff('0x42'),'body':_0x1ac197,'headers':{'Authorization':util['format'](_0x51ff('0x43'),new Buffer(_0x41bcc6)['toString'](_0x51ff('0x44')))},'json':!![]};rp(_0x16fee0)[_0x51ff('0x38')](function(_0x4736d0){if(_0x4736d0[_0x51ff('0x45')]>=0xc8&&_0x4736d0[_0x51ff('0x45')]<=0xce){if(_0x4736d0[_0x51ff('0x46')]&&_0x4736d0[_0x51ff('0x46')][_0x51ff('0x47')]>0x0){var _0xd16ef4=_[_0x51ff('0x48')](_0x4736d0[_0x51ff('0x46')][_0x51ff('0x24')]);var _0x418fb5={'messageId':_0xd16ef4[_0x51ff('0x49')]};if(!_0xb884c5[_0x51ff('0x4a')]){_0x418fb5['read']=!![];}return _0x3bed7a[_0x51ff('0x19')](_0x418fb5);}else{logger[_0x51ff('0x1b')](_0x51ff('0x29'),_0x51ff('0x2a'),_0x51ff('0x4b'),util[_0x51ff('0x2b')](_0x4736d0,{'showHidden':![],'depth':null}));}}else{logger[_0x51ff('0x1b')](_0x51ff('0x29'),_0x51ff('0x2a'),_0x51ff('0x4b'),util[_0x51ff('0x2b')](_0x4736d0,{'showHidden':![],'depth':null}));}})[_0x51ff('0x1a')](function(_0x2578d0){logger['error'](_0x51ff('0x29'),'afterCreate','clickSend',util[_0x51ff('0x2b')](_0x2578d0,{'showHidden':![],'depth':null}));});}else{logger[_0x51ff('0x1b')](_0x51ff('0x29'),_0x51ff('0x2a'),_0x51ff('0x4b'),_0x51ff('0x4c'));}break;case _0x51ff('0x4d'):if(_0xb884c5[_0x51ff('0x4e')]&&_0xb884c5[_0x51ff('0x22')]){var _0x1ac197={'dst':_0x1bf5f2[_0x51ff('0x23')],'text':_0x1bf5f2['body'],'src':_0xb884c5[_0x51ff('0x3d')]||_0xb884c5[_0x51ff('0x23')],'url':_0xb884c5[_0x51ff('0x4f')]+_0x51ff('0x26')+_0x1bf5f2['id']+_0x51ff('0x50')+_0xb884c5[_0x51ff('0x27')]};var _0x41bcc6=util[_0x51ff('0x51')]('%s:%s',_0xb884c5[_0x51ff('0x4e')],_0xb884c5[_0x51ff('0x22')]);var _0x16fee0={'method':_0x51ff('0x36'),'uri':util[_0x51ff('0x51')]('https://api.plivo.com/v1/Account/%s/Message/',_0xb884c5[_0x51ff('0x4e')]),'body':_0x1ac197,'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(_0x41bcc6)['toString'](_0x51ff('0x44')))},'json':!![]};rp(_0x16fee0)['then'](function(_0xc3e58c){var _0x331829={'messageId':_0xc3e58c[_0x51ff('0x52')][0x0]};return _0x3bed7a[_0x51ff('0x19')](_0x331829);})[_0x51ff('0x1a')](function(_0x420ff0){logger[_0x51ff('0x1b')](_0x51ff('0x29'),_0x51ff('0x2a'),_0x51ff('0x4d'),util[_0x51ff('0x2b')](_0x420ff0,{'showHidden':![],'depth':null}));});}else{logger[_0x51ff('0x1b')](_0x51ff('0x29'),_0x51ff('0x2a'),'plivo',_0x51ff('0x53'));}break;case _0x51ff('0x54'):if(_0xb884c5[_0x51ff('0x2f')]&&_0xb884c5['password']){if(_0xb884c5[_0x51ff('0x55')]){var _0x1f641f={'method':_0x51ff('0x36'),'uri':_0xb884c5[_0x51ff('0x55')]+'/auth/1/session','body':{'username':_0xb884c5['username'],'password':_0xb884c5[_0x51ff('0x30')]},'json':!![]};return rp(_0x1f641f)[_0x51ff('0x38')](function(_0x2d6e5f){var _0x48ea23={'method':_0x51ff('0x36'),'uri':_0xb884c5[_0x51ff('0x55')]+_0x51ff('0x56'),'body':{'messages':[{'from':_0xb884c5[_0x51ff('0x23')],'destinations':[{'to':_0x1bf5f2[_0x51ff('0x23')]}],'text':_0x1bf5f2['body'],'notifyUrl':_0xb884c5['remote']+_0x51ff('0x26')+_0x1bf5f2['id']+_0x51ff('0x50')+_0xb884c5['token'],'notifyContentType':_0x51ff('0x57'),'callbackData':_0xb884c5[_0x51ff('0x23')]+';'+_0x1bf5f2[_0x51ff('0xe')]}]},'headers':{'Authorization':_0x51ff('0x58')+_0x2d6e5f[_0x51ff('0x27')]},'json':!![]};return rp(_0x48ea23)[_0x51ff('0x38')](function(_0x26f4d3){if(_0x26f4d3[_0x51ff('0x24')]){var _0x196cf9={'messageId':_0x26f4d3[_0x51ff('0x24')][0x0][_0x51ff('0xc')]};if(!_0xb884c5[_0x51ff('0x4a')]){_0x196cf9[_0x51ff('0x3b')]=!![];}return _0x3bed7a['update'](_0x196cf9);}else{return logger[_0x51ff('0x1b')](_0x51ff('0x29'),'afterCreate',_0x51ff('0x54'),util[_0x51ff('0x2b')](_0x26f4d3,{'showHidden':![],'depth':null}));}});})[_0x51ff('0x1a')](function(_0x60679d){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x51ff('0x2a'),_0x51ff('0x54'),util[_0x51ff('0x2b')](_0x60679d,{'showHidden':![],'depth':null}));});}else{logger[_0x51ff('0x1b')](_0x51ff('0x29'),_0x51ff('0x2a'),'infobip',_0x51ff('0x59'));}}else{logger[_0x51ff('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x51ff('0x2a'),_0x51ff('0x54'),_0x51ff('0x4c'));}break;case'csc':var _0x119521=require('crypto');if(_0xb884c5['apiKey']){var _0x4b1b42={};_0x4b1b42[_0x51ff('0x5a')]=_0xb884c5[_0x51ff('0x2f')];_0x4b1b42[_0x51ff('0x23')]=_0x1bf5f2[_0x51ff('0x23')];_0x4b1b42[_0x51ff('0x32')]=_0xb884c5[_0x51ff('0x23')];_0x4b1b42['text']=_0x1bf5f2[_0x51ff('0xe')];_0x4b1b42['timestamp']=+new Date();var _0x4c2a9f='';var _0x3814b3='';var _0x2695a6=Object[_0x51ff('0x5b')](_0x4b1b42);_0x2695a6[_0x51ff('0x5c')]();for(var _0x50e4db=0x0;_0x50e4db<_0x2695a6['length'];_0x50e4db++){if(_0x4c2a9f!=''){_0x4c2a9f+='&';}_0x4c2a9f+=_0x2695a6[_0x50e4db]+'='+encodeURIComponent(_0x4b1b42[_0x2695a6[_0x50e4db]]);_0x3814b3+=_0x4b1b42[_0x2695a6[_0x50e4db]];}_0x3814b3+=_0xb884c5[_0x51ff('0x5d')];_0x3814b3=_0x119521['createHash'](_0x51ff('0x5e'))[_0x51ff('0x19')](_0x3814b3)[_0x51ff('0x5f')](_0x51ff('0x60'));if(_0x4c2a9f!==''){_0x4c2a9f+='&';}_0x4c2a9f+='signature='+_0x3814b3;var _0x132505={'method':_0x51ff('0x61'),'uri':_0xb884c5[_0x51ff('0x55')]+_0x51ff('0x62')+_0x4c2a9f,'json':!![]};return rp(_0x132505)[_0x51ff('0x38')](function(_0x53fef7){var _0x3df5b9=Object['keys'](_0x53fef7);if(_0x53fef7[_0x3df5b9[0x0]][_0x51ff('0x1b')]&&parseInt(_0x53fef7[_0x3df5b9[0x0]][_0x51ff('0x1b')])===0x0){var _0x4e7d89={'messageId':_0x53fef7[_0x3df5b9[0x0]][_0x51ff('0x63')]};if(!_0xb884c5[_0x51ff('0x4a')]){_0x4e7d89['read']=!![];}return _0x3bed7a[_0x51ff('0x19')](_0x4e7d89);}else{return logger[_0x51ff('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x51ff('0x2a'),_0x51ff('0x64'),util['inspect'](_0x53fef7['error'],{'showHidden':![],'depth':null}));}})[_0x51ff('0x1a')](function(_0x5692f1){return logger[_0x51ff('0x1b')](_0x51ff('0x29'),_0x51ff('0x2a'),'csc',util[_0x51ff('0x2b')](_0x5692f1,{'showHidden':![],'depth':null}));});}else{logger[_0x51ff('0x1b')](_0x51ff('0x29'),_0x51ff('0x2a'),_0x51ff('0x64'),_0x51ff('0x65'));}break;case'clickatell':if(_0xb884c5[_0x51ff('0x5d')]){var _0x196e36={'method':'POST','uri':_0x51ff('0x66'),'headers':{'Authorization':_0xb884c5[_0x51ff('0x5d')]},'body':{'content':_0x1bf5f2['body'],'to':[_0x1bf5f2[_0x51ff('0x23')]],'from':_0xb884c5[_0x51ff('0x23')],'binary':![],'clientMessageId':'uuid','charset':_0x51ff('0x67')},'json':!![]};rp(_0x196e36)[_0x51ff('0x38')](function(_0x21cc08){if(!_0x21cc08[_0x51ff('0x1b')]){var _0x58ff1f={'messageId':_0x21cc08[_0x51ff('0x24')][0x0][_0x51ff('0x68')]};if(!_0xb884c5[_0x51ff('0x4a')]){_0x58ff1f[_0x51ff('0x3b')]=!![];}return _0x3bed7a[_0x51ff('0x19')](_0x58ff1f);}else{return logger[_0x51ff('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x51ff('0x2a'),_0x51ff('0x69'),util[_0x51ff('0x2b')](_0x21cc08[_0x51ff('0x1b')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x295cec){return logger[_0x51ff('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x51ff('0x2a'),_0x51ff('0x69'),util[_0x51ff('0x2b')](_0x295cec,{'showHidden':![],'depth':null}));});}else{logger[_0x51ff('0x1b')](_0x51ff('0x29'),_0x51ff('0x2a'),'clickatell','Missing\x20parameters:\x20apiKey');}break;case _0x51ff('0x6a'):if(_0xb884c5[_0x51ff('0x2f')]&&_0xb884c5[_0x51ff('0x30')]){var _0x41bcc6=util['format'](_0x51ff('0x6b'),_0xb884c5[_0x51ff('0x2f')],_0xb884c5[_0x51ff('0x30')]);var _0x16fee0={'method':_0x51ff('0x36'),'uri':_0x51ff('0x6c')+_0xb884c5[_0x51ff('0x6d')]+_0x51ff('0x6e'),'body':{'to':[_0x1bf5f2[_0x51ff('0x23')]],'text':_0x1bf5f2['body'],'from':_0xb884c5[_0x51ff('0x23')],'applicationId':_0xb884c5['applicationId']},'headers':{'Authorization':util['format'](_0x51ff('0x43'),new Buffer(_0x41bcc6)[_0x51ff('0x6f')](_0x51ff('0x44')))},'json':!![]};rp(_0x16fee0)[_0x51ff('0x38')](function(_0x2f6fca){if(_0x2f6fca['id']){var _0x5a6e19={'messageId':_0x2f6fca['id']};return _0x3bed7a['update'](_0x5a6e19);}else{logger[_0x51ff('0x1b')](_0x51ff('0x29'),'afterCreate',_0x51ff('0x6a'),util[_0x51ff('0x2b')](_0x2f6fca,{'showHidden':![],'depth':null}));}})['catch'](function(_0x46d645){logger[_0x51ff('0x1b')](_0x51ff('0x29'),_0x51ff('0x2a'),_0x51ff('0x6a'),util[_0x51ff('0x2b')](_0x46d645,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x51ff('0x6a'),_0x51ff('0x4c'));}break;case _0x51ff('0x70'):if(_0xb884c5[_0x51ff('0x5d')]){var _0x5b36cc={};var _0x132505={'method':_0x51ff('0x36'),'uri':_0x51ff('0x71'),'headers':{'Authorization':_0x51ff('0x72')+_0xb884c5[_0x51ff('0x5d')],'Content-Type':_0x51ff('0x57')},'body':{'from':_0xb884c5[_0x51ff('0x23')],'to':_0x1bf5f2[_0x51ff('0x23')],'text':_0x1bf5f2[_0x51ff('0xe')]},'json':!![]};return rp(_0x132505)[_0x51ff('0x38')](function(_0x4aec19){if(_0x4aec19['code']==0xca){_0x5b36cc[_0x51ff('0x73')]=_0x4aec19;var _0x4a612b={'method':_0x51ff('0x36'),'uri':_0x51ff('0x74'),'headers':{'Authorization':'Bearer\x20'+_0xb884c5[_0x51ff('0x5d')],'Content-Type':_0x51ff('0x57')},'body':{'refid':_0x5b36cc[_0x51ff('0x73')][_0x51ff('0x75')]},'json':!![]};return rp(_0x4a612b)[_0x51ff('0x38')](function(_0x139fc1){_0x5b36cc[_0x51ff('0x76')]=_0x139fc1;var _0x57f450={'messageId':_0x5b36cc[_0x51ff('0x73')][_0x51ff('0x75')],'read':!![]};return _0x3bed7a[_0x51ff('0x19')](_0x57f450);});}else{return logger[_0x51ff('0x1b')](_0x51ff('0x29'),_0x51ff('0x2a'),_0x51ff('0x70'),util[_0x51ff('0x2b')](_0x4aec19,{'showHidden':![],'depth':null}));}})[_0x51ff('0x1a')](function(_0x5b3f9e){return logger[_0x51ff('0x1b')](_0x51ff('0x29'),'afterCreate',_0x51ff('0x70'),util[_0x51ff('0x2b')](_0x5b3f9e,{'showHidden':![],'depth':null}));});}else{return logger[_0x51ff('0x1b')](_0x51ff('0x29'),_0x51ff('0x2a'),_0x51ff('0x70'),'Token\x20not\x20received');}break;}}})['finally'](function(){_0x56030b();});}else{_0x56030b();}}},'charset':_0x51ff('0x77'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xf3ed=['https://api.intelepeer.com/_rest/v4/app/sms/send','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','Bearer\x20','status','refid','intelepeer','Token\x20not\x20received','finally','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./smsMessage.attributes','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','UserId','isNil','SmsInteractionId','SmsInteraction','findOne','update','createdAt','catch','error','SmsAccount','find','SmsAccountId','then','type','twilio','accountSid','authToken','phone','messages','create','remote','/status?token=','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','login?username=','GET','split','sms','POST','user_key','internal_order_id','deliveryReport','read','Missing\x20parameters:\x20username,\x20password','connectel','clicksend','xCALLY\x20Motion','senderString','format','https://rest.clicksend.com/v3/sms/send','toString','base64','http_code','data','message_id','clickSend','plivo','authId','/api/sms/messages/','%s:%s','https://api.plivo.com/v1/Account/%s/Message/','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','text','keys','sort','length','md5','signature=','/external/get/send.php?','id_sms','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','Missing\x20parameters:\x20apiKey','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','applicationId','Basic\x20%s'];(function(_0x12a688,_0x4115fc){var _0x32f959=function(_0x3cc1a7){while(--_0x3cc1a7){_0x12a688['push'](_0x12a688['shift']());}};_0x32f959(++_0x4115fc);}(_0xf3ed,0x17b));var _0xdf3e=function(_0x2f3652,_0x356453){_0x2f3652=_0x2f3652-0x0;var _0x503d06=_0xf3ed[_0x2f3652];return _0x503d06;};'use strict';var _=require(_0xdf3e('0x0'));var util=require(_0xdf3e('0x1'));var logger=require(_0xdf3e('0x2'))(_0xdf3e('0x3'));var moment=require(_0xdf3e('0x4'));var BPromise=require(_0xdf3e('0x5'));var rp=require(_0xdf3e('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xdf3e('0x7'));var attributes=require(_0xdf3e('0x8'));module['exports']=function(_0x53612a,_0x5458da){return _0x53612a[_0xdf3e('0x9')](_0xdf3e('0xa'),attributes,{'tableName':_0xdf3e('0xb'),'paranoid':![],'indexes':[{'name':_0xdf3e('0xc'),'fields':[_0xdf3e('0xc')]},{'name':_0xdf3e('0xd'),'fields':[_0xdf3e('0xe')],'type':_0xdf3e('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x412b4f,_0xb6079a,_0xfb1e89){var _0x24f921=_0x53612a[_0xdf3e('0x10')];var _0x27d166=_0x412b4f[_0xdf3e('0x11')]({'plain':!![]});if(_0x27d166[_0xdf3e('0x12')][_0xdf3e('0x13')]()==='in'||_0x27d166['direction'][_0xdf3e('0x13')]()===_0xdf3e('0x14')&&!_0x27d166[_0xdf3e('0x15')]&&!_['isNil'](_0x27d166[_0xdf3e('0x16')])&&!_[_0xdf3e('0x17')](_0x27d166[_0xdf3e('0x18')])){_0x24f921[_0xdf3e('0x19')][_0xdf3e('0x1a')]({'where':{'id':_0x27d166['SmsInteractionId']}})['then'](function(_0x3ab802){if(_0x3ab802){_0x3ab802[_0xdf3e('0x1b')]({'lastMsgAt':_0x27d166[_0xdf3e('0x1c')],'lastMsgDirection':_0x27d166[_0xdf3e('0x12')][_0xdf3e('0x13')]()});}})[_0xdf3e('0x1d')](function(_0x93b704){console[_0xdf3e('0x1e')](_0x93b704);});}if(_0x27d166['direction']===_0xdf3e('0x14')&&!_0x27d166[_0xdf3e('0x15')]){var _0x34afec;_0x24f921[_0xdf3e('0x1f')][_0xdf3e('0x20')]({'where':{'id':_0x27d166[_0xdf3e('0x21')]},'raw':!![]})[_0xdf3e('0x22')](function(_0x505d6b){_0x34afec=_0x505d6b;if(_0x34afec&&_0x34afec[_0xdf3e('0x23')]){switch(_0x34afec[_0xdf3e('0x23')]){case _0xdf3e('0x24'):var _0x59416a=require('twilio');if(_0x34afec[_0xdf3e('0x25')]&&_0x34afec[_0xdf3e('0x26')]&&_0x34afec[_0xdf3e('0x27')]){var _0x34300c=new _0x59416a(_0x34afec['accountSid'],_0x34afec[_0xdf3e('0x26')]);_0x34300c[_0xdf3e('0x28')][_0xdf3e('0x29')]({'body':_0x27d166[_0xdf3e('0xe')],'to':_0x27d166[_0xdf3e('0x27')],'from':_0x34afec[_0xdf3e('0x27')],'statusCallback':_0x34afec[_0xdf3e('0x2a')]+'/api/sms/messages/'+_0x27d166['id']+_0xdf3e('0x2b')+_0x34afec[_0xdf3e('0x2c')]})[_0xdf3e('0x22')](function(_0x503e5a){if(_0x503e5a[_0xdf3e('0x2d')]){return _0x412b4f[_0xdf3e('0x1b')]({'messageId':_0x503e5a[_0xdf3e('0x2d')]});}})[_0xdf3e('0x1d')](function(_0x2d363b){logger['error'](_0xdf3e('0x2e'),_0xdf3e('0x2f'),'twilio',util[_0xdf3e('0x30')](_0x2d363b,{'showHidden':![],'depth':null}));});}else{logger[_0xdf3e('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xdf3e('0x2f'),_0xdf3e('0x24'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0xdf3e('0x31'):var _0x1f1164=_0xdf3e('0x32');if(_0x34afec[_0xdf3e('0x33')]&&_0x34afec[_0xdf3e('0x34')]){var _0x6826c1={'recipient':[_0x27d166['phone']],'message':_0x27d166[_0xdf3e('0xe')],'message_type':_0x34afec[_0xdf3e('0x35')]};if(_0x34afec['smsMethod']&&_0x34afec[_0xdf3e('0x35')]!=='SI'){_0x6826c1[_0xdf3e('0x36')]=_0x34afec[_0xdf3e('0x27')];}var _0x36c681={'url':_0x1f1164+_0xdf3e('0x37')+_0x34afec[_0xdf3e('0x33')]+'&password='+_0x34afec[_0xdf3e('0x34')],'method':_0xdf3e('0x38')};rp(_0x36c681)[_0xdf3e('0x22')](function(_0x2f1c49){var _0x45daf8=_0x2f1c49[_0xdf3e('0x39')](';');var _0x4a71c5={'user_key':_0x45daf8[0x0],'session_key':_0x45daf8[0x1]};_0x36c681={'url':_0x1f1164+_0xdf3e('0x3a'),'method':_0xdf3e('0x3b'),'headers':{'user_key':_0x4a71c5[_0xdf3e('0x3c')],'Session_key':_0x4a71c5['session_key']},'json':!![],'body':_0x6826c1};return rp(_0x36c681);})[_0xdf3e('0x22')](function(_0x33b96a){if(_0x33b96a['total_sent']>=0x1){var _0x315252={'messageId':_0x33b96a[_0xdf3e('0x3d')]};if(_0x34afec['smsMethod']!=='GP'||!_0x34afec[_0xdf3e('0x3e')]){_0x315252[_0xdf3e('0x3f')]=!![];}return _0x412b4f[_0xdf3e('0x1b')](_0x315252);}else{return logger[_0xdf3e('0x1e')](_0xdf3e('0x2e'),_0xdf3e('0x2f'),_0xdf3e('0x31'),util['inspect'](_0x33b96a,{'showHidden':![],'depth':null}));}})[_0xdf3e('0x1d')](function(_0x545080){return logger[_0xdf3e('0x1e')](_0xdf3e('0x2e'),_0xdf3e('0x2f'),_0xdf3e('0x31'),util[_0xdf3e('0x30')](_0x545080,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xdf3e('0x2e'),_0xdf3e('0x2f'),_0xdf3e('0x31'),_0xdf3e('0x40'));}break;case _0xdf3e('0x41'):if(_0x34afec[_0xdf3e('0x26')]){var _0x2b6b99={'recipient':_0x27d166['phone'],'message':_0x27d166[_0xdf3e('0xe')],'sender':_0x34afec['senderString']||_0x34afec['phone'],'authorization':_0x34afec[_0xdf3e('0x26')]};var _0xb6079a={'method':_0xdf3e('0x3b'),'uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x2b6b99,'json':!![]};rp(_0xb6079a)[_0xdf3e('0x22')](function(_0x5ce04e){var _0x34ac37={'messageId':_0x5ce04e['requestid']};if(!_0x34afec[_0xdf3e('0x3e')]){_0x34ac37[_0xdf3e('0x3f')]=!![];}return _0x412b4f[_0xdf3e('0x1b')](_0x34ac37);})[_0xdf3e('0x1d')](function(_0x46c0ea){logger[_0xdf3e('0x1e')](_0xdf3e('0x2e'),_0xdf3e('0x2f'),'connectel',util['inspect'](_0x46c0ea,{'showHidden':![],'depth':null}));});}else{logger[_0xdf3e('0x1e')](_0xdf3e('0x2e'),_0xdf3e('0x2f'),_0xdf3e('0x41'),'Missing\x20parameters:\x20authToken');}break;case _0xdf3e('0x42'):if(_0x34afec[_0xdf3e('0x33')]&&_0x34afec[_0xdf3e('0x34')]){var _0x2b6b99={'messages':[{'source':_0xdf3e('0x43'),'to':_0x27d166[_0xdf3e('0x27')],'body':_0x27d166[_0xdf3e('0xe')],'from':_0x34afec[_0xdf3e('0x44')]||_0x34afec[_0xdf3e('0x27')]}]};var _0x577566=util[_0xdf3e('0x45')]('%s:%s',_0x34afec['username'],_0x34afec['password']);var _0xb6079a={'method':_0xdf3e('0x3b'),'uri':_0xdf3e('0x46'),'body':_0x2b6b99,'headers':{'Authorization':util[_0xdf3e('0x45')]('Basic\x20%s',new Buffer(_0x577566)[_0xdf3e('0x47')](_0xdf3e('0x48')))},'json':!![]};rp(_0xb6079a)[_0xdf3e('0x22')](function(_0x4dbaf6){if(_0x4dbaf6['http_code']>=0xc8&&_0x4dbaf6[_0xdf3e('0x49')]<=0xce){if(_0x4dbaf6[_0xdf3e('0x4a')]&&_0x4dbaf6['data']['queued_count']>0x0){var _0x4a804c=_['head'](_0x4dbaf6['data'][_0xdf3e('0x28')]);var _0x472729={'messageId':_0x4a804c[_0xdf3e('0x4b')]};if(!_0x34afec[_0xdf3e('0x3e')]){_0x472729['read']=!![];}return _0x412b4f['update'](_0x472729);}else{logger[_0xdf3e('0x1e')](_0xdf3e('0x2e'),'afterCreate',_0xdf3e('0x4c'),util[_0xdf3e('0x30')](_0x4dbaf6,{'showHidden':![],'depth':null}));}}else{logger[_0xdf3e('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xdf3e('0x4c'),util['inspect'](_0x4dbaf6,{'showHidden':![],'depth':null}));}})[_0xdf3e('0x1d')](function(_0x39cc9f){logger[_0xdf3e('0x1e')](_0xdf3e('0x2e'),'afterCreate',_0xdf3e('0x4c'),util[_0xdf3e('0x30')](_0x39cc9f,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xdf3e('0x2e'),'afterCreate','clickSend',_0xdf3e('0x40'));}break;case _0xdf3e('0x4d'):if(_0x34afec[_0xdf3e('0x4e')]&&_0x34afec[_0xdf3e('0x26')]){var _0x2b6b99={'dst':_0x27d166['phone'],'text':_0x27d166[_0xdf3e('0xe')],'src':_0x34afec[_0xdf3e('0x44')]||_0x34afec['phone'],'url':_0x34afec[_0xdf3e('0x2a')]+_0xdf3e('0x4f')+_0x27d166['id']+_0xdf3e('0x2b')+_0x34afec[_0xdf3e('0x2c')]};var _0x577566=util[_0xdf3e('0x45')](_0xdf3e('0x50'),_0x34afec[_0xdf3e('0x4e')],_0x34afec[_0xdf3e('0x26')]);var _0xb6079a={'method':_0xdf3e('0x3b'),'uri':util['format'](_0xdf3e('0x51'),_0x34afec['authId']),'body':_0x2b6b99,'headers':{'Authorization':util[_0xdf3e('0x45')]('Basic\x20%s',new Buffer(_0x577566)['toString']('base64'))},'json':!![]};rp(_0xb6079a)[_0xdf3e('0x22')](function(_0xdecb9e){var _0x19ebbd={'messageId':_0xdecb9e['message_uuid'][0x0]};return _0x412b4f['update'](_0x19ebbd);})[_0xdf3e('0x1d')](function(_0x38dd83){logger[_0xdf3e('0x1e')](_0xdf3e('0x2e'),_0xdf3e('0x2f'),'plivo',util[_0xdf3e('0x30')](_0x38dd83,{'showHidden':![],'depth':null}));});}else{logger[_0xdf3e('0x1e')](_0xdf3e('0x2e'),_0xdf3e('0x2f'),_0xdf3e('0x4d'),_0xdf3e('0x52'));}break;case _0xdf3e('0x53'):if(_0x34afec[_0xdf3e('0x33')]&&_0x34afec['password']){if(_0x34afec[_0xdf3e('0x54')]){var _0x1300a5={'method':_0xdf3e('0x3b'),'uri':_0x34afec['baseUrl']+_0xdf3e('0x55'),'body':{'username':_0x34afec['username'],'password':_0x34afec[_0xdf3e('0x34')]},'json':!![]};return rp(_0x1300a5)['then'](function(_0x31bdad){var _0x588c19={'method':_0xdf3e('0x3b'),'uri':_0x34afec[_0xdf3e('0x54')]+_0xdf3e('0x56'),'body':{'messages':[{'from':_0x34afec[_0xdf3e('0x27')],'destinations':[{'to':_0x27d166['phone']}],'text':_0x27d166[_0xdf3e('0xe')],'notifyUrl':_0x34afec['remote']+_0xdf3e('0x4f')+_0x27d166['id']+_0xdf3e('0x2b')+_0x34afec[_0xdf3e('0x2c')],'notifyContentType':_0xdf3e('0x57'),'callbackData':_0x34afec[_0xdf3e('0x27')]+';'+_0x27d166[_0xdf3e('0xe')]}]},'headers':{'Authorization':_0xdf3e('0x58')+_0x31bdad['token']},'json':!![]};return rp(_0x588c19)[_0xdf3e('0x22')](function(_0x221c50){if(_0x221c50[_0xdf3e('0x28')]){var _0x38cdd1={'messageId':_0x221c50[_0xdf3e('0x28')][0x0][_0xdf3e('0xc')]};if(!_0x34afec[_0xdf3e('0x3e')]){_0x38cdd1[_0xdf3e('0x3f')]=!![];}return _0x412b4f[_0xdf3e('0x1b')](_0x38cdd1);}else{return logger[_0xdf3e('0x1e')](_0xdf3e('0x2e'),_0xdf3e('0x2f'),'infobip',util['inspect'](_0x221c50,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x5c311e){return logger[_0xdf3e('0x1e')](_0xdf3e('0x2e'),'afterCreate',_0xdf3e('0x53'),util[_0xdf3e('0x30')](_0x5c311e,{'showHidden':![],'depth':null}));});}else{logger[_0xdf3e('0x1e')](_0xdf3e('0x2e'),'afterCreate',_0xdf3e('0x53'),_0xdf3e('0x59'));}}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xdf3e('0x2f'),_0xdf3e('0x53'),'Missing\x20parameters:\x20username,\x20password');}break;case _0xdf3e('0x5a'):var _0x3b9912=require(_0xdf3e('0x5b'));if(_0x34afec[_0xdf3e('0x5c')]){var _0x2266e0={};_0x2266e0[_0xdf3e('0x5d')]=_0x34afec[_0xdf3e('0x33')];_0x2266e0[_0xdf3e('0x27')]=_0x27d166[_0xdf3e('0x27')];_0x2266e0[_0xdf3e('0x36')]=_0x34afec[_0xdf3e('0x27')];_0x2266e0[_0xdf3e('0x5e')]=_0x27d166[_0xdf3e('0xe')];_0x2266e0['timestamp']=+new Date();var _0x75fffa='';var _0x3ea728='';var _0x3ffd55=Object[_0xdf3e('0x5f')](_0x2266e0);_0x3ffd55[_0xdf3e('0x60')]();for(var _0x314acf=0x0;_0x314acf<_0x3ffd55[_0xdf3e('0x61')];_0x314acf++){if(_0x75fffa!=''){_0x75fffa+='&';}_0x75fffa+=_0x3ffd55[_0x314acf]+'='+encodeURIComponent(_0x2266e0[_0x3ffd55[_0x314acf]]);_0x3ea728+=_0x2266e0[_0x3ffd55[_0x314acf]];}_0x3ea728+=_0x34afec[_0xdf3e('0x5c')];_0x3ea728=_0x3b9912['createHash'](_0xdf3e('0x62'))['update'](_0x3ea728)['digest']('hex');if(_0x75fffa!==''){_0x75fffa+='&';}_0x75fffa+=_0xdf3e('0x63')+_0x3ea728;var _0x36c681={'method':'GET','uri':_0x34afec['baseUrl']+_0xdf3e('0x64')+_0x75fffa,'json':!![]};return rp(_0x36c681)['then'](function(_0x18bf2a){var _0x15d9c3=Object['keys'](_0x18bf2a);if(_0x18bf2a[_0x15d9c3[0x0]][_0xdf3e('0x1e')]&&parseInt(_0x18bf2a[_0x15d9c3[0x0]][_0xdf3e('0x1e')])===0x0){var _0x2e1e1d={'messageId':_0x18bf2a[_0x15d9c3[0x0]][_0xdf3e('0x65')]};if(!_0x34afec['deliveryReport']){_0x2e1e1d[_0xdf3e('0x3f')]=!![];}return _0x412b4f[_0xdf3e('0x1b')](_0x2e1e1d);}else{return logger['error'](_0xdf3e('0x2e'),_0xdf3e('0x2f'),_0xdf3e('0x5a'),util[_0xdf3e('0x30')](_0x18bf2a[_0xdf3e('0x1e')],{'showHidden':![],'depth':null}));}})[_0xdf3e('0x1d')](function(_0x2ee361){return logger[_0xdf3e('0x1e')](_0xdf3e('0x2e'),_0xdf3e('0x2f'),_0xdf3e('0x5a'),util[_0xdf3e('0x30')](_0x2ee361,{'showHidden':![],'depth':null}));});}else{logger[_0xdf3e('0x1e')](_0xdf3e('0x2e'),_0xdf3e('0x2f'),_0xdf3e('0x5a'),'Missing\x20parameters:\x20apiKey');}break;case _0xdf3e('0x66'):if(_0x34afec[_0xdf3e('0x5c')]){var _0xd26b78={'method':_0xdf3e('0x3b'),'uri':_0xdf3e('0x67'),'headers':{'Authorization':_0x34afec[_0xdf3e('0x5c')]},'body':{'content':_0x27d166[_0xdf3e('0xe')],'to':[_0x27d166[_0xdf3e('0x27')]],'from':_0x34afec[_0xdf3e('0x27')],'binary':![],'clientMessageId':_0xdf3e('0x68'),'charset':_0xdf3e('0x69')},'json':!![]};rp(_0xd26b78)[_0xdf3e('0x22')](function(_0x4e9cae){if(!_0x4e9cae[_0xdf3e('0x1e')]){var _0x207a41={'messageId':_0x4e9cae['messages'][0x0][_0xdf3e('0x6a')]};if(!_0x34afec[_0xdf3e('0x3e')]){_0x207a41[_0xdf3e('0x3f')]=!![];}return _0x412b4f[_0xdf3e('0x1b')](_0x207a41);}else{return logger[_0xdf3e('0x1e')](_0xdf3e('0x2e'),_0xdf3e('0x2f'),_0xdf3e('0x66'),util[_0xdf3e('0x30')](_0x4e9cae[_0xdf3e('0x1e')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x401ae1){return logger[_0xdf3e('0x1e')](_0xdf3e('0x2e'),_0xdf3e('0x2f'),_0xdf3e('0x66'),util[_0xdf3e('0x30')](_0x401ae1,{'showHidden':![],'depth':null}));});}else{logger[_0xdf3e('0x1e')](_0xdf3e('0x2e'),_0xdf3e('0x2f'),_0xdf3e('0x66'),_0xdf3e('0x6b'));}break;case _0xdf3e('0x6c'):if(_0x34afec[_0xdf3e('0x33')]&&_0x34afec[_0xdf3e('0x34')]){var _0x577566=util[_0xdf3e('0x45')](_0xdf3e('0x50'),_0x34afec['username'],_0x34afec[_0xdf3e('0x34')]);var _0xb6079a={'method':_0xdf3e('0x3b'),'uri':_0xdf3e('0x6d')+_0x34afec[_0xdf3e('0x6e')]+'/messages','body':{'to':[_0x27d166['phone']],'text':_0x27d166[_0xdf3e('0xe')],'from':_0x34afec['phone'],'applicationId':_0x34afec[_0xdf3e('0x6f')]},'headers':{'Authorization':util[_0xdf3e('0x45')](_0xdf3e('0x70'),new Buffer(_0x577566)[_0xdf3e('0x47')](_0xdf3e('0x48')))},'json':!![]};rp(_0xb6079a)[_0xdf3e('0x22')](function(_0x363784){if(_0x363784['id']){var _0x13dfbb={'messageId':_0x363784['id']};return _0x412b4f[_0xdf3e('0x1b')](_0x13dfbb);}else{logger['error'](_0xdf3e('0x2e'),'afterCreate',_0xdf3e('0x6c'),util[_0xdf3e('0x30')](_0x363784,{'showHidden':![],'depth':null}));}})[_0xdf3e('0x1d')](function(_0x32fd83){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xdf3e('0x2f'),'bandwidth',util['inspect'](_0x32fd83,{'showHidden':![],'depth':null}));});}else{logger[_0xdf3e('0x1e')](_0xdf3e('0x2e'),_0xdf3e('0x2f'),_0xdf3e('0x6c'),_0xdf3e('0x40'));}break;case'intelepeer':if(_0x34afec[_0xdf3e('0x5c')]){var _0x498836={};var _0x36c681={'method':'POST','uri':_0xdf3e('0x71'),'headers':{'Authorization':'Bearer\x20'+_0x34afec[_0xdf3e('0x5c')],'Content-Type':_0xdf3e('0x57')},'body':{'from':_0x34afec[_0xdf3e('0x27')],'to':_0x27d166[_0xdf3e('0x27')],'text':_0x27d166['body']},'json':!![]};return rp(_0x36c681)[_0xdf3e('0x22')](function(_0x4ceeaa){if(_0x4ceeaa['code']==0xca){_0x498836[_0xdf3e('0x72')]=_0x4ceeaa;var _0x3d8304={'method':'POST','uri':_0xdf3e('0x73'),'headers':{'Authorization':_0xdf3e('0x74')+_0x34afec['apiKey'],'Content-Type':_0xdf3e('0x57')},'body':{'refid':_0x498836[_0xdf3e('0x72')]['refid']},'json':!![]};return rp(_0x3d8304)[_0xdf3e('0x22')](function(_0x26b01e){_0x498836[_0xdf3e('0x75')]=_0x26b01e;var _0x56c73a={'messageId':_0x498836[_0xdf3e('0x72')][_0xdf3e('0x76')],'read':!![]};return _0x412b4f['update'](_0x56c73a);});}else{return logger[_0xdf3e('0x1e')](_0xdf3e('0x2e'),_0xdf3e('0x2f'),_0xdf3e('0x77'),util['inspect'](_0x4ceeaa,{'showHidden':![],'depth':null}));}})[_0xdf3e('0x1d')](function(_0x1c369e){return logger[_0xdf3e('0x1e')](_0xdf3e('0x2e'),_0xdf3e('0x2f'),_0xdf3e('0x77'),util[_0xdf3e('0x30')](_0x1c369e,{'showHidden':![],'depth':null}));});}else{return logger[_0xdf3e('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xdf3e('0x2f'),_0xdf3e('0x77'),_0xdf3e('0x78'));}break;}}})[_0xdf3e('0x79')](function(){_0xfb1e89();});}else{_0xfb1e89();}}},'charset':_0xdf3e('0x7a'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index a771096..522ca33 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 _0xc8ec=['request','then','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','CreateSmsMessage','body','options','raw','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter'];(function(_0x199bc4,_0x338105){var _0x136ffb=function(_0x3e7ced){while(--_0x3e7ced){_0x199bc4['push'](_0x199bc4['shift']());}};_0x136ffb(++_0x338105);}(_0xc8ec,0x11e));var _0xcc8e=function(_0x2b20f2,_0x3a8537){_0x2b20f2=_0x2b20f2-0x0;var _0xfe2e03=_0xc8ec[_0x2b20f2];return _0xfe2e03;};'use strict';var _=require(_0xcc8e('0x0'));var util=require(_0xcc8e('0x1'));var moment=require(_0xcc8e('0x2'));var BPromise=require(_0xcc8e('0x3'));var rs=require(_0xcc8e('0x4'));var fs=require('fs');var Redis=require(_0xcc8e('0x5'));var db=require(_0xcc8e('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xcc8e('0x7'))('rpc');var config=require(_0xcc8e('0x8'));var jayson=require(_0xcc8e('0x9'));var client=jayson[_0xcc8e('0xa')][_0xcc8e('0xb')]({'port':0x232a});config[_0xcc8e('0xc')]=_['defaults'](config[_0xcc8e('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xcc8e('0xd'))(new Redis(config[_0xcc8e('0xc')]));require('./smsMessage.socket')['register'](socket);function respondWithRpcPromise(_0x4a36ae,_0x40e298,_0x46ce10){return new BPromise(function(_0x584851,_0x300de9){return client[_0xcc8e('0xe')](_0x4a36ae,_0x46ce10)[_0xcc8e('0xf')](function(_0x2b8af4){logger['info'](_0xcc8e('0x10'),_0x40e298,_0xcc8e('0x11'));logger[_0xcc8e('0x12')](_0xcc8e('0x13'),_0x40e298,_0xcc8e('0x11'),JSON['stringify'](_0x2b8af4));if(_0x2b8af4['error']){if(_0x2b8af4[_0xcc8e('0x14')][_0xcc8e('0x15')]===0x1f4){logger[_0xcc8e('0x14')](_0xcc8e('0x10'),_0x40e298,_0x2b8af4[_0xcc8e('0x14')]['message']);return _0x300de9(_0x2b8af4['error']['message']);}logger[_0xcc8e('0x14')]('SmsMessage,\x20%s,\x20%s',_0x40e298,_0x2b8af4['error'][_0xcc8e('0x16')]);return _0x584851(_0x2b8af4[_0xcc8e('0x14')][_0xcc8e('0x16')]);}else{logger[_0xcc8e('0x17')](_0xcc8e('0x10'),_0x40e298,'request\x20sent');_0x584851(_0x2b8af4['result'][_0xcc8e('0x16')]);}})[_0xcc8e('0x18')](function(_0x50019c){logger[_0xcc8e('0x14')](_0xcc8e('0x10'),_0x40e298,_0x50019c);_0x300de9(_0x50019c);});});}exports[_0xcc8e('0x19')]=function(_0x1fc750){var _0x5c0dfa=this;return new Promise(function(_0x1a08b6,_0x311547){return db['SmsMessage']['create'](_0x1fc750[_0xcc8e('0x1a')],{'raw':_0x1fc750[_0xcc8e('0x1b')]?_0x1fc750['options'][_0xcc8e('0x1c')]===undefined?!![]:![]:!![]})[_0xcc8e('0xf')](function(_0x539799){logger['info'](_0xcc8e('0x19'),_0x1fc750);logger[_0xcc8e('0x12')]('CreateSmsMessage',_0x1fc750,JSON[_0xcc8e('0x1d')](_0x539799));_0x1a08b6(_0x539799);})[_0xcc8e('0x18')](function(_0x21c4cb){logger[_0xcc8e('0x14')]('CreateSmsMessage',_0x21c4cb[_0xcc8e('0x16')],_0x1fc750);_0x311547(_0x5c0dfa[_0xcc8e('0x14')](0x1f4,_0x21c4cb[_0xcc8e('0x16')]));});});}; \ No newline at end of file +var _0x07f1=['util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','defaults','redis','localhost','socket.io-emitter','./smsMessage.socket','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSmsMessage','SmsMessage','create','options','raw'];(function(_0x5ee936,_0x5775c0){var _0x2cf998=function(_0x193e16){while(--_0x193e16){_0x5ee936['push'](_0x5ee936['shift']());}};_0x2cf998(++_0x5775c0);}(_0x07f1,0xba));var _0x107f=function(_0x2bfe81,_0x1223ec){_0x2bfe81=_0x2bfe81-0x0;var _0x22c23f=_0x07f1[_0x2bfe81];return _0x22c23f;};'use strict';var _=require('lodash');var util=require(_0x107f('0x0'));var moment=require(_0x107f('0x1'));var BPromise=require(_0x107f('0x2'));var rs=require(_0x107f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x107f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x107f('0x5'))(_0x107f('0x6'));var config=require(_0x107f('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x107f('0x8')](config[_0x107f('0x9')],{'host':_0x107f('0xa'),'port':0x18eb});var socket=require(_0x107f('0xb'))(new Redis(config[_0x107f('0x9')]));require(_0x107f('0xc'))['register'](socket);function respondWithRpcPromise(_0x39c943,_0x2e3e81,_0x2dff7a){return new BPromise(function(_0x26df98,_0x5612e3){return client[_0x107f('0xd')](_0x39c943,_0x2dff7a)[_0x107f('0xe')](function(_0x39f9e0){logger[_0x107f('0xf')](_0x107f('0x10'),_0x2e3e81,_0x107f('0x11'));logger[_0x107f('0x12')](_0x107f('0x13'),_0x2e3e81,_0x107f('0x11'),JSON[_0x107f('0x14')](_0x39f9e0));if(_0x39f9e0[_0x107f('0x15')]){if(_0x39f9e0['error'][_0x107f('0x16')]===0x1f4){logger['error'](_0x107f('0x10'),_0x2e3e81,_0x39f9e0['error'][_0x107f('0x17')]);return _0x5612e3(_0x39f9e0[_0x107f('0x15')][_0x107f('0x17')]);}logger[_0x107f('0x15')](_0x107f('0x10'),_0x2e3e81,_0x39f9e0['error'][_0x107f('0x17')]);return _0x26df98(_0x39f9e0[_0x107f('0x15')][_0x107f('0x17')]);}else{logger[_0x107f('0xf')](_0x107f('0x10'),_0x2e3e81,'request\x20sent');_0x26df98(_0x39f9e0[_0x107f('0x18')][_0x107f('0x17')]);}})[_0x107f('0x19')](function(_0x466fe8){logger[_0x107f('0x15')](_0x107f('0x10'),_0x2e3e81,_0x466fe8);_0x5612e3(_0x466fe8);});});}exports[_0x107f('0x1a')]=function(_0x4d4020){var _0x4b8a6e=this;return new Promise(function(_0x3d4ec8,_0x36d67c){return db[_0x107f('0x1b')][_0x107f('0x1c')](_0x4d4020['body'],{'raw':_0x4d4020[_0x107f('0x1d')]?_0x4d4020[_0x107f('0x1d')][_0x107f('0x1e')]===undefined?!![]:![]:!![]})[_0x107f('0xe')](function(_0x2dd58e){logger[_0x107f('0xf')]('CreateSmsMessage',_0x4d4020);logger[_0x107f('0x12')](_0x107f('0x1a'),_0x4d4020,JSON[_0x107f('0x14')](_0x2dd58e));_0x3d4ec8(_0x2dd58e);})[_0x107f('0x19')](function(_0x24f70f){logger[_0x107f('0x15')](_0x107f('0x1a'),_0x24f70f[_0x107f('0x17')],_0x4d4020);_0x36d67c(_0x4b8a6e['error'](0x1f4,_0x24f70f[_0x107f('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index eeb7f5a..eba81e9 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 _0x2381=['length','smsMessage:','./smsMessage.events','save','remove','update','removeListener','register'];(function(_0x584bcd,_0x59c4b7){var _0x146bc7=function(_0x20b30d){while(--_0x20b30d){_0x584bcd['push'](_0x584bcd['shift']());}};_0x146bc7(++_0x59c4b7);}(_0x2381,0xb2));var _0x1238=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x2381[_0x5c351c];return _0x26f3b3;};'use strict';var SmsMessageEvents=require(_0x1238('0x0'));var events=[_0x1238('0x1'),_0x1238('0x2'),_0x1238('0x3')];function createListener(_0x2ecf1f,_0x422c76){return function(_0x4b9cfa){_0x422c76['emit'](_0x2ecf1f,_0x4b9cfa);};}function removeListener(_0x21a55e,_0x586d47){return function(){SmsMessageEvents[_0x1238('0x4')](_0x21a55e,_0x586d47);};}exports[_0x1238('0x5')]=function(_0x38c964){for(var _0x26ce40=0x0,_0x246bba=events[_0x1238('0x6')];_0x26ce40<_0x246bba;_0x26ce40++){var _0x51e247=events[_0x26ce40];var _0x46e753=createListener(_0x1238('0x7')+_0x51e247,_0x38c964);SmsMessageEvents['on'](_0x51e247,_0x46e753);}}; \ No newline at end of file +var _0x6cf5=['removeListener','register','length','smsMessage:','./smsMessage.events','save','remove','emit'];(function(_0xadbe21,_0x1f367e){var _0x283c67=function(_0x19100c){while(--_0x19100c){_0xadbe21['push'](_0xadbe21['shift']());}};_0x283c67(++_0x1f367e);}(_0x6cf5,0xa4));var _0x56cf=function(_0x50da99,_0x25c8a1){_0x50da99=_0x50da99-0x0;var _0x8931ff=_0x6cf5[_0x50da99];return _0x8931ff;};'use strict';var SmsMessageEvents=require(_0x56cf('0x0'));var events=[_0x56cf('0x1'),_0x56cf('0x2'),'update'];function createListener(_0x444b0e,_0x54fcc){return function(_0x5879e3){_0x54fcc[_0x56cf('0x3')](_0x444b0e,_0x5879e3);};}function removeListener(_0x6c3a47,_0x178eba){return function(){SmsMessageEvents[_0x56cf('0x4')](_0x6c3a47,_0x178eba);};}exports[_0x56cf('0x5')]=function(_0x243383){for(var _0x17745c=0x0,_0x559c2f=events[_0x56cf('0x6')];_0x17745c<_0x559c2f;_0x17745c++){var _0x3fc603=events[_0x17745c];var _0x2ae7b2=createListener(_0x56cf('0x7')+_0x3fc603,_0x243383);SmsMessageEvents['on'](_0x3fc603,_0x2ae7b2);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index a630c22..400d999 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 _0xafcc=['../../components/interaction/service','./smsQueue.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','/:id/teams','addTeams','put','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x30ba4a,_0x51ca35){var _0x5e8b13=function(_0x13f368){while(--_0x13f368){_0x30ba4a['push'](_0x30ba4a['shift']());}};_0x5e8b13(++_0x51ca35);}(_0xafcc,0xd2));var _0xcafc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xafcc[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xcafc('0x0'));var util=require(_0xcafc('0x1'));var path=require(_0xcafc('0x2'));var timeout=require(_0xcafc('0x3'));var express=require('express');var router=express[_0xcafc('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xcafc('0x5'));var interaction=require(_0xcafc('0x6'));var config=require('../../config/environment');var controller=require(_0xcafc('0x7'));router['get']('/',auth[_0xcafc('0x8')](),controller[_0xcafc('0x9')]);router[_0xcafc('0xa')](_0xcafc('0xb'),auth[_0xcafc('0x8')](),controller[_0xcafc('0xc')]);router[_0xcafc('0xa')](_0xcafc('0xd'),auth[_0xcafc('0x8')](),controller[_0xcafc('0xe')]);router[_0xcafc('0xa')](_0xcafc('0xf'),auth[_0xcafc('0x8')](),controller[_0xcafc('0x10')]);router[_0xcafc('0xa')]('/:id/teams',auth[_0xcafc('0x8')](),controller[_0xcafc('0x11')]);router[_0xcafc('0xa')](_0xcafc('0x12'),auth[_0xcafc('0x8')](),controller[_0xcafc('0x13')]);router[_0xcafc('0x14')]('/',auth['isAuthenticated'](),controller['create']);router[_0xcafc('0x14')](_0xcafc('0x15'),auth[_0xcafc('0x8')](),controller[_0xcafc('0x16')]);router['post'](_0xcafc('0x12'),auth['isAuthenticated'](),controller['addAgents']);router[_0xcafc('0x17')](_0xcafc('0xd'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xcafc('0xd'),auth[_0xcafc('0x8')](),controller['destroy']);router['delete'](_0xcafc('0x15'),auth[_0xcafc('0x8')](),controller[_0xcafc('0x18')]);router['delete'](_0xcafc('0x12'),auth['isAuthenticated'](),controller[_0xcafc('0x19')]);module[_0xcafc('0x1a')]=router; \ No newline at end of file +var _0xa87c=['fs-extra','../../components/auth/service','../../config/environment','get','index','/describe','describe','/:id','show','/:id/members','isAuthenticated','getMembers','/:id/teams','getTeams','/:id/users','post','addAgents','put','update','delete','destroy','removeAgents','exports','multer','util','express','Router'];(function(_0x306646,_0xdc2e1b){var _0x40bd8d=function(_0x397d05){while(--_0x397d05){_0x306646['push'](_0x306646['shift']());}};_0x40bd8d(++_0xdc2e1b);}(_0xa87c,0x140));var _0xca87=function(_0x9d639c,_0x524dbe){_0x9d639c=_0x9d639c-0x0;var _0x1671de=_0xa87c[_0x9d639c];return _0x1671de;};'use strict';var multer=require(_0xca87('0x0'));var util=require(_0xca87('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xca87('0x2'));var router=express[_0xca87('0x3')]();var fs_extra=require(_0xca87('0x4'));var auth=require(_0xca87('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xca87('0x6'));var controller=require('./smsQueue.controller');router[_0xca87('0x7')]('/',auth['isAuthenticated'](),controller[_0xca87('0x8')]);router[_0xca87('0x7')](_0xca87('0x9'),auth['isAuthenticated'](),controller[_0xca87('0xa')]);router[_0xca87('0x7')](_0xca87('0xb'),auth['isAuthenticated'](),controller[_0xca87('0xc')]);router[_0xca87('0x7')](_0xca87('0xd'),auth[_0xca87('0xe')](),controller[_0xca87('0xf')]);router[_0xca87('0x7')](_0xca87('0x10'),auth[_0xca87('0xe')](),controller[_0xca87('0x11')]);router[_0xca87('0x7')](_0xca87('0x12'),auth[_0xca87('0xe')](),controller['getAgents']);router[_0xca87('0x13')]('/',auth[_0xca87('0xe')](),controller['create']);router[_0xca87('0x13')](_0xca87('0x10'),auth[_0xca87('0xe')](),controller['addTeams']);router[_0xca87('0x13')]('/:id/users',auth[_0xca87('0xe')](),controller[_0xca87('0x14')]);router[_0xca87('0x15')](_0xca87('0xb'),auth[_0xca87('0xe')](),controller[_0xca87('0x16')]);router[_0xca87('0x17')](_0xca87('0xb'),auth['isAuthenticated'](),controller[_0xca87('0x18')]);router['delete'](_0xca87('0x10'),auth['isAuthenticated'](),controller['removeTeams']);router[_0xca87('0x17')](_0xca87('0x12'),auth[_0xca87('0xe')](),controller[_0xca87('0x19')]);module[_0xca87('0x1a')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index cc1cb4f..1ec2544 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 _0x658c=['INTEGER','rrmemory','beepall','roundrobin','sequelize','exports','name','STRING'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x658c,0x18c));var _0xc658=function(_0x247be3,_0x3aa35f){_0x247be3=_0x247be3-0x0;var _0x1c43f5=_0x658c[_0x247be3];return _0x1c43f5;};'use strict';var Sequelize=require(_0xc658('0x0'));module[_0xc658('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xc658('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xc658('0x3')]},'timeout':{'type':Sequelize[_0xc658('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xc658('0x5'),_0xc658('0x6'),_0xc658('0x7'))}}; \ No newline at end of file +var _0x71b7=['STRING','ENUM','beepall','roundrobin','sequelize','exports'];(function(_0x564dff,_0x32bdc5){var _0x283988=function(_0x289c8d){while(--_0x289c8d){_0x564dff['push'](_0x564dff['shift']());}};_0x283988(++_0x32bdc5);}(_0x71b7,0x88));var _0x771b=function(_0x4f0ac9,_0xf8844e){_0x4f0ac9=_0x4f0ac9-0x0;var _0x1d1f24=_0x71b7[_0x4f0ac9];return _0x1d1f24;};'use strict';var Sequelize=require(_0x771b('0x0'));module[_0x771b('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x771b('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x771b('0x3')]('rrmemory',_0x771b('0x4'),_0x771b('0x5'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index c8567b3..13414a3 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 _0x01d3=['clone','push','toString','QueryTypes','SELECT','every','includes','all','union','compact','value','emit','addAgents','ids','omit','spread','removeAgents','userSmsQueue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','get','UserProfileResource','end','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','merge','options','SmsQueue','rows','catch','show','params','includeAll','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','describe','getMembers','findOne','UserSmsQueue','order','SmsQueueId','filter','User','findAndCountAll','UserId','agent','updatedAt','createdAt','%s/%s','SIP','smsPause','getTeams','Team','addTeams','voicePause','flatMap','sequelize','transaction','each','findOrCreate','forEach','removeTeams','findAll','Agents','select','field','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x01d3,0xa2));var _0x301d=function(_0x2096bc,_0x2246cb){_0x2096bc=_0x2096bc-0x0;var _0x5b522d=_0x01d3[_0x2096bc];return _0x5b522d;};'use strict';var emlformat=require(_0x301d('0x0'));var rimraf=require(_0x301d('0x1'));var zipdir=require(_0x301d('0x2'));var jsonpatch=require(_0x301d('0x3'));var rp=require('request-promise');var moment=require(_0x301d('0x4'));var BPromise=require(_0x301d('0x5'));var Mustache=require('mustache');var util=require(_0x301d('0x6'));var path=require(_0x301d('0x7'));var sox=require(_0x301d('0x8'));var csv=require(_0x301d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x301d('0xa'));var _=require(_0x301d('0xb'));var squel=require(_0x301d('0xc'));var crypto=require(_0x301d('0xd'));var jsforce=require(_0x301d('0xe'));var deskjs=require(_0x301d('0xf'));var toCsv=require(_0x301d('0x9'));var querystring=require(_0x301d('0x10'));var Papa=require(_0x301d('0x11'));var Redis=require(_0x301d('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x301d('0x13'));var as=require(_0x301d('0x14'));var hardwareService=require(_0x301d('0x15'));var logger=require('../../config/logger')(_0x301d('0x16'));var utils=require(_0x301d('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x301d('0x18')]=_[_0x301d('0x19')](config[_0x301d('0x18')],{'host':_0x301d('0x1a'),'port':0x18eb});var socket=require(_0x301d('0x1b'))(new Redis(config[_0x301d('0x18')]));require(_0x301d('0x1c'))['register'](socket);function respondWithStatusCode(_0x50520c,_0xdb0cf1){_0xdb0cf1=_0xdb0cf1||0xcc;return function(_0x13e93b){if(_0x13e93b){return _0x50520c[_0x301d('0x1d')](_0xdb0cf1);}return _0x50520c['status'](_0xdb0cf1)['end']();};}function respondWithResult(_0x4f0f10,_0x5a1583){_0x5a1583=_0x5a1583||0xc8;return function(_0x36f7d5){if(_0x36f7d5){return _0x4f0f10[_0x301d('0x1e')](_0x5a1583)[_0x301d('0x1f')](_0x36f7d5);}};}function respondWithFilteredResult(_0xc31e6d,_0x26b150){return function(_0x39e505){if(_0x39e505){var _0x4c36a6=typeof _0x26b150[_0x301d('0x20')]==='undefined'&&typeof _0x26b150['limit']===_0x301d('0x21');var _0x11e1c9=_0x39e505['count'];var _0x2063b7=_0x4c36a6?0x0:_0x26b150['offset'];var _0x1edb9b=_0x4c36a6?_0x39e505[_0x301d('0x22')]:_0x26b150[_0x301d('0x20')]+_0x26b150['limit'];var _0xad221b;if(_0x1edb9b>=_0x11e1c9){_0x1edb9b=_0x11e1c9;_0xad221b=0xc8;}else{_0xad221b=0xce;}_0xc31e6d['status'](_0xad221b);return _0xc31e6d[_0x301d('0x23')](_0x301d('0x24'),_0x2063b7+'-'+_0x1edb9b+'/'+_0x11e1c9)[_0x301d('0x1f')](_0x39e505);}return null;};}function patchUpdates(_0x48cd08){return function(_0x36ff9b){try{jsonpatch[_0x301d('0x25')](_0x36ff9b,_0x48cd08,!![]);}catch(_0x1e2692){return BPromise[_0x301d('0x26')](_0x1e2692);}return _0x36ff9b[_0x301d('0x27')]();};}function saveUpdates(_0x1d8d00,_0x36f26a){return function(_0x52e758){if(_0x52e758){return _0x52e758[_0x301d('0x28')](_0x1d8d00)[_0x301d('0x29')](function(_0x45e7e3){return _0x45e7e3;});}return null;};}function removeEntity(_0x5a53b5,_0x7c824b){return function(_0x3d9dc6){if(_0x3d9dc6){return _0x3d9dc6['destroy']()[_0x301d('0x29')](function(){var _0x58d54b=_0x3d9dc6[_0x301d('0x2a')]({'plain':!![]});var _0x3d2e77='SmsQueues';return db[_0x301d('0x2b')]['destroy']({'where':{'type':_0x3d2e77,'resourceId':_0x58d54b['id']}})['then'](function(){return _0x3d9dc6;});})[_0x301d('0x29')](function(){_0x5a53b5[_0x301d('0x1e')](0xcc)[_0x301d('0x2c')]();});}};}function handleEntityNotFound(_0x54423d,_0x361940){return function(_0x532d59){if(!_0x532d59){_0x54423d['sendStatus'](0x194);}return _0x532d59;};}function handleError(_0x5c941b,_0x122b15){_0x122b15=_0x122b15||0x1f4;return function(_0x54e9a1){logger[_0x301d('0x2d')](_0x54e9a1[_0x301d('0x2e')]);if(_0x54e9a1[_0x301d('0x2f')]){delete _0x54e9a1[_0x301d('0x2f')];}_0x5c941b[_0x301d('0x1e')](_0x122b15)[_0x301d('0x30')](_0x54e9a1);};}exports[_0x301d('0x31')]=function(_0x1b1d83,_0x4cc9e9){var _0x11c1a3={},_0x4f2355={},_0x333cb2={'count':0x0,'rows':[]};var _0xfc69f4=_['map'](db['SmsQueue'][_0x301d('0x32')],function(_0x548de5){return{'name':_0x548de5[_0x301d('0x33')],'type':_0x548de5[_0x301d('0x34')][_0x301d('0x35')]};});_0x4f2355[_0x301d('0x36')]=_[_0x301d('0x37')](_0xfc69f4,_0x301d('0x2f'));_0x4f2355[_0x301d('0x38')]=_[_0x301d('0x39')](_0x1b1d83[_0x301d('0x38')]);_0x4f2355[_0x301d('0x3a')]=_['intersection'](_0x4f2355['model'],_0x4f2355['query']);_0x11c1a3[_0x301d('0x3b')]=_[_0x301d('0x3c')](_0x4f2355[_0x301d('0x36')],qs['fields'](_0x1b1d83[_0x301d('0x38')][_0x301d('0x3d')]));_0x11c1a3[_0x301d('0x3b')]=_0x11c1a3['attributes'][_0x301d('0x3e')]?_0x11c1a3[_0x301d('0x3b')]:_0x4f2355[_0x301d('0x36')];if(!_0x1b1d83['query'][_0x301d('0x3f')](_0x301d('0x40'))){_0x11c1a3[_0x301d('0x41')]=qs[_0x301d('0x41')](_0x1b1d83[_0x301d('0x38')][_0x301d('0x41')]);_0x11c1a3[_0x301d('0x20')]=qs[_0x301d('0x20')](_0x1b1d83[_0x301d('0x38')]['offset']);}_0x11c1a3['order']=qs[_0x301d('0x42')](_0x1b1d83[_0x301d('0x38')][_0x301d('0x42')]);_0x11c1a3[_0x301d('0x43')]=qs[_0x301d('0x3a')](_[_0x301d('0x44')](_0x1b1d83[_0x301d('0x38')],_0x4f2355['filters']),_0xfc69f4);if(_0x1b1d83[_0x301d('0x38')]['filter']){_0x11c1a3['where']=_[_0x301d('0x45')](_0x11c1a3['where'],{'$or':_[_0x301d('0x37')](_0xfc69f4,function(_0x2e9911){if(_0x2e9911[_0x301d('0x34')]!=='VIRTUAL'){var _0x5df100={};_0x5df100[_0x2e9911[_0x301d('0x2f')]]={'$like':'%'+_0x1b1d83[_0x301d('0x38')]['filter']+'%'};return _0x5df100;}})});}_0x11c1a3=_['merge']({},_0x11c1a3,_0x1b1d83[_0x301d('0x46')]);var _0x4c56a6={'where':_0x11c1a3['where']};return db[_0x301d('0x47')][_0x301d('0x22')](_0x4c56a6)[_0x301d('0x29')](function(_0x3dcad1){_0x333cb2[_0x301d('0x22')]=_0x3dcad1;if(_0x1b1d83[_0x301d('0x38')]['includeAll']){_0x11c1a3['include']=[{'all':!![]}];}return db['SmsQueue']['findAll'](_0x11c1a3);})[_0x301d('0x29')](function(_0xa09bf0){_0x333cb2[_0x301d('0x48')]=_0xa09bf0;return _0x333cb2;})[_0x301d('0x29')](respondWithFilteredResult(_0x4cc9e9,_0x11c1a3))[_0x301d('0x49')](handleError(_0x4cc9e9,null));};exports[_0x301d('0x4a')]=function(_0x57c90f,_0x368cc6){var _0x3b9134={'raw':!![],'where':{'id':_0x57c90f[_0x301d('0x4b')]['id']}},_0x1a1c06={};_0x1a1c06[_0x301d('0x36')]=_[_0x301d('0x39')](db[_0x301d('0x47')]['rawAttributes']);_0x1a1c06[_0x301d('0x38')]=_[_0x301d('0x39')](_0x57c90f[_0x301d('0x38')]);_0x1a1c06['filters']=_[_0x301d('0x3c')](_0x1a1c06[_0x301d('0x36')],_0x1a1c06[_0x301d('0x38')]);_0x3b9134[_0x301d('0x3b')]=_[_0x301d('0x3c')](_0x1a1c06[_0x301d('0x36')],qs[_0x301d('0x3d')](_0x57c90f[_0x301d('0x38')]['fields']));_0x3b9134[_0x301d('0x3b')]=_0x3b9134[_0x301d('0x3b')][_0x301d('0x3e')]?_0x3b9134['attributes']:_0x1a1c06[_0x301d('0x36')];if(_0x57c90f['query'][_0x301d('0x4c')]){_0x3b9134[_0x301d('0x4d')]=[{'all':!![]}];}_0x3b9134=_['merge']({},_0x3b9134,_0x57c90f['options']);return db[_0x301d('0x47')]['find'](_0x3b9134)[_0x301d('0x29')](handleEntityNotFound(_0x368cc6,null))[_0x301d('0x29')](respondWithResult(_0x368cc6,null))['catch'](handleError(_0x368cc6,null));};exports[_0x301d('0x4e')]=function(_0x362623,_0x193894){return db[_0x301d('0x47')][_0x301d('0x4e')](_0x362623[_0x301d('0x4f')],{})[_0x301d('0x29')](function(_0x254aac){var _0x30e112=_0x362623[_0x301d('0x50')][_0x301d('0x2a')]({'plain':!![]});if(!_0x30e112)throw new Error(_0x301d('0x51'));if(_0x30e112['role']===_0x301d('0x50')){var _0x2e2a3c=_0x254aac[_0x301d('0x2a')]({'plain':!![]});var _0x5e1bbf='SmsQueues';return db[_0x301d('0x52')][_0x301d('0x53')]({'where':{'name':_0x5e1bbf,'userProfileId':_0x30e112[_0x301d('0x54')]},'raw':!![]})[_0x301d('0x29')](function(_0x12d114){if(_0x12d114&&_0x12d114['autoAssociation']===0x0){return db[_0x301d('0x2b')][_0x301d('0x4e')]({'name':_0x2e2a3c[_0x301d('0x2f')],'resourceId':_0x2e2a3c['id'],'type':_0x12d114[_0x301d('0x2f')],'sectionId':_0x12d114['id']},{})['then'](function(){return _0x254aac;});}else{return _0x254aac;}})[_0x301d('0x49')](function(_0x1db4c6){logger['error'](_0x301d('0x55'),_0x1db4c6);throw _0x1db4c6;});}return _0x254aac;})[_0x301d('0x29')](respondWithResult(_0x193894,0xc9))[_0x301d('0x49')](handleError(_0x193894,null));};exports[_0x301d('0x28')]=function(_0x25e0e2,_0x32665c){if(_0x25e0e2[_0x301d('0x4f')]['id']){delete _0x25e0e2['body']['id'];}return db[_0x301d('0x47')][_0x301d('0x53')]({'where':{'id':_0x25e0e2[_0x301d('0x4b')]['id']}})[_0x301d('0x29')](handleEntityNotFound(_0x32665c,null))['then'](saveUpdates(_0x25e0e2[_0x301d('0x4f')],null))['then'](respondWithResult(_0x32665c,null))['catch'](handleError(_0x32665c,null));};exports[_0x301d('0x56')]=function(_0x5433af,_0x29cc87){return db['SmsQueue'][_0x301d('0x53')]({'where':{'id':_0x5433af[_0x301d('0x4b')]['id']}})[_0x301d('0x29')](handleEntityNotFound(_0x29cc87,null))[_0x301d('0x29')](removeEntity(_0x29cc87,null))[_0x301d('0x49')](handleError(_0x29cc87,null));};exports[_0x301d('0x57')]=function(_0x468dfe,_0x34c2b1){return db['SmsQueue'][_0x301d('0x57')]()[_0x301d('0x29')](respondWithResult(_0x34c2b1,null))['catch'](handleError(_0x34c2b1,null));};exports[_0x301d('0x58')]=function(_0x5bffb4,_0x390731,_0x28dd15){var _0x481832={'raw':!![],'where':{}},_0x41e798={},_0x2015ca;return db[_0x301d('0x47')][_0x301d('0x59')]({'where':{'id':_0x5bffb4['params']['id']}})['then'](handleEntityNotFound(_0x390731,null))['then'](function(_0x379b93){if(_0x379b93){_0x2015ca=_0x379b93[_0x301d('0x2a')]({'plain':!![]});_0x41e798[_0x301d('0x36')]=_[_0x301d('0x39')](db[_0x301d('0x5a')][_0x301d('0x32')]);_0x41e798[_0x301d('0x38')]=_[_0x301d('0x39')](_0x5bffb4[_0x301d('0x38')]);_0x41e798[_0x301d('0x3a')]=_[_0x301d('0x3c')](_0x41e798['model'],_0x41e798[_0x301d('0x38')]);_0x481832[_0x301d('0x3b')]=_['intersection'](_0x41e798[_0x301d('0x36')],qs[_0x301d('0x3d')](_0x5bffb4[_0x301d('0x38')]['fields']));_0x481832[_0x301d('0x3b')]=_0x481832[_0x301d('0x3b')][_0x301d('0x3e')]?_0x481832[_0x301d('0x3b')]:_0x41e798['model'];if(!_0x5bffb4[_0x301d('0x38')][_0x301d('0x3f')](_0x301d('0x40'))){_0x481832[_0x301d('0x41')]=qs[_0x301d('0x41')](_0x5bffb4[_0x301d('0x38')]['limit']);_0x481832[_0x301d('0x20')]=qs[_0x301d('0x20')](_0x5bffb4[_0x301d('0x38')]['offset']);}_0x481832[_0x301d('0x5b')]=qs['sort'](_0x5bffb4['query'][_0x301d('0x42')]);_0x481832[_0x301d('0x43')]=qs[_0x301d('0x3a')](_['pick'](_0x5bffb4[_0x301d('0x38')],_0x41e798[_0x301d('0x3a')]));_0x481832[_0x301d('0x43')][_0x301d('0x5c')]=_0x379b93['id'];if(_0x5bffb4[_0x301d('0x38')][_0x301d('0x5d')]){_0x481832[_0x301d('0x43')]=_[_0x301d('0x45')](_0x481832['where'],{'$or':_[_0x301d('0x37')](_0x481832['attributes'],function(_0x4101d2){var _0x43c77f={};_0x43c77f[_0x4101d2]={'$like':'%'+_0x5bffb4['query'][_0x301d('0x5d')]+'%'};return _0x43c77f;})});}_0x481832=_[_0x301d('0x45')]({},_0x481832,_0x5bffb4[_0x301d('0x46')]);return db[_0x301d('0x5a')]['findAll'](_0x481832);}})['then'](function(_0x40daec){if(_0x40daec){return db[_0x301d('0x5e')][_0x301d('0x5f')]({'where':{'id':_[_0x301d('0x37')](_0x40daec,_0x301d('0x60')),'role':_0x301d('0x61')},'attributes':['id',_0x301d('0x2f'),'smsPause',_0x301d('0x62'),_0x301d('0x63')]});}})[_0x301d('0x29')](function(_0x5ca281){if(_0x5ca281){return{'count':_0x5ca281[_0x301d('0x22')],'rows':_['map'](_0x5ca281['rows'],function(_0x49bf46){return{'membername':_0x49bf46[_0x301d('0x2f')],'UserId':_0x49bf46['id'],'queue_name':_0x2015ca['name'],'SmsQueueId':_0x2015ca['id'],'interface':util['format'](_0x301d('0x64'),_0x301d('0x65'),_0x49bf46[_0x301d('0x2f')]),'penalty':0x0,'paused':_0x49bf46[_0x301d('0x66')],'createdAt':_0x49bf46[_0x301d('0x63')],'updatedAt':_0x49bf46[_0x301d('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x301d('0x29')](respondWithFilteredResult(_0x390731,_0x481832))[_0x301d('0x49')](handleError(_0x390731,null));};exports[_0x301d('0x67')]=function(_0x46e3b2,_0xc63a33,_0x5cac12){var _0x935f98={};var _0x3e480f={};var _0x19e360;var _0x32e6ec;return db[_0x301d('0x47')]['findOne']({'where':{'id':_0x46e3b2['params']['id']}})[_0x301d('0x29')](handleEntityNotFound(_0xc63a33,null))[_0x301d('0x29')](function(_0x164864){if(_0x164864){_0x19e360=_0x164864;_0x3e480f[_0x301d('0x36')]=_[_0x301d('0x39')](db[_0x301d('0x68')][_0x301d('0x32')]);_0x3e480f[_0x301d('0x38')]=_[_0x301d('0x39')](_0x46e3b2[_0x301d('0x38')]);_0x3e480f['filters']=_[_0x301d('0x3c')](_0x3e480f[_0x301d('0x36')],_0x3e480f['query']);_0x935f98[_0x301d('0x3b')]=_[_0x301d('0x3c')](_0x3e480f[_0x301d('0x36')],qs[_0x301d('0x3d')](_0x46e3b2[_0x301d('0x38')][_0x301d('0x3d')]));_0x935f98[_0x301d('0x3b')]=_0x935f98[_0x301d('0x3b')][_0x301d('0x3e')]?_0x935f98[_0x301d('0x3b')]:_0x3e480f['model'];_0x935f98[_0x301d('0x5b')]=qs[_0x301d('0x42')](_0x46e3b2[_0x301d('0x38')][_0x301d('0x42')]);_0x935f98[_0x301d('0x43')]=qs['filters'](_[_0x301d('0x44')](_0x46e3b2[_0x301d('0x38')],_0x3e480f['filters']));if(_0x46e3b2['query'][_0x301d('0x5d')]){_0x935f98[_0x301d('0x43')]=_[_0x301d('0x45')](_0x935f98[_0x301d('0x43')],{'$or':_['map'](_0x935f98[_0x301d('0x3b')],function(_0x57d1c3){var _0x5b4da1={};_0x5b4da1[_0x57d1c3]={'$like':'%'+_0x46e3b2[_0x301d('0x38')][_0x301d('0x5d')]+'%'};return _0x5b4da1;})});}_0x935f98=_[_0x301d('0x45')]({},_0x935f98,_0x46e3b2[_0x301d('0x46')]);return _0x19e360[_0x301d('0x67')](_0x935f98);}})[_0x301d('0x29')](function(_0xc10583){if(_0xc10583){_0x32e6ec=_0xc10583[_0x301d('0x3e')];if(!_0x46e3b2['query'][_0x301d('0x3f')](_0x301d('0x40'))){_0x935f98[_0x301d('0x41')]=qs[_0x301d('0x41')](_0x46e3b2['query'][_0x301d('0x41')]);_0x935f98['offset']=qs[_0x301d('0x20')](_0x46e3b2[_0x301d('0x38')]['offset']);}return _0x19e360['getTeams'](_0x935f98);}})[_0x301d('0x29')](function(_0x5f5da9){if(_0x5f5da9){return _0x5f5da9?{'count':_0x32e6ec,'rows':_0x5f5da9}:null;}})[_0x301d('0x29')](respondWithResult(_0xc63a33,null))[_0x301d('0x49')](handleError(_0xc63a33,null));};exports[_0x301d('0x69')]=function(_0x49bed0,_0x45e59b,_0x4651ce){var _0x40f366=_0x49bed0[_0x301d('0x4f')]['ids'];return db[_0x301d('0x68')]['findAll']({'where':{'id':_0x40f366},'attributes':['id'],'include':[{'model':db[_0x301d('0x5e')],'as':'Agents','attributes':['id',_0x301d('0x2f'),'online',_0x301d('0x6a'),'interface'],'raw':!![]}]})[_0x301d('0x29')](function(_0x29fb79){if(_0x29fb79){var _0x597c17=_[_0x301d('0x6b')](_0x29fb79,function(_0xf365e8){var _0x419d62=_0xf365e8[_0x301d('0x2a')]({'plain':!![]});return _0x419d62['Agents'];});return db[_0x301d('0x47')][_0x301d('0x53')]({'where':{'id':_0x49bed0[_0x301d('0x4b')]['id']}})[_0x301d('0x29')](function(_0x6a3e67){return db[_0x301d('0x6c')][_0x301d('0x6d')](function(_0x58127c){return _0x6a3e67['addTeams'](_0x40f366,{'transaction':_0x58127c})[_0x301d('0x29')](function(){return BPromise[_0x301d('0x6e')](_0x597c17,function(_0x3a5a8a){return db['UserSmsQueue'][_0x301d('0x6f')]({'where':{'UserId':_0x3a5a8a['id'],'SmsQueueId':_0x49bed0[_0x301d('0x4b')]['id']},'transaction':_0x58127c});});})[_0x301d('0x29')](function(){_0x597c17[_0x301d('0x70')](function(_0x5304fa){socket['emit']('userSmsQueue:save',{'UserId':_0x5304fa['id'],'SmsQueueId':_0x6a3e67['id']});});});});});}})[_0x301d('0x29')](respondWithStatusCode(_0x45e59b,null))[_0x301d('0x49')](handleError(_0x45e59b,null));};exports[_0x301d('0x71')]=function(_0x27ab18,_0x1ba0f9,_0xaad6a7){return db[_0x301d('0x68')][_0x301d('0x72')]({'where':{'id':_0x27ab18[_0x301d('0x38')]['ids']},'attributes':['id'],'include':[{'model':db[_0x301d('0x5e')],'as':_0x301d('0x73'),'attributes':['id'],'raw':!![]}]})[_0x301d('0x29')](handleEntityNotFound(_0x1ba0f9,null))[_0x301d('0x29')](function(_0x273014){var _0x423cd6=_[_0x301d('0x37')](_0x273014,'id');var _0x223229=[];var _0x98c3bc=[];var _0x23f80d=squel[_0x301d('0x74')]();_0x23f80d[_0x301d('0x75')]('tq.TeamId')[_0x301d('0x76')](_0x301d('0x77'),'tq')[_0x301d('0x78')](_0x301d('0x79'),'ut',_0x301d('0x7a'))[_0x301d('0x43')](_0x301d('0x7b'),_0x27ab18[_0x301d('0x4b')]['id']);for(var _0x1d230d=0x0;_0x1d230d<_0x273014[_0x301d('0x3e')];_0x1d230d+=0x1){let _0x36f046=_0x273014[_0x1d230d];for(var _0x30a3b4=0x0;_0x30a3b4<_0x36f046[_0x301d('0x73')][_0x301d('0x3e')];_0x30a3b4+=0x1){let _0xd8a948=_0x36f046[_0x301d('0x73')][_0x30a3b4];var _0x75d1d5=_0x23f80d[_0x301d('0x7c')]();_0x75d1d5['where']('ut.UserId\x20=\x20?',_0xd8a948['id']);_0x98c3bc[_0x301d('0x7d')](db[_0x301d('0x6c')][_0x301d('0x38')](_0x75d1d5[_0x301d('0x7e')](),{'type':db[_0x301d('0x6c')][_0x301d('0x7f')][_0x301d('0x80')]})[_0x301d('0x29')](function(_0x3be2f9){if(_0x3be2f9[_0x301d('0x3e')]===0x1){return _0xd8a948['id'];}else{var _0x1a9b72=_[_0x301d('0x81')](_[_0x301d('0x37')](_0x3be2f9,'TeamId'),function(_0x38e081){return _[_0x301d('0x82')](_0x423cd6,_0x38e081);});if(_0x1a9b72){return _0xd8a948['id'];}}}));}}return BPromise[_0x301d('0x83')](_0x98c3bc)[_0x301d('0x29')](function(_0x4f6b37){_0x223229=_(_0x223229)[_0x301d('0x84')](_0x4f6b37)[_0x301d('0x85')]()[_0x301d('0x86')]();return db[_0x301d('0x47')][_0x301d('0x53')]({'where':{'id':_0x27ab18['params']['id']}})['then'](function(_0x20a509){return db[_0x301d('0x6c')]['transaction'](function(_0xf05b4f){return _0x20a509[_0x301d('0x71')](_0x27ab18[_0x301d('0x38')]['ids'],{'transaction':_0xf05b4f})[_0x301d('0x29')](function(){if(!_['isEmpty'](_0x223229)){return _0x20a509['removeAgents'](_0x223229,{'transaction':_0xf05b4f});}})[_0x301d('0x29')](function(){_0x223229[_0x301d('0x70')](function(_0x30025d){socket[_0x301d('0x87')]('userSmsQueue:remove',{'UserId':_0x30025d,'SmsQueueId':_0x20a509['id']});});});});});});})[_0x301d('0x29')](respondWithStatusCode(_0x1ba0f9,null))['catch'](handleError(_0x1ba0f9,null));};exports[_0x301d('0x88')]=function(_0xf5d966,_0x5650d0,_0x5b0812){return db['SmsQueue'][_0x301d('0x53')]({'where':{'id':_0xf5d966['params']['id']}})['then'](handleEntityNotFound(_0x5650d0,null))[_0x301d('0x29')](function(_0x57f745){if(_0x57f745){return _0x57f745[_0x301d('0x88')](_0xf5d966[_0x301d('0x4f')][_0x301d('0x89')],_[_0x301d('0x8a')](_0xf5d966[_0x301d('0x4f')],[_0x301d('0x89'),'id'])||{})[_0x301d('0x8b')](function(_0x5623b6){for(var _0x5197bc=0x0;_0x5197bc<_0xf5d966[_0x301d('0x4f')][_0x301d('0x89')][_0x301d('0x3e')];_0x5197bc+=0x1){socket[_0x301d('0x87')]('userSmsQueue:save',{'UserId':Number(_0xf5d966[_0x301d('0x4f')][_0x301d('0x89')][_0x5197bc]),'SmsQueueId':Number(_0xf5d966[_0x301d('0x4b')]['id'])});}return _0x5623b6;});}})[_0x301d('0x29')](respondWithResult(_0x5650d0,null))[_0x301d('0x49')](handleError(_0x5650d0,null));};exports[_0x301d('0x8c')]=function(_0x368ad4,_0x2139f4,_0x59a841){return db[_0x301d('0x47')][_0x301d('0x53')]({'where':{'id':_0x368ad4['params']['id']}})['then'](handleEntityNotFound(_0x2139f4,null))[_0x301d('0x29')](function(_0x1ef0aa){if(_0x1ef0aa){return _0x1ef0aa['removeAgents'](_0x368ad4[_0x301d('0x38')][_0x301d('0x89')])[_0x301d('0x29')](function(){if(_['isArray'](_0x368ad4['query']['ids'])){for(var _0x94f7ba=0x0;_0x94f7ba<_0x368ad4[_0x301d('0x38')][_0x301d('0x89')]['length'];_0x94f7ba+=0x1){socket[_0x301d('0x87')](_0x301d('0x8d'),{'UserId':Number(_0x368ad4[_0x301d('0x38')][_0x301d('0x89')][_0x94f7ba]),'SmsQueueId':Number(_0x368ad4[_0x301d('0x4b')]['id'])});}}else{socket['emit']('userSmsQueue:remove',{'UserId':Number(_0x368ad4['query']['ids']),'SmsQueueId':Number(_0x368ad4[_0x301d('0x4b')]['id'])});}});}})[_0x301d('0x29')](respondWithStatusCode(_0x2139f4,null))[_0x301d('0x49')](handleError(_0x2139f4,null));};exports[_0x301d('0x8e')]=function(_0x5a41b9,_0x23ab24,_0x19a2ff){var _0x14bf9d={};var _0x5c6ad4={};var _0x98a77b;var _0x5ea9d3;return db[_0x301d('0x47')][_0x301d('0x59')]({'where':{'id':_0x5a41b9[_0x301d('0x4b')]['id']}})['then'](handleEntityNotFound(_0x23ab24,null))[_0x301d('0x29')](function(_0x24cc94){if(_0x24cc94){_0x98a77b=_0x24cc94;_0x5c6ad4['model']=_[_0x301d('0x39')](db[_0x301d('0x5e')][_0x301d('0x32')]);_0x5c6ad4[_0x301d('0x38')]=_['keys'](_0x5a41b9[_0x301d('0x38')]);_0x5c6ad4[_0x301d('0x3a')]=_[_0x301d('0x3c')](_0x5c6ad4[_0x301d('0x36')],_0x5c6ad4['query']);_0x14bf9d[_0x301d('0x3b')]=_[_0x301d('0x3c')](_0x5c6ad4[_0x301d('0x36')],qs[_0x301d('0x3d')](_0x5a41b9[_0x301d('0x38')][_0x301d('0x3d')]));_0x14bf9d['attributes']=_0x14bf9d[_0x301d('0x3b')][_0x301d('0x3e')]?_0x14bf9d['attributes']:_0x5c6ad4[_0x301d('0x36')];_0x14bf9d[_0x301d('0x5b')]=qs[_0x301d('0x42')](_0x5a41b9[_0x301d('0x38')]['sort']);_0x14bf9d['where']=qs['filters'](_['pick'](_0x5a41b9[_0x301d('0x38')],_0x5c6ad4[_0x301d('0x3a')]));if(_0x5a41b9[_0x301d('0x38')]['filter']){_0x14bf9d[_0x301d('0x43')]=_[_0x301d('0x45')](_0x14bf9d[_0x301d('0x43')],{'$or':_[_0x301d('0x37')](_0x14bf9d[_0x301d('0x3b')],function(_0x1e7368){var _0x5534fd={};_0x5534fd[_0x1e7368]={'$like':'%'+_0x5a41b9[_0x301d('0x38')][_0x301d('0x5d')]+'%'};return _0x5534fd;})});}_0x14bf9d=_[_0x301d('0x45')]({},_0x14bf9d,_0x5a41b9['options']);return _0x98a77b['getAgents'](_0x14bf9d);}})[_0x301d('0x29')](function(_0x5656e5){if(_0x5656e5){_0x5ea9d3=_0x5656e5['length'];if(!_0x5a41b9[_0x301d('0x38')]['hasOwnProperty']('nolimit')){_0x14bf9d[_0x301d('0x41')]=qs[_0x301d('0x41')](_0x5a41b9[_0x301d('0x38')][_0x301d('0x41')]);_0x14bf9d[_0x301d('0x20')]=qs[_0x301d('0x20')](_0x5a41b9[_0x301d('0x38')]['offset']);}return _0x98a77b[_0x301d('0x8e')](_0x14bf9d);}})[_0x301d('0x29')](function(_0x589c6c){if(_0x589c6c){return _0x589c6c?{'count':_0x5ea9d3,'rows':_0x589c6c}:null;}})['then'](respondWithResult(_0x23ab24,null))['catch'](handleError(_0x23ab24,null));}; \ No newline at end of file +var _0xb4b6=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./smsQueue.socket','register','sendStatus','end','status','json','undefined','count','set','Content-Range','apply','reject','save','then','destroy','SmsQueues','UserProfileResource','error','stack','send','index','SmsQueue','model','map','name','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','limit','offset','sort','where','pick','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','params','rawAttributes','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','getMembers','UserSmsQueue','length','order','SmsQueueId','filter','User','UserId','agent','updatedAt','createdAt','format','%s/%s','SIP','smsPause','getTeams','findOne','addTeams','ids','Team','online','interface','flatMap','Agents','sequelize','transaction','each','forEach','emit','select','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','userSmsQueue:remove','addAgents','omit','spread','userSmsQueue:save','isArray','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse'];(function(_0x4a1678,_0x247f5e){var _0x46c002=function(_0x35613c){while(--_0x35613c){_0x4a1678['push'](_0x4a1678['shift']());}};_0x46c002(++_0x247f5e);}(_0xb4b6,0x7e));var _0x6b4b=function(_0xdaa5bd,_0x49d2b8){_0xdaa5bd=_0xdaa5bd-0x0;var _0x14e8be=_0xb4b6[_0xdaa5bd];return _0x14e8be;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6b4b('0x0'));var zipdir=require(_0x6b4b('0x1'));var jsonpatch=require(_0x6b4b('0x2'));var rp=require(_0x6b4b('0x3'));var moment=require(_0x6b4b('0x4'));var BPromise=require(_0x6b4b('0x5'));var Mustache=require(_0x6b4b('0x6'));var util=require(_0x6b4b('0x7'));var path=require(_0x6b4b('0x8'));var sox=require('sox');var csv=require(_0x6b4b('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6b4b('0xa'));var _=require(_0x6b4b('0xb'));var squel=require(_0x6b4b('0xc'));var crypto=require(_0x6b4b('0xd'));var jsforce=require(_0x6b4b('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x6b4b('0x9'));var querystring=require(_0x6b4b('0xf'));var Papa=require(_0x6b4b('0x10'));var Redis=require(_0x6b4b('0x11'));var authService=require(_0x6b4b('0x12'));var qs=require(_0x6b4b('0x13'));var as=require(_0x6b4b('0x14'));var hardwareService=require(_0x6b4b('0x15'));var logger=require('../../config/logger')(_0x6b4b('0x16'));var utils=require('../../config/utils');var config=require(_0x6b4b('0x17'));var licenseUtil=require(_0x6b4b('0x18'));var db=require(_0x6b4b('0x19'))['db'];config[_0x6b4b('0x1a')]=_[_0x6b4b('0x1b')](config[_0x6b4b('0x1a')],{'host':_0x6b4b('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6b4b('0x1a')]));require(_0x6b4b('0x1d'))[_0x6b4b('0x1e')](socket);function respondWithStatusCode(_0x587ed1,_0x5ca0d8){_0x5ca0d8=_0x5ca0d8||0xcc;return function(_0x39390c){if(_0x39390c){return _0x587ed1[_0x6b4b('0x1f')](_0x5ca0d8);}return _0x587ed1['status'](_0x5ca0d8)[_0x6b4b('0x20')]();};}function respondWithResult(_0x3842a6,_0x26ac10){_0x26ac10=_0x26ac10||0xc8;return function(_0x3954d9){if(_0x3954d9){return _0x3842a6[_0x6b4b('0x21')](_0x26ac10)[_0x6b4b('0x22')](_0x3954d9);}};}function respondWithFilteredResult(_0x2fecb4,_0xc3e02c){return function(_0x15333b){if(_0x15333b){var _0x5308da=typeof _0xc3e02c['offset']===_0x6b4b('0x23')&&typeof _0xc3e02c['limit']===_0x6b4b('0x23');var _0x44c5f6=_0x15333b[_0x6b4b('0x24')];var _0x9106ac=_0x5308da?0x0:_0xc3e02c['offset'];var _0x35d70b=_0x5308da?_0x15333b[_0x6b4b('0x24')]:_0xc3e02c['offset']+_0xc3e02c['limit'];var _0x5ec8a9;if(_0x35d70b>=_0x44c5f6){_0x35d70b=_0x44c5f6;_0x5ec8a9=0xc8;}else{_0x5ec8a9=0xce;}_0x2fecb4[_0x6b4b('0x21')](_0x5ec8a9);return _0x2fecb4[_0x6b4b('0x25')](_0x6b4b('0x26'),_0x9106ac+'-'+_0x35d70b+'/'+_0x44c5f6)[_0x6b4b('0x22')](_0x15333b);}return null;};}function patchUpdates(_0x1a9fba){return function(_0x5e7ad1){try{jsonpatch[_0x6b4b('0x27')](_0x5e7ad1,_0x1a9fba,!![]);}catch(_0xbee434){return BPromise[_0x6b4b('0x28')](_0xbee434);}return _0x5e7ad1[_0x6b4b('0x29')]();};}function saveUpdates(_0x595f33,_0x571920){return function(_0x524ac4){if(_0x524ac4){return _0x524ac4['update'](_0x595f33)[_0x6b4b('0x2a')](function(_0x526f6d){return _0x526f6d;});}return null;};}function removeEntity(_0x5df887,_0x24e78a){return function(_0x2cbe79){if(_0x2cbe79){return _0x2cbe79[_0x6b4b('0x2b')]()[_0x6b4b('0x2a')](function(){var _0x5afba8=_0x2cbe79['get']({'plain':!![]});var _0x19f977=_0x6b4b('0x2c');return db[_0x6b4b('0x2d')][_0x6b4b('0x2b')]({'where':{'type':_0x19f977,'resourceId':_0x5afba8['id']}})['then'](function(){return _0x2cbe79;});})[_0x6b4b('0x2a')](function(){_0x5df887['status'](0xcc)[_0x6b4b('0x20')]();});}};}function handleEntityNotFound(_0x1ab47c,_0x334cf8){return function(_0x5efba8){if(!_0x5efba8){_0x1ab47c[_0x6b4b('0x1f')](0x194);}return _0x5efba8;};}function handleError(_0x11816c,_0x3fd1bf){_0x3fd1bf=_0x3fd1bf||0x1f4;return function(_0x1681ee){logger[_0x6b4b('0x2e')](_0x1681ee[_0x6b4b('0x2f')]);if(_0x1681ee['name']){delete _0x1681ee['name'];}_0x11816c['status'](_0x3fd1bf)[_0x6b4b('0x30')](_0x1681ee);};}exports[_0x6b4b('0x31')]=function(_0x319b4e,_0x467446){var _0x3eb067={},_0x44788f={},_0x50d8c3={'count':0x0,'rows':[]};var _0x5798b3=_['map'](db[_0x6b4b('0x32')]['rawAttributes'],function(_0x269322){return{'name':_0x269322['fieldName'],'type':_0x269322['type']['key']};});_0x44788f[_0x6b4b('0x33')]=_[_0x6b4b('0x34')](_0x5798b3,_0x6b4b('0x35'));_0x44788f[_0x6b4b('0x36')]=_[_0x6b4b('0x37')](_0x319b4e['query']);_0x44788f[_0x6b4b('0x38')]=_['intersection'](_0x44788f[_0x6b4b('0x33')],_0x44788f['query']);_0x3eb067[_0x6b4b('0x39')]=_[_0x6b4b('0x3a')](_0x44788f[_0x6b4b('0x33')],qs['fields'](_0x319b4e[_0x6b4b('0x36')][_0x6b4b('0x3b')]));_0x3eb067[_0x6b4b('0x39')]=_0x3eb067['attributes']['length']?_0x3eb067[_0x6b4b('0x39')]:_0x44788f[_0x6b4b('0x33')];if(!_0x319b4e[_0x6b4b('0x36')][_0x6b4b('0x3c')](_0x6b4b('0x3d'))){_0x3eb067[_0x6b4b('0x3e')]=qs['limit'](_0x319b4e[_0x6b4b('0x36')]['limit']);_0x3eb067[_0x6b4b('0x3f')]=qs[_0x6b4b('0x3f')](_0x319b4e['query']['offset']);}_0x3eb067['order']=qs[_0x6b4b('0x40')](_0x319b4e[_0x6b4b('0x36')][_0x6b4b('0x40')]);_0x3eb067[_0x6b4b('0x41')]=qs[_0x6b4b('0x38')](_[_0x6b4b('0x42')](_0x319b4e[_0x6b4b('0x36')],_0x44788f[_0x6b4b('0x38')]),_0x5798b3);if(_0x319b4e[_0x6b4b('0x36')]['filter']){_0x3eb067[_0x6b4b('0x41')]=_[_0x6b4b('0x43')](_0x3eb067['where'],{'$or':_['map'](_0x5798b3,function(_0x4213e7){if(_0x4213e7[_0x6b4b('0x44')]!==_0x6b4b('0x45')){var _0x292bc4={};_0x292bc4[_0x4213e7[_0x6b4b('0x35')]]={'$like':'%'+_0x319b4e[_0x6b4b('0x36')]['filter']+'%'};return _0x292bc4;}})});}_0x3eb067=_['merge']({},_0x3eb067,_0x319b4e[_0x6b4b('0x46')]);var _0x29f1a9={'where':_0x3eb067[_0x6b4b('0x41')]};return db[_0x6b4b('0x32')][_0x6b4b('0x24')](_0x29f1a9)[_0x6b4b('0x2a')](function(_0x4f1d57){_0x50d8c3[_0x6b4b('0x24')]=_0x4f1d57;if(_0x319b4e[_0x6b4b('0x36')][_0x6b4b('0x47')]){_0x3eb067[_0x6b4b('0x48')]=[{'all':!![]}];}return db[_0x6b4b('0x32')][_0x6b4b('0x49')](_0x3eb067);})[_0x6b4b('0x2a')](function(_0x24264c){_0x50d8c3['rows']=_0x24264c;return _0x50d8c3;})[_0x6b4b('0x2a')](respondWithFilteredResult(_0x467446,_0x3eb067))[_0x6b4b('0x4a')](handleError(_0x467446,null));};exports[_0x6b4b('0x4b')]=function(_0x50f974,_0x4ae52b){var _0x1d00ea={'raw':!![],'where':{'id':_0x50f974[_0x6b4b('0x4c')]['id']}},_0x1937f9={};_0x1937f9['model']=_[_0x6b4b('0x37')](db['SmsQueue'][_0x6b4b('0x4d')]);_0x1937f9[_0x6b4b('0x36')]=_['keys'](_0x50f974[_0x6b4b('0x36')]);_0x1937f9['filters']=_[_0x6b4b('0x3a')](_0x1937f9['model'],_0x1937f9['query']);_0x1d00ea[_0x6b4b('0x39')]=_[_0x6b4b('0x3a')](_0x1937f9[_0x6b4b('0x33')],qs[_0x6b4b('0x3b')](_0x50f974['query'][_0x6b4b('0x3b')]));_0x1d00ea[_0x6b4b('0x39')]=_0x1d00ea[_0x6b4b('0x39')]['length']?_0x1d00ea['attributes']:_0x1937f9[_0x6b4b('0x33')];if(_0x50f974['query']['includeAll']){_0x1d00ea[_0x6b4b('0x48')]=[{'all':!![]}];}_0x1d00ea=_[_0x6b4b('0x43')]({},_0x1d00ea,_0x50f974[_0x6b4b('0x46')]);return db[_0x6b4b('0x32')]['find'](_0x1d00ea)[_0x6b4b('0x2a')](handleEntityNotFound(_0x4ae52b,null))[_0x6b4b('0x2a')](respondWithResult(_0x4ae52b,null))[_0x6b4b('0x4a')](handleError(_0x4ae52b,null));};exports[_0x6b4b('0x4e')]=function(_0x2e8009,_0x387702){return db[_0x6b4b('0x32')][_0x6b4b('0x4e')](_0x2e8009[_0x6b4b('0x4f')],{})[_0x6b4b('0x2a')](function(_0x34fbe9){var _0x243595=_0x2e8009['user'][_0x6b4b('0x50')]({'plain':!![]});if(!_0x243595)throw new Error(_0x6b4b('0x51'));if(_0x243595['role']==='user'){var _0x43a30a=_0x34fbe9[_0x6b4b('0x50')]({'plain':!![]});var _0x19e827=_0x6b4b('0x2c');return db[_0x6b4b('0x52')][_0x6b4b('0x53')]({'where':{'name':_0x19e827,'userProfileId':_0x243595[_0x6b4b('0x54')]},'raw':!![]})[_0x6b4b('0x2a')](function(_0x4bdfe0){if(_0x4bdfe0&&_0x4bdfe0[_0x6b4b('0x55')]===0x0){return db['UserProfileResource'][_0x6b4b('0x4e')]({'name':_0x43a30a['name'],'resourceId':_0x43a30a['id'],'type':_0x4bdfe0[_0x6b4b('0x35')],'sectionId':_0x4bdfe0['id']},{})['then'](function(){return _0x34fbe9;});}else{return _0x34fbe9;}})[_0x6b4b('0x4a')](function(_0x4bf6cb){logger[_0x6b4b('0x2e')](_0x6b4b('0x56'),_0x4bf6cb);throw _0x4bf6cb;});}return _0x34fbe9;})[_0x6b4b('0x2a')](respondWithResult(_0x387702,0xc9))[_0x6b4b('0x4a')](handleError(_0x387702,null));};exports[_0x6b4b('0x57')]=function(_0x3921fe,_0x2437f8){if(_0x3921fe['body']['id']){delete _0x3921fe[_0x6b4b('0x4f')]['id'];}return db['SmsQueue'][_0x6b4b('0x53')]({'where':{'id':_0x3921fe[_0x6b4b('0x4c')]['id']}})[_0x6b4b('0x2a')](handleEntityNotFound(_0x2437f8,null))['then'](saveUpdates(_0x3921fe[_0x6b4b('0x4f')],null))['then'](respondWithResult(_0x2437f8,null))[_0x6b4b('0x4a')](handleError(_0x2437f8,null));};exports[_0x6b4b('0x2b')]=function(_0x27675e,_0x293f22){return db['SmsQueue']['find']({'where':{'id':_0x27675e[_0x6b4b('0x4c')]['id']}})['then'](handleEntityNotFound(_0x293f22,null))[_0x6b4b('0x2a')](removeEntity(_0x293f22,null))[_0x6b4b('0x4a')](handleError(_0x293f22,null));};exports['describe']=function(_0x29e8b8,_0x1814bd){return db[_0x6b4b('0x32')]['describe']()['then'](respondWithResult(_0x1814bd,null))['catch'](handleError(_0x1814bd,null));};exports[_0x6b4b('0x58')]=function(_0x5f5bd9,_0x3978aa,_0x9a8237){var _0x59c37f={'raw':!![],'where':{}},_0x40c085={},_0x3df50f;return db[_0x6b4b('0x32')]['findOne']({'where':{'id':_0x5f5bd9[_0x6b4b('0x4c')]['id']}})['then'](handleEntityNotFound(_0x3978aa,null))[_0x6b4b('0x2a')](function(_0x26172c){if(_0x26172c){_0x3df50f=_0x26172c['get']({'plain':!![]});_0x40c085[_0x6b4b('0x33')]=_[_0x6b4b('0x37')](db[_0x6b4b('0x59')][_0x6b4b('0x4d')]);_0x40c085[_0x6b4b('0x36')]=_[_0x6b4b('0x37')](_0x5f5bd9['query']);_0x40c085['filters']=_[_0x6b4b('0x3a')](_0x40c085[_0x6b4b('0x33')],_0x40c085[_0x6b4b('0x36')]);_0x59c37f[_0x6b4b('0x39')]=_[_0x6b4b('0x3a')](_0x40c085[_0x6b4b('0x33')],qs[_0x6b4b('0x3b')](_0x5f5bd9['query']['fields']));_0x59c37f[_0x6b4b('0x39')]=_0x59c37f['attributes'][_0x6b4b('0x5a')]?_0x59c37f[_0x6b4b('0x39')]:_0x40c085[_0x6b4b('0x33')];if(!_0x5f5bd9[_0x6b4b('0x36')]['hasOwnProperty'](_0x6b4b('0x3d'))){_0x59c37f[_0x6b4b('0x3e')]=qs['limit'](_0x5f5bd9[_0x6b4b('0x36')]['limit']);_0x59c37f[_0x6b4b('0x3f')]=qs[_0x6b4b('0x3f')](_0x5f5bd9[_0x6b4b('0x36')]['offset']);}_0x59c37f[_0x6b4b('0x5b')]=qs[_0x6b4b('0x40')](_0x5f5bd9[_0x6b4b('0x36')][_0x6b4b('0x40')]);_0x59c37f[_0x6b4b('0x41')]=qs[_0x6b4b('0x38')](_[_0x6b4b('0x42')](_0x5f5bd9['query'],_0x40c085['filters']));_0x59c37f[_0x6b4b('0x41')][_0x6b4b('0x5c')]=_0x26172c['id'];if(_0x5f5bd9[_0x6b4b('0x36')][_0x6b4b('0x5d')]){_0x59c37f[_0x6b4b('0x41')]=_[_0x6b4b('0x43')](_0x59c37f[_0x6b4b('0x41')],{'$or':_[_0x6b4b('0x34')](_0x59c37f[_0x6b4b('0x39')],function(_0x490dfd){var _0x10e96c={};_0x10e96c[_0x490dfd]={'$like':'%'+_0x5f5bd9['query'][_0x6b4b('0x5d')]+'%'};return _0x10e96c;})});}_0x59c37f=_[_0x6b4b('0x43')]({},_0x59c37f,_0x5f5bd9['options']);return db[_0x6b4b('0x59')][_0x6b4b('0x49')](_0x59c37f);}})[_0x6b4b('0x2a')](function(_0x5c0408){if(_0x5c0408){return db[_0x6b4b('0x5e')]['findAndCountAll']({'where':{'id':_[_0x6b4b('0x34')](_0x5c0408,_0x6b4b('0x5f')),'role':_0x6b4b('0x60')},'attributes':['id',_0x6b4b('0x35'),'smsPause',_0x6b4b('0x61'),_0x6b4b('0x62')]});}})[_0x6b4b('0x2a')](function(_0x504e14){if(_0x504e14){return{'count':_0x504e14[_0x6b4b('0x24')],'rows':_['map'](_0x504e14['rows'],function(_0x36cc44){return{'membername':_0x36cc44[_0x6b4b('0x35')],'UserId':_0x36cc44['id'],'queue_name':_0x3df50f[_0x6b4b('0x35')],'SmsQueueId':_0x3df50f['id'],'interface':util[_0x6b4b('0x63')](_0x6b4b('0x64'),_0x6b4b('0x65'),_0x36cc44[_0x6b4b('0x35')]),'penalty':0x0,'paused':_0x36cc44[_0x6b4b('0x66')],'createdAt':_0x36cc44[_0x6b4b('0x62')],'updatedAt':_0x36cc44['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x3978aa,_0x59c37f))[_0x6b4b('0x4a')](handleError(_0x3978aa,null));};exports[_0x6b4b('0x67')]=function(_0x24593d,_0x114b6a,_0x359818){var _0x3241d3={};var _0x28c2ba={};var _0x2188d8;var _0x1b9a50;return db['SmsQueue'][_0x6b4b('0x68')]({'where':{'id':_0x24593d[_0x6b4b('0x4c')]['id']}})[_0x6b4b('0x2a')](handleEntityNotFound(_0x114b6a,null))[_0x6b4b('0x2a')](function(_0x2f8241){if(_0x2f8241){_0x2188d8=_0x2f8241;_0x28c2ba[_0x6b4b('0x33')]=_[_0x6b4b('0x37')](db['Team']['rawAttributes']);_0x28c2ba[_0x6b4b('0x36')]=_[_0x6b4b('0x37')](_0x24593d[_0x6b4b('0x36')]);_0x28c2ba['filters']=_[_0x6b4b('0x3a')](_0x28c2ba[_0x6b4b('0x33')],_0x28c2ba[_0x6b4b('0x36')]);_0x3241d3[_0x6b4b('0x39')]=_[_0x6b4b('0x3a')](_0x28c2ba[_0x6b4b('0x33')],qs[_0x6b4b('0x3b')](_0x24593d[_0x6b4b('0x36')]['fields']));_0x3241d3[_0x6b4b('0x39')]=_0x3241d3[_0x6b4b('0x39')]['length']?_0x3241d3[_0x6b4b('0x39')]:_0x28c2ba['model'];_0x3241d3[_0x6b4b('0x5b')]=qs[_0x6b4b('0x40')](_0x24593d[_0x6b4b('0x36')][_0x6b4b('0x40')]);_0x3241d3[_0x6b4b('0x41')]=qs['filters'](_['pick'](_0x24593d['query'],_0x28c2ba[_0x6b4b('0x38')]));if(_0x24593d[_0x6b4b('0x36')]['filter']){_0x3241d3[_0x6b4b('0x41')]=_['merge'](_0x3241d3[_0x6b4b('0x41')],{'$or':_[_0x6b4b('0x34')](_0x3241d3[_0x6b4b('0x39')],function(_0x58ad84){var _0x494ef7={};_0x494ef7[_0x58ad84]={'$like':'%'+_0x24593d[_0x6b4b('0x36')][_0x6b4b('0x5d')]+'%'};return _0x494ef7;})});}_0x3241d3=_[_0x6b4b('0x43')]({},_0x3241d3,_0x24593d[_0x6b4b('0x46')]);return _0x2188d8[_0x6b4b('0x67')](_0x3241d3);}})['then'](function(_0xd19228){if(_0xd19228){_0x1b9a50=_0xd19228[_0x6b4b('0x5a')];if(!_0x24593d[_0x6b4b('0x36')][_0x6b4b('0x3c')](_0x6b4b('0x3d'))){_0x3241d3[_0x6b4b('0x3e')]=qs['limit'](_0x24593d[_0x6b4b('0x36')]['limit']);_0x3241d3[_0x6b4b('0x3f')]=qs['offset'](_0x24593d['query'][_0x6b4b('0x3f')]);}return _0x2188d8['getTeams'](_0x3241d3);}})[_0x6b4b('0x2a')](function(_0x47a74f){if(_0x47a74f){return _0x47a74f?{'count':_0x1b9a50,'rows':_0x47a74f}:null;}})[_0x6b4b('0x2a')](respondWithResult(_0x114b6a,null))[_0x6b4b('0x4a')](handleError(_0x114b6a,null));};exports[_0x6b4b('0x69')]=function(_0x10b2e5,_0x4cc801,_0x119f8e){var _0x2f576d=_0x10b2e5[_0x6b4b('0x4f')][_0x6b4b('0x6a')];return db[_0x6b4b('0x6b')][_0x6b4b('0x49')]({'where':{'id':_0x2f576d},'attributes':['id'],'include':[{'model':db[_0x6b4b('0x5e')],'as':'Agents','attributes':['id','name',_0x6b4b('0x6c'),'voicePause',_0x6b4b('0x6d')],'raw':!![]}]})['then'](function(_0x494abb){if(_0x494abb){var _0x5518de=_[_0x6b4b('0x6e')](_0x494abb,function(_0x30b040){var _0x178345=_0x30b040[_0x6b4b('0x50')]({'plain':!![]});return _0x178345[_0x6b4b('0x6f')];});return db['SmsQueue'][_0x6b4b('0x53')]({'where':{'id':_0x10b2e5['params']['id']}})['then'](function(_0x3b9047){return db[_0x6b4b('0x70')][_0x6b4b('0x71')](function(_0x38653d){return _0x3b9047['addTeams'](_0x2f576d,{'transaction':_0x38653d})['then'](function(){return BPromise[_0x6b4b('0x72')](_0x5518de,function(_0x531c6b){return db[_0x6b4b('0x59')]['findOrCreate']({'where':{'UserId':_0x531c6b['id'],'SmsQueueId':_0x10b2e5[_0x6b4b('0x4c')]['id']},'transaction':_0x38653d});});})['then'](function(){_0x5518de[_0x6b4b('0x73')](function(_0x44e464){socket[_0x6b4b('0x74')]('userSmsQueue:save',{'UserId':_0x44e464['id'],'SmsQueueId':_0x3b9047['id']});});});});});}})[_0x6b4b('0x2a')](respondWithStatusCode(_0x4cc801,null))[_0x6b4b('0x4a')](handleError(_0x4cc801,null));};exports['removeTeams']=function(_0x2d5d9e,_0x4f801e,_0x294ea7){return db[_0x6b4b('0x6b')][_0x6b4b('0x49')]({'where':{'id':_0x2d5d9e[_0x6b4b('0x36')][_0x6b4b('0x6a')]},'attributes':['id'],'include':[{'model':db[_0x6b4b('0x5e')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x6b4b('0x2a')](handleEntityNotFound(_0x4f801e,null))['then'](function(_0x10cdfa){var _0x4252fb=_[_0x6b4b('0x34')](_0x10cdfa,'id');var _0x3eb245=[];var _0x402b3d=[];var _0x3aadf3=squel[_0x6b4b('0x75')]();_0x3aadf3['field']('tq.TeamId')[_0x6b4b('0x76')](_0x6b4b('0x77'),'tq')[_0x6b4b('0x78')](_0x6b4b('0x79'),'ut',_0x6b4b('0x7a'))[_0x6b4b('0x41')](_0x6b4b('0x7b'),_0x2d5d9e[_0x6b4b('0x4c')]['id']);for(var _0x8337f8=0x0;_0x8337f8<_0x10cdfa[_0x6b4b('0x5a')];_0x8337f8+=0x1){let _0x3f5d45=_0x10cdfa[_0x8337f8];for(var _0x3c1114=0x0;_0x3c1114<_0x3f5d45[_0x6b4b('0x6f')][_0x6b4b('0x5a')];_0x3c1114+=0x1){let _0x12f11e=_0x3f5d45[_0x6b4b('0x6f')][_0x3c1114];var _0x184876=_0x3aadf3['clone']();_0x184876[_0x6b4b('0x41')](_0x6b4b('0x7c'),_0x12f11e['id']);_0x402b3d[_0x6b4b('0x7d')](db[_0x6b4b('0x70')][_0x6b4b('0x36')](_0x184876['toString'](),{'type':db[_0x6b4b('0x70')]['QueryTypes'][_0x6b4b('0x7e')]})['then'](function(_0x45db83){if(_0x45db83[_0x6b4b('0x5a')]===0x1){return _0x12f11e['id'];}else{var _0x1f3449=_[_0x6b4b('0x7f')](_[_0x6b4b('0x34')](_0x45db83,_0x6b4b('0x80')),function(_0x4c177c){return _[_0x6b4b('0x81')](_0x4252fb,_0x4c177c);});if(_0x1f3449){return _0x12f11e['id'];}}}));}}return BPromise[_0x6b4b('0x82')](_0x402b3d)[_0x6b4b('0x2a')](function(_0x1bd036){_0x3eb245=_(_0x3eb245)[_0x6b4b('0x83')](_0x1bd036)[_0x6b4b('0x84')]()[_0x6b4b('0x85')]();return db['SmsQueue'][_0x6b4b('0x53')]({'where':{'id':_0x2d5d9e[_0x6b4b('0x4c')]['id']}})[_0x6b4b('0x2a')](function(_0x301a59){return db[_0x6b4b('0x70')]['transaction'](function(_0x53e961){return _0x301a59['removeTeams'](_0x2d5d9e[_0x6b4b('0x36')][_0x6b4b('0x6a')],{'transaction':_0x53e961})[_0x6b4b('0x2a')](function(){if(!_[_0x6b4b('0x86')](_0x3eb245)){return _0x301a59[_0x6b4b('0x87')](_0x3eb245,{'transaction':_0x53e961});}})[_0x6b4b('0x2a')](function(){_0x3eb245[_0x6b4b('0x73')](function(_0x4d880b){socket[_0x6b4b('0x74')](_0x6b4b('0x88'),{'UserId':_0x4d880b,'SmsQueueId':_0x301a59['id']});});});});});});})['then'](respondWithStatusCode(_0x4f801e,null))[_0x6b4b('0x4a')](handleError(_0x4f801e,null));};exports[_0x6b4b('0x89')]=function(_0x2b93d8,_0x2702a7,_0x26146d){return db[_0x6b4b('0x32')][_0x6b4b('0x53')]({'where':{'id':_0x2b93d8['params']['id']}})[_0x6b4b('0x2a')](handleEntityNotFound(_0x2702a7,null))[_0x6b4b('0x2a')](function(_0x2f2750){if(_0x2f2750){return _0x2f2750[_0x6b4b('0x89')](_0x2b93d8[_0x6b4b('0x4f')][_0x6b4b('0x6a')],_[_0x6b4b('0x8a')](_0x2b93d8['body'],[_0x6b4b('0x6a'),'id'])||{})[_0x6b4b('0x8b')](function(_0x4eec20){for(var _0x241d59=0x0;_0x241d59<_0x2b93d8[_0x6b4b('0x4f')][_0x6b4b('0x6a')]['length'];_0x241d59+=0x1){socket['emit'](_0x6b4b('0x8c'),{'UserId':Number(_0x2b93d8[_0x6b4b('0x4f')][_0x6b4b('0x6a')][_0x241d59]),'SmsQueueId':Number(_0x2b93d8[_0x6b4b('0x4c')]['id'])});}return _0x4eec20;});}})[_0x6b4b('0x2a')](respondWithResult(_0x2702a7,null))[_0x6b4b('0x4a')](handleError(_0x2702a7,null));};exports['removeAgents']=function(_0x5ca1d4,_0x39313e,_0x5ae71f){return db['SmsQueue'][_0x6b4b('0x53')]({'where':{'id':_0x5ca1d4[_0x6b4b('0x4c')]['id']}})[_0x6b4b('0x2a')](handleEntityNotFound(_0x39313e,null))[_0x6b4b('0x2a')](function(_0x12e975){if(_0x12e975){return _0x12e975[_0x6b4b('0x87')](_0x5ca1d4[_0x6b4b('0x36')][_0x6b4b('0x6a')])[_0x6b4b('0x2a')](function(){if(_[_0x6b4b('0x8d')](_0x5ca1d4[_0x6b4b('0x36')][_0x6b4b('0x6a')])){for(var _0x192f68=0x0;_0x192f68<_0x5ca1d4['query'][_0x6b4b('0x6a')][_0x6b4b('0x5a')];_0x192f68+=0x1){socket[_0x6b4b('0x74')](_0x6b4b('0x88'),{'UserId':Number(_0x5ca1d4[_0x6b4b('0x36')][_0x6b4b('0x6a')][_0x192f68]),'SmsQueueId':Number(_0x5ca1d4[_0x6b4b('0x4c')]['id'])});}}else{socket[_0x6b4b('0x74')]('userSmsQueue:remove',{'UserId':Number(_0x5ca1d4[_0x6b4b('0x36')][_0x6b4b('0x6a')]),'SmsQueueId':Number(_0x5ca1d4['params']['id'])});}});}})['then'](respondWithStatusCode(_0x39313e,null))[_0x6b4b('0x4a')](handleError(_0x39313e,null));};exports['getAgents']=function(_0x315dd4,_0x3525d7,_0x542c85){var _0x32443f={};var _0x84f614={};var _0x33b452;var _0x41992b;return db[_0x6b4b('0x32')][_0x6b4b('0x68')]({'where':{'id':_0x315dd4[_0x6b4b('0x4c')]['id']}})[_0x6b4b('0x2a')](handleEntityNotFound(_0x3525d7,null))[_0x6b4b('0x2a')](function(_0x5c3be2){if(_0x5c3be2){_0x33b452=_0x5c3be2;_0x84f614[_0x6b4b('0x33')]=_[_0x6b4b('0x37')](db[_0x6b4b('0x5e')]['rawAttributes']);_0x84f614[_0x6b4b('0x36')]=_[_0x6b4b('0x37')](_0x315dd4[_0x6b4b('0x36')]);_0x84f614[_0x6b4b('0x38')]=_['intersection'](_0x84f614[_0x6b4b('0x33')],_0x84f614[_0x6b4b('0x36')]);_0x32443f[_0x6b4b('0x39')]=_[_0x6b4b('0x3a')](_0x84f614[_0x6b4b('0x33')],qs['fields'](_0x315dd4['query'][_0x6b4b('0x3b')]));_0x32443f['attributes']=_0x32443f[_0x6b4b('0x39')][_0x6b4b('0x5a')]?_0x32443f[_0x6b4b('0x39')]:_0x84f614['model'];_0x32443f['order']=qs[_0x6b4b('0x40')](_0x315dd4[_0x6b4b('0x36')][_0x6b4b('0x40')]);_0x32443f[_0x6b4b('0x41')]=qs['filters'](_[_0x6b4b('0x42')](_0x315dd4['query'],_0x84f614['filters']));if(_0x315dd4[_0x6b4b('0x36')][_0x6b4b('0x5d')]){_0x32443f[_0x6b4b('0x41')]=_[_0x6b4b('0x43')](_0x32443f[_0x6b4b('0x41')],{'$or':_[_0x6b4b('0x34')](_0x32443f['attributes'],function(_0x3881f3){var _0x1b0581={};_0x1b0581[_0x3881f3]={'$like':'%'+_0x315dd4['query'][_0x6b4b('0x5d')]+'%'};return _0x1b0581;})});}_0x32443f=_['merge']({},_0x32443f,_0x315dd4[_0x6b4b('0x46')]);return _0x33b452[_0x6b4b('0x8e')](_0x32443f);}})['then'](function(_0x491a21){if(_0x491a21){_0x41992b=_0x491a21[_0x6b4b('0x5a')];if(!_0x315dd4[_0x6b4b('0x36')][_0x6b4b('0x3c')]('nolimit')){_0x32443f[_0x6b4b('0x3e')]=qs['limit'](_0x315dd4[_0x6b4b('0x36')][_0x6b4b('0x3e')]);_0x32443f[_0x6b4b('0x3f')]=qs['offset'](_0x315dd4[_0x6b4b('0x36')][_0x6b4b('0x3f')]);}return _0x33b452[_0x6b4b('0x8e')](_0x32443f);}})[_0x6b4b('0x2a')](function(_0x2f2328){if(_0x2f2328){return _0x2f2328?{'count':_0x41992b,'rows':_0x2f2328}:null;}})[_0x6b4b('0x2a')](respondWithResult(_0x3525d7,null))[_0x6b4b('0x4a')](handleError(_0x3525d7,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index aadbbec..217c468 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 _0x93f2=['emit','hasOwnProperty','hook','exports','events','setMaxListeners','save','update','remove'];(function(_0x1ea689,_0x189d5a){var _0x3c1a81=function(_0x95590){while(--_0x95590){_0x1ea689['push'](_0x1ea689['shift']());}};_0x3c1a81(++_0x189d5a);}(_0x93f2,0x100));var _0x293f=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0x93f2[_0x525c7b];return _0x27b33e;};'use strict';var EventEmitter=require(_0x293f('0x0'));var SmsQueue=require('../../mysqldb')['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x293f('0x1')](0x0);var events={'afterCreate':_0x293f('0x2'),'afterUpdate':_0x293f('0x3'),'afterDestroy':_0x293f('0x4')};function emitEvent(_0x1988c1){return function(_0x9226a,_0x51d1c4,_0x3dbb99){SmsQueueEvents[_0x293f('0x5')](_0x1988c1+':'+_0x9226a['id'],_0x9226a);SmsQueueEvents[_0x293f('0x5')](_0x1988c1,_0x9226a);_0x3dbb99(null);};}for(var e in events){if(events[_0x293f('0x6')](e)){var event=events[e];SmsQueue[_0x293f('0x7')](e,emitEvent(event));}}module[_0x293f('0x8')]=SmsQueueEvents; \ No newline at end of file +var _0x3caf=['../../mysqldb','setMaxListeners','remove','emit','hasOwnProperty','hook'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x3caf,0x108));var _0xf3ca=function(_0x198372,_0x137bbf){_0x198372=_0x198372-0x0;var _0x161a97=_0x3caf[_0x198372];return _0x161a97;};'use strict';var EventEmitter=require('events');var SmsQueue=require(_0xf3ca('0x0'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xf3ca('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xf3ca('0x2')};function emitEvent(_0x2fdb4a){return function(_0xd039a7,_0x359af9,_0x3971b6){SmsQueueEvents[_0xf3ca('0x3')](_0x2fdb4a+':'+_0xd039a7['id'],_0xd039a7);SmsQueueEvents[_0xf3ca('0x3')](_0x2fdb4a,_0xd039a7);_0x3971b6(null);};}for(var e in events){if(events[_0xf3ca('0x4')](e)){var event=events[e];SmsQueue[_0xf3ca('0x5')](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 7dac5ee..5d50608 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 _0xe3bc=['rimraf','../../config/environment','./smsQueue.attributes','exports','define','SmsQueue','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x5ae653,_0x539cd0){var _0x2ea184=function(_0x4b8bd8){while(--_0x4b8bd8){_0x5ae653['push'](_0x5ae653['shift']());}};_0x2ea184(++_0x539cd0);}(_0xe3bc,0xe3));var _0xce3b=function(_0x5a6378,_0x2d383a){_0x5a6378=_0x5a6378-0x0;var _0x38a9e6=_0xe3bc[_0x5a6378];return _0x38a9e6;};'use strict';var _=require(_0xce3b('0x0'));var util=require(_0xce3b('0x1'));var logger=require(_0xce3b('0x2'))(_0xce3b('0x3'));var moment=require('moment');var BPromise=require(_0xce3b('0x4'));var rp=require(_0xce3b('0x5'));var fs=require('fs');var path=require(_0xce3b('0x6'));var rimraf=require(_0xce3b('0x7'));var config=require(_0xce3b('0x8'));var attributes=require(_0xce3b('0x9'));module[_0xce3b('0xa')]=function(_0x1f6930,_0x1e7e13){return _0x1f6930[_0xce3b('0xb')](_0xce3b('0xc'),attributes,{'tableName':'sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa164=['sms_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','SmsQueue'];(function(_0xf22c0e,_0x457d52){var _0x1717b1=function(_0x2ced5b){while(--_0x2ced5b){_0xf22c0e['push'](_0xf22c0e['shift']());}};_0x1717b1(++_0x457d52);}(_0xa164,0xaa));var _0x4a16=function(_0x2c259a,_0x26e290){_0x2c259a=_0x2c259a-0x0;var _0x31e280=_0xa164[_0x2c259a];return _0x31e280;};'use strict';var _=require(_0x4a16('0x0'));var util=require(_0x4a16('0x1'));var logger=require(_0x4a16('0x2'))(_0x4a16('0x3'));var moment=require(_0x4a16('0x4'));var BPromise=require(_0x4a16('0x5'));var rp=require(_0x4a16('0x6'));var fs=require('fs');var path=require(_0x4a16('0x7'));var rimraf=require(_0x4a16('0x8'));var config=require(_0x4a16('0x9'));var attributes=require('./smsQueue.attributes');module[_0x4a16('0xa')]=function(_0x3320d1,_0x56046e){return _0x3320d1['define'](_0x4a16('0xb'),attributes,{'tableName':_0x4a16('0xc'),'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 03abe80..c7c8745 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 _0x19b2=['register','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','GetSmsQueue','SmsQueue','findAll','options','raw','where','attributes','limit','include','map','model','catch','ShowSmsQueue','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','defaults','redis','localhost','socket.io-emitter','./smsQueue.socket'];(function(_0x45f888,_0x45aa43){var _0x244cdd=function(_0x58fa87){while(--_0x58fa87){_0x45f888['push'](_0x45f888['shift']());}};_0x244cdd(++_0x45aa43);}(_0x19b2,0x64));var _0x219b=function(_0x3307fc,_0x37e2a3){_0x3307fc=_0x3307fc-0x0;var _0x3fca54=_0x19b2[_0x3307fc];return _0x3fca54;};'use strict';var _=require(_0x219b('0x0'));var util=require('util');var moment=require(_0x219b('0x1'));var BPromise=require(_0x219b('0x2'));var rs=require(_0x219b('0x3'));var fs=require('fs');var Redis=require(_0x219b('0x4'));var db=require(_0x219b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x219b('0x6'))(_0x219b('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x219b('0x8')]['http']({'port':0x232a});config['redis']=_[_0x219b('0x9')](config[_0x219b('0xa')],{'host':_0x219b('0xb'),'port':0x18eb});var socket=require(_0x219b('0xc'))(new Redis(config['redis']));require(_0x219b('0xd'))[_0x219b('0xe')](socket);function respondWithRpcPromise(_0x4d375a,_0x5530ad,_0x53e673){return new BPromise(function(_0x5bc28f,_0x3bba0f){return client[_0x219b('0xf')](_0x4d375a,_0x53e673)[_0x219b('0x10')](function(_0x39311c){logger[_0x219b('0x11')](_0x219b('0x12'),_0x5530ad,_0x219b('0x13'));logger[_0x219b('0x14')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0x5530ad,_0x219b('0x13'),JSON[_0x219b('0x15')](_0x39311c));if(_0x39311c[_0x219b('0x16')]){if(_0x39311c['error']['code']===0x1f4){logger[_0x219b('0x16')](_0x219b('0x12'),_0x5530ad,_0x39311c['error'][_0x219b('0x17')]);return _0x3bba0f(_0x39311c[_0x219b('0x16')][_0x219b('0x17')]);}logger[_0x219b('0x16')](_0x219b('0x12'),_0x5530ad,_0x39311c[_0x219b('0x16')][_0x219b('0x17')]);return _0x5bc28f(_0x39311c[_0x219b('0x16')][_0x219b('0x17')]);}else{logger[_0x219b('0x11')](_0x219b('0x12'),_0x5530ad,_0x219b('0x13'));_0x5bc28f(_0x39311c['result'][_0x219b('0x17')]);}})['catch'](function(_0x2b2df9){logger[_0x219b('0x16')]('SmsQueue,\x20%s,\x20%s',_0x5530ad,_0x2b2df9);_0x3bba0f(_0x2b2df9);});});}exports[_0x219b('0x18')]=function(_0x2abc53){var _0x3047c3=this;return new Promise(function(_0x278d04,_0x2a2db8){return db[_0x219b('0x19')][_0x219b('0x1a')]({'raw':_0x2abc53[_0x219b('0x1b')]?_0x2abc53['options'][_0x219b('0x1c')]===undefined?!![]:![]:!![],'where':_0x2abc53[_0x219b('0x1b')]?_0x2abc53[_0x219b('0x1b')][_0x219b('0x1d')]||null:null,'attributes':_0x2abc53[_0x219b('0x1b')]?_0x2abc53[_0x219b('0x1b')][_0x219b('0x1e')]||null:null,'limit':_0x2abc53['options']?_0x2abc53[_0x219b('0x1b')][_0x219b('0x1f')]||null:null,'include':_0x2abc53['options']?_0x2abc53[_0x219b('0x1b')][_0x219b('0x20')]?_[_0x219b('0x21')](_0x2abc53[_0x219b('0x1b')][_0x219b('0x20')],function(_0x5aef71){return{'model':db[_0x5aef71[_0x219b('0x22')]],'as':_0x5aef71['as'],'attributes':_0x5aef71[_0x219b('0x1e')],'include':_0x5aef71[_0x219b('0x20')]?_[_0x219b('0x21')](_0x5aef71[_0x219b('0x20')],function(_0x26b069){return{'model':db[_0x26b069['model']],'as':_0x26b069['as'],'attributes':_0x26b069['attributes'],'include':_0x26b069['include']?_[_0x219b('0x21')](_0x26b069[_0x219b('0x20')],function(_0x22c487){return{'model':db[_0x22c487[_0x219b('0x22')]],'as':_0x22c487['as'],'attributes':_0x22c487[_0x219b('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x219b('0x10')](function(_0x252e84){logger[_0x219b('0x11')](_0x219b('0x18'),_0x2abc53);logger[_0x219b('0x14')](_0x219b('0x18'),_0x2abc53,JSON['stringify'](_0x252e84));_0x278d04(_0x252e84);})[_0x219b('0x23')](function(_0x2316ff){logger[_0x219b('0x16')](_0x219b('0x18'),_0x2316ff['message'],_0x2abc53);_0x2a2db8(_0x3047c3[_0x219b('0x16')](0x1f4,_0x2316ff[_0x219b('0x17')]));});});};exports[_0x219b('0x24')]=function(_0x242e41){var _0x59eb1f=this;return new Promise(function(_0x5d0dd7,_0x1a25c4){return db[_0x219b('0x19')][_0x219b('0x25')]({'raw':_0x242e41[_0x219b('0x1b')]?_0x242e41[_0x219b('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x242e41[_0x219b('0x1b')]?_0x242e41['options'][_0x219b('0x1d')]||null:null,'attributes':_0x242e41[_0x219b('0x1b')]?_0x242e41[_0x219b('0x1b')]['attributes']||null:null,'include':_0x242e41[_0x219b('0x1b')]?_0x242e41[_0x219b('0x1b')][_0x219b('0x20')]?_[_0x219b('0x21')](_0x242e41['options'][_0x219b('0x20')],function(_0x28d4a6){return{'model':db[_0x28d4a6['model']],'as':_0x28d4a6['as'],'attributes':_0x28d4a6[_0x219b('0x1e')],'include':_0x28d4a6['include']?_[_0x219b('0x21')](_0x28d4a6[_0x219b('0x20')],function(_0x1b1c46){return{'model':db[_0x1b1c46[_0x219b('0x22')]],'as':_0x1b1c46['as'],'attributes':_0x1b1c46['attributes'],'include':_0x1b1c46[_0x219b('0x20')]?_[_0x219b('0x21')](_0x1b1c46['include'],function(_0x432ef7){return{'model':db[_0x432ef7[_0x219b('0x22')]],'as':_0x432ef7['as'],'attributes':_0x432ef7['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3fa424){logger['info'](_0x219b('0x24'),_0x242e41);logger[_0x219b('0x14')](_0x219b('0x24'),_0x242e41,JSON[_0x219b('0x15')](_0x3fa424));_0x5d0dd7(_0x3fa424);})[_0x219b('0x23')](function(_0x19e29d){logger[_0x219b('0x16')]('ShowSmsQueue',_0x19e29d[_0x219b('0x17')],_0x242e41);_0x1a25c4(_0x59eb1f[_0x219b('0x16')](0x1f4,_0x19e29d[_0x219b('0x17')]));});});}; \ No newline at end of file +var _0xb89f=['register','request','info','SmsQueue,\x20%s,\x20%s','request\x20sent','error','message','result','catch','GetSmsQueue','SmsQueue','findAll','options','raw','where','attributes','limit','include','map','model','then','debug','stringify','ShowSmsQueue','find','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost'];(function(_0x5746a1,_0x11eab1){var _0x551a43=function(_0x7ddcbe){while(--_0x7ddcbe){_0x5746a1['push'](_0x5746a1['shift']());}};_0x551a43(++_0x11eab1);}(_0xb89f,0xdc));var _0xfb89=function(_0x4ca288,_0x13a1ea){_0x4ca288=_0x4ca288-0x0;var _0x31a2ae=_0xb89f[_0x4ca288];return _0x31a2ae;};'use strict';var _=require(_0xfb89('0x0'));var util=require(_0xfb89('0x1'));var moment=require('moment');var BPromise=require(_0xfb89('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfb89('0x3'));var db=require(_0xfb89('0x4'))['db'];var utils=require(_0xfb89('0x5'));var logger=require(_0xfb89('0x6'))('rpc');var config=require(_0xfb89('0x7'));var jayson=require(_0xfb89('0x8'));var client=jayson[_0xfb89('0x9')][_0xfb89('0xa')]({'port':0x232a});config[_0xfb89('0xb')]=_[_0xfb89('0xc')](config[_0xfb89('0xb')],{'host':_0xfb89('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./smsQueue.socket')[_0xfb89('0xe')](socket);function respondWithRpcPromise(_0x21556a,_0x2ae30b,_0x4f7c74){return new BPromise(function(_0x579b3b,_0x3ad8c7){return client[_0xfb89('0xf')](_0x21556a,_0x4f7c74)['then'](function(_0x2d775a){logger[_0xfb89('0x10')](_0xfb89('0x11'),_0x2ae30b,_0xfb89('0x12'));logger['debug']('SmsQueue,\x20%s,\x20%s,\x20%s',_0x2ae30b,_0xfb89('0x12'),JSON['stringify'](_0x2d775a));if(_0x2d775a[_0xfb89('0x13')]){if(_0x2d775a[_0xfb89('0x13')]['code']===0x1f4){logger[_0xfb89('0x13')](_0xfb89('0x11'),_0x2ae30b,_0x2d775a[_0xfb89('0x13')]['message']);return _0x3ad8c7(_0x2d775a['error'][_0xfb89('0x14')]);}logger[_0xfb89('0x13')]('SmsQueue,\x20%s,\x20%s',_0x2ae30b,_0x2d775a[_0xfb89('0x13')][_0xfb89('0x14')]);return _0x579b3b(_0x2d775a[_0xfb89('0x13')][_0xfb89('0x14')]);}else{logger[_0xfb89('0x10')](_0xfb89('0x11'),_0x2ae30b,_0xfb89('0x12'));_0x579b3b(_0x2d775a[_0xfb89('0x15')][_0xfb89('0x14')]);}})[_0xfb89('0x16')](function(_0x368e10){logger[_0xfb89('0x13')](_0xfb89('0x11'),_0x2ae30b,_0x368e10);_0x3ad8c7(_0x368e10);});});}exports[_0xfb89('0x17')]=function(_0x35a5bd){var _0x371a3d=this;return new Promise(function(_0x1fa43a,_0x549095){return db[_0xfb89('0x18')][_0xfb89('0x19')]({'raw':_0x35a5bd[_0xfb89('0x1a')]?_0x35a5bd[_0xfb89('0x1a')][_0xfb89('0x1b')]===undefined?!![]:![]:!![],'where':_0x35a5bd[_0xfb89('0x1a')]?_0x35a5bd['options'][_0xfb89('0x1c')]||null:null,'attributes':_0x35a5bd[_0xfb89('0x1a')]?_0x35a5bd[_0xfb89('0x1a')][_0xfb89('0x1d')]||null:null,'limit':_0x35a5bd['options']?_0x35a5bd[_0xfb89('0x1a')][_0xfb89('0x1e')]||null:null,'include':_0x35a5bd[_0xfb89('0x1a')]?_0x35a5bd[_0xfb89('0x1a')][_0xfb89('0x1f')]?_[_0xfb89('0x20')](_0x35a5bd['options'][_0xfb89('0x1f')],function(_0x1c5384){return{'model':db[_0x1c5384[_0xfb89('0x21')]],'as':_0x1c5384['as'],'attributes':_0x1c5384['attributes'],'include':_0x1c5384[_0xfb89('0x1f')]?_[_0xfb89('0x20')](_0x1c5384[_0xfb89('0x1f')],function(_0x478671){return{'model':db[_0x478671[_0xfb89('0x21')]],'as':_0x478671['as'],'attributes':_0x478671['attributes'],'include':_0x478671[_0xfb89('0x1f')]?_[_0xfb89('0x20')](_0x478671['include'],function(_0x2e52ad){return{'model':db[_0x2e52ad[_0xfb89('0x21')]],'as':_0x2e52ad['as'],'attributes':_0x2e52ad[_0xfb89('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xfb89('0x22')](function(_0x5a9cde){logger['info'](_0xfb89('0x17'),_0x35a5bd);logger[_0xfb89('0x23')](_0xfb89('0x17'),_0x35a5bd,JSON[_0xfb89('0x24')](_0x5a9cde));_0x1fa43a(_0x5a9cde);})[_0xfb89('0x16')](function(_0x2802f2){logger[_0xfb89('0x13')](_0xfb89('0x17'),_0x2802f2[_0xfb89('0x14')],_0x35a5bd);_0x549095(_0x371a3d[_0xfb89('0x13')](0x1f4,_0x2802f2[_0xfb89('0x14')]));});});};exports[_0xfb89('0x25')]=function(_0x99c4cf){var _0x1124f8=this;return new Promise(function(_0xbb075d,_0x5dc4fb){return db['SmsQueue'][_0xfb89('0x26')]({'raw':_0x99c4cf[_0xfb89('0x1a')]?_0x99c4cf['options']['raw']===undefined?!![]:![]:!![],'where':_0x99c4cf['options']?_0x99c4cf['options'][_0xfb89('0x1c')]||null:null,'attributes':_0x99c4cf[_0xfb89('0x1a')]?_0x99c4cf[_0xfb89('0x1a')][_0xfb89('0x1d')]||null:null,'include':_0x99c4cf[_0xfb89('0x1a')]?_0x99c4cf[_0xfb89('0x1a')][_0xfb89('0x1f')]?_[_0xfb89('0x20')](_0x99c4cf[_0xfb89('0x1a')][_0xfb89('0x1f')],function(_0x4a1442){return{'model':db[_0x4a1442[_0xfb89('0x21')]],'as':_0x4a1442['as'],'attributes':_0x4a1442[_0xfb89('0x1d')],'include':_0x4a1442[_0xfb89('0x1f')]?_['map'](_0x4a1442[_0xfb89('0x1f')],function(_0x351434){return{'model':db[_0x351434[_0xfb89('0x21')]],'as':_0x351434['as'],'attributes':_0x351434[_0xfb89('0x1d')],'include':_0x351434['include']?_['map'](_0x351434[_0xfb89('0x1f')],function(_0x4a22a5){return{'model':db[_0x4a22a5[_0xfb89('0x21')]],'as':_0x4a22a5['as'],'attributes':_0x4a22a5[_0xfb89('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xfb89('0x22')](function(_0x4ce957){logger['info'](_0xfb89('0x25'),_0x99c4cf);logger[_0xfb89('0x23')](_0xfb89('0x25'),_0x99c4cf,JSON[_0xfb89('0x24')](_0x4ce957));_0xbb075d(_0x4ce957);})[_0xfb89('0x16')](function(_0x331b58){logger[_0xfb89('0x13')]('ShowSmsQueue',_0x331b58[_0xfb89('0x14')],_0x99c4cf);_0x5dc4fb(_0x1124f8[_0xfb89('0x13')](0x1f4,_0x331b58[_0xfb89('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index ea1da52..17f77d2 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 _0x6018=['./smsQueue.events','save','remove','emit','removeListener','register'];(function(_0x397cfb,_0xb8f317){var _0x15fed9=function(_0x3eba43){while(--_0x3eba43){_0x397cfb['push'](_0x397cfb['shift']());}};_0x15fed9(++_0xb8f317);}(_0x6018,0xba));var _0x8601=function(_0x16ec75,_0x586479){_0x16ec75=_0x16ec75-0x0;var _0x537eb8=_0x6018[_0x16ec75];return _0x537eb8;};'use strict';var SmsQueueEvents=require(_0x8601('0x0'));var events=[_0x8601('0x1'),_0x8601('0x2'),'update'];function createListener(_0x441750,_0x4a601a){return function(_0x14e035){_0x4a601a[_0x8601('0x3')](_0x441750,_0x14e035);};}function removeListener(_0x52a48a,_0x3bc039){return function(){SmsQueueEvents[_0x8601('0x4')](_0x52a48a,_0x3bc039);};}exports[_0x8601('0x5')]=function(_0xf93a56){for(var _0x3375e7=0x0,_0x39d68d=events['length'];_0x3375e7<_0x39d68d;_0x3375e7++){var _0x1a6265=events[_0x3375e7];var _0xbc48ee=createListener('smsQueue:'+_0x1a6265,_0xf93a56);SmsQueueEvents['on'](_0x1a6265,_0xbc48ee);}}; \ No newline at end of file +var _0x8e12=['remove','removeListener','register','length','smsQueue:','./smsQueue.events'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x8e12,0x161));var _0x28e1=function(_0xe14054,_0x29faf6){_0xe14054=_0xe14054-0x0;var _0x1e8862=_0x8e12[_0xe14054];return _0x1e8862;};'use strict';var SmsQueueEvents=require(_0x28e1('0x0'));var events=['save',_0x28e1('0x1'),'update'];function createListener(_0x2eabf1,_0x295945){return function(_0x223b1b){_0x295945['emit'](_0x2eabf1,_0x223b1b);};}function removeListener(_0x5241dc,_0x4414a0){return function(){SmsQueueEvents[_0x28e1('0x2')](_0x5241dc,_0x4414a0);};}exports[_0x28e1('0x3')]=function(_0x25f68e){for(var _0x3ad317=0x0,_0x4b3cf4=events[_0x28e1('0x4')];_0x3ad317<_0x4b3cf4;_0x3ad317++){var _0x3a0234=events[_0x3ad317];var _0x20b0c6=createListener(_0x28e1('0x5')+_0x3a0234,_0x25f68e);SmsQueueEvents['on'](_0x3a0234,_0x20b0c6);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 862891e..36af113 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 _0x3f54=['destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','/:id','show','create'];(function(_0x30f0a7,_0x4bdcfe){var _0x3f2fd4=function(_0x41d15e){while(--_0x41d15e){_0x30f0a7['push'](_0x30f0a7['shift']());}};_0x3f2fd4(++_0x4bdcfe);}(_0x3f54,0x68));var _0x43f5=function(_0x32e649,_0x228649){_0x32e649=_0x32e649-0x0;var _0x14d386=_0x3f54[_0x32e649];return _0x14d386;};'use strict';var multer=require('multer');var util=require(_0x43f5('0x0'));var path=require(_0x43f5('0x1'));var timeout=require(_0x43f5('0x2'));var express=require(_0x43f5('0x3'));var router=express[_0x43f5('0x4')]();var fs_extra=require(_0x43f5('0x5'));var auth=require(_0x43f5('0x6'));var interaction=require(_0x43f5('0x7'));var config=require(_0x43f5('0x8'));var controller=require('./smsQueueReport.controller');router[_0x43f5('0x9')]('/',auth[_0x43f5('0xa')](),controller['index']);router['get']('/describe',auth[_0x43f5('0xa')](),controller[_0x43f5('0xb')]);router['get'](_0x43f5('0xc'),auth['isAuthenticated'](),controller[_0x43f5('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x43f5('0xe')]);router['put'](_0x43f5('0xc'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x43f5('0xa')](),controller[_0x43f5('0xf')]);module[_0x43f5('0x10')]=router; \ No newline at end of file +var _0xa33c=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','update','delete','exports','multer','path','connect-timeout','express','Router'];(function(_0x471f8f,_0x2eaaf8){var _0x31da61=function(_0x44d464){while(--_0x44d464){_0x471f8f['push'](_0x471f8f['shift']());}};_0x31da61(++_0x2eaaf8);}(_0xa33c,0x64));var _0xca33=function(_0x2ce40d,_0x11e919){_0x2ce40d=_0x2ce40d-0x0;var _0x4f7734=_0xa33c[_0x2ce40d];return _0x4f7734;};'use strict';var multer=require(_0xca33('0x0'));var util=require('util');var path=require(_0xca33('0x1'));var timeout=require(_0xca33('0x2'));var express=require(_0xca33('0x3'));var router=express[_0xca33('0x4')]();var fs_extra=require(_0xca33('0x5'));var auth=require(_0xca33('0x6'));var interaction=require(_0xca33('0x7'));var config=require(_0xca33('0x8'));var controller=require(_0xca33('0x9'));router[_0xca33('0xa')]('/',auth[_0xca33('0xb')](),controller[_0xca33('0xc')]);router[_0xca33('0xa')]('/describe',auth[_0xca33('0xb')](),controller[_0xca33('0xd')]);router[_0xca33('0xa')](_0xca33('0xe'),auth[_0xca33('0xb')](),controller[_0xca33('0xf')]);router[_0xca33('0x10')]('/',auth['isAuthenticated'](),controller[_0xca33('0x11')]);router['put'](_0xca33('0xe'),auth['isAuthenticated'](),controller[_0xca33('0x12')]);router[_0xca33('0x13')](_0xca33('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0xca33('0x14')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index b5053d1..e903284 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 _0x3b86=['STRING','DATE','moment'];(function(_0x49748c,_0x3d2005){var _0xedf6b6=function(_0x11628d){while(--_0x11628d){_0x49748c['push'](_0x49748c['shift']());}};_0xedf6b6(++_0x3d2005);}(_0x3b86,0xa1));var _0x63b8=function(_0x36123b,_0x11d60c){_0x36123b=_0x36123b-0x0;var _0x50677f=_0x3b86[_0x36123b];return _0x50677f;};'use strict';var moment=require(_0x63b8('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x63b8('0x1')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x63b8('0x2')]},'leaveAt':{'type':Sequelize[_0x63b8('0x2')]},'acceptAt':{'type':Sequelize[_0x63b8('0x2')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x63b8('0x1')]}}; \ No newline at end of file +var _0x7548=['STRING','DATE'];(function(_0xc1a8d9,_0x257549){var _0x38169e=function(_0x11fc01){while(--_0x11fc01){_0xc1a8d9['push'](_0xc1a8d9['shift']());}};_0x38169e(++_0x257549);}(_0x7548,0x1d8));var _0x8754=function(_0x65b2f5,_0x5d5635){_0x65b2f5=_0x65b2f5-0x0;var _0x3719c8=_0x7548[_0x65b2f5];return _0x3719c8;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x8754('0x0')],'allowNull':![]},'from':{'type':Sequelize[_0x8754('0x0')]},'joinAt':{'type':Sequelize[_0x8754('0x1')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x8754('0x1')]},'reason':{'type':Sequelize[_0x8754('0x0')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 40594fe..2e8f14e 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 _0x655d=['mustache','util','path','sox','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','then','destroy','stack','name','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','filter','SmsQueueReport','includeAll','findAll','rows','show','include','find','create','body','catch','update','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0x655d,0x1b0));var _0xd655=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x655d[_0x27af45];return _0x18df21;};'use strict';var emlformat=require(_0xd655('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd655('0x1'));var jsonpatch=require(_0xd655('0x2'));var rp=require(_0xd655('0x3'));var moment=require(_0xd655('0x4'));var BPromise=require(_0xd655('0x5'));var Mustache=require(_0xd655('0x6'));var util=require(_0xd655('0x7'));var path=require(_0xd655('0x8'));var sox=require(_0xd655('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd655('0xa'));var _=require(_0xd655('0xb'));var squel=require(_0xd655('0xc'));var crypto=require('crypto');var jsforce=require(_0xd655('0xd'));var deskjs=require(_0xd655('0xe'));var toCsv=require(_0xd655('0xf'));var querystring=require(_0xd655('0x10'));var Papa=require(_0xd655('0x11'));var Redis=require(_0xd655('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xd655('0x13'));var as=require(_0xd655('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd655('0x15'));var utils=require(_0xd655('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xd655('0x17'));var db=require(_0xd655('0x18'))['db'];function respondWithStatusCode(_0x114068,_0x439f22){_0x439f22=_0x439f22||0xcc;return function(_0x29c90c){if(_0x29c90c){return _0x114068['sendStatus'](_0x439f22);}return _0x114068[_0xd655('0x19')](_0x439f22)[_0xd655('0x1a')]();};}function respondWithResult(_0x308a48,_0x2b894b){_0x2b894b=_0x2b894b||0xc8;return function(_0x42142f){if(_0x42142f){return _0x308a48[_0xd655('0x19')](_0x2b894b)[_0xd655('0x1b')](_0x42142f);}};}function respondWithFilteredResult(_0x56da21,_0x41ee83){return function(_0x6f50c3){if(_0x6f50c3){var _0x42474d=typeof _0x41ee83[_0xd655('0x1c')]===_0xd655('0x1d')&&typeof _0x41ee83[_0xd655('0x1e')]===_0xd655('0x1d');var _0x48c620=_0x6f50c3[_0xd655('0x1f')];var _0xab8358=_0x42474d?0x0:_0x41ee83['offset'];var _0xbb44fa=_0x42474d?_0x6f50c3[_0xd655('0x1f')]:_0x41ee83[_0xd655('0x1c')]+_0x41ee83[_0xd655('0x1e')];var _0x6e6f61;if(_0xbb44fa>=_0x48c620){_0xbb44fa=_0x48c620;_0x6e6f61=0xc8;}else{_0x6e6f61=0xce;}_0x56da21[_0xd655('0x19')](_0x6e6f61);return _0x56da21['set'](_0xd655('0x20'),_0xab8358+'-'+_0xbb44fa+'/'+_0x48c620)[_0xd655('0x1b')](_0x6f50c3);}return null;};}function patchUpdates(_0x29f740){return function(_0x37c0c9){try{jsonpatch[_0xd655('0x21')](_0x37c0c9,_0x29f740,!![]);}catch(_0x5018df){return BPromise[_0xd655('0x22')](_0x5018df);}return _0x37c0c9['save']();};}function saveUpdates(_0x5c92c5,_0x24d2b1){return function(_0x52d9ce){if(_0x52d9ce){return _0x52d9ce['update'](_0x5c92c5)[_0xd655('0x23')](function(_0x449de6){return _0x449de6;});}return null;};}function removeEntity(_0x28bc64,_0x59a41b){return function(_0xf2269e){if(_0xf2269e){return _0xf2269e[_0xd655('0x24')]()[_0xd655('0x23')](function(){_0x28bc64[_0xd655('0x19')](0xcc)[_0xd655('0x1a')]();});}};}function handleEntityNotFound(_0x1c3636,_0x241b6f){return function(_0x4e4216){if(!_0x4e4216){_0x1c3636['sendStatus'](0x194);}return _0x4e4216;};}function handleError(_0xe19e3c,_0x595951){_0x595951=_0x595951||0x1f4;return function(_0x2b2f4a){logger['error'](_0x2b2f4a[_0xd655('0x25')]);if(_0x2b2f4a[_0xd655('0x26')]){delete _0x2b2f4a[_0xd655('0x26')];}_0xe19e3c[_0xd655('0x19')](_0x595951)['send'](_0x2b2f4a);};}exports['index']=function(_0xddcee9,_0x478264){var _0x5621f6={},_0x4f3323={},_0x4e5e1f={'count':0x0,'rows':[]};var _0x55033e=_['map'](db['SmsQueueReport'][_0xd655('0x27')],function(_0x6c5626){return{'name':_0x6c5626[_0xd655('0x28')],'type':_0x6c5626[_0xd655('0x29')][_0xd655('0x2a')]};});_0x4f3323[_0xd655('0x2b')]=_[_0xd655('0x2c')](_0x55033e,'name');_0x4f3323[_0xd655('0x2d')]=_[_0xd655('0x2e')](_0xddcee9[_0xd655('0x2d')]);_0x4f3323[_0xd655('0x2f')]=_[_0xd655('0x30')](_0x4f3323['model'],_0x4f3323[_0xd655('0x2d')]);_0x5621f6['attributes']=_[_0xd655('0x30')](_0x4f3323['model'],qs[_0xd655('0x31')](_0xddcee9['query']['fields']));_0x5621f6[_0xd655('0x32')]=_0x5621f6[_0xd655('0x32')][_0xd655('0x33')]?_0x5621f6[_0xd655('0x32')]:_0x4f3323[_0xd655('0x2b')];if(!_0xddcee9[_0xd655('0x2d')][_0xd655('0x34')](_0xd655('0x35'))){_0x5621f6[_0xd655('0x1e')]=qs[_0xd655('0x1e')](_0xddcee9['query'][_0xd655('0x1e')]);_0x5621f6[_0xd655('0x1c')]=qs['offset'](_0xddcee9[_0xd655('0x2d')][_0xd655('0x1c')]);}_0x5621f6[_0xd655('0x36')]=qs['sort'](_0xddcee9[_0xd655('0x2d')][_0xd655('0x37')]);_0x5621f6['where']=qs['filters'](_[_0xd655('0x38')](_0xddcee9[_0xd655('0x2d')],_0x4f3323[_0xd655('0x2f')]),_0x55033e);if(_0xddcee9[_0xd655('0x2d')]['filter']){_0x5621f6[_0xd655('0x39')]=_[_0xd655('0x3a')](_0x5621f6[_0xd655('0x39')],{'$or':_[_0xd655('0x2c')](_0x55033e,function(_0x5ecc30){if(_0x5ecc30[_0xd655('0x29')]!=='VIRTUAL'){var _0xb49c1={};_0xb49c1[_0x5ecc30['name']]={'$like':'%'+_0xddcee9['query'][_0xd655('0x3b')]+'%'};return _0xb49c1;}})});}_0x5621f6=_[_0xd655('0x3a')]({},_0x5621f6,_0xddcee9['options']);var _0x3ff9d0={'where':_0x5621f6['where']};return db[_0xd655('0x3c')]['count'](_0x3ff9d0)[_0xd655('0x23')](function(_0x2849ab){_0x4e5e1f[_0xd655('0x1f')]=_0x2849ab;if(_0xddcee9[_0xd655('0x2d')][_0xd655('0x3d')]){_0x5621f6['include']=[{'all':!![]}];}return db[_0xd655('0x3c')][_0xd655('0x3e')](_0x5621f6);})[_0xd655('0x23')](function(_0x4a2508){_0x4e5e1f[_0xd655('0x3f')]=_0x4a2508;return _0x4e5e1f;})[_0xd655('0x23')](respondWithFilteredResult(_0x478264,_0x5621f6))['catch'](handleError(_0x478264,null));};exports[_0xd655('0x40')]=function(_0x1b01f4,_0x15139a){var _0x344deb={'raw':!![],'where':{'id':_0x1b01f4['params']['id']}},_0x2f1f25={};_0x2f1f25[_0xd655('0x2b')]=_[_0xd655('0x2e')](db[_0xd655('0x3c')][_0xd655('0x27')]);_0x2f1f25[_0xd655('0x2d')]=_[_0xd655('0x2e')](_0x1b01f4[_0xd655('0x2d')]);_0x2f1f25[_0xd655('0x2f')]=_['intersection'](_0x2f1f25[_0xd655('0x2b')],_0x2f1f25[_0xd655('0x2d')]);_0x344deb[_0xd655('0x32')]=_['intersection'](_0x2f1f25['model'],qs['fields'](_0x1b01f4[_0xd655('0x2d')][_0xd655('0x31')]));_0x344deb[_0xd655('0x32')]=_0x344deb[_0xd655('0x32')][_0xd655('0x33')]?_0x344deb[_0xd655('0x32')]:_0x2f1f25['model'];if(_0x1b01f4[_0xd655('0x2d')][_0xd655('0x3d')]){_0x344deb[_0xd655('0x41')]=[{'all':!![]}];}_0x344deb=_[_0xd655('0x3a')]({},_0x344deb,_0x1b01f4['options']);return db[_0xd655('0x3c')][_0xd655('0x42')](_0x344deb)[_0xd655('0x23')](handleEntityNotFound(_0x15139a,null))[_0xd655('0x23')](respondWithResult(_0x15139a,null))['catch'](handleError(_0x15139a,null));};exports[_0xd655('0x43')]=function(_0x5664e2,_0x321346){return db[_0xd655('0x3c')]['create'](_0x5664e2[_0xd655('0x44')],{})[_0xd655('0x23')](respondWithResult(_0x321346,0xc9))[_0xd655('0x45')](handleError(_0x321346,null));};exports[_0xd655('0x46')]=function(_0x550f7a,_0x375737){if(_0x550f7a[_0xd655('0x44')]['id']){delete _0x550f7a[_0xd655('0x44')]['id'];}return db[_0xd655('0x3c')]['find']({'where':{'id':_0x550f7a[_0xd655('0x47')]['id']}})[_0xd655('0x23')](handleEntityNotFound(_0x375737,null))[_0xd655('0x23')](saveUpdates(_0x550f7a[_0xd655('0x44')],null))[_0xd655('0x23')](respondWithResult(_0x375737,null))[_0xd655('0x45')](handleError(_0x375737,null));};exports[_0xd655('0x24')]=function(_0x5bb27a,_0x22ac8f){return db[_0xd655('0x3c')][_0xd655('0x42')]({'where':{'id':_0x5bb27a['params']['id']}})[_0xd655('0x23')](handleEntityNotFound(_0x22ac8f,null))[_0xd655('0x23')](removeEntity(_0x22ac8f,null))[_0xd655('0x45')](handleError(_0x22ac8f,null));};exports['describe']=function(_0x25ad9d,_0x525776){return db['SmsQueueReport'][_0xd655('0x48')]()['then'](respondWithResult(_0x525776,null))[_0xd655('0x45')](handleError(_0x525776,null));}; \ No newline at end of file +var _0x6da7=['model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','find','create','catch','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','index','SmsQueueReport','rawAttributes','fieldName','type','key'];(function(_0x35f3ae,_0x322c11){var _0x2ba291=function(_0x4823fc){while(--_0x4823fc){_0x35f3ae['push'](_0x35f3ae['shift']());}};_0x2ba291(++_0x322c11);}(_0x6da7,0x1ea));var _0x76da=function(_0x8d7297,_0x2634cd){_0x8d7297=_0x8d7297-0x0;var _0x17d413=_0x6da7[_0x8d7297];return _0x17d413;};'use strict';var emlformat=require(_0x76da('0x0'));var rimraf=require(_0x76da('0x1'));var zipdir=require(_0x76da('0x2'));var jsonpatch=require(_0x76da('0x3'));var rp=require(_0x76da('0x4'));var moment=require(_0x76da('0x5'));var BPromise=require(_0x76da('0x6'));var Mustache=require('mustache');var util=require(_0x76da('0x7'));var path=require(_0x76da('0x8'));var sox=require(_0x76da('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x76da('0xa'));var squel=require(_0x76da('0xb'));var crypto=require(_0x76da('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x76da('0xd'));var toCsv=require(_0x76da('0xe'));var querystring=require(_0x76da('0xf'));var Papa=require(_0x76da('0x10'));var Redis=require(_0x76da('0x11'));var authService=require(_0x76da('0x12'));var qs=require(_0x76da('0x13'));var as=require(_0x76da('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x76da('0x15'));var utils=require(_0x76da('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x76da('0x17'));var db=require(_0x76da('0x18'))['db'];function respondWithStatusCode(_0x17c32b,_0x158d7a){_0x158d7a=_0x158d7a||0xcc;return function(_0xad3c14){if(_0xad3c14){return _0x17c32b[_0x76da('0x19')](_0x158d7a);}return _0x17c32b[_0x76da('0x1a')](_0x158d7a)[_0x76da('0x1b')]();};}function respondWithResult(_0xe6dd98,_0x29aebe){_0x29aebe=_0x29aebe||0xc8;return function(_0x547602){if(_0x547602){return _0xe6dd98['status'](_0x29aebe)['json'](_0x547602);}};}function respondWithFilteredResult(_0x1eb696,_0x1aaa71){return function(_0x142bec){if(_0x142bec){var _0x3994ff=typeof _0x1aaa71[_0x76da('0x1c')]===_0x76da('0x1d')&&typeof _0x1aaa71[_0x76da('0x1e')]===_0x76da('0x1d');var _0x366c63=_0x142bec[_0x76da('0x1f')];var _0x4fefc3=_0x3994ff?0x0:_0x1aaa71[_0x76da('0x1c')];var _0x1db40e=_0x3994ff?_0x142bec['count']:_0x1aaa71[_0x76da('0x1c')]+_0x1aaa71[_0x76da('0x1e')];var _0x800e4b;if(_0x1db40e>=_0x366c63){_0x1db40e=_0x366c63;_0x800e4b=0xc8;}else{_0x800e4b=0xce;}_0x1eb696['status'](_0x800e4b);return _0x1eb696[_0x76da('0x20')](_0x76da('0x21'),_0x4fefc3+'-'+_0x1db40e+'/'+_0x366c63)[_0x76da('0x22')](_0x142bec);}return null;};}function patchUpdates(_0x246ac0){return function(_0x446dc4){try{jsonpatch[_0x76da('0x23')](_0x446dc4,_0x246ac0,!![]);}catch(_0x59ee0f){return BPromise[_0x76da('0x24')](_0x59ee0f);}return _0x446dc4[_0x76da('0x25')]();};}function saveUpdates(_0x40ebeb,_0x36135a){return function(_0x33a2fe){if(_0x33a2fe){return _0x33a2fe[_0x76da('0x26')](_0x40ebeb)[_0x76da('0x27')](function(_0x5c8555){return _0x5c8555;});}return null;};}function removeEntity(_0x116424,_0x24a3e7){return function(_0x22ba93){if(_0x22ba93){return _0x22ba93[_0x76da('0x28')]()[_0x76da('0x27')](function(){_0x116424[_0x76da('0x1a')](0xcc)[_0x76da('0x1b')]();});}};}function handleEntityNotFound(_0xa9b924,_0x137558){return function(_0x2a0951){if(!_0x2a0951){_0xa9b924[_0x76da('0x19')](0x194);}return _0x2a0951;};}function handleError(_0x3cb947,_0x40d4af){_0x40d4af=_0x40d4af||0x1f4;return function(_0x3033b2){logger['error'](_0x3033b2[_0x76da('0x29')]);if(_0x3033b2[_0x76da('0x2a')]){delete _0x3033b2['name'];}_0x3cb947['status'](_0x40d4af)['send'](_0x3033b2);};}exports[_0x76da('0x2b')]=function(_0x3ef6b7,_0x4f55e7){var _0x3f7f8c={},_0x2856c5={},_0x3a533e={'count':0x0,'rows':[]};var _0x501d8b=_['map'](db[_0x76da('0x2c')][_0x76da('0x2d')],function(_0x3b13bf){return{'name':_0x3b13bf[_0x76da('0x2e')],'type':_0x3b13bf[_0x76da('0x2f')][_0x76da('0x30')]};});_0x2856c5[_0x76da('0x31')]=_[_0x76da('0x32')](_0x501d8b,_0x76da('0x2a'));_0x2856c5[_0x76da('0x33')]=_[_0x76da('0x34')](_0x3ef6b7[_0x76da('0x33')]);_0x2856c5[_0x76da('0x35')]=_[_0x76da('0x36')](_0x2856c5[_0x76da('0x31')],_0x2856c5[_0x76da('0x33')]);_0x3f7f8c[_0x76da('0x37')]=_['intersection'](_0x2856c5[_0x76da('0x31')],qs[_0x76da('0x38')](_0x3ef6b7[_0x76da('0x33')]['fields']));_0x3f7f8c[_0x76da('0x37')]=_0x3f7f8c[_0x76da('0x37')][_0x76da('0x39')]?_0x3f7f8c['attributes']:_0x2856c5[_0x76da('0x31')];if(!_0x3ef6b7[_0x76da('0x33')][_0x76da('0x3a')]('nolimit')){_0x3f7f8c[_0x76da('0x1e')]=qs['limit'](_0x3ef6b7[_0x76da('0x33')][_0x76da('0x1e')]);_0x3f7f8c[_0x76da('0x1c')]=qs[_0x76da('0x1c')](_0x3ef6b7[_0x76da('0x33')][_0x76da('0x1c')]);}_0x3f7f8c[_0x76da('0x3b')]=qs[_0x76da('0x3c')](_0x3ef6b7[_0x76da('0x33')]['sort']);_0x3f7f8c[_0x76da('0x3d')]=qs[_0x76da('0x35')](_[_0x76da('0x3e')](_0x3ef6b7[_0x76da('0x33')],_0x2856c5['filters']),_0x501d8b);if(_0x3ef6b7[_0x76da('0x33')][_0x76da('0x3f')]){_0x3f7f8c[_0x76da('0x3d')]=_[_0x76da('0x40')](_0x3f7f8c[_0x76da('0x3d')],{'$or':_[_0x76da('0x32')](_0x501d8b,function(_0x32d45c){if(_0x32d45c['type']!==_0x76da('0x41')){var _0x1bdd31={};_0x1bdd31[_0x32d45c[_0x76da('0x2a')]]={'$like':'%'+_0x3ef6b7[_0x76da('0x33')][_0x76da('0x3f')]+'%'};return _0x1bdd31;}})});}_0x3f7f8c=_['merge']({},_0x3f7f8c,_0x3ef6b7[_0x76da('0x42')]);var _0x4aa443={'where':_0x3f7f8c['where']};return db[_0x76da('0x2c')][_0x76da('0x1f')](_0x4aa443)[_0x76da('0x27')](function(_0x295e9c){_0x3a533e['count']=_0x295e9c;if(_0x3ef6b7[_0x76da('0x33')][_0x76da('0x43')]){_0x3f7f8c[_0x76da('0x44')]=[{'all':!![]}];}return db[_0x76da('0x2c')]['findAll'](_0x3f7f8c);})[_0x76da('0x27')](function(_0x2a2155){_0x3a533e[_0x76da('0x45')]=_0x2a2155;return _0x3a533e;})[_0x76da('0x27')](respondWithFilteredResult(_0x4f55e7,_0x3f7f8c))['catch'](handleError(_0x4f55e7,null));};exports[_0x76da('0x46')]=function(_0x144e9b,_0x34bf6a){var _0x247ec7={'raw':!![],'where':{'id':_0x144e9b['params']['id']}},_0x99b4ec={};_0x99b4ec['model']=_[_0x76da('0x34')](db[_0x76da('0x2c')][_0x76da('0x2d')]);_0x99b4ec[_0x76da('0x33')]=_[_0x76da('0x34')](_0x144e9b['query']);_0x99b4ec[_0x76da('0x35')]=_[_0x76da('0x36')](_0x99b4ec[_0x76da('0x31')],_0x99b4ec['query']);_0x247ec7['attributes']=_['intersection'](_0x99b4ec[_0x76da('0x31')],qs['fields'](_0x144e9b[_0x76da('0x33')][_0x76da('0x38')]));_0x247ec7[_0x76da('0x37')]=_0x247ec7[_0x76da('0x37')]['length']?_0x247ec7[_0x76da('0x37')]:_0x99b4ec['model'];if(_0x144e9b['query']['includeAll']){_0x247ec7['include']=[{'all':!![]}];}_0x247ec7=_[_0x76da('0x40')]({},_0x247ec7,_0x144e9b[_0x76da('0x42')]);return db['SmsQueueReport'][_0x76da('0x47')](_0x247ec7)[_0x76da('0x27')](handleEntityNotFound(_0x34bf6a,null))[_0x76da('0x27')](respondWithResult(_0x34bf6a,null))['catch'](handleError(_0x34bf6a,null));};exports[_0x76da('0x48')]=function(_0x3097bf,_0x564cd0){return db[_0x76da('0x2c')][_0x76da('0x48')](_0x3097bf['body'],{})[_0x76da('0x27')](respondWithResult(_0x564cd0,0xc9))[_0x76da('0x49')](handleError(_0x564cd0,null));};exports[_0x76da('0x26')]=function(_0x1e10b1,_0xf2e448){if(_0x1e10b1[_0x76da('0x4a')]['id']){delete _0x1e10b1[_0x76da('0x4a')]['id'];}return db[_0x76da('0x2c')][_0x76da('0x47')]({'where':{'id':_0x1e10b1[_0x76da('0x4b')]['id']}})[_0x76da('0x27')](handleEntityNotFound(_0xf2e448,null))[_0x76da('0x27')](saveUpdates(_0x1e10b1[_0x76da('0x4a')],null))[_0x76da('0x27')](respondWithResult(_0xf2e448,null))['catch'](handleError(_0xf2e448,null));};exports[_0x76da('0x28')]=function(_0x5a2568,_0x4371dc){return db[_0x76da('0x2c')][_0x76da('0x47')]({'where':{'id':_0x5a2568['params']['id']}})['then'](handleEntityNotFound(_0x4371dc,null))[_0x76da('0x27')](removeEntity(_0x4371dc,null))[_0x76da('0x49')](handleError(_0x4371dc,null));};exports[_0x76da('0x4c')]=function(_0x5a35d8,_0x252c95){return db[_0x76da('0x2c')]['describe']()[_0x76da('0x27')](respondWithResult(_0x252c95,null))[_0x76da('0x49')](handleError(_0x252c95,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 5cd1bb0..34d8bf7 100644 --- a/server/api/smsQueueReport/smsQueueReport.model.js +++ b/server/api/smsQueueReport/smsQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','define','SmsQueueReport','uniqueid','lodash'];(function(_0x26835b,_0x304e35){var _0x301f13=function(_0x20c770){while(--_0x20c770){_0x26835b['push'](_0x26835b['shift']());}};_0x301f13(++_0x304e35);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1fc122,_0x5e2c17){_0x1fc122=_0x1fc122-0x0;var _0xa2cb13=_0xb7e7[_0x1fc122];return _0xa2cb13;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));module['exports']=function(_0x53ed64,_0x333fa4){return _0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x8'),attributes,{'tableName':'report_sms_queue','paranoid':![],'indexes':[{'name':_0x7b7e('0x9'),'fields':[_0x7b7e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['define','SmsQueueReport','uniqueid','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xa9e0[_0x4b7b62];return _0x2280df;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'report_sms_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0a9e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 628d274..9b1c679 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 _0xd596=['create','body','options','limit','UpdateSmsQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','CreateSmsQueueReport','SmsQueueReport'];(function(_0x26d305,_0x570a4d){var _0xbca0c3=function(_0x239bf7){while(--_0x239bf7){_0x26d305['push'](_0x26d305['shift']());}};_0xbca0c3(++_0x570a4d);}(_0xd596,0x65));var _0x6d59=function(_0x2fc012,_0x503e5b){_0x2fc012=_0x2fc012-0x0;var _0x2891f9=_0xd596[_0x2fc012];return _0x2891f9;};'use strict';var _=require(_0x6d59('0x0'));var util=require(_0x6d59('0x1'));var moment=require(_0x6d59('0x2'));var BPromise=require(_0x6d59('0x3'));var rs=require(_0x6d59('0x4'));var fs=require('fs');var Redis=require(_0x6d59('0x5'));var db=require(_0x6d59('0x6'))['db'];var utils=require(_0x6d59('0x7'));var logger=require(_0x6d59('0x8'))(_0x6d59('0x9'));var config=require(_0x6d59('0xa'));var jayson=require(_0x6d59('0xb'));var client=jayson[_0x6d59('0xc')][_0x6d59('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x513bf3,_0x5b927a,_0x425487){return new BPromise(function(_0x4d1b5b,_0x5ab7c5){return client[_0x6d59('0xe')](_0x513bf3,_0x425487)[_0x6d59('0xf')](function(_0x1a9166){logger[_0x6d59('0x10')](_0x6d59('0x11'),_0x5b927a,_0x6d59('0x12'));logger[_0x6d59('0x13')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x5b927a,_0x6d59('0x12'),JSON[_0x6d59('0x14')](_0x1a9166));if(_0x1a9166[_0x6d59('0x15')]){if(_0x1a9166[_0x6d59('0x15')][_0x6d59('0x16')]===0x1f4){logger[_0x6d59('0x15')](_0x6d59('0x11'),_0x5b927a,_0x1a9166[_0x6d59('0x15')][_0x6d59('0x17')]);return _0x5ab7c5(_0x1a9166[_0x6d59('0x15')][_0x6d59('0x17')]);}logger[_0x6d59('0x15')]('SmsQueueReport,\x20%s,\x20%s',_0x5b927a,_0x1a9166[_0x6d59('0x15')][_0x6d59('0x17')]);return _0x4d1b5b(_0x1a9166['error'][_0x6d59('0x17')]);}else{logger['info'](_0x6d59('0x11'),_0x5b927a,_0x6d59('0x12'));_0x4d1b5b(_0x1a9166['result'][_0x6d59('0x17')]);}})[_0x6d59('0x18')](function(_0x1b96ca){logger['error'](_0x6d59('0x11'),_0x5b927a,_0x1b96ca);_0x5ab7c5(_0x1b96ca);});});}exports[_0x6d59('0x19')]=function(_0x358403){var _0x20833c=this;return new Promise(function(_0x9c46fd,_0x53c57b){return db[_0x6d59('0x1a')][_0x6d59('0x1b')](_0x358403[_0x6d59('0x1c')],{'raw':_0x358403[_0x6d59('0x1d')]?_0x358403[_0x6d59('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x6d59('0xf')](function(_0xc2bd1b){logger[_0x6d59('0x10')](_0x6d59('0x19'),_0x358403);logger[_0x6d59('0x13')](_0x6d59('0x19'),_0x358403,JSON[_0x6d59('0x14')](_0xc2bd1b));_0x9c46fd(_0xc2bd1b);})[_0x6d59('0x18')](function(_0x55b245){logger[_0x6d59('0x15')](_0x6d59('0x19'),_0x55b245['message'],_0x358403);_0x53c57b(_0x20833c[_0x6d59('0x15')](0x1f4,_0x55b245[_0x6d59('0x17')]));});});};exports['UpdateSmsQueueReport']=function(_0x1daf36){var _0x5bb029=this;return new Promise(function(_0x1db85a,_0x988a2){return db[_0x6d59('0x1a')]['update'](_0x1daf36[_0x6d59('0x1c')],{'raw':_0x1daf36['options']?_0x1daf36['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1daf36['options']?_0x1daf36[_0x6d59('0x1d')]['where']||null:null,'attributes':_0x1daf36[_0x6d59('0x1d')]?_0x1daf36[_0x6d59('0x1d')]['attributes']||null:null,'limit':_0x1daf36[_0x6d59('0x1d')]?_0x1daf36[_0x6d59('0x1d')][_0x6d59('0x1e')]||null:null})[_0x6d59('0xf')](function(_0x34146){logger['info'](_0x6d59('0x1f'),_0x1daf36);logger[_0x6d59('0x13')](_0x6d59('0x1f'),_0x1daf36,JSON[_0x6d59('0x14')](_0x34146));_0x1db85a(_0x34146);})[_0x6d59('0x18')](function(_0x1563d9){logger[_0x6d59('0x15')](_0x6d59('0x1f'),_0x1563d9[_0x6d59('0x17')],_0x1daf36);_0x988a2(_0x5bb029[_0x6d59('0x15')](0x1f4,_0x1563d9['message']));});});}; \ No newline at end of file +var _0xebf9=['create','body','options','UpdateSmsQueueReport','update','raw','where','attributes','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateSmsQueueReport','SmsQueueReport'];(function(_0x4e5e92,_0x4e657e){var _0x486c68=function(_0x35966f){while(--_0x35966f){_0x4e5e92['push'](_0x4e5e92['shift']());}};_0x486c68(++_0x4e657e);}(_0xebf9,0xe1));var _0x9ebf=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xebf9[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x9ebf('0x0'));var util=require(_0x9ebf('0x1'));var moment=require(_0x9ebf('0x2'));var BPromise=require('bluebird');var rs=require(_0x9ebf('0x3'));var fs=require('fs');var Redis=require(_0x9ebf('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9ebf('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x9ebf('0x6'));var jayson=require(_0x9ebf('0x7'));var client=jayson[_0x9ebf('0x8')][_0x9ebf('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x55d24e,_0x4e3078,_0x5ca9a7){return new BPromise(function(_0x6f601c,_0x496aae){return client['request'](_0x55d24e,_0x5ca9a7)[_0x9ebf('0xa')](function(_0x20f0ec){logger[_0x9ebf('0xb')](_0x9ebf('0xc'),_0x4e3078,_0x9ebf('0xd'));logger[_0x9ebf('0xe')](_0x9ebf('0xf'),_0x4e3078,_0x9ebf('0xd'),JSON[_0x9ebf('0x10')](_0x20f0ec));if(_0x20f0ec[_0x9ebf('0x11')]){if(_0x20f0ec['error'][_0x9ebf('0x12')]===0x1f4){logger['error'](_0x9ebf('0xc'),_0x4e3078,_0x20f0ec[_0x9ebf('0x11')][_0x9ebf('0x13')]);return _0x496aae(_0x20f0ec[_0x9ebf('0x11')]['message']);}logger[_0x9ebf('0x11')]('SmsQueueReport,\x20%s,\x20%s',_0x4e3078,_0x20f0ec[_0x9ebf('0x11')][_0x9ebf('0x13')]);return _0x6f601c(_0x20f0ec[_0x9ebf('0x11')]['message']);}else{logger[_0x9ebf('0xb')]('SmsQueueReport,\x20%s,\x20%s',_0x4e3078,'request\x20sent');_0x6f601c(_0x20f0ec['result'][_0x9ebf('0x13')]);}})[_0x9ebf('0x14')](function(_0x4184c4){logger[_0x9ebf('0x11')](_0x9ebf('0xc'),_0x4e3078,_0x4184c4);_0x496aae(_0x4184c4);});});}exports[_0x9ebf('0x15')]=function(_0x1e376c){var _0x189c40=this;return new Promise(function(_0x380309,_0x1d4dd2){return db[_0x9ebf('0x16')][_0x9ebf('0x17')](_0x1e376c[_0x9ebf('0x18')],{'raw':_0x1e376c[_0x9ebf('0x19')]?_0x1e376c['options']['raw']===undefined?!![]:![]:!![]})[_0x9ebf('0xa')](function(_0x15d010){logger[_0x9ebf('0xb')](_0x9ebf('0x15'),_0x1e376c);logger[_0x9ebf('0xe')](_0x9ebf('0x15'),_0x1e376c,JSON[_0x9ebf('0x10')](_0x15d010));_0x380309(_0x15d010);})[_0x9ebf('0x14')](function(_0xdc7ddd){logger[_0x9ebf('0x11')](_0x9ebf('0x15'),_0xdc7ddd['message'],_0x1e376c);_0x1d4dd2(_0x189c40[_0x9ebf('0x11')](0x1f4,_0xdc7ddd[_0x9ebf('0x13')]));});});};exports[_0x9ebf('0x1a')]=function(_0x5b6f49){var _0x163ea1=this;return new Promise(function(_0x2425af,_0x9e4777){return db[_0x9ebf('0x16')][_0x9ebf('0x1b')](_0x5b6f49[_0x9ebf('0x18')],{'raw':_0x5b6f49[_0x9ebf('0x19')]?_0x5b6f49[_0x9ebf('0x19')][_0x9ebf('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5b6f49[_0x9ebf('0x19')]?_0x5b6f49[_0x9ebf('0x19')][_0x9ebf('0x1d')]||null:null,'attributes':_0x5b6f49[_0x9ebf('0x19')]?_0x5b6f49['options'][_0x9ebf('0x1e')]||null:null,'limit':_0x5b6f49[_0x9ebf('0x19')]?_0x5b6f49[_0x9ebf('0x19')]['limit']||null:null})['then'](function(_0xe23d75){logger[_0x9ebf('0xb')](_0x9ebf('0x1a'),_0x5b6f49);logger[_0x9ebf('0xe')]('UpdateSmsQueueReport',_0x5b6f49,JSON[_0x9ebf('0x10')](_0xe23d75));_0x2425af(_0xe23d75);})[_0x9ebf('0x14')](function(_0x1b2fb5){logger[_0x9ebf('0x11')]('UpdateSmsQueueReport',_0x1b2fb5['message'],_0x5b6f49);_0x9e4777(_0x163ea1[_0x9ebf('0x11')](0x1f4,_0x1b2fb5['message']));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 314b974..4633cab 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 _0x25fa=['isAuthenticated','index','get','/describe','describe','/:id','post','put','update','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','./smsTransferReport.controller'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x25fa,0x109));var _0xa25f=function(_0x1b0691,_0x2f7403){_0x1b0691=_0x1b0691-0x0;var _0xc0f5fd=_0x25fa[_0x1b0691];return _0xc0f5fd;};'use strict';var multer=require(_0xa25f('0x0'));var util=require('util');var path=require(_0xa25f('0x1'));var timeout=require(_0xa25f('0x2'));var express=require('express');var router=express[_0xa25f('0x3')]();var fs_extra=require(_0xa25f('0x4'));var auth=require(_0xa25f('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa25f('0x6'));router['get']('/',auth[_0xa25f('0x7')](),controller[_0xa25f('0x8')]);router[_0xa25f('0x9')](_0xa25f('0xa'),auth[_0xa25f('0x7')](),controller[_0xa25f('0xb')]);router[_0xa25f('0x9')](_0xa25f('0xc'),auth[_0xa25f('0x7')](),controller['show']);router[_0xa25f('0xd')]('/',auth[_0xa25f('0x7')](),controller['create']);router[_0xa25f('0xe')](_0xa25f('0xc'),auth[_0xa25f('0x7')](),controller[_0xa25f('0xf')]);router['delete'](_0xa25f('0xc'),auth[_0xa25f('0x7')](),controller['destroy']);module[_0xa25f('0x10')]=router; \ No newline at end of file +var _0x4944=['fs-extra','../../components/interaction/service','./smsTransferReport.controller','get','isAuthenticated','index','/describe','describe','show','post','/:id','update','destroy','exports','multer','path','connect-timeout','express','Router'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x4944,0x6d));var _0x4494=function(_0xf7370f,_0x1167f4){_0xf7370f=_0xf7370f-0x0;var _0x25f26e=_0x4944[_0xf7370f];return _0x25f26e;};'use strict';var multer=require(_0x4494('0x0'));var util=require('util');var path=require(_0x4494('0x1'));var timeout=require(_0x4494('0x2'));var express=require(_0x4494('0x3'));var router=express[_0x4494('0x4')]();var fs_extra=require(_0x4494('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x4494('0x6'));var config=require('../../config/environment');var controller=require(_0x4494('0x7'));router[_0x4494('0x8')]('/',auth[_0x4494('0x9')](),controller[_0x4494('0xa')]);router[_0x4494('0x8')](_0x4494('0xb'),auth[_0x4494('0x9')](),controller[_0x4494('0xc')]);router[_0x4494('0x8')]('/:id',auth[_0x4494('0x9')](),controller[_0x4494('0xd')]);router[_0x4494('0xe')]('/',auth[_0x4494('0x9')](),controller['create']);router['put'](_0x4494('0xf'),auth[_0x4494('0x9')](),controller[_0x4494('0x10')]);router['delete']('/:id',auth[_0x4494('0x9')](),controller[_0x4494('0x11')]);module[_0x4494('0x12')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 010e20c..58ede01 100644 --- a/server/api/smsTransferReport/smsTransferReport.attributes.js +++ b/server/api/smsTransferReport/smsTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x5611a9,_0x460b05){var _0x483cd1=function(_0x526f95){while(--_0x526f95){_0x5611a9['push'](_0x5611a9['shift']());}};_0x483cd1(++_0x460b05);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'use strict';var moment=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'agent',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x4')},'transferredAt':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0a9e('0x6')]}}; \ No newline at end of file +var _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x3861f7,_0x995b22){var _0x50879f=function(_0x3003f1){while(--_0x3003f1){_0x3861f7['push'](_0x3861f7['shift']());}};_0x50879f(++_0x995b22);}(_0x9bde,0xe1));var _0xe9bd=function(_0x1afa9f,_0x485fdc){_0x1afa9f=_0x1afa9f-0x0;var _0x1989b7=_0x9bde[_0x1afa9f];return _0x1989b7;};'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 diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index b771bf2..8da6940 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 _0x4fe1=['filter','merge','options','includeAll','findAll','rows','catch','show','keys','include','find','create','body','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','map','SmsTransferReport','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick'];(function(_0x46f098,_0x5f5063){var _0x1eef1d=function(_0x4d8b59){while(--_0x4d8b59){_0x46f098['push'](_0x46f098['shift']());}};_0x1eef1d(++_0x5f5063);}(_0x4fe1,0xab));var _0x14fe=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0x4fe1[_0x55f8b4];return _0x2475f9;};'use strict';var emlformat=require(_0x14fe('0x0'));var rimraf=require(_0x14fe('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x14fe('0x2'));var rp=require(_0x14fe('0x3'));var moment=require(_0x14fe('0x4'));var BPromise=require(_0x14fe('0x5'));var Mustache=require('mustache');var util=require(_0x14fe('0x6'));var path=require(_0x14fe('0x7'));var sox=require(_0x14fe('0x8'));var csv=require(_0x14fe('0x9'));var ejs=require(_0x14fe('0xa'));var fs=require('fs');var fs_extra=require(_0x14fe('0xb'));var _=require(_0x14fe('0xc'));var squel=require('squel');var crypto=require(_0x14fe('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x14fe('0xe'));var toCsv=require(_0x14fe('0x9'));var querystring=require('querystring');var Papa=require(_0x14fe('0xf'));var Redis=require(_0x14fe('0x10'));var authService=require(_0x14fe('0x11'));var qs=require(_0x14fe('0x12'));var as=require(_0x14fe('0x13'));var hardwareService=require(_0x14fe('0x14'));var logger=require(_0x14fe('0x15'))(_0x14fe('0x16'));var utils=require('../../config/utils');var config=require(_0x14fe('0x17'));var licenseUtil=require(_0x14fe('0x18'));var db=require(_0x14fe('0x19'))['db'];function respondWithStatusCode(_0x46a1f7,_0x111a42){_0x111a42=_0x111a42||0xcc;return function(_0x3a2aa5){if(_0x3a2aa5){return _0x46a1f7['sendStatus'](_0x111a42);}return _0x46a1f7[_0x14fe('0x1a')](_0x111a42)[_0x14fe('0x1b')]();};}function respondWithResult(_0x3f54ec,_0x1aad4f){_0x1aad4f=_0x1aad4f||0xc8;return function(_0x4d6802){if(_0x4d6802){return _0x3f54ec[_0x14fe('0x1a')](_0x1aad4f)[_0x14fe('0x1c')](_0x4d6802);}};}function respondWithFilteredResult(_0xc4844a,_0x1043f7){return function(_0xc15ec0){if(_0xc15ec0){var _0x1b8885=typeof _0x1043f7[_0x14fe('0x1d')]===_0x14fe('0x1e')&&typeof _0x1043f7[_0x14fe('0x1f')]===_0x14fe('0x1e');var _0x36c11b=_0xc15ec0[_0x14fe('0x20')];var _0x54529a=_0x1b8885?0x0:_0x1043f7[_0x14fe('0x1d')];var _0xf95f05=_0x1b8885?_0xc15ec0[_0x14fe('0x20')]:_0x1043f7[_0x14fe('0x1d')]+_0x1043f7[_0x14fe('0x1f')];var _0x1d9be5;if(_0xf95f05>=_0x36c11b){_0xf95f05=_0x36c11b;_0x1d9be5=0xc8;}else{_0x1d9be5=0xce;}_0xc4844a[_0x14fe('0x1a')](_0x1d9be5);return _0xc4844a[_0x14fe('0x21')](_0x14fe('0x22'),_0x54529a+'-'+_0xf95f05+'/'+_0x36c11b)[_0x14fe('0x1c')](_0xc15ec0);}return null;};}function patchUpdates(_0x3e656c){return function(_0x156e08){try{jsonpatch[_0x14fe('0x23')](_0x156e08,_0x3e656c,!![]);}catch(_0x3a0793){return BPromise[_0x14fe('0x24')](_0x3a0793);}return _0x156e08['save']();};}function saveUpdates(_0x4f424a,_0x538c5a){return function(_0x442080){if(_0x442080){return _0x442080[_0x14fe('0x25')](_0x4f424a)[_0x14fe('0x26')](function(_0x3b9477){return _0x3b9477;});}return null;};}function removeEntity(_0x4f6df2,_0x43288b){return function(_0x15e899){if(_0x15e899){return _0x15e899[_0x14fe('0x27')]()[_0x14fe('0x26')](function(){_0x4f6df2[_0x14fe('0x1a')](0xcc)[_0x14fe('0x1b')]();});}};}function handleEntityNotFound(_0x38251e,_0x5c6047){return function(_0x517ff2){if(!_0x517ff2){_0x38251e[_0x14fe('0x28')](0x194);}return _0x517ff2;};}function handleError(_0x280d91,_0x34b92b){_0x34b92b=_0x34b92b||0x1f4;return function(_0x31007a){logger[_0x14fe('0x29')](_0x31007a[_0x14fe('0x2a')]);if(_0x31007a[_0x14fe('0x2b')]){delete _0x31007a[_0x14fe('0x2b')];}_0x280d91[_0x14fe('0x1a')](_0x34b92b)[_0x14fe('0x2c')](_0x31007a);};}exports['index']=function(_0x37f26d,_0x3f0d9d){var _0x2320a6={},_0x3f2f79={},_0x2fb89c={'count':0x0,'rows':[]};var _0x845131=_[_0x14fe('0x2d')](db[_0x14fe('0x2e')][_0x14fe('0x2f')],function(_0x58e86f){return{'name':_0x58e86f[_0x14fe('0x30')],'type':_0x58e86f[_0x14fe('0x31')][_0x14fe('0x32')]};});_0x3f2f79[_0x14fe('0x33')]=_['map'](_0x845131,_0x14fe('0x2b'));_0x3f2f79[_0x14fe('0x34')]=_['keys'](_0x37f26d[_0x14fe('0x34')]);_0x3f2f79['filters']=_[_0x14fe('0x35')](_0x3f2f79['model'],_0x3f2f79[_0x14fe('0x34')]);_0x2320a6[_0x14fe('0x36')]=_[_0x14fe('0x35')](_0x3f2f79[_0x14fe('0x33')],qs['fields'](_0x37f26d[_0x14fe('0x34')][_0x14fe('0x37')]));_0x2320a6['attributes']=_0x2320a6['attributes'][_0x14fe('0x38')]?_0x2320a6['attributes']:_0x3f2f79['model'];if(!_0x37f26d[_0x14fe('0x34')][_0x14fe('0x39')](_0x14fe('0x3a'))){_0x2320a6[_0x14fe('0x1f')]=qs[_0x14fe('0x1f')](_0x37f26d[_0x14fe('0x34')][_0x14fe('0x1f')]);_0x2320a6[_0x14fe('0x1d')]=qs[_0x14fe('0x1d')](_0x37f26d[_0x14fe('0x34')][_0x14fe('0x1d')]);}_0x2320a6['order']=qs[_0x14fe('0x3b')](_0x37f26d[_0x14fe('0x34')][_0x14fe('0x3b')]);_0x2320a6[_0x14fe('0x3c')]=qs[_0x14fe('0x3d')](_[_0x14fe('0x3e')](_0x37f26d[_0x14fe('0x34')],_0x3f2f79[_0x14fe('0x3d')]),_0x845131);if(_0x37f26d[_0x14fe('0x34')][_0x14fe('0x3f')]){_0x2320a6[_0x14fe('0x3c')]=_[_0x14fe('0x40')](_0x2320a6[_0x14fe('0x3c')],{'$or':_['map'](_0x845131,function(_0x5eb64f){if(_0x5eb64f['type']!=='VIRTUAL'){var _0x36a897={};_0x36a897[_0x5eb64f[_0x14fe('0x2b')]]={'$like':'%'+_0x37f26d[_0x14fe('0x34')][_0x14fe('0x3f')]+'%'};return _0x36a897;}})});}_0x2320a6=_['merge']({},_0x2320a6,_0x37f26d[_0x14fe('0x41')]);var _0x78b503={'where':_0x2320a6['where']};return db[_0x14fe('0x2e')][_0x14fe('0x20')](_0x78b503)['then'](function(_0x196fd5){_0x2fb89c[_0x14fe('0x20')]=_0x196fd5;if(_0x37f26d[_0x14fe('0x34')][_0x14fe('0x42')]){_0x2320a6['include']=[{'all':!![]}];}return db['SmsTransferReport'][_0x14fe('0x43')](_0x2320a6);})[_0x14fe('0x26')](function(_0x453d2b){_0x2fb89c[_0x14fe('0x44')]=_0x453d2b;return _0x2fb89c;})[_0x14fe('0x26')](respondWithFilteredResult(_0x3f0d9d,_0x2320a6))[_0x14fe('0x45')](handleError(_0x3f0d9d,null));};exports[_0x14fe('0x46')]=function(_0x2c8db3,_0x32dcfe){var _0x222be5={'raw':!![],'where':{'id':_0x2c8db3['params']['id']}},_0x21c0ad={};_0x21c0ad[_0x14fe('0x33')]=_['keys'](db[_0x14fe('0x2e')][_0x14fe('0x2f')]);_0x21c0ad[_0x14fe('0x34')]=_[_0x14fe('0x47')](_0x2c8db3['query']);_0x21c0ad[_0x14fe('0x3d')]=_[_0x14fe('0x35')](_0x21c0ad['model'],_0x21c0ad['query']);_0x222be5[_0x14fe('0x36')]=_[_0x14fe('0x35')](_0x21c0ad[_0x14fe('0x33')],qs[_0x14fe('0x37')](_0x2c8db3[_0x14fe('0x34')][_0x14fe('0x37')]));_0x222be5[_0x14fe('0x36')]=_0x222be5[_0x14fe('0x36')][_0x14fe('0x38')]?_0x222be5[_0x14fe('0x36')]:_0x21c0ad['model'];if(_0x2c8db3[_0x14fe('0x34')][_0x14fe('0x42')]){_0x222be5[_0x14fe('0x48')]=[{'all':!![]}];}_0x222be5=_['merge']({},_0x222be5,_0x2c8db3[_0x14fe('0x41')]);return db[_0x14fe('0x2e')][_0x14fe('0x49')](_0x222be5)['then'](handleEntityNotFound(_0x32dcfe,null))['then'](respondWithResult(_0x32dcfe,null))['catch'](handleError(_0x32dcfe,null));};exports[_0x14fe('0x4a')]=function(_0x546227,_0x56327e){return db[_0x14fe('0x2e')][_0x14fe('0x4a')](_0x546227[_0x14fe('0x4b')],{})[_0x14fe('0x26')](respondWithResult(_0x56327e,0xc9))[_0x14fe('0x45')](handleError(_0x56327e,null));};exports[_0x14fe('0x25')]=function(_0x11815e,_0x8d9c26){if(_0x11815e[_0x14fe('0x4b')]['id']){delete _0x11815e[_0x14fe('0x4b')]['id'];}return db[_0x14fe('0x2e')]['find']({'where':{'id':_0x11815e[_0x14fe('0x4c')]['id']}})[_0x14fe('0x26')](handleEntityNotFound(_0x8d9c26,null))[_0x14fe('0x26')](saveUpdates(_0x11815e['body'],null))[_0x14fe('0x26')](respondWithResult(_0x8d9c26,null))[_0x14fe('0x45')](handleError(_0x8d9c26,null));};exports[_0x14fe('0x27')]=function(_0x5ef508,_0x4329f2){return db[_0x14fe('0x2e')][_0x14fe('0x49')]({'where':{'id':_0x5ef508[_0x14fe('0x4c')]['id']}})[_0x14fe('0x26')](handleEntityNotFound(_0x4329f2,null))[_0x14fe('0x26')](removeEntity(_0x4329f2,null))['catch'](handleError(_0x4329f2,null));};exports[_0x14fe('0x4d')]=function(_0x2ab257,_0x3cd56f){return db[_0x14fe('0x2e')][_0x14fe('0x4d')]()[_0x14fe('0x26')](respondWithResult(_0x3cd56f,null))[_0x14fe('0x45')](handleError(_0x3cd56f,null));}; \ No newline at end of file +var _0x37ae=['util','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','then','destroy','sendStatus','error','name','send','index','map','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','SmsTransferReport','includeAll','include','findAll','rows','params','keys','find','body','catch','update','describe','eml-format','zip-dir','fast-json-patch','moment','mustache'];(function(_0x2130b9,_0x2ce16c){var _0x3d1fe4=function(_0x98c6aa){while(--_0x98c6aa){_0x2130b9['push'](_0x2130b9['shift']());}};_0x3d1fe4(++_0x2ce16c);}(_0x37ae,0x172));var _0xe37a=function(_0x4b6830,_0x2bf6fb){_0x4b6830=_0x4b6830-0x0;var _0x239e4a=_0x37ae[_0x4b6830];return _0x239e4a;};'use strict';var emlformat=require(_0xe37a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe37a('0x1'));var jsonpatch=require(_0xe37a('0x2'));var rp=require('request-promise');var moment=require(_0xe37a('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xe37a('0x4'));var util=require(_0xe37a('0x5'));var path=require('path');var sox=require(_0xe37a('0x6'));var csv=require('to-csv');var ejs=require(_0xe37a('0x7'));var fs=require('fs');var fs_extra=require(_0xe37a('0x8'));var _=require('lodash');var squel=require(_0xe37a('0x9'));var crypto=require(_0xe37a('0xa'));var jsforce=require(_0xe37a('0xb'));var deskjs=require(_0xe37a('0xc'));var toCsv=require(_0xe37a('0xd'));var querystring=require('querystring');var Papa=require(_0xe37a('0xe'));var Redis=require(_0xe37a('0xf'));var authService=require(_0xe37a('0x10'));var qs=require(_0xe37a('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe37a('0x12'));var logger=require(_0xe37a('0x13'))(_0xe37a('0x14'));var utils=require('../../config/utils');var config=require(_0xe37a('0x15'));var licenseUtil=require(_0xe37a('0x16'));var db=require(_0xe37a('0x17'))['db'];function respondWithStatusCode(_0x32d01f,_0x141ef6){_0x141ef6=_0x141ef6||0xcc;return function(_0x1664f3){if(_0x1664f3){return _0x32d01f['sendStatus'](_0x141ef6);}return _0x32d01f[_0xe37a('0x18')](_0x141ef6)[_0xe37a('0x19')]();};}function respondWithResult(_0x46b0d1,_0x245130){_0x245130=_0x245130||0xc8;return function(_0xb7efac){if(_0xb7efac){return _0x46b0d1[_0xe37a('0x18')](_0x245130)['json'](_0xb7efac);}};}function respondWithFilteredResult(_0x4631a3,_0x5161a6){return function(_0x5246fa){if(_0x5246fa){var _0x21a7fc=typeof _0x5161a6[_0xe37a('0x1a')]===_0xe37a('0x1b')&&typeof _0x5161a6[_0xe37a('0x1c')]===_0xe37a('0x1b');var _0x5d0d73=_0x5246fa[_0xe37a('0x1d')];var _0x590d61=_0x21a7fc?0x0:_0x5161a6['offset'];var _0x36a528=_0x21a7fc?_0x5246fa[_0xe37a('0x1d')]:_0x5161a6[_0xe37a('0x1a')]+_0x5161a6[_0xe37a('0x1c')];var _0x5e7073;if(_0x36a528>=_0x5d0d73){_0x36a528=_0x5d0d73;_0x5e7073=0xc8;}else{_0x5e7073=0xce;}_0x4631a3[_0xe37a('0x18')](_0x5e7073);return _0x4631a3['set'](_0xe37a('0x1e'),_0x590d61+'-'+_0x36a528+'/'+_0x5d0d73)[_0xe37a('0x1f')](_0x5246fa);}return null;};}function patchUpdates(_0x1fce13){return function(_0x37b9de){try{jsonpatch[_0xe37a('0x20')](_0x37b9de,_0x1fce13,!![]);}catch(_0x109b66){return BPromise[_0xe37a('0x21')](_0x109b66);}return _0x37b9de[_0xe37a('0x22')]();};}function saveUpdates(_0x1436b3,_0x7c440f){return function(_0x4df295){if(_0x4df295){return _0x4df295['update'](_0x1436b3)[_0xe37a('0x23')](function(_0x2ee040){return _0x2ee040;});}return null;};}function removeEntity(_0x5762f7,_0x2b569b){return function(_0x4aed1b){if(_0x4aed1b){return _0x4aed1b[_0xe37a('0x24')]()[_0xe37a('0x23')](function(){_0x5762f7[_0xe37a('0x18')](0xcc)[_0xe37a('0x19')]();});}};}function handleEntityNotFound(_0x40ddd2,_0x57e0d2){return function(_0x5242c){if(!_0x5242c){_0x40ddd2[_0xe37a('0x25')](0x194);}return _0x5242c;};}function handleError(_0x70ec6c,_0x473929){_0x473929=_0x473929||0x1f4;return function(_0x38753d){logger[_0xe37a('0x26')](_0x38753d['stack']);if(_0x38753d[_0xe37a('0x27')]){delete _0x38753d[_0xe37a('0x27')];}_0x70ec6c[_0xe37a('0x18')](_0x473929)[_0xe37a('0x28')](_0x38753d);};}exports[_0xe37a('0x29')]=function(_0x4d6b84,_0x12ff03){var _0x2695da={},_0xd3ecb3={},_0x4d023b={'count':0x0,'rows':[]};var _0x27ac96=_[_0xe37a('0x2a')](db['SmsTransferReport'][_0xe37a('0x2b')],function(_0x5b4ca7){return{'name':_0x5b4ca7[_0xe37a('0x2c')],'type':_0x5b4ca7[_0xe37a('0x2d')]['key']};});_0xd3ecb3[_0xe37a('0x2e')]=_[_0xe37a('0x2a')](_0x27ac96,_0xe37a('0x27'));_0xd3ecb3[_0xe37a('0x2f')]=_['keys'](_0x4d6b84['query']);_0xd3ecb3[_0xe37a('0x30')]=_[_0xe37a('0x31')](_0xd3ecb3[_0xe37a('0x2e')],_0xd3ecb3['query']);_0x2695da[_0xe37a('0x32')]=_['intersection'](_0xd3ecb3[_0xe37a('0x2e')],qs[_0xe37a('0x33')](_0x4d6b84[_0xe37a('0x2f')][_0xe37a('0x33')]));_0x2695da[_0xe37a('0x32')]=_0x2695da['attributes'][_0xe37a('0x34')]?_0x2695da[_0xe37a('0x32')]:_0xd3ecb3[_0xe37a('0x2e')];if(!_0x4d6b84[_0xe37a('0x2f')][_0xe37a('0x35')](_0xe37a('0x36'))){_0x2695da['limit']=qs[_0xe37a('0x1c')](_0x4d6b84[_0xe37a('0x2f')][_0xe37a('0x1c')]);_0x2695da[_0xe37a('0x1a')]=qs[_0xe37a('0x1a')](_0x4d6b84[_0xe37a('0x2f')][_0xe37a('0x1a')]);}_0x2695da[_0xe37a('0x37')]=qs['sort'](_0x4d6b84[_0xe37a('0x2f')][_0xe37a('0x38')]);_0x2695da[_0xe37a('0x39')]=qs[_0xe37a('0x30')](_[_0xe37a('0x3a')](_0x4d6b84['query'],_0xd3ecb3['filters']),_0x27ac96);if(_0x4d6b84[_0xe37a('0x2f')][_0xe37a('0x3b')]){_0x2695da['where']=_[_0xe37a('0x3c')](_0x2695da[_0xe37a('0x39')],{'$or':_['map'](_0x27ac96,function(_0x16b54a){if(_0x16b54a[_0xe37a('0x2d')]!==_0xe37a('0x3d')){var _0x215957={};_0x215957[_0x16b54a['name']]={'$like':'%'+_0x4d6b84[_0xe37a('0x2f')][_0xe37a('0x3b')]+'%'};return _0x215957;}})});}_0x2695da=_[_0xe37a('0x3c')]({},_0x2695da,_0x4d6b84[_0xe37a('0x3e')]);var _0x2ed994={'where':_0x2695da[_0xe37a('0x39')]};return db[_0xe37a('0x3f')][_0xe37a('0x1d')](_0x2ed994)['then'](function(_0x200391){_0x4d023b[_0xe37a('0x1d')]=_0x200391;if(_0x4d6b84[_0xe37a('0x2f')][_0xe37a('0x40')]){_0x2695da[_0xe37a('0x41')]=[{'all':!![]}];}return db[_0xe37a('0x3f')][_0xe37a('0x42')](_0x2695da);})[_0xe37a('0x23')](function(_0x41fbb6){_0x4d023b[_0xe37a('0x43')]=_0x41fbb6;return _0x4d023b;})[_0xe37a('0x23')](respondWithFilteredResult(_0x12ff03,_0x2695da))['catch'](handleError(_0x12ff03,null));};exports['show']=function(_0x59bdea,_0x91ab09){var _0x9d0df1={'raw':!![],'where':{'id':_0x59bdea[_0xe37a('0x44')]['id']}},_0x34bb45={};_0x34bb45['model']=_[_0xe37a('0x45')](db[_0xe37a('0x3f')]['rawAttributes']);_0x34bb45[_0xe37a('0x2f')]=_[_0xe37a('0x45')](_0x59bdea[_0xe37a('0x2f')]);_0x34bb45[_0xe37a('0x30')]=_['intersection'](_0x34bb45['model'],_0x34bb45[_0xe37a('0x2f')]);_0x9d0df1[_0xe37a('0x32')]=_[_0xe37a('0x31')](_0x34bb45['model'],qs[_0xe37a('0x33')](_0x59bdea[_0xe37a('0x2f')][_0xe37a('0x33')]));_0x9d0df1[_0xe37a('0x32')]=_0x9d0df1[_0xe37a('0x32')][_0xe37a('0x34')]?_0x9d0df1[_0xe37a('0x32')]:_0x34bb45['model'];if(_0x59bdea['query'][_0xe37a('0x40')]){_0x9d0df1[_0xe37a('0x41')]=[{'all':!![]}];}_0x9d0df1=_['merge']({},_0x9d0df1,_0x59bdea[_0xe37a('0x3e')]);return db[_0xe37a('0x3f')][_0xe37a('0x46')](_0x9d0df1)[_0xe37a('0x23')](handleEntityNotFound(_0x91ab09,null))['then'](respondWithResult(_0x91ab09,null))['catch'](handleError(_0x91ab09,null));};exports['create']=function(_0x56543f,_0x323bee){return db[_0xe37a('0x3f')]['create'](_0x56543f[_0xe37a('0x47')],{})[_0xe37a('0x23')](respondWithResult(_0x323bee,0xc9))[_0xe37a('0x48')](handleError(_0x323bee,null));};exports[_0xe37a('0x49')]=function(_0x2bf107,_0x4ef5c8){if(_0x2bf107[_0xe37a('0x47')]['id']){delete _0x2bf107[_0xe37a('0x47')]['id'];}return db[_0xe37a('0x3f')][_0xe37a('0x46')]({'where':{'id':_0x2bf107[_0xe37a('0x44')]['id']}})[_0xe37a('0x23')](handleEntityNotFound(_0x4ef5c8,null))[_0xe37a('0x23')](saveUpdates(_0x2bf107[_0xe37a('0x47')],null))['then'](respondWithResult(_0x4ef5c8,null))['catch'](handleError(_0x4ef5c8,null));};exports[_0xe37a('0x24')]=function(_0x3d8bb2,_0x39d33e){return db[_0xe37a('0x3f')]['find']({'where':{'id':_0x3d8bb2[_0xe37a('0x44')]['id']}})['then'](handleEntityNotFound(_0x39d33e,null))[_0xe37a('0x23')](removeEntity(_0x39d33e,null))['catch'](handleError(_0x39d33e,null));};exports[_0xe37a('0x4a')]=function(_0xa16618,_0x26acff){return db['SmsTransferReport'][_0xe37a('0x4a')]()[_0xe37a('0x23')](respondWithResult(_0x26acff,null))['catch'](handleError(_0x26acff,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 4c667ba..faf8bef 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 _0x1e69=['api','moment','bluebird','path','../../config/environment','./smsTransferReport.attributes','SmsTransferReport','uniqueid','lodash'];(function(_0x43c665,_0x5e5567){var _0x13d2a7=function(_0x4fa231){while(--_0x4fa231){_0x43c665['push'](_0x43c665['shift']());}};_0x13d2a7(++_0x5e5567);}(_0x1e69,0x19d));var _0x91e6=function(_0x4c6c9f,_0x25c8a9){_0x4c6c9f=_0x4c6c9f-0x0;var _0x31e332=_0x1e69[_0x4c6c9f];return _0x31e332;};'use strict';var _=require(_0x91e6('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x91e6('0x1'));var moment=require(_0x91e6('0x2'));var BPromise=require(_0x91e6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x91e6('0x4'));var rimraf=require('rimraf');var config=require(_0x91e6('0x5'));var attributes=require(_0x91e6('0x6'));module['exports']=function(_0x4b0364,_0x3d51a0){return _0x4b0364['define'](_0x91e6('0x7'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0x91e6('0x8'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xa5fd=['lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','define','SmsTransferReport','report_sms_transfer','uniqueid'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xa5fd,0x90));var _0xda5f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa5fd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xda5f('0x0'));var util=require('util');var logger=require(_0xda5f('0x1'))(_0xda5f('0x2'));var moment=require(_0xda5f('0x3'));var BPromise=require('bluebird');var rp=require(_0xda5f('0x4'));var fs=require('fs');var path=require(_0xda5f('0x5'));var rimraf=require(_0xda5f('0x6'));var config=require(_0xda5f('0x7'));var attributes=require('./smsTransferReport.attributes');module['exports']=function(_0x372ee6,_0x2798db){return _0x372ee6[_0xda5f('0x8')](_0xda5f('0x9'),attributes,{'tableName':_0xda5f('0xa'),'paranoid':![],'indexes':[{'name':_0xda5f('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 6cc0a03..e8f52cf 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 _0xf6c1=['jayson/promise','client','http','request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x2721cd,_0x4cb9c1){var _0x3a40c7=function(_0x428338){while(--_0x428338){_0x2721cd['push'](_0x2721cd['shift']());}};_0x3a40c7(++_0x4cb9c1);}(_0xf6c1,0x99));var _0x1f6c=function(_0x547eb3,_0xcc2cef){_0x547eb3=_0x547eb3-0x0;var _0x3880cd=_0xf6c1[_0x547eb3];return _0x3880cd;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1f6c('0x0'));var BPromise=require(_0x1f6c('0x1'));var rs=require(_0x1f6c('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1f6c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x1f6c('0x4'))(_0x1f6c('0x5'));var config=require(_0x1f6c('0x6'));var jayson=require(_0x1f6c('0x7'));var client=jayson[_0x1f6c('0x8')][_0x1f6c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x530b25,_0x3c7569,_0x1385de){return new BPromise(function(_0xade159,_0xcf5c23){return client[_0x1f6c('0xa')](_0x530b25,_0x1385de)[_0x1f6c('0xb')](function(_0x1e7287){logger[_0x1f6c('0xc')](_0x1f6c('0xd'),_0x3c7569,'request\x20sent');logger['debug']('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x3c7569,_0x1f6c('0xe'),JSON[_0x1f6c('0xf')](_0x1e7287));if(_0x1e7287[_0x1f6c('0x10')]){if(_0x1e7287[_0x1f6c('0x10')][_0x1f6c('0x11')]===0x1f4){logger[_0x1f6c('0x10')]('SmsTransferReport,\x20%s,\x20%s',_0x3c7569,_0x1e7287[_0x1f6c('0x10')][_0x1f6c('0x12')]);return _0xcf5c23(_0x1e7287[_0x1f6c('0x10')][_0x1f6c('0x12')]);}logger[_0x1f6c('0x10')](_0x1f6c('0xd'),_0x3c7569,_0x1e7287[_0x1f6c('0x10')][_0x1f6c('0x12')]);return _0xade159(_0x1e7287['error'][_0x1f6c('0x12')]);}else{logger[_0x1f6c('0xc')](_0x1f6c('0xd'),_0x3c7569,_0x1f6c('0xe'));_0xade159(_0x1e7287[_0x1f6c('0x13')][_0x1f6c('0x12')]);}})['catch'](function(_0x521c4c){logger[_0x1f6c('0x10')](_0x1f6c('0xd'),_0x3c7569,_0x521c4c);_0xcf5c23(_0x521c4c);});});} \ No newline at end of file +var _0x294b=['jayson/promise','client','http','then','info','SmsTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SmsTransferReport,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment'];(function(_0x528b1e,_0xc65acb){var _0x5342cd=function(_0x32c767){while(--_0x32c767){_0x528b1e['push'](_0x528b1e['shift']());}};_0x5342cd(++_0xc65acb);}(_0x294b,0xea));var _0xb294=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x294b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb294('0x0'));var util=require('util');var moment=require(_0xb294('0x1'));var BPromise=require(_0xb294('0x2'));var rs=require(_0xb294('0x3'));var fs=require('fs');var Redis=require(_0xb294('0x4'));var db=require(_0xb294('0x5'))['db'];var utils=require(_0xb294('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xb294('0x7'));var jayson=require(_0xb294('0x8'));var client=jayson[_0xb294('0x9')][_0xb294('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xcc7910,_0x509dbd,_0x39dfbf){return new BPromise(function(_0x5110aa,_0x5226a4){return client['request'](_0xcc7910,_0x39dfbf)[_0xb294('0xb')](function(_0x33f8e5){logger[_0xb294('0xc')]('SmsTransferReport,\x20%s,\x20%s',_0x509dbd,'request\x20sent');logger['debug'](_0xb294('0xd'),_0x509dbd,_0xb294('0xe'),JSON[_0xb294('0xf')](_0x33f8e5));if(_0x33f8e5[_0xb294('0x10')]){if(_0x33f8e5[_0xb294('0x10')][_0xb294('0x11')]===0x1f4){logger[_0xb294('0x10')](_0xb294('0x12'),_0x509dbd,_0x33f8e5[_0xb294('0x10')][_0xb294('0x13')]);return _0x5226a4(_0x33f8e5['error']['message']);}logger[_0xb294('0x10')]('SmsTransferReport,\x20%s,\x20%s',_0x509dbd,_0x33f8e5['error'][_0xb294('0x13')]);return _0x5110aa(_0x33f8e5[_0xb294('0x10')][_0xb294('0x13')]);}else{logger[_0xb294('0xc')](_0xb294('0x12'),_0x509dbd,_0xb294('0xe'));_0x5110aa(_0x33f8e5[_0xb294('0x14')][_0xb294('0x13')]);}})[_0xb294('0x15')](function(_0x289839){logger[_0xb294('0x10')]('SmsTransferReport,\x20%s,\x20%s',_0x509dbd,_0x289839);_0x5226a4(_0x289839);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 0adaada..7fffb90 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 _0x6751=['exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./sound.controller','get','isAuthenticated','show','/:id/download','diskStorage','root','originalname','replace','format','%s-%s%s','basename','extname','now','post','single','file','create','/:id','update','delete'];(function(_0xcfa566,_0x2bf741){var _0xca62f8=function(_0x5d13b5){while(--_0x5d13b5){_0xcfa566['push'](_0xcfa566['shift']());}};_0xca62f8(++_0x2bf741);}(_0x6751,0x15d));var _0x1675=function(_0x25c1bd,_0x2b9085){_0x25c1bd=_0x25c1bd-0x0;var _0x1eea5f=_0x6751[_0x25c1bd];return _0x1eea5f;};'use strict';var multer=require(_0x1675('0x0'));var util=require(_0x1675('0x1'));var path=require(_0x1675('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1675('0x3')]();var fs_extra=require(_0x1675('0x4'));var auth=require(_0x1675('0x5'));var interaction=require(_0x1675('0x6'));var config=require('../../config/environment');var controller=require(_0x1675('0x7'));router[_0x1675('0x8')]('/',auth[_0x1675('0x9')](),controller['index']);router[_0x1675('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x1675('0xa')]);router[_0x1675('0x8')](_0x1675('0xb'),auth['isAuthenticated'](),controller['download']);var upload=multer({'storage':multer[_0x1675('0xc')]({'destination':function(_0x5b1dea,_0x171230,_0x52e4b2){_0x52e4b2(null,path['join'](config[_0x1675('0xd')],'server/files/sounds/original/'));},'filename':function(_0x531b14,_0x498071,_0x2417dc){_0x498071[_0x1675('0xe')]=_0x498071[_0x1675('0xe')][_0x1675('0xf')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2417dc(null,util[_0x1675('0x10')](_0x1675('0x11'),path[_0x1675('0x12')](_0x498071['originalname'],path[_0x1675('0x13')](_0x498071[_0x1675('0xe')])),Date[_0x1675('0x14')](),path[_0x1675('0x13')](_0x498071[_0x1675('0xe')])));}})});router[_0x1675('0x15')]('/',upload[_0x1675('0x16')](_0x1675('0x17')),controller[_0x1675('0x18')]);router['put'](_0x1675('0x19'),auth[_0x1675('0x9')](),controller[_0x1675('0x1a')]);router['delete']('/:id',auth[_0x1675('0x9')](),controller[_0x1675('0x1b')]);module[_0x1675('0x1c')]=router; \ No newline at end of file +var _0xf607=['download','diskStorage','join','root','server/files/sounds/original/','replace','format','basename','originalname','extname','post','single','file','update','delete','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','/:id/download'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xf607,0x197));var _0x7f60=function(_0x2b1b27,_0x522b68){_0x2b1b27=_0x2b1b27-0x0;var _0x3dcc3f=_0xf607[_0x2b1b27];return _0x3dcc3f;};'use strict';var multer=require(_0x7f60('0x0'));var util=require(_0x7f60('0x1'));var path=require(_0x7f60('0x2'));var timeout=require(_0x7f60('0x3'));var express=require(_0x7f60('0x4'));var router=express[_0x7f60('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x7f60('0x6'));var config=require(_0x7f60('0x7'));var controller=require('./sound.controller');router['get']('/',auth[_0x7f60('0x8')](),controller[_0x7f60('0x9')]);router[_0x7f60('0xa')](_0x7f60('0xb'),auth[_0x7f60('0x8')](),controller['show']);router['get'](_0x7f60('0xc'),auth[_0x7f60('0x8')](),controller[_0x7f60('0xd')]);var upload=multer({'storage':multer[_0x7f60('0xe')]({'destination':function(_0x44c918,_0x36c550,_0x347057){_0x347057(null,path[_0x7f60('0xf')](config[_0x7f60('0x10')],_0x7f60('0x11')));},'filename':function(_0x4e22a0,_0x7be946,_0x365814){_0x7be946['originalname']=_0x7be946['originalname'][_0x7f60('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x365814(null,util[_0x7f60('0x13')]('%s-%s%s',path[_0x7f60('0x14')](_0x7be946[_0x7f60('0x15')],path['extname'](_0x7be946[_0x7f60('0x15')])),Date['now'](),path[_0x7f60('0x16')](_0x7be946['originalname'])));}})});router[_0x7f60('0x17')]('/',upload[_0x7f60('0x18')](_0x7f60('0x19')),controller['create']);router['put'](_0x7f60('0xb'),auth['isAuthenticated'](),controller[_0x7f60('0x1a')]);router[_0x7f60('0x1b')]('/:id',auth[_0x7f60('0x8')](),controller['delete']);module['exports']=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index e92cf2f..62864ac 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 _0x4e34=['INTEGER','sequelize','exports','name','STRING','FLOAT','BIGINT'];(function(_0x27cd09,_0x3347a0){var _0x372d20=function(_0x5b0bfc){while(--_0x5b0bfc){_0x27cd09['push'](_0x27cd09['shift']());}};_0x372d20(++_0x3347a0);}(_0x4e34,0xd3));var _0x44e3=function(_0x4536c4,_0x936b6a){_0x4536c4=_0x4536c4-0x0;var _0x4e2cda=_0x4e34[_0x4536c4];return _0x4e2cda;};'use strict';var Sequelize=require(_0x44e3('0x0'));module[_0x44e3('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x44e3('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0x44e3('0x3')]},'display_name':{'type':Sequelize[_0x44e3('0x3')],'defaultValue':''},'description':{'type':Sequelize[_0x44e3('0x3')]},'original_format':{'type':Sequelize[_0x44e3('0x3')]},'original_duration':{'type':Sequelize[_0x44e3('0x4')]},'original_sampleCount':{'type':Sequelize[_0x44e3('0x5')]},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize[_0x44e3('0x5')]},'original_sampleRate':{'type':Sequelize[_0x44e3('0x6')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize[_0x44e3('0x4')]},'converted_sampleCount':{'type':Sequelize[_0x44e3('0x5')]},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize[_0x44e3('0x5')]},'converted_sampleRate':{'type':Sequelize[_0x44e3('0x6')]}}; \ No newline at end of file +var _0xa64b=['INTEGER','BIGINT','sequelize','STRING','FLOAT'];(function(_0x31abee,_0x11ff0c){var _0x3c1761=function(_0x2b5062){while(--_0x2b5062){_0x31abee['push'](_0x31abee['shift']());}};_0x3c1761(++_0x11ff0c);}(_0xa64b,0x133));var _0xba64=function(_0x3c3293,_0x487f40){_0x3c3293=_0x3c3293-0x0;var _0x17bd40=_0xa64b[_0x3c3293];return _0x17bd40;};'use strict';var Sequelize=require(_0xba64('0x0'));module['exports']={'name':{'type':Sequelize[_0xba64('0x1')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0xba64('0x1')]},'original_format':{'type':Sequelize[_0xba64('0x1')]},'original_duration':{'type':Sequelize[_0xba64('0x2')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0xba64('0x3')]},'original_bitRate':{'type':Sequelize[_0xba64('0x4')]},'original_sampleRate':{'type':Sequelize[_0xba64('0x3')]},'converted_format':{'type':Sequelize[_0xba64('0x1')]},'converted_duration':{'type':Sequelize[_0xba64('0x2')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0xba64('0x3')]},'converted_bitRate':{'type':Sequelize[_0xba64('0x4')]},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 51f93a1..3519c55 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 _0x6bd6=['ValidationError','%s.%s','format','create','basename','file','originalname','extname','filename','substring','Sound\x20upload\x20filepath:\x20%s','info','0777','unlinkSync','send','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','bitRate','converted_sampleRate','chmodSync','body','role','userProfileId','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','description','delete','save_name','original_format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Sounds','UserProfileResource','error','name','map','Sound','fieldName','type','query','keys','filters','model','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','download','converted_format','existsSync','join','root','server/files/sounds/converted'];(function(_0x539b71,_0x4daf0b){var _0x3d1a59=function(_0x1a59ed){while(--_0x1a59ed){_0x539b71['push'](_0x539b71['shift']());}};_0x3d1a59(++_0x4daf0b);}(_0x6bd6,0xa1));var _0x66bd=function(_0x3dda00,_0x392dca){_0x3dda00=_0x3dda00-0x0;var _0x2a6b26=_0x6bd6[_0x3dda00];return _0x2a6b26;};'use strict';var emlformat=require(_0x66bd('0x0'));var rimraf=require(_0x66bd('0x1'));var zipdir=require(_0x66bd('0x2'));var jsonpatch=require(_0x66bd('0x3'));var rp=require(_0x66bd('0x4'));var moment=require(_0x66bd('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x66bd('0x6'));var util=require(_0x66bd('0x7'));var path=require(_0x66bd('0x8'));var sox=require(_0x66bd('0x9'));var csv=require(_0x66bd('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x66bd('0xb'));var _=require(_0x66bd('0xc'));var squel=require(_0x66bd('0xd'));var crypto=require(_0x66bd('0xe'));var jsforce=require(_0x66bd('0xf'));var deskjs=require(_0x66bd('0x10'));var toCsv=require(_0x66bd('0xa'));var querystring=require(_0x66bd('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x66bd('0x12'));var qs=require(_0x66bd('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x66bd('0x14'));var logger=require(_0x66bd('0x15'))(_0x66bd('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x66bd('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x28c46e,_0x545f21){_0x545f21=_0x545f21||0xcc;return function(_0x40673a){if(_0x40673a){return _0x28c46e[_0x66bd('0x18')](_0x545f21);}return _0x28c46e[_0x66bd('0x19')](_0x545f21)[_0x66bd('0x1a')]();};}function respondWithResult(_0x498a6f,_0x4da52a){_0x4da52a=_0x4da52a||0xc8;return function(_0x445f91){if(_0x445f91){return _0x498a6f[_0x66bd('0x19')](_0x4da52a)[_0x66bd('0x1b')](_0x445f91);}};}function respondWithFilteredResult(_0x319812,_0x502045){return function(_0x187960){if(_0x187960){var _0x411fe8=typeof _0x502045['offset']===_0x66bd('0x1c')&&typeof _0x502045['limit']==='undefined';var _0x35d69f=_0x187960[_0x66bd('0x1d')];var _0x26ac78=_0x411fe8?0x0:_0x502045['offset'];var _0x251eb6=_0x411fe8?_0x187960[_0x66bd('0x1d')]:_0x502045[_0x66bd('0x1e')]+_0x502045[_0x66bd('0x1f')];var _0xc84165;if(_0x251eb6>=_0x35d69f){_0x251eb6=_0x35d69f;_0xc84165=0xc8;}else{_0xc84165=0xce;}_0x319812[_0x66bd('0x19')](_0xc84165);return _0x319812[_0x66bd('0x20')](_0x66bd('0x21'),_0x26ac78+'-'+_0x251eb6+'/'+_0x35d69f)[_0x66bd('0x1b')](_0x187960);}return null;};}function patchUpdates(_0x1d78b8){return function(_0x23032c){try{jsonpatch[_0x66bd('0x22')](_0x23032c,_0x1d78b8,!![]);}catch(_0x407fd1){return BPromise[_0x66bd('0x23')](_0x407fd1);}return _0x23032c[_0x66bd('0x24')]();};}function saveUpdates(_0x247b68,_0x5c589d){return function(_0x3bd6ac){if(_0x3bd6ac){return _0x3bd6ac[_0x66bd('0x25')](_0x247b68)[_0x66bd('0x26')](function(_0x260785){return _0x260785;});}return null;};}function removeEntity(_0x4abdcb,_0x539c23){return function(_0x3104fe){if(_0x3104fe){return _0x3104fe[_0x66bd('0x27')]()['then'](function(){var _0x20f7ee=_0x3104fe[_0x66bd('0x28')]({'plain':!![]});var _0x1c4de7=_0x66bd('0x29');return db[_0x66bd('0x2a')]['destroy']({'where':{'type':_0x1c4de7,'resourceId':_0x20f7ee['id']}})[_0x66bd('0x26')](function(){return _0x3104fe;});})[_0x66bd('0x26')](function(){_0x4abdcb[_0x66bd('0x19')](0xcc)[_0x66bd('0x1a')]();});}};}function handleEntityNotFound(_0x572a77,_0x2d6e22){return function(_0x28cbb9){if(!_0x28cbb9){_0x572a77[_0x66bd('0x18')](0x194);}return _0x28cbb9;};}function handleError(_0x1483f4,_0x45639b){_0x45639b=_0x45639b||0x1f4;return function(_0x4dfe0f){logger[_0x66bd('0x2b')](_0x4dfe0f['stack']);if(_0x4dfe0f[_0x66bd('0x2c')]){delete _0x4dfe0f[_0x66bd('0x2c')];}_0x1483f4['status'](_0x45639b)['send'](_0x4dfe0f);};}exports['index']=function(_0x51cfd6,_0x1f6154){var _0x10ffca={},_0x11b30e={},_0x2ed76c={'count':0x0,'rows':[]};var _0x56ea8a=_[_0x66bd('0x2d')](db[_0x66bd('0x2e')]['rawAttributes'],function(_0x185150){return{'name':_0x185150[_0x66bd('0x2f')],'type':_0x185150[_0x66bd('0x30')]['key']};});_0x11b30e['model']=_[_0x66bd('0x2d')](_0x56ea8a,_0x66bd('0x2c'));_0x11b30e[_0x66bd('0x31')]=_[_0x66bd('0x32')](_0x51cfd6[_0x66bd('0x31')]);_0x11b30e[_0x66bd('0x33')]=_['intersection'](_0x11b30e[_0x66bd('0x34')],_0x11b30e[_0x66bd('0x31')]);_0x10ffca['attributes']=_[_0x66bd('0x35')](_0x11b30e[_0x66bd('0x34')],qs[_0x66bd('0x36')](_0x51cfd6[_0x66bd('0x31')][_0x66bd('0x36')]));_0x10ffca['attributes']=_0x10ffca[_0x66bd('0x37')]['length']?_0x10ffca[_0x66bd('0x37')]:_0x11b30e[_0x66bd('0x34')];if(!_0x51cfd6['query'][_0x66bd('0x38')](_0x66bd('0x39'))){_0x10ffca[_0x66bd('0x1f')]=qs[_0x66bd('0x1f')](_0x51cfd6[_0x66bd('0x31')][_0x66bd('0x1f')]);_0x10ffca[_0x66bd('0x1e')]=qs['offset'](_0x51cfd6[_0x66bd('0x31')][_0x66bd('0x1e')]);}_0x10ffca['order']=qs[_0x66bd('0x3a')](_0x51cfd6['query'][_0x66bd('0x3a')]);_0x10ffca[_0x66bd('0x3b')]=qs['filters'](_[_0x66bd('0x3c')](_0x51cfd6[_0x66bd('0x31')],_0x11b30e[_0x66bd('0x33')]),_0x56ea8a);if(_0x51cfd6[_0x66bd('0x31')][_0x66bd('0x3d')]){_0x10ffca[_0x66bd('0x3b')]=_[_0x66bd('0x3e')](_0x10ffca[_0x66bd('0x3b')],{'$or':_[_0x66bd('0x2d')](_0x56ea8a,function(_0x107740){if(_0x107740[_0x66bd('0x30')]!==_0x66bd('0x3f')){var _0x359fb9={};_0x359fb9[_0x107740[_0x66bd('0x2c')]]={'$like':'%'+_0x51cfd6[_0x66bd('0x31')][_0x66bd('0x3d')]+'%'};return _0x359fb9;}})});}_0x10ffca=_[_0x66bd('0x3e')]({},_0x10ffca,_0x51cfd6[_0x66bd('0x40')]);var _0x237bff={'where':_0x10ffca['where']};return db[_0x66bd('0x2e')][_0x66bd('0x1d')](_0x237bff)[_0x66bd('0x26')](function(_0x245564){_0x2ed76c[_0x66bd('0x1d')]=_0x245564;if(_0x51cfd6[_0x66bd('0x31')][_0x66bd('0x41')]){_0x10ffca[_0x66bd('0x42')]=[{'all':!![]}];}return db['Sound'][_0x66bd('0x43')](_0x10ffca);})[_0x66bd('0x26')](function(_0x460ba8){_0x2ed76c[_0x66bd('0x44')]=_0x460ba8;return _0x2ed76c;})['then'](respondWithFilteredResult(_0x1f6154,_0x10ffca))[_0x66bd('0x45')](handleError(_0x1f6154,null));};exports[_0x66bd('0x46')]=function(_0x3b05f2,_0x23ecfb){var _0x296025={'raw':!![],'where':{'id':_0x3b05f2[_0x66bd('0x47')]['id']}},_0x475226={};_0x475226[_0x66bd('0x34')]=_[_0x66bd('0x32')](db[_0x66bd('0x2e')][_0x66bd('0x48')]);_0x475226[_0x66bd('0x31')]=_[_0x66bd('0x32')](_0x3b05f2[_0x66bd('0x31')]);_0x475226[_0x66bd('0x33')]=_['intersection'](_0x475226['model'],_0x475226['query']);_0x296025['attributes']=_[_0x66bd('0x35')](_0x475226[_0x66bd('0x34')],qs[_0x66bd('0x36')](_0x3b05f2['query'][_0x66bd('0x36')]));_0x296025['attributes']=_0x296025[_0x66bd('0x37')][_0x66bd('0x49')]?_0x296025['attributes']:_0x475226[_0x66bd('0x34')];if(_0x3b05f2['query'][_0x66bd('0x41')]){_0x296025['include']=[{'all':!![]}];}_0x296025=_['merge']({},_0x296025,_0x3b05f2['options']);return db[_0x66bd('0x2e')][_0x66bd('0x4a')](_0x296025)[_0x66bd('0x26')](handleEntityNotFound(_0x23ecfb,null))[_0x66bd('0x26')](respondWithResult(_0x23ecfb,null))[_0x66bd('0x45')](handleError(_0x23ecfb,null));};exports[_0x66bd('0x4b')]=function(_0x19540d,_0xc4194e,_0x3871a3){return db['Sound'][_0x66bd('0x4a')]({'where':{'id':_0x19540d[_0x66bd('0x47')]['id']},'attributes':[_0x66bd('0x2c'),'save_name',_0x66bd('0x4c')],'raw':!![]})[_0x66bd('0x26')](handleEntityNotFound(_0xc4194e,null))[_0x66bd('0x26')](function(_0x1f4c34){if(_0x1f4c34){if(!fs[_0x66bd('0x4d')](path[_0x66bd('0x4e')](config[_0x66bd('0x4f')],_0x66bd('0x50'),_0x1f4c34['save_name']+'.'+_0x1f4c34[_0x66bd('0x4c')]))){throw new db['Sequelize'][(_0x66bd('0x51'))]('Sound\x20not\x20found');}return _0xc4194e[_0x66bd('0x4b')](path[_0x66bd('0x4e')](config[_0x66bd('0x4f')],_0x66bd('0x50'),util['format'](_0x66bd('0x52'),_0x1f4c34['save_name'],_0x1f4c34[_0x66bd('0x4c')])),util[_0x66bd('0x53')]('%s.%s',_0x1f4c34[_0x66bd('0x2c')],_0x1f4c34[_0x66bd('0x4c')]));}return null;})[_0x66bd('0x45')](handleError(_0xc4194e,null));};exports[_0x66bd('0x54')]=function(_0x3a5a5a,_0x3b0dbd,_0x1cd77d){var _0x4c1d9c={'name':path[_0x66bd('0x55')](_0x3a5a5a[_0x66bd('0x56')][_0x66bd('0x57')],path[_0x66bd('0x58')](_0x3a5a5a[_0x66bd('0x56')][_0x66bd('0x57')])),'save_name':path[_0x66bd('0x55')](_0x3a5a5a[_0x66bd('0x56')][_0x66bd('0x59')],path[_0x66bd('0x58')](_0x3a5a5a[_0x66bd('0x56')]['filename'])),'original_format':path[_0x66bd('0x58')](_0x3a5a5a[_0x66bd('0x56')][_0x66bd('0x57')])[_0x66bd('0x5a')](0x1),'converted_format':'wav'};var _0x3e1b4a=path[_0x66bd('0x4e')](config[_0x66bd('0x4f')],'server/files/sounds/original',_0x3a5a5a[_0x66bd('0x56')][_0x66bd('0x59')]);var _0x1bf344=path[_0x66bd('0x4e')](config['root'],'server/files/sounds/converted',util[_0x66bd('0x53')](_0x66bd('0x52'),path[_0x66bd('0x55')](_0x3a5a5a['file'][_0x66bd('0x59')],path[_0x66bd('0x58')](_0x3a5a5a[_0x66bd('0x56')]['filename'])),_0x4c1d9c[_0x66bd('0x4c')]));logger['info'](_0x66bd('0x5b'),_0x3e1b4a);logger[_0x66bd('0x5c')]('Sound\x20upload\x20destination:\x20%s',_0x1bf344);try{fs['chmodSync'](_0x3e1b4a,parseInt(_0x66bd('0x5d'),0x8));var _0x2af0dc=sox['transcode'](_0x3e1b4a,_0x1bf344,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x2af0dc['on'](_0x66bd('0x2b'),function(_0x297f06){fs[_0x66bd('0x5e')](_0x3e1b4a);_0x3b0dbd[_0x66bd('0x19')](0x1f4)[_0x66bd('0x5f')](_0x297f06);});_0x2af0dc['on']('src',function(_0x34da50){_0x4c1d9c['original_duration']=isNaN(_0x34da50[_0x66bd('0x60')])?null:_0x34da50[_0x66bd('0x60')]*0x3e8;_0x4c1d9c[_0x66bd('0x61')]=isNaN(_0x34da50['sampleCount'])?null:_0x34da50[_0x66bd('0x62')];_0x4c1d9c[_0x66bd('0x63')]=isNaN(_0x34da50[_0x66bd('0x64')])?null:_0x34da50['channelCount'];_0x4c1d9c['original_bitRate']=isNaN(_0x34da50['bitRate'])?null:_0x34da50['bitRate'];_0x4c1d9c[_0x66bd('0x65')]=isNaN(_0x34da50['sampleRate'])?null:_0x34da50[_0x66bd('0x66')];});_0x2af0dc['on'](_0x66bd('0x67'),function(_0x21bbdf){_0x4c1d9c[_0x66bd('0x68')]=isNaN(_0x21bbdf[_0x66bd('0x60')])?null:_0x21bbdf[_0x66bd('0x60')]*0x3e8;_0x4c1d9c[_0x66bd('0x69')]=isNaN(_0x21bbdf[_0x66bd('0x62')])?null:_0x21bbdf['sampleCount'];_0x4c1d9c[_0x66bd('0x6a')]=isNaN(_0x21bbdf[_0x66bd('0x64')])?null:_0x21bbdf[_0x66bd('0x64')];_0x4c1d9c[_0x66bd('0x6b')]=isNaN(_0x21bbdf[_0x66bd('0x6c')])?null:_0x21bbdf[_0x66bd('0x6c')];_0x4c1d9c[_0x66bd('0x6d')]=isNaN(_0x21bbdf[_0x66bd('0x66')])?null:_0x21bbdf[_0x66bd('0x66')];});_0x2af0dc['on'](_0x66bd('0x1a'),function(){fs[_0x66bd('0x6e')](_0x1bf344,parseInt(_0x66bd('0x5d'),0x8));return db[_0x66bd('0x2e')][_0x66bd('0x54')](_0x4c1d9c)['then'](function(_0x3a4699){var _0x57cfc0={'role':_0x3a5a5a[_0x66bd('0x6f')][_0x66bd('0x70')],'userProfileId':_0x3a5a5a['body'][_0x66bd('0x71')]};if(!_0x57cfc0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x57cfc0['role']==='user'){var _0x1734df=_0x3a4699[_0x66bd('0x28')]({'plain':!![]});return db[_0x66bd('0x72')]['find']({'where':{'name':_0x66bd('0x29'),'userProfileId':_0x57cfc0['userProfileId']},'raw':!![]})[_0x66bd('0x26')](function(_0x2dee4b){if(_0x2dee4b&&_0x2dee4b[_0x66bd('0x73')]===0x0){return db[_0x66bd('0x2a')][_0x66bd('0x54')]({'name':_0x1734df[_0x66bd('0x2c')],'resourceId':_0x1734df['id'],'type':_0x2dee4b['name'],'sectionId':_0x2dee4b['id']},{})[_0x66bd('0x26')](function(){return _0x3a4699;});}else{return _0x3a4699;}})['catch'](function(_0xaa1877){logger[_0x66bd('0x2b')](_0x66bd('0x74'),_0xaa1877);throw _0xaa1877;});}return _0x3a4699;})[_0x66bd('0x26')](respondWithResult(_0x3b0dbd,null))[_0x66bd('0x45')](handleError(_0x3b0dbd,null));});_0x2af0dc['start']();}catch(_0x54a704){_0x3b0dbd[_0x66bd('0x19')](0x1f4)[_0x66bd('0x5f')](_0x54a704);}};exports['update']=function(_0x5ac376,_0x86acbb,_0x4becd2){return db[_0x66bd('0x2e')][_0x66bd('0x4a')]({'where':{'id':_0x5ac376[_0x66bd('0x47')]['id']}})[_0x66bd('0x26')](handleEntityNotFound(_0x86acbb,null))['then'](saveUpdates(_[_0x66bd('0x3c')](_0x5ac376[_0x66bd('0x6f')],[_0x66bd('0x2c'),_0x66bd('0x75')]),null))[_0x66bd('0x26')](respondWithResult(_0x86acbb,null))[_0x66bd('0x45')](handleError(_0x86acbb,null));};exports[_0x66bd('0x76')]=function(_0x38bc3d,_0x35ae25,_0x2b0a92){return db['Sound'][_0x66bd('0x4a')]({'where':{'id':_0x38bc3d['params']['id']}})['then'](function(_0x1d7f2d){if(_0x1d7f2d){return _0x1d7f2d[_0x66bd('0x27')]();}})['then'](function(_0x61eea5){var _0xf0fe9c=path[_0x66bd('0x4e')](config[_0x66bd('0x4f')],'server/files/sounds/original',util[_0x66bd('0x53')](_0x66bd('0x52'),_0x61eea5[_0x66bd('0x77')],_0x61eea5[_0x66bd('0x78')]));var _0xb80ea4=path['join'](config[_0x66bd('0x4f')],_0x66bd('0x50'),util[_0x66bd('0x53')]('%s.%s',_0x61eea5['save_name'],_0x61eea5['converted_format']));fs[_0x66bd('0x5e')](_0xf0fe9c);fs[_0x66bd('0x5e')](_0xb80ea4);return _0x61eea5;})['then'](function(_0x4010b4){if(_0x4010b4){return _0x35ae25['status'](0xcc)[_0x66bd('0x1a')]();}})[_0x66bd('0x26')](handleEntityNotFound(_0x35ae25,null))[_0x66bd('0x45')](handleError(_0x35ae25,null));}; \ No newline at end of file +var _0x52f8=['file','basename','filename','substring','server/files/sounds/converted','%s.%s','info','Sound\x20upload\x20destination:\x20%s','chmodSync','transcode','wav','error','src','duration','sampleCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','converted_channelCount','converted_bitRate','converted_sampleRate','0777','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Sounds','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','find','description','delete','server/files/sounds/original','original_format','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','count','limit','status','set','Content-Range','apply','update','then','destroy','get','UserProfileResource','stack','name','send','index','map','Sound','rawAttributes','type','model','query','intersection','attributes','fields','sort','where','filters','merge','filter','options','includeAll','rows','catch','show','params','keys','length','include','download','save_name','converted_format','existsSync','root','ValidationError','join','format','originalname','extname'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x52f8,0x113));var _0x852f=function(_0x504b9d,_0x274e13){_0x504b9d=_0x504b9d-0x0;var _0x3c80f4=_0x52f8[_0x504b9d];return _0x3c80f4;};'use strict';var emlformat=require(_0x852f('0x0'));var rimraf=require(_0x852f('0x1'));var zipdir=require(_0x852f('0x2'));var jsonpatch=require(_0x852f('0x3'));var rp=require(_0x852f('0x4'));var moment=require(_0x852f('0x5'));var BPromise=require(_0x852f('0x6'));var Mustache=require(_0x852f('0x7'));var util=require(_0x852f('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x852f('0x9'));var ejs=require(_0x852f('0xa'));var fs=require('fs');var fs_extra=require(_0x852f('0xb'));var _=require(_0x852f('0xc'));var squel=require(_0x852f('0xd'));var crypto=require(_0x852f('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x852f('0xf'));var authService=require(_0x852f('0x10'));var qs=require(_0x852f('0x11'));var as=require(_0x852f('0x12'));var hardwareService=require(_0x852f('0x13'));var logger=require(_0x852f('0x14'))(_0x852f('0x15'));var utils=require(_0x852f('0x16'));var config=require(_0x852f('0x17'));var licenseUtil=require(_0x852f('0x18'));var db=require(_0x852f('0x19'))['db'];function respondWithStatusCode(_0x31ac32,_0x5ca6c7){_0x5ca6c7=_0x5ca6c7||0xcc;return function(_0x52a6fe){if(_0x52a6fe){return _0x31ac32[_0x852f('0x1a')](_0x5ca6c7);}return _0x31ac32['status'](_0x5ca6c7)[_0x852f('0x1b')]();};}function respondWithResult(_0x1a15a6,_0x5b68f6){_0x5b68f6=_0x5b68f6||0xc8;return function(_0x4df978){if(_0x4df978){return _0x1a15a6['status'](_0x5b68f6)[_0x852f('0x1c')](_0x4df978);}};}function respondWithFilteredResult(_0x3093be,_0x534eee){return function(_0x594ad1){if(_0x594ad1){var _0x747c81=typeof _0x534eee[_0x852f('0x1d')]==='undefined'&&typeof _0x534eee['limit']===_0x852f('0x1e');var _0x17a664=_0x594ad1[_0x852f('0x1f')];var _0x280263=_0x747c81?0x0:_0x534eee[_0x852f('0x1d')];var _0x402873=_0x747c81?_0x594ad1[_0x852f('0x1f')]:_0x534eee[_0x852f('0x1d')]+_0x534eee[_0x852f('0x20')];var _0x4841d4;if(_0x402873>=_0x17a664){_0x402873=_0x17a664;_0x4841d4=0xc8;}else{_0x4841d4=0xce;}_0x3093be[_0x852f('0x21')](_0x4841d4);return _0x3093be[_0x852f('0x22')](_0x852f('0x23'),_0x280263+'-'+_0x402873+'/'+_0x17a664)[_0x852f('0x1c')](_0x594ad1);}return null;};}function patchUpdates(_0x51995a){return function(_0x2d02fa){try{jsonpatch[_0x852f('0x24')](_0x2d02fa,_0x51995a,!![]);}catch(_0x58b459){return BPromise['reject'](_0x58b459);}return _0x2d02fa['save']();};}function saveUpdates(_0x1e312a,_0xaf8128){return function(_0x2dd903){if(_0x2dd903){return _0x2dd903[_0x852f('0x25')](_0x1e312a)[_0x852f('0x26')](function(_0x16daf4){return _0x16daf4;});}return null;};}function removeEntity(_0x21efee,_0x121000){return function(_0x67b4cd){if(_0x67b4cd){return _0x67b4cd[_0x852f('0x27')]()[_0x852f('0x26')](function(){var _0x13e47e=_0x67b4cd[_0x852f('0x28')]({'plain':!![]});var _0xc5b34d='Sounds';return db[_0x852f('0x29')][_0x852f('0x27')]({'where':{'type':_0xc5b34d,'resourceId':_0x13e47e['id']}})[_0x852f('0x26')](function(){return _0x67b4cd;});})['then'](function(){_0x21efee[_0x852f('0x21')](0xcc)[_0x852f('0x1b')]();});}};}function handleEntityNotFound(_0x930f17,_0x45ebba){return function(_0x2052ba){if(!_0x2052ba){_0x930f17[_0x852f('0x1a')](0x194);}return _0x2052ba;};}function handleError(_0x46186f,_0x45f0d6){_0x45f0d6=_0x45f0d6||0x1f4;return function(_0x479bab){logger['error'](_0x479bab[_0x852f('0x2a')]);if(_0x479bab[_0x852f('0x2b')]){delete _0x479bab[_0x852f('0x2b')];}_0x46186f[_0x852f('0x21')](_0x45f0d6)[_0x852f('0x2c')](_0x479bab);};}exports[_0x852f('0x2d')]=function(_0x1ed910,_0x1131e0){var _0x4eaf3f={},_0x3bd495={},_0x25566f={'count':0x0,'rows':[]};var _0x472da8=_[_0x852f('0x2e')](db[_0x852f('0x2f')][_0x852f('0x30')],function(_0x44164){return{'name':_0x44164['fieldName'],'type':_0x44164[_0x852f('0x31')]['key']};});_0x3bd495[_0x852f('0x32')]=_[_0x852f('0x2e')](_0x472da8,_0x852f('0x2b'));_0x3bd495[_0x852f('0x33')]=_['keys'](_0x1ed910[_0x852f('0x33')]);_0x3bd495['filters']=_[_0x852f('0x34')](_0x3bd495[_0x852f('0x32')],_0x3bd495[_0x852f('0x33')]);_0x4eaf3f[_0x852f('0x35')]=_['intersection'](_0x3bd495[_0x852f('0x32')],qs[_0x852f('0x36')](_0x1ed910['query'][_0x852f('0x36')]));_0x4eaf3f[_0x852f('0x35')]=_0x4eaf3f[_0x852f('0x35')]['length']?_0x4eaf3f[_0x852f('0x35')]:_0x3bd495['model'];if(!_0x1ed910[_0x852f('0x33')]['hasOwnProperty']('nolimit')){_0x4eaf3f[_0x852f('0x20')]=qs[_0x852f('0x20')](_0x1ed910[_0x852f('0x33')][_0x852f('0x20')]);_0x4eaf3f[_0x852f('0x1d')]=qs['offset'](_0x1ed910[_0x852f('0x33')]['offset']);}_0x4eaf3f['order']=qs[_0x852f('0x37')](_0x1ed910[_0x852f('0x33')]['sort']);_0x4eaf3f[_0x852f('0x38')]=qs[_0x852f('0x39')](_['pick'](_0x1ed910['query'],_0x3bd495[_0x852f('0x39')]),_0x472da8);if(_0x1ed910['query']['filter']){_0x4eaf3f[_0x852f('0x38')]=_[_0x852f('0x3a')](_0x4eaf3f[_0x852f('0x38')],{'$or':_[_0x852f('0x2e')](_0x472da8,function(_0x5a161b){if(_0x5a161b['type']!=='VIRTUAL'){var _0x52c498={};_0x52c498[_0x5a161b[_0x852f('0x2b')]]={'$like':'%'+_0x1ed910[_0x852f('0x33')][_0x852f('0x3b')]+'%'};return _0x52c498;}})});}_0x4eaf3f=_['merge']({},_0x4eaf3f,_0x1ed910[_0x852f('0x3c')]);var _0x55d585={'where':_0x4eaf3f['where']};return db[_0x852f('0x2f')][_0x852f('0x1f')](_0x55d585)[_0x852f('0x26')](function(_0x1c4309){_0x25566f[_0x852f('0x1f')]=_0x1c4309;if(_0x1ed910[_0x852f('0x33')][_0x852f('0x3d')]){_0x4eaf3f['include']=[{'all':!![]}];}return db['Sound']['findAll'](_0x4eaf3f);})[_0x852f('0x26')](function(_0x4d00f8){_0x25566f[_0x852f('0x3e')]=_0x4d00f8;return _0x25566f;})[_0x852f('0x26')](respondWithFilteredResult(_0x1131e0,_0x4eaf3f))[_0x852f('0x3f')](handleError(_0x1131e0,null));};exports[_0x852f('0x40')]=function(_0x4540ae,_0x3c3aae){var _0x5c96b4={'raw':!![],'where':{'id':_0x4540ae[_0x852f('0x41')]['id']}},_0x2d5ccf={};_0x2d5ccf['model']=_[_0x852f('0x42')](db[_0x852f('0x2f')][_0x852f('0x30')]);_0x2d5ccf[_0x852f('0x33')]=_[_0x852f('0x42')](_0x4540ae['query']);_0x2d5ccf[_0x852f('0x39')]=_[_0x852f('0x34')](_0x2d5ccf[_0x852f('0x32')],_0x2d5ccf[_0x852f('0x33')]);_0x5c96b4[_0x852f('0x35')]=_['intersection'](_0x2d5ccf[_0x852f('0x32')],qs[_0x852f('0x36')](_0x4540ae[_0x852f('0x33')]['fields']));_0x5c96b4[_0x852f('0x35')]=_0x5c96b4[_0x852f('0x35')][_0x852f('0x43')]?_0x5c96b4[_0x852f('0x35')]:_0x2d5ccf['model'];if(_0x4540ae[_0x852f('0x33')]['includeAll']){_0x5c96b4[_0x852f('0x44')]=[{'all':!![]}];}_0x5c96b4=_['merge']({},_0x5c96b4,_0x4540ae[_0x852f('0x3c')]);return db['Sound']['find'](_0x5c96b4)[_0x852f('0x26')](handleEntityNotFound(_0x3c3aae,null))['then'](respondWithResult(_0x3c3aae,null))[_0x852f('0x3f')](handleError(_0x3c3aae,null));};exports[_0x852f('0x45')]=function(_0x5b627f,_0x34fff5,_0x96d205){return db['Sound']['find']({'where':{'id':_0x5b627f['params']['id']},'attributes':[_0x852f('0x2b'),_0x852f('0x46'),_0x852f('0x47')],'raw':!![]})[_0x852f('0x26')](handleEntityNotFound(_0x34fff5,null))[_0x852f('0x26')](function(_0x4d641f){if(_0x4d641f){if(!fs[_0x852f('0x48')](path['join'](config[_0x852f('0x49')],'server/files/sounds/converted',_0x4d641f[_0x852f('0x46')]+'.'+_0x4d641f['converted_format']))){throw new db['Sequelize'][(_0x852f('0x4a'))]('Sound\x20not\x20found');}return _0x34fff5[_0x852f('0x45')](path[_0x852f('0x4b')](config[_0x852f('0x49')],'server/files/sounds/converted',util[_0x852f('0x4c')]('%s.%s',_0x4d641f[_0x852f('0x46')],_0x4d641f[_0x852f('0x47')])),util[_0x852f('0x4c')]('%s.%s',_0x4d641f['name'],_0x4d641f[_0x852f('0x47')]));}return null;})[_0x852f('0x3f')](handleError(_0x34fff5,null));};exports['create']=function(_0x30a8e7,_0x133d22,_0x576575){var _0x4462b1={'name':path['basename'](_0x30a8e7['file'][_0x852f('0x4d')],path[_0x852f('0x4e')](_0x30a8e7[_0x852f('0x4f')][_0x852f('0x4d')])),'save_name':path[_0x852f('0x50')](_0x30a8e7['file'][_0x852f('0x51')],path[_0x852f('0x4e')](_0x30a8e7[_0x852f('0x4f')]['filename'])),'original_format':path[_0x852f('0x4e')](_0x30a8e7['file'][_0x852f('0x4d')])[_0x852f('0x52')](0x1),'converted_format':'wav'};var _0x48d757=path[_0x852f('0x4b')](config[_0x852f('0x49')],'server/files/sounds/original',_0x30a8e7[_0x852f('0x4f')][_0x852f('0x51')]);var _0x391017=path[_0x852f('0x4b')](config[_0x852f('0x49')],_0x852f('0x53'),util['format'](_0x852f('0x54'),path['basename'](_0x30a8e7[_0x852f('0x4f')][_0x852f('0x51')],path[_0x852f('0x4e')](_0x30a8e7[_0x852f('0x4f')][_0x852f('0x51')])),_0x4462b1[_0x852f('0x47')]));logger['info']('Sound\x20upload\x20filepath:\x20%s',_0x48d757);logger[_0x852f('0x55')](_0x852f('0x56'),_0x391017);try{fs[_0x852f('0x57')](_0x48d757,parseInt('0777',0x8));var _0x3d80a2=sox[_0x852f('0x58')](_0x48d757,_0x391017,{'sampleRate':0x1f40,'format':_0x852f('0x59'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x3d80a2['on'](_0x852f('0x5a'),function(_0x2f53d5){fs['unlinkSync'](_0x48d757);_0x133d22[_0x852f('0x21')](0x1f4)[_0x852f('0x2c')](_0x2f53d5);});_0x3d80a2['on'](_0x852f('0x5b'),function(_0x51042e){_0x4462b1['original_duration']=isNaN(_0x51042e['duration'])?null:_0x51042e[_0x852f('0x5c')]*0x3e8;_0x4462b1['original_sampleCount']=isNaN(_0x51042e[_0x852f('0x5d')])?null:_0x51042e[_0x852f('0x5d')];_0x4462b1['original_channelCount']=isNaN(_0x51042e[_0x852f('0x5e')])?null:_0x51042e[_0x852f('0x5e')];_0x4462b1[_0x852f('0x5f')]=isNaN(_0x51042e['bitRate'])?null:_0x51042e[_0x852f('0x60')];_0x4462b1[_0x852f('0x61')]=isNaN(_0x51042e['sampleRate'])?null:_0x51042e[_0x852f('0x62')];});_0x3d80a2['on']('dest',function(_0x339cd4){_0x4462b1['converted_duration']=isNaN(_0x339cd4['duration'])?null:_0x339cd4[_0x852f('0x5c')]*0x3e8;_0x4462b1['converted_sampleCount']=isNaN(_0x339cd4[_0x852f('0x5d')])?null:_0x339cd4[_0x852f('0x5d')];_0x4462b1[_0x852f('0x63')]=isNaN(_0x339cd4[_0x852f('0x5e')])?null:_0x339cd4[_0x852f('0x5e')];_0x4462b1[_0x852f('0x64')]=isNaN(_0x339cd4[_0x852f('0x60')])?null:_0x339cd4[_0x852f('0x60')];_0x4462b1[_0x852f('0x65')]=isNaN(_0x339cd4[_0x852f('0x62')])?null:_0x339cd4[_0x852f('0x62')];});_0x3d80a2['on'](_0x852f('0x1b'),function(){fs[_0x852f('0x57')](_0x391017,parseInt(_0x852f('0x66'),0x8));return db[_0x852f('0x2f')]['create'](_0x4462b1)[_0x852f('0x26')](function(_0x50a707){var _0xa87324={'role':_0x30a8e7['body']['role'],'userProfileId':_0x30a8e7[_0x852f('0x67')][_0x852f('0x68')]};if(!_0xa87324)throw new Error(_0x852f('0x69'));if(_0xa87324[_0x852f('0x6a')]==='user'){var _0x3f6dc0=_0x50a707[_0x852f('0x28')]({'plain':!![]});return db[_0x852f('0x6b')]['find']({'where':{'name':_0x852f('0x6c'),'userProfileId':_0xa87324[_0x852f('0x68')]},'raw':!![]})['then'](function(_0x178717){if(_0x178717&&_0x178717[_0x852f('0x6d')]===0x0){return db['UserProfileResource']['create']({'name':_0x3f6dc0[_0x852f('0x2b')],'resourceId':_0x3f6dc0['id'],'type':_0x178717[_0x852f('0x2b')],'sectionId':_0x178717['id']},{})[_0x852f('0x26')](function(){return _0x50a707;});}else{return _0x50a707;}})[_0x852f('0x3f')](function(_0x58e5cb){logger[_0x852f('0x5a')](_0x852f('0x6e'),_0x58e5cb);throw _0x58e5cb;});}return _0x50a707;})[_0x852f('0x26')](respondWithResult(_0x133d22,null))['catch'](handleError(_0x133d22,null));});_0x3d80a2[_0x852f('0x6f')]();}catch(_0x4c335e){_0x133d22['status'](0x1f4)[_0x852f('0x2c')](_0x4c335e);}};exports['update']=function(_0x16bd31,_0x1b53c4,_0x2d7c9e){return db[_0x852f('0x2f')][_0x852f('0x70')]({'where':{'id':_0x16bd31[_0x852f('0x41')]['id']}})[_0x852f('0x26')](handleEntityNotFound(_0x1b53c4,null))[_0x852f('0x26')](saveUpdates(_['pick'](_0x16bd31[_0x852f('0x67')],[_0x852f('0x2b'),_0x852f('0x71')]),null))['then'](respondWithResult(_0x1b53c4,null))[_0x852f('0x3f')](handleError(_0x1b53c4,null));};exports[_0x852f('0x72')]=function(_0x1a7bc9,_0x37578e,_0x321218){return db[_0x852f('0x2f')][_0x852f('0x70')]({'where':{'id':_0x1a7bc9['params']['id']}})[_0x852f('0x26')](function(_0x2742f2){if(_0x2742f2){return _0x2742f2[_0x852f('0x27')]();}})['then'](function(_0x297630){var _0x484e0f=path['join'](config['root'],_0x852f('0x73'),util[_0x852f('0x4c')](_0x852f('0x54'),_0x297630['save_name'],_0x297630[_0x852f('0x74')]));var _0x3d7bd0=path['join'](config[_0x852f('0x49')],_0x852f('0x53'),util[_0x852f('0x4c')](_0x852f('0x54'),_0x297630['save_name'],_0x297630[_0x852f('0x47')]));fs[_0x852f('0x75')](_0x484e0f);fs[_0x852f('0x75')](_0x3d7bd0);return _0x297630;})[_0x852f('0x26')](function(_0x497358){if(_0x497358){return _0x37578e[_0x852f('0x21')](0xcc)[_0x852f('0x1b')]();}})[_0x852f('0x26')](handleEntityNotFound(_0x37578e,null))[_0x852f('0x3f')](handleError(_0x37578e,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 0d9cee5..1a3ba50 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 _0x0c70=['util','moment','rimraf','./sound.attributes','define','Sound','tools_sounds','lodash'];(function(_0x4d2841,_0x43bbfa){var _0x1c8b3d=function(_0x327336){while(--_0x327336){_0x4d2841['push'](_0x4d2841['shift']());}};_0x1c8b3d(++_0x43bbfa);}(_0x0c70,0x117));var _0x00c7=function(_0x2acdd5,_0x38cb93){_0x2acdd5=_0x2acdd5-0x0;var _0x279a99=_0x0c70[_0x2acdd5];return _0x279a99;};'use strict';var _=require(_0x00c7('0x0'));var util=require(_0x00c7('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x00c7('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x00c7('0x3'));var config=require('../../config/environment');var attributes=require(_0x00c7('0x4'));module['exports']=function(_0x5dd01c,_0x49d6eb){return _0x5dd01c[_0x00c7('0x5')](_0x00c7('0x6'),attributes,{'tableName':_0x00c7('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc13b=['api','bluebird','request-promise','path','rimraf','../../config/environment','./sound.attributes','exports','define','Sound','tools_sounds','lodash'];(function(_0x1d056a,_0x293d07){var _0x8e14c0=function(_0xb2a20a){while(--_0xb2a20a){_0x1d056a['push'](_0x1d056a['shift']());}};_0x8e14c0(++_0x293d07);}(_0xc13b,0x197));var _0xbc13=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0xc13b[_0x55e08b];return _0xd1a7ff;};'use strict';var _=require(_0xbc13('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xbc13('0x1'));var moment=require('moment');var BPromise=require(_0xbc13('0x2'));var rp=require(_0xbc13('0x3'));var fs=require('fs');var path=require(_0xbc13('0x4'));var rimraf=require(_0xbc13('0x5'));var config=require(_0xbc13('0x6'));var attributes=require(_0xbc13('0x7'));module[_0xbc13('0x8')]=function(_0x3614ca,_0x292aeb){return _0x3614ca[_0xbc13('0x9')](_0xbc13('0xa'),attributes,{'tableName':_0xbc13('0xb'),'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 2006d1c..292e2b4 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 _0xd834=['find','options','where','attributes','include','map','model','stringify','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','client','http','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowSound','Sound'];(function(_0x22431e,_0x5af0a3){var _0xd978e9=function(_0x2bbdd7){while(--_0x2bbdd7){_0x22431e['push'](_0x22431e['shift']());}};_0xd978e9(++_0x5af0a3);}(_0xd834,0x17c));var _0x4d83=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xd834[_0x8c43de];return _0xa6591b;};'use strict';var _=require(_0x4d83('0x0'));var util=require(_0x4d83('0x1'));var moment=require('moment');var BPromise=require(_0x4d83('0x2'));var rs=require(_0x4d83('0x3'));var fs=require('fs');var Redis=require(_0x4d83('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4d83('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x4d83('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x4d83('0x7')][_0x4d83('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x32dba9,_0x1cf2b9,_0xd097b){return new BPromise(function(_0x4ac74e,_0x292279){return client[_0x4d83('0x9')](_0x32dba9,_0xd097b)[_0x4d83('0xa')](function(_0x56111d){logger[_0x4d83('0xb')](_0x4d83('0xc'),_0x1cf2b9,_0x4d83('0xd'));logger[_0x4d83('0xe')](_0x4d83('0xf'),_0x1cf2b9,_0x4d83('0xd'),JSON['stringify'](_0x56111d));if(_0x56111d[_0x4d83('0x10')]){if(_0x56111d[_0x4d83('0x10')][_0x4d83('0x11')]===0x1f4){logger[_0x4d83('0x10')](_0x4d83('0xc'),_0x1cf2b9,_0x56111d[_0x4d83('0x10')]['message']);return _0x292279(_0x56111d['error'][_0x4d83('0x12')]);}logger[_0x4d83('0x10')](_0x4d83('0xc'),_0x1cf2b9,_0x56111d[_0x4d83('0x10')][_0x4d83('0x12')]);return _0x4ac74e(_0x56111d[_0x4d83('0x10')][_0x4d83('0x12')]);}else{logger[_0x4d83('0xb')](_0x4d83('0xc'),_0x1cf2b9,_0x4d83('0xd'));_0x4ac74e(_0x56111d[_0x4d83('0x13')][_0x4d83('0x12')]);}})[_0x4d83('0x14')](function(_0x2ce108){logger[_0x4d83('0x10')](_0x4d83('0xc'),_0x1cf2b9,_0x2ce108);_0x292279(_0x2ce108);});});}exports[_0x4d83('0x15')]=function(_0x3de96c){var _0x56dc1f=this;return new Promise(function(_0x272877,_0x3c5f80){return db[_0x4d83('0x16')][_0x4d83('0x17')]({'raw':_0x3de96c[_0x4d83('0x18')]?_0x3de96c[_0x4d83('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x3de96c[_0x4d83('0x18')]?_0x3de96c[_0x4d83('0x18')][_0x4d83('0x19')]||null:null,'attributes':_0x3de96c[_0x4d83('0x18')]?_0x3de96c['options'][_0x4d83('0x1a')]||null:null,'include':_0x3de96c[_0x4d83('0x18')]?_0x3de96c[_0x4d83('0x18')][_0x4d83('0x1b')]?_[_0x4d83('0x1c')](_0x3de96c['options'][_0x4d83('0x1b')],function(_0x157c3b){return{'model':db[_0x157c3b[_0x4d83('0x1d')]],'as':_0x157c3b['as'],'attributes':_0x157c3b[_0x4d83('0x1a')],'include':_0x157c3b['include']?_['map'](_0x157c3b['include'],function(_0x1b2b94){return{'model':db[_0x1b2b94[_0x4d83('0x1d')]],'as':_0x1b2b94['as'],'attributes':_0x1b2b94[_0x4d83('0x1a')],'include':_0x1b2b94[_0x4d83('0x1b')]?_[_0x4d83('0x1c')](_0x1b2b94[_0x4d83('0x1b')],function(_0x14ba70){return{'model':db[_0x14ba70[_0x4d83('0x1d')]],'as':_0x14ba70['as'],'attributes':_0x14ba70[_0x4d83('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x4d83('0xa')](function(_0x69497d){logger[_0x4d83('0xb')](_0x4d83('0x15'),_0x3de96c);logger[_0x4d83('0xe')]('ShowSound',_0x3de96c,JSON[_0x4d83('0x1e')](_0x69497d));_0x272877(_0x69497d);})['catch'](function(_0x5c5e18){logger[_0x4d83('0x10')](_0x4d83('0x15'),_0x5c5e18[_0x4d83('0x12')],_0x3de96c);_0x3c5f80(_0x56dc1f['error'](0x1f4,_0x5c5e18[_0x4d83('0x12')]));});});}; \ No newline at end of file +var _0x6ba3=['request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','ShowSound','Sound','find','options','raw','where','attributes','include','map','model','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','Sound,\x20%s,\x20%s'];(function(_0x40a825,_0x3bac79){var _0x273a54=function(_0x5628d8){while(--_0x5628d8){_0x40a825['push'](_0x40a825['shift']());}};_0x273a54(++_0x3bac79);}(_0x6ba3,0x92));var _0x36ba=function(_0x276098,_0x3bb8b3){_0x276098=_0x276098-0x0;var _0x3e7506=_0x6ba3[_0x276098];return _0x3e7506;};'use strict';var _=require(_0x36ba('0x0'));var util=require(_0x36ba('0x1'));var moment=require(_0x36ba('0x2'));var BPromise=require('bluebird');var rs=require(_0x36ba('0x3'));var fs=require('fs');var Redis=require(_0x36ba('0x4'));var db=require(_0x36ba('0x5'))['db'];var utils=require(_0x36ba('0x6'));var logger=require(_0x36ba('0x7'))(_0x36ba('0x8'));var config=require(_0x36ba('0x9'));var jayson=require(_0x36ba('0xa'));var client=jayson['client'][_0x36ba('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5a0bd4,_0xc94d11,_0x25d702){return new BPromise(function(_0x2bdd04,_0x2e1d7b){return client[_0x36ba('0xc')](_0x5a0bd4,_0x25d702)['then'](function(_0x90d2db){logger['info'](_0x36ba('0xd'),_0xc94d11,_0x36ba('0xe'));logger[_0x36ba('0xf')](_0x36ba('0x10'),_0xc94d11,_0x36ba('0xe'),JSON[_0x36ba('0x11')](_0x90d2db));if(_0x90d2db['error']){if(_0x90d2db[_0x36ba('0x12')]['code']===0x1f4){logger[_0x36ba('0x12')]('Sound,\x20%s,\x20%s',_0xc94d11,_0x90d2db[_0x36ba('0x12')]['message']);return _0x2e1d7b(_0x90d2db[_0x36ba('0x12')][_0x36ba('0x13')]);}logger['error'](_0x36ba('0xd'),_0xc94d11,_0x90d2db[_0x36ba('0x12')]['message']);return _0x2bdd04(_0x90d2db['error'][_0x36ba('0x13')]);}else{logger[_0x36ba('0x14')](_0x36ba('0xd'),_0xc94d11,_0x36ba('0xe'));_0x2bdd04(_0x90d2db['result'][_0x36ba('0x13')]);}})[_0x36ba('0x15')](function(_0x6b4a18){logger[_0x36ba('0x12')](_0x36ba('0xd'),_0xc94d11,_0x6b4a18);_0x2e1d7b(_0x6b4a18);});});}exports[_0x36ba('0x16')]=function(_0x3b0c99){var _0x28264c=this;return new Promise(function(_0x5db93b,_0x4bbcfe){return db[_0x36ba('0x17')][_0x36ba('0x18')]({'raw':_0x3b0c99[_0x36ba('0x19')]?_0x3b0c99[_0x36ba('0x19')][_0x36ba('0x1a')]===undefined?!![]:![]:!![],'where':_0x3b0c99[_0x36ba('0x19')]?_0x3b0c99['options'][_0x36ba('0x1b')]||null:null,'attributes':_0x3b0c99['options']?_0x3b0c99[_0x36ba('0x19')][_0x36ba('0x1c')]||null:null,'include':_0x3b0c99[_0x36ba('0x19')]?_0x3b0c99[_0x36ba('0x19')][_0x36ba('0x1d')]?_[_0x36ba('0x1e')](_0x3b0c99[_0x36ba('0x19')][_0x36ba('0x1d')],function(_0xb1e897){return{'model':db[_0xb1e897['model']],'as':_0xb1e897['as'],'attributes':_0xb1e897[_0x36ba('0x1c')],'include':_0xb1e897['include']?_['map'](_0xb1e897[_0x36ba('0x1d')],function(_0x55e6aa){return{'model':db[_0x55e6aa[_0x36ba('0x1f')]],'as':_0x55e6aa['as'],'attributes':_0x55e6aa[_0x36ba('0x1c')],'include':_0x55e6aa[_0x36ba('0x1d')]?_['map'](_0x55e6aa[_0x36ba('0x1d')],function(_0x45c8bd){return{'model':db[_0x45c8bd[_0x36ba('0x1f')]],'as':_0x45c8bd['as'],'attributes':_0x45c8bd['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x14063c){logger[_0x36ba('0x14')](_0x36ba('0x16'),_0x3b0c99);logger[_0x36ba('0xf')](_0x36ba('0x16'),_0x3b0c99,JSON[_0x36ba('0x11')](_0x14063c));_0x5db93b(_0x14063c);})['catch'](function(_0x238cfe){logger['error'](_0x36ba('0x16'),_0x238cfe['message'],_0x3b0c99);_0x4bbcfe(_0x28264c[_0x36ba('0x12')](0x1f4,_0x238cfe[_0x36ba('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index b6cebe6..71c8b80 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(_0x518c1f,_0xe5e20e){var _0x102c14=function(_0x37c717){while(--_0x37c717){_0x518c1f['push'](_0x518c1f['shift']());}};_0x102c14(++_0xe5e20e);}(_0x757a,0xde));var _0xa757=function(_0xc5fe85,_0x40d655){_0xc5fe85=_0xc5fe85-0x0;var _0x9669e9=_0x757a[_0xc5fe85];return _0x9669e9;};'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 _0xb7e7=['exports','multer','path','express','fs-extra','../../components/interaction/service','../../config/environment','./squareMessage.controller','index','get','/:id','show','post','isAuthenticated','create','put','delete','destroy'];(function(_0x4b874b,_0x1f1751){var _0x2f7bf3=function(_0x5b5eb6){while(--_0x5b5eb6){_0x4b874b['push'](_0x4b874b['shift']());}};_0x2f7bf3(++_0x1f1751);}(_0xb7e7,0x121));var _0x7b7e=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0xb7e7[_0xc4001c];return _0x49f7bc;};'use strict';var multer=require(_0x7b7e('0x0'));var util=require('util');var path=require(_0x7b7e('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b7e('0x2'));var router=express['Router']();var fs_extra=require(_0x7b7e('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var controller=require(_0x7b7e('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x7b7e('0x7')]);router[_0x7b7e('0x8')](_0x7b7e('0x9'),auth['isAuthenticated'](),controller[_0x7b7e('0xa')]);router[_0x7b7e('0xb')]('/',auth[_0x7b7e('0xc')](),controller[_0x7b7e('0xd')]);router[_0x7b7e('0xe')](_0x7b7e('0x9'),auth[_0x7b7e('0xc')](),controller['update']);router[_0x7b7e('0xf')](_0x7b7e('0x9'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x10')]);module[_0x7b7e('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 a2b49ea..940863b 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 _0xc683=['exports','out','STRING','TEXT','sequelize'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc683,0x9f));var _0x3c68=function(_0x8a969d,_0x339d9f){_0x8a969d=_0x8a969d-0x0;var _0x1d8dc7=_0xc683[_0x8a969d];return _0x1d8dc7;};'use strict';var Sequelize=require(_0x3c68('0x0'));module[_0x3c68('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in',_0x3c68('0x2')),'defaultValue':_0x3c68('0x2'),'allowNull':![]},'providerName':{'type':Sequelize[_0x3c68('0x3')]},'providerResponse':{'type':Sequelize[_0x3c68('0x4')]}}; \ No newline at end of file +var _0x0cc3=['TEXT','medium','ENUM','sequelize','exports','STRING'];(function(_0x54e3f6,_0x4a43a8){var _0x3d490a=function(_0x5a6429){while(--_0x5a6429){_0x54e3f6['push'](_0x54e3f6['shift']());}};_0x3d490a(++_0x4a43a8);}(_0x0cc3,0x105));var _0x30cc=function(_0x28e252,_0x860d0){_0x28e252=_0x28e252-0x0;var _0x308d04=_0x0cc3[_0x28e252];return _0x308d04;};'use strict';var Sequelize=require(_0x30cc('0x0'));module[_0x30cc('0x1')]={'uniqueid':{'type':Sequelize[_0x30cc('0x2')]},'body':{'type':Sequelize[_0x30cc('0x3')](_0x30cc('0x4')),'allowNull':![]},'direction':{'type':Sequelize[_0x30cc('0x5')]('in','out'),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x30cc('0x3')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 52b4b9c..863677c 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 _0x75ea=['../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','then','destroy','error','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','order','sort','where','filter','VIRTUAL','options','SquareMessage','includeAll','include','findAll','rows','show','params','length','merge','find','create','catch','update','body','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service'];(function(_0x56740a,_0x568894){var _0x257144=function(_0x2b8cc5){while(--_0x2b8cc5){_0x56740a['push'](_0x56740a['shift']());}};_0x257144(++_0x568894);}(_0x75ea,0x7d));var _0xa75e=function(_0x32850f,_0x32c3ba){_0x32850f=_0x32850f-0x0;var _0x556e05=_0x75ea[_0x32850f];return _0x556e05;};'use strict';var emlformat=require(_0xa75e('0x0'));var rimraf=require(_0xa75e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa75e('0x2'));var rp=require(_0xa75e('0x3'));var moment=require('moment');var BPromise=require(_0xa75e('0x4'));var Mustache=require(_0xa75e('0x5'));var util=require(_0xa75e('0x6'));var path=require(_0xa75e('0x7'));var sox=require(_0xa75e('0x8'));var csv=require('to-csv');var ejs=require(_0xa75e('0x9'));var fs=require('fs');var fs_extra=require(_0xa75e('0xa'));var _=require(_0xa75e('0xb'));var squel=require(_0xa75e('0xc'));var crypto=require(_0xa75e('0xd'));var jsforce=require(_0xa75e('0xe'));var deskjs=require(_0xa75e('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa75e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xa75e('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa75e('0x12'))(_0xa75e('0x13'));var utils=require('../../config/utils');var config=require(_0xa75e('0x14'));var licenseUtil=require(_0xa75e('0x15'));var db=require(_0xa75e('0x16'))['db'];function respondWithStatusCode(_0x35c81b,_0x46d808){_0x46d808=_0x46d808||0xcc;return function(_0x3d01eb){if(_0x3d01eb){return _0x35c81b[_0xa75e('0x17')](_0x46d808);}return _0x35c81b[_0xa75e('0x18')](_0x46d808)[_0xa75e('0x19')]();};}function respondWithResult(_0x5319e2,_0x171e67){_0x171e67=_0x171e67||0xc8;return function(_0x5ae4fe){if(_0x5ae4fe){return _0x5319e2[_0xa75e('0x18')](_0x171e67)[_0xa75e('0x1a')](_0x5ae4fe);}};}function respondWithFilteredResult(_0x530c38,_0x235860){return function(_0x3179e2){if(_0x3179e2){var _0x1d78ce=typeof _0x235860['offset']===_0xa75e('0x1b')&&typeof _0x235860[_0xa75e('0x1c')]===_0xa75e('0x1b');var _0x5c0725=_0x3179e2[_0xa75e('0x1d')];var _0x71fd71=_0x1d78ce?0x0:_0x235860[_0xa75e('0x1e')];var _0x44a786=_0x1d78ce?_0x3179e2['count']:_0x235860[_0xa75e('0x1e')]+_0x235860[_0xa75e('0x1c')];var _0x149647;if(_0x44a786>=_0x5c0725){_0x44a786=_0x5c0725;_0x149647=0xc8;}else{_0x149647=0xce;}_0x530c38['status'](_0x149647);return _0x530c38['set'](_0xa75e('0x1f'),_0x71fd71+'-'+_0x44a786+'/'+_0x5c0725)['json'](_0x3179e2);}return null;};}function patchUpdates(_0x47b19c){return function(_0x4e0809){try{jsonpatch[_0xa75e('0x20')](_0x4e0809,_0x47b19c,!![]);}catch(_0x51279b){return BPromise[_0xa75e('0x21')](_0x51279b);}return _0x4e0809['save']();};}function saveUpdates(_0x32766b,_0x38b3ad){return function(_0x2b184e){if(_0x2b184e){return _0x2b184e['update'](_0x32766b)[_0xa75e('0x22')](function(_0x411d82){return _0x411d82;});}return null;};}function removeEntity(_0x158caa,_0x4e64aa){return function(_0x227d81){if(_0x227d81){return _0x227d81[_0xa75e('0x23')]()[_0xa75e('0x22')](function(){_0x158caa[_0xa75e('0x18')](0xcc)[_0xa75e('0x19')]();});}};}function handleEntityNotFound(_0x29c9df,_0x3c80e9){return function(_0x168e8c){if(!_0x168e8c){_0x29c9df[_0xa75e('0x17')](0x194);}return _0x168e8c;};}function handleError(_0x5c41c0,_0x52bee6){_0x52bee6=_0x52bee6||0x1f4;return function(_0x278e4a){logger[_0xa75e('0x24')](_0x278e4a['stack']);if(_0x278e4a[_0xa75e('0x25')]){delete _0x278e4a[_0xa75e('0x25')];}_0x5c41c0[_0xa75e('0x18')](_0x52bee6)[_0xa75e('0x26')](_0x278e4a);};}exports[_0xa75e('0x27')]=function(_0x113af5,_0x57bbba){var _0x455b8a={},_0x15241f={},_0x267816={'count':0x0,'rows':[]};var _0x26fb0f=_[_0xa75e('0x28')](db['SquareMessage'][_0xa75e('0x29')],function(_0x566db9){return{'name':_0x566db9['fieldName'],'type':_0x566db9[_0xa75e('0x2a')][_0xa75e('0x2b')]};});_0x15241f[_0xa75e('0x2c')]=_[_0xa75e('0x28')](_0x26fb0f,_0xa75e('0x25'));_0x15241f[_0xa75e('0x2d')]=_[_0xa75e('0x2e')](_0x113af5[_0xa75e('0x2d')]);_0x15241f[_0xa75e('0x2f')]=_[_0xa75e('0x30')](_0x15241f[_0xa75e('0x2c')],_0x15241f[_0xa75e('0x2d')]);_0x455b8a[_0xa75e('0x31')]=_['intersection'](_0x15241f[_0xa75e('0x2c')],qs[_0xa75e('0x32')](_0x113af5[_0xa75e('0x2d')][_0xa75e('0x32')]));_0x455b8a[_0xa75e('0x31')]=_0x455b8a[_0xa75e('0x31')]['length']?_0x455b8a['attributes']:_0x15241f['model'];if(!_0x113af5[_0xa75e('0x2d')]['hasOwnProperty']('nolimit')){_0x455b8a[_0xa75e('0x1c')]=qs['limit'](_0x113af5[_0xa75e('0x2d')][_0xa75e('0x1c')]);_0x455b8a[_0xa75e('0x1e')]=qs[_0xa75e('0x1e')](_0x113af5['query'][_0xa75e('0x1e')]);}_0x455b8a[_0xa75e('0x33')]=qs[_0xa75e('0x34')](_0x113af5['query']['sort']);_0x455b8a[_0xa75e('0x35')]=qs[_0xa75e('0x2f')](_['pick'](_0x113af5[_0xa75e('0x2d')],_0x15241f[_0xa75e('0x2f')]),_0x26fb0f);if(_0x113af5['query'][_0xa75e('0x36')]){_0x455b8a[_0xa75e('0x35')]=_['merge'](_0x455b8a[_0xa75e('0x35')],{'$or':_[_0xa75e('0x28')](_0x26fb0f,function(_0x77bb70){if(_0x77bb70['type']!==_0xa75e('0x37')){var _0x15e2a8={};_0x15e2a8[_0x77bb70[_0xa75e('0x25')]]={'$like':'%'+_0x113af5[_0xa75e('0x2d')][_0xa75e('0x36')]+'%'};return _0x15e2a8;}})});}_0x455b8a=_['merge']({},_0x455b8a,_0x113af5[_0xa75e('0x38')]);var _0x4b7fd7={'where':_0x455b8a[_0xa75e('0x35')]};return db[_0xa75e('0x39')][_0xa75e('0x1d')](_0x4b7fd7)[_0xa75e('0x22')](function(_0x11d219){_0x267816['count']=_0x11d219;if(_0x113af5[_0xa75e('0x2d')][_0xa75e('0x3a')]){_0x455b8a[_0xa75e('0x3b')]=[{'all':!![]}];}return db['SquareMessage'][_0xa75e('0x3c')](_0x455b8a);})[_0xa75e('0x22')](function(_0x5988b7){_0x267816[_0xa75e('0x3d')]=_0x5988b7;return _0x267816;})[_0xa75e('0x22')](respondWithFilteredResult(_0x57bbba,_0x455b8a))['catch'](handleError(_0x57bbba,null));};exports[_0xa75e('0x3e')]=function(_0x17964e,_0x222b88){var _0x29d4d4={'raw':!![],'where':{'id':_0x17964e[_0xa75e('0x3f')]['id']}},_0x2a0257={};_0x2a0257['model']=_[_0xa75e('0x2e')](db[_0xa75e('0x39')][_0xa75e('0x29')]);_0x2a0257[_0xa75e('0x2d')]=_['keys'](_0x17964e['query']);_0x2a0257['filters']=_[_0xa75e('0x30')](_0x2a0257[_0xa75e('0x2c')],_0x2a0257[_0xa75e('0x2d')]);_0x29d4d4[_0xa75e('0x31')]=_['intersection'](_0x2a0257[_0xa75e('0x2c')],qs['fields'](_0x17964e[_0xa75e('0x2d')][_0xa75e('0x32')]));_0x29d4d4[_0xa75e('0x31')]=_0x29d4d4['attributes'][_0xa75e('0x40')]?_0x29d4d4[_0xa75e('0x31')]:_0x2a0257['model'];if(_0x17964e[_0xa75e('0x2d')][_0xa75e('0x3a')]){_0x29d4d4[_0xa75e('0x3b')]=[{'all':!![]}];}_0x29d4d4=_[_0xa75e('0x41')]({},_0x29d4d4,_0x17964e['options']);return db[_0xa75e('0x39')][_0xa75e('0x42')](_0x29d4d4)[_0xa75e('0x22')](handleEntityNotFound(_0x222b88,null))[_0xa75e('0x22')](respondWithResult(_0x222b88,null))['catch'](handleError(_0x222b88,null));};exports[_0xa75e('0x43')]=function(_0x58c0eb,_0x427a20){return db[_0xa75e('0x39')][_0xa75e('0x43')](_0x58c0eb['body'],{})[_0xa75e('0x22')](respondWithResult(_0x427a20,0xc9))[_0xa75e('0x44')](handleError(_0x427a20,null));};exports[_0xa75e('0x45')]=function(_0x4cf713,_0x13213b){if(_0x4cf713[_0xa75e('0x46')]['id']){delete _0x4cf713[_0xa75e('0x46')]['id'];}return db['SquareMessage'][_0xa75e('0x42')]({'where':{'id':_0x4cf713['params']['id']}})[_0xa75e('0x22')](handleEntityNotFound(_0x13213b,null))[_0xa75e('0x22')](saveUpdates(_0x4cf713[_0xa75e('0x46')],null))['then'](respondWithResult(_0x13213b,null))[_0xa75e('0x44')](handleError(_0x13213b,null));};exports[_0xa75e('0x23')]=function(_0x47f04e,_0x1521a6){return db[_0xa75e('0x39')][_0xa75e('0x42')]({'where':{'id':_0x47f04e[_0xa75e('0x3f')]['id']}})[_0xa75e('0x22')](handleEntityNotFound(_0x1521a6,null))[_0xa75e('0x22')](removeEntity(_0x1521a6,null))[_0xa75e('0x44')](handleError(_0x1521a6,null));}; \ No newline at end of file +var _0x98f1=['stack','name','map','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','SquareMessage','includeAll','include','findAll','catch','keys','find','create','body','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy'];(function(_0x40faa2,_0x31d114){var _0x28fab4=function(_0x575390){while(--_0x575390){_0x40faa2['push'](_0x40faa2['shift']());}};_0x28fab4(++_0x31d114);}(_0x98f1,0x1cf));var _0x198f=function(_0x5baf22,_0x21fe88){_0x5baf22=_0x5baf22-0x0;var _0x5789ad=_0x98f1[_0x5baf22];return _0x5789ad;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x198f('0x0'));var jsonpatch=require(_0x198f('0x1'));var rp=require(_0x198f('0x2'));var moment=require(_0x198f('0x3'));var BPromise=require(_0x198f('0x4'));var Mustache=require(_0x198f('0x5'));var util=require('util');var path=require(_0x198f('0x6'));var sox=require(_0x198f('0x7'));var csv=require(_0x198f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x198f('0x9'));var _=require(_0x198f('0xa'));var squel=require(_0x198f('0xb'));var crypto=require('crypto');var jsforce=require(_0x198f('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x198f('0x8'));var querystring=require(_0x198f('0xd'));var Papa=require(_0x198f('0xe'));var Redis=require(_0x198f('0xf'));var authService=require(_0x198f('0x10'));var qs=require(_0x198f('0x11'));var as=require(_0x198f('0x12'));var hardwareService=require(_0x198f('0x13'));var logger=require(_0x198f('0x14'))(_0x198f('0x15'));var utils=require(_0x198f('0x16'));var config=require(_0x198f('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x198f('0x18'))['db'];function respondWithStatusCode(_0x10e25a,_0x3e1fc7){_0x3e1fc7=_0x3e1fc7||0xcc;return function(_0x44fcf6){if(_0x44fcf6){return _0x10e25a[_0x198f('0x19')](_0x3e1fc7);}return _0x10e25a[_0x198f('0x1a')](_0x3e1fc7)[_0x198f('0x1b')]();};}function respondWithResult(_0x492ad9,_0x343d6c){_0x343d6c=_0x343d6c||0xc8;return function(_0x2193df){if(_0x2193df){return _0x492ad9['status'](_0x343d6c)[_0x198f('0x1c')](_0x2193df);}};}function respondWithFilteredResult(_0x569ee6,_0x56b901){return function(_0x3377a7){if(_0x3377a7){var _0x489846=typeof _0x56b901[_0x198f('0x1d')]===_0x198f('0x1e')&&typeof _0x56b901['limit']===_0x198f('0x1e');var _0x498f4b=_0x3377a7[_0x198f('0x1f')];var _0x4f2557=_0x489846?0x0:_0x56b901['offset'];var _0x14cfb1=_0x489846?_0x3377a7[_0x198f('0x1f')]:_0x56b901[_0x198f('0x1d')]+_0x56b901[_0x198f('0x20')];var _0x5eba0a;if(_0x14cfb1>=_0x498f4b){_0x14cfb1=_0x498f4b;_0x5eba0a=0xc8;}else{_0x5eba0a=0xce;}_0x569ee6[_0x198f('0x1a')](_0x5eba0a);return _0x569ee6[_0x198f('0x21')](_0x198f('0x22'),_0x4f2557+'-'+_0x14cfb1+'/'+_0x498f4b)['json'](_0x3377a7);}return null;};}function patchUpdates(_0x58a8a9){return function(_0x13edff){try{jsonpatch[_0x198f('0x23')](_0x13edff,_0x58a8a9,!![]);}catch(_0x5caf68){return BPromise[_0x198f('0x24')](_0x5caf68);}return _0x13edff[_0x198f('0x25')]();};}function saveUpdates(_0x25ecb7,_0x15da1b){return function(_0x232073){if(_0x232073){return _0x232073[_0x198f('0x26')](_0x25ecb7)[_0x198f('0x27')](function(_0x313e92){return _0x313e92;});}return null;};}function removeEntity(_0x109fc1,_0x48b632){return function(_0x28daba){if(_0x28daba){return _0x28daba[_0x198f('0x28')]()[_0x198f('0x27')](function(){_0x109fc1[_0x198f('0x1a')](0xcc)[_0x198f('0x1b')]();});}};}function handleEntityNotFound(_0x5b0fdd,_0x5bcd76){return function(_0xf11240){if(!_0xf11240){_0x5b0fdd[_0x198f('0x19')](0x194);}return _0xf11240;};}function handleError(_0x4dcabc,_0x18a293){_0x18a293=_0x18a293||0x1f4;return function(_0x511c32){logger['error'](_0x511c32[_0x198f('0x29')]);if(_0x511c32[_0x198f('0x2a')]){delete _0x511c32[_0x198f('0x2a')];}_0x4dcabc['status'](_0x18a293)['send'](_0x511c32);};}exports['index']=function(_0x5df785,_0x297967){var _0x597fc6={},_0x15e9d8={},_0x4693bd={'count':0x0,'rows':[]};var _0x2cff10=_[_0x198f('0x2b')](db['SquareMessage'][_0x198f('0x2c')],function(_0x2fc741){return{'name':_0x2fc741[_0x198f('0x2d')],'type':_0x2fc741[_0x198f('0x2e')]['key']};});_0x15e9d8[_0x198f('0x2f')]=_['map'](_0x2cff10,'name');_0x15e9d8[_0x198f('0x30')]=_['keys'](_0x5df785['query']);_0x15e9d8[_0x198f('0x31')]=_[_0x198f('0x32')](_0x15e9d8[_0x198f('0x2f')],_0x15e9d8[_0x198f('0x30')]);_0x597fc6[_0x198f('0x33')]=_[_0x198f('0x32')](_0x15e9d8[_0x198f('0x2f')],qs[_0x198f('0x34')](_0x5df785[_0x198f('0x30')][_0x198f('0x34')]));_0x597fc6[_0x198f('0x33')]=_0x597fc6[_0x198f('0x33')][_0x198f('0x35')]?_0x597fc6['attributes']:_0x15e9d8[_0x198f('0x2f')];if(!_0x5df785[_0x198f('0x30')][_0x198f('0x36')]('nolimit')){_0x597fc6[_0x198f('0x20')]=qs['limit'](_0x5df785[_0x198f('0x30')]['limit']);_0x597fc6[_0x198f('0x1d')]=qs[_0x198f('0x1d')](_0x5df785[_0x198f('0x30')][_0x198f('0x1d')]);}_0x597fc6[_0x198f('0x37')]=qs[_0x198f('0x38')](_0x5df785[_0x198f('0x30')][_0x198f('0x38')]);_0x597fc6[_0x198f('0x39')]=qs[_0x198f('0x31')](_[_0x198f('0x3a')](_0x5df785[_0x198f('0x30')],_0x15e9d8[_0x198f('0x31')]),_0x2cff10);if(_0x5df785[_0x198f('0x30')][_0x198f('0x3b')]){_0x597fc6[_0x198f('0x39')]=_[_0x198f('0x3c')](_0x597fc6[_0x198f('0x39')],{'$or':_['map'](_0x2cff10,function(_0xd548b1){if(_0xd548b1[_0x198f('0x2e')]!==_0x198f('0x3d')){var _0x5c2eda={};_0x5c2eda[_0xd548b1[_0x198f('0x2a')]]={'$like':'%'+_0x5df785[_0x198f('0x30')]['filter']+'%'};return _0x5c2eda;}})});}_0x597fc6=_[_0x198f('0x3c')]({},_0x597fc6,_0x5df785[_0x198f('0x3e')]);var _0xd1c474={'where':_0x597fc6['where']};return db[_0x198f('0x3f')]['count'](_0xd1c474)['then'](function(_0x468b1f){_0x4693bd[_0x198f('0x1f')]=_0x468b1f;if(_0x5df785['query'][_0x198f('0x40')]){_0x597fc6[_0x198f('0x41')]=[{'all':!![]}];}return db['SquareMessage'][_0x198f('0x42')](_0x597fc6);})['then'](function(_0x4d1665){_0x4693bd['rows']=_0x4d1665;return _0x4693bd;})[_0x198f('0x27')](respondWithFilteredResult(_0x297967,_0x597fc6))[_0x198f('0x43')](handleError(_0x297967,null));};exports['show']=function(_0x5d0005,_0x3393ac){var _0x1ce335={'raw':!![],'where':{'id':_0x5d0005['params']['id']}},_0x2ad10c={};_0x2ad10c[_0x198f('0x2f')]=_[_0x198f('0x44')](db['SquareMessage'][_0x198f('0x2c')]);_0x2ad10c['query']=_[_0x198f('0x44')](_0x5d0005['query']);_0x2ad10c['filters']=_['intersection'](_0x2ad10c[_0x198f('0x2f')],_0x2ad10c['query']);_0x1ce335[_0x198f('0x33')]=_[_0x198f('0x32')](_0x2ad10c[_0x198f('0x2f')],qs[_0x198f('0x34')](_0x5d0005[_0x198f('0x30')][_0x198f('0x34')]));_0x1ce335[_0x198f('0x33')]=_0x1ce335[_0x198f('0x33')]['length']?_0x1ce335[_0x198f('0x33')]:_0x2ad10c[_0x198f('0x2f')];if(_0x5d0005[_0x198f('0x30')][_0x198f('0x40')]){_0x1ce335[_0x198f('0x41')]=[{'all':!![]}];}_0x1ce335=_[_0x198f('0x3c')]({},_0x1ce335,_0x5d0005[_0x198f('0x3e')]);return db[_0x198f('0x3f')][_0x198f('0x45')](_0x1ce335)[_0x198f('0x27')](handleEntityNotFound(_0x3393ac,null))[_0x198f('0x27')](respondWithResult(_0x3393ac,null))[_0x198f('0x43')](handleError(_0x3393ac,null));};exports[_0x198f('0x46')]=function(_0x203c65,_0x4dd900){return db[_0x198f('0x3f')][_0x198f('0x46')](_0x203c65['body'],{})['then'](respondWithResult(_0x4dd900,0xc9))['catch'](handleError(_0x4dd900,null));};exports[_0x198f('0x26')]=function(_0xae5d28,_0x1dbda4){if(_0xae5d28[_0x198f('0x47')]['id']){delete _0xae5d28[_0x198f('0x47')]['id'];}return db[_0x198f('0x3f')]['find']({'where':{'id':_0xae5d28['params']['id']}})[_0x198f('0x27')](handleEntityNotFound(_0x1dbda4,null))[_0x198f('0x27')](saveUpdates(_0xae5d28[_0x198f('0x47')],null))[_0x198f('0x27')](respondWithResult(_0x1dbda4,null))[_0x198f('0x43')](handleError(_0x1dbda4,null));};exports[_0x198f('0x28')]=function(_0x4af107,_0xdface7){return db['SquareMessage'][_0x198f('0x45')]({'where':{'id':_0x4af107['params']['id']}})[_0x198f('0x27')](handleEntityNotFound(_0xdface7,null))[_0x198f('0x27')](removeEntity(_0xdface7,null))[_0x198f('0x43')](handleError(_0xdface7,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index ffeea2a..1765f85 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 _0xafb6=['../../config/environment','exports','define','square_messages','lodash','util','../../config/logger','api','moment','bluebird','rimraf'];(function(_0x20abe5,_0x51f8da){var _0x29f97f=function(_0x294ee5){while(--_0x294ee5){_0x20abe5['push'](_0x20abe5['shift']());}};_0x29f97f(++_0x51f8da);}(_0xafb6,0x164));var _0x6afb=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xafb6[_0x13ea00];return _0x1f7347;};'use strict';var _=require(_0x6afb('0x0'));var util=require(_0x6afb('0x1'));var logger=require(_0x6afb('0x2'))(_0x6afb('0x3'));var moment=require(_0x6afb('0x4'));var BPromise=require(_0x6afb('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6afb('0x6'));var config=require(_0x6afb('0x7'));var attributes=require('./squareMessage.attributes');module[_0x6afb('0x8')]=function(_0x26cf49,_0xdfa3ca){return _0x26cf49[_0x6afb('0x9')]('SquareMessage',attributes,{'tableName':_0x6afb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5569=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareMessage.attributes','exports','define'];(function(_0x424195,_0x5bc3fa){var _0x529058=function(_0x9d45){while(--_0x9d45){_0x424195['push'](_0x424195['shift']());}};_0x529058(++_0x5bc3fa);}(_0x5569,0x1a4));var _0x9556=function(_0x49258d,_0x5bcf0e){_0x49258d=_0x49258d-0x0;var _0x2a9044=_0x5569[_0x49258d];return _0x2a9044;};'use strict';var _=require(_0x9556('0x0'));var util=require('util');var logger=require(_0x9556('0x1'))(_0x9556('0x2'));var moment=require(_0x9556('0x3'));var BPromise=require(_0x9556('0x4'));var rp=require(_0x9556('0x5'));var fs=require('fs');var path=require(_0x9556('0x6'));var rimraf=require(_0x9556('0x7'));var config=require(_0x9556('0x8'));var attributes=require(_0x9556('0x9'));module[_0x9556('0xa')]=function(_0x132600,_0x3516d2){return _0x132600[_0x9556('0xb')]('SquareMessage',attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index 8194c80..1796db3 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 _0xe47e=['client','http','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','SquareMessage','create','body','options','CreateSquareMessage','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x557a6d,_0x36633d){var _0x5cea71=function(_0x1f4d78){while(--_0x1f4d78){_0x557a6d['push'](_0x557a6d['shift']());}};_0x5cea71(++_0x36633d);}(_0xe47e,0x1eb));var _0xee47=function(_0x211632,_0x378e2e){_0x211632=_0x211632-0x0;var _0x5a1da1=_0xe47e[_0x211632];return _0x5a1da1;};'use strict';var _=require('lodash');var util=require(_0xee47('0x0'));var moment=require(_0xee47('0x1'));var BPromise=require(_0xee47('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xee47('0x3'));var db=require(_0xee47('0x4'))['db'];var utils=require(_0xee47('0x5'));var logger=require(_0xee47('0x6'))(_0xee47('0x7'));var config=require(_0xee47('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xee47('0x9')][_0xee47('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x31528a,_0x5d2ff2,_0x208817){return new BPromise(function(_0x3a4b15,_0x186fa6){return client['request'](_0x31528a,_0x208817)[_0xee47('0xb')](function(_0x425955){logger[_0xee47('0xc')](_0xee47('0xd'),_0x5d2ff2,_0xee47('0xe'));logger[_0xee47('0xf')]('SquareMessage,\x20%s,\x20%s,\x20%s',_0x5d2ff2,'request\x20sent',JSON['stringify'](_0x425955));if(_0x425955[_0xee47('0x10')]){if(_0x425955['error'][_0xee47('0x11')]===0x1f4){logger['error']('SquareMessage,\x20%s,\x20%s',_0x5d2ff2,_0x425955[_0xee47('0x10')][_0xee47('0x12')]);return _0x186fa6(_0x425955[_0xee47('0x10')][_0xee47('0x12')]);}logger[_0xee47('0x10')](_0xee47('0xd'),_0x5d2ff2,_0x425955[_0xee47('0x10')][_0xee47('0x12')]);return _0x3a4b15(_0x425955[_0xee47('0x10')][_0xee47('0x12')]);}else{logger[_0xee47('0xc')]('SquareMessage,\x20%s,\x20%s',_0x5d2ff2,_0xee47('0xe'));_0x3a4b15(_0x425955[_0xee47('0x13')][_0xee47('0x12')]);}})['catch'](function(_0x3be412){logger[_0xee47('0x10')](_0xee47('0xd'),_0x5d2ff2,_0x3be412);_0x186fa6(_0x3be412);});});}exports['CreateSquareMessage']=function(_0x52d7cc){var _0x2decbc=this;return new Promise(function(_0x195c27,_0x577720){return db[_0xee47('0x14')][_0xee47('0x15')](_0x52d7cc[_0xee47('0x16')],{'raw':_0x52d7cc[_0xee47('0x17')]?_0x52d7cc['options']['raw']===undefined?!![]:![]:!![]})[_0xee47('0xb')](function(_0x34be40){logger[_0xee47('0xc')](_0xee47('0x18'),_0x52d7cc);logger[_0xee47('0xf')]('CreateSquareMessage',_0x52d7cc,JSON['stringify'](_0x34be40));_0x195c27(_0x34be40);})['catch'](function(_0xa0704c){logger[_0xee47('0x10')](_0xee47('0x18'),_0xa0704c[_0xee47('0x12')],_0x52d7cc);_0x577720(_0x2decbc[_0xee47('0x10')](0x1f4,_0xa0704c[_0xee47('0x12')]));});});}; \ No newline at end of file +var _0x97ef=['options','raw','then','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','CreateSquareMessage','SquareMessage','body'];(function(_0x2ece74,_0x4a240f){var _0x3c45b9=function(_0x5cc1de){while(--_0x5cc1de){_0x2ece74['push'](_0x2ece74['shift']());}};_0x3c45b9(++_0x4a240f);}(_0x97ef,0x73));var _0xf97e=function(_0x201ae7,_0x162fd5){_0x201ae7=_0x201ae7-0x0;var _0x5c8830=_0x97ef[_0x201ae7];return _0x5c8830;};'use strict';var _=require(_0xf97e('0x0'));var util=require(_0xf97e('0x1'));var moment=require('moment');var BPromise=require(_0xf97e('0x2'));var rs=require(_0xf97e('0x3'));var fs=require('fs');var Redis=require(_0xf97e('0x4'));var db=require(_0xf97e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf97e('0x6'))(_0xf97e('0x7'));var config=require(_0xf97e('0x8'));var jayson=require(_0xf97e('0x9'));var client=jayson[_0xf97e('0xa')][_0xf97e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3a6547,_0x3101f3,_0x8e432f){return new BPromise(function(_0x2f4659,_0x3b8f67){return client[_0xf97e('0xc')](_0x3a6547,_0x8e432f)['then'](function(_0x32df42){logger['info'](_0xf97e('0xd'),_0x3101f3,_0xf97e('0xe'));logger[_0xf97e('0xf')]('SquareMessage,\x20%s,\x20%s,\x20%s',_0x3101f3,_0xf97e('0xe'),JSON[_0xf97e('0x10')](_0x32df42));if(_0x32df42[_0xf97e('0x11')]){if(_0x32df42[_0xf97e('0x11')][_0xf97e('0x12')]===0x1f4){logger[_0xf97e('0x11')](_0xf97e('0xd'),_0x3101f3,_0x32df42['error']['message']);return _0x3b8f67(_0x32df42[_0xf97e('0x11')][_0xf97e('0x13')]);}logger[_0xf97e('0x11')](_0xf97e('0xd'),_0x3101f3,_0x32df42[_0xf97e('0x11')]['message']);return _0x2f4659(_0x32df42[_0xf97e('0x11')]['message']);}else{logger[_0xf97e('0x14')]('SquareMessage,\x20%s,\x20%s',_0x3101f3,'request\x20sent');_0x2f4659(_0x32df42['result']['message']);}})[_0xf97e('0x15')](function(_0x3bbd53){logger[_0xf97e('0x11')](_0xf97e('0xd'),_0x3101f3,_0x3bbd53);_0x3b8f67(_0x3bbd53);});});}exports[_0xf97e('0x16')]=function(_0x3ad30a){var _0x20464e=this;return new Promise(function(_0x27c423,_0x5e0c18){return db[_0xf97e('0x17')]['create'](_0x3ad30a[_0xf97e('0x18')],{'raw':_0x3ad30a[_0xf97e('0x19')]?_0x3ad30a['options'][_0xf97e('0x1a')]===undefined?!![]:![]:!![]})[_0xf97e('0x1b')](function(_0xc2407c){logger['info'](_0xf97e('0x16'),_0x3ad30a);logger['debug'](_0xf97e('0x16'),_0x3ad30a,JSON['stringify'](_0xc2407c));_0x27c423(_0xc2407c);})['catch'](function(_0x2b34d4){logger[_0xf97e('0x11')](_0xf97e('0x16'),_0x2b34d4[_0xf97e('0x13')],_0x3ad30a);_0x5e0c18(_0x20464e['error'](0x1f4,_0x2b34d4[_0xf97e('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index afcac31..f724308 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 _0x617c=['get','index','/:id','isAuthenticated','15s','test','post','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller'];(function(_0x45d388,_0x383699){var _0x5d94b4=function(_0x5c2778){while(--_0x5c2778){_0x45d388['push'](_0x45d388['shift']());}};_0x5d94b4(++_0x383699);}(_0x617c,0x1d9));var _0xc617=function(_0x2ca9d4,_0x51d5c6){_0x2ca9d4=_0x2ca9d4-0x0;var _0x258956=_0x617c[_0x2ca9d4];return _0x258956;};'use strict';var multer=require(_0xc617('0x0'));var util=require(_0xc617('0x1'));var path=require('path');var timeout=require(_0xc617('0x2'));var express=require(_0xc617('0x3'));var router=express[_0xc617('0x4')]();var fs_extra=require(_0xc617('0x5'));var auth=require(_0xc617('0x6'));var interaction=require(_0xc617('0x7'));var config=require(_0xc617('0x8'));var controller=require(_0xc617('0x9'));router[_0xc617('0xa')]('/',auth['isAuthenticated'](),controller[_0xc617('0xb')]);router[_0xc617('0xa')](_0xc617('0xc'),auth[_0xc617('0xd')](),controller['show']);router[_0xc617('0xa')]('/:id/test',auth[_0xc617('0xd')](),timeout(_0xc617('0xe')),controller[_0xc617('0xf')]);router[_0xc617('0x10')]('/',auth[_0xc617('0xd')](),controller['create']);router['put'](_0xc617('0xc'),auth[_0xc617('0xd')](),controller[_0xc617('0x11')]);router[_0xc617('0x12')]('/:id',auth[_0xc617('0xd')](),controller[_0xc617('0x13')]);module[_0xc617('0x14')]=router; \ No newline at end of file +var _0x93d3=['multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./squareOdbc.controller','get','isAuthenticated','index','show','post','update','delete','/:id','destroy','exports'];(function(_0x9d9d58,_0x7bf873){var _0x51d4d3=function(_0x3e7528){while(--_0x3e7528){_0x9d9d58['push'](_0x9d9d58['shift']());}};_0x51d4d3(++_0x7bf873);}(_0x93d3,0x11d));var _0x393d=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0x93d3[_0x2064e5];return _0x21a233;};'use strict';var multer=require(_0x393d('0x0'));var util=require('util');var path=require(_0x393d('0x1'));var timeout=require(_0x393d('0x2'));var express=require(_0x393d('0x3'));var router=express[_0x393d('0x4')]();var fs_extra=require(_0x393d('0x5'));var auth=require(_0x393d('0x6'));var interaction=require(_0x393d('0x7'));var config=require('../../config/environment');var controller=require(_0x393d('0x8'));router[_0x393d('0x9')]('/',auth[_0x393d('0xa')](),controller[_0x393d('0xb')]);router['get']('/:id',auth[_0x393d('0xa')](),controller[_0x393d('0xc')]);router[_0x393d('0x9')]('/:id/test',auth['isAuthenticated'](),timeout('15s'),controller['test']);router[_0x393d('0xd')]('/',auth[_0x393d('0xa')](),controller['create']);router['put']('/:id',auth[_0x393d('0xa')](),controller[_0x393d('0xe')]);router[_0x393d('0xf')](_0x393d('0x10'),auth['isAuthenticated'](),controller[_0x393d('0x11')]);module[_0x393d('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 0c20c2b..020a868 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 _0x5300=['STRING','name','sequelize'];(function(_0x21edb6,_0x38670f){var _0x468e69=function(_0x3721c4){while(--_0x3721c4){_0x21edb6['push'](_0x21edb6['shift']());}};_0x468e69(++_0x38670f);}(_0x5300,0x1bb));var _0x0530=function(_0xbf59ae,_0x2d1abf){_0xbf59ae=_0xbf59ae-0x0;var _0x970c14=_0x5300[_0xbf59ae];return _0x970c14;};'use strict';var Sequelize=require(_0x0530('0x0'));module['exports']={'name':{'type':Sequelize[_0x0530('0x1')],'unique':_0x0530('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0x0530('0x1')]},'description':{'type':Sequelize[_0x0530('0x1')]}}; \ No newline at end of file +var _0x158b=['sequelize','STRING','name'];(function(_0x5adac6,_0x1a6482){var _0x273e72=function(_0x494d77){while(--_0x494d77){_0x5adac6['push'](_0x5adac6['shift']());}};_0x273e72(++_0x1a6482);}(_0x158b,0x11a));var _0xb158=function(_0x3807b8,_0x41a346){_0x3807b8=_0x3807b8-0x0;var _0x5715fd=_0x158b[_0x3807b8];return _0x5715fd;};'use strict';var Sequelize=require(_0xb158('0x0'));module['exports']={'name':{'type':Sequelize[_0xb158('0x1')],'unique':_0xb158('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0xb158('0x1')]},'description':{'type':Sequelize[_0xb158('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index b0afa8b..54f3414 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 _0x7287=['merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','SquareOdbc','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','test','dsn','odbc','openSync','rimraf','fast-json-patch','request-promise','moment','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','limit','undefined','count','Content-Range','save','update','then','destroy','get','ODBC','UserProfileResource','end','stack','name','send','index','map','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','order','sort','where','filter'];(function(_0xb1a51,_0x31ee90){var _0x404ff5=function(_0x5a1938){while(--_0x5a1938){_0xb1a51['push'](_0xb1a51['shift']());}};_0x404ff5(++_0x31ee90);}(_0x7287,0x163));var _0x7728=function(_0x5830a6,_0x1ca3b0){_0x5830a6=_0x5830a6-0x0;var _0x372fc1=_0x7287[_0x5830a6];return _0x372fc1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7728('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7728('0x1'));var rp=require(_0x7728('0x2'));var moment=require(_0x7728('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7728('0x4'));var path=require('path');var sox=require(_0x7728('0x5'));var csv=require(_0x7728('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7728('0x7'));var _=require(_0x7728('0x8'));var squel=require(_0x7728('0x9'));var crypto=require(_0x7728('0xa'));var jsforce=require(_0x7728('0xb'));var deskjs=require(_0x7728('0xc'));var toCsv=require(_0x7728('0x6'));var querystring=require(_0x7728('0xd'));var Papa=require(_0x7728('0xe'));var Redis=require(_0x7728('0xf'));var authService=require(_0x7728('0x10'));var qs=require(_0x7728('0x11'));var as=require(_0x7728('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7728('0x13'))(_0x7728('0x14'));var utils=require(_0x7728('0x15'));var config=require(_0x7728('0x16'));var licenseUtil=require(_0x7728('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x47e648,_0x4ad786){_0x4ad786=_0x4ad786||0xcc;return function(_0x2aea40){if(_0x2aea40){return _0x47e648[_0x7728('0x18')](_0x4ad786);}return _0x47e648[_0x7728('0x19')](_0x4ad786)['end']();};}function respondWithResult(_0x1a9c34,_0x357ef3){_0x357ef3=_0x357ef3||0xc8;return function(_0x429873){if(_0x429873){return _0x1a9c34[_0x7728('0x19')](_0x357ef3)[_0x7728('0x1a')](_0x429873);}};}function respondWithFilteredResult(_0x9b0899,_0x34deee){return function(_0x30b3a9){if(_0x30b3a9){var _0xba4d47=typeof _0x34deee[_0x7728('0x1b')]==='undefined'&&typeof _0x34deee[_0x7728('0x1c')]===_0x7728('0x1d');var _0x13b2d0=_0x30b3a9['count'];var _0x1ba9af=_0xba4d47?0x0:_0x34deee[_0x7728('0x1b')];var _0x1ff307=_0xba4d47?_0x30b3a9[_0x7728('0x1e')]:_0x34deee[_0x7728('0x1b')]+_0x34deee['limit'];var _0x45ae45;if(_0x1ff307>=_0x13b2d0){_0x1ff307=_0x13b2d0;_0x45ae45=0xc8;}else{_0x45ae45=0xce;}_0x9b0899['status'](_0x45ae45);return _0x9b0899['set'](_0x7728('0x1f'),_0x1ba9af+'-'+_0x1ff307+'/'+_0x13b2d0)['json'](_0x30b3a9);}return null;};}function patchUpdates(_0x1f60cf){return function(_0x2ff366){try{jsonpatch['apply'](_0x2ff366,_0x1f60cf,!![]);}catch(_0x3b6772){return BPromise['reject'](_0x3b6772);}return _0x2ff366[_0x7728('0x20')]();};}function saveUpdates(_0x3fd45f,_0x21d282){return function(_0x5943e8){if(_0x5943e8){return _0x5943e8[_0x7728('0x21')](_0x3fd45f)[_0x7728('0x22')](function(_0x1406cc){return _0x1406cc;});}return null;};}function removeEntity(_0x28b3ba,_0x312c30){return function(_0x8e987b){if(_0x8e987b){return _0x8e987b[_0x7728('0x23')]()[_0x7728('0x22')](function(){var _0x382a00=_0x8e987b[_0x7728('0x24')]({'plain':!![]});var _0x1f7bf9=_0x7728('0x25');return db[_0x7728('0x26')][_0x7728('0x23')]({'where':{'type':_0x1f7bf9,'resourceId':_0x382a00['id']}})['then'](function(){return _0x8e987b;});})[_0x7728('0x22')](function(){_0x28b3ba['status'](0xcc)[_0x7728('0x27')]();});}};}function handleEntityNotFound(_0x5c0913,_0x3bd2e2){return function(_0x93d27d){if(!_0x93d27d){_0x5c0913['sendStatus'](0x194);}return _0x93d27d;};}function handleError(_0x23df48,_0x4f1ab9){_0x4f1ab9=_0x4f1ab9||0x1f4;return function(_0x55890f){logger['error'](_0x55890f[_0x7728('0x28')]);if(_0x55890f['name']){delete _0x55890f[_0x7728('0x29')];}_0x23df48[_0x7728('0x19')](_0x4f1ab9)[_0x7728('0x2a')](_0x55890f);};}exports[_0x7728('0x2b')]=function(_0x1f10f1,_0x866b99){var _0x1faec7={},_0x31d252={},_0x553fb7={'count':0x0,'rows':[]};var _0x405ac4=_[_0x7728('0x2c')](db['SquareOdbc'][_0x7728('0x2d')],function(_0x58aeef){return{'name':_0x58aeef[_0x7728('0x2e')],'type':_0x58aeef['type'][_0x7728('0x2f')]};});_0x31d252[_0x7728('0x30')]=_[_0x7728('0x2c')](_0x405ac4,'name');_0x31d252['query']=_[_0x7728('0x31')](_0x1f10f1[_0x7728('0x32')]);_0x31d252[_0x7728('0x33')]=_[_0x7728('0x34')](_0x31d252['model'],_0x31d252['query']);_0x1faec7[_0x7728('0x35')]=_['intersection'](_0x31d252[_0x7728('0x30')],qs[_0x7728('0x36')](_0x1f10f1[_0x7728('0x32')][_0x7728('0x36')]));_0x1faec7['attributes']=_0x1faec7[_0x7728('0x35')][_0x7728('0x37')]?_0x1faec7[_0x7728('0x35')]:_0x31d252[_0x7728('0x30')];if(!_0x1f10f1['query']['hasOwnProperty']('nolimit')){_0x1faec7[_0x7728('0x1c')]=qs[_0x7728('0x1c')](_0x1f10f1['query'][_0x7728('0x1c')]);_0x1faec7[_0x7728('0x1b')]=qs[_0x7728('0x1b')](_0x1f10f1[_0x7728('0x32')][_0x7728('0x1b')]);}_0x1faec7[_0x7728('0x38')]=qs['sort'](_0x1f10f1[_0x7728('0x32')][_0x7728('0x39')]);_0x1faec7[_0x7728('0x3a')]=qs['filters'](_['pick'](_0x1f10f1['query'],_0x31d252['filters']),_0x405ac4);if(_0x1f10f1[_0x7728('0x32')][_0x7728('0x3b')]){_0x1faec7[_0x7728('0x3a')]=_[_0x7728('0x3c')](_0x1faec7[_0x7728('0x3a')],{'$or':_['map'](_0x405ac4,function(_0x104a7d){if(_0x104a7d['type']!==_0x7728('0x3d')){var _0x560296={};_0x560296[_0x104a7d['name']]={'$like':'%'+_0x1f10f1[_0x7728('0x32')][_0x7728('0x3b')]+'%'};return _0x560296;}})});}_0x1faec7=_[_0x7728('0x3c')]({},_0x1faec7,_0x1f10f1[_0x7728('0x3e')]);var _0x353a3b={'where':_0x1faec7[_0x7728('0x3a')]};return db['SquareOdbc']['count'](_0x353a3b)[_0x7728('0x22')](function(_0x42a3ad){_0x553fb7[_0x7728('0x1e')]=_0x42a3ad;if(_0x1f10f1[_0x7728('0x32')][_0x7728('0x3f')]){_0x1faec7[_0x7728('0x40')]=[{'all':!![]}];}return db['SquareOdbc']['findAll'](_0x1faec7);})['then'](function(_0x3f9b94){_0x553fb7[_0x7728('0x41')]=_0x3f9b94;return _0x553fb7;})[_0x7728('0x22')](respondWithFilteredResult(_0x866b99,_0x1faec7))[_0x7728('0x42')](handleError(_0x866b99,null));};exports[_0x7728('0x43')]=function(_0x321f3c,_0x6e93e2){var _0x56d9f2={'raw':!![],'where':{'id':_0x321f3c[_0x7728('0x44')]['id']}},_0x40933e={};_0x40933e[_0x7728('0x30')]=_['keys'](db[_0x7728('0x45')][_0x7728('0x2d')]);_0x40933e[_0x7728('0x32')]=_[_0x7728('0x31')](_0x321f3c[_0x7728('0x32')]);_0x40933e[_0x7728('0x33')]=_['intersection'](_0x40933e[_0x7728('0x30')],_0x40933e['query']);_0x56d9f2[_0x7728('0x35')]=_[_0x7728('0x34')](_0x40933e['model'],qs['fields'](_0x321f3c['query'][_0x7728('0x36')]));_0x56d9f2[_0x7728('0x35')]=_0x56d9f2['attributes'][_0x7728('0x37')]?_0x56d9f2[_0x7728('0x35')]:_0x40933e[_0x7728('0x30')];if(_0x321f3c[_0x7728('0x32')][_0x7728('0x3f')]){_0x56d9f2[_0x7728('0x40')]=[{'all':!![]}];}_0x56d9f2=_[_0x7728('0x3c')]({},_0x56d9f2,_0x321f3c[_0x7728('0x3e')]);return db['SquareOdbc'][_0x7728('0x46')](_0x56d9f2)[_0x7728('0x22')](handleEntityNotFound(_0x6e93e2,null))[_0x7728('0x22')](respondWithResult(_0x6e93e2,null))['catch'](handleError(_0x6e93e2,null));};exports[_0x7728('0x47')]=function(_0x58728c,_0x1799d0){return db[_0x7728('0x45')][_0x7728('0x47')](_0x58728c['body'],{})[_0x7728('0x22')](function(_0x2fd4e1){var _0x40b0c3=_0x58728c['user'][_0x7728('0x24')]({'plain':!![]});if(!_0x40b0c3)throw new Error(_0x7728('0x48'));if(_0x40b0c3[_0x7728('0x49')]==='user'){var _0x5a900f=_0x2fd4e1[_0x7728('0x24')]({'plain':!![]});var _0x44e74b=_0x7728('0x25');return db[_0x7728('0x4a')][_0x7728('0x46')]({'where':{'name':_0x44e74b,'userProfileId':_0x40b0c3[_0x7728('0x4b')]},'raw':!![]})[_0x7728('0x22')](function(_0x7810f2){if(_0x7810f2&&_0x7810f2[_0x7728('0x4c')]===0x0){return db[_0x7728('0x26')][_0x7728('0x47')]({'name':_0x5a900f[_0x7728('0x29')],'resourceId':_0x5a900f['id'],'type':_0x7810f2['name'],'sectionId':_0x7810f2['id']},{})[_0x7728('0x22')](function(){return _0x2fd4e1;});}else{return _0x2fd4e1;}})[_0x7728('0x42')](function(_0x40f5db){logger['error'](_0x7728('0x4d'),_0x40f5db);throw _0x40f5db;});}return _0x2fd4e1;})['then'](respondWithResult(_0x1799d0,0xc9))[_0x7728('0x42')](handleError(_0x1799d0,null));};exports['update']=function(_0x28ebee,_0x1016c2){if(_0x28ebee[_0x7728('0x4e')]['id']){delete _0x28ebee[_0x7728('0x4e')]['id'];}return db[_0x7728('0x45')]['find']({'where':{'id':_0x28ebee[_0x7728('0x44')]['id']}})[_0x7728('0x22')](handleEntityNotFound(_0x1016c2,null))['then'](saveUpdates(_0x28ebee[_0x7728('0x4e')],null))[_0x7728('0x22')](respondWithResult(_0x1016c2,null))['catch'](handleError(_0x1016c2,null));};exports[_0x7728('0x23')]=function(_0x803b21,_0x56b347){return db[_0x7728('0x45')][_0x7728('0x46')]({'where':{'id':_0x803b21[_0x7728('0x44')]['id']}})[_0x7728('0x22')](handleEntityNotFound(_0x56b347,null))[_0x7728('0x22')](removeEntity(_0x56b347,null))[_0x7728('0x42')](handleError(_0x56b347,null));};exports[_0x7728('0x4f')]=function(_0x59147c,_0xf99572,_0x33350f){var _0x2ec6d1;return db[_0x7728('0x45')][_0x7728('0x46')]({'where':{'id':_0x59147c['params']['id']},'attributes':['id',_0x7728('0x50')]})['then'](handleEntityNotFound(_0xf99572,null))['then'](function(_0x282433){if(_0x282433){var _0x1b9cd2=require(_0x7728('0x51'))();_0x1b9cd2[_0x7728('0x52')](_0x282433[_0x7728('0x50')]);_0x1b9cd2['closeSync']();return _0x282433;}})[_0x7728('0x22')](respondWithResult(_0xf99572,null))[_0x7728('0x42')](handleError(_0xf99572,null));}; \ No newline at end of file +var _0x1eba=['end','error','stack','name','send','index','map','SquareOdbc','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','sort','where','filters','pick','VIRTUAL','filter','merge','includeAll','include','findAll','catch','show','params','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','odbc','openSync','dsn','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','get','ODBC','status'];(function(_0x2926a7,_0x54fe0d){var _0x4eded3=function(_0x3ab646){while(--_0x3ab646){_0x2926a7['push'](_0x2926a7['shift']());}};_0x4eded3(++_0x54fe0d);}(_0x1eba,0xda));var _0xa1eb=function(_0x23ec06,_0x561142){_0x23ec06=_0x23ec06-0x0;var _0x2831d4=_0x1eba[_0x23ec06];return _0x2831d4;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa1eb('0x0'));var jsonpatch=require(_0xa1eb('0x1'));var rp=require(_0xa1eb('0x2'));var moment=require(_0xa1eb('0x3'));var BPromise=require(_0xa1eb('0x4'));var Mustache=require(_0xa1eb('0x5'));var util=require('util');var path=require(_0xa1eb('0x6'));var sox=require(_0xa1eb('0x7'));var csv=require(_0xa1eb('0x8'));var ejs=require(_0xa1eb('0x9'));var fs=require('fs');var fs_extra=require(_0xa1eb('0xa'));var _=require(_0xa1eb('0xb'));var squel=require(_0xa1eb('0xc'));var crypto=require(_0xa1eb('0xd'));var jsforce=require(_0xa1eb('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa1eb('0x8'));var querystring=require(_0xa1eb('0xf'));var Papa=require(_0xa1eb('0x10'));var Redis=require(_0xa1eb('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa1eb('0x12'));var logger=require(_0xa1eb('0x13'))(_0xa1eb('0x14'));var utils=require(_0xa1eb('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xa1eb('0x16'));var db=require(_0xa1eb('0x17'))['db'];function respondWithStatusCode(_0x56e940,_0x24a815){_0x24a815=_0x24a815||0xcc;return function(_0x1e0f82){if(_0x1e0f82){return _0x56e940[_0xa1eb('0x18')](_0x24a815);}return _0x56e940['status'](_0x24a815)['end']();};}function respondWithResult(_0xf0d31e,_0x108ace){_0x108ace=_0x108ace||0xc8;return function(_0x2396ef){if(_0x2396ef){return _0xf0d31e['status'](_0x108ace)[_0xa1eb('0x19')](_0x2396ef);}};}function respondWithFilteredResult(_0x1848af,_0x2fd596){return function(_0x2a23eb){if(_0x2a23eb){var _0x5e1130=typeof _0x2fd596[_0xa1eb('0x1a')]===_0xa1eb('0x1b')&&typeof _0x2fd596[_0xa1eb('0x1c')]==='undefined';var _0x7768e0=_0x2a23eb[_0xa1eb('0x1d')];var _0x978593=_0x5e1130?0x0:_0x2fd596[_0xa1eb('0x1a')];var _0x1ae324=_0x5e1130?_0x2a23eb[_0xa1eb('0x1d')]:_0x2fd596[_0xa1eb('0x1a')]+_0x2fd596[_0xa1eb('0x1c')];var _0xf6248b;if(_0x1ae324>=_0x7768e0){_0x1ae324=_0x7768e0;_0xf6248b=0xc8;}else{_0xf6248b=0xce;}_0x1848af['status'](_0xf6248b);return _0x1848af[_0xa1eb('0x1e')](_0xa1eb('0x1f'),_0x978593+'-'+_0x1ae324+'/'+_0x7768e0)[_0xa1eb('0x19')](_0x2a23eb);}return null;};}function patchUpdates(_0x398015){return function(_0x221701){try{jsonpatch[_0xa1eb('0x20')](_0x221701,_0x398015,!![]);}catch(_0x33fd9e){return BPromise['reject'](_0x33fd9e);}return _0x221701[_0xa1eb('0x21')]();};}function saveUpdates(_0x2978d0,_0x53a77f){return function(_0x2c914a){if(_0x2c914a){return _0x2c914a[_0xa1eb('0x22')](_0x2978d0)[_0xa1eb('0x23')](function(_0x5effb0){return _0x5effb0;});}return null;};}function removeEntity(_0x4422cb,_0x9bd810){return function(_0x23e420){if(_0x23e420){return _0x23e420[_0xa1eb('0x24')]()[_0xa1eb('0x23')](function(){var _0x5bc80e=_0x23e420[_0xa1eb('0x25')]({'plain':!![]});var _0x24c2b9=_0xa1eb('0x26');return db['UserProfileResource'][_0xa1eb('0x24')]({'where':{'type':_0x24c2b9,'resourceId':_0x5bc80e['id']}})[_0xa1eb('0x23')](function(){return _0x23e420;});})[_0xa1eb('0x23')](function(){_0x4422cb[_0xa1eb('0x27')](0xcc)[_0xa1eb('0x28')]();});}};}function handleEntityNotFound(_0x42fbb7,_0x3be3e8){return function(_0x2974cc){if(!_0x2974cc){_0x42fbb7[_0xa1eb('0x18')](0x194);}return _0x2974cc;};}function handleError(_0x534815,_0x2608d6){_0x2608d6=_0x2608d6||0x1f4;return function(_0x58c2e9){logger[_0xa1eb('0x29')](_0x58c2e9[_0xa1eb('0x2a')]);if(_0x58c2e9['name']){delete _0x58c2e9[_0xa1eb('0x2b')];}_0x534815['status'](_0x2608d6)[_0xa1eb('0x2c')](_0x58c2e9);};}exports[_0xa1eb('0x2d')]=function(_0xf470c7,_0x4ff177){var _0x20b438={},_0x4789b6={},_0x5e9b6f={'count':0x0,'rows':[]};var _0x29d1ff=_[_0xa1eb('0x2e')](db[_0xa1eb('0x2f')][_0xa1eb('0x30')],function(_0x21940e){return{'name':_0x21940e[_0xa1eb('0x31')],'type':_0x21940e[_0xa1eb('0x32')][_0xa1eb('0x33')]};});_0x4789b6[_0xa1eb('0x34')]=_['map'](_0x29d1ff,_0xa1eb('0x2b'));_0x4789b6[_0xa1eb('0x35')]=_[_0xa1eb('0x36')](_0xf470c7['query']);_0x4789b6['filters']=_[_0xa1eb('0x37')](_0x4789b6['model'],_0x4789b6[_0xa1eb('0x35')]);_0x20b438['attributes']=_[_0xa1eb('0x37')](_0x4789b6[_0xa1eb('0x34')],qs[_0xa1eb('0x38')](_0xf470c7[_0xa1eb('0x35')]['fields']));_0x20b438['attributes']=_0x20b438[_0xa1eb('0x39')][_0xa1eb('0x3a')]?_0x20b438[_0xa1eb('0x39')]:_0x4789b6[_0xa1eb('0x34')];if(!_0xf470c7[_0xa1eb('0x35')]['hasOwnProperty']('nolimit')){_0x20b438[_0xa1eb('0x1c')]=qs[_0xa1eb('0x1c')](_0xf470c7['query'][_0xa1eb('0x1c')]);_0x20b438[_0xa1eb('0x1a')]=qs[_0xa1eb('0x1a')](_0xf470c7[_0xa1eb('0x35')][_0xa1eb('0x1a')]);}_0x20b438['order']=qs['sort'](_0xf470c7[_0xa1eb('0x35')][_0xa1eb('0x3b')]);_0x20b438[_0xa1eb('0x3c')]=qs[_0xa1eb('0x3d')](_[_0xa1eb('0x3e')](_0xf470c7[_0xa1eb('0x35')],_0x4789b6[_0xa1eb('0x3d')]),_0x29d1ff);if(_0xf470c7[_0xa1eb('0x35')]['filter']){_0x20b438[_0xa1eb('0x3c')]=_['merge'](_0x20b438[_0xa1eb('0x3c')],{'$or':_['map'](_0x29d1ff,function(_0x4ace5e){if(_0x4ace5e[_0xa1eb('0x32')]!==_0xa1eb('0x3f')){var _0x4eb2a4={};_0x4eb2a4[_0x4ace5e['name']]={'$like':'%'+_0xf470c7[_0xa1eb('0x35')][_0xa1eb('0x40')]+'%'};return _0x4eb2a4;}})});}_0x20b438=_[_0xa1eb('0x41')]({},_0x20b438,_0xf470c7['options']);var _0x49d01a={'where':_0x20b438['where']};return db[_0xa1eb('0x2f')][_0xa1eb('0x1d')](_0x49d01a)[_0xa1eb('0x23')](function(_0x3277d0){_0x5e9b6f[_0xa1eb('0x1d')]=_0x3277d0;if(_0xf470c7[_0xa1eb('0x35')][_0xa1eb('0x42')]){_0x20b438[_0xa1eb('0x43')]=[{'all':!![]}];}return db[_0xa1eb('0x2f')][_0xa1eb('0x44')](_0x20b438);})[_0xa1eb('0x23')](function(_0x337c4d){_0x5e9b6f['rows']=_0x337c4d;return _0x5e9b6f;})[_0xa1eb('0x23')](respondWithFilteredResult(_0x4ff177,_0x20b438))[_0xa1eb('0x45')](handleError(_0x4ff177,null));};exports[_0xa1eb('0x46')]=function(_0x586e4b,_0x19b94a){var _0x47366b={'raw':!![],'where':{'id':_0x586e4b[_0xa1eb('0x47')]['id']}},_0x3a2ac7={};_0x3a2ac7[_0xa1eb('0x34')]=_[_0xa1eb('0x36')](db[_0xa1eb('0x2f')]['rawAttributes']);_0x3a2ac7[_0xa1eb('0x35')]=_[_0xa1eb('0x36')](_0x586e4b[_0xa1eb('0x35')]);_0x3a2ac7[_0xa1eb('0x3d')]=_[_0xa1eb('0x37')](_0x3a2ac7[_0xa1eb('0x34')],_0x3a2ac7[_0xa1eb('0x35')]);_0x47366b[_0xa1eb('0x39')]=_['intersection'](_0x3a2ac7['model'],qs[_0xa1eb('0x38')](_0x586e4b[_0xa1eb('0x35')]['fields']));_0x47366b[_0xa1eb('0x39')]=_0x47366b[_0xa1eb('0x39')][_0xa1eb('0x3a')]?_0x47366b[_0xa1eb('0x39')]:_0x3a2ac7[_0xa1eb('0x34')];if(_0x586e4b['query'][_0xa1eb('0x42')]){_0x47366b[_0xa1eb('0x43')]=[{'all':!![]}];}_0x47366b=_[_0xa1eb('0x41')]({},_0x47366b,_0x586e4b[_0xa1eb('0x48')]);return db['SquareOdbc']['find'](_0x47366b)[_0xa1eb('0x23')](handleEntityNotFound(_0x19b94a,null))[_0xa1eb('0x23')](respondWithResult(_0x19b94a,null))[_0xa1eb('0x45')](handleError(_0x19b94a,null));};exports[_0xa1eb('0x49')]=function(_0x52cff5,_0x781b2e){return db[_0xa1eb('0x2f')][_0xa1eb('0x49')](_0x52cff5[_0xa1eb('0x4a')],{})[_0xa1eb('0x23')](function(_0x22f043){var _0x531f30=_0x52cff5[_0xa1eb('0x4b')]['get']({'plain':!![]});if(!_0x531f30)throw new Error(_0xa1eb('0x4c'));if(_0x531f30[_0xa1eb('0x4d')]==='user'){var _0x1b0803=_0x22f043[_0xa1eb('0x25')]({'plain':!![]});var _0x53371c=_0xa1eb('0x26');return db['UserProfileSection'][_0xa1eb('0x4e')]({'where':{'name':_0x53371c,'userProfileId':_0x531f30[_0xa1eb('0x4f')]},'raw':!![]})[_0xa1eb('0x23')](function(_0x118910){if(_0x118910&&_0x118910[_0xa1eb('0x50')]===0x0){return db[_0xa1eb('0x51')][_0xa1eb('0x49')]({'name':_0x1b0803[_0xa1eb('0x2b')],'resourceId':_0x1b0803['id'],'type':_0x118910['name'],'sectionId':_0x118910['id']},{})['then'](function(){return _0x22f043;});}else{return _0x22f043;}})[_0xa1eb('0x45')](function(_0x5c82de){logger['error'](_0xa1eb('0x52'),_0x5c82de);throw _0x5c82de;});}return _0x22f043;})[_0xa1eb('0x23')](respondWithResult(_0x781b2e,0xc9))[_0xa1eb('0x45')](handleError(_0x781b2e,null));};exports['update']=function(_0x4cb81e,_0x5bf436){if(_0x4cb81e[_0xa1eb('0x4a')]['id']){delete _0x4cb81e[_0xa1eb('0x4a')]['id'];}return db[_0xa1eb('0x2f')][_0xa1eb('0x4e')]({'where':{'id':_0x4cb81e[_0xa1eb('0x47')]['id']}})[_0xa1eb('0x23')](handleEntityNotFound(_0x5bf436,null))[_0xa1eb('0x23')](saveUpdates(_0x4cb81e[_0xa1eb('0x4a')],null))[_0xa1eb('0x23')](respondWithResult(_0x5bf436,null))[_0xa1eb('0x45')](handleError(_0x5bf436,null));};exports[_0xa1eb('0x24')]=function(_0x45ec26,_0x2f9a6c){return db['SquareOdbc'][_0xa1eb('0x4e')]({'where':{'id':_0x45ec26[_0xa1eb('0x47')]['id']}})[_0xa1eb('0x23')](handleEntityNotFound(_0x2f9a6c,null))[_0xa1eb('0x23')](removeEntity(_0x2f9a6c,null))['catch'](handleError(_0x2f9a6c,null));};exports['test']=function(_0x2c18d6,_0x4c3088,_0x3815f5){var _0x35a4c2;return db['SquareOdbc'][_0xa1eb('0x4e')]({'where':{'id':_0x2c18d6[_0xa1eb('0x47')]['id']},'attributes':['id','dsn']})['then'](handleEntityNotFound(_0x4c3088,null))['then'](function(_0x20c60d){if(_0x20c60d){var _0x4e138b=require(_0xa1eb('0x53'))();_0x4e138b[_0xa1eb('0x54')](_0x20c60d[_0xa1eb('0x55')]);_0x4e138b['closeSync']();return _0x20c60d;}})[_0xa1eb('0x23')](respondWithResult(_0x4c3088,null))[_0xa1eb('0x45')](handleError(_0x4c3088,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 657558b..53eccc8 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 _0xcf83=['bluebird','path','rimraf','../../config/environment','./squareOdbc.attributes','exports','define','SquareOdbc','square_odbc','lodash','util','../../config/logger','api','moment'];(function(_0x47fd36,_0x41535d){var _0x21a0fc=function(_0x44c07c){while(--_0x44c07c){_0x47fd36['push'](_0x47fd36['shift']());}};_0x21a0fc(++_0x41535d);}(_0xcf83,0xf7));var _0x3cf8=function(_0x1f1d24,_0x92a763){_0x1f1d24=_0x1f1d24-0x0;var _0x30425f=_0xcf83[_0x1f1d24];return _0x30425f;};'use strict';var _=require(_0x3cf8('0x0'));var util=require(_0x3cf8('0x1'));var logger=require(_0x3cf8('0x2'))(_0x3cf8('0x3'));var moment=require(_0x3cf8('0x4'));var BPromise=require(_0x3cf8('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3cf8('0x6'));var rimraf=require(_0x3cf8('0x7'));var config=require(_0x3cf8('0x8'));var attributes=require(_0x3cf8('0x9'));module[_0x3cf8('0xa')]=function(_0x5b85e5,_0x4371ed){return _0x5b85e5[_0x3cf8('0xb')](_0x3cf8('0xc'),attributes,{'tableName':_0x3cf8('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcaee=['moment','bluebird','request-promise','path','rimraf','./squareOdbc.attributes','exports','define','SquareOdbc','square_odbc','lodash','util','../../config/logger','api'];(function(_0x235e7e,_0x5079e9){var _0x30410e=function(_0x437257){while(--_0x437257){_0x235e7e['push'](_0x235e7e['shift']());}};_0x30410e(++_0x5079e9);}(_0xcaee,0x1f4));var _0xecae=function(_0x247270,_0x3cb3b5){_0x247270=_0x247270-0x0;var _0x4d49a3=_0xcaee[_0x247270];return _0x4d49a3;};'use strict';var _=require(_0xecae('0x0'));var util=require(_0xecae('0x1'));var logger=require(_0xecae('0x2'))(_0xecae('0x3'));var moment=require(_0xecae('0x4'));var BPromise=require(_0xecae('0x5'));var rp=require(_0xecae('0x6'));var fs=require('fs');var path=require(_0xecae('0x7'));var rimraf=require(_0xecae('0x8'));var config=require('../../config/environment');var attributes=require(_0xecae('0x9'));module[_0xecae('0xa')]=function(_0xc8c77e,_0x54b582){return _0xc8c77e[_0xecae('0xb')](_0xecae('0xc'),attributes,{'tableName':_0xecae('0xd'),'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 ce8affa..ca5b140 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 _0x9759=['model','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowSquareOdbc','SquareOdbc','find','options','where','attributes','include','map'];(function(_0x29ffed,_0x2e4194){var _0xe900be=function(_0x595330){while(--_0x595330){_0x29ffed['push'](_0x29ffed['shift']());}};_0xe900be(++_0x2e4194);}(_0x9759,0x1c2));var _0x9975=function(_0x2166db,_0x44d0f2){_0x2166db=_0x2166db-0x0;var _0x30b231=_0x9759[_0x2166db];return _0x30b231;};'use strict';var _=require(_0x9975('0x0'));var util=require(_0x9975('0x1'));var moment=require(_0x9975('0x2'));var BPromise=require(_0x9975('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9975('0x4'));var db=require(_0x9975('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9975('0x6'));var config=require(_0x9975('0x7'));var jayson=require(_0x9975('0x8'));var client=jayson[_0x9975('0x9')][_0x9975('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x395b71,_0x265654,_0x2c8731){return new BPromise(function(_0x40906a,_0x16db27){return client['request'](_0x395b71,_0x2c8731)[_0x9975('0xb')](function(_0x17d409){logger[_0x9975('0xc')](_0x9975('0xd'),_0x265654,_0x9975('0xe'));logger[_0x9975('0xf')](_0x9975('0x10'),_0x265654,_0x9975('0xe'),JSON['stringify'](_0x17d409));if(_0x17d409[_0x9975('0x11')]){if(_0x17d409[_0x9975('0x11')][_0x9975('0x12')]===0x1f4){logger[_0x9975('0x11')](_0x9975('0xd'),_0x265654,_0x17d409[_0x9975('0x11')]['message']);return _0x16db27(_0x17d409[_0x9975('0x11')][_0x9975('0x13')]);}logger['error'](_0x9975('0xd'),_0x265654,_0x17d409[_0x9975('0x11')]['message']);return _0x40906a(_0x17d409[_0x9975('0x11')][_0x9975('0x13')]);}else{logger['info'](_0x9975('0xd'),_0x265654,_0x9975('0xe'));_0x40906a(_0x17d409[_0x9975('0x14')][_0x9975('0x13')]);}})[_0x9975('0x15')](function(_0x2cd4b2){logger[_0x9975('0x11')](_0x9975('0xd'),_0x265654,_0x2cd4b2);_0x16db27(_0x2cd4b2);});});}exports[_0x9975('0x16')]=function(_0xd39f78){var _0x2807de=this;return new Promise(function(_0x47ee8b,_0x38635e){return db[_0x9975('0x17')][_0x9975('0x18')]({'raw':_0xd39f78[_0x9975('0x19')]?_0xd39f78[_0x9975('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0xd39f78[_0x9975('0x19')]?_0xd39f78[_0x9975('0x19')][_0x9975('0x1a')]||null:null,'attributes':_0xd39f78['options']?_0xd39f78['options'][_0x9975('0x1b')]||null:null,'include':_0xd39f78[_0x9975('0x19')]?_0xd39f78[_0x9975('0x19')][_0x9975('0x1c')]?_[_0x9975('0x1d')](_0xd39f78['options'][_0x9975('0x1c')],function(_0x105f34){return{'model':db[_0x105f34[_0x9975('0x1e')]],'as':_0x105f34['as'],'attributes':_0x105f34[_0x9975('0x1b')],'include':_0x105f34[_0x9975('0x1c')]?_[_0x9975('0x1d')](_0x105f34[_0x9975('0x1c')],function(_0x400e96){return{'model':db[_0x400e96['model']],'as':_0x400e96['as'],'attributes':_0x400e96['attributes'],'include':_0x400e96[_0x9975('0x1c')]?_['map'](_0x400e96['include'],function(_0x51ad09){return{'model':db[_0x51ad09[_0x9975('0x1e')]],'as':_0x51ad09['as'],'attributes':_0x51ad09['attributes']};}):[]};}):[]};}):[]:[]})[_0x9975('0xb')](function(_0x12daa3){logger[_0x9975('0xc')](_0x9975('0x16'),_0xd39f78);logger[_0x9975('0xf')](_0x9975('0x16'),_0xd39f78,JSON[_0x9975('0x1f')](_0x12daa3));_0x47ee8b(_0x12daa3);})[_0x9975('0x15')](function(_0x470582){logger[_0x9975('0x11')](_0x9975('0x16'),_0x470582[_0x9975('0x13')],_0xd39f78);_0x38635e(_0x2807de[_0x9975('0x11')](0x1f4,_0x470582[_0x9975('0x13')]));});});}; \ No newline at end of file +var _0xc1bc=['attributes','include','map','model','lodash','moment','bluebird','randomstring','../../config/utils','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','result','catch','ShowSquareOdbc','SquareOdbc','options','raw'];(function(_0x3c9bdf,_0x3b30cd){var _0x5664a6=function(_0x4ea55c){while(--_0x4ea55c){_0x3c9bdf['push'](_0x3c9bdf['shift']());}};_0x5664a6(++_0x3b30cd);}(_0xc1bc,0x178));var _0xcc1b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xc1bc[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xcc1b('0x0'));var util=require('util');var moment=require(_0xcc1b('0x1'));var BPromise=require(_0xcc1b('0x2'));var rs=require(_0xcc1b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xcc1b('0x4'));var logger=require('../../config/logger')(_0xcc1b('0x5'));var config=require(_0xcc1b('0x6'));var jayson=require(_0xcc1b('0x7'));var client=jayson[_0xcc1b('0x8')][_0xcc1b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x32c853,_0x127914,_0x5325cc){return new BPromise(function(_0x56e82e,_0x4d229f){return client[_0xcc1b('0xa')](_0x32c853,_0x5325cc)[_0xcc1b('0xb')](function(_0x4613d8){logger[_0xcc1b('0xc')](_0xcc1b('0xd'),_0x127914,_0xcc1b('0xe'));logger[_0xcc1b('0xf')](_0xcc1b('0x10'),_0x127914,_0xcc1b('0xe'),JSON[_0xcc1b('0x11')](_0x4613d8));if(_0x4613d8[_0xcc1b('0x12')]){if(_0x4613d8[_0xcc1b('0x12')][_0xcc1b('0x13')]===0x1f4){logger['error'](_0xcc1b('0xd'),_0x127914,_0x4613d8[_0xcc1b('0x12')]['message']);return _0x4d229f(_0x4613d8['error'][_0xcc1b('0x14')]);}logger[_0xcc1b('0x12')]('SquareOdbc,\x20%s,\x20%s',_0x127914,_0x4613d8[_0xcc1b('0x12')][_0xcc1b('0x14')]);return _0x56e82e(_0x4613d8[_0xcc1b('0x12')][_0xcc1b('0x14')]);}else{logger['info'](_0xcc1b('0xd'),_0x127914,'request\x20sent');_0x56e82e(_0x4613d8[_0xcc1b('0x15')][_0xcc1b('0x14')]);}})[_0xcc1b('0x16')](function(_0x403103){logger[_0xcc1b('0x12')](_0xcc1b('0xd'),_0x127914,_0x403103);_0x4d229f(_0x403103);});});}exports[_0xcc1b('0x17')]=function(_0x73c6cc){var _0x115309=this;return new Promise(function(_0x2e8c74,_0x4c8ebf){return db[_0xcc1b('0x18')]['find']({'raw':_0x73c6cc[_0xcc1b('0x19')]?_0x73c6cc[_0xcc1b('0x19')][_0xcc1b('0x1a')]===undefined?!![]:![]:!![],'where':_0x73c6cc[_0xcc1b('0x19')]?_0x73c6cc['options']['where']||null:null,'attributes':_0x73c6cc['options']?_0x73c6cc[_0xcc1b('0x19')][_0xcc1b('0x1b')]||null:null,'include':_0x73c6cc[_0xcc1b('0x19')]?_0x73c6cc[_0xcc1b('0x19')][_0xcc1b('0x1c')]?_[_0xcc1b('0x1d')](_0x73c6cc[_0xcc1b('0x19')][_0xcc1b('0x1c')],function(_0x4e4cb1){return{'model':db[_0x4e4cb1[_0xcc1b('0x1e')]],'as':_0x4e4cb1['as'],'attributes':_0x4e4cb1[_0xcc1b('0x1b')],'include':_0x4e4cb1['include']?_[_0xcc1b('0x1d')](_0x4e4cb1[_0xcc1b('0x1c')],function(_0x97e7d5){return{'model':db[_0x97e7d5['model']],'as':_0x97e7d5['as'],'attributes':_0x97e7d5[_0xcc1b('0x1b')],'include':_0x97e7d5['include']?_['map'](_0x97e7d5['include'],function(_0x107fe9){return{'model':db[_0x107fe9['model']],'as':_0x107fe9['as'],'attributes':_0x107fe9[_0xcc1b('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xcc1b('0xb')](function(_0x58d2b6){logger[_0xcc1b('0xc')]('ShowSquareOdbc',_0x73c6cc);logger['debug']('ShowSquareOdbc',_0x73c6cc,JSON[_0xcc1b('0x11')](_0x58d2b6));_0x2e8c74(_0x58d2b6);})[_0xcc1b('0x16')](function(_0x206d70){logger[_0xcc1b('0x12')](_0xcc1b('0x17'),_0x206d70[_0xcc1b('0x14')],_0x73c6cc);_0x4c8ebf(_0x115309[_0xcc1b('0x12')](0x1f4,_0x206d70['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index d943e91..10db4c9 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 _0x01a6=['../../components/interaction/service','./squareProject.controller','get','isAuthenticated','index','show','/:id/users','getUsers','post','create','addUsers','put','/:id','update','delete','destroy','removeUsers','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x01a6,0x162));var _0x601a=function(_0x33eb22,_0xc0e8){_0x33eb22=_0x33eb22-0x0;var _0x3e416e=_0x01a6[_0x33eb22];return _0x3e416e;};'use strict';var multer=require(_0x601a('0x0'));var util=require('util');var path=require(_0x601a('0x1'));var timeout=require(_0x601a('0x2'));var express=require(_0x601a('0x3'));var router=express[_0x601a('0x4')]();var fs_extra=require(_0x601a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x601a('0x6'));var config=require('../../config/environment');var controller=require(_0x601a('0x7'));router[_0x601a('0x8')]('/',auth[_0x601a('0x9')](),controller[_0x601a('0xa')]);router[_0x601a('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x601a('0xb')]);router[_0x601a('0x8')](_0x601a('0xc'),auth['isAuthenticated'](),controller[_0x601a('0xd')]);router[_0x601a('0xe')]('/',auth['isAuthenticated'](),controller[_0x601a('0xf')]);router[_0x601a('0xe')]('/:id/users',auth[_0x601a('0x9')](),controller[_0x601a('0x10')]);router[_0x601a('0x11')](_0x601a('0x12'),auth[_0x601a('0x9')](),controller[_0x601a('0x13')]);router[_0x601a('0x14')](_0x601a('0x12'),auth[_0x601a('0x9')](),controller[_0x601a('0x15')]);router[_0x601a('0x14')]('/:id/users',auth[_0x601a('0x9')](),controller[_0x601a('0x16')]);module[_0x601a('0x17')]=router; \ No newline at end of file +var _0x1a21=['../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','isAuthenticated','index','get','/:id','show','/:id/users','getUsers','post','create','addUsers','update','destroy','removeUsers','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x496738,_0x3f1a9f){var _0xee1381=function(_0x4dc50c){while(--_0x4dc50c){_0x496738['push'](_0x496738['shift']());}};_0xee1381(++_0x3f1a9f);}(_0x1a21,0x1d9));var _0x11a2=function(_0x9729d7,_0x1b79a8){_0x9729d7=_0x9729d7-0x0;var _0x3c4ac6=_0x1a21[_0x9729d7];return _0x3c4ac6;};'use strict';var multer=require(_0x11a2('0x0'));var util=require(_0x11a2('0x1'));var path=require(_0x11a2('0x2'));var timeout=require(_0x11a2('0x3'));var express=require(_0x11a2('0x4'));var router=express[_0x11a2('0x5')]();var fs_extra=require(_0x11a2('0x6'));var auth=require(_0x11a2('0x7'));var interaction=require(_0x11a2('0x8'));var config=require(_0x11a2('0x9'));var controller=require(_0x11a2('0xa'));router['get']('/',auth[_0x11a2('0xb')](),controller[_0x11a2('0xc')]);router[_0x11a2('0xd')](_0x11a2('0xe'),auth[_0x11a2('0xb')](),controller[_0x11a2('0xf')]);router['get'](_0x11a2('0x10'),auth[_0x11a2('0xb')](),controller[_0x11a2('0x11')]);router[_0x11a2('0x12')]('/',auth['isAuthenticated'](),controller[_0x11a2('0x13')]);router[_0x11a2('0x12')]('/:id/users',auth['isAuthenticated'](),controller[_0x11a2('0x14')]);router['put'](_0x11a2('0xe'),auth[_0x11a2('0xb')](),controller[_0x11a2('0x15')]);router['delete'](_0x11a2('0xe'),auth[_0x11a2('0xb')](),controller[_0x11a2('0x16')]);router['delete']('/:id/users',auth[_0x11a2('0xb')](),controller[_0x11a2('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index ec136ad..08d77c6 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 _0x0348=['preproduction','toString','utf8','production','DATE','exports','name','STRING','BLOB','long','getDataValue'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x0348,0x1e9));var _0x8034=function(_0x732d54,_0x5708f4){_0x732d54=_0x732d54-0x0;var _0x55e766=_0x0348[_0x732d54];return _0x55e766;};'use strict';var Sequelize=require('sequelize');module[_0x8034('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x8034('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0x8034('0x2')]},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize[_0x8034('0x3')](_0x8034('0x4')),'get':function(){if(this[_0x8034('0x5')](_0x8034('0x6'))){return this[_0x8034('0x5')](_0x8034('0x6'))[_0x8034('0x7')](_0x8034('0x8'));}}},'production':{'type':Sequelize['BLOB'](_0x8034('0x4')),'get':function(){if(this[_0x8034('0x5')](_0x8034('0x9'))){return this[_0x8034('0x5')](_0x8034('0x9'))[_0x8034('0x7')](_0x8034('0x8'));}}},'savedAt':{'type':Sequelize[_0x8034('0xa')]},'publishedAt':{'type':Sequelize[_0x8034('0xa')]}}; \ No newline at end of file +var _0x279a=['sequelize','exports','long','getDataValue','preproduction','utf8','BLOB','production','toString','DATE'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x279a,0xdc));var _0xa279=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x279a[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xa279('0x0'));module[_0xa279('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize['BLOB'](_0xa279('0x2')),'get':function(){if(this[_0xa279('0x3')](_0xa279('0x4'))){return this[_0xa279('0x3')](_0xa279('0x4'))['toString'](_0xa279('0x5'));}}},'production':{'type':Sequelize[_0xa279('0x6')](_0xa279('0x2')),'get':function(){if(this[_0xa279('0x3')](_0xa279('0x7'))){return this[_0xa279('0x3')](_0xa279('0x7'))[_0xa279('0x8')]('utf8');}}},'savedAt':{'type':Sequelize[_0xa279('0x9')]},'publishedAt':{'type':Sequelize[_0xa279('0x9')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 641affe..6e75794 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 _0xc1c6=['../../components/parsers/qs','api','../../mysqldb','redis','defaults','socket.io-emitter','./squareProject.socket','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','update','destroy','get','SquareProjects','then','publish','agi','stringify','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','type','VIRTUAL','filter','merge','options','SquareProject','includeAll','include','rows','show','params','keys','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','pick','addUsers','ids','omit','removeUsers','isArray','emit','userSquareProject:remove','getUsers','findOne','User','lodash','ioredis'];(function(_0x50b176,_0x235c31){var _0x5aff30=function(_0x326ced){while(--_0x326ced){_0x50b176['push'](_0x50b176['shift']());}};_0x5aff30(++_0x235c31);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x88bfe7,_0x5e25c1){_0x88bfe7=_0x88bfe7-0x0;var _0xb2c381=_0xc1c6[_0x88bfe7];return _0xb2c381;};'use strict';var _=require(_0x6c1c('0x0'));var Redis=require(_0x6c1c('0x1'));var qs=require(_0x6c1c('0x2'));var logger=require('../../config/logger')(_0x6c1c('0x3'));var config=require('../../config/environment');var db=require(_0x6c1c('0x4'))['db'];config[_0x6c1c('0x5')]=_[_0x6c1c('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x6c1c('0x7'))(new Redis(config['redis']));require(_0x6c1c('0x8'))['register'](socket);function respondWithStatusCode(_0xe510ca,_0x2eb1ba){_0x2eb1ba=_0x2eb1ba||0xcc;return function(_0x38369d){if(_0x38369d){return _0xe510ca[_0x6c1c('0x9')](_0x2eb1ba);}return _0xe510ca['status'](_0x2eb1ba)[_0x6c1c('0xa')]();};}function respondWithResult(_0x3ca985,_0x524d21){_0x524d21=_0x524d21||0xc8;return function(_0x147c7b){if(_0x147c7b){return _0x3ca985[_0x6c1c('0xb')](_0x524d21)[_0x6c1c('0xc')](_0x147c7b);}};}function respondWithFilteredResult(_0x1137e8,_0x49fb01){return function(_0x3a25a2){if(_0x3a25a2){var _0x2a4fd4=typeof _0x49fb01[_0x6c1c('0xd')]==='undefined'&&typeof _0x49fb01[_0x6c1c('0xe')]===_0x6c1c('0xf');var _0x2067bd=_0x3a25a2['count'];var _0x2e82e9=_0x2a4fd4?0x0:_0x49fb01['offset'];var _0x357370=_0x2a4fd4?_0x3a25a2[_0x6c1c('0x10')]:_0x49fb01[_0x6c1c('0xd')]+_0x49fb01[_0x6c1c('0xe')];var _0x350e6f;if(_0x357370>=_0x2067bd){_0x357370=_0x2067bd;_0x350e6f=0xc8;}else{_0x350e6f=0xce;}_0x1137e8[_0x6c1c('0xb')](_0x350e6f);return _0x1137e8[_0x6c1c('0x11')](_0x6c1c('0x12'),_0x2e82e9+'-'+_0x357370+'/'+_0x2067bd)[_0x6c1c('0xc')](_0x3a25a2);}return null;};}function saveUpdates(_0x5f3758){return function(_0x3df1b7){if(_0x3df1b7){return _0x3df1b7[_0x6c1c('0x13')](_0x5f3758)['then'](function(_0x3a2d32){return _0x3a2d32;});}return null;};}function removeEntity(_0x237cac){return function(_0x494ffc){if(_0x494ffc){return _0x494ffc[_0x6c1c('0x14')]()['then'](function(){var _0x338dc2=_0x494ffc[_0x6c1c('0x15')]({'plain':!![]});var _0x5a3bb7=_0x6c1c('0x16');return db['UserProfileResource'][_0x6c1c('0x14')]({'where':{'type':_0x5a3bb7,'resourceId':_0x338dc2['id']}})[_0x6c1c('0x17')](function(){return _0x494ffc;});})[_0x6c1c('0x17')](function(){var _0x211f49=new Redis(config[_0x6c1c('0x5')]);_0x211f49[_0x6c1c('0x18')](_0x6c1c('0x19'),JSON[_0x6c1c('0x1a')]({'id':_0x494ffc['id'],'deleted':!![]}));})[_0x6c1c('0x17')](function(){_0x237cac[_0x6c1c('0xb')](0xcc)[_0x6c1c('0xa')]();});}};}function handleEntityNotFound(_0x450b1f){return function(_0x2382c0){if(!_0x2382c0){_0x450b1f[_0x6c1c('0x9')](0x194);}return _0x2382c0;};}function handleError(_0x31fed2,_0x19c269){_0x19c269=_0x19c269||0x1f4;return function(_0x2319d3){logger[_0x6c1c('0x1b')](_0x2319d3[_0x6c1c('0x1c')]);if(_0x2319d3[_0x6c1c('0x1d')]){delete _0x2319d3[_0x6c1c('0x1d')];}_0x31fed2[_0x6c1c('0xb')](_0x19c269)[_0x6c1c('0x1e')](_0x2319d3);};}exports[_0x6c1c('0x1f')]=function(_0x18452d,_0x80bc05){var _0x3b7cc1={},_0x1b9d7d={},_0x2feaf4={'count':0x0,'rows':[]};var _0x5f4568=_[_0x6c1c('0x20')](db['SquareProject'][_0x6c1c('0x21')],function(_0x4c23f8){return{'name':_0x4c23f8[_0x6c1c('0x22')],'type':_0x4c23f8['type'][_0x6c1c('0x23')]};});_0x1b9d7d[_0x6c1c('0x24')]=_['map'](_0x5f4568,_0x6c1c('0x1d'));_0x1b9d7d[_0x6c1c('0x25')]=_['keys'](_0x18452d[_0x6c1c('0x25')]);_0x1b9d7d[_0x6c1c('0x26')]=_[_0x6c1c('0x27')](_0x1b9d7d[_0x6c1c('0x24')],_0x1b9d7d['query']);_0x3b7cc1['attributes']=_[_0x6c1c('0x27')](_0x1b9d7d[_0x6c1c('0x24')],qs[_0x6c1c('0x28')](_0x18452d[_0x6c1c('0x25')][_0x6c1c('0x28')]));_0x3b7cc1[_0x6c1c('0x29')]=_0x3b7cc1['attributes'][_0x6c1c('0x2a')]?_0x3b7cc1[_0x6c1c('0x29')]:_0x1b9d7d['model'];if(!_0x18452d[_0x6c1c('0x25')][_0x6c1c('0x2b')](_0x6c1c('0x2c'))){_0x3b7cc1[_0x6c1c('0xe')]=qs['limit'](_0x18452d[_0x6c1c('0x25')][_0x6c1c('0xe')]);_0x3b7cc1[_0x6c1c('0xd')]=qs['offset'](_0x18452d[_0x6c1c('0x25')]['offset']);}_0x3b7cc1[_0x6c1c('0x2d')]=qs['sort'](_0x18452d[_0x6c1c('0x25')][_0x6c1c('0x2e')]);_0x3b7cc1[_0x6c1c('0x2f')]=qs['filters'](_['pick'](_0x18452d[_0x6c1c('0x25')],_0x1b9d7d[_0x6c1c('0x26')]),_0x5f4568);if(_0x18452d[_0x6c1c('0x25')]['filter']){_0x3b7cc1[_0x6c1c('0x2f')]=_['merge'](_0x3b7cc1['where'],{'$or':_[_0x6c1c('0x20')](_0x5f4568,function(_0xbafcb3){if(_0xbafcb3[_0x6c1c('0x30')]!==_0x6c1c('0x31')){var _0x4bed10={};_0x4bed10[_0xbafcb3[_0x6c1c('0x1d')]]={'$like':'%'+_0x18452d[_0x6c1c('0x25')][_0x6c1c('0x32')]+'%'};return _0x4bed10;}})});}_0x3b7cc1=_[_0x6c1c('0x33')]({},_0x3b7cc1,_0x18452d[_0x6c1c('0x34')]);var _0x398e95={'where':_0x3b7cc1[_0x6c1c('0x2f')]};return db[_0x6c1c('0x35')][_0x6c1c('0x10')](_0x398e95)[_0x6c1c('0x17')](function(_0x47d75e){_0x2feaf4[_0x6c1c('0x10')]=_0x47d75e;if(_0x18452d[_0x6c1c('0x25')][_0x6c1c('0x36')]){_0x3b7cc1[_0x6c1c('0x37')]=[{'all':!![]}];}return db[_0x6c1c('0x35')]['findAll'](_0x3b7cc1);})['then'](function(_0x549db1){_0x2feaf4[_0x6c1c('0x38')]=_0x549db1;return _0x2feaf4;})['then'](respondWithFilteredResult(_0x80bc05,_0x3b7cc1))['catch'](handleError(_0x80bc05,null));};exports[_0x6c1c('0x39')]=function(_0x37244e,_0x5f3f3e){var _0x2b2ae5={'raw':![],'where':{'id':_0x37244e[_0x6c1c('0x3a')]['id']}},_0x40645f={};_0x40645f['model']=_[_0x6c1c('0x3b')](db[_0x6c1c('0x35')]['rawAttributes']);_0x40645f[_0x6c1c('0x25')]=_['keys'](_0x37244e[_0x6c1c('0x25')]);_0x40645f[_0x6c1c('0x26')]=_[_0x6c1c('0x27')](_0x40645f[_0x6c1c('0x24')],_0x40645f[_0x6c1c('0x25')]);_0x2b2ae5['attributes']=_[_0x6c1c('0x27')](_0x40645f[_0x6c1c('0x24')],qs[_0x6c1c('0x28')](_0x37244e['query'][_0x6c1c('0x28')]));_0x2b2ae5[_0x6c1c('0x29')]=_0x2b2ae5[_0x6c1c('0x29')][_0x6c1c('0x2a')]?_0x2b2ae5[_0x6c1c('0x29')]:_0x40645f['model'];if(_0x37244e[_0x6c1c('0x25')]['includeAll']){_0x2b2ae5['include']=[{'all':!![]}];}_0x2b2ae5=_['merge']({},_0x2b2ae5,_0x37244e[_0x6c1c('0x34')]);return db[_0x6c1c('0x35')][_0x6c1c('0x3c')](_0x2b2ae5)[_0x6c1c('0x17')](handleEntityNotFound(_0x5f3f3e,null))[_0x6c1c('0x17')](respondWithResult(_0x5f3f3e,null))[_0x6c1c('0x3d')](handleError(_0x5f3f3e,null));};exports[_0x6c1c('0x3e')]=function(_0x167f3b,_0x5ed2d7){return db[_0x6c1c('0x35')][_0x6c1c('0x3e')](_0x167f3b['body'],{})[_0x6c1c('0x17')](function(_0x5518f6){var _0x39e741=_0x167f3b[_0x6c1c('0x3f')][_0x6c1c('0x15')]({'plain':!![]});if(!_0x39e741)throw new Error(_0x6c1c('0x40'));if(_0x39e741[_0x6c1c('0x41')]==='user'){var _0x1fe6e8=_0x5518f6['get']({'plain':!![]});var _0x2a59bc=_0x6c1c('0x16');return db[_0x6c1c('0x42')][_0x6c1c('0x3c')]({'where':{'name':_0x2a59bc,'userProfileId':_0x39e741[_0x6c1c('0x43')]},'raw':!![]})[_0x6c1c('0x17')](function(_0x52c14d){if(_0x52c14d&&_0x52c14d[_0x6c1c('0x44')]===0x0){return db[_0x6c1c('0x45')]['create']({'name':_0x1fe6e8[_0x6c1c('0x1d')],'resourceId':_0x1fe6e8['id'],'type':_0x52c14d[_0x6c1c('0x1d')],'sectionId':_0x52c14d['id']},{})[_0x6c1c('0x17')](function(){return _0x5518f6;});}else{return _0x5518f6;}})[_0x6c1c('0x3d')](function(_0x5badb4){logger[_0x6c1c('0x1b')](_0x6c1c('0x46'),_0x5badb4);throw _0x5badb4;});}return _0x5518f6;})[_0x6c1c('0x17')](respondWithResult(_0x5ed2d7,0xc9))['catch'](handleError(_0x5ed2d7,null));};exports['update']=function(_0x56b367,_0x5714a6){if(_0x56b367['body']['id']){delete _0x56b367[_0x6c1c('0x47')]['id'];}return db[_0x6c1c('0x35')]['find']({'where':{'id':_0x56b367[_0x6c1c('0x3a')]['id']}})[_0x6c1c('0x17')](handleEntityNotFound(_0x5714a6,null))[_0x6c1c('0x17')](saveUpdates(_0x56b367['body'],null))['then'](function(_0x28bd68){if(!_0x28bd68)return;var _0xd5936=_0x28bd68['get']({'plain':!![]});return _0xd5936;})[_0x6c1c('0x17')](function(_0x25dda9){var _0x3f4303=new Redis(config[_0x6c1c('0x5')]);_0x3f4303[_0x6c1c('0x18')](_0x6c1c('0x19'),JSON['stringify'](_[_0x6c1c('0x48')](_0x25dda9,['id',_0x6c1c('0x1d'),'production'])));return _0x25dda9;})['then'](respondWithResult(_0x5714a6,null))[_0x6c1c('0x3d')](handleError(_0x5714a6,null));};exports[_0x6c1c('0x14')]=function(_0x3a2fef,_0x58ac8d){return db[_0x6c1c('0x35')][_0x6c1c('0x3c')]({'where':{'id':_0x3a2fef[_0x6c1c('0x3a')]['id']}})[_0x6c1c('0x17')](handleEntityNotFound(_0x58ac8d,null))['then'](removeEntity(_0x58ac8d,null))['catch'](handleError(_0x58ac8d,null));};exports[_0x6c1c('0x49')]=function(_0x1ac7e4,_0x1a8e19){return db['SquareProject']['find']({'where':{'id':_0x1ac7e4[_0x6c1c('0x3a')]['id']}})[_0x6c1c('0x17')](handleEntityNotFound(_0x1a8e19,null))['then'](function(_0x2a334b){if(_0x2a334b){return _0x2a334b[_0x6c1c('0x49')](_0x1ac7e4[_0x6c1c('0x47')][_0x6c1c('0x4a')],_[_0x6c1c('0x4b')](_0x1ac7e4[_0x6c1c('0x47')],['ids','id'])||{});}})[_0x6c1c('0x17')](respondWithResult(_0x1a8e19,null))['catch'](handleError(_0x1a8e19,null));};exports[_0x6c1c('0x4c')]=function(_0x1930ea,_0x117240){return db[_0x6c1c('0x35')]['find']({'where':{'id':_0x1930ea['params']['id']}})[_0x6c1c('0x17')](handleEntityNotFound(_0x117240,null))[_0x6c1c('0x17')](function(_0x612be2){if(_0x612be2){return _0x612be2['removeUsers'](_0x1930ea[_0x6c1c('0x25')][_0x6c1c('0x4a')])[_0x6c1c('0x17')](function(){if(_[_0x6c1c('0x4d')](_0x1930ea[_0x6c1c('0x25')][_0x6c1c('0x4a')])){for(var _0xed095f=0x0;_0xed095f<_0x1930ea['query'][_0x6c1c('0x4a')]['length'];_0xed095f+=0x1){socket[_0x6c1c('0x4e')](_0x6c1c('0x4f'),{'UserId':Number(_0x1930ea[_0x6c1c('0x25')][_0x6c1c('0x4a')][_0xed095f]),'SquareProjectId':Number(_0x1930ea['params']['id'])});}}else{socket[_0x6c1c('0x4e')](_0x6c1c('0x4f'),{'UserId':Number(_0x1930ea[_0x6c1c('0x25')][_0x6c1c('0x4a')]),'SquareProjectId':Number(_0x1930ea[_0x6c1c('0x3a')]['id'])});}});}})[_0x6c1c('0x17')](respondWithStatusCode(_0x117240,null))[_0x6c1c('0x3d')](handleError(_0x117240,null));};exports[_0x6c1c('0x50')]=function(_0x2d248c,_0x13963a){var _0x26ee48={};var _0x4fa646={};var _0x43d379;var _0x6b05c7;return db[_0x6c1c('0x35')][_0x6c1c('0x51')]({'where':{'id':_0x2d248c[_0x6c1c('0x3a')]['id']}})['then'](handleEntityNotFound(_0x13963a,null))[_0x6c1c('0x17')](function(_0x39636a){if(_0x39636a){_0x43d379=_0x39636a;_0x4fa646['model']=_[_0x6c1c('0x3b')](db[_0x6c1c('0x52')][_0x6c1c('0x21')]);_0x4fa646['query']=_[_0x6c1c('0x3b')](_0x2d248c[_0x6c1c('0x25')]);_0x4fa646[_0x6c1c('0x26')]=_[_0x6c1c('0x27')](_0x4fa646[_0x6c1c('0x24')],_0x4fa646[_0x6c1c('0x25')]);_0x26ee48['attributes']=_['intersection'](_0x4fa646[_0x6c1c('0x24')],qs[_0x6c1c('0x28')](_0x2d248c['query']['fields']));_0x26ee48['attributes']=_0x26ee48[_0x6c1c('0x29')][_0x6c1c('0x2a')]?_0x26ee48[_0x6c1c('0x29')]:_0x4fa646[_0x6c1c('0x24')];_0x26ee48['order']=qs[_0x6c1c('0x2e')](_0x2d248c['query']['sort']);_0x26ee48['where']=qs[_0x6c1c('0x26')](_[_0x6c1c('0x48')](_0x2d248c[_0x6c1c('0x25')],_0x4fa646[_0x6c1c('0x26')]));if(_0x2d248c[_0x6c1c('0x25')][_0x6c1c('0x32')]){_0x26ee48['where']=_[_0x6c1c('0x33')](_0x26ee48[_0x6c1c('0x2f')],{'$or':_[_0x6c1c('0x20')](_0x26ee48['attributes'],function(_0x585a42){var _0x4ea97d={};_0x4ea97d[_0x585a42]={'$like':'%'+_0x2d248c[_0x6c1c('0x25')][_0x6c1c('0x32')]+'%'};return _0x4ea97d;})});}_0x26ee48=_['merge']({},_0x26ee48,_0x2d248c[_0x6c1c('0x34')]);return _0x43d379['getUsers'](_0x26ee48);}})[_0x6c1c('0x17')](function(_0x1fc46f){if(_0x1fc46f){_0x6b05c7=_0x1fc46f[_0x6c1c('0x2a')];if(!_0x2d248c[_0x6c1c('0x25')]['hasOwnProperty'](_0x6c1c('0x2c'))){_0x26ee48[_0x6c1c('0xe')]=qs['limit'](_0x2d248c['query'][_0x6c1c('0xe')]);_0x26ee48[_0x6c1c('0xd')]=qs[_0x6c1c('0xd')](_0x2d248c['query'][_0x6c1c('0xd')]);}return _0x43d379[_0x6c1c('0x50')](_0x26ee48);}})['then'](function(_0x4a730a){if(_0x4a730a){return _0x4a730a?{'count':_0x6b05c7,'rows':_0x4a730a}:null;}})['then'](respondWithResult(_0x13963a,null))['catch'](handleError(_0x13963a,null));}; \ No newline at end of file +var _0x5496=['end','status','json','offset','undefined','limit','count','update','then','SquareProjects','UserProfileResource','destroy','agi','stringify','error','stack','name','index','map','SquareProject','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','merge','filter','options','includeAll','include','rows','catch','keys','find','create','body','user','role','get','UserProfileSection','userProfileId','autoAssociation','params','publish','pick','production','addUsers','ids','removeUsers','isArray','emit','userSquareProject:remove','findOne','User','order','getUsers','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','defaults','redis','localhost','./squareProject.socket','register','sendStatus'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x5496,0x175));var _0x6549=function(_0x43c20d,_0x32e1f4){_0x43c20d=_0x43c20d-0x0;var _0x45d451=_0x5496[_0x43c20d];return _0x45d451;};'use strict';var _=require(_0x6549('0x0'));var Redis=require(_0x6549('0x1'));var qs=require(_0x6549('0x2'));var logger=require(_0x6549('0x3'))(_0x6549('0x4'));var config=require('../../config/environment');var db=require(_0x6549('0x5'))['db'];config['redis']=_[_0x6549('0x6')](config[_0x6549('0x7')],{'host':_0x6549('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x6549('0x9'))[_0x6549('0xa')](socket);function respondWithStatusCode(_0x4fcffd,_0x1ca8fc){_0x1ca8fc=_0x1ca8fc||0xcc;return function(_0x3442c3){if(_0x3442c3){return _0x4fcffd[_0x6549('0xb')](_0x1ca8fc);}return _0x4fcffd['status'](_0x1ca8fc)[_0x6549('0xc')]();};}function respondWithResult(_0x35d008,_0x2ecce2){_0x2ecce2=_0x2ecce2||0xc8;return function(_0x135c2c){if(_0x135c2c){return _0x35d008[_0x6549('0xd')](_0x2ecce2)[_0x6549('0xe')](_0x135c2c);}};}function respondWithFilteredResult(_0x50fa35,_0x551133){return function(_0x1e27d4){if(_0x1e27d4){var _0xac828c=typeof _0x551133[_0x6549('0xf')]===_0x6549('0x10')&&typeof _0x551133[_0x6549('0x11')]==='undefined';var _0x4dfb06=_0x1e27d4[_0x6549('0x12')];var _0x39d78c=_0xac828c?0x0:_0x551133['offset'];var _0x200ff1=_0xac828c?_0x1e27d4[_0x6549('0x12')]:_0x551133[_0x6549('0xf')]+_0x551133[_0x6549('0x11')];var _0xc0e859;if(_0x200ff1>=_0x4dfb06){_0x200ff1=_0x4dfb06;_0xc0e859=0xc8;}else{_0xc0e859=0xce;}_0x50fa35[_0x6549('0xd')](_0xc0e859);return _0x50fa35['set']('Content-Range',_0x39d78c+'-'+_0x200ff1+'/'+_0x4dfb06)[_0x6549('0xe')](_0x1e27d4);}return null;};}function saveUpdates(_0x25da29){return function(_0x47a81a){if(_0x47a81a){return _0x47a81a[_0x6549('0x13')](_0x25da29)[_0x6549('0x14')](function(_0x4608fb){return _0x4608fb;});}return null;};}function removeEntity(_0x387e60){return function(_0xffc8b9){if(_0xffc8b9){return _0xffc8b9['destroy']()['then'](function(){var _0x26a212=_0xffc8b9['get']({'plain':!![]});var _0x56c15b=_0x6549('0x15');return db[_0x6549('0x16')][_0x6549('0x17')]({'where':{'type':_0x56c15b,'resourceId':_0x26a212['id']}})[_0x6549('0x14')](function(){return _0xffc8b9;});})[_0x6549('0x14')](function(){var _0x5ce3aa=new Redis(config[_0x6549('0x7')]);_0x5ce3aa['publish'](_0x6549('0x18'),JSON[_0x6549('0x19')]({'id':_0xffc8b9['id'],'deleted':!![]}));})[_0x6549('0x14')](function(){_0x387e60[_0x6549('0xd')](0xcc)[_0x6549('0xc')]();});}};}function handleEntityNotFound(_0x12d547){return function(_0x427b47){if(!_0x427b47){_0x12d547[_0x6549('0xb')](0x194);}return _0x427b47;};}function handleError(_0x2be467,_0x6ae00c){_0x6ae00c=_0x6ae00c||0x1f4;return function(_0x40d3f9){logger[_0x6549('0x1a')](_0x40d3f9[_0x6549('0x1b')]);if(_0x40d3f9['name']){delete _0x40d3f9[_0x6549('0x1c')];}_0x2be467[_0x6549('0xd')](_0x6ae00c)['send'](_0x40d3f9);};}exports[_0x6549('0x1d')]=function(_0x29f89e,_0x3768cb){var _0x583c7d={},_0x31a95={},_0xfb51a1={'count':0x0,'rows':[]};var _0x14de1f=_[_0x6549('0x1e')](db[_0x6549('0x1f')][_0x6549('0x20')],function(_0x2f58f7){return{'name':_0x2f58f7[_0x6549('0x21')],'type':_0x2f58f7['type'][_0x6549('0x22')]};});_0x31a95[_0x6549('0x23')]=_[_0x6549('0x1e')](_0x14de1f,'name');_0x31a95[_0x6549('0x24')]=_['keys'](_0x29f89e['query']);_0x31a95['filters']=_[_0x6549('0x25')](_0x31a95[_0x6549('0x23')],_0x31a95['query']);_0x583c7d[_0x6549('0x26')]=_[_0x6549('0x25')](_0x31a95[_0x6549('0x23')],qs[_0x6549('0x27')](_0x29f89e[_0x6549('0x24')][_0x6549('0x27')]));_0x583c7d[_0x6549('0x26')]=_0x583c7d['attributes'][_0x6549('0x28')]?_0x583c7d[_0x6549('0x26')]:_0x31a95[_0x6549('0x23')];if(!_0x29f89e[_0x6549('0x24')][_0x6549('0x29')](_0x6549('0x2a'))){_0x583c7d['limit']=qs[_0x6549('0x11')](_0x29f89e['query'][_0x6549('0x11')]);_0x583c7d['offset']=qs[_0x6549('0xf')](_0x29f89e[_0x6549('0x24')][_0x6549('0xf')]);}_0x583c7d['order']=qs[_0x6549('0x2b')](_0x29f89e[_0x6549('0x24')][_0x6549('0x2b')]);_0x583c7d[_0x6549('0x2c')]=qs['filters'](_['pick'](_0x29f89e['query'],_0x31a95[_0x6549('0x2d')]),_0x14de1f);if(_0x29f89e[_0x6549('0x24')]['filter']){_0x583c7d[_0x6549('0x2c')]=_[_0x6549('0x2e')](_0x583c7d[_0x6549('0x2c')],{'$or':_[_0x6549('0x1e')](_0x14de1f,function(_0x3741f5){if(_0x3741f5['type']!=='VIRTUAL'){var _0x1fcacf={};_0x1fcacf[_0x3741f5[_0x6549('0x1c')]]={'$like':'%'+_0x29f89e[_0x6549('0x24')][_0x6549('0x2f')]+'%'};return _0x1fcacf;}})});}_0x583c7d=_[_0x6549('0x2e')]({},_0x583c7d,_0x29f89e[_0x6549('0x30')]);var _0x1c6b46={'where':_0x583c7d[_0x6549('0x2c')]};return db[_0x6549('0x1f')][_0x6549('0x12')](_0x1c6b46)['then'](function(_0x3ecf9a){_0xfb51a1[_0x6549('0x12')]=_0x3ecf9a;if(_0x29f89e[_0x6549('0x24')][_0x6549('0x31')]){_0x583c7d[_0x6549('0x32')]=[{'all':!![]}];}return db['SquareProject']['findAll'](_0x583c7d);})['then'](function(_0x22b919){_0xfb51a1[_0x6549('0x33')]=_0x22b919;return _0xfb51a1;})[_0x6549('0x14')](respondWithFilteredResult(_0x3768cb,_0x583c7d))[_0x6549('0x34')](handleError(_0x3768cb,null));};exports['show']=function(_0x56ce9f,_0x438f0b){var _0x1e719a={'raw':![],'where':{'id':_0x56ce9f['params']['id']}},_0x252d20={};_0x252d20[_0x6549('0x23')]=_['keys'](db[_0x6549('0x1f')][_0x6549('0x20')]);_0x252d20[_0x6549('0x24')]=_[_0x6549('0x35')](_0x56ce9f[_0x6549('0x24')]);_0x252d20[_0x6549('0x2d')]=_[_0x6549('0x25')](_0x252d20['model'],_0x252d20[_0x6549('0x24')]);_0x1e719a[_0x6549('0x26')]=_[_0x6549('0x25')](_0x252d20[_0x6549('0x23')],qs[_0x6549('0x27')](_0x56ce9f[_0x6549('0x24')][_0x6549('0x27')]));_0x1e719a[_0x6549('0x26')]=_0x1e719a[_0x6549('0x26')][_0x6549('0x28')]?_0x1e719a[_0x6549('0x26')]:_0x252d20[_0x6549('0x23')];if(_0x56ce9f[_0x6549('0x24')][_0x6549('0x31')]){_0x1e719a[_0x6549('0x32')]=[{'all':!![]}];}_0x1e719a=_[_0x6549('0x2e')]({},_0x1e719a,_0x56ce9f['options']);return db[_0x6549('0x1f')][_0x6549('0x36')](_0x1e719a)[_0x6549('0x14')](handleEntityNotFound(_0x438f0b,null))[_0x6549('0x14')](respondWithResult(_0x438f0b,null))['catch'](handleError(_0x438f0b,null));};exports[_0x6549('0x37')]=function(_0x483727,_0x14c90a){return db[_0x6549('0x1f')]['create'](_0x483727[_0x6549('0x38')],{})[_0x6549('0x14')](function(_0x44e608){var _0x18a751=_0x483727[_0x6549('0x39')]['get']({'plain':!![]});if(!_0x18a751)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x18a751[_0x6549('0x3a')]===_0x6549('0x39')){var _0x41d675=_0x44e608[_0x6549('0x3b')]({'plain':!![]});var _0x1e562b='SquareProjects';return db[_0x6549('0x3c')][_0x6549('0x36')]({'where':{'name':_0x1e562b,'userProfileId':_0x18a751[_0x6549('0x3d')]},'raw':!![]})[_0x6549('0x14')](function(_0xa4c650){if(_0xa4c650&&_0xa4c650[_0x6549('0x3e')]===0x0){return db[_0x6549('0x16')][_0x6549('0x37')]({'name':_0x41d675['name'],'resourceId':_0x41d675['id'],'type':_0xa4c650[_0x6549('0x1c')],'sectionId':_0xa4c650['id']},{})['then'](function(){return _0x44e608;});}else{return _0x44e608;}})[_0x6549('0x34')](function(_0x1e09e1){logger[_0x6549('0x1a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1e09e1);throw _0x1e09e1;});}return _0x44e608;})[_0x6549('0x14')](respondWithResult(_0x14c90a,0xc9))[_0x6549('0x34')](handleError(_0x14c90a,null));};exports[_0x6549('0x13')]=function(_0x5300c8,_0x19ac50){if(_0x5300c8[_0x6549('0x38')]['id']){delete _0x5300c8[_0x6549('0x38')]['id'];}return db[_0x6549('0x1f')][_0x6549('0x36')]({'where':{'id':_0x5300c8[_0x6549('0x3f')]['id']}})['then'](handleEntityNotFound(_0x19ac50,null))[_0x6549('0x14')](saveUpdates(_0x5300c8['body'],null))[_0x6549('0x14')](function(_0x9bad8f){if(!_0x9bad8f)return;var _0x1640aa=_0x9bad8f[_0x6549('0x3b')]({'plain':!![]});return _0x1640aa;})[_0x6549('0x14')](function(_0x21d2fb){var _0x292b52=new Redis(config[_0x6549('0x7')]);_0x292b52[_0x6549('0x40')](_0x6549('0x18'),JSON[_0x6549('0x19')](_[_0x6549('0x41')](_0x21d2fb,['id','name',_0x6549('0x42')])));return _0x21d2fb;})[_0x6549('0x14')](respondWithResult(_0x19ac50,null))[_0x6549('0x34')](handleError(_0x19ac50,null));};exports[_0x6549('0x17')]=function(_0x260097,_0x1ffa23){return db[_0x6549('0x1f')][_0x6549('0x36')]({'where':{'id':_0x260097['params']['id']}})[_0x6549('0x14')](handleEntityNotFound(_0x1ffa23,null))[_0x6549('0x14')](removeEntity(_0x1ffa23,null))[_0x6549('0x34')](handleError(_0x1ffa23,null));};exports[_0x6549('0x43')]=function(_0x2b0ba8,_0x8bbdf4){return db[_0x6549('0x1f')][_0x6549('0x36')]({'where':{'id':_0x2b0ba8['params']['id']}})[_0x6549('0x14')](handleEntityNotFound(_0x8bbdf4,null))[_0x6549('0x14')](function(_0x32b336){if(_0x32b336){return _0x32b336[_0x6549('0x43')](_0x2b0ba8[_0x6549('0x38')][_0x6549('0x44')],_['omit'](_0x2b0ba8[_0x6549('0x38')],[_0x6549('0x44'),'id'])||{});}})['then'](respondWithResult(_0x8bbdf4,null))[_0x6549('0x34')](handleError(_0x8bbdf4,null));};exports[_0x6549('0x45')]=function(_0x2efad1,_0x557b52){return db[_0x6549('0x1f')][_0x6549('0x36')]({'where':{'id':_0x2efad1['params']['id']}})[_0x6549('0x14')](handleEntityNotFound(_0x557b52,null))['then'](function(_0x3dc12c){if(_0x3dc12c){return _0x3dc12c['removeUsers'](_0x2efad1[_0x6549('0x24')][_0x6549('0x44')])[_0x6549('0x14')](function(){if(_[_0x6549('0x46')](_0x2efad1[_0x6549('0x24')][_0x6549('0x44')])){for(var _0x3b01d9=0x0;_0x3b01d9<_0x2efad1[_0x6549('0x24')][_0x6549('0x44')][_0x6549('0x28')];_0x3b01d9+=0x1){socket[_0x6549('0x47')](_0x6549('0x48'),{'UserId':Number(_0x2efad1[_0x6549('0x24')][_0x6549('0x44')][_0x3b01d9]),'SquareProjectId':Number(_0x2efad1['params']['id'])});}}else{socket[_0x6549('0x47')](_0x6549('0x48'),{'UserId':Number(_0x2efad1['query'][_0x6549('0x44')]),'SquareProjectId':Number(_0x2efad1[_0x6549('0x3f')]['id'])});}});}})[_0x6549('0x14')](respondWithStatusCode(_0x557b52,null))[_0x6549('0x34')](handleError(_0x557b52,null));};exports['getUsers']=function(_0x6ff64d,_0x28ff2e){var _0x19c9bd={};var _0x20e39b={};var _0x53d016;var _0x395039;return db['SquareProject'][_0x6549('0x49')]({'where':{'id':_0x6ff64d[_0x6549('0x3f')]['id']}})[_0x6549('0x14')](handleEntityNotFound(_0x28ff2e,null))[_0x6549('0x14')](function(_0x179dd7){if(_0x179dd7){_0x53d016=_0x179dd7;_0x20e39b[_0x6549('0x23')]=_[_0x6549('0x35')](db[_0x6549('0x4a')][_0x6549('0x20')]);_0x20e39b[_0x6549('0x24')]=_['keys'](_0x6ff64d[_0x6549('0x24')]);_0x20e39b[_0x6549('0x2d')]=_[_0x6549('0x25')](_0x20e39b[_0x6549('0x23')],_0x20e39b[_0x6549('0x24')]);_0x19c9bd[_0x6549('0x26')]=_['intersection'](_0x20e39b['model'],qs[_0x6549('0x27')](_0x6ff64d[_0x6549('0x24')][_0x6549('0x27')]));_0x19c9bd['attributes']=_0x19c9bd[_0x6549('0x26')][_0x6549('0x28')]?_0x19c9bd['attributes']:_0x20e39b[_0x6549('0x23')];_0x19c9bd[_0x6549('0x4b')]=qs[_0x6549('0x2b')](_0x6ff64d[_0x6549('0x24')][_0x6549('0x2b')]);_0x19c9bd[_0x6549('0x2c')]=qs[_0x6549('0x2d')](_[_0x6549('0x41')](_0x6ff64d['query'],_0x20e39b[_0x6549('0x2d')]));if(_0x6ff64d['query'][_0x6549('0x2f')]){_0x19c9bd[_0x6549('0x2c')]=_['merge'](_0x19c9bd[_0x6549('0x2c')],{'$or':_[_0x6549('0x1e')](_0x19c9bd[_0x6549('0x26')],function(_0x5f3873){var _0xaf4ef3={};_0xaf4ef3[_0x5f3873]={'$like':'%'+_0x6ff64d[_0x6549('0x24')][_0x6549('0x2f')]+'%'};return _0xaf4ef3;})});}_0x19c9bd=_[_0x6549('0x2e')]({},_0x19c9bd,_0x6ff64d[_0x6549('0x30')]);return _0x53d016[_0x6549('0x4c')](_0x19c9bd);}})['then'](function(_0x384237){if(_0x384237){_0x395039=_0x384237[_0x6549('0x28')];if(!_0x6ff64d[_0x6549('0x24')]['hasOwnProperty']('nolimit')){_0x19c9bd['limit']=qs[_0x6549('0x11')](_0x6ff64d[_0x6549('0x24')][_0x6549('0x11')]);_0x19c9bd['offset']=qs['offset'](_0x6ff64d[_0x6549('0x24')]['offset']);}return _0x53d016[_0x6549('0x4c')](_0x19c9bd);}})[_0x6549('0x14')](function(_0xcba9e1){if(_0xcba9e1){return _0xcba9e1?{'count':_0x395039,'rows':_0xcba9e1}:null;}})[_0x6549('0x14')](respondWithResult(_0x28ff2e,null))[_0x6549('0x34')](handleError(_0x28ff2e,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index e61f084..c498cd7 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 _0x92f7=['update','remove','emit','hasOwnProperty','exports','setMaxListeners','save'];(function(_0x427c29,_0x534f87){var _0x3b7150=function(_0x3cf516){while(--_0x3cf516){_0x427c29['push'](_0x427c29['shift']());}};_0x3b7150(++_0x534f87);}(_0x92f7,0x1e1));var _0x792f=function(_0x1b2e34,_0x8d3ab5){_0x1b2e34=_0x1b2e34-0x0;var _0x13c2b9=_0x92f7[_0x1b2e34];return _0x13c2b9;};'use strict';var EventEmitter=require('events');var SquareProject=require('../../mysqldb')['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x792f('0x0')](0x0);var events={'afterCreate':_0x792f('0x1'),'afterUpdate':_0x792f('0x2'),'afterDestroy':_0x792f('0x3')};function emitEvent(_0x29430a){return function(_0x54e1ae,_0x5e96f0,_0x149408){SquareProjectEvents[_0x792f('0x4')](_0x29430a+':'+_0x54e1ae['id'],_0x54e1ae);SquareProjectEvents[_0x792f('0x4')](_0x29430a,_0x54e1ae);_0x149408(null);};}for(var e in events){if(events[_0x792f('0x5')](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0x792f('0x6')]=SquareProjectEvents; \ No newline at end of file +var _0x96b1=['emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','save','remove'];(function(_0x54577b,_0x142934){var _0x3aac99=function(_0x4a7184){while(--_0x4a7184){_0x54577b['push'](_0x54577b['shift']());}};_0x3aac99(++_0x142934);}(_0x96b1,0x1c3));var _0x196b=function(_0x2850c0,_0x1363a7){_0x2850c0=_0x2850c0-0x0;var _0x21e830=_0x96b1[_0x2850c0];return _0x21e830;};'use strict';var EventEmitter=require(_0x196b('0x0'));var SquareProject=require(_0x196b('0x1'))['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x196b('0x2')](0x0);var events={'afterCreate':_0x196b('0x3'),'afterUpdate':'update','afterDestroy':_0x196b('0x4')};function emitEvent(_0x445eb8){return function(_0x2e3b84,_0x492530,_0x8cf9d3){SquareProjectEvents['emit'](_0x445eb8+':'+_0x2e3b84['id'],_0x2e3b84);SquareProjectEvents[_0x196b('0x5')](_0x445eb8,_0x2e3b84);_0x8cf9d3(null);};}for(var e in events){if(events[_0x196b('0x6')](e)){var event=events[e];SquareProject[_0x196b('0x7')](e,emitEvent(event));}}module['exports']=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 9bec02d..508b21e 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 _0xea91=['production','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./squareProject.attributes','exports','SquareProject','square_projects','format','YYYY-MM-DD\x20HH:mm:ss','changed'];(function(_0x4f51f9,_0x5d5613){var _0x533984=function(_0x578319){while(--_0x578319){_0x4f51f9['push'](_0x4f51f9['shift']());}};_0x533984(++_0x5d5613);}(_0xea91,0x133));var _0x1ea9=function(_0x19d0b6,_0x85209a){_0x19d0b6=_0x19d0b6-0x0;var _0x16060b=_0xea91[_0x19d0b6];return _0x16060b;};'use strict';var _=require(_0x1ea9('0x0'));var util=require(_0x1ea9('0x1'));var logger=require(_0x1ea9('0x2'))(_0x1ea9('0x3'));var moment=require(_0x1ea9('0x4'));var BPromise=require(_0x1ea9('0x5'));var rp=require(_0x1ea9('0x6'));var fs=require('fs');var path=require(_0x1ea9('0x7'));var rimraf=require('rimraf');var config=require(_0x1ea9('0x8'));var attributes=require(_0x1ea9('0x9'));module[_0x1ea9('0xa')]=function(_0x18f019,_0x2394f3){return _0x18f019['define'](_0x1ea9('0xb'),attributes,{'tableName':_0x1ea9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5804b6,_0x30c1d0,_0x93c1a2){if(_0x5804b6['changed']('preproduction')){_0x5804b6['savedAt']=moment()[_0x1ea9('0xd')](_0x1ea9('0xe'));}if(_0x5804b6[_0x1ea9('0xf')](_0x1ea9('0x10'))){_0x5804b6['publishedAt']=moment()[_0x1ea9('0xd')](_0x1ea9('0xe'));}_0x93c1a2(null,_0x5804b6);}}});}; \ No newline at end of file +var _0xc4af=['lodash','util','moment','bluebird','request-promise','rimraf','../../config/environment','define','SquareProject','changed','format','YYYY-MM-DD\x20HH:mm:ss','production'];(function(_0x4f507f,_0xad0b60){var _0x2e9980=function(_0x8d67ba){while(--_0x8d67ba){_0x4f507f['push'](_0x4f507f['shift']());}};_0x2e9980(++_0xad0b60);}(_0xc4af,0xa9));var _0xfc4a=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xc4af[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0xfc4a('0x0'));var util=require(_0xfc4a('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xfc4a('0x2'));var BPromise=require(_0xfc4a('0x3'));var rp=require(_0xfc4a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfc4a('0x5'));var config=require(_0xfc4a('0x6'));var attributes=require('./squareProject.attributes');module['exports']=function(_0x5281d6,_0x4df2b4){return _0x5281d6[_0xfc4a('0x7')](_0xfc4a('0x8'),attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2d0cbf,_0x16700d,_0x5c28fa){if(_0x2d0cbf[_0xfc4a('0x9')]('preproduction')){_0x2d0cbf['savedAt']=moment()[_0xfc4a('0xa')](_0xfc4a('0xb'));}if(_0x2d0cbf[_0xfc4a('0x9')](_0xfc4a('0xc'))){_0x2d0cbf['publishedAt']=moment()[_0xfc4a('0xa')](_0xfc4a('0xb'));}_0x5c28fa(null,_0x2d0cbf);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index cd6f0c8..de24b51 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 _0xf652=['limit','include','map','model','then','info','debug','stringify','catch','message','error','ShowSquareProject','find','lodash','../../mysqldb','../../config/logger','rpc','redis','localhost','./squareProject.socket','register','GetSquareProjects','SquareProject','options','where','attributes'];(function(_0x43a37c,_0x25a567){var _0x5d1d40=function(_0x3ec673){while(--_0x3ec673){_0x43a37c['push'](_0x43a37c['shift']());}};_0x5d1d40(++_0x25a567);}(_0xf652,0xc3));var _0x2f65=function(_0x97535d,_0x8559ac){_0x97535d=_0x97535d-0x0;var _0x47960f=_0xf652[_0x97535d];return _0x47960f;};'use strict';var _=require(_0x2f65('0x0'));var Redis=require('ioredis');var db=require(_0x2f65('0x1'))['db'];var logger=require(_0x2f65('0x2'))(_0x2f65('0x3'));var config=require('../../config/environment');config['redis']=_['defaults'](config[_0x2f65('0x4')],{'host':_0x2f65('0x5'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x2f65('0x6'))[_0x2f65('0x7')](socket);exports[_0x2f65('0x8')]=function(_0x247fbc){var _0x36ce3c=this;return new Promise(function(_0x4e3c74,_0x373246){return db[_0x2f65('0x9')]['findAll']({'raw':_0x247fbc[_0x2f65('0xa')]?_0x247fbc[_0x2f65('0xa')]['raw']===undefined?!![]:![]:!![],'where':_0x247fbc['options']?_0x247fbc['options'][_0x2f65('0xb')]||null:null,'attributes':_0x247fbc[_0x2f65('0xa')]?_0x247fbc['options'][_0x2f65('0xc')]||null:null,'limit':_0x247fbc['options']?_0x247fbc['options'][_0x2f65('0xd')]||null:null,'include':_0x247fbc[_0x2f65('0xa')]?_0x247fbc[_0x2f65('0xa')][_0x2f65('0xe')]?_[_0x2f65('0xf')](_0x247fbc[_0x2f65('0xa')][_0x2f65('0xe')],function(_0x1e4ee4){return{'model':db[_0x1e4ee4[_0x2f65('0x10')]],'as':_0x1e4ee4['as'],'attributes':_0x1e4ee4[_0x2f65('0xc')],'include':_0x1e4ee4[_0x2f65('0xe')]?_[_0x2f65('0xf')](_0x1e4ee4[_0x2f65('0xe')],function(_0x13b0ac){return{'model':db[_0x13b0ac['model']],'as':_0x13b0ac['as'],'attributes':_0x13b0ac['attributes'],'include':_0x13b0ac['include']?_['map'](_0x13b0ac['include'],function(_0xfe1f64){return{'model':db[_0xfe1f64[_0x2f65('0x10')]],'as':_0xfe1f64['as'],'attributes':_0xfe1f64[_0x2f65('0xc')]};}):[]};}):[]};}):[]:[]})[_0x2f65('0x11')](function(_0x47e1a5){logger[_0x2f65('0x12')](_0x2f65('0x8'),_0x247fbc);logger[_0x2f65('0x13')](_0x2f65('0x8'),_0x247fbc,JSON[_0x2f65('0x14')](_0x47e1a5));_0x4e3c74(_0x47e1a5);})[_0x2f65('0x15')](function(_0x5becc3){logger['error'](_0x2f65('0x8'),_0x5becc3[_0x2f65('0x16')],_0x247fbc);_0x373246(_0x36ce3c[_0x2f65('0x17')](0x1f4,_0x5becc3[_0x2f65('0x16')]));});});};exports[_0x2f65('0x18')]=function(_0x2d0198){var _0x5aeb61=this;return new Promise(function(_0x4da0db,_0x59fef1){return db[_0x2f65('0x9')][_0x2f65('0x19')]({'raw':_0x2d0198[_0x2f65('0xa')]?_0x2d0198['options']['raw']===undefined?!![]:![]:!![],'where':_0x2d0198[_0x2f65('0xa')]?_0x2d0198['options'][_0x2f65('0xb')]||null:null,'attributes':_0x2d0198[_0x2f65('0xa')]?_0x2d0198['options']['attributes']||null:null,'include':_0x2d0198[_0x2f65('0xa')]?_0x2d0198[_0x2f65('0xa')][_0x2f65('0xe')]?_['map'](_0x2d0198[_0x2f65('0xa')][_0x2f65('0xe')],function(_0x379d9d){return{'model':db[_0x379d9d[_0x2f65('0x10')]],'as':_0x379d9d['as'],'attributes':_0x379d9d['attributes'],'include':_0x379d9d[_0x2f65('0xe')]?_['map'](_0x379d9d[_0x2f65('0xe')],function(_0x296494){return{'model':db[_0x296494['model']],'as':_0x296494['as'],'attributes':_0x296494['attributes'],'include':_0x296494[_0x2f65('0xe')]?_[_0x2f65('0xf')](_0x296494[_0x2f65('0xe')],function(_0x318b9b){return{'model':db[_0x318b9b[_0x2f65('0x10')]],'as':_0x318b9b['as'],'attributes':_0x318b9b['attributes']};}):[]};}):[]};}):[]:[]})[_0x2f65('0x11')](function(_0x41632c){logger[_0x2f65('0x12')](_0x2f65('0x18'),_0x2d0198);logger[_0x2f65('0x13')](_0x2f65('0x18'),_0x2d0198,JSON[_0x2f65('0x14')](_0x41632c));_0x4da0db(_0x41632c);})[_0x2f65('0x15')](function(_0x1a9cec){logger[_0x2f65('0x17')]('ShowSquareProject',_0x1a9cec[_0x2f65('0x16')],_0x2d0198);_0x59fef1(_0x5aeb61[_0x2f65('0x17')](0x1f4,_0x1a9cec['message']));});});}; \ No newline at end of file +var _0x710b=['model','attributes','then','info','GetSquareProjects','debug','catch','error','message','ShowSquareProject','find','stringify','lodash','ioredis','../../mysqldb','../../config/logger','../../config/environment','redis','socket.io-emitter','./squareProject.socket','register','SquareProject','findAll','options','raw','where','limit','map','include'];(function(_0x236043,_0x5c2c37){var _0x4fcd2c=function(_0x482b1c){while(--_0x482b1c){_0x236043['push'](_0x236043['shift']());}};_0x4fcd2c(++_0x5c2c37);}(_0x710b,0x80));var _0xb710=function(_0x482115,_0x5550f5){_0x482115=_0x482115-0x0;var _0x40afb4=_0x710b[_0x482115];return _0x40afb4;};'use strict';var _=require(_0xb710('0x0'));var Redis=require(_0xb710('0x1'));var db=require(_0xb710('0x2'))['db'];var logger=require(_0xb710('0x3'))('rpc');var config=require(_0xb710('0x4'));config[_0xb710('0x5')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xb710('0x6'))(new Redis(config['redis']));require(_0xb710('0x7'))[_0xb710('0x8')](socket);exports['GetSquareProjects']=function(_0x130f0d){var _0x54d8f4=this;return new Promise(function(_0x38b7c7,_0x2a9e77){return db[_0xb710('0x9')][_0xb710('0xa')]({'raw':_0x130f0d[_0xb710('0xb')]?_0x130f0d['options'][_0xb710('0xc')]===undefined?!![]:![]:!![],'where':_0x130f0d[_0xb710('0xb')]?_0x130f0d[_0xb710('0xb')][_0xb710('0xd')]||null:null,'attributes':_0x130f0d[_0xb710('0xb')]?_0x130f0d['options']['attributes']||null:null,'limit':_0x130f0d['options']?_0x130f0d['options'][_0xb710('0xe')]||null:null,'include':_0x130f0d[_0xb710('0xb')]?_0x130f0d[_0xb710('0xb')]['include']?_[_0xb710('0xf')](_0x130f0d['options'][_0xb710('0x10')],function(_0x3c8d11){return{'model':db[_0x3c8d11[_0xb710('0x11')]],'as':_0x3c8d11['as'],'attributes':_0x3c8d11[_0xb710('0x12')],'include':_0x3c8d11[_0xb710('0x10')]?_['map'](_0x3c8d11[_0xb710('0x10')],function(_0x26ba60){return{'model':db[_0x26ba60[_0xb710('0x11')]],'as':_0x26ba60['as'],'attributes':_0x26ba60[_0xb710('0x12')],'include':_0x26ba60[_0xb710('0x10')]?_[_0xb710('0xf')](_0x26ba60[_0xb710('0x10')],function(_0x42663c){return{'model':db[_0x42663c[_0xb710('0x11')]],'as':_0x42663c['as'],'attributes':_0x42663c[_0xb710('0x12')]};}):[]};}):[]};}):[]:[]})[_0xb710('0x13')](function(_0x26b2f5){logger[_0xb710('0x14')](_0xb710('0x15'),_0x130f0d);logger[_0xb710('0x16')](_0xb710('0x15'),_0x130f0d,JSON['stringify'](_0x26b2f5));_0x38b7c7(_0x26b2f5);})[_0xb710('0x17')](function(_0x323438){logger[_0xb710('0x18')](_0xb710('0x15'),_0x323438[_0xb710('0x19')],_0x130f0d);_0x2a9e77(_0x54d8f4[_0xb710('0x18')](0x1f4,_0x323438[_0xb710('0x19')]));});});};exports[_0xb710('0x1a')]=function(_0x29a631){var _0x33739d=this;return new Promise(function(_0x2b8e13,_0x3b75ff){return db[_0xb710('0x9')][_0xb710('0x1b')]({'raw':_0x29a631[_0xb710('0xb')]?_0x29a631[_0xb710('0xb')]['raw']===undefined?!![]:![]:!![],'where':_0x29a631[_0xb710('0xb')]?_0x29a631[_0xb710('0xb')][_0xb710('0xd')]||null:null,'attributes':_0x29a631[_0xb710('0xb')]?_0x29a631[_0xb710('0xb')][_0xb710('0x12')]||null:null,'include':_0x29a631[_0xb710('0xb')]?_0x29a631['options'][_0xb710('0x10')]?_[_0xb710('0xf')](_0x29a631['options'][_0xb710('0x10')],function(_0x30646d){return{'model':db[_0x30646d[_0xb710('0x11')]],'as':_0x30646d['as'],'attributes':_0x30646d[_0xb710('0x12')],'include':_0x30646d[_0xb710('0x10')]?_[_0xb710('0xf')](_0x30646d[_0xb710('0x10')],function(_0x489450){return{'model':db[_0x489450[_0xb710('0x11')]],'as':_0x489450['as'],'attributes':_0x489450[_0xb710('0x12')],'include':_0x489450[_0xb710('0x10')]?_['map'](_0x489450[_0xb710('0x10')],function(_0x468885){return{'model':db[_0x468885[_0xb710('0x11')]],'as':_0x468885['as'],'attributes':_0x468885[_0xb710('0x12')]};}):[]};}):[]};}):[]:[]})[_0xb710('0x13')](function(_0x569fe4){logger['info'](_0xb710('0x1a'),_0x29a631);logger['debug'](_0xb710('0x1a'),_0x29a631,JSON[_0xb710('0x1c')](_0x569fe4));_0x2b8e13(_0x569fe4);})[_0xb710('0x17')](function(_0x3c6975){logger['error'](_0xb710('0x1a'),_0x3c6975['message'],_0x29a631);_0x3b75ff(_0x33739d[_0xb710('0x18')](0x1f4,_0x3c6975['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 54ab06b..4fdc7e3 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 _0x245d=['save','update','emit','removeListener','register','squareProject:','./squareProject.events'];(function(_0x347d95,_0x2d161b){var _0x1a5e53=function(_0x1e55f8){while(--_0x1e55f8){_0x347d95['push'](_0x347d95['shift']());}};_0x1a5e53(++_0x2d161b);}(_0x245d,0xca));var _0xd245=function(_0x26479f,_0x3cf57b){_0x26479f=_0x26479f-0x0;var _0x2e390c=_0x245d[_0x26479f];return _0x2e390c;};'use strict';var SquareProjectEvents=require(_0xd245('0x0'));var events=[_0xd245('0x1'),'remove',_0xd245('0x2')];function createListener(_0x2e8f21,_0x1a9e8a){return function(_0x5e4a55){_0x1a9e8a[_0xd245('0x3')](_0x2e8f21,_0x5e4a55);};}function removeListener(_0x1cd68a,_0x49a9e8){return function(){SquareProjectEvents[_0xd245('0x4')](_0x1cd68a,_0x49a9e8);};}exports[_0xd245('0x5')]=function(_0x5149c3){for(var _0x2045f6=0x0,_0x340ce3=events['length'];_0x2045f6<_0x340ce3;_0x2045f6++){var _0x383334=events[_0x2045f6];var _0x114466=createListener(_0xd245('0x6')+_0x383334,_0x5149c3);SquareProjectEvents['on'](_0x383334,_0x114466);}}; \ No newline at end of file +var _0x4eaa=['./squareProject.events','save','update','emit','removeListener','register','length','squareProject:'];(function(_0x5ce93e,_0x5b62ec){var _0x30d7e4=function(_0x4d8f41){while(--_0x4d8f41){_0x5ce93e['push'](_0x5ce93e['shift']());}};_0x30d7e4(++_0x5b62ec);}(_0x4eaa,0xb8));var _0xa4ea=function(_0x5ebcdc,_0x9035e2){_0x5ebcdc=_0x5ebcdc-0x0;var _0x7e7511=_0x4eaa[_0x5ebcdc];return _0x7e7511;};'use strict';var SquareProjectEvents=require(_0xa4ea('0x0'));var events=[_0xa4ea('0x1'),'remove',_0xa4ea('0x2')];function createListener(_0x59c477,_0x48aaad){return function(_0x2da831){_0x48aaad[_0xa4ea('0x3')](_0x59c477,_0x2da831);};}function removeListener(_0x3b32a9,_0x5946c4){return function(){SquareProjectEvents[_0xa4ea('0x4')](_0x3b32a9,_0x5946c4);};}exports[_0xa4ea('0x5')]=function(_0x2f1ee5){for(var _0x3b38d8=0x0,_0xda341c=events[_0xa4ea('0x6')];_0x3b38d8<_0xda341c;_0x3b38d8++){var _0x25e876=events[_0x3b38d8];var _0x249dbf=createListener(_0xa4ea('0x7')+_0x25e876,_0x2f1ee5);SquareProjectEvents['on'](_0x25e876,_0x249dbf);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index dacb3b2..f7b33bf 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 _0xe14b=['Router','../../components/auth/service','./squareRecording.controller','get','isAuthenticated','index','/:id','download','post','delete','destroy','exports','multer','util','express'];(function(_0x2ce262,_0x475070){var _0x4cd71d=function(_0x3c4291){while(--_0x3c4291){_0x2ce262['push'](_0x2ce262['shift']());}};_0x4cd71d(++_0x475070);}(_0xe14b,0x93));var _0xbe14=function(_0x151d3f,_0x111071){_0x151d3f=_0x151d3f-0x0;var _0x31d2fd=_0xe14b[_0x151d3f];return _0x31d2fd;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbe14('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbe14('0x5'));router[_0xbe14('0x6')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x8')]);router[_0xbe14('0x6')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['show']);router['get']('/:id/download',auth[_0xbe14('0x7')](),controller[_0xbe14('0xa')]);router[_0xbe14('0xb')]('/',auth[_0xbe14('0x7')](),controller['create']);router['put'](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['update']);router[_0xbe14('0xc')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller[_0xbe14('0xd')]);module[_0xbe14('0xe')]=router; \ No newline at end of file +var _0x1cb9=['update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./squareRecording.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','post','create','put'];(function(_0x4fdd2b,_0x4db15c){var _0x598f5d=function(_0x53b86e){while(--_0x53b86e){_0x4fdd2b['push'](_0x4fdd2b['shift']());}};_0x598f5d(++_0x4db15c);}(_0x1cb9,0x14e));var _0x91cb=function(_0x5a7e36,_0x17657e){_0x5a7e36=_0x5a7e36-0x0;var _0x40a73d=_0x1cb9[_0x5a7e36];return _0x40a73d;};'use strict';var multer=require(_0x91cb('0x0'));var util=require('util');var path=require(_0x91cb('0x1'));var timeout=require(_0x91cb('0x2'));var express=require(_0x91cb('0x3'));var router=express[_0x91cb('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x91cb('0x5'));var interaction=require(_0x91cb('0x6'));var config=require('../../config/environment');var controller=require(_0x91cb('0x7'));router[_0x91cb('0x8')]('/',auth[_0x91cb('0x9')](),controller[_0x91cb('0xa')]);router[_0x91cb('0x8')](_0x91cb('0xb'),auth['isAuthenticated'](),controller[_0x91cb('0xc')]);router['get'](_0x91cb('0xd'),auth['isAuthenticated'](),controller[_0x91cb('0xe')]);router[_0x91cb('0xf')]('/',auth[_0x91cb('0x9')](),controller[_0x91cb('0x10')]);router[_0x91cb('0x11')](_0x91cb('0xb'),auth[_0x91cb('0x9')](),controller[_0x91cb('0x12')]);router[_0x91cb('0x13')](_0x91cb('0xb'),auth['isAuthenticated'](),controller[_0x91cb('0x14')]);module[_0x91cb('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 3f481fa..1a551d3 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 _0xf494=['STRING','VIRTUAL','getDataValue','savePath','substring','lastIndexOf','sequelize','exports'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0xf494,0x1c6));var _0x4f49=function(_0x2a6bc0,_0x340472){_0x2a6bc0=_0x2a6bc0-0x0;var _0x543694=_0xf494[_0x2a6bc0];return _0x543694;};'use strict';var Sequelize=require(_0x4f49('0x0'));module[_0x4f49('0x1')]={'uniqueid':{'type':Sequelize[_0x4f49('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x4f49('0x2')]},'context':{'type':Sequelize[_0x4f49('0x2')]},'extension':{'type':Sequelize[_0x4f49('0x2')]},'priority':{'type':Sequelize[_0x4f49('0x2')]},'accountcode':{'type':Sequelize[_0x4f49('0x2')]},'dnid':{'type':Sequelize[_0x4f49('0x2')]},'projectName':{'type':Sequelize[_0x4f49('0x2')]},'saveName':{'type':Sequelize[_0x4f49('0x2')]},'filename':{'type':Sequelize[_0x4f49('0x2')]},'savePath':{'type':Sequelize[_0x4f49('0x2')]},'format':{'type':Sequelize[_0x4f49('0x3')],'get':function(){var _0x5eb186='';var _0x58e9a0=this[_0x4f49('0x4')](_0x4f49('0x5'));if(_0x58e9a0){_0x5eb186=_0x58e9a0[_0x4f49('0x6')](_0x58e9a0[_0x4f49('0x7')]('.'));}return _0x5eb186;}}}; \ No newline at end of file +var _0x2675=['getDataValue','savePath','lastIndexOf','sequelize','STRING','VIRTUAL'];(function(_0x22808b,_0x329b6a){var _0x42cbd2=function(_0x256a8d){while(--_0x256a8d){_0x22808b['push'](_0x22808b['shift']());}};_0x42cbd2(++_0x329b6a);}(_0x2675,0x75));var _0x5267=function(_0x12b855,_0x260471){_0x12b855=_0x12b855-0x0;var _0x4046c8=_0x2675[_0x12b855];return _0x4046c8;};'use strict';var Sequelize=require(_0x5267('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x5267('0x1')]},'context':{'type':Sequelize[_0x5267('0x1')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x5267('0x1')]},'accountcode':{'type':Sequelize[_0x5267('0x1')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0x5267('0x1')]},'saveName':{'type':Sequelize[_0x5267('0x1')]},'filename':{'type':Sequelize[_0x5267('0x1')]},'savePath':{'type':Sequelize[_0x5267('0x1')]},'format':{'type':Sequelize[_0x5267('0x2')],'get':function(){var _0xc56cd5='';var _0x527c16=this[_0x5267('0x3')](_0x5267('0x4'));if(_0x527c16){_0xc56cd5=_0x527c16['substring'](_0x527c16[_0x5267('0x5')]('.'));}return _0xc56cd5;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 4cbcf07..ba15886 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 _0x277e=['save','update','then','destroy','stack','name','index','map','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','SquareRecording','includeAll','include','findAll','rows','catch','rawAttributes','find','create','body','params','download','../../components/encryptor','uniqueid','savePath','filename','format','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink','message','send','Not\x20found','isNil','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','json','offset','undefined','limit','count','status','Content-Range','apply','reject'];(function(_0x58da2c,_0x4a55dc){var _0x4d6aa1=function(_0x205ceb){while(--_0x205ceb){_0x58da2c['push'](_0x58da2c['shift']());}};_0x4d6aa1(++_0x4a55dc);}(_0x277e,0xfb));var _0xe277=function(_0x211436,_0x419cbb){_0x211436=_0x211436-0x0;var _0x4ef863=_0x277e[_0x211436];return _0x4ef863;};'use strict';var emlformat=require(_0xe277('0x0'));var rimraf=require(_0xe277('0x1'));var zipdir=require(_0xe277('0x2'));var jsonpatch=require(_0xe277('0x3'));var rp=require('request-promise');var moment=require(_0xe277('0x4'));var BPromise=require(_0xe277('0x5'));var Mustache=require(_0xe277('0x6'));var util=require(_0xe277('0x7'));var path=require(_0xe277('0x8'));var sox=require(_0xe277('0x9'));var csv=require(_0xe277('0xa'));var ejs=require(_0xe277('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xe277('0xc'));var jsforce=require(_0xe277('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe277('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe277('0xe'));var authService=require(_0xe277('0xf'));var qs=require(_0xe277('0x10'));var as=require(_0xe277('0x11'));var hardwareService=require(_0xe277('0x12'));var logger=require('../../config/logger')(_0xe277('0x13'));var utils=require(_0xe277('0x14'));var config=require(_0xe277('0x15'));var licenseUtil=require(_0xe277('0x16'));var db=require(_0xe277('0x17'))['db'];function respondWithStatusCode(_0x5a11af,_0x507736){_0x507736=_0x507736||0xcc;return function(_0x308a16){if(_0x308a16){return _0x5a11af['sendStatus'](_0x507736);}return _0x5a11af['status'](_0x507736)[_0xe277('0x18')]();};}function respondWithResult(_0x2fbe44,_0x1a03e8){_0x1a03e8=_0x1a03e8||0xc8;return function(_0x6d05b5){if(_0x6d05b5){return _0x2fbe44['status'](_0x1a03e8)[_0xe277('0x19')](_0x6d05b5);}};}function respondWithFilteredResult(_0x576a07,_0x4d0d25){return function(_0x1af34d){if(_0x1af34d){var _0x520f8b=typeof _0x4d0d25[_0xe277('0x1a')]===_0xe277('0x1b')&&typeof _0x4d0d25[_0xe277('0x1c')]===_0xe277('0x1b');var _0x4fce0c=_0x1af34d[_0xe277('0x1d')];var _0x7624ff=_0x520f8b?0x0:_0x4d0d25[_0xe277('0x1a')];var _0x8c36a9=_0x520f8b?_0x1af34d[_0xe277('0x1d')]:_0x4d0d25[_0xe277('0x1a')]+_0x4d0d25[_0xe277('0x1c')];var _0x19febf;if(_0x8c36a9>=_0x4fce0c){_0x8c36a9=_0x4fce0c;_0x19febf=0xc8;}else{_0x19febf=0xce;}_0x576a07[_0xe277('0x1e')](_0x19febf);return _0x576a07['set'](_0xe277('0x1f'),_0x7624ff+'-'+_0x8c36a9+'/'+_0x4fce0c)[_0xe277('0x19')](_0x1af34d);}return null;};}function patchUpdates(_0x5e9911){return function(_0x5cd117){try{jsonpatch[_0xe277('0x20')](_0x5cd117,_0x5e9911,!![]);}catch(_0x36f433){return BPromise[_0xe277('0x21')](_0x36f433);}return _0x5cd117[_0xe277('0x22')]();};}function saveUpdates(_0x2bb4e5,_0x2c33a9){return function(_0x49b6d4){if(_0x49b6d4){return _0x49b6d4[_0xe277('0x23')](_0x2bb4e5)[_0xe277('0x24')](function(_0x4d60d5){return _0x4d60d5;});}return null;};}function removeEntity(_0x35c691,_0x591c26){return function(_0x1dcb90){if(_0x1dcb90){return _0x1dcb90[_0xe277('0x25')]()[_0xe277('0x24')](function(){_0x35c691[_0xe277('0x1e')](0xcc)[_0xe277('0x18')]();});}};}function handleEntityNotFound(_0x1de8fc,_0x75b9f9){return function(_0x4ed923){if(!_0x4ed923){_0x1de8fc['sendStatus'](0x194);}return _0x4ed923;};}function handleError(_0x13ab1d,_0x447694){_0x447694=_0x447694||0x1f4;return function(_0x49a52f){logger['error'](_0x49a52f[_0xe277('0x26')]);if(_0x49a52f['name']){delete _0x49a52f[_0xe277('0x27')];}_0x13ab1d[_0xe277('0x1e')](_0x447694)['send'](_0x49a52f);};}exports[_0xe277('0x28')]=function(_0x5ec116,_0x171128){var _0x29eec7={},_0x1b2dc7={},_0x5ea14a={'count':0x0,'rows':[]};var _0x819fdf=_[_0xe277('0x29')](db['SquareRecording']['rawAttributes'],function(_0x5b4def){return{'name':_0x5b4def['fieldName'],'type':_0x5b4def[_0xe277('0x2a')][_0xe277('0x2b')]};});_0x1b2dc7[_0xe277('0x2c')]=_[_0xe277('0x29')](_0x819fdf,_0xe277('0x27'));_0x1b2dc7[_0xe277('0x2d')]=_['keys'](_0x5ec116[_0xe277('0x2d')]);_0x1b2dc7[_0xe277('0x2e')]=_[_0xe277('0x2f')](_0x1b2dc7[_0xe277('0x2c')],_0x1b2dc7[_0xe277('0x2d')]);_0x29eec7['attributes']=_[_0xe277('0x2f')](_0x1b2dc7['model'],qs[_0xe277('0x30')](_0x5ec116[_0xe277('0x2d')]['fields']));_0x29eec7['attributes']=_0x29eec7[_0xe277('0x31')][_0xe277('0x32')]?_0x29eec7['attributes']:_0x1b2dc7[_0xe277('0x2c')];if(!_0x5ec116['query'][_0xe277('0x33')](_0xe277('0x34'))){_0x29eec7[_0xe277('0x1c')]=qs[_0xe277('0x1c')](_0x5ec116[_0xe277('0x2d')][_0xe277('0x1c')]);_0x29eec7[_0xe277('0x1a')]=qs[_0xe277('0x1a')](_0x5ec116[_0xe277('0x2d')][_0xe277('0x1a')]);}_0x29eec7[_0xe277('0x35')]=qs['sort'](_0x5ec116['query'][_0xe277('0x36')]);_0x29eec7[_0xe277('0x37')]=qs['filters'](_[_0xe277('0x38')](_0x5ec116['query'],_0x1b2dc7[_0xe277('0x2e')]),_0x819fdf);if(_0x5ec116[_0xe277('0x2d')][_0xe277('0x39')]){_0x29eec7['where']=_['merge'](_0x29eec7[_0xe277('0x37')],{'$or':_[_0xe277('0x29')](_0x819fdf,function(_0x24e6e7){if(_0x24e6e7[_0xe277('0x2a')]!=='VIRTUAL'){var _0x580614={};_0x580614[_0x24e6e7[_0xe277('0x27')]]={'$like':'%'+_0x5ec116['query'][_0xe277('0x39')]+'%'};return _0x580614;}})});}_0x29eec7=_[_0xe277('0x3a')]({},_0x29eec7,_0x5ec116[_0xe277('0x3b')]);var _0x267610={'where':_0x29eec7['where']};return db[_0xe277('0x3c')][_0xe277('0x1d')](_0x267610)[_0xe277('0x24')](function(_0x50e0fd){_0x5ea14a[_0xe277('0x1d')]=_0x50e0fd;if(_0x5ec116['query'][_0xe277('0x3d')]){_0x29eec7[_0xe277('0x3e')]=[{'all':!![]}];}return db[_0xe277('0x3c')][_0xe277('0x3f')](_0x29eec7);})['then'](function(_0x29b033){_0x5ea14a[_0xe277('0x40')]=_0x29b033;return _0x5ea14a;})[_0xe277('0x24')](respondWithFilteredResult(_0x171128,_0x29eec7))[_0xe277('0x41')](handleError(_0x171128,null));};exports['show']=function(_0x331b0c,_0x37c359){var _0x523fcb={'raw':!![],'where':{'id':_0x331b0c['params']['id']}},_0x40b019={};_0x40b019[_0xe277('0x2c')]=_['keys'](db[_0xe277('0x3c')][_0xe277('0x42')]);_0x40b019[_0xe277('0x2d')]=_['keys'](_0x331b0c[_0xe277('0x2d')]);_0x40b019[_0xe277('0x2e')]=_[_0xe277('0x2f')](_0x40b019[_0xe277('0x2c')],_0x40b019[_0xe277('0x2d')]);_0x523fcb[_0xe277('0x31')]=_[_0xe277('0x2f')](_0x40b019[_0xe277('0x2c')],qs[_0xe277('0x30')](_0x331b0c[_0xe277('0x2d')]['fields']));_0x523fcb[_0xe277('0x31')]=_0x523fcb[_0xe277('0x31')][_0xe277('0x32')]?_0x523fcb[_0xe277('0x31')]:_0x40b019[_0xe277('0x2c')];if(_0x331b0c['query'][_0xe277('0x3d')]){_0x523fcb[_0xe277('0x3e')]=[{'all':!![]}];}_0x523fcb=_[_0xe277('0x3a')]({},_0x523fcb,_0x331b0c[_0xe277('0x3b')]);return db[_0xe277('0x3c')][_0xe277('0x43')](_0x523fcb)[_0xe277('0x24')](handleEntityNotFound(_0x37c359,null))[_0xe277('0x24')](respondWithResult(_0x37c359,null))[_0xe277('0x41')](handleError(_0x37c359,null));};exports[_0xe277('0x44')]=function(_0x5864d7,_0x2e3c91){return db[_0xe277('0x3c')][_0xe277('0x44')](_0x5864d7[_0xe277('0x45')],{})[_0xe277('0x24')](respondWithResult(_0x2e3c91,0xc9))[_0xe277('0x41')](handleError(_0x2e3c91,null));};exports[_0xe277('0x23')]=function(_0x2b3975,_0x232262){if(_0x2b3975[_0xe277('0x45')]['id']){delete _0x2b3975[_0xe277('0x45')]['id'];}return db[_0xe277('0x3c')][_0xe277('0x43')]({'where':{'id':_0x2b3975[_0xe277('0x46')]['id']}})['then'](handleEntityNotFound(_0x232262,null))[_0xe277('0x24')](saveUpdates(_0x2b3975[_0xe277('0x45')],null))['then'](respondWithResult(_0x232262,null))[_0xe277('0x41')](handleError(_0x232262,null));};exports[_0xe277('0x47')]=function(_0x17250c,_0x42e151,_0x2ae38b){var _0x175861=require(_0xe277('0x48'));var _0x59c59f=![];var _0x2926c6={};if(_0x17250c[_0xe277('0x2d')][_0xe277('0x2a')]&&_0x17250c[_0xe277('0x2d')][_0xe277('0x2a')]===_0xe277('0x49')){_0x2926c6[_0xe277('0x49')]=_0x17250c[_0xe277('0x46')]['id'];}else{_0x2926c6['id']=_0x17250c[_0xe277('0x46')]['id'];}return db[_0xe277('0x3c')]['find']({'where':_0x2926c6,'attributes':['id',_0xe277('0x4a'),_0xe277('0x4b')],'raw':!![]})[_0xe277('0x24')](handleEntityNotFound(_0x42e151,null))[_0xe277('0x24')](function(_0x149e56){if(_0x149e56){var _0x2055a1=_0x149e56[_0xe277('0x4a')];var _0x276dd7=util[_0xe277('0x4c')]('%s.cypher',_0x2055a1);if(fs[_0xe277('0x4d')](_0x276dd7)){_0x59c59f=!![];return _0x175861[_0xe277('0x4e')](_0x276dd7,_0x2055a1,config[_0xe277('0x4f')][_0xe277('0x50')])[_0xe277('0x24')](function(){return _0x149e56;});}return _0x149e56;}})['then'](function(_0x4129fa){if(_0x4129fa){var _0x2152fc=_0x4129fa[_0xe277('0x4a')];if(!fs[_0xe277('0x4d')](_0x2152fc)){throw new db[(_0xe277('0x51'))][(_0xe277('0x52'))](_0xe277('0x53'));}if(_0x4129fa[_0xe277('0x4b')]){return _0x42e151[_0xe277('0x47')](_0x2152fc,_0x4129fa[_0xe277('0x4b')]+path[_0xe277('0x54')](_0x2152fc),function(){if(_0x59c59f){fs['unlink'](_0x2152fc);}});}else{return _0x42e151[_0xe277('0x47')](_0x2152fc,function(_0x250e59){if(_0x59c59f){fs[_0xe277('0x55')](_0x2152fc);}});}}})['catch'](function(_0x4fd8df){if(_0x4fd8df[_0xe277('0x56')]===_0xe277('0x53')){_0x42e151[_0xe277('0x1e')](0x194)[_0xe277('0x57')](_0xe277('0x58'));}else{return handleError(_0x42e151,null);}});};exports[_0xe277('0x25')]=function(_0x373be4,_0x3e9315){return db[_0xe277('0x3c')][_0xe277('0x43')]({'where':{'id':_0x373be4['params']['id']}})[_0xe277('0x24')](function(_0x5a0d4a){if(_[_0xe277('0x59')](_0x5a0d4a)){throw new ReferenceError('Entity\x20not\x20found');}return _0x5a0d4a;})['then'](function(_0x2571cd){var _0x33f2f2=_0x2571cd[_0xe277('0x4a')];logger[_0xe277('0x5a')]('cancellazione\x20fisica\x20documento\x20%s',_0x33f2f2);if(!_[_0xe277('0x59')](_0x2571cd[_0xe277('0x4a')])&&fs['existsSync'](_0x33f2f2)){logger[_0xe277('0x5a')](_0xe277('0x5b')+_0x33f2f2+_0xe277('0x5c'));fs[_0xe277('0x5d')](_0x33f2f2);}_0x33f2f2=_0x33f2f2+_0xe277('0x5e');if(!_[_0xe277('0x59')](_0x2571cd[_0xe277('0x4a')])&&fs[_0xe277('0x4d')](_0x33f2f2)){logger[_0xe277('0x5a')](_0xe277('0x5b')+_0x33f2f2+_0xe277('0x5c'));fs['unlinkSync'](_0x33f2f2);}return _0x2571cd;})[_0xe277('0x24')](function(_0x3b372c){if(!_0x3b372c)throw new InternalError();return _0x3b372c[_0xe277('0x25')]();})[_0xe277('0x24')](function(){_0x3e9315['status'](0xcc)[_0xe277('0x18')]();})[_0xe277('0x41')](handleError(_0x3e9315,null));}; \ No newline at end of file +var _0x18cb=['message','Not\x20found','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','destroy','eml-format','fast-json-patch','request-promise','mustache','util','path','sox','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','json','apply','reject','save','then','stack','name','send','index','map','SquareRecording','fieldName','query','intersection','model','attributes','fields','hasOwnProperty','nolimit','limit','sort','where','pick','filters','filter','merge','type','VIRTUAL','options','includeAll','include','catch','show','params','keys','rawAttributes','length','create','update','body','find','download','../../components/encryptor','uniqueid','savePath','format','%s.cypher','existsSync','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','filename','extname','unlink'];(function(_0x33681b,_0x5d8620){var _0x8c62c5=function(_0x3db0a7){while(--_0x3db0a7){_0x33681b['push'](_0x33681b['shift']());}};_0x8c62c5(++_0x5d8620);}(_0x18cb,0x67));var _0xb18c=function(_0x1cafbe,_0x32e34a){_0x1cafbe=_0x1cafbe-0x0;var _0x46fd18=_0x18cb[_0x1cafbe];return _0x46fd18;};'use strict';var emlformat=require(_0xb18c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb18c('0x1'));var rp=require(_0xb18c('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb18c('0x3'));var util=require(_0xb18c('0x4'));var path=require(_0xb18c('0x5'));var sox=require(_0xb18c('0x6'));var csv=require('to-csv');var ejs=require(_0xb18c('0x7'));var fs=require('fs');var fs_extra=require(_0xb18c('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xb18c('0x9'));var jsforce=require(_0xb18c('0xa'));var deskjs=require(_0xb18c('0xb'));var toCsv=require('to-csv');var querystring=require(_0xb18c('0xc'));var Papa=require(_0xb18c('0xd'));var Redis=require(_0xb18c('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xb18c('0xf'));var as=require(_0xb18c('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb18c('0x11'))(_0xb18c('0x12'));var utils=require('../../config/utils');var config=require(_0xb18c('0x13'));var licenseUtil=require(_0xb18c('0x14'));var db=require(_0xb18c('0x15'))['db'];function respondWithStatusCode(_0x1445c5,_0x2afb35){_0x2afb35=_0x2afb35||0xcc;return function(_0x432cab){if(_0x432cab){return _0x1445c5[_0xb18c('0x16')](_0x2afb35);}return _0x1445c5[_0xb18c('0x17')](_0x2afb35)[_0xb18c('0x18')]();};}function respondWithResult(_0x45eb70,_0x4eaadf){_0x4eaadf=_0x4eaadf||0xc8;return function(_0x351af8){if(_0x351af8){return _0x45eb70[_0xb18c('0x17')](_0x4eaadf)['json'](_0x351af8);}};}function respondWithFilteredResult(_0x5010fc,_0x221855){return function(_0x44e7e4){if(_0x44e7e4){var _0x441023=typeof _0x221855[_0xb18c('0x19')]==='undefined'&&typeof _0x221855['limit']===_0xb18c('0x1a');var _0x1b610e=_0x44e7e4[_0xb18c('0x1b')];var _0x13fc63=_0x441023?0x0:_0x221855[_0xb18c('0x19')];var _0xe7d0f9=_0x441023?_0x44e7e4[_0xb18c('0x1b')]:_0x221855[_0xb18c('0x19')]+_0x221855['limit'];var _0x2b4094;if(_0xe7d0f9>=_0x1b610e){_0xe7d0f9=_0x1b610e;_0x2b4094=0xc8;}else{_0x2b4094=0xce;}_0x5010fc[_0xb18c('0x17')](_0x2b4094);return _0x5010fc['set']('Content-Range',_0x13fc63+'-'+_0xe7d0f9+'/'+_0x1b610e)[_0xb18c('0x1c')](_0x44e7e4);}return null;};}function patchUpdates(_0x3fcdbe){return function(_0x5bc223){try{jsonpatch[_0xb18c('0x1d')](_0x5bc223,_0x3fcdbe,!![]);}catch(_0x556e82){return BPromise[_0xb18c('0x1e')](_0x556e82);}return _0x5bc223[_0xb18c('0x1f')]();};}function saveUpdates(_0x5f2f02,_0xe1e944){return function(_0x41852a){if(_0x41852a){return _0x41852a['update'](_0x5f2f02)[_0xb18c('0x20')](function(_0x512d09){return _0x512d09;});}return null;};}function removeEntity(_0x49f536,_0x19ce27){return function(_0x458a00){if(_0x458a00){return _0x458a00['destroy']()[_0xb18c('0x20')](function(){_0x49f536['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3478df,_0x1ab937){return function(_0x4952c5){if(!_0x4952c5){_0x3478df[_0xb18c('0x16')](0x194);}return _0x4952c5;};}function handleError(_0x5b5bdf,_0x43334d){_0x43334d=_0x43334d||0x1f4;return function(_0x33c749){logger['error'](_0x33c749[_0xb18c('0x21')]);if(_0x33c749[_0xb18c('0x22')]){delete _0x33c749[_0xb18c('0x22')];}_0x5b5bdf[_0xb18c('0x17')](_0x43334d)[_0xb18c('0x23')](_0x33c749);};}exports[_0xb18c('0x24')]=function(_0x20e09f,_0x32830d){var _0x26fe6f={},_0x5966e9={},_0x15a512={'count':0x0,'rows':[]};var _0x3be7e8=_[_0xb18c('0x25')](db[_0xb18c('0x26')]['rawAttributes'],function(_0x268331){return{'name':_0x268331[_0xb18c('0x27')],'type':_0x268331['type']['key']};});_0x5966e9['model']=_[_0xb18c('0x25')](_0x3be7e8,'name');_0x5966e9[_0xb18c('0x28')]=_['keys'](_0x20e09f[_0xb18c('0x28')]);_0x5966e9['filters']=_[_0xb18c('0x29')](_0x5966e9[_0xb18c('0x2a')],_0x5966e9[_0xb18c('0x28')]);_0x26fe6f[_0xb18c('0x2b')]=_['intersection'](_0x5966e9[_0xb18c('0x2a')],qs[_0xb18c('0x2c')](_0x20e09f[_0xb18c('0x28')][_0xb18c('0x2c')]));_0x26fe6f[_0xb18c('0x2b')]=_0x26fe6f['attributes']['length']?_0x26fe6f[_0xb18c('0x2b')]:_0x5966e9[_0xb18c('0x2a')];if(!_0x20e09f[_0xb18c('0x28')][_0xb18c('0x2d')](_0xb18c('0x2e'))){_0x26fe6f[_0xb18c('0x2f')]=qs[_0xb18c('0x2f')](_0x20e09f[_0xb18c('0x28')]['limit']);_0x26fe6f[_0xb18c('0x19')]=qs[_0xb18c('0x19')](_0x20e09f[_0xb18c('0x28')]['offset']);}_0x26fe6f['order']=qs[_0xb18c('0x30')](_0x20e09f[_0xb18c('0x28')][_0xb18c('0x30')]);_0x26fe6f[_0xb18c('0x31')]=qs['filters'](_[_0xb18c('0x32')](_0x20e09f[_0xb18c('0x28')],_0x5966e9[_0xb18c('0x33')]),_0x3be7e8);if(_0x20e09f[_0xb18c('0x28')][_0xb18c('0x34')]){_0x26fe6f[_0xb18c('0x31')]=_[_0xb18c('0x35')](_0x26fe6f[_0xb18c('0x31')],{'$or':_[_0xb18c('0x25')](_0x3be7e8,function(_0x2aae24){if(_0x2aae24[_0xb18c('0x36')]!==_0xb18c('0x37')){var _0x1f6d0e={};_0x1f6d0e[_0x2aae24[_0xb18c('0x22')]]={'$like':'%'+_0x20e09f[_0xb18c('0x28')]['filter']+'%'};return _0x1f6d0e;}})});}_0x26fe6f=_['merge']({},_0x26fe6f,_0x20e09f[_0xb18c('0x38')]);var _0x2e2f84={'where':_0x26fe6f[_0xb18c('0x31')]};return db[_0xb18c('0x26')]['count'](_0x2e2f84)[_0xb18c('0x20')](function(_0x554a32){_0x15a512['count']=_0x554a32;if(_0x20e09f[_0xb18c('0x28')][_0xb18c('0x39')]){_0x26fe6f[_0xb18c('0x3a')]=[{'all':!![]}];}return db[_0xb18c('0x26')]['findAll'](_0x26fe6f);})[_0xb18c('0x20')](function(_0x17e35e){_0x15a512['rows']=_0x17e35e;return _0x15a512;})[_0xb18c('0x20')](respondWithFilteredResult(_0x32830d,_0x26fe6f))[_0xb18c('0x3b')](handleError(_0x32830d,null));};exports[_0xb18c('0x3c')]=function(_0x130db3,_0x23b0f7){var _0x3f0130={'raw':!![],'where':{'id':_0x130db3[_0xb18c('0x3d')]['id']}},_0x59ceb2={};_0x59ceb2[_0xb18c('0x2a')]=_[_0xb18c('0x3e')](db['SquareRecording'][_0xb18c('0x3f')]);_0x59ceb2['query']=_[_0xb18c('0x3e')](_0x130db3['query']);_0x59ceb2[_0xb18c('0x33')]=_[_0xb18c('0x29')](_0x59ceb2[_0xb18c('0x2a')],_0x59ceb2['query']);_0x3f0130['attributes']=_[_0xb18c('0x29')](_0x59ceb2[_0xb18c('0x2a')],qs[_0xb18c('0x2c')](_0x130db3['query'][_0xb18c('0x2c')]));_0x3f0130[_0xb18c('0x2b')]=_0x3f0130[_0xb18c('0x2b')][_0xb18c('0x40')]?_0x3f0130[_0xb18c('0x2b')]:_0x59ceb2[_0xb18c('0x2a')];if(_0x130db3[_0xb18c('0x28')][_0xb18c('0x39')]){_0x3f0130[_0xb18c('0x3a')]=[{'all':!![]}];}_0x3f0130=_[_0xb18c('0x35')]({},_0x3f0130,_0x130db3[_0xb18c('0x38')]);return db[_0xb18c('0x26')]['find'](_0x3f0130)[_0xb18c('0x20')](handleEntityNotFound(_0x23b0f7,null))[_0xb18c('0x20')](respondWithResult(_0x23b0f7,null))[_0xb18c('0x3b')](handleError(_0x23b0f7,null));};exports[_0xb18c('0x41')]=function(_0x36cfcc,_0x67aff4){return db['SquareRecording'][_0xb18c('0x41')](_0x36cfcc['body'],{})['then'](respondWithResult(_0x67aff4,0xc9))[_0xb18c('0x3b')](handleError(_0x67aff4,null));};exports[_0xb18c('0x42')]=function(_0xb55c43,_0x4f3aeb){if(_0xb55c43[_0xb18c('0x43')]['id']){delete _0xb55c43[_0xb18c('0x43')]['id'];}return db['SquareRecording'][_0xb18c('0x44')]({'where':{'id':_0xb55c43[_0xb18c('0x3d')]['id']}})[_0xb18c('0x20')](handleEntityNotFound(_0x4f3aeb,null))[_0xb18c('0x20')](saveUpdates(_0xb55c43[_0xb18c('0x43')],null))['then'](respondWithResult(_0x4f3aeb,null))[_0xb18c('0x3b')](handleError(_0x4f3aeb,null));};exports[_0xb18c('0x45')]=function(_0x241f1e,_0x37ab5f,_0x42c9ed){var _0x3da0e9=require(_0xb18c('0x46'));var _0x266e03=![];var _0x4deaa5={};if(_0x241f1e['query']['type']&&_0x241f1e[_0xb18c('0x28')][_0xb18c('0x36')]===_0xb18c('0x47')){_0x4deaa5['uniqueid']=_0x241f1e['params']['id'];}else{_0x4deaa5['id']=_0x241f1e[_0xb18c('0x3d')]['id'];}return db[_0xb18c('0x26')][_0xb18c('0x44')]({'where':_0x4deaa5,'attributes':['id',_0xb18c('0x48'),'filename'],'raw':!![]})['then'](handleEntityNotFound(_0x37ab5f,null))[_0xb18c('0x20')](function(_0x544c91){if(_0x544c91){var _0x48d73c=_0x544c91[_0xb18c('0x48')];var _0x34792a=util[_0xb18c('0x49')](_0xb18c('0x4a'),_0x48d73c);if(fs[_0xb18c('0x4b')](_0x34792a)){_0x266e03=!![];return _0x3da0e9['decryptFile'](_0x34792a,_0x48d73c,config['secrets'][_0xb18c('0x4c')])[_0xb18c('0x20')](function(){return _0x544c91;});}return _0x544c91;}})[_0xb18c('0x20')](function(_0x52ef47){if(_0x52ef47){var _0x703fac=_0x52ef47[_0xb18c('0x48')];if(!fs[_0xb18c('0x4b')](_0x703fac)){throw new db[(_0xb18c('0x4d'))][(_0xb18c('0x4e'))](_0xb18c('0x4f'));}if(_0x52ef47['filename']){return _0x37ab5f[_0xb18c('0x45')](_0x703fac,_0x52ef47[_0xb18c('0x50')]+path[_0xb18c('0x51')](_0x703fac),function(){if(_0x266e03){fs[_0xb18c('0x52')](_0x703fac);}});}else{return _0x37ab5f[_0xb18c('0x45')](_0x703fac,function(_0x55bd9a){if(_0x266e03){fs[_0xb18c('0x52')](_0x703fac);}});}}})[_0xb18c('0x3b')](function(_0x58d0cd){if(_0x58d0cd[_0xb18c('0x53')]===_0xb18c('0x4f')){_0x37ab5f[_0xb18c('0x17')](0x194)[_0xb18c('0x23')](_0xb18c('0x54'));}else{return handleError(_0x37ab5f,null);}});};exports['destroy']=function(_0x4840f8,_0x1b8262){return db[_0xb18c('0x26')]['find']({'where':{'id':_0x4840f8[_0xb18c('0x3d')]['id']}})[_0xb18c('0x20')](function(_0x3bc92a){if(_['isNil'](_0x3bc92a)){throw new ReferenceError(_0xb18c('0x55'));}return _0x3bc92a;})[_0xb18c('0x20')](function(_0x1a43f8){var _0x2d9e4b=_0x1a43f8['savePath'];logger[_0xb18c('0x56')](_0xb18c('0x57'),_0x2d9e4b);if(!_['isNil'](_0x1a43f8[_0xb18c('0x48')])&&fs[_0xb18c('0x4b')](_0x2d9e4b)){logger[_0xb18c('0x56')](_0xb18c('0x58')+_0x2d9e4b+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xb18c('0x59')](_0x2d9e4b);}_0x2d9e4b=_0x2d9e4b+_0xb18c('0x5a');if(!_['isNil'](_0x1a43f8[_0xb18c('0x48')])&&fs[_0xb18c('0x4b')](_0x2d9e4b)){logger[_0xb18c('0x56')](_0xb18c('0x58')+_0x2d9e4b+_0xb18c('0x5b'));fs[_0xb18c('0x59')](_0x2d9e4b);}return _0x1a43f8;})[_0xb18c('0x20')](function(_0x5f3d46){if(!_0x5f3d46)throw new InternalError();return _0x5f3d46[_0xb18c('0x5c')]();})[_0xb18c('0x20')](function(){_0x1b8262[_0xb18c('0x17')](0xcc)['end']();})[_0xb18c('0x3b')](handleError(_0x1b8262,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index cdec6a9..a18031c 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 _0x5b47=['lodash','util','path','rimraf','../../config/environment','./squareRecording.attributes','exports','SquareRecording'];(function(_0x5611f5,_0x174d69){var _0x48c8bb=function(_0x309145){while(--_0x309145){_0x5611f5['push'](_0x5611f5['shift']());}};_0x48c8bb(++_0x174d69);}(_0x5b47,0x120));var _0x75b4=function(_0x1f0f9e,_0x310952){_0x1f0f9e=_0x1f0f9e-0x0;var _0x6321a8=_0x5b47[_0x1f0f9e];return _0x6321a8;};'use strict';var _=require(_0x75b4('0x0'));var util=require(_0x75b4('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x75b4('0x2'));var rimraf=require(_0x75b4('0x3'));var config=require(_0x75b4('0x4'));var attributes=require(_0x75b4('0x5'));module[_0x75b4('0x6')]=function(_0x5f544a,_0x5ee223){return _0x5f544a['define'](_0x75b4('0x7'),attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0f97=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareRecording.attributes','define','SquareRecording','square_recordings'];(function(_0x4de877,_0x340170){var _0xb2cfeb=function(_0x488634){while(--_0x488634){_0x4de877['push'](_0x4de877['shift']());}};_0xb2cfeb(++_0x340170);}(_0x0f97,0x196));var _0x70f9=function(_0x4c075b,_0x56c2e7){_0x4c075b=_0x4c075b-0x0;var _0x228448=_0x0f97[_0x4c075b];return _0x228448;};'use strict';var _=require(_0x70f9('0x0'));var util=require(_0x70f9('0x1'));var logger=require(_0x70f9('0x2'))(_0x70f9('0x3'));var moment=require(_0x70f9('0x4'));var BPromise=require(_0x70f9('0x5'));var rp=require(_0x70f9('0x6'));var fs=require('fs');var path=require(_0x70f9('0x7'));var rimraf=require(_0x70f9('0x8'));var config=require(_0x70f9('0x9'));var attributes=require(_0x70f9('0xa'));module['exports']=function(_0x4dafa5,_0x37d6a7){return _0x4dafa5[_0x70f9('0xb')](_0x70f9('0xc'),attributes,{'tableName':_0x70f9('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index d1b3479..1fbd4c8 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 _0xfeab=['stringify','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','error','message','result','CreateSquareRecording','SquareRecording','create','body','options'];(function(_0x20c893,_0xbef2b4){var _0xc705e8=function(_0x449739){while(--_0x449739){_0x20c893['push'](_0x20c893['shift']());}};_0xc705e8(++_0xbef2b4);}(_0xfeab,0xfc));var _0xbfea=function(_0x4e0bb3,_0x10d147){_0x4e0bb3=_0x4e0bb3-0x0;var _0x598028=_0xfeab[_0x4e0bb3];return _0x598028;};'use strict';var _=require(_0xbfea('0x0'));var util=require('util');var moment=require(_0xbfea('0x1'));var BPromise=require(_0xbfea('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbfea('0x3'));var db=require(_0xbfea('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xbfea('0x5'))(_0xbfea('0x6'));var config=require(_0xbfea('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xbfea('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x173790,_0x3b6317,_0xc42b10){return new BPromise(function(_0x44730c,_0x56f651){return client['request'](_0x173790,_0xc42b10)[_0xbfea('0x9')](function(_0x6041d7){logger[_0xbfea('0xa')](_0xbfea('0xb'),_0x3b6317,_0xbfea('0xc'));logger[_0xbfea('0xd')](_0xbfea('0xe'),_0x3b6317,_0xbfea('0xc'),JSON['stringify'](_0x6041d7));if(_0x6041d7['error']){if(_0x6041d7[_0xbfea('0xf')]['code']===0x1f4){logger[_0xbfea('0xf')](_0xbfea('0xb'),_0x3b6317,_0x6041d7[_0xbfea('0xf')]['message']);return _0x56f651(_0x6041d7[_0xbfea('0xf')][_0xbfea('0x10')]);}logger[_0xbfea('0xf')](_0xbfea('0xb'),_0x3b6317,_0x6041d7[_0xbfea('0xf')][_0xbfea('0x10')]);return _0x44730c(_0x6041d7[_0xbfea('0xf')][_0xbfea('0x10')]);}else{logger[_0xbfea('0xa')](_0xbfea('0xb'),_0x3b6317,'request\x20sent');_0x44730c(_0x6041d7[_0xbfea('0x11')][_0xbfea('0x10')]);}})['catch'](function(_0x5c816a){logger['error'](_0xbfea('0xb'),_0x3b6317,_0x5c816a);_0x56f651(_0x5c816a);});});}exports[_0xbfea('0x12')]=function(_0x761036){var _0x1890e0=this;return new Promise(function(_0x404e4a,_0x2c4778){return db[_0xbfea('0x13')][_0xbfea('0x14')](_0x761036[_0xbfea('0x15')],{'raw':_0x761036[_0xbfea('0x16')]?_0x761036[_0xbfea('0x16')]['raw']===undefined?!![]:![]:!![]})[_0xbfea('0x9')](function(_0x6e7f54){logger[_0xbfea('0xa')]('CreateSquareRecording',_0x761036);logger[_0xbfea('0xd')](_0xbfea('0x12'),_0x761036,JSON[_0xbfea('0x17')](_0x6e7f54));_0x404e4a(_0x6e7f54);})[_0xbfea('0x18')](function(_0x1de7f8){logger['error']('CreateSquareRecording',_0x1de7f8[_0xbfea('0x10')],_0x761036);_0x2c4778(_0x1890e0[_0xbfea('0xf')](0x1f4,_0x1de7f8[_0xbfea('0x10')]));});});}; \ No newline at end of file +var _0x51fe=['rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug','stringify','error','code','SquareRecording,\x20%s,\x20%s','message','info','result','catch','SquareRecording','create','body','options','raw','CreateSquareRecording','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x4b8d4a,_0x2916e1){var _0x2e1196=function(_0x2ca319){while(--_0x2ca319){_0x4b8d4a['push'](_0x4b8d4a['shift']());}};_0x2e1196(++_0x2916e1);}(_0x51fe,0x11a));var _0xe51f=function(_0x40b23e,_0xc6d07c){_0x40b23e=_0x40b23e-0x0;var _0x4ffc93=_0x51fe[_0x40b23e];return _0x4ffc93;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe51f('0x0'));var fs=require('fs');var Redis=require(_0xe51f('0x1'));var db=require(_0xe51f('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xe51f('0x3'))(_0xe51f('0x4'));var config=require(_0xe51f('0x5'));var jayson=require(_0xe51f('0x6'));var client=jayson['client'][_0xe51f('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x131824,_0xe0b630,_0x20159e){return new BPromise(function(_0x29b4aa,_0x5e9974){return client[_0xe51f('0x8')](_0x131824,_0x20159e)[_0xe51f('0x9')](function(_0x15571c){logger['info']('SquareRecording,\x20%s,\x20%s',_0xe0b630,_0xe51f('0xa'));logger[_0xe51f('0xb')]('SquareRecording,\x20%s,\x20%s,\x20%s',_0xe0b630,'request\x20sent',JSON[_0xe51f('0xc')](_0x15571c));if(_0x15571c[_0xe51f('0xd')]){if(_0x15571c[_0xe51f('0xd')][_0xe51f('0xe')]===0x1f4){logger[_0xe51f('0xd')](_0xe51f('0xf'),_0xe0b630,_0x15571c['error'][_0xe51f('0x10')]);return _0x5e9974(_0x15571c[_0xe51f('0xd')][_0xe51f('0x10')]);}logger[_0xe51f('0xd')](_0xe51f('0xf'),_0xe0b630,_0x15571c[_0xe51f('0xd')]['message']);return _0x29b4aa(_0x15571c[_0xe51f('0xd')]['message']);}else{logger[_0xe51f('0x11')](_0xe51f('0xf'),_0xe0b630,_0xe51f('0xa'));_0x29b4aa(_0x15571c[_0xe51f('0x12')][_0xe51f('0x10')]);}})[_0xe51f('0x13')](function(_0x7ea942){logger[_0xe51f('0xd')](_0xe51f('0xf'),_0xe0b630,_0x7ea942);_0x5e9974(_0x7ea942);});});}exports['CreateSquareRecording']=function(_0x413b8c){var _0x48460d=this;return new Promise(function(_0x28abc4,_0xab20ea){return db[_0xe51f('0x14')][_0xe51f('0x15')](_0x413b8c[_0xe51f('0x16')],{'raw':_0x413b8c[_0xe51f('0x17')]?_0x413b8c[_0xe51f('0x17')][_0xe51f('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0xcfc905){logger[_0xe51f('0x11')](_0xe51f('0x19'),_0x413b8c);logger[_0xe51f('0xb')](_0xe51f('0x19'),_0x413b8c,JSON['stringify'](_0xcfc905));_0x28abc4(_0xcfc905);})[_0xe51f('0x13')](function(_0x2aa287){logger['error']('CreateSquareRecording',_0x2aa287[_0xe51f('0x10')],_0x413b8c);_0xab20ea(_0x48460d[_0xe51f('0xd')](0x1f4,_0x2aa287[_0xe51f('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index de12cef..9e7f703 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 _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(_0x559ff5,_0x389fda){var _0x51483e=function(_0x1ce5f3){while(--_0x1ce5f3){_0x559ff5['push'](_0x559ff5['shift']());}};_0x51483e(++_0x389fda);}(_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('./squareReport.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 _0xb10b=['../../components/interaction/service','../../config/environment','./squareReport.controller','get','index','isAuthenticated','describe','/:id','show','post','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x1f2b58,_0x211f19){var _0x26bbe5=function(_0x23d9ce){while(--_0x23d9ce){_0x1f2b58['push'](_0x1f2b58['shift']());}};_0x26bbe5(++_0x211f19);}(_0xb10b,0x12a));var _0xbb10=function(_0x25875c,_0xc144a9){_0x25875c=_0x25875c-0x0;var _0x48a9e6=_0xb10b[_0x25875c];return _0x48a9e6;};'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')]('/describe',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')]('/',auth[_0xbb10('0xb')](),controller['create']);router['put'](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x10')]);router['delete'](_0xbb10('0xd'),auth['isAuthenticated'](),controller[_0xbb10('0x11')]);module[_0xbb10('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 7639ec3..43383e7 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 _0xe50b=['exports','STRING','DATE','BOOLEAN'];(function(_0x3842fe,_0xccf37b){var _0x50fa99=function(_0x5e74a6){while(--_0x5e74a6){_0x3842fe['push'](_0x3842fe['shift']());}};_0x50fa99(++_0xccf37b);}(_0xe50b,0x1c8));var _0xbe50=function(_0x482cc7,_0x3a9093){_0x482cc7=_0x482cc7-0x0;var _0x3911ce=_0xe50b[_0x482cc7];return _0x3911ce;};'use strict';var Sequelize=require('sequelize');module[_0xbe50('0x0')]={'network':{'type':Sequelize[_0xbe50('0x1')]},'network_script':{'type':Sequelize[_0xbe50('0x1')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xbe50('0x1')]},'language':{'type':Sequelize[_0xbe50('0x1')]},'type':{'type':Sequelize[_0xbe50('0x1')]},'uniqueid':{'type':Sequelize[_0xbe50('0x1')]},'version':{'type':Sequelize[_0xbe50('0x1')]},'callerid':{'type':Sequelize[_0xbe50('0x1')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0xbe50('0x1')]},'callingani2':{'type':Sequelize[_0xbe50('0x1')]},'callington':{'type':Sequelize[_0xbe50('0x1')]},'callingtns':{'type':Sequelize[_0xbe50('0x1')]},'dnid':{'type':Sequelize[_0xbe50('0x1')]},'rdnis':{'type':Sequelize[_0xbe50('0x1')]},'context':{'type':Sequelize[_0xbe50('0x1')]},'extension':{'type':Sequelize[_0xbe50('0x1')]},'priority':{'type':Sequelize[_0xbe50('0x1')]},'enhanced':{'type':Sequelize[_0xbe50('0x1')]},'accountcode':{'type':Sequelize[_0xbe50('0x1')]},'threadid':{'type':Sequelize[_0xbe50('0x1')]},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xbe50('0x2')]},'leaveAt':{'type':Sequelize[_0xbe50('0x2')]},'bot':{'type':Sequelize[_0xbe50('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x5a47=['STRING','DATE','BOOLEAN','sequelize','exports'];(function(_0x32da3f,_0x11ff13){var _0x5c0353=function(_0x24e44d){while(--_0x24e44d){_0x32da3f['push'](_0x32da3f['shift']());}};_0x5c0353(++_0x11ff13);}(_0x5a47,0x152));var _0x75a4=function(_0x63b00e,_0x54ef74){_0x63b00e=_0x63b00e-0x0;var _0x206754=_0x5a47[_0x63b00e];return _0x206754;};'use strict';var Sequelize=require(_0x75a4('0x0'));module[_0x75a4('0x1')]={'network':{'type':Sequelize[_0x75a4('0x2')]},'network_script':{'type':Sequelize[_0x75a4('0x2')]},'request':{'type':Sequelize[_0x75a4('0x2')]},'channel':{'type':Sequelize[_0x75a4('0x2')]},'language':{'type':Sequelize[_0x75a4('0x2')]},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x75a4('0x2')]},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x75a4('0x2')]},'calleridname':{'type':Sequelize[_0x75a4('0x2')]},'callingpres':{'type':Sequelize[_0x75a4('0x2')]},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize[_0x75a4('0x2')]},'callingtns':{'type':Sequelize[_0x75a4('0x2')]},'dnid':{'type':Sequelize[_0x75a4('0x2')]},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x75a4('0x2')]},'extension':{'type':Sequelize[_0x75a4('0x2')]},'priority':{'type':Sequelize[_0x75a4('0x2')]},'enhanced':{'type':Sequelize[_0x75a4('0x2')]},'accountcode':{'type':Sequelize[_0x75a4('0x2')]},'threadid':{'type':Sequelize[_0x75a4('0x2')]},'project_name':{'type':Sequelize[_0x75a4('0x2')]},'joinAt':{'type':Sequelize[_0x75a4('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0x75a4('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 4d4ffb2..b90c5ef 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 _0x45c5=['../../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','then','error','stack','name','send','index','map','SquareReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','filters','length','find','create','body','update','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs'];(function(_0x2fb628,_0x3e88e6){var _0x46d03f=function(_0x496b9b){while(--_0x496b9b){_0x2fb628['push'](_0x2fb628['shift']());}};_0x46d03f(++_0x3e88e6);}(_0x45c5,0x11b));var _0x545c=function(_0x482b63,_0xc56cc7){_0x482b63=_0x482b63-0x0;var _0x1b5656=_0x45c5[_0x482b63];return _0x1b5656;};'use strict';var emlformat=require(_0x545c('0x0'));var rimraf=require(_0x545c('0x1'));var zipdir=require(_0x545c('0x2'));var jsonpatch=require(_0x545c('0x3'));var rp=require(_0x545c('0x4'));var moment=require(_0x545c('0x5'));var BPromise=require(_0x545c('0x6'));var Mustache=require('mustache');var util=require(_0x545c('0x7'));var path=require(_0x545c('0x8'));var sox=require(_0x545c('0x9'));var csv=require(_0x545c('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x545c('0xb'));var squel=require('squel');var crypto=require(_0x545c('0xc'));var jsforce=require(_0x545c('0xd'));var deskjs=require(_0x545c('0xe'));var toCsv=require(_0x545c('0xa'));var querystring=require('querystring');var Papa=require(_0x545c('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x545c('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x545c('0x11'));var logger=require(_0x545c('0x12'))(_0x545c('0x13'));var utils=require(_0x545c('0x14'));var config=require(_0x545c('0x15'));var licenseUtil=require(_0x545c('0x16'));var db=require(_0x545c('0x17'))['db'];function respondWithStatusCode(_0x5047b0,_0x5bd62e){_0x5bd62e=_0x5bd62e||0xcc;return function(_0x4ce08a){if(_0x4ce08a){return _0x5047b0[_0x545c('0x18')](_0x5bd62e);}return _0x5047b0[_0x545c('0x19')](_0x5bd62e)[_0x545c('0x1a')]();};}function respondWithResult(_0xe4291e,_0x42be8b){_0x42be8b=_0x42be8b||0xc8;return function(_0x27906a){if(_0x27906a){return _0xe4291e[_0x545c('0x19')](_0x42be8b)[_0x545c('0x1b')](_0x27906a);}};}function respondWithFilteredResult(_0x3a8faa,_0x258b60){return function(_0x3ad97c){if(_0x3ad97c){var _0x54e57f=typeof _0x258b60[_0x545c('0x1c')]===_0x545c('0x1d')&&typeof _0x258b60[_0x545c('0x1e')]===_0x545c('0x1d');var _0x42283b=_0x3ad97c['count'];var _0x49b349=_0x54e57f?0x0:_0x258b60[_0x545c('0x1c')];var _0xa437d4=_0x54e57f?_0x3ad97c[_0x545c('0x1f')]:_0x258b60[_0x545c('0x1c')]+_0x258b60['limit'];var _0x43468d;if(_0xa437d4>=_0x42283b){_0xa437d4=_0x42283b;_0x43468d=0xc8;}else{_0x43468d=0xce;}_0x3a8faa[_0x545c('0x19')](_0x43468d);return _0x3a8faa[_0x545c('0x20')]('Content-Range',_0x49b349+'-'+_0xa437d4+'/'+_0x42283b)[_0x545c('0x1b')](_0x3ad97c);}return null;};}function patchUpdates(_0x57a80a){return function(_0x48d6b5){try{jsonpatch[_0x545c('0x21')](_0x48d6b5,_0x57a80a,!![]);}catch(_0x3e2ac9){return BPromise[_0x545c('0x22')](_0x3e2ac9);}return _0x48d6b5['save']();};}function saveUpdates(_0x1e2cf5,_0x3c8a59){return function(_0x2ba45c){if(_0x2ba45c){return _0x2ba45c['update'](_0x1e2cf5)['then'](function(_0x14498b){return _0x14498b;});}return null;};}function removeEntity(_0x4ac324,_0xc5c2b3){return function(_0x13ad02){if(_0x13ad02){return _0x13ad02['destroy']()[_0x545c('0x23')](function(){_0x4ac324[_0x545c('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x369722,_0x48ea5f){return function(_0xa330e5){if(!_0xa330e5){_0x369722['sendStatus'](0x194);}return _0xa330e5;};}function handleError(_0x504861,_0x3402f5){_0x3402f5=_0x3402f5||0x1f4;return function(_0x4da9bd){logger[_0x545c('0x24')](_0x4da9bd[_0x545c('0x25')]);if(_0x4da9bd[_0x545c('0x26')]){delete _0x4da9bd[_0x545c('0x26')];}_0x504861[_0x545c('0x19')](_0x3402f5)[_0x545c('0x27')](_0x4da9bd);};}exports[_0x545c('0x28')]=function(_0x1ff98d,_0x11ddb2){var _0x526227={},_0x18053e={},_0x4a99c4={'count':0x0,'rows':[]};var _0x335ef9=_[_0x545c('0x29')](db[_0x545c('0x2a')][_0x545c('0x2b')],function(_0x1565cb){return{'name':_0x1565cb[_0x545c('0x2c')],'type':_0x1565cb[_0x545c('0x2d')][_0x545c('0x2e')]};});_0x18053e[_0x545c('0x2f')]=_[_0x545c('0x29')](_0x335ef9,_0x545c('0x26'));_0x18053e[_0x545c('0x30')]=_[_0x545c('0x31')](_0x1ff98d[_0x545c('0x30')]);_0x18053e['filters']=_[_0x545c('0x32')](_0x18053e[_0x545c('0x2f')],_0x18053e[_0x545c('0x30')]);_0x526227[_0x545c('0x33')]=_[_0x545c('0x32')](_0x18053e[_0x545c('0x2f')],qs['fields'](_0x1ff98d['query'][_0x545c('0x34')]));_0x526227[_0x545c('0x33')]=_0x526227[_0x545c('0x33')]['length']?_0x526227['attributes']:_0x18053e[_0x545c('0x2f')];if(!_0x1ff98d[_0x545c('0x30')]['hasOwnProperty']('nolimit')){_0x526227[_0x545c('0x1e')]=qs['limit'](_0x1ff98d['query'][_0x545c('0x1e')]);_0x526227['offset']=qs[_0x545c('0x1c')](_0x1ff98d[_0x545c('0x30')][_0x545c('0x1c')]);}_0x526227[_0x545c('0x35')]=qs[_0x545c('0x36')](_0x1ff98d[_0x545c('0x30')][_0x545c('0x36')]);_0x526227['where']=qs['filters'](_[_0x545c('0x37')](_0x1ff98d[_0x545c('0x30')],_0x18053e['filters']),_0x335ef9);if(_0x1ff98d[_0x545c('0x30')][_0x545c('0x38')]){_0x526227[_0x545c('0x39')]=_[_0x545c('0x3a')](_0x526227[_0x545c('0x39')],{'$or':_[_0x545c('0x29')](_0x335ef9,function(_0x58db89){if(_0x58db89[_0x545c('0x2d')]!==_0x545c('0x3b')){var _0x395c9b={};_0x395c9b[_0x58db89[_0x545c('0x26')]]={'$like':'%'+_0x1ff98d[_0x545c('0x30')][_0x545c('0x38')]+'%'};return _0x395c9b;}})});}_0x526227=_['merge']({},_0x526227,_0x1ff98d[_0x545c('0x3c')]);var _0x402707={'where':_0x526227['where']};return db[_0x545c('0x2a')]['count'](_0x402707)[_0x545c('0x23')](function(_0x5215f0){_0x4a99c4[_0x545c('0x1f')]=_0x5215f0;if(_0x1ff98d[_0x545c('0x30')][_0x545c('0x3d')]){_0x526227[_0x545c('0x3e')]=[{'all':!![]}];}return db[_0x545c('0x2a')]['findAll'](_0x526227);})[_0x545c('0x23')](function(_0x133e78){_0x4a99c4[_0x545c('0x3f')]=_0x133e78;return _0x4a99c4;})[_0x545c('0x23')](respondWithFilteredResult(_0x11ddb2,_0x526227))[_0x545c('0x40')](handleError(_0x11ddb2,null));};exports[_0x545c('0x41')]=function(_0x478ba1,_0x565e19){var _0xf2b670={'raw':!![],'where':{'id':_0x478ba1[_0x545c('0x42')]['id']}},_0x3734aa={};_0x3734aa[_0x545c('0x2f')]=_['keys'](db['SquareReport'][_0x545c('0x2b')]);_0x3734aa['query']=_[_0x545c('0x31')](_0x478ba1[_0x545c('0x30')]);_0x3734aa[_0x545c('0x43')]=_[_0x545c('0x32')](_0x3734aa[_0x545c('0x2f')],_0x3734aa[_0x545c('0x30')]);_0xf2b670['attributes']=_[_0x545c('0x32')](_0x3734aa['model'],qs[_0x545c('0x34')](_0x478ba1[_0x545c('0x30')][_0x545c('0x34')]));_0xf2b670[_0x545c('0x33')]=_0xf2b670['attributes'][_0x545c('0x44')]?_0xf2b670['attributes']:_0x3734aa[_0x545c('0x2f')];if(_0x478ba1['query'][_0x545c('0x3d')]){_0xf2b670['include']=[{'all':!![]}];}_0xf2b670=_[_0x545c('0x3a')]({},_0xf2b670,_0x478ba1['options']);return db[_0x545c('0x2a')][_0x545c('0x45')](_0xf2b670)[_0x545c('0x23')](handleEntityNotFound(_0x565e19,null))[_0x545c('0x23')](respondWithResult(_0x565e19,null))[_0x545c('0x40')](handleError(_0x565e19,null));};exports[_0x545c('0x46')]=function(_0x2a9396,_0x3d374c){return db['SquareReport'][_0x545c('0x46')](_0x2a9396[_0x545c('0x47')],{})['then'](respondWithResult(_0x3d374c,0xc9))[_0x545c('0x40')](handleError(_0x3d374c,null));};exports[_0x545c('0x48')]=function(_0x2ca542,_0x149da6){if(_0x2ca542[_0x545c('0x47')]['id']){delete _0x2ca542['body']['id'];}return db[_0x545c('0x2a')][_0x545c('0x45')]({'where':{'id':_0x2ca542[_0x545c('0x42')]['id']}})[_0x545c('0x23')](handleEntityNotFound(_0x149da6,null))[_0x545c('0x23')](saveUpdates(_0x2ca542[_0x545c('0x47')],null))['then'](respondWithResult(_0x149da6,null))[_0x545c('0x40')](handleError(_0x149da6,null));};exports[_0x545c('0x49')]=function(_0x3b02c4,_0x36c502){return db['SquareReport'][_0x545c('0x45')]({'where':{'id':_0x3b02c4[_0x545c('0x42')]['id']}})[_0x545c('0x23')](handleEntityNotFound(_0x36c502,null))['then'](removeEntity(_0x36c502,null))[_0x545c('0x40')](handleError(_0x36c502,null));};exports['describe']=function(_0x44d3d9,_0x11bbe6){return db['SquareReport'][_0x545c('0x4a')]()[_0x545c('0x23')](respondWithResult(_0x11bbe6,null))[_0x545c('0x40')](handleError(_0x11bbe6,null));}; \ No newline at end of file +var _0xc6e2=['where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','rawAttributes','options','find','create','body','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','update','then','destroy','stack','name','index','SquareReport','type','model','map','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort'];(function(_0x967959,_0x53c5c1){var _0x5c4489=function(_0x1ae5c6){while(--_0x1ae5c6){_0x967959['push'](_0x967959['shift']());}};_0x5c4489(++_0x53c5c1);}(_0xc6e2,0x1cd));var _0x2c6e=function(_0x1d8844,_0x415d9d){_0x1d8844=_0x1d8844-0x0;var _0x8565c3=_0xc6e2[_0x1d8844];return _0x8565c3;};'use strict';var emlformat=require(_0x2c6e('0x0'));var rimraf=require(_0x2c6e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2c6e('0x2'));var moment=require(_0x2c6e('0x3'));var BPromise=require(_0x2c6e('0x4'));var Mustache=require(_0x2c6e('0x5'));var util=require('util');var path=require(_0x2c6e('0x6'));var sox=require(_0x2c6e('0x7'));var csv=require(_0x2c6e('0x8'));var ejs=require(_0x2c6e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2c6e('0xa'));var squel=require('squel');var crypto=require(_0x2c6e('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2c6e('0x8'));var querystring=require(_0x2c6e('0xc'));var Papa=require(_0x2c6e('0xd'));var Redis=require(_0x2c6e('0xe'));var authService=require(_0x2c6e('0xf'));var qs=require(_0x2c6e('0x10'));var as=require(_0x2c6e('0x11'));var hardwareService=require(_0x2c6e('0x12'));var logger=require(_0x2c6e('0x13'))(_0x2c6e('0x14'));var utils=require(_0x2c6e('0x15'));var config=require(_0x2c6e('0x16'));var licenseUtil=require(_0x2c6e('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3378c4,_0x5ed722){_0x5ed722=_0x5ed722||0xcc;return function(_0x147820){if(_0x147820){return _0x3378c4[_0x2c6e('0x18')](_0x5ed722);}return _0x3378c4[_0x2c6e('0x19')](_0x5ed722)[_0x2c6e('0x1a')]();};}function respondWithResult(_0x33aa02,_0x4356f8){_0x4356f8=_0x4356f8||0xc8;return function(_0x2e777e){if(_0x2e777e){return _0x33aa02[_0x2c6e('0x19')](_0x4356f8)['json'](_0x2e777e);}};}function respondWithFilteredResult(_0x49d71a,_0x207b63){return function(_0x4f5087){if(_0x4f5087){var _0x394e40=typeof _0x207b63[_0x2c6e('0x1b')]==='undefined'&&typeof _0x207b63[_0x2c6e('0x1c')]===_0x2c6e('0x1d');var _0x4cac7e=_0x4f5087[_0x2c6e('0x1e')];var _0x389751=_0x394e40?0x0:_0x207b63[_0x2c6e('0x1b')];var _0x22ec56=_0x394e40?_0x4f5087[_0x2c6e('0x1e')]:_0x207b63['offset']+_0x207b63[_0x2c6e('0x1c')];var _0x4f6653;if(_0x22ec56>=_0x4cac7e){_0x22ec56=_0x4cac7e;_0x4f6653=0xc8;}else{_0x4f6653=0xce;}_0x49d71a[_0x2c6e('0x19')](_0x4f6653);return _0x49d71a[_0x2c6e('0x1f')](_0x2c6e('0x20'),_0x389751+'-'+_0x22ec56+'/'+_0x4cac7e)[_0x2c6e('0x21')](_0x4f5087);}return null;};}function patchUpdates(_0x11127d){return function(_0x3c8189){try{jsonpatch[_0x2c6e('0x22')](_0x3c8189,_0x11127d,!![]);}catch(_0x35ae84){return BPromise[_0x2c6e('0x23')](_0x35ae84);}return _0x3c8189['save']();};}function saveUpdates(_0x6e17d8,_0x3c7260){return function(_0x110163){if(_0x110163){return _0x110163[_0x2c6e('0x24')](_0x6e17d8)[_0x2c6e('0x25')](function(_0x578981){return _0x578981;});}return null;};}function removeEntity(_0x36f0a6,_0x16b184){return function(_0x3da550){if(_0x3da550){return _0x3da550[_0x2c6e('0x26')]()['then'](function(){_0x36f0a6[_0x2c6e('0x19')](0xcc)[_0x2c6e('0x1a')]();});}};}function handleEntityNotFound(_0x1d8443,_0x1df761){return function(_0xa4fe1){if(!_0xa4fe1){_0x1d8443[_0x2c6e('0x18')](0x194);}return _0xa4fe1;};}function handleError(_0x51bb89,_0x1351c7){_0x1351c7=_0x1351c7||0x1f4;return function(_0x1145a6){logger['error'](_0x1145a6[_0x2c6e('0x27')]);if(_0x1145a6[_0x2c6e('0x28')]){delete _0x1145a6[_0x2c6e('0x28')];}_0x51bb89['status'](_0x1351c7)['send'](_0x1145a6);};}exports[_0x2c6e('0x29')]=function(_0x160221,_0x2251db){var _0x3f8d75={},_0x59032f={},_0x144b48={'count':0x0,'rows':[]};var _0x1a523b=_['map'](db[_0x2c6e('0x2a')]['rawAttributes'],function(_0x47d6ea){return{'name':_0x47d6ea['fieldName'],'type':_0x47d6ea[_0x2c6e('0x2b')]['key']};});_0x59032f[_0x2c6e('0x2c')]=_[_0x2c6e('0x2d')](_0x1a523b,_0x2c6e('0x28'));_0x59032f['query']=_[_0x2c6e('0x2e')](_0x160221['query']);_0x59032f[_0x2c6e('0x2f')]=_[_0x2c6e('0x30')](_0x59032f[_0x2c6e('0x2c')],_0x59032f[_0x2c6e('0x31')]);_0x3f8d75['attributes']=_[_0x2c6e('0x30')](_0x59032f[_0x2c6e('0x2c')],qs['fields'](_0x160221[_0x2c6e('0x31')][_0x2c6e('0x32')]));_0x3f8d75[_0x2c6e('0x33')]=_0x3f8d75[_0x2c6e('0x33')][_0x2c6e('0x34')]?_0x3f8d75['attributes']:_0x59032f[_0x2c6e('0x2c')];if(!_0x160221[_0x2c6e('0x31')][_0x2c6e('0x35')](_0x2c6e('0x36'))){_0x3f8d75[_0x2c6e('0x1c')]=qs[_0x2c6e('0x1c')](_0x160221['query'][_0x2c6e('0x1c')]);_0x3f8d75['offset']=qs[_0x2c6e('0x1b')](_0x160221[_0x2c6e('0x31')][_0x2c6e('0x1b')]);}_0x3f8d75[_0x2c6e('0x37')]=qs[_0x2c6e('0x38')](_0x160221['query'][_0x2c6e('0x38')]);_0x3f8d75[_0x2c6e('0x39')]=qs[_0x2c6e('0x2f')](_[_0x2c6e('0x3a')](_0x160221['query'],_0x59032f[_0x2c6e('0x2f')]),_0x1a523b);if(_0x160221[_0x2c6e('0x31')][_0x2c6e('0x3b')]){_0x3f8d75[_0x2c6e('0x39')]=_[_0x2c6e('0x3c')](_0x3f8d75['where'],{'$or':_[_0x2c6e('0x2d')](_0x1a523b,function(_0x5a4ac1){if(_0x5a4ac1['type']!==_0x2c6e('0x3d')){var _0x32ff29={};_0x32ff29[_0x5a4ac1[_0x2c6e('0x28')]]={'$like':'%'+_0x160221[_0x2c6e('0x31')]['filter']+'%'};return _0x32ff29;}})});}_0x3f8d75=_[_0x2c6e('0x3c')]({},_0x3f8d75,_0x160221['options']);var _0x3913fc={'where':_0x3f8d75[_0x2c6e('0x39')]};return db[_0x2c6e('0x2a')][_0x2c6e('0x1e')](_0x3913fc)[_0x2c6e('0x25')](function(_0x4a2132){_0x144b48[_0x2c6e('0x1e')]=_0x4a2132;if(_0x160221[_0x2c6e('0x31')][_0x2c6e('0x3e')]){_0x3f8d75[_0x2c6e('0x3f')]=[{'all':!![]}];}return db['SquareReport'][_0x2c6e('0x40')](_0x3f8d75);})[_0x2c6e('0x25')](function(_0x1c4411){_0x144b48['rows']=_0x1c4411;return _0x144b48;})[_0x2c6e('0x25')](respondWithFilteredResult(_0x2251db,_0x3f8d75))[_0x2c6e('0x41')](handleError(_0x2251db,null));};exports[_0x2c6e('0x42')]=function(_0xf33eff,_0x5608c1){var _0x50efbb={'raw':!![],'where':{'id':_0xf33eff[_0x2c6e('0x43')]['id']}},_0x46716b={};_0x46716b[_0x2c6e('0x2c')]=_[_0x2c6e('0x2e')](db[_0x2c6e('0x2a')][_0x2c6e('0x44')]);_0x46716b[_0x2c6e('0x31')]=_[_0x2c6e('0x2e')](_0xf33eff['query']);_0x46716b[_0x2c6e('0x2f')]=_[_0x2c6e('0x30')](_0x46716b['model'],_0x46716b[_0x2c6e('0x31')]);_0x50efbb['attributes']=_[_0x2c6e('0x30')](_0x46716b[_0x2c6e('0x2c')],qs[_0x2c6e('0x32')](_0xf33eff[_0x2c6e('0x31')][_0x2c6e('0x32')]));_0x50efbb[_0x2c6e('0x33')]=_0x50efbb['attributes'][_0x2c6e('0x34')]?_0x50efbb[_0x2c6e('0x33')]:_0x46716b[_0x2c6e('0x2c')];if(_0xf33eff['query'][_0x2c6e('0x3e')]){_0x50efbb['include']=[{'all':!![]}];}_0x50efbb=_[_0x2c6e('0x3c')]({},_0x50efbb,_0xf33eff[_0x2c6e('0x45')]);return db['SquareReport'][_0x2c6e('0x46')](_0x50efbb)[_0x2c6e('0x25')](handleEntityNotFound(_0x5608c1,null))['then'](respondWithResult(_0x5608c1,null))[_0x2c6e('0x41')](handleError(_0x5608c1,null));};exports[_0x2c6e('0x47')]=function(_0x2e8442,_0x4ffa45){return db[_0x2c6e('0x2a')][_0x2c6e('0x47')](_0x2e8442[_0x2c6e('0x48')],{})['then'](respondWithResult(_0x4ffa45,0xc9))[_0x2c6e('0x41')](handleError(_0x4ffa45,null));};exports['update']=function(_0xfc27f5,_0x34ac87){if(_0xfc27f5[_0x2c6e('0x48')]['id']){delete _0xfc27f5[_0x2c6e('0x48')]['id'];}return db[_0x2c6e('0x2a')][_0x2c6e('0x46')]({'where':{'id':_0xfc27f5[_0x2c6e('0x43')]['id']}})[_0x2c6e('0x25')](handleEntityNotFound(_0x34ac87,null))[_0x2c6e('0x25')](saveUpdates(_0xfc27f5['body'],null))[_0x2c6e('0x25')](respondWithResult(_0x34ac87,null))[_0x2c6e('0x41')](handleError(_0x34ac87,null));};exports[_0x2c6e('0x26')]=function(_0x33f4a3,_0x24eddb){return db[_0x2c6e('0x2a')][_0x2c6e('0x46')]({'where':{'id':_0x33f4a3[_0x2c6e('0x43')]['id']}})[_0x2c6e('0x25')](handleEntityNotFound(_0x24eddb,null))[_0x2c6e('0x25')](removeEntity(_0x24eddb,null))[_0x2c6e('0x41')](handleError(_0x24eddb,null));};exports[_0x2c6e('0x49')]=function(_0x161a22,_0x4c5247){return db['SquareReport'][_0x2c6e('0x49')]()[_0x2c6e('0x25')](respondWithResult(_0x4c5247,null))[_0x2c6e('0x41')](handleError(_0x4c5247,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 1c366b9..cca8276 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 _0xe264=['api','moment','path','./squareReport.attributes','exports','define','SquareReport','report_square','uniqueid','leaveAt','lodash','../../config/logger'];(function(_0x7076c9,_0x94745a){var _0x5d6720=function(_0xcfde72){while(--_0xcfde72){_0x7076c9['push'](_0x7076c9['shift']());}};_0x5d6720(++_0x94745a);}(_0xe264,0x1ba));var _0x4e26=function(_0x178668,_0x1ec300){_0x178668=_0x178668-0x0;var _0x26107d=_0xe264[_0x178668];return _0x26107d;};'use strict';var _=require(_0x4e26('0x0'));var util=require('util');var logger=require(_0x4e26('0x1'))(_0x4e26('0x2'));var moment=require(_0x4e26('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4e26('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4e26('0x5'));module[_0x4e26('0x6')]=function(_0x2fb001,_0x1afb4d){return _0x2fb001[_0x4e26('0x7')](_0x4e26('0x8'),attributes,{'tableName':_0x4e26('0x9'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0x4e26('0xa'),'project_name']},{'name':_0x4e26('0xb'),'fields':[_0x4e26('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x81eb=['util','api','bluebird','request-promise','path','rimraf','../../config/environment','./squareReport.attributes','exports','define','report_square','leaveAt','lodash'];(function(_0x1f3aec,_0x24c18e){var _0x409f0d=function(_0x52b818){while(--_0x52b818){_0x1f3aec['push'](_0x1f3aec['shift']());}};_0x409f0d(++_0x24c18e);}(_0x81eb,0x19f));var _0xb81e=function(_0x37453f,_0x31f75d){_0x37453f=_0x37453f-0x0;var _0x41ec41=_0x81eb[_0x37453f];return _0x41ec41;};'use strict';var _=require(_0xb81e('0x0'));var util=require(_0xb81e('0x1'));var logger=require('../../config/logger')(_0xb81e('0x2'));var moment=require('moment');var BPromise=require(_0xb81e('0x3'));var rp=require(_0xb81e('0x4'));var fs=require('fs');var path=require(_0xb81e('0x5'));var rimraf=require(_0xb81e('0x6'));var config=require(_0xb81e('0x7'));var attributes=require(_0xb81e('0x8'));module[_0xb81e('0x9')]=function(_0x3ce874,_0x1fa92b){return _0x3ce874[_0xb81e('0xa')]('SquareReport',attributes,{'tableName':_0xb81e('0xb'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':['uniqueid','project_name']},{'name':_0xb81e('0xc'),'fields':[_0xb81e('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 4bf757c..f3de8be 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 _0x194e=['../../config/logger','rpc','jayson/promise','http','request','then','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateSquareReport','SquareReport','create','body','options','UpdateSquareReport','update','raw','where','attributes','lodash','util','bluebird','randomstring','ioredis'];(function(_0x2f22da,_0x4677d7){var _0x1ef6d7=function(_0x34a251){while(--_0x34a251){_0x2f22da['push'](_0x2f22da['shift']());}};_0x1ef6d7(++_0x4677d7);}(_0x194e,0x9b));var _0xe194=function(_0x598ddf,_0x4c035e){_0x598ddf=_0x598ddf-0x0;var _0x4db375=_0x194e[_0x598ddf];return _0x4db375;};'use strict';var _=require(_0xe194('0x0'));var util=require(_0xe194('0x1'));var moment=require('moment');var BPromise=require(_0xe194('0x2'));var rs=require(_0xe194('0x3'));var fs=require('fs');var Redis=require(_0xe194('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe194('0x5'))(_0xe194('0x6'));var config=require('../../config/environment');var jayson=require(_0xe194('0x7'));var client=jayson['client'][_0xe194('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2d2620,_0x11c84f,_0x451c2f){return new BPromise(function(_0x1e7284,_0x23552c){return client[_0xe194('0x9')](_0x2d2620,_0x451c2f)[_0xe194('0xa')](function(_0x5c9857){logger['info'](_0xe194('0xb'),_0x11c84f,_0xe194('0xc'));logger[_0xe194('0xd')](_0xe194('0xe'),_0x11c84f,_0xe194('0xc'),JSON[_0xe194('0xf')](_0x5c9857));if(_0x5c9857[_0xe194('0x10')]){if(_0x5c9857['error'][_0xe194('0x11')]===0x1f4){logger['error'](_0xe194('0xb'),_0x11c84f,_0x5c9857['error'][_0xe194('0x12')]);return _0x23552c(_0x5c9857[_0xe194('0x10')][_0xe194('0x12')]);}logger[_0xe194('0x10')](_0xe194('0xb'),_0x11c84f,_0x5c9857[_0xe194('0x10')][_0xe194('0x12')]);return _0x1e7284(_0x5c9857[_0xe194('0x10')][_0xe194('0x12')]);}else{logger[_0xe194('0x13')](_0xe194('0xb'),_0x11c84f,_0xe194('0xc'));_0x1e7284(_0x5c9857[_0xe194('0x14')][_0xe194('0x12')]);}})[_0xe194('0x15')](function(_0x2730c2){logger[_0xe194('0x10')](_0xe194('0xb'),_0x11c84f,_0x2730c2);_0x23552c(_0x2730c2);});});}exports[_0xe194('0x16')]=function(_0x2598a7){var _0x9264bc=this;return new Promise(function(_0x1da83a,_0x3ec437){return db[_0xe194('0x17')][_0xe194('0x18')](_0x2598a7[_0xe194('0x19')],{'raw':_0x2598a7[_0xe194('0x1a')]?_0x2598a7[_0xe194('0x1a')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x261610){logger['info'](_0xe194('0x16'),_0x2598a7);logger[_0xe194('0xd')](_0xe194('0x16'),_0x2598a7,JSON['stringify'](_0x261610));_0x1da83a(_0x261610);})[_0xe194('0x15')](function(_0x4ee749){logger['error']('CreateSquareReport',_0x4ee749[_0xe194('0x12')],_0x2598a7);_0x3ec437(_0x9264bc[_0xe194('0x10')](0x1f4,_0x4ee749[_0xe194('0x12')]));});});};exports[_0xe194('0x1b')]=function(_0x152daa){var _0x253942=this;return new Promise(function(_0x5712a7,_0x5b89e4){return db[_0xe194('0x17')][_0xe194('0x1c')](_0x152daa[_0xe194('0x19')],{'raw':_0x152daa[_0xe194('0x1a')]?_0x152daa[_0xe194('0x1a')][_0xe194('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x152daa[_0xe194('0x1a')]?_0x152daa[_0xe194('0x1a')][_0xe194('0x1e')]||null:null,'attributes':_0x152daa[_0xe194('0x1a')]?_0x152daa[_0xe194('0x1a')][_0xe194('0x1f')]||null:null,'limit':_0x152daa['options']?_0x152daa[_0xe194('0x1a')]['limit']||null:null})[_0xe194('0xa')](function(_0x56202e){logger['info']('UpdateSquareReport',_0x152daa);logger[_0xe194('0xd')](_0xe194('0x1b'),_0x152daa,JSON[_0xe194('0xf')](_0x56202e));_0x5712a7(_0x56202e);})['catch'](function(_0x3605d2){logger[_0xe194('0x10')]('UpdateSquareReport',_0x3605d2['message'],_0x152daa);_0x5b89e4(_0x253942['error'](0x1f4,_0x3605d2[_0xe194('0x12')]));});});}; \ No newline at end of file +var _0xb5b2=['code','message','catch','body','raw','debug','CreateSquareReport','stringify','UpdateSquareReport','update','options','where','attributes','limit','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','SquareReport,\x20%s,\x20%s,\x20%s','error'];(function(_0x4949ae,_0x323e98){var _0x4fc397=function(_0x46de87){while(--_0x46de87){_0x4949ae['push'](_0x4949ae['shift']());}};_0x4fc397(++_0x323e98);}(_0xb5b2,0x1df));var _0x2b5b=function(_0x1b77c8,_0x289f97){_0x1b77c8=_0x1b77c8-0x0;var _0x7cf2e=_0xb5b2[_0x1b77c8];return _0x7cf2e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2b5b('0x0'));var BPromise=require(_0x2b5b('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2b5b('0x2'));var db=require(_0x2b5b('0x3'))['db'];var utils=require(_0x2b5b('0x4'));var logger=require(_0x2b5b('0x5'))(_0x2b5b('0x6'));var config=require(_0x2b5b('0x7'));var jayson=require(_0x2b5b('0x8'));var client=jayson[_0x2b5b('0x9')][_0x2b5b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x288eec,_0x3b3141,_0x178c75){return new BPromise(function(_0x47172c,_0x566d69){return client['request'](_0x288eec,_0x178c75)[_0x2b5b('0xb')](function(_0x10999a){logger[_0x2b5b('0xc')](_0x2b5b('0xd'),_0x3b3141,_0x2b5b('0xe'));logger['debug'](_0x2b5b('0xf'),_0x3b3141,'request\x20sent',JSON['stringify'](_0x10999a));if(_0x10999a[_0x2b5b('0x10')]){if(_0x10999a['error'][_0x2b5b('0x11')]===0x1f4){logger[_0x2b5b('0x10')](_0x2b5b('0xd'),_0x3b3141,_0x10999a[_0x2b5b('0x10')][_0x2b5b('0x12')]);return _0x566d69(_0x10999a['error'][_0x2b5b('0x12')]);}logger[_0x2b5b('0x10')](_0x2b5b('0xd'),_0x3b3141,_0x10999a['error'][_0x2b5b('0x12')]);return _0x47172c(_0x10999a['error'][_0x2b5b('0x12')]);}else{logger[_0x2b5b('0xc')](_0x2b5b('0xd'),_0x3b3141,_0x2b5b('0xe'));_0x47172c(_0x10999a['result'][_0x2b5b('0x12')]);}})[_0x2b5b('0x13')](function(_0x6f045d){logger['error']('SquareReport,\x20%s,\x20%s',_0x3b3141,_0x6f045d);_0x566d69(_0x6f045d);});});}exports['CreateSquareReport']=function(_0x1b078d){var _0x55fcd3=this;return new Promise(function(_0x413e9d,_0x315a7f){return db['SquareReport']['create'](_0x1b078d[_0x2b5b('0x14')],{'raw':_0x1b078d['options']?_0x1b078d['options'][_0x2b5b('0x15')]===undefined?!![]:![]:!![]})[_0x2b5b('0xb')](function(_0x4dcd69){logger[_0x2b5b('0xc')]('CreateSquareReport',_0x1b078d);logger[_0x2b5b('0x16')](_0x2b5b('0x17'),_0x1b078d,JSON[_0x2b5b('0x18')](_0x4dcd69));_0x413e9d(_0x4dcd69);})[_0x2b5b('0x13')](function(_0x178d2b){logger[_0x2b5b('0x10')](_0x2b5b('0x17'),_0x178d2b[_0x2b5b('0x12')],_0x1b078d);_0x315a7f(_0x55fcd3[_0x2b5b('0x10')](0x1f4,_0x178d2b[_0x2b5b('0x12')]));});});};exports[_0x2b5b('0x19')]=function(_0x19d14a){var _0x1ed64c=this;return new Promise(function(_0x2c353f,_0x302732){return db['SquareReport'][_0x2b5b('0x1a')](_0x19d14a['body'],{'raw':_0x19d14a[_0x2b5b('0x1b')]?_0x19d14a['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x19d14a[_0x2b5b('0x1b')]?_0x19d14a[_0x2b5b('0x1b')][_0x2b5b('0x1c')]||null:null,'attributes':_0x19d14a[_0x2b5b('0x1b')]?_0x19d14a[_0x2b5b('0x1b')][_0x2b5b('0x1d')]||null:null,'limit':_0x19d14a[_0x2b5b('0x1b')]?_0x19d14a[_0x2b5b('0x1b')][_0x2b5b('0x1e')]||null:null})['then'](function(_0x25841a){logger[_0x2b5b('0xc')](_0x2b5b('0x19'),_0x19d14a);logger[_0x2b5b('0x16')](_0x2b5b('0x19'),_0x19d14a,JSON['stringify'](_0x25841a));_0x2c353f(_0x25841a);})['catch'](function(_0x86a8a7){logger['error'](_0x2b5b('0x19'),_0x86a8a7[_0x2b5b('0x12')],_0x19d14a);_0x302732(_0x1ed64c[_0x2b5b('0x10')](0x1f4,_0x86a8a7[_0x2b5b('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index c662e55..16c9e1e 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 _0x1ae0=['post','create','put','update','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x1ae0,0x1ea));var _0x01ae=function(_0x13d2a5,_0x5016a4){_0x13d2a5=_0x13d2a5-0x0;var _0x437a87=_0x1ae0[_0x13d2a5];return _0x437a87;};'use strict';var multer=require(_0x01ae('0x0'));var util=require(_0x01ae('0x1'));var path=require(_0x01ae('0x2'));var timeout=require(_0x01ae('0x3'));var express=require('express');var router=express[_0x01ae('0x4')]();var fs_extra=require(_0x01ae('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x01ae('0x6'));var config=require(_0x01ae('0x7'));var controller=require(_0x01ae('0x8'));router[_0x01ae('0x9')]('/',auth[_0x01ae('0xa')](),controller[_0x01ae('0xb')]);router[_0x01ae('0x9')](_0x01ae('0xc'),auth[_0x01ae('0xa')](),controller[_0x01ae('0xd')]);router[_0x01ae('0x9')](_0x01ae('0xe'),auth[_0x01ae('0xa')](),controller[_0x01ae('0xf')]);router[_0x01ae('0x10')]('/',auth[_0x01ae('0xa')](),controller[_0x01ae('0x11')]);router[_0x01ae('0x12')](_0x01ae('0xe'),auth[_0x01ae('0xa')](),controller[_0x01ae('0x13')]);router[_0x01ae('0x14')](_0x01ae('0xe'),auth[_0x01ae('0xa')](),controller[_0x01ae('0x15')]);module['exports']=router; \ No newline at end of file +var _0x2f23=['get','isAuthenticated','index','describe','/:id','show','create','update','delete','destroy','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller'];(function(_0x590b61,_0x4c4335){var _0x1a14dc=function(_0x2ff4f6){while(--_0x2ff4f6){_0x590b61['push'](_0x590b61['shift']());}};_0x1a14dc(++_0x4c4335);}(_0x2f23,0x1ba));var _0x32f2=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2f23[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require(_0x32f2('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x32f2('0x1'));var router=express[_0x32f2('0x2')]();var fs_extra=require(_0x32f2('0x3'));var auth=require(_0x32f2('0x4'));var interaction=require(_0x32f2('0x5'));var config=require(_0x32f2('0x6'));var controller=require(_0x32f2('0x7'));router[_0x32f2('0x8')]('/',auth[_0x32f2('0x9')](),controller[_0x32f2('0xa')]);router['get']('/describe',auth[_0x32f2('0x9')](),controller[_0x32f2('0xb')]);router[_0x32f2('0x8')](_0x32f2('0xc'),auth[_0x32f2('0x9')](),controller[_0x32f2('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x32f2('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x32f2('0xf')]);router[_0x32f2('0x10')]('/:id',auth[_0x32f2('0x9')](),controller[_0x32f2('0x11')]);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 8b44779..8e3c59b 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 _0x14d1=['STRING','TEXT','sequelize','exports'];(function(_0x2a4e06,_0x16cf63){var _0x4bfa56=function(_0x3aa8b4){while(--_0x3aa8b4){_0x2a4e06['push'](_0x2a4e06['shift']());}};_0x4bfa56(++_0x16cf63);}(_0x14d1,0xda));var _0x114d=function(_0x2452cd,_0x5b787a){_0x2452cd=_0x2452cd-0x0;var _0x5df072=_0x14d1[_0x2452cd];return _0x5df072;};'use strict';var Sequelize=require(_0x114d('0x0'));module[_0x114d('0x1')]={'uniqueid':{'type':Sequelize[_0x114d('0x2')]},'node':{'type':Sequelize[_0x114d('0x2')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0x114d('0x3')]},'project_name':{'type':Sequelize[_0x114d('0x2')]},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6797=['STRING','TEXT','sequelize','exports'];(function(_0x1ce919,_0x1bbb96){var _0x34ec94=function(_0x3f7a6f){while(--_0x3f7a6f){_0x1ce919['push'](_0x1ce919['shift']());}};_0x34ec94(++_0x1bbb96);}(_0x6797,0xda));var _0x7679=function(_0x564d23,_0x4777fc){_0x564d23=_0x564d23-0x0;var _0x144f24=_0x6797[_0x564d23];return _0x144f24;};'use strict';var Sequelize=require(_0x7679('0x0'));module[_0x7679('0x1')]={'uniqueid':{'type':Sequelize[_0x7679('0x2')]},'node':{'type':Sequelize[_0x7679('0x2')]},'application':{'type':Sequelize[_0x7679('0x2')]},'data':{'type':Sequelize[_0x7679('0x3')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x7679('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 82a4e48..a55ffcc 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 _0x873c=['length','include','create','body','find','params','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','undefined','limit','count','json','reject','save','then','sendStatus','error','stack','name','send','index','map','SquareDetailsReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show'];(function(_0xfcdce8,_0x8cfc07){var _0x191751=function(_0x1e4138){while(--_0x1e4138){_0xfcdce8['push'](_0xfcdce8['shift']());}};_0x191751(++_0x8cfc07);}(_0x873c,0x9e));var _0xc873=function(_0x44d427,_0x5e3c4f){_0x44d427=_0x44d427-0x0;var _0x174d6d=_0x873c[_0x44d427];return _0x174d6d;};'use strict';var emlformat=require(_0xc873('0x0'));var rimraf=require(_0xc873('0x1'));var zipdir=require(_0xc873('0x2'));var jsonpatch=require(_0xc873('0x3'));var rp=require(_0xc873('0x4'));var moment=require(_0xc873('0x5'));var BPromise=require(_0xc873('0x6'));var Mustache=require(_0xc873('0x7'));var util=require('util');var path=require('path');var sox=require(_0xc873('0x8'));var csv=require(_0xc873('0x9'));var ejs=require(_0xc873('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc873('0xb'));var squel=require('squel');var crypto=require(_0xc873('0xc'));var jsforce=require(_0xc873('0xd'));var deskjs=require(_0xc873('0xe'));var toCsv=require(_0xc873('0x9'));var querystring=require(_0xc873('0xf'));var Papa=require('papaparse');var Redis=require(_0xc873('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xc873('0x11'));var as=require(_0xc873('0x12'));var hardwareService=require(_0xc873('0x13'));var logger=require(_0xc873('0x14'))(_0xc873('0x15'));var utils=require(_0xc873('0x16'));var config=require(_0xc873('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xc873('0x18'))['db'];function respondWithStatusCode(_0x5421c4,_0x564205){_0x564205=_0x564205||0xcc;return function(_0x26db43){if(_0x26db43){return _0x5421c4['sendStatus'](_0x564205);}return _0x5421c4[_0xc873('0x19')](_0x564205)[_0xc873('0x1a')]();};}function respondWithResult(_0x4998d4,_0x3504e2){_0x3504e2=_0x3504e2||0xc8;return function(_0xa0e844){if(_0xa0e844){return _0x4998d4[_0xc873('0x19')](_0x3504e2)['json'](_0xa0e844);}};}function respondWithFilteredResult(_0x567b82,_0x4124be){return function(_0x39010c){if(_0x39010c){var _0x589fcc=typeof _0x4124be[_0xc873('0x1b')]===_0xc873('0x1c')&&typeof _0x4124be[_0xc873('0x1d')]===_0xc873('0x1c');var _0x2e56b4=_0x39010c['count'];var _0x524dde=_0x589fcc?0x0:_0x4124be[_0xc873('0x1b')];var _0x35c9b2=_0x589fcc?_0x39010c[_0xc873('0x1e')]:_0x4124be[_0xc873('0x1b')]+_0x4124be[_0xc873('0x1d')];var _0x88c5f0;if(_0x35c9b2>=_0x2e56b4){_0x35c9b2=_0x2e56b4;_0x88c5f0=0xc8;}else{_0x88c5f0=0xce;}_0x567b82[_0xc873('0x19')](_0x88c5f0);return _0x567b82['set']('Content-Range',_0x524dde+'-'+_0x35c9b2+'/'+_0x2e56b4)[_0xc873('0x1f')](_0x39010c);}return null;};}function patchUpdates(_0x6725c4){return function(_0x501625){try{jsonpatch['apply'](_0x501625,_0x6725c4,!![]);}catch(_0x5ab07e){return BPromise[_0xc873('0x20')](_0x5ab07e);}return _0x501625[_0xc873('0x21')]();};}function saveUpdates(_0x578576,_0x4598f6){return function(_0x3dc3c3){if(_0x3dc3c3){return _0x3dc3c3['update'](_0x578576)[_0xc873('0x22')](function(_0x523797){return _0x523797;});}return null;};}function removeEntity(_0x232119,_0x3eaccd){return function(_0x55e646){if(_0x55e646){return _0x55e646['destroy']()[_0xc873('0x22')](function(){_0x232119[_0xc873('0x19')](0xcc)[_0xc873('0x1a')]();});}};}function handleEntityNotFound(_0x252d67,_0x7adaef){return function(_0x449204){if(!_0x449204){_0x252d67[_0xc873('0x23')](0x194);}return _0x449204;};}function handleError(_0x46a165,_0x402f97){_0x402f97=_0x402f97||0x1f4;return function(_0x11fe54){logger[_0xc873('0x24')](_0x11fe54[_0xc873('0x25')]);if(_0x11fe54['name']){delete _0x11fe54[_0xc873('0x26')];}_0x46a165[_0xc873('0x19')](_0x402f97)[_0xc873('0x27')](_0x11fe54);};}exports[_0xc873('0x28')]=function(_0x56f0ac,_0x4ad4bb){var _0x3def1c={},_0x3d0440={},_0x5d164f={'count':0x0,'rows':[]};var _0x4d9f3d=_[_0xc873('0x29')](db[_0xc873('0x2a')][_0xc873('0x2b')],function(_0x4d5840){return{'name':_0x4d5840[_0xc873('0x2c')],'type':_0x4d5840[_0xc873('0x2d')][_0xc873('0x2e')]};});_0x3d0440['model']=_[_0xc873('0x29')](_0x4d9f3d,_0xc873('0x26'));_0x3d0440[_0xc873('0x2f')]=_[_0xc873('0x30')](_0x56f0ac['query']);_0x3d0440[_0xc873('0x31')]=_[_0xc873('0x32')](_0x3d0440[_0xc873('0x33')],_0x3d0440['query']);_0x3def1c['attributes']=_[_0xc873('0x32')](_0x3d0440[_0xc873('0x33')],qs[_0xc873('0x34')](_0x56f0ac[_0xc873('0x2f')][_0xc873('0x34')]));_0x3def1c[_0xc873('0x35')]=_0x3def1c[_0xc873('0x35')]['length']?_0x3def1c['attributes']:_0x3d0440['model'];if(!_0x56f0ac['query'][_0xc873('0x36')]('nolimit')){_0x3def1c['limit']=qs['limit'](_0x56f0ac[_0xc873('0x2f')][_0xc873('0x1d')]);_0x3def1c['offset']=qs[_0xc873('0x1b')](_0x56f0ac[_0xc873('0x2f')]['offset']);}_0x3def1c['order']=qs[_0xc873('0x37')](_0x56f0ac[_0xc873('0x2f')][_0xc873('0x37')]);_0x3def1c[_0xc873('0x38')]=qs[_0xc873('0x31')](_[_0xc873('0x39')](_0x56f0ac['query'],_0x3d0440[_0xc873('0x31')]),_0x4d9f3d);if(_0x56f0ac[_0xc873('0x2f')][_0xc873('0x3a')]){_0x3def1c['where']=_[_0xc873('0x3b')](_0x3def1c[_0xc873('0x38')],{'$or':_['map'](_0x4d9f3d,function(_0x35aea8){if(_0x35aea8['type']!==_0xc873('0x3c')){var _0x4a83bc={};_0x4a83bc[_0x35aea8['name']]={'$like':'%'+_0x56f0ac[_0xc873('0x2f')][_0xc873('0x3a')]+'%'};return _0x4a83bc;}})});}_0x3def1c=_[_0xc873('0x3b')]({},_0x3def1c,_0x56f0ac[_0xc873('0x3d')]);var _0x19d91e={'where':_0x3def1c[_0xc873('0x38')]};return db[_0xc873('0x2a')][_0xc873('0x1e')](_0x19d91e)[_0xc873('0x22')](function(_0xa0754c){_0x5d164f[_0xc873('0x1e')]=_0xa0754c;if(_0x56f0ac['query'][_0xc873('0x3e')]){_0x3def1c['include']=[{'all':!![]}];}return db[_0xc873('0x2a')][_0xc873('0x3f')](_0x3def1c);})[_0xc873('0x22')](function(_0x362e93){_0x5d164f[_0xc873('0x40')]=_0x362e93;return _0x5d164f;})[_0xc873('0x22')](respondWithFilteredResult(_0x4ad4bb,_0x3def1c))[_0xc873('0x41')](handleError(_0x4ad4bb,null));};exports[_0xc873('0x42')]=function(_0x67cb5d,_0x1b5610){var _0x2dd7d5={'raw':!![],'where':{'id':_0x67cb5d['params']['id']}},_0xf5319={};_0xf5319[_0xc873('0x33')]=_[_0xc873('0x30')](db[_0xc873('0x2a')]['rawAttributes']);_0xf5319[_0xc873('0x2f')]=_['keys'](_0x67cb5d['query']);_0xf5319[_0xc873('0x31')]=_[_0xc873('0x32')](_0xf5319[_0xc873('0x33')],_0xf5319[_0xc873('0x2f')]);_0x2dd7d5[_0xc873('0x35')]=_[_0xc873('0x32')](_0xf5319[_0xc873('0x33')],qs[_0xc873('0x34')](_0x67cb5d[_0xc873('0x2f')][_0xc873('0x34')]));_0x2dd7d5[_0xc873('0x35')]=_0x2dd7d5[_0xc873('0x35')][_0xc873('0x43')]?_0x2dd7d5[_0xc873('0x35')]:_0xf5319[_0xc873('0x33')];if(_0x67cb5d[_0xc873('0x2f')][_0xc873('0x3e')]){_0x2dd7d5[_0xc873('0x44')]=[{'all':!![]}];}_0x2dd7d5=_[_0xc873('0x3b')]({},_0x2dd7d5,_0x67cb5d['options']);return db[_0xc873('0x2a')]['find'](_0x2dd7d5)[_0xc873('0x22')](handleEntityNotFound(_0x1b5610,null))['then'](respondWithResult(_0x1b5610,null))[_0xc873('0x41')](handleError(_0x1b5610,null));};exports[_0xc873('0x45')]=function(_0x22242e,_0x41aefe){return db['SquareDetailsReport'][_0xc873('0x45')](_0x22242e['body'],{})['then'](respondWithResult(_0x41aefe,0xc9))[_0xc873('0x41')](handleError(_0x41aefe,null));};exports['update']=function(_0x4a09ad,_0x1cc5ae){if(_0x4a09ad['body']['id']){delete _0x4a09ad[_0xc873('0x46')]['id'];}return db[_0xc873('0x2a')][_0xc873('0x47')]({'where':{'id':_0x4a09ad[_0xc873('0x48')]['id']}})['then'](handleEntityNotFound(_0x1cc5ae,null))[_0xc873('0x22')](saveUpdates(_0x4a09ad[_0xc873('0x46')],null))[_0xc873('0x22')](respondWithResult(_0x1cc5ae,null))[_0xc873('0x41')](handleError(_0x1cc5ae,null));};exports[_0xc873('0x49')]=function(_0x4e05d5,_0x21007e){return db[_0xc873('0x2a')][_0xc873('0x47')]({'where':{'id':_0x4e05d5[_0xc873('0x48')]['id']}})['then'](handleEntityNotFound(_0x21007e,null))['then'](removeEntity(_0x21007e,null))[_0xc873('0x41')](handleError(_0x21007e,null));};exports[_0xc873('0x4a')]=function(_0x312b4b,_0x1959c0){return db[_0xc873('0x2a')][_0xc873('0x4a')]()[_0xc873('0x22')](respondWithResult(_0x1959c0,null))[_0xc873('0x41')](handleError(_0x1959c0,null));}; \ No newline at end of file +var _0xb469=['apply','update','then','error','stack','name','index','map','SquareDetailsReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','offset','order','sort','pick','filter','where','merge','VIRTUAL','include','rows','catch','params','includeAll','options','find','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','count','limit','set','Content-Range'];(function(_0x16149d,_0x231c66){var _0x1d7a53=function(_0x484452){while(--_0x484452){_0x16149d['push'](_0x16149d['shift']());}};_0x1d7a53(++_0x231c66);}(_0xb469,0x13b));var _0x9b46=function(_0x3fefb7,_0x4f6afc){_0x3fefb7=_0x3fefb7-0x0;var _0x340aab=_0xb469[_0x3fefb7];return _0x340aab;};'use strict';var emlformat=require(_0x9b46('0x0'));var rimraf=require(_0x9b46('0x1'));var zipdir=require(_0x9b46('0x2'));var jsonpatch=require(_0x9b46('0x3'));var rp=require(_0x9b46('0x4'));var moment=require(_0x9b46('0x5'));var BPromise=require(_0x9b46('0x6'));var Mustache=require('mustache');var util=require(_0x9b46('0x7'));var path=require(_0x9b46('0x8'));var sox=require('sox');var csv=require(_0x9b46('0x9'));var ejs=require(_0x9b46('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9b46('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9b46('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x9b46('0x9'));var querystring=require(_0x9b46('0xd'));var Papa=require(_0x9b46('0xe'));var Redis=require('ioredis');var authService=require(_0x9b46('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x9b46('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9b46('0x11'))('api');var utils=require(_0x9b46('0x12'));var config=require(_0x9b46('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x9b46('0x14'))['db'];function respondWithStatusCode(_0x417df5,_0x5b65c2){_0x5b65c2=_0x5b65c2||0xcc;return function(_0x14362a){if(_0x14362a){return _0x417df5[_0x9b46('0x15')](_0x5b65c2);}return _0x417df5[_0x9b46('0x16')](_0x5b65c2)[_0x9b46('0x17')]();};}function respondWithResult(_0xa8f4ac,_0x35c5c1){_0x35c5c1=_0x35c5c1||0xc8;return function(_0x2136bc){if(_0x2136bc){return _0xa8f4ac[_0x9b46('0x16')](_0x35c5c1)[_0x9b46('0x18')](_0x2136bc);}};}function respondWithFilteredResult(_0x178293,_0xbc1ba6){return function(_0x135cc2){if(_0x135cc2){var _0x1e6911=typeof _0xbc1ba6['offset']==='undefined'&&typeof _0xbc1ba6['limit']===_0x9b46('0x19');var _0x5a380c=_0x135cc2[_0x9b46('0x1a')];var _0x5c5cc9=_0x1e6911?0x0:_0xbc1ba6['offset'];var _0x3d9efa=_0x1e6911?_0x135cc2['count']:_0xbc1ba6['offset']+_0xbc1ba6[_0x9b46('0x1b')];var _0x3a15cc;if(_0x3d9efa>=_0x5a380c){_0x3d9efa=_0x5a380c;_0x3a15cc=0xc8;}else{_0x3a15cc=0xce;}_0x178293['status'](_0x3a15cc);return _0x178293[_0x9b46('0x1c')](_0x9b46('0x1d'),_0x5c5cc9+'-'+_0x3d9efa+'/'+_0x5a380c)['json'](_0x135cc2);}return null;};}function patchUpdates(_0x55aece){return function(_0xbec2ea){try{jsonpatch[_0x9b46('0x1e')](_0xbec2ea,_0x55aece,!![]);}catch(_0x204098){return BPromise['reject'](_0x204098);}return _0xbec2ea['save']();};}function saveUpdates(_0x2b3440,_0x51d2ca){return function(_0x21dacb){if(_0x21dacb){return _0x21dacb[_0x9b46('0x1f')](_0x2b3440)['then'](function(_0xadff19){return _0xadff19;});}return null;};}function removeEntity(_0x5182b1,_0x141cb6){return function(_0x2b6f72){if(_0x2b6f72){return _0x2b6f72['destroy']()[_0x9b46('0x20')](function(){_0x5182b1[_0x9b46('0x16')](0xcc)[_0x9b46('0x17')]();});}};}function handleEntityNotFound(_0x319930,_0x33ea06){return function(_0x3e4899){if(!_0x3e4899){_0x319930[_0x9b46('0x15')](0x194);}return _0x3e4899;};}function handleError(_0x5dc377,_0xdd756c){_0xdd756c=_0xdd756c||0x1f4;return function(_0x3ac37e){logger[_0x9b46('0x21')](_0x3ac37e[_0x9b46('0x22')]);if(_0x3ac37e[_0x9b46('0x23')]){delete _0x3ac37e[_0x9b46('0x23')];}_0x5dc377[_0x9b46('0x16')](_0xdd756c)['send'](_0x3ac37e);};}exports[_0x9b46('0x24')]=function(_0xee519e,_0x3630bf){var _0x376ccc={},_0x28b289={},_0x869993={'count':0x0,'rows':[]};var _0xc062ec=_[_0x9b46('0x25')](db[_0x9b46('0x26')][_0x9b46('0x27')],function(_0x2e1c51){return{'name':_0x2e1c51['fieldName'],'type':_0x2e1c51[_0x9b46('0x28')][_0x9b46('0x29')]};});_0x28b289[_0x9b46('0x2a')]=_[_0x9b46('0x25')](_0xc062ec,_0x9b46('0x23'));_0x28b289[_0x9b46('0x2b')]=_[_0x9b46('0x2c')](_0xee519e[_0x9b46('0x2b')]);_0x28b289[_0x9b46('0x2d')]=_[_0x9b46('0x2e')](_0x28b289[_0x9b46('0x2a')],_0x28b289['query']);_0x376ccc[_0x9b46('0x2f')]=_['intersection'](_0x28b289[_0x9b46('0x2a')],qs[_0x9b46('0x30')](_0xee519e[_0x9b46('0x2b')]['fields']));_0x376ccc[_0x9b46('0x2f')]=_0x376ccc[_0x9b46('0x2f')][_0x9b46('0x31')]?_0x376ccc[_0x9b46('0x2f')]:_0x28b289[_0x9b46('0x2a')];if(!_0xee519e['query']['hasOwnProperty'](_0x9b46('0x32'))){_0x376ccc[_0x9b46('0x1b')]=qs[_0x9b46('0x1b')](_0xee519e[_0x9b46('0x2b')]['limit']);_0x376ccc[_0x9b46('0x33')]=qs['offset'](_0xee519e[_0x9b46('0x2b')][_0x9b46('0x33')]);}_0x376ccc[_0x9b46('0x34')]=qs[_0x9b46('0x35')](_0xee519e['query'][_0x9b46('0x35')]);_0x376ccc['where']=qs[_0x9b46('0x2d')](_[_0x9b46('0x36')](_0xee519e[_0x9b46('0x2b')],_0x28b289[_0x9b46('0x2d')]),_0xc062ec);if(_0xee519e[_0x9b46('0x2b')][_0x9b46('0x37')]){_0x376ccc[_0x9b46('0x38')]=_[_0x9b46('0x39')](_0x376ccc[_0x9b46('0x38')],{'$or':_[_0x9b46('0x25')](_0xc062ec,function(_0x1c4147){if(_0x1c4147['type']!==_0x9b46('0x3a')){var _0x5aac02={};_0x5aac02[_0x1c4147[_0x9b46('0x23')]]={'$like':'%'+_0xee519e[_0x9b46('0x2b')]['filter']+'%'};return _0x5aac02;}})});}_0x376ccc=_[_0x9b46('0x39')]({},_0x376ccc,_0xee519e['options']);var _0x416538={'where':_0x376ccc['where']};return db[_0x9b46('0x26')][_0x9b46('0x1a')](_0x416538)[_0x9b46('0x20')](function(_0x22ab5d){_0x869993[_0x9b46('0x1a')]=_0x22ab5d;if(_0xee519e['query']['includeAll']){_0x376ccc[_0x9b46('0x3b')]=[{'all':!![]}];}return db['SquareDetailsReport']['findAll'](_0x376ccc);})['then'](function(_0x4e1911){_0x869993[_0x9b46('0x3c')]=_0x4e1911;return _0x869993;})['then'](respondWithFilteredResult(_0x3630bf,_0x376ccc))[_0x9b46('0x3d')](handleError(_0x3630bf,null));};exports['show']=function(_0x3fa46c,_0xe807bf){var _0x2e92aa={'raw':!![],'where':{'id':_0x3fa46c[_0x9b46('0x3e')]['id']}},_0xa14b={};_0xa14b[_0x9b46('0x2a')]=_[_0x9b46('0x2c')](db[_0x9b46('0x26')][_0x9b46('0x27')]);_0xa14b['query']=_[_0x9b46('0x2c')](_0x3fa46c[_0x9b46('0x2b')]);_0xa14b[_0x9b46('0x2d')]=_[_0x9b46('0x2e')](_0xa14b[_0x9b46('0x2a')],_0xa14b[_0x9b46('0x2b')]);_0x2e92aa[_0x9b46('0x2f')]=_[_0x9b46('0x2e')](_0xa14b[_0x9b46('0x2a')],qs[_0x9b46('0x30')](_0x3fa46c[_0x9b46('0x2b')][_0x9b46('0x30')]));_0x2e92aa[_0x9b46('0x2f')]=_0x2e92aa[_0x9b46('0x2f')]['length']?_0x2e92aa['attributes']:_0xa14b[_0x9b46('0x2a')];if(_0x3fa46c[_0x9b46('0x2b')][_0x9b46('0x3f')]){_0x2e92aa['include']=[{'all':!![]}];}_0x2e92aa=_['merge']({},_0x2e92aa,_0x3fa46c[_0x9b46('0x40')]);return db[_0x9b46('0x26')][_0x9b46('0x41')](_0x2e92aa)[_0x9b46('0x20')](handleEntityNotFound(_0xe807bf,null))[_0x9b46('0x20')](respondWithResult(_0xe807bf,null))[_0x9b46('0x3d')](handleError(_0xe807bf,null));};exports['create']=function(_0x6d1e73,_0x32e34d){return db[_0x9b46('0x26')]['create'](_0x6d1e73[_0x9b46('0x42')],{})['then'](respondWithResult(_0x32e34d,0xc9))[_0x9b46('0x3d')](handleError(_0x32e34d,null));};exports[_0x9b46('0x1f')]=function(_0x16e6d8,_0x566bad){if(_0x16e6d8[_0x9b46('0x42')]['id']){delete _0x16e6d8[_0x9b46('0x42')]['id'];}return db[_0x9b46('0x26')][_0x9b46('0x41')]({'where':{'id':_0x16e6d8[_0x9b46('0x3e')]['id']}})[_0x9b46('0x20')](handleEntityNotFound(_0x566bad,null))['then'](saveUpdates(_0x16e6d8[_0x9b46('0x42')],null))[_0x9b46('0x20')](respondWithResult(_0x566bad,null))[_0x9b46('0x3d')](handleError(_0x566bad,null));};exports[_0x9b46('0x43')]=function(_0x362311,_0x36a492){return db['SquareDetailsReport'][_0x9b46('0x41')]({'where':{'id':_0x362311['params']['id']}})[_0x9b46('0x20')](handleEntityNotFound(_0x36a492,null))[_0x9b46('0x20')](removeEntity(_0x36a492,null))[_0x9b46('0x3d')](handleError(_0x36a492,null));};exports[_0x9b46('0x44')]=function(_0x33a2ea,_0x5f5ce9){return db[_0x9b46('0x26')][_0x9b46('0x44')]()[_0x9b46('0x20')](respondWithResult(_0x5f5ce9,null))[_0x9b46('0x3d')](handleError(_0x5f5ce9,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 217fb0d..494ef85 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 _0xe3ba=['../../config/logger','api','moment','bluebird','request-promise','rimraf','SquareDetailsReport','lodash','util'];(function(_0x3cea78,_0x4a6751){var _0x33b66b=function(_0x1f45cd){while(--_0x1f45cd){_0x3cea78['push'](_0x3cea78['shift']());}};_0x33b66b(++_0x4a6751);}(_0xe3ba,0x1d2));var _0xae3b=function(_0x5e2c70,_0x108e64){_0x5e2c70=_0x5e2c70-0x0;var _0x1e6cbc=_0xe3ba[_0x5e2c70];return _0x1e6cbc;};'use strict';var _=require(_0xae3b('0x0'));var util=require(_0xae3b('0x1'));var logger=require(_0xae3b('0x2'))(_0xae3b('0x3'));var moment=require(_0xae3b('0x4'));var BPromise=require(_0xae3b('0x5'));var rp=require(_0xae3b('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xae3b('0x7'));var config=require('../../config/environment');var attributes=require('./squareReportDetail.attributes');module['exports']=function(_0x4865fd,_0x27f02e){return _0x4865fd['define'](_0xae3b('0x8'),attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xece9=['../../config/environment','./squareReportDetail.attributes','exports','define','SquareDetailsReport','report_square_details','lodash','api','moment','bluebird','path'];(function(_0x2e603f,_0x2851eb){var _0x21ef91=function(_0x494eff){while(--_0x494eff){_0x2e603f['push'](_0x2e603f['shift']());}};_0x21ef91(++_0x2851eb);}(_0xece9,0x1c9));var _0x9ece=function(_0x34f8e4,_0x40394f){_0x34f8e4=_0x34f8e4-0x0;var _0x4b3659=_0xece9[_0x34f8e4];return _0x4b3659;};'use strict';var _=require(_0x9ece('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x9ece('0x1'));var moment=require(_0x9ece('0x2'));var BPromise=require(_0x9ece('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9ece('0x4'));var rimraf=require('rimraf');var config=require(_0x9ece('0x5'));var attributes=require(_0x9ece('0x6'));module[_0x9ece('0x7')]=function(_0x56d1c6,_0x1ff49b){return _0x56d1c6[_0x9ece('0x8')](_0x9ece('0x9'),attributes,{'tableName':_0x9ece('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index 0b8f7d3..b4ff026 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 _0x5ed9=['stringify','error','code','message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','raw','then','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','info','SquareDetailsReport,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x22bae4,_0x22474b){var _0x2047b6=function(_0x849589){while(--_0x849589){_0x22bae4['push'](_0x22bae4['shift']());}};_0x2047b6(++_0x22474b);}(_0x5ed9,0x1e9));var _0x95ed=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x5ed9[_0x4c12ec];return _0x3ae42c;};'use strict';var _=require(_0x95ed('0x0'));var util=require(_0x95ed('0x1'));var moment=require('moment');var BPromise=require(_0x95ed('0x2'));var rs=require(_0x95ed('0x3'));var fs=require('fs');var Redis=require(_0x95ed('0x4'));var db=require(_0x95ed('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x95ed('0x6'))(_0x95ed('0x7'));var config=require(_0x95ed('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x95ed('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32bf25,_0xaa1eb1,_0x3753b5){return new BPromise(function(_0x1df51f,_0x46ed43){return client[_0x95ed('0xa')](_0x32bf25,_0x3753b5)['then'](function(_0x2b59f5){logger[_0x95ed('0xb')](_0x95ed('0xc'),_0xaa1eb1,'request\x20sent');logger[_0x95ed('0xd')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0xaa1eb1,_0x95ed('0xe'),JSON[_0x95ed('0xf')](_0x2b59f5));if(_0x2b59f5[_0x95ed('0x10')]){if(_0x2b59f5[_0x95ed('0x10')][_0x95ed('0x11')]===0x1f4){logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0xaa1eb1,_0x2b59f5[_0x95ed('0x10')][_0x95ed('0x12')]);return _0x46ed43(_0x2b59f5['error']['message']);}logger[_0x95ed('0x10')](_0x95ed('0xc'),_0xaa1eb1,_0x2b59f5[_0x95ed('0x10')][_0x95ed('0x12')]);return _0x1df51f(_0x2b59f5['error'][_0x95ed('0x12')]);}else{logger[_0x95ed('0xb')](_0x95ed('0xc'),_0xaa1eb1,_0x95ed('0xe'));_0x1df51f(_0x2b59f5[_0x95ed('0x13')]['message']);}})[_0x95ed('0x14')](function(_0x54ad78){logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0xaa1eb1,_0x54ad78);_0x46ed43(_0x54ad78);});});}exports[_0x95ed('0x15')]=function(_0x58fb9e){var _0x421ab9=this;return new Promise(function(_0x1bc47c,_0x4ad26d){return db[_0x95ed('0x16')][_0x95ed('0x17')](_0x58fb9e[_0x95ed('0x18')],{'raw':_0x58fb9e[_0x95ed('0x19')]?_0x58fb9e[_0x95ed('0x19')][_0x95ed('0x1a')]===undefined?!![]:![]:!![]})[_0x95ed('0x1b')](function(_0x3e05cf){logger[_0x95ed('0xb')](_0x95ed('0x15'),_0x58fb9e);logger['debug'](_0x95ed('0x15'),_0x58fb9e,JSON[_0x95ed('0xf')](_0x3e05cf));_0x1bc47c(_0x3e05cf);})['catch'](function(_0x5d5afe){logger['error'](_0x95ed('0x15'),_0x5d5afe[_0x95ed('0x12')],_0x58fb9e);_0x4ad26d(_0x421ab9[_0x95ed('0x10')](0x1f4,_0x5d5afe[_0x95ed('0x12')]));});});}; \ No newline at end of file +var _0x25e7=['SquareDetailsReport','create','body','options','raw','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateSquareDetailsReport'];(function(_0x28d225,_0x43be18){var _0x1f79e1=function(_0x362c23){while(--_0x362c23){_0x28d225['push'](_0x28d225['shift']());}};_0x1f79e1(++_0x43be18);}(_0x25e7,0x1d6));var _0x725e=function(_0x517a86,_0x1b0466){_0x517a86=_0x517a86-0x0;var _0x5abb1c=_0x25e7[_0x517a86];return _0x5abb1c;};'use strict';var _=require(_0x725e('0x0'));var util=require(_0x725e('0x1'));var moment=require(_0x725e('0x2'));var BPromise=require(_0x725e('0x3'));var rs=require(_0x725e('0x4'));var fs=require('fs');var Redis=require(_0x725e('0x5'));var db=require(_0x725e('0x6'))['db'];var utils=require(_0x725e('0x7'));var logger=require(_0x725e('0x8'))(_0x725e('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x725e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x481316,_0x111a50,_0x192c27){return new BPromise(function(_0x216b33,_0x67de0c){return client[_0x725e('0xb')](_0x481316,_0x192c27)[_0x725e('0xc')](function(_0x39858a){logger[_0x725e('0xd')](_0x725e('0xe'),_0x111a50,_0x725e('0xf'));logger[_0x725e('0x10')](_0x725e('0x11'),_0x111a50,'request\x20sent',JSON['stringify'](_0x39858a));if(_0x39858a[_0x725e('0x12')]){if(_0x39858a[_0x725e('0x12')]['code']===0x1f4){logger['error'](_0x725e('0xe'),_0x111a50,_0x39858a[_0x725e('0x12')]['message']);return _0x67de0c(_0x39858a[_0x725e('0x12')][_0x725e('0x13')]);}logger[_0x725e('0x12')]('SquareDetailsReport,\x20%s,\x20%s',_0x111a50,_0x39858a[_0x725e('0x12')][_0x725e('0x13')]);return _0x216b33(_0x39858a[_0x725e('0x12')][_0x725e('0x13')]);}else{logger[_0x725e('0xd')](_0x725e('0xe'),_0x111a50,'request\x20sent');_0x216b33(_0x39858a[_0x725e('0x14')][_0x725e('0x13')]);}})[_0x725e('0x15')](function(_0x54ac0f){logger[_0x725e('0x12')](_0x725e('0xe'),_0x111a50,_0x54ac0f);_0x67de0c(_0x54ac0f);});});}exports[_0x725e('0x16')]=function(_0x397e33){var _0x268438=this;return new Promise(function(_0x2811e7,_0x528e7d){return db[_0x725e('0x17')][_0x725e('0x18')](_0x397e33[_0x725e('0x19')],{'raw':_0x397e33[_0x725e('0x1a')]?_0x397e33[_0x725e('0x1a')][_0x725e('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x2fc416){logger[_0x725e('0xd')](_0x725e('0x16'),_0x397e33);logger[_0x725e('0x10')](_0x725e('0x16'),_0x397e33,JSON[_0x725e('0x1c')](_0x2fc416));_0x2811e7(_0x2fc416);})[_0x725e('0x15')](function(_0x262b01){logger[_0x725e('0x12')]('CreateSquareDetailsReport',_0x262b01[_0x725e('0x13')],_0x397e33);_0x528e7d(_0x268438[_0x725e('0x12')](0x1f4,_0x262b01[_0x725e('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 40f1f87..0eeea04 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 _0x470a=['/process/:pid/kill','killProcess','exports','express','Router','./system.controller','isAuthenticated'];(function(_0x1e6832,_0x338e23){var _0x12efbf=function(_0x5013b1){while(--_0x5013b1){_0x1e6832['push'](_0x1e6832['shift']());}};_0x12efbf(++_0x338e23);}(_0x470a,0x8f));var _0xa470=function(_0x49ff2a,_0x39ede5){_0x49ff2a=_0x49ff2a-0x0;var _0xb68884=_0x470a[_0x49ff2a];return _0xb68884;};'use strict';var express=require(_0xa470('0x0'));var router=express[_0xa470('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xa470('0x2'));router['get']('/',auth[_0xa470('0x3')](),controller['index']);router['get'](_0xa470('0x4'),auth[_0xa470('0x3')](),controller[_0xa470('0x5')]);module[_0xa470('0x6')]=router; \ No newline at end of file +var _0xaaf5=['/process/:pid/kill','killProcess','express','Router','../../components/auth/service','index','get'];(function(_0x8550ba,_0x57c10d){var _0x432399=function(_0x33ab8a){while(--_0x33ab8a){_0x8550ba['push'](_0x8550ba['shift']());}};_0x432399(++_0x57c10d);}(_0xaaf5,0x128));var _0x5aaf=function(_0x50e293,_0x521a69){_0x50e293=_0x50e293-0x0;var _0x39eaea=_0xaaf5[_0x50e293];return _0x39eaea;};'use strict';var express=require(_0x5aaf('0x0'));var router=express[_0x5aaf('0x1')]();var auth=require(_0x5aaf('0x2'));var controller=require('./system.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x5aaf('0x3')]);router[_0x5aaf('0x4')](_0x5aaf('0x5'),auth['isAuthenticated'](),controller[_0x5aaf('0x6')]);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 28b6c87..7c7a81f 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 _0x9c45=['<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','index','getAllData','then','json','catch','killProcess','format','params','pid','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec','../../config/logger','util','bluebird','error'];(function(_0x515792,_0x5f1501){var _0x998f5b=function(_0x3f2b0a){while(--_0x3f2b0a){_0x515792['push'](_0x515792['shift']());}};_0x998f5b(++_0x5f1501);}(_0x9c45,0xb6));var _0x59c4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c45[_0x3dd15e];return _0x231fd0;};'use strict';var info=require(_0x59c4('0x0'));var exec=require(_0x59c4('0x1'))[_0x59c4('0x2')];var logger=require(_0x59c4('0x3'))('api');var util=require(_0x59c4('0x4'));var BPromise=require(_0x59c4('0x5'));var _=require('lodash');function handleError(_0x1754c5,_0x41a5a1,_0x55dc35){_0x41a5a1=_0x41a5a1||0x1f4;return function(_0x2339f9){logger[_0x59c4('0x6')](_0x59c4('0x7'),_0x55dc35,_0x41a5a1,util[_0x59c4('0x8')](_0x2339f9,{'showHidden':![],'depth':null}));delete _0x2339f9[_0x59c4('0x9')];_0x1754c5[_0x59c4('0xa')](_0x41a5a1)[_0x59c4('0xb')](_0x2339f9);};}exports[_0x59c4('0xc')]=function(_0xbaed44,_0xbe236c){return info[_0x59c4('0xd')]()[_0x59c4('0xe')](function(_0xe61e89){return _0xbe236c[_0x59c4('0xa')](0xc8)[_0x59c4('0xf')](_0xe61e89);})[_0x59c4('0x10')](function(_0x396398){return _0xbe236c[_0x59c4('0xa')](0x1f4)[_0x59c4('0xf')](_0x396398);});};exports[_0x59c4('0x11')]=function(_0x383ebe,_0x3c93e8){var _0x538304=['components/import/cm'];return new BPromise(function(_0x1b5b83,_0x2af422){return exec(util[_0x59c4('0x12')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x383ebe[_0x59c4('0x13')][_0x59c4('0x14')]),function(_0x132834,_0x58274e,_0x333e96){if(_0x132834){return _0x2af422(_0x132834);}return _0x1b5b83(_0x58274e);});})[_0x59c4('0xe')](function(_0x360aa7){var _0x28e7ad=![];var _0x12fbdb=_0x360aa7[_0x59c4('0x15')](/\n/);for(var _0x2d496c=0x0,_0x45160c=_0x538304[_0x59c4('0x16')];_0x2d496c<_0x45160c,_0x28e7ad===![];_0x2d496c+=0x1){if(_0x360aa7[_0x59c4('0x17')](_0x538304[_0x2d496c])>=0x0){_0x28e7ad=!![];}}if(!_0x28e7ad){throw new Error(util[_0x59c4('0x12')](_0x59c4('0x18'),_0x383ebe[_0x59c4('0x13')][_0x59c4('0x14')]));}process[_0x59c4('0x19')](_0x383ebe[_0x59c4('0x13')][_0x59c4('0x14')],'SIGINT');return _0x3c93e8[_0x59c4('0xa')](0xc8)[_0x59c4('0xf')]({'message':util[_0x59c4('0x12')](_0x59c4('0x1a'),_0x383ebe[_0x59c4('0x13')][_0x59c4('0x14')])});})[_0x59c4('0x10')](handleError(_0x3c93e8,null,'killProcess'));}; \ No newline at end of file +var _0xc304=['name','status','send','getAllData','then','json','killProcess','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','catch','child_process','exec','../../config/logger','api','util','bluebird','lodash','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s'];(function(_0x5c3505,_0x3770ce){var _0x5eec90=function(_0x34157c){while(--_0x34157c){_0x5c3505['push'](_0x5c3505['shift']());}};_0x5eec90(++_0x3770ce);}(_0xc304,0x94));var _0x4c30=function(_0x74892f,_0x1e981b){_0x74892f=_0x74892f-0x0;var _0x10ee61=_0xc304[_0x74892f];return _0x10ee61;};'use strict';var info=require('systeminformation');var exec=require(_0x4c30('0x0'))[_0x4c30('0x1')];var logger=require(_0x4c30('0x2'))(_0x4c30('0x3'));var util=require(_0x4c30('0x4'));var BPromise=require(_0x4c30('0x5'));var _=require(_0x4c30('0x6'));function handleError(_0x375b92,_0xf9c878,_0x210e5a){_0xf9c878=_0xf9c878||0x1f4;return function(_0xb550e1){logger['error'](_0x4c30('0x7'),_0x210e5a,_0xf9c878,util['inspect'](_0xb550e1,{'showHidden':![],'depth':null}));delete _0xb550e1[_0x4c30('0x8')];_0x375b92[_0x4c30('0x9')](_0xf9c878)[_0x4c30('0xa')](_0xb550e1);};}exports['index']=function(_0x4937a3,_0x3075cd){return info[_0x4c30('0xb')]()[_0x4c30('0xc')](function(_0x41fe01){return _0x3075cd[_0x4c30('0x9')](0xc8)[_0x4c30('0xd')](_0x41fe01);})['catch'](function(_0x2b2091){return _0x3075cd[_0x4c30('0x9')](0x1f4)[_0x4c30('0xd')](_0x2b2091);});};exports[_0x4c30('0xe')]=function(_0x213c5d,_0x222f1b){var _0x5505f9=['components/import/cm'];return new BPromise(function(_0x3b471c,_0x9276d9){return exec(util[_0x4c30('0xf')](_0x4c30('0x10'),_0x213c5d[_0x4c30('0x11')][_0x4c30('0x12')]),function(_0x388eeb,_0x442462,_0xd5df2b){if(_0x388eeb){return _0x9276d9(_0x388eeb);}return _0x3b471c(_0x442462);});})[_0x4c30('0xc')](function(_0x4a3986){var _0x433b9e=![];var _0x2691a5=_0x4a3986[_0x4c30('0x13')](/\n/);for(var _0x30d7d4=0x0,_0xac82a3=_0x5505f9[_0x4c30('0x14')];_0x30d7d4<_0xac82a3,_0x433b9e===![];_0x30d7d4+=0x1){if(_0x4a3986[_0x4c30('0x15')](_0x5505f9[_0x30d7d4])>=0x0){_0x433b9e=!![];}}if(!_0x433b9e){throw new Error(util[_0x4c30('0xf')](_0x4c30('0x16'),_0x213c5d[_0x4c30('0x11')][_0x4c30('0x12')]));}process['kill'](_0x213c5d[_0x4c30('0x11')][_0x4c30('0x12')],_0x4c30('0x17'));return _0x222f1b[_0x4c30('0x9')](0xc8)['json']({'message':util[_0x4c30('0xf')](_0x4c30('0x18'),_0x213c5d[_0x4c30('0x11')][_0x4c30('0x12')])});})[_0x4c30('0x19')](handleError(_0x222f1b,null,'killProcess'));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index ab222af..856e571 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 _0x1a95=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated','index','show','post','put','/:id','update','delete','exports','multer','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1a95,0x130));var _0x51a9=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x1a95[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x51a9('0x0'));var util=require('util');var path=require(_0x51a9('0x1'));var timeout=require('connect-timeout');var express=require(_0x51a9('0x2'));var router=express[_0x51a9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x51a9('0x4'));var interaction=require(_0x51a9('0x5'));var config=require(_0x51a9('0x6'));var controller=require(_0x51a9('0x7'));router[_0x51a9('0x8')]('/',auth[_0x51a9('0x9')](),controller[_0x51a9('0xa')]);router['get']('/:id',auth[_0x51a9('0x9')](),controller[_0x51a9('0xb')]);router[_0x51a9('0xc')]('/',auth[_0x51a9('0x9')](),controller['create']);router[_0x51a9('0xd')](_0x51a9('0xe'),auth[_0x51a9('0x9')](),controller[_0x51a9('0xf')]);router[_0x51a9('0x10')](_0x51a9('0xe'),auth[_0x51a9('0x9')](),controller['destroy']);module[_0x51a9('0x11')]=router; \ No newline at end of file +var _0x9a1b=['index','get','show','post','create','update','delete','/:id','destroy','exports','multer','express','Router','fs-extra','../../components/auth/service','../../config/environment','./tag.controller','isAuthenticated'];(function(_0x119850,_0x38b73c){var _0x3d20a2=function(_0x227453){while(--_0x227453){_0x119850['push'](_0x119850['shift']());}};_0x3d20a2(++_0x38b73c);}(_0x9a1b,0x1ba));var _0xb9a1=function(_0x44cb68,_0x3ca3f2){_0x44cb68=_0x44cb68-0x0;var _0x4a42c2=_0x9a1b[_0x44cb68];return _0x4a42c2;};'use strict';var multer=require(_0xb9a1('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb9a1('0x1'));var router=express[_0xb9a1('0x2')]();var fs_extra=require(_0xb9a1('0x3'));var auth=require(_0xb9a1('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xb9a1('0x5'));var controller=require(_0xb9a1('0x6'));router['get']('/',auth[_0xb9a1('0x7')](),controller[_0xb9a1('0x8')]);router[_0xb9a1('0x9')]('/:id',auth[_0xb9a1('0x7')](),controller[_0xb9a1('0xa')]);router[_0xb9a1('0xb')]('/',auth[_0xb9a1('0x7')](),controller[_0xb9a1('0xc')]);router['put']('/:id',auth[_0xb9a1('0x7')](),controller[_0xb9a1('0xd')]);router[_0xb9a1('0xe')](_0xb9a1('0xf'),auth[_0xb9a1('0x7')](),controller[_0xb9a1('0x10')]);module[_0xb9a1('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 0f8974e..c706693 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 _0x2e21=['sequelize','exports','STRING'];(function(_0x461c64,_0x426ab6){var _0x2dea4f=function(_0xf4bd99){while(--_0xf4bd99){_0x461c64['push'](_0x461c64['shift']());}};_0x2dea4f(++_0x426ab6);}(_0x2e21,0xba));var _0x12e2=function(_0x13536e,_0x20b162){_0x13536e=_0x13536e-0x0;var _0x24ec5d=_0x2e21[_0x13536e];return _0x24ec5d;};'use strict';var Sequelize=require(_0x12e2('0x0'));module[_0x12e2('0x1')]={'name':{'type':Sequelize[_0x12e2('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x12e2('0x2')],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0x12e2('0x2')]}}; \ No newline at end of file +var _0x5a1c=['exports','STRING','sequelize'];(function(_0x7ae1c1,_0x450f63){var _0x548ff0=function(_0x112c1f){while(--_0x112c1f){_0x7ae1c1['push'](_0x7ae1c1['shift']());}};_0x548ff0(++_0x450f63);}(_0x5a1c,0x1b5));var _0xc5a1=function(_0x208897,_0x1cfafc){_0x208897=_0x208897-0x0;var _0x1fed9e=_0x5a1c[_0x208897];return _0x1fed9e;};'use strict';var Sequelize=require(_0xc5a1('0x0'));module[_0xc5a1('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xc5a1('0x2')],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0xc5a1('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 2fd5756..f7bc1e5 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 _0xca66=['limit','count','set','Content-Range','json','apply','reject','save','update','destroy','then','get','Tags','UserProfileResource','sendStatus','error','name','index','map','Tag','fieldName','type','key','query','filters','intersection','attributes','model','fields','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','keys','rawAttributes','length','include','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','eml-format','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined'];(function(_0x17bb31,_0x2fc6f8){var _0x505c71=function(_0x5013cf){while(--_0x5013cf){_0x17bb31['push'](_0x17bb31['shift']());}};_0x505c71(++_0x2fc6f8);}(_0xca66,0x8b));var _0x6ca6=function(_0xbc8199,_0x190329){_0xbc8199=_0xbc8199-0x0;var _0x2db173=_0xca66[_0xbc8199];return _0x2db173;};'use strict';var emlformat=require(_0x6ca6('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6ca6('0x1'));var rp=require(_0x6ca6('0x2'));var moment=require(_0x6ca6('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x6ca6('0x4'));var util=require('util');var path=require(_0x6ca6('0x5'));var sox=require('sox');var csv=require(_0x6ca6('0x6'));var ejs=require(_0x6ca6('0x7'));var fs=require('fs');var fs_extra=require(_0x6ca6('0x8'));var _=require(_0x6ca6('0x9'));var squel=require(_0x6ca6('0xa'));var crypto=require(_0x6ca6('0xb'));var jsforce=require(_0x6ca6('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x6ca6('0x6'));var querystring=require(_0x6ca6('0xd'));var Papa=require(_0x6ca6('0xe'));var Redis=require(_0x6ca6('0xf'));var authService=require(_0x6ca6('0x10'));var qs=require(_0x6ca6('0x11'));var as=require(_0x6ca6('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6ca6('0x13'))(_0x6ca6('0x14'));var utils=require(_0x6ca6('0x15'));var config=require(_0x6ca6('0x16'));var licenseUtil=require(_0x6ca6('0x17'));var db=require(_0x6ca6('0x18'))['db'];function respondWithStatusCode(_0x4c05e9,_0x152e63){_0x152e63=_0x152e63||0xcc;return function(_0x38de67){if(_0x38de67){return _0x4c05e9['sendStatus'](_0x152e63);}return _0x4c05e9[_0x6ca6('0x19')](_0x152e63)[_0x6ca6('0x1a')]();};}function respondWithResult(_0x3f417f,_0x3570f1){_0x3570f1=_0x3570f1||0xc8;return function(_0xc774c){if(_0xc774c){return _0x3f417f[_0x6ca6('0x19')](_0x3570f1)['json'](_0xc774c);}};}function respondWithFilteredResult(_0x52c59a,_0x5785b1){return function(_0x36ff3e){if(_0x36ff3e){var _0x19e94f=typeof _0x5785b1[_0x6ca6('0x1b')]===_0x6ca6('0x1c')&&typeof _0x5785b1[_0x6ca6('0x1d')]===_0x6ca6('0x1c');var _0x25dc6c=_0x36ff3e['count'];var _0x2391ce=_0x19e94f?0x0:_0x5785b1[_0x6ca6('0x1b')];var _0xc97f0=_0x19e94f?_0x36ff3e[_0x6ca6('0x1e')]:_0x5785b1[_0x6ca6('0x1b')]+_0x5785b1[_0x6ca6('0x1d')];var _0x16a3d7;if(_0xc97f0>=_0x25dc6c){_0xc97f0=_0x25dc6c;_0x16a3d7=0xc8;}else{_0x16a3d7=0xce;}_0x52c59a[_0x6ca6('0x19')](_0x16a3d7);return _0x52c59a[_0x6ca6('0x1f')](_0x6ca6('0x20'),_0x2391ce+'-'+_0xc97f0+'/'+_0x25dc6c)[_0x6ca6('0x21')](_0x36ff3e);}return null;};}function patchUpdates(_0x4c3be9){return function(_0x28a982){try{jsonpatch[_0x6ca6('0x22')](_0x28a982,_0x4c3be9,!![]);}catch(_0x38cad4){return BPromise[_0x6ca6('0x23')](_0x38cad4);}return _0x28a982[_0x6ca6('0x24')]();};}function saveUpdates(_0x438694,_0x593f15){return function(_0xfb962d){if(_0xfb962d){return _0xfb962d[_0x6ca6('0x25')](_0x438694)['then'](function(_0x4927c1){return _0x4927c1;});}return null;};}function removeEntity(_0xfbf496,_0x216701){return function(_0xfe0760){if(_0xfe0760){return _0xfe0760[_0x6ca6('0x26')]()[_0x6ca6('0x27')](function(){var _0x541122=_0xfe0760[_0x6ca6('0x28')]({'plain':!![]});var _0x1d6caa=_0x6ca6('0x29');return db[_0x6ca6('0x2a')][_0x6ca6('0x26')]({'where':{'type':_0x1d6caa,'resourceId':_0x541122['id']}})[_0x6ca6('0x27')](function(){return _0xfe0760;});})[_0x6ca6('0x27')](function(){_0xfbf496[_0x6ca6('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x55b07f,_0x144ec5){return function(_0x9467bd){if(!_0x9467bd){_0x55b07f[_0x6ca6('0x2b')](0x194);}return _0x9467bd;};}function handleError(_0x141c0f,_0x552f3e){_0x552f3e=_0x552f3e||0x1f4;return function(_0x5ea6f7){logger[_0x6ca6('0x2c')](_0x5ea6f7['stack']);if(_0x5ea6f7['name']){delete _0x5ea6f7[_0x6ca6('0x2d')];}_0x141c0f[_0x6ca6('0x19')](_0x552f3e)['send'](_0x5ea6f7);};}exports[_0x6ca6('0x2e')]=function(_0xf829ee,_0xac50e8){var _0x566543={},_0x484411={},_0x28af50={'count':0x0,'rows':[]};var _0x23112a=_[_0x6ca6('0x2f')](db[_0x6ca6('0x30')]['rawAttributes'],function(_0x467a89){return{'name':_0x467a89[_0x6ca6('0x31')],'type':_0x467a89[_0x6ca6('0x32')][_0x6ca6('0x33')]};});_0x484411['model']=_['map'](_0x23112a,'name');_0x484411['query']=_['keys'](_0xf829ee[_0x6ca6('0x34')]);_0x484411[_0x6ca6('0x35')]=_[_0x6ca6('0x36')](_0x484411['model'],_0x484411[_0x6ca6('0x34')]);_0x566543[_0x6ca6('0x37')]=_[_0x6ca6('0x36')](_0x484411[_0x6ca6('0x38')],qs['fields'](_0xf829ee[_0x6ca6('0x34')][_0x6ca6('0x39')]));_0x566543[_0x6ca6('0x37')]=_0x566543[_0x6ca6('0x37')]['length']?_0x566543[_0x6ca6('0x37')]:_0x484411['model'];if(!_0xf829ee[_0x6ca6('0x34')]['hasOwnProperty']('nolimit')){_0x566543[_0x6ca6('0x1d')]=qs[_0x6ca6('0x1d')](_0xf829ee[_0x6ca6('0x34')][_0x6ca6('0x1d')]);_0x566543['offset']=qs['offset'](_0xf829ee[_0x6ca6('0x34')][_0x6ca6('0x1b')]);}_0x566543['order']=qs[_0x6ca6('0x3a')](_0xf829ee['query'][_0x6ca6('0x3a')]);_0x566543['where']=qs[_0x6ca6('0x35')](_[_0x6ca6('0x3b')](_0xf829ee[_0x6ca6('0x34')],_0x484411[_0x6ca6('0x35')]),_0x23112a);if(_0xf829ee[_0x6ca6('0x34')][_0x6ca6('0x3c')]){_0x566543[_0x6ca6('0x3d')]=_[_0x6ca6('0x3e')](_0x566543['where'],{'$or':_[_0x6ca6('0x2f')](_0x23112a,function(_0x4ac816){if(_0x4ac816['type']!==_0x6ca6('0x3f')){var _0x306eda={};_0x306eda[_0x4ac816['name']]={'$like':'%'+_0xf829ee[_0x6ca6('0x34')]['filter']+'%'};return _0x306eda;}})});}_0x566543=_[_0x6ca6('0x3e')]({},_0x566543,_0xf829ee[_0x6ca6('0x40')]);var _0x3f9e8f={'where':_0x566543[_0x6ca6('0x3d')]};return db['Tag']['count'](_0x3f9e8f)[_0x6ca6('0x27')](function(_0x3813d6){_0x28af50[_0x6ca6('0x1e')]=_0x3813d6;if(_0xf829ee[_0x6ca6('0x34')][_0x6ca6('0x41')]){_0x566543['include']=[{'all':!![]}];}return db[_0x6ca6('0x30')][_0x6ca6('0x42')](_0x566543);})['then'](function(_0x317b5e){_0x28af50[_0x6ca6('0x43')]=_0x317b5e;return _0x28af50;})[_0x6ca6('0x27')](respondWithFilteredResult(_0xac50e8,_0x566543))[_0x6ca6('0x44')](handleError(_0xac50e8,null));};exports[_0x6ca6('0x45')]=function(_0x3e658e,_0x258c76){var _0xe9bce9={'raw':!![],'where':{'id':_0x3e658e['params']['id']}},_0x1a8b7e={};_0x1a8b7e[_0x6ca6('0x38')]=_[_0x6ca6('0x46')](db[_0x6ca6('0x30')][_0x6ca6('0x47')]);_0x1a8b7e[_0x6ca6('0x34')]=_[_0x6ca6('0x46')](_0x3e658e[_0x6ca6('0x34')]);_0x1a8b7e[_0x6ca6('0x35')]=_['intersection'](_0x1a8b7e['model'],_0x1a8b7e[_0x6ca6('0x34')]);_0xe9bce9[_0x6ca6('0x37')]=_[_0x6ca6('0x36')](_0x1a8b7e[_0x6ca6('0x38')],qs[_0x6ca6('0x39')](_0x3e658e[_0x6ca6('0x34')][_0x6ca6('0x39')]));_0xe9bce9['attributes']=_0xe9bce9['attributes'][_0x6ca6('0x48')]?_0xe9bce9[_0x6ca6('0x37')]:_0x1a8b7e['model'];if(_0x3e658e[_0x6ca6('0x34')][_0x6ca6('0x41')]){_0xe9bce9[_0x6ca6('0x49')]=[{'all':!![]}];}_0xe9bce9=_[_0x6ca6('0x3e')]({},_0xe9bce9,_0x3e658e[_0x6ca6('0x40')]);return db[_0x6ca6('0x30')][_0x6ca6('0x4a')](_0xe9bce9)['then'](handleEntityNotFound(_0x258c76,null))[_0x6ca6('0x27')](respondWithResult(_0x258c76,null))[_0x6ca6('0x44')](handleError(_0x258c76,null));};exports[_0x6ca6('0x4b')]=function(_0x4fde51,_0x408df3){return db['Tag'][_0x6ca6('0x4b')](_0x4fde51['body'],{})['then'](function(_0x5da714){var _0x199489=_0x4fde51[_0x6ca6('0x4c')][_0x6ca6('0x28')]({'plain':!![]});if(!_0x199489)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x199489[_0x6ca6('0x4d')]==='user'){var _0x1f552d=_0x5da714[_0x6ca6('0x28')]({'plain':!![]});var _0xe0b775=_0x6ca6('0x29');return db[_0x6ca6('0x4e')][_0x6ca6('0x4a')]({'where':{'name':_0xe0b775,'userProfileId':_0x199489[_0x6ca6('0x4f')]},'raw':!![]})[_0x6ca6('0x27')](function(_0x2bd33e){if(_0x2bd33e&&_0x2bd33e[_0x6ca6('0x50')]===0x0){return db[_0x6ca6('0x2a')]['create']({'name':_0x1f552d[_0x6ca6('0x2d')],'resourceId':_0x1f552d['id'],'type':_0x2bd33e[_0x6ca6('0x2d')],'sectionId':_0x2bd33e['id']},{})[_0x6ca6('0x27')](function(){return _0x5da714;});}else{return _0x5da714;}})[_0x6ca6('0x44')](function(_0x11fda2){logger['error'](_0x6ca6('0x51'),_0x11fda2);throw _0x11fda2;});}return _0x5da714;})[_0x6ca6('0x27')](respondWithResult(_0x408df3,0xc9))[_0x6ca6('0x44')](handleError(_0x408df3,null));};exports['update']=function(_0x5490ce,_0x4fe7a9){if(_0x5490ce['body']['id']){delete _0x5490ce[_0x6ca6('0x52')]['id'];}return db[_0x6ca6('0x30')][_0x6ca6('0x4a')]({'where':{'id':_0x5490ce['params']['id']}})['then'](handleEntityNotFound(_0x4fe7a9,null))[_0x6ca6('0x27')](saveUpdates(_0x5490ce[_0x6ca6('0x52')],null))[_0x6ca6('0x27')](respondWithResult(_0x4fe7a9,null))['catch'](handleError(_0x4fe7a9,null));};exports[_0x6ca6('0x26')]=function(_0x57880d,_0x281759){return db[_0x6ca6('0x30')][_0x6ca6('0x4a')]({'where':{'id':_0x57880d[_0x6ca6('0x53')]['id']}})['then'](handleEntityNotFound(_0x281759,null))[_0x6ca6('0x27')](removeEntity(_0x281759,null))['catch'](handleError(_0x281759,null));}; \ No newline at end of file +var _0x5089=['index','map','rawAttributes','fieldName','type','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','Tag','findAll','catch','show','params','keys','includeAll','find','create','user','Tags','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','get','UserProfileResource','error','stack','name','send'];(function(_0x15da95,_0x2a6b25){var _0x5cfdc5=function(_0x3c899e){while(--_0x3c899e){_0x15da95['push'](_0x15da95['shift']());}};_0x5cfdc5(++_0x2a6b25);}(_0x5089,0x1bb));var _0x9508=function(_0x5c082a,_0x19ac27){_0x5c082a=_0x5c082a-0x0;var _0x3b60ac=_0x5089[_0x5c082a];return _0x3b60ac;};'use strict';var emlformat=require(_0x9508('0x0'));var rimraf=require(_0x9508('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9508('0x2'));var rp=require(_0x9508('0x3'));var moment=require(_0x9508('0x4'));var BPromise=require(_0x9508('0x5'));var Mustache=require(_0x9508('0x6'));var util=require('util');var path=require(_0x9508('0x7'));var sox=require('sox');var csv=require(_0x9508('0x8'));var ejs=require(_0x9508('0x9'));var fs=require('fs');var fs_extra=require(_0x9508('0xa'));var _=require('lodash');var squel=require(_0x9508('0xb'));var crypto=require(_0x9508('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x9508('0xd'));var toCsv=require(_0x9508('0x8'));var querystring=require('querystring');var Papa=require(_0x9508('0xe'));var Redis=require('ioredis');var authService=require(_0x9508('0xf'));var qs=require(_0x9508('0x10'));var as=require(_0x9508('0x11'));var hardwareService=require(_0x9508('0x12'));var logger=require(_0x9508('0x13'))(_0x9508('0x14'));var utils=require('../../config/utils');var config=require(_0x9508('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x9508('0x16'))['db'];function respondWithStatusCode(_0x396896,_0x554c90){_0x554c90=_0x554c90||0xcc;return function(_0x11dc7f){if(_0x11dc7f){return _0x396896[_0x9508('0x17')](_0x554c90);}return _0x396896[_0x9508('0x18')](_0x554c90)[_0x9508('0x19')]();};}function respondWithResult(_0x51ef92,_0x440709){_0x440709=_0x440709||0xc8;return function(_0x21b2d1){if(_0x21b2d1){return _0x51ef92['status'](_0x440709)[_0x9508('0x1a')](_0x21b2d1);}};}function respondWithFilteredResult(_0x539746,_0x25d4d6){return function(_0x418889){if(_0x418889){var _0x374c03=typeof _0x25d4d6[_0x9508('0x1b')]===_0x9508('0x1c')&&typeof _0x25d4d6[_0x9508('0x1d')]===_0x9508('0x1c');var _0x20df7d=_0x418889['count'];var _0x22ba9c=_0x374c03?0x0:_0x25d4d6[_0x9508('0x1b')];var _0xfcc29d=_0x374c03?_0x418889[_0x9508('0x1e')]:_0x25d4d6[_0x9508('0x1b')]+_0x25d4d6[_0x9508('0x1d')];var _0x52e3c4;if(_0xfcc29d>=_0x20df7d){_0xfcc29d=_0x20df7d;_0x52e3c4=0xc8;}else{_0x52e3c4=0xce;}_0x539746['status'](_0x52e3c4);return _0x539746[_0x9508('0x1f')]('Content-Range',_0x22ba9c+'-'+_0xfcc29d+'/'+_0x20df7d)[_0x9508('0x1a')](_0x418889);}return null;};}function patchUpdates(_0x4e9e9f){return function(_0x3ba927){try{jsonpatch[_0x9508('0x20')](_0x3ba927,_0x4e9e9f,!![]);}catch(_0x226f29){return BPromise[_0x9508('0x21')](_0x226f29);}return _0x3ba927[_0x9508('0x22')]();};}function saveUpdates(_0x2f8106,_0x20eb53){return function(_0x5f4f0c){if(_0x5f4f0c){return _0x5f4f0c['update'](_0x2f8106)[_0x9508('0x23')](function(_0x1b70e6){return _0x1b70e6;});}return null;};}function removeEntity(_0x39e6b0,_0xf70830){return function(_0x16c54f){if(_0x16c54f){return _0x16c54f[_0x9508('0x24')]()['then'](function(){var _0x5e9a80=_0x16c54f[_0x9508('0x25')]({'plain':!![]});var _0x55cc4d='Tags';return db[_0x9508('0x26')]['destroy']({'where':{'type':_0x55cc4d,'resourceId':_0x5e9a80['id']}})['then'](function(){return _0x16c54f;});})[_0x9508('0x23')](function(){_0x39e6b0[_0x9508('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x49246b,_0x32b0dd){return function(_0x22b2e2){if(!_0x22b2e2){_0x49246b[_0x9508('0x17')](0x194);}return _0x22b2e2;};}function handleError(_0x1f7755,_0x175088){_0x175088=_0x175088||0x1f4;return function(_0x15c32e){logger[_0x9508('0x27')](_0x15c32e[_0x9508('0x28')]);if(_0x15c32e[_0x9508('0x29')]){delete _0x15c32e[_0x9508('0x29')];}_0x1f7755['status'](_0x175088)[_0x9508('0x2a')](_0x15c32e);};}exports[_0x9508('0x2b')]=function(_0x2b3738,_0x5853a2){var _0x3438da={},_0x38686a={},_0x5e1d31={'count':0x0,'rows':[]};var _0x3334d4=_[_0x9508('0x2c')](db['Tag'][_0x9508('0x2d')],function(_0x2fd00e){return{'name':_0x2fd00e[_0x9508('0x2e')],'type':_0x2fd00e[_0x9508('0x2f')]['key']};});_0x38686a['model']=_[_0x9508('0x2c')](_0x3334d4,_0x9508('0x29'));_0x38686a[_0x9508('0x30')]=_['keys'](_0x2b3738['query']);_0x38686a[_0x9508('0x31')]=_[_0x9508('0x32')](_0x38686a[_0x9508('0x33')],_0x38686a[_0x9508('0x30')]);_0x3438da[_0x9508('0x34')]=_[_0x9508('0x32')](_0x38686a[_0x9508('0x33')],qs[_0x9508('0x35')](_0x2b3738[_0x9508('0x30')][_0x9508('0x35')]));_0x3438da['attributes']=_0x3438da[_0x9508('0x34')][_0x9508('0x36')]?_0x3438da['attributes']:_0x38686a[_0x9508('0x33')];if(!_0x2b3738[_0x9508('0x30')][_0x9508('0x37')](_0x9508('0x38'))){_0x3438da[_0x9508('0x1d')]=qs[_0x9508('0x1d')](_0x2b3738[_0x9508('0x30')][_0x9508('0x1d')]);_0x3438da[_0x9508('0x1b')]=qs[_0x9508('0x1b')](_0x2b3738[_0x9508('0x30')]['offset']);}_0x3438da[_0x9508('0x39')]=qs['sort'](_0x2b3738[_0x9508('0x30')][_0x9508('0x3a')]);_0x3438da[_0x9508('0x3b')]=qs['filters'](_['pick'](_0x2b3738[_0x9508('0x30')],_0x38686a[_0x9508('0x31')]),_0x3334d4);if(_0x2b3738[_0x9508('0x30')][_0x9508('0x3c')]){_0x3438da['where']=_[_0x9508('0x3d')](_0x3438da['where'],{'$or':_[_0x9508('0x2c')](_0x3334d4,function(_0x174e83){if(_0x174e83['type']!==_0x9508('0x3e')){var _0x37217e={};_0x37217e[_0x174e83['name']]={'$like':'%'+_0x2b3738[_0x9508('0x30')][_0x9508('0x3c')]+'%'};return _0x37217e;}})});}_0x3438da=_[_0x9508('0x3d')]({},_0x3438da,_0x2b3738[_0x9508('0x3f')]);var _0x4e2561={'where':_0x3438da['where']};return db[_0x9508('0x40')]['count'](_0x4e2561)[_0x9508('0x23')](function(_0x22c135){_0x5e1d31[_0x9508('0x1e')]=_0x22c135;if(_0x2b3738[_0x9508('0x30')]['includeAll']){_0x3438da['include']=[{'all':!![]}];}return db['Tag'][_0x9508('0x41')](_0x3438da);})['then'](function(_0x3f2fc1){_0x5e1d31['rows']=_0x3f2fc1;return _0x5e1d31;})[_0x9508('0x23')](respondWithFilteredResult(_0x5853a2,_0x3438da))[_0x9508('0x42')](handleError(_0x5853a2,null));};exports[_0x9508('0x43')]=function(_0x464c1a,_0x5b456a){var _0x152288={'raw':!![],'where':{'id':_0x464c1a[_0x9508('0x44')]['id']}},_0x57b2c={};_0x57b2c['model']=_[_0x9508('0x45')](db[_0x9508('0x40')]['rawAttributes']);_0x57b2c[_0x9508('0x30')]=_['keys'](_0x464c1a[_0x9508('0x30')]);_0x57b2c['filters']=_['intersection'](_0x57b2c[_0x9508('0x33')],_0x57b2c[_0x9508('0x30')]);_0x152288[_0x9508('0x34')]=_[_0x9508('0x32')](_0x57b2c[_0x9508('0x33')],qs[_0x9508('0x35')](_0x464c1a['query'][_0x9508('0x35')]));_0x152288[_0x9508('0x34')]=_0x152288[_0x9508('0x34')]['length']?_0x152288[_0x9508('0x34')]:_0x57b2c[_0x9508('0x33')];if(_0x464c1a[_0x9508('0x30')][_0x9508('0x46')]){_0x152288['include']=[{'all':!![]}];}_0x152288=_[_0x9508('0x3d')]({},_0x152288,_0x464c1a['options']);return db[_0x9508('0x40')][_0x9508('0x47')](_0x152288)['then'](handleEntityNotFound(_0x5b456a,null))[_0x9508('0x23')](respondWithResult(_0x5b456a,null))[_0x9508('0x42')](handleError(_0x5b456a,null));};exports['create']=function(_0x61eb2c,_0x22306e){return db['Tag'][_0x9508('0x48')](_0x61eb2c['body'],{})[_0x9508('0x23')](function(_0x50df5e){var _0x1e6c8c=_0x61eb2c['user']['get']({'plain':!![]});if(!_0x1e6c8c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1e6c8c['role']===_0x9508('0x49')){var _0x13cedc=_0x50df5e[_0x9508('0x25')]({'plain':!![]});var _0x2eead6=_0x9508('0x4a');return db[_0x9508('0x4b')][_0x9508('0x47')]({'where':{'name':_0x2eead6,'userProfileId':_0x1e6c8c[_0x9508('0x4c')]},'raw':!![]})[_0x9508('0x23')](function(_0x5e4992){if(_0x5e4992&&_0x5e4992[_0x9508('0x4d')]===0x0){return db[_0x9508('0x26')][_0x9508('0x48')]({'name':_0x13cedc[_0x9508('0x29')],'resourceId':_0x13cedc['id'],'type':_0x5e4992[_0x9508('0x29')],'sectionId':_0x5e4992['id']},{})['then'](function(){return _0x50df5e;});}else{return _0x50df5e;}})['catch'](function(_0x1873c9){logger['error'](_0x9508('0x4e'),_0x1873c9);throw _0x1873c9;});}return _0x50df5e;})[_0x9508('0x23')](respondWithResult(_0x22306e,0xc9))['catch'](handleError(_0x22306e,null));};exports[_0x9508('0x4f')]=function(_0x5edd40,_0x4ee3f5){if(_0x5edd40[_0x9508('0x50')]['id']){delete _0x5edd40[_0x9508('0x50')]['id'];}return db['Tag'][_0x9508('0x47')]({'where':{'id':_0x5edd40[_0x9508('0x44')]['id']}})[_0x9508('0x23')](handleEntityNotFound(_0x4ee3f5,null))[_0x9508('0x23')](saveUpdates(_0x5edd40[_0x9508('0x50')],null))[_0x9508('0x23')](respondWithResult(_0x4ee3f5,null))[_0x9508('0x42')](handleError(_0x4ee3f5,null));};exports[_0x9508('0x24')]=function(_0x367da4,_0x2304fc){return db[_0x9508('0x40')][_0x9508('0x47')]({'where':{'id':_0x367da4[_0x9508('0x44')]['id']}})[_0x9508('0x23')](handleEntityNotFound(_0x2304fc,null))['then'](removeEntity(_0x2304fc,null))[_0x9508('0x42')](handleError(_0x2304fc,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 7e56976..b967361 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 _0xc265=['bluebird','rimraf','../../config/environment','./tag.attributes','exports','define','Tag','lodash','util','../../config/logger','api','moment'];(function(_0x117cc1,_0x3e22e7){var _0xd53ba2=function(_0x348814){while(--_0x348814){_0x117cc1['push'](_0x117cc1['shift']());}};_0xd53ba2(++_0x3e22e7);}(_0xc265,0x1b7));var _0x5c26=function(_0x35a690,_0x5c2457){_0x35a690=_0x35a690-0x0;var _0x19fdf6=_0xc265[_0x35a690];return _0x19fdf6;};'use strict';var _=require(_0x5c26('0x0'));var util=require(_0x5c26('0x1'));var logger=require(_0x5c26('0x2'))(_0x5c26('0x3'));var moment=require(_0x5c26('0x4'));var BPromise=require(_0x5c26('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5c26('0x6'));var config=require(_0x5c26('0x7'));var attributes=require(_0x5c26('0x8'));module[_0x5c26('0x9')]=function(_0x48bb33,_0x4eb734){return _0x48bb33[_0x5c26('0xa')](_0x5c26('0xb'),attributes,{'tableName':'tools_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc910=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./tag.attributes','define','Tag','tools_tags','lodash'];(function(_0x4bffe2,_0x395a76){var _0x4de9a6=function(_0x4fdbb9){while(--_0x4fdbb9){_0x4bffe2['push'](_0x4bffe2['shift']());}};_0x4de9a6(++_0x395a76);}(_0xc910,0x109));var _0x0c91=function(_0x4b185b,_0x4b67f1){_0x4b185b=_0x4b185b-0x0;var _0x4a181b=_0xc910[_0x4b185b];return _0x4a181b;};'use strict';var _=require(_0x0c91('0x0'));var util=require(_0x0c91('0x1'));var logger=require(_0x0c91('0x2'))(_0x0c91('0x3'));var moment=require(_0x0c91('0x4'));var BPromise=require(_0x0c91('0x5'));var rp=require(_0x0c91('0x6'));var fs=require('fs');var path=require(_0x0c91('0x7'));var rimraf=require(_0x0c91('0x8'));var config=require(_0x0c91('0x9'));var attributes=require(_0x0c91('0xa'));module['exports']=function(_0x129432,_0x439ac9){return _0x129432[_0x0c91('0xb')](_0x0c91('0xc'),attributes,{'tableName':_0x0c91('0xd'),'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 541638c..7272c3e 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 _0x4bc3=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','debug','Tag,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','Tag,\x20%s,\x20%s','message','result','catch','lodash','util'];(function(_0x1fbaa4,_0x1a0cac){var _0x1a6760=function(_0x52fb39){while(--_0x52fb39){_0x1fbaa4['push'](_0x1fbaa4['shift']());}};_0x1a6760(++_0x1a0cac);}(_0x4bc3,0x16e));var _0x34bc=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0x4bc3[_0x4a747d];return _0x3a5b5c;};'use strict';var _=require(_0x34bc('0x0'));var util=require(_0x34bc('0x1'));var moment=require('moment');var BPromise=require(_0x34bc('0x2'));var rs=require(_0x34bc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x34bc('0x4'))['db'];var utils=require(_0x34bc('0x5'));var logger=require(_0x34bc('0x6'))(_0x34bc('0x7'));var config=require(_0x34bc('0x8'));var jayson=require(_0x34bc('0x9'));var client=jayson[_0x34bc('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x21451b,_0x50320d,_0x502087){return new BPromise(function(_0x18a01c,_0x474108){return client[_0x34bc('0xb')](_0x21451b,_0x502087)[_0x34bc('0xc')](function(_0x409105){logger[_0x34bc('0xd')]('Tag,\x20%s,\x20%s',_0x50320d,'request\x20sent');logger[_0x34bc('0xe')](_0x34bc('0xf'),_0x50320d,_0x34bc('0x10'),JSON['stringify'](_0x409105));if(_0x409105[_0x34bc('0x11')]){if(_0x409105['error'][_0x34bc('0x12')]===0x1f4){logger[_0x34bc('0x11')](_0x34bc('0x13'),_0x50320d,_0x409105['error'][_0x34bc('0x14')]);return _0x474108(_0x409105['error'][_0x34bc('0x14')]);}logger[_0x34bc('0x11')](_0x34bc('0x13'),_0x50320d,_0x409105['error']['message']);return _0x18a01c(_0x409105[_0x34bc('0x11')]['message']);}else{logger[_0x34bc('0xd')](_0x34bc('0x13'),_0x50320d,_0x34bc('0x10'));_0x18a01c(_0x409105[_0x34bc('0x15')][_0x34bc('0x14')]);}})[_0x34bc('0x16')](function(_0x5e132d){logger['error']('Tag,\x20%s,\x20%s',_0x50320d,_0x5e132d);_0x474108(_0x5e132d);});});} \ No newline at end of file +var _0xe5d5=['request\x20sent','result','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Tag,\x20%s,\x20%s','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xe5d5,0x156));var _0x5e5d=function(_0x1dc77c,_0x3c31b5){_0x1dc77c=_0x1dc77c-0x0;var _0x28a49c=_0xe5d5[_0x1dc77c];return _0x28a49c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5e5d('0x0'));var BPromise=require('bluebird');var rs=require(_0x5e5d('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5e5d('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x5e5d('0x3'))(_0x5e5d('0x4'));var config=require(_0x5e5d('0x5'));var jayson=require(_0x5e5d('0x6'));var client=jayson[_0x5e5d('0x7')][_0x5e5d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3200d5,_0xab446c,_0x23de8d){return new BPromise(function(_0x131a59,_0x11973c){return client[_0x5e5d('0x9')](_0x3200d5,_0x23de8d)[_0x5e5d('0xa')](function(_0x5d3a3b){logger['info'](_0x5e5d('0xb'),_0xab446c,'request\x20sent');logger[_0x5e5d('0xc')](_0x5e5d('0xd'),_0xab446c,'request\x20sent',JSON[_0x5e5d('0xe')](_0x5d3a3b));if(_0x5d3a3b[_0x5e5d('0xf')]){if(_0x5d3a3b[_0x5e5d('0xf')][_0x5e5d('0x10')]===0x1f4){logger['error']('Tag,\x20%s,\x20%s',_0xab446c,_0x5d3a3b[_0x5e5d('0xf')][_0x5e5d('0x11')]);return _0x11973c(_0x5d3a3b['error'][_0x5e5d('0x11')]);}logger[_0x5e5d('0xf')]('Tag,\x20%s,\x20%s',_0xab446c,_0x5d3a3b[_0x5e5d('0xf')][_0x5e5d('0x11')]);return _0x131a59(_0x5d3a3b['error']['message']);}else{logger['info'](_0x5e5d('0xb'),_0xab446c,_0x5e5d('0x12'));_0x131a59(_0x5d3a3b[_0x5e5d('0x13')][_0x5e5d('0x11')]);}})['catch'](function(_0x132532){logger[_0x5e5d('0xf')](_0x5e5d('0xb'),_0xab446c,_0x132532);_0x11973c(_0x132532);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 22e2cd7..618e193 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(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/queues',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/queues',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller['destroy']);router[_0x0a9e('0x13')]('/:id/queues',auth[_0x0a9e('0xd')](),controller['removeQueues']);router[_0x0a9e('0x13')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x14')]);module['exports']=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/queues',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/queues',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller['destroy']);router[_0x0a9e('0x13')]('/:id/queues',auth[_0x0a9e('0xd')](),controller['removeQueues']);router[_0x0a9e('0x13')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/team/team.attributes.js b/server/api/team/team.attributes.js index 630eccc..c3c4eb2 100644 --- a/server/api/team/team.attributes.js +++ b/server/api/team/team.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['exports','sequelize'];(function(_0x2a44c7,_0x5c80f9){var _0x43058f=function(_0x4cf90a){while(--_0x4cf90a){_0x2a44c7['push'](_0x2a44c7['shift']());}};_0x43058f(++_0x5c80f9);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb10b=['name','sequelize','STRING'];(function(_0x2a2b10,_0x2abf1c){var _0x52caba=function(_0x298491){while(--_0x298491){_0x2a2b10['push'](_0x2a2b10['shift']());}};_0x52caba(++_0x2abf1c);}(_0xb10b,0x12a));var _0xbb10=function(_0x57928b,_0x29a111){_0x57928b=_0x57928b-0x0;var _0x49aad6=_0xb10b[_0x57928b];return _0x49aad6;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![],'unique':_0xbb10('0x2')},'description':{'type':Sequelize[_0xbb10('0x1')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index ed41bb4..16bca9f 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 _0xda18=['TeamVoiceQueue','Queue','findOrCreate','Queue:save','User','online','interface','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','voicePause','all','TeamVoicePrefix','UserVoicePrefix','spread','removeAgents','isArray','Whatsapp','emit','Queue:remove','QueueId','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','sendStatus','status','end','json','offset','undefined','limit','count','apply','save','update','then','error','stack','name','send','index','map','Team','rawAttributes','fieldName','key','model','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','keys','intersection','merge','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','sequelize','transaction','Sequelize','QueryTypes','SELECT','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','VoiceQueueId','UserVoiceQueue','destroy','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','UserWhatsappQueue','VoicePrefixId','getQueues','findOne','channel','isValidChannel','Unknown\x20channel','toLowerCase','capitalize','addQueues','ValidationError','Queues','ids','removeQueues','remove','addAgents','Voice','Chat','Mail','Sms','Fax','through','penalty'];(function(_0x22d5ee,_0x24b58a){var _0x5187a6=function(_0x547060){while(--_0x547060){_0x22d5ee['push'](_0x22d5ee['shift']());}};_0x5187a6(++_0x24b58a);}(_0xda18,0xb2));var _0x8da1=function(_0x2f6f43,_0x1e55cd){_0x2f6f43=_0x2f6f43-0x0;var _0x5ee808=_0xda18[_0x2f6f43];return _0x5ee808;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8da1('0x0'));var zipdir=require(_0x8da1('0x1'));var jsonpatch=require(_0x8da1('0x2'));var rp=require(_0x8da1('0x3'));var moment=require(_0x8da1('0x4'));var BPromise=require(_0x8da1('0x5'));var Mustache=require(_0x8da1('0x6'));var util=require(_0x8da1('0x7'));var path=require('path');var sox=require(_0x8da1('0x8'));var csv=require(_0x8da1('0x9'));var ejs=require(_0x8da1('0xa'));var fs=require('fs');var fs_extra=require(_0x8da1('0xb'));var _=require(_0x8da1('0xc'));var squel=require(_0x8da1('0xd'));var crypto=require(_0x8da1('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x8da1('0xf'));var toCsv=require(_0x8da1('0x9'));var querystring=require(_0x8da1('0x10'));var Papa=require('papaparse');var Redis=require(_0x8da1('0x11'));var authService=require(_0x8da1('0x12'));var qs=require(_0x8da1('0x13'));var as=require(_0x8da1('0x14'));var hardwareService=require(_0x8da1('0x15'));var logger=require(_0x8da1('0x16'))(_0x8da1('0x17'));var utils=require(_0x8da1('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x8da1('0x19'));var db=require(_0x8da1('0x1a'))['db'];config['redis']=_[_0x8da1('0x1b')](config[_0x8da1('0x1c')],{'host':_0x8da1('0x1d'),'port':0x18eb});var socket=require(_0x8da1('0x1e'))(new Redis(config['redis']));require('./team.socket')['register'](socket);function respondWithStatusCode(_0x296787,_0x535962){_0x535962=_0x535962||0xcc;return function(_0x3ae362){if(_0x3ae362){return _0x296787[_0x8da1('0x1f')](_0x535962);}return _0x296787[_0x8da1('0x20')](_0x535962)[_0x8da1('0x21')]();};}function respondWithResult(_0x3e6ac8,_0x2c89ce){_0x2c89ce=_0x2c89ce||0xc8;return function(_0x2e4e31){if(_0x2e4e31){return _0x3e6ac8[_0x8da1('0x20')](_0x2c89ce)[_0x8da1('0x22')](_0x2e4e31);}};}function respondWithFilteredResult(_0x472a4a,_0x5dad4d){return function(_0x71bbb8){if(_0x71bbb8){var _0x3558b1=typeof _0x5dad4d[_0x8da1('0x23')]===_0x8da1('0x24')&&typeof _0x5dad4d[_0x8da1('0x25')]===_0x8da1('0x24');var _0x4d97d2=_0x71bbb8['count'];var _0x45b8bc=_0x3558b1?0x0:_0x5dad4d['offset'];var _0x1ed9a1=_0x3558b1?_0x71bbb8[_0x8da1('0x26')]:_0x5dad4d[_0x8da1('0x23')]+_0x5dad4d[_0x8da1('0x25')];var _0x38bf38;if(_0x1ed9a1>=_0x4d97d2){_0x1ed9a1=_0x4d97d2;_0x38bf38=0xc8;}else{_0x38bf38=0xce;}_0x472a4a['status'](_0x38bf38);return _0x472a4a['set']('Content-Range',_0x45b8bc+'-'+_0x1ed9a1+'/'+_0x4d97d2)[_0x8da1('0x22')](_0x71bbb8);}return null;};}function patchUpdates(_0x1c39cc){return function(_0x588589){try{jsonpatch[_0x8da1('0x27')](_0x588589,_0x1c39cc,!![]);}catch(_0x2469a0){return BPromise['reject'](_0x2469a0);}return _0x588589[_0x8da1('0x28')]();};}function saveUpdates(_0x3e1ad2,_0x3a115e){return function(_0x4b8b60){if(_0x4b8b60){return _0x4b8b60[_0x8da1('0x29')](_0x3e1ad2)[_0x8da1('0x2a')](function(_0x3be12b){return _0x3be12b;});}return null;};}function handleEntityNotFound(_0x561288,_0x26a0f7){return function(_0x24ca73){if(!_0x24ca73){_0x561288[_0x8da1('0x1f')](0x194);}return _0x24ca73;};}function handleError(_0x28b773,_0x33964f){_0x33964f=_0x33964f||0x1f4;return function(_0x24e483){logger[_0x8da1('0x2b')](_0x24e483[_0x8da1('0x2c')]);if(_0x24e483[_0x8da1('0x2d')]){delete _0x24e483[_0x8da1('0x2d')];}_0x28b773[_0x8da1('0x20')](_0x33964f)[_0x8da1('0x2e')](_0x24e483);};}exports[_0x8da1('0x2f')]=function(_0x3f4c02,_0x1e1c2f){var _0x47b92d={},_0x340576={},_0x15e284={'count':0x0,'rows':[]};var _0x5761a5=_[_0x8da1('0x30')](db[_0x8da1('0x31')][_0x8da1('0x32')],function(_0x41c4f8){return{'name':_0x41c4f8[_0x8da1('0x33')],'type':_0x41c4f8['type'][_0x8da1('0x34')]};});_0x340576[_0x8da1('0x35')]=_[_0x8da1('0x30')](_0x5761a5,_0x8da1('0x2d'));_0x340576['query']=_['keys'](_0x3f4c02['query']);_0x340576['filters']=_['intersection'](_0x340576[_0x8da1('0x35')],_0x340576[_0x8da1('0x36')]);_0x47b92d[_0x8da1('0x37')]=_['intersection'](_0x340576[_0x8da1('0x35')],qs[_0x8da1('0x38')](_0x3f4c02['query']['fields']));_0x47b92d[_0x8da1('0x37')]=_0x47b92d['attributes'][_0x8da1('0x39')]?_0x47b92d['attributes']:_0x340576['model'];if(!_0x3f4c02['query'][_0x8da1('0x3a')](_0x8da1('0x3b'))){_0x47b92d[_0x8da1('0x25')]=qs[_0x8da1('0x25')](_0x3f4c02[_0x8da1('0x36')]['limit']);_0x47b92d[_0x8da1('0x23')]=qs['offset'](_0x3f4c02[_0x8da1('0x36')][_0x8da1('0x23')]);}_0x47b92d[_0x8da1('0x3c')]=qs[_0x8da1('0x3d')](_0x3f4c02[_0x8da1('0x36')][_0x8da1('0x3d')]);_0x47b92d[_0x8da1('0x3e')]=qs['filters'](_[_0x8da1('0x3f')](_0x3f4c02[_0x8da1('0x36')],_0x340576[_0x8da1('0x40')]),_0x5761a5);if(_0x3f4c02['query']['filter']){_0x47b92d[_0x8da1('0x3e')]=_['merge'](_0x47b92d[_0x8da1('0x3e')],{'$or':_['map'](_0x5761a5,function(_0x190a0b){if(_0x190a0b[_0x8da1('0x41')]!==_0x8da1('0x42')){var _0xb53cf9={};_0xb53cf9[_0x190a0b[_0x8da1('0x2d')]]={'$like':'%'+_0x3f4c02['query'][_0x8da1('0x43')]+'%'};return _0xb53cf9;}})});}_0x47b92d=_['merge']({},_0x47b92d,_0x3f4c02[_0x8da1('0x44')]);var _0x21669b={'where':_0x47b92d[_0x8da1('0x3e')]};return db['Team'][_0x8da1('0x26')](_0x21669b)['then'](function(_0x7eb66a){_0x15e284[_0x8da1('0x26')]=_0x7eb66a;if(_0x3f4c02[_0x8da1('0x36')][_0x8da1('0x45')]){_0x47b92d[_0x8da1('0x46')]=[{'all':!![]}];}return db[_0x8da1('0x31')][_0x8da1('0x47')](_0x47b92d);})['then'](function(_0x127fa2){_0x15e284[_0x8da1('0x48')]=_0x127fa2;return _0x15e284;})[_0x8da1('0x2a')](respondWithFilteredResult(_0x1e1c2f,_0x47b92d))[_0x8da1('0x49')](handleError(_0x1e1c2f,null));};exports['show']=function(_0x52e321,_0x13cf84){var _0xe4795c={'raw':![],'where':{'id':_0x52e321['params']['id']}},_0x4349bf={};_0x4349bf[_0x8da1('0x35')]=_[_0x8da1('0x4a')](db[_0x8da1('0x31')][_0x8da1('0x32')]);_0x4349bf['query']=_['keys'](_0x52e321[_0x8da1('0x36')]);_0x4349bf['filters']=_[_0x8da1('0x4b')](_0x4349bf['model'],_0x4349bf[_0x8da1('0x36')]);_0xe4795c['attributes']=_[_0x8da1('0x4b')](_0x4349bf[_0x8da1('0x35')],qs[_0x8da1('0x38')](_0x52e321[_0x8da1('0x36')][_0x8da1('0x38')]));_0xe4795c[_0x8da1('0x37')]=_0xe4795c[_0x8da1('0x37')][_0x8da1('0x39')]?_0xe4795c[_0x8da1('0x37')]:_0x4349bf[_0x8da1('0x35')];if(_0x52e321[_0x8da1('0x36')]['includeAll']){_0xe4795c[_0x8da1('0x46')]=[{'all':!![]}];}_0xe4795c=_[_0x8da1('0x4c')]({},_0xe4795c,_0x52e321[_0x8da1('0x44')]);return db[_0x8da1('0x31')][_0x8da1('0x4d')](_0xe4795c)['then'](handleEntityNotFound(_0x13cf84,null))[_0x8da1('0x2a')](respondWithResult(_0x13cf84,null))[_0x8da1('0x49')](handleError(_0x13cf84,null));};exports[_0x8da1('0x4e')]=function(_0x13de40,_0x4895cd){return db[_0x8da1('0x31')]['create'](_0x13de40[_0x8da1('0x4f')],{})['then'](function(_0x598b56){var _0x6cc09c=_0x13de40[_0x8da1('0x50')][_0x8da1('0x51')]({'plain':!![]});if(!_0x6cc09c)throw new Error(_0x8da1('0x52'));if(_0x6cc09c[_0x8da1('0x53')]===_0x8da1('0x50')){var _0x53a8eb=_0x598b56[_0x8da1('0x51')]({'plain':!![]});var _0xeffe6f=_0x8da1('0x54');return db[_0x8da1('0x55')][_0x8da1('0x4d')]({'where':{'name':_0xeffe6f,'userProfileId':_0x6cc09c['userProfileId']},'raw':!![]})[_0x8da1('0x2a')](function(_0x1050dc){if(_0x1050dc&&_0x1050dc[_0x8da1('0x56')]===0x0){return db['UserProfileResource'][_0x8da1('0x4e')]({'name':_0x53a8eb['name'],'resourceId':_0x53a8eb['id'],'type':_0x1050dc[_0x8da1('0x2d')],'sectionId':_0x1050dc['id']},{})['then'](function(){return _0x598b56;});}else{return _0x598b56;}})[_0x8da1('0x49')](function(_0x3ab91e){logger[_0x8da1('0x2b')](_0x8da1('0x57'),_0x3ab91e);throw _0x3ab91e;});}return _0x598b56;})['then'](respondWithResult(_0x4895cd,0xc9))[_0x8da1('0x49')](handleError(_0x4895cd,null));};exports[_0x8da1('0x29')]=function(_0x45b1ca,_0x260dc1){if(_0x45b1ca['body']['id']){delete _0x45b1ca[_0x8da1('0x4f')]['id'];}return db[_0x8da1('0x31')][_0x8da1('0x4d')]({'where':{'id':_0x45b1ca[_0x8da1('0x58')]['id']}})[_0x8da1('0x2a')](handleEntityNotFound(_0x260dc1,null))['then'](saveUpdates(_0x45b1ca[_0x8da1('0x4f')],null))[_0x8da1('0x2a')](respondWithResult(_0x260dc1,null))[_0x8da1('0x49')](handleError(_0x260dc1,null));};exports['destroy']=function(_0x3b9fcd,_0x54047a){var _0x2e2ef4=_0x3b9fcd[_0x8da1('0x58')]['id'];var _0x3e325c=[];return db[_0x8da1('0x59')][_0x8da1('0x5a')](function(_0x5ab03e){var _0x442e3e='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x2e2ef4;return db[_0x8da1('0x59')]['query'](_0x442e3e,{'type':db[_0x8da1('0x5b')][_0x8da1('0x5c')][_0x8da1('0x5d')],'raw':!![],'transaction':_0x5ab03e})['then'](function(_0x252ff8){_0x3e325c=_[_0x8da1('0x30')](_0x252ff8,function(_0x324043){return Number(_0x324043['UserId']);});})[_0x8da1('0x2a')](function(){var _0x14092b=_0x8da1('0x5e')+_0x2e2ef4;return db[_0x8da1('0x59')][_0x8da1('0x36')](_0x14092b,{'type':db[_0x8da1('0x5b')][_0x8da1('0x5c')]['SELECT'],'raw':!![],'transaction':_0x5ab03e});})[_0x8da1('0x2a')](function(_0xdfa44b){var _0x2c85bc=_[_0x8da1('0x30')](_0xdfa44b,function(_0x1578da){return Number(_0x1578da[_0x8da1('0x5f')]);});return db[_0x8da1('0x60')][_0x8da1('0x61')]({'where':{'UserId':{'$in':_0x3e325c},'VoiceQueueId':{'$in':_0x2c85bc}},'transaction':_0x5ab03e});})[_0x8da1('0x2a')](function(){var _0x257302='SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20'+_0x2e2ef4;return db['sequelize'][_0x8da1('0x36')](_0x257302,{'type':db[_0x8da1('0x5b')][_0x8da1('0x5c')][_0x8da1('0x5d')],'raw':!![],'transaction':_0x5ab03e});})[_0x8da1('0x2a')](function(_0x56e858){var _0x42ecdb=_['map'](_0x56e858,function(_0x8fbee3){return Number(_0x8fbee3['MailQueueId']);});return db['UserMailQueue']['destroy']({'where':{'UserId':{'$in':_0x3e325c},'MailQueueId':{'$in':_0x42ecdb}},'transaction':_0x5ab03e});})[_0x8da1('0x2a')](function(){var _0x15c53e=_0x8da1('0x62')+_0x2e2ef4;return db[_0x8da1('0x59')][_0x8da1('0x36')](_0x15c53e,{'type':db[_0x8da1('0x5b')][_0x8da1('0x5c')][_0x8da1('0x5d')],'raw':!![],'transaction':_0x5ab03e});})[_0x8da1('0x2a')](function(_0x351bcf){var _0x516d44=_[_0x8da1('0x30')](_0x351bcf,function(_0x3c295d){return Number(_0x3c295d['SmsQueueId']);});return db['UserSmsQueue'][_0x8da1('0x61')]({'where':{'UserId':{'$in':_0x3e325c},'SmsQueueId':{'$in':_0x516d44}},'transaction':_0x5ab03e});})[_0x8da1('0x2a')](function(){var _0x35da1a='SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20'+_0x2e2ef4;return db[_0x8da1('0x59')]['query'](_0x35da1a,{'type':db[_0x8da1('0x5b')][_0x8da1('0x5c')]['SELECT'],'raw':!![],'transaction':_0x5ab03e});})[_0x8da1('0x2a')](function(_0x3e06fe){var _0x6f2da2=_['map'](_0x3e06fe,function(_0x560319){return Number(_0x560319[_0x8da1('0x63')]);});return db[_0x8da1('0x64')][_0x8da1('0x61')]({'where':{'UserId':{'$in':_0x3e325c},'ChatQueueId':{'$in':_0x6f2da2}},'transaction':_0x5ab03e});})[_0x8da1('0x2a')](function(){var _0x290d6f=_0x8da1('0x65')+_0x2e2ef4;return db[_0x8da1('0x59')]['query'](_0x290d6f,{'type':db[_0x8da1('0x5b')][_0x8da1('0x5c')][_0x8da1('0x5d')],'raw':!![],'transaction':_0x5ab03e});})[_0x8da1('0x2a')](function(_0x4e3d27){var _0x525581=_[_0x8da1('0x30')](_0x4e3d27,function(_0x43e9d5){return Number(_0x43e9d5[_0x8da1('0x66')]);});return db[_0x8da1('0x67')][_0x8da1('0x61')]({'where':{'UserId':{'$in':_0x3e325c},'FaxQueueId':{'$in':_0x525581}},'transaction':_0x5ab03e});})['then'](function(){var _0x500007=_0x8da1('0x68')+_0x2e2ef4;return db[_0x8da1('0x59')][_0x8da1('0x36')](_0x500007,{'type':db[_0x8da1('0x5b')]['QueryTypes'][_0x8da1('0x5d')],'raw':!![],'transaction':_0x5ab03e});})[_0x8da1('0x2a')](function(_0x39e5f1){var _0x35b5bc=_[_0x8da1('0x30')](_0x39e5f1,function(_0x203a76){return Number(_0x203a76['OpenchannelQueueId']);});return db[_0x8da1('0x69')][_0x8da1('0x61')]({'where':{'UserId':{'$in':_0x3e325c},'OpenchannelQueueId':{'$in':_0x35b5bc}},'transaction':_0x5ab03e});})[_0x8da1('0x2a')](function(){var _0x408a1c=_0x8da1('0x6a')+_0x2e2ef4;return db[_0x8da1('0x59')][_0x8da1('0x36')](_0x408a1c,{'type':db[_0x8da1('0x5b')][_0x8da1('0x5c')][_0x8da1('0x5d')],'raw':!![],'transaction':_0x5ab03e});})[_0x8da1('0x2a')](function(_0xc05249){var _0x234744=_[_0x8da1('0x30')](_0xc05249,function(_0x3f09f0){return Number(_0x3f09f0['WhatsappQueueId']);});return db[_0x8da1('0x6b')][_0x8da1('0x61')]({'where':{'UserId':{'$in':_0x3e325c},'WhatsappQueueId':{'$in':_0x234744}},'transaction':_0x5ab03e});})[_0x8da1('0x2a')](function(){return db['TeamVoicePrefix'][_0x8da1('0x4d')]({'where':{'TeamId':_0x2e2ef4}});})[_0x8da1('0x2a')](function(_0x54cfde){if(_0x54cfde===null){return;}return db['UserVoicePrefix']['destroy']({'where':{'UserId':{'$in':_0x3e325c},'VoicePrefixId':_0x54cfde[_0x8da1('0x6c')]},'transaction':_0x5ab03e});})[_0x8da1('0x2a')](function(){return db[_0x8da1('0x31')][_0x8da1('0x61')]({'where':{'id':_0x2e2ef4},'cascade':!![],'transaction':_0x5ab03e});})[_0x8da1('0x2a')](function(_0x5b0c67){if(_0x5b0c67===0x0){_0x54047a['sendStatus'](0x194);}else{return db['UserProfileResource'][_0x8da1('0x61')]({'where':{'type':_0x8da1('0x54'),'resourceId':_0x2e2ef4},'cascade':!![],'transaction':_0x5ab03e})[_0x8da1('0x2a')](function(){_0x54047a[_0x8da1('0x20')](0xcc)[_0x8da1('0x21')]();});}})[_0x8da1('0x49')](function(_0x335e38){_0x54047a[_0x8da1('0x20')](0x1f4)['send'](_0x335e38);});});};exports[_0x8da1('0x6d')]=function(_0x34dba3,_0x29ab87,_0x40d197){return db[_0x8da1('0x31')][_0x8da1('0x6e')]({'where':{'id':_0x34dba3[_0x8da1('0x58')]['id']}})[_0x8da1('0x2a')](handleEntityNotFound(_0x29ab87,null))[_0x8da1('0x2a')](function(_0x158df2){if(!_0x34dba3['query'][_0x8da1('0x6f')]||!utils[_0x8da1('0x70')](_0x34dba3['query'][_0x8da1('0x6f')])){throw new db[(_0x8da1('0x5b'))]['ValidationError'](_0x8da1('0x71'));}var _0x1226c4={};var _0x5f2304={};_0x5f2304['model']=_['keys'](db[_['capitalize'](_0x34dba3[_0x8da1('0x36')][_0x8da1('0x6f')][_0x8da1('0x72')]())+'Queue']['rawAttributes']);_0x5f2304[_0x8da1('0x36')]=_[_0x8da1('0x4a')](_0x34dba3[_0x8da1('0x36')]);_0x5f2304[_0x8da1('0x40')]=_[_0x8da1('0x4b')](_0x5f2304[_0x8da1('0x35')],_0x5f2304['query']);_0x1226c4['attributes']=_[_0x8da1('0x4b')](_0x5f2304[_0x8da1('0x35')],qs[_0x8da1('0x38')](_0x34dba3[_0x8da1('0x36')][_0x8da1('0x38')]));_0x1226c4[_0x8da1('0x37')]=_0x1226c4[_0x8da1('0x37')][_0x8da1('0x39')]?_0x1226c4[_0x8da1('0x37')]:_0x5f2304[_0x8da1('0x35')];_0x1226c4['limit']=qs[_0x8da1('0x25')](_0x34dba3['query']['limit']);_0x1226c4[_0x8da1('0x23')]=qs[_0x8da1('0x23')](_0x34dba3['query'][_0x8da1('0x23')]);_0x1226c4[_0x8da1('0x3c')]=qs[_0x8da1('0x3d')](_0x34dba3[_0x8da1('0x36')]['sort']);_0x1226c4[_0x8da1('0x3e')]=qs[_0x8da1('0x40')](_[_0x8da1('0x3f')](_0x34dba3[_0x8da1('0x36')],_0x5f2304[_0x8da1('0x40')]));_0x1226c4=_['merge']({},_0x1226c4,_0x34dba3[_0x8da1('0x44')]);return _0x158df2[_0x8da1('0x51')+_[_0x8da1('0x73')](_0x34dba3['query'][_0x8da1('0x6f')][_0x8da1('0x72')]())+'Queues'](_0x1226c4);})[_0x8da1('0x2a')](respondWithResult(_0x29ab87,null))['catch'](handleError(_0x29ab87,null));};exports[_0x8da1('0x74')]=function(_0x3fa5b6,_0x4ccabf,_0x74fe79){return db[_0x8da1('0x31')][_0x8da1('0x6e')]({'where':{'id':_0x3fa5b6[_0x8da1('0x58')]['id']}})['then'](function(_0xd1593a){if(_0xd1593a){if(!_0x3fa5b6[_0x8da1('0x4f')][_0x8da1('0x6f')]||!utils[_0x8da1('0x70')](_0x3fa5b6['body']['channel'])){throw new db[(_0x8da1('0x5b'))][(_0x8da1('0x75'))](_0x8da1('0x71'));}return _0xd1593a['add'+_[_0x8da1('0x73')](_0x3fa5b6[_0x8da1('0x4f')][_0x8da1('0x6f')][_0x8da1('0x72')]())+_0x8da1('0x76')](_0x3fa5b6[_0x8da1('0x4f')][_0x8da1('0x77')]);}return null;})[_0x8da1('0x2a')](handleEntityNotFound(_0x4ccabf,null))[_0x8da1('0x2a')](respondWithStatusCode(_0x4ccabf,null))['catch'](handleError(_0x4ccabf,null));};exports[_0x8da1('0x78')]=function(_0x398b96,_0x51e036,_0xec9f26){return db[_0x8da1('0x31')][_0x8da1('0x6e')]({'where':{'id':_0x398b96[_0x8da1('0x58')]['id']}})[_0x8da1('0x2a')](function(_0x516315){if(_0x516315){if(!_0x398b96['query'][_0x8da1('0x6f')]||!utils['isValidChannel'](_0x398b96[_0x8da1('0x36')][_0x8da1('0x6f')])){throw new db['Sequelize'][(_0x8da1('0x75'))](_0x8da1('0x71'));}return _0x516315[_0x8da1('0x79')+_['capitalize'](_0x398b96[_0x8da1('0x36')][_0x8da1('0x6f')]['toLowerCase']())+_0x8da1('0x76')](_0x398b96[_0x8da1('0x36')][_0x8da1('0x77')]);}return null;})['then'](handleEntityNotFound(_0x51e036,null))[_0x8da1('0x2a')](respondWithStatusCode(_0x51e036,null))[_0x8da1('0x49')](handleError(_0x51e036,null));};exports[_0x8da1('0x7a')]=function(_0x50e338,_0x296d60){var _0xa2852a=_['isArray'](_0x50e338[_0x8da1('0x4f')][_0x8da1('0x77')])?_0x50e338[_0x8da1('0x4f')][_0x8da1('0x77')]:[_0x50e338[_0x8da1('0x4f')]['ids']];var _0x58feb6=_0x50e338[_0x8da1('0x58')]['id'];return db[_0x8da1('0x31')][_0x8da1('0x4d')]({'where':{'id':_0x58feb6}})['then'](handleEntityNotFound(_0x296d60,null))['then'](function(_0x52dc83){if(_0x52dc83){var _0x11e9cc=[_0x8da1('0x7b'),_0x8da1('0x7c'),_0x8da1('0x7d'),_0x8da1('0x7e'),_0x8da1('0x7f'),'Openchannel','Whatsapp'];return db[_0x8da1('0x59')][_0x8da1('0x5a')](function(_0x57f19d){var _0x237ef1=_['map'](_0x11e9cc,function(_0x21db45){var _0x5ee105={'attributes':['id',_0x8da1('0x2d')]};if(_0x21db45===_0x8da1('0x7b')){_0x5ee105[_0x8da1('0x80')]={'attributes':[_0x8da1('0x81')]};}return _0x52dc83[_0x8da1('0x51')+_0x21db45+_0x8da1('0x76')](_0x5ee105)[_0x8da1('0x2a')](function(_0x3584c2){var _0x1eeff1=_[_0x8da1('0x30')](_0x3584c2,function(_0x23af77){var _0x2bc172=_[_0x8da1('0x30')](_0xa2852a,function(_0x3992ca){var _0x1f1715={'where':{'UserId':_0x3992ca,[_0x21db45+'QueueId']:_0x23af77['id']},'transaction':_0x57f19d};if(_0x21db45===_0x8da1('0x7b')){_0x1f1715[_0x8da1('0x1b')]={'penalty':_0x23af77[_0x8da1('0x82')][_0x8da1('0x81')]};}return db['User'+_0x21db45+_0x8da1('0x83')][_0x8da1('0x84')](_0x1f1715)[_0x8da1('0x2a')](function(){socket['emit'](_0x8da1('0x50')+_0x21db45+_0x8da1('0x85'),{'UserId':_0x3992ca,[_0x21db45+'QueueId']:_0x23af77['id']});if(_0x21db45!==_0x8da1('0x7b')){return;}return db[_0x8da1('0x86')][_0x8da1('0x47')]({'where':{'id':_0xa2852a,'online':0x1},'attributes':['id','name',_0x8da1('0x87'),'voicePause',_0x8da1('0x88')],'raw':!![]})[_0x8da1('0x2a')](function(_0x3d77b7){var _0x4d7e00=_[_0x8da1('0x30')](_0x3d77b7,function(_0x4d7101){return db[_0x8da1('0x89')][_0x8da1('0x8a')]({'membername':_0x4d7101[_0x8da1('0x2d')],'UserId':_0x4d7101['id'],'queue_name':_0x23af77[_0x8da1('0x2d')],'VoiceQueueId':_0x23af77['id'],'interface':_[_0x8da1('0x8b')](_0x4d7101[_0x8da1('0x88')])?util[_0x8da1('0x8c')](_0x8da1('0x8d'),_0x4d7101[_0x8da1('0x2d')]):_0x4d7101[_0x8da1('0x88')],'paused':_0x4d7101[_0x8da1('0x8e')]||![],'penalty':_0x23af77[_0x8da1('0x82')][_0x8da1('0x81')]},{'transaction':_0x57f19d});});return Promise[_0x8da1('0x8f')](_0x4d7e00);});});});return Promise[_0x8da1('0x8f')](_0x2bc172);});return Promise[_0x8da1('0x8f')](_0x1eeff1);})[_0x8da1('0x2a')](function(){return db[_0x8da1('0x90')][_0x8da1('0x6e')]({'where':{'teamId':_0x58feb6}})[_0x8da1('0x2a')](function(_0x526074){if(_0x526074){var _0x50fffa=_[_0x8da1('0x30')](_0xa2852a,function(_0x4db559){db[_0x8da1('0x91')][_0x8da1('0x8a')]({'UserId':_0x4db559,'VoicePrefixId':_0x526074[_0x8da1('0x6c')]});});return Promise[_0x8da1('0x8f')](_0x50fffa);}});});});return Promise[_0x8da1('0x8f')](_0x237ef1)[_0x8da1('0x2a')](function(){return _0x52dc83[_0x8da1('0x7a')](_0xa2852a,{'transaction':_0x57f19d})[_0x8da1('0x92')](function(_0x314d2a){return _0x314d2a;});});});}})[_0x8da1('0x2a')](respondWithResult(_0x296d60,null))['catch'](handleError(_0x296d60,null));};exports[_0x8da1('0x93')]=function(_0x47e799,_0x4eb131){var _0x9ae5f1=_[_0x8da1('0x94')](_0x47e799[_0x8da1('0x36')]['ids'])?_0x47e799[_0x8da1('0x36')]['ids']:[_0x47e799[_0x8da1('0x36')][_0x8da1('0x77')]];var _0xe500f5=_0x47e799['params']['id'];return db[_0x8da1('0x31')][_0x8da1('0x4d')]({'where':{'id':_0xe500f5}})[_0x8da1('0x2a')](handleEntityNotFound(_0x4eb131,null))[_0x8da1('0x2a')](function(_0x4ec6e1){if(_0x4ec6e1){var _0x1fcc77=[_0x8da1('0x7b'),_0x8da1('0x7c'),_0x8da1('0x7d'),'Sms','Fax','Openchannel',_0x8da1('0x95')];return db[_0x8da1('0x59')]['transaction'](function(_0x4fbc47){var _0x4955b5=_[_0x8da1('0x30')](_0x1fcc77,function(_0x51fb9b){var _0x31d6a6={'attributes':['id',_0x8da1('0x2d')]};return _0x4ec6e1[_0x8da1('0x51')+_0x51fb9b+_0x8da1('0x76')](_0x31d6a6)['then'](function(_0x4b4fe2){var _0x26b73c=_[_0x8da1('0x30')](_0x4b4fe2,function(_0x2e56b0){return _0x2e56b0[_0x8da1('0x93')](_0x9ae5f1,{'transaction':_0x4fbc47})['then'](function(){var _0x301860=_[_0x8da1('0x30')](_0x9ae5f1,function(_0x556908){socket[_0x8da1('0x96')]('user'+_0x51fb9b+_0x8da1('0x97'),{'UserId':Number(_0x556908),[_0x51fb9b+_0x8da1('0x98')]:_0x2e56b0['id']});if(_0x51fb9b!==_0x8da1('0x7b')){return;}return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x2e56b0['id'],'UserId':_0x556908},'transaction':_0x4fbc47});});return Promise['all'](_0x301860);});});return Promise['all'](_0x26b73c);});});return Promise[_0x8da1('0x8f')](_0x4955b5)[_0x8da1('0x2a')](function(){return _0x4ec6e1[_0x8da1('0x93')](_0x9ae5f1,{'transaction':_0x4fbc47});})[_0x8da1('0x2a')](function(){return db[_0x8da1('0x90')]['findOne']({'where':{'teamId':_0xe500f5}})[_0x8da1('0x2a')](function(_0x4d1510){if(_0x4d1510){var _0x3625b2=_['map'](_0x9ae5f1,function(_0x336751){db[_0x8da1('0x91')][_0x8da1('0x61')]({'where':{'UserId':_0x336751,'VoicePrefixId':_0x4d1510['VoicePrefixId']}});});return Promise[_0x8da1('0x8f')](_0x3625b2);}});});});}})[_0x8da1('0x2a')](respondWithStatusCode(_0x4eb131,null))[_0x8da1('0x49')](handleError(_0x4eb131,null));};exports['getAgents']=function(_0x447678,_0x2b92c7,_0x288c08){var _0x540073={};var _0x313343={};var _0x438ecc;var _0x44e618;return db[_0x8da1('0x31')][_0x8da1('0x6e')]({'where':{'id':_0x447678[_0x8da1('0x58')]['id']}})[_0x8da1('0x2a')](handleEntityNotFound(_0x2b92c7,null))['then'](function(_0x31e175){if(_0x31e175){_0x438ecc=_0x31e175;_0x313343[_0x8da1('0x35')]=_['keys'](db[_0x8da1('0x86')]['rawAttributes']);_0x313343[_0x8da1('0x36')]=_[_0x8da1('0x4a')](_0x447678[_0x8da1('0x36')]);_0x313343[_0x8da1('0x40')]=_[_0x8da1('0x4b')](_0x313343['model'],_0x313343[_0x8da1('0x36')]);_0x540073[_0x8da1('0x37')]=_[_0x8da1('0x4b')](_0x313343['model'],qs[_0x8da1('0x38')](_0x447678[_0x8da1('0x36')][_0x8da1('0x38')]));_0x540073[_0x8da1('0x37')]=_0x540073['attributes']['length']?_0x540073[_0x8da1('0x37')]:_0x313343[_0x8da1('0x35')];_0x540073['order']=qs['sort'](_0x447678[_0x8da1('0x36')][_0x8da1('0x3d')]);_0x540073[_0x8da1('0x3e')]=qs[_0x8da1('0x40')](_['pick'](_0x447678[_0x8da1('0x36')],_0x313343[_0x8da1('0x40')]));if(_0x447678['query'][_0x8da1('0x43')]){_0x540073[_0x8da1('0x3e')]=_['merge'](_0x540073['where'],{'$or':_['map'](_0x540073[_0x8da1('0x37')],function(_0x20e0df){var _0x2dd869={};_0x2dd869[_0x20e0df]={'$like':'%'+_0x447678[_0x8da1('0x36')]['filter']+'%'};return _0x2dd869;})});}_0x540073=_[_0x8da1('0x4c')]({},_0x540073,_0x447678['options']);return _0x438ecc['getAgents'](_0x540073);}})[_0x8da1('0x2a')](function(_0x4ac71c){if(_0x4ac71c){_0x44e618=_0x4ac71c[_0x8da1('0x39')];if(!_0x447678[_0x8da1('0x36')][_0x8da1('0x3a')](_0x8da1('0x3b'))){_0x540073[_0x8da1('0x25')]=qs[_0x8da1('0x25')](_0x447678[_0x8da1('0x36')]['limit']);_0x540073[_0x8da1('0x23')]=qs['offset'](_0x447678[_0x8da1('0x36')]['offset']);}return _0x438ecc[_0x8da1('0x99')](_0x540073);}})[_0x8da1('0x2a')](function(_0x469e07){if(_0x469e07){return _0x469e07?{'count':_0x44e618,'rows':_0x469e07}:null;}})[_0x8da1('0x2a')](respondWithResult(_0x2b92c7,null))[_0x8da1('0x49')](handleError(_0x2b92c7,null));}; \ No newline at end of file +var _0xae87=['toLowerCase','Queue','addQueues','add','capitalize','ids','removeQueues','remove','isArray','Voice','Chat','Openchannel','QueueId','defaults','TeamVoiceQueue','penalty','User','findOrCreate','emit','user','Queue:save','interface','UserVoiceQueueRt','upsert','format','SIP/%s','voicePause','all','addAgents','spread','removeAgents','Mail','Fax','Whatsapp','Queues','Queue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./team.socket','register','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','then','sendStatus','stack','name','send','index','Team','fieldName','type','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','params','rawAttributes','catch','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','Sequelize','QueryTypes','SELECT','VoiceQueueId','destroy','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','UserFaxQueue','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','findOne','channel','isValidChannel','ValidationError','Unknown\x20channel'];(function(_0xfa1795,_0xadf2f9){var _0x51f59c=function(_0x414bbb){while(--_0x414bbb){_0xfa1795['push'](_0xfa1795['shift']());}};_0x51f59c(++_0xadf2f9);}(_0xae87,0xbe));var _0x7ae8=function(_0x43d701,_0x4bb2e9){_0x43d701=_0x43d701-0x0;var _0x2ec4c6=_0xae87[_0x43d701];return _0x2ec4c6;};'use strict';var emlformat=require(_0x7ae8('0x0'));var rimraf=require(_0x7ae8('0x1'));var zipdir=require(_0x7ae8('0x2'));var jsonpatch=require(_0x7ae8('0x3'));var rp=require(_0x7ae8('0x4'));var moment=require('moment');var BPromise=require(_0x7ae8('0x5'));var Mustache=require('mustache');var util=require(_0x7ae8('0x6'));var path=require(_0x7ae8('0x7'));var sox=require('sox');var csv=require(_0x7ae8('0x8'));var ejs=require(_0x7ae8('0x9'));var fs=require('fs');var fs_extra=require(_0x7ae8('0xa'));var _=require(_0x7ae8('0xb'));var squel=require(_0x7ae8('0xc'));var crypto=require('crypto');var jsforce=require(_0x7ae8('0xd'));var deskjs=require(_0x7ae8('0xe'));var toCsv=require(_0x7ae8('0x8'));var querystring=require('querystring');var Papa=require(_0x7ae8('0xf'));var Redis=require('ioredis');var authService=require(_0x7ae8('0x10'));var qs=require(_0x7ae8('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7ae8('0x12'));var logger=require(_0x7ae8('0x13'))('api');var utils=require(_0x7ae8('0x14'));var config=require(_0x7ae8('0x15'));var licenseUtil=require(_0x7ae8('0x16'));var db=require(_0x7ae8('0x17'))['db'];config[_0x7ae8('0x18')]=_['defaults'](config[_0x7ae8('0x18')],{'host':_0x7ae8('0x19'),'port':0x18eb});var socket=require(_0x7ae8('0x1a'))(new Redis(config[_0x7ae8('0x18')]));require(_0x7ae8('0x1b'))[_0x7ae8('0x1c')](socket);function respondWithStatusCode(_0x36624c,_0x5c38f5){_0x5c38f5=_0x5c38f5||0xcc;return function(_0xf7b539){if(_0xf7b539){return _0x36624c['sendStatus'](_0x5c38f5);}return _0x36624c[_0x7ae8('0x1d')](_0x5c38f5)[_0x7ae8('0x1e')]();};}function respondWithResult(_0x619b7a,_0x458193){_0x458193=_0x458193||0xc8;return function(_0x23430a){if(_0x23430a){return _0x619b7a['status'](_0x458193)['json'](_0x23430a);}};}function respondWithFilteredResult(_0x5f1b92,_0xcdb1d5){return function(_0x25871e){if(_0x25871e){var _0x10e138=typeof _0xcdb1d5[_0x7ae8('0x1f')]===_0x7ae8('0x20')&&typeof _0xcdb1d5[_0x7ae8('0x21')]===_0x7ae8('0x20');var _0x27c1e6=_0x25871e['count'];var _0x369fb2=_0x10e138?0x0:_0xcdb1d5[_0x7ae8('0x1f')];var _0x2f2afb=_0x10e138?_0x25871e[_0x7ae8('0x22')]:_0xcdb1d5[_0x7ae8('0x1f')]+_0xcdb1d5[_0x7ae8('0x21')];var _0x5b489b;if(_0x2f2afb>=_0x27c1e6){_0x2f2afb=_0x27c1e6;_0x5b489b=0xc8;}else{_0x5b489b=0xce;}_0x5f1b92[_0x7ae8('0x1d')](_0x5b489b);return _0x5f1b92[_0x7ae8('0x23')](_0x7ae8('0x24'),_0x369fb2+'-'+_0x2f2afb+'/'+_0x27c1e6)[_0x7ae8('0x25')](_0x25871e);}return null;};}function patchUpdates(_0x3cde0d){return function(_0xd187e3){try{jsonpatch[_0x7ae8('0x26')](_0xd187e3,_0x3cde0d,!![]);}catch(_0x5205a1){return BPromise[_0x7ae8('0x27')](_0x5205a1);}return _0xd187e3['save']();};}function saveUpdates(_0x4c1454,_0x51e39f){return function(_0x291d31){if(_0x291d31){return _0x291d31['update'](_0x4c1454)[_0x7ae8('0x28')](function(_0x49b8bd){return _0x49b8bd;});}return null;};}function handleEntityNotFound(_0x532f1f,_0x312c7c){return function(_0x5ab915){if(!_0x5ab915){_0x532f1f[_0x7ae8('0x29')](0x194);}return _0x5ab915;};}function handleError(_0x2f0bbf,_0x9cb243){_0x9cb243=_0x9cb243||0x1f4;return function(_0x5a832d){logger['error'](_0x5a832d[_0x7ae8('0x2a')]);if(_0x5a832d[_0x7ae8('0x2b')]){delete _0x5a832d[_0x7ae8('0x2b')];}_0x2f0bbf[_0x7ae8('0x1d')](_0x9cb243)[_0x7ae8('0x2c')](_0x5a832d);};}exports[_0x7ae8('0x2d')]=function(_0x1e2bb2,_0x1a9184){var _0x29503c={},_0x10b51c={},_0x104a32={'count':0x0,'rows':[]};var _0x15603b=_['map'](db[_0x7ae8('0x2e')]['rawAttributes'],function(_0x48df09){return{'name':_0x48df09[_0x7ae8('0x2f')],'type':_0x48df09[_0x7ae8('0x30')]['key']};});_0x10b51c[_0x7ae8('0x31')]=_[_0x7ae8('0x32')](_0x15603b,_0x7ae8('0x2b'));_0x10b51c[_0x7ae8('0x33')]=_[_0x7ae8('0x34')](_0x1e2bb2['query']);_0x10b51c[_0x7ae8('0x35')]=_['intersection'](_0x10b51c[_0x7ae8('0x31')],_0x10b51c[_0x7ae8('0x33')]);_0x29503c[_0x7ae8('0x36')]=_[_0x7ae8('0x37')](_0x10b51c[_0x7ae8('0x31')],qs[_0x7ae8('0x38')](_0x1e2bb2['query'][_0x7ae8('0x38')]));_0x29503c[_0x7ae8('0x36')]=_0x29503c[_0x7ae8('0x36')][_0x7ae8('0x39')]?_0x29503c[_0x7ae8('0x36')]:_0x10b51c[_0x7ae8('0x31')];if(!_0x1e2bb2[_0x7ae8('0x33')][_0x7ae8('0x3a')](_0x7ae8('0x3b'))){_0x29503c['limit']=qs[_0x7ae8('0x21')](_0x1e2bb2['query'][_0x7ae8('0x21')]);_0x29503c[_0x7ae8('0x1f')]=qs[_0x7ae8('0x1f')](_0x1e2bb2['query'][_0x7ae8('0x1f')]);}_0x29503c[_0x7ae8('0x3c')]=qs[_0x7ae8('0x3d')](_0x1e2bb2[_0x7ae8('0x33')][_0x7ae8('0x3d')]);_0x29503c[_0x7ae8('0x3e')]=qs['filters'](_[_0x7ae8('0x3f')](_0x1e2bb2[_0x7ae8('0x33')],_0x10b51c['filters']),_0x15603b);if(_0x1e2bb2[_0x7ae8('0x33')][_0x7ae8('0x40')]){_0x29503c[_0x7ae8('0x3e')]=_[_0x7ae8('0x41')](_0x29503c[_0x7ae8('0x3e')],{'$or':_[_0x7ae8('0x32')](_0x15603b,function(_0x377256){if(_0x377256[_0x7ae8('0x30')]!==_0x7ae8('0x42')){var _0x35078f={};_0x35078f[_0x377256[_0x7ae8('0x2b')]]={'$like':'%'+_0x1e2bb2[_0x7ae8('0x33')][_0x7ae8('0x40')]+'%'};return _0x35078f;}})});}_0x29503c=_[_0x7ae8('0x41')]({},_0x29503c,_0x1e2bb2[_0x7ae8('0x43')]);var _0x13a315={'where':_0x29503c[_0x7ae8('0x3e')]};return db['Team']['count'](_0x13a315)[_0x7ae8('0x28')](function(_0x192e1f){_0x104a32['count']=_0x192e1f;if(_0x1e2bb2[_0x7ae8('0x33')][_0x7ae8('0x44')]){_0x29503c[_0x7ae8('0x45')]=[{'all':!![]}];}return db[_0x7ae8('0x2e')][_0x7ae8('0x46')](_0x29503c);})[_0x7ae8('0x28')](function(_0x1e8448){_0x104a32['rows']=_0x1e8448;return _0x104a32;})['then'](respondWithFilteredResult(_0x1a9184,_0x29503c))['catch'](handleError(_0x1a9184,null));};exports['show']=function(_0x4622e2,_0x568cf2){var _0x290e0c={'raw':![],'where':{'id':_0x4622e2[_0x7ae8('0x47')]['id']}},_0x1ca249={};_0x1ca249[_0x7ae8('0x31')]=_['keys'](db['Team'][_0x7ae8('0x48')]);_0x1ca249[_0x7ae8('0x33')]=_['keys'](_0x4622e2[_0x7ae8('0x33')]);_0x1ca249['filters']=_[_0x7ae8('0x37')](_0x1ca249['model'],_0x1ca249[_0x7ae8('0x33')]);_0x290e0c[_0x7ae8('0x36')]=_[_0x7ae8('0x37')](_0x1ca249['model'],qs['fields'](_0x4622e2['query'][_0x7ae8('0x38')]));_0x290e0c['attributes']=_0x290e0c['attributes']['length']?_0x290e0c['attributes']:_0x1ca249[_0x7ae8('0x31')];if(_0x4622e2[_0x7ae8('0x33')]['includeAll']){_0x290e0c[_0x7ae8('0x45')]=[{'all':!![]}];}_0x290e0c=_[_0x7ae8('0x41')]({},_0x290e0c,_0x4622e2[_0x7ae8('0x43')]);return db[_0x7ae8('0x2e')]['find'](_0x290e0c)[_0x7ae8('0x28')](handleEntityNotFound(_0x568cf2,null))[_0x7ae8('0x28')](respondWithResult(_0x568cf2,null))[_0x7ae8('0x49')](handleError(_0x568cf2,null));};exports[_0x7ae8('0x4a')]=function(_0x51b5cb,_0x306d9e){return db[_0x7ae8('0x2e')][_0x7ae8('0x4a')](_0x51b5cb['body'],{})[_0x7ae8('0x28')](function(_0x47f790){var _0x60b7b6=_0x51b5cb['user'][_0x7ae8('0x4b')]({'plain':!![]});if(!_0x60b7b6)throw new Error(_0x7ae8('0x4c'));if(_0x60b7b6[_0x7ae8('0x4d')]==='user'){var _0x31c6d5=_0x47f790[_0x7ae8('0x4b')]({'plain':!![]});var _0x3460ed='Teams';return db['UserProfileSection'][_0x7ae8('0x4e')]({'where':{'name':_0x3460ed,'userProfileId':_0x60b7b6[_0x7ae8('0x4f')]},'raw':!![]})[_0x7ae8('0x28')](function(_0x49cf57){if(_0x49cf57&&_0x49cf57[_0x7ae8('0x50')]===0x0){return db[_0x7ae8('0x51')][_0x7ae8('0x4a')]({'name':_0x31c6d5['name'],'resourceId':_0x31c6d5['id'],'type':_0x49cf57[_0x7ae8('0x2b')],'sectionId':_0x49cf57['id']},{})[_0x7ae8('0x28')](function(){return _0x47f790;});}else{return _0x47f790;}})[_0x7ae8('0x49')](function(_0x49c711){logger[_0x7ae8('0x52')](_0x7ae8('0x53'),_0x49c711);throw _0x49c711;});}return _0x47f790;})['then'](respondWithResult(_0x306d9e,0xc9))[_0x7ae8('0x49')](handleError(_0x306d9e,null));};exports[_0x7ae8('0x54')]=function(_0x41eeb2,_0x1ba3a1){if(_0x41eeb2[_0x7ae8('0x55')]['id']){delete _0x41eeb2[_0x7ae8('0x55')]['id'];}return db[_0x7ae8('0x2e')][_0x7ae8('0x4e')]({'where':{'id':_0x41eeb2['params']['id']}})['then'](handleEntityNotFound(_0x1ba3a1,null))['then'](saveUpdates(_0x41eeb2[_0x7ae8('0x55')],null))[_0x7ae8('0x28')](respondWithResult(_0x1ba3a1,null))['catch'](handleError(_0x1ba3a1,null));};exports['destroy']=function(_0x27ad32,_0x12d1c2){var _0x3804e7=_0x27ad32[_0x7ae8('0x47')]['id'];var _0x12b1b7=[];return db[_0x7ae8('0x56')][_0x7ae8('0x57')](function(_0x1836a8){var _0x526a26=_0x7ae8('0x58')+_0x3804e7;return db[_0x7ae8('0x56')][_0x7ae8('0x33')](_0x526a26,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x1836a8})[_0x7ae8('0x28')](function(_0x191549){_0x12b1b7=_[_0x7ae8('0x32')](_0x191549,function(_0x1c6341){return Number(_0x1c6341[_0x7ae8('0x59')]);});})[_0x7ae8('0x28')](function(){var _0x371404=_0x7ae8('0x5a')+_0x3804e7;return db[_0x7ae8('0x56')][_0x7ae8('0x33')](_0x371404,{'type':db[_0x7ae8('0x5b')][_0x7ae8('0x5c')][_0x7ae8('0x5d')],'raw':!![],'transaction':_0x1836a8});})[_0x7ae8('0x28')](function(_0x3350a4){var _0x1dd8e7=_[_0x7ae8('0x32')](_0x3350a4,function(_0x59aa74){return Number(_0x59aa74[_0x7ae8('0x5e')]);});return db['UserVoiceQueue'][_0x7ae8('0x5f')]({'where':{'UserId':{'$in':_0x12b1b7},'VoiceQueueId':{'$in':_0x1dd8e7}},'transaction':_0x1836a8});})[_0x7ae8('0x28')](function(){var _0x4ffe93=_0x7ae8('0x60')+_0x3804e7;return db['sequelize']['query'](_0x4ffe93,{'type':db['Sequelize'][_0x7ae8('0x5c')][_0x7ae8('0x5d')],'raw':!![],'transaction':_0x1836a8});})[_0x7ae8('0x28')](function(_0x390fff){var _0xa16eef=_[_0x7ae8('0x32')](_0x390fff,function(_0x48ef3f){return Number(_0x48ef3f[_0x7ae8('0x61')]);});return db[_0x7ae8('0x62')][_0x7ae8('0x5f')]({'where':{'UserId':{'$in':_0x12b1b7},'MailQueueId':{'$in':_0xa16eef}},'transaction':_0x1836a8});})[_0x7ae8('0x28')](function(){var _0x235d29=_0x7ae8('0x63')+_0x3804e7;return db['sequelize']['query'](_0x235d29,{'type':db['Sequelize']['QueryTypes'][_0x7ae8('0x5d')],'raw':!![],'transaction':_0x1836a8});})[_0x7ae8('0x28')](function(_0x12a641){var _0x2ba8ba=_[_0x7ae8('0x32')](_0x12a641,function(_0xf8af61){return Number(_0xf8af61[_0x7ae8('0x64')]);});return db[_0x7ae8('0x65')][_0x7ae8('0x5f')]({'where':{'UserId':{'$in':_0x12b1b7},'SmsQueueId':{'$in':_0x2ba8ba}},'transaction':_0x1836a8});})['then'](function(){var _0x39c9f5=_0x7ae8('0x66')+_0x3804e7;return db[_0x7ae8('0x56')][_0x7ae8('0x33')](_0x39c9f5,{'type':db[_0x7ae8('0x5b')][_0x7ae8('0x5c')]['SELECT'],'raw':!![],'transaction':_0x1836a8});})['then'](function(_0x125c48){var _0x9354e8=_['map'](_0x125c48,function(_0x17196f){return Number(_0x17196f['ChatQueueId']);});return db['UserChatQueue'][_0x7ae8('0x5f')]({'where':{'UserId':{'$in':_0x12b1b7},'ChatQueueId':{'$in':_0x9354e8}},'transaction':_0x1836a8});})[_0x7ae8('0x28')](function(){var _0x2564f5=_0x7ae8('0x67')+_0x3804e7;return db[_0x7ae8('0x56')][_0x7ae8('0x33')](_0x2564f5,{'type':db[_0x7ae8('0x5b')][_0x7ae8('0x5c')][_0x7ae8('0x5d')],'raw':!![],'transaction':_0x1836a8});})['then'](function(_0x1d71ab){var _0x55b901=_[_0x7ae8('0x32')](_0x1d71ab,function(_0x347aab){return Number(_0x347aab['FaxQueueId']);});return db[_0x7ae8('0x68')][_0x7ae8('0x5f')]({'where':{'UserId':{'$in':_0x12b1b7},'FaxQueueId':{'$in':_0x55b901}},'transaction':_0x1836a8});})[_0x7ae8('0x28')](function(){var _0x754185='SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20'+_0x3804e7;return db['sequelize'][_0x7ae8('0x33')](_0x754185,{'type':db['Sequelize'][_0x7ae8('0x5c')][_0x7ae8('0x5d')],'raw':!![],'transaction':_0x1836a8});})[_0x7ae8('0x28')](function(_0x5e7e50){var _0x309e89=_[_0x7ae8('0x32')](_0x5e7e50,function(_0x515e65){return Number(_0x515e65['OpenchannelQueueId']);});return db[_0x7ae8('0x69')]['destroy']({'where':{'UserId':{'$in':_0x12b1b7},'OpenchannelQueueId':{'$in':_0x309e89}},'transaction':_0x1836a8});})['then'](function(){var _0x37afe5=_0x7ae8('0x6a')+_0x3804e7;return db[_0x7ae8('0x56')][_0x7ae8('0x33')](_0x37afe5,{'type':db['Sequelize']['QueryTypes'][_0x7ae8('0x5d')],'raw':!![],'transaction':_0x1836a8});})['then'](function(_0x36a35d){var _0x1525f1=_[_0x7ae8('0x32')](_0x36a35d,function(_0x4b5457){return Number(_0x4b5457['WhatsappQueueId']);});return db[_0x7ae8('0x6b')][_0x7ae8('0x5f')]({'where':{'UserId':{'$in':_0x12b1b7},'WhatsappQueueId':{'$in':_0x1525f1}},'transaction':_0x1836a8});})[_0x7ae8('0x28')](function(){return db[_0x7ae8('0x6c')][_0x7ae8('0x4e')]({'where':{'TeamId':_0x3804e7}});})[_0x7ae8('0x28')](function(_0x2aafab){if(_0x2aafab===null){return;}return db[_0x7ae8('0x6d')][_0x7ae8('0x5f')]({'where':{'UserId':{'$in':_0x12b1b7},'VoicePrefixId':_0x2aafab[_0x7ae8('0x6e')]},'transaction':_0x1836a8});})[_0x7ae8('0x28')](function(){return db[_0x7ae8('0x2e')][_0x7ae8('0x5f')]({'where':{'id':_0x3804e7},'cascade':!![],'transaction':_0x1836a8});})[_0x7ae8('0x28')](function(_0x42c4cf){if(_0x42c4cf===0x0){_0x12d1c2[_0x7ae8('0x29')](0x194);}else{return db[_0x7ae8('0x51')][_0x7ae8('0x5f')]({'where':{'type':'Teams','resourceId':_0x3804e7},'cascade':!![],'transaction':_0x1836a8})[_0x7ae8('0x28')](function(){_0x12d1c2[_0x7ae8('0x1d')](0xcc)[_0x7ae8('0x1e')]();});}})[_0x7ae8('0x49')](function(_0x490bfd){_0x12d1c2[_0x7ae8('0x1d')](0x1f4)['send'](_0x490bfd);});});};exports['getQueues']=function(_0x532128,_0x437f0c,_0x45efc1){return db[_0x7ae8('0x2e')][_0x7ae8('0x6f')]({'where':{'id':_0x532128[_0x7ae8('0x47')]['id']}})[_0x7ae8('0x28')](handleEntityNotFound(_0x437f0c,null))[_0x7ae8('0x28')](function(_0x239db2){if(!_0x532128['query'][_0x7ae8('0x70')]||!utils[_0x7ae8('0x71')](_0x532128[_0x7ae8('0x33')]['channel'])){throw new db[(_0x7ae8('0x5b'))][(_0x7ae8('0x72'))](_0x7ae8('0x73'));}var _0x35cae1={};var _0x47bb66={};_0x47bb66[_0x7ae8('0x31')]=_['keys'](db[_['capitalize'](_0x532128['query'][_0x7ae8('0x70')][_0x7ae8('0x74')]())+_0x7ae8('0x75')][_0x7ae8('0x48')]);_0x47bb66[_0x7ae8('0x33')]=_['keys'](_0x532128[_0x7ae8('0x33')]);_0x47bb66[_0x7ae8('0x35')]=_[_0x7ae8('0x37')](_0x47bb66[_0x7ae8('0x31')],_0x47bb66['query']);_0x35cae1['attributes']=_['intersection'](_0x47bb66['model'],qs[_0x7ae8('0x38')](_0x532128[_0x7ae8('0x33')][_0x7ae8('0x38')]));_0x35cae1['attributes']=_0x35cae1['attributes'][_0x7ae8('0x39')]?_0x35cae1[_0x7ae8('0x36')]:_0x47bb66[_0x7ae8('0x31')];_0x35cae1[_0x7ae8('0x21')]=qs[_0x7ae8('0x21')](_0x532128[_0x7ae8('0x33')][_0x7ae8('0x21')]);_0x35cae1['offset']=qs[_0x7ae8('0x1f')](_0x532128[_0x7ae8('0x33')][_0x7ae8('0x1f')]);_0x35cae1['order']=qs[_0x7ae8('0x3d')](_0x532128['query'][_0x7ae8('0x3d')]);_0x35cae1['where']=qs['filters'](_[_0x7ae8('0x3f')](_0x532128['query'],_0x47bb66[_0x7ae8('0x35')]));_0x35cae1=_[_0x7ae8('0x41')]({},_0x35cae1,_0x532128[_0x7ae8('0x43')]);return _0x239db2[_0x7ae8('0x4b')+_['capitalize'](_0x532128[_0x7ae8('0x33')]['channel'][_0x7ae8('0x74')]())+'Queues'](_0x35cae1);})['then'](respondWithResult(_0x437f0c,null))[_0x7ae8('0x49')](handleError(_0x437f0c,null));};exports[_0x7ae8('0x76')]=function(_0x5bbee1,_0x44311a,_0x3d6697){return db['Team']['findOne']({'where':{'id':_0x5bbee1[_0x7ae8('0x47')]['id']}})[_0x7ae8('0x28')](function(_0x454f39){if(_0x454f39){if(!_0x5bbee1[_0x7ae8('0x55')][_0x7ae8('0x70')]||!utils['isValidChannel'](_0x5bbee1[_0x7ae8('0x55')]['channel'])){throw new db[(_0x7ae8('0x5b'))][(_0x7ae8('0x72'))](_0x7ae8('0x73'));}return _0x454f39[_0x7ae8('0x77')+_[_0x7ae8('0x78')](_0x5bbee1[_0x7ae8('0x55')][_0x7ae8('0x70')][_0x7ae8('0x74')]())+'Queues'](_0x5bbee1[_0x7ae8('0x55')][_0x7ae8('0x79')]);}return null;})[_0x7ae8('0x28')](handleEntityNotFound(_0x44311a,null))[_0x7ae8('0x28')](respondWithStatusCode(_0x44311a,null))[_0x7ae8('0x49')](handleError(_0x44311a,null));};exports[_0x7ae8('0x7a')]=function(_0xd593c9,_0x2d8b2d,_0x50e211){return db['Team'][_0x7ae8('0x6f')]({'where':{'id':_0xd593c9[_0x7ae8('0x47')]['id']}})['then'](function(_0x1fff8e){if(_0x1fff8e){if(!_0xd593c9['query']['channel']||!utils['isValidChannel'](_0xd593c9[_0x7ae8('0x33')][_0x7ae8('0x70')])){throw new db['Sequelize'][(_0x7ae8('0x72'))]('Unknown\x20channel');}return _0x1fff8e[_0x7ae8('0x7b')+_['capitalize'](_0xd593c9['query'][_0x7ae8('0x70')][_0x7ae8('0x74')]())+'Queues'](_0xd593c9[_0x7ae8('0x33')][_0x7ae8('0x79')]);}return null;})['then'](handleEntityNotFound(_0x2d8b2d,null))['then'](respondWithStatusCode(_0x2d8b2d,null))[_0x7ae8('0x49')](handleError(_0x2d8b2d,null));};exports['addAgents']=function(_0x14cc73,_0x5ed488){var _0x5854e2=_[_0x7ae8('0x7c')](_0x14cc73[_0x7ae8('0x55')][_0x7ae8('0x79')])?_0x14cc73[_0x7ae8('0x55')][_0x7ae8('0x79')]:[_0x14cc73['body'][_0x7ae8('0x79')]];var _0x56209b=_0x14cc73[_0x7ae8('0x47')]['id'];return db[_0x7ae8('0x2e')][_0x7ae8('0x4e')]({'where':{'id':_0x56209b}})['then'](handleEntityNotFound(_0x5ed488,null))['then'](function(_0x104e30){if(_0x104e30){var _0x1b55e9=[_0x7ae8('0x7d'),_0x7ae8('0x7e'),'Mail','Sms','Fax',_0x7ae8('0x7f'),'Whatsapp'];return db[_0x7ae8('0x56')][_0x7ae8('0x57')](function(_0x418387){var _0x18aa14=_[_0x7ae8('0x32')](_0x1b55e9,function(_0x25f62f){var _0x382cb2={'attributes':['id','name']};if(_0x25f62f===_0x7ae8('0x7d')){_0x382cb2['through']={'attributes':['penalty']};}return _0x104e30['get'+_0x25f62f+'Queues'](_0x382cb2)[_0x7ae8('0x28')](function(_0x2fd140){var _0x5e9797=_[_0x7ae8('0x32')](_0x2fd140,function(_0x2dc591){var _0x27d29e=_[_0x7ae8('0x32')](_0x5854e2,function(_0x2044fd){var _0x4d9d95={'where':{'UserId':_0x2044fd,[_0x25f62f+_0x7ae8('0x80')]:_0x2dc591['id']},'transaction':_0x418387};if(_0x25f62f===_0x7ae8('0x7d')){_0x4d9d95[_0x7ae8('0x81')]={'penalty':_0x2dc591[_0x7ae8('0x82')][_0x7ae8('0x83')]};}return db[_0x7ae8('0x84')+_0x25f62f+'Queue'][_0x7ae8('0x85')](_0x4d9d95)[_0x7ae8('0x28')](function(){socket[_0x7ae8('0x86')](_0x7ae8('0x87')+_0x25f62f+_0x7ae8('0x88'),{'UserId':_0x2044fd,[_0x25f62f+_0x7ae8('0x80')]:_0x2dc591['id']});if(_0x25f62f!==_0x7ae8('0x7d')){return;}return db['User'][_0x7ae8('0x46')]({'where':{'id':_0x5854e2,'online':0x1},'attributes':['id',_0x7ae8('0x2b'),'online','voicePause',_0x7ae8('0x89')],'raw':!![]})[_0x7ae8('0x28')](function(_0x582317){var _0x4333b6=_[_0x7ae8('0x32')](_0x582317,function(_0x484ecd){return db[_0x7ae8('0x8a')][_0x7ae8('0x8b')]({'membername':_0x484ecd[_0x7ae8('0x2b')],'UserId':_0x484ecd['id'],'queue_name':_0x2dc591[_0x7ae8('0x2b')],'VoiceQueueId':_0x2dc591['id'],'interface':_['isNil'](_0x484ecd[_0x7ae8('0x89')])?util[_0x7ae8('0x8c')](_0x7ae8('0x8d'),_0x484ecd[_0x7ae8('0x2b')]):_0x484ecd[_0x7ae8('0x89')],'paused':_0x484ecd[_0x7ae8('0x8e')]||![],'penalty':_0x2dc591['TeamVoiceQueue']['penalty']},{'transaction':_0x418387});});return Promise[_0x7ae8('0x8f')](_0x4333b6);});});});return Promise[_0x7ae8('0x8f')](_0x27d29e);});return Promise[_0x7ae8('0x8f')](_0x5e9797);})[_0x7ae8('0x28')](function(){return db['TeamVoicePrefix'][_0x7ae8('0x6f')]({'where':{'teamId':_0x56209b}})[_0x7ae8('0x28')](function(_0x212448){if(_0x212448){var _0x7a572a=_[_0x7ae8('0x32')](_0x5854e2,function(_0x1b453c){db[_0x7ae8('0x6d')][_0x7ae8('0x8b')]({'UserId':_0x1b453c,'VoicePrefixId':_0x212448['VoicePrefixId']});});return Promise['all'](_0x7a572a);}});});});return Promise[_0x7ae8('0x8f')](_0x18aa14)[_0x7ae8('0x28')](function(){return _0x104e30[_0x7ae8('0x90')](_0x5854e2,{'transaction':_0x418387})[_0x7ae8('0x91')](function(_0x4c833a){return _0x4c833a;});});});}})[_0x7ae8('0x28')](respondWithResult(_0x5ed488,null))['catch'](handleError(_0x5ed488,null));};exports[_0x7ae8('0x92')]=function(_0x1f5965,_0x182cb0){var _0x267ee3=_[_0x7ae8('0x7c')](_0x1f5965[_0x7ae8('0x33')][_0x7ae8('0x79')])?_0x1f5965[_0x7ae8('0x33')][_0x7ae8('0x79')]:[_0x1f5965[_0x7ae8('0x33')][_0x7ae8('0x79')]];var _0x5582ca=_0x1f5965['params']['id'];return db['Team'][_0x7ae8('0x4e')]({'where':{'id':_0x5582ca}})[_0x7ae8('0x28')](handleEntityNotFound(_0x182cb0,null))[_0x7ae8('0x28')](function(_0xdfc96d){if(_0xdfc96d){var _0x357b33=['Voice',_0x7ae8('0x7e'),_0x7ae8('0x93'),'Sms',_0x7ae8('0x94'),_0x7ae8('0x7f'),_0x7ae8('0x95')];return db[_0x7ae8('0x56')][_0x7ae8('0x57')](function(_0x242a38){var _0x3d74e2=_['map'](_0x357b33,function(_0x2f57c8){var _0x159e15={'attributes':['id',_0x7ae8('0x2b')]};return _0xdfc96d[_0x7ae8('0x4b')+_0x2f57c8+_0x7ae8('0x96')](_0x159e15)[_0x7ae8('0x28')](function(_0x10f1d9){var _0x59e392=_[_0x7ae8('0x32')](_0x10f1d9,function(_0x4f38d6){return _0x4f38d6['removeAgents'](_0x267ee3,{'transaction':_0x242a38})[_0x7ae8('0x28')](function(){var _0x28b34d=_['map'](_0x267ee3,function(_0x1140f8){socket['emit'](_0x7ae8('0x87')+_0x2f57c8+_0x7ae8('0x97'),{'UserId':Number(_0x1140f8),[_0x2f57c8+_0x7ae8('0x80')]:_0x4f38d6['id']});if(_0x2f57c8!==_0x7ae8('0x7d')){return;}return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x4f38d6['id'],'UserId':_0x1140f8},'transaction':_0x242a38});});return Promise[_0x7ae8('0x8f')](_0x28b34d);});});return Promise[_0x7ae8('0x8f')](_0x59e392);});});return Promise[_0x7ae8('0x8f')](_0x3d74e2)[_0x7ae8('0x28')](function(){return _0xdfc96d['removeAgents'](_0x267ee3,{'transaction':_0x242a38});})[_0x7ae8('0x28')](function(){return db['TeamVoicePrefix']['findOne']({'where':{'teamId':_0x5582ca}})['then'](function(_0x349db1){if(_0x349db1){var _0x41e375=_['map'](_0x267ee3,function(_0x1ee671){db[_0x7ae8('0x6d')][_0x7ae8('0x5f')]({'where':{'UserId':_0x1ee671,'VoicePrefixId':_0x349db1['VoicePrefixId']}});});return Promise[_0x7ae8('0x8f')](_0x41e375);}});});});}})[_0x7ae8('0x28')](respondWithStatusCode(_0x182cb0,null))[_0x7ae8('0x49')](handleError(_0x182cb0,null));};exports[_0x7ae8('0x98')]=function(_0x4f0fbe,_0x4ceb3f,_0x2dddc5){var _0x1087d9={};var _0x25a669={};var _0x11f22f;var _0x5113e8;return db[_0x7ae8('0x2e')][_0x7ae8('0x6f')]({'where':{'id':_0x4f0fbe[_0x7ae8('0x47')]['id']}})[_0x7ae8('0x28')](handleEntityNotFound(_0x4ceb3f,null))[_0x7ae8('0x28')](function(_0x17cee3){if(_0x17cee3){_0x11f22f=_0x17cee3;_0x25a669[_0x7ae8('0x31')]=_[_0x7ae8('0x34')](db[_0x7ae8('0x84')][_0x7ae8('0x48')]);_0x25a669[_0x7ae8('0x33')]=_[_0x7ae8('0x34')](_0x4f0fbe[_0x7ae8('0x33')]);_0x25a669[_0x7ae8('0x35')]=_[_0x7ae8('0x37')](_0x25a669['model'],_0x25a669['query']);_0x1087d9[_0x7ae8('0x36')]=_[_0x7ae8('0x37')](_0x25a669['model'],qs[_0x7ae8('0x38')](_0x4f0fbe[_0x7ae8('0x33')][_0x7ae8('0x38')]));_0x1087d9[_0x7ae8('0x36')]=_0x1087d9['attributes'][_0x7ae8('0x39')]?_0x1087d9[_0x7ae8('0x36')]:_0x25a669[_0x7ae8('0x31')];_0x1087d9[_0x7ae8('0x3c')]=qs['sort'](_0x4f0fbe[_0x7ae8('0x33')][_0x7ae8('0x3d')]);_0x1087d9['where']=qs[_0x7ae8('0x35')](_[_0x7ae8('0x3f')](_0x4f0fbe['query'],_0x25a669[_0x7ae8('0x35')]));if(_0x4f0fbe['query'][_0x7ae8('0x40')]){_0x1087d9[_0x7ae8('0x3e')]=_[_0x7ae8('0x41')](_0x1087d9['where'],{'$or':_['map'](_0x1087d9[_0x7ae8('0x36')],function(_0x46d21c){var _0x52365c={};_0x52365c[_0x46d21c]={'$like':'%'+_0x4f0fbe[_0x7ae8('0x33')][_0x7ae8('0x40')]+'%'};return _0x52365c;})});}_0x1087d9=_[_0x7ae8('0x41')]({},_0x1087d9,_0x4f0fbe['options']);return _0x11f22f[_0x7ae8('0x98')](_0x1087d9);}})[_0x7ae8('0x28')](function(_0x546945){if(_0x546945){_0x5113e8=_0x546945['length'];if(!_0x4f0fbe['query'][_0x7ae8('0x3a')](_0x7ae8('0x3b'))){_0x1087d9[_0x7ae8('0x21')]=qs['limit'](_0x4f0fbe['query'][_0x7ae8('0x21')]);_0x1087d9[_0x7ae8('0x1f')]=qs[_0x7ae8('0x1f')](_0x4f0fbe[_0x7ae8('0x33')][_0x7ae8('0x1f')]);}return _0x11f22f['getAgents'](_0x1087d9);}})[_0x7ae8('0x28')](function(_0x3cd466){if(_0x3cd466){return _0x3cd466?{'count':_0x5113e8,'rows':_0x3cd466}:null;}})[_0x7ae8('0x28')](respondWithResult(_0x4ceb3f,null))[_0x7ae8('0x49')](handleError(_0x4ceb3f,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 763e19d..174d713 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 _0x9d13=['Team','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x2554c3,_0x1b4b2c){var _0xfe95b6=function(_0x293a79){while(--_0x293a79){_0x2554c3['push'](_0x2554c3['shift']());}};_0xfe95b6(++_0x1b4b2c);}(_0x9d13,0xe9));var _0x39d1=function(_0x2579ba,_0x10dae0){_0x2579ba=_0x2579ba-0x0;var _0x9b1fe0=_0x9d13[_0x2579ba];return _0x9b1fe0;};'use strict';var EventEmitter=require(_0x39d1('0x0'));var Team=require('../../mysqldb')['db'][_0x39d1('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0x39d1('0x2')](0x0);var events={'afterCreate':_0x39d1('0x3'),'afterUpdate':'update','afterDestroy':_0x39d1('0x4')};function emitEvent(_0x4a8dda){return function(_0x119638,_0x2f0f5c,_0x1a2919){TeamEvents['emit'](_0x4a8dda+':'+_0x119638['id'],_0x119638);TeamEvents[_0x39d1('0x5')](_0x4a8dda,_0x119638);_0x1a2919(null);};}for(var e in events){if(events[_0x39d1('0x6')](e)){var event=events[e];Team[_0x39d1('0x7')](e,emitEvent(event));}}module[_0x39d1('0x8')]=TeamEvents; \ No newline at end of file +var _0x6982=['hasOwnProperty','hook','exports','events','../../mysqldb','Team','setMaxListeners','save','remove','emit'];(function(_0x4b8a95,_0x345c94){var _0x25acac=function(_0x2f50f9){while(--_0x2f50f9){_0x4b8a95['push'](_0x4b8a95['shift']());}};_0x25acac(++_0x345c94);}(_0x6982,0x1e3));var _0x2698=function(_0x478fd6,_0x316081){_0x478fd6=_0x478fd6-0x0;var _0x213a8b=_0x6982[_0x478fd6];return _0x213a8b;};'use strict';var EventEmitter=require(_0x2698('0x0'));var Team=require(_0x2698('0x1'))['db'][_0x2698('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x2698('0x3')](0x0);var events={'afterCreate':_0x2698('0x4'),'afterUpdate':'update','afterDestroy':_0x2698('0x5')};function emitEvent(_0x55823e){return function(_0x57e1c0,_0x4feda8,_0x35967c){TeamEvents[_0x2698('0x6')](_0x55823e+':'+_0x57e1c0['id'],_0x57e1c0);TeamEvents['emit'](_0x55823e,_0x57e1c0);_0x35967c(null);};}for(var e in events){if(events[_0x2698('0x7')](e)){var event=events[e];Team[_0x2698('0x8')](e,emitEvent(event));}}module[_0x2698('0x9')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 23bb927..18217e8 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 _0x2e87=['Queues','then','setDataValue','catch','exports','define','Team','teams','Chat','Fax','Mail','Sms','Voice','Whatsapp','resolve','map','all','lodash','./team.attributes'];(function(_0x44039a,_0x2ac8a8){var _0x525de5=function(_0x1dc635){while(--_0x1dc635){_0x44039a['push'](_0x44039a['shift']());}};_0x525de5(++_0x2ac8a8);}(_0x2e87,0x18d));var _0x72e8=function(_0x4e0359,_0x205155){_0x4e0359=_0x4e0359-0x0;var _0x450f0a=_0x2e87[_0x4e0359];return _0x450f0a;};'use strict';var _=require(_0x72e8('0x0'));var attributes=require(_0x72e8('0x1'));function getQueuesByChannel(_0x555a70,_0x4273e2){var _0x343c4e='get'+_0x4273e2+_0x72e8('0x2');return _0x555a70[_0x343c4e]()[_0x72e8('0x3')](function(_0x3321ed){return _['map'](_0x3321ed,function(_0x2ae3b7){_0x2ae3b7[_0x72e8('0x4')]('channel',_0x4273e2);return _0x2ae3b7;});})[_0x72e8('0x5')](function(_0x561f92){throw _0x561f92;});}module[_0x72e8('0x6')]=function(_0x2b169d){return _0x2b169d[_0x72e8('0x7')](_0x72e8('0x8'),attributes,{'tableName':_0x72e8('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x109615=this;var _0x19638b=[_0x72e8('0xa'),_0x72e8('0xb'),_0x72e8('0xc'),'Openchannel',_0x72e8('0xd'),_0x72e8('0xe'),_0x72e8('0xf')];return Promise[_0x72e8('0x10')]()['then'](function(){var _0x222a52=_[_0x72e8('0x11')](_0x19638b,function(_0xe003cc){return getQueuesByChannel(_0x109615,_0xe003cc);});return Promise[_0x72e8('0x12')](_0x222a52);})[_0x72e8('0x5')](function(_0x3e9917){throw _0x3e9917;});}}});}; \ No newline at end of file +var _0x1cda=['teams','Fax','Openchannel','Voice','Whatsapp','all','lodash','./team.attributes','get','Queues','then','map','setDataValue','channel','catch','exports','define','Team'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0x1cda,0xf0));var _0xa1cd=function(_0x4afb34,_0x4cefef){_0x4afb34=_0x4afb34-0x0;var _0x59973b=_0x1cda[_0x4afb34];return _0x59973b;};'use strict';var _=require(_0xa1cd('0x0'));var attributes=require(_0xa1cd('0x1'));function getQueuesByChannel(_0x179f68,_0xe7a5af){var _0x4174ee=_0xa1cd('0x2')+_0xe7a5af+_0xa1cd('0x3');return _0x179f68[_0x4174ee]()[_0xa1cd('0x4')](function(_0x566213){return _[_0xa1cd('0x5')](_0x566213,function(_0x13cbd3){_0x13cbd3[_0xa1cd('0x6')](_0xa1cd('0x7'),_0xe7a5af);return _0x13cbd3;});})[_0xa1cd('0x8')](function(_0x46cd4b){throw _0x46cd4b;});}module[_0xa1cd('0x9')]=function(_0x1b3032){return _0x1b3032[_0xa1cd('0xa')](_0xa1cd('0xb'),attributes,{'tableName':_0xa1cd('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x250071=this;var _0xf46530=['Chat',_0xa1cd('0xd'),'Mail',_0xa1cd('0xe'),'Sms',_0xa1cd('0xf'),_0xa1cd('0x10')];return Promise['resolve']()[_0xa1cd('0x4')](function(){var _0x2bfdba=_[_0xa1cd('0x5')](_0xf46530,function(_0x57ca9d){return getQueuesByChannel(_0x250071,_0x57ca9d);});return Promise[_0xa1cd('0x11')](_0x2bfdba);})[_0xa1cd('0x8')](function(_0x1d299d){throw _0x1d299d;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 0cc16ad..1bb1d45 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 _0x97ae=['info','Team,\x20%s,\x20%s','request\x20sent','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','client','http','redis','defaults','localhost','socket.io-emitter','./team.socket','register','request'];(function(_0x295314,_0x17b250){var _0x584b0c=function(_0x51cc84){while(--_0x51cc84){_0x295314['push'](_0x295314['shift']());}};_0x584b0c(++_0x17b250);}(_0x97ae,0x142));var _0xe97a=function(_0x18baeb,_0x5d27eb){_0x18baeb=_0x18baeb-0x0;var _0x181abb=_0x97ae[_0x18baeb];return _0x181abb;};'use strict';var _=require(_0xe97a('0x0'));var util=require('util');var moment=require(_0xe97a('0x1'));var BPromise=require(_0xe97a('0x2'));var rs=require(_0xe97a('0x3'));var fs=require('fs');var Redis=require(_0xe97a('0x4'));var db=require(_0xe97a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe97a('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe97a('0x7')][_0xe97a('0x8')]({'port':0x232a});config[_0xe97a('0x9')]=_[_0xe97a('0xa')](config['redis'],{'host':_0xe97a('0xb'),'port':0x18eb});var socket=require(_0xe97a('0xc'))(new Redis(config[_0xe97a('0x9')]));require(_0xe97a('0xd'))[_0xe97a('0xe')](socket);function respondWithRpcPromise(_0x466de3,_0x50c2ac,_0xc375c8){return new BPromise(function(_0x3bb848,_0x39dcd3){return client[_0xe97a('0xf')](_0x466de3,_0xc375c8)['then'](function(_0xb61d06){logger[_0xe97a('0x10')](_0xe97a('0x11'),_0x50c2ac,_0xe97a('0x12'));logger['debug'](_0xe97a('0x13'),_0x50c2ac,_0xe97a('0x12'),JSON[_0xe97a('0x14')](_0xb61d06));if(_0xb61d06[_0xe97a('0x15')]){if(_0xb61d06[_0xe97a('0x15')][_0xe97a('0x16')]===0x1f4){logger[_0xe97a('0x15')](_0xe97a('0x11'),_0x50c2ac,_0xb61d06[_0xe97a('0x15')][_0xe97a('0x17')]);return _0x39dcd3(_0xb61d06[_0xe97a('0x15')][_0xe97a('0x17')]);}logger['error'](_0xe97a('0x11'),_0x50c2ac,_0xb61d06[_0xe97a('0x15')]['message']);return _0x3bb848(_0xb61d06[_0xe97a('0x15')][_0xe97a('0x17')]);}else{logger[_0xe97a('0x10')](_0xe97a('0x11'),_0x50c2ac,_0xe97a('0x12'));_0x3bb848(_0xb61d06[_0xe97a('0x18')][_0xe97a('0x17')]);}})[_0xe97a('0x19')](function(_0x276974){logger[_0xe97a('0x15')](_0xe97a('0x11'),_0x50c2ac,_0x276974);_0x39dcd3(_0x276974);});});} \ No newline at end of file +var _0xc446=['catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','redis','defaults','localhost','register','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','Team,\x20%s,\x20%s','message','info'];(function(_0x48b195,_0x32c180){var _0x42d86d=function(_0x5bd14e){while(--_0x5bd14e){_0x48b195['push'](_0x48b195['shift']());}};_0x42d86d(++_0x32c180);}(_0xc446,0xd9));var _0x6c44=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc446[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6c44('0x0'));var util=require(_0x6c44('0x1'));var moment=require(_0x6c44('0x2'));var BPromise=require('bluebird');var rs=require(_0x6c44('0x3'));var fs=require('fs');var Redis=require(_0x6c44('0x4'));var db=require(_0x6c44('0x5'))['db'];var utils=require(_0x6c44('0x6'));var logger=require(_0x6c44('0x7'))(_0x6c44('0x8'));var config=require(_0x6c44('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x6c44('0xa')]=_[_0x6c44('0xb')](config[_0x6c44('0xa')],{'host':_0x6c44('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./team.socket')[_0x6c44('0xd')](socket);function respondWithRpcPromise(_0x11dc90,_0x274102,_0x18f0f0){return new BPromise(function(_0x3d69d6,_0x8180d1){return client['request'](_0x11dc90,_0x18f0f0)['then'](function(_0x2121b0){logger['info']('Team,\x20%s,\x20%s',_0x274102,_0x6c44('0xe'));logger[_0x6c44('0xf')](_0x6c44('0x10'),_0x274102,_0x6c44('0xe'),JSON[_0x6c44('0x11')](_0x2121b0));if(_0x2121b0[_0x6c44('0x12')]){if(_0x2121b0[_0x6c44('0x12')][_0x6c44('0x13')]===0x1f4){logger[_0x6c44('0x12')](_0x6c44('0x14'),_0x274102,_0x2121b0[_0x6c44('0x12')][_0x6c44('0x15')]);return _0x8180d1(_0x2121b0['error'][_0x6c44('0x15')]);}logger[_0x6c44('0x12')](_0x6c44('0x14'),_0x274102,_0x2121b0['error'][_0x6c44('0x15')]);return _0x3d69d6(_0x2121b0[_0x6c44('0x12')][_0x6c44('0x15')]);}else{logger[_0x6c44('0x16')]('Team,\x20%s,\x20%s',_0x274102,_0x6c44('0xe'));_0x3d69d6(_0x2121b0['result'][_0x6c44('0x15')]);}})[_0x6c44('0x17')](function(_0x418776){logger[_0x6c44('0x12')]('Team,\x20%s,\x20%s',_0x274102,_0x418776);_0x8180d1(_0x418776);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 983ffec..3060f72 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 _0xd235=['emit','removeListener','register','team:','./team.events','save','remove'];(function(_0x26a818,_0x40708a){var _0x5d8ca0=function(_0x3cc7ed){while(--_0x3cc7ed){_0x26a818['push'](_0x26a818['shift']());}};_0x5d8ca0(++_0x40708a);}(_0xd235,0x11c));var _0x5d23=function(_0x185d9a,_0x145c97){_0x185d9a=_0x185d9a-0x0;var _0x242c0c=_0xd235[_0x185d9a];return _0x242c0c;};'use strict';var TeamEvents=require(_0x5d23('0x0'));var events=[_0x5d23('0x1'),_0x5d23('0x2'),'update'];function createListener(_0x4a896a,_0x1b61c5){return function(_0x481361){_0x1b61c5[_0x5d23('0x3')](_0x4a896a,_0x481361);};}function removeListener(_0x2cd9f2,_0x40099d){return function(){TeamEvents[_0x5d23('0x4')](_0x2cd9f2,_0x40099d);};}exports[_0x5d23('0x5')]=function(_0x3db210){for(var _0x47d961=0x0,_0x4cf395=events['length'];_0x47d961<_0x4cf395;_0x47d961++){var _0x1e447c=events[_0x47d961];var _0x45bc11=createListener(_0x5d23('0x6')+_0x1e447c,_0x3db210);TeamEvents['on'](_0x1e447c,_0x45bc11);}}; \ No newline at end of file +var _0x643b=['removeListener','register','length','team:','./team.events','save','update','emit'];(function(_0x211568,_0x456b3c){var _0x5f22e9=function(_0x19ceca){while(--_0x19ceca){_0x211568['push'](_0x211568['shift']());}};_0x5f22e9(++_0x456b3c);}(_0x643b,0x1dc));var _0xb643=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x643b[_0x19950b];return _0x3c6b41;};'use strict';var TeamEvents=require(_0xb643('0x0'));var events=[_0xb643('0x1'),'remove',_0xb643('0x2')];function createListener(_0x246dda,_0x1664d1){return function(_0x34b0db){_0x1664d1[_0xb643('0x3')](_0x246dda,_0x34b0db);};}function removeListener(_0x116bba,_0x5776d0){return function(){TeamEvents[_0xb643('0x4')](_0x116bba,_0x5776d0);};}exports[_0xb643('0x5')]=function(_0x201000){for(var _0x26c611=0x0,_0x2695f3=events[_0xb643('0x6')];_0x26c611<_0x2695f3;_0x26c611++){var _0x4d774f=events[_0x26c611];var _0x5a7ac4=createListener(_0xb643('0x7')+_0x4d774f,_0x201000);TeamEvents['on'](_0x4d774f,_0x5a7ac4);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 5b20ae9..5da9c70 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 _0x09dd=['sequelize','exports','INTEGER'];(function(_0x1d83db,_0x89d115){var _0x2dc1d1=function(_0x13fdc3){while(--_0x13fdc3){_0x1d83db['push'](_0x1d83db['shift']());}};_0x2dc1d1(++_0x89d115);}(_0x09dd,0x81));var _0xd09d=function(_0x46401e,_0x2a345b){_0x46401e=_0x46401e-0x0;var _0x447cba=_0x09dd[_0x46401e];return _0x447cba;};'use strict';var Sequelize=require(_0xd09d('0x0'));module[_0xd09d('0x1')]={'TeamId':{'type':Sequelize[_0xd09d('0x2')]},'VoicePrefixId':{'type':Sequelize[_0xd09d('0x2')]}}; \ No newline at end of file +var _0x2be0=['exports','INTEGER','sequelize'];(function(_0x3265af,_0x505052){var _0x15955b=function(_0x20944c){while(--_0x20944c){_0x3265af['push'](_0x3265af['shift']());}};_0x15955b(++_0x505052);}(_0x2be0,0x128));var _0x02be=function(_0x58afd5,_0x534a48){_0x58afd5=_0x58afd5-0x0;var _0x3e503b=_0x2be0[_0x58afd5];return _0x3e503b;};'use strict';var Sequelize=require(_0x02be('0x0'));module[_0x02be('0x1')]={'TeamId':{'type':Sequelize[_0x02be('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x02be('0x2')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 4d38ece..6c8534f 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 _0x3f40=['path','rimraf','../../config/environment','exports','define','TeamVoicePrefix','team_has_voice_prefixes','lodash','util','../../config/logger','moment','request-promise'];(function(_0x4f6dbe,_0x4f49ca){var _0x2d8d00=function(_0x9be233){while(--_0x9be233){_0x4f6dbe['push'](_0x4f6dbe['shift']());}};_0x2d8d00(++_0x4f49ca);}(_0x3f40,0xbb));var _0x03f4=function(_0x29ec2a,_0x1b70dc){_0x29ec2a=_0x29ec2a-0x0;var _0x2ddd2d=_0x3f40[_0x29ec2a];return _0x2ddd2d;};'use strict';var _=require(_0x03f4('0x0'));var util=require(_0x03f4('0x1'));var logger=require(_0x03f4('0x2'))('api');var moment=require(_0x03f4('0x3'));var BPromise=require('bluebird');var rp=require(_0x03f4('0x4'));var fs=require('fs');var path=require(_0x03f4('0x5'));var rimraf=require(_0x03f4('0x6'));var config=require(_0x03f4('0x7'));var attributes=require('./teamVoicePrefix.attributes');module[_0x03f4('0x8')]=function(_0x3b42bb,_0x196b64){return _0x3b42bb[_0x03f4('0x9')](_0x03f4('0xa'),attributes,{'tableName':_0x03f4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb03e=['team_has_voice_prefixes','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./teamVoicePrefix.attributes','exports','define','TeamVoicePrefix'];(function(_0x346962,_0x4f69d6){var _0x3f2a3d=function(_0x5cf591){while(--_0x5cf591){_0x346962['push'](_0x346962['shift']());}};_0x3f2a3d(++_0x4f69d6);}(_0xb03e,0x1eb));var _0xeb03=function(_0x1f64d0,_0x3a3fb4){_0x1f64d0=_0x1f64d0-0x0;var _0x224c83=_0xb03e[_0x1f64d0];return _0x224c83;};'use strict';var _=require('lodash');var util=require(_0xeb03('0x0'));var logger=require(_0xeb03('0x1'))(_0xeb03('0x2'));var moment=require(_0xeb03('0x3'));var BPromise=require(_0xeb03('0x4'));var rp=require(_0xeb03('0x5'));var fs=require('fs');var path=require(_0xeb03('0x6'));var rimraf=require(_0xeb03('0x7'));var config=require(_0xeb03('0x8'));var attributes=require(_0xeb03('0x9'));module[_0xeb03('0xa')]=function(_0xee2291,_0x4e1cea){return _0xee2291[_0xeb03('0xb')](_0xeb03('0xc'),attributes,{'tableName':_0xeb03('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 895b9fd..276d215 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(_0x2cbcfa,_0x180afb){var _0x4a1584=function(_0x41b3a9){while(--_0x41b3a9){_0x2cbcfa['push'](_0x2cbcfa['shift']());}};_0x4a1584(++_0x180afb);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x340756,_0xad31ae){_0x340756=_0x340756-0x0;var _0x2ef745=_0xcb91[_0x340756];return _0x2ef745;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x747a90,_0x426acf){var _0x22bf2a=function(_0x38de54){while(--_0x38de54){_0x747a90['push'](_0x747a90['shift']());}};_0x22bf2a(++_0x426acf);}(_0x70e0,0x17b));var _0x070e=function(_0x2f9f20,_0x4f1986){_0x2f9f20=_0x2f9f20-0x0;var _0x332ec5=_0x70e0[_0x2f9f20];return _0x332ec5;};'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/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index d76736c..bf46a9a 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 _0x4e8b=['sequelize','exports','INTEGER'];(function(_0x1cfe33,_0x2e3557){var _0x379597=function(_0x7fdcf6){while(--_0x7fdcf6){_0x1cfe33['push'](_0x1cfe33['shift']());}};_0x379597(++_0x2e3557);}(_0x4e8b,0x159));var _0xb4e8=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x4e8b[_0x3ff085];return _0x2b68c3;};'use strict';var Sequelize=require(_0xb4e8('0x0'));module[_0xb4e8('0x1')]={'penalty':{'type':Sequelize[_0xb4e8('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9d2d=['exports','INTEGER'];(function(_0x98db33,_0x397f20){var _0x5ae63a=function(_0x411f1c){while(--_0x411f1c){_0x98db33['push'](_0x98db33['shift']());}};_0x5ae63a(++_0x397f20);}(_0x9d2d,0x124));var _0xd9d2=function(_0x377061,_0x54cbd7){_0x377061=_0x377061-0x0;var _0x5983c3=_0x9d2d[_0x377061];return _0x5983c3;};'use strict';var Sequelize=require('sequelize');module[_0xd9d2('0x0')]={'penalty':{'type':Sequelize[_0xd9d2('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 0a55dbf..e6f3ad1 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 _0x668b=['team_has_voice_queues','lodash','util','api','moment','request-promise','rimraf','../../config/environment','./teamVoiceQueue.attributes','define','TeamVoiceQueue'];(function(_0x40022a,_0x490e53){var _0x1c8f3a=function(_0x12937a){while(--_0x12937a){_0x40022a['push'](_0x40022a['shift']());}};_0x1c8f3a(++_0x490e53);}(_0x668b,0x140));var _0xb668=function(_0x480bc8,_0x1fac40){_0x480bc8=_0x480bc8-0x0;var _0x28c245=_0x668b[_0x480bc8];return _0x28c245;};'use strict';var _=require(_0xb668('0x0'));var util=require(_0xb668('0x1'));var logger=require('../../config/logger')(_0xb668('0x2'));var moment=require(_0xb668('0x3'));var BPromise=require('bluebird');var rp=require(_0xb668('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb668('0x5'));var config=require(_0xb668('0x6'));var attributes=require(_0xb668('0x7'));module['exports']=function(_0x9b99a8,_0x296fa9){return _0x9b99a8[_0xb668('0x8')](_0xb668('0x9'),attributes,{'tableName':_0xb668('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1a8f=['../../config/logger','api','moment','bluebird','request-promise','exports','TeamVoiceQueue','lodash'];(function(_0x505401,_0xe9276f){var _0x39ae49=function(_0x3bf48c){while(--_0x3bf48c){_0x505401['push'](_0x505401['shift']());}};_0x39ae49(++_0xe9276f);}(_0x1a8f,0x87));var _0xf1a8=function(_0x2390bd,_0x212fbd){_0x2390bd=_0x2390bd-0x0;var _0x3a969d=_0x1a8f[_0x2390bd];return _0x3a969d;};'use strict';var _=require(_0xf1a8('0x0'));var util=require('util');var logger=require(_0xf1a8('0x1'))(_0xf1a8('0x2'));var moment=require(_0xf1a8('0x3'));var BPromise=require(_0xf1a8('0x4'));var rp=require(_0xf1a8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./teamVoiceQueue.attributes');module[_0xf1a8('0x6')]=function(_0x515ff3,_0x29dc33){return _0x515ff3['define'](_0xf1a8('0x7'),attributes,{'tableName':'team_has_voice_queues','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 0847d92..1e94fa2 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 _0x4737=['error','code','message','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','debug','stringify'];(function(_0x3ba8ad,_0x554081){var _0x2ddc6e=function(_0xca1609){while(--_0xca1609){_0x3ba8ad['push'](_0x3ba8ad['shift']());}};_0x2ddc6e(++_0x554081);}(_0x4737,0x141));var _0x7473=function(_0x17e759,_0x194f97){_0x17e759=_0x17e759-0x0;var _0x5e338d=_0x4737[_0x17e759];return _0x5e338d;};'use strict';var _=require(_0x7473('0x0'));var util=require(_0x7473('0x1'));var moment=require(_0x7473('0x2'));var BPromise=require(_0x7473('0x3'));var rs=require(_0x7473('0x4'));var fs=require('fs');var Redis=require(_0x7473('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7473('0x6'))('rpc');var config=require(_0x7473('0x7'));var jayson=require(_0x7473('0x8'));var client=jayson[_0x7473('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x29a7c2,_0x194949,_0x5174c4){return new BPromise(function(_0x1148c9,_0xf88bcc){return client[_0x7473('0xa')](_0x29a7c2,_0x5174c4)[_0x7473('0xb')](function(_0x40f8){logger[_0x7473('0xc')]('TeamVoiceQueue,\x20%s,\x20%s',_0x194949,'request\x20sent');logger[_0x7473('0xd')]('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x194949,'request\x20sent',JSON[_0x7473('0xe')](_0x40f8));if(_0x40f8[_0x7473('0xf')]){if(_0x40f8[_0x7473('0xf')][_0x7473('0x10')]===0x1f4){logger[_0x7473('0xf')]('TeamVoiceQueue,\x20%s,\x20%s',_0x194949,_0x40f8['error'][_0x7473('0x11')]);return _0xf88bcc(_0x40f8[_0x7473('0xf')][_0x7473('0x11')]);}logger[_0x7473('0xf')](_0x7473('0x12'),_0x194949,_0x40f8['error']['message']);return _0x1148c9(_0x40f8['error']['message']);}else{logger[_0x7473('0xc')]('TeamVoiceQueue,\x20%s,\x20%s',_0x194949,_0x7473('0x13'));_0x1148c9(_0x40f8[_0x7473('0x14')][_0x7473('0x11')]);}})['catch'](function(_0xe8e38f){logger[_0x7473('0xf')]('TeamVoiceQueue,\x20%s,\x20%s',_0x194949,_0xe8e38f);_0xf88bcc(_0xe8e38f);});});} \ No newline at end of file +var _0x1036=['request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','TeamVoiceQueue,\x20%s,\x20%s'];(function(_0x415603,_0x21320c){var _0x131e72=function(_0x50092a){while(--_0x50092a){_0x415603['push'](_0x415603['shift']());}};_0x131e72(++_0x21320c);}(_0x1036,0x18f));var _0x6103=function(_0x584a32,_0x19dbe4){_0x584a32=_0x584a32-0x0;var _0xfe6bd7=_0x1036[_0x584a32];return _0xfe6bd7;};'use strict';var _=require(_0x6103('0x0'));var util=require(_0x6103('0x1'));var moment=require('moment');var BPromise=require(_0x6103('0x2'));var rs=require(_0x6103('0x3'));var fs=require('fs');var Redis=require(_0x6103('0x4'));var db=require(_0x6103('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6103('0x6'));var config=require(_0x6103('0x7'));var jayson=require(_0x6103('0x8'));var client=jayson[_0x6103('0x9')][_0x6103('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1c019e,_0x33a804,_0x57ea6d){return new BPromise(function(_0x18887c,_0x4981b9){return client[_0x6103('0xb')](_0x1c019e,_0x57ea6d)[_0x6103('0xc')](function(_0x287611){logger[_0x6103('0xd')](_0x6103('0xe'),_0x33a804,_0x6103('0xf'));logger[_0x6103('0x10')](_0x6103('0x11'),_0x33a804,'request\x20sent',JSON[_0x6103('0x12')](_0x287611));if(_0x287611['error']){if(_0x287611[_0x6103('0x13')][_0x6103('0x14')]===0x1f4){logger['error'](_0x6103('0xe'),_0x33a804,_0x287611[_0x6103('0x13')][_0x6103('0x15')]);return _0x4981b9(_0x287611[_0x6103('0x13')]['message']);}logger[_0x6103('0x13')](_0x6103('0xe'),_0x33a804,_0x287611[_0x6103('0x13')][_0x6103('0x15')]);return _0x18887c(_0x287611[_0x6103('0x13')]['message']);}else{logger[_0x6103('0xd')](_0x6103('0xe'),_0x33a804,_0x6103('0xf'));_0x18887c(_0x287611[_0x6103('0x16')][_0x6103('0x15')]);}})['catch'](function(_0x2aa484){logger[_0x6103('0x13')](_0x6103('0xe'),_0x33a804,_0x2aa484);_0x4981b9(_0x2aa484);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index dd591e6..22bf4e3 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 _0x2c16=['../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','index','/:id','show','put','update','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x2f0542,_0x37d152){var _0x113099=function(_0x199e70){while(--_0x199e70){_0x2f0542['push'](_0x2f0542['shift']());}};_0x113099(++_0x37d152);}(_0x2c16,0xf0));var _0x62c1=function(_0x54f7b8,_0x2fadaa){_0x54f7b8=_0x54f7b8-0x0;var _0x48f6cb=_0x2c16[_0x54f7b8];return _0x48f6cb;};'use strict';var multer=require(_0x62c1('0x0'));var util=require(_0x62c1('0x1'));var path=require(_0x62c1('0x2'));var timeout=require('connect-timeout');var express=require(_0x62c1('0x3'));var router=express[_0x62c1('0x4')]();var fs_extra=require(_0x62c1('0x5'));var auth=require(_0x62c1('0x6'));var interaction=require(_0x62c1('0x7'));var config=require(_0x62c1('0x8'));var controller=require(_0x62c1('0x9'));router[_0x62c1('0xa')]('/',auth[_0x62c1('0xb')](),controller[_0x62c1('0xc')]);router['get'](_0x62c1('0xd'),auth[_0x62c1('0xb')](),controller[_0x62c1('0xe')]);router['post']('/',auth[_0x62c1('0xb')](),controller['create']);router[_0x62c1('0xf')](_0x62c1('0xd'),auth['isAuthenticated'](),controller[_0x62c1('0x10')]);router['delete'](_0x62c1('0xd'),auth[_0x62c1('0xb')](),controller[_0x62c1('0x11')]);module[_0x62c1('0x12')]=router; \ No newline at end of file +var _0xbd9e=['index','get','/:id','show','create','put','delete','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./template.controller','isAuthenticated'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbd9e,0x108));var _0xebd9=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0xbd9e[_0x6cf19c];return _0xce14f3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xebd9('0x0'));var timeout=require('connect-timeout');var express=require(_0xebd9('0x1'));var router=express[_0xebd9('0x2')]();var fs_extra=require(_0xebd9('0x3'));var auth=require(_0xebd9('0x4'));var interaction=require(_0xebd9('0x5'));var config=require('../../config/environment');var controller=require(_0xebd9('0x6'));router['get']('/',auth[_0xebd9('0x7')](),controller[_0xebd9('0x8')]);router[_0xebd9('0x9')](_0xebd9('0xa'),auth[_0xebd9('0x7')](),controller[_0xebd9('0xb')]);router['post']('/',auth[_0xebd9('0x7')](),controller[_0xebd9('0xc')]);router[_0xebd9('0xd')](_0xebd9('0xa'),auth[_0xebd9('0x7')](),controller['update']);router[_0xebd9('0xe')]('/:id',auth[_0xebd9('0x7')](),controller['destroy']);module[_0xebd9('0xf')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index de2cf85..2fa6067 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 _0xa0fd=['exports','STRING','sequelize'];(function(_0x48961c,_0x280e9d){var _0x1d895d=function(_0x248ffa){while(--_0x248ffa){_0x48961c['push'](_0x48961c['shift']());}};_0x1d895d(++_0x280e9d);}(_0xa0fd,0x122));var _0xda0f=function(_0x4363ae,_0x1ae174){_0x4363ae=_0x4363ae-0x0;var _0x550cd6=_0xa0fd[_0x4363ae];return _0x550cd6;};'use strict';var Sequelize=require(_0xda0f('0x0'));module[_0xda0f('0x1')]={'name':{'type':Sequelize[_0xda0f('0x2')]},'description':{'type':Sequelize[_0xda0f('0x2')]},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x6bd5=['exports','TEXT'];(function(_0x11c573,_0x9e7c6e){var _0x6b72de=function(_0x2e8a61){while(--_0x2e8a61){_0x11c573['push'](_0x11c573['shift']());}};_0x6b72de(++_0x9e7c6e);}(_0x6bd5,0x1da));var _0x56bd=function(_0x26f702,_0x3919bf){_0x26f702=_0x26f702-0x0;var _0x11417d=_0x6bd5[_0x26f702];return _0x11417d;};'use strict';var Sequelize=require('sequelize');module[_0x56bd('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize[_0x56bd('0x1')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 1bf0d01..4aa15c1 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 _0x420a=['ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','save','update','then','get','Templates','destroy','name','send','index','Template','rawAttributes','type','key','model','map','query','keys','intersection','fields','length','attributes','nolimit','sort','pick','filters','filter','VIRTUAL','merge','where','includeAll','include','findAll','rows','catch','show','options','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x2609aa,_0x181142){var _0x3679f2=function(_0x4223e9){while(--_0x4223e9){_0x2609aa['push'](_0x2609aa['shift']());}};_0x3679f2(++_0x181142);}(_0x420a,0xeb));var _0xa420=function(_0x4ff524,_0x5430f5){_0x4ff524=_0x4ff524-0x0;var _0x5ac57b=_0x420a[_0x4ff524];return _0x5ac57b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa420('0x0'));var zipdir=require(_0xa420('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa420('0x2'));var moment=require('moment');var BPromise=require(_0xa420('0x3'));var Mustache=require(_0xa420('0x4'));var util=require('util');var path=require(_0xa420('0x5'));var sox=require(_0xa420('0x6'));var csv=require(_0xa420('0x7'));var ejs=require(_0xa420('0x8'));var fs=require('fs');var fs_extra=require(_0xa420('0x9'));var _=require(_0xa420('0xa'));var squel=require(_0xa420('0xb'));var crypto=require(_0xa420('0xc'));var jsforce=require(_0xa420('0xd'));var deskjs=require(_0xa420('0xe'));var toCsv=require(_0xa420('0x7'));var querystring=require(_0xa420('0xf'));var Papa=require(_0xa420('0x10'));var Redis=require(_0xa420('0x11'));var authService=require(_0xa420('0x12'));var qs=require(_0xa420('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa420('0x14'));var logger=require(_0xa420('0x15'))(_0xa420('0x16'));var utils=require(_0xa420('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xa420('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1b6396,_0x239657){_0x239657=_0x239657||0xcc;return function(_0x36df47){if(_0x36df47){return _0x1b6396[_0xa420('0x19')](_0x239657);}return _0x1b6396[_0xa420('0x1a')](_0x239657)[_0xa420('0x1b')]();};}function respondWithResult(_0x8436d1,_0x17e66a){_0x17e66a=_0x17e66a||0xc8;return function(_0x3da58d){if(_0x3da58d){return _0x8436d1[_0xa420('0x1a')](_0x17e66a)[_0xa420('0x1c')](_0x3da58d);}};}function respondWithFilteredResult(_0x4b1b97,_0x42787e){return function(_0x5f3492){if(_0x5f3492){var _0x3a3b43=typeof _0x42787e['offset']==='undefined'&&typeof _0x42787e[_0xa420('0x1d')]===_0xa420('0x1e');var _0x446d41=_0x5f3492[_0xa420('0x1f')];var _0x2d4534=_0x3a3b43?0x0:_0x42787e[_0xa420('0x20')];var _0x4a9513=_0x3a3b43?_0x5f3492['count']:_0x42787e[_0xa420('0x20')]+_0x42787e[_0xa420('0x1d')];var _0x45adc8;if(_0x4a9513>=_0x446d41){_0x4a9513=_0x446d41;_0x45adc8=0xc8;}else{_0x45adc8=0xce;}_0x4b1b97[_0xa420('0x1a')](_0x45adc8);return _0x4b1b97[_0xa420('0x21')](_0xa420('0x22'),_0x2d4534+'-'+_0x4a9513+'/'+_0x446d41)['json'](_0x5f3492);}return null;};}function patchUpdates(_0xb90612){return function(_0x44b1f8){try{jsonpatch['apply'](_0x44b1f8,_0xb90612,!![]);}catch(_0x1b8cb0){return BPromise['reject'](_0x1b8cb0);}return _0x44b1f8[_0xa420('0x23')]();};}function saveUpdates(_0x56cffe,_0x34a686){return function(_0x486564){if(_0x486564){return _0x486564[_0xa420('0x24')](_0x56cffe)[_0xa420('0x25')](function(_0x1b9a01){return _0x1b9a01;});}return null;};}function removeEntity(_0x3c7858,_0x3a5d9c){return function(_0x882572){if(_0x882572){return _0x882572['destroy']()[_0xa420('0x25')](function(){var _0x321380=_0x882572[_0xa420('0x26')]({'plain':!![]});var _0x123acd=_0xa420('0x27');return db['UserProfileResource'][_0xa420('0x28')]({'where':{'type':_0x123acd,'resourceId':_0x321380['id']}})['then'](function(){return _0x882572;});})[_0xa420('0x25')](function(){_0x3c7858['status'](0xcc)[_0xa420('0x1b')]();});}};}function handleEntityNotFound(_0x58814c,_0x54e1dc){return function(_0x4d7a29){if(!_0x4d7a29){_0x58814c[_0xa420('0x19')](0x194);}return _0x4d7a29;};}function handleError(_0x170585,_0x455c61){_0x455c61=_0x455c61||0x1f4;return function(_0x1f4963){logger['error'](_0x1f4963['stack']);if(_0x1f4963[_0xa420('0x29')]){delete _0x1f4963[_0xa420('0x29')];}_0x170585[_0xa420('0x1a')](_0x455c61)[_0xa420('0x2a')](_0x1f4963);};}exports[_0xa420('0x2b')]=function(_0x404aef,_0x131b00){var _0x573311={},_0x126691={},_0x3dff31={'count':0x0,'rows':[]};var _0x56fccd=_['map'](db[_0xa420('0x2c')][_0xa420('0x2d')],function(_0x3e9f27){return{'name':_0x3e9f27['fieldName'],'type':_0x3e9f27[_0xa420('0x2e')][_0xa420('0x2f')]};});_0x126691[_0xa420('0x30')]=_[_0xa420('0x31')](_0x56fccd,_0xa420('0x29'));_0x126691[_0xa420('0x32')]=_[_0xa420('0x33')](_0x404aef[_0xa420('0x32')]);_0x126691['filters']=_['intersection'](_0x126691[_0xa420('0x30')],_0x126691[_0xa420('0x32')]);_0x573311['attributes']=_[_0xa420('0x34')](_0x126691['model'],qs[_0xa420('0x35')](_0x404aef[_0xa420('0x32')][_0xa420('0x35')]));_0x573311['attributes']=_0x573311['attributes'][_0xa420('0x36')]?_0x573311[_0xa420('0x37')]:_0x126691[_0xa420('0x30')];if(!_0x404aef[_0xa420('0x32')]['hasOwnProperty'](_0xa420('0x38'))){_0x573311[_0xa420('0x1d')]=qs[_0xa420('0x1d')](_0x404aef['query'][_0xa420('0x1d')]);_0x573311[_0xa420('0x20')]=qs[_0xa420('0x20')](_0x404aef[_0xa420('0x32')][_0xa420('0x20')]);}_0x573311['order']=qs[_0xa420('0x39')](_0x404aef[_0xa420('0x32')][_0xa420('0x39')]);_0x573311['where']=qs['filters'](_[_0xa420('0x3a')](_0x404aef[_0xa420('0x32')],_0x126691[_0xa420('0x3b')]),_0x56fccd);if(_0x404aef[_0xa420('0x32')][_0xa420('0x3c')]){_0x573311['where']=_['merge'](_0x573311['where'],{'$or':_[_0xa420('0x31')](_0x56fccd,function(_0x4143d5){if(_0x4143d5[_0xa420('0x2e')]!==_0xa420('0x3d')){var _0x6a308f={};_0x6a308f[_0x4143d5[_0xa420('0x29')]]={'$like':'%'+_0x404aef['query'][_0xa420('0x3c')]+'%'};return _0x6a308f;}})});}_0x573311=_[_0xa420('0x3e')]({},_0x573311,_0x404aef['options']);var _0x972f84={'where':_0x573311[_0xa420('0x3f')]};return db[_0xa420('0x2c')][_0xa420('0x1f')](_0x972f84)[_0xa420('0x25')](function(_0x3f72dc){_0x3dff31[_0xa420('0x1f')]=_0x3f72dc;if(_0x404aef[_0xa420('0x32')][_0xa420('0x40')]){_0x573311[_0xa420('0x41')]=[{'all':!![]}];}return db[_0xa420('0x2c')][_0xa420('0x42')](_0x573311);})[_0xa420('0x25')](function(_0x256c14){_0x3dff31[_0xa420('0x43')]=_0x256c14;return _0x3dff31;})[_0xa420('0x25')](respondWithFilteredResult(_0x131b00,_0x573311))[_0xa420('0x44')](handleError(_0x131b00,null));};exports[_0xa420('0x45')]=function(_0x115564,_0x641168){var _0x4fb860={'raw':!![],'where':{'id':_0x115564['params']['id']}},_0x1d66a3={};_0x1d66a3[_0xa420('0x30')]=_[_0xa420('0x33')](db['Template']['rawAttributes']);_0x1d66a3[_0xa420('0x32')]=_[_0xa420('0x33')](_0x115564[_0xa420('0x32')]);_0x1d66a3[_0xa420('0x3b')]=_[_0xa420('0x34')](_0x1d66a3['model'],_0x1d66a3[_0xa420('0x32')]);_0x4fb860[_0xa420('0x37')]=_[_0xa420('0x34')](_0x1d66a3[_0xa420('0x30')],qs['fields'](_0x115564[_0xa420('0x32')][_0xa420('0x35')]));_0x4fb860[_0xa420('0x37')]=_0x4fb860[_0xa420('0x37')][_0xa420('0x36')]?_0x4fb860[_0xa420('0x37')]:_0x1d66a3['model'];if(_0x115564[_0xa420('0x32')][_0xa420('0x40')]){_0x4fb860[_0xa420('0x41')]=[{'all':!![]}];}_0x4fb860=_[_0xa420('0x3e')]({},_0x4fb860,_0x115564[_0xa420('0x46')]);return db[_0xa420('0x2c')]['find'](_0x4fb860)['then'](handleEntityNotFound(_0x641168,null))['then'](respondWithResult(_0x641168,null))[_0xa420('0x44')](handleError(_0x641168,null));};exports[_0xa420('0x47')]=function(_0x144a87,_0x515893){return db[_0xa420('0x2c')][_0xa420('0x47')](_0x144a87[_0xa420('0x48')],{})[_0xa420('0x25')](function(_0xcadbe4){var _0x11bedd=_0x144a87['user'][_0xa420('0x26')]({'plain':!![]});if(!_0x11bedd)throw new Error(_0xa420('0x49'));if(_0x11bedd[_0xa420('0x4a')]===_0xa420('0x4b')){var _0x2f1862=_0xcadbe4[_0xa420('0x26')]({'plain':!![]});var _0x55d937=_0xa420('0x27');return db[_0xa420('0x4c')][_0xa420('0x4d')]({'where':{'name':_0x55d937,'userProfileId':_0x11bedd[_0xa420('0x4e')]},'raw':!![]})[_0xa420('0x25')](function(_0x26183b){if(_0x26183b&&_0x26183b[_0xa420('0x4f')]===0x0){return db[_0xa420('0x50')]['create']({'name':_0x2f1862[_0xa420('0x29')],'resourceId':_0x2f1862['id'],'type':_0x26183b['name'],'sectionId':_0x26183b['id']},{})[_0xa420('0x25')](function(){return _0xcadbe4;});}else{return _0xcadbe4;}})['catch'](function(_0x19ca0c){logger[_0xa420('0x51')](_0xa420('0x52'),_0x19ca0c);throw _0x19ca0c;});}return _0xcadbe4;})[_0xa420('0x25')](respondWithResult(_0x515893,0xc9))[_0xa420('0x44')](handleError(_0x515893,null));};exports['update']=function(_0x2e024d,_0x8f665b){if(_0x2e024d[_0xa420('0x48')]['id']){delete _0x2e024d[_0xa420('0x48')]['id'];}return db[_0xa420('0x2c')]['find']({'where':{'id':_0x2e024d[_0xa420('0x53')]['id']}})[_0xa420('0x25')](handleEntityNotFound(_0x8f665b,null))['then'](saveUpdates(_0x2e024d[_0xa420('0x48')],null))[_0xa420('0x25')](respondWithResult(_0x8f665b,null))['catch'](handleError(_0x8f665b,null));};exports[_0xa420('0x28')]=function(_0x2cfcff,_0x15c5b0){return db[_0xa420('0x2c')][_0xa420('0x4d')]({'where':{'id':_0x2cfcff[_0xa420('0x53')]['id']}})[_0xa420('0x25')](handleEntityNotFound(_0x15c5b0,null))[_0xa420('0x25')](removeEntity(_0x15c5b0,null))[_0xa420('0x44')](handleError(_0x15c5b0,null));}; \ No newline at end of file +var _0x5cb6=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','get','Templates','UserProfileResource','end','error','stack','name','send','map','Template','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','params','keys','includeAll','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','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'];(function(_0x5daa89,_0x1d6cb8){var _0x1945c9=function(_0xf8bf1d){while(--_0xf8bf1d){_0x5daa89['push'](_0x5daa89['shift']());}};_0x1945c9(++_0x1d6cb8);}(_0x5cb6,0x1ab));var _0x65cb=function(_0x17a0a0,_0x1befaa){_0x17a0a0=_0x17a0a0-0x0;var _0x4da752=_0x5cb6[_0x17a0a0];return _0x4da752;};'use strict';var emlformat=require(_0x65cb('0x0'));var rimraf=require(_0x65cb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x65cb('0x2'));var rp=require(_0x65cb('0x3'));var moment=require(_0x65cb('0x4'));var BPromise=require(_0x65cb('0x5'));var Mustache=require(_0x65cb('0x6'));var util=require(_0x65cb('0x7'));var path=require(_0x65cb('0x8'));var sox=require('sox');var csv=require(_0x65cb('0x9'));var ejs=require(_0x65cb('0xa'));var fs=require('fs');var fs_extra=require(_0x65cb('0xb'));var _=require(_0x65cb('0xc'));var squel=require(_0x65cb('0xd'));var crypto=require(_0x65cb('0xe'));var jsforce=require(_0x65cb('0xf'));var deskjs=require(_0x65cb('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x65cb('0x11'));var authService=require(_0x65cb('0x12'));var qs=require(_0x65cb('0x13'));var as=require(_0x65cb('0x14'));var hardwareService=require(_0x65cb('0x15'));var logger=require(_0x65cb('0x16'))(_0x65cb('0x17'));var utils=require(_0x65cb('0x18'));var config=require(_0x65cb('0x19'));var licenseUtil=require(_0x65cb('0x1a'));var db=require(_0x65cb('0x1b'))['db'];function respondWithStatusCode(_0x544246,_0x2fccb6){_0x2fccb6=_0x2fccb6||0xcc;return function(_0x143a46){if(_0x143a46){return _0x544246[_0x65cb('0x1c')](_0x2fccb6);}return _0x544246[_0x65cb('0x1d')](_0x2fccb6)['end']();};}function respondWithResult(_0x337e83,_0x1c33f1){_0x1c33f1=_0x1c33f1||0xc8;return function(_0x1d85ab){if(_0x1d85ab){return _0x337e83[_0x65cb('0x1d')](_0x1c33f1)[_0x65cb('0x1e')](_0x1d85ab);}};}function respondWithFilteredResult(_0x800ce4,_0x2403ae){return function(_0x149267){if(_0x149267){var _0x23ad9a=typeof _0x2403ae['offset']===_0x65cb('0x1f')&&typeof _0x2403ae[_0x65cb('0x20')]===_0x65cb('0x1f');var _0x9917a7=_0x149267[_0x65cb('0x21')];var _0x5c1f6e=_0x23ad9a?0x0:_0x2403ae[_0x65cb('0x22')];var _0x587faa=_0x23ad9a?_0x149267['count']:_0x2403ae['offset']+_0x2403ae[_0x65cb('0x20')];var _0x1acac7;if(_0x587faa>=_0x9917a7){_0x587faa=_0x9917a7;_0x1acac7=0xc8;}else{_0x1acac7=0xce;}_0x800ce4[_0x65cb('0x1d')](_0x1acac7);return _0x800ce4[_0x65cb('0x23')](_0x65cb('0x24'),_0x5c1f6e+'-'+_0x587faa+'/'+_0x9917a7)[_0x65cb('0x1e')](_0x149267);}return null;};}function patchUpdates(_0x523444){return function(_0xed9f6a){try{jsonpatch[_0x65cb('0x25')](_0xed9f6a,_0x523444,!![]);}catch(_0x2173c9){return BPromise[_0x65cb('0x26')](_0x2173c9);}return _0xed9f6a[_0x65cb('0x27')]();};}function saveUpdates(_0x3defc4,_0x4bf504){return function(_0x1694a9){if(_0x1694a9){return _0x1694a9['update'](_0x3defc4)[_0x65cb('0x28')](function(_0x1a317d){return _0x1a317d;});}return null;};}function removeEntity(_0x1d6466,_0x3553b7){return function(_0x4f58c5){if(_0x4f58c5){return _0x4f58c5[_0x65cb('0x29')]()[_0x65cb('0x28')](function(){var _0x3d65c0=_0x4f58c5[_0x65cb('0x2a')]({'plain':!![]});var _0x496e34=_0x65cb('0x2b');return db[_0x65cb('0x2c')][_0x65cb('0x29')]({'where':{'type':_0x496e34,'resourceId':_0x3d65c0['id']}})[_0x65cb('0x28')](function(){return _0x4f58c5;});})[_0x65cb('0x28')](function(){_0x1d6466['status'](0xcc)[_0x65cb('0x2d')]();});}};}function handleEntityNotFound(_0x2d543a,_0x4ccd7c){return function(_0x281329){if(!_0x281329){_0x2d543a[_0x65cb('0x1c')](0x194);}return _0x281329;};}function handleError(_0xab4ac2,_0x32c852){_0x32c852=_0x32c852||0x1f4;return function(_0x4d749e){logger[_0x65cb('0x2e')](_0x4d749e[_0x65cb('0x2f')]);if(_0x4d749e[_0x65cb('0x30')]){delete _0x4d749e[_0x65cb('0x30')];}_0xab4ac2[_0x65cb('0x1d')](_0x32c852)[_0x65cb('0x31')](_0x4d749e);};}exports['index']=function(_0x459216,_0x3587da){var _0x55f2b0={},_0x1d652f={},_0x14a9ac={'count':0x0,'rows':[]};var _0x40d2db=_[_0x65cb('0x32')](db[_0x65cb('0x33')][_0x65cb('0x34')],function(_0x269ddb){return{'name':_0x269ddb[_0x65cb('0x35')],'type':_0x269ddb[_0x65cb('0x36')][_0x65cb('0x37')]};});_0x1d652f[_0x65cb('0x38')]=_[_0x65cb('0x32')](_0x40d2db,_0x65cb('0x30'));_0x1d652f[_0x65cb('0x39')]=_['keys'](_0x459216[_0x65cb('0x39')]);_0x1d652f[_0x65cb('0x3a')]=_[_0x65cb('0x3b')](_0x1d652f[_0x65cb('0x38')],_0x1d652f[_0x65cb('0x39')]);_0x55f2b0[_0x65cb('0x3c')]=_['intersection'](_0x1d652f[_0x65cb('0x38')],qs[_0x65cb('0x3d')](_0x459216[_0x65cb('0x39')][_0x65cb('0x3d')]));_0x55f2b0[_0x65cb('0x3c')]=_0x55f2b0['attributes'][_0x65cb('0x3e')]?_0x55f2b0[_0x65cb('0x3c')]:_0x1d652f['model'];if(!_0x459216['query'][_0x65cb('0x3f')](_0x65cb('0x40'))){_0x55f2b0[_0x65cb('0x20')]=qs[_0x65cb('0x20')](_0x459216['query'][_0x65cb('0x20')]);_0x55f2b0[_0x65cb('0x22')]=qs[_0x65cb('0x22')](_0x459216[_0x65cb('0x39')][_0x65cb('0x22')]);}_0x55f2b0['order']=qs['sort'](_0x459216[_0x65cb('0x39')][_0x65cb('0x41')]);_0x55f2b0[_0x65cb('0x42')]=qs[_0x65cb('0x3a')](_[_0x65cb('0x43')](_0x459216[_0x65cb('0x39')],_0x1d652f[_0x65cb('0x3a')]),_0x40d2db);if(_0x459216[_0x65cb('0x39')][_0x65cb('0x44')]){_0x55f2b0['where']=_[_0x65cb('0x45')](_0x55f2b0[_0x65cb('0x42')],{'$or':_[_0x65cb('0x32')](_0x40d2db,function(_0x152a53){if(_0x152a53[_0x65cb('0x36')]!==_0x65cb('0x46')){var _0x2970d1={};_0x2970d1[_0x152a53[_0x65cb('0x30')]]={'$like':'%'+_0x459216[_0x65cb('0x39')][_0x65cb('0x44')]+'%'};return _0x2970d1;}})});}_0x55f2b0=_[_0x65cb('0x45')]({},_0x55f2b0,_0x459216[_0x65cb('0x47')]);var _0x1b5228={'where':_0x55f2b0['where']};return db[_0x65cb('0x33')][_0x65cb('0x21')](_0x1b5228)[_0x65cb('0x28')](function(_0x4afb4b){_0x14a9ac[_0x65cb('0x21')]=_0x4afb4b;if(_0x459216[_0x65cb('0x39')]['includeAll']){_0x55f2b0['include']=[{'all':!![]}];}return db[_0x65cb('0x33')][_0x65cb('0x48')](_0x55f2b0);})[_0x65cb('0x28')](function(_0x297017){_0x14a9ac[_0x65cb('0x49')]=_0x297017;return _0x14a9ac;})['then'](respondWithFilteredResult(_0x3587da,_0x55f2b0))['catch'](handleError(_0x3587da,null));};exports['show']=function(_0x5d7568,_0x4f1a8a){var _0x32b371={'raw':!![],'where':{'id':_0x5d7568[_0x65cb('0x4a')]['id']}},_0x1f22de={};_0x1f22de[_0x65cb('0x38')]=_[_0x65cb('0x4b')](db[_0x65cb('0x33')][_0x65cb('0x34')]);_0x1f22de['query']=_[_0x65cb('0x4b')](_0x5d7568[_0x65cb('0x39')]);_0x1f22de[_0x65cb('0x3a')]=_[_0x65cb('0x3b')](_0x1f22de[_0x65cb('0x38')],_0x1f22de[_0x65cb('0x39')]);_0x32b371[_0x65cb('0x3c')]=_['intersection'](_0x1f22de[_0x65cb('0x38')],qs[_0x65cb('0x3d')](_0x5d7568[_0x65cb('0x39')][_0x65cb('0x3d')]));_0x32b371[_0x65cb('0x3c')]=_0x32b371[_0x65cb('0x3c')][_0x65cb('0x3e')]?_0x32b371[_0x65cb('0x3c')]:_0x1f22de[_0x65cb('0x38')];if(_0x5d7568[_0x65cb('0x39')][_0x65cb('0x4c')]){_0x32b371[_0x65cb('0x4d')]=[{'all':!![]}];}_0x32b371=_[_0x65cb('0x45')]({},_0x32b371,_0x5d7568[_0x65cb('0x47')]);return db[_0x65cb('0x33')][_0x65cb('0x4e')](_0x32b371)[_0x65cb('0x28')](handleEntityNotFound(_0x4f1a8a,null))['then'](respondWithResult(_0x4f1a8a,null))['catch'](handleError(_0x4f1a8a,null));};exports[_0x65cb('0x4f')]=function(_0x484c1b,_0x1cb0f6){return db[_0x65cb('0x33')]['create'](_0x484c1b[_0x65cb('0x50')],{})[_0x65cb('0x28')](function(_0x149147){var _0xe7acb4=_0x484c1b[_0x65cb('0x51')]['get']({'plain':!![]});if(!_0xe7acb4)throw new Error(_0x65cb('0x52'));if(_0xe7acb4[_0x65cb('0x53')]===_0x65cb('0x51')){var _0x3a607f=_0x149147['get']({'plain':!![]});var _0x3e5d21=_0x65cb('0x2b');return db[_0x65cb('0x54')][_0x65cb('0x4e')]({'where':{'name':_0x3e5d21,'userProfileId':_0xe7acb4[_0x65cb('0x55')]},'raw':!![]})[_0x65cb('0x28')](function(_0x42b3f0){if(_0x42b3f0&&_0x42b3f0[_0x65cb('0x56')]===0x0){return db['UserProfileResource'][_0x65cb('0x4f')]({'name':_0x3a607f[_0x65cb('0x30')],'resourceId':_0x3a607f['id'],'type':_0x42b3f0[_0x65cb('0x30')],'sectionId':_0x42b3f0['id']},{})['then'](function(){return _0x149147;});}else{return _0x149147;}})[_0x65cb('0x57')](function(_0x5822ad){logger[_0x65cb('0x2e')](_0x65cb('0x58'),_0x5822ad);throw _0x5822ad;});}return _0x149147;})['then'](respondWithResult(_0x1cb0f6,0xc9))['catch'](handleError(_0x1cb0f6,null));};exports[_0x65cb('0x59')]=function(_0x4b061a,_0x40d069){if(_0x4b061a[_0x65cb('0x50')]['id']){delete _0x4b061a[_0x65cb('0x50')]['id'];}return db[_0x65cb('0x33')][_0x65cb('0x4e')]({'where':{'id':_0x4b061a[_0x65cb('0x4a')]['id']}})[_0x65cb('0x28')](handleEntityNotFound(_0x40d069,null))[_0x65cb('0x28')](saveUpdates(_0x4b061a[_0x65cb('0x50')],null))[_0x65cb('0x28')](respondWithResult(_0x40d069,null))[_0x65cb('0x57')](handleError(_0x40d069,null));};exports[_0x65cb('0x29')]=function(_0x242a37,_0x12bf50){return db[_0x65cb('0x33')]['find']({'where':{'id':_0x242a37[_0x65cb('0x4a')]['id']}})[_0x65cb('0x28')](handleEntityNotFound(_0x12bf50,null))['then'](removeEntity(_0x12bf50,null))[_0x65cb('0x57')](handleError(_0x12bf50,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 3be93f8..110e9df 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 _0xbcaf=['moment','bluebird','request-promise','rimraf','../../config/environment','./template.attributes','define','Template','tools_templates','util','../../config/logger'];(function(_0x274a03,_0xa661ae){var _0x53b6dc=function(_0x29a5df){while(--_0x29a5df){_0x274a03['push'](_0x274a03['shift']());}};_0x53b6dc(++_0xa661ae);}(_0xbcaf,0xda));var _0xfbca=function(_0x4d2013,_0x21f7a0){_0x4d2013=_0x4d2013-0x0;var _0x402122=_0xbcaf[_0x4d2013];return _0x402122;};'use strict';var _=require('lodash');var util=require(_0xfbca('0x0'));var logger=require(_0xfbca('0x1'))('api');var moment=require(_0xfbca('0x2'));var BPromise=require(_0xfbca('0x3'));var rp=require(_0xfbca('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfbca('0x5'));var config=require(_0xfbca('0x6'));var attributes=require(_0xfbca('0x7'));module['exports']=function(_0x3a92cc,_0x57c37f){return _0x3a92cc[_0xfbca('0x8')](_0xfbca('0x9'),attributes,{'tableName':_0xfbca('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xce8c=['exports','Template','lodash','util','api','path','../../config/environment','./template.attributes'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xce8c,0x1ca));var _0xcce8=function(_0xbece44,_0x12fb53){_0xbece44=_0xbece44-0x0;var _0x1e7ec3=_0xce8c[_0xbece44];return _0x1e7ec3;};'use strict';var _=require(_0xcce8('0x0'));var util=require(_0xcce8('0x1'));var logger=require('../../config/logger')(_0xcce8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xcce8('0x3'));var rimraf=require('rimraf');var config=require(_0xcce8('0x4'));var attributes=require(_0xcce8('0x5'));module[_0xcce8('0x6')]=function(_0x4cb6ce,_0x2056e8){return _0x4cb6ce['define'](_0xcce8('0x7'),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 09091a8..2c9c4f5 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 _0xe1bf=['raw','where','limit','include','map','attributes','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','GetTemplate','Template','options'];(function(_0x2cfb58,_0x3d9412){var _0xd99951=function(_0x329afa){while(--_0x329afa){_0x2cfb58['push'](_0x2cfb58['shift']());}};_0xd99951(++_0x3d9412);}(_0xe1bf,0x67));var _0xfe1b=function(_0x76bfe7,_0x4c4c23){_0x76bfe7=_0x76bfe7-0x0;var _0x69423d=_0xe1bf[_0x76bfe7];return _0x69423d;};'use strict';var _=require('lodash');var util=require(_0xfe1b('0x0'));var moment=require('moment');var BPromise=require(_0xfe1b('0x1'));var rs=require(_0xfe1b('0x2'));var fs=require('fs');var Redis=require(_0xfe1b('0x3'));var db=require(_0xfe1b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xfe1b('0x5'))(_0xfe1b('0x6'));var config=require(_0xfe1b('0x7'));var jayson=require(_0xfe1b('0x8'));var client=jayson['client'][_0xfe1b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x25a3ae,_0x2c79ea,_0x50a4d9){return new BPromise(function(_0x140ebf,_0x3fe148){return client[_0xfe1b('0xa')](_0x25a3ae,_0x50a4d9)[_0xfe1b('0xb')](function(_0x446abc){logger['info'](_0xfe1b('0xc'),_0x2c79ea,_0xfe1b('0xd'));logger[_0xfe1b('0xe')](_0xfe1b('0xf'),_0x2c79ea,_0xfe1b('0xd'),JSON[_0xfe1b('0x10')](_0x446abc));if(_0x446abc[_0xfe1b('0x11')]){if(_0x446abc[_0xfe1b('0x11')][_0xfe1b('0x12')]===0x1f4){logger[_0xfe1b('0x11')](_0xfe1b('0xc'),_0x2c79ea,_0x446abc[_0xfe1b('0x11')]['message']);return _0x3fe148(_0x446abc[_0xfe1b('0x11')]['message']);}logger[_0xfe1b('0x11')](_0xfe1b('0xc'),_0x2c79ea,_0x446abc[_0xfe1b('0x11')][_0xfe1b('0x13')]);return _0x140ebf(_0x446abc[_0xfe1b('0x11')][_0xfe1b('0x13')]);}else{logger[_0xfe1b('0x14')]('Template,\x20%s,\x20%s',_0x2c79ea,'request\x20sent');_0x140ebf(_0x446abc[_0xfe1b('0x15')][_0xfe1b('0x13')]);}})['catch'](function(_0x3ae71e){logger[_0xfe1b('0x11')](_0xfe1b('0xc'),_0x2c79ea,_0x3ae71e);_0x3fe148(_0x3ae71e);});});}exports[_0xfe1b('0x16')]=function(_0x249f0e){var _0x1df4ac=this;return new Promise(function(_0x5c14b2,_0x52becb){return db[_0xfe1b('0x17')]['findAll']({'raw':_0x249f0e[_0xfe1b('0x18')]?_0x249f0e[_0xfe1b('0x18')][_0xfe1b('0x19')]===undefined?!![]:![]:!![],'where':_0x249f0e[_0xfe1b('0x18')]?_0x249f0e[_0xfe1b('0x18')][_0xfe1b('0x1a')]||null:null,'attributes':_0x249f0e[_0xfe1b('0x18')]?_0x249f0e[_0xfe1b('0x18')]['attributes']||null:null,'limit':_0x249f0e[_0xfe1b('0x18')]?_0x249f0e[_0xfe1b('0x18')][_0xfe1b('0x1b')]||null:null,'include':_0x249f0e[_0xfe1b('0x18')]?_0x249f0e['options'][_0xfe1b('0x1c')]?_[_0xfe1b('0x1d')](_0x249f0e['options'][_0xfe1b('0x1c')],function(_0x595be3){return{'model':db[_0x595be3['model']],'as':_0x595be3['as'],'attributes':_0x595be3[_0xfe1b('0x1e')],'include':_0x595be3['include']?_[_0xfe1b('0x1d')](_0x595be3[_0xfe1b('0x1c')],function(_0x5a8efd){return{'model':db[_0x5a8efd['model']],'as':_0x5a8efd['as'],'attributes':_0x5a8efd['attributes'],'include':_0x5a8efd['include']?_[_0xfe1b('0x1d')](_0x5a8efd['include'],function(_0x248ad2){return{'model':db[_0x248ad2['model']],'as':_0x248ad2['as'],'attributes':_0x248ad2['attributes']};}):[]};}):[]};}):[]:[]})[_0xfe1b('0xb')](function(_0x54e951){logger[_0xfe1b('0x14')](_0xfe1b('0x16'),_0x249f0e);logger[_0xfe1b('0xe')]('GetTemplate',_0x249f0e,JSON[_0xfe1b('0x10')](_0x54e951));_0x5c14b2(_0x54e951);})[_0xfe1b('0x1f')](function(_0x204ca5){logger[_0xfe1b('0x11')](_0xfe1b('0x16'),_0x204ca5['message'],_0x249f0e);_0x52becb(_0x1df4ac[_0xfe1b('0x11')](0x1f4,_0x204ca5[_0xfe1b('0x13')]));});});}; \ No newline at end of file +var _0x9b0c=['message','result','catch','GetTemplate','Template','findAll','raw','options','where','attributes','limit','include','map','model','stringify','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9b0c,0x138));var _0xc9b0=function(_0x3e6a74,_0x477c01){_0x3e6a74=_0x3e6a74-0x0;var _0x1a1ece=_0x9b0c[_0x3e6a74];return _0x1a1ece;};'use strict';var _=require('lodash');var util=require(_0xc9b0('0x0'));var moment=require(_0xc9b0('0x1'));var BPromise=require(_0xc9b0('0x2'));var rs=require(_0xc9b0('0x3'));var fs=require('fs');var Redis=require(_0xc9b0('0x4'));var db=require(_0xc9b0('0x5'))['db'];var utils=require(_0xc9b0('0x6'));var logger=require(_0xc9b0('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc9b0('0x8'));var client=jayson['client'][_0xc9b0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x32c9ee,_0x4e2f6a,_0x550f21){return new BPromise(function(_0x3da873,_0x493fd7){return client[_0xc9b0('0xa')](_0x32c9ee,_0x550f21)['then'](function(_0x664ebb){logger[_0xc9b0('0xb')](_0xc9b0('0xc'),_0x4e2f6a,_0xc9b0('0xd'));logger[_0xc9b0('0xe')](_0xc9b0('0xf'),_0x4e2f6a,'request\x20sent',JSON['stringify'](_0x664ebb));if(_0x664ebb[_0xc9b0('0x10')]){if(_0x664ebb[_0xc9b0('0x10')][_0xc9b0('0x11')]===0x1f4){logger['error'](_0xc9b0('0xc'),_0x4e2f6a,_0x664ebb[_0xc9b0('0x10')]['message']);return _0x493fd7(_0x664ebb[_0xc9b0('0x10')][_0xc9b0('0x12')]);}logger['error'](_0xc9b0('0xc'),_0x4e2f6a,_0x664ebb['error'][_0xc9b0('0x12')]);return _0x3da873(_0x664ebb['error'][_0xc9b0('0x12')]);}else{logger[_0xc9b0('0xb')]('Template,\x20%s,\x20%s',_0x4e2f6a,_0xc9b0('0xd'));_0x3da873(_0x664ebb[_0xc9b0('0x13')][_0xc9b0('0x12')]);}})[_0xc9b0('0x14')](function(_0x5473d6){logger['error'](_0xc9b0('0xc'),_0x4e2f6a,_0x5473d6);_0x493fd7(_0x5473d6);});});}exports[_0xc9b0('0x15')]=function(_0x15ad14){var _0x13a001=this;return new Promise(function(_0x135752,_0x1d2472){return db[_0xc9b0('0x16')][_0xc9b0('0x17')]({'raw':_0x15ad14['options']?_0x15ad14['options'][_0xc9b0('0x18')]===undefined?!![]:![]:!![],'where':_0x15ad14[_0xc9b0('0x19')]?_0x15ad14[_0xc9b0('0x19')][_0xc9b0('0x1a')]||null:null,'attributes':_0x15ad14['options']?_0x15ad14[_0xc9b0('0x19')][_0xc9b0('0x1b')]||null:null,'limit':_0x15ad14[_0xc9b0('0x19')]?_0x15ad14['options'][_0xc9b0('0x1c')]||null:null,'include':_0x15ad14['options']?_0x15ad14['options'][_0xc9b0('0x1d')]?_[_0xc9b0('0x1e')](_0x15ad14[_0xc9b0('0x19')]['include'],function(_0x571703){return{'model':db[_0x571703[_0xc9b0('0x1f')]],'as':_0x571703['as'],'attributes':_0x571703[_0xc9b0('0x1b')],'include':_0x571703['include']?_[_0xc9b0('0x1e')](_0x571703[_0xc9b0('0x1d')],function(_0x562b0b){return{'model':db[_0x562b0b[_0xc9b0('0x1f')]],'as':_0x562b0b['as'],'attributes':_0x562b0b[_0xc9b0('0x1b')],'include':_0x562b0b[_0xc9b0('0x1d')]?_[_0xc9b0('0x1e')](_0x562b0b[_0xc9b0('0x1d')],function(_0x3ea085){return{'model':db[_0x3ea085[_0xc9b0('0x1f')]],'as':_0x3ea085['as'],'attributes':_0x3ea085[_0xc9b0('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x109b68){logger[_0xc9b0('0xb')](_0xc9b0('0x15'),_0x15ad14);logger[_0xc9b0('0xe')](_0xc9b0('0x15'),_0x15ad14,JSON[_0xc9b0('0x20')](_0x109b68));_0x135752(_0x109b68);})['catch'](function(_0x509905){logger[_0xc9b0('0x10')](_0xc9b0('0x15'),_0x509905['message'],_0x15ad14);_0x1d2472(_0x13a001['error'](0x1f4,_0x509905[_0xc9b0('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 0040afa..3fc7f19 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 _0xdadd=['isAuthenticated','show','getAllConditions','/:id/any_conditions','getAnyConditions','getActions','post','create','/:id/all_conditions','addAllCondition','addAnyCondition','/:id/actions','addAction','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./trigger.controller','get','index','/:id'];(function(_0x113e43,_0x2627f8){var _0x3c924a=function(_0x5b58f9){while(--_0x5b58f9){_0x113e43['push'](_0x113e43['shift']());}};_0x3c924a(++_0x2627f8);}(_0xdadd,0x18b));var _0xddad=function(_0x5dcff6,_0x4a8796){_0x5dcff6=_0x5dcff6-0x0;var _0x2699cd=_0xdadd[_0x5dcff6];return _0x2699cd;};'use strict';var multer=require(_0xddad('0x0'));var util=require(_0xddad('0x1'));var path=require('path');var timeout=require(_0xddad('0x2'));var express=require(_0xddad('0x3'));var router=express[_0xddad('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xddad('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xddad('0x6'));var controller=require(_0xddad('0x7'));router[_0xddad('0x8')]('/',auth['isAuthenticated'](),controller[_0xddad('0x9')]);router['get'](_0xddad('0xa'),auth[_0xddad('0xb')](),controller[_0xddad('0xc')]);router['get']('/:id/all_conditions',auth[_0xddad('0xb')](),controller[_0xddad('0xd')]);router[_0xddad('0x8')](_0xddad('0xe'),auth[_0xddad('0xb')](),controller[_0xddad('0xf')]);router[_0xddad('0x8')]('/:id/actions',auth[_0xddad('0xb')](),controller[_0xddad('0x10')]);router[_0xddad('0x11')]('/',auth['isAuthenticated'](),controller[_0xddad('0x12')]);router[_0xddad('0x11')](_0xddad('0x13'),auth[_0xddad('0xb')](),controller[_0xddad('0x14')]);router[_0xddad('0x11')](_0xddad('0xe'),auth[_0xddad('0xb')](),controller[_0xddad('0x15')]);router['post'](_0xddad('0x16'),auth['isAuthenticated'](),controller[_0xddad('0x17')]);router[_0xddad('0x18')]('/:id',auth[_0xddad('0xb')](),controller[_0xddad('0x19')]);router[_0xddad('0x1a')]('/:id',auth[_0xddad('0xb')](),controller[_0xddad('0x1b')]);module[_0xddad('0x1c')]=router; \ No newline at end of file +var _0xcb49=['/:id/any_conditions','/:id/actions','getActions','post','/:id/all_conditions','addAllCondition','addAnyCondition','put','/:id','update','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','show'];(function(_0x235486,_0x426c10){var _0x53ed3=function(_0x250ea8){while(--_0x250ea8){_0x235486['push'](_0x235486['shift']());}};_0x53ed3(++_0x426c10);}(_0xcb49,0x156));var _0x9cb4=function(_0x2a0a38,_0x4a6de5){_0x2a0a38=_0x2a0a38-0x0;var _0x4a200e=_0xcb49[_0x2a0a38];return _0x4a200e;};'use strict';var multer=require(_0x9cb4('0x0'));var util=require('util');var path=require(_0x9cb4('0x1'));var timeout=require(_0x9cb4('0x2'));var express=require(_0x9cb4('0x3'));var router=express[_0x9cb4('0x4')]();var fs_extra=require(_0x9cb4('0x5'));var auth=require(_0x9cb4('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./trigger.controller');router[_0x9cb4('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x9cb4('0x7')]('/:id',auth[_0x9cb4('0x8')](),controller[_0x9cb4('0x9')]);router['get']('/:id/all_conditions',auth[_0x9cb4('0x8')](),controller['getAllConditions']);router[_0x9cb4('0x7')](_0x9cb4('0xa'),auth['isAuthenticated'](),controller['getAnyConditions']);router[_0x9cb4('0x7')](_0x9cb4('0xb'),auth[_0x9cb4('0x8')](),controller[_0x9cb4('0xc')]);router['post']('/',auth[_0x9cb4('0x8')](),controller['create']);router[_0x9cb4('0xd')](_0x9cb4('0xe'),auth[_0x9cb4('0x8')](),controller[_0x9cb4('0xf')]);router[_0x9cb4('0xd')]('/:id/any_conditions',auth[_0x9cb4('0x8')](),controller[_0x9cb4('0x10')]);router['post'](_0x9cb4('0xb'),auth['isAuthenticated'](),controller['addAction']);router[_0x9cb4('0x11')](_0x9cb4('0x12'),auth[_0x9cb4('0x8')](),controller[_0x9cb4('0x13')]);router['delete'](_0x9cb4('0x12'),auth[_0x9cb4('0x8')](),controller[_0x9cb4('0x14')]);module[_0x9cb4('0x15')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 58d8e0d..8c5ee69 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 _0x97bf=['sequelize','exports','STRING','BOOLEAN'];(function(_0x511a2a,_0x390bd3){var _0x520c49=function(_0x56fbb1){while(--_0x56fbb1){_0x511a2a['push'](_0x511a2a['shift']());}};_0x520c49(++_0x390bd3);}(_0x97bf,0x188));var _0xf97b=function(_0x1d0723,_0x248e67){_0x1d0723=_0x1d0723-0x0;var _0xd2e1a4=_0x97bf[_0x1d0723];return _0xd2e1a4;};'use strict';var Sequelize=require(_0xf97b('0x0'));module[_0xf97b('0x1')]={'name':{'type':Sequelize[_0xf97b('0x2')]},'channel':{'type':Sequelize[_0xf97b('0x2')]},'description':{'type':Sequelize[_0xf97b('0x2')]},'status':{'type':Sequelize[_0xf97b('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x1d8a=['STRING','BOOLEAN','exports'];(function(_0x1eb786,_0x1b5f72){var _0x460cad=function(_0x3ec7a6){while(--_0x3ec7a6){_0x1eb786['push'](_0x1eb786['shift']());}};_0x460cad(++_0x1b5f72);}(_0x1d8a,0x1f1));var _0xa1d8=function(_0x27d61e,_0x417f72){_0x27d61e=_0x27d61e-0x0;var _0x6b4512=_0x1d8a[_0x27d61e];return _0x6b4512;};'use strict';var Sequelize=require('sequelize');module[_0xa1d8('0x0')]={'name':{'type':Sequelize[_0xa1d8('0x1')]},'channel':{'type':Sequelize[_0xa1d8('0x1')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0xa1d8('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 53f35f6..e52f370 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 _0x4426=['rimraf','zip-dir','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Triggers','UserProfileResource','error','stack','name','map','Trigger','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','addAllCondition','Condition','getAllConditions','findOne','pick','getAnyConditions','addAction','Action','getActions'];(function(_0x4f6f1d,_0x23dc49){var _0x1c2341=function(_0xd606e5){while(--_0xd606e5){_0x4f6f1d['push'](_0x4f6f1d['shift']());}};_0x1c2341(++_0x23dc49);}(_0x4426,0x168));var _0x6442=function(_0x12d15e,_0x2037e3){_0x12d15e=_0x12d15e-0x0;var _0x2412d2=_0x4426[_0x12d15e];return _0x2412d2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6442('0x0'));var zipdir=require(_0x6442('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6442('0x2'));var BPromise=require(_0x6442('0x3'));var Mustache=require('mustache');var util=require(_0x6442('0x4'));var path=require(_0x6442('0x5'));var sox=require(_0x6442('0x6'));var csv=require(_0x6442('0x7'));var ejs=require(_0x6442('0x8'));var fs=require('fs');var fs_extra=require(_0x6442('0x9'));var _=require(_0x6442('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6442('0xb'));var deskjs=require(_0x6442('0xc'));var toCsv=require(_0x6442('0x7'));var querystring=require(_0x6442('0xd'));var Papa=require('papaparse');var Redis=require(_0x6442('0xe'));var authService=require(_0x6442('0xf'));var qs=require(_0x6442('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6442('0x11'));var logger=require(_0x6442('0x12'))(_0x6442('0x13'));var utils=require('../../config/utils');var config=require(_0x6442('0x14'));var licenseUtil=require(_0x6442('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x292e87,_0x3f16a6){_0x3f16a6=_0x3f16a6||0xcc;return function(_0x27ce06){if(_0x27ce06){return _0x292e87[_0x6442('0x16')](_0x3f16a6);}return _0x292e87[_0x6442('0x17')](_0x3f16a6)[_0x6442('0x18')]();};}function respondWithResult(_0x28750b,_0x12950c){_0x12950c=_0x12950c||0xc8;return function(_0x77f9fb){if(_0x77f9fb){return _0x28750b[_0x6442('0x17')](_0x12950c)[_0x6442('0x19')](_0x77f9fb);}};}function respondWithFilteredResult(_0x43d185,_0x5a2fce){return function(_0x34c920){if(_0x34c920){var _0x56fff9=typeof _0x5a2fce[_0x6442('0x1a')]===_0x6442('0x1b')&&typeof _0x5a2fce['limit']==='undefined';var _0x5f4bd1=_0x34c920[_0x6442('0x1c')];var _0x6cd029=_0x56fff9?0x0:_0x5a2fce[_0x6442('0x1a')];var _0x2d2c10=_0x56fff9?_0x34c920[_0x6442('0x1c')]:_0x5a2fce['offset']+_0x5a2fce['limit'];var _0x3047e3;if(_0x2d2c10>=_0x5f4bd1){_0x2d2c10=_0x5f4bd1;_0x3047e3=0xc8;}else{_0x3047e3=0xce;}_0x43d185[_0x6442('0x17')](_0x3047e3);return _0x43d185[_0x6442('0x1d')](_0x6442('0x1e'),_0x6cd029+'-'+_0x2d2c10+'/'+_0x5f4bd1)['json'](_0x34c920);}return null;};}function patchUpdates(_0x1524d2){return function(_0x1d55f1){try{jsonpatch[_0x6442('0x1f')](_0x1d55f1,_0x1524d2,!![]);}catch(_0xc60f85){return BPromise[_0x6442('0x20')](_0xc60f85);}return _0x1d55f1[_0x6442('0x21')]();};}function saveUpdates(_0x190b48,_0x160088){return function(_0x380319){if(_0x380319){return _0x380319[_0x6442('0x22')](_0x190b48)[_0x6442('0x23')](function(_0x64b6ae){return _0x64b6ae;});}return null;};}function removeEntity(_0x5abb91,_0x105690){return function(_0x47fe52){if(_0x47fe52){return _0x47fe52[_0x6442('0x24')]()['then'](function(){var _0x440bdc=_0x47fe52[_0x6442('0x25')]({'plain':!![]});var _0x50e1c9=_0x6442('0x26');return db[_0x6442('0x27')][_0x6442('0x24')]({'where':{'type':_0x50e1c9,'resourceId':_0x440bdc['id']}})[_0x6442('0x23')](function(){return _0x47fe52;});})[_0x6442('0x23')](function(){_0x5abb91[_0x6442('0x17')](0xcc)[_0x6442('0x18')]();});}};}function handleEntityNotFound(_0x59c2da,_0x4ba2fa){return function(_0x43f401){if(!_0x43f401){_0x59c2da['sendStatus'](0x194);}return _0x43f401;};}function handleError(_0x3f32a6,_0x292465){_0x292465=_0x292465||0x1f4;return function(_0x2905e3){logger[_0x6442('0x28')](_0x2905e3[_0x6442('0x29')]);if(_0x2905e3[_0x6442('0x2a')]){delete _0x2905e3[_0x6442('0x2a')];}_0x3f32a6['status'](_0x292465)['send'](_0x2905e3);};}exports['index']=function(_0x5283b6,_0x25e07f){var _0x11aaed={},_0x93d0c7={},_0xfbec1a={'count':0x0,'rows':[]};var _0x12b188=_[_0x6442('0x2b')](db[_0x6442('0x2c')][_0x6442('0x2d')],function(_0xe604c9){return{'name':_0xe604c9[_0x6442('0x2e')],'type':_0xe604c9[_0x6442('0x2f')][_0x6442('0x30')]};});_0x93d0c7[_0x6442('0x31')]=_[_0x6442('0x2b')](_0x12b188,_0x6442('0x2a'));_0x93d0c7['query']=_[_0x6442('0x32')](_0x5283b6['query']);_0x93d0c7[_0x6442('0x33')]=_[_0x6442('0x34')](_0x93d0c7[_0x6442('0x31')],_0x93d0c7[_0x6442('0x35')]);_0x11aaed[_0x6442('0x36')]=_[_0x6442('0x34')](_0x93d0c7[_0x6442('0x31')],qs[_0x6442('0x37')](_0x5283b6[_0x6442('0x35')][_0x6442('0x37')]));_0x11aaed[_0x6442('0x36')]=_0x11aaed[_0x6442('0x36')][_0x6442('0x38')]?_0x11aaed['attributes']:_0x93d0c7[_0x6442('0x31')];if(!_0x5283b6[_0x6442('0x35')][_0x6442('0x39')](_0x6442('0x3a'))){_0x11aaed[_0x6442('0x3b')]=qs[_0x6442('0x3b')](_0x5283b6[_0x6442('0x35')][_0x6442('0x3b')]);_0x11aaed['offset']=qs[_0x6442('0x1a')](_0x5283b6[_0x6442('0x35')][_0x6442('0x1a')]);}_0x11aaed[_0x6442('0x3c')]=qs[_0x6442('0x3d')](_0x5283b6[_0x6442('0x35')][_0x6442('0x3d')]);_0x11aaed[_0x6442('0x3e')]=qs['filters'](_['pick'](_0x5283b6['query'],_0x93d0c7['filters']),_0x12b188);if(_0x5283b6[_0x6442('0x35')][_0x6442('0x3f')]){_0x11aaed[_0x6442('0x3e')]=_[_0x6442('0x40')](_0x11aaed[_0x6442('0x3e')],{'$or':_[_0x6442('0x2b')](_0x12b188,function(_0x3e1c9d){if(_0x3e1c9d[_0x6442('0x2f')]!=='VIRTUAL'){var _0xc074a9={};_0xc074a9[_0x3e1c9d[_0x6442('0x2a')]]={'$like':'%'+_0x5283b6[_0x6442('0x35')][_0x6442('0x3f')]+'%'};return _0xc074a9;}})});}_0x11aaed=_[_0x6442('0x40')]({},_0x11aaed,_0x5283b6[_0x6442('0x41')]);var _0x187042={'where':_0x11aaed[_0x6442('0x3e')]};return db[_0x6442('0x2c')]['count'](_0x187042)[_0x6442('0x23')](function(_0x2937eb){_0xfbec1a[_0x6442('0x1c')]=_0x2937eb;if(_0x5283b6[_0x6442('0x35')][_0x6442('0x42')]){_0x11aaed[_0x6442('0x43')]=[{'all':!![]}];}return db[_0x6442('0x2c')][_0x6442('0x44')](_0x11aaed);})[_0x6442('0x23')](function(_0x5c64d6){_0xfbec1a[_0x6442('0x45')]=_0x5c64d6;return _0xfbec1a;})[_0x6442('0x23')](respondWithFilteredResult(_0x25e07f,_0x11aaed))[_0x6442('0x46')](handleError(_0x25e07f,null));};exports[_0x6442('0x47')]=function(_0x29ddf9,_0x4a6b4d){var _0x47595d={'raw':![],'where':{'id':_0x29ddf9[_0x6442('0x48')]['id']}},_0x240820={};_0x240820['model']=_[_0x6442('0x32')](db[_0x6442('0x2c')]['rawAttributes']);_0x240820['query']=_[_0x6442('0x32')](_0x29ddf9[_0x6442('0x35')]);_0x240820[_0x6442('0x33')]=_[_0x6442('0x34')](_0x240820[_0x6442('0x31')],_0x240820['query']);_0x47595d[_0x6442('0x36')]=_['intersection'](_0x240820[_0x6442('0x31')],qs[_0x6442('0x37')](_0x29ddf9[_0x6442('0x35')][_0x6442('0x37')]));_0x47595d[_0x6442('0x36')]=_0x47595d[_0x6442('0x36')][_0x6442('0x38')]?_0x47595d[_0x6442('0x36')]:_0x240820['model'];if(_0x29ddf9[_0x6442('0x35')][_0x6442('0x42')]){_0x47595d[_0x6442('0x43')]=[{'all':!![]}];}_0x47595d=_['merge']({},_0x47595d,_0x29ddf9[_0x6442('0x41')]);return db[_0x6442('0x2c')]['find'](_0x47595d)['then'](handleEntityNotFound(_0x4a6b4d,null))[_0x6442('0x23')](respondWithResult(_0x4a6b4d,null))[_0x6442('0x46')](handleError(_0x4a6b4d,null));};exports['create']=function(_0x3c91fb,_0x2f63a9){return db[_0x6442('0x2c')][_0x6442('0x49')](_0x3c91fb[_0x6442('0x4a')],{})['then'](function(_0x16541c){var _0x1c358b=_0x3c91fb[_0x6442('0x4b')]['get']({'plain':!![]});if(!_0x1c358b)throw new Error(_0x6442('0x4c'));if(_0x1c358b[_0x6442('0x4d')]==='user'){var _0x162b93=_0x16541c[_0x6442('0x25')]({'plain':!![]});var _0x3f1885=_0x6442('0x26');return db['UserProfileSection']['find']({'where':{'name':_0x3f1885,'userProfileId':_0x1c358b['userProfileId']},'raw':!![]})[_0x6442('0x23')](function(_0x9ebb1e){if(_0x9ebb1e&&_0x9ebb1e[_0x6442('0x4e')]===0x0){return db['UserProfileResource'][_0x6442('0x49')]({'name':_0x162b93[_0x6442('0x2a')],'resourceId':_0x162b93['id'],'type':_0x9ebb1e[_0x6442('0x2a')],'sectionId':_0x9ebb1e['id']},{})[_0x6442('0x23')](function(){return _0x16541c;});}else{return _0x16541c;}})[_0x6442('0x46')](function(_0x21771b){logger[_0x6442('0x28')](_0x6442('0x4f'),_0x21771b);throw _0x21771b;});}return _0x16541c;})[_0x6442('0x23')](respondWithResult(_0x2f63a9,0xc9))[_0x6442('0x46')](handleError(_0x2f63a9,null));};exports[_0x6442('0x22')]=function(_0x58e2c7,_0x529f70){if(_0x58e2c7[_0x6442('0x4a')]['id']){delete _0x58e2c7[_0x6442('0x4a')]['id'];}return db[_0x6442('0x2c')][_0x6442('0x50')]({'where':{'id':_0x58e2c7[_0x6442('0x48')]['id']}})['then'](handleEntityNotFound(_0x529f70,null))[_0x6442('0x23')](saveUpdates(_0x58e2c7[_0x6442('0x4a')],null))['then'](respondWithResult(_0x529f70,null))[_0x6442('0x46')](handleError(_0x529f70,null));};exports[_0x6442('0x24')]=function(_0x68ded4,_0x1cacfa){return db[_0x6442('0x2c')][_0x6442('0x50')]({'where':{'id':_0x68ded4['params']['id']}})['then'](handleEntityNotFound(_0x1cacfa,null))[_0x6442('0x23')](removeEntity(_0x1cacfa,null))[_0x6442('0x46')](handleError(_0x1cacfa,null));};exports[_0x6442('0x51')]=function(_0x28f41e,_0x5daf33,_0x1347dd){if(_0x28f41e['body']['id']){delete _0x28f41e[_0x6442('0x4a')]['id'];}return db['Trigger']['find']({'where':{'id':_0x28f41e[_0x6442('0x48')]['id']}})[_0x6442('0x23')](handleEntityNotFound(_0x5daf33,null))[_0x6442('0x23')](function(_0xabb12f){if(_0xabb12f){_0x28f41e[_0x6442('0x4a')]['TriggerAllId']=_0xabb12f['id'];return db[_0x6442('0x52')]['create'](_0x28f41e[_0x6442('0x4a')]);}})[_0x6442('0x23')](respondWithResult(_0x5daf33,null))['catch'](handleError(_0x5daf33,null));};exports['addAnyCondition']=function(_0x3b8c98,_0x3681a6,_0x18d72d){if(_0x3b8c98[_0x6442('0x4a')]['id']){delete _0x3b8c98['body']['id'];}return db['Trigger']['find']({'where':{'id':_0x3b8c98[_0x6442('0x48')]['id']}})[_0x6442('0x23')](handleEntityNotFound(_0x3681a6,null))['then'](function(_0x86b6ad){if(_0x86b6ad){_0x3b8c98[_0x6442('0x4a')]['TriggerAnyId']=_0x86b6ad['id'];return db[_0x6442('0x52')]['create'](_0x3b8c98[_0x6442('0x4a')]);}})[_0x6442('0x23')](respondWithResult(_0x3681a6,null))[_0x6442('0x46')](handleError(_0x3681a6,null));};exports[_0x6442('0x53')]=function(_0x4f9fd5,_0x3060b3,_0x278c6c){var _0x161590={};var _0x9d39e0={};var _0xca9db2;var _0x3e6486;return db[_0x6442('0x2c')][_0x6442('0x54')]({'where':{'id':_0x4f9fd5[_0x6442('0x48')]['id']}})[_0x6442('0x23')](handleEntityNotFound(_0x3060b3,null))[_0x6442('0x23')](function(_0x5d5618){if(_0x5d5618){_0xca9db2=_0x5d5618;_0x9d39e0[_0x6442('0x31')]=_[_0x6442('0x32')](db[_0x6442('0x52')][_0x6442('0x2d')]);_0x9d39e0[_0x6442('0x35')]=_[_0x6442('0x32')](_0x4f9fd5['query']);_0x9d39e0['filters']=_[_0x6442('0x34')](_0x9d39e0[_0x6442('0x31')],_0x9d39e0[_0x6442('0x35')]);_0x161590[_0x6442('0x36')]=_[_0x6442('0x34')](_0x9d39e0[_0x6442('0x31')],qs[_0x6442('0x37')](_0x4f9fd5[_0x6442('0x35')][_0x6442('0x37')]));_0x161590[_0x6442('0x36')]=_0x161590[_0x6442('0x36')]['length']?_0x161590[_0x6442('0x36')]:_0x9d39e0['model'];_0x161590['order']=qs[_0x6442('0x3d')](_0x4f9fd5[_0x6442('0x35')][_0x6442('0x3d')]);_0x161590['where']=qs[_0x6442('0x33')](_[_0x6442('0x55')](_0x4f9fd5[_0x6442('0x35')],_0x9d39e0[_0x6442('0x33')]));if(_0x4f9fd5[_0x6442('0x35')][_0x6442('0x3f')]){_0x161590[_0x6442('0x3e')]=_[_0x6442('0x40')](_0x161590['where'],{'$or':_[_0x6442('0x2b')](_0x161590['attributes'],function(_0x535306){var _0x2556e1={};_0x2556e1[_0x535306]={'$like':'%'+_0x4f9fd5[_0x6442('0x35')][_0x6442('0x3f')]+'%'};return _0x2556e1;})});}_0x161590=_[_0x6442('0x40')]({},_0x161590,_0x4f9fd5[_0x6442('0x41')]);return _0xca9db2['getAllConditions'](_0x161590);}})['then'](function(_0x513cf0){if(_0x513cf0){_0x3e6486=_0x513cf0['length'];if(!_0x4f9fd5[_0x6442('0x35')][_0x6442('0x39')]('nolimit')){_0x161590[_0x6442('0x3b')]=qs[_0x6442('0x3b')](_0x4f9fd5['query'][_0x6442('0x3b')]);_0x161590[_0x6442('0x1a')]=qs[_0x6442('0x1a')](_0x4f9fd5['query']['offset']);}return _0xca9db2[_0x6442('0x53')](_0x161590);}})[_0x6442('0x23')](function(_0x423600){if(_0x423600){return _0x423600?{'count':_0x3e6486,'rows':_0x423600}:null;}})[_0x6442('0x23')](respondWithResult(_0x3060b3,null))[_0x6442('0x46')](handleError(_0x3060b3,null));};exports[_0x6442('0x56')]=function(_0x5738c8,_0x726485,_0x37832a){var _0x234ccd={};var _0x56a0d0={};var _0x2b2c47;var _0x555f1b;return db[_0x6442('0x2c')]['findOne']({'where':{'id':_0x5738c8['params']['id']}})[_0x6442('0x23')](handleEntityNotFound(_0x726485,null))[_0x6442('0x23')](function(_0x5756ac){if(_0x5756ac){_0x2b2c47=_0x5756ac;_0x56a0d0[_0x6442('0x31')]=_[_0x6442('0x32')](db[_0x6442('0x52')]['rawAttributes']);_0x56a0d0[_0x6442('0x35')]=_[_0x6442('0x32')](_0x5738c8[_0x6442('0x35')]);_0x56a0d0['filters']=_[_0x6442('0x34')](_0x56a0d0[_0x6442('0x31')],_0x56a0d0['query']);_0x234ccd[_0x6442('0x36')]=_['intersection'](_0x56a0d0[_0x6442('0x31')],qs['fields'](_0x5738c8[_0x6442('0x35')][_0x6442('0x37')]));_0x234ccd[_0x6442('0x36')]=_0x234ccd[_0x6442('0x36')]['length']?_0x234ccd[_0x6442('0x36')]:_0x56a0d0[_0x6442('0x31')];_0x234ccd['order']=qs['sort'](_0x5738c8[_0x6442('0x35')][_0x6442('0x3d')]);_0x234ccd['where']=qs[_0x6442('0x33')](_[_0x6442('0x55')](_0x5738c8[_0x6442('0x35')],_0x56a0d0['filters']));if(_0x5738c8[_0x6442('0x35')][_0x6442('0x3f')]){_0x234ccd[_0x6442('0x3e')]=_[_0x6442('0x40')](_0x234ccd[_0x6442('0x3e')],{'$or':_[_0x6442('0x2b')](_0x234ccd['attributes'],function(_0x55b450){var _0x5c91dd={};_0x5c91dd[_0x55b450]={'$like':'%'+_0x5738c8[_0x6442('0x35')][_0x6442('0x3f')]+'%'};return _0x5c91dd;})});}_0x234ccd=_['merge']({},_0x234ccd,_0x5738c8[_0x6442('0x41')]);return _0x2b2c47['getAnyConditions'](_0x234ccd);}})['then'](function(_0x297ac7){if(_0x297ac7){_0x555f1b=_0x297ac7[_0x6442('0x38')];if(!_0x5738c8[_0x6442('0x35')]['hasOwnProperty'](_0x6442('0x3a'))){_0x234ccd[_0x6442('0x3b')]=qs[_0x6442('0x3b')](_0x5738c8[_0x6442('0x35')][_0x6442('0x3b')]);_0x234ccd['offset']=qs[_0x6442('0x1a')](_0x5738c8[_0x6442('0x35')][_0x6442('0x1a')]);}return _0x2b2c47[_0x6442('0x56')](_0x234ccd);}})[_0x6442('0x23')](function(_0xe73f47){if(_0xe73f47){return _0xe73f47?{'count':_0x555f1b,'rows':_0xe73f47}:null;}})['then'](respondWithResult(_0x726485,null))[_0x6442('0x46')](handleError(_0x726485,null));};exports[_0x6442('0x57')]=function(_0x317259,_0x7076ca,_0x1c8262){if(_0x317259['body']['id']){delete _0x317259[_0x6442('0x4a')]['id'];}return db[_0x6442('0x2c')][_0x6442('0x50')]({'where':{'id':_0x317259[_0x6442('0x48')]['id']}})['then'](handleEntityNotFound(_0x7076ca,null))[_0x6442('0x23')](function(_0x593976){if(_0x593976){_0x317259['body']['TriggerId']=_0x593976['id'];return db[_0x6442('0x58')][_0x6442('0x49')](_0x317259[_0x6442('0x4a')]);}})[_0x6442('0x23')](respondWithResult(_0x7076ca,null))['catch'](handleError(_0x7076ca,null));};exports[_0x6442('0x59')]=function(_0x379f76,_0x439529,_0x3eafd8){var _0x30d4d6={};var _0x5ce91f={};var _0x53c9f7;var _0x5d6b84;return db[_0x6442('0x2c')]['findOne']({'where':{'id':_0x379f76[_0x6442('0x48')]['id']}})['then'](handleEntityNotFound(_0x439529,null))[_0x6442('0x23')](function(_0x19909d){if(_0x19909d){_0x53c9f7=_0x19909d;_0x5ce91f[_0x6442('0x31')]=_[_0x6442('0x32')](db[_0x6442('0x58')]['rawAttributes']);_0x5ce91f[_0x6442('0x35')]=_[_0x6442('0x32')](_0x379f76[_0x6442('0x35')]);_0x5ce91f[_0x6442('0x33')]=_[_0x6442('0x34')](_0x5ce91f[_0x6442('0x31')],_0x5ce91f[_0x6442('0x35')]);_0x30d4d6[_0x6442('0x36')]=_[_0x6442('0x34')](_0x5ce91f[_0x6442('0x31')],qs[_0x6442('0x37')](_0x379f76[_0x6442('0x35')][_0x6442('0x37')]));_0x30d4d6[_0x6442('0x36')]=_0x30d4d6[_0x6442('0x36')][_0x6442('0x38')]?_0x30d4d6['attributes']:_0x5ce91f[_0x6442('0x31')];_0x30d4d6[_0x6442('0x3c')]=qs[_0x6442('0x3d')](_0x379f76[_0x6442('0x35')][_0x6442('0x3d')]);_0x30d4d6['where']=qs[_0x6442('0x33')](_['pick'](_0x379f76[_0x6442('0x35')],_0x5ce91f[_0x6442('0x33')]));if(_0x379f76[_0x6442('0x35')]['filter']){_0x30d4d6['where']=_['merge'](_0x30d4d6[_0x6442('0x3e')],{'$or':_['map'](_0x30d4d6[_0x6442('0x36')],function(_0x3ca50a){var _0x57d864={};_0x57d864[_0x3ca50a]={'$like':'%'+_0x379f76[_0x6442('0x35')][_0x6442('0x3f')]+'%'};return _0x57d864;})});}_0x30d4d6=_[_0x6442('0x40')]({},_0x30d4d6,_0x379f76['options']);return _0x53c9f7[_0x6442('0x59')](_0x30d4d6);}})[_0x6442('0x23')](function(_0x51e9e5){if(_0x51e9e5){_0x5d6b84=_0x51e9e5[_0x6442('0x38')];if(!_0x379f76[_0x6442('0x35')]['hasOwnProperty'](_0x6442('0x3a'))){_0x30d4d6[_0x6442('0x3b')]=qs[_0x6442('0x3b')](_0x379f76[_0x6442('0x35')][_0x6442('0x3b')]);_0x30d4d6[_0x6442('0x1a')]=qs['offset'](_0x379f76[_0x6442('0x35')][_0x6442('0x1a')]);}return _0x53c9f7['getActions'](_0x30d4d6);}})['then'](function(_0x287cda){if(_0x287cda){return _0x287cda?{'count':_0x5d6b84,'rows':_0x287cda}:null;}})[_0x6442('0x23')](respondWithResult(_0x439529,null))[_0x6442('0x46')](handleError(_0x439529,null));}; \ No newline at end of file +var _0x978e=['undefined','limit','count','reject','save','update','destroy','get','then','end','sendStatus','stack','name','send','map','Trigger','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','rows','catch','show','params','length','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Triggers','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','getAnyConditions','addAction','Action','getActions','rimraf','fast-json-patch','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','json','offset'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x978e,0x9d));var _0xe978=function(_0x3cea2c,_0x5eb764){_0x3cea2c=_0x3cea2c-0x0;var _0x5c1067=_0x978e[_0x3cea2c];return _0x5c1067;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe978('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe978('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe978('0x2'));var util=require('util');var path=require(_0xe978('0x3'));var sox=require(_0xe978('0x4'));var csv=require(_0xe978('0x5'));var ejs=require(_0xe978('0x6'));var fs=require('fs');var fs_extra=require(_0xe978('0x7'));var _=require(_0xe978('0x8'));var squel=require(_0xe978('0x9'));var crypto=require(_0xe978('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe978('0x5'));var querystring=require(_0xe978('0xb'));var Papa=require('papaparse');var Redis=require(_0xe978('0xc'));var authService=require(_0xe978('0xd'));var qs=require(_0xe978('0xe'));var as=require(_0xe978('0xf'));var hardwareService=require(_0xe978('0x10'));var logger=require(_0xe978('0x11'))(_0xe978('0x12'));var utils=require(_0xe978('0x13'));var config=require(_0xe978('0x14'));var licenseUtil=require(_0xe978('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x17d58b,_0x53ea6b){_0x53ea6b=_0x53ea6b||0xcc;return function(_0xec2cf7){if(_0xec2cf7){return _0x17d58b['sendStatus'](_0x53ea6b);}return _0x17d58b[_0xe978('0x16')](_0x53ea6b)['end']();};}function respondWithResult(_0x23ab4b,_0x39734d){_0x39734d=_0x39734d||0xc8;return function(_0xd336a){if(_0xd336a){return _0x23ab4b[_0xe978('0x16')](_0x39734d)[_0xe978('0x17')](_0xd336a);}};}function respondWithFilteredResult(_0x38fe7c,_0x1deaf6){return function(_0x4d577e){if(_0x4d577e){var _0x46af7c=typeof _0x1deaf6[_0xe978('0x18')]===_0xe978('0x19')&&typeof _0x1deaf6[_0xe978('0x1a')]===_0xe978('0x19');var _0x1d937b=_0x4d577e[_0xe978('0x1b')];var _0x193813=_0x46af7c?0x0:_0x1deaf6[_0xe978('0x18')];var _0x3ac47a=_0x46af7c?_0x4d577e['count']:_0x1deaf6[_0xe978('0x18')]+_0x1deaf6['limit'];var _0x29a9f5;if(_0x3ac47a>=_0x1d937b){_0x3ac47a=_0x1d937b;_0x29a9f5=0xc8;}else{_0x29a9f5=0xce;}_0x38fe7c[_0xe978('0x16')](_0x29a9f5);return _0x38fe7c['set']('Content-Range',_0x193813+'-'+_0x3ac47a+'/'+_0x1d937b)['json'](_0x4d577e);}return null;};}function patchUpdates(_0x311262){return function(_0x5c8c07){try{jsonpatch['apply'](_0x5c8c07,_0x311262,!![]);}catch(_0x7f22ea){return BPromise[_0xe978('0x1c')](_0x7f22ea);}return _0x5c8c07[_0xe978('0x1d')]();};}function saveUpdates(_0x25bd15,_0x335244){return function(_0x5562ed){if(_0x5562ed){return _0x5562ed[_0xe978('0x1e')](_0x25bd15)['then'](function(_0x29d78a){return _0x29d78a;});}return null;};}function removeEntity(_0x551e9e,_0x32f36c){return function(_0x1b5b1f){if(_0x1b5b1f){return _0x1b5b1f[_0xe978('0x1f')]()['then'](function(){var _0x58de07=_0x1b5b1f[_0xe978('0x20')]({'plain':!![]});var _0x5441d7='Triggers';return db['UserProfileResource']['destroy']({'where':{'type':_0x5441d7,'resourceId':_0x58de07['id']}})[_0xe978('0x21')](function(){return _0x1b5b1f;});})[_0xe978('0x21')](function(){_0x551e9e[_0xe978('0x16')](0xcc)[_0xe978('0x22')]();});}};}function handleEntityNotFound(_0x5edd13,_0x1578d9){return function(_0x45fd5d){if(!_0x45fd5d){_0x5edd13[_0xe978('0x23')](0x194);}return _0x45fd5d;};}function handleError(_0x282f1d,_0x37ccae){_0x37ccae=_0x37ccae||0x1f4;return function(_0x58ac5e){logger['error'](_0x58ac5e[_0xe978('0x24')]);if(_0x58ac5e['name']){delete _0x58ac5e[_0xe978('0x25')];}_0x282f1d[_0xe978('0x16')](_0x37ccae)[_0xe978('0x26')](_0x58ac5e);};}exports['index']=function(_0x16bdec,_0x283afb){var _0xc71d1f={},_0x5ac454={},_0xe1c643={'count':0x0,'rows':[]};var _0x4a79c=_[_0xe978('0x27')](db[_0xe978('0x28')][_0xe978('0x29')],function(_0x9fb3d2){return{'name':_0x9fb3d2[_0xe978('0x2a')],'type':_0x9fb3d2['type'][_0xe978('0x2b')]};});_0x5ac454[_0xe978('0x2c')]=_[_0xe978('0x27')](_0x4a79c,_0xe978('0x25'));_0x5ac454[_0xe978('0x2d')]=_[_0xe978('0x2e')](_0x16bdec['query']);_0x5ac454[_0xe978('0x2f')]=_[_0xe978('0x30')](_0x5ac454['model'],_0x5ac454[_0xe978('0x2d')]);_0xc71d1f['attributes']=_['intersection'](_0x5ac454[_0xe978('0x2c')],qs[_0xe978('0x31')](_0x16bdec[_0xe978('0x2d')][_0xe978('0x31')]));_0xc71d1f['attributes']=_0xc71d1f[_0xe978('0x32')]['length']?_0xc71d1f[_0xe978('0x32')]:_0x5ac454[_0xe978('0x2c')];if(!_0x16bdec['query'][_0xe978('0x33')](_0xe978('0x34'))){_0xc71d1f[_0xe978('0x1a')]=qs[_0xe978('0x1a')](_0x16bdec['query'][_0xe978('0x1a')]);_0xc71d1f[_0xe978('0x18')]=qs[_0xe978('0x18')](_0x16bdec[_0xe978('0x2d')]['offset']);}_0xc71d1f[_0xe978('0x35')]=qs['sort'](_0x16bdec[_0xe978('0x2d')][_0xe978('0x36')]);_0xc71d1f[_0xe978('0x37')]=qs[_0xe978('0x2f')](_[_0xe978('0x38')](_0x16bdec[_0xe978('0x2d')],_0x5ac454[_0xe978('0x2f')]),_0x4a79c);if(_0x16bdec[_0xe978('0x2d')][_0xe978('0x39')]){_0xc71d1f[_0xe978('0x37')]=_[_0xe978('0x3a')](_0xc71d1f[_0xe978('0x37')],{'$or':_[_0xe978('0x27')](_0x4a79c,function(_0x4d0846){if(_0x4d0846[_0xe978('0x3b')]!==_0xe978('0x3c')){var _0xd4f14a={};_0xd4f14a[_0x4d0846['name']]={'$like':'%'+_0x16bdec[_0xe978('0x2d')]['filter']+'%'};return _0xd4f14a;}})});}_0xc71d1f=_[_0xe978('0x3a')]({},_0xc71d1f,_0x16bdec[_0xe978('0x3d')]);var _0xc7ace4={'where':_0xc71d1f[_0xe978('0x37')]};return db['Trigger']['count'](_0xc7ace4)[_0xe978('0x21')](function(_0x3c80ba){_0xe1c643['count']=_0x3c80ba;if(_0x16bdec[_0xe978('0x2d')][_0xe978('0x3e')]){_0xc71d1f['include']=[{'all':!![]}];}return db['Trigger']['findAll'](_0xc71d1f);})[_0xe978('0x21')](function(_0x2275e4){_0xe1c643[_0xe978('0x3f')]=_0x2275e4;return _0xe1c643;})[_0xe978('0x21')](respondWithFilteredResult(_0x283afb,_0xc71d1f))[_0xe978('0x40')](handleError(_0x283afb,null));};exports[_0xe978('0x41')]=function(_0x25757b,_0x3dd606){var _0x802e44={'raw':![],'where':{'id':_0x25757b[_0xe978('0x42')]['id']}},_0x8f8f48={};_0x8f8f48['model']=_['keys'](db[_0xe978('0x28')][_0xe978('0x29')]);_0x8f8f48[_0xe978('0x2d')]=_['keys'](_0x25757b['query']);_0x8f8f48[_0xe978('0x2f')]=_[_0xe978('0x30')](_0x8f8f48[_0xe978('0x2c')],_0x8f8f48['query']);_0x802e44[_0xe978('0x32')]=_['intersection'](_0x8f8f48[_0xe978('0x2c')],qs['fields'](_0x25757b[_0xe978('0x2d')][_0xe978('0x31')]));_0x802e44[_0xe978('0x32')]=_0x802e44[_0xe978('0x32')][_0xe978('0x43')]?_0x802e44[_0xe978('0x32')]:_0x8f8f48[_0xe978('0x2c')];if(_0x25757b[_0xe978('0x2d')]['includeAll']){_0x802e44[_0xe978('0x44')]=[{'all':!![]}];}_0x802e44=_[_0xe978('0x3a')]({},_0x802e44,_0x25757b[_0xe978('0x3d')]);return db[_0xe978('0x28')][_0xe978('0x45')](_0x802e44)[_0xe978('0x21')](handleEntityNotFound(_0x3dd606,null))[_0xe978('0x21')](respondWithResult(_0x3dd606,null))['catch'](handleError(_0x3dd606,null));};exports[_0xe978('0x46')]=function(_0x3c492c,_0x25459d){return db[_0xe978('0x28')][_0xe978('0x46')](_0x3c492c[_0xe978('0x47')],{})[_0xe978('0x21')](function(_0x543100){var _0x468cdb=_0x3c492c[_0xe978('0x48')][_0xe978('0x20')]({'plain':!![]});if(!_0x468cdb)throw new Error(_0xe978('0x49'));if(_0x468cdb[_0xe978('0x4a')]===_0xe978('0x48')){var _0x20f61f=_0x543100[_0xe978('0x20')]({'plain':!![]});var _0x234096=_0xe978('0x4b');return db[_0xe978('0x4c')][_0xe978('0x45')]({'where':{'name':_0x234096,'userProfileId':_0x468cdb['userProfileId']},'raw':!![]})[_0xe978('0x21')](function(_0x567d57){if(_0x567d57&&_0x567d57[_0xe978('0x4d')]===0x0){return db['UserProfileResource'][_0xe978('0x46')]({'name':_0x20f61f[_0xe978('0x25')],'resourceId':_0x20f61f['id'],'type':_0x567d57[_0xe978('0x25')],'sectionId':_0x567d57['id']},{})[_0xe978('0x21')](function(){return _0x543100;});}else{return _0x543100;}})[_0xe978('0x40')](function(_0x1f222d){logger[_0xe978('0x4e')](_0xe978('0x4f'),_0x1f222d);throw _0x1f222d;});}return _0x543100;})[_0xe978('0x21')](respondWithResult(_0x25459d,0xc9))[_0xe978('0x40')](handleError(_0x25459d,null));};exports[_0xe978('0x1e')]=function(_0x2c286a,_0x459667){if(_0x2c286a[_0xe978('0x47')]['id']){delete _0x2c286a[_0xe978('0x47')]['id'];}return db[_0xe978('0x28')][_0xe978('0x45')]({'where':{'id':_0x2c286a['params']['id']}})['then'](handleEntityNotFound(_0x459667,null))[_0xe978('0x21')](saveUpdates(_0x2c286a[_0xe978('0x47')],null))[_0xe978('0x21')](respondWithResult(_0x459667,null))[_0xe978('0x40')](handleError(_0x459667,null));};exports['destroy']=function(_0x407912,_0x21bcbe){return db[_0xe978('0x28')][_0xe978('0x45')]({'where':{'id':_0x407912[_0xe978('0x42')]['id']}})[_0xe978('0x21')](handleEntityNotFound(_0x21bcbe,null))['then'](removeEntity(_0x21bcbe,null))['catch'](handleError(_0x21bcbe,null));};exports[_0xe978('0x50')]=function(_0x43264c,_0x2c0c04,_0x420cd7){if(_0x43264c[_0xe978('0x47')]['id']){delete _0x43264c[_0xe978('0x47')]['id'];}return db[_0xe978('0x28')]['find']({'where':{'id':_0x43264c[_0xe978('0x42')]['id']}})[_0xe978('0x21')](handleEntityNotFound(_0x2c0c04,null))[_0xe978('0x21')](function(_0x5ad4e4){if(_0x5ad4e4){_0x43264c[_0xe978('0x47')][_0xe978('0x51')]=_0x5ad4e4['id'];return db[_0xe978('0x52')][_0xe978('0x46')](_0x43264c[_0xe978('0x47')]);}})[_0xe978('0x21')](respondWithResult(_0x2c0c04,null))[_0xe978('0x40')](handleError(_0x2c0c04,null));};exports[_0xe978('0x53')]=function(_0x3768a2,_0x547b29,_0x100ea2){if(_0x3768a2['body']['id']){delete _0x3768a2['body']['id'];}return db[_0xe978('0x28')][_0xe978('0x45')]({'where':{'id':_0x3768a2[_0xe978('0x42')]['id']}})[_0xe978('0x21')](handleEntityNotFound(_0x547b29,null))[_0xe978('0x21')](function(_0x13b152){if(_0x13b152){_0x3768a2[_0xe978('0x47')][_0xe978('0x54')]=_0x13b152['id'];return db[_0xe978('0x52')][_0xe978('0x46')](_0x3768a2[_0xe978('0x47')]);}})[_0xe978('0x21')](respondWithResult(_0x547b29,null))[_0xe978('0x40')](handleError(_0x547b29,null));};exports[_0xe978('0x55')]=function(_0x5c01af,_0x2b16b3,_0x21a70e){var _0x13d4dc={};var _0x49be28={};var _0x217902;var _0x780b12;return db['Trigger'][_0xe978('0x56')]({'where':{'id':_0x5c01af[_0xe978('0x42')]['id']}})[_0xe978('0x21')](handleEntityNotFound(_0x2b16b3,null))[_0xe978('0x21')](function(_0x1bf70c){if(_0x1bf70c){_0x217902=_0x1bf70c;_0x49be28['model']=_[_0xe978('0x2e')](db[_0xe978('0x52')][_0xe978('0x29')]);_0x49be28[_0xe978('0x2d')]=_[_0xe978('0x2e')](_0x5c01af[_0xe978('0x2d')]);_0x49be28[_0xe978('0x2f')]=_['intersection'](_0x49be28[_0xe978('0x2c')],_0x49be28[_0xe978('0x2d')]);_0x13d4dc[_0xe978('0x32')]=_[_0xe978('0x30')](_0x49be28[_0xe978('0x2c')],qs[_0xe978('0x31')](_0x5c01af['query'][_0xe978('0x31')]));_0x13d4dc[_0xe978('0x32')]=_0x13d4dc[_0xe978('0x32')]['length']?_0x13d4dc['attributes']:_0x49be28[_0xe978('0x2c')];_0x13d4dc[_0xe978('0x35')]=qs[_0xe978('0x36')](_0x5c01af['query'][_0xe978('0x36')]);_0x13d4dc[_0xe978('0x37')]=qs[_0xe978('0x2f')](_[_0xe978('0x38')](_0x5c01af[_0xe978('0x2d')],_0x49be28[_0xe978('0x2f')]));if(_0x5c01af[_0xe978('0x2d')]['filter']){_0x13d4dc[_0xe978('0x37')]=_[_0xe978('0x3a')](_0x13d4dc[_0xe978('0x37')],{'$or':_['map'](_0x13d4dc[_0xe978('0x32')],function(_0x3cabbb){var _0x3d403a={};_0x3d403a[_0x3cabbb]={'$like':'%'+_0x5c01af[_0xe978('0x2d')][_0xe978('0x39')]+'%'};return _0x3d403a;})});}_0x13d4dc=_['merge']({},_0x13d4dc,_0x5c01af['options']);return _0x217902[_0xe978('0x55')](_0x13d4dc);}})[_0xe978('0x21')](function(_0x329fb3){if(_0x329fb3){_0x780b12=_0x329fb3['length'];if(!_0x5c01af[_0xe978('0x2d')]['hasOwnProperty']('nolimit')){_0x13d4dc[_0xe978('0x1a')]=qs[_0xe978('0x1a')](_0x5c01af[_0xe978('0x2d')][_0xe978('0x1a')]);_0x13d4dc[_0xe978('0x18')]=qs[_0xe978('0x18')](_0x5c01af[_0xe978('0x2d')][_0xe978('0x18')]);}return _0x217902[_0xe978('0x55')](_0x13d4dc);}})['then'](function(_0x287079){if(_0x287079){return _0x287079?{'count':_0x780b12,'rows':_0x287079}:null;}})[_0xe978('0x21')](respondWithResult(_0x2b16b3,null))['catch'](handleError(_0x2b16b3,null));};exports['getAnyConditions']=function(_0x966ffd,_0x56bc31,_0x54791d){var _0x53a051={};var _0x52341a={};var _0x3400aa;var _0x582cb4;return db[_0xe978('0x28')][_0xe978('0x56')]({'where':{'id':_0x966ffd[_0xe978('0x42')]['id']}})[_0xe978('0x21')](handleEntityNotFound(_0x56bc31,null))[_0xe978('0x21')](function(_0x1a5cd4){if(_0x1a5cd4){_0x3400aa=_0x1a5cd4;_0x52341a[_0xe978('0x2c')]=_[_0xe978('0x2e')](db[_0xe978('0x52')][_0xe978('0x29')]);_0x52341a[_0xe978('0x2d')]=_[_0xe978('0x2e')](_0x966ffd[_0xe978('0x2d')]);_0x52341a[_0xe978('0x2f')]=_[_0xe978('0x30')](_0x52341a['model'],_0x52341a[_0xe978('0x2d')]);_0x53a051['attributes']=_[_0xe978('0x30')](_0x52341a['model'],qs[_0xe978('0x31')](_0x966ffd[_0xe978('0x2d')][_0xe978('0x31')]));_0x53a051[_0xe978('0x32')]=_0x53a051[_0xe978('0x32')][_0xe978('0x43')]?_0x53a051[_0xe978('0x32')]:_0x52341a[_0xe978('0x2c')];_0x53a051['order']=qs[_0xe978('0x36')](_0x966ffd[_0xe978('0x2d')][_0xe978('0x36')]);_0x53a051['where']=qs['filters'](_[_0xe978('0x38')](_0x966ffd[_0xe978('0x2d')],_0x52341a[_0xe978('0x2f')]));if(_0x966ffd['query']['filter']){_0x53a051[_0xe978('0x37')]=_['merge'](_0x53a051[_0xe978('0x37')],{'$or':_[_0xe978('0x27')](_0x53a051[_0xe978('0x32')],function(_0x3dd955){var _0x2b3ad0={};_0x2b3ad0[_0x3dd955]={'$like':'%'+_0x966ffd[_0xe978('0x2d')][_0xe978('0x39')]+'%'};return _0x2b3ad0;})});}_0x53a051=_['merge']({},_0x53a051,_0x966ffd[_0xe978('0x3d')]);return _0x3400aa['getAnyConditions'](_0x53a051);}})['then'](function(_0x51ca55){if(_0x51ca55){_0x582cb4=_0x51ca55[_0xe978('0x43')];if(!_0x966ffd[_0xe978('0x2d')][_0xe978('0x33')](_0xe978('0x34'))){_0x53a051[_0xe978('0x1a')]=qs['limit'](_0x966ffd['query']['limit']);_0x53a051[_0xe978('0x18')]=qs[_0xe978('0x18')](_0x966ffd[_0xe978('0x2d')][_0xe978('0x18')]);}return _0x3400aa[_0xe978('0x57')](_0x53a051);}})['then'](function(_0x1ee4d5){if(_0x1ee4d5){return _0x1ee4d5?{'count':_0x582cb4,'rows':_0x1ee4d5}:null;}})[_0xe978('0x21')](respondWithResult(_0x56bc31,null))[_0xe978('0x40')](handleError(_0x56bc31,null));};exports[_0xe978('0x58')]=function(_0x173ae1,_0x4a40fe,_0x1dfdbb){if(_0x173ae1['body']['id']){delete _0x173ae1['body']['id'];}return db['Trigger'][_0xe978('0x45')]({'where':{'id':_0x173ae1[_0xe978('0x42')]['id']}})[_0xe978('0x21')](handleEntityNotFound(_0x4a40fe,null))[_0xe978('0x21')](function(_0x570dd3){if(_0x570dd3){_0x173ae1[_0xe978('0x47')]['TriggerId']=_0x570dd3['id'];return db[_0xe978('0x59')]['create'](_0x173ae1['body']);}})[_0xe978('0x21')](respondWithResult(_0x4a40fe,null))['catch'](handleError(_0x4a40fe,null));};exports['getActions']=function(_0x399d25,_0x31a515,_0x2ef8ea){var _0x3833b5={};var _0x5ac91e={};var _0x2d7319;var _0x1b0174;return db[_0xe978('0x28')][_0xe978('0x56')]({'where':{'id':_0x399d25[_0xe978('0x42')]['id']}})[_0xe978('0x21')](handleEntityNotFound(_0x31a515,null))['then'](function(_0x1a95df){if(_0x1a95df){_0x2d7319=_0x1a95df;_0x5ac91e[_0xe978('0x2c')]=_[_0xe978('0x2e')](db[_0xe978('0x59')][_0xe978('0x29')]);_0x5ac91e[_0xe978('0x2d')]=_[_0xe978('0x2e')](_0x399d25[_0xe978('0x2d')]);_0x5ac91e[_0xe978('0x2f')]=_[_0xe978('0x30')](_0x5ac91e[_0xe978('0x2c')],_0x5ac91e[_0xe978('0x2d')]);_0x3833b5[_0xe978('0x32')]=_[_0xe978('0x30')](_0x5ac91e[_0xe978('0x2c')],qs[_0xe978('0x31')](_0x399d25[_0xe978('0x2d')][_0xe978('0x31')]));_0x3833b5['attributes']=_0x3833b5[_0xe978('0x32')][_0xe978('0x43')]?_0x3833b5[_0xe978('0x32')]:_0x5ac91e[_0xe978('0x2c')];_0x3833b5[_0xe978('0x35')]=qs[_0xe978('0x36')](_0x399d25[_0xe978('0x2d')][_0xe978('0x36')]);_0x3833b5[_0xe978('0x37')]=qs['filters'](_[_0xe978('0x38')](_0x399d25[_0xe978('0x2d')],_0x5ac91e['filters']));if(_0x399d25[_0xe978('0x2d')][_0xe978('0x39')]){_0x3833b5[_0xe978('0x37')]=_['merge'](_0x3833b5[_0xe978('0x37')],{'$or':_[_0xe978('0x27')](_0x3833b5['attributes'],function(_0x1249ac){var _0x178c32={};_0x178c32[_0x1249ac]={'$like':'%'+_0x399d25[_0xe978('0x2d')][_0xe978('0x39')]+'%'};return _0x178c32;})});}_0x3833b5=_[_0xe978('0x3a')]({},_0x3833b5,_0x399d25[_0xe978('0x3d')]);return _0x2d7319[_0xe978('0x5a')](_0x3833b5);}})['then'](function(_0x36fdeb){if(_0x36fdeb){_0x1b0174=_0x36fdeb[_0xe978('0x43')];if(!_0x399d25[_0xe978('0x2d')][_0xe978('0x33')](_0xe978('0x34'))){_0x3833b5[_0xe978('0x1a')]=qs[_0xe978('0x1a')](_0x399d25['query'][_0xe978('0x1a')]);_0x3833b5[_0xe978('0x18')]=qs[_0xe978('0x18')](_0x399d25['query'][_0xe978('0x18')]);}return _0x2d7319['getActions'](_0x3833b5);}})['then'](function(_0x11d8ec){if(_0x11d8ec){return _0x11d8ec?{'count':_0x1b0174,'rows':_0x11d8ec}:null;}})['then'](respondWithResult(_0x31a515,null))[_0xe978('0x40')](handleError(_0x31a515,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 0afb9be..6accabd 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 _0x6fc4=['define','Trigger','lodash','util','moment','rimraf','../../config/environment','./trigger.attributes','exports'];(function(_0x581979,_0x17c67d){var _0x558d78=function(_0x106a4a){while(--_0x106a4a){_0x581979['push'](_0x581979['shift']());}};_0x558d78(++_0x17c67d);}(_0x6fc4,0x1a0));var _0x46fc=function(_0x5b1d80,_0x4230ba){_0x5b1d80=_0x5b1d80-0x0;var _0x4f344c=_0x6fc4[_0x5b1d80];return _0x4f344c;};'use strict';var _=require(_0x46fc('0x0'));var util=require(_0x46fc('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x46fc('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x46fc('0x3'));var config=require(_0x46fc('0x4'));var attributes=require(_0x46fc('0x5'));module[_0x46fc('0x6')]=function(_0x3f4e43,_0x7656d9){return _0x3f4e43[_0x46fc('0x7')](_0x46fc('0x8'),attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x18a5=['./trigger.attributes','define','Trigger','tools_triggers','lodash','util','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x16da39,_0x172a81){var _0x302587=function(_0x7808dc){while(--_0x7808dc){_0x16da39['push'](_0x16da39['shift']());}};_0x302587(++_0x172a81);}(_0x18a5,0x164));var _0x518a=function(_0x44d302,_0x5b2562){_0x44d302=_0x44d302-0x0;var _0x48475a=_0x18a5[_0x44d302];return _0x48475a;};'use strict';var _=require(_0x518a('0x0'));var util=require(_0x518a('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x518a('0x2'));var BPromise=require('bluebird');var rp=require(_0x518a('0x3'));var fs=require('fs');var path=require(_0x518a('0x4'));var rimraf=require(_0x518a('0x5'));var config=require(_0x518a('0x6'));var attributes=require(_0x518a('0x7'));module['exports']=function(_0x5dcff1,_0x4b150f){return _0x5dcff1[_0x518a('0x8')](_0x518a('0x9'),attributes,{'tableName':_0x518a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index f752958..9caf238 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 _0xeae8=['lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','error','message','result','Trigger','findAll','options','raw','attributes','limit','include','model','map','then','GetTrigger','stringify','catch','ShowTrigger','find','where'];(function(_0x10dc5d,_0x4b62cc){var _0x2c1e6f=function(_0x5f7307){while(--_0x5f7307){_0x10dc5d['push'](_0x10dc5d['shift']());}};_0x2c1e6f(++_0x4b62cc);}(_0xeae8,0x66));var _0x8eae=function(_0x55a921,_0x23cade){_0x55a921=_0x55a921-0x0;var _0x2cdf04=_0xeae8[_0x55a921];return _0x2cdf04;};'use strict';var _=require(_0x8eae('0x0'));var util=require(_0x8eae('0x1'));var moment=require(_0x8eae('0x2'));var BPromise=require('bluebird');var rs=require(_0x8eae('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8eae('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8eae('0x5'))(_0x8eae('0x6'));var config=require(_0x8eae('0x7'));var jayson=require(_0x8eae('0x8'));var client=jayson[_0x8eae('0x9')][_0x8eae('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x32c67f,_0xd2b0,_0x2dcd90){return new BPromise(function(_0x2ae6e7,_0x476ba1){return client['request'](_0x32c67f,_0x2dcd90)['then'](function(_0x1cd68f){logger[_0x8eae('0xb')](_0x8eae('0xc'),_0xd2b0,_0x8eae('0xd'));logger[_0x8eae('0xe')]('Trigger,\x20%s,\x20%s,\x20%s',_0xd2b0,'request\x20sent',JSON['stringify'](_0x1cd68f));if(_0x1cd68f[_0x8eae('0xf')]){if(_0x1cd68f[_0x8eae('0xf')]['code']===0x1f4){logger[_0x8eae('0xf')]('Trigger,\x20%s,\x20%s',_0xd2b0,_0x1cd68f[_0x8eae('0xf')][_0x8eae('0x10')]);return _0x476ba1(_0x1cd68f[_0x8eae('0xf')][_0x8eae('0x10')]);}logger[_0x8eae('0xf')]('Trigger,\x20%s,\x20%s',_0xd2b0,_0x1cd68f[_0x8eae('0xf')][_0x8eae('0x10')]);return _0x2ae6e7(_0x1cd68f[_0x8eae('0xf')][_0x8eae('0x10')]);}else{logger[_0x8eae('0xb')](_0x8eae('0xc'),_0xd2b0,_0x8eae('0xd'));_0x2ae6e7(_0x1cd68f[_0x8eae('0x11')][_0x8eae('0x10')]);}})['catch'](function(_0x5e214e){logger['error'](_0x8eae('0xc'),_0xd2b0,_0x5e214e);_0x476ba1(_0x5e214e);});});}exports['GetTrigger']=function(_0x3db47b){var _0x3fe930=this;return new Promise(function(_0x386a97,_0x13331a){return db[_0x8eae('0x12')][_0x8eae('0x13')]({'raw':_0x3db47b[_0x8eae('0x14')]?_0x3db47b[_0x8eae('0x14')][_0x8eae('0x15')]===undefined?!![]:![]:!![],'where':_0x3db47b[_0x8eae('0x14')]?_0x3db47b['options']['where']||null:null,'attributes':_0x3db47b[_0x8eae('0x14')]?_0x3db47b[_0x8eae('0x14')][_0x8eae('0x16')]||null:null,'limit':_0x3db47b['options']?_0x3db47b[_0x8eae('0x14')][_0x8eae('0x17')]||null:null,'include':_0x3db47b['options']?_0x3db47b[_0x8eae('0x14')][_0x8eae('0x18')]?_['map'](_0x3db47b[_0x8eae('0x14')][_0x8eae('0x18')],function(_0x171710){return{'model':db[_0x171710[_0x8eae('0x19')]],'as':_0x171710['as'],'attributes':_0x171710[_0x8eae('0x16')],'include':_0x171710[_0x8eae('0x18')]?_[_0x8eae('0x1a')](_0x171710[_0x8eae('0x18')],function(_0x14c0c5){return{'model':db[_0x14c0c5[_0x8eae('0x19')]],'as':_0x14c0c5['as'],'attributes':_0x14c0c5[_0x8eae('0x16')],'include':_0x14c0c5['include']?_[_0x8eae('0x1a')](_0x14c0c5[_0x8eae('0x18')],function(_0x141940){return{'model':db[_0x141940[_0x8eae('0x19')]],'as':_0x141940['as'],'attributes':_0x141940[_0x8eae('0x16')]};}):[]};}):[]};}):[]:[]})[_0x8eae('0x1b')](function(_0x206ba3){logger['info'](_0x8eae('0x1c'),_0x3db47b);logger['debug'](_0x8eae('0x1c'),_0x3db47b,JSON[_0x8eae('0x1d')](_0x206ba3));_0x386a97(_0x206ba3);})[_0x8eae('0x1e')](function(_0x3f5d30){logger[_0x8eae('0xf')]('GetTrigger',_0x3f5d30['message'],_0x3db47b);_0x13331a(_0x3fe930[_0x8eae('0xf')](0x1f4,_0x3f5d30[_0x8eae('0x10')]));});});};exports[_0x8eae('0x1f')]=function(_0x307a19){var _0x547eea=this;return new Promise(function(_0x113dc7,_0x22ffeb){return db[_0x8eae('0x12')][_0x8eae('0x20')]({'raw':_0x307a19[_0x8eae('0x14')]?_0x307a19[_0x8eae('0x14')][_0x8eae('0x15')]===undefined?!![]:![]:!![],'where':_0x307a19[_0x8eae('0x14')]?_0x307a19[_0x8eae('0x14')][_0x8eae('0x21')]||null:null,'attributes':_0x307a19[_0x8eae('0x14')]?_0x307a19[_0x8eae('0x14')][_0x8eae('0x16')]||null:null,'include':_0x307a19[_0x8eae('0x14')]?_0x307a19[_0x8eae('0x14')][_0x8eae('0x18')]?_[_0x8eae('0x1a')](_0x307a19[_0x8eae('0x14')][_0x8eae('0x18')],function(_0x2fc72a){return{'model':db[_0x2fc72a[_0x8eae('0x19')]],'as':_0x2fc72a['as'],'attributes':_0x2fc72a['attributes'],'include':_0x2fc72a[_0x8eae('0x18')]?_[_0x8eae('0x1a')](_0x2fc72a[_0x8eae('0x18')],function(_0x4bf905){return{'model':db[_0x4bf905[_0x8eae('0x19')]],'as':_0x4bf905['as'],'attributes':_0x4bf905[_0x8eae('0x16')],'include':_0x4bf905[_0x8eae('0x18')]?_[_0x8eae('0x1a')](_0x4bf905['include'],function(_0xa885ad){return{'model':db[_0xa885ad['model']],'as':_0xa885ad['as'],'attributes':_0xa885ad['attributes']};}):[]};}):[]};}):[]:[]})[_0x8eae('0x1b')](function(_0x38713d){logger[_0x8eae('0xb')](_0x8eae('0x1f'),_0x307a19);logger[_0x8eae('0xe')](_0x8eae('0x1f'),_0x307a19,JSON[_0x8eae('0x1d')](_0x38713d));_0x113dc7(_0x38713d);})['catch'](function(_0x71f9be){logger[_0x8eae('0xf')]('ShowTrigger',_0x71f9be['message'],_0x307a19);_0x22ffeb(_0x547eea['error'](0x1f4,_0x71f9be[_0x8eae('0x10')]));});});}; \ No newline at end of file +var _0xb41f=['GetTrigger','Trigger','findAll','options','raw','where','attributes','limit','include','map','model','then','catch','ShowTrigger','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','request','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0xfd716,_0x56aacd){var _0x9e4d53=function(_0x2a5b24){while(--_0x2a5b24){_0xfd716['push'](_0xfd716['shift']());}};_0x9e4d53(++_0x56aacd);}(_0xb41f,0x104));var _0xfb41=function(_0x44b758,_0x69c372){_0x44b758=_0x44b758-0x0;var _0x23c523=_0xb41f[_0x44b758];return _0x23c523;};'use strict';var _=require(_0xfb41('0x0'));var util=require(_0xfb41('0x1'));var moment=require(_0xfb41('0x2'));var BPromise=require(_0xfb41('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfb41('0x4'));var db=require(_0xfb41('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xfb41('0x6'))('rpc');var config=require(_0xfb41('0x7'));var jayson=require(_0xfb41('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1ce176,_0x3eb0ea,_0x6d2b4a){return new BPromise(function(_0x342e70,_0x1411f8){return client[_0xfb41('0x9')](_0x1ce176,_0x6d2b4a)['then'](function(_0x143bc){logger[_0xfb41('0xa')](_0xfb41('0xb'),_0x3eb0ea,_0xfb41('0xc'));logger[_0xfb41('0xd')](_0xfb41('0xe'),_0x3eb0ea,'request\x20sent',JSON[_0xfb41('0xf')](_0x143bc));if(_0x143bc[_0xfb41('0x10')]){if(_0x143bc[_0xfb41('0x10')][_0xfb41('0x11')]===0x1f4){logger[_0xfb41('0x10')](_0xfb41('0xb'),_0x3eb0ea,_0x143bc[_0xfb41('0x10')][_0xfb41('0x12')]);return _0x1411f8(_0x143bc[_0xfb41('0x10')]['message']);}logger[_0xfb41('0x10')](_0xfb41('0xb'),_0x3eb0ea,_0x143bc['error'][_0xfb41('0x12')]);return _0x342e70(_0x143bc[_0xfb41('0x10')]['message']);}else{logger['info'](_0xfb41('0xb'),_0x3eb0ea,_0xfb41('0xc'));_0x342e70(_0x143bc[_0xfb41('0x13')][_0xfb41('0x12')]);}})['catch'](function(_0x3341c1){logger[_0xfb41('0x10')]('Trigger,\x20%s,\x20%s',_0x3eb0ea,_0x3341c1);_0x1411f8(_0x3341c1);});});}exports[_0xfb41('0x14')]=function(_0x59227c){var _0x431a36=this;return new Promise(function(_0x50ca43,_0x3d62bf){return db[_0xfb41('0x15')][_0xfb41('0x16')]({'raw':_0x59227c[_0xfb41('0x17')]?_0x59227c[_0xfb41('0x17')][_0xfb41('0x18')]===undefined?!![]:![]:!![],'where':_0x59227c[_0xfb41('0x17')]?_0x59227c[_0xfb41('0x17')][_0xfb41('0x19')]||null:null,'attributes':_0x59227c[_0xfb41('0x17')]?_0x59227c[_0xfb41('0x17')][_0xfb41('0x1a')]||null:null,'limit':_0x59227c[_0xfb41('0x17')]?_0x59227c['options'][_0xfb41('0x1b')]||null:null,'include':_0x59227c['options']?_0x59227c[_0xfb41('0x17')][_0xfb41('0x1c')]?_[_0xfb41('0x1d')](_0x59227c[_0xfb41('0x17')][_0xfb41('0x1c')],function(_0x25d0f7){return{'model':db[_0x25d0f7['model']],'as':_0x25d0f7['as'],'attributes':_0x25d0f7[_0xfb41('0x1a')],'include':_0x25d0f7[_0xfb41('0x1c')]?_[_0xfb41('0x1d')](_0x25d0f7[_0xfb41('0x1c')],function(_0x4c0e0f){return{'model':db[_0x4c0e0f['model']],'as':_0x4c0e0f['as'],'attributes':_0x4c0e0f['attributes'],'include':_0x4c0e0f[_0xfb41('0x1c')]?_[_0xfb41('0x1d')](_0x4c0e0f[_0xfb41('0x1c')],function(_0x154cdc){return{'model':db[_0x154cdc[_0xfb41('0x1e')]],'as':_0x154cdc['as'],'attributes':_0x154cdc['attributes']};}):[]};}):[]};}):[]:[]})[_0xfb41('0x1f')](function(_0x875e07){logger[_0xfb41('0xa')](_0xfb41('0x14'),_0x59227c);logger[_0xfb41('0xd')](_0xfb41('0x14'),_0x59227c,JSON[_0xfb41('0xf')](_0x875e07));_0x50ca43(_0x875e07);})[_0xfb41('0x20')](function(_0x242506){logger['error']('GetTrigger',_0x242506[_0xfb41('0x12')],_0x59227c);_0x3d62bf(_0x431a36[_0xfb41('0x10')](0x1f4,_0x242506[_0xfb41('0x12')]));});});};exports[_0xfb41('0x21')]=function(_0x9a6401){var _0x30a28b=this;return new Promise(function(_0x2e4062,_0x4bbc15){return db['Trigger'][_0xfb41('0x22')]({'raw':_0x9a6401[_0xfb41('0x17')]?_0x9a6401[_0xfb41('0x17')][_0xfb41('0x18')]===undefined?!![]:![]:!![],'where':_0x9a6401['options']?_0x9a6401[_0xfb41('0x17')][_0xfb41('0x19')]||null:null,'attributes':_0x9a6401[_0xfb41('0x17')]?_0x9a6401[_0xfb41('0x17')]['attributes']||null:null,'include':_0x9a6401[_0xfb41('0x17')]?_0x9a6401['options'][_0xfb41('0x1c')]?_[_0xfb41('0x1d')](_0x9a6401[_0xfb41('0x17')]['include'],function(_0xafa8f5){return{'model':db[_0xafa8f5[_0xfb41('0x1e')]],'as':_0xafa8f5['as'],'attributes':_0xafa8f5['attributes'],'include':_0xafa8f5[_0xfb41('0x1c')]?_[_0xfb41('0x1d')](_0xafa8f5[_0xfb41('0x1c')],function(_0x50038f){return{'model':db[_0x50038f[_0xfb41('0x1e')]],'as':_0x50038f['as'],'attributes':_0x50038f['attributes'],'include':_0x50038f[_0xfb41('0x1c')]?_[_0xfb41('0x1d')](_0x50038f[_0xfb41('0x1c')],function(_0x54a48e){return{'model':db[_0x54a48e[_0xfb41('0x1e')]],'as':_0x54a48e['as'],'attributes':_0x54a48e['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xe2483a){logger[_0xfb41('0xa')](_0xfb41('0x21'),_0x9a6401);logger[_0xfb41('0xd')](_0xfb41('0x21'),_0x9a6401,JSON[_0xfb41('0xf')](_0xe2483a));_0x2e4062(_0xe2483a);})['catch'](function(_0x330887){logger['error'](_0xfb41('0x21'),_0x330887[_0xfb41('0x12')],_0x9a6401);_0x4bbc15(_0x30a28b[_0xfb41('0x10')](0x1f4,_0x330887['message']));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 816105d..cfbe795 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 _0x4139=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./trunk.controller','get','index','/:id','isAuthenticated','show','post','/:id/clone','clone','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x2e655a,_0x6d5799){var _0x26f13b=function(_0x2dd535){while(--_0x2dd535){_0x2e655a['push'](_0x2e655a['shift']());}};_0x26f13b(++_0x6d5799);}(_0x4139,0x8c));var _0x9413=function(_0x221342,_0x3246d6){_0x221342=_0x221342-0x0;var _0x52a7a9=_0x4139[_0x221342];return _0x52a7a9;};'use strict';var multer=require(_0x9413('0x0'));var util=require(_0x9413('0x1'));var path=require(_0x9413('0x2'));var timeout=require(_0x9413('0x3'));var express=require(_0x9413('0x4'));var router=express[_0x9413('0x5')]();var fs_extra=require(_0x9413('0x6'));var auth=require(_0x9413('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x9413('0x8'));var controller=require(_0x9413('0x9'));router[_0x9413('0xa')]('/',auth['isAuthenticated'](),controller[_0x9413('0xb')]);router[_0x9413('0xa')](_0x9413('0xc'),auth[_0x9413('0xd')](),controller[_0x9413('0xe')]);router[_0x9413('0xf')](_0x9413('0x10'),auth[_0x9413('0xd')](),controller[_0x9413('0x11')]);router[_0x9413('0xf')]('/',auth['isAuthenticated'](),controller[_0x9413('0x12')]);router[_0x9413('0x13')](_0x9413('0xc'),auth['isAuthenticated'](),controller[_0x9413('0x14')]);router[_0x9413('0x15')](_0x9413('0xc'),auth['isAuthenticated'](),controller[_0x9413('0x16')]);module[_0x9413('0x17')]=router; \ No newline at end of file +var _0x5cbd=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated','show','/:id/clone','clone','post','create','put','/:id','delete'];(function(_0x5cf214,_0x222f06){var _0x17908b=function(_0x7a2d12){while(--_0x7a2d12){_0x5cf214['push'](_0x5cf214['shift']());}};_0x17908b(++_0x222f06);}(_0x5cbd,0x13c));var _0xd5cb=function(_0x469d0a,_0x19c14f){_0x469d0a=_0x469d0a-0x0;var _0x49bb3b=_0x5cbd[_0x469d0a];return _0x49bb3b;};'use strict';var multer=require(_0xd5cb('0x0'));var util=require(_0xd5cb('0x1'));var path=require(_0xd5cb('0x2'));var timeout=require(_0xd5cb('0x3'));var express=require(_0xd5cb('0x4'));var router=express[_0xd5cb('0x5')]();var fs_extra=require(_0xd5cb('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xd5cb('0x7'));var config=require(_0xd5cb('0x8'));var controller=require(_0xd5cb('0x9'));router[_0xd5cb('0xa')]('/',auth[_0xd5cb('0xb')](),controller['index']);router[_0xd5cb('0xa')]('/:id',auth[_0xd5cb('0xb')](),controller[_0xd5cb('0xc')]);router['post'](_0xd5cb('0xd'),auth['isAuthenticated'](),controller[_0xd5cb('0xe')]);router[_0xd5cb('0xf')]('/',auth[_0xd5cb('0xb')](),controller[_0xd5cb('0x10')]);router[_0xd5cb('0x11')](_0xd5cb('0x12'),auth[_0xd5cb('0xb')](),controller['update']);router[_0xd5cb('0x13')]('/:id',auth[_0xd5cb('0xb')](),controller['destroy']);module[_0xd5cb('0x14')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index b7588ed..a8de41f 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 _0xa273=['refuse','INTEGER','uac','uas','pai','fingerprint','passive','actpass','dynamic','update,nonat','BOOLEAN','sequelize','exports','STRING','name','ENUM','friend','user','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','setDataValue','transport','join','getDataValue','rfc2833','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','\x22\x22\x20<>','always','accept'];(function(_0x319d6e,_0x44517f){var _0x2ba9d6=function(_0x5932fc){while(--_0x5932fc){_0x319d6e['push'](_0x319d6e['shift']());}};_0x2ba9d6(++_0x44517f);}(_0xa273,0x1cd));var _0x3a27=function(_0x1e44fa,_0x1b1ec2){_0x1e44fa=_0x1e44fa-0x0;var _0x190b4d=_0xa273[_0x1e44fa];return _0x190b4d;};'use strict';var Sequelize=require(_0x3a27('0x0'));module[_0x3a27('0x1')]={'name':{'type':Sequelize[_0x3a27('0x2')],'allowNull':![],'unique':_0x3a27('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x3a27('0x4')](_0x3a27('0x5'),_0x3a27('0x6'),'peer'),'allowNull':![],'defaultValue':_0x3a27('0x5')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x3a27('0x7')},'callingpres':{'type':Sequelize[_0x3a27('0x4')](_0x3a27('0x8'),'ALLOWED_PASSED_SCREEN',_0x3a27('0x9'),_0x3a27('0xa'),_0x3a27('0xb'),_0x3a27('0xc'),_0x3a27('0xd'),_0x3a27('0xe'))},'deny':{'type':Sequelize[_0x3a27('0x2')]},'permit':{'type':Sequelize[_0x3a27('0x2')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0x3a27('0x2')]},'remotesecret':{'type':Sequelize[_0x3a27('0x2')]},'transport':{'type':Sequelize[_0x3a27('0x2')],'defaultValue':'udp','set':function(_0x3c345b){this[_0x3a27('0xf')](_0x3a27('0x10'),_0x3c345b?_0x3c345b[_0x3a27('0x11')](','):null);},'get':function(){return this[_0x3a27('0x12')](_0x3a27('0x10'))?this[_0x3a27('0x12')](_0x3a27('0x10'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x3a27('0x4')](_0x3a27('0x13'),'info','shortinfo',_0x3a27('0x14'),_0x3a27('0x15')),'defaultValue':_0x3a27('0x13')},'directmedia':{'type':Sequelize[_0x3a27('0x4')](_0x3a27('0x16'),'no',_0x3a27('0x17'),_0x3a27('0x18'),_0x3a27('0x19')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x3a27('0x16'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0x3a27('0x2')]},'nat':{'type':Sequelize[_0x3a27('0x2')],'defaultValue':_0x3a27('0x1a'),'set':function(_0x305130){this['setDataValue']('nat',_0x305130?_0x305130[_0x3a27('0x11')](','):null);},'get':function(){return this[_0x3a27('0x12')](_0x3a27('0x1b'))?this[_0x3a27('0x12')](_0x3a27('0x1b'))[_0x3a27('0x1c')](','):null;},'comment':_0x3a27('0x1d')},'callgroup':{'type':Sequelize[_0x3a27('0x2')]},'namedcallgroup':{'type':Sequelize[_0x3a27('0x2')]},'pickupgroup':{'type':Sequelize[_0x3a27('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x3a27('0x2')]},'language':{'type':Sequelize[_0x3a27('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0x3a27('0x2')],'defaultValue':_0x3a27('0x1e')},'allow':{'type':Sequelize[_0x3a27('0x2')],'allowNull':![],'defaultValue':_0x3a27('0x1f'),'set':function(_0xdc03c7){this[_0x3a27('0xf')](_0x3a27('0x20'),_0xdc03c7?_0xdc03c7['join'](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x3a27('0x12')](_0x3a27('0x20'))?this[_0x3a27('0x12')]('allow')[_0x3a27('0x1c')](';'):null;},'comment':_0x3a27('0x21')},'autoframing':{'type':Sequelize[_0x3a27('0x4')](_0x3a27('0x16'),'no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':'port,invite','set':function(_0x1342d9){this[_0x3a27('0xf')](_0x3a27('0x22'),_0x1342d9?_0x1342d9[_0x3a27('0x11')](','):null);},'get':function(){return this[_0x3a27('0x12')](_0x3a27('0x22'))?this[_0x3a27('0x12')](_0x3a27('0x22'))[_0x3a27('0x1c')](','):null;},'comment':_0x3a27('0x23')},'trustrpid':{'type':Sequelize[_0x3a27('0x4')](_0x3a27('0x16'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x3a27('0x4')](_0x3a27('0x16'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x3a27('0x4')](_0x3a27('0x16'),'no','never')},'promiscredir':{'type':Sequelize[_0x3a27('0x4')](_0x3a27('0x16'),'no')},'useclientcode':{'type':Sequelize[_0x3a27('0x4')](_0x3a27('0x16'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0x3a27('0x2')]},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0x3a27('0x24')},'amaflags':{'type':Sequelize[_0x3a27('0x2')]},'callcounter':{'type':Sequelize['ENUM'](_0x3a27('0x16'),'no'),'defaultValue':_0x3a27('0x16')},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0x3a27('0x4')](_0x3a27('0x16'),'no')},'allowsubscribe':{'type':Sequelize[_0x3a27('0x4')](_0x3a27('0x16'),'no')},'allowtransfer':{'type':Sequelize[_0x3a27('0x4')](_0x3a27('0x16'),'no')},'ignoresdpversion':{'type':Sequelize[_0x3a27('0x4')](_0x3a27('0x16'),'no')},'subscribecontext':{'type':Sequelize[_0x3a27('0x2')]},'template':{'type':Sequelize[_0x3a27('0x2')]},'videosupport':{'type':Sequelize[_0x3a27('0x4')](_0x3a27('0x16'),'no',_0x3a27('0x25')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x3a27('0x16'),'no')},'mailbox':{'type':Sequelize[_0x3a27('0x2')]},'session_timers':{'type':Sequelize[_0x3a27('0x4')](_0x3a27('0x26'),_0x3a27('0x27'),'originate')},'session_expires':{'type':Sequelize[_0x3a27('0x28')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0x3a27('0x4')](_0x3a27('0x29'),_0x3a27('0x2a')),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize[_0x3a27('0x2')]},'fromdomain':{'type':Sequelize[_0x3a27('0x2')]},'fromuser':{'type':Sequelize[_0x3a27('0x2')]},'port':{'type':Sequelize[_0x3a27('0x28')](0x5)},'qualify':{'type':Sequelize[_0x3a27('0x4')](_0x3a27('0x16'),'no'),'defaultValue':_0x3a27('0x16')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0x3a27('0x2')]},'rtptimeout':{'type':Sequelize[_0x3a27('0x28')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x3a27('0x28')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x3a27('0x28')](0xb)},'sendrpid':{'type':Sequelize[_0x3a27('0x4')](_0x3a27('0x16'),'no',_0x3a27('0x2b')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0x3a27('0x28')](0xb)},'timerb':{'type':Sequelize[_0x3a27('0x28')](0xb)},'qualifyfreq':{'type':Sequelize[_0x3a27('0x28')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0x3a27('0x2')]},'contactacl':{'type':Sequelize[_0x3a27('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0x3a27('0x2')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize[_0x3a27('0x4')](_0x3a27('0x16'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x3a27('0x4')](_0x3a27('0x16'),'no')},'force_avp':{'type':Sequelize[_0x3a27('0x4')](_0x3a27('0x16'),'no')},'icesupport':{'type':Sequelize[_0x3a27('0x4')]('yes','no')},'dtlsenable':{'type':Sequelize['ENUM'](_0x3a27('0x16'),'no')},'dtlsverify':{'type':Sequelize[_0x3a27('0x4')](_0x3a27('0x16'),'no',_0x3a27('0x2c'),'certificate')},'dtlsrekey':{'type':Sequelize[_0x3a27('0x28')](0xb)},'dtlscertfile':{'type':Sequelize[_0x3a27('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0x3a27('0x2')]},'dtlscipher':{'type':Sequelize[_0x3a27('0x2')]},'dtlscafile':{'type':Sequelize[_0x3a27('0x2')]},'dtlscapath':{'type':Sequelize[_0x3a27('0x2')]},'dtlssetup':{'type':Sequelize[_0x3a27('0x4')]('active',_0x3a27('0x2d'),_0x3a27('0x2e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x3a27('0x2')]},'usereqphone':{'type':Sequelize[_0x3a27('0x4')](_0x3a27('0x16'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x3a27('0x4')](_0x3a27('0x16'),'no')},'subscribemwi':{'type':Sequelize[_0x3a27('0x4')](_0x3a27('0x16'),'no')},'vmexten':{'type':Sequelize[_0x3a27('0x2')]},'mohinterpret':{'type':Sequelize[_0x3a27('0x2')]},'mohsuggest':{'type':Sequelize[_0x3a27('0x2')]},'parkinglot':{'type':Sequelize[_0x3a27('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x3a27('0x2')],'defaultValue':_0x3a27('0x2f')},'canreinvite':{'type':Sequelize[_0x3a27('0x4')](_0x3a27('0x16'),'no',_0x3a27('0x17'),_0x3a27('0x18'),_0x3a27('0x30')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x3a27('0x2')]},'otherFields':{'type':Sequelize[_0x3a27('0x2')]},'active':{'type':Sequelize[_0x3a27('0x31')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x3a27('0x2')],'defaultValue':'no'}}; \ No newline at end of file +var _0x7f4c=['actpass','dynamic','nonat','update','update,nonat','BOOLEAN','sequelize','exports','STRING','name','ENUM','friend','user','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB','udp','setDataValue','transport','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','auto','yes','outgoing','force_rport,comedia','getDataValue','nat','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','INTEGER','always','refuse','originate','uac','uas','fingerprint','certificate','active'];(function(_0x5206f7,_0x580f49){var _0x13ca7f=function(_0x30008b){while(--_0x30008b){_0x5206f7['push'](_0x5206f7['shift']());}};_0x13ca7f(++_0x580f49);}(_0x7f4c,0x172));var _0xc7f4=function(_0x5415b9,_0x58e2e5){_0x5415b9=_0x5415b9-0x0;var _0x41d2cd=_0x7f4c[_0x5415b9];return _0x41d2cd;};'use strict';var Sequelize=require(_0xc7f4('0x0'));module[_0xc7f4('0x1')]={'name':{'type':Sequelize[_0xc7f4('0x2')],'allowNull':![],'unique':_0xc7f4('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xc7f4('0x4')](_0xc7f4('0x5'),_0xc7f4('0x6'),'peer'),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0xc7f4('0x2')],'allowNull':![],'defaultValue':_0xc7f4('0x7')},'callingpres':{'type':Sequelize[_0xc7f4('0x4')](_0xc7f4('0x8'),_0xc7f4('0x9'),'ALLOWED_FAILED_SCREEN',_0xc7f4('0xa'),_0xc7f4('0xb'),_0xc7f4('0xc'),'PROHIB_FAILED_SCREEN',_0xc7f4('0xd'))},'deny':{'type':Sequelize[_0xc7f4('0x2')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0xc7f4('0x2')]},'md5secret':{'type':Sequelize[_0xc7f4('0x2')]},'remotesecret':{'type':Sequelize[_0xc7f4('0x2')]},'transport':{'type':Sequelize[_0xc7f4('0x2')],'defaultValue':_0xc7f4('0xe'),'set':function(_0x27cbba){this[_0xc7f4('0xf')](_0xc7f4('0x10'),_0x27cbba?_0x27cbba[_0xc7f4('0x11')](','):null);},'get':function(){return this['getDataValue'](_0xc7f4('0x10'))?this['getDataValue'](_0xc7f4('0x10'))['split'](','):null;},'comment':_0xc7f4('0x12')},'dtmfmode':{'type':Sequelize['ENUM'](_0xc7f4('0x13'),'info',_0xc7f4('0x14'),'inband',_0xc7f4('0x15')),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0xc7f4('0x4')](_0xc7f4('0x16'),'no','nonat','update',_0xc7f4('0x17')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0xc7f4('0x16'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xc7f4('0x2')]},'directmediadeny':{'type':Sequelize[_0xc7f4('0x2')]},'nat':{'type':Sequelize[_0xc7f4('0x2')],'defaultValue':_0xc7f4('0x18'),'set':function(_0x3d86cd){this[_0xc7f4('0xf')]('nat',_0x3d86cd?_0x3d86cd[_0xc7f4('0x11')](','):null);},'get':function(){return this['getDataValue']('nat')?this[_0xc7f4('0x19')](_0xc7f4('0x1a'))[_0xc7f4('0x1b')](','):null;},'comment':_0xc7f4('0x1c')},'callgroup':{'type':Sequelize[_0xc7f4('0x2')]},'namedcallgroup':{'type':Sequelize[_0xc7f4('0x2')]},'pickupgroup':{'type':Sequelize[_0xc7f4('0x2')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xc7f4('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xc7f4('0x2')],'defaultValue':_0xc7f4('0x1d')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xc7f4('0x1e'),'set':function(_0x4d208c){this['setDataValue'](_0xc7f4('0x1f'),_0x4d208c?_0x4d208c[_0xc7f4('0x11')](';'):_0xc7f4('0x1e'));},'get':function(){return this[_0xc7f4('0x19')](_0xc7f4('0x1f'))?this['getDataValue'](_0xc7f4('0x1f'))[_0xc7f4('0x1b')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize['ENUM'](_0xc7f4('0x16'),'no')},'insecure':{'type':Sequelize[_0xc7f4('0x2')],'defaultValue':_0xc7f4('0x20'),'set':function(_0x32b02b){this[_0xc7f4('0xf')](_0xc7f4('0x21'),_0x32b02b?_0x32b02b[_0xc7f4('0x11')](','):null);},'get':function(){return this['getDataValue']('insecure')?this['getDataValue'](_0xc7f4('0x21'))[_0xc7f4('0x1b')](','):null;},'comment':_0xc7f4('0x22')},'trustrpid':{'type':Sequelize[_0xc7f4('0x4')](_0xc7f4('0x16'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xc7f4('0x4')](_0xc7f4('0x16'),'no',_0xc7f4('0x23'))},'promiscredir':{'type':Sequelize[_0xc7f4('0x4')](_0xc7f4('0x16'),'no')},'useclientcode':{'type':Sequelize['ENUM'](_0xc7f4('0x16'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0xc7f4('0x2')]},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0xc7f4('0x24')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0xc7f4('0x4')]('yes','no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0xc7f4('0x25')](0xb)},'allowoverlap':{'type':Sequelize[_0xc7f4('0x4')](_0xc7f4('0x16'),'no')},'allowsubscribe':{'type':Sequelize[_0xc7f4('0x4')](_0xc7f4('0x16'),'no')},'allowtransfer':{'type':Sequelize[_0xc7f4('0x4')]('yes','no')},'ignoresdpversion':{'type':Sequelize['ENUM']('yes','no')},'subscribecontext':{'type':Sequelize[_0xc7f4('0x2')]},'template':{'type':Sequelize[_0xc7f4('0x2')]},'videosupport':{'type':Sequelize[_0xc7f4('0x4')](_0xc7f4('0x16'),'no',_0xc7f4('0x26')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize[_0xc7f4('0x4')](_0xc7f4('0x16'),'no')},'mailbox':{'type':Sequelize[_0xc7f4('0x2')]},'session_timers':{'type':Sequelize[_0xc7f4('0x4')]('accept',_0xc7f4('0x27'),_0xc7f4('0x28'))},'session_expires':{'type':Sequelize[_0xc7f4('0x25')](0xb)},'session_minse':{'type':Sequelize[_0xc7f4('0x25')](0xb)},'session_refresher':{'type':Sequelize[_0xc7f4('0x4')](_0xc7f4('0x29'),_0xc7f4('0x2a')),'defaultValue':_0xc7f4('0x2a')},'t38pt_usertpsource':{'type':Sequelize[_0xc7f4('0x2')]},'regexten':{'type':Sequelize[_0xc7f4('0x2')]},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0xc7f4('0x2')]},'port':{'type':Sequelize[_0xc7f4('0x25')](0x5)},'qualify':{'type':Sequelize[_0xc7f4('0x4')](_0xc7f4('0x16'),'no'),'defaultValue':_0xc7f4('0x16')},'keepalive':{'type':Sequelize[_0xc7f4('0x25')](0xb)},'defaultip':{'type':Sequelize[_0xc7f4('0x2')]},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize[_0xc7f4('0x25')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0xc7f4('0x16'),'no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xc7f4('0x2')]},'callbackextension':{'type':Sequelize[_0xc7f4('0x2')]},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize[_0xc7f4('0x25')](0xb)},'qualifyfreq':{'type':Sequelize[_0xc7f4('0x25')](0xb)},'contactpermit':{'type':Sequelize[_0xc7f4('0x2')]},'contactdeny':{'type':Sequelize[_0xc7f4('0x2')]},'contactacl':{'type':Sequelize[_0xc7f4('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0xc7f4('0x2')]},'use_q850_reason':{'type':Sequelize[_0xc7f4('0x2')]},'maxforwards':{'type':Sequelize[_0xc7f4('0x25')](0xb)},'encryption':{'type':Sequelize[_0xc7f4('0x4')](_0xc7f4('0x16'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0xc7f4('0x16'),'no')},'force_avp':{'type':Sequelize[_0xc7f4('0x4')](_0xc7f4('0x16'),'no')},'icesupport':{'type':Sequelize[_0xc7f4('0x4')](_0xc7f4('0x16'),'no')},'dtlsenable':{'type':Sequelize[_0xc7f4('0x4')]('yes','no')},'dtlsverify':{'type':Sequelize[_0xc7f4('0x4')](_0xc7f4('0x16'),'no',_0xc7f4('0x2b'),_0xc7f4('0x2c'))},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize[_0xc7f4('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0xc7f4('0x2')]},'dtlscipher':{'type':Sequelize[_0xc7f4('0x2')]},'dtlscafile':{'type':Sequelize[_0xc7f4('0x2')]},'dtlscapath':{'type':Sequelize[_0xc7f4('0x2')]},'dtlssetup':{'type':Sequelize['ENUM'](_0xc7f4('0x2d'),'passive',_0xc7f4('0x2e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xc7f4('0x2')]},'usereqphone':{'type':Sequelize['ENUM'](_0xc7f4('0x16'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xc7f4('0x2')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0xc7f4('0x25')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xc7f4('0x4')](_0xc7f4('0x16'),'no')},'subscribemwi':{'type':Sequelize[_0xc7f4('0x4')]('yes','no')},'vmexten':{'type':Sequelize[_0xc7f4('0x2')]},'mohinterpret':{'type':Sequelize[_0xc7f4('0x2')]},'mohsuggest':{'type':Sequelize[_0xc7f4('0x2')]},'parkinglot':{'type':Sequelize[_0xc7f4('0x2')]},'description':{'type':Sequelize[_0xc7f4('0x2')]},'host':{'type':Sequelize[_0xc7f4('0x2')],'defaultValue':_0xc7f4('0x2f')},'canreinvite':{'type':Sequelize[_0xc7f4('0x4')]('yes','no',_0xc7f4('0x30'),_0xc7f4('0x31'),_0xc7f4('0x32')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xc7f4('0x2')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0xc7f4('0x33')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index 868e0fa..f7289eb 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 _0x81bd=['/etc/asterisk/sip_xcally_trunks.conf','registry','render','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','update','server/files/templates/trunk.ejs','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','http','request','then','info','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','destroy','UserProfileResource','name','index','Trunk','rawAttributes','fieldName','key','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','clone','find','get','omit','createdAt','updatedAt','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Trunks','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','server/files/templates/registry.ejs','utf8','writeFileSync'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0x81bd,0x7c));var _0xd81b=function(_0x287eaf,_0x41d318){_0x287eaf=_0x287eaf-0x0;var _0x321683=_0x81bd[_0x287eaf];return _0x321683;};'use strict';var emlformat=require(_0xd81b('0x0'));var rimraf=require(_0xd81b('0x1'));var zipdir=require(_0xd81b('0x2'));var jsonpatch=require(_0xd81b('0x3'));var rp=require(_0xd81b('0x4'));var moment=require(_0xd81b('0x5'));var BPromise=require(_0xd81b('0x6'));var Mustache=require('mustache');var util=require(_0xd81b('0x7'));var path=require(_0xd81b('0x8'));var sox=require(_0xd81b('0x9'));var csv=require('to-csv');var ejs=require(_0xd81b('0xa'));var fs=require('fs');var fs_extra=require(_0xd81b('0xb'));var _=require(_0xd81b('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd81b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd81b('0xe'));var querystring=require(_0xd81b('0xf'));var Papa=require(_0xd81b('0x10'));var Redis=require(_0xd81b('0x11'));var authService=require(_0xd81b('0x12'));var qs=require(_0xd81b('0x13'));var as=require(_0xd81b('0x14'));var hardwareService=require(_0xd81b('0x15'));var logger=require(_0xd81b('0x16'))(_0xd81b('0x17'));var utils=require(_0xd81b('0x18'));var config=require(_0xd81b('0x19'));var licenseUtil=require(_0xd81b('0x1a'));var db=require('../../mysqldb')['db'];var jayson=require(_0xd81b('0x1b'));var client=jayson['client'][_0xd81b('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0xe75568,_0x5f0b6b,_0x35a053,_0x47dd04){return new BPromise(function(_0x13dd00,_0x41bf7a){var _0x6c6041=_0x47dd04||client;return _0x6c6041[_0xd81b('0x1d')](_0xe75568,_0x35a053)[_0xd81b('0x1e')](function(_0x552215){logger[_0xd81b('0x1f')](_0xd81b('0x20'),_0x5f0b6b,'request\x20sent');logger[_0xd81b('0x21')](_0xd81b('0x22'),_0x5f0b6b,_0xd81b('0x23'),JSON[_0xd81b('0x24')](_0x552215));if(_0x552215[_0xd81b('0x25')]){if(_0x552215[_0xd81b('0x25')][_0xd81b('0x26')]===0x1f4){logger[_0xd81b('0x25')](_0xd81b('0x20'),_0x5f0b6b,_0x552215[_0xd81b('0x25')][_0xd81b('0x27')]);return _0x41bf7a(_0x552215[_0xd81b('0x25')][_0xd81b('0x27')]);}logger[_0xd81b('0x25')](_0xd81b('0x20'),_0x5f0b6b,_0x552215[_0xd81b('0x25')]['message']);return _0x13dd00(_0x552215['error'][_0xd81b('0x27')]);}else{logger[_0xd81b('0x1f')](_0xd81b('0x20'),_0x5f0b6b,'request\x20sent');_0x13dd00(_0x552215[_0xd81b('0x28')][_0xd81b('0x27')]);}})['catch'](function(_0xcd6474){logger[_0xd81b('0x25')](_0xd81b('0x20'),_0x5f0b6b,_0xcd6474);_0x41bf7a(_0xcd6474);});});}function respondWithStatusCode(_0x1ad65c,_0x279176){_0x279176=_0x279176||0xcc;return function(_0xcb4f91){if(_0xcb4f91){return _0x1ad65c[_0xd81b('0x29')](_0x279176);}return _0x1ad65c[_0xd81b('0x2a')](_0x279176)[_0xd81b('0x2b')]();};}function respondWithResult(_0x212c4e,_0x2ccedf){_0x2ccedf=_0x2ccedf||0xc8;return function(_0x1bf351){if(_0x1bf351){return _0x212c4e['status'](_0x2ccedf)[_0xd81b('0x2c')](_0x1bf351);}};}function respondWithFilteredResult(_0x99dbc9,_0xe3637a){return function(_0x31b9fd){if(_0x31b9fd){var _0x3266c2=typeof _0xe3637a[_0xd81b('0x2d')]===_0xd81b('0x2e')&&typeof _0xe3637a[_0xd81b('0x2f')]===_0xd81b('0x2e');var _0x483a3d=_0x31b9fd[_0xd81b('0x30')];var _0x4e2eff=_0x3266c2?0x0:_0xe3637a['offset'];var _0xb9ff9f=_0x3266c2?_0x31b9fd[_0xd81b('0x30')]:_0xe3637a['offset']+_0xe3637a['limit'];var _0x4093c8;if(_0xb9ff9f>=_0x483a3d){_0xb9ff9f=_0x483a3d;_0x4093c8=0xc8;}else{_0x4093c8=0xce;}_0x99dbc9[_0xd81b('0x2a')](_0x4093c8);return _0x99dbc9[_0xd81b('0x31')](_0xd81b('0x32'),_0x4e2eff+'-'+_0xb9ff9f+'/'+_0x483a3d)[_0xd81b('0x2c')](_0x31b9fd);}return null;};}function patchUpdates(_0x4654ba){return function(_0x5527ed){try{jsonpatch[_0xd81b('0x33')](_0x5527ed,_0x4654ba,!![]);}catch(_0x26f629){return BPromise['reject'](_0x26f629);}return _0x5527ed['save']();};}function saveUpdates(_0x165892,_0x1966b1){return function(_0x50472a){if(_0x50472a){return _0x50472a['update'](_0x165892)['then'](function(_0x322991){return _0x322991;});}return null;};}function removeEntity(_0x3ead68,_0x1d2f46){return function(_0x1c4cf7){if(_0x1c4cf7){return _0x1c4cf7[_0xd81b('0x34')]()[_0xd81b('0x1e')](function(){var _0x29aabf=_0x1c4cf7['get']({'plain':!![]});var _0x28782f='Trunks';return db[_0xd81b('0x35')][_0xd81b('0x34')]({'where':{'type':_0x28782f,'resourceId':_0x29aabf['id']}})[_0xd81b('0x1e')](function(){return _0x1c4cf7;});})[_0xd81b('0x1e')](function(){_0x3ead68[_0xd81b('0x2a')](0xcc)[_0xd81b('0x2b')]();});}};}function handleEntityNotFound(_0x1c20d3,_0x2d23b9){return function(_0xf9d1a5){if(!_0xf9d1a5){_0x1c20d3[_0xd81b('0x29')](0x194);}return _0xf9d1a5;};}function handleError(_0x1be4e2,_0x3c8371){_0x3c8371=_0x3c8371||0x1f4;return function(_0x346038){logger['error'](_0x346038['stack']);if(_0x346038[_0xd81b('0x36')]){delete _0x346038[_0xd81b('0x36')];}_0x1be4e2[_0xd81b('0x2a')](_0x3c8371)['send'](_0x346038);};}exports[_0xd81b('0x37')]=function(_0x37ba34,_0x5a236a){var _0x46f058={},_0xaa9e97={},_0x512e39={'count':0x0,'rows':[]};var _0xed5272=_['map'](db[_0xd81b('0x38')][_0xd81b('0x39')],function(_0x203365){return{'name':_0x203365[_0xd81b('0x3a')],'type':_0x203365['type'][_0xd81b('0x3b')]};});_0xaa9e97[_0xd81b('0x3c')]=_[_0xd81b('0x3d')](_0xed5272,_0xd81b('0x36'));_0xaa9e97[_0xd81b('0x3e')]=_[_0xd81b('0x3f')](_0x37ba34[_0xd81b('0x3e')]);_0xaa9e97['filters']=_[_0xd81b('0x40')](_0xaa9e97[_0xd81b('0x3c')],_0xaa9e97[_0xd81b('0x3e')]);_0x46f058['attributes']=_[_0xd81b('0x40')](_0xaa9e97[_0xd81b('0x3c')],qs[_0xd81b('0x41')](_0x37ba34[_0xd81b('0x3e')][_0xd81b('0x41')]));_0x46f058['attributes']=_0x46f058[_0xd81b('0x42')][_0xd81b('0x43')]?_0x46f058[_0xd81b('0x42')]:_0xaa9e97[_0xd81b('0x3c')];if(!_0x37ba34[_0xd81b('0x3e')][_0xd81b('0x44')](_0xd81b('0x45'))){_0x46f058[_0xd81b('0x2f')]=qs[_0xd81b('0x2f')](_0x37ba34[_0xd81b('0x3e')][_0xd81b('0x2f')]);_0x46f058['offset']=qs[_0xd81b('0x2d')](_0x37ba34[_0xd81b('0x3e')][_0xd81b('0x2d')]);}_0x46f058[_0xd81b('0x46')]=qs[_0xd81b('0x47')](_0x37ba34[_0xd81b('0x3e')][_0xd81b('0x47')]);_0x46f058[_0xd81b('0x48')]=qs['filters'](_['pick'](_0x37ba34[_0xd81b('0x3e')],_0xaa9e97[_0xd81b('0x49')]),_0xed5272);if(_0x37ba34[_0xd81b('0x3e')][_0xd81b('0x4a')]){_0x46f058[_0xd81b('0x48')]=_[_0xd81b('0x4b')](_0x46f058[_0xd81b('0x48')],{'$or':_[_0xd81b('0x3d')](_0xed5272,function(_0x2fa588){if(_0x2fa588[_0xd81b('0x4c')]!==_0xd81b('0x4d')){var _0x38e436={};_0x38e436[_0x2fa588['name']]={'$like':'%'+_0x37ba34[_0xd81b('0x3e')][_0xd81b('0x4a')]+'%'};return _0x38e436;}})});}_0x46f058=_[_0xd81b('0x4b')]({},_0x46f058,_0x37ba34[_0xd81b('0x4e')]);var _0x105a48={'where':_0x46f058[_0xd81b('0x48')]};return db[_0xd81b('0x38')][_0xd81b('0x30')](_0x105a48)[_0xd81b('0x1e')](function(_0x53ea36){_0x512e39[_0xd81b('0x30')]=_0x53ea36;if(_0x37ba34[_0xd81b('0x3e')][_0xd81b('0x4f')]){_0x46f058[_0xd81b('0x50')]=[{'all':!![]}];}return db['Trunk'][_0xd81b('0x51')](_0x46f058);})[_0xd81b('0x1e')](function(_0x15030b){_0x512e39[_0xd81b('0x52')]=_0x15030b;return _0x512e39;})[_0xd81b('0x1e')](respondWithFilteredResult(_0x5a236a,_0x46f058))[_0xd81b('0x53')](handleError(_0x5a236a,null));};exports[_0xd81b('0x54')]=function(_0x43d7ce,_0x133a76){var _0x49cba6={'raw':![],'where':{'id':_0x43d7ce[_0xd81b('0x55')]['id']}},_0x534d10={};_0x534d10[_0xd81b('0x3c')]=_[_0xd81b('0x3f')](db[_0xd81b('0x38')][_0xd81b('0x39')]);_0x534d10[_0xd81b('0x3e')]=_[_0xd81b('0x3f')](_0x43d7ce[_0xd81b('0x3e')]);_0x534d10['filters']=_[_0xd81b('0x40')](_0x534d10[_0xd81b('0x3c')],_0x534d10[_0xd81b('0x3e')]);_0x49cba6[_0xd81b('0x42')]=_[_0xd81b('0x40')](_0x534d10['model'],qs[_0xd81b('0x41')](_0x43d7ce[_0xd81b('0x3e')]['fields']));_0x49cba6[_0xd81b('0x42')]=_0x49cba6[_0xd81b('0x42')][_0xd81b('0x43')]?_0x49cba6[_0xd81b('0x42')]:_0x534d10[_0xd81b('0x3c')];if(_0x43d7ce[_0xd81b('0x3e')][_0xd81b('0x4f')]){_0x49cba6[_0xd81b('0x50')]=[{'all':!![]}];}_0x49cba6=_[_0xd81b('0x4b')]({},_0x49cba6,_0x43d7ce[_0xd81b('0x4e')]);return db[_0xd81b('0x38')]['find'](_0x49cba6)[_0xd81b('0x1e')](handleEntityNotFound(_0x133a76,null))['then'](respondWithResult(_0x133a76,null))[_0xd81b('0x53')](handleError(_0x133a76,null));};exports[_0xd81b('0x56')]=function(_0x390db6,_0x3c2a9f){var _0x34d2a2={'where':{'id':_0x390db6['params']['id']}},_0x1e9f73={};_0x1e9f73[_0xd81b('0x3c')]=_[_0xd81b('0x3f')](db['Trunk']['rawAttributes']);_0x34d2a2[_0xd81b('0x42')]=_['intersection'](_0x1e9f73[_0xd81b('0x3c')],qs['fields'](_0x390db6[_0xd81b('0x3e')][_0xd81b('0x41')]));_0x34d2a2[_0xd81b('0x42')]=_0x34d2a2['attributes'][_0xd81b('0x43')]?_0x34d2a2[_0xd81b('0x42')]:_0x1e9f73['model'];if(_0x390db6[_0xd81b('0x3e')][_0xd81b('0x4f')]){_0x34d2a2['include']=[{'all':!![]}];}_0x34d2a2=_[_0xd81b('0x4b')]({},_0x34d2a2,_0x390db6['options']);return db[_0xd81b('0x38')][_0xd81b('0x57')](_0x34d2a2)[_0xd81b('0x1e')](handleEntityNotFound(_0x3c2a9f,null))[_0xd81b('0x1e')](function(_0x4add79){if(_0x4add79){var _0x32eab4=_0x4add79[_0xd81b('0x58')]({'plain':!![]});_0x32eab4=qs[_0xd81b('0x59')](_0x32eab4,['id',_0xd81b('0x5a'),_0xd81b('0x5b')]);_0x390db6['body']=_[_0xd81b('0x59')](_0x390db6[_0xd81b('0x5c')],['id',_0xd81b('0x5a'),_0xd81b('0x5b')]);return db[_0xd81b('0x38')][_0xd81b('0x5d')](_[_0xd81b('0x4b')](_0x32eab4,_0x390db6['body']),{'include':_0x390db6['query']['includeAll']?[{'all':!![]}]:undefined})[_0xd81b('0x1e')](function(_0x12b0bf){var _0x37507e=_0x390db6[_0xd81b('0x5e')][_0xd81b('0x58')]({'plain':!![]});if(!_0x37507e)throw new Error(_0xd81b('0x5f'));if(_0x37507e[_0xd81b('0x60')]==='user'){var _0x3fcd8c=_0x12b0bf[_0xd81b('0x58')]({'plain':!![]});var _0x35c9cf=_0xd81b('0x61');return db[_0xd81b('0x62')][_0xd81b('0x57')]({'where':{'name':_0x35c9cf,'userProfileId':_0x37507e[_0xd81b('0x63')]},'raw':!![]})['then'](function(_0x14b187){if(_0x14b187&&_0x14b187[_0xd81b('0x64')]===0x0){return db[_0xd81b('0x35')][_0xd81b('0x5d')]({'name':_0x3fcd8c[_0xd81b('0x36')],'resourceId':_0x3fcd8c['id'],'type':_0x14b187[_0xd81b('0x36')],'sectionId':_0x14b187['id']},{})[_0xd81b('0x1e')](function(){return _0x12b0bf;});}else{return _0x12b0bf;}})[_0xd81b('0x53')](function(_0x8fa8cd){logger[_0xd81b('0x25')](_0xd81b('0x65'),_0x8fa8cd);throw _0x8fa8cd;});}return _0x12b0bf;});}})[_0xd81b('0x1e')](respondWithResult(_0x3c2a9f,0xc9))['catch'](handleError(_0x3c2a9f,null));};exports[_0xd81b('0x5d')]=function(_0x5358a6,_0x2e7141,_0x6fa974){var _0x414f40;return db[_0xd81b('0x38')][_0xd81b('0x5d')](_0x5358a6[_0xd81b('0x5c')],{'raw':!![]})[_0xd81b('0x1e')](function(_0x18f2ac){_0x414f40=_0x18f2ac;return db[_0xd81b('0x38')][_0xd81b('0x51')]({'raw':!![]});})['then'](function(_0xfa2a13){var _0x344c32=fs[_0xd81b('0x66')](path[_0xd81b('0x67')](config[_0xd81b('0x68')],'server/files/templates/trunk.ejs'),'utf8');var _0x3274d2=fs[_0xd81b('0x66')](path[_0xd81b('0x67')](config[_0xd81b('0x68')],_0xd81b('0x69')),_0xd81b('0x6a'));var _0xaee7e3=ejs['render'](_0x344c32,{'trunks':_0xfa2a13||[]});fs[_0xd81b('0x6b')](_0xd81b('0x6c'),_0xaee7e3);if(_0x414f40[_0xd81b('0x6d')]){var _0x1c6ec8=ejs[_0xd81b('0x6e')](_0x3274d2,{'trunks':_0xfa2a13||[]});fs[_0xd81b('0x6b')](_0xd81b('0x6f'),_0x1c6ec8);}})[_0xd81b('0x1e')](function(){return respondWithRpcPromise(_0xd81b('0x70'),'create',{'module':_0xd81b('0x71')});})[_0xd81b('0x1e')](function(){var _0x3858eb=_0x5358a6[_0xd81b('0x5e')][_0xd81b('0x58')]({'plain':!![]});if(!_0x3858eb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3858eb[_0xd81b('0x60')]===_0xd81b('0x5e')){var _0x4cc440=_0x414f40[_0xd81b('0x58')]({'plain':!![]});return db[_0xd81b('0x62')]['find']({'where':{'name':_0xd81b('0x61'),'userProfileId':_0x3858eb[_0xd81b('0x63')]},'raw':!![]})[_0xd81b('0x1e')](function(_0x483026){if(_0x483026&&_0x483026[_0xd81b('0x64')]===0x0){return db[_0xd81b('0x35')][_0xd81b('0x5d')]({'name':_0x4cc440['name'],'resourceId':_0x4cc440['id'],'type':_0x483026['name'],'sectionId':_0x483026['id']},{})[_0xd81b('0x1e')](function(){return _0x414f40;});}else{return _0x414f40;}})[_0xd81b('0x53')](function(_0x36c694){logger['error'](_0xd81b('0x65'),_0x36c694);throw _0x36c694;});}return _0x414f40;})[_0xd81b('0x1e')](respondWithResult(_0x2e7141,0xc9))[_0xd81b('0x53')](handleError(_0x2e7141,null));};exports[_0xd81b('0x72')]=function(_0x524196,_0x4f69a7,_0x42ae01){var _0x256696;return db[_0xd81b('0x38')][_0xd81b('0x57')]({'where':{'id':_0x524196['params']['id']}})[_0xd81b('0x1e')](handleEntityNotFound(_0x4f69a7,null))[_0xd81b('0x1e')](saveUpdates(_0x524196['body'],null))[_0xd81b('0x1e')](function(_0x4e5bf4){if(_0x4e5bf4){_0x256696=_0x4e5bf4;return db[_0xd81b('0x38')][_0xd81b('0x51')]({'raw':!![]});}})['then'](function(_0x1be0e6){if(_0x1be0e6){var _0x9a9634=fs[_0xd81b('0x66')](path[_0xd81b('0x67')](config[_0xd81b('0x68')],'server/files/templates/trunk.ejs'),_0xd81b('0x6a'));var _0xc0e137=fs[_0xd81b('0x66')](path[_0xd81b('0x67')](config[_0xd81b('0x68')],_0xd81b('0x69')),'utf8');var _0x5c8ea0=ejs[_0xd81b('0x6e')](_0x9a9634,{'trunks':_0x1be0e6||[]});fs[_0xd81b('0x6b')](_0xd81b('0x6c'),_0x5c8ea0);var _0x15aed5=ejs['render'](_0xc0e137,{'trunks':_0x1be0e6||[]});fs[_0xd81b('0x6b')](_0xd81b('0x6f'),_0x15aed5);return respondWithRpcPromise(_0xd81b('0x70'),_0xd81b('0x72'),{'module':_0xd81b('0x71')});}return null;})['then'](function(_0x3744bf){if(_0x3744bf){return _0x256696;}})[_0xd81b('0x1e')](respondWithResult(_0x4f69a7,null))[_0xd81b('0x53')](handleError(_0x4f69a7,null));};exports[_0xd81b('0x34')]=function(_0x1d596c,_0x288124,_0x402eb9){var _0x57179a;return db[_0xd81b('0x38')][_0xd81b('0x57')]({'where':{'id':_0x1d596c[_0xd81b('0x55')]['id']}})[_0xd81b('0x1e')](handleEntityNotFound(_0x288124,null))[_0xd81b('0x1e')](removeEntity(_0x288124,null))[_0xd81b('0x1e')](function(){return db['Trunk'][_0xd81b('0x51')]({'raw':!![]});})['then'](function(_0x11e590){var _0x9e6e05=fs[_0xd81b('0x66')](path['join'](config[_0xd81b('0x68')],_0xd81b('0x73')),_0xd81b('0x6a'));var _0x5060dc=fs[_0xd81b('0x66')](path[_0xd81b('0x67')](config['root'],_0xd81b('0x69')),'utf8');var _0x5f5514=ejs[_0xd81b('0x6e')](_0x9e6e05,{'trunks':_0x11e590});var _0x428317=ejs[_0xd81b('0x6e')](_0x5060dc,{'trunks':_0x11e590});fs['writeFileSync'](_0xd81b('0x6c'),_0x5f5514);fs[_0xd81b('0x6b')](_0xd81b('0x6f'),_0x428317);return respondWithRpcPromise(_0xd81b('0x70'),_0xd81b('0x34'),{'module':_0xd81b('0x71')});})['catch'](handleError(_0x288124,null));}; \ No newline at end of file +var _0xb821=['model','map','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','Trunk','includeAll','findAll','intersection','length','include','find','params','get','omit','createdAt','updatedAt','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','server/files/templates/trunk.ejs','utf8','join','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','UserProfileSection','root','rimraf','zip-dir','moment','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','stringify','code','Trunk,\x20%s,\x20%s','error','message','info','result','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','Trunks','name','send','index','rawAttributes','fieldName','key'];(function(_0x428860,_0xdd7647){var _0x12ba92=function(_0x392972){while(--_0x392972){_0x428860['push'](_0x428860['shift']());}};_0x12ba92(++_0xdd7647);}(_0xb821,0xa7));var _0x1b82=function(_0x5dbe6f,_0x356228){_0x5dbe6f=_0x5dbe6f-0x0;var _0x3ebffe=_0xb821[_0x5dbe6f];return _0x3ebffe;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1b82('0x0'));var zipdir=require(_0x1b82('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1b82('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1b82('0x3'));var path=require(_0x1b82('0x4'));var sox=require(_0x1b82('0x5'));var csv=require(_0x1b82('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1b82('0x7'));var _=require(_0x1b82('0x8'));var squel=require(_0x1b82('0x9'));var crypto=require(_0x1b82('0xa'));var jsforce=require(_0x1b82('0xb'));var deskjs=require(_0x1b82('0xc'));var toCsv=require(_0x1b82('0x6'));var querystring=require(_0x1b82('0xd'));var Papa=require(_0x1b82('0xe'));var Redis=require('ioredis');var authService=require(_0x1b82('0xf'));var qs=require(_0x1b82('0x10'));var as=require(_0x1b82('0x11'));var hardwareService=require(_0x1b82('0x12'));var logger=require(_0x1b82('0x13'))(_0x1b82('0x14'));var utils=require(_0x1b82('0x15'));var config=require(_0x1b82('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x1b82('0x17'))['db'];var jayson=require(_0x1b82('0x18'));var client=jayson[_0x1b82('0x19')][_0x1b82('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x50aed7,_0x1a6285,_0x5767aa,_0x54915f){return new BPromise(function(_0x1e553a,_0x4bf75b){var _0x1cffd1=_0x54915f||client;return _0x1cffd1[_0x1b82('0x1b')](_0x50aed7,_0x5767aa)['then'](function(_0x46c2cf){logger['info']('Trunk,\x20%s,\x20%s',_0x1a6285,_0x1b82('0x1c'));logger['debug'](_0x1b82('0x1d'),_0x1a6285,_0x1b82('0x1c'),JSON[_0x1b82('0x1e')](_0x46c2cf));if(_0x46c2cf['error']){if(_0x46c2cf['error'][_0x1b82('0x1f')]===0x1f4){logger['error'](_0x1b82('0x20'),_0x1a6285,_0x46c2cf[_0x1b82('0x21')][_0x1b82('0x22')]);return _0x4bf75b(_0x46c2cf['error'][_0x1b82('0x22')]);}logger[_0x1b82('0x21')](_0x1b82('0x20'),_0x1a6285,_0x46c2cf[_0x1b82('0x21')][_0x1b82('0x22')]);return _0x1e553a(_0x46c2cf['error'][_0x1b82('0x22')]);}else{logger[_0x1b82('0x23')](_0x1b82('0x20'),_0x1a6285,_0x1b82('0x1c'));_0x1e553a(_0x46c2cf[_0x1b82('0x24')][_0x1b82('0x22')]);}})[_0x1b82('0x25')](function(_0x486e92){logger[_0x1b82('0x21')](_0x1b82('0x20'),_0x1a6285,_0x486e92);_0x4bf75b(_0x486e92);});});}function respondWithStatusCode(_0x5b8d09,_0x561d78){_0x561d78=_0x561d78||0xcc;return function(_0x225b81){if(_0x225b81){return _0x5b8d09[_0x1b82('0x26')](_0x561d78);}return _0x5b8d09['status'](_0x561d78)[_0x1b82('0x27')]();};}function respondWithResult(_0x4db690,_0x5cd458){_0x5cd458=_0x5cd458||0xc8;return function(_0x5f556b){if(_0x5f556b){return _0x4db690[_0x1b82('0x28')](_0x5cd458)[_0x1b82('0x29')](_0x5f556b);}};}function respondWithFilteredResult(_0xfd00d1,_0x257b79){return function(_0x548a3b){if(_0x548a3b){var _0x222483=typeof _0x257b79[_0x1b82('0x2a')]===_0x1b82('0x2b')&&typeof _0x257b79[_0x1b82('0x2c')]===_0x1b82('0x2b');var _0x1b8b6f=_0x548a3b[_0x1b82('0x2d')];var _0x21ea34=_0x222483?0x0:_0x257b79[_0x1b82('0x2a')];var _0x1f9c6b=_0x222483?_0x548a3b[_0x1b82('0x2d')]:_0x257b79[_0x1b82('0x2a')]+_0x257b79[_0x1b82('0x2c')];var _0x5ea890;if(_0x1f9c6b>=_0x1b8b6f){_0x1f9c6b=_0x1b8b6f;_0x5ea890=0xc8;}else{_0x5ea890=0xce;}_0xfd00d1[_0x1b82('0x28')](_0x5ea890);return _0xfd00d1[_0x1b82('0x2e')](_0x1b82('0x2f'),_0x21ea34+'-'+_0x1f9c6b+'/'+_0x1b8b6f)[_0x1b82('0x29')](_0x548a3b);}return null;};}function patchUpdates(_0x18e4ff){return function(_0x115ce7){try{jsonpatch[_0x1b82('0x30')](_0x115ce7,_0x18e4ff,!![]);}catch(_0x46575f){return BPromise[_0x1b82('0x31')](_0x46575f);}return _0x115ce7[_0x1b82('0x32')]();};}function saveUpdates(_0x501ab0,_0x225c06){return function(_0x29a31e){if(_0x29a31e){return _0x29a31e[_0x1b82('0x33')](_0x501ab0)[_0x1b82('0x34')](function(_0x5b7b18){return _0x5b7b18;});}return null;};}function removeEntity(_0x474218,_0xbf65a){return function(_0x544bd5){if(_0x544bd5){return _0x544bd5[_0x1b82('0x35')]()[_0x1b82('0x34')](function(){var _0x365c3c=_0x544bd5['get']({'plain':!![]});var _0x5efb8e=_0x1b82('0x36');return db['UserProfileResource']['destroy']({'where':{'type':_0x5efb8e,'resourceId':_0x365c3c['id']}})[_0x1b82('0x34')](function(){return _0x544bd5;});})[_0x1b82('0x34')](function(){_0x474218[_0x1b82('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x42a64e,_0x366db3){return function(_0xea774a){if(!_0xea774a){_0x42a64e[_0x1b82('0x26')](0x194);}return _0xea774a;};}function handleError(_0x4dd64a,_0x42c1c4){_0x42c1c4=_0x42c1c4||0x1f4;return function(_0x1cd7de){logger[_0x1b82('0x21')](_0x1cd7de['stack']);if(_0x1cd7de['name']){delete _0x1cd7de[_0x1b82('0x37')];}_0x4dd64a['status'](_0x42c1c4)[_0x1b82('0x38')](_0x1cd7de);};}exports[_0x1b82('0x39')]=function(_0x286b4b,_0x348880){var _0x1255db={},_0x3ab35c={},_0x39fe4a={'count':0x0,'rows':[]};var _0x1368df=_['map'](db['Trunk'][_0x1b82('0x3a')],function(_0x5f4baf){return{'name':_0x5f4baf[_0x1b82('0x3b')],'type':_0x5f4baf['type'][_0x1b82('0x3c')]};});_0x3ab35c[_0x1b82('0x3d')]=_[_0x1b82('0x3e')](_0x1368df,_0x1b82('0x37'));_0x3ab35c[_0x1b82('0x3f')]=_[_0x1b82('0x40')](_0x286b4b['query']);_0x3ab35c[_0x1b82('0x41')]=_['intersection'](_0x3ab35c[_0x1b82('0x3d')],_0x3ab35c['query']);_0x1255db[_0x1b82('0x42')]=_['intersection'](_0x3ab35c['model'],qs[_0x1b82('0x43')](_0x286b4b[_0x1b82('0x3f')][_0x1b82('0x43')]));_0x1255db[_0x1b82('0x42')]=_0x1255db[_0x1b82('0x42')]['length']?_0x1255db[_0x1b82('0x42')]:_0x3ab35c['model'];if(!_0x286b4b[_0x1b82('0x3f')][_0x1b82('0x44')](_0x1b82('0x45'))){_0x1255db[_0x1b82('0x2c')]=qs[_0x1b82('0x2c')](_0x286b4b['query'][_0x1b82('0x2c')]);_0x1255db['offset']=qs[_0x1b82('0x2a')](_0x286b4b[_0x1b82('0x3f')]['offset']);}_0x1255db[_0x1b82('0x46')]=qs[_0x1b82('0x47')](_0x286b4b[_0x1b82('0x3f')][_0x1b82('0x47')]);_0x1255db[_0x1b82('0x48')]=qs[_0x1b82('0x41')](_[_0x1b82('0x49')](_0x286b4b['query'],_0x3ab35c[_0x1b82('0x41')]),_0x1368df);if(_0x286b4b['query'][_0x1b82('0x4a')]){_0x1255db[_0x1b82('0x48')]=_[_0x1b82('0x4b')](_0x1255db[_0x1b82('0x48')],{'$or':_[_0x1b82('0x3e')](_0x1368df,function(_0x1d24d6){if(_0x1d24d6[_0x1b82('0x4c')]!==_0x1b82('0x4d')){var _0x192ce3={};_0x192ce3[_0x1d24d6[_0x1b82('0x37')]]={'$like':'%'+_0x286b4b[_0x1b82('0x3f')][_0x1b82('0x4a')]+'%'};return _0x192ce3;}})});}_0x1255db=_[_0x1b82('0x4b')]({},_0x1255db,_0x286b4b[_0x1b82('0x4e')]);var _0x4fb92f={'where':_0x1255db['where']};return db[_0x1b82('0x4f')]['count'](_0x4fb92f)[_0x1b82('0x34')](function(_0x3df0af){_0x39fe4a[_0x1b82('0x2d')]=_0x3df0af;if(_0x286b4b['query'][_0x1b82('0x50')]){_0x1255db['include']=[{'all':!![]}];}return db['Trunk'][_0x1b82('0x51')](_0x1255db);})[_0x1b82('0x34')](function(_0x242324){_0x39fe4a['rows']=_0x242324;return _0x39fe4a;})[_0x1b82('0x34')](respondWithFilteredResult(_0x348880,_0x1255db))[_0x1b82('0x25')](handleError(_0x348880,null));};exports['show']=function(_0x5ca898,_0x106282){var _0x2e676a={'raw':![],'where':{'id':_0x5ca898['params']['id']}},_0x2dc53e={};_0x2dc53e[_0x1b82('0x3d')]=_[_0x1b82('0x40')](db[_0x1b82('0x4f')][_0x1b82('0x3a')]);_0x2dc53e[_0x1b82('0x3f')]=_[_0x1b82('0x40')](_0x5ca898['query']);_0x2dc53e[_0x1b82('0x41')]=_['intersection'](_0x2dc53e[_0x1b82('0x3d')],_0x2dc53e[_0x1b82('0x3f')]);_0x2e676a['attributes']=_[_0x1b82('0x52')](_0x2dc53e['model'],qs[_0x1b82('0x43')](_0x5ca898[_0x1b82('0x3f')][_0x1b82('0x43')]));_0x2e676a[_0x1b82('0x42')]=_0x2e676a[_0x1b82('0x42')][_0x1b82('0x53')]?_0x2e676a['attributes']:_0x2dc53e['model'];if(_0x5ca898[_0x1b82('0x3f')][_0x1b82('0x50')]){_0x2e676a[_0x1b82('0x54')]=[{'all':!![]}];}_0x2e676a=_[_0x1b82('0x4b')]({},_0x2e676a,_0x5ca898[_0x1b82('0x4e')]);return db[_0x1b82('0x4f')][_0x1b82('0x55')](_0x2e676a)[_0x1b82('0x34')](handleEntityNotFound(_0x106282,null))['then'](respondWithResult(_0x106282,null))['catch'](handleError(_0x106282,null));};exports['clone']=function(_0x2658b5,_0x2a95d2){var _0x207f1c={'where':{'id':_0x2658b5[_0x1b82('0x56')]['id']}},_0x27ad80={};_0x27ad80[_0x1b82('0x3d')]=_[_0x1b82('0x40')](db['Trunk'][_0x1b82('0x3a')]);_0x207f1c[_0x1b82('0x42')]=_[_0x1b82('0x52')](_0x27ad80[_0x1b82('0x3d')],qs[_0x1b82('0x43')](_0x2658b5[_0x1b82('0x3f')][_0x1b82('0x43')]));_0x207f1c[_0x1b82('0x42')]=_0x207f1c['attributes'][_0x1b82('0x53')]?_0x207f1c[_0x1b82('0x42')]:_0x27ad80[_0x1b82('0x3d')];if(_0x2658b5[_0x1b82('0x3f')][_0x1b82('0x50')]){_0x207f1c['include']=[{'all':!![]}];}_0x207f1c=_['merge']({},_0x207f1c,_0x2658b5[_0x1b82('0x4e')]);return db[_0x1b82('0x4f')][_0x1b82('0x55')](_0x207f1c)[_0x1b82('0x34')](handleEntityNotFound(_0x2a95d2,null))['then'](function(_0x170905){if(_0x170905){var _0x352603=_0x170905[_0x1b82('0x57')]({'plain':!![]});_0x352603=qs[_0x1b82('0x58')](_0x352603,['id',_0x1b82('0x59'),_0x1b82('0x5a')]);_0x2658b5[_0x1b82('0x5b')]=_[_0x1b82('0x58')](_0x2658b5[_0x1b82('0x5b')],['id',_0x1b82('0x59'),'updatedAt']);return db[_0x1b82('0x4f')][_0x1b82('0x5c')](_['merge'](_0x352603,_0x2658b5[_0x1b82('0x5b')]),{'include':_0x2658b5[_0x1b82('0x3f')][_0x1b82('0x50')]?[{'all':!![]}]:undefined})[_0x1b82('0x34')](function(_0x4b26c4){var _0x30f13a=_0x2658b5[_0x1b82('0x5d')][_0x1b82('0x57')]({'plain':!![]});if(!_0x30f13a)throw new Error(_0x1b82('0x5e'));if(_0x30f13a[_0x1b82('0x5f')]===_0x1b82('0x5d')){var _0x4e8fa2=_0x4b26c4[_0x1b82('0x57')]({'plain':!![]});var _0x5267c3=_0x1b82('0x36');return db['UserProfileSection'][_0x1b82('0x55')]({'where':{'name':_0x5267c3,'userProfileId':_0x30f13a[_0x1b82('0x60')]},'raw':!![]})[_0x1b82('0x34')](function(_0x2db0fe){if(_0x2db0fe&&_0x2db0fe[_0x1b82('0x61')]===0x0){return db[_0x1b82('0x62')][_0x1b82('0x5c')]({'name':_0x4e8fa2['name'],'resourceId':_0x4e8fa2['id'],'type':_0x2db0fe[_0x1b82('0x37')],'sectionId':_0x2db0fe['id']},{})[_0x1b82('0x34')](function(){return _0x4b26c4;});}else{return _0x4b26c4;}})[_0x1b82('0x25')](function(_0x2de10c){logger[_0x1b82('0x21')](_0x1b82('0x63'),_0x2de10c);throw _0x2de10c;});}return _0x4b26c4;});}})[_0x1b82('0x34')](respondWithResult(_0x2a95d2,0xc9))[_0x1b82('0x25')](handleError(_0x2a95d2,null));};exports[_0x1b82('0x5c')]=function(_0x3f7690,_0x1873de,_0xe31cbc){var _0x1ef92c;return db['Trunk'][_0x1b82('0x5c')](_0x3f7690[_0x1b82('0x5b')],{'raw':!![]})[_0x1b82('0x34')](function(_0x4a229e){_0x1ef92c=_0x4a229e;return db[_0x1b82('0x4f')][_0x1b82('0x51')]({'raw':!![]});})['then'](function(_0x3bf106){var _0x5cc386=fs[_0x1b82('0x64')](path['join'](config['root'],_0x1b82('0x65')),_0x1b82('0x66'));var _0x3b4088=fs[_0x1b82('0x64')](path[_0x1b82('0x67')](config['root'],_0x1b82('0x68')),'utf8');var _0x143689=ejs[_0x1b82('0x69')](_0x5cc386,{'trunks':_0x3bf106||[]});fs[_0x1b82('0x6a')](_0x1b82('0x6b'),_0x143689);if(_0x1ef92c[_0x1b82('0x6c')]){var _0x29c42e=ejs[_0x1b82('0x69')](_0x3b4088,{'trunks':_0x3bf106||[]});fs[_0x1b82('0x6a')](_0x1b82('0x6d'),_0x29c42e);}})[_0x1b82('0x34')](function(){return respondWithRpcPromise(_0x1b82('0x6e'),'create',{'module':_0x1b82('0x6f')});})['then'](function(){var _0x4c2e52=_0x3f7690[_0x1b82('0x5d')][_0x1b82('0x57')]({'plain':!![]});if(!_0x4c2e52)throw new Error(_0x1b82('0x5e'));if(_0x4c2e52[_0x1b82('0x5f')]===_0x1b82('0x5d')){var _0x1dd3a1=_0x1ef92c[_0x1b82('0x57')]({'plain':!![]});return db[_0x1b82('0x70')][_0x1b82('0x55')]({'where':{'name':_0x1b82('0x36'),'userProfileId':_0x4c2e52['userProfileId']},'raw':!![]})[_0x1b82('0x34')](function(_0x4d496b){if(_0x4d496b&&_0x4d496b[_0x1b82('0x61')]===0x0){return db['UserProfileResource'][_0x1b82('0x5c')]({'name':_0x1dd3a1[_0x1b82('0x37')],'resourceId':_0x1dd3a1['id'],'type':_0x4d496b[_0x1b82('0x37')],'sectionId':_0x4d496b['id']},{})[_0x1b82('0x34')](function(){return _0x1ef92c;});}else{return _0x1ef92c;}})[_0x1b82('0x25')](function(_0x49a202){logger[_0x1b82('0x21')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x49a202);throw _0x49a202;});}return _0x1ef92c;})['then'](respondWithResult(_0x1873de,0xc9))[_0x1b82('0x25')](handleError(_0x1873de,null));};exports[_0x1b82('0x33')]=function(_0x1a4826,_0x4d986c,_0x2e9191){var _0x52f16e;return db[_0x1b82('0x4f')]['find']({'where':{'id':_0x1a4826[_0x1b82('0x56')]['id']}})[_0x1b82('0x34')](handleEntityNotFound(_0x4d986c,null))[_0x1b82('0x34')](saveUpdates(_0x1a4826[_0x1b82('0x5b')],null))['then'](function(_0x46cae4){if(_0x46cae4){_0x52f16e=_0x46cae4;return db['Trunk'][_0x1b82('0x51')]({'raw':!![]});}})[_0x1b82('0x34')](function(_0x1095fb){if(_0x1095fb){var _0x185fce=fs[_0x1b82('0x64')](path['join'](config[_0x1b82('0x71')],'server/files/templates/trunk.ejs'),_0x1b82('0x66'));var _0x5ce247=fs[_0x1b82('0x64')](path[_0x1b82('0x67')](config[_0x1b82('0x71')],'server/files/templates/registry.ejs'),_0x1b82('0x66'));var _0x31a56e=ejs[_0x1b82('0x69')](_0x185fce,{'trunks':_0x1095fb||[]});fs['writeFileSync'](_0x1b82('0x6b'),_0x31a56e);var _0x396272=ejs[_0x1b82('0x69')](_0x5ce247,{'trunks':_0x1095fb||[]});fs[_0x1b82('0x6a')](_0x1b82('0x6d'),_0x396272);return respondWithRpcPromise('Reload',_0x1b82('0x33'),{'module':'chan_sip.so'});}return null;})['then'](function(_0x2759ac){if(_0x2759ac){return _0x52f16e;}})['then'](respondWithResult(_0x4d986c,null))[_0x1b82('0x25')](handleError(_0x4d986c,null));};exports[_0x1b82('0x35')]=function(_0x5f349f,_0x3e17b0,_0x391207){var _0x553ac5;return db['Trunk']['find']({'where':{'id':_0x5f349f['params']['id']}})[_0x1b82('0x34')](handleEntityNotFound(_0x3e17b0,null))[_0x1b82('0x34')](removeEntity(_0x3e17b0,null))[_0x1b82('0x34')](function(){return db['Trunk'][_0x1b82('0x51')]({'raw':!![]});})['then'](function(_0x7d95b6){var _0x372c3b=fs[_0x1b82('0x64')](path[_0x1b82('0x67')](config['root'],_0x1b82('0x65')),_0x1b82('0x66'));var _0x14510c=fs[_0x1b82('0x64')](path[_0x1b82('0x67')](config[_0x1b82('0x71')],_0x1b82('0x68')),'utf8');var _0x58e180=ejs[_0x1b82('0x69')](_0x372c3b,{'trunks':_0x7d95b6});var _0x531d3f=ejs['render'](_0x14510c,{'trunks':_0x7d95b6});fs[_0x1b82('0x6a')](_0x1b82('0x6b'),_0x58e180);fs[_0x1b82('0x6a')]('/etc/asterisk/sip_xcally_registers.conf',_0x531d3f);return respondWithRpcPromise(_0x1b82('0x6e'),'destroy',{'module':_0x1b82('0x6f')});})[_0x1b82('0x25')](handleError(_0x3e17b0,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index c9168b9..a6174b5 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 _0x9cf5=['path','../../config/environment','Trunk','lodash','util','api','moment','bluebird','request-promise'];(function(_0x2867d8,_0xef3ee0){var _0x3b8176=function(_0x2b9eb8){while(--_0x2b9eb8){_0x2867d8['push'](_0x2867d8['shift']());}};_0x3b8176(++_0xef3ee0);}(_0x9cf5,0xdb));var _0x59cf=function(_0x549249,_0x28b734){_0x549249=_0x549249-0x0;var _0x362895=_0x9cf5[_0x549249];return _0x362895;};'use strict';var _=require(_0x59cf('0x0'));var util=require(_0x59cf('0x1'));var logger=require('../../config/logger')(_0x59cf('0x2'));var moment=require(_0x59cf('0x3'));var BPromise=require(_0x59cf('0x4'));var rp=require(_0x59cf('0x5'));var fs=require('fs');var path=require(_0x59cf('0x6'));var rimraf=require('rimraf');var config=require(_0x59cf('0x7'));var attributes=require('./trunk.attributes');module['exports']=function(_0xbf7c0c,_0x439f7e){return _0xbf7c0c['define'](_0x59cf('0x8'),attributes,{'tableName':'tools_trunks','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9dd7=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./trunk.attributes','define','lodash','util'];(function(_0x118733,_0x2bd820){var _0x4777af=function(_0x52886a){while(--_0x52886a){_0x118733['push'](_0x118733['shift']());}};_0x4777af(++_0x2bd820);}(_0x9dd7,0x15e));var _0x79dd=function(_0x34f02e,_0x45e49d){_0x34f02e=_0x34f02e-0x0;var _0x215674=_0x9dd7[_0x34f02e];return _0x215674;};'use strict';var _=require(_0x79dd('0x0'));var util=require(_0x79dd('0x1'));var logger=require(_0x79dd('0x2'))(_0x79dd('0x3'));var moment=require(_0x79dd('0x4'));var BPromise=require(_0x79dd('0x5'));var rp=require(_0x79dd('0x6'));var fs=require('fs');var path=require(_0x79dd('0x7'));var rimraf=require(_0x79dd('0x8'));var config=require('../../config/environment');var attributes=require(_0x79dd('0x9'));module['exports']=function(_0x1b6d6d,_0x21ee89){return _0x1b6d6d[_0x79dd('0xa')]('Trunk',attributes,{'tableName':'tools_trunks','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 e78d8be..e581d79 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 _0x58fe=['message','result','catch','findAll','options','raw','where','limit','include','map','attributes','model','GetTrunk','debug','ShowTrunk','find','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x5c4837,_0xcfc79c){var _0x572e2c=function(_0x3f061c){while(--_0x3f061c){_0x5c4837['push'](_0x5c4837['shift']());}};_0x572e2c(++_0xcfc79c);}(_0x58fe,0xdc));var _0xe58f=function(_0x21f931,_0x598b2d){_0x21f931=_0x21f931-0x0;var _0x3f083c=_0x58fe[_0x21f931];return _0x3f083c;};'use strict';var _=require('lodash');var util=require(_0xe58f('0x0'));var moment=require(_0xe58f('0x1'));var BPromise=require(_0xe58f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe58f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xe58f('0x4'));var logger=require(_0xe58f('0x5'))(_0xe58f('0x6'));var config=require(_0xe58f('0x7'));var jayson=require(_0xe58f('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x264b1a,_0x4dda92,_0x113ebf){return new BPromise(function(_0x3b8589,_0x3ac153){return client[_0xe58f('0x9')](_0x264b1a,_0x113ebf)[_0xe58f('0xa')](function(_0x3aabeb){logger[_0xe58f('0xb')](_0xe58f('0xc'),_0x4dda92,_0xe58f('0xd'));logger['debug'](_0xe58f('0xe'),_0x4dda92,_0xe58f('0xd'),JSON[_0xe58f('0xf')](_0x3aabeb));if(_0x3aabeb[_0xe58f('0x10')]){if(_0x3aabeb[_0xe58f('0x10')][_0xe58f('0x11')]===0x1f4){logger['error']('Trunk,\x20%s,\x20%s',_0x4dda92,_0x3aabeb['error'][_0xe58f('0x12')]);return _0x3ac153(_0x3aabeb[_0xe58f('0x10')][_0xe58f('0x12')]);}logger[_0xe58f('0x10')](_0xe58f('0xc'),_0x4dda92,_0x3aabeb[_0xe58f('0x10')]['message']);return _0x3b8589(_0x3aabeb[_0xe58f('0x10')][_0xe58f('0x12')]);}else{logger['info'](_0xe58f('0xc'),_0x4dda92,'request\x20sent');_0x3b8589(_0x3aabeb[_0xe58f('0x13')][_0xe58f('0x12')]);}})[_0xe58f('0x14')](function(_0x5c3e77){logger['error'](_0xe58f('0xc'),_0x4dda92,_0x5c3e77);_0x3ac153(_0x5c3e77);});});}exports['GetTrunk']=function(_0x9041ab){var _0x386bb9=this;return new Promise(function(_0x31a71e,_0x4c46ee){return db['Trunk'][_0xe58f('0x15')]({'raw':_0x9041ab[_0xe58f('0x16')]?_0x9041ab[_0xe58f('0x16')][_0xe58f('0x17')]===undefined?!![]:![]:!![],'where':_0x9041ab['options']?_0x9041ab['options'][_0xe58f('0x18')]||null:null,'attributes':_0x9041ab[_0xe58f('0x16')]?_0x9041ab['options']['attributes']||null:null,'limit':_0x9041ab[_0xe58f('0x16')]?_0x9041ab[_0xe58f('0x16')][_0xe58f('0x19')]||null:null,'include':_0x9041ab['options']?_0x9041ab['options'][_0xe58f('0x1a')]?_[_0xe58f('0x1b')](_0x9041ab[_0xe58f('0x16')]['include'],function(_0x26b3ff){return{'model':db[_0x26b3ff['model']],'as':_0x26b3ff['as'],'attributes':_0x26b3ff[_0xe58f('0x1c')],'include':_0x26b3ff[_0xe58f('0x1a')]?_['map'](_0x26b3ff['include'],function(_0x3b0fc3){return{'model':db[_0x3b0fc3['model']],'as':_0x3b0fc3['as'],'attributes':_0x3b0fc3[_0xe58f('0x1c')],'include':_0x3b0fc3['include']?_[_0xe58f('0x1b')](_0x3b0fc3[_0xe58f('0x1a')],function(_0x2a610c){return{'model':db[_0x2a610c[_0xe58f('0x1d')]],'as':_0x2a610c['as'],'attributes':_0x2a610c[_0xe58f('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xe58f('0xa')](function(_0x24151c){logger[_0xe58f('0xb')](_0xe58f('0x1e'),_0x9041ab);logger[_0xe58f('0x1f')]('GetTrunk',_0x9041ab,JSON[_0xe58f('0xf')](_0x24151c));_0x31a71e(_0x24151c);})[_0xe58f('0x14')](function(_0x1716d7){logger[_0xe58f('0x10')](_0xe58f('0x1e'),_0x1716d7[_0xe58f('0x12')],_0x9041ab);_0x4c46ee(_0x386bb9['error'](0x1f4,_0x1716d7['message']));});});};exports[_0xe58f('0x20')]=function(_0x1d2cfc){var _0x3b47d0=this;return new Promise(function(_0x1dbde1,_0x2ea36f){return db['Trunk'][_0xe58f('0x21')]({'raw':_0x1d2cfc[_0xe58f('0x16')]?_0x1d2cfc['options'][_0xe58f('0x17')]===undefined?!![]:![]:!![],'where':_0x1d2cfc[_0xe58f('0x16')]?_0x1d2cfc['options']['where']||null:null,'attributes':_0x1d2cfc[_0xe58f('0x16')]?_0x1d2cfc[_0xe58f('0x16')][_0xe58f('0x1c')]||null:null,'include':_0x1d2cfc[_0xe58f('0x16')]?_0x1d2cfc[_0xe58f('0x16')][_0xe58f('0x1a')]?_[_0xe58f('0x1b')](_0x1d2cfc[_0xe58f('0x16')][_0xe58f('0x1a')],function(_0x1d5a1c){return{'model':db[_0x1d5a1c['model']],'as':_0x1d5a1c['as'],'attributes':_0x1d5a1c[_0xe58f('0x1c')],'include':_0x1d5a1c[_0xe58f('0x1a')]?_[_0xe58f('0x1b')](_0x1d5a1c[_0xe58f('0x1a')],function(_0x51c14c){return{'model':db[_0x51c14c['model']],'as':_0x51c14c['as'],'attributes':_0x51c14c[_0xe58f('0x1c')],'include':_0x51c14c[_0xe58f('0x1a')]?_[_0xe58f('0x1b')](_0x51c14c[_0xe58f('0x1a')],function(_0x182927){return{'model':db[_0x182927[_0xe58f('0x1d')]],'as':_0x182927['as'],'attributes':_0x182927[_0xe58f('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xe58f('0xa')](function(_0xe68bb0){logger[_0xe58f('0xb')]('ShowTrunk',_0x1d2cfc);logger[_0xe58f('0x1f')](_0xe58f('0x20'),_0x1d2cfc,JSON[_0xe58f('0xf')](_0xe68bb0));_0x1dbde1(_0xe68bb0);})[_0xe58f('0x14')](function(_0x2312d7){logger[_0xe58f('0x10')]('ShowTrunk',_0x2312d7[_0xe58f('0x12')],_0x1d2cfc);_0x2ea36f(_0x3b47d0[_0xe58f('0x10')](0x1f4,_0x2312d7['message']));});});}; \ No newline at end of file +var _0x758e=['request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','Trunk','options','raw','include','map','model','attributes','GetTrunk','find','where','debug','ShowTrunk','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s'];(function(_0x36fbef,_0x4ffc84){var _0x45e270=function(_0x32dd95){while(--_0x32dd95){_0x36fbef['push'](_0x36fbef['shift']());}};_0x45e270(++_0x4ffc84);}(_0x758e,0x194));var _0xe758=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x758e[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0xe758('0x0'));var util=require(_0xe758('0x1'));var moment=require(_0xe758('0x2'));var BPromise=require(_0xe758('0x3'));var rs=require(_0xe758('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe758('0x5'));var logger=require(_0xe758('0x6'))(_0xe758('0x7'));var config=require(_0xe758('0x8'));var jayson=require(_0xe758('0x9'));var client=jayson[_0xe758('0xa')][_0xe758('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x427288,_0x240c0f,_0x37c458){return new BPromise(function(_0x9d8a26,_0x3e4d31){return client[_0xe758('0xc')](_0x427288,_0x37c458)[_0xe758('0xd')](function(_0x345e87){logger[_0xe758('0xe')](_0xe758('0xf'),_0x240c0f,_0xe758('0x10'));logger['debug'](_0xe758('0x11'),_0x240c0f,_0xe758('0x10'),JSON[_0xe758('0x12')](_0x345e87));if(_0x345e87[_0xe758('0x13')]){if(_0x345e87['error'][_0xe758('0x14')]===0x1f4){logger[_0xe758('0x13')](_0xe758('0xf'),_0x240c0f,_0x345e87[_0xe758('0x13')][_0xe758('0x15')]);return _0x3e4d31(_0x345e87['error'][_0xe758('0x15')]);}logger['error'](_0xe758('0xf'),_0x240c0f,_0x345e87[_0xe758('0x13')][_0xe758('0x15')]);return _0x9d8a26(_0x345e87['error'][_0xe758('0x15')]);}else{logger[_0xe758('0xe')](_0xe758('0xf'),_0x240c0f,_0xe758('0x10'));_0x9d8a26(_0x345e87['result'][_0xe758('0x15')]);}})[_0xe758('0x16')](function(_0x10cff4){logger['error'](_0xe758('0xf'),_0x240c0f,_0x10cff4);_0x3e4d31(_0x10cff4);});});}exports['GetTrunk']=function(_0x57a4fd){var _0x44572a=this;return new Promise(function(_0x46e89b,_0x2356c9){return db[_0xe758('0x17')]['findAll']({'raw':_0x57a4fd[_0xe758('0x18')]?_0x57a4fd[_0xe758('0x18')][_0xe758('0x19')]===undefined?!![]:![]:!![],'where':_0x57a4fd['options']?_0x57a4fd[_0xe758('0x18')]['where']||null:null,'attributes':_0x57a4fd[_0xe758('0x18')]?_0x57a4fd[_0xe758('0x18')]['attributes']||null:null,'limit':_0x57a4fd[_0xe758('0x18')]?_0x57a4fd['options']['limit']||null:null,'include':_0x57a4fd[_0xe758('0x18')]?_0x57a4fd[_0xe758('0x18')][_0xe758('0x1a')]?_[_0xe758('0x1b')](_0x57a4fd['options'][_0xe758('0x1a')],function(_0x49f9c6){return{'model':db[_0x49f9c6[_0xe758('0x1c')]],'as':_0x49f9c6['as'],'attributes':_0x49f9c6[_0xe758('0x1d')],'include':_0x49f9c6[_0xe758('0x1a')]?_[_0xe758('0x1b')](_0x49f9c6['include'],function(_0xcaa7c4){return{'model':db[_0xcaa7c4['model']],'as':_0xcaa7c4['as'],'attributes':_0xcaa7c4['attributes'],'include':_0xcaa7c4[_0xe758('0x1a')]?_[_0xe758('0x1b')](_0xcaa7c4['include'],function(_0x4b015f){return{'model':db[_0x4b015f['model']],'as':_0x4b015f['as'],'attributes':_0x4b015f[_0xe758('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xf60998){logger['info'](_0xe758('0x1e'),_0x57a4fd);logger['debug']('GetTrunk',_0x57a4fd,JSON[_0xe758('0x12')](_0xf60998));_0x46e89b(_0xf60998);})[_0xe758('0x16')](function(_0x1547e9){logger[_0xe758('0x13')]('GetTrunk',_0x1547e9[_0xe758('0x15')],_0x57a4fd);_0x2356c9(_0x44572a[_0xe758('0x13')](0x1f4,_0x1547e9['message']));});});};exports['ShowTrunk']=function(_0x386d04){var _0x46c628=this;return new Promise(function(_0x3c7b00,_0x3eea51){return db['Trunk'][_0xe758('0x1f')]({'raw':_0x386d04[_0xe758('0x18')]?_0x386d04[_0xe758('0x18')][_0xe758('0x19')]===undefined?!![]:![]:!![],'where':_0x386d04[_0xe758('0x18')]?_0x386d04[_0xe758('0x18')][_0xe758('0x20')]||null:null,'attributes':_0x386d04[_0xe758('0x18')]?_0x386d04[_0xe758('0x18')]['attributes']||null:null,'include':_0x386d04[_0xe758('0x18')]?_0x386d04['options'][_0xe758('0x1a')]?_[_0xe758('0x1b')](_0x386d04[_0xe758('0x18')][_0xe758('0x1a')],function(_0xa33c11){return{'model':db[_0xa33c11[_0xe758('0x1c')]],'as':_0xa33c11['as'],'attributes':_0xa33c11['attributes'],'include':_0xa33c11['include']?_[_0xe758('0x1b')](_0xa33c11[_0xe758('0x1a')],function(_0x2e92dc){return{'model':db[_0x2e92dc[_0xe758('0x1c')]],'as':_0x2e92dc['as'],'attributes':_0x2e92dc[_0xe758('0x1d')],'include':_0x2e92dc[_0xe758('0x1a')]?_[_0xe758('0x1b')](_0x2e92dc[_0xe758('0x1a')],function(_0x3869c6){return{'model':db[_0x3869c6[_0xe758('0x1c')]],'as':_0x3869c6['as'],'attributes':_0x3869c6[_0xe758('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xe758('0xd')](function(_0x2ebdd8){logger[_0xe758('0xe')]('ShowTrunk',_0x386d04);logger[_0xe758('0x21')](_0xe758('0x22'),_0x386d04,JSON['stringify'](_0x2ebdd8));_0x3c7b00(_0x2ebdd8);})[_0xe758('0x16')](function(_0x1323d2){logger[_0xe758('0x13')](_0xe758('0x22'),_0x1323d2['message'],_0x386d04);_0x3eea51(_0x46c628['error'](0x1f4,_0x1323d2[_0xe758('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index fc56c54..ebcb749 100644 --- a/server/api/user-setting/index.js +++ b/server/api/user-setting/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x15ec=['Router','../../components/auth/service','./user-setting.controller','put','/:id','isAuthenticated','update','express'];(function(_0x31659b,_0x3f07a1){var _0x48b140=function(_0x3b295c){while(--_0x3b295c){_0x31659b['push'](_0x31659b['shift']());}};_0x48b140(++_0x3f07a1);}(_0x15ec,0xe7));var _0xc15e=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x15ec[_0xb0f7c3];return _0x28ea68;};'use strict';var express=require(_0xc15e('0x0'));var router=express[_0xc15e('0x1')]();var auth=require(_0xc15e('0x2'));var controller=require(_0xc15e('0x3'));router[_0xc15e('0x4')](_0xc15e('0x5'),auth[_0xc15e('0x6')](),controller[_0xc15e('0x7')]);module['exports']=router; \ No newline at end of file +var _0x4542=['express','../../components/auth/service','./user-setting.controller','put','/:id','update'];(function(_0xe3919f,_0x28f960){var _0x2a0d70=function(_0x66917c){while(--_0x66917c){_0xe3919f['push'](_0xe3919f['shift']());}};_0x2a0d70(++_0x28f960);}(_0x4542,0x96));var _0x2454=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0x4542[_0x263a74];return _0x2aa86c;};'use strict';var express=require(_0x2454('0x0'));var router=express['Router']();var auth=require(_0x2454('0x1'));var controller=require(_0x2454('0x2'));router[_0x2454('0x3')](_0x2454('0x4'),auth['isAuthenticated'](),controller[_0x2454('0x5')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.attributes.js b/server/api/user-setting/user-setting.attributes.js index 1670fcc..ba7cd38 100644 --- a/server/api/user-setting/user-setting.attributes.js +++ b/server/api/user-setting/user-setting.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa746=['warning','info','exports','ENUM','BOOLEAN','TEXT','DATE','sequelize','error'];(function(_0x2673c1,_0x489c00){var _0x46bde=function(_0x3c7b08){while(--_0x3c7b08){_0x2673c1['push'](_0x2673c1['shift']());}};_0x46bde(++_0x489c00);}(_0xa746,0x1db));var _0x6a74=function(_0x3515d2,_0x2bd954){_0x3515d2=_0x3515d2-0x0;var _0x3935d5=_0xa746[_0x3515d2];return _0x3935d5;};'use strict';var Sequelize=require(_0x6a74('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0x6a74('0x1'),_0x6a74('0x2'),_0x6a74('0x3'),'debug'];module[_0x6a74('0x4')]={'clientSideLoggingLevel':{'type':Sequelize[_0x6a74('0x5')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x6a74('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x6a74('0x6')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x6a74('0x7')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x6a74('0x8')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize['INTEGER'],'unique':'UserId'}}; \ No newline at end of file +var _0x0851=['debug','ENUM','BOOLEAN','TEXT','INTEGER','UserId','error','warning','info'];(function(_0x54ffd6,_0x35e14d){var _0x1d75a8=function(_0xf4b988){while(--_0xf4b988){_0x54ffd6['push'](_0x54ffd6['shift']());}};_0x1d75a8(++_0x35e14d);}(_0x0851,0x72));var _0x1085=function(_0x3775ee,_0x1cf833){_0x3775ee=_0x3775ee-0x0;var _0xe2b4fc=_0x0851[_0x3775ee];return _0xe2b4fc;};'use strict';var Sequelize=require('sequelize');const CLIENT_SIDE_LOG_LEVELS=[_0x1085('0x0'),_0x1085('0x1'),_0x1085('0x2'),_0x1085('0x3')];module['exports']={'clientSideLoggingLevel':{'type':Sequelize[_0x1085('0x4')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x1085('0x0'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x1085('0x5')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x1085('0x6')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x1085('0x7')],'unique':_0x1085('0x8')}}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.controller.js b/server/api/user-setting/user-setting.controller.js index bca1243..6576aae 100644 --- a/server/api/user-setting/user-setting.controller.js +++ b/server/api/user-setting/user-setting.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x340c=['socket.io-emitter','redis','./user-setting.socket','defaults','localhost','json','update','then','stack','name','status','send','user','role','admin','params','Invalid\x20user\x20setting\x20id','UserSetting','find','body','catch','lodash','ioredis','../../config/logger','api','../../mysqldb'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0x340c,0xe5));var _0xc340=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x340c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc340('0x0'));var Redis=require(_0xc340('0x1'));var logger=require(_0xc340('0x2'))(_0xc340('0x3'));var config=require('../../config/environment');var db=require(_0xc340('0x4'))['db'];var socket=require(_0xc340('0x5'))(new Redis(config[_0xc340('0x6')]));require(_0xc340('0x7'))['register'](socket);config[_0xc340('0x6')]=_[_0xc340('0x8')](config[_0xc340('0x6')],{'host':_0xc340('0x9'),'port':0x18eb});function respondWithResult(_0x35b8e6,_0x4c3a04){_0x4c3a04=_0x4c3a04||0xc8;return function(_0x4c33db){if(_0x4c33db){return _0x35b8e6['status'](_0x4c3a04)[_0xc340('0xa')](_0x4c33db);}};}function saveUpdates(_0x43e43f){return function(_0x5346b9){if(_0x5346b9){return _0x5346b9[_0xc340('0xb')](_0x43e43f)[_0xc340('0xc')](function(_0x1b79e4){return _0x1b79e4;});}return null;};}function handleEntityNotFound(_0x2edcf7){return function(_0x1f43c6){if(!_0x1f43c6){_0x2edcf7['sendStatus'](0x194);}return _0x1f43c6;};}function handleError(_0x3a8922,_0x16cab0){_0x16cab0=_0x16cab0||0x1f4;return function(_0x131e43){logger['error'](_0x131e43[_0xc340('0xd')]);if(_0x131e43[_0xc340('0xe')]){delete _0x131e43[_0xc340('0xe')];}_0x3a8922[_0xc340('0xf')](_0x16cab0)[_0xc340('0x10')](_0x131e43);};}exports['update']=function(_0x13c360,_0x7c70c8){if(_0x13c360[_0xc340('0x11')][_0xc340('0x12')]!==_0xc340('0x13'))throw new Error('Unauthorized');if(isNaN(Number(_0x13c360[_0xc340('0x14')]['id'])))throw new Error(_0xc340('0x15'));return db[_0xc340('0x16')][_0xc340('0x17')]({'where':{'id':_0x13c360[_0xc340('0x14')]['id']}})['then'](handleEntityNotFound(_0x7c70c8,null))[_0xc340('0xc')](saveUpdates(_0x13c360[_0xc340('0x18')],null))[_0xc340('0xc')](respondWithResult(_0x7c70c8,null))[_0xc340('0x19')](handleError(_0x7c70c8,null));}; \ No newline at end of file +var _0x668b=['./user-setting.socket','register','redis','localhost','status','update','then','sendStatus','error','stack','name','send','user','role','admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','find','lodash','ioredis','api','../../config/environment','socket.io-emitter'];(function(_0x57df46,_0x4ccd4e){var _0x40f49d=function(_0x5c4542){while(--_0x5c4542){_0x57df46['push'](_0x57df46['shift']());}};_0x40f49d(++_0x4ccd4e);}(_0x668b,0x140));var _0xb668=function(_0x4207f4,_0x1f778b){_0x4207f4=_0x4207f4-0x0;var _0x29a621=_0x668b[_0x4207f4];return _0x29a621;};'use strict';var _=require(_0xb668('0x0'));var Redis=require(_0xb668('0x1'));var logger=require('../../config/logger')(_0xb668('0x2'));var config=require(_0xb668('0x3'));var db=require('../../mysqldb')['db'];var socket=require(_0xb668('0x4'))(new Redis(config['redis']));require(_0xb668('0x5'))[_0xb668('0x6')](socket);config[_0xb668('0x7')]=_['defaults'](config[_0xb668('0x7')],{'host':_0xb668('0x8'),'port':0x18eb});function respondWithResult(_0x3be92e,_0x2778e9){_0x2778e9=_0x2778e9||0xc8;return function(_0x20b749){if(_0x20b749){return _0x3be92e[_0xb668('0x9')](_0x2778e9)['json'](_0x20b749);}};}function saveUpdates(_0x11bb5e){return function(_0xb850f0){if(_0xb850f0){return _0xb850f0[_0xb668('0xa')](_0x11bb5e)[_0xb668('0xb')](function(_0x39b79c){return _0x39b79c;});}return null;};}function handleEntityNotFound(_0x3606a7){return function(_0x45bc39){if(!_0x45bc39){_0x3606a7[_0xb668('0xc')](0x194);}return _0x45bc39;};}function handleError(_0x567ea9,_0x3b15a6){_0x3b15a6=_0x3b15a6||0x1f4;return function(_0x27dbf7){logger[_0xb668('0xd')](_0x27dbf7[_0xb668('0xe')]);if(_0x27dbf7[_0xb668('0xf')]){delete _0x27dbf7[_0xb668('0xf')];}_0x567ea9[_0xb668('0x9')](_0x3b15a6)[_0xb668('0x10')](_0x27dbf7);};}exports[_0xb668('0xa')]=function(_0x25c5c5,_0x1af935){if(_0x25c5c5[_0xb668('0x11')][_0xb668('0x12')]!==_0xb668('0x13'))throw new Error(_0xb668('0x14'));if(isNaN(Number(_0x25c5c5[_0xb668('0x15')]['id'])))throw new Error(_0xb668('0x16'));return db[_0xb668('0x17')][_0xb668('0x18')]({'where':{'id':_0x25c5c5[_0xb668('0x15')]['id']}})[_0xb668('0xb')](handleEntityNotFound(_0x1af935,null))[_0xb668('0xb')](saveUpdates(_0x25c5c5['body'],null))[_0xb668('0xb')](respondWithResult(_0x1af935,null))['catch'](handleError(_0x1af935,null));}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.events.js b/server/api/user-setting/user-setting.events.js index cbee8b7..3640692 100644 --- a/server/api/user-setting/user-setting.events.js +++ b/server/api/user-setting/user-setting.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc99f=['setMaxListeners','update','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x2eec47,_0x2bf704){var _0x21ef26=function(_0x555e3f){while(--_0x555e3f){_0x2eec47['push'](_0x2eec47['shift']());}};_0x21ef26(++_0x2bf704);}(_0xc99f,0x16b));var _0xfc99=function(_0x4c49c0,_0x4adb76){_0x4c49c0=_0x4c49c0-0x0;var _0x596b70=_0xc99f[_0x4c49c0];return _0x596b70;};'use strict';var EventEmitter=require('events');var UserSetting=require(_0xfc99('0x0'))['db']['UserSetting'];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0xfc99('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xfc99('0x2'),'afterDestroy':'remove'};function emitEvent(_0x1bf304){return function(_0xfbcfcf,_0x2f83d7,_0x270e8d){UserSettingEvents[_0xfc99('0x3')](_0x1bf304+':'+_0xfbcfcf['id'],_0xfbcfcf);UserSettingEvents[_0xfc99('0x3')](_0x1bf304,_0xfbcfcf);_0x270e8d(null);};}for(var e in events){if(events[_0xfc99('0x4')](e)){var event=events[e];UserSetting[_0xfc99('0x5')](e,emitEvent(event));}}module[_0xfc99('0x6')]=UserSettingEvents; \ No newline at end of file +var _0x56b2=['hook','exports','events','UserSetting','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x56b2,0x1ba));var _0x256b=function(_0x2fb8df,_0x16e783){_0x2fb8df=_0x2fb8df-0x0;var _0x55aec7=_0x56b2[_0x2fb8df];return _0x55aec7;};'use strict';var EventEmitter=require(_0x256b('0x0'));var UserSetting=require('../../mysqldb')['db'][_0x256b('0x1')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x256b('0x2')](0x0);var events={'afterCreate':_0x256b('0x3'),'afterUpdate':_0x256b('0x4'),'afterDestroy':_0x256b('0x5')};function emitEvent(_0x13b93b){return function(_0x85fe8,_0x614f2b,_0x49f506){UserSettingEvents['emit'](_0x13b93b+':'+_0x85fe8['id'],_0x85fe8);UserSettingEvents[_0x256b('0x6')](_0x13b93b,_0x85fe8);_0x49f506(null);};}for(var e in events){if(events[_0x256b('0x7')](e)){var event=events[e];UserSetting[_0x256b('0x8')](e,emitEvent(event));}}module[_0x256b('0x9')]=UserSettingEvents; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.model.js b/server/api/user-setting/user-setting.model.js index aa2a6a6..001d8bf 100644 --- a/server/api/user-setting/user-setting.model.js +++ b/server/api/user-setting/user-setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc9c3=['exports','define','clientSideLoggingEnabled','clientSideLoggingEnabledSince'];(function(_0x4111de,_0x2d8454){var _0x30f9f1=function(_0x50d292){while(--_0x50d292){_0x4111de['push'](_0x4111de['shift']());}};_0x30f9f1(++_0x2d8454);}(_0xc9c3,0xd0));var _0x3c9c=function(_0x7fc2c1,_0x4bcabd){_0x7fc2c1=_0x7fc2c1-0x0;var _0x6f2884=_0xc9c3[_0x7fc2c1];return _0x6f2884;};'use strict';var attributes=require('./user-setting.attributes');module[_0x3c9c('0x0')]=function(_0x362cef){return _0x362cef[_0x3c9c('0x1')]('UserSetting',attributes,{'tableName':'user_settings','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2ca714){if(!_0x2ca714[_0x3c9c('0x2')])_0x2ca714['clientSideLoggingEnabledSince']=null;else if(_0x2ca714[_0x3c9c('0x3')]===null)_0x2ca714[_0x3c9c('0x3')]=new Date();}}});}; \ No newline at end of file +var _0xa25c=['clientSideLoggingEnabledSince','exports','define','UserSetting','user_settings','clientSideLoggingEnabled'];(function(_0x3d86cb,_0x296c31){var _0x5793c1=function(_0x252257){while(--_0x252257){_0x3d86cb['push'](_0x3d86cb['shift']());}};_0x5793c1(++_0x296c31);}(_0xa25c,0x13f));var _0xca25=function(_0x326e5e,_0x491c33){_0x326e5e=_0x326e5e-0x0;var _0x4d0fde=_0xa25c[_0x326e5e];return _0x4d0fde;};'use strict';var attributes=require('./user-setting.attributes');module[_0xca25('0x0')]=function(_0x3c0ed9){return _0x3c0ed9[_0xca25('0x1')](_0xca25('0x2'),attributes,{'tableName':_0xca25('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xc361f1){if(!_0xc361f1[_0xca25('0x4')])_0xc361f1[_0xca25('0x5')]=null;else if(_0xc361f1['clientSideLoggingEnabledSince']===null)_0xc361f1[_0xca25('0x5')]=new Date();}}});}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.socket.js b/server/api/user-setting/user-setting.socket.js index 2f568ab..2210455 100644 --- a/server/api/user-setting/user-setting.socket.js +++ b/server/api/user-setting/user-setting.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x650b=['emit','user-setting:update','user-setting:update:user-','register','length','save','remove','update'];(function(_0x573e3a,_0xd9df01){var _0xf26f2d=function(_0x42730b){while(--_0x42730b){_0x573e3a['push'](_0x573e3a['shift']());}};_0xf26f2d(++_0xd9df01);}(_0x650b,0x195));var _0xb650=function(_0x4893b0,_0x2e8249){_0x4893b0=_0x4893b0-0x0;var _0x3cf8e6=_0x650b[_0x4893b0];return _0x3cf8e6;};'use strict';var UserSettingEvents=require('./user-setting.events');var events=[_0xb650('0x0'),_0xb650('0x1'),_0xb650('0x2')];function createListener(_0x26d951,_0x48e39c){return function(_0x1a643a){_0x48e39c[_0xb650('0x3')](_0x26d951,_0x1a643a);if(_0x26d951===_0xb650('0x4')){_0x48e39c[_0xb650('0x3')](_0xb650('0x5')+_0x1a643a['UserId'],_0x1a643a);}};}exports[_0xb650('0x6')]=function(_0x22c8d1){for(var _0xa20540=0x0,_0x4fa4c7=events[_0xb650('0x7')];_0xa20540<_0x4fa4c7;_0xa20540++){var _0x4fed1d=events[_0xa20540];var _0x53477f=createListener('user-setting:'+_0x4fed1d,_0x22c8d1);UserSettingEvents['on'](_0x4fed1d,_0x53477f);}}; \ No newline at end of file +var _0xef32=['emit','user-setting:update','register','length','./user-setting.events','save','update'];(function(_0x3c51d4,_0x36ba53){var _0x53c45f=function(_0x3d6683){while(--_0x3d6683){_0x3c51d4['push'](_0x3c51d4['shift']());}};_0x53c45f(++_0x36ba53);}(_0xef32,0x1bd));var _0x2ef3=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xef32[_0x2763f2];return _0x3ef471;};'use strict';var UserSettingEvents=require(_0x2ef3('0x0'));var events=[_0x2ef3('0x1'),'remove',_0x2ef3('0x2')];function createListener(_0x5cd863,_0x1c7143){return function(_0x14edfe){_0x1c7143[_0x2ef3('0x3')](_0x5cd863,_0x14edfe);if(_0x5cd863===_0x2ef3('0x4')){_0x1c7143[_0x2ef3('0x3')]('user-setting:update:user-'+_0x14edfe['UserId'],_0x14edfe);}};}exports[_0x2ef3('0x5')]=function(_0x4db010){for(var _0x597232=0x0,_0x560b37=events[_0x2ef3('0x6')];_0x597232<_0x560b37;_0x597232++){var _0x2e9f11=events[_0x597232];var _0x6f5ba2=createListener('user-setting:'+_0x2e9f11,_0x4db010);UserSettingEvents['on'](_0x2e9f11,_0x6f5ba2);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index d066b29..399b8da 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 _0xb8c9=['pause','/:id/unpause','unpause','/:id/chat_interactions','/:id/mail_interactions','addFaxInteractions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','addWhatsappInteractions','addMailAccounts','addOpenchannelAccounts','/:id/sms_accounts','addSmsAccounts','/:id/chat_websites','addSquareProjects','update','put','/:id/password','changePassword','removeQueues','removeTeams','delete','destroy','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','/:id/whatsapp_interactions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeWhatsappAccounts','removeApiKey','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','index','/describe','describe','/whoami','whoami','getPresence','/:id','show','getAvatar','getOpenTabs','/:id/queues','getQueues','/:id/queues_rt','/:id/groups','getGroups','getRecordings','getScreenRecordings','getChatInteractions','/:id/openchannel/interactions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','/:id/openchannel_accounts','getSmsAccounts','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','addContacts','bulkCreate','addQueues','diskStorage','root','format','%s-%s','now','originalname','/:id/avatar','addAvatar','/:id/login','login','/:id/logout'];(function(_0x66ca61,_0x49453d){var _0xa80806=function(_0x5b3814){while(--_0x5b3814){_0x66ca61['push'](_0x66ca61['shift']());}};_0xa80806(++_0x49453d);}(_0xb8c9,0x95));var _0x9b8c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb8c9[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x9b8c('0x0'));var util=require(_0x9b8c('0x1'));var path=require(_0x9b8c('0x2'));var timeout=require(_0x9b8c('0x3'));var express=require(_0x9b8c('0x4'));var router=express[_0x9b8c('0x5')]();var fs_extra=require(_0x9b8c('0x6'));var auth=require(_0x9b8c('0x7'));var interaction=require(_0x9b8c('0x8'));var config=require(_0x9b8c('0x9'));var controller=require(_0x9b8c('0xa'));router[_0x9b8c('0xb')]('/',auth[_0x9b8c('0xc')](),controller[_0x9b8c('0xd')]);router[_0x9b8c('0xb')](_0x9b8c('0xe'),auth['isAuthenticated'](),controller[_0x9b8c('0xf')]);router[_0x9b8c('0xb')](_0x9b8c('0x10'),auth['isAuthenticated'](),controller[_0x9b8c('0x11')]);router[_0x9b8c('0xb')]('/presence',auth[_0x9b8c('0xc')](),controller[_0x9b8c('0x12')]);router[_0x9b8c('0xb')](_0x9b8c('0x13'),auth['isAuthenticated'](),controller[_0x9b8c('0x14')]);router[_0x9b8c('0xb')]('/:id/avatar',controller[_0x9b8c('0x15')]);router['get']('/:id/open_tabs',auth['isAuthenticated'](),controller[_0x9b8c('0x16')]);router[_0x9b8c('0xb')]('/:id/contacts',auth[_0x9b8c('0xc')](),controller['getContacts']);router[_0x9b8c('0xb')](_0x9b8c('0x17'),auth[_0x9b8c('0xc')](),controller[_0x9b8c('0x18')]);router[_0x9b8c('0xb')](_0x9b8c('0x19'),auth[_0x9b8c('0xc')](),controller['getVoiceQueuesRt']);router[_0x9b8c('0xb')](_0x9b8c('0x1a'),auth['isAuthenticated'](),controller[_0x9b8c('0x1b')]);router[_0x9b8c('0xb')]('/:id/recordings',auth[_0x9b8c('0xc')](),controller[_0x9b8c('0x1c')]);router[_0x9b8c('0xb')]('/:id/screen_recordings',auth[_0x9b8c('0xc')](),controller[_0x9b8c('0x1d')]);router[_0x9b8c('0xb')]('/:id/chat/interactions',auth[_0x9b8c('0xc')](),controller[_0x9b8c('0x1e')]);router['get'](_0x9b8c('0x1f'),auth[_0x9b8c('0xc')](),controller['getOpenchannelInteractions']);router[_0x9b8c('0xb')](_0x9b8c('0x20'),auth[_0x9b8c('0xc')](),controller[_0x9b8c('0x21')]);router['get'](_0x9b8c('0x22'),auth[_0x9b8c('0xc')](),controller['getSmsInteractions']);router[_0x9b8c('0xb')](_0x9b8c('0x23'),auth['isAuthenticated'](),controller[_0x9b8c('0x24')]);router['get'](_0x9b8c('0x25'),auth['isAuthenticated'](),controller[_0x9b8c('0x26')]);router[_0x9b8c('0xb')](_0x9b8c('0x27'),auth[_0x9b8c('0xc')](),controller['getTeams']);router['get'](_0x9b8c('0x28'),auth[_0x9b8c('0xc')](),controller[_0x9b8c('0x29')]);router[_0x9b8c('0xb')](_0x9b8c('0x2a'),auth[_0x9b8c('0xc')](),controller[_0x9b8c('0x2b')]);router[_0x9b8c('0xb')](_0x9b8c('0x2c'),auth[_0x9b8c('0xc')](),controller['getVoicePrefixes']);router[_0x9b8c('0xb')](_0x9b8c('0x2d'),auth[_0x9b8c('0xc')](),controller[_0x9b8c('0x2e')]);router[_0x9b8c('0xb')](_0x9b8c('0x2f'),auth[_0x9b8c('0xc')](),controller['getMailAccounts']);router[_0x9b8c('0xb')](_0x9b8c('0x30'),auth[_0x9b8c('0xc')](),controller['getOpenchannelAccounts']);router['get']('/:id/sms_accounts',auth[_0x9b8c('0xc')](),controller[_0x9b8c('0x31')]);router[_0x9b8c('0xb')]('/:id/chat_websites',auth[_0x9b8c('0xc')](),controller[_0x9b8c('0x32')]);router[_0x9b8c('0xb')](_0x9b8c('0x33'),auth[_0x9b8c('0xc')](),controller[_0x9b8c('0x34')]);router[_0x9b8c('0xb')](_0x9b8c('0x35'),auth[_0x9b8c('0xc')](),controller['getSquareProjects']);router[_0x9b8c('0xb')](_0x9b8c('0x36'),auth[_0x9b8c('0xc')](),controller[_0x9b8c('0x37')]);router[_0x9b8c('0xb')](_0x9b8c('0x38'),auth[_0x9b8c('0xc')](),controller[_0x9b8c('0x39')]);router[_0x9b8c('0x3a')]('/:id/contacts',auth[_0x9b8c('0xc')](),controller[_0x9b8c('0x3b')]);router[_0x9b8c('0x3a')]('/',auth[_0x9b8c('0xc')](),controller['create']);router[_0x9b8c('0x3a')]('/create_many',auth[_0x9b8c('0xc')](),controller[_0x9b8c('0x3c')]);router[_0x9b8c('0x3a')](_0x9b8c('0x17'),auth[_0x9b8c('0xc')](),controller[_0x9b8c('0x3d')]);var upload=multer({'storage':multer[_0x9b8c('0x3e')]({'destination':function(_0x2b208d,_0x5af958,_0x3ba0c2){_0x3ba0c2(null,path['join'](config[_0x9b8c('0x3f')],'server/files/images/'));},'filename':function(_0x3cf9fc,_0x128519,_0x1facfd){_0x1facfd(null,util[_0x9b8c('0x40')](_0x9b8c('0x41'),Date[_0x9b8c('0x42')](),_0x128519[_0x9b8c('0x43')]));}})});router['post'](_0x9b8c('0x44'),upload['single']('file'),controller[_0x9b8c('0x45')]);router[_0x9b8c('0x3a')](_0x9b8c('0x46'),auth[_0x9b8c('0xc')](),controller[_0x9b8c('0x47')]);router[_0x9b8c('0x3a')](_0x9b8c('0x48'),auth[_0x9b8c('0xc')](),controller['logout']);router[_0x9b8c('0x3a')]('/:id/pause',auth['isAuthenticated'](),controller[_0x9b8c('0x49')]);router[_0x9b8c('0x3a')](_0x9b8c('0x4a'),auth['isAuthenticated'](),controller[_0x9b8c('0x4b')]);router[_0x9b8c('0x3a')](_0x9b8c('0x27'),auth['isAuthenticated'](),controller['addTeams']);router[_0x9b8c('0x3a')](_0x9b8c('0x4c'),auth[_0x9b8c('0xc')](),controller['addChatInteractions']);router[_0x9b8c('0x3a')](_0x9b8c('0x4d'),auth[_0x9b8c('0xc')](),controller['addMailInteractions']);router['post']('/:id/fax_interactions',auth[_0x9b8c('0xc')](),controller[_0x9b8c('0x4e')]);router[_0x9b8c('0x3a')]('/:id/sms_interactions',auth[_0x9b8c('0xc')](),controller[_0x9b8c('0x4f')]);router[_0x9b8c('0x3a')](_0x9b8c('0x50'),auth[_0x9b8c('0xc')](),controller[_0x9b8c('0x51')]);router[_0x9b8c('0x3a')]('/:id/whatsapp_interactions',auth['isAuthenticated'](),controller[_0x9b8c('0x52')]);router[_0x9b8c('0x3a')](_0x9b8c('0x2d'),auth[_0x9b8c('0xc')](),controller['addFaxAccounts']);router['post'](_0x9b8c('0x2f'),auth[_0x9b8c('0xc')](),controller[_0x9b8c('0x53')]);router[_0x9b8c('0x3a')](_0x9b8c('0x30'),auth[_0x9b8c('0xc')](),controller[_0x9b8c('0x54')]);router[_0x9b8c('0x3a')](_0x9b8c('0x55'),auth[_0x9b8c('0xc')](),controller[_0x9b8c('0x56')]);router[_0x9b8c('0x3a')](_0x9b8c('0x57'),auth['isAuthenticated'](),controller['addChatWebsites']);router['post'](_0x9b8c('0x33'),auth[_0x9b8c('0xc')](),controller['addWhatsappAccounts']);router[_0x9b8c('0x3a')](_0x9b8c('0x35'),auth[_0x9b8c('0xc')](),controller[_0x9b8c('0x58')]);router[_0x9b8c('0x3a')](_0x9b8c('0x38'),auth[_0x9b8c('0xc')](),controller['createApiKey']);router['put'](_0x9b8c('0x13'),auth[_0x9b8c('0xc')](),controller[_0x9b8c('0x59')]);router[_0x9b8c('0x5a')](_0x9b8c('0x5b'),auth[_0x9b8c('0xc')](),controller[_0x9b8c('0x5c')]);router['delete'](_0x9b8c('0x17'),auth[_0x9b8c('0xc')](),controller[_0x9b8c('0x5d')]);router['delete'](_0x9b8c('0x27'),auth[_0x9b8c('0xc')](),controller[_0x9b8c('0x5e')]);router[_0x9b8c('0x5f')]('/:id',auth['isAuthenticated'](),controller[_0x9b8c('0x60')]);router[_0x9b8c('0x5f')](_0x9b8c('0x4c'),auth[_0x9b8c('0xc')](),controller[_0x9b8c('0x61')]);router['delete'](_0x9b8c('0x4d'),auth[_0x9b8c('0xc')](),controller[_0x9b8c('0x62')]);router[_0x9b8c('0x5f')]('/:id/fax_interactions',auth[_0x9b8c('0xc')](),controller[_0x9b8c('0x63')]);router[_0x9b8c('0x5f')]('/:id/sms_interactions',auth[_0x9b8c('0xc')](),controller[_0x9b8c('0x64')]);router[_0x9b8c('0x5f')](_0x9b8c('0x50'),auth[_0x9b8c('0xc')](),controller[_0x9b8c('0x65')]);router[_0x9b8c('0x5f')](_0x9b8c('0x66'),auth[_0x9b8c('0xc')](),controller[_0x9b8c('0x67')]);router[_0x9b8c('0x5f')](_0x9b8c('0x2d'),auth[_0x9b8c('0xc')](),controller[_0x9b8c('0x68')]);router[_0x9b8c('0x5f')](_0x9b8c('0x2f'),auth[_0x9b8c('0xc')](),controller[_0x9b8c('0x69')]);router['delete'](_0x9b8c('0x30'),auth[_0x9b8c('0xc')](),controller[_0x9b8c('0x6a')]);router['delete'](_0x9b8c('0x55'),auth[_0x9b8c('0xc')](),controller[_0x9b8c('0x6b')]);router['delete'](_0x9b8c('0x57'),auth[_0x9b8c('0xc')](),controller['removeChatWebsites']);router[_0x9b8c('0x5f')]('/:id/whatsapp_accounts',auth[_0x9b8c('0xc')](),controller[_0x9b8c('0x6c')]);router[_0x9b8c('0x5f')](_0x9b8c('0x35'),auth[_0x9b8c('0xc')](),controller['removeSquareProjects']);router[_0x9b8c('0x5f')](_0x9b8c('0x38'),auth['isAuthenticated'](),controller[_0x9b8c('0x6d')]);module[_0x9b8c('0x6e')]=router; \ No newline at end of file +var _0xf689=['%s-%s','originalname','/:id/avatar','single','file','/:id/login','/:id/logout','logout','/:id/pause','pause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','addChatWebsites','createApiKey','put','update','/:id/password','changePassword','removeQueues','delete','removeTeams','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','/:id/openchannel_interactions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','removeApiKey','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','./user.controller','get','isAuthenticated','index','/describe','/whoami','whoami','/presence','getPresence','/:id','show','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','getGroups','getRecordings','/:id/screen_recordings','/:id/chat/interactions','getChatInteractions','getOpenchannelInteractions','/:id/mail/interactions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','/:id/square_projects','getSquareProjects','getScheduledCalls','/:id/api_key','post','addContacts','create','/create_many','bulkCreate','addQueues','diskStorage','join','root','format'];(function(_0x4100cf,_0x317fa2){var _0x332218=function(_0x3d53e3){while(--_0x3d53e3){_0x4100cf['push'](_0x4100cf['shift']());}};_0x332218(++_0x317fa2);}(_0xf689,0xa4));var _0x9f68=function(_0x108b35,_0x208d1e){_0x108b35=_0x108b35-0x0;var _0x30d823=_0xf689[_0x108b35];return _0x30d823;};'use strict';var multer=require(_0x9f68('0x0'));var util=require(_0x9f68('0x1'));var path=require('path');var timeout=require(_0x9f68('0x2'));var express=require(_0x9f68('0x3'));var router=express['Router']();var fs_extra=require(_0x9f68('0x4'));var auth=require(_0x9f68('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9f68('0x6'));router[_0x9f68('0x7')]('/',auth[_0x9f68('0x8')](),controller[_0x9f68('0x9')]);router[_0x9f68('0x7')](_0x9f68('0xa'),auth[_0x9f68('0x8')](),controller['describe']);router[_0x9f68('0x7')](_0x9f68('0xb'),auth[_0x9f68('0x8')](),controller[_0x9f68('0xc')]);router[_0x9f68('0x7')](_0x9f68('0xd'),auth[_0x9f68('0x8')](),controller[_0x9f68('0xe')]);router['get'](_0x9f68('0xf'),auth['isAuthenticated'](),controller[_0x9f68('0x10')]);router[_0x9f68('0x7')]('/:id/avatar',controller['getAvatar']);router[_0x9f68('0x7')](_0x9f68('0x11'),auth['isAuthenticated'](),controller[_0x9f68('0x12')]);router['get'](_0x9f68('0x13'),auth['isAuthenticated'](),controller[_0x9f68('0x14')]);router[_0x9f68('0x7')](_0x9f68('0x15'),auth['isAuthenticated'](),controller[_0x9f68('0x16')]);router[_0x9f68('0x7')](_0x9f68('0x17'),auth['isAuthenticated'](),controller[_0x9f68('0x18')]);router['get']('/:id/groups',auth[_0x9f68('0x8')](),controller[_0x9f68('0x19')]);router['get']('/:id/recordings',auth[_0x9f68('0x8')](),controller[_0x9f68('0x1a')]);router['get'](_0x9f68('0x1b'),auth[_0x9f68('0x8')](),controller['getScreenRecordings']);router['get'](_0x9f68('0x1c'),auth[_0x9f68('0x8')](),controller[_0x9f68('0x1d')]);router[_0x9f68('0x7')]('/:id/openchannel/interactions',auth[_0x9f68('0x8')](),controller[_0x9f68('0x1e')]);router['get'](_0x9f68('0x1f'),auth[_0x9f68('0x8')](),controller['getMailInteractions']);router[_0x9f68('0x7')](_0x9f68('0x20'),auth[_0x9f68('0x8')](),controller[_0x9f68('0x21')]);router[_0x9f68('0x7')](_0x9f68('0x22'),auth['isAuthenticated'](),controller['getFaxInteractions']);router[_0x9f68('0x7')](_0x9f68('0x23'),auth['isAuthenticated'](),controller[_0x9f68('0x24')]);router[_0x9f68('0x7')](_0x9f68('0x25'),auth['isAuthenticated'](),controller[_0x9f68('0x26')]);router['get']('/:id/lists',auth[_0x9f68('0x8')](),controller['getLists']);router[_0x9f68('0x7')](_0x9f68('0x27'),auth[_0x9f68('0x8')](),controller[_0x9f68('0x28')]);router[_0x9f68('0x7')](_0x9f68('0x29'),auth[_0x9f68('0x8')](),controller[_0x9f68('0x2a')]);router['get'](_0x9f68('0x2b'),auth['isAuthenticated'](),controller[_0x9f68('0x2c')]);router[_0x9f68('0x7')](_0x9f68('0x2d'),auth['isAuthenticated'](),controller[_0x9f68('0x2e')]);router[_0x9f68('0x7')](_0x9f68('0x2f'),auth[_0x9f68('0x8')](),controller[_0x9f68('0x30')]);router[_0x9f68('0x7')](_0x9f68('0x31'),auth['isAuthenticated'](),controller[_0x9f68('0x32')]);router['get'](_0x9f68('0x33'),auth['isAuthenticated'](),controller[_0x9f68('0x34')]);router[_0x9f68('0x7')](_0x9f68('0x35'),auth[_0x9f68('0x8')](),controller['getWhatsappAccounts']);router[_0x9f68('0x7')](_0x9f68('0x36'),auth['isAuthenticated'](),controller[_0x9f68('0x37')]);router[_0x9f68('0x7')]('/:id/scheduled_calls',auth[_0x9f68('0x8')](),controller[_0x9f68('0x38')]);router[_0x9f68('0x7')](_0x9f68('0x39'),auth['isAuthenticated'](),controller['getApiKey']);router[_0x9f68('0x3a')]('/:id/contacts',auth[_0x9f68('0x8')](),controller[_0x9f68('0x3b')]);router['post']('/',auth['isAuthenticated'](),controller[_0x9f68('0x3c')]);router[_0x9f68('0x3a')](_0x9f68('0x3d'),auth[_0x9f68('0x8')](),controller[_0x9f68('0x3e')]);router[_0x9f68('0x3a')](_0x9f68('0x15'),auth['isAuthenticated'](),controller[_0x9f68('0x3f')]);var upload=multer({'storage':multer[_0x9f68('0x40')]({'destination':function(_0x2f2f30,_0x275d1a,_0x182cf5){_0x182cf5(null,path[_0x9f68('0x41')](config[_0x9f68('0x42')],'server/files/images/'));},'filename':function(_0x5060b7,_0x159ef0,_0x21527a){_0x21527a(null,util[_0x9f68('0x43')](_0x9f68('0x44'),Date['now'](),_0x159ef0[_0x9f68('0x45')]));}})});router[_0x9f68('0x3a')](_0x9f68('0x46'),upload[_0x9f68('0x47')](_0x9f68('0x48')),controller['addAvatar']);router[_0x9f68('0x3a')](_0x9f68('0x49'),auth[_0x9f68('0x8')](),controller['login']);router['post'](_0x9f68('0x4a'),auth[_0x9f68('0x8')](),controller[_0x9f68('0x4b')]);router['post'](_0x9f68('0x4c'),auth[_0x9f68('0x8')](),controller[_0x9f68('0x4d')]);router['post']('/:id/unpause',auth['isAuthenticated'](),controller['unpause']);router[_0x9f68('0x3a')](_0x9f68('0x25'),auth[_0x9f68('0x8')](),controller[_0x9f68('0x4e')]);router[_0x9f68('0x3a')](_0x9f68('0x4f'),auth[_0x9f68('0x8')](),controller[_0x9f68('0x50')]);router[_0x9f68('0x3a')](_0x9f68('0x51'),auth[_0x9f68('0x8')](),controller[_0x9f68('0x52')]);router[_0x9f68('0x3a')](_0x9f68('0x53'),auth[_0x9f68('0x8')](),controller[_0x9f68('0x54')]);router['post'](_0x9f68('0x55'),auth[_0x9f68('0x8')](),controller[_0x9f68('0x56')]);router['post']('/:id/openchannel_interactions',auth[_0x9f68('0x8')](),controller['addOpenchannelInteractions']);router['post'](_0x9f68('0x57'),auth[_0x9f68('0x8')](),controller[_0x9f68('0x58')]);router[_0x9f68('0x3a')](_0x9f68('0x2b'),auth[_0x9f68('0x8')](),controller[_0x9f68('0x59')]);router[_0x9f68('0x3a')](_0x9f68('0x2d'),auth[_0x9f68('0x8')](),controller[_0x9f68('0x5a')]);router[_0x9f68('0x3a')]('/:id/openchannel_accounts',auth[_0x9f68('0x8')](),controller[_0x9f68('0x5b')]);router[_0x9f68('0x3a')]('/:id/sms_accounts',auth[_0x9f68('0x8')](),controller['addSmsAccounts']);router[_0x9f68('0x3a')](_0x9f68('0x33'),auth[_0x9f68('0x8')](),controller[_0x9f68('0x5c')]);router[_0x9f68('0x3a')](_0x9f68('0x35'),auth[_0x9f68('0x8')](),controller['addWhatsappAccounts']);router[_0x9f68('0x3a')](_0x9f68('0x36'),auth[_0x9f68('0x8')](),controller['addSquareProjects']);router[_0x9f68('0x3a')](_0x9f68('0x39'),auth[_0x9f68('0x8')](),controller[_0x9f68('0x5d')]);router[_0x9f68('0x5e')](_0x9f68('0xf'),auth[_0x9f68('0x8')](),controller[_0x9f68('0x5f')]);router[_0x9f68('0x5e')](_0x9f68('0x60'),auth[_0x9f68('0x8')](),controller[_0x9f68('0x61')]);router['delete'](_0x9f68('0x15'),auth[_0x9f68('0x8')](),controller[_0x9f68('0x62')]);router[_0x9f68('0x63')](_0x9f68('0x25'),auth[_0x9f68('0x8')](),controller[_0x9f68('0x64')]);router[_0x9f68('0x63')](_0x9f68('0xf'),auth['isAuthenticated'](),controller['destroy']);router[_0x9f68('0x63')](_0x9f68('0x4f'),auth[_0x9f68('0x8')](),controller[_0x9f68('0x65')]);router[_0x9f68('0x63')](_0x9f68('0x51'),auth['isAuthenticated'](),controller[_0x9f68('0x66')]);router[_0x9f68('0x63')]('/:id/fax_interactions',auth[_0x9f68('0x8')](),controller[_0x9f68('0x67')]);router['delete'](_0x9f68('0x55'),auth[_0x9f68('0x8')](),controller[_0x9f68('0x68')]);router[_0x9f68('0x63')](_0x9f68('0x69'),auth[_0x9f68('0x8')](),controller[_0x9f68('0x6a')]);router['delete'](_0x9f68('0x57'),auth[_0x9f68('0x8')](),controller[_0x9f68('0x6b')]);router[_0x9f68('0x63')](_0x9f68('0x2b'),auth[_0x9f68('0x8')](),controller[_0x9f68('0x6c')]);router[_0x9f68('0x63')](_0x9f68('0x2d'),auth[_0x9f68('0x8')](),controller[_0x9f68('0x6d')]);router['delete'](_0x9f68('0x2f'),auth[_0x9f68('0x8')](),controller[_0x9f68('0x6e')]);router[_0x9f68('0x63')](_0x9f68('0x31'),auth[_0x9f68('0x8')](),controller['removeSmsAccounts']);router[_0x9f68('0x63')](_0x9f68('0x33'),auth[_0x9f68('0x8')](),controller[_0x9f68('0x6f')]);router[_0x9f68('0x63')](_0x9f68('0x35'),auth[_0x9f68('0x8')](),controller[_0x9f68('0x70')]);router[_0x9f68('0x63')](_0x9f68('0x36'),auth[_0x9f68('0x8')](),controller[_0x9f68('0x71')]);router['delete'](_0x9f68('0x39'),auth[_0x9f68('0x8')](),controller[_0x9f68('0x72')]);module[_0x9f68('0x73')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index b114bb6..89d07b2 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 _0x70e0=['refuse','originate','uac','uas','fingerprint','update,nonat','TEXT','showWebBar','get','isArray','wss','udp','encryption','avpf','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlsprivatekey','rtcp_mux','actpass','dtlscertfile','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','true','false','screenrecording','blocked','blockedAt','loginAttempts','sequelize','moment','util','STRING','name','setDataValue','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','admin','user','agent','telephone','INTEGER','BOOLEAN','DATE','dynamic','friend','peer','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','join','transport','split','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','ulaw;alaw;gsm','allow','insecure','\x22\x22\x20<>','always','accept'];(function(_0x283b78,_0x15a944){var _0x2bec26=function(_0xab7b95){while(--_0xab7b95){_0x283b78['push'](_0x283b78['shift']());}};_0x2bec26(++_0x15a944);}(_0x70e0,0x17b));var _0x070e=function(_0x3dc8ea,_0x553f66){_0x3dc8ea=_0x3dc8ea-0x0;var _0x224f40=_0x70e0[_0x3dc8ea];return _0x224f40;};'use strict';var Sequelize=require(_0x070e('0x0'));var moment=require(_0x070e('0x1'));var util=require(_0x070e('0x2'));var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0x070e('0x3')],'allowNull':![],'unique':_0x070e('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x277d32){this[_0x070e('0x5')]('name',_0x277d32);this[_0x070e('0x5')]('defaultuser',_0x277d32);},'comment':_0x070e('0x6')},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x56e420){this['setDataValue'](_0x070e('0x7'),_0x56e420);this[_0x070e('0x5')](_0x070e('0x8'),util[_0x070e('0x9')](_0x070e('0xa'),_0x56e420,this[_0x070e('0xb')](_0x070e('0xc'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x070e('0xd'),'validate':{'isEmail':!![]},'set':function(_0x2e3e5e){if(_0x2e3e5e){this[_0x070e('0x5')](_0x070e('0xd'),_0x2e3e5e[_0x070e('0xe')]());}}},'role':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x10'),_0x070e('0x11'),_0x070e('0x12'),_0x070e('0x13')),'allowNull':![]},'password':{'type':Sequelize[_0x070e('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':'local'},'internal':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':![],'unique':'internal','set':function(_0x4a33d2){this['setDataValue'](_0x070e('0xc'),_0x4a33d2);this[_0x070e('0x5')]('accountcode',_0x4a33d2);this['setDataValue'](_0x070e('0x8'),util[_0x070e('0x9')](_0x070e('0xa'),this[_0x070e('0xb')]('fullname'),_0x4a33d2));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x070e('0x3')]},'mobile':{'type':Sequelize[_0x070e('0x3')]},'address':{'type':Sequelize[_0x070e('0x3')]},'zipcode':{'type':Sequelize[_0x070e('0x3')]},'userpic':{'type':Sequelize[_0x070e('0x3')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x070e('0x3')]},'online':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x070e('0x16')]},'voicePause':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x070e('0x3')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0x070e('0x16')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x070e('0x14')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x070e('0x17')},'ipaddr':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0x070e('0x14')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x18'),_0x070e('0x11'),_0x070e('0x19')),'allowNull':!![],'defaultValue':_0x070e('0x18')},'context':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x1a'),_0x070e('0x1b'),'ALLOWED_FAILED_SCREEN','ALLOWED',_0x070e('0x1c'),_0x070e('0x1d'),_0x070e('0x1e'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'permit':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'udp','set':function(_0x59c5b4){this[_0x070e('0x5')]('transport',_0x59c5b4?_0x59c5b4[_0x070e('0x1f')](','):null);},'get':function(){return this[_0x070e('0xb')]('transport')?this['getDataValue'](_0x070e('0x20'))[_0x070e('0x21')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize['ENUM'](_0x070e('0x22'),_0x070e('0x23'),_0x070e('0x24'),_0x070e('0x25'),_0x070e('0x26')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no',_0x070e('0x28'),_0x070e('0x29'),_0x070e('0x2a')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x070e('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x070e('0x2b'),'set':function(_0x34746e){this['setDataValue']('nat',_0x34746e?_0x34746e['join'](','):null);},'get':function(){return this[_0x070e('0xb')](_0x070e('0x2c'))?this[_0x070e('0xb')](_0x070e('0x2c'))[_0x070e('0x21')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x070e('0x3')]},'namedcallgroup':{'type':Sequelize[_0x070e('0x3')]},'pickupgroup':{'type':Sequelize[_0x070e('0x3')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x070e('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x070e('0x3')]},'disallow':{'type':Sequelize[_0x070e('0x3')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize[_0x070e('0x3')],'allowNull':![],'defaultValue':_0x070e('0x2d'),'set':function(_0x4800a9){this[_0x070e('0x5')]('allow',_0x4800a9?_0x4800a9[_0x070e('0x1f')](';'):_0x070e('0x2d'));},'get':function(){return this[_0x070e('0xb')](_0x070e('0x2e'))?this[_0x070e('0xb')]('allow')[_0x070e('0x21')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![],'set':function(_0x38879f){this['setDataValue'](_0x070e('0x2f'),_0x38879f?_0x38879f[_0x070e('0x1f')](','):null);},'get':function(){return this[_0x070e('0xb')](_0x070e('0x2f'))?this['getDataValue'](_0x070e('0x2f'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x070e('0xf')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x070e('0x30')},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':_0x070e('0x27')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no',_0x070e('0x31')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x32'),_0x070e('0x33'),_0x070e('0x34')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x35'),'uas'),'allowNull':!![],'defaultValue':_0x070e('0x36')},'t38pt_usertpsource':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':_0x070e('0x27')},'keepalive':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x070e('0xf')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x070e('0xf')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no',_0x070e('0x37'),'certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x070e('0xf')]('active','passive','actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no',_0x070e('0x28'),'update',_0x070e('0x38')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize[_0x070e('0x16')]},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x070e('0x39')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x4cb86f){this['setDataValue'](_0x070e('0x3a'),_0x4cb86f);var _0x1ae5cb=this[_0x070e('0x3b')]({'plain':!![]});switch(_0x4cb86f){case 0x0:case 0x1:var _0x122198=_0x1ae5cb[_0x070e('0x20')]?_[_0x070e('0x3c')](_0x1ae5cb['transport'])?_0x1ae5cb[_0x070e('0x20')]['join']():_0x1ae5cb[_0x070e('0x20')]:'udp';if(_0x122198===_0x070e('0x3d')){_0x122198=_0x070e('0x3e');}this['setDataValue'](_0x070e('0x20'),_0x122198);this['setDataValue'](_0x070e('0x3f'),'no');this[_0x070e('0x5')](_0x070e('0x40'),null);this[_0x070e('0x5')](_0x070e('0x41'),null);this[_0x070e('0x5')](_0x070e('0x42'),null);this[_0x070e('0x5')](_0x070e('0x43'),null);this[_0x070e('0x5')](_0x070e('0x44'),null);this[_0x070e('0x5')](_0x070e('0x45'),null);this[_0x070e('0x5')]('dtlscertfile',null);this[_0x070e('0x5')](_0x070e('0x46'),null);this[_0x070e('0x5')](_0x070e('0x47'),'no');break;case 0x2:this['setDataValue'](_0x070e('0x20'),_0x070e('0x3d'));this[_0x070e('0x5')](_0x070e('0x3f'),_0x070e('0x27'));this[_0x070e('0x5')]('avpf',_0x070e('0x27'));this[_0x070e('0x5')](_0x070e('0x41'),_0x070e('0x27'));this['setDataValue'](_0x070e('0x42'),'yes');this[_0x070e('0x5')](_0x070e('0x43'),_0x070e('0x27'));this[_0x070e('0x5')](_0x070e('0x44'),'no');this['setDataValue'](_0x070e('0x45'),_0x070e('0x48'));this[_0x070e('0x5')](_0x070e('0x49'),_0x1ae5cb['dtlscertfile']||_0x070e('0x4a'));this['setDataValue'](_0x070e('0x46'),_0x1ae5cb[_0x070e('0x46')]||_0x070e('0x4b'));this['setDataValue'](_0x070e('0x47'),'yes');break;default:}}},'permissions':{'type':Sequelize[_0x070e('0x39')],'set':function(_0x5ce157){this[_0x070e('0x5')](_0x070e('0x4c'),_0x5ce157?_0x5ce157['join'](','):[]);},'get':function(){return this[_0x070e('0xb')]('permissions')?_[_0x070e('0x4d')](this[_0x070e('0xb')]('permissions')['split'](','),function(_0x29ee66){return parseInt(_0x29ee66,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x070e('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x070e('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0x070e('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x070e('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x070e('0x4e')],'get':function(){return this[_0x070e('0xb')](_0x070e('0x4f'))?this[_0x070e('0xb')](_0x070e('0x4f')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'interface':{'type':Sequelize[_0x070e('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x4f720f){if(typeof _0x4f720f==='string'){var _0x1624cd=_0x4f720f==='1'?!![]:_0x4f720f==='0'?![]:_0x4f720f===_0x070e('0x50')?!![]:_0x4f720f===_0x070e('0x51')?![]:![];this[_0x070e('0x5')]('screenrecording',_0x1624cd);}else{this[_0x070e('0x5')](_0x070e('0x52'),_0x4f720f);}}},'blocked':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![],'set':function(_0xd74f9c){this[_0x070e('0x5')](_0x070e('0x53'),_0xd74f9c);if(_0xd74f9c===!![]){this['setDataValue'](_0x070e('0x54'),moment());this['setDataValue'](_0x070e('0x55'),0x0);}else{this[_0x070e('0x5')](_0x070e('0x54'),null);}}},'blockedAt':{'type':Sequelize[_0x070e('0x16')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x070e('0x14')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0}}; \ No newline at end of file +var _0x70e0=['refuse','originate','uac','uas','fingerprint','update,nonat','TEXT','showWebBar','get','isArray','wss','udp','encryption','avpf','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlsprivatekey','rtcp_mux','actpass','dtlscertfile','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','true','false','screenrecording','blocked','blockedAt','loginAttempts','sequelize','moment','util','STRING','name','setDataValue','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','admin','user','agent','telephone','INTEGER','BOOLEAN','DATE','dynamic','friend','peer','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','join','transport','split','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','ulaw;alaw;gsm','allow','insecure','\x22\x22\x20<>','always','accept'];(function(_0x8ee8e1,_0x457d7e){var _0x581eeb=function(_0x45a5e4){while(--_0x45a5e4){_0x8ee8e1['push'](_0x8ee8e1['shift']());}};_0x581eeb(++_0x457d7e);}(_0x70e0,0x17b));var _0x070e=function(_0x1009cd,_0x31dfa7){_0x1009cd=_0x1009cd-0x0;var _0x541b0e=_0x70e0[_0x1009cd];return _0x541b0e;};'use strict';var Sequelize=require(_0x070e('0x0'));var moment=require(_0x070e('0x1'));var util=require(_0x070e('0x2'));var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0x070e('0x3')],'allowNull':![],'unique':_0x070e('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x277d32){this[_0x070e('0x5')]('name',_0x277d32);this[_0x070e('0x5')]('defaultuser',_0x277d32);},'comment':_0x070e('0x6')},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x56e420){this['setDataValue'](_0x070e('0x7'),_0x56e420);this[_0x070e('0x5')](_0x070e('0x8'),util[_0x070e('0x9')](_0x070e('0xa'),_0x56e420,this[_0x070e('0xb')](_0x070e('0xc'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x070e('0xd'),'validate':{'isEmail':!![]},'set':function(_0x2e3e5e){if(_0x2e3e5e){this[_0x070e('0x5')](_0x070e('0xd'),_0x2e3e5e[_0x070e('0xe')]());}}},'role':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x10'),_0x070e('0x11'),_0x070e('0x12'),_0x070e('0x13')),'allowNull':![]},'password':{'type':Sequelize[_0x070e('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':'local'},'internal':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':![],'unique':'internal','set':function(_0x4a33d2){this['setDataValue'](_0x070e('0xc'),_0x4a33d2);this[_0x070e('0x5')]('accountcode',_0x4a33d2);this['setDataValue'](_0x070e('0x8'),util[_0x070e('0x9')](_0x070e('0xa'),this[_0x070e('0xb')]('fullname'),_0x4a33d2));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x070e('0x3')]},'mobile':{'type':Sequelize[_0x070e('0x3')]},'address':{'type':Sequelize[_0x070e('0x3')]},'zipcode':{'type':Sequelize[_0x070e('0x3')]},'userpic':{'type':Sequelize[_0x070e('0x3')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x070e('0x3')]},'online':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x070e('0x16')]},'voicePause':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x070e('0x3')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0x070e('0x16')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x070e('0x14')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x070e('0x17')},'ipaddr':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0x070e('0x14')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x18'),_0x070e('0x11'),_0x070e('0x19')),'allowNull':!![],'defaultValue':_0x070e('0x18')},'context':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x1a'),_0x070e('0x1b'),'ALLOWED_FAILED_SCREEN','ALLOWED',_0x070e('0x1c'),_0x070e('0x1d'),_0x070e('0x1e'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'permit':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'udp','set':function(_0x59c5b4){this[_0x070e('0x5')]('transport',_0x59c5b4?_0x59c5b4[_0x070e('0x1f')](','):null);},'get':function(){return this[_0x070e('0xb')]('transport')?this['getDataValue'](_0x070e('0x20'))[_0x070e('0x21')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize['ENUM'](_0x070e('0x22'),_0x070e('0x23'),_0x070e('0x24'),_0x070e('0x25'),_0x070e('0x26')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no',_0x070e('0x28'),_0x070e('0x29'),_0x070e('0x2a')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x070e('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x070e('0x2b'),'set':function(_0x34746e){this['setDataValue']('nat',_0x34746e?_0x34746e['join'](','):null);},'get':function(){return this[_0x070e('0xb')](_0x070e('0x2c'))?this[_0x070e('0xb')](_0x070e('0x2c'))[_0x070e('0x21')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x070e('0x3')]},'namedcallgroup':{'type':Sequelize[_0x070e('0x3')]},'pickupgroup':{'type':Sequelize[_0x070e('0x3')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x070e('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x070e('0x3')]},'disallow':{'type':Sequelize[_0x070e('0x3')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize[_0x070e('0x3')],'allowNull':![],'defaultValue':_0x070e('0x2d'),'set':function(_0x4800a9){this[_0x070e('0x5')]('allow',_0x4800a9?_0x4800a9[_0x070e('0x1f')](';'):_0x070e('0x2d'));},'get':function(){return this[_0x070e('0xb')](_0x070e('0x2e'))?this[_0x070e('0xb')]('allow')[_0x070e('0x21')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![],'set':function(_0x38879f){this['setDataValue'](_0x070e('0x2f'),_0x38879f?_0x38879f[_0x070e('0x1f')](','):null);},'get':function(){return this[_0x070e('0xb')](_0x070e('0x2f'))?this['getDataValue'](_0x070e('0x2f'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x070e('0xf')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x070e('0x30')},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':_0x070e('0x27')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no',_0x070e('0x31')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x32'),_0x070e('0x33'),_0x070e('0x34')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x35'),'uas'),'allowNull':!![],'defaultValue':_0x070e('0x36')},'t38pt_usertpsource':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':_0x070e('0x27')},'keepalive':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x070e('0xf')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x070e('0xf')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no',_0x070e('0x37'),'certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x070e('0xf')]('active','passive','actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x070e('0x14')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x070e('0xf')](_0x070e('0x27'),'no',_0x070e('0x28'),'update',_0x070e('0x38')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize[_0x070e('0x16')]},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x070e('0x39')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x4cb86f){this['setDataValue'](_0x070e('0x3a'),_0x4cb86f);var _0x1ae5cb=this[_0x070e('0x3b')]({'plain':!![]});switch(_0x4cb86f){case 0x0:case 0x1:var _0x122198=_0x1ae5cb[_0x070e('0x20')]?_[_0x070e('0x3c')](_0x1ae5cb['transport'])?_0x1ae5cb[_0x070e('0x20')]['join']():_0x1ae5cb[_0x070e('0x20')]:'udp';if(_0x122198===_0x070e('0x3d')){_0x122198=_0x070e('0x3e');}this['setDataValue'](_0x070e('0x20'),_0x122198);this['setDataValue'](_0x070e('0x3f'),'no');this[_0x070e('0x5')](_0x070e('0x40'),null);this[_0x070e('0x5')](_0x070e('0x41'),null);this[_0x070e('0x5')](_0x070e('0x42'),null);this[_0x070e('0x5')](_0x070e('0x43'),null);this[_0x070e('0x5')](_0x070e('0x44'),null);this[_0x070e('0x5')](_0x070e('0x45'),null);this[_0x070e('0x5')]('dtlscertfile',null);this[_0x070e('0x5')](_0x070e('0x46'),null);this[_0x070e('0x5')](_0x070e('0x47'),'no');break;case 0x2:this['setDataValue'](_0x070e('0x20'),_0x070e('0x3d'));this[_0x070e('0x5')](_0x070e('0x3f'),_0x070e('0x27'));this[_0x070e('0x5')]('avpf',_0x070e('0x27'));this[_0x070e('0x5')](_0x070e('0x41'),_0x070e('0x27'));this['setDataValue'](_0x070e('0x42'),'yes');this[_0x070e('0x5')](_0x070e('0x43'),_0x070e('0x27'));this[_0x070e('0x5')](_0x070e('0x44'),'no');this['setDataValue'](_0x070e('0x45'),_0x070e('0x48'));this[_0x070e('0x5')](_0x070e('0x49'),_0x1ae5cb['dtlscertfile']||_0x070e('0x4a'));this['setDataValue'](_0x070e('0x46'),_0x1ae5cb[_0x070e('0x46')]||_0x070e('0x4b'));this['setDataValue'](_0x070e('0x47'),'yes');break;default:}}},'permissions':{'type':Sequelize[_0x070e('0x39')],'set':function(_0x5ce157){this[_0x070e('0x5')](_0x070e('0x4c'),_0x5ce157?_0x5ce157['join'](','):[]);},'get':function(){return this[_0x070e('0xb')]('permissions')?_[_0x070e('0x4d')](this[_0x070e('0xb')]('permissions')['split'](','),function(_0x29ee66){return parseInt(_0x29ee66,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x070e('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x070e('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0x070e('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x070e('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM'](_0x070e('0x27'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x070e('0x4e')],'get':function(){return this[_0x070e('0xb')](_0x070e('0x4f'))?this[_0x070e('0xb')](_0x070e('0x4f')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'interface':{'type':Sequelize[_0x070e('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x070e('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x4f720f){if(typeof _0x4f720f==='string'){var _0x1624cd=_0x4f720f==='1'?!![]:_0x4f720f==='0'?![]:_0x4f720f===_0x070e('0x50')?!![]:_0x4f720f===_0x070e('0x51')?![]:![];this[_0x070e('0x5')]('screenrecording',_0x1624cd);}else{this[_0x070e('0x5')](_0x070e('0x52'),_0x4f720f);}}},'blocked':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![],'set':function(_0xd74f9c){this[_0x070e('0x5')](_0x070e('0x53'),_0xd74f9c);if(_0xd74f9c===!![]){this['setDataValue'](_0x070e('0x54'),moment());this['setDataValue'](_0x070e('0x55'),0x0);}else{this[_0x070e('0x5')](_0x070e('0x54'),null);}}},'blockedAt':{'type':Sequelize[_0x070e('0x16')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x070e('0x14')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x070e('0x15')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x070e('0x15')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x070e('0x14')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index f767036..cb333d4 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 _0xaf9d=['mailPause','chatPause','faxPause','openchannelPause','smsPause','whatsapppause','pauseType','lastPauseAt','manual','%s%s','Pause','getTeams','Team','addTeams','resolve','Body\x20parameter\x20\x27ids\x27\x20is\x20required','User\x20with\x20id\x20%s\x20not\x20found','transaction','getAssociatedQueues','addAgent','getDataValue','Voice','TeamVoicePrefix','VoicePrefixId','removeTeams','flattenDeep','removeAgent','UserVoicePrefix','CmList','getLists','getAgents','values','send','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','VoicePrefix','getVoicePrefixes','getFaxAccounts','FaxAccount','addFaxAccounts','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','getWhatsappAccounts','addWhatsappAccounts','getSquareProjects','SquareProject','addSquareProjects','removeSquareProjects','getScheduledCalls','$and','$gt','$gte','$ne','$not','$between','$like','$notLike','$overlap','$contained','$any','CmHopper','firstName','lastName','getApiKey','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','removeApiKey','apiKeyIat','API\x20key\x20not\x20available','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','getUserSetting','getPresence','queues','teams','inbound','flatten','lower','col','toString','asc','uniqBy','orderBy','request','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','offline','idle','unknown','ringing','voiceStatus','busy','slice','toUpperCase','select','InteractionId','field','ui.createdAt','user_has_','ui.UserId\x20=\x20?','OpenTabs','moment','bluebird','util','path','lodash','squel','jayson/promise','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/license/util','../../errors/api','APIBadRequestError','APINotFoundError','handleError','../../mysqldb','socket.io-emitter','redis','register','defaults','localhost','client','http','User,\x20%s,\x20%s','request\x20sent','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','then','emit','userNotification:recalc:','destroy','get','role','Users','user','Agents','agent','Telephones','telephone','filter','map','value','includes','name','UserProfileResource','end','stack','index','User','rawAttributes','key','password','salt','query','includeAll','include','UserSetting','userSetting','attributes','push','findAll','true','rows','dataValues','sms','fax','mail','all','show','model','differenceBy','keys','filters','intersection','fields','merge','options','find','openTabs','chat','openchannel','whatsapp','update','body','params','describe','addContacts','ids','omit','internal','Setting','findById','securePassword','max','isNil','min_internal','sequelize','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','SELECT','length','from','voicemail','mailbox','VoiceMail','fullname','email','permissions','101','102','110','104','105','107','108','109','100','111','114','115','create','admin','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','settingsEnabled','userProfileId','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','Unauthorized','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','each','isEmpty','autoAssociation','compact','changePassword','oldPassword','newPassword','Sequelize','ValidationError','authenticate','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','previousPasswords','validatePasswordHistory','updatePasswordsHistory','addQueues','channel','online','loginInPause','voicePause','interface','isValidChannel','Unknown\x20channel','add','capitalize','toLowerCase','penalty','spread','QueueId','voice','VoiceQueue','format','SIP/%s','upsert','removeQueues','remove','Queues','isArray','Queue:remove','UserVoiceQueueRt','addAvatar','userpic','file','filename','getAvatar','root','server/files/images/logos/default_profile.png','download','server/files/images/','join','getOpenTabs','CHAT','FaxOpenTabs','FAX','createdAt','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','SmsOpenTabs','SMS','WhatsappOpenTabs','WHATSAPP','concat','getContacts','CmContact','order','sort','where','pick','hasOwnProperty','List','Tags','color','tag','nolimit','getQueues','Queue','Unknown\x20role','getVoiceQueuesRt','getGroups','ChatGroup','getRecordings','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','SmsInteraction','getSmsInteractions','getFaxInteractions','getWhatsappInteractions','WhatsappInteraction','phone','LOCAL/%s@from-sip/n','intrf','user:%s','x-forwarded-for','connection','remoteAddress','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','MemberReport','YYYY-MM-DD\x20HH:mm:ss','forEach','LOGIN','device','PAUSE','LOGININPAUSE','isMiddleware','logout','pause','QueuePause','updateAttributes','getChannels','type','DEFAULT\x20PAUSE','unpause'];(function(_0x18d631,_0x4376d2){var _0x50d708=function(_0x3b6ab5){while(--_0x3b6ab5){_0x18d631['push'](_0x18d631['shift']());}};_0x50d708(++_0x4376d2);}(_0xaf9d,0x87));var _0xdaf9=function(_0x47c871,_0x335771){_0x47c871=_0x47c871-0x0;var _0x2568d0=_0xaf9d[_0x47c871];return _0x2568d0;};'use strict';var moment=require(_0xdaf9('0x0'));var BPromise=require(_0xdaf9('0x1'));var util=require(_0xdaf9('0x2'));var path=require(_0xdaf9('0x3'));var fs=require('fs');var _=require(_0xdaf9('0x4'));var squel=require(_0xdaf9('0x5'));var jayson=require(_0xdaf9('0x6'));var Redis=require(_0xdaf9('0x7'));var authService=require(_0xdaf9('0x8'));var qs=require('../../components/parsers/qs');var logger=require(_0xdaf9('0x9'))(_0xdaf9('0xa'));var utils=require(_0xdaf9('0xb'));var config=require('../../config/environment');var licenseUtil=require(_0xdaf9('0xc'));var APIBadRequestError=require(_0xdaf9('0xd'))[_0xdaf9('0xe')];var APINotFoundError=require(_0xdaf9('0xd'))[_0xdaf9('0xf')];var APIHandleError=require(_0xdaf9('0xd'))[_0xdaf9('0x10')];var db=require(_0xdaf9('0x11'))['db'];var socket=require(_0xdaf9('0x12'))(new Redis(config[_0xdaf9('0x13')]));require('./user.socket')[_0xdaf9('0x14')](socket);config[_0xdaf9('0x13')]=_[_0xdaf9('0x15')](config[_0xdaf9('0x13')],{'host':_0xdaf9('0x16'),'port':0x18eb});var client=jayson[_0xdaf9('0x17')][_0xdaf9('0x18')]({'port':0x232a});var values;function respondWithRpcPromise(_0x3a0a75,_0x5d253b,_0xb687fd,_0x25b277){return new BPromise(function(_0x4c5b64,_0x3e7536){var _0x2261bf=_0x25b277||client;return _0x2261bf['request'](_0x3a0a75,_0xb687fd)['then'](function(_0x3f3dcb){logger['info'](_0xdaf9('0x19'),_0x5d253b,_0xdaf9('0x1a'));logger['debug'](_0xdaf9('0x1b'),_0x5d253b,_0xdaf9('0x1a'),JSON[_0xdaf9('0x1c')](_0x3f3dcb));if(_0x3f3dcb[_0xdaf9('0x1d')]){if(_0x3f3dcb['error'][_0xdaf9('0x1e')]===0x1f4){logger['error'](_0xdaf9('0x19'),_0x5d253b,_0x3f3dcb[_0xdaf9('0x1d')][_0xdaf9('0x1f')]);return _0x3e7536(_0x3f3dcb[_0xdaf9('0x1d')][_0xdaf9('0x1f')]);}logger['error'](_0xdaf9('0x19'),_0x5d253b,_0x3f3dcb[_0xdaf9('0x1d')][_0xdaf9('0x1f')]);return _0x4c5b64(_0x3f3dcb[_0xdaf9('0x1d')][_0xdaf9('0x1f')]);}else{logger[_0xdaf9('0x20')](_0xdaf9('0x19'),_0x5d253b,_0xdaf9('0x1a'));_0x4c5b64(_0x3f3dcb[_0xdaf9('0x21')][_0xdaf9('0x1f')]);}})[_0xdaf9('0x22')](function(_0x1d3076){logger[_0xdaf9('0x1d')]('User,\x20%s,\x20%s',_0x5d253b,_0x1d3076);_0x3e7536(_0x1d3076);});});}function respondWithStatusCode(_0x2d7cc8,_0x2993d1){_0x2993d1=_0x2993d1||0xcc;return function(_0x24aa12){if(_0x24aa12){return _0x2d7cc8[_0xdaf9('0x23')](_0x2993d1);}return _0x2d7cc8[_0xdaf9('0x24')](_0x2993d1)['end']();};}function respondWithResult(_0x4529ab,_0x58a6e2){_0x58a6e2=_0x58a6e2||0xc8;return function(_0x2d3263){if(_0x2d3263){return _0x4529ab[_0xdaf9('0x24')](_0x58a6e2)[_0xdaf9('0x25')](_0x2d3263);}};}function respondWithFilteredResult(_0x535db5,_0x509aec){return function(_0x308278){if(_0x308278){var _0x19ed4e=typeof _0x509aec[_0xdaf9('0x26')]===_0xdaf9('0x27')&&typeof _0x509aec[_0xdaf9('0x28')]===_0xdaf9('0x27');var _0x52133c=_0x308278[_0xdaf9('0x29')];var _0x5351d4=_0x19ed4e?0x0:_0x509aec[_0xdaf9('0x26')];var _0x2ba768=_0x19ed4e?_0x308278[_0xdaf9('0x29')]:_0x509aec[_0xdaf9('0x26')]+_0x509aec[_0xdaf9('0x28')];var _0x33d665;if(_0x2ba768>=_0x52133c){_0x2ba768=_0x52133c;_0x33d665=0xc8;}else{_0x33d665=0xce;}_0x535db5[_0xdaf9('0x24')](_0x33d665);return _0x535db5[_0xdaf9('0x2a')](_0xdaf9('0x2b'),_0x5351d4+'-'+_0x2ba768+'/'+_0x52133c)[_0xdaf9('0x25')](_0x308278);}return null;};}function saveUpdates(_0x18f489){return function(_0x168f3e){if(_0x168f3e){return _0x168f3e['update'](_0x18f489)[_0xdaf9('0x2c')](function(_0x59590c){socket[_0xdaf9('0x2d')](_0xdaf9('0x2e')+_0x59590c['id'],{});return _0x59590c;});}return null;};}function removeEntity(_0x3cb212){return function(_0x5c3e14){if(_0x5c3e14){return _0x5c3e14[_0xdaf9('0x2f')]()[_0xdaf9('0x2c')](function(){var _0x32b64b=_0x5c3e14[_0xdaf9('0x30')]({'plain':!![]});if(_0x32b64b[_0xdaf9('0x31')]==='admin')return;var _0xfdb753=[{'name':_0xdaf9('0x32'),'value':_0xdaf9('0x33'),'ignore':!![]},{'name':_0xdaf9('0x34'),'value':_0xdaf9('0x35'),'ignore':![]},{'name':_0xdaf9('0x36'),'value':_0xdaf9('0x37'),'ignore':![]}];var _0x32371b=_(_0xfdb753)[_0xdaf9('0x38')]('ignore')[_0xdaf9('0x39')]('value')[_0xdaf9('0x3a')]();if(_[_0xdaf9('0x3b')](_0x32371b,_0x32b64b[_0xdaf9('0x31')])){return;}var _0x3f3f13=_['find'](_0xfdb753,[_0xdaf9('0x3a'),_0x32b64b['role']])[_0xdaf9('0x3c')];return db[_0xdaf9('0x3d')][_0xdaf9('0x2f')]({'where':{'type':_0x3f3f13,'resourceId':_0x32b64b['id']}})[_0xdaf9('0x2c')](function(){return _0x5c3e14;});})['then'](function(){_0x3cb212[_0xdaf9('0x24')](0xcc)[_0xdaf9('0x3e')]();});}};}function handleEntityNotFound(_0x89b926){return function(_0x2e1dd6){if(!_0x2e1dd6){_0x89b926[_0xdaf9('0x23')](0x194);}return _0x2e1dd6;};}function handleError(_0x4a81a5,_0x60bfe5){_0x60bfe5=_0x60bfe5||0x1f4;return function(_0x299288){logger[_0xdaf9('0x1d')](_0x299288[_0xdaf9('0x3f')]);if(_0x299288['name']){delete _0x299288[_0xdaf9('0x3c')];}_0x4a81a5['status'](_0x60bfe5)['send'](_0x299288);};}exports[_0xdaf9('0x40')]=function(_0x3fd34d,_0x3ebaaf){var _0x195b27={},_0x5b400a={'count':0x0,'rows':[]};var _0x154ef2=_(db[_0xdaf9('0x41')][_0xdaf9('0x42')])[_0xdaf9('0x39')](function(_0x33e813){return{'name':_0x33e813['fieldName'],'type':_0x33e813['type'][_0xdaf9('0x43')]};})[_0xdaf9('0x38')](function(_0x23940f){return!_[_0xdaf9('0x3b')]([_0xdaf9('0x44'),_0xdaf9('0x45')],_0x23940f[_0xdaf9('0x3c')]);})['value']();_0x195b27=qs['getOptions'](_0x154ef2,_0x3fd34d);var _0x1e0a51={'where':_0x195b27['where']};return db['User'][_0xdaf9('0x29')](_0x1e0a51)[_0xdaf9('0x2c')](function(_0x454dee){_0x5b400a['count']=_0x454dee;if(_0x3fd34d[_0xdaf9('0x46')][_0xdaf9('0x47')]){_0x195b27[_0xdaf9('0x48')]=[{'all':!![]}];}if(_0x3fd34d['query']['userSetting']==='true'){_0x195b27[_0xdaf9('0x48')]=[{'model':db[_0xdaf9('0x49')],'as':_0xdaf9('0x4a')}];}if(!_[_0xdaf9('0x3b')](_0x195b27[_0xdaf9('0x4b')],'id')){_0x195b27[_0xdaf9('0x4b')][_0xdaf9('0x4c')]('id');}return db[_0xdaf9('0x41')][_0xdaf9('0x4d')](_0x195b27);})[_0xdaf9('0x2c')](function(_0x3e07e9){_0x5b400a['rows']=_0x3e07e9;if(_0x3fd34d[_0xdaf9('0x46')]['openTabs']===_0xdaf9('0x4e')){var _0x41ffa7=[];for(var _0x3b8115=0x0;_0x3b8115<_0x5b400a['rows']['length'];_0x3b8115++){_0x41ffa7[_0xdaf9('0x4c')](get_open_tabs('chat',_0x5b400a[_0xdaf9('0x4f')][_0x3b8115][_0xdaf9('0x50')]));_0x41ffa7[_0xdaf9('0x4c')](get_open_tabs(_0xdaf9('0x51'),_0x5b400a[_0xdaf9('0x4f')][_0x3b8115][_0xdaf9('0x50')]));_0x41ffa7[_0xdaf9('0x4c')](get_open_tabs(_0xdaf9('0x52'),_0x5b400a[_0xdaf9('0x4f')][_0x3b8115][_0xdaf9('0x50')]));_0x41ffa7['push'](get_open_tabs(_0xdaf9('0x53'),_0x5b400a[_0xdaf9('0x4f')][_0x3b8115][_0xdaf9('0x50')]));_0x41ffa7['push'](get_open_tabs('openchannel',_0x5b400a[_0xdaf9('0x4f')][_0x3b8115][_0xdaf9('0x50')]));_0x41ffa7['push'](get_open_tabs('whatsapp',_0x5b400a[_0xdaf9('0x4f')][_0x3b8115][_0xdaf9('0x50')]));}return BPromise[_0xdaf9('0x54')](_0x41ffa7)[_0xdaf9('0x2c')](function(){return _0x5b400a;});}else{return _0x5b400a;}})['then'](respondWithFilteredResult(_0x3ebaaf,_0x195b27))['catch'](handleError(_0x3ebaaf,null));};exports[_0xdaf9('0x55')]=function(_0x25c5eb,_0x360f15){var _0x26873c={'raw':![],'where':{'id':_0x25c5eb['params']['id']}},_0x8fc609={};_0x8fc609[_0xdaf9('0x56')]=_[_0xdaf9('0x57')](_[_0xdaf9('0x58')](db[_0xdaf9('0x41')][_0xdaf9('0x42')]),[_0xdaf9('0x44'),'salt']);_0x8fc609[_0xdaf9('0x46')]=_[_0xdaf9('0x58')](_0x25c5eb[_0xdaf9('0x46')]);_0x8fc609[_0xdaf9('0x59')]=_['intersection'](_0x8fc609[_0xdaf9('0x56')],_0x8fc609[_0xdaf9('0x46')]);_0x26873c[_0xdaf9('0x4b')]=_[_0xdaf9('0x5a')](_0x8fc609[_0xdaf9('0x56')],qs[_0xdaf9('0x5b')](_0x25c5eb[_0xdaf9('0x46')]['fields']));_0x26873c['attributes']=_0x26873c[_0xdaf9('0x4b')]['length']?_0x26873c[_0xdaf9('0x4b')]:_0x8fc609['model'];if(_0x25c5eb[_0xdaf9('0x46')][_0xdaf9('0x47')]){_0x26873c[_0xdaf9('0x48')]=[{'all':!![]}];}if(_0x25c5eb[_0xdaf9('0x46')][_0xdaf9('0x4a')]==='true'){_0x26873c['include']=[{'model':db['UserSetting'],'as':_0xdaf9('0x4a')}];}_0x26873c=_[_0xdaf9('0x5c')]({},_0x26873c,_0x25c5eb[_0xdaf9('0x5d')]);if(!_[_0xdaf9('0x3b')](_0x26873c[_0xdaf9('0x4b')],'id')){_0x26873c[_0xdaf9('0x4b')][_0xdaf9('0x4c')]('id');}return db['User'][_0xdaf9('0x5e')](_0x26873c)[_0xdaf9('0x2c')](handleEntityNotFound(_0x360f15,null))[_0xdaf9('0x2c')](function(_0x5ac2c8){var _0x3b3867=[];values=_0x5ac2c8;if(_0x25c5eb[_0xdaf9('0x46')][_0xdaf9('0x5f')]==='true'){_0x3b3867[_0xdaf9('0x4c')](get_open_tabs(_0xdaf9('0x60'),_0x5ac2c8[_0xdaf9('0x50')]));_0x3b3867[_0xdaf9('0x4c')](get_open_tabs('sms',_0x5ac2c8[_0xdaf9('0x50')]));_0x3b3867['push'](get_open_tabs(_0xdaf9('0x61'),_0x5ac2c8[_0xdaf9('0x50')]));_0x3b3867[_0xdaf9('0x4c')](get_open_tabs(_0xdaf9('0x62'),_0x5ac2c8[_0xdaf9('0x50')]));_0x3b3867[_0xdaf9('0x4c')](get_open_tabs('fax',_0x5ac2c8[_0xdaf9('0x50')]));_0x3b3867['push'](get_open_tabs('mail',_0x5ac2c8['dataValues']));return BPromise[_0xdaf9('0x54')](_0x3b3867);}else{return values;}})[_0xdaf9('0x2c')](function(){return values;})[_0xdaf9('0x2c')](respondWithResult(_0x360f15,null))['catch'](handleError(_0x360f15,null));};exports[_0xdaf9('0x63')]=function(_0x5aeda5,_0x5b05eb){if(_0x5aeda5['body']['id']){delete _0x5aeda5[_0xdaf9('0x64')]['id'];}delete _0x5aeda5[_0xdaf9('0x64')][_0xdaf9('0x31')];return db[_0xdaf9('0x41')][_0xdaf9('0x5e')]({'where':{'id':_0x5aeda5[_0xdaf9('0x65')]['id']}})[_0xdaf9('0x2c')](handleEntityNotFound(_0x5b05eb,null))[_0xdaf9('0x2c')](saveUpdates(_0x5aeda5[_0xdaf9('0x64')],null))['then'](respondWithResult(_0x5b05eb,null))[_0xdaf9('0x22')](handleError(_0x5b05eb,null));};exports['describe']=function(_0x24d67b,_0x205d5c){return db[_0xdaf9('0x41')][_0xdaf9('0x66')]()[_0xdaf9('0x2c')](respondWithResult(_0x205d5c,null))[_0xdaf9('0x22')](handleError(_0x205d5c,null));};exports['addContacts']=function(_0x48a956,_0x5f4ebf){return db[_0xdaf9('0x41')][_0xdaf9('0x5e')]({'where':{'id':_0x48a956[_0xdaf9('0x65')]['id']}})['then'](handleEntityNotFound(_0x5f4ebf,null))[_0xdaf9('0x2c')](function(_0x57dd5a){if(_0x57dd5a){return _0x57dd5a[_0xdaf9('0x67')](_0x48a956['body'][_0xdaf9('0x68')],_[_0xdaf9('0x69')](_0x48a956[_0xdaf9('0x64')],['ids','id'])||{});}})[_0xdaf9('0x2c')](respondWithResult(_0x5f4ebf,null))[_0xdaf9('0x22')](handleError(_0x5f4ebf,null));};function validateUser(_0x3aa781){return new BPromise(function(_0x16815a,_0x174af7){if(_0x3aa781[_0xdaf9('0x6a')])return _0x16815a(_0x3aa781);return db[_0xdaf9('0x6b')][_0xdaf9('0x6c')](0x1)[_0xdaf9('0x2c')](function(_0x27eeec){if(_0x27eeec[_0xdaf9('0x6d')])authService['validatePasswordPattern'](_0x3aa781[_0xdaf9('0x44')]);db['User'][_0xdaf9('0x6e')](_0xdaf9('0x6a'))[_0xdaf9('0x2c')](function(_0x5cd36d){if(_[_0xdaf9('0x6f')](_0x5cd36d)){_0x3aa781['internal']=_0x27eeec[_0xdaf9('0x70')]||0x1;return;}if(_['isNil'](_0x27eeec[_0xdaf9('0x70')])||_0x27eeec[_0xdaf9('0x70')]===_0x5cd36d){_0x3aa781['internal']=_0x5cd36d+0x1;return;}if(_0x27eeec[_0xdaf9('0x70')]>_0x5cd36d){_0x3aa781[_0xdaf9('0x6a')]=_0x27eeec[_0xdaf9('0x70')];return;}return db[_0xdaf9('0x71')][_0xdaf9('0x46')](_0xdaf9('0x72'),{'type':db[_0xdaf9('0x71')][_0xdaf9('0x73')][_0xdaf9('0x74')]})[_0xdaf9('0x2c')](function(_0x19db61){if(_0x19db61&&_0x19db61[_0xdaf9('0x75')]){for(var _0x593c68=0x0,_0x588998=_0x19db61[_0xdaf9('0x75')];_0x593c68<_0x588998&&_[_0xdaf9('0x6f')](_0x3aa781[_0xdaf9('0x6a')]);_0x593c68++){if(_0x27eeec[_0xdaf9('0x70')]<=_0x19db61[_0x593c68][_0xdaf9('0x76')]){_0x3aa781[_0xdaf9('0x6a')]=_0x19db61[_0x593c68][_0xdaf9('0x76')];}else if(_0x27eeec[_0xdaf9('0x70')]>_0x19db61[_0x593c68][_0xdaf9('0x76')]&&_0x27eeec['min_internal']<=_0x19db61[_0x593c68]['to']){_0x3aa781['internal']=_0x27eeec[_0xdaf9('0x70')];}}}if(_[_0xdaf9('0x6f')](_0x3aa781[_0xdaf9('0x6a')])){_0x3aa781['internal']=_0x5cd36d+0x1;}return _0x16815a(_0x3aa781);});});})[_0xdaf9('0x22')](function(_0x447fbc){_0x174af7(_0x447fbc);});});}function updateUser(_0x3f01c5){return new BPromise(function(_0x4702a1,_0x5eb516){try{if(_0x3f01c5[_0xdaf9('0x77')]){_0x3f01c5[_0xdaf9('0x78')]=_0x3f01c5[_0xdaf9('0x6a')];_0x3f01c5[_0xdaf9('0x79')]={'mailbox':_0x3f01c5[_0xdaf9('0x6a')],'password':_0x3f01c5[_0xdaf9('0x44')],'fullname':_0x3f01c5[_0xdaf9('0x7a')],'email':_0x3f01c5[_0xdaf9('0x7b')]};}if(_0x3f01c5['role']===_0xdaf9('0x35')){if(!_0x3f01c5['permissions'])_0x3f01c5[_0xdaf9('0x7c')]=[_0xdaf9('0x7d'),_0xdaf9('0x7e'),'103','113',_0xdaf9('0x7f'),_0xdaf9('0x80'),_0xdaf9('0x81'),'106',_0xdaf9('0x82'),_0xdaf9('0x83'),_0xdaf9('0x84'),_0xdaf9('0x85'),_0xdaf9('0x86'),_0xdaf9('0x87'),_0xdaf9('0x88')];}_0x4702a1(_0x3f01c5);}catch(_0x4c2a32){_0x5eb516(_0x4c2a32);}});}exports[_0xdaf9('0x89')]=function(_0x1c6ca4,_0x13cfa4){if(_0x1c6ca4[_0xdaf9('0x33')][_0xdaf9('0x31')]===_0xdaf9('0x35'))throw new Error('Unauthorized');if(_0x1c6ca4[_0xdaf9('0x64')][_0xdaf9('0x31')]===_0xdaf9('0x33')&&_0x1c6ca4[_0xdaf9('0x33')][_0xdaf9('0x31')]!==_0xdaf9('0x8a')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x1c6ca4[_0xdaf9('0x64')][_0xdaf9('0x31')]===_0xdaf9('0x8a')&&_0x1c6ca4[_0xdaf9('0x33')][_0xdaf9('0x31')]!=='admin'){throw new Error(_0xdaf9('0x8b'));}return licenseUtil[_0xdaf9('0x8c')]([_0x1c6ca4[_0xdaf9('0x64')]])['then'](function(){return validateUser(_0x1c6ca4['body']);})[_0xdaf9('0x2c')](function(_0x230ddd){return updateUser(_0x230ddd)[_0xdaf9('0x2c')](function(_0xd10f3){if(_0xd10f3['role']===_0xdaf9('0x8a')){_0xd10f3['settingsEnabled']=_0x1c6ca4[_0xdaf9('0x33')][_0xdaf9('0x8d')];delete _0xd10f3[_0xdaf9('0x8e')];}return _0xd10f3;});})['then'](function(_0x6e725){return db[_0xdaf9('0x41')][_0xdaf9('0x89')](_0x6e725,{'include':[{'model':db[_0xdaf9('0x79')],'as':_0xdaf9('0x79')}]});})[_0xdaf9('0x2c')](function(_0x3ffac9){if(_0x1c6ca4[_0xdaf9('0x64')]['role']==='user')return _0x3ffac9;if(_0x1c6ca4['user']['role']!==_0xdaf9('0x33'))return _0x3ffac9;return db[_0xdaf9('0x8f')][_0xdaf9('0x5e')]({'where':{'name':_0x3ffac9['role']===_0xdaf9('0x35')?_0xdaf9('0x34'):_0xdaf9('0x36'),'userProfileId':_0x1c6ca4[_0xdaf9('0x33')][_0xdaf9('0x8e')]},'raw':!![]})[_0xdaf9('0x2c')](function(_0x1eb736){if(!_0x1eb736||_0x1eb736['autoAssociation']!=0x0)return _0x3ffac9;return db['UserProfileResource'][_0xdaf9('0x89')]({'name':_0x3ffac9[_0xdaf9('0x3c')],'resourceId':_0x3ffac9['id'],'type':_0x1eb736[_0xdaf9('0x3c')],'sectionId':_0x1eb736['id']},{})[_0xdaf9('0x2c')](function(){return _0x3ffac9;});})[_0xdaf9('0x22')](function(_0x4e6927){logger[_0xdaf9('0x1d')](_0xdaf9('0x90'),_0x4e6927);throw _0x4e6927;});})[_0xdaf9('0x2c')](respondWithResult(_0x13cfa4,0xc9))['catch'](handleError(_0x13cfa4,null));};exports[_0xdaf9('0x91')]=function(_0x141a99,_0x6b7e99){var _0x1a992b=_0x141a99[_0xdaf9('0x64')];var _0x30f670=[];if(_0x141a99[_0xdaf9('0x33')][_0xdaf9('0x31')]===_0xdaf9('0x35'))throw new Error(_0xdaf9('0x92'));if(_['some'](_0x1a992b,[_0xdaf9('0x31'),_0xdaf9('0x33')])&&_0x141a99[_0xdaf9('0x33')]['role']!==_0xdaf9('0x8a')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_[_0xdaf9('0x93')](_0x1a992b,['role',_0xdaf9('0x8a')])&&_0x141a99[_0xdaf9('0x33')][_0xdaf9('0x31')]!=='admin'){throw new Error(_0xdaf9('0x94'));}return licenseUtil[_0xdaf9('0x8c')](_0x1a992b)[_0xdaf9('0x2c')](function(){return validateUser(_0x1a992b[0x0]);})[_0xdaf9('0x2c')](function(){for(var _0x12cb5f=0x1;_0x12cb5f<_0x1a992b[_0xdaf9('0x75')];_0x12cb5f++){var _0xd990c5=_0x1a992b[_0x12cb5f-0x1]['internal'];if(!_0x1a992b[_0x12cb5f][_0xdaf9('0x6a')])_0x1a992b[_0x12cb5f][_0xdaf9('0x6a')]=_0xd990c5+0x1;_0x30f670[_0xdaf9('0x4c')](validateUser(_0x1a992b[_0x12cb5f]));}return BPromise[_0xdaf9('0x54')](_0x30f670);})[_0xdaf9('0x2c')](function(){_0x30f670=[];for(var _0x5eb166=0x0;_0x5eb166<_0x1a992b['length'];_0x5eb166++){_0x30f670[_0xdaf9('0x4c')](updateUser(_0x1a992b[_0x5eb166]));}return BPromise[_0xdaf9('0x54')](_0x30f670);})['then'](function(){return BPromise[_0xdaf9('0x95')](_0x1a992b,function(_0x3175c5){return db[_0xdaf9('0x41')]['create'](_0x3175c5,{'include':[{'model':db['VoiceMail'],'as':_0xdaf9('0x79')}]})[_0xdaf9('0x2c')](function(_0x2d4bae){_0x3175c5['id']=_0x2d4bae['id'];return _0x3175c5;});});})[_0xdaf9('0x2c')](function(_0x3c3aa9){if(_0x141a99[_0xdaf9('0x64')][_0xdaf9('0x31')]===_0xdaf9('0x33'))return _0x3c3aa9;if(_0x141a99[_0xdaf9('0x33')][_0xdaf9('0x31')]!==_0xdaf9('0x33'))return _0x3c3aa9;var _0x2d1000=_['some'](_0x3c3aa9,function(_0xaecf0c){return _0xaecf0c[_0xdaf9('0x31')]==='agent'||_0xaecf0c[_0xdaf9('0x31')]===_0xdaf9('0x37');});if(!_0x2d1000)return _0x3c3aa9;return db[_0xdaf9('0x8f')][_0xdaf9('0x4d')]({'where':{'name':{'$or':[_0xdaf9('0x34'),_0xdaf9('0x36')]},'userProfileId':_0x141a99[_0xdaf9('0x33')][_0xdaf9('0x8e')]},'raw':!![]})['then'](function(_0x262174){if(_[_0xdaf9('0x96')](_0x262174)||!_[_0xdaf9('0x93')](_0x262174,[_0xdaf9('0x97'),0x0]))return _0x3c3aa9;_0x30f670=[];var _0x56a3cd=_(_0x262174)[_0xdaf9('0x39')](function(_0x337474){if(_0x337474['autoAssociation']===0x1)return;return _0x337474['name']===_0xdaf9('0x34')?'agent':'telephone';})[_0xdaf9('0x98')]()[_0xdaf9('0x3a')]();for(var _0x3e1544=0x0;_0x3e1544<_0x3c3aa9[_0xdaf9('0x75')];_0x3e1544++){if(!_[_0xdaf9('0x3b')](_0x56a3cd,_0x3c3aa9[_0x3e1544][_0xdaf9('0x31')]))return;var _0x21b1b0=_0x3c3aa9[_0x3e1544][_0xdaf9('0x31')]===_0xdaf9('0x35')?_0xdaf9('0x34'):'Telephones';_0x30f670[_0xdaf9('0x4c')](db['UserProfileResource']['create']({'name':_0x3c3aa9[_0x3e1544][_0xdaf9('0x3c')],'resourceId':_0x3c3aa9[_0x3e1544]['id'],'type':_0x21b1b0,'sectionId':_[_0xdaf9('0x5e')](_0x262174,['name',_0x21b1b0])['id']},{}));}return BPromise[_0xdaf9('0x54')](_0x30f670);});})[_0xdaf9('0x2c')](respondWithResult(_0x6b7e99,0xc9))[_0xdaf9('0x22')](handleError(_0x6b7e99,null));};exports[_0xdaf9('0x99')]=function(_0x5be201,_0x226093){if(_0x5be201[_0xdaf9('0x64')]['id']){delete _0x5be201['body']['id'];}return db[_0xdaf9('0x41')][_0xdaf9('0x5e')]({'where':{'id':_0x5be201[_0xdaf9('0x65')]['id']}})[_0xdaf9('0x2c')](function(_0x1caba3){if(!_0x1caba3)return null;if(_0x1caba3['id']===_0x5be201['user']['id']){if(!_0x5be201[_0xdaf9('0x64')][_0xdaf9('0x9a')]||!_0x5be201[_0xdaf9('0x64')][_0xdaf9('0x9b')]){throw new db[(_0xdaf9('0x9c'))][(_0xdaf9('0x9d'))]('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x1caba3[_0xdaf9('0x9e')](_0x5be201[_0xdaf9('0x64')][_0xdaf9('0x9a')])){throw new db[(_0xdaf9('0x9c'))][(_0xdaf9('0x9d'))]('Wrong\x20credentials');}if(_0x5be201[_0xdaf9('0x64')]['oldPassword']===_0x5be201[_0xdaf9('0x64')][_0xdaf9('0x9b')]){throw new db[(_0xdaf9('0x9c'))]['ValidationError'](_0xdaf9('0x9f'));}}else if(_0x5be201[_0xdaf9('0x33')][_0xdaf9('0x31')]==='admin'){if(!_0x5be201[_0xdaf9('0x64')][_0xdaf9('0x9b')]){throw new db['Sequelize']['ValidationError'](_0xdaf9('0xa0'));}}else if(_0x5be201[_0xdaf9('0x33')]['role']===_0xdaf9('0x33')){if(!_0x5be201['body'][_0xdaf9('0x9b')]){throw new db[(_0xdaf9('0x9c'))]['ValidationError']('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x1caba3['role']!==_0xdaf9('0x35')){throw new db[(_0xdaf9('0x9c'))][(_0xdaf9('0x9d'))]('Unauthorized');}}else{throw new db[(_0xdaf9('0x9c'))][(_0xdaf9('0x9d'))](_0xdaf9('0x92'));}return _0x1caba3;})[_0xdaf9('0x2c')](handleEntityNotFound(_0x226093,null))[_0xdaf9('0x2c')](function(_0x228307){return db[_0xdaf9('0x6b')][_0xdaf9('0xa1')]({'attributes':['id',_0xdaf9('0x6d'),_0xdaf9('0xa2'),_0xdaf9('0xa3')]})[_0xdaf9('0x2c')](function(_0x2c0d62){if(_0x2c0d62[_0xdaf9('0x6d')])authService[_0xdaf9('0xa4')](_0x5be201[_0xdaf9('0x64')][_0xdaf9('0x9b')]);if(!_0x2c0d62[_0xdaf9('0xa2')]||!_0x228307[_0xdaf9('0xa5')])return _0x228307;authService[_0xdaf9('0xa6')](_0x5be201[_0xdaf9('0x64')]['newPassword'],_0x228307[_0xdaf9('0xa5')],_0x2c0d62[_0xdaf9('0xa3')]);return _0x228307;})[_0xdaf9('0x2c')](saveUpdates({'password':_0x5be201[_0xdaf9('0x64')][_0xdaf9('0x9b')],'passwordResetAt':_0x5be201[_0xdaf9('0x33')]['id']==_0x5be201['params']['id']?moment():null,'previousPasswords':authService[_0xdaf9('0xa7')](_0x5be201['body'][_0xdaf9('0x9b')],_0x228307[_0xdaf9('0xa5')])},null));})[_0xdaf9('0x2c')](respondWithResult(_0x226093,null))['catch'](handleError(_0x226093,null));};exports[_0xdaf9('0xa8')]=function(_0x5c41ee,_0x2ab2da){var _0x544239=_0x5c41ee[_0xdaf9('0x64')][_0xdaf9('0xa9')];return db[_0xdaf9('0x41')][_0xdaf9('0x5e')]({'where':{'id':_0x5c41ee[_0xdaf9('0x65')]['id']},'attributes':['id',_0xdaf9('0x3c'),_0xdaf9('0x31'),_0xdaf9('0xaa'),_0xdaf9('0xab'),_0xdaf9('0xac'),_0xdaf9('0xad')]})[_0xdaf9('0x2c')](handleEntityNotFound(_0x2ab2da,null))[_0xdaf9('0x2c')](function(_0x5a57dc){if(_0x5a57dc){if(!utils[_0xdaf9('0xae')](_0x544239)){throw new db[(_0xdaf9('0x9c'))]['ValidationError'](_0xdaf9('0xaf'));}return _0x5a57dc[_0xdaf9('0xb0')+_[_0xdaf9('0xb1')](_0x544239[_0xdaf9('0xb2')]())+'Queues'](_0x5c41ee[_0xdaf9('0x64')][_0xdaf9('0x68')],{'penalty':_0x5c41ee[_0xdaf9('0x64')][_0xdaf9('0xb3')]||0x0})[_0xdaf9('0xb4')](function(_0x5ca603){for(var _0xd36016=0x0;_0xd36016<_0x5c41ee['body'][_0xdaf9('0x68')][_0xdaf9('0x75')];_0xd36016+=0x1){var _0x3767b3={'UserId':Number(_0x5c41ee[_0xdaf9('0x65')]['id'])};_0x3767b3[_[_0xdaf9('0xb1')](_0x544239[_0xdaf9('0xb2')]())+_0xdaf9('0xb5')]=Number(_0x5c41ee[_0xdaf9('0x64')][_0xdaf9('0x68')][_0xd36016]);socket[_0xdaf9('0x2d')](_0xdaf9('0x33')+_[_0xdaf9('0xb1')](_0x544239[_0xdaf9('0xb2')]())+'Queue:save',_0x3767b3);}return _0x5ca603;})['then'](function(){if(_0x544239===_0xdaf9('0xb6')){return db[_0xdaf9('0xb7')][_0xdaf9('0x4d')]({'where':{'id':_0x5c41ee[_0xdaf9('0x64')][_0xdaf9('0x68')]||[]},'raw':!![],'attributes':['id',_0xdaf9('0x3c')]});}})[_0xdaf9('0x2c')](function(_0x464e7e){var _0xbed340=_0x5a57dc['get']({'plain':!![]});var _0x277fd7=[];if(_0x544239==='voice'&&_0xbed340[_0xdaf9('0x31')]===_0xdaf9('0x35')&&_0xbed340[_0xdaf9('0xaa')]){for(var _0x5421eb=0x0;_0x5421eb<_0x464e7e[_0xdaf9('0x75')];_0x5421eb+=0x1){_0x277fd7[_0xdaf9('0x4c')]({'membername':_0xbed340[_0xdaf9('0x3c')],'UserId':_0xbed340['id'],'queue_name':_0x464e7e[_0x5421eb]['name'],'VoiceQueueId':_0x464e7e[_0x5421eb]['id'],'interface':_['isNil'](_0xbed340[_0xdaf9('0xad')])?util[_0xdaf9('0xb8')](_0xdaf9('0xb9'),_0xbed340['name']):_0xbed340[_0xdaf9('0xad')],'paused':_0xbed340[_0xdaf9('0xac')]||![],'penalty':_0x5c41ee[_0xdaf9('0x64')][_0xdaf9('0xb3')]||0x0});}return BPromise[_0xdaf9('0x95')](_0x277fd7,function(_0x234a12){return db['UserVoiceQueueRt'][_0xdaf9('0xba')](_0x234a12);});}return _0x5a57dc;});}})[_0xdaf9('0x2c')](respondWithStatusCode(_0x2ab2da,null))[_0xdaf9('0x22')](handleError(_0x2ab2da,null));};exports[_0xdaf9('0xbb')]=function(_0x320f60,_0xa2752c){var _0x5ba28b,_0x1619fe;return db['User'][_0xdaf9('0x5e')]({'where':{'id':_0x320f60[_0xdaf9('0x65')]['id']},'attributes':['id',_0xdaf9('0x3c'),'role']})[_0xdaf9('0x2c')](handleEntityNotFound(_0xa2752c,null))[_0xdaf9('0x2c')](function(_0x3b5e07){if(_0x3b5e07){_0x5ba28b=_0x3b5e07;if(!_0x320f60[_0xdaf9('0x46')][_0xdaf9('0xa9')]||!utils['isValidChannel'](_0x320f60[_0xdaf9('0x46')]['channel'])){throw new db['Sequelize']['ValidationError'](_0xdaf9('0xaf'));}return _0x3b5e07[_0xdaf9('0xbc')+_[_0xdaf9('0xb1')](_0x320f60['query']['channel'][_0xdaf9('0xb2')]())+_0xdaf9('0xbd')](_0x320f60[_0xdaf9('0x46')][_0xdaf9('0x68')]);}})[_0xdaf9('0x2c')](function(_0x5246cb){if(_[_0xdaf9('0xbe')](_0x320f60[_0xdaf9('0x46')][_0xdaf9('0x68')])){for(var _0x5bf02b=0x0;_0x5bf02b<_0x320f60['query'][_0xdaf9('0x68')][_0xdaf9('0x75')];_0x5bf02b+=0x1){_0x1619fe={'UserId':Number(_0x320f60[_0xdaf9('0x65')]['id'])};_0x1619fe[_[_0xdaf9('0xb1')](_0x320f60[_0xdaf9('0x46')]['channel'][_0xdaf9('0xb2')]())+'QueueId']=Number(_0x320f60[_0xdaf9('0x46')][_0xdaf9('0x68')][_0x5bf02b]);socket['emit'](_0xdaf9('0x33')+_['capitalize'](_0x320f60[_0xdaf9('0x46')][_0xdaf9('0xa9')][_0xdaf9('0xb2')]())+'Queue:remove',_0x1619fe);}}else{_0x1619fe={'UserId':Number(_0x320f60[_0xdaf9('0x65')]['id'])};_0x1619fe[_['capitalize'](_0x320f60[_0xdaf9('0x46')]['channel'][_0xdaf9('0xb2')]())+_0xdaf9('0xb5')]=Number(_0x320f60[_0xdaf9('0x46')]['ids']);socket['emit'](_0xdaf9('0x33')+_[_0xdaf9('0xb1')](_0x320f60['query'][_0xdaf9('0xa9')][_0xdaf9('0xb2')]())+_0xdaf9('0xbf'),_0x1619fe);}return _0x5246cb;})[_0xdaf9('0x2c')](function(){if(_0x320f60[_0xdaf9('0x46')][_0xdaf9('0xa9')]===_0xdaf9('0xb6')){return db[_0xdaf9('0xc0')]['destroy']({'where':{'UserId':_0x320f60[_0xdaf9('0x65')]['id'],'VoiceQueueId':_0x320f60[_0xdaf9('0x46')][_0xdaf9('0x68')]},'individualHooks':!![]})[_0xdaf9('0x2c')](function(){return _0x5ba28b;});}return _0x5ba28b;})[_0xdaf9('0x2c')](respondWithStatusCode(_0xa2752c,null))[_0xdaf9('0x22')](handleError(_0xa2752c,null));};exports[_0xdaf9('0xc1')]=function(_0x1a0acf,_0x1a8798){_0x1a0acf[_0xdaf9('0x64')][_0xdaf9('0xc2')]=_0x1a0acf[_0xdaf9('0xc3')][_0xdaf9('0xc4')];return db['User'][_0xdaf9('0x5e')]({'where':{'id':_0x1a0acf['params']['id']}})[_0xdaf9('0x2c')](handleEntityNotFound(_0x1a8798,null))[_0xdaf9('0x2c')](saveUpdates(_0x1a0acf[_0xdaf9('0x64')],null))[_0xdaf9('0x2c')](respondWithResult(_0x1a8798,null))[_0xdaf9('0x22')](handleError(_0x1a8798,null));};exports[_0xdaf9('0xc5')]=function(_0x372dc1,_0x3bb80e){var _0x57b174=path['join'](config[_0xdaf9('0xc6')],_0xdaf9('0xc7'));return db[_0xdaf9('0x41')]['find']({'where':{'id':_0x372dc1['params']['id']},'attributes':['id',_0xdaf9('0xc2')],'raw':!![]})[_0xdaf9('0x2c')](handleEntityNotFound(_0x3bb80e,null))[_0xdaf9('0x2c')](function(_0x1cd451){if(_0x1cd451){if(_[_0xdaf9('0x6f')](_0x1cd451[_0xdaf9('0xc2')])){return _0x3bb80e[_0xdaf9('0xc8')](_0x57b174);}else{if(!fs['existsSync'](path['join'](config['root'],_0xdaf9('0xc9'),_0x1cd451[_0xdaf9('0xc2')]))){return _0x3bb80e[_0xdaf9('0xc8')](_0x57b174);}return _0x3bb80e[_0xdaf9('0xc8')](path[_0xdaf9('0xca')](config['root'],_0xdaf9('0xc9'),_0x1cd451[_0xdaf9('0xc2')]));}}})[_0xdaf9('0x22')](handleError(_0x3bb80e,null));};exports[_0xdaf9('0xcb')]=function(_0x1ac257,_0x112ca9){return db['User'][_0xdaf9('0x5e')]({'where':{'id':_0x1ac257[_0xdaf9('0x65')]['id']},'attributes':['id']})[_0xdaf9('0x2c')](handleEntityNotFound(_0x112ca9,null))['then'](function(_0x22d38e){var _0x253aea=[];values=_0x22d38e[_0xdaf9('0x50')];_0x253aea['push'](get_open_tabs(_0xdaf9('0x60'),_0x22d38e[_0xdaf9('0x50')]));_0x253aea[_0xdaf9('0x4c')](get_open_tabs(_0xdaf9('0x51'),_0x22d38e[_0xdaf9('0x50')]));_0x253aea[_0xdaf9('0x4c')](get_open_tabs('openchannel',_0x22d38e[_0xdaf9('0x50')]));_0x253aea['push'](get_open_tabs('whatsapp',_0x22d38e[_0xdaf9('0x50')]));_0x253aea[_0xdaf9('0x4c')](get_open_tabs('fax',_0x22d38e['dataValues']));_0x253aea[_0xdaf9('0x4c')](get_open_tabs(_0xdaf9('0x53'),_0x22d38e[_0xdaf9('0x50')]));return BPromise['all'](_0x253aea);})[_0xdaf9('0x2c')](function(_0x3635e6){if(_0x3635e6){var _0x555286=_[_0xdaf9('0x39')](values['ChatOpenTabs'],function(_0x33ac62){return{'channel':_0xdaf9('0xcc'),'id':_0x33ac62['id'],'createdAt':_0x33ac62['createdAt']};});var _0x530530=_['map'](values[_0xdaf9('0xcd')],function(_0x19a7d3){return{'channel':_0xdaf9('0xce'),'id':_0x19a7d3['id'],'createdAt':_0x19a7d3[_0xdaf9('0xcf')]};});var _0x4d6241=_[_0xdaf9('0x39')](values[_0xdaf9('0xd0')],function(_0x356b5c){return{'channel':_0xdaf9('0xd1'),'id':_0x356b5c['id'],'createdAt':_0x356b5c[_0xdaf9('0xcf')]};});var _0x19c029=_[_0xdaf9('0x39')](values[_0xdaf9('0xd2')],function(_0x46aec7){return{'channel':'MAIL','id':_0x46aec7['id'],'createdAt':_0x46aec7[_0xdaf9('0xcf')]};});var _0x2ab17d=_[_0xdaf9('0x39')](values[_0xdaf9('0xd3')],function(_0x1d77bf){return{'channel':_0xdaf9('0xd4'),'id':_0x1d77bf['id'],'createdAt':_0x1d77bf[_0xdaf9('0xcf')]};});var _0x346c84=_['map'](values[_0xdaf9('0xd5')],function(_0x616a0e){return{'channel':_0xdaf9('0xd6'),'id':_0x616a0e['id'],'createdAt':_0x616a0e[_0xdaf9('0xcf')]};});var _0x2bbeef=_[_0xdaf9('0xd7')](_0x555286,_0x530530,_0x4d6241,_0x19c029,_0x2ab17d,_0x346c84);var _0xa386ab={'count':_0x2bbeef[_0xdaf9('0x75')],'rows':_0x2bbeef};return _0xa386ab;}else return null;})[_0xdaf9('0x2c')](respondWithResult(_0x112ca9,null))[_0xdaf9('0x22')](handleError(_0x112ca9,null));};exports[_0xdaf9('0xd8')]=function(_0x111c54,_0x24814c){var _0xbfd637={};var _0x4bdc26={};var _0x591630;var _0x10c8ba;return db['User'][_0xdaf9('0xa1')]({'where':{'id':_0x111c54['params']['id']}})[_0xdaf9('0x2c')](handleEntityNotFound(_0x24814c,null))[_0xdaf9('0x2c')](function(_0xffbe0e){if(_0xffbe0e){_0x591630=_0xffbe0e;_0x4bdc26[_0xdaf9('0x56')]=_['keys'](db[_0xdaf9('0xd9')][_0xdaf9('0x42')]);_0x4bdc26['query']=_[_0xdaf9('0x58')](_0x111c54[_0xdaf9('0x46')]);_0x4bdc26[_0xdaf9('0x59')]=_['intersection'](_0x4bdc26[_0xdaf9('0x56')],_0x4bdc26[_0xdaf9('0x46')]);_0xbfd637[_0xdaf9('0x4b')]=_[_0xdaf9('0x5a')](_0x4bdc26[_0xdaf9('0x56')],qs[_0xdaf9('0x5b')](_0x111c54['query'][_0xdaf9('0x5b')]));_0xbfd637[_0xdaf9('0x4b')]=_0xbfd637[_0xdaf9('0x4b')][_0xdaf9('0x75')]?_0xbfd637[_0xdaf9('0x4b')]:_0x4bdc26[_0xdaf9('0x56')];_0xbfd637[_0xdaf9('0xda')]=qs[_0xdaf9('0xdb')](_0x111c54[_0xdaf9('0x46')][_0xdaf9('0xdb')]);_0xbfd637[_0xdaf9('0xdc')]=qs[_0xdaf9('0x59')](_[_0xdaf9('0xdd')](_0x111c54[_0xdaf9('0x46')],_0x4bdc26[_0xdaf9('0x59')]));if(_0x111c54['query'][_0xdaf9('0x38')]){_0xbfd637[_0xdaf9('0xdc')]=_[_0xdaf9('0x5c')](_0xbfd637['where'],{'$or':_[_0xdaf9('0x39')](_0xbfd637[_0xdaf9('0x4b')],function(_0x2140e1){var _0x2268a0={};_0x2268a0[_0x2140e1]={'$like':'%'+_0x111c54[_0xdaf9('0x46')][_0xdaf9('0x38')]+'%'};return _0x2268a0;})});}_0xbfd637=_[_0xdaf9('0x5c')]({},_0xbfd637,_0x111c54[_0xdaf9('0x5d')]);return _0x591630['getContacts'](_0xbfd637);}})[_0xdaf9('0x2c')](function(_0x4efca6){if(_0x4efca6){_0x10c8ba=_0x4efca6[_0xdaf9('0x75')];if(_0x111c54[_0xdaf9('0x46')][_0xdaf9('0xde')](_0xdaf9('0x47'))){_0xbfd637[_0xdaf9('0x48')]=[{'model':db['CmList'],'as':_0xdaf9('0xdf'),'required':![]},{'model':db['Tag'],'as':_0xdaf9('0xe0'),'attributes':['id','name',_0xdaf9('0xe1')],'where':_0x111c54[_0xdaf9('0x46')][_0xdaf9('0xe2')]?{'id':_0x111c54['query'][_0xdaf9('0xe2')]}:undefined,'required':_0x111c54['query'][_0xdaf9('0xe2')]?!![]:![]}];}if(!_0x111c54[_0xdaf9('0x46')][_0xdaf9('0xde')](_0xdaf9('0xe3'))){_0xbfd637['limit']=qs[_0xdaf9('0x28')](_0x111c54[_0xdaf9('0x46')][_0xdaf9('0x28')]);_0xbfd637[_0xdaf9('0x26')]=qs[_0xdaf9('0x26')](_0x111c54[_0xdaf9('0x46')][_0xdaf9('0x26')]);}return _0x591630[_0xdaf9('0xd8')](_0xbfd637);}})[_0xdaf9('0x2c')](function(_0x145c50){if(_0x145c50){return _0x145c50?{'count':_0x10c8ba,'rows':_0x145c50}:null;}})['then'](respondWithResult(_0x24814c,null))[_0xdaf9('0x22')](handleError(_0x24814c,null));};exports[_0xdaf9('0xe4')]=function(_0x58ef2e,_0x4089c5){var _0x46753f;var _0x33d998={};var _0x1914e1;return db[_0xdaf9('0x41')]['findOne']({'where':{'id':_0x58ef2e[_0xdaf9('0x65')]['id']},'attributes':['id',_0xdaf9('0x3c'),_0xdaf9('0x31')]})[_0xdaf9('0x2c')](handleEntityNotFound(_0x4089c5,null))[_0xdaf9('0x2c')](function(_0x2e6c8b){if(!utils['isValidChannel'](_0x58ef2e[_0xdaf9('0x46')]['channel'])){throw new db[(_0xdaf9('0x9c'))][(_0xdaf9('0x9d'))]('Unknown\x20channel');}_0x46753f=_0x2e6c8b;var _0x192867={};_0x192867[_0xdaf9('0x56')]=_[_0xdaf9('0x58')](db[_[_0xdaf9('0xb1')](_0x58ef2e[_0xdaf9('0x46')][_0xdaf9('0xa9')])+_0xdaf9('0xe5')][_0xdaf9('0x42')]);_0x192867['query']=_[_0xdaf9('0x58')](_0x58ef2e['query']);_0x192867[_0xdaf9('0x59')]=_['intersection'](_0x192867[_0xdaf9('0x56')],_0x192867[_0xdaf9('0x46')]);_0x33d998[_0xdaf9('0x4b')]=_[_0xdaf9('0x5a')](_0x192867['model'],qs[_0xdaf9('0x5b')](_0x58ef2e[_0xdaf9('0x46')][_0xdaf9('0x5b')]));_0x33d998[_0xdaf9('0x4b')]=_0x33d998[_0xdaf9('0x4b')][_0xdaf9('0x75')]?_0x33d998[_0xdaf9('0x4b')]:_0x192867['model'];_0x33d998['order']=qs[_0xdaf9('0xdb')](_0x58ef2e[_0xdaf9('0x46')][_0xdaf9('0xdb')]);_0x33d998[_0xdaf9('0xdc')]=qs[_0xdaf9('0x59')](_[_0xdaf9('0xdd')](_0x58ef2e['query'],_0x192867[_0xdaf9('0x59')]));if(_0x58ef2e[_0xdaf9('0x46')][_0xdaf9('0x38')]){_0x33d998[_0xdaf9('0xdc')]=_['merge'](_0x33d998[_0xdaf9('0xdc')],{'$or':_['map'](_0x33d998[_0xdaf9('0x4b')],function(_0x2d3e79){var _0x155f95={};_0x155f95[_0x2d3e79]={'$like':'%'+_0x58ef2e['query'][_0xdaf9('0x38')]+'%'};return _0x155f95;})});}_0x33d998=_['merge']({},_0x33d998,_0x58ef2e[_0xdaf9('0x5d')]);switch(_0x46753f['role']){case _0xdaf9('0x8a'):return db[_[_0xdaf9('0xb1')](_0x58ef2e['query'][_0xdaf9('0xa9')])+_0xdaf9('0xe5')]['findAll'](_0x33d998);case _0xdaf9('0x33'):case _0xdaf9('0x35'):return _0x46753f['get'+_[_0xdaf9('0xb1')](_0x58ef2e[_0xdaf9('0x46')][_0xdaf9('0xa9')])+_0xdaf9('0xbd')](_0x33d998);default:throw new db[(_0xdaf9('0x9c'))]['ValidationError'](_0xdaf9('0xe6'));}})['then'](function(_0x586c9d){_0x1914e1=_0x586c9d['length'];if(!_0x58ef2e[_0xdaf9('0x46')][_0xdaf9('0xde')]('nolimit')){_0x33d998['limit']=qs['limit'](_0x58ef2e['query']['limit']);_0x33d998[_0xdaf9('0x26')]=qs[_0xdaf9('0x26')](_0x58ef2e[_0xdaf9('0x46')][_0xdaf9('0x26')]);}switch(_0x46753f[_0xdaf9('0x31')]){case _0xdaf9('0x8a'):return db[_[_0xdaf9('0xb1')](_0x58ef2e['query']['channel'])+_0xdaf9('0xe5')][_0xdaf9('0x4d')](_0x33d998);case'user':case _0xdaf9('0x35'):return _0x46753f[_0xdaf9('0x30')+_[_0xdaf9('0xb1')](_0x58ef2e[_0xdaf9('0x46')][_0xdaf9('0xa9')])+_0xdaf9('0xbd')](_0x33d998);}})[_0xdaf9('0x2c')](function(_0x4b94cb){return{'count':_0x1914e1,'rows':_0x4b94cb};})['then'](respondWithResult(_0x4089c5,null))['catch'](handleError(_0x4089c5,null));};exports[_0xdaf9('0xe7')]=function(_0x25a2c2,_0x33dd40){var _0x247d3b={};var _0x5916bb={};var _0xd06f92;var _0x32023e;return db[_0xdaf9('0x41')]['findOne']({'where':{'id':_0x25a2c2[_0xdaf9('0x65')]['id']}})[_0xdaf9('0x2c')](handleEntityNotFound(_0x33dd40,null))[_0xdaf9('0x2c')](function(_0x184d6){if(_0x184d6){_0xd06f92=_0x184d6;_0x5916bb['model']=_[_0xdaf9('0x58')](db[_0xdaf9('0xc0')][_0xdaf9('0x42')]);_0x5916bb[_0xdaf9('0x46')]=_[_0xdaf9('0x58')](_0x25a2c2['query']);_0x5916bb[_0xdaf9('0x59')]=_[_0xdaf9('0x5a')](_0x5916bb['model'],_0x5916bb[_0xdaf9('0x46')]);_0x247d3b[_0xdaf9('0x4b')]=_['intersection'](_0x5916bb[_0xdaf9('0x56')],qs[_0xdaf9('0x5b')](_0x25a2c2[_0xdaf9('0x46')]['fields']));_0x247d3b[_0xdaf9('0x4b')]=_0x247d3b[_0xdaf9('0x4b')][_0xdaf9('0x75')]?_0x247d3b[_0xdaf9('0x4b')]:_0x5916bb[_0xdaf9('0x56')];_0x247d3b[_0xdaf9('0xda')]=qs[_0xdaf9('0xdb')](_0x25a2c2[_0xdaf9('0x46')][_0xdaf9('0xdb')]);_0x247d3b['where']=qs[_0xdaf9('0x59')](_['pick'](_0x25a2c2['query'],_0x5916bb['filters']));if(_0x25a2c2[_0xdaf9('0x46')][_0xdaf9('0x38')]){_0x247d3b[_0xdaf9('0xdc')]=_[_0xdaf9('0x5c')](_0x247d3b[_0xdaf9('0xdc')],{'$or':_[_0xdaf9('0x39')](_0x247d3b[_0xdaf9('0x4b')],function(_0x42267d){var _0x4447c5={};_0x4447c5[_0x42267d]={'$like':'%'+_0x25a2c2['query'][_0xdaf9('0x38')]+'%'};return _0x4447c5;})});}_0x247d3b=_['merge']({},_0x247d3b,_0x25a2c2[_0xdaf9('0x5d')]);return _0xd06f92[_0xdaf9('0xe7')](_0x247d3b);}})['then'](function(_0x375d53){if(_0x375d53){_0x32023e=_0x375d53[_0xdaf9('0x75')];if(!_0x25a2c2['query']['hasOwnProperty'](_0xdaf9('0xe3'))){_0x247d3b['limit']=qs[_0xdaf9('0x28')](_0x25a2c2['query'][_0xdaf9('0x28')]);_0x247d3b[_0xdaf9('0x26')]=qs['offset'](_0x25a2c2[_0xdaf9('0x46')]['offset']);}return _0xd06f92['getVoiceQueuesRt'](_0x247d3b);}})['then'](function(_0x155238){if(_0x155238){return _0x155238?{'count':_0x32023e,'rows':_0x155238}:null;}})[_0xdaf9('0x2c')](respondWithResult(_0x33dd40,null))['catch'](handleError(_0x33dd40,null));};exports[_0xdaf9('0xe8')]=function(_0xa1d579,_0x26db37){var _0x3e651a={};var _0x30ad74={};var _0x44ac54;var _0x2777a9;return db[_0xdaf9('0x41')]['findOne']({'where':{'id':_0xa1d579[_0xdaf9('0x65')]['id']}})[_0xdaf9('0x2c')](handleEntityNotFound(_0x26db37,null))[_0xdaf9('0x2c')](function(_0x3cca7d){if(_0x3cca7d){_0x44ac54=_0x3cca7d;_0x30ad74[_0xdaf9('0x56')]=_[_0xdaf9('0x58')](db[_0xdaf9('0xe9')]['rawAttributes']);_0x30ad74['query']=_[_0xdaf9('0x58')](_0xa1d579[_0xdaf9('0x46')]);_0x30ad74['filters']=_[_0xdaf9('0x5a')](_0x30ad74['model'],_0x30ad74[_0xdaf9('0x46')]);_0x3e651a['attributes']=_['intersection'](_0x30ad74[_0xdaf9('0x56')],qs[_0xdaf9('0x5b')](_0xa1d579[_0xdaf9('0x46')]['fields']));_0x3e651a[_0xdaf9('0x4b')]=_0x3e651a['attributes'][_0xdaf9('0x75')]?_0x3e651a[_0xdaf9('0x4b')]:_0x30ad74[_0xdaf9('0x56')];_0x3e651a[_0xdaf9('0xda')]=qs[_0xdaf9('0xdb')](_0xa1d579[_0xdaf9('0x46')][_0xdaf9('0xdb')]);_0x3e651a[_0xdaf9('0xdc')]=qs[_0xdaf9('0x59')](_[_0xdaf9('0xdd')](_0xa1d579[_0xdaf9('0x46')],_0x30ad74[_0xdaf9('0x59')]));if(_0xa1d579['query'][_0xdaf9('0x38')]){_0x3e651a['where']=_['merge'](_0x3e651a[_0xdaf9('0xdc')],{'$or':_[_0xdaf9('0x39')](_0x3e651a[_0xdaf9('0x4b')],function(_0x2b67e3){var _0x507fb6={};_0x507fb6[_0x2b67e3]={'$like':'%'+_0xa1d579[_0xdaf9('0x46')]['filter']+'%'};return _0x507fb6;})});}_0x3e651a=_['merge']({},_0x3e651a,_0xa1d579['options']);return _0x44ac54[_0xdaf9('0xe8')](_0x3e651a);}})[_0xdaf9('0x2c')](function(_0x2640a6){if(_0x2640a6){_0x2777a9=_0x2640a6[_0xdaf9('0x75')];if(!_0xa1d579[_0xdaf9('0x46')][_0xdaf9('0xde')](_0xdaf9('0xe3'))){_0x3e651a[_0xdaf9('0x28')]=qs['limit'](_0xa1d579[_0xdaf9('0x46')]['limit']);_0x3e651a[_0xdaf9('0x26')]=qs[_0xdaf9('0x26')](_0xa1d579[_0xdaf9('0x46')][_0xdaf9('0x26')]);}return _0x44ac54[_0xdaf9('0xe8')](_0x3e651a);}})[_0xdaf9('0x2c')](function(_0x58ebe2){if(_0x58ebe2){return _0x58ebe2?{'count':_0x2777a9,'rows':_0x58ebe2}:null;}})[_0xdaf9('0x2c')](respondWithResult(_0x26db37,null))[_0xdaf9('0x22')](handleError(_0x26db37,null));};exports[_0xdaf9('0xea')]=function(_0x4b4b25,_0x4bbc08){var _0x274eb0={'raw':!![],'where':{}};var _0x212f5b={};var _0x41f849={'count':0x0,'rows':[]};return db[_0xdaf9('0x41')][_0xdaf9('0xa1')]({'where':{'id':_0x4b4b25[_0xdaf9('0x65')]['id']}})['then'](handleEntityNotFound(_0x4bbc08,null))['then'](function(_0x437413){if(_0x437413){_0x212f5b['model']=_[_0xdaf9('0x58')](db[_0xdaf9('0xeb')][_0xdaf9('0x42')]);_0x212f5b[_0xdaf9('0x46')]=_['keys'](_0x4b4b25[_0xdaf9('0x46')]);_0x212f5b[_0xdaf9('0x59')]=_[_0xdaf9('0x5a')](_0x212f5b[_0xdaf9('0x56')],_0x212f5b[_0xdaf9('0x46')]);_0x274eb0[_0xdaf9('0x4b')]=_['intersection'](_0x212f5b[_0xdaf9('0x56')],qs[_0xdaf9('0x5b')](_0x4b4b25['query'][_0xdaf9('0x5b')]));_0x274eb0[_0xdaf9('0x4b')]=_0x274eb0[_0xdaf9('0x4b')][_0xdaf9('0x75')]?_0x274eb0[_0xdaf9('0x4b')]:_0x212f5b[_0xdaf9('0x56')];if(!_0x4b4b25['query'][_0xdaf9('0xde')](_0xdaf9('0xe3'))){_0x274eb0['limit']=qs['limit'](_0x4b4b25[_0xdaf9('0x46')][_0xdaf9('0x28')]);_0x274eb0[_0xdaf9('0x26')]=qs['offset'](_0x4b4b25[_0xdaf9('0x46')]['offset']);}_0x274eb0[_0xdaf9('0xda')]=qs[_0xdaf9('0xdb')](_0x4b4b25[_0xdaf9('0x46')]['sort']);_0x274eb0['where']=qs['filters'](_[_0xdaf9('0xdd')](_0x4b4b25[_0xdaf9('0x46')],_0x212f5b[_0xdaf9('0x59')]));_0x274eb0[_0xdaf9('0xdc')][_0xdaf9('0xec')]=_0x437413['id'];if(_0x4b4b25['query'][_0xdaf9('0x38')]){_0x274eb0[_0xdaf9('0xdc')]=_['merge'](_0x274eb0[_0xdaf9('0xdc')],{'$or':_['map'](_0x274eb0[_0xdaf9('0x4b')],function(_0x40e8f9){var _0x55a66={};_0x55a66[_0x40e8f9]={'$like':'%'+_0x4b4b25['query'][_0xdaf9('0x38')]+'%'};return _0x55a66;})});}_0x274eb0=_['merge']({},_0x274eb0,_0x4b4b25[_0xdaf9('0x5d')]);return db[_0xdaf9('0xeb')][_0xdaf9('0x29')]({'where':_0x274eb0[_0xdaf9('0xdc')]})[_0xdaf9('0x2c')](function(_0x230bb7){_0x41f849[_0xdaf9('0x29')]=_0x230bb7;if(_0x4b4b25[_0xdaf9('0x46')]['includeAll']){_0x274eb0[_0xdaf9('0x48')]=[{'all':!![]}];}return db[_0xdaf9('0xeb')]['findAll'](_0x274eb0);})['then'](function(_0x2fac87){_0x41f849[_0xdaf9('0x4f')]=_0x2fac87;return _0x41f849;});}})[_0xdaf9('0x2c')](respondWithFilteredResult(_0x4bbc08,_0x274eb0))[_0xdaf9('0x22')](handleError(_0x4bbc08,null));};exports[_0xdaf9('0xed')]=function(_0x16d8a2,_0x834578){var _0x52fe11={'raw':!![],'where':{}};var _0x2be4c8={};var _0x27a295={'count':0x0,'rows':[]};return db['User'][_0xdaf9('0xa1')]({'where':{'id':_0x16d8a2[_0xdaf9('0x65')]['id']}})[_0xdaf9('0x2c')](handleEntityNotFound(_0x834578,null))[_0xdaf9('0x2c')](function(_0x1e46e3){if(_0x1e46e3){_0x2be4c8[_0xdaf9('0x56')]=_[_0xdaf9('0x58')](db['ScreenRecording']['rawAttributes']);_0x2be4c8[_0xdaf9('0x46')]=_[_0xdaf9('0x58')](_0x16d8a2[_0xdaf9('0x46')]);_0x2be4c8[_0xdaf9('0x59')]=_['intersection'](_0x2be4c8[_0xdaf9('0x56')],_0x2be4c8['query']);_0x52fe11['attributes']=_['intersection'](_0x2be4c8[_0xdaf9('0x56')],qs[_0xdaf9('0x5b')](_0x16d8a2[_0xdaf9('0x46')][_0xdaf9('0x5b')]));_0x52fe11['attributes']=_0x52fe11[_0xdaf9('0x4b')]['length']?_0x52fe11[_0xdaf9('0x4b')]:_0x2be4c8[_0xdaf9('0x56')];if(!_0x16d8a2['query'][_0xdaf9('0xde')](_0xdaf9('0xe3'))){_0x52fe11[_0xdaf9('0x28')]=qs[_0xdaf9('0x28')](_0x16d8a2[_0xdaf9('0x46')][_0xdaf9('0x28')]);_0x52fe11[_0xdaf9('0x26')]=qs[_0xdaf9('0x26')](_0x16d8a2[_0xdaf9('0x46')][_0xdaf9('0x26')]);}_0x52fe11[_0xdaf9('0xda')]=qs[_0xdaf9('0xdb')](_0x16d8a2['query'][_0xdaf9('0xdb')]);_0x52fe11[_0xdaf9('0xdc')]=qs[_0xdaf9('0x59')](_[_0xdaf9('0xdd')](_0x16d8a2[_0xdaf9('0x46')],_0x2be4c8[_0xdaf9('0x59')]));_0x52fe11['where'][_0xdaf9('0xec')]=_0x1e46e3['id'];if(_0x16d8a2[_0xdaf9('0x46')][_0xdaf9('0x38')]){_0x52fe11[_0xdaf9('0xdc')]=_[_0xdaf9('0x5c')](_0x52fe11['where'],{'$or':_[_0xdaf9('0x39')](_0x52fe11[_0xdaf9('0x4b')],function(_0x248fff){var _0x1de6bd={};_0x1de6bd[_0x248fff]={'$like':'%'+_0x16d8a2['query']['filter']+'%'};return _0x1de6bd;})});}_0x52fe11=_['merge']({},_0x52fe11,_0x16d8a2[_0xdaf9('0x5d')]);return db[_0xdaf9('0xee')][_0xdaf9('0x29')]({'where':_0x52fe11[_0xdaf9('0xdc')]})[_0xdaf9('0x2c')](function(_0x2c55d2){_0x27a295[_0xdaf9('0x29')]=_0x2c55d2;if(_0x16d8a2['query'][_0xdaf9('0x47')]){_0x52fe11[_0xdaf9('0x48')]=[{'all':!![]}];}return db[_0xdaf9('0xee')][_0xdaf9('0x4d')](_0x52fe11);})[_0xdaf9('0x2c')](function(_0x31ab0e){_0x27a295[_0xdaf9('0x4f')]=_0x31ab0e;return _0x27a295;});}})['then'](respondWithFilteredResult(_0x834578,_0x52fe11))[_0xdaf9('0x22')](handleError(_0x834578,null));};exports[_0xdaf9('0xef')]=function(_0x366432,_0x314ab5){var _0x3e4b2e={};var _0x1c7d65={};var _0x1e0202;var _0x386e3f;return db[_0xdaf9('0x41')][_0xdaf9('0xa1')]({'where':{'id':_0x366432[_0xdaf9('0x65')]['id']}})[_0xdaf9('0x2c')](handleEntityNotFound(_0x314ab5,null))['then'](function(_0x4d2d34){if(_0x4d2d34){_0x1e0202=_0x4d2d34;_0x1c7d65[_0xdaf9('0x56')]=_[_0xdaf9('0x58')](db[_0xdaf9('0xf0')]['rawAttributes']);_0x1c7d65['query']=_[_0xdaf9('0x58')](_0x366432[_0xdaf9('0x46')]);_0x1c7d65[_0xdaf9('0x59')]=_[_0xdaf9('0x5a')](_0x1c7d65['model'],_0x1c7d65['query']);_0x3e4b2e[_0xdaf9('0x4b')]=_['intersection'](_0x1c7d65['model'],qs['fields'](_0x366432[_0xdaf9('0x46')][_0xdaf9('0x5b')]));_0x3e4b2e[_0xdaf9('0x4b')]=_0x3e4b2e[_0xdaf9('0x4b')]['length']?_0x3e4b2e[_0xdaf9('0x4b')]:_0x1c7d65[_0xdaf9('0x56')];_0x3e4b2e['order']=qs[_0xdaf9('0xdb')](_0x366432[_0xdaf9('0x46')][_0xdaf9('0xdb')]);_0x3e4b2e[_0xdaf9('0xdc')]=qs['filters'](_['pick'](_0x366432[_0xdaf9('0x46')],_0x1c7d65[_0xdaf9('0x59')]));if(_0x366432[_0xdaf9('0x46')][_0xdaf9('0x38')]){_0x3e4b2e['where']=_[_0xdaf9('0x5c')](_0x3e4b2e['where'],{'$or':_[_0xdaf9('0x39')](_0x3e4b2e['attributes'],function(_0x54436a){var _0x5a73a6={};_0x5a73a6[_0x54436a]={'$like':'%'+_0x366432[_0xdaf9('0x46')][_0xdaf9('0x38')]+'%'};return _0x5a73a6;})});}_0x3e4b2e=_[_0xdaf9('0x5c')]({},_0x3e4b2e,_0x366432[_0xdaf9('0x5d')]);return _0x1e0202['getChatInteractions'](_0x3e4b2e);}})[_0xdaf9('0x2c')](function(_0x1c72fc){if(_0x1c72fc){_0x386e3f=_0x1c72fc[_0xdaf9('0x75')];if(!_0x366432[_0xdaf9('0x46')][_0xdaf9('0xde')](_0xdaf9('0xe3'))){_0x3e4b2e['limit']=qs['limit'](_0x366432[_0xdaf9('0x46')]['limit']);_0x3e4b2e[_0xdaf9('0x26')]=qs[_0xdaf9('0x26')](_0x366432[_0xdaf9('0x46')][_0xdaf9('0x26')]);}return _0x1e0202[_0xdaf9('0xef')](_0x3e4b2e);}})[_0xdaf9('0x2c')](function(_0x21d4fa){if(_0x21d4fa){return _0x21d4fa?{'count':_0x386e3f,'rows':_0x21d4fa}:null;}})[_0xdaf9('0x2c')](respondWithResult(_0x314ab5,null))['catch'](handleError(_0x314ab5,null));};exports[_0xdaf9('0xf1')]=function(_0x3d4728,_0x2879ec){var _0x2b7135={};var _0x37956f={};var _0x60be41;var _0x3fb6fa;return db['User']['findOne']({'where':{'id':_0x3d4728[_0xdaf9('0x65')]['id']}})[_0xdaf9('0x2c')](handleEntityNotFound(_0x2879ec,null))[_0xdaf9('0x2c')](function(_0x353187){if(_0x353187){_0x60be41=_0x353187;_0x37956f[_0xdaf9('0x56')]=_[_0xdaf9('0x58')](db[_0xdaf9('0xf2')][_0xdaf9('0x42')]);_0x37956f[_0xdaf9('0x46')]=_['keys'](_0x3d4728['query']);_0x37956f[_0xdaf9('0x59')]=_[_0xdaf9('0x5a')](_0x37956f[_0xdaf9('0x56')],_0x37956f['query']);_0x2b7135[_0xdaf9('0x4b')]=_[_0xdaf9('0x5a')](_0x37956f[_0xdaf9('0x56')],qs['fields'](_0x3d4728['query'][_0xdaf9('0x5b')]));_0x2b7135['attributes']=_0x2b7135['attributes']['length']?_0x2b7135['attributes']:_0x37956f[_0xdaf9('0x56')];_0x2b7135[_0xdaf9('0xda')]=qs['sort'](_0x3d4728[_0xdaf9('0x46')][_0xdaf9('0xdb')]);_0x2b7135[_0xdaf9('0xdc')]=qs['filters'](_[_0xdaf9('0xdd')](_0x3d4728[_0xdaf9('0x46')],_0x37956f['filters']));if(_0x3d4728[_0xdaf9('0x46')]['filter']){_0x2b7135['where']=_[_0xdaf9('0x5c')](_0x2b7135[_0xdaf9('0xdc')],{'$or':_[_0xdaf9('0x39')](_0x2b7135[_0xdaf9('0x4b')],function(_0xa2cabc){var _0x48a89d={};_0x48a89d[_0xa2cabc]={'$like':'%'+_0x3d4728[_0xdaf9('0x46')]['filter']+'%'};return _0x48a89d;})});}_0x2b7135=_[_0xdaf9('0x5c')]({},_0x2b7135,_0x3d4728['options']);return _0x60be41[_0xdaf9('0xf1')](_0x2b7135);}})[_0xdaf9('0x2c')](function(_0x51e1f3){if(_0x51e1f3){_0x3fb6fa=_0x51e1f3[_0xdaf9('0x75')];if(!_0x3d4728[_0xdaf9('0x46')][_0xdaf9('0xde')](_0xdaf9('0xe3'))){_0x2b7135['limit']=qs[_0xdaf9('0x28')](_0x3d4728[_0xdaf9('0x46')]['limit']);_0x2b7135[_0xdaf9('0x26')]=qs['offset'](_0x3d4728['query'][_0xdaf9('0x26')]);}return _0x60be41[_0xdaf9('0xf1')](_0x2b7135);}})[_0xdaf9('0x2c')](function(_0x3fc8f9){if(_0x3fc8f9){return _0x3fc8f9?{'count':_0x3fb6fa,'rows':_0x3fc8f9}:null;}})['then'](respondWithResult(_0x2879ec,null))[_0xdaf9('0x22')](handleError(_0x2879ec,null));};exports[_0xdaf9('0xf3')]=function(_0x3d3873,_0x33b40f){var _0x4f398f={'raw':!![],'where':{}};var _0x1f7623={};var _0x490e43={'count':0x0,'rows':[]};return db['User']['findOne']({'where':{'id':_0x3d3873[_0xdaf9('0x65')]['id']}})[_0xdaf9('0x2c')](handleEntityNotFound(_0x33b40f,null))[_0xdaf9('0x2c')](function(_0x1b23e0){if(_0x1b23e0){_0x1f7623[_0xdaf9('0x56')]=_[_0xdaf9('0x58')](db[_0xdaf9('0xf4')][_0xdaf9('0x42')]);_0x1f7623['query']=_[_0xdaf9('0x58')](_0x3d3873[_0xdaf9('0x46')]);_0x1f7623['filters']=_[_0xdaf9('0x5a')](_0x1f7623['model'],_0x1f7623[_0xdaf9('0x46')]);_0x4f398f[_0xdaf9('0x4b')]=_[_0xdaf9('0x5a')](_0x1f7623[_0xdaf9('0x56')],qs[_0xdaf9('0x5b')](_0x3d3873['query'][_0xdaf9('0x5b')]));_0x4f398f[_0xdaf9('0x4b')]=_0x4f398f['attributes'][_0xdaf9('0x75')]?_0x4f398f[_0xdaf9('0x4b')]:_0x1f7623[_0xdaf9('0x56')];if(!_0x3d3873['query'][_0xdaf9('0xde')](_0xdaf9('0xe3'))){_0x4f398f['limit']=qs[_0xdaf9('0x28')](_0x3d3873[_0xdaf9('0x46')][_0xdaf9('0x28')]);_0x4f398f['offset']=qs[_0xdaf9('0x26')](_0x3d3873[_0xdaf9('0x46')]['offset']);}_0x4f398f[_0xdaf9('0xda')]=qs[_0xdaf9('0xdb')](_0x3d3873['query'][_0xdaf9('0xdb')]);_0x4f398f[_0xdaf9('0xdc')]=qs[_0xdaf9('0x59')](_[_0xdaf9('0xdd')](_0x3d3873[_0xdaf9('0x46')],_0x1f7623[_0xdaf9('0x59')]));_0x4f398f[_0xdaf9('0xdc')][_0xdaf9('0xec')]=_0x1b23e0['id'];if(_0x3d3873[_0xdaf9('0x46')][_0xdaf9('0x38')]){_0x4f398f[_0xdaf9('0xdc')]=_[_0xdaf9('0x5c')](_0x4f398f[_0xdaf9('0xdc')],{'$or':_['map'](_0x4f398f[_0xdaf9('0x4b')],function(_0x359f0f){var _0xed7f57={};_0xed7f57[_0x359f0f]={'$like':'%'+_0x3d3873['query'][_0xdaf9('0x38')]+'%'};return _0xed7f57;})});}_0x4f398f=_['merge']({},_0x4f398f,_0x3d3873[_0xdaf9('0x5d')]);return db[_0xdaf9('0xf4')][_0xdaf9('0x29')]({'where':_0x4f398f[_0xdaf9('0xdc')]})[_0xdaf9('0x2c')](function(_0x4d77b6){_0x490e43[_0xdaf9('0x29')]=_0x4d77b6;if(_0x3d3873['query'][_0xdaf9('0x47')]){_0x4f398f[_0xdaf9('0x48')]=[{'all':!![]}];}return db[_0xdaf9('0xf4')][_0xdaf9('0x4d')](_0x4f398f);})[_0xdaf9('0x2c')](function(_0xf310d0){_0x490e43['rows']=_0xf310d0;return _0x490e43;});}})[_0xdaf9('0x2c')](respondWithFilteredResult(_0x33b40f,_0x4f398f))['catch'](handleError(_0x33b40f,null));};exports['getSmsInteractions']=function(_0x552f85,_0x241b71){var _0x4ae32f={};var _0xdb2f3a={};var _0x40689e;var _0x39eb12;return db['User'][_0xdaf9('0xa1')]({'where':{'id':_0x552f85[_0xdaf9('0x65')]['id']}})[_0xdaf9('0x2c')](handleEntityNotFound(_0x241b71,null))[_0xdaf9('0x2c')](function(_0x5bb975){if(_0x5bb975){_0x40689e=_0x5bb975;_0xdb2f3a[_0xdaf9('0x56')]=_['keys'](db[_0xdaf9('0xf5')][_0xdaf9('0x42')]);_0xdb2f3a[_0xdaf9('0x46')]=_['keys'](_0x552f85[_0xdaf9('0x46')]);_0xdb2f3a[_0xdaf9('0x59')]=_[_0xdaf9('0x5a')](_0xdb2f3a[_0xdaf9('0x56')],_0xdb2f3a[_0xdaf9('0x46')]);_0x4ae32f['attributes']=_[_0xdaf9('0x5a')](_0xdb2f3a[_0xdaf9('0x56')],qs['fields'](_0x552f85[_0xdaf9('0x46')][_0xdaf9('0x5b')]));_0x4ae32f[_0xdaf9('0x4b')]=_0x4ae32f['attributes']['length']?_0x4ae32f[_0xdaf9('0x4b')]:_0xdb2f3a['model'];_0x4ae32f[_0xdaf9('0xda')]=qs[_0xdaf9('0xdb')](_0x552f85[_0xdaf9('0x46')][_0xdaf9('0xdb')]);_0x4ae32f['where']=qs['filters'](_[_0xdaf9('0xdd')](_0x552f85[_0xdaf9('0x46')],_0xdb2f3a[_0xdaf9('0x59')]));if(_0x552f85['query'][_0xdaf9('0x38')]){_0x4ae32f[_0xdaf9('0xdc')]=_[_0xdaf9('0x5c')](_0x4ae32f[_0xdaf9('0xdc')],{'$or':_['map'](_0x4ae32f[_0xdaf9('0x4b')],function(_0x52e75a){var _0xbdc172={};_0xbdc172[_0x52e75a]={'$like':'%'+_0x552f85[_0xdaf9('0x46')][_0xdaf9('0x38')]+'%'};return _0xbdc172;})});}_0x4ae32f=_[_0xdaf9('0x5c')]({},_0x4ae32f,_0x552f85['options']);return _0x40689e[_0xdaf9('0xf6')](_0x4ae32f);}})['then'](function(_0x5f49f5){if(_0x5f49f5){_0x39eb12=_0x5f49f5[_0xdaf9('0x75')];if(!_0x552f85[_0xdaf9('0x46')][_0xdaf9('0xde')](_0xdaf9('0xe3'))){_0x4ae32f[_0xdaf9('0x28')]=qs[_0xdaf9('0x28')](_0x552f85[_0xdaf9('0x46')][_0xdaf9('0x28')]);_0x4ae32f['offset']=qs[_0xdaf9('0x26')](_0x552f85[_0xdaf9('0x46')][_0xdaf9('0x26')]);}return _0x40689e[_0xdaf9('0xf6')](_0x4ae32f);}})[_0xdaf9('0x2c')](function(_0x53c73e){if(_0x53c73e){return _0x53c73e?{'count':_0x39eb12,'rows':_0x53c73e}:null;}})[_0xdaf9('0x2c')](respondWithResult(_0x241b71,null))['catch'](handleError(_0x241b71,null));};exports[_0xdaf9('0xf7')]=function(_0x500e21,_0x2c7d5e){var _0x2a0bb9={};var _0x4d791e={};var _0x4d0ac1;var _0x46fb12;return db[_0xdaf9('0x41')][_0xdaf9('0xa1')]({'where':{'id':_0x500e21['params']['id']}})[_0xdaf9('0x2c')](handleEntityNotFound(_0x2c7d5e,null))[_0xdaf9('0x2c')](function(_0x349dce){if(_0x349dce){_0x4d0ac1=_0x349dce;_0x4d791e[_0xdaf9('0x56')]=_['keys'](db['FaxInteraction'][_0xdaf9('0x42')]);_0x4d791e[_0xdaf9('0x46')]=_[_0xdaf9('0x58')](_0x500e21[_0xdaf9('0x46')]);_0x4d791e[_0xdaf9('0x59')]=_[_0xdaf9('0x5a')](_0x4d791e[_0xdaf9('0x56')],_0x4d791e[_0xdaf9('0x46')]);_0x2a0bb9[_0xdaf9('0x4b')]=_[_0xdaf9('0x5a')](_0x4d791e['model'],qs[_0xdaf9('0x5b')](_0x500e21['query']['fields']));_0x2a0bb9[_0xdaf9('0x4b')]=_0x2a0bb9[_0xdaf9('0x4b')][_0xdaf9('0x75')]?_0x2a0bb9[_0xdaf9('0x4b')]:_0x4d791e[_0xdaf9('0x56')];_0x2a0bb9[_0xdaf9('0xda')]=qs['sort'](_0x500e21[_0xdaf9('0x46')][_0xdaf9('0xdb')]);_0x2a0bb9[_0xdaf9('0xdc')]=qs['filters'](_['pick'](_0x500e21[_0xdaf9('0x46')],_0x4d791e[_0xdaf9('0x59')]));if(_0x500e21[_0xdaf9('0x46')][_0xdaf9('0x38')]){_0x2a0bb9[_0xdaf9('0xdc')]=_[_0xdaf9('0x5c')](_0x2a0bb9[_0xdaf9('0xdc')],{'$or':_['map'](_0x2a0bb9['attributes'],function(_0xf4774a){var _0x1726e0={};_0x1726e0[_0xf4774a]={'$like':'%'+_0x500e21[_0xdaf9('0x46')][_0xdaf9('0x38')]+'%'};return _0x1726e0;})});}_0x2a0bb9=_[_0xdaf9('0x5c')]({},_0x2a0bb9,_0x500e21[_0xdaf9('0x5d')]);return _0x4d0ac1[_0xdaf9('0xf7')](_0x2a0bb9);}})[_0xdaf9('0x2c')](function(_0x23fe51){if(_0x23fe51){_0x46fb12=_0x23fe51['length'];if(!_0x500e21['query'][_0xdaf9('0xde')](_0xdaf9('0xe3'))){_0x2a0bb9[_0xdaf9('0x28')]=qs[_0xdaf9('0x28')](_0x500e21[_0xdaf9('0x46')][_0xdaf9('0x28')]);_0x2a0bb9['offset']=qs[_0xdaf9('0x26')](_0x500e21[_0xdaf9('0x46')][_0xdaf9('0x26')]);}return _0x4d0ac1[_0xdaf9('0xf7')](_0x2a0bb9);}})[_0xdaf9('0x2c')](function(_0x5ddf3e){if(_0x5ddf3e){return _0x5ddf3e?{'count':_0x46fb12,'rows':_0x5ddf3e}:null;}})[_0xdaf9('0x2c')](respondWithResult(_0x2c7d5e,null))[_0xdaf9('0x22')](handleError(_0x2c7d5e,null));};exports[_0xdaf9('0xf8')]=function(_0x57eccc,_0x59a2e4){var _0x1565b2={};var _0x258b0e={};var _0x43eb34;var _0x3426cd;return db['User'][_0xdaf9('0xa1')]({'where':{'id':_0x57eccc['params']['id']}})[_0xdaf9('0x2c')](handleEntityNotFound(_0x59a2e4,null))['then'](function(_0x328937){if(_0x328937){_0x43eb34=_0x328937;_0x258b0e['model']=_[_0xdaf9('0x58')](db[_0xdaf9('0xf9')][_0xdaf9('0x42')]);_0x258b0e[_0xdaf9('0x46')]=_['keys'](_0x57eccc['query']);_0x258b0e[_0xdaf9('0x59')]=_[_0xdaf9('0x5a')](_0x258b0e[_0xdaf9('0x56')],_0x258b0e[_0xdaf9('0x46')]);_0x1565b2['attributes']=_[_0xdaf9('0x5a')](_0x258b0e[_0xdaf9('0x56')],qs[_0xdaf9('0x5b')](_0x57eccc[_0xdaf9('0x46')][_0xdaf9('0x5b')]));_0x1565b2[_0xdaf9('0x4b')]=_0x1565b2[_0xdaf9('0x4b')][_0xdaf9('0x75')]?_0x1565b2[_0xdaf9('0x4b')]:_0x258b0e['model'];_0x1565b2[_0xdaf9('0xda')]=qs[_0xdaf9('0xdb')](_0x57eccc[_0xdaf9('0x46')][_0xdaf9('0xdb')]);_0x1565b2[_0xdaf9('0xdc')]=qs[_0xdaf9('0x59')](_['pick'](_0x57eccc['query'],_0x258b0e[_0xdaf9('0x59')]));if(_0x57eccc[_0xdaf9('0x46')]['filter']){_0x1565b2[_0xdaf9('0xdc')]=_[_0xdaf9('0x5c')](_0x1565b2[_0xdaf9('0xdc')],{'$or':_[_0xdaf9('0x39')](_0x1565b2['attributes'],function(_0x586da2){var _0x368bb2={};_0x368bb2[_0x586da2]={'$like':'%'+_0x57eccc[_0xdaf9('0x46')]['filter']+'%'};return _0x368bb2;})});}_0x1565b2=_[_0xdaf9('0x5c')]({},_0x1565b2,_0x57eccc[_0xdaf9('0x5d')]);return _0x43eb34[_0xdaf9('0xf8')](_0x1565b2);}})[_0xdaf9('0x2c')](function(_0x4d125a){if(_0x4d125a){_0x3426cd=_0x4d125a[_0xdaf9('0x75')];if(!_0x57eccc[_0xdaf9('0x46')]['hasOwnProperty'](_0xdaf9('0xe3'))){_0x1565b2[_0xdaf9('0x28')]=qs['limit'](_0x57eccc[_0xdaf9('0x46')][_0xdaf9('0x28')]);_0x1565b2[_0xdaf9('0x26')]=qs['offset'](_0x57eccc[_0xdaf9('0x46')][_0xdaf9('0x26')]);}return _0x43eb34[_0xdaf9('0xf8')](_0x1565b2);}})['then'](function(_0x26a10c){if(_0x26a10c){return _0x26a10c?{'count':_0x3426cd,'rows':_0x26a10c}:null;}})[_0xdaf9('0x2c')](respondWithResult(_0x59a2e4,null))[_0xdaf9('0x22')](handleError(_0x59a2e4,null));};exports['login']=function(_0x23f9cb,_0x2cd886,_0xb62232){var _0x148eeb;var _0x397a84;var _0x145e4c;var _0x8860c8=!_[_0xdaf9('0x6f')](_0x23f9cb['params']['id'])?_0x23f9cb[_0xdaf9('0x65')]['id']:!_[_0xdaf9('0x6f')](_0x23f9cb['user']['id'])?_0x23f9cb['user']['id']:null;return db[_0xdaf9('0x41')][_0xdaf9('0x5e')]({'where':{'id':_0x8860c8,'role':{'$or':['admin',_0xdaf9('0x33'),'agent']}},'attributes':['id','name',_0xdaf9('0xfa'),'mobile',_0xdaf9('0x31'),_0xdaf9('0x6a'),_0xdaf9('0xab')]})[_0xdaf9('0x2c')](function(_0x4c56ea){if(_0x4c56ea){if(_0x4c56ea[_0xdaf9('0x31')]===_0xdaf9('0x35')){_0x148eeb=_0x4c56ea;if(_0x23f9cb[_0xdaf9('0x64')]['interface']){_0x145e4c=util[_0xdaf9('0xb8')](_0xdaf9('0xfb'),_0x148eeb[_0x23f9cb[_0xdaf9('0x64')][_0xdaf9('0xad')]]);}else if(_0x23f9cb[_0xdaf9('0x64')][_0xdaf9('0xfc')]){_0x145e4c=util[_0xdaf9('0xb8')](_0xdaf9('0xb9'),_0x23f9cb['body'][_0xdaf9('0xfc')]);}else{_0x145e4c=util[_0xdaf9('0xb8')]('SIP/%s',_0x148eeb[_0xdaf9('0x3c')]);}socket['to'](util[_0xdaf9('0xb8')](_0xdaf9('0xfd'),_0x148eeb[_0xdaf9('0x3c')]))[_0xdaf9('0x2d')]('user:forcelogout',{'user':{'id':_0x148eeb['id'],'name':_0x148eeb[_0xdaf9('0x3c')]},'ip':_0x23f9cb['headers'][_0xdaf9('0xfe')]||_0x23f9cb[_0xdaf9('0xff')][_0xdaf9('0x100')]||_0x23f9cb['socket'][_0xdaf9('0x100')]||_0x23f9cb[_0xdaf9('0xff')]['socket']['remoteAddress']});return db[_0xdaf9('0xc0')][_0xdaf9('0x2f')]({'where':{'membername':_0x148eeb['name']},'individualHooks':!![]});}}else{throw new db[(_0xdaf9('0x9c'))][(_0xdaf9('0x9d'))](_0xdaf9('0x101'));}})[_0xdaf9('0x2c')](function(){if(_0x148eeb){return _0x148eeb[_0xdaf9('0x102')]({'raw':!![]});}})[_0xdaf9('0x2c')](function(_0x225ade){if(_0x148eeb){var _0x4a37d2=[];if(_0x225ade){_0x397a84=_0x225ade;if(_0x397a84['length']){for(var _0x1a7749=0x0;_0x1a7749<_0x397a84[_0xdaf9('0x75')];_0x1a7749++){_0x4a37d2['push']({'membername':_0x148eeb[_0xdaf9('0x3c')],'UserId':_0x148eeb['id'],'queue_name':_0x397a84[_0x1a7749][_0xdaf9('0x3c')],'VoiceQueueId':_0x397a84[_0x1a7749]['id'],'interface':_0x145e4c,'paused':_0x148eeb[_0xdaf9('0xab')]||![],'penalty':_0x397a84[_0x1a7749][_0xdaf9('0x103')]||0x0});}return BPromise[_0xdaf9('0x95')](_0x4a37d2,function(_0x2efc6a){return db[_0xdaf9('0xc0')][_0xdaf9('0xba')](_0x2efc6a);});}}}})[_0xdaf9('0x2c')](function(){if(_0x148eeb){return db[_0xdaf9('0x104')]['findAll']({'where':{'membername':_0x148eeb[_0xdaf9('0x3c')],'exitAt':null}});}})[_0xdaf9('0x2c')](function(_0x13e5b0){if(_0x148eeb){var _0x456f13=[];_0x13e5b0['forEach'](function(_0x4cdfe9){_0x456f13[_0xdaf9('0x4c')](_0x4cdfe9['update']({'exitAt':moment()['format'](_0xdaf9('0x105'))}));});return BPromise[_0xdaf9('0x54')](_0x456f13);}})[_0xdaf9('0x2c')](function(){if(_0x148eeb){var _0x14474a=[];var _0x28299d=[];var _0x58b06d=utils['getChannels']();var _0x13e6a1={'membername':_0x148eeb[_0xdaf9('0x3c')],'interface':_0x145e4c,'enterAt':moment()['format'](_0xdaf9('0x105')),'role':_0x148eeb[_0xdaf9('0x31')],'internal':_0x148eeb['internal']};_0x58b06d[_0xdaf9('0x106')](function(_0x4ce17d){_0x14474a[_0xdaf9('0x4c')](_['merge']({'channel':_0x4ce17d,'type':_0xdaf9('0x107'),'data1':_0x23f9cb[_0xdaf9('0x64')][_0xdaf9('0x108')],'data2':_0x145e4c},_0x13e6a1));if(_0x148eeb[_0xdaf9('0xab')]){_0x28299d[_0xdaf9('0x4c')](_[_0xdaf9('0x5c')]({'channel':_0x4ce17d,'type':_0xdaf9('0x109'),'data1':'LOGININPAUSE'},_0x13e6a1));}});return db['MemberReport'][_0xdaf9('0x91')](_0x14474a['concat'](_0x28299d),{'individualHooks':!![]});}})[_0xdaf9('0x2c')](function(){if(_0x148eeb){return _0x148eeb['update']({'online':!![],'lastLoginAt':moment()[_0xdaf9('0xb8')](_0xdaf9('0x105')),'voicePause':_0x148eeb[_0xdaf9('0xab')]||![],'mailPause':_0x148eeb[_0xdaf9('0xab')]||![],'chatPause':_0x148eeb[_0xdaf9('0xab')]||![],'faxPause':_0x148eeb[_0xdaf9('0xab')]||![],'smsPause':_0x148eeb[_0xdaf9('0xab')]||![],'openchannelPause':_0x148eeb[_0xdaf9('0xab')]||![],'whatsappPause':_0x148eeb[_0xdaf9('0xab')]||![],'pauseType':_0x148eeb[_0xdaf9('0xab')]?_0xdaf9('0x10a'):null,'interface':_0x145e4c,'lastPauseAt':moment()[_0xdaf9('0xb8')](_0xdaf9('0x105'))});}})[_0xdaf9('0x2c')](function(_0x2fd999){if(_0x23f9cb[_0xdaf9('0x10b')]){return _0xb62232();}else{return BPromise['resolve'](_0x2fd999)['then'](respondWithResult(_0x2cd886,null));}})[_0xdaf9('0x22')](handleError(_0x2cd886,null));};exports[_0xdaf9('0x10c')]=function(_0x10b6f6,_0x4dfc5b){var _0x2e30cb;return db[_0xdaf9('0x41')][_0xdaf9('0x5e')]({'where':{'id':_0x10b6f6['params']['id'],'role':_0xdaf9('0x35')},'attributes':['id',_0xdaf9('0x3c'),'role']})[_0xdaf9('0x2c')](handleEntityNotFound(_0x4dfc5b,null))[_0xdaf9('0x2c')](function(_0x15bbe1){if(_0x15bbe1){_0x2e30cb=_0x15bbe1;return db[_0xdaf9('0xc0')][_0xdaf9('0x2f')]({'where':{'membername':_0x2e30cb[_0xdaf9('0x3c')]},'individualHooks':!![]});}})[_0xdaf9('0x2c')](function(){return db[_0xdaf9('0x104')]['findAll']({'where':{'membername':_0x2e30cb[_0xdaf9('0x3c')],'exitAt':null}});})[_0xdaf9('0x2c')](function(_0x3a5d25){var _0x404817=[];_0x3a5d25[_0xdaf9('0x106')](function(_0x1b31d2){_0x404817[_0xdaf9('0x4c')](_0x1b31d2[_0xdaf9('0x63')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise['all'](_0x404817);})[_0xdaf9('0x2c')](function(){return _0x2e30cb['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0xdaf9('0x2c')](respondWithResult(_0x4dfc5b,null))['catch'](handleError(_0x4dfc5b,null));};exports[_0xdaf9('0x10d')]=function(_0x54ea7f,_0x25acbc){var _0x401a0c;return db[_0xdaf9('0xc0')]['update']({'paused':0x1},{'where':{'UserId':_0x54ea7f[_0xdaf9('0x65')]['id']},'individualHooks':!![]})[_0xdaf9('0x2c')](function(){return db['User'][_0xdaf9('0x5e')]({'where':{'id':_0x54ea7f[_0xdaf9('0x65')]['id'],'role':'agent'},'attributes':['id','name',_0xdaf9('0x31'),_0xdaf9('0x6a'),'interface']});})['then'](handleEntityNotFound(_0x25acbc,null))[_0xdaf9('0x2c')](function(_0x2d5baf){if(_0x2d5baf){_0x401a0c=_0x2d5baf;return respondWithRpcPromise(_0xdaf9('0x10e'),'pause',{'id':_0x401a0c['id'],'name':_0x401a0c[_0xdaf9('0x3c')],'pause':!![]});}})['then'](function(){if(_0x401a0c){return db[_0xdaf9('0x104')][_0xdaf9('0x4d')]({'where':{'membername':_0x401a0c['name'],'type':_0xdaf9('0x109'),'exitAt':null}});}})[_0xdaf9('0x2c')](function(_0x3f47fb){if(_0x3f47fb[_0xdaf9('0x75')]){var _0x837ad=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');for(var _0x4ab283=0x0,_0x4ff649=_0x3f47fb[_0xdaf9('0x75')];_0x4ab283<_0x4ff649;_0x4ab283++){_0x3f47fb[_0x4ab283][_0xdaf9('0x10f')]({'exitAt':_0x837ad});}}})[_0xdaf9('0x2c')](function(){var _0x54fd46=[];var _0x35c24c=utils[_0xdaf9('0x110')]();_0x35c24c[_0xdaf9('0x106')](function(_0x4c29bf){_0x54fd46[_0xdaf9('0x4c')]({'channel':_0x4c29bf,'membername':_0x401a0c[_0xdaf9('0x3c')],'interface':_[_0xdaf9('0x6f')](_0x401a0c[_0xdaf9('0xad')])?util['format'](_0xdaf9('0xb9'),_0x401a0c[_0xdaf9('0x3c')]):_0x401a0c[_0xdaf9('0xad')],'type':_0xdaf9('0x109'),'enterAt':moment()[_0xdaf9('0xb8')](_0xdaf9('0x105')),'data1':_0x54ea7f[_0xdaf9('0x64')][_0xdaf9('0x111')]||_0xdaf9('0x112'),'role':_0x401a0c['role'],'internal':_0x401a0c[_0xdaf9('0x6a')]});});return db[_0xdaf9('0x104')][_0xdaf9('0x91')](_0x54fd46,{'individualHooks':!![]});})[_0xdaf9('0x2c')](function(){return _0x401a0c[_0xdaf9('0x63')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x54ea7f['body'][_0xdaf9('0x111')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0xdaf9('0xb8')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0xdaf9('0x2c')](respondWithResult(_0x25acbc,null))['catch'](handleError(_0x25acbc,null));};exports[_0xdaf9('0x113')]=function(_0x58d997,_0x464f1b){var _0x4d4948;return db['User'][_0xdaf9('0x5e')]({'where':{'id':_0x58d997[_0xdaf9('0x65')]['id']},'attributes':['id',_0xdaf9('0x3c'),'role',_0xdaf9('0xac'),_0xdaf9('0x114'),_0xdaf9('0x115'),_0xdaf9('0x116'),_0xdaf9('0x117'),_0xdaf9('0x118'),_0xdaf9('0x119'),_0xdaf9('0x11a'),_0xdaf9('0x11b')]})['then'](handleEntityNotFound(_0x464f1b,null))[_0xdaf9('0x2c')](function(_0x562aa8){if(_0x562aa8){_0x4d4948=_0x562aa8;if(_0x58d997[_0xdaf9('0x64')][_0xdaf9('0xa9')]&&!utils['isValidChannel'](_0x58d997['body'][_0xdaf9('0xa9')])){throw new db[(_0xdaf9('0x9c'))][(_0xdaf9('0x9d'))]('Unknown\x20channel');}switch(_0x58d997[_0xdaf9('0x64')][_0xdaf9('0xa9')]){case _0xdaf9('0xb6'):return respondWithRpcPromise('QueuePause','unpause',{'id':_0x4d4948['id'],'name':_0x4d4948[_0xdaf9('0x3c')],'pause':![]})[_0xdaf9('0x2c')](function(){return db[_0xdaf9('0xc0')][_0xdaf9('0x63')]({'paused':0x0},{'where':{'UserId':_0x4d4948['id']},'individualHooks':!![]});})['then'](function(){return db['MemberReport']['find']({'where':{'channel':_0x58d997[_0xdaf9('0x64')]['channel'],'membername':_0x4d4948[_0xdaf9('0x3c')],'type':_0xdaf9('0x109'),'exitAt':null}});})[_0xdaf9('0x2c')](function(_0x4699ec){if(_0x4699ec){return _0x4699ec['update']({'exitAt':moment()[_0xdaf9('0xb8')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0xdaf9('0x11c')},{'individualHooks':!![]});}return null;})[_0xdaf9('0x2c')](function(){return _0x4d4948[_0xdaf9('0x63')]({'voicePause':![]});});case'mail':case _0xdaf9('0x60'):case'fax':case _0xdaf9('0x51'):case'whatsapp':case _0xdaf9('0x61'):return db['MemberReport'][_0xdaf9('0x5e')]({'where':{'channel':_0x58d997['body'][_0xdaf9('0xa9')],'membername':_0x4d4948[_0xdaf9('0x3c')],'type':_0xdaf9('0x109'),'exitAt':null}})[_0xdaf9('0x2c')](function(_0x142a7b){if(_0x142a7b){return _0x142a7b[_0xdaf9('0x63')]({'exitAt':moment()[_0xdaf9('0xb8')](_0xdaf9('0x105')),'data2':_0xdaf9('0x11c')},{'individualHooks':!![]});}return null;})[_0xdaf9('0x2c')](function(){var _0x4cc452={};_['set'](_0x4cc452,util[_0xdaf9('0xb8')](_0xdaf9('0x11d'),_0x58d997['body'][_0xdaf9('0xa9')],_0xdaf9('0x11e')),![]);return _0x4d4948[_0xdaf9('0x63')](_0x4cc452);});default:return respondWithRpcPromise(_0xdaf9('0x10e'),_0xdaf9('0x113'),{'id':_0x4d4948['id'],'name':_0x4d4948[_0xdaf9('0x3c')],'pause':![]})[_0xdaf9('0x2c')](function(){return db[_0xdaf9('0xc0')][_0xdaf9('0x63')]({'paused':0x0},{'where':{'UserId':_0x4d4948['id']}});})[_0xdaf9('0x2c')](function(){return db['MemberReport'][_0xdaf9('0x4d')]({'where':{'membername':_0x4d4948[_0xdaf9('0x3c')],'type':_0xdaf9('0x109'),'exitAt':null}});})[_0xdaf9('0x2c')](function(_0x49dbc4){var _0x13860d=[];_0x49dbc4['forEach'](function(_0x5bc065){_0x13860d['push'](_0x5bc065[_0xdaf9('0x63')]({'exitAt':moment()[_0xdaf9('0xb8')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0xdaf9('0x11c')}));});return BPromise[_0xdaf9('0x54')](_0x13860d);})[_0xdaf9('0x2c')](function(){return _0x4d4948[_0xdaf9('0x63')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0xdaf9('0x2c')](respondWithResult(_0x464f1b,null))[_0xdaf9('0x22')](handleError(_0x464f1b,null));};exports[_0xdaf9('0x11f')]=function(_0x24db20,_0x2fcdab){var _0x167d12={};var _0x1a2078={};var _0x39ac0f;var _0x710e73;return db['User'][_0xdaf9('0xa1')]({'where':{'id':_0x24db20[_0xdaf9('0x65')]['id']}})['then'](handleEntityNotFound(_0x2fcdab,null))[_0xdaf9('0x2c')](function(_0x9a16e5){if(_0x9a16e5){_0x39ac0f=_0x9a16e5;_0x1a2078['model']=_[_0xdaf9('0x58')](db[_0xdaf9('0x120')][_0xdaf9('0x42')]);_0x1a2078['query']=_['keys'](_0x24db20[_0xdaf9('0x46')]);_0x1a2078[_0xdaf9('0x59')]=_[_0xdaf9('0x5a')](_0x1a2078[_0xdaf9('0x56')],_0x1a2078[_0xdaf9('0x46')]);_0x167d12[_0xdaf9('0x4b')]=_['intersection'](_0x1a2078[_0xdaf9('0x56')],qs['fields'](_0x24db20[_0xdaf9('0x46')]['fields']));_0x167d12[_0xdaf9('0x4b')]=_0x167d12[_0xdaf9('0x4b')][_0xdaf9('0x75')]?_0x167d12[_0xdaf9('0x4b')]:_0x1a2078['model'];_0x167d12['order']=qs[_0xdaf9('0xdb')](_0x24db20[_0xdaf9('0x46')][_0xdaf9('0xdb')]);_0x167d12[_0xdaf9('0xdc')]=qs[_0xdaf9('0x59')](_[_0xdaf9('0xdd')](_0x24db20['query'],_0x1a2078[_0xdaf9('0x59')]));if(_0x24db20[_0xdaf9('0x46')]['filter']){_0x167d12['where']=_[_0xdaf9('0x5c')](_0x167d12[_0xdaf9('0xdc')],{'$or':_[_0xdaf9('0x39')](_0x167d12['attributes'],function(_0x35d07e){var _0xb8d5f4={};_0xb8d5f4[_0x35d07e]={'$like':'%'+_0x24db20[_0xdaf9('0x46')]['filter']+'%'};return _0xb8d5f4;})});}_0x167d12=_[_0xdaf9('0x5c')]({},_0x167d12,_0x24db20[_0xdaf9('0x5d')]);return _0x39ac0f['getTeams'](_0x167d12);}})['then'](function(_0x5507a8){if(_0x5507a8){_0x710e73=_0x5507a8[_0xdaf9('0x75')];if(!_0x24db20['query'][_0xdaf9('0xde')](_0xdaf9('0xe3'))){_0x167d12[_0xdaf9('0x28')]=qs[_0xdaf9('0x28')](_0x24db20[_0xdaf9('0x46')][_0xdaf9('0x28')]);_0x167d12['offset']=qs[_0xdaf9('0x26')](_0x24db20['query']['offset']);}return _0x39ac0f[_0xdaf9('0x11f')](_0x167d12);}})[_0xdaf9('0x2c')](function(_0x3c27e2){if(_0x3c27e2){return _0x3c27e2?{'count':_0x710e73,'rows':_0x3c27e2}:null;}})[_0xdaf9('0x2c')](respondWithResult(_0x2fcdab,null))[_0xdaf9('0x22')](handleError(_0x2fcdab,null));};exports[_0xdaf9('0x121')]=function(_0x9b5fc4,_0x3f8384){var _0x2957f3=_0x9b5fc4[_0xdaf9('0x65')]['id'];var _0x5446b8=_0x9b5fc4[_0xdaf9('0x64')]?_0x9b5fc4[_0xdaf9('0x64')][_0xdaf9('0x68')]:null;var _0x55e938=[];return Promise[_0xdaf9('0x122')]()[_0xdaf9('0x2c')](function(){if(!_0x5446b8)throw new APIBadRequestError(_0xdaf9('0x123'));})[_0xdaf9('0x2c')](function(){return db[_0xdaf9('0x41')]['findOne']({'where':{'id':_0x2957f3}});})[_0xdaf9('0x2c')](function(_0x2264d2){if(!_0x2264d2)throw new APINotFoundError(util[_0xdaf9('0xb8')](_0xdaf9('0x124'),_0x9b5fc4[_0xdaf9('0x65')]['id']));return db['sequelize'][_0xdaf9('0x125')](function(_0x5f1b40){return _0x2264d2['addTeams'](_0x5446b8,{'transaction':_0x5f1b40})[_0xdaf9('0x2c')](function(){return db[_0xdaf9('0x120')][_0xdaf9('0x4d')]({'where':{'id':{'$in':_0x5446b8}}});})[_0xdaf9('0x2c')](function(_0x45401f){var _0x3403c8=_[_0xdaf9('0x39')](_0x45401f,function(_0x31228e){return _0x31228e[_0xdaf9('0x126')]();});return Promise[_0xdaf9('0x54')](_0x3403c8);})[_0xdaf9('0x2c')](function(_0x244252){_0x55e938=_['flattenDeep'](_0x244252);var _0x35116c=_[_0xdaf9('0x39')](_0x55e938,function(_0x30faab){return _0x30faab[_0xdaf9('0x127')](_0x2264d2['id'],{'transaction':_0x5f1b40});});return Promise[_0xdaf9('0x54')](_0x35116c);})[_0xdaf9('0x2c')](function(){if(!_0x2264d2[_0xdaf9('0xaa')])return;var _0x2184eb=_['filter'](_0x55e938,function(_0x17fc0a){return _0x17fc0a[_0xdaf9('0x128')](_0xdaf9('0xa9'))===_0xdaf9('0x129');});var _0x39dca4=_[_0xdaf9('0x39')](_0x2184eb,function(_0x266c26){return db[_0xdaf9('0xc0')][_0xdaf9('0xba')]({'membername':_0x2264d2[_0xdaf9('0x3c')],'UserId':_0x2264d2['id'],'queue_name':_0x266c26[_0xdaf9('0x3c')],'VoiceQueueId':_0x266c26['id'],'interface':_[_0xdaf9('0x6f')](_0x2264d2[_0xdaf9('0xad')])?util[_0xdaf9('0xb8')](_0xdaf9('0xb9'),_0x2264d2[_0xdaf9('0x3c')]):_0x2264d2[_0xdaf9('0xad')],'paused':_0x2264d2[_0xdaf9('0xac')]||![],'penalty':_0x2264d2[_0xdaf9('0xb3')]},{'transaction':_0x5f1b40});});return Promise['all'](_0x39dca4);})[_0xdaf9('0x2c')](function(){return db[_0xdaf9('0x12a')]['findAll']({'where':{'teamId':{'$in':_0x5446b8}}});})[_0xdaf9('0x2c')](function(_0x26c57b){var _0x55be16=_[_0xdaf9('0x39')](_0x26c57b,function(_0x57514f){return db['UserVoicePrefix'][_0xdaf9('0x89')]({'UserId':_0x2264d2['id'],'VoicePrefixId':_0x57514f[_0xdaf9('0x12b')]},{'transaction':_0x5f1b40});});return Promise[_0xdaf9('0x54')](_0x55be16);});});})[_0xdaf9('0x2c')](function(){for(var _0x3942f8=0x0;_0x3942f8<_0x55e938['length'];_0x3942f8++){var _0x56d678=_0x55e938[_0x3942f8][_0xdaf9('0x128')](_0xdaf9('0xa9'));var _0x32a1db=_0x56d678+_0xdaf9('0xb5');socket['emit'](_0xdaf9('0x33')+_0x56d678+'Queue:save',{'UserId':_0x2957f3,['queueField']:_0x55e938[_0x3942f8]['id']});}})[_0xdaf9('0x2c')](respondWithStatusCode(_0x3f8384,null))['catch'](APIHandleError(_0x3f8384));};exports[_0xdaf9('0x12c')]=function(_0x4e2bbd,_0x4bf80d){var _0x5ce99b=_0x4e2bbd['params']['id'];var _0x5230bf=null;if(_0x4e2bbd['query'][_0xdaf9('0x68')]){_0x5230bf=_[_0xdaf9('0xbe')](_0x4e2bbd[_0xdaf9('0x46')][_0xdaf9('0x68')])?_0x4e2bbd[_0xdaf9('0x46')][_0xdaf9('0x68')]:[_0x4e2bbd[_0xdaf9('0x46')][_0xdaf9('0x68')]];}var _0x495783=[];return Promise[_0xdaf9('0x122')]()['then'](function(){if(!_0x5230bf)throw new APIBadRequestError('Query\x20parameter\x20\x27ids\x27\x20is\x20required');})[_0xdaf9('0x2c')](function(){return db[_0xdaf9('0x41')][_0xdaf9('0xa1')]({'where':{'id':_0x5ce99b}});})[_0xdaf9('0x2c')](function(_0x330bea){if(!_0x330bea)throw new APINotFoundError(util[_0xdaf9('0xb8')](_0xdaf9('0x124'),_0x4e2bbd['params']['id']));return db[_0xdaf9('0x71')][_0xdaf9('0x125')](function(_0x528b8c){return _0x330bea['removeTeams'](_0x5230bf,{'transaction':_0x528b8c})['then'](function(){return db[_0xdaf9('0x120')][_0xdaf9('0x4d')]({'where':{'id':{'$in':_0x5230bf}}});})['then'](function(_0x3166f9){var _0x457e79=_[_0xdaf9('0x39')](_0x3166f9,function(_0x21f36d){return _0x21f36d[_0xdaf9('0x126')]();});return Promise[_0xdaf9('0x54')](_0x457e79);})[_0xdaf9('0x2c')](function(_0xc7c2d1){_0x495783=_[_0xdaf9('0x12d')](_0xc7c2d1);var _0x55cfd6=_['map'](_0x495783,function(_0x502d39){return _0x502d39[_0xdaf9('0x12e')](_0x330bea['id'],{'transaction':_0x528b8c});});return Promise[_0xdaf9('0x54')](_0x55cfd6);})[_0xdaf9('0x2c')](function(){if(!_0x330bea[_0xdaf9('0xaa')])return;var _0x151911=_[_0xdaf9('0x38')](_0x495783,function(_0x4908b7){return _0x4908b7[_0xdaf9('0x128')]('channel')===_0xdaf9('0x129');});var _0x3ef248=_[_0xdaf9('0x39')](_0x151911,function(_0x340da3){return db[_0xdaf9('0xc0')][_0xdaf9('0x2f')]({'where':{'VoiceQueueId':_0x340da3['id'],'UserId':_0x330bea['id']},'transaction':_0x528b8c});});return Promise[_0xdaf9('0x54')](_0x3ef248);})[_0xdaf9('0x2c')](function(){return db['TeamVoicePrefix'][_0xdaf9('0x4d')]({'where':{'teamId':{'$in':_0x5230bf}}});})['then'](function(_0x388309){var _0x139480=_[_0xdaf9('0x39')](_0x388309,function(_0x39b46b){return db[_0xdaf9('0x12f')][_0xdaf9('0x2f')]({'where':{'UserId':_0x330bea['id'],'VoicePrefixId':_0x39b46b[_0xdaf9('0x12b')]}},{'transaction':_0x528b8c});});return Promise[_0xdaf9('0x54')](_0x139480);});});})[_0xdaf9('0x2c')](function(){for(var _0x402004=0x0;_0x402004<_0x495783[_0xdaf9('0x75')];_0x402004++){var _0xbddd87=_0x495783[_0x402004][_0xdaf9('0x128')]('channel');var _0x15e3de=_0xbddd87+_0xdaf9('0xb5');socket['emit'](_0xdaf9('0x33')+_0xbddd87+_0xdaf9('0xbf'),{'UserId':_0x5ce99b,['queueField']:_0x495783[_0x402004]['id']});}})['then'](respondWithStatusCode(_0x4bf80d,null))[_0xdaf9('0x22')](APIHandleError(_0x4bf80d));};exports['getLists']=function(_0x29f6c2,_0xc36474){var _0x32bd5e={};var _0x373fb5={};var _0x3696f6;var _0x1d9a20;return db['User'][_0xdaf9('0xa1')]({'where':{'id':_0x29f6c2[_0xdaf9('0x65')]['id']}})[_0xdaf9('0x2c')](handleEntityNotFound(_0xc36474,null))[_0xdaf9('0x2c')](function(_0x5632a9){if(_0x5632a9){_0x3696f6=_0x5632a9;_0x373fb5['model']=_['keys'](db[_0xdaf9('0x130')][_0xdaf9('0x42')]);_0x373fb5[_0xdaf9('0x46')]=_['keys'](_0x29f6c2[_0xdaf9('0x46')]);_0x373fb5[_0xdaf9('0x59')]=_['intersection'](_0x373fb5[_0xdaf9('0x56')],_0x373fb5[_0xdaf9('0x46')]);_0x32bd5e[_0xdaf9('0x4b')]=_['intersection'](_0x373fb5[_0xdaf9('0x56')],qs[_0xdaf9('0x5b')](_0x29f6c2['query']['fields']));_0x32bd5e['attributes']=_0x32bd5e['attributes'][_0xdaf9('0x75')]?_0x32bd5e[_0xdaf9('0x4b')]:_0x373fb5[_0xdaf9('0x56')];_0x32bd5e[_0xdaf9('0xda')]=qs[_0xdaf9('0xdb')](_0x29f6c2['query'][_0xdaf9('0xdb')]);_0x32bd5e[_0xdaf9('0xdc')]=qs[_0xdaf9('0x59')](_[_0xdaf9('0xdd')](_0x29f6c2[_0xdaf9('0x46')],_0x373fb5[_0xdaf9('0x59')]));if(_0x29f6c2['query'][_0xdaf9('0x38')]){_0x32bd5e['where']=_[_0xdaf9('0x5c')](_0x32bd5e['where'],{'$or':_[_0xdaf9('0x39')](_0x32bd5e[_0xdaf9('0x4b')],function(_0x5943fb){var _0x16c60d={};_0x16c60d[_0x5943fb]={'$like':'%'+_0x29f6c2[_0xdaf9('0x46')][_0xdaf9('0x38')]+'%'};return _0x16c60d;})});}_0x32bd5e=_[_0xdaf9('0x5c')]({},_0x32bd5e,_0x29f6c2[_0xdaf9('0x5d')]);return _0x3696f6[_0xdaf9('0x131')](_0x32bd5e);}})['then'](function(_0x5d77d7){if(_0x5d77d7){_0x1d9a20=_0x5d77d7[_0xdaf9('0x75')];if(!_0x29f6c2[_0xdaf9('0x46')][_0xdaf9('0xde')](_0xdaf9('0xe3'))){_0x32bd5e[_0xdaf9('0x28')]=qs[_0xdaf9('0x28')](_0x29f6c2[_0xdaf9('0x46')][_0xdaf9('0x28')]);_0x32bd5e[_0xdaf9('0x26')]=qs['offset'](_0x29f6c2['query'][_0xdaf9('0x26')]);}return _0x3696f6['getLists'](_0x32bd5e);}})['then'](function(_0xda866c){if(_0xda866c){return _0xda866c?{'count':_0x1d9a20,'rows':_0xda866c}:null;}})[_0xdaf9('0x2c')](respondWithResult(_0xc36474,null))[_0xdaf9('0x22')](handleError(_0xc36474,null));};exports[_0xdaf9('0x132')]=function(_0x272144,_0x3457ca){var _0x47c7f3={};var _0x55ecba={};var _0x34ba34;return db[_0xdaf9('0x41')][_0xdaf9('0xa1')]({'where':{'id':_0x272144[_0xdaf9('0x65')]['id']}})[_0xdaf9('0x2c')](handleEntityNotFound(_0x3457ca,null))[_0xdaf9('0x2c')](function(_0x1becc5){if(_0x1becc5){_0x34ba34=_0x1becc5;_0x55ecba[_0xdaf9('0x56')]=_['keys'](db[_0xdaf9('0x41')]['rawAttributes']);_0x55ecba[_0xdaf9('0x46')]=_[_0xdaf9('0x58')](_0x272144[_0xdaf9('0x46')]);_0x55ecba[_0xdaf9('0x59')]=_['intersection'](_0x55ecba[_0xdaf9('0x56')],_0x55ecba[_0xdaf9('0x46')]);_0x47c7f3[_0xdaf9('0x4b')]=_[_0xdaf9('0x5a')](_0x55ecba[_0xdaf9('0x56')],qs['fields'](_0x272144[_0xdaf9('0x46')][_0xdaf9('0x5b')]));_0x47c7f3[_0xdaf9('0x4b')]=_0x47c7f3['attributes']['length']?_0x47c7f3['attributes']:_0x55ecba[_0xdaf9('0x56')];_0x47c7f3['order']=qs[_0xdaf9('0xdb')](_0x272144[_0xdaf9('0x46')][_0xdaf9('0xdb')]);_0x47c7f3[_0xdaf9('0xdc')]=qs[_0xdaf9('0x59')](_[_0xdaf9('0xdd')](_0x272144[_0xdaf9('0x46')],_0x55ecba[_0xdaf9('0x59')]));if(_0x272144[_0xdaf9('0x46')]['filter']){_0x47c7f3[_0xdaf9('0xdc')]=_['merge'](_0x47c7f3[_0xdaf9('0xdc')],{'$or':_[_0xdaf9('0x39')](_0x47c7f3[_0xdaf9('0x4b')],function(_0xbb949f){var _0x220905={};_0x220905[_0xbb949f]={'$like':'%'+_0x272144[_0xdaf9('0x46')][_0xdaf9('0x38')]+'%'};return _0x220905;})});}_0x47c7f3['model']=db[_0xdaf9('0x41')];_0x47c7f3['as']='Agents';_0x47c7f3=_['merge']({},_0x47c7f3,_0x272144[_0xdaf9('0x5d')]);return _0x34ba34['getVoiceQueues']({'include':[_0x47c7f3]});}})[_0xdaf9('0x2c')](function(_0x4e04f1){if(_0x4e04f1){var _0x519d09={},_0x59179e=[];for(var _0x8b964c=0x0;_0x8b964c<_0x4e04f1[_0xdaf9('0x75')];_0x8b964c+=0x1){for(var _0x41e79b=0x0,_0x239101;_0x41e79b<_0x4e04f1[_0x8b964c][_0xdaf9('0x34')][_0xdaf9('0x75')];_0x41e79b+=0x1){_0x239101=_0x4e04f1[_0x8b964c][_0xdaf9('0x34')][_0x41e79b][_0xdaf9('0x30')]({'plain':!![]});_0x519d09[_0x239101['id']]=_0x239101;}}_0x519d09=_[_0xdaf9('0x133')](_0x519d09);for(var _0x4517cf=qs[_0xdaf9('0x26')](_0x272144[_0xdaf9('0x46')]['offset']);_0x4517cf<_0x519d09[_0xdaf9('0x75')]&&_0x59179e['length']=_0x1aa346){_0x12fc36=_0x1aa346;_0x560a1a=0xc8;}else{_0x560a1a=0xce;}_0x1a26a4['status'](_0x560a1a);return _0x1a26a4[_0x3a21('0x22')](_0x3a21('0x23'),_0x5c6dbe+'-'+_0x12fc36+'/'+_0x1aa346)[_0x3a21('0x24')](_0x5ce44e);}return null;};}function saveUpdates(_0x267002){return function(_0x110ae4){if(_0x110ae4){return _0x110ae4[_0x3a21('0x25')](_0x267002)[_0x3a21('0x26')](function(_0xeba5fc){socket[_0x3a21('0x27')]('userNotification:recalc:'+_0xeba5fc['id'],{});return _0xeba5fc;});}return null;};}function removeEntity(_0x128f7d){return function(_0x33798e){if(_0x33798e){return _0x33798e[_0x3a21('0x28')]()['then'](function(){var _0x129135=_0x33798e[_0x3a21('0x29')]({'plain':!![]});if(_0x129135['role']===_0x3a21('0x2a'))return;var _0x50251e=[{'name':_0x3a21('0x2b'),'value':'user','ignore':!![]},{'name':_0x3a21('0x2c'),'value':'agent','ignore':![]},{'name':_0x3a21('0x2d'),'value':'telephone','ignore':![]}];var _0xa5242b=_(_0x50251e)[_0x3a21('0x2e')](_0x3a21('0x2f'))[_0x3a21('0x30')]('value')[_0x3a21('0x31')]();if(_[_0x3a21('0x32')](_0xa5242b,_0x129135['role'])){return;}var _0x3c1925=_[_0x3a21('0x33')](_0x50251e,[_0x3a21('0x31'),_0x129135[_0x3a21('0x34')]])[_0x3a21('0x35')];return db[_0x3a21('0x36')]['destroy']({'where':{'type':_0x3c1925,'resourceId':_0x129135['id']}})['then'](function(){return _0x33798e;});})[_0x3a21('0x26')](function(){_0x128f7d[_0x3a21('0x1d')](0xcc)[_0x3a21('0x37')]();});}};}function handleEntityNotFound(_0x830d27){return function(_0x382362){if(!_0x382362){_0x830d27[_0x3a21('0x1c')](0x194);}return _0x382362;};}function handleError(_0x1f5fd4,_0x27ef21){_0x27ef21=_0x27ef21||0x1f4;return function(_0x1b8324){logger[_0x3a21('0x16')](_0x1b8324[_0x3a21('0x38')]);if(_0x1b8324[_0x3a21('0x35')]){delete _0x1b8324[_0x3a21('0x35')];}_0x1f5fd4['status'](_0x27ef21)[_0x3a21('0x39')](_0x1b8324);};}exports[_0x3a21('0x3a')]=function(_0x5cebec,_0x2de659){var _0x1e6927={},_0x4054b8={'count':0x0,'rows':[]};var _0x14e134=_(db[_0x3a21('0x3b')][_0x3a21('0x3c')])['map'](function(_0x204c53){return{'name':_0x204c53[_0x3a21('0x3d')],'type':_0x204c53['type'][_0x3a21('0x3e')]};})[_0x3a21('0x2e')](function(_0x2507dc){return!_[_0x3a21('0x32')]([_0x3a21('0x3f'),_0x3a21('0x40')],_0x2507dc['name']);})[_0x3a21('0x31')]();_0x1e6927=qs[_0x3a21('0x41')](_0x14e134,_0x5cebec);var _0x1ef9a7={'where':_0x1e6927[_0x3a21('0x42')]};return db[_0x3a21('0x3b')]['count'](_0x1ef9a7)[_0x3a21('0x26')](function(_0x42fea0){_0x4054b8[_0x3a21('0x20')]=_0x42fea0;if(_0x5cebec[_0x3a21('0x43')][_0x3a21('0x44')]){_0x1e6927[_0x3a21('0x45')]=[{'all':!![]}];}if(_0x5cebec[_0x3a21('0x43')][_0x3a21('0x46')]===_0x3a21('0x47')){_0x1e6927[_0x3a21('0x45')]=[{'model':db[_0x3a21('0x48')],'as':_0x3a21('0x46')}];}if(!_[_0x3a21('0x32')](_0x1e6927[_0x3a21('0x49')],'id')){_0x1e6927[_0x3a21('0x49')][_0x3a21('0x4a')]('id');}return db[_0x3a21('0x3b')][_0x3a21('0x4b')](_0x1e6927);})['then'](function(_0x590923){_0x4054b8[_0x3a21('0x4c')]=_0x590923;if(_0x5cebec[_0x3a21('0x43')][_0x3a21('0x4d')]===_0x3a21('0x47')){var _0x4764df=[];for(var _0x4b4556=0x0;_0x4b4556<_0x4054b8[_0x3a21('0x4c')][_0x3a21('0x4e')];_0x4b4556++){_0x4764df['push'](get_open_tabs('chat',_0x4054b8[_0x3a21('0x4c')][_0x4b4556][_0x3a21('0x4f')]));_0x4764df['push'](get_open_tabs(_0x3a21('0x50'),_0x4054b8['rows'][_0x4b4556][_0x3a21('0x4f')]));_0x4764df['push'](get_open_tabs(_0x3a21('0x51'),_0x4054b8['rows'][_0x4b4556][_0x3a21('0x4f')]));_0x4764df['push'](get_open_tabs(_0x3a21('0x52'),_0x4054b8[_0x3a21('0x4c')][_0x4b4556]['dataValues']));_0x4764df['push'](get_open_tabs(_0x3a21('0x53'),_0x4054b8['rows'][_0x4b4556][_0x3a21('0x4f')]));_0x4764df['push'](get_open_tabs('whatsapp',_0x4054b8[_0x3a21('0x4c')][_0x4b4556][_0x3a21('0x4f')]));}return BPromise['all'](_0x4764df)[_0x3a21('0x26')](function(){return _0x4054b8;});}else{return _0x4054b8;}})['then'](respondWithFilteredResult(_0x2de659,_0x1e6927))[_0x3a21('0x1b')](handleError(_0x2de659,null));};exports['show']=function(_0x4a58dc,_0x443287){var _0x53b362={'raw':![],'where':{'id':_0x4a58dc[_0x3a21('0x54')]['id']}},_0x1613a8={};_0x1613a8[_0x3a21('0x55')]=_['differenceBy'](_[_0x3a21('0x56')](db['User'][_0x3a21('0x3c')]),[_0x3a21('0x3f'),'salt']);_0x1613a8[_0x3a21('0x43')]=_[_0x3a21('0x56')](_0x4a58dc[_0x3a21('0x43')]);_0x1613a8['filters']=_[_0x3a21('0x57')](_0x1613a8[_0x3a21('0x55')],_0x1613a8[_0x3a21('0x43')]);_0x53b362[_0x3a21('0x49')]=_[_0x3a21('0x57')](_0x1613a8[_0x3a21('0x55')],qs[_0x3a21('0x58')](_0x4a58dc[_0x3a21('0x43')]['fields']));_0x53b362[_0x3a21('0x49')]=_0x53b362[_0x3a21('0x49')][_0x3a21('0x4e')]?_0x53b362[_0x3a21('0x49')]:_0x1613a8['model'];if(_0x4a58dc[_0x3a21('0x43')]['includeAll']){_0x53b362[_0x3a21('0x45')]=[{'all':!![]}];}if(_0x4a58dc[_0x3a21('0x43')]['userSetting']===_0x3a21('0x47')){_0x53b362[_0x3a21('0x45')]=[{'model':db[_0x3a21('0x48')],'as':_0x3a21('0x46')}];}_0x53b362=_['merge']({},_0x53b362,_0x4a58dc[_0x3a21('0x59')]);if(!_['includes'](_0x53b362[_0x3a21('0x49')],'id')){_0x53b362[_0x3a21('0x49')][_0x3a21('0x4a')]('id');}return db[_0x3a21('0x3b')]['find'](_0x53b362)[_0x3a21('0x26')](handleEntityNotFound(_0x443287,null))[_0x3a21('0x26')](function(_0x230143){var _0x17e68d=[];values=_0x230143;if(_0x4a58dc[_0x3a21('0x43')][_0x3a21('0x4d')]===_0x3a21('0x47')){_0x17e68d[_0x3a21('0x4a')](get_open_tabs('chat',_0x230143[_0x3a21('0x4f')]));_0x17e68d['push'](get_open_tabs(_0x3a21('0x50'),_0x230143[_0x3a21('0x4f')]));_0x17e68d['push'](get_open_tabs(_0x3a21('0x53'),_0x230143[_0x3a21('0x4f')]));_0x17e68d[_0x3a21('0x4a')](get_open_tabs(_0x3a21('0x5a'),_0x230143[_0x3a21('0x4f')]));_0x17e68d[_0x3a21('0x4a')](get_open_tabs(_0x3a21('0x51'),_0x230143[_0x3a21('0x4f')]));_0x17e68d[_0x3a21('0x4a')](get_open_tabs('mail',_0x230143[_0x3a21('0x4f')]));return BPromise[_0x3a21('0x5b')](_0x17e68d);}else{return values;}})[_0x3a21('0x26')](function(){return values;})[_0x3a21('0x26')](respondWithResult(_0x443287,null))[_0x3a21('0x1b')](handleError(_0x443287,null));};exports['update']=function(_0x4186f6,_0x5a8d08){if(_0x4186f6[_0x3a21('0x5c')]['id']){delete _0x4186f6[_0x3a21('0x5c')]['id'];}delete _0x4186f6[_0x3a21('0x5c')][_0x3a21('0x34')];return db['User']['find']({'where':{'id':_0x4186f6[_0x3a21('0x54')]['id']}})[_0x3a21('0x26')](handleEntityNotFound(_0x5a8d08,null))[_0x3a21('0x26')](saveUpdates(_0x4186f6['body'],null))[_0x3a21('0x26')](respondWithResult(_0x5a8d08,null))[_0x3a21('0x1b')](handleError(_0x5a8d08,null));};exports[_0x3a21('0x5d')]=function(_0x397f22,_0x2b01d5){return db[_0x3a21('0x3b')][_0x3a21('0x5d')]()[_0x3a21('0x26')](respondWithResult(_0x2b01d5,null))[_0x3a21('0x1b')](handleError(_0x2b01d5,null));};exports['addContacts']=function(_0x10f412,_0x241013){return db[_0x3a21('0x3b')][_0x3a21('0x33')]({'where':{'id':_0x10f412[_0x3a21('0x54')]['id']}})[_0x3a21('0x26')](handleEntityNotFound(_0x241013,null))[_0x3a21('0x26')](function(_0x3bb545){if(_0x3bb545){return _0x3bb545[_0x3a21('0x5e')](_0x10f412[_0x3a21('0x5c')][_0x3a21('0x5f')],_[_0x3a21('0x60')](_0x10f412[_0x3a21('0x5c')],['ids','id'])||{});}})[_0x3a21('0x26')](respondWithResult(_0x241013,null))['catch'](handleError(_0x241013,null));};function validateUser(_0x705ce7){return new BPromise(function(_0x12b25f,_0x36670b){if(_0x705ce7[_0x3a21('0x61')])return _0x12b25f(_0x705ce7);return db[_0x3a21('0x62')][_0x3a21('0x63')](0x1)[_0x3a21('0x26')](function(_0x4d7092){if(_0x4d7092[_0x3a21('0x64')])authService[_0x3a21('0x65')](_0x705ce7[_0x3a21('0x3f')]);db[_0x3a21('0x3b')]['max'](_0x3a21('0x61'))[_0x3a21('0x26')](function(_0x4d4054){if(_[_0x3a21('0x66')](_0x4d4054)){_0x705ce7[_0x3a21('0x61')]=_0x4d7092[_0x3a21('0x67')]||0x1;return;}if(_['isNil'](_0x4d7092['min_internal'])||_0x4d7092['min_internal']===_0x4d4054){_0x705ce7[_0x3a21('0x61')]=_0x4d4054+0x1;return;}if(_0x4d7092[_0x3a21('0x67')]>_0x4d4054){_0x705ce7[_0x3a21('0x61')]=_0x4d7092[_0x3a21('0x67')];return;}return db[_0x3a21('0x68')][_0x3a21('0x43')]('select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)',{'type':db[_0x3a21('0x68')][_0x3a21('0x69')][_0x3a21('0x6a')]})[_0x3a21('0x26')](function(_0x102afa){if(_0x102afa&&_0x102afa[_0x3a21('0x4e')]){for(var _0x9d77c1=0x0,_0x5a91d3=_0x102afa[_0x3a21('0x4e')];_0x9d77c1<_0x5a91d3&&_[_0x3a21('0x66')](_0x705ce7[_0x3a21('0x61')]);_0x9d77c1++){if(_0x4d7092[_0x3a21('0x67')]<=_0x102afa[_0x9d77c1][_0x3a21('0x6b')]){_0x705ce7[_0x3a21('0x61')]=_0x102afa[_0x9d77c1][_0x3a21('0x6b')];}else if(_0x4d7092[_0x3a21('0x67')]>_0x102afa[_0x9d77c1]['from']&&_0x4d7092[_0x3a21('0x67')]<=_0x102afa[_0x9d77c1]['to']){_0x705ce7[_0x3a21('0x61')]=_0x4d7092[_0x3a21('0x67')];}}}if(_[_0x3a21('0x66')](_0x705ce7['internal'])){_0x705ce7[_0x3a21('0x61')]=_0x4d4054+0x1;}return _0x12b25f(_0x705ce7);});});})[_0x3a21('0x1b')](function(_0xb18a2a){_0x36670b(_0xb18a2a);});});}function updateUser(_0x4fa06f){return new BPromise(function(_0x1860aa,_0x1c64b4){try{if(_0x4fa06f[_0x3a21('0x6c')]){_0x4fa06f[_0x3a21('0x6d')]=_0x4fa06f[_0x3a21('0x61')];_0x4fa06f[_0x3a21('0x6e')]={'mailbox':_0x4fa06f[_0x3a21('0x61')],'password':_0x4fa06f[_0x3a21('0x3f')],'fullname':_0x4fa06f['fullname'],'email':_0x4fa06f[_0x3a21('0x6f')]};}if(_0x4fa06f[_0x3a21('0x34')]===_0x3a21('0x70')){if(!_0x4fa06f['permissions'])_0x4fa06f[_0x3a21('0x71')]=[_0x3a21('0x72'),'102',_0x3a21('0x73'),_0x3a21('0x74'),'110',_0x3a21('0x75'),'105','106',_0x3a21('0x76'),'108',_0x3a21('0x77'),_0x3a21('0x78'),_0x3a21('0x79'),_0x3a21('0x7a'),'115'];}_0x1860aa(_0x4fa06f);}catch(_0x449ade){_0x1c64b4(_0x449ade);}});}exports[_0x3a21('0x7b')]=function(_0x18cf25,_0x314d5b){if(_0x18cf25[_0x3a21('0x7c')][_0x3a21('0x34')]===_0x3a21('0x70'))throw new Error(_0x3a21('0x7d'));if(_0x18cf25[_0x3a21('0x5c')][_0x3a21('0x34')]===_0x3a21('0x7c')&&_0x18cf25[_0x3a21('0x7c')][_0x3a21('0x34')]!==_0x3a21('0x2a')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x18cf25['body'][_0x3a21('0x34')]===_0x3a21('0x2a')&&_0x18cf25['user'][_0x3a21('0x34')]!==_0x3a21('0x2a')){throw new Error(_0x3a21('0x7e'));}return licenseUtil[_0x3a21('0x7f')]([_0x18cf25[_0x3a21('0x5c')]])['then'](function(){return validateUser(_0x18cf25[_0x3a21('0x5c')]);})[_0x3a21('0x26')](function(_0x508d55){return updateUser(_0x508d55)[_0x3a21('0x26')](function(_0x4c2c78){if(_0x4c2c78[_0x3a21('0x34')]==='admin'){_0x4c2c78['settingsEnabled']=_0x18cf25[_0x3a21('0x7c')][_0x3a21('0x80')];delete _0x4c2c78[_0x3a21('0x81')];}return _0x4c2c78;});})[_0x3a21('0x26')](function(_0x200e92){return db[_0x3a21('0x3b')][_0x3a21('0x7b')](_0x200e92,{'include':[{'model':db[_0x3a21('0x6e')],'as':_0x3a21('0x6e')}]});})[_0x3a21('0x26')](function(_0x5d56b2){if(_0x18cf25[_0x3a21('0x5c')][_0x3a21('0x34')]===_0x3a21('0x7c'))return _0x5d56b2;if(_0x18cf25[_0x3a21('0x7c')]['role']!==_0x3a21('0x7c'))return _0x5d56b2;return db[_0x3a21('0x82')][_0x3a21('0x33')]({'where':{'name':_0x5d56b2['role']===_0x3a21('0x70')?'Agents':_0x3a21('0x2d'),'userProfileId':_0x18cf25[_0x3a21('0x7c')][_0x3a21('0x81')]},'raw':!![]})['then'](function(_0xec9c5f){if(!_0xec9c5f||_0xec9c5f[_0x3a21('0x83')]!=0x0)return _0x5d56b2;return db['UserProfileResource']['create']({'name':_0x5d56b2[_0x3a21('0x35')],'resourceId':_0x5d56b2['id'],'type':_0xec9c5f['name'],'sectionId':_0xec9c5f['id']},{})[_0x3a21('0x26')](function(){return _0x5d56b2;});})['catch'](function(_0x4430fe){logger[_0x3a21('0x16')](_0x3a21('0x84'),_0x4430fe);throw _0x4430fe;});})[_0x3a21('0x26')](respondWithResult(_0x314d5b,0xc9))[_0x3a21('0x1b')](handleError(_0x314d5b,null));};exports['bulkCreate']=function(_0x2c1bb7,_0x1b676c){var _0x52d650=_0x2c1bb7[_0x3a21('0x5c')];var _0x3ab494=[];if(_0x2c1bb7[_0x3a21('0x7c')][_0x3a21('0x34')]==='agent')throw new Error('Unauthorized');if(_[_0x3a21('0x85')](_0x52d650,['role',_0x3a21('0x7c')])&&_0x2c1bb7['user'][_0x3a21('0x34')]!==_0x3a21('0x2a')){throw new Error(_0x3a21('0x86'));}if(_['some'](_0x52d650,[_0x3a21('0x34'),_0x3a21('0x2a')])&&_0x2c1bb7['user']['role']!==_0x3a21('0x2a')){throw new Error(_0x3a21('0x87'));}return licenseUtil[_0x3a21('0x7f')](_0x52d650)['then'](function(){return validateUser(_0x52d650[0x0]);})[_0x3a21('0x26')](function(){for(var _0x125158=0x1;_0x125158<_0x52d650[_0x3a21('0x4e')];_0x125158++){var _0x100b25=_0x52d650[_0x125158-0x1][_0x3a21('0x61')];if(!_0x52d650[_0x125158][_0x3a21('0x61')])_0x52d650[_0x125158][_0x3a21('0x61')]=_0x100b25+0x1;_0x3ab494[_0x3a21('0x4a')](validateUser(_0x52d650[_0x125158]));}return BPromise[_0x3a21('0x5b')](_0x3ab494);})[_0x3a21('0x26')](function(){_0x3ab494=[];for(var _0x5ba411=0x0;_0x5ba411<_0x52d650[_0x3a21('0x4e')];_0x5ba411++){_0x3ab494[_0x3a21('0x4a')](updateUser(_0x52d650[_0x5ba411]));}return BPromise[_0x3a21('0x5b')](_0x3ab494);})['then'](function(){return BPromise[_0x3a21('0x88')](_0x52d650,function(_0x2cdbd0){return db[_0x3a21('0x3b')][_0x3a21('0x7b')](_0x2cdbd0,{'include':[{'model':db[_0x3a21('0x6e')],'as':_0x3a21('0x6e')}]})[_0x3a21('0x26')](function(_0x41fd31){_0x2cdbd0['id']=_0x41fd31['id'];return _0x2cdbd0;});});})[_0x3a21('0x26')](function(_0x1c32d2){if(_0x2c1bb7[_0x3a21('0x5c')][_0x3a21('0x34')]===_0x3a21('0x7c'))return _0x1c32d2;if(_0x2c1bb7[_0x3a21('0x7c')]['role']!==_0x3a21('0x7c'))return _0x1c32d2;var _0x4d09dc=_[_0x3a21('0x85')](_0x1c32d2,function(_0x88e5f7){return _0x88e5f7[_0x3a21('0x34')]==='agent'||_0x88e5f7[_0x3a21('0x34')]==='telephone';});if(!_0x4d09dc)return _0x1c32d2;return db['UserProfileSection'][_0x3a21('0x4b')]({'where':{'name':{'$or':[_0x3a21('0x2c'),_0x3a21('0x2d')]},'userProfileId':_0x2c1bb7[_0x3a21('0x7c')][_0x3a21('0x81')]},'raw':!![]})[_0x3a21('0x26')](function(_0x17d7bc){if(_[_0x3a21('0x89')](_0x17d7bc)||!_['some'](_0x17d7bc,['autoAssociation',0x0]))return _0x1c32d2;_0x3ab494=[];var _0x275df2=_(_0x17d7bc)[_0x3a21('0x30')](function(_0x47899d){if(_0x47899d[_0x3a21('0x83')]===0x1)return;return _0x47899d[_0x3a21('0x35')]==='Agents'?_0x3a21('0x70'):'telephone';})['compact']()[_0x3a21('0x31')]();for(var _0x28d982=0x0;_0x28d982<_0x1c32d2[_0x3a21('0x4e')];_0x28d982++){if(!_[_0x3a21('0x32')](_0x275df2,_0x1c32d2[_0x28d982]['role']))return;var _0x5a7101=_0x1c32d2[_0x28d982][_0x3a21('0x34')]===_0x3a21('0x70')?_0x3a21('0x2c'):_0x3a21('0x2d');_0x3ab494[_0x3a21('0x4a')](db[_0x3a21('0x36')][_0x3a21('0x7b')]({'name':_0x1c32d2[_0x28d982]['name'],'resourceId':_0x1c32d2[_0x28d982]['id'],'type':_0x5a7101,'sectionId':_['find'](_0x17d7bc,[_0x3a21('0x35'),_0x5a7101])['id']},{}));}return BPromise[_0x3a21('0x5b')](_0x3ab494);});})[_0x3a21('0x26')](respondWithResult(_0x1b676c,0xc9))[_0x3a21('0x1b')](handleError(_0x1b676c,null));};exports[_0x3a21('0x8a')]=function(_0x61a311,_0x1bbec0){if(_0x61a311[_0x3a21('0x5c')]['id']){delete _0x61a311['body']['id'];}return db[_0x3a21('0x3b')][_0x3a21('0x33')]({'where':{'id':_0x61a311[_0x3a21('0x54')]['id']}})['then'](function(_0x241e07){if(!_0x241e07)return null;if(_0x241e07['id']===_0x61a311['user']['id']){if(!_0x61a311[_0x3a21('0x5c')]['oldPassword']||!_0x61a311[_0x3a21('0x5c')][_0x3a21('0x8b')]){throw new db[(_0x3a21('0x8c'))][(_0x3a21('0x8d'))](_0x3a21('0x8e'));}if(!_0x241e07[_0x3a21('0x8f')](_0x61a311[_0x3a21('0x5c')][_0x3a21('0x90')])){throw new db[(_0x3a21('0x8c'))]['ValidationError'](_0x3a21('0x91'));}if(_0x61a311[_0x3a21('0x5c')][_0x3a21('0x90')]===_0x61a311[_0x3a21('0x5c')][_0x3a21('0x8b')]){throw new db['Sequelize'][(_0x3a21('0x8d'))]('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0x61a311[_0x3a21('0x7c')][_0x3a21('0x34')]===_0x3a21('0x2a')){if(!_0x61a311[_0x3a21('0x5c')][_0x3a21('0x8b')]){throw new db[(_0x3a21('0x8c'))][(_0x3a21('0x8d'))](_0x3a21('0x92'));}}else if(_0x61a311[_0x3a21('0x7c')][_0x3a21('0x34')]===_0x3a21('0x7c')){if(!_0x61a311['body'][_0x3a21('0x8b')]){throw new db['Sequelize']['ValidationError'](_0x3a21('0x92'));}if(_0x241e07[_0x3a21('0x34')]!==_0x3a21('0x70')){throw new db[(_0x3a21('0x8c'))][(_0x3a21('0x8d'))](_0x3a21('0x7d'));}}else{throw new db[(_0x3a21('0x8c'))][(_0x3a21('0x8d'))](_0x3a21('0x7d'));}return _0x241e07;})[_0x3a21('0x26')](handleEntityNotFound(_0x1bbec0,null))[_0x3a21('0x26')](function(_0x18c913){return db['Setting'][_0x3a21('0x93')]({'attributes':['id',_0x3a21('0x64'),_0x3a21('0x94'),_0x3a21('0x95')]})[_0x3a21('0x26')](function(_0x42963a){if(_0x42963a[_0x3a21('0x64')])authService[_0x3a21('0x65')](_0x61a311[_0x3a21('0x5c')][_0x3a21('0x8b')]);if(!_0x42963a[_0x3a21('0x94')]||!_0x18c913[_0x3a21('0x96')])return _0x18c913;authService['validatePasswordHistory'](_0x61a311[_0x3a21('0x5c')][_0x3a21('0x8b')],_0x18c913['previousPasswords'],_0x42963a[_0x3a21('0x95')]);return _0x18c913;})[_0x3a21('0x26')](saveUpdates({'password':_0x61a311[_0x3a21('0x5c')][_0x3a21('0x8b')],'passwordResetAt':_0x61a311[_0x3a21('0x7c')]['id']==_0x61a311[_0x3a21('0x54')]['id']?moment():null,'previousPasswords':authService[_0x3a21('0x97')](_0x61a311[_0x3a21('0x5c')][_0x3a21('0x8b')],_0x18c913['previousPasswords'])},null));})[_0x3a21('0x26')](respondWithResult(_0x1bbec0,null))[_0x3a21('0x1b')](handleError(_0x1bbec0,null));};exports[_0x3a21('0x98')]=function(_0x29743b,_0x3425a8){var _0x5ddb21=_0x29743b[_0x3a21('0x5c')]['channel'];return db[_0x3a21('0x3b')][_0x3a21('0x33')]({'where':{'id':_0x29743b[_0x3a21('0x54')]['id']},'attributes':['id','name',_0x3a21('0x34'),'online',_0x3a21('0x99'),_0x3a21('0x9a'),_0x3a21('0x9b')]})['then'](handleEntityNotFound(_0x3425a8,null))[_0x3a21('0x26')](function(_0x459228){if(_0x459228){if(!utils[_0x3a21('0x9c')](_0x5ddb21)){throw new db[(_0x3a21('0x8c'))]['ValidationError'](_0x3a21('0x9d'));}return _0x459228[_0x3a21('0x9e')+_[_0x3a21('0x9f')](_0x5ddb21['toLowerCase']())+_0x3a21('0xa0')](_0x29743b['body'][_0x3a21('0x5f')],{'penalty':_0x29743b[_0x3a21('0x5c')][_0x3a21('0xa1')]||0x0})[_0x3a21('0xa2')](function(_0x15d197){for(var _0x4d978b=0x0;_0x4d978b<_0x29743b[_0x3a21('0x5c')][_0x3a21('0x5f')]['length'];_0x4d978b+=0x1){var _0x41e2b1={'UserId':Number(_0x29743b[_0x3a21('0x54')]['id'])};_0x41e2b1[_[_0x3a21('0x9f')](_0x5ddb21[_0x3a21('0xa3')]())+_0x3a21('0xa4')]=Number(_0x29743b[_0x3a21('0x5c')][_0x3a21('0x5f')][_0x4d978b]);socket[_0x3a21('0x27')](_0x3a21('0x7c')+_[_0x3a21('0x9f')](_0x5ddb21['toLowerCase']())+_0x3a21('0xa5'),_0x41e2b1);}return _0x15d197;})['then'](function(){if(_0x5ddb21==='voice'){return db[_0x3a21('0xa6')][_0x3a21('0x4b')]({'where':{'id':_0x29743b[_0x3a21('0x5c')][_0x3a21('0x5f')]||[]},'raw':!![],'attributes':['id',_0x3a21('0x35')]});}})[_0x3a21('0x26')](function(_0x14baca){var _0xda00fd=_0x459228[_0x3a21('0x29')]({'plain':!![]});var _0x54dd62=[];if(_0x5ddb21===_0x3a21('0xa7')&&_0xda00fd['role']===_0x3a21('0x70')&&_0xda00fd[_0x3a21('0xa8')]){for(var _0x4e0831=0x0;_0x4e0831<_0x14baca[_0x3a21('0x4e')];_0x4e0831+=0x1){_0x54dd62[_0x3a21('0x4a')]({'membername':_0xda00fd[_0x3a21('0x35')],'UserId':_0xda00fd['id'],'queue_name':_0x14baca[_0x4e0831][_0x3a21('0x35')],'VoiceQueueId':_0x14baca[_0x4e0831]['id'],'interface':_[_0x3a21('0x66')](_0xda00fd[_0x3a21('0x9b')])?util[_0x3a21('0xa9')](_0x3a21('0xaa'),_0xda00fd[_0x3a21('0x35')]):_0xda00fd[_0x3a21('0x9b')],'paused':_0xda00fd[_0x3a21('0x9a')]||![],'penalty':_0x29743b['body'][_0x3a21('0xa1')]||0x0});}return BPromise[_0x3a21('0x88')](_0x54dd62,function(_0x2351ab){return db[_0x3a21('0xab')][_0x3a21('0xac')](_0x2351ab);});}return _0x459228;});}})[_0x3a21('0x26')](respondWithStatusCode(_0x3425a8,null))['catch'](handleError(_0x3425a8,null));};exports[_0x3a21('0xad')]=function(_0x55dd6e,_0x2594eb){var _0x259738,_0xd33833;return db[_0x3a21('0x3b')][_0x3a21('0x33')]({'where':{'id':_0x55dd6e['params']['id']},'attributes':['id',_0x3a21('0x35'),'role']})[_0x3a21('0x26')](handleEntityNotFound(_0x2594eb,null))[_0x3a21('0x26')](function(_0x2225cd){if(_0x2225cd){_0x259738=_0x2225cd;if(!_0x55dd6e['query'][_0x3a21('0xae')]||!utils[_0x3a21('0x9c')](_0x55dd6e['query'][_0x3a21('0xae')])){throw new db[(_0x3a21('0x8c'))][(_0x3a21('0x8d'))](_0x3a21('0x9d'));}return _0x2225cd[_0x3a21('0xaf')+_['capitalize'](_0x55dd6e[_0x3a21('0x43')][_0x3a21('0xae')][_0x3a21('0xa3')]())+_0x3a21('0xa0')](_0x55dd6e[_0x3a21('0x43')][_0x3a21('0x5f')]);}})[_0x3a21('0x26')](function(_0x763cc9){if(_['isArray'](_0x55dd6e[_0x3a21('0x43')]['ids'])){for(var _0x526592=0x0;_0x526592<_0x55dd6e[_0x3a21('0x43')][_0x3a21('0x5f')]['length'];_0x526592+=0x1){_0xd33833={'UserId':Number(_0x55dd6e[_0x3a21('0x54')]['id'])};_0xd33833[_[_0x3a21('0x9f')](_0x55dd6e['query'][_0x3a21('0xae')][_0x3a21('0xa3')]())+'QueueId']=Number(_0x55dd6e['query'][_0x3a21('0x5f')][_0x526592]);socket[_0x3a21('0x27')](_0x3a21('0x7c')+_[_0x3a21('0x9f')](_0x55dd6e[_0x3a21('0x43')][_0x3a21('0xae')]['toLowerCase']())+_0x3a21('0xb0'),_0xd33833);}}else{_0xd33833={'UserId':Number(_0x55dd6e[_0x3a21('0x54')]['id'])};_0xd33833[_[_0x3a21('0x9f')](_0x55dd6e['query'][_0x3a21('0xae')][_0x3a21('0xa3')]())+_0x3a21('0xa4')]=Number(_0x55dd6e['query'][_0x3a21('0x5f')]);socket[_0x3a21('0x27')](_0x3a21('0x7c')+_[_0x3a21('0x9f')](_0x55dd6e[_0x3a21('0x43')][_0x3a21('0xae')][_0x3a21('0xa3')]())+'Queue:remove',_0xd33833);}return _0x763cc9;})[_0x3a21('0x26')](function(){if(_0x55dd6e[_0x3a21('0x43')]['channel']==='voice'){return db['UserVoiceQueueRt']['destroy']({'where':{'UserId':_0x55dd6e[_0x3a21('0x54')]['id'],'VoiceQueueId':_0x55dd6e[_0x3a21('0x43')][_0x3a21('0x5f')]},'individualHooks':!![]})[_0x3a21('0x26')](function(){return _0x259738;});}return _0x259738;})[_0x3a21('0x26')](respondWithStatusCode(_0x2594eb,null))[_0x3a21('0x1b')](handleError(_0x2594eb,null));};exports[_0x3a21('0xb1')]=function(_0x11d665,_0x167caf){_0x11d665[_0x3a21('0x5c')][_0x3a21('0xb2')]=_0x11d665['file'][_0x3a21('0xb3')];return db[_0x3a21('0x3b')][_0x3a21('0x33')]({'where':{'id':_0x11d665[_0x3a21('0x54')]['id']}})[_0x3a21('0x26')](handleEntityNotFound(_0x167caf,null))['then'](saveUpdates(_0x11d665[_0x3a21('0x5c')],null))['then'](respondWithResult(_0x167caf,null))[_0x3a21('0x1b')](handleError(_0x167caf,null));};exports[_0x3a21('0xb4')]=function(_0xb26d82,_0x21dea9){var _0x3d9e28=path[_0x3a21('0xb5')](config[_0x3a21('0xb6')],'server/files/images/logos/default_profile.png');return db[_0x3a21('0x3b')][_0x3a21('0x33')]({'where':{'id':_0xb26d82['params']['id']},'attributes':['id',_0x3a21('0xb2')],'raw':!![]})[_0x3a21('0x26')](handleEntityNotFound(_0x21dea9,null))[_0x3a21('0x26')](function(_0x21df0e){if(_0x21df0e){if(_[_0x3a21('0x66')](_0x21df0e['userpic'])){return _0x21dea9[_0x3a21('0xb7')](_0x3d9e28);}else{if(!fs[_0x3a21('0xb8')](path[_0x3a21('0xb5')](config[_0x3a21('0xb6')],_0x3a21('0xb9'),_0x21df0e[_0x3a21('0xb2')]))){return _0x21dea9[_0x3a21('0xb7')](_0x3d9e28);}return _0x21dea9[_0x3a21('0xb7')](path['join'](config[_0x3a21('0xb6')],_0x3a21('0xb9'),_0x21df0e['userpic']));}}})[_0x3a21('0x1b')](handleError(_0x21dea9,null));};exports[_0x3a21('0xba')]=function(_0xfbd28,_0x3d7bb7){return db[_0x3a21('0x3b')][_0x3a21('0x33')]({'where':{'id':_0xfbd28[_0x3a21('0x54')]['id']},'attributes':['id']})[_0x3a21('0x26')](handleEntityNotFound(_0x3d7bb7,null))[_0x3a21('0x26')](function(_0x149ce4){var _0x4eb2bf=[];values=_0x149ce4[_0x3a21('0x4f')];_0x4eb2bf[_0x3a21('0x4a')](get_open_tabs(_0x3a21('0xbb'),_0x149ce4[_0x3a21('0x4f')]));_0x4eb2bf[_0x3a21('0x4a')](get_open_tabs('sms',_0x149ce4[_0x3a21('0x4f')]));_0x4eb2bf[_0x3a21('0x4a')](get_open_tabs(_0x3a21('0x53'),_0x149ce4[_0x3a21('0x4f')]));_0x4eb2bf['push'](get_open_tabs(_0x3a21('0x5a'),_0x149ce4[_0x3a21('0x4f')]));_0x4eb2bf[_0x3a21('0x4a')](get_open_tabs(_0x3a21('0x51'),_0x149ce4[_0x3a21('0x4f')]));_0x4eb2bf['push'](get_open_tabs(_0x3a21('0x52'),_0x149ce4['dataValues']));return BPromise[_0x3a21('0x5b')](_0x4eb2bf);})[_0x3a21('0x26')](function(_0x58f52c){if(_0x58f52c){var _0x3ba2c0=_[_0x3a21('0x30')](values[_0x3a21('0xbc')],function(_0x2f7f3e){return{'channel':_0x3a21('0xbd'),'id':_0x2f7f3e['id'],'createdAt':_0x2f7f3e['createdAt']};});var _0x3cc7bc=_['map'](values['FaxOpenTabs'],function(_0xf554aa){return{'channel':_0x3a21('0xbe'),'id':_0xf554aa['id'],'createdAt':_0xf554aa['createdAt']};});var _0x125581=_['map'](values[_0x3a21('0xbf')],function(_0x2a8f7e){return{'channel':_0x3a21('0xc0'),'id':_0x2a8f7e['id'],'createdAt':_0x2a8f7e[_0x3a21('0xc1')]};});var _0x341bb8=_['map'](values[_0x3a21('0xc2')],function(_0xd06ed2){return{'channel':_0x3a21('0xc3'),'id':_0xd06ed2['id'],'createdAt':_0xd06ed2[_0x3a21('0xc1')]};});var _0xb3bd7d=_['map'](values[_0x3a21('0xc4')],function(_0x55adea){return{'channel':_0x3a21('0xc5'),'id':_0x55adea['id'],'createdAt':_0x55adea['createdAt']};});var _0x2aec47=_[_0x3a21('0x30')](values[_0x3a21('0xc6')],function(_0x1ccd9d){return{'channel':'WHATSAPP','id':_0x1ccd9d['id'],'createdAt':_0x1ccd9d[_0x3a21('0xc1')]};});var _0x40bd88=_['concat'](_0x3ba2c0,_0x3cc7bc,_0x125581,_0x341bb8,_0xb3bd7d,_0x2aec47);var _0x3932fa={'count':_0x40bd88[_0x3a21('0x4e')],'rows':_0x40bd88};return _0x3932fa;}else return null;})[_0x3a21('0x26')](respondWithResult(_0x3d7bb7,null))['catch'](handleError(_0x3d7bb7,null));};exports[_0x3a21('0xc7')]=function(_0x2e1af6,_0x420a87){var _0x373482={};var _0x51cf98={};var _0x4288cc;var _0x44ee4f;return db[_0x3a21('0x3b')][_0x3a21('0x93')]({'where':{'id':_0x2e1af6[_0x3a21('0x54')]['id']}})[_0x3a21('0x26')](handleEntityNotFound(_0x420a87,null))[_0x3a21('0x26')](function(_0x40a80c){if(_0x40a80c){_0x4288cc=_0x40a80c;_0x51cf98[_0x3a21('0x55')]=_['keys'](db[_0x3a21('0xc8')]['rawAttributes']);_0x51cf98['query']=_[_0x3a21('0x56')](_0x2e1af6['query']);_0x51cf98['filters']=_['intersection'](_0x51cf98[_0x3a21('0x55')],_0x51cf98['query']);_0x373482[_0x3a21('0x49')]=_['intersection'](_0x51cf98['model'],qs[_0x3a21('0x58')](_0x2e1af6[_0x3a21('0x43')][_0x3a21('0x58')]));_0x373482[_0x3a21('0x49')]=_0x373482[_0x3a21('0x49')]['length']?_0x373482[_0x3a21('0x49')]:_0x51cf98['model'];_0x373482[_0x3a21('0xc9')]=qs[_0x3a21('0xca')](_0x2e1af6['query'][_0x3a21('0xca')]);_0x373482[_0x3a21('0x42')]=qs[_0x3a21('0xcb')](_['pick'](_0x2e1af6[_0x3a21('0x43')],_0x51cf98[_0x3a21('0xcb')]));if(_0x2e1af6[_0x3a21('0x43')][_0x3a21('0x2e')]){_0x373482[_0x3a21('0x42')]=_[_0x3a21('0xcc')](_0x373482[_0x3a21('0x42')],{'$or':_[_0x3a21('0x30')](_0x373482[_0x3a21('0x49')],function(_0x73481c){var _0x322051={};_0x322051[_0x73481c]={'$like':'%'+_0x2e1af6[_0x3a21('0x43')][_0x3a21('0x2e')]+'%'};return _0x322051;})});}_0x373482=_[_0x3a21('0xcc')]({},_0x373482,_0x2e1af6[_0x3a21('0x59')]);return _0x4288cc[_0x3a21('0xc7')](_0x373482);}})[_0x3a21('0x26')](function(_0x1aae79){if(_0x1aae79){_0x44ee4f=_0x1aae79[_0x3a21('0x4e')];if(_0x2e1af6['query'][_0x3a21('0xcd')](_0x3a21('0x44'))){_0x373482[_0x3a21('0x45')]=[{'model':db[_0x3a21('0xce')],'as':_0x3a21('0xcf'),'required':![]},{'model':db[_0x3a21('0xd0')],'as':_0x3a21('0xd1'),'attributes':['id',_0x3a21('0x35'),'color'],'where':_0x2e1af6[_0x3a21('0x43')][_0x3a21('0xd2')]?{'id':_0x2e1af6['query'][_0x3a21('0xd2')]}:undefined,'required':_0x2e1af6[_0x3a21('0x43')][_0x3a21('0xd2')]?!![]:![]}];}if(!_0x2e1af6[_0x3a21('0x43')][_0x3a21('0xcd')](_0x3a21('0xd3'))){_0x373482[_0x3a21('0x21')]=qs['limit'](_0x2e1af6[_0x3a21('0x43')]['limit']);_0x373482[_0x3a21('0x1e')]=qs[_0x3a21('0x1e')](_0x2e1af6[_0x3a21('0x43')][_0x3a21('0x1e')]);}return _0x4288cc[_0x3a21('0xc7')](_0x373482);}})[_0x3a21('0x26')](function(_0x6f240b){if(_0x6f240b){return _0x6f240b?{'count':_0x44ee4f,'rows':_0x6f240b}:null;}})[_0x3a21('0x26')](respondWithResult(_0x420a87,null))[_0x3a21('0x1b')](handleError(_0x420a87,null));};exports[_0x3a21('0xd4')]=function(_0x12260f,_0x3405ac){var _0x3b4931;var _0x4fe26e={};var _0x40f123;return db['User'][_0x3a21('0x93')]({'where':{'id':_0x12260f['params']['id']},'attributes':['id',_0x3a21('0x35'),_0x3a21('0x34')]})[_0x3a21('0x26')](handleEntityNotFound(_0x3405ac,null))['then'](function(_0x53f2cb){if(!utils['isValidChannel'](_0x12260f[_0x3a21('0x43')][_0x3a21('0xae')])){throw new db[(_0x3a21('0x8c'))][(_0x3a21('0x8d'))]('Unknown\x20channel');}_0x3b4931=_0x53f2cb;var _0xf5cb3b={};_0xf5cb3b[_0x3a21('0x55')]=_[_0x3a21('0x56')](db[_[_0x3a21('0x9f')](_0x12260f['query'][_0x3a21('0xae')])+_0x3a21('0xd5')][_0x3a21('0x3c')]);_0xf5cb3b[_0x3a21('0x43')]=_['keys'](_0x12260f[_0x3a21('0x43')]);_0xf5cb3b[_0x3a21('0xcb')]=_[_0x3a21('0x57')](_0xf5cb3b[_0x3a21('0x55')],_0xf5cb3b[_0x3a21('0x43')]);_0x4fe26e[_0x3a21('0x49')]=_[_0x3a21('0x57')](_0xf5cb3b['model'],qs[_0x3a21('0x58')](_0x12260f[_0x3a21('0x43')][_0x3a21('0x58')]));_0x4fe26e[_0x3a21('0x49')]=_0x4fe26e[_0x3a21('0x49')]['length']?_0x4fe26e['attributes']:_0xf5cb3b[_0x3a21('0x55')];_0x4fe26e[_0x3a21('0xc9')]=qs['sort'](_0x12260f[_0x3a21('0x43')]['sort']);_0x4fe26e[_0x3a21('0x42')]=qs[_0x3a21('0xcb')](_[_0x3a21('0xd6')](_0x12260f[_0x3a21('0x43')],_0xf5cb3b[_0x3a21('0xcb')]));if(_0x12260f['query'][_0x3a21('0x2e')]){_0x4fe26e[_0x3a21('0x42')]=_[_0x3a21('0xcc')](_0x4fe26e[_0x3a21('0x42')],{'$or':_[_0x3a21('0x30')](_0x4fe26e[_0x3a21('0x49')],function(_0x11dd77){var _0xfc8483={};_0xfc8483[_0x11dd77]={'$like':'%'+_0x12260f[_0x3a21('0x43')]['filter']+'%'};return _0xfc8483;})});}_0x4fe26e=_[_0x3a21('0xcc')]({},_0x4fe26e,_0x12260f[_0x3a21('0x59')]);switch(_0x3b4931[_0x3a21('0x34')]){case'admin':return db[_[_0x3a21('0x9f')](_0x12260f[_0x3a21('0x43')][_0x3a21('0xae')])+_0x3a21('0xd5')]['findAll'](_0x4fe26e);case _0x3a21('0x7c'):case _0x3a21('0x70'):return _0x3b4931[_0x3a21('0x29')+_['capitalize'](_0x12260f[_0x3a21('0x43')][_0x3a21('0xae')])+_0x3a21('0xa0')](_0x4fe26e);default:throw new db[(_0x3a21('0x8c'))][(_0x3a21('0x8d'))](_0x3a21('0xd7'));}})[_0x3a21('0x26')](function(_0x19e613){_0x40f123=_0x19e613['length'];if(!_0x12260f[_0x3a21('0x43')][_0x3a21('0xcd')](_0x3a21('0xd3'))){_0x4fe26e[_0x3a21('0x21')]=qs['limit'](_0x12260f[_0x3a21('0x43')][_0x3a21('0x21')]);_0x4fe26e['offset']=qs[_0x3a21('0x1e')](_0x12260f[_0x3a21('0x43')][_0x3a21('0x1e')]);}switch(_0x3b4931[_0x3a21('0x34')]){case'admin':return db[_[_0x3a21('0x9f')](_0x12260f['query'][_0x3a21('0xae')])+_0x3a21('0xd5')]['findAll'](_0x4fe26e);case'user':case'agent':return _0x3b4931[_0x3a21('0x29')+_[_0x3a21('0x9f')](_0x12260f[_0x3a21('0x43')][_0x3a21('0xae')])+_0x3a21('0xa0')](_0x4fe26e);}})[_0x3a21('0x26')](function(_0x1aae2c){return{'count':_0x40f123,'rows':_0x1aae2c};})[_0x3a21('0x26')](respondWithResult(_0x3405ac,null))[_0x3a21('0x1b')](handleError(_0x3405ac,null));};exports[_0x3a21('0xd8')]=function(_0x36f7ad,_0x1d2b8c){var _0x679480={};var _0x4c1606={};var _0x4bf29a;var _0x2d2c0e;return db[_0x3a21('0x3b')][_0x3a21('0x93')]({'where':{'id':_0x36f7ad[_0x3a21('0x54')]['id']}})['then'](handleEntityNotFound(_0x1d2b8c,null))['then'](function(_0x4e6517){if(_0x4e6517){_0x4bf29a=_0x4e6517;_0x4c1606[_0x3a21('0x55')]=_['keys'](db[_0x3a21('0xab')]['rawAttributes']);_0x4c1606[_0x3a21('0x43')]=_[_0x3a21('0x56')](_0x36f7ad[_0x3a21('0x43')]);_0x4c1606[_0x3a21('0xcb')]=_[_0x3a21('0x57')](_0x4c1606[_0x3a21('0x55')],_0x4c1606[_0x3a21('0x43')]);_0x679480['attributes']=_[_0x3a21('0x57')](_0x4c1606[_0x3a21('0x55')],qs[_0x3a21('0x58')](_0x36f7ad[_0x3a21('0x43')][_0x3a21('0x58')]));_0x679480[_0x3a21('0x49')]=_0x679480['attributes'][_0x3a21('0x4e')]?_0x679480[_0x3a21('0x49')]:_0x4c1606[_0x3a21('0x55')];_0x679480[_0x3a21('0xc9')]=qs[_0x3a21('0xca')](_0x36f7ad[_0x3a21('0x43')][_0x3a21('0xca')]);_0x679480[_0x3a21('0x42')]=qs[_0x3a21('0xcb')](_['pick'](_0x36f7ad['query'],_0x4c1606[_0x3a21('0xcb')]));if(_0x36f7ad[_0x3a21('0x43')][_0x3a21('0x2e')]){_0x679480['where']=_[_0x3a21('0xcc')](_0x679480[_0x3a21('0x42')],{'$or':_[_0x3a21('0x30')](_0x679480['attributes'],function(_0x2a261a){var _0x43e0dd={};_0x43e0dd[_0x2a261a]={'$like':'%'+_0x36f7ad[_0x3a21('0x43')][_0x3a21('0x2e')]+'%'};return _0x43e0dd;})});}_0x679480=_['merge']({},_0x679480,_0x36f7ad[_0x3a21('0x59')]);return _0x4bf29a[_0x3a21('0xd8')](_0x679480);}})['then'](function(_0x12f1f0){if(_0x12f1f0){_0x2d2c0e=_0x12f1f0[_0x3a21('0x4e')];if(!_0x36f7ad[_0x3a21('0x43')][_0x3a21('0xcd')](_0x3a21('0xd3'))){_0x679480[_0x3a21('0x21')]=qs['limit'](_0x36f7ad[_0x3a21('0x43')][_0x3a21('0x21')]);_0x679480[_0x3a21('0x1e')]=qs[_0x3a21('0x1e')](_0x36f7ad['query'][_0x3a21('0x1e')]);}return _0x4bf29a['getVoiceQueuesRt'](_0x679480);}})[_0x3a21('0x26')](function(_0x2c1c5b){if(_0x2c1c5b){return _0x2c1c5b?{'count':_0x2d2c0e,'rows':_0x2c1c5b}:null;}})['then'](respondWithResult(_0x1d2b8c,null))[_0x3a21('0x1b')](handleError(_0x1d2b8c,null));};exports[_0x3a21('0xd9')]=function(_0x450ce9,_0x32b55d){var _0x1dc29d={};var _0x3c836c={};var _0x39f2de;var _0x1c7b48;return db[_0x3a21('0x3b')][_0x3a21('0x93')]({'where':{'id':_0x450ce9[_0x3a21('0x54')]['id']}})['then'](handleEntityNotFound(_0x32b55d,null))[_0x3a21('0x26')](function(_0x406d0d){if(_0x406d0d){_0x39f2de=_0x406d0d;_0x3c836c[_0x3a21('0x55')]=_[_0x3a21('0x56')](db[_0x3a21('0xda')]['rawAttributes']);_0x3c836c[_0x3a21('0x43')]=_[_0x3a21('0x56')](_0x450ce9[_0x3a21('0x43')]);_0x3c836c[_0x3a21('0xcb')]=_[_0x3a21('0x57')](_0x3c836c['model'],_0x3c836c[_0x3a21('0x43')]);_0x1dc29d['attributes']=_[_0x3a21('0x57')](_0x3c836c[_0x3a21('0x55')],qs[_0x3a21('0x58')](_0x450ce9[_0x3a21('0x43')][_0x3a21('0x58')]));_0x1dc29d['attributes']=_0x1dc29d[_0x3a21('0x49')][_0x3a21('0x4e')]?_0x1dc29d[_0x3a21('0x49')]:_0x3c836c['model'];_0x1dc29d[_0x3a21('0xc9')]=qs[_0x3a21('0xca')](_0x450ce9[_0x3a21('0x43')]['sort']);_0x1dc29d[_0x3a21('0x42')]=qs['filters'](_[_0x3a21('0xd6')](_0x450ce9[_0x3a21('0x43')],_0x3c836c[_0x3a21('0xcb')]));if(_0x450ce9[_0x3a21('0x43')][_0x3a21('0x2e')]){_0x1dc29d[_0x3a21('0x42')]=_[_0x3a21('0xcc')](_0x1dc29d[_0x3a21('0x42')],{'$or':_[_0x3a21('0x30')](_0x1dc29d[_0x3a21('0x49')],function(_0x263d5b){var _0x59ecce={};_0x59ecce[_0x263d5b]={'$like':'%'+_0x450ce9['query'][_0x3a21('0x2e')]+'%'};return _0x59ecce;})});}_0x1dc29d=_[_0x3a21('0xcc')]({},_0x1dc29d,_0x450ce9[_0x3a21('0x59')]);return _0x39f2de['getGroups'](_0x1dc29d);}})[_0x3a21('0x26')](function(_0x6a9729){if(_0x6a9729){_0x1c7b48=_0x6a9729[_0x3a21('0x4e')];if(!_0x450ce9[_0x3a21('0x43')][_0x3a21('0xcd')](_0x3a21('0xd3'))){_0x1dc29d['limit']=qs[_0x3a21('0x21')](_0x450ce9['query'][_0x3a21('0x21')]);_0x1dc29d['offset']=qs[_0x3a21('0x1e')](_0x450ce9[_0x3a21('0x43')][_0x3a21('0x1e')]);}return _0x39f2de[_0x3a21('0xd9')](_0x1dc29d);}})[_0x3a21('0x26')](function(_0x2bd256){if(_0x2bd256){return _0x2bd256?{'count':_0x1c7b48,'rows':_0x2bd256}:null;}})[_0x3a21('0x26')](respondWithResult(_0x32b55d,null))[_0x3a21('0x1b')](handleError(_0x32b55d,null));};exports[_0x3a21('0xdb')]=function(_0x1cfd07,_0x1e7a27){var _0x4b0009={'raw':!![],'where':{}};var _0x3de818={};var _0x39deae={'count':0x0,'rows':[]};return db['User'][_0x3a21('0x93')]({'where':{'id':_0x1cfd07[_0x3a21('0x54')]['id']}})[_0x3a21('0x26')](handleEntityNotFound(_0x1e7a27,null))[_0x3a21('0x26')](function(_0x5660cf){if(_0x5660cf){_0x3de818[_0x3a21('0x55')]=_[_0x3a21('0x56')](db[_0x3a21('0xdc')][_0x3a21('0x3c')]);_0x3de818['query']=_[_0x3a21('0x56')](_0x1cfd07[_0x3a21('0x43')]);_0x3de818[_0x3a21('0xcb')]=_[_0x3a21('0x57')](_0x3de818[_0x3a21('0x55')],_0x3de818[_0x3a21('0x43')]);_0x4b0009[_0x3a21('0x49')]=_[_0x3a21('0x57')](_0x3de818[_0x3a21('0x55')],qs['fields'](_0x1cfd07[_0x3a21('0x43')][_0x3a21('0x58')]));_0x4b0009['attributes']=_0x4b0009[_0x3a21('0x49')][_0x3a21('0x4e')]?_0x4b0009[_0x3a21('0x49')]:_0x3de818[_0x3a21('0x55')];if(!_0x1cfd07[_0x3a21('0x43')]['hasOwnProperty'](_0x3a21('0xd3'))){_0x4b0009['limit']=qs['limit'](_0x1cfd07[_0x3a21('0x43')]['limit']);_0x4b0009[_0x3a21('0x1e')]=qs[_0x3a21('0x1e')](_0x1cfd07['query'][_0x3a21('0x1e')]);}_0x4b0009[_0x3a21('0xc9')]=qs['sort'](_0x1cfd07['query'][_0x3a21('0xca')]);_0x4b0009[_0x3a21('0x42')]=qs[_0x3a21('0xcb')](_[_0x3a21('0xd6')](_0x1cfd07[_0x3a21('0x43')],_0x3de818['filters']));_0x4b0009[_0x3a21('0x42')]['UserId']=_0x5660cf['id'];if(_0x1cfd07[_0x3a21('0x43')][_0x3a21('0x2e')]){_0x4b0009[_0x3a21('0x42')]=_[_0x3a21('0xcc')](_0x4b0009['where'],{'$or':_[_0x3a21('0x30')](_0x4b0009[_0x3a21('0x49')],function(_0x25873a){var _0x447842={};_0x447842[_0x25873a]={'$like':'%'+_0x1cfd07['query'][_0x3a21('0x2e')]+'%'};return _0x447842;})});}_0x4b0009=_['merge']({},_0x4b0009,_0x1cfd07[_0x3a21('0x59')]);return db[_0x3a21('0xdc')]['count']({'where':_0x4b0009[_0x3a21('0x42')]})[_0x3a21('0x26')](function(_0x328e18){_0x39deae[_0x3a21('0x20')]=_0x328e18;if(_0x1cfd07[_0x3a21('0x43')][_0x3a21('0x44')]){_0x4b0009[_0x3a21('0x45')]=[{'all':!![]}];}return db[_0x3a21('0xdc')][_0x3a21('0x4b')](_0x4b0009);})[_0x3a21('0x26')](function(_0x25847c){_0x39deae[_0x3a21('0x4c')]=_0x25847c;return _0x39deae;});}})[_0x3a21('0x26')](respondWithFilteredResult(_0x1e7a27,_0x4b0009))[_0x3a21('0x1b')](handleError(_0x1e7a27,null));};exports[_0x3a21('0xdd')]=function(_0x3b5edf,_0x275306){var _0x535425={'raw':!![],'where':{}};var _0x3f35e0={};var _0x398daa={'count':0x0,'rows':[]};return db[_0x3a21('0x3b')][_0x3a21('0x93')]({'where':{'id':_0x3b5edf[_0x3a21('0x54')]['id']}})[_0x3a21('0x26')](handleEntityNotFound(_0x275306,null))[_0x3a21('0x26')](function(_0x3978b0){if(_0x3978b0){_0x3f35e0[_0x3a21('0x55')]=_[_0x3a21('0x56')](db['ScreenRecording'][_0x3a21('0x3c')]);_0x3f35e0[_0x3a21('0x43')]=_['keys'](_0x3b5edf['query']);_0x3f35e0[_0x3a21('0xcb')]=_[_0x3a21('0x57')](_0x3f35e0[_0x3a21('0x55')],_0x3f35e0[_0x3a21('0x43')]);_0x535425[_0x3a21('0x49')]=_[_0x3a21('0x57')](_0x3f35e0[_0x3a21('0x55')],qs[_0x3a21('0x58')](_0x3b5edf[_0x3a21('0x43')]['fields']));_0x535425['attributes']=_0x535425[_0x3a21('0x49')][_0x3a21('0x4e')]?_0x535425[_0x3a21('0x49')]:_0x3f35e0[_0x3a21('0x55')];if(!_0x3b5edf[_0x3a21('0x43')][_0x3a21('0xcd')]('nolimit')){_0x535425[_0x3a21('0x21')]=qs['limit'](_0x3b5edf[_0x3a21('0x43')][_0x3a21('0x21')]);_0x535425[_0x3a21('0x1e')]=qs[_0x3a21('0x1e')](_0x3b5edf[_0x3a21('0x43')]['offset']);}_0x535425[_0x3a21('0xc9')]=qs[_0x3a21('0xca')](_0x3b5edf[_0x3a21('0x43')][_0x3a21('0xca')]);_0x535425[_0x3a21('0x42')]=qs[_0x3a21('0xcb')](_[_0x3a21('0xd6')](_0x3b5edf[_0x3a21('0x43')],_0x3f35e0['filters']));_0x535425['where'][_0x3a21('0xde')]=_0x3978b0['id'];if(_0x3b5edf['query'][_0x3a21('0x2e')]){_0x535425[_0x3a21('0x42')]=_[_0x3a21('0xcc')](_0x535425[_0x3a21('0x42')],{'$or':_[_0x3a21('0x30')](_0x535425[_0x3a21('0x49')],function(_0x90f2c9){var _0x3be455={};_0x3be455[_0x90f2c9]={'$like':'%'+_0x3b5edf[_0x3a21('0x43')]['filter']+'%'};return _0x3be455;})});}_0x535425=_['merge']({},_0x535425,_0x3b5edf[_0x3a21('0x59')]);return db[_0x3a21('0xdf')][_0x3a21('0x20')]({'where':_0x535425['where']})[_0x3a21('0x26')](function(_0xda9077){_0x398daa['count']=_0xda9077;if(_0x3b5edf['query']['includeAll']){_0x535425[_0x3a21('0x45')]=[{'all':!![]}];}return db['ScreenRecording']['findAll'](_0x535425);})[_0x3a21('0x26')](function(_0x68b25b){_0x398daa['rows']=_0x68b25b;return _0x398daa;});}})[_0x3a21('0x26')](respondWithFilteredResult(_0x275306,_0x535425))[_0x3a21('0x1b')](handleError(_0x275306,null));};exports[_0x3a21('0xe0')]=function(_0xa5a412,_0x5cc6a3){var _0x2b8064={};var _0x53e3e9={};var _0x2af739;var _0x5f6459;return db['User'][_0x3a21('0x93')]({'where':{'id':_0xa5a412[_0x3a21('0x54')]['id']}})[_0x3a21('0x26')](handleEntityNotFound(_0x5cc6a3,null))[_0x3a21('0x26')](function(_0x3169b6){if(_0x3169b6){_0x2af739=_0x3169b6;_0x53e3e9[_0x3a21('0x55')]=_[_0x3a21('0x56')](db[_0x3a21('0xe1')][_0x3a21('0x3c')]);_0x53e3e9[_0x3a21('0x43')]=_['keys'](_0xa5a412[_0x3a21('0x43')]);_0x53e3e9[_0x3a21('0xcb')]=_[_0x3a21('0x57')](_0x53e3e9[_0x3a21('0x55')],_0x53e3e9[_0x3a21('0x43')]);_0x2b8064[_0x3a21('0x49')]=_[_0x3a21('0x57')](_0x53e3e9[_0x3a21('0x55')],qs[_0x3a21('0x58')](_0xa5a412[_0x3a21('0x43')][_0x3a21('0x58')]));_0x2b8064[_0x3a21('0x49')]=_0x2b8064[_0x3a21('0x49')][_0x3a21('0x4e')]?_0x2b8064[_0x3a21('0x49')]:_0x53e3e9[_0x3a21('0x55')];_0x2b8064[_0x3a21('0xc9')]=qs[_0x3a21('0xca')](_0xa5a412[_0x3a21('0x43')]['sort']);_0x2b8064[_0x3a21('0x42')]=qs[_0x3a21('0xcb')](_[_0x3a21('0xd6')](_0xa5a412[_0x3a21('0x43')],_0x53e3e9[_0x3a21('0xcb')]));if(_0xa5a412['query'][_0x3a21('0x2e')]){_0x2b8064[_0x3a21('0x42')]=_[_0x3a21('0xcc')](_0x2b8064[_0x3a21('0x42')],{'$or':_[_0x3a21('0x30')](_0x2b8064['attributes'],function(_0x41f981){var _0x554494={};_0x554494[_0x41f981]={'$like':'%'+_0xa5a412[_0x3a21('0x43')][_0x3a21('0x2e')]+'%'};return _0x554494;})});}_0x2b8064=_[_0x3a21('0xcc')]({},_0x2b8064,_0xa5a412[_0x3a21('0x59')]);return _0x2af739['getChatInteractions'](_0x2b8064);}})[_0x3a21('0x26')](function(_0x4d34de){if(_0x4d34de){_0x5f6459=_0x4d34de[_0x3a21('0x4e')];if(!_0xa5a412[_0x3a21('0x43')]['hasOwnProperty'](_0x3a21('0xd3'))){_0x2b8064['limit']=qs['limit'](_0xa5a412['query'][_0x3a21('0x21')]);_0x2b8064[_0x3a21('0x1e')]=qs[_0x3a21('0x1e')](_0xa5a412['query'][_0x3a21('0x1e')]);}return _0x2af739['getChatInteractions'](_0x2b8064);}})[_0x3a21('0x26')](function(_0x2177fe){if(_0x2177fe){return _0x2177fe?{'count':_0x5f6459,'rows':_0x2177fe}:null;}})[_0x3a21('0x26')](respondWithResult(_0x5cc6a3,null))['catch'](handleError(_0x5cc6a3,null));};exports[_0x3a21('0xe2')]=function(_0x4a7de6,_0x4ef04e){var _0x179bc1={};var _0x2269a9={};var _0x406fe0;var _0x4c2428;return db[_0x3a21('0x3b')][_0x3a21('0x93')]({'where':{'id':_0x4a7de6[_0x3a21('0x54')]['id']}})['then'](handleEntityNotFound(_0x4ef04e,null))[_0x3a21('0x26')](function(_0x5dad86){if(_0x5dad86){_0x406fe0=_0x5dad86;_0x2269a9['model']=_[_0x3a21('0x56')](db[_0x3a21('0xe3')]['rawAttributes']);_0x2269a9[_0x3a21('0x43')]=_[_0x3a21('0x56')](_0x4a7de6[_0x3a21('0x43')]);_0x2269a9[_0x3a21('0xcb')]=_[_0x3a21('0x57')](_0x2269a9[_0x3a21('0x55')],_0x2269a9[_0x3a21('0x43')]);_0x179bc1['attributes']=_[_0x3a21('0x57')](_0x2269a9[_0x3a21('0x55')],qs[_0x3a21('0x58')](_0x4a7de6[_0x3a21('0x43')][_0x3a21('0x58')]));_0x179bc1[_0x3a21('0x49')]=_0x179bc1[_0x3a21('0x49')][_0x3a21('0x4e')]?_0x179bc1[_0x3a21('0x49')]:_0x2269a9['model'];_0x179bc1['order']=qs['sort'](_0x4a7de6[_0x3a21('0x43')][_0x3a21('0xca')]);_0x179bc1['where']=qs[_0x3a21('0xcb')](_[_0x3a21('0xd6')](_0x4a7de6[_0x3a21('0x43')],_0x2269a9[_0x3a21('0xcb')]));if(_0x4a7de6[_0x3a21('0x43')][_0x3a21('0x2e')]){_0x179bc1[_0x3a21('0x42')]=_[_0x3a21('0xcc')](_0x179bc1[_0x3a21('0x42')],{'$or':_['map'](_0x179bc1['attributes'],function(_0x2989c0){var _0x48b876={};_0x48b876[_0x2989c0]={'$like':'%'+_0x4a7de6[_0x3a21('0x43')][_0x3a21('0x2e')]+'%'};return _0x48b876;})});}_0x179bc1=_['merge']({},_0x179bc1,_0x4a7de6[_0x3a21('0x59')]);return _0x406fe0[_0x3a21('0xe2')](_0x179bc1);}})['then'](function(_0x2145dd){if(_0x2145dd){_0x4c2428=_0x2145dd[_0x3a21('0x4e')];if(!_0x4a7de6['query'][_0x3a21('0xcd')](_0x3a21('0xd3'))){_0x179bc1[_0x3a21('0x21')]=qs[_0x3a21('0x21')](_0x4a7de6[_0x3a21('0x43')][_0x3a21('0x21')]);_0x179bc1[_0x3a21('0x1e')]=qs[_0x3a21('0x1e')](_0x4a7de6[_0x3a21('0x43')][_0x3a21('0x1e')]);}return _0x406fe0[_0x3a21('0xe2')](_0x179bc1);}})[_0x3a21('0x26')](function(_0x1af3d6){if(_0x1af3d6){return _0x1af3d6?{'count':_0x4c2428,'rows':_0x1af3d6}:null;}})[_0x3a21('0x26')](respondWithResult(_0x4ef04e,null))[_0x3a21('0x1b')](handleError(_0x4ef04e,null));};exports[_0x3a21('0xe4')]=function(_0x4b42dc,_0x4af56b){var _0x1f9d84={'raw':!![],'where':{}};var _0x285a1b={};var _0x13e470={'count':0x0,'rows':[]};return db[_0x3a21('0x3b')][_0x3a21('0x93')]({'where':{'id':_0x4b42dc[_0x3a21('0x54')]['id']}})[_0x3a21('0x26')](handleEntityNotFound(_0x4af56b,null))[_0x3a21('0x26')](function(_0x31d4a5){if(_0x31d4a5){_0x285a1b['model']=_[_0x3a21('0x56')](db[_0x3a21('0xe5')][_0x3a21('0x3c')]);_0x285a1b['query']=_[_0x3a21('0x56')](_0x4b42dc['query']);_0x285a1b[_0x3a21('0xcb')]=_[_0x3a21('0x57')](_0x285a1b[_0x3a21('0x55')],_0x285a1b['query']);_0x1f9d84[_0x3a21('0x49')]=_[_0x3a21('0x57')](_0x285a1b['model'],qs[_0x3a21('0x58')](_0x4b42dc[_0x3a21('0x43')][_0x3a21('0x58')]));_0x1f9d84[_0x3a21('0x49')]=_0x1f9d84[_0x3a21('0x49')][_0x3a21('0x4e')]?_0x1f9d84['attributes']:_0x285a1b[_0x3a21('0x55')];if(!_0x4b42dc[_0x3a21('0x43')][_0x3a21('0xcd')](_0x3a21('0xd3'))){_0x1f9d84['limit']=qs[_0x3a21('0x21')](_0x4b42dc[_0x3a21('0x43')][_0x3a21('0x21')]);_0x1f9d84[_0x3a21('0x1e')]=qs[_0x3a21('0x1e')](_0x4b42dc[_0x3a21('0x43')][_0x3a21('0x1e')]);}_0x1f9d84[_0x3a21('0xc9')]=qs[_0x3a21('0xca')](_0x4b42dc['query']['sort']);_0x1f9d84[_0x3a21('0x42')]=qs[_0x3a21('0xcb')](_['pick'](_0x4b42dc[_0x3a21('0x43')],_0x285a1b['filters']));_0x1f9d84[_0x3a21('0x42')][_0x3a21('0xde')]=_0x31d4a5['id'];if(_0x4b42dc[_0x3a21('0x43')][_0x3a21('0x2e')]){_0x1f9d84[_0x3a21('0x42')]=_[_0x3a21('0xcc')](_0x1f9d84[_0x3a21('0x42')],{'$or':_[_0x3a21('0x30')](_0x1f9d84[_0x3a21('0x49')],function(_0x23fa4b){var _0x2b373a={};_0x2b373a[_0x23fa4b]={'$like':'%'+_0x4b42dc[_0x3a21('0x43')][_0x3a21('0x2e')]+'%'};return _0x2b373a;})});}_0x1f9d84=_[_0x3a21('0xcc')]({},_0x1f9d84,_0x4b42dc[_0x3a21('0x59')]);return db[_0x3a21('0xe5')][_0x3a21('0x20')]({'where':_0x1f9d84[_0x3a21('0x42')]})[_0x3a21('0x26')](function(_0xc98214){_0x13e470['count']=_0xc98214;if(_0x4b42dc['query'][_0x3a21('0x44')]){_0x1f9d84[_0x3a21('0x45')]=[{'all':!![]}];}return db['MailInteraction'][_0x3a21('0x4b')](_0x1f9d84);})['then'](function(_0x2d1102){_0x13e470[_0x3a21('0x4c')]=_0x2d1102;return _0x13e470;});}})[_0x3a21('0x26')](respondWithFilteredResult(_0x4af56b,_0x1f9d84))['catch'](handleError(_0x4af56b,null));};exports[_0x3a21('0xe6')]=function(_0x3649d7,_0x5149f9){var _0x56ebf4={};var _0x7bef3b={};var _0x3979bd;var _0x4e0922;return db[_0x3a21('0x3b')]['findOne']({'where':{'id':_0x3649d7[_0x3a21('0x54')]['id']}})['then'](handleEntityNotFound(_0x5149f9,null))[_0x3a21('0x26')](function(_0x421487){if(_0x421487){_0x3979bd=_0x421487;_0x7bef3b[_0x3a21('0x55')]=_[_0x3a21('0x56')](db[_0x3a21('0xe7')][_0x3a21('0x3c')]);_0x7bef3b[_0x3a21('0x43')]=_[_0x3a21('0x56')](_0x3649d7[_0x3a21('0x43')]);_0x7bef3b[_0x3a21('0xcb')]=_[_0x3a21('0x57')](_0x7bef3b[_0x3a21('0x55')],_0x7bef3b[_0x3a21('0x43')]);_0x56ebf4[_0x3a21('0x49')]=_[_0x3a21('0x57')](_0x7bef3b[_0x3a21('0x55')],qs[_0x3a21('0x58')](_0x3649d7['query']['fields']));_0x56ebf4[_0x3a21('0x49')]=_0x56ebf4[_0x3a21('0x49')][_0x3a21('0x4e')]?_0x56ebf4[_0x3a21('0x49')]:_0x7bef3b[_0x3a21('0x55')];_0x56ebf4[_0x3a21('0xc9')]=qs[_0x3a21('0xca')](_0x3649d7[_0x3a21('0x43')][_0x3a21('0xca')]);_0x56ebf4[_0x3a21('0x42')]=qs['filters'](_[_0x3a21('0xd6')](_0x3649d7[_0x3a21('0x43')],_0x7bef3b[_0x3a21('0xcb')]));if(_0x3649d7['query']['filter']){_0x56ebf4[_0x3a21('0x42')]=_[_0x3a21('0xcc')](_0x56ebf4['where'],{'$or':_['map'](_0x56ebf4[_0x3a21('0x49')],function(_0x3f978a){var _0x4941ec={};_0x4941ec[_0x3f978a]={'$like':'%'+_0x3649d7[_0x3a21('0x43')][_0x3a21('0x2e')]+'%'};return _0x4941ec;})});}_0x56ebf4=_[_0x3a21('0xcc')]({},_0x56ebf4,_0x3649d7[_0x3a21('0x59')]);return _0x3979bd[_0x3a21('0xe6')](_0x56ebf4);}})[_0x3a21('0x26')](function(_0xe3beb9){if(_0xe3beb9){_0x4e0922=_0xe3beb9[_0x3a21('0x4e')];if(!_0x3649d7[_0x3a21('0x43')][_0x3a21('0xcd')](_0x3a21('0xd3'))){_0x56ebf4['limit']=qs[_0x3a21('0x21')](_0x3649d7['query'][_0x3a21('0x21')]);_0x56ebf4[_0x3a21('0x1e')]=qs[_0x3a21('0x1e')](_0x3649d7[_0x3a21('0x43')][_0x3a21('0x1e')]);}return _0x3979bd['getSmsInteractions'](_0x56ebf4);}})[_0x3a21('0x26')](function(_0x440813){if(_0x440813){return _0x440813?{'count':_0x4e0922,'rows':_0x440813}:null;}})[_0x3a21('0x26')](respondWithResult(_0x5149f9,null))[_0x3a21('0x1b')](handleError(_0x5149f9,null));};exports[_0x3a21('0xe8')]=function(_0x56cc31,_0x3b99bb){var _0x2fbc1a={};var _0x5e72bf={};var _0x1d7c38;var _0xae2227;return db[_0x3a21('0x3b')]['findOne']({'where':{'id':_0x56cc31['params']['id']}})['then'](handleEntityNotFound(_0x3b99bb,null))[_0x3a21('0x26')](function(_0x1f31be){if(_0x1f31be){_0x1d7c38=_0x1f31be;_0x5e72bf[_0x3a21('0x55')]=_['keys'](db[_0x3a21('0xe9')][_0x3a21('0x3c')]);_0x5e72bf[_0x3a21('0x43')]=_['keys'](_0x56cc31[_0x3a21('0x43')]);_0x5e72bf[_0x3a21('0xcb')]=_[_0x3a21('0x57')](_0x5e72bf[_0x3a21('0x55')],_0x5e72bf[_0x3a21('0x43')]);_0x2fbc1a['attributes']=_[_0x3a21('0x57')](_0x5e72bf[_0x3a21('0x55')],qs[_0x3a21('0x58')](_0x56cc31['query'][_0x3a21('0x58')]));_0x2fbc1a[_0x3a21('0x49')]=_0x2fbc1a[_0x3a21('0x49')][_0x3a21('0x4e')]?_0x2fbc1a[_0x3a21('0x49')]:_0x5e72bf[_0x3a21('0x55')];_0x2fbc1a[_0x3a21('0xc9')]=qs['sort'](_0x56cc31['query'][_0x3a21('0xca')]);_0x2fbc1a[_0x3a21('0x42')]=qs[_0x3a21('0xcb')](_[_0x3a21('0xd6')](_0x56cc31['query'],_0x5e72bf[_0x3a21('0xcb')]));if(_0x56cc31[_0x3a21('0x43')][_0x3a21('0x2e')]){_0x2fbc1a[_0x3a21('0x42')]=_['merge'](_0x2fbc1a[_0x3a21('0x42')],{'$or':_['map'](_0x2fbc1a[_0x3a21('0x49')],function(_0x1f5210){var _0x27041a={};_0x27041a[_0x1f5210]={'$like':'%'+_0x56cc31[_0x3a21('0x43')]['filter']+'%'};return _0x27041a;})});}_0x2fbc1a=_[_0x3a21('0xcc')]({},_0x2fbc1a,_0x56cc31[_0x3a21('0x59')]);return _0x1d7c38[_0x3a21('0xe8')](_0x2fbc1a);}})[_0x3a21('0x26')](function(_0x12f306){if(_0x12f306){_0xae2227=_0x12f306['length'];if(!_0x56cc31[_0x3a21('0x43')]['hasOwnProperty'](_0x3a21('0xd3'))){_0x2fbc1a[_0x3a21('0x21')]=qs[_0x3a21('0x21')](_0x56cc31['query'][_0x3a21('0x21')]);_0x2fbc1a[_0x3a21('0x1e')]=qs[_0x3a21('0x1e')](_0x56cc31[_0x3a21('0x43')][_0x3a21('0x1e')]);}return _0x1d7c38[_0x3a21('0xe8')](_0x2fbc1a);}})['then'](function(_0x225b76){if(_0x225b76){return _0x225b76?{'count':_0xae2227,'rows':_0x225b76}:null;}})[_0x3a21('0x26')](respondWithResult(_0x3b99bb,null))[_0x3a21('0x1b')](handleError(_0x3b99bb,null));};exports[_0x3a21('0xea')]=function(_0x2eddeb,_0x484316){var _0x12ee85={};var _0x2c1453={};var _0x23a9a3;var _0x674b8c;return db[_0x3a21('0x3b')]['findOne']({'where':{'id':_0x2eddeb[_0x3a21('0x54')]['id']}})[_0x3a21('0x26')](handleEntityNotFound(_0x484316,null))[_0x3a21('0x26')](function(_0x2cb810){if(_0x2cb810){_0x23a9a3=_0x2cb810;_0x2c1453['model']=_['keys'](db[_0x3a21('0xeb')]['rawAttributes']);_0x2c1453[_0x3a21('0x43')]=_[_0x3a21('0x56')](_0x2eddeb['query']);_0x2c1453['filters']=_[_0x3a21('0x57')](_0x2c1453[_0x3a21('0x55')],_0x2c1453['query']);_0x12ee85[_0x3a21('0x49')]=_[_0x3a21('0x57')](_0x2c1453[_0x3a21('0x55')],qs[_0x3a21('0x58')](_0x2eddeb['query'][_0x3a21('0x58')]));_0x12ee85[_0x3a21('0x49')]=_0x12ee85[_0x3a21('0x49')][_0x3a21('0x4e')]?_0x12ee85[_0x3a21('0x49')]:_0x2c1453[_0x3a21('0x55')];_0x12ee85[_0x3a21('0xc9')]=qs[_0x3a21('0xca')](_0x2eddeb['query']['sort']);_0x12ee85[_0x3a21('0x42')]=qs[_0x3a21('0xcb')](_[_0x3a21('0xd6')](_0x2eddeb[_0x3a21('0x43')],_0x2c1453[_0x3a21('0xcb')]));if(_0x2eddeb[_0x3a21('0x43')]['filter']){_0x12ee85['where']=_[_0x3a21('0xcc')](_0x12ee85[_0x3a21('0x42')],{'$or':_[_0x3a21('0x30')](_0x12ee85['attributes'],function(_0xc3da61){var _0x37a291={};_0x37a291[_0xc3da61]={'$like':'%'+_0x2eddeb[_0x3a21('0x43')][_0x3a21('0x2e')]+'%'};return _0x37a291;})});}_0x12ee85=_['merge']({},_0x12ee85,_0x2eddeb[_0x3a21('0x59')]);return _0x23a9a3[_0x3a21('0xea')](_0x12ee85);}})[_0x3a21('0x26')](function(_0xf955b9){if(_0xf955b9){_0x674b8c=_0xf955b9[_0x3a21('0x4e')];if(!_0x2eddeb[_0x3a21('0x43')][_0x3a21('0xcd')]('nolimit')){_0x12ee85[_0x3a21('0x21')]=qs['limit'](_0x2eddeb['query']['limit']);_0x12ee85['offset']=qs[_0x3a21('0x1e')](_0x2eddeb['query'][_0x3a21('0x1e')]);}return _0x23a9a3[_0x3a21('0xea')](_0x12ee85);}})[_0x3a21('0x26')](function(_0x2b179f){if(_0x2b179f){return _0x2b179f?{'count':_0x674b8c,'rows':_0x2b179f}:null;}})[_0x3a21('0x26')](respondWithResult(_0x484316,null))[_0x3a21('0x1b')](handleError(_0x484316,null));};exports[_0x3a21('0xec')]=function(_0x17e5fa,_0x37966f,_0x4e36c8){var _0x39ce32;var _0x26fb38;var _0x20ad05;var _0x10f602=!_[_0x3a21('0x66')](_0x17e5fa[_0x3a21('0x54')]['id'])?_0x17e5fa[_0x3a21('0x54')]['id']:!_[_0x3a21('0x66')](_0x17e5fa[_0x3a21('0x7c')]['id'])?_0x17e5fa[_0x3a21('0x7c')]['id']:null;return db['User'][_0x3a21('0x33')]({'where':{'id':_0x10f602,'role':{'$or':['admin',_0x3a21('0x7c'),_0x3a21('0x70')]}},'attributes':['id',_0x3a21('0x35'),_0x3a21('0xed'),'mobile','role',_0x3a21('0x61'),_0x3a21('0x99')]})[_0x3a21('0x26')](function(_0x3ab2c8){if(_0x3ab2c8){if(_0x3ab2c8[_0x3a21('0x34')]===_0x3a21('0x70')){_0x39ce32=_0x3ab2c8;if(_0x17e5fa[_0x3a21('0x5c')][_0x3a21('0x9b')]){_0x20ad05=util[_0x3a21('0xa9')](_0x3a21('0xee'),_0x39ce32[_0x17e5fa[_0x3a21('0x5c')][_0x3a21('0x9b')]]);}else if(_0x17e5fa['body'][_0x3a21('0xef')]){_0x20ad05=util[_0x3a21('0xa9')](_0x3a21('0xaa'),_0x17e5fa['body'][_0x3a21('0xef')]);}else{_0x20ad05=util[_0x3a21('0xa9')](_0x3a21('0xaa'),_0x39ce32[_0x3a21('0x35')]);}socket['to'](util[_0x3a21('0xa9')](_0x3a21('0xf0'),_0x39ce32[_0x3a21('0x35')]))[_0x3a21('0x27')]('user:forcelogout',{'user':{'id':_0x39ce32['id'],'name':_0x39ce32[_0x3a21('0x35')]},'ip':_0x17e5fa['headers'][_0x3a21('0xf1')]||_0x17e5fa[_0x3a21('0xf2')][_0x3a21('0xf3')]||_0x17e5fa['socket']['remoteAddress']||_0x17e5fa[_0x3a21('0xf2')][_0x3a21('0xf4')][_0x3a21('0xf3')]});return db[_0x3a21('0xab')][_0x3a21('0x28')]({'where':{'membername':_0x39ce32['name']},'individualHooks':!![]});}}else{throw new db[(_0x3a21('0x8c'))]['ValidationError'](_0x3a21('0xf5'));}})['then'](function(){if(_0x39ce32){return _0x39ce32['getVoiceQueues']({'raw':!![]});}})[_0x3a21('0x26')](function(_0x2f3b9a){if(_0x39ce32){var _0x7900ac=[];if(_0x2f3b9a){_0x26fb38=_0x2f3b9a;if(_0x26fb38[_0x3a21('0x4e')]){for(var _0x398c3a=0x0;_0x398c3a<_0x26fb38[_0x3a21('0x4e')];_0x398c3a++){_0x7900ac['push']({'membername':_0x39ce32[_0x3a21('0x35')],'UserId':_0x39ce32['id'],'queue_name':_0x26fb38[_0x398c3a]['name'],'VoiceQueueId':_0x26fb38[_0x398c3a]['id'],'interface':_0x20ad05,'paused':_0x39ce32['loginInPause']||![],'penalty':_0x26fb38[_0x398c3a]['UserVoiceQueue.penalty']||0x0});}return BPromise[_0x3a21('0x88')](_0x7900ac,function(_0x2f0270){return db[_0x3a21('0xab')][_0x3a21('0xac')](_0x2f0270);});}}}})[_0x3a21('0x26')](function(){if(_0x39ce32){return db[_0x3a21('0xf6')]['findAll']({'where':{'membername':_0x39ce32['name'],'exitAt':null}});}})['then'](function(_0x4ce038){if(_0x39ce32){var _0x3cd8e0=[];_0x4ce038[_0x3a21('0xf7')](function(_0x227dba){_0x3cd8e0[_0x3a21('0x4a')](_0x227dba[_0x3a21('0x25')]({'exitAt':moment()[_0x3a21('0xa9')](_0x3a21('0xf8'))}));});return BPromise[_0x3a21('0x5b')](_0x3cd8e0);}})[_0x3a21('0x26')](function(){if(_0x39ce32){var _0x85fed9=[];var _0x595ff1=[];var _0x1a4acb=utils[_0x3a21('0xf9')]();var _0x315c36={'membername':_0x39ce32[_0x3a21('0x35')],'interface':_0x20ad05,'enterAt':moment()[_0x3a21('0xa9')](_0x3a21('0xf8')),'role':_0x39ce32[_0x3a21('0x34')],'internal':_0x39ce32[_0x3a21('0x61')]};_0x1a4acb[_0x3a21('0xf7')](function(_0xe28bf0){_0x85fed9[_0x3a21('0x4a')](_[_0x3a21('0xcc')]({'channel':_0xe28bf0,'type':_0x3a21('0xfa'),'data1':_0x17e5fa['body'][_0x3a21('0xfb')],'data2':_0x20ad05},_0x315c36));if(_0x39ce32[_0x3a21('0x99')]){_0x595ff1[_0x3a21('0x4a')](_[_0x3a21('0xcc')]({'channel':_0xe28bf0,'type':_0x3a21('0xfc'),'data1':_0x3a21('0xfd')},_0x315c36));}});return db[_0x3a21('0xf6')][_0x3a21('0xfe')](_0x85fed9[_0x3a21('0xff')](_0x595ff1),{'individualHooks':!![]});}})[_0x3a21('0x26')](function(){if(_0x39ce32){return _0x39ce32[_0x3a21('0x25')]({'online':!![],'lastLoginAt':moment()['format'](_0x3a21('0xf8')),'voicePause':_0x39ce32[_0x3a21('0x99')]||![],'mailPause':_0x39ce32[_0x3a21('0x99')]||![],'chatPause':_0x39ce32[_0x3a21('0x99')]||![],'faxPause':_0x39ce32[_0x3a21('0x99')]||![],'smsPause':_0x39ce32[_0x3a21('0x99')]||![],'openchannelPause':_0x39ce32[_0x3a21('0x99')]||![],'whatsappPause':_0x39ce32[_0x3a21('0x99')]||![],'pauseType':_0x39ce32[_0x3a21('0x99')]?_0x3a21('0xfd'):null,'interface':_0x20ad05,'lastPauseAt':moment()[_0x3a21('0xa9')]('YYYY-MM-DD\x20HH:mm:ss')});}})[_0x3a21('0x26')](function(_0x234aaf){if(_0x17e5fa[_0x3a21('0x100')]){return _0x4e36c8();}else{return BPromise['resolve'](_0x234aaf)['then'](respondWithResult(_0x37966f,null));}})['catch'](handleError(_0x37966f,null));};exports['logout']=function(_0x69a2cf,_0x542139){var _0x1e0c1c;return db[_0x3a21('0x3b')][_0x3a21('0x33')]({'where':{'id':_0x69a2cf[_0x3a21('0x54')]['id'],'role':_0x3a21('0x70')},'attributes':['id',_0x3a21('0x35'),_0x3a21('0x34')]})[_0x3a21('0x26')](handleEntityNotFound(_0x542139,null))['then'](function(_0x2f1f4f){if(_0x2f1f4f){_0x1e0c1c=_0x2f1f4f;return db[_0x3a21('0xab')][_0x3a21('0x28')]({'where':{'membername':_0x1e0c1c[_0x3a21('0x35')]},'individualHooks':!![]});}})['then'](function(){return db['MemberReport'][_0x3a21('0x4b')]({'where':{'membername':_0x1e0c1c[_0x3a21('0x35')],'exitAt':null}});})[_0x3a21('0x26')](function(_0x344e79){var _0x1cfd75=[];_0x344e79['forEach'](function(_0x3d6664){_0x1cfd75[_0x3a21('0x4a')](_0x3d6664['update']({'exitAt':moment()[_0x3a21('0xa9')](_0x3a21('0xf8'))}));});return BPromise['all'](_0x1cfd75);})[_0x3a21('0x26')](function(){return _0x1e0c1c[_0x3a21('0x25')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x3a21('0x26')](respondWithResult(_0x542139,null))[_0x3a21('0x1b')](handleError(_0x542139,null));};exports[_0x3a21('0x101')]=function(_0x2a97f8,_0x3ddb60){var _0xdb0096;return db[_0x3a21('0xab')][_0x3a21('0x25')]({'paused':0x1},{'where':{'UserId':_0x2a97f8[_0x3a21('0x54')]['id']},'individualHooks':!![]})[_0x3a21('0x26')](function(){return db[_0x3a21('0x3b')][_0x3a21('0x33')]({'where':{'id':_0x2a97f8[_0x3a21('0x54')]['id'],'role':_0x3a21('0x70')},'attributes':['id',_0x3a21('0x35'),_0x3a21('0x34'),'internal','interface']});})[_0x3a21('0x26')](handleEntityNotFound(_0x3ddb60,null))[_0x3a21('0x26')](function(_0x4d0461){if(_0x4d0461){_0xdb0096=_0x4d0461;return respondWithRpcPromise(_0x3a21('0x102'),_0x3a21('0x101'),{'id':_0xdb0096['id'],'name':_0xdb0096['name'],'pause':!![]});}})['then'](function(){if(_0xdb0096){return db[_0x3a21('0xf6')]['findAll']({'where':{'membername':_0xdb0096[_0x3a21('0x35')],'type':_0x3a21('0xfc'),'exitAt':null}});}})[_0x3a21('0x26')](function(_0x2af150){if(_0x2af150[_0x3a21('0x4e')]){var _0x22bacf=moment()['format'](_0x3a21('0xf8'));for(var _0x43acc6=0x0,_0x3d2ff2=_0x2af150[_0x3a21('0x4e')];_0x43acc6<_0x3d2ff2;_0x43acc6++){_0x2af150[_0x43acc6][_0x3a21('0x103')]({'exitAt':_0x22bacf});}}})['then'](function(){var _0x37e1fb=[];var _0x20a136=utils[_0x3a21('0xf9')]();_0x20a136[_0x3a21('0xf7')](function(_0xc3eebb){_0x37e1fb[_0x3a21('0x4a')]({'channel':_0xc3eebb,'membername':_0xdb0096[_0x3a21('0x35')],'interface':_['isNil'](_0xdb0096[_0x3a21('0x9b')])?util['format'](_0x3a21('0xaa'),_0xdb0096[_0x3a21('0x35')]):_0xdb0096['interface'],'type':_0x3a21('0xfc'),'enterAt':moment()['format'](_0x3a21('0xf8')),'data1':_0x2a97f8['body'][_0x3a21('0x104')]||_0x3a21('0x105'),'role':_0xdb0096[_0x3a21('0x34')],'internal':_0xdb0096[_0x3a21('0x61')]});});return db[_0x3a21('0xf6')]['bulkCreate'](_0x37e1fb,{'individualHooks':!![]});})[_0x3a21('0x26')](function(){return _0xdb0096[_0x3a21('0x25')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x2a97f8[_0x3a21('0x5c')][_0x3a21('0x104')]||_0x3a21('0x105'),'lastPauseAt':moment()[_0x3a21('0xa9')](_0x3a21('0xf8'))});})[_0x3a21('0x26')](respondWithResult(_0x3ddb60,null))[_0x3a21('0x1b')](handleError(_0x3ddb60,null));};exports[_0x3a21('0x106')]=function(_0x5b2663,_0x20e0cb){var _0x173af9;return db[_0x3a21('0x3b')][_0x3a21('0x33')]({'where':{'id':_0x5b2663[_0x3a21('0x54')]['id']},'attributes':['id',_0x3a21('0x35'),_0x3a21('0x34'),_0x3a21('0x9a'),_0x3a21('0x107'),'chatPause',_0x3a21('0x108'),_0x3a21('0x109'),'smsPause',_0x3a21('0x10a'),_0x3a21('0x10b'),_0x3a21('0x10c')]})[_0x3a21('0x26')](handleEntityNotFound(_0x20e0cb,null))['then'](function(_0x119a8b){if(_0x119a8b){_0x173af9=_0x119a8b;if(_0x5b2663[_0x3a21('0x5c')][_0x3a21('0xae')]&&!utils[_0x3a21('0x9c')](_0x5b2663[_0x3a21('0x5c')][_0x3a21('0xae')])){throw new db[(_0x3a21('0x8c'))][(_0x3a21('0x8d'))](_0x3a21('0x9d'));}switch(_0x5b2663['body']['channel']){case _0x3a21('0xa7'):return respondWithRpcPromise('QueuePause',_0x3a21('0x106'),{'id':_0x173af9['id'],'name':_0x173af9[_0x3a21('0x35')],'pause':![]})[_0x3a21('0x26')](function(){return db[_0x3a21('0xab')][_0x3a21('0x25')]({'paused':0x0},{'where':{'UserId':_0x173af9['id']},'individualHooks':!![]});})[_0x3a21('0x26')](function(){return db['MemberReport'][_0x3a21('0x33')]({'where':{'channel':_0x5b2663[_0x3a21('0x5c')][_0x3a21('0xae')],'membername':_0x173af9[_0x3a21('0x35')],'type':_0x3a21('0xfc'),'exitAt':null}});})[_0x3a21('0x26')](function(_0x26d569){if(_0x26d569){return _0x26d569[_0x3a21('0x25')]({'exitAt':moment()[_0x3a21('0xa9')](_0x3a21('0xf8')),'data2':_0x3a21('0x10d')},{'individualHooks':!![]});}return null;})[_0x3a21('0x26')](function(){return _0x173af9[_0x3a21('0x25')]({'voicePause':![]});});case _0x3a21('0x52'):case _0x3a21('0xbb'):case _0x3a21('0x51'):case'sms':case _0x3a21('0x5a'):case'openchannel':return db[_0x3a21('0xf6')][_0x3a21('0x33')]({'where':{'channel':_0x5b2663[_0x3a21('0x5c')][_0x3a21('0xae')],'membername':_0x173af9[_0x3a21('0x35')],'type':_0x3a21('0xfc'),'exitAt':null}})[_0x3a21('0x26')](function(_0x515771){if(_0x515771){return _0x515771['update']({'exitAt':moment()[_0x3a21('0xa9')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x3a21('0x10d')},{'individualHooks':!![]});}return null;})['then'](function(){var _0x2c0f0b={};_[_0x3a21('0x22')](_0x2c0f0b,util[_0x3a21('0xa9')]('%s%s',_0x5b2663[_0x3a21('0x5c')]['channel'],_0x3a21('0x10e')),![]);return _0x173af9[_0x3a21('0x25')](_0x2c0f0b);});default:return respondWithRpcPromise(_0x3a21('0x102'),_0x3a21('0x106'),{'id':_0x173af9['id'],'name':_0x173af9['name'],'pause':![]})[_0x3a21('0x26')](function(){return db[_0x3a21('0xab')][_0x3a21('0x25')]({'paused':0x0},{'where':{'UserId':_0x173af9['id']}});})[_0x3a21('0x26')](function(){return db[_0x3a21('0xf6')][_0x3a21('0x4b')]({'where':{'membername':_0x173af9[_0x3a21('0x35')],'type':_0x3a21('0xfc'),'exitAt':null}});})[_0x3a21('0x26')](function(_0x266400){var _0x4b1bcb=[];_0x266400[_0x3a21('0xf7')](function(_0x29268d){_0x4b1bcb['push'](_0x29268d[_0x3a21('0x25')]({'exitAt':moment()[_0x3a21('0xa9')](_0x3a21('0xf8')),'data2':_0x3a21('0x10d')}));});return BPromise['all'](_0x4b1bcb);})['then'](function(){return _0x173af9[_0x3a21('0x25')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})['then'](respondWithResult(_0x20e0cb,null))['catch'](handleError(_0x20e0cb,null));};exports[_0x3a21('0x10f')]=function(_0x397635,_0x453a5a){var _0x1265ac={};var _0x422204={};var _0xe7e9ce;var _0x356d5e;return db[_0x3a21('0x3b')][_0x3a21('0x93')]({'where':{'id':_0x397635[_0x3a21('0x54')]['id']}})[_0x3a21('0x26')](handleEntityNotFound(_0x453a5a,null))[_0x3a21('0x26')](function(_0x377e6c){if(_0x377e6c){_0xe7e9ce=_0x377e6c;_0x422204['model']=_['keys'](db['Team'][_0x3a21('0x3c')]);_0x422204['query']=_[_0x3a21('0x56')](_0x397635['query']);_0x422204[_0x3a21('0xcb')]=_[_0x3a21('0x57')](_0x422204[_0x3a21('0x55')],_0x422204[_0x3a21('0x43')]);_0x1265ac['attributes']=_[_0x3a21('0x57')](_0x422204[_0x3a21('0x55')],qs[_0x3a21('0x58')](_0x397635[_0x3a21('0x43')][_0x3a21('0x58')]));_0x1265ac['attributes']=_0x1265ac[_0x3a21('0x49')][_0x3a21('0x4e')]?_0x1265ac[_0x3a21('0x49')]:_0x422204['model'];_0x1265ac[_0x3a21('0xc9')]=qs[_0x3a21('0xca')](_0x397635[_0x3a21('0x43')][_0x3a21('0xca')]);_0x1265ac[_0x3a21('0x42')]=qs['filters'](_['pick'](_0x397635[_0x3a21('0x43')],_0x422204['filters']));if(_0x397635[_0x3a21('0x43')][_0x3a21('0x2e')]){_0x1265ac[_0x3a21('0x42')]=_[_0x3a21('0xcc')](_0x1265ac[_0x3a21('0x42')],{'$or':_[_0x3a21('0x30')](_0x1265ac[_0x3a21('0x49')],function(_0x5d8d6a){var _0x5cc04b={};_0x5cc04b[_0x5d8d6a]={'$like':'%'+_0x397635['query'][_0x3a21('0x2e')]+'%'};return _0x5cc04b;})});}_0x1265ac=_['merge']({},_0x1265ac,_0x397635[_0x3a21('0x59')]);return _0xe7e9ce[_0x3a21('0x10f')](_0x1265ac);}})['then'](function(_0x5cc7e2){if(_0x5cc7e2){_0x356d5e=_0x5cc7e2[_0x3a21('0x4e')];if(!_0x397635[_0x3a21('0x43')][_0x3a21('0xcd')](_0x3a21('0xd3'))){_0x1265ac['limit']=qs[_0x3a21('0x21')](_0x397635[_0x3a21('0x43')][_0x3a21('0x21')]);_0x1265ac['offset']=qs['offset'](_0x397635[_0x3a21('0x43')][_0x3a21('0x1e')]);}return _0xe7e9ce['getTeams'](_0x1265ac);}})[_0x3a21('0x26')](function(_0xea1f07){if(_0xea1f07){return _0xea1f07?{'count':_0x356d5e,'rows':_0xea1f07}:null;}})['then'](respondWithResult(_0x453a5a,null))[_0x3a21('0x1b')](handleError(_0x453a5a,null));};exports[_0x3a21('0x110')]=function(_0x4542df,_0x53176b){var _0x4535bf=_0x4542df['params']['id'];var _0x501685=_0x4542df['body']?_0x4542df[_0x3a21('0x5c')][_0x3a21('0x5f')]:null;var _0x1ffea1=[];return Promise[_0x3a21('0x111')]()['then'](function(){if(!_0x501685)throw new APIBadRequestError(_0x3a21('0x112'));})[_0x3a21('0x26')](function(){return db[_0x3a21('0x3b')][_0x3a21('0x93')]({'where':{'id':_0x4535bf}});})[_0x3a21('0x26')](function(_0x35ea11){if(!_0x35ea11)throw new APINotFoundError(util[_0x3a21('0xa9')](_0x3a21('0x113'),_0x4542df['params']['id']));return db['sequelize'][_0x3a21('0x114')](function(_0x22bd65){return _0x35ea11[_0x3a21('0x110')](_0x501685,{'transaction':_0x22bd65})[_0x3a21('0x26')](function(){return db['Team'][_0x3a21('0x4b')]({'where':{'id':{'$in':_0x501685}}});})['then'](function(_0x4f668a){var _0x249df9=_[_0x3a21('0x30')](_0x4f668a,function(_0x53de8f){return _0x53de8f['getAssociatedQueues']();});return Promise['all'](_0x249df9);})['then'](function(_0x23841a){_0x1ffea1=_['flattenDeep'](_0x23841a);var _0xbd5560=_[_0x3a21('0x30')](_0x1ffea1,function(_0x3182b9){return _0x3182b9[_0x3a21('0x115')](_0x35ea11['id'],{'transaction':_0x22bd65});});return Promise['all'](_0xbd5560);})['then'](function(){if(!_0x35ea11[_0x3a21('0xa8')])return;var _0x1bac27=_[_0x3a21('0x2e')](_0x1ffea1,function(_0x5129d9){return _0x5129d9['getDataValue']('channel')===_0x3a21('0x116');});var _0x3e41c5=_[_0x3a21('0x30')](_0x1bac27,function(_0x430118){return db[_0x3a21('0xab')][_0x3a21('0xac')]({'membername':_0x35ea11['name'],'UserId':_0x35ea11['id'],'queue_name':_0x430118['name'],'VoiceQueueId':_0x430118['id'],'interface':_['isNil'](_0x35ea11[_0x3a21('0x9b')])?util[_0x3a21('0xa9')](_0x3a21('0xaa'),_0x35ea11[_0x3a21('0x35')]):_0x35ea11[_0x3a21('0x9b')],'paused':_0x35ea11[_0x3a21('0x9a')]||![],'penalty':_0x35ea11['penalty']},{'transaction':_0x22bd65});});return Promise['all'](_0x3e41c5);})[_0x3a21('0x26')](function(){return db[_0x3a21('0x117')][_0x3a21('0x4b')]({'where':{'teamId':{'$in':_0x501685}}});})[_0x3a21('0x26')](function(_0x3cbbee){var _0x467c9e=_[_0x3a21('0x30')](_0x3cbbee,function(_0x1f62d7){return db[_0x3a21('0x118')]['create']({'UserId':_0x35ea11['id'],'VoicePrefixId':_0x1f62d7[_0x3a21('0x119')]},{'transaction':_0x22bd65});});return Promise['all'](_0x467c9e);});});})[_0x3a21('0x26')](function(){for(var _0x230b1c=0x0;_0x230b1c<_0x1ffea1[_0x3a21('0x4e')];_0x230b1c++){var _0x5ed226=_0x1ffea1[_0x230b1c]['getDataValue'](_0x3a21('0xae'));var _0x445880=_0x5ed226+'QueueId';socket['emit'](_0x3a21('0x7c')+_0x5ed226+_0x3a21('0xa5'),{'UserId':_0x4535bf,['queueField']:_0x1ffea1[_0x230b1c]['id']});}})[_0x3a21('0x26')](respondWithStatusCode(_0x53176b,null))[_0x3a21('0x1b')](APIHandleError(_0x53176b));};exports[_0x3a21('0x11a')]=function(_0x3256cf,_0xf47907){var _0x2477fd=_0x3256cf[_0x3a21('0x54')]['id'];var _0x506b22=null;if(_0x3256cf[_0x3a21('0x43')][_0x3a21('0x5f')]){_0x506b22=_[_0x3a21('0x11b')](_0x3256cf[_0x3a21('0x43')]['ids'])?_0x3256cf[_0x3a21('0x43')][_0x3a21('0x5f')]:[_0x3256cf[_0x3a21('0x43')][_0x3a21('0x5f')]];}var _0x5b6026=[];return Promise[_0x3a21('0x111')]()[_0x3a21('0x26')](function(){if(!_0x506b22)throw new APIBadRequestError(_0x3a21('0x11c'));})['then'](function(){return db[_0x3a21('0x3b')][_0x3a21('0x93')]({'where':{'id':_0x2477fd}});})[_0x3a21('0x26')](function(_0xcfc98e){if(!_0xcfc98e)throw new APINotFoundError(util[_0x3a21('0xa9')]('User\x20with\x20id\x20%s\x20not\x20found',_0x3256cf[_0x3a21('0x54')]['id']));return db[_0x3a21('0x68')]['transaction'](function(_0x14400a){return _0xcfc98e['removeTeams'](_0x506b22,{'transaction':_0x14400a})[_0x3a21('0x26')](function(){return db[_0x3a21('0x11d')]['findAll']({'where':{'id':{'$in':_0x506b22}}});})['then'](function(_0x297c2d){var _0x24297a=_[_0x3a21('0x30')](_0x297c2d,function(_0x2c2ecf){return _0x2c2ecf[_0x3a21('0x11e')]();});return Promise[_0x3a21('0x5b')](_0x24297a);})[_0x3a21('0x26')](function(_0x3e5883){_0x5b6026=_[_0x3a21('0x11f')](_0x3e5883);var _0x394b1c=_[_0x3a21('0x30')](_0x5b6026,function(_0x1c8243){return _0x1c8243[_0x3a21('0x120')](_0xcfc98e['id'],{'transaction':_0x14400a});});return Promise[_0x3a21('0x5b')](_0x394b1c);})['then'](function(){if(!_0xcfc98e[_0x3a21('0xa8')])return;var _0x557681=_[_0x3a21('0x2e')](_0x5b6026,function(_0x5e4600){return _0x5e4600[_0x3a21('0x121')]('channel')===_0x3a21('0x116');});var _0x3fccdc=_[_0x3a21('0x30')](_0x557681,function(_0x16f363){return db[_0x3a21('0xab')]['destroy']({'where':{'VoiceQueueId':_0x16f363['id'],'UserId':_0xcfc98e['id']},'transaction':_0x14400a});});return Promise[_0x3a21('0x5b')](_0x3fccdc);})['then'](function(){return db['TeamVoicePrefix']['findAll']({'where':{'teamId':{'$in':_0x506b22}}});})[_0x3a21('0x26')](function(_0x10f8bf){var _0x55150f=_['map'](_0x10f8bf,function(_0x33e475){return db[_0x3a21('0x118')][_0x3a21('0x28')]({'where':{'UserId':_0xcfc98e['id'],'VoicePrefixId':_0x33e475[_0x3a21('0x119')]}},{'transaction':_0x14400a});});return Promise[_0x3a21('0x5b')](_0x55150f);});});})[_0x3a21('0x26')](function(){for(var _0x112512=0x0;_0x112512<_0x5b6026[_0x3a21('0x4e')];_0x112512++){var _0x38878a=_0x5b6026[_0x112512]['getDataValue'](_0x3a21('0xae'));var _0x13d12d=_0x38878a+_0x3a21('0xa4');socket[_0x3a21('0x27')](_0x3a21('0x7c')+_0x38878a+_0x3a21('0xb0'),{'UserId':_0x2477fd,['queueField']:_0x5b6026[_0x112512]['id']});}})[_0x3a21('0x26')](respondWithStatusCode(_0xf47907,null))[_0x3a21('0x1b')](APIHandleError(_0xf47907));};exports[_0x3a21('0x122')]=function(_0x1c5465,_0x300555){var _0x1faa35={};var _0x3572ac={};var _0x1923f5;var _0x4c28ab;return db[_0x3a21('0x3b')][_0x3a21('0x93')]({'where':{'id':_0x1c5465[_0x3a21('0x54')]['id']}})[_0x3a21('0x26')](handleEntityNotFound(_0x300555,null))[_0x3a21('0x26')](function(_0x50c6b0){if(_0x50c6b0){_0x1923f5=_0x50c6b0;_0x3572ac[_0x3a21('0x55')]=_[_0x3a21('0x56')](db[_0x3a21('0xce')][_0x3a21('0x3c')]);_0x3572ac[_0x3a21('0x43')]=_[_0x3a21('0x56')](_0x1c5465[_0x3a21('0x43')]);_0x3572ac['filters']=_[_0x3a21('0x57')](_0x3572ac[_0x3a21('0x55')],_0x3572ac['query']);_0x1faa35['attributes']=_[_0x3a21('0x57')](_0x3572ac[_0x3a21('0x55')],qs[_0x3a21('0x58')](_0x1c5465[_0x3a21('0x43')]['fields']));_0x1faa35[_0x3a21('0x49')]=_0x1faa35[_0x3a21('0x49')][_0x3a21('0x4e')]?_0x1faa35[_0x3a21('0x49')]:_0x3572ac[_0x3a21('0x55')];_0x1faa35[_0x3a21('0xc9')]=qs[_0x3a21('0xca')](_0x1c5465[_0x3a21('0x43')][_0x3a21('0xca')]);_0x1faa35[_0x3a21('0x42')]=qs[_0x3a21('0xcb')](_['pick'](_0x1c5465[_0x3a21('0x43')],_0x3572ac['filters']));if(_0x1c5465[_0x3a21('0x43')][_0x3a21('0x2e')]){_0x1faa35[_0x3a21('0x42')]=_['merge'](_0x1faa35['where'],{'$or':_[_0x3a21('0x30')](_0x1faa35[_0x3a21('0x49')],function(_0x3baa02){var _0x3729e8={};_0x3729e8[_0x3baa02]={'$like':'%'+_0x1c5465[_0x3a21('0x43')][_0x3a21('0x2e')]+'%'};return _0x3729e8;})});}_0x1faa35=_[_0x3a21('0xcc')]({},_0x1faa35,_0x1c5465[_0x3a21('0x59')]);return _0x1923f5[_0x3a21('0x122')](_0x1faa35);}})['then'](function(_0x5b5f3c){if(_0x5b5f3c){_0x4c28ab=_0x5b5f3c[_0x3a21('0x4e')];if(!_0x1c5465[_0x3a21('0x43')][_0x3a21('0xcd')](_0x3a21('0xd3'))){_0x1faa35[_0x3a21('0x21')]=qs['limit'](_0x1c5465[_0x3a21('0x43')][_0x3a21('0x21')]);_0x1faa35[_0x3a21('0x1e')]=qs['offset'](_0x1c5465['query'][_0x3a21('0x1e')]);}return _0x1923f5['getLists'](_0x1faa35);}})['then'](function(_0x3d5d34){if(_0x3d5d34){return _0x3d5d34?{'count':_0x4c28ab,'rows':_0x3d5d34}:null;}})['then'](respondWithResult(_0x300555,null))[_0x3a21('0x1b')](handleError(_0x300555,null));};exports[_0x3a21('0x123')]=function(_0x22332e,_0x386dce){var _0x11113d={};var _0x38bc38={};var _0x1a36b6;return db[_0x3a21('0x3b')][_0x3a21('0x93')]({'where':{'id':_0x22332e[_0x3a21('0x54')]['id']}})['then'](handleEntityNotFound(_0x386dce,null))[_0x3a21('0x26')](function(_0x16b7b8){if(_0x16b7b8){_0x1a36b6=_0x16b7b8;_0x38bc38[_0x3a21('0x55')]=_['keys'](db[_0x3a21('0x3b')][_0x3a21('0x3c')]);_0x38bc38[_0x3a21('0x43')]=_[_0x3a21('0x56')](_0x22332e['query']);_0x38bc38[_0x3a21('0xcb')]=_[_0x3a21('0x57')](_0x38bc38['model'],_0x38bc38[_0x3a21('0x43')]);_0x11113d[_0x3a21('0x49')]=_['intersection'](_0x38bc38['model'],qs[_0x3a21('0x58')](_0x22332e['query'][_0x3a21('0x58')]));_0x11113d[_0x3a21('0x49')]=_0x11113d[_0x3a21('0x49')]['length']?_0x11113d[_0x3a21('0x49')]:_0x38bc38[_0x3a21('0x55')];_0x11113d['order']=qs[_0x3a21('0xca')](_0x22332e[_0x3a21('0x43')][_0x3a21('0xca')]);_0x11113d[_0x3a21('0x42')]=qs[_0x3a21('0xcb')](_['pick'](_0x22332e[_0x3a21('0x43')],_0x38bc38[_0x3a21('0xcb')]));if(_0x22332e[_0x3a21('0x43')]['filter']){_0x11113d[_0x3a21('0x42')]=_[_0x3a21('0xcc')](_0x11113d[_0x3a21('0x42')],{'$or':_[_0x3a21('0x30')](_0x11113d['attributes'],function(_0x12778c){var _0x4d974d={};_0x4d974d[_0x12778c]={'$like':'%'+_0x22332e['query']['filter']+'%'};return _0x4d974d;})});}_0x11113d[_0x3a21('0x55')]=db[_0x3a21('0x3b')];_0x11113d['as']=_0x3a21('0x2c');_0x11113d=_[_0x3a21('0xcc')]({},_0x11113d,_0x22332e[_0x3a21('0x59')]);return _0x1a36b6[_0x3a21('0x124')]({'include':[_0x11113d]});}})[_0x3a21('0x26')](function(_0x48ec88){if(_0x48ec88){var _0x323c7a={},_0xa31bb3=[];for(var _0x1ab1c4=0x0;_0x1ab1c4<_0x48ec88[_0x3a21('0x4e')];_0x1ab1c4+=0x1){for(var _0x3c8bf9=0x0,_0x414786;_0x3c8bf9<_0x48ec88[_0x1ab1c4]['Agents']['length'];_0x3c8bf9+=0x1){_0x414786=_0x48ec88[_0x1ab1c4][_0x3a21('0x2c')][_0x3c8bf9][_0x3a21('0x29')]({'plain':!![]});_0x323c7a[_0x414786['id']]=_0x414786;}}_0x323c7a=_['values'](_0x323c7a);for(var _0x26560d=qs[_0x3a21('0x1e')](_0x22332e[_0x3a21('0x43')][_0x3a21('0x1e')]);_0x26560d<_0x323c7a[_0x3a21('0x4e')]&&_0xa31bb3[_0x3a21('0x4e')]=_0x1568b8[_0x98cb('0x51')]){throw new Error(_0x98cb('0x52'));}})[_0x98cb('0x10')](function(){if(_0x11f5d5){return db[_0x98cb('0x2a')][_0x98cb('0x48')]({'where':{'membername':_0x11f5d5[_0x98cb('0x28')]},'individualHooks':!![]});}})[_0x98cb('0x10')](function(){if(_0x11f5d5){return _0x11f5d5[_0x98cb('0x53')]({'raw':!![]});}})[_0x98cb('0x10')](function(_0x4be948){if(_0x11f5d5){if(_0x4be948){var _0x1514b0=[];_0x58513e=_0x4be948;if(_0x58513e[_0x98cb('0x2c')]){for(var _0x44b862=0x0;_0x44b862<_0x58513e[_0x98cb('0x2c')];_0x44b862++){_0x1514b0[_0x98cb('0x30')](db[_0x98cb('0x2a')]['upsert']({'membername':_0x11f5d5['name'],'UserId':_0x11f5d5['id'],'queue_name':_0x58513e[_0x44b862]['name'],'VoiceQueueId':_0x58513e[_0x44b862]['id'],'interface':_0x16542d,'paused':_0x11f5d5[_0x98cb('0x4d')]||![],'penalty':_0x58513e[_0x44b862][_0x98cb('0x54')]||0x0}));}return BPromise[_0x98cb('0x49')](_0x1514b0);}}}})['then'](function(){if(_0x11f5d5){return db[_0x98cb('0x38')][_0x98cb('0x46')]({'where':{'membername':_0x11f5d5[_0x98cb('0x28')],'exitAt':null}});}})[_0x98cb('0x10')](function(_0x624336){if(_0x11f5d5){if(_0x624336&&_0x624336[_0x98cb('0x2c')]){var _0xc84918=[];_0x624336[_0x98cb('0x2f')](function(_0xb35d40){_0xc84918[_0x98cb('0x30')](_0xb35d40['update']({'exitAt':moment()[_0x98cb('0x2d')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x98cb('0x49')](_0xc84918);}}})[_0x98cb('0x10')](function(_0x57fcb6){if(_0x11f5d5){var _0x2c0bbb=[];var _0xb83cbd=[];var _0x4229e8=utils[_0x98cb('0x55')]();var _0x1ab73f={'membername':_0x11f5d5[_0x98cb('0x28')],'interface':_0x16542d,'enterAt':moment()[_0x98cb('0x2d')](_0x98cb('0x3a')),'role':_0x11f5d5[_0x98cb('0x4a')],'internal':_0x11f5d5[_0x98cb('0x4c')]};_0x4229e8['forEach'](function(_0x2acea3){_0x2c0bbb[_0x98cb('0x30')](_['merge']({'channel':_0x2acea3,'type':_0x98cb('0x56'),'data1':'callysquare','data2':_0x16542d},_0x1ab73f));if(_0x11f5d5['loginInPause']){_0xb83cbd[_0x98cb('0x30')](_[_0x98cb('0x57')]({'channel':_0x2acea3,'type':_0x98cb('0x33'),'data1':_0x98cb('0x58')},_0x1ab73f));}});return db[_0x98cb('0x38')][_0x98cb('0x39')](_0x2c0bbb[_0x98cb('0x59')](_0xb83cbd),{'individualHooks':!![]});}})[_0x98cb('0x10')](function(){if(_0x11f5d5){return _0x11f5d5[_0x98cb('0x2b')]({'online':!![],'lastLoginAt':moment()[_0x98cb('0x2d')](_0x98cb('0x3a')),'voicePause':_0x11f5d5[_0x98cb('0x4d')]||![],'mailPause':_0x11f5d5['loginInPause']||![],'chatPause':_0x11f5d5[_0x98cb('0x4d')]||![],'faxPause':_0x11f5d5['loginInPause']||![],'smsPause':_0x11f5d5[_0x98cb('0x4d')]||![],'openchannelPause':_0x11f5d5[_0x98cb('0x4d')]||![],'pauseType':_0x11f5d5[_0x98cb('0x4d')]?'LOGININPAUSE':null,'lastPauseAt':moment()[_0x98cb('0x2d')](_0x98cb('0x3a')),'interface':_0x16542d});}})['then'](function(_0x31eacd){_0x53098e(_0x31eacd);})[_0x98cb('0x1b')](function(_0x87b386){_0x5892ba(_0x4335f8[_0x98cb('0x17')](0x1f4,_0x87b386[_0x98cb('0x19')]));});});}; \ No newline at end of file +var _0x783f=['result','catch','GetUser','User','options','raw','limit','include','map','model','attributes','where','ShowUser','PauseUser','find','internal','interface','UserVoiceQueueRt','update','MemberReport','findAll','name','PAUSE','length','updateAttributes','getChannels','forEach','push','isNil','format','SIP/%s','YYYY-MM-DD\x20HH:mm:ss','body','type','DEFAULT\x20PAUSE','role','uniqueid','bulkCreate','UnpauseUser','findOne','isValidChannel','channel','Unknown\x20channel','voice','system','mail','chat','fax','sms','openchannel','whatsapp','set','%s%s','all','LogoutUser','destroy','LoginUser','mobile','loginInPause','count','agent','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','upsert','UserVoiceQueue.penalty','LOGIN','callysquare','LOGININPAUSE','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','request','then','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x5b47f9,_0x56f7fa){var _0x46f10f=function(_0x43dbe3){while(--_0x43dbe3){_0x5b47f9['push'](_0x5b47f9['shift']());}};_0x46f10f(++_0x56f7fa);}(_0x783f,0x167));var _0xf783=function(_0x59ed51,_0x3ae2ac){_0x59ed51=_0x59ed51-0x0;var _0x5e94dd=_0x783f[_0x59ed51];return _0x5e94dd;};'use strict';var _=require(_0xf783('0x0'));var util=require(_0xf783('0x1'));var moment=require('moment');var BPromise=require(_0xf783('0x2'));var rs=require(_0xf783('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf783('0x4'))['db'];var utils=require(_0xf783('0x5'));var logger=require(_0xf783('0x6'))(_0xf783('0x7'));var config=require(_0xf783('0x8'));var jayson=require(_0xf783('0x9'));var client=jayson[_0xf783('0xa')]['http']({'port':0x232a});config[_0xf783('0xb')]=_[_0xf783('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xf783('0xd'))(new Redis(config[_0xf783('0xb')]));require('./user.socket')['register'](socket);function respondWithRpcPromise(_0x14ad45,_0x34c9c3,_0x18011a){return new BPromise(function(_0x491cc1,_0x489d38){return client[_0xf783('0xe')](_0x14ad45,_0x18011a)[_0xf783('0xf')](function(_0x1e1357){logger['info'](_0xf783('0x10'),_0x34c9c3,_0xf783('0x11'));logger[_0xf783('0x12')](_0xf783('0x13'),_0x34c9c3,_0xf783('0x11'),JSON[_0xf783('0x14')](_0x1e1357));if(_0x1e1357[_0xf783('0x15')]){if(_0x1e1357['error'][_0xf783('0x16')]===0x1f4){logger[_0xf783('0x15')](_0xf783('0x10'),_0x34c9c3,_0x1e1357[_0xf783('0x15')][_0xf783('0x17')]);return _0x489d38(_0x1e1357[_0xf783('0x15')][_0xf783('0x17')]);}logger[_0xf783('0x15')](_0xf783('0x10'),_0x34c9c3,_0x1e1357['error'][_0xf783('0x17')]);return _0x491cc1(_0x1e1357[_0xf783('0x15')][_0xf783('0x17')]);}else{logger[_0xf783('0x18')](_0xf783('0x10'),_0x34c9c3,_0xf783('0x11'));_0x491cc1(_0x1e1357[_0xf783('0x19')]['message']);}})[_0xf783('0x1a')](function(_0x1d7f60){logger[_0xf783('0x15')](_0xf783('0x10'),_0x34c9c3,_0x1d7f60);_0x489d38(_0x1d7f60);});});}exports[_0xf783('0x1b')]=function(_0x5c754e){var _0x55567e=this;return new Promise(function(_0x4bc10e,_0xf39e6d){return db[_0xf783('0x1c')]['findAll']({'raw':_0x5c754e[_0xf783('0x1d')]?_0x5c754e['options'][_0xf783('0x1e')]===undefined?!![]:![]:!![],'where':_0x5c754e[_0xf783('0x1d')]?_0x5c754e['options']['where']||null:null,'attributes':_0x5c754e['options']?_0x5c754e[_0xf783('0x1d')]['attributes']||null:null,'limit':_0x5c754e[_0xf783('0x1d')]?_0x5c754e[_0xf783('0x1d')][_0xf783('0x1f')]||null:null,'include':_0x5c754e[_0xf783('0x1d')]?_0x5c754e[_0xf783('0x1d')][_0xf783('0x20')]?_[_0xf783('0x21')](_0x5c754e['options'][_0xf783('0x20')],function(_0x120b34){return{'model':db[_0x120b34[_0xf783('0x22')]],'as':_0x120b34['as'],'attributes':_0x120b34[_0xf783('0x23')],'include':_0x120b34[_0xf783('0x20')]?_[_0xf783('0x21')](_0x120b34[_0xf783('0x20')],function(_0x2dec2d){return{'model':db[_0x2dec2d[_0xf783('0x22')]],'as':_0x2dec2d['as'],'attributes':_0x2dec2d[_0xf783('0x23')],'include':_0x2dec2d[_0xf783('0x20')]?_['map'](_0x2dec2d[_0xf783('0x20')],function(_0x6fce57){return{'model':db[_0x6fce57[_0xf783('0x22')]],'as':_0x6fce57['as'],'attributes':_0x6fce57[_0xf783('0x23')]};}):[]};}):[]};}):[]:[]})[_0xf783('0xf')](function(_0x5a3a0f){logger['info'](_0xf783('0x1b'),_0x5c754e);logger[_0xf783('0x12')](_0xf783('0x1b'),_0x5c754e,JSON[_0xf783('0x14')](_0x5a3a0f));_0x4bc10e(_0x5a3a0f);})['catch'](function(_0x1344ff){logger[_0xf783('0x15')](_0xf783('0x1b'),_0x1344ff['message'],_0x5c754e);_0xf39e6d(_0x55567e[_0xf783('0x15')](0x1f4,_0x1344ff[_0xf783('0x17')]));});});};exports['ShowUser']=function(_0x1779bb){var _0x2aef69=this;return new Promise(function(_0x2e2632,_0x411d94){return db[_0xf783('0x1c')]['find']({'raw':_0x1779bb[_0xf783('0x1d')]?_0x1779bb[_0xf783('0x1d')][_0xf783('0x1e')]===undefined?!![]:![]:!![],'where':_0x1779bb[_0xf783('0x1d')]?_0x1779bb[_0xf783('0x1d')][_0xf783('0x24')]||null:null,'attributes':_0x1779bb[_0xf783('0x1d')]?_0x1779bb['options']['attributes']||null:null,'include':_0x1779bb[_0xf783('0x1d')]?_0x1779bb[_0xf783('0x1d')][_0xf783('0x20')]?_['map'](_0x1779bb[_0xf783('0x1d')][_0xf783('0x20')],function(_0x17db67){return{'model':db[_0x17db67[_0xf783('0x22')]],'as':_0x17db67['as'],'attributes':_0x17db67['attributes'],'include':_0x17db67[_0xf783('0x20')]?_[_0xf783('0x21')](_0x17db67[_0xf783('0x20')],function(_0x4f3949){return{'model':db[_0x4f3949[_0xf783('0x22')]],'as':_0x4f3949['as'],'attributes':_0x4f3949['attributes'],'include':_0x4f3949[_0xf783('0x20')]?_[_0xf783('0x21')](_0x4f3949[_0xf783('0x20')],function(_0x28c5f9){return{'model':db[_0x28c5f9[_0xf783('0x22')]],'as':_0x28c5f9['as'],'attributes':_0x28c5f9[_0xf783('0x23')]};}):[]};}):[]};}):[]:[]})[_0xf783('0xf')](function(_0x2905c8){logger[_0xf783('0x18')]('ShowUser',_0x1779bb);logger[_0xf783('0x12')](_0xf783('0x25'),_0x1779bb,JSON['stringify'](_0x2905c8));_0x2e2632(_0x2905c8);})['catch'](function(_0x31d839){logger[_0xf783('0x15')](_0xf783('0x25'),_0x31d839['message'],_0x1779bb);_0x411d94(_0x2aef69[_0xf783('0x15')](0x1f4,_0x31d839[_0xf783('0x17')]));});});};exports[_0xf783('0x26')]=function(_0x15f6a9){var _0xb8ec69=this;return new Promise(function(_0x234244,_0x2efdc7){var _0x37bc51;return db['User'][_0xf783('0x27')]({'where':_0x15f6a9[_0xf783('0x1d')][_0xf783('0x24')]||{},'attributes':['id','name','role',_0xf783('0x28'),_0xf783('0x29')]})['then'](function(_0xedbd7c){if(_0xedbd7c){_0x37bc51=_0xedbd7c;return db[_0xf783('0x2a')][_0xf783('0x2b')]({'paused':0x1},{'where':{'UserId':_0x37bc51['id']},'individualHooks':!![]});}})['then'](function(){if(_0x37bc51){return db[_0xf783('0x2c')][_0xf783('0x2d')]({'where':{'membername':_0x37bc51[_0xf783('0x2e')],'type':_0xf783('0x2f'),'exitAt':null}});}})[_0xf783('0xf')](function(_0x4f9048){if(_0x37bc51){if(_0x4f9048&&_0x4f9048[_0xf783('0x30')]){var _0x387a16=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');for(var _0x5c02b0=0x0,_0x1ba2de=_0x4f9048[_0xf783('0x30')];_0x5c02b0<_0x1ba2de;_0x5c02b0++){_0x4f9048[_0x5c02b0][_0xf783('0x31')]({'exitAt':_0x387a16});}}}})[_0xf783('0xf')](function(){if(_0x37bc51){var _0x567f3e=[];var _0x1ab733=utils[_0xf783('0x32')]();_0x1ab733[_0xf783('0x33')](function(_0x45bd36){_0x567f3e[_0xf783('0x34')]({'channel':_0x45bd36,'membername':_0x37bc51['name'],'interface':_[_0xf783('0x35')](_0x37bc51['interface'])?util[_0xf783('0x36')](_0xf783('0x37'),_0x37bc51['name']):_0x37bc51[_0xf783('0x29')],'type':_0xf783('0x2f'),'enterAt':moment()[_0xf783('0x36')](_0xf783('0x38')),'data1':_0x15f6a9[_0xf783('0x39')][_0xf783('0x3a')]||_0xf783('0x3b'),'role':_0x37bc51[_0xf783('0x3c')],'internal':_0x37bc51[_0xf783('0x28')],'uniqueid':_0x15f6a9['body'][_0xf783('0x3d')]||null});});return db[_0xf783('0x2c')][_0xf783('0x3e')](_0x567f3e,{'individualHooks':!![]});}})['then'](function(){if(_0x37bc51){return _0x37bc51[_0xf783('0x2b')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x15f6a9['body'][_0xf783('0x3a')]||_0xf783('0x3b'),'lastPauseAt':moment()[_0xf783('0x36')](_0xf783('0x38'))});}})[_0xf783('0xf')](function(_0x52eb14){_0x234244(_0x52eb14);})[_0xf783('0x1a')](function(_0x472332){_0x2efdc7(_0xb8ec69[_0xf783('0x15')](0x1f4,_0x472332['message']));});});};exports[_0xf783('0x3f')]=function(_0x40302e){var _0x5b5669=this;return new Promise(function(_0xeec883,_0x37627d){var _0x38dbb0;return db[_0xf783('0x1c')][_0xf783('0x40')]({'where':_0x40302e[_0xf783('0x1d')][_0xf783('0x24')]||{},'attributes':['id',_0xf783('0x2e')]})[_0xf783('0xf')](function(_0x2b1de9){if(_0x2b1de9){_0x38dbb0=_0x2b1de9;if(_0x40302e[_0xf783('0x39')]['channel']&&!utils[_0xf783('0x41')](_0x40302e[_0xf783('0x39')][_0xf783('0x42')])){throw new Error(_0xf783('0x43'));}switch(_0x40302e[_0xf783('0x39')][_0xf783('0x42')]){case _0xf783('0x44'):return db[_0xf783('0x2a')][_0xf783('0x2b')]({'paused':0x0},{'where':{'UserId':_0x38dbb0['id']}})[_0xf783('0xf')](function(){return db[_0xf783('0x2c')][_0xf783('0x27')]({'where':{'channel':_0x40302e[_0xf783('0x39')]['channel'],'membername':_0x38dbb0[_0xf783('0x2e')],'type':'PAUSE','exitAt':null}});})[_0xf783('0xf')](function(_0x335e20){if(_0x335e20){return _0x335e20['update']({'exitAt':moment()[_0xf783('0x36')](_0xf783('0x38')),'data2':_0xf783('0x45')},{'individualHooks':!![]});}return null;})[_0xf783('0xf')](function(){return _0x38dbb0[_0xf783('0x2b')]({'voicePause':![]});});case _0xf783('0x46'):case _0xf783('0x47'):case _0xf783('0x48'):case _0xf783('0x49'):case _0xf783('0x4a'):case _0xf783('0x4b'):return db[_0xf783('0x2c')][_0xf783('0x27')]({'where':{'channel':_0x40302e[_0xf783('0x39')][_0xf783('0x42')],'membername':_0x38dbb0[_0xf783('0x2e')],'type':_0xf783('0x2f'),'exitAt':null}})[_0xf783('0xf')](function(_0xe44e3a){return _0xe44e3a[_0xf783('0x2b')]({'exitAt':moment()[_0xf783('0x36')](_0xf783('0x38')),'data2':'system'},{'individualHooks':!![]});})[_0xf783('0xf')](function(){var _0x52a385={};_[_0xf783('0x4c')](_0x52a385,util[_0xf783('0x36')](_0xf783('0x4d'),_0x40302e[_0xf783('0x39')][_0xf783('0x42')],'Pause'),![]);return _0x38dbb0[_0xf783('0x2b')](_0x52a385);});default:return db[_0xf783('0x2a')][_0xf783('0x2b')]({'paused':0x0},{'where':{'UserId':_0x38dbb0['id']}})[_0xf783('0xf')](function(){return db[_0xf783('0x2c')][_0xf783('0x2d')]({'where':{'membername':_0x38dbb0[_0xf783('0x2e')],'type':'PAUSE','exitAt':null}});})[_0xf783('0xf')](function(_0x10f0cd){var _0x54442d=[];_0x10f0cd[_0xf783('0x33')](function(_0x136e1f){_0x54442d['push'](_0x136e1f['update']({'exitAt':moment()['format'](_0xf783('0x38')),'data2':_0xf783('0x45')}));});return BPromise[_0xf783('0x4e')](_0x54442d);})[_0xf783('0xf')](function(){return _0x38dbb0[_0xf783('0x2b')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})[_0xf783('0xf')](function(_0xec2dda){_0xeec883(_0xec2dda);})['catch'](function(_0x345c06){_0x37627d(_0x5b5669['error'](0x1f4,_0x345c06[_0xf783('0x17')]));});});};exports[_0xf783('0x4f')]=function(_0x325988){var _0xfd0bd5=this;return new Promise(function(_0x19ab87,_0x2c5165){var _0x4d8515;return db[_0xf783('0x1c')][_0xf783('0x40')]({'where':_0x325988['options']['where']||{},'attributes':['id',_0xf783('0x2e')]})[_0xf783('0xf')](function(_0x5cf20f){if(_0x5cf20f){_0x4d8515=_0x5cf20f;return db[_0xf783('0x2a')][_0xf783('0x50')]({'where':{'membername':_0x4d8515[_0xf783('0x2e')]},'individualHooks':!![]});}})[_0xf783('0xf')](function(){if(_0x4d8515){return db[_0xf783('0x2c')][_0xf783('0x2d')]({'where':{'membername':_0x4d8515[_0xf783('0x2e')],'exitAt':null}});}})[_0xf783('0xf')](function(_0x25aea0){if(_0x4d8515){if(_0x25aea0&&_0x25aea0[_0xf783('0x30')]){var _0x2ae32b=[];_0x25aea0['forEach'](function(_0x5341a0){_0x2ae32b['push'](_0x5341a0[_0xf783('0x2b')]({'exitAt':moment()[_0xf783('0x36')](_0xf783('0x38'))}));});return BPromise[_0xf783('0x4e')](_0x2ae32b);}}})[_0xf783('0xf')](function(){if(_0x4d8515){return _0x4d8515['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})['then'](function(_0x36ed81){_0x19ab87(_0x36ed81);})[_0xf783('0x1a')](function(_0x12b5a1){_0x2c5165(_0xfd0bd5[_0xf783('0x15')](0x1f4,_0x12b5a1[_0xf783('0x17')]));});});};exports[_0xf783('0x51')]=function(_0x20f444){var _0x8b722a=this;return new Promise(function(_0x313072,_0x38a73c){var _0x1cc565;var _0x444530;var _0xca116e;var _0x16cc5a;return db[_0xf783('0x1c')][_0xf783('0x40')]({'where':_0x20f444[_0xf783('0x1d')][_0xf783('0x24')]||{},'attributes':['id','name',_0xf783('0x3c'),_0xf783('0x52'),'phone',_0xf783('0x28'),_0xf783('0x53'),_0xf783('0x29')]})[_0xf783('0xf')](function(_0x3bea96){if(_0x3bea96){_0x1cc565=_0x3bea96;_0x16cc5a=_0x20f444['body'][_0xf783('0x29')]?_0x20f444[_0xf783('0x39')][_0xf783('0x29')]:util['format']('SIP/%s',_0x1cc565[_0xf783('0x2e')]);return db[_0xf783('0x1c')][_0xf783('0x54')]({'where':{'role':_0xf783('0x55'),'online':!![],'id':{'$ne':_0x1cc565['id']}}});}})[_0xf783('0xf')](function(_0x3cffbb){if(_0x3cffbb){_0xca116e=_0x3cffbb;return require(_0xf783('0x56'))[_0xf783('0x57')]();}})[_0xf783('0xf')](function(_0x31b152){if(_0x31b152&&_0x31b152[_0xf783('0x58')]&&_0xca116e>=_0x31b152[_0xf783('0x58')]){throw new Error(_0xf783('0x59'));}})['then'](function(){if(_0x1cc565){return db[_0xf783('0x2a')]['destroy']({'where':{'membername':_0x1cc565['name']},'individualHooks':!![]});}})[_0xf783('0xf')](function(){if(_0x1cc565){return _0x1cc565[_0xf783('0x5a')]({'raw':!![]});}})['then'](function(_0x539b2b){if(_0x1cc565){if(_0x539b2b){var _0x273d3a=[];_0x444530=_0x539b2b;if(_0x444530['length']){for(var _0x1c0428=0x0;_0x1c0428<_0x444530[_0xf783('0x30')];_0x1c0428++){_0x273d3a['push'](db[_0xf783('0x2a')][_0xf783('0x5b')]({'membername':_0x1cc565[_0xf783('0x2e')],'UserId':_0x1cc565['id'],'queue_name':_0x444530[_0x1c0428][_0xf783('0x2e')],'VoiceQueueId':_0x444530[_0x1c0428]['id'],'interface':_0x16cc5a,'paused':_0x1cc565['loginInPause']||![],'penalty':_0x444530[_0x1c0428][_0xf783('0x5c')]||0x0}));}return BPromise[_0xf783('0x4e')](_0x273d3a);}}}})[_0xf783('0xf')](function(){if(_0x1cc565){return db[_0xf783('0x2c')]['findAll']({'where':{'membername':_0x1cc565['name'],'exitAt':null}});}})[_0xf783('0xf')](function(_0x454f29){if(_0x1cc565){if(_0x454f29&&_0x454f29[_0xf783('0x30')]){var _0x11a43b=[];_0x454f29[_0xf783('0x33')](function(_0x850510){_0x11a43b[_0xf783('0x34')](_0x850510['update']({'exitAt':moment()[_0xf783('0x36')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0xf783('0x4e')](_0x11a43b);}}})[_0xf783('0xf')](function(_0x284c1d){if(_0x1cc565){var _0x4e7a81=[];var _0x2a99e5=[];var _0x745a89=utils[_0xf783('0x32')]();var _0x26b29f={'membername':_0x1cc565[_0xf783('0x2e')],'interface':_0x16cc5a,'enterAt':moment()[_0xf783('0x36')](_0xf783('0x38')),'role':_0x1cc565[_0xf783('0x3c')],'internal':_0x1cc565[_0xf783('0x28')]};_0x745a89[_0xf783('0x33')](function(_0x108796){_0x4e7a81[_0xf783('0x34')](_['merge']({'channel':_0x108796,'type':_0xf783('0x5d'),'data1':_0xf783('0x5e'),'data2':_0x16cc5a},_0x26b29f));if(_0x1cc565[_0xf783('0x53')]){_0x2a99e5[_0xf783('0x34')](_['merge']({'channel':_0x108796,'type':'PAUSE','data1':_0xf783('0x5f')},_0x26b29f));}});return db[_0xf783('0x2c')]['bulkCreate'](_0x4e7a81['concat'](_0x2a99e5),{'individualHooks':!![]});}})[_0xf783('0xf')](function(){if(_0x1cc565){return _0x1cc565['update']({'online':!![],'lastLoginAt':moment()[_0xf783('0x36')](_0xf783('0x38')),'voicePause':_0x1cc565[_0xf783('0x53')]||![],'mailPause':_0x1cc565[_0xf783('0x53')]||![],'chatPause':_0x1cc565['loginInPause']||![],'faxPause':_0x1cc565[_0xf783('0x53')]||![],'smsPause':_0x1cc565['loginInPause']||![],'openchannelPause':_0x1cc565[_0xf783('0x53')]||![],'pauseType':_0x1cc565['loginInPause']?_0xf783('0x5f'):null,'lastPauseAt':moment()['format'](_0xf783('0x38')),'interface':_0x16cc5a});}})['then'](function(_0x18f0ef){_0x313072(_0x18f0ef);})[_0xf783('0x1a')](function(_0x2f2a09){_0x38a73c(_0x8b722a['error'](0x1f4,_0x2f2a09[_0xf783('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 3163c41..a5bfadc 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 _0x8558=['emit','removeListener','register','length','user:','./user.events','save','remove'];(function(_0x1c61f9,_0x66ba02){var _0x4de6ab=function(_0xfb76e2){while(--_0xfb76e2){_0x1c61f9['push'](_0x1c61f9['shift']());}};_0x4de6ab(++_0x66ba02);}(_0x8558,0x8d));var _0x8855=function(_0x3a9d21,_0x4870c4){_0x3a9d21=_0x3a9d21-0x0;var _0x4712db=_0x8558[_0x3a9d21];return _0x4712db;};'use strict';var UserEvents=require(_0x8855('0x0'));var events=[_0x8855('0x1'),_0x8855('0x2'),'update'];function createListener(_0x5a56dc,_0x190817){return function(_0x330b8b){_0x190817[_0x8855('0x3')](_0x5a56dc,_0x330b8b);};}function removeListener(_0x36a2b0,_0x22e194){return function(){UserEvents[_0x8855('0x4')](_0x36a2b0,_0x22e194);};}exports[_0x8855('0x5')]=function(_0x2b3587){for(var _0x52418d=0x0,_0x59c022=events[_0x8855('0x6')];_0x52418d<_0x59c022;_0x52418d++){var _0x226e71=events[_0x52418d];var _0x50e512=createListener(_0x8855('0x7')+_0x226e71,_0x2b3587);UserEvents['on'](_0x226e71,_0x50e512);}}; \ No newline at end of file +var _0x5b72=['emit','removeListener','register','user:','save','remove','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5b72,0x17e));var _0x25b7=function(_0x12c84c,_0xb354e6){_0x12c84c=_0x12c84c-0x0;var _0x36aef3=_0x5b72[_0x12c84c];return _0x36aef3;};'use strict';var UserEvents=require('./user.events');var events=[_0x25b7('0x0'),_0x25b7('0x1'),_0x25b7('0x2')];function createListener(_0x436eb5,_0x57302a){return function(_0x332bba){_0x57302a[_0x25b7('0x3')](_0x436eb5,_0x332bba);};}function removeListener(_0x512911,_0x1dd6e5){return function(){UserEvents[_0x25b7('0x4')](_0x512911,_0x1dd6e5);};}exports[_0x25b7('0x5')]=function(_0x3917c9){for(var _0x5cc2af=0x0,_0x1c16f5=events['length'];_0x5cc2af<_0x1c16f5;_0x5cc2af++){var _0x2cd35f=events[_0x5cc2af];var _0xf210c=createListener(_0x25b7('0x6')+_0x2cd35f,_0x3917c9);UserEvents['on'](_0x2cd35f,_0xf210c);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index c8ea0c1..da55b5e 100644 --- a/server/api/userChatQueue/index.js +++ b/server/api/userChatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x494c6f,_0x54dbe7){var _0x4c9c08=function(_0x22fe1b){while(--_0x22fe1b){_0x494c6f['push'](_0x494c6f['shift']());}};_0x4c9c08(++_0x54dbe7);}(_0x9c44,0x178));var _0x49c4=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x9c44[_0x3b0731];return _0x4204d7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x555bc4,_0x463a19){var _0x410bda=function(_0x501fc5){while(--_0x501fc5){_0x555bc4['push'](_0x555bc4['shift']());}};_0x410bda(++_0x463a19);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x414f67,_0x861aed){_0x414f67=_0x414f67-0x0;var _0x338537=_0xcb91[_0x414f67];return _0x338537;};'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/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 48275d4..55a4e4c 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 _0x874b=['exports','INTEGER'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x874b,0x196));var _0xb874=function(_0x3971a9,_0x3caf60){_0x3971a9=_0x3971a9-0x0;var _0x2987a1=_0x874b[_0x3971a9];return _0x2987a1;};'use strict';var Sequelize=require('sequelize');module[_0xb874('0x0')]={'penalty':{'type':Sequelize[_0xb874('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb837=['exports','INTEGER'];(function(_0x4b4f24,_0x5654a8){var _0x1c13d4=function(_0x4940bf){while(--_0x4940bf){_0x4b4f24['push'](_0x4b4f24['shift']());}};_0x1c13d4(++_0x5654a8);}(_0xb837,0x166));var _0x7b83=function(_0x1f753b,_0x5894ea){_0x1f753b=_0x1f753b-0x0;var _0x34db7e=_0xb837[_0x1f753b];return _0x34db7e;};'use strict';var Sequelize=require('sequelize');module[_0x7b83('0x0')]={'penalty':{'type':Sequelize[_0x7b83('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 575bd1d..51b2395 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 _0xfa5c=['user_has_chat_queues','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','exports'];(function(_0x32d5e4,_0x5a4d24){var _0x10704e=function(_0x357397){while(--_0x357397){_0x32d5e4['push'](_0x32d5e4['shift']());}};_0x10704e(++_0x5a4d24);}(_0xfa5c,0x169));var _0xcfa5=function(_0x1d49b5,_0x5b37a1){_0x1d49b5=_0x1d49b5-0x0;var _0x3baca5=_0xfa5c[_0x1d49b5];return _0x3baca5;};'use strict';var _=require('lodash');var util=require(_0xcfa5('0x0'));var logger=require(_0xcfa5('0x1'))('api');var moment=require(_0xcfa5('0x2'));var BPromise=require(_0xcfa5('0x3'));var rp=require(_0xcfa5('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcfa5('0x5'));var config=require(_0xcfa5('0x6'));var attributes=require('./userChatQueue.attributes');module[_0xcfa5('0x7')]=function(_0x3e65a6,_0x482dcb){return _0x3e65a6['define']('UserChatQueue',attributes,{'tableName':_0xcfa5('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5db2=['bluebird','request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes','exports','UserChatQueue','user_has_chat_queues','lodash','util','../../config/logger','moment'];(function(_0x430c14,_0x3afe0b){var _0xbceb21=function(_0x18568b){while(--_0x18568b){_0x430c14['push'](_0x430c14['shift']());}};_0xbceb21(++_0x3afe0b);}(_0x5db2,0xf3));var _0x25db=function(_0x48b660,_0x45ae0b){_0x48b660=_0x48b660-0x0;var _0x18b53a=_0x5db2[_0x48b660];return _0x18b53a;};'use strict';var _=require(_0x25db('0x0'));var util=require(_0x25db('0x1'));var logger=require(_0x25db('0x2'))('api');var moment=require(_0x25db('0x3'));var BPromise=require(_0x25db('0x4'));var rp=require(_0x25db('0x5'));var fs=require('fs');var path=require(_0x25db('0x6'));var rimraf=require(_0x25db('0x7'));var config=require(_0x25db('0x8'));var attributes=require(_0x25db('0x9'));module[_0x25db('0xa')]=function(_0x4b9260,_0x248306){return _0x4b9260['define'](_0x25db('0xb'),attributes,{'tableName':_0x25db('0xc'),'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 be386e2..b842368 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 _0xabe7=['rpc','../../config/environment','jayson/promise','client','http','request','then','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x4c6b54,_0x198a4e){var _0x3fc405=function(_0x2e034c){while(--_0x2e034c){_0x4c6b54['push'](_0x4c6b54['shift']());}};_0x3fc405(++_0x198a4e);}(_0xabe7,0x169));var _0x7abe=function(_0x19efa6,_0xb6a8be){_0x19efa6=_0x19efa6-0x0;var _0x2beffd=_0xabe7[_0x19efa6];return _0x2beffd;};'use strict';var _=require(_0x7abe('0x0'));var util=require(_0x7abe('0x1'));var moment=require('moment');var BPromise=require(_0x7abe('0x2'));var rs=require(_0x7abe('0x3'));var fs=require('fs');var Redis=require(_0x7abe('0x4'));var db=require(_0x7abe('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7abe('0x6'))(_0x7abe('0x7'));var config=require(_0x7abe('0x8'));var jayson=require(_0x7abe('0x9'));var client=jayson[_0x7abe('0xa')][_0x7abe('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1c14ac,_0x24c507,_0x25ce0b){return new BPromise(function(_0x2c39f6,_0x237521){return client[_0x7abe('0xc')](_0x1c14ac,_0x25ce0b)[_0x7abe('0xd')](function(_0x47b26f){logger['info'](_0x7abe('0xe'),_0x24c507,_0x7abe('0xf'));logger[_0x7abe('0x10')](_0x7abe('0x11'),_0x24c507,_0x7abe('0xf'),JSON['stringify'](_0x47b26f));if(_0x47b26f[_0x7abe('0x12')]){if(_0x47b26f[_0x7abe('0x12')][_0x7abe('0x13')]===0x1f4){logger['error'](_0x7abe('0xe'),_0x24c507,_0x47b26f['error']['message']);return _0x237521(_0x47b26f['error']['message']);}logger[_0x7abe('0x12')](_0x7abe('0xe'),_0x24c507,_0x47b26f[_0x7abe('0x12')][_0x7abe('0x14')]);return _0x2c39f6(_0x47b26f[_0x7abe('0x12')][_0x7abe('0x14')]);}else{logger[_0x7abe('0x15')](_0x7abe('0xe'),_0x24c507,_0x7abe('0xf'));_0x2c39f6(_0x47b26f['result']['message']);}})[_0x7abe('0x16')](function(_0x2e2071){logger[_0x7abe('0x12')](_0x7abe('0xe'),_0x24c507,_0x2e2071);_0x237521(_0x2e2071);});});} \ No newline at end of file +var _0x578e=['message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x1de4b8,_0x529b41){var _0x557699=function(_0xb10c18){while(--_0xb10c18){_0x1de4b8['push'](_0x1de4b8['shift']());}};_0x557699(++_0x529b41);}(_0x578e,0x13a));var _0xe578=function(_0x7ea3b8,_0x726e83){_0x7ea3b8=_0x7ea3b8-0x0;var _0x401aba=_0x578e[_0x7ea3b8];return _0x401aba;};'use strict';var _=require('lodash');var util=require(_0xe578('0x0'));var moment=require(_0xe578('0x1'));var BPromise=require(_0xe578('0x2'));var rs=require(_0xe578('0x3'));var fs=require('fs');var Redis=require(_0xe578('0x4'));var db=require(_0xe578('0x5'))['db'];var utils=require(_0xe578('0x6'));var logger=require(_0xe578('0x7'))(_0xe578('0x8'));var config=require(_0xe578('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xe578('0xa')][_0xe578('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x44c05b,_0x2bbc2e,_0x548a52){return new BPromise(function(_0x183989,_0x11a783){return client[_0xe578('0xc')](_0x44c05b,_0x548a52)[_0xe578('0xd')](function(_0x411cc5){logger[_0xe578('0xe')](_0xe578('0xf'),_0x2bbc2e,_0xe578('0x10'));logger[_0xe578('0x11')](_0xe578('0x12'),_0x2bbc2e,'request\x20sent',JSON[_0xe578('0x13')](_0x411cc5));if(_0x411cc5[_0xe578('0x14')]){if(_0x411cc5[_0xe578('0x14')][_0xe578('0x15')]===0x1f4){logger['error']('UserChatQueue,\x20%s,\x20%s',_0x2bbc2e,_0x411cc5['error']['message']);return _0x11a783(_0x411cc5[_0xe578('0x14')][_0xe578('0x16')]);}logger[_0xe578('0x14')](_0xe578('0xf'),_0x2bbc2e,_0x411cc5[_0xe578('0x14')][_0xe578('0x16')]);return _0x183989(_0x411cc5[_0xe578('0x14')][_0xe578('0x16')]);}else{logger[_0xe578('0xe')]('UserChatQueue,\x20%s,\x20%s',_0x2bbc2e,'request\x20sent');_0x183989(_0x411cc5[_0xe578('0x17')]['message']);}})['catch'](function(_0x52fb48){logger[_0xe578('0x14')](_0xe578('0xf'),_0x2bbc2e,_0x52fb48);_0x11a783(_0x52fb48);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 9f1aa11..d33dfda 100644 --- a/server/api/userFaxQueue/index.js +++ b/server/api/userFaxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x388b3e,_0x260613){var _0x594cf6=function(_0x42cb0a){while(--_0x42cb0a){_0x388b3e['push'](_0x388b3e['shift']());}};_0x594cf6(++_0x260613);}(_0xedd9,0xfc));var _0x9edd=function(_0x487886,_0x1c947d){_0x487886=_0x487886-0x0;var _0x3eb36a=_0xedd9[_0x487886];return _0x3eb36a;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x38984,_0x664aae){var _0x151520=function(_0x150704){while(--_0x150704){_0x38984['push'](_0x38984['shift']());}};_0x151520(++_0x664aae);}(_0xcb91,0x1a9));var _0x1cb9=function(_0xa2c0a3,_0x5bbac0){_0xa2c0a3=_0xa2c0a3-0x0;var _0x52c618=_0xcb91[_0xa2c0a3];return _0x52c618;};'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/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 881d28c..3ad4644 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 _0x5e0b=['INTEGER','sequelize'];(function(_0x334f9a,_0x542f01){var _0x2b219d=function(_0x25bb3e){while(--_0x25bb3e){_0x334f9a['push'](_0x334f9a['shift']());}};_0x2b219d(++_0x542f01);}(_0x5e0b,0x93));var _0xb5e0=function(_0x5ddaac,_0x2697a8){_0x5ddaac=_0x5ddaac-0x0;var _0x2a9c58=_0x5e0b[_0x5ddaac];return _0x2a9c58;};'use strict';var Sequelize=require(_0xb5e0('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xb5e0('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x95d9=['STRING','sequelize','exports','INTEGER'];(function(_0x355ce8,_0x5f1d0a){var _0x1db8b8=function(_0x277eb2){while(--_0x277eb2){_0x355ce8['push'](_0x355ce8['shift']());}};_0x1db8b8(++_0x5f1d0a);}(_0x95d9,0x75));var _0x995d=function(_0xac151d,_0x4ea1d2){_0xac151d=_0xac151d-0x0;var _0x111dba=_0x95d9[_0xac151d];return _0x111dba;};'use strict';var Sequelize=require(_0x995d('0x0'));module[_0x995d('0x1')]={'penalty':{'type':Sequelize[_0x995d('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0x995d('0x3')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 5104e85..ef91618 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 _0xe513=['../../config/environment','exports','define','user_has_fax_queues','lodash','util','api','moment','request-promise','path'];(function(_0x2edb84,_0x5185d1){var _0x233b8c=function(_0x35720a){while(--_0x35720a){_0x2edb84['push'](_0x2edb84['shift']());}};_0x233b8c(++_0x5185d1);}(_0xe513,0xc2));var _0x3e51=function(_0x8160fa,_0x2228dd){_0x8160fa=_0x8160fa-0x0;var _0x2cbf6d=_0xe513[_0x8160fa];return _0x2cbf6d;};'use strict';var _=require(_0x3e51('0x0'));var util=require(_0x3e51('0x1'));var logger=require('../../config/logger')(_0x3e51('0x2'));var moment=require(_0x3e51('0x3'));var BPromise=require('bluebird');var rp=require(_0x3e51('0x4'));var fs=require('fs');var path=require(_0x3e51('0x5'));var rimraf=require('rimraf');var config=require(_0x3e51('0x6'));var attributes=require('./userFaxQueue.attributes');module[_0x3e51('0x7')]=function(_0x19d721,_0x53ef25){return _0x19d721[_0x3e51('0x8')]('UserFaxQueue',attributes,{'tableName':_0x3e51('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd044=['lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./userFaxQueue.attributes','exports','define','user_has_fax_queues'];(function(_0x3cba93,_0x5c2fd8){var _0x4a2991=function(_0x3cf95b){while(--_0x3cf95b){_0x3cba93['push'](_0x3cba93['shift']());}};_0x4a2991(++_0x5c2fd8);}(_0xd044,0xe4));var _0x4d04=function(_0x22dbd1,_0x47e0bb){_0x22dbd1=_0x22dbd1-0x0;var _0x50a4fd=_0xd044[_0x22dbd1];return _0x50a4fd;};'use strict';var _=require(_0x4d04('0x0'));var util=require(_0x4d04('0x1'));var logger=require(_0x4d04('0x2'))(_0x4d04('0x3'));var moment=require('moment');var BPromise=require(_0x4d04('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4d04('0x5'));var rimraf=require(_0x4d04('0x6'));var config=require(_0x4d04('0x7'));var attributes=require(_0x4d04('0x8'));module[_0x4d04('0x9')]=function(_0x4f1563,_0x115244){return _0x4f1563[_0x4d04('0xa')]('UserFaxQueue',attributes,{'tableName':_0x4d04('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index d991124..ebdba78 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 _0x9c28=['UserFaxQueue,\x20%s,\x20%s','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','lodash','util','moment','randomstring','ioredis','../../config/utils','jayson/promise','http','then'];(function(_0x128bef,_0xc7a0af){var _0x1ba862=function(_0x4858e8){while(--_0x4858e8){_0x128bef['push'](_0x128bef['shift']());}};_0x1ba862(++_0xc7a0af);}(_0x9c28,0x14d));var _0x89c2=function(_0x592a5d,_0x53e9b8){_0x592a5d=_0x592a5d-0x0;var _0x4d9254=_0x9c28[_0x592a5d];return _0x4d9254;};'use strict';var _=require(_0x89c2('0x0'));var util=require(_0x89c2('0x1'));var moment=require(_0x89c2('0x2'));var BPromise=require('bluebird');var rs=require(_0x89c2('0x3'));var fs=require('fs');var Redis=require(_0x89c2('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x89c2('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x89c2('0x6'));var client=jayson['client'][_0x89c2('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5d3b24,_0xf064e2,_0x3b264d){return new BPromise(function(_0x2b93ec,_0x1bd56b){return client['request'](_0x5d3b24,_0x3b264d)[_0x89c2('0x8')](function(_0x277e48){logger['info'](_0x89c2('0x9'),_0xf064e2,'request\x20sent');logger[_0x89c2('0xa')](_0x89c2('0xb'),_0xf064e2,_0x89c2('0xc'),JSON[_0x89c2('0xd')](_0x277e48));if(_0x277e48[_0x89c2('0xe')]){if(_0x277e48['error']['code']===0x1f4){logger[_0x89c2('0xe')]('UserFaxQueue,\x20%s,\x20%s',_0xf064e2,_0x277e48['error'][_0x89c2('0xf')]);return _0x1bd56b(_0x277e48[_0x89c2('0xe')][_0x89c2('0xf')]);}logger[_0x89c2('0xe')](_0x89c2('0x9'),_0xf064e2,_0x277e48[_0x89c2('0xe')][_0x89c2('0xf')]);return _0x2b93ec(_0x277e48[_0x89c2('0xe')]['message']);}else{logger[_0x89c2('0x10')](_0x89c2('0x9'),_0xf064e2,_0x89c2('0xc'));_0x2b93ec(_0x277e48[_0x89c2('0x11')][_0x89c2('0xf')]);}})['catch'](function(_0x2ee470){logger[_0x89c2('0xe')](_0x89c2('0x9'),_0xf064e2,_0x2ee470);_0x1bd56b(_0x2ee470);});});} \ No newline at end of file +var _0xd830=['request\x20sent','debug','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','info','UserFaxQueue,\x20%s,\x20%s'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xd830,0x118));var _0x0d83=function(_0x4afebf,_0x40b2bf){_0x4afebf=_0x4afebf-0x0;var _0x21bf0a=_0xd830[_0x4afebf];return _0x21bf0a;};'use strict';var _=require(_0x0d83('0x0'));var util=require(_0x0d83('0x1'));var moment=require(_0x0d83('0x2'));var BPromise=require(_0x0d83('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d83('0x4'));var db=require(_0x0d83('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x0d83('0x6'));var config=require(_0x0d83('0x7'));var jayson=require(_0x0d83('0x8'));var client=jayson[_0x0d83('0x9')][_0x0d83('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x42da80,_0x21f9d8,_0x355733){return new BPromise(function(_0x5d9bf7,_0x503209){return client['request'](_0x42da80,_0x355733)[_0x0d83('0xb')](function(_0x2f2888){logger[_0x0d83('0xc')](_0x0d83('0xd'),_0x21f9d8,_0x0d83('0xe'));logger[_0x0d83('0xf')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x21f9d8,_0x0d83('0xe'),JSON['stringify'](_0x2f2888));if(_0x2f2888[_0x0d83('0x10')]){if(_0x2f2888['error'][_0x0d83('0x11')]===0x1f4){logger[_0x0d83('0x10')](_0x0d83('0xd'),_0x21f9d8,_0x2f2888[_0x0d83('0x10')][_0x0d83('0x12')]);return _0x503209(_0x2f2888[_0x0d83('0x10')][_0x0d83('0x12')]);}logger[_0x0d83('0x10')](_0x0d83('0xd'),_0x21f9d8,_0x2f2888[_0x0d83('0x10')]['message']);return _0x5d9bf7(_0x2f2888[_0x0d83('0x10')]['message']);}else{logger[_0x0d83('0xc')](_0x0d83('0xd'),_0x21f9d8,'request\x20sent');_0x5d9bf7(_0x2f2888[_0x0d83('0x13')][_0x0d83('0x12')]);}})[_0x0d83('0x14')](function(_0x4c111e){logger[_0x0d83('0x10')](_0x0d83('0xd'),_0x21f9d8,_0x4c111e);_0x503209(_0x4c111e);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index f3c4751..7a8c853 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x907200,_0x406f6e){var _0x54b46b=function(_0x52ea2a){while(--_0x52ea2a){_0x907200['push'](_0x907200['shift']());}};_0x54b46b(++_0x406f6e);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x8975ac,_0x30655a){var _0x8b7f44=function(_0xf0d5dd){while(--_0xf0d5dd){_0x8975ac['push'](_0x8975ac['shift']());}};_0x8b7f44(++_0x30655a);}(_0x70e0,0x17b));var _0x070e=function(_0x5beb16,_0x3ed4bb){_0x5beb16=_0x5beb16-0x0;var _0x3daec1=_0x70e0[_0x5beb16];return _0x3daec1;};'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/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 3c3bf17..9006424 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 _0x1625=['INTEGER','exports'];(function(_0x56f63f,_0x3ed8c9){var _0x25b30f=function(_0x48724e){while(--_0x48724e){_0x56f63f['push'](_0x56f63f['shift']());}};_0x25b30f(++_0x3ed8c9);}(_0x1625,0xe3));var _0x5162=function(_0x469798,_0x10a707){_0x469798=_0x469798-0x0;var _0x3bf67f=_0x1625[_0x469798];return _0x3bf67f;};'use strict';var Sequelize=require('sequelize');module[_0x5162('0x0')]={'penalty':{'type':Sequelize[_0x5162('0x1')],'defaultValue':0x0}}; \ No newline at end of file +'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index fb8cb64..43f50cf 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 _0xbad2=['api','moment','bluebird','path','rimraf','../../config/environment','exports','define','lodash','util'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xbad2,0x10c));var _0x2bad=function(_0x9f13fe,_0x58b22f){_0x9f13fe=_0x9f13fe-0x0;var _0x3f537e=_0xbad2[_0x9f13fe];return _0x3f537e;};'use strict';var _=require(_0x2bad('0x0'));var util=require(_0x2bad('0x1'));var logger=require('../../config/logger')(_0x2bad('0x2'));var moment=require(_0x2bad('0x3'));var BPromise=require(_0x2bad('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2bad('0x5'));var rimraf=require(_0x2bad('0x6'));var config=require(_0x2bad('0x7'));var attributes=require('./userMailQueue.attributes');module[_0x2bad('0x8')]=function(_0x18a971,_0x27ff09){return _0x18a971[_0x2bad('0x9')]('UserMailQueue',attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd7b3=['./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues','lodash','util','../../config/logger','api','moment','rimraf','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd7b3,0x1f1));var _0x3d7b=function(_0x282ff9,_0x268bfe){_0x282ff9=_0x282ff9-0x0;var _0x542612=_0xd7b3[_0x282ff9];return _0x542612;};'use strict';var _=require(_0x3d7b('0x0'));var util=require(_0x3d7b('0x1'));var logger=require(_0x3d7b('0x2'))(_0x3d7b('0x3'));var moment=require(_0x3d7b('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3d7b('0x5'));var config=require(_0x3d7b('0x6'));var attributes=require(_0x3d7b('0x7'));module[_0x3d7b('0x8')]=function(_0x5b1e76,_0x486fc3){return _0x5b1e76[_0x3d7b('0x9')](_0x3d7b('0xa'),attributes,{'tableName':_0x3d7b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index 69b442a..bee7c6d 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 _0x5fc3=['../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','stringify','error','code','message','UserMailQueue,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0xea6a33,_0x11cfe1){var _0x141b02=function(_0x45cf41){while(--_0x45cf41){_0xea6a33['push'](_0xea6a33['shift']());}};_0x141b02(++_0x11cfe1);}(_0x5fc3,0xa8));var _0x35fc=function(_0xb301d4,_0x27ed18){_0xb301d4=_0xb301d4-0x0;var _0x3b5bde=_0x5fc3[_0xb301d4];return _0x3b5bde;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var moment=require('moment');var BPromise=require(_0x35fc('0x2'));var rs=require(_0x35fc('0x3'));var fs=require('fs');var Redis=require(_0x35fc('0x4'));var db=require(_0x35fc('0x5'))['db'];var utils=require(_0x35fc('0x6'));var logger=require('../../config/logger')(_0x35fc('0x7'));var config=require(_0x35fc('0x8'));var jayson=require(_0x35fc('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x19a0d1,_0x508b32,_0x16e153){return new BPromise(function(_0x27524f,_0xc72d93){return client[_0x35fc('0xa')](_0x19a0d1,_0x16e153)[_0x35fc('0xb')](function(_0xf9d3a6){logger[_0x35fc('0xc')]('UserMailQueue,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'));logger[_0x35fc('0xe')]('UserMailQueue,\x20%s,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'),JSON[_0x35fc('0xf')](_0xf9d3a6));if(_0xf9d3a6['error']){if(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x11')]===0x1f4){logger['error']('UserMailQueue,\x20%s,\x20%s',_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0xc72d93(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x12')]);}logger[_0x35fc('0x10')](_0x35fc('0x13'),_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0x27524f(_0xf9d3a6['error']['message']);}else{logger['info'](_0x35fc('0x13'),_0x508b32,_0x35fc('0xd'));_0x27524f(_0xf9d3a6[_0x35fc('0x14')][_0x35fc('0x12')]);}})[_0x35fc('0x15')](function(_0x1121fa){logger['error'](_0x35fc('0x13'),_0x508b32,_0x1121fa);_0xc72d93(_0x1121fa);});});} \ No newline at end of file +var _0x55ca=['rpc','../../config/environment','jayson/promise','client','http','request','then','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','ioredis','../../mysqldb','../../config/logger'];(function(_0x4823de,_0x136649){var _0x484084=function(_0x4137ec){while(--_0x4137ec){_0x4823de['push'](_0x4823de['shift']());}};_0x484084(++_0x136649);}(_0x55ca,0x126));var _0xa55c=function(_0x46cb35,_0x2b92ab){_0x46cb35=_0x46cb35-0x0;var _0x847507=_0x55ca[_0x46cb35];return _0x847507;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa55c('0x2'));var db=require(_0xa55c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa55c('0x4'))(_0xa55c('0x5'));var config=require(_0xa55c('0x6'));var jayson=require(_0xa55c('0x7'));var client=jayson[_0xa55c('0x8')][_0xa55c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36b623,_0x4d0624,_0x2121fd){return new BPromise(function(_0x2537f0,_0x57e069){return client[_0xa55c('0xa')](_0x36b623,_0x2121fd)[_0xa55c('0xb')](function(_0x52a3bc){logger['info'](_0xa55c('0xc'),_0x4d0624,_0xa55c('0xd'));logger[_0xa55c('0xe')](_0xa55c('0xf'),_0x4d0624,_0xa55c('0xd'),JSON[_0xa55c('0x10')](_0x52a3bc));if(_0x52a3bc[_0xa55c('0x11')]){if(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x12')]===0x1f4){logger[_0xa55c('0x11')]('UserMailQueue,\x20%s,\x20%s',_0x4d0624,_0x52a3bc['error'][_0xa55c('0x13')]);return _0x57e069(_0x52a3bc['error']['message']);}logger['error'](_0xa55c('0xc'),_0x4d0624,_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);return _0x2537f0(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);}else{logger[_0xa55c('0x14')]('UserMailQueue,\x20%s,\x20%s',_0x4d0624,_0xa55c('0xd'));_0x2537f0(_0x52a3bc[_0xa55c('0x15')][_0xa55c('0x13')]);}})[_0xa55c('0x16')](function(_0x1c4cfd){logger[_0xa55c('0x11')](_0xa55c('0xc'),_0x4d0624,_0x1c4cfd);_0x57e069(_0x1c4cfd);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index c0e2194..065091c 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 _0xbda2=['../../components/interaction/service','../../config/environment','./userNotification.controller','post','isAuthenticated','sendUserNotification','connect-timeout','express','Router','fs-extra'];(function(_0x252f4f,_0x278feb){var _0x493f33=function(_0x5e9753){while(--_0x5e9753){_0x252f4f['push'](_0x252f4f['shift']());}};_0x493f33(++_0x278feb);}(_0xbda2,0x10a));var _0x2bda=function(_0x14df1b,_0xe2261e){_0x14df1b=_0x14df1b-0x0;var _0x2013d1=_0xbda2[_0x14df1b];return _0x2013d1;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x2bda('0x0'));var express=require(_0x2bda('0x1'));var router=express[_0x2bda('0x2')]();var fs_extra=require(_0x2bda('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x2bda('0x4'));var config=require(_0x2bda('0x5'));var controller=require(_0x2bda('0x6'));router[_0x2bda('0x7')]('/',auth[_0x2bda('0x8')](),controller[_0x2bda('0x9')]);module['exports']=router; \ No newline at end of file +var _0xe0b6=['../../components/auth/service','../../components/interaction/service','../../config/environment','post','isAuthenticated','sendUserNotification','exports','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x2fbb34,_0x358b15){var _0x26914a=function(_0x240fc1){while(--_0x240fc1){_0x2fbb34['push'](_0x2fbb34['shift']());}};_0x26914a(++_0x358b15);}(_0xe0b6,0xe4));var _0x6e0b=function(_0x51beba,_0x202d19){_0x51beba=_0x51beba-0x0;var _0x167ee0=_0xe0b6[_0x51beba];return _0x167ee0;};'use strict';var multer=require(_0x6e0b('0x0'));var util=require(_0x6e0b('0x1'));var path=require(_0x6e0b('0x2'));var timeout=require(_0x6e0b('0x3'));var express=require(_0x6e0b('0x4'));var router=express['Router']();var fs_extra=require(_0x6e0b('0x5'));var auth=require(_0x6e0b('0x6'));var interaction=require(_0x6e0b('0x7'));var config=require(_0x6e0b('0x8'));var controller=require('./userNotification.controller');router[_0x6e0b('0x9')]('/',auth[_0x6e0b('0xa')](),controller[_0x6e0b('0xb')]);module[_0x6e0b('0xc')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index acec812..5b9953a 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 _0x24ce=['TEXT','STRING'];(function(_0x35ead2,_0x2f4a1d){var _0x53ca39=function(_0x2c9071){while(--_0x2c9071){_0x35ead2['push'](_0x35ead2['shift']());}};_0x53ca39(++_0x2f4a1d);}(_0x24ce,0x1ca));var _0xe24c=function(_0x2bb2ad,_0x4f4773){_0x2bb2ad=_0x2bb2ad-0x0;var _0x3990ef=_0x24ce[_0x2bb2ad];return _0x3990ef;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0xe24c('0x0')]},'senderName':{'type':Sequelize[_0xe24c('0x1')]},'recipientsId':{'type':Sequelize[_0xe24c('0x0')]},'recipientsDescription':{'type':Sequelize[_0xe24c('0x1')]},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file +var _0xbded=['exports','TEXT','STRING','BOOLEAN','sequelize'];(function(_0x2a5353,_0x8afbe8){var _0x14eddc=function(_0x5b33f2){while(--_0x5b33f2){_0x2a5353['push'](_0x2a5353['shift']());}};_0x14eddc(++_0x8afbe8);}(_0xbded,0x81));var _0xdbde=function(_0x1107d8,_0x2a1376){_0x1107d8=_0x1107d8-0x0;var _0x46214f=_0xbded[_0x1107d8];return _0x46214f;};'use strict';var Sequelize=require(_0xdbde('0x0'));module[_0xdbde('0x1')]={'body':{'type':Sequelize[_0xdbde('0x2')]},'senderName':{'type':Sequelize[_0xdbde('0x3')]},'recipientsId':{'type':Sequelize[_0xdbde('0x2')]},'recipientsDescription':{'type':Sequelize[_0xdbde('0x3')]},'beep':{'type':Sequelize[_0xdbde('0x4')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index f367f76..bedc7da 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 _0x54b9=['mailqueue','openchannelqueue','smsqueue','whatsappqueue','team','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','user','recipientsDescription','isEmpty','beep','recipientsId','sortBy','sequelize','create','userNotification:send','catch','Template','findOne','html','render','startCase','User','ids','queue','replace','push','all','union','flatten','map','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','register','status','end','json','undefined','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','error','name','send','sendUserNotification','body','hasOwnProperty','text','TemplateId','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Sequelize','Missing\x20\x27view\x27\x20parameter','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue'];(function(_0x5504a2,_0x34e7da){var _0x53d5ed=function(_0x210e79){while(--_0x210e79){_0x5504a2['push'](_0x5504a2['shift']());}};_0x53d5ed(++_0x34e7da);}(_0x54b9,0x83));var _0x954b=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0x54b9[_0x2b7764];return _0x848dcb;};'use strict';var emlformat=require(_0x954b('0x0'));var rimraf=require(_0x954b('0x1'));var zipdir=require(_0x954b('0x2'));var jsonpatch=require(_0x954b('0x3'));var rp=require(_0x954b('0x4'));var moment=require(_0x954b('0x5'));var BPromise=require(_0x954b('0x6'));var Mustache=require(_0x954b('0x7'));var util=require(_0x954b('0x8'));var path=require(_0x954b('0x9'));var sox=require(_0x954b('0xa'));var csv=require(_0x954b('0xb'));var ejs=require(_0x954b('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x954b('0xd'));var squel=require(_0x954b('0xe'));var crypto=require(_0x954b('0xf'));var jsforce=require(_0x954b('0x10'));var deskjs=require(_0x954b('0x11'));var toCsv=require(_0x954b('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x954b('0x12'));var authService=require(_0x954b('0x13'));var qs=require(_0x954b('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x954b('0x15'));var logger=require(_0x954b('0x16'))(_0x954b('0x17'));var utils=require(_0x954b('0x18'));var config=require(_0x954b('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x954b('0x1a'))['db'];config['redis']=_[_0x954b('0x1b')](config[_0x954b('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0x954b('0x1d'))(new Redis(config[_0x954b('0x1c')]));require('./userNotification.socket')[_0x954b('0x1e')](socket);function respondWithStatusCode(_0x4219c7,_0x19d26d){_0x19d26d=_0x19d26d||0xcc;return function(_0x34fee2){if(_0x34fee2){return _0x4219c7['sendStatus'](_0x19d26d);}return _0x4219c7[_0x954b('0x1f')](_0x19d26d)[_0x954b('0x20')]();};}function respondWithResult(_0x44c6f6,_0x5093f0){_0x5093f0=_0x5093f0||0xc8;return function(_0x2a3554){if(_0x2a3554){return _0x44c6f6[_0x954b('0x1f')](_0x5093f0)[_0x954b('0x21')](_0x2a3554);}};}function respondWithFilteredResult(_0xf665f2,_0x402b5d){return function(_0x53b2c2){if(_0x53b2c2){var _0xe15825=typeof _0x402b5d['offset']===_0x954b('0x22')&&typeof _0x402b5d['limit']===_0x954b('0x22');var _0x2b28e5=_0x53b2c2[_0x954b('0x23')];var _0x55cce3=_0xe15825?0x0:_0x402b5d[_0x954b('0x24')];var _0x25258e=_0xe15825?_0x53b2c2['count']:_0x402b5d['offset']+_0x402b5d[_0x954b('0x25')];var _0x1a0c97;if(_0x25258e>=_0x2b28e5){_0x25258e=_0x2b28e5;_0x1a0c97=0xc8;}else{_0x1a0c97=0xce;}_0xf665f2[_0x954b('0x1f')](_0x1a0c97);return _0xf665f2[_0x954b('0x26')](_0x954b('0x27'),_0x55cce3+'-'+_0x25258e+'/'+_0x2b28e5)['json'](_0x53b2c2);}return null;};}function patchUpdates(_0x15a1a5){return function(_0x4f6b6c){try{jsonpatch['apply'](_0x4f6b6c,_0x15a1a5,!![]);}catch(_0x24b098){return BPromise[_0x954b('0x28')](_0x24b098);}return _0x4f6b6c[_0x954b('0x29')]();};}function saveUpdates(_0x4e877f,_0x2dd199){return function(_0x11069d){if(_0x11069d){return _0x11069d[_0x954b('0x2a')](_0x4e877f)[_0x954b('0x2b')](function(_0x3e711c){return _0x3e711c;});}return null;};}function removeEntity(_0x1c2e40,_0x5ddeb7){return function(_0x489e1a){if(_0x489e1a){return _0x489e1a[_0x954b('0x2c')]()['then'](function(){_0x1c2e40['status'](0xcc)[_0x954b('0x20')]();});}};}function handleEntityNotFound(_0x528a49,_0x138c54){return function(_0xcaab26){if(!_0xcaab26){_0x528a49['sendStatus'](0x194);}return _0xcaab26;};}function handleError(_0x2e5b98,_0x10863e){_0x10863e=_0x10863e||0x1f4;return function(_0x363ff6){logger[_0x954b('0x2d')](_0x363ff6['stack']);if(_0x363ff6[_0x954b('0x2e')]){delete _0x363ff6[_0x954b('0x2e')];}_0x2e5b98[_0x954b('0x1f')](_0x10863e)[_0x954b('0x2f')](_0x363ff6);};}exports[_0x954b('0x30')]=function(_0x2fdf58,_0xdef942,_0x43dda1){if(!_0x2fdf58[_0x954b('0x31')][_0x954b('0x32')](_0x954b('0x33'))&&!_0x2fdf58[_0x954b('0x31')][_0x954b('0x32')](_0x954b('0x34'))){throw new db['Sequelize'][(_0x954b('0x35'))](_0x954b('0x36'));}else{if(_0x2fdf58['body']['hasOwnProperty'](_0x954b('0x34'))&&!_0x2fdf58[_0x954b('0x31')][_0x954b('0x32')](_0x954b('0x37'))){throw new db[(_0x954b('0x38'))]['ValidationError'](_0x954b('0x39'));}if(!_0x2fdf58[_0x954b('0x31')][_0x954b('0x32')]('recipients')){throw new db[(_0x954b('0x38'))][(_0x954b('0x35'))](_0x954b('0x3a'));}else{try{var _0x235f5b=JSON[_0x954b('0x3b')](_0x2fdf58[_0x954b('0x31')]['recipients']);}catch(_0x4b201c){logger[_0x954b('0x2d')](_0x4b201c);throw new db['Sequelize']['ValidationError'](_0x954b('0x3c'));}var _0x7442cb=[_0x954b('0x3d'),_0x954b('0x3e'),_0x954b('0x3f'),_0x954b('0x40'),_0x954b('0x41'),'voicequeue',_0x954b('0x42'),_0x954b('0x43'),'user'];if(_['some'](_0x235f5b,function(_0x485c6f){return!_[_0x954b('0x44')](_0x7442cb,_0x485c6f[_0x954b('0x45')][_0x954b('0x46')]());})){throw new db['Sequelize'][(_0x954b('0x35'))](_0x954b('0x47'));}}}var _0x15592f={};_0x15592f[_0x954b('0x48')]=_0x2fdf58['body']['hasOwnProperty'](_0x954b('0x48'))?_0x2fdf58[_0x954b('0x31')]['senderName']:_0x2fdf58[_0x954b('0x49')]['fullname'];_0x15592f[_0x954b('0x4a')]=_[_0x954b('0x4b')](_0x2fdf58[_0x954b('0x31')]['recipientsDescription'])?null:_0x2fdf58[_0x954b('0x31')][_0x954b('0x4a')];_0x15592f[_0x954b('0x4c')]=_0x2fdf58[_0x954b('0x31')][_0x954b('0x4c')]||![];_0x15592f['SenderId']=_0x2fdf58[_0x954b('0x49')]['id'];return getContent(_0x2fdf58[_0x954b('0x31')])[_0x954b('0x2b')](function(_0x4e9fd2){_0x15592f[_0x954b('0x31')]=_0x4e9fd2;return getRecipients(_0x235f5b);})[_0x954b('0x2b')](function(_0x3187cb){_0x15592f[_0x954b('0x4d')]=_[_0x954b('0x4e')](_0x3187cb)['join'](',');return db[_0x954b('0x4f')]['transaction'](function(_0x259024){return db['UserNotification'][_0x954b('0x50')](_0x15592f,{'raw':!![],'transaction':_0x259024})[_0x954b('0x2b')](function(_0x525d5f){var _0x1d85e5={'sender':_0x15592f['senderName'],'description':_0x15592f[_0x954b('0x4a')],'content':_0x15592f[_0x954b('0x31')],'beep':_0x15592f[_0x954b('0x4c')]};_0x3187cb['forEach'](function(_0x57254c){_0x1d85e5['recipient']=_0x57254c;socket['emit'](_0x954b('0x51'),_0x1d85e5);});return _0x525d5f;});});})[_0x954b('0x2b')](respondWithResult(_0xdef942,0xc9))[_0x954b('0x52')](handleError(_0xdef942,null));};function getContent(_0x57482d){return new BPromise(function(_0x55922e,_0x547fe7){if(_0x57482d[_0x954b('0x33')]){_0x55922e(_0x57482d[_0x954b('0x33')]);return;}return db[_0x954b('0x53')][_0x954b('0x54')]({'attributes':[_0x954b('0x55')],'where':{'id':_0x57482d['TemplateId']},'raw':!![]})[_0x954b('0x2b')](function(_0x5ae357){if(!_0x5ae357)throw new db[(_0x954b('0x38'))][(_0x954b('0x35'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x2a2d80=Mustache[_0x954b('0x56')](_0x5ae357[_0x954b('0x55')],_0x57482d[_0x954b('0x37')]);_0x55922e(_0x2a2d80);})['catch'](function(_0x5d77a1){_0x547fe7(_0x5d77a1);});});}function getRecipients(_0x452833){return new BPromise(function(_0x20c5a0,_0x2f329b){var _0x3a3665=[];var _0x284afd=[];_0x452833['forEach'](function(_0x4d20ee){var _0x5e5c0b=_[_0x954b('0x57')](_0x4d20ee[_0x954b('0x45')][_0x954b('0x46')]());if(_0x5e5c0b===_0x954b('0x58')){_0x3a3665=_['union'](_0x3a3665,_0x4d20ee[_0x954b('0x59')]);}else{if(_[_0x954b('0x44')](_0x5e5c0b,_0x954b('0x5a')))_0x5e5c0b=_0x5e5c0b[_0x954b('0x5b')](_0x954b('0x5a'),'Queue');_0x4d20ee['ids']['forEach'](function(_0xf03ad4){_0x284afd[_0x954b('0x5c')](getAgents(_0x5e5c0b,_0xf03ad4));});}});return BPromise[_0x954b('0x5d')](_0x284afd)['then'](function(_0x3f1231){_0x3a3665=_[_0x954b('0x5e')](_0x3a3665,_[_0x954b('0x5f')](_0x3f1231));_0x20c5a0(_0x3a3665);})['catch'](function(_0x5159ce){_0x2f329b(_0x5159ce);});});}function getAgents(_0x5ee753,_0x246966){return new BPromise(function(_0x4ad850,_0x1ddee1){return db[_0x5ee753][_0x954b('0x54')]({'where':{'id':_0x246966}})['then'](function(_0x15b307){return _0x15b307['getAgents']({'attributes':['id'],'raw':!![]})[_0x954b('0x2b')](function(_0xf0703b){var _0x174215=_[_0x954b('0x60')](_0xf0703b,'id');_0x4ad850(_0x174215);});})[_0x954b('0x52')](function(_0x33d719){_0x1ddee1(_0x33d719);});});} \ No newline at end of file +var _0x5fcc=['name','send','sendUserNotification','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter','recipients','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','mailqueue','openchannelqueue','voicequeue','whatsappqueue','team','user','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','recipientsDescription','beep','SenderId','sortBy','join','sequelize','transaction','UserNotification','recipient','emit','userNotification:send','catch','Template','findOne','html','startCase','User','ids','queue','replace','Queue','forEach','push','union','flatten','map','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','end','error','stack'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5fcc,0x95));var _0xc5fc=function(_0x1f48e5,_0x451e6e){_0x1f48e5=_0x1f48e5-0x0;var _0x342f42=_0x5fcc[_0x1f48e5];return _0x342f42;};'use strict';var emlformat=require(_0xc5fc('0x0'));var rimraf=require(_0xc5fc('0x1'));var zipdir=require(_0xc5fc('0x2'));var jsonpatch=require(_0xc5fc('0x3'));var rp=require(_0xc5fc('0x4'));var moment=require(_0xc5fc('0x5'));var BPromise=require(_0xc5fc('0x6'));var Mustache=require('mustache');var util=require(_0xc5fc('0x7'));var path=require('path');var sox=require(_0xc5fc('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc5fc('0x9'));var _=require('lodash');var squel=require(_0xc5fc('0xa'));var crypto=require(_0xc5fc('0xb'));var jsforce=require(_0xc5fc('0xc'));var deskjs=require(_0xc5fc('0xd'));var toCsv=require(_0xc5fc('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc5fc('0xf'));var authService=require(_0xc5fc('0x10'));var qs=require(_0xc5fc('0x11'));var as=require(_0xc5fc('0x12'));var hardwareService=require(_0xc5fc('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xc5fc('0x14'));var config=require(_0xc5fc('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xc5fc('0x16'))['db'];config[_0xc5fc('0x17')]=_[_0xc5fc('0x18')](config[_0xc5fc('0x17')],{'host':_0xc5fc('0x19'),'port':0x18eb});var socket=require(_0xc5fc('0x1a'))(new Redis(config['redis']));require('./userNotification.socket')['register'](socket);function respondWithStatusCode(_0x1d9e72,_0x3d66a7){_0x3d66a7=_0x3d66a7||0xcc;return function(_0x1b56b4){if(_0x1b56b4){return _0x1d9e72[_0xc5fc('0x1b')](_0x3d66a7);}return _0x1d9e72['status'](_0x3d66a7)['end']();};}function respondWithResult(_0xf689f4,_0x4d9446){_0x4d9446=_0x4d9446||0xc8;return function(_0x1919bd){if(_0x1919bd){return _0xf689f4[_0xc5fc('0x1c')](_0x4d9446)[_0xc5fc('0x1d')](_0x1919bd);}};}function respondWithFilteredResult(_0x554926,_0x54fb8b){return function(_0x311390){if(_0x311390){var _0x2022f6=typeof _0x54fb8b[_0xc5fc('0x1e')]===_0xc5fc('0x1f')&&typeof _0x54fb8b[_0xc5fc('0x20')]===_0xc5fc('0x1f');var _0x2e7221=_0x311390[_0xc5fc('0x21')];var _0x2e8170=_0x2022f6?0x0:_0x54fb8b[_0xc5fc('0x1e')];var _0x1c6456=_0x2022f6?_0x311390[_0xc5fc('0x21')]:_0x54fb8b['offset']+_0x54fb8b[_0xc5fc('0x20')];var _0x292831;if(_0x1c6456>=_0x2e7221){_0x1c6456=_0x2e7221;_0x292831=0xc8;}else{_0x292831=0xce;}_0x554926[_0xc5fc('0x1c')](_0x292831);return _0x554926[_0xc5fc('0x22')](_0xc5fc('0x23'),_0x2e8170+'-'+_0x1c6456+'/'+_0x2e7221)['json'](_0x311390);}return null;};}function patchUpdates(_0x2a5af0){return function(_0x39d064){try{jsonpatch['apply'](_0x39d064,_0x2a5af0,!![]);}catch(_0x30de21){return BPromise[_0xc5fc('0x24')](_0x30de21);}return _0x39d064['save']();};}function saveUpdates(_0x4c4c51,_0x59366f){return function(_0x4d1ead){if(_0x4d1ead){return _0x4d1ead[_0xc5fc('0x25')](_0x4c4c51)[_0xc5fc('0x26')](function(_0x4ef6bf){return _0x4ef6bf;});}return null;};}function removeEntity(_0x1b1376,_0x425480){return function(_0x45332d){if(_0x45332d){return _0x45332d[_0xc5fc('0x27')]()[_0xc5fc('0x26')](function(){_0x1b1376[_0xc5fc('0x1c')](0xcc)[_0xc5fc('0x28')]();});}};}function handleEntityNotFound(_0x569488,_0x555dd7){return function(_0x1949fb){if(!_0x1949fb){_0x569488[_0xc5fc('0x1b')](0x194);}return _0x1949fb;};}function handleError(_0x1fb539,_0x37af34){_0x37af34=_0x37af34||0x1f4;return function(_0x4b9457){logger[_0xc5fc('0x29')](_0x4b9457[_0xc5fc('0x2a')]);if(_0x4b9457[_0xc5fc('0x2b')]){delete _0x4b9457[_0xc5fc('0x2b')];}_0x1fb539[_0xc5fc('0x1c')](_0x37af34)[_0xc5fc('0x2c')](_0x4b9457);};}exports[_0xc5fc('0x2d')]=function(_0x3e5001,_0x2a6f20,_0x16dee5){if(!_0x3e5001[_0xc5fc('0x2e')][_0xc5fc('0x2f')](_0xc5fc('0x30'))&&!_0x3e5001[_0xc5fc('0x2e')][_0xc5fc('0x2f')](_0xc5fc('0x31'))){throw new db[(_0xc5fc('0x32'))][(_0xc5fc('0x33'))](_0xc5fc('0x34'));}else{if(_0x3e5001[_0xc5fc('0x2e')]['hasOwnProperty'](_0xc5fc('0x31'))&&!_0x3e5001[_0xc5fc('0x2e')]['hasOwnProperty'](_0xc5fc('0x35'))){throw new db[(_0xc5fc('0x32'))][(_0xc5fc('0x33'))](_0xc5fc('0x36'));}if(!_0x3e5001[_0xc5fc('0x2e')]['hasOwnProperty'](_0xc5fc('0x37'))){throw new db[(_0xc5fc('0x32'))][(_0xc5fc('0x33'))]('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x4fd8b6=JSON[_0xc5fc('0x38')](_0x3e5001[_0xc5fc('0x2e')]['recipients']);}catch(_0x23590d){logger[_0xc5fc('0x29')](_0x23590d);throw new db[(_0xc5fc('0x32'))][(_0xc5fc('0x33'))](_0xc5fc('0x39'));}var _0x535e8d=[_0xc5fc('0x3a'),'faxqueue',_0xc5fc('0x3b'),_0xc5fc('0x3c'),'smsqueue',_0xc5fc('0x3d'),_0xc5fc('0x3e'),_0xc5fc('0x3f'),_0xc5fc('0x40')];if(_['some'](_0x4fd8b6,function(_0x4dec6e){return!_[_0xc5fc('0x41')](_0x535e8d,_0x4dec6e[_0xc5fc('0x42')][_0xc5fc('0x43')]());})){throw new db['Sequelize'][(_0xc5fc('0x33'))](_0xc5fc('0x44'));}}}var _0x51bdd3={};_0x51bdd3[_0xc5fc('0x45')]=_0x3e5001[_0xc5fc('0x2e')][_0xc5fc('0x2f')]('senderName')?_0x3e5001['body'][_0xc5fc('0x45')]:_0x3e5001[_0xc5fc('0x40')]['fullname'];_0x51bdd3[_0xc5fc('0x46')]=_['isEmpty'](_0x3e5001[_0xc5fc('0x2e')]['recipientsDescription'])?null:_0x3e5001[_0xc5fc('0x2e')][_0xc5fc('0x46')];_0x51bdd3[_0xc5fc('0x47')]=_0x3e5001[_0xc5fc('0x2e')]['beep']||![];_0x51bdd3[_0xc5fc('0x48')]=_0x3e5001[_0xc5fc('0x40')]['id'];return getContent(_0x3e5001[_0xc5fc('0x2e')])[_0xc5fc('0x26')](function(_0x579e2b){_0x51bdd3[_0xc5fc('0x2e')]=_0x579e2b;return getRecipients(_0x4fd8b6);})[_0xc5fc('0x26')](function(_0x355060){_0x51bdd3['recipientsId']=_[_0xc5fc('0x49')](_0x355060)[_0xc5fc('0x4a')](',');return db[_0xc5fc('0x4b')][_0xc5fc('0x4c')](function(_0x2bf9f1){return db[_0xc5fc('0x4d')]['create'](_0x51bdd3,{'raw':!![],'transaction':_0x2bf9f1})[_0xc5fc('0x26')](function(_0x1a38cb){var _0x3b980c={'sender':_0x51bdd3[_0xc5fc('0x45')],'description':_0x51bdd3[_0xc5fc('0x46')],'content':_0x51bdd3['body'],'beep':_0x51bdd3['beep']};_0x355060['forEach'](function(_0x1af226){_0x3b980c[_0xc5fc('0x4e')]=_0x1af226;socket[_0xc5fc('0x4f')](_0xc5fc('0x50'),_0x3b980c);});return _0x1a38cb;});});})[_0xc5fc('0x26')](respondWithResult(_0x2a6f20,0xc9))[_0xc5fc('0x51')](handleError(_0x2a6f20,null));};function getContent(_0x33ee07){return new BPromise(function(_0x4c6953,_0x1c2fc2){if(_0x33ee07[_0xc5fc('0x30')]){_0x4c6953(_0x33ee07['text']);return;}return db[_0xc5fc('0x52')][_0xc5fc('0x53')]({'attributes':[_0xc5fc('0x54')],'where':{'id':_0x33ee07[_0xc5fc('0x31')]},'raw':!![]})['then'](function(_0x30e1c8){if(!_0x30e1c8)throw new db['Sequelize'][(_0xc5fc('0x33'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x5dc7db=Mustache['render'](_0x30e1c8['html'],_0x33ee07[_0xc5fc('0x35')]);_0x4c6953(_0x5dc7db);})[_0xc5fc('0x51')](function(_0x39e98f){_0x1c2fc2(_0x39e98f);});});}function getRecipients(_0x54c415){return new BPromise(function(_0x5731b6,_0x5a1dd9){var _0x579fad=[];var _0x4a4aa0=[];_0x54c415['forEach'](function(_0x1e3d8e){var _0x2c4760=_[_0xc5fc('0x55')](_0x1e3d8e[_0xc5fc('0x42')][_0xc5fc('0x43')]());if(_0x2c4760===_0xc5fc('0x56')){_0x579fad=_['union'](_0x579fad,_0x1e3d8e[_0xc5fc('0x57')]);}else{if(_[_0xc5fc('0x41')](_0x2c4760,_0xc5fc('0x58')))_0x2c4760=_0x2c4760[_0xc5fc('0x59')]('queue',_0xc5fc('0x5a'));_0x1e3d8e['ids'][_0xc5fc('0x5b')](function(_0x1fa124){_0x4a4aa0[_0xc5fc('0x5c')](getAgents(_0x2c4760,_0x1fa124));});}});return BPromise['all'](_0x4a4aa0)[_0xc5fc('0x26')](function(_0x3496e9){_0x579fad=_[_0xc5fc('0x5d')](_0x579fad,_[_0xc5fc('0x5e')](_0x3496e9));_0x5731b6(_0x579fad);})[_0xc5fc('0x51')](function(_0x1c746e){_0x5a1dd9(_0x1c746e);});});}function getAgents(_0x47e1eb,_0x2cd29f){return new BPromise(function(_0x2a67f3,_0xc3c7b4){return db[_0x47e1eb][_0xc5fc('0x53')]({'where':{'id':_0x2cd29f}})['then'](function(_0x5f2138){return _0x5f2138['getAgents']({'attributes':['id'],'raw':!![]})[_0xc5fc('0x26')](function(_0xdd99f7){var _0x3352f7=_[_0xc5fc('0x5f')](_0xdd99f7,'id');_0x2a67f3(_0x3352f7);});})[_0xc5fc('0x51')](function(_0x310317){_0xc3c7b4(_0x310317);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index e6327b9..f4c1ec7 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 _0xb4a0=['update','emit','hasOwnProperty','exports','../../mysqldb','setMaxListeners','save'];(function(_0xabbd2f,_0x44d05a){var _0x34a040=function(_0x3736d9){while(--_0x3736d9){_0xabbd2f['push'](_0xabbd2f['shift']());}};_0x34a040(++_0x44d05a);}(_0xb4a0,0x1cb));var _0x0b4a=function(_0x3d3030,_0x27373d){_0x3d3030=_0x3d3030-0x0;var _0x54fb6f=_0xb4a0[_0x3d3030];return _0x54fb6f;};'use strict';var EventEmitter=require('events');var UserNotification=require(_0x0b4a('0x0'))['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x0b4a('0x1')](0x0);var events={'afterCreate':_0x0b4a('0x2'),'afterUpdate':_0x0b4a('0x3'),'afterDestroy':'remove'};function emitEvent(_0x1764f6){return function(_0x134220,_0x221a8d,_0x550cae){UserNotificationEvents[_0x0b4a('0x4')](_0x1764f6+':'+_0x134220['id'],_0x134220);UserNotificationEvents[_0x0b4a('0x4')](_0x1764f6,_0x134220);_0x550cae(null);};}for(var e in events){if(events[_0x0b4a('0x5')](e)){var event=events[e];UserNotification['hook'](e,emitEvent(event));}}module[_0x0b4a('0x6')]=UserNotificationEvents; \ No newline at end of file +var _0x1a34=['hasOwnProperty','hook','exports','events','../../mysqldb','UserNotification','setMaxListeners','save','update','remove','emit'];(function(_0x5cf394,_0x38987b){var _0x34c818=function(_0x1cf52b){while(--_0x1cf52b){_0x5cf394['push'](_0x5cf394['shift']());}};_0x34c818(++_0x38987b);}(_0x1a34,0x1bb));var _0x41a3=function(_0x5fcd98,_0x4c9805){_0x5fcd98=_0x5fcd98-0x0;var _0x1a9be7=_0x1a34[_0x5fcd98];return _0x1a9be7;};'use strict';var EventEmitter=require(_0x41a3('0x0'));var UserNotification=require(_0x41a3('0x1'))['db'][_0x41a3('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x41a3('0x3')](0x0);var events={'afterCreate':_0x41a3('0x4'),'afterUpdate':_0x41a3('0x5'),'afterDestroy':_0x41a3('0x6')};function emitEvent(_0x413bd7){return function(_0x5c2fce,_0x2213a9,_0x558063){UserNotificationEvents[_0x41a3('0x7')](_0x413bd7+':'+_0x5c2fce['id'],_0x5c2fce);UserNotificationEvents[_0x41a3('0x7')](_0x413bd7,_0x5c2fce);_0x558063(null);};}for(var e in events){if(events[_0x41a3('0x8')](e)){var event=events[e];UserNotification[_0x41a3('0x9')](e,emitEvent(event));}}module[_0x41a3('0xa')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 97dd220..3007b3f 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 _0xb85a=['lodash','util','../../config/logger','api','moment','request-promise','rimraf','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci'];(function(_0x3895b7,_0xd4796b){var _0x3f3b8c=function(_0x43a116){while(--_0x43a116){_0x3895b7['push'](_0x3895b7['shift']());}};_0x3f3b8c(++_0xd4796b);}(_0xb85a,0x11e));var _0xab85=function(_0x3b07bc,_0xd8bf6c){_0x3b07bc=_0x3b07bc-0x0;var _0x4f858b=_0xb85a[_0x3b07bc];return _0x4f858b;};'use strict';var _=require(_0xab85('0x0'));var util=require(_0xab85('0x1'));var logger=require(_0xab85('0x2'))(_0xab85('0x3'));var moment=require(_0xab85('0x4'));var BPromise=require('bluebird');var rp=require(_0xab85('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xab85('0x6'));var config=require('../../config/environment');var attributes=require('./userNotification.attributes');module['exports']=function(_0x57a8d9,_0x3100a5){return _0x57a8d9['define'](_0xab85('0x7'),attributes,{'tableName':_0xab85('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xab85('0x9'),'collate':_0xab85('0xa')});}; \ No newline at end of file +var _0x0310=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','UserNotification','userNotifications','utf8mb4_unicode_ci','lodash','util','moment'];(function(_0x2117e8,_0x239baf){var _0x5e6fc5=function(_0x305753){while(--_0x305753){_0x2117e8['push'](_0x2117e8['shift']());}};_0x5e6fc5(++_0x239baf);}(_0x0310,0x128));var _0x0031=function(_0x9600e0,_0x18fbae){_0x9600e0=_0x9600e0-0x0;var _0x49e32b=_0x0310[_0x9600e0];return _0x49e32b;};'use strict';var _=require(_0x0031('0x0'));var util=require(_0x0031('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0031('0x2'));var BPromise=require(_0x0031('0x3'));var rp=require(_0x0031('0x4'));var fs=require('fs');var path=require(_0x0031('0x5'));var rimraf=require(_0x0031('0x6'));var config=require(_0x0031('0x7'));var attributes=require('./userNotification.attributes');module[_0x0031('0x8')]=function(_0x5276b1,_0x370ddd){return _0x5276b1[_0x0031('0x9')](_0x0031('0xa'),attributes,{'tableName':_0x0031('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0031('0xc')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 128c273..3568c50 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 _0xe5de=['request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','then','info','UserNotification,\x20%s,\x20%s'];(function(_0x436366,_0x4e627d){var _0x2c3b6e=function(_0x5c901f){while(--_0x5c901f){_0x436366['push'](_0x436366['shift']());}};_0x2c3b6e(++_0x4e627d);}(_0xe5de,0xf3));var _0xee5d=function(_0x5dd466,_0xc8c557){_0x5dd466=_0x5dd466-0x0;var _0x373700=_0xe5de[_0x5dd466];return _0x373700;};'use strict';var _=require(_0xee5d('0x0'));var util=require(_0xee5d('0x1'));var moment=require('moment');var BPromise=require(_0xee5d('0x2'));var rs=require(_0xee5d('0x3'));var fs=require('fs');var Redis=require(_0xee5d('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xee5d('0x5'));var config=require(_0xee5d('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xee5d('0x7')]({'port':0x232a});config[_0xee5d('0x8')]=_[_0xee5d('0x9')](config[_0xee5d('0x8')],{'host':_0xee5d('0xa'),'port':0x18eb});var socket=require(_0xee5d('0xb'))(new Redis(config[_0xee5d('0x8')]));require(_0xee5d('0xc'))[_0xee5d('0xd')](socket);function respondWithRpcPromise(_0x180dab,_0xd24989,_0x5b1ec2){return new BPromise(function(_0x2f56f5,_0x41e7ed){return client['request'](_0x180dab,_0x5b1ec2)[_0xee5d('0xe')](function(_0x147075){logger[_0xee5d('0xf')](_0xee5d('0x10'),_0xd24989,_0xee5d('0x11'));logger[_0xee5d('0x12')](_0xee5d('0x13'),_0xd24989,_0xee5d('0x11'),JSON[_0xee5d('0x14')](_0x147075));if(_0x147075[_0xee5d('0x15')]){if(_0x147075[_0xee5d('0x15')][_0xee5d('0x16')]===0x1f4){logger[_0xee5d('0x15')](_0xee5d('0x10'),_0xd24989,_0x147075['error'][_0xee5d('0x17')]);return _0x41e7ed(_0x147075[_0xee5d('0x15')][_0xee5d('0x17')]);}logger[_0xee5d('0x15')](_0xee5d('0x10'),_0xd24989,_0x147075[_0xee5d('0x15')][_0xee5d('0x17')]);return _0x2f56f5(_0x147075[_0xee5d('0x15')][_0xee5d('0x17')]);}else{logger['info']('UserNotification,\x20%s,\x20%s',_0xd24989,_0xee5d('0x11'));_0x2f56f5(_0x147075[_0xee5d('0x18')][_0xee5d('0x17')]);}})[_0xee5d('0x19')](function(_0x5c2a25){logger[_0xee5d('0x15')]('UserNotification,\x20%s,\x20%s',_0xd24989,_0x5c2a25);_0x41e7ed(_0x5c2a25);});});} \ No newline at end of file +var _0x4c4f=['redis','defaults','localhost','./userNotification.socket','register','request','then','info','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','message','UserNotification,\x20%s,\x20%s','catch','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0xdf13c9,_0x5da43f){var _0x302aaa=function(_0x42cc73){while(--_0x42cc73){_0xdf13c9['push'](_0xdf13c9['shift']());}};_0x302aaa(++_0x5da43f);}(_0x4c4f,0x65));var _0xf4c4=function(_0x8cb28a,_0x34ad06){_0x8cb28a=_0x8cb28a-0x0;var _0x1e196e=_0x4c4f[_0x8cb28a];return _0x1e196e;};'use strict';var _=require(_0xf4c4('0x0'));var util=require(_0xf4c4('0x1'));var moment=require(_0xf4c4('0x2'));var BPromise=require(_0xf4c4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf4c4('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf4c4('0x5'))(_0xf4c4('0x6'));var config=require(_0xf4c4('0x7'));var jayson=require(_0xf4c4('0x8'));var client=jayson[_0xf4c4('0x9')][_0xf4c4('0xa')]({'port':0x232a});config[_0xf4c4('0xb')]=_[_0xf4c4('0xc')](config['redis'],{'host':_0xf4c4('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xf4c4('0xe'))[_0xf4c4('0xf')](socket);function respondWithRpcPromise(_0x1a37ca,_0x312053,_0x42c2fd){return new BPromise(function(_0x54217c,_0x304db5){return client[_0xf4c4('0x10')](_0x1a37ca,_0x42c2fd)[_0xf4c4('0x11')](function(_0x5f4a8b){logger[_0xf4c4('0x12')]('UserNotification,\x20%s,\x20%s',_0x312053,_0xf4c4('0x13'));logger[_0xf4c4('0x14')](_0xf4c4('0x15'),_0x312053,_0xf4c4('0x13'),JSON[_0xf4c4('0x16')](_0x5f4a8b));if(_0x5f4a8b[_0xf4c4('0x17')]){if(_0x5f4a8b[_0xf4c4('0x17')][_0xf4c4('0x18')]===0x1f4){logger[_0xf4c4('0x17')]('UserNotification,\x20%s,\x20%s',_0x312053,_0x5f4a8b[_0xf4c4('0x17')][_0xf4c4('0x19')]);return _0x304db5(_0x5f4a8b[_0xf4c4('0x17')]['message']);}logger[_0xf4c4('0x17')](_0xf4c4('0x1a'),_0x312053,_0x5f4a8b['error'][_0xf4c4('0x19')]);return _0x54217c(_0x5f4a8b[_0xf4c4('0x17')][_0xf4c4('0x19')]);}else{logger[_0xf4c4('0x12')](_0xf4c4('0x1a'),_0x312053,_0xf4c4('0x13'));_0x54217c(_0x5f4a8b['result'][_0xf4c4('0x19')]);}})[_0xf4c4('0x1b')](function(_0x404c69){logger[_0xf4c4('0x17')]('UserNotification,\x20%s,\x20%s',_0x312053,_0x404c69);_0x304db5(_0x404c69);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 3ca86c8..8f85142 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 _0x4ed3=['userNotification:','./userNotification.events','save','remove','update','emit','removeListener','register'];(function(_0x53b117,_0x4e4767){var _0x1494f8=function(_0x395a23){while(--_0x395a23){_0x53b117['push'](_0x53b117['shift']());}};_0x1494f8(++_0x4e4767);}(_0x4ed3,0x131));var _0x34ed=function(_0x5fed56,_0x5d5a50){_0x5fed56=_0x5fed56-0x0;var _0x450022=_0x4ed3[_0x5fed56];return _0x450022;};'use strict';var UserNotificationEvents=require(_0x34ed('0x0'));var events=[_0x34ed('0x1'),_0x34ed('0x2'),_0x34ed('0x3')];function createListener(_0x1559f0,_0x3ddfba){return function(_0x43fede){_0x3ddfba[_0x34ed('0x4')](_0x1559f0,_0x43fede);};}function removeListener(_0xfda44b,_0x1a4f3f){return function(){UserNotificationEvents[_0x34ed('0x5')](_0xfda44b,_0x1a4f3f);};}exports[_0x34ed('0x6')]=function(_0x5a5539){for(var _0x3f9cd3=0x0,_0x1395d3=events['length'];_0x3f9cd3<_0x1395d3;_0x3f9cd3++){var _0x56e2eb=events[_0x3f9cd3];var _0x3f90eb=createListener(_0x34ed('0x7')+_0x56e2eb,_0x5a5539);UserNotificationEvents['on'](_0x56e2eb,_0x3f90eb);}}; \ No newline at end of file +var _0x6e38=['length','./userNotification.events','remove','removeListener'];(function(_0x38a24f,_0xa7da43){var _0x37c956=function(_0x2784a9){while(--_0x2784a9){_0x38a24f['push'](_0x38a24f['shift']());}};_0x37c956(++_0xa7da43);}(_0x6e38,0xb9));var _0x86e3=function(_0x4e5333,_0x3f8eb6){_0x4e5333=_0x4e5333-0x0;var _0x4f4e2e=_0x6e38[_0x4e5333];return _0x4f4e2e;};'use strict';var UserNotificationEvents=require(_0x86e3('0x0'));var events=['save',_0x86e3('0x1'),'update'];function createListener(_0x561a36,_0x585a77){return function(_0x7e12e){_0x585a77['emit'](_0x561a36,_0x7e12e);};}function removeListener(_0x523ec3,_0x4543f4){return function(){UserNotificationEvents[_0x86e3('0x2')](_0x523ec3,_0x4543f4);};}exports['register']=function(_0x38d27b){for(var _0x276ae7=0x0,_0x40e928=events[_0x86e3('0x3')];_0x276ae7<_0x40e928;_0x276ae7++){var _0x15f981=events[_0x276ae7];var _0x1ac883=createListener('userNotification:'+_0x15f981,_0x38d27b);UserNotificationEvents['on'](_0x15f981,_0x1ac883);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 1371e13..f085a3d 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(_0x39b123,_0x251bec){var _0x15fa57=function(_0x47e11c){while(--_0x47e11c){_0x39b123['push'](_0x39b123['shift']());}};_0x15fa57(++_0x251bec);}(_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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0xc84cea,_0x7058f1){var _0x572c6c=function(_0x512a34){while(--_0x512a34){_0xc84cea['push'](_0xc84cea['shift']());}};_0x572c6c(++_0x7058f1);}(_0x9c44,0x178));var _0x49c4=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x9c44[_0x1035c1];return _0x308d67;};'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/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index aa643f6..b5003c8 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 _0xe93b=['exports','INTEGER','sequelize'];(function(_0x4b7b62,_0x4920a9){var _0x2280df=function(_0x21e1f8){while(--_0x21e1f8){_0x4b7b62['push'](_0x4b7b62['shift']());}};_0x2280df(++_0x4920a9);}(_0xe93b,0x16a));var _0xbe93=function(_0x132b2e,_0x2d4c53){_0x132b2e=_0x132b2e-0x0;var _0x1f5ba3=_0xe93b[_0x132b2e];return _0x1f5ba3;};'use strict';var Sequelize=require(_0xbe93('0x0'));module[_0xbe93('0x1')]={'penalty':{'type':Sequelize[_0xbe93('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xced8=['sequelize','exports'];(function(_0xffe5bd,_0x267abe){var _0x34575d=function(_0x1d173e){while(--_0x1d173e){_0xffe5bd['push'](_0xffe5bd['shift']());}};_0x34575d(++_0x267abe);}(_0xced8,0xe0));var _0x8ced=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xced8[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x8ced('0x0'));module[_0x8ced('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 1e8d4b0..0026050 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 _0x9879=['UserOpenchannelQueue','user_has_openchannel_queues','util','api','moment','bluebird','rimraf','../../config/environment','./userOpenchannelQueue.attributes','define'];(function(_0x4c0c78,_0x2bda19){var _0x7324ac=function(_0x21460d){while(--_0x21460d){_0x4c0c78['push'](_0x4c0c78['shift']());}};_0x7324ac(++_0x2bda19);}(_0x9879,0x17e));var _0x9987=function(_0x2d24f0,_0x461469){_0x2d24f0=_0x2d24f0-0x0;var _0x2dd083=_0x9879[_0x2d24f0];return _0x2dd083;};'use strict';var _=require('lodash');var util=require(_0x9987('0x0'));var logger=require('../../config/logger')(_0x9987('0x1'));var moment=require(_0x9987('0x2'));var BPromise=require(_0x9987('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9987('0x4'));var config=require(_0x9987('0x5'));var attributes=require(_0x9987('0x6'));module['exports']=function(_0x251d02,_0x2a1abc){return _0x251d02[_0x9987('0x7')](_0x9987('0x8'),attributes,{'tableName':_0x9987('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfea2=['user_has_openchannel_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue'];(function(_0x382980,_0x250ea1){var _0x373b9b=function(_0x5c3e29){while(--_0x5c3e29){_0x382980['push'](_0x382980['shift']());}};_0x373b9b(++_0x250ea1);}(_0xfea2,0x1d2));var _0x2fea=function(_0x51ab4f,_0x32f508){_0x51ab4f=_0x51ab4f-0x0;var _0xc004ae=_0xfea2[_0x51ab4f];return _0xc004ae;};'use strict';var _=require(_0x2fea('0x0'));var util=require(_0x2fea('0x1'));var logger=require(_0x2fea('0x2'))(_0x2fea('0x3'));var moment=require(_0x2fea('0x4'));var BPromise=require(_0x2fea('0x5'));var rp=require(_0x2fea('0x6'));var fs=require('fs');var path=require(_0x2fea('0x7'));var rimraf=require(_0x2fea('0x8'));var config=require(_0x2fea('0x9'));var attributes=require(_0x2fea('0xa'));module[_0x2fea('0xb')]=function(_0x5dd8cd,_0x2a7e9e){return _0x5dd8cd[_0x2fea('0xc')](_0x2fea('0xd'),attributes,{'tableName':_0x2fea('0xe'),'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 0532eb4..1c41c7d 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 _0x398a=['stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x258335,_0x1c364f){var _0x2320d2=function(_0x373fb7){while(--_0x373fb7){_0x258335['push'](_0x258335['shift']());}};_0x2320d2(++_0x1c364f);}(_0x398a,0x7d));var _0xa398=function(_0x48cad7,_0x35a7d6){_0x48cad7=_0x48cad7-0x0;var _0x53927b=_0x398a[_0x48cad7];return _0x53927b;};'use strict';var _=require(_0xa398('0x0'));var util=require(_0xa398('0x1'));var moment=require(_0xa398('0x2'));var BPromise=require(_0xa398('0x3'));var rs=require(_0xa398('0x4'));var fs=require('fs');var Redis=require(_0xa398('0x5'));var db=require(_0xa398('0x6'))['db'];var utils=require(_0xa398('0x7'));var logger=require(_0xa398('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa398('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x470d50,_0x42bbd1,_0x2fc28b){return new BPromise(function(_0x17c865,_0x3bd991){return client['request'](_0x470d50,_0x2fc28b)[_0xa398('0xa')](function(_0x3a7469){logger[_0xa398('0xb')](_0xa398('0xc'),_0x42bbd1,_0xa398('0xd'));logger[_0xa398('0xe')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x42bbd1,'request\x20sent',JSON[_0xa398('0xf')](_0x3a7469));if(_0x3a7469[_0xa398('0x10')]){if(_0x3a7469[_0xa398('0x10')][_0xa398('0x11')]===0x1f4){logger[_0xa398('0x10')](_0xa398('0xc'),_0x42bbd1,_0x3a7469['error'][_0xa398('0x12')]);return _0x3bd991(_0x3a7469[_0xa398('0x10')]['message']);}logger[_0xa398('0x10')](_0xa398('0xc'),_0x42bbd1,_0x3a7469['error']['message']);return _0x17c865(_0x3a7469['error'][_0xa398('0x12')]);}else{logger['info'](_0xa398('0xc'),_0x42bbd1,_0xa398('0xd'));_0x17c865(_0x3a7469['result'][_0xa398('0x12')]);}})[_0xa398('0x13')](function(_0x7eb8ec){logger['error'](_0xa398('0xc'),_0x42bbd1,_0x7eb8ec);_0x3bd991(_0x7eb8ec);});});} \ No newline at end of file +var _0xd527=['stringify','error','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xd527,0x195));var _0x7d52=function(_0x3311ae,_0x362cee){_0x3311ae=_0x3311ae-0x0;var _0x107949=_0xd527[_0x3311ae];return _0x107949;};'use strict';var _=require('lodash');var util=require(_0x7d52('0x0'));var moment=require(_0x7d52('0x1'));var BPromise=require(_0x7d52('0x2'));var rs=require(_0x7d52('0x3'));var fs=require('fs');var Redis=require(_0x7d52('0x4'));var db=require(_0x7d52('0x5'))['db'];var utils=require(_0x7d52('0x6'));var logger=require(_0x7d52('0x7'))(_0x7d52('0x8'));var config=require(_0x7d52('0x9'));var jayson=require(_0x7d52('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4788b2,_0x4c9005,_0x4228df){return new BPromise(function(_0xb2b79e,_0x30a1de){return client[_0x7d52('0xb')](_0x4788b2,_0x4228df)['then'](function(_0x2cf494){logger['info'](_0x7d52('0xc'),_0x4c9005,_0x7d52('0xd'));logger[_0x7d52('0xe')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x4c9005,_0x7d52('0xd'),JSON[_0x7d52('0xf')](_0x2cf494));if(_0x2cf494[_0x7d52('0x10')]){if(_0x2cf494[_0x7d52('0x10')]['code']===0x1f4){logger['error']('UserOpenchannelQueue,\x20%s,\x20%s',_0x4c9005,_0x2cf494[_0x7d52('0x10')][_0x7d52('0x11')]);return _0x30a1de(_0x2cf494[_0x7d52('0x10')]['message']);}logger['error']('UserOpenchannelQueue,\x20%s,\x20%s',_0x4c9005,_0x2cf494['error']['message']);return _0xb2b79e(_0x2cf494['error'][_0x7d52('0x11')]);}else{logger[_0x7d52('0x12')](_0x7d52('0xc'),_0x4c9005,_0x7d52('0xd'));_0xb2b79e(_0x2cf494[_0x7d52('0x13')]['message']);}})[_0x7d52('0x14')](function(_0x383368){logger[_0x7d52('0x10')](_0x7d52('0xc'),_0x4c9005,_0x383368);_0x30a1de(_0x383368);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 84ddda6..b2817b8 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 _0x784d=['exports','multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./userProfile.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/sections','getSections','/:id/resources','getResources','post','create','/:id/clone','clone','addSections','addResources','put','delete','destroy'];(function(_0x15e785,_0x5a44c1){var _0x113148=function(_0x15c938){while(--_0x15c938){_0x15e785['push'](_0x15e785['shift']());}};_0x113148(++_0x5a44c1);}(_0x784d,0x140));var _0xd784=function(_0x56a37a,_0xffb054){_0x56a37a=_0x56a37a-0x0;var _0x3a57ff=_0x784d[_0x56a37a];return _0x3a57ff;};'use strict';var multer=require(_0xd784('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd784('0x1'));var express=require(_0xd784('0x2'));var router=express[_0xd784('0x3')]();var fs_extra=require(_0xd784('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xd784('0x5'));var config=require(_0xd784('0x6'));var controller=require(_0xd784('0x7'));router['get']('/',auth[_0xd784('0x8')](),controller[_0xd784('0x9')]);router[_0xd784('0xa')](_0xd784('0xb'),auth[_0xd784('0x8')](),controller[_0xd784('0xc')]);router[_0xd784('0xa')](_0xd784('0xd'),auth[_0xd784('0x8')](),controller[_0xd784('0xe')]);router[_0xd784('0xa')](_0xd784('0xf'),auth[_0xd784('0x8')](),controller[_0xd784('0x10')]);router[_0xd784('0xa')](_0xd784('0x11'),auth[_0xd784('0x8')](),controller[_0xd784('0x12')]);router[_0xd784('0x13')]('/',auth[_0xd784('0x8')](),controller[_0xd784('0x14')]);router['post'](_0xd784('0x15'),auth[_0xd784('0x8')](),controller[_0xd784('0x16')]);router[_0xd784('0x13')](_0xd784('0xf'),auth[_0xd784('0x8')](),controller[_0xd784('0x17')]);router[_0xd784('0x13')]('/:id/resources',auth[_0xd784('0x8')](),controller[_0xd784('0x18')]);router[_0xd784('0x19')]('/:id',auth[_0xd784('0x8')](),controller['update']);router[_0xd784('0x1a')](_0xd784('0xd'),auth['isAuthenticated'](),controller[_0xd784('0x1b')]);router[_0xd784('0x1a')](_0xd784('0xf'),auth[_0xd784('0x8')](),controller['removeSections']);router[_0xd784('0x1a')]('/:id/resources',auth[_0xd784('0x8')](),controller['removeResources']);module[_0xd784('0x1c')]=router; \ No newline at end of file +var _0xd87b=['destroy','removeSections','exports','multer','connect-timeout','express','fs-extra','../../config/environment','./userProfile.controller','get','index','/describe','isAuthenticated','/:id','show','/:id/sections','getSections','/:id/resources','create','/:id/clone','clone','post','addSections','addResources','put','update','delete'];(function(_0x1ce16e,_0x4983ce){var _0x380e58=function(_0x391eda){while(--_0x391eda){_0x1ce16e['push'](_0x1ce16e['shift']());}};_0x380e58(++_0x4983ce);}(_0xd87b,0x8a));var _0xbd87=function(_0x144edc,_0x115053){_0x144edc=_0x144edc-0x0;var _0x14913a=_0xd87b[_0x144edc];return _0x14913a;};'use strict';var multer=require(_0xbd87('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xbd87('0x1'));var express=require(_0xbd87('0x2'));var router=express['Router']();var fs_extra=require(_0xbd87('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xbd87('0x4'));var controller=require(_0xbd87('0x5'));router[_0xbd87('0x6')]('/',auth['isAuthenticated'](),controller[_0xbd87('0x7')]);router[_0xbd87('0x6')](_0xbd87('0x8'),auth[_0xbd87('0x9')](),controller['describe']);router['get'](_0xbd87('0xa'),auth['isAuthenticated'](),controller[_0xbd87('0xb')]);router[_0xbd87('0x6')](_0xbd87('0xc'),auth[_0xbd87('0x9')](),controller[_0xbd87('0xd')]);router[_0xbd87('0x6')](_0xbd87('0xe'),auth[_0xbd87('0x9')](),controller['getResources']);router['post']('/',auth[_0xbd87('0x9')](),controller[_0xbd87('0xf')]);router['post'](_0xbd87('0x10'),auth[_0xbd87('0x9')](),controller[_0xbd87('0x11')]);router[_0xbd87('0x12')]('/:id/sections',auth[_0xbd87('0x9')](),controller[_0xbd87('0x13')]);router['post'](_0xbd87('0xe'),auth[_0xbd87('0x9')](),controller[_0xbd87('0x14')]);router[_0xbd87('0x15')](_0xbd87('0xa'),auth[_0xbd87('0x9')](),controller[_0xbd87('0x16')]);router[_0xbd87('0x17')](_0xbd87('0xa'),auth[_0xbd87('0x9')](),controller[_0xbd87('0x18')]);router[_0xbd87('0x17')]('/:id/sections',auth[_0xbd87('0x9')](),controller[_0xbd87('0x19')]);router[_0xbd87('0x17')](_0xbd87('0xe'),auth[_0xbd87('0x9')](),controller['removeResources']);module[_0xbd87('0x1a')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 7d5ec79..5649c82 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 _0xfa38=['exports','STRING','name','crudPermissions','join','getDataValue','BOOLEAN','sequelize'];(function(_0x2c1b53,_0x39cfe8){var _0x1a2c94=function(_0x39a067){while(--_0x39a067){_0x2c1b53['push'](_0x2c1b53['shift']());}};_0x1a2c94(++_0x39cfe8);}(_0xfa38,0xef));var _0x8fa3=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xfa38[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require(_0x8fa3('0x0'));module[_0x8fa3('0x1')]={'name':{'type':Sequelize[_0x8fa3('0x2')],'allowNull':![],'unique':_0x8fa3('0x3')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x5c5eb6){this['setDataValue'](_0x8fa3('0x4'),_0x5c5eb6?_0x5c5eb6[_0x8fa3('0x5')](''):[]);},'get':function(){return this['getDataValue'](_0x8fa3('0x4'))?this[_0x8fa3('0x6')]('crudPermissions')['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x8fa3('0x7')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x8fa3('0x7')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x8fa3('0x7')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x8fa3('0x7')],'defaultValue':!![]}}; \ No newline at end of file +var _0x58ba=['setDataValue','join','getDataValue','crudPermissions','BOOLEAN','sequelize','exports','STRING','name'];(function(_0x186cb3,_0x4801e9){var _0x48b5fb=function(_0x33059a){while(--_0x33059a){_0x186cb3['push'](_0x186cb3['shift']());}};_0x48b5fb(++_0x4801e9);}(_0x58ba,0x140));var _0xa58b=function(_0x303fb8,_0x3ab926){_0x303fb8=_0x303fb8-0x0;var _0x39adf5=_0x58ba[_0x303fb8];return _0x39adf5;};'use strict';var Sequelize=require(_0xa58b('0x0'));module[_0xa58b('0x1')]={'name':{'type':Sequelize[_0xa58b('0x2')],'allowNull':![],'unique':_0xa58b('0x3')},'crudPermissions':{'type':Sequelize[_0xa58b('0x2')],'set':function(_0xec6c4d){this[_0xa58b('0x4')]('crudPermissions',_0xec6c4d?_0xec6c4d[_0xa58b('0x5')](''):[]);},'get':function(){return this[_0xa58b('0x6')](_0xa58b('0x7'))?this[_0xa58b('0x6')](_0xa58b('0x7'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xa58b('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xa58b('0x8')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xa58b('0x8')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xa58b('0x8')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xa58b('0x8')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xa58b('0x8')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xa58b('0x8')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xa58b('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 314d474..c060e0e 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 _0xc373=['getSections','includes','isEmpty','subsections','enabled','findOne','Dashboard','forEach','resourceId','userProfileId','bulkCreate','removeResources','getResources','section','Missing\x20section\x20parameter','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','then','error','stack','name','index','UserProfile','fieldName','type','key','model','map','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','create','body','omit','createdAt','updatedAt','crudPermissions','sequelize','transaction','UserProfileSection','each','autoAssociation','UserProfileResource','sectionId','Resources','update','destroy','describe','addSections','push','get','ids'];(function(_0x3924d7,_0x4e219c){var _0x55c159=function(_0x1308bf){while(--_0x1308bf){_0x3924d7['push'](_0x3924d7['shift']());}};_0x55c159(++_0x4e219c);}(_0xc373,0x1c7));var _0x3c37=function(_0x35fabd,_0x825452){_0x35fabd=_0x35fabd-0x0;var _0x61a8ee=_0xc373[_0x35fabd];return _0x61a8ee;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3c37('0x0'));var zipdir=require(_0x3c37('0x1'));var jsonpatch=require(_0x3c37('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3c37('0x3'));var Mustache=require(_0x3c37('0x4'));var util=require(_0x3c37('0x5'));var path=require(_0x3c37('0x6'));var sox=require(_0x3c37('0x7'));var csv=require(_0x3c37('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3c37('0x9'));var squel=require(_0x3c37('0xa'));var crypto=require(_0x3c37('0xb'));var jsforce=require(_0x3c37('0xc'));var deskjs=require(_0x3c37('0xd'));var toCsv=require(_0x3c37('0x8'));var querystring=require(_0x3c37('0xe'));var Papa=require(_0x3c37('0xf'));var Redis=require(_0x3c37('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3c37('0x11'));var hardwareService=require(_0x3c37('0x12'));var logger=require(_0x3c37('0x13'))(_0x3c37('0x14'));var utils=require(_0x3c37('0x15'));var config=require(_0x3c37('0x16'));var licenseUtil=require(_0x3c37('0x17'));var db=require('../../mysqldb')['db'];config[_0x3c37('0x18')]=_[_0x3c37('0x19')](config[_0x3c37('0x18')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3c37('0x18')]));require('./userProfile.socket')['register'](socket);function respondWithStatusCode(_0x37904b,_0x3be8b3){_0x3be8b3=_0x3be8b3||0xcc;return function(_0x2eca76){if(_0x2eca76){return _0x37904b[_0x3c37('0x1a')](_0x3be8b3);}return _0x37904b[_0x3c37('0x1b')](_0x3be8b3)[_0x3c37('0x1c')]();};}function respondWithResult(_0x25d36e,_0x40d3ee){_0x40d3ee=_0x40d3ee||0xc8;return function(_0x294ea3){if(_0x294ea3){return _0x25d36e['status'](_0x40d3ee)[_0x3c37('0x1d')](_0x294ea3);}};}function respondWithFilteredResult(_0x214a0b,_0x5201bb){return function(_0x55761e){if(_0x55761e){var _0x3ae991=typeof _0x5201bb[_0x3c37('0x1e')]===_0x3c37('0x1f')&&typeof _0x5201bb[_0x3c37('0x20')]===_0x3c37('0x1f');var _0x2b0f25=_0x55761e['count'];var _0x97c790=_0x3ae991?0x0:_0x5201bb['offset'];var _0x4c8932=_0x3ae991?_0x55761e[_0x3c37('0x21')]:_0x5201bb[_0x3c37('0x1e')]+_0x5201bb[_0x3c37('0x20')];var _0x7fe4f0;if(_0x4c8932>=_0x2b0f25){_0x4c8932=_0x2b0f25;_0x7fe4f0=0xc8;}else{_0x7fe4f0=0xce;}_0x214a0b[_0x3c37('0x1b')](_0x7fe4f0);return _0x214a0b['set'](_0x3c37('0x22'),_0x97c790+'-'+_0x4c8932+'/'+_0x2b0f25)['json'](_0x55761e);}return null;};}function patchUpdates(_0x3399a7){return function(_0x510baf){try{jsonpatch[_0x3c37('0x23')](_0x510baf,_0x3399a7,!![]);}catch(_0x2e4226){return BPromise[_0x3c37('0x24')](_0x2e4226);}return _0x510baf['save']();};}function saveUpdates(_0x51d25d,_0x5e004e){return function(_0x573e24){if(_0x573e24){return _0x573e24['update'](_0x51d25d)[_0x3c37('0x25')](function(_0xb334d0){return _0xb334d0;});}return null;};}function removeEntity(_0x1655c1,_0x3ab6bd){return function(_0x5dc9af){if(_0x5dc9af){return _0x5dc9af['destroy']()['then'](function(){_0x1655c1[_0x3c37('0x1b')](0xcc)[_0x3c37('0x1c')]();});}};}function handleEntityNotFound(_0x5e1df2,_0x4a9091){return function(_0x1ba7e0){if(!_0x1ba7e0){_0x5e1df2[_0x3c37('0x1a')](0x194);}return _0x1ba7e0;};}function handleError(_0x118269,_0xf98a18){_0xf98a18=_0xf98a18||0x1f4;return function(_0x64474f){logger[_0x3c37('0x26')](_0x64474f[_0x3c37('0x27')]);if(_0x64474f[_0x3c37('0x28')]){delete _0x64474f[_0x3c37('0x28')];}_0x118269[_0x3c37('0x1b')](_0xf98a18)['send'](_0x64474f);};}exports[_0x3c37('0x29')]=function(_0x2f7f87,_0x531931){var _0x579142={},_0x14936d={},_0x3bc99a={'count':0x0,'rows':[]};var _0x35590b=_['map'](db[_0x3c37('0x2a')]['rawAttributes'],function(_0x4548d3){return{'name':_0x4548d3[_0x3c37('0x2b')],'type':_0x4548d3[_0x3c37('0x2c')][_0x3c37('0x2d')]};});_0x14936d[_0x3c37('0x2e')]=_[_0x3c37('0x2f')](_0x35590b,_0x3c37('0x28'));_0x14936d[_0x3c37('0x30')]=_[_0x3c37('0x31')](_0x2f7f87[_0x3c37('0x30')]);_0x14936d['filters']=_['intersection'](_0x14936d['model'],_0x14936d[_0x3c37('0x30')]);_0x579142[_0x3c37('0x32')]=_[_0x3c37('0x33')](_0x14936d[_0x3c37('0x2e')],qs[_0x3c37('0x34')](_0x2f7f87[_0x3c37('0x30')][_0x3c37('0x34')]));_0x579142[_0x3c37('0x32')]=_0x579142[_0x3c37('0x32')][_0x3c37('0x35')]?_0x579142[_0x3c37('0x32')]:_0x14936d[_0x3c37('0x2e')];if(!_0x2f7f87['query'][_0x3c37('0x36')](_0x3c37('0x37'))){_0x579142['limit']=qs['limit'](_0x2f7f87[_0x3c37('0x30')][_0x3c37('0x20')]);_0x579142[_0x3c37('0x1e')]=qs[_0x3c37('0x1e')](_0x2f7f87[_0x3c37('0x30')][_0x3c37('0x1e')]);}_0x579142[_0x3c37('0x38')]=qs[_0x3c37('0x39')](_0x2f7f87[_0x3c37('0x30')]['sort']);_0x579142[_0x3c37('0x3a')]=qs[_0x3c37('0x3b')](_[_0x3c37('0x3c')](_0x2f7f87[_0x3c37('0x30')],_0x14936d[_0x3c37('0x3b')]),_0x35590b);if(_0x2f7f87[_0x3c37('0x30')][_0x3c37('0x3d')]){_0x579142[_0x3c37('0x3a')]=_[_0x3c37('0x3e')](_0x579142[_0x3c37('0x3a')],{'$or':_['map'](_0x35590b,function(_0x3b73be){if(_0x3b73be[_0x3c37('0x2c')]!==_0x3c37('0x3f')){var _0xab1900={};_0xab1900[_0x3b73be[_0x3c37('0x28')]]={'$like':'%'+_0x2f7f87['query'][_0x3c37('0x3d')]+'%'};return _0xab1900;}})});}_0x579142=_[_0x3c37('0x3e')]({},_0x579142,_0x2f7f87[_0x3c37('0x40')]);var _0x21576e={'where':_0x579142['where']};return db[_0x3c37('0x2a')]['count'](_0x21576e)[_0x3c37('0x25')](function(_0x51687d){_0x3bc99a[_0x3c37('0x21')]=_0x51687d;if(_0x2f7f87[_0x3c37('0x30')][_0x3c37('0x41')]){_0x579142['include']=[{'all':!![]}];}return db[_0x3c37('0x2a')][_0x3c37('0x42')](_0x579142);})[_0x3c37('0x25')](function(_0x2a4300){_0x3bc99a[_0x3c37('0x43')]=_0x2a4300;return _0x3bc99a;})['then'](respondWithFilteredResult(_0x531931,_0x579142))[_0x3c37('0x44')](handleError(_0x531931,null));};exports[_0x3c37('0x45')]=function(_0x2a2ad9,_0x420196){var _0x1f1632={'raw':![],'where':{'id':_0x2a2ad9[_0x3c37('0x46')]['id']}},_0x30ddbe={};_0x30ddbe['model']=_[_0x3c37('0x31')](db[_0x3c37('0x2a')][_0x3c37('0x47')]);_0x30ddbe['query']=_[_0x3c37('0x31')](_0x2a2ad9['query']);_0x30ddbe[_0x3c37('0x3b')]=_[_0x3c37('0x33')](_0x30ddbe[_0x3c37('0x2e')],_0x30ddbe[_0x3c37('0x30')]);_0x1f1632['attributes']=_['intersection'](_0x30ddbe['model'],qs[_0x3c37('0x34')](_0x2a2ad9[_0x3c37('0x30')]['fields']));_0x1f1632['attributes']=_0x1f1632[_0x3c37('0x32')]['length']?_0x1f1632[_0x3c37('0x32')]:_0x30ddbe[_0x3c37('0x2e')];if(_0x2a2ad9[_0x3c37('0x30')][_0x3c37('0x41')]){_0x1f1632[_0x3c37('0x48')]=[{'all':!![]}];}_0x1f1632=_[_0x3c37('0x3e')]({},_0x1f1632,_0x2a2ad9[_0x3c37('0x40')]);return db[_0x3c37('0x2a')][_0x3c37('0x49')](_0x1f1632)[_0x3c37('0x25')](handleEntityNotFound(_0x420196,null))[_0x3c37('0x25')](respondWithResult(_0x420196,null))['catch'](handleError(_0x420196,null));};exports[_0x3c37('0x4a')]=function(_0x1869ad,_0x4b8351){return db[_0x3c37('0x2a')][_0x3c37('0x4a')](_0x1869ad[_0x3c37('0x4b')],{})['then'](respondWithResult(_0x4b8351,0xc9))[_0x3c37('0x44')](handleError(_0x4b8351,null));};exports['clone']=function(_0x32f2f8,_0xaa6056){var _0x317851={'where':{'id':_0x32f2f8[_0x3c37('0x46')]['id']}},_0x5343e3={};_0x5343e3[_0x3c37('0x2e')]=_[_0x3c37('0x31')](db[_0x3c37('0x2a')][_0x3c37('0x47')]);_0x317851[_0x3c37('0x32')]=_[_0x3c37('0x33')](_0x5343e3[_0x3c37('0x2e')],qs[_0x3c37('0x34')](_0x32f2f8[_0x3c37('0x30')][_0x3c37('0x34')]));_0x317851[_0x3c37('0x32')]=_0x317851[_0x3c37('0x32')]['length']?_0x317851[_0x3c37('0x32')]:_0x5343e3[_0x3c37('0x2e')];if(_0x32f2f8[_0x3c37('0x30')]['includeAll']){_0x317851[_0x3c37('0x48')]=[{'all':!![]}];}_0x317851=_[_0x3c37('0x3e')]({},_0x317851,_0x32f2f8[_0x3c37('0x40')]);return db['UserProfile'][_0x3c37('0x49')](_0x317851)[_0x3c37('0x25')](handleEntityNotFound(_0xaa6056,null))[_0x3c37('0x25')](function(_0x183b19){if(_0x183b19){var _0x3a67e3=_0x183b19['get']({'plain':!![]});_0x3a67e3=qs[_0x3c37('0x4c')](_0x3a67e3,['id',_0x3c37('0x4d'),_0x3c37('0x4e'),_0x3c37('0x4f')]);_0x32f2f8['body']=_['omit'](_0x32f2f8[_0x3c37('0x4b')],['id','createdAt',_0x3c37('0x4e')]);return db[_0x3c37('0x50')][_0x3c37('0x51')](function(_0x5c8757){return db['UserProfile'][_0x3c37('0x4a')](_[_0x3c37('0x3e')](_0x3a67e3,_0x32f2f8[_0x3c37('0x4b')]),{'include':_0x32f2f8[_0x3c37('0x30')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x5c8757})[_0x3c37('0x25')](function(_0x1858bf){var _0x56d3d2=_0x1858bf['get']({'plain':!![]});return db[_0x3c37('0x52')]['findAll']({'where':{'userProfileId':_0x32f2f8[_0x3c37('0x46')]['id']},'raw':!![]})[_0x3c37('0x25')](function(_0xe0d4d){if(_0xe0d4d){return BPromise[_0x3c37('0x53')](_0xe0d4d,function(_0x4c589b){return new BPromise(function(_0xfb69a6,_0x5a0d96){if(_0x4c589b[_0x3c37('0x54')]===null||_0x4c589b[_0x3c37('0x54')]===0x1)_0xfb69a6(null);return db[_0x3c37('0x55')][_0x3c37('0x42')]({'where':{'sectionId':_0x4c589b['id']},'raw':!![]})['then'](function(_0x338098){var _0x57c209=_[_0x3c37('0x2f')](_0x338098,function(_0x6e6cfe){return qs[_0x3c37('0x4c')](_0x6e6cfe,['id','createdAt',_0x3c37('0x4e'),_0x3c37('0x56')]);});_0xfb69a6(_0x57c209);})['catch'](function(_0x415627){_0x5a0d96(_0x415627);});})[_0x3c37('0x25')](function(_0x1d5c6f){var _0x5964d4=qs[_0x3c37('0x4c')](_0x4c589b,['id',_0x3c37('0x4d'),'updatedAt']);_0x5964d4['userProfileId']=_0x56d3d2['id'];if(_0x1d5c6f)_0x5964d4['Resources']=_0x1d5c6f;return _0x5964d4;})[_0x3c37('0x25')](function(_0x1c02aa){return db[_0x3c37('0x52')][_0x3c37('0x4a')](_0x1c02aa,{'include':[{'model':db[_0x3c37('0x55')],'as':_0x3c37('0x57')}],'raw':!![],'transaction':_0x5c8757});});})[_0x3c37('0x25')](function(){return _0x56d3d2;});}});});});}})[_0x3c37('0x25')](respondWithResult(_0xaa6056,0xc9))[_0x3c37('0x44')](handleError(_0xaa6056,null));};exports[_0x3c37('0x58')]=function(_0x10a4de,_0x4511be){if(_0x10a4de[_0x3c37('0x4b')]['id']){delete _0x10a4de['body']['id'];}return db[_0x3c37('0x2a')][_0x3c37('0x49')]({'where':{'id':_0x10a4de[_0x3c37('0x46')]['id']}})[_0x3c37('0x25')](handleEntityNotFound(_0x4511be,null))[_0x3c37('0x25')](saveUpdates(_0x10a4de['body'],null))[_0x3c37('0x25')](respondWithResult(_0x4511be,null))[_0x3c37('0x44')](handleError(_0x4511be,null));};exports[_0x3c37('0x59')]=function(_0x3e6fa4,_0x309131){return db['UserProfile']['find']({'where':{'id':_0x3e6fa4['params']['id']}})[_0x3c37('0x25')](handleEntityNotFound(_0x309131,null))[_0x3c37('0x25')](removeEntity(_0x309131,null))[_0x3c37('0x44')](handleError(_0x309131,null));};exports['describe']=function(_0x471046,_0x497e52){return db[_0x3c37('0x2a')][_0x3c37('0x5a')]()[_0x3c37('0x25')](respondWithResult(_0x497e52,null))['catch'](handleError(_0x497e52,null));};exports[_0x3c37('0x5b')]=function(_0xc2f37e,_0x440271){var _0xc30769=_0xc2f37e[_0x3c37('0x4b')];return db['UserProfile'][_0x3c37('0x49')]({'where':{'id':_0xc2f37e[_0x3c37('0x46')]['id']}})[_0x3c37('0x25')](handleEntityNotFound(_0x440271,null))[_0x3c37('0x25')](function(_0x1cf913){if(_0x1cf913){return db[_0x3c37('0x50')][_0x3c37('0x51')](function(_0x4c2c60){return db[_0x3c37('0x52')]['destroy']({'where':{'userProfileId':_0xc2f37e[_0x3c37('0x46')]['id'],'sectionId':_[_0x3c37('0x2f')](_0xc30769,function(_0x207d15){return _0x207d15['sectionId'];})},'transaction':_0x4c2c60})[_0x3c37('0x25')](function(){var _0x3ef528=_[_0x3c37('0x2f')](_0xc30769,function(_0x4cc1bd){_0x4cc1bd['userProfileId']=_0xc2f37e[_0x3c37('0x46')]['id'];return _0x4cc1bd;});var _0x567d38=[];return BPromise[_0x3c37('0x53')](_0x3ef528,function(_0x5c0878){return db[_0x3c37('0x52')]['create'](_0x5c0878,{'include':[{'model':db['UserProfileResource'],'as':'Resources'}],'raw':!![],'transaction':_0x4c2c60})['then'](function(_0x56c31b){_0x567d38[_0x3c37('0x5c')](_0x56c31b[_0x3c37('0x5d')]({'plain':!![]}));});})[_0x3c37('0x25')](function(){return _0x567d38;});});});}})[_0x3c37('0x25')](function(_0x2175db){return _0x2175db;})[_0x3c37('0x25')](respondWithResult(_0x440271,null))['catch'](handleError(_0x440271,null));};exports['removeSections']=function(_0x5c9b10,_0x8cb9d7){var _0x1dbfde;return db['UserProfile'][_0x3c37('0x49')]({'where':{'id':_0x5c9b10[_0x3c37('0x46')]['id']},'attributes':['id',_0x3c37('0x28')]})[_0x3c37('0x25')](handleEntityNotFound(_0x8cb9d7,null))[_0x3c37('0x25')](function(_0x1ac66c){if(_0x1ac66c){_0x1dbfde=_0x1ac66c;return db['UserProfileSection']['destroy']({'where':{'userProfileId':_0x5c9b10['params']['id'],'sectionId':_0x5c9b10[_0x3c37('0x30')][_0x3c37('0x5e')]}});}})[_0x3c37('0x25')](function(){return _0x1dbfde;})[_0x3c37('0x25')](respondWithStatusCode(_0x8cb9d7,null))[_0x3c37('0x44')](handleError(_0x8cb9d7,null));};exports[_0x3c37('0x5f')]=function(_0x3e7003,_0x181133){var _0x1f1be3=[];var _0x23be20=[];return db[_0x3c37('0x52')][_0x3c37('0x42')]({'where':{'userProfileId':_0x3e7003[_0x3c37('0x46')]['id']},'raw':!![]})[_0x3c37('0x25')](function(_0x1efa11){_0x1f1be3=_['filter'](_0x1efa11,function(_0x599ccf){return _0x599ccf['enabled']===0x1||_[_0x3c37('0x60')]([0x3eb,0x709],_0x599ccf[_0x3c37('0x56')]);});if(!_[_0x3c37('0x61')](_0x1f1be3)){return _[_0x3c37('0x2f')](_0x1f1be3,function(_0x470019){return _0x470019['sectionId'];});}else{return;}})['then'](function(_0x18785e){if(_0x18785e)_0x23be20=_0x18785e;if(_['includes'](_0x23be20,0x64)){var _0x5617b2=_[_0x3c37('0x49')](_0x1f1be3,{'sectionId':0x64});return hasDefaultDashboard(_0x5617b2)[_0x3c37('0x25')](function(_0x699ac8){return _[_0x3c37('0x2f')](_0x1f1be3,function(_0xebe5df){if(_0xebe5df['sectionId']===0x64){_0xebe5df[_0x3c37('0x62')]=_0x699ac8;}return _0xebe5df;});});}else{return;}})['then'](function(_0x32cc9a){if(_0x32cc9a)_0x1f1be3=_0x32cc9a;if(_[_0x3c37('0x60')](_0x23be20,0x3eb)){var _0x28c743=_[_0x3c37('0x49')](_0x1f1be3,{'sectionId':0x3eb});return getCustomDashboards(_0x28c743)[_0x3c37('0x25')](function(_0x4e189d){return _[_0x3c37('0x2f')](_0x1f1be3,function(_0x36acc2){if(_0x28c743[_0x3c37('0x63')]){if(_0x36acc2['sectionId']===0x3eb){_0x36acc2[_0x3c37('0x62')]=_0x4e189d;}}else{if(_0x36acc2[_0x3c37('0x56')]===0x64){_0x36acc2[_0x3c37('0x62')]=_0x4e189d;}}return _0x36acc2;});});}else{return;}})[_0x3c37('0x25')](function(_0x482036){if(_0x482036)_0x1f1be3=_0x482036;if(_[_0x3c37('0x60')](_0x23be20,0x709)){var _0x2864ec=_[_0x3c37('0x49')](_0x1f1be3,{'sectionId':0x709});return getPlugins(_0x2864ec)[_0x3c37('0x25')](function(_0x3a0f7e){if(_0x2864ec[_0x3c37('0x63')]){return _[_0x3c37('0x2f')](_0x1f1be3,function(_0x1334a9){if(_0x1334a9['sectionId']===0x709){_0x1334a9[_0x3c37('0x62')]=_0x3a0f7e;}return _0x1334a9;});}else{var _0x3cda5c={'sectionId':0x76c,'enabled':0x1,'subsections':_0x3a0f7e};var _0x151c92=_[_0x3c37('0x2f')](_0x1f1be3);_0x151c92[_0x3c37('0x5c')](_0x3cda5c);return _0x151c92;}});}else{return;}})['then'](function(_0xf62d66){if(_0xf62d66)_0x1f1be3=_0xf62d66;return _[_0x3c37('0x3d')](_0x1f1be3,[_0x3c37('0x63'),0x1]);})['then'](respondWithResult(_0x181133,null))[_0x3c37('0x44')](handleError(_0x181133,null));};function hasDefaultDashboard(_0x447523){var _0x1bee7a=[0x65];return new BPromise(function(_0x4232d8,_0x2372b3){try{if(_0x447523[_0x3c37('0x54')]){_0x4232d8(_0x1bee7a);}else{return db['UserProfileResource'][_0x3c37('0x64')]({'where':{'sectionId':_0x447523['id']},'raw':!![]})[_0x3c37('0x25')](function(_0x2ed337){_0x2ed337?_0x4232d8(_0x1bee7a):_0x4232d8();});}}catch(_0x16bb10){_0x2372b3(_0x16bb10);}});}function getCustomDashboards(_0x44584f){var _0x4f09a3=[];return new BPromise(function(_0x3fdda9,_0xd296e3){try{if(_0x44584f[_0x3c37('0x54')]){return db[_0x3c37('0x65')]['findAll']({'raw':!![]})[_0x3c37('0x25')](function(_0x303d33){_0x303d33[_0x3c37('0x66')](function(_0x4cf765){_0x4f09a3[_0x3c37('0x5c')](_0x4cf765['id']+0x1869f);});_0x3fdda9(_0x4f09a3);});}else{return db[_0x3c37('0x55')][_0x3c37('0x42')]({'where':{'sectionId':_0x44584f['id']},'raw':!![]})[_0x3c37('0x25')](function(_0x20be64){_0x20be64[_0x3c37('0x66')](function(_0x51ec5a){_0x4f09a3['push'](_0x51ec5a[_0x3c37('0x67')]+0x1869f);});_0x3fdda9(_0x4f09a3);});}}catch(_0x47b705){_0xd296e3(_0x47b705);}});}function getPlugins(_0x4213eb){var _0x1f466b=[];return new BPromise(function(_0x2bb8f0,_0x784318){try{if(_0x4213eb['autoAssociation']){return db['Plugin'][_0x3c37('0x42')]({'raw':!![]})[_0x3c37('0x25')](function(_0x5e1c21){_0x5e1c21[_0x3c37('0x66')](function(_0x20846f){_0x1f466b['push'](_0x20846f['id']+0x15b38);});_0x2bb8f0(_0x1f466b);});}else{return db[_0x3c37('0x55')][_0x3c37('0x42')]({'where':{'sectionId':_0x4213eb['id']},'raw':!![]})[_0x3c37('0x25')](function(_0x1e312f){_0x1e312f[_0x3c37('0x66')](function(_0x2747e0){_0x1f466b['push'](_0x2747e0[_0x3c37('0x67')]+0x15b38);});_0x2bb8f0(_0x1f466b);});}}catch(_0x1b2057){_0x784318(_0x1b2057);}});}exports['addResources']=function(_0x28e4f6,_0x15b54f){return db[_0x3c37('0x2a')][_0x3c37('0x49')]({'where':{'id':_0x28e4f6['params']['id']}})[_0x3c37('0x25')](handleEntityNotFound(_0x15b54f,null))[_0x3c37('0x25')](function(_0x4483ec){if(_0x4483ec){return db[_0x3c37('0x50')]['transaction'](function(_0x1b71e8){return db['UserProfileSection'][_0x3c37('0x42')]({'where':{'userProfileId':_0x28e4f6[_0x3c37('0x46')]['id']},'attributes':['id'],'raw':!![]})[_0x3c37('0x25')](function(_0x32fba7){if(_0x32fba7){return db[_0x3c37('0x52')][_0x3c37('0x59')]({'where':{'userProfileId':_0x28e4f6['params']['id'],'id':_['map'](_0x32fba7,function(_0x2d650c){return _0x2d650c['id'];})},'transaction':_0x1b71e8});}})[_0x3c37('0x25')](function(_0x84429f){var _0x452bf4=_[_0x3c37('0x2f')](_0x28e4f6[_0x3c37('0x4b')],function(_0x16d7b6){_0x16d7b6[_0x3c37('0x68')]=_0x28e4f6['params']['id'];return _0x16d7b6;});return db['UserProfileSection'][_0x3c37('0x69')](_0x452bf4,{'raw':!![],'transaction':_0x1b71e8});})[_0x3c37('0x25')](function(_0x29b8f8){var _0x194d4f=_[_0x3c37('0x3d')](_[_0x3c37('0x2f')](_0x29b8f8,function(_0x4b5272){return _0x4b5272['get']({'plain':!![]});}),{'includeAll':![]});if(_0x194d4f){return db['UserProfileSection'][_0x3c37('0x42')]({'where':{'userProfileId':_0x28e4f6[_0x3c37('0x46')]['id'],'sectionId':_[_0x3c37('0x2f')](_0x194d4f,function(_0x3ae623){return _0x3ae623[_0x3c37('0x56')];})},'attributes':['id','sectionId'],'raw':!![]})[_0x3c37('0x25')](function(_0x30d74f){var _0x3c9016=_[_0x3c37('0x2f')](_0x28e4f6['body'],function(_0x5589d2){_0x5589d2['userProfileId']=_0x28e4f6[_0x3c37('0x46')]['id'];return _0x5589d2;});return db['UserProfileResource']['bulkCreate'](_0x3c9016,{'raw':!![],'transaction':_0x1b71e8});});}})['catch'](handleError(_0x15b54f,null));});}})[_0x3c37('0x25')](function(_0x3c0712){var _0x10c679=_['map'](_0x3c0712,function(_0x4d8c95){return _0x4d8c95[_0x3c37('0x5d')]({'plain':!![]});});})[_0x3c37('0x25')](respondWithResult(_0x15b54f,null))[_0x3c37('0x44')](handleError(_0x15b54f,null));};exports[_0x3c37('0x6a')]=function(_0x341bfd,_0x461b3e,_0x2c97eb){return db[_0x3c37('0x2a')][_0x3c37('0x49')]({'where':{'id':_0x341bfd[_0x3c37('0x46')]['id']}})[_0x3c37('0x25')](handleEntityNotFound(_0x461b3e,null))[_0x3c37('0x25')](function(_0x27c1d4){if(_0x27c1d4){return _0x27c1d4[_0x3c37('0x6a')](_0x341bfd[_0x3c37('0x30')]['ids']);}})[_0x3c37('0x25')](respondWithStatusCode(_0x461b3e,null))[_0x3c37('0x44')](handleError(_0x461b3e,null));};exports[_0x3c37('0x6b')]=function(_0x2300aa,_0x5e7807){var _0x3f1280={};if(!_0x2300aa[_0x3c37('0x30')][_0x3c37('0x6c')])throw new Error(_0x3c37('0x6d'));if(!_0x2300aa[_0x3c37('0x30')][_0x3c37('0x36')]('nolimit')){_0x3f1280['limit']=qs[_0x3c37('0x20')](_0x2300aa[_0x3c37('0x30')][_0x3c37('0x20')]);_0x3f1280[_0x3c37('0x1e')]=qs[_0x3c37('0x1e')](_0x2300aa['query'][_0x3c37('0x1e')]);}return db[_0x3c37('0x2a')]['find']({'where':{'id':_0x2300aa[_0x3c37('0x46')]['id']}})['then'](function(_0x439ae5){if(!_0x439ae5)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x2300aa[_0x3c37('0x46')]['id']);return db['UserProfile'][_0x3c37('0x6b')](_0x2300aa);})[_0x3c37('0x25')](respondWithFilteredResult(_0x5e7807,_0x3f1280))[_0x3c37('0x44')](handleError(_0x5e7807,null));}; \ No newline at end of file +var _0x5a13=['ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/license/util','redis','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','then','destroy','error','stack','name','send','index','map','UserProfile','rawAttributes','fieldName','type','key','keys','filters','intersection','model','query','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','show','params','options','find','create','catch','clone','get','omit','updatedAt','crudPermissions','body','createdAt','sequelize','transaction','UserProfileSection','each','autoAssociation','UserProfileResource','sectionId','Resources','describe','userProfileId','push','removeSections','ids','getSections','enabled','isEmpty','includes','subsections','findOne','Dashboard','forEach','resourceId','Plugin','bulkCreate','removeResources','getResources','section','hasOwnProperty','nolimit','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5a13,0x145));var _0x35a1=function(_0x6e9f04,_0x4b925e){_0x6e9f04=_0x6e9f04-0x0;var _0x5e95a1=_0x5a13[_0x6e9f04];return _0x5e95a1;};'use strict';var emlformat=require(_0x35a1('0x0'));var rimraf=require(_0x35a1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x35a1('0x2'));var rp=require(_0x35a1('0x3'));var moment=require(_0x35a1('0x4'));var BPromise=require(_0x35a1('0x5'));var Mustache=require(_0x35a1('0x6'));var util=require(_0x35a1('0x7'));var path=require(_0x35a1('0x8'));var sox=require(_0x35a1('0x9'));var csv=require(_0x35a1('0xa'));var ejs=require(_0x35a1('0xb'));var fs=require('fs');var fs_extra=require(_0x35a1('0xc'));var _=require(_0x35a1('0xd'));var squel=require(_0x35a1('0xe'));var crypto=require(_0x35a1('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x35a1('0x10'));var Papa=require(_0x35a1('0x11'));var Redis=require('ioredis');var authService=require(_0x35a1('0x12'));var qs=require(_0x35a1('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x35a1('0x14'))(_0x35a1('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x35a1('0x16'));var db=require('../../mysqldb')['db'];config[_0x35a1('0x17')]=_['defaults'](config[_0x35a1('0x17')],{'host':_0x35a1('0x18'),'port':0x18eb});var socket=require(_0x35a1('0x19'))(new Redis(config[_0x35a1('0x17')]));require(_0x35a1('0x1a'))[_0x35a1('0x1b')](socket);function respondWithStatusCode(_0x20d868,_0x42de36){_0x42de36=_0x42de36||0xcc;return function(_0x1a2627){if(_0x1a2627){return _0x20d868[_0x35a1('0x1c')](_0x42de36);}return _0x20d868[_0x35a1('0x1d')](_0x42de36)[_0x35a1('0x1e')]();};}function respondWithResult(_0x2f93be,_0x44c755){_0x44c755=_0x44c755||0xc8;return function(_0x45f49a){if(_0x45f49a){return _0x2f93be[_0x35a1('0x1d')](_0x44c755)[_0x35a1('0x1f')](_0x45f49a);}};}function respondWithFilteredResult(_0x2b22b4,_0x3e7b28){return function(_0x1de373){if(_0x1de373){var _0x5e4317=typeof _0x3e7b28[_0x35a1('0x20')]===_0x35a1('0x21')&&typeof _0x3e7b28[_0x35a1('0x22')]===_0x35a1('0x21');var _0x2a9df3=_0x1de373[_0x35a1('0x23')];var _0x363f2d=_0x5e4317?0x0:_0x3e7b28[_0x35a1('0x20')];var _0x4179a2=_0x5e4317?_0x1de373['count']:_0x3e7b28[_0x35a1('0x20')]+_0x3e7b28[_0x35a1('0x22')];var _0x5ddd25;if(_0x4179a2>=_0x2a9df3){_0x4179a2=_0x2a9df3;_0x5ddd25=0xc8;}else{_0x5ddd25=0xce;}_0x2b22b4[_0x35a1('0x1d')](_0x5ddd25);return _0x2b22b4[_0x35a1('0x24')]('Content-Range',_0x363f2d+'-'+_0x4179a2+'/'+_0x2a9df3)[_0x35a1('0x1f')](_0x1de373);}return null;};}function patchUpdates(_0x5a1742){return function(_0x28af51){try{jsonpatch[_0x35a1('0x25')](_0x28af51,_0x5a1742,!![]);}catch(_0x329054){return BPromise['reject'](_0x329054);}return _0x28af51[_0x35a1('0x26')]();};}function saveUpdates(_0x2b87a1,_0x48f1bd){return function(_0x4c41ce){if(_0x4c41ce){return _0x4c41ce['update'](_0x2b87a1)[_0x35a1('0x27')](function(_0x51f5bd){return _0x51f5bd;});}return null;};}function removeEntity(_0x5408a7,_0x52d22b){return function(_0x2ee03c){if(_0x2ee03c){return _0x2ee03c[_0x35a1('0x28')]()[_0x35a1('0x27')](function(){_0x5408a7[_0x35a1('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39cc91,_0x34b3d8){return function(_0x3c552c){if(!_0x3c552c){_0x39cc91[_0x35a1('0x1c')](0x194);}return _0x3c552c;};}function handleError(_0x4712ba,_0x426623){_0x426623=_0x426623||0x1f4;return function(_0x3d3453){logger[_0x35a1('0x29')](_0x3d3453[_0x35a1('0x2a')]);if(_0x3d3453[_0x35a1('0x2b')]){delete _0x3d3453[_0x35a1('0x2b')];}_0x4712ba[_0x35a1('0x1d')](_0x426623)[_0x35a1('0x2c')](_0x3d3453);};}exports[_0x35a1('0x2d')]=function(_0x2ae0ca,_0x4b74b3){var _0x9720a4={},_0x379819={},_0x10b65e={'count':0x0,'rows':[]};var _0xd79e92=_[_0x35a1('0x2e')](db[_0x35a1('0x2f')][_0x35a1('0x30')],function(_0x2dc636){return{'name':_0x2dc636[_0x35a1('0x31')],'type':_0x2dc636[_0x35a1('0x32')][_0x35a1('0x33')]};});_0x379819['model']=_['map'](_0xd79e92,_0x35a1('0x2b'));_0x379819['query']=_[_0x35a1('0x34')](_0x2ae0ca['query']);_0x379819[_0x35a1('0x35')]=_[_0x35a1('0x36')](_0x379819[_0x35a1('0x37')],_0x379819[_0x35a1('0x38')]);_0x9720a4[_0x35a1('0x39')]=_[_0x35a1('0x36')](_0x379819[_0x35a1('0x37')],qs[_0x35a1('0x3a')](_0x2ae0ca[_0x35a1('0x38')][_0x35a1('0x3a')]));_0x9720a4[_0x35a1('0x39')]=_0x9720a4['attributes'][_0x35a1('0x3b')]?_0x9720a4[_0x35a1('0x39')]:_0x379819[_0x35a1('0x37')];if(!_0x2ae0ca['query']['hasOwnProperty']('nolimit')){_0x9720a4['limit']=qs['limit'](_0x2ae0ca['query'][_0x35a1('0x22')]);_0x9720a4[_0x35a1('0x20')]=qs[_0x35a1('0x20')](_0x2ae0ca[_0x35a1('0x38')][_0x35a1('0x20')]);}_0x9720a4[_0x35a1('0x3c')]=qs[_0x35a1('0x3d')](_0x2ae0ca[_0x35a1('0x38')]['sort']);_0x9720a4[_0x35a1('0x3e')]=qs['filters'](_[_0x35a1('0x3f')](_0x2ae0ca[_0x35a1('0x38')],_0x379819[_0x35a1('0x35')]),_0xd79e92);if(_0x2ae0ca[_0x35a1('0x38')][_0x35a1('0x40')]){_0x9720a4['where']=_[_0x35a1('0x41')](_0x9720a4[_0x35a1('0x3e')],{'$or':_[_0x35a1('0x2e')](_0xd79e92,function(_0x55c7e5){if(_0x55c7e5['type']!==_0x35a1('0x42')){var _0x1c7c0e={};_0x1c7c0e[_0x55c7e5[_0x35a1('0x2b')]]={'$like':'%'+_0x2ae0ca[_0x35a1('0x38')]['filter']+'%'};return _0x1c7c0e;}})});}_0x9720a4=_[_0x35a1('0x41')]({},_0x9720a4,_0x2ae0ca['options']);var _0x382e18={'where':_0x9720a4['where']};return db[_0x35a1('0x2f')][_0x35a1('0x23')](_0x382e18)['then'](function(_0x51eaaf){_0x10b65e[_0x35a1('0x23')]=_0x51eaaf;if(_0x2ae0ca['query'][_0x35a1('0x43')]){_0x9720a4[_0x35a1('0x44')]=[{'all':!![]}];}return db['UserProfile'][_0x35a1('0x45')](_0x9720a4);})['then'](function(_0xb1c14c){_0x10b65e['rows']=_0xb1c14c;return _0x10b65e;})[_0x35a1('0x27')](respondWithFilteredResult(_0x4b74b3,_0x9720a4))['catch'](handleError(_0x4b74b3,null));};exports[_0x35a1('0x46')]=function(_0x4e4893,_0x3453ee){var _0x4edec7={'raw':![],'where':{'id':_0x4e4893[_0x35a1('0x47')]['id']}},_0x171209={};_0x171209[_0x35a1('0x37')]=_[_0x35a1('0x34')](db[_0x35a1('0x2f')][_0x35a1('0x30')]);_0x171209[_0x35a1('0x38')]=_['keys'](_0x4e4893[_0x35a1('0x38')]);_0x171209[_0x35a1('0x35')]=_[_0x35a1('0x36')](_0x171209[_0x35a1('0x37')],_0x171209[_0x35a1('0x38')]);_0x4edec7[_0x35a1('0x39')]=_['intersection'](_0x171209[_0x35a1('0x37')],qs[_0x35a1('0x3a')](_0x4e4893[_0x35a1('0x38')][_0x35a1('0x3a')]));_0x4edec7[_0x35a1('0x39')]=_0x4edec7['attributes'][_0x35a1('0x3b')]?_0x4edec7[_0x35a1('0x39')]:_0x171209[_0x35a1('0x37')];if(_0x4e4893[_0x35a1('0x38')]['includeAll']){_0x4edec7[_0x35a1('0x44')]=[{'all':!![]}];}_0x4edec7=_[_0x35a1('0x41')]({},_0x4edec7,_0x4e4893[_0x35a1('0x48')]);return db[_0x35a1('0x2f')][_0x35a1('0x49')](_0x4edec7)[_0x35a1('0x27')](handleEntityNotFound(_0x3453ee,null))[_0x35a1('0x27')](respondWithResult(_0x3453ee,null))['catch'](handleError(_0x3453ee,null));};exports['create']=function(_0x16092f,_0x34805f){return db[_0x35a1('0x2f')][_0x35a1('0x4a')](_0x16092f['body'],{})['then'](respondWithResult(_0x34805f,0xc9))[_0x35a1('0x4b')](handleError(_0x34805f,null));};exports[_0x35a1('0x4c')]=function(_0x19123f,_0x42e5c0){var _0x53b05e={'where':{'id':_0x19123f['params']['id']}},_0x4c6399={};_0x4c6399[_0x35a1('0x37')]=_['keys'](db[_0x35a1('0x2f')][_0x35a1('0x30')]);_0x53b05e[_0x35a1('0x39')]=_[_0x35a1('0x36')](_0x4c6399[_0x35a1('0x37')],qs[_0x35a1('0x3a')](_0x19123f[_0x35a1('0x38')][_0x35a1('0x3a')]));_0x53b05e['attributes']=_0x53b05e[_0x35a1('0x39')][_0x35a1('0x3b')]?_0x53b05e[_0x35a1('0x39')]:_0x4c6399['model'];if(_0x19123f['query']['includeAll']){_0x53b05e['include']=[{'all':!![]}];}_0x53b05e=_[_0x35a1('0x41')]({},_0x53b05e,_0x19123f[_0x35a1('0x48')]);return db[_0x35a1('0x2f')][_0x35a1('0x49')](_0x53b05e)[_0x35a1('0x27')](handleEntityNotFound(_0x42e5c0,null))[_0x35a1('0x27')](function(_0x3369c1){if(_0x3369c1){var _0x2df88b=_0x3369c1[_0x35a1('0x4d')]({'plain':!![]});_0x2df88b=qs[_0x35a1('0x4e')](_0x2df88b,['id','createdAt',_0x35a1('0x4f'),_0x35a1('0x50')]);_0x19123f[_0x35a1('0x51')]=_['omit'](_0x19123f['body'],['id',_0x35a1('0x52'),'updatedAt']);return db[_0x35a1('0x53')][_0x35a1('0x54')](function(_0x3b1248){return db['UserProfile']['create'](_[_0x35a1('0x41')](_0x2df88b,_0x19123f['body']),{'include':_0x19123f['query'][_0x35a1('0x43')]?[{'all':!![]}]:undefined,'transaction':_0x3b1248})['then'](function(_0x1cec5e){var _0x238c1c=_0x1cec5e[_0x35a1('0x4d')]({'plain':!![]});return db[_0x35a1('0x55')][_0x35a1('0x45')]({'where':{'userProfileId':_0x19123f[_0x35a1('0x47')]['id']},'raw':!![]})[_0x35a1('0x27')](function(_0x23ea8f){if(_0x23ea8f){return BPromise[_0x35a1('0x56')](_0x23ea8f,function(_0x2ab62f){return new BPromise(function(_0x31851d,_0x5a6b4e){if(_0x2ab62f[_0x35a1('0x57')]===null||_0x2ab62f[_0x35a1('0x57')]===0x1)_0x31851d(null);return db[_0x35a1('0x58')]['findAll']({'where':{'sectionId':_0x2ab62f['id']},'raw':!![]})[_0x35a1('0x27')](function(_0xa85658){var _0x39349f=_[_0x35a1('0x2e')](_0xa85658,function(_0x750932){return qs[_0x35a1('0x4e')](_0x750932,['id',_0x35a1('0x52'),_0x35a1('0x4f'),_0x35a1('0x59')]);});_0x31851d(_0x39349f);})[_0x35a1('0x4b')](function(_0x3178c1){_0x5a6b4e(_0x3178c1);});})[_0x35a1('0x27')](function(_0x4eb8c6){var _0x36fc93=qs[_0x35a1('0x4e')](_0x2ab62f,['id',_0x35a1('0x52'),_0x35a1('0x4f')]);_0x36fc93['userProfileId']=_0x238c1c['id'];if(_0x4eb8c6)_0x36fc93['Resources']=_0x4eb8c6;return _0x36fc93;})[_0x35a1('0x27')](function(_0xce5b30){return db[_0x35a1('0x55')][_0x35a1('0x4a')](_0xce5b30,{'include':[{'model':db[_0x35a1('0x58')],'as':_0x35a1('0x5a')}],'raw':!![],'transaction':_0x3b1248});});})[_0x35a1('0x27')](function(){return _0x238c1c;});}});});});}})['then'](respondWithResult(_0x42e5c0,0xc9))[_0x35a1('0x4b')](handleError(_0x42e5c0,null));};exports['update']=function(_0x5b4da1,_0x3d2e20){if(_0x5b4da1[_0x35a1('0x51')]['id']){delete _0x5b4da1['body']['id'];}return db['UserProfile'][_0x35a1('0x49')]({'where':{'id':_0x5b4da1[_0x35a1('0x47')]['id']}})[_0x35a1('0x27')](handleEntityNotFound(_0x3d2e20,null))[_0x35a1('0x27')](saveUpdates(_0x5b4da1[_0x35a1('0x51')],null))[_0x35a1('0x27')](respondWithResult(_0x3d2e20,null))[_0x35a1('0x4b')](handleError(_0x3d2e20,null));};exports[_0x35a1('0x28')]=function(_0x578a95,_0x2c63e3){return db[_0x35a1('0x2f')][_0x35a1('0x49')]({'where':{'id':_0x578a95[_0x35a1('0x47')]['id']}})[_0x35a1('0x27')](handleEntityNotFound(_0x2c63e3,null))[_0x35a1('0x27')](removeEntity(_0x2c63e3,null))[_0x35a1('0x4b')](handleError(_0x2c63e3,null));};exports[_0x35a1('0x5b')]=function(_0x42cee7,_0x29ac46){return db[_0x35a1('0x2f')]['describe']()[_0x35a1('0x27')](respondWithResult(_0x29ac46,null))[_0x35a1('0x4b')](handleError(_0x29ac46,null));};exports['addSections']=function(_0x469cb8,_0x351af5){var _0x261acb=_0x469cb8[_0x35a1('0x51')];return db[_0x35a1('0x2f')][_0x35a1('0x49')]({'where':{'id':_0x469cb8[_0x35a1('0x47')]['id']}})[_0x35a1('0x27')](handleEntityNotFound(_0x351af5,null))[_0x35a1('0x27')](function(_0x48f209){if(_0x48f209){return db['sequelize'][_0x35a1('0x54')](function(_0x3c9786){return db[_0x35a1('0x55')][_0x35a1('0x28')]({'where':{'userProfileId':_0x469cb8['params']['id'],'sectionId':_[_0x35a1('0x2e')](_0x261acb,function(_0x3f8f14){return _0x3f8f14[_0x35a1('0x59')];})},'transaction':_0x3c9786})[_0x35a1('0x27')](function(){var _0x10f603=_[_0x35a1('0x2e')](_0x261acb,function(_0xac314f){_0xac314f[_0x35a1('0x5c')]=_0x469cb8[_0x35a1('0x47')]['id'];return _0xac314f;});var _0xf03dfe=[];return BPromise[_0x35a1('0x56')](_0x10f603,function(_0x5430d1){return db[_0x35a1('0x55')][_0x35a1('0x4a')](_0x5430d1,{'include':[{'model':db['UserProfileResource'],'as':_0x35a1('0x5a')}],'raw':!![],'transaction':_0x3c9786})[_0x35a1('0x27')](function(_0x3fe7fa){_0xf03dfe[_0x35a1('0x5d')](_0x3fe7fa['get']({'plain':!![]}));});})[_0x35a1('0x27')](function(){return _0xf03dfe;});});});}})[_0x35a1('0x27')](function(_0x2e7195){return _0x2e7195;})[_0x35a1('0x27')](respondWithResult(_0x351af5,null))[_0x35a1('0x4b')](handleError(_0x351af5,null));};exports[_0x35a1('0x5e')]=function(_0x403a25,_0x435d03){var _0x1139e1;return db['UserProfile']['find']({'where':{'id':_0x403a25['params']['id']},'attributes':['id',_0x35a1('0x2b')]})[_0x35a1('0x27')](handleEntityNotFound(_0x435d03,null))[_0x35a1('0x27')](function(_0x914ea5){if(_0x914ea5){_0x1139e1=_0x914ea5;return db[_0x35a1('0x55')][_0x35a1('0x28')]({'where':{'userProfileId':_0x403a25['params']['id'],'sectionId':_0x403a25['query'][_0x35a1('0x5f')]}});}})[_0x35a1('0x27')](function(){return _0x1139e1;})[_0x35a1('0x27')](respondWithStatusCode(_0x435d03,null))['catch'](handleError(_0x435d03,null));};exports[_0x35a1('0x60')]=function(_0x9c820e,_0x4031eb){var _0x207cbd=[];var _0x549d40=[];return db['UserProfileSection'][_0x35a1('0x45')]({'where':{'userProfileId':_0x9c820e[_0x35a1('0x47')]['id']},'raw':!![]})['then'](function(_0x371b14){_0x207cbd=_[_0x35a1('0x40')](_0x371b14,function(_0x369069){return _0x369069[_0x35a1('0x61')]===0x1||_['includes']([0x3eb,0x709],_0x369069[_0x35a1('0x59')]);});if(!_[_0x35a1('0x62')](_0x207cbd)){return _['map'](_0x207cbd,function(_0x198cf7){return _0x198cf7[_0x35a1('0x59')];});}else{return;}})[_0x35a1('0x27')](function(_0x4f2dcf){if(_0x4f2dcf)_0x549d40=_0x4f2dcf;if(_[_0x35a1('0x63')](_0x549d40,0x64)){var _0x754431=_[_0x35a1('0x49')](_0x207cbd,{'sectionId':0x64});return hasDefaultDashboard(_0x754431)[_0x35a1('0x27')](function(_0x269b3e){return _[_0x35a1('0x2e')](_0x207cbd,function(_0x37e2ce){if(_0x37e2ce[_0x35a1('0x59')]===0x64){_0x37e2ce[_0x35a1('0x64')]=_0x269b3e;}return _0x37e2ce;});});}else{return;}})[_0x35a1('0x27')](function(_0xff8cb0){if(_0xff8cb0)_0x207cbd=_0xff8cb0;if(_[_0x35a1('0x63')](_0x549d40,0x3eb)){var _0xc1da8a=_[_0x35a1('0x49')](_0x207cbd,{'sectionId':0x3eb});return getCustomDashboards(_0xc1da8a)[_0x35a1('0x27')](function(_0xbfe3da){return _['map'](_0x207cbd,function(_0x1a5487){if(_0xc1da8a['enabled']){if(_0x1a5487[_0x35a1('0x59')]===0x3eb){_0x1a5487[_0x35a1('0x64')]=_0xbfe3da;}}else{if(_0x1a5487['sectionId']===0x64){_0x1a5487[_0x35a1('0x64')]=_0xbfe3da;}}return _0x1a5487;});});}else{return;}})['then'](function(_0x5e3d22){if(_0x5e3d22)_0x207cbd=_0x5e3d22;if(_['includes'](_0x549d40,0x709)){var _0x10c8dc=_[_0x35a1('0x49')](_0x207cbd,{'sectionId':0x709});return getPlugins(_0x10c8dc)['then'](function(_0x4477f8){if(_0x10c8dc[_0x35a1('0x61')]){return _[_0x35a1('0x2e')](_0x207cbd,function(_0x2d6242){if(_0x2d6242[_0x35a1('0x59')]===0x709){_0x2d6242[_0x35a1('0x64')]=_0x4477f8;}return _0x2d6242;});}else{var _0x41b383={'sectionId':0x76c,'enabled':0x1,'subsections':_0x4477f8};var _0x28977a=_[_0x35a1('0x2e')](_0x207cbd);_0x28977a[_0x35a1('0x5d')](_0x41b383);return _0x28977a;}});}else{return;}})['then'](function(_0x30e6f4){if(_0x30e6f4)_0x207cbd=_0x30e6f4;return _['filter'](_0x207cbd,[_0x35a1('0x61'),0x1]);})[_0x35a1('0x27')](respondWithResult(_0x4031eb,null))[_0x35a1('0x4b')](handleError(_0x4031eb,null));};function hasDefaultDashboard(_0x403115){var _0x38d8c1=[0x65];return new BPromise(function(_0x2687cb,_0x365f44){try{if(_0x403115[_0x35a1('0x57')]){_0x2687cb(_0x38d8c1);}else{return db[_0x35a1('0x58')][_0x35a1('0x65')]({'where':{'sectionId':_0x403115['id']},'raw':!![]})[_0x35a1('0x27')](function(_0xbac00){_0xbac00?_0x2687cb(_0x38d8c1):_0x2687cb();});}}catch(_0x12337b){_0x365f44(_0x12337b);}});}function getCustomDashboards(_0x57c7ff){var _0x5e735d=[];return new BPromise(function(_0x186cd5,_0x4dd2a2){try{if(_0x57c7ff[_0x35a1('0x57')]){return db[_0x35a1('0x66')][_0x35a1('0x45')]({'raw':!![]})[_0x35a1('0x27')](function(_0x497838){_0x497838['forEach'](function(_0x59ca9e){_0x5e735d[_0x35a1('0x5d')](_0x59ca9e['id']+0x1869f);});_0x186cd5(_0x5e735d);});}else{return db[_0x35a1('0x58')][_0x35a1('0x45')]({'where':{'sectionId':_0x57c7ff['id']},'raw':!![]})[_0x35a1('0x27')](function(_0x41eb9a){_0x41eb9a[_0x35a1('0x67')](function(_0x5af910){_0x5e735d[_0x35a1('0x5d')](_0x5af910[_0x35a1('0x68')]+0x1869f);});_0x186cd5(_0x5e735d);});}}catch(_0xe32c07){_0x4dd2a2(_0xe32c07);}});}function getPlugins(_0x10984e){var _0x2c08e9=[];return new BPromise(function(_0x5730dc,_0x142602){try{if(_0x10984e['autoAssociation']){return db[_0x35a1('0x69')][_0x35a1('0x45')]({'raw':!![]})[_0x35a1('0x27')](function(_0x563505){_0x563505[_0x35a1('0x67')](function(_0x4ca0f5){_0x2c08e9[_0x35a1('0x5d')](_0x4ca0f5['id']+0x15b38);});_0x5730dc(_0x2c08e9);});}else{return db[_0x35a1('0x58')][_0x35a1('0x45')]({'where':{'sectionId':_0x10984e['id']},'raw':!![]})[_0x35a1('0x27')](function(_0xb60e1){_0xb60e1[_0x35a1('0x67')](function(_0x22751b){_0x2c08e9[_0x35a1('0x5d')](_0x22751b['resourceId']+0x15b38);});_0x5730dc(_0x2c08e9);});}}catch(_0x5725d9){_0x142602(_0x5725d9);}});}exports['addResources']=function(_0xa5544e,_0x17fc3c){return db[_0x35a1('0x2f')][_0x35a1('0x49')]({'where':{'id':_0xa5544e[_0x35a1('0x47')]['id']}})['then'](handleEntityNotFound(_0x17fc3c,null))['then'](function(_0x2f6860){if(_0x2f6860){return db[_0x35a1('0x53')][_0x35a1('0x54')](function(_0x2010db){return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0xa5544e[_0x35a1('0x47')]['id']},'attributes':['id'],'raw':!![]})[_0x35a1('0x27')](function(_0x2bfce5){if(_0x2bfce5){return db[_0x35a1('0x55')][_0x35a1('0x28')]({'where':{'userProfileId':_0xa5544e[_0x35a1('0x47')]['id'],'id':_[_0x35a1('0x2e')](_0x2bfce5,function(_0x3605f5){return _0x3605f5['id'];})},'transaction':_0x2010db});}})[_0x35a1('0x27')](function(_0x6e5d1d){var _0x1fe465=_[_0x35a1('0x2e')](_0xa5544e[_0x35a1('0x51')],function(_0x6c1e15){_0x6c1e15[_0x35a1('0x5c')]=_0xa5544e[_0x35a1('0x47')]['id'];return _0x6c1e15;});return db['UserProfileSection'][_0x35a1('0x6a')](_0x1fe465,{'raw':!![],'transaction':_0x2010db});})[_0x35a1('0x27')](function(_0xf655f1){var _0x5eab4e=_[_0x35a1('0x40')](_[_0x35a1('0x2e')](_0xf655f1,function(_0x348c87){return _0x348c87[_0x35a1('0x4d')]({'plain':!![]});}),{'includeAll':![]});if(_0x5eab4e){return db['UserProfileSection'][_0x35a1('0x45')]({'where':{'userProfileId':_0xa5544e[_0x35a1('0x47')]['id'],'sectionId':_[_0x35a1('0x2e')](_0x5eab4e,function(_0x2788f1){return _0x2788f1['sectionId'];})},'attributes':['id',_0x35a1('0x59')],'raw':!![]})[_0x35a1('0x27')](function(_0x4dea99){var _0x234d1b=_['map'](_0xa5544e[_0x35a1('0x51')],function(_0x339bab){_0x339bab[_0x35a1('0x5c')]=_0xa5544e[_0x35a1('0x47')]['id'];return _0x339bab;});return db[_0x35a1('0x58')][_0x35a1('0x6a')](_0x234d1b,{'raw':!![],'transaction':_0x2010db});});}})[_0x35a1('0x4b')](handleError(_0x17fc3c,null));});}})[_0x35a1('0x27')](function(_0x3766db){var _0x36b65f=_[_0x35a1('0x2e')](_0x3766db,function(_0x28db5f){return _0x28db5f[_0x35a1('0x4d')]({'plain':!![]});});})[_0x35a1('0x27')](respondWithResult(_0x17fc3c,null))[_0x35a1('0x4b')](handleError(_0x17fc3c,null));};exports[_0x35a1('0x6b')]=function(_0xa94fd,_0x562db2,_0x326c33){return db['UserProfile'][_0x35a1('0x49')]({'where':{'id':_0xa94fd['params']['id']}})[_0x35a1('0x27')](handleEntityNotFound(_0x562db2,null))[_0x35a1('0x27')](function(_0x30b832){if(_0x30b832){return _0x30b832[_0x35a1('0x6b')](_0xa94fd[_0x35a1('0x38')][_0x35a1('0x5f')]);}})[_0x35a1('0x27')](respondWithStatusCode(_0x562db2,null))[_0x35a1('0x4b')](handleError(_0x562db2,null));};exports[_0x35a1('0x6c')]=function(_0x366512,_0x2b450b){var _0x4b995c={};if(!_0x366512[_0x35a1('0x38')][_0x35a1('0x6d')])throw new Error('Missing\x20section\x20parameter');if(!_0x366512['query'][_0x35a1('0x6e')](_0x35a1('0x6f'))){_0x4b995c[_0x35a1('0x22')]=qs['limit'](_0x366512[_0x35a1('0x38')]['limit']);_0x4b995c[_0x35a1('0x20')]=qs[_0x35a1('0x20')](_0x366512[_0x35a1('0x38')][_0x35a1('0x20')]);}return db[_0x35a1('0x2f')][_0x35a1('0x49')]({'where':{'id':_0x366512[_0x35a1('0x47')]['id']}})[_0x35a1('0x27')](function(_0x16baa2){if(!_0x16baa2)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x366512[_0x35a1('0x47')]['id']);return db[_0x35a1('0x2f')][_0x35a1('0x6c')](_0x366512);})['then'](respondWithFilteredResult(_0x2b450b,_0x4b995c))['catch'](handleError(_0x2b450b,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 47f8888..ed80480 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 _0xed5c=['remove','emit','exports','events','../../mysqldb','UserProfile','setMaxListeners','save','update'];(function(_0x3303fb,_0x1266dd){var _0x71a686=function(_0x2c7537){while(--_0x2c7537){_0x3303fb['push'](_0x3303fb['shift']());}};_0x71a686(++_0x1266dd);}(_0xed5c,0x81));var _0xced5=function(_0x1c5f65,_0x5ce2f5){_0x1c5f65=_0x1c5f65-0x0;var _0x45c60c=_0xed5c[_0x1c5f65];return _0x45c60c;};'use strict';var EventEmitter=require(_0xced5('0x0'));var UserProfile=require(_0xced5('0x1'))['db'][_0xced5('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xced5('0x3')](0x0);var events={'afterCreate':_0xced5('0x4'),'afterUpdate':_0xced5('0x5'),'afterDestroy':_0xced5('0x6')};function emitEvent(_0x395c27){return function(_0x2b8184,_0x2ec4f9,_0x583a62){UserProfileEvents[_0xced5('0x7')](_0x395c27+':'+_0x2b8184['id'],_0x2b8184);UserProfileEvents[_0xced5('0x7')](_0x395c27,_0x2b8184);_0x583a62(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0xced5('0x8')]=UserProfileEvents; \ No newline at end of file +var _0x853e=['../../mysqldb','setMaxListeners','update','emit','hasOwnProperty','hook','exports'];(function(_0x365838,_0x1d8abc){var _0x565e1e=function(_0x1f31a8){while(--_0x1f31a8){_0x365838['push'](_0x365838['shift']());}};_0x565e1e(++_0x1d8abc);}(_0x853e,0x1ea));var _0xe853=function(_0x211ae1,_0x337154){_0x211ae1=_0x211ae1-0x0;var _0x1085a3=_0x853e[_0x211ae1];return _0x1085a3;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0xe853('0x0'))['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xe853('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe853('0x2'),'afterDestroy':'remove'};function emitEvent(_0xf7b6da){return function(_0xbc2b15,_0x46c559,_0x44705d){UserProfileEvents[_0xe853('0x3')](_0xf7b6da+':'+_0xbc2b15['id'],_0xbc2b15);UserProfileEvents['emit'](_0xf7b6da,_0xbc2b15);_0x44705d(null);};}for(var e in events){if(events[_0xe853('0x4')](e)){var event=events[e];UserProfile[_0xe853('0x5')](e,emitEvent(event));}}module[_0xe853('0x6')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index f97ac72..1a2f89d 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 _0x3423=['keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','offset','order','sort','pick','merge','VIRTUAL','foreignKey','forEach','options','includeAll','DefaultReports','custom','rows','ids','count','Tags','color','tag','include','openTabs','true','chat','dataValues','mail','openchannel','whatsapp','../../components/parsers/qs','squel','exports','models','filter','field','value','findAll','then','map','model','associatedResources','name','catch','resolve','UserProfileResource','resourceId','type','toLowerCase','childModel','parentSections','projects','JscriptyProject','CmContact','Lists','lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','ChatQueue','ChatWebsite','faxqueues','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','voicerecordings','VoiceRecording','Agents','membername','User','role','Telephones','VoiceQueues','queue','VoiceQueue','inbound','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailAccount','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','whatsappaccounts','WhatsappAccount','teams','Team','queuecampaigns','QueueCampaigns','agents','telephones','Users','user','zendeskaccounts','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','deskaccounts','DeskAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','intervals','Interval','pauses','scheduler','Schedule','sounds','Sound','tags','Tag','triggers','Trunk','variables','Variable','plugins','Plugin','extractedreports','AnalyticExtractedReport','metrics','AnalyticMetric','charAt','Sequelize','SELECT','select','ui.','InteractionId','ui.createdAt','from','where','sequelize','query','toString','UserProfile','user_profiles','raw','section','Invalid\x20section\x20\x27','isEmpty','length','push','UserProfileSection','find','params','all','ignore','union','autoAssociation','rawAttributes'];(function(_0x483a38,_0x1ad5f2){var _0x3806db=function(_0x3e66fa){while(--_0x3e66fa){_0x483a38['push'](_0x483a38['shift']());}};_0x3806db(++_0x1ad5f2);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var attributes=require('./userProfile.attributes');var qs=require(_0x3342('0x0'));var squel=require(_0x3342('0x1'));module[_0x3342('0x2')]=function(_0x3b763d){var _0x21bdc2=_0x3b763d[_0x3342('0x3')];function _0x2207ce(_0x3c5d8d,_0x3075f8){return new Promise(function(_0x19206f,_0x467453){if(!_0x3075f8)return _0x19206f(null);var _0x2ccbe0=_0x3075f8[_0x3342('0x4')]?{[_0x3075f8[_0x3342('0x4')][_0x3342('0x5')]]:_0x3075f8[_0x3342('0x4')][_0x3342('0x6')]}:undefined;return _0x21bdc2[_0x3c5d8d][_0x3342('0x7')]({'where':_0x2ccbe0,'raw':!![]})[_0x3342('0x8')](function(_0x4ae4f3){_0x3075f8['associatedResources']=_[_0x3342('0x9')](_0x4ae4f3,'id');_0x19206f(_0x3075f8);})['catch'](function(_0x5a1fba){_0x467453(_0x5a1fba);});});}function _0x51b276(_0x4f85e3,_0xb11eb9){return new Promise(function(_0x2f3c47,_0x51496d){var _0x2d14c4=_0x4f85e3['filter']?{[_0x4f85e3[_0x3342('0x4')][_0x3342('0x5')]]:_0x4f85e3['filter'][_0x3342('0x6')]}:undefined;return _0x21bdc2[_0x4f85e3[_0x3342('0xa')]][_0x3342('0x7')]({'where':_0x2d14c4,'raw':!![]})[_0x3342('0x8')](function(_0x61fcc0){_0xb11eb9[_0x3342('0xb')]=_[_0x3342('0x9')](_0x61fcc0,function(_0x59be1d){return _0x59be1d[_0x3342('0xc')];});_0x2f3c47(_0xb11eb9);})[_0x3342('0xd')](function(_0x49afe3){_0x51496d(_0x49afe3);});});}function _0x40d609(_0x2c9df0,_0x51ef91,_0x554f9c){if(!_0x51ef91)return Promise[_0x3342('0xe')](null);return new Promise(function(_0x143cf1,_0x6949fc){return _0x21bdc2[_0x3342('0xf')][_0x3342('0x7')]({'where':{'sectionId':_0x51ef91['id']},'raw':!![]})[_0x3342('0x8')](function(_0x45a3ca){if(_0x2c9df0[_0x3342('0x5')]&&_0x2c9df0[_0x3342('0x5')]!=='id'){_0x51ef91['associatedResources']=_[_0x3342('0x9')](_0x45a3ca,function(_0xda235a){return _0xda235a[_0x2c9df0[_0x3342('0x5')]];});}else{if(_0x554f9c==='AnalyticExtractedReport'){_0x51ef91[_0x3342('0xb')]=_[_0x3342('0x9')](_0x45a3ca,function(_0x52f7b7){return{'id':_0x52f7b7[_0x3342('0x10')],'type':_0x52f7b7[_0x3342('0x11')]};});}else{_0x51ef91['associatedResources']=_[_0x3342('0x9')](_0x45a3ca,function(_0x5a0658){return _0x5a0658[_0x3342('0x10')];});}}_0x143cf1(_0x51ef91);})[_0x3342('0xd')](function(_0xa23053){_0x6949fc(_0xa23053);});});}function _0x2dbad1(_0xd2b87d,_0x2925a2){var _0x26eb87={'parentSections':[]};switch(_0xd2b87d[_0x3342('0x12')]()){case'squareprojects':_0x26eb87[_0x3342('0x13')]='SquareProject';break;case'odbc':_0x26eb87[_0x3342('0x13')]='SquareOdbc';break;case'squarerecordings':_0x26eb87[_0x3342('0x13')]='SquareRecording';_0x26eb87[_0x3342('0x14')]=[{'name':'SquareProjects','field':'name','foreignKey':'projectName'}];break;case _0x3342('0x15'):_0x26eb87[_0x3342('0x13')]=_0x3342('0x16');break;case'contacts':_0x26eb87[_0x3342('0x13')]=_0x3342('0x17');_0x26eb87[_0x3342('0x14')]=[{'name':_0x3342('0x18'),'field':'id','foreignKey':'ListId'}];break;case _0x3342('0x19'):_0x26eb87[_0x3342('0x13')]=_0x3342('0x1a');break;case _0x3342('0x1b'):_0x26eb87[_0x3342('0x13')]=_0x3342('0x1c');break;case _0x3342('0x1d'):_0x26eb87['childModel']=_0x3342('0x1e');break;case'chatqueues':_0x26eb87[_0x3342('0x13')]=_0x3342('0x1f');break;case'chatwebsites':_0x26eb87[_0x3342('0x13')]=_0x3342('0x20');break;case _0x3342('0x21'):_0x26eb87[_0x3342('0x13')]='FaxQueue';break;case _0x3342('0x22'):_0x26eb87[_0x3342('0x13')]=_0x3342('0x23');break;case _0x3342('0x24'):case _0x3342('0x25'):case _0x3342('0x26'):_0x26eb87[_0x3342('0x13')]=_0x3342('0x27');break;case _0x3342('0x28'):_0x26eb87[_0x3342('0x13')]=_0x3342('0x29');break;case _0x3342('0x2a'):_0x26eb87['childModel']='VoiceMail';break;case _0x3342('0x2b'):_0x26eb87['childModel']=_0x3342('0x2c');_0x26eb87[_0x3342('0x14')]=[{'name':_0x3342('0x2d'),'field':_0x3342('0xc'),'foreignKey':_0x3342('0x2e'),'model':_0x3342('0x2f'),'filter':{'field':_0x3342('0x30'),'value':['agent']}},{'name':_0x3342('0x31'),'field':_0x3342('0xc'),'foreignKey':_0x3342('0x2e'),'model':_0x3342('0x2f'),'filter':{'field':_0x3342('0x30'),'value':['telephone']}},{'name':_0x3342('0x32'),'field':'name','foreignKey':_0x3342('0x33'),'model':_0x3342('0x34'),'filter':{'field':_0x3342('0x11'),'value':[_0x3342('0x35')]}},{'name':'QueueCampaigns','field':_0x3342('0xc'),'foreignKey':'queue','model':_0x3342('0x34'),'filter':{'field':_0x3342('0x11'),'value':[_0x3342('0x36')]}}];break;case _0x3342('0x37'):_0x26eb87[_0x3342('0x13')]=_0x3342('0x38');break;case _0x3342('0x39'):_0x26eb87['childModel']=_0x3342('0x3a');break;case _0x3342('0x3b'):_0x26eb87['childModel']=_0x3342('0x3c');break;case _0x3342('0x3d'):_0x26eb87['childModel']=_0x3342('0x3e');break;case _0x3342('0x3f'):_0x26eb87['childModel']='MailQueue';break;case'mailaccounts':_0x26eb87[_0x3342('0x13')]=_0x3342('0x40');break;case'mailsubstatuses':_0x26eb87[_0x3342('0x13')]=_0x3342('0x41');break;case _0x3342('0x42'):_0x26eb87[_0x3342('0x13')]=_0x3342('0x43');break;case _0x3342('0x44'):_0x26eb87[_0x3342('0x13')]=_0x3342('0x45');break;case'smsqueues':_0x26eb87['childModel']=_0x3342('0x46');break;case _0x3342('0x47'):_0x26eb87[_0x3342('0x13')]=_0x3342('0x48');break;case _0x3342('0x49'):_0x26eb87[_0x3342('0x13')]='WhatsappQueue';break;case _0x3342('0x4a'):_0x26eb87[_0x3342('0x13')]=_0x3342('0x4b');break;case _0x3342('0x4c'):_0x26eb87[_0x3342('0x13')]=_0x3342('0x4d');break;case'voicequeues':case _0x3342('0x4e'):_0x26eb87['childModel']=_0x3342('0x34');if(_0x2925a2){_0x26eb87[_0x3342('0x14')]=[{'name':_0x3342('0x32')},{'name':_0x3342('0x4f')}];}break;case'users':case _0x3342('0x50'):case _0x3342('0x51'):_0x26eb87['childModel']=_0x3342('0x2f');if(_0x2925a2){_0x26eb87[_0x3342('0x14')]=[{'name':_0x3342('0x52'),'filter':{'field':_0x3342('0x30'),'value':['admin',_0x3342('0x53')]},'ignore':!![]},{'name':_0x3342('0x2d')},{'name':'Telephones'}];}break;case _0x3342('0x54'):_0x26eb87['childModel']='ZendeskAccount';break;case _0x3342('0x55'):_0x26eb87[_0x3342('0x13')]=_0x3342('0x56');break;case _0x3342('0x57'):_0x26eb87[_0x3342('0x13')]=_0x3342('0x58');break;case _0x3342('0x59'):_0x26eb87['childModel']='SugarcrmAccount';break;case _0x3342('0x5a'):_0x26eb87['childModel']=_0x3342('0x5b');break;case'zohoaccounts':_0x26eb87['childModel']='ZohoAccount';break;case _0x3342('0x5c'):_0x26eb87[_0x3342('0x13')]=_0x3342('0x2f');break;case _0x3342('0x5d'):_0x26eb87['childModel']=_0x3342('0x5e');break;case _0x3342('0x5f'):_0x26eb87['childModel']=_0x3342('0x60');break;case _0x3342('0x61'):_0x26eb87[_0x3342('0x13')]='Dashboard';break;case _0x3342('0x62'):_0x26eb87[_0x3342('0x13')]=_0x3342('0x63');break;case _0x3342('0x64'):_0x26eb87[_0x3342('0x13')]='Pause';break;case _0x3342('0x65'):_0x26eb87[_0x3342('0x13')]=_0x3342('0x66');break;case _0x3342('0x67'):_0x26eb87[_0x3342('0x13')]=_0x3342('0x68');break;case _0x3342('0x69'):_0x26eb87[_0x3342('0x13')]=_0x3342('0x6a');break;case'templates':_0x26eb87[_0x3342('0x13')]='Template';break;case _0x3342('0x6b'):_0x26eb87['childModel']='Trigger';break;case'trunks':_0x26eb87['childModel']=_0x3342('0x6c');break;case _0x3342('0x6d'):_0x26eb87[_0x3342('0x13')]=_0x3342('0x6e');break;case _0x3342('0x6f'):_0x26eb87[_0x3342('0x13')]=_0x3342('0x70');break;case _0x3342('0x71'):_0x26eb87[_0x3342('0x13')]=_0x3342('0x72');_0x26eb87[_0x3342('0x14')]=[{'name':'Reports','field':'id','foreignKey':'reportId'}];break;case _0x3342('0x73'):_0x26eb87['childModel']=_0x3342('0x74');break;}return _0x26eb87;}function _0x59964b(_0x4c777e,_0x44faea){var _0x43d39f=_0x4c777e[_0x3342('0x75')](0x0)['toUpperCase']()+_0x4c777e['slice'](0x1);var _0x54b41d={'type':_0x21bdc2[_0x3342('0x76')]['QueryTypes'][_0x3342('0x77')],'raw':!![]};return new Promise(function(_0x219a17,_0x372af5){var _0x4d3660=squel[_0x3342('0x78')]()[_0x3342('0x5')](_0x3342('0x79')+_0x43d39f+_0x3342('0x7a'),'id')[_0x3342('0x5')](_0x3342('0x7b'))[_0x3342('0x7c')]('user_has_'+_0x4c777e+'_interactions','ui')[_0x3342('0x7d')]('ui.UserId\x20=\x20?',_0x44faea['id']);return _0x21bdc2[_0x3342('0x7e')][_0x3342('0x7f')](_0x4d3660[_0x3342('0x80')](),_0x54b41d)[_0x3342('0x8')](function(_0xe9b979){_0x44faea[_0x43d39f+'OpenTabs']=_0xe9b979;_0x219a17(_0xe9b979);})[_0x3342('0xd')](function(_0x3f2fcb){_0x372af5(_0x3f2fcb);});});}return _0x3b763d['define'](_0x3342('0x81'),attributes,{'tableName':_0x3342('0x82'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x10842c){var _0x2858a6={'raw':_0x10842c[_0x3342('0x7f')][_0x3342('0x83')],'where':{}};var _0x19fcc5={};var _0x2f6a48={'count':0x0,'rows':[]};var _0x16c3f3=_0x10842c[_0x3342('0x7f')][_0x3342('0x84')];var _0x28bbfa=_0x10842c[_0x3342('0x7f')]['mergeResources']||![];var _0x5c9399=_0x2dbad1(_0x16c3f3,_0x28bbfa);if(!_0x5c9399[_0x3342('0x13')])throw new Error(_0x3342('0x85')+_0x16c3f3+'\x27');var _0x14193b=[{'name':_0x16c3f3}];if(!_[_0x3342('0x86')](_0x5c9399['parentSections']))_0x14193b=_0x5c9399['parentSections'];var _0x3310ac=[];for(var _0x18751b=0x0;_0x18751b<_0x14193b[_0x3342('0x87')];_0x18751b++){_0x3310ac[_0x3342('0x88')](_0x21bdc2[_0x3342('0x89')][_0x3342('0x8a')]({'where':{'userProfileId':_0x10842c[_0x3342('0x8b')]['id'],'name':_0x14193b[_0x18751b][_0x3342('0xc')]},'raw':!![]}));}return Promise[_0x3342('0x8c')](_0x3310ac)[_0x3342('0x8')](function(_0x4887d4){var _0x3392a2=_['filter'](_0x4887d4,function(_0x1c5d7d){return _0x1c5d7d?_0x1c5d7d:undefined;});var _0xba7c0e=_['filter'](_0x14193b,[_0x3342('0x8d'),!![]]);var _0x3506d4=_['isEmpty'](_0x3392a2)&&_[_0x3342('0x86')](_0xba7c0e)?null:_[_0x3342('0x8e')](_0xba7c0e,_0x3392a2);if(!_0x3506d4)return null;var _0x1e3353=[];for(var _0x466e06=0x0;_0x466e06<_0x3506d4[_0x3342('0x87')];_0x466e06++){var _0x42bc3b=_[_0x3342('0x8a')](_0x14193b,function(_0x57b8ac){return _0x3506d4[_0x466e06]?_0x57b8ac[_0x3342('0xc')]===_0x3506d4[_0x466e06]['name']:null;});if(_0x42bc3b){if(_0x3506d4[_0x466e06]['ignore']){_0x1e3353[_0x3342('0x88')](_0x2207ce(_0x5c9399[_0x3342('0x13')],_0x3506d4[_0x466e06]));}else{if(!_0x3506d4[_0x466e06][_0x3342('0x8f')]){_0x1e3353[_0x3342('0x88')](_0x40d609(_0x42bc3b,_0x3506d4[_0x466e06],_0x5c9399[_0x3342('0x13')]));}else{if(_0x42bc3b[_0x3342('0xa')]){_0x1e3353[_0x3342('0x88')](_0x51b276(_0x42bc3b,_0x3506d4[_0x466e06]));}}}}}return Promise[_0x3342('0x8c')](_0x1e3353);})['then'](function(_0x3c8fd5){var _0x2766e8=_0x3c8fd5;var _0x2cfbee=null;if(_0x2766e8){_0x2cfbee=_0x2766e8[_0x3342('0x87')]===0x1?_0x2766e8[0x0]:null;}if(!_0x2cfbee&&!_0x2766e8)return _0x2f6a48;var _0x3c151b=_0x21bdc2[_0x5c9399[_0x3342('0x13')]][_0x3342('0x90')];_0x19fcc5['model']=_[_0x3342('0x91')](_0x3c151b);_0x19fcc5[_0x3342('0x7f')]=_[_0x3342('0x91')](_0x10842c[_0x3342('0x7f')]);_0x19fcc5[_0x3342('0x92')]=_[_0x3342('0x93')](_0x19fcc5['model'],_0x19fcc5['query']);_0x2858a6['attributes']=_[_0x3342('0x93')](_0x19fcc5[_0x3342('0xa')],qs[_0x3342('0x94')](_0x10842c[_0x3342('0x7f')][_0x3342('0x94')]));_0x2858a6[_0x3342('0x95')]=_0x2858a6[_0x3342('0x95')][_0x3342('0x87')]?_0x2858a6['attributes']:_0x19fcc5[_0x3342('0xa')];if(!_0x10842c[_0x3342('0x7f')][_0x3342('0x96')](_0x3342('0x97'))){_0x2858a6['limit']=qs[_0x3342('0x98')](_0x10842c[_0x3342('0x7f')][_0x3342('0x98')]);_0x2858a6[_0x3342('0x99')]=qs[_0x3342('0x99')](_0x10842c[_0x3342('0x7f')][_0x3342('0x99')]);}_0x2858a6[_0x3342('0x9a')]=qs[_0x3342('0x9b')](_0x10842c['query'][_0x3342('0x9b')]);_0x2858a6[_0x3342('0x7d')]=qs['filters'](_[_0x3342('0x9c')](_0x10842c['query'],_0x19fcc5[_0x3342('0x92')]));if(_0x10842c['query'][_0x3342('0x4')]){_0x2858a6['where']=_[_0x3342('0x9d')](_0x2858a6[_0x3342('0x7d')],{'$or':_['map'](_0x3c151b,function(_0x3a24b7){if(_0x3a24b7[_0x3342('0x11')]['key']!==_0x3342('0x9e')){var _0x24c9ef={};_0x24c9ef[_0x3a24b7[_0x3342('0x5')]]={'$like':'%'+_0x10842c[_0x3342('0x7f')][_0x3342('0x4')]+'%'};return _0x24c9ef;}})});}var _0x1d58cb=[];var _0x5cb6c5=null;var _0x29a7a1={};if(_0x2cfbee){_0x5cb6c5=_[_0x3342('0x8a')](_0x14193b,[_0x3342('0xc'),_0x2cfbee[_0x3342('0xc')]]);if(_0x5cb6c5[_0x3342('0x5')]){_0x29a7a1={};if(_0x5c9399[_0x3342('0x13')]===_0x3342('0x72')){_0x29a7a1[_0x5cb6c5[_0x3342('0x9f')]]=_[_0x3342('0x9')](_0x2cfbee[_0x3342('0xb')],'id');}else{_0x29a7a1[_0x5cb6c5['foreignKey']]=_0x2cfbee[_0x3342('0xb')];}_0x1d58cb[_0x3342('0x88')](_0x29a7a1);}else{_0x2858a6[_0x3342('0x7d')]['id']=_0x2cfbee['associatedResources'];}}else{for(var _0x5ef689=0x0;_0x5ef689<_0x2766e8[_0x3342('0x87')];_0x5ef689++){_0x5cb6c5=_['find'](_0x14193b,['name',_0x2766e8[_0x5ef689][_0x3342('0xc')]]);if(_0x5cb6c5[_0x3342('0x5')]){_0x29a7a1={};_0x29a7a1[_0x5cb6c5['foreignKey']]=_0x2766e8[_0x5ef689][_0x3342('0xb')];_0x1d58cb['push'](_0x29a7a1);}else{if(!_0x2858a6[_0x3342('0x7d')]['id'])_0x2858a6['where']['id']=[];_0x2766e8[_0x5ef689]['associatedResources'][_0x3342('0xa0')](function(_0x2d3f3e){_0x2858a6[_0x3342('0x7d')]['id']['push'](_0x2d3f3e);});}}}if(!_['isEmpty'](_0x1d58cb)){_0x2858a6[_0x3342('0x7d')]=_['merge'](_0x2858a6[_0x3342('0x7d')],{'$and':{'$or':_0x1d58cb}});}_0x2858a6=_[_0x3342('0x9d')]({},_0x2858a6,_0x10842c[_0x3342('0xa1')]);if(_0x2cfbee&&!_0x2cfbee[_0x3342('0x8f')]&&_0x5c9399['childModel']==='AnalyticExtractedReport'){if(_0x10842c[_0x3342('0x7f')][_0x3342('0xa2')]){_0x2858a6['include']=[{'all':!![]}];}return _0x21bdc2[_0x5c9399[_0x3342('0x13')]]['findAll'](_0x2858a6)[_0x3342('0x8')](function(_0x21a2bc){var _0x45899e=[];_0x21a2bc[_0x3342('0xa0')](function(_0x22b415){var _0x5e368f;switch(_0x22b415['reportType']){case'default':_0x5e368f=_[_0x3342('0x8a')](_0x2cfbee[_0x3342('0xb')],function(_0x3aaf86){return _0x3aaf86['id']===_0x22b415['reportId']&&_0x3aaf86[_0x3342('0x11')]===_0x3342('0xa3');});break;case _0x3342('0xa4'):_0x5e368f=_[_0x3342('0x8a')](_0x2cfbee[_0x3342('0xb')],function(_0x2355c0){return _0x2355c0['id']===_0x22b415['reportId']&&_0x2355c0[_0x3342('0x11')]==='CustomReports';});break;}if(_0x5e368f)_0x45899e['push'](_0x22b415);});_0x2f6a48['count']=_0x45899e[_0x3342('0x87')];_0x2f6a48[_0x3342('0xa5')]=_0x45899e;return _0x2f6a48;});}else{if(!_['isEmpty'](_0x10842c[_0x3342('0x7f')][_0x3342('0xa6')])){_0x2858a6['where']['id']=_0x2858a6[_0x3342('0x7d')]['id']?_[_0x3342('0x93')](_0x2858a6[_0x3342('0x7d')]['id'],_0x10842c[_0x3342('0x7f')][_0x3342('0xa6')]):_0x10842c[_0x3342('0x7f')][_0x3342('0xa6')];}return _0x21bdc2[_0x5c9399[_0x3342('0x13')]]['count']({'where':_0x2858a6[_0x3342('0x7d')]})[_0x3342('0x8')](function(_0x13738c){_0x2f6a48[_0x3342('0xa7')]=_0x13738c;if(_0x10842c[_0x3342('0x7f')][_0x3342('0xa2')]){if(_0x5c9399[_0x3342('0x13')]==='CmContact'){_0x2858a6['include']=[{'model':_0x21bdc2[_0x3342('0x6a')],'as':_0x3342('0xa8'),'attributes':['id',_0x3342('0xc'),_0x3342('0xa9')],'required':_0x10842c[_0x3342('0x7f')][_0x3342('0xaa')]?!![]:![]},{'model':_0x21bdc2[_0x3342('0x6a')],'as':'ThroughTags','attributes':['id',_0x3342('0xc'),_0x3342('0xa9')],'through':_0x10842c[_0x3342('0x7f')][_0x3342('0xaa')]?{'attributes':[],'where':{'TagId':_0x10842c[_0x3342('0x7f')]['tag']||undefined}}:{},'required':_0x10842c[_0x3342('0x7f')][_0x3342('0xaa')]?!![]:![]}];}else{_0x2858a6[_0x3342('0xab')]=[{'all':!![]}];}}return _0x21bdc2[_0x5c9399[_0x3342('0x13')]]['findAll'](_0x2858a6);})[_0x3342('0x8')](function(_0x250317){_0x2f6a48[_0x3342('0xa5')]=_0x250317;if(_0x16c3f3===_0x3342('0x2d')&&_0x10842c[_0x3342('0x7f')][_0x3342('0xac')]===_0x3342('0xad')){var _0x5ccbc6=[];for(var _0x53a9e1=0x0;_0x53a9e1<_0x2f6a48[_0x3342('0xa5')]['length'];_0x53a9e1++){_0x5ccbc6[_0x3342('0x88')](_0x59964b(_0x3342('0xae'),_0x2f6a48[_0x3342('0xa5')][_0x53a9e1][_0x3342('0xaf')]));_0x5ccbc6[_0x3342('0x88')](_0x59964b('sms',_0x2f6a48[_0x3342('0xa5')][_0x53a9e1][_0x3342('0xaf')]));_0x5ccbc6[_0x3342('0x88')](_0x59964b('fax',_0x2f6a48['rows'][_0x53a9e1][_0x3342('0xaf')]));_0x5ccbc6[_0x3342('0x88')](_0x59964b(_0x3342('0xb0'),_0x2f6a48[_0x3342('0xa5')][_0x53a9e1][_0x3342('0xaf')]));_0x5ccbc6[_0x3342('0x88')](_0x59964b(_0x3342('0xb1'),_0x2f6a48[_0x3342('0xa5')][_0x53a9e1][_0x3342('0xaf')]));_0x5ccbc6[_0x3342('0x88')](_0x59964b(_0x3342('0xb2'),_0x2f6a48[_0x3342('0xa5')][_0x53a9e1]['dataValues']));}return Promise['all'](_0x5ccbc6)['then'](function(){return _0x2f6a48;});}return _0x2f6a48;});}});}}});}; \ No newline at end of file +var _0x8f4c=['zendeskaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','intervals','Interval','pauses','Pause','Schedule','sounds','tags','triggers','Trigger','trunks','Trunk','variables','Variable','plugins','extractedreports','reportId','AnalyticMetric','charAt','Sequelize','QueryTypes','SELECT','ui.','ui.createdAt','from','user_has_','_interactions','where','ui.UserId\x20=\x20?','query','toString','OpenTabs','define','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','push','find','params','all','ignore','union','autoAssociation','keys','filters','intersection','attributes','fields','nolimit','limit','order','sort','pick','merge','key','VIRTUAL','forEach','options','includeAll','include','reportType','default','CustomReports','count','rows','ids','Tag','Tags','color','tag','ThroughTags','openTabs','true','chat','dataValues','sms','fax','mail','whatsapp','lodash','./userProfile.attributes','../../components/parsers/qs','squel','exports','models','filter','value','findAll','then','map','catch','field','model','associatedResources','name','UserProfileResource','AnalyticExtractedReport','resourceId','type','toLowerCase','childModel','odbc','squarerecordings','SquareRecording','parentSections','projectName','JscriptyProject','contacts','CmContact','ListId','lists','companies','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','inboundroutes','internalroutes','VoiceExtension','contexts','VoiceContext','voicemails','voicerecordings','VoiceRecording','Agents','membername','User','role','agent','Telephones','telephone','VoiceQueue','inbound','QueueCampaigns','queue','outbound','VoiceMusicOnHold','chanspies','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','MailSubstatus','openchannelqueues','OpenchannelAccount','SmsQueue','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','Team','voicequeues','users','agents','telephones','Users'];(function(_0x43ed1c,_0x53c4dd){var _0x5d3583=function(_0x20a20f){while(--_0x20a20f){_0x43ed1c['push'](_0x43ed1c['shift']());}};_0x5d3583(++_0x53c4dd);}(_0x8f4c,0x113));var _0xc8f4=function(_0x5a4b2b,_0x210f4e){_0x5a4b2b=_0x5a4b2b-0x0;var _0x290f97=_0x8f4c[_0x5a4b2b];return _0x290f97;};'use strict';var _=require(_0xc8f4('0x0'));var attributes=require(_0xc8f4('0x1'));var qs=require(_0xc8f4('0x2'));var squel=require(_0xc8f4('0x3'));module[_0xc8f4('0x4')]=function(_0x134d73){var _0x580083=_0x134d73[_0xc8f4('0x5')];function _0x47350d(_0x133764,_0x56c9b1){return new Promise(function(_0x32cd80,_0x5208da){if(!_0x56c9b1)return _0x32cd80(null);var _0x4c86f8=_0x56c9b1['filter']?{[_0x56c9b1[_0xc8f4('0x6')]['field']]:_0x56c9b1[_0xc8f4('0x6')][_0xc8f4('0x7')]}:undefined;return _0x580083[_0x133764][_0xc8f4('0x8')]({'where':_0x4c86f8,'raw':!![]})[_0xc8f4('0x9')](function(_0x34f05f){_0x56c9b1['associatedResources']=_[_0xc8f4('0xa')](_0x34f05f,'id');_0x32cd80(_0x56c9b1);})[_0xc8f4('0xb')](function(_0x2fba62){_0x5208da(_0x2fba62);});});}function _0x3a2f8a(_0x4fd453,_0x26f83){return new Promise(function(_0x52c699,_0x430009){var _0xf07a92=_0x4fd453[_0xc8f4('0x6')]?{[_0x4fd453[_0xc8f4('0x6')][_0xc8f4('0xc')]]:_0x4fd453['filter'][_0xc8f4('0x7')]}:undefined;return _0x580083[_0x4fd453[_0xc8f4('0xd')]][_0xc8f4('0x8')]({'where':_0xf07a92,'raw':!![]})[_0xc8f4('0x9')](function(_0x1dcee5){_0x26f83[_0xc8f4('0xe')]=_['map'](_0x1dcee5,function(_0x2bce00){return _0x2bce00[_0xc8f4('0xf')];});_0x52c699(_0x26f83);})[_0xc8f4('0xb')](function(_0x46ac15){_0x430009(_0x46ac15);});});}function _0x22c08a(_0x56a25d,_0xac45d5,_0x4d2b77){if(!_0xac45d5)return Promise['resolve'](null);return new Promise(function(_0x14bc02,_0x225b76){return _0x580083[_0xc8f4('0x10')][_0xc8f4('0x8')]({'where':{'sectionId':_0xac45d5['id']},'raw':!![]})[_0xc8f4('0x9')](function(_0x374761){if(_0x56a25d[_0xc8f4('0xc')]&&_0x56a25d[_0xc8f4('0xc')]!=='id'){_0xac45d5[_0xc8f4('0xe')]=_[_0xc8f4('0xa')](_0x374761,function(_0x3cd90c){return _0x3cd90c[_0x56a25d[_0xc8f4('0xc')]];});}else{if(_0x4d2b77===_0xc8f4('0x11')){_0xac45d5['associatedResources']=_[_0xc8f4('0xa')](_0x374761,function(_0x5c520){return{'id':_0x5c520[_0xc8f4('0x12')],'type':_0x5c520[_0xc8f4('0x13')]};});}else{_0xac45d5[_0xc8f4('0xe')]=_[_0xc8f4('0xa')](_0x374761,function(_0xaeee7d){return _0xaeee7d[_0xc8f4('0x12')];});}}_0x14bc02(_0xac45d5);})['catch'](function(_0x4463aa){_0x225b76(_0x4463aa);});});}function _0x205c41(_0x3195ff,_0x1d159e){var _0x5d54a9={'parentSections':[]};switch(_0x3195ff[_0xc8f4('0x14')]()){case'squareprojects':_0x5d54a9[_0xc8f4('0x15')]='SquareProject';break;case _0xc8f4('0x16'):_0x5d54a9[_0xc8f4('0x15')]='SquareOdbc';break;case _0xc8f4('0x17'):_0x5d54a9[_0xc8f4('0x15')]=_0xc8f4('0x18');_0x5d54a9[_0xc8f4('0x19')]=[{'name':'SquareProjects','field':_0xc8f4('0xf'),'foreignKey':_0xc8f4('0x1a')}];break;case'projects':_0x5d54a9[_0xc8f4('0x15')]=_0xc8f4('0x1b');break;case _0xc8f4('0x1c'):_0x5d54a9[_0xc8f4('0x15')]=_0xc8f4('0x1d');_0x5d54a9[_0xc8f4('0x19')]=[{'name':'Lists','field':'id','foreignKey':_0xc8f4('0x1e')}];break;case _0xc8f4('0x1f'):_0x5d54a9[_0xc8f4('0x15')]='CmList';break;case _0xc8f4('0x20'):_0x5d54a9[_0xc8f4('0x15')]='CmCompany';break;case'globalcustomfields':_0x5d54a9['childModel']=_0xc8f4('0x21');break;case _0xc8f4('0x22'):_0x5d54a9[_0xc8f4('0x15')]=_0xc8f4('0x23');break;case _0xc8f4('0x24'):_0x5d54a9[_0xc8f4('0x15')]=_0xc8f4('0x25');break;case _0xc8f4('0x26'):_0x5d54a9['childModel']=_0xc8f4('0x27');break;case _0xc8f4('0x28'):_0x5d54a9[_0xc8f4('0x15')]='FaxAccount';break;case _0xc8f4('0x29'):case _0xc8f4('0x2a'):case'outboundroutes':_0x5d54a9[_0xc8f4('0x15')]=_0xc8f4('0x2b');break;case _0xc8f4('0x2c'):_0x5d54a9['childModel']=_0xc8f4('0x2d');break;case _0xc8f4('0x2e'):_0x5d54a9[_0xc8f4('0x15')]='VoiceMail';break;case _0xc8f4('0x2f'):_0x5d54a9[_0xc8f4('0x15')]=_0xc8f4('0x30');_0x5d54a9[_0xc8f4('0x19')]=[{'name':_0xc8f4('0x31'),'field':_0xc8f4('0xf'),'foreignKey':_0xc8f4('0x32'),'model':_0xc8f4('0x33'),'filter':{'field':_0xc8f4('0x34'),'value':[_0xc8f4('0x35')]}},{'name':_0xc8f4('0x36'),'field':_0xc8f4('0xf'),'foreignKey':_0xc8f4('0x32'),'model':_0xc8f4('0x33'),'filter':{'field':_0xc8f4('0x34'),'value':[_0xc8f4('0x37')]}},{'name':'VoiceQueues','field':_0xc8f4('0xf'),'foreignKey':'queue','model':_0xc8f4('0x38'),'filter':{'field':'type','value':[_0xc8f4('0x39')]}},{'name':_0xc8f4('0x3a'),'field':_0xc8f4('0xf'),'foreignKey':_0xc8f4('0x3b'),'model':_0xc8f4('0x38'),'filter':{'field':_0xc8f4('0x13'),'value':[_0xc8f4('0x3c')]}}];break;case'musiconholds':_0x5d54a9[_0xc8f4('0x15')]=_0xc8f4('0x3d');break;case _0xc8f4('0x3e'):_0x5d54a9[_0xc8f4('0x15')]='VoiceChanSpy';break;case _0xc8f4('0x3f'):_0x5d54a9[_0xc8f4('0x15')]=_0xc8f4('0x40');break;case _0xc8f4('0x41'):_0x5d54a9[_0xc8f4('0x15')]=_0xc8f4('0x42');break;case _0xc8f4('0x43'):_0x5d54a9[_0xc8f4('0x15')]=_0xc8f4('0x44');break;case _0xc8f4('0x45'):_0x5d54a9[_0xc8f4('0x15')]=_0xc8f4('0x46');break;case'mailsubstatuses':_0x5d54a9[_0xc8f4('0x15')]=_0xc8f4('0x47');break;case _0xc8f4('0x48'):_0x5d54a9[_0xc8f4('0x15')]='OpenchannelQueue';break;case'openchannelaccounts':_0x5d54a9[_0xc8f4('0x15')]=_0xc8f4('0x49');break;case'smsqueues':_0x5d54a9[_0xc8f4('0x15')]=_0xc8f4('0x4a');break;case'smsaccounts':_0x5d54a9['childModel']=_0xc8f4('0x4b');break;case _0xc8f4('0x4c'):_0x5d54a9[_0xc8f4('0x15')]=_0xc8f4('0x4d');break;case _0xc8f4('0x4e'):_0x5d54a9[_0xc8f4('0x15')]='WhatsappAccount';break;case'teams':_0x5d54a9[_0xc8f4('0x15')]=_0xc8f4('0x4f');break;case _0xc8f4('0x50'):case'queuecampaigns':_0x5d54a9['childModel']='VoiceQueue';if(_0x1d159e){_0x5d54a9['parentSections']=[{'name':'VoiceQueues'},{'name':_0xc8f4('0x3a')}];}break;case _0xc8f4('0x51'):case _0xc8f4('0x52'):case _0xc8f4('0x53'):_0x5d54a9[_0xc8f4('0x15')]=_0xc8f4('0x33');if(_0x1d159e){_0x5d54a9['parentSections']=[{'name':_0xc8f4('0x54'),'filter':{'field':_0xc8f4('0x34'),'value':['admin','user']},'ignore':!![]},{'name':_0xc8f4('0x31')},{'name':_0xc8f4('0x36')}];}break;case _0xc8f4('0x55'):_0x5d54a9[_0xc8f4('0x15')]='ZendeskAccount';break;case'salesforceaccounts':_0x5d54a9[_0xc8f4('0x15')]=_0xc8f4('0x56');break;case _0xc8f4('0x57'):_0x5d54a9[_0xc8f4('0x15')]=_0xc8f4('0x58');break;case _0xc8f4('0x59'):_0x5d54a9['childModel']='SugarcrmAccount';break;case _0xc8f4('0x5a'):_0x5d54a9[_0xc8f4('0x15')]=_0xc8f4('0x5b');break;case _0xc8f4('0x5c'):_0x5d54a9[_0xc8f4('0x15')]=_0xc8f4('0x5d');break;case _0xc8f4('0x5e'):_0x5d54a9[_0xc8f4('0x15')]=_0xc8f4('0x33');break;case'cannedanswers':_0x5d54a9['childModel']=_0xc8f4('0x5f');break;case _0xc8f4('0x60'):_0x5d54a9[_0xc8f4('0x15')]=_0xc8f4('0x61');break;case _0xc8f4('0x62'):_0x5d54a9[_0xc8f4('0x15')]=_0xc8f4('0x63');break;case _0xc8f4('0x64'):_0x5d54a9[_0xc8f4('0x15')]=_0xc8f4('0x65');break;case _0xc8f4('0x66'):_0x5d54a9[_0xc8f4('0x15')]=_0xc8f4('0x67');break;case'scheduler':_0x5d54a9[_0xc8f4('0x15')]=_0xc8f4('0x68');break;case _0xc8f4('0x69'):_0x5d54a9[_0xc8f4('0x15')]='Sound';break;case _0xc8f4('0x6a'):_0x5d54a9[_0xc8f4('0x15')]='Tag';break;case'templates':_0x5d54a9[_0xc8f4('0x15')]='Template';break;case _0xc8f4('0x6b'):_0x5d54a9[_0xc8f4('0x15')]=_0xc8f4('0x6c');break;case _0xc8f4('0x6d'):_0x5d54a9[_0xc8f4('0x15')]=_0xc8f4('0x6e');break;case _0xc8f4('0x6f'):_0x5d54a9[_0xc8f4('0x15')]=_0xc8f4('0x70');break;case _0xc8f4('0x71'):_0x5d54a9[_0xc8f4('0x15')]='Plugin';break;case _0xc8f4('0x72'):_0x5d54a9[_0xc8f4('0x15')]=_0xc8f4('0x11');_0x5d54a9[_0xc8f4('0x19')]=[{'name':'Reports','field':'id','foreignKey':_0xc8f4('0x73')}];break;case'metrics':_0x5d54a9['childModel']=_0xc8f4('0x74');break;}return _0x5d54a9;}function _0x451a3e(_0x192bbc,_0x39cb77){var _0x2bfb92=_0x192bbc[_0xc8f4('0x75')](0x0)['toUpperCase']()+_0x192bbc['slice'](0x1);var _0x45fb1a={'type':_0x580083[_0xc8f4('0x76')][_0xc8f4('0x77')][_0xc8f4('0x78')],'raw':!![]};return new Promise(function(_0x25369e,_0x19a024){var _0x443148=squel['select']()[_0xc8f4('0xc')](_0xc8f4('0x79')+_0x2bfb92+'InteractionId','id')[_0xc8f4('0xc')](_0xc8f4('0x7a'))[_0xc8f4('0x7b')](_0xc8f4('0x7c')+_0x192bbc+_0xc8f4('0x7d'),'ui')[_0xc8f4('0x7e')](_0xc8f4('0x7f'),_0x39cb77['id']);return _0x580083['sequelize'][_0xc8f4('0x80')](_0x443148[_0xc8f4('0x81')](),_0x45fb1a)['then'](function(_0x52e295){_0x39cb77[_0x2bfb92+_0xc8f4('0x82')]=_0x52e295;_0x25369e(_0x52e295);})['catch'](function(_0x281b3a){_0x19a024(_0x281b3a);});});}return _0x134d73[_0xc8f4('0x83')]('UserProfile',attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x57ad51){var _0x490b8b={'raw':_0x57ad51['query']['raw'],'where':{}};var _0x32665c={};var _0x51612f={'count':0x0,'rows':[]};var _0x17e9d1=_0x57ad51[_0xc8f4('0x80')][_0xc8f4('0x84')];var _0x29231d=_0x57ad51['query'][_0xc8f4('0x85')]||![];var _0x329c26=_0x205c41(_0x17e9d1,_0x29231d);if(!_0x329c26[_0xc8f4('0x15')])throw new Error(_0xc8f4('0x86')+_0x17e9d1+'\x27');var _0x4ae72e=[{'name':_0x17e9d1}];if(!_[_0xc8f4('0x87')](_0x329c26[_0xc8f4('0x19')]))_0x4ae72e=_0x329c26[_0xc8f4('0x19')];var _0x3761cc=[];for(var _0x4dc1e5=0x0;_0x4dc1e5<_0x4ae72e[_0xc8f4('0x88')];_0x4dc1e5++){_0x3761cc[_0xc8f4('0x89')](_0x580083['UserProfileSection'][_0xc8f4('0x8a')]({'where':{'userProfileId':_0x57ad51[_0xc8f4('0x8b')]['id'],'name':_0x4ae72e[_0x4dc1e5][_0xc8f4('0xf')]},'raw':!![]}));}return Promise[_0xc8f4('0x8c')](_0x3761cc)[_0xc8f4('0x9')](function(_0x239e4d){var _0x5362c8=_[_0xc8f4('0x6')](_0x239e4d,function(_0x269766){return _0x269766?_0x269766:undefined;});var _0x3d493c=_['filter'](_0x4ae72e,[_0xc8f4('0x8d'),!![]]);var _0x2b6510=_[_0xc8f4('0x87')](_0x5362c8)&&_['isEmpty'](_0x3d493c)?null:_[_0xc8f4('0x8e')](_0x3d493c,_0x5362c8);if(!_0x2b6510)return null;var _0x38a486=[];for(var _0x482cfd=0x0;_0x482cfd<_0x2b6510[_0xc8f4('0x88')];_0x482cfd++){var _0x5bf089=_[_0xc8f4('0x8a')](_0x4ae72e,function(_0x9996da){return _0x2b6510[_0x482cfd]?_0x9996da['name']===_0x2b6510[_0x482cfd][_0xc8f4('0xf')]:null;});if(_0x5bf089){if(_0x2b6510[_0x482cfd][_0xc8f4('0x8d')]){_0x38a486['push'](_0x47350d(_0x329c26[_0xc8f4('0x15')],_0x2b6510[_0x482cfd]));}else{if(!_0x2b6510[_0x482cfd][_0xc8f4('0x8f')]){_0x38a486[_0xc8f4('0x89')](_0x22c08a(_0x5bf089,_0x2b6510[_0x482cfd],_0x329c26[_0xc8f4('0x15')]));}else{if(_0x5bf089[_0xc8f4('0xd')]){_0x38a486[_0xc8f4('0x89')](_0x3a2f8a(_0x5bf089,_0x2b6510[_0x482cfd]));}}}}}return Promise[_0xc8f4('0x8c')](_0x38a486);})[_0xc8f4('0x9')](function(_0x5a6cfe){var _0x2d363c=_0x5a6cfe;var _0x3adcdb=null;if(_0x2d363c){_0x3adcdb=_0x2d363c[_0xc8f4('0x88')]===0x1?_0x2d363c[0x0]:null;}if(!_0x3adcdb&&!_0x2d363c)return _0x51612f;var _0xd85d11=_0x580083[_0x329c26[_0xc8f4('0x15')]]['rawAttributes'];_0x32665c[_0xc8f4('0xd')]=_['keys'](_0xd85d11);_0x32665c[_0xc8f4('0x80')]=_[_0xc8f4('0x90')](_0x57ad51[_0xc8f4('0x80')]);_0x32665c[_0xc8f4('0x91')]=_[_0xc8f4('0x92')](_0x32665c[_0xc8f4('0xd')],_0x32665c[_0xc8f4('0x80')]);_0x490b8b[_0xc8f4('0x93')]=_[_0xc8f4('0x92')](_0x32665c[_0xc8f4('0xd')],qs[_0xc8f4('0x94')](_0x57ad51['query'][_0xc8f4('0x94')]));_0x490b8b[_0xc8f4('0x93')]=_0x490b8b[_0xc8f4('0x93')][_0xc8f4('0x88')]?_0x490b8b['attributes']:_0x32665c['model'];if(!_0x57ad51[_0xc8f4('0x80')]['hasOwnProperty'](_0xc8f4('0x95'))){_0x490b8b['limit']=qs[_0xc8f4('0x96')](_0x57ad51['query']['limit']);_0x490b8b['offset']=qs['offset'](_0x57ad51['query']['offset']);}_0x490b8b[_0xc8f4('0x97')]=qs['sort'](_0x57ad51[_0xc8f4('0x80')][_0xc8f4('0x98')]);_0x490b8b[_0xc8f4('0x7e')]=qs[_0xc8f4('0x91')](_[_0xc8f4('0x99')](_0x57ad51['query'],_0x32665c[_0xc8f4('0x91')]));if(_0x57ad51[_0xc8f4('0x80')][_0xc8f4('0x6')]){_0x490b8b['where']=_[_0xc8f4('0x9a')](_0x490b8b[_0xc8f4('0x7e')],{'$or':_[_0xc8f4('0xa')](_0xd85d11,function(_0x1b95e6){if(_0x1b95e6[_0xc8f4('0x13')][_0xc8f4('0x9b')]!==_0xc8f4('0x9c')){var _0x1401f1={};_0x1401f1[_0x1b95e6['field']]={'$like':'%'+_0x57ad51[_0xc8f4('0x80')][_0xc8f4('0x6')]+'%'};return _0x1401f1;}})});}var _0x1f419d=[];var _0x3ce754=null;var _0xf2a4d7={};if(_0x3adcdb){_0x3ce754=_[_0xc8f4('0x8a')](_0x4ae72e,[_0xc8f4('0xf'),_0x3adcdb[_0xc8f4('0xf')]]);if(_0x3ce754[_0xc8f4('0xc')]){_0xf2a4d7={};if(_0x329c26[_0xc8f4('0x15')]===_0xc8f4('0x11')){_0xf2a4d7[_0x3ce754['foreignKey']]=_[_0xc8f4('0xa')](_0x3adcdb[_0xc8f4('0xe')],'id');}else{_0xf2a4d7[_0x3ce754['foreignKey']]=_0x3adcdb[_0xc8f4('0xe')];}_0x1f419d[_0xc8f4('0x89')](_0xf2a4d7);}else{_0x490b8b['where']['id']=_0x3adcdb[_0xc8f4('0xe')];}}else{for(var _0x2bbf57=0x0;_0x2bbf57<_0x2d363c['length'];_0x2bbf57++){_0x3ce754=_['find'](_0x4ae72e,[_0xc8f4('0xf'),_0x2d363c[_0x2bbf57][_0xc8f4('0xf')]]);if(_0x3ce754[_0xc8f4('0xc')]){_0xf2a4d7={};_0xf2a4d7[_0x3ce754['foreignKey']]=_0x2d363c[_0x2bbf57][_0xc8f4('0xe')];_0x1f419d[_0xc8f4('0x89')](_0xf2a4d7);}else{if(!_0x490b8b['where']['id'])_0x490b8b['where']['id']=[];_0x2d363c[_0x2bbf57][_0xc8f4('0xe')][_0xc8f4('0x9d')](function(_0x327d9c){_0x490b8b['where']['id'][_0xc8f4('0x89')](_0x327d9c);});}}}if(!_[_0xc8f4('0x87')](_0x1f419d)){_0x490b8b[_0xc8f4('0x7e')]=_['merge'](_0x490b8b[_0xc8f4('0x7e')],{'$and':{'$or':_0x1f419d}});}_0x490b8b=_[_0xc8f4('0x9a')]({},_0x490b8b,_0x57ad51[_0xc8f4('0x9e')]);if(_0x3adcdb&&!_0x3adcdb[_0xc8f4('0x8f')]&&_0x329c26[_0xc8f4('0x15')]===_0xc8f4('0x11')){if(_0x57ad51[_0xc8f4('0x80')][_0xc8f4('0x9f')]){_0x490b8b[_0xc8f4('0xa0')]=[{'all':!![]}];}return _0x580083[_0x329c26[_0xc8f4('0x15')]][_0xc8f4('0x8')](_0x490b8b)['then'](function(_0x7ae79){var _0x51b4b7=[];_0x7ae79[_0xc8f4('0x9d')](function(_0x39896d){var _0x1b6953;switch(_0x39896d[_0xc8f4('0xa1')]){case _0xc8f4('0xa2'):_0x1b6953=_[_0xc8f4('0x8a')](_0x3adcdb[_0xc8f4('0xe')],function(_0x2594fa){return _0x2594fa['id']===_0x39896d['reportId']&&_0x2594fa[_0xc8f4('0x13')]==='DefaultReports';});break;case'custom':_0x1b6953=_[_0xc8f4('0x8a')](_0x3adcdb[_0xc8f4('0xe')],function(_0x35a3db){return _0x35a3db['id']===_0x39896d['reportId']&&_0x35a3db['type']===_0xc8f4('0xa3');});break;}if(_0x1b6953)_0x51b4b7[_0xc8f4('0x89')](_0x39896d);});_0x51612f[_0xc8f4('0xa4')]=_0x51b4b7['length'];_0x51612f[_0xc8f4('0xa5')]=_0x51b4b7;return _0x51612f;});}else{if(!_['isEmpty'](_0x57ad51[_0xc8f4('0x80')][_0xc8f4('0xa6')])){_0x490b8b[_0xc8f4('0x7e')]['id']=_0x490b8b[_0xc8f4('0x7e')]['id']?_[_0xc8f4('0x92')](_0x490b8b['where']['id'],_0x57ad51[_0xc8f4('0x80')]['ids']):_0x57ad51[_0xc8f4('0x80')][_0xc8f4('0xa6')];}return _0x580083[_0x329c26[_0xc8f4('0x15')]][_0xc8f4('0xa4')]({'where':_0x490b8b[_0xc8f4('0x7e')]})[_0xc8f4('0x9')](function(_0x3f1852){_0x51612f[_0xc8f4('0xa4')]=_0x3f1852;if(_0x57ad51[_0xc8f4('0x80')][_0xc8f4('0x9f')]){if(_0x329c26[_0xc8f4('0x15')]==='CmContact'){_0x490b8b['include']=[{'model':_0x580083[_0xc8f4('0xa7')],'as':_0xc8f4('0xa8'),'attributes':['id',_0xc8f4('0xf'),_0xc8f4('0xa9')],'required':_0x57ad51[_0xc8f4('0x80')][_0xc8f4('0xaa')]?!![]:![]},{'model':_0x580083[_0xc8f4('0xa7')],'as':_0xc8f4('0xab'),'attributes':['id',_0xc8f4('0xf'),_0xc8f4('0xa9')],'through':_0x57ad51[_0xc8f4('0x80')][_0xc8f4('0xaa')]?{'attributes':[],'where':{'TagId':_0x57ad51['query']['tag']||undefined}}:{},'required':_0x57ad51[_0xc8f4('0x80')]['tag']?!![]:![]}];}else{_0x490b8b['include']=[{'all':!![]}];}}return _0x580083[_0x329c26[_0xc8f4('0x15')]]['findAll'](_0x490b8b);})['then'](function(_0x5c607e){_0x51612f['rows']=_0x5c607e;if(_0x17e9d1==='Agents'&&_0x57ad51[_0xc8f4('0x80')][_0xc8f4('0xac')]===_0xc8f4('0xad')){var _0x3afcb4=[];for(var _0x383c8a=0x0;_0x383c8a<_0x51612f[_0xc8f4('0xa5')][_0xc8f4('0x88')];_0x383c8a++){_0x3afcb4[_0xc8f4('0x89')](_0x451a3e(_0xc8f4('0xae'),_0x51612f[_0xc8f4('0xa5')][_0x383c8a][_0xc8f4('0xaf')]));_0x3afcb4[_0xc8f4('0x89')](_0x451a3e(_0xc8f4('0xb0'),_0x51612f[_0xc8f4('0xa5')][_0x383c8a][_0xc8f4('0xaf')]));_0x3afcb4[_0xc8f4('0x89')](_0x451a3e(_0xc8f4('0xb1'),_0x51612f[_0xc8f4('0xa5')][_0x383c8a][_0xc8f4('0xaf')]));_0x3afcb4[_0xc8f4('0x89')](_0x451a3e(_0xc8f4('0xb2'),_0x51612f[_0xc8f4('0xa5')][_0x383c8a][_0xc8f4('0xaf')]));_0x3afcb4['push'](_0x451a3e('openchannel',_0x51612f[_0xc8f4('0xa5')][_0x383c8a][_0xc8f4('0xaf')]));_0x3afcb4[_0xc8f4('0x89')](_0x451a3e(_0xc8f4('0xb3'),_0x51612f[_0xc8f4('0xa5')][_0x383c8a][_0xc8f4('0xaf')]));}return Promise[_0xc8f4('0x8c')](_0x3afcb4)[_0xc8f4('0x9')](function(){return _0x51612f;});}return _0x51612f;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 690c3d3..eda178b 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 _0x6d38=['catch','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./userProfile.socket','request','then','info','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','UserProfile,\x20%s,\x20%s','message','result'];(function(_0x2d3c95,_0x13270f){var _0x22fe91=function(_0x4c9da4){while(--_0x4c9da4){_0x2d3c95['push'](_0x2d3c95['shift']());}};_0x22fe91(++_0x13270f);}(_0x6d38,0x1ef));var _0x86d3=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x6d38[_0x465028];return _0xb783d4;};'use strict';var _=require('lodash');var util=require(_0x86d3('0x0'));var moment=require(_0x86d3('0x1'));var BPromise=require(_0x86d3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x86d3('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x86d3('0x4'))(_0x86d3('0x5'));var config=require(_0x86d3('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x86d3('0x7')][_0x86d3('0x8')]({'port':0x232a});config[_0x86d3('0x9')]=_[_0x86d3('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x86d3('0xb'))(new Redis(config[_0x86d3('0x9')]));require(_0x86d3('0xc'))['register'](socket);function respondWithRpcPromise(_0x4a277e,_0x3ed317,_0x555e6d){return new BPromise(function(_0x49b436,_0x5606eb){return client[_0x86d3('0xd')](_0x4a277e,_0x555e6d)[_0x86d3('0xe')](function(_0x4f216c){logger[_0x86d3('0xf')]('UserProfile,\x20%s,\x20%s',_0x3ed317,_0x86d3('0x10'));logger[_0x86d3('0x11')](_0x86d3('0x12'),_0x3ed317,_0x86d3('0x10'),JSON[_0x86d3('0x13')](_0x4f216c));if(_0x4f216c[_0x86d3('0x14')]){if(_0x4f216c[_0x86d3('0x14')][_0x86d3('0x15')]===0x1f4){logger['error'](_0x86d3('0x16'),_0x3ed317,_0x4f216c[_0x86d3('0x14')][_0x86d3('0x17')]);return _0x5606eb(_0x4f216c[_0x86d3('0x14')][_0x86d3('0x17')]);}logger[_0x86d3('0x14')](_0x86d3('0x16'),_0x3ed317,_0x4f216c[_0x86d3('0x14')]['message']);return _0x49b436(_0x4f216c[_0x86d3('0x14')][_0x86d3('0x17')]);}else{logger[_0x86d3('0xf')](_0x86d3('0x16'),_0x3ed317,_0x86d3('0x10'));_0x49b436(_0x4f216c[_0x86d3('0x18')][_0x86d3('0x17')]);}})[_0x86d3('0x19')](function(_0x9b76f2){logger['error'](_0x86d3('0x16'),_0x3ed317,_0x9b76f2);_0x5606eb(_0x9b76f2);});});} \ No newline at end of file +var _0x110e=['info','UserProfile,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','UserProfile,\x20%s,\x20%s','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','client','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','request','then'];(function(_0x5d9387,_0x4b1b3d){var _0xd826a0=function(_0xd7627e){while(--_0xd7627e){_0x5d9387['push'](_0x5d9387['shift']());}};_0xd826a0(++_0x4b1b3d);}(_0x110e,0x68));var _0xe110=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0x110e[_0x342baa];return _0x1208f3;};'use strict';var _=require(_0xe110('0x0'));var util=require(_0xe110('0x1'));var moment=require('moment');var BPromise=require(_0xe110('0x2'));var rs=require(_0xe110('0x3'));var fs=require('fs');var Redis=require(_0xe110('0x4'));var db=require(_0xe110('0x5'))['db'];var utils=require(_0xe110('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe110('0x7')]['http']({'port':0x232a});config[_0xe110('0x8')]=_[_0xe110('0x9')](config[_0xe110('0x8')],{'host':_0xe110('0xa'),'port':0x18eb});var socket=require(_0xe110('0xb'))(new Redis(config[_0xe110('0x8')]));require(_0xe110('0xc'))[_0xe110('0xd')](socket);function respondWithRpcPromise(_0x3985c9,_0x47a535,_0x2df21e){return new BPromise(function(_0x435722,_0x5ebe72){return client[_0xe110('0xe')](_0x3985c9,_0x2df21e)[_0xe110('0xf')](function(_0x326a5a){logger[_0xe110('0x10')]('UserProfile,\x20%s,\x20%s',_0x47a535,'request\x20sent');logger['debug'](_0xe110('0x11'),_0x47a535,_0xe110('0x12'),JSON['stringify'](_0x326a5a));if(_0x326a5a['error']){if(_0x326a5a['error'][_0xe110('0x13')]===0x1f4){logger[_0xe110('0x14')]('UserProfile,\x20%s,\x20%s',_0x47a535,_0x326a5a['error'][_0xe110('0x15')]);return _0x5ebe72(_0x326a5a['error'][_0xe110('0x15')]);}logger[_0xe110('0x14')](_0xe110('0x16'),_0x47a535,_0x326a5a[_0xe110('0x14')]['message']);return _0x435722(_0x326a5a[_0xe110('0x14')][_0xe110('0x15')]);}else{logger['info']('UserProfile,\x20%s,\x20%s',_0x47a535,_0xe110('0x12'));_0x435722(_0x326a5a['result'][_0xe110('0x15')]);}})[_0xe110('0x17')](function(_0x47fff8){logger[_0xe110('0x14')](_0xe110('0x16'),_0x47a535,_0x47fff8);_0x5ebe72(_0x47fff8);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index a148ba9..5750c1d 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 _0x7a60=['update','emit','removeListener','length','userProfile:','./userProfile.events','save','remove'];(function(_0x5a3cf0,_0x160a68){var _0x5a64ee=function(_0x34cd1d){while(--_0x34cd1d){_0x5a3cf0['push'](_0x5a3cf0['shift']());}};_0x5a64ee(++_0x160a68);}(_0x7a60,0x65));var _0x07a6=function(_0x2bdc7e,_0x55ce86){_0x2bdc7e=_0x2bdc7e-0x0;var _0x319a46=_0x7a60[_0x2bdc7e];return _0x319a46;};'use strict';var UserProfileEvents=require(_0x07a6('0x0'));var events=[_0x07a6('0x1'),_0x07a6('0x2'),_0x07a6('0x3')];function createListener(_0x4e7d60,_0xfb84b3){return function(_0xdb96a8){_0xfb84b3[_0x07a6('0x4')](_0x4e7d60,_0xdb96a8);};}function removeListener(_0x4955a5,_0x4e5fea){return function(){UserProfileEvents[_0x07a6('0x5')](_0x4955a5,_0x4e5fea);};}exports['register']=function(_0x56e9cb){for(var _0x431718=0x0,_0x1d4d67=events[_0x07a6('0x6')];_0x431718<_0x1d4d67;_0x431718++){var _0x468d23=events[_0x431718];var _0x29c73f=createListener(_0x07a6('0x7')+_0x468d23,_0x56e9cb);UserProfileEvents['on'](_0x468d23,_0x29c73f);}}; \ No newline at end of file +var _0x3dfb=['length','userProfile:','./userProfile.events','save','remove','update','emit','removeListener','register'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x3dfb,0x92));var _0xb3df=function(_0x5709d9,_0x208671){_0x5709d9=_0x5709d9-0x0;var _0x24d560=_0x3dfb[_0x5709d9];return _0x24d560;};'use strict';var UserProfileEvents=require(_0xb3df('0x0'));var events=[_0xb3df('0x1'),_0xb3df('0x2'),_0xb3df('0x3')];function createListener(_0x19f297,_0x85df96){return function(_0x5baf90){_0x85df96[_0xb3df('0x4')](_0x19f297,_0x5baf90);};}function removeListener(_0x4f0347,_0x2398d6){return function(){UserProfileEvents[_0xb3df('0x5')](_0x4f0347,_0x2398d6);};}exports[_0xb3df('0x6')]=function(_0x13f35b){for(var _0x27d195=0x0,_0x1c3fcb=events[_0xb3df('0x7')];_0x27d195<_0x1c3fcb;_0x27d195++){var _0x578e81=events[_0x27d195];var _0x5ad574=createListener(_0xb3df('0x8')+_0x578e81,_0x13f35b);UserProfileEvents['on'](_0x578e81,_0x5ad574);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 9df1246..bf11700 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 _0x25ec=['fs-extra','../../components/auth/service','../../components/interaction/service','./userProfileResource.controller','get','isAuthenticated','index','/describe','show','post','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x36a263,_0x3dd45b){var _0x195316=function(_0x7e92bf){while(--_0x7e92bf){_0x36a263['push'](_0x36a263['shift']());}};_0x195316(++_0x3dd45b);}(_0x25ec,0x1de));var _0xc25e=function(_0x2d1310,_0x5426ee){_0x2d1310=_0x2d1310-0x0;var _0xf6b625=_0x25ec[_0x2d1310];return _0xf6b625;};'use strict';var multer=require(_0xc25e('0x0'));var util=require(_0xc25e('0x1'));var path=require(_0xc25e('0x2'));var timeout=require(_0xc25e('0x3'));var express=require(_0xc25e('0x4'));var router=express[_0xc25e('0x5')]();var fs_extra=require(_0xc25e('0x6'));var auth=require(_0xc25e('0x7'));var interaction=require(_0xc25e('0x8'));var config=require('../../config/environment');var controller=require(_0xc25e('0x9'));router[_0xc25e('0xa')]('/',auth[_0xc25e('0xb')](),controller[_0xc25e('0xc')]);router['get'](_0xc25e('0xd'),auth[_0xc25e('0xb')](),controller['describe']);router[_0xc25e('0xa')]('/:id',auth[_0xc25e('0xb')](),controller[_0xc25e('0xe')]);router[_0xc25e('0xf')]('/',auth[_0xc25e('0xb')](),controller['create']);router[_0xc25e('0x10')]('/:id',auth[_0xc25e('0xb')](),controller[_0xc25e('0x11')]);router[_0xc25e('0x12')](_0xc25e('0x13'),auth['isAuthenticated'](),controller[_0xc25e('0x14')]);module[_0xc25e('0x15')]=router; \ No newline at end of file +var _0x5c1b=['post','create','put','delete','destroy','util','path','express','Router','../../components/auth/service','../../config/environment','isAuthenticated','get','/describe','/:id','show'];(function(_0x19d28d,_0x32b76c){var _0x5ce051=function(_0x1ee03f){while(--_0x1ee03f){_0x19d28d['push'](_0x19d28d['shift']());}};_0x5ce051(++_0x32b76c);}(_0x5c1b,0x65));var _0xb5c1=function(_0x5169ca,_0x419e0b){_0x5169ca=_0x5169ca-0x0;var _0x4f160=_0x5c1b[_0x5169ca];return _0x4f160;};'use strict';var multer=require('multer');var util=require(_0xb5c1('0x0'));var path=require(_0xb5c1('0x1'));var timeout=require('connect-timeout');var express=require(_0xb5c1('0x2'));var router=express[_0xb5c1('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb5c1('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xb5c1('0x5'));var controller=require('./userProfileResource.controller');router['get']('/',auth[_0xb5c1('0x6')](),controller['index']);router[_0xb5c1('0x7')](_0xb5c1('0x8'),auth[_0xb5c1('0x6')](),controller['describe']);router[_0xb5c1('0x7')](_0xb5c1('0x9'),auth['isAuthenticated'](),controller[_0xb5c1('0xa')]);router[_0xb5c1('0xb')]('/',auth[_0xb5c1('0x6')](),controller[_0xb5c1('0xc')]);router[_0xb5c1('0xd')]('/:id',auth[_0xb5c1('0x6')](),controller['update']);router[_0xb5c1('0xe')](_0xb5c1('0x9'),auth[_0xb5c1('0x6')](),controller[_0xb5c1('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index cc60068..dc1d457 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 _0x3089=['sequelize','STRING','INTEGER'];(function(_0x424c15,_0x44f30d){var _0x3c01b8=function(_0x179b7b){while(--_0x179b7b){_0x424c15['push'](_0x424c15['shift']());}};_0x3c01b8(++_0x44f30d);}(_0x3089,0x14a));var _0x9308=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x3089[_0x5c351c];return _0x26f3b3;};'use strict';var Sequelize=require(_0x9308('0x0'));module['exports']={'name':{'type':Sequelize[_0x9308('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x9308('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9308('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xcd57=['sequelize','exports','STRING','INTEGER'];(function(_0x116d7f,_0x88f6f1){var _0x442220=function(_0x316e4c){while(--_0x316e4c){_0x116d7f['push'](_0x116d7f['shift']());}};_0x442220(++_0x88f6f1);}(_0xcd57,0x1a4));var _0x7cd5=function(_0x378752,_0x158b32){_0x378752=_0x378752-0x0;var _0xd5a262=_0xcd57[_0x378752];return _0xd5a262;};'use strict';var Sequelize=require(_0x7cd5('0x0'));module[_0x7cd5('0x1')]={'name':{'type':Sequelize[_0x7cd5('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x7cd5('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x7cd5('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 1dbe804..cc74c97 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 _0x430c=['status','end','json','limit','undefined','offset','count','set','Content-Range','then','destroy','error','stack','name','send','index','UserProfileResource','rawAttributes','fieldName','key','model','map','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','create','body','update','find','describe','eml-format','fast-json-patch','request-promise','moment','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus'];(function(_0x36acb3,_0x204e94){var _0x13976c=function(_0x4371dd){while(--_0x4371dd){_0x36acb3['push'](_0x36acb3['shift']());}};_0x13976c(++_0x204e94);}(_0x430c,0x1a1));var _0xc430=function(_0x587dd0,_0x273922){_0x587dd0=_0x587dd0-0x0;var _0x56f153=_0x430c[_0x587dd0];return _0x56f153;};'use strict';var emlformat=require(_0xc430('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc430('0x1'));var rp=require(_0xc430('0x2'));var moment=require(_0xc430('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xc430('0x4'));var csv=require(_0xc430('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc430('0x6'));var _=require('lodash');var squel=require(_0xc430('0x7'));var crypto=require(_0xc430('0x8'));var jsforce=require(_0xc430('0x9'));var deskjs=require(_0xc430('0xa'));var toCsv=require(_0xc430('0x5'));var querystring=require(_0xc430('0xb'));var Papa=require(_0xc430('0xc'));var Redis=require(_0xc430('0xd'));var authService=require(_0xc430('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xc430('0xf'));var hardwareService=require(_0xc430('0x10'));var logger=require('../../config/logger')(_0xc430('0x11'));var utils=require('../../config/utils');var config=require(_0xc430('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xc430('0x13'))['db'];function respondWithStatusCode(_0x8aa2e6,_0xc5f92){_0xc5f92=_0xc5f92||0xcc;return function(_0x1fb8ce){if(_0x1fb8ce){return _0x8aa2e6[_0xc430('0x14')](_0xc5f92);}return _0x8aa2e6[_0xc430('0x15')](_0xc5f92)[_0xc430('0x16')]();};}function respondWithResult(_0x54d851,_0x4e9134){_0x4e9134=_0x4e9134||0xc8;return function(_0x3f359c){if(_0x3f359c){return _0x54d851[_0xc430('0x15')](_0x4e9134)[_0xc430('0x17')](_0x3f359c);}};}function respondWithFilteredResult(_0x2ef538,_0x31d3b7){return function(_0x55cc6c){if(_0x55cc6c){var _0x111598=typeof _0x31d3b7['offset']==='undefined'&&typeof _0x31d3b7[_0xc430('0x18')]===_0xc430('0x19');var _0x2327c5=_0x55cc6c['count'];var _0x5d3acc=_0x111598?0x0:_0x31d3b7[_0xc430('0x1a')];var _0x4c1937=_0x111598?_0x55cc6c[_0xc430('0x1b')]:_0x31d3b7['offset']+_0x31d3b7['limit'];var _0x2f3203;if(_0x4c1937>=_0x2327c5){_0x4c1937=_0x2327c5;_0x2f3203=0xc8;}else{_0x2f3203=0xce;}_0x2ef538['status'](_0x2f3203);return _0x2ef538[_0xc430('0x1c')](_0xc430('0x1d'),_0x5d3acc+'-'+_0x4c1937+'/'+_0x2327c5)[_0xc430('0x17')](_0x55cc6c);}return null;};}function patchUpdates(_0x1f90bb){return function(_0x2a1ea1){try{jsonpatch['apply'](_0x2a1ea1,_0x1f90bb,!![]);}catch(_0x388a2f){return BPromise['reject'](_0x388a2f);}return _0x2a1ea1['save']();};}function saveUpdates(_0x3b7c3d,_0x2ea352){return function(_0x3c7afa){if(_0x3c7afa){return _0x3c7afa['update'](_0x3b7c3d)[_0xc430('0x1e')](function(_0x57d26e){return _0x57d26e;});}return null;};}function removeEntity(_0x23425d,_0x22ebfb){return function(_0x4efecd){if(_0x4efecd){return _0x4efecd[_0xc430('0x1f')]()[_0xc430('0x1e')](function(){_0x23425d['status'](0xcc)[_0xc430('0x16')]();});}};}function handleEntityNotFound(_0x59c498,_0x3aa85e){return function(_0x4b5280){if(!_0x4b5280){_0x59c498[_0xc430('0x14')](0x194);}return _0x4b5280;};}function handleError(_0x21e28a,_0x50110b){_0x50110b=_0x50110b||0x1f4;return function(_0x33433f){logger[_0xc430('0x20')](_0x33433f[_0xc430('0x21')]);if(_0x33433f[_0xc430('0x22')]){delete _0x33433f[_0xc430('0x22')];}_0x21e28a['status'](_0x50110b)[_0xc430('0x23')](_0x33433f);};}exports[_0xc430('0x24')]=function(_0x1c1da9,_0x1591e3){var _0x542cba={},_0x1f8086={},_0x4cf56c={'count':0x0,'rows':[]};var _0x1d65ee=_['map'](db[_0xc430('0x25')][_0xc430('0x26')],function(_0xfc8767){return{'name':_0xfc8767[_0xc430('0x27')],'type':_0xfc8767['type'][_0xc430('0x28')]};});_0x1f8086[_0xc430('0x29')]=_[_0xc430('0x2a')](_0x1d65ee,_0xc430('0x22'));_0x1f8086['query']=_[_0xc430('0x2b')](_0x1c1da9[_0xc430('0x2c')]);_0x1f8086['filters']=_[_0xc430('0x2d')](_0x1f8086['model'],_0x1f8086['query']);_0x542cba[_0xc430('0x2e')]=_[_0xc430('0x2d')](_0x1f8086[_0xc430('0x29')],qs[_0xc430('0x2f')](_0x1c1da9[_0xc430('0x2c')][_0xc430('0x2f')]));_0x542cba[_0xc430('0x2e')]=_0x542cba[_0xc430('0x2e')]['length']?_0x542cba[_0xc430('0x2e')]:_0x1f8086['model'];if(!_0x1c1da9[_0xc430('0x2c')][_0xc430('0x30')](_0xc430('0x31'))){_0x542cba[_0xc430('0x18')]=qs['limit'](_0x1c1da9[_0xc430('0x2c')]['limit']);_0x542cba['offset']=qs[_0xc430('0x1a')](_0x1c1da9[_0xc430('0x2c')]['offset']);}_0x542cba[_0xc430('0x32')]=qs[_0xc430('0x33')](_0x1c1da9[_0xc430('0x2c')][_0xc430('0x33')]);_0x542cba[_0xc430('0x34')]=qs[_0xc430('0x35')](_[_0xc430('0x36')](_0x1c1da9[_0xc430('0x2c')],_0x1f8086[_0xc430('0x35')]),_0x1d65ee);if(_0x1c1da9[_0xc430('0x2c')][_0xc430('0x37')]){_0x542cba[_0xc430('0x34')]=_[_0xc430('0x38')](_0x542cba[_0xc430('0x34')],{'$or':_[_0xc430('0x2a')](_0x1d65ee,function(_0x537e4c){if(_0x537e4c[_0xc430('0x39')]!==_0xc430('0x3a')){var _0x24363b={};_0x24363b[_0x537e4c[_0xc430('0x22')]]={'$like':'%'+_0x1c1da9['query'][_0xc430('0x37')]+'%'};return _0x24363b;}})});}_0x542cba=_[_0xc430('0x38')]({},_0x542cba,_0x1c1da9[_0xc430('0x3b')]);var _0x45b3dc={'where':_0x542cba[_0xc430('0x34')]};return db[_0xc430('0x25')]['count'](_0x45b3dc)[_0xc430('0x1e')](function(_0x348f2f){_0x4cf56c[_0xc430('0x1b')]=_0x348f2f;if(_0x1c1da9[_0xc430('0x2c')][_0xc430('0x3c')]){_0x542cba[_0xc430('0x3d')]=[{'all':!![]}];}return db[_0xc430('0x25')][_0xc430('0x3e')](_0x542cba);})[_0xc430('0x1e')](function(_0x4174d2){_0x4cf56c[_0xc430('0x3f')]=_0x4174d2;return _0x4cf56c;})[_0xc430('0x1e')](respondWithFilteredResult(_0x1591e3,_0x542cba))[_0xc430('0x40')](handleError(_0x1591e3,null));};exports[_0xc430('0x41')]=function(_0x5a9c4b,_0x47edb0){var _0x4983e0={'raw':![],'where':{'id':_0x5a9c4b[_0xc430('0x42')]['id']}},_0x262063={};_0x262063[_0xc430('0x29')]=_[_0xc430('0x2b')](db[_0xc430('0x25')][_0xc430('0x26')]);_0x262063[_0xc430('0x2c')]=_[_0xc430('0x2b')](_0x5a9c4b[_0xc430('0x2c')]);_0x262063[_0xc430('0x35')]=_[_0xc430('0x2d')](_0x262063[_0xc430('0x29')],_0x262063[_0xc430('0x2c')]);_0x4983e0[_0xc430('0x2e')]=_[_0xc430('0x2d')](_0x262063[_0xc430('0x29')],qs['fields'](_0x5a9c4b[_0xc430('0x2c')][_0xc430('0x2f')]));_0x4983e0[_0xc430('0x2e')]=_0x4983e0[_0xc430('0x2e')][_0xc430('0x43')]?_0x4983e0[_0xc430('0x2e')]:_0x262063[_0xc430('0x29')];if(_0x5a9c4b[_0xc430('0x2c')]['includeAll']){_0x4983e0[_0xc430('0x3d')]=[{'all':!![]}];}_0x4983e0=_['merge']({},_0x4983e0,_0x5a9c4b[_0xc430('0x3b')]);return db[_0xc430('0x25')]['find'](_0x4983e0)['then'](handleEntityNotFound(_0x47edb0,null))[_0xc430('0x1e')](respondWithResult(_0x47edb0,null))['catch'](handleError(_0x47edb0,null));};exports['create']=function(_0x10db27,_0x4eafae){return db[_0xc430('0x25')][_0xc430('0x44')](_0x10db27[_0xc430('0x45')],{})['then'](respondWithResult(_0x4eafae,0xc9))[_0xc430('0x40')](handleError(_0x4eafae,null));};exports[_0xc430('0x46')]=function(_0x19e563,_0x549400){if(_0x19e563[_0xc430('0x45')]['id']){delete _0x19e563[_0xc430('0x45')]['id'];}return db[_0xc430('0x25')][_0xc430('0x47')]({'where':{'id':_0x19e563[_0xc430('0x42')]['id']}})[_0xc430('0x1e')](handleEntityNotFound(_0x549400,null))[_0xc430('0x1e')](saveUpdates(_0x19e563['body'],null))[_0xc430('0x1e')](respondWithResult(_0x549400,null))[_0xc430('0x40')](handleError(_0x549400,null));};exports[_0xc430('0x1f')]=function(_0x4e9aff,_0x23cb41){return db[_0xc430('0x25')][_0xc430('0x47')]({'where':{'id':_0x4e9aff[_0xc430('0x42')]['id']}})['then'](handleEntityNotFound(_0x23cb41,null))[_0xc430('0x1e')](removeEntity(_0x23cb41,null))['catch'](handleError(_0x23cb41,null));};exports[_0xc430('0x48')]=function(_0x214954,_0x2a5143){return db[_0xc430('0x25')][_0xc430('0x48')]()[_0xc430('0x1e')](respondWithResult(_0x2a5143,null))['catch'](handleError(_0x2a5143,null));}; \ No newline at end of file +var _0x9f0e=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','update','then','destroy','end','error','name','send','index','map','UserProfileResource','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','options','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9f0e,0x116));var _0xe9f0=function(_0x9b379a,_0x11a45c){_0x9b379a=_0x9b379a-0x0;var _0x23349c=_0x9f0e[_0x9b379a];return _0x23349c;};'use strict';var emlformat=require(_0xe9f0('0x0'));var rimraf=require(_0xe9f0('0x1'));var zipdir=require(_0xe9f0('0x2'));var jsonpatch=require(_0xe9f0('0x3'));var rp=require(_0xe9f0('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe9f0('0x5'));var util=require(_0xe9f0('0x6'));var path=require(_0xe9f0('0x7'));var sox=require(_0xe9f0('0x8'));var csv=require(_0xe9f0('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe9f0('0xa'));var squel=require(_0xe9f0('0xb'));var crypto=require(_0xe9f0('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe9f0('0xd'));var toCsv=require(_0xe9f0('0x9'));var querystring=require(_0xe9f0('0xe'));var Papa=require(_0xe9f0('0xf'));var Redis=require(_0xe9f0('0x10'));var authService=require(_0xe9f0('0x11'));var qs=require(_0xe9f0('0x12'));var as=require(_0xe9f0('0x13'));var hardwareService=require(_0xe9f0('0x14'));var logger=require('../../config/logger')(_0xe9f0('0x15'));var utils=require(_0xe9f0('0x16'));var config=require(_0xe9f0('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xe9f0('0x18'))['db'];function respondWithStatusCode(_0x586763,_0x367545){_0x367545=_0x367545||0xcc;return function(_0xd82420){if(_0xd82420){return _0x586763[_0xe9f0('0x19')](_0x367545);}return _0x586763[_0xe9f0('0x1a')](_0x367545)['end']();};}function respondWithResult(_0x2cf75d,_0x5a10c6){_0x5a10c6=_0x5a10c6||0xc8;return function(_0x1e3ba8){if(_0x1e3ba8){return _0x2cf75d[_0xe9f0('0x1a')](_0x5a10c6)[_0xe9f0('0x1b')](_0x1e3ba8);}};}function respondWithFilteredResult(_0x59320d,_0x28bfac){return function(_0x33e9e4){if(_0x33e9e4){var _0x2e68ef=typeof _0x28bfac['offset']===_0xe9f0('0x1c')&&typeof _0x28bfac[_0xe9f0('0x1d')]===_0xe9f0('0x1c');var _0xd71ac8=_0x33e9e4[_0xe9f0('0x1e')];var _0x2ab12b=_0x2e68ef?0x0:_0x28bfac[_0xe9f0('0x1f')];var _0x59bf5a=_0x2e68ef?_0x33e9e4[_0xe9f0('0x1e')]:_0x28bfac[_0xe9f0('0x1f')]+_0x28bfac[_0xe9f0('0x1d')];var _0x5c4182;if(_0x59bf5a>=_0xd71ac8){_0x59bf5a=_0xd71ac8;_0x5c4182=0xc8;}else{_0x5c4182=0xce;}_0x59320d[_0xe9f0('0x1a')](_0x5c4182);return _0x59320d[_0xe9f0('0x20')](_0xe9f0('0x21'),_0x2ab12b+'-'+_0x59bf5a+'/'+_0xd71ac8)[_0xe9f0('0x1b')](_0x33e9e4);}return null;};}function patchUpdates(_0x5ba788){return function(_0x33f143){try{jsonpatch[_0xe9f0('0x22')](_0x33f143,_0x5ba788,!![]);}catch(_0x583687){return BPromise['reject'](_0x583687);}return _0x33f143['save']();};}function saveUpdates(_0x12fe9f,_0xa1ddc){return function(_0x1211ae){if(_0x1211ae){return _0x1211ae[_0xe9f0('0x23')](_0x12fe9f)[_0xe9f0('0x24')](function(_0x4a5c27){return _0x4a5c27;});}return null;};}function removeEntity(_0x229fe0,_0x38b7ee){return function(_0x437d43){if(_0x437d43){return _0x437d43[_0xe9f0('0x25')]()[_0xe9f0('0x24')](function(){_0x229fe0[_0xe9f0('0x1a')](0xcc)[_0xe9f0('0x26')]();});}};}function handleEntityNotFound(_0x1321bb,_0x3c4ba9){return function(_0x3fce54){if(!_0x3fce54){_0x1321bb['sendStatus'](0x194);}return _0x3fce54;};}function handleError(_0x371095,_0x27541f){_0x27541f=_0x27541f||0x1f4;return function(_0x2ddfba){logger[_0xe9f0('0x27')](_0x2ddfba['stack']);if(_0x2ddfba[_0xe9f0('0x28')]){delete _0x2ddfba[_0xe9f0('0x28')];}_0x371095[_0xe9f0('0x1a')](_0x27541f)[_0xe9f0('0x29')](_0x2ddfba);};}exports[_0xe9f0('0x2a')]=function(_0x5457f6,_0x130f96){var _0xdc16bc={},_0x44fb5b={},_0xab3d81={'count':0x0,'rows':[]};var _0xa27c84=_[_0xe9f0('0x2b')](db[_0xe9f0('0x2c')][_0xe9f0('0x2d')],function(_0x2b6503){return{'name':_0x2b6503[_0xe9f0('0x2e')],'type':_0x2b6503[_0xe9f0('0x2f')][_0xe9f0('0x30')]};});_0x44fb5b[_0xe9f0('0x31')]=_[_0xe9f0('0x2b')](_0xa27c84,_0xe9f0('0x28'));_0x44fb5b[_0xe9f0('0x32')]=_[_0xe9f0('0x33')](_0x5457f6[_0xe9f0('0x32')]);_0x44fb5b[_0xe9f0('0x34')]=_[_0xe9f0('0x35')](_0x44fb5b[_0xe9f0('0x31')],_0x44fb5b[_0xe9f0('0x32')]);_0xdc16bc[_0xe9f0('0x36')]=_[_0xe9f0('0x35')](_0x44fb5b['model'],qs['fields'](_0x5457f6['query'][_0xe9f0('0x37')]));_0xdc16bc['attributes']=_0xdc16bc[_0xe9f0('0x36')][_0xe9f0('0x38')]?_0xdc16bc['attributes']:_0x44fb5b[_0xe9f0('0x31')];if(!_0x5457f6['query']['hasOwnProperty']('nolimit')){_0xdc16bc[_0xe9f0('0x1d')]=qs[_0xe9f0('0x1d')](_0x5457f6['query'][_0xe9f0('0x1d')]);_0xdc16bc[_0xe9f0('0x1f')]=qs[_0xe9f0('0x1f')](_0x5457f6['query']['offset']);}_0xdc16bc[_0xe9f0('0x39')]=qs[_0xe9f0('0x3a')](_0x5457f6[_0xe9f0('0x32')]['sort']);_0xdc16bc[_0xe9f0('0x3b')]=qs[_0xe9f0('0x34')](_[_0xe9f0('0x3c')](_0x5457f6[_0xe9f0('0x32')],_0x44fb5b[_0xe9f0('0x34')]),_0xa27c84);if(_0x5457f6['query'][_0xe9f0('0x3d')]){_0xdc16bc[_0xe9f0('0x3b')]=_[_0xe9f0('0x3e')](_0xdc16bc['where'],{'$or':_[_0xe9f0('0x2b')](_0xa27c84,function(_0xbec11f){if(_0xbec11f['type']!==_0xe9f0('0x3f')){var _0x5154c3={};_0x5154c3[_0xbec11f[_0xe9f0('0x28')]]={'$like':'%'+_0x5457f6['query']['filter']+'%'};return _0x5154c3;}})});}_0xdc16bc=_['merge']({},_0xdc16bc,_0x5457f6['options']);var _0x5165f7={'where':_0xdc16bc[_0xe9f0('0x3b')]};return db[_0xe9f0('0x2c')][_0xe9f0('0x1e')](_0x5165f7)[_0xe9f0('0x24')](function(_0x2560c6){_0xab3d81[_0xe9f0('0x1e')]=_0x2560c6;if(_0x5457f6[_0xe9f0('0x32')][_0xe9f0('0x40')]){_0xdc16bc[_0xe9f0('0x41')]=[{'all':!![]}];}return db['UserProfileResource'][_0xe9f0('0x42')](_0xdc16bc);})[_0xe9f0('0x24')](function(_0x36b00a){_0xab3d81['rows']=_0x36b00a;return _0xab3d81;})['then'](respondWithFilteredResult(_0x130f96,_0xdc16bc))[_0xe9f0('0x43')](handleError(_0x130f96,null));};exports['show']=function(_0x297689,_0x52613a){var _0x314f0e={'raw':![],'where':{'id':_0x297689['params']['id']}},_0x42d9d2={};_0x42d9d2[_0xe9f0('0x31')]=_[_0xe9f0('0x33')](db[_0xe9f0('0x2c')][_0xe9f0('0x2d')]);_0x42d9d2[_0xe9f0('0x32')]=_['keys'](_0x297689[_0xe9f0('0x32')]);_0x42d9d2[_0xe9f0('0x34')]=_[_0xe9f0('0x35')](_0x42d9d2[_0xe9f0('0x31')],_0x42d9d2[_0xe9f0('0x32')]);_0x314f0e['attributes']=_[_0xe9f0('0x35')](_0x42d9d2['model'],qs['fields'](_0x297689[_0xe9f0('0x32')][_0xe9f0('0x37')]));_0x314f0e['attributes']=_0x314f0e[_0xe9f0('0x36')][_0xe9f0('0x38')]?_0x314f0e[_0xe9f0('0x36')]:_0x42d9d2[_0xe9f0('0x31')];if(_0x297689[_0xe9f0('0x32')][_0xe9f0('0x40')]){_0x314f0e[_0xe9f0('0x41')]=[{'all':!![]}];}_0x314f0e=_['merge']({},_0x314f0e,_0x297689[_0xe9f0('0x44')]);return db['UserProfileResource'][_0xe9f0('0x45')](_0x314f0e)['then'](handleEntityNotFound(_0x52613a,null))[_0xe9f0('0x24')](respondWithResult(_0x52613a,null))['catch'](handleError(_0x52613a,null));};exports[_0xe9f0('0x46')]=function(_0x2023b4,_0x422324){return db['UserProfileResource'][_0xe9f0('0x46')](_0x2023b4[_0xe9f0('0x47')],{})[_0xe9f0('0x24')](respondWithResult(_0x422324,0xc9))[_0xe9f0('0x43')](handleError(_0x422324,null));};exports[_0xe9f0('0x23')]=function(_0x135175,_0x6ece3f){if(_0x135175[_0xe9f0('0x47')]['id']){delete _0x135175[_0xe9f0('0x47')]['id'];}return db[_0xe9f0('0x2c')][_0xe9f0('0x45')]({'where':{'id':_0x135175[_0xe9f0('0x48')]['id']}})['then'](handleEntityNotFound(_0x6ece3f,null))['then'](saveUpdates(_0x135175[_0xe9f0('0x47')],null))[_0xe9f0('0x24')](respondWithResult(_0x6ece3f,null))[_0xe9f0('0x43')](handleError(_0x6ece3f,null));};exports['destroy']=function(_0x1ac381,_0x4d8b2e){return db[_0xe9f0('0x2c')][_0xe9f0('0x45')]({'where':{'id':_0x1ac381[_0xe9f0('0x48')]['id']}})[_0xe9f0('0x24')](handleEntityNotFound(_0x4d8b2e,null))['then'](removeEntity(_0x4d8b2e,null))[_0xe9f0('0x43')](handleError(_0x4d8b2e,null));};exports[_0xe9f0('0x49')]=function(_0x5163ea,_0x2bf65c){return db[_0xe9f0('0x2c')][_0xe9f0('0x49')]()[_0xe9f0('0x24')](respondWithResult(_0x2bf65c,null))['catch'](handleError(_0x2bf65c,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 9222899..10ea642 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 _0x3999=['lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userProfileResource.attributes','UserProfileResource','user_profile_has_resources','compositeIndex','sectionId'];(function(_0x277c72,_0x22dd1f){var _0x469415=function(_0x1a50fd){while(--_0x1a50fd){_0x277c72['push'](_0x277c72['shift']());}};_0x469415(++_0x22dd1f);}(_0x3999,0xc3));var _0x9399=function(_0x21e573,_0x15f1a0){_0x21e573=_0x21e573-0x0;var _0x4ea154=_0x3999[_0x21e573];return _0x4ea154;};'use strict';var _=require(_0x9399('0x0'));var util=require('util');var logger=require(_0x9399('0x1'))(_0x9399('0x2'));var moment=require(_0x9399('0x3'));var BPromise=require(_0x9399('0x4'));var rp=require(_0x9399('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9399('0x6'));var config=require(_0x9399('0x7'));var attributes=require(_0x9399('0x8'));module['exports']=function(_0x345bd7,_0x3d45a6){return _0x345bd7['define'](_0x9399('0x9'),attributes,{'tableName':_0x9399('0xa'),'paranoid':![],'indexes':[{'name':_0x9399('0xb'),'fields':['resourceId',_0x9399('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x170a=['user_profile_has_resources','compositeIndex','sectionId','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','define','UserProfileResource'];(function(_0x288f5e,_0x205edd){var _0x476cc9=function(_0x796f53){while(--_0x796f53){_0x288f5e['push'](_0x288f5e['shift']());}};_0x476cc9(++_0x205edd);}(_0x170a,0x1ca));var _0xa170=function(_0xda7a8e,_0x1f5b06){_0xda7a8e=_0xda7a8e-0x0;var _0x551cfa=_0x170a[_0xda7a8e];return _0x551cfa;};'use strict';var _=require(_0xa170('0x0'));var util=require(_0xa170('0x1'));var logger=require(_0xa170('0x2'))('api');var moment=require(_0xa170('0x3'));var BPromise=require(_0xa170('0x4'));var rp=require(_0xa170('0x5'));var fs=require('fs');var path=require(_0xa170('0x6'));var rimraf=require(_0xa170('0x7'));var config=require('../../config/environment');var attributes=require('./userProfileResource.attributes');module['exports']=function(_0x1c9323,_0x2d6243){return _0x1c9323[_0xa170('0x8')](_0xa170('0x9'),attributes,{'tableName':_0xa170('0xa'),'paranoid':![],'indexes':[{'name':_0xa170('0xb'),'fields':['resourceId',_0xa170('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 5f01395..456bd0f 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 _0x6375=['debug','stringify','error','code','message','catch','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent'];(function(_0x277721,_0x46971e){var _0x286051=function(_0x130c98){while(--_0x130c98){_0x277721['push'](_0x277721['shift']());}};_0x286051(++_0x46971e);}(_0x6375,0x99));var _0x5637=function(_0x5e42a7,_0x3eba35){_0x5e42a7=_0x5e42a7-0x0;var _0x36d21b=_0x6375[_0x5e42a7];return _0x36d21b;};'use strict';var _=require('lodash');var util=require(_0x5637('0x0'));var moment=require(_0x5637('0x1'));var BPromise=require(_0x5637('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5637('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5637('0x4'));var logger=require(_0x5637('0x5'))(_0x5637('0x6'));var config=require(_0x5637('0x7'));var jayson=require(_0x5637('0x8'));var client=jayson[_0x5637('0x9')][_0x5637('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf824de,_0x35c5f0,_0x26aa2d){return new BPromise(function(_0x5b9668,_0x1471f5){return client['request'](_0xf824de,_0x26aa2d)[_0x5637('0xb')](function(_0x190d05){logger[_0x5637('0xc')](_0x5637('0xd'),_0x35c5f0,_0x5637('0xe'));logger[_0x5637('0xf')]('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x35c5f0,_0x5637('0xe'),JSON[_0x5637('0x10')](_0x190d05));if(_0x190d05['error']){if(_0x190d05[_0x5637('0x11')][_0x5637('0x12')]===0x1f4){logger[_0x5637('0x11')](_0x5637('0xd'),_0x35c5f0,_0x190d05['error'][_0x5637('0x13')]);return _0x1471f5(_0x190d05[_0x5637('0x11')]['message']);}logger[_0x5637('0x11')](_0x5637('0xd'),_0x35c5f0,_0x190d05[_0x5637('0x11')][_0x5637('0x13')]);return _0x5b9668(_0x190d05[_0x5637('0x11')][_0x5637('0x13')]);}else{logger[_0x5637('0xc')](_0x5637('0xd'),_0x35c5f0,'request\x20sent');_0x5b9668(_0x190d05['result'][_0x5637('0x13')]);}})[_0x5637('0x14')](function(_0x2bb65b){logger[_0x5637('0x11')](_0x5637('0xd'),_0x35c5f0,_0x2bb65b);_0x1471f5(_0x2bb65b);});});} \ No newline at end of file +var _0xb1bd=['then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xb1bd,0x12b));var _0xdb1b=function(_0x332bb2,_0x20e938){_0x332bb2=_0x332bb2-0x0;var _0x1d1cdd=_0xb1bd[_0x332bb2];return _0x1d1cdd;};'use strict';var _=require(_0xdb1b('0x0'));var util=require('util');var moment=require(_0xdb1b('0x1'));var BPromise=require(_0xdb1b('0x2'));var rs=require(_0xdb1b('0x3'));var fs=require('fs');var Redis=require(_0xdb1b('0x4'));var db=require(_0xdb1b('0x5'))['db'];var utils=require(_0xdb1b('0x6'));var logger=require(_0xdb1b('0x7'))(_0xdb1b('0x8'));var config=require(_0xdb1b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xdb1b('0xa')][_0xdb1b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x277a72,_0x46d2da,_0xa59e81){return new BPromise(function(_0x139425,_0x1e4ffe){return client[_0xdb1b('0xc')](_0x277a72,_0xa59e81)[_0xdb1b('0xd')](function(_0x41ef1a){logger[_0xdb1b('0xe')](_0xdb1b('0xf'),_0x46d2da,_0xdb1b('0x10'));logger[_0xdb1b('0x11')](_0xdb1b('0x12'),_0x46d2da,'request\x20sent',JSON[_0xdb1b('0x13')](_0x41ef1a));if(_0x41ef1a[_0xdb1b('0x14')]){if(_0x41ef1a['error'][_0xdb1b('0x15')]===0x1f4){logger['error']('UserProfileResource,\x20%s,\x20%s',_0x46d2da,_0x41ef1a['error']['message']);return _0x1e4ffe(_0x41ef1a['error'][_0xdb1b('0x16')]);}logger[_0xdb1b('0x14')](_0xdb1b('0xf'),_0x46d2da,_0x41ef1a['error']['message']);return _0x139425(_0x41ef1a[_0xdb1b('0x14')]['message']);}else{logger[_0xdb1b('0xe')](_0xdb1b('0xf'),_0x46d2da,'request\x20sent');_0x139425(_0x41ef1a['result']['message']);}})[_0xdb1b('0x17')](function(_0x5ec37d){logger['error'](_0xdb1b('0xf'),_0x46d2da,_0x5ec37d);_0x1e4ffe(_0x5ec37d);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 158e349..1d59ca9 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 _0xd61e=['index','/describe','describe','/:id','show','post','create','put','update','delete','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated'];(function(_0x5a0d6c,_0x180ba4){var _0x1b9fc1=function(_0x5728e3){while(--_0x5728e3){_0x5a0d6c['push'](_0x5a0d6c['shift']());}};_0x1b9fc1(++_0x180ba4);}(_0xd61e,0x186));var _0xed61=function(_0x50bc68,_0x281d4b){_0x50bc68=_0x50bc68-0x0;var _0x5da00b=_0xd61e[_0x50bc68];return _0x5da00b;};'use strict';var multer=require(_0xed61('0x0'));var util=require('util');var path=require(_0xed61('0x1'));var timeout=require(_0xed61('0x2'));var express=require(_0xed61('0x3'));var router=express[_0xed61('0x4')]();var fs_extra=require(_0xed61('0x5'));var auth=require(_0xed61('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xed61('0x7'));var controller=require('./userProfileSection.controller');router[_0xed61('0x8')]('/',auth[_0xed61('0x9')](),controller[_0xed61('0xa')]);router['get'](_0xed61('0xb'),auth[_0xed61('0x9')](),controller[_0xed61('0xc')]);router[_0xed61('0x8')](_0xed61('0xd'),auth['isAuthenticated'](),controller[_0xed61('0xe')]);router[_0xed61('0xf')]('/',auth[_0xed61('0x9')](),controller[_0xed61('0x10')]);router[_0xed61('0x11')](_0xed61('0xd'),auth[_0xed61('0x9')](),controller[_0xed61('0x12')]);router[_0xed61('0x13')](_0xed61('0xd'),auth[_0xed61('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xa8ac=['express','fs-extra','../../components/auth/service','../../config/environment','./userProfileSection.controller','get','index','isAuthenticated','describe','post','create','put','/:id','update','delete','exports','util','path'];(function(_0x53f964,_0x3b52b8){var _0x17be6c=function(_0x25a732){while(--_0x25a732){_0x53f964['push'](_0x53f964['shift']());}};_0x17be6c(++_0x3b52b8);}(_0xa8ac,0x1ae));var _0xca8a=function(_0x37a543,_0x2b1784){_0x37a543=_0x37a543-0x0;var _0x537753=_0xa8ac[_0x37a543];return _0x537753;};'use strict';var multer=require('multer');var util=require(_0xca8a('0x0'));var path=require(_0xca8a('0x1'));var timeout=require('connect-timeout');var express=require(_0xca8a('0x2'));var router=express['Router']();var fs_extra=require(_0xca8a('0x3'));var auth=require(_0xca8a('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xca8a('0x5'));var controller=require(_0xca8a('0x6'));router[_0xca8a('0x7')]('/',auth['isAuthenticated'](),controller[_0xca8a('0x8')]);router[_0xca8a('0x7')]('/describe',auth[_0xca8a('0x9')](),controller[_0xca8a('0xa')]);router[_0xca8a('0x7')]('/:id',auth[_0xca8a('0x9')](),controller['show']);router[_0xca8a('0xb')]('/',auth[_0xca8a('0x9')](),controller[_0xca8a('0xc')]);router[_0xca8a('0xd')](_0xca8a('0xe'),auth['isAuthenticated'](),controller[_0xca8a('0xf')]);router[_0xca8a('0x10')]('/:id',auth[_0xca8a('0x9')](),controller['destroy']);module[_0xca8a('0x11')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index bc0b811..cdb8592 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 _0xab40=['STRING','setDataValue','getDataValue','crudPermissions','split','sequelize','exports','BOOLEAN'];(function(_0xf31767,_0x381746){var _0x24bd0c=function(_0x3b3472){while(--_0x3b3472){_0xf31767['push'](_0xf31767['shift']());}};_0x24bd0c(++_0x381746);}(_0xab40,0xcd));var _0x0ab4=function(_0x10a841,_0x1c9753){_0x10a841=_0x10a841-0x0;var _0x871b18=_0xab40[_0x10a841];return _0x871b18;};'use strict';var Sequelize=require(_0x0ab4('0x0'));module[_0x0ab4('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize[_0x0ab4('0x2')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x0ab4('0x2')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x0ab4('0x3')],'set':function(_0x2bf1ba){this[_0x0ab4('0x4')]('crudPermissions',_0x2bf1ba?_0x2bf1ba['join'](''):[]);},'get':function(){return this[_0x0ab4('0x5')]('crudPermissions')?this[_0x0ab4('0x5')](_0x0ab4('0x6'))[_0x0ab4('0x7')](''):[];}}}; \ No newline at end of file +var _0xcf66=['getDataValue','crudPermissions','split','sequelize','exports','STRING','INTEGER','BOOLEAN','setDataValue','join'];(function(_0x26001d,_0x30155d){var _0x4c6ffa=function(_0x33f247){while(--_0x33f247){_0x26001d['push'](_0x26001d['shift']());}};_0x4c6ffa(++_0x30155d);}(_0xcf66,0x71));var _0x6cf6=function(_0x55c275,_0x1dc38e){_0x55c275=_0x55c275-0x0;var _0x409f40=_0xcf66[_0x55c275];return _0x409f40;};'use strict';var Sequelize=require(_0x6cf6('0x0'));module[_0x6cf6('0x1')]={'name':{'type':Sequelize[_0x6cf6('0x2')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0x6cf6('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0x6cf6('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x1c599d){this[_0x6cf6('0x5')]('crudPermissions',_0x1c599d?_0x1c599d[_0x6cf6('0x6')](''):[]);},'get':function(){return this[_0x6cf6('0x7')](_0x6cf6('0x8'))?this['getDataValue'](_0x6cf6('0x8'))[_0x6cf6('0x9')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index f361755..0e45d9b 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 _0x8222=['index','fieldName','type','key','model','map','query','keys','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','options','UserProfileSection','includeAll','include','rows','show','params','find','catch','create','body','destroy','describe','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','reject','update','then','error','stack','name','send'];(function(_0x7f63d2,_0x3c4c68){var _0x3d935a=function(_0x50d4bb){while(--_0x50d4bb){_0x7f63d2['push'](_0x7f63d2['shift']());}};_0x3d935a(++_0x3c4c68);}(_0x8222,0x100));var _0x2822=function(_0x2f5cd4,_0x150621){_0x2f5cd4=_0x2f5cd4-0x0;var _0x534353=_0x8222[_0x2f5cd4];return _0x534353;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2822('0x0'));var jsonpatch=require(_0x2822('0x1'));var rp=require(_0x2822('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2822('0x3'));var util=require('util');var path=require(_0x2822('0x4'));var sox=require(_0x2822('0x5'));var csv=require(_0x2822('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2822('0x7'));var squel=require(_0x2822('0x8'));var crypto=require(_0x2822('0x9'));var jsforce=require(_0x2822('0xa'));var deskjs=require(_0x2822('0xb'));var toCsv=require(_0x2822('0x6'));var querystring=require(_0x2822('0xc'));var Papa=require('papaparse');var Redis=require(_0x2822('0xd'));var authService=require(_0x2822('0xe'));var qs=require(_0x2822('0xf'));var as=require(_0x2822('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2822('0x11'))(_0x2822('0x12'));var utils=require(_0x2822('0x13'));var config=require(_0x2822('0x14'));var licenseUtil=require(_0x2822('0x15'));var db=require(_0x2822('0x16'))['db'];function respondWithStatusCode(_0x5b7b4a,_0x44edc1){_0x44edc1=_0x44edc1||0xcc;return function(_0x2fa95d){if(_0x2fa95d){return _0x5b7b4a[_0x2822('0x17')](_0x44edc1);}return _0x5b7b4a['status'](_0x44edc1)[_0x2822('0x18')]();};}function respondWithResult(_0x549e76,_0x2d3688){_0x2d3688=_0x2d3688||0xc8;return function(_0x5d139f){if(_0x5d139f){return _0x549e76[_0x2822('0x19')](_0x2d3688)[_0x2822('0x1a')](_0x5d139f);}};}function respondWithFilteredResult(_0x36b043,_0x3da838){return function(_0x5c29fa){if(_0x5c29fa){var _0x5cd2cb=typeof _0x3da838[_0x2822('0x1b')]===_0x2822('0x1c')&&typeof _0x3da838['limit']===_0x2822('0x1c');var _0x1edcf8=_0x5c29fa[_0x2822('0x1d')];var _0x2641e6=_0x5cd2cb?0x0:_0x3da838['offset'];var _0x42ffa1=_0x5cd2cb?_0x5c29fa[_0x2822('0x1d')]:_0x3da838[_0x2822('0x1b')]+_0x3da838[_0x2822('0x1e')];var _0x49e422;if(_0x42ffa1>=_0x1edcf8){_0x42ffa1=_0x1edcf8;_0x49e422=0xc8;}else{_0x49e422=0xce;}_0x36b043[_0x2822('0x19')](_0x49e422);return _0x36b043[_0x2822('0x1f')](_0x2822('0x20'),_0x2641e6+'-'+_0x42ffa1+'/'+_0x1edcf8)[_0x2822('0x1a')](_0x5c29fa);}return null;};}function patchUpdates(_0x71ab6e){return function(_0x10c074){try{jsonpatch['apply'](_0x10c074,_0x71ab6e,!![]);}catch(_0x4e4a7e){return BPromise[_0x2822('0x21')](_0x4e4a7e);}return _0x10c074['save']();};}function saveUpdates(_0x58f08d,_0x2472b4){return function(_0x3e17a5){if(_0x3e17a5){return _0x3e17a5[_0x2822('0x22')](_0x58f08d)[_0x2822('0x23')](function(_0x156356){return _0x156356;});}return null;};}function removeEntity(_0x2ea2d6,_0x2cdea8){return function(_0x3ac74f){if(_0x3ac74f){return _0x3ac74f['destroy']()['then'](function(){_0x2ea2d6[_0x2822('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5abe2a,_0x80d529){return function(_0x1d3402){if(!_0x1d3402){_0x5abe2a[_0x2822('0x17')](0x194);}return _0x1d3402;};}function handleError(_0x31de19,_0x5b1285){_0x5b1285=_0x5b1285||0x1f4;return function(_0x1694bb){logger[_0x2822('0x24')](_0x1694bb[_0x2822('0x25')]);if(_0x1694bb[_0x2822('0x26')]){delete _0x1694bb[_0x2822('0x26')];}_0x31de19[_0x2822('0x19')](_0x5b1285)[_0x2822('0x27')](_0x1694bb);};}exports[_0x2822('0x28')]=function(_0x40fa10,_0x21ab3c){var _0x17ac7e={},_0x569b5e={},_0x176540={'count':0x0,'rows':[]};var _0x4244cc=_['map'](db['UserProfileSection']['rawAttributes'],function(_0x579906){return{'name':_0x579906[_0x2822('0x29')],'type':_0x579906[_0x2822('0x2a')][_0x2822('0x2b')]};});_0x569b5e[_0x2822('0x2c')]=_[_0x2822('0x2d')](_0x4244cc,_0x2822('0x26'));_0x569b5e[_0x2822('0x2e')]=_[_0x2822('0x2f')](_0x40fa10[_0x2822('0x2e')]);_0x569b5e['filters']=_[_0x2822('0x30')](_0x569b5e[_0x2822('0x2c')],_0x569b5e[_0x2822('0x2e')]);_0x17ac7e['attributes']=_['intersection'](_0x569b5e[_0x2822('0x2c')],qs[_0x2822('0x31')](_0x40fa10['query'][_0x2822('0x31')]));_0x17ac7e['attributes']=_0x17ac7e['attributes'][_0x2822('0x32')]?_0x17ac7e[_0x2822('0x33')]:_0x569b5e['model'];if(!_0x40fa10['query'][_0x2822('0x34')](_0x2822('0x35'))){_0x17ac7e[_0x2822('0x1e')]=qs['limit'](_0x40fa10[_0x2822('0x2e')]['limit']);_0x17ac7e[_0x2822('0x1b')]=qs[_0x2822('0x1b')](_0x40fa10[_0x2822('0x2e')][_0x2822('0x1b')]);}_0x17ac7e[_0x2822('0x36')]=qs['sort'](_0x40fa10[_0x2822('0x2e')][_0x2822('0x37')]);_0x17ac7e[_0x2822('0x38')]=qs['filters'](_[_0x2822('0x39')](_0x40fa10['query'],_0x569b5e[_0x2822('0x3a')]),_0x4244cc);if(_0x40fa10[_0x2822('0x2e')][_0x2822('0x3b')]){_0x17ac7e[_0x2822('0x38')]=_[_0x2822('0x3c')](_0x17ac7e[_0x2822('0x38')],{'$or':_[_0x2822('0x2d')](_0x4244cc,function(_0x534f0b){if(_0x534f0b[_0x2822('0x2a')]!=='VIRTUAL'){var _0x1c6881={};_0x1c6881[_0x534f0b['name']]={'$like':'%'+_0x40fa10[_0x2822('0x2e')][_0x2822('0x3b')]+'%'};return _0x1c6881;}})});}_0x17ac7e=_['merge']({},_0x17ac7e,_0x40fa10[_0x2822('0x3d')]);var _0x20163b={'where':_0x17ac7e['where']};return db[_0x2822('0x3e')][_0x2822('0x1d')](_0x20163b)[_0x2822('0x23')](function(_0x2b029b){_0x176540[_0x2822('0x1d')]=_0x2b029b;if(_0x40fa10[_0x2822('0x2e')][_0x2822('0x3f')]){_0x17ac7e[_0x2822('0x40')]=[{'all':!![]}];}return db['UserProfileSection']['findAll'](_0x17ac7e);})[_0x2822('0x23')](function(_0x3637b6){_0x176540[_0x2822('0x41')]=_0x3637b6;return _0x176540;})[_0x2822('0x23')](respondWithFilteredResult(_0x21ab3c,_0x17ac7e))['catch'](handleError(_0x21ab3c,null));};exports[_0x2822('0x42')]=function(_0x4b30c2,_0x44679c){var _0x8ba3e2={'raw':![],'where':{'id':_0x4b30c2[_0x2822('0x43')]['id']}},_0x33ba58={};_0x33ba58[_0x2822('0x2c')]=_[_0x2822('0x2f')](db[_0x2822('0x3e')]['rawAttributes']);_0x33ba58[_0x2822('0x2e')]=_[_0x2822('0x2f')](_0x4b30c2['query']);_0x33ba58[_0x2822('0x3a')]=_[_0x2822('0x30')](_0x33ba58[_0x2822('0x2c')],_0x33ba58[_0x2822('0x2e')]);_0x8ba3e2[_0x2822('0x33')]=_[_0x2822('0x30')](_0x33ba58['model'],qs['fields'](_0x4b30c2[_0x2822('0x2e')][_0x2822('0x31')]));_0x8ba3e2[_0x2822('0x33')]=_0x8ba3e2[_0x2822('0x33')][_0x2822('0x32')]?_0x8ba3e2[_0x2822('0x33')]:_0x33ba58[_0x2822('0x2c')];if(_0x4b30c2['query'][_0x2822('0x3f')]){_0x8ba3e2['include']=[{'all':!![]}];}_0x8ba3e2=_[_0x2822('0x3c')]({},_0x8ba3e2,_0x4b30c2[_0x2822('0x3d')]);return db[_0x2822('0x3e')][_0x2822('0x44')](_0x8ba3e2)[_0x2822('0x23')](handleEntityNotFound(_0x44679c,null))[_0x2822('0x23')](respondWithResult(_0x44679c,null))[_0x2822('0x45')](handleError(_0x44679c,null));};exports[_0x2822('0x46')]=function(_0x1a3541,_0x4e3b47){return db[_0x2822('0x3e')][_0x2822('0x46')](_0x1a3541[_0x2822('0x47')],{})['then'](respondWithResult(_0x4e3b47,0xc9))['catch'](handleError(_0x4e3b47,null));};exports['update']=function(_0x4c99cc,_0x44ef22){if(_0x4c99cc[_0x2822('0x47')]['id']){delete _0x4c99cc['body']['id'];}return db[_0x2822('0x3e')][_0x2822('0x44')]({'where':{'id':_0x4c99cc['params']['id']}})[_0x2822('0x23')](handleEntityNotFound(_0x44ef22,null))['then'](saveUpdates(_0x4c99cc[_0x2822('0x47')],null))[_0x2822('0x23')](respondWithResult(_0x44ef22,null))[_0x2822('0x45')](handleError(_0x44ef22,null));};exports[_0x2822('0x48')]=function(_0x3b7312,_0x15a833){return db[_0x2822('0x3e')][_0x2822('0x44')]({'where':{'id':_0x3b7312['params']['id']}})[_0x2822('0x23')](handleEntityNotFound(_0x15a833,null))[_0x2822('0x23')](removeEntity(_0x15a833,null))[_0x2822('0x45')](handleError(_0x15a833,null));};exports['describe']=function(_0x2b0cc0,_0x4a1558){return db[_0x2822('0x3e')][_0x2822('0x49')]()[_0x2822('0x23')](respondWithResult(_0x4a1558,null))[_0x2822('0x45')](handleError(_0x4a1558,null));}; \ No newline at end of file +var _0x4807=['../../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','then','sendStatus','error','stack','name','send','map','UserProfileSection','rawAttributes','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','keys','find','create','body','update','params','describe','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','crypto','desk.js','papaparse','ioredis'];(function(_0x2be255,_0x250130){var _0x491cf3=function(_0x4fefa7){while(--_0x4fefa7){_0x2be255['push'](_0x2be255['shift']());}};_0x491cf3(++_0x250130);}(_0x4807,0x19d));var _0x7480=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x4807[_0x57b54c];return _0x59cc19;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7480('0x0'));var rp=require(_0x7480('0x1'));var moment=require(_0x7480('0x2'));var BPromise=require(_0x7480('0x3'));var Mustache=require('mustache');var util=require(_0x7480('0x4'));var path=require(_0x7480('0x5'));var sox=require(_0x7480('0x6'));var csv=require(_0x7480('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7480('0x8'));var squel=require('squel');var crypto=require(_0x7480('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x7480('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7480('0xb'));var Redis=require(_0x7480('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x7480('0xd'));var as=require(_0x7480('0xe'));var hardwareService=require(_0x7480('0xf'));var logger=require(_0x7480('0x10'))(_0x7480('0x11'));var utils=require(_0x7480('0x12'));var config=require(_0x7480('0x13'));var licenseUtil=require(_0x7480('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x37b544,_0x169729){_0x169729=_0x169729||0xcc;return function(_0x22d269){if(_0x22d269){return _0x37b544['sendStatus'](_0x169729);}return _0x37b544[_0x7480('0x15')](_0x169729)[_0x7480('0x16')]();};}function respondWithResult(_0x5df216,_0x3f3837){_0x3f3837=_0x3f3837||0xc8;return function(_0x2c75be){if(_0x2c75be){return _0x5df216[_0x7480('0x15')](_0x3f3837)[_0x7480('0x17')](_0x2c75be);}};}function respondWithFilteredResult(_0x180ea2,_0x4e81fe){return function(_0x48889d){if(_0x48889d){var _0x16c5a1=typeof _0x4e81fe[_0x7480('0x18')]==='undefined'&&typeof _0x4e81fe['limit']===_0x7480('0x19');var _0x36a70a=_0x48889d[_0x7480('0x1a')];var _0x443d6c=_0x16c5a1?0x0:_0x4e81fe['offset'];var _0x3b2986=_0x16c5a1?_0x48889d['count']:_0x4e81fe[_0x7480('0x18')]+_0x4e81fe[_0x7480('0x1b')];var _0x12bbcd;if(_0x3b2986>=_0x36a70a){_0x3b2986=_0x36a70a;_0x12bbcd=0xc8;}else{_0x12bbcd=0xce;}_0x180ea2[_0x7480('0x15')](_0x12bbcd);return _0x180ea2[_0x7480('0x1c')](_0x7480('0x1d'),_0x443d6c+'-'+_0x3b2986+'/'+_0x36a70a)[_0x7480('0x17')](_0x48889d);}return null;};}function patchUpdates(_0x181d17){return function(_0x354d89){try{jsonpatch['apply'](_0x354d89,_0x181d17,!![]);}catch(_0x4f1605){return BPromise[_0x7480('0x1e')](_0x4f1605);}return _0x354d89[_0x7480('0x1f')]();};}function saveUpdates(_0x53ab05,_0x717703){return function(_0x53a0f6){if(_0x53a0f6){return _0x53a0f6['update'](_0x53ab05)[_0x7480('0x20')](function(_0x1abbf7){return _0x1abbf7;});}return null;};}function removeEntity(_0x11c66b,_0x4a63d9){return function(_0x5504da){if(_0x5504da){return _0x5504da['destroy']()[_0x7480('0x20')](function(){_0x11c66b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fee98,_0x4e50c1){return function(_0x454caa){if(!_0x454caa){_0x4fee98[_0x7480('0x21')](0x194);}return _0x454caa;};}function handleError(_0xf28d33,_0xcf341a){_0xcf341a=_0xcf341a||0x1f4;return function(_0x1394f3){logger[_0x7480('0x22')](_0x1394f3[_0x7480('0x23')]);if(_0x1394f3[_0x7480('0x24')]){delete _0x1394f3[_0x7480('0x24')];}_0xf28d33['status'](_0xcf341a)[_0x7480('0x25')](_0x1394f3);};}exports['index']=function(_0x3a3508,_0x5d2592){var _0x1951dd={},_0x233bb2={},_0x3b7a00={'count':0x0,'rows':[]};var _0x5629f2=_[_0x7480('0x26')](db[_0x7480('0x27')][_0x7480('0x28')],function(_0x449c33){return{'name':_0x449c33['fieldName'],'type':_0x449c33['type'][_0x7480('0x29')]};});_0x233bb2[_0x7480('0x2a')]=_[_0x7480('0x26')](_0x5629f2,_0x7480('0x24'));_0x233bb2[_0x7480('0x2b')]=_['keys'](_0x3a3508[_0x7480('0x2b')]);_0x233bb2[_0x7480('0x2c')]=_['intersection'](_0x233bb2['model'],_0x233bb2['query']);_0x1951dd[_0x7480('0x2d')]=_[_0x7480('0x2e')](_0x233bb2['model'],qs[_0x7480('0x2f')](_0x3a3508[_0x7480('0x2b')][_0x7480('0x2f')]));_0x1951dd[_0x7480('0x2d')]=_0x1951dd['attributes'][_0x7480('0x30')]?_0x1951dd[_0x7480('0x2d')]:_0x233bb2[_0x7480('0x2a')];if(!_0x3a3508[_0x7480('0x2b')][_0x7480('0x31')](_0x7480('0x32'))){_0x1951dd[_0x7480('0x1b')]=qs[_0x7480('0x1b')](_0x3a3508[_0x7480('0x2b')][_0x7480('0x1b')]);_0x1951dd['offset']=qs[_0x7480('0x18')](_0x3a3508[_0x7480('0x2b')][_0x7480('0x18')]);}_0x1951dd[_0x7480('0x33')]=qs[_0x7480('0x34')](_0x3a3508[_0x7480('0x2b')][_0x7480('0x34')]);_0x1951dd['where']=qs[_0x7480('0x2c')](_[_0x7480('0x35')](_0x3a3508['query'],_0x233bb2['filters']),_0x5629f2);if(_0x3a3508['query'][_0x7480('0x36')]){_0x1951dd[_0x7480('0x37')]=_[_0x7480('0x38')](_0x1951dd[_0x7480('0x37')],{'$or':_['map'](_0x5629f2,function(_0x559f66){if(_0x559f66[_0x7480('0x39')]!==_0x7480('0x3a')){var _0x24fe19={};_0x24fe19[_0x559f66[_0x7480('0x24')]]={'$like':'%'+_0x3a3508[_0x7480('0x2b')][_0x7480('0x36')]+'%'};return _0x24fe19;}})});}_0x1951dd=_[_0x7480('0x38')]({},_0x1951dd,_0x3a3508[_0x7480('0x3b')]);var _0xe9103={'where':_0x1951dd[_0x7480('0x37')]};return db[_0x7480('0x27')]['count'](_0xe9103)[_0x7480('0x20')](function(_0x412acf){_0x3b7a00[_0x7480('0x1a')]=_0x412acf;if(_0x3a3508[_0x7480('0x2b')][_0x7480('0x3c')]){_0x1951dd[_0x7480('0x3d')]=[{'all':!![]}];}return db[_0x7480('0x27')][_0x7480('0x3e')](_0x1951dd);})[_0x7480('0x20')](function(_0x2cc425){_0x3b7a00['rows']=_0x2cc425;return _0x3b7a00;})[_0x7480('0x20')](respondWithFilteredResult(_0x5d2592,_0x1951dd))[_0x7480('0x3f')](handleError(_0x5d2592,null));};exports['show']=function(_0x1c69ef,_0x4c386a){var _0x1f2a2d={'raw':![],'where':{'id':_0x1c69ef['params']['id']}},_0xcae586={};_0xcae586[_0x7480('0x2a')]=_[_0x7480('0x40')](db[_0x7480('0x27')]['rawAttributes']);_0xcae586[_0x7480('0x2b')]=_['keys'](_0x1c69ef[_0x7480('0x2b')]);_0xcae586['filters']=_[_0x7480('0x2e')](_0xcae586[_0x7480('0x2a')],_0xcae586[_0x7480('0x2b')]);_0x1f2a2d[_0x7480('0x2d')]=_['intersection'](_0xcae586[_0x7480('0x2a')],qs[_0x7480('0x2f')](_0x1c69ef['query']['fields']));_0x1f2a2d['attributes']=_0x1f2a2d[_0x7480('0x2d')][_0x7480('0x30')]?_0x1f2a2d[_0x7480('0x2d')]:_0xcae586[_0x7480('0x2a')];if(_0x1c69ef[_0x7480('0x2b')][_0x7480('0x3c')]){_0x1f2a2d['include']=[{'all':!![]}];}_0x1f2a2d=_[_0x7480('0x38')]({},_0x1f2a2d,_0x1c69ef['options']);return db['UserProfileSection'][_0x7480('0x41')](_0x1f2a2d)['then'](handleEntityNotFound(_0x4c386a,null))['then'](respondWithResult(_0x4c386a,null))[_0x7480('0x3f')](handleError(_0x4c386a,null));};exports[_0x7480('0x42')]=function(_0x58bc45,_0x4bb3e8){return db[_0x7480('0x27')][_0x7480('0x42')](_0x58bc45[_0x7480('0x43')],{})['then'](respondWithResult(_0x4bb3e8,0xc9))[_0x7480('0x3f')](handleError(_0x4bb3e8,null));};exports[_0x7480('0x44')]=function(_0xb8b129,_0x21ebed){if(_0xb8b129[_0x7480('0x43')]['id']){delete _0xb8b129[_0x7480('0x43')]['id'];}return db[_0x7480('0x27')][_0x7480('0x41')]({'where':{'id':_0xb8b129[_0x7480('0x45')]['id']}})[_0x7480('0x20')](handleEntityNotFound(_0x21ebed,null))[_0x7480('0x20')](saveUpdates(_0xb8b129[_0x7480('0x43')],null))[_0x7480('0x20')](respondWithResult(_0x21ebed,null))[_0x7480('0x3f')](handleError(_0x21ebed,null));};exports['destroy']=function(_0x2bdbb6,_0x181cba){return db[_0x7480('0x27')][_0x7480('0x41')]({'where':{'id':_0x2bdbb6[_0x7480('0x45')]['id']}})[_0x7480('0x20')](handleEntityNotFound(_0x181cba,null))['then'](removeEntity(_0x181cba,null))[_0x7480('0x3f')](handleError(_0x181cba,null));};exports['describe']=function(_0xfcd587,_0x13dd67){return db[_0x7480('0x27')][_0x7480('0x46')]()[_0x7480('0x20')](respondWithResult(_0x13dd67,null))[_0x7480('0x3f')](handleError(_0x13dd67,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 8d36eee..1e7ba27 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 _0x3287=['./userProfileSection.attributes','define','UserProfileSection','user_profile_has_sections','sectionId','userProfileId','lodash','util','../../config/logger','request-promise','path','rimraf','../../config/environment'];(function(_0x3bfdde,_0x306be4){var _0x3f752a=function(_0x3b6751){while(--_0x3b6751){_0x3bfdde['push'](_0x3bfdde['shift']());}};_0x3f752a(++_0x306be4);}(_0x3287,0x6e));var _0x7328=function(_0x1060da,_0xccb78){_0x1060da=_0x1060da-0x0;var _0x5965f8=_0x3287[_0x1060da];return _0x5965f8;};'use strict';var _=require(_0x7328('0x0'));var util=require(_0x7328('0x1'));var logger=require(_0x7328('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7328('0x3'));var fs=require('fs');var path=require(_0x7328('0x4'));var rimraf=require(_0x7328('0x5'));var config=require(_0x7328('0x6'));var attributes=require(_0x7328('0x7'));module['exports']=function(_0xbf07cc,_0x1f7143){return _0xbf07cc[_0x7328('0x8')](_0x7328('0x9'),attributes,{'tableName':_0x7328('0xa'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x7328('0xb'),_0x7328('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2003=['path','rimraf','./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','userProfileId','lodash','api','bluebird'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x2003,0xb3));var _0x3200=function(_0x2867d8,_0xef3ee0){_0x2867d8=_0x2867d8-0x0;var _0x3b8176=_0x2003[_0x2867d8];return _0x3b8176;};'use strict';var _=require(_0x3200('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3200('0x1'));var moment=require('moment');var BPromise=require(_0x3200('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3200('0x3'));var rimraf=require(_0x3200('0x4'));var config=require('../../config/environment');var attributes=require(_0x3200('0x5'));module[_0x3200('0x6')]=function(_0x165959,_0x15bad6){return _0x165959[_0x3200('0x7')](_0x3200('0x8'),attributes,{'tableName':_0x3200('0x9'),'paranoid':![],'indexes':[{'name':_0x3200('0xa'),'fields':[_0x3200('0xb'),_0x3200('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 fc653f2..6a80347 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 _0x9f7a=['../../config/environment','http','request','then','UserProfileSection,\x20%s,\x20%s','request\x20sent','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','ioredis','rpc'];(function(_0x2aefc6,_0x427e85){var _0x3bb5c5=function(_0x2236f0){while(--_0x2236f0){_0x2aefc6['push'](_0x2aefc6['shift']());}};_0x3bb5c5(++_0x427e85);}(_0x9f7a,0xf1));var _0xa9f7=function(_0x3e44fa,_0x75ed2a){_0x3e44fa=_0x3e44fa-0x0;var _0x2a0aba=_0x9f7a[_0x3e44fa];return _0x2a0aba;};'use strict';var _=require(_0xa9f7('0x0'));var util=require(_0xa9f7('0x1'));var moment=require(_0xa9f7('0x2'));var BPromise=require(_0xa9f7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa9f7('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa9f7('0x5'));var config=require(_0xa9f7('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xa9f7('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5497c8,_0x48e791,_0x5bf7ca){return new BPromise(function(_0x21010f,_0x58a3f3){return client[_0xa9f7('0x8')](_0x5497c8,_0x5bf7ca)[_0xa9f7('0x9')](function(_0x287478){logger['info'](_0xa9f7('0xa'),_0x48e791,_0xa9f7('0xb'));logger['debug'](_0xa9f7('0xc'),_0x48e791,_0xa9f7('0xb'),JSON[_0xa9f7('0xd')](_0x287478));if(_0x287478[_0xa9f7('0xe')]){if(_0x287478[_0xa9f7('0xe')][_0xa9f7('0xf')]===0x1f4){logger[_0xa9f7('0xe')]('UserProfileSection,\x20%s,\x20%s',_0x48e791,_0x287478[_0xa9f7('0xe')]['message']);return _0x58a3f3(_0x287478[_0xa9f7('0xe')][_0xa9f7('0x10')]);}logger[_0xa9f7('0xe')]('UserProfileSection,\x20%s,\x20%s',_0x48e791,_0x287478['error'][_0xa9f7('0x10')]);return _0x21010f(_0x287478['error']['message']);}else{logger[_0xa9f7('0x11')](_0xa9f7('0xa'),_0x48e791,_0xa9f7('0xb'));_0x21010f(_0x287478['result'][_0xa9f7('0x10')]);}})[_0xa9f7('0x12')](function(_0x2aeadd){logger['error'](_0xa9f7('0xa'),_0x48e791,_0x2aeadd);_0x58a3f3(_0x2aeadd);});});} \ No newline at end of file +var _0x6927=['rpc','../../config/environment','jayson/promise','http','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x23144c,_0x3bd454){var _0x72997=function(_0x2e180d){while(--_0x2e180d){_0x23144c['push'](_0x23144c['shift']());}};_0x72997(++_0x3bd454);}(_0x6927,0xf6));var _0x7692=function(_0x11abda,_0x4717aa){_0x11abda=_0x11abda-0x0;var _0x2a7ee0=_0x6927[_0x11abda];return _0x2a7ee0;};'use strict';var _=require(_0x7692('0x0'));var util=require('util');var moment=require(_0x7692('0x1'));var BPromise=require(_0x7692('0x2'));var rs=require(_0x7692('0x3'));var fs=require('fs');var Redis=require(_0x7692('0x4'));var db=require(_0x7692('0x5'))['db'];var utils=require(_0x7692('0x6'));var logger=require('../../config/logger')(_0x7692('0x7'));var config=require(_0x7692('0x8'));var jayson=require(_0x7692('0x9'));var client=jayson['client'][_0x7692('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4e4ba0,_0x543918,_0x373f0d){return new BPromise(function(_0x23a1c2,_0x2a38cb){return client[_0x7692('0xb')](_0x4e4ba0,_0x373f0d)[_0x7692('0xc')](function(_0x5c025e){logger[_0x7692('0xd')](_0x7692('0xe'),_0x543918,_0x7692('0xf'));logger[_0x7692('0x10')](_0x7692('0x11'),_0x543918,'request\x20sent',JSON[_0x7692('0x12')](_0x5c025e));if(_0x5c025e[_0x7692('0x13')]){if(_0x5c025e['error']['code']===0x1f4){logger[_0x7692('0x13')](_0x7692('0xe'),_0x543918,_0x5c025e[_0x7692('0x13')][_0x7692('0x14')]);return _0x2a38cb(_0x5c025e[_0x7692('0x13')][_0x7692('0x14')]);}logger[_0x7692('0x13')](_0x7692('0xe'),_0x543918,_0x5c025e[_0x7692('0x13')]['message']);return _0x23a1c2(_0x5c025e[_0x7692('0x13')][_0x7692('0x14')]);}else{logger[_0x7692('0xd')](_0x7692('0xe'),_0x543918,_0x7692('0xf'));_0x23a1c2(_0x5c025e[_0x7692('0x15')][_0x7692('0x14')]);}})[_0x7692('0x16')](function(_0xff1ae5){logger[_0x7692('0x13')]('UserProfileSection,\x20%s,\x20%s',_0x543918,_0xff1ae5);_0x2a38cb(_0xff1ae5);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 479cbb5..adc7e3f 100644 --- a/server/api/userSmsQueue/index.js +++ b/server/api/userSmsQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x100095,_0x236c21){var _0x3addd7=function(_0x3153a8){while(--_0x3153a8){_0x100095['push'](_0x100095['shift']());}};_0x3addd7(++_0x236c21);}(_0xe706,0xa3));var _0x6e70=function(_0x2cfb2b,_0x30c0f1){_0x2cfb2b=_0x2cfb2b-0x0;var _0x403a5c=_0xe706[_0x2cfb2b];return _0x403a5c;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x241fe1,_0x63f0b1){var _0xa3797a=function(_0x2adf26){while(--_0x2adf26){_0x241fe1['push'](_0x241fe1['shift']());}};_0xa3797a(++_0x63f0b1);}(_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/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 563dc2a..b0d4499 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 _0x106f=['exports'];(function(_0x569fef,_0x49c37a){var _0x11f20b=function(_0x3721d8){while(--_0x3721d8){_0x569fef['push'](_0x569fef['shift']());}};_0x11f20b(++_0x49c37a);}(_0x106f,0x15c));var _0xf106=function(_0x21e77a,_0x132db3){_0x21e77a=_0x21e77a-0x0;var _0x5a5fcf=_0x106f[_0x21e77a];return _0x5a5fcf;};'use strict';var Sequelize=require('sequelize');module[_0xf106('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x6d76=['exports','INTEGER','sequelize'];(function(_0x51bc5a,_0x1f602a){var _0x2af8e1=function(_0x51fa6f){while(--_0x51fa6f){_0x51bc5a['push'](_0x51bc5a['shift']());}};_0x2af8e1(++_0x1f602a);}(_0x6d76,0xa4));var _0x66d7=function(_0xe8b9b8,_0xc72320){_0xe8b9b8=_0xe8b9b8-0x0;var _0x3d1761=_0x6d76[_0xe8b9b8];return _0x3d1761;};'use strict';var Sequelize=require(_0x66d7('0x0'));module[_0x66d7('0x1')]={'penalty':{'type':Sequelize[_0x66d7('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index 8423ec8..188d45d 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 _0xb511=['rimraf','../../config/environment','exports','define','UserSmsQueue','lodash','util','../../config/logger','moment','bluebird','path'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xb511,0x165));var _0x1b51=function(_0x6aa48e,_0xd7685c){_0x6aa48e=_0x6aa48e-0x0;var _0x5ae491=_0xb511[_0x6aa48e];return _0x5ae491;};'use strict';var _=require(_0x1b51('0x0'));var util=require(_0x1b51('0x1'));var logger=require(_0x1b51('0x2'))('api');var moment=require(_0x1b51('0x3'));var BPromise=require(_0x1b51('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1b51('0x5'));var rimraf=require(_0x1b51('0x6'));var config=require(_0x1b51('0x7'));var attributes=require('./userSmsQueue.attributes');module[_0x1b51('0x8')]=function(_0x463bec,_0x506653){return _0x463bec[_0x1b51('0x9')](_0x1b51('0xa'),attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7096=['exports','define','UserSmsQueue','user_has_sms_queues','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./userSmsQueue.attributes'];(function(_0xdbd4f7,_0x4e3bdd){var _0x5c3f9d=function(_0xa7a35a){while(--_0xa7a35a){_0xdbd4f7['push'](_0xdbd4f7['shift']());}};_0x5c3f9d(++_0x4e3bdd);}(_0x7096,0x10c));var _0x6709=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x7096[_0x618414];return _0x21c19a;};'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':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index 480f688..32b3937 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 _0x3ee2=['UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info'];(function(_0x42eff3,_0x16852f){var _0x3dbfe8=function(_0x33eda7){while(--_0x33eda7){_0x42eff3['push'](_0x42eff3['shift']());}};_0x3dbfe8(++_0x16852f);}(_0x3ee2,0x1d6));var _0x23ee=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x3ee2[_0x2be8c2];return _0x97f531;};'use strict';var _=require(_0x23ee('0x0'));var util=require(_0x23ee('0x1'));var moment=require(_0x23ee('0x2'));var BPromise=require(_0x23ee('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x23ee('0x4'));var db=require(_0x23ee('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x23ee('0x6'))(_0x23ee('0x7'));var config=require(_0x23ee('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x23ee('0x9')][_0x23ee('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x11f332,_0x58cbd8,_0x18bbc9){return new BPromise(function(_0x3e05ec,_0x135201){return client[_0x23ee('0xb')](_0x11f332,_0x18bbc9)[_0x23ee('0xc')](function(_0x14d527){logger[_0x23ee('0xd')](_0x23ee('0xe'),_0x58cbd8,_0x23ee('0xf'));logger[_0x23ee('0x10')](_0x23ee('0x11'),_0x58cbd8,'request\x20sent',JSON['stringify'](_0x14d527));if(_0x14d527[_0x23ee('0x12')]){if(_0x14d527[_0x23ee('0x12')]['code']===0x1f4){logger[_0x23ee('0x12')](_0x23ee('0xe'),_0x58cbd8,_0x14d527['error'][_0x23ee('0x13')]);return _0x135201(_0x14d527[_0x23ee('0x12')][_0x23ee('0x13')]);}logger['error'](_0x23ee('0xe'),_0x58cbd8,_0x14d527[_0x23ee('0x12')]['message']);return _0x3e05ec(_0x14d527[_0x23ee('0x12')][_0x23ee('0x13')]);}else{logger['info'](_0x23ee('0xe'),_0x58cbd8,_0x23ee('0xf'));_0x3e05ec(_0x14d527[_0x23ee('0x14')][_0x23ee('0x13')]);}})[_0x23ee('0x15')](function(_0x7f5051){logger['error']('UserSmsQueue,\x20%s,\x20%s',_0x58cbd8,_0x7f5051);_0x135201(_0x7f5051);});});} \ No newline at end of file +var _0x09dc=['request\x20sent','debug','stringify','error','message','UserSmsQueue,\x20%s,\x20%s','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then'];(function(_0x5267d8,_0x3d4458){var _0x45eed9=function(_0x121f84){while(--_0x121f84){_0x5267d8['push'](_0x5267d8['shift']());}};_0x45eed9(++_0x3d4458);}(_0x09dc,0x72));var _0xc09d=function(_0x129f74,_0x3d64d8){_0x129f74=_0x129f74-0x0;var _0x1cf683=_0x09dc[_0x129f74];return _0x1cf683;};'use strict';var _=require(_0xc09d('0x0'));var util=require('util');var moment=require(_0xc09d('0x1'));var BPromise=require('bluebird');var rs=require(_0xc09d('0x2'));var fs=require('fs');var Redis=require(_0xc09d('0x3'));var db=require(_0xc09d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc09d('0x5'))(_0xc09d('0x6'));var config=require(_0xc09d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc09d('0x8')][_0xc09d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3f851f,_0x5beb0c,_0xe09747){return new BPromise(function(_0x43266e,_0x2eaf89){return client[_0xc09d('0xa')](_0x3f851f,_0xe09747)[_0xc09d('0xb')](function(_0x3468fb){logger['info']('UserSmsQueue,\x20%s,\x20%s',_0x5beb0c,_0xc09d('0xc'));logger[_0xc09d('0xd')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x5beb0c,_0xc09d('0xc'),JSON[_0xc09d('0xe')](_0x3468fb));if(_0x3468fb[_0xc09d('0xf')]){if(_0x3468fb[_0xc09d('0xf')]['code']===0x1f4){logger[_0xc09d('0xf')]('UserSmsQueue,\x20%s,\x20%s',_0x5beb0c,_0x3468fb[_0xc09d('0xf')][_0xc09d('0x10')]);return _0x2eaf89(_0x3468fb[_0xc09d('0xf')][_0xc09d('0x10')]);}logger['error'](_0xc09d('0x11'),_0x5beb0c,_0x3468fb[_0xc09d('0xf')][_0xc09d('0x10')]);return _0x43266e(_0x3468fb[_0xc09d('0xf')][_0xc09d('0x10')]);}else{logger['info'](_0xc09d('0x11'),_0x5beb0c,_0xc09d('0xc'));_0x43266e(_0x3468fb['result'][_0xc09d('0x10')]);}})['catch'](function(_0x27a659){logger['error']('UserSmsQueue,\x20%s,\x20%s',_0x5beb0c,_0x27a659);_0x2eaf89(_0x27a659);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 3664fa1..7137ad4 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 _0xf103=['INTEGER','sequelize'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xf103,0x1cd));var _0x3f10=function(_0x34daf6,_0x5db9ca){_0x34daf6=_0x34daf6-0x0;var _0xd80948=_0xf103[_0x34daf6];return _0xd80948;};'use strict';var Sequelize=require(_0x3f10('0x0'));module['exports']={'UserId':{'type':Sequelize[_0x3f10('0x1')]},'VoicePrefixId':{'type':Sequelize[_0x3f10('0x1')]}}; \ No newline at end of file +var _0xf28f=['INTEGER','sequelize'];(function(_0x4ba781,_0x46f296){var _0x4f2982=function(_0x3fbf5e){while(--_0x3fbf5e){_0x4ba781['push'](_0x4ba781['shift']());}};_0x4f2982(++_0x46f296);}(_0xf28f,0xfd));var _0xff28=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xf28f[_0x187ee1];return _0x388160;};'use strict';var Sequelize=require(_0xff28('0x0'));module['exports']={'UserId':{'type':Sequelize[_0xff28('0x1')]},'VoicePrefixId':{'type':Sequelize[_0xff28('0x1')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 31b9778..0373a90 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(_0x3e5383,_0xc31558){var _0x420d2c=function(_0x43d517){while(--_0x43d517){_0x3e5383['push'](_0x3e5383['shift']());}};_0x420d2c(++_0xc31558);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xa9e0[_0x4b7b62];return _0x2280df;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x30f640,_0x44b86a){var _0x27f1ac=function(_0x25549f){while(--_0x25549f){_0x30f640['push'](_0x30f640['shift']());}};_0x27f1ac(++_0x44b86a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'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 a05a42b..eb99245 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x168c3f,_0x177b2f){var _0x3f9e62=function(_0x1917c6){while(--_0x1917c6){_0x168c3f['push'](_0x168c3f['shift']());}};_0x3f9e62(++_0x177b2f);}(_0x70e0,0x17b));var _0x070e=function(_0x4ce1cb,_0x1ef61a){_0x4ce1cb=_0x4ce1cb-0x0;var _0x4c9100=_0x70e0[_0x4ce1cb];return _0x4c9100;};'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(_0x1aa9ae,_0x20f09b){var _0x3ca404=function(_0x537bdf){while(--_0x537bdf){_0x1aa9ae['push'](_0x1aa9ae['shift']());}};_0x3ca404(++_0x20f09b);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1602ef,_0x447aba){_0x1602ef=_0x1602ef-0x0;var _0x5870ee=_0xcb91[_0x1602ef];return _0x5870ee;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 2d153c8..cdfd707 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 _0x62b0=['exports','sequelize'];(function(_0x3eb590,_0x507722){var _0x44f08e=function(_0x116550){while(--_0x116550){_0x3eb590['push'](_0x3eb590['shift']());}};_0x44f08e(++_0x507722);}(_0x62b0,0x17d));var _0x062b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x62b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x062b('0x0'));module[_0x062b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xa990=['sequelize','exports','INTEGER'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xa990,0xc9));var _0x0a99=function(_0x491051,_0x41e03a){_0x491051=_0x491051-0x0;var _0x100277=_0xa990[_0x491051];return _0x100277;};'use strict';var Sequelize=require(_0x0a99('0x0'));module[_0x0a99('0x1')]={'penalty':{'type':Sequelize[_0x0a99('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index e8ff6eb..59a474a 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 _0x4479=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define','user_has_voice_queues','../../config/logger'];(function(_0x110881,_0x17a7c){var _0x2dcb33=function(_0x138549){while(--_0x138549){_0x110881['push'](_0x110881['shift']());}};_0x2dcb33(++_0x17a7c);}(_0x4479,0x9b));var _0x9447=function(_0x2d93f5,_0x42c94f){_0x2d93f5=_0x2d93f5-0x0;var _0x3b65c1=_0x4479[_0x2d93f5];return _0x3b65c1;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9447('0x0'))(_0x9447('0x1'));var moment=require(_0x9447('0x2'));var BPromise=require(_0x9447('0x3'));var rp=require(_0x9447('0x4'));var fs=require('fs');var path=require(_0x9447('0x5'));var rimraf=require(_0x9447('0x6'));var config=require(_0x9447('0x7'));var attributes=require(_0x9447('0x8'));module[_0x9447('0x9')]=function(_0x530838,_0xbc6215){return _0x530838[_0x9447('0xa')]('UserVoiceQueue',attributes,{'tableName':_0x9447('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6180=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','user_has_voice_queues'];(function(_0x131585,_0x1abd33){var _0x1fcca2=function(_0x8f165b){while(--_0x8f165b){_0x131585['push'](_0x131585['shift']());}};_0x1fcca2(++_0x1abd33);}(_0x6180,0x195));var _0x0618=function(_0x1474fd,_0x30b9aa){_0x1474fd=_0x1474fd-0x0;var _0x1b76e3=_0x6180[_0x1474fd];return _0x1b76e3;};'use strict';var _=require(_0x0618('0x0'));var util=require(_0x0618('0x1'));var logger=require(_0x0618('0x2'))(_0x0618('0x3'));var moment=require(_0x0618('0x4'));var BPromise=require(_0x0618('0x5'));var rp=require(_0x0618('0x6'));var fs=require('fs');var path=require(_0x0618('0x7'));var rimraf=require(_0x0618('0x8'));var config=require(_0x0618('0x9'));var attributes=require(_0x0618('0xa'));module[_0x0618('0xb')]=function(_0x44c1e7,_0x8513b1){return _0x44c1e7[_0x0618('0xc')](_0x0618('0xd'),attributes,{'tableName':_0x0618('0xe'),'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 2009739..d99b050 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 _0xd1f8=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','UserVoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','result','lodash'];(function(_0x2c8f9d,_0x44b9d8){var _0x53ee2b=function(_0x293831){while(--_0x293831){_0x2c8f9d['push'](_0x2c8f9d['shift']());}};_0x53ee2b(++_0x44b9d8);}(_0xd1f8,0x175));var _0x8d1f=function(_0x54eab6,_0x5e262f){_0x54eab6=_0x54eab6-0x0;var _0x1e7435=_0xd1f8[_0x54eab6];return _0x1e7435;};'use strict';var _=require(_0x8d1f('0x0'));var util=require(_0x8d1f('0x1'));var moment=require(_0x8d1f('0x2'));var BPromise=require('bluebird');var rs=require(_0x8d1f('0x3'));var fs=require('fs');var Redis=require(_0x8d1f('0x4'));var db=require(_0x8d1f('0x5'))['db'];var utils=require(_0x8d1f('0x6'));var logger=require(_0x8d1f('0x7'))(_0x8d1f('0x8'));var config=require(_0x8d1f('0x9'));var jayson=require(_0x8d1f('0xa'));var client=jayson[_0x8d1f('0xb')][_0x8d1f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3103df,_0x5f4fce,_0x123b3f){return new BPromise(function(_0x366170,_0x639102){return client['request'](_0x3103df,_0x123b3f)[_0x8d1f('0xd')](function(_0x5a1fe2){logger['info'](_0x8d1f('0xe'),_0x5f4fce,_0x8d1f('0xf'));logger['debug'](_0x8d1f('0x10'),_0x5f4fce,_0x8d1f('0xf'),JSON['stringify'](_0x5a1fe2));if(_0x5a1fe2[_0x8d1f('0x11')]){if(_0x5a1fe2[_0x8d1f('0x11')][_0x8d1f('0x12')]===0x1f4){logger['error'](_0x8d1f('0xe'),_0x5f4fce,_0x5a1fe2[_0x8d1f('0x11')][_0x8d1f('0x13')]);return _0x639102(_0x5a1fe2[_0x8d1f('0x11')][_0x8d1f('0x13')]);}logger[_0x8d1f('0x11')](_0x8d1f('0xe'),_0x5f4fce,_0x5a1fe2[_0x8d1f('0x11')][_0x8d1f('0x13')]);return _0x366170(_0x5a1fe2[_0x8d1f('0x11')][_0x8d1f('0x13')]);}else{logger[_0x8d1f('0x14')](_0x8d1f('0xe'),_0x5f4fce,_0x8d1f('0xf'));_0x366170(_0x5a1fe2[_0x8d1f('0x15')][_0x8d1f('0x13')]);}})['catch'](function(_0x3deb33){logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x5f4fce,_0x3deb33);_0x639102(_0x3deb33);});});} \ No newline at end of file +var _0xffb0=['code','message','info','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','then','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xffb0,0x1a9));var _0x0ffb=function(_0x382f17,_0x3e5289){_0x382f17=_0x382f17-0x0;var _0x15774f=_0xffb0[_0x382f17];return _0x15774f;};'use strict';var _=require('lodash');var util=require(_0x0ffb('0x0'));var moment=require(_0x0ffb('0x1'));var BPromise=require('bluebird');var rs=require(_0x0ffb('0x2'));var fs=require('fs');var Redis=require(_0x0ffb('0x3'));var db=require(_0x0ffb('0x4'))['db'];var utils=require(_0x0ffb('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x0ffb('0x6'));var jayson=require(_0x0ffb('0x7'));var client=jayson[_0x0ffb('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x17aa53,_0x564e79,_0x284cc0){return new BPromise(function(_0x11d96e,_0x4572c3){return client['request'](_0x17aa53,_0x284cc0)[_0x0ffb('0x9')](function(_0x50a94e){logger['info'](_0x0ffb('0xa'),_0x564e79,_0x0ffb('0xb'));logger[_0x0ffb('0xc')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x564e79,_0x0ffb('0xb'),JSON[_0x0ffb('0xd')](_0x50a94e));if(_0x50a94e[_0x0ffb('0xe')]){if(_0x50a94e['error'][_0x0ffb('0xf')]===0x1f4){logger[_0x0ffb('0xe')](_0x0ffb('0xa'),_0x564e79,_0x50a94e[_0x0ffb('0xe')][_0x0ffb('0x10')]);return _0x4572c3(_0x50a94e['error'][_0x0ffb('0x10')]);}logger[_0x0ffb('0xe')](_0x0ffb('0xa'),_0x564e79,_0x50a94e['error']['message']);return _0x11d96e(_0x50a94e[_0x0ffb('0xe')][_0x0ffb('0x10')]);}else{logger[_0x0ffb('0x11')](_0x0ffb('0xa'),_0x564e79,_0x0ffb('0xb'));_0x11d96e(_0x50a94e[_0x0ffb('0x12')][_0x0ffb('0x10')]);}})[_0x0ffb('0x13')](function(_0x2ead0c){logger[_0x0ffb('0xe')](_0x0ffb('0xa'),_0x564e79,_0x2ead0c);_0x4572c3(_0x2ead0c);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 6b567d5..ce0183e 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x1af3df,_0x7a5dc2){var _0x50eba3=function(_0x553a41){while(--_0x553a41){_0x1af3df['push'](_0x1af3df['shift']());}};_0x50eba3(++_0x7a5dc2);}(_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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0xb4d9c2,_0x13697f){var _0x4f331e=function(_0x30aec7){while(--_0x30aec7){_0xb4d9c2['push'](_0xb4d9c2['shift']());}};_0x4f331e(++_0x13697f);}(_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/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 1195081..b1c7d23 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 _0x0d83=['exports','INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface','sequelize'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x0d83,0xad));var _0x30d8=function(_0x40e109,_0x51371f){_0x40e109=_0x40e109-0x0;var _0x298269=_0x0d83[_0x40e109];return _0x298269;};'use strict';var Sequelize=require(_0x30d8('0x0'));module[_0x30d8('0x1')]={'uniqueid':{'type':Sequelize[_0x30d8('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x30d8('0x3')},'membername':{'type':Sequelize[_0x30d8('0x4')],'allowNull':![],'comment':_0x30d8('0x3')},'UserId':{'type':Sequelize[_0x30d8('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x30d8('0x4')],'allowNull':![],'unique':_0x30d8('0x5'),'comment':_0x30d8('0x3')},'VoiceQueueId':{'type':Sequelize[_0x30d8('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x30d8('0x4')],'allowNull':![],'unique':_0x30d8('0x5'),'comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize[_0x30d8('0x2')](0xb),'defaultValue':0x0,'comment':_0x30d8('0x3')},'paused':{'type':Sequelize[_0x30d8('0x2')](0xb),'defaultValue':0x0,'comment':_0x30d8('0x3')}}; \ No newline at end of file +var _0xc8a2=['Required\x20by\x20Asterisk','STRING','INTEGER','queue_interface','exports'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0xc8a2,0x86));var _0x2c8a=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xc8a2[_0x1cc8fe];return _0x230054;};'use strict';var Sequelize=require('sequelize');module[_0x2c8a('0x0')]={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':_0x2c8a('0x1')},'membername':{'type':Sequelize[_0x2c8a('0x2')],'allowNull':![],'comment':_0x2c8a('0x1')},'UserId':{'type':Sequelize[_0x2c8a('0x3')],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x2c8a('0x4'),'comment':_0x2c8a('0x1')},'VoiceQueueId':{'type':Sequelize[_0x2c8a('0x3')],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':'queue_interface','comment':_0x2c8a('0x1')},'penalty':{'type':Sequelize[_0x2c8a('0x3')](0xb),'defaultValue':0x0,'comment':_0x2c8a('0x1')},'paused':{'type':Sequelize[_0x2c8a('0x3')](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 eae4411..d41ddf6 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 _0x441b=['hasOwnProperty','exports','events','UserVoiceQueueRt','setMaxListeners','remove','emit'];(function(_0x4625b3,_0x3e17e6){var _0xf819b9=function(_0x1cc9a6){while(--_0x1cc9a6){_0x4625b3['push'](_0x4625b3['shift']());}};_0xf819b9(++_0x3e17e6);}(_0x441b,0x113));var _0xb441=function(_0x5c6081,_0x247a8f){_0x5c6081=_0x5c6081-0x0;var _0x10aadb=_0x441b[_0x5c6081];return _0x10aadb;};'use strict';var EventEmitter=require(_0xb441('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db'][_0xb441('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xb441('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xb441('0x3')};function emitEvent(_0x599658){return function(_0x123bfb,_0x3dc09e,_0x509822){UserVoiceQueueRtEvents[_0xb441('0x4')](_0x599658+':'+_0x123bfb['id'],_0x123bfb);UserVoiceQueueRtEvents['emit'](_0x599658,_0x123bfb);_0x509822(null);};}for(var e in events){if(events[_0xb441('0x5')](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module[_0xb441('0x6')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x57e9=['exports','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','emit','hasOwnProperty','hook'];(function(_0xbc2d06,_0x275f68){var _0x45a543=function(_0x478200){while(--_0x478200){_0xbc2d06['push'](_0xbc2d06['shift']());}};_0x45a543(++_0x275f68);}(_0x57e9,0x91));var _0x957e=function(_0x296444,_0x27811e){_0x296444=_0x296444-0x0;var _0x52e24c=_0x57e9[_0x296444];return _0x52e24c;};'use strict';var EventEmitter=require(_0x957e('0x0'));var UserVoiceQueueRt=require(_0x957e('0x1'))['db'][_0x957e('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x957e('0x3')](0x0);var events={'afterCreate':_0x957e('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x245402){return function(_0x35aa1b,_0x3beb3c,_0x1e825a){UserVoiceQueueRtEvents[_0x957e('0x5')](_0x245402+':'+_0x35aa1b['id'],_0x35aa1b);UserVoiceQueueRtEvents[_0x957e('0x5')](_0x245402,_0x35aa1b);_0x1e825a(null);};}for(var e in events){if(events[_0x957e('0x6')](e)){var event=events[e];UserVoiceQueueRt[_0x957e('0x7')](e,emitEvent(event));}}module[_0x957e('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 567396c..2a90888 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 _0xb230=['UserVoiceQueueRt','user_has_voice_queues_rt','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes'];(function(_0x42bc91,_0x41f40a){var _0x3f5507=function(_0x20cfaf){while(--_0x20cfaf){_0x42bc91['push'](_0x42bc91['shift']());}};_0x3f5507(++_0x41f40a);}(_0xb230,0x16d));var _0x0b23=function(_0x532259,_0x266ff3){_0x532259=_0x532259-0x0;var _0x69018b=_0xb230[_0x532259];return _0x69018b;};'use strict';var _=require('lodash');var util=require(_0x0b23('0x0'));var logger=require(_0x0b23('0x1'))(_0x0b23('0x2'));var moment=require(_0x0b23('0x3'));var BPromise=require('bluebird');var rp=require(_0x0b23('0x4'));var fs=require('fs');var path=require(_0x0b23('0x5'));var rimraf=require(_0x0b23('0x6'));var config=require(_0x0b23('0x7'));var attributes=require(_0x0b23('0x8'));module['exports']=function(_0x54a1af,_0x277aed){return _0x54a1af['define'](_0x0b23('0x9'),attributes,{'tableName':_0x0b23('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeb33=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xeb33,0x186));var _0x3eb3=function(_0x418aaf,_0x280c52){_0x418aaf=_0x418aaf-0x0;var _0x54fc7a=_0xeb33[_0x418aaf];return _0x54fc7a;};'use strict';var _=require(_0x3eb3('0x0'));var util=require(_0x3eb3('0x1'));var logger=require(_0x3eb3('0x2'))(_0x3eb3('0x3'));var moment=require(_0x3eb3('0x4'));var BPromise=require('bluebird');var rp=require(_0x3eb3('0x5'));var fs=require('fs');var path=require(_0x3eb3('0x6'));var rimraf=require(_0x3eb3('0x7'));var config=require(_0x3eb3('0x8'));var attributes=require(_0x3eb3('0x9'));module[_0x3eb3('0xa')]=function(_0x450d34,_0x214fb1){return _0x450d34[_0x3eb3('0xb')](_0x3eb3('0xc'),attributes,{'tableName':_0x3eb3('0xd'),'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 63b7d42..1570576 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 _0x6285=['`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./userVoiceQueueRt.socket','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','where','sequelize','COUNT','literal'];(function(_0x136ee2,_0x3919db){var _0x134202=function(_0x4842b4){while(--_0x4842b4){_0x136ee2['push'](_0x136ee2['shift']());}};_0x134202(++_0x3919db);}(_0x6285,0x1a4));var _0x5628=function(_0x485744,_0x590b7f){_0x485744=_0x485744-0x0;var _0x3f73a8=_0x6285[_0x485744];return _0x3f73a8;};'use strict';var _=require(_0x5628('0x0'));var util=require(_0x5628('0x1'));var moment=require(_0x5628('0x2'));var BPromise=require(_0x5628('0x3'));var rs=require(_0x5628('0x4'));var fs=require('fs');var Redis=require(_0x5628('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5628('0x6'));var logger=require(_0x5628('0x7'))(_0x5628('0x8'));var config=require(_0x5628('0x9'));var jayson=require(_0x5628('0xa'));var client=jayson[_0x5628('0xb')]['http']({'port':0x232a});config[_0x5628('0xc')]=_['defaults'](config[_0x5628('0xc')],{'host':_0x5628('0xd'),'port':0x18eb});var socket=require(_0x5628('0xe'))(new Redis(config[_0x5628('0xc')]));require(_0x5628('0xf'))['register'](socket);function respondWithRpcPromise(_0x49febb,_0x1f8b26,_0x200067){return new BPromise(function(_0x1f3602,_0x2e3d19){return client['request'](_0x49febb,_0x200067)[_0x5628('0x10')](function(_0x1f7a1c){logger[_0x5628('0x11')](_0x5628('0x12'),_0x1f8b26,_0x5628('0x13'));logger[_0x5628('0x14')](_0x5628('0x15'),_0x1f8b26,_0x5628('0x13'),JSON['stringify'](_0x1f7a1c));if(_0x1f7a1c[_0x5628('0x16')]){if(_0x1f7a1c['error'][_0x5628('0x17')]===0x1f4){logger[_0x5628('0x16')](_0x5628('0x12'),_0x1f8b26,_0x1f7a1c[_0x5628('0x16')][_0x5628('0x18')]);return _0x2e3d19(_0x1f7a1c['error']['message']);}logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0x1f8b26,_0x1f7a1c[_0x5628('0x16')][_0x5628('0x18')]);return _0x1f3602(_0x1f7a1c['error'][_0x5628('0x18')]);}else{logger[_0x5628('0x11')](_0x5628('0x12'),_0x1f8b26,_0x5628('0x13'));_0x1f3602(_0x1f7a1c[_0x5628('0x19')][_0x5628('0x18')]);}})[_0x5628('0x1a')](function(_0x16f530){logger[_0x5628('0x16')](_0x5628('0x12'),_0x1f8b26,_0x16f530);_0x2e3d19(_0x16f530);});});}exports[_0x5628('0x1b')]=function(_0x4f8608){var _0x204729=this;return new Promise(function(_0x2d6198,_0x5a216e){return db[_0x5628('0x1c')][_0x5628('0x1d')]({'raw':_0x4f8608[_0x5628('0x1e')]?_0x4f8608[_0x5628('0x1e')][_0x5628('0x1f')]===undefined?!![]:![]:!![],'where':_0x4f8608[_0x5628('0x1e')]?_0x4f8608[_0x5628('0x1e')][_0x5628('0x20')]||null:null,'attributes':[[db[_0x5628('0x21')]['fn'](_0x5628('0x22'),db['sequelize']['fn']('IF',db[_0x5628('0x21')][_0x5628('0x23')](_0x5628('0x24')))),_0x5628('0x25')]]})['then'](function(_0x545d69){logger[_0x5628('0x11')]('GetVoiceQueueRtPauses',_0x4f8608);logger[_0x5628('0x14')](_0x5628('0x1b'),_0x4f8608,JSON['stringify'](_0x545d69));_0x2d6198(_0x545d69);})[_0x5628('0x1a')](function(_0x496ec3){logger[_0x5628('0x16')](_0x5628('0x1b'),_0x496ec3[_0x5628('0x18')],_0x4f8608);_0x5a216e(_0x204729[_0x5628('0x16')](0x1f4,_0x496ec3[_0x5628('0x18')]));});});}; \ No newline at end of file +var _0xf648=['outboundQueuePauses','stringify','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./userVoiceQueueRt.socket','register','request','then','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','error','code','UserVoiceQueueRt,\x20%s,\x20%s','message','info','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','where','sequelize','`paused`\x20=\x201,\x201,\x20null'];(function(_0x2e8d01,_0x12fe7a){var _0x92efe5=function(_0x4fb17a){while(--_0x4fb17a){_0x2e8d01['push'](_0x2e8d01['shift']());}};_0x92efe5(++_0x12fe7a);}(_0xf648,0xa7));var _0x8f64=function(_0x1000e3,_0x994865){_0x1000e3=_0x1000e3-0x0;var _0x5493d7=_0xf648[_0x1000e3];return _0x5493d7;};'use strict';var _=require('lodash');var util=require(_0x8f64('0x0'));var moment=require(_0x8f64('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8f64('0x2'))['db'];var utils=require(_0x8f64('0x3'));var logger=require(_0x8f64('0x4'))(_0x8f64('0x5'));var config=require(_0x8f64('0x6'));var jayson=require(_0x8f64('0x7'));var client=jayson['client'][_0x8f64('0x8')]({'port':0x232a});config[_0x8f64('0x9')]=_[_0x8f64('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x8f64('0xb'))(new Redis(config[_0x8f64('0x9')]));require(_0x8f64('0xc'))[_0x8f64('0xd')](socket);function respondWithRpcPromise(_0xb8f287,_0x5512f3,_0x2203b6){return new BPromise(function(_0x5ebade,_0x2c6a44){return client[_0x8f64('0xe')](_0xb8f287,_0x2203b6)[_0x8f64('0xf')](function(_0x592acb){logger['info']('UserVoiceQueueRt,\x20%s,\x20%s',_0x5512f3,_0x8f64('0x10'));logger[_0x8f64('0x11')](_0x8f64('0x12'),_0x5512f3,'request\x20sent',JSON['stringify'](_0x592acb));if(_0x592acb[_0x8f64('0x13')]){if(_0x592acb['error'][_0x8f64('0x14')]===0x1f4){logger[_0x8f64('0x13')](_0x8f64('0x15'),_0x5512f3,_0x592acb[_0x8f64('0x13')]['message']);return _0x2c6a44(_0x592acb[_0x8f64('0x13')]['message']);}logger[_0x8f64('0x13')](_0x8f64('0x15'),_0x5512f3,_0x592acb[_0x8f64('0x13')][_0x8f64('0x16')]);return _0x5ebade(_0x592acb[_0x8f64('0x13')][_0x8f64('0x16')]);}else{logger[_0x8f64('0x17')](_0x8f64('0x15'),_0x5512f3,_0x8f64('0x10'));_0x5ebade(_0x592acb['result'][_0x8f64('0x16')]);}})['catch'](function(_0x1d4fe2){logger[_0x8f64('0x13')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x5512f3,_0x1d4fe2);_0x2c6a44(_0x1d4fe2);});});}exports[_0x8f64('0x18')]=function(_0x270d2d){var _0x47e9e6=this;return new Promise(function(_0x30f64e,_0x2a09a7){return db[_0x8f64('0x19')][_0x8f64('0x1a')]({'raw':_0x270d2d[_0x8f64('0x1b')]?_0x270d2d['options']['raw']===undefined?!![]:![]:!![],'where':_0x270d2d['options']?_0x270d2d[_0x8f64('0x1b')][_0x8f64('0x1c')]||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db[_0x8f64('0x1d')]['fn']('IF',db[_0x8f64('0x1d')]['literal'](_0x8f64('0x1e')))),_0x8f64('0x1f')]]})['then'](function(_0xa7ded1){logger[_0x8f64('0x17')](_0x8f64('0x18'),_0x270d2d);logger[_0x8f64('0x11')](_0x8f64('0x18'),_0x270d2d,JSON[_0x8f64('0x20')](_0xa7ded1));_0x30f64e(_0xa7ded1);})['catch'](function(_0x19b8bb){logger[_0x8f64('0x13')](_0x8f64('0x18'),_0x19b8bb[_0x8f64('0x16')],_0x270d2d);_0x2a09a7(_0x47e9e6[_0x8f64('0x13')](0x1f4,_0x19b8bb[_0x8f64('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 27d341a..77dd50c 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 _0x4148=['register','userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove','update','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4148,0xc6));var _0x8414=function(_0x13256a,_0x44d0a2){_0x13256a=_0x13256a-0x0;var _0x59ad3b=_0x4148[_0x13256a];return _0x59ad3b;};'use strict';var UserVoiceQueueRtEvents=require(_0x8414('0x0'));var events=[_0x8414('0x1'),_0x8414('0x2'),_0x8414('0x3')];function createListener(_0x27bb22,_0x4b1e25){return function(_0x1be902){_0x4b1e25[_0x8414('0x4')](_0x27bb22,_0x1be902);};}function removeListener(_0x41ddde,_0x361d0b){return function(){UserVoiceQueueRtEvents['removeListener'](_0x41ddde,_0x361d0b);};}exports[_0x8414('0x5')]=function(_0x5119d0){for(var _0x8b350a=0x0,_0x507e0b=events['length'];_0x8b350a<_0x507e0b;_0x8b350a++){var _0x131b88=events[_0x8b350a];var _0x2444b7=createListener(_0x8414('0x6')+_0x131b88,_0x5119d0);UserVoiceQueueRtEvents['on'](_0x131b88,_0x2444b7);}}; \ No newline at end of file +var _0xbe2a=['userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove','update','removeListener','register','length'];(function(_0x494d4e,_0x24ca57){var _0x1da78f=function(_0x24bbd1){while(--_0x24bbd1){_0x494d4e['push'](_0x494d4e['shift']());}};_0x1da78f(++_0x24ca57);}(_0xbe2a,0x1d9));var _0xabe2=function(_0x207659,_0x3a6d62){_0x207659=_0x207659-0x0;var _0x5c161c=_0xbe2a[_0x207659];return _0x5c161c;};'use strict';var UserVoiceQueueRtEvents=require(_0xabe2('0x0'));var events=[_0xabe2('0x1'),_0xabe2('0x2'),_0xabe2('0x3')];function createListener(_0x29d9a3,_0x373f35){return function(_0x21e3ad){_0x373f35['emit'](_0x29d9a3,_0x21e3ad);};}function removeListener(_0x42fbad,_0x4f80bf){return function(){UserVoiceQueueRtEvents[_0xabe2('0x4')](_0x42fbad,_0x4f80bf);};}exports[_0xabe2('0x5')]=function(_0x2ddf42){for(var _0x475007=0x0,_0x3538a0=events[_0xabe2('0x6')];_0x475007<_0x3538a0;_0x475007++){var _0x5347ca=events[_0x475007];var _0x1c5c5c=createListener(_0xabe2('0x7')+_0x5347ca,_0x2ddf42);UserVoiceQueueRtEvents['on'](_0x5347ca,_0x1c5c5c);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 9a9fc69..41d518b 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(_0x582fe4,_0x48a7cc){var _0x5a8cd4=function(_0x5e4f30){while(--_0x5e4f30){_0x582fe4['push'](_0x582fe4['shift']());}};_0x5a8cd4(++_0x48a7cc);}(_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(_0x3c130c,_0xe0aa05){var _0x41d44b=function(_0x393acd){while(--_0x393acd){_0x3c130c['push'](_0x3c130c['shift']());}};_0x41d44b(++_0xe0aa05);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x243217,_0x522951){_0x243217=_0x243217-0x0;var _0x478029=_0xcb91[_0x243217];return _0x478029;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 6317c8f..9b375ad 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 _0x8587=['sequelize','exports','INTEGER'];(function(_0xc31d1a,_0x525064){var _0x4de51c=function(_0x5591ad){while(--_0x5591ad){_0xc31d1a['push'](_0xc31d1a['shift']());}};_0x4de51c(++_0x525064);}(_0x8587,0x1a1));var _0x7858=function(_0x2dee47,_0x18df35){_0x2dee47=_0x2dee47-0x0;var _0x1bb981=_0x8587[_0x2dee47];return _0x1bb981;};'use strict';var Sequelize=require(_0x7858('0x0'));module[_0x7858('0x1')]={'penalty':{'type':Sequelize[_0x7858('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xae16=['sequelize','INTEGER'];(function(_0x351279,_0x56eb25){var _0x280854=function(_0x3b4072){while(--_0x3b4072){_0x351279['push'](_0x351279['shift']());}};_0x280854(++_0x56eb25);}(_0xae16,0xee));var _0x6ae1=function(_0x12779f,_0x534537){_0x12779f=_0x12779f-0x0;var _0x530c42=_0xae16[_0x12779f];return _0x530c42;};'use strict';var Sequelize=require(_0x6ae1('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x6ae1('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index 0530f10..59b7c0b 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 _0x41e3=['exports','define','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./userWhatsappQueue.attributes'];(function(_0x2fa334,_0xa351de){var _0x5b846c=function(_0x2badc6){while(--_0x2badc6){_0x2fa334['push'](_0x2fa334['shift']());}};_0x5b846c(++_0xa351de);}(_0x41e3,0x199));var _0x341e=function(_0x34e46d,_0x5df86a){_0x34e46d=_0x34e46d-0x0;var _0x1cc6aa=_0x41e3[_0x34e46d];return _0x1cc6aa;};'use strict';var _=require(_0x341e('0x0'));var util=require(_0x341e('0x1'));var logger=require(_0x341e('0x2'))(_0x341e('0x3'));var moment=require(_0x341e('0x4'));var BPromise=require(_0x341e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x341e('0x6'));var rimraf=require('rimraf');var config=require(_0x341e('0x7'));var attributes=require(_0x341e('0x8'));module[_0x341e('0x9')]=function(_0x54dc9c,_0x24ac51){return _0x54dc9c[_0x341e('0xa')]('UserWhatsappQueue',attributes,{'tableName':'user_has_whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x575d=['api','moment','bluebird','request-promise','path','../../config/environment','./userWhatsappQueue.attributes','exports','define','user_has_whatsapp_queues','lodash','util'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x575d,0xb2));var _0xd575=function(_0x4c35fa,_0x5b6cec){_0x4c35fa=_0x4c35fa-0x0;var _0x413606=_0x575d[_0x4c35fa];return _0x413606;};'use strict';var _=require(_0xd575('0x0'));var util=require(_0xd575('0x1'));var logger=require('../../config/logger')(_0xd575('0x2'));var moment=require(_0xd575('0x3'));var BPromise=require(_0xd575('0x4'));var rp=require(_0xd575('0x5'));var fs=require('fs');var path=require(_0xd575('0x6'));var rimraf=require('rimraf');var config=require(_0xd575('0x7'));var attributes=require(_0xd575('0x8'));module[_0xd575('0x9')]=function(_0x3889f3,_0x1419bc){return _0x3889f3[_0xd575('0xa')]('UserWhatsappQueue',attributes,{'tableName':_0xd575('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index 07ec5d2..91807cb 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 _0x4ef7=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserWhatsappQueue,\x20%s,\x20%s','message','result','catch'];(function(_0x8d695e,_0x394999){var _0x3d156e=function(_0x38cf6f){while(--_0x38cf6f){_0x8d695e['push'](_0x8d695e['shift']());}};_0x3d156e(++_0x394999);}(_0x4ef7,0x138));var _0x74ef=function(_0x430715,_0x4d76f5){_0x430715=_0x430715-0x0;var _0x2cf334=_0x4ef7[_0x430715];return _0x2cf334;};'use strict';var _=require('lodash');var util=require(_0x74ef('0x0'));var moment=require(_0x74ef('0x1'));var BPromise=require(_0x74ef('0x2'));var rs=require(_0x74ef('0x3'));var fs=require('fs');var Redis=require(_0x74ef('0x4'));var db=require(_0x74ef('0x5'))['db'];var utils=require(_0x74ef('0x6'));var logger=require(_0x74ef('0x7'))(_0x74ef('0x8'));var config=require(_0x74ef('0x9'));var jayson=require(_0x74ef('0xa'));var client=jayson[_0x74ef('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x52c460,_0x2bc4fd,_0x1c12c9){return new BPromise(function(_0x3a5983,_0x4f8912){return client[_0x74ef('0xc')](_0x52c460,_0x1c12c9)[_0x74ef('0xd')](function(_0x53e5c3){logger[_0x74ef('0xe')]('UserWhatsappQueue,\x20%s,\x20%s',_0x2bc4fd,_0x74ef('0xf'));logger['debug'](_0x74ef('0x10'),_0x2bc4fd,_0x74ef('0xf'),JSON[_0x74ef('0x11')](_0x53e5c3));if(_0x53e5c3[_0x74ef('0x12')]){if(_0x53e5c3[_0x74ef('0x12')][_0x74ef('0x13')]===0x1f4){logger['error'](_0x74ef('0x14'),_0x2bc4fd,_0x53e5c3['error'][_0x74ef('0x15')]);return _0x4f8912(_0x53e5c3[_0x74ef('0x12')][_0x74ef('0x15')]);}logger[_0x74ef('0x12')](_0x74ef('0x14'),_0x2bc4fd,_0x53e5c3[_0x74ef('0x12')]['message']);return _0x3a5983(_0x53e5c3['error'][_0x74ef('0x15')]);}else{logger['info'](_0x74ef('0x14'),_0x2bc4fd,_0x74ef('0xf'));_0x3a5983(_0x53e5c3[_0x74ef('0x16')]['message']);}})[_0x74ef('0x17')](function(_0x5941d4){logger['error'](_0x74ef('0x14'),_0x2bc4fd,_0x5941d4);_0x4f8912(_0x5941d4);});});} \ No newline at end of file +var _0x159d=['../../config/logger','../../config/environment','jayson/promise','http','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x20aad0,_0x41a776){var _0x2a21ad=function(_0x4b7236){while(--_0x4b7236){_0x20aad0['push'](_0x20aad0['shift']());}};_0x2a21ad(++_0x41a776);}(_0x159d,0xdf));var _0xd159=function(_0x18f76d,_0x534402){_0x18f76d=_0x18f76d-0x0;var _0xb70ebd=_0x159d[_0x18f76d];return _0xb70ebd;};'use strict';var _=require('lodash');var util=require(_0xd159('0x0'));var moment=require('moment');var BPromise=require(_0xd159('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd159('0x2'));var db=require(_0xd159('0x3'))['db'];var utils=require(_0xd159('0x4'));var logger=require(_0xd159('0x5'))('rpc');var config=require(_0xd159('0x6'));var jayson=require(_0xd159('0x7'));var client=jayson['client'][_0xd159('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x13da48,_0x4fa7fc,_0x444940){return new BPromise(function(_0x48d760,_0x71008d){return client['request'](_0x13da48,_0x444940)['then'](function(_0x5e27e2){logger[_0xd159('0x9')](_0xd159('0xa'),_0x4fa7fc,_0xd159('0xb'));logger['debug'](_0xd159('0xc'),_0x4fa7fc,_0xd159('0xb'),JSON[_0xd159('0xd')](_0x5e27e2));if(_0x5e27e2[_0xd159('0xe')]){if(_0x5e27e2[_0xd159('0xe')][_0xd159('0xf')]===0x1f4){logger[_0xd159('0xe')](_0xd159('0xa'),_0x4fa7fc,_0x5e27e2[_0xd159('0xe')][_0xd159('0x10')]);return _0x71008d(_0x5e27e2[_0xd159('0xe')][_0xd159('0x10')]);}logger[_0xd159('0xe')](_0xd159('0xa'),_0x4fa7fc,_0x5e27e2[_0xd159('0xe')][_0xd159('0x10')]);return _0x48d760(_0x5e27e2['error'][_0xd159('0x10')]);}else{logger[_0xd159('0x9')](_0xd159('0xa'),_0x4fa7fc,_0xd159('0xb'));_0x48d760(_0x5e27e2[_0xd159('0x11')][_0xd159('0x10')]);}})[_0xd159('0x12')](function(_0x3dd3ae){logger[_0xd159('0xe')](_0xd159('0xa'),_0x4fa7fc,_0x3dd3ae);_0x71008d(_0x3dd3ae);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index ba3802c..b15e28b 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 _0x765b=['put','/:id','destroy','exports','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','post','create'];(function(_0x290694,_0x281935){var _0x5a0f2e=function(_0x58d7d4){while(--_0x58d7d4){_0x290694['push'](_0x290694['shift']());}};_0x5a0f2e(++_0x281935);}(_0x765b,0x18c));var _0xb765=function(_0x5c72ee,_0x5a8bf8){_0x5c72ee=_0x5c72ee-0x0;var _0x231876=_0x765b[_0x5c72ee];return _0x231876;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xb765('0x0'));var express=require('express');var router=express[_0xb765('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0xb765('0x2'));var interaction=require(_0xb765('0x3'));var config=require(_0xb765('0x4'));var controller=require('./variable.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xb765('0x5')]('/:id',auth[_0xb765('0x6')](),controller[_0xb765('0x7')]);router[_0xb765('0x8')]('/',auth['isAuthenticated'](),controller[_0xb765('0x9')]);router[_0xb765('0xa')](_0xb765('0xb'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xb765('0xb'),auth[_0xb765('0x6')](),controller[_0xb765('0xc')]);module[_0xb765('0xd')]=router; \ No newline at end of file +var _0x6737=['delete','destroy','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./variable.controller','isAuthenticated','index','post','create','put','update'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x6737,0xe2));var _0x7673=function(_0x42bc26,_0x59db8b){_0x42bc26=_0x42bc26-0x0;var _0x32e312=_0x6737[_0x42bc26];return _0x32e312;};'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')]('/',auth['isAuthenticated'](),controller[_0x7673('0xb')]);router[_0x7673('0xc')]('/:id',auth[_0x7673('0x8')](),controller[_0x7673('0xd')]);router[_0x7673('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x7673('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 8bceecd..ddfd6d6 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 _0xba07=['STRING','name','sequelize','exports'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xba07,0xc6));var _0x7ba0=function(_0x3ebf0f,_0x24752b){_0x3ebf0f=_0x3ebf0f-0x0;var _0x6aca35=_0xba07[_0x3ebf0f];return _0x6aca35;};'use strict';var Sequelize=require(_0x7ba0('0x0'));module[_0x7ba0('0x1')]={'name':{'type':Sequelize[_0x7ba0('0x2')],'unique':_0x7ba0('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x7ba0('0x2')]}}; \ No newline at end of file +var _0xe7b3=['sequelize','name','STRING'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0xe7b3,0x1b6));var _0x3e7b=function(_0x2fdd79,_0x4118e3){_0x2fdd79=_0x2fdd79-0x0;var _0x4a14c6=_0xe7b3[_0x2fdd79];return _0x4a14c6;};'use strict';var Sequelize=require(_0x3e7b('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x3e7b('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x3e7b('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 81b684a..416a6b6 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 _0x392a=['sort','where','filter','merge','Variable','includeAll','include','findAll','catch','show','params','keys','length','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','Variables','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','update','destroy','then','UserProfileResource','sendStatus','error','name','send','map','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','nolimit','order'];(function(_0x2025c4,_0x19b9ce){var _0x547fc3=function(_0x5e956a){while(--_0x5e956a){_0x2025c4['push'](_0x2025c4['shift']());}};_0x547fc3(++_0x19b9ce);}(_0x392a,0x66));var _0xa392=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x392a[_0x8c43de];return _0xa6591b;};'use strict';var emlformat=require(_0xa392('0x0'));var rimraf=require(_0xa392('0x1'));var zipdir=require(_0xa392('0x2'));var jsonpatch=require(_0xa392('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa392('0x4'));var Mustache=require(_0xa392('0x5'));var util=require(_0xa392('0x6'));var path=require(_0xa392('0x7'));var sox=require(_0xa392('0x8'));var csv=require(_0xa392('0x9'));var ejs=require(_0xa392('0xa'));var fs=require('fs');var fs_extra=require(_0xa392('0xb'));var _=require(_0xa392('0xc'));var squel=require('squel');var crypto=require(_0xa392('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa392('0x9'));var querystring=require(_0xa392('0xe'));var Papa=require(_0xa392('0xf'));var Redis=require(_0xa392('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xa392('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa392('0x12'));var utils=require(_0xa392('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xa392('0x14'));var db=require(_0xa392('0x15'))['db'];function respondWithStatusCode(_0x3b024d,_0xdfe05){_0xdfe05=_0xdfe05||0xcc;return function(_0x3d8087){if(_0x3d8087){return _0x3b024d['sendStatus'](_0xdfe05);}return _0x3b024d[_0xa392('0x16')](_0xdfe05)[_0xa392('0x17')]();};}function respondWithResult(_0x127440,_0x28afd2){_0x28afd2=_0x28afd2||0xc8;return function(_0x27b785){if(_0x27b785){return _0x127440['status'](_0x28afd2)[_0xa392('0x18')](_0x27b785);}};}function respondWithFilteredResult(_0xf9e40d,_0x3f2966){return function(_0x52cd2e){if(_0x52cd2e){var _0x6c6836=typeof _0x3f2966[_0xa392('0x19')]===_0xa392('0x1a')&&typeof _0x3f2966['limit']===_0xa392('0x1a');var _0x306b38=_0x52cd2e[_0xa392('0x1b')];var _0x56c68c=_0x6c6836?0x0:_0x3f2966[_0xa392('0x19')];var _0x19615b=_0x6c6836?_0x52cd2e[_0xa392('0x1b')]:_0x3f2966['offset']+_0x3f2966[_0xa392('0x1c')];var _0x538c29;if(_0x19615b>=_0x306b38){_0x19615b=_0x306b38;_0x538c29=0xc8;}else{_0x538c29=0xce;}_0xf9e40d[_0xa392('0x16')](_0x538c29);return _0xf9e40d[_0xa392('0x1d')](_0xa392('0x1e'),_0x56c68c+'-'+_0x19615b+'/'+_0x306b38)[_0xa392('0x18')](_0x52cd2e);}return null;};}function patchUpdates(_0x5a463d){return function(_0x18f8ec){try{jsonpatch[_0xa392('0x1f')](_0x18f8ec,_0x5a463d,!![]);}catch(_0x16cbf5){return BPromise['reject'](_0x16cbf5);}return _0x18f8ec['save']();};}function saveUpdates(_0x130656,_0xda9856){return function(_0x44e77e){if(_0x44e77e){return _0x44e77e[_0xa392('0x20')](_0x130656)['then'](function(_0x17c12b){return _0x17c12b;});}return null;};}function removeEntity(_0x20d212,_0x28ff51){return function(_0x1eaa7b){if(_0x1eaa7b){return _0x1eaa7b[_0xa392('0x21')]()[_0xa392('0x22')](function(){var _0x17954e=_0x1eaa7b['get']({'plain':!![]});var _0x30c151='Variables';return db[_0xa392('0x23')][_0xa392('0x21')]({'where':{'type':_0x30c151,'resourceId':_0x17954e['id']}})[_0xa392('0x22')](function(){return _0x1eaa7b;});})[_0xa392('0x22')](function(){_0x20d212[_0xa392('0x16')](0xcc)[_0xa392('0x17')]();});}};}function handleEntityNotFound(_0x27ba60,_0x1b71cc){return function(_0x180fe6){if(!_0x180fe6){_0x27ba60[_0xa392('0x24')](0x194);}return _0x180fe6;};}function handleError(_0x45d1ce,_0x443edf){_0x443edf=_0x443edf||0x1f4;return function(_0x1f580c){logger[_0xa392('0x25')](_0x1f580c['stack']);if(_0x1f580c['name']){delete _0x1f580c[_0xa392('0x26')];}_0x45d1ce[_0xa392('0x16')](_0x443edf)[_0xa392('0x27')](_0x1f580c);};}exports['index']=function(_0x35e944,_0x2e3f94){var _0x316bab={},_0x4869b1={},_0x4a822c={'count':0x0,'rows':[]};var _0x4c7bde=_[_0xa392('0x28')](db['Variable'][_0xa392('0x29')],function(_0x4ad10e){return{'name':_0x4ad10e['fieldName'],'type':_0x4ad10e[_0xa392('0x2a')][_0xa392('0x2b')]};});_0x4869b1[_0xa392('0x2c')]=_[_0xa392('0x28')](_0x4c7bde,_0xa392('0x26'));_0x4869b1['query']=_['keys'](_0x35e944[_0xa392('0x2d')]);_0x4869b1[_0xa392('0x2e')]=_[_0xa392('0x2f')](_0x4869b1['model'],_0x4869b1[_0xa392('0x2d')]);_0x316bab[_0xa392('0x30')]=_[_0xa392('0x2f')](_0x4869b1['model'],qs[_0xa392('0x31')](_0x35e944[_0xa392('0x2d')]['fields']));_0x316bab[_0xa392('0x30')]=_0x316bab[_0xa392('0x30')]['length']?_0x316bab[_0xa392('0x30')]:_0x4869b1['model'];if(!_0x35e944[_0xa392('0x2d')]['hasOwnProperty'](_0xa392('0x32'))){_0x316bab[_0xa392('0x1c')]=qs['limit'](_0x35e944[_0xa392('0x2d')][_0xa392('0x1c')]);_0x316bab[_0xa392('0x19')]=qs['offset'](_0x35e944[_0xa392('0x2d')][_0xa392('0x19')]);}_0x316bab[_0xa392('0x33')]=qs[_0xa392('0x34')](_0x35e944['query']['sort']);_0x316bab[_0xa392('0x35')]=qs[_0xa392('0x2e')](_['pick'](_0x35e944[_0xa392('0x2d')],_0x4869b1['filters']),_0x4c7bde);if(_0x35e944[_0xa392('0x2d')][_0xa392('0x36')]){_0x316bab[_0xa392('0x35')]=_[_0xa392('0x37')](_0x316bab[_0xa392('0x35')],{'$or':_['map'](_0x4c7bde,function(_0x127096){if(_0x127096[_0xa392('0x2a')]!=='VIRTUAL'){var _0x211ec6={};_0x211ec6[_0x127096[_0xa392('0x26')]]={'$like':'%'+_0x35e944['query'][_0xa392('0x36')]+'%'};return _0x211ec6;}})});}_0x316bab=_[_0xa392('0x37')]({},_0x316bab,_0x35e944['options']);var _0x3af379={'where':_0x316bab[_0xa392('0x35')]};return db[_0xa392('0x38')][_0xa392('0x1b')](_0x3af379)[_0xa392('0x22')](function(_0x48ccf6){_0x4a822c[_0xa392('0x1b')]=_0x48ccf6;if(_0x35e944[_0xa392('0x2d')][_0xa392('0x39')]){_0x316bab[_0xa392('0x3a')]=[{'all':!![]}];}return db['Variable'][_0xa392('0x3b')](_0x316bab);})[_0xa392('0x22')](function(_0x2acdbd){_0x4a822c['rows']=_0x2acdbd;return _0x4a822c;})[_0xa392('0x22')](respondWithFilteredResult(_0x2e3f94,_0x316bab))[_0xa392('0x3c')](handleError(_0x2e3f94,null));};exports[_0xa392('0x3d')]=function(_0x2a3ce2,_0x17f1cc){var _0x551394={'raw':!![],'where':{'id':_0x2a3ce2[_0xa392('0x3e')]['id']}},_0x5097f3={};_0x5097f3[_0xa392('0x2c')]=_[_0xa392('0x3f')](db['Variable'][_0xa392('0x29')]);_0x5097f3[_0xa392('0x2d')]=_[_0xa392('0x3f')](_0x2a3ce2['query']);_0x5097f3[_0xa392('0x2e')]=_[_0xa392('0x2f')](_0x5097f3[_0xa392('0x2c')],_0x5097f3[_0xa392('0x2d')]);_0x551394[_0xa392('0x30')]=_['intersection'](_0x5097f3[_0xa392('0x2c')],qs['fields'](_0x2a3ce2[_0xa392('0x2d')][_0xa392('0x31')]));_0x551394[_0xa392('0x30')]=_0x551394[_0xa392('0x30')][_0xa392('0x40')]?_0x551394['attributes']:_0x5097f3[_0xa392('0x2c')];if(_0x2a3ce2[_0xa392('0x2d')][_0xa392('0x39')]){_0x551394[_0xa392('0x3a')]=[{'all':!![]}];}_0x551394=_[_0xa392('0x37')]({},_0x551394,_0x2a3ce2[_0xa392('0x41')]);return db[_0xa392('0x38')][_0xa392('0x42')](_0x551394)[_0xa392('0x22')](handleEntityNotFound(_0x17f1cc,null))['then'](respondWithResult(_0x17f1cc,null))[_0xa392('0x3c')](handleError(_0x17f1cc,null));};exports[_0xa392('0x43')]=function(_0x6685db,_0x3c1f01){return db[_0xa392('0x38')][_0xa392('0x43')](_0x6685db[_0xa392('0x44')],{})['then'](function(_0x1f4da3){var _0x5bd577=_0x6685db['user']['get']({'plain':!![]});if(!_0x5bd577)throw new Error(_0xa392('0x45'));if(_0x5bd577[_0xa392('0x46')]===_0xa392('0x47')){var _0xf07186=_0x1f4da3[_0xa392('0x48')]({'plain':!![]});var _0x187fd7=_0xa392('0x49');return db[_0xa392('0x4a')][_0xa392('0x42')]({'where':{'name':_0x187fd7,'userProfileId':_0x5bd577['userProfileId']},'raw':!![]})[_0xa392('0x22')](function(_0x463a1f){if(_0x463a1f&&_0x463a1f[_0xa392('0x4b')]===0x0){return db[_0xa392('0x23')][_0xa392('0x43')]({'name':_0xf07186['name'],'resourceId':_0xf07186['id'],'type':_0x463a1f[_0xa392('0x26')],'sectionId':_0x463a1f['id']},{})[_0xa392('0x22')](function(){return _0x1f4da3;});}else{return _0x1f4da3;}})[_0xa392('0x3c')](function(_0xa83554){logger[_0xa392('0x25')](_0xa392('0x4c'),_0xa83554);throw _0xa83554;});}return _0x1f4da3;})[_0xa392('0x22')](respondWithResult(_0x3c1f01,0xc9))[_0xa392('0x3c')](handleError(_0x3c1f01,null));};exports['update']=function(_0x1279e3,_0x5cd668){if(_0x1279e3[_0xa392('0x44')]['id']){delete _0x1279e3[_0xa392('0x44')]['id'];}return db['Variable'][_0xa392('0x42')]({'where':{'id':_0x1279e3[_0xa392('0x3e')]['id']}})['then'](handleEntityNotFound(_0x5cd668,null))[_0xa392('0x22')](saveUpdates(_0x1279e3[_0xa392('0x44')],null))[_0xa392('0x22')](respondWithResult(_0x5cd668,null))[_0xa392('0x3c')](handleError(_0x5cd668,null));};exports[_0xa392('0x21')]=function(_0xc51217,_0x5d8452){return db[_0xa392('0x38')][_0xa392('0x42')]({'where':{'id':_0xc51217[_0xa392('0x3e')]['id']}})[_0xa392('0x22')](handleEntityNotFound(_0x5d8452,null))[_0xa392('0x22')](removeEntity(_0x5d8452,null))[_0xa392('0x3c')](handleError(_0x5d8452,null));}; \ No newline at end of file +var _0x1ba0=['map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','options','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','find','rimraf','fast-json-patch','request-promise','moment','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','status','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','get','Variables','UserProfileResource','destroy','error','stack','name','send','index','Variable','rawAttributes','type','model'];(function(_0x2c5c2d,_0x336b57){var _0x27d4f9=function(_0x4c3e5f){while(--_0x4c3e5f){_0x2c5c2d['push'](_0x2c5c2d['shift']());}};_0x27d4f9(++_0x336b57);}(_0x1ba0,0x161));var _0x01ba=function(_0x5cde6d,_0xbfb4ac){_0x5cde6d=_0x5cde6d-0x0;var _0x3788da=_0x1ba0[_0x5cde6d];return _0x3788da;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x01ba('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x01ba('0x1'));var rp=require(_0x01ba('0x2'));var moment=require(_0x01ba('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x01ba('0x4'));var sox=require(_0x01ba('0x5'));var csv=require(_0x01ba('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x01ba('0x7'));var squel=require(_0x01ba('0x8'));var crypto=require(_0x01ba('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x01ba('0xa'));var toCsv=require('to-csv');var querystring=require(_0x01ba('0xb'));var Papa=require(_0x01ba('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x01ba('0xd'));var as=require(_0x01ba('0xe'));var hardwareService=require(_0x01ba('0xf'));var logger=require(_0x01ba('0x10'))(_0x01ba('0x11'));var utils=require(_0x01ba('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x01ba('0x13'))['db'];function respondWithStatusCode(_0x3caf9e,_0x376669){_0x376669=_0x376669||0xcc;return function(_0x8a3c6e){if(_0x8a3c6e){return _0x3caf9e[_0x01ba('0x14')](_0x376669);}return _0x3caf9e['status'](_0x376669)[_0x01ba('0x15')]();};}function respondWithResult(_0xe04ee2,_0x185a0b){_0x185a0b=_0x185a0b||0xc8;return function(_0x10dac0){if(_0x10dac0){return _0xe04ee2[_0x01ba('0x16')](_0x185a0b)[_0x01ba('0x17')](_0x10dac0);}};}function respondWithFilteredResult(_0x1d49f3,_0x5c8b9d){return function(_0x47f0f0){if(_0x47f0f0){var _0x1f75fd=typeof _0x5c8b9d[_0x01ba('0x18')]==='undefined'&&typeof _0x5c8b9d[_0x01ba('0x19')]==='undefined';var _0x720ad1=_0x47f0f0[_0x01ba('0x1a')];var _0x5b1c42=_0x1f75fd?0x0:_0x5c8b9d[_0x01ba('0x18')];var _0x558c36=_0x1f75fd?_0x47f0f0[_0x01ba('0x1a')]:_0x5c8b9d[_0x01ba('0x18')]+_0x5c8b9d[_0x01ba('0x19')];var _0x122681;if(_0x558c36>=_0x720ad1){_0x558c36=_0x720ad1;_0x122681=0xc8;}else{_0x122681=0xce;}_0x1d49f3[_0x01ba('0x16')](_0x122681);return _0x1d49f3[_0x01ba('0x1b')](_0x01ba('0x1c'),_0x5b1c42+'-'+_0x558c36+'/'+_0x720ad1)['json'](_0x47f0f0);}return null;};}function patchUpdates(_0x259179){return function(_0x2ad953){try{jsonpatch[_0x01ba('0x1d')](_0x2ad953,_0x259179,!![]);}catch(_0x3643cf){return BPromise[_0x01ba('0x1e')](_0x3643cf);}return _0x2ad953[_0x01ba('0x1f')]();};}function saveUpdates(_0x3c29fd,_0x42ae15){return function(_0x50f178){if(_0x50f178){return _0x50f178[_0x01ba('0x20')](_0x3c29fd)[_0x01ba('0x21')](function(_0x274f7b){return _0x274f7b;});}return null;};}function removeEntity(_0x4ab1f1,_0x46382e){return function(_0x995ee7){if(_0x995ee7){return _0x995ee7['destroy']()['then'](function(){var _0x3b1c98=_0x995ee7[_0x01ba('0x22')]({'plain':!![]});var _0x2e12b0=_0x01ba('0x23');return db[_0x01ba('0x24')][_0x01ba('0x25')]({'where':{'type':_0x2e12b0,'resourceId':_0x3b1c98['id']}})[_0x01ba('0x21')](function(){return _0x995ee7;});})['then'](function(){_0x4ab1f1['status'](0xcc)[_0x01ba('0x15')]();});}};}function handleEntityNotFound(_0x27d54a,_0x308f24){return function(_0x2b5226){if(!_0x2b5226){_0x27d54a[_0x01ba('0x14')](0x194);}return _0x2b5226;};}function handleError(_0x46c9b7,_0x5e2f4c){_0x5e2f4c=_0x5e2f4c||0x1f4;return function(_0x5e2ea5){logger[_0x01ba('0x26')](_0x5e2ea5[_0x01ba('0x27')]);if(_0x5e2ea5[_0x01ba('0x28')]){delete _0x5e2ea5[_0x01ba('0x28')];}_0x46c9b7[_0x01ba('0x16')](_0x5e2f4c)[_0x01ba('0x29')](_0x5e2ea5);};}exports[_0x01ba('0x2a')]=function(_0x2c6656,_0x5efd8e){var _0x234591={},_0x232cc6={},_0x5963ae={'count':0x0,'rows':[]};var _0x150af5=_['map'](db[_0x01ba('0x2b')][_0x01ba('0x2c')],function(_0x5f2b5e){return{'name':_0x5f2b5e['fieldName'],'type':_0x5f2b5e[_0x01ba('0x2d')]['key']};});_0x232cc6[_0x01ba('0x2e')]=_[_0x01ba('0x2f')](_0x150af5,_0x01ba('0x28'));_0x232cc6[_0x01ba('0x30')]=_[_0x01ba('0x31')](_0x2c6656['query']);_0x232cc6[_0x01ba('0x32')]=_[_0x01ba('0x33')](_0x232cc6['model'],_0x232cc6[_0x01ba('0x30')]);_0x234591[_0x01ba('0x34')]=_[_0x01ba('0x33')](_0x232cc6[_0x01ba('0x2e')],qs[_0x01ba('0x35')](_0x2c6656['query']['fields']));_0x234591[_0x01ba('0x34')]=_0x234591[_0x01ba('0x34')][_0x01ba('0x36')]?_0x234591['attributes']:_0x232cc6[_0x01ba('0x2e')];if(!_0x2c6656['query'][_0x01ba('0x37')](_0x01ba('0x38'))){_0x234591[_0x01ba('0x19')]=qs[_0x01ba('0x19')](_0x2c6656['query'][_0x01ba('0x19')]);_0x234591[_0x01ba('0x18')]=qs[_0x01ba('0x18')](_0x2c6656[_0x01ba('0x30')][_0x01ba('0x18')]);}_0x234591['order']=qs['sort'](_0x2c6656[_0x01ba('0x30')][_0x01ba('0x39')]);_0x234591[_0x01ba('0x3a')]=qs[_0x01ba('0x32')](_[_0x01ba('0x3b')](_0x2c6656[_0x01ba('0x30')],_0x232cc6['filters']),_0x150af5);if(_0x2c6656[_0x01ba('0x30')][_0x01ba('0x3c')]){_0x234591[_0x01ba('0x3a')]=_['merge'](_0x234591['where'],{'$or':_['map'](_0x150af5,function(_0xa68dd5){if(_0xa68dd5['type']!==_0x01ba('0x3d')){var _0x43b33e={};_0x43b33e[_0xa68dd5[_0x01ba('0x28')]]={'$like':'%'+_0x2c6656[_0x01ba('0x30')][_0x01ba('0x3c')]+'%'};return _0x43b33e;}})});}_0x234591=_[_0x01ba('0x3e')]({},_0x234591,_0x2c6656['options']);var _0x4962ad={'where':_0x234591[_0x01ba('0x3a')]};return db[_0x01ba('0x2b')]['count'](_0x4962ad)[_0x01ba('0x21')](function(_0x9c672b){_0x5963ae[_0x01ba('0x1a')]=_0x9c672b;if(_0x2c6656[_0x01ba('0x30')][_0x01ba('0x3f')]){_0x234591[_0x01ba('0x40')]=[{'all':!![]}];}return db['Variable'][_0x01ba('0x41')](_0x234591);})['then'](function(_0x2aa047){_0x5963ae[_0x01ba('0x42')]=_0x2aa047;return _0x5963ae;})[_0x01ba('0x21')](respondWithFilteredResult(_0x5efd8e,_0x234591))[_0x01ba('0x43')](handleError(_0x5efd8e,null));};exports[_0x01ba('0x44')]=function(_0x51aad8,_0xda5c06){var _0x2071c1={'raw':!![],'where':{'id':_0x51aad8[_0x01ba('0x45')]['id']}},_0x24cd3b={};_0x24cd3b[_0x01ba('0x2e')]=_[_0x01ba('0x31')](db[_0x01ba('0x2b')][_0x01ba('0x2c')]);_0x24cd3b['query']=_['keys'](_0x51aad8['query']);_0x24cd3b[_0x01ba('0x32')]=_[_0x01ba('0x33')](_0x24cd3b[_0x01ba('0x2e')],_0x24cd3b['query']);_0x2071c1[_0x01ba('0x34')]=_[_0x01ba('0x33')](_0x24cd3b[_0x01ba('0x2e')],qs[_0x01ba('0x35')](_0x51aad8[_0x01ba('0x30')][_0x01ba('0x35')]));_0x2071c1[_0x01ba('0x34')]=_0x2071c1['attributes'][_0x01ba('0x36')]?_0x2071c1[_0x01ba('0x34')]:_0x24cd3b[_0x01ba('0x2e')];if(_0x51aad8['query'][_0x01ba('0x3f')]){_0x2071c1[_0x01ba('0x40')]=[{'all':!![]}];}_0x2071c1=_['merge']({},_0x2071c1,_0x51aad8[_0x01ba('0x46')]);return db[_0x01ba('0x2b')]['find'](_0x2071c1)[_0x01ba('0x21')](handleEntityNotFound(_0xda5c06,null))[_0x01ba('0x21')](respondWithResult(_0xda5c06,null))['catch'](handleError(_0xda5c06,null));};exports[_0x01ba('0x47')]=function(_0x52db63,_0x22deba){return db[_0x01ba('0x2b')]['create'](_0x52db63[_0x01ba('0x48')],{})[_0x01ba('0x21')](function(_0x5f3efd){var _0xce45e4=_0x52db63['user'][_0x01ba('0x22')]({'plain':!![]});if(!_0xce45e4)throw new Error(_0x01ba('0x49'));if(_0xce45e4[_0x01ba('0x4a')]===_0x01ba('0x4b')){var _0x3bf5a1=_0x5f3efd[_0x01ba('0x22')]({'plain':!![]});var _0x410ae2=_0x01ba('0x23');return db[_0x01ba('0x4c')]['find']({'where':{'name':_0x410ae2,'userProfileId':_0xce45e4[_0x01ba('0x4d')]},'raw':!![]})[_0x01ba('0x21')](function(_0x4cbc6b){if(_0x4cbc6b&&_0x4cbc6b[_0x01ba('0x4e')]===0x0){return db[_0x01ba('0x24')]['create']({'name':_0x3bf5a1['name'],'resourceId':_0x3bf5a1['id'],'type':_0x4cbc6b[_0x01ba('0x28')],'sectionId':_0x4cbc6b['id']},{})['then'](function(){return _0x5f3efd;});}else{return _0x5f3efd;}})[_0x01ba('0x43')](function(_0x106e77){logger[_0x01ba('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x106e77);throw _0x106e77;});}return _0x5f3efd;})[_0x01ba('0x21')](respondWithResult(_0x22deba,0xc9))[_0x01ba('0x43')](handleError(_0x22deba,null));};exports['update']=function(_0x2f3fa7,_0x46cbbb){if(_0x2f3fa7[_0x01ba('0x48')]['id']){delete _0x2f3fa7['body']['id'];}return db['Variable']['find']({'where':{'id':_0x2f3fa7['params']['id']}})[_0x01ba('0x21')](handleEntityNotFound(_0x46cbbb,null))[_0x01ba('0x21')](saveUpdates(_0x2f3fa7[_0x01ba('0x48')],null))[_0x01ba('0x21')](respondWithResult(_0x46cbbb,null))[_0x01ba('0x43')](handleError(_0x46cbbb,null));};exports['destroy']=function(_0x22bb72,_0x511705){return db[_0x01ba('0x2b')][_0x01ba('0x4f')]({'where':{'id':_0x22bb72[_0x01ba('0x45')]['id']}})[_0x01ba('0x21')](handleEntityNotFound(_0x511705,null))[_0x01ba('0x21')](removeEntity(_0x511705,null))[_0x01ba('0x43')](handleError(_0x511705,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 1300615..a99f851 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 _0x17e1=['exports','define','Variable','tools_variables','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x399df7,_0x1adc7e){var _0x228c14=function(_0xe61072){while(--_0xe61072){_0x399df7['push'](_0x399df7['shift']());}};_0x228c14(++_0x1adc7e);}(_0x17e1,0x130));var _0x117e=function(_0x13402d,_0x4d4a89){_0x13402d=_0x13402d-0x0;var _0x176439=_0x17e1[_0x13402d];return _0x176439;};'use strict';var _=require('lodash');var util=require(_0x117e('0x0'));var logger=require(_0x117e('0x1'))('api');var moment=require(_0x117e('0x2'));var BPromise=require(_0x117e('0x3'));var rp=require(_0x117e('0x4'));var fs=require('fs');var path=require(_0x117e('0x5'));var rimraf=require(_0x117e('0x6'));var config=require(_0x117e('0x7'));var attributes=require('./variable.attributes');module[_0x117e('0x8')]=function(_0x23bca1,_0x492dbe){return _0x23bca1[_0x117e('0x9')](_0x117e('0xa'),attributes,{'tableName':_0x117e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc8b5=['../../config/environment','./variable.attributes','exports','tools_variables','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x3a3a41,_0x384c71){var _0x38b9f7=function(_0x424d4a){while(--_0x424d4a){_0x3a3a41['push'](_0x3a3a41['shift']());}};_0x38b9f7(++_0x384c71);}(_0xc8b5,0x122));var _0x5c8b=function(_0x29a0a3,_0x334495){_0x29a0a3=_0x29a0a3-0x0;var _0x52139a=_0xc8b5[_0x29a0a3];return _0x52139a;};'use strict';var _=require('lodash');var util=require(_0x5c8b('0x0'));var logger=require(_0x5c8b('0x1'))('api');var moment=require(_0x5c8b('0x2'));var BPromise=require(_0x5c8b('0x3'));var rp=require(_0x5c8b('0x4'));var fs=require('fs');var path=require(_0x5c8b('0x5'));var rimraf=require(_0x5c8b('0x6'));var config=require(_0x5c8b('0x7'));var attributes=require(_0x5c8b('0x8'));module[_0x5c8b('0x9')]=function(_0x118f38,_0x196601){return _0x118f38['define']('Variable',attributes,{'tableName':_0x5c8b('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 19299d3..4c77bd6 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 _0x5fc3=['info','request\x20sent','debug','stringify','error','code','message','Variable,\x20%s,\x20%s','result','catch','ShowVariable','find','options','where','attributes','include','map','model','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then'];(function(_0x248c51,_0xdf9962){var _0x28c4ce=function(_0xfd6d44){while(--_0xfd6d44){_0x248c51['push'](_0x248c51['shift']());}};_0x28c4ce(++_0xdf9962);}(_0x5fc3,0xa8));var _0x35fc=function(_0x34325b,_0x5e5afe){_0x34325b=_0x34325b-0x0;var _0x3da348=_0x5fc3[_0x34325b];return _0x3da348;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var moment=require('moment');var BPromise=require(_0x35fc('0x2'));var rs=require(_0x35fc('0x3'));var fs=require('fs');var Redis=require(_0x35fc('0x4'));var db=require(_0x35fc('0x5'))['db'];var utils=require(_0x35fc('0x6'));var logger=require('../../config/logger')(_0x35fc('0x7'));var config=require(_0x35fc('0x8'));var jayson=require(_0x35fc('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x19a0d1,_0x508b32,_0x16e153){return new BPromise(function(_0x27524f,_0xc72d93){return client[_0x35fc('0xa')](_0x19a0d1,_0x16e153)[_0x35fc('0xb')](function(_0xf9d3a6){logger[_0x35fc('0xc')]('Variable,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'));logger[_0x35fc('0xe')]('Variable,\x20%s,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'),JSON[_0x35fc('0xf')](_0xf9d3a6));if(_0xf9d3a6['error']){if(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x11')]===0x1f4){logger['error']('Variable,\x20%s,\x20%s',_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0xc72d93(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x12')]);}logger[_0x35fc('0x10')](_0x35fc('0x13'),_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0x27524f(_0xf9d3a6['error']['message']);}else{logger['info'](_0x35fc('0x13'),_0x508b32,_0x35fc('0xd'));_0x27524f(_0xf9d3a6[_0x35fc('0x14')][_0x35fc('0x12')]);}})[_0x35fc('0x15')](function(_0x1121fa){logger['error'](_0x35fc('0x13'),_0x508b32,_0x1121fa);_0xc72d93(_0x1121fa);});});}exports[_0x35fc('0x16')]=function(_0x553677){var _0x41e165=this;return new Promise(function(_0x363e47,_0x2e513b){return db['Variable'][_0x35fc('0x17')]({'raw':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x19')]||null:null,'attributes':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x1a')]||null:null,'include':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x1b')]?_[_0x35fc('0x1c')](_0x553677['options'][_0x35fc('0x1b')],function(_0xd5399f){return{'model':db[_0xd5399f[_0x35fc('0x1d')]],'as':_0xd5399f['as'],'attributes':_0xd5399f[_0x35fc('0x1a')],'include':_0xd5399f[_0x35fc('0x1b')]?_['map'](_0xd5399f[_0x35fc('0x1b')],function(_0x4c587a){return{'model':db[_0x4c587a['model']],'as':_0x4c587a['as'],'attributes':_0x4c587a[_0x35fc('0x1a')],'include':_0x4c587a[_0x35fc('0x1b')]?_[_0x35fc('0x1c')](_0x4c587a['include'],function(_0x4086e9){return{'model':db[_0x4086e9['model']],'as':_0x4086e9['as'],'attributes':_0x4086e9[_0x35fc('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x35fc('0xb')](function(_0x5cb986){logger['info'](_0x35fc('0x16'),_0x553677);logger['debug'](_0x35fc('0x16'),_0x553677,JSON[_0x35fc('0xf')](_0x5cb986));_0x363e47(_0x5cb986);})['catch'](function(_0x26b7cb){logger[_0x35fc('0x10')](_0x35fc('0x16'),_0x26b7cb[_0x35fc('0x12')],_0x553677);_0x2e513b(_0x41e165[_0x35fc('0x10')](0x1f4,_0x26b7cb[_0x35fc('0x12')]));});});}; \ No newline at end of file +var _0x814b=['model','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowVariable','options','where','include','map','attributes'];(function(_0x1a0b1a,_0x15a22c){var _0x192e2c=function(_0x4e7828){while(--_0x4e7828){_0x1a0b1a['push'](_0x1a0b1a['shift']());}};_0x192e2c(++_0x15a22c);}(_0x814b,0x1a2));var _0xb814=function(_0x15f8ad,_0x5275c3){_0x15f8ad=_0x15f8ad-0x0;var _0xc0238a=_0x814b[_0x15f8ad];return _0xc0238a;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var moment=require(_0xb814('0x2'));var BPromise=require(_0xb814('0x3'));var rs=require(_0xb814('0x4'));var fs=require('fs');var Redis=require(_0xb814('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb814('0x6'));var logger=require(_0xb814('0x7'))(_0xb814('0x8'));var config=require(_0xb814('0x9'));var jayson=require(_0xb814('0xa'));var client=jayson[_0xb814('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b0829,_0x2e6272,_0x5c8539){return new BPromise(function(_0x271af9,_0x2913a6){return client[_0xb814('0xc')](_0x3b0829,_0x5c8539)[_0xb814('0xd')](function(_0x1fea33){logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));logger[_0xb814('0x11')](_0xb814('0x12'),_0x2e6272,_0xb814('0x10'),JSON['stringify'](_0x1fea33));if(_0x1fea33[_0xb814('0x13')]){if(_0x1fea33['error'][_0xb814('0x14')]===0x1f4){logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x2913a6(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x271af9(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}else{logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));_0x271af9(_0x1fea33[_0xb814('0x16')][_0xb814('0x15')]);}})[_0xb814('0x17')](function(_0x21b73f){logger[_0xb814('0x13')]('Variable,\x20%s,\x20%s',_0x2e6272,_0x21b73f);_0x2913a6(_0x21b73f);});});}exports[_0xb814('0x18')]=function(_0x55ba16){var _0x270598=this;return new Promise(function(_0xfac75b,_0x4c3007){return db['Variable']['find']({'raw':_0x55ba16[_0xb814('0x19')]?_0x55ba16['options']['raw']===undefined?!![]:![]:!![],'where':_0x55ba16[_0xb814('0x19')]?_0x55ba16[_0xb814('0x19')][_0xb814('0x1a')]||null:null,'attributes':_0x55ba16['options']?_0x55ba16[_0xb814('0x19')]['attributes']||null:null,'include':_0x55ba16[_0xb814('0x19')]?_0x55ba16[_0xb814('0x19')][_0xb814('0x1b')]?_[_0xb814('0x1c')](_0x55ba16[_0xb814('0x19')][_0xb814('0x1b')],function(_0x1f5d40){return{'model':db[_0x1f5d40['model']],'as':_0x1f5d40['as'],'attributes':_0x1f5d40[_0xb814('0x1d')],'include':_0x1f5d40['include']?_[_0xb814('0x1c')](_0x1f5d40[_0xb814('0x1b')],function(_0x31c7ec){return{'model':db[_0x31c7ec[_0xb814('0x1e')]],'as':_0x31c7ec['as'],'attributes':_0x31c7ec[_0xb814('0x1d')],'include':_0x31c7ec[_0xb814('0x1b')]?_[_0xb814('0x1c')](_0x31c7ec['include'],function(_0x392222){return{'model':db[_0x392222[_0xb814('0x1e')]],'as':_0x392222['as'],'attributes':_0x392222[_0xb814('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xb814('0xd')](function(_0x32ed56){logger[_0xb814('0xe')](_0xb814('0x18'),_0x55ba16);logger[_0xb814('0x11')]('ShowVariable',_0x55ba16,JSON[_0xb814('0x1f')](_0x32ed56));_0xfac75b(_0x32ed56);})[_0xb814('0x17')](function(_0x52ed64){logger[_0xb814('0x13')](_0xb814('0x18'),_0x52ed64[_0xb814('0x15')],_0x55ba16);_0x4c3007(_0x270598['error'](0x1f4,_0x52ed64[_0xb814('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index def36a6..9024aff 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 _0xe57f=['index','/fetch','isAuthenticated','canUpdate','fetch','/reset','reset','/pull','pull','/migrations','migrations','exports','express','Router','../../components/auth/service','./version.controller','get'];(function(_0x14aa12,_0x1fcd0a){var _0x48a4a7=function(_0x26c945){while(--_0x26c945){_0x14aa12['push'](_0x14aa12['shift']());}};_0x48a4a7(++_0x1fcd0a);}(_0xe57f,0x10b));var _0xfe57=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xe57f[_0x4565bf];return _0x5610ba;};'use strict';var express=require(_0xfe57('0x0'));var router=express[_0xfe57('0x1')]();var auth=require(_0xfe57('0x2'));var controller=require(_0xfe57('0x3'));router[_0xfe57('0x4')]('/',controller[_0xfe57('0x5')]);router[_0xfe57('0x4')](_0xfe57('0x6'),auth[_0xfe57('0x7')](),auth[_0xfe57('0x8')](),controller[_0xfe57('0x9')]);router[_0xfe57('0x4')](_0xfe57('0xa'),auth[_0xfe57('0x7')](),auth[_0xfe57('0x8')](),controller[_0xfe57('0xb')]);router[_0xfe57('0x4')](_0xfe57('0xc'),auth[_0xfe57('0x7')](),auth[_0xfe57('0x8')](),controller[_0xfe57('0xd')]);router[_0xfe57('0x4')]('/restart',auth[_0xfe57('0x7')](),controller['restart']);router[_0xfe57('0x4')](_0xfe57('0xe'),controller[_0xfe57('0xf')]);module[_0xfe57('0x10')]=router; \ No newline at end of file +var _0xe3b6=['/fetch','isAuthenticated','canUpdate','fetch','/reset','reset','/restart','restart','/migrations','migrations','exports','Router','../../components/auth/service','get'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0xe3b6,0x89));var _0x6e3b=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xe3b6[_0x5ddb1c];return _0x354adc;};'use strict';var express=require('express');var router=express[_0x6e3b('0x0')]();var auth=require(_0x6e3b('0x1'));var controller=require('./version.controller');router[_0x6e3b('0x2')]('/',controller['index']);router[_0x6e3b('0x2')](_0x6e3b('0x3'),auth[_0x6e3b('0x4')](),auth[_0x6e3b('0x5')](),controller[_0x6e3b('0x6')]);router[_0x6e3b('0x2')](_0x6e3b('0x7'),auth[_0x6e3b('0x4')](),auth[_0x6e3b('0x5')](),controller[_0x6e3b('0x8')]);router['get']('/pull',auth['isAuthenticated'](),auth[_0x6e3b('0x5')](),controller['pull']);router['get'](_0x6e3b('0x9'),auth[_0x6e3b('0x4')](),controller[_0x6e3b('0xa')]);router[_0x6e3b('0x2')](_0x6e3b('0xb'),controller[_0x6e3b('0xc')]);module[_0x6e3b('0xd')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index c90ba99..0bfebee 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 _0xa542=['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','catch','migrations','readdirSync','join','server','length','replace','.js','sort','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','path','lodash','pkginfo','version','compare-versions','child_process','exec','../../config/environment','../../config/pm2','update','simple-git','root','exports','query','latest','2.0.0','json','status','origin','master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard'];(function(_0x31f22e,_0x434db1){var _0x16e1b0=function(_0x4f5355){while(--_0x4f5355){_0x31f22e['push'](_0x31f22e['shift']());}};_0x16e1b0(++_0x434db1);}(_0xa542,0x8e));var _0x2a54=function(_0x1229ec,_0x436d95){_0x1229ec=_0x1229ec-0x0;var _0x37f61c=_0xa542[_0x1229ec];return _0x37f61c;};'use strict';var Umzug=require('umzug');var path=require(_0x2a54('0x0'));var fs=require('fs');var _=require(_0x2a54('0x1'));var pkginfo=require(_0x2a54('0x2'))(module,_0x2a54('0x3'));var compareVersions=require(_0x2a54('0x4'));var exec=require(_0x2a54('0x5'))[_0x2a54('0x6')];var db=require('../../mysqldb')['db'];var config=require(_0x2a54('0x7'));var pm2=require(_0x2a54('0x8'));var logger=require('../../config/logger')(_0x2a54('0x9'));var git=require(_0x2a54('0xa'))(config[_0x2a54('0xb')]);exports['index']=function(_0x10a5a1,_0x582977){var _0x56b16f={'current':module[_0x2a54('0xc')][_0x2a54('0x3')],'phonebar':0x2};if(_0x10a5a1[_0x2a54('0xd')]&&_0x10a5a1[_0x2a54('0xd')]['latest']){return git['fetch']()['tags'](function(_0xd8bd65,_0x5b5b7c){_0x56b16f['latest']=(_0xd8bd65?module[_0x2a54('0xc')][_0x2a54('0x3')]:_0x5b5b7c[_0x2a54('0xe')])||_0x2a54('0xf');return _0x582977['status'](0xc8)[_0x2a54('0x10')](_0x56b16f);});}else{return _0x582977[_0x2a54('0x11')](0xc8)[_0x2a54('0x10')](_0x56b16f);}};exports['fetch']=function(_0xb970d0,_0x1801d0){return git['fetch']([_0x2a54('0x12'),_0x2a54('0x13')],function(_0x176f51){if(_0x176f51){logger[_0x2a54('0x14')](_0x176f51);return _0x1801d0[_0x2a54('0x11')](0x1f4)['json'](_0x176f51);}logger[_0x2a54('0x15')](_0x2a54('0x16'));return _0x1801d0[_0x2a54('0x11')](0xc8)[_0x2a54('0x10')]({'output':_0x2a54('0x17')});});};exports[_0x2a54('0x18')]=function(_0x2d9fb9,_0x2e38ab){return git['reset']([_0x2a54('0x19'),_0x2a54('0x1a')],function(_0x48218d){if(_0x48218d){logger['error'](_0x48218d);return _0x2e38ab[_0x2a54('0x11')](0x1f4)[_0x2a54('0x10')](_0x48218d);}logger['info'](_0x2a54('0x1b'));return _0x2e38ab['status'](0xc8)[_0x2a54('0x10')]({'output':_0x2a54('0x1c')});});};exports[_0x2a54('0x1d')]=function(_0x4d0158,_0xc18b59){exec(_0x2a54('0x1e'),function(_0x487a12,_0x990318,_0x184755){logger[_0x2a54('0x15')](_0x990318);logger[_0x2a54('0x15')](_0x184755);if(_0x487a12){logger[_0x2a54('0x14')](_0x487a12);return _0xc18b59['status'](0x1f4)[_0x2a54('0x10')](_0x487a12);}return _0xc18b59['status'](0xc8)[_0x2a54('0x10')]({'output':_0x990318});});};exports['restart']=function(_0x56e6b5,_0x4db2c5){return pm2[_0x2a54('0x1f')](_0x2a54('0x20'))[_0x2a54('0x21')](function(_0x3471f5){logger[_0x2a54('0x15')](_0x2a54('0x22'),_0x3471f5);return _0x4db2c5[_0x2a54('0x11')](0xc8)['json']({'output':_0x2a54('0x23')});})[_0x2a54('0x24')](function(_0x12af14){logger[_0x2a54('0x14')](_0x12af14);return _0x4db2c5[_0x2a54('0x11')](0x1f4)[_0x2a54('0x10')](_0x12af14);});};exports[_0x2a54('0x25')]=function(_0x2682d8,_0x56e16c){var _0x237f70=fs[_0x2a54('0x26')](path[_0x2a54('0x27')](config[_0x2a54('0xb')],_0x2a54('0x28'),_0x2a54('0x25')));var _0x32c188=[];for(var _0x87ec8c=0x0;_0x87ec8c<_0x237f70[_0x2a54('0x29')];_0x87ec8c++){var _0x485d14=_0x237f70[_0x87ec8c][_0x2a54('0x2a')](_0x2a54('0x2b'),'');if(compareVersions(module[_0x2a54('0xc')][_0x2a54('0x3')],_0x485d14)===-0x1){_0x32c188['push'](_0x485d14);}}if(_0x32c188[_0x2a54('0x29')]){var _0x5f08ff=_0x32c188[_0x2a54('0x2c')](compareVersions);var _0x306efe=new Umzug({'storage':_0x2a54('0x2d'),'storageOptions':{'model':db[_0x2a54('0x2e')],'modelName':_0x2a54('0x2e'),'columnName':_0x2a54('0x3')},'migrations':{'params':[db[_0x2a54('0x2d')][_0x2a54('0x2f')](),db[_0x2a54('0x2d')][_0x2a54('0x30')],function(){throw new Error(_0x2a54('0x31'));}],'path':path[_0x2a54('0x27')](config[_0x2a54('0xb')],_0x2a54('0x28'),_0x2a54('0x25')),'pattern':/\.js$/}});_0x306efe['up']({'migrations':_[_0x2a54('0x32')](_0x5f08ff,function(_0x2aa9f0){return _0x2aa9f0+'.js';})})[_0x2a54('0x21')](function(){return _0x56e16c[_0x2a54('0x11')](0xc8)['json']({'output':_0x2a54('0x33')+module[_0x2a54('0xc')][_0x2a54('0x3')]+_0x2a54('0x34')+_[_0x2a54('0x35')](_0x5f08ff),'migrations':_[_0x2a54('0x27')](_0x5f08ff)});})[_0x2a54('0x24')](function(_0x5842b0){if(_0x5842b0 instanceof db[_0x2a54('0x2d')][_0x2a54('0x36')]){return _0x56e16c['status'](0xc8)[_0x2a54('0x10')]({'output':_0x2a54('0x37')});}else{return _0x56e16c[_0x2a54('0x11')](0x1f4)['json'](_0x5842b0);}});}else{return _0x56e16c['status'](0xc8)[_0x2a54('0x10')]({'output':_0x2a54('0x37')});}}; \ No newline at end of file +var _0x8c2b=['Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','compare-versions','../../config/environment','../../config/logger','update','simple-git','root','index','exports','query','latest','fetch','tags','2.0.0','json','status','origin','master','error','info','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','pull','npm\x20install\x20--production','restart','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','server','replace','.js','push','length','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','then','\x20to\x20','UniqueConstraintError'];(function(_0x4c7424,_0x56d716){var _0x47ba08=function(_0x5096b4){while(--_0x5096b4){_0x4c7424['push'](_0x4c7424['shift']());}};_0x47ba08(++_0x56d716);}(_0x8c2b,0x133));var _0xb8c2=function(_0x528560,_0x5dc96c){_0x528560=_0x528560-0x0;var _0x4509c3=_0x8c2b[_0x528560];return _0x4509c3;};'use strict';var Umzug=require(_0xb8c2('0x0'));var path=require(_0xb8c2('0x1'));var fs=require('fs');var _=require(_0xb8c2('0x2'));var pkginfo=require(_0xb8c2('0x3'))(module,_0xb8c2('0x4'));var compareVersions=require(_0xb8c2('0x5'));var exec=require('child_process')['exec'];var db=require('../../mysqldb')['db'];var config=require(_0xb8c2('0x6'));var pm2=require('../../config/pm2');var logger=require(_0xb8c2('0x7'))(_0xb8c2('0x8'));var git=require(_0xb8c2('0x9'))(config[_0xb8c2('0xa')]);exports[_0xb8c2('0xb')]=function(_0x26d1d8,_0x57cb7d){var _0x3c7eb8={'current':module[_0xb8c2('0xc')]['version'],'phonebar':0x2};if(_0x26d1d8['query']&&_0x26d1d8[_0xb8c2('0xd')][_0xb8c2('0xe')]){return git[_0xb8c2('0xf')]()[_0xb8c2('0x10')](function(_0x46328e,_0x3994e7){_0x3c7eb8[_0xb8c2('0xe')]=(_0x46328e?module['exports']['version']:_0x3994e7['latest'])||_0xb8c2('0x11');return _0x57cb7d['status'](0xc8)[_0xb8c2('0x12')](_0x3c7eb8);});}else{return _0x57cb7d[_0xb8c2('0x13')](0xc8)[_0xb8c2('0x12')](_0x3c7eb8);}};exports[_0xb8c2('0xf')]=function(_0x2e04d9,_0x3e10bd){return git['fetch']([_0xb8c2('0x14'),_0xb8c2('0x15')],function(_0x722e34){if(_0x722e34){logger[_0xb8c2('0x16')](_0x722e34);return _0x3e10bd['status'](0x1f4)[_0xb8c2('0x12')](_0x722e34);}logger[_0xb8c2('0x17')]('git\x20fetch');return _0x3e10bd[_0xb8c2('0x13')](0xc8)['json']({'output':'git\x20fetch\x20origin\x20master'});});};exports['reset']=function(_0x5c4cda,_0x46dee5){return git['reset']([_0xb8c2('0x18'),_0xb8c2('0x19')],function(_0x4c2552){if(_0x4c2552){logger['error'](_0x4c2552);return _0x46dee5[_0xb8c2('0x13')](0x1f4)[_0xb8c2('0x12')](_0x4c2552);}logger[_0xb8c2('0x17')](_0xb8c2('0x1a'));return _0x46dee5[_0xb8c2('0x13')](0xc8)[_0xb8c2('0x12')]({'output':'git\x20reset\x20--hard'});});};exports[_0xb8c2('0x1b')]=function(_0x146bf9,_0x24bdbe){exec(_0xb8c2('0x1c'),function(_0x39a64c,_0x3fe438,_0x1095e5){logger[_0xb8c2('0x17')](_0x3fe438);logger[_0xb8c2('0x17')](_0x1095e5);if(_0x39a64c){logger[_0xb8c2('0x16')](_0x39a64c);return _0x24bdbe[_0xb8c2('0x13')](0x1f4)[_0xb8c2('0x12')](_0x39a64c);}return _0x24bdbe['status'](0xc8)[_0xb8c2('0x12')]({'output':_0x3fe438});});};exports[_0xb8c2('0x1d')]=function(_0x1940d4,_0x56dba2){return pm2[_0xb8c2('0x1d')]('motion2')['then'](function(_0x339d0b){logger['info'](_0xb8c2('0x1e'),_0x339d0b);return _0x56dba2[_0xb8c2('0x13')](0xc8)[_0xb8c2('0x12')]({'output':_0xb8c2('0x1f')});})[_0xb8c2('0x20')](function(_0x3397cc){logger[_0xb8c2('0x16')](_0x3397cc);return _0x56dba2[_0xb8c2('0x13')](0x1f4)[_0xb8c2('0x12')](_0x3397cc);});};exports[_0xb8c2('0x21')]=function(_0x15afd9,_0x1121e4){var _0x18fe7e=fs[_0xb8c2('0x22')](path[_0xb8c2('0x23')](config[_0xb8c2('0xa')],_0xb8c2('0x24'),_0xb8c2('0x21')));var _0x44c20d=[];for(var _0x551db7=0x0;_0x551db7<_0x18fe7e['length'];_0x551db7++){var _0x10afa6=_0x18fe7e[_0x551db7][_0xb8c2('0x25')](_0xb8c2('0x26'),'');if(compareVersions(module[_0xb8c2('0xc')][_0xb8c2('0x4')],_0x10afa6)===-0x1){_0x44c20d[_0xb8c2('0x27')](_0x10afa6);}}if(_0x44c20d[_0xb8c2('0x28')]){var _0x45f395=_0x44c20d[_0xb8c2('0x29')](compareVersions);var _0x315e1d=new Umzug({'storage':_0xb8c2('0x2a'),'storageOptions':{'model':db[_0xb8c2('0x2b')],'modelName':_0xb8c2('0x2b'),'columnName':_0xb8c2('0x4')},'migrations':{'params':[db[_0xb8c2('0x2a')][_0xb8c2('0x2c')](),db[_0xb8c2('0x2a')]['constructor'],function(){throw new Error(_0xb8c2('0x2d'));}],'path':path[_0xb8c2('0x23')](config['root'],_0xb8c2('0x24'),_0xb8c2('0x21')),'pattern':/\.js$/}});_0x315e1d['up']({'migrations':_[_0xb8c2('0x2e')](_0x45f395,function(_0x3c8fcd){return _0x3c8fcd+'.js';})})[_0xb8c2('0x2f')](function(){return _0x1121e4['status'](0xc8)[_0xb8c2('0x12')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module['exports']['version']+_0xb8c2('0x30')+_['last'](_0x45f395),'migrations':_[_0xb8c2('0x23')](_0x45f395)});})[_0xb8c2('0x20')](function(_0x200e4e){if(_0x200e4e instanceof db[_0xb8c2('0x2a')][_0xb8c2('0x31')]){return _0x1121e4[_0xb8c2('0x13')](0xc8)[_0xb8c2('0x12')]({'output':_0xb8c2('0x32')});}else{return _0x1121e4[_0xb8c2('0x13')](0x1f4)['json'](_0x200e4e);}});}else{return _0x1121e4[_0xb8c2('0x13')](0xc8)['json']({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 2cb9a2f..c91c52a 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 _0x837c=['destroy','exports','multer','util','path','express','Router','fs-extra','../../config/environment','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','delete'];(function(_0x4e4e20,_0x27df36){var _0x559559=function(_0x283e52){while(--_0x283e52){_0x4e4e20['push'](_0x4e4e20['shift']());}};_0x559559(++_0x27df36);}(_0x837c,0x1ce));var _0xc837=function(_0x4712bc,_0x54afc3){_0x4712bc=_0x4712bc-0x0;var _0x4f4b2d=_0x837c[_0x4712bc];return _0x4f4b2d;};'use strict';var multer=require(_0xc837('0x0'));var util=require(_0xc837('0x1'));var path=require(_0xc837('0x2'));var timeout=require('connect-timeout');var express=require(_0xc837('0x3'));var router=express[_0xc837('0x4')]();var fs_extra=require(_0xc837('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc837('0x6'));var controller=require('./voiceAgentReport.controller');router[_0xc837('0x7')]('/',auth[_0xc837('0x8')](),controller[_0xc837('0x9')]);router[_0xc837('0x7')]('/describe',auth[_0xc837('0x8')](),controller[_0xc837('0xa')]);router[_0xc837('0x7')](_0xc837('0xb'),auth[_0xc837('0x8')](),controller[_0xc837('0xc')]);router[_0xc837('0xd')]('/',auth[_0xc837('0x8')](),controller[_0xc837('0xe')]);router[_0xc837('0xf')]('/:id',auth[_0xc837('0x8')](),controller[_0xc837('0x10')]);router[_0xc837('0x11')](_0xc837('0xb'),auth['isAuthenticated'](),controller[_0xc837('0x12')]);module[_0xc837('0x13')]=router; \ No newline at end of file +var _0x5308=['/:id','delete','destroy','exports','util','path','express','../../components/auth/service','../../config/environment','get','isAuthenticated','index','describe','show','post','put'];(function(_0x2131b3,_0x350ffd){var _0x5b8030=function(_0x5d47a5){while(--_0x5d47a5){_0x2131b3['push'](_0x2131b3['shift']());}};_0x5b8030(++_0x350ffd);}(_0x5308,0x94));var _0x8530=function(_0x4d337e,_0x2f7eed){_0x4d337e=_0x4d337e-0x0;var _0x247963=_0x5308[_0x4d337e];return _0x247963;};'use strict';var multer=require('multer');var util=require(_0x8530('0x0'));var path=require(_0x8530('0x1'));var timeout=require('connect-timeout');var express=require(_0x8530('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8530('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x8530('0x4'));var controller=require('./voiceAgentReport.controller');router[_0x8530('0x5')]('/',auth[_0x8530('0x6')](),controller[_0x8530('0x7')]);router[_0x8530('0x5')]('/describe',auth[_0x8530('0x6')](),controller[_0x8530('0x8')]);router[_0x8530('0x5')]('/:id',auth[_0x8530('0x6')](),controller[_0x8530('0x9')]);router[_0x8530('0xa')]('/',auth[_0x8530('0x6')](),controller['create']);router[_0x8530('0xb')](_0x8530('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x8530('0xd')](_0x8530('0xc'),auth['isAuthenticated'](),controller[_0x8530('0xe')]);module[_0x8530('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 34e42dc..9c89118 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 _0x0abf=['DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','STRING'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x0abf,0xe8));var _0xf0ab=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x0abf[_0x5ddb1c];return _0x354adc;};'use strict';var Sequelize=require(_0xf0ab('0x0'));module['exports']={'type':{'type':Sequelize[_0xf0ab('0x1')]},'uniqueid':{'type':Sequelize[_0xf0ab('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xf0ab('0x1')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xf0ab('0x1')]},'agentcalledAt':{'type':Sequelize[_0xf0ab('0x2')]},'agentconnectAt':{'type':Sequelize[_0xf0ab('0x2')]},'agentcompleteAt':{'type':Sequelize[_0xf0ab('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0xf0ab('0x2')]},'agentdumpAt':{'type':Sequelize[_0xf0ab('0x2')]},'holdtime':{'type':Sequelize[_0xf0ab('0x3')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xf0ab('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xf0ab('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xf0ab('0x3')]},'agentacw':{'type':Sequelize[_0xf0ab('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0xf0ab('0x1')]},'lastevent':{'type':Sequelize[_0xf0ab('0x1')]},'channel':{'type':Sequelize[_0xf0ab('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xf0ab('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xf0ab('0x1')]},'accountcode':{'type':Sequelize[_0xf0ab('0x1')]},'context':{'type':Sequelize[_0xf0ab('0x1')]},'exten':{'type':Sequelize[_0xf0ab('0x1')]},'priority':{'type':Sequelize[_0xf0ab('0x1')]},'destchannel':{'type':Sequelize[_0xf0ab('0x1')]},'destchannelstate':{'type':Sequelize[_0xf0ab('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xf0ab('0x1')]},'destcalleridname':{'type':Sequelize[_0xf0ab('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xf0ab('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xf0ab('0x1')]},'destlanguage':{'type':Sequelize[_0xf0ab('0x1')]},'destaccountcode':{'type':Sequelize[_0xf0ab('0x1')]},'destcontext':{'type':Sequelize[_0xf0ab('0x1')]},'destexten':{'type':Sequelize[_0xf0ab('0x1')]},'destpriority':{'type':Sequelize[_0xf0ab('0x1')]},'destuniqueid':{'type':Sequelize[_0xf0ab('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xf0ab('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0xf0ab('0x1')]},'transfer':{'type':Sequelize[_0xf0ab('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xf0ab('0x1')],'comment':_0xf0ab('0x5')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0xf0ab('0x1')]},'agententerreason':{'type':Sequelize[_0xf0ab('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xef0a=['exports','STRING','DATE','INTEGER','BOOLEAN','sequelize'];(function(_0x2405bc,_0x2f28a1){var _0x5272d4=function(_0x225294){while(--_0x225294){_0x2405bc['push'](_0x2405bc['shift']());}};_0x5272d4(++_0x2f28a1);}(_0xef0a,0xdd));var _0xaef0=function(_0x57eec7,_0x52b38e){_0x57eec7=_0x57eec7-0x0;var _0x47a03f=_0xef0a[_0x57eec7];return _0x47a03f;};'use strict';var Sequelize=require(_0xaef0('0x0'));module[_0xaef0('0x1')]={'type':{'type':Sequelize[_0xaef0('0x2')]},'uniqueid':{'type':Sequelize[_0xaef0('0x2')]},'calleridnum':{'type':Sequelize[_0xaef0('0x2')]},'calleridname':{'type':Sequelize[_0xaef0('0x2')]},'queue':{'type':Sequelize[_0xaef0('0x2')]},'interface':{'type':Sequelize[_0xaef0('0x2')]},'membername':{'type':Sequelize[_0xaef0('0x2')]},'agentcalledAt':{'type':Sequelize[_0xaef0('0x3')]},'agentconnectAt':{'type':Sequelize[_0xaef0('0x3')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0xaef0('0x3')]},'agentdumpAt':{'type':Sequelize[_0xaef0('0x3')]},'holdtime':{'type':Sequelize[_0xaef0('0x4')]},'agentcomplete':{'type':Sequelize[_0xaef0('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0xaef0('0x4')]},'agentacw':{'type':Sequelize[_0xaef0('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xaef0('0x4')]},'reason':{'type':Sequelize[_0xaef0('0x2')]},'lastevent':{'type':Sequelize[_0xaef0('0x2')]},'channel':{'type':Sequelize[_0xaef0('0x2')]},'channelstate':{'type':Sequelize[_0xaef0('0x4')]},'channelstatedesc':{'type':Sequelize[_0xaef0('0x2')]},'connectedlinenum':{'type':Sequelize[_0xaef0('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xaef0('0x2')]},'accountcode':{'type':Sequelize[_0xaef0('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xaef0('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xaef0('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0xaef0('0x2')]},'destcalleridnum':{'type':Sequelize[_0xaef0('0x2')]},'destcalleridname':{'type':Sequelize[_0xaef0('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xaef0('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xaef0('0x2')]},'destlanguage':{'type':Sequelize[_0xaef0('0x2')]},'destaccountcode':{'type':Sequelize[_0xaef0('0x2')]},'destcontext':{'type':Sequelize[_0xaef0('0x2')]},'destexten':{'type':Sequelize[_0xaef0('0x2')]},'destpriority':{'type':Sequelize[_0xaef0('0x2')]},'destuniqueid':{'type':Sequelize[_0xaef0('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xaef0('0x2')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0xaef0('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xaef0('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0xaef0('0x2')]},'transferuniqueid':{'type':Sequelize[_0xaef0('0x2')]},'agententerreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index 45ae492..a6f6fb1 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(_0x2adbeb,_0x5581be){var _0x5e18a6=function(_0x84e42b){while(--_0x84e42b){_0x2adbeb['push'](_0x2adbeb['shift']());}};_0x5e18a6(++_0x5581be);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'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(_0x580647,_0x43d2c3){var _0x5f0792=function(_0x386cef){while(--_0x386cef){_0x580647['push'](_0x580647['shift']());}};_0x5f0792(++_0x43d2c3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'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 dc2c9d3..4dbc0c9 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 _0xc978=['bluebird','path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','VoiceAgentReport','report_agent','uniqueid','destuniqueid','lodash','util','../../config/logger','api','moment'];(function(_0xc484ef,_0x239e94){var _0x48025a=function(_0x4c11f7){while(--_0x4c11f7){_0xc484ef['push'](_0xc484ef['shift']());}};_0x48025a(++_0x239e94);}(_0xc978,0xcd));var _0x8c97=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc978[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x8c97('0x0'));var util=require(_0x8c97('0x1'));var logger=require(_0x8c97('0x2'))(_0x8c97('0x3'));var moment=require(_0x8c97('0x4'));var BPromise=require(_0x8c97('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8c97('0x6'));var rimraf=require(_0x8c97('0x7'));var config=require(_0x8c97('0x8'));var attributes=require(_0x8c97('0x9'));module[_0x8c97('0xa')]=function(_0x2a9434,_0xabd146){return _0x2a9434['define'](_0x8c97('0xb'),attributes,{'tableName':_0x8c97('0xc'),'paranoid':![],'indexes':[{'fields':[_0x8c97('0xd'),_0x8c97('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6596=['util','api','moment','bluebird','request-promise','path','rimraf','exports','define','VoiceAgentReport','destuniqueid','lodash'];(function(_0x4254ce,_0x49121b){var _0x114eb0=function(_0x49cab6){while(--_0x49cab6){_0x4254ce['push'](_0x4254ce['shift']());}};_0x114eb0(++_0x49121b);}(_0x6596,0x1d3));var _0x6659=function(_0x2aec68,_0x351ea4){_0x2aec68=_0x2aec68-0x0;var _0x16f3a4=_0x6596[_0x2aec68];return _0x16f3a4;};'use strict';var _=require(_0x6659('0x0'));var util=require(_0x6659('0x1'));var logger=require('../../config/logger')(_0x6659('0x2'));var moment=require(_0x6659('0x3'));var BPromise=require(_0x6659('0x4'));var rp=require(_0x6659('0x5'));var fs=require('fs');var path=require(_0x6659('0x6'));var rimraf=require(_0x6659('0x7'));var config=require('../../config/environment');var attributes=require('./voiceAgentReport.attributes');module[_0x6659('0x8')]=function(_0x3091f1,_0xd6bf59){return _0x3091f1[_0x6659('0x9')](_0x6659('0xa'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':['uniqueid',_0x6659('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 802185b..33aee38 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 _0x6a16=['VoiceAgentReport','create','body','options','raw','UpdateVoiceAgentReport','limit','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateVoiceAgentReport'];(function(_0x35f4fb,_0x540863){var _0xade7d6=function(_0xcf05a6){while(--_0xcf05a6){_0x35f4fb['push'](_0x35f4fb['shift']());}};_0xade7d6(++_0x540863);}(_0x6a16,0x1d8));var _0x66a1=function(_0x47411f,_0x5e0737){_0x47411f=_0x47411f-0x0;var _0x1fb64e=_0x6a16[_0x47411f];return _0x1fb64e;};'use strict';var _=require(_0x66a1('0x0'));var util=require(_0x66a1('0x1'));var moment=require(_0x66a1('0x2'));var BPromise=require(_0x66a1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x66a1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x66a1('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x66a1('0x6'));var jayson=require(_0x66a1('0x7'));var client=jayson[_0x66a1('0x8')][_0x66a1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3d67df,_0x4d7df1,_0x22156a){return new BPromise(function(_0x96e846,_0x38fbd5){return client[_0x66a1('0xa')](_0x3d67df,_0x22156a)[_0x66a1('0xb')](function(_0x588242){logger['info'](_0x66a1('0xc'),_0x4d7df1,_0x66a1('0xd'));logger[_0x66a1('0xe')](_0x66a1('0xf'),_0x4d7df1,'request\x20sent',JSON[_0x66a1('0x10')](_0x588242));if(_0x588242[_0x66a1('0x11')]){if(_0x588242[_0x66a1('0x11')][_0x66a1('0x12')]===0x1f4){logger[_0x66a1('0x11')](_0x66a1('0xc'),_0x4d7df1,_0x588242[_0x66a1('0x11')][_0x66a1('0x13')]);return _0x38fbd5(_0x588242[_0x66a1('0x11')]['message']);}logger[_0x66a1('0x11')]('VoiceAgentReport,\x20%s,\x20%s',_0x4d7df1,_0x588242[_0x66a1('0x11')][_0x66a1('0x13')]);return _0x96e846(_0x588242[_0x66a1('0x11')]['message']);}else{logger[_0x66a1('0x14')](_0x66a1('0xc'),_0x4d7df1,_0x66a1('0xd'));_0x96e846(_0x588242[_0x66a1('0x15')][_0x66a1('0x13')]);}})[_0x66a1('0x16')](function(_0x59726b){logger[_0x66a1('0x11')](_0x66a1('0xc'),_0x4d7df1,_0x59726b);_0x38fbd5(_0x59726b);});});}exports[_0x66a1('0x17')]=function(_0x2b50eb){var _0x40f0c5=this;return new Promise(function(_0x323cec,_0x4465a5){return db[_0x66a1('0x18')][_0x66a1('0x19')](_0x2b50eb[_0x66a1('0x1a')],{'raw':_0x2b50eb[_0x66a1('0x1b')]?_0x2b50eb[_0x66a1('0x1b')][_0x66a1('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x282486){logger[_0x66a1('0x14')](_0x66a1('0x17'),_0x2b50eb);logger[_0x66a1('0xe')](_0x66a1('0x17'),_0x2b50eb,JSON[_0x66a1('0x10')](_0x282486));_0x323cec(_0x282486);})[_0x66a1('0x16')](function(_0x58482b){logger[_0x66a1('0x11')](_0x66a1('0x17'),_0x58482b['message'],_0x2b50eb);_0x4465a5(_0x40f0c5[_0x66a1('0x11')](0x1f4,_0x58482b['message']));});});};exports[_0x66a1('0x1d')]=function(_0x4a0c01){var _0xa49b4=this;return new Promise(function(_0x11e531,_0x5086f8){return db[_0x66a1('0x18')]['update'](_0x4a0c01[_0x66a1('0x1a')],{'raw':_0x4a0c01[_0x66a1('0x1b')]?_0x4a0c01[_0x66a1('0x1b')][_0x66a1('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4a0c01['options']?_0x4a0c01[_0x66a1('0x1b')]['where']||null:null,'attributes':_0x4a0c01[_0x66a1('0x1b')]?_0x4a0c01[_0x66a1('0x1b')]['attributes']||null:null,'limit':_0x4a0c01[_0x66a1('0x1b')]?_0x4a0c01[_0x66a1('0x1b')][_0x66a1('0x1e')]||null:null})[_0x66a1('0xb')](function(_0x1ccdd2){logger[_0x66a1('0x14')](_0x66a1('0x1d'),_0x4a0c01);logger[_0x66a1('0xe')](_0x66a1('0x1d'),_0x4a0c01,JSON['stringify'](_0x1ccdd2));_0x11e531(_0x1ccdd2);})[_0x66a1('0x16')](function(_0x4f1352){logger['error']('UpdateVoiceAgentReport',_0x4f1352[_0x66a1('0x13')],_0x4a0c01);_0x5086f8(_0xa49b4[_0x66a1('0x11')](0x1f4,_0x4f1352[_0x66a1('0x13')]));});});}; \ No newline at end of file +var _0xa430=['catch','CreateVoiceAgentReport','VoiceAgentReport','body','options','raw','UpdateVoiceAgentReport','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x531d20,_0x5682b0){var _0x425a5b=function(_0x4dd8f6){while(--_0x4dd8f6){_0x531d20['push'](_0x531d20['shift']());}};_0x425a5b(++_0x5682b0);}(_0xa430,0x16a));var _0x0a43=function(_0x39ecd0,_0x1e935a){_0x39ecd0=_0x39ecd0-0x0;var _0x1bf291=_0xa430[_0x39ecd0];return _0x1bf291;};'use strict';var _=require(_0x0a43('0x0'));var util=require(_0x0a43('0x1'));var moment=require(_0x0a43('0x2'));var BPromise=require(_0x0a43('0x3'));var rs=require(_0x0a43('0x4'));var fs=require('fs');var Redis=require(_0x0a43('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0a43('0x6'))(_0x0a43('0x7'));var config=require(_0x0a43('0x8'));var jayson=require(_0x0a43('0x9'));var client=jayson[_0x0a43('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xa17bb3,_0x17ac0f,_0xb3fa80){return new BPromise(function(_0x23f74b,_0x5aff69){return client[_0x0a43('0xb')](_0xa17bb3,_0xb3fa80)[_0x0a43('0xc')](function(_0x4be4b7){logger[_0x0a43('0xd')](_0x0a43('0xe'),_0x17ac0f,_0x0a43('0xf'));logger[_0x0a43('0x10')](_0x0a43('0x11'),_0x17ac0f,'request\x20sent',JSON[_0x0a43('0x12')](_0x4be4b7));if(_0x4be4b7[_0x0a43('0x13')]){if(_0x4be4b7['error']['code']===0x1f4){logger[_0x0a43('0x13')](_0x0a43('0xe'),_0x17ac0f,_0x4be4b7[_0x0a43('0x13')][_0x0a43('0x14')]);return _0x5aff69(_0x4be4b7[_0x0a43('0x13')][_0x0a43('0x14')]);}logger[_0x0a43('0x13')](_0x0a43('0xe'),_0x17ac0f,_0x4be4b7[_0x0a43('0x13')][_0x0a43('0x14')]);return _0x23f74b(_0x4be4b7[_0x0a43('0x13')][_0x0a43('0x14')]);}else{logger['info'](_0x0a43('0xe'),_0x17ac0f,'request\x20sent');_0x23f74b(_0x4be4b7[_0x0a43('0x15')]['message']);}})[_0x0a43('0x16')](function(_0x2916f1){logger[_0x0a43('0x13')](_0x0a43('0xe'),_0x17ac0f,_0x2916f1);_0x5aff69(_0x2916f1);});});}exports[_0x0a43('0x17')]=function(_0x418c33){var _0x39c142=this;return new Promise(function(_0x59ac25,_0x104387){return db[_0x0a43('0x18')]['create'](_0x418c33[_0x0a43('0x19')],{'raw':_0x418c33['options']?_0x418c33[_0x0a43('0x1a')][_0x0a43('0x1b')]===undefined?!![]:![]:!![]})[_0x0a43('0xc')](function(_0xfcc7a4){logger[_0x0a43('0xd')](_0x0a43('0x17'),_0x418c33);logger[_0x0a43('0x10')]('CreateVoiceAgentReport',_0x418c33,JSON[_0x0a43('0x12')](_0xfcc7a4));_0x59ac25(_0xfcc7a4);})[_0x0a43('0x16')](function(_0x5f1b3f){logger[_0x0a43('0x13')]('CreateVoiceAgentReport',_0x5f1b3f[_0x0a43('0x14')],_0x418c33);_0x104387(_0x39c142['error'](0x1f4,_0x5f1b3f['message']));});});};exports[_0x0a43('0x1c')]=function(_0x2fd2bf){var _0x8e17dc=this;return new Promise(function(_0x43b36c,_0x11b800){return db[_0x0a43('0x18')]['update'](_0x2fd2bf[_0x0a43('0x19')],{'raw':_0x2fd2bf[_0x0a43('0x1a')]?_0x2fd2bf[_0x0a43('0x1a')][_0x0a43('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2fd2bf[_0x0a43('0x1a')]?_0x2fd2bf[_0x0a43('0x1a')][_0x0a43('0x1d')]||null:null,'attributes':_0x2fd2bf[_0x0a43('0x1a')]?_0x2fd2bf['options'][_0x0a43('0x1e')]||null:null,'limit':_0x2fd2bf[_0x0a43('0x1a')]?_0x2fd2bf['options'][_0x0a43('0x1f')]||null:null})[_0x0a43('0xc')](function(_0x98d4a7){logger['info'](_0x0a43('0x1c'),_0x2fd2bf);logger['debug'](_0x0a43('0x1c'),_0x2fd2bf,JSON['stringify'](_0x98d4a7));_0x43b36c(_0x98d4a7);})[_0x0a43('0x16')](function(_0x432bcb){logger['error'](_0x0a43('0x1c'),_0x432bcb[_0x0a43('0x14')],_0x2fd2bf);_0x11b800(_0x8e17dc['error'](0x1f4,_0x432bcb[_0x0a43('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 9b1603a..7c9afcf 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 _0xed1f=['destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','put','update'];(function(_0x4d0b5b,_0xf881c4){var _0x521856=function(_0x2e5d01){while(--_0x2e5d01){_0x4d0b5b['push'](_0x4d0b5b['shift']());}};_0x521856(++_0xf881c4);}(_0xed1f,0x6a));var _0xfed1=function(_0x26f702,_0x3919bf){_0x26f702=_0x26f702-0x0;var _0x11417d=_0xed1f[_0x26f702];return _0x11417d;};'use strict';var multer=require(_0xfed1('0x0'));var util=require(_0xfed1('0x1'));var path=require(_0xfed1('0x2'));var timeout=require(_0xfed1('0x3'));var express=require(_0xfed1('0x4'));var router=express[_0xfed1('0x5')]();var fs_extra=require(_0xfed1('0x6'));var auth=require(_0xfed1('0x7'));var interaction=require(_0xfed1('0x8'));var config=require(_0xfed1('0x9'));var controller=require(_0xfed1('0xa'));router[_0xfed1('0xb')]('/',auth[_0xfed1('0xc')](),controller[_0xfed1('0xd')]);router[_0xfed1('0xb')](_0xfed1('0xe'),auth[_0xfed1('0xc')](),controller[_0xfed1('0xf')]);router['get'](_0xfed1('0x10'),auth[_0xfed1('0xc')](),controller['show']);router[_0xfed1('0x11')]('/',auth[_0xfed1('0xc')](),controller['create']);router[_0xfed1('0x12')]('/:id',auth[_0xfed1('0xc')](),controller[_0xfed1('0x13')]);router['delete']('/:id',auth[_0xfed1('0xc')](),controller[_0xfed1('0x14')]);module['exports']=router; \ No newline at end of file +var _0xdbf5=['show','post','put','update','exports','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','index','/describe'];(function(_0x58ae8a,_0x3c619e){var _0x2f0b6b=function(_0x6db940){while(--_0x6db940){_0x58ae8a['push'](_0x58ae8a['shift']());}};_0x2f0b6b(++_0x3c619e);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x13a468,_0x5a248b){_0x13a468=_0x13a468-0x0;var _0x3b15c0=_0xdbf5[_0x13a468];return _0x3b15c0;};'use strict';var multer=require('multer');var util=require(_0x5dbf('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5dbf('0x1'));var router=express[_0x5dbf('0x2')]();var fs_extra=require(_0x5dbf('0x3'));var auth=require(_0x5dbf('0x4'));var interaction=require(_0x5dbf('0x5'));var config=require(_0x5dbf('0x6'));var controller=require(_0x5dbf('0x7'));router[_0x5dbf('0x8')]('/',auth[_0x5dbf('0x9')](),controller[_0x5dbf('0xa')]);router[_0x5dbf('0x8')](_0x5dbf('0xb'),auth[_0x5dbf('0x9')](),controller['describe']);router[_0x5dbf('0x8')]('/:id',auth[_0x5dbf('0x9')](),controller[_0x5dbf('0xc')]);router[_0x5dbf('0xd')]('/',auth[_0x5dbf('0x9')](),controller['create']);router[_0x5dbf('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x5dbf('0xf')]);router['delete']('/:id',auth[_0x5dbf('0x9')](),controller['destroy']);module[_0x5dbf('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 18b5231..c7f16be 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 _0x66d4=['internal','outbound','inbound-fax','STRING','TEXT','DATE','INTEGER','exports','ENUM','inbound'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x66d4,0x10b));var _0x466d=function(_0x1d50f2,_0x3c3ec6){_0x1d50f2=_0x1d50f2-0x0;var _0x3769b8=_0x66d4[_0x1d50f2];return _0x3769b8;};'use strict';var Sequelize=require('sequelize');module[_0x466d('0x0')]={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x466d('0x1')](_0x466d('0x2'),_0x466d('0x3'),_0x466d('0x4'),_0x466d('0x5'),'outbound-fax','dialer')},'tag':{'type':Sequelize[_0x466d('0x6')]},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize[_0x466d('0x6')]},'destination':{'type':Sequelize[_0x466d('0x6')]},'destinationcontext':{'type':Sequelize[_0x466d('0x6')]},'callerid':{'type':Sequelize[_0x466d('0x6')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize[_0x466d('0x6')]},'lastdata':{'type':Sequelize[_0x466d('0x7')]},'starttime':{'type':Sequelize[_0x466d('0x8')]},'systemanswertime':{'type':Sequelize[_0x466d('0x8')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x466d('0x8')]},'duration':{'type':Sequelize[_0x466d('0x9')]},'billableseconds':{'type':Sequelize[_0x466d('0x9')]},'mohtime':{'type':Sequelize[_0x466d('0x9')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x466d('0x6')]},'amaflags':{'type':Sequelize[_0x466d('0x6')]},'userfield':{'type':Sequelize[_0x466d('0x6')]},'userDisposition':{'type':Sequelize[_0x466d('0x6')]},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x466d('0x6')]},'prefix':{'type':Sequelize[_0x466d('0x6')]},'routeid':{'type':Sequelize[_0x466d('0x9')]},'sipcallid':{'type':Sequelize[_0x466d('0x6')]}}; \ No newline at end of file +var _0x7bb9=['inbound','outbound','TEXT','DATE','INTEGER','sequelize','exports','STRING','ENUM'];(function(_0x17e4d0,_0x2d354b){var _0x559fe2=function(_0x2216e5){while(--_0x2216e5){_0x17e4d0['push'](_0x17e4d0['shift']());}};_0x559fe2(++_0x2d354b);}(_0x7bb9,0x1eb));var _0x97bb=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0x7bb9[_0x1deb03];return _0x189fe7;};'use strict';var Sequelize=require(_0x97bb('0x0'));module[_0x97bb('0x1')]={'uniqueid':{'type':Sequelize[_0x97bb('0x2')]},'type':{'type':Sequelize[_0x97bb('0x3')](_0x97bb('0x4'),'internal',_0x97bb('0x5'),'inbound-fax','outbound-fax','dialer')},'tag':{'type':Sequelize[_0x97bb('0x2')]},'accountcode':{'type':Sequelize[_0x97bb('0x2')]},'source':{'type':Sequelize[_0x97bb('0x2')]},'destination':{'type':Sequelize[_0x97bb('0x2')]},'destinationcontext':{'type':Sequelize[_0x97bb('0x2')]},'callerid':{'type':Sequelize[_0x97bb('0x2')]},'channel':{'type':Sequelize[_0x97bb('0x2')]},'destinationchannel':{'type':Sequelize[_0x97bb('0x2')]},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x97bb('0x6')]},'starttime':{'type':Sequelize[_0x97bb('0x7')]},'systemanswertime':{'type':Sequelize[_0x97bb('0x7')]},'answertime':{'type':Sequelize[_0x97bb('0x7')]},'endtime':{'type':Sequelize[_0x97bb('0x7')]},'duration':{'type':Sequelize[_0x97bb('0x8')]},'billableseconds':{'type':Sequelize[_0x97bb('0x8')]},'mohtime':{'type':Sequelize[_0x97bb('0x8')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x97bb('0x2')]},'amaflags':{'type':Sequelize[_0x97bb('0x2')]},'userfield':{'type':Sequelize[_0x97bb('0x2')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x97bb('0x2')]},'userThirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x97bb('0x2')]},'prefix':{'type':Sequelize[_0x97bb('0x2')]},'routeid':{'type':Sequelize[_0x97bb('0x8')]},'sipcallid':{'type':Sequelize[_0x97bb('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index f68283f..8fc48f9 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(_0x5eef70,_0x59f7b2){var _0x3ff465=function(_0x121de5){while(--_0x121de5){_0x5eef70['push'](_0x5eef70['shift']());}};_0x3ff465(++_0x59f7b2);}(_0xdb28,0x106));var _0x8db2=function(_0x2c4405,_0x15d8bc){_0x2c4405=_0x2c4405-0x0;var _0x4ed77a=_0xdb28[_0x2c4405];return _0x4ed77a;};'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(_0x10260e,_0x59148e){_0x10260e=_0x10260e-0x0;var _0x2d9210=_0x2032[_0x10260e];return _0x2d9210;};'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 5445ccb..5caaf83 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 _0xdc32=['util','../../config/logger','api','request-promise','path','../../config/environment','./voiceCallReport.attributes','exports','report_call','uniqueid','lodash'];(function(_0x21fd4a,_0x5b6522){var _0x187e5a=function(_0x457f2c){while(--_0x457f2c){_0x21fd4a['push'](_0x21fd4a['shift']());}};_0x187e5a(++_0x5b6522);}(_0xdc32,0x18b));var _0x2dc3=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xdc32[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x2dc3('0x0'));var util=require(_0x2dc3('0x1'));var logger=require(_0x2dc3('0x2'))(_0x2dc3('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2dc3('0x4'));var fs=require('fs');var path=require(_0x2dc3('0x5'));var rimraf=require('rimraf');var config=require(_0x2dc3('0x6'));var attributes=require(_0x2dc3('0x7'));module[_0x2dc3('0x8')]=function(_0x439c22,_0xeac4db){return _0x439c22['define']('VoiceCallReport',attributes,{'tableName':_0x2dc3('0x9'),'paranoid':![],'indexes':[{'fields':[_0x2dc3('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfb7b=['../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x2cccad,_0x178c6f){var _0x5170f2=function(_0x1ea616){while(--_0x1ea616){_0x2cccad['push'](_0x2cccad['shift']());}};_0x5170f2(++_0x178c6f);}(_0xfb7b,0x1c9));var _0xbfb7=function(_0x4876df,_0x154cff){_0x4876df=_0x4876df-0x0;var _0xda258a=_0xfb7b[_0x4876df];return _0xda258a;};'use strict';var _=require(_0xbfb7('0x0'));var util=require(_0xbfb7('0x1'));var logger=require(_0xbfb7('0x2'))(_0xbfb7('0x3'));var moment=require('moment');var BPromise=require(_0xbfb7('0x4'));var rp=require(_0xbfb7('0x5'));var fs=require('fs');var path=require(_0xbfb7('0x6'));var rimraf=require(_0xbfb7('0x7'));var config=require(_0xbfb7('0x8'));var attributes=require(_0xbfb7('0x9'));module[_0xbfb7('0xa')]=function(_0x583ff2,_0x4facca){return _0x583ff2[_0xbfb7('0xb')](_0xbfb7('0xc'),attributes,{'tableName':_0xbfb7('0xd'),'paranoid':![],'indexes':[{'fields':[_0xbfb7('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index f6748a5..04881d2 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 _0x369c=['attributes','map','model','GetVoiceCallReport','catch','create','body','CreateVoiceCallReport','UpdateVoiceCallReport','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','VoiceCallReport','findAll','options','raw','where','limit','include'];(function(_0x13c164,_0x494753){var _0x27ffcc=function(_0x1a32ef){while(--_0x1a32ef){_0x13c164['push'](_0x13c164['shift']());}};_0x27ffcc(++_0x494753);}(_0x369c,0x99));var _0xc369=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x369c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc369('0x0'));var BPromise=require(_0xc369('0x1'));var rs=require(_0xc369('0x2'));var fs=require('fs');var Redis=require(_0xc369('0x3'));var db=require(_0xc369('0x4'))['db'];var utils=require(_0xc369('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xc369('0x6'));var jayson=require(_0xc369('0x7'));var client=jayson[_0xc369('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x392582,_0x5e94cb,_0x15728e){return new BPromise(function(_0x222976,_0x441bd5){return client[_0xc369('0x9')](_0x392582,_0x15728e)[_0xc369('0xa')](function(_0xba66a1){logger[_0xc369('0xb')](_0xc369('0xc'),_0x5e94cb,_0xc369('0xd'));logger[_0xc369('0xe')](_0xc369('0xf'),_0x5e94cb,'request\x20sent',JSON[_0xc369('0x10')](_0xba66a1));if(_0xba66a1[_0xc369('0x11')]){if(_0xba66a1['error']['code']===0x1f4){logger['error']('VoiceCallReport,\x20%s,\x20%s',_0x5e94cb,_0xba66a1[_0xc369('0x11')][_0xc369('0x12')]);return _0x441bd5(_0xba66a1[_0xc369('0x11')][_0xc369('0x12')]);}logger[_0xc369('0x11')](_0xc369('0xc'),_0x5e94cb,_0xba66a1['error'][_0xc369('0x12')]);return _0x222976(_0xba66a1[_0xc369('0x11')]['message']);}else{logger[_0xc369('0xb')]('VoiceCallReport,\x20%s,\x20%s',_0x5e94cb,'request\x20sent');_0x222976(_0xba66a1[_0xc369('0x13')][_0xc369('0x12')]);}})['catch'](function(_0x1eabed){logger['error'](_0xc369('0xc'),_0x5e94cb,_0x1eabed);_0x441bd5(_0x1eabed);});});}exports['GetVoiceCallReport']=function(_0x4bb463){var _0x6c6670=this;return new Promise(function(_0x517d26,_0x5b1f95){return db[_0xc369('0x14')][_0xc369('0x15')]({'raw':_0x4bb463[_0xc369('0x16')]?_0x4bb463[_0xc369('0x16')][_0xc369('0x17')]===undefined?!![]:![]:!![],'where':_0x4bb463[_0xc369('0x16')]?_0x4bb463[_0xc369('0x16')][_0xc369('0x18')]||null:null,'attributes':_0x4bb463[_0xc369('0x16')]?_0x4bb463[_0xc369('0x16')]['attributes']||null:null,'limit':_0x4bb463[_0xc369('0x16')]?_0x4bb463[_0xc369('0x16')][_0xc369('0x19')]||null:null,'include':_0x4bb463[_0xc369('0x16')]?_0x4bb463[_0xc369('0x16')][_0xc369('0x1a')]?_['map'](_0x4bb463[_0xc369('0x16')][_0xc369('0x1a')],function(_0x205c92){return{'model':db[_0x205c92['model']],'as':_0x205c92['as'],'attributes':_0x205c92[_0xc369('0x1b')],'include':_0x205c92[_0xc369('0x1a')]?_[_0xc369('0x1c')](_0x205c92[_0xc369('0x1a')],function(_0x5ec285){return{'model':db[_0x5ec285[_0xc369('0x1d')]],'as':_0x5ec285['as'],'attributes':_0x5ec285['attributes'],'include':_0x5ec285['include']?_[_0xc369('0x1c')](_0x5ec285[_0xc369('0x1a')],function(_0x22897d){return{'model':db[_0x22897d[_0xc369('0x1d')]],'as':_0x22897d['as'],'attributes':_0x22897d[_0xc369('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xc369('0xa')](function(_0x4957bc){logger[_0xc369('0xb')](_0xc369('0x1e'),_0x4bb463);logger[_0xc369('0xe')](_0xc369('0x1e'),_0x4bb463,JSON[_0xc369('0x10')](_0x4957bc));_0x517d26(_0x4957bc);})[_0xc369('0x1f')](function(_0x462cd9){logger['error'](_0xc369('0x1e'),_0x462cd9['message'],_0x4bb463);_0x5b1f95(_0x6c6670[_0xc369('0x11')](0x1f4,_0x462cd9[_0xc369('0x12')]));});});};exports['CreateVoiceCallReport']=function(_0x3fe484){var _0x107087=this;return new Promise(function(_0x237d70,_0x3c4a9d){return db[_0xc369('0x14')][_0xc369('0x20')](_0x3fe484[_0xc369('0x21')],{'raw':_0x3fe484[_0xc369('0x16')]?_0x3fe484['options']['raw']===undefined?!![]:![]:!![]})[_0xc369('0xa')](function(_0x168d11){logger[_0xc369('0xb')]('CreateVoiceCallReport',_0x3fe484);logger[_0xc369('0xe')](_0xc369('0x22'),_0x3fe484,JSON[_0xc369('0x10')](_0x168d11));_0x237d70(_0x168d11);})[_0xc369('0x1f')](function(_0x3e4c5d){logger[_0xc369('0x11')](_0xc369('0x22'),_0x3e4c5d[_0xc369('0x12')],_0x3fe484);_0x3c4a9d(_0x107087[_0xc369('0x11')](0x1f4,_0x3e4c5d[_0xc369('0x12')]));});});};exports[_0xc369('0x23')]=function(_0x3697de){var _0x359ae6=this;return new Promise(function(_0x532874,_0x517009){return db[_0xc369('0x14')]['update'](_0x3697de['body'],{'raw':_0x3697de[_0xc369('0x16')]?_0x3697de['options'][_0xc369('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3697de[_0xc369('0x16')]?_0x3697de[_0xc369('0x16')][_0xc369('0x18')]||null:null,'attributes':_0x3697de[_0xc369('0x16')]?_0x3697de[_0xc369('0x16')]['attributes']||null:null,'limit':_0x3697de[_0xc369('0x16')]?_0x3697de[_0xc369('0x16')][_0xc369('0x19')]||null:null})['then'](function(_0xf8e5f5){logger[_0xc369('0xb')](_0xc369('0x23'),_0x3697de);logger[_0xc369('0xe')](_0xc369('0x23'),_0x3697de,JSON[_0xc369('0x10')](_0xf8e5f5));_0x532874(_0xf8e5f5);})['catch'](function(_0x1b9561){logger[_0xc369('0x11')]('UpdateVoiceCallReport',_0x1b9561[_0xc369('0x12')],_0x3697de);_0x517009(_0x359ae6[_0xc369('0x11')](0x1f4,_0x1b9561[_0xc369('0x12')]));});});}; \ No newline at end of file +var _0x53d4=['http','then','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','GetVoiceCallReport','VoiceCallReport','findAll','options','where','limit','include','map','attributes','model','catch','CreateVoiceCallReport','create','body','raw','UpdateVoiceCallReport','update','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0xebc21d,_0x25c9b5){var _0x5e0d90=function(_0x209613){while(--_0x209613){_0xebc21d['push'](_0xebc21d['shift']());}};_0x5e0d90(++_0x25c9b5);}(_0x53d4,0x107));var _0x453d=function(_0x1b9e32,_0x22ba6f){_0x1b9e32=_0x1b9e32-0x0;var _0x4db419=_0x53d4[_0x1b9e32];return _0x4db419;};'use strict';var _=require(_0x453d('0x0'));var util=require(_0x453d('0x1'));var moment=require('moment');var BPromise=require(_0x453d('0x2'));var rs=require(_0x453d('0x3'));var fs=require('fs');var Redis=require(_0x453d('0x4'));var db=require(_0x453d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x453d('0x6'))('rpc');var config=require(_0x453d('0x7'));var jayson=require(_0x453d('0x8'));var client=jayson[_0x453d('0x9')][_0x453d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1dc432,_0x2c0ed0,_0x3fb2d8){return new BPromise(function(_0x51b0a,_0xf0aa60){return client['request'](_0x1dc432,_0x3fb2d8)[_0x453d('0xb')](function(_0x28f3d2){logger['info'](_0x453d('0xc'),_0x2c0ed0,_0x453d('0xd'));logger[_0x453d('0xe')](_0x453d('0xf'),_0x2c0ed0,_0x453d('0xd'),JSON[_0x453d('0x10')](_0x28f3d2));if(_0x28f3d2[_0x453d('0x11')]){if(_0x28f3d2[_0x453d('0x11')][_0x453d('0x12')]===0x1f4){logger['error'](_0x453d('0xc'),_0x2c0ed0,_0x28f3d2[_0x453d('0x11')]['message']);return _0xf0aa60(_0x28f3d2[_0x453d('0x11')]['message']);}logger['error'](_0x453d('0xc'),_0x2c0ed0,_0x28f3d2[_0x453d('0x11')][_0x453d('0x13')]);return _0x51b0a(_0x28f3d2[_0x453d('0x11')][_0x453d('0x13')]);}else{logger[_0x453d('0x14')](_0x453d('0xc'),_0x2c0ed0,_0x453d('0xd'));_0x51b0a(_0x28f3d2[_0x453d('0x15')][_0x453d('0x13')]);}})['catch'](function(_0xa56b40){logger[_0x453d('0x11')](_0x453d('0xc'),_0x2c0ed0,_0xa56b40);_0xf0aa60(_0xa56b40);});});}exports[_0x453d('0x16')]=function(_0x5349fb){var _0x16da5b=this;return new Promise(function(_0x3afce1,_0x573ff1){return db[_0x453d('0x17')][_0x453d('0x18')]({'raw':_0x5349fb[_0x453d('0x19')]?_0x5349fb[_0x453d('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x5349fb['options']?_0x5349fb[_0x453d('0x19')][_0x453d('0x1a')]||null:null,'attributes':_0x5349fb[_0x453d('0x19')]?_0x5349fb['options']['attributes']||null:null,'limit':_0x5349fb[_0x453d('0x19')]?_0x5349fb['options'][_0x453d('0x1b')]||null:null,'include':_0x5349fb[_0x453d('0x19')]?_0x5349fb['options'][_0x453d('0x1c')]?_[_0x453d('0x1d')](_0x5349fb['options'][_0x453d('0x1c')],function(_0x3aed53){return{'model':db[_0x3aed53['model']],'as':_0x3aed53['as'],'attributes':_0x3aed53[_0x453d('0x1e')],'include':_0x3aed53[_0x453d('0x1c')]?_['map'](_0x3aed53[_0x453d('0x1c')],function(_0x404e8e){return{'model':db[_0x404e8e[_0x453d('0x1f')]],'as':_0x404e8e['as'],'attributes':_0x404e8e[_0x453d('0x1e')],'include':_0x404e8e[_0x453d('0x1c')]?_[_0x453d('0x1d')](_0x404e8e['include'],function(_0x24f4de){return{'model':db[_0x24f4de[_0x453d('0x1f')]],'as':_0x24f4de['as'],'attributes':_0x24f4de[_0x453d('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x453d('0xb')](function(_0x451994){logger[_0x453d('0x14')](_0x453d('0x16'),_0x5349fb);logger[_0x453d('0xe')](_0x453d('0x16'),_0x5349fb,JSON[_0x453d('0x10')](_0x451994));_0x3afce1(_0x451994);})[_0x453d('0x20')](function(_0x44bc9a){logger[_0x453d('0x11')]('GetVoiceCallReport',_0x44bc9a['message'],_0x5349fb);_0x573ff1(_0x16da5b[_0x453d('0x11')](0x1f4,_0x44bc9a['message']));});});};exports[_0x453d('0x21')]=function(_0x153d1c){var _0x1cef64=this;return new Promise(function(_0x445ccb,_0x4b46fe){return db[_0x453d('0x17')][_0x453d('0x22')](_0x153d1c[_0x453d('0x23')],{'raw':_0x153d1c[_0x453d('0x19')]?_0x153d1c['options'][_0x453d('0x24')]===undefined?!![]:![]:!![]})[_0x453d('0xb')](function(_0x498a2a){logger[_0x453d('0x14')]('CreateVoiceCallReport',_0x153d1c);logger['debug']('CreateVoiceCallReport',_0x153d1c,JSON[_0x453d('0x10')](_0x498a2a));_0x445ccb(_0x498a2a);})[_0x453d('0x20')](function(_0x184803){logger[_0x453d('0x11')](_0x453d('0x21'),_0x184803[_0x453d('0x13')],_0x153d1c);_0x4b46fe(_0x1cef64['error'](0x1f4,_0x184803['message']));});});};exports[_0x453d('0x25')]=function(_0x450555){var _0x97b93a=this;return new Promise(function(_0x467886,_0x20c066){return db[_0x453d('0x17')][_0x453d('0x26')](_0x450555[_0x453d('0x23')],{'raw':_0x450555[_0x453d('0x19')]?_0x450555[_0x453d('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x450555[_0x453d('0x19')]?_0x450555[_0x453d('0x19')][_0x453d('0x1a')]||null:null,'attributes':_0x450555[_0x453d('0x19')]?_0x450555['options']['attributes']||null:null,'limit':_0x450555[_0x453d('0x19')]?_0x450555['options']['limit']||null:null})[_0x453d('0xb')](function(_0x7a788f){logger[_0x453d('0x14')](_0x453d('0x25'),_0x450555);logger[_0x453d('0xe')](_0x453d('0x25'),_0x450555,JSON[_0x453d('0x10')](_0x7a788f));_0x467886(_0x7a788f);})[_0x453d('0x20')](function(_0x170c47){logger['error'](_0x453d('0x25'),_0x170c47[_0x453d('0x13')],_0x450555);_0x20c066(_0x97b93a['error'](0x1f4,_0x170c47[_0x453d('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index e417b8c..69bff35 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 _0x9e81=['create','put','update','delete','/:id','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','index','get','isAuthenticated','show','post'];(function(_0x28a13f,_0x5a9aed){var _0x30d31c=function(_0x18bd94){while(--_0x18bd94){_0x28a13f['push'](_0x28a13f['shift']());}};_0x30d31c(++_0x5a9aed);}(_0x9e81,0x12c));var _0x19e8=function(_0x33c8cb,_0x56cff2){_0x33c8cb=_0x33c8cb-0x0;var _0x2d28bb=_0x9e81[_0x33c8cb];return _0x2d28bb;};'use strict';var multer=require(_0x19e8('0x0'));var util=require(_0x19e8('0x1'));var path=require(_0x19e8('0x2'));var timeout=require(_0x19e8('0x3'));var express=require(_0x19e8('0x4'));var router=express[_0x19e8('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x19e8('0x6'));var interaction=require(_0x19e8('0x7'));var config=require(_0x19e8('0x8'));var controller=require(_0x19e8('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x19e8('0xa')]);router[_0x19e8('0xb')]('/:id',auth[_0x19e8('0xc')](),controller[_0x19e8('0xd')]);router[_0x19e8('0xe')]('/',auth[_0x19e8('0xc')](),controller[_0x19e8('0xf')]);router[_0x19e8('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x19e8('0x11')]);router[_0x19e8('0x12')](_0x19e8('0x13'),auth[_0x19e8('0xc')](),controller['destroy']);module[_0x19e8('0x14')]=router; \ No newline at end of file +var _0xd013=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','post','put','update','delete','destroy','multer','util','path'];(function(_0x465e65,_0x4cab6a){var _0x413339=function(_0x1a964e){while(--_0x1a964e){_0x465e65['push'](_0x465e65['shift']());}};_0x413339(++_0x4cab6a);}(_0xd013,0xe1));var _0x3d01=function(_0x11e30d,_0x5584aa){_0x11e30d=_0x11e30d-0x0;var _0x2d4e29=_0xd013[_0x11e30d];return _0x2d4e29;};'use strict';var multer=require(_0x3d01('0x0'));var util=require(_0x3d01('0x1'));var path=require(_0x3d01('0x2'));var timeout=require(_0x3d01('0x3'));var express=require(_0x3d01('0x4'));var router=express[_0x3d01('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x3d01('0x6'));var interaction=require(_0x3d01('0x7'));var config=require(_0x3d01('0x8'));var controller=require('./voiceChanSpy.controller');router['get']('/',auth[_0x3d01('0x9')](),controller[_0x3d01('0xa')]);router[_0x3d01('0xb')](_0x3d01('0xc'),auth[_0x3d01('0x9')](),controller[_0x3d01('0xd')]);router[_0x3d01('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3d01('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x3d01('0x10')]);router[_0x3d01('0x11')](_0x3d01('0xc'),auth[_0x3d01('0x9')](),controller[_0x3d01('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 59d47c8..8c462e4 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 _0xfe63=['sequelize','name','STRING','setDataValue','options','join','getDataValue'];(function(_0x247d8a,_0x5239d3){var _0x55733b=function(_0x223aab){while(--_0x223aab){_0x247d8a['push'](_0x247d8a['shift']());}};_0x55733b(++_0x5239d3);}(_0xfe63,0xf5));var _0x3fe6=function(_0x2aea9e,_0x1f587f){_0x2aea9e=_0x2aea9e-0x0;var _0x430b92=_0xfe63[_0x2aea9e];return _0x430b92;};'use strict';var Sequelize=require(_0x3fe6('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize['STRING'],'unique':_0x3fe6('0x1'),'allowNull':![]},'options':{'type':Sequelize[_0x3fe6('0x2')],'set':function(_0x36c5ec){this[_0x3fe6('0x3')](_0x3fe6('0x4'),_0x36c5ec?_0x36c5ec[_0x3fe6('0x5')](''):[]);},'get':function(){return this['getDataValue'](_0x3fe6('0x4'))?this[_0x3fe6('0x6')]('options')['split'](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0x3fe6('0x2')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x3fe6('0x2')]},'description':{'type':Sequelize[_0x3fe6('0x2')]}}; \ No newline at end of file +var _0xcbe8=['STRING','name','setDataValue','options','join','getDataValue','BOOLEAN'];(function(_0x53789f,_0x26176c){var _0x2a6d96=function(_0x457667){while(--_0x457667){_0x53789f['push'](_0x53789f['shift']());}};_0x2a6d96(++_0x26176c);}(_0xcbe8,0x150));var _0x8cbe=function(_0x220345,_0x116053){_0x220345=_0x220345-0x0;var _0x27b5f2=_0xcbe8[_0x220345];return _0x27b5f2;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x8cbe('0x0')],'unique':_0x8cbe('0x1'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x5cf497){this[_0x8cbe('0x2')](_0x8cbe('0x3'),_0x5cf497?_0x5cf497[_0x8cbe('0x4')](''):[]);},'get':function(){return this[_0x8cbe('0x5')](_0x8cbe('0x3'))?this[_0x8cbe('0x5')](_0x8cbe('0x3'))['split'](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0x8cbe('0x0')]},'record':{'type':Sequelize[_0x8cbe('0x6')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x8cbe('0x0')]},'description':{'type':Sequelize[_0x8cbe('0x0')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 81a76eb..538d8d2 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 _0x9c5e=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','end','stack','name','send','map','VoiceChanSpy','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','params','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChanSpies','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js'];(function(_0x2ae640,_0x182f3d){var _0x2f80d7=function(_0x27b533){while(--_0x27b533){_0x2ae640['push'](_0x2ae640['shift']());}};_0x2f80d7(++_0x182f3d);}(_0x9c5e,0x9c));var _0xe9c5=function(_0x3c8244,_0x2f960e){_0x3c8244=_0x3c8244-0x0;var _0xc66b60=_0x9c5e[_0x3c8244];return _0xc66b60;};'use strict';var emlformat=require(_0xe9c5('0x0'));var rimraf=require(_0xe9c5('0x1'));var zipdir=require(_0xe9c5('0x2'));var jsonpatch=require(_0xe9c5('0x3'));var rp=require(_0xe9c5('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe9c5('0x5'));var path=require(_0xe9c5('0x6'));var sox=require('sox');var csv=require(_0xe9c5('0x7'));var ejs=require(_0xe9c5('0x8'));var fs=require('fs');var fs_extra=require(_0xe9c5('0x9'));var _=require(_0xe9c5('0xa'));var squel=require('squel');var crypto=require(_0xe9c5('0xb'));var jsforce=require(_0xe9c5('0xc'));var deskjs=require(_0xe9c5('0xd'));var toCsv=require(_0xe9c5('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe9c5('0xe'));var authService=require(_0xe9c5('0xf'));var qs=require(_0xe9c5('0x10'));var as=require(_0xe9c5('0x11'));var hardwareService=require(_0xe9c5('0x12'));var logger=require(_0xe9c5('0x13'))(_0xe9c5('0x14'));var utils=require(_0xe9c5('0x15'));var config=require(_0xe9c5('0x16'));var licenseUtil=require(_0xe9c5('0x17'));var db=require(_0xe9c5('0x18'))['db'];function respondWithStatusCode(_0x27f3e1,_0x471401){_0x471401=_0x471401||0xcc;return function(_0x25ff11){if(_0x25ff11){return _0x27f3e1[_0xe9c5('0x19')](_0x471401);}return _0x27f3e1[_0xe9c5('0x1a')](_0x471401)['end']();};}function respondWithResult(_0x3cce36,_0xe98b11){_0xe98b11=_0xe98b11||0xc8;return function(_0x5eb474){if(_0x5eb474){return _0x3cce36[_0xe9c5('0x1a')](_0xe98b11)[_0xe9c5('0x1b')](_0x5eb474);}};}function respondWithFilteredResult(_0x232584,_0x5d8236){return function(_0x163253){if(_0x163253){var _0x14eb41=typeof _0x5d8236['offset']===_0xe9c5('0x1c')&&typeof _0x5d8236[_0xe9c5('0x1d')]===_0xe9c5('0x1c');var _0x154390=_0x163253[_0xe9c5('0x1e')];var _0x4d9c7d=_0x14eb41?0x0:_0x5d8236[_0xe9c5('0x1f')];var _0x1cecae=_0x14eb41?_0x163253[_0xe9c5('0x1e')]:_0x5d8236[_0xe9c5('0x1f')]+_0x5d8236['limit'];var _0x26492a;if(_0x1cecae>=_0x154390){_0x1cecae=_0x154390;_0x26492a=0xc8;}else{_0x26492a=0xce;}_0x232584[_0xe9c5('0x1a')](_0x26492a);return _0x232584[_0xe9c5('0x20')](_0xe9c5('0x21'),_0x4d9c7d+'-'+_0x1cecae+'/'+_0x154390)[_0xe9c5('0x1b')](_0x163253);}return null;};}function patchUpdates(_0x58fbad){return function(_0x51e860){try{jsonpatch[_0xe9c5('0x22')](_0x51e860,_0x58fbad,!![]);}catch(_0x57818d){return BPromise[_0xe9c5('0x23')](_0x57818d);}return _0x51e860[_0xe9c5('0x24')]();};}function saveUpdates(_0x21b02a,_0x4d16bc){return function(_0x5750ff){if(_0x5750ff){return _0x5750ff[_0xe9c5('0x25')](_0x21b02a)[_0xe9c5('0x26')](function(_0x37fb90){return _0x37fb90;});}return null;};}function removeEntity(_0x189a13,_0x34a7c8){return function(_0x245161){if(_0x245161){return _0x245161[_0xe9c5('0x27')]()[_0xe9c5('0x26')](function(){var _0x1cd9c4=_0x245161[_0xe9c5('0x28')]({'plain':!![]});var _0x5a3caa='ChanSpies';return db[_0xe9c5('0x29')][_0xe9c5('0x27')]({'where':{'type':_0x5a3caa,'resourceId':_0x1cd9c4['id']}})[_0xe9c5('0x26')](function(){return _0x245161;});})[_0xe9c5('0x26')](function(){_0x189a13[_0xe9c5('0x1a')](0xcc)[_0xe9c5('0x2a')]();});}};}function handleEntityNotFound(_0x493108,_0x2c3fcb){return function(_0x480187){if(!_0x480187){_0x493108[_0xe9c5('0x19')](0x194);}return _0x480187;};}function handleError(_0x50256b,_0x4fa0c2){_0x4fa0c2=_0x4fa0c2||0x1f4;return function(_0x2112a6){logger['error'](_0x2112a6[_0xe9c5('0x2b')]);if(_0x2112a6[_0xe9c5('0x2c')]){delete _0x2112a6[_0xe9c5('0x2c')];}_0x50256b[_0xe9c5('0x1a')](_0x4fa0c2)[_0xe9c5('0x2d')](_0x2112a6);};}exports['index']=function(_0xe3464c,_0x4fcabd){var _0x46d3e6={},_0x5088a6={},_0x348fee={'count':0x0,'rows':[]};var _0x32e267=_[_0xe9c5('0x2e')](db[_0xe9c5('0x2f')][_0xe9c5('0x30')],function(_0x4e6043){return{'name':_0x4e6043[_0xe9c5('0x31')],'type':_0x4e6043[_0xe9c5('0x32')][_0xe9c5('0x33')]};});_0x5088a6[_0xe9c5('0x34')]=_[_0xe9c5('0x2e')](_0x32e267,'name');_0x5088a6['query']=_[_0xe9c5('0x35')](_0xe3464c[_0xe9c5('0x36')]);_0x5088a6[_0xe9c5('0x37')]=_[_0xe9c5('0x38')](_0x5088a6[_0xe9c5('0x34')],_0x5088a6[_0xe9c5('0x36')]);_0x46d3e6[_0xe9c5('0x39')]=_[_0xe9c5('0x38')](_0x5088a6['model'],qs[_0xe9c5('0x3a')](_0xe3464c[_0xe9c5('0x36')]['fields']));_0x46d3e6[_0xe9c5('0x39')]=_0x46d3e6['attributes'][_0xe9c5('0x3b')]?_0x46d3e6[_0xe9c5('0x39')]:_0x5088a6[_0xe9c5('0x34')];if(!_0xe3464c[_0xe9c5('0x36')][_0xe9c5('0x3c')](_0xe9c5('0x3d'))){_0x46d3e6[_0xe9c5('0x1d')]=qs[_0xe9c5('0x1d')](_0xe3464c[_0xe9c5('0x36')][_0xe9c5('0x1d')]);_0x46d3e6[_0xe9c5('0x1f')]=qs[_0xe9c5('0x1f')](_0xe3464c[_0xe9c5('0x36')][_0xe9c5('0x1f')]);}_0x46d3e6[_0xe9c5('0x3e')]=qs[_0xe9c5('0x3f')](_0xe3464c[_0xe9c5('0x36')][_0xe9c5('0x3f')]);_0x46d3e6[_0xe9c5('0x40')]=qs['filters'](_[_0xe9c5('0x41')](_0xe3464c[_0xe9c5('0x36')],_0x5088a6[_0xe9c5('0x37')]),_0x32e267);if(_0xe3464c[_0xe9c5('0x36')][_0xe9c5('0x42')]){_0x46d3e6[_0xe9c5('0x40')]=_['merge'](_0x46d3e6[_0xe9c5('0x40')],{'$or':_[_0xe9c5('0x2e')](_0x32e267,function(_0x3a8be8){if(_0x3a8be8['type']!==_0xe9c5('0x43')){var _0x1bf7c5={};_0x1bf7c5[_0x3a8be8[_0xe9c5('0x2c')]]={'$like':'%'+_0xe3464c[_0xe9c5('0x36')][_0xe9c5('0x42')]+'%'};return _0x1bf7c5;}})});}_0x46d3e6=_[_0xe9c5('0x44')]({},_0x46d3e6,_0xe3464c[_0xe9c5('0x45')]);var _0x1fdf92={'where':_0x46d3e6[_0xe9c5('0x40')]};return db[_0xe9c5('0x2f')][_0xe9c5('0x1e')](_0x1fdf92)['then'](function(_0x51dd18){_0x348fee[_0xe9c5('0x1e')]=_0x51dd18;if(_0xe3464c[_0xe9c5('0x36')][_0xe9c5('0x46')]){_0x46d3e6[_0xe9c5('0x47')]=[{'all':!![]}];}return db['VoiceChanSpy']['findAll'](_0x46d3e6);})[_0xe9c5('0x26')](function(_0x144e85){_0x348fee['rows']=_0x144e85;return _0x348fee;})[_0xe9c5('0x26')](respondWithFilteredResult(_0x4fcabd,_0x46d3e6))['catch'](handleError(_0x4fcabd,null));};exports['show']=function(_0x5c395d,_0x3c7e42){var _0x232ab0={'raw':![],'where':{'id':_0x5c395d[_0xe9c5('0x48')]['id']}},_0x1d081a={};_0x1d081a['model']=_[_0xe9c5('0x35')](db[_0xe9c5('0x2f')][_0xe9c5('0x30')]);_0x1d081a[_0xe9c5('0x36')]=_[_0xe9c5('0x35')](_0x5c395d[_0xe9c5('0x36')]);_0x1d081a[_0xe9c5('0x37')]=_[_0xe9c5('0x38')](_0x1d081a['model'],_0x1d081a[_0xe9c5('0x36')]);_0x232ab0[_0xe9c5('0x39')]=_[_0xe9c5('0x38')](_0x1d081a[_0xe9c5('0x34')],qs[_0xe9c5('0x3a')](_0x5c395d[_0xe9c5('0x36')]['fields']));_0x232ab0['attributes']=_0x232ab0['attributes']['length']?_0x232ab0[_0xe9c5('0x39')]:_0x1d081a[_0xe9c5('0x34')];if(_0x5c395d[_0xe9c5('0x36')]['includeAll']){_0x232ab0[_0xe9c5('0x47')]=[{'all':!![]}];}_0x232ab0=_[_0xe9c5('0x44')]({},_0x232ab0,_0x5c395d[_0xe9c5('0x45')]);return db[_0xe9c5('0x2f')][_0xe9c5('0x49')](_0x232ab0)[_0xe9c5('0x26')](handleEntityNotFound(_0x3c7e42,null))['then'](respondWithResult(_0x3c7e42,null))[_0xe9c5('0x4a')](handleError(_0x3c7e42,null));};exports[_0xe9c5('0x4b')]=function(_0x1da6a3,_0x249940){return db['VoiceChanSpy'][_0xe9c5('0x4b')](_0x1da6a3[_0xe9c5('0x4c')],{})[_0xe9c5('0x26')](function(_0x2d68be){var _0x38396f=_0x1da6a3[_0xe9c5('0x4d')]['get']({'plain':!![]});if(!_0x38396f)throw new Error(_0xe9c5('0x4e'));if(_0x38396f[_0xe9c5('0x4f')]===_0xe9c5('0x4d')){var _0x9d0154=_0x2d68be['get']({'plain':!![]});var _0x375f60=_0xe9c5('0x50');return db[_0xe9c5('0x51')][_0xe9c5('0x49')]({'where':{'name':_0x375f60,'userProfileId':_0x38396f[_0xe9c5('0x52')]},'raw':!![]})[_0xe9c5('0x26')](function(_0x581f8f){if(_0x581f8f&&_0x581f8f['autoAssociation']===0x0){return db[_0xe9c5('0x29')][_0xe9c5('0x4b')]({'name':_0x9d0154[_0xe9c5('0x2c')],'resourceId':_0x9d0154['id'],'type':_0x581f8f[_0xe9c5('0x2c')],'sectionId':_0x581f8f['id']},{})[_0xe9c5('0x26')](function(){return _0x2d68be;});}else{return _0x2d68be;}})[_0xe9c5('0x4a')](function(_0x2a9260){logger[_0xe9c5('0x53')](_0xe9c5('0x54'),_0x2a9260);throw _0x2a9260;});}return _0x2d68be;})[_0xe9c5('0x26')](respondWithResult(_0x249940,0xc9))[_0xe9c5('0x4a')](handleError(_0x249940,null));};exports[_0xe9c5('0x25')]=function(_0x2086fd,_0x3cd72b){if(_0x2086fd[_0xe9c5('0x4c')]['id']){delete _0x2086fd[_0xe9c5('0x4c')]['id'];}return db['VoiceChanSpy']['find']({'where':{'id':_0x2086fd['params']['id']}})[_0xe9c5('0x26')](handleEntityNotFound(_0x3cd72b,null))[_0xe9c5('0x26')](saveUpdates(_0x2086fd[_0xe9c5('0x4c')],null))['then'](respondWithResult(_0x3cd72b,null))[_0xe9c5('0x4a')](handleError(_0x3cd72b,null));};exports['destroy']=function(_0x227370,_0xbac8ef){return db[_0xe9c5('0x2f')][_0xe9c5('0x49')]({'where':{'id':_0x227370[_0xe9c5('0x48')]['id']}})['then'](handleEntityNotFound(_0xbac8ef,null))[_0xe9c5('0x26')](removeEntity(_0xbac8ef,null))[_0xe9c5('0x4a')](handleError(_0xbac8ef,null));}; \ No newline at end of file +var _0xfa2f=['ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','ChanSpies','UserProfileResource','end','error','stack','name','send','index','map','VoiceChanSpy','rawAttributes','fieldName','key','model','keys','intersection','query','fields','attributes','length','nolimit','order','sort','where','filters','pick','filter','merge','type','options','includeAll','include','findAll','catch','find','create','body','user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv'];(function(_0x557797,_0x41e4fb){var _0x1b1b7f=function(_0x480240){while(--_0x480240){_0x557797['push'](_0x557797['shift']());}};_0x1b1b7f(++_0x41e4fb);}(_0xfa2f,0xe8));var _0xffa2=function(_0x35b89a,_0x1c0ba7){_0x35b89a=_0x35b89a-0x0;var _0xb5088e=_0xfa2f[_0x35b89a];return _0xb5088e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xffa2('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xffa2('0x1'));var moment=require(_0xffa2('0x2'));var BPromise=require(_0xffa2('0x3'));var Mustache=require('mustache');var util=require(_0xffa2('0x4'));var path=require(_0xffa2('0x5'));var sox=require(_0xffa2('0x6'));var csv=require(_0xffa2('0x7'));var ejs=require(_0xffa2('0x8'));var fs=require('fs');var fs_extra=require(_0xffa2('0x9'));var _=require(_0xffa2('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xffa2('0xb'));var deskjs=require(_0xffa2('0xc'));var toCsv=require(_0xffa2('0x7'));var querystring=require(_0xffa2('0xd'));var Papa=require(_0xffa2('0xe'));var Redis=require(_0xffa2('0xf'));var authService=require(_0xffa2('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xffa2('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xffa2('0x12'));var utils=require(_0xffa2('0x13'));var config=require(_0xffa2('0x14'));var licenseUtil=require(_0xffa2('0x15'));var db=require(_0xffa2('0x16'))['db'];function respondWithStatusCode(_0x569ebb,_0x33acac){_0x33acac=_0x33acac||0xcc;return function(_0x3f9363){if(_0x3f9363){return _0x569ebb[_0xffa2('0x17')](_0x33acac);}return _0x569ebb[_0xffa2('0x18')](_0x33acac)['end']();};}function respondWithResult(_0x5f44cc,_0x32e54e){_0x32e54e=_0x32e54e||0xc8;return function(_0x19a880){if(_0x19a880){return _0x5f44cc[_0xffa2('0x18')](_0x32e54e)['json'](_0x19a880);}};}function respondWithFilteredResult(_0x2d6803,_0x31a57f){return function(_0x2c4035){if(_0x2c4035){var _0x4019b3=typeof _0x31a57f[_0xffa2('0x19')]===_0xffa2('0x1a')&&typeof _0x31a57f[_0xffa2('0x1b')]==='undefined';var _0x2c83d7=_0x2c4035[_0xffa2('0x1c')];var _0x923abf=_0x4019b3?0x0:_0x31a57f[_0xffa2('0x19')];var _0x2b71e7=_0x4019b3?_0x2c4035[_0xffa2('0x1c')]:_0x31a57f[_0xffa2('0x19')]+_0x31a57f[_0xffa2('0x1b')];var _0x2e93c0;if(_0x2b71e7>=_0x2c83d7){_0x2b71e7=_0x2c83d7;_0x2e93c0=0xc8;}else{_0x2e93c0=0xce;}_0x2d6803[_0xffa2('0x18')](_0x2e93c0);return _0x2d6803[_0xffa2('0x1d')](_0xffa2('0x1e'),_0x923abf+'-'+_0x2b71e7+'/'+_0x2c83d7)['json'](_0x2c4035);}return null;};}function patchUpdates(_0x6c9785){return function(_0x54c2f){try{jsonpatch[_0xffa2('0x1f')](_0x54c2f,_0x6c9785,!![]);}catch(_0x57ac03){return BPromise[_0xffa2('0x20')](_0x57ac03);}return _0x54c2f['save']();};}function saveUpdates(_0x204a0f,_0x3f602c){return function(_0x15edba){if(_0x15edba){return _0x15edba[_0xffa2('0x21')](_0x204a0f)[_0xffa2('0x22')](function(_0x3e6b5e){return _0x3e6b5e;});}return null;};}function removeEntity(_0x341522,_0x251a0d){return function(_0xcfec26){if(_0xcfec26){return _0xcfec26[_0xffa2('0x23')]()['then'](function(){var _0x1d62b1=_0xcfec26[_0xffa2('0x24')]({'plain':!![]});var _0x4d97a3=_0xffa2('0x25');return db[_0xffa2('0x26')][_0xffa2('0x23')]({'where':{'type':_0x4d97a3,'resourceId':_0x1d62b1['id']}})[_0xffa2('0x22')](function(){return _0xcfec26;});})[_0xffa2('0x22')](function(){_0x341522[_0xffa2('0x18')](0xcc)[_0xffa2('0x27')]();});}};}function handleEntityNotFound(_0x361540,_0x4e10b4){return function(_0x2d4376){if(!_0x2d4376){_0x361540[_0xffa2('0x17')](0x194);}return _0x2d4376;};}function handleError(_0x1f91bc,_0x48cdf3){_0x48cdf3=_0x48cdf3||0x1f4;return function(_0x45fa74){logger[_0xffa2('0x28')](_0x45fa74[_0xffa2('0x29')]);if(_0x45fa74['name']){delete _0x45fa74[_0xffa2('0x2a')];}_0x1f91bc[_0xffa2('0x18')](_0x48cdf3)[_0xffa2('0x2b')](_0x45fa74);};}exports[_0xffa2('0x2c')]=function(_0x183076,_0x2824cc){var _0x42568d={},_0x62170b={},_0x3f3d6c={'count':0x0,'rows':[]};var _0xd58f36=_[_0xffa2('0x2d')](db[_0xffa2('0x2e')][_0xffa2('0x2f')],function(_0x29be46){return{'name':_0x29be46[_0xffa2('0x30')],'type':_0x29be46['type'][_0xffa2('0x31')]};});_0x62170b[_0xffa2('0x32')]=_['map'](_0xd58f36,_0xffa2('0x2a'));_0x62170b['query']=_[_0xffa2('0x33')](_0x183076['query']);_0x62170b['filters']=_[_0xffa2('0x34')](_0x62170b['model'],_0x62170b[_0xffa2('0x35')]);_0x42568d['attributes']=_[_0xffa2('0x34')](_0x62170b[_0xffa2('0x32')],qs[_0xffa2('0x36')](_0x183076[_0xffa2('0x35')]['fields']));_0x42568d[_0xffa2('0x37')]=_0x42568d['attributes'][_0xffa2('0x38')]?_0x42568d[_0xffa2('0x37')]:_0x62170b[_0xffa2('0x32')];if(!_0x183076['query']['hasOwnProperty'](_0xffa2('0x39'))){_0x42568d[_0xffa2('0x1b')]=qs[_0xffa2('0x1b')](_0x183076['query'][_0xffa2('0x1b')]);_0x42568d['offset']=qs[_0xffa2('0x19')](_0x183076[_0xffa2('0x35')][_0xffa2('0x19')]);}_0x42568d[_0xffa2('0x3a')]=qs[_0xffa2('0x3b')](_0x183076[_0xffa2('0x35')][_0xffa2('0x3b')]);_0x42568d[_0xffa2('0x3c')]=qs[_0xffa2('0x3d')](_[_0xffa2('0x3e')](_0x183076[_0xffa2('0x35')],_0x62170b[_0xffa2('0x3d')]),_0xd58f36);if(_0x183076['query'][_0xffa2('0x3f')]){_0x42568d['where']=_[_0xffa2('0x40')](_0x42568d[_0xffa2('0x3c')],{'$or':_[_0xffa2('0x2d')](_0xd58f36,function(_0x41d486){if(_0x41d486[_0xffa2('0x41')]!=='VIRTUAL'){var _0x2e2d0b={};_0x2e2d0b[_0x41d486['name']]={'$like':'%'+_0x183076[_0xffa2('0x35')]['filter']+'%'};return _0x2e2d0b;}})});}_0x42568d=_['merge']({},_0x42568d,_0x183076[_0xffa2('0x42')]);var _0x21a6cb={'where':_0x42568d[_0xffa2('0x3c')]};return db[_0xffa2('0x2e')][_0xffa2('0x1c')](_0x21a6cb)['then'](function(_0x4efcdb){_0x3f3d6c[_0xffa2('0x1c')]=_0x4efcdb;if(_0x183076[_0xffa2('0x35')][_0xffa2('0x43')]){_0x42568d[_0xffa2('0x44')]=[{'all':!![]}];}return db['VoiceChanSpy'][_0xffa2('0x45')](_0x42568d);})[_0xffa2('0x22')](function(_0x386b81){_0x3f3d6c['rows']=_0x386b81;return _0x3f3d6c;})[_0xffa2('0x22')](respondWithFilteredResult(_0x2824cc,_0x42568d))[_0xffa2('0x46')](handleError(_0x2824cc,null));};exports['show']=function(_0x32fd9e,_0x4b7d7a){var _0x10bd17={'raw':![],'where':{'id':_0x32fd9e['params']['id']}},_0x4a42f0={};_0x4a42f0[_0xffa2('0x32')]=_[_0xffa2('0x33')](db[_0xffa2('0x2e')][_0xffa2('0x2f')]);_0x4a42f0['query']=_[_0xffa2('0x33')](_0x32fd9e['query']);_0x4a42f0[_0xffa2('0x3d')]=_[_0xffa2('0x34')](_0x4a42f0[_0xffa2('0x32')],_0x4a42f0[_0xffa2('0x35')]);_0x10bd17['attributes']=_[_0xffa2('0x34')](_0x4a42f0['model'],qs[_0xffa2('0x36')](_0x32fd9e['query'][_0xffa2('0x36')]));_0x10bd17[_0xffa2('0x37')]=_0x10bd17[_0xffa2('0x37')][_0xffa2('0x38')]?_0x10bd17[_0xffa2('0x37')]:_0x4a42f0[_0xffa2('0x32')];if(_0x32fd9e[_0xffa2('0x35')][_0xffa2('0x43')]){_0x10bd17[_0xffa2('0x44')]=[{'all':!![]}];}_0x10bd17=_[_0xffa2('0x40')]({},_0x10bd17,_0x32fd9e[_0xffa2('0x42')]);return db['VoiceChanSpy'][_0xffa2('0x47')](_0x10bd17)[_0xffa2('0x22')](handleEntityNotFound(_0x4b7d7a,null))[_0xffa2('0x22')](respondWithResult(_0x4b7d7a,null))[_0xffa2('0x46')](handleError(_0x4b7d7a,null));};exports[_0xffa2('0x48')]=function(_0x11f72e,_0x198fd5){return db[_0xffa2('0x2e')][_0xffa2('0x48')](_0x11f72e[_0xffa2('0x49')],{})[_0xffa2('0x22')](function(_0x5a1ec1){var _0x4c3c72=_0x11f72e[_0xffa2('0x4a')]['get']({'plain':!![]});if(!_0x4c3c72)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4c3c72[_0xffa2('0x4b')]==='user'){var _0x1b474c=_0x5a1ec1[_0xffa2('0x24')]({'plain':!![]});var _0xaf9515='ChanSpies';return db[_0xffa2('0x4c')][_0xffa2('0x47')]({'where':{'name':_0xaf9515,'userProfileId':_0x4c3c72[_0xffa2('0x4d')]},'raw':!![]})[_0xffa2('0x22')](function(_0x278795){if(_0x278795&&_0x278795['autoAssociation']===0x0){return db[_0xffa2('0x26')]['create']({'name':_0x1b474c['name'],'resourceId':_0x1b474c['id'],'type':_0x278795[_0xffa2('0x2a')],'sectionId':_0x278795['id']},{})[_0xffa2('0x22')](function(){return _0x5a1ec1;});}else{return _0x5a1ec1;}})['catch'](function(_0x508f81){logger[_0xffa2('0x28')](_0xffa2('0x4e'),_0x508f81);throw _0x508f81;});}return _0x5a1ec1;})[_0xffa2('0x22')](respondWithResult(_0x198fd5,0xc9))[_0xffa2('0x46')](handleError(_0x198fd5,null));};exports['update']=function(_0xd5fc3,_0x5f17ae){if(_0xd5fc3[_0xffa2('0x49')]['id']){delete _0xd5fc3[_0xffa2('0x49')]['id'];}return db[_0xffa2('0x2e')][_0xffa2('0x47')]({'where':{'id':_0xd5fc3[_0xffa2('0x4f')]['id']}})[_0xffa2('0x22')](handleEntityNotFound(_0x5f17ae,null))[_0xffa2('0x22')](saveUpdates(_0xd5fc3['body'],null))[_0xffa2('0x22')](respondWithResult(_0x5f17ae,null))['catch'](handleError(_0x5f17ae,null));};exports[_0xffa2('0x23')]=function(_0xfd6e2d,_0xd2f63){return db[_0xffa2('0x2e')][_0xffa2('0x47')]({'where':{'id':_0xfd6e2d[_0xffa2('0x4f')]['id']}})[_0xffa2('0x22')](handleEntityNotFound(_0xd2f63,null))[_0xffa2('0x22')](removeEntity(_0xd2f63,null))[_0xffa2('0x46')](handleError(_0xd2f63,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 1093eb7..787c051 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 _0xadd6=['merge','Set','CDR(type)=%s','record','MixMonitor','${UNIQUEID}.%s,a','auth','password','ChanSpy','SIP/%s,%s','name','join','StopMixMonitor','concat','internal','findAll','agent','then','catch','exports','models','voice_chanspy','length','VoiceExtension','bulkCreate','destroy','lodash','util','./voiceChanSpy.attributes','context','from-sip','format','%s%s','prefix','system','push'];(function(_0x394066,_0x4b544e){var _0x5e2803=function(_0x43986a){while(--_0x43986a){_0x394066['push'](_0x394066['shift']());}};_0x5e2803(++_0x4b544e);}(_0xadd6,0x13a));var _0x6add=function(_0xae9024,_0x17f58e){_0xae9024=_0xae9024-0x0;var _0x23e7d3=_0xadd6[_0xae9024];return _0x23e7d3;};'use strict';var _=require(_0x6add('0x0'));var util=require(_0x6add('0x1'));var BPromise=require('bluebird');var attributes=require(_0x6add('0x2'));var getUserApplications=function(_0x3ada4e,_0x18754b,_0x133ad6){var _0x53baa6=0x1;var _0x5a4f9e=[];var _0x2dc9b8={'context':_0x18754b[_0x6add('0x3')]||_0x6add('0x4'),'exten':util[_0x6add('0x5')](_0x6add('0x6'),_0x3ada4e[_0x6add('0x7')],_0x133ad6),'type':_0x6add('0x8'),'isApp':![],'ChanSpyId':_0x3ada4e['id'],'UserId':_0x18754b['id']};_0x5a4f9e[_0x6add('0x9')](_[_0x6add('0xa')]({'app':_0x6add('0xb'),'appdata':util['format'](_0x6add('0xc'),'chanspy'),'priority':_0x53baa6++},_0x2dc9b8));if(_0x3ada4e[_0x6add('0xd')]){_0x5a4f9e[_0x6add('0x9')](_[_0x6add('0xa')]({'app':_0x6add('0xe'),'appdata':util[_0x6add('0x5')](_0x6add('0xf'),_0x3ada4e['recordingFormat']),'priority':_0x53baa6++},_0x2dc9b8));}if(_0x3ada4e[_0x6add('0x10')]){_0x5a4f9e[_0x6add('0x9')](_[_0x6add('0xa')]({'app':'Authenticate','appdata':_0x3ada4e[_0x6add('0x11')],'priority':_0x53baa6++},_0x2dc9b8));}_0x5a4f9e[_0x6add('0x9')](_[_0x6add('0xa')]({'app':_0x6add('0x12'),'appdata':util[_0x6add('0x5')](_0x6add('0x13'),_0x18754b[_0x6add('0x14')],_0x3ada4e['options']?_0x3ada4e['options'][_0x6add('0x15')](''):''),'priority':_0x53baa6++},_0x2dc9b8));if(_0x3ada4e[_0x6add('0xd')]){_0x5a4f9e[_0x6add('0x9')](_[_0x6add('0xa')]({'app':_0x6add('0x16'),'priority':_0x53baa6++},_0x2dc9b8));}return _0x5a4f9e;};var getChanSpyApplications=function(_0x72e8f9,_0x16b304){var _0x1606d2=[];for(var _0x58f39e=0x0,_0x2a53e3=0x1;_0x58f39e<_0x16b304['length'];_0x58f39e++,_0x2a53e3=0x1){_0x1606d2=_0x1606d2[_0x6add('0x17')](getUserApplications(_0x72e8f9,_0x16b304[_0x58f39e],_0x16b304[_0x58f39e][_0x6add('0x18')]));if(_0x16b304[_0x58f39e][_0x6add('0x18')]!=_0x16b304[_0x58f39e][_0x6add('0x14')]){_0x1606d2=_0x1606d2['concat'](getUserApplications(_0x72e8f9,_0x16b304[_0x58f39e],_0x16b304[_0x58f39e][_0x6add('0x14')]));}}return _0x1606d2;};var getChanSpyPromise=function(_0x21ffea,_0x548f69){return new BPromise(function(_0x143a31,_0x4ede9b){return _0x21ffea['User'][_0x6add('0x19')]({'attributes':['id',_0x6add('0x14'),_0x6add('0x18')],'where':{'role':_0x6add('0x1a'),'chanspy':!![]},'raw':!![]})[_0x6add('0x1b')](function(_0x1b71fa){if(_0x1b71fa){return _0x143a31(getChanSpyApplications(_0x548f69,_0x1b71fa));}return _0x143a31([]);})[_0x6add('0x1c')](function(_0x2692f9){_0x4ede9b(_0x2692f9);});});};module[_0x6add('0x1d')]=function(_0x1f203c,_0x4f1fff){var _0x22faeb=_0x1f203c[_0x6add('0x1e')];return _0x1f203c['define']('VoiceChanSpy',attributes,{'tableName':_0x6add('0x1f'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x4ad0c3,_0x552648,_0x54c7dd){return getChanSpyPromise(_0x22faeb,_0x4ad0c3)[_0x6add('0x1b')](function(_0xdf6ef0){if(_0xdf6ef0&&_0xdf6ef0[_0x6add('0x20')]){return _0x22faeb[_0x6add('0x21')][_0x6add('0x22')](_0xdf6ef0);}})[_0x6add('0x1b')](function(){_0x54c7dd();})['catch'](function(_0x5a1a98){_0x54c7dd(_0x5a1a98);});},'afterUpdate':function(_0x232450,_0x3fc9d9,_0x17fc75){return _0x22faeb[_0x6add('0x21')][_0x6add('0x23')]({'where':{'ChanSpyId':_0x232450['id']}})['then'](function(){return getChanSpyPromise(_0x22faeb,_0x232450);})['then'](function(_0x31af21){if(_0x31af21&&_0x31af21[_0x6add('0x20')]){return _0x22faeb[_0x6add('0x21')][_0x6add('0x22')](_0x31af21);}})['then'](function(){_0x17fc75();})[_0x6add('0x1c')](function(_0x3265b1){_0x17fc75(_0x3265b1);});},'afterDestroy':function(_0x10edb9,_0x386eeb,_0x563f40){return _0x22faeb[_0x6add('0x21')]['destroy']({'where':{'ChanSpyId':_0x10edb9['id']}})[_0x6add('0x1b')](function(){_0x563f40();})[_0x6add('0x1c')](function(_0x1a16f9){_0x563f40(_0x1a16f9);});}}});}; \ No newline at end of file +var _0x4dd7=['VoiceExtension','destroy','catch','lodash','./voiceChanSpy.attributes','context','from-sip','format','%s%s','prefix','system','push','merge','Set','CDR(type)=%s','chanspy','record','MixMonitor','${UNIQUEID}.%s,a','auth','ChanSpy','name','options','join','length','internal','concat','User','findAll','agent','then','exports','define','voice_chanspy','bulkCreate'];(function(_0x54ac41,_0x4e36e5){var _0x1d7fa2=function(_0x41821f){while(--_0x41821f){_0x54ac41['push'](_0x54ac41['shift']());}};_0x1d7fa2(++_0x4e36e5);}(_0x4dd7,0x8f));var _0x74dd=function(_0x4b7464,_0x49d9b1){_0x4b7464=_0x4b7464-0x0;var _0x32399f=_0x4dd7[_0x4b7464];return _0x32399f;};'use strict';var _=require(_0x74dd('0x0'));var util=require('util');var BPromise=require('bluebird');var attributes=require(_0x74dd('0x1'));var getUserApplications=function(_0x4f7db2,_0x5279cb,_0x15721f){var _0x14e305=0x1;var _0x4bcb24=[];var _0x1a6c1a={'context':_0x5279cb[_0x74dd('0x2')]||_0x74dd('0x3'),'exten':util[_0x74dd('0x4')](_0x74dd('0x5'),_0x4f7db2[_0x74dd('0x6')],_0x15721f),'type':_0x74dd('0x7'),'isApp':![],'ChanSpyId':_0x4f7db2['id'],'UserId':_0x5279cb['id']};_0x4bcb24[_0x74dd('0x8')](_[_0x74dd('0x9')]({'app':_0x74dd('0xa'),'appdata':util['format'](_0x74dd('0xb'),_0x74dd('0xc')),'priority':_0x14e305++},_0x1a6c1a));if(_0x4f7db2[_0x74dd('0xd')]){_0x4bcb24[_0x74dd('0x8')](_[_0x74dd('0x9')]({'app':_0x74dd('0xe'),'appdata':util[_0x74dd('0x4')](_0x74dd('0xf'),_0x4f7db2['recordingFormat']),'priority':_0x14e305++},_0x1a6c1a));}if(_0x4f7db2[_0x74dd('0x10')]){_0x4bcb24[_0x74dd('0x8')](_[_0x74dd('0x9')]({'app':'Authenticate','appdata':_0x4f7db2['password'],'priority':_0x14e305++},_0x1a6c1a));}_0x4bcb24[_0x74dd('0x8')](_['merge']({'app':_0x74dd('0x11'),'appdata':util[_0x74dd('0x4')]('SIP/%s,%s',_0x5279cb[_0x74dd('0x12')],_0x4f7db2[_0x74dd('0x13')]?_0x4f7db2[_0x74dd('0x13')][_0x74dd('0x14')](''):''),'priority':_0x14e305++},_0x1a6c1a));if(_0x4f7db2['record']){_0x4bcb24['push'](_[_0x74dd('0x9')]({'app':'StopMixMonitor','priority':_0x14e305++},_0x1a6c1a));}return _0x4bcb24;};var getChanSpyApplications=function(_0x18a323,_0x21eca2){var _0x4488ce=[];for(var _0x544dd8=0x0,_0x12cc13=0x1;_0x544dd8<_0x21eca2[_0x74dd('0x15')];_0x544dd8++,_0x12cc13=0x1){_0x4488ce=_0x4488ce['concat'](getUserApplications(_0x18a323,_0x21eca2[_0x544dd8],_0x21eca2[_0x544dd8]['internal']));if(_0x21eca2[_0x544dd8][_0x74dd('0x16')]!=_0x21eca2[_0x544dd8]['name']){_0x4488ce=_0x4488ce[_0x74dd('0x17')](getUserApplications(_0x18a323,_0x21eca2[_0x544dd8],_0x21eca2[_0x544dd8][_0x74dd('0x12')]));}}return _0x4488ce;};var getChanSpyPromise=function(_0x3f8ed9,_0x209344){return new BPromise(function(_0x2b648e,_0x1bba3d){return _0x3f8ed9[_0x74dd('0x18')][_0x74dd('0x19')]({'attributes':['id',_0x74dd('0x12'),'internal'],'where':{'role':_0x74dd('0x1a'),'chanspy':!![]},'raw':!![]})[_0x74dd('0x1b')](function(_0x440ee7){if(_0x440ee7){return _0x2b648e(getChanSpyApplications(_0x209344,_0x440ee7));}return _0x2b648e([]);})['catch'](function(_0x57ff6e){_0x1bba3d(_0x57ff6e);});});};module[_0x74dd('0x1c')]=function(_0x4d021a,_0x26db27){var _0x3fe76f=_0x4d021a['models'];return _0x4d021a[_0x74dd('0x1d')]('VoiceChanSpy',attributes,{'tableName':_0x74dd('0x1e'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5d5db4,_0x4991bf,_0x4141bf){return getChanSpyPromise(_0x3fe76f,_0x5d5db4)[_0x74dd('0x1b')](function(_0xdbf218){if(_0xdbf218&&_0xdbf218[_0x74dd('0x15')]){return _0x3fe76f['VoiceExtension'][_0x74dd('0x1f')](_0xdbf218);}})['then'](function(){_0x4141bf();})['catch'](function(_0x30bbea){_0x4141bf(_0x30bbea);});},'afterUpdate':function(_0x12922c,_0x28bc21,_0x4b8da2){return _0x3fe76f[_0x74dd('0x20')][_0x74dd('0x21')]({'where':{'ChanSpyId':_0x12922c['id']}})[_0x74dd('0x1b')](function(){return getChanSpyPromise(_0x3fe76f,_0x12922c);})[_0x74dd('0x1b')](function(_0xbd1768){if(_0xbd1768&&_0xbd1768['length']){return _0x3fe76f['VoiceExtension']['bulkCreate'](_0xbd1768);}})['then'](function(){_0x4b8da2();})[_0x74dd('0x22')](function(_0x3126f3){_0x4b8da2(_0x3126f3);});},'afterDestroy':function(_0x1a934a,_0x17074c,_0x2b0bf9){return _0x3fe76f['VoiceExtension']['destroy']({'where':{'ChanSpyId':_0x1a934a['id']}})[_0x74dd('0x1b')](function(){_0x2b0bf9();})[_0x74dd('0x22')](function(_0x5c19b5){_0x2b0bf9(_0x5c19b5);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index e62b1a8..5e79325 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 _0xd52d=['jayson/promise','client','http','request','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x42acb,_0xd6115d){var _0x57d7b2=function(_0x577d54){while(--_0x577d54){_0x42acb['push'](_0x42acb['shift']());}};_0x57d7b2(++_0xd6115d);}(_0xd52d,0x1c7));var _0xdd52=function(_0x569fa5,_0x12edc8){_0x569fa5=_0x569fa5-0x0;var _0x31becf=_0xd52d[_0x569fa5];return _0x31becf;};'use strict';var _=require('lodash');var util=require(_0xdd52('0x0'));var moment=require(_0xdd52('0x1'));var BPromise=require('bluebird');var rs=require(_0xdd52('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xdd52('0x3'));var logger=require(_0xdd52('0x4'))(_0xdd52('0x5'));var config=require(_0xdd52('0x6'));var jayson=require(_0xdd52('0x7'));var client=jayson[_0xdd52('0x8')][_0xdd52('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x18d01d,_0x4ca1a2,_0x1b8b74){return new BPromise(function(_0x6ab1e3,_0x8a6170){return client[_0xdd52('0xa')](_0x18d01d,_0x1b8b74)[_0xdd52('0xb')](function(_0xb6616a){logger[_0xdd52('0xc')](_0xdd52('0xd'),_0x4ca1a2,_0xdd52('0xe'));logger[_0xdd52('0xf')](_0xdd52('0x10'),_0x4ca1a2,_0xdd52('0xe'),JSON[_0xdd52('0x11')](_0xb6616a));if(_0xb6616a['error']){if(_0xb6616a[_0xdd52('0x12')][_0xdd52('0x13')]===0x1f4){logger[_0xdd52('0x12')](_0xdd52('0xd'),_0x4ca1a2,_0xb6616a[_0xdd52('0x12')][_0xdd52('0x14')]);return _0x8a6170(_0xb6616a['error'][_0xdd52('0x14')]);}logger[_0xdd52('0x12')](_0xdd52('0xd'),_0x4ca1a2,_0xb6616a['error'][_0xdd52('0x14')]);return _0x6ab1e3(_0xb6616a[_0xdd52('0x12')][_0xdd52('0x14')]);}else{logger[_0xdd52('0xc')](_0xdd52('0xd'),_0x4ca1a2,_0xdd52('0xe'));_0x6ab1e3(_0xb6616a[_0xdd52('0x15')][_0xdd52('0x14')]);}})['catch'](function(_0x468c7a){logger['error'](_0xdd52('0xd'),_0x4ca1a2,_0x468c7a);_0x8a6170(_0x468c7a);});});} \ No newline at end of file +var _0x2750=['jayson/promise','http','request','then','VoiceChanSpy,\x20%s,\x20%s','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x68a7d1,_0x17a736){var _0x19685b=function(_0x4589a0){while(--_0x4589a0){_0x68a7d1['push'](_0x68a7d1['shift']());}};_0x19685b(++_0x17a736);}(_0x2750,0x13b));var _0x0275=function(_0x43a4cf,_0x35017c){_0x43a4cf=_0x43a4cf-0x0;var _0xf90616=_0x2750[_0x43a4cf];return _0xf90616;};'use strict';var _=require(_0x0275('0x0'));var util=require('util');var moment=require(_0x0275('0x1'));var BPromise=require(_0x0275('0x2'));var rs=require(_0x0275('0x3'));var fs=require('fs');var Redis=require(_0x0275('0x4'));var db=require(_0x0275('0x5'))['db'];var utils=require(_0x0275('0x6'));var logger=require(_0x0275('0x7'))(_0x0275('0x8'));var config=require(_0x0275('0x9'));var jayson=require(_0x0275('0xa'));var client=jayson['client'][_0x0275('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2421fd,_0x2fa0eb,_0x2e4b5c){return new BPromise(function(_0x4dffd1,_0x1f7c4a){return client[_0x0275('0xc')](_0x2421fd,_0x2e4b5c)[_0x0275('0xd')](function(_0x5e0e4a){logger['info'](_0x0275('0xe'),_0x2fa0eb,'request\x20sent');logger[_0x0275('0xf')](_0x0275('0x10'),_0x2fa0eb,_0x0275('0x11'),JSON[_0x0275('0x12')](_0x5e0e4a));if(_0x5e0e4a[_0x0275('0x13')]){if(_0x5e0e4a['error'][_0x0275('0x14')]===0x1f4){logger[_0x0275('0x13')](_0x0275('0xe'),_0x2fa0eb,_0x5e0e4a['error']['message']);return _0x1f7c4a(_0x5e0e4a[_0x0275('0x13')][_0x0275('0x15')]);}logger[_0x0275('0x13')](_0x0275('0xe'),_0x2fa0eb,_0x5e0e4a[_0x0275('0x13')][_0x0275('0x15')]);return _0x4dffd1(_0x5e0e4a['error'][_0x0275('0x15')]);}else{logger[_0x0275('0x16')]('VoiceChanSpy,\x20%s,\x20%s',_0x2fa0eb,_0x0275('0x11'));_0x4dffd1(_0x5e0e4a[_0x0275('0x17')]['message']);}})[_0x0275('0x18')](function(_0x31c76b){logger['error']('VoiceChanSpy,\x20%s,\x20%s',_0x2fa0eb,_0x31c76b);_0x1f7c4a(_0x31c76b);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 89d9bfc..9e80ee8 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 _0xe662=['create','delete','destroy','exports','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','index','/:id','post'];(function(_0x3eabfe,_0x3c1dd8){var _0x31b326=function(_0x340f61){while(--_0x340f61){_0x3eabfe['push'](_0x3eabfe['shift']());}};_0x31b326(++_0x3c1dd8);}(_0xe662,0xb4));var _0x2e66=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xe662[_0x297fd3];return _0x2af381;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2e66('0x0'));var timeout=require('connect-timeout');var express=require(_0x2e66('0x1'));var router=express[_0x2e66('0x2')]();var fs_extra=require(_0x2e66('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x2e66('0x4'));var config=require(_0x2e66('0x5'));var controller=require(_0x2e66('0x6'));router[_0x2e66('0x7')]('/',auth[_0x2e66('0x8')](),controller[_0x2e66('0x9')]);router['get'](_0x2e66('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x2e66('0xb')]('/',auth[_0x2e66('0x8')](),controller[_0x2e66('0xc')]);router['put'](_0x2e66('0xa'),auth[_0x2e66('0x8')](),controller['update']);router[_0x2e66('0xd')](_0x2e66('0xa'),auth[_0x2e66('0x8')](),controller[_0x2e66('0xe')]);module[_0x2e66('0xf')]=router; \ No newline at end of file +var _0x3a17=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','util','path','express'];(function(_0x46dd8f,_0x5c473b){var _0x3d9d8e=function(_0x1f2b84){while(--_0x1f2b84){_0x46dd8f['push'](_0x46dd8f['shift']());}};_0x3d9d8e(++_0x5c473b);}(_0x3a17,0x189));var _0x73a1=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0x3a17[_0x2112d4];return _0x434972;};'use strict';var multer=require('multer');var util=require(_0x73a1('0x0'));var path=require(_0x73a1('0x1'));var timeout=require('connect-timeout');var express=require(_0x73a1('0x2'));var router=express[_0x73a1('0x3')]();var fs_extra=require(_0x73a1('0x4'));var auth=require(_0x73a1('0x5'));var interaction=require(_0x73a1('0x6'));var config=require(_0x73a1('0x7'));var controller=require('./voiceContext.controller');router[_0x73a1('0x8')]('/',auth[_0x73a1('0x9')](),controller[_0x73a1('0xa')]);router[_0x73a1('0x8')](_0x73a1('0xb'),auth[_0x73a1('0x9')](),controller[_0x73a1('0xc')]);router[_0x73a1('0xd')]('/',auth[_0x73a1('0x9')](),controller[_0x73a1('0xe')]);router[_0x73a1('0xf')](_0x73a1('0xb'),auth[_0x73a1('0x9')](),controller[_0x73a1('0x10')]);router[_0x73a1('0x11')](_0x73a1('0xb'),auth[_0x73a1('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 9af3c08..1108c61 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 _0x54b3=['STRING','BOOLEAN','sequelize','exports'];(function(_0x36f2a6,_0x58ed4e){var _0x2a8b33=function(_0x3ae06a){while(--_0x3ae06a){_0x36f2a6['push'](_0x36f2a6['shift']());}};_0x2a8b33(++_0x58ed4e);}(_0x54b3,0xaa));var _0x354b=function(_0x260737,_0x75f109){_0x260737=_0x260737-0x0;var _0x1a65c5=_0x54b3[_0x260737];return _0x1a65c5;};'use strict';var Sequelize=require(_0x354b('0x0'));module[_0x354b('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name'},'description':{'type':Sequelize[_0x354b('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x354b('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa219=['sequelize','exports','STRING','name'];(function(_0x21c62e,_0x225e32){var _0x2774f6=function(_0x397f8c){while(--_0x397f8c){_0x21c62e['push'](_0x21c62e['shift']());}};_0x2774f6(++_0x225e32);}(_0xa219,0xf8));var _0x9a21=function(_0x1573ea,_0x434f02){_0x1573ea=_0x1573ea-0x0;var _0x51c0e2=_0xa219[_0x1573ea];return _0x51c0e2;};'use strict';var Sequelize=require(_0x9a21('0x0'));module[_0x9a21('0x1')]={'name':{'type':Sequelize[_0x9a21('0x2')],'unique':_0x9a21('0x3')},'description':{'type':Sequelize[_0x9a21('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'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 37de556..473ad6a 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 _0x7fdf=['hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','create','body','readFileSync','join','root','utf8','render','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','server/files/templates/context.ejs','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','sendStatus','status','json','limit','undefined','count','offset','Content-Range','apply','reject','save','update','destroy','Contexts','end','stack','name','send','index','map','VoiceContext','fieldName','type','query','filters','intersection','attributes','fields','length','model'];(function(_0x313f28,_0x2c3131){var _0x582ba6=function(_0x4a7733){while(--_0x4a7733){_0x313f28['push'](_0x313f28['shift']());}};_0x582ba6(++_0x2c3131);}(_0x7fdf,0xf9));var _0xf7fd=function(_0x810e4d,_0x909ef4){_0x810e4d=_0x810e4d-0x0;var _0x13f01c=_0x7fdf[_0x810e4d];return _0x13f01c;};'use strict';var emlformat=require(_0xf7fd('0x0'));var rimraf=require(_0xf7fd('0x1'));var zipdir=require(_0xf7fd('0x2'));var jsonpatch=require(_0xf7fd('0x3'));var rp=require(_0xf7fd('0x4'));var moment=require(_0xf7fd('0x5'));var BPromise=require(_0xf7fd('0x6'));var Mustache=require(_0xf7fd('0x7'));var util=require('util');var path=require(_0xf7fd('0x8'));var sox=require('sox');var csv=require(_0xf7fd('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf7fd('0xa'));var squel=require(_0xf7fd('0xb'));var crypto=require(_0xf7fd('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xf7fd('0xd'));var toCsv=require('to-csv');var querystring=require(_0xf7fd('0xe'));var Papa=require('papaparse');var Redis=require(_0xf7fd('0xf'));var authService=require(_0xf7fd('0x10'));var qs=require(_0xf7fd('0x11'));var as=require(_0xf7fd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf7fd('0x13'))('api');var utils=require(_0xf7fd('0x14'));var config=require(_0xf7fd('0x15'));var licenseUtil=require(_0xf7fd('0x16'));var db=require(_0xf7fd('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x186e00,_0x4665fc,_0xc9ae13,_0x5b7cbd){return new BPromise(function(_0x41091d,_0x36ba3b){var _0x5755f3=_0x5b7cbd||client;return _0x5755f3[_0xf7fd('0x18')](_0x186e00,_0xc9ae13)[_0xf7fd('0x19')](function(_0x1d3d47){logger[_0xf7fd('0x1a')](_0xf7fd('0x1b'),_0x4665fc,_0xf7fd('0x1c'));logger[_0xf7fd('0x1d')](_0xf7fd('0x1e'),_0x4665fc,_0xf7fd('0x1c'),JSON[_0xf7fd('0x1f')](_0x1d3d47));if(_0x1d3d47['error']){if(_0x1d3d47['error'][_0xf7fd('0x20')]===0x1f4){logger[_0xf7fd('0x21')](_0xf7fd('0x1b'),_0x4665fc,_0x1d3d47[_0xf7fd('0x21')][_0xf7fd('0x22')]);return _0x36ba3b(_0x1d3d47[_0xf7fd('0x21')]['message']);}logger['error'](_0xf7fd('0x1b'),_0x4665fc,_0x1d3d47['error'][_0xf7fd('0x22')]);return _0x41091d(_0x1d3d47[_0xf7fd('0x21')][_0xf7fd('0x22')]);}else{logger[_0xf7fd('0x1a')](_0xf7fd('0x1b'),_0x4665fc,_0xf7fd('0x1c'));_0x41091d(_0x1d3d47[_0xf7fd('0x23')][_0xf7fd('0x22')]);}})['catch'](function(_0x1e0291){logger[_0xf7fd('0x21')](_0xf7fd('0x1b'),_0x4665fc,_0x1e0291);_0x36ba3b(_0x1e0291);});});}function respondWithStatusCode(_0x21ac04,_0x369b0b){_0x369b0b=_0x369b0b||0xcc;return function(_0x3ca760){if(_0x3ca760){return _0x21ac04[_0xf7fd('0x24')](_0x369b0b);}return _0x21ac04[_0xf7fd('0x25')](_0x369b0b)['end']();};}function respondWithResult(_0x536f0f,_0xce9f3c){_0xce9f3c=_0xce9f3c||0xc8;return function(_0x211995){if(_0x211995){return _0x536f0f[_0xf7fd('0x25')](_0xce9f3c)[_0xf7fd('0x26')](_0x211995);}};}function respondWithFilteredResult(_0x24eb6,_0x4b843f){return function(_0x4ff2d4){if(_0x4ff2d4){var _0x31a96c=typeof _0x4b843f['offset']==='undefined'&&typeof _0x4b843f[_0xf7fd('0x27')]===_0xf7fd('0x28');var _0x550e41=_0x4ff2d4[_0xf7fd('0x29')];var _0x1fef8d=_0x31a96c?0x0:_0x4b843f[_0xf7fd('0x2a')];var _0x1f0dfa=_0x31a96c?_0x4ff2d4[_0xf7fd('0x29')]:_0x4b843f[_0xf7fd('0x2a')]+_0x4b843f[_0xf7fd('0x27')];var _0x43ea20;if(_0x1f0dfa>=_0x550e41){_0x1f0dfa=_0x550e41;_0x43ea20=0xc8;}else{_0x43ea20=0xce;}_0x24eb6['status'](_0x43ea20);return _0x24eb6['set'](_0xf7fd('0x2b'),_0x1fef8d+'-'+_0x1f0dfa+'/'+_0x550e41)[_0xf7fd('0x26')](_0x4ff2d4);}return null;};}function patchUpdates(_0x46bc5a){return function(_0x2d2a86){try{jsonpatch[_0xf7fd('0x2c')](_0x2d2a86,_0x46bc5a,!![]);}catch(_0x3d5e2a){return BPromise[_0xf7fd('0x2d')](_0x3d5e2a);}return _0x2d2a86[_0xf7fd('0x2e')]();};}function saveUpdates(_0x5d7e73,_0x344794){return function(_0xd4d192){if(_0xd4d192){return _0xd4d192[_0xf7fd('0x2f')](_0x5d7e73)[_0xf7fd('0x19')](function(_0x4f26da){return _0x4f26da;});}return null;};}function removeEntity(_0x4180ad,_0x15548b){return function(_0x2449d2){if(_0x2449d2){return _0x2449d2[_0xf7fd('0x30')]()[_0xf7fd('0x19')](function(){var _0x1b8c10=_0x2449d2['get']({'plain':!![]});var _0x526a58=_0xf7fd('0x31');return db['UserProfileResource'][_0xf7fd('0x30')]({'where':{'type':_0x526a58,'resourceId':_0x1b8c10['id']}})[_0xf7fd('0x19')](function(){return _0x2449d2;});})[_0xf7fd('0x19')](function(){_0x4180ad[_0xf7fd('0x25')](0xcc)[_0xf7fd('0x32')]();});}};}function handleEntityNotFound(_0x1e5ad6,_0x205884){return function(_0x121611){if(!_0x121611){_0x1e5ad6[_0xf7fd('0x24')](0x194);}return _0x121611;};}function handleError(_0x4b2247,_0x1d3abd){_0x1d3abd=_0x1d3abd||0x1f4;return function(_0x10d62f){logger[_0xf7fd('0x21')](_0x10d62f[_0xf7fd('0x33')]);if(_0x10d62f['name']){delete _0x10d62f[_0xf7fd('0x34')];}_0x4b2247[_0xf7fd('0x25')](_0x1d3abd)[_0xf7fd('0x35')](_0x10d62f);};}exports[_0xf7fd('0x36')]=function(_0x65c06b,_0x3c4ec8){var _0x58639a={},_0x3534ad={},_0x5b81fd={'count':0x0,'rows':[]};var _0x313117=_[_0xf7fd('0x37')](db[_0xf7fd('0x38')]['rawAttributes'],function(_0x574bc7){return{'name':_0x574bc7[_0xf7fd('0x39')],'type':_0x574bc7[_0xf7fd('0x3a')]['key']};});_0x3534ad['model']=_[_0xf7fd('0x37')](_0x313117,'name');_0x3534ad[_0xf7fd('0x3b')]=_['keys'](_0x65c06b[_0xf7fd('0x3b')]);_0x3534ad[_0xf7fd('0x3c')]=_[_0xf7fd('0x3d')](_0x3534ad['model'],_0x3534ad[_0xf7fd('0x3b')]);_0x58639a[_0xf7fd('0x3e')]=_[_0xf7fd('0x3d')](_0x3534ad['model'],qs[_0xf7fd('0x3f')](_0x65c06b[_0xf7fd('0x3b')]['fields']));_0x58639a[_0xf7fd('0x3e')]=_0x58639a['attributes'][_0xf7fd('0x40')]?_0x58639a[_0xf7fd('0x3e')]:_0x3534ad[_0xf7fd('0x41')];if(!_0x65c06b[_0xf7fd('0x3b')][_0xf7fd('0x42')](_0xf7fd('0x43'))){_0x58639a[_0xf7fd('0x27')]=qs[_0xf7fd('0x27')](_0x65c06b['query'][_0xf7fd('0x27')]);_0x58639a[_0xf7fd('0x2a')]=qs[_0xf7fd('0x2a')](_0x65c06b[_0xf7fd('0x3b')][_0xf7fd('0x2a')]);}_0x58639a[_0xf7fd('0x44')]=qs['sort'](_0x65c06b[_0xf7fd('0x3b')][_0xf7fd('0x45')]);_0x58639a[_0xf7fd('0x46')]=qs[_0xf7fd('0x3c')](_['pick'](_0x65c06b[_0xf7fd('0x3b')],_0x3534ad[_0xf7fd('0x3c')]),_0x313117);if(_0x65c06b[_0xf7fd('0x3b')]['filter']){_0x58639a[_0xf7fd('0x46')]=_[_0xf7fd('0x47')](_0x58639a['where'],{'$or':_[_0xf7fd('0x37')](_0x313117,function(_0xbd5c2a){if(_0xbd5c2a[_0xf7fd('0x3a')]!==_0xf7fd('0x48')){var _0x3ee5e9={};_0x3ee5e9[_0xbd5c2a['name']]={'$like':'%'+_0x65c06b['query'][_0xf7fd('0x49')]+'%'};return _0x3ee5e9;}})});}_0x58639a=_[_0xf7fd('0x47')]({},_0x58639a,_0x65c06b[_0xf7fd('0x4a')]);var _0x7ec2ba={'where':_0x58639a[_0xf7fd('0x46')]};return db[_0xf7fd('0x38')][_0xf7fd('0x29')](_0x7ec2ba)[_0xf7fd('0x19')](function(_0x3a6a56){_0x5b81fd[_0xf7fd('0x29')]=_0x3a6a56;if(_0x65c06b[_0xf7fd('0x3b')][_0xf7fd('0x4b')]){_0x58639a['include']=[{'all':!![]}];}return db['VoiceContext'][_0xf7fd('0x4c')](_0x58639a);})[_0xf7fd('0x19')](function(_0x4ad360){_0x5b81fd[_0xf7fd('0x4d')]=_0x4ad360;return _0x5b81fd;})[_0xf7fd('0x19')](respondWithFilteredResult(_0x3c4ec8,_0x58639a))[_0xf7fd('0x4e')](handleError(_0x3c4ec8,null));};exports[_0xf7fd('0x4f')]=function(_0x4cbfd2,_0xe6cc89){var _0x53d0d2={'raw':![],'where':{'id':_0x4cbfd2[_0xf7fd('0x50')]['id']}},_0x420c74={};_0x420c74[_0xf7fd('0x41')]=_['keys'](db[_0xf7fd('0x38')][_0xf7fd('0x51')]);_0x420c74[_0xf7fd('0x3b')]=_['keys'](_0x4cbfd2[_0xf7fd('0x3b')]);_0x420c74[_0xf7fd('0x3c')]=_[_0xf7fd('0x3d')](_0x420c74[_0xf7fd('0x41')],_0x420c74[_0xf7fd('0x3b')]);_0x53d0d2[_0xf7fd('0x3e')]=_[_0xf7fd('0x3d')](_0x420c74[_0xf7fd('0x41')],qs['fields'](_0x4cbfd2[_0xf7fd('0x3b')][_0xf7fd('0x3f')]));_0x53d0d2[_0xf7fd('0x3e')]=_0x53d0d2[_0xf7fd('0x3e')][_0xf7fd('0x40')]?_0x53d0d2[_0xf7fd('0x3e')]:_0x420c74['model'];if(_0x4cbfd2[_0xf7fd('0x3b')][_0xf7fd('0x4b')]){_0x53d0d2[_0xf7fd('0x52')]=[{'all':!![]}];}_0x53d0d2=_['merge']({},_0x53d0d2,_0x4cbfd2['options']);return db[_0xf7fd('0x38')]['find'](_0x53d0d2)[_0xf7fd('0x19')](handleEntityNotFound(_0xe6cc89,null))['then'](respondWithResult(_0xe6cc89,null))['catch'](handleError(_0xe6cc89,null));};exports[_0xf7fd('0x53')]=function(_0x1a4d7a,_0x486996,_0xa41cff){var _0x83052d;return db[_0xf7fd('0x38')]['create'](_0x1a4d7a[_0xf7fd('0x54')],{'raw':!![]})[_0xf7fd('0x19')](function(_0x55393e){_0x83052d=_0x55393e;return db['VoiceContext']['findAll']({'raw':!![]});})[_0xf7fd('0x19')](function(_0x32e2fe){var _0x39544f=fs[_0xf7fd('0x55')](path[_0xf7fd('0x56')](config[_0xf7fd('0x57')],'server/files/templates/context.ejs'),_0xf7fd('0x58'));var _0x592782=ejs[_0xf7fd('0x59')](_0x39544f,{'contexts':_0x32e2fe||[]});fs['writeFileSync']('/etc/asterisk/extensions_xcally_contexts.conf',_0x592782);})[_0xf7fd('0x19')](function(){return respondWithRpcPromise(_0xf7fd('0x5a'),_0xf7fd('0x53'),{'module':_0xf7fd('0x5b')});})[_0xf7fd('0x19')](function(){var _0x1a2bb3=_0x1a4d7a[_0xf7fd('0x5c')]['get']({'plain':!![]});if(!_0x1a2bb3)throw new Error(_0xf7fd('0x5d'));if(_0x1a2bb3[_0xf7fd('0x5e')]===_0xf7fd('0x5c')){var _0x163b70=_0x83052d[_0xf7fd('0x5f')]({'plain':!![]});return db[_0xf7fd('0x60')][_0xf7fd('0x61')]({'where':{'name':_0xf7fd('0x31'),'userProfileId':_0x1a2bb3[_0xf7fd('0x62')]},'raw':!![]})[_0xf7fd('0x19')](function(_0x2f8e10){if(_0x2f8e10&&_0x2f8e10[_0xf7fd('0x63')]===0x0){return db[_0xf7fd('0x64')][_0xf7fd('0x53')]({'name':_0x163b70['name'],'resourceId':_0x163b70['id'],'type':_0x2f8e10[_0xf7fd('0x34')],'sectionId':_0x2f8e10['id']},{})[_0xf7fd('0x19')](function(){return _0x83052d;});}else{return _0x83052d;}})[_0xf7fd('0x4e')](function(_0x4326d4){logger['error'](_0xf7fd('0x65'),_0x4326d4);throw _0x4326d4;});}return _0x83052d;})['then'](respondWithResult(_0x486996,0xc9))['catch'](handleError(_0x486996,null));};exports[_0xf7fd('0x2f')]=function(_0x251de7,_0x34aff1,_0x38768d){var _0x1a568b;return db['VoiceContext'][_0xf7fd('0x61')]({'where':{'id':_0x251de7[_0xf7fd('0x50')]['id']}})[_0xf7fd('0x19')](handleEntityNotFound(_0x34aff1,null))[_0xf7fd('0x19')](saveUpdates(_0x251de7[_0xf7fd('0x54')],null))[_0xf7fd('0x19')](function(_0x17518a){if(_0x17518a){_0x1a568b=_0x17518a;return db[_0xf7fd('0x38')]['findAll']({'raw':!![]});}})['then'](function(_0x4da118){var _0x26b3a6=fs['readFileSync'](path['join'](config[_0xf7fd('0x57')],_0xf7fd('0x66')),_0xf7fd('0x58'));var _0x47544a=ejs[_0xf7fd('0x59')](_0x26b3a6,{'contexts':_0x4da118||[]});fs[_0xf7fd('0x67')](_0xf7fd('0x68'),_0x47544a);})[_0xf7fd('0x19')](function(){return respondWithRpcPromise(_0xf7fd('0x5a'),'update',{'module':_0xf7fd('0x5b')});})[_0xf7fd('0x19')](function(){return _0x1a568b;})[_0xf7fd('0x19')](respondWithResult(_0x34aff1,null))[_0xf7fd('0x4e')](handleError(_0x34aff1,null));};exports[_0xf7fd('0x30')]=function(_0x41d1ef,_0x45992f,_0x5ec42b){var _0x11048c;return db[_0xf7fd('0x38')][_0xf7fd('0x61')]({'where':{'id':_0x41d1ef[_0xf7fd('0x50')]['id']}})[_0xf7fd('0x19')](handleEntityNotFound(_0x45992f,null))['then'](removeEntity(_0x45992f,null))['then'](function(){return db['VoiceContext'][_0xf7fd('0x4c')]({'raw':!![]});})[_0xf7fd('0x19')](function(_0x3b371b){var _0x3affaa=fs['readFileSync'](path[_0xf7fd('0x56')](config['root'],'server/files/templates/context.ejs'),'utf8');var _0x494a92=ejs[_0xf7fd('0x59')](_0x3affaa,{'contexts':_0x3b371b});fs[_0xf7fd('0x67')](_0xf7fd('0x68'),_0x494a92);return respondWithRpcPromise(_0xf7fd('0x5a'),'destroy',{'module':_0xf7fd('0x5b')});})[_0xf7fd('0x4e')](handleError(_0x45992f,null));}; \ No newline at end of file +var _0x8550=['jayson/promise','request','then','info','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoiceContext,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','offset','limit','undefined','count','set','json','apply','reject','save','destroy','get','Contexts','name','send','index','map','VoiceContext','rawAttributes','fieldName','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','show','params','options','find','create','findAll','readFileSync','join','root','server/files/templates/context.ejs','utf8','writeFileSync','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','UserProfileResource','body','Reload','update','/etc/asterisk/extensions_xcally_contexts.conf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x451590,_0x3d192c){var _0x1b0c6d=function(_0x917134){while(--_0x917134){_0x451590['push'](_0x451590['shift']());}};_0x1b0c6d(++_0x3d192c);}(_0x8550,0xb3));var _0x0855=function(_0x27cc43,_0x426a18){_0x27cc43=_0x27cc43-0x0;var _0x471ea7=_0x8550[_0x27cc43];return _0x471ea7;};'use strict';var emlformat=require(_0x0855('0x0'));var rimraf=require(_0x0855('0x1'));var zipdir=require(_0x0855('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0855('0x3'));var moment=require('moment');var BPromise=require(_0x0855('0x4'));var Mustache=require(_0x0855('0x5'));var util=require('util');var path=require('path');var sox=require(_0x0855('0x6'));var csv=require(_0x0855('0x7'));var ejs=require(_0x0855('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0855('0x9'));var squel=require(_0x0855('0xa'));var crypto=require(_0x0855('0xb'));var jsforce=require(_0x0855('0xc'));var deskjs=require(_0x0855('0xd'));var toCsv=require(_0x0855('0x7'));var querystring=require(_0x0855('0xe'));var Papa=require(_0x0855('0xf'));var Redis=require(_0x0855('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x0855('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x0855('0x12'))(_0x0855('0x13'));var utils=require(_0x0855('0x14'));var config=require(_0x0855('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x0855('0x16'))['db'];var jayson=require(_0x0855('0x17'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x562c33,_0x21f981,_0x5c1800,_0x50407e){return new BPromise(function(_0x64f84b,_0x403280){var _0xd3863d=_0x50407e||client;return _0xd3863d[_0x0855('0x18')](_0x562c33,_0x5c1800)[_0x0855('0x19')](function(_0x293e7d){logger[_0x0855('0x1a')]('VoiceContext,\x20%s,\x20%s',_0x21f981,'request\x20sent');logger[_0x0855('0x1b')](_0x0855('0x1c'),_0x21f981,_0x0855('0x1d'),JSON[_0x0855('0x1e')](_0x293e7d));if(_0x293e7d['error']){if(_0x293e7d[_0x0855('0x1f')][_0x0855('0x20')]===0x1f4){logger[_0x0855('0x1f')](_0x0855('0x21'),_0x21f981,_0x293e7d['error'][_0x0855('0x22')]);return _0x403280(_0x293e7d[_0x0855('0x1f')]['message']);}logger['error'](_0x0855('0x21'),_0x21f981,_0x293e7d[_0x0855('0x1f')][_0x0855('0x22')]);return _0x64f84b(_0x293e7d[_0x0855('0x1f')][_0x0855('0x22')]);}else{logger['info'](_0x0855('0x21'),_0x21f981,_0x0855('0x1d'));_0x64f84b(_0x293e7d[_0x0855('0x23')][_0x0855('0x22')]);}})[_0x0855('0x24')](function(_0x537bf2){logger[_0x0855('0x1f')](_0x0855('0x21'),_0x21f981,_0x537bf2);_0x403280(_0x537bf2);});});}function respondWithStatusCode(_0x1b7401,_0x22045e){_0x22045e=_0x22045e||0xcc;return function(_0xf7868b){if(_0xf7868b){return _0x1b7401[_0x0855('0x25')](_0x22045e);}return _0x1b7401[_0x0855('0x26')](_0x22045e)[_0x0855('0x27')]();};}function respondWithResult(_0x4d983f,_0x1c25bd){_0x1c25bd=_0x1c25bd||0xc8;return function(_0x45be99){if(_0x45be99){return _0x4d983f[_0x0855('0x26')](_0x1c25bd)['json'](_0x45be99);}};}function respondWithFilteredResult(_0x2efb3f,_0x4f2523){return function(_0x2fb276){if(_0x2fb276){var _0x3a67b3=typeof _0x4f2523[_0x0855('0x28')]==='undefined'&&typeof _0x4f2523[_0x0855('0x29')]===_0x0855('0x2a');var _0xa18364=_0x2fb276[_0x0855('0x2b')];var _0x3b1518=_0x3a67b3?0x0:_0x4f2523[_0x0855('0x28')];var _0x1ec3fc=_0x3a67b3?_0x2fb276[_0x0855('0x2b')]:_0x4f2523[_0x0855('0x28')]+_0x4f2523[_0x0855('0x29')];var _0x1c6fb5;if(_0x1ec3fc>=_0xa18364){_0x1ec3fc=_0xa18364;_0x1c6fb5=0xc8;}else{_0x1c6fb5=0xce;}_0x2efb3f[_0x0855('0x26')](_0x1c6fb5);return _0x2efb3f[_0x0855('0x2c')]('Content-Range',_0x3b1518+'-'+_0x1ec3fc+'/'+_0xa18364)[_0x0855('0x2d')](_0x2fb276);}return null;};}function patchUpdates(_0x77ccb9){return function(_0x33a003){try{jsonpatch[_0x0855('0x2e')](_0x33a003,_0x77ccb9,!![]);}catch(_0x22f238){return BPromise[_0x0855('0x2f')](_0x22f238);}return _0x33a003[_0x0855('0x30')]();};}function saveUpdates(_0x172a3e,_0x257111){return function(_0x5b9ed7){if(_0x5b9ed7){return _0x5b9ed7['update'](_0x172a3e)[_0x0855('0x19')](function(_0x435582){return _0x435582;});}return null;};}function removeEntity(_0x1efe7f,_0x3f210c){return function(_0x5c30d9){if(_0x5c30d9){return _0x5c30d9[_0x0855('0x31')]()[_0x0855('0x19')](function(){var _0x185d65=_0x5c30d9[_0x0855('0x32')]({'plain':!![]});var _0x6ab7d8=_0x0855('0x33');return db['UserProfileResource']['destroy']({'where':{'type':_0x6ab7d8,'resourceId':_0x185d65['id']}})['then'](function(){return _0x5c30d9;});})[_0x0855('0x19')](function(){_0x1efe7f[_0x0855('0x26')](0xcc)[_0x0855('0x27')]();});}};}function handleEntityNotFound(_0x27bded,_0x52e717){return function(_0x167bfa){if(!_0x167bfa){_0x27bded['sendStatus'](0x194);}return _0x167bfa;};}function handleError(_0x45dab1,_0x527582){_0x527582=_0x527582||0x1f4;return function(_0x8d3738){logger[_0x0855('0x1f')](_0x8d3738['stack']);if(_0x8d3738[_0x0855('0x34')]){delete _0x8d3738[_0x0855('0x34')];}_0x45dab1[_0x0855('0x26')](_0x527582)[_0x0855('0x35')](_0x8d3738);};}exports[_0x0855('0x36')]=function(_0x5441df,_0x100712){var _0x3dee3a={},_0x4f35ab={},_0x46f969={'count':0x0,'rows':[]};var _0x109b00=_[_0x0855('0x37')](db[_0x0855('0x38')][_0x0855('0x39')],function(_0x1a0906){return{'name':_0x1a0906[_0x0855('0x3a')],'type':_0x1a0906['type'][_0x0855('0x3b')]};});_0x4f35ab[_0x0855('0x3c')]=_[_0x0855('0x37')](_0x109b00,_0x0855('0x34'));_0x4f35ab['query']=_[_0x0855('0x3d')](_0x5441df[_0x0855('0x3e')]);_0x4f35ab['filters']=_[_0x0855('0x3f')](_0x4f35ab['model'],_0x4f35ab['query']);_0x3dee3a['attributes']=_['intersection'](_0x4f35ab['model'],qs[_0x0855('0x40')](_0x5441df[_0x0855('0x3e')]['fields']));_0x3dee3a[_0x0855('0x41')]=_0x3dee3a[_0x0855('0x41')][_0x0855('0x42')]?_0x3dee3a[_0x0855('0x41')]:_0x4f35ab[_0x0855('0x3c')];if(!_0x5441df['query'][_0x0855('0x43')](_0x0855('0x44'))){_0x3dee3a[_0x0855('0x29')]=qs[_0x0855('0x29')](_0x5441df[_0x0855('0x3e')]['limit']);_0x3dee3a['offset']=qs['offset'](_0x5441df[_0x0855('0x3e')][_0x0855('0x28')]);}_0x3dee3a[_0x0855('0x45')]=qs[_0x0855('0x46')](_0x5441df['query'][_0x0855('0x46')]);_0x3dee3a[_0x0855('0x47')]=qs[_0x0855('0x48')](_[_0x0855('0x49')](_0x5441df[_0x0855('0x3e')],_0x4f35ab[_0x0855('0x48')]),_0x109b00);if(_0x5441df[_0x0855('0x3e')][_0x0855('0x4a')]){_0x3dee3a['where']=_[_0x0855('0x4b')](_0x3dee3a[_0x0855('0x47')],{'$or':_[_0x0855('0x37')](_0x109b00,function(_0x534f7a){if(_0x534f7a['type']!==_0x0855('0x4c')){var _0x3746c5={};_0x3746c5[_0x534f7a['name']]={'$like':'%'+_0x5441df[_0x0855('0x3e')][_0x0855('0x4a')]+'%'};return _0x3746c5;}})});}_0x3dee3a=_['merge']({},_0x3dee3a,_0x5441df['options']);var _0xa8e1fc={'where':_0x3dee3a['where']};return db[_0x0855('0x38')][_0x0855('0x2b')](_0xa8e1fc)[_0x0855('0x19')](function(_0x1fdfba){_0x46f969['count']=_0x1fdfba;if(_0x5441df[_0x0855('0x3e')][_0x0855('0x4d')]){_0x3dee3a[_0x0855('0x4e')]=[{'all':!![]}];}return db[_0x0855('0x38')]['findAll'](_0x3dee3a);})['then'](function(_0x46549e){_0x46f969['rows']=_0x46549e;return _0x46f969;})[_0x0855('0x19')](respondWithFilteredResult(_0x100712,_0x3dee3a))[_0x0855('0x24')](handleError(_0x100712,null));};exports[_0x0855('0x4f')]=function(_0x58507c,_0xe0f581){var _0x227c19={'raw':![],'where':{'id':_0x58507c[_0x0855('0x50')]['id']}},_0x2e47ed={};_0x2e47ed[_0x0855('0x3c')]=_['keys'](db[_0x0855('0x38')][_0x0855('0x39')]);_0x2e47ed[_0x0855('0x3e')]=_['keys'](_0x58507c['query']);_0x2e47ed[_0x0855('0x48')]=_[_0x0855('0x3f')](_0x2e47ed[_0x0855('0x3c')],_0x2e47ed[_0x0855('0x3e')]);_0x227c19[_0x0855('0x41')]=_['intersection'](_0x2e47ed[_0x0855('0x3c')],qs['fields'](_0x58507c[_0x0855('0x3e')][_0x0855('0x40')]));_0x227c19[_0x0855('0x41')]=_0x227c19['attributes']['length']?_0x227c19['attributes']:_0x2e47ed[_0x0855('0x3c')];if(_0x58507c[_0x0855('0x3e')][_0x0855('0x4d')]){_0x227c19[_0x0855('0x4e')]=[{'all':!![]}];}_0x227c19=_['merge']({},_0x227c19,_0x58507c[_0x0855('0x51')]);return db['VoiceContext'][_0x0855('0x52')](_0x227c19)[_0x0855('0x19')](handleEntityNotFound(_0xe0f581,null))[_0x0855('0x19')](respondWithResult(_0xe0f581,null))['catch'](handleError(_0xe0f581,null));};exports['create']=function(_0x50b5d7,_0x3c10ef,_0x45824d){var _0x3972d7;return db[_0x0855('0x38')][_0x0855('0x53')](_0x50b5d7['body'],{'raw':!![]})[_0x0855('0x19')](function(_0x44e923){_0x3972d7=_0x44e923;return db[_0x0855('0x38')][_0x0855('0x54')]({'raw':!![]});})[_0x0855('0x19')](function(_0x330803){var _0x5d9159=fs[_0x0855('0x55')](path[_0x0855('0x56')](config[_0x0855('0x57')],_0x0855('0x58')),_0x0855('0x59'));var _0x2bceac=ejs['render'](_0x5d9159,{'contexts':_0x330803||[]});fs[_0x0855('0x5a')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x2bceac);})[_0x0855('0x19')](function(){return respondWithRpcPromise('Reload',_0x0855('0x53'),{'module':_0x0855('0x5b')});})[_0x0855('0x19')](function(){var _0xf1cda=_0x50b5d7[_0x0855('0x5c')]['get']({'plain':!![]});if(!_0xf1cda)throw new Error(_0x0855('0x5d'));if(_0xf1cda['role']===_0x0855('0x5c')){var _0xc7f5a2=_0x3972d7['get']({'plain':!![]});return db[_0x0855('0x5e')][_0x0855('0x52')]({'where':{'name':_0x0855('0x33'),'userProfileId':_0xf1cda['userProfileId']},'raw':!![]})[_0x0855('0x19')](function(_0x3de7b7){if(_0x3de7b7&&_0x3de7b7[_0x0855('0x5f')]===0x0){return db[_0x0855('0x60')][_0x0855('0x53')]({'name':_0xc7f5a2[_0x0855('0x34')],'resourceId':_0xc7f5a2['id'],'type':_0x3de7b7['name'],'sectionId':_0x3de7b7['id']},{})['then'](function(){return _0x3972d7;});}else{return _0x3972d7;}})['catch'](function(_0x334c0a){logger[_0x0855('0x1f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x334c0a);throw _0x334c0a;});}return _0x3972d7;})[_0x0855('0x19')](respondWithResult(_0x3c10ef,0xc9))[_0x0855('0x24')](handleError(_0x3c10ef,null));};exports['update']=function(_0x3928dc,_0x4818a5,_0x34d7dd){var _0x43818c;return db[_0x0855('0x38')][_0x0855('0x52')]({'where':{'id':_0x3928dc[_0x0855('0x50')]['id']}})[_0x0855('0x19')](handleEntityNotFound(_0x4818a5,null))[_0x0855('0x19')](saveUpdates(_0x3928dc[_0x0855('0x61')],null))[_0x0855('0x19')](function(_0x4e9b8d){if(_0x4e9b8d){_0x43818c=_0x4e9b8d;return db[_0x0855('0x38')]['findAll']({'raw':!![]});}})[_0x0855('0x19')](function(_0x4b8a10){var _0x146fe5=fs[_0x0855('0x55')](path[_0x0855('0x56')](config[_0x0855('0x57')],_0x0855('0x58')),'utf8');var _0x247ffc=ejs['render'](_0x146fe5,{'contexts':_0x4b8a10||[]});fs['writeFileSync']('/etc/asterisk/extensions_xcally_contexts.conf',_0x247ffc);})[_0x0855('0x19')](function(){return respondWithRpcPromise(_0x0855('0x62'),_0x0855('0x63'),{'module':_0x0855('0x5b')});})[_0x0855('0x19')](function(){return _0x43818c;})[_0x0855('0x19')](respondWithResult(_0x4818a5,null))['catch'](handleError(_0x4818a5,null));};exports[_0x0855('0x31')]=function(_0x3317fa,_0x2a32ab,_0x42a06b){var _0x1b67be;return db[_0x0855('0x38')]['find']({'where':{'id':_0x3317fa[_0x0855('0x50')]['id']}})[_0x0855('0x19')](handleEntityNotFound(_0x2a32ab,null))[_0x0855('0x19')](removeEntity(_0x2a32ab,null))[_0x0855('0x19')](function(){return db[_0x0855('0x38')][_0x0855('0x54')]({'raw':!![]});})[_0x0855('0x19')](function(_0x15562f){var _0x54f70c=fs[_0x0855('0x55')](path[_0x0855('0x56')](config[_0x0855('0x57')],_0x0855('0x58')),_0x0855('0x59'));var _0x579834=ejs['render'](_0x54f70c,{'contexts':_0x15562f});fs['writeFileSync'](_0x0855('0x64'),_0x579834);return respondWithRpcPromise(_0x0855('0x62'),'destroy',{'module':_0x0855('0x5b')});})[_0x0855('0x24')](handleError(_0x2a32ab,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 9ddc21c..7647299 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 _0x20d9=['bluebird','request-promise','path','rimraf','../../config/environment','./voiceContext.attributes','define','VoiceContext','voice_contexts','util','../../config/logger','api','moment'];(function(_0x3731bf,_0x5ed2a5){var _0x2db210=function(_0x4ba4f4){while(--_0x4ba4f4){_0x3731bf['push'](_0x3731bf['shift']());}};_0x2db210(++_0x5ed2a5);}(_0x20d9,0xcc));var _0x920d=function(_0x34d840,_0x5d7566){_0x34d840=_0x34d840-0x0;var _0x1b3f62=_0x20d9[_0x34d840];return _0x1b3f62;};'use strict';var _=require('lodash');var util=require(_0x920d('0x0'));var logger=require(_0x920d('0x1'))(_0x920d('0x2'));var moment=require(_0x920d('0x3'));var BPromise=require(_0x920d('0x4'));var rp=require(_0x920d('0x5'));var fs=require('fs');var path=require(_0x920d('0x6'));var rimraf=require(_0x920d('0x7'));var config=require(_0x920d('0x8'));var attributes=require(_0x920d('0x9'));module['exports']=function(_0x4f828d,_0x3f7122){return _0x4f828d[_0x920d('0xa')](_0x920d('0xb'),attributes,{'tableName':_0x920d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9823=['bluebird','path','rimraf','../../config/environment','./voiceContext.attributes','exports','define','voice_contexts','lodash','util','../../config/logger','api'];(function(_0x1e9155,_0x19e091){var _0x16b55c=function(_0x1aa969){while(--_0x1aa969){_0x1e9155['push'](_0x1e9155['shift']());}};_0x16b55c(++_0x19e091);}(_0x9823,0xf8));var _0x3982=function(_0x25d1f8,_0x359928){_0x25d1f8=_0x25d1f8-0x0;var _0x5e5b8e=_0x9823[_0x25d1f8];return _0x5e5b8e;};'use strict';var _=require(_0x3982('0x0'));var util=require(_0x3982('0x1'));var logger=require(_0x3982('0x2'))(_0x3982('0x3'));var moment=require('moment');var BPromise=require(_0x3982('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3982('0x5'));var rimraf=require(_0x3982('0x6'));var config=require(_0x3982('0x7'));var attributes=require(_0x3982('0x8'));module[_0x3982('0x9')]=function(_0x5dc2f2,_0x1d1dbb){return _0x5dc2f2[_0x3982('0xa')]('VoiceContext',attributes,{'tableName':_0x3982('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index 9b9db28..74ba78d 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 _0x64eb=['lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x158b9b,_0x16f16a){var _0xeab562=function(_0x318ecd){while(--_0x318ecd){_0x158b9b['push'](_0x158b9b['shift']());}};_0xeab562(++_0x16f16a);}(_0x64eb,0xc6));var _0xb64e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x64eb[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xb64e('0x0'));var util=require(_0xb64e('0x1'));var moment=require('moment');var BPromise=require(_0xb64e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb64e('0x3'));var db=require(_0xb64e('0x4'))['db'];var utils=require(_0xb64e('0x5'));var logger=require('../../config/logger')(_0xb64e('0x6'));var config=require('../../config/environment');var jayson=require(_0xb64e('0x7'));var client=jayson[_0xb64e('0x8')][_0xb64e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x474f1a,_0x1f3ed4,_0x78f41d){return new BPromise(function(_0x282638,_0x386c38){return client[_0xb64e('0xa')](_0x474f1a,_0x78f41d)['then'](function(_0x579f21){logger[_0xb64e('0xb')](_0xb64e('0xc'),_0x1f3ed4,_0xb64e('0xd'));logger[_0xb64e('0xe')](_0xb64e('0xf'),_0x1f3ed4,_0xb64e('0xd'),JSON[_0xb64e('0x10')](_0x579f21));if(_0x579f21[_0xb64e('0x11')]){if(_0x579f21[_0xb64e('0x11')][_0xb64e('0x12')]===0x1f4){logger[_0xb64e('0x11')](_0xb64e('0xc'),_0x1f3ed4,_0x579f21['error'][_0xb64e('0x13')]);return _0x386c38(_0x579f21[_0xb64e('0x11')][_0xb64e('0x13')]);}logger[_0xb64e('0x11')](_0xb64e('0xc'),_0x1f3ed4,_0x579f21[_0xb64e('0x11')][_0xb64e('0x13')]);return _0x282638(_0x579f21[_0xb64e('0x11')][_0xb64e('0x13')]);}else{logger[_0xb64e('0xb')](_0xb64e('0xc'),_0x1f3ed4,_0xb64e('0xd'));_0x282638(_0x579f21[_0xb64e('0x14')][_0xb64e('0x13')]);}})[_0xb64e('0x15')](function(_0x1d72e3){logger['error'](_0xb64e('0xc'),_0x1f3ed4,_0x1d72e3);_0x386c38(_0x1d72e3);});});} \ No newline at end of file +var _0x4e5c=['moment','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','request','then','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash'];(function(_0x188334,_0x19a000){var _0x3b41bd=function(_0x444e33){while(--_0x444e33){_0x188334['push'](_0x188334['shift']());}};_0x3b41bd(++_0x19a000);}(_0x4e5c,0x149));var _0xc4e5=function(_0x20a558,_0x160e0e){_0x20a558=_0x20a558-0x0;var _0x53d3f7=_0x4e5c[_0x20a558];return _0x53d3f7;};'use strict';var _=require(_0xc4e5('0x0'));var util=require('util');var moment=require(_0xc4e5('0x1'));var BPromise=require('bluebird');var rs=require(_0xc4e5('0x2'));var fs=require('fs');var Redis=require(_0xc4e5('0x3'));var db=require(_0xc4e5('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xc4e5('0x5'));var jayson=require(_0xc4e5('0x6'));var client=jayson[_0xc4e5('0x7')][_0xc4e5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x36da95,_0x1a7dac,_0x40c9df){return new BPromise(function(_0x3fb6b7,_0x3283b4){return client[_0xc4e5('0x9')](_0x36da95,_0x40c9df)[_0xc4e5('0xa')](function(_0x259106){logger['info'](_0xc4e5('0xb'),_0x1a7dac,_0xc4e5('0xc'));logger[_0xc4e5('0xd')](_0xc4e5('0xe'),_0x1a7dac,'request\x20sent',JSON[_0xc4e5('0xf')](_0x259106));if(_0x259106[_0xc4e5('0x10')]){if(_0x259106[_0xc4e5('0x10')][_0xc4e5('0x11')]===0x1f4){logger[_0xc4e5('0x10')](_0xc4e5('0xb'),_0x1a7dac,_0x259106[_0xc4e5('0x10')]['message']);return _0x3283b4(_0x259106['error'][_0xc4e5('0x12')]);}logger['error'](_0xc4e5('0xb'),_0x1a7dac,_0x259106[_0xc4e5('0x10')][_0xc4e5('0x12')]);return _0x3fb6b7(_0x259106[_0xc4e5('0x10')]['message']);}else{logger[_0xc4e5('0x13')]('VoiceContext,\x20%s,\x20%s',_0x1a7dac,_0xc4e5('0xc'));_0x3fb6b7(_0x259106[_0xc4e5('0x14')][_0xc4e5('0x12')]);}})[_0xc4e5('0x15')](function(_0x12ff4c){logger[_0xc4e5('0x10')](_0xc4e5('0xb'),_0x1a7dac,_0x12ff4c);_0x3283b4(_0x12ff4c);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index a37dc28..a6d7af9 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 _0xa786=['../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','index','/describe','isAuthenticated','/:id','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x5dc5c6,_0x2d502a){var _0xaf61e8=function(_0x44eeb0){while(--_0x44eeb0){_0x5dc5c6['push'](_0x5dc5c6['shift']());}};_0xaf61e8(++_0x2d502a);}(_0xa786,0x1f1));var _0x6a78=function(_0x1021c8,_0x449509){_0x1021c8=_0x1021c8-0x0;var _0x5b63cb=_0xa786[_0x1021c8];return _0x5b63cb;};'use strict';var multer=require(_0x6a78('0x0'));var util=require(_0x6a78('0x1'));var path=require(_0x6a78('0x2'));var timeout=require(_0x6a78('0x3'));var express=require(_0x6a78('0x4'));var router=express[_0x6a78('0x5')]();var fs_extra=require(_0x6a78('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x6a78('0x7'));var config=require(_0x6a78('0x8'));var controller=require(_0x6a78('0x9'));router[_0x6a78('0xa')]('/',auth['isAuthenticated'](),controller[_0x6a78('0xb')]);router[_0x6a78('0xa')](_0x6a78('0xc'),auth[_0x6a78('0xd')](),controller['describe']);router['get'](_0x6a78('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x6a78('0xf')]('/',auth[_0x6a78('0xd')](),controller[_0x6a78('0x10')]);router[_0x6a78('0x11')](_0x6a78('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x6a78('0x12')](_0x6a78('0xe'),auth['isAuthenticated'](),controller[_0x6a78('0x13')]);module[_0x6a78('0x14')]=router; \ No newline at end of file +var _0x6d04=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','/:id','show','post','create','update','delete','destroy','exports','multer','connect-timeout','express'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x6d04,0x74));var _0x46d0=function(_0x3dec71,_0x4b2e75){_0x3dec71=_0x3dec71-0x0;var _0x3aa06e=_0x6d04[_0x3dec71];return _0x3aa06e;};'use strict';var multer=require(_0x46d0('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x46d0('0x1'));var express=require(_0x46d0('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x46d0('0x3'));var interaction=require(_0x46d0('0x4'));var config=require(_0x46d0('0x5'));var controller=require(_0x46d0('0x6'));router[_0x46d0('0x7')]('/',auth[_0x46d0('0x8')](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x46d0('0x7')](_0x46d0('0x9'),auth[_0x46d0('0x8')](),controller[_0x46d0('0xa')]);router[_0x46d0('0xb')]('/',auth[_0x46d0('0x8')](),controller[_0x46d0('0xc')]);router['put'](_0x46d0('0x9'),auth[_0x46d0('0x8')](),controller[_0x46d0('0xd')]);router[_0x46d0('0xe')](_0x46d0('0x9'),auth[_0x46d0('0x8')](),controller[_0x46d0('0xf')]);module[_0x46d0('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 9463f70..e6e598f 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 _0x3e74=['DATE','sequelize','STRING','INTEGER'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0x3e74,0x175));var _0x43e7=function(_0x2b3545,_0x3dfbca){_0x2b3545=_0x2b3545-0x0;var _0x739e6c=_0x3e74[_0x2b3545];return _0x739e6c;};'use strict';var Sequelize=require(_0x43e7('0x0'));module['exports']={'privilege':{'type':Sequelize[_0x43e7('0x1')]},'channel':{'type':Sequelize[_0x43e7('0x1')]},'channelstate':{'type':Sequelize[_0x43e7('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x43e7('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x43e7('0x1')]},'language':{'type':Sequelize[_0x43e7('0x1')]},'accountcode':{'type':Sequelize[_0x43e7('0x1')]},'context':{'type':Sequelize[_0x43e7('0x1')]},'exten':{'type':Sequelize[_0x43e7('0x1')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x43e7('0x1')]},'linkedid':{'type':Sequelize[_0x43e7('0x1')]},'destchannel':{'type':Sequelize[_0x43e7('0x1')]},'destchannelstate':{'type':Sequelize[_0x43e7('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x43e7('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x43e7('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x43e7('0x1')]},'destaccountcode':{'type':Sequelize[_0x43e7('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x43e7('0x1')]},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize[_0x43e7('0x1')]},'destlinkedid':{'type':Sequelize[_0x43e7('0x1')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0x43e7('0x1')]},'starttime':{'type':Sequelize[_0x43e7('0x3')]},'answertime':{'type':Sequelize[_0x43e7('0x3')]},'endtime':{'type':Sequelize[_0x43e7('0x3')]},'lastevent':{'type':Sequelize['STRING'],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0x43e7('0x2')]},'duration':{'type':Sequelize[_0x43e7('0x2')]},'holdtime':{'type':Sequelize[_0x43e7('0x2')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xedd9=['DATE','called,connect,complete','exports','STRING','INTEGER'];(function(_0x5be9a4,_0x570e14){var _0xbb11e4=function(_0x424817){while(--_0x424817){_0x5be9a4['push'](_0x5be9a4['shift']());}};_0xbb11e4(++_0x570e14);}(_0xedd9,0xfc));var _0x9edd=function(_0x361cd0,_0x503b1d){_0x361cd0=_0x361cd0-0x0;var _0x3b29ed=_0xedd9[_0x361cd0];return _0x3b29ed;};'use strict';var Sequelize=require('sequelize');module[_0x9edd('0x0')]={'privilege':{'type':Sequelize[_0x9edd('0x1')]},'channel':{'type':Sequelize[_0x9edd('0x1')]},'channelstate':{'type':Sequelize[_0x9edd('0x2')]},'channelstatedesc':{'type':Sequelize[_0x9edd('0x1')]},'calleridnum':{'type':Sequelize[_0x9edd('0x1')]},'calleridname':{'type':Sequelize[_0x9edd('0x1')]},'connectedlinenum':{'type':Sequelize[_0x9edd('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x9edd('0x1')]},'accountcode':{'type':Sequelize[_0x9edd('0x1')]},'context':{'type':Sequelize[_0x9edd('0x1')]},'exten':{'type':Sequelize[_0x9edd('0x1')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x9edd('0x1')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x9edd('0x1')]},'destchannelstate':{'type':Sequelize[_0x9edd('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x9edd('0x1')]},'destcalleridnum':{'type':Sequelize[_0x9edd('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x9edd('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x9edd('0x1')]},'destaccountcode':{'type':Sequelize[_0x9edd('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x9edd('0x1')]},'destpriority':{'type':Sequelize[_0x9edd('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize[_0x9edd('0x1')]},'dialstring':{'type':Sequelize[_0x9edd('0x1')]},'dialstatus':{'type':Sequelize[_0x9edd('0x1')]},'starttime':{'type':Sequelize[_0x9edd('0x3')]},'answertime':{'type':Sequelize[_0x9edd('0x3')]},'endtime':{'type':Sequelize[_0x9edd('0x3')]},'lastevent':{'type':Sequelize[_0x9edd('0x1')],'comment':_0x9edd('0x4')},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize[_0x9edd('0x2')]},'holdtime':{'type':Sequelize[_0x9edd('0x2')]},'billableseconds':{'type':Sequelize[_0x9edd('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 2961ca1..f1eb221 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 _0x6777=['desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','save','update','then','end','error','stack','name','send','index','map','VoiceDialReport','fieldName','type','model','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','where','merge','options','includeAll','include','findAll','rows','catch','params','rawAttributes','intersection','length','find','create','body','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel'];(function(_0x124ddd,_0x313748){var _0x19616a=function(_0x187c52){while(--_0x187c52){_0x124ddd['push'](_0x124ddd['shift']());}};_0x19616a(++_0x313748);}(_0x6777,0xcb));var _0x7677=function(_0xa8883,_0x1f107f){_0xa8883=_0xa8883-0x0;var _0x479426=_0x6777[_0xa8883];return _0x479426;};'use strict';var emlformat=require(_0x7677('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7677('0x1'));var rp=require(_0x7677('0x2'));var moment=require(_0x7677('0x3'));var BPromise=require(_0x7677('0x4'));var Mustache=require(_0x7677('0x5'));var util=require(_0x7677('0x6'));var path=require(_0x7677('0x7'));var sox=require(_0x7677('0x8'));var csv=require(_0x7677('0x9'));var ejs=require(_0x7677('0xa'));var fs=require('fs');var fs_extra=require(_0x7677('0xb'));var _=require('lodash');var squel=require(_0x7677('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7677('0xd'));var toCsv=require(_0x7677('0x9'));var querystring=require(_0x7677('0xe'));var Papa=require(_0x7677('0xf'));var Redis=require('ioredis');var authService=require(_0x7677('0x10'));var qs=require(_0x7677('0x11'));var as=require(_0x7677('0x12'));var hardwareService=require(_0x7677('0x13'));var logger=require(_0x7677('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7677('0x15'));var db=require(_0x7677('0x16'))['db'];function respondWithStatusCode(_0x16c6a2,_0x2b7931){_0x2b7931=_0x2b7931||0xcc;return function(_0x5ea4ea){if(_0x5ea4ea){return _0x16c6a2[_0x7677('0x17')](_0x2b7931);}return _0x16c6a2['status'](_0x2b7931)['end']();};}function respondWithResult(_0x579702,_0x4d6e19){_0x4d6e19=_0x4d6e19||0xc8;return function(_0x5808c2){if(_0x5808c2){return _0x579702[_0x7677('0x18')](_0x4d6e19)[_0x7677('0x19')](_0x5808c2);}};}function respondWithFilteredResult(_0x34c5a0,_0xbe5418){return function(_0x5de850){if(_0x5de850){var _0x5ad206=typeof _0xbe5418[_0x7677('0x1a')]==='undefined'&&typeof _0xbe5418['limit']===_0x7677('0x1b');var _0x40ef8b=_0x5de850['count'];var _0x397c63=_0x5ad206?0x0:_0xbe5418[_0x7677('0x1a')];var _0x869d1b=_0x5ad206?_0x5de850[_0x7677('0x1c')]:_0xbe5418[_0x7677('0x1a')]+_0xbe5418[_0x7677('0x1d')];var _0x263b3c;if(_0x869d1b>=_0x40ef8b){_0x869d1b=_0x40ef8b;_0x263b3c=0xc8;}else{_0x263b3c=0xce;}_0x34c5a0[_0x7677('0x18')](_0x263b3c);return _0x34c5a0[_0x7677('0x1e')](_0x7677('0x1f'),_0x397c63+'-'+_0x869d1b+'/'+_0x40ef8b)[_0x7677('0x19')](_0x5de850);}return null;};}function patchUpdates(_0x547b73){return function(_0x129a42){try{jsonpatch['apply'](_0x129a42,_0x547b73,!![]);}catch(_0x20fcce){return BPromise['reject'](_0x20fcce);}return _0x129a42[_0x7677('0x20')]();};}function saveUpdates(_0x23ee3a,_0x30b602){return function(_0x58a35f){if(_0x58a35f){return _0x58a35f[_0x7677('0x21')](_0x23ee3a)[_0x7677('0x22')](function(_0x5e0081){return _0x5e0081;});}return null;};}function removeEntity(_0xedbc8c,_0x48e01d){return function(_0x7e818){if(_0x7e818){return _0x7e818['destroy']()[_0x7677('0x22')](function(){_0xedbc8c[_0x7677('0x18')](0xcc)[_0x7677('0x23')]();});}};}function handleEntityNotFound(_0x274c50,_0x11c799){return function(_0xa80072){if(!_0xa80072){_0x274c50[_0x7677('0x17')](0x194);}return _0xa80072;};}function handleError(_0x377167,_0x5732fc){_0x5732fc=_0x5732fc||0x1f4;return function(_0x3d1b29){logger[_0x7677('0x24')](_0x3d1b29[_0x7677('0x25')]);if(_0x3d1b29[_0x7677('0x26')]){delete _0x3d1b29['name'];}_0x377167[_0x7677('0x18')](_0x5732fc)[_0x7677('0x27')](_0x3d1b29);};}exports[_0x7677('0x28')]=function(_0x572140,_0x574ca5){var _0x2e2c35={},_0x5b877a={},_0x599011={'count':0x0,'rows':[]};var _0x5b19cb=_[_0x7677('0x29')](db[_0x7677('0x2a')]['rawAttributes'],function(_0x11eddf){return{'name':_0x11eddf[_0x7677('0x2b')],'type':_0x11eddf[_0x7677('0x2c')]['key']};});_0x5b877a[_0x7677('0x2d')]=_[_0x7677('0x29')](_0x5b19cb,'name');_0x5b877a[_0x7677('0x2e')]=_[_0x7677('0x2f')](_0x572140[_0x7677('0x2e')]);_0x5b877a[_0x7677('0x30')]=_['intersection'](_0x5b877a['model'],_0x5b877a[_0x7677('0x2e')]);_0x2e2c35[_0x7677('0x31')]=_['intersection'](_0x5b877a[_0x7677('0x2d')],qs[_0x7677('0x32')](_0x572140['query'][_0x7677('0x32')]));_0x2e2c35[_0x7677('0x31')]=_0x2e2c35[_0x7677('0x31')]['length']?_0x2e2c35[_0x7677('0x31')]:_0x5b877a['model'];if(!_0x572140['query'][_0x7677('0x33')](_0x7677('0x34'))){_0x2e2c35[_0x7677('0x1d')]=qs[_0x7677('0x1d')](_0x572140['query'][_0x7677('0x1d')]);_0x2e2c35[_0x7677('0x1a')]=qs['offset'](_0x572140[_0x7677('0x2e')][_0x7677('0x1a')]);}_0x2e2c35[_0x7677('0x35')]=qs[_0x7677('0x36')](_0x572140[_0x7677('0x2e')][_0x7677('0x36')]);_0x2e2c35['where']=qs[_0x7677('0x30')](_['pick'](_0x572140[_0x7677('0x2e')],_0x5b877a[_0x7677('0x30')]),_0x5b19cb);if(_0x572140[_0x7677('0x2e')][_0x7677('0x37')]){_0x2e2c35[_0x7677('0x38')]=_[_0x7677('0x39')](_0x2e2c35[_0x7677('0x38')],{'$or':_[_0x7677('0x29')](_0x5b19cb,function(_0x59fdb2){if(_0x59fdb2[_0x7677('0x2c')]!=='VIRTUAL'){var _0x6d5d4e={};_0x6d5d4e[_0x59fdb2[_0x7677('0x26')]]={'$like':'%'+_0x572140[_0x7677('0x2e')][_0x7677('0x37')]+'%'};return _0x6d5d4e;}})});}_0x2e2c35=_[_0x7677('0x39')]({},_0x2e2c35,_0x572140[_0x7677('0x3a')]);var _0x5732d6={'where':_0x2e2c35['where']};return db[_0x7677('0x2a')]['count'](_0x5732d6)[_0x7677('0x22')](function(_0x158c05){_0x599011['count']=_0x158c05;if(_0x572140[_0x7677('0x2e')][_0x7677('0x3b')]){_0x2e2c35[_0x7677('0x3c')]=[{'all':!![]}];}return db[_0x7677('0x2a')][_0x7677('0x3d')](_0x2e2c35);})[_0x7677('0x22')](function(_0x584e38){_0x599011[_0x7677('0x3e')]=_0x584e38;return _0x599011;})[_0x7677('0x22')](respondWithFilteredResult(_0x574ca5,_0x2e2c35))[_0x7677('0x3f')](handleError(_0x574ca5,null));};exports['show']=function(_0x272ad5,_0x2f25b4){var _0x474a1b={'raw':!![],'where':{'id':_0x272ad5[_0x7677('0x40')]['id']}},_0x5092fb={};_0x5092fb['model']=_[_0x7677('0x2f')](db[_0x7677('0x2a')][_0x7677('0x41')]);_0x5092fb[_0x7677('0x2e')]=_[_0x7677('0x2f')](_0x272ad5['query']);_0x5092fb[_0x7677('0x30')]=_[_0x7677('0x42')](_0x5092fb[_0x7677('0x2d')],_0x5092fb['query']);_0x474a1b[_0x7677('0x31')]=_[_0x7677('0x42')](_0x5092fb[_0x7677('0x2d')],qs[_0x7677('0x32')](_0x272ad5[_0x7677('0x2e')][_0x7677('0x32')]));_0x474a1b[_0x7677('0x31')]=_0x474a1b[_0x7677('0x31')][_0x7677('0x43')]?_0x474a1b[_0x7677('0x31')]:_0x5092fb[_0x7677('0x2d')];if(_0x272ad5[_0x7677('0x2e')]['includeAll']){_0x474a1b[_0x7677('0x3c')]=[{'all':!![]}];}_0x474a1b=_['merge']({},_0x474a1b,_0x272ad5[_0x7677('0x3a')]);return db[_0x7677('0x2a')][_0x7677('0x44')](_0x474a1b)[_0x7677('0x22')](handleEntityNotFound(_0x2f25b4,null))['then'](respondWithResult(_0x2f25b4,null))[_0x7677('0x3f')](handleError(_0x2f25b4,null));};exports[_0x7677('0x45')]=function(_0x5cc084,_0x5b778f){return db['VoiceDialReport']['create'](_0x5cc084[_0x7677('0x46')],{})[_0x7677('0x22')](respondWithResult(_0x5b778f,0xc9))[_0x7677('0x3f')](handleError(_0x5b778f,null));};exports[_0x7677('0x21')]=function(_0x4d7db9,_0xb9cd3b){if(_0x4d7db9['body']['id']){delete _0x4d7db9['body']['id'];}return db['VoiceDialReport']['find']({'where':{'id':_0x4d7db9[_0x7677('0x40')]['id']}})[_0x7677('0x22')](handleEntityNotFound(_0xb9cd3b,null))[_0x7677('0x22')](saveUpdates(_0x4d7db9[_0x7677('0x46')],null))[_0x7677('0x22')](respondWithResult(_0xb9cd3b,null))[_0x7677('0x3f')](handleError(_0xb9cd3b,null));};exports['destroy']=function(_0x150849,_0x5d7fb6){return db[_0x7677('0x2a')][_0x7677('0x44')]({'where':{'id':_0x150849[_0x7677('0x40')]['id']}})[_0x7677('0x22')](handleEntityNotFound(_0x5d7fb6,null))[_0x7677('0x22')](removeEntity(_0x5d7fb6,null))['catch'](handleError(_0x5d7fb6,null));};exports[_0x7677('0x47')]=function(_0x59a2ad,_0x471de2){return db[_0x7677('0x2a')]['describe']()['then'](respondWithResult(_0x471de2,null))['catch'](handleError(_0x471de2,null));}; \ No newline at end of file +var _0x03bf=['hasOwnProperty','nolimit','sort','where','merge','options','VoiceDialReport','includeAll','include','findAll','find','catch','create','body','params','describe','eml-format','rimraf','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','json','reject','update','then','destroy','error','name','send','index','map','rawAttributes','type','key','query','keys','filters','intersection','model','fields','attributes','length'];(function(_0x458920,_0x58ab7e){var _0xdc2988=function(_0x3e2301){while(--_0x3e2301){_0x458920['push'](_0x458920['shift']());}};_0xdc2988(++_0x58ab7e);}(_0x03bf,0x1e5));var _0xf03b=function(_0x54d0f9,_0x4d9a56){_0x54d0f9=_0x54d0f9-0x0;var _0x3c5c7a=_0x03bf[_0x54d0f9];return _0x3c5c7a;};'use strict';var emlformat=require(_0xf03b('0x0'));var rimraf=require(_0xf03b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf03b('0x2'));var BPromise=require(_0xf03b('0x3'));var Mustache=require(_0xf03b('0x4'));var util=require(_0xf03b('0x5'));var path=require(_0xf03b('0x6'));var sox=require(_0xf03b('0x7'));var csv=require(_0xf03b('0x8'));var ejs=require(_0xf03b('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf03b('0xa'));var squel=require(_0xf03b('0xb'));var crypto=require(_0xf03b('0xc'));var jsforce=require(_0xf03b('0xd'));var deskjs=require(_0xf03b('0xe'));var toCsv=require(_0xf03b('0x8'));var querystring=require(_0xf03b('0xf'));var Papa=require(_0xf03b('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf03b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf03b('0x12'));var logger=require(_0xf03b('0x13'))('api');var utils=require(_0xf03b('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xf03b('0x15'))['db'];function respondWithStatusCode(_0x402b0a,_0x1aebec){_0x1aebec=_0x1aebec||0xcc;return function(_0x5e541a){if(_0x5e541a){return _0x402b0a[_0xf03b('0x16')](_0x1aebec);}return _0x402b0a[_0xf03b('0x17')](_0x1aebec)[_0xf03b('0x18')]();};}function respondWithResult(_0x4105fa,_0x49a325){_0x49a325=_0x49a325||0xc8;return function(_0x5f2e7b){if(_0x5f2e7b){return _0x4105fa[_0xf03b('0x17')](_0x49a325)['json'](_0x5f2e7b);}};}function respondWithFilteredResult(_0x4b6c9b,_0x1765d1){return function(_0x2bc978){if(_0x2bc978){var _0x426ac1=typeof _0x1765d1[_0xf03b('0x19')]==='undefined'&&typeof _0x1765d1[_0xf03b('0x1a')]===_0xf03b('0x1b');var _0x2d5268=_0x2bc978[_0xf03b('0x1c')];var _0x37213c=_0x426ac1?0x0:_0x1765d1[_0xf03b('0x19')];var _0x1745ed=_0x426ac1?_0x2bc978[_0xf03b('0x1c')]:_0x1765d1['offset']+_0x1765d1[_0xf03b('0x1a')];var _0x512fb2;if(_0x1745ed>=_0x2d5268){_0x1745ed=_0x2d5268;_0x512fb2=0xc8;}else{_0x512fb2=0xce;}_0x4b6c9b[_0xf03b('0x17')](_0x512fb2);return _0x4b6c9b[_0xf03b('0x1d')]('Content-Range',_0x37213c+'-'+_0x1745ed+'/'+_0x2d5268)[_0xf03b('0x1e')](_0x2bc978);}return null;};}function patchUpdates(_0x4c56a2){return function(_0x5a9790){try{jsonpatch['apply'](_0x5a9790,_0x4c56a2,!![]);}catch(_0x5655b1){return BPromise[_0xf03b('0x1f')](_0x5655b1);}return _0x5a9790['save']();};}function saveUpdates(_0x398360,_0x33f65d){return function(_0x3d76bd){if(_0x3d76bd){return _0x3d76bd[_0xf03b('0x20')](_0x398360)[_0xf03b('0x21')](function(_0x431d46){return _0x431d46;});}return null;};}function removeEntity(_0x370a45,_0x46f482){return function(_0x3a6468){if(_0x3a6468){return _0x3a6468[_0xf03b('0x22')]()['then'](function(){_0x370a45[_0xf03b('0x17')](0xcc)[_0xf03b('0x18')]();});}};}function handleEntityNotFound(_0x463b83,_0x18af81){return function(_0x47ce14){if(!_0x47ce14){_0x463b83[_0xf03b('0x16')](0x194);}return _0x47ce14;};}function handleError(_0x566d5f,_0x404c11){_0x404c11=_0x404c11||0x1f4;return function(_0x33a4e0){logger[_0xf03b('0x23')](_0x33a4e0['stack']);if(_0x33a4e0[_0xf03b('0x24')]){delete _0x33a4e0[_0xf03b('0x24')];}_0x566d5f[_0xf03b('0x17')](_0x404c11)[_0xf03b('0x25')](_0x33a4e0);};}exports[_0xf03b('0x26')]=function(_0xa1e43,_0x5a8192){var _0x297961={},_0x408253={},_0x18b77c={'count':0x0,'rows':[]};var _0x6c2c30=_[_0xf03b('0x27')](db['VoiceDialReport'][_0xf03b('0x28')],function(_0x286cc4){return{'name':_0x286cc4['fieldName'],'type':_0x286cc4[_0xf03b('0x29')][_0xf03b('0x2a')]};});_0x408253['model']=_[_0xf03b('0x27')](_0x6c2c30,_0xf03b('0x24'));_0x408253[_0xf03b('0x2b')]=_[_0xf03b('0x2c')](_0xa1e43[_0xf03b('0x2b')]);_0x408253[_0xf03b('0x2d')]=_[_0xf03b('0x2e')](_0x408253['model'],_0x408253[_0xf03b('0x2b')]);_0x297961['attributes']=_['intersection'](_0x408253[_0xf03b('0x2f')],qs['fields'](_0xa1e43['query'][_0xf03b('0x30')]));_0x297961[_0xf03b('0x31')]=_0x297961[_0xf03b('0x31')][_0xf03b('0x32')]?_0x297961[_0xf03b('0x31')]:_0x408253[_0xf03b('0x2f')];if(!_0xa1e43[_0xf03b('0x2b')][_0xf03b('0x33')](_0xf03b('0x34'))){_0x297961[_0xf03b('0x1a')]=qs[_0xf03b('0x1a')](_0xa1e43[_0xf03b('0x2b')][_0xf03b('0x1a')]);_0x297961[_0xf03b('0x19')]=qs[_0xf03b('0x19')](_0xa1e43['query'][_0xf03b('0x19')]);}_0x297961['order']=qs[_0xf03b('0x35')](_0xa1e43['query']['sort']);_0x297961[_0xf03b('0x36')]=qs[_0xf03b('0x2d')](_['pick'](_0xa1e43[_0xf03b('0x2b')],_0x408253[_0xf03b('0x2d')]),_0x6c2c30);if(_0xa1e43[_0xf03b('0x2b')]['filter']){_0x297961[_0xf03b('0x36')]=_[_0xf03b('0x37')](_0x297961[_0xf03b('0x36')],{'$or':_[_0xf03b('0x27')](_0x6c2c30,function(_0xb51422){if(_0xb51422[_0xf03b('0x29')]!=='VIRTUAL'){var _0x10e411={};_0x10e411[_0xb51422[_0xf03b('0x24')]]={'$like':'%'+_0xa1e43['query']['filter']+'%'};return _0x10e411;}})});}_0x297961=_[_0xf03b('0x37')]({},_0x297961,_0xa1e43[_0xf03b('0x38')]);var _0x3901ba={'where':_0x297961['where']};return db[_0xf03b('0x39')]['count'](_0x3901ba)[_0xf03b('0x21')](function(_0x236adc){_0x18b77c[_0xf03b('0x1c')]=_0x236adc;if(_0xa1e43[_0xf03b('0x2b')][_0xf03b('0x3a')]){_0x297961[_0xf03b('0x3b')]=[{'all':!![]}];}return db[_0xf03b('0x39')][_0xf03b('0x3c')](_0x297961);})[_0xf03b('0x21')](function(_0x5d3b66){_0x18b77c['rows']=_0x5d3b66;return _0x18b77c;})[_0xf03b('0x21')](respondWithFilteredResult(_0x5a8192,_0x297961))['catch'](handleError(_0x5a8192,null));};exports['show']=function(_0x104e4a,_0x304416){var _0x2c897b={'raw':!![],'where':{'id':_0x104e4a['params']['id']}},_0x3378f9={};_0x3378f9['model']=_[_0xf03b('0x2c')](db['VoiceDialReport'][_0xf03b('0x28')]);_0x3378f9[_0xf03b('0x2b')]=_[_0xf03b('0x2c')](_0x104e4a[_0xf03b('0x2b')]);_0x3378f9['filters']=_[_0xf03b('0x2e')](_0x3378f9['model'],_0x3378f9[_0xf03b('0x2b')]);_0x2c897b['attributes']=_[_0xf03b('0x2e')](_0x3378f9[_0xf03b('0x2f')],qs[_0xf03b('0x30')](_0x104e4a['query'][_0xf03b('0x30')]));_0x2c897b['attributes']=_0x2c897b[_0xf03b('0x31')][_0xf03b('0x32')]?_0x2c897b['attributes']:_0x3378f9[_0xf03b('0x2f')];if(_0x104e4a['query']['includeAll']){_0x2c897b[_0xf03b('0x3b')]=[{'all':!![]}];}_0x2c897b=_[_0xf03b('0x37')]({},_0x2c897b,_0x104e4a[_0xf03b('0x38')]);return db[_0xf03b('0x39')][_0xf03b('0x3d')](_0x2c897b)['then'](handleEntityNotFound(_0x304416,null))['then'](respondWithResult(_0x304416,null))[_0xf03b('0x3e')](handleError(_0x304416,null));};exports[_0xf03b('0x3f')]=function(_0x540f04,_0x43e76b){return db[_0xf03b('0x39')][_0xf03b('0x3f')](_0x540f04[_0xf03b('0x40')],{})['then'](respondWithResult(_0x43e76b,0xc9))[_0xf03b('0x3e')](handleError(_0x43e76b,null));};exports[_0xf03b('0x20')]=function(_0x2de3ea,_0x537490){if(_0x2de3ea[_0xf03b('0x40')]['id']){delete _0x2de3ea[_0xf03b('0x40')]['id'];}return db[_0xf03b('0x39')][_0xf03b('0x3d')]({'where':{'id':_0x2de3ea[_0xf03b('0x41')]['id']}})[_0xf03b('0x21')](handleEntityNotFound(_0x537490,null))[_0xf03b('0x21')](saveUpdates(_0x2de3ea['body'],null))[_0xf03b('0x21')](respondWithResult(_0x537490,null))[_0xf03b('0x3e')](handleError(_0x537490,null));};exports[_0xf03b('0x22')]=function(_0x23ca9c,_0x538867){return db['VoiceDialReport'][_0xf03b('0x3d')]({'where':{'id':_0x23ca9c[_0xf03b('0x41')]['id']}})[_0xf03b('0x21')](handleEntityNotFound(_0x538867,null))['then'](removeEntity(_0x538867,null))['catch'](handleError(_0x538867,null));};exports[_0xf03b('0x42')]=function(_0x19a64f,_0x36d5d4){return db['VoiceDialReport'][_0xf03b('0x42')]()[_0xf03b('0x21')](respondWithResult(_0x36d5d4,null))[_0xf03b('0x3e')](handleError(_0x36d5d4,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index c09a7d3..a754ee3 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 _0xe50f=['bluebird','request-promise','path','rimraf','../../config/environment','./voiceDialReport.attributes','exports','define','report_dial','lodash','api','moment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe50f,0x1b9));var _0xfe50=function(_0x17bb7a,_0xa4d1d7){_0x17bb7a=_0x17bb7a-0x0;var _0x29ea0f=_0xe50f[_0x17bb7a];return _0x29ea0f;};'use strict';var _=require(_0xfe50('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xfe50('0x1'));var moment=require(_0xfe50('0x2'));var BPromise=require(_0xfe50('0x3'));var rp=require(_0xfe50('0x4'));var fs=require('fs');var path=require(_0xfe50('0x5'));var rimraf=require(_0xfe50('0x6'));var config=require(_0xfe50('0x7'));var attributes=require(_0xfe50('0x8'));module[_0xfe50('0x9')]=function(_0xa1f3c4,_0x5219e7){return _0xa1f3c4[_0xfe50('0xa')]('VoiceDialReport',attributes,{'tableName':_0xfe50('0xb'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xadc5=['uniqueid','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial'];(function(_0x5cabfd,_0x5dea47){var _0x4bc06c=function(_0x4a2fea){while(--_0x4a2fea){_0x5cabfd['push'](_0x5cabfd['shift']());}};_0x4bc06c(++_0x5dea47);}(_0xadc5,0x1bd));var _0x5adc=function(_0x5aad77,_0x1fca34){_0x5aad77=_0x5aad77-0x0;var _0x336005=_0xadc5[_0x5aad77];return _0x336005;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5adc('0x0'))(_0x5adc('0x1'));var moment=require(_0x5adc('0x2'));var BPromise=require(_0x5adc('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5adc('0x4'));var config=require(_0x5adc('0x5'));var attributes=require(_0x5adc('0x6'));module[_0x5adc('0x7')]=function(_0x68a90d,_0x2deac9){return _0x68a90d[_0x5adc('0x8')](_0x5adc('0x9'),attributes,{'tableName':_0x5adc('0xa'),'paranoid':![],'indexes':[{'fields':[_0x5adc('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index a74c17c..81e15d1 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 _0x3cd6=['then','info','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','VoiceDialReport,\x20%s,\x20%s','message','result','catch','CreateVoiceDialReport','VoiceDialReport','create','body','options','raw','UpdateVoiceDialReport','where','attributes','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http'];(function(_0x56792c,_0x2953de){var _0x30f462=function(_0x21cabd){while(--_0x21cabd){_0x56792c['push'](_0x56792c['shift']());}};_0x30f462(++_0x2953de);}(_0x3cd6,0x104));var _0x63cd=function(_0x1e9621,_0x149377){_0x1e9621=_0x1e9621-0x0;var _0x1dd7f4=_0x3cd6[_0x1e9621];return _0x1dd7f4;};'use strict';var _=require('lodash');var util=require(_0x63cd('0x0'));var moment=require(_0x63cd('0x1'));var BPromise=require(_0x63cd('0x2'));var rs=require(_0x63cd('0x3'));var fs=require('fs');var Redis=require(_0x63cd('0x4'));var db=require(_0x63cd('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x63cd('0x6'));var jayson=require(_0x63cd('0x7'));var client=jayson[_0x63cd('0x8')][_0x63cd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4b2a40,_0x92785f,_0x336924){return new BPromise(function(_0xc6dbdd,_0x3f726d){return client['request'](_0x4b2a40,_0x336924)[_0x63cd('0xa')](function(_0x111667){logger[_0x63cd('0xb')]('VoiceDialReport,\x20%s,\x20%s',_0x92785f,'request\x20sent');logger[_0x63cd('0xc')](_0x63cd('0xd'),_0x92785f,_0x63cd('0xe'),JSON[_0x63cd('0xf')](_0x111667));if(_0x111667['error']){if(_0x111667[_0x63cd('0x10')]['code']===0x1f4){logger[_0x63cd('0x10')](_0x63cd('0x11'),_0x92785f,_0x111667[_0x63cd('0x10')]['message']);return _0x3f726d(_0x111667[_0x63cd('0x10')]['message']);}logger[_0x63cd('0x10')](_0x63cd('0x11'),_0x92785f,_0x111667[_0x63cd('0x10')]['message']);return _0xc6dbdd(_0x111667['error'][_0x63cd('0x12')]);}else{logger[_0x63cd('0xb')](_0x63cd('0x11'),_0x92785f,_0x63cd('0xe'));_0xc6dbdd(_0x111667[_0x63cd('0x13')]['message']);}})[_0x63cd('0x14')](function(_0x2bc7ac){logger['error'](_0x63cd('0x11'),_0x92785f,_0x2bc7ac);_0x3f726d(_0x2bc7ac);});});}exports[_0x63cd('0x15')]=function(_0x3822a9){var _0x4fc7f5=this;return new Promise(function(_0x1baa79,_0x422799){return db[_0x63cd('0x16')][_0x63cd('0x17')](_0x3822a9[_0x63cd('0x18')],{'raw':_0x3822a9[_0x63cd('0x19')]?_0x3822a9[_0x63cd('0x19')][_0x63cd('0x1a')]===undefined?!![]:![]:!![]})[_0x63cd('0xa')](function(_0xa2dd0){logger[_0x63cd('0xb')]('CreateVoiceDialReport',_0x3822a9);logger[_0x63cd('0xc')](_0x63cd('0x15'),_0x3822a9,JSON[_0x63cd('0xf')](_0xa2dd0));_0x1baa79(_0xa2dd0);})[_0x63cd('0x14')](function(_0x3685df){logger[_0x63cd('0x10')](_0x63cd('0x15'),_0x3685df[_0x63cd('0x12')],_0x3822a9);_0x422799(_0x4fc7f5[_0x63cd('0x10')](0x1f4,_0x3685df[_0x63cd('0x12')]));});});};exports[_0x63cd('0x1b')]=function(_0x39b704){var _0x433c95=this;return new Promise(function(_0x4b5fa4,_0x297a91){return db[_0x63cd('0x16')]['update'](_0x39b704[_0x63cd('0x18')],{'raw':_0x39b704[_0x63cd('0x19')]?_0x39b704['options'][_0x63cd('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x39b704['options']?_0x39b704['options'][_0x63cd('0x1c')]||null:null,'attributes':_0x39b704[_0x63cd('0x19')]?_0x39b704[_0x63cd('0x19')][_0x63cd('0x1d')]||null:null,'limit':_0x39b704[_0x63cd('0x19')]?_0x39b704[_0x63cd('0x19')]['limit']||null:null})[_0x63cd('0xa')](function(_0x5cf049){logger['info'](_0x63cd('0x1b'),_0x39b704);logger[_0x63cd('0xc')](_0x63cd('0x1b'),_0x39b704,JSON[_0x63cd('0xf')](_0x5cf049));_0x4b5fa4(_0x5cf049);})[_0x63cd('0x14')](function(_0x547202){logger[_0x63cd('0x10')]('UpdateVoiceDialReport',_0x547202[_0x63cd('0x12')],_0x39b704);_0x297a91(_0x433c95[_0x63cd('0x10')](0x1f4,_0x547202[_0x63cd('0x12')]));});});}; \ No newline at end of file +var _0x051e=['VoiceDialReport','update','where','attributes','UpdateVoiceDialReport','stringify','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','request','then','info','request\x20sent','debug','code','VoiceDialReport,\x20%s,\x20%s','error','message','result','catch','CreateVoiceDialReport','body','options','raw'];(function(_0x954b3a,_0x10a7c1){var _0x3a313e=function(_0x1070ad){while(--_0x1070ad){_0x954b3a['push'](_0x954b3a['shift']());}};_0x3a313e(++_0x10a7c1);}(_0x051e,0x1e6));var _0xe051=function(_0x334cbe,_0x298828){_0x334cbe=_0x334cbe-0x0;var _0x47ab22=_0x051e[_0x334cbe];return _0x47ab22;};'use strict';var _=require('lodash');var util=require(_0xe051('0x0'));var moment=require(_0xe051('0x1'));var BPromise=require(_0xe051('0x2'));var rs=require(_0xe051('0x3'));var fs=require('fs');var Redis=require(_0xe051('0x4'));var db=require(_0xe051('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe051('0x6'))('rpc');var config=require(_0xe051('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe051('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c39b3,_0x416355,_0x3322a4){return new BPromise(function(_0x1efc31,_0x27d0b5){return client[_0xe051('0x9')](_0x3c39b3,_0x3322a4)[_0xe051('0xa')](function(_0xbff962){logger[_0xe051('0xb')]('VoiceDialReport,\x20%s,\x20%s',_0x416355,_0xe051('0xc'));logger[_0xe051('0xd')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x416355,'request\x20sent',JSON['stringify'](_0xbff962));if(_0xbff962['error']){if(_0xbff962['error'][_0xe051('0xe')]===0x1f4){logger['error'](_0xe051('0xf'),_0x416355,_0xbff962[_0xe051('0x10')][_0xe051('0x11')]);return _0x27d0b5(_0xbff962[_0xe051('0x10')]['message']);}logger['error'](_0xe051('0xf'),_0x416355,_0xbff962[_0xe051('0x10')][_0xe051('0x11')]);return _0x1efc31(_0xbff962[_0xe051('0x10')]['message']);}else{logger[_0xe051('0xb')]('VoiceDialReport,\x20%s,\x20%s',_0x416355,'request\x20sent');_0x1efc31(_0xbff962[_0xe051('0x12')]['message']);}})[_0xe051('0x13')](function(_0x154d8d){logger[_0xe051('0x10')](_0xe051('0xf'),_0x416355,_0x154d8d);_0x27d0b5(_0x154d8d);});});}exports[_0xe051('0x14')]=function(_0x3106de){var _0x3786d7=this;return new Promise(function(_0x480cfa,_0x593628){return db['VoiceDialReport']['create'](_0x3106de[_0xe051('0x15')],{'raw':_0x3106de[_0xe051('0x16')]?_0x3106de[_0xe051('0x16')][_0xe051('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x99fec0){logger[_0xe051('0xb')](_0xe051('0x14'),_0x3106de);logger[_0xe051('0xd')]('CreateVoiceDialReport',_0x3106de,JSON['stringify'](_0x99fec0));_0x480cfa(_0x99fec0);})['catch'](function(_0x441748){logger['error'](_0xe051('0x14'),_0x441748['message'],_0x3106de);_0x593628(_0x3786d7[_0xe051('0x10')](0x1f4,_0x441748['message']));});});};exports['UpdateVoiceDialReport']=function(_0xc39d59){var _0x133b9c=this;return new Promise(function(_0x100538,_0x377ba1){return db[_0xe051('0x18')][_0xe051('0x19')](_0xc39d59[_0xe051('0x15')],{'raw':_0xc39d59[_0xe051('0x16')]?_0xc39d59[_0xe051('0x16')][_0xe051('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xc39d59[_0xe051('0x16')]?_0xc39d59[_0xe051('0x16')][_0xe051('0x1a')]||null:null,'attributes':_0xc39d59[_0xe051('0x16')]?_0xc39d59[_0xe051('0x16')][_0xe051('0x1b')]||null:null,'limit':_0xc39d59['options']?_0xc39d59[_0xe051('0x16')]['limit']||null:null})['then'](function(_0x2251fb){logger['info']('UpdateVoiceDialReport',_0xc39d59);logger[_0xe051('0xd')](_0xe051('0x1c'),_0xc39d59,JSON[_0xe051('0x1d')](_0x2251fb));_0x100538(_0x2251fb);})['catch'](function(_0x31f9d4){logger[_0xe051('0x10')](_0xe051('0x1c'),_0x31f9d4['message'],_0xc39d59);_0x377ba1(_0x133b9c['error'](0x1f4,_0x31f9d4[_0xe051('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 7252ef9..dcfc5e4 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 _0x5b39=['get','isAuthenticated','index','/:id','show','post','create','/:id/applications','addApplications','put','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./voiceExtension.controller'];(function(_0x4a2c8f,_0xea2882){var _0x2aeb38=function(_0x3b7372){while(--_0x3b7372){_0x4a2c8f['push'](_0x4a2c8f['shift']());}};_0x2aeb38(++_0xea2882);}(_0x5b39,0xfc));var _0x95b3=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x5b39[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require(_0x95b3('0x0'));var util=require('util');var path=require(_0x95b3('0x1'));var timeout=require(_0x95b3('0x2'));var express=require(_0x95b3('0x3'));var router=express[_0x95b3('0x4')]();var fs_extra=require(_0x95b3('0x5'));var auth=require(_0x95b3('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x95b3('0x7'));router[_0x95b3('0x8')]('/',auth[_0x95b3('0x9')](),controller[_0x95b3('0xa')]);router[_0x95b3('0x8')](_0x95b3('0xb'),auth['isAuthenticated'](),controller[_0x95b3('0xc')]);router[_0x95b3('0xd')]('/',auth[_0x95b3('0x9')](),controller[_0x95b3('0xe')]);router[_0x95b3('0xd')](_0x95b3('0xf'),auth[_0x95b3('0x9')](),controller[_0x95b3('0x10')]);router[_0x95b3('0x11')](_0x95b3('0xb'),auth[_0x95b3('0x9')](),controller['update']);router[_0x95b3('0x12')](_0x95b3('0xb'),auth['isAuthenticated'](),controller[_0x95b3('0x13')]);module['exports']=router; \ No newline at end of file +var _0x44bd=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','index','/:id','isAuthenticated','show','post','create','/:id/applications','put','delete','destroy','exports','multer','util','path'];(function(_0x4432f2,_0x22697a){var _0x1c97d6=function(_0x1ab5df){while(--_0x1ab5df){_0x4432f2['push'](_0x4432f2['shift']());}};_0x1c97d6(++_0x22697a);}(_0x44bd,0x15d));var _0xd44b=function(_0x30bed8,_0x3d7980){_0x30bed8=_0x30bed8-0x0;var _0x53d3c4=_0x44bd[_0x30bed8];return _0x53d3c4;};'use strict';var multer=require(_0xd44b('0x0'));var util=require(_0xd44b('0x1'));var path=require(_0xd44b('0x2'));var timeout=require(_0xd44b('0x3'));var express=require(_0xd44b('0x4'));var router=express[_0xd44b('0x5')]();var fs_extra=require(_0xd44b('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xd44b('0x7'));var config=require(_0xd44b('0x8'));var controller=require(_0xd44b('0x9'));router[_0xd44b('0xa')]('/',auth['isAuthenticated'](),controller[_0xd44b('0xb')]);router[_0xd44b('0xa')](_0xd44b('0xc'),auth[_0xd44b('0xd')](),controller[_0xd44b('0xe')]);router[_0xd44b('0xf')]('/',auth[_0xd44b('0xd')](),controller[_0xd44b('0x10')]);router[_0xd44b('0xf')](_0xd44b('0x11'),auth[_0xd44b('0xd')](),controller['addApplications']);router[_0xd44b('0x12')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xd44b('0x13')](_0xd44b('0xc'),auth[_0xd44b('0xd')](),controller[_0xd44b('0x14')]);module[_0xd44b('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index fa3c5f2..1d0385c 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 _0x8e96=['STRING','compositeIndex','NoOp','ENUM','inbound','outbound','internal','system','any','BOOLEAN','INTEGER','wav','VIRTUAL','getDataValue','exten','sequelize','exports'];(function(_0x21bc27,_0x20c9da){var _0x56790c=function(_0x4ee4a3){while(--_0x4ee4a3){_0x21bc27['push'](_0x21bc27['shift']());}};_0x56790c(++_0x20c9da);}(_0x8e96,0x1c9));var _0x68e9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8e96[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x68e9('0x0'));module[_0x68e9('0x1')]={'context':{'type':Sequelize[_0x68e9('0x2')],'allowNull':![],'unique':_0x68e9('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x68e9('0x3')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0x68e9('0x3')},'tag':{'type':Sequelize[_0x68e9('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x68e9('0x2')],'allowNull':![],'defaultValue':_0x68e9('0x4')},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x68e9('0x5')](_0x68e9('0x6'),_0x68e9('0x7'),_0x68e9('0x8'),'inbound-fax','outbound-fax',_0x68e9('0x9'),_0x68e9('0xa')),'allowNull':![]},'description':{'type':Sequelize[_0x68e9('0x2')]},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'*,*,*,*'},'IntervalId':{'type':Sequelize['INTEGER']},'isApp':{'type':Sequelize[_0x68e9('0xb')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x68e9('0x2')],'defaultValue':null},'callerID':{'type':Sequelize['STRING'],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x68e9('0xc')]},'recordingFormat':{'type':Sequelize[_0x68e9('0x2')],'defaultValue':_0x68e9('0xd')},'answer':{'type':Sequelize[_0x68e9('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0x68e9('0xe')],'get':function(_0x47e5c3){return this[_0x68e9('0xf')](_0x68e9('0x10'));}},'alias':{'type':Sequelize[_0x68e9('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0xd981=['inbound','internal','outbound-fax','system','any','*,*,*,*','BOOLEAN','getDataValue','exten','exports','STRING','compositeIndex','NoOp'];(function(_0x52bc53,_0x29d09d){var _0x36d12b=function(_0x1cd325){while(--_0x1cd325){_0x52bc53['push'](_0x52bc53['shift']());}};_0x36d12b(++_0x29d09d);}(_0xd981,0x1c3));var _0x1d98=function(_0x83ea1,_0x36b361){_0x83ea1=_0x83ea1-0x0;var _0x2ee9c8=_0xd981[_0x83ea1];return _0x2ee9c8;};'use strict';var Sequelize=require('sequelize');module[_0x1d98('0x0')]={'context':{'type':Sequelize[_0x1d98('0x1')],'allowNull':![],'unique':_0x1d98('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x1d98('0x1')],'allowNull':![],'unique':'compositeIndex'},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0x1d98('0x1')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x1d98('0x3')},'appdata':{'type':Sequelize[_0x1d98('0x1')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x1d98('0x4'),'outbound',_0x1d98('0x5'),'inbound-fax',_0x1d98('0x6'),_0x1d98('0x7'),_0x1d98('0x8')),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x1d98('0x1')],'allowNull':![],'defaultValue':_0x1d98('0x9')},'IntervalId':{'type':Sequelize['INTEGER']},'isApp':{'type':Sequelize[_0x1d98('0xa')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize['STRING'],'defaultValue':null},'callerID':{'type':Sequelize[_0x1d98('0x1')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize[_0x1d98('0x1')],'defaultValue':'wav'},'answer':{'type':Sequelize[_0x1d98('0xa')],'defaultValue':!![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(_0xf9efa5){return this[_0x1d98('0xb')](_0x1d98('0xc'));}},'alias':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 44bfd1e..7b6ddb6 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 _0x2277=['mandatoryDisposition','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','VoiceExtensionId','isApp','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','lodash','ioredis','../../config/environment','../../mysqldb','redis','defaults','localhost','./voiceExtension.socket','sendStatus','status','end','undefined','limit','count','offset','set','json','destroy','then','get','InboundRoutes','inbound','outbound','InternalRoutes','internal','ignore','map','value','type','find','UserProfileResource','error','stack','name','send','index','VoiceExtension','rawAttributes','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','create','exten','body','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OutboundRoutes','UserProfileSection','autoAssociation','update','pick','context','description','recordingFormat','cutdigits'];(function(_0x2af30e,_0xafdbd7){var _0x33e64f=function(_0x5c977f){while(--_0x5c977f){_0x2af30e['push'](_0x2af30e['shift']());}};_0x33e64f(++_0xafdbd7);}(_0x2277,0x1d4));var _0x7227=function(_0x20f01b,_0x4569d0){_0x20f01b=_0x20f01b-0x0;var _0x16c300=_0x2277[_0x20f01b];return _0x16c300;};'use strict';var _=require(_0x7227('0x0'));var Redis=require(_0x7227('0x1'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')('api');var config=require(_0x7227('0x2'));var db=require(_0x7227('0x3'))['db'];config[_0x7227('0x4')]=_[_0x7227('0x5')](config[_0x7227('0x4')],{'host':_0x7227('0x6'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7227('0x4')]));require(_0x7227('0x7'))['register'](socket);function respondWithStatusCode(_0x3a2cab,_0x557fab){_0x557fab=_0x557fab||0xcc;return function(_0x4d01c7){if(_0x4d01c7){return _0x3a2cab[_0x7227('0x8')](_0x557fab);}return _0x3a2cab[_0x7227('0x9')](_0x557fab)[_0x7227('0xa')]();};}function respondWithResult(_0xe1a9d5,_0x425198){_0x425198=_0x425198||0xc8;return function(_0x47e964){if(_0x47e964){return _0xe1a9d5[_0x7227('0x9')](_0x425198)['json'](_0x47e964);}};}function respondWithFilteredResult(_0x5522e7,_0x65a197){return function(_0x6cf4cd){if(_0x6cf4cd){var _0x4c743a=typeof _0x65a197['offset']===_0x7227('0xb')&&typeof _0x65a197[_0x7227('0xc')]===_0x7227('0xb');var _0x24edce=_0x6cf4cd[_0x7227('0xd')];var _0x1b603d=_0x4c743a?0x0:_0x65a197[_0x7227('0xe')];var _0x3f2d00=_0x4c743a?_0x6cf4cd[_0x7227('0xd')]:_0x65a197[_0x7227('0xe')]+_0x65a197[_0x7227('0xc')];var _0xc8f74a;if(_0x3f2d00>=_0x24edce){_0x3f2d00=_0x24edce;_0xc8f74a=0xc8;}else{_0xc8f74a=0xce;}_0x5522e7['status'](_0xc8f74a);return _0x5522e7[_0x7227('0xf')]('Content-Range',_0x1b603d+'-'+_0x3f2d00+'/'+_0x24edce)[_0x7227('0x10')](_0x6cf4cd);}return null;};}function removeEntity(_0x455a86){return function(_0x582acd){if(_0x582acd){return _0x582acd[_0x7227('0x11')]()[_0x7227('0x12')](function(){var _0x58b703=_0x582acd[_0x7227('0x13')]({'plain':!![]});var _0x10138c=[{'name':_0x7227('0x14'),'value':_0x7227('0x15'),'ignore':![]},{'name':'OutboundRoutes','value':_0x7227('0x16'),'ignore':![]},{'name':_0x7227('0x17'),'value':_0x7227('0x18'),'ignore':![]}];var _0x32915b=_(_0x10138c)['filter'](_0x7227('0x19'))[_0x7227('0x1a')](_0x7227('0x1b'))[_0x7227('0x1b')]();if(_['includes'](_0x32915b,_0x58b703[_0x7227('0x1c')])){return;}var _0x4f1be1=_[_0x7227('0x1d')](_0x10138c,[_0x7227('0x1b'),_0x58b703['type']])['name'];return db[_0x7227('0x1e')][_0x7227('0x11')]({'where':{'type':_0x4f1be1,'resourceId':_0x58b703['id']}})[_0x7227('0x12')](function(){return _0x582acd;});})['then'](function(){_0x455a86['status'](0xcc)[_0x7227('0xa')]();});}};}function handleEntityNotFound(_0x20bb8f){return function(_0x36b616){if(!_0x36b616){_0x20bb8f[_0x7227('0x8')](0x194);}return _0x36b616;};}function handleError(_0x381dd1,_0x2fa5ba){_0x2fa5ba=_0x2fa5ba||0x1f4;return function(_0x5bf982){logger[_0x7227('0x1f')](_0x5bf982[_0x7227('0x20')]);if(_0x5bf982[_0x7227('0x21')]){delete _0x5bf982[_0x7227('0x21')];}_0x381dd1['status'](_0x2fa5ba)[_0x7227('0x22')](_0x5bf982);};}exports[_0x7227('0x23')]=function(_0x326e72,_0xc1678b){var _0x1c37a1={},_0x578855={},_0x2e8465={'count':0x0,'rows':[]};var _0x2407eb=_[_0x7227('0x1a')](db[_0x7227('0x24')][_0x7227('0x25')],function(_0x37f6ec){return{'name':_0x37f6ec['fieldName'],'type':_0x37f6ec[_0x7227('0x1c')][_0x7227('0x26')]};});_0x578855['model']=_[_0x7227('0x1a')](_0x2407eb,_0x7227('0x21'));_0x578855[_0x7227('0x27')]=_[_0x7227('0x28')](_0x326e72['query']);_0x578855[_0x7227('0x29')]=_[_0x7227('0x2a')](_0x578855['model'],_0x578855[_0x7227('0x27')]);_0x1c37a1[_0x7227('0x2b')]=_[_0x7227('0x2a')](_0x578855[_0x7227('0x2c')],qs['fields'](_0x326e72[_0x7227('0x27')][_0x7227('0x2d')]));_0x1c37a1[_0x7227('0x2b')]=_0x1c37a1[_0x7227('0x2b')][_0x7227('0x2e')]?_0x1c37a1['attributes']:_0x578855[_0x7227('0x2c')];if(!_0x326e72['query'][_0x7227('0x2f')](_0x7227('0x30'))){_0x1c37a1[_0x7227('0xc')]=qs[_0x7227('0xc')](_0x326e72['query'][_0x7227('0xc')]);_0x1c37a1['offset']=qs[_0x7227('0xe')](_0x326e72[_0x7227('0x27')][_0x7227('0xe')]);}_0x1c37a1[_0x7227('0x31')]=qs['sort'](_0x326e72[_0x7227('0x27')][_0x7227('0x32')]);_0x1c37a1[_0x7227('0x33')]=qs[_0x7227('0x29')](_['pick'](_0x326e72['query'],_0x578855[_0x7227('0x29')]),_0x2407eb);if(_0x326e72[_0x7227('0x27')][_0x7227('0x34')]){_0x1c37a1[_0x7227('0x33')]=_['merge'](_0x1c37a1['where'],{'$or':_[_0x7227('0x1a')](_0x2407eb,function(_0x535246){if(_0x535246[_0x7227('0x1c')]!==_0x7227('0x35')){var _0x1cbf46={};_0x1cbf46[_0x535246[_0x7227('0x21')]]={'$like':'%'+_0x326e72['query'][_0x7227('0x34')]+'%'};return _0x1cbf46;}})});}_0x1c37a1=_[_0x7227('0x36')]({},_0x1c37a1,_0x326e72[_0x7227('0x37')]);var _0x3ae008={'where':_0x1c37a1[_0x7227('0x33')]};return db[_0x7227('0x24')][_0x7227('0xd')](_0x3ae008)[_0x7227('0x12')](function(_0x12dee9){_0x2e8465[_0x7227('0xd')]=_0x12dee9;if(_0x326e72['query']['includeAll']){_0x1c37a1[_0x7227('0x38')]=[{'all':!![]}];}return db[_0x7227('0x24')][_0x7227('0x39')](_0x1c37a1);})[_0x7227('0x12')](function(_0x253601){_0x2e8465[_0x7227('0x3a')]=_0x253601;return _0x2e8465;})[_0x7227('0x12')](respondWithFilteredResult(_0xc1678b,_0x1c37a1))[_0x7227('0x3b')](handleError(_0xc1678b,null));};exports[_0x7227('0x3c')]=function(_0xe608e,_0x1297e4){var _0xb26e99={'raw':![],'where':{'id':_0xe608e[_0x7227('0x3d')]['id']}},_0x296533={};_0x296533['model']=_[_0x7227('0x28')](db[_0x7227('0x24')]['rawAttributes']);_0x296533[_0x7227('0x27')]=_['keys'](_0xe608e['query']);_0x296533[_0x7227('0x29')]=_[_0x7227('0x2a')](_0x296533['model'],_0x296533[_0x7227('0x27')]);_0xb26e99[_0x7227('0x2b')]=_[_0x7227('0x2a')](_0x296533[_0x7227('0x2c')],qs[_0x7227('0x2d')](_0xe608e['query'][_0x7227('0x2d')]));_0xb26e99[_0x7227('0x2b')]=_0xb26e99[_0x7227('0x2b')][_0x7227('0x2e')]?_0xb26e99[_0x7227('0x2b')]:_0x296533[_0x7227('0x2c')];if(_0xe608e['query']['includeAll']){_0xb26e99[_0x7227('0x38')]=[{'all':!![]}];}_0xb26e99=_[_0x7227('0x36')]({},_0xb26e99,_0xe608e[_0x7227('0x37')]);return db[_0x7227('0x24')][_0x7227('0x1d')](_0xb26e99)[_0x7227('0x12')](handleEntityNotFound(_0x1297e4,null))[_0x7227('0x12')](respondWithResult(_0x1297e4,null))[_0x7227('0x3b')](handleError(_0x1297e4,null));};exports['destroy']=function(_0x5a4926,_0x4c56ad){return db['VoiceExtension']['find']({'where':{'id':_0x5a4926[_0x7227('0x3d')]['id']}})['then'](handleEntityNotFound(_0x4c56ad,null))['then'](removeEntity(_0x4c56ad,null))['catch'](handleError(_0x4c56ad,null));};exports[_0x7227('0x3e')]=function(_0x1d7400,_0x501abb){if(_0x1d7400['body'][_0x7227('0x1c')]===_0x7227('0x16')&&!_['startsWith'](_0x1d7400['body'][_0x7227('0x3f')],'_')){_0x1d7400[_0x7227('0x40')][_0x7227('0x3f')]='_'[_0x7227('0x41')](_0x1d7400['body'][_0x7227('0x3f')]);}return db[_0x7227('0x24')]['create'](_0x1d7400[_0x7227('0x40')],{'raw':![]})['then'](function(_0x4e59a4){var _0x522796=_0x1d7400[_0x7227('0x42')]['get']({'plain':!![]});if(!_0x522796)throw new Error(_0x7227('0x43'));if(_0x522796[_0x7227('0x44')]===_0x7227('0x42')){var _0x2fb20f=_0x4e59a4[_0x7227('0x13')]({'plain':!![]});var _0xe8d66f=[{'name':'InboundRoutes','value':_0x7227('0x15')},{'name':_0x7227('0x45'),'value':_0x7227('0x16')},{'name':_0x7227('0x17'),'value':_0x7227('0x18')}];var _0x5306cd=_[_0x7227('0x1d')](_0xe8d66f,[_0x7227('0x1b'),_0x2fb20f[_0x7227('0x1c')]])[_0x7227('0x21')];return db[_0x7227('0x46')][_0x7227('0x1d')]({'where':{'name':_0x5306cd,'userProfileId':_0x522796['userProfileId']},'raw':!![]})[_0x7227('0x12')](function(_0x3d86c6){if(_0x3d86c6&&_0x3d86c6[_0x7227('0x47')]===0x0){return db[_0x7227('0x1e')][_0x7227('0x3e')]({'name':_0x2fb20f[_0x7227('0x21')],'resourceId':_0x2fb20f['id'],'type':_0x3d86c6['name'],'sectionId':_0x3d86c6['id']},{})[_0x7227('0x12')](function(){return _0x4e59a4;});}else{return _0x4e59a4;}})[_0x7227('0x3b')](function(_0x12442b){logger[_0x7227('0x1f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x12442b);throw _0x12442b;});}return _0x4e59a4;})[_0x7227('0x12')](respondWithResult(_0x501abb,0xc9))['catch'](handleError(_0x501abb,null));};exports[_0x7227('0x48')]=function(_0x1ca0f3,_0x20f723){if(_0x1ca0f3[_0x7227('0x40')]['id']){delete _0x1ca0f3[_0x7227('0x40')]['id'];}return db[_0x7227('0x24')]['find']({'where':{'id':_0x1ca0f3[_0x7227('0x3d')]['id']}})[_0x7227('0x12')](handleEntityNotFound(_0x20f723,null))[_0x7227('0x12')](function(_0x52a9a9){if(_0x52a9a9){return db[_0x7227('0x24')][_0x7227('0x48')](_[_0x7227('0x49')](_0x1ca0f3[_0x7227('0x40')],['exten',_0x7227('0x4a'),_0x7227('0x4b'),_0x7227('0x4c'),_0x7227('0x4d'),_0x7227('0x4e'),'alias']),{'where':{'context':_0x52a9a9[_0x7227('0x4a')],'exten':_0x52a9a9[_0x7227('0x3f')]},'individualHooks':!![]})[_0x7227('0x12')](function(_0x56b0a3){return _0x56b0a3;});}return null;})[_0x7227('0x12')](respondWithStatusCode(_0x20f723,null))[_0x7227('0x3b')](handleError(_0x20f723,null));};exports[_0x7227('0x4f')]=function(_0x17d262,_0x2108ff){var _0x2df15f=_0x17d262['params']['id'];var _0x2788e0=_0x17d262[_0x7227('0x40')];var _0x3bfe60=0xc8;var _0x311329=null;return db[_0x7227('0x50')][_0x7227('0x51')]({'isolationLevel':db[_0x7227('0x50')][_0x7227('0x52')][_0x7227('0x53')][_0x7227('0x54')]},function(_0xb634c4){return db[_0x7227('0x24')][_0x7227('0x55')]({'where':{'id':_0x2df15f},'transaction':_0xb634c4})['then'](function(_0x5e8ed6){if(_0x5e8ed6){return db[_0x7227('0x24')][_0x7227('0x11')]({'where':{'VoiceExtensionId':_0x2df15f},'transaction':_0xb634c4})[_0x7227('0x12')](function(){var _0x4c7193=_['map'](_0x2788e0,function(_0x37420f){_0x37420f[_0x7227('0x56')]=_0x2df15f;_0x37420f[_0x7227('0x57')]=!![];return _0x37420f;});return _0x5e8ed6['createRouting'](_0x4c7193);})[_0x7227('0x12')](function(_0x3d9a02){return db['VoiceExtension'][_0x7227('0x58')](_0x3d9a02,{'transaction':_0xb634c4});});}else{_0x3bfe60=0x194;_0x311329=[];}});})[_0x7227('0x12')](function(){if(_0x3bfe60!==0x194){return db[_0x7227('0x24')][_0x7227('0x59')]({'where':{'isApp':!![],'VoiceExtensionId':_0x2df15f},'order':_0x7227('0x5a')})[_0x7227('0x12')](function(_0x271e9c){_0x311329=_0x271e9c;});}})[_0x7227('0x3b')](function(_0x2f8aa4){_0x3bfe60=0x1f4;logger[_0x7227('0x1f')](_0x2f8aa4['stack']);if(_0x2f8aa4['name']){delete _0x2f8aa4[_0x7227('0x21')];}_0x311329=_0x2f8aa4;})['finally'](function(){if(_0x311329===null){_0x2108ff[_0x7227('0x8')](_0x3bfe60);}else{if(_0x3bfe60===0x1f4){_0x2108ff[_0x7227('0x9')](_0x3bfe60)[_0x7227('0x22')](_0x311329);}else{_0x2108ff[_0x7227('0x9')](_0x3bfe60)[_0x7227('0x10')](_0x311329);}}});}; \ No newline at end of file +var _0x3979=['Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','VoiceExtensionId','isApp','createRouting','cast(priority\x20as\x20unsigned)','lodash','ioredis','../../components/parsers/qs','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','destroy','then','get','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','internal','filter','ignore','map','value','type','find','name','UserProfileResource','error','stack','send','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','VoiceExtension','includeAll','rows','show','params','include','catch','create','body','startsWith','exten','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','description','recordingFormat','cutdigits','addApplications','sequelize','transaction'];(function(_0x44268d,_0xad8443){var _0x4be92d=function(_0x8a57ff){while(--_0x8a57ff){_0x44268d['push'](_0x44268d['shift']());}};_0x4be92d(++_0xad8443);}(_0x3979,0x64));var _0x9397=function(_0x2cd4bf,_0xc969c8){_0x2cd4bf=_0x2cd4bf-0x0;var _0x492901=_0x3979[_0x2cd4bf];return _0x492901;};'use strict';var _=require(_0x9397('0x0'));var Redis=require(_0x9397('0x1'));var qs=require(_0x9397('0x2'));var logger=require('../../config/logger')(_0x9397('0x3'));var config=require(_0x9397('0x4'));var db=require('../../mysqldb')['db'];config[_0x9397('0x5')]=_[_0x9397('0x6')](config[_0x9397('0x5')],{'host':_0x9397('0x7'),'port':0x18eb});var socket=require(_0x9397('0x8'))(new Redis(config[_0x9397('0x5')]));require('./voiceExtension.socket')['register'](socket);function respondWithStatusCode(_0x57c78c,_0x186501){_0x186501=_0x186501||0xcc;return function(_0x350ed1){if(_0x350ed1){return _0x57c78c[_0x9397('0x9')](_0x186501);}return _0x57c78c[_0x9397('0xa')](_0x186501)[_0x9397('0xb')]();};}function respondWithResult(_0x4075fb,_0x591f7d){_0x591f7d=_0x591f7d||0xc8;return function(_0xc82478){if(_0xc82478){return _0x4075fb[_0x9397('0xa')](_0x591f7d)['json'](_0xc82478);}};}function respondWithFilteredResult(_0x1a98ed,_0x4944d6){return function(_0x22fd90){if(_0x22fd90){var _0x5c6a9d=typeof _0x4944d6[_0x9397('0xc')]===_0x9397('0xd')&&typeof _0x4944d6[_0x9397('0xe')]==='undefined';var _0x1ae016=_0x22fd90[_0x9397('0xf')];var _0x5cf77f=_0x5c6a9d?0x0:_0x4944d6['offset'];var _0x4c183e=_0x5c6a9d?_0x22fd90[_0x9397('0xf')]:_0x4944d6['offset']+_0x4944d6['limit'];var _0x389993;if(_0x4c183e>=_0x1ae016){_0x4c183e=_0x1ae016;_0x389993=0xc8;}else{_0x389993=0xce;}_0x1a98ed[_0x9397('0xa')](_0x389993);return _0x1a98ed[_0x9397('0x10')](_0x9397('0x11'),_0x5cf77f+'-'+_0x4c183e+'/'+_0x1ae016)['json'](_0x22fd90);}return null;};}function removeEntity(_0xa4e2a5){return function(_0x520ef0){if(_0x520ef0){return _0x520ef0[_0x9397('0x12')]()[_0x9397('0x13')](function(){var _0xed3a80=_0x520ef0[_0x9397('0x14')]({'plain':!![]});var _0x184db1=[{'name':_0x9397('0x15'),'value':_0x9397('0x16'),'ignore':![]},{'name':_0x9397('0x17'),'value':_0x9397('0x18'),'ignore':![]},{'name':_0x9397('0x19'),'value':_0x9397('0x1a'),'ignore':![]}];var _0x30123d=_(_0x184db1)[_0x9397('0x1b')](_0x9397('0x1c'))[_0x9397('0x1d')](_0x9397('0x1e'))[_0x9397('0x1e')]();if(_['includes'](_0x30123d,_0xed3a80[_0x9397('0x1f')])){return;}var _0x1cedb5=_[_0x9397('0x20')](_0x184db1,[_0x9397('0x1e'),_0xed3a80[_0x9397('0x1f')]])[_0x9397('0x21')];return db[_0x9397('0x22')][_0x9397('0x12')]({'where':{'type':_0x1cedb5,'resourceId':_0xed3a80['id']}})['then'](function(){return _0x520ef0;});})[_0x9397('0x13')](function(){_0xa4e2a5[_0x9397('0xa')](0xcc)[_0x9397('0xb')]();});}};}function handleEntityNotFound(_0x19d8ba){return function(_0x50b79b){if(!_0x50b79b){_0x19d8ba['sendStatus'](0x194);}return _0x50b79b;};}function handleError(_0x207a23,_0x5d948b){_0x5d948b=_0x5d948b||0x1f4;return function(_0x18a040){logger[_0x9397('0x23')](_0x18a040[_0x9397('0x24')]);if(_0x18a040[_0x9397('0x21')]){delete _0x18a040[_0x9397('0x21')];}_0x207a23[_0x9397('0xa')](_0x5d948b)[_0x9397('0x25')](_0x18a040);};}exports['index']=function(_0x55797a,_0x288205){var _0x4166c5={},_0x33011d={},_0x36dd73={'count':0x0,'rows':[]};var _0x49ede5=_[_0x9397('0x1d')](db['VoiceExtension'][_0x9397('0x26')],function(_0x11ce44){return{'name':_0x11ce44[_0x9397('0x27')],'type':_0x11ce44['type'][_0x9397('0x28')]};});_0x33011d[_0x9397('0x29')]=_['map'](_0x49ede5,'name');_0x33011d[_0x9397('0x2a')]=_[_0x9397('0x2b')](_0x55797a['query']);_0x33011d[_0x9397('0x2c')]=_['intersection'](_0x33011d[_0x9397('0x29')],_0x33011d[_0x9397('0x2a')]);_0x4166c5[_0x9397('0x2d')]=_[_0x9397('0x2e')](_0x33011d['model'],qs[_0x9397('0x2f')](_0x55797a[_0x9397('0x2a')][_0x9397('0x2f')]));_0x4166c5[_0x9397('0x2d')]=_0x4166c5[_0x9397('0x2d')][_0x9397('0x30')]?_0x4166c5['attributes']:_0x33011d['model'];if(!_0x55797a[_0x9397('0x2a')][_0x9397('0x31')](_0x9397('0x32'))){_0x4166c5[_0x9397('0xe')]=qs[_0x9397('0xe')](_0x55797a[_0x9397('0x2a')]['limit']);_0x4166c5[_0x9397('0xc')]=qs[_0x9397('0xc')](_0x55797a[_0x9397('0x2a')][_0x9397('0xc')]);}_0x4166c5[_0x9397('0x33')]=qs[_0x9397('0x34')](_0x55797a[_0x9397('0x2a')][_0x9397('0x34')]);_0x4166c5[_0x9397('0x35')]=qs[_0x9397('0x2c')](_[_0x9397('0x36')](_0x55797a[_0x9397('0x2a')],_0x33011d[_0x9397('0x2c')]),_0x49ede5);if(_0x55797a['query'][_0x9397('0x1b')]){_0x4166c5[_0x9397('0x35')]=_[_0x9397('0x37')](_0x4166c5[_0x9397('0x35')],{'$or':_[_0x9397('0x1d')](_0x49ede5,function(_0x532214){if(_0x532214[_0x9397('0x1f')]!==_0x9397('0x38')){var _0x56e01a={};_0x56e01a[_0x532214['name']]={'$like':'%'+_0x55797a['query'][_0x9397('0x1b')]+'%'};return _0x56e01a;}})});}_0x4166c5=_[_0x9397('0x37')]({},_0x4166c5,_0x55797a[_0x9397('0x39')]);var _0x30ce3c={'where':_0x4166c5['where']};return db[_0x9397('0x3a')]['count'](_0x30ce3c)['then'](function(_0x3b8984){_0x36dd73[_0x9397('0xf')]=_0x3b8984;if(_0x55797a[_0x9397('0x2a')][_0x9397('0x3b')]){_0x4166c5['include']=[{'all':!![]}];}return db[_0x9397('0x3a')]['findAll'](_0x4166c5);})[_0x9397('0x13')](function(_0x47d641){_0x36dd73[_0x9397('0x3c')]=_0x47d641;return _0x36dd73;})[_0x9397('0x13')](respondWithFilteredResult(_0x288205,_0x4166c5))['catch'](handleError(_0x288205,null));};exports[_0x9397('0x3d')]=function(_0x1225ac,_0x2c45aa){var _0x417b7d={'raw':![],'where':{'id':_0x1225ac[_0x9397('0x3e')]['id']}},_0x5bf647={};_0x5bf647[_0x9397('0x29')]=_[_0x9397('0x2b')](db[_0x9397('0x3a')]['rawAttributes']);_0x5bf647[_0x9397('0x2a')]=_[_0x9397('0x2b')](_0x1225ac[_0x9397('0x2a')]);_0x5bf647['filters']=_[_0x9397('0x2e')](_0x5bf647[_0x9397('0x29')],_0x5bf647[_0x9397('0x2a')]);_0x417b7d[_0x9397('0x2d')]=_[_0x9397('0x2e')](_0x5bf647['model'],qs[_0x9397('0x2f')](_0x1225ac[_0x9397('0x2a')][_0x9397('0x2f')]));_0x417b7d[_0x9397('0x2d')]=_0x417b7d[_0x9397('0x2d')]['length']?_0x417b7d[_0x9397('0x2d')]:_0x5bf647[_0x9397('0x29')];if(_0x1225ac[_0x9397('0x2a')]['includeAll']){_0x417b7d[_0x9397('0x3f')]=[{'all':!![]}];}_0x417b7d=_[_0x9397('0x37')]({},_0x417b7d,_0x1225ac[_0x9397('0x39')]);return db[_0x9397('0x3a')][_0x9397('0x20')](_0x417b7d)[_0x9397('0x13')](handleEntityNotFound(_0x2c45aa,null))[_0x9397('0x13')](respondWithResult(_0x2c45aa,null))['catch'](handleError(_0x2c45aa,null));};exports[_0x9397('0x12')]=function(_0x18edf5,_0x16a626){return db[_0x9397('0x3a')][_0x9397('0x20')]({'where':{'id':_0x18edf5[_0x9397('0x3e')]['id']}})['then'](handleEntityNotFound(_0x16a626,null))[_0x9397('0x13')](removeEntity(_0x16a626,null))[_0x9397('0x40')](handleError(_0x16a626,null));};exports[_0x9397('0x41')]=function(_0x258cf2,_0x2f87c2){if(_0x258cf2[_0x9397('0x42')][_0x9397('0x1f')]==='outbound'&&!_[_0x9397('0x43')](_0x258cf2['body']['exten'],'_')){_0x258cf2[_0x9397('0x42')][_0x9397('0x44')]='_'['concat'](_0x258cf2[_0x9397('0x42')][_0x9397('0x44')]);}return db[_0x9397('0x3a')][_0x9397('0x41')](_0x258cf2[_0x9397('0x42')],{'raw':![]})['then'](function(_0x249452){var _0x203c2a=_0x258cf2['user'][_0x9397('0x14')]({'plain':!![]});if(!_0x203c2a)throw new Error(_0x9397('0x45'));if(_0x203c2a[_0x9397('0x46')]===_0x9397('0x47')){var _0x339dbc=_0x249452[_0x9397('0x14')]({'plain':!![]});var _0xbf2dbd=[{'name':_0x9397('0x15'),'value':_0x9397('0x16')},{'name':_0x9397('0x17'),'value':_0x9397('0x18')},{'name':_0x9397('0x19'),'value':_0x9397('0x1a')}];var _0x28d4e2=_[_0x9397('0x20')](_0xbf2dbd,[_0x9397('0x1e'),_0x339dbc[_0x9397('0x1f')]])['name'];return db[_0x9397('0x48')][_0x9397('0x20')]({'where':{'name':_0x28d4e2,'userProfileId':_0x203c2a[_0x9397('0x49')]},'raw':!![]})[_0x9397('0x13')](function(_0x36e5b8){if(_0x36e5b8&&_0x36e5b8[_0x9397('0x4a')]===0x0){return db[_0x9397('0x22')]['create']({'name':_0x339dbc[_0x9397('0x21')],'resourceId':_0x339dbc['id'],'type':_0x36e5b8[_0x9397('0x21')],'sectionId':_0x36e5b8['id']},{})['then'](function(){return _0x249452;});}else{return _0x249452;}})[_0x9397('0x40')](function(_0x13ae99){logger[_0x9397('0x23')](_0x9397('0x4b'),_0x13ae99);throw _0x13ae99;});}return _0x249452;})['then'](respondWithResult(_0x2f87c2,0xc9))[_0x9397('0x40')](handleError(_0x2f87c2,null));};exports[_0x9397('0x4c')]=function(_0x44ed16,_0x403f4e){if(_0x44ed16[_0x9397('0x42')]['id']){delete _0x44ed16[_0x9397('0x42')]['id'];}return db[_0x9397('0x3a')]['find']({'where':{'id':_0x44ed16[_0x9397('0x3e')]['id']}})[_0x9397('0x13')](handleEntityNotFound(_0x403f4e,null))[_0x9397('0x13')](function(_0x19b422){if(_0x19b422){return db[_0x9397('0x3a')][_0x9397('0x4c')](_[_0x9397('0x36')](_0x44ed16[_0x9397('0x42')],[_0x9397('0x44'),_0x9397('0x4d'),_0x9397('0x4e'),_0x9397('0x4f'),_0x9397('0x50'),'mandatoryDisposition','alias']),{'where':{'context':_0x19b422[_0x9397('0x4d')],'exten':_0x19b422[_0x9397('0x44')]},'individualHooks':!![]})['then'](function(_0x6eeb47){return _0x6eeb47;});}return null;})[_0x9397('0x13')](respondWithStatusCode(_0x403f4e,null))[_0x9397('0x40')](handleError(_0x403f4e,null));};exports[_0x9397('0x51')]=function(_0x5470bc,_0x3173a7){var _0xce8b6c=_0x5470bc[_0x9397('0x3e')]['id'];var _0x549742=_0x5470bc[_0x9397('0x42')];var _0x107411=0xc8;var _0x53008c=null;return db[_0x9397('0x52')][_0x9397('0x53')]({'isolationLevel':db[_0x9397('0x52')][_0x9397('0x54')][_0x9397('0x55')][_0x9397('0x56')]},function(_0x2bcc35){return db[_0x9397('0x3a')][_0x9397('0x57')]({'where':{'id':_0xce8b6c},'transaction':_0x2bcc35})[_0x9397('0x13')](function(_0x8f76b8){if(_0x8f76b8){return db[_0x9397('0x3a')][_0x9397('0x12')]({'where':{'VoiceExtensionId':_0xce8b6c},'transaction':_0x2bcc35})[_0x9397('0x13')](function(){var _0x480e98=_[_0x9397('0x1d')](_0x549742,function(_0x2b8f8f){_0x2b8f8f[_0x9397('0x58')]=_0xce8b6c;_0x2b8f8f[_0x9397('0x59')]=!![];return _0x2b8f8f;});return _0x8f76b8[_0x9397('0x5a')](_0x480e98);})[_0x9397('0x13')](function(_0x1609fc){return db[_0x9397('0x3a')]['bulkCreate'](_0x1609fc,{'transaction':_0x2bcc35});});}else{_0x107411=0x194;_0x53008c=[];}});})[_0x9397('0x13')](function(){if(_0x107411!==0x194){return db[_0x9397('0x3a')]['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0xce8b6c},'order':_0x9397('0x5b')})[_0x9397('0x13')](function(_0x1ed027){_0x53008c=_0x1ed027;});}})[_0x9397('0x40')](function(_0x1b5b84){_0x107411=0x1f4;logger[_0x9397('0x23')](_0x1b5b84['stack']);if(_0x1b5b84[_0x9397('0x21')]){delete _0x1b5b84[_0x9397('0x21')];}_0x53008c=_0x1b5b84;})['finally'](function(){if(_0x53008c===null){_0x3173a7[_0x9397('0x9')](_0x107411);}else{if(_0x107411===0x1f4){_0x3173a7[_0x9397('0xa')](_0x107411)[_0x9397('0x25')](_0x53008c);}else{_0x3173a7[_0x9397('0xa')](_0x107411)['json'](_0x53008c);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index dc9c8e2..62e5851 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 _0xf667=['save','update','emit','hook','exports','events','../../mysqldb','VoiceExtension'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xf667,0xf5));var _0x7f66=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0xf667[_0x3511d3];return _0x5d6321;};'use strict';var EventEmitter=require(_0x7f66('0x0'));var VoiceExtension=require(_0x7f66('0x1'))['db'][_0x7f66('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7f66('0x3'),'afterUpdate':_0x7f66('0x4'),'afterDestroy':'remove'};function emitEvent(_0x54d01b){return function(_0x184da0,_0x5e1362,_0x548dbb){VoiceExtensionEvents[_0x7f66('0x5')](_0x54d01b+':'+_0x184da0['id'],_0x184da0);VoiceExtensionEvents[_0x7f66('0x5')](_0x54d01b,_0x184da0);_0x548dbb(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0x7f66('0x6')](e,emitEvent(event));}}module[_0x7f66('0x7')]=VoiceExtensionEvents; \ No newline at end of file +var _0x0075=['emit','hasOwnProperty','exports','events','../../mysqldb','VoiceExtension','setMaxListeners','save','remove'];(function(_0x1a7bec,_0x31bbd7){var _0x55bf92=function(_0x2de764){while(--_0x2de764){_0x1a7bec['push'](_0x1a7bec['shift']());}};_0x55bf92(++_0x31bbd7);}(_0x0075,0x147));var _0x5007=function(_0x374ee1,_0x34e6be){_0x374ee1=_0x374ee1-0x0;var _0x568d29=_0x0075[_0x374ee1];return _0x568d29;};'use strict';var EventEmitter=require(_0x5007('0x0'));var VoiceExtension=require(_0x5007('0x1'))['db'][_0x5007('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x5007('0x3')](0x0);var events={'afterCreate':_0x5007('0x4'),'afterUpdate':'update','afterDestroy':_0x5007('0x5')};function emitEvent(_0x451802){return function(_0x2b9ef5,_0x3e664c,_0x180b91){VoiceExtensionEvents[_0x5007('0x6')](_0x451802+':'+_0x2b9ef5['id'],_0x2b9ef5);VoiceExtensionEvents[_0x5007('0x6')](_0x451802,_0x2b9ef5);_0x180b91(null);};}for(var e in events){if(events[_0x5007('0x7')](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0x5007('0x8')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 7532d7d..bee58aa 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 _0x2624=['Interval','findAll','interval','IntervalId','*,*,*,*','intervals','map','filter','toLowerCase','hasOwnProperty','tag','callerID','NoOp(No\x20number\x20available)','answer','queue','includes','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','splice','GotoIfTime',',${EXTEN},','outboundDial','appdata','last','catch','VoiceExtension','voice_extensions','get','priority','then','concat','Hangup','lodash','./voiceExtension.attributes','models','type','context','exten','NoOp','alias','CDR(routeAlias)=','No\x20alias\x20set','inbound','push','CDR(routeid)=','Set','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(destination)=','cutdigits','${EXTEN:','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','options','url','split','length','name','phone','param','prefix','${EXTEN}','join','none','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty'];(function(_0x3a250f,_0x4cea2d){var _0x122726=function(_0x1bb235){while(--_0x1bb235){_0x3a250f['push'](_0x3a250f['shift']());}};_0x122726(++_0x4cea2d);}(_0x2624,0x75));var _0x4262=function(_0x372ac2,_0x28fcd2){_0x372ac2=_0x372ac2-0x0;var _0x75fba5=_0x2624[_0x372ac2];return _0x75fba5;};'use strict';var _=require(_0x4262('0x0'));var attributes=require(_0x4262('0x1'));module['exports']=function(_0x1f9a97){var _0x221794=_0x1f9a97[_0x4262('0x2')];function _0xc6f04c(_0x4a3aa8){var _0x4169f4=0x2;var _0xf17c2b=[{'type':_0x4a3aa8[_0x4262('0x3')],'app':'Set','appdata':'CDR(type)='+_0x4a3aa8[_0x4262('0x3')],'context':_0x4a3aa8[_0x4262('0x4')],'exten':_0x4a3aa8[_0x4262('0x5')],'priority':_0x4169f4++,'VoiceExtensionId':_0x4a3aa8['id']},{'type':_0x4a3aa8[_0x4262('0x3')],'app':_0x4a3aa8['alias']?'Set':_0x4262('0x6'),'appdata':_0x4a3aa8[_0x4262('0x7')]?_0x4262('0x8')+_0x4a3aa8[_0x4262('0x7')]:_0x4262('0x9'),'context':_0x4a3aa8[_0x4262('0x4')],'exten':_0x4a3aa8[_0x4262('0x5')],'priority':_0x4169f4++,'VoiceExtensionId':_0x4a3aa8['id']}];if(_0x4a3aa8[_0x4262('0x3')]===_0x4262('0xa')){_0xf17c2b[_0x4262('0xb')]({'type':'inbound','app':'Set','appdata':_0x4262('0xc')+_0x4a3aa8['id'],'context':_0x4a3aa8[_0x4262('0x4')],'exten':_0x4a3aa8[_0x4262('0x5')],'priority':_0x4169f4++,'VoiceExtensionId':_0x4a3aa8['id']});}_0xf17c2b['push']({'type':_0x4a3aa8[_0x4262('0x3')],'app':_0x4262('0xd'),'appdata':_0x4262('0xe'),'context':_0x4a3aa8[_0x4262('0x4')],'exten':_0x4a3aa8['exten'],'priority':_0x4169f4++,'VoiceExtensionId':_0x4a3aa8['id']},{'type':_0x4a3aa8[_0x4262('0x3')],'app':_0x4262('0xd'),'appdata':_0x4262('0xf'),'context':_0x4a3aa8['context'],'exten':_0x4a3aa8[_0x4262('0x5')],'priority':_0x4169f4++,'VoiceExtensionId':_0x4a3aa8['id']},{'type':_0x4a3aa8['type'],'app':'Set','appdata':_0x4262('0x10'),'context':_0x4a3aa8[_0x4262('0x4')],'exten':_0x4a3aa8[_0x4262('0x5')],'priority':_0x4169f4++,'VoiceExtensionId':_0x4a3aa8['id']});return _0xf17c2b;}function _0x12e0e6(_0x30d1eb){var _0x452e99=0x2;var _0x4ff43a=[{'type':_0x4262('0x11'),'app':_0x4262('0xd'),'appdata':_0x4262('0x12'),'context':_0x30d1eb[_0x4262('0x4')],'exten':_0x30d1eb[_0x4262('0x5')],'priority':_0x452e99++,'VoiceExtensionId':_0x30d1eb['id']},{'type':_0x4262('0x11'),'app':_0x30d1eb[_0x4262('0x7')]?_0x4262('0xd'):_0x4262('0x6'),'appdata':_0x30d1eb['alias']?'CDR(routeAlias)='+_0x30d1eb['alias']:'No\x20alias\x20set','context':_0x30d1eb[_0x4262('0x4')],'exten':_0x30d1eb[_0x4262('0x5')],'priority':_0x452e99++,'VoiceExtensionId':_0x30d1eb['id']},{'type':_0x4262('0x11'),'app':_0x4262('0xd'),'appdata':_0x4262('0x13')+(_0x30d1eb[_0x4262('0x14')]?_0x4262('0x15')+_0x30d1eb[_0x4262('0x14')]+'}':'${EXTEN}'),'context':_0x30d1eb[_0x4262('0x4')],'exten':_0x30d1eb['exten'],'priority':_0x452e99++,'VoiceExtensionId':_0x30d1eb['id']},{'type':_0x4262('0x11'),'app':_0x4262('0xd'),'appdata':_0x4262('0xc')+_0x30d1eb['id'],'context':_0x30d1eb[_0x4262('0x4')],'exten':_0x30d1eb[_0x4262('0x5')],'priority':_0x452e99++,'VoiceExtensionId':_0x30d1eb['id']},{'type':_0x4262('0x11'),'app':_0x4262('0x16'),'appdata':_0x4262('0x17')+(_0x452e99+0x2)+'):Goto('+(_0x452e99+0x1)+')','context':_0x30d1eb[_0x4262('0x4')],'exten':_0x30d1eb['exten'],'priority':_0x452e99++,'VoiceExtensionId':_0x30d1eb['id']},{'type':'outbound','app':_0x4262('0xd'),'appdata':_0x30d1eb['cutdigits']?_0x4262('0x18')+_0x30d1eb[_0x4262('0x14')]+'}':_0x4262('0x19'),'context':_0x30d1eb['context'],'exten':_0x30d1eb[_0x4262('0x5')],'priority':_0x452e99++,'VoiceExtensionId':_0x30d1eb['id']},{'type':'outbound','app':_0x4262('0xd'),'appdata':_0x4262('0xe'),'context':_0x30d1eb[_0x4262('0x4')],'exten':_0x30d1eb[_0x4262('0x5')],'priority':_0x452e99++,'VoiceExtensionId':_0x30d1eb['id']},{'type':_0x4262('0x11'),'app':_0x4262('0xd'),'appdata':_0x4262('0xf'),'context':_0x30d1eb[_0x4262('0x4')],'exten':_0x30d1eb['exten'],'priority':_0x452e99++,'VoiceExtensionId':_0x30d1eb['id']},{'type':'outbound','app':_0x4262('0xd'),'appdata':_0x4262('0x10'),'context':_0x30d1eb[_0x4262('0x4')],'exten':_0x30d1eb['exten'],'priority':_0x452e99++,'VoiceExtensionId':_0x30d1eb['id']},{'type':_0x4262('0x11'),'app':_0x4262('0xd'),'appdata':_0x4262('0x1a')+_0x30d1eb['id'],'context':_0x30d1eb[_0x4262('0x4')],'exten':_0x30d1eb[_0x4262('0x5')],'priority':_0x452e99++,'VoiceExtensionId':_0x30d1eb['id']}];if(_0x30d1eb['hasOwnProperty']('recordingFormat')&&_0x30d1eb[_0x4262('0x1b')]!=='none'){_0x4ff43a[_0x4262('0xb')]({'type':_0x4262('0x11'),'app':_0x4262('0xd'),'appdata':_0x4262('0x1c'),'context':_0x30d1eb['context'],'exten':_0x30d1eb['exten'],'priority':_0x452e99++,'VoiceExtensionId':_0x30d1eb['id']},{'type':_0x4262('0x11'),'app':_0x4262('0xd'),'appdata':_0x4262('0x1d')+_0x30d1eb['recordingFormat']||_0x4262('0x1e'),'context':_0x30d1eb[_0x4262('0x4')],'exten':_0x30d1eb[_0x4262('0x5')],'priority':_0x452e99++,'VoiceExtensionId':_0x30d1eb['id']});}return _0x4ff43a;}function _0x747ed3(_0x36849d,_0x36bf00){var _0x229ad5=[{'name':_0x4262('0x1f'),'param':0x0},{'name':'timeout','param':0x1},{'name':_0x4262('0x20'),'param':0x2},{'name':_0x4262('0x21'),'param':0x3}];var _0x63a7e0={};var _0x77ffa4=_0x36bf00[_0x4262('0x22')](',');var _0x154935=[];for(var _0x2a753a=0x0;_0x2a753a<_0x229ad5[_0x4262('0x23')];_0x2a753a++){switch(_0x229ad5[_0x2a753a][_0x4262('0x24')]){case'trunk':_0x63a7e0[_0x4262('0x1f')]=_0x77ffa4[_0x229ad5[_0x2a753a]['param']][_0x4262('0x22')]('/')[0x1];_0x63a7e0[_0x4262('0x25')]=_0x77ffa4[_0x229ad5[_0x2a753a][_0x4262('0x26')]][_0x4262('0x22')]('/')[0x2];_0x63a7e0[_0x4262('0x27')]=_0x63a7e0[_0x4262('0x25')]?_0x63a7e0['phone']['split']('$')[0x0]:undefined;_0x63a7e0[_0x4262('0x25')]=_0x36849d[_0x4262('0x14')]?(_0x63a7e0[_0x4262('0x27')]||'')+'${EXTEN:'+_0x36849d[_0x4262('0x14')]+'}':(_0x63a7e0['prefix']||'')+_0x4262('0x28');_0x154935[_0x229ad5[_0x2a753a]['param']]=['SIP',_0x63a7e0[_0x4262('0x1f')],_0x63a7e0[_0x4262('0x25')]][_0x4262('0x29')]('/');break;case _0x4262('0x20'):_0x63a7e0[_0x4262('0x20')]=_0x77ffa4[_0x229ad5[_0x2a753a]['param']];if(_0x36849d[_0x4262('0x1b')]!==_0x4262('0x2a')){if(_0x63a7e0['options'][_0x4262('0x2b')]('U(xcally-mixmonitor-context)')<0x0){_0x63a7e0[_0x4262('0x20')]+=_0x4262('0x2c');}}else{_0x63a7e0[_0x4262('0x20')]=_0x63a7e0[_0x4262('0x20')][_0x4262('0x2d')](_0x4262('0x2c'),'');}_0x154935[_0x229ad5[_0x2a753a]['param']]=_0x63a7e0[_0x4262('0x20')];break;default:_0x154935[_0x229ad5[_0x2a753a][_0x4262('0x26')]]=_0x77ffa4[_0x229ad5[_0x2a753a]['param']];}}return _0x154935[_0x4262('0x29')](',');}function _0x23866d(_0x3e7726,_0x272dc8,_0x13b433){return new Promise(function(_0x4cb50e,_0x534852){var _0x4f4aee=[];if(_[_0x4262('0x2e')](_0x272dc8))return _0x4cb50e(_0x4f4aee);_0x221794[_0x4262('0x2f')][_0x4262('0x30')]({'attributes':['id',_0x4262('0x31'),_0x4262('0x32')],'raw':!![]})['then'](function(_0x2667cc){for(var _0x51a0ed=0x0,_0x22cbc6=0x0;_0x51a0ed<_0x272dc8[_0x4262('0x23')];_0x51a0ed++,_0x22cbc6=0x0){var _0x498394=_0x272dc8[_0x51a0ed];var _0x298828=[];var _0x470938=[];delete _0x498394['id'];if(_0x498394['interval']!==_0x4262('0x33')){_0x498394[_0x4262('0x34')]=[_0x498394[_0x4262('0x31')]];}else{_0x498394['intervals']=_0x498394[_0x4262('0x32')]?_[_0x4262('0x35')](_[_0x4262('0x36')](_0x2667cc,{'IntervalId':_0x498394['IntervalId']}),'interval'):[];}_0x498394[_0x4262('0x4')]=_0x3e7726['context'];_0x498394[_0x4262('0x5')]=_0x3e7726[_0x4262('0x5')];if(_0x498394[_0x4262('0x3')])_0x498394[_0x4262('0x3')]=_0x498394[_0x4262('0x3')][_0x4262('0x37')]();if(_0x3e7726[_0x4262('0x3')]==='outbound'){if(_0x498394[_0x4262('0x38')](_0x4262('0x39'))&&_0x498394[_0x4262('0x39')]&&_0x498394['tag']!=='--'){_0x298828[_0x4262('0xb')]({'type':_0x498394[_0x4262('0x3')][_0x4262('0x37')](),'app':_0x4262('0xd'),'appdata':'CDR(tag)='+_0x498394[_0x4262('0x39')],'context':_0x3e7726[_0x4262('0x4')],'exten':_0x3e7726['exten'],'priority':_0x498394[_0x4262('0x34')][_0x4262('0x23')]+_0x13b433+_0x22cbc6++,'VoiceExtensionId':_0x3e7726['id']});}_0x298828[_0x4262('0xb')]({'type':_0x498394[_0x4262('0x3')][_0x4262('0x37')](),'app':_0x4262('0x16'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):'+(_0x498394[_0x4262('0x3a')]?'Set(CALLERID(all)='+_0x498394[_0x4262('0x3a')]+')':_0x4262('0x3b')),'context':_0x3e7726[_0x4262('0x4')],'exten':_0x3e7726[_0x4262('0x5')],'priority':_0x498394[_0x4262('0x34')][_0x4262('0x23')]+_0x13b433+_0x22cbc6++,'VoiceExtensionId':_0x3e7726['id']});}else{if(_0x498394[_0x4262('0x38')](_0x4262('0x3c'))){if([_0x4262('0x3d'),'playback'][_0x4262('0x3e')](_0x498394[_0x4262('0x3f')][_0x4262('0x37')]())&&_0x498394[_0x4262('0x40')]!==_0x4262('0x41')){if(_0x498394[_0x4262('0x3c')]){_0x298828[_0x4262('0xb')]({'type':_0x498394[_0x4262('0x3')]['toLowerCase'](),'app':'ExecIf','appdata':_0x4262('0x42'),'context':_0x3e7726['context'],'exten':_0x3e7726[_0x4262('0x5')],'priority':_0x498394[_0x4262('0x34')]['length']+_0x13b433+_0x22cbc6++,'VoiceExtensionId':_0x3e7726['id']});_0x298828[_0x4262('0xb')]({'type':_0x498394[_0x4262('0x3')][_0x4262('0x37')](),'app':'Set','appdata':_0x4262('0x43'),'context':_0x3e7726[_0x4262('0x4')],'exten':_0x3e7726[_0x4262('0x5')],'priority':_0x498394[_0x4262('0x34')][_0x4262('0x23')]+_0x13b433+_0x22cbc6++,'VoiceExtensionId':_0x3e7726['id']});}else{_0x298828[_0x4262('0xb')]({'type':_0x498394[_0x4262('0x3')][_0x4262('0x37')](),'app':'ExecIf','appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x3e7726['context'],'exten':_0x3e7726[_0x4262('0x5')],'priority':_0x498394[_0x4262('0x34')][_0x4262('0x23')]+_0x13b433+_0x22cbc6++,'VoiceExtensionId':_0x3e7726['id']});_0x298828[_0x4262('0xb')]({'type':_0x498394['type'][_0x4262('0x37')](),'app':_0x4262('0xd'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x3e7726['context'],'exten':_0x3e7726[_0x4262('0x5')],'priority':_0x498394[_0x4262('0x34')][_0x4262('0x23')]+_0x13b433+_0x22cbc6++,'VoiceExtensionId':_0x3e7726['id']});}}}}for(var _0x265589=0x0;_0x265589<_0x498394['intervals']['length'];_0x265589++){var _0x503884=_0x13b433+_0x498394[_0x4262('0x34')][_0x4262('0x23')];var _0x892b23=_0x265589===_0x498394[_0x4262('0x34')]['length']-0x1?_0x13b433+_0x298828['length']+_0x470938['length']+0x2:_0x13b433+_0x265589+0x1;_0x298828[_0x4262('0x44')](_0x265589,0x0,{'type':_0x3e7726['type'],'app':_0x4262('0x45'),'appdata':_0x498394[_0x4262('0x34')][_0x265589]+'?'+_0x3e7726[_0x4262('0x4')]+_0x4262('0x46')+_0x503884+':'+_0x3e7726['context']+_0x4262('0x46')+_0x892b23,'exten':_0x3e7726['exten'],'context':_0x3e7726['context'],'priority':_0x13b433+_0x265589,'VoiceExtensionId':_0x3e7726['id']});}if(_0x498394[_0x4262('0x40')]===_0x4262('0x47'))_0x498394[_0x4262('0x48')]=_0x747ed3(_0x3e7726,_0x498394[_0x4262('0x48')]);_0x498394['priority']=_0x298828[_0x4262('0x23')]?_['last'](_0x298828)['priority']+0x1:_0x13b433;_0x4f4aee=_['concat'](_0x4f4aee,_0x298828,[_0x498394],_0x470938);_0x13b433=_[_0x4262('0x49')](_0x4f4aee)['priority']+0x1;}return _0x4cb50e(_0x4f4aee);})[_0x4262('0x4a')](function(_0x2f82b9){_0x534852(_0x2f82b9);});});}return _0x1f9a97['define'](_0x4262('0x4b'),attributes,{'tableName':_0x4262('0x4c'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x7615d2){var _0x5ef947=this[_0x4262('0x4d')]({'plain':!![]});var _0x17fbdc=_0x5ef947[_0x4262('0x3')]==='outbound'?_0x12e0e6(_0x5ef947):_0xc6f04c(_0x5ef947);return _0x23866d(_0x5ef947,_0x7615d2,_[_0x4262('0x49')](_0x17fbdc)[_0x4262('0x4e')]+0x1)[_0x4262('0x4f')](function(_0x5cd9a8){var _0x491408=_[_0x4262('0x50')](_0x17fbdc,_0x5cd9a8);_0x491408[_0x4262('0xb')]({'type':_0x5ef947[_0x4262('0x3')],'app':_0x4262('0x51'),'exten':_0x5ef947['exten'],'context':_0x5ef947[_0x4262('0x4')],'priority':_[_0x4262('0x49')](_0x491408)[_0x4262('0x4e')]+0x1,'VoiceExtensionId':_0x5ef947['id']});return _0x491408;});}}});}; \ No newline at end of file +var _0x9c50=['voice_extensions','then','models','Set','type','context','exten','alias','NoOp','inbound','push','CDR(routeid)=','outbound','CDR(type)=outbound','No\x20alias\x20set','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','MONITOR_OPTIONS=ab','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','options','url','split','name','phone','param','prefix','indexOf','U(xcally-mixmonitor-context)','join','isEmpty','Interval','findAll','IntervalId','interval','*,*,*,*','intervals','map','filter','toLowerCase','tag','CDR(tag)=','length','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','queue','app','custom','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','outboundDial','appdata','last','priority','concat','catch','define','VoiceExtension'];(function(_0x2a6166,_0x338023){var _0x417a2f=function(_0x249ef7){while(--_0x249ef7){_0x2a6166['push'](_0x2a6166['shift']());}};_0x417a2f(++_0x338023);}(_0x9c50,0xec));var _0x09c5=function(_0x3a31f5,_0x24a10e){_0x3a31f5=_0x3a31f5-0x0;var _0x155780=_0x9c50[_0x3a31f5];return _0x155780;};'use strict';var _=require('lodash');var attributes=require('./voiceExtension.attributes');module['exports']=function(_0x2cf3b4){var _0x5ec6dd=_0x2cf3b4[_0x09c5('0x0')];function _0x493887(_0x48aa92){var _0x23513c=0x2;var _0x1e2992=[{'type':_0x48aa92['type'],'app':_0x09c5('0x1'),'appdata':'CDR(type)='+_0x48aa92[_0x09c5('0x2')],'context':_0x48aa92[_0x09c5('0x3')],'exten':_0x48aa92[_0x09c5('0x4')],'priority':_0x23513c++,'VoiceExtensionId':_0x48aa92['id']},{'type':_0x48aa92['type'],'app':_0x48aa92[_0x09c5('0x5')]?_0x09c5('0x1'):_0x09c5('0x6'),'appdata':_0x48aa92[_0x09c5('0x5')]?'CDR(routeAlias)='+_0x48aa92[_0x09c5('0x5')]:'No\x20alias\x20set','context':_0x48aa92['context'],'exten':_0x48aa92[_0x09c5('0x4')],'priority':_0x23513c++,'VoiceExtensionId':_0x48aa92['id']}];if(_0x48aa92[_0x09c5('0x2')]===_0x09c5('0x7')){_0x1e2992[_0x09c5('0x8')]({'type':'inbound','app':_0x09c5('0x1'),'appdata':_0x09c5('0x9')+_0x48aa92['id'],'context':_0x48aa92[_0x09c5('0x3')],'exten':_0x48aa92[_0x09c5('0x4')],'priority':_0x23513c++,'VoiceExtensionId':_0x48aa92['id']});}_0x1e2992[_0x09c5('0x8')]({'type':_0x48aa92[_0x09c5('0x2')],'app':'Set','appdata':'XCALLY-MOTION-ANSWER=0','context':_0x48aa92[_0x09c5('0x3')],'exten':_0x48aa92[_0x09c5('0x4')],'priority':_0x23513c++,'VoiceExtensionId':_0x48aa92['id']},{'type':_0x48aa92[_0x09c5('0x2')],'app':_0x09c5('0x1'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x48aa92['context'],'exten':_0x48aa92[_0x09c5('0x4')],'priority':_0x23513c++,'VoiceExtensionId':_0x48aa92['id']},{'type':_0x48aa92['type'],'app':'Set','appdata':'MONITOR_OPTIONS=ab','context':_0x48aa92[_0x09c5('0x3')],'exten':_0x48aa92[_0x09c5('0x4')],'priority':_0x23513c++,'VoiceExtensionId':_0x48aa92['id']});return _0x1e2992;}function _0x3d160f(_0x2f6732){var _0x2891fb=0x2;var _0x34258c=[{'type':_0x09c5('0xa'),'app':_0x09c5('0x1'),'appdata':_0x09c5('0xb'),'context':_0x2f6732[_0x09c5('0x3')],'exten':_0x2f6732['exten'],'priority':_0x2891fb++,'VoiceExtensionId':_0x2f6732['id']},{'type':_0x09c5('0xa'),'app':_0x2f6732[_0x09c5('0x5')]?_0x09c5('0x1'):_0x09c5('0x6'),'appdata':_0x2f6732[_0x09c5('0x5')]?'CDR(routeAlias)='+_0x2f6732[_0x09c5('0x5')]:_0x09c5('0xc'),'context':_0x2f6732[_0x09c5('0x3')],'exten':_0x2f6732[_0x09c5('0x4')],'priority':_0x2891fb++,'VoiceExtensionId':_0x2f6732['id']},{'type':'outbound','app':'Set','appdata':_0x09c5('0xd')+(_0x2f6732[_0x09c5('0xe')]?_0x09c5('0xf')+_0x2f6732['cutdigits']+'}':_0x09c5('0x10')),'context':_0x2f6732[_0x09c5('0x3')],'exten':_0x2f6732[_0x09c5('0x4')],'priority':_0x2891fb++,'VoiceExtensionId':_0x2f6732['id']},{'type':_0x09c5('0xa'),'app':'Set','appdata':_0x09c5('0x9')+_0x2f6732['id'],'context':_0x2f6732['context'],'exten':_0x2f6732[_0x09c5('0x4')],'priority':_0x2891fb++,'VoiceExtensionId':_0x2f6732['id']},{'type':_0x09c5('0xa'),'app':_0x09c5('0x11'),'appdata':_0x09c5('0x12')+(_0x2891fb+0x2)+'):Goto('+(_0x2891fb+0x1)+')','context':_0x2f6732[_0x09c5('0x3')],'exten':_0x2f6732[_0x09c5('0x4')],'priority':_0x2891fb++,'VoiceExtensionId':_0x2f6732['id']},{'type':_0x09c5('0xa'),'app':'Set','appdata':_0x2f6732[_0x09c5('0xe')]?_0x09c5('0x13')+_0x2f6732[_0x09c5('0xe')]+'}':_0x09c5('0x14'),'context':_0x2f6732[_0x09c5('0x3')],'exten':_0x2f6732[_0x09c5('0x4')],'priority':_0x2891fb++,'VoiceExtensionId':_0x2f6732['id']},{'type':_0x09c5('0xa'),'app':'Set','appdata':'XCALLY-MOTION-ANSWER=0','context':_0x2f6732[_0x09c5('0x3')],'exten':_0x2f6732['exten'],'priority':_0x2891fb++,'VoiceExtensionId':_0x2f6732['id']},{'type':_0x09c5('0xa'),'app':_0x09c5('0x1'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x2f6732['context'],'exten':_0x2f6732[_0x09c5('0x4')],'priority':_0x2891fb++,'VoiceExtensionId':_0x2f6732['id']},{'type':'outbound','app':_0x09c5('0x1'),'appdata':_0x09c5('0x15'),'context':_0x2f6732[_0x09c5('0x3')],'exten':_0x2f6732['exten'],'priority':_0x2891fb++,'VoiceExtensionId':_0x2f6732['id']},{'type':_0x09c5('0xa'),'app':_0x09c5('0x1'),'appdata':_0x09c5('0x16')+_0x2f6732['id'],'context':_0x2f6732['context'],'exten':_0x2f6732['exten'],'priority':_0x2891fb++,'VoiceExtensionId':_0x2f6732['id']}];if(_0x2f6732[_0x09c5('0x17')]('recordingFormat')&&_0x2f6732[_0x09c5('0x18')]!==_0x09c5('0x19')){_0x34258c[_0x09c5('0x8')]({'type':_0x09c5('0xa'),'app':_0x09c5('0x1'),'appdata':_0x09c5('0x1a'),'context':_0x2f6732['context'],'exten':_0x2f6732['exten'],'priority':_0x2891fb++,'VoiceExtensionId':_0x2f6732['id']},{'type':_0x09c5('0xa'),'app':_0x09c5('0x1'),'appdata':_0x09c5('0x1b')+_0x2f6732['recordingFormat']||_0x09c5('0x1c'),'context':_0x2f6732[_0x09c5('0x3')],'exten':_0x2f6732[_0x09c5('0x4')],'priority':_0x2891fb++,'VoiceExtensionId':_0x2f6732['id']});}return _0x34258c;}function _0x1c2f0b(_0x395e7e,_0x31321d){var _0x132e08=[{'name':_0x09c5('0x1d'),'param':0x0},{'name':_0x09c5('0x1e'),'param':0x1},{'name':_0x09c5('0x1f'),'param':0x2},{'name':_0x09c5('0x20'),'param':0x3}];var _0x4e0138={};var _0xaa2f4c=_0x31321d[_0x09c5('0x21')](',');var _0x3c0b1c=[];for(var _0x40d7b0=0x0;_0x40d7b0<_0x132e08['length'];_0x40d7b0++){switch(_0x132e08[_0x40d7b0][_0x09c5('0x22')]){case _0x09c5('0x1d'):_0x4e0138[_0x09c5('0x1d')]=_0xaa2f4c[_0x132e08[_0x40d7b0]['param']][_0x09c5('0x21')]('/')[0x1];_0x4e0138[_0x09c5('0x23')]=_0xaa2f4c[_0x132e08[_0x40d7b0][_0x09c5('0x24')]][_0x09c5('0x21')]('/')[0x2];_0x4e0138[_0x09c5('0x25')]=_0x4e0138[_0x09c5('0x23')]?_0x4e0138[_0x09c5('0x23')][_0x09c5('0x21')]('$')[0x0]:undefined;_0x4e0138['phone']=_0x395e7e[_0x09c5('0xe')]?(_0x4e0138[_0x09c5('0x25')]||'')+_0x09c5('0xf')+_0x395e7e[_0x09c5('0xe')]+'}':(_0x4e0138['prefix']||'')+_0x09c5('0x10');_0x3c0b1c[_0x132e08[_0x40d7b0]['param']]=['SIP',_0x4e0138[_0x09c5('0x1d')],_0x4e0138[_0x09c5('0x23')]]['join']('/');break;case _0x09c5('0x1f'):_0x4e0138[_0x09c5('0x1f')]=_0xaa2f4c[_0x132e08[_0x40d7b0][_0x09c5('0x24')]];if(_0x395e7e['recordingFormat']!==_0x09c5('0x19')){if(_0x4e0138[_0x09c5('0x1f')][_0x09c5('0x26')](_0x09c5('0x27'))<0x0){_0x4e0138[_0x09c5('0x1f')]+=_0x09c5('0x27');}}else{_0x4e0138['options']=_0x4e0138[_0x09c5('0x1f')]['replace'](_0x09c5('0x27'),'');}_0x3c0b1c[_0x132e08[_0x40d7b0][_0x09c5('0x24')]]=_0x4e0138[_0x09c5('0x1f')];break;default:_0x3c0b1c[_0x132e08[_0x40d7b0][_0x09c5('0x24')]]=_0xaa2f4c[_0x132e08[_0x40d7b0]['param']];}}return _0x3c0b1c[_0x09c5('0x28')](',');}function _0x335bad(_0x33c0c8,_0x5a391b,_0x159936){return new Promise(function(_0xf525a4,_0x4a27be){var _0x549671=[];if(_[_0x09c5('0x29')](_0x5a391b))return _0xf525a4(_0x549671);_0x5ec6dd[_0x09c5('0x2a')][_0x09c5('0x2b')]({'attributes':['id','interval',_0x09c5('0x2c')],'raw':!![]})['then'](function(_0x16168f){for(var _0x42f95e=0x0,_0x114f0d=0x0;_0x42f95e<_0x5a391b['length'];_0x42f95e++,_0x114f0d=0x0){var _0x2c173b=_0x5a391b[_0x42f95e];var _0x36cbe2=[];var _0x3ebee1=[];delete _0x2c173b['id'];if(_0x2c173b[_0x09c5('0x2d')]!==_0x09c5('0x2e')){_0x2c173b['intervals']=[_0x2c173b[_0x09c5('0x2d')]];}else{_0x2c173b[_0x09c5('0x2f')]=_0x2c173b[_0x09c5('0x2c')]?_[_0x09c5('0x30')](_[_0x09c5('0x31')](_0x16168f,{'IntervalId':_0x2c173b[_0x09c5('0x2c')]}),_0x09c5('0x2d')):[];}_0x2c173b[_0x09c5('0x3')]=_0x33c0c8['context'];_0x2c173b[_0x09c5('0x4')]=_0x33c0c8[_0x09c5('0x4')];if(_0x2c173b['type'])_0x2c173b[_0x09c5('0x2')]=_0x2c173b[_0x09c5('0x2')][_0x09c5('0x32')]();if(_0x33c0c8[_0x09c5('0x2')]==='outbound'){if(_0x2c173b[_0x09c5('0x17')](_0x09c5('0x33'))&&_0x2c173b['tag']&&_0x2c173b[_0x09c5('0x33')]!=='--'){_0x36cbe2[_0x09c5('0x8')]({'type':_0x2c173b[_0x09c5('0x2')][_0x09c5('0x32')](),'app':'Set','appdata':_0x09c5('0x34')+_0x2c173b['tag'],'context':_0x33c0c8[_0x09c5('0x3')],'exten':_0x33c0c8[_0x09c5('0x4')],'priority':_0x2c173b[_0x09c5('0x2f')][_0x09c5('0x35')]+_0x159936+_0x114f0d++,'VoiceExtensionId':_0x33c0c8['id']});}_0x36cbe2[_0x09c5('0x8')]({'type':_0x2c173b[_0x09c5('0x2')][_0x09c5('0x32')](),'app':'ExecIf','appdata':_0x09c5('0x36')+(_0x2c173b[_0x09c5('0x37')]?_0x09c5('0x38')+_0x2c173b[_0x09c5('0x37')]+')':_0x09c5('0x39')),'context':_0x33c0c8['context'],'exten':_0x33c0c8[_0x09c5('0x4')],'priority':_0x2c173b[_0x09c5('0x2f')][_0x09c5('0x35')]+_0x159936+_0x114f0d++,'VoiceExtensionId':_0x33c0c8['id']});}else{if(_0x2c173b[_0x09c5('0x17')]('answer')){if([_0x09c5('0x3a'),'playback']['includes'](_0x2c173b[_0x09c5('0x3b')][_0x09c5('0x32')]())&&_0x2c173b['appType']!==_0x09c5('0x3c')){if(_0x2c173b[_0x09c5('0x3d')]){_0x36cbe2[_0x09c5('0x8')]({'type':_0x2c173b['type']['toLowerCase'](),'app':_0x09c5('0x11'),'appdata':_0x09c5('0x3e'),'context':_0x33c0c8[_0x09c5('0x3')],'exten':_0x33c0c8[_0x09c5('0x4')],'priority':_0x2c173b[_0x09c5('0x2f')][_0x09c5('0x35')]+_0x159936+_0x114f0d++,'VoiceExtensionId':_0x33c0c8['id']});_0x36cbe2[_0x09c5('0x8')]({'type':_0x2c173b[_0x09c5('0x2')][_0x09c5('0x32')](),'app':'Set','appdata':'XCALLY-MOTION-ANSWER=1','context':_0x33c0c8[_0x09c5('0x3')],'exten':_0x33c0c8[_0x09c5('0x4')],'priority':_0x2c173b[_0x09c5('0x2f')][_0x09c5('0x35')]+_0x159936+_0x114f0d++,'VoiceExtensionId':_0x33c0c8['id']});}else{_0x36cbe2[_0x09c5('0x8')]({'type':_0x2c173b[_0x09c5('0x2')][_0x09c5('0x32')](),'app':_0x09c5('0x11'),'appdata':_0x09c5('0x3f'),'context':_0x33c0c8['context'],'exten':_0x33c0c8[_0x09c5('0x4')],'priority':_0x2c173b[_0x09c5('0x2f')][_0x09c5('0x35')]+_0x159936+_0x114f0d++,'VoiceExtensionId':_0x33c0c8['id']});_0x36cbe2['push']({'type':_0x2c173b[_0x09c5('0x2')]['toLowerCase'](),'app':_0x09c5('0x1'),'appdata':_0x09c5('0x40'),'context':_0x33c0c8['context'],'exten':_0x33c0c8['exten'],'priority':_0x2c173b['intervals'][_0x09c5('0x35')]+_0x159936+_0x114f0d++,'VoiceExtensionId':_0x33c0c8['id']});}}}}for(var _0x48b0c3=0x0;_0x48b0c3<_0x2c173b['intervals'][_0x09c5('0x35')];_0x48b0c3++){var _0x21f49e=_0x159936+_0x2c173b['intervals'][_0x09c5('0x35')];var _0x49a1ff=_0x48b0c3===_0x2c173b[_0x09c5('0x2f')][_0x09c5('0x35')]-0x1?_0x159936+_0x36cbe2['length']+_0x3ebee1[_0x09c5('0x35')]+0x2:_0x159936+_0x48b0c3+0x1;_0x36cbe2[_0x09c5('0x41')](_0x48b0c3,0x0,{'type':_0x33c0c8[_0x09c5('0x2')],'app':_0x09c5('0x42'),'appdata':_0x2c173b[_0x09c5('0x2f')][_0x48b0c3]+'?'+_0x33c0c8[_0x09c5('0x3')]+_0x09c5('0x43')+_0x21f49e+':'+_0x33c0c8['context']+_0x09c5('0x43')+_0x49a1ff,'exten':_0x33c0c8[_0x09c5('0x4')],'context':_0x33c0c8[_0x09c5('0x3')],'priority':_0x159936+_0x48b0c3,'VoiceExtensionId':_0x33c0c8['id']});}if(_0x2c173b['appType']===_0x09c5('0x44'))_0x2c173b[_0x09c5('0x45')]=_0x1c2f0b(_0x33c0c8,_0x2c173b[_0x09c5('0x45')]);_0x2c173b['priority']=_0x36cbe2[_0x09c5('0x35')]?_[_0x09c5('0x46')](_0x36cbe2)[_0x09c5('0x47')]+0x1:_0x159936;_0x549671=_[_0x09c5('0x48')](_0x549671,_0x36cbe2,[_0x2c173b],_0x3ebee1);_0x159936=_[_0x09c5('0x46')](_0x549671)['priority']+0x1;}return _0xf525a4(_0x549671);})[_0x09c5('0x49')](function(_0x19fc12){_0x4a27be(_0x19fc12);});});}return _0x2cf3b4[_0x09c5('0x4a')](_0x09c5('0x4b'),attributes,{'tableName':_0x09c5('0x4c'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x5a79a8){var _0xb7c2d3=this['get']({'plain':!![]});var _0x176c45=_0xb7c2d3[_0x09c5('0x2')]===_0x09c5('0xa')?_0x3d160f(_0xb7c2d3):_0x493887(_0xb7c2d3);return _0x335bad(_0xb7c2d3,_0x5a79a8,_[_0x09c5('0x46')](_0x176c45)[_0x09c5('0x47')]+0x1)[_0x09c5('0x4d')](function(_0x59cf8f){var _0x2901f1=_[_0x09c5('0x48')](_0x176c45,_0x59cf8f);_0x2901f1[_0x09c5('0x8')]({'type':_0xb7c2d3['type'],'app':'Hangup','exten':_0xb7c2d3[_0x09c5('0x4')],'context':_0xb7c2d3[_0x09c5('0x3')],'priority':_['last'](_0x2901f1)['priority']+0x1,'VoiceExtensionId':_0xb7c2d3['id']});return _0x2901f1;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index fc0f0b3..47eaf0c 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 _0xd1f9=['request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','code','error','VoiceExtension,\x20%s,\x20%s','message','GetVoiceExtension','VoiceExtension','options','raw','where','attributes','limit','include','map','model','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','request','then','info'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xd1f9,0x88));var _0x9d1f=function(_0x4de226,_0xf589ec){_0x4de226=_0x4de226-0x0;var _0x2fb276=_0xd1f9[_0x4de226];return _0x2fb276;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9d1f('0x0'));var BPromise=require(_0x9d1f('0x1'));var rs=require(_0x9d1f('0x2'));var fs=require('fs');var Redis=require(_0x9d1f('0x3'));var db=require(_0x9d1f('0x4'))['db'];var utils=require(_0x9d1f('0x5'));var logger=require(_0x9d1f('0x6'))(_0x9d1f('0x7'));var config=require(_0x9d1f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9d1f('0x9')][_0x9d1f('0xa')]({'port':0x232a});config[_0x9d1f('0xb')]=_[_0x9d1f('0xc')](config[_0x9d1f('0xb')],{'host':_0x9d1f('0xd'),'port':0x18eb});var socket=require(_0x9d1f('0xe'))(new Redis(config[_0x9d1f('0xb')]));require(_0x9d1f('0xf'))[_0x9d1f('0x10')](socket);function respondWithRpcPromise(_0x153ef3,_0x1d960c,_0x1c5446){return new BPromise(function(_0x27480b,_0x34e67a){return client[_0x9d1f('0x11')](_0x153ef3,_0x1c5446)[_0x9d1f('0x12')](function(_0x1dcf5f){logger[_0x9d1f('0x13')]('VoiceExtension,\x20%s,\x20%s',_0x1d960c,_0x9d1f('0x14'));logger[_0x9d1f('0x15')](_0x9d1f('0x16'),_0x1d960c,'request\x20sent',JSON[_0x9d1f('0x17')](_0x1dcf5f));if(_0x1dcf5f['error']){if(_0x1dcf5f['error'][_0x9d1f('0x18')]===0x1f4){logger[_0x9d1f('0x19')](_0x9d1f('0x1a'),_0x1d960c,_0x1dcf5f[_0x9d1f('0x19')][_0x9d1f('0x1b')]);return _0x34e67a(_0x1dcf5f[_0x9d1f('0x19')][_0x9d1f('0x1b')]);}logger[_0x9d1f('0x19')](_0x9d1f('0x1a'),_0x1d960c,_0x1dcf5f[_0x9d1f('0x19')][_0x9d1f('0x1b')]);return _0x27480b(_0x1dcf5f[_0x9d1f('0x19')][_0x9d1f('0x1b')]);}else{logger['info'](_0x9d1f('0x1a'),_0x1d960c,_0x9d1f('0x14'));_0x27480b(_0x1dcf5f['result'][_0x9d1f('0x1b')]);}})['catch'](function(_0x4ab476){logger['error'](_0x9d1f('0x1a'),_0x1d960c,_0x4ab476);_0x34e67a(_0x4ab476);});});}exports[_0x9d1f('0x1c')]=function(_0x380a14){var _0x5686d9=this;return new Promise(function(_0x3671f7,_0x4cfcf5){return db[_0x9d1f('0x1d')]['findAll']({'raw':_0x380a14['options']?_0x380a14[_0x9d1f('0x1e')][_0x9d1f('0x1f')]===undefined?!![]:![]:!![],'where':_0x380a14[_0x9d1f('0x1e')]?_0x380a14[_0x9d1f('0x1e')][_0x9d1f('0x20')]||null:null,'attributes':_0x380a14[_0x9d1f('0x1e')]?_0x380a14[_0x9d1f('0x1e')][_0x9d1f('0x21')]||null:null,'limit':_0x380a14[_0x9d1f('0x1e')]?_0x380a14[_0x9d1f('0x1e')][_0x9d1f('0x22')]||null:null,'include':_0x380a14[_0x9d1f('0x1e')]?_0x380a14[_0x9d1f('0x1e')][_0x9d1f('0x23')]?_['map'](_0x380a14[_0x9d1f('0x1e')][_0x9d1f('0x23')],function(_0x48245c){return{'model':db[_0x48245c['model']],'as':_0x48245c['as'],'attributes':_0x48245c[_0x9d1f('0x21')],'include':_0x48245c[_0x9d1f('0x23')]?_[_0x9d1f('0x24')](_0x48245c[_0x9d1f('0x23')],function(_0x1aeaf3){return{'model':db[_0x1aeaf3['model']],'as':_0x1aeaf3['as'],'attributes':_0x1aeaf3['attributes'],'include':_0x1aeaf3[_0x9d1f('0x23')]?_[_0x9d1f('0x24')](_0x1aeaf3[_0x9d1f('0x23')],function(_0x44515d){return{'model':db[_0x44515d[_0x9d1f('0x25')]],'as':_0x44515d['as'],'attributes':_0x44515d[_0x9d1f('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2b11db){logger['info'](_0x9d1f('0x1c'),_0x380a14);logger[_0x9d1f('0x15')](_0x9d1f('0x1c'),_0x380a14,JSON[_0x9d1f('0x17')](_0x2b11db));_0x3671f7(_0x2b11db);})[_0x9d1f('0x26')](function(_0x57f521){logger[_0x9d1f('0x19')](_0x9d1f('0x1c'),_0x57f521[_0x9d1f('0x1b')],_0x380a14);_0x4cfcf5(_0x5686d9['error'](0x1f4,_0x57f521['message']));});});}; \ No newline at end of file +var _0x8585=['map','attributes','include','model','lodash','util','moment','randomstring','ioredis','rpc','../../config/environment','http','redis','defaults','socket.io-emitter','request','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetVoiceExtension','findAll','options','raw','where','limit'];(function(_0x1b3ac0,_0x2b675b){var _0x393f8e=function(_0x1cede6){while(--_0x1cede6){_0x1b3ac0['push'](_0x1b3ac0['shift']());}};_0x393f8e(++_0x2b675b);}(_0x8585,0x64));var _0x5858=function(_0x34192d,_0x1b5096){_0x34192d=_0x34192d-0x0;var _0x1aa6f9=_0x8585[_0x34192d];return _0x1aa6f9;};'use strict';var _=require(_0x5858('0x0'));var util=require(_0x5858('0x1'));var moment=require(_0x5858('0x2'));var BPromise=require('bluebird');var rs=require(_0x5858('0x3'));var fs=require('fs');var Redis=require(_0x5858('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5858('0x5'));var config=require(_0x5858('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5858('0x7')]({'port':0x232a});config[_0x5858('0x8')]=_[_0x5858('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x5858('0xa'))(new Redis(config[_0x5858('0x8')]));require('./voiceExtension.socket')['register'](socket);function respondWithRpcPromise(_0x3b8121,_0x420f75,_0x4f25d6){return new BPromise(function(_0x2c8b1f,_0x264f64){return client[_0x5858('0xb')](_0x3b8121,_0x4f25d6)[_0x5858('0xc')](function(_0x28aa4f){logger[_0x5858('0xd')](_0x5858('0xe'),_0x420f75,_0x5858('0xf'));logger[_0x5858('0x10')]('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x420f75,_0x5858('0xf'),JSON[_0x5858('0x11')](_0x28aa4f));if(_0x28aa4f[_0x5858('0x12')]){if(_0x28aa4f['error'][_0x5858('0x13')]===0x1f4){logger[_0x5858('0x12')](_0x5858('0xe'),_0x420f75,_0x28aa4f[_0x5858('0x12')][_0x5858('0x14')]);return _0x264f64(_0x28aa4f[_0x5858('0x12')][_0x5858('0x14')]);}logger[_0x5858('0x12')](_0x5858('0xe'),_0x420f75,_0x28aa4f[_0x5858('0x12')][_0x5858('0x14')]);return _0x2c8b1f(_0x28aa4f[_0x5858('0x12')][_0x5858('0x14')]);}else{logger[_0x5858('0xd')](_0x5858('0xe'),_0x420f75,_0x5858('0xf'));_0x2c8b1f(_0x28aa4f['result'][_0x5858('0x14')]);}})[_0x5858('0x15')](function(_0x446ce1){logger['error'](_0x5858('0xe'),_0x420f75,_0x446ce1);_0x264f64(_0x446ce1);});});}exports[_0x5858('0x16')]=function(_0x178f7e){var _0x48a0fb=this;return new Promise(function(_0x23097e,_0x229fe4){return db['VoiceExtension'][_0x5858('0x17')]({'raw':_0x178f7e[_0x5858('0x18')]?_0x178f7e[_0x5858('0x18')][_0x5858('0x19')]===undefined?!![]:![]:!![],'where':_0x178f7e[_0x5858('0x18')]?_0x178f7e[_0x5858('0x18')][_0x5858('0x1a')]||null:null,'attributes':_0x178f7e[_0x5858('0x18')]?_0x178f7e[_0x5858('0x18')]['attributes']||null:null,'limit':_0x178f7e[_0x5858('0x18')]?_0x178f7e[_0x5858('0x18')][_0x5858('0x1b')]||null:null,'include':_0x178f7e[_0x5858('0x18')]?_0x178f7e['options']['include']?_[_0x5858('0x1c')](_0x178f7e[_0x5858('0x18')]['include'],function(_0x517178){return{'model':db[_0x517178['model']],'as':_0x517178['as'],'attributes':_0x517178[_0x5858('0x1d')],'include':_0x517178[_0x5858('0x1e')]?_[_0x5858('0x1c')](_0x517178['include'],function(_0x24a5fe){return{'model':db[_0x24a5fe[_0x5858('0x1f')]],'as':_0x24a5fe['as'],'attributes':_0x24a5fe[_0x5858('0x1d')],'include':_0x24a5fe['include']?_[_0x5858('0x1c')](_0x24a5fe[_0x5858('0x1e')],function(_0xbc841e){return{'model':db[_0xbc841e[_0x5858('0x1f')]],'as':_0xbc841e['as'],'attributes':_0xbc841e['attributes']};}):[]};}):[]};}):[]:[]})[_0x5858('0xc')](function(_0x22146e){logger['info']('GetVoiceExtension',_0x178f7e);logger['debug'](_0x5858('0x16'),_0x178f7e,JSON[_0x5858('0x11')](_0x22146e));_0x23097e(_0x22146e);})[_0x5858('0x15')](function(_0x4dc403){logger[_0x5858('0x12')](_0x5858('0x16'),_0x4dc403[_0x5858('0x14')],_0x178f7e);_0x229fe4(_0x48a0fb[_0x5858('0x12')](0x1f4,_0x4dc403['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 6deb65c..9af864a 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 _0x53ec=['length','voiceExtension:','./voiceExtension.events','save','remove','update','emit','removeListener'];(function(_0x9e0e0f,_0xfb7148){var _0x2bb2c2=function(_0x48b3a0){while(--_0x48b3a0){_0x9e0e0f['push'](_0x9e0e0f['shift']());}};_0x2bb2c2(++_0xfb7148);}(_0x53ec,0x192));var _0xc53e=function(_0x1ceb7b,_0x894d3d){_0x1ceb7b=_0x1ceb7b-0x0;var _0x57c016=_0x53ec[_0x1ceb7b];return _0x57c016;};'use strict';var VoiceExtensionEvents=require(_0xc53e('0x0'));var events=[_0xc53e('0x1'),_0xc53e('0x2'),_0xc53e('0x3')];function createListener(_0x1b04cc,_0xe45c6d){return function(_0x51c435){_0xe45c6d[_0xc53e('0x4')](_0x1b04cc,_0x51c435);};}function removeListener(_0x4e954a,_0x2b90f6){return function(){VoiceExtensionEvents[_0xc53e('0x5')](_0x4e954a,_0x2b90f6);};}exports['register']=function(_0x2f1414){for(var _0x4f989b=0x0,_0x41a9e8=events[_0xc53e('0x6')];_0x4f989b<_0x41a9e8;_0x4f989b++){var _0x5d3b28=events[_0x4f989b];var _0x1616ac=createListener(_0xc53e('0x7')+_0x5d3b28,_0x2f1414);VoiceExtensionEvents['on'](_0x5d3b28,_0x1616ac);}}; \ No newline at end of file +var _0x53ec=['length','voiceExtension:','./voiceExtension.events','save','remove','update','emit','removeListener'];(function(_0x5468e5,_0x428c9b){var _0x1f98cf=function(_0x543a20){while(--_0x543a20){_0x5468e5['push'](_0x5468e5['shift']());}};_0x1f98cf(++_0x428c9b);}(_0x53ec,0x192));var _0xc53e=function(_0x513835,_0x93de04){_0x513835=_0x513835-0x0;var _0x567b24=_0x53ec[_0x513835];return _0x567b24;};'use strict';var VoiceExtensionEvents=require(_0xc53e('0x0'));var events=[_0xc53e('0x1'),_0xc53e('0x2'),_0xc53e('0x3')];function createListener(_0x1b04cc,_0xe45c6d){return function(_0x51c435){_0xe45c6d[_0xc53e('0x4')](_0x1b04cc,_0x51c435);};}function removeListener(_0x4e954a,_0x2b90f6){return function(){VoiceExtensionEvents[_0xc53e('0x5')](_0x4e954a,_0x2b90f6);};}exports['register']=function(_0x2f1414){for(var _0x4f989b=0x0,_0x41a9e8=events[_0xc53e('0x6')];_0x4f989b<_0x41a9e8;_0x4f989b++){var _0x5d3b28=events[_0x4f989b];var _0x1616ac=createListener(_0xc53e('0x7')+_0x5d3b28,_0x2f1414);VoiceExtensionEvents['on'](_0x5d3b28,_0x1616ac);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index ee5273f..b5a0f2b 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 _0xdf55=['/:id/messages','getMessages','create','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceMail.controller','get','isAuthenticated','index','/:id','show'];(function(_0x11ddae,_0x4b8ae4){var _0x437c1a=function(_0x5ad06f){while(--_0x5ad06f){_0x11ddae['push'](_0x11ddae['shift']());}};_0x437c1a(++_0x4b8ae4);}(_0xdf55,0x83));var _0x5df5=function(_0x286726,_0x20a337){_0x286726=_0x286726-0x0;var _0xcd4fe9=_0xdf55[_0x286726];return _0xcd4fe9;};'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['post']('/',auth['isAuthenticated'](),controller[_0x5df5('0xf')]);router['put'](_0x5df5('0xb'),auth[_0x5df5('0x9')](),controller['update']);router['delete'](_0x5df5('0xb'),auth[_0x5df5('0x9')](),controller[_0x5df5('0x10')]);module[_0x5df5('0x11')]=router; \ No newline at end of file +var _0x1883=['index','/:id','/:id/messages','getMessages','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated'];(function(_0x568363,_0x2e79a7){var _0x47f0ed=function(_0x7d922b){while(--_0x7d922b){_0x568363['push'](_0x568363['shift']());}};_0x47f0ed(++_0x2e79a7);}(_0x1883,0xab));var _0x3188=function(_0xb1135d,_0xbfa44c){_0xb1135d=_0xb1135d-0x0;var _0x644ac7=_0x1883[_0xb1135d];return _0x644ac7;};'use strict';var multer=require(_0x3188('0x0'));var util=require(_0x3188('0x1'));var path=require(_0x3188('0x2'));var timeout=require(_0x3188('0x3'));var express=require(_0x3188('0x4'));var router=express[_0x3188('0x5')]();var fs_extra=require(_0x3188('0x6'));var auth=require(_0x3188('0x7'));var interaction=require(_0x3188('0x8'));var config=require(_0x3188('0x9'));var controller=require(_0x3188('0xa'));router[_0x3188('0xb')]('/',auth[_0x3188('0xc')](),controller[_0x3188('0xd')]);router[_0x3188('0xb')](_0x3188('0xe'),auth[_0x3188('0xc')](),controller['show']);router[_0x3188('0xb')](_0x3188('0xf'),auth['isAuthenticated'](),controller[_0x3188('0x10')]);router['post']('/',auth[_0x3188('0xc')](),controller[_0x3188('0x11')]);router[_0x3188('0x12')](_0x3188('0xe'),auth['isAuthenticated'](),controller[_0x3188('0x13')]);router[_0x3188('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x3188('0x15')]);module[_0x3188('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index f5f1f19..4ab8146 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 _0x3272=['VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue','string','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3272,0xdd));var _0x2327=function(_0x2bdff1,_0x93df64){_0x2bdff1=_0x2bdff1-0x0;var _0x307796=_0x3272[_0x2bdff1];return _0x307796;};'use strict';var Sequelize=require(_0x2327('0x0'));module[_0x2327('0x1')]={'customer_id':{'type':Sequelize[_0x2327('0x2')]},'context':{'type':Sequelize[_0x2327('0x2')],'defaultValue':_0x2327('0x3'),'unique':_0x2327('0x4')},'mailbox':{'type':Sequelize[_0x2327('0x2')],'defaultValue':'','allowNull':![],'unique':_0x2327('0x4')},'password':{'type':Sequelize[_0x2327('0x2')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x2327('0x2')],'validate':{'isEmail':!![]},'set':function(_0x35c442){this[_0x2327('0x5')]('email',typeof _0x35c442===_0x2327('0x6')&&_0x35c442[_0x2327('0x7')]()?_0x35c442[_0x2327('0x7')]():null);}},'pager':{'type':Sequelize[_0x2327('0x2')]},'tz':{'type':Sequelize[_0x2327('0x2')],'defaultValue':_0x2327('0x8')},'attach':{'type':Sequelize[_0x2327('0x9')](_0x2327('0xa'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0x2327('0x9')]('yes','no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0x2327('0x2')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0x2327('0x9')](_0x2327('0xa'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x2327('0x9')](_0x2327('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x2327('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x2327('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x2327('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x2327('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x2327('0x9')](_0x2327('0xa'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x2327('0x9')](_0x2327('0xa'),'no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0x2327('0xa'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x2327('0x9')](_0x2327('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x2327('0x9')](_0x2327('0xa'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0x2327('0xc')},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x2327('0xd')],'get':function(){return this[_0x2327('0xe')](_0x2327('0xf'))+_0x2327('0x10')+this[_0x2327('0xe')](_0x2327('0x11'));}}}; \ No newline at end of file +var _0x0391=['contest_mailbox','setDataValue','email','string','trim','central','yes','ENUM','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','\x20-\x20','mailbox','sequelize','exports','STRING','from-voicemail'];(function(_0x59c426,_0x46d49b){var _0x36da2f=function(_0x3bbfb4){while(--_0x3bbfb4){_0x59c426['push'](_0x59c426['shift']());}};_0x36da2f(++_0x46d49b);}(_0x0391,0x13f));var _0x1039=function(_0x25a6a9,_0x1e2dee){_0x25a6a9=_0x25a6a9-0x0;var _0x54a112=_0x0391[_0x25a6a9];return _0x54a112;};'use strict';var Sequelize=require(_0x1039('0x0'));module[_0x1039('0x1')]={'customer_id':{'type':Sequelize[_0x1039('0x2')]},'context':{'type':Sequelize[_0x1039('0x2')],'defaultValue':_0x1039('0x3'),'unique':_0x1039('0x4')},'mailbox':{'type':Sequelize[_0x1039('0x2')],'defaultValue':'','allowNull':![],'unique':_0x1039('0x4')},'password':{'type':Sequelize[_0x1039('0x2')]},'fullname':{'type':Sequelize[_0x1039('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x5acd9c){this[_0x1039('0x5')](_0x1039('0x6'),typeof _0x5acd9c===_0x1039('0x7')&&_0x5acd9c[_0x1039('0x8')]()?_0x5acd9c[_0x1039('0x8')]():null);}},'pager':{'type':Sequelize[_0x1039('0x2')]},'tz':{'type':Sequelize[_0x1039('0x2')],'defaultValue':_0x1039('0x9')},'attach':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x1039('0xa'),'allowNull':![]},'saycid':{'type':Sequelize[_0x1039('0xb')](_0x1039('0xa'),'no'),'defaultValue':_0x1039('0xa'),'allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize['ENUM'](_0x1039('0xa'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x1039('0xb')](_0x1039('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x1039('0xb')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x1039('0xb')](_0x1039('0xa'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x1039('0xc'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x1039('0xb')](_0x1039('0xa'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM'](_0x1039('0xa'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x1039('0xa'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0x1039('0xa'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0x1039('0xa'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0x1039('0xd')},'emailsubject':{'type':Sequelize[_0x1039('0x2')]},'emailbody':{'type':Sequelize[_0x1039('0x2')]},'maxsecs':{'type':Sequelize[_0x1039('0xe')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x1039('0xe')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x1039('0xf')],'get':function(){return this[_0x1039('0x10')]('fullname')+_0x1039('0x11')+this['getDataValue'](_0x1039('0x12'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index ceafecf..45cf6f2 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 _0x373d=['count','set','Content-Range','apply','reject','save','update','then','destroy','get','Voicemails','UserProfileResource','error','stack','name','index','map','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','merge','filter','VoiceMail','include','findAll','catch','show','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','getMessages','findOne','VoiceMailMessage','nolimit','pick','mailbox','options','findAndCountAll','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit'];(function(_0x43f290,_0x1a6124){var _0x53e837=function(_0x12f41c){while(--_0x12f41c){_0x43f290['push'](_0x43f290['shift']());}};_0x53e837(++_0x1a6124);}(_0x373d,0x1e2));var _0xd373=function(_0x14ef79,_0x17fa9d){_0x14ef79=_0x14ef79-0x0;var _0x5561dc=_0x373d[_0x14ef79];return _0x5561dc;};'use strict';var emlformat=require(_0xd373('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd373('0x1'));var jsonpatch=require(_0xd373('0x2'));var rp=require(_0xd373('0x3'));var moment=require(_0xd373('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd373('0x5'));var util=require(_0xd373('0x6'));var path=require(_0xd373('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd373('0x8'));var fs=require('fs');var fs_extra=require(_0xd373('0x9'));var _=require(_0xd373('0xa'));var squel=require(_0xd373('0xb'));var crypto=require('crypto');var jsforce=require(_0xd373('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd373('0xd'));var Redis=require(_0xd373('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xd373('0xf'));var as=require(_0xd373('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd373('0x11'));var utils=require(_0xd373('0x12'));var config=require(_0xd373('0x13'));var licenseUtil=require(_0xd373('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4c7f91,_0x5ab89c){_0x5ab89c=_0x5ab89c||0xcc;return function(_0xcd9b8c){if(_0xcd9b8c){return _0x4c7f91[_0xd373('0x15')](_0x5ab89c);}return _0x4c7f91['status'](_0x5ab89c)[_0xd373('0x16')]();};}function respondWithResult(_0x129475,_0x27c161){_0x27c161=_0x27c161||0xc8;return function(_0x23ed86){if(_0x23ed86){return _0x129475[_0xd373('0x17')](_0x27c161)[_0xd373('0x18')](_0x23ed86);}};}function respondWithFilteredResult(_0x20aca5,_0x2eacb1){return function(_0x5a286a){if(_0x5a286a){var _0x2c5854=typeof _0x2eacb1[_0xd373('0x19')]===_0xd373('0x1a')&&typeof _0x2eacb1[_0xd373('0x1b')]==='undefined';var _0x1e26cf=_0x5a286a['count'];var _0x460259=_0x2c5854?0x0:_0x2eacb1[_0xd373('0x19')];var _0x55c5c7=_0x2c5854?_0x5a286a[_0xd373('0x1c')]:_0x2eacb1['offset']+_0x2eacb1['limit'];var _0x23fada;if(_0x55c5c7>=_0x1e26cf){_0x55c5c7=_0x1e26cf;_0x23fada=0xc8;}else{_0x23fada=0xce;}_0x20aca5[_0xd373('0x17')](_0x23fada);return _0x20aca5[_0xd373('0x1d')](_0xd373('0x1e'),_0x460259+'-'+_0x55c5c7+'/'+_0x1e26cf)[_0xd373('0x18')](_0x5a286a);}return null;};}function patchUpdates(_0x181eb2){return function(_0x4ba510){try{jsonpatch[_0xd373('0x1f')](_0x4ba510,_0x181eb2,!![]);}catch(_0xd808f8){return BPromise[_0xd373('0x20')](_0xd808f8);}return _0x4ba510[_0xd373('0x21')]();};}function saveUpdates(_0x165e21,_0x3aa1c5){return function(_0x4f64bd){if(_0x4f64bd){return _0x4f64bd[_0xd373('0x22')](_0x165e21)[_0xd373('0x23')](function(_0x157f81){return _0x157f81;});}return null;};}function removeEntity(_0x209ca7,_0x217ee7){return function(_0x238ffd){if(_0x238ffd){return _0x238ffd[_0xd373('0x24')]()[_0xd373('0x23')](function(){var _0x1ab540=_0x238ffd[_0xd373('0x25')]({'plain':!![]});var _0x437110=_0xd373('0x26');return db[_0xd373('0x27')][_0xd373('0x24')]({'where':{'type':_0x437110,'resourceId':_0x1ab540['id']}})[_0xd373('0x23')](function(){return _0x238ffd;});})[_0xd373('0x23')](function(){_0x209ca7[_0xd373('0x17')](0xcc)[_0xd373('0x16')]();});}};}function handleEntityNotFound(_0x3e657b,_0x470612){return function(_0x45ee58){if(!_0x45ee58){_0x3e657b[_0xd373('0x15')](0x194);}return _0x45ee58;};}function handleError(_0x71c5c,_0x3384a5){_0x3384a5=_0x3384a5||0x1f4;return function(_0xf85ca8){logger[_0xd373('0x28')](_0xf85ca8[_0xd373('0x29')]);if(_0xf85ca8[_0xd373('0x2a')]){delete _0xf85ca8[_0xd373('0x2a')];}_0x71c5c[_0xd373('0x17')](_0x3384a5)['send'](_0xf85ca8);};}exports[_0xd373('0x2b')]=function(_0x490842,_0x498aaa){var _0xedc8f3={},_0x15da6c={},_0x25e016={'count':0x0,'rows':[]};var _0x23024c=_[_0xd373('0x2c')](db['VoiceMail'][_0xd373('0x2d')],function(_0x104156){return{'name':_0x104156['fieldName'],'type':_0x104156[_0xd373('0x2e')][_0xd373('0x2f')]};});_0x15da6c[_0xd373('0x30')]=_[_0xd373('0x2c')](_0x23024c,_0xd373('0x2a'));_0x15da6c[_0xd373('0x31')]=_[_0xd373('0x32')](_0x490842[_0xd373('0x31')]);_0x15da6c[_0xd373('0x33')]=_['intersection'](_0x15da6c[_0xd373('0x30')],_0x15da6c[_0xd373('0x31')]);_0xedc8f3[_0xd373('0x34')]=_[_0xd373('0x35')](_0x15da6c[_0xd373('0x30')],qs[_0xd373('0x36')](_0x490842[_0xd373('0x31')][_0xd373('0x36')]));_0xedc8f3[_0xd373('0x34')]=_0xedc8f3[_0xd373('0x34')][_0xd373('0x37')]?_0xedc8f3[_0xd373('0x34')]:_0x15da6c[_0xd373('0x30')];if(!_0x490842[_0xd373('0x31')][_0xd373('0x38')]('nolimit')){_0xedc8f3[_0xd373('0x1b')]=qs[_0xd373('0x1b')](_0x490842[_0xd373('0x31')][_0xd373('0x1b')]);_0xedc8f3['offset']=qs[_0xd373('0x19')](_0x490842[_0xd373('0x31')][_0xd373('0x19')]);}_0xedc8f3[_0xd373('0x39')]=qs[_0xd373('0x3a')](_0x490842[_0xd373('0x31')]['sort']);_0xedc8f3['where']=qs[_0xd373('0x33')](_['pick'](_0x490842[_0xd373('0x31')],_0x15da6c[_0xd373('0x33')]),_0x23024c);if(_0x490842[_0xd373('0x31')]['filter']){_0xedc8f3[_0xd373('0x3b')]=_[_0xd373('0x3c')](_0xedc8f3[_0xd373('0x3b')],{'$or':_[_0xd373('0x2c')](_0x23024c,function(_0x504450){if(_0x504450['type']!=='VIRTUAL'){var _0x11ec1b={};_0x11ec1b[_0x504450['name']]={'$like':'%'+_0x490842[_0xd373('0x31')][_0xd373('0x3d')]+'%'};return _0x11ec1b;}})});}_0xedc8f3=_['merge']({},_0xedc8f3,_0x490842['options']);var _0x5f3dd5={'where':_0xedc8f3[_0xd373('0x3b')]};return db[_0xd373('0x3e')][_0xd373('0x1c')](_0x5f3dd5)['then'](function(_0x5c3b22){_0x25e016[_0xd373('0x1c')]=_0x5c3b22;if(_0x490842[_0xd373('0x31')]['includeAll']){_0xedc8f3[_0xd373('0x3f')]=[{'all':!![]}];}return db[_0xd373('0x3e')][_0xd373('0x40')](_0xedc8f3);})[_0xd373('0x23')](function(_0x2d8c7d){_0x25e016['rows']=_0x2d8c7d;return _0x25e016;})['then'](respondWithFilteredResult(_0x498aaa,_0xedc8f3))[_0xd373('0x41')](handleError(_0x498aaa,null));};exports[_0xd373('0x42')]=function(_0x30b423,_0x302f65){var _0x5d4dd2={'raw':!![],'where':{'id':_0x30b423['params']['id']}},_0x29725c={};_0x29725c[_0xd373('0x30')]=_[_0xd373('0x32')](db[_0xd373('0x3e')][_0xd373('0x2d')]);_0x29725c[_0xd373('0x31')]=_['keys'](_0x30b423[_0xd373('0x31')]);_0x29725c[_0xd373('0x33')]=_['intersection'](_0x29725c[_0xd373('0x30')],_0x29725c[_0xd373('0x31')]);_0x5d4dd2[_0xd373('0x34')]=_[_0xd373('0x35')](_0x29725c[_0xd373('0x30')],qs[_0xd373('0x36')](_0x30b423[_0xd373('0x31')][_0xd373('0x36')]));_0x5d4dd2[_0xd373('0x34')]=_0x5d4dd2[_0xd373('0x34')]['length']?_0x5d4dd2['attributes']:_0x29725c[_0xd373('0x30')];if(_0x30b423['query'][_0xd373('0x43')]){_0x5d4dd2['include']=[{'all':!![]}];}_0x5d4dd2=_['merge']({},_0x5d4dd2,_0x30b423['options']);return db[_0xd373('0x3e')][_0xd373('0x44')](_0x5d4dd2)[_0xd373('0x23')](handleEntityNotFound(_0x302f65,null))[_0xd373('0x23')](respondWithResult(_0x302f65,null))[_0xd373('0x41')](handleError(_0x302f65,null));};exports[_0xd373('0x45')]=function(_0x1855aa,_0x4d1088){return db[_0xd373('0x3e')]['create'](_0x1855aa[_0xd373('0x46')],{})[_0xd373('0x23')](function(_0x5502e5){var _0x4517ab=_0x1855aa['user'][_0xd373('0x25')]({'plain':!![]});if(!_0x4517ab)throw new Error(_0xd373('0x47'));if(_0x4517ab[_0xd373('0x48')]===_0xd373('0x49')){var _0xe22cbd=_0x5502e5['get']({'plain':!![]});var _0x4971a0='Voicemails';return db[_0xd373('0x4a')][_0xd373('0x44')]({'where':{'name':_0x4971a0,'userProfileId':_0x4517ab['userProfileId']},'raw':!![]})[_0xd373('0x23')](function(_0x3e6766){if(_0x3e6766&&_0x3e6766['autoAssociation']===0x0){return db[_0xd373('0x27')][_0xd373('0x45')]({'name':_0xe22cbd[_0xd373('0x2a')],'resourceId':_0xe22cbd['id'],'type':_0x3e6766[_0xd373('0x2a')],'sectionId':_0x3e6766['id']},{})[_0xd373('0x23')](function(){return _0x5502e5;});}else{return _0x5502e5;}})[_0xd373('0x41')](function(_0xc255ec){logger[_0xd373('0x28')](_0xd373('0x4b'),_0xc255ec);throw _0xc255ec;});}return _0x5502e5;})[_0xd373('0x23')](respondWithResult(_0x4d1088,0xc9))[_0xd373('0x41')](handleError(_0x4d1088,null));};exports['update']=function(_0x4b2645,_0x51ca73){if(_0x4b2645['body']['id']){delete _0x4b2645['body']['id'];}return db['VoiceMail'][_0xd373('0x44')]({'where':{'id':_0x4b2645[_0xd373('0x4c')]['id']}})['then'](handleEntityNotFound(_0x51ca73,null))['then'](saveUpdates(_0x4b2645['body'],null))[_0xd373('0x23')](respondWithResult(_0x51ca73,null))[_0xd373('0x41')](handleError(_0x51ca73,null));};exports['destroy']=function(_0x52fa5b,_0x2230d6){return db[_0xd373('0x3e')][_0xd373('0x44')]({'where':{'id':_0x52fa5b[_0xd373('0x4c')]['id']}})[_0xd373('0x23')](handleEntityNotFound(_0x2230d6,null))['then'](removeEntity(_0x2230d6,null))[_0xd373('0x41')](handleError(_0x2230d6,null));};exports[_0xd373('0x4d')]=function(_0x386e4c,_0x213da6,_0xc607fb){return db[_0xd373('0x3e')][_0xd373('0x4e')]({'where':{'id':_0x386e4c[_0xd373('0x4c')]['id']}})[_0xd373('0x23')](handleEntityNotFound(_0x213da6,null))[_0xd373('0x23')](function(_0x1c21d2){var _0x3ad1ec;var _0x213b3c={},_0x42e45d={};_0x42e45d[_0xd373('0x30')]=_['keys'](db[_0xd373('0x4f')][_0xd373('0x2d')]);_0x42e45d[_0xd373('0x31')]=_['keys'](_0x386e4c[_0xd373('0x31')]);_0x42e45d['filters']=_[_0xd373('0x35')](_0x42e45d['model'],_0x42e45d[_0xd373('0x31')]);_0x213b3c[_0xd373('0x34')]=_[_0xd373('0x35')](_0x42e45d[_0xd373('0x30')],qs[_0xd373('0x36')](_0x386e4c[_0xd373('0x31')][_0xd373('0x36')]));_0x213b3c[_0xd373('0x34')]=_0x213b3c[_0xd373('0x34')][_0xd373('0x37')]?_0x213b3c[_0xd373('0x34')]:_0x42e45d[_0xd373('0x30')];if(!_0x386e4c[_0xd373('0x31')][_0xd373('0x38')](_0xd373('0x50'))){_0x213b3c[_0xd373('0x1b')]=qs[_0xd373('0x1b')](_0x386e4c[_0xd373('0x31')][_0xd373('0x1b')]);_0x213b3c[_0xd373('0x19')]=qs[_0xd373('0x19')](_0x386e4c[_0xd373('0x31')][_0xd373('0x19')]);}_0x213b3c[_0xd373('0x39')]=qs[_0xd373('0x3a')](_0x386e4c[_0xd373('0x31')]['sort']);_0x213b3c[_0xd373('0x3b')]=qs[_0xd373('0x33')](_[_0xd373('0x51')](_0x386e4c['query'],_0x42e45d[_0xd373('0x33')]));if(_0x386e4c[_0xd373('0x31')][_0xd373('0x3d')]){_0x213b3c[_0xd373('0x3b')]=_[_0xd373('0x3c')](_0x213b3c[_0xd373('0x3b')],{'$or':_[_0xd373('0x2c')](_0x213b3c['attributes'],function(_0x1afe12){var _0x356820={};_0x356820[_0x1afe12]={'$like':'%'+_0x386e4c[_0xd373('0x31')][_0xd373('0x3d')]+'%'};return _0x356820;})});}_0x213b3c[_0xd373('0x3b')]=_[_0xd373('0x3c')](_0x213b3c[_0xd373('0x3b')],{'mailboxuser':_0x1c21d2[_0xd373('0x52')]});_0x213b3c=_['merge']({},_0x213b3c,_0x386e4c[_0xd373('0x53')]);return db['VoiceMailMessage'][_0xd373('0x54')](_0x213b3c)[_0xd373('0x23')](respondWithFilteredResult(_0x213da6,_0x213b3c));})[_0xd373('0x41')](handleError(_0x213da6,null));}; \ No newline at end of file +var _0x9c00=['name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','offset','order','sort','pick','filter','merge','where','VIRTUAL','options','VoiceMail','includeAll','include','rows','catch','show','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','getMessages','findOne','VoiceMailMessage','mailbox','findAndCountAll','eml-format','rimraf','request-promise','moment','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/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','Content-Range','apply','reject','update','destroy','get','Voicemails','UserProfileResource','then','stack'];(function(_0x52c10f,_0x3fadcf){var _0x5cf1f2=function(_0x5caa7d){while(--_0x5caa7d){_0x52c10f['push'](_0x52c10f['shift']());}};_0x5cf1f2(++_0x3fadcf);}(_0x9c00,0x1a0));var _0x09c0=function(_0x544baa,_0x1b17fe){_0x544baa=_0x544baa-0x0;var _0x5e8cc1=_0x9c00[_0x544baa];return _0x5e8cc1;};'use strict';var emlformat=require(_0x09c0('0x0'));var rimraf=require(_0x09c0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x09c0('0x2'));var moment=require(_0x09c0('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x09c0('0x4'));var util=require(_0x09c0('0x5'));var path=require(_0x09c0('0x6'));var sox=require(_0x09c0('0x7'));var csv=require(_0x09c0('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x09c0('0x9'));var squel=require(_0x09c0('0xa'));var crypto=require(_0x09c0('0xb'));var jsforce=require(_0x09c0('0xc'));var deskjs=require(_0x09c0('0xd'));var toCsv=require('to-csv');var querystring=require(_0x09c0('0xe'));var Papa=require(_0x09c0('0xf'));var Redis=require(_0x09c0('0x10'));var authService=require(_0x09c0('0x11'));var qs=require(_0x09c0('0x12'));var as=require(_0x09c0('0x13'));var hardwareService=require(_0x09c0('0x14'));var logger=require(_0x09c0('0x15'))(_0x09c0('0x16'));var utils=require(_0x09c0('0x17'));var config=require(_0x09c0('0x18'));var licenseUtil=require(_0x09c0('0x19'));var db=require(_0x09c0('0x1a'))['db'];function respondWithStatusCode(_0x144271,_0x3b95cc){_0x3b95cc=_0x3b95cc||0xcc;return function(_0x331905){if(_0x331905){return _0x144271[_0x09c0('0x1b')](_0x3b95cc);}return _0x144271[_0x09c0('0x1c')](_0x3b95cc)[_0x09c0('0x1d')]();};}function respondWithResult(_0x3649d2,_0x16e490){_0x16e490=_0x16e490||0xc8;return function(_0x254598){if(_0x254598){return _0x3649d2[_0x09c0('0x1c')](_0x16e490)[_0x09c0('0x1e')](_0x254598);}};}function respondWithFilteredResult(_0x33c3d6,_0x2fdf11){return function(_0x4ff6b7){if(_0x4ff6b7){var _0x590129=typeof _0x2fdf11['offset']===_0x09c0('0x1f')&&typeof _0x2fdf11[_0x09c0('0x20')]===_0x09c0('0x1f');var _0x628272=_0x4ff6b7['count'];var _0x2c4440=_0x590129?0x0:_0x2fdf11['offset'];var _0x4c29a7=_0x590129?_0x4ff6b7[_0x09c0('0x21')]:_0x2fdf11['offset']+_0x2fdf11[_0x09c0('0x20')];var _0x319c36;if(_0x4c29a7>=_0x628272){_0x4c29a7=_0x628272;_0x319c36=0xc8;}else{_0x319c36=0xce;}_0x33c3d6[_0x09c0('0x1c')](_0x319c36);return _0x33c3d6['set'](_0x09c0('0x22'),_0x2c4440+'-'+_0x4c29a7+'/'+_0x628272)[_0x09c0('0x1e')](_0x4ff6b7);}return null;};}function patchUpdates(_0x8ad645){return function(_0x3447c5){try{jsonpatch[_0x09c0('0x23')](_0x3447c5,_0x8ad645,!![]);}catch(_0xa5d16f){return BPromise[_0x09c0('0x24')](_0xa5d16f);}return _0x3447c5['save']();};}function saveUpdates(_0x1695e8,_0x46f171){return function(_0x473fbd){if(_0x473fbd){return _0x473fbd[_0x09c0('0x25')](_0x1695e8)['then'](function(_0x4f6824){return _0x4f6824;});}return null;};}function removeEntity(_0x321bcc,_0x25fdb5){return function(_0x1e8a1c){if(_0x1e8a1c){return _0x1e8a1c[_0x09c0('0x26')]()['then'](function(){var _0x42ebfc=_0x1e8a1c[_0x09c0('0x27')]({'plain':!![]});var _0x56d883=_0x09c0('0x28');return db[_0x09c0('0x29')][_0x09c0('0x26')]({'where':{'type':_0x56d883,'resourceId':_0x42ebfc['id']}})[_0x09c0('0x2a')](function(){return _0x1e8a1c;});})[_0x09c0('0x2a')](function(){_0x321bcc[_0x09c0('0x1c')](0xcc)[_0x09c0('0x1d')]();});}};}function handleEntityNotFound(_0x35b61c,_0x1ea951){return function(_0x1aa80e){if(!_0x1aa80e){_0x35b61c[_0x09c0('0x1b')](0x194);}return _0x1aa80e;};}function handleError(_0x5e53ac,_0x15a667){_0x15a667=_0x15a667||0x1f4;return function(_0x1bdde9){logger['error'](_0x1bdde9[_0x09c0('0x2b')]);if(_0x1bdde9['name']){delete _0x1bdde9[_0x09c0('0x2c')];}_0x5e53ac['status'](_0x15a667)[_0x09c0('0x2d')](_0x1bdde9);};}exports[_0x09c0('0x2e')]=function(_0x108409,_0x4159bc){var _0x4e999a={},_0x5478b7={},_0x17c374={'count':0x0,'rows':[]};var _0x38a315=_[_0x09c0('0x2f')](db['VoiceMail'][_0x09c0('0x30')],function(_0x4bdae9){return{'name':_0x4bdae9[_0x09c0('0x31')],'type':_0x4bdae9[_0x09c0('0x32')][_0x09c0('0x33')]};});_0x5478b7['model']=_[_0x09c0('0x2f')](_0x38a315,_0x09c0('0x2c'));_0x5478b7[_0x09c0('0x34')]=_[_0x09c0('0x35')](_0x108409[_0x09c0('0x34')]);_0x5478b7[_0x09c0('0x36')]=_[_0x09c0('0x37')](_0x5478b7['model'],_0x5478b7[_0x09c0('0x34')]);_0x4e999a[_0x09c0('0x38')]=_[_0x09c0('0x37')](_0x5478b7[_0x09c0('0x39')],qs[_0x09c0('0x3a')](_0x108409['query'][_0x09c0('0x3a')]));_0x4e999a[_0x09c0('0x38')]=_0x4e999a[_0x09c0('0x38')][_0x09c0('0x3b')]?_0x4e999a[_0x09c0('0x38')]:_0x5478b7['model'];if(!_0x108409[_0x09c0('0x34')][_0x09c0('0x3c')](_0x09c0('0x3d'))){_0x4e999a[_0x09c0('0x20')]=qs[_0x09c0('0x20')](_0x108409[_0x09c0('0x34')][_0x09c0('0x20')]);_0x4e999a['offset']=qs[_0x09c0('0x3e')](_0x108409[_0x09c0('0x34')][_0x09c0('0x3e')]);}_0x4e999a[_0x09c0('0x3f')]=qs[_0x09c0('0x40')](_0x108409['query']['sort']);_0x4e999a['where']=qs['filters'](_[_0x09c0('0x41')](_0x108409[_0x09c0('0x34')],_0x5478b7[_0x09c0('0x36')]),_0x38a315);if(_0x108409[_0x09c0('0x34')][_0x09c0('0x42')]){_0x4e999a['where']=_[_0x09c0('0x43')](_0x4e999a[_0x09c0('0x44')],{'$or':_['map'](_0x38a315,function(_0x1067cf){if(_0x1067cf['type']!==_0x09c0('0x45')){var _0x5c80a2={};_0x5c80a2[_0x1067cf[_0x09c0('0x2c')]]={'$like':'%'+_0x108409[_0x09c0('0x34')]['filter']+'%'};return _0x5c80a2;}})});}_0x4e999a=_[_0x09c0('0x43')]({},_0x4e999a,_0x108409[_0x09c0('0x46')]);var _0x5d69fd={'where':_0x4e999a[_0x09c0('0x44')]};return db[_0x09c0('0x47')][_0x09c0('0x21')](_0x5d69fd)[_0x09c0('0x2a')](function(_0xeb8191){_0x17c374[_0x09c0('0x21')]=_0xeb8191;if(_0x108409['query'][_0x09c0('0x48')]){_0x4e999a[_0x09c0('0x49')]=[{'all':!![]}];}return db[_0x09c0('0x47')]['findAll'](_0x4e999a);})[_0x09c0('0x2a')](function(_0x30c0c5){_0x17c374[_0x09c0('0x4a')]=_0x30c0c5;return _0x17c374;})['then'](respondWithFilteredResult(_0x4159bc,_0x4e999a))[_0x09c0('0x4b')](handleError(_0x4159bc,null));};exports[_0x09c0('0x4c')]=function(_0x52cd5c,_0x5bbf4e){var _0x397e73={'raw':!![],'where':{'id':_0x52cd5c['params']['id']}},_0x471078={};_0x471078[_0x09c0('0x39')]=_[_0x09c0('0x35')](db['VoiceMail'][_0x09c0('0x30')]);_0x471078[_0x09c0('0x34')]=_[_0x09c0('0x35')](_0x52cd5c[_0x09c0('0x34')]);_0x471078[_0x09c0('0x36')]=_['intersection'](_0x471078[_0x09c0('0x39')],_0x471078['query']);_0x397e73['attributes']=_[_0x09c0('0x37')](_0x471078[_0x09c0('0x39')],qs[_0x09c0('0x3a')](_0x52cd5c[_0x09c0('0x34')][_0x09c0('0x3a')]));_0x397e73[_0x09c0('0x38')]=_0x397e73['attributes']['length']?_0x397e73['attributes']:_0x471078[_0x09c0('0x39')];if(_0x52cd5c[_0x09c0('0x34')][_0x09c0('0x48')]){_0x397e73['include']=[{'all':!![]}];}_0x397e73=_[_0x09c0('0x43')]({},_0x397e73,_0x52cd5c[_0x09c0('0x46')]);return db[_0x09c0('0x47')][_0x09c0('0x4d')](_0x397e73)[_0x09c0('0x2a')](handleEntityNotFound(_0x5bbf4e,null))[_0x09c0('0x2a')](respondWithResult(_0x5bbf4e,null))[_0x09c0('0x4b')](handleError(_0x5bbf4e,null));};exports[_0x09c0('0x4e')]=function(_0x3f6d14,_0x38085c){return db[_0x09c0('0x47')][_0x09c0('0x4e')](_0x3f6d14[_0x09c0('0x4f')],{})[_0x09c0('0x2a')](function(_0x332b69){var _0x32abbe=_0x3f6d14[_0x09c0('0x50')][_0x09c0('0x27')]({'plain':!![]});if(!_0x32abbe)throw new Error(_0x09c0('0x51'));if(_0x32abbe[_0x09c0('0x52')]==='user'){var _0x4acf54=_0x332b69[_0x09c0('0x27')]({'plain':!![]});var _0x15b0a2=_0x09c0('0x28');return db[_0x09c0('0x53')]['find']({'where':{'name':_0x15b0a2,'userProfileId':_0x32abbe[_0x09c0('0x54')]},'raw':!![]})[_0x09c0('0x2a')](function(_0x1823c2){if(_0x1823c2&&_0x1823c2['autoAssociation']===0x0){return db[_0x09c0('0x29')][_0x09c0('0x4e')]({'name':_0x4acf54[_0x09c0('0x2c')],'resourceId':_0x4acf54['id'],'type':_0x1823c2[_0x09c0('0x2c')],'sectionId':_0x1823c2['id']},{})[_0x09c0('0x2a')](function(){return _0x332b69;});}else{return _0x332b69;}})[_0x09c0('0x4b')](function(_0x45ecd0){logger['error'](_0x09c0('0x55'),_0x45ecd0);throw _0x45ecd0;});}return _0x332b69;})[_0x09c0('0x2a')](respondWithResult(_0x38085c,0xc9))[_0x09c0('0x4b')](handleError(_0x38085c,null));};exports[_0x09c0('0x25')]=function(_0x21fe00,_0x316fbd){if(_0x21fe00[_0x09c0('0x4f')]['id']){delete _0x21fe00['body']['id'];}return db['VoiceMail'][_0x09c0('0x4d')]({'where':{'id':_0x21fe00[_0x09c0('0x56')]['id']}})[_0x09c0('0x2a')](handleEntityNotFound(_0x316fbd,null))['then'](saveUpdates(_0x21fe00[_0x09c0('0x4f')],null))['then'](respondWithResult(_0x316fbd,null))[_0x09c0('0x4b')](handleError(_0x316fbd,null));};exports[_0x09c0('0x26')]=function(_0x42d4dd,_0x290618){return db[_0x09c0('0x47')][_0x09c0('0x4d')]({'where':{'id':_0x42d4dd[_0x09c0('0x56')]['id']}})['then'](handleEntityNotFound(_0x290618,null))[_0x09c0('0x2a')](removeEntity(_0x290618,null))[_0x09c0('0x4b')](handleError(_0x290618,null));};exports[_0x09c0('0x57')]=function(_0x270ff2,_0x3a6845,_0x219195){return db[_0x09c0('0x47')][_0x09c0('0x58')]({'where':{'id':_0x270ff2[_0x09c0('0x56')]['id']}})[_0x09c0('0x2a')](handleEntityNotFound(_0x3a6845,null))[_0x09c0('0x2a')](function(_0x4c4339){var _0x34cc0a;var _0x3564e6={},_0x26dc22={};_0x26dc22[_0x09c0('0x39')]=_['keys'](db[_0x09c0('0x59')]['rawAttributes']);_0x26dc22[_0x09c0('0x34')]=_[_0x09c0('0x35')](_0x270ff2[_0x09c0('0x34')]);_0x26dc22['filters']=_['intersection'](_0x26dc22[_0x09c0('0x39')],_0x26dc22[_0x09c0('0x34')]);_0x3564e6[_0x09c0('0x38')]=_[_0x09c0('0x37')](_0x26dc22['model'],qs[_0x09c0('0x3a')](_0x270ff2[_0x09c0('0x34')]['fields']));_0x3564e6[_0x09c0('0x38')]=_0x3564e6[_0x09c0('0x38')][_0x09c0('0x3b')]?_0x3564e6[_0x09c0('0x38')]:_0x26dc22['model'];if(!_0x270ff2[_0x09c0('0x34')][_0x09c0('0x3c')](_0x09c0('0x3d'))){_0x3564e6[_0x09c0('0x20')]=qs[_0x09c0('0x20')](_0x270ff2[_0x09c0('0x34')][_0x09c0('0x20')]);_0x3564e6[_0x09c0('0x3e')]=qs[_0x09c0('0x3e')](_0x270ff2[_0x09c0('0x34')][_0x09c0('0x3e')]);}_0x3564e6[_0x09c0('0x3f')]=qs[_0x09c0('0x40')](_0x270ff2['query'][_0x09c0('0x40')]);_0x3564e6[_0x09c0('0x44')]=qs[_0x09c0('0x36')](_[_0x09c0('0x41')](_0x270ff2[_0x09c0('0x34')],_0x26dc22['filters']));if(_0x270ff2[_0x09c0('0x34')][_0x09c0('0x42')]){_0x3564e6[_0x09c0('0x44')]=_[_0x09c0('0x43')](_0x3564e6['where'],{'$or':_[_0x09c0('0x2f')](_0x3564e6[_0x09c0('0x38')],function(_0x569462){var _0x325013={};_0x325013[_0x569462]={'$like':'%'+_0x270ff2[_0x09c0('0x34')][_0x09c0('0x42')]+'%'};return _0x325013;})});}_0x3564e6[_0x09c0('0x44')]=_[_0x09c0('0x43')](_0x3564e6['where'],{'mailboxuser':_0x4c4339[_0x09c0('0x5a')]});_0x3564e6=_[_0x09c0('0x43')]({},_0x3564e6,_0x270ff2[_0x09c0('0x46')]);return db[_0x09c0('0x59')][_0x09c0('0x5b')](_0x3564e6)['then'](respondWithFilteredResult(_0x3a6845,_0x3564e6));})[_0x09c0('0x4b')](handleError(_0x3a6845,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 2cf5b21..c3dc838 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 _0x6ebf=['mailbox_context','mailbox','context','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./voiceMail.attributes','define','VoiceMail','voice_voicemail'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x6ebf,0x99));var _0xf6eb=function(_0x1cc961,_0x2c42ee){_0x1cc961=_0x1cc961-0x0;var _0x471d86=_0x6ebf[_0x1cc961];return _0x471d86;};'use strict';var _=require(_0xf6eb('0x0'));var util=require('util');var logger=require(_0xf6eb('0x1'))(_0xf6eb('0x2'));var moment=require(_0xf6eb('0x3'));var BPromise=require(_0xf6eb('0x4'));var rp=require(_0xf6eb('0x5'));var fs=require('fs');var path=require(_0xf6eb('0x6'));var rimraf=require('rimraf');var config=require(_0xf6eb('0x7'));var attributes=require(_0xf6eb('0x8'));module['exports']=function(_0x324c5d,_0x1fcb18){return _0x324c5d[_0xf6eb('0x9')](_0xf6eb('0xa'),attributes,{'tableName':_0xf6eb('0xb'),'paranoid':![],'indexes':[{'name':_0xf6eb('0xc'),'fields':[_0xf6eb('0xd'),_0xf6eb('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3d13=['path','rimraf','../../config/environment','./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail','mailbox_context','context','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0x3d13,0xaa));var _0x33d1=function(_0x55a49d,_0x40d730){_0x55a49d=_0x55a49d-0x0;var _0x503b34=_0x3d13[_0x55a49d];return _0x503b34;};'use strict';var _=require(_0x33d1('0x0'));var util=require(_0x33d1('0x1'));var logger=require(_0x33d1('0x2'))(_0x33d1('0x3'));var moment=require(_0x33d1('0x4'));var BPromise=require('bluebird');var rp=require(_0x33d1('0x5'));var fs=require('fs');var path=require(_0x33d1('0x6'));var rimraf=require(_0x33d1('0x7'));var config=require(_0x33d1('0x8'));var attributes=require(_0x33d1('0x9'));module[_0x33d1('0xa')]=function(_0x28f7c9,_0x59235b){return _0x28f7c9[_0x33d1('0xb')](_0x33d1('0xc'),attributes,{'tableName':_0x33d1('0xd'),'paranoid':![],'indexes':[{'name':_0x33d1('0xe'),'fields':['mailbox',_0x33d1('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 7c66369..e0aa3f1 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 _0x4dd3=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','debug','VoiceMail,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','VoiceMail,\x20%s,\x20%s','result'];(function(_0x385f2b,_0xa304e9){var _0x153647=function(_0x2422ce){while(--_0x2422ce){_0x385f2b['push'](_0x385f2b['shift']());}};_0x153647(++_0xa304e9);}(_0x4dd3,0xcf));var _0x34dd=function(_0x2ca9d4,_0x51d5c6){_0x2ca9d4=_0x2ca9d4-0x0;var _0x258956=_0x4dd3[_0x2ca9d4];return _0x258956;};'use strict';var _=require('lodash');var util=require(_0x34dd('0x0'));var moment=require('moment');var BPromise=require(_0x34dd('0x1'));var rs=require(_0x34dd('0x2'));var fs=require('fs');var Redis=require(_0x34dd('0x3'));var db=require(_0x34dd('0x4'))['db'];var utils=require(_0x34dd('0x5'));var logger=require(_0x34dd('0x6'))('rpc');var config=require(_0x34dd('0x7'));var jayson=require(_0x34dd('0x8'));var client=jayson[_0x34dd('0x9')][_0x34dd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4ba932,_0x1c7368,_0x3e5d75){return new BPromise(function(_0x3231c2,_0x30acba){return client[_0x34dd('0xb')](_0x4ba932,_0x3e5d75)[_0x34dd('0xc')](function(_0x513ac7){logger[_0x34dd('0xd')]('VoiceMail,\x20%s,\x20%s',_0x1c7368,'request\x20sent');logger[_0x34dd('0xe')](_0x34dd('0xf'),_0x1c7368,_0x34dd('0x10'),JSON[_0x34dd('0x11')](_0x513ac7));if(_0x513ac7[_0x34dd('0x12')]){if(_0x513ac7[_0x34dd('0x12')][_0x34dd('0x13')]===0x1f4){logger['error']('VoiceMail,\x20%s,\x20%s',_0x1c7368,_0x513ac7['error'][_0x34dd('0x14')]);return _0x30acba(_0x513ac7['error']['message']);}logger[_0x34dd('0x12')](_0x34dd('0x15'),_0x1c7368,_0x513ac7['error']['message']);return _0x3231c2(_0x513ac7['error']['message']);}else{logger[_0x34dd('0xd')](_0x34dd('0x15'),_0x1c7368,_0x34dd('0x10'));_0x3231c2(_0x513ac7[_0x34dd('0x16')]['message']);}})['catch'](function(_0x299e13){logger[_0x34dd('0x12')](_0x34dd('0x15'),_0x1c7368,_0x299e13);_0x30acba(_0x299e13);});});} \ No newline at end of file +var _0x0948=['jayson/promise','client','http','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4a3456,_0x1a951c){var _0x1f91f8=function(_0x582e20){while(--_0x582e20){_0x4a3456['push'](_0x4a3456['shift']());}};_0x1f91f8(++_0x1a951c);}(_0x0948,0x176));var _0x8094=function(_0x237bf7,_0xb851fc){_0x237bf7=_0x237bf7-0x0;var _0x5928ba=_0x0948[_0x237bf7];return _0x5928ba;};'use strict';var _=require(_0x8094('0x0'));var util=require(_0x8094('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8094('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8094('0x3'))['db'];var utils=require(_0x8094('0x4'));var logger=require(_0x8094('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8094('0x6'));var client=jayson[_0x8094('0x7')][_0x8094('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x18d1f3,_0x13f693,_0x189d39){return new BPromise(function(_0x3e326,_0x161c88){return client['request'](_0x18d1f3,_0x189d39)[_0x8094('0x9')](function(_0x1c17e1){logger[_0x8094('0xa')](_0x8094('0xb'),_0x13f693,_0x8094('0xc'));logger[_0x8094('0xd')](_0x8094('0xe'),_0x13f693,_0x8094('0xc'),JSON[_0x8094('0xf')](_0x1c17e1));if(_0x1c17e1[_0x8094('0x10')]){if(_0x1c17e1[_0x8094('0x10')]['code']===0x1f4){logger['error'](_0x8094('0xb'),_0x13f693,_0x1c17e1[_0x8094('0x10')][_0x8094('0x11')]);return _0x161c88(_0x1c17e1[_0x8094('0x10')]['message']);}logger['error'](_0x8094('0xb'),_0x13f693,_0x1c17e1[_0x8094('0x10')][_0x8094('0x11')]);return _0x3e326(_0x1c17e1[_0x8094('0x10')][_0x8094('0x11')]);}else{logger[_0x8094('0xa')]('VoiceMail,\x20%s,\x20%s',_0x13f693,_0x8094('0xc'));_0x3e326(_0x1c17e1[_0x8094('0x12')][_0x8094('0x11')]);}})[_0x8094('0x13')](function(_0x2e1d5c){logger['error'](_0x8094('0xb'),_0x13f693,_0x2e1d5c);_0x161c88(_0x2e1d5c);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 159c310..9a39fc2 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 _0x6d87=['/:id','show','download','create','update','destroy','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','./voiceMailMessage.controller','get','isAuthenticated','index'];(function(_0x4d48fa,_0x5e647c){var _0x20fbbd=function(_0x14d5e5){while(--_0x14d5e5){_0x4d48fa['push'](_0x4d48fa['shift']());}};_0x20fbbd(++_0x5e647c);}(_0x6d87,0xe4));var _0x76d8=function(_0x203d56,_0x5dfbf7){_0x203d56=_0x203d56-0x0;var _0x35c93d=_0x6d87[_0x203d56];return _0x35c93d;};'use strict';var multer=require(_0x76d8('0x0'));var util=require(_0x76d8('0x1'));var path=require('path');var timeout=require(_0x76d8('0x2'));var express=require(_0x76d8('0x3'));var router=express[_0x76d8('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x76d8('0x5'));var config=require('../../config/environment');var controller=require(_0x76d8('0x6'));router[_0x76d8('0x7')]('/',auth[_0x76d8('0x8')](),controller[_0x76d8('0x9')]);router[_0x76d8('0x7')](_0x76d8('0xa'),auth['isAuthenticated'](),controller[_0x76d8('0xb')]);router[_0x76d8('0x7')]('/:id/download',auth[_0x76d8('0x8')](),controller[_0x76d8('0xc')]);router['post']('/',auth[_0x76d8('0x8')](),controller[_0x76d8('0xd')]);router['put'](_0x76d8('0xa'),auth['isAuthenticated'](),controller[_0x76d8('0xe')]);router['delete'](_0x76d8('0xa'),auth[_0x76d8('0x8')](),controller[_0x76d8('0xf')]);module[_0x76d8('0x10')]=router; \ No newline at end of file +var _0xfd06=['get','isAuthenticated','index','/:id','show','download','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller'];(function(_0x117490,_0x22f108){var _0x4747b7=function(_0x4c4d70){while(--_0x4c4d70){_0x117490['push'](_0x117490['shift']());}};_0x4747b7(++_0x22f108);}(_0xfd06,0x175));var _0x6fd0=function(_0x5de6c9,_0x471538){_0x5de6c9=_0x5de6c9-0x0;var _0x4f45f6=_0xfd06[_0x5de6c9];return _0x4f45f6;};'use strict';var multer=require(_0x6fd0('0x0'));var util=require(_0x6fd0('0x1'));var path=require(_0x6fd0('0x2'));var timeout=require(_0x6fd0('0x3'));var express=require(_0x6fd0('0x4'));var router=express[_0x6fd0('0x5')]();var fs_extra=require(_0x6fd0('0x6'));var auth=require(_0x6fd0('0x7'));var interaction=require(_0x6fd0('0x8'));var config=require(_0x6fd0('0x9'));var controller=require(_0x6fd0('0xa'));router[_0x6fd0('0xb')]('/',auth[_0x6fd0('0xc')](),controller[_0x6fd0('0xd')]);router[_0x6fd0('0xb')](_0x6fd0('0xe'),auth[_0x6fd0('0xc')](),controller[_0x6fd0('0xf')]);router[_0x6fd0('0xb')]('/:id/download',auth['isAuthenticated'](),controller[_0x6fd0('0x10')]);router[_0x6fd0('0x11')]('/',auth[_0x6fd0('0xc')](),controller[_0x6fd0('0x12')]);router[_0x6fd0('0x13')](_0x6fd0('0xe'),auth[_0x6fd0('0xc')](),controller[_0x6fd0('0x14')]);router[_0x6fd0('0x15')](_0x6fd0('0xe'),auth[_0x6fd0('0xc')](),controller[_0x6fd0('0x16')]);module[_0x6fd0('0x17')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 22c68ea..c41f433 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 _0x2a3a=['INTEGER','STRING','long','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','VIRTUAL'];(function(_0x219a56,_0x2b4e14){var _0x47d120=function(_0x103b7d){while(--_0x103b7d){_0x219a56['push'](_0x219a56['shift']());}};_0x47d120(++_0x2b4e14);}(_0x2a3a,0x1c8));var _0xa2a3=function(_0x2d3a2a,_0x5dd964){_0x2d3a2a=_0x2d3a2a-0x0;var _0x4d9697=_0x2a3a[_0x2d3a2a];return _0x4d9697;};'use strict';var Sequelize=require(_0xa2a3('0x0'));module[_0xa2a3('0x1')]={'name':{'type':Sequelize[_0xa2a3('0x2')],'get':function(_0x345bac){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize[_0xa2a3('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xa2a3('0x4')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0xa2a3('0x4')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize[_0xa2a3('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xa2a3('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xa2a3('0x4')],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0xa2a3('0x5')),'defaultValue':null},'flag':{'type':Sequelize[_0xa2a3('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xa2a3('0x4')],'defaultValue':''},'stamp':{'type':_0xa2a3('0x6'),'defaultValue':Sequelize[_0xa2a3('0x7')](_0xa2a3('0x8'))}}; \ No newline at end of file +var _0xd8b6=['INTEGER','STRING','BLOB','long','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','VIRTUAL'];(function(_0x319e2e,_0x2f727f){var _0x302524=function(_0x5cad9d){while(--_0x5cad9d){_0x319e2e['push'](_0x319e2e['shift']());}};_0x302524(++_0x2f727f);}(_0xd8b6,0x66));var _0x6d8b=function(_0x54c695,_0x5d6677){_0x54c695=_0x54c695-0x0;var _0x3ce06b=_0xd8b6[_0x54c695];return _0x3ce06b;};'use strict';var Sequelize=require(_0x6d8b('0x0'));module['exports']={'name':{'type':Sequelize[_0x6d8b('0x1')],'get':function(_0x598814){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize[_0x6d8b('0x2')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x6d8b('0x3')],'defaultValue':''},'context':{'type':Sequelize[_0x6d8b('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x6d8b('0x3')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x6d8b('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x6d8b('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0x6d8b('0x4')](_0x6d8b('0x5')),'defaultValue':null},'flag':{'type':Sequelize[_0x6d8b('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':'TIMESTAMP','defaultValue':Sequelize[_0x6d8b('0x6')](_0x6d8b('0x7'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index c898f3a..246c59f 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 _0x933a=['offset','undefined','count','limit','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','VoiceMailMessage','includeAll','findAll','rows','catch','params','include','find','create','body','download','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','set','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','end','status','json'];(function(_0x2af349,_0x352f75){var _0x125bbe=function(_0x2e7d03){while(--_0x2e7d03){_0x2af349['push'](_0x2af349['shift']());}};_0x125bbe(++_0x352f75);}(_0x933a,0x90));var _0xa933=function(_0x52ed01,_0x1b9fd9){_0x52ed01=_0x52ed01-0x0;var _0x630ace=_0x933a[_0x52ed01];return _0x630ace;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa933('0x0'));var zipdir=require(_0xa933('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa933('0x2'));var moment=require(_0xa933('0x3'));var BPromise=require(_0xa933('0x4'));var Mustache=require(_0xa933('0x5'));var util=require(_0xa933('0x6'));var path=require(_0xa933('0x7'));var sox=require(_0xa933('0x8'));var csv=require(_0xa933('0x9'));var ejs=require(_0xa933('0xa'));var fs=require('fs');var fs_extra=require(_0xa933('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa933('0xc'));var deskjs=require(_0xa933('0xd'));var toCsv=require(_0xa933('0x9'));var querystring=require(_0xa933('0xe'));var Papa=require(_0xa933('0xf'));var Redis=require(_0xa933('0x10'));var authService=require(_0xa933('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xa933('0x12'));var hardwareService=require(_0xa933('0x13'));var logger=require(_0xa933('0x14'))(_0xa933('0x15'));var utils=require(_0xa933('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xa933('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xfbd3f8,_0x418828){_0x418828=_0x418828||0xcc;return function(_0xac7e80){if(_0xac7e80){return _0xfbd3f8[_0xa933('0x18')](_0x418828);}return _0xfbd3f8['status'](_0x418828)[_0xa933('0x19')]();};}function respondWithResult(_0xf83163,_0x36232d){_0x36232d=_0x36232d||0xc8;return function(_0x813385){if(_0x813385){return _0xf83163[_0xa933('0x1a')](_0x36232d)[_0xa933('0x1b')](_0x813385);}};}function respondWithFilteredResult(_0x23280e,_0x2c96ea){return function(_0x315db9){if(_0x315db9){var _0x2c43cb=typeof _0x2c96ea[_0xa933('0x1c')]==='undefined'&&typeof _0x2c96ea['limit']===_0xa933('0x1d');var _0x17854f=_0x315db9[_0xa933('0x1e')];var _0x181e3b=_0x2c43cb?0x0:_0x2c96ea['offset'];var _0x2c5840=_0x2c43cb?_0x315db9['count']:_0x2c96ea['offset']+_0x2c96ea[_0xa933('0x1f')];var _0x4d497f;if(_0x2c5840>=_0x17854f){_0x2c5840=_0x17854f;_0x4d497f=0xc8;}else{_0x4d497f=0xce;}_0x23280e['status'](_0x4d497f);return _0x23280e['set'](_0xa933('0x20'),_0x181e3b+'-'+_0x2c5840+'/'+_0x17854f)[_0xa933('0x1b')](_0x315db9);}return null;};}function patchUpdates(_0x46f06f){return function(_0x59c26e){try{jsonpatch[_0xa933('0x21')](_0x59c26e,_0x46f06f,!![]);}catch(_0x4cc798){return BPromise[_0xa933('0x22')](_0x4cc798);}return _0x59c26e['save']();};}function saveUpdates(_0x4e53cc,_0x89a449){return function(_0x4efd2c){if(_0x4efd2c){return _0x4efd2c[_0xa933('0x23')](_0x4e53cc)[_0xa933('0x24')](function(_0x314672){return _0x314672;});}return null;};}function removeEntity(_0x34f49a,_0x459281){return function(_0x399d5e){if(_0x399d5e){return _0x399d5e[_0xa933('0x25')]()[_0xa933('0x24')](function(){_0x34f49a['status'](0xcc)[_0xa933('0x19')]();});}};}function handleEntityNotFound(_0x80b4f8,_0x1ad701){return function(_0x27db5a){if(!_0x27db5a){_0x80b4f8[_0xa933('0x18')](0x194);}return _0x27db5a;};}function handleError(_0x2cd695,_0x518f34){_0x518f34=_0x518f34||0x1f4;return function(_0x2697c3){logger[_0xa933('0x26')](_0x2697c3[_0xa933('0x27')]);if(_0x2697c3[_0xa933('0x28')]){delete _0x2697c3[_0xa933('0x28')];}_0x2cd695[_0xa933('0x1a')](_0x518f34)[_0xa933('0x29')](_0x2697c3);};}exports['index']=function(_0xeec183,_0x291d29){var _0x3e8339={},_0x10a961={},_0x169275={'count':0x0,'rows':[]};var _0x14a4e4=_[_0xa933('0x2a')](db['VoiceMailMessage'][_0xa933('0x2b')],function(_0x5b7ce5){return{'name':_0x5b7ce5[_0xa933('0x2c')],'type':_0x5b7ce5[_0xa933('0x2d')][_0xa933('0x2e')]};});_0x10a961[_0xa933('0x2f')]=_[_0xa933('0x30')](_[_0xa933('0x2a')](_0x14a4e4,_0xa933('0x28')),[_0xa933('0x28')]);_0x10a961[_0xa933('0x31')]=_[_0xa933('0x32')](_0xeec183[_0xa933('0x31')]);_0x10a961[_0xa933('0x33')]=_[_0xa933('0x34')](_0x10a961[_0xa933('0x2f')],_0x10a961[_0xa933('0x31')]);_0x3e8339[_0xa933('0x35')]=_['intersection'](_0x10a961[_0xa933('0x2f')],qs[_0xa933('0x36')](_0xeec183['query']['fields']));_0x3e8339[_0xa933('0x35')]=_0x3e8339[_0xa933('0x35')]['length']?_0x3e8339['attributes']:_0x10a961[_0xa933('0x2f')];if(!_0xeec183[_0xa933('0x31')][_0xa933('0x37')](_0xa933('0x38'))){_0x3e8339[_0xa933('0x1f')]=qs['limit'](_0xeec183['query'][_0xa933('0x1f')]);_0x3e8339[_0xa933('0x1c')]=qs[_0xa933('0x1c')](_0xeec183[_0xa933('0x31')]['offset']);}_0x3e8339[_0xa933('0x39')]=qs[_0xa933('0x3a')](_0xeec183[_0xa933('0x31')][_0xa933('0x3a')]);_0x3e8339[_0xa933('0x3b')]=qs[_0xa933('0x33')](_[_0xa933('0x3c')](_0xeec183['query'],_0x10a961['filters']),_0x14a4e4);if(_0xeec183['query'][_0xa933('0x3d')]){_0x3e8339[_0xa933('0x3b')]=_[_0xa933('0x3e')](_0x3e8339['where'],{'$or':_[_0xa933('0x2a')](_0x14a4e4,function(_0x573e54){if(_0x573e54[_0xa933('0x2d')]!==_0xa933('0x3f')){var _0x3ef2cf={};_0x3ef2cf[_0x573e54[_0xa933('0x28')]]={'$like':'%'+_0xeec183[_0xa933('0x31')][_0xa933('0x3d')]+'%'};return _0x3ef2cf;}})});}_0x3e8339=_[_0xa933('0x3e')]({},_0x3e8339,_0xeec183[_0xa933('0x40')]);var _0x22afd6={'where':_0x3e8339[_0xa933('0x3b')]};return db[_0xa933('0x41')]['count'](_0x22afd6)['then'](function(_0x4146a5){_0x169275[_0xa933('0x1e')]=_0x4146a5;if(_0xeec183[_0xa933('0x31')][_0xa933('0x42')]){_0x3e8339['include']=[{'all':!![]}];}return db[_0xa933('0x41')][_0xa933('0x43')](_0x3e8339);})[_0xa933('0x24')](function(_0x79ba9b){_0x169275[_0xa933('0x44')]=_0x79ba9b;return _0x169275;})[_0xa933('0x24')](respondWithFilteredResult(_0x291d29,_0x3e8339))[_0xa933('0x45')](handleError(_0x291d29,null));};exports['show']=function(_0x546913,_0x95a867){var _0x57dbd9={'raw':!![],'where':{'id':_0x546913[_0xa933('0x46')]['id']}},_0xd70351={};_0xd70351[_0xa933('0x2f')]=_['keys'](db[_0xa933('0x41')]['rawAttributes']);_0xd70351[_0xa933('0x31')]=_[_0xa933('0x32')](_0x546913['query']);_0xd70351['filters']=_[_0xa933('0x34')](_0xd70351['model'],_0xd70351[_0xa933('0x31')]);_0x57dbd9[_0xa933('0x35')]=_[_0xa933('0x34')](_0xd70351['model'],qs[_0xa933('0x36')](_0x546913[_0xa933('0x31')][_0xa933('0x36')]));_0x57dbd9[_0xa933('0x35')]=_0x57dbd9[_0xa933('0x35')]['length']?_0x57dbd9[_0xa933('0x35')]:_0xd70351[_0xa933('0x2f')];if(_0x546913['query'][_0xa933('0x42')]){_0x57dbd9[_0xa933('0x47')]=[{'all':!![]}];}_0x57dbd9=_[_0xa933('0x3e')]({},_0x57dbd9,_0x546913[_0xa933('0x40')]);return db[_0xa933('0x41')][_0xa933('0x48')](_0x57dbd9)[_0xa933('0x24')](handleEntityNotFound(_0x95a867,null))[_0xa933('0x24')](respondWithResult(_0x95a867,null))['catch'](handleError(_0x95a867,null));};exports['create']=function(_0x5a0187,_0x1b8827){return db[_0xa933('0x41')][_0xa933('0x49')](_0x5a0187[_0xa933('0x4a')],{})[_0xa933('0x24')](respondWithResult(_0x1b8827,0xc9))['catch'](handleError(_0x1b8827,null));};exports[_0xa933('0x23')]=function(_0x1dc2ea,_0x4c56bf){if(_0x1dc2ea['body']['id']){delete _0x1dc2ea['body']['id'];}return db['VoiceMailMessage'][_0xa933('0x48')]({'where':{'id':_0x1dc2ea[_0xa933('0x46')]['id']}})[_0xa933('0x24')](handleEntityNotFound(_0x4c56bf,null))[_0xa933('0x24')](saveUpdates(_0x1dc2ea[_0xa933('0x4a')],null))[_0xa933('0x24')](respondWithResult(_0x4c56bf,null))[_0xa933('0x45')](handleError(_0x4c56bf,null));};exports['destroy']=function(_0x43cf17,_0x521ee6){return db['VoiceMailMessage'][_0xa933('0x48')]({'where':{'id':_0x43cf17['params']['id']}})[_0xa933('0x24')](handleEntityNotFound(_0x521ee6,null))['then'](removeEntity(_0x521ee6,null))[_0xa933('0x45')](handleError(_0x521ee6,null));};exports[_0xa933('0x4b')]=function(_0x4e9fbf,_0x209cbd,_0x3b3590){return db[_0xa933('0x41')][_0xa933('0x48')]({'where':{'id':_0x4e9fbf[_0xa933('0x46')]['id']},'attributes':['id',_0xa933('0x4c'),_0xa933('0x4d')]})[_0xa933('0x24')](handleEntityNotFound(_0x209cbd,null))[_0xa933('0x24')](function(_0x13deda){if(_0x13deda){if(!_0x13deda['recording']){throw new db[(_0xa933('0x4e'))][(_0xa933('0x4f'))](_0xa933('0x50'));}var _0x549684={'Content-Type':_0xa933('0x51'),'Content-Disposition':_0xa933('0x52')};if(_0x13deda[_0xa933('0x4d')]){_0x549684[_0xa933('0x53')]=_0xa933('0x54')+_0x13deda[_0xa933('0x4d')]+'.wav\x22';}_0x209cbd[_0xa933('0x55')](_0x549684);return _0x209cbd[_0xa933('0x29')](new Buffer(_0x13deda[_0xa933('0x4c')]));}})[_0xa933('0x45')](handleError(_0x209cbd,null));}; \ No newline at end of file +var _0xfaa1=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','destroy','then','status','error','stack','index','map','rawAttributes','fieldName','type','key','differenceBy','name','query','keys','filters','model','intersection','fields','attributes','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','VoiceMailMessage','includeAll','include','findAll','rows','catch','length','create','body','find','params','download','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','.wav\x22','send','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce'];(function(_0x295e67,_0x241f20){var _0x1b66de=function(_0x2049b9){while(--_0x2049b9){_0x295e67['push'](_0x295e67['shift']());}};_0x1b66de(++_0x241f20);}(_0xfaa1,0x152));var _0x1faa=function(_0x1e8ce6,_0x224840){_0x1e8ce6=_0x1e8ce6-0x0;var _0xd290b5=_0xfaa1[_0x1e8ce6];return _0xd290b5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1faa('0x0'));var zipdir=require(_0x1faa('0x1'));var jsonpatch=require(_0x1faa('0x2'));var rp=require(_0x1faa('0x3'));var moment=require('moment');var BPromise=require(_0x1faa('0x4'));var Mustache=require(_0x1faa('0x5'));var util=require(_0x1faa('0x6'));var path=require(_0x1faa('0x7'));var sox=require(_0x1faa('0x8'));var csv=require(_0x1faa('0x9'));var ejs=require(_0x1faa('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1faa('0xb'));var squel=require(_0x1faa('0xc'));var crypto=require('crypto');var jsforce=require(_0x1faa('0xd'));var deskjs=require(_0x1faa('0xe'));var toCsv=require(_0x1faa('0x9'));var querystring=require(_0x1faa('0xf'));var Papa=require(_0x1faa('0x10'));var Redis=require(_0x1faa('0x11'));var authService=require(_0x1faa('0x12'));var qs=require(_0x1faa('0x13'));var as=require(_0x1faa('0x14'));var hardwareService=require(_0x1faa('0x15'));var logger=require(_0x1faa('0x16'))(_0x1faa('0x17'));var utils=require('../../config/utils');var config=require(_0x1faa('0x18'));var licenseUtil=require(_0x1faa('0x19'));var db=require(_0x1faa('0x1a'))['db'];function respondWithStatusCode(_0x68be0c,_0x3de723){_0x3de723=_0x3de723||0xcc;return function(_0xaa223e){if(_0xaa223e){return _0x68be0c[_0x1faa('0x1b')](_0x3de723);}return _0x68be0c['status'](_0x3de723)['end']();};}function respondWithResult(_0x2c28e1,_0x58a55c){_0x58a55c=_0x58a55c||0xc8;return function(_0x387d37){if(_0x387d37){return _0x2c28e1['status'](_0x58a55c)[_0x1faa('0x1c')](_0x387d37);}};}function respondWithFilteredResult(_0x3e1055,_0x570c31){return function(_0x1d8045){if(_0x1d8045){var _0x256ce3=typeof _0x570c31[_0x1faa('0x1d')]===_0x1faa('0x1e')&&typeof _0x570c31['limit']===_0x1faa('0x1e');var _0x462357=_0x1d8045[_0x1faa('0x1f')];var _0x3a78c7=_0x256ce3?0x0:_0x570c31[_0x1faa('0x1d')];var _0x1e57b7=_0x256ce3?_0x1d8045['count']:_0x570c31[_0x1faa('0x1d')]+_0x570c31[_0x1faa('0x20')];var _0x37a203;if(_0x1e57b7>=_0x462357){_0x1e57b7=_0x462357;_0x37a203=0xc8;}else{_0x37a203=0xce;}_0x3e1055['status'](_0x37a203);return _0x3e1055[_0x1faa('0x21')](_0x1faa('0x22'),_0x3a78c7+'-'+_0x1e57b7+'/'+_0x462357)['json'](_0x1d8045);}return null;};}function patchUpdates(_0x30cb40){return function(_0x5ed03f){try{jsonpatch[_0x1faa('0x23')](_0x5ed03f,_0x30cb40,!![]);}catch(_0x44d2d8){return BPromise[_0x1faa('0x24')](_0x44d2d8);}return _0x5ed03f['save']();};}function saveUpdates(_0x5b5e4c,_0x6730ff){return function(_0x4b9c51){if(_0x4b9c51){return _0x4b9c51[_0x1faa('0x25')](_0x5b5e4c)['then'](function(_0x2da64b){return _0x2da64b;});}return null;};}function removeEntity(_0x24f779,_0x210e1e){return function(_0x257f06){if(_0x257f06){return _0x257f06[_0x1faa('0x26')]()[_0x1faa('0x27')](function(){_0x24f779[_0x1faa('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c31a7,_0x201ee8){return function(_0x4c0e46){if(!_0x4c0e46){_0x4c31a7[_0x1faa('0x1b')](0x194);}return _0x4c0e46;};}function handleError(_0x82521b,_0xadc0aa){_0xadc0aa=_0xadc0aa||0x1f4;return function(_0x54a08f){logger[_0x1faa('0x29')](_0x54a08f[_0x1faa('0x2a')]);if(_0x54a08f['name']){delete _0x54a08f['name'];}_0x82521b[_0x1faa('0x28')](_0xadc0aa)['send'](_0x54a08f);};}exports[_0x1faa('0x2b')]=function(_0x46e067,_0x552fd7){var _0xc93fbc={},_0x7c1cbc={},_0x3b3261={'count':0x0,'rows':[]};var _0x3ccdb3=_[_0x1faa('0x2c')](db['VoiceMailMessage'][_0x1faa('0x2d')],function(_0x1b078d){return{'name':_0x1b078d[_0x1faa('0x2e')],'type':_0x1b078d[_0x1faa('0x2f')][_0x1faa('0x30')]};});_0x7c1cbc['model']=_[_0x1faa('0x31')](_[_0x1faa('0x2c')](_0x3ccdb3,'name'),[_0x1faa('0x32')]);_0x7c1cbc[_0x1faa('0x33')]=_[_0x1faa('0x34')](_0x46e067[_0x1faa('0x33')]);_0x7c1cbc[_0x1faa('0x35')]=_['intersection'](_0x7c1cbc[_0x1faa('0x36')],_0x7c1cbc[_0x1faa('0x33')]);_0xc93fbc['attributes']=_[_0x1faa('0x37')](_0x7c1cbc[_0x1faa('0x36')],qs[_0x1faa('0x38')](_0x46e067[_0x1faa('0x33')][_0x1faa('0x38')]));_0xc93fbc['attributes']=_0xc93fbc[_0x1faa('0x39')]['length']?_0xc93fbc[_0x1faa('0x39')]:_0x7c1cbc[_0x1faa('0x36')];if(!_0x46e067[_0x1faa('0x33')][_0x1faa('0x3a')]('nolimit')){_0xc93fbc[_0x1faa('0x20')]=qs[_0x1faa('0x20')](_0x46e067[_0x1faa('0x33')][_0x1faa('0x20')]);_0xc93fbc['offset']=qs[_0x1faa('0x1d')](_0x46e067[_0x1faa('0x33')][_0x1faa('0x1d')]);}_0xc93fbc[_0x1faa('0x3b')]=qs[_0x1faa('0x3c')](_0x46e067['query']['sort']);_0xc93fbc[_0x1faa('0x3d')]=qs[_0x1faa('0x35')](_['pick'](_0x46e067['query'],_0x7c1cbc[_0x1faa('0x35')]),_0x3ccdb3);if(_0x46e067[_0x1faa('0x33')][_0x1faa('0x3e')]){_0xc93fbc[_0x1faa('0x3d')]=_[_0x1faa('0x3f')](_0xc93fbc['where'],{'$or':_[_0x1faa('0x2c')](_0x3ccdb3,function(_0x3a5638){if(_0x3a5638[_0x1faa('0x2f')]!==_0x1faa('0x40')){var _0x9b9198={};_0x9b9198[_0x3a5638[_0x1faa('0x32')]]={'$like':'%'+_0x46e067[_0x1faa('0x33')][_0x1faa('0x3e')]+'%'};return _0x9b9198;}})});}_0xc93fbc=_[_0x1faa('0x3f')]({},_0xc93fbc,_0x46e067[_0x1faa('0x41')]);var _0x26a4ed={'where':_0xc93fbc[_0x1faa('0x3d')]};return db[_0x1faa('0x42')][_0x1faa('0x1f')](_0x26a4ed)[_0x1faa('0x27')](function(_0x52610e){_0x3b3261['count']=_0x52610e;if(_0x46e067[_0x1faa('0x33')][_0x1faa('0x43')]){_0xc93fbc[_0x1faa('0x44')]=[{'all':!![]}];}return db[_0x1faa('0x42')][_0x1faa('0x45')](_0xc93fbc);})[_0x1faa('0x27')](function(_0x5a37a2){_0x3b3261[_0x1faa('0x46')]=_0x5a37a2;return _0x3b3261;})[_0x1faa('0x27')](respondWithFilteredResult(_0x552fd7,_0xc93fbc))[_0x1faa('0x47')](handleError(_0x552fd7,null));};exports['show']=function(_0x9e8b3e,_0x405ae2){var _0x55a02f={'raw':!![],'where':{'id':_0x9e8b3e['params']['id']}},_0x12c19c={};_0x12c19c[_0x1faa('0x36')]=_[_0x1faa('0x34')](db[_0x1faa('0x42')][_0x1faa('0x2d')]);_0x12c19c[_0x1faa('0x33')]=_[_0x1faa('0x34')](_0x9e8b3e[_0x1faa('0x33')]);_0x12c19c['filters']=_[_0x1faa('0x37')](_0x12c19c[_0x1faa('0x36')],_0x12c19c['query']);_0x55a02f[_0x1faa('0x39')]=_['intersection'](_0x12c19c['model'],qs[_0x1faa('0x38')](_0x9e8b3e['query'][_0x1faa('0x38')]));_0x55a02f[_0x1faa('0x39')]=_0x55a02f[_0x1faa('0x39')][_0x1faa('0x48')]?_0x55a02f['attributes']:_0x12c19c[_0x1faa('0x36')];if(_0x9e8b3e['query']['includeAll']){_0x55a02f[_0x1faa('0x44')]=[{'all':!![]}];}_0x55a02f=_[_0x1faa('0x3f')]({},_0x55a02f,_0x9e8b3e[_0x1faa('0x41')]);return db[_0x1faa('0x42')]['find'](_0x55a02f)[_0x1faa('0x27')](handleEntityNotFound(_0x405ae2,null))[_0x1faa('0x27')](respondWithResult(_0x405ae2,null))['catch'](handleError(_0x405ae2,null));};exports[_0x1faa('0x49')]=function(_0x3f780a,_0x2a50e1){return db[_0x1faa('0x42')][_0x1faa('0x49')](_0x3f780a[_0x1faa('0x4a')],{})[_0x1faa('0x27')](respondWithResult(_0x2a50e1,0xc9))[_0x1faa('0x47')](handleError(_0x2a50e1,null));};exports[_0x1faa('0x25')]=function(_0x36f8d9,_0x30ea5e){if(_0x36f8d9['body']['id']){delete _0x36f8d9['body']['id'];}return db[_0x1faa('0x42')][_0x1faa('0x4b')]({'where':{'id':_0x36f8d9[_0x1faa('0x4c')]['id']}})[_0x1faa('0x27')](handleEntityNotFound(_0x30ea5e,null))[_0x1faa('0x27')](saveUpdates(_0x36f8d9['body'],null))['then'](respondWithResult(_0x30ea5e,null))[_0x1faa('0x47')](handleError(_0x30ea5e,null));};exports[_0x1faa('0x26')]=function(_0xb7b947,_0x211d4c){return db['VoiceMailMessage'][_0x1faa('0x4b')]({'where':{'id':_0xb7b947['params']['id']}})[_0x1faa('0x27')](handleEntityNotFound(_0x211d4c,null))[_0x1faa('0x27')](removeEntity(_0x211d4c,null))[_0x1faa('0x47')](handleError(_0x211d4c,null));};exports[_0x1faa('0x4d')]=function(_0x160ef3,_0x2cb3ca,_0x4f3d8d){return db[_0x1faa('0x42')][_0x1faa('0x4b')]({'where':{'id':_0x160ef3[_0x1faa('0x4c')]['id']},'attributes':['id',_0x1faa('0x4e'),_0x1faa('0x4f')]})['then'](handleEntityNotFound(_0x2cb3ca,null))[_0x1faa('0x27')](function(_0x15f659){if(_0x15f659){if(!_0x15f659['recording']){throw new db[(_0x1faa('0x50'))][(_0x1faa('0x51'))](_0x1faa('0x52'));}var _0x6a874c={'Content-Type':_0x1faa('0x53'),'Content-Disposition':_0x1faa('0x54')};if(_0x15f659[_0x1faa('0x4f')]){_0x6a874c[_0x1faa('0x55')]='attachment;\x20filename=\x22'+_0x15f659[_0x1faa('0x4f')]+_0x1faa('0x56');}_0x2cb3ca['set'](_0x6a874c);return _0x2cb3ca[_0x1faa('0x57')](new Buffer(_0x15f659['recording']));}})['catch'](handleError(_0x2cb3ca,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 5d34170..578c005 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 _0x9737=['rimraf','../../config/environment','define','VoiceMailMessage','util','../../config/logger','bluebird','request-promise'];(function(_0x2d26c9,_0x2a7f13){var _0x57962f=function(_0x141383){while(--_0x141383){_0x2d26c9['push'](_0x2d26c9['shift']());}};_0x57962f(++_0x2a7f13);}(_0x9737,0x114));var _0x7973=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9737[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x7973('0x0'));var logger=require(_0x7973('0x1'))('api');var moment=require('moment');var BPromise=require(_0x7973('0x2'));var rp=require(_0x7973('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7973('0x4'));var config=require(_0x7973('0x5'));var attributes=require('./voiceMailMessage.attributes');module['exports']=function(_0x4c4f45,_0x54b58d){return _0x4c4f45[_0x7973('0x6')](_0x7973('0x7'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':'dir','fields':['dir']}],'timestamps':![]});}; \ No newline at end of file +var _0x827a=['path','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','util','../../config/logger','api','moment'];(function(_0x42d373,_0x17c8f7){var _0x3548dc=function(_0x256e7f){while(--_0x256e7f){_0x42d373['push'](_0x42d373['shift']());}};_0x3548dc(++_0x17c8f7);}(_0x827a,0x13d));var _0xa827=function(_0x14fc82,_0x1ada04){_0x14fc82=_0x14fc82-0x0;var _0x4530eb=_0x827a[_0x14fc82];return _0x4530eb;};'use strict';var _=require(_0xa827('0x0'));var util=require(_0xa827('0x1'));var logger=require(_0xa827('0x2'))(_0xa827('0x3'));var moment=require(_0xa827('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa827('0x5'));var rimraf=require(_0xa827('0x6'));var config=require(_0xa827('0x7'));var attributes=require(_0xa827('0x8'));module[_0xa827('0x9')]=function(_0x1be64b,_0x2f3533){return _0x1be64b[_0xa827('0xa')](_0xa827('0xb'),attributes,{'tableName':_0xa827('0xc'),'paranoid':![],'indexes':[{'name':_0xa827('0xd'),'fields':['dir']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 750a0ce..60ca2b4 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 _0xaccd=['VoiceMailMessage,\x20%s,\x20%s,\x20%s','code','error','message','result','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaccd,0x191));var _0xdacc=function(_0x49ef5c,_0x130864){_0x49ef5c=_0x49ef5c-0x0;var _0x106147=_0xaccd[_0x49ef5c];return _0x106147;};'use strict';var _=require(_0xdacc('0x0'));var util=require(_0xdacc('0x1'));var moment=require('moment');var BPromise=require(_0xdacc('0x2'));var rs=require(_0xdacc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdacc('0x4'))['db'];var utils=require(_0xdacc('0x5'));var logger=require(_0xdacc('0x6'))(_0xdacc('0x7'));var config=require(_0xdacc('0x8'));var jayson=require(_0xdacc('0x9'));var client=jayson[_0xdacc('0xa')][_0xdacc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x13ca3c,_0xd72927,_0x5f4c40){return new BPromise(function(_0x5ceeab,_0x3de271){return client[_0xdacc('0xc')](_0x13ca3c,_0x5f4c40)[_0xdacc('0xd')](function(_0x4933ec){logger[_0xdacc('0xe')](_0xdacc('0xf'),_0xd72927,_0xdacc('0x10'));logger['debug'](_0xdacc('0x11'),_0xd72927,_0xdacc('0x10'),JSON['stringify'](_0x4933ec));if(_0x4933ec['error']){if(_0x4933ec['error'][_0xdacc('0x12')]===0x1f4){logger['error']('VoiceMailMessage,\x20%s,\x20%s',_0xd72927,_0x4933ec[_0xdacc('0x13')][_0xdacc('0x14')]);return _0x3de271(_0x4933ec[_0xdacc('0x13')][_0xdacc('0x14')]);}logger['error'](_0xdacc('0xf'),_0xd72927,_0x4933ec[_0xdacc('0x13')][_0xdacc('0x14')]);return _0x5ceeab(_0x4933ec['error'][_0xdacc('0x14')]);}else{logger[_0xdacc('0xe')](_0xdacc('0xf'),_0xd72927,'request\x20sent');_0x5ceeab(_0x4933ec[_0xdacc('0x15')][_0xdacc('0x14')]);}})['catch'](function(_0x293be2){logger[_0xdacc('0x13')](_0xdacc('0xf'),_0xd72927,_0x293be2);_0x3de271(_0x293be2);});});} \ No newline at end of file +var _0xaf3a=['jayson/promise','client','http','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0xaf3a,0x64));var _0xaaf3=function(_0x52fb3c,_0x2cf66e){_0x52fb3c=_0x52fb3c-0x0;var _0x5c9223=_0xaf3a[_0x52fb3c];return _0x5c9223;};'use strict';var _=require(_0xaaf3('0x0'));var util=require(_0xaaf3('0x1'));var moment=require(_0xaaf3('0x2'));var BPromise=require(_0xaaf3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xaaf3('0x4'));var logger=require(_0xaaf3('0x5'))(_0xaaf3('0x6'));var config=require(_0xaaf3('0x7'));var jayson=require(_0xaaf3('0x8'));var client=jayson[_0xaaf3('0x9')][_0xaaf3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x7bbba6,_0x2f0b4d,_0x2c0fcb){return new BPromise(function(_0x4cdf0d,_0x225708){return client['request'](_0x7bbba6,_0x2c0fcb)['then'](function(_0x3ad510){logger['info'](_0xaaf3('0xb'),_0x2f0b4d,_0xaaf3('0xc'));logger['debug']('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x2f0b4d,_0xaaf3('0xc'),JSON[_0xaaf3('0xd')](_0x3ad510));if(_0x3ad510[_0xaaf3('0xe')]){if(_0x3ad510['error']['code']===0x1f4){logger[_0xaaf3('0xe')](_0xaaf3('0xb'),_0x2f0b4d,_0x3ad510['error']['message']);return _0x225708(_0x3ad510[_0xaaf3('0xe')][_0xaaf3('0xf')]);}logger[_0xaaf3('0xe')]('VoiceMailMessage,\x20%s,\x20%s',_0x2f0b4d,_0x3ad510[_0xaaf3('0xe')][_0xaaf3('0xf')]);return _0x4cdf0d(_0x3ad510[_0xaaf3('0xe')]['message']);}else{logger['info'](_0xaaf3('0xb'),_0x2f0b4d,_0xaaf3('0xc'));_0x4cdf0d(_0x3ad510[_0xaaf3('0x10')][_0xaaf3('0xf')]);}})[_0xaaf3('0x11')](function(_0x50e774){logger[_0xaaf3('0xe')](_0xaaf3('0xb'),_0x2f0b4d,_0x50e774);_0x225708(_0x50e774);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 0aaaea4..cf5ab5c 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 _0x6655=['../../components/auth/service','../../config/environment','./voiceMusicOnHold.controller','isAuthenticated','index','get','/:id','show','/:id/sounds','getSounds','post','create','put','update','delete','destroy','/:id/sounds/:id2','removeSound','exports','multer','util','path','connect-timeout','express'];(function(_0x56b138,_0x2396d6){var _0x3df878=function(_0x4b3ccc){while(--_0x4b3ccc){_0x56b138['push'](_0x56b138['shift']());}};_0x3df878(++_0x2396d6);}(_0x6655,0xbb));var _0x5665=function(_0x58ea44,_0x512f53){_0x58ea44=_0x58ea44-0x0;var _0x31eb1d=_0x6655[_0x58ea44];return _0x31eb1d;};'use strict';var multer=require(_0x5665('0x0'));var util=require(_0x5665('0x1'));var path=require(_0x5665('0x2'));var timeout=require(_0x5665('0x3'));var express=require(_0x5665('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x5665('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5665('0x6'));var controller=require(_0x5665('0x7'));router['get']('/',auth[_0x5665('0x8')](),controller[_0x5665('0x9')]);router[_0x5665('0xa')](_0x5665('0xb'),auth[_0x5665('0x8')](),controller[_0x5665('0xc')]);router[_0x5665('0xa')](_0x5665('0xd'),auth[_0x5665('0x8')](),controller[_0x5665('0xe')]);router[_0x5665('0xf')]('/',auth[_0x5665('0x8')](),controller[_0x5665('0x10')]);router[_0x5665('0xf')](_0x5665('0xd'),auth['isAuthenticated'](),controller['addSound']);router[_0x5665('0x11')](_0x5665('0xb'),auth[_0x5665('0x8')](),controller[_0x5665('0x12')]);router[_0x5665('0x13')](_0x5665('0xb'),auth[_0x5665('0x8')](),controller[_0x5665('0x14')]);router[_0x5665('0x13')](_0x5665('0x15'),auth['isAuthenticated'](),controller[_0x5665('0x16')]);module[_0x5665('0x17')]=router; \ No newline at end of file +var _0xb35a=['destroy','/:id/sounds/:id2','removeSound','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','/:id','show','get','/:id/sounds','getSounds','post','create','addSound','update','delete'];(function(_0x347f75,_0x4fede9){var _0xeddff5=function(_0x23f36e){while(--_0x23f36e){_0x347f75['push'](_0x347f75['shift']());}};_0xeddff5(++_0x4fede9);}(_0xb35a,0x10c));var _0xab35=function(_0x4d5f37,_0x431410){_0x4d5f37=_0x4d5f37-0x0;var _0x5ef460=_0xb35a[_0x4d5f37];return _0x5ef460;};'use strict';var multer=require(_0xab35('0x0'));var util=require(_0xab35('0x1'));var path=require(_0xab35('0x2'));var timeout=require(_0xab35('0x3'));var express=require(_0xab35('0x4'));var router=express[_0xab35('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xab35('0x6'));var interaction=require(_0xab35('0x7'));var config=require('../../config/environment');var controller=require('./voiceMusicOnHold.controller');router['get']('/',auth[_0xab35('0x8')](),controller[_0xab35('0x9')]);router['get'](_0xab35('0xa'),auth[_0xab35('0x8')](),controller[_0xab35('0xb')]);router[_0xab35('0xc')](_0xab35('0xd'),auth[_0xab35('0x8')](),controller[_0xab35('0xe')]);router[_0xab35('0xf')]('/',auth[_0xab35('0x8')](),controller[_0xab35('0x10')]);router['post']('/:id/sounds',auth[_0xab35('0x8')](),controller[_0xab35('0x11')]);router['put'](_0xab35('0xa'),auth[_0xab35('0x8')](),controller[_0xab35('0x12')]);router[_0xab35('0x13')]('/:id',auth[_0xab35('0x8')](),controller[_0xab35('0x14')]);router[_0xab35('0x13')](_0xab35('0x15'),auth[_0xab35('0x8')](),controller[_0xab35('0x16')]);module[_0xab35('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 94fb7f4..267c01b 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 _0x0be4=['sequelize','exports','name','ENUM','custom','mp3nb','quietmp3nb','quietmp3','files','STRING','alpha','TIMESTAMP','BOOLEAN'];(function(_0x6e3ccb,_0x2e8a9b){var _0x2e6687=function(_0x11ce2d){while(--_0x11ce2d){_0x6e3ccb['push'](_0x6e3ccb['shift']());}};_0x2e6687(++_0x2e8a9b);}(_0x0be4,0x193));var _0x40be=function(_0x2c3a18,_0x5ed4e6){_0x2c3a18=_0x2c3a18-0x0;var _0x1600ef=_0x0be4[_0x2c3a18];return _0x1600ef;};'use strict';var Sequelize=require(_0x40be('0x0'));module[_0x40be('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x40be('0x2')},'mode':{'type':Sequelize[_0x40be('0x3')](_0x40be('0x4'),'files',_0x40be('0x5'),_0x40be('0x6'),_0x40be('0x7'),'mp3'),'allowNull':!![],'defaultValue':_0x40be('0x8')},'directory':{'type':Sequelize[_0x40be('0x9')],'allowNull':!![]},'application':{'type':Sequelize[_0x40be('0x9')],'allowNull':!![]},'digit':{'type':Sequelize[_0x40be('0x9')],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x40be('0xa')},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':_0x40be('0xb')},'defaultEntry':{'type':Sequelize[_0x40be('0xc')],'defaultValue':0x0}}; \ No newline at end of file +var _0x958a=['mp3','alpha','TIMESTAMP','BOOLEAN','sequelize','STRING','name','ENUM','custom','files','quietmp3nb','quietmp3'];(function(_0x49677a,_0x197e86){var _0x115408=function(_0xc88918){while(--_0xc88918){_0x49677a['push'](_0x49677a['shift']());}};_0x115408(++_0x197e86);}(_0x958a,0x1cc));var _0xa958=function(_0x33533b,_0x270d5f){_0x33533b=_0x33533b-0x0;var _0x351982=_0x958a[_0x33533b];return _0x351982;};'use strict';var Sequelize=require(_0xa958('0x0'));module['exports']={'name':{'type':Sequelize[_0xa958('0x1')],'allowNull':![],'unique':_0xa958('0x2')},'mode':{'type':Sequelize[_0xa958('0x3')](_0xa958('0x4'),_0xa958('0x5'),'mp3nb',_0xa958('0x6'),_0xa958('0x7'),_0xa958('0x8')),'allowNull':!![],'defaultValue':_0xa958('0x5')},'directory':{'type':Sequelize[_0xa958('0x1')],'allowNull':!![]},'application':{'type':Sequelize[_0xa958('0x1')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize[_0xa958('0x1')],'allowNull':!![],'defaultValue':_0xa958('0x9')},'format':{'type':Sequelize[_0xa958('0x1')],'allowNull':!![]},'stamp':{'type':_0xa958('0xa')},'defaultEntry':{'type':Sequelize[_0xa958('0xb')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index b38c3e0..15e9841 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 _0x1bee=['sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','find','body','params','create','sequelize','mode','files','directory','join','root','server/files/moh','mkdirSync','0777','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','transaction','readdirSync','unlinkSync','Sequelize','ValidationError','addSound','Sound','save_name','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','extname','symlinkSync','message','findOne','removeSound','id2','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','reject','update','then','destroy','get','MusicOnHolds','UserProfileResource','end','error','stack','name','send','index','map','VoiceMusicOnHold','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','limit','order'];(function(_0x5abb00,_0x342d70){var _0xf9b854=function(_0x43ac30){while(--_0x43ac30){_0x5abb00['push'](_0x5abb00['shift']());}};_0xf9b854(++_0x342d70);}(_0x1bee,0x188));var _0xe1be=function(_0x542d80,_0x150561){_0x542d80=_0x542d80-0x0;var _0x1f4492=_0x1bee[_0x542d80];return _0x1f4492;};'use strict';var emlformat=require(_0xe1be('0x0'));var rimraf=require(_0xe1be('0x1'));var zipdir=require(_0xe1be('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe1be('0x3'));var moment=require(_0xe1be('0x4'));var BPromise=require(_0xe1be('0x5'));var Mustache=require(_0xe1be('0x6'));var util=require(_0xe1be('0x7'));var path=require('path');var sox=require(_0xe1be('0x8'));var csv=require(_0xe1be('0x9'));var ejs=require(_0xe1be('0xa'));var fs=require('fs');var fs_extra=require(_0xe1be('0xb'));var _=require('lodash');var squel=require(_0xe1be('0xc'));var crypto=require(_0xe1be('0xd'));var jsforce=require(_0xe1be('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xe1be('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe1be('0xf'));var authService=require(_0xe1be('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe1be('0x11'));var hardwareService=require(_0xe1be('0x12'));var logger=require(_0xe1be('0x13'))(_0xe1be('0x14'));var utils=require(_0xe1be('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xe1be('0x16'));var db=require(_0xe1be('0x17'))['db'];function respondWithStatusCode(_0x241cf6,_0x11a5a8){_0x11a5a8=_0x11a5a8||0xcc;return function(_0x3f060c){if(_0x3f060c){return _0x241cf6[_0xe1be('0x18')](_0x11a5a8);}return _0x241cf6[_0xe1be('0x19')](_0x11a5a8)['end']();};}function respondWithResult(_0x2d63f7,_0x374805){_0x374805=_0x374805||0xc8;return function(_0x35bdf8){if(_0x35bdf8){return _0x2d63f7[_0xe1be('0x19')](_0x374805)[_0xe1be('0x1a')](_0x35bdf8);}};}function respondWithFilteredResult(_0x4080e9,_0x58fd55){return function(_0x2d7cd5){if(_0x2d7cd5){var _0x11a1a1=typeof _0x58fd55[_0xe1be('0x1b')]===_0xe1be('0x1c')&&typeof _0x58fd55['limit']===_0xe1be('0x1c');var _0x2f412d=_0x2d7cd5[_0xe1be('0x1d')];var _0x135007=_0x11a1a1?0x0:_0x58fd55[_0xe1be('0x1b')];var _0x4eb5ec=_0x11a1a1?_0x2d7cd5[_0xe1be('0x1d')]:_0x58fd55['offset']+_0x58fd55['limit'];var _0x114379;if(_0x4eb5ec>=_0x2f412d){_0x4eb5ec=_0x2f412d;_0x114379=0xc8;}else{_0x114379=0xce;}_0x4080e9[_0xe1be('0x19')](_0x114379);return _0x4080e9[_0xe1be('0x1e')](_0xe1be('0x1f'),_0x135007+'-'+_0x4eb5ec+'/'+_0x2f412d)[_0xe1be('0x1a')](_0x2d7cd5);}return null;};}function patchUpdates(_0xbb94c6){return function(_0x22a1fe){try{jsonpatch[_0xe1be('0x20')](_0x22a1fe,_0xbb94c6,!![]);}catch(_0xd4984d){return BPromise[_0xe1be('0x21')](_0xd4984d);}return _0x22a1fe['save']();};}function saveUpdates(_0x2df131,_0x5ea0fa){return function(_0x253130){if(_0x253130){return _0x253130[_0xe1be('0x22')](_0x2df131)[_0xe1be('0x23')](function(_0xf4e121){return _0xf4e121;});}return null;};}function removeEntity(_0x4af5b1,_0x59c08d){return function(_0x4bc6c4){if(_0x4bc6c4){return _0x4bc6c4[_0xe1be('0x24')]()[_0xe1be('0x23')](function(){var _0x13209d=_0x4bc6c4[_0xe1be('0x25')]({'plain':!![]});var _0x599271=_0xe1be('0x26');return db[_0xe1be('0x27')]['destroy']({'where':{'type':_0x599271,'resourceId':_0x13209d['id']}})['then'](function(){return _0x4bc6c4;});})[_0xe1be('0x23')](function(){_0x4af5b1[_0xe1be('0x19')](0xcc)[_0xe1be('0x28')]();});}};}function handleEntityNotFound(_0x42a4fb,_0x453ac7){return function(_0x2391a2){if(!_0x2391a2){_0x42a4fb[_0xe1be('0x18')](0x194);}return _0x2391a2;};}function handleError(_0x598ec6,_0x263a5a){_0x263a5a=_0x263a5a||0x1f4;return function(_0x5c1ed1){logger[_0xe1be('0x29')](_0x5c1ed1[_0xe1be('0x2a')]);if(_0x5c1ed1[_0xe1be('0x2b')]){delete _0x5c1ed1[_0xe1be('0x2b')];}_0x598ec6[_0xe1be('0x19')](_0x263a5a)[_0xe1be('0x2c')](_0x5c1ed1);};}exports[_0xe1be('0x2d')]=function(_0x579f55,_0x14e0db){var _0x17de44={},_0x2b6d92={},_0x239ed2={'count':0x0,'rows':[]};var _0x3ab3ee=_[_0xe1be('0x2e')](db[_0xe1be('0x2f')][_0xe1be('0x30')],function(_0x5f779a){return{'name':_0x5f779a[_0xe1be('0x31')],'type':_0x5f779a[_0xe1be('0x32')][_0xe1be('0x33')]};});_0x2b6d92['model']=_[_0xe1be('0x2e')](_0x3ab3ee,'name');_0x2b6d92[_0xe1be('0x34')]=_[_0xe1be('0x35')](_0x579f55[_0xe1be('0x34')]);_0x2b6d92[_0xe1be('0x36')]=_[_0xe1be('0x37')](_0x2b6d92['model'],_0x2b6d92[_0xe1be('0x34')]);_0x17de44[_0xe1be('0x38')]=_[_0xe1be('0x37')](_0x2b6d92['model'],qs[_0xe1be('0x39')](_0x579f55[_0xe1be('0x34')][_0xe1be('0x39')]));_0x17de44['attributes']=_0x17de44['attributes'][_0xe1be('0x3a')]?_0x17de44[_0xe1be('0x38')]:_0x2b6d92[_0xe1be('0x3b')];if(!_0x579f55[_0xe1be('0x34')][_0xe1be('0x3c')](_0xe1be('0x3d'))){_0x17de44[_0xe1be('0x3e')]=qs[_0xe1be('0x3e')](_0x579f55['query'][_0xe1be('0x3e')]);_0x17de44[_0xe1be('0x1b')]=qs[_0xe1be('0x1b')](_0x579f55[_0xe1be('0x34')][_0xe1be('0x1b')]);}_0x17de44[_0xe1be('0x3f')]=qs[_0xe1be('0x40')](_0x579f55[_0xe1be('0x34')][_0xe1be('0x40')]);delete _0x579f55[_0xe1be('0x34')]['sort'];_0x17de44[_0xe1be('0x41')]=qs[_0xe1be('0x36')](_[_0xe1be('0x42')](_0x579f55[_0xe1be('0x34')],_0x2b6d92['filters']),_0x3ab3ee);if(_0x579f55[_0xe1be('0x34')][_0xe1be('0x43')]){_0x17de44[_0xe1be('0x41')]=_[_0xe1be('0x44')](_0x17de44[_0xe1be('0x41')],{'$or':_[_0xe1be('0x2e')](_0x3ab3ee,function(_0x1f3072){if(_0x1f3072['type']!==_0xe1be('0x45')){var _0x36f4d5={};_0x36f4d5[_0x1f3072['name']]={'$like':'%'+_0x579f55[_0xe1be('0x34')]['filter']+'%'};return _0x36f4d5;}})});}_0x17de44=_[_0xe1be('0x44')]({},_0x17de44,_0x579f55[_0xe1be('0x46')]);var _0x491938={'where':_0x17de44[_0xe1be('0x41')]};return db['VoiceMusicOnHold'][_0xe1be('0x1d')](_0x491938)[_0xe1be('0x23')](function(_0x236a5f){_0x239ed2[_0xe1be('0x1d')]=_0x236a5f;if(_0x579f55[_0xe1be('0x34')][_0xe1be('0x47')]){_0x17de44['include']=[{'all':!![]}];}return db[_0xe1be('0x2f')][_0xe1be('0x48')](_0x17de44);})[_0xe1be('0x23')](function(_0x3401d6){_0x239ed2[_0xe1be('0x49')]=_0x3401d6;return _0x239ed2;})['then'](respondWithFilteredResult(_0x14e0db,_0x17de44))[_0xe1be('0x4a')](handleError(_0x14e0db,null));};exports[_0xe1be('0x4b')]=function(_0x252a1e,_0x3c7615){var _0x58e632={'raw':![],'where':{'id':_0x252a1e['params']['id']}},_0xfcaa7b={};_0xfcaa7b[_0xe1be('0x3b')]=_[_0xe1be('0x35')](db[_0xe1be('0x2f')][_0xe1be('0x30')]);_0xfcaa7b[_0xe1be('0x34')]=_[_0xe1be('0x35')](_0x252a1e[_0xe1be('0x34')]);_0xfcaa7b['filters']=_[_0xe1be('0x37')](_0xfcaa7b[_0xe1be('0x3b')],_0xfcaa7b[_0xe1be('0x34')]);_0x58e632['attributes']=_['intersection'](_0xfcaa7b['model'],qs[_0xe1be('0x39')](_0x252a1e['query']['fields']));_0x58e632['attributes']=_0x58e632[_0xe1be('0x38')]['length']?_0x58e632[_0xe1be('0x38')]:_0xfcaa7b['model'];if(_0x252a1e[_0xe1be('0x34')][_0xe1be('0x47')]){_0x58e632['include']=[{'all':!![]}];}_0x58e632=_[_0xe1be('0x44')]({},_0x58e632,_0x252a1e[_0xe1be('0x46')]);return db['VoiceMusicOnHold'][_0xe1be('0x4c')](_0x58e632)['then'](handleEntityNotFound(_0x3c7615,null))['then'](respondWithResult(_0x3c7615,null))[_0xe1be('0x4a')](handleError(_0x3c7615,null));};exports[_0xe1be('0x22')]=function(_0x36773a,_0x51a6f5){if(_0x36773a[_0xe1be('0x4d')]['id']){delete _0x36773a[_0xe1be('0x4d')]['id'];}return db[_0xe1be('0x2f')][_0xe1be('0x4c')]({'where':{'id':_0x36773a[_0xe1be('0x4e')]['id']}})[_0xe1be('0x23')](handleEntityNotFound(_0x51a6f5,null))['then'](saveUpdates(_0x36773a[_0xe1be('0x4d')],null))[_0xe1be('0x23')](respondWithResult(_0x51a6f5,null))['catch'](handleError(_0x51a6f5,null));};exports[_0xe1be('0x4f')]=function(_0x4163e9,_0x4cc30e,_0x53884c){return db[_0xe1be('0x50')]['transaction'](function(_0x1ef9e6){if(_0x4163e9[_0xe1be('0x4d')][_0xe1be('0x51')]===_0xe1be('0x52')){_0x4163e9['body'][_0xe1be('0x53')]=path[_0xe1be('0x54')](config[_0xe1be('0x55')],_0xe1be('0x56'),_0x4163e9[_0xe1be('0x4d')][_0xe1be('0x2b')]);}return db[_0xe1be('0x2f')][_0xe1be('0x4f')](_0x4163e9[_0xe1be('0x4d')],{'transaction':_0x1ef9e6})[_0xe1be('0x23')](function(_0x26a093){if(_0x4163e9[_0xe1be('0x4d')][_0xe1be('0x51')]==='files'){fs[_0xe1be('0x57')](_0x26a093[_0xe1be('0x53')],parseInt(_0xe1be('0x58'),0x8));}var _0x5ca54c=_0x4163e9[_0xe1be('0x59')][_0xe1be('0x25')]({'plain':!![]});if(!_0x5ca54c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5ca54c[_0xe1be('0x5a')]===_0xe1be('0x59')){var _0x23067f=_0x26a093[_0xe1be('0x25')]({'plain':!![]});return db[_0xe1be('0x5b')][_0xe1be('0x4c')]({'where':{'name':_0xe1be('0x26'),'userProfileId':_0x5ca54c[_0xe1be('0x5c')]},'raw':!![]})[_0xe1be('0x23')](function(_0x2146cd){if(_0x2146cd&&_0x2146cd[_0xe1be('0x5d')]===0x0){return db[_0xe1be('0x27')]['create']({'name':_0x23067f[_0xe1be('0x2b')],'resourceId':_0x23067f['id'],'type':_0x2146cd[_0xe1be('0x2b')],'sectionId':_0x2146cd['id']},{})['then'](function(){return _0x26a093;});}else{return _0x26a093;}})[_0xe1be('0x4a')](function(_0x551a28){logger[_0xe1be('0x29')](_0xe1be('0x5e'),_0x551a28);});}return _0x26a093;});})[_0xe1be('0x23')](respondWithResult(_0x4cc30e,0xc9))['catch'](handleError(_0x4cc30e,null));};exports[_0xe1be('0x24')]=function(_0x5b8f79,_0x169e78,_0x20e6a8){var _0x106cea;return db[_0xe1be('0x2f')]['find']({'where':{'id':_0x5b8f79['params']['id']}})[_0xe1be('0x23')](function(_0xf046a4){if(_0xf046a4){return db[_0xe1be('0x50')][_0xe1be('0x5f')](function(_0x2da4de){return _0xf046a4[_0xe1be('0x24')]({'transaction':_0x2da4de,'raw':!![]})[_0xe1be('0x23')](function(_0x32f372){if(_0x32f372['directory']){fs[_0xe1be('0x60')](_0x32f372['directory'])['forEach'](function(_0x206ce4){fs[_0xe1be('0x61')](path['join'](_0x32f372[_0xe1be('0x53')],_0x206ce4));});fs['rmdirSync'](_0x32f372[_0xe1be('0x53')]);}return _0x32f372;});})['catch'](function(_0xcb60cc){throw new db[(_0xe1be('0x62'))][(_0xe1be('0x63'))](_0xcb60cc['message']);});}})[_0xe1be('0x23')](handleEntityNotFound(_0x169e78,null))[_0xe1be('0x23')](removeEntity(_0x169e78,null))[_0xe1be('0x4a')](handleError(_0x169e78,null));};exports[_0xe1be('0x64')]=function(_0xf6870b,_0x123033,_0xe5dfb2){return db[_0xe1be('0x50')][_0xe1be('0x5f')](function(_0x503835){var _0x2ad024;return db['VoiceMusicOnHold']['find']({'where':{'id':_0xf6870b[_0xe1be('0x4e')]['id']}})[_0xe1be('0x23')](function(_0x4ebae1){if(_0x4ebae1){_0x2ad024=_0x4ebae1;return _0x4ebae1['addSound'](_0xf6870b[_0xe1be('0x4d')]['id'],{'transaction':_0x503835});}})['then'](function(_0x4eca60){if(_0x4eca60){return db[_0xe1be('0x65')]['findOne']({'where':{'id':_0xf6870b[_0xe1be('0x4d')]['id']},'attributes':['id',_0xe1be('0x2b'),_0xe1be('0x66'),_0xe1be('0x67'),_0xe1be('0x68')],'raw':!![]});}})['then'](function(_0xbddbd){if(_0xbddbd){var _0x5263e3=path[_0xe1be('0x54')](config[_0xe1be('0x55')],_0xe1be('0x69'),util[_0xe1be('0x6a')](_0xe1be('0x6b'),path['basename'](_0xbddbd[_0xe1be('0x66')],path[_0xe1be('0x6c')](_0xbddbd[_0xe1be('0x66')])),_0xbddbd[_0xe1be('0x67')]));var _0x767d4e=path['join'](config[_0xe1be('0x55')],_0xe1be('0x56'),_0x2ad024[_0xe1be('0x2b')],util['format']('%s.%s',_0xbddbd[_0xe1be('0x2b')],_0xbddbd['converted_format']));fs[_0xe1be('0x6d')](_0x5263e3,_0x767d4e);return _0xbddbd;}})[_0xe1be('0x4a')](function(_0x3846d5){throw new db['Sequelize'][(_0xe1be('0x63'))](_0x3846d5[_0xe1be('0x6e')]);});})['then'](handleEntityNotFound(_0x123033,null))['then'](respondWithResult(_0x123033,0xc9))['catch'](handleError(_0x123033,null));};exports['removeSound']=function(_0x20a368,_0x3ec3d0,_0x389af9){return db['sequelize'][_0xe1be('0x5f')](function(_0x394419){var _0x190134;return db['VoiceMusicOnHold'][_0xe1be('0x6f')]({'where':{'id':_0x20a368[_0xe1be('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3ec3d0,null))[_0xe1be('0x23')](function(_0x142099){if(_0x142099){_0x190134=_0x142099;return _0x142099[_0xe1be('0x70')](_0x20a368[_0xe1be('0x4e')][_0xe1be('0x71')]);}})['then'](function(_0x25ddba){if(_0x25ddba){return db['Sound']['findOne']({'where':{'id':_0x20a368[_0xe1be('0x4e')][_0xe1be('0x71')]},'attributes':['id',_0xe1be('0x2b'),_0xe1be('0x66'),'converted_format',_0xe1be('0x68')],'raw':!![]});}})[_0xe1be('0x23')](function(_0x39ebc4){if(_0x39ebc4){fs[_0xe1be('0x61')](path['join'](_0x190134['directory'],util[_0xe1be('0x6a')](_0xe1be('0x6b'),_0x39ebc4[_0xe1be('0x2b')],_0x39ebc4[_0xe1be('0x67')])));return _0x39ebc4;}})['catch'](function(_0x54a331){throw new db['Sequelize'][(_0xe1be('0x63'))](_0x54a331[_0xe1be('0x6e')]);});})['then'](handleEntityNotFound(_0x3ec3d0,null))[_0xe1be('0x23')](respondWithStatusCode(_0x3ec3d0,0xcc))[_0xe1be('0x4a')](handleError(_0x3ec3d0,null));};exports['getSounds']=function(_0x12fcab,_0x167bec,_0x1fe79d){var _0x3484ae={};var _0x5d9124={};var _0x4f37a1;var _0x150559;return db[_0xe1be('0x2f')][_0xe1be('0x6f')]({'where':{'id':_0x12fcab[_0xe1be('0x4e')]['id']}})[_0xe1be('0x23')](handleEntityNotFound(_0x167bec,null))[_0xe1be('0x23')](function(_0x52e9fd){if(_0x52e9fd){_0x4f37a1=_0x52e9fd;_0x5d9124[_0xe1be('0x3b')]=_[_0xe1be('0x35')](db[_0xe1be('0x65')][_0xe1be('0x30')]);_0x5d9124['query']=_['keys'](_0x12fcab[_0xe1be('0x34')]);_0x5d9124[_0xe1be('0x36')]=_[_0xe1be('0x37')](_0x5d9124['model'],_0x5d9124['query']);_0x3484ae['attributes']=_[_0xe1be('0x37')](_0x5d9124[_0xe1be('0x3b')],qs[_0xe1be('0x39')](_0x12fcab[_0xe1be('0x34')]['fields']));_0x3484ae['attributes']=_0x3484ae[_0xe1be('0x38')][_0xe1be('0x3a')]?_0x3484ae[_0xe1be('0x38')]:_0x5d9124['model'];_0x3484ae[_0xe1be('0x3f')]=qs[_0xe1be('0x40')](_0x12fcab[_0xe1be('0x34')][_0xe1be('0x40')]);_0x3484ae[_0xe1be('0x41')]=qs[_0xe1be('0x36')](_[_0xe1be('0x42')](_0x12fcab['query'],_0x5d9124[_0xe1be('0x36')]));if(_0x12fcab[_0xe1be('0x34')][_0xe1be('0x43')]){_0x3484ae[_0xe1be('0x41')]=_['merge'](_0x3484ae[_0xe1be('0x41')],{'$or':_[_0xe1be('0x2e')](_0x3484ae[_0xe1be('0x38')],function(_0x3c28fb){var _0x1c47ab={};_0x1c47ab[_0x3c28fb]={'$like':'%'+_0x12fcab[_0xe1be('0x34')][_0xe1be('0x43')]+'%'};return _0x1c47ab;})});}_0x3484ae=_[_0xe1be('0x44')]({},_0x3484ae,_0x12fcab[_0xe1be('0x46')]);return _0x4f37a1['getSounds'](_0x3484ae);}})['then'](function(_0x2ba74c){if(_0x2ba74c){_0x150559=_0x2ba74c[_0xe1be('0x3a')];if(!_0x12fcab[_0xe1be('0x34')][_0xe1be('0x3c')](_0xe1be('0x3d'))){_0x3484ae[_0xe1be('0x3e')]=qs[_0xe1be('0x3e')](_0x12fcab[_0xe1be('0x34')][_0xe1be('0x3e')]);_0x3484ae[_0xe1be('0x1b')]=qs[_0xe1be('0x1b')](_0x12fcab[_0xe1be('0x34')][_0xe1be('0x1b')]);}return _0x4f37a1['getSounds'](_0x3484ae);}})['then'](function(_0x5b78b7){if(_0x5b78b7){return _0x5b78b7?{'count':_0x150559,'rows':_0x5b78b7}:null;}})['then'](respondWithResult(_0x167bec,null))[_0xe1be('0x4a')](handleError(_0x167bec,null));}; \ No newline at end of file +var _0x4053=['where','merge','VIRTUAL','options','VoiceMusicOnHold','includeAll','include','rows','catch','show','params','keys','body','find','sequelize','mode','files','directory','join','server/files/moh','create','mkdirSync','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','transaction','forEach','unlinkSync','rmdirSync','message','addSound','Sound','findOne','save_name','converted_format','createdAt','root','format','basename','extname','%s.%s','Sequelize','removeSound','id2','ValidationError','getSounds','filter','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','get','MusicOnHolds','UserProfileResource','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick'];(function(_0x3c4594,_0x485580){var _0x5a1d4f=function(_0x5870b2){while(--_0x5870b2){_0x3c4594['push'](_0x3c4594['shift']());}};_0x5a1d4f(++_0x485580);}(_0x4053,0x117));var _0x3405=function(_0x2a238a,_0x1d5054){_0x2a238a=_0x2a238a-0x0;var _0xeef802=_0x4053[_0x2a238a];return _0xeef802;};'use strict';var emlformat=require(_0x3405('0x0'));var rimraf=require(_0x3405('0x1'));var zipdir=require(_0x3405('0x2'));var jsonpatch=require(_0x3405('0x3'));var rp=require(_0x3405('0x4'));var moment=require(_0x3405('0x5'));var BPromise=require(_0x3405('0x6'));var Mustache=require(_0x3405('0x7'));var util=require(_0x3405('0x8'));var path=require('path');var sox=require(_0x3405('0x9'));var csv=require(_0x3405('0xa'));var ejs=require(_0x3405('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3405('0xc'));var squel=require(_0x3405('0xd'));var crypto=require('crypto');var jsforce=require(_0x3405('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3405('0xf'));var Papa=require(_0x3405('0x10'));var Redis=require(_0x3405('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x3405('0x12'));var as=require(_0x3405('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3405('0x14'))(_0x3405('0x15'));var utils=require(_0x3405('0x16'));var config=require(_0x3405('0x17'));var licenseUtil=require(_0x3405('0x18'));var db=require(_0x3405('0x19'))['db'];function respondWithStatusCode(_0x2e4793,_0x7768e0){_0x7768e0=_0x7768e0||0xcc;return function(_0x5e0cfa){if(_0x5e0cfa){return _0x2e4793['sendStatus'](_0x7768e0);}return _0x2e4793[_0x3405('0x1a')](_0x7768e0)[_0x3405('0x1b')]();};}function respondWithResult(_0xa29fa5,_0x516110){_0x516110=_0x516110||0xc8;return function(_0x114d6a){if(_0x114d6a){return _0xa29fa5[_0x3405('0x1a')](_0x516110)[_0x3405('0x1c')](_0x114d6a);}};}function respondWithFilteredResult(_0x528790,_0x56f0ce){return function(_0x5cfb06){if(_0x5cfb06){var _0x240c16=typeof _0x56f0ce[_0x3405('0x1d')]===_0x3405('0x1e')&&typeof _0x56f0ce[_0x3405('0x1f')]===_0x3405('0x1e');var _0x1d3c5a=_0x5cfb06[_0x3405('0x20')];var _0x1f22ea=_0x240c16?0x0:_0x56f0ce['offset'];var _0x2286aa=_0x240c16?_0x5cfb06[_0x3405('0x20')]:_0x56f0ce['offset']+_0x56f0ce['limit'];var _0x204686;if(_0x2286aa>=_0x1d3c5a){_0x2286aa=_0x1d3c5a;_0x204686=0xc8;}else{_0x204686=0xce;}_0x528790[_0x3405('0x1a')](_0x204686);return _0x528790['set'](_0x3405('0x21'),_0x1f22ea+'-'+_0x2286aa+'/'+_0x1d3c5a)[_0x3405('0x1c')](_0x5cfb06);}return null;};}function patchUpdates(_0x3bd83c){return function(_0x250ac8){try{jsonpatch[_0x3405('0x22')](_0x250ac8,_0x3bd83c,!![]);}catch(_0x322ad0){return BPromise['reject'](_0x322ad0);}return _0x250ac8[_0x3405('0x23')]();};}function saveUpdates(_0x484952,_0x34747a){return function(_0x2baa71){if(_0x2baa71){return _0x2baa71[_0x3405('0x24')](_0x484952)[_0x3405('0x25')](function(_0x2a84f5){return _0x2a84f5;});}return null;};}function removeEntity(_0x16824d,_0x4b0514){return function(_0x585bb2){if(_0x585bb2){return _0x585bb2[_0x3405('0x26')]()['then'](function(){var _0x4a71e2=_0x585bb2[_0x3405('0x27')]({'plain':!![]});var _0x49ea7c=_0x3405('0x28');return db[_0x3405('0x29')][_0x3405('0x26')]({'where':{'type':_0x49ea7c,'resourceId':_0x4a71e2['id']}})[_0x3405('0x25')](function(){return _0x585bb2;});})[_0x3405('0x25')](function(){_0x16824d[_0x3405('0x1a')](0xcc)[_0x3405('0x1b')]();});}};}function handleEntityNotFound(_0x499740,_0x50e6e5){return function(_0x547bb7){if(!_0x547bb7){_0x499740[_0x3405('0x2a')](0x194);}return _0x547bb7;};}function handleError(_0xe846b9,_0x5d005d){_0x5d005d=_0x5d005d||0x1f4;return function(_0x57d4b3){logger['error'](_0x57d4b3[_0x3405('0x2b')]);if(_0x57d4b3[_0x3405('0x2c')]){delete _0x57d4b3[_0x3405('0x2c')];}_0xe846b9['status'](_0x5d005d)[_0x3405('0x2d')](_0x57d4b3);};}exports[_0x3405('0x2e')]=function(_0xb966a9,_0x3d7fc0){var _0xf03399={},_0x3c64b3={},_0x2fc43c={'count':0x0,'rows':[]};var _0x10647b=_[_0x3405('0x2f')](db['VoiceMusicOnHold'][_0x3405('0x30')],function(_0x21fa4a){return{'name':_0x21fa4a[_0x3405('0x31')],'type':_0x21fa4a[_0x3405('0x32')][_0x3405('0x33')]};});_0x3c64b3[_0x3405('0x34')]=_[_0x3405('0x2f')](_0x10647b,_0x3405('0x2c'));_0x3c64b3[_0x3405('0x35')]=_['keys'](_0xb966a9[_0x3405('0x35')]);_0x3c64b3[_0x3405('0x36')]=_[_0x3405('0x37')](_0x3c64b3[_0x3405('0x34')],_0x3c64b3['query']);_0xf03399[_0x3405('0x38')]=_['intersection'](_0x3c64b3[_0x3405('0x34')],qs[_0x3405('0x39')](_0xb966a9[_0x3405('0x35')][_0x3405('0x39')]));_0xf03399['attributes']=_0xf03399[_0x3405('0x38')][_0x3405('0x3a')]?_0xf03399[_0x3405('0x38')]:_0x3c64b3['model'];if(!_0xb966a9[_0x3405('0x35')][_0x3405('0x3b')]('nolimit')){_0xf03399['limit']=qs[_0x3405('0x1f')](_0xb966a9[_0x3405('0x35')][_0x3405('0x1f')]);_0xf03399['offset']=qs['offset'](_0xb966a9[_0x3405('0x35')][_0x3405('0x1d')]);}_0xf03399[_0x3405('0x3c')]=qs[_0x3405('0x3d')](_0xb966a9['query']['sort']);delete _0xb966a9[_0x3405('0x35')][_0x3405('0x3d')];_0xf03399['where']=qs[_0x3405('0x36')](_[_0x3405('0x3e')](_0xb966a9['query'],_0x3c64b3[_0x3405('0x36')]),_0x10647b);if(_0xb966a9[_0x3405('0x35')]['filter']){_0xf03399[_0x3405('0x3f')]=_[_0x3405('0x40')](_0xf03399[_0x3405('0x3f')],{'$or':_[_0x3405('0x2f')](_0x10647b,function(_0x9aff19){if(_0x9aff19['type']!==_0x3405('0x41')){var _0x404168={};_0x404168[_0x9aff19[_0x3405('0x2c')]]={'$like':'%'+_0xb966a9[_0x3405('0x35')]['filter']+'%'};return _0x404168;}})});}_0xf03399=_[_0x3405('0x40')]({},_0xf03399,_0xb966a9[_0x3405('0x42')]);var _0x5ebf7d={'where':_0xf03399[_0x3405('0x3f')]};return db[_0x3405('0x43')]['count'](_0x5ebf7d)[_0x3405('0x25')](function(_0x1c78e2){_0x2fc43c[_0x3405('0x20')]=_0x1c78e2;if(_0xb966a9['query'][_0x3405('0x44')]){_0xf03399[_0x3405('0x45')]=[{'all':!![]}];}return db[_0x3405('0x43')]['findAll'](_0xf03399);})[_0x3405('0x25')](function(_0x3d2205){_0x2fc43c[_0x3405('0x46')]=_0x3d2205;return _0x2fc43c;})[_0x3405('0x25')](respondWithFilteredResult(_0x3d7fc0,_0xf03399))[_0x3405('0x47')](handleError(_0x3d7fc0,null));};exports[_0x3405('0x48')]=function(_0x59e47a,_0x452e81){var _0x2eb558={'raw':![],'where':{'id':_0x59e47a[_0x3405('0x49')]['id']}},_0xeb956d={};_0xeb956d['model']=_[_0x3405('0x4a')](db[_0x3405('0x43')][_0x3405('0x30')]);_0xeb956d['query']=_[_0x3405('0x4a')](_0x59e47a['query']);_0xeb956d['filters']=_[_0x3405('0x37')](_0xeb956d['model'],_0xeb956d['query']);_0x2eb558['attributes']=_[_0x3405('0x37')](_0xeb956d['model'],qs[_0x3405('0x39')](_0x59e47a['query'][_0x3405('0x39')]));_0x2eb558[_0x3405('0x38')]=_0x2eb558['attributes']['length']?_0x2eb558[_0x3405('0x38')]:_0xeb956d['model'];if(_0x59e47a['query'][_0x3405('0x44')]){_0x2eb558['include']=[{'all':!![]}];}_0x2eb558=_[_0x3405('0x40')]({},_0x2eb558,_0x59e47a['options']);return db[_0x3405('0x43')]['find'](_0x2eb558)['then'](handleEntityNotFound(_0x452e81,null))['then'](respondWithResult(_0x452e81,null))[_0x3405('0x47')](handleError(_0x452e81,null));};exports[_0x3405('0x24')]=function(_0x4d8254,_0x4534e9){if(_0x4d8254[_0x3405('0x4b')]['id']){delete _0x4d8254[_0x3405('0x4b')]['id'];}return db['VoiceMusicOnHold'][_0x3405('0x4c')]({'where':{'id':_0x4d8254['params']['id']}})['then'](handleEntityNotFound(_0x4534e9,null))[_0x3405('0x25')](saveUpdates(_0x4d8254[_0x3405('0x4b')],null))[_0x3405('0x25')](respondWithResult(_0x4534e9,null))[_0x3405('0x47')](handleError(_0x4534e9,null));};exports['create']=function(_0xbbb2c,_0x42776b,_0x1c0953){return db[_0x3405('0x4d')]['transaction'](function(_0x25cead){if(_0xbbb2c[_0x3405('0x4b')][_0x3405('0x4e')]===_0x3405('0x4f')){_0xbbb2c['body'][_0x3405('0x50')]=path[_0x3405('0x51')](config['root'],_0x3405('0x52'),_0xbbb2c[_0x3405('0x4b')][_0x3405('0x2c')]);}return db[_0x3405('0x43')][_0x3405('0x53')](_0xbbb2c['body'],{'transaction':_0x25cead})[_0x3405('0x25')](function(_0x145461){if(_0xbbb2c[_0x3405('0x4b')][_0x3405('0x4e')]==='files'){fs[_0x3405('0x54')](_0x145461['directory'],parseInt(_0x3405('0x55'),0x8));}var _0x52c5b1=_0xbbb2c[_0x3405('0x56')][_0x3405('0x27')]({'plain':!![]});if(!_0x52c5b1)throw new Error(_0x3405('0x57'));if(_0x52c5b1['role']===_0x3405('0x56')){var _0x221ffa=_0x145461[_0x3405('0x27')]({'plain':!![]});return db[_0x3405('0x58')][_0x3405('0x4c')]({'where':{'name':_0x3405('0x28'),'userProfileId':_0x52c5b1[_0x3405('0x59')]},'raw':!![]})[_0x3405('0x25')](function(_0x5887da){if(_0x5887da&&_0x5887da['autoAssociation']===0x0){return db[_0x3405('0x29')]['create']({'name':_0x221ffa[_0x3405('0x2c')],'resourceId':_0x221ffa['id'],'type':_0x5887da[_0x3405('0x2c')],'sectionId':_0x5887da['id']},{})['then'](function(){return _0x145461;});}else{return _0x145461;}})[_0x3405('0x47')](function(_0x43ed99){logger[_0x3405('0x5a')](_0x3405('0x5b'),_0x43ed99);});}return _0x145461;});})['then'](respondWithResult(_0x42776b,0xc9))['catch'](handleError(_0x42776b,null));};exports[_0x3405('0x26')]=function(_0x35d19d,_0x5d9e13,_0x43da3a){var _0x3be3ea;return db[_0x3405('0x43')]['find']({'where':{'id':_0x35d19d['params']['id']}})[_0x3405('0x25')](function(_0x18b2e4){if(_0x18b2e4){return db[_0x3405('0x4d')][_0x3405('0x5c')](function(_0x187c6a){return _0x18b2e4[_0x3405('0x26')]({'transaction':_0x187c6a,'raw':!![]})['then'](function(_0x394a69){if(_0x394a69[_0x3405('0x50')]){fs['readdirSync'](_0x394a69[_0x3405('0x50')])[_0x3405('0x5d')](function(_0xf8ff5b){fs[_0x3405('0x5e')](path[_0x3405('0x51')](_0x394a69[_0x3405('0x50')],_0xf8ff5b));});fs[_0x3405('0x5f')](_0x394a69[_0x3405('0x50')]);}return _0x394a69;});})[_0x3405('0x47')](function(_0x463f3a){throw new db['Sequelize']['ValidationError'](_0x463f3a[_0x3405('0x60')]);});}})[_0x3405('0x25')](handleEntityNotFound(_0x5d9e13,null))[_0x3405('0x25')](removeEntity(_0x5d9e13,null))[_0x3405('0x47')](handleError(_0x5d9e13,null));};exports[_0x3405('0x61')]=function(_0x36739,_0x1bee35,_0x2bcf4c){return db['sequelize'][_0x3405('0x5c')](function(_0x15b014){var _0x3ede1c;return db[_0x3405('0x43')][_0x3405('0x4c')]({'where':{'id':_0x36739['params']['id']}})['then'](function(_0x304428){if(_0x304428){_0x3ede1c=_0x304428;return _0x304428[_0x3405('0x61')](_0x36739[_0x3405('0x4b')]['id'],{'transaction':_0x15b014});}})[_0x3405('0x25')](function(_0x24cf46){if(_0x24cf46){return db[_0x3405('0x62')][_0x3405('0x63')]({'where':{'id':_0x36739['body']['id']},'attributes':['id',_0x3405('0x2c'),_0x3405('0x64'),_0x3405('0x65'),_0x3405('0x66')],'raw':!![]});}})['then'](function(_0x3fd7a2){if(_0x3fd7a2){var _0x36e5fd=path[_0x3405('0x51')](config[_0x3405('0x67')],'server/files/sounds/converted',util[_0x3405('0x68')]('%s.%s',path[_0x3405('0x69')](_0x3fd7a2[_0x3405('0x64')],path[_0x3405('0x6a')](_0x3fd7a2[_0x3405('0x64')])),_0x3fd7a2[_0x3405('0x65')]));var _0x4b76b7=path[_0x3405('0x51')](config[_0x3405('0x67')],'server/files/moh',_0x3ede1c['name'],util[_0x3405('0x68')](_0x3405('0x6b'),_0x3fd7a2[_0x3405('0x2c')],_0x3fd7a2['converted_format']));fs['symlinkSync'](_0x36e5fd,_0x4b76b7);return _0x3fd7a2;}})[_0x3405('0x47')](function(_0x470ecc){throw new db[(_0x3405('0x6c'))]['ValidationError'](_0x470ecc['message']);});})[_0x3405('0x25')](handleEntityNotFound(_0x1bee35,null))['then'](respondWithResult(_0x1bee35,0xc9))[_0x3405('0x47')](handleError(_0x1bee35,null));};exports[_0x3405('0x6d')]=function(_0x24e67b,_0xf1f33c,_0x4fcb50){return db[_0x3405('0x4d')][_0x3405('0x5c')](function(_0x1c8d25){var _0x28ba4b;return db['VoiceMusicOnHold'][_0x3405('0x63')]({'where':{'id':_0x24e67b['params']['id']}})[_0x3405('0x25')](handleEntityNotFound(_0xf1f33c,null))[_0x3405('0x25')](function(_0x2eccd1){if(_0x2eccd1){_0x28ba4b=_0x2eccd1;return _0x2eccd1[_0x3405('0x6d')](_0x24e67b['params'][_0x3405('0x6e')]);}})['then'](function(_0x5d1e27){if(_0x5d1e27){return db[_0x3405('0x62')][_0x3405('0x63')]({'where':{'id':_0x24e67b['params'][_0x3405('0x6e')]},'attributes':['id',_0x3405('0x2c'),_0x3405('0x64'),_0x3405('0x65'),_0x3405('0x66')],'raw':!![]});}})[_0x3405('0x25')](function(_0x7b8b0){if(_0x7b8b0){fs[_0x3405('0x5e')](path[_0x3405('0x51')](_0x28ba4b['directory'],util[_0x3405('0x68')](_0x3405('0x6b'),_0x7b8b0['name'],_0x7b8b0[_0x3405('0x65')])));return _0x7b8b0;}})[_0x3405('0x47')](function(_0x3dad8a){throw new db[(_0x3405('0x6c'))][(_0x3405('0x6f'))](_0x3dad8a[_0x3405('0x60')]);});})[_0x3405('0x25')](handleEntityNotFound(_0xf1f33c,null))[_0x3405('0x25')](respondWithStatusCode(_0xf1f33c,0xcc))[_0x3405('0x47')](handleError(_0xf1f33c,null));};exports[_0x3405('0x70')]=function(_0x49652e,_0x3c5e01,_0x2fbbc8){var _0x181aee={};var _0x16e12d={};var _0x5a684c;var _0x5585ce;return db['VoiceMusicOnHold'][_0x3405('0x63')]({'where':{'id':_0x49652e['params']['id']}})[_0x3405('0x25')](handleEntityNotFound(_0x3c5e01,null))[_0x3405('0x25')](function(_0xcfa849){if(_0xcfa849){_0x5a684c=_0xcfa849;_0x16e12d[_0x3405('0x34')]=_[_0x3405('0x4a')](db['Sound'][_0x3405('0x30')]);_0x16e12d['query']=_['keys'](_0x49652e[_0x3405('0x35')]);_0x16e12d['filters']=_[_0x3405('0x37')](_0x16e12d[_0x3405('0x34')],_0x16e12d['query']);_0x181aee[_0x3405('0x38')]=_[_0x3405('0x37')](_0x16e12d[_0x3405('0x34')],qs[_0x3405('0x39')](_0x49652e['query'][_0x3405('0x39')]));_0x181aee['attributes']=_0x181aee['attributes'][_0x3405('0x3a')]?_0x181aee[_0x3405('0x38')]:_0x16e12d[_0x3405('0x34')];_0x181aee[_0x3405('0x3c')]=qs[_0x3405('0x3d')](_0x49652e['query']['sort']);_0x181aee['where']=qs[_0x3405('0x36')](_[_0x3405('0x3e')](_0x49652e[_0x3405('0x35')],_0x16e12d[_0x3405('0x36')]));if(_0x49652e['query'][_0x3405('0x71')]){_0x181aee['where']=_[_0x3405('0x40')](_0x181aee['where'],{'$or':_[_0x3405('0x2f')](_0x181aee[_0x3405('0x38')],function(_0x5bcf43){var _0x286da3={};_0x286da3[_0x5bcf43]={'$like':'%'+_0x49652e[_0x3405('0x35')][_0x3405('0x71')]+'%'};return _0x286da3;})});}_0x181aee=_[_0x3405('0x40')]({},_0x181aee,_0x49652e[_0x3405('0x42')]);return _0x5a684c['getSounds'](_0x181aee);}})[_0x3405('0x25')](function(_0xa0292f){if(_0xa0292f){_0x5585ce=_0xa0292f['length'];if(!_0x49652e['query']['hasOwnProperty']('nolimit')){_0x181aee[_0x3405('0x1f')]=qs['limit'](_0x49652e[_0x3405('0x35')][_0x3405('0x1f')]);_0x181aee['offset']=qs[_0x3405('0x1d')](_0x49652e[_0x3405('0x35')][_0x3405('0x1d')]);}return _0x5a684c[_0x3405('0x70')](_0x181aee);}})[_0x3405('0x25')](function(_0x37b7c7){if(_0x37b7c7){return _0x37b7c7?{'count':_0x5585ce,'rows':_0x37b7c7}:null;}})[_0x3405('0x25')](respondWithResult(_0x3c5e01,null))[_0x3405('0x47')](handleError(_0x3c5e01,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index bee7aba..7f82603 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 _0xf399=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','voice_musiconhold','lodash','util'];(function(_0x5c2295,_0x2d50e2){var _0x583115=function(_0x2dd264){while(--_0x2dd264){_0x5c2295['push'](_0x5c2295['shift']());}};_0x583115(++_0x2d50e2);}(_0xf399,0x7c));var _0x9f39=function(_0x39e1e7,_0x3c6f1d){_0x39e1e7=_0x39e1e7-0x0;var _0xad5637=_0xf399[_0x39e1e7];return _0xad5637;};'use strict';var _=require(_0x9f39('0x0'));var util=require(_0x9f39('0x1'));var logger=require(_0x9f39('0x2'))(_0x9f39('0x3'));var moment=require('moment');var BPromise=require(_0x9f39('0x4'));var rp=require(_0x9f39('0x5'));var fs=require('fs');var path=require(_0x9f39('0x6'));var rimraf=require(_0x9f39('0x7'));var config=require(_0x9f39('0x8'));var attributes=require(_0x9f39('0x9'));module[_0x9f39('0xa')]=function(_0x34f8a0,_0x329834){return _0x34f8a0[_0x9f39('0xb')](_0x9f39('0xc'),attributes,{'tableName':_0x9f39('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaa4c=['define','VoiceMusicOnHold','util','../../config/logger','api','request-promise','rimraf','../../config/environment'];(function(_0x11e40e,_0x8b3dd2){var _0x46b772=function(_0x9457fd){while(--_0x9457fd){_0x11e40e['push'](_0x11e40e['shift']());}};_0x46b772(++_0x8b3dd2);}(_0xaa4c,0x1da));var _0xcaa4=function(_0x36feec,_0x926868){_0x36feec=_0x36feec-0x0;var _0x3c7641=_0xaa4c[_0x36feec];return _0x3c7641;};'use strict';var _=require('lodash');var util=require(_0xcaa4('0x0'));var logger=require(_0xcaa4('0x1'))(_0xcaa4('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xcaa4('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcaa4('0x4'));var config=require(_0xcaa4('0x5'));var attributes=require('./voiceMusicOnHold.attributes');module['exports']=function(_0x57cc6b,_0x22c3be){return _0x57cc6b[_0xcaa4('0x6')](_0xcaa4('0x7'),attributes,{'tableName':'voice_musiconhold','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 95812db..f46cdb0 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['code','VoiceMusicOnHold,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x4ac876,_0x3da6cb){var _0x5ae4eb=function(_0x50420d){while(--_0x50420d){_0x4ac876['push'](_0x4ac876['shift']());}};_0x5ae4eb(++_0x3da6cb);}(_0x70e0,0x17b));var _0x070e=function(_0x10d989,_0x4676ae){_0x10d989=_0x10d989-0x0;var _0x5be528=_0x70e0[_0x10d989];return _0x5be528;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file +var _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s'];(function(_0x4c4106,_0x423f60){var _0x2a5b31=function(_0x535deb){while(--_0x535deb){_0x4c4106['push'](_0x4c4106['shift']());}};_0x2a5b31(++_0x423f60);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4c4042,_0x1ea485){_0x4c4042=_0x4c4042-0x0;var _0xbd10dc=_0xcb91[_0x4c4042];return _0xbd10dc;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index a17dfd5..4fce71c 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 _0x24e2=['exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','index','/describe','describe','/:id','isAuthenticated','getAgents','/:id/teams','getTeams','post','/:id/users','addAgents','addTeams','put','update','delete','removeAgents','removeTeams'];(function(_0x385b70,_0x52974f){var _0x33e2ef=function(_0x273ee9){while(--_0x273ee9){_0x385b70['push'](_0x385b70['shift']());}};_0x33e2ef(++_0x52974f);}(_0x24e2,0x1c1));var _0x224e=function(_0x3c9cef,_0xeb0edc){_0x3c9cef=_0x3c9cef-0x0;var _0x21f79e=_0x24e2[_0x3c9cef];return _0x21f79e;};'use strict';var multer=require(_0x224e('0x0'));var util=require(_0x224e('0x1'));var path=require('path');var timeout=require(_0x224e('0x2'));var express=require(_0x224e('0x3'));var router=express[_0x224e('0x4')]();var fs_extra=require(_0x224e('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x224e('0x6'));var config=require(_0x224e('0x7'));var controller=require(_0x224e('0x8'));router[_0x224e('0x9')]('/',auth['isAuthenticated'](),controller[_0x224e('0xa')]);router[_0x224e('0x9')](_0x224e('0xb'),auth['isAuthenticated'](),controller[_0x224e('0xc')]);router[_0x224e('0x9')](_0x224e('0xd'),auth[_0x224e('0xe')](),controller['show']);router[_0x224e('0x9')]('/:id/users',auth[_0x224e('0xe')](),controller[_0x224e('0xf')]);router['get'](_0x224e('0x10'),auth[_0x224e('0xe')](),controller[_0x224e('0x11')]);router[_0x224e('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0x224e('0x12')](_0x224e('0x13'),auth[_0x224e('0xe')](),controller[_0x224e('0x14')]);router[_0x224e('0x12')](_0x224e('0x10'),auth[_0x224e('0xe')](),controller[_0x224e('0x15')]);router[_0x224e('0x16')](_0x224e('0xd'),auth[_0x224e('0xe')](),controller[_0x224e('0x17')]);router[_0x224e('0x18')]('/:id',auth[_0x224e('0xe')](),controller['destroy']);router[_0x224e('0x18')](_0x224e('0x13'),auth[_0x224e('0xe')](),controller[_0x224e('0x19')]);router[_0x224e('0x18')](_0x224e('0x10'),auth[_0x224e('0xe')](),controller[_0x224e('0x1a')]);module[_0x224e('0x1b')]=router; \ No newline at end of file +var _0xbeea=['removeTeams','exports','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','/describe','show','/:id/users','getAgents','/:id/teams','getTeams','create','post','addTeams','put','/:id','delete','destroy'];(function(_0xe1b12b,_0x241bd1){var _0x1b697a=function(_0x1ce999){while(--_0x1ce999){_0xe1b12b['push'](_0xe1b12b['shift']());}};_0x1b697a(++_0x241bd1);}(_0xbeea,0xb1));var _0xabee=function(_0x5e3c7c,_0x2d533d){_0x5e3c7c=_0x5e3c7c-0x0;var _0x352d5c=_0xbeea[_0x5e3c7c];return _0x352d5c;};'use strict';var multer=require(_0xabee('0x0'));var util=require('util');var path=require(_0xabee('0x1'));var timeout=require(_0xabee('0x2'));var express=require(_0xabee('0x3'));var router=express['Router']();var fs_extra=require(_0xabee('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xabee('0x5'));var config=require(_0xabee('0x6'));var controller=require(_0xabee('0x7'));router[_0xabee('0x8')]('/',auth[_0xabee('0x9')](),controller['index']);router['get'](_0xabee('0xa'),auth[_0xabee('0x9')](),controller['describe']);router[_0xabee('0x8')]('/:id',auth[_0xabee('0x9')](),controller[_0xabee('0xb')]);router[_0xabee('0x8')](_0xabee('0xc'),auth[_0xabee('0x9')](),controller[_0xabee('0xd')]);router['get'](_0xabee('0xe'),auth[_0xabee('0x9')](),controller[_0xabee('0xf')]);router['post']('/',auth[_0xabee('0x9')](),controller[_0xabee('0x10')]);router[_0xabee('0x11')]('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router['post']('/:id/teams',auth[_0xabee('0x9')](),controller[_0xabee('0x12')]);router[_0xabee('0x13')](_0xabee('0x14'),auth[_0xabee('0x9')](),controller['update']);router[_0xabee('0x15')](_0xabee('0x14'),auth[_0xabee('0x9')](),controller[_0xabee('0x16')]);router[_0xabee('0x15')](_0xabee('0xc'),auth[_0xabee('0x9')](),controller['removeAgents']);router[_0xabee('0x15')](_0xabee('0xe'),auth[_0xabee('0x9')](),controller[_0xabee('0x17')]);module[_0xabee('0x18')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index cd9888e..3583e38 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 _0x92bd=['name','VIRTUAL','system-','getDataValue','STRING','INTEGER','sequelize','exports'];(function(_0x50bfbe,_0x35e70f){var _0x3fa8a6=function(_0x11fb23){while(--_0x11fb23){_0x50bfbe['push'](_0x50bfbe['shift']());}};_0x3fa8a6(++_0x35e70f);}(_0x92bd,0xde));var _0xd92b=function(_0x7ba770,_0x4407f9){_0x7ba770=_0x7ba770-0x0;var _0x2ccfcd=_0x92bd[_0x7ba770];return _0x2ccfcd;};'use strict';var Sequelize=require(_0xd92b('0x0'));module[_0xd92b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xd92b('0x2')},'prefix':{'type':Sequelize[_0xd92b('0x3')],'get':function(_0x35bb7f){return _0xd92b('0x4')+this[_0xd92b('0x5')](_0xd92b('0x2'))+'-';}},'description':{'type':Sequelize[_0xd92b('0x6')]},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize[_0xd92b('0x7')]}}; \ No newline at end of file +var _0xccbb=['name','VIRTUAL','system-','getDataValue','STRING','INTEGER','sequelize','exports'];(function(_0x17ade1,_0x53fec8){var _0x546a13=function(_0x5e20d0){while(--_0x5e20d0){_0x17ade1['push'](_0x17ade1['shift']());}};_0x546a13(++_0x53fec8);}(_0xccbb,0x96));var _0xbccb=function(_0x2518c0,_0xf9a14f){_0x2518c0=_0x2518c0-0x0;var _0x4c4c53=_0xccbb[_0x2518c0];return _0x4c4c53;};'use strict';var Sequelize=require(_0xbccb('0x0'));module[_0xbccb('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xbccb('0x2')},'prefix':{'type':Sequelize[_0xbccb('0x3')],'get':function(_0x14fe08){return _0xbccb('0x4')+this[_0xbccb('0x5')]('name')+'-';}},'description':{'type':Sequelize[_0xbccb('0x6')]},'callerIdAll':{'type':Sequelize[_0xbccb('0x6')]},'VoiceExtensionId':{'type':Sequelize[_0xbccb('0x7')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index c7995d9..8f9b4eb 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 _0x087b=['status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','get','VoicePrefixes','UserProfileResource','end','error','stack','name','index','map','VoicePrefix','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','filter','merge','VIRTUAL','where','include','catch','options','find','describe','create','sequelize','transaction','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','from-sip','exten','app','system','description','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','Set','CDR(prefix)=','callerIdAll','push','No\x20callerid\x20available','context','charAt','body','system-','findById','addAgents','params','omit','ids','spread','removeAgents','isArray','emit','userVoicePrefix:remove','findOne','User','pick','getAgents','nolimit','getTeams','Team','addTeams','findAll','interface','flatMap','Agents','each','TeamVoicePrefix','UserVoicePrefix','findOrCreate','forEach','userVoicePrefix:save','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','union','compact','value','removeTeams','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus'];(function(_0x2ef210,_0x5cb2f0){var _0x69297b=function(_0xc37de8){while(--_0xc37de8){_0x2ef210['push'](_0x2ef210['shift']());}};_0x69297b(++_0x5cb2f0);}(_0x087b,0x11a));var _0xb087=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0x087b[_0x341e0f];return _0x59555a;};'use strict';var emlformat=require(_0xb087('0x0'));var rimraf=require(_0xb087('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb087('0x2'));var moment=require('moment');var BPromise=require(_0xb087('0x3'));var Mustache=require(_0xb087('0x4'));var util=require(_0xb087('0x5'));var path=require(_0xb087('0x6'));var sox=require(_0xb087('0x7'));var csv=require(_0xb087('0x8'));var ejs=require(_0xb087('0x9'));var fs=require('fs');var fs_extra=require(_0xb087('0xa'));var _=require(_0xb087('0xb'));var squel=require(_0xb087('0xc'));var crypto=require(_0xb087('0xd'));var jsforce=require(_0xb087('0xe'));var deskjs=require(_0xb087('0xf'));var toCsv=require(_0xb087('0x8'));var querystring=require(_0xb087('0x10'));var Papa=require(_0xb087('0x11'));var Redis=require(_0xb087('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xb087('0x13'));var as=require(_0xb087('0x14'));var hardwareService=require(_0xb087('0x15'));var logger=require(_0xb087('0x16'))(_0xb087('0x17'));var utils=require(_0xb087('0x18'));var config=require(_0xb087('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xb087('0x1a'))['db'];config[_0xb087('0x1b')]=_[_0xb087('0x1c')](config['redis'],{'host':_0xb087('0x1d'),'port':0x18eb});var socket=require(_0xb087('0x1e'))(new Redis(config[_0xb087('0x1b')]));require(_0xb087('0x1f'))[_0xb087('0x20')](socket);function respondWithStatusCode(_0x12d0db,_0x5e9757){_0x5e9757=_0x5e9757||0xcc;return function(_0x5147e3){if(_0x5147e3){return _0x12d0db[_0xb087('0x21')](_0x5e9757);}return _0x12d0db[_0xb087('0x22')](_0x5e9757)['end']();};}function respondWithResult(_0x43e576,_0x412b48){_0x412b48=_0x412b48||0xc8;return function(_0x597478){if(_0x597478){return _0x43e576[_0xb087('0x22')](_0x412b48)[_0xb087('0x23')](_0x597478);}};}function respondWithFilteredResult(_0x2e9e74,_0x5bb80b){return function(_0x330005){if(_0x330005){var _0x3c680f=typeof _0x5bb80b[_0xb087('0x24')]===_0xb087('0x25')&&typeof _0x5bb80b['limit']===_0xb087('0x25');var _0x28428e=_0x330005[_0xb087('0x26')];var _0x23c1b6=_0x3c680f?0x0:_0x5bb80b['offset'];var _0x5aeab1=_0x3c680f?_0x330005['count']:_0x5bb80b['offset']+_0x5bb80b[_0xb087('0x27')];var _0x17be8e;if(_0x5aeab1>=_0x28428e){_0x5aeab1=_0x28428e;_0x17be8e=0xc8;}else{_0x17be8e=0xce;}_0x2e9e74[_0xb087('0x22')](_0x17be8e);return _0x2e9e74[_0xb087('0x28')](_0xb087('0x29'),_0x23c1b6+'-'+_0x5aeab1+'/'+_0x28428e)[_0xb087('0x23')](_0x330005);}return null;};}function patchUpdates(_0x31ae01){return function(_0x5587f7){try{jsonpatch[_0xb087('0x2a')](_0x5587f7,_0x31ae01,!![]);}catch(_0x466397){return BPromise[_0xb087('0x2b')](_0x466397);}return _0x5587f7[_0xb087('0x2c')]();};}function saveUpdates(_0x3ad74e,_0x4d9028){return function(_0x183eab){if(_0x183eab){return _0x183eab[_0xb087('0x2d')](_0x3ad74e)['then'](function(_0x5a2dc6){return _0x5a2dc6;});}return null;};}function removeEntity(_0x50745a,_0x598b99){return function(_0x5a4ee0){if(_0x5a4ee0){return _0x5a4ee0[_0xb087('0x2e')]()[_0xb087('0x2f')](function(){var _0x1d124f=_0x5a4ee0[_0xb087('0x30')]({'plain':!![]});var _0xd9ec66=_0xb087('0x31');return db[_0xb087('0x32')][_0xb087('0x2e')]({'where':{'type':_0xd9ec66,'resourceId':_0x1d124f['id']}})[_0xb087('0x2f')](function(){return _0x5a4ee0;});})[_0xb087('0x2f')](function(){_0x50745a[_0xb087('0x22')](0xcc)[_0xb087('0x33')]();});}};}function handleEntityNotFound(_0xb0baf6,_0x263259){return function(_0x593b78){if(!_0x593b78){_0xb0baf6[_0xb087('0x21')](0x194);}return _0x593b78;};}function handleError(_0x1335d9,_0x20183f){_0x20183f=_0x20183f||0x1f4;return function(_0x15c9ac){logger[_0xb087('0x34')](_0x15c9ac[_0xb087('0x35')]);if(_0x15c9ac[_0xb087('0x36')]){delete _0x15c9ac[_0xb087('0x36')];}_0x1335d9['status'](_0x20183f)['send'](_0x15c9ac);};}exports[_0xb087('0x37')]=function(_0xedd164,_0x4cb5a8){var _0x60bfe2={},_0x7d3776={},_0x2a48d3={'count':0x0,'rows':[]};var _0x32b20d=_[_0xb087('0x38')](db[_0xb087('0x39')][_0xb087('0x3a')],function(_0x3b7ace){return{'name':_0x3b7ace[_0xb087('0x3b')],'type':_0x3b7ace[_0xb087('0x3c')][_0xb087('0x3d')]};});_0x7d3776[_0xb087('0x3e')]=_['map'](_0x32b20d,_0xb087('0x36'));_0x7d3776['query']=_[_0xb087('0x3f')](_0xedd164[_0xb087('0x40')]);_0x7d3776[_0xb087('0x41')]=_[_0xb087('0x42')](_0x7d3776[_0xb087('0x3e')],_0x7d3776[_0xb087('0x40')]);_0x60bfe2[_0xb087('0x43')]=_[_0xb087('0x42')](_0x7d3776[_0xb087('0x3e')],qs['fields'](_0xedd164['query'][_0xb087('0x44')]));_0x60bfe2[_0xb087('0x43')]=_0x60bfe2[_0xb087('0x43')][_0xb087('0x45')]?_0x60bfe2[_0xb087('0x43')]:_0x7d3776['model'];if(!_0xedd164[_0xb087('0x40')][_0xb087('0x46')]('nolimit')){_0x60bfe2['limit']=qs[_0xb087('0x27')](_0xedd164[_0xb087('0x40')][_0xb087('0x27')]);_0x60bfe2['offset']=qs[_0xb087('0x24')](_0xedd164[_0xb087('0x40')][_0xb087('0x24')]);}_0x60bfe2[_0xb087('0x47')]=qs[_0xb087('0x48')](_0xedd164['query'][_0xb087('0x48')]);_0x60bfe2['where']=qs[_0xb087('0x41')](_['pick'](_0xedd164[_0xb087('0x40')],_0x7d3776[_0xb087('0x41')]),_0x32b20d);if(_0xedd164['query'][_0xb087('0x49')]){_0x60bfe2['where']=_[_0xb087('0x4a')](_0x60bfe2['where'],{'$or':_[_0xb087('0x38')](_0x32b20d,function(_0x326934){if(_0x326934[_0xb087('0x3c')]!==_0xb087('0x4b')){var _0x1785e0={};_0x1785e0[_0x326934[_0xb087('0x36')]]={'$like':'%'+_0xedd164[_0xb087('0x40')]['filter']+'%'};return _0x1785e0;}})});}_0x60bfe2=_[_0xb087('0x4a')]({},_0x60bfe2,_0xedd164['options']);var _0x2a2b9c={'where':_0x60bfe2[_0xb087('0x4c')]};return db['VoicePrefix'][_0xb087('0x26')](_0x2a2b9c)[_0xb087('0x2f')](function(_0x7650c5){_0x2a48d3['count']=_0x7650c5;if(_0xedd164[_0xb087('0x40')]['includeAll']){_0x60bfe2[_0xb087('0x4d')]=[{'all':!![]}];}return db[_0xb087('0x39')]['findAll'](_0x60bfe2);})[_0xb087('0x2f')](function(_0x302ce7){_0x2a48d3['rows']=_0x302ce7;return _0x2a48d3;})[_0xb087('0x2f')](respondWithFilteredResult(_0x4cb5a8,_0x60bfe2))[_0xb087('0x4e')](handleError(_0x4cb5a8,null));};exports['show']=function(_0x93ada7,_0x46c713){var _0x1d7f80={'raw':![],'where':{'id':_0x93ada7['params']['id']}},_0x174c10={};_0x174c10['model']=_[_0xb087('0x3f')](db[_0xb087('0x39')][_0xb087('0x3a')]);_0x174c10[_0xb087('0x40')]=_[_0xb087('0x3f')](_0x93ada7[_0xb087('0x40')]);_0x174c10['filters']=_['intersection'](_0x174c10[_0xb087('0x3e')],_0x174c10['query']);_0x1d7f80[_0xb087('0x43')]=_[_0xb087('0x42')](_0x174c10[_0xb087('0x3e')],qs[_0xb087('0x44')](_0x93ada7['query'][_0xb087('0x44')]));_0x1d7f80['attributes']=_0x1d7f80[_0xb087('0x43')][_0xb087('0x45')]?_0x1d7f80[_0xb087('0x43')]:_0x174c10[_0xb087('0x3e')];if(_0x93ada7[_0xb087('0x40')]['includeAll']){_0x1d7f80[_0xb087('0x4d')]=[{'all':!![]}];}_0x1d7f80=_[_0xb087('0x4a')]({},_0x1d7f80,_0x93ada7[_0xb087('0x4f')]);return db['VoicePrefix'][_0xb087('0x50')](_0x1d7f80)['then'](handleEntityNotFound(_0x46c713,null))['then'](respondWithResult(_0x46c713,null))[_0xb087('0x4e')](handleError(_0x46c713,null));};exports[_0xb087('0x2e')]=function(_0x5eacf3,_0x4362d4){return db[_0xb087('0x39')][_0xb087('0x50')]({'where':{'id':_0x5eacf3['params']['id']}})['then'](handleEntityNotFound(_0x4362d4,null))[_0xb087('0x2f')](removeEntity(_0x4362d4,null))['catch'](handleError(_0x4362d4,null));};exports['describe']=function(_0x1e52e4,_0x3bafca){return db[_0xb087('0x39')][_0xb087('0x51')]()[_0xb087('0x2f')](respondWithResult(_0x3bafca,null))[_0xb087('0x4e')](handleError(_0x3bafca,null));};exports[_0xb087('0x52')]=function(_0xfb8827,_0x1fe178){var _0x18d93b;return db[_0xb087('0x53')][_0xb087('0x54')](function(_0x55e653){return db[_0xb087('0x39')][_0xb087('0x52')](_0xfb8827['body'],{'transaction':_0x55e653})[_0xb087('0x2f')](function(_0x458301){_0x18d93b=_0x458301[_0xb087('0x30')]({'plain':!![]});return db[_0xb087('0x55')][_0xb087('0x50')]({'where':{'id':_0x18d93b[_0xb087('0x56')]},'raw':!![]})[_0xb087('0x2f')](function(_0x298169){return createVoicePrefixExtensions(_0x18d93b,_0x298169,_0x55e653);});});})[_0xb087('0x2f')](function(){var _0x357616=_0xfb8827[_0xb087('0x57')]['get']({'plain':!![]});if(!_0x357616)throw new Error(_0xb087('0x58'));if(_0x357616['role']===_0xb087('0x57')){var _0x575cc4=_0x18d93b;return db[_0xb087('0x59')][_0xb087('0x50')]({'where':{'name':_0xb087('0x31'),'userProfileId':_0x357616[_0xb087('0x5a')]},'raw':!![]})[_0xb087('0x2f')](function(_0x465ef6){if(_0x465ef6&&_0x465ef6[_0xb087('0x5b')]===0x0){return db[_0xb087('0x32')][_0xb087('0x52')]({'name':_0x575cc4[_0xb087('0x36')],'resourceId':_0x575cc4['id'],'type':_0x465ef6[_0xb087('0x36')],'sectionId':_0x465ef6['id']},{})[_0xb087('0x2f')](function(){return _0x18d93b;});}else{return _0x18d93b;}})[_0xb087('0x4e')](function(_0x22be05){logger[_0xb087('0x34')](_0xb087('0x5c'),_0x22be05);throw _0x22be05;});}return _0x18d93b;})[_0xb087('0x2f')](respondWithResult(_0x1fe178,null))[_0xb087('0x4e')](handleError(_0x1fe178,null));};function Extension(_0x40ff74,_0xe3cb2,_0x4053c8,_0x459c5b){this['context']=_0xb087('0x5d');this[_0xb087('0x5e')]=_0x40ff74;this[_0xb087('0x5f')]=_0x4053c8;this['type']=_0xb087('0x60');this[_0xb087('0x61')]='Voice\x20Prefix\x20Extension';this[_0xb087('0x62')]=_0xe3cb2;this[_0xb087('0x63')]=_0x459c5b;}function createVoicePrefixExtensions(_0x2e3a14,_0x596264,_0x133c58){return new BPromise(function(_0x257894,_0x3d7f74){var _0x43ef22=new Extension(formatPrefixName(_0x2e3a14[_0xb087('0x64')]),0x1,_0xb087('0x65'),_0xb087('0x66'));_0x43ef22[_0xb087('0x67')]=_0x2e3a14['id'];return db['VoiceExtension'][_0xb087('0x52')](_0x43ef22,{'transaction':_0x133c58})[_0xb087('0x2f')](function(_0x44548f){var _0x47b2c7=_0x44548f[_0xb087('0x30')]({'plain':!![]});var _0x4a26d0=_['map'](addVoicePrefixExtensions(_0x2e3a14,_0x596264),function(_0x3516d4){_0x3516d4[_0xb087('0x56')]=_0x47b2c7['id'];_0x3516d4['VoicePrefixId']=_0x2e3a14['id'];return _0x3516d4;});return db[_0xb087('0x55')]['bulkCreate'](_0x4a26d0,{'transaction':_0x133c58})[_0xb087('0x2f')](function(_0x1a8237){if(!_0x1a8237){return _0x3d7f74('Extensions\x20creation\x20failed');}else{return _0x257894(_0x1a8237);}})['catch'](function(_0x22219d){return _0x3d7f74(_0x22219d);});});;});};function addVoicePrefixExtensions(_0x5c43c8,_0x5ede2e){var _0x3c97ab=[];var _0x52d72a=formatPrefixName(_0x5c43c8[_0xb087('0x64')]);_0x3c97ab['push'](new Extension(_0x52d72a,0x2,_0xb087('0x68'),_0xb087('0x69')+_0x5c43c8[_0xb087('0x36')]));if(_0x5c43c8[_0xb087('0x6a')]){_0x3c97ab[_0xb087('0x6b')](new Extension(_0x52d72a,0x3,_0xb087('0x68'),'PREFIX-CALLERIDALL='+_0x5c43c8[_0xb087('0x6a')]));}else{_0x3c97ab['push'](new Extension(_0x52d72a,0x3,_0xb087('0x65'),_0xb087('0x6c')));}_0x3c97ab[_0xb087('0x6b')](new Extension(_0x52d72a,0x4,'goto',_0x5ede2e[_0xb087('0x6d')]+','+'${EXTEN:'+(0x8+_0x5c43c8[_0xb087('0x36')][_0xb087('0x45')])+'}'+','+0x1));return _0x3c97ab;}function formatPrefixName(_0x66f15b){var _0x2ee63f='_';for(var _0x16cb87=0x0;_0x16cb87<_0x66f15b[_0xb087('0x45')];_0x16cb87++){if(_0x66f15b['charAt'](_0x16cb87)=='-'){_0x2ee63f+=_0x66f15b[_0xb087('0x6e')](_0x16cb87);}else{_0x2ee63f+='['+_0x66f15b[_0xb087('0x6e')](_0x16cb87)+']';}}_0x2ee63f+='.';return _0x2ee63f;}exports['update']=function(_0x25a45f,_0x58de88,_0x19238d){var _0x38f5d2=_0x25a45f[_0xb087('0x6f')];_0x38f5d2[_0xb087('0x64')]=_0xb087('0x70')+_0x38f5d2[_0xb087('0x36')]+'-';return db[_0xb087('0x53')][_0xb087('0x54')](function(_0x509ee7){return db['VoicePrefix']['update'](_0x38f5d2,{'where':{'id':_0x38f5d2['id']},'transaction':_0x509ee7})[_0xb087('0x2f')](function(){return db['VoiceExtension'][_0xb087('0x2e')]({'where':{'VoicePrefixId':_0x38f5d2['id']},'transaction':_0x509ee7})['then'](function(){return db[_0xb087('0x55')][_0xb087('0x50')]({'where':{'id':_0x38f5d2[_0xb087('0x56')]},'raw':!![]})[_0xb087('0x2f')](function(_0x49d0d3){return createVoicePrefixExtensions(_0x38f5d2,_0x49d0d3,_0x509ee7);});});});})[_0xb087('0x2f')](function(){return db['VoicePrefix'][_0xb087('0x71')](_0x38f5d2['id']);})[_0xb087('0x2f')](respondWithResult(_0x58de88,null))[_0xb087('0x4e')](handleError(_0x58de88,null));};exports[_0xb087('0x72')]=function(_0x5b5ad3,_0x49d26a,_0x38f296){return db['VoicePrefix'][_0xb087('0x50')]({'where':{'id':_0x5b5ad3[_0xb087('0x73')]['id']}})[_0xb087('0x2f')](handleEntityNotFound(_0x49d26a,null))[_0xb087('0x2f')](function(_0x4a9193){if(_0x4a9193){return _0x4a9193['addAgents'](_0x5b5ad3[_0xb087('0x6f')]['ids'],_[_0xb087('0x74')](_0x5b5ad3[_0xb087('0x6f')],[_0xb087('0x75'),'id'])||{})[_0xb087('0x76')](function(_0x142b0f){for(var _0x581ad4=0x0;_0x581ad4<_0x5b5ad3[_0xb087('0x6f')][_0xb087('0x75')]['length'];_0x581ad4+=0x1){socket['emit']('userVoicePrefix:save',{'UserId':Number(_0x5b5ad3[_0xb087('0x6f')][_0xb087('0x75')][_0x581ad4]),'VoicePrefixId':Number(_0x5b5ad3[_0xb087('0x73')]['id'])});}return _0x142b0f;});}})[_0xb087('0x2f')](respondWithResult(_0x49d26a,null))[_0xb087('0x4e')](handleError(_0x49d26a,null));};exports[_0xb087('0x77')]=function(_0x47ea48,_0xd1f58a,_0x25e097){return db[_0xb087('0x39')][_0xb087('0x50')]({'where':{'id':_0x47ea48[_0xb087('0x73')]['id']}})[_0xb087('0x2f')](handleEntityNotFound(_0xd1f58a,null))[_0xb087('0x2f')](function(_0x50454b){if(_0x50454b){return _0x50454b[_0xb087('0x77')](_0x47ea48[_0xb087('0x40')][_0xb087('0x75')])['then'](function(){if(_[_0xb087('0x78')](_0x47ea48['query'][_0xb087('0x75')])){for(var _0x5fb869=0x0;_0x5fb869<_0x47ea48[_0xb087('0x40')][_0xb087('0x75')][_0xb087('0x45')];_0x5fb869+=0x1){socket[_0xb087('0x79')]('userVoicePrefix:remove',{'UserId':Number(_0x47ea48['query'][_0xb087('0x75')][_0x5fb869]),'VoicePrefixId':Number(_0x47ea48[_0xb087('0x73')]['id'])});}}else{socket['emit'](_0xb087('0x7a'),{'UserId':Number(_0x47ea48[_0xb087('0x40')][_0xb087('0x75')]),'VoicePrefixId':Number(_0x47ea48[_0xb087('0x73')]['id'])});}});}})[_0xb087('0x2f')](respondWithStatusCode(_0xd1f58a,null))[_0xb087('0x4e')](handleError(_0xd1f58a,null));};exports['getAgents']=function(_0x15ff29,_0x141859,_0x2c92f6){var _0x3114ce={};var _0x416e05={};var _0x3d6d1a;var _0xf286de;return db[_0xb087('0x39')][_0xb087('0x7b')]({'where':{'id':_0x15ff29['params']['id']}})[_0xb087('0x2f')](handleEntityNotFound(_0x141859,null))['then'](function(_0x2a32d0){if(_0x2a32d0){_0x3d6d1a=_0x2a32d0;_0x416e05[_0xb087('0x3e')]=_['keys'](db[_0xb087('0x7c')][_0xb087('0x3a')]);_0x416e05[_0xb087('0x40')]=_[_0xb087('0x3f')](_0x15ff29[_0xb087('0x40')]);_0x416e05[_0xb087('0x41')]=_['intersection'](_0x416e05[_0xb087('0x3e')],_0x416e05[_0xb087('0x40')]);_0x3114ce[_0xb087('0x43')]=_[_0xb087('0x42')](_0x416e05[_0xb087('0x3e')],qs['fields'](_0x15ff29[_0xb087('0x40')][_0xb087('0x44')]));_0x3114ce[_0xb087('0x43')]=_0x3114ce[_0xb087('0x43')][_0xb087('0x45')]?_0x3114ce[_0xb087('0x43')]:_0x416e05[_0xb087('0x3e')];_0x3114ce[_0xb087('0x47')]=qs[_0xb087('0x48')](_0x15ff29[_0xb087('0x40')][_0xb087('0x48')]);_0x3114ce['where']=qs['filters'](_[_0xb087('0x7d')](_0x15ff29[_0xb087('0x40')],_0x416e05[_0xb087('0x41')]));if(_0x15ff29[_0xb087('0x40')][_0xb087('0x49')]){_0x3114ce['where']=_[_0xb087('0x4a')](_0x3114ce[_0xb087('0x4c')],{'$or':_[_0xb087('0x38')](_0x3114ce[_0xb087('0x43')],function(_0x3e58be){var _0xbe2a4c={};_0xbe2a4c[_0x3e58be]={'$like':'%'+_0x15ff29['query'][_0xb087('0x49')]+'%'};return _0xbe2a4c;})});}_0x3114ce=_['merge']({},_0x3114ce,_0x15ff29['options']);return _0x3d6d1a[_0xb087('0x7e')](_0x3114ce);}})[_0xb087('0x2f')](function(_0x3a446d){if(_0x3a446d){_0xf286de=_0x3a446d[_0xb087('0x45')];if(!_0x15ff29['query'][_0xb087('0x46')](_0xb087('0x7f'))){_0x3114ce['limit']=qs[_0xb087('0x27')](_0x15ff29['query']['limit']);_0x3114ce[_0xb087('0x24')]=qs[_0xb087('0x24')](_0x15ff29[_0xb087('0x40')][_0xb087('0x24')]);}return _0x3d6d1a[_0xb087('0x7e')](_0x3114ce);}})['then'](function(_0x3cf818){if(_0x3cf818){return _0x3cf818?{'count':_0xf286de,'rows':_0x3cf818}:null;}})[_0xb087('0x2f')](respondWithResult(_0x141859,null))[_0xb087('0x4e')](handleError(_0x141859,null));};exports[_0xb087('0x80')]=function(_0x48e2c6,_0x489b1f,_0x544a68){var _0x5ebb4f={};var _0x17f0af={};var _0x3296c9;var _0x10e4b6;return db[_0xb087('0x39')][_0xb087('0x7b')]({'where':{'id':_0x48e2c6[_0xb087('0x73')]['id']}})[_0xb087('0x2f')](handleEntityNotFound(_0x489b1f,null))['then'](function(_0x5d45e7){if(_0x5d45e7){_0x3296c9=_0x5d45e7;_0x17f0af[_0xb087('0x3e')]=_[_0xb087('0x3f')](db[_0xb087('0x81')][_0xb087('0x3a')]);_0x17f0af['query']=_[_0xb087('0x3f')](_0x48e2c6['query']);_0x17f0af[_0xb087('0x41')]=_['intersection'](_0x17f0af[_0xb087('0x3e')],_0x17f0af[_0xb087('0x40')]);_0x5ebb4f[_0xb087('0x43')]=_[_0xb087('0x42')](_0x17f0af['model'],qs[_0xb087('0x44')](_0x48e2c6['query']['fields']));_0x5ebb4f['attributes']=_0x5ebb4f[_0xb087('0x43')]['length']?_0x5ebb4f[_0xb087('0x43')]:_0x17f0af[_0xb087('0x3e')];_0x5ebb4f[_0xb087('0x47')]=qs[_0xb087('0x48')](_0x48e2c6[_0xb087('0x40')][_0xb087('0x48')]);_0x5ebb4f[_0xb087('0x4c')]=qs[_0xb087('0x41')](_[_0xb087('0x7d')](_0x48e2c6[_0xb087('0x40')],_0x17f0af[_0xb087('0x41')]));if(_0x48e2c6[_0xb087('0x40')][_0xb087('0x49')]){_0x5ebb4f[_0xb087('0x4c')]=_[_0xb087('0x4a')](_0x5ebb4f[_0xb087('0x4c')],{'$or':_[_0xb087('0x38')](_0x5ebb4f[_0xb087('0x43')],function(_0x4e42eb){var _0x15e2f9={};_0x15e2f9[_0x4e42eb]={'$like':'%'+_0x48e2c6['query'][_0xb087('0x49')]+'%'};return _0x15e2f9;})});}_0x5ebb4f=_[_0xb087('0x4a')]({},_0x5ebb4f,_0x48e2c6[_0xb087('0x4f')]);return _0x3296c9[_0xb087('0x80')](_0x5ebb4f);}})[_0xb087('0x2f')](function(_0x2e4d22){if(_0x2e4d22){_0x10e4b6=_0x2e4d22[_0xb087('0x45')];if(!_0x48e2c6['query']['hasOwnProperty']('nolimit')){_0x5ebb4f[_0xb087('0x27')]=qs[_0xb087('0x27')](_0x48e2c6[_0xb087('0x40')][_0xb087('0x27')]);_0x5ebb4f[_0xb087('0x24')]=qs[_0xb087('0x24')](_0x48e2c6[_0xb087('0x40')][_0xb087('0x24')]);}return _0x3296c9[_0xb087('0x80')](_0x5ebb4f);}})['then'](function(_0x2de517){if(_0x2de517){return _0x2de517?{'count':_0x10e4b6,'rows':_0x2de517}:null;}})['then'](respondWithResult(_0x489b1f,null))[_0xb087('0x4e')](handleError(_0x489b1f,null));};exports[_0xb087('0x82')]=function(_0x597d80,_0x4c3aef,_0x2f2597){var _0x2ae274=_0x597d80[_0xb087('0x6f')][_0xb087('0x75')];var _0x5069f2;return db[_0xb087('0x81')][_0xb087('0x83')]({'where':{'id':_0x2ae274},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0xb087('0x36'),'online','voicePause',_0xb087('0x84')],'raw':!![]}]})['then'](function(_0x4059ac){if(_0x4059ac){_0x5069f2=_0x4059ac;var _0x12976c=_[_0xb087('0x85')](_0x4059ac,function(_0x1e48cc){var _0x2de831=_0x1e48cc[_0xb087('0x30')]({'plain':!![]});return _0x2de831[_0xb087('0x86')];});return db[_0xb087('0x39')]['find']({'where':{'id':_0x597d80[_0xb087('0x73')]['id']}})['then'](function(_0x5acf13){return db[_0xb087('0x53')][_0xb087('0x54')](function(_0x1fdb0f){return _0x5acf13['addTeams'](_0x2ae274,{'transaction':_0x1fdb0f})[_0xb087('0x2f')](function(){return BPromise[_0xb087('0x87')](_0x5069f2,function(_0x313d4b){return db[_0xb087('0x88')]['upsert']({'TeamId':_0x313d4b['id'],'VoicePrefixId':_0x597d80[_0xb087('0x73')]['id']},{'transaction':_0x1fdb0f});});})[_0xb087('0x2f')](function(){return BPromise[_0xb087('0x87')](_0x12976c,function(_0x46f5e6){return db[_0xb087('0x89')][_0xb087('0x8a')]({'where':{'UserId':_0x46f5e6['id'],'VoicePrefixId':_0x597d80[_0xb087('0x73')]['id']},'transaction':_0x1fdb0f});});})['then'](function(){_0x12976c[_0xb087('0x8b')](function(_0xfc3490){socket[_0xb087('0x79')](_0xb087('0x8c'),{'UserId':_0xfc3490['id'],'VoicePrefixId':_0x5acf13['id']});});});});});}})[_0xb087('0x2f')](respondWithStatusCode(_0x4c3aef,null))[_0xb087('0x4e')](handleError(_0x4c3aef,null));};exports['removeTeams']=function(_0x44c8cb,_0x15bbda,_0x149020){return db['Team']['findAll']({'where':{'id':_0x44c8cb[_0xb087('0x40')][_0xb087('0x75')]},'attributes':['id'],'include':[{'model':db[_0xb087('0x7c')],'as':_0xb087('0x86'),'attributes':['id'],'raw':!![]}]})[_0xb087('0x2f')](handleEntityNotFound(_0x15bbda,null))[_0xb087('0x2f')](function(_0x42528a){var _0x2795e9=_[_0xb087('0x38')](_0x42528a,'id');var _0xa58050=[];var _0x5ef263=[];var _0x1a7486=squel[_0xb087('0x8d')]();_0x1a7486[_0xb087('0x8e')](_0xb087('0x8f'))[_0xb087('0x90')]('team_has_voice_prefixes','tq')[_0xb087('0x91')](_0xb087('0x92'),'ut',_0xb087('0x93'))[_0xb087('0x4c')]('VoicePrefixId\x20=\x20?',_0x44c8cb[_0xb087('0x73')]['id']);for(var _0x547968=0x0;_0x547968<_0x42528a[_0xb087('0x45')];_0x547968+=0x1){let _0x532682=_0x42528a[_0x547968];for(var _0x5f4312=0x0;_0x5f4312<_0x532682[_0xb087('0x86')][_0xb087('0x45')];_0x5f4312+=0x1){let _0x1cb959=_0x532682['Agents'][_0x5f4312];var _0x595faa=_0x1a7486[_0xb087('0x94')]();_0x595faa[_0xb087('0x4c')](_0xb087('0x95'),_0x1cb959['id']);_0x5ef263[_0xb087('0x6b')](db[_0xb087('0x53')]['query'](_0x595faa[_0xb087('0x96')](),{'type':db[_0xb087('0x53')][_0xb087('0x97')][_0xb087('0x98')]})[_0xb087('0x2f')](function(_0x14737){if(_0x14737['length']===0x1){return _0x1cb959['id'];}else{var _0x5777d0=_[_0xb087('0x99')](_[_0xb087('0x38')](_0x14737,'TeamId'),function(_0x1f28dd){return _['includes'](_0x2795e9,_0x1f28dd);});if(_0x5777d0){return _0x1cb959['id'];}}}));}}return BPromise['all'](_0x5ef263)[_0xb087('0x2f')](function(_0x3193c8){_0xa58050=_(_0xa58050)[_0xb087('0x9a')](_0x3193c8)[_0xb087('0x9b')]()[_0xb087('0x9c')]();return db[_0xb087('0x39')][_0xb087('0x50')]({'where':{'id':_0x44c8cb[_0xb087('0x73')]['id']}})[_0xb087('0x2f')](function(_0xff9c0c){return db['sequelize']['transaction'](function(_0x5e704a){return _0xff9c0c[_0xb087('0x9d')](_0x44c8cb['query'][_0xb087('0x75')],{'transaction':_0x5e704a})['then'](function(){if(!_['isEmpty'](_0xa58050)){return _0xff9c0c[_0xb087('0x77')](_0xa58050,{'transaction':_0x5e704a});}})[_0xb087('0x2f')](function(){_0xa58050[_0xb087('0x8b')](function(_0x170d9e){socket[_0xb087('0x79')](_0xb087('0x7a'),{'UserId':_0x170d9e,'VoicePrefixId':_0xff9c0c['id']});});});});});});})[_0xb087('0x2f')](respondWithStatusCode(_0x15bbda,null))[_0xb087('0x4e')](handleError(_0x15bbda,null));}; \ No newline at end of file +var _0x25e7=['ejs','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','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','destroy','then','get','UserProfileResource','end','stack','name','send','index','map','VoicePrefix','type','model','query','keys','attributes','fields','hasOwnProperty','order','sort','filters','pick','where','merge','VIRTUAL','filter','include','findAll','catch','show','rawAttributes','intersection','includeAll','options','find','params','describe','create','sequelize','transaction','VoiceExtension','VoiceExtensionId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','VoicePrefixes','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','app','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','Set','CDR(prefix)=','push','PREFIX-CALLERIDALL=','callerIdAll','NoOp','No\x20callerid\x20available','goto','${EXTEN:','length','charAt','body','system-','update','findById','addAgents','ids','omit','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','User','nolimit','getTeams','Team','Agents','voicePause','interface','addTeams','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','forEach','removeTeams','select','field','tq.TeamId','from','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','toString','SELECT','every','TeamId','all','union','compact','value','isEmpty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0x1081c1,_0x16d00f){var _0x96a86e=function(_0x4a7372){while(--_0x4a7372){_0x1081c1['push'](_0x1081c1['shift']());}};_0x96a86e(++_0x16d00f);}(_0x25e7,0x1d6));var _0x725e=function(_0x25d4ee,_0xc95872){_0x25d4ee=_0x25d4ee-0x0;var _0x214a35=_0x25e7[_0x25d4ee];return _0x214a35;};'use strict';var emlformat=require(_0x725e('0x0'));var rimraf=require(_0x725e('0x1'));var zipdir=require(_0x725e('0x2'));var jsonpatch=require(_0x725e('0x3'));var rp=require(_0x725e('0x4'));var moment=require(_0x725e('0x5'));var BPromise=require(_0x725e('0x6'));var Mustache=require(_0x725e('0x7'));var util=require(_0x725e('0x8'));var path=require(_0x725e('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x725e('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x725e('0xb'));var crypto=require(_0x725e('0xc'));var jsforce=require(_0x725e('0xd'));var deskjs=require(_0x725e('0xe'));var toCsv=require(_0x725e('0xf'));var querystring=require(_0x725e('0x10'));var Papa=require(_0x725e('0x11'));var Redis=require(_0x725e('0x12'));var authService=require(_0x725e('0x13'));var qs=require(_0x725e('0x14'));var as=require(_0x725e('0x15'));var hardwareService=require(_0x725e('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x725e('0x17'));var config=require(_0x725e('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x725e('0x19')]=_[_0x725e('0x1a')](config['redis'],{'host':_0x725e('0x1b'),'port':0x18eb});var socket=require(_0x725e('0x1c'))(new Redis(config[_0x725e('0x19')]));require('./voicePrefix.socket')[_0x725e('0x1d')](socket);function respondWithStatusCode(_0x221e02,_0x44e652){_0x44e652=_0x44e652||0xcc;return function(_0x2e78d2){if(_0x2e78d2){return _0x221e02[_0x725e('0x1e')](_0x44e652);}return _0x221e02[_0x725e('0x1f')](_0x44e652)['end']();};}function respondWithResult(_0x156b99,_0x268312){_0x268312=_0x268312||0xc8;return function(_0x297bb7){if(_0x297bb7){return _0x156b99['status'](_0x268312)[_0x725e('0x20')](_0x297bb7);}};}function respondWithFilteredResult(_0x125fef,_0x2dda5c){return function(_0x397e33){if(_0x397e33){var _0x268438=typeof _0x2dda5c[_0x725e('0x21')]==='undefined'&&typeof _0x2dda5c[_0x725e('0x22')]===_0x725e('0x23');var _0x1b8879=_0x397e33[_0x725e('0x24')];var _0x1a9ea6=_0x268438?0x0:_0x2dda5c[_0x725e('0x21')];var _0x540802=_0x268438?_0x397e33[_0x725e('0x24')]:_0x2dda5c[_0x725e('0x21')]+_0x2dda5c[_0x725e('0x22')];var _0x40c21b;if(_0x540802>=_0x1b8879){_0x540802=_0x1b8879;_0x40c21b=0xc8;}else{_0x40c21b=0xce;}_0x125fef[_0x725e('0x1f')](_0x40c21b);return _0x125fef[_0x725e('0x25')](_0x725e('0x26'),_0x1a9ea6+'-'+_0x540802+'/'+_0x1b8879)[_0x725e('0x20')](_0x397e33);}return null;};}function patchUpdates(_0x7d0792){return function(_0x5c33c1){try{jsonpatch[_0x725e('0x27')](_0x5c33c1,_0x7d0792,!![]);}catch(_0x36cbab){return BPromise[_0x725e('0x28')](_0x36cbab);}return _0x5c33c1[_0x725e('0x29')]();};}function saveUpdates(_0x5a8191,_0xffe474){return function(_0x5268c8){if(_0x5268c8){return _0x5268c8['update'](_0x5a8191)['then'](function(_0x2aad7b){return _0x2aad7b;});}return null;};}function removeEntity(_0x1cbaae,_0x2d3c55){return function(_0x590aff){if(_0x590aff){return _0x590aff[_0x725e('0x2a')]()[_0x725e('0x2b')](function(){var _0x5a5bef=_0x590aff[_0x725e('0x2c')]({'plain':!![]});var _0x339a58='VoicePrefixes';return db[_0x725e('0x2d')]['destroy']({'where':{'type':_0x339a58,'resourceId':_0x5a5bef['id']}})['then'](function(){return _0x590aff;});})[_0x725e('0x2b')](function(){_0x1cbaae['status'](0xcc)[_0x725e('0x2e')]();});}};}function handleEntityNotFound(_0x4cc4ad,_0x4de2e0){return function(_0x9b5b7f){if(!_0x9b5b7f){_0x4cc4ad[_0x725e('0x1e')](0x194);}return _0x9b5b7f;};}function handleError(_0x33fe34,_0x545237){_0x545237=_0x545237||0x1f4;return function(_0x2e0534){logger['error'](_0x2e0534[_0x725e('0x2f')]);if(_0x2e0534[_0x725e('0x30')]){delete _0x2e0534[_0x725e('0x30')];}_0x33fe34[_0x725e('0x1f')](_0x545237)[_0x725e('0x31')](_0x2e0534);};}exports[_0x725e('0x32')]=function(_0x154ca0,_0x100c63){var _0x4271d2={},_0x3e7637={},_0x9179a4={'count':0x0,'rows':[]};var _0x5493d0=_[_0x725e('0x33')](db[_0x725e('0x34')]['rawAttributes'],function(_0x43f3c6){return{'name':_0x43f3c6['fieldName'],'type':_0x43f3c6[_0x725e('0x35')]['key']};});_0x3e7637[_0x725e('0x36')]=_[_0x725e('0x33')](_0x5493d0,_0x725e('0x30'));_0x3e7637[_0x725e('0x37')]=_[_0x725e('0x38')](_0x154ca0[_0x725e('0x37')]);_0x3e7637['filters']=_['intersection'](_0x3e7637[_0x725e('0x36')],_0x3e7637[_0x725e('0x37')]);_0x4271d2[_0x725e('0x39')]=_['intersection'](_0x3e7637[_0x725e('0x36')],qs['fields'](_0x154ca0[_0x725e('0x37')][_0x725e('0x3a')]));_0x4271d2[_0x725e('0x39')]=_0x4271d2[_0x725e('0x39')]['length']?_0x4271d2['attributes']:_0x3e7637[_0x725e('0x36')];if(!_0x154ca0[_0x725e('0x37')][_0x725e('0x3b')]('nolimit')){_0x4271d2[_0x725e('0x22')]=qs[_0x725e('0x22')](_0x154ca0[_0x725e('0x37')]['limit']);_0x4271d2[_0x725e('0x21')]=qs['offset'](_0x154ca0[_0x725e('0x37')][_0x725e('0x21')]);}_0x4271d2[_0x725e('0x3c')]=qs[_0x725e('0x3d')](_0x154ca0[_0x725e('0x37')]['sort']);_0x4271d2['where']=qs[_0x725e('0x3e')](_[_0x725e('0x3f')](_0x154ca0[_0x725e('0x37')],_0x3e7637['filters']),_0x5493d0);if(_0x154ca0[_0x725e('0x37')]['filter']){_0x4271d2[_0x725e('0x40')]=_[_0x725e('0x41')](_0x4271d2[_0x725e('0x40')],{'$or':_[_0x725e('0x33')](_0x5493d0,function(_0x48e532){if(_0x48e532[_0x725e('0x35')]!==_0x725e('0x42')){var _0x1ae4e2={};_0x1ae4e2[_0x48e532[_0x725e('0x30')]]={'$like':'%'+_0x154ca0[_0x725e('0x37')][_0x725e('0x43')]+'%'};return _0x1ae4e2;}})});}_0x4271d2=_[_0x725e('0x41')]({},_0x4271d2,_0x154ca0['options']);var _0x36b0ae={'where':_0x4271d2[_0x725e('0x40')]};return db['VoicePrefix'][_0x725e('0x24')](_0x36b0ae)[_0x725e('0x2b')](function(_0x5e719e){_0x9179a4['count']=_0x5e719e;if(_0x154ca0['query']['includeAll']){_0x4271d2[_0x725e('0x44')]=[{'all':!![]}];}return db[_0x725e('0x34')][_0x725e('0x45')](_0x4271d2);})['then'](function(_0x1eee42){_0x9179a4['rows']=_0x1eee42;return _0x9179a4;})['then'](respondWithFilteredResult(_0x100c63,_0x4271d2))[_0x725e('0x46')](handleError(_0x100c63,null));};exports[_0x725e('0x47')]=function(_0x12ffd0,_0x241960){var _0x3081df={'raw':![],'where':{'id':_0x12ffd0['params']['id']}},_0x45eed6={};_0x45eed6[_0x725e('0x36')]=_['keys'](db[_0x725e('0x34')][_0x725e('0x48')]);_0x45eed6['query']=_[_0x725e('0x38')](_0x12ffd0['query']);_0x45eed6[_0x725e('0x3e')]=_[_0x725e('0x49')](_0x45eed6['model'],_0x45eed6['query']);_0x3081df[_0x725e('0x39')]=_['intersection'](_0x45eed6[_0x725e('0x36')],qs['fields'](_0x12ffd0['query']['fields']));_0x3081df[_0x725e('0x39')]=_0x3081df[_0x725e('0x39')]['length']?_0x3081df[_0x725e('0x39')]:_0x45eed6[_0x725e('0x36')];if(_0x12ffd0['query'][_0x725e('0x4a')]){_0x3081df[_0x725e('0x44')]=[{'all':!![]}];}_0x3081df=_[_0x725e('0x41')]({},_0x3081df,_0x12ffd0[_0x725e('0x4b')]);return db[_0x725e('0x34')][_0x725e('0x4c')](_0x3081df)[_0x725e('0x2b')](handleEntityNotFound(_0x241960,null))[_0x725e('0x2b')](respondWithResult(_0x241960,null))[_0x725e('0x46')](handleError(_0x241960,null));};exports[_0x725e('0x2a')]=function(_0x34edcd,_0x14753a){return db[_0x725e('0x34')]['find']({'where':{'id':_0x34edcd[_0x725e('0x4d')]['id']}})['then'](handleEntityNotFound(_0x14753a,null))[_0x725e('0x2b')](removeEntity(_0x14753a,null))[_0x725e('0x46')](handleError(_0x14753a,null));};exports[_0x725e('0x4e')]=function(_0x1a289e,_0x34eab7){return db[_0x725e('0x34')][_0x725e('0x4e')]()[_0x725e('0x2b')](respondWithResult(_0x34eab7,null))[_0x725e('0x46')](handleError(_0x34eab7,null));};exports[_0x725e('0x4f')]=function(_0x3f4d9b,_0x248252){var _0x361050;return db[_0x725e('0x50')][_0x725e('0x51')](function(_0x3c994e){return db[_0x725e('0x34')][_0x725e('0x4f')](_0x3f4d9b['body'],{'transaction':_0x3c994e})[_0x725e('0x2b')](function(_0x5ce25f){_0x361050=_0x5ce25f[_0x725e('0x2c')]({'plain':!![]});return db[_0x725e('0x52')]['find']({'where':{'id':_0x361050[_0x725e('0x53')]},'raw':!![]})['then'](function(_0x3a2d0a){return createVoicePrefixExtensions(_0x361050,_0x3a2d0a,_0x3c994e);});});})[_0x725e('0x2b')](function(){var _0x1330b1=_0x3f4d9b['user'][_0x725e('0x2c')]({'plain':!![]});if(!_0x1330b1)throw new Error(_0x725e('0x54'));if(_0x1330b1[_0x725e('0x55')]===_0x725e('0x56')){var _0x2afb6e=_0x361050;return db[_0x725e('0x57')][_0x725e('0x4c')]({'where':{'name':_0x725e('0x58'),'userProfileId':_0x1330b1['userProfileId']},'raw':!![]})[_0x725e('0x2b')](function(_0x215018){if(_0x215018&&_0x215018['autoAssociation']===0x0){return db['UserProfileResource'][_0x725e('0x4f')]({'name':_0x2afb6e[_0x725e('0x30')],'resourceId':_0x2afb6e['id'],'type':_0x215018['name'],'sectionId':_0x215018['id']},{})['then'](function(){return _0x361050;});}else{return _0x361050;}})[_0x725e('0x46')](function(_0x2c343f){logger[_0x725e('0x59')](_0x725e('0x5a'),_0x2c343f);throw _0x2c343f;});}return _0x361050;})[_0x725e('0x2b')](respondWithResult(_0x248252,null))[_0x725e('0x46')](handleError(_0x248252,null));};function Extension(_0x591c00,_0x18fb12,_0x4498fb,_0x5c5a3f){this[_0x725e('0x5b')]=_0x725e('0x5c');this[_0x725e('0x5d')]=_0x591c00;this[_0x725e('0x5e')]=_0x4498fb;this[_0x725e('0x35')]='system';this[_0x725e('0x5f')]=_0x725e('0x60');this[_0x725e('0x61')]=_0x18fb12;this[_0x725e('0x62')]=_0x5c5a3f;}function createVoicePrefixExtensions(_0x3af5fd,_0x104a68,_0x4a742b){return new BPromise(function(_0x342ba9,_0x5f46f0){var _0x517bb9=new Extension(formatPrefixName(_0x3af5fd[_0x725e('0x63')]),0x1,'NoOp','Voice\x20Prefix');_0x517bb9[_0x725e('0x64')]=_0x3af5fd['id'];return db[_0x725e('0x52')][_0x725e('0x4f')](_0x517bb9,{'transaction':_0x4a742b})[_0x725e('0x2b')](function(_0x402eb3){var _0x2b748c=_0x402eb3[_0x725e('0x2c')]({'plain':!![]});var _0x5ecc04=_[_0x725e('0x33')](addVoicePrefixExtensions(_0x3af5fd,_0x104a68),function(_0xa138bf){_0xa138bf[_0x725e('0x53')]=_0x2b748c['id'];_0xa138bf['VoicePrefixId']=_0x3af5fd['id'];return _0xa138bf;});return db['VoiceExtension'][_0x725e('0x65')](_0x5ecc04,{'transaction':_0x4a742b})[_0x725e('0x2b')](function(_0x449f1f){if(!_0x449f1f){return _0x5f46f0(_0x725e('0x66'));}else{return _0x342ba9(_0x449f1f);}})[_0x725e('0x46')](function(_0x10c7ba){return _0x5f46f0(_0x10c7ba);});});;});};function addVoicePrefixExtensions(_0x1f977b,_0x4d97c9){var _0x24e2ed=[];var _0x5c31b6=formatPrefixName(_0x1f977b[_0x725e('0x63')]);_0x24e2ed['push'](new Extension(_0x5c31b6,0x2,_0x725e('0x67'),_0x725e('0x68')+_0x1f977b[_0x725e('0x30')]));if(_0x1f977b['callerIdAll']){_0x24e2ed[_0x725e('0x69')](new Extension(_0x5c31b6,0x3,_0x725e('0x67'),_0x725e('0x6a')+_0x1f977b[_0x725e('0x6b')]));}else{_0x24e2ed[_0x725e('0x69')](new Extension(_0x5c31b6,0x3,_0x725e('0x6c'),_0x725e('0x6d')));}_0x24e2ed[_0x725e('0x69')](new Extension(_0x5c31b6,0x4,_0x725e('0x6e'),_0x4d97c9['context']+','+_0x725e('0x6f')+(0x8+_0x1f977b[_0x725e('0x30')]['length'])+'}'+','+0x1));return _0x24e2ed;}function formatPrefixName(_0x12cc3e){var _0x1a12c1='_';for(var _0x1d2e49=0x0;_0x1d2e49<_0x12cc3e[_0x725e('0x70')];_0x1d2e49++){if(_0x12cc3e[_0x725e('0x71')](_0x1d2e49)=='-'){_0x1a12c1+=_0x12cc3e[_0x725e('0x71')](_0x1d2e49);}else{_0x1a12c1+='['+_0x12cc3e[_0x725e('0x71')](_0x1d2e49)+']';}}_0x1a12c1+='.';return _0x1a12c1;}exports['update']=function(_0x5e54b6,_0x5216eb,_0x2d13df){var _0x3fc31d=_0x5e54b6[_0x725e('0x72')];_0x3fc31d['prefix']=_0x725e('0x73')+_0x3fc31d[_0x725e('0x30')]+'-';return db['sequelize']['transaction'](function(_0xd456e4){return db['VoicePrefix'][_0x725e('0x74')](_0x3fc31d,{'where':{'id':_0x3fc31d['id']},'transaction':_0xd456e4})[_0x725e('0x2b')](function(){return db['VoiceExtension'][_0x725e('0x2a')]({'where':{'VoicePrefixId':_0x3fc31d['id']},'transaction':_0xd456e4})[_0x725e('0x2b')](function(){return db[_0x725e('0x52')]['find']({'where':{'id':_0x3fc31d[_0x725e('0x53')]},'raw':!![]})[_0x725e('0x2b')](function(_0x44bcaa){return createVoicePrefixExtensions(_0x3fc31d,_0x44bcaa,_0xd456e4);});});});})['then'](function(){return db[_0x725e('0x34')][_0x725e('0x75')](_0x3fc31d['id']);})[_0x725e('0x2b')](respondWithResult(_0x5216eb,null))[_0x725e('0x46')](handleError(_0x5216eb,null));};exports[_0x725e('0x76')]=function(_0x57dd58,_0x5b84ae,_0x2fbf91){return db[_0x725e('0x34')][_0x725e('0x4c')]({'where':{'id':_0x57dd58['params']['id']}})[_0x725e('0x2b')](handleEntityNotFound(_0x5b84ae,null))[_0x725e('0x2b')](function(_0x4d0809){if(_0x4d0809){return _0x4d0809[_0x725e('0x76')](_0x57dd58[_0x725e('0x72')][_0x725e('0x77')],_[_0x725e('0x78')](_0x57dd58[_0x725e('0x72')],['ids','id'])||{})[_0x725e('0x79')](function(_0x543e18){for(var _0xc7201d=0x0;_0xc7201d<_0x57dd58[_0x725e('0x72')][_0x725e('0x77')][_0x725e('0x70')];_0xc7201d+=0x1){socket[_0x725e('0x7a')](_0x725e('0x7b'),{'UserId':Number(_0x57dd58[_0x725e('0x72')][_0x725e('0x77')][_0xc7201d]),'VoicePrefixId':Number(_0x57dd58[_0x725e('0x4d')]['id'])});}return _0x543e18;});}})['then'](respondWithResult(_0x5b84ae,null))[_0x725e('0x46')](handleError(_0x5b84ae,null));};exports[_0x725e('0x7c')]=function(_0x2e35a9,_0x41eeeb,_0x59ef64){return db[_0x725e('0x34')][_0x725e('0x4c')]({'where':{'id':_0x2e35a9[_0x725e('0x4d')]['id']}})[_0x725e('0x2b')](handleEntityNotFound(_0x41eeeb,null))['then'](function(_0x3072d8){if(_0x3072d8){return _0x3072d8['removeAgents'](_0x2e35a9[_0x725e('0x37')]['ids'])['then'](function(){if(_[_0x725e('0x7d')](_0x2e35a9['query'][_0x725e('0x77')])){for(var _0x4ed673=0x0;_0x4ed673<_0x2e35a9[_0x725e('0x37')][_0x725e('0x77')][_0x725e('0x70')];_0x4ed673+=0x1){socket['emit'](_0x725e('0x7e'),{'UserId':Number(_0x2e35a9[_0x725e('0x37')]['ids'][_0x4ed673]),'VoicePrefixId':Number(_0x2e35a9[_0x725e('0x4d')]['id'])});}}else{socket['emit'](_0x725e('0x7e'),{'UserId':Number(_0x2e35a9[_0x725e('0x37')]['ids']),'VoicePrefixId':Number(_0x2e35a9[_0x725e('0x4d')]['id'])});}});}})[_0x725e('0x2b')](respondWithStatusCode(_0x41eeeb,null))[_0x725e('0x46')](handleError(_0x41eeeb,null));};exports[_0x725e('0x7f')]=function(_0x3beead,_0x35f227,_0x17a099){var _0x42416e={};var _0x12b0e3={};var _0x1898be;var _0xc67a2f;return db[_0x725e('0x34')][_0x725e('0x80')]({'where':{'id':_0x3beead[_0x725e('0x4d')]['id']}})[_0x725e('0x2b')](handleEntityNotFound(_0x35f227,null))[_0x725e('0x2b')](function(_0x2ca538){if(_0x2ca538){_0x1898be=_0x2ca538;_0x12b0e3['model']=_[_0x725e('0x38')](db[_0x725e('0x81')][_0x725e('0x48')]);_0x12b0e3[_0x725e('0x37')]=_[_0x725e('0x38')](_0x3beead[_0x725e('0x37')]);_0x12b0e3[_0x725e('0x3e')]=_[_0x725e('0x49')](_0x12b0e3['model'],_0x12b0e3['query']);_0x42416e[_0x725e('0x39')]=_[_0x725e('0x49')](_0x12b0e3[_0x725e('0x36')],qs['fields'](_0x3beead['query'][_0x725e('0x3a')]));_0x42416e[_0x725e('0x39')]=_0x42416e[_0x725e('0x39')][_0x725e('0x70')]?_0x42416e[_0x725e('0x39')]:_0x12b0e3[_0x725e('0x36')];_0x42416e['order']=qs[_0x725e('0x3d')](_0x3beead[_0x725e('0x37')][_0x725e('0x3d')]);_0x42416e['where']=qs[_0x725e('0x3e')](_[_0x725e('0x3f')](_0x3beead['query'],_0x12b0e3[_0x725e('0x3e')]));if(_0x3beead[_0x725e('0x37')][_0x725e('0x43')]){_0x42416e[_0x725e('0x40')]=_[_0x725e('0x41')](_0x42416e[_0x725e('0x40')],{'$or':_['map'](_0x42416e['attributes'],function(_0x3b35ba){var _0x21d697={};_0x21d697[_0x3b35ba]={'$like':'%'+_0x3beead[_0x725e('0x37')][_0x725e('0x43')]+'%'};return _0x21d697;})});}_0x42416e=_[_0x725e('0x41')]({},_0x42416e,_0x3beead['options']);return _0x1898be[_0x725e('0x7f')](_0x42416e);}})[_0x725e('0x2b')](function(_0x6e24d0){if(_0x6e24d0){_0xc67a2f=_0x6e24d0['length'];if(!_0x3beead['query'][_0x725e('0x3b')](_0x725e('0x82'))){_0x42416e[_0x725e('0x22')]=qs['limit'](_0x3beead[_0x725e('0x37')][_0x725e('0x22')]);_0x42416e[_0x725e('0x21')]=qs[_0x725e('0x21')](_0x3beead[_0x725e('0x37')][_0x725e('0x21')]);}return _0x1898be[_0x725e('0x7f')](_0x42416e);}})[_0x725e('0x2b')](function(_0x54fbe6){if(_0x54fbe6){return _0x54fbe6?{'count':_0xc67a2f,'rows':_0x54fbe6}:null;}})[_0x725e('0x2b')](respondWithResult(_0x35f227,null))['catch'](handleError(_0x35f227,null));};exports[_0x725e('0x83')]=function(_0x56fc9a,_0x51e00d,_0x2e02a3){var _0x1b6528={};var _0x4fc3ef={};var _0x50bb3e;var _0x2d37f3;return db[_0x725e('0x34')]['findOne']({'where':{'id':_0x56fc9a[_0x725e('0x4d')]['id']}})[_0x725e('0x2b')](handleEntityNotFound(_0x51e00d,null))[_0x725e('0x2b')](function(_0x1fe8bd){if(_0x1fe8bd){_0x50bb3e=_0x1fe8bd;_0x4fc3ef[_0x725e('0x36')]=_[_0x725e('0x38')](db[_0x725e('0x84')][_0x725e('0x48')]);_0x4fc3ef['query']=_[_0x725e('0x38')](_0x56fc9a[_0x725e('0x37')]);_0x4fc3ef[_0x725e('0x3e')]=_[_0x725e('0x49')](_0x4fc3ef[_0x725e('0x36')],_0x4fc3ef[_0x725e('0x37')]);_0x1b6528[_0x725e('0x39')]=_['intersection'](_0x4fc3ef[_0x725e('0x36')],qs['fields'](_0x56fc9a[_0x725e('0x37')][_0x725e('0x3a')]));_0x1b6528[_0x725e('0x39')]=_0x1b6528[_0x725e('0x39')][_0x725e('0x70')]?_0x1b6528[_0x725e('0x39')]:_0x4fc3ef['model'];_0x1b6528['order']=qs[_0x725e('0x3d')](_0x56fc9a[_0x725e('0x37')][_0x725e('0x3d')]);_0x1b6528[_0x725e('0x40')]=qs[_0x725e('0x3e')](_[_0x725e('0x3f')](_0x56fc9a[_0x725e('0x37')],_0x4fc3ef[_0x725e('0x3e')]));if(_0x56fc9a[_0x725e('0x37')][_0x725e('0x43')]){_0x1b6528[_0x725e('0x40')]=_[_0x725e('0x41')](_0x1b6528[_0x725e('0x40')],{'$or':_['map'](_0x1b6528[_0x725e('0x39')],function(_0x5877e9){var _0x2a5ee9={};_0x2a5ee9[_0x5877e9]={'$like':'%'+_0x56fc9a[_0x725e('0x37')]['filter']+'%'};return _0x2a5ee9;})});}_0x1b6528=_[_0x725e('0x41')]({},_0x1b6528,_0x56fc9a['options']);return _0x50bb3e[_0x725e('0x83')](_0x1b6528);}})[_0x725e('0x2b')](function(_0x579756){if(_0x579756){_0x2d37f3=_0x579756['length'];if(!_0x56fc9a[_0x725e('0x37')]['hasOwnProperty'](_0x725e('0x82'))){_0x1b6528['limit']=qs[_0x725e('0x22')](_0x56fc9a[_0x725e('0x37')]['limit']);_0x1b6528[_0x725e('0x21')]=qs[_0x725e('0x21')](_0x56fc9a[_0x725e('0x37')][_0x725e('0x21')]);}return _0x50bb3e[_0x725e('0x83')](_0x1b6528);}})[_0x725e('0x2b')](function(_0x354d76){if(_0x354d76){return _0x354d76?{'count':_0x2d37f3,'rows':_0x354d76}:null;}})['then'](respondWithResult(_0x51e00d,null))[_0x725e('0x46')](handleError(_0x51e00d,null));};exports['addTeams']=function(_0x1dffdd,_0x125a60,_0x58773a){var _0x58c8fe=_0x1dffdd['body'][_0x725e('0x77')];var _0x5b3b7c;return db['Team'][_0x725e('0x45')]({'where':{'id':_0x58c8fe},'attributes':['id'],'include':[{'model':db[_0x725e('0x81')],'as':_0x725e('0x85'),'attributes':['id',_0x725e('0x30'),'online',_0x725e('0x86'),_0x725e('0x87')],'raw':!![]}]})[_0x725e('0x2b')](function(_0x4cb90b){if(_0x4cb90b){_0x5b3b7c=_0x4cb90b;var _0x100b33=_['flatMap'](_0x4cb90b,function(_0x358cda){var _0x20f0a9=_0x358cda[_0x725e('0x2c')]({'plain':!![]});return _0x20f0a9[_0x725e('0x85')];});return db[_0x725e('0x34')][_0x725e('0x4c')]({'where':{'id':_0x1dffdd[_0x725e('0x4d')]['id']}})['then'](function(_0x530ac5){return db[_0x725e('0x50')][_0x725e('0x51')](function(_0xe17e71){return _0x530ac5[_0x725e('0x88')](_0x58c8fe,{'transaction':_0xe17e71})['then'](function(){return BPromise[_0x725e('0x89')](_0x5b3b7c,function(_0x4a6dd1){return db[_0x725e('0x8a')][_0x725e('0x8b')]({'TeamId':_0x4a6dd1['id'],'VoicePrefixId':_0x1dffdd[_0x725e('0x4d')]['id']},{'transaction':_0xe17e71});});})[_0x725e('0x2b')](function(){return BPromise[_0x725e('0x89')](_0x100b33,function(_0x3455da){return db[_0x725e('0x8c')][_0x725e('0x8d')]({'where':{'UserId':_0x3455da['id'],'VoicePrefixId':_0x1dffdd['params']['id']},'transaction':_0xe17e71});});})[_0x725e('0x2b')](function(){_0x100b33[_0x725e('0x8e')](function(_0x34bd67){socket[_0x725e('0x7a')](_0x725e('0x7b'),{'UserId':_0x34bd67['id'],'VoicePrefixId':_0x530ac5['id']});});});});});}})[_0x725e('0x2b')](respondWithStatusCode(_0x125a60,null))['catch'](handleError(_0x125a60,null));};exports[_0x725e('0x8f')]=function(_0x127f9b,_0x3da4d9,_0x543e64){return db[_0x725e('0x84')][_0x725e('0x45')]({'where':{'id':_0x127f9b[_0x725e('0x37')][_0x725e('0x77')]},'attributes':['id'],'include':[{'model':db[_0x725e('0x81')],'as':_0x725e('0x85'),'attributes':['id'],'raw':!![]}]})[_0x725e('0x2b')](handleEntityNotFound(_0x3da4d9,null))[_0x725e('0x2b')](function(_0x46b8f8){var _0x1f9130=_[_0x725e('0x33')](_0x46b8f8,'id');var _0x1851df=[];var _0x5ad4be=[];var _0x256b12=squel[_0x725e('0x90')]();_0x256b12[_0x725e('0x91')](_0x725e('0x92'))[_0x725e('0x93')]('team_has_voice_prefixes','tq')['join']('user_has_teams','ut',_0x725e('0x94'))['where']('VoicePrefixId\x20=\x20?',_0x127f9b[_0x725e('0x4d')]['id']);for(var _0x545eb3=0x0;_0x545eb3<_0x46b8f8[_0x725e('0x70')];_0x545eb3+=0x1){let _0x28aebc=_0x46b8f8[_0x545eb3];for(var _0x322347=0x0;_0x322347<_0x28aebc['Agents'][_0x725e('0x70')];_0x322347+=0x1){let _0x35aa4a=_0x28aebc['Agents'][_0x322347];var _0x3e7f45=_0x256b12[_0x725e('0x95')]();_0x3e7f45[_0x725e('0x40')](_0x725e('0x96'),_0x35aa4a['id']);_0x5ad4be[_0x725e('0x69')](db['sequelize']['query'](_0x3e7f45[_0x725e('0x97')](),{'type':db[_0x725e('0x50')]['QueryTypes'][_0x725e('0x98')]})['then'](function(_0x55ef18){if(_0x55ef18[_0x725e('0x70')]===0x1){return _0x35aa4a['id'];}else{var _0x5c11d5=_[_0x725e('0x99')](_[_0x725e('0x33')](_0x55ef18,_0x725e('0x9a')),function(_0x4cc2fb){return _['includes'](_0x1f9130,_0x4cc2fb);});if(_0x5c11d5){return _0x35aa4a['id'];}}}));}}return BPromise[_0x725e('0x9b')](_0x5ad4be)[_0x725e('0x2b')](function(_0x1d533b){_0x1851df=_(_0x1851df)[_0x725e('0x9c')](_0x1d533b)[_0x725e('0x9d')]()[_0x725e('0x9e')]();return db['VoicePrefix'][_0x725e('0x4c')]({'where':{'id':_0x127f9b[_0x725e('0x4d')]['id']}})[_0x725e('0x2b')](function(_0x51ba9d){return db[_0x725e('0x50')][_0x725e('0x51')](function(_0xe8e8d7){return _0x51ba9d[_0x725e('0x8f')](_0x127f9b['query'][_0x725e('0x77')],{'transaction':_0xe8e8d7})[_0x725e('0x2b')](function(){if(!_[_0x725e('0x9f')](_0x1851df)){return _0x51ba9d[_0x725e('0x7c')](_0x1851df,{'transaction':_0xe8e8d7});}})['then'](function(){_0x1851df[_0x725e('0x8e')](function(_0x5f3ad7){socket[_0x725e('0x7a')]('userVoicePrefix:remove',{'UserId':_0x5f3ad7,'VoicePrefixId':_0x51ba9d['id']});});});});});});})[_0x725e('0x2b')](respondWithStatusCode(_0x3da4d9,null))[_0x725e('0x46')](handleError(_0x3da4d9,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index edf2fdc..bd51843 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 _0xf020=['save','update','remove','emit','hasOwnProperty','hook','exports','setMaxListeners'];(function(_0x2b0267,_0x59cab1){var _0x289a4a=function(_0x3ec45c){while(--_0x3ec45c){_0x2b0267['push'](_0x2b0267['shift']());}};_0x289a4a(++_0x59cab1);}(_0xf020,0x107));var _0x0f02=function(_0x465a97,_0x482fe2){_0x465a97=_0x465a97-0x0;var _0x4d7641=_0xf020[_0x465a97];return _0x4d7641;};'use strict';var EventEmitter=require('events');var VoicePrefix=require('../../mysqldb')['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x0f02('0x0')](0x0);var events={'afterCreate':_0x0f02('0x1'),'afterUpdate':_0x0f02('0x2'),'afterDestroy':_0x0f02('0x3')};function emitEvent(_0x4143da){return function(_0x151234,_0x234efb,_0x2c4026){VoicePrefixEvents['emit'](_0x4143da+':'+_0x151234['id'],_0x151234);VoicePrefixEvents[_0x0f02('0x4')](_0x4143da,_0x151234);_0x2c4026(null);};}for(var e in events){if(events[_0x0f02('0x5')](e)){var event=events[e];VoicePrefix[_0x0f02('0x6')](e,emitEvent(event));}}module[_0x0f02('0x7')]=VoicePrefixEvents; \ No newline at end of file +var _0xa14b=['hook','exports','events','setMaxListeners','update','remove','emit'];(function(_0x455daa,_0x1f4085){var _0x21eae7=function(_0x20f9a0){while(--_0x20f9a0){_0x455daa['push'](_0x455daa['shift']());}};_0x21eae7(++_0x1f4085);}(_0xa14b,0x16e));var _0xba14=function(_0x383da7,_0x4f5253){_0x383da7=_0x383da7-0x0;var _0x4b7406=_0xa14b[_0x383da7];return _0x4b7406;};'use strict';var EventEmitter=require(_0xba14('0x0'));var VoicePrefix=require('../../mysqldb')['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xba14('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xba14('0x2'),'afterDestroy':_0xba14('0x3')};function emitEvent(_0x23b2c8){return function(_0x7a142e,_0x8d8c95,_0x43eb33){VoicePrefixEvents[_0xba14('0x4')](_0x23b2c8+':'+_0x7a142e['id'],_0x7a142e);VoicePrefixEvents['emit'](_0x23b2c8,_0x7a142e);_0x43eb33(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix[_0xba14('0x5')](e,emitEvent(event));}}module[_0xba14('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 3e283fc..2892550 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 _0x60ac=['rimraf','../../config/environment','./voicePrefix.attributes','exports','VoicePrefix','voice_prefixes','util','../../config/logger','api','request-promise'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0x60ac,0x1dc));var _0xc60a=function(_0x51718b,_0x4d6cf0){_0x51718b=_0x51718b-0x0;var _0x2f48d0=_0x60ac[_0x51718b];return _0x2f48d0;};'use strict';var _=require('lodash');var util=require(_0xc60a('0x0'));var logger=require(_0xc60a('0x1'))(_0xc60a('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc60a('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc60a('0x4'));var config=require(_0xc60a('0x5'));var attributes=require(_0xc60a('0x6'));module[_0xc60a('0x7')]=function(_0x546221,_0x549ea3){return _0x546221['define'](_0xc60a('0x8'),attributes,{'tableName':_0xc60a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x38db=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./voicePrefix.attributes','exports','define','VoicePrefix','voice_prefixes','lodash','util','../../config/logger'];(function(_0x7b341f,_0x11e481){var _0x46d0a1=function(_0x6f779d){while(--_0x6f779d){_0x7b341f['push'](_0x7b341f['shift']());}};_0x46d0a1(++_0x11e481);}(_0x38db,0xf9));var _0xb38d=function(_0x10578b,_0x13a6dd){_0x10578b=_0x10578b-0x0;var _0x5ef794=_0x38db[_0x10578b];return _0x5ef794;};'use strict';var _=require(_0xb38d('0x0'));var util=require(_0xb38d('0x1'));var logger=require(_0xb38d('0x2'))('api');var moment=require(_0xb38d('0x3'));var BPromise=require(_0xb38d('0x4'));var rp=require(_0xb38d('0x5'));var fs=require('fs');var path=require(_0xb38d('0x6'));var rimraf=require(_0xb38d('0x7'));var config=require(_0xb38d('0x8'));var attributes=require(_0xb38d('0x9'));module[_0xb38d('0xa')]=function(_0x12c0d0,_0x13242){return _0x12c0d0[_0xb38d('0xb')](_0xb38d('0xc'),attributes,{'tableName':_0xb38d('0xd'),'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 805f335..c0ac309 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 _0x90ec=['VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','VoicePrefix,\x20%s,\x20%s','message','info','request\x20sent','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','./voicePrefix.socket','register','then','debug'];(function(_0x115101,_0xa83f5c){var _0x269158=function(_0x4f8661){while(--_0x4f8661){_0x115101['push'](_0x115101['shift']());}};_0x269158(++_0xa83f5c);}(_0x90ec,0x1d4));var _0xc90e=function(_0x302fd6,_0x30dfc8){_0x302fd6=_0x302fd6-0x0;var _0x34c3c7=_0x90ec[_0x302fd6];return _0x34c3c7;};'use strict';var _=require(_0xc90e('0x0'));var util=require(_0xc90e('0x1'));var moment=require('moment');var BPromise=require(_0xc90e('0x2'));var rs=require(_0xc90e('0x3'));var fs=require('fs');var Redis=require(_0xc90e('0x4'));var db=require(_0xc90e('0x5'))['db'];var utils=require(_0xc90e('0x6'));var logger=require('../../config/logger')(_0xc90e('0x7'));var config=require(_0xc90e('0x8'));var jayson=require(_0xc90e('0x9'));var client=jayson['client'][_0xc90e('0xa')]({'port':0x232a});config['redis']=_[_0xc90e('0xb')](config[_0xc90e('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xc90e('0xd'))(new Redis(config[_0xc90e('0xc')]));require(_0xc90e('0xe'))[_0xc90e('0xf')](socket);function respondWithRpcPromise(_0x3702ed,_0x1bfb66,_0x386e63){return new BPromise(function(_0x3aff4c,_0xc4cba){return client['request'](_0x3702ed,_0x386e63)[_0xc90e('0x10')](function(_0x5e14b7){logger['info']('VoicePrefix,\x20%s,\x20%s',_0x1bfb66,'request\x20sent');logger[_0xc90e('0x11')](_0xc90e('0x12'),_0x1bfb66,'request\x20sent',JSON[_0xc90e('0x13')](_0x5e14b7));if(_0x5e14b7[_0xc90e('0x14')]){if(_0x5e14b7['error'][_0xc90e('0x15')]===0x1f4){logger[_0xc90e('0x14')](_0xc90e('0x16'),_0x1bfb66,_0x5e14b7[_0xc90e('0x14')][_0xc90e('0x17')]);return _0xc4cba(_0x5e14b7[_0xc90e('0x14')]['message']);}logger[_0xc90e('0x14')](_0xc90e('0x16'),_0x1bfb66,_0x5e14b7['error'][_0xc90e('0x17')]);return _0x3aff4c(_0x5e14b7['error'][_0xc90e('0x17')]);}else{logger[_0xc90e('0x18')]('VoicePrefix,\x20%s,\x20%s',_0x1bfb66,_0xc90e('0x19'));_0x3aff4c(_0x5e14b7[_0xc90e('0x1a')][_0xc90e('0x17')]);}})['catch'](function(_0x5cf3f5){logger['error'](_0xc90e('0x16'),_0x1bfb66,_0x5cf3f5);_0xc4cba(_0x5cf3f5);});});} \ No newline at end of file +var _0x15ef=['request\x20sent','debug','stringify','error','code','message','info','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','localhost','./voicePrefix.socket','register','request','VoicePrefix,\x20%s,\x20%s'];(function(_0x36b728,_0x3d942a){var _0x50f42c=function(_0xa0ecb2){while(--_0xa0ecb2){_0x36b728['push'](_0x36b728['shift']());}};_0x50f42c(++_0x3d942a);}(_0x15ef,0x80));var _0xf15e=function(_0x5f4613,_0x58bce2){_0x5f4613=_0x5f4613-0x0;var _0x105875=_0x15ef[_0x5f4613];return _0x105875;};'use strict';var _=require('lodash');var util=require(_0xf15e('0x0'));var moment=require(_0xf15e('0x1'));var BPromise=require('bluebird');var rs=require(_0xf15e('0x2'));var fs=require('fs');var Redis=require(_0xf15e('0x3'));var db=require(_0xf15e('0x4'))['db'];var utils=require(_0xf15e('0x5'));var logger=require(_0xf15e('0x6'))('rpc');var config=require(_0xf15e('0x7'));var jayson=require(_0xf15e('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0xf15e('0x9')]=_[_0xf15e('0xa')](config['redis'],{'host':_0xf15e('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf15e('0x9')]));require(_0xf15e('0xc'))[_0xf15e('0xd')](socket);function respondWithRpcPromise(_0x403e52,_0x556bf5,_0x492fa3){return new BPromise(function(_0x5a14f5,_0x250a60){return client[_0xf15e('0xe')](_0x403e52,_0x492fa3)['then'](function(_0x5e487f){logger['info'](_0xf15e('0xf'),_0x556bf5,_0xf15e('0x10'));logger[_0xf15e('0x11')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x556bf5,_0xf15e('0x10'),JSON[_0xf15e('0x12')](_0x5e487f));if(_0x5e487f[_0xf15e('0x13')]){if(_0x5e487f['error'][_0xf15e('0x14')]===0x1f4){logger[_0xf15e('0x13')](_0xf15e('0xf'),_0x556bf5,_0x5e487f[_0xf15e('0x13')][_0xf15e('0x15')]);return _0x250a60(_0x5e487f[_0xf15e('0x13')][_0xf15e('0x15')]);}logger[_0xf15e('0x13')]('VoicePrefix,\x20%s,\x20%s',_0x556bf5,_0x5e487f[_0xf15e('0x13')][_0xf15e('0x15')]);return _0x5a14f5(_0x5e487f['error'][_0xf15e('0x15')]);}else{logger[_0xf15e('0x16')](_0xf15e('0xf'),_0x556bf5,'request\x20sent');_0x5a14f5(_0x5e487f['result'][_0xf15e('0x15')]);}})[_0xf15e('0x17')](function(_0x503df0){logger[_0xf15e('0x13')](_0xf15e('0xf'),_0x556bf5,_0x503df0);_0x250a60(_0x503df0);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 739b37c..ecd2b80 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 _0xc686=['removeListener','register','length','remove','emit'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xc686,0x148));var _0x6c68=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xc686[_0x311c35];return _0x5cc50c;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=['save',_0x6c68('0x0'),'update'];function createListener(_0xe45565,_0x5f1f2c){return function(_0x1f6b6d){_0x5f1f2c[_0x6c68('0x1')](_0xe45565,_0x1f6b6d);};}function removeListener(_0x1bfe91,_0x434bb0){return function(){VoicePrefixEvents[_0x6c68('0x2')](_0x1bfe91,_0x434bb0);};}exports[_0x6c68('0x3')]=function(_0x1c1b02){for(var _0x2d5dda=0x0,_0x3dc035=events[_0x6c68('0x4')];_0x2d5dda<_0x3dc035;_0x2d5dda++){var _0x12e935=events[_0x2d5dda];var _0x394644=createListener('voicePrefix:'+_0x12e935,_0x1c1b02);VoicePrefixEvents['on'](_0x12e935,_0x394644);}}; \ No newline at end of file +var _0x9234=['emit','removeListener','register','length','voicePrefix:','./voicePrefix.events','remove','update'];(function(_0x172cf0,_0x5cb39c){var _0x112c4f=function(_0x348be1){while(--_0x348be1){_0x172cf0['push'](_0x172cf0['shift']());}};_0x112c4f(++_0x5cb39c);}(_0x9234,0x1bd));var _0x4923=function(_0x133fe4,_0x1f473b){_0x133fe4=_0x133fe4-0x0;var _0x4c4017=_0x9234[_0x133fe4];return _0x4c4017;};'use strict';var VoicePrefixEvents=require(_0x4923('0x0'));var events=['save',_0x4923('0x1'),_0x4923('0x2')];function createListener(_0x1f0d3a,_0x34915b){return function(_0x481178){_0x34915b[_0x4923('0x3')](_0x1f0d3a,_0x481178);};}function removeListener(_0x436ce1,_0x4bf615){return function(){VoicePrefixEvents[_0x4923('0x4')](_0x436ce1,_0x4bf615);};}exports[_0x4923('0x5')]=function(_0x526ad7){for(var _0x3c5e3f=0x0,_0x17b854=events[_0x4923('0x6')];_0x3c5e3f<_0x17b854;_0x3c5e3f++){var _0x2de396=events[_0x3c5e3f];var _0x548676=createListener(_0x4923('0x7')+_0x2de396,_0x526ad7);VoicePrefixEvents['on'](_0x2de396,_0x548676);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 734182c..2bc50f8 100644 --- a/server/api/voiceQueue/index.js +++ b/server/api/voiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['addAgents','/:id/blacklists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','getHoppers','/:id/hopper_histories','isAuthenticated','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addTeams'];(function(_0x1c5399,_0x2982bc){var _0x540808=function(_0xd18932){while(--_0xd18932){_0x1c5399['push'](_0x1c5399['shift']());}};_0x540808(++_0x2982bc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file +var _0xa9e0=['addAgents','/:id/blacklists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','getHoppers','/:id/hopper_histories','isAuthenticated','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addTeams'];(function(_0x3d4d5a,_0x42ab3d){var _0x5e1643=function(_0x4e51d9){while(--_0x4e51d9){_0x3d4d5a['push'](_0x3d4d5a['shift']());}};_0x5e1643(++_0x42ab3d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xa9e0[_0x934425];return _0x31d596;};'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 6f46356..f1b85af 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 _0x89ae=['fewestcalls','linear','wrandom','rrordered','rrmemory','getDataValue','type','dialMethod','booked','progressive','predictive','power','INTEGER','yes','all','once','TEXT','setDataValue','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','wrapuptime','Active/Disactive\x20Campaign','preview','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','FLOAT','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Congestion\x20Retry\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','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','ASC','DESC','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','sequelize','exports','name','ENUM','inbound','outbound','STRING','default','ringall','leastrecent'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x89ae,0x13e));var _0xe89a=function(_0x4b1f9c,_0x422fc9){_0x4b1f9c=_0x4b1f9c-0x0;var _0x3e0632=_0x89ae[_0x4b1f9c];return _0x3e0632;};'use strict';var Sequelize=require(_0xe89a('0x0'));module[_0xe89a('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xe89a('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xe89a('0x3')](_0xe89a('0x4'),_0xe89a('0x5')),'allowNull':![],'defaultValue':_0xe89a('0x4')},'musiconhold':{'type':Sequelize[_0xe89a('0x6')],'defaultValue':_0xe89a('0x7')},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize[_0xe89a('0x3')]('rr',_0xe89a('0x8'),_0xe89a('0x9'),_0xe89a('0xa'),'random','rrmemory',_0xe89a('0xb'),_0xe89a('0xc'),_0xe89a('0xd')),'allowNull':![],'defaultValue':_0xe89a('0x8'),'set':function(_0x394aec){this['setDataValue']('strategy',_0x394aec?_0x394aec:_0xe89a('0xe'));},'get':function(){var _0x96fcfd=this[_0xe89a('0xf')](_0xe89a('0x10'));var _0x500d52=this['getDataValue'](_0xe89a('0x11'));var _0x5ed650=this[_0xe89a('0xf')]('strategy');if(_0x96fcfd===_0xe89a('0x4')){return _0x5ed650;}if(_0x500d52===_0xe89a('0x12')&&_0x5ed650===_0xe89a('0xe')||_0x500d52==='booked'&&_0x5ed650==='roundrobin'){return _0x5ed650;}if(_0x500d52===_0xe89a('0x13')||_0x500d52===_0xe89a('0x14')||_0x500d52===_0xe89a('0x15')){return _0x5ed650;}return null;}},'servicelevel':{'type':Sequelize[_0xe89a('0x16')](0xb),'defaultValue':0x0},'context':{'type':Sequelize['STRING'],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0xe89a('0x16')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xe89a('0x16')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xe89a('0x6')]},'weight':{'type':Sequelize[_0xe89a('0x16')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xe89a('0x3')](_0xe89a('0x17'),'no'),'defaultValue':_0xe89a('0x17')},'autopause':{'type':Sequelize[_0xe89a('0x3')](_0xe89a('0x17'),'no',_0xe89a('0x18')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize[_0xe89a('0x3')](_0xe89a('0x17'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xe89a('0x3')](_0xe89a('0x17'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xe89a('0x16')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xe89a('0x3')](_0xe89a('0x17'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xe89a('0x3')](_0xe89a('0x17'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xe89a('0x3')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xe89a('0x6')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xe89a('0x6')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xe89a('0x16')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xe89a('0x16')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xe89a('0x3')](_0xe89a('0x17'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xe89a('0x3')](_0xe89a('0x17'),'no'),'defaultValue':_0xe89a('0x17')},'announce_holdtime':{'type':Sequelize[_0xe89a('0x3')]('yes','no',_0xe89a('0x19')),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xe89a('0x3')](_0xe89a('0x17'),'no')},'announce_position_limit':{'type':Sequelize[_0xe89a('0x16')](0xb)},'announce_round_seconds':{'type':Sequelize[_0xe89a('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xe89a('0x6')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xe89a('0x6')]},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xe89a('0x6')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xe89a('0x6')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xe89a('0x6')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xe89a('0x6')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xe89a('0x6')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xe89a('0x6')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xe89a('0x6')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xe89a('0x6')]},'queue_quantity1':{'type':Sequelize[_0xe89a('0x6')]},'queue_quantity2':{'type':Sequelize[_0xe89a('0x6')]},'queue_periodic_announce':{'type':Sequelize[_0xe89a('0x6')]},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize[_0xe89a('0x1a')],'set':function(_0x3e0d47){this[_0xe89a('0x1b')](_0xe89a('0x1c'),_0x3e0d47?_0x3e0d47[_0xe89a('0x1d')](','):[]);},'get':function(){return this['getDataValue'](_0xe89a('0x1c'))?this[_0xe89a('0xf')](_0xe89a('0x1c'))[_0xe89a('0x1e')](','):[];}},'joinempty':{'type':Sequelize[_0xe89a('0x6')],'defaultValue':_0xe89a('0x17'),'set':function(_0xea0cf1){this['setDataValue'](_0xe89a('0x1f'),_0xea0cf1?_0xea0cf1[_0xe89a('0x1d')](','):undefined);},'get':function(){return this[_0xe89a('0xf')](_0xe89a('0x1f'))?this['getDataValue'](_0xe89a('0x1f'))['split'](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xe89a('0x6')],'defaultValue':'no','set':function(_0x3a15bb){this['setDataValue']('leavewhenempty',_0x3a15bb?_0x3a15bb['join'](','):undefined);},'get':function(){return this['getDataValue']('leavewhenempty')?this['getDataValue'](_0xe89a('0x20'))['split'](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xe89a('0x3')](_0xe89a('0x17'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xe89a('0x3')](_0xe89a('0x17'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xe89a('0x16')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM'](_0xe89a('0x17'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xe89a('0x6')]},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize[_0xe89a('0x21')],'defaultValue':0x0,'set':function(_0x5c865d){this['setDataValue']('acw',_0x5c865d);if(_0x5c865d){if(this[_0xe89a('0xf')](_0xe89a('0x22'))<0x2){this[_0xe89a('0x1b')](_0xe89a('0x22'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xe89a('0x21')],'defaultValue':0x0,'comment':_0xe89a('0x23')},'dialMethod':{'type':Sequelize[_0xe89a('0x3')](_0xe89a('0x24'),_0xe89a('0x13'),_0xe89a('0x15'),_0xe89a('0x14'),'booked'),'defaultValue':_0xe89a('0x13'),'comment':_0xe89a('0x25')},'dialLimitChannel':{'type':Sequelize[_0xe89a('0x16')](0x4)[_0xe89a('0x26')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xe89a('0x27')},'dialLimitQueue':{'type':Sequelize[_0xe89a('0x16')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xe89a('0x28')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xe89a('0x29')},'dialPredictiveOptimization':{'type':Sequelize['ENUM'](_0xe89a('0x2a'),_0xe89a('0x2b')),'defaultValue':'dropRate','comment':_0xe89a('0x2c')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xe89a('0x2d')](0x2)[_0xe89a('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xe89a('0x2e')},'dialPredictiveInterval':{'type':Sequelize[_0xe89a('0x16')](0x3)[_0xe89a('0x26')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xe89a('0x2f')},'dialOriginateCallerIdName':{'type':Sequelize[_0xe89a('0x6')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xe89a('0x6')]},'dialOriginateTimeout':{'type':Sequelize[_0xe89a('0x16')](0x3)[_0xe89a('0x26')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe89a('0x30')},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':_0xe89a('0x31'),'comment':_0xe89a('0x32')},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe89a('0x33')},'dialQueueProject':{'type':Sequelize[_0xe89a('0x6')],'comment':_0xe89a('0x34')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0xe89a('0x16')](0x5)[_0xe89a('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe89a('0x35')},'dialBusyMaxRetry':{'type':Sequelize[_0xe89a('0x16')](0x3)[_0xe89a('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe89a('0x36')},'dialBusyRetryFrequency':{'type':Sequelize[_0xe89a('0x16')](0x5)[_0xe89a('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe89a('0x37')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xe89a('0x16')](0x3)[_0xe89a('0x26')],'defaultValue':0x3,'comment':_0xe89a('0x38')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xe89a('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe89a('0x39')},'dialGlobalMaxRetry':{'type':Sequelize[_0xe89a('0x16')](0x3)[_0xe89a('0x26')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xe89a('0x3a')},'dialTimezone':{'type':Sequelize[_0xe89a('0x6')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xe89a('0x6')],'defaultValue':_0xe89a('0x3b')},'dialPrefix':{'type':Sequelize[_0xe89a('0x6')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xe89a('0x3')](_0xe89a('0x3c'),_0xe89a('0x3d'),_0xe89a('0x3e')),'defaultValue':_0xe89a('0x3c')},'dialAMDActive':{'type':Sequelize[_0xe89a('0x21')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0xe89a('0x16')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xe89a('0x3f')},'dialAMDGreeting':{'type':Sequelize[_0xe89a('0x16')](0x9)[_0xe89a('0x26')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0xe89a('0x26')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xe89a('0x40')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0xe89a('0x26')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0xe89a('0x16')](0x9)[_0xe89a('0x26')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0xe89a('0x26')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xe89a('0x41')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0xe89a('0x26')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xe89a('0x42')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0xe89a('0x26')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0xe89a('0x16')](0x9)[_0xe89a('0x26')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xe89a('0x43')},'dialRecallMeTimeout':{'type':Sequelize[_0xe89a('0x16')](0x5)[_0xe89a('0x26')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xe89a('0x44')},'dialRecallInQueue':{'type':Sequelize[_0xe89a('0x21')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize[_0xe89a('0x3')]('DESC',_0xe89a('0x45')),'defaultValue':_0xe89a('0x46')},'dialQueueProject2':{'type':Sequelize[_0xe89a('0x6')],'comment':_0xe89a('0x34')},'dialAgiAfterHangupClient':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xe89a('0x21')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xe89a('0x16')](0x3)[_0xe89a('0x26')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0xe89a('0x16')](0x3)[_0xe89a('0x26')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xe89a('0x47')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xe89a('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe89a('0x48')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xe89a('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe89a('0x49')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xe89a('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0xe89a('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe89a('0x4a')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xe89a('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe89a('0x4b')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe89a('0x4c')},'dialMachineMaxRetry':{'type':Sequelize[_0xe89a('0x16')](0x3)[_0xe89a('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe89a('0x4d')},'dialMachineRetryFrequency':{'type':Sequelize[_0xe89a('0x16')](0x5)[_0xe89a('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xe89a('0x16')](0x3)[_0xe89a('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe89a('0x4e')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xe89a('0x16')](0x5)[_0xe89a('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe89a('0x4f')},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe89a('0x16')],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xe89a('0x21')],'defaultValue':![],'comment':_0xe89a('0x50'),'set':function(_0x221f80){if(!_0x221f80)this['setDataValue'](_0xe89a('0x51'),null);this[_0xe89a('0x1b')]('mandatoryDisposition',_0x221f80);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xe89a('0x16')](0x3)[_0xe89a('0x26')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0xe89a('0x16')](0x3)[_0xe89a('0x26')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0xe89a('0x21')],'defaultValue':![]}}; \ No newline at end of file +var _0x65e4=['Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','tTxX','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Busy\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#RecallMe\x20Timeout\x20(min:1)','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','exports','STRING','name','inbound','outbound','default','ringall','fewestcalls','linear','wrandom','rrordered','setDataValue','rrmemory','type','getDataValue','dialMethod','strategy','booked','roundrobin','predictive','INTEGER','ENUM','yes','all','once','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','preview','progressive','power','Dial\x20Method.','UNSIGNED'];(function(_0x19687b,_0xbe5ebe){var _0x197878=function(_0xe490bd){while(--_0xe490bd){_0x19687b['push'](_0x19687b['shift']());}};_0x197878(++_0xbe5ebe);}(_0x65e4,0x1de));var _0x465e=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x65e4[_0x167cc1];return _0x10bc4b;};'use strict';var Sequelize=require('sequelize');module[_0x465e('0x0')]={'name':{'type':Sequelize[_0x465e('0x1')],'allowNull':![],'unique':_0x465e('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x465e('0x3'),_0x465e('0x4')),'allowNull':![],'defaultValue':_0x465e('0x3')},'musiconhold':{'type':Sequelize[_0x465e('0x1')],'defaultValue':_0x465e('0x5')},'announce':{'type':Sequelize[_0x465e('0x1')],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr',_0x465e('0x6'),'leastrecent',_0x465e('0x7'),'random','rrmemory',_0x465e('0x8'),_0x465e('0x9'),_0x465e('0xa')),'allowNull':![],'defaultValue':_0x465e('0x6'),'set':function(_0x4398e8){this[_0x465e('0xb')]('strategy',_0x4398e8?_0x4398e8:_0x465e('0xc'));},'get':function(){var _0x18448d=this['getDataValue'](_0x465e('0xd'));var _0x49782f=this[_0x465e('0xe')](_0x465e('0xf'));var _0x59d429=this[_0x465e('0xe')](_0x465e('0x10'));if(_0x18448d===_0x465e('0x3')){return _0x59d429;}if(_0x49782f==='booked'&&_0x59d429==='rrmemory'||_0x49782f===_0x465e('0x11')&&_0x59d429===_0x465e('0x12')){return _0x59d429;}if(_0x49782f==='progressive'||_0x49782f===_0x465e('0x13')||_0x49782f==='power'){return _0x59d429;}return null;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x465e('0x1')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x465e('0x14')](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x465e('0x1')]},'weight':{'type':Sequelize[_0x465e('0x14')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x465e('0x14')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x465e('0x15')](_0x465e('0x16'),'no'),'defaultValue':'yes'},'autopause':{'type':Sequelize[_0x465e('0x15')](_0x465e('0x16'),'no',_0x465e('0x17')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x465e('0x14')](0xb)},'autopausebusy':{'type':Sequelize[_0x465e('0x15')](_0x465e('0x16'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM'](_0x465e('0x16'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x465e('0x14')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize['ENUM'](_0x465e('0x16'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x465e('0x15')]('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x465e('0x15')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x465e('0x1')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x465e('0x1')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x465e('0x14')](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[_0x465e('0x15')](_0x465e('0x16'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x465e('0x15')](_0x465e('0x16'),'no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize[_0x465e('0x15')]('yes','no',_0x465e('0x18')),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x465e('0x15')](_0x465e('0x16'),'no')},'announce_position_limit':{'type':Sequelize[_0x465e('0x14')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x465e('0x15')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x465e('0x1')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x465e('0x1')]},'queue_youarenext':{'type':Sequelize[_0x465e('0x1')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x465e('0x1')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x465e('0x1')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x465e('0x1')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x465e('0x1')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x465e('0x1')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x465e('0x1')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x465e('0x1')]},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize[_0x465e('0x1')]},'queue_less_than':{'type':Sequelize[_0x465e('0x1')]},'periodic_announce':{'type':Sequelize[_0x465e('0x19')],'set':function(_0x2e7d03){this[_0x465e('0xb')](_0x465e('0x1a'),_0x2e7d03?_0x2e7d03[_0x465e('0x1b')](','):[]);},'get':function(){return this[_0x465e('0xe')](_0x465e('0x1a'))?this[_0x465e('0xe')](_0x465e('0x1a'))[_0x465e('0x1c')](','):[];}},'joinempty':{'type':Sequelize[_0x465e('0x1')],'defaultValue':'yes','set':function(_0x660af9){this['setDataValue'](_0x465e('0x1d'),_0x660af9?_0x660af9['join'](','):undefined);},'get':function(){return this[_0x465e('0xe')](_0x465e('0x1d'))?this['getDataValue'](_0x465e('0x1d'))['split'](','):undefined;}},'leavewhenempty':{'type':Sequelize['STRING'],'defaultValue':'no','set':function(_0x578ac5){this[_0x465e('0xb')]('leavewhenempty',_0x578ac5?_0x578ac5[_0x465e('0x1b')](','):undefined);},'get':function(){return this[_0x465e('0xe')](_0x465e('0x1e'))?this['getDataValue'](_0x465e('0x1e'))[_0x465e('0x1c')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x465e('0x15')]('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x465e('0x15')](_0x465e('0x16'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x465e('0x15')]('yes','no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x465e('0x1')]},'description':{'type':Sequelize[_0x465e('0x1')]},'acw':{'type':Sequelize[_0x465e('0x1f')],'defaultValue':0x0,'set':function(_0x5e6777){this[_0x465e('0xb')](_0x465e('0x20'),_0x5e6777);if(_0x5e6777){if(this[_0x465e('0xe')](_0x465e('0x21'))<0x2){this[_0x465e('0xb')](_0x465e('0x21'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x465e('0x1f')],'defaultValue':0x0,'comment':_0x465e('0x22')},'dialMethod':{'type':Sequelize['ENUM'](_0x465e('0x23'),_0x465e('0x24'),_0x465e('0x25'),_0x465e('0x13'),_0x465e('0x11')),'defaultValue':'progressive','comment':_0x465e('0x26')},'dialLimitChannel':{'type':Sequelize[_0x465e('0x14')](0x4)[_0x465e('0x27')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x465e('0x28')},'dialLimitQueue':{'type':Sequelize[_0x465e('0x14')](0x4)[_0x465e('0x27')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x465e('0x29')},'dialPowerLevel':{'type':Sequelize[_0x465e('0x2a')](0x2)[_0x465e('0x27')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize[_0x465e('0x15')]('agentBusyFactor','dropRate'),'defaultValue':_0x465e('0x2b'),'comment':_0x465e('0x2c')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x465e('0x2a')](0x2)[_0x465e('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x465e('0x2d')},'dialPredictiveInterval':{'type':Sequelize[_0x465e('0x14')](0x3)[_0x465e('0x27')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x465e('0x2e')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x465e('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0x465e('0x14')](0x3)[_0x465e('0x27')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':_0x465e('0x2f'),'comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize[_0x465e('0x14')](0x3)[_0x465e('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueProject':{'type':Sequelize['STRING'],'comment':_0x465e('0x30')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x465e('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x465e('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x465e('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x465e('0x31')},'dialBusyRetryFrequency':{'type':Sequelize[_0x465e('0x14')](0x5)[_0x465e('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x465e('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x465e('0x14')](0x5)[_0x465e('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x465e('0x32')},'dialGlobalMaxRetry':{'type':Sequelize[_0x465e('0x14')](0x3)[_0x465e('0x27')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x465e('0x1')],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize[_0x465e('0x1')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM']('always',_0x465e('0x33'),_0x465e('0x34')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x465e('0x1f')],'defaultValue':0x0,'comment':_0x465e('0x35')},'dialAMDInitialSilence':{'type':Sequelize[_0x465e('0x14')](0x9)[_0x465e('0x27')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x465e('0x36')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x465e('0x27')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x465e('0x14')](0x9)[_0x465e('0x27')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x465e('0x14')](0x9)[_0x465e('0x27')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x465e('0x37')},'dialAMDMinWordLength':{'type':Sequelize[_0x465e('0x14')](0x9)[_0x465e('0x27')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x465e('0x38')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x465e('0x14')](0x9)[_0x465e('0x27')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x465e('0x39')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x465e('0x14')](0x9)[_0x465e('0x27')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x465e('0x3a')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x465e('0x27')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x465e('0x3b')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0x465e('0x14')](0x5)[_0x465e('0x27')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x465e('0x3c')},'dialRecallInQueue':{'type':Sequelize[_0x465e('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize[_0x465e('0x15')]('DESC','ASC'),'defaultValue':_0x465e('0x3d')},'dialQueueProject2':{'type':Sequelize[_0x465e('0x1')],'comment':_0x465e('0x30')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x465e('0x1f')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x465e('0x1f')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x465e('0x27')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x465e('0x3e')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x465e('0x27')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x465e('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x465e('0x3f')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x465e('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x465e('0x40')},'dialDropMaxRetry':{'type':Sequelize[_0x465e('0x14')](0x3)[_0x465e('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x465e('0x41')},'dialDropRetryFrequency':{'type':Sequelize[_0x465e('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x465e('0x42')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x465e('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x465e('0x43')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x465e('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x465e('0x44')},'dialMachineMaxRetry':{'type':Sequelize[_0x465e('0x14')](0x3)[_0x465e('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x465e('0x45')},'dialMachineRetryFrequency':{'type':Sequelize[_0x465e('0x14')](0x5)[_0x465e('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x465e('0x46')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x465e('0x14')](0x3)[_0x465e('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x465e('0x14')](0x5)[_0x465e('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x465e('0x47')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x465e('0x14')],'allowNull':!![],'comment':_0x465e('0x48')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x526578){if(!_0x526578)this[_0x465e('0xb')](_0x465e('0x49'),null);this['setDataValue']('mandatoryDisposition',_0x526578);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x465e('0x14')](0x3)[_0x465e('0x27')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x465e('0x1f')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x465e('0x14')](0x3)[_0x465e('0x27')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x465e('0x1f')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 35a4a91..b756bed 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 _0xc61d=['QueryTypes','SELECT','TeamId','union','transaction','isEmpty','removeAgents','UserVoiceQueueRt','userVoiceQueue:remove','omit','spread','User','push','isNil','SIP/%s','all','isArray','getAgents','getMembers','getLists','addLists','format','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','ContactId','ListId','scheduledAt','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','OrderBy','h.id','ci.OrderBy+1','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','CmList','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','status','end','json','offset','count','set','Content-Range','save','update','then','destroy','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','map','value','includes','type','UserProfileResource','error','stack','name','send','index','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','pick','where','merge','VIRTUAL','VoiceQueue','includeAll','include','findAll','params','keys','options','catch','create','body','user','role','find','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','getHoppers','findOne','CmHopper','VoiceQueueId','rows','getHopperHistories','CmHopperHistory','order','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','teams','Agents','online','voicePause','interface','flatMap','forEach','sequelize','each','upsert','penalty','findOrCreate','emit','userVoiceQueue:save','removeTeams','Team','ids','select','field','tq.TeamId','from','team_has_voice_queues','join','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString'];(function(_0x5bcd36,_0x9b6233){var _0x1abc37=function(_0x5ddb7b){while(--_0x5ddb7b){_0x5bcd36['push'](_0x5bcd36['shift']());}};_0x1abc37(++_0x9b6233);}(_0xc61d,0xfb));var _0xdc61=function(_0x7bf37c,_0x579d37){_0x7bf37c=_0x7bf37c-0x0;var _0x55cf51=_0xc61d[_0x7bf37c];return _0x55cf51;};'use strict';var emlformat=require(_0xdc61('0x0'));var rimraf=require(_0xdc61('0x1'));var zipdir=require(_0xdc61('0x2'));var jsonpatch=require(_0xdc61('0x3'));var rp=require(_0xdc61('0x4'));var moment=require(_0xdc61('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xdc61('0x6'));var util=require(_0xdc61('0x7'));var path=require('path');var sox=require(_0xdc61('0x8'));var csv=require(_0xdc61('0x9'));var ejs=require(_0xdc61('0xa'));var fs=require('fs');var fs_extra=require(_0xdc61('0xb'));var _=require(_0xdc61('0xc'));var squel=require(_0xdc61('0xd'));var crypto=require(_0xdc61('0xe'));var jsforce=require(_0xdc61('0xf'));var deskjs=require(_0xdc61('0x10'));var toCsv=require(_0xdc61('0x9'));var querystring=require('querystring');var Papa=require(_0xdc61('0x11'));var Redis=require(_0xdc61('0x12'));var authService=require(_0xdc61('0x13'));var qs=require(_0xdc61('0x14'));var as=require(_0xdc61('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdc61('0x16'))('api');var utils=require(_0xdc61('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xdc61('0x18'));var db=require(_0xdc61('0x19'))['db'];config[_0xdc61('0x1a')]=_[_0xdc61('0x1b')](config[_0xdc61('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xdc61('0x1c'))(new Redis(config[_0xdc61('0x1a')]));require('./voiceQueue.socket')[_0xdc61('0x1d')](socket);function respondWithStatusCode(_0x85d82d,_0x42798c){_0x42798c=_0x42798c||0xcc;return function(_0x386b7f){if(_0x386b7f){return _0x85d82d[_0xdc61('0x1e')](_0x42798c);}return _0x85d82d[_0xdc61('0x1f')](_0x42798c)[_0xdc61('0x20')]();};}function respondWithResult(_0x191d06,_0x2805d0){_0x2805d0=_0x2805d0||0xc8;return function(_0x53c185){if(_0x53c185){return _0x191d06[_0xdc61('0x1f')](_0x2805d0)[_0xdc61('0x21')](_0x53c185);}};}function respondWithFilteredResult(_0x1de932,_0x2cd1a4){return function(_0x45b7b7){if(_0x45b7b7){var _0x393205=typeof _0x2cd1a4[_0xdc61('0x22')]==='undefined'&&typeof _0x2cd1a4['limit']==='undefined';var _0x17120b=_0x45b7b7['count'];var _0x319d93=_0x393205?0x0:_0x2cd1a4[_0xdc61('0x22')];var _0xf9aa4e=_0x393205?_0x45b7b7[_0xdc61('0x23')]:_0x2cd1a4[_0xdc61('0x22')]+_0x2cd1a4['limit'];var _0x2c687d;if(_0xf9aa4e>=_0x17120b){_0xf9aa4e=_0x17120b;_0x2c687d=0xc8;}else{_0x2c687d=0xce;}_0x1de932[_0xdc61('0x1f')](_0x2c687d);return _0x1de932[_0xdc61('0x24')](_0xdc61('0x25'),_0x319d93+'-'+_0xf9aa4e+'/'+_0x17120b)[_0xdc61('0x21')](_0x45b7b7);}return null;};}function patchUpdates(_0x5a733a){return function(_0x447a46){try{jsonpatch['apply'](_0x447a46,_0x5a733a,!![]);}catch(_0x53cad0){return BPromise['reject'](_0x53cad0);}return _0x447a46[_0xdc61('0x26')]();};}function saveUpdates(_0x2571bc,_0x495dae){return function(_0x230d58){if(_0x230d58){return _0x230d58[_0xdc61('0x27')](_0x2571bc)[_0xdc61('0x28')](function(_0x40cf53){return _0x40cf53;});}return null;};}function removeEntity(_0x290790,_0x2e15f6){return function(_0xda80ca){if(_0xda80ca){return _0xda80ca[_0xdc61('0x29')]()['then'](function(){var _0x434095=_0xda80ca[_0xdc61('0x2a')]({'plain':!![]});var _0x3988ec=[{'name':_0xdc61('0x2b'),'value':_0xdc61('0x2c'),'ignore':![]},{'name':_0xdc61('0x2d'),'value':_0xdc61('0x2e'),'ignore':![]}];var _0x5bb7e5=_(_0x3988ec)[_0xdc61('0x2f')](_0xdc61('0x30'))[_0xdc61('0x31')](_0xdc61('0x32'))['value']();if(_[_0xdc61('0x33')](_0x5bb7e5,_0x434095[_0xdc61('0x34')])){return;}var _0x3a2208=_['find'](_0x3988ec,[_0xdc61('0x32'),_0x434095[_0xdc61('0x34')]])['name'];return db[_0xdc61('0x35')][_0xdc61('0x29')]({'where':{'type':_0x3a2208,'resourceId':_0x434095['id']}})[_0xdc61('0x28')](function(){return _0xda80ca;});})[_0xdc61('0x28')](function(){_0x290790[_0xdc61('0x1f')](0xcc)[_0xdc61('0x20')]();});}};}function handleEntityNotFound(_0x44713a,_0x5a5e6b){return function(_0x1df3cb){if(!_0x1df3cb){_0x44713a['sendStatus'](0x194);}return _0x1df3cb;};}function handleError(_0x3128b3,_0x3038d1){_0x3038d1=_0x3038d1||0x1f4;return function(_0x45f3e4){logger[_0xdc61('0x36')](_0x45f3e4[_0xdc61('0x37')]);if(_0x45f3e4[_0xdc61('0x38')]){delete _0x45f3e4[_0xdc61('0x38')];}_0x3128b3['status'](_0x3038d1)[_0xdc61('0x39')](_0x45f3e4);};}exports[_0xdc61('0x3a')]=function(_0x2b3dd7,_0x3b560e){var _0x35fe57={},_0x5ccbed={},_0x15a6d1={'count':0x0,'rows':[]};var _0x93aaa0=_[_0xdc61('0x31')](db['VoiceQueue'][_0xdc61('0x3b')],function(_0x45add7){return{'name':_0x45add7[_0xdc61('0x3c')],'type':_0x45add7[_0xdc61('0x34')][_0xdc61('0x3d')]};});_0x5ccbed[_0xdc61('0x3e')]=_[_0xdc61('0x31')](_0x93aaa0,_0xdc61('0x38'));_0x5ccbed[_0xdc61('0x3f')]=_['keys'](_0x2b3dd7[_0xdc61('0x3f')]);_0x5ccbed[_0xdc61('0x40')]=_[_0xdc61('0x41')](_0x5ccbed['model'],_0x5ccbed[_0xdc61('0x3f')]);_0x35fe57[_0xdc61('0x42')]=_[_0xdc61('0x41')](_0x5ccbed['model'],qs['fields'](_0x2b3dd7[_0xdc61('0x3f')][_0xdc61('0x43')]));_0x35fe57['attributes']=_0x35fe57['attributes'][_0xdc61('0x44')]?_0x35fe57[_0xdc61('0x42')]:_0x5ccbed[_0xdc61('0x3e')];if(!_0x2b3dd7['query'][_0xdc61('0x45')](_0xdc61('0x46'))){_0x35fe57[_0xdc61('0x47')]=qs[_0xdc61('0x47')](_0x2b3dd7['query'][_0xdc61('0x47')]);_0x35fe57[_0xdc61('0x22')]=qs[_0xdc61('0x22')](_0x2b3dd7[_0xdc61('0x3f')][_0xdc61('0x22')]);}_0x35fe57['order']=qs[_0xdc61('0x48')](_0x2b3dd7[_0xdc61('0x3f')][_0xdc61('0x48')]);_0x35fe57['where']=qs['filters'](_[_0xdc61('0x49')](_0x2b3dd7[_0xdc61('0x3f')],_0x5ccbed[_0xdc61('0x40')]),_0x93aaa0);if(_0x2b3dd7[_0xdc61('0x3f')][_0xdc61('0x2f')]){_0x35fe57[_0xdc61('0x4a')]=_[_0xdc61('0x4b')](_0x35fe57[_0xdc61('0x4a')],{'$or':_['map'](_0x93aaa0,function(_0x45bbfb){if(_0x45bbfb[_0xdc61('0x34')]!==_0xdc61('0x4c')){var _0x18d60b={};_0x18d60b[_0x45bbfb['name']]={'$like':'%'+_0x2b3dd7[_0xdc61('0x3f')][_0xdc61('0x2f')]+'%'};return _0x18d60b;}})});}_0x35fe57=_[_0xdc61('0x4b')]({},_0x35fe57,_0x2b3dd7['options']);var _0x1ca686={'where':_0x35fe57[_0xdc61('0x4a')]};return db[_0xdc61('0x4d')][_0xdc61('0x23')](_0x1ca686)[_0xdc61('0x28')](function(_0x2457e9){_0x15a6d1['count']=_0x2457e9;if(_0x2b3dd7[_0xdc61('0x3f')][_0xdc61('0x4e')]){_0x35fe57[_0xdc61('0x4f')]=[{'all':!![]}];}return db[_0xdc61('0x4d')][_0xdc61('0x50')](_0x35fe57);})['then'](function(_0x57b9e1){_0x15a6d1['rows']=_0x57b9e1;return _0x15a6d1;})[_0xdc61('0x28')](respondWithFilteredResult(_0x3b560e,_0x35fe57))['catch'](handleError(_0x3b560e,null));};exports['show']=function(_0x5b5ab2,_0x585d29){var _0x20e806={'raw':![],'where':{'id':_0x5b5ab2[_0xdc61('0x51')]['id']}},_0x2a74c0={};_0x2a74c0[_0xdc61('0x3e')]=_[_0xdc61('0x52')](db[_0xdc61('0x4d')][_0xdc61('0x3b')]);_0x2a74c0['query']=_[_0xdc61('0x52')](_0x5b5ab2[_0xdc61('0x3f')]);_0x2a74c0[_0xdc61('0x40')]=_[_0xdc61('0x41')](_0x2a74c0[_0xdc61('0x3e')],_0x2a74c0[_0xdc61('0x3f')]);_0x20e806[_0xdc61('0x42')]=_[_0xdc61('0x41')](_0x2a74c0['model'],qs['fields'](_0x5b5ab2[_0xdc61('0x3f')][_0xdc61('0x43')]));_0x20e806[_0xdc61('0x42')]=_0x20e806['attributes'][_0xdc61('0x44')]?_0x20e806[_0xdc61('0x42')]:_0x2a74c0[_0xdc61('0x3e')];if(_0x5b5ab2['query']['includeAll']){_0x20e806[_0xdc61('0x4f')]=[{'all':!![]}];}_0x20e806=_['merge']({},_0x20e806,_0x5b5ab2[_0xdc61('0x53')]);return db['VoiceQueue']['find'](_0x20e806)[_0xdc61('0x28')](handleEntityNotFound(_0x585d29,null))[_0xdc61('0x28')](respondWithResult(_0x585d29,null))[_0xdc61('0x54')](handleError(_0x585d29,null));};exports[_0xdc61('0x55')]=function(_0x176f46,_0x4fed65){return db[_0xdc61('0x4d')][_0xdc61('0x55')](_0x176f46[_0xdc61('0x56')],{})['then'](function(_0x141f7c){var _0x3e2f3c=_0x176f46[_0xdc61('0x57')]['get']({'plain':!![]});if(!_0x3e2f3c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3e2f3c[_0xdc61('0x58')]===_0xdc61('0x57')){var _0x55ab58=_0x141f7c[_0xdc61('0x2a')]({'plain':!![]});var _0x4e1d1d=[{'name':_0xdc61('0x2b'),'value':_0xdc61('0x2c')},{'name':_0xdc61('0x2d'),'value':_0xdc61('0x2e')}];var _0x4952b2=_[_0xdc61('0x59')](_0x4e1d1d,[_0xdc61('0x32'),_0x55ab58[_0xdc61('0x34')]])['name'];return db[_0xdc61('0x5a')][_0xdc61('0x59')]({'where':{'name':_0x4952b2,'userProfileId':_0x3e2f3c[_0xdc61('0x5b')]},'raw':!![]})[_0xdc61('0x28')](function(_0x6138c5){if(_0x6138c5&&_0x6138c5[_0xdc61('0x5c')]===0x0){return db['UserProfileResource'][_0xdc61('0x55')]({'name':_0x55ab58['name'],'resourceId':_0x55ab58['id'],'type':_0x6138c5[_0xdc61('0x38')],'sectionId':_0x6138c5['id']},{})[_0xdc61('0x28')](function(){return _0x141f7c;});}else{return _0x141f7c;}})[_0xdc61('0x54')](function(_0x4977ff){logger[_0xdc61('0x36')](_0xdc61('0x5d'),_0x4977ff);throw _0x4977ff;});}return _0x141f7c;})[_0xdc61('0x28')](respondWithResult(_0x4fed65,0xc9))['catch'](handleError(_0x4fed65,null));};exports[_0xdc61('0x5e')]=function(_0x143078,_0x1b5893){var _0x49b483={'where':{'id':_0x143078[_0xdc61('0x51')]['id']}},_0x3f98a2={};_0x3f98a2['model']=_[_0xdc61('0x52')](db['VoiceQueue'][_0xdc61('0x3b')]);_0x49b483['attributes']=_[_0xdc61('0x41')](_0x3f98a2[_0xdc61('0x3e')],qs[_0xdc61('0x43')](_0x143078[_0xdc61('0x3f')][_0xdc61('0x43')]));_0x49b483[_0xdc61('0x42')]=_0x49b483['attributes'][_0xdc61('0x44')]?_0x49b483[_0xdc61('0x42')]:_0x3f98a2[_0xdc61('0x3e')];if(_0x143078[_0xdc61('0x3f')]['includeAll']){_0x49b483[_0xdc61('0x4f')]=[{'all':!![]}];}_0x49b483=_[_0xdc61('0x4b')]({},_0x49b483,_0x143078[_0xdc61('0x53')]);return db[_0xdc61('0x4d')][_0xdc61('0x59')](_0x49b483)['then'](handleEntityNotFound(_0x1b5893,null))['then'](function(_0x16bc9f){if(_0x16bc9f){var _0x29aad4=_0x16bc9f[_0xdc61('0x2a')]({'plain':!![]});_0x29aad4=qs['omit'](_0x29aad4,['id',_0xdc61('0x5f'),'updatedAt']);_0x143078[_0xdc61('0x56')]=_['omit'](_0x143078[_0xdc61('0x56')],['id',_0xdc61('0x5f'),_0xdc61('0x60')]);return db[_0xdc61('0x4d')][_0xdc61('0x55')](_[_0xdc61('0x4b')](_0x29aad4,_0x143078[_0xdc61('0x56')]),{'include':_0x143078[_0xdc61('0x3f')][_0xdc61('0x4e')]?[{'all':!![]}]:undefined})[_0xdc61('0x28')](function(_0x38ce99){var _0x561d90=_0x143078[_0xdc61('0x57')]['get']({'plain':!![]});if(!_0x561d90)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x561d90[_0xdc61('0x58')]==='user'){var _0x20c571=_0x38ce99[_0xdc61('0x2a')]({'plain':!![]});var _0x3451e9=[{'name':'VoiceQueues','value':_0xdc61('0x2c')},{'name':_0xdc61('0x2d'),'value':_0xdc61('0x2e')}];var _0xd47102=_[_0xdc61('0x59')](_0x3451e9,['value',_0x20c571[_0xdc61('0x34')]])['name'];return db[_0xdc61('0x5a')]['find']({'where':{'name':_0xd47102,'userProfileId':_0x561d90[_0xdc61('0x5b')]},'raw':!![]})['then'](function(_0x270b4d){if(_0x270b4d&&_0x270b4d[_0xdc61('0x5c')]===0x0){return db[_0xdc61('0x35')]['create']({'name':_0x20c571[_0xdc61('0x38')],'resourceId':_0x20c571['id'],'type':_0x270b4d[_0xdc61('0x38')],'sectionId':_0x270b4d['id']},{})['then'](function(){return _0x38ce99;});}else{return _0x38ce99;}})['catch'](function(_0x5dcce9){logger['error'](_0xdc61('0x5d'),_0x5dcce9);throw _0x5dcce9;});}return _0x38ce99;});}})['then'](respondWithResult(_0x1b5893,0xc9))[_0xdc61('0x54')](handleError(_0x1b5893,null));};exports[_0xdc61('0x27')]=function(_0x14e2c3,_0x196ef4){if(_0x14e2c3[_0xdc61('0x56')]['id']){delete _0x14e2c3[_0xdc61('0x56')]['id'];}return db[_0xdc61('0x4d')][_0xdc61('0x59')]({'where':{'id':_0x14e2c3[_0xdc61('0x51')]['id']}})[_0xdc61('0x28')](handleEntityNotFound(_0x196ef4,null))['then'](saveUpdates(_0x14e2c3[_0xdc61('0x56')],null))[_0xdc61('0x28')](respondWithResult(_0x196ef4,null))[_0xdc61('0x54')](handleError(_0x196ef4,null));};exports[_0xdc61('0x29')]=function(_0x164129,_0x4899be){return db[_0xdc61('0x4d')]['find']({'where':{'id':_0x164129[_0xdc61('0x51')]['id']}})['then'](handleEntityNotFound(_0x4899be,null))[_0xdc61('0x28')](removeEntity(_0x4899be,null))['catch'](handleError(_0x4899be,null));};exports[_0xdc61('0x61')]=function(_0x5f7eca,_0x2605ff,_0x455feb){var _0x342ad8={'raw':![],'where':{}};var _0x4d5f88={};var _0x499f23={'count':0x0,'rows':[]};return db[_0xdc61('0x4d')][_0xdc61('0x62')]({'where':{'id':_0x5f7eca[_0xdc61('0x51')]['id']}})['then'](handleEntityNotFound(_0x2605ff,null))[_0xdc61('0x28')](function(_0x46078a){if(_0x46078a){_0x4d5f88['model']=_[_0xdc61('0x52')](db[_0xdc61('0x63')][_0xdc61('0x3b')]);_0x4d5f88['query']=_[_0xdc61('0x52')](_0x5f7eca[_0xdc61('0x3f')]);_0x4d5f88['filters']=_[_0xdc61('0x41')](_0x4d5f88[_0xdc61('0x3e')],_0x4d5f88[_0xdc61('0x3f')]);_0x342ad8[_0xdc61('0x42')]=_[_0xdc61('0x41')](_0x4d5f88[_0xdc61('0x3e')],qs['fields'](_0x5f7eca[_0xdc61('0x3f')][_0xdc61('0x43')]));_0x342ad8['attributes']=_0x342ad8[_0xdc61('0x42')][_0xdc61('0x44')]?_0x342ad8['attributes']:_0x4d5f88['model'];if(!_0x5f7eca[_0xdc61('0x3f')][_0xdc61('0x45')](_0xdc61('0x46'))){_0x342ad8[_0xdc61('0x47')]=qs[_0xdc61('0x47')](_0x5f7eca['query'][_0xdc61('0x47')]);_0x342ad8['offset']=qs[_0xdc61('0x22')](_0x5f7eca['query']['offset']);}_0x342ad8['order']=qs['sort'](_0x5f7eca['query'][_0xdc61('0x48')]);_0x342ad8[_0xdc61('0x4a')]=qs[_0xdc61('0x40')](_[_0xdc61('0x49')](_0x5f7eca[_0xdc61('0x3f')],_0x4d5f88[_0xdc61('0x40')]));_0x342ad8[_0xdc61('0x4a')][_0xdc61('0x64')]=_0x46078a['id'];if(_0x5f7eca[_0xdc61('0x3f')]['filter']){_0x342ad8[_0xdc61('0x4a')]=_[_0xdc61('0x4b')](_0x342ad8['where'],{'$or':_[_0xdc61('0x31')](_0x342ad8[_0xdc61('0x42')],function(_0x336cc2){var _0x48aebd={};_0x48aebd[_0x336cc2]={'$like':'%'+_0x5f7eca[_0xdc61('0x3f')][_0xdc61('0x2f')]+'%'};return _0x48aebd;})});}_0x342ad8=_[_0xdc61('0x4b')]({},_0x342ad8,_0x5f7eca[_0xdc61('0x53')]);return db[_0xdc61('0x63')][_0xdc61('0x23')]({'where':_0x342ad8[_0xdc61('0x4a')]})[_0xdc61('0x28')](function(_0x22eaeb){_0x499f23['count']=_0x22eaeb;if(_0x5f7eca[_0xdc61('0x3f')][_0xdc61('0x4e')]){_0x342ad8[_0xdc61('0x4f')]=[{'all':!![]}];}return db[_0xdc61('0x63')][_0xdc61('0x50')](_0x342ad8);})['then'](function(_0x2ceeb6){_0x499f23[_0xdc61('0x65')]=_0x2ceeb6;return _0x499f23;});}})[_0xdc61('0x28')](respondWithFilteredResult(_0x2605ff,_0x342ad8))[_0xdc61('0x54')](handleError(_0x2605ff,null));};exports[_0xdc61('0x66')]=function(_0x5b7e78,_0x16562b,_0x4cbdaf){var _0x15c1bc={'raw':!![],'where':{}};var _0x3f950f={};var _0x5d6c66={'count':0x0,'rows':[]};return db[_0xdc61('0x4d')]['findOne']({'where':{'id':_0x5b7e78['params']['id']}})[_0xdc61('0x28')](handleEntityNotFound(_0x16562b,null))[_0xdc61('0x28')](function(_0x1b6234){if(_0x1b6234){_0x3f950f[_0xdc61('0x3e')]=_[_0xdc61('0x52')](db[_0xdc61('0x67')][_0xdc61('0x3b')]);_0x3f950f[_0xdc61('0x3f')]=_['keys'](_0x5b7e78[_0xdc61('0x3f')]);_0x3f950f['filters']=_[_0xdc61('0x41')](_0x3f950f[_0xdc61('0x3e')],_0x3f950f[_0xdc61('0x3f')]);_0x15c1bc[_0xdc61('0x42')]=_[_0xdc61('0x41')](_0x3f950f[_0xdc61('0x3e')],qs['fields'](_0x5b7e78['query'][_0xdc61('0x43')]));_0x15c1bc['attributes']=_0x15c1bc[_0xdc61('0x42')][_0xdc61('0x44')]?_0x15c1bc[_0xdc61('0x42')]:_0x3f950f[_0xdc61('0x3e')];if(!_0x5b7e78['query'][_0xdc61('0x45')](_0xdc61('0x46'))){_0x15c1bc[_0xdc61('0x47')]=qs[_0xdc61('0x47')](_0x5b7e78[_0xdc61('0x3f')]['limit']);_0x15c1bc[_0xdc61('0x22')]=qs[_0xdc61('0x22')](_0x5b7e78[_0xdc61('0x3f')]['offset']);}_0x15c1bc[_0xdc61('0x68')]=qs[_0xdc61('0x48')](_0x5b7e78[_0xdc61('0x3f')]['sort']);_0x15c1bc['where']=qs[_0xdc61('0x40')](_[_0xdc61('0x49')](_0x5b7e78[_0xdc61('0x3f')],_0x3f950f[_0xdc61('0x40')]));_0x15c1bc[_0xdc61('0x4a')][_0xdc61('0x64')]=_0x1b6234['id'];if(_0x5b7e78['query'][_0xdc61('0x2f')]){_0x15c1bc[_0xdc61('0x4a')]=_[_0xdc61('0x4b')](_0x15c1bc['where'],{'$or':_[_0xdc61('0x31')](_0x15c1bc[_0xdc61('0x42')],function(_0x196e45){var _0xc2d92e={};_0xc2d92e[_0x196e45]={'$like':'%'+_0x5b7e78['query'][_0xdc61('0x2f')]+'%'};return _0xc2d92e;})});}_0x15c1bc=_['merge']({},_0x15c1bc,_0x5b7e78['options']);return db[_0xdc61('0x67')][_0xdc61('0x23')]({'where':_0x15c1bc[_0xdc61('0x4a')]})[_0xdc61('0x28')](function(_0x370291){_0x5d6c66[_0xdc61('0x23')]=_0x370291;if(_0x5b7e78[_0xdc61('0x3f')][_0xdc61('0x4e')]){_0x15c1bc[_0xdc61('0x4f')]=[{'all':!![]}];}return db[_0xdc61('0x67')][_0xdc61('0x50')](_0x15c1bc);})[_0xdc61('0x28')](function(_0x59bbd7){_0x5d6c66[_0xdc61('0x65')]=_0x59bbd7;return _0x5d6c66;});}})[_0xdc61('0x28')](respondWithFilteredResult(_0x16562b,_0x15c1bc))[_0xdc61('0x54')](handleError(_0x16562b,null));};exports[_0xdc61('0x69')]=function(_0x5cd074,_0x1105d7,_0x3b4085){var _0x991093={'raw':!![],'where':{}};var _0x253540={};var _0x20d4a5={'count':0x0,'rows':[]};return db[_0xdc61('0x4d')][_0xdc61('0x62')]({'where':{'id':_0x5cd074[_0xdc61('0x51')]['id']}})['then'](handleEntityNotFound(_0x1105d7,null))[_0xdc61('0x28')](function(_0x3913ec){if(_0x3913ec){_0x253540[_0xdc61('0x3e')]=_['keys'](db[_0xdc61('0x6a')][_0xdc61('0x3b')]);_0x253540['query']=_[_0xdc61('0x52')](_0x5cd074[_0xdc61('0x3f')]);_0x253540[_0xdc61('0x40')]=_['intersection'](_0x253540[_0xdc61('0x3e')],_0x253540['query']);_0x991093[_0xdc61('0x42')]=_[_0xdc61('0x41')](_0x253540[_0xdc61('0x3e')],qs['fields'](_0x5cd074['query'][_0xdc61('0x43')]));_0x991093[_0xdc61('0x42')]=_0x991093[_0xdc61('0x42')]['length']?_0x991093[_0xdc61('0x42')]:_0x253540[_0xdc61('0x3e')];if(!_0x5cd074[_0xdc61('0x3f')][_0xdc61('0x45')]('nolimit')){_0x991093['limit']=qs['limit'](_0x5cd074['query']['limit']);_0x991093['offset']=qs[_0xdc61('0x22')](_0x5cd074['query']['offset']);}_0x991093[_0xdc61('0x68')]=qs[_0xdc61('0x48')](_0x5cd074[_0xdc61('0x3f')][_0xdc61('0x48')]);_0x991093[_0xdc61('0x4a')]=qs['filters'](_[_0xdc61('0x49')](_0x5cd074[_0xdc61('0x3f')],_0x253540[_0xdc61('0x40')]));_0x991093[_0xdc61('0x4a')][_0xdc61('0x64')]=_0x3913ec['id'];if(_0x5cd074['query'][_0xdc61('0x2f')]){_0x991093['where']=_[_0xdc61('0x4b')](_0x991093[_0xdc61('0x4a')],{'$or':_['map'](_0x991093['attributes'],function(_0x1d1fae){var _0x4ca62f={};_0x4ca62f[_0x1d1fae]={'$like':'%'+_0x5cd074[_0xdc61('0x3f')][_0xdc61('0x2f')]+'%'};return _0x4ca62f;})});}_0x991093=_['merge']({},_0x991093,_0x5cd074[_0xdc61('0x53')]);return db[_0xdc61('0x6a')][_0xdc61('0x23')]({'where':_0x991093['where']})[_0xdc61('0x28')](function(_0x3d22a3){_0x20d4a5['count']=_0x3d22a3;if(_0x5cd074['query']['includeAll']){_0x991093[_0xdc61('0x4f')]=[{'all':!![]}];}return db['CmHopperFinal'][_0xdc61('0x50')](_0x991093);})[_0xdc61('0x28')](function(_0x2fddc7){_0x20d4a5[_0xdc61('0x65')]=_0x2fddc7;return _0x20d4a5;});}})[_0xdc61('0x28')](respondWithFilteredResult(_0x1105d7,_0x991093))[_0xdc61('0x54')](handleError(_0x1105d7,null));};exports[_0xdc61('0x6b')]=function(_0x238a76,_0x114c41,_0x7f9e80){var _0x2fba81={'raw':!![],'where':{}};var _0x54b421={};var _0x1f7759={'count':0x0,'rows':[]};return db[_0xdc61('0x4d')][_0xdc61('0x62')]({'where':{'id':_0x238a76[_0xdc61('0x51')]['id']}})['then'](handleEntityNotFound(_0x114c41,null))['then'](function(_0x547fae){if(_0x547fae){_0x54b421['model']=_[_0xdc61('0x52')](db[_0xdc61('0x6c')][_0xdc61('0x3b')]);_0x54b421[_0xdc61('0x3f')]=_[_0xdc61('0x52')](_0x238a76[_0xdc61('0x3f')]);_0x54b421['filters']=_[_0xdc61('0x41')](_0x54b421[_0xdc61('0x3e')],_0x54b421[_0xdc61('0x3f')]);_0x2fba81[_0xdc61('0x42')]=_[_0xdc61('0x41')](_0x54b421[_0xdc61('0x3e')],qs[_0xdc61('0x43')](_0x238a76[_0xdc61('0x3f')][_0xdc61('0x43')]));_0x2fba81[_0xdc61('0x42')]=_0x2fba81[_0xdc61('0x42')][_0xdc61('0x44')]?_0x2fba81[_0xdc61('0x42')]:_0x54b421[_0xdc61('0x3e')];if(!_0x238a76[_0xdc61('0x3f')][_0xdc61('0x45')](_0xdc61('0x46'))){_0x2fba81[_0xdc61('0x47')]=qs[_0xdc61('0x47')](_0x238a76[_0xdc61('0x3f')][_0xdc61('0x47')]);_0x2fba81[_0xdc61('0x22')]=qs[_0xdc61('0x22')](_0x238a76[_0xdc61('0x3f')][_0xdc61('0x22')]);}_0x2fba81[_0xdc61('0x68')]=qs[_0xdc61('0x48')](_0x238a76['query'][_0xdc61('0x48')]);_0x2fba81[_0xdc61('0x4a')]=qs[_0xdc61('0x40')](_[_0xdc61('0x49')](_0x238a76[_0xdc61('0x3f')],_0x54b421[_0xdc61('0x40')]));_0x2fba81['where'][_0xdc61('0x64')]=_0x547fae['id'];if(_0x238a76[_0xdc61('0x3f')][_0xdc61('0x2f')]){_0x2fba81[_0xdc61('0x4a')]=_[_0xdc61('0x4b')](_0x2fba81['where'],{'$or':_['map'](_0x2fba81[_0xdc61('0x42')],function(_0x598d19){var _0x37114a={};_0x37114a[_0x598d19]={'$like':'%'+_0x238a76[_0xdc61('0x3f')][_0xdc61('0x2f')]+'%'};return _0x37114a;})});}_0x2fba81=_['merge']({},_0x2fba81,_0x238a76[_0xdc61('0x53')]);return db[_0xdc61('0x6c')][_0xdc61('0x23')]({'where':_0x2fba81[_0xdc61('0x4a')]})[_0xdc61('0x28')](function(_0x21dcf6){_0x1f7759['count']=_0x21dcf6;if(_0x238a76[_0xdc61('0x3f')]['includeAll']){_0x2fba81['include']=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x2fba81);})[_0xdc61('0x28')](function(_0x2b6e50){_0x1f7759[_0xdc61('0x65')]=_0x2b6e50;return _0x1f7759;});}})[_0xdc61('0x28')](respondWithFilteredResult(_0x114c41,_0x2fba81))[_0xdc61('0x54')](handleError(_0x114c41,null));};exports['getTeams']=function(_0xa8d145,_0x53b33d,_0x53ebb2){var _0x5df427={};var _0x135182={};var _0x16aebc;var _0x27288f;return db[_0xdc61('0x4d')]['findOne']({'where':{'id':_0xa8d145[_0xdc61('0x51')]['id']}})[_0xdc61('0x28')](handleEntityNotFound(_0x53b33d,null))[_0xdc61('0x28')](function(_0x1b7942){if(_0x1b7942){_0x16aebc=_0x1b7942;_0x135182[_0xdc61('0x3e')]=_[_0xdc61('0x52')](db['Team']['rawAttributes']);_0x135182[_0xdc61('0x3f')]=_[_0xdc61('0x52')](_0xa8d145[_0xdc61('0x3f')]);_0x135182[_0xdc61('0x40')]=_[_0xdc61('0x41')](_0x135182[_0xdc61('0x3e')],_0x135182[_0xdc61('0x3f')]);_0x5df427[_0xdc61('0x42')]=_[_0xdc61('0x41')](_0x135182[_0xdc61('0x3e')],qs[_0xdc61('0x43')](_0xa8d145[_0xdc61('0x3f')][_0xdc61('0x43')]));_0x5df427['attributes']=_0x5df427[_0xdc61('0x42')][_0xdc61('0x44')]?_0x5df427[_0xdc61('0x42')]:_0x135182[_0xdc61('0x3e')];_0x5df427[_0xdc61('0x68')]=qs[_0xdc61('0x48')](_0xa8d145['query'][_0xdc61('0x48')]);_0x5df427[_0xdc61('0x4a')]=qs['filters'](_[_0xdc61('0x49')](_0xa8d145[_0xdc61('0x3f')],_0x135182[_0xdc61('0x40')]));if(_0xa8d145[_0xdc61('0x3f')][_0xdc61('0x2f')]){_0x5df427[_0xdc61('0x4a')]=_['merge'](_0x5df427[_0xdc61('0x4a')],{'$or':_[_0xdc61('0x31')](_0x5df427[_0xdc61('0x42')],function(_0x459838){var _0x1beca8={};_0x1beca8[_0x459838]={'$like':'%'+_0xa8d145['query'][_0xdc61('0x2f')]+'%'};return _0x1beca8;})});}_0x5df427=_[_0xdc61('0x4b')]({},_0x5df427,_0xa8d145['options']);return _0x16aebc[_0xdc61('0x6d')](_0x5df427);}})['then'](function(_0x5ada8a){if(_0x5ada8a){_0x27288f=_0x5ada8a[_0xdc61('0x44')];if(!_0xa8d145[_0xdc61('0x3f')][_0xdc61('0x45')](_0xdc61('0x46'))){_0x5df427['limit']=qs[_0xdc61('0x47')](_0xa8d145[_0xdc61('0x3f')][_0xdc61('0x47')]);_0x5df427[_0xdc61('0x22')]=qs[_0xdc61('0x22')](_0xa8d145[_0xdc61('0x3f')]['offset']);}return _0x16aebc[_0xdc61('0x6d')](_0x5df427);}})['then'](function(_0x497063){if(_0x497063){return _0x497063?{'count':_0x27288f,'rows':_0x497063}:null;}})['then'](respondWithResult(_0x53b33d,null))[_0xdc61('0x54')](handleError(_0x53b33d,null));};exports['addTeams']=function(_0xdbf41a,_0x1f524f,_0xb0db68){var _0x2e3e8f=_0xdbf41a[_0xdc61('0x56')][_0xdc61('0x6e')];var _0x116a92=_[_0xdc61('0x31')](_0x2e3e8f,'id');return db['Team'][_0xdc61('0x50')]({'where':{'id':_0x116a92},'attributes':['id'],'include':[{'model':db['User'],'as':_0xdc61('0x6f'),'attributes':['id',_0xdc61('0x38'),_0xdc61('0x70'),_0xdc61('0x71'),_0xdc61('0x72')],'raw':!![]}]})[_0xdc61('0x28')](function(_0xeac423){if(_0xeac423){var _0x177a81=_[_0xdc61('0x73')](_0xeac423,function(_0x2b5839){var _0x4df59c=_0x2b5839[_0xdc61('0x2a')]({'plain':!![]});_0x4df59c[_0xdc61('0x6f')][_0xdc61('0x74')](function(_0x166816){_0x166816['penalty']=_[_0xdc61('0x59')](_0x2e3e8f,{'id':_0x4df59c['id']})['penalty'];});return _0x4df59c[_0xdc61('0x6f')];});return db[_0xdc61('0x4d')]['find']({'where':{'id':_0xdbf41a[_0xdc61('0x51')]['id']}})[_0xdc61('0x28')](function(_0x20c77c){return db[_0xdc61('0x75')]['transaction'](function(_0x1a0394){return _0x20c77c['addTeams'](_0x116a92,{'transaction':_0x1a0394})['then'](function(){return BPromise[_0xdc61('0x76')](_0x2e3e8f,function(_0x53201d){return db['TeamVoiceQueue'][_0xdc61('0x77')]({'TeamId':_0x53201d['id'],'VoiceQueueId':_0xdbf41a[_0xdc61('0x51')]['id'],'penalty':_0x53201d[_0xdc61('0x78')]},{'transaction':_0x1a0394});});})['then'](function(){return BPromise[_0xdc61('0x76')](_0x177a81,function(_0xd78053){return db['UserVoiceQueue'][_0xdc61('0x79')]({'where':{'UserId':_0xd78053['id'],'VoiceQueueId':_0xdbf41a['params']['id']},'defaults':{'penalty':_0xd78053[_0xdc61('0x78')]},'transaction':_0x1a0394});});})[_0xdc61('0x28')](function(){return BPromise[_0xdc61('0x76')](_[_0xdc61('0x2f')](_0x177a81,{'online':!![]}),function(_0x235b25){return db['UserVoiceQueueRt'][_0xdc61('0x77')]({'membername':_0x235b25[_0xdc61('0x38')],'UserId':_0x235b25['id'],'queue_name':_0x20c77c[_0xdc61('0x38')],'VoiceQueueId':_0x20c77c['id'],'interface':_['isNil'](_0x235b25[_0xdc61('0x72')])?util['format']('SIP/%s',_0x235b25[_0xdc61('0x38')]):_0x235b25['interface'],'paused':_0x235b25['voicePause']||![],'penalty':_0x235b25[_0xdc61('0x78')]},{'transaction':_0x1a0394});});})[_0xdc61('0x28')](function(){_0x177a81[_0xdc61('0x74')](function(_0x2a2fd9){socket[_0xdc61('0x7a')](_0xdc61('0x7b'),{'UserId':_0x2a2fd9['id'],'VoiceQueueId':_0x20c77c['id']});});});});});}})['then'](respondWithStatusCode(_0x1f524f,null))['catch'](handleError(_0x1f524f,null));};exports[_0xdc61('0x7c')]=function(_0x8d77d3,_0x1f234c,_0x289193){return db[_0xdc61('0x7d')][_0xdc61('0x50')]({'where':{'id':_0x8d77d3[_0xdc61('0x3f')][_0xdc61('0x7e')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xdc61('0x6f'),'attributes':['id'],'raw':!![]}]})[_0xdc61('0x28')](handleEntityNotFound(_0x1f234c,null))[_0xdc61('0x28')](function(_0x28d413){var _0x1a804b=_['map'](_0x28d413,'id');var _0x38de25=[];var _0x1cea5a=[];var _0x31d96a=squel[_0xdc61('0x7f')]();_0x31d96a[_0xdc61('0x80')](_0xdc61('0x81'))[_0xdc61('0x82')](_0xdc61('0x83'),'tq')[_0xdc61('0x84')]('user_has_teams','ut',_0xdc61('0x85'))[_0xdc61('0x4a')](_0xdc61('0x86'),_0x8d77d3['params']['id']);for(var _0x33f0bb=0x0;_0x33f0bb<_0x28d413[_0xdc61('0x44')];_0x33f0bb+=0x1){let _0x44593d=_0x28d413[_0x33f0bb];for(var _0x432564=0x0;_0x432564<_0x44593d[_0xdc61('0x6f')][_0xdc61('0x44')];_0x432564+=0x1){let _0x389e8a=_0x44593d[_0xdc61('0x6f')][_0x432564];var _0x2e6670=_0x31d96a[_0xdc61('0x5e')]();_0x2e6670[_0xdc61('0x4a')](_0xdc61('0x87'),_0x389e8a['id']);_0x1cea5a['push'](db[_0xdc61('0x75')][_0xdc61('0x3f')](_0x2e6670[_0xdc61('0x88')](),{'type':db[_0xdc61('0x75')][_0xdc61('0x89')][_0xdc61('0x8a')]})[_0xdc61('0x28')](function(_0x57e791){if(_0x57e791['length']===0x1){return _0x389e8a['id'];}else{var _0x9bb010=_['every'](_['map'](_0x57e791,_0xdc61('0x8b')),function(_0x5a47bf){return _['includes'](_0x1a804b,_0x5a47bf);});if(_0x9bb010){return _0x389e8a['id'];}}}));}}return BPromise['all'](_0x1cea5a)['then'](function(_0x23b5ba){_0x38de25=_(_0x38de25)[_0xdc61('0x8c')](_0x23b5ba)['compact']()[_0xdc61('0x32')]();return db[_0xdc61('0x4d')]['find']({'where':{'id':_0x8d77d3['params']['id']}})[_0xdc61('0x28')](function(_0x5220b1){return db[_0xdc61('0x75')][_0xdc61('0x8d')](function(_0x20ea9f){return _0x5220b1[_0xdc61('0x7c')](_0x8d77d3[_0xdc61('0x3f')][_0xdc61('0x7e')],{'transaction':_0x20ea9f})['then'](function(){if(!_[_0xdc61('0x8e')](_0x38de25)){return _0x5220b1[_0xdc61('0x8f')](_0x38de25,{'transaction':_0x20ea9f})[_0xdc61('0x28')](function(){return db[_0xdc61('0x90')][_0xdc61('0x29')]({'where':{'VoiceQueueId':_0x8d77d3[_0xdc61('0x51')]['id'],'UserId':_0x38de25},'transaction':_0x20ea9f});});}})[_0xdc61('0x28')](function(){_0x38de25['forEach'](function(_0x3a23a4){socket[_0xdc61('0x7a')](_0xdc61('0x91'),{'UserId':_0x3a23a4,'VoiceQueueId':_0x5220b1['id']});});});});});});})['then'](respondWithStatusCode(_0x1f234c,null))[_0xdc61('0x54')](handleError(_0x1f234c,null));};exports['addAgents']=function(_0x10c496,_0x16537c,_0x4d47a){var _0x58ae66,_0x45fede;return db['VoiceQueue'][_0xdc61('0x59')]({'where':{'id':_0x10c496['params']['id']}})[_0xdc61('0x28')](handleEntityNotFound(_0x16537c,null))[_0xdc61('0x28')](function(_0x165b47){if(_0x165b47){_0x45fede=_0x165b47;return _0x165b47['addAgents'](_0x10c496[_0xdc61('0x56')]['ids'],_[_0xdc61('0x92')](_0x10c496[_0xdc61('0x56')],[_0xdc61('0x7e'),'id'])||{})[_0xdc61('0x93')](function(_0x11f812){for(var _0x1ace73=0x0;_0x1ace73<_0x10c496[_0xdc61('0x56')][_0xdc61('0x7e')][_0xdc61('0x44')];_0x1ace73+=0x1){socket['emit'](_0xdc61('0x7b'),{'UserId':Number(_0x10c496[_0xdc61('0x56')][_0xdc61('0x7e')][_0x1ace73]),'VoiceQueueId':Number(_0x10c496['params']['id'])});}return _0x11f812;});}})[_0xdc61('0x28')](function(_0x366b8b){_0x58ae66=_0x366b8b||[];if(_0x45fede){return db[_0xdc61('0x94')][_0xdc61('0x50')]({'where':{'id':_0x10c496[_0xdc61('0x56')][_0xdc61('0x7e')]},'attributes':['id',_0xdc61('0x38'),_0xdc61('0x70'),_0xdc61('0x71'),_0xdc61('0x72')],'raw':!![]});}})[_0xdc61('0x28')](function(_0x393917){if(!_['isEmpty'](_0x393917)){var _0x288f15=[];for(var _0x5b174a=0x0;_0x5b174a<_0x393917['length'];_0x5b174a++){if(_0x393917[_0x5b174a]['online']){_0x288f15[_0xdc61('0x95')](db[_0xdc61('0x90')][_0xdc61('0x77')]({'membername':_0x393917[_0x5b174a][_0xdc61('0x38')],'UserId':_0x393917[_0x5b174a]['id'],'queue_name':_0x45fede['name'],'VoiceQueueId':_0x45fede['id'],'interface':_[_0xdc61('0x96')](_0x393917[_0x5b174a][_0xdc61('0x72')])?util['format'](_0xdc61('0x97'),_0x393917[_0x5b174a][_0xdc61('0x38')]):_0x393917[_0x5b174a][_0xdc61('0x72')],'paused':_0x393917[_0x5b174a][_0xdc61('0x71')]||![],'penalty':_0x10c496[_0xdc61('0x56')][_0xdc61('0x78')]||0x0}));}}return BPromise[_0xdc61('0x98')](_0x288f15);}})[_0xdc61('0x28')](function(){return _0x58ae66;})[_0xdc61('0x28')](respondWithResult(_0x16537c,null))[_0xdc61('0x54')](handleError(_0x16537c,null));};exports[_0xdc61('0x8f')]=function(_0x53c314,_0x4979bf,_0x35a06d){return db[_0xdc61('0x4d')]['find']({'where':{'id':_0x53c314[_0xdc61('0x51')]['id']}})[_0xdc61('0x28')](handleEntityNotFound(_0x4979bf,null))[_0xdc61('0x28')](function(_0x317c39){if(_0x317c39){return _0x317c39[_0xdc61('0x8f')](_0x53c314[_0xdc61('0x3f')]['ids'])[_0xdc61('0x28')](function(){if(_[_0xdc61('0x99')](_0x53c314[_0xdc61('0x3f')][_0xdc61('0x7e')])){for(var _0x3e91ba=0x0;_0x3e91ba<_0x53c314['query'][_0xdc61('0x7e')][_0xdc61('0x44')];_0x3e91ba+=0x1){socket[_0xdc61('0x7a')](_0xdc61('0x91'),{'UserId':Number(_0x53c314[_0xdc61('0x3f')][_0xdc61('0x7e')][_0x3e91ba]),'VoiceQueueId':Number(_0x53c314['params']['id'])});}}else{socket[_0xdc61('0x7a')](_0xdc61('0x91'),{'UserId':Number(_0x53c314['query'][_0xdc61('0x7e')]),'VoiceQueueId':Number(_0x53c314[_0xdc61('0x51')]['id'])});}});}})[_0xdc61('0x28')](function(_0x63edc6){return db['UserVoiceQueueRt'][_0xdc61('0x29')]({'where':{'VoiceQueueId':_0x53c314['params']['id'],'UserId':_0x53c314[_0xdc61('0x3f')][_0xdc61('0x7e')]}})[_0xdc61('0x28')](function(){return _0x63edc6;});})[_0xdc61('0x28')](respondWithStatusCode(_0x4979bf,null))[_0xdc61('0x54')](handleError(_0x4979bf,null));};exports['getAgents']=function(_0x2c6149,_0x23e04a,_0x26f890){var _0x176c97={};var _0x3f7f28={};var _0x2e320c;var _0x48b3fc;return db[_0xdc61('0x4d')]['findOne']({'where':{'id':_0x2c6149['params']['id']}})[_0xdc61('0x28')](handleEntityNotFound(_0x23e04a,null))[_0xdc61('0x28')](function(_0x11696f){if(_0x11696f){_0x2e320c=_0x11696f;_0x3f7f28[_0xdc61('0x3e')]=_[_0xdc61('0x52')](db[_0xdc61('0x94')][_0xdc61('0x3b')]);_0x3f7f28[_0xdc61('0x3f')]=_['keys'](_0x2c6149[_0xdc61('0x3f')]);_0x3f7f28[_0xdc61('0x40')]=_[_0xdc61('0x41')](_0x3f7f28[_0xdc61('0x3e')],_0x3f7f28[_0xdc61('0x3f')]);_0x176c97[_0xdc61('0x42')]=_[_0xdc61('0x41')](_0x3f7f28[_0xdc61('0x3e')],qs[_0xdc61('0x43')](_0x2c6149[_0xdc61('0x3f')]['fields']));_0x176c97[_0xdc61('0x42')]=_0x176c97[_0xdc61('0x42')][_0xdc61('0x44')]?_0x176c97[_0xdc61('0x42')]:_0x3f7f28[_0xdc61('0x3e')];_0x176c97[_0xdc61('0x68')]=qs[_0xdc61('0x48')](_0x2c6149[_0xdc61('0x3f')][_0xdc61('0x48')]);_0x176c97[_0xdc61('0x4a')]=qs['filters'](_['pick'](_0x2c6149[_0xdc61('0x3f')],_0x3f7f28[_0xdc61('0x40')]));if(_0x2c6149[_0xdc61('0x3f')][_0xdc61('0x2f')]){_0x176c97[_0xdc61('0x4a')]=_[_0xdc61('0x4b')](_0x176c97[_0xdc61('0x4a')],{'$or':_[_0xdc61('0x31')](_0x176c97[_0xdc61('0x42')],function(_0x26299b){var _0x1e7ad9={};_0x1e7ad9[_0x26299b]={'$like':'%'+_0x2c6149[_0xdc61('0x3f')]['filter']+'%'};return _0x1e7ad9;})});}_0x176c97=_[_0xdc61('0x4b')]({},_0x176c97,_0x2c6149[_0xdc61('0x53')]);return _0x2e320c[_0xdc61('0x9a')](_0x176c97);}})['then'](function(_0x1849af){if(_0x1849af){_0x48b3fc=_0x1849af[_0xdc61('0x44')];if(!_0x2c6149['query']['hasOwnProperty'](_0xdc61('0x46'))){_0x176c97['limit']=qs['limit'](_0x2c6149['query'][_0xdc61('0x47')]);_0x176c97[_0xdc61('0x22')]=qs[_0xdc61('0x22')](_0x2c6149[_0xdc61('0x3f')]['offset']);}return _0x2e320c['getAgents'](_0x176c97);}})['then'](function(_0x525d78){if(_0x525d78){return _0x525d78?{'count':_0x48b3fc,'rows':_0x525d78}:null;}})[_0xdc61('0x28')](respondWithResult(_0x23e04a,null))['catch'](handleError(_0x23e04a,null));};exports[_0xdc61('0x9b')]=function(_0x3b53ca,_0x1af48b,_0x25b66f){var _0x560ec9={};var _0x344d36={};var _0x13b294;var _0xe6b11b;return db[_0xdc61('0x4d')]['findOne']({'where':{'id':_0x3b53ca['params']['id']}})[_0xdc61('0x28')](handleEntityNotFound(_0x1af48b,null))[_0xdc61('0x28')](function(_0x53bd0d){if(_0x53bd0d){_0x13b294=_0x53bd0d;_0x344d36[_0xdc61('0x3e')]=_[_0xdc61('0x52')](db[_0xdc61('0x90')]['rawAttributes']);_0x344d36[_0xdc61('0x3f')]=_['keys'](_0x3b53ca[_0xdc61('0x3f')]);_0x344d36[_0xdc61('0x40')]=_['intersection'](_0x344d36['model'],_0x344d36[_0xdc61('0x3f')]);_0x560ec9['attributes']=_[_0xdc61('0x41')](_0x344d36[_0xdc61('0x3e')],qs[_0xdc61('0x43')](_0x3b53ca[_0xdc61('0x3f')][_0xdc61('0x43')]));_0x560ec9['attributes']=_0x560ec9['attributes'][_0xdc61('0x44')]?_0x560ec9[_0xdc61('0x42')]:_0x344d36['model'];_0x560ec9[_0xdc61('0x68')]=qs[_0xdc61('0x48')](_0x3b53ca[_0xdc61('0x3f')][_0xdc61('0x48')]);_0x560ec9[_0xdc61('0x4a')]=qs['filters'](_[_0xdc61('0x49')](_0x3b53ca['query'],_0x344d36[_0xdc61('0x40')]));if(_0x3b53ca['query'][_0xdc61('0x2f')]){_0x560ec9[_0xdc61('0x4a')]=_[_0xdc61('0x4b')](_0x560ec9[_0xdc61('0x4a')],{'$or':_[_0xdc61('0x31')](_0x560ec9[_0xdc61('0x42')],function(_0x3d02c6){var _0x386378={};_0x386378[_0x3d02c6]={'$like':'%'+_0x3b53ca[_0xdc61('0x3f')][_0xdc61('0x2f')]+'%'};return _0x386378;})});}_0x560ec9=_[_0xdc61('0x4b')]({},_0x560ec9,_0x3b53ca['options']);return _0x13b294[_0xdc61('0x9b')](_0x560ec9);}})[_0xdc61('0x28')](function(_0x3f79f6){if(_0x3f79f6){_0xe6b11b=_0x3f79f6[_0xdc61('0x44')];if(!_0x3b53ca['query'][_0xdc61('0x45')](_0xdc61('0x46'))){_0x560ec9[_0xdc61('0x47')]=qs[_0xdc61('0x47')](_0x3b53ca[_0xdc61('0x3f')][_0xdc61('0x47')]);_0x560ec9[_0xdc61('0x22')]=qs[_0xdc61('0x22')](_0x3b53ca[_0xdc61('0x3f')][_0xdc61('0x22')]);}return _0x13b294['getMembers'](_0x560ec9);}})[_0xdc61('0x28')](function(_0x3878bf){return _0x3878bf?{'count':_0xe6b11b,'rows':_0x3878bf}:null;})[_0xdc61('0x28')](respondWithResult(_0x1af48b,null))['catch'](handleError(_0x1af48b,null));};exports[_0xdc61('0x9c')]=function(_0x2cd7ba,_0x2b5655,_0xba3405){var _0x522942={};var _0x3d24a3={};var _0x4c1627;var _0x16f953;return db[_0xdc61('0x4d')][_0xdc61('0x62')]({'where':{'id':_0x2cd7ba['params']['id']}})[_0xdc61('0x28')](handleEntityNotFound(_0x2b5655,null))[_0xdc61('0x28')](function(_0xa80434){if(_0xa80434){_0x4c1627=_0xa80434;_0x3d24a3[_0xdc61('0x3e')]=_[_0xdc61('0x52')](db['CmList'][_0xdc61('0x3b')]);_0x3d24a3[_0xdc61('0x3f')]=_['keys'](_0x2cd7ba[_0xdc61('0x3f')]);_0x3d24a3[_0xdc61('0x40')]=_[_0xdc61('0x41')](_0x3d24a3[_0xdc61('0x3e')],_0x3d24a3[_0xdc61('0x3f')]);_0x522942['attributes']=_[_0xdc61('0x41')](_0x3d24a3[_0xdc61('0x3e')],qs[_0xdc61('0x43')](_0x2cd7ba['query'][_0xdc61('0x43')]));_0x522942['attributes']=_0x522942[_0xdc61('0x42')][_0xdc61('0x44')]?_0x522942[_0xdc61('0x42')]:_0x3d24a3[_0xdc61('0x3e')];_0x522942[_0xdc61('0x68')]=qs[_0xdc61('0x48')](_0x2cd7ba['query'][_0xdc61('0x48')]);_0x522942[_0xdc61('0x4a')]=qs['filters'](_[_0xdc61('0x49')](_0x2cd7ba[_0xdc61('0x3f')],_0x3d24a3[_0xdc61('0x40')]));if(_0x2cd7ba['query']['filter']){_0x522942['where']=_['merge'](_0x522942['where'],{'$or':_[_0xdc61('0x31')](_0x522942[_0xdc61('0x42')],function(_0x1b7748){var _0x4cb31c={};_0x4cb31c[_0x1b7748]={'$like':'%'+_0x2cd7ba[_0xdc61('0x3f')]['filter']+'%'};return _0x4cb31c;})});}_0x522942=_[_0xdc61('0x4b')]({},_0x522942,_0x2cd7ba[_0xdc61('0x53')]);return _0x4c1627['getLists'](_0x522942);}})[_0xdc61('0x28')](function(_0x33e5d6){if(_0x33e5d6){_0x16f953=_0x33e5d6['length'];if(!_0x2cd7ba['query']['hasOwnProperty'](_0xdc61('0x46'))){_0x522942[_0xdc61('0x47')]=qs[_0xdc61('0x47')](_0x2cd7ba[_0xdc61('0x3f')][_0xdc61('0x47')]);_0x522942['offset']=qs[_0xdc61('0x22')](_0x2cd7ba[_0xdc61('0x3f')][_0xdc61('0x22')]);}return _0x4c1627[_0xdc61('0x9c')](_0x522942);}})[_0xdc61('0x28')](function(_0x20a06d){if(_0x20a06d){return _0x20a06d?{'count':_0x16f953,'rows':_0x20a06d}:null;}})[_0xdc61('0x28')](respondWithResult(_0x2b5655,null))['catch'](handleError(_0x2b5655,null));};exports[_0xdc61('0x9d')]=function(_0x455b0c,_0x137afb,_0x4ff6c0){var _0x3a8436=moment()[_0xdc61('0x9e')](_0xdc61('0x9f'));var _0x2cea2b,_0x4f6235;return db[_0xdc61('0x4d')]['find']({'where':{'id':_0x455b0c[_0xdc61('0x51')]['id']}})[_0xdc61('0x28')](handleEntityNotFound(_0x137afb,null))[_0xdc61('0x28')](function(_0x1ba6c2){if(_0x1ba6c2){_0x4f6235=_0x1ba6c2;return _0x1ba6c2[_0xdc61('0x9d')](_0x455b0c['body'][_0xdc61('0x7e')],_[_0xdc61('0x92')](_0x455b0c[_0xdc61('0x56')],[_0xdc61('0x7e'),'id'])||{});}return null;})['spread'](function(_0xa7c3bc){var _0x3f8134;_0x2cea2b=_0xa7c3bc||[];var _0x3bbda7=[];if(_0xa7c3bc){for(var _0x459266=0x0;_0x459266<_0xa7c3bc[_0xdc61('0x44')];_0x459266+=0x1){var _0x3e05cd=_0xa7c3bc[_0x459266][_0xdc61('0x2a')]({'plain':!![]});_0x4f6235[_0xdc61('0xa0')]=_0x455b0c[_0xdc61('0x56')][_0xdc61('0xa0')]?_0x455b0c[_0xdc61('0x56')][_0xdc61('0xa0')]:_0x4f6235[_0xdc61('0xa0')];switch(_0x4f6235[_0xdc61('0xa0')]){case _0xdc61('0xa1'):_0x3f8134=squel[_0xdc61('0xa2')]()[_0xdc61('0xa3')](_0xdc61('0xa4'))[_0xdc61('0xa5')]([_0xdc61('0xa6'),'scheduledAt',_0xdc61('0xa7'),_0xdc61('0xa8'),_0xdc61('0x64'),_0xdc61('0x5f'),_0xdc61('0x60')],squel['select']()[_0xdc61('0x80')](_0xdc61('0xa6'),_0xdc61('0xa6'))[_0xdc61('0x80')]('\x27'+_0x3a8436+'\x27',_0xdc61('0xa9'))['field']('id','ContactId')['field'](_0x3e05cd[_0xdc61('0xaa')][_0xdc61('0x88')](),_0xdc61('0xa8'))[_0xdc61('0x80')](_0x455b0c[_0xdc61('0x51')]['id'][_0xdc61('0x88')](),_0xdc61('0x64'))[_0xdc61('0x80')]('\x27'+_0x3a8436+'\x27','createdAt')[_0xdc61('0x80')]('\x27'+_0x3a8436+'\x27',_0xdc61('0x60'))[_0xdc61('0x82')](_0xdc61('0xab'))['where'](_0xdc61('0xac'))[_0xdc61('0x4a')](_0xdc61('0xad'),_0x3e05cd[_0xdc61('0xaa')][_0xdc61('0x88')]())[_0xdc61('0x4a')](_0xdc61('0xae'))['where']('phone\x20NOT\x20IN\x20(?)',squel['select']()['field'](_0xdc61('0xaf'))[_0xdc61('0x82')](_0xdc61('0xb0'))[_0xdc61('0x4a')](_0xdc61('0x86'),_0x455b0c[_0xdc61('0x51')]['id'][_0xdc61('0x88')]()))[_0xdc61('0x4a')](_0xdc61('0xb1'),squel['select']()[_0xdc61('0x80')](_0xdc61('0xb2'))[_0xdc61('0x82')]('cm_hopper')[_0xdc61('0x4a')](_0xdc61('0x86'),_0x455b0c[_0xdc61('0x51')]['id'][_0xdc61('0x88')]())))[_0xdc61('0x88')]();break;case'onlyIfOpen':_0x3f8134=squel[_0xdc61('0xa2')]()[_0xdc61('0xa3')](_0xdc61('0xa4'))[_0xdc61('0xa5')]([_0xdc61('0xa6'),_0xdc61('0xa9'),'ContactId','ListId','VoiceQueueId',_0xdc61('0x5f'),_0xdc61('0x60')],squel[_0xdc61('0x7f')]()[_0xdc61('0x80')](_0xdc61('0xa6'),'phone')[_0xdc61('0x80')]('\x27'+_0x3a8436+'\x27','scheduledAt')[_0xdc61('0x80')]('id',_0xdc61('0xa7'))[_0xdc61('0x80')](_0x3e05cd[_0xdc61('0xaa')][_0xdc61('0x88')](),_0xdc61('0xa8'))[_0xdc61('0x80')](_0x455b0c[_0xdc61('0x51')]['id'][_0xdc61('0x88')](),_0xdc61('0x64'))[_0xdc61('0x80')]('\x27'+_0x3a8436+'\x27','createdAt')['field']('\x27'+_0x3a8436+'\x27',_0xdc61('0x60'))[_0xdc61('0x82')](_0xdc61('0xab'))[_0xdc61('0x4a')]('deletedAt\x20IS\x20NULL')[_0xdc61('0x4a')](_0xdc61('0xad'),_0x3e05cd[_0xdc61('0xaa')][_0xdc61('0x88')]())[_0xdc61('0x4a')](_0xdc61('0xae'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0xdc61('0x7f')]()[_0xdc61('0x80')](_0xdc61('0xb2'))['from']('cm_hopper')['where'](_0xdc61('0x86'),_0x455b0c['params']['id']['toString']())))[_0xdc61('0x88')]();break;default:_0x3f8134=squel['insert']()[_0xdc61('0xa3')](_0xdc61('0xa4'))['fromQuery']([_0xdc61('0xa6'),_0xdc61('0xa9'),'ContactId',_0xdc61('0xa8'),'VoiceQueueId',_0xdc61('0x5f'),_0xdc61('0x60')],squel[_0xdc61('0x7f')]()[_0xdc61('0x80')]('phone',_0xdc61('0xa6'))[_0xdc61('0x80')]('\x27'+_0x3a8436+'\x27',_0xdc61('0xa9'))[_0xdc61('0x80')]('id',_0xdc61('0xa7'))[_0xdc61('0x80')](_0x3e05cd[_0xdc61('0xaa')][_0xdc61('0x88')](),_0xdc61('0xa8'))[_0xdc61('0x80')](_0x455b0c[_0xdc61('0x51')]['id'][_0xdc61('0x88')](),'VoiceQueueId')['field']('\x27'+_0x3a8436+'\x27',_0xdc61('0x5f'))[_0xdc61('0x80')]('\x27'+_0x3a8436+'\x27','updatedAt')[_0xdc61('0x82')](_0xdc61('0xab'))[_0xdc61('0x4a')](_0xdc61('0xac'))[_0xdc61('0x4a')](_0xdc61('0xad'),_0x3e05cd[_0xdc61('0xaa')][_0xdc61('0x88')]())[_0xdc61('0x4a')](_0xdc61('0xae')))['toString']();}_0x3bbda7[_0xdc61('0x95')](db[_0xdc61('0x75')][_0xdc61('0x3f')](_0x3f8134));}return BPromise['all'](_0x3bbda7);}})[_0xdc61('0x28')](function(){var _0x2a2522=[];var _0x40738b=squel[_0xdc61('0xa2')]()[_0xdc61('0xa3')]('cm_hopper_additional_phones')[_0xdc61('0xa5')](['CmHopperId',_0xdc61('0xa6'),_0xdc61('0xb3'),_0xdc61('0x5f'),'updatedAt'],squel[_0xdc61('0x7f')]()[_0xdc61('0x80')](_0xdc61('0xb4'))[_0xdc61('0x80')]('ci.item')[_0xdc61('0x80')](_0xdc61('0xb5'))[_0xdc61('0x80')]('\x27'+_0x3a8436+'\x27',_0xdc61('0x5f'))[_0xdc61('0x80')]('\x27'+_0x3a8436+'\x27',_0xdc61('0x60'))[_0xdc61('0x82')](_0xdc61('0xb6'),'ci')['join'](_0xdc61('0xa4'),'h',_0xdc61('0xb7'))[_0xdc61('0x4a')](_0xdc61('0xb8'),_0x3a8436)[_0xdc61('0x4a')](_0xdc61('0xb9'),_0xdc61('0xba')))[_0xdc61('0x88')]();_0x2a2522[_0xdc61('0x95')](db[_0xdc61('0x75')][_0xdc61('0x3f')](_0x40738b));return BPromise['all'](_0x2a2522);})[_0xdc61('0x28')](function(){return _0x2cea2b;})[_0xdc61('0x28')](respondWithResult(_0x137afb,null))[_0xdc61('0x54')](handleError(_0x137afb,null));};exports[_0xdc61('0xbb')]=function(_0x2a403b,_0x385cf1,_0x20a6ef){return db['VoiceQueue'][_0xdc61('0x59')]({'where':{'id':_0x2a403b[_0xdc61('0x51')]['id']}})['then'](handleEntityNotFound(_0x385cf1,null))[_0xdc61('0x28')](function(_0x2552e3){if(_0x2552e3){return _0x2552e3[_0xdc61('0xbb')](_0x2a403b[_0xdc61('0x3f')]['ids']);}})[_0xdc61('0x28')](function(_0x2f62a3){if(_0x2f62a3){return db['CmHopper'][_0xdc61('0x29')]({'where':{'ListId':_0x2a403b[_0xdc61('0x3f')][_0xdc61('0x7e')],'VoiceQueueId':_0x2a403b[_0xdc61('0x51')]['id']}})[_0xdc61('0x28')](function(){return _0x2f62a3;});}})[_0xdc61('0x28')](respondWithStatusCode(_0x385cf1,null))[_0xdc61('0x54')](handleError(_0x385cf1,null));};exports[_0xdc61('0xbc')]=function(_0x5f1e73,_0x54ee24,_0x1b44ca){var _0x163016={};var _0x48b266={};var _0x5eb151;var _0x57fcba;return db['VoiceQueue'][_0xdc61('0x62')]({'where':{'id':_0x5f1e73[_0xdc61('0x51')]['id']}})[_0xdc61('0x28')](handleEntityNotFound(_0x54ee24,null))[_0xdc61('0x28')](function(_0x5b3453){if(_0x5b3453){_0x5eb151=_0x5b3453;_0x48b266[_0xdc61('0x3e')]=_['keys'](db[_0xdc61('0xbd')][_0xdc61('0x3b')]);_0x48b266[_0xdc61('0x3f')]=_[_0xdc61('0x52')](_0x5f1e73[_0xdc61('0x3f')]);_0x48b266[_0xdc61('0x40')]=_[_0xdc61('0x41')](_0x48b266['model'],_0x48b266[_0xdc61('0x3f')]);_0x163016[_0xdc61('0x42')]=_['intersection'](_0x48b266[_0xdc61('0x3e')],qs[_0xdc61('0x43')](_0x5f1e73[_0xdc61('0x3f')]['fields']));_0x163016['attributes']=_0x163016['attributes'][_0xdc61('0x44')]?_0x163016[_0xdc61('0x42')]:_0x48b266[_0xdc61('0x3e')];_0x163016[_0xdc61('0x68')]=qs[_0xdc61('0x48')](_0x5f1e73[_0xdc61('0x3f')]['sort']);_0x163016[_0xdc61('0x4a')]=qs[_0xdc61('0x40')](_[_0xdc61('0x49')](_0x5f1e73['query'],_0x48b266[_0xdc61('0x40')]));if(_0x5f1e73[_0xdc61('0x3f')][_0xdc61('0x2f')]){_0x163016[_0xdc61('0x4a')]=_[_0xdc61('0x4b')](_0x163016['where'],{'$or':_[_0xdc61('0x31')](_0x163016['attributes'],function(_0x49a0c0){var _0x50468a={};_0x50468a[_0x49a0c0]={'$like':'%'+_0x5f1e73[_0xdc61('0x3f')][_0xdc61('0x2f')]+'%'};return _0x50468a;})});}_0x163016=_[_0xdc61('0x4b')]({},_0x163016,_0x5f1e73[_0xdc61('0x53')]);return _0x5eb151['getBlackLists'](_0x163016);}})[_0xdc61('0x28')](function(_0x4d8b5f){if(_0x4d8b5f){_0x57fcba=_0x4d8b5f[_0xdc61('0x44')];if(!_0x5f1e73[_0xdc61('0x3f')][_0xdc61('0x45')]('nolimit')){_0x163016[_0xdc61('0x47')]=qs[_0xdc61('0x47')](_0x5f1e73[_0xdc61('0x3f')]['limit']);_0x163016[_0xdc61('0x22')]=qs[_0xdc61('0x22')](_0x5f1e73[_0xdc61('0x3f')][_0xdc61('0x22')]);}return _0x5eb151[_0xdc61('0xbc')](_0x163016);}})[_0xdc61('0x28')](function(_0x587d55){if(_0x587d55){return _0x587d55?{'count':_0x57fcba,'rows':_0x587d55}:null;}})[_0xdc61('0x28')](respondWithResult(_0x54ee24,null))[_0xdc61('0x54')](handleError(_0x54ee24,null));};exports[_0xdc61('0xbe')]=function(_0x3e25d8,_0x45eea8,_0x3cf9a0){var _0x1c568d,_0xbce30a;return db[_0xdc61('0x4d')][_0xdc61('0x59')]({'where':{'id':_0x3e25d8[_0xdc61('0x51')]['id']}})[_0xdc61('0x28')](handleEntityNotFound(_0x45eea8,null))[_0xdc61('0x28')](function(_0x17fc2d){if(_0x17fc2d){_0xbce30a=_0x17fc2d;return _0x17fc2d[_0xdc61('0xbe')](_0x3e25d8[_0xdc61('0x56')][_0xdc61('0x7e')],_[_0xdc61('0x92')](_0x3e25d8['body'],['ids','id'])||{});}return null;})[_0xdc61('0x93')](function(_0x4bd14f){var _0xaef08d;_0x1c568d=_0x4bd14f||[];var _0x2e5e74=[];if(_0x4bd14f){for(var _0x541bf3=0x0;_0x541bf3<_0x4bd14f[_0xdc61('0x44')];_0x541bf3+=0x1){var _0x418a2d=_0x4bd14f[_0x541bf3][_0xdc61('0x2a')]({'plain':!![]});_0xaef08d=squel[_0xdc61('0xa2')]()[_0xdc61('0xa3')](_0xdc61('0xbf'))[_0xdc61('0xa5')]([_0xdc61('0xa6'),_0xdc61('0xa7'),_0xdc61('0xa8'),_0xdc61('0x64'),_0xdc61('0x5f'),'updatedAt'],squel[_0xdc61('0x7f')]()[_0xdc61('0x80')]('phone','phone')[_0xdc61('0x80')]('id',_0xdc61('0xa7'))[_0xdc61('0x80')](_0x418a2d[_0xdc61('0xaa')][_0xdc61('0x88')](),_0xdc61('0xa8'))[_0xdc61('0x80')](_0x3e25d8['params']['id'][_0xdc61('0x88')](),_0xdc61('0x64'))[_0xdc61('0x80')](_0xdc61('0xc0'),_0xdc61('0x5f'))[_0xdc61('0x80')](_0xdc61('0xc0'),_0xdc61('0x60'))[_0xdc61('0x82')]('cm_contacts')[_0xdc61('0x4a')](_0xdc61('0xac'))[_0xdc61('0x4a')]('ListId\x20=\x20?',_0x418a2d[_0xdc61('0xaa')][_0xdc61('0x88')]())[_0xdc61('0x4a')](_0xdc61('0xae')))['toString']();_0x2e5e74['push'](db[_0xdc61('0x75')][_0xdc61('0x3f')](_0xaef08d));}return BPromise['all'](_0x2e5e74);}})[_0xdc61('0x28')](function(){return _0x1c568d;})[_0xdc61('0x28')](respondWithResult(_0x45eea8,null))[_0xdc61('0x54')](handleError(_0x45eea8,null));};exports[_0xdc61('0xc1')]=function(_0x404340,_0x108a64,_0x39fa7a){return db[_0xdc61('0x4d')][_0xdc61('0x59')]({'where':{'id':_0x404340['params']['id']}})['then'](handleEntityNotFound(_0x108a64,null))[_0xdc61('0x28')](function(_0x43bbe1){if(_0x43bbe1){return _0x43bbe1[_0xdc61('0xc1')](_0x404340[_0xdc61('0x3f')][_0xdc61('0x7e')]);}})[_0xdc61('0x28')](function(_0x1dbdac){if(_0x1dbdac){return db[_0xdc61('0x6c')][_0xdc61('0x29')]({'where':{'ListId':_0x404340[_0xdc61('0x3f')]['ids'],'VoiceQueueId':_0x404340[_0xdc61('0x51')]['id']}})[_0xdc61('0x28')](function(){return _0x1dbdac;});}})[_0xdc61('0x28')](respondWithStatusCode(_0x108a64,null))[_0xdc61('0x54')](handleError(_0x108a64,null));}; \ No newline at end of file +var _0x1224=['online','voicePause','interface','flatMap','penalty','transaction','each','TeamVoiceQueue','upsert','UserVoiceQueue','UserVoiceQueueRt','isNil','format','forEach','emit','userVoiceQueue:save','ids','select','field','tq.TeamId','team_has_voice_queues','user_has_teams','push','toString','QueryTypes','SELECT','TeamId','all','union','sequelize','removeTeams','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','SIP/%s','isArray','getAgents','getMembers','getLists','addLists','dialCheckDuplicateType','insert','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','phone','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','from','VoiceQueueId\x20=\x20?','COALESCE(phone,\x27\x27)','into','OrderBy','h.id','ci.item','ci.OrderBy+1','cm_contact_has_items','h.ContactId=ci.CmContactId','ci.ItemClass=?','removeLists','CmList','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','save','update','destroy','then','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','map','value','includes','type','name','UserProfileResource','stack','send','VoiceQueue','fieldName','model','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','includeAll','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','rawAttributes','omit','createdAt','updatedAt','userProfileId','getHoppers','findOne','hasOwnProperty','VoiceQueueId','CmHopper','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','User','Agents'];(function(_0x56916d,_0x37b935){var _0x2b7f1f=function(_0x206eb1){while(--_0x206eb1){_0x56916d['push'](_0x56916d['shift']());}};_0x2b7f1f(++_0x37b935);}(_0x1224,0x10d));var _0x4122=function(_0x47cc40,_0x3b3d9b){_0x47cc40=_0x47cc40-0x0;var _0x4623c0=_0x1224[_0x47cc40];return _0x4623c0;};'use strict';var emlformat=require(_0x4122('0x0'));var rimraf=require(_0x4122('0x1'));var zipdir=require(_0x4122('0x2'));var jsonpatch=require(_0x4122('0x3'));var rp=require(_0x4122('0x4'));var moment=require(_0x4122('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4122('0x6'));var util=require(_0x4122('0x7'));var path=require(_0x4122('0x8'));var sox=require('sox');var csv=require(_0x4122('0x9'));var ejs=require(_0x4122('0xa'));var fs=require('fs');var fs_extra=require(_0x4122('0xb'));var _=require(_0x4122('0xc'));var squel=require(_0x4122('0xd'));var crypto=require(_0x4122('0xe'));var jsforce=require(_0x4122('0xf'));var deskjs=require(_0x4122('0x10'));var toCsv=require(_0x4122('0x9'));var querystring=require(_0x4122('0x11'));var Papa=require(_0x4122('0x12'));var Redis=require(_0x4122('0x13'));var authService=require(_0x4122('0x14'));var qs=require(_0x4122('0x15'));var as=require(_0x4122('0x16'));var hardwareService=require(_0x4122('0x17'));var logger=require(_0x4122('0x18'))(_0x4122('0x19'));var utils=require(_0x4122('0x1a'));var config=require(_0x4122('0x1b'));var licenseUtil=require(_0x4122('0x1c'));var db=require(_0x4122('0x1d'))['db'];config[_0x4122('0x1e')]=_[_0x4122('0x1f')](config[_0x4122('0x1e')],{'host':_0x4122('0x20'),'port':0x18eb});var socket=require(_0x4122('0x21'))(new Redis(config[_0x4122('0x1e')]));require(_0x4122('0x22'))[_0x4122('0x23')](socket);function respondWithStatusCode(_0x3a88fe,_0x47ae9b){_0x47ae9b=_0x47ae9b||0xcc;return function(_0x4761a0){if(_0x4761a0){return _0x3a88fe[_0x4122('0x24')](_0x47ae9b);}return _0x3a88fe[_0x4122('0x25')](_0x47ae9b)[_0x4122('0x26')]();};}function respondWithResult(_0x520300,_0x2e33cf){_0x2e33cf=_0x2e33cf||0xc8;return function(_0x19684e){if(_0x19684e){return _0x520300['status'](_0x2e33cf)[_0x4122('0x27')](_0x19684e);}};}function respondWithFilteredResult(_0x3ec4d3,_0x399003){return function(_0x4636ae){if(_0x4636ae){var _0xf6ba87=typeof _0x399003[_0x4122('0x28')]===_0x4122('0x29')&&typeof _0x399003['limit']==='undefined';var _0x586105=_0x4636ae[_0x4122('0x2a')];var _0x2d95e8=_0xf6ba87?0x0:_0x399003[_0x4122('0x28')];var _0x1dde85=_0xf6ba87?_0x4636ae[_0x4122('0x2a')]:_0x399003[_0x4122('0x28')]+_0x399003[_0x4122('0x2b')];var _0x46b24e;if(_0x1dde85>=_0x586105){_0x1dde85=_0x586105;_0x46b24e=0xc8;}else{_0x46b24e=0xce;}_0x3ec4d3['status'](_0x46b24e);return _0x3ec4d3[_0x4122('0x2c')]('Content-Range',_0x2d95e8+'-'+_0x1dde85+'/'+_0x586105)['json'](_0x4636ae);}return null;};}function patchUpdates(_0x508cd7){return function(_0x36d8d9){try{jsonpatch[_0x4122('0x2d')](_0x36d8d9,_0x508cd7,!![]);}catch(_0x317418){return BPromise['reject'](_0x317418);}return _0x36d8d9[_0x4122('0x2e')]();};}function saveUpdates(_0x386cdc,_0x5b259d){return function(_0x4a5711){if(_0x4a5711){return _0x4a5711[_0x4122('0x2f')](_0x386cdc)['then'](function(_0x4db23e){return _0x4db23e;});}return null;};}function removeEntity(_0x59895d,_0x1b449b){return function(_0x2e71f4){if(_0x2e71f4){return _0x2e71f4[_0x4122('0x30')]()[_0x4122('0x31')](function(){var _0x31568f=_0x2e71f4[_0x4122('0x32')]({'plain':!![]});var _0x26768b=[{'name':_0x4122('0x33'),'value':_0x4122('0x34'),'ignore':![]},{'name':_0x4122('0x35'),'value':_0x4122('0x36'),'ignore':![]}];var _0x419275=_(_0x26768b)[_0x4122('0x37')]('ignore')[_0x4122('0x38')](_0x4122('0x39'))[_0x4122('0x39')]();if(_[_0x4122('0x3a')](_0x419275,_0x31568f['type'])){return;}var _0x115caa=_['find'](_0x26768b,[_0x4122('0x39'),_0x31568f[_0x4122('0x3b')]])[_0x4122('0x3c')];return db[_0x4122('0x3d')][_0x4122('0x30')]({'where':{'type':_0x115caa,'resourceId':_0x31568f['id']}})[_0x4122('0x31')](function(){return _0x2e71f4;});})[_0x4122('0x31')](function(){_0x59895d[_0x4122('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x17968f,_0x11c2a2){return function(_0x5770bd){if(!_0x5770bd){_0x17968f[_0x4122('0x24')](0x194);}return _0x5770bd;};}function handleError(_0x23974e,_0x384787){_0x384787=_0x384787||0x1f4;return function(_0x1876f8){logger['error'](_0x1876f8[_0x4122('0x3e')]);if(_0x1876f8[_0x4122('0x3c')]){delete _0x1876f8['name'];}_0x23974e['status'](_0x384787)[_0x4122('0x3f')](_0x1876f8);};}exports['index']=function(_0x2359ef,_0x1081e3){var _0x5c7e42={},_0x45a51a={},_0x4457fb={'count':0x0,'rows':[]};var _0x31ba4b=_['map'](db[_0x4122('0x40')]['rawAttributes'],function(_0x4063cb){return{'name':_0x4063cb[_0x4122('0x41')],'type':_0x4063cb[_0x4122('0x3b')]['key']};});_0x45a51a[_0x4122('0x42')]=_['map'](_0x31ba4b,_0x4122('0x3c'));_0x45a51a[_0x4122('0x43')]=_['keys'](_0x2359ef['query']);_0x45a51a['filters']=_[_0x4122('0x44')](_0x45a51a['model'],_0x45a51a[_0x4122('0x43')]);_0x5c7e42[_0x4122('0x45')]=_[_0x4122('0x44')](_0x45a51a[_0x4122('0x42')],qs[_0x4122('0x46')](_0x2359ef['query']['fields']));_0x5c7e42[_0x4122('0x45')]=_0x5c7e42['attributes'][_0x4122('0x47')]?_0x5c7e42['attributes']:_0x45a51a[_0x4122('0x42')];if(!_0x2359ef[_0x4122('0x43')]['hasOwnProperty'](_0x4122('0x48'))){_0x5c7e42[_0x4122('0x2b')]=qs[_0x4122('0x2b')](_0x2359ef[_0x4122('0x43')][_0x4122('0x2b')]);_0x5c7e42[_0x4122('0x28')]=qs['offset'](_0x2359ef[_0x4122('0x43')]['offset']);}_0x5c7e42[_0x4122('0x49')]=qs['sort'](_0x2359ef[_0x4122('0x43')][_0x4122('0x4a')]);_0x5c7e42[_0x4122('0x4b')]=qs[_0x4122('0x4c')](_[_0x4122('0x4d')](_0x2359ef['query'],_0x45a51a[_0x4122('0x4c')]),_0x31ba4b);if(_0x2359ef[_0x4122('0x43')]['filter']){_0x5c7e42['where']=_['merge'](_0x5c7e42[_0x4122('0x4b')],{'$or':_[_0x4122('0x38')](_0x31ba4b,function(_0x319670){if(_0x319670[_0x4122('0x3b')]!==_0x4122('0x4e')){var _0x1183f5={};_0x1183f5[_0x319670[_0x4122('0x3c')]]={'$like':'%'+_0x2359ef[_0x4122('0x43')][_0x4122('0x37')]+'%'};return _0x1183f5;}})});}_0x5c7e42=_['merge']({},_0x5c7e42,_0x2359ef[_0x4122('0x4f')]);var _0x4c6578={'where':_0x5c7e42['where']};return db[_0x4122('0x40')][_0x4122('0x2a')](_0x4c6578)[_0x4122('0x31')](function(_0x5ed2c7){_0x4457fb[_0x4122('0x2a')]=_0x5ed2c7;if(_0x2359ef[_0x4122('0x43')]['includeAll']){_0x5c7e42[_0x4122('0x50')]=[{'all':!![]}];}return db[_0x4122('0x40')][_0x4122('0x51')](_0x5c7e42);})[_0x4122('0x31')](function(_0x49d246){_0x4457fb[_0x4122('0x52')]=_0x49d246;return _0x4457fb;})[_0x4122('0x31')](respondWithFilteredResult(_0x1081e3,_0x5c7e42))[_0x4122('0x53')](handleError(_0x1081e3,null));};exports[_0x4122('0x54')]=function(_0x358f4c,_0x5d43de){var _0x531117={'raw':![],'where':{'id':_0x358f4c[_0x4122('0x55')]['id']}},_0x16b917={};_0x16b917[_0x4122('0x42')]=_[_0x4122('0x56')](db[_0x4122('0x40')]['rawAttributes']);_0x16b917[_0x4122('0x43')]=_[_0x4122('0x56')](_0x358f4c[_0x4122('0x43')]);_0x16b917['filters']=_[_0x4122('0x44')](_0x16b917['model'],_0x16b917[_0x4122('0x43')]);_0x531117[_0x4122('0x45')]=_[_0x4122('0x44')](_0x16b917[_0x4122('0x42')],qs['fields'](_0x358f4c['query'][_0x4122('0x46')]));_0x531117[_0x4122('0x45')]=_0x531117[_0x4122('0x45')][_0x4122('0x47')]?_0x531117['attributes']:_0x16b917[_0x4122('0x42')];if(_0x358f4c['query'][_0x4122('0x57')]){_0x531117['include']=[{'all':!![]}];}_0x531117=_[_0x4122('0x58')]({},_0x531117,_0x358f4c[_0x4122('0x4f')]);return db[_0x4122('0x40')][_0x4122('0x59')](_0x531117)[_0x4122('0x31')](handleEntityNotFound(_0x5d43de,null))[_0x4122('0x31')](respondWithResult(_0x5d43de,null))['catch'](handleError(_0x5d43de,null));};exports[_0x4122('0x5a')]=function(_0x5f4aea,_0x167805){return db[_0x4122('0x40')][_0x4122('0x5a')](_0x5f4aea[_0x4122('0x5b')],{})[_0x4122('0x31')](function(_0x5dd938){var _0x3e28cb=_0x5f4aea[_0x4122('0x5c')][_0x4122('0x32')]({'plain':!![]});if(!_0x3e28cb)throw new Error(_0x4122('0x5d'));if(_0x3e28cb['role']===_0x4122('0x5c')){var _0x4a3f04=_0x5dd938[_0x4122('0x32')]({'plain':!![]});var _0x4314c9=[{'name':_0x4122('0x33'),'value':_0x4122('0x34')},{'name':_0x4122('0x35'),'value':_0x4122('0x36')}];var _0x41eba0=_[_0x4122('0x59')](_0x4314c9,[_0x4122('0x39'),_0x4a3f04['type']])[_0x4122('0x3c')];return db[_0x4122('0x5e')][_0x4122('0x59')]({'where':{'name':_0x41eba0,'userProfileId':_0x3e28cb['userProfileId']},'raw':!![]})['then'](function(_0x4ef016){if(_0x4ef016&&_0x4ef016[_0x4122('0x5f')]===0x0){return db[_0x4122('0x3d')][_0x4122('0x5a')]({'name':_0x4a3f04['name'],'resourceId':_0x4a3f04['id'],'type':_0x4ef016[_0x4122('0x3c')],'sectionId':_0x4ef016['id']},{})[_0x4122('0x31')](function(){return _0x5dd938;});}else{return _0x5dd938;}})[_0x4122('0x53')](function(_0x41d7ab){logger[_0x4122('0x60')](_0x4122('0x61'),_0x41d7ab);throw _0x41d7ab;});}return _0x5dd938;})[_0x4122('0x31')](respondWithResult(_0x167805,0xc9))[_0x4122('0x53')](handleError(_0x167805,null));};exports[_0x4122('0x62')]=function(_0x2269f5,_0x2d418b){var _0xcbfee7={'where':{'id':_0x2269f5[_0x4122('0x55')]['id']}},_0x59c904={};_0x59c904['model']=_[_0x4122('0x56')](db[_0x4122('0x40')][_0x4122('0x63')]);_0xcbfee7[_0x4122('0x45')]=_[_0x4122('0x44')](_0x59c904[_0x4122('0x42')],qs['fields'](_0x2269f5[_0x4122('0x43')]['fields']));_0xcbfee7[_0x4122('0x45')]=_0xcbfee7[_0x4122('0x45')][_0x4122('0x47')]?_0xcbfee7['attributes']:_0x59c904[_0x4122('0x42')];if(_0x2269f5[_0x4122('0x43')]['includeAll']){_0xcbfee7[_0x4122('0x50')]=[{'all':!![]}];}_0xcbfee7=_[_0x4122('0x58')]({},_0xcbfee7,_0x2269f5['options']);return db[_0x4122('0x40')][_0x4122('0x59')](_0xcbfee7)[_0x4122('0x31')](handleEntityNotFound(_0x2d418b,null))[_0x4122('0x31')](function(_0x1862c7){if(_0x1862c7){var _0x37124c=_0x1862c7[_0x4122('0x32')]({'plain':!![]});_0x37124c=qs[_0x4122('0x64')](_0x37124c,['id',_0x4122('0x65'),_0x4122('0x66')]);_0x2269f5['body']=_[_0x4122('0x64')](_0x2269f5[_0x4122('0x5b')],['id',_0x4122('0x65'),_0x4122('0x66')]);return db['VoiceQueue'][_0x4122('0x5a')](_[_0x4122('0x58')](_0x37124c,_0x2269f5['body']),{'include':_0x2269f5['query'][_0x4122('0x57')]?[{'all':!![]}]:undefined})[_0x4122('0x31')](function(_0x456c19){var _0x49199d=_0x2269f5['user']['get']({'plain':!![]});if(!_0x49199d)throw new Error(_0x4122('0x5d'));if(_0x49199d['role']==='user'){var _0x362378=_0x456c19[_0x4122('0x32')]({'plain':!![]});var _0x257a39=[{'name':'VoiceQueues','value':_0x4122('0x34')},{'name':_0x4122('0x35'),'value':_0x4122('0x36')}];var _0x33619f=_[_0x4122('0x59')](_0x257a39,[_0x4122('0x39'),_0x362378[_0x4122('0x3b')]])[_0x4122('0x3c')];return db[_0x4122('0x5e')][_0x4122('0x59')]({'where':{'name':_0x33619f,'userProfileId':_0x49199d[_0x4122('0x67')]},'raw':!![]})[_0x4122('0x31')](function(_0x4de022){if(_0x4de022&&_0x4de022['autoAssociation']===0x0){return db[_0x4122('0x3d')][_0x4122('0x5a')]({'name':_0x362378[_0x4122('0x3c')],'resourceId':_0x362378['id'],'type':_0x4de022['name'],'sectionId':_0x4de022['id']},{})[_0x4122('0x31')](function(){return _0x456c19;});}else{return _0x456c19;}})['catch'](function(_0x3f3b3e){logger[_0x4122('0x60')](_0x4122('0x61'),_0x3f3b3e);throw _0x3f3b3e;});}return _0x456c19;});}})[_0x4122('0x31')](respondWithResult(_0x2d418b,0xc9))[_0x4122('0x53')](handleError(_0x2d418b,null));};exports['update']=function(_0xc9f003,_0x17c3a0){if(_0xc9f003[_0x4122('0x5b')]['id']){delete _0xc9f003[_0x4122('0x5b')]['id'];}return db[_0x4122('0x40')][_0x4122('0x59')]({'where':{'id':_0xc9f003['params']['id']}})[_0x4122('0x31')](handleEntityNotFound(_0x17c3a0,null))[_0x4122('0x31')](saveUpdates(_0xc9f003[_0x4122('0x5b')],null))['then'](respondWithResult(_0x17c3a0,null))[_0x4122('0x53')](handleError(_0x17c3a0,null));};exports[_0x4122('0x30')]=function(_0x353fd9,_0x14b561){return db[_0x4122('0x40')]['find']({'where':{'id':_0x353fd9[_0x4122('0x55')]['id']}})[_0x4122('0x31')](handleEntityNotFound(_0x14b561,null))[_0x4122('0x31')](removeEntity(_0x14b561,null))['catch'](handleError(_0x14b561,null));};exports[_0x4122('0x68')]=function(_0x32c86a,_0x5c5af2,_0x1bb253){var _0x48c00b={'raw':![],'where':{}};var _0x454096={};var _0x3b3187={'count':0x0,'rows':[]};return db[_0x4122('0x40')][_0x4122('0x69')]({'where':{'id':_0x32c86a[_0x4122('0x55')]['id']}})['then'](handleEntityNotFound(_0x5c5af2,null))['then'](function(_0x3ea124){if(_0x3ea124){_0x454096['model']=_[_0x4122('0x56')](db['CmHopper']['rawAttributes']);_0x454096['query']=_['keys'](_0x32c86a[_0x4122('0x43')]);_0x454096['filters']=_['intersection'](_0x454096[_0x4122('0x42')],_0x454096['query']);_0x48c00b[_0x4122('0x45')]=_['intersection'](_0x454096[_0x4122('0x42')],qs[_0x4122('0x46')](_0x32c86a[_0x4122('0x43')]['fields']));_0x48c00b[_0x4122('0x45')]=_0x48c00b['attributes'][_0x4122('0x47')]?_0x48c00b[_0x4122('0x45')]:_0x454096['model'];if(!_0x32c86a[_0x4122('0x43')][_0x4122('0x6a')](_0x4122('0x48'))){_0x48c00b[_0x4122('0x2b')]=qs[_0x4122('0x2b')](_0x32c86a[_0x4122('0x43')]['limit']);_0x48c00b['offset']=qs[_0x4122('0x28')](_0x32c86a[_0x4122('0x43')]['offset']);}_0x48c00b['order']=qs[_0x4122('0x4a')](_0x32c86a[_0x4122('0x43')][_0x4122('0x4a')]);_0x48c00b[_0x4122('0x4b')]=qs[_0x4122('0x4c')](_[_0x4122('0x4d')](_0x32c86a['query'],_0x454096[_0x4122('0x4c')]));_0x48c00b['where'][_0x4122('0x6b')]=_0x3ea124['id'];if(_0x32c86a['query'][_0x4122('0x37')]){_0x48c00b['where']=_[_0x4122('0x58')](_0x48c00b['where'],{'$or':_[_0x4122('0x38')](_0x48c00b[_0x4122('0x45')],function(_0x5e313f){var _0x4ca1bc={};_0x4ca1bc[_0x5e313f]={'$like':'%'+_0x32c86a[_0x4122('0x43')]['filter']+'%'};return _0x4ca1bc;})});}_0x48c00b=_['merge']({},_0x48c00b,_0x32c86a['options']);return db['CmHopper'][_0x4122('0x2a')]({'where':_0x48c00b['where']})[_0x4122('0x31')](function(_0x2771df){_0x3b3187['count']=_0x2771df;if(_0x32c86a[_0x4122('0x43')][_0x4122('0x57')]){_0x48c00b['include']=[{'all':!![]}];}return db[_0x4122('0x6c')][_0x4122('0x51')](_0x48c00b);})['then'](function(_0x5e3a1e){_0x3b3187[_0x4122('0x52')]=_0x5e3a1e;return _0x3b3187;});}})['then'](respondWithFilteredResult(_0x5c5af2,_0x48c00b))[_0x4122('0x53')](handleError(_0x5c5af2,null));};exports[_0x4122('0x6d')]=function(_0x270762,_0x529f8c,_0x4889f8){var _0x38b940={'raw':!![],'where':{}};var _0x18898e={};var _0x44d091={'count':0x0,'rows':[]};return db[_0x4122('0x40')]['findOne']({'where':{'id':_0x270762[_0x4122('0x55')]['id']}})[_0x4122('0x31')](handleEntityNotFound(_0x529f8c,null))[_0x4122('0x31')](function(_0x363dcf){if(_0x363dcf){_0x18898e['model']=_['keys'](db['CmHopperHistory']['rawAttributes']);_0x18898e[_0x4122('0x43')]=_[_0x4122('0x56')](_0x270762[_0x4122('0x43')]);_0x18898e[_0x4122('0x4c')]=_[_0x4122('0x44')](_0x18898e[_0x4122('0x42')],_0x18898e['query']);_0x38b940[_0x4122('0x45')]=_[_0x4122('0x44')](_0x18898e['model'],qs[_0x4122('0x46')](_0x270762[_0x4122('0x43')][_0x4122('0x46')]));_0x38b940['attributes']=_0x38b940['attributes'][_0x4122('0x47')]?_0x38b940[_0x4122('0x45')]:_0x18898e[_0x4122('0x42')];if(!_0x270762[_0x4122('0x43')]['hasOwnProperty'](_0x4122('0x48'))){_0x38b940[_0x4122('0x2b')]=qs[_0x4122('0x2b')](_0x270762[_0x4122('0x43')][_0x4122('0x2b')]);_0x38b940[_0x4122('0x28')]=qs['offset'](_0x270762[_0x4122('0x43')][_0x4122('0x28')]);}_0x38b940[_0x4122('0x49')]=qs[_0x4122('0x4a')](_0x270762['query'][_0x4122('0x4a')]);_0x38b940[_0x4122('0x4b')]=qs[_0x4122('0x4c')](_[_0x4122('0x4d')](_0x270762[_0x4122('0x43')],_0x18898e[_0x4122('0x4c')]));_0x38b940[_0x4122('0x4b')][_0x4122('0x6b')]=_0x363dcf['id'];if(_0x270762['query'][_0x4122('0x37')]){_0x38b940[_0x4122('0x4b')]=_[_0x4122('0x58')](_0x38b940[_0x4122('0x4b')],{'$or':_[_0x4122('0x38')](_0x38b940[_0x4122('0x45')],function(_0x5b343b){var _0x3f5ef9={};_0x3f5ef9[_0x5b343b]={'$like':'%'+_0x270762[_0x4122('0x43')][_0x4122('0x37')]+'%'};return _0x3f5ef9;})});}_0x38b940=_[_0x4122('0x58')]({},_0x38b940,_0x270762[_0x4122('0x4f')]);return db[_0x4122('0x6e')]['count']({'where':_0x38b940[_0x4122('0x4b')]})[_0x4122('0x31')](function(_0x1c5941){_0x44d091[_0x4122('0x2a')]=_0x1c5941;if(_0x270762[_0x4122('0x43')][_0x4122('0x57')]){_0x38b940['include']=[{'all':!![]}];}return db[_0x4122('0x6e')][_0x4122('0x51')](_0x38b940);})['then'](function(_0x43ee3b){_0x44d091[_0x4122('0x52')]=_0x43ee3b;return _0x44d091;});}})[_0x4122('0x31')](respondWithFilteredResult(_0x529f8c,_0x38b940))['catch'](handleError(_0x529f8c,null));};exports[_0x4122('0x6f')]=function(_0x516bdf,_0x4378a1,_0x447369){var _0x1e3916={'raw':!![],'where':{}};var _0x5985d4={};var _0x284e13={'count':0x0,'rows':[]};return db[_0x4122('0x40')][_0x4122('0x69')]({'where':{'id':_0x516bdf[_0x4122('0x55')]['id']}})['then'](handleEntityNotFound(_0x4378a1,null))[_0x4122('0x31')](function(_0x32facc){if(_0x32facc){_0x5985d4['model']=_[_0x4122('0x56')](db[_0x4122('0x70')]['rawAttributes']);_0x5985d4['query']=_['keys'](_0x516bdf['query']);_0x5985d4[_0x4122('0x4c')]=_[_0x4122('0x44')](_0x5985d4['model'],_0x5985d4[_0x4122('0x43')]);_0x1e3916[_0x4122('0x45')]=_[_0x4122('0x44')](_0x5985d4[_0x4122('0x42')],qs['fields'](_0x516bdf[_0x4122('0x43')][_0x4122('0x46')]));_0x1e3916[_0x4122('0x45')]=_0x1e3916[_0x4122('0x45')][_0x4122('0x47')]?_0x1e3916['attributes']:_0x5985d4['model'];if(!_0x516bdf[_0x4122('0x43')][_0x4122('0x6a')](_0x4122('0x48'))){_0x1e3916[_0x4122('0x2b')]=qs[_0x4122('0x2b')](_0x516bdf[_0x4122('0x43')]['limit']);_0x1e3916['offset']=qs[_0x4122('0x28')](_0x516bdf[_0x4122('0x43')][_0x4122('0x28')]);}_0x1e3916['order']=qs[_0x4122('0x4a')](_0x516bdf['query'][_0x4122('0x4a')]);_0x1e3916[_0x4122('0x4b')]=qs['filters'](_['pick'](_0x516bdf['query'],_0x5985d4[_0x4122('0x4c')]));_0x1e3916['where'][_0x4122('0x6b')]=_0x32facc['id'];if(_0x516bdf[_0x4122('0x43')][_0x4122('0x37')]){_0x1e3916[_0x4122('0x4b')]=_['merge'](_0x1e3916['where'],{'$or':_[_0x4122('0x38')](_0x1e3916[_0x4122('0x45')],function(_0x39f530){var _0x3fa785={};_0x3fa785[_0x39f530]={'$like':'%'+_0x516bdf[_0x4122('0x43')][_0x4122('0x37')]+'%'};return _0x3fa785;})});}_0x1e3916=_[_0x4122('0x58')]({},_0x1e3916,_0x516bdf[_0x4122('0x4f')]);return db['CmHopperFinal'][_0x4122('0x2a')]({'where':_0x1e3916['where']})[_0x4122('0x31')](function(_0x3da241){_0x284e13['count']=_0x3da241;if(_0x516bdf[_0x4122('0x43')][_0x4122('0x57')]){_0x1e3916[_0x4122('0x50')]=[{'all':!![]}];}return db[_0x4122('0x70')][_0x4122('0x51')](_0x1e3916);})[_0x4122('0x31')](function(_0x533b83){_0x284e13['rows']=_0x533b83;return _0x284e13;});}})[_0x4122('0x31')](respondWithFilteredResult(_0x4378a1,_0x1e3916))[_0x4122('0x53')](handleError(_0x4378a1,null));};exports[_0x4122('0x71')]=function(_0x27da99,_0x310b42,_0x47b721){var _0x31bd76={'raw':!![],'where':{}};var _0x3bbcf3={};var _0x86043b={'count':0x0,'rows':[]};return db[_0x4122('0x40')][_0x4122('0x69')]({'where':{'id':_0x27da99[_0x4122('0x55')]['id']}})['then'](handleEntityNotFound(_0x310b42,null))['then'](function(_0x35b412){if(_0x35b412){_0x3bbcf3['model']=_[_0x4122('0x56')](db[_0x4122('0x72')][_0x4122('0x63')]);_0x3bbcf3[_0x4122('0x43')]=_['keys'](_0x27da99[_0x4122('0x43')]);_0x3bbcf3[_0x4122('0x4c')]=_[_0x4122('0x44')](_0x3bbcf3['model'],_0x3bbcf3[_0x4122('0x43')]);_0x31bd76[_0x4122('0x45')]=_[_0x4122('0x44')](_0x3bbcf3[_0x4122('0x42')],qs[_0x4122('0x46')](_0x27da99['query'][_0x4122('0x46')]));_0x31bd76['attributes']=_0x31bd76[_0x4122('0x45')][_0x4122('0x47')]?_0x31bd76[_0x4122('0x45')]:_0x3bbcf3[_0x4122('0x42')];if(!_0x27da99[_0x4122('0x43')][_0x4122('0x6a')]('nolimit')){_0x31bd76[_0x4122('0x2b')]=qs[_0x4122('0x2b')](_0x27da99[_0x4122('0x43')][_0x4122('0x2b')]);_0x31bd76[_0x4122('0x28')]=qs[_0x4122('0x28')](_0x27da99['query'][_0x4122('0x28')]);}_0x31bd76[_0x4122('0x49')]=qs[_0x4122('0x4a')](_0x27da99[_0x4122('0x43')]['sort']);_0x31bd76['where']=qs['filters'](_['pick'](_0x27da99['query'],_0x3bbcf3[_0x4122('0x4c')]));_0x31bd76[_0x4122('0x4b')][_0x4122('0x6b')]=_0x35b412['id'];if(_0x27da99[_0x4122('0x43')]['filter']){_0x31bd76[_0x4122('0x4b')]=_[_0x4122('0x58')](_0x31bd76['where'],{'$or':_['map'](_0x31bd76[_0x4122('0x45')],function(_0x2018e1){var _0x27a9f0={};_0x27a9f0[_0x2018e1]={'$like':'%'+_0x27da99[_0x4122('0x43')][_0x4122('0x37')]+'%'};return _0x27a9f0;})});}_0x31bd76=_[_0x4122('0x58')]({},_0x31bd76,_0x27da99[_0x4122('0x4f')]);return db[_0x4122('0x72')][_0x4122('0x2a')]({'where':_0x31bd76[_0x4122('0x4b')]})[_0x4122('0x31')](function(_0xede380){_0x86043b['count']=_0xede380;if(_0x27da99[_0x4122('0x43')][_0x4122('0x57')]){_0x31bd76['include']=[{'all':!![]}];}return db[_0x4122('0x72')]['findAll'](_0x31bd76);})[_0x4122('0x31')](function(_0x4c23cd){_0x86043b[_0x4122('0x52')]=_0x4c23cd;return _0x86043b;});}})[_0x4122('0x31')](respondWithFilteredResult(_0x310b42,_0x31bd76))[_0x4122('0x53')](handleError(_0x310b42,null));};exports[_0x4122('0x73')]=function(_0x300238,_0x3aeb61,_0x4fa1e6){var _0x1db488={};var _0x10dbf7={};var _0x40b12f;var _0x177cd0;return db[_0x4122('0x40')]['findOne']({'where':{'id':_0x300238[_0x4122('0x55')]['id']}})[_0x4122('0x31')](handleEntityNotFound(_0x3aeb61,null))['then'](function(_0x392669){if(_0x392669){_0x40b12f=_0x392669;_0x10dbf7[_0x4122('0x42')]=_[_0x4122('0x56')](db['Team'][_0x4122('0x63')]);_0x10dbf7['query']=_[_0x4122('0x56')](_0x300238[_0x4122('0x43')]);_0x10dbf7['filters']=_[_0x4122('0x44')](_0x10dbf7[_0x4122('0x42')],_0x10dbf7[_0x4122('0x43')]);_0x1db488['attributes']=_[_0x4122('0x44')](_0x10dbf7[_0x4122('0x42')],qs[_0x4122('0x46')](_0x300238['query'][_0x4122('0x46')]));_0x1db488[_0x4122('0x45')]=_0x1db488[_0x4122('0x45')]['length']?_0x1db488[_0x4122('0x45')]:_0x10dbf7['model'];_0x1db488[_0x4122('0x49')]=qs['sort'](_0x300238[_0x4122('0x43')][_0x4122('0x4a')]);_0x1db488[_0x4122('0x4b')]=qs['filters'](_[_0x4122('0x4d')](_0x300238[_0x4122('0x43')],_0x10dbf7[_0x4122('0x4c')]));if(_0x300238[_0x4122('0x43')][_0x4122('0x37')]){_0x1db488[_0x4122('0x4b')]=_['merge'](_0x1db488[_0x4122('0x4b')],{'$or':_['map'](_0x1db488[_0x4122('0x45')],function(_0x597016){var _0x4b26fe={};_0x4b26fe[_0x597016]={'$like':'%'+_0x300238[_0x4122('0x43')][_0x4122('0x37')]+'%'};return _0x4b26fe;})});}_0x1db488=_['merge']({},_0x1db488,_0x300238[_0x4122('0x4f')]);return _0x40b12f['getTeams'](_0x1db488);}})['then'](function(_0x527d95){if(_0x527d95){_0x177cd0=_0x527d95[_0x4122('0x47')];if(!_0x300238[_0x4122('0x43')][_0x4122('0x6a')](_0x4122('0x48'))){_0x1db488['limit']=qs[_0x4122('0x2b')](_0x300238[_0x4122('0x43')][_0x4122('0x2b')]);_0x1db488[_0x4122('0x28')]=qs[_0x4122('0x28')](_0x300238['query'][_0x4122('0x28')]);}return _0x40b12f[_0x4122('0x73')](_0x1db488);}})[_0x4122('0x31')](function(_0x365138){if(_0x365138){return _0x365138?{'count':_0x177cd0,'rows':_0x365138}:null;}})[_0x4122('0x31')](respondWithResult(_0x3aeb61,null))[_0x4122('0x53')](handleError(_0x3aeb61,null));};exports['addTeams']=function(_0x5e0434,_0x2018bf,_0x195897){var _0x3be86d=_0x5e0434['body']['teams'];var _0x15fe1f=_[_0x4122('0x38')](_0x3be86d,'id');return db[_0x4122('0x74')]['findAll']({'where':{'id':_0x15fe1f},'attributes':['id'],'include':[{'model':db[_0x4122('0x75')],'as':_0x4122('0x76'),'attributes':['id',_0x4122('0x3c'),_0x4122('0x77'),_0x4122('0x78'),_0x4122('0x79')],'raw':!![]}]})[_0x4122('0x31')](function(_0x2e8be4){if(_0x2e8be4){var _0x205d4a=_[_0x4122('0x7a')](_0x2e8be4,function(_0x400fe5){var _0x14fc8c=_0x400fe5[_0x4122('0x32')]({'plain':!![]});_0x14fc8c[_0x4122('0x76')]['forEach'](function(_0x15e3a6){_0x15e3a6[_0x4122('0x7b')]=_[_0x4122('0x59')](_0x3be86d,{'id':_0x14fc8c['id']})[_0x4122('0x7b')];});return _0x14fc8c['Agents'];});return db[_0x4122('0x40')][_0x4122('0x59')]({'where':{'id':_0x5e0434[_0x4122('0x55')]['id']}})[_0x4122('0x31')](function(_0x41488f){return db['sequelize'][_0x4122('0x7c')](function(_0x505444){return _0x41488f['addTeams'](_0x15fe1f,{'transaction':_0x505444})[_0x4122('0x31')](function(){return BPromise[_0x4122('0x7d')](_0x3be86d,function(_0x23a826){return db[_0x4122('0x7e')][_0x4122('0x7f')]({'TeamId':_0x23a826['id'],'VoiceQueueId':_0x5e0434[_0x4122('0x55')]['id'],'penalty':_0x23a826[_0x4122('0x7b')]},{'transaction':_0x505444});});})[_0x4122('0x31')](function(){return BPromise[_0x4122('0x7d')](_0x205d4a,function(_0x4ced77){return db[_0x4122('0x80')]['findOrCreate']({'where':{'UserId':_0x4ced77['id'],'VoiceQueueId':_0x5e0434[_0x4122('0x55')]['id']},'defaults':{'penalty':_0x4ced77['penalty']},'transaction':_0x505444});});})[_0x4122('0x31')](function(){return BPromise['each'](_[_0x4122('0x37')](_0x205d4a,{'online':!![]}),function(_0xbf9ed6){return db[_0x4122('0x81')][_0x4122('0x7f')]({'membername':_0xbf9ed6['name'],'UserId':_0xbf9ed6['id'],'queue_name':_0x41488f[_0x4122('0x3c')],'VoiceQueueId':_0x41488f['id'],'interface':_[_0x4122('0x82')](_0xbf9ed6[_0x4122('0x79')])?util[_0x4122('0x83')]('SIP/%s',_0xbf9ed6['name']):_0xbf9ed6['interface'],'paused':_0xbf9ed6['voicePause']||![],'penalty':_0xbf9ed6[_0x4122('0x7b')]},{'transaction':_0x505444});});})[_0x4122('0x31')](function(){_0x205d4a[_0x4122('0x84')](function(_0x170512){socket[_0x4122('0x85')](_0x4122('0x86'),{'UserId':_0x170512['id'],'VoiceQueueId':_0x41488f['id']});});});});});}})[_0x4122('0x31')](respondWithStatusCode(_0x2018bf,null))['catch'](handleError(_0x2018bf,null));};exports['removeTeams']=function(_0x41e944,_0xa46f72,_0x54a01a){return db[_0x4122('0x74')][_0x4122('0x51')]({'where':{'id':_0x41e944[_0x4122('0x43')][_0x4122('0x87')]},'attributes':['id'],'include':[{'model':db[_0x4122('0x75')],'as':_0x4122('0x76'),'attributes':['id'],'raw':!![]}]})[_0x4122('0x31')](handleEntityNotFound(_0xa46f72,null))[_0x4122('0x31')](function(_0x1dd6ed){var _0x1a43c0=_[_0x4122('0x38')](_0x1dd6ed,'id');var _0x448ba2=[];var _0x35c26c=[];var _0x36491d=squel[_0x4122('0x88')]();_0x36491d[_0x4122('0x89')](_0x4122('0x8a'))['from'](_0x4122('0x8b'),'tq')['join'](_0x4122('0x8c'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x4122('0x4b')]('VoiceQueueId\x20=\x20?',_0x41e944['params']['id']);for(var _0x41ddd5=0x0;_0x41ddd5<_0x1dd6ed['length'];_0x41ddd5+=0x1){let _0x1785f7=_0x1dd6ed[_0x41ddd5];for(var _0x2ad70b=0x0;_0x2ad70b<_0x1785f7['Agents'][_0x4122('0x47')];_0x2ad70b+=0x1){let _0x59eb92=_0x1785f7[_0x4122('0x76')][_0x2ad70b];var _0x3fc080=_0x36491d[_0x4122('0x62')]();_0x3fc080[_0x4122('0x4b')]('ut.UserId\x20=\x20?',_0x59eb92['id']);_0x35c26c[_0x4122('0x8d')](db['sequelize'][_0x4122('0x43')](_0x3fc080[_0x4122('0x8e')](),{'type':db['sequelize'][_0x4122('0x8f')][_0x4122('0x90')]})[_0x4122('0x31')](function(_0x1a0d4){if(_0x1a0d4['length']===0x1){return _0x59eb92['id'];}else{var _0x1c6cf8=_['every'](_[_0x4122('0x38')](_0x1a0d4,_0x4122('0x91')),function(_0xb68fae){return _[_0x4122('0x3a')](_0x1a43c0,_0xb68fae);});if(_0x1c6cf8){return _0x59eb92['id'];}}}));}}return BPromise[_0x4122('0x92')](_0x35c26c)[_0x4122('0x31')](function(_0x23619b){_0x448ba2=_(_0x448ba2)[_0x4122('0x93')](_0x23619b)['compact']()[_0x4122('0x39')]();return db['VoiceQueue'][_0x4122('0x59')]({'where':{'id':_0x41e944[_0x4122('0x55')]['id']}})[_0x4122('0x31')](function(_0x4d0996){return db[_0x4122('0x94')][_0x4122('0x7c')](function(_0x4f0f95){return _0x4d0996[_0x4122('0x95')](_0x41e944[_0x4122('0x43')][_0x4122('0x87')],{'transaction':_0x4f0f95})[_0x4122('0x31')](function(){if(!_[_0x4122('0x96')](_0x448ba2)){return _0x4d0996[_0x4122('0x97')](_0x448ba2,{'transaction':_0x4f0f95})[_0x4122('0x31')](function(){return db[_0x4122('0x81')][_0x4122('0x30')]({'where':{'VoiceQueueId':_0x41e944[_0x4122('0x55')]['id'],'UserId':_0x448ba2},'transaction':_0x4f0f95});});}})[_0x4122('0x31')](function(){_0x448ba2[_0x4122('0x84')](function(_0x1be774){socket[_0x4122('0x85')](_0x4122('0x98'),{'UserId':_0x1be774,'VoiceQueueId':_0x4d0996['id']});});});});});});})[_0x4122('0x31')](respondWithStatusCode(_0xa46f72,null))[_0x4122('0x53')](handleError(_0xa46f72,null));};exports[_0x4122('0x99')]=function(_0x5acf3f,_0x215fe9,_0x27be43){var _0x200597,_0xe7faf1;return db[_0x4122('0x40')]['find']({'where':{'id':_0x5acf3f[_0x4122('0x55')]['id']}})[_0x4122('0x31')](handleEntityNotFound(_0x215fe9,null))[_0x4122('0x31')](function(_0x474e35){if(_0x474e35){_0xe7faf1=_0x474e35;return _0x474e35[_0x4122('0x99')](_0x5acf3f[_0x4122('0x5b')][_0x4122('0x87')],_[_0x4122('0x64')](_0x5acf3f[_0x4122('0x5b')],[_0x4122('0x87'),'id'])||{})[_0x4122('0x9a')](function(_0xe6257a){for(var _0x22b581=0x0;_0x22b581<_0x5acf3f[_0x4122('0x5b')][_0x4122('0x87')]['length'];_0x22b581+=0x1){socket[_0x4122('0x85')](_0x4122('0x86'),{'UserId':Number(_0x5acf3f[_0x4122('0x5b')][_0x4122('0x87')][_0x22b581]),'VoiceQueueId':Number(_0x5acf3f['params']['id'])});}return _0xe6257a;});}})['then'](function(_0x19f12f){_0x200597=_0x19f12f||[];if(_0xe7faf1){return db[_0x4122('0x75')]['findAll']({'where':{'id':_0x5acf3f['body'][_0x4122('0x87')]},'attributes':['id',_0x4122('0x3c'),_0x4122('0x77'),_0x4122('0x78'),_0x4122('0x79')],'raw':!![]});}})[_0x4122('0x31')](function(_0x3babbf){if(!_[_0x4122('0x96')](_0x3babbf)){var _0xf75ff7=[];for(var _0x23fa85=0x0;_0x23fa85<_0x3babbf['length'];_0x23fa85++){if(_0x3babbf[_0x23fa85][_0x4122('0x77')]){_0xf75ff7[_0x4122('0x8d')](db['UserVoiceQueueRt']['upsert']({'membername':_0x3babbf[_0x23fa85][_0x4122('0x3c')],'UserId':_0x3babbf[_0x23fa85]['id'],'queue_name':_0xe7faf1[_0x4122('0x3c')],'VoiceQueueId':_0xe7faf1['id'],'interface':_[_0x4122('0x82')](_0x3babbf[_0x23fa85][_0x4122('0x79')])?util[_0x4122('0x83')](_0x4122('0x9b'),_0x3babbf[_0x23fa85][_0x4122('0x3c')]):_0x3babbf[_0x23fa85][_0x4122('0x79')],'paused':_0x3babbf[_0x23fa85][_0x4122('0x78')]||![],'penalty':_0x5acf3f['body']['penalty']||0x0}));}}return BPromise[_0x4122('0x92')](_0xf75ff7);}})[_0x4122('0x31')](function(){return _0x200597;})[_0x4122('0x31')](respondWithResult(_0x215fe9,null))['catch'](handleError(_0x215fe9,null));};exports[_0x4122('0x97')]=function(_0x4e373d,_0x23b832,_0x1f64e2){return db[_0x4122('0x40')][_0x4122('0x59')]({'where':{'id':_0x4e373d[_0x4122('0x55')]['id']}})['then'](handleEntityNotFound(_0x23b832,null))[_0x4122('0x31')](function(_0x558518){if(_0x558518){return _0x558518[_0x4122('0x97')](_0x4e373d[_0x4122('0x43')][_0x4122('0x87')])['then'](function(){if(_[_0x4122('0x9c')](_0x4e373d[_0x4122('0x43')]['ids'])){for(var _0x37a2f8=0x0;_0x37a2f8<_0x4e373d[_0x4122('0x43')][_0x4122('0x87')][_0x4122('0x47')];_0x37a2f8+=0x1){socket[_0x4122('0x85')](_0x4122('0x98'),{'UserId':Number(_0x4e373d[_0x4122('0x43')][_0x4122('0x87')][_0x37a2f8]),'VoiceQueueId':Number(_0x4e373d['params']['id'])});}}else{socket[_0x4122('0x85')]('userVoiceQueue:remove',{'UserId':Number(_0x4e373d[_0x4122('0x43')][_0x4122('0x87')]),'VoiceQueueId':Number(_0x4e373d['params']['id'])});}});}})[_0x4122('0x31')](function(_0x21d533){return db[_0x4122('0x81')][_0x4122('0x30')]({'where':{'VoiceQueueId':_0x4e373d['params']['id'],'UserId':_0x4e373d[_0x4122('0x43')][_0x4122('0x87')]}})['then'](function(){return _0x21d533;});})['then'](respondWithStatusCode(_0x23b832,null))['catch'](handleError(_0x23b832,null));};exports[_0x4122('0x9d')]=function(_0x2d74f1,_0x44c511,_0x2dcfb1){var _0x1c75c4={};var _0x3c32f3={};var _0x25ee24;var _0x18c7c7;return db[_0x4122('0x40')]['findOne']({'where':{'id':_0x2d74f1[_0x4122('0x55')]['id']}})['then'](handleEntityNotFound(_0x44c511,null))[_0x4122('0x31')](function(_0x45b7c9){if(_0x45b7c9){_0x25ee24=_0x45b7c9;_0x3c32f3[_0x4122('0x42')]=_[_0x4122('0x56')](db[_0x4122('0x75')][_0x4122('0x63')]);_0x3c32f3[_0x4122('0x43')]=_['keys'](_0x2d74f1[_0x4122('0x43')]);_0x3c32f3['filters']=_['intersection'](_0x3c32f3[_0x4122('0x42')],_0x3c32f3[_0x4122('0x43')]);_0x1c75c4[_0x4122('0x45')]=_[_0x4122('0x44')](_0x3c32f3[_0x4122('0x42')],qs[_0x4122('0x46')](_0x2d74f1[_0x4122('0x43')][_0x4122('0x46')]));_0x1c75c4['attributes']=_0x1c75c4[_0x4122('0x45')][_0x4122('0x47')]?_0x1c75c4['attributes']:_0x3c32f3[_0x4122('0x42')];_0x1c75c4[_0x4122('0x49')]=qs[_0x4122('0x4a')](_0x2d74f1['query'][_0x4122('0x4a')]);_0x1c75c4[_0x4122('0x4b')]=qs[_0x4122('0x4c')](_['pick'](_0x2d74f1[_0x4122('0x43')],_0x3c32f3[_0x4122('0x4c')]));if(_0x2d74f1[_0x4122('0x43')][_0x4122('0x37')]){_0x1c75c4[_0x4122('0x4b')]=_['merge'](_0x1c75c4['where'],{'$or':_['map'](_0x1c75c4[_0x4122('0x45')],function(_0x1888b1){var _0x1d87aa={};_0x1d87aa[_0x1888b1]={'$like':'%'+_0x2d74f1[_0x4122('0x43')]['filter']+'%'};return _0x1d87aa;})});}_0x1c75c4=_[_0x4122('0x58')]({},_0x1c75c4,_0x2d74f1['options']);return _0x25ee24['getAgents'](_0x1c75c4);}})[_0x4122('0x31')](function(_0x4b77e9){if(_0x4b77e9){_0x18c7c7=_0x4b77e9[_0x4122('0x47')];if(!_0x2d74f1['query'][_0x4122('0x6a')](_0x4122('0x48'))){_0x1c75c4[_0x4122('0x2b')]=qs[_0x4122('0x2b')](_0x2d74f1['query'][_0x4122('0x2b')]);_0x1c75c4[_0x4122('0x28')]=qs[_0x4122('0x28')](_0x2d74f1[_0x4122('0x43')][_0x4122('0x28')]);}return _0x25ee24[_0x4122('0x9d')](_0x1c75c4);}})[_0x4122('0x31')](function(_0x582f73){if(_0x582f73){return _0x582f73?{'count':_0x18c7c7,'rows':_0x582f73}:null;}})[_0x4122('0x31')](respondWithResult(_0x44c511,null))[_0x4122('0x53')](handleError(_0x44c511,null));};exports[_0x4122('0x9e')]=function(_0x7c02d6,_0x4dfc11,_0x3a2d2f){var _0x5a94fa={};var _0x397dba={};var _0x11aacb;var _0x59b82e;return db[_0x4122('0x40')]['findOne']({'where':{'id':_0x7c02d6['params']['id']}})[_0x4122('0x31')](handleEntityNotFound(_0x4dfc11,null))['then'](function(_0x27a3fe){if(_0x27a3fe){_0x11aacb=_0x27a3fe;_0x397dba[_0x4122('0x42')]=_[_0x4122('0x56')](db[_0x4122('0x81')][_0x4122('0x63')]);_0x397dba['query']=_[_0x4122('0x56')](_0x7c02d6[_0x4122('0x43')]);_0x397dba[_0x4122('0x4c')]=_['intersection'](_0x397dba[_0x4122('0x42')],_0x397dba[_0x4122('0x43')]);_0x5a94fa['attributes']=_[_0x4122('0x44')](_0x397dba['model'],qs[_0x4122('0x46')](_0x7c02d6['query'][_0x4122('0x46')]));_0x5a94fa['attributes']=_0x5a94fa['attributes'][_0x4122('0x47')]?_0x5a94fa['attributes']:_0x397dba[_0x4122('0x42')];_0x5a94fa[_0x4122('0x49')]=qs['sort'](_0x7c02d6['query'][_0x4122('0x4a')]);_0x5a94fa[_0x4122('0x4b')]=qs[_0x4122('0x4c')](_[_0x4122('0x4d')](_0x7c02d6[_0x4122('0x43')],_0x397dba[_0x4122('0x4c')]));if(_0x7c02d6[_0x4122('0x43')]['filter']){_0x5a94fa['where']=_[_0x4122('0x58')](_0x5a94fa[_0x4122('0x4b')],{'$or':_[_0x4122('0x38')](_0x5a94fa[_0x4122('0x45')],function(_0x38a09d){var _0xb6d1c6={};_0xb6d1c6[_0x38a09d]={'$like':'%'+_0x7c02d6[_0x4122('0x43')]['filter']+'%'};return _0xb6d1c6;})});}_0x5a94fa=_[_0x4122('0x58')]({},_0x5a94fa,_0x7c02d6[_0x4122('0x4f')]);return _0x11aacb[_0x4122('0x9e')](_0x5a94fa);}})['then'](function(_0x4fb7fc){if(_0x4fb7fc){_0x59b82e=_0x4fb7fc[_0x4122('0x47')];if(!_0x7c02d6['query'][_0x4122('0x6a')](_0x4122('0x48'))){_0x5a94fa[_0x4122('0x2b')]=qs[_0x4122('0x2b')](_0x7c02d6[_0x4122('0x43')]['limit']);_0x5a94fa[_0x4122('0x28')]=qs[_0x4122('0x28')](_0x7c02d6[_0x4122('0x43')][_0x4122('0x28')]);}return _0x11aacb[_0x4122('0x9e')](_0x5a94fa);}})[_0x4122('0x31')](function(_0x1097ff){return _0x1097ff?{'count':_0x59b82e,'rows':_0x1097ff}:null;})[_0x4122('0x31')](respondWithResult(_0x4dfc11,null))['catch'](handleError(_0x4dfc11,null));};exports[_0x4122('0x9f')]=function(_0x5a9ecb,_0x151072,_0x288d86){var _0x309269={};var _0x16a85e={};var _0x484cae;var _0x356389;return db[_0x4122('0x40')][_0x4122('0x69')]({'where':{'id':_0x5a9ecb[_0x4122('0x55')]['id']}})[_0x4122('0x31')](handleEntityNotFound(_0x151072,null))[_0x4122('0x31')](function(_0x6f5a12){if(_0x6f5a12){_0x484cae=_0x6f5a12;_0x16a85e[_0x4122('0x42')]=_[_0x4122('0x56')](db['CmList']['rawAttributes']);_0x16a85e[_0x4122('0x43')]=_['keys'](_0x5a9ecb['query']);_0x16a85e['filters']=_[_0x4122('0x44')](_0x16a85e[_0x4122('0x42')],_0x16a85e['query']);_0x309269[_0x4122('0x45')]=_[_0x4122('0x44')](_0x16a85e[_0x4122('0x42')],qs[_0x4122('0x46')](_0x5a9ecb[_0x4122('0x43')][_0x4122('0x46')]));_0x309269[_0x4122('0x45')]=_0x309269['attributes'][_0x4122('0x47')]?_0x309269[_0x4122('0x45')]:_0x16a85e[_0x4122('0x42')];_0x309269[_0x4122('0x49')]=qs[_0x4122('0x4a')](_0x5a9ecb[_0x4122('0x43')]['sort']);_0x309269['where']=qs[_0x4122('0x4c')](_[_0x4122('0x4d')](_0x5a9ecb[_0x4122('0x43')],_0x16a85e[_0x4122('0x4c')]));if(_0x5a9ecb['query']['filter']){_0x309269[_0x4122('0x4b')]=_['merge'](_0x309269[_0x4122('0x4b')],{'$or':_['map'](_0x309269[_0x4122('0x45')],function(_0x549d6b){var _0x427899={};_0x427899[_0x549d6b]={'$like':'%'+_0x5a9ecb[_0x4122('0x43')][_0x4122('0x37')]+'%'};return _0x427899;})});}_0x309269=_[_0x4122('0x58')]({},_0x309269,_0x5a9ecb[_0x4122('0x4f')]);return _0x484cae[_0x4122('0x9f')](_0x309269);}})[_0x4122('0x31')](function(_0xdd2ff7){if(_0xdd2ff7){_0x356389=_0xdd2ff7[_0x4122('0x47')];if(!_0x5a9ecb[_0x4122('0x43')][_0x4122('0x6a')](_0x4122('0x48'))){_0x309269['limit']=qs[_0x4122('0x2b')](_0x5a9ecb[_0x4122('0x43')][_0x4122('0x2b')]);_0x309269[_0x4122('0x28')]=qs['offset'](_0x5a9ecb[_0x4122('0x43')][_0x4122('0x28')]);}return _0x484cae[_0x4122('0x9f')](_0x309269);}})['then'](function(_0x3141bb){if(_0x3141bb){return _0x3141bb?{'count':_0x356389,'rows':_0x3141bb}:null;}})[_0x4122('0x31')](respondWithResult(_0x151072,null))[_0x4122('0x53')](handleError(_0x151072,null));};exports['addLists']=function(_0x270222,_0x1f27d7,_0x30240f){var _0x1fcc9a=moment()[_0x4122('0x83')]('YYYY-MM-DD\x20HH:mm:ss');var _0x32f0c5,_0x567c35;return db[_0x4122('0x40')]['find']({'where':{'id':_0x270222['params']['id']}})['then'](handleEntityNotFound(_0x1f27d7,null))[_0x4122('0x31')](function(_0x123eac){if(_0x123eac){_0x567c35=_0x123eac;return _0x123eac[_0x4122('0xa0')](_0x270222[_0x4122('0x5b')]['ids'],_['omit'](_0x270222[_0x4122('0x5b')],[_0x4122('0x87'),'id'])||{});}return null;})[_0x4122('0x9a')](function(_0x3a1252){var _0x15cdee;_0x32f0c5=_0x3a1252||[];var _0x27d33c=[];if(_0x3a1252){for(var _0x417326=0x0;_0x417326<_0x3a1252[_0x4122('0x47')];_0x417326+=0x1){var _0x254bdc=_0x3a1252[_0x417326][_0x4122('0x32')]({'plain':!![]});_0x567c35[_0x4122('0xa1')]=_0x270222[_0x4122('0x5b')][_0x4122('0xa1')]?_0x270222['body'][_0x4122('0xa1')]:_0x567c35[_0x4122('0xa1')];switch(_0x567c35[_0x4122('0xa1')]){case'always':_0x15cdee=squel[_0x4122('0xa2')]()['into'](_0x4122('0xa3'))[_0x4122('0xa4')](['phone',_0x4122('0xa5'),_0x4122('0xa6'),_0x4122('0xa7'),_0x4122('0x6b'),_0x4122('0x65'),_0x4122('0x66')],squel[_0x4122('0x88')]()[_0x4122('0x89')](_0x4122('0xa8'),'phone')[_0x4122('0x89')]('\x27'+_0x1fcc9a+'\x27',_0x4122('0xa5'))[_0x4122('0x89')]('id','ContactId')[_0x4122('0x89')](_0x254bdc[_0x4122('0xa9')][_0x4122('0x8e')](),_0x4122('0xa7'))[_0x4122('0x89')](_0x270222['params']['id'][_0x4122('0x8e')](),_0x4122('0x6b'))['field']('\x27'+_0x1fcc9a+'\x27',_0x4122('0x65'))[_0x4122('0x89')]('\x27'+_0x1fcc9a+'\x27','updatedAt')['from'](_0x4122('0xaa'))[_0x4122('0x4b')](_0x4122('0xab'))['where'](_0x4122('0xac'),_0x254bdc['CmListId'][_0x4122('0x8e')]())['where'](_0x4122('0xad'))[_0x4122('0x4b')](_0x4122('0xae'),squel[_0x4122('0x88')]()['field'](_0x4122('0xaf'))[_0x4122('0xb0')]('cm_hopper_final')[_0x4122('0x4b')](_0x4122('0xb1'),_0x270222[_0x4122('0x55')]['id'][_0x4122('0x8e')]()))[_0x4122('0x4b')](_0x4122('0xae'),squel[_0x4122('0x88')]()[_0x4122('0x89')](_0x4122('0xb2'))[_0x4122('0xb0')](_0x4122('0xa3'))[_0x4122('0x4b')](_0x4122('0xb1'),_0x270222[_0x4122('0x55')]['id'][_0x4122('0x8e')]())))[_0x4122('0x8e')]();break;case'onlyIfOpen':_0x15cdee=squel[_0x4122('0xa2')]()[_0x4122('0xb3')](_0x4122('0xa3'))[_0x4122('0xa4')]([_0x4122('0xa8'),_0x4122('0xa5'),_0x4122('0xa6'),'ListId','VoiceQueueId','createdAt',_0x4122('0x66')],squel[_0x4122('0x88')]()[_0x4122('0x89')](_0x4122('0xa8'),_0x4122('0xa8'))[_0x4122('0x89')]('\x27'+_0x1fcc9a+'\x27',_0x4122('0xa5'))['field']('id',_0x4122('0xa6'))[_0x4122('0x89')](_0x254bdc[_0x4122('0xa9')]['toString'](),_0x4122('0xa7'))['field'](_0x270222['params']['id'][_0x4122('0x8e')](),_0x4122('0x6b'))['field']('\x27'+_0x1fcc9a+'\x27',_0x4122('0x65'))[_0x4122('0x89')]('\x27'+_0x1fcc9a+'\x27','updatedAt')['from'](_0x4122('0xaa'))[_0x4122('0x4b')](_0x4122('0xab'))['where'](_0x4122('0xac'),_0x254bdc['CmListId'][_0x4122('0x8e')]())['where'](_0x4122('0xad'))[_0x4122('0x4b')](_0x4122('0xae'),squel[_0x4122('0x88')]()[_0x4122('0x89')](_0x4122('0xb2'))[_0x4122('0xb0')](_0x4122('0xa3'))['where'](_0x4122('0xb1'),_0x270222[_0x4122('0x55')]['id'][_0x4122('0x8e')]())))['toString']();break;default:_0x15cdee=squel[_0x4122('0xa2')]()['into'](_0x4122('0xa3'))[_0x4122('0xa4')]([_0x4122('0xa8'),_0x4122('0xa5'),_0x4122('0xa6'),_0x4122('0xa7'),_0x4122('0x6b'),_0x4122('0x65'),_0x4122('0x66')],squel[_0x4122('0x88')]()['field'](_0x4122('0xa8'),_0x4122('0xa8'))[_0x4122('0x89')]('\x27'+_0x1fcc9a+'\x27',_0x4122('0xa5'))[_0x4122('0x89')]('id',_0x4122('0xa6'))[_0x4122('0x89')](_0x254bdc[_0x4122('0xa9')][_0x4122('0x8e')](),'ListId')[_0x4122('0x89')](_0x270222['params']['id'][_0x4122('0x8e')](),'VoiceQueueId')['field']('\x27'+_0x1fcc9a+'\x27',_0x4122('0x65'))[_0x4122('0x89')]('\x27'+_0x1fcc9a+'\x27','updatedAt')[_0x4122('0xb0')](_0x4122('0xaa'))[_0x4122('0x4b')](_0x4122('0xab'))[_0x4122('0x4b')]('ListId\x20=\x20?',_0x254bdc[_0x4122('0xa9')]['toString']())[_0x4122('0x4b')](_0x4122('0xad')))[_0x4122('0x8e')]();}_0x27d33c[_0x4122('0x8d')](db['sequelize'][_0x4122('0x43')](_0x15cdee));}return BPromise[_0x4122('0x92')](_0x27d33c);}})[_0x4122('0x31')](function(){var _0x53c646=[];var _0x10daa2=squel[_0x4122('0xa2')]()['into']('cm_hopper_additional_phones')[_0x4122('0xa4')](['CmHopperId',_0x4122('0xa8'),_0x4122('0xb4'),_0x4122('0x65'),'updatedAt'],squel[_0x4122('0x88')]()[_0x4122('0x89')](_0x4122('0xb5'))['field'](_0x4122('0xb6'))[_0x4122('0x89')](_0x4122('0xb7'))['field']('\x27'+_0x1fcc9a+'\x27',_0x4122('0x65'))[_0x4122('0x89')]('\x27'+_0x1fcc9a+'\x27',_0x4122('0x66'))[_0x4122('0xb0')](_0x4122('0xb8'),'ci')['join'](_0x4122('0xa3'),'h',_0x4122('0xb9'))['where']('h.scheduledat=?',_0x1fcc9a)[_0x4122('0x4b')](_0x4122('0xba'),'PHONE'))[_0x4122('0x8e')]();_0x53c646[_0x4122('0x8d')](db[_0x4122('0x94')]['query'](_0x10daa2));return BPromise['all'](_0x53c646);})[_0x4122('0x31')](function(){return _0x32f0c5;})['then'](respondWithResult(_0x1f27d7,null))[_0x4122('0x53')](handleError(_0x1f27d7,null));};exports[_0x4122('0xbb')]=function(_0x170e48,_0x33ff6d,_0x5298f2){return db['VoiceQueue'][_0x4122('0x59')]({'where':{'id':_0x170e48[_0x4122('0x55')]['id']}})[_0x4122('0x31')](handleEntityNotFound(_0x33ff6d,null))[_0x4122('0x31')](function(_0x45c8a2){if(_0x45c8a2){return _0x45c8a2[_0x4122('0xbb')](_0x170e48[_0x4122('0x43')][_0x4122('0x87')]);}})[_0x4122('0x31')](function(_0x27425e){if(_0x27425e){return db[_0x4122('0x6c')][_0x4122('0x30')]({'where':{'ListId':_0x170e48['query'][_0x4122('0x87')],'VoiceQueueId':_0x170e48['params']['id']}})[_0x4122('0x31')](function(){return _0x27425e;});}})[_0x4122('0x31')](respondWithStatusCode(_0x33ff6d,null))[_0x4122('0x53')](handleError(_0x33ff6d,null));};exports['getBlackLists']=function(_0x26bb71,_0x10e05e,_0x363d31){var _0x4b5c52={};var _0x46f67c={};var _0x34167c;var _0x4a82ba;return db['VoiceQueue'][_0x4122('0x69')]({'where':{'id':_0x26bb71[_0x4122('0x55')]['id']}})['then'](handleEntityNotFound(_0x10e05e,null))[_0x4122('0x31')](function(_0x269e19){if(_0x269e19){_0x34167c=_0x269e19;_0x46f67c[_0x4122('0x42')]=_[_0x4122('0x56')](db[_0x4122('0xbc')][_0x4122('0x63')]);_0x46f67c['query']=_[_0x4122('0x56')](_0x26bb71[_0x4122('0x43')]);_0x46f67c[_0x4122('0x4c')]=_[_0x4122('0x44')](_0x46f67c[_0x4122('0x42')],_0x46f67c['query']);_0x4b5c52[_0x4122('0x45')]=_[_0x4122('0x44')](_0x46f67c[_0x4122('0x42')],qs[_0x4122('0x46')](_0x26bb71[_0x4122('0x43')][_0x4122('0x46')]));_0x4b5c52[_0x4122('0x45')]=_0x4b5c52[_0x4122('0x45')][_0x4122('0x47')]?_0x4b5c52[_0x4122('0x45')]:_0x46f67c[_0x4122('0x42')];_0x4b5c52[_0x4122('0x49')]=qs[_0x4122('0x4a')](_0x26bb71[_0x4122('0x43')][_0x4122('0x4a')]);_0x4b5c52[_0x4122('0x4b')]=qs[_0x4122('0x4c')](_[_0x4122('0x4d')](_0x26bb71[_0x4122('0x43')],_0x46f67c[_0x4122('0x4c')]));if(_0x26bb71[_0x4122('0x43')][_0x4122('0x37')]){_0x4b5c52['where']=_[_0x4122('0x58')](_0x4b5c52[_0x4122('0x4b')],{'$or':_[_0x4122('0x38')](_0x4b5c52[_0x4122('0x45')],function(_0x1393f6){var _0x31f27f={};_0x31f27f[_0x1393f6]={'$like':'%'+_0x26bb71[_0x4122('0x43')][_0x4122('0x37')]+'%'};return _0x31f27f;})});}_0x4b5c52=_[_0x4122('0x58')]({},_0x4b5c52,_0x26bb71[_0x4122('0x4f')]);return _0x34167c[_0x4122('0xbd')](_0x4b5c52);}})[_0x4122('0x31')](function(_0x133716){if(_0x133716){_0x4a82ba=_0x133716[_0x4122('0x47')];if(!_0x26bb71[_0x4122('0x43')][_0x4122('0x6a')]('nolimit')){_0x4b5c52[_0x4122('0x2b')]=qs[_0x4122('0x2b')](_0x26bb71[_0x4122('0x43')]['limit']);_0x4b5c52[_0x4122('0x28')]=qs[_0x4122('0x28')](_0x26bb71['query'][_0x4122('0x28')]);}return _0x34167c[_0x4122('0xbd')](_0x4b5c52);}})['then'](function(_0x2b7acb){if(_0x2b7acb){return _0x2b7acb?{'count':_0x4a82ba,'rows':_0x2b7acb}:null;}})[_0x4122('0x31')](respondWithResult(_0x10e05e,null))['catch'](handleError(_0x10e05e,null));};exports['addBlackLists']=function(_0x4b6827,_0x143836,_0x3b49f2){var _0x503f8b,_0x1567ca;return db['VoiceQueue']['find']({'where':{'id':_0x4b6827[_0x4122('0x55')]['id']}})[_0x4122('0x31')](handleEntityNotFound(_0x143836,null))[_0x4122('0x31')](function(_0x2a7818){if(_0x2a7818){_0x1567ca=_0x2a7818;return _0x2a7818[_0x4122('0xbe')](_0x4b6827[_0x4122('0x5b')][_0x4122('0x87')],_[_0x4122('0x64')](_0x4b6827[_0x4122('0x5b')],[_0x4122('0x87'),'id'])||{});}return null;})[_0x4122('0x9a')](function(_0x2bf1be){var _0x42250f;_0x503f8b=_0x2bf1be||[];var _0x4c77f6=[];if(_0x2bf1be){for(var _0xcf63f0=0x0;_0xcf63f0<_0x2bf1be[_0x4122('0x47')];_0xcf63f0+=0x1){var _0x34ae13=_0x2bf1be[_0xcf63f0][_0x4122('0x32')]({'plain':!![]});_0x42250f=squel[_0x4122('0xa2')]()[_0x4122('0xb3')](_0x4122('0xbf'))[_0x4122('0xa4')]([_0x4122('0xa8'),'ContactId',_0x4122('0xa7'),_0x4122('0x6b'),'createdAt',_0x4122('0x66')],squel[_0x4122('0x88')]()[_0x4122('0x89')](_0x4122('0xa8'),'phone')[_0x4122('0x89')]('id',_0x4122('0xa6'))[_0x4122('0x89')](_0x34ae13[_0x4122('0xa9')][_0x4122('0x8e')](),_0x4122('0xa7'))['field'](_0x4b6827['params']['id'][_0x4122('0x8e')](),'VoiceQueueId')[_0x4122('0x89')](_0x4122('0xc0'),_0x4122('0x65'))['field'](_0x4122('0xc0'),'updatedAt')['from']('cm_contacts')['where'](_0x4122('0xab'))['where'](_0x4122('0xac'),_0x34ae13[_0x4122('0xa9')][_0x4122('0x8e')]())[_0x4122('0x4b')]('phone\x20IS\x20NOT\x20NULL'))[_0x4122('0x8e')]();_0x4c77f6[_0x4122('0x8d')](db[_0x4122('0x94')][_0x4122('0x43')](_0x42250f));}return BPromise['all'](_0x4c77f6);}})[_0x4122('0x31')](function(){return _0x503f8b;})['then'](respondWithResult(_0x143836,null))[_0x4122('0x53')](handleError(_0x143836,null));};exports[_0x4122('0xc1')]=function(_0xb9c0a7,_0x2b5531,_0x69c4f8){return db[_0x4122('0x40')][_0x4122('0x59')]({'where':{'id':_0xb9c0a7['params']['id']}})[_0x4122('0x31')](handleEntityNotFound(_0x2b5531,null))[_0x4122('0x31')](function(_0x248305){if(_0x248305){return _0x248305['removeBlackLists'](_0xb9c0a7[_0x4122('0x43')][_0x4122('0x87')]);}})[_0x4122('0x31')](function(_0x5aa375){if(_0x5aa375){return db['CmHopperBlack'][_0x4122('0x30')]({'where':{'ListId':_0xb9c0a7[_0x4122('0x43')][_0x4122('0x87')],'VoiceQueueId':_0xb9c0a7[_0x4122('0x55')]['id']}})[_0x4122('0x31')](function(){return _0x5aa375;});}})['then'](respondWithStatusCode(_0x2b5531,null))['catch'](handleError(_0x2b5531,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index b3b14cd..a5e9bb0 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 _0x800a=['hook','exports','events','../../mysqldb','VoiceQueue','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x3ad13a,_0xf6b08d){var _0xf40bc6=function(_0x160537){while(--_0x160537){_0x3ad13a['push'](_0x3ad13a['shift']());}};_0xf40bc6(++_0xf6b08d);}(_0x800a,0x188));var _0xa800=function(_0x4344dd,_0x938c32){_0x4344dd=_0x4344dd-0x0;var _0x5cc5ce=_0x800a[_0x4344dd];return _0x5cc5ce;};'use strict';var EventEmitter=require(_0xa800('0x0'));var VoiceQueue=require(_0xa800('0x1'))['db'][_0xa800('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xa800('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa800('0x4'),'afterDestroy':_0xa800('0x5')};function emitEvent(_0x22124a){return function(_0x1b575c,_0x5dbb51,_0x480eab){VoiceQueueEvents[_0xa800('0x6')](_0x22124a+':'+_0x1b575c['id'],_0x1b575c);VoiceQueueEvents[_0xa800('0x6')](_0x22124a,_0x1b575c);_0x480eab(null);};}for(var e in events){if(events[_0xa800('0x7')](e)){var event=events[e];VoiceQueue[_0xa800('0x8')](e,emitEvent(event));}}module[_0xa800('0x9')]=VoiceQueueEvents; \ No newline at end of file +var _0x229a=['events','../../mysqldb','VoiceQueue','save','update','remove','emit','hook','exports'];(function(_0x41d56b,_0x576329){var _0x8c4a8a=function(_0x5c366d){while(--_0x5c366d){_0x41d56b['push'](_0x41d56b['shift']());}};_0x8c4a8a(++_0x576329);}(_0x229a,0x1e6));var _0xa229=function(_0x1e0cce,_0x4e2913){_0x1e0cce=_0x1e0cce-0x0;var _0x2f2a85=_0x229a[_0x1e0cce];return _0x2f2a85;};'use strict';var EventEmitter=require(_0xa229('0x0'));var VoiceQueue=require(_0xa229('0x1'))['db'][_0xa229('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa229('0x3'),'afterUpdate':_0xa229('0x4'),'afterDestroy':_0xa229('0x5')};function emitEvent(_0x35aa63){return function(_0x373b9d,_0x37a4df,_0x2eee10){VoiceQueueEvents['emit'](_0x35aa63+':'+_0x373b9d['id'],_0x373b9d);VoiceQueueEvents[_0xa229('0x6')](_0x35aa63,_0x373b9d);_0x2eee10(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0xa229('0x7')](e,emitEvent(event));}}module[_0xa229('0x8')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index e750d95..d8868c9 100644 --- a/server/api/voiceQueue/voiceQueue.model.js +++ b/server/api/voiceQueue/voiceQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceQueue.attributes','exports','VoiceQueue','util'];(function(_0x3f4b6c,_0x574fbc){var _0x1f9822=function(_0x52acf7){while(--_0x52acf7){_0x3f4b6c['push'](_0x3f4b6c['shift']());}};_0x1f9822(++_0x574fbc);}(_0xedd9,0xfc));var _0x9edd=function(_0x5b1edc,_0xd5fa84){_0x5b1edc=_0x5b1edc-0x0;var _0xe44ac8=_0xedd9[_0x5b1edc];return _0xe44ac8;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e74=['exports','VoiceQueue','voice_queues','lodash','../../config/logger','api','moment','path','../../config/environment','./voiceQueue.attributes'];(function(_0x5aa20c,_0x28b6ca){var _0x5d0a3a=function(_0x4b6cc8){while(--_0x4b6cc8){_0x5aa20c['push'](_0x5aa20c['shift']());}};_0x5d0a3a(++_0x28b6ca);}(_0x3e74,0x175));var _0x43e7=function(_0x5bf7d9,_0x1321dd){_0x5bf7d9=_0x5bf7d9-0x0;var _0x115e47=_0x3e74[_0x5bf7d9];return _0x115e47;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index 94babc5..58efe1b 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 _0x07b2=['../../config/environment','redis','defaults','socket.io-emitter','./voiceQueue.socket','request','then','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','GetVoiceQueue','VoiceQueue','findAll','options','where','attributes','limit','include','map','model','ShowVoiceQueue','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x4ed520,_0x21be63){var _0x4415a6=function(_0x14b151){while(--_0x14b151){_0x4ed520['push'](_0x4ed520['shift']());}};_0x4415a6(++_0x21be63);}(_0x07b2,0x199));var _0x207b=function(_0x4c6bf4,_0x24966d){_0x4c6bf4=_0x4c6bf4-0x0;var _0x333a53=_0x07b2[_0x4c6bf4];return _0x333a53;};'use strict';var _=require(_0x207b('0x0'));var util=require(_0x207b('0x1'));var moment=require(_0x207b('0x2'));var BPromise=require(_0x207b('0x3'));var rs=require(_0x207b('0x4'));var fs=require('fs');var Redis=require(_0x207b('0x5'));var db=require(_0x207b('0x6'))['db'];var utils=require(_0x207b('0x7'));var logger=require('../../config/logger')(_0x207b('0x8'));var config=require(_0x207b('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x207b('0xa')]=_[_0x207b('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x207b('0xc'))(new Redis(config['redis']));require(_0x207b('0xd'))['register'](socket);function respondWithRpcPromise(_0x2e4241,_0x181844,_0x523aaa){return new BPromise(function(_0x37d693,_0x6d8d09){return client[_0x207b('0xe')](_0x2e4241,_0x523aaa)[_0x207b('0xf')](function(_0x49c75d){logger['info'](_0x207b('0x10'),_0x181844,_0x207b('0x11'));logger[_0x207b('0x12')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x181844,_0x207b('0x11'),JSON[_0x207b('0x13')](_0x49c75d));if(_0x49c75d[_0x207b('0x14')]){if(_0x49c75d[_0x207b('0x14')][_0x207b('0x15')]===0x1f4){logger[_0x207b('0x14')](_0x207b('0x10'),_0x181844,_0x49c75d['error'][_0x207b('0x16')]);return _0x6d8d09(_0x49c75d[_0x207b('0x14')][_0x207b('0x16')]);}logger[_0x207b('0x14')]('VoiceQueue,\x20%s,\x20%s',_0x181844,_0x49c75d['error'][_0x207b('0x16')]);return _0x37d693(_0x49c75d[_0x207b('0x14')]['message']);}else{logger[_0x207b('0x17')]('VoiceQueue,\x20%s,\x20%s',_0x181844,_0x207b('0x11'));_0x37d693(_0x49c75d[_0x207b('0x18')][_0x207b('0x16')]);}})[_0x207b('0x19')](function(_0x39183c){logger[_0x207b('0x14')](_0x207b('0x10'),_0x181844,_0x39183c);_0x6d8d09(_0x39183c);});});}exports[_0x207b('0x1a')]=function(_0x5f0e7c){var _0x39e210=this;return new Promise(function(_0x29250d,_0x180208){return db[_0x207b('0x1b')][_0x207b('0x1c')]({'raw':_0x5f0e7c['options']?_0x5f0e7c['options']['raw']===undefined?!![]:![]:!![],'where':_0x5f0e7c[_0x207b('0x1d')]?_0x5f0e7c[_0x207b('0x1d')][_0x207b('0x1e')]||null:null,'attributes':_0x5f0e7c['options']?_0x5f0e7c['options'][_0x207b('0x1f')]||null:null,'limit':_0x5f0e7c[_0x207b('0x1d')]?_0x5f0e7c['options'][_0x207b('0x20')]||null:null,'include':_0x5f0e7c[_0x207b('0x1d')]?_0x5f0e7c[_0x207b('0x1d')][_0x207b('0x21')]?_[_0x207b('0x22')](_0x5f0e7c[_0x207b('0x1d')][_0x207b('0x21')],function(_0x552b8c){return{'model':db[_0x552b8c[_0x207b('0x23')]],'as':_0x552b8c['as'],'attributes':_0x552b8c[_0x207b('0x1f')],'include':_0x552b8c[_0x207b('0x21')]?_['map'](_0x552b8c[_0x207b('0x21')],function(_0x5b2111){return{'model':db[_0x5b2111[_0x207b('0x23')]],'as':_0x5b2111['as'],'attributes':_0x5b2111[_0x207b('0x1f')],'include':_0x5b2111[_0x207b('0x21')]?_[_0x207b('0x22')](_0x5b2111[_0x207b('0x21')],function(_0x3a916d){return{'model':db[_0x3a916d[_0x207b('0x23')]],'as':_0x3a916d['as'],'attributes':_0x3a916d['attributes']};}):[]};}):[]};}):[]:[]})[_0x207b('0xf')](function(_0x1b86ee){logger[_0x207b('0x17')](_0x207b('0x1a'),_0x5f0e7c);logger['debug']('GetVoiceQueue',_0x5f0e7c,JSON[_0x207b('0x13')](_0x1b86ee));_0x29250d(_0x1b86ee);})[_0x207b('0x19')](function(_0x2c70e1){logger[_0x207b('0x14')](_0x207b('0x1a'),_0x2c70e1[_0x207b('0x16')],_0x5f0e7c);_0x180208(_0x39e210[_0x207b('0x14')](0x1f4,_0x2c70e1[_0x207b('0x16')]));});});};exports[_0x207b('0x24')]=function(_0x46056c){var _0x466332=this;return new Promise(function(_0x40d2d2,_0xbf1519){return db['VoiceQueue']['find']({'raw':_0x46056c[_0x207b('0x1d')]?_0x46056c[_0x207b('0x1d')][_0x207b('0x25')]===undefined?!![]:![]:!![],'where':_0x46056c[_0x207b('0x1d')]?_0x46056c[_0x207b('0x1d')][_0x207b('0x1e')]||null:null,'attributes':_0x46056c['options']?_0x46056c[_0x207b('0x1d')][_0x207b('0x1f')]||null:null,'include':_0x46056c[_0x207b('0x1d')]?_0x46056c['options'][_0x207b('0x21')]?_['map'](_0x46056c[_0x207b('0x1d')][_0x207b('0x21')],function(_0x4836e8){return{'model':db[_0x4836e8[_0x207b('0x23')]],'as':_0x4836e8['as'],'attributes':_0x4836e8['attributes'],'include':_0x4836e8[_0x207b('0x21')]?_[_0x207b('0x22')](_0x4836e8[_0x207b('0x21')],function(_0x38db74){return{'model':db[_0x38db74[_0x207b('0x23')]],'as':_0x38db74['as'],'attributes':_0x38db74[_0x207b('0x1f')],'include':_0x38db74[_0x207b('0x21')]?_['map'](_0x38db74['include'],function(_0x571a60){return{'model':db[_0x571a60[_0x207b('0x23')]],'as':_0x571a60['as'],'attributes':_0x571a60[_0x207b('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x207b('0xf')](function(_0x420520){logger[_0x207b('0x17')]('ShowVoiceQueue',_0x46056c);logger[_0x207b('0x12')](_0x207b('0x24'),_0x46056c,JSON[_0x207b('0x13')](_0x420520));_0x40d2d2(_0x420520);})['catch'](function(_0x20d845){logger['error'](_0x207b('0x24'),_0x20d845[_0x207b('0x16')],_0x46056c);_0xbf1519(_0x466332[_0x207b('0x14')](0x1f4,_0x20d845[_0x207b('0x16')]));});});}; \ No newline at end of file +var _0xf133=['redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','request','info','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceQueue,\x20%s,\x20%s','result','GetVoiceQueue','VoiceQueue','options','raw','where','limit','include','model','map','attributes','then','catch','ShowVoiceQueue','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http'];(function(_0x16ae34,_0x1dc6d){var _0x184836=function(_0x1e48b7){while(--_0x1e48b7){_0x16ae34['push'](_0x16ae34['shift']());}};_0x184836(++_0x1dc6d);}(_0xf133,0xc3));var _0x3f13=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0xf133[_0x4ae6ef];return _0x3cbb4e;};'use strict';var _=require('lodash');var util=require(_0x3f13('0x0'));var moment=require(_0x3f13('0x1'));var BPromise=require(_0x3f13('0x2'));var rs=require(_0x3f13('0x3'));var fs=require('fs');var Redis=require(_0x3f13('0x4'));var db=require(_0x3f13('0x5'))['db'];var utils=require(_0x3f13('0x6'));var logger=require(_0x3f13('0x7'))(_0x3f13('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x3f13('0x9')]({'port':0x232a});config[_0x3f13('0xa')]=_[_0x3f13('0xb')](config[_0x3f13('0xa')],{'host':_0x3f13('0xc'),'port':0x18eb});var socket=require(_0x3f13('0xd'))(new Redis(config[_0x3f13('0xa')]));require(_0x3f13('0xe'))[_0x3f13('0xf')](socket);function respondWithRpcPromise(_0x6cfe88,_0x13b8e1,_0x41cbb8){return new BPromise(function(_0x532afc,_0x46d74a){return client[_0x3f13('0x10')](_0x6cfe88,_0x41cbb8)['then'](function(_0xb42bd4){logger[_0x3f13('0x11')]('VoiceQueue,\x20%s,\x20%s',_0x13b8e1,_0x3f13('0x12'));logger[_0x3f13('0x13')](_0x3f13('0x14'),_0x13b8e1,_0x3f13('0x12'),JSON[_0x3f13('0x15')](_0xb42bd4));if(_0xb42bd4[_0x3f13('0x16')]){if(_0xb42bd4[_0x3f13('0x16')][_0x3f13('0x17')]===0x1f4){logger[_0x3f13('0x16')]('VoiceQueue,\x20%s,\x20%s',_0x13b8e1,_0xb42bd4[_0x3f13('0x16')][_0x3f13('0x18')]);return _0x46d74a(_0xb42bd4[_0x3f13('0x16')]['message']);}logger[_0x3f13('0x16')]('VoiceQueue,\x20%s,\x20%s',_0x13b8e1,_0xb42bd4[_0x3f13('0x16')][_0x3f13('0x18')]);return _0x532afc(_0xb42bd4[_0x3f13('0x16')][_0x3f13('0x18')]);}else{logger[_0x3f13('0x11')](_0x3f13('0x19'),_0x13b8e1,_0x3f13('0x12'));_0x532afc(_0xb42bd4[_0x3f13('0x1a')][_0x3f13('0x18')]);}})['catch'](function(_0x270b70){logger[_0x3f13('0x16')](_0x3f13('0x19'),_0x13b8e1,_0x270b70);_0x46d74a(_0x270b70);});});}exports[_0x3f13('0x1b')]=function(_0x270e65){var _0x3d338f=this;return new Promise(function(_0x9bd8e7,_0x11587d){return db[_0x3f13('0x1c')]['findAll']({'raw':_0x270e65[_0x3f13('0x1d')]?_0x270e65['options'][_0x3f13('0x1e')]===undefined?!![]:![]:!![],'where':_0x270e65['options']?_0x270e65[_0x3f13('0x1d')][_0x3f13('0x1f')]||null:null,'attributes':_0x270e65[_0x3f13('0x1d')]?_0x270e65[_0x3f13('0x1d')]['attributes']||null:null,'limit':_0x270e65['options']?_0x270e65[_0x3f13('0x1d')][_0x3f13('0x20')]||null:null,'include':_0x270e65[_0x3f13('0x1d')]?_0x270e65['options'][_0x3f13('0x21')]?_['map'](_0x270e65[_0x3f13('0x1d')][_0x3f13('0x21')],function(_0x2a35d6){return{'model':db[_0x2a35d6[_0x3f13('0x22')]],'as':_0x2a35d6['as'],'attributes':_0x2a35d6['attributes'],'include':_0x2a35d6[_0x3f13('0x21')]?_[_0x3f13('0x23')](_0x2a35d6[_0x3f13('0x21')],function(_0x2420dc){return{'model':db[_0x2420dc[_0x3f13('0x22')]],'as':_0x2420dc['as'],'attributes':_0x2420dc[_0x3f13('0x24')],'include':_0x2420dc[_0x3f13('0x21')]?_[_0x3f13('0x23')](_0x2420dc[_0x3f13('0x21')],function(_0x4993a5){return{'model':db[_0x4993a5[_0x3f13('0x22')]],'as':_0x4993a5['as'],'attributes':_0x4993a5['attributes']};}):[]};}):[]};}):[]:[]})[_0x3f13('0x25')](function(_0x834696){logger[_0x3f13('0x11')](_0x3f13('0x1b'),_0x270e65);logger[_0x3f13('0x13')](_0x3f13('0x1b'),_0x270e65,JSON[_0x3f13('0x15')](_0x834696));_0x9bd8e7(_0x834696);})[_0x3f13('0x26')](function(_0x255f86){logger[_0x3f13('0x16')](_0x3f13('0x1b'),_0x255f86[_0x3f13('0x18')],_0x270e65);_0x11587d(_0x3d338f[_0x3f13('0x16')](0x1f4,_0x255f86[_0x3f13('0x18')]));});});};exports[_0x3f13('0x27')]=function(_0xc3550a){var _0x246059=this;return new Promise(function(_0x28406e,_0x54f328){return db['VoiceQueue'][_0x3f13('0x28')]({'raw':_0xc3550a['options']?_0xc3550a['options'][_0x3f13('0x1e')]===undefined?!![]:![]:!![],'where':_0xc3550a['options']?_0xc3550a[_0x3f13('0x1d')][_0x3f13('0x1f')]||null:null,'attributes':_0xc3550a['options']?_0xc3550a['options'][_0x3f13('0x24')]||null:null,'include':_0xc3550a[_0x3f13('0x1d')]?_0xc3550a[_0x3f13('0x1d')][_0x3f13('0x21')]?_['map'](_0xc3550a[_0x3f13('0x1d')]['include'],function(_0x50802f){return{'model':db[_0x50802f[_0x3f13('0x22')]],'as':_0x50802f['as'],'attributes':_0x50802f[_0x3f13('0x24')],'include':_0x50802f[_0x3f13('0x21')]?_['map'](_0x50802f[_0x3f13('0x21')],function(_0xa1b661){return{'model':db[_0xa1b661[_0x3f13('0x22')]],'as':_0xa1b661['as'],'attributes':_0xa1b661[_0x3f13('0x24')],'include':_0xa1b661[_0x3f13('0x21')]?_[_0x3f13('0x23')](_0xa1b661[_0x3f13('0x21')],function(_0x5ef7e1){return{'model':db[_0x5ef7e1['model']],'as':_0x5ef7e1['as'],'attributes':_0x5ef7e1['attributes']};}):[]};}):[]};}):[]:[]})[_0x3f13('0x25')](function(_0x3defc2){logger[_0x3f13('0x11')]('ShowVoiceQueue',_0xc3550a);logger[_0x3f13('0x13')](_0x3f13('0x27'),_0xc3550a,JSON[_0x3f13('0x15')](_0x3defc2));_0x28406e(_0x3defc2);})[_0x3f13('0x26')](function(_0x331b62){logger[_0x3f13('0x16')]('ShowVoiceQueue',_0x331b62['message'],_0xc3550a);_0x54f328(_0x246059['error'](0x1f4,_0x331b62[_0x3f13('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 42acbbc..9fa6301 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 _0x2c08=['length','voiceQueue:','./voiceQueue.events','save','remove','update','emit','register'];(function(_0x3421ec,_0x28d9a1){var _0x342b7c=function(_0x2cf3dc){while(--_0x2cf3dc){_0x3421ec['push'](_0x3421ec['shift']());}};_0x342b7c(++_0x28d9a1);}(_0x2c08,0x10a));var _0x82c0=function(_0x1db5d9,_0x53c693){_0x1db5d9=_0x1db5d9-0x0;var _0x4bf4b4=_0x2c08[_0x1db5d9];return _0x4bf4b4;};'use strict';var VoiceQueueEvents=require(_0x82c0('0x0'));var events=[_0x82c0('0x1'),_0x82c0('0x2'),_0x82c0('0x3')];function createListener(_0x335abe,_0x56191d){return function(_0x5b92e3){_0x56191d[_0x82c0('0x4')](_0x335abe,_0x5b92e3);};}function removeListener(_0x40cbf8,_0x1068df){return function(){VoiceQueueEvents['removeListener'](_0x40cbf8,_0x1068df);};}exports[_0x82c0('0x5')]=function(_0x87099c){for(var _0x2e02ce=0x0,_0x224b0e=events[_0x82c0('0x6')];_0x2e02ce<_0x224b0e;_0x2e02ce++){var _0x58b976=events[_0x2e02ce];var _0x2c2310=createListener(_0x82c0('0x7')+_0x58b976,_0x87099c);VoiceQueueEvents['on'](_0x58b976,_0x2c2310);}}; \ No newline at end of file +var _0xb01f=['removeListener','register','voiceQueue:','./voiceQueue.events','save','remove','update'];(function(_0x3b5185,_0x57ac83){var _0x544b33=function(_0x213538){while(--_0x213538){_0x3b5185['push'](_0x3b5185['shift']());}};_0x544b33(++_0x57ac83);}(_0xb01f,0x184));var _0xfb01=function(_0x504439,_0x592c72){_0x504439=_0x504439-0x0;var _0x22a0e0=_0xb01f[_0x504439];return _0x22a0e0;};'use strict';var VoiceQueueEvents=require(_0xfb01('0x0'));var events=[_0xfb01('0x1'),_0xfb01('0x2'),_0xfb01('0x3')];function createListener(_0x344fff,_0x48892c){return function(_0xc60f93){_0x48892c['emit'](_0x344fff,_0xc60f93);};}function removeListener(_0x2ff0cf,_0x24e7d1){return function(){VoiceQueueEvents[_0xfb01('0x4')](_0x2ff0cf,_0x24e7d1);};}exports[_0xfb01('0x5')]=function(_0x345c65){for(var _0x5dd08c=0x0,_0x205e1f=events['length'];_0x5dd08c<_0x205e1f;_0x5dd08c++){var _0x3024cc=events[_0x5dd08c];var _0x3e285c=createListener(_0xfb01('0x6')+_0x3024cc,_0x345c65);VoiceQueueEvents['on'](_0x3024cc,_0x3e285c);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 8bca1a4..2a1c935 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 _0xc06c=['isAuthenticated','/index','getVoiceQueuesReport','/:id','show','post','put','delete','exports','multer','Router','fs-extra','../../components/interaction/service','./voiceQueueReport.controller','get','index'];(function(_0x3c7865,_0x11587b){var _0x39ad89=function(_0x22c2d9){while(--_0x22c2d9){_0x3c7865['push'](_0x3c7865['shift']());}};_0x39ad89(++_0x11587b);}(_0xc06c,0xf9));var _0xcc06=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xc06c[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0xcc06('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xcc06('0x1')]();var fs_extra=require(_0xcc06('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xcc06('0x3'));var config=require('../../config/environment');var controller=require(_0xcc06('0x4'));router[_0xcc06('0x5')]('/',auth['isAuthenticated'](),controller[_0xcc06('0x6')]);router[_0xcc06('0x5')]('/describe',auth[_0xcc06('0x7')](),controller['describe']);router[_0xcc06('0x5')](_0xcc06('0x8'),auth[_0xcc06('0x7')](),controller[_0xcc06('0x9')]);router[_0xcc06('0x5')](_0xcc06('0xa'),auth[_0xcc06('0x7')](),controller[_0xcc06('0xb')]);router[_0xcc06('0xc')]('/',auth[_0xcc06('0x7')](),controller['create']);router[_0xcc06('0xd')](_0xcc06('0xa'),auth[_0xcc06('0x7')](),controller['update']);router[_0xcc06('0xe')]('/:id',auth[_0xcc06('0x7')](),controller['destroy']);module[_0xcc06('0xf')]=router; \ No newline at end of file +var _0xecb1=['get','isAuthenticated','index','/describe','show','create','put','/:id','delete','destroy','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceQueueReport.controller'];(function(_0x384fc4,_0x1740d6){var _0x292817=function(_0x50249c){while(--_0x50249c){_0x384fc4['push'](_0x384fc4['shift']());}};_0x292817(++_0x1740d6);}(_0xecb1,0x9a));var _0x1ecb=function(_0x29e858,_0x205c0c){_0x29e858=_0x29e858-0x0;var _0x54e531=_0xecb1[_0x29e858];return _0x54e531;};'use strict';var multer=require('multer');var util=require(_0x1ecb('0x0'));var path=require(_0x1ecb('0x1'));var timeout=require('connect-timeout');var express=require(_0x1ecb('0x2'));var router=express[_0x1ecb('0x3')]();var fs_extra=require(_0x1ecb('0x4'));var auth=require(_0x1ecb('0x5'));var interaction=require(_0x1ecb('0x6'));var config=require('../../config/environment');var controller=require(_0x1ecb('0x7'));router[_0x1ecb('0x8')]('/',auth[_0x1ecb('0x9')](),controller[_0x1ecb('0xa')]);router[_0x1ecb('0x8')](_0x1ecb('0xb'),auth[_0x1ecb('0x9')](),controller['describe']);router[_0x1ecb('0x8')]('/index',auth[_0x1ecb('0x9')](),controller['getVoiceQueuesReport']);router[_0x1ecb('0x8')]('/:id',auth[_0x1ecb('0x9')](),controller[_0x1ecb('0xc')]);router['post']('/',auth[_0x1ecb('0x9')](),controller[_0x1ecb('0xd')]);router[_0x1ecb('0xe')](_0x1ecb('0xf'),auth['isAuthenticated'](),controller['update']);router[_0x1ecb('0x10')](_0x1ecb('0xf'),auth[_0x1ecb('0x9')](),controller[_0x1ecb('0x11')]);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 cf8df25..72955fa 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 _0xb3e1=['BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','queuecallerleaveAt','setDataValue','holdtime','INTEGER'];(function(_0x56c52c,_0xd08322){var _0x5040b0=function(_0xcb8a66){while(--_0xcb8a66){_0x56c52c['push'](_0x56c52c['shift']());}};_0x5040b0(++_0xd08322);}(_0xb3e1,0x6f));var _0x1b3e=function(_0x1558ab,_0x39d1de){_0x1558ab=_0x1558ab-0x0;var _0x53b64a=_0xb3e1[_0x1558ab];return _0x53b64a;};'use strict';var Sequelize=require(_0x1b3e('0x0'));var moment=require(_0x1b3e('0x1'));module[_0x1b3e('0x2')]={'type':{'type':Sequelize[_0x1b3e('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x1b3e('0x3')]},'calleridname':{'type':Sequelize[_0x1b3e('0x3')]},'queue':{'type':Sequelize[_0x1b3e('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0x1b3e('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0x1b3e('0x4')],'set':function(_0x472134){var _0x1474c4=moment(_0x472134);var _0x1825a5=moment(this[_0x1b3e('0x5')](_0x1b3e('0x6')))[_0x1b3e('0x7')](_0x1b3e('0x8'));var _0x3e8d5e=_0x1474c4[_0x1b3e('0x9')](_0x1825a5,_0x1b3e('0xa'));this['setDataValue'](_0x1b3e('0xb'),_0x472134);this[_0x1b3e('0xc')](_0x1b3e('0xd'),_0x3e8d5e||null);}},'position':{'type':Sequelize[_0x1b3e('0xe')]},'count':{'type':Sequelize[_0x1b3e('0xe')]},'queuecallerabandon':{'type':Sequelize[_0x1b3e('0xf')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0x1b3e('0xf')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x1b3e('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0x1b3e('0x3')],'comment':_0x1b3e('0x10')},'originalposition':{'type':Sequelize[_0x1b3e('0xe')]},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x1b3e('0x3')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x1b3e('0x3')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x1b3e('0x3')]},'holdtime':{'type':Sequelize[_0x1b3e('0xe')]},'mohtime':{'type':Sequelize[_0x1b3e('0xe')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x1b3e('0xf')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x1b3e('0x3')],'comment':_0x1b3e('0x11')},'transferexten':{'type':Sequelize[_0x1b3e('0x3')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x1b3e('0x3')]},'secondDisposition':{'type':Sequelize[_0x1b3e('0x3')]},'thirdDisposition':{'type':Sequelize[_0x1b3e('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0x1b3e('0xe')],'defaultValue':0x0}}; \ No newline at end of file +var _0x4516=['moment','exports','STRING','DATE','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','seconds','queuecallerleaveAt','setDataValue','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize'];(function(_0xa8a226,_0xeafb7d){var _0x1b30fa=function(_0x22c8ec){while(--_0x22c8ec){_0xa8a226['push'](_0xa8a226['shift']());}};_0x1b30fa(++_0xeafb7d);}(_0x4516,0x1b1));var _0x6451=function(_0x1fd4de,_0xbae1c8){_0x1fd4de=_0x1fd4de-0x0;var _0x2acc09=_0x4516[_0x1fd4de];return _0x2acc09;};'use strict';var Sequelize=require(_0x6451('0x0'));var moment=require(_0x6451('0x1'));module[_0x6451('0x2')]={'type':{'type':Sequelize[_0x6451('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x6451('0x3')]},'calleridname':{'type':Sequelize[_0x6451('0x3')]},'queue':{'type':Sequelize[_0x6451('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0x6451('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0x6451('0x4')],'set':function(_0x43bca5){var _0x5931e9=moment(_0x43bca5);var _0x3d80eb=moment(this['getDataValue'](_0x6451('0x5')))[_0x6451('0x6')](_0x6451('0x7'));var _0x2227fc=_0x5931e9['diff'](_0x3d80eb,_0x6451('0x8'));this['setDataValue'](_0x6451('0x9'),_0x43bca5);this[_0x6451('0xa')]('holdtime',_0x2227fc||null);}},'position':{'type':Sequelize[_0x6451('0xb')]},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0x6451('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x6451('0x4')]},'queuecallercomplete':{'type':Sequelize[_0x6451('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x6451('0x4')]},'queuecallerexit':{'type':Sequelize[_0x6451('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x6451('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0x6451('0x3')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize[_0x6451('0xb')]},'channel':{'type':Sequelize[_0x6451('0x3')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x6451('0x3')]},'accountcode':{'type':Sequelize[_0x6451('0x3')]},'context':{'type':Sequelize[_0x6451('0x3')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x6451('0x3')]},'holdtime':{'type':Sequelize[_0x6451('0xb')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x6451('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x6451('0x3')],'comment':_0x6451('0xd')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x6451('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x6451('0x3')]},'thirdDisposition':{'type':Sequelize[_0x6451('0x3')]},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'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 a6998cd..ee07caf 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 _0x4622=['fields','length','hasOwnProperty','order','sort','where','pick','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','find','create','body','destroy','describe','getVoiceQueuesReport','nolimit','filter','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','ejs','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./voiceQueueReport.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','error','stack','name','send','map','VoiceQueueReport','rawAttributes','type','key','query','keys','filters','model','attributes','intersection'];(function(_0x36912b,_0x2a8e02){var _0x5711c6=function(_0x53f3d6){while(--_0x53f3d6){_0x36912b['push'](_0x36912b['shift']());}};_0x5711c6(++_0x2a8e02);}(_0x4622,0xff));var _0x2462=function(_0x495e9f,_0x1b1d80){_0x495e9f=_0x495e9f-0x0;var _0xb249d2=_0x4622[_0x495e9f];return _0xb249d2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2462('0x0'));var zipdir=require(_0x2462('0x1'));var jsonpatch=require(_0x2462('0x2'));var rp=require(_0x2462('0x3'));var moment=require('moment');var BPromise=require(_0x2462('0x4'));var Mustache=require(_0x2462('0x5'));var util=require(_0x2462('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2462('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x2462('0x8'));var crypto=require(_0x2462('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x2462('0xa'));var toCsv=require(_0x2462('0xb'));var querystring=require(_0x2462('0xc'));var Papa=require(_0x2462('0xd'));var Redis=require(_0x2462('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2462('0xf'));var utils=require(_0x2462('0x10'));var config=require(_0x2462('0x11'));var licenseUtil=require(_0x2462('0x12'));var db=require(_0x2462('0x13'))['db'];config[_0x2462('0x14')]=_['defaults'](config[_0x2462('0x14')],{'host':_0x2462('0x15'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2462('0x14')]));require(_0x2462('0x16'))[_0x2462('0x17')](socket);function respondWithStatusCode(_0x22528b,_0xd05f27){_0xd05f27=_0xd05f27||0xcc;return function(_0x3f1a84){if(_0x3f1a84){return _0x22528b[_0x2462('0x18')](_0xd05f27);}return _0x22528b[_0x2462('0x19')](_0xd05f27)[_0x2462('0x1a')]();};}function respondWithResult(_0x18111f,_0x4f3905){_0x4f3905=_0x4f3905||0xc8;return function(_0x3f344f){if(_0x3f344f){return _0x18111f[_0x2462('0x19')](_0x4f3905)[_0x2462('0x1b')](_0x3f344f);}};}function respondWithFilteredResult(_0x2581bb,_0x1e24ca){return function(_0x2e7cf6){if(_0x2e7cf6){var _0x4256cc=typeof _0x1e24ca[_0x2462('0x1c')]===_0x2462('0x1d')&&typeof _0x1e24ca[_0x2462('0x1e')]==='undefined';var _0x2a83d1=_0x2e7cf6[_0x2462('0x1f')];var _0x337489=_0x4256cc?0x0:_0x1e24ca[_0x2462('0x1c')];var _0x5f521c=_0x4256cc?_0x2e7cf6[_0x2462('0x1f')]:_0x1e24ca[_0x2462('0x1c')]+_0x1e24ca[_0x2462('0x1e')];var _0x230894;if(_0x5f521c>=_0x2a83d1){_0x5f521c=_0x2a83d1;_0x230894=0xc8;}else{_0x230894=0xce;}_0x2581bb[_0x2462('0x19')](_0x230894);return _0x2581bb[_0x2462('0x20')](_0x2462('0x21'),_0x337489+'-'+_0x5f521c+'/'+_0x2a83d1)[_0x2462('0x1b')](_0x2e7cf6);}return null;};}function patchUpdates(_0x2a4905){return function(_0x35a3f1){try{jsonpatch['apply'](_0x35a3f1,_0x2a4905,!![]);}catch(_0x3e287c){return BPromise[_0x2462('0x22')](_0x3e287c);}return _0x35a3f1[_0x2462('0x23')]();};}function saveUpdates(_0x2939c0,_0x4a3b43){return function(_0x2edbed){if(_0x2edbed){return _0x2edbed[_0x2462('0x24')](_0x2939c0)[_0x2462('0x25')](function(_0x2dabc6){return _0x2dabc6;});}return null;};}function removeEntity(_0x49b40e,_0x3f9ab0){return function(_0x29683e){if(_0x29683e){return _0x29683e['destroy']()['then'](function(){_0x49b40e[_0x2462('0x19')](0xcc)[_0x2462('0x1a')]();});}};}function handleEntityNotFound(_0x11b9b2,_0x3b0724){return function(_0x58363){if(!_0x58363){_0x11b9b2[_0x2462('0x18')](0x194);}return _0x58363;};}function handleError(_0x268d72,_0x3d276d){_0x3d276d=_0x3d276d||0x1f4;return function(_0x560592){logger[_0x2462('0x26')](_0x560592[_0x2462('0x27')]);if(_0x560592[_0x2462('0x28')]){delete _0x560592['name'];}_0x268d72['status'](_0x3d276d)[_0x2462('0x29')](_0x560592);};}exports['index']=function(_0x333ef6,_0x4447f4){var _0x3c05e7={},_0x2a8e9a={},_0x243b5d={'count':0x0,'rows':[]};var _0x3215bb=_[_0x2462('0x2a')](db[_0x2462('0x2b')][_0x2462('0x2c')],function(_0x586b19){return{'name':_0x586b19['fieldName'],'type':_0x586b19[_0x2462('0x2d')][_0x2462('0x2e')]};});_0x2a8e9a['model']=_['map'](_0x3215bb,'name');_0x2a8e9a[_0x2462('0x2f')]=_[_0x2462('0x30')](_0x333ef6[_0x2462('0x2f')]);_0x2a8e9a[_0x2462('0x31')]=_['intersection'](_0x2a8e9a[_0x2462('0x32')],_0x2a8e9a[_0x2462('0x2f')]);_0x3c05e7[_0x2462('0x33')]=_[_0x2462('0x34')](_0x2a8e9a[_0x2462('0x32')],qs[_0x2462('0x35')](_0x333ef6['query'][_0x2462('0x35')]));_0x3c05e7[_0x2462('0x33')]=_0x3c05e7[_0x2462('0x33')][_0x2462('0x36')]?_0x3c05e7[_0x2462('0x33')]:_0x2a8e9a[_0x2462('0x32')];if(!_0x333ef6[_0x2462('0x2f')][_0x2462('0x37')]('nolimit')){_0x3c05e7[_0x2462('0x1e')]=qs[_0x2462('0x1e')](_0x333ef6['query']['limit']);_0x3c05e7['offset']=qs[_0x2462('0x1c')](_0x333ef6[_0x2462('0x2f')][_0x2462('0x1c')]);}_0x3c05e7[_0x2462('0x38')]=qs[_0x2462('0x39')](_0x333ef6['query'][_0x2462('0x39')]);_0x3c05e7[_0x2462('0x3a')]=qs[_0x2462('0x31')](_[_0x2462('0x3b')](_0x333ef6[_0x2462('0x2f')],_0x2a8e9a[_0x2462('0x31')]),_0x3215bb);if(_0x333ef6[_0x2462('0x2f')]['filter']){_0x3c05e7[_0x2462('0x3a')]=_['merge'](_0x3c05e7[_0x2462('0x3a')],{'$or':_[_0x2462('0x2a')](_0x3215bb,function(_0x56c6a7){if(_0x56c6a7[_0x2462('0x2d')]!==_0x2462('0x3c')){var _0x21144f={};_0x21144f[_0x56c6a7[_0x2462('0x28')]]={'$like':'%'+_0x333ef6[_0x2462('0x2f')]['filter']+'%'};return _0x21144f;}})});}_0x3c05e7=_[_0x2462('0x3d')]({},_0x3c05e7,_0x333ef6[_0x2462('0x3e')]);var _0x37bfaf={'where':_0x3c05e7['where']};return db[_0x2462('0x2b')][_0x2462('0x1f')](_0x37bfaf)['then'](function(_0x333cd8){_0x243b5d[_0x2462('0x1f')]=_0x333cd8;if(_0x333ef6['query'][_0x2462('0x3f')]){_0x3c05e7[_0x2462('0x40')]=[{'all':!![]}];}return db[_0x2462('0x2b')][_0x2462('0x41')](_0x3c05e7);})[_0x2462('0x25')](function(_0x4e20fa){_0x243b5d[_0x2462('0x42')]=_0x4e20fa;return _0x243b5d;})[_0x2462('0x25')](respondWithFilteredResult(_0x4447f4,_0x3c05e7))[_0x2462('0x43')](handleError(_0x4447f4,null));};exports['show']=function(_0x14f308,_0x4badf5){var _0x12ccde={'raw':![],'where':{'id':_0x14f308[_0x2462('0x44')]['id']}},_0x270d64={};_0x270d64[_0x2462('0x32')]=_[_0x2462('0x30')](db[_0x2462('0x2b')]['rawAttributes']);_0x270d64[_0x2462('0x2f')]=_[_0x2462('0x30')](_0x14f308['query']);_0x270d64['filters']=_[_0x2462('0x34')](_0x270d64[_0x2462('0x32')],_0x270d64[_0x2462('0x2f')]);_0x12ccde[_0x2462('0x33')]=_[_0x2462('0x34')](_0x270d64['model'],qs[_0x2462('0x35')](_0x14f308[_0x2462('0x2f')]['fields']));_0x12ccde['attributes']=_0x12ccde[_0x2462('0x33')][_0x2462('0x36')]?_0x12ccde[_0x2462('0x33')]:_0x270d64['model'];if(_0x14f308[_0x2462('0x2f')][_0x2462('0x3f')]){_0x12ccde[_0x2462('0x40')]=[{'all':!![]}];}_0x12ccde=_[_0x2462('0x3d')]({},_0x12ccde,_0x14f308[_0x2462('0x3e')]);return db[_0x2462('0x2b')][_0x2462('0x45')](_0x12ccde)[_0x2462('0x25')](handleEntityNotFound(_0x4badf5,null))['then'](respondWithResult(_0x4badf5,null))[_0x2462('0x43')](handleError(_0x4badf5,null));};exports[_0x2462('0x46')]=function(_0x4625d4,_0x3f8e8b){return db['VoiceQueueReport'][_0x2462('0x46')](_0x4625d4['body'],{})[_0x2462('0x25')](respondWithResult(_0x3f8e8b,0xc9))[_0x2462('0x43')](handleError(_0x3f8e8b,null));};exports[_0x2462('0x24')]=function(_0x6b57a2,_0x5bece7){if(_0x6b57a2[_0x2462('0x47')]['id']){delete _0x6b57a2[_0x2462('0x47')]['id'];}return db[_0x2462('0x2b')][_0x2462('0x45')]({'where':{'id':_0x6b57a2[_0x2462('0x44')]['id']}})[_0x2462('0x25')](handleEntityNotFound(_0x5bece7,null))['then'](saveUpdates(_0x6b57a2[_0x2462('0x47')],null))[_0x2462('0x25')](respondWithResult(_0x5bece7,null))['catch'](handleError(_0x5bece7,null));};exports[_0x2462('0x48')]=function(_0x22025a,_0x202828){return db[_0x2462('0x2b')][_0x2462('0x45')]({'where':{'id':_0x22025a['params']['id']}})['then'](handleEntityNotFound(_0x202828,null))[_0x2462('0x25')](removeEntity(_0x202828,null))[_0x2462('0x43')](handleError(_0x202828,null));};exports[_0x2462('0x49')]=function(_0x1dd702,_0x1b0b74){return db['VoiceQueueReport'][_0x2462('0x49')]()[_0x2462('0x25')](respondWithResult(_0x1b0b74,null))[_0x2462('0x43')](handleError(_0x1b0b74,null));};exports[_0x2462('0x4a')]=function(_0xbe9dab,_0xa5ca3c){var _0x39a496={},_0x3ec7fe={},_0x1b6a68={'count':0x0,'rows':[]};_0x3ec7fe['model']=_[_0x2462('0x30')](db['VoiceQueueReport'][_0x2462('0x2c')]);_0x3ec7fe[_0x2462('0x2f')]=_[_0x2462('0x30')](_0xbe9dab[_0x2462('0x2f')]);_0x3ec7fe[_0x2462('0x31')]=_[_0x2462('0x34')](_0x3ec7fe[_0x2462('0x32')],_0x3ec7fe[_0x2462('0x2f')]);_0x39a496['attributes']=_[_0x2462('0x34')](_0x3ec7fe[_0x2462('0x32')],qs['fields'](_0xbe9dab[_0x2462('0x2f')][_0x2462('0x35')]));_0x39a496[_0x2462('0x33')]=_0x39a496[_0x2462('0x33')][_0x2462('0x36')]?_0x39a496[_0x2462('0x33')]:_0x3ec7fe[_0x2462('0x32')];if(!_0xbe9dab[_0x2462('0x2f')]['hasOwnProperty'](_0x2462('0x4b'))){_0x39a496[_0x2462('0x1e')]=qs[_0x2462('0x1e')](_0xbe9dab[_0x2462('0x2f')][_0x2462('0x1e')]);_0x39a496[_0x2462('0x1c')]=qs[_0x2462('0x1c')](_0xbe9dab[_0x2462('0x2f')][_0x2462('0x1c')]);}_0x39a496[_0x2462('0x38')]=qs[_0x2462('0x39')](_0xbe9dab['query'][_0x2462('0x39')]);_0x39a496['where']=qs['filters'](_[_0x2462('0x3b')](_0xbe9dab[_0x2462('0x2f')],_0x3ec7fe[_0x2462('0x31')]));if(_0xbe9dab[_0x2462('0x2f')][_0x2462('0x4c')]){_0x39a496[_0x2462('0x3a')]=_[_0x2462('0x3d')](_0x39a496[_0x2462('0x3a')],{'$or':_[_0x2462('0x2a')](_0x39a496[_0x2462('0x33')],function(_0x2a107c){var _0x137b3e={};_0x137b3e[_0x2a107c]={'$like':'%'+_0xbe9dab['query'][_0x2462('0x4c')]+'%'};return _0x137b3e;})});}_0x39a496=_[_0x2462('0x3d')]({},_0x39a496,_0xbe9dab['options']);var _0x25816f={'where':_0x39a496[_0x2462('0x3a')]};return db[_0x2462('0x2b')][_0x2462('0x1f')](_0x25816f)[_0x2462('0x25')](function(_0x595e12){_0x1b6a68[_0x2462('0x1f')]=_0x595e12;if(_0xbe9dab[_0x2462('0x2f')][_0x2462('0x3f')]){_0x39a496['include']=[{'all':!![]}];}return db[_0x2462('0x2b')][_0x2462('0x41')](_0x39a496);})[_0x2462('0x25')](function(_0x18dc2e){_0x1b6a68[_0x2462('0x42')]=_0x18dc2e;return _0x1b6a68;})[_0x2462('0x25')](respondWithFilteredResult(_0xa5ca3c,_0x39a496,_0x2462('0x4a')))['catch'](handleError(_0xa5ca3c,null,_0x2462('0x4a')));}; \ No newline at end of file +var _0x4551=['update','then','destroy','end','sendStatus','error','stack','name','send','VoiceQueueReport','rawAttributes','fieldName','type','key','map','query','keys','filters','model','attributes','fields','length','nolimit','order','sort','pick','where','VIRTUAL','filter','merge','options','count','includeAll','include','findAll','show','params','intersection','find','catch','create','body','describe','getVoiceQueuesReport','hasOwnProperty','rows','eml-format','rimraf','request-promise','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','status','json','offset','limit','undefined','Content-Range','reject'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4551,0x1d2));var _0x1455=function(_0x26cfb8,_0x47a2b3){_0x26cfb8=_0x26cfb8-0x0;var _0x21f10f=_0x4551[_0x26cfb8];return _0x21f10f;};'use strict';var emlformat=require(_0x1455('0x0'));var rimraf=require(_0x1455('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1455('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1455('0x3'));var util=require(_0x1455('0x4'));var path=require(_0x1455('0x5'));var sox=require(_0x1455('0x6'));var csv=require(_0x1455('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1455('0x8'));var _=require(_0x1455('0x9'));var squel=require(_0x1455('0xa'));var crypto=require(_0x1455('0xb'));var jsforce=require(_0x1455('0xc'));var deskjs=require(_0x1455('0xd'));var toCsv=require('to-csv');var querystring=require(_0x1455('0xe'));var Papa=require('papaparse');var Redis=require(_0x1455('0xf'));var authService=require(_0x1455('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x1455('0x11'));var hardwareService=require(_0x1455('0x12'));var logger=require(_0x1455('0x13'))(_0x1455('0x14'));var utils=require(_0x1455('0x15'));var config=require(_0x1455('0x16'));var licenseUtil=require(_0x1455('0x17'));var db=require(_0x1455('0x18'))['db'];config[_0x1455('0x19')]=_[_0x1455('0x1a')](config[_0x1455('0x19')],{'host':_0x1455('0x1b'),'port':0x18eb});var socket=require(_0x1455('0x1c'))(new Redis(config[_0x1455('0x19')]));require(_0x1455('0x1d'))[_0x1455('0x1e')](socket);function respondWithStatusCode(_0x3a98a8,_0x4a3bf9){_0x4a3bf9=_0x4a3bf9||0xcc;return function(_0x31ef9c){if(_0x31ef9c){return _0x3a98a8['sendStatus'](_0x4a3bf9);}return _0x3a98a8[_0x1455('0x1f')](_0x4a3bf9)['end']();};}function respondWithResult(_0x4eb7f9,_0x2a9e21){_0x2a9e21=_0x2a9e21||0xc8;return function(_0x5ac841){if(_0x5ac841){return _0x4eb7f9[_0x1455('0x1f')](_0x2a9e21)[_0x1455('0x20')](_0x5ac841);}};}function respondWithFilteredResult(_0x2f76b3,_0x450292){return function(_0x1bca48){if(_0x1bca48){var _0x445204=typeof _0x450292[_0x1455('0x21')]==='undefined'&&typeof _0x450292[_0x1455('0x22')]===_0x1455('0x23');var _0x1d0f7a=_0x1bca48['count'];var _0x1d2479=_0x445204?0x0:_0x450292[_0x1455('0x21')];var _0x5555ea=_0x445204?_0x1bca48['count']:_0x450292[_0x1455('0x21')]+_0x450292[_0x1455('0x22')];var _0x376718;if(_0x5555ea>=_0x1d0f7a){_0x5555ea=_0x1d0f7a;_0x376718=0xc8;}else{_0x376718=0xce;}_0x2f76b3['status'](_0x376718);return _0x2f76b3['set'](_0x1455('0x24'),_0x1d2479+'-'+_0x5555ea+'/'+_0x1d0f7a)[_0x1455('0x20')](_0x1bca48);}return null;};}function patchUpdates(_0x15ac4b){return function(_0x59a85a){try{jsonpatch['apply'](_0x59a85a,_0x15ac4b,!![]);}catch(_0x1b10b5){return BPromise[_0x1455('0x25')](_0x1b10b5);}return _0x59a85a['save']();};}function saveUpdates(_0x6cc241,_0x488889){return function(_0x115ad3){if(_0x115ad3){return _0x115ad3[_0x1455('0x26')](_0x6cc241)[_0x1455('0x27')](function(_0x46742e){return _0x46742e;});}return null;};}function removeEntity(_0xbdebeb,_0xf3a223){return function(_0x50e7a3){if(_0x50e7a3){return _0x50e7a3[_0x1455('0x28')]()[_0x1455('0x27')](function(){_0xbdebeb[_0x1455('0x1f')](0xcc)[_0x1455('0x29')]();});}};}function handleEntityNotFound(_0x2e0314,_0x7dcbde){return function(_0x537988){if(!_0x537988){_0x2e0314[_0x1455('0x2a')](0x194);}return _0x537988;};}function handleError(_0x5f21d3,_0x27e9cc){_0x27e9cc=_0x27e9cc||0x1f4;return function(_0x291d3a){logger[_0x1455('0x2b')](_0x291d3a[_0x1455('0x2c')]);if(_0x291d3a[_0x1455('0x2d')]){delete _0x291d3a['name'];}_0x5f21d3[_0x1455('0x1f')](_0x27e9cc)[_0x1455('0x2e')](_0x291d3a);};}exports['index']=function(_0x6470fe,_0x4d216b){var _0x48af08={},_0x5b92bb={},_0x1e8155={'count':0x0,'rows':[]};var _0x31d0b4=_['map'](db[_0x1455('0x2f')][_0x1455('0x30')],function(_0x4602ad){return{'name':_0x4602ad[_0x1455('0x31')],'type':_0x4602ad[_0x1455('0x32')][_0x1455('0x33')]};});_0x5b92bb['model']=_[_0x1455('0x34')](_0x31d0b4,_0x1455('0x2d'));_0x5b92bb[_0x1455('0x35')]=_[_0x1455('0x36')](_0x6470fe[_0x1455('0x35')]);_0x5b92bb[_0x1455('0x37')]=_['intersection'](_0x5b92bb[_0x1455('0x38')],_0x5b92bb[_0x1455('0x35')]);_0x48af08[_0x1455('0x39')]=_['intersection'](_0x5b92bb[_0x1455('0x38')],qs['fields'](_0x6470fe[_0x1455('0x35')][_0x1455('0x3a')]));_0x48af08['attributes']=_0x48af08[_0x1455('0x39')][_0x1455('0x3b')]?_0x48af08[_0x1455('0x39')]:_0x5b92bb[_0x1455('0x38')];if(!_0x6470fe[_0x1455('0x35')]['hasOwnProperty'](_0x1455('0x3c'))){_0x48af08[_0x1455('0x22')]=qs['limit'](_0x6470fe['query'][_0x1455('0x22')]);_0x48af08[_0x1455('0x21')]=qs[_0x1455('0x21')](_0x6470fe[_0x1455('0x35')]['offset']);}_0x48af08[_0x1455('0x3d')]=qs[_0x1455('0x3e')](_0x6470fe[_0x1455('0x35')][_0x1455('0x3e')]);_0x48af08['where']=qs[_0x1455('0x37')](_[_0x1455('0x3f')](_0x6470fe[_0x1455('0x35')],_0x5b92bb['filters']),_0x31d0b4);if(_0x6470fe['query']['filter']){_0x48af08[_0x1455('0x40')]=_['merge'](_0x48af08[_0x1455('0x40')],{'$or':_['map'](_0x31d0b4,function(_0x1b5334){if(_0x1b5334['type']!==_0x1455('0x41')){var _0x192b1a={};_0x192b1a[_0x1b5334[_0x1455('0x2d')]]={'$like':'%'+_0x6470fe[_0x1455('0x35')][_0x1455('0x42')]+'%'};return _0x192b1a;}})});}_0x48af08=_[_0x1455('0x43')]({},_0x48af08,_0x6470fe[_0x1455('0x44')]);var _0x2c57cf={'where':_0x48af08['where']};return db[_0x1455('0x2f')][_0x1455('0x45')](_0x2c57cf)['then'](function(_0x485108){_0x1e8155[_0x1455('0x45')]=_0x485108;if(_0x6470fe[_0x1455('0x35')][_0x1455('0x46')]){_0x48af08[_0x1455('0x47')]=[{'all':!![]}];}return db[_0x1455('0x2f')][_0x1455('0x48')](_0x48af08);})[_0x1455('0x27')](function(_0x52a7c){_0x1e8155['rows']=_0x52a7c;return _0x1e8155;})['then'](respondWithFilteredResult(_0x4d216b,_0x48af08))['catch'](handleError(_0x4d216b,null));};exports[_0x1455('0x49')]=function(_0x370b3d,_0x3853a0){var _0xe108b9={'raw':![],'where':{'id':_0x370b3d[_0x1455('0x4a')]['id']}},_0x547d0f={};_0x547d0f[_0x1455('0x38')]=_[_0x1455('0x36')](db[_0x1455('0x2f')][_0x1455('0x30')]);_0x547d0f[_0x1455('0x35')]=_['keys'](_0x370b3d['query']);_0x547d0f['filters']=_[_0x1455('0x4b')](_0x547d0f[_0x1455('0x38')],_0x547d0f[_0x1455('0x35')]);_0xe108b9['attributes']=_['intersection'](_0x547d0f[_0x1455('0x38')],qs[_0x1455('0x3a')](_0x370b3d[_0x1455('0x35')][_0x1455('0x3a')]));_0xe108b9[_0x1455('0x39')]=_0xe108b9[_0x1455('0x39')]['length']?_0xe108b9[_0x1455('0x39')]:_0x547d0f['model'];if(_0x370b3d[_0x1455('0x35')][_0x1455('0x46')]){_0xe108b9[_0x1455('0x47')]=[{'all':!![]}];}_0xe108b9=_[_0x1455('0x43')]({},_0xe108b9,_0x370b3d[_0x1455('0x44')]);return db['VoiceQueueReport'][_0x1455('0x4c')](_0xe108b9)[_0x1455('0x27')](handleEntityNotFound(_0x3853a0,null))[_0x1455('0x27')](respondWithResult(_0x3853a0,null))[_0x1455('0x4d')](handleError(_0x3853a0,null));};exports[_0x1455('0x4e')]=function(_0x7ba8b,_0xe4fe4f){return db['VoiceQueueReport'][_0x1455('0x4e')](_0x7ba8b[_0x1455('0x4f')],{})['then'](respondWithResult(_0xe4fe4f,0xc9))['catch'](handleError(_0xe4fe4f,null));};exports['update']=function(_0x246593,_0xf3b999){if(_0x246593[_0x1455('0x4f')]['id']){delete _0x246593[_0x1455('0x4f')]['id'];}return db[_0x1455('0x2f')][_0x1455('0x4c')]({'where':{'id':_0x246593['params']['id']}})[_0x1455('0x27')](handleEntityNotFound(_0xf3b999,null))[_0x1455('0x27')](saveUpdates(_0x246593[_0x1455('0x4f')],null))['then'](respondWithResult(_0xf3b999,null))['catch'](handleError(_0xf3b999,null));};exports['destroy']=function(_0x4e0a0e,_0x17fbd0){return db[_0x1455('0x2f')][_0x1455('0x4c')]({'where':{'id':_0x4e0a0e[_0x1455('0x4a')]['id']}})[_0x1455('0x27')](handleEntityNotFound(_0x17fbd0,null))['then'](removeEntity(_0x17fbd0,null))[_0x1455('0x4d')](handleError(_0x17fbd0,null));};exports[_0x1455('0x50')]=function(_0x6822d4,_0x25b3b8){return db[_0x1455('0x2f')][_0x1455('0x50')]()['then'](respondWithResult(_0x25b3b8,null))[_0x1455('0x4d')](handleError(_0x25b3b8,null));};exports[_0x1455('0x51')]=function(_0x409017,_0x58a569){var _0x1f44da={},_0x181a0d={},_0x769e6b={'count':0x0,'rows':[]};_0x181a0d[_0x1455('0x38')]=_[_0x1455('0x36')](db[_0x1455('0x2f')][_0x1455('0x30')]);_0x181a0d['query']=_[_0x1455('0x36')](_0x409017[_0x1455('0x35')]);_0x181a0d[_0x1455('0x37')]=_[_0x1455('0x4b')](_0x181a0d['model'],_0x181a0d[_0x1455('0x35')]);_0x1f44da[_0x1455('0x39')]=_['intersection'](_0x181a0d[_0x1455('0x38')],qs['fields'](_0x409017[_0x1455('0x35')]['fields']));_0x1f44da[_0x1455('0x39')]=_0x1f44da[_0x1455('0x39')][_0x1455('0x3b')]?_0x1f44da[_0x1455('0x39')]:_0x181a0d[_0x1455('0x38')];if(!_0x409017[_0x1455('0x35')][_0x1455('0x52')](_0x1455('0x3c'))){_0x1f44da['limit']=qs['limit'](_0x409017['query'][_0x1455('0x22')]);_0x1f44da[_0x1455('0x21')]=qs[_0x1455('0x21')](_0x409017[_0x1455('0x35')][_0x1455('0x21')]);}_0x1f44da[_0x1455('0x3d')]=qs['sort'](_0x409017[_0x1455('0x35')][_0x1455('0x3e')]);_0x1f44da[_0x1455('0x40')]=qs[_0x1455('0x37')](_[_0x1455('0x3f')](_0x409017[_0x1455('0x35')],_0x181a0d[_0x1455('0x37')]));if(_0x409017['query'][_0x1455('0x42')]){_0x1f44da['where']=_[_0x1455('0x43')](_0x1f44da[_0x1455('0x40')],{'$or':_[_0x1455('0x34')](_0x1f44da[_0x1455('0x39')],function(_0x383252){var _0x5d743c={};_0x5d743c[_0x383252]={'$like':'%'+_0x409017['query'][_0x1455('0x42')]+'%'};return _0x5d743c;})});}_0x1f44da=_[_0x1455('0x43')]({},_0x1f44da,_0x409017[_0x1455('0x44')]);var _0x2f9b22={'where':_0x1f44da['where']};return db[_0x1455('0x2f')][_0x1455('0x45')](_0x2f9b22)[_0x1455('0x27')](function(_0x50db2b){_0x769e6b[_0x1455('0x45')]=_0x50db2b;if(_0x409017[_0x1455('0x35')]['includeAll']){_0x1f44da[_0x1455('0x47')]=[{'all':!![]}];}return db[_0x1455('0x2f')][_0x1455('0x48')](_0x1f44da);})['then'](function(_0x5f41ab){_0x769e6b[_0x1455('0x53')]=_0x5f41ab;return _0x769e6b;})[_0x1455('0x27')](respondWithFilteredResult(_0x58a569,_0x1f44da,'getVoiceQueuesReport'))[_0x1455('0x4d')](handleError(_0x58a569,null,_0x1455('0x51')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 8dd505c..3324eee 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 _0xbb93=['remove','emit','hasOwnProperty','hook','events','VoiceQueueReport','save'];(function(_0x56e44a,_0x23c7e6){var _0x3fa7c=function(_0x4fb7f2){while(--_0x4fb7f2){_0x56e44a['push'](_0x56e44a['shift']());}};_0x3fa7c(++_0x23c7e6);}(_0xbb93,0x170));var _0x3bb9=function(_0x4ea983,_0x3a325a){_0x4ea983=_0x4ea983-0x0;var _0x5c0a16=_0xbb93[_0x4ea983];return _0x5c0a16;};'use strict';var EventEmitter=require(_0x3bb9('0x0'));var VoiceQueueReport=require('../../mysqldb')['db'][_0x3bb9('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3bb9('0x2'),'afterUpdate':'update','afterDestroy':_0x3bb9('0x3')};function emitEvent(_0x5b027e){return function(_0x1a6757,_0x1b5063,_0x4abd17){VoiceQueueReportEvents[_0x3bb9('0x4')](_0x5b027e+':'+_0x1a6757['id'],_0x1a6757);VoiceQueueReportEvents[_0x3bb9('0x4')](_0x5b027e,_0x1a6757);_0x4abd17(null);};}for(var e in events){if(events[_0x3bb9('0x5')](e)){var event=events[e];VoiceQueueReport[_0x3bb9('0x6')](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file +var _0x00cf=['hasOwnProperty','hook','exports','events','../../mysqldb','VoiceQueueReport','setMaxListeners','save','update','remove'];(function(_0x49e46d,_0x3550a3){var _0xa8aa24=function(_0x1161aa){while(--_0x1161aa){_0x49e46d['push'](_0x49e46d['shift']());}};_0xa8aa24(++_0x3550a3);}(_0x00cf,0x19d));var _0xf00c=function(_0x22430d,_0x1fcd17){_0x22430d=_0x22430d-0x0;var _0x5d2ea0=_0x00cf[_0x22430d];return _0x5d2ea0;};'use strict';var EventEmitter=require(_0xf00c('0x0'));var VoiceQueueReport=require(_0xf00c('0x1'))['db'][_0xf00c('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xf00c('0x3')](0x0);var events={'afterCreate':_0xf00c('0x4'),'afterUpdate':_0xf00c('0x5'),'afterDestroy':_0xf00c('0x6')};function emitEvent(_0x41cb0f){return function(_0x1b285c,_0x2eb79c,_0x53a114){VoiceQueueReportEvents['emit'](_0x41cb0f+':'+_0x1b285c['id'],_0x1b285c);VoiceQueueReportEvents['emit'](_0x41cb0f,_0x1b285c);_0x53a114(null);};}for(var e in events){if(events[_0xf00c('0x7')](e)){var event=events[e];VoiceQueueReport[_0xf00c('0x8')](e,emitEvent(event));}}module[_0xf00c('0x9')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 3381dae..bfc8be8 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 _0x9997=['report_queue','uniqueid','calleridnum','lodash','util','../../config/logger','moment','request-promise','rimraf','../../config/environment','./voiceQueueReport.attributes','exports','define','VoiceQueueReport'];(function(_0x3b7b8a,_0x52c3b0){var _0x441206=function(_0x5d34d3){while(--_0x5d34d3){_0x3b7b8a['push'](_0x3b7b8a['shift']());}};_0x441206(++_0x52c3b0);}(_0x9997,0xb9));var _0x7999=function(_0x16a223,_0x31b6e8){_0x16a223=_0x16a223-0x0;var _0x5ded66=_0x9997[_0x16a223];return _0x5ded66;};'use strict';var _=require(_0x7999('0x0'));var util=require(_0x7999('0x1'));var logger=require(_0x7999('0x2'))('api');var moment=require(_0x7999('0x3'));var BPromise=require('bluebird');var rp=require(_0x7999('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7999('0x5'));var config=require(_0x7999('0x6'));var attributes=require(_0x7999('0x7'));module[_0x7999('0x8')]=function(_0x1e3748,_0x16679f){return _0x1e3748[_0x7999('0x9')](_0x7999('0xa'),attributes,{'tableName':_0x7999('0xb'),'paranoid':![],'indexes':[{'fields':[_0x7999('0xc')]},{'fields':[_0x7999('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x121f=['bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueueReport.attributes','exports','VoiceQueueReport','report_queue','uniqueid','calleridnum','util','../../config/logger','api','moment'];(function(_0x2977b6,_0x4a3c73){var _0x582ece=function(_0x27d131){while(--_0x27d131){_0x2977b6['push'](_0x2977b6['shift']());}};_0x582ece(++_0x4a3c73);}(_0x121f,0xce));var _0xf121=function(_0x325501,_0x5242f6){_0x325501=_0x325501-0x0;var _0x2c1626=_0x121f[_0x325501];return _0x2c1626;};'use strict';var _=require('lodash');var util=require(_0xf121('0x0'));var logger=require(_0xf121('0x1'))(_0xf121('0x2'));var moment=require(_0xf121('0x3'));var BPromise=require(_0xf121('0x4'));var rp=require(_0xf121('0x5'));var fs=require('fs');var path=require(_0xf121('0x6'));var rimraf=require(_0xf121('0x7'));var config=require(_0xf121('0x8'));var attributes=require(_0xf121('0x9'));module[_0xf121('0xa')]=function(_0x5ce020,_0x1674f8){return _0x5ce020['define'](_0xf121('0xb'),attributes,{'tableName':_0xf121('0xc'),'paranoid':![],'indexes':[{'fields':[_0xf121('0xd')]},{'fields':[_0xf121('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 8abb8a5..c6b4088 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 _0x351a=['catch','VoiceQueueReport','findAll','options','raw','where','attributes','limit','include','map','model','CreateVoiceQueueReport','create','UpdateVoiceQueueReport','body','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','then','info','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceQueueReport,\x20%s,\x20%s','message','result'];(function(_0x59c5a1,_0x239bfa){var _0x17170f=function(_0x58e3e1){while(--_0x58e3e1){_0x59c5a1['push'](_0x59c5a1['shift']());}};_0x17170f(++_0x239bfa);}(_0x351a,0x69));var _0xa351=function(_0x587845,_0x3115b9){_0x587845=_0x587845-0x0;var _0x1c2292=_0x351a[_0x587845];return _0x1c2292;};'use strict';var _=require(_0xa351('0x0'));var util=require(_0xa351('0x1'));var moment=require('moment');var BPromise=require(_0xa351('0x2'));var rs=require(_0xa351('0x3'));var fs=require('fs');var Redis=require(_0xa351('0x4'));var db=require(_0xa351('0x5'))['db'];var utils=require(_0xa351('0x6'));var logger=require(_0xa351('0x7'))(_0xa351('0x8'));var config=require('../../config/environment');var jayson=require(_0xa351('0x9'));var client=jayson[_0xa351('0xa')][_0xa351('0xb')]({'port':0x232a});config[_0xa351('0xc')]=_[_0xa351('0xd')](config[_0xa351('0xc')],{'host':_0xa351('0xe'),'port':0x18eb});var socket=require(_0xa351('0xf'))(new Redis(config[_0xa351('0xc')]));require(_0xa351('0x10'))[_0xa351('0x11')](socket);function respondWithRpcPromise(_0x24f2e2,_0x40da7c,_0x208c1a){return new BPromise(function(_0x18052c,_0x4cb105){return client[_0xa351('0x12')](_0x24f2e2,_0x208c1a)[_0xa351('0x13')](function(_0x3567f0){logger[_0xa351('0x14')]('VoiceQueueReport,\x20%s,\x20%s',_0x40da7c,_0xa351('0x15'));logger[_0xa351('0x16')](_0xa351('0x17'),_0x40da7c,'request\x20sent',JSON[_0xa351('0x18')](_0x3567f0));if(_0x3567f0[_0xa351('0x19')]){if(_0x3567f0[_0xa351('0x19')][_0xa351('0x1a')]===0x1f4){logger[_0xa351('0x19')](_0xa351('0x1b'),_0x40da7c,_0x3567f0[_0xa351('0x19')][_0xa351('0x1c')]);return _0x4cb105(_0x3567f0['error'][_0xa351('0x1c')]);}logger[_0xa351('0x19')]('VoiceQueueReport,\x20%s,\x20%s',_0x40da7c,_0x3567f0[_0xa351('0x19')][_0xa351('0x1c')]);return _0x18052c(_0x3567f0[_0xa351('0x19')][_0xa351('0x1c')]);}else{logger['info'](_0xa351('0x1b'),_0x40da7c,_0xa351('0x15'));_0x18052c(_0x3567f0[_0xa351('0x1d')][_0xa351('0x1c')]);}})[_0xa351('0x1e')](function(_0x299599){logger[_0xa351('0x19')]('VoiceQueueReport,\x20%s,\x20%s',_0x40da7c,_0x299599);_0x4cb105(_0x299599);});});}exports['GetVoiceQueueReport']=function(_0xa05cad){var _0x205df9=this;return new Promise(function(_0x613444,_0x4a58a5){return db[_0xa351('0x1f')][_0xa351('0x20')]({'raw':_0xa05cad[_0xa351('0x21')]?_0xa05cad['options'][_0xa351('0x22')]===undefined?!![]:![]:!![],'where':_0xa05cad[_0xa351('0x21')]?_0xa05cad[_0xa351('0x21')][_0xa351('0x23')]||null:null,'attributes':_0xa05cad[_0xa351('0x21')]?_0xa05cad[_0xa351('0x21')][_0xa351('0x24')]||null:null,'limit':_0xa05cad[_0xa351('0x21')]?_0xa05cad['options'][_0xa351('0x25')]||null:null,'include':_0xa05cad['options']?_0xa05cad[_0xa351('0x21')][_0xa351('0x26')]?_[_0xa351('0x27')](_0xa05cad[_0xa351('0x21')]['include'],function(_0x50f8d1){return{'model':db[_0x50f8d1['model']],'as':_0x50f8d1['as'],'attributes':_0x50f8d1[_0xa351('0x24')],'include':_0x50f8d1['include']?_[_0xa351('0x27')](_0x50f8d1[_0xa351('0x26')],function(_0x1b2c54){return{'model':db[_0x1b2c54[_0xa351('0x28')]],'as':_0x1b2c54['as'],'attributes':_0x1b2c54['attributes'],'include':_0x1b2c54[_0xa351('0x26')]?_['map'](_0x1b2c54[_0xa351('0x26')],function(_0x3f7631){return{'model':db[_0x3f7631[_0xa351('0x28')]],'as':_0x3f7631['as'],'attributes':_0x3f7631[_0xa351('0x24')]};}):[]};}):[]};}):[]:[]})[_0xa351('0x13')](function(_0x998e3e){logger[_0xa351('0x14')]('GetVoiceQueueReport',_0xa05cad);logger[_0xa351('0x16')]('GetVoiceQueueReport',_0xa05cad,JSON[_0xa351('0x18')](_0x998e3e));_0x613444(_0x998e3e);})[_0xa351('0x1e')](function(_0x57f49c){logger[_0xa351('0x19')]('GetVoiceQueueReport',_0x57f49c['message'],_0xa05cad);_0x4a58a5(_0x205df9[_0xa351('0x19')](0x1f4,_0x57f49c[_0xa351('0x1c')]));});});};exports[_0xa351('0x29')]=function(_0x233e97){var _0x13e042=this;return new Promise(function(_0x296a38,_0x597194){return db[_0xa351('0x1f')][_0xa351('0x2a')](_0x233e97['body'],{'raw':_0x233e97[_0xa351('0x21')]?_0x233e97[_0xa351('0x21')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x43a12f){logger[_0xa351('0x14')](_0xa351('0x29'),_0x233e97);logger['debug']('CreateVoiceQueueReport',_0x233e97,JSON[_0xa351('0x18')](_0x43a12f));_0x296a38(_0x43a12f);})[_0xa351('0x1e')](function(_0x34ef6a){logger['error']('CreateVoiceQueueReport',_0x34ef6a[_0xa351('0x1c')],_0x233e97);_0x597194(_0x13e042[_0xa351('0x19')](0x1f4,_0x34ef6a[_0xa351('0x1c')]));});});};exports[_0xa351('0x2b')]=function(_0x503731){var _0x1dfad9=this;return new Promise(function(_0x39992f,_0x422e2c){return db[_0xa351('0x1f')]['update'](_0x503731[_0xa351('0x2c')],{'raw':_0x503731['options']?_0x503731['options'][_0xa351('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x503731[_0xa351('0x21')]?_0x503731[_0xa351('0x21')][_0xa351('0x23')]||null:null,'attributes':_0x503731['options']?_0x503731['options']['attributes']||null:null,'limit':_0x503731['options']?_0x503731[_0xa351('0x21')][_0xa351('0x25')]||null:null})[_0xa351('0x13')](function(_0x4c6a0d){logger[_0xa351('0x14')](_0xa351('0x2b'),_0x503731);logger[_0xa351('0x16')](_0xa351('0x2b'),_0x503731,JSON['stringify'](_0x4c6a0d));_0x39992f(_0x4c6a0d);})[_0xa351('0x1e')](function(_0x110e93){logger[_0xa351('0x19')](_0xa351('0x2b'),_0x110e93[_0xa351('0x1c')],_0x503731);_0x422e2c(_0x1dfad9['error'](0x1f4,_0x110e93['message']));});});}; \ No newline at end of file +var _0xf6da=['VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','where','attributes','limit','include','map','model','CreateVoiceQueueReport','create','body','raw','debug','UpdateVoiceQueueReport','update','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','jayson/promise','client','redis','localhost','socket.io-emitter','register','request','then','VoiceQueueReport,\x20%s,\x20%s','request\x20sent'];(function(_0x17a7e1,_0x39959a){var _0x355e76=function(_0x4a5cc8){while(--_0x4a5cc8){_0x17a7e1['push'](_0x17a7e1['shift']());}};_0x355e76(++_0x39959a);}(_0xf6da,0x18a));var _0xaf6d=function(_0x349823,_0x380ae9){_0x349823=_0x349823-0x0;var _0x3ce632=_0xf6da[_0x349823];return _0x3ce632;};'use strict';var _=require(_0xaf6d('0x0'));var util=require(_0xaf6d('0x1'));var moment=require('moment');var BPromise=require(_0xaf6d('0x2'));var rs=require(_0xaf6d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaf6d('0x4'))['db'];var utils=require(_0xaf6d('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xaf6d('0x6'));var client=jayson[_0xaf6d('0x7')]['http']({'port':0x232a});config[_0xaf6d('0x8')]=_['defaults'](config[_0xaf6d('0x8')],{'host':_0xaf6d('0x9'),'port':0x18eb});var socket=require(_0xaf6d('0xa'))(new Redis(config['redis']));require('./voiceQueueReport.socket')[_0xaf6d('0xb')](socket);function respondWithRpcPromise(_0x36a5fb,_0x3212ae,_0x5d53fc){return new BPromise(function(_0x3634b7,_0x1f20ad){return client[_0xaf6d('0xc')](_0x36a5fb,_0x5d53fc)[_0xaf6d('0xd')](function(_0x36bdfe){logger['info'](_0xaf6d('0xe'),_0x3212ae,_0xaf6d('0xf'));logger['debug'](_0xaf6d('0x10'),_0x3212ae,'request\x20sent',JSON[_0xaf6d('0x11')](_0x36bdfe));if(_0x36bdfe[_0xaf6d('0x12')]){if(_0x36bdfe['error'][_0xaf6d('0x13')]===0x1f4){logger[_0xaf6d('0x12')]('VoiceQueueReport,\x20%s,\x20%s',_0x3212ae,_0x36bdfe[_0xaf6d('0x12')][_0xaf6d('0x14')]);return _0x1f20ad(_0x36bdfe[_0xaf6d('0x12')]['message']);}logger[_0xaf6d('0x12')]('VoiceQueueReport,\x20%s,\x20%s',_0x3212ae,_0x36bdfe['error'][_0xaf6d('0x14')]);return _0x3634b7(_0x36bdfe[_0xaf6d('0x12')][_0xaf6d('0x14')]);}else{logger[_0xaf6d('0x15')]('VoiceQueueReport,\x20%s,\x20%s',_0x3212ae,_0xaf6d('0xf'));_0x3634b7(_0x36bdfe[_0xaf6d('0x16')][_0xaf6d('0x14')]);}})[_0xaf6d('0x17')](function(_0xe34cda){logger[_0xaf6d('0x12')](_0xaf6d('0xe'),_0x3212ae,_0xe34cda);_0x1f20ad(_0xe34cda);});});}exports[_0xaf6d('0x18')]=function(_0x41e66d){var _0x233402=this;return new Promise(function(_0x245fef,_0x37c18c){return db[_0xaf6d('0x19')][_0xaf6d('0x1a')]({'raw':_0x41e66d[_0xaf6d('0x1b')]?_0x41e66d[_0xaf6d('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x41e66d[_0xaf6d('0x1b')]?_0x41e66d['options'][_0xaf6d('0x1c')]||null:null,'attributes':_0x41e66d['options']?_0x41e66d[_0xaf6d('0x1b')][_0xaf6d('0x1d')]||null:null,'limit':_0x41e66d['options']?_0x41e66d[_0xaf6d('0x1b')][_0xaf6d('0x1e')]||null:null,'include':_0x41e66d[_0xaf6d('0x1b')]?_0x41e66d[_0xaf6d('0x1b')]['include']?_['map'](_0x41e66d[_0xaf6d('0x1b')]['include'],function(_0x4feaaa){return{'model':db[_0x4feaaa['model']],'as':_0x4feaaa['as'],'attributes':_0x4feaaa[_0xaf6d('0x1d')],'include':_0x4feaaa[_0xaf6d('0x1f')]?_[_0xaf6d('0x20')](_0x4feaaa[_0xaf6d('0x1f')],function(_0x5df9b4){return{'model':db[_0x5df9b4[_0xaf6d('0x21')]],'as':_0x5df9b4['as'],'attributes':_0x5df9b4[_0xaf6d('0x1d')],'include':_0x5df9b4[_0xaf6d('0x1f')]?_['map'](_0x5df9b4[_0xaf6d('0x1f')],function(_0x3a0bef){return{'model':db[_0x3a0bef[_0xaf6d('0x21')]],'as':_0x3a0bef['as'],'attributes':_0x3a0bef[_0xaf6d('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xaf6d('0xd')](function(_0x26dcd2){logger[_0xaf6d('0x15')](_0xaf6d('0x18'),_0x41e66d);logger['debug']('GetVoiceQueueReport',_0x41e66d,JSON[_0xaf6d('0x11')](_0x26dcd2));_0x245fef(_0x26dcd2);})[_0xaf6d('0x17')](function(_0x5f3fea){logger['error'](_0xaf6d('0x18'),_0x5f3fea[_0xaf6d('0x14')],_0x41e66d);_0x37c18c(_0x233402[_0xaf6d('0x12')](0x1f4,_0x5f3fea[_0xaf6d('0x14')]));});});};exports[_0xaf6d('0x22')]=function(_0x1bd63c){var _0x2f209b=this;return new Promise(function(_0x455492,_0x55d20a){return db[_0xaf6d('0x19')][_0xaf6d('0x23')](_0x1bd63c[_0xaf6d('0x24')],{'raw':_0x1bd63c[_0xaf6d('0x1b')]?_0x1bd63c['options'][_0xaf6d('0x25')]===undefined?!![]:![]:!![]})['then'](function(_0x136628){logger[_0xaf6d('0x15')](_0xaf6d('0x22'),_0x1bd63c);logger[_0xaf6d('0x26')]('CreateVoiceQueueReport',_0x1bd63c,JSON['stringify'](_0x136628));_0x455492(_0x136628);})[_0xaf6d('0x17')](function(_0x24ebd0){logger[_0xaf6d('0x12')]('CreateVoiceQueueReport',_0x24ebd0[_0xaf6d('0x14')],_0x1bd63c);_0x55d20a(_0x2f209b[_0xaf6d('0x12')](0x1f4,_0x24ebd0[_0xaf6d('0x14')]));});});};exports[_0xaf6d('0x27')]=function(_0x6a4416){var _0x24ef01=this;return new Promise(function(_0xd73b0,_0x5d5692){return db[_0xaf6d('0x19')][_0xaf6d('0x28')](_0x6a4416[_0xaf6d('0x24')],{'raw':_0x6a4416[_0xaf6d('0x1b')]?_0x6a4416[_0xaf6d('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x6a4416['options']?_0x6a4416[_0xaf6d('0x1b')][_0xaf6d('0x1c')]||null:null,'attributes':_0x6a4416[_0xaf6d('0x1b')]?_0x6a4416[_0xaf6d('0x1b')]['attributes']||null:null,'limit':_0x6a4416['options']?_0x6a4416[_0xaf6d('0x1b')][_0xaf6d('0x1e')]||null:null})['then'](function(_0x1fea32){logger[_0xaf6d('0x15')](_0xaf6d('0x27'),_0x6a4416);logger[_0xaf6d('0x26')](_0xaf6d('0x27'),_0x6a4416,JSON[_0xaf6d('0x11')](_0x1fea32));_0xd73b0(_0x1fea32);})['catch'](function(_0x4931e8){logger[_0xaf6d('0x12')](_0xaf6d('0x27'),_0x4931e8[_0xaf6d('0x14')],_0x6a4416);_0x5d5692(_0x24ef01[_0xaf6d('0x12')](0x1f4,_0x4931e8[_0xaf6d('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 316e57e..57daf24 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 _0xbe22=['save','emit','removeListener','register','length','./voiceQueueReport.events'];(function(_0x4090c2,_0x1f6da9){var _0x14d3dd=function(_0x8d95d2){while(--_0x8d95d2){_0x4090c2['push'](_0x4090c2['shift']());}};_0x14d3dd(++_0x1f6da9);}(_0xbe22,0x1c1));var _0x2be2=function(_0x30a1d5,_0x5e0612){_0x30a1d5=_0x30a1d5-0x0;var _0x22ae28=_0xbe22[_0x30a1d5];return _0x22ae28;};'use strict';var VoiceQueueReportEvents=require(_0x2be2('0x0'));var events=[_0x2be2('0x1'),'remove','update'];function createListener(_0x332458,_0x20a08c){return function(_0xf16dc5){_0x20a08c[_0x2be2('0x2')](_0x332458,_0xf16dc5);};}function removeListener(_0x1729d7,_0x250c97){return function(){VoiceQueueReportEvents[_0x2be2('0x3')](_0x1729d7,_0x250c97);};}exports[_0x2be2('0x4')]=function(_0x1b3bde){for(var _0x3a4d77=0x0,_0x59740c=events[_0x2be2('0x5')];_0x3a4d77<_0x59740c;_0x3a4d77++){var _0x27e1a9=events[_0x3a4d77];var _0x12d9b4=createListener('voiceQueueReport:'+_0x27e1a9,_0x1b3bde);VoiceQueueReportEvents['on'](_0x27e1a9,_0x12d9b4);}}; \ No newline at end of file +var _0x4397=['update','emit','removeListener','voiceQueueReport:','./voiceQueueReport.events','save','remove'];(function(_0x16000f,_0x1667e8){var _0x2f51a7=function(_0x44800b){while(--_0x44800b){_0x16000f['push'](_0x16000f['shift']());}};_0x2f51a7(++_0x1667e8);}(_0x4397,0xe4));var _0x7439=function(_0x2f6f50,_0x1d21a7){_0x2f6f50=_0x2f6f50-0x0;var _0x2cf365=_0x4397[_0x2f6f50];return _0x2cf365;};'use strict';var VoiceQueueReportEvents=require(_0x7439('0x0'));var events=[_0x7439('0x1'),_0x7439('0x2'),_0x7439('0x3')];function createListener(_0x2e0b05,_0x559f14){return function(_0x12c2be){_0x559f14[_0x7439('0x4')](_0x2e0b05,_0x12c2be);};}function removeListener(_0xe30683,_0x238d9d){return function(){VoiceQueueReportEvents[_0x7439('0x5')](_0xe30683,_0x238d9d);};}exports['register']=function(_0x53caf4){for(var _0x44f245=0x0,_0x2a79d8=events['length'];_0x44f245<_0x2a79d8;_0x44f245++){var _0x2ea297=events[_0x44f245];var _0x7d93d5=createListener(_0x7439('0x6')+_0x2ea297,_0x53caf4);VoiceQueueReportEvents['on'](_0x2ea297,_0x7d93d5);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 0163b5d..6235287 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 _0x2a59=['../../components/auth/service','../../components/interaction/service','./voiceQueuesLog.controller','get','index','/:id','show','post','put','isAuthenticated','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra'];(function(_0x2df507,_0x553862){var _0x1f7167=function(_0x11319e){while(--_0x11319e){_0x2df507['push'](_0x2df507['shift']());}};_0x1f7167(++_0x553862);}(_0x2a59,0x13a));var _0x92a5=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x2a59[_0x21a9d9];return _0x46adce;};'use strict';var multer=require(_0x92a5('0x0'));var util=require(_0x92a5('0x1'));var path=require(_0x92a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x92a5('0x3'));var router=express[_0x92a5('0x4')]();var fs_extra=require(_0x92a5('0x5'));var auth=require(_0x92a5('0x6'));var interaction=require(_0x92a5('0x7'));var config=require('../../config/environment');var controller=require(_0x92a5('0x8'));router[_0x92a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x92a5('0xa')]);router['get'](_0x92a5('0xb'),auth['isAuthenticated'](),controller[_0x92a5('0xc')]);router[_0x92a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x92a5('0xe')](_0x92a5('0xb'),auth[_0x92a5('0xf')](),controller[_0x92a5('0x10')]);router[_0x92a5('0x11')](_0x92a5('0xb'),auth['isAuthenticated'](),controller[_0x92a5('0x12')]);module[_0x92a5('0x13')]=router; \ No newline at end of file +var _0x2e89=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceQueuesLog.controller','isAuthenticated','get','/:id','show','post','create','update','delete','multer','util','path','connect-timeout'];(function(_0x3aa163,_0x310e59){var _0x29d9f2=function(_0x368d3a){while(--_0x368d3a){_0x3aa163['push'](_0x3aa163['shift']());}};_0x29d9f2(++_0x310e59);}(_0x2e89,0x1e9));var _0x92e8=function(_0x3c0572,_0x5bbabd){_0x3c0572=_0x3c0572-0x0;var _0x1dc0a6=_0x2e89[_0x3c0572];return _0x1dc0a6;};'use strict';var multer=require(_0x92e8('0x0'));var util=require(_0x92e8('0x1'));var path=require(_0x92e8('0x2'));var timeout=require(_0x92e8('0x3'));var express=require('express');var router=express[_0x92e8('0x4')]();var fs_extra=require(_0x92e8('0x5'));var auth=require(_0x92e8('0x6'));var interaction=require(_0x92e8('0x7'));var config=require('../../config/environment');var controller=require(_0x92e8('0x8'));router['get']('/',auth[_0x92e8('0x9')](),controller['index']);router[_0x92e8('0xa')](_0x92e8('0xb'),auth[_0x92e8('0x9')](),controller[_0x92e8('0xc')]);router[_0x92e8('0xd')]('/',auth['isAuthenticated'](),controller[_0x92e8('0xe')]);router['put'](_0x92e8('0xb'),auth['isAuthenticated'](),controller[_0x92e8('0xf')]);router[_0x92e8('0x10')](_0x92e8('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 57224d0..8421f91 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 _0x9e42=['YYYY-MM-DD\x20HH:mm:ss','moment','exports','STRING','DATE','format'];(function(_0x1a7930,_0x48c9e3){var _0x5627b5=function(_0x52b021){while(--_0x52b021){_0x1a7930['push'](_0x1a7930['shift']());}};_0x5627b5(++_0x48c9e3);}(_0x9e42,0x157));var _0x29e4=function(_0x1d04b5,_0x30792c){_0x1d04b5=_0x1d04b5-0x0;var _0x161342=_0x9e42[_0x1d04b5];return _0x161342;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x29e4('0x0'));module[_0x29e4('0x1')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0x29e4('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x29e4('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x29e4('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x29e4('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x29e4('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x29e4('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x29e4('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x29e4('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x29e4('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x29e4('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x29e4('0x3')],'allowNull':![],'defaultValue':moment()[_0x29e4('0x4')](_0x29e4('0x5'))}}; \ No newline at end of file +var _0xa1d5=['exports','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','sequelize'];(function(_0x538767,_0x23cac2){var _0x4743f1=function(_0x47efc6){while(--_0x47efc6){_0x538767['push'](_0x538767['shift']());}};_0x4743f1(++_0x23cac2);}(_0xa1d5,0x191));var _0x5a1d=function(_0x4a5bb4,_0x4b8424){_0x4a5bb4=_0x4a5bb4-0x0;var _0x20cd95=_0xa1d5[_0x4a5bb4];return _0x20cd95;};'use strict';var Sequelize=require(_0x5a1d('0x0'));var moment=require('moment');module[_0x5a1d('0x1')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x5a1d('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x5a1d('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x5a1d('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x5a1d('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x5a1d('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x5a1d('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x5a1d('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x5a1d('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x5a1d('0x3')],'allowNull':![],'defaultValue':moment()[_0x5a1d('0x4')](_0x5a1d('0x5'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index f99b698..da81816 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 _0xa0b6=['merge','map','VIRTUAL','rows','catch','params','includeAll','include','options','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','fs-extra','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','destroy','stack','name','VoiceQueuesLog','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','order','sort','where','pick'];(function(_0x4c7907,_0x5e97cc){var _0x42c124=function(_0x245603){while(--_0x245603){_0x4c7907['push'](_0x4c7907['shift']());}};_0x42c124(++_0x5e97cc);}(_0xa0b6,0x124));var _0x6a0b=function(_0x487b0c,_0x14ff74){_0x487b0c=_0x487b0c-0x0;var _0x1adbdc=_0xa0b6[_0x487b0c];return _0x1adbdc;};'use strict';var emlformat=require(_0x6a0b('0x0'));var rimraf=require(_0x6a0b('0x1'));var zipdir=require(_0x6a0b('0x2'));var jsonpatch=require(_0x6a0b('0x3'));var rp=require('request-promise');var moment=require(_0x6a0b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6a0b('0x5'));var util=require(_0x6a0b('0x6'));var path=require(_0x6a0b('0x7'));var sox=require('sox');var csv=require(_0x6a0b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6a0b('0x9'));var _=require('lodash');var squel=require(_0x6a0b('0xa'));var crypto=require('crypto');var jsforce=require(_0x6a0b('0xb'));var deskjs=require(_0x6a0b('0xc'));var toCsv=require('to-csv');var querystring=require(_0x6a0b('0xd'));var Papa=require(_0x6a0b('0xe'));var Redis=require('ioredis');var authService=require(_0x6a0b('0xf'));var qs=require(_0x6a0b('0x10'));var as=require(_0x6a0b('0x11'));var hardwareService=require(_0x6a0b('0x12'));var logger=require(_0x6a0b('0x13'))(_0x6a0b('0x14'));var utils=require('../../config/utils');var config=require(_0x6a0b('0x15'));var licenseUtil=require(_0x6a0b('0x16'));var db=require(_0x6a0b('0x17'))['db'];function respondWithStatusCode(_0x5bec57,_0x1476a3){_0x1476a3=_0x1476a3||0xcc;return function(_0x143ae4){if(_0x143ae4){return _0x5bec57[_0x6a0b('0x18')](_0x1476a3);}return _0x5bec57[_0x6a0b('0x19')](_0x1476a3)[_0x6a0b('0x1a')]();};}function respondWithResult(_0xbd50,_0x38c6c6){_0x38c6c6=_0x38c6c6||0xc8;return function(_0x56ec31){if(_0x56ec31){return _0xbd50[_0x6a0b('0x19')](_0x38c6c6)['json'](_0x56ec31);}};}function respondWithFilteredResult(_0x3e6793,_0xac8787){return function(_0x396ffd){if(_0x396ffd){var _0x39de5e=typeof _0xac8787[_0x6a0b('0x1b')]===_0x6a0b('0x1c')&&typeof _0xac8787[_0x6a0b('0x1d')]===_0x6a0b('0x1c');var _0x5dee16=_0x396ffd[_0x6a0b('0x1e')];var _0x9ff7b8=_0x39de5e?0x0:_0xac8787[_0x6a0b('0x1b')];var _0x5e22fd=_0x39de5e?_0x396ffd[_0x6a0b('0x1e')]:_0xac8787[_0x6a0b('0x1b')]+_0xac8787['limit'];var _0x498900;if(_0x5e22fd>=_0x5dee16){_0x5e22fd=_0x5dee16;_0x498900=0xc8;}else{_0x498900=0xce;}_0x3e6793[_0x6a0b('0x19')](_0x498900);return _0x3e6793[_0x6a0b('0x1f')](_0x6a0b('0x20'),_0x9ff7b8+'-'+_0x5e22fd+'/'+_0x5dee16)[_0x6a0b('0x21')](_0x396ffd);}return null;};}function patchUpdates(_0x4df7d5){return function(_0x4b8dc9){try{jsonpatch[_0x6a0b('0x22')](_0x4b8dc9,_0x4df7d5,!![]);}catch(_0x31fd89){return BPromise['reject'](_0x31fd89);}return _0x4b8dc9[_0x6a0b('0x23')]();};}function saveUpdates(_0x4da19f,_0x44e222){return function(_0xdd87ec){if(_0xdd87ec){return _0xdd87ec[_0x6a0b('0x24')](_0x4da19f)[_0x6a0b('0x25')](function(_0x2c7f64){return _0x2c7f64;});}return null;};}function removeEntity(_0x3338b4,_0x2e886f){return function(_0x3818fa){if(_0x3818fa){return _0x3818fa[_0x6a0b('0x26')]()[_0x6a0b('0x25')](function(){_0x3338b4[_0x6a0b('0x19')](0xcc)[_0x6a0b('0x1a')]();});}};}function handleEntityNotFound(_0x40dbb4,_0x29a5ce){return function(_0x4a5550){if(!_0x4a5550){_0x40dbb4[_0x6a0b('0x18')](0x194);}return _0x4a5550;};}function handleError(_0x4e4b19,_0x4a954a){_0x4a954a=_0x4a954a||0x1f4;return function(_0x3d0c9f){logger['error'](_0x3d0c9f[_0x6a0b('0x27')]);if(_0x3d0c9f['name']){delete _0x3d0c9f[_0x6a0b('0x28')];}_0x4e4b19[_0x6a0b('0x19')](_0x4a954a)['send'](_0x3d0c9f);};}exports['index']=function(_0x5c8eb3,_0x5e4b12){var _0x5ec3a0={},_0x55976d={},_0x4f8210={'count':0x0,'rows':[]};var _0x5307d0=_['map'](db[_0x6a0b('0x29')][_0x6a0b('0x2a')],function(_0x13ec29){return{'name':_0x13ec29[_0x6a0b('0x2b')],'type':_0x13ec29[_0x6a0b('0x2c')][_0x6a0b('0x2d')]};});_0x55976d[_0x6a0b('0x2e')]=_['map'](_0x5307d0,'name');_0x55976d[_0x6a0b('0x2f')]=_[_0x6a0b('0x30')](_0x5c8eb3[_0x6a0b('0x2f')]);_0x55976d[_0x6a0b('0x31')]=_['intersection'](_0x55976d['model'],_0x55976d[_0x6a0b('0x2f')]);_0x5ec3a0[_0x6a0b('0x32')]=_[_0x6a0b('0x33')](_0x55976d[_0x6a0b('0x2e')],qs['fields'](_0x5c8eb3[_0x6a0b('0x2f')][_0x6a0b('0x34')]));_0x5ec3a0[_0x6a0b('0x32')]=_0x5ec3a0['attributes'][_0x6a0b('0x35')]?_0x5ec3a0[_0x6a0b('0x32')]:_0x55976d['model'];if(!_0x5c8eb3[_0x6a0b('0x2f')]['hasOwnProperty']('nolimit')){_0x5ec3a0[_0x6a0b('0x1d')]=qs[_0x6a0b('0x1d')](_0x5c8eb3[_0x6a0b('0x2f')][_0x6a0b('0x1d')]);_0x5ec3a0[_0x6a0b('0x1b')]=qs[_0x6a0b('0x1b')](_0x5c8eb3['query']['offset']);}_0x5ec3a0[_0x6a0b('0x36')]=qs[_0x6a0b('0x37')](_0x5c8eb3[_0x6a0b('0x2f')][_0x6a0b('0x37')]);_0x5ec3a0[_0x6a0b('0x38')]=qs[_0x6a0b('0x31')](_[_0x6a0b('0x39')](_0x5c8eb3[_0x6a0b('0x2f')],_0x55976d[_0x6a0b('0x31')]),_0x5307d0);if(_0x5c8eb3[_0x6a0b('0x2f')]['filter']){_0x5ec3a0['where']=_[_0x6a0b('0x3a')](_0x5ec3a0[_0x6a0b('0x38')],{'$or':_[_0x6a0b('0x3b')](_0x5307d0,function(_0xa93887){if(_0xa93887[_0x6a0b('0x2c')]!==_0x6a0b('0x3c')){var _0xfc2454={};_0xfc2454[_0xa93887['name']]={'$like':'%'+_0x5c8eb3[_0x6a0b('0x2f')]['filter']+'%'};return _0xfc2454;}})});}_0x5ec3a0=_[_0x6a0b('0x3a')]({},_0x5ec3a0,_0x5c8eb3['options']);var _0x2d3be9={'where':_0x5ec3a0['where']};return db[_0x6a0b('0x29')][_0x6a0b('0x1e')](_0x2d3be9)[_0x6a0b('0x25')](function(_0x406909){_0x4f8210[_0x6a0b('0x1e')]=_0x406909;if(_0x5c8eb3[_0x6a0b('0x2f')]['includeAll']){_0x5ec3a0['include']=[{'all':!![]}];}return db['VoiceQueuesLog']['findAll'](_0x5ec3a0);})[_0x6a0b('0x25')](function(_0xa124b1){_0x4f8210[_0x6a0b('0x3d')]=_0xa124b1;return _0x4f8210;})['then'](respondWithFilteredResult(_0x5e4b12,_0x5ec3a0))[_0x6a0b('0x3e')](handleError(_0x5e4b12,null));};exports['show']=function(_0x4d4372,_0x15b74b){var _0x3b8f22={'raw':!![],'where':{'id':_0x4d4372[_0x6a0b('0x3f')]['id']}},_0x2af8ba={};_0x2af8ba[_0x6a0b('0x2e')]=_[_0x6a0b('0x30')](db[_0x6a0b('0x29')][_0x6a0b('0x2a')]);_0x2af8ba[_0x6a0b('0x2f')]=_['keys'](_0x4d4372[_0x6a0b('0x2f')]);_0x2af8ba[_0x6a0b('0x31')]=_['intersection'](_0x2af8ba[_0x6a0b('0x2e')],_0x2af8ba[_0x6a0b('0x2f')]);_0x3b8f22[_0x6a0b('0x32')]=_[_0x6a0b('0x33')](_0x2af8ba['model'],qs[_0x6a0b('0x34')](_0x4d4372['query'][_0x6a0b('0x34')]));_0x3b8f22[_0x6a0b('0x32')]=_0x3b8f22[_0x6a0b('0x32')][_0x6a0b('0x35')]?_0x3b8f22['attributes']:_0x2af8ba['model'];if(_0x4d4372[_0x6a0b('0x2f')][_0x6a0b('0x40')]){_0x3b8f22[_0x6a0b('0x41')]=[{'all':!![]}];}_0x3b8f22=_['merge']({},_0x3b8f22,_0x4d4372[_0x6a0b('0x42')]);return db[_0x6a0b('0x29')][_0x6a0b('0x43')](_0x3b8f22)[_0x6a0b('0x25')](handleEntityNotFound(_0x15b74b,null))[_0x6a0b('0x25')](respondWithResult(_0x15b74b,null))[_0x6a0b('0x3e')](handleError(_0x15b74b,null));};exports[_0x6a0b('0x44')]=function(_0x3d94a7,_0x5ef4d5){return db[_0x6a0b('0x29')]['create'](_0x3d94a7[_0x6a0b('0x45')],{})[_0x6a0b('0x25')](respondWithResult(_0x5ef4d5,0xc9))[_0x6a0b('0x3e')](handleError(_0x5ef4d5,null));};exports[_0x6a0b('0x24')]=function(_0x43eb34,_0x452dc6){if(_0x43eb34[_0x6a0b('0x45')]['id']){delete _0x43eb34['body']['id'];}return db[_0x6a0b('0x29')]['find']({'where':{'id':_0x43eb34[_0x6a0b('0x3f')]['id']}})['then'](handleEntityNotFound(_0x452dc6,null))[_0x6a0b('0x25')](saveUpdates(_0x43eb34[_0x6a0b('0x45')],null))[_0x6a0b('0x25')](respondWithResult(_0x452dc6,null))[_0x6a0b('0x3e')](handleError(_0x452dc6,null));};exports[_0x6a0b('0x26')]=function(_0x53ce24,_0x5e9dd1){return db[_0x6a0b('0x29')][_0x6a0b('0x43')]({'where':{'id':_0x53ce24[_0x6a0b('0x3f')]['id']}})[_0x6a0b('0x25')](handleEntityNotFound(_0x5e9dd1,null))[_0x6a0b('0x25')](removeEntity(_0x5e9dd1,null))['catch'](handleError(_0x5e9dd1,null));}; \ No newline at end of file +var _0x245e=['squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','catch','show','params','includeAll','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x4b1e73,_0x14b5f1){var _0x3db1f4=function(_0x24235a){while(--_0x24235a){_0x4b1e73['push'](_0x4b1e73['shift']());}};_0x3db1f4(++_0x14b5f1);}(_0x245e,0xdf));var _0xe245=function(_0x4e23a5,_0x54ba03){_0x4e23a5=_0x4e23a5-0x0;var _0x3c9b18=_0x245e[_0x4e23a5];return _0x3c9b18;};'use strict';var emlformat=require(_0xe245('0x0'));var rimraf=require(_0xe245('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe245('0x2'));var rp=require(_0xe245('0x3'));var moment=require(_0xe245('0x4'));var BPromise=require(_0xe245('0x5'));var Mustache=require(_0xe245('0x6'));var util=require(_0xe245('0x7'));var path=require(_0xe245('0x8'));var sox=require(_0xe245('0x9'));var csv=require(_0xe245('0xa'));var ejs=require(_0xe245('0xb'));var fs=require('fs');var fs_extra=require(_0xe245('0xc'));var _=require(_0xe245('0xd'));var squel=require(_0xe245('0xe'));var crypto=require('crypto');var jsforce=require(_0xe245('0xf'));var deskjs=require(_0xe245('0x10'));var toCsv=require(_0xe245('0xa'));var querystring=require(_0xe245('0x11'));var Papa=require('papaparse');var Redis=require(_0xe245('0x12'));var authService=require(_0xe245('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe245('0x14'));var logger=require(_0xe245('0x15'))(_0xe245('0x16'));var utils=require(_0xe245('0x17'));var config=require(_0xe245('0x18'));var licenseUtil=require(_0xe245('0x19'));var db=require(_0xe245('0x1a'))['db'];function respondWithStatusCode(_0x3ef1dd,_0x26bfd3){_0x26bfd3=_0x26bfd3||0xcc;return function(_0x2d5d7f){if(_0x2d5d7f){return _0x3ef1dd[_0xe245('0x1b')](_0x26bfd3);}return _0x3ef1dd[_0xe245('0x1c')](_0x26bfd3)['end']();};}function respondWithResult(_0x4abf72,_0x147e2c){_0x147e2c=_0x147e2c||0xc8;return function(_0x54c1f7){if(_0x54c1f7){return _0x4abf72[_0xe245('0x1c')](_0x147e2c)[_0xe245('0x1d')](_0x54c1f7);}};}function respondWithFilteredResult(_0x3a6583,_0x5e3ad8){return function(_0x380f9f){if(_0x380f9f){var _0x75976a=typeof _0x5e3ad8['offset']===_0xe245('0x1e')&&typeof _0x5e3ad8['limit']===_0xe245('0x1e');var _0x625739=_0x380f9f[_0xe245('0x1f')];var _0x5f5ac6=_0x75976a?0x0:_0x5e3ad8[_0xe245('0x20')];var _0x4b56cf=_0x75976a?_0x380f9f[_0xe245('0x1f')]:_0x5e3ad8[_0xe245('0x20')]+_0x5e3ad8[_0xe245('0x21')];var _0x394459;if(_0x4b56cf>=_0x625739){_0x4b56cf=_0x625739;_0x394459=0xc8;}else{_0x394459=0xce;}_0x3a6583[_0xe245('0x1c')](_0x394459);return _0x3a6583[_0xe245('0x22')](_0xe245('0x23'),_0x5f5ac6+'-'+_0x4b56cf+'/'+_0x625739)[_0xe245('0x1d')](_0x380f9f);}return null;};}function patchUpdates(_0x27cef7){return function(_0x43a361){try{jsonpatch[_0xe245('0x24')](_0x43a361,_0x27cef7,!![]);}catch(_0x4b5318){return BPromise[_0xe245('0x25')](_0x4b5318);}return _0x43a361['save']();};}function saveUpdates(_0x8ac553,_0x36957f){return function(_0x4e98c6){if(_0x4e98c6){return _0x4e98c6[_0xe245('0x26')](_0x8ac553)[_0xe245('0x27')](function(_0x193081){return _0x193081;});}return null;};}function removeEntity(_0x4e7239,_0x5240a5){return function(_0x29fa88){if(_0x29fa88){return _0x29fa88[_0xe245('0x28')]()[_0xe245('0x27')](function(){_0x4e7239[_0xe245('0x1c')](0xcc)[_0xe245('0x29')]();});}};}function handleEntityNotFound(_0x192dde,_0x278489){return function(_0x4b9a69){if(!_0x4b9a69){_0x192dde[_0xe245('0x1b')](0x194);}return _0x4b9a69;};}function handleError(_0x3f6c49,_0xbd87a4){_0xbd87a4=_0xbd87a4||0x1f4;return function(_0x33abca){logger[_0xe245('0x2a')](_0x33abca[_0xe245('0x2b')]);if(_0x33abca[_0xe245('0x2c')]){delete _0x33abca[_0xe245('0x2c')];}_0x3f6c49[_0xe245('0x1c')](_0xbd87a4)[_0xe245('0x2d')](_0x33abca);};}exports[_0xe245('0x2e')]=function(_0x1de3ac,_0x19b375){var _0x1b76a3={},_0x431de5={},_0x58e3ff={'count':0x0,'rows':[]};var _0xf45806=_[_0xe245('0x2f')](db[_0xe245('0x30')][_0xe245('0x31')],function(_0x78e82f){return{'name':_0x78e82f[_0xe245('0x32')],'type':_0x78e82f[_0xe245('0x33')][_0xe245('0x34')]};});_0x431de5[_0xe245('0x35')]=_[_0xe245('0x2f')](_0xf45806,_0xe245('0x2c'));_0x431de5[_0xe245('0x36')]=_[_0xe245('0x37')](_0x1de3ac['query']);_0x431de5[_0xe245('0x38')]=_[_0xe245('0x39')](_0x431de5[_0xe245('0x35')],_0x431de5['query']);_0x1b76a3[_0xe245('0x3a')]=_[_0xe245('0x39')](_0x431de5[_0xe245('0x35')],qs[_0xe245('0x3b')](_0x1de3ac[_0xe245('0x36')][_0xe245('0x3b')]));_0x1b76a3[_0xe245('0x3a')]=_0x1b76a3[_0xe245('0x3a')][_0xe245('0x3c')]?_0x1b76a3[_0xe245('0x3a')]:_0x431de5[_0xe245('0x35')];if(!_0x1de3ac[_0xe245('0x36')][_0xe245('0x3d')](_0xe245('0x3e'))){_0x1b76a3[_0xe245('0x21')]=qs['limit'](_0x1de3ac['query'][_0xe245('0x21')]);_0x1b76a3[_0xe245('0x20')]=qs[_0xe245('0x20')](_0x1de3ac[_0xe245('0x36')][_0xe245('0x20')]);}_0x1b76a3[_0xe245('0x3f')]=qs[_0xe245('0x40')](_0x1de3ac['query'][_0xe245('0x40')]);_0x1b76a3[_0xe245('0x41')]=qs['filters'](_[_0xe245('0x42')](_0x1de3ac[_0xe245('0x36')],_0x431de5['filters']),_0xf45806);if(_0x1de3ac[_0xe245('0x36')][_0xe245('0x43')]){_0x1b76a3[_0xe245('0x41')]=_['merge'](_0x1b76a3[_0xe245('0x41')],{'$or':_[_0xe245('0x2f')](_0xf45806,function(_0x10c193){if(_0x10c193[_0xe245('0x33')]!=='VIRTUAL'){var _0x6ff6d8={};_0x6ff6d8[_0x10c193[_0xe245('0x2c')]]={'$like':'%'+_0x1de3ac[_0xe245('0x36')]['filter']+'%'};return _0x6ff6d8;}})});}_0x1b76a3=_[_0xe245('0x44')]({},_0x1b76a3,_0x1de3ac[_0xe245('0x45')]);var _0x148100={'where':_0x1b76a3[_0xe245('0x41')]};return db['VoiceQueuesLog'][_0xe245('0x1f')](_0x148100)[_0xe245('0x27')](function(_0xf4409){_0x58e3ff[_0xe245('0x1f')]=_0xf4409;if(_0x1de3ac[_0xe245('0x36')]['includeAll']){_0x1b76a3[_0xe245('0x46')]=[{'all':!![]}];}return db[_0xe245('0x30')][_0xe245('0x47')](_0x1b76a3);})[_0xe245('0x27')](function(_0x554162){_0x58e3ff['rows']=_0x554162;return _0x58e3ff;})[_0xe245('0x27')](respondWithFilteredResult(_0x19b375,_0x1b76a3))[_0xe245('0x48')](handleError(_0x19b375,null));};exports[_0xe245('0x49')]=function(_0x5a75dc,_0x44d743){var _0x41f064={'raw':!![],'where':{'id':_0x5a75dc[_0xe245('0x4a')]['id']}},_0xd3c652={};_0xd3c652['model']=_[_0xe245('0x37')](db['VoiceQueuesLog'][_0xe245('0x31')]);_0xd3c652[_0xe245('0x36')]=_[_0xe245('0x37')](_0x5a75dc[_0xe245('0x36')]);_0xd3c652[_0xe245('0x38')]=_['intersection'](_0xd3c652[_0xe245('0x35')],_0xd3c652[_0xe245('0x36')]);_0x41f064[_0xe245('0x3a')]=_[_0xe245('0x39')](_0xd3c652[_0xe245('0x35')],qs[_0xe245('0x3b')](_0x5a75dc[_0xe245('0x36')][_0xe245('0x3b')]));_0x41f064[_0xe245('0x3a')]=_0x41f064[_0xe245('0x3a')][_0xe245('0x3c')]?_0x41f064[_0xe245('0x3a')]:_0xd3c652[_0xe245('0x35')];if(_0x5a75dc[_0xe245('0x36')][_0xe245('0x4b')]){_0x41f064['include']=[{'all':!![]}];}_0x41f064=_[_0xe245('0x44')]({},_0x41f064,_0x5a75dc[_0xe245('0x45')]);return db[_0xe245('0x30')][_0xe245('0x4c')](_0x41f064)[_0xe245('0x27')](handleEntityNotFound(_0x44d743,null))['then'](respondWithResult(_0x44d743,null))['catch'](handleError(_0x44d743,null));};exports['create']=function(_0x5a5020,_0x183ef6){return db[_0xe245('0x30')][_0xe245('0x4d')](_0x5a5020[_0xe245('0x4e')],{})['then'](respondWithResult(_0x183ef6,0xc9))['catch'](handleError(_0x183ef6,null));};exports[_0xe245('0x26')]=function(_0x5c95d4,_0x4ca8bb){if(_0x5c95d4['body']['id']){delete _0x5c95d4[_0xe245('0x4e')]['id'];}return db['VoiceQueuesLog'][_0xe245('0x4c')]({'where':{'id':_0x5c95d4[_0xe245('0x4a')]['id']}})[_0xe245('0x27')](handleEntityNotFound(_0x4ca8bb,null))['then'](saveUpdates(_0x5c95d4[_0xe245('0x4e')],null))[_0xe245('0x27')](respondWithResult(_0x4ca8bb,null))[_0xe245('0x48')](handleError(_0x4ca8bb,null));};exports[_0xe245('0x28')]=function(_0x5df554,_0x3851e8){return db['VoiceQueuesLog']['find']({'where':{'id':_0x5df554[_0xe245('0x4a')]['id']}})[_0xe245('0x27')](handleEntityNotFound(_0x3851e8,null))[_0xe245('0x27')](removeEntity(_0x3851e8,null))[_0xe245('0x48')](handleError(_0x3851e8,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index c6954bd..8aedf2c 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 _0x9320=['api','moment','bluebird','path','rimraf','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','lodash','util','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9320,0xfd));var _0x0932=function(_0x23185c,_0x127536){_0x23185c=_0x23185c-0x0;var _0x48f084=_0x9320[_0x23185c];return _0x48f084;};'use strict';var _=require(_0x0932('0x0'));var util=require(_0x0932('0x1'));var logger=require(_0x0932('0x2'))(_0x0932('0x3'));var moment=require(_0x0932('0x4'));var BPromise=require(_0x0932('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0932('0x6'));var rimraf=require(_0x0932('0x7'));var config=require('../../config/environment');var attributes=require(_0x0932('0x8'));module[_0x0932('0x9')]=function(_0x3d54a3,_0x268f42){return _0x3d54a3[_0x0932('0xa')](_0x0932('0xb'),attributes,{'tableName':_0x0932('0xc'),'paranoid':![],'indexes':[{'name':_0x0932('0xd'),'fields':[_0x0932('0xe'),_0x0932('0xf')]}],'timestamps':![]});}; \ No newline at end of file +var _0x3fc3=['event_dtm','event','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','VoiceQueuesLog','voice_queues_log'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0x3fc3,0x110));var _0x33fc=function(_0x5f159f,_0x49867c){_0x5f159f=_0x5f159f-0x0;var _0x37a881=_0x3fc3[_0x5f159f];return _0x37a881;};'use strict';var _=require(_0x33fc('0x0'));var util=require(_0x33fc('0x1'));var logger=require(_0x33fc('0x2'))(_0x33fc('0x3'));var moment=require(_0x33fc('0x4'));var BPromise=require(_0x33fc('0x5'));var rp=require(_0x33fc('0x6'));var fs=require('fs');var path=require(_0x33fc('0x7'));var rimraf=require(_0x33fc('0x8'));var config=require(_0x33fc('0x9'));var attributes=require('./voiceQueuesLog.attributes');module[_0x33fc('0xa')]=function(_0x491a41,_0x5a4627){return _0x491a41['define'](_0x33fc('0xb'),attributes,{'tableName':_0x33fc('0xc'),'paranoid':![],'indexes':[{'name':_0x33fc('0xd'),'fields':[_0x33fc('0xe'),'dtm']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 8494f6c..c0e6228 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 _0x521b=['error','code','VoiceQueuesLog,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','request','then','info','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5333ba,_0x22e1bb){var _0x20f9dc=function(_0x1956af){while(--_0x1956af){_0x5333ba['push'](_0x5333ba['shift']());}};_0x20f9dc(++_0x22e1bb);}(_0x521b,0xd5));var _0xb521=function(_0x2f90c0,_0x5d162a){_0x2f90c0=_0x2f90c0-0x0;var _0x2e3552=_0x521b[_0x2f90c0];return _0x2e3552;};'use strict';var _=require(_0xb521('0x0'));var util=require(_0xb521('0x1'));var moment=require('moment');var BPromise=require(_0xb521('0x2'));var rs=require(_0xb521('0x3'));var fs=require('fs');var Redis=require(_0xb521('0x4'));var db=require(_0xb521('0x5'))['db'];var utils=require(_0xb521('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xb521('0x7'));var client=jayson[_0xb521('0x8')][_0xb521('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x871841,_0x341859,_0x13a9ef){return new BPromise(function(_0x1aa703,_0x5f0005){return client[_0xb521('0xa')](_0x871841,_0x13a9ef)[_0xb521('0xb')](function(_0x465f3e){logger[_0xb521('0xc')]('VoiceQueuesLog,\x20%s,\x20%s',_0x341859,_0xb521('0xd'));logger[_0xb521('0xe')](_0xb521('0xf'),_0x341859,_0xb521('0xd'),JSON[_0xb521('0x10')](_0x465f3e));if(_0x465f3e[_0xb521('0x11')]){if(_0x465f3e[_0xb521('0x11')][_0xb521('0x12')]===0x1f4){logger['error'](_0xb521('0x13'),_0x341859,_0x465f3e[_0xb521('0x11')][_0xb521('0x14')]);return _0x5f0005(_0x465f3e[_0xb521('0x11')][_0xb521('0x14')]);}logger[_0xb521('0x11')](_0xb521('0x13'),_0x341859,_0x465f3e[_0xb521('0x11')][_0xb521('0x14')]);return _0x1aa703(_0x465f3e[_0xb521('0x11')][_0xb521('0x14')]);}else{logger['info'](_0xb521('0x13'),_0x341859,_0xb521('0xd'));_0x1aa703(_0x465f3e[_0xb521('0x15')][_0xb521('0x14')]);}})[_0xb521('0x16')](function(_0x3dbb11){logger['error'](_0xb521('0x13'),_0x341859,_0x3dbb11);_0x5f0005(_0x3dbb11);});});} \ No newline at end of file +var _0x1663=['request','then','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','message','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x2da5e8,_0xf08ec4){var _0x5d0829=function(_0x204d51){while(--_0x204d51){_0x2da5e8['push'](_0x2da5e8['shift']());}};_0x5d0829(++_0xf08ec4);}(_0x1663,0x95));var _0x3166=function(_0x16cf86,_0x209a9a){_0x16cf86=_0x16cf86-0x0;var _0xb7b8cd=_0x1663[_0x16cf86];return _0xb7b8cd;};'use strict';var _=require('lodash');var util=require(_0x3166('0x0'));var moment=require('moment');var BPromise=require(_0x3166('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3166('0x2'));var db=require(_0x3166('0x3'))['db'];var utils=require(_0x3166('0x4'));var logger=require(_0x3166('0x5'))(_0x3166('0x6'));var config=require(_0x3166('0x7'));var jayson=require(_0x3166('0x8'));var client=jayson[_0x3166('0x9')][_0x3166('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x338308,_0x256a56,_0x2c7d74){return new BPromise(function(_0x4ac68e,_0x492c9f){return client[_0x3166('0xb')](_0x338308,_0x2c7d74)[_0x3166('0xc')](function(_0x2f22b4){logger['info'](_0x3166('0xd'),_0x256a56,_0x3166('0xe'));logger[_0x3166('0xf')](_0x3166('0x10'),_0x256a56,'request\x20sent',JSON[_0x3166('0x11')](_0x2f22b4));if(_0x2f22b4[_0x3166('0x12')]){if(_0x2f22b4['error']['code']===0x1f4){logger[_0x3166('0x12')](_0x3166('0xd'),_0x256a56,_0x2f22b4[_0x3166('0x12')]['message']);return _0x492c9f(_0x2f22b4['error'][_0x3166('0x13')]);}logger['error'](_0x3166('0xd'),_0x256a56,_0x2f22b4[_0x3166('0x12')]['message']);return _0x4ac68e(_0x2f22b4[_0x3166('0x12')][_0x3166('0x13')]);}else{logger['info'](_0x3166('0xd'),_0x256a56,_0x3166('0xe'));_0x4ac68e(_0x2f22b4['result']['message']);}})['catch'](function(_0x3603e8){logger['error'](_0x3166('0xd'),_0x256a56,_0x3603e8);_0x492c9f(_0x3603e8);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 06cdfd6..987b9cd 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 _0xcbbe=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','download','/:id/downloads','downloads','/:id/transcribe','create','post','runTranscribe','put','update','delete','multer','util','path','connect-timeout'];(function(_0x47abb1,_0x3f5545){var _0x26ef7c=function(_0x1f7d42){while(--_0x1f7d42){_0x47abb1['push'](_0x47abb1['shift']());}};_0x26ef7c(++_0x3f5545);}(_0xcbbe,0x8c));var _0xecbb=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0xcbbe[_0x411017];return _0x2adeea;};'use strict';var multer=require(_0xecbb('0x0'));var util=require(_0xecbb('0x1'));var path=require(_0xecbb('0x2'));var timeout=require(_0xecbb('0x3'));var express=require('express');var router=express[_0xecbb('0x4')]();var fs_extra=require(_0xecbb('0x5'));var auth=require(_0xecbb('0x6'));var interaction=require(_0xecbb('0x7'));var config=require(_0xecbb('0x8'));var controller=require('./voiceRecording.controller');router[_0xecbb('0x9')]('/',auth[_0xecbb('0xa')](),controller[_0xecbb('0xb')]);router[_0xecbb('0x9')](_0xecbb('0xc'),auth[_0xecbb('0xa')](),controller['describe']);router[_0xecbb('0x9')](_0xecbb('0xd'),auth[_0xecbb('0xa')](),controller['show']);router[_0xecbb('0x9')]('/:id/download',auth[_0xecbb('0xa')](),controller[_0xecbb('0xe')]);router[_0xecbb('0x9')](_0xecbb('0xf'),controller[_0xecbb('0x10')]);router[_0xecbb('0x9')](_0xecbb('0x11'),auth[_0xecbb('0xa')](),controller['downloadTranscribe']);router['post']('/',auth[_0xecbb('0xa')](),controller[_0xecbb('0x12')]);router[_0xecbb('0x13')](_0xecbb('0x11'),auth['isAuthenticated'](),controller[_0xecbb('0x14')]);router[_0xecbb('0x15')](_0xecbb('0xd'),auth[_0xecbb('0xa')](),controller[_0xecbb('0x16')]);router[_0xecbb('0x17')](_0xecbb('0xd'),auth[_0xecbb('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xbaa0=['/:id','show','/:id/download','download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','create','put','update','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceRecording.controller','get','index','isAuthenticated','describe'];(function(_0x1b1516,_0x17a510){var _0x14902e=function(_0x573007){while(--_0x573007){_0x1b1516['push'](_0x1b1516['shift']());}};_0x14902e(++_0x17a510);}(_0xbaa0,0xa2));var _0x0baa=function(_0xd3f0de,_0x33f614){_0xd3f0de=_0xd3f0de-0x0;var _0x1b8a29=_0xbaa0[_0xd3f0de];return _0x1b8a29;};'use strict';var multer=require(_0x0baa('0x0'));var util=require('util');var path=require(_0x0baa('0x1'));var timeout=require(_0x0baa('0x2'));var express=require(_0x0baa('0x3'));var router=express[_0x0baa('0x4')]();var fs_extra=require(_0x0baa('0x5'));var auth=require(_0x0baa('0x6'));var interaction=require(_0x0baa('0x7'));var config=require('../../config/environment');var controller=require(_0x0baa('0x8'));router[_0x0baa('0x9')]('/',auth['isAuthenticated'](),controller[_0x0baa('0xa')]);router[_0x0baa('0x9')]('/describe',auth[_0x0baa('0xb')](),controller[_0x0baa('0xc')]);router['get'](_0x0baa('0xd'),auth[_0x0baa('0xb')](),controller[_0x0baa('0xe')]);router[_0x0baa('0x9')](_0x0baa('0xf'),auth[_0x0baa('0xb')](),controller[_0x0baa('0x10')]);router[_0x0baa('0x9')](_0x0baa('0x11'),controller[_0x0baa('0x12')]);router[_0x0baa('0x9')](_0x0baa('0x13'),auth[_0x0baa('0xb')](),controller[_0x0baa('0x14')]);router[_0x0baa('0x15')]('/',auth[_0x0baa('0xb')](),controller[_0x0baa('0x16')]);router['post'](_0x0baa('0x13'),auth[_0x0baa('0xb')](),controller['runTranscribe']);router[_0x0baa('0x17')](_0x0baa('0xd'),auth[_0x0baa('0xb')](),controller[_0x0baa('0x18')]);router['delete'](_0x0baa('0xd'),auth['isAuthenticated'](),controller['destroy']);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 336e7e0..b2cdb25 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(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xa9e0[_0x2576d7];return _0x16a08c;};'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(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0a9e('0x3')]('value')?path[_0x0a9e('0x4')](this[_0x0a9e('0x3')](_0x0a9e('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0x0a9e('0x6')]},'channel':{'type':Sequelize[_0x0a9e('0x6')],'set':function(_0x57b080){if(_0x57b080){this[_0x0a9e('0x7')](_0x0a9e('0x8'),_0x57b080);this[_0x0a9e('0x7')]('membername',_0x57b080['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x0a9e('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x0a9e('0x6')]},'connectedlinename':{'type':Sequelize[_0x0a9e('0x6')]},'accountcode':{'type':Sequelize[_0x0a9e('0x6')]},'context':{'type':Sequelize[_0x0a9e('0x6')]},'exten':{'type':Sequelize[_0x0a9e('0x6')]},'value':{'type':Sequelize[_0x0a9e('0x6')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'userThirdDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'location':{'type':Sequelize[_0x0a9e('0x9')]},'transcribeName':{'type':Sequelize[_0x0a9e('0x6')]},'transcribeStatus':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':_0x0a9e('0xa')},'fileUri':{'type':Sequelize['TEXT']},'fileText':{'type':Sequelize[_0x0a9e('0x9')]},'failureReason':{'type':Sequelize[_0x0a9e('0x9')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')]},'sPositive':{'type':Sequelize[_0x0a9e('0xb')]},'sNegative':{'type':Sequelize[_0x0a9e('0xb')]},'sNeutral':{'type':Sequelize[_0x0a9e('0xb')]},'sMixed':{'type':Sequelize['FLOAT']},'tempSentiment':{'type':Sequelize[_0x0a9e('0xc')],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x0a9e('0x3')]('createdAt'))[_0x0a9e('0xd')](_0x0a9e('0xe'))['toString']();}},'updatedAt':{'type':Sequelize[_0x0a9e('0xf')],'get':function(){return moment(this['getDataValue'](_0x0a9e('0x10')))[_0x0a9e('0xd')](_0x0a9e('0xe'))[_0x0a9e('0x11')]();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index 49556dc..6d04190 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 _0xb28c=['../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','then','end','error','stack','name','send','rawAttributes','fieldName','key','differenceBy','map','format','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','type','VIRTUAL','filter','merge','options','VoiceRecording','include','findAll','rows','catch','show','params','length','includeAll','create','body','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','recording','ValidationError','filename','unlink','message','VoiceRecording\x20not\x20found','Not\x20found','downloads','sequelize','MD5','col','push','find','extname','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','isNil','listBuckets','createBucket','TranscribeService','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','transcribeRegion','language','Sequelize','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','NEW','IN_PROGRESS','tempSentiment','runSentiment','writeFile','downloadTranscribe','fileText','root','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','aws-sdk','uuid/v4','ioredis'];(function(_0x3d6a49,_0x47ec38){var _0x41cb49=function(_0xcd2cb5){while(--_0xcd2cb5){_0x3d6a49['push'](_0x3d6a49['shift']());}};_0x41cb49(++_0x47ec38);}(_0xb28c,0x1c0));var _0xcb28=function(_0x2ab11b,_0x2afa09){_0x2ab11b=_0x2ab11b-0x0;var _0x3ebaa8=_0xb28c[_0x2ab11b];return _0x3ebaa8;};'use strict';var emlformat=require(_0xcb28('0x0'));var rimraf=require(_0xcb28('0x1'));var zipdir=require(_0xcb28('0x2'));var jsonpatch=require(_0xcb28('0x3'));var rp=require(_0xcb28('0x4'));var moment=require(_0xcb28('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xcb28('0x6'));var util=require(_0xcb28('0x7'));var path=require(_0xcb28('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xcb28('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcb28('0xa'));var squel=require(_0xcb28('0xb'));var crypto=require(_0xcb28('0xc'));var jsforce=require(_0xcb28('0xd'));var deskjs=require(_0xcb28('0xe'));var toCsv=require(_0xcb28('0xf'));var querystring=require('querystring');var Papa=require(_0xcb28('0x10'));var AWS=require(_0xcb28('0x11'));var uuidv4=require(_0xcb28('0x12'));var Redis=require(_0xcb28('0x13'));var authService=require(_0xcb28('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xcb28('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xcb28('0x16'));var utils=require(_0xcb28('0x17'));var config=require(_0xcb28('0x18'));var licenseUtil=require(_0xcb28('0x19'));var db=require(_0xcb28('0x1a'))['db'];function respondWithStatusCode(_0x4d2700,_0x51771c){_0x51771c=_0x51771c||0xcc;return function(_0x3cd5ee){if(_0x3cd5ee){return _0x4d2700[_0xcb28('0x1b')](_0x51771c);}return _0x4d2700[_0xcb28('0x1c')](_0x51771c)['end']();};}function respondWithResult(_0x53ccd8,_0x4a1022){_0x4a1022=_0x4a1022||0xc8;return function(_0x5970fc){if(_0x5970fc){return _0x53ccd8[_0xcb28('0x1c')](_0x4a1022)[_0xcb28('0x1d')](_0x5970fc);}};}function respondWithFilteredResult(_0x935a7a,_0x5cef10){return function(_0x13bb3c){if(_0x13bb3c){var _0x5ca906=typeof _0x5cef10[_0xcb28('0x1e')]===_0xcb28('0x1f')&&typeof _0x5cef10[_0xcb28('0x20')]==='undefined';var _0x458523=_0x13bb3c[_0xcb28('0x21')];var _0x442382=_0x5ca906?0x0:_0x5cef10[_0xcb28('0x1e')];var _0x47912a=_0x5ca906?_0x13bb3c[_0xcb28('0x21')]:_0x5cef10['offset']+_0x5cef10[_0xcb28('0x20')];var _0x34bb26;if(_0x47912a>=_0x458523){_0x47912a=_0x458523;_0x34bb26=0xc8;}else{_0x34bb26=0xce;}_0x935a7a[_0xcb28('0x1c')](_0x34bb26);return _0x935a7a['set'](_0xcb28('0x22'),_0x442382+'-'+_0x47912a+'/'+_0x458523)[_0xcb28('0x1d')](_0x13bb3c);}return null;};}function patchUpdates(_0x23e101){return function(_0x2cc497){try{jsonpatch[_0xcb28('0x23')](_0x2cc497,_0x23e101,!![]);}catch(_0x46e3a4){return BPromise[_0xcb28('0x24')](_0x46e3a4);}return _0x2cc497[_0xcb28('0x25')]();};}function saveUpdates(_0xcd10f8,_0x4411ba){return function(_0x10e366){if(_0x10e366){return _0x10e366[_0xcb28('0x26')](_0xcd10f8)['then'](function(_0x436101){return _0x436101;});}return null;};}function removeEntity(_0x15431a,_0x158a38){return function(_0x436d07){if(_0x436d07){return _0x436d07[_0xcb28('0x27')]()[_0xcb28('0x28')](function(){_0x15431a['status'](0xcc)[_0xcb28('0x29')]();});}};}function handleEntityNotFound(_0x1544ec,_0x31c525){return function(_0x261bba){if(!_0x261bba){_0x1544ec[_0xcb28('0x1b')](0x194);}return _0x261bba;};}function handleError(_0xdcaa13,_0x187db9){_0x187db9=_0x187db9||0x1f4;return function(_0x38ca62){logger[_0xcb28('0x2a')](_0x38ca62[_0xcb28('0x2b')]);if(_0x38ca62['name']){delete _0x38ca62[_0xcb28('0x2c')];}_0xdcaa13[_0xcb28('0x1c')](_0x187db9)[_0xcb28('0x2d')](_0x38ca62);};}exports['index']=function(_0x2fcb50,_0x490b1f){var _0x1de8e8={},_0x59489d={},_0x57419d={'count':0x0,'rows':[]};var _0x41bd63=_['map'](db['VoiceRecording'][_0xcb28('0x2e')],function(_0x433d81){return{'name':_0x433d81[_0xcb28('0x2f')],'type':_0x433d81['type'][_0xcb28('0x30')]};});_0x59489d['model']=_[_0xcb28('0x31')](_[_0xcb28('0x32')](_0x41bd63,'name'),[_0xcb28('0x33')]);_0x59489d[_0xcb28('0x34')]=_[_0xcb28('0x35')](_0x2fcb50[_0xcb28('0x34')]);_0x59489d[_0xcb28('0x36')]=_[_0xcb28('0x37')](_0x59489d[_0xcb28('0x38')],_0x59489d[_0xcb28('0x34')]);_0x1de8e8[_0xcb28('0x39')]=_[_0xcb28('0x37')](_0x59489d[_0xcb28('0x38')],qs['fields'](_0x2fcb50['query'][_0xcb28('0x3a')]));_0x1de8e8['attributes']=_0x1de8e8['attributes']['length']?_0x1de8e8[_0xcb28('0x39')]:_0x59489d[_0xcb28('0x38')];if(!_0x2fcb50[_0xcb28('0x34')][_0xcb28('0x3b')](_0xcb28('0x3c'))){_0x1de8e8[_0xcb28('0x20')]=qs[_0xcb28('0x20')](_0x2fcb50[_0xcb28('0x34')][_0xcb28('0x20')]);_0x1de8e8[_0xcb28('0x1e')]=qs['offset'](_0x2fcb50[_0xcb28('0x34')]['offset']);}_0x1de8e8[_0xcb28('0x3d')]=qs[_0xcb28('0x3e')](_0x2fcb50[_0xcb28('0x34')][_0xcb28('0x3e')]);_0x1de8e8[_0xcb28('0x3f')]=qs[_0xcb28('0x36')](_[_0xcb28('0x40')](_0x2fcb50[_0xcb28('0x34')],_0x59489d[_0xcb28('0x36')]),_0x41bd63);if(_0x2fcb50[_0xcb28('0x34')]['filter']){_0x1de8e8['where']=_['merge'](_0x1de8e8['where'],{'$or':_[_0xcb28('0x32')](_0x41bd63,function(_0x268c33){if(_0x268c33[_0xcb28('0x41')]!==_0xcb28('0x42')){var _0x300f5a={};_0x300f5a[_0x268c33[_0xcb28('0x2c')]]={'$like':'%'+_0x2fcb50[_0xcb28('0x34')][_0xcb28('0x43')]+'%'};return _0x300f5a;}})});}_0x1de8e8=_[_0xcb28('0x44')]({},_0x1de8e8,_0x2fcb50[_0xcb28('0x45')]);var _0x44d447={'where':_0x1de8e8['where']};return db[_0xcb28('0x46')][_0xcb28('0x21')](_0x44d447)['then'](function(_0x10c609){_0x57419d[_0xcb28('0x21')]=_0x10c609;if(_0x2fcb50[_0xcb28('0x34')]['includeAll']){_0x1de8e8[_0xcb28('0x47')]=[{'all':!![]}];}return db['VoiceRecording'][_0xcb28('0x48')](_0x1de8e8);})[_0xcb28('0x28')](function(_0x367d4e){_0x57419d[_0xcb28('0x49')]=_0x367d4e;return _0x57419d;})['then'](respondWithFilteredResult(_0x490b1f,_0x1de8e8))[_0xcb28('0x4a')](handleError(_0x490b1f,null));};exports[_0xcb28('0x4b')]=function(_0x373ffc,_0x5ca506){var _0x279302={'raw':![],'where':{'id':_0x373ffc[_0xcb28('0x4c')]['id']}},_0x496a19={};_0x496a19[_0xcb28('0x38')]=_[_0xcb28('0x35')](db[_0xcb28('0x46')][_0xcb28('0x2e')]);_0x496a19[_0xcb28('0x34')]=_[_0xcb28('0x35')](_0x373ffc['query']);_0x496a19[_0xcb28('0x36')]=_[_0xcb28('0x37')](_0x496a19[_0xcb28('0x38')],_0x496a19['query']);_0x279302[_0xcb28('0x39')]=_[_0xcb28('0x37')](_0x496a19[_0xcb28('0x38')],qs['fields'](_0x373ffc[_0xcb28('0x34')][_0xcb28('0x3a')]));_0x279302[_0xcb28('0x39')]=_0x279302[_0xcb28('0x39')][_0xcb28('0x4d')]?_0x279302[_0xcb28('0x39')]:_0x496a19[_0xcb28('0x38')];if(_0x373ffc[_0xcb28('0x34')][_0xcb28('0x4e')]){_0x279302[_0xcb28('0x47')]=[{'all':!![]}];}_0x279302=_[_0xcb28('0x44')]({},_0x279302,_0x373ffc[_0xcb28('0x45')]);return db[_0xcb28('0x46')]['find'](_0x279302)[_0xcb28('0x28')](handleEntityNotFound(_0x5ca506,null))[_0xcb28('0x28')](respondWithResult(_0x5ca506,null))['catch'](handleError(_0x5ca506,null));};exports['create']=function(_0x54f316,_0x1ea3ae){return db[_0xcb28('0x46')][_0xcb28('0x4f')](_0x54f316[_0xcb28('0x50')],{})[_0xcb28('0x28')](respondWithResult(_0x1ea3ae,0xc9))['catch'](handleError(_0x1ea3ae,null));};exports[_0xcb28('0x26')]=function(_0x13ab4e,_0x56114e){if(_0x13ab4e[_0xcb28('0x50')]['id']){delete _0x13ab4e['body']['id'];}return db[_0xcb28('0x46')]['find']({'where':{'id':_0x13ab4e[_0xcb28('0x4c')]['id']}})[_0xcb28('0x28')](handleEntityNotFound(_0x56114e,null))[_0xcb28('0x28')](saveUpdates(_0x13ab4e[_0xcb28('0x50')],null))[_0xcb28('0x28')](respondWithResult(_0x56114e,null))['catch'](handleError(_0x56114e,null));};exports[_0xcb28('0x51')]=function(_0x4ffc97,_0x9bc140){return db['VoiceRecording']['describe']()[_0xcb28('0x28')](respondWithResult(_0x9bc140,null))[_0xcb28('0x4a')](handleError(_0x9bc140,null));};exports[_0xcb28('0x52')]=function(_0xa16bd7,_0x3cdf1d,_0x12a28b){var _0x5a5ea1=require(_0xcb28('0x53'));var _0x466de3=![];var _0x5676b9={};if(_0xa16bd7['query']['type']&&_0xa16bd7[_0xcb28('0x34')][_0xcb28('0x41')]==='uniqueid'){_0x5676b9[_0xcb28('0x54')]=_0xa16bd7[_0xcb28('0x4c')]['id'];}else{_0x5676b9['id']=_0xa16bd7['params']['id'];}return db[_0xcb28('0x46')]['find']({'where':_0x5676b9,'attributes':['id','value'],'raw':!![]})['then'](handleEntityNotFound(_0x3cdf1d,null))[_0xcb28('0x28')](function(_0x421e36){if(_0x421e36){var _0x3d16bd=_0x421e36[_0xcb28('0x55')];var _0x2a9e1f=util[_0xcb28('0x33')](_0xcb28('0x56'),_0x3d16bd);if(fs[_0xcb28('0x57')](_0x2a9e1f)){_0x466de3=!![];return _0x5a5ea1['decryptFile'](_0x2a9e1f,_0x3d16bd,config['secrets'][_0xcb28('0x58')])[_0xcb28('0x28')](function(){return _0x421e36;});}return _0x421e36;}})[_0xcb28('0x28')](function(_0x2c1637){if(_0x2c1637){var _0x2dd436=_0x2c1637['value'];if(!fs[_0xcb28('0x57')](_0x2dd436)){throw new db['Sequelize'][(_0xcb28('0x59'))]('VoiceRecording\x20not\x20found');}if(_0x2c1637['filename']){return _0x3cdf1d[_0xcb28('0x52')](_0x2dd436,_0x2c1637[_0xcb28('0x5a')]+path['extname'](_0x2dd436),function(){if(_0x466de3){fs['unlink'](_0x2dd436);}});}else{return _0x3cdf1d[_0xcb28('0x52')](_0x2dd436,function(_0x344b67){if(_0x466de3){fs[_0xcb28('0x5b')](_0x2dd436);}});}}})[_0xcb28('0x4a')](function(_0x11f495){if(_0x11f495[_0xcb28('0x5c')]===_0xcb28('0x5d')){_0x3cdf1d[_0xcb28('0x1c')](0x194)[_0xcb28('0x2d')](_0xcb28('0x5e'));}else{return handleError(_0x3cdf1d,null);}});};exports[_0xcb28('0x5f')]=function(_0x5e2bde,_0x702fbc,_0x422752){var _0xb75160=require(_0xcb28('0x53'));var _0x4fc376=![];var _0x1aac0d={'$and':[db[_0xcb28('0x60')][_0xcb28('0x3f')](db['sequelize']['fn'](_0xcb28('0x61'),db[_0xcb28('0x60')][_0xcb28('0x62')]('uniqueid')),_0x5e2bde[_0xcb28('0x34')]['token'])]};if(_0x5e2bde[_0xcb28('0x34')][_0xcb28('0x41')]&&_0x5e2bde[_0xcb28('0x34')]['type']===_0xcb28('0x54')){_0x1aac0d['$and'][_0xcb28('0x63')]({'uniqueid':_0x5e2bde['params']['id']});}else{_0x1aac0d['$and'][_0xcb28('0x63')]({'id':_0x5e2bde['params']['id']});}return db[_0xcb28('0x46')][_0xcb28('0x64')]({'where':_0x1aac0d,'attributes':['id','value'],'raw':!![]})[_0xcb28('0x28')](handleEntityNotFound(_0x702fbc,null))['then'](function(_0x1b680b){if(_0x1b680b){var _0xcc7947=util['format']('%s.cypher',_0x1b680b[_0xcb28('0x55')]);if(fs[_0xcb28('0x57')](_0xcc7947)){_0x4fc376=!![];return _0xb75160['decryptFile'](_0xcc7947,_0x1b680b[_0xcb28('0x55')],config['secrets']['recording'])[_0xcb28('0x28')](function(){return _0x1b680b;});}return _0x1b680b;}})[_0xcb28('0x28')](function(_0x4424d0){if(_0x4424d0){if(!fs['existsSync'](_0x4424d0[_0xcb28('0x55')])){throw new db['Sequelize'][(_0xcb28('0x59'))](_0xcb28('0x5d'));}if(_0x4424d0['filename']){return _0x702fbc[_0xcb28('0x52')](_0x4424d0[_0xcb28('0x55')],_0x4424d0[_0xcb28('0x5a')]+path[_0xcb28('0x65')](_0x4424d0[_0xcb28('0x55')]),function(){if(_0x4fc376){fs['unlink'](_0x4424d0[_0xcb28('0x55')]);}});}else{return _0x702fbc[_0xcb28('0x52')](_0x4424d0[_0xcb28('0x55')],function(_0x428d88){if(_0x4fc376){fs[_0xcb28('0x5b')](_0x4424d0[_0xcb28('0x55')]);}});}}})['catch'](handleError(_0x702fbc,null));};exports[_0xcb28('0x27')]=function(_0x32d4f5,_0x42682b){return db['VoiceRecording']['find']({'where':{'id':_0x32d4f5[_0xcb28('0x4c')]['id']}})[_0xcb28('0x28')](function(_0x214dd4){if(_['isNil'](_0x214dd4)){throw new ReferenceError('Entity\x20not\x20found');}return _0x214dd4;})['then'](function(_0x2378ed){var _0x19ddcc=_0x2378ed['value'];logger[_0xcb28('0x66')](_0xcb28('0x67'),_0x19ddcc);if(!_['isNil'](_0x2378ed[_0xcb28('0x55')])&&fs['existsSync'](_0x19ddcc)){logger[_0xcb28('0x66')](_0xcb28('0x68')+_0x19ddcc+_0xcb28('0x69'));fs[_0xcb28('0x6a')](_0x19ddcc);}_0x19ddcc=_0x19ddcc+_0xcb28('0x6b');if(!_[_0xcb28('0x6c')](_0x2378ed['value'])&&fs[_0xcb28('0x57')](_0x19ddcc)){logger['info'](_0xcb28('0x68')+_0x19ddcc+_0xcb28('0x69'));fs[_0xcb28('0x6a')](_0x19ddcc);}return _0x2378ed;})[_0xcb28('0x28')](function(_0x30034c){if(!_0x30034c)throw new InternalError();return _0x30034c[_0xcb28('0x27')]();})[_0xcb28('0x28')](function(){_0x42682b[_0xcb28('0x1c')](0xcc)['end']();})[_0xcb28('0x4a')](handleError(_0x42682b,null));};function getBucketslist(_0x238475,_0x4650a9,_0x343764){return new Promise(function(_0x3a5474,_0x40775d){var _0x30432a=new AWS['S3']({'accessKeyId':_0x4650a9,'secretAccessKey':_0x238475,'region':_0x343764});_0x30432a[_0xcb28('0x6d')]({},function(_0x2e152a,_0x2b1f72){if(_0x2e152a){return _0x40775d(_0x2e152a);}else{return _0x3a5474(_0x2b1f72);}});});}function createBucket(_0x45dba9,_0x5be40b,_0x30728c,_0xfc18fc){return new Promise(function(_0x37363b,_0x440f66){var _0x2acfdd=new AWS['S3']({'accessKeyId':_0x5be40b,'secretAccessKey':_0x45dba9,'region':_0x30728c});_0x2acfdd[_0xcb28('0x6e')]({'Bucket':_0xfc18fc},function(_0x3bfd3e,_0x569bc9){if(_0x3bfd3e){return _0x440f66(_0x3bfd3e);}else{return _0x37363b(_0x569bc9);}});});}function uploadFile(_0x42bb01,_0x25784e,_0x5d93aa,_0x12b87f,_0x18403f,_0x32c9e6){return new Promise(function(_0x2e1038,_0x250699){var _0x336720=new AWS['S3']({'accessKeyId':_0x25784e,'secretAccessKey':_0x42bb01,'region':_0x5d93aa});_0x336720['upload']({'Bucket':_0x12b87f,'Key':_0x18403f,'Body':_0x32c9e6},function(_0x2a549d,_0x41702c){if(_0x2a549d){return _0x250699(_0x2a549d);}else{return _0x2e1038(_0x41702c);}});});}function startTranscribe(_0x17cbed,_0x2fa50f,_0x82702b,_0x499dd6,_0x94c806,_0x41df98){return new Promise(function(_0x23ec5f,_0x45e5bf){var _0x4e2e38=new AWS[(_0xcb28('0x6f'))]({'accessKeyId':_0x2fa50f,'secretAccessKey':_0x17cbed,'region':_0x82702b});_0x4e2e38['startTranscriptionJob']({'TranscriptionJobName':_0x499dd6,'LanguageCode':_0x94c806,'Media':{'MediaFileUri':_0x41df98}},function(_0x3315da,_0x403411){if(_0x3315da){return _0x45e5bf(_0x3315da);}else{return _0x23ec5f(_0x403411);}});});}function transcribe(_0x13d4f4,_0x16ecee,_0x3302c5,_0x44530d,_0x2c369e,_0x56c89c,_0x747fc6){return new Promise(function(_0x2cd586,_0x2a7c34){var _0x3776d6={};logger[_0xcb28('0x66')](util['format'](_0xcb28('0x70'),_0x13d4f4,_0x2c369e));return uploadFile(_0x16ecee,_0x3302c5,_0x44530d,_0x2c369e,path[_0xcb28('0x71')](_0x56c89c),fs[_0xcb28('0x72')](_0x56c89c))['then'](function(_0x1705cf){logger['info'](util[_0xcb28('0x33')](_0xcb28('0x73'),_0x13d4f4,_0x2c369e,_0x1705cf[_0xcb28('0x74')]));_0x3776d6[_0xcb28('0x75')]=_0x1705cf[_0xcb28('0x76')];_0x3776d6[_0xcb28('0x77')]=_0x1705cf[_0xcb28('0x74')];logger[_0xcb28('0x66')](util[_0xcb28('0x33')](_0xcb28('0x78'),_0x13d4f4));return startTranscribe(_0x16ecee,_0x3302c5,_0x44530d,uuidv4(),_0x747fc6,_0x1705cf[_0xcb28('0x74')]);})[_0xcb28('0x28')](function(_0x44bc5b){logger[_0xcb28('0x66')](util[_0xcb28('0x33')](_0xcb28('0x79'),_0x13d4f4,_0x44bc5b[_0xcb28('0x7a')][_0xcb28('0x7b')]));_0x3776d6[_0xcb28('0x7c')]=_0x44bc5b['TranscriptionJob'][_0xcb28('0x7b')];_0x3776d6[_0xcb28('0x7d')]=_0x44bc5b['TranscriptionJob'][_0xcb28('0x7e')];return _0x2cd586(_0x3776d6);})[_0xcb28('0x4a')](function(_0x5c892c){return _0x2a7c34(_0x5c892c);});});}exports[_0xcb28('0x7f')]=function(_0x4f7a05,_0x217ea2,_0x1de141){var _0x33e6cd;var _0x31ae9e;var _0x10d724;var _0x30fe88=require(_0xcb28('0x53'));return db[_0xcb28('0x46')][_0xcb28('0x80')]({'where':{'id':_0x4f7a05[_0xcb28('0x4c')]['id']}})[_0xcb28('0x28')](function(_0xb80f72){if(_0xb80f72){var _0x508851=util[_0xcb28('0x33')](_0xcb28('0x56'),_0xb80f72[_0xcb28('0x55')]);if(fs[_0xcb28('0x57')](_0x508851)){cypher=!![];return _0x30fe88['decryptFile'](_0x508851,_0xb80f72['value'],config['secrets'][_0xcb28('0x58')])[_0xcb28('0x28')](function(){return _0xb80f72;});}return _0xb80f72;}})[_0xcb28('0x28')](function(_0x4b3a7a){if(!_0x4b3a7a){throw new db['Sequelize'][(_0xcb28('0x59'))](_0xcb28('0x81'));}_0x31ae9e=_0x4b3a7a;return db[_0xcb28('0x82')]['findOne']({'where':{'id':0x1}});})[_0xcb28('0x28')](handleEntityNotFound(_0x217ea2,null))[_0xcb28('0x28')](function(_0xb61b39){if(_0xb61b39){_0x33e6cd=_0xb61b39;if(!_0x33e6cd[_0xcb28('0x83')]||!_0x33e6cd[_0xcb28('0x84')]||!_0x33e6cd[_0xcb28('0x85')]||!_0x33e6cd[_0xcb28('0x86')]||!_0x33e6cd[_0xcb28('0x75')]){throw new db[(_0xcb28('0x87'))][(_0xcb28('0x59'))]('Transcribe\x20not\x20configured');}if(_0x4f7a05[_0xcb28('0x50')]['runSentiment']&&(!_0x33e6cd[_0xcb28('0x88')]||!_0x33e6cd[_0xcb28('0x89')]||!_0x33e6cd[_0xcb28('0x8a')]||!_0x33e6cd[_0xcb28('0x86')]||!_0x33e6cd[_0xcb28('0x75')])){throw new db['Sequelize'][(_0xcb28('0x59'))](_0xcb28('0x8b'));}return db[_0xcb28('0x8c')][_0xcb28('0x80')]({'where':{'id':_0x33e6cd[_0xcb28('0x84')]}});}})['then'](function(_0x34d55e){if(!_0x34d55e){throw new db[(_0xcb28('0x87'))]['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x34d55e[_0xcb28('0x8d')]||!_0x34d55e[_0xcb28('0x8e')]){throw new db[(_0xcb28('0x87'))][(_0xcb28('0x59'))](_0xcb28('0x8f'));}_0x10d724=_0x34d55e;return getBucketslist(_0x10d724[_0xcb28('0x8d')],_0x10d724[_0xcb28('0x8e')],_0x33e6cd['transcribeRegion']);})[_0xcb28('0x28')](function(_0x2f8f2b){if(_0x2f8f2b&&_0x2f8f2b[_0xcb28('0x90')]){var _0x30b48a=_[_0xcb28('0x64')](_0x2f8f2b[_0xcb28('0x90')],function(_0x3f3f93){return _0x3f3f93[_0xcb28('0x91')]===_0x33e6cd['bucket'];});if(!_0x30b48a){logger[_0xcb28('0x66')](util['format'](_0xcb28('0x92'),_0x4f7a05[_0xcb28('0x4c')]['id'],_0x33e6cd[_0xcb28('0x75')]));return createBucket(_0x10d724[_0xcb28('0x8d')],_0x10d724[_0xcb28('0x8e')],_0x33e6cd['transcribeRegion'],_0x33e6cd[_0xcb28('0x75')]);}logger['info'](util['format']('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x4f7a05[_0xcb28('0x4c')]['id'],_0x33e6cd['bucket']));return;}})['then'](function(_0x4d2e78){if(_0x31ae9e['transcribeStatus']===_0xcb28('0x93')){return transcribe(_0x4f7a05[_0xcb28('0x4c')]['id'],_0x10d724[_0xcb28('0x8d')],_0x10d724['data2'],_0x33e6cd['transcribeRegion'],_0x33e6cd[_0xcb28('0x75')],_0x31ae9e[_0xcb28('0x55')],_0x33e6cd[_0xcb28('0x86')]);}else{logger['info'](util[_0xcb28('0x33')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x4f7a05[_0xcb28('0x4c')]['id']));return{'transcribeStatus':_0xcb28('0x94')};}})['then'](function(_0x1d778c){if(_0x1d778c){_0x1d778c[_0xcb28('0x95')]=_0x4f7a05[_0xcb28('0x50')][_0xcb28('0x96')];return _0x31ae9e['updateAttributes'](_0x1d778c);}})['then'](respondWithResult(_0x217ea2,null))[_0xcb28('0x4a')](handleError(_0x217ea2,null));};function writeFile(_0x168c5a,_0x23aad){return new Promise(function(_0x2bf43f,_0x32df29){fs[_0xcb28('0x97')](_0x23aad,_0x168c5a,function(_0x575952,_0x3f5253){if(_0x575952){return _0x32df29(_0x575952);}else{return _0x2bf43f(_0x3f5253);}});});}exports[_0xcb28('0x98')]=function(_0x264777,_0x2cc2a4,_0x83691){return db[_0xcb28('0x46')][_0xcb28('0x80')]({'where':{'id':_0x264777[_0xcb28('0x4c')]['id']}})[_0xcb28('0x28')](handleEntityNotFound(_0x2cc2a4))['then'](function(_0x4e6f6a){if(_0x4e6f6a&&_0x4e6f6a[_0xcb28('0x99')]){var _0x5c3c6a=_0x4e6f6a[_0xcb28('0x99')];var _0x229868=config[_0xcb28('0x9a')]+'/server/files/transcribes/transcribe_'+_0x4e6f6a['id']+'.txt';if(fs[_0xcb28('0x57')](_0x229868)){return _0x229868;}return writeFile(_0x5c3c6a,_0x229868)[_0xcb28('0x28')](function(){return _0x229868;});}else{throw new db['Sequelize'][(_0xcb28('0x59'))](_0xcb28('0x9b'));}})[_0xcb28('0x28')](function(_0x5302d6){return _0x2cc2a4[_0xcb28('0x52')](_0x5302d6);})[_0xcb28('0x4a')](handleError(_0x2cc2a4));}; \ No newline at end of file +var _0xced0=['Transcript\x20not\x20available','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','aws-sdk','uuid/v4','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','count','offset','limit','set','apply','save','then','destroy','error','stack','name','index','map','VoiceRecording','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','includeAll','include','show','params','options','find','catch','create','body','update','download','uniqueid','value','format','%s.cypher','decryptFile','secrets','recording','existsSync','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','unlink','message','send','downloads','sequelize','MD5','col','token','push','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','createBucket','upload','TranscribeService','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJobName','transcribeName','TranscriptionJob','transcribeStatus','TranscriptionJobStatus','runTranscribe','../../components/encryptor','findOne','transcribeRegion','sentimentAccountId','sentimentRegion','language','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','transcribeAccountId','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','runSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_'];(function(_0x267a5b,_0x311aee){var _0x4048d0=function(_0x56e091){while(--_0x56e091){_0x267a5b['push'](_0x267a5b['shift']());}};_0x4048d0(++_0x311aee);}(_0xced0,0x1c9));var _0x0ced=function(_0x3ddb41,_0x23302f){_0x3ddb41=_0x3ddb41-0x0;var _0x2d57b5=_0xced0[_0x3ddb41];return _0x2d57b5;};'use strict';var emlformat=require(_0x0ced('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x0ced('0x1'));var rp=require(_0x0ced('0x2'));var moment=require(_0x0ced('0x3'));var BPromise=require(_0x0ced('0x4'));var Mustache=require(_0x0ced('0x5'));var util=require(_0x0ced('0x6'));var path=require('path');var sox=require(_0x0ced('0x7'));var csv=require(_0x0ced('0x8'));var ejs=require(_0x0ced('0x9'));var fs=require('fs');var fs_extra=require(_0x0ced('0xa'));var _=require(_0x0ced('0xb'));var squel=require('squel');var crypto=require(_0x0ced('0xc'));var jsforce=require(_0x0ced('0xd'));var deskjs=require(_0x0ced('0xe'));var toCsv=require(_0x0ced('0x8'));var querystring=require('querystring');var Papa=require(_0x0ced('0xf'));var AWS=require(_0x0ced('0x10'));var uuidv4=require(_0x0ced('0x11'));var Redis=require(_0x0ced('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0ced('0x13'));var hardwareService=require(_0x0ced('0x14'));var logger=require(_0x0ced('0x15'))(_0x0ced('0x16'));var utils=require(_0x0ced('0x17'));var config=require(_0x0ced('0x18'));var licenseUtil=require(_0x0ced('0x19'));var db=require(_0x0ced('0x1a'))['db'];function respondWithStatusCode(_0x1be16e,_0x4c2342){_0x4c2342=_0x4c2342||0xcc;return function(_0x4521b6){if(_0x4521b6){return _0x1be16e['sendStatus'](_0x4c2342);}return _0x1be16e[_0x0ced('0x1b')](_0x4c2342)[_0x0ced('0x1c')]();};}function respondWithResult(_0x22b5f5,_0x376ba0){_0x376ba0=_0x376ba0||0xc8;return function(_0x5e9709){if(_0x5e9709){return _0x22b5f5[_0x0ced('0x1b')](_0x376ba0)[_0x0ced('0x1d')](_0x5e9709);}};}function respondWithFilteredResult(_0x247cef,_0x4d0bc2){return function(_0x2073cf){if(_0x2073cf){var _0xe5ee6b=typeof _0x4d0bc2['offset']===_0x0ced('0x1e')&&typeof _0x4d0bc2['limit']==='undefined';var _0x324aad=_0x2073cf[_0x0ced('0x1f')];var _0xcc0049=_0xe5ee6b?0x0:_0x4d0bc2[_0x0ced('0x20')];var _0x51c17b=_0xe5ee6b?_0x2073cf[_0x0ced('0x1f')]:_0x4d0bc2['offset']+_0x4d0bc2[_0x0ced('0x21')];var _0x2883a2;if(_0x51c17b>=_0x324aad){_0x51c17b=_0x324aad;_0x2883a2=0xc8;}else{_0x2883a2=0xce;}_0x247cef[_0x0ced('0x1b')](_0x2883a2);return _0x247cef[_0x0ced('0x22')]('Content-Range',_0xcc0049+'-'+_0x51c17b+'/'+_0x324aad)['json'](_0x2073cf);}return null;};}function patchUpdates(_0x21150d){return function(_0x1d6e21){try{jsonpatch[_0x0ced('0x23')](_0x1d6e21,_0x21150d,!![]);}catch(_0x5d9a59){return BPromise['reject'](_0x5d9a59);}return _0x1d6e21[_0x0ced('0x24')]();};}function saveUpdates(_0x471299,_0x1c1fb4){return function(_0x442bd7){if(_0x442bd7){return _0x442bd7['update'](_0x471299)[_0x0ced('0x25')](function(_0xaa2707){return _0xaa2707;});}return null;};}function removeEntity(_0x1c6974,_0x290565){return function(_0x48986c){if(_0x48986c){return _0x48986c[_0x0ced('0x26')]()[_0x0ced('0x25')](function(){_0x1c6974['status'](0xcc)[_0x0ced('0x1c')]();});}};}function handleEntityNotFound(_0x3397a6,_0x4dc785){return function(_0x2692f7){if(!_0x2692f7){_0x3397a6['sendStatus'](0x194);}return _0x2692f7;};}function handleError(_0x512c10,_0x5c90e2){_0x5c90e2=_0x5c90e2||0x1f4;return function(_0x333423){logger[_0x0ced('0x27')](_0x333423[_0x0ced('0x28')]);if(_0x333423[_0x0ced('0x29')]){delete _0x333423[_0x0ced('0x29')];}_0x512c10[_0x0ced('0x1b')](_0x5c90e2)['send'](_0x333423);};}exports[_0x0ced('0x2a')]=function(_0x467328,_0x1a6a6b){var _0x927600={},_0x14d2e4={},_0x3b9f9d={'count':0x0,'rows':[]};var _0x257328=_[_0x0ced('0x2b')](db[_0x0ced('0x2c')][_0x0ced('0x2d')],function(_0x5bee56){return{'name':_0x5bee56[_0x0ced('0x2e')],'type':_0x5bee56[_0x0ced('0x2f')][_0x0ced('0x30')]};});_0x14d2e4[_0x0ced('0x31')]=_[_0x0ced('0x32')](_[_0x0ced('0x2b')](_0x257328,_0x0ced('0x29')),['format']);_0x14d2e4[_0x0ced('0x33')]=_[_0x0ced('0x34')](_0x467328[_0x0ced('0x33')]);_0x14d2e4[_0x0ced('0x35')]=_[_0x0ced('0x36')](_0x14d2e4['model'],_0x14d2e4[_0x0ced('0x33')]);_0x927600[_0x0ced('0x37')]=_[_0x0ced('0x36')](_0x14d2e4[_0x0ced('0x31')],qs[_0x0ced('0x38')](_0x467328[_0x0ced('0x33')][_0x0ced('0x38')]));_0x927600['attributes']=_0x927600[_0x0ced('0x37')][_0x0ced('0x39')]?_0x927600['attributes']:_0x14d2e4[_0x0ced('0x31')];if(!_0x467328[_0x0ced('0x33')][_0x0ced('0x3a')](_0x0ced('0x3b'))){_0x927600[_0x0ced('0x21')]=qs[_0x0ced('0x21')](_0x467328['query'][_0x0ced('0x21')]);_0x927600[_0x0ced('0x20')]=qs['offset'](_0x467328['query'][_0x0ced('0x20')]);}_0x927600[_0x0ced('0x3c')]=qs[_0x0ced('0x3d')](_0x467328['query']['sort']);_0x927600['where']=qs[_0x0ced('0x35')](_[_0x0ced('0x3e')](_0x467328[_0x0ced('0x33')],_0x14d2e4[_0x0ced('0x35')]),_0x257328);if(_0x467328[_0x0ced('0x33')][_0x0ced('0x3f')]){_0x927600[_0x0ced('0x40')]=_[_0x0ced('0x41')](_0x927600[_0x0ced('0x40')],{'$or':_[_0x0ced('0x2b')](_0x257328,function(_0x50ec4a){if(_0x50ec4a[_0x0ced('0x2f')]!=='VIRTUAL'){var _0x23c981={};_0x23c981[_0x50ec4a[_0x0ced('0x29')]]={'$like':'%'+_0x467328[_0x0ced('0x33')][_0x0ced('0x3f')]+'%'};return _0x23c981;}})});}_0x927600=_[_0x0ced('0x41')]({},_0x927600,_0x467328['options']);var _0xffc3ec={'where':_0x927600[_0x0ced('0x40')]};return db[_0x0ced('0x2c')][_0x0ced('0x1f')](_0xffc3ec)[_0x0ced('0x25')](function(_0x2be67f){_0x3b9f9d[_0x0ced('0x1f')]=_0x2be67f;if(_0x467328['query'][_0x0ced('0x42')]){_0x927600[_0x0ced('0x43')]=[{'all':!![]}];}return db['VoiceRecording']['findAll'](_0x927600);})[_0x0ced('0x25')](function(_0x348d34){_0x3b9f9d['rows']=_0x348d34;return _0x3b9f9d;})[_0x0ced('0x25')](respondWithFilteredResult(_0x1a6a6b,_0x927600))['catch'](handleError(_0x1a6a6b,null));};exports[_0x0ced('0x44')]=function(_0x40528e,_0x22dcbd){var _0x12c4d6={'raw':![],'where':{'id':_0x40528e[_0x0ced('0x45')]['id']}},_0x29d8a1={};_0x29d8a1[_0x0ced('0x31')]=_[_0x0ced('0x34')](db[_0x0ced('0x2c')][_0x0ced('0x2d')]);_0x29d8a1['query']=_[_0x0ced('0x34')](_0x40528e[_0x0ced('0x33')]);_0x29d8a1['filters']=_[_0x0ced('0x36')](_0x29d8a1[_0x0ced('0x31')],_0x29d8a1[_0x0ced('0x33')]);_0x12c4d6[_0x0ced('0x37')]=_[_0x0ced('0x36')](_0x29d8a1['model'],qs['fields'](_0x40528e[_0x0ced('0x33')][_0x0ced('0x38')]));_0x12c4d6[_0x0ced('0x37')]=_0x12c4d6['attributes'][_0x0ced('0x39')]?_0x12c4d6[_0x0ced('0x37')]:_0x29d8a1[_0x0ced('0x31')];if(_0x40528e['query'][_0x0ced('0x42')]){_0x12c4d6[_0x0ced('0x43')]=[{'all':!![]}];}_0x12c4d6=_[_0x0ced('0x41')]({},_0x12c4d6,_0x40528e[_0x0ced('0x46')]);return db['VoiceRecording'][_0x0ced('0x47')](_0x12c4d6)[_0x0ced('0x25')](handleEntityNotFound(_0x22dcbd,null))[_0x0ced('0x25')](respondWithResult(_0x22dcbd,null))[_0x0ced('0x48')](handleError(_0x22dcbd,null));};exports[_0x0ced('0x49')]=function(_0x303a6c,_0x75dc81){return db[_0x0ced('0x2c')][_0x0ced('0x49')](_0x303a6c[_0x0ced('0x4a')],{})[_0x0ced('0x25')](respondWithResult(_0x75dc81,0xc9))['catch'](handleError(_0x75dc81,null));};exports[_0x0ced('0x4b')]=function(_0x1b9d1c,_0x87e434){if(_0x1b9d1c['body']['id']){delete _0x1b9d1c['body']['id'];}return db[_0x0ced('0x2c')][_0x0ced('0x47')]({'where':{'id':_0x1b9d1c[_0x0ced('0x45')]['id']}})[_0x0ced('0x25')](handleEntityNotFound(_0x87e434,null))[_0x0ced('0x25')](saveUpdates(_0x1b9d1c['body'],null))[_0x0ced('0x25')](respondWithResult(_0x87e434,null))[_0x0ced('0x48')](handleError(_0x87e434,null));};exports['describe']=function(_0x3c03a0,_0x4d46a1){return db[_0x0ced('0x2c')]['describe']()[_0x0ced('0x25')](respondWithResult(_0x4d46a1,null))[_0x0ced('0x48')](handleError(_0x4d46a1,null));};exports[_0x0ced('0x4c')]=function(_0x556751,_0x266fa3,_0xd6dfe){var _0x5bdd6c=require('../../components/encryptor');var _0x3c175d=![];var _0x16e21e={};if(_0x556751['query']['type']&&_0x556751[_0x0ced('0x33')]['type']==='uniqueid'){_0x16e21e[_0x0ced('0x4d')]=_0x556751[_0x0ced('0x45')]['id'];}else{_0x16e21e['id']=_0x556751[_0x0ced('0x45')]['id'];}return db['VoiceRecording'][_0x0ced('0x47')]({'where':_0x16e21e,'attributes':['id','value'],'raw':!![]})[_0x0ced('0x25')](handleEntityNotFound(_0x266fa3,null))[_0x0ced('0x25')](function(_0x337af2){if(_0x337af2){var _0x1f3901=_0x337af2[_0x0ced('0x4e')];var _0x3c6817=util[_0x0ced('0x4f')](_0x0ced('0x50'),_0x1f3901);if(fs['existsSync'](_0x3c6817)){_0x3c175d=!![];return _0x5bdd6c[_0x0ced('0x51')](_0x3c6817,_0x1f3901,config[_0x0ced('0x52')][_0x0ced('0x53')])['then'](function(){return _0x337af2;});}return _0x337af2;}})[_0x0ced('0x25')](function(_0x3ee57c){if(_0x3ee57c){var _0x1f5333=_0x3ee57c['value'];if(!fs[_0x0ced('0x54')](_0x1f5333)){throw new db[(_0x0ced('0x55'))][(_0x0ced('0x56'))](_0x0ced('0x57'));}if(_0x3ee57c[_0x0ced('0x58')]){return _0x266fa3[_0x0ced('0x4c')](_0x1f5333,_0x3ee57c['filename']+path['extname'](_0x1f5333),function(){if(_0x3c175d){fs[_0x0ced('0x59')](_0x1f5333);}});}else{return _0x266fa3[_0x0ced('0x4c')](_0x1f5333,function(_0xb45b89){if(_0x3c175d){fs[_0x0ced('0x59')](_0x1f5333);}});}}})[_0x0ced('0x48')](function(_0x22a806){if(_0x22a806[_0x0ced('0x5a')]===_0x0ced('0x57')){_0x266fa3['status'](0x194)[_0x0ced('0x5b')]('Not\x20found');}else{return handleError(_0x266fa3,null);}});};exports[_0x0ced('0x5c')]=function(_0x3a89c7,_0x267fa2,_0x4c2a7a){var _0xbbafe9=require('../../components/encryptor');var _0x550078=![];var _0x11a0ab={'$and':[db[_0x0ced('0x5d')]['where'](db['sequelize']['fn'](_0x0ced('0x5e'),db[_0x0ced('0x5d')][_0x0ced('0x5f')](_0x0ced('0x4d'))),_0x3a89c7[_0x0ced('0x33')][_0x0ced('0x60')])]};if(_0x3a89c7['query'][_0x0ced('0x2f')]&&_0x3a89c7[_0x0ced('0x33')]['type']===_0x0ced('0x4d')){_0x11a0ab['$and']['push']({'uniqueid':_0x3a89c7['params']['id']});}else{_0x11a0ab['$and'][_0x0ced('0x61')]({'id':_0x3a89c7[_0x0ced('0x45')]['id']});}return db[_0x0ced('0x2c')][_0x0ced('0x47')]({'where':_0x11a0ab,'attributes':['id',_0x0ced('0x4e')],'raw':!![]})[_0x0ced('0x25')](handleEntityNotFound(_0x267fa2,null))[_0x0ced('0x25')](function(_0x10d433){if(_0x10d433){var _0xf186e9=util['format']('%s.cypher',_0x10d433[_0x0ced('0x4e')]);if(fs[_0x0ced('0x54')](_0xf186e9)){_0x550078=!![];return _0xbbafe9['decryptFile'](_0xf186e9,_0x10d433[_0x0ced('0x4e')],config[_0x0ced('0x52')][_0x0ced('0x53')])['then'](function(){return _0x10d433;});}return _0x10d433;}})[_0x0ced('0x25')](function(_0x51620f){if(_0x51620f){if(!fs['existsSync'](_0x51620f[_0x0ced('0x4e')])){throw new db['Sequelize'][(_0x0ced('0x56'))](_0x0ced('0x57'));}if(_0x51620f[_0x0ced('0x58')]){return _0x267fa2[_0x0ced('0x4c')](_0x51620f[_0x0ced('0x4e')],_0x51620f['filename']+path['extname'](_0x51620f[_0x0ced('0x4e')]),function(){if(_0x550078){fs[_0x0ced('0x59')](_0x51620f[_0x0ced('0x4e')]);}});}else{return _0x267fa2['download'](_0x51620f['value'],function(_0x78908d){if(_0x550078){fs[_0x0ced('0x59')](_0x51620f[_0x0ced('0x4e')]);}});}}})[_0x0ced('0x48')](handleError(_0x267fa2,null));};exports[_0x0ced('0x26')]=function(_0x1bc455,_0x16da78){return db[_0x0ced('0x2c')][_0x0ced('0x47')]({'where':{'id':_0x1bc455[_0x0ced('0x45')]['id']}})[_0x0ced('0x25')](function(_0x29ad4b){if(_[_0x0ced('0x62')](_0x29ad4b)){throw new ReferenceError('Entity\x20not\x20found');}return _0x29ad4b;})[_0x0ced('0x25')](function(_0x4c900e){var _0x902094=_0x4c900e['value'];logger[_0x0ced('0x63')](_0x0ced('0x64'),_0x902094);if(!_['isNil'](_0x4c900e[_0x0ced('0x4e')])&&fs[_0x0ced('0x54')](_0x902094)){logger['info'](_0x0ced('0x65')+_0x902094+_0x0ced('0x66'));fs[_0x0ced('0x67')](_0x902094);}_0x902094=_0x902094+_0x0ced('0x68');if(!_[_0x0ced('0x62')](_0x4c900e['value'])&&fs['existsSync'](_0x902094)){logger[_0x0ced('0x63')](_0x0ced('0x65')+_0x902094+_0x0ced('0x66'));fs[_0x0ced('0x67')](_0x902094);}return _0x4c900e;})[_0x0ced('0x25')](function(_0x556d9a){if(!_0x556d9a)throw new InternalError();return _0x556d9a['destroy']();})[_0x0ced('0x25')](function(){_0x16da78['status'](0xcc)[_0x0ced('0x1c')]();})[_0x0ced('0x48')](handleError(_0x16da78,null));};function getBucketslist(_0x59ee2a,_0x3cbcc0,_0x162ec8){return new Promise(function(_0x524953,_0xb8f4cd){var _0x5082a2=new AWS['S3']({'accessKeyId':_0x3cbcc0,'secretAccessKey':_0x59ee2a,'region':_0x162ec8});_0x5082a2['listBuckets']({},function(_0x52b200,_0x453851){if(_0x52b200){return _0xb8f4cd(_0x52b200);}else{return _0x524953(_0x453851);}});});}function createBucket(_0x56ab3d,_0x51fc4d,_0x5caf94,_0x39da49){return new Promise(function(_0x4e026a,_0x4e52b5){var _0x5f5960=new AWS['S3']({'accessKeyId':_0x51fc4d,'secretAccessKey':_0x56ab3d,'region':_0x5caf94});_0x5f5960[_0x0ced('0x69')]({'Bucket':_0x39da49},function(_0x5b5201,_0x527894){if(_0x5b5201){return _0x4e52b5(_0x5b5201);}else{return _0x4e026a(_0x527894);}});});}function uploadFile(_0x1dda28,_0x5ed0f1,_0x385b7d,_0xf5b404,_0x53d64d,_0x144f4f){return new Promise(function(_0x38b518,_0x2627af){var _0x3fb2cb=new AWS['S3']({'accessKeyId':_0x5ed0f1,'secretAccessKey':_0x1dda28,'region':_0x385b7d});_0x3fb2cb[_0x0ced('0x6a')]({'Bucket':_0xf5b404,'Key':_0x53d64d,'Body':_0x144f4f},function(_0x2ebf11,_0x257c16){if(_0x2ebf11){return _0x2627af(_0x2ebf11);}else{return _0x38b518(_0x257c16);}});});}function startTranscribe(_0x14d167,_0x242e6a,_0x26579e,_0x280d6b,_0x34d495,_0x1f731b){return new Promise(function(_0x18e8a1,_0x2b6c3a){var _0x5083bd=new AWS[(_0x0ced('0x6b'))]({'accessKeyId':_0x242e6a,'secretAccessKey':_0x14d167,'region':_0x26579e});_0x5083bd['startTranscriptionJob']({'TranscriptionJobName':_0x280d6b,'LanguageCode':_0x34d495,'Media':{'MediaFileUri':_0x1f731b}},function(_0xa4030d,_0x2e305f){if(_0xa4030d){return _0x2b6c3a(_0xa4030d);}else{return _0x18e8a1(_0x2e305f);}});});}function transcribe(_0x534c2d,_0x56b5b1,_0x517429,_0x275e0b,_0x5a8daa,_0x4d95cc,_0x471f6c){return new Promise(function(_0xe21314,_0x4a44b1){var _0x4f683a={};logger[_0x0ced('0x63')](util[_0x0ced('0x4f')](_0x0ced('0x6c'),_0x534c2d,_0x5a8daa));return uploadFile(_0x56b5b1,_0x517429,_0x275e0b,_0x5a8daa,path[_0x0ced('0x6d')](_0x4d95cc),fs[_0x0ced('0x6e')](_0x4d95cc))[_0x0ced('0x25')](function(_0x5c9c8e){logger[_0x0ced('0x63')](util[_0x0ced('0x4f')](_0x0ced('0x6f'),_0x534c2d,_0x5a8daa,_0x5c9c8e[_0x0ced('0x70')]));_0x4f683a[_0x0ced('0x71')]=_0x5c9c8e[_0x0ced('0x72')];_0x4f683a[_0x0ced('0x73')]=_0x5c9c8e['Location'];logger[_0x0ced('0x63')](util[_0x0ced('0x4f')](_0x0ced('0x74'),_0x534c2d));return startTranscribe(_0x56b5b1,_0x517429,_0x275e0b,uuidv4(),_0x471f6c,_0x5c9c8e['Location']);})['then'](function(_0x4adf1f){logger[_0x0ced('0x63')](util['format'](_0x0ced('0x75'),_0x534c2d,_0x4adf1f['TranscriptionJob'][_0x0ced('0x76')]));_0x4f683a[_0x0ced('0x77')]=_0x4adf1f[_0x0ced('0x78')][_0x0ced('0x76')];_0x4f683a[_0x0ced('0x79')]=_0x4adf1f[_0x0ced('0x78')][_0x0ced('0x7a')];return _0xe21314(_0x4f683a);})[_0x0ced('0x48')](function(_0x58c79a){return _0x4a44b1(_0x58c79a);});});}exports[_0x0ced('0x7b')]=function(_0x2747d4,_0x2d3673,_0x3ae38c){var _0x146ada;var _0x519f47;var _0x4a9e4f;var _0x545d94=require(_0x0ced('0x7c'));return db[_0x0ced('0x2c')][_0x0ced('0x7d')]({'where':{'id':_0x2747d4[_0x0ced('0x45')]['id']}})['then'](function(_0x33c401){if(_0x33c401){var _0x1f532a=util[_0x0ced('0x4f')]('%s.cypher',_0x33c401[_0x0ced('0x4e')]);if(fs[_0x0ced('0x54')](_0x1f532a)){cypher=!![];return _0x545d94[_0x0ced('0x51')](_0x1f532a,_0x33c401[_0x0ced('0x4e')],config[_0x0ced('0x52')]['recording'])[_0x0ced('0x25')](function(){return _0x33c401;});}return _0x33c401;}})[_0x0ced('0x25')](function(_0x6d3994){if(!_0x6d3994){throw new db[(_0x0ced('0x55'))][(_0x0ced('0x56'))]('Voice\x20Recording\x20not\x20found');}_0x519f47=_0x6d3994;return db['Setting'][_0x0ced('0x7d')]({'where':{'id':0x1}});})[_0x0ced('0x25')](handleEntityNotFound(_0x2d3673,null))[_0x0ced('0x25')](function(_0x19d9b5){if(_0x19d9b5){_0x146ada=_0x19d9b5;if(!_0x146ada['transcribe']||!_0x146ada['transcribeAccountId']||!_0x146ada[_0x0ced('0x7e')]||!_0x146ada['language']||!_0x146ada[_0x0ced('0x71')]){throw new db['Sequelize'][(_0x0ced('0x56'))]('Transcribe\x20not\x20configured');}if(_0x2747d4['body']['runSentiment']&&(!_0x146ada['sentiment']||!_0x146ada[_0x0ced('0x7f')]||!_0x146ada[_0x0ced('0x80')]||!_0x146ada[_0x0ced('0x81')]||!_0x146ada['bucket'])){throw new db[(_0x0ced('0x55'))][(_0x0ced('0x56'))](_0x0ced('0x82'));}return db[_0x0ced('0x83')][_0x0ced('0x7d')]({'where':{'id':_0x146ada[_0x0ced('0x84')]}});}})[_0x0ced('0x25')](function(_0x492e57){if(!_0x492e57){throw new db['Sequelize'][(_0x0ced('0x56'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x492e57[_0x0ced('0x85')]||!_0x492e57[_0x0ced('0x86')]){throw new db[(_0x0ced('0x55'))]['ValidationError'](_0x0ced('0x87'));}_0x4a9e4f=_0x492e57;return getBucketslist(_0x4a9e4f[_0x0ced('0x85')],_0x4a9e4f[_0x0ced('0x86')],_0x146ada[_0x0ced('0x7e')]);})['then'](function(_0x1a96f9){if(_0x1a96f9&&_0x1a96f9['Buckets']){var _0x3cd586=_[_0x0ced('0x47')](_0x1a96f9[_0x0ced('0x88')],function(_0x1110a0){return _0x1110a0[_0x0ced('0x89')]===_0x146ada[_0x0ced('0x71')];});if(!_0x3cd586){logger[_0x0ced('0x63')](util[_0x0ced('0x4f')](_0x0ced('0x8a'),_0x2747d4[_0x0ced('0x45')]['id'],_0x146ada[_0x0ced('0x71')]));return createBucket(_0x4a9e4f[_0x0ced('0x85')],_0x4a9e4f[_0x0ced('0x86')],_0x146ada[_0x0ced('0x7e')],_0x146ada['bucket']);}logger['info'](util[_0x0ced('0x4f')](_0x0ced('0x8b'),_0x2747d4[_0x0ced('0x45')]['id'],_0x146ada[_0x0ced('0x71')]));return;}})[_0x0ced('0x25')](function(_0x528077){if(_0x519f47[_0x0ced('0x79')]===_0x0ced('0x8c')){return transcribe(_0x2747d4[_0x0ced('0x45')]['id'],_0x4a9e4f[_0x0ced('0x85')],_0x4a9e4f['data2'],_0x146ada['transcribeRegion'],_0x146ada[_0x0ced('0x71')],_0x519f47[_0x0ced('0x4e')],_0x146ada[_0x0ced('0x81')]);}else{logger[_0x0ced('0x63')](util[_0x0ced('0x4f')](_0x0ced('0x8d'),_0x2747d4[_0x0ced('0x45')]['id']));return{'transcribeStatus':_0x0ced('0x8e')};}})[_0x0ced('0x25')](function(_0x85dcf6){if(_0x85dcf6){_0x85dcf6[_0x0ced('0x8f')]=_0x2747d4[_0x0ced('0x4a')][_0x0ced('0x90')];return _0x519f47[_0x0ced('0x91')](_0x85dcf6);}})[_0x0ced('0x25')](respondWithResult(_0x2d3673,null))[_0x0ced('0x48')](handleError(_0x2d3673,null));};function writeFile(_0x289619,_0x4945f5){return new Promise(function(_0x4d2eb0,_0x20175f){fs[_0x0ced('0x92')](_0x4945f5,_0x289619,function(_0x2946ca,_0x187b2a){if(_0x2946ca){return _0x20175f(_0x2946ca);}else{return _0x4d2eb0(_0x187b2a);}});});}exports[_0x0ced('0x93')]=function(_0x1cae6a,_0x320dbc,_0x529066){return db[_0x0ced('0x2c')][_0x0ced('0x7d')]({'where':{'id':_0x1cae6a['params']['id']}})[_0x0ced('0x25')](handleEntityNotFound(_0x320dbc))['then'](function(_0x4c50d4){if(_0x4c50d4&&_0x4c50d4[_0x0ced('0x94')]){var _0x53a151=_0x4c50d4[_0x0ced('0x94')];var _0x51e703=config[_0x0ced('0x95')]+_0x0ced('0x96')+_0x4c50d4['id']+'.txt';if(fs[_0x0ced('0x54')](_0x51e703)){return _0x51e703;}return writeFile(_0x53a151,_0x51e703)[_0x0ced('0x25')](function(){return _0x51e703;});}else{throw new db[(_0x0ced('0x55'))][(_0x0ced('0x56'))](_0x0ced('0x97'));}})[_0x0ced('0x25')](function(_0x52e459){return _0x320dbc[_0x0ced('0x4c')](_0x52e459);})[_0x0ced('0x48')](handleError(_0x320dbc));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 63f6a90..c93e058 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 _0x8972=['./voiceRecording.attributes','exports','define','VoiceRecording','voice_recordings','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment'];(function(_0xfc54ee,_0x2987fc){var _0x5cad39=function(_0x5f1faf){while(--_0x5f1faf){_0xfc54ee['push'](_0xfc54ee['shift']());}};_0x5cad39(++_0x2987fc);}(_0x8972,0xd8));var _0x2897=function(_0x1a61b2,_0x6f4aa6){_0x1a61b2=_0x1a61b2-0x0;var _0x11aabb=_0x8972[_0x1a61b2];return _0x11aabb;};'use strict';var _=require(_0x2897('0x0'));var util=require(_0x2897('0x1'));var logger=require(_0x2897('0x2'))('api');var moment=require(_0x2897('0x3'));var BPromise=require(_0x2897('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2897('0x5'));var rimraf=require(_0x2897('0x6'));var config=require(_0x2897('0x7'));var attributes=require(_0x2897('0x8'));module[_0x2897('0x9')]=function(_0x468a0f,_0x3cd9a8){return _0x468a0f[_0x2897('0xa')](_0x2897('0xb'),attributes,{'tableName':_0x2897('0xc'),'paranoid':![],'indexes':[{'name':_0x2897('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x1c90=['path','rimraf','../../config/environment','./voiceRecording.attributes','exports','define','voice_recordings','uniqueid','../../config/logger','moment','bluebird','request-promise'];(function(_0x33554b,_0x48162b){var _0x256954=function(_0x185f66){while(--_0x185f66){_0x33554b['push'](_0x33554b['shift']());}};_0x256954(++_0x48162b);}(_0x1c90,0x188));var _0x01c9=function(_0x322f09,_0x549086){_0x322f09=_0x322f09-0x0;var _0x583dc7=_0x1c90[_0x322f09];return _0x583dc7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x01c9('0x0'))('api');var moment=require(_0x01c9('0x1'));var BPromise=require(_0x01c9('0x2'));var rp=require(_0x01c9('0x3'));var fs=require('fs');var path=require(_0x01c9('0x4'));var rimraf=require(_0x01c9('0x5'));var config=require(_0x01c9('0x6'));var attributes=require(_0x01c9('0x7'));module[_0x01c9('0x8')]=function(_0x384b29,_0x4055ec){return _0x384b29[_0x01c9('0x9')]('VoiceRecording',attributes,{'tableName':_0x01c9('0xa'),'paranoid':![],'indexes':[{'name':_0x01c9('0xb'),'fields':[_0x01c9('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 7ec56c1..2b1ab30 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 _0xd943=['info','request\x20sent','VoiceRecording,\x20%s,\x20%s,\x20%s','error','code','VoiceRecording,\x20%s,\x20%s','message','result','catch','UpdateVoiceRecording','VoiceRecording','body','options','raw','where','attributes','debug','stringify','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','existsSync','value','format','secrets','recording','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','then'];(function(_0x38ae4f,_0x1d3180){var _0x1e92db=function(_0x1a1cb9){while(--_0x1a1cb9){_0x38ae4f['push'](_0x38ae4f['shift']());}};_0x1e92db(++_0x1d3180);}(_0xd943,0x15d));var _0x3d94=function(_0x2b18b1,_0x89526f){_0x2b18b1=_0x2b18b1-0x0;var _0xba6f18=_0xd943[_0x2b18b1];return _0xba6f18;};'use strict';var _=require(_0x3d94('0x0'));var util=require(_0x3d94('0x1'));var moment=require(_0x3d94('0x2'));var BPromise=require(_0x3d94('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3d94('0x4'));var db=require(_0x3d94('0x5'))['db'];var utils=require(_0x3d94('0x6'));var logger=require(_0x3d94('0x7'))(_0x3d94('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3d94('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54e81f,_0x4d29e7,_0x20f4d1){return new BPromise(function(_0x35d36a,_0x5244c3){return client['request'](_0x54e81f,_0x20f4d1)[_0x3d94('0xa')](function(_0x27e381){logger[_0x3d94('0xb')]('VoiceRecording,\x20%s,\x20%s',_0x4d29e7,_0x3d94('0xc'));logger['debug'](_0x3d94('0xd'),_0x4d29e7,_0x3d94('0xc'),JSON['stringify'](_0x27e381));if(_0x27e381[_0x3d94('0xe')]){if(_0x27e381[_0x3d94('0xe')][_0x3d94('0xf')]===0x1f4){logger[_0x3d94('0xe')](_0x3d94('0x10'),_0x4d29e7,_0x27e381['error'][_0x3d94('0x11')]);return _0x5244c3(_0x27e381[_0x3d94('0xe')][_0x3d94('0x11')]);}logger['error'](_0x3d94('0x10'),_0x4d29e7,_0x27e381[_0x3d94('0xe')][_0x3d94('0x11')]);return _0x35d36a(_0x27e381['error'][_0x3d94('0x11')]);}else{logger[_0x3d94('0xb')](_0x3d94('0x10'),_0x4d29e7,_0x3d94('0xc'));_0x35d36a(_0x27e381[_0x3d94('0x12')][_0x3d94('0x11')]);}})[_0x3d94('0x13')](function(_0x9893cb){logger['error'](_0x3d94('0x10'),_0x4d29e7,_0x9893cb);_0x5244c3(_0x9893cb);});});}exports[_0x3d94('0x14')]=function(_0x2acee3){var _0x1c35a8=this;return new Promise(function(_0x4afc92,_0x3ca0e3){return db[_0x3d94('0x15')]['update'](_0x2acee3[_0x3d94('0x16')],{'raw':_0x2acee3['options']?_0x2acee3[_0x3d94('0x17')][_0x3d94('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2acee3[_0x3d94('0x17')]?_0x2acee3[_0x3d94('0x17')][_0x3d94('0x19')]||null:null,'attributes':_0x2acee3['options']?_0x2acee3['options'][_0x3d94('0x1a')]||null:null,'limit':_0x2acee3[_0x3d94('0x17')]?_0x2acee3[_0x3d94('0x17')]['limit']||null:null})[_0x3d94('0xa')](function(_0x2e8c91){logger[_0x3d94('0xb')](_0x3d94('0x14'),_0x2acee3);logger[_0x3d94('0x1b')](_0x3d94('0x14'),_0x2acee3,JSON[_0x3d94('0x1c')](_0x2e8c91));_0x4afc92(_0x2e8c91);})[_0x3d94('0x13')](function(_0xee7b8d){logger[_0x3d94('0xe')](_0x3d94('0x14'),_0xee7b8d[_0x3d94('0x11')],_0x2acee3);_0x3ca0e3(_0x1c35a8[_0x3d94('0xe')](0x1f4,_0xee7b8d[_0x3d94('0x11')]));});});};exports[_0x3d94('0x1d')]=function(_0x5b3b31){var _0x123183=this;return new Promise(function(_0x558fd2,_0x28a698){var _0x1d0a7a=require(_0x3d94('0x1e'));var _0x439173;return db[_0x3d94('0x1f')][_0x3d94('0x20')]({'attributes':['id',_0x3d94('0x21')],'where':{'id':0x1},'raw':!![]})['then'](function(_0x584c4a){_0x439173=_0x584c4a;return db[_0x3d94('0x15')]['create'](_0x5b3b31['body']);})[_0x3d94('0xa')](function(_0x58c0d0){if(_0x439173[_0x3d94('0x21')]&&fs[_0x3d94('0x22')](_0x58c0d0[_0x3d94('0x23')])){var _0x4cef9c=util[_0x3d94('0x24')]('%s.cypher',_0x58c0d0[_0x3d94('0x23')]);return _0x1d0a7a['encryptFile'](_0x58c0d0[_0x3d94('0x23')],_0x4cef9c,config[_0x3d94('0x25')][_0x3d94('0x26')])[_0x3d94('0xa')](function(){fs['unlink'](_0x58c0d0[_0x3d94('0x23')]);logger['info'](_0x3d94('0x27'));return _0x58c0d0;});}return _0x58c0d0;})[_0x3d94('0xa')](function(_0x51d308){logger['info'](_0x3d94('0x1d'),_0x5b3b31);logger[_0x3d94('0x1b')](_0x3d94('0x1d'),_0x5b3b31,JSON['stringify'](_0x51d308));_0x558fd2(_0x51d308);})[_0x3d94('0x13')](function(_0x3d29fd){logger['error'](_0x3d94('0x1d'),_0x3d29fd[_0x3d94('0x11')],_0x5b3b31);_0x28a698(_0x123183[_0x3d94('0xe')](0x1f4,_0x3d29fd[_0x3d94('0x11')]));});});}; \ No newline at end of file +var _0x0295=['client','http','then','info','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','VoiceRecording,\x20%s,\x20%s','message','result','catch','VoiceRecording','update','body','options','where','limit','UpdateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','create','existsSync','value','format','%s.cypher','encryptFile','secrets','recording','unlink','CreateVoiceRecording','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x208ad0,_0x3386cf){var _0x578738=function(_0x317295){while(--_0x317295){_0x208ad0['push'](_0x208ad0['shift']());}};_0x578738(++_0x3386cf);}(_0x0295,0x1f0));var _0x5029=function(_0x11ae28,_0x5a2fa9){_0x11ae28=_0x11ae28-0x0;var _0x5012ec=_0x0295[_0x11ae28];return _0x5012ec;};'use strict';var _=require(_0x5029('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5029('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5029('0x2'))['db'];var utils=require(_0x5029('0x3'));var logger=require(_0x5029('0x4'))(_0x5029('0x5'));var config=require(_0x5029('0x6'));var jayson=require(_0x5029('0x7'));var client=jayson[_0x5029('0x8')][_0x5029('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b3cd,_0x502a62,_0x54978f){return new BPromise(function(_0x4ee867,_0xf4459b){return client['request'](_0x5b3cd,_0x54978f)[_0x5029('0xa')](function(_0x5bccfc){logger[_0x5029('0xb')]('VoiceRecording,\x20%s,\x20%s',_0x502a62,_0x5029('0xc'));logger[_0x5029('0xd')](_0x5029('0xe'),_0x502a62,'request\x20sent',JSON[_0x5029('0xf')](_0x5bccfc));if(_0x5bccfc[_0x5029('0x10')]){if(_0x5bccfc[_0x5029('0x10')]['code']===0x1f4){logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x5bccfc['error']['message']);return _0xf4459b(_0x5bccfc['error']['message']);}logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x5bccfc[_0x5029('0x10')][_0x5029('0x12')]);return _0x4ee867(_0x5bccfc[_0x5029('0x10')][_0x5029('0x12')]);}else{logger[_0x5029('0xb')](_0x5029('0x11'),_0x502a62,_0x5029('0xc'));_0x4ee867(_0x5bccfc[_0x5029('0x13')][_0x5029('0x12')]);}})[_0x5029('0x14')](function(_0x3786b5){logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x3786b5);_0xf4459b(_0x3786b5);});});}exports['UpdateVoiceRecording']=function(_0x1ed567){var _0x31a155=this;return new Promise(function(_0x35de81,_0x4902f3){return db[_0x5029('0x15')][_0x5029('0x16')](_0x1ed567[_0x5029('0x17')],{'raw':_0x1ed567['options']?_0x1ed567[_0x5029('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ed567[_0x5029('0x18')]?_0x1ed567[_0x5029('0x18')][_0x5029('0x19')]||null:null,'attributes':_0x1ed567[_0x5029('0x18')]?_0x1ed567['options']['attributes']||null:null,'limit':_0x1ed567[_0x5029('0x18')]?_0x1ed567['options'][_0x5029('0x1a')]||null:null})[_0x5029('0xa')](function(_0x1eb228){logger[_0x5029('0xb')](_0x5029('0x1b'),_0x1ed567);logger[_0x5029('0xd')](_0x5029('0x1b'),_0x1ed567,JSON[_0x5029('0xf')](_0x1eb228));_0x35de81(_0x1eb228);})[_0x5029('0x14')](function(_0x4ceaae){logger['error']('UpdateVoiceRecording',_0x4ceaae[_0x5029('0x12')],_0x1ed567);_0x4902f3(_0x31a155[_0x5029('0x10')](0x1f4,_0x4ceaae['message']));});});};exports['CreateVoiceRecording']=function(_0x181da0){var _0x1e7e61=this;return new Promise(function(_0x36d810,_0x5527fc){var _0x2c501f=require(_0x5029('0x1c'));var _0x5e45c4;return db[_0x5029('0x1d')][_0x5029('0x1e')]({'attributes':['id',_0x5029('0x1f')],'where':{'id':0x1},'raw':!![]})['then'](function(_0x32da06){_0x5e45c4=_0x32da06;return db[_0x5029('0x15')][_0x5029('0x20')](_0x181da0['body']);})[_0x5029('0xa')](function(_0x2bb398){if(_0x5e45c4['callRecordingEncryption']&&fs[_0x5029('0x21')](_0x2bb398[_0x5029('0x22')])){var _0x4434ff=util[_0x5029('0x23')](_0x5029('0x24'),_0x2bb398[_0x5029('0x22')]);return _0x2c501f[_0x5029('0x25')](_0x2bb398[_0x5029('0x22')],_0x4434ff,config[_0x5029('0x26')][_0x5029('0x27')])[_0x5029('0xa')](function(){fs[_0x5029('0x28')](_0x2bb398['value']);logger[_0x5029('0xb')]('CreateVoiceRecording\x20file\x20encrypted');return _0x2bb398;});}return _0x2bb398;})[_0x5029('0xa')](function(_0x4f672e){logger['info'](_0x5029('0x29'),_0x181da0);logger[_0x5029('0xd')](_0x5029('0x29'),_0x181da0,JSON['stringify'](_0x4f672e));_0x36d810(_0x4f672e);})[_0x5029('0x14')](function(_0x15d882){logger[_0x5029('0x10')](_0x5029('0x29'),_0x15d882[_0x5029('0x12')],_0x181da0);_0x5527fc(_0x1e7e61[_0x5029('0x10')](0x1f4,_0x15d882[_0x5029('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 8281352..32a59d8 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 _0x7957=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','./voiceTransferReport.controller','get','index','/describe','isAuthenticated','describe','/:id','post','create','put','update','destroy','exports','util','path'];(function(_0x45f7d3,_0x5603df){var _0x27b628=function(_0x466011){while(--_0x466011){_0x45f7d3['push'](_0x45f7d3['shift']());}};_0x27b628(++_0x5603df);}(_0x7957,0x1b6));var _0x7795=function(_0x48d6a3,_0x37c848){_0x48d6a3=_0x48d6a3-0x0;var _0x38bfa0=_0x7957[_0x48d6a3];return _0x38bfa0;};'use strict';var multer=require('multer');var util=require(_0x7795('0x0'));var path=require(_0x7795('0x1'));var timeout=require(_0x7795('0x2'));var express=require(_0x7795('0x3'));var router=express[_0x7795('0x4')]();var fs_extra=require(_0x7795('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x7795('0x6'));var config=require('../../config/environment');var controller=require(_0x7795('0x7'));router[_0x7795('0x8')]('/',auth['isAuthenticated'](),controller[_0x7795('0x9')]);router['get'](_0x7795('0xa'),auth[_0x7795('0xb')](),controller[_0x7795('0xc')]);router['get'](_0x7795('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x7795('0xe')]('/',auth[_0x7795('0xb')](),controller[_0x7795('0xf')]);router[_0x7795('0x10')]('/:id',auth[_0x7795('0xb')](),controller[_0x7795('0x11')]);router['delete'](_0x7795('0xd'),auth[_0x7795('0xb')](),controller[_0x7795('0x12')]);module[_0x7795('0x13')]=router; \ No newline at end of file +var _0x0690=['multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceTransferReport.controller','get','isAuthenticated','index','/describe','/:id','show','put','update','delete','destroy','exports'];(function(_0x2fe85a,_0x28c346){var _0x468e0f=function(_0x515887){while(--_0x515887){_0x2fe85a['push'](_0x2fe85a['shift']());}};_0x468e0f(++_0x28c346);}(_0x0690,0x104));var _0x0069=function(_0x1bfab6,_0x1e883b){_0x1bfab6=_0x1bfab6-0x0;var _0x590b19=_0x0690[_0x1bfab6];return _0x590b19;};'use strict';var multer=require(_0x0069('0x0'));var util=require(_0x0069('0x1'));var path=require(_0x0069('0x2'));var timeout=require('connect-timeout');var express=require(_0x0069('0x3'));var router=express[_0x0069('0x4')]();var fs_extra=require(_0x0069('0x5'));var auth=require(_0x0069('0x6'));var interaction=require(_0x0069('0x7'));var config=require('../../config/environment');var controller=require(_0x0069('0x8'));router[_0x0069('0x9')]('/',auth[_0x0069('0xa')](),controller[_0x0069('0xb')]);router['get'](_0x0069('0xc'),auth[_0x0069('0xa')](),controller['describe']);router[_0x0069('0x9')](_0x0069('0xd'),auth[_0x0069('0xa')](),controller[_0x0069('0xe')]);router['post']('/',auth[_0x0069('0xa')](),controller['create']);router[_0x0069('0xf')](_0x0069('0xd'),auth[_0x0069('0xa')](),controller[_0x0069('0x10')]);router[_0x0069('0x11')](_0x0069('0xd'),auth['isAuthenticated'](),controller[_0x0069('0x12')]);module[_0x0069('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 2dc4e3d..f15f34d 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 _0xb7f2=['blind','attended','STRING','ENUM','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb7f2,0x15a));var _0x2b7f=function(_0x325792,_0x4c4f0b){_0x325792=_0x325792-0x0;var _0x3c1652=_0xb7f2[_0x325792];return _0x3c1652;};'use strict';var Sequelize=require(_0x2b7f('0x0'));var moment=require('moment');module[_0x2b7f('0x1')]={'type':{'type':Sequelize['ENUM'](_0x2b7f('0x2'),_0x2b7f('0x3'))},'result':{'type':Sequelize[_0x2b7f('0x4')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0x2b7f('0x4')]},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize[_0x2b7f('0x4')]},'transfererconnectedlinename':{'type':Sequelize[_0x2b7f('0x4')]},'transfereraccountcode':{'type':Sequelize[_0x2b7f('0x4')]},'transferercontext':{'type':Sequelize[_0x2b7f('0x4')]},'transfererexten':{'type':Sequelize[_0x2b7f('0x4')]},'transfererlinkedid':{'type':Sequelize[_0x2b7f('0x4')]},'transfereechannel':{'type':Sequelize[_0x2b7f('0x4')]},'transfereecalleridnum':{'type':Sequelize[_0x2b7f('0x4')]},'transfereecalleridname':{'type':Sequelize[_0x2b7f('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x2b7f('0x4')]},'transfereeconnectedlinename':{'type':Sequelize[_0x2b7f('0x4')]},'transfereeaccountcode':{'type':Sequelize[_0x2b7f('0x4')]},'transfereecontext':{'type':Sequelize[_0x2b7f('0x4')]},'transfereeexten':{'type':Sequelize[_0x2b7f('0x4')]},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize[_0x2b7f('0x5')]('Yes','No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x2b7f('0x4')]}}; \ No newline at end of file +var _0x9d71=['attended','STRING','Yes','sequelize','exports','ENUM','blind'];(function(_0x15d450,_0x16663c){var _0x3358a2=function(_0x56a5af){while(--_0x56a5af){_0x15d450['push'](_0x15d450['shift']());}};_0x3358a2(++_0x16663c);}(_0x9d71,0x1c3));var _0x19d7=function(_0x4da661,_0x34d40d){_0x4da661=_0x4da661-0x0;var _0x45e9b2=_0x9d71[_0x4da661];return _0x45e9b2;};'use strict';var Sequelize=require(_0x19d7('0x0'));var moment=require('moment');module[_0x19d7('0x1')]={'type':{'type':Sequelize[_0x19d7('0x2')](_0x19d7('0x3'),_0x19d7('0x4'))},'result':{'type':Sequelize[_0x19d7('0x5')]},'transfererchannel':{'type':Sequelize[_0x19d7('0x5')]},'transferercalleridnum':{'type':Sequelize[_0x19d7('0x5')]},'transferercalleridname':{'type':Sequelize[_0x19d7('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0x19d7('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0x19d7('0x5')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0x19d7('0x5')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0x19d7('0x5')]},'transfereechannel':{'type':Sequelize[_0x19d7('0x5')]},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize[_0x19d7('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x19d7('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0x19d7('0x5')]},'transfereeaccountcode':{'type':Sequelize[_0x19d7('0x5')]},'transfereecontext':{'type':Sequelize[_0x19d7('0x5')]},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0x19d7('0x5')]},'isexternal':{'type':Sequelize['ENUM'](_0x19d7('0x6'),'No')},'context':{'type':Sequelize[_0x19d7('0x5')]},'extension':{'type':Sequelize[_0x19d7('0x5')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index a73bfb1..0076f48 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 _0x554b=['papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','apply','save','then','error','stack','name','index','map','VoiceTransferReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','merge','where','VIRTUAL','options','include','findAll','rows','catch','params','includeAll','find','body','update','destroy','describe','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0x3a529c,_0x5c1593){var _0x297e49=function(_0xa45422){while(--_0xa45422){_0x3a529c['push'](_0x3a529c['shift']());}};_0x297e49(++_0x5c1593);}(_0x554b,0x85));var _0xb554=function(_0x271060,_0x3f86b1){_0x271060=_0x271060-0x0;var _0x40540b=_0x554b[_0x271060];return _0x40540b;};'use strict';var emlformat=require(_0xb554('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb554('0x1'));var rp=require('request-promise');var moment=require(_0xb554('0x2'));var BPromise=require(_0xb554('0x3'));var Mustache=require(_0xb554('0x4'));var util=require(_0xb554('0x5'));var path=require(_0xb554('0x6'));var sox=require('sox');var csv=require(_0xb554('0x7'));var ejs=require(_0xb554('0x8'));var fs=require('fs');var fs_extra=require(_0xb554('0x9'));var _=require(_0xb554('0xa'));var squel=require(_0xb554('0xb'));var crypto=require(_0xb554('0xc'));var jsforce=require(_0xb554('0xd'));var deskjs=require(_0xb554('0xe'));var toCsv=require(_0xb554('0x7'));var querystring=require('querystring');var Papa=require(_0xb554('0xf'));var Redis=require(_0xb554('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xb554('0x11'));var as=require(_0xb554('0x12'));var hardwareService=require(_0xb554('0x13'));var logger=require(_0xb554('0x14'))(_0xb554('0x15'));var utils=require('../../config/utils');var config=require(_0xb554('0x16'));var licenseUtil=require(_0xb554('0x17'));var db=require(_0xb554('0x18'))['db'];function respondWithStatusCode(_0x2ece7d,_0x223f81){_0x223f81=_0x223f81||0xcc;return function(_0x180b67){if(_0x180b67){return _0x2ece7d[_0xb554('0x19')](_0x223f81);}return _0x2ece7d[_0xb554('0x1a')](_0x223f81)[_0xb554('0x1b')]();};}function respondWithResult(_0x29bbc0,_0x50de42){_0x50de42=_0x50de42||0xc8;return function(_0x27b7fc){if(_0x27b7fc){return _0x29bbc0['status'](_0x50de42)[_0xb554('0x1c')](_0x27b7fc);}};}function respondWithFilteredResult(_0x317836,_0x214a35){return function(_0x3bc192){if(_0x3bc192){var _0x2e2475=typeof _0x214a35['offset']===_0xb554('0x1d')&&typeof _0x214a35['limit']==='undefined';var _0x548a8d=_0x3bc192[_0xb554('0x1e')];var _0x71ec8c=_0x2e2475?0x0:_0x214a35[_0xb554('0x1f')];var _0x2ca5d9=_0x2e2475?_0x3bc192[_0xb554('0x1e')]:_0x214a35['offset']+_0x214a35[_0xb554('0x20')];var _0x4417e3;if(_0x2ca5d9>=_0x548a8d){_0x2ca5d9=_0x548a8d;_0x4417e3=0xc8;}else{_0x4417e3=0xce;}_0x317836[_0xb554('0x1a')](_0x4417e3);return _0x317836[_0xb554('0x21')]('Content-Range',_0x71ec8c+'-'+_0x2ca5d9+'/'+_0x548a8d)[_0xb554('0x1c')](_0x3bc192);}return null;};}function patchUpdates(_0x28d38e){return function(_0x4a0752){try{jsonpatch[_0xb554('0x22')](_0x4a0752,_0x28d38e,!![]);}catch(_0xeaa6cd){return BPromise['reject'](_0xeaa6cd);}return _0x4a0752[_0xb554('0x23')]();};}function saveUpdates(_0x28e956,_0x4ba183){return function(_0x4872bc){if(_0x4872bc){return _0x4872bc['update'](_0x28e956)[_0xb554('0x24')](function(_0x2ceb99){return _0x2ceb99;});}return null;};}function removeEntity(_0x11a28e,_0x45a92f){return function(_0x263129){if(_0x263129){return _0x263129['destroy']()['then'](function(){_0x11a28e[_0xb554('0x1a')](0xcc)[_0xb554('0x1b')]();});}};}function handleEntityNotFound(_0x21e5cf,_0x219fbf){return function(_0x20c590){if(!_0x20c590){_0x21e5cf[_0xb554('0x19')](0x194);}return _0x20c590;};}function handleError(_0xec8997,_0x41091d){_0x41091d=_0x41091d||0x1f4;return function(_0x18cd89){logger[_0xb554('0x25')](_0x18cd89[_0xb554('0x26')]);if(_0x18cd89[_0xb554('0x27')]){delete _0x18cd89[_0xb554('0x27')];}_0xec8997[_0xb554('0x1a')](_0x41091d)['send'](_0x18cd89);};}exports[_0xb554('0x28')]=function(_0x24997c,_0xf6d2bb){var _0x32bace={},_0x14b303={},_0xfebc83={'count':0x0,'rows':[]};var _0x4ec1b9=_[_0xb554('0x29')](db[_0xb554('0x2a')][_0xb554('0x2b')],function(_0x2e24c9){return{'name':_0x2e24c9[_0xb554('0x2c')],'type':_0x2e24c9[_0xb554('0x2d')][_0xb554('0x2e')]};});_0x14b303[_0xb554('0x2f')]=_[_0xb554('0x29')](_0x4ec1b9,_0xb554('0x27'));_0x14b303['query']=_[_0xb554('0x30')](_0x24997c[_0xb554('0x31')]);_0x14b303[_0xb554('0x32')]=_[_0xb554('0x33')](_0x14b303[_0xb554('0x2f')],_0x14b303[_0xb554('0x31')]);_0x32bace['attributes']=_[_0xb554('0x33')](_0x14b303[_0xb554('0x2f')],qs[_0xb554('0x34')](_0x24997c['query'][_0xb554('0x34')]));_0x32bace[_0xb554('0x35')]=_0x32bace[_0xb554('0x35')][_0xb554('0x36')]?_0x32bace[_0xb554('0x35')]:_0x14b303[_0xb554('0x2f')];if(!_0x24997c[_0xb554('0x31')][_0xb554('0x37')]('nolimit')){_0x32bace[_0xb554('0x20')]=qs[_0xb554('0x20')](_0x24997c[_0xb554('0x31')][_0xb554('0x20')]);_0x32bace['offset']=qs[_0xb554('0x1f')](_0x24997c[_0xb554('0x31')][_0xb554('0x1f')]);}_0x32bace[_0xb554('0x38')]=qs[_0xb554('0x39')](_0x24997c[_0xb554('0x31')][_0xb554('0x39')]);_0x32bace['where']=qs['filters'](_[_0xb554('0x3a')](_0x24997c[_0xb554('0x31')],_0x14b303['filters']),_0x4ec1b9);if(_0x24997c[_0xb554('0x31')]['filter']){_0x32bace['where']=_[_0xb554('0x3b')](_0x32bace[_0xb554('0x3c')],{'$or':_[_0xb554('0x29')](_0x4ec1b9,function(_0x4815d3){if(_0x4815d3['type']!==_0xb554('0x3d')){var _0x4bfa79={};_0x4bfa79[_0x4815d3[_0xb554('0x27')]]={'$like':'%'+_0x24997c[_0xb554('0x31')]['filter']+'%'};return _0x4bfa79;}})});}_0x32bace=_[_0xb554('0x3b')]({},_0x32bace,_0x24997c[_0xb554('0x3e')]);var _0x452a0c={'where':_0x32bace[_0xb554('0x3c')]};return db[_0xb554('0x2a')][_0xb554('0x1e')](_0x452a0c)['then'](function(_0x2ba7b3){_0xfebc83[_0xb554('0x1e')]=_0x2ba7b3;if(_0x24997c[_0xb554('0x31')]['includeAll']){_0x32bace[_0xb554('0x3f')]=[{'all':!![]}];}return db[_0xb554('0x2a')][_0xb554('0x40')](_0x32bace);})[_0xb554('0x24')](function(_0x4f1a45){_0xfebc83[_0xb554('0x41')]=_0x4f1a45;return _0xfebc83;})['then'](respondWithFilteredResult(_0xf6d2bb,_0x32bace))[_0xb554('0x42')](handleError(_0xf6d2bb,null));};exports['show']=function(_0x4f9c39,_0x677ea5){var _0x542a04={'raw':!![],'where':{'id':_0x4f9c39[_0xb554('0x43')]['id']}},_0x330b90={};_0x330b90[_0xb554('0x2f')]=_[_0xb554('0x30')](db[_0xb554('0x2a')][_0xb554('0x2b')]);_0x330b90[_0xb554('0x31')]=_[_0xb554('0x30')](_0x4f9c39[_0xb554('0x31')]);_0x330b90[_0xb554('0x32')]=_[_0xb554('0x33')](_0x330b90[_0xb554('0x2f')],_0x330b90[_0xb554('0x31')]);_0x542a04['attributes']=_[_0xb554('0x33')](_0x330b90[_0xb554('0x2f')],qs['fields'](_0x4f9c39[_0xb554('0x31')][_0xb554('0x34')]));_0x542a04['attributes']=_0x542a04['attributes'][_0xb554('0x36')]?_0x542a04[_0xb554('0x35')]:_0x330b90['model'];if(_0x4f9c39['query'][_0xb554('0x44')]){_0x542a04['include']=[{'all':!![]}];}_0x542a04=_['merge']({},_0x542a04,_0x4f9c39[_0xb554('0x3e')]);return db[_0xb554('0x2a')][_0xb554('0x45')](_0x542a04)[_0xb554('0x24')](handleEntityNotFound(_0x677ea5,null))[_0xb554('0x24')](respondWithResult(_0x677ea5,null))['catch'](handleError(_0x677ea5,null));};exports['create']=function(_0x3e8247,_0x1b73ba){return db[_0xb554('0x2a')]['create'](_0x3e8247[_0xb554('0x46')],{})[_0xb554('0x24')](respondWithResult(_0x1b73ba,0xc9))[_0xb554('0x42')](handleError(_0x1b73ba,null));};exports[_0xb554('0x47')]=function(_0x146fbd,_0x55ee1b){if(_0x146fbd[_0xb554('0x46')]['id']){delete _0x146fbd[_0xb554('0x46')]['id'];}return db[_0xb554('0x2a')][_0xb554('0x45')]({'where':{'id':_0x146fbd[_0xb554('0x43')]['id']}})[_0xb554('0x24')](handleEntityNotFound(_0x55ee1b,null))[_0xb554('0x24')](saveUpdates(_0x146fbd[_0xb554('0x46')],null))[_0xb554('0x24')](respondWithResult(_0x55ee1b,null))[_0xb554('0x42')](handleError(_0x55ee1b,null));};exports[_0xb554('0x48')]=function(_0x4e9ef2,_0x26e6d0){return db[_0xb554('0x2a')][_0xb554('0x45')]({'where':{'id':_0x4e9ef2[_0xb554('0x43')]['id']}})['then'](handleEntityNotFound(_0x26e6d0,null))['then'](removeEntity(_0x26e6d0,null))[_0xb554('0x42')](handleError(_0x26e6d0,null));};exports[_0xb554('0x49')]=function(_0x7d8cfe,_0x479b34){return db[_0xb554('0x2a')][_0xb554('0x49')]()[_0xb554('0x24')](respondWithResult(_0x479b34,null))[_0xb554('0x42')](handleError(_0x479b34,null));}; \ No newline at end of file +var _0xd8b3=['offset','limit','count','status','set','Content-Range','reject','update','then','error','name','send','index','map','VoiceTransferReport','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','options','includeAll','include','catch','show','params','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','json'];(function(_0x324e86,_0x81b1cb){var _0x592846=function(_0x33439c){while(--_0x33439c){_0x324e86['push'](_0x324e86['shift']());}};_0x592846(++_0x81b1cb);}(_0xd8b3,0xbe));var _0x3d8b=function(_0x5a187b,_0x1f64fe){_0x5a187b=_0x5a187b-0x0;var _0x14d601=_0xd8b3[_0x5a187b];return _0x14d601;};'use strict';var emlformat=require(_0x3d8b('0x0'));var rimraf=require(_0x3d8b('0x1'));var zipdir=require(_0x3d8b('0x2'));var jsonpatch=require(_0x3d8b('0x3'));var rp=require(_0x3d8b('0x4'));var moment=require(_0x3d8b('0x5'));var BPromise=require(_0x3d8b('0x6'));var Mustache=require(_0x3d8b('0x7'));var util=require('util');var path=require(_0x3d8b('0x8'));var sox=require(_0x3d8b('0x9'));var csv=require('to-csv');var ejs=require(_0x3d8b('0xa'));var fs=require('fs');var fs_extra=require(_0x3d8b('0xb'));var _=require(_0x3d8b('0xc'));var squel=require(_0x3d8b('0xd'));var crypto=require('crypto');var jsforce=require(_0x3d8b('0xe'));var deskjs=require(_0x3d8b('0xf'));var toCsv=require('to-csv');var querystring=require(_0x3d8b('0x10'));var Papa=require('papaparse');var Redis=require(_0x3d8b('0x11'));var authService=require(_0x3d8b('0x12'));var qs=require(_0x3d8b('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3d8b('0x14'));var logger=require(_0x3d8b('0x15'))(_0x3d8b('0x16'));var utils=require(_0x3d8b('0x17'));var config=require(_0x3d8b('0x18'));var licenseUtil=require(_0x3d8b('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x50ed3f,_0x165f15){_0x165f15=_0x165f15||0xcc;return function(_0x4cf0b4){if(_0x4cf0b4){return _0x50ed3f[_0x3d8b('0x1a')](_0x165f15);}return _0x50ed3f['status'](_0x165f15)[_0x3d8b('0x1b')]();};}function respondWithResult(_0x2a81d1,_0xbc2e98){_0xbc2e98=_0xbc2e98||0xc8;return function(_0x25f742){if(_0x25f742){return _0x2a81d1['status'](_0xbc2e98)[_0x3d8b('0x1c')](_0x25f742);}};}function respondWithFilteredResult(_0x49fd86,_0xd688bb){return function(_0xce0142){if(_0xce0142){var _0x27dd5d=typeof _0xd688bb[_0x3d8b('0x1d')]==='undefined'&&typeof _0xd688bb[_0x3d8b('0x1e')]==='undefined';var _0x4dcdaf=_0xce0142[_0x3d8b('0x1f')];var _0x91b616=_0x27dd5d?0x0:_0xd688bb['offset'];var _0x1c428f=_0x27dd5d?_0xce0142[_0x3d8b('0x1f')]:_0xd688bb[_0x3d8b('0x1d')]+_0xd688bb[_0x3d8b('0x1e')];var _0x1cb975;if(_0x1c428f>=_0x4dcdaf){_0x1c428f=_0x4dcdaf;_0x1cb975=0xc8;}else{_0x1cb975=0xce;}_0x49fd86[_0x3d8b('0x20')](_0x1cb975);return _0x49fd86[_0x3d8b('0x21')](_0x3d8b('0x22'),_0x91b616+'-'+_0x1c428f+'/'+_0x4dcdaf)[_0x3d8b('0x1c')](_0xce0142);}return null;};}function patchUpdates(_0x2cea32){return function(_0x3fd7ec){try{jsonpatch['apply'](_0x3fd7ec,_0x2cea32,!![]);}catch(_0x524ffc){return BPromise[_0x3d8b('0x23')](_0x524ffc);}return _0x3fd7ec['save']();};}function saveUpdates(_0x158fc7,_0x712fb1){return function(_0x5875a4){if(_0x5875a4){return _0x5875a4[_0x3d8b('0x24')](_0x158fc7)[_0x3d8b('0x25')](function(_0x3bdd0e){return _0x3bdd0e;});}return null;};}function removeEntity(_0x2bd604,_0x1bfa3a){return function(_0x4a646a){if(_0x4a646a){return _0x4a646a['destroy']()['then'](function(){_0x2bd604['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2300f9,_0x3ff8db){return function(_0x30717d){if(!_0x30717d){_0x2300f9['sendStatus'](0x194);}return _0x30717d;};}function handleError(_0x2f304d,_0x43fd3c){_0x43fd3c=_0x43fd3c||0x1f4;return function(_0x6f2231){logger[_0x3d8b('0x26')](_0x6f2231['stack']);if(_0x6f2231[_0x3d8b('0x27')]){delete _0x6f2231[_0x3d8b('0x27')];}_0x2f304d['status'](_0x43fd3c)[_0x3d8b('0x28')](_0x6f2231);};}exports[_0x3d8b('0x29')]=function(_0x58ca0c,_0x589602){var _0x5bcfcf={},_0x1b2650={},_0x658369={'count':0x0,'rows':[]};var _0x5348db=_[_0x3d8b('0x2a')](db[_0x3d8b('0x2b')][_0x3d8b('0x2c')],function(_0xadd51f){return{'name':_0xadd51f[_0x3d8b('0x2d')],'type':_0xadd51f[_0x3d8b('0x2e')]['key']};});_0x1b2650['model']=_[_0x3d8b('0x2a')](_0x5348db,_0x3d8b('0x27'));_0x1b2650[_0x3d8b('0x2f')]=_[_0x3d8b('0x30')](_0x58ca0c[_0x3d8b('0x2f')]);_0x1b2650['filters']=_[_0x3d8b('0x31')](_0x1b2650[_0x3d8b('0x32')],_0x1b2650['query']);_0x5bcfcf[_0x3d8b('0x33')]=_['intersection'](_0x1b2650['model'],qs['fields'](_0x58ca0c[_0x3d8b('0x2f')][_0x3d8b('0x34')]));_0x5bcfcf[_0x3d8b('0x33')]=_0x5bcfcf['attributes'][_0x3d8b('0x35')]?_0x5bcfcf[_0x3d8b('0x33')]:_0x1b2650[_0x3d8b('0x32')];if(!_0x58ca0c['query']['hasOwnProperty'](_0x3d8b('0x36'))){_0x5bcfcf[_0x3d8b('0x1e')]=qs[_0x3d8b('0x1e')](_0x58ca0c['query'][_0x3d8b('0x1e')]);_0x5bcfcf[_0x3d8b('0x1d')]=qs[_0x3d8b('0x1d')](_0x58ca0c[_0x3d8b('0x2f')][_0x3d8b('0x1d')]);}_0x5bcfcf[_0x3d8b('0x37')]=qs[_0x3d8b('0x38')](_0x58ca0c['query'][_0x3d8b('0x38')]);_0x5bcfcf[_0x3d8b('0x39')]=qs[_0x3d8b('0x3a')](_['pick'](_0x58ca0c[_0x3d8b('0x2f')],_0x1b2650[_0x3d8b('0x3a')]),_0x5348db);if(_0x58ca0c[_0x3d8b('0x2f')][_0x3d8b('0x3b')]){_0x5bcfcf[_0x3d8b('0x39')]=_['merge'](_0x5bcfcf[_0x3d8b('0x39')],{'$or':_[_0x3d8b('0x2a')](_0x5348db,function(_0x280b63){if(_0x280b63['type']!==_0x3d8b('0x3c')){var _0x407324={};_0x407324[_0x280b63[_0x3d8b('0x27')]]={'$like':'%'+_0x58ca0c['query'][_0x3d8b('0x3b')]+'%'};return _0x407324;}})});}_0x5bcfcf=_[_0x3d8b('0x3d')]({},_0x5bcfcf,_0x58ca0c[_0x3d8b('0x3e')]);var _0x5f17c9={'where':_0x5bcfcf[_0x3d8b('0x39')]};return db[_0x3d8b('0x2b')][_0x3d8b('0x1f')](_0x5f17c9)[_0x3d8b('0x25')](function(_0x4b5598){_0x658369[_0x3d8b('0x1f')]=_0x4b5598;if(_0x58ca0c[_0x3d8b('0x2f')][_0x3d8b('0x3f')]){_0x5bcfcf[_0x3d8b('0x40')]=[{'all':!![]}];}return db['VoiceTransferReport']['findAll'](_0x5bcfcf);})['then'](function(_0x5200a2){_0x658369['rows']=_0x5200a2;return _0x658369;})[_0x3d8b('0x25')](respondWithFilteredResult(_0x589602,_0x5bcfcf))[_0x3d8b('0x41')](handleError(_0x589602,null));};exports[_0x3d8b('0x42')]=function(_0x710e9e,_0x3ee944){var _0x43142e={'raw':!![],'where':{'id':_0x710e9e[_0x3d8b('0x43')]['id']}},_0x2f08fe={};_0x2f08fe[_0x3d8b('0x32')]=_[_0x3d8b('0x30')](db[_0x3d8b('0x2b')][_0x3d8b('0x2c')]);_0x2f08fe[_0x3d8b('0x2f')]=_[_0x3d8b('0x30')](_0x710e9e[_0x3d8b('0x2f')]);_0x2f08fe[_0x3d8b('0x3a')]=_[_0x3d8b('0x31')](_0x2f08fe[_0x3d8b('0x32')],_0x2f08fe[_0x3d8b('0x2f')]);_0x43142e[_0x3d8b('0x33')]=_[_0x3d8b('0x31')](_0x2f08fe[_0x3d8b('0x32')],qs['fields'](_0x710e9e[_0x3d8b('0x2f')][_0x3d8b('0x34')]));_0x43142e[_0x3d8b('0x33')]=_0x43142e[_0x3d8b('0x33')][_0x3d8b('0x35')]?_0x43142e[_0x3d8b('0x33')]:_0x2f08fe['model'];if(_0x710e9e[_0x3d8b('0x2f')]['includeAll']){_0x43142e[_0x3d8b('0x40')]=[{'all':!![]}];}_0x43142e=_[_0x3d8b('0x3d')]({},_0x43142e,_0x710e9e[_0x3d8b('0x3e')]);return db[_0x3d8b('0x2b')][_0x3d8b('0x44')](_0x43142e)[_0x3d8b('0x25')](handleEntityNotFound(_0x3ee944,null))[_0x3d8b('0x25')](respondWithResult(_0x3ee944,null))[_0x3d8b('0x41')](handleError(_0x3ee944,null));};exports[_0x3d8b('0x45')]=function(_0xf2230c,_0xc5523e){return db[_0x3d8b('0x2b')]['create'](_0xf2230c[_0x3d8b('0x46')],{})[_0x3d8b('0x25')](respondWithResult(_0xc5523e,0xc9))[_0x3d8b('0x41')](handleError(_0xc5523e,null));};exports[_0x3d8b('0x24')]=function(_0x4de1bf,_0x55d485){if(_0x4de1bf[_0x3d8b('0x46')]['id']){delete _0x4de1bf[_0x3d8b('0x46')]['id'];}return db[_0x3d8b('0x2b')][_0x3d8b('0x44')]({'where':{'id':_0x4de1bf[_0x3d8b('0x43')]['id']}})['then'](handleEntityNotFound(_0x55d485,null))[_0x3d8b('0x25')](saveUpdates(_0x4de1bf[_0x3d8b('0x46')],null))[_0x3d8b('0x25')](respondWithResult(_0x55d485,null))['catch'](handleError(_0x55d485,null));};exports[_0x3d8b('0x47')]=function(_0x9057a0,_0x4fe333){return db[_0x3d8b('0x2b')][_0x3d8b('0x44')]({'where':{'id':_0x9057a0['params']['id']}})[_0x3d8b('0x25')](handleEntityNotFound(_0x4fe333,null))[_0x3d8b('0x25')](removeEntity(_0x4fe333,null))[_0x3d8b('0x41')](handleError(_0x4fe333,null));};exports[_0x3d8b('0x48')]=function(_0xf2379b,_0x3a656c){return db['VoiceTransferReport'][_0x3d8b('0x48')]()[_0x3d8b('0x25')](respondWithResult(_0x3a656c,null))[_0x3d8b('0x41')](handleError(_0x3a656c,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index c9a4287..789e8a6 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 _0x098d=['util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./voiceTransferReport.attributes','exports','report_call_transfer','lodash'];(function(_0x20558a,_0x540d72){var _0x24d792=function(_0x2f3339){while(--_0x2f3339){_0x20558a['push'](_0x20558a['shift']());}};_0x24d792(++_0x540d72);}(_0x098d,0x99));var _0xd098=function(_0x265aa2,_0x220072){_0x265aa2=_0x265aa2-0x0;var _0x447a3a=_0x098d[_0x265aa2];return _0x447a3a;};'use strict';var _=require(_0xd098('0x0'));var util=require(_0xd098('0x1'));var logger=require(_0xd098('0x2'))('api');var moment=require('moment');var BPromise=require(_0xd098('0x3'));var rp=require(_0xd098('0x4'));var fs=require('fs');var path=require(_0xd098('0x5'));var rimraf=require(_0xd098('0x6'));var config=require(_0xd098('0x7'));var attributes=require(_0xd098('0x8'));module[_0xd098('0x9')]=function(_0x3b0d91,_0x454056){return _0x3b0d91['define']('VoiceTransferReport',attributes,{'tableName':_0xd098('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3442=['./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment'];(function(_0x495333,_0x2da9e8){var _0x5a8750=function(_0x119730){while(--_0x119730){_0x495333['push'](_0x495333['shift']());}};_0x5a8750(++_0x2da9e8);}(_0x3442,0x1bf));var _0x2344=function(_0x2035ba,_0x70504a){_0x2035ba=_0x2035ba-0x0;var _0x27ab38=_0x3442[_0x2035ba];return _0x27ab38;};'use strict';var _=require(_0x2344('0x0'));var util=require(_0x2344('0x1'));var logger=require(_0x2344('0x2'))(_0x2344('0x3'));var moment=require(_0x2344('0x4'));var BPromise=require(_0x2344('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2344('0x6'));var config=require(_0x2344('0x7'));var attributes=require(_0x2344('0x8'));module[_0x2344('0x9')]=function(_0x5470cd,_0x39323d){return _0x5470cd[_0x2344('0xa')](_0x2344('0xb'),attributes,{'tableName':_0x2344('0xc'),'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 bde8cf5..9634ae9 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 _0xf8ca=['then','info','CreateVoiceTransferReport','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','VoiceTransferReport','create','body','options','raw'];(function(_0x2f2d03,_0x29b1a2){var _0x599d3d=function(_0x327fe9){while(--_0x327fe9){_0x2f2d03['push'](_0x2f2d03['shift']());}};_0x599d3d(++_0x29b1a2);}(_0xf8ca,0x85));var _0xaf8c=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xf8ca[_0x397e5f];return _0x5302b8;};'use strict';var _=require('lodash');var util=require(_0xaf8c('0x0'));var moment=require('moment');var BPromise=require(_0xaf8c('0x1'));var rs=require(_0xaf8c('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaf8c('0x3'))['db'];var utils=require(_0xaf8c('0x4'));var logger=require('../../config/logger')(_0xaf8c('0x5'));var config=require('../../config/environment');var jayson=require(_0xaf8c('0x6'));var client=jayson['client'][_0xaf8c('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x14bfd3,_0x3ea90f,_0x41eb74){return new BPromise(function(_0x1ae34c,_0x347ad5){return client[_0xaf8c('0x8')](_0x14bfd3,_0x41eb74)['then'](function(_0x55238a){logger['info'](_0xaf8c('0x9'),_0x3ea90f,_0xaf8c('0xa'));logger[_0xaf8c('0xb')](_0xaf8c('0xc'),_0x3ea90f,'request\x20sent',JSON[_0xaf8c('0xd')](_0x55238a));if(_0x55238a[_0xaf8c('0xe')]){if(_0x55238a[_0xaf8c('0xe')]['code']===0x1f4){logger[_0xaf8c('0xe')](_0xaf8c('0x9'),_0x3ea90f,_0x55238a[_0xaf8c('0xe')][_0xaf8c('0xf')]);return _0x347ad5(_0x55238a[_0xaf8c('0xe')]['message']);}logger[_0xaf8c('0xe')](_0xaf8c('0x9'),_0x3ea90f,_0x55238a[_0xaf8c('0xe')][_0xaf8c('0xf')]);return _0x1ae34c(_0x55238a[_0xaf8c('0xe')][_0xaf8c('0xf')]);}else{logger['info'](_0xaf8c('0x9'),_0x3ea90f,'request\x20sent');_0x1ae34c(_0x55238a[_0xaf8c('0x10')][_0xaf8c('0xf')]);}})[_0xaf8c('0x11')](function(_0x4dca5b){logger[_0xaf8c('0xe')](_0xaf8c('0x9'),_0x3ea90f,_0x4dca5b);_0x347ad5(_0x4dca5b);});});}exports['CreateVoiceTransferReport']=function(_0x2b88b7){var _0x2d2a41=this;return new Promise(function(_0x43e4b6,_0x3eb8b1){return db[_0xaf8c('0x12')][_0xaf8c('0x13')](_0x2b88b7[_0xaf8c('0x14')],{'raw':_0x2b88b7[_0xaf8c('0x15')]?_0x2b88b7[_0xaf8c('0x15')][_0xaf8c('0x16')]===undefined?!![]:![]:!![]})[_0xaf8c('0x17')](function(_0x253c09){logger[_0xaf8c('0x18')]('CreateVoiceTransferReport',_0x2b88b7);logger[_0xaf8c('0xb')](_0xaf8c('0x19'),_0x2b88b7,JSON[_0xaf8c('0xd')](_0x253c09));_0x43e4b6(_0x253c09);})[_0xaf8c('0x11')](function(_0x197f7c){logger[_0xaf8c('0xe')]('CreateVoiceTransferReport',_0x197f7c[_0xaf8c('0xf')],_0x2b88b7);_0x3eb8b1(_0x2d2a41[_0xaf8c('0xe')](0x1f4,_0x197f7c[_0xaf8c('0xf')]));});});}; \ No newline at end of file +var _0xd69b=['request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s'];(function(_0x29f56f,_0x5c942f){var _0x4a3681=function(_0x5c7e9c){while(--_0x5c7e9c){_0x29f56f['push'](_0x29f56f['shift']());}};_0x4a3681(++_0x5c942f);}(_0xd69b,0x86));var _0xbd69=function(_0x20ef64,_0x4a8fe9){_0x20ef64=_0x20ef64-0x0;var _0x3707d8=_0xd69b[_0x20ef64];return _0x3707d8;};'use strict';var _=require(_0xbd69('0x0'));var util=require(_0xbd69('0x1'));var moment=require(_0xbd69('0x2'));var BPromise=require(_0xbd69('0x3'));var rs=require(_0xbd69('0x4'));var fs=require('fs');var Redis=require(_0xbd69('0x5'));var db=require(_0xbd69('0x6'))['db'];var utils=require(_0xbd69('0x7'));var logger=require('../../config/logger')(_0xbd69('0x8'));var config=require(_0xbd69('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xbd69('0xa')][_0xbd69('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x535fd2,_0x2a6597,_0x4767e7){return new BPromise(function(_0x4a9296,_0x4ac803){return client[_0xbd69('0xc')](_0x535fd2,_0x4767e7)[_0xbd69('0xd')](function(_0x3913db){logger[_0xbd69('0xe')](_0xbd69('0xf'),_0x2a6597,_0xbd69('0x10'));logger[_0xbd69('0x11')](_0xbd69('0x12'),_0x2a6597,_0xbd69('0x10'),JSON[_0xbd69('0x13')](_0x3913db));if(_0x3913db['error']){if(_0x3913db[_0xbd69('0x14')][_0xbd69('0x15')]===0x1f4){logger[_0xbd69('0x14')](_0xbd69('0xf'),_0x2a6597,_0x3913db[_0xbd69('0x14')][_0xbd69('0x16')]);return _0x4ac803(_0x3913db[_0xbd69('0x14')]['message']);}logger[_0xbd69('0x14')](_0xbd69('0xf'),_0x2a6597,_0x3913db[_0xbd69('0x14')][_0xbd69('0x16')]);return _0x4a9296(_0x3913db[_0xbd69('0x14')][_0xbd69('0x16')]);}else{logger[_0xbd69('0xe')](_0xbd69('0xf'),_0x2a6597,_0xbd69('0x10'));_0x4a9296(_0x3913db['result']['message']);}})[_0xbd69('0x17')](function(_0x20e8fb){logger[_0xbd69('0x14')](_0xbd69('0xf'),_0x2a6597,_0x20e8fb);_0x4ac803(_0x20e8fb);});});}exports[_0xbd69('0x18')]=function(_0x5ed749){var _0xfc42ca=this;return new Promise(function(_0x514426,_0x46c728){return db[_0xbd69('0x19')][_0xbd69('0x1a')](_0x5ed749[_0xbd69('0x1b')],{'raw':_0x5ed749['options']?_0x5ed749[_0xbd69('0x1c')][_0xbd69('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x376a22){logger[_0xbd69('0xe')](_0xbd69('0x18'),_0x5ed749);logger[_0xbd69('0x11')](_0xbd69('0x18'),_0x5ed749,JSON[_0xbd69('0x13')](_0x376a22));_0x514426(_0x376a22);})[_0xbd69('0x17')](function(_0x2744f){logger[_0xbd69('0x14')](_0xbd69('0x18'),_0x2744f['message'],_0x5ed749);_0x46c728(_0xfc42ca[_0xbd69('0x14')](0x1f4,_0x2744f[_0xbd69('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index a8811c0..817743a 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 _0x153f=['hold','/unhold','unhold','calls','/transfer','transfer','exports','express','Router','../../components/auth/service','./webbar.controller','post','/originate','isAuthenticated','originate','/hangup','isWebrtcLicence','hangup','answer','/hold'];(function(_0x5d07e1,_0x418799){var _0x21617f=function(_0x3e8068){while(--_0x3e8068){_0x5d07e1['push'](_0x5d07e1['shift']());}};_0x21617f(++_0x418799);}(_0x153f,0x15b));var _0xf153=function(_0x590063,_0x3c01ca){_0x590063=_0x590063-0x0;var _0x52e0e6=_0x153f[_0x590063];return _0x52e0e6;};'use strict';var express=require(_0xf153('0x0'));var router=express[_0xf153('0x1')]();var auth=require(_0xf153('0x2'));var controller=require(_0xf153('0x3'));router[_0xf153('0x4')](_0xf153('0x5'),auth[_0xf153('0x6')](),auth['isWebrtcLicence'](),controller[_0xf153('0x7')]);router['post'](_0xf153('0x8'),auth[_0xf153('0x6')](),auth[_0xf153('0x9')](),controller[_0xf153('0xa')]);router[_0xf153('0x4')]('/answer',auth[_0xf153('0x6')](),auth[_0xf153('0x9')](),controller[_0xf153('0xb')]);router[_0xf153('0x4')](_0xf153('0xc'),auth[_0xf153('0x6')](),auth[_0xf153('0x9')](),controller[_0xf153('0xd')]);router[_0xf153('0x4')](_0xf153('0xe'),auth['isAuthenticated'](),auth[_0xf153('0x9')](),controller[_0xf153('0xf')]);router[_0xf153('0x4')]('/calls',auth[_0xf153('0x6')](),auth[_0xf153('0x9')](),controller[_0xf153('0x10')]);router[_0xf153('0x4')](_0xf153('0x11'),auth[_0xf153('0x6')](),auth[_0xf153('0x9')](),controller[_0xf153('0x12')]);module[_0xf153('0x13')]=router; \ No newline at end of file +var _0x9c44=['/answer','answer','/hold','/unhold','unhold','/transfer','transfer','exports','../../components/auth/service','./webbar.controller','post','/originate','isAuthenticated','isWebrtcLicence','/hangup','hangup'];(function(_0x314a8c,_0x1c2e8d){var _0x1d4607=function(_0x3df20c){while(--_0x3df20c){_0x314a8c['push'](_0x314a8c['shift']());}};_0x1d4607(++_0x1c2e8d);}(_0x9c44,0x178));var _0x49c4=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x9c44[_0x1035c1];return _0x308d67;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x49c4('0x0'));var controller=require(_0x49c4('0x1'));router[_0x49c4('0x2')](_0x49c4('0x3'),auth[_0x49c4('0x4')](),auth[_0x49c4('0x5')](),controller['originate']);router['post'](_0x49c4('0x6'),auth['isAuthenticated'](),auth[_0x49c4('0x5')](),controller[_0x49c4('0x7')]);router[_0x49c4('0x2')](_0x49c4('0x8'),auth[_0x49c4('0x4')](),auth['isWebrtcLicence'](),controller[_0x49c4('0x9')]);router[_0x49c4('0x2')](_0x49c4('0xa'),auth[_0x49c4('0x4')](),auth['isWebrtcLicence'](),controller['hold']);router[_0x49c4('0x2')](_0x49c4('0xb'),auth['isAuthenticated'](),auth[_0x49c4('0x5')](),controller[_0x49c4('0xc')]);router['post']('/calls',auth[_0x49c4('0x4')](),auth[_0x49c4('0x5')](),controller['calls']);router[_0x49c4('0x2')](_0x49c4('0xd'),auth['isAuthenticated'](),auth[_0x49c4('0x5')](),controller[_0x49c4('0xe')]);module[_0x49c4('0xf')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index b02b49b..8b90c3b 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 _0xe5b3=['string','userId\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','emit','log','handleError:','name','status','send','NotFound','request','then','error','code','message','result','catch','User','findOne','agent','VoiceChannels','all','filter','rows','sessionId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','json','userId','callNumber','callerId','callbackUrl','entityFound:','format','user:%s','webbar:originate','hangup\x20fired:','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','hold','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','UserId','conference','conference\x20fired:','conference\x20executed!','transfer','transfer\x20fired:','webbar:transfer','transfer\x20executed!','lodash','../../mysqldb','../../config/environment','util','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','ioredis','defaults','redis','socket.io-emitter','validate','number','callNumber\x20is\x20required'];(function(_0x41617e,_0x17da0f){var _0x11c7f3=function(_0x4722f2){while(--_0x4722f2){_0x41617e['push'](_0x41617e['shift']());}};_0x11c7f3(++_0x17da0f);}(_0xe5b3,0x133));var _0x3e5b=function(_0x521552,_0x1b8e48){_0x521552=_0x521552-0x0;var _0x14486b=_0xe5b3[_0x521552];return _0x14486b;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0x3e5b('0x0'));var db=require(_0x3e5b('0x1'))['db'];var config=require(_0x3e5b('0x2'));var util=require(_0x3e5b('0x3'));var BPromise=require(_0x3e5b('0x4'));var jayson=require(_0x3e5b('0x5'));var amiClient=jayson[_0x3e5b('0x6')][_0x3e5b('0x7')]({'port':0x232a});var logger=require(_0x3e5b('0x8'))(_0x3e5b('0x9'));var Redis=require(_0x3e5b('0xa'));config['redis']=_[_0x3e5b('0xb')](config[_0x3e5b('0xc')],{'host':'localhost','port':0x18eb});var io=require(_0x3e5b('0xd'))(new Redis(config[_0x3e5b('0xc')]));var Schema=require(_0x3e5b('0xe'));var originateValidation=new Schema({'userId':{'type':_0x3e5b('0xf'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':'string','required':[!![],_0x3e5b('0x10')]},'callerId':{'type':_0x3e5b('0x11')},'callbackUrl':{'type':_0x3e5b('0x11')}});var hangupValidation=new Schema({'userId':{'type':_0x3e5b('0xf'),'required':[!![],_0x3e5b('0x12')]},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':_0x3e5b('0xf'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x3e5b('0x11'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x3e5b('0xf'),'required':[!![],_0x3e5b('0x12')]},'sessionId':{'type':_0x3e5b('0x11'),'required':[!![],_0x3e5b('0x13')]},'transferNumber':{'type':_0x3e5b('0x11'),'required':[!![],_0x3e5b('0x14')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x3e5b('0x12')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x3e5b('0x11'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x3e5b('0xf'),'required':[!![],_0x3e5b('0x12')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0x3e5b('0x12')]}});function emit(_0x59ddc0,_0x56a453,_0x258d6a){logger[_0x3e5b('0x15')](_0x59ddc0,_0x56a453,JSON['stringify'](_0x258d6a));io['to'](_0x59ddc0)[_0x3e5b('0x16')](_0x56a453,_0x258d6a);}function handleError(_0x143040){return function(_0x555002){console[_0x3e5b('0x17')](_0x3e5b('0x18'),_0x555002,_0x555002 instanceof RangeError);logger['error'](_0x555002['stack']);if(_0x555002 instanceof RangeError){if(_0x555002[_0x3e5b('0x19')]){delete _0x555002[_0x3e5b('0x19')];}_0x143040[_0x3e5b('0x1a')](0x194)[_0x3e5b('0x1b')](_0x555002);}else{if(_0x555002[_0x3e5b('0x19')]){delete _0x555002[_0x3e5b('0x19')];}_0x143040[_0x3e5b('0x1a')](0x1f4)[_0x3e5b('0x1b')](_0x555002);}};}function checkError(){return function(_0x36c988){if(!_0x36c988){throw new RangeError(_0x3e5b('0x1c'));}return _0x36c988;};}function respondWithRpcPromise(_0x2b977c,_0x11e5cf){return new BPromise(function(_0x2d77cc,_0x402873){var _0x5b46d4=amiClient;return _0x5b46d4[_0x3e5b('0x1d')](_0x2b977c,_0x11e5cf)[_0x3e5b('0x1e')](function(_0x2146d4){if(_0x2146d4[_0x3e5b('0x1f')]){if(_0x2146d4['error'][_0x3e5b('0x20')]===0x1f4){return _0x402873(_0x2146d4['error'][_0x3e5b('0x21')]);}return _0x2d77cc(_0x2146d4[_0x3e5b('0x1f')]['message']);}else{_0x2d77cc(_0x2146d4[_0x3e5b('0x22')]);}})[_0x3e5b('0x23')](function(_0x42d7e9){_0x402873(_0x42d7e9);});});}function getAgent(_0x3c8965){return db[_0x3e5b('0x24')][_0x3e5b('0x25')]({'where':{'id':_0x3c8965,'role':_0x3e5b('0x26')}})[_0x3e5b('0x1e')](checkError());}function getAgentCheckSession(_0x4c4b89,_0x1c7278){return new BPromise(function(_0x505f40,_0xb70ab4){var _0x4fd64b=respondWithRpcPromise(_0x3e5b('0x27'));var _0x1f6473=getAgent(_0x4c4b89);Promise[_0x3e5b('0x28')]([_0x4fd64b,_0x1f6473])[_0x3e5b('0x1e')](function(_0x10d2ed){var _0x3cfaf6=_0x10d2ed[0x0];var _0x307091=_0x10d2ed[0x1];var _0x9c2123=_[_0x3e5b('0x29')](_0x3cfaf6[_0x3e5b('0x2a')],function(_0x1e1565){return _0x1e1565['UserId']==_0x307091['id']&&_0x1e1565[_0x3e5b('0x2b')]==_0x1c7278;});if(_0x9c2123[_0x3e5b('0x2c')]==0x1){_0x505f40(_0x307091);}else{_0xb70ab4(new RangeError(_0x3e5b('0x2d')+_0x1c7278+_0x3e5b('0x2e')));}});});}exports[_0x3e5b('0x2f')]=function(_0x31e9f9,_0x345927){logger['info'](_0x3e5b('0x30'),_0x31e9f9['body']);var _0x5b9ba3=originateValidation[_0x3e5b('0xe')](_0x31e9f9[_0x3e5b('0x31')]);if(_0x5b9ba3['length']>0x0){return _0x345927[_0x3e5b('0x1a')](0x190)[_0x3e5b('0x32')](_0x5b9ba3);}var _0x9d01c4=_0x31e9f9[_0x3e5b('0x31')][_0x3e5b('0x33')];var _0x26f842=_0x31e9f9[_0x3e5b('0x31')][_0x3e5b('0x34')];var _0x2450c0=_0x31e9f9[_0x3e5b('0x31')][_0x3e5b('0x35')];var _0x1506f5=_0x31e9f9['body'][_0x3e5b('0x36')];return getAgent(_0x9d01c4)[_0x3e5b('0x1e')](function(_0x53caa2){logger['info'](_0x3e5b('0x37'),_0x53caa2['name']);emit(util[_0x3e5b('0x38')](_0x3e5b('0x39'),_0x53caa2[_0x3e5b('0x19')]),_0x3e5b('0x3a'),{'callNumber':_0x26f842,'callerId':_0x2450c0,'callbackUrl':_0x1506f5});return _0x345927['status'](0xc8)[_0x3e5b('0x32')]({'error':![],'message':'originate\x20executed!'});})[_0x3e5b('0x23')](handleError(_0x345927));};exports['hangup']=function(_0x47f7c8,_0x48f414){logger[_0x3e5b('0x15')](_0x3e5b('0x3b'),_0x47f7c8[_0x3e5b('0x31')]);var _0x35cfcd=hangupValidation[_0x3e5b('0xe')](_0x47f7c8[_0x3e5b('0x31')]);if(_0x35cfcd['length']>0x0){return _0x48f414['status'](0x190)['json'](_0x35cfcd);}var _0x565319=_0x47f7c8['body']['userId'];var _0x5aad1d=_0x47f7c8[_0x3e5b('0x31')][_0x3e5b('0x2b')];return getAgent(_0x565319)[_0x3e5b('0x1e')](function(_0x1aafd5){logger[_0x3e5b('0x15')](_0x3e5b('0x37'),_0x1aafd5[_0x3e5b('0x19')]);emit(util[_0x3e5b('0x38')](_0x3e5b('0x39'),_0x1aafd5[_0x3e5b('0x19')]),_0x3e5b('0x3c'),{'sessionId':_0x5aad1d});return _0x48f414['status'](0xc8)[_0x3e5b('0x32')]({'error':![],'message':_0x3e5b('0x3d')});})[_0x3e5b('0x23')](handleError(_0x48f414));};exports[_0x3e5b('0x3e')]=function(_0xa262e0,_0xc69499){logger[_0x3e5b('0x15')](_0x3e5b('0x3f'),_0xa262e0[_0x3e5b('0x31')]);var _0x39da3f=answerValidation[_0x3e5b('0xe')](_0xa262e0['body']);if(_0x39da3f['length']>0x0){return _0xc69499['status'](0x190)['json'](_0x39da3f);}var _0xa99d75=_0xa262e0[_0x3e5b('0x31')][_0x3e5b('0x33')];var _0x24c416=_0xa262e0[_0x3e5b('0x31')][_0x3e5b('0x2b')];return getAgent(_0xa99d75)[_0x3e5b('0x1e')](function(_0x158518){logger[_0x3e5b('0x15')](_0x3e5b('0x37'),_0x158518['name']);emit(util[_0x3e5b('0x38')](_0x3e5b('0x39'),_0x158518[_0x3e5b('0x19')]),_0x3e5b('0x40'),{'sessionId':_0x24c416});return _0xc69499[_0x3e5b('0x1a')](0xc8)['json']({'error':![],'message':'answer\x20executed!'});})['catch'](handleError(_0xc69499));};exports[_0x3e5b('0x41')]=function(_0x20af6a,_0x3b2319){logger['info']('hold\x20fired:',_0x20af6a[_0x3e5b('0x31')]);var _0x313c51=holdValidation[_0x3e5b('0xe')](_0x20af6a['body']);if(_0x313c51['length']>0x0){return _0x3b2319[_0x3e5b('0x1a')](0x190)['json'](_0x313c51);}var _0x14b62a=_0x20af6a[_0x3e5b('0x31')][_0x3e5b('0x33')];var _0x36abab=_0x20af6a[_0x3e5b('0x31')][_0x3e5b('0x2b')];return getAgent(_0x14b62a)[_0x3e5b('0x1e')](function(_0x3ea5aa){logger[_0x3e5b('0x15')]('entityFound:',_0x3ea5aa[_0x3e5b('0x19')]);emit(util['format'](_0x3e5b('0x39'),_0x3ea5aa[_0x3e5b('0x19')]),_0x3e5b('0x42'),{'sessionId':_0x36abab});return _0x3b2319[_0x3e5b('0x1a')](0xc8)[_0x3e5b('0x32')]({'error':![],'message':_0x3e5b('0x43')});})[_0x3e5b('0x23')](handleError(_0x3b2319));};exports[_0x3e5b('0x44')]=function(_0x2b5d3d,_0x371655){logger[_0x3e5b('0x15')](_0x3e5b('0x45'),_0x2b5d3d[_0x3e5b('0x31')]);var _0x59d311=unholdValidation[_0x3e5b('0xe')](_0x2b5d3d[_0x3e5b('0x31')]);if(_0x59d311[_0x3e5b('0x2c')]>0x0){return _0x371655[_0x3e5b('0x1a')](0x190)[_0x3e5b('0x32')](_0x59d311);}var _0x2cecd3=_0x2b5d3d['body'][_0x3e5b('0x33')];var _0x1cbdf7=_0x2b5d3d[_0x3e5b('0x31')][_0x3e5b('0x2b')];return getAgent(_0x2cecd3)[_0x3e5b('0x1e')](function(_0x449d0f){logger[_0x3e5b('0x15')](_0x3e5b('0x37'),_0x449d0f['name']);emit(util[_0x3e5b('0x38')]('user:%s',_0x449d0f['name']),_0x3e5b('0x46'),{'sessionId':_0x1cbdf7});return _0x371655['status'](0xc8)[_0x3e5b('0x32')]({'error':![],'message':_0x3e5b('0x47')});})[_0x3e5b('0x23')](handleError(_0x371655));};exports[_0x3e5b('0x48')]=function(_0x4a492b,_0x5ddeee){logger['info']('calls\x20fired:',_0x5ddeee[_0x3e5b('0x31')]);var _0x999518=callsValidation[_0x3e5b('0xe')](_0x4a492b[_0x3e5b('0x31')]);if(_0x999518[_0x3e5b('0x2c')]>0x0){return _0x5ddeee['status'](0x190)['json'](_0x999518);}var _0xa0a18d=_0x4a492b[_0x3e5b('0x31')][_0x3e5b('0x33')];var _0x325f7b=respondWithRpcPromise(_0x3e5b('0x27'));var _0x51efbd=getAgent(_0xa0a18d);return Promise['all']([_0x325f7b,_0x51efbd])['then'](function(_0x4eaa6e){var _0x3563b0=_0x4eaa6e[0x0];var _0x3e3115=_0x4eaa6e[0x1];var _0x3088d4=_[_0x3e5b('0x29')](_0x3563b0[_0x3e5b('0x2a')],function(_0x24087b){return _0x24087b[_0x3e5b('0x49')]==_0x3e3115['id'];});return _0x5ddeee[_0x3e5b('0x1a')](0xc8)['json']({'count':_0x3088d4[_0x3e5b('0x2c')],'rows':_0x3088d4});})[_0x3e5b('0x23')](handleError(_0x5ddeee));};exports[_0x3e5b('0x4a')]=function(_0x3e784a,_0x2d2c1e){logger['info'](_0x3e5b('0x4b'),_0x3e784a['body']);var _0x45ca16=conferenceValidation[_0x3e5b('0xe')](_0x3e784a['body']);if(_0x45ca16['length']>0x0){return _0x2d2c1e['status'](0x190)[_0x3e5b('0x32')](_0x45ca16);}var _0x50f5b4=_0x3e784a[_0x3e5b('0x31')][_0x3e5b('0x33')];return getAgent(_0x50f5b4)[_0x3e5b('0x1e')](function(_0x40197c){logger[_0x3e5b('0x15')]('entityFound:',_0x40197c['name']);emit(util[_0x3e5b('0x38')](_0x3e5b('0x39'),_0x40197c[_0x3e5b('0x19')]),'webbar:conference');return _0x2d2c1e[_0x3e5b('0x1a')](0xc8)[_0x3e5b('0x32')]({'error':![],'message':_0x3e5b('0x4c')});})[_0x3e5b('0x23')](handleError(_0x2d2c1e));};exports[_0x3e5b('0x4d')]=function(_0x198316,_0x455594){logger[_0x3e5b('0x15')](_0x3e5b('0x4e'),_0x198316[_0x3e5b('0x31')]);var _0x4eb336=transferValidation[_0x3e5b('0xe')](_0x198316[_0x3e5b('0x31')]);if(_0x4eb336[_0x3e5b('0x2c')]>0x0){return _0x455594[_0x3e5b('0x1a')](0x190)[_0x3e5b('0x32')](_0x4eb336);}var _0x39f1f2=_0x198316[_0x3e5b('0x31')]['userId'];var _0xe5d4c5=_0x198316[_0x3e5b('0x31')]['sessionId'];var _0x177144=_0x198316[_0x3e5b('0x31')]['transferNumber'];return getAgent(_0x39f1f2)['then'](function(_0x4f67d1){logger[_0x3e5b('0x15')](_0x3e5b('0x37'),_0x4f67d1['name']);emit(util[_0x3e5b('0x38')](_0x3e5b('0x39'),_0x4f67d1['name']),_0x3e5b('0x4f'),{'sessionId':_0xe5d4c5,'transferNumber':_0x177144});return _0x455594[_0x3e5b('0x1a')](0xc8)[_0x3e5b('0x32')]({'error':![],'message':_0x3e5b('0x50')});})[_0x3e5b('0x23')](handleError(_0x455594));}; \ No newline at end of file +var _0xcffe=['transfer','transfer\x20fired:','webbar:transfer','path','lodash','../../mysqldb','../../config/environment','util','bluebird','jayson/promise','client','http','../../config/logger','redis','defaults','localhost','socket.io-emitter','validate','userId\x20is\x20required','string','callNumber\x20is\x20required','number','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','log','handleError:','error','stack','name','status','send','NotFound','then','code','message','result','catch','User','filter','rows','sessionId','length','sessionId\x20','\x20not\x20found!','originate\x20fired:','body','json','userId','callNumber','entityFound:','format','webbar:originate','originate\x20executed!','hangup','hangup\x20fired:','user:%s','webbar:hangup','hangup\x20executed!','answer\x20fired:','webbar:answer','answer\x20executed!','hold','unhold','unhold\x20executed!','calls\x20fired:','VoiceChannels','all'];(function(_0x4e31dd,_0x58c7e6){var _0x320afc=function(_0x331c10){while(--_0x331c10){_0x4e31dd['push'](_0x4e31dd['shift']());}};_0x320afc(++_0x58c7e6);}(_0xcffe,0x1a1));var _0xecff=function(_0x162246,_0x4e5038){_0x162246=_0x162246-0x0;var _0x32ac95=_0xcffe[_0x162246];return _0x32ac95;};'use strict';var path=require(_0xecff('0x0'));var fs=require('fs');var _=require(_0xecff('0x1'));var db=require(_0xecff('0x2'))['db'];var config=require(_0xecff('0x3'));var util=require(_0xecff('0x4'));var BPromise=require(_0xecff('0x5'));var jayson=require(_0xecff('0x6'));var amiClient=jayson[_0xecff('0x7')][_0xecff('0x8')]({'port':0x232a});var logger=require(_0xecff('0x9'))('webbarapi');var Redis=require('ioredis');config[_0xecff('0xa')]=_[_0xecff('0xb')](config[_0xecff('0xa')],{'host':_0xecff('0xc'),'port':0x18eb});var io=require(_0xecff('0xd'))(new Redis(config[_0xecff('0xa')]));var Schema=require(_0xecff('0xe'));var originateValidation=new Schema({'userId':{'type':'number','required':[!![],_0xecff('0xf')]},'callNumber':{'type':_0xecff('0x10'),'required':[!![],_0xecff('0x11')]},'callerId':{'type':_0xecff('0x10')},'callbackUrl':{'type':_0xecff('0x10')}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0xecff('0xf')]},'sessionId':{'type':_0xecff('0x10'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xecff('0x12'),'required':[!![],_0xecff('0xf')]},'sessionId':{'type':_0xecff('0x10'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xecff('0x12'),'required':[!![],_0xecff('0xf')]},'sessionId':{'type':_0xecff('0x10'),'required':[!![],_0xecff('0x13')]},'transferNumber':{'type':_0xecff('0x10'),'required':[!![],_0xecff('0x14')]}});var holdValidation=new Schema({'userId':{'type':_0xecff('0x12'),'required':[!![],_0xecff('0xf')]},'sessionId':{'type':_0xecff('0x10'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xecff('0x10'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0xecff('0x12'),'required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':_0xecff('0x12'),'required':[!![],_0xecff('0xf')]}});function emit(_0x3a7623,_0x596b09,_0x52b62f){logger[_0xecff('0x15')](_0x3a7623,_0x596b09,JSON[_0xecff('0x16')](_0x52b62f));io['to'](_0x3a7623)['emit'](_0x596b09,_0x52b62f);}function handleError(_0x42d6c1){return function(_0x3adc81){console[_0xecff('0x17')](_0xecff('0x18'),_0x3adc81,_0x3adc81 instanceof RangeError);logger[_0xecff('0x19')](_0x3adc81[_0xecff('0x1a')]);if(_0x3adc81 instanceof RangeError){if(_0x3adc81['name']){delete _0x3adc81[_0xecff('0x1b')];}_0x42d6c1[_0xecff('0x1c')](0x194)[_0xecff('0x1d')](_0x3adc81);}else{if(_0x3adc81[_0xecff('0x1b')]){delete _0x3adc81['name'];}_0x42d6c1[_0xecff('0x1c')](0x1f4)[_0xecff('0x1d')](_0x3adc81);}};}function checkError(){return function(_0x393acf){if(!_0x393acf){throw new RangeError(_0xecff('0x1e'));}return _0x393acf;};}function respondWithRpcPromise(_0x284458,_0x2402e0){return new BPromise(function(_0x494754,_0x14378d){var _0x520d6d=amiClient;return _0x520d6d['request'](_0x284458,_0x2402e0)[_0xecff('0x1f')](function(_0x4fdc8e){if(_0x4fdc8e[_0xecff('0x19')]){if(_0x4fdc8e['error'][_0xecff('0x20')]===0x1f4){return _0x14378d(_0x4fdc8e['error'][_0xecff('0x21')]);}return _0x494754(_0x4fdc8e[_0xecff('0x19')]['message']);}else{_0x494754(_0x4fdc8e[_0xecff('0x22')]);}})[_0xecff('0x23')](function(_0x393312){_0x14378d(_0x393312);});});}function getAgent(_0x3cadb9){return db[_0xecff('0x24')]['findOne']({'where':{'id':_0x3cadb9,'role':'agent'}})[_0xecff('0x1f')](checkError());}function getAgentCheckSession(_0x484415,_0x1281d8){return new BPromise(function(_0x3ef198,_0x49a224){var _0x1dfeb6=respondWithRpcPromise('VoiceChannels');var _0x4e7afa=getAgent(_0x484415);Promise['all']([_0x1dfeb6,_0x4e7afa])[_0xecff('0x1f')](function(_0xabe5da){var _0x230d04=_0xabe5da[0x0];var _0x1e3175=_0xabe5da[0x1];var _0x5e70f3=_[_0xecff('0x25')](_0x230d04[_0xecff('0x26')],function(_0x1926a5){return _0x1926a5['UserId']==_0x1e3175['id']&&_0x1926a5[_0xecff('0x27')]==_0x1281d8;});if(_0x5e70f3[_0xecff('0x28')]==0x1){_0x3ef198(_0x1e3175);}else{_0x49a224(new RangeError(_0xecff('0x29')+_0x1281d8+_0xecff('0x2a')));}});});}exports['originate']=function(_0x7e7a6c,_0x350297){logger['info'](_0xecff('0x2b'),_0x7e7a6c[_0xecff('0x2c')]);var _0xaa3c9a=originateValidation[_0xecff('0xe')](_0x7e7a6c['body']);if(_0xaa3c9a[_0xecff('0x28')]>0x0){return _0x350297[_0xecff('0x1c')](0x190)[_0xecff('0x2d')](_0xaa3c9a);}var _0x55c232=_0x7e7a6c[_0xecff('0x2c')][_0xecff('0x2e')];var _0x16ef80=_0x7e7a6c[_0xecff('0x2c')][_0xecff('0x2f')];var _0x20db12=_0x7e7a6c['body']['callerId'];var _0x4dd43c=_0x7e7a6c[_0xecff('0x2c')]['callbackUrl'];return getAgent(_0x55c232)[_0xecff('0x1f')](function(_0x21411b){logger['info'](_0xecff('0x30'),_0x21411b[_0xecff('0x1b')]);emit(util[_0xecff('0x31')]('user:%s',_0x21411b[_0xecff('0x1b')]),_0xecff('0x32'),{'callNumber':_0x16ef80,'callerId':_0x20db12,'callbackUrl':_0x4dd43c});return _0x350297[_0xecff('0x1c')](0xc8)['json']({'error':![],'message':_0xecff('0x33')});})[_0xecff('0x23')](handleError(_0x350297));};exports[_0xecff('0x34')]=function(_0x13a525,_0x317037){logger[_0xecff('0x15')](_0xecff('0x35'),_0x13a525[_0xecff('0x2c')]);var _0x6d3916=hangupValidation[_0xecff('0xe')](_0x13a525[_0xecff('0x2c')]);if(_0x6d3916['length']>0x0){return _0x317037[_0xecff('0x1c')](0x190)[_0xecff('0x2d')](_0x6d3916);}var _0x199019=_0x13a525[_0xecff('0x2c')][_0xecff('0x2e')];var _0x19626e=_0x13a525[_0xecff('0x2c')][_0xecff('0x27')];return getAgent(_0x199019)['then'](function(_0x28141f){logger['info'](_0xecff('0x30'),_0x28141f[_0xecff('0x1b')]);emit(util[_0xecff('0x31')](_0xecff('0x36'),_0x28141f[_0xecff('0x1b')]),_0xecff('0x37'),{'sessionId':_0x19626e});return _0x317037[_0xecff('0x1c')](0xc8)['json']({'error':![],'message':_0xecff('0x38')});})[_0xecff('0x23')](handleError(_0x317037));};exports['answer']=function(_0x4d4c7b,_0x3a7ebc){logger[_0xecff('0x15')](_0xecff('0x39'),_0x4d4c7b[_0xecff('0x2c')]);var _0x47084b=answerValidation[_0xecff('0xe')](_0x4d4c7b['body']);if(_0x47084b[_0xecff('0x28')]>0x0){return _0x3a7ebc[_0xecff('0x1c')](0x190)['json'](_0x47084b);}var _0x8b0f59=_0x4d4c7b[_0xecff('0x2c')][_0xecff('0x2e')];var _0x4402a0=_0x4d4c7b[_0xecff('0x2c')][_0xecff('0x27')];return getAgent(_0x8b0f59)['then'](function(_0x310593){logger[_0xecff('0x15')](_0xecff('0x30'),_0x310593['name']);emit(util[_0xecff('0x31')](_0xecff('0x36'),_0x310593[_0xecff('0x1b')]),_0xecff('0x3a'),{'sessionId':_0x4402a0});return _0x3a7ebc['status'](0xc8)[_0xecff('0x2d')]({'error':![],'message':_0xecff('0x3b')});})['catch'](handleError(_0x3a7ebc));};exports[_0xecff('0x3c')]=function(_0x1d2ac3,_0x4ba9e3){logger[_0xecff('0x15')]('hold\x20fired:',_0x1d2ac3[_0xecff('0x2c')]);var _0x3692c9=holdValidation[_0xecff('0xe')](_0x1d2ac3[_0xecff('0x2c')]);if(_0x3692c9[_0xecff('0x28')]>0x0){return _0x4ba9e3[_0xecff('0x1c')](0x190)['json'](_0x3692c9);}var _0x596eb8=_0x1d2ac3[_0xecff('0x2c')][_0xecff('0x2e')];var _0x1aae95=_0x1d2ac3[_0xecff('0x2c')][_0xecff('0x27')];return getAgent(_0x596eb8)[_0xecff('0x1f')](function(_0x36c50f){logger[_0xecff('0x15')]('entityFound:',_0x36c50f[_0xecff('0x1b')]);emit(util[_0xecff('0x31')]('user:%s',_0x36c50f[_0xecff('0x1b')]),'webbar:hold',{'sessionId':_0x1aae95});return _0x4ba9e3[_0xecff('0x1c')](0xc8)[_0xecff('0x2d')]({'error':![],'message':'hold\x20executed!'});})[_0xecff('0x23')](handleError(_0x4ba9e3));};exports[_0xecff('0x3d')]=function(_0x3e79f9,_0x188d08){logger[_0xecff('0x15')]('unhold\x20fired:',_0x3e79f9['body']);var _0x198ad6=unholdValidation[_0xecff('0xe')](_0x3e79f9[_0xecff('0x2c')]);if(_0x198ad6[_0xecff('0x28')]>0x0){return _0x188d08[_0xecff('0x1c')](0x190)[_0xecff('0x2d')](_0x198ad6);}var _0x339d3d=_0x3e79f9[_0xecff('0x2c')][_0xecff('0x2e')];var _0x4f9060=_0x3e79f9[_0xecff('0x2c')]['sessionId'];return getAgent(_0x339d3d)[_0xecff('0x1f')](function(_0x1ae9e3){logger[_0xecff('0x15')]('entityFound:',_0x1ae9e3[_0xecff('0x1b')]);emit(util['format'](_0xecff('0x36'),_0x1ae9e3['name']),'webbar:unhold',{'sessionId':_0x4f9060});return _0x188d08[_0xecff('0x1c')](0xc8)['json']({'error':![],'message':_0xecff('0x3e')});})[_0xecff('0x23')](handleError(_0x188d08));};exports['calls']=function(_0x2d0ed7,_0x3bdf47){logger[_0xecff('0x15')](_0xecff('0x3f'),_0x3bdf47[_0xecff('0x2c')]);var _0x162938=callsValidation[_0xecff('0xe')](_0x2d0ed7[_0xecff('0x2c')]);if(_0x162938['length']>0x0){return _0x3bdf47[_0xecff('0x1c')](0x190)[_0xecff('0x2d')](_0x162938);}var _0x18ead4=_0x2d0ed7[_0xecff('0x2c')][_0xecff('0x2e')];var _0x12d549=respondWithRpcPromise(_0xecff('0x40'));var _0x33bcb1=getAgent(_0x18ead4);return Promise[_0xecff('0x41')]([_0x12d549,_0x33bcb1])[_0xecff('0x1f')](function(_0xa48ffb){var _0x10939a=_0xa48ffb[0x0];var _0x3f8e22=_0xa48ffb[0x1];var _0x88882b=_['filter'](_0x10939a['rows'],function(_0x13ec0f){return _0x13ec0f['UserId']==_0x3f8e22['id'];});return _0x3bdf47['status'](0xc8)[_0xecff('0x2d')]({'count':_0x88882b[_0xecff('0x28')],'rows':_0x88882b});})[_0xecff('0x23')](handleError(_0x3bdf47));};exports['conference']=function(_0x161190,_0x1eabd0){logger[_0xecff('0x15')]('conference\x20fired:',_0x161190[_0xecff('0x2c')]);var _0x56eefb=conferenceValidation['validate'](_0x161190[_0xecff('0x2c')]);if(_0x56eefb[_0xecff('0x28')]>0x0){return _0x1eabd0[_0xecff('0x1c')](0x190)[_0xecff('0x2d')](_0x56eefb);}var _0x303a=_0x161190[_0xecff('0x2c')][_0xecff('0x2e')];return getAgent(_0x303a)[_0xecff('0x1f')](function(_0x345ceb){logger[_0xecff('0x15')](_0xecff('0x30'),_0x345ceb[_0xecff('0x1b')]);emit(util[_0xecff('0x31')](_0xecff('0x36'),_0x345ceb['name']),'webbar:conference');return _0x1eabd0[_0xecff('0x1c')](0xc8)[_0xecff('0x2d')]({'error':![],'message':'conference\x20executed!'});})[_0xecff('0x23')](handleError(_0x1eabd0));};exports[_0xecff('0x42')]=function(_0x59857d,_0x148c69){logger[_0xecff('0x15')](_0xecff('0x43'),_0x59857d[_0xecff('0x2c')]);var _0x20e8ab=transferValidation[_0xecff('0xe')](_0x59857d['body']);if(_0x20e8ab[_0xecff('0x28')]>0x0){return _0x148c69[_0xecff('0x1c')](0x190)[_0xecff('0x2d')](_0x20e8ab);}var _0x3c333c=_0x59857d[_0xecff('0x2c')]['userId'];var _0x31cd2d=_0x59857d[_0xecff('0x2c')][_0xecff('0x27')];var _0x3e54b8=_0x59857d['body']['transferNumber'];return getAgent(_0x3c333c)['then'](function(_0x3882cf){logger[_0xecff('0x15')](_0xecff('0x30'),_0x3882cf['name']);emit(util[_0xecff('0x31')]('user:%s',_0x3882cf[_0xecff('0x1b')]),_0xecff('0x44'),{'sessionId':_0x31cd2d,'transferNumber':_0x3e54b8});return _0x148c69[_0xecff('0x1c')](0xc8)[_0xecff('0x2d')]({'error':![],'message':'transfer\x20executed!'});})[_0xecff('0x23')](handleError(_0x148c69));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index c620fdd..3b9be16 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(_0x73536b,_0x17e09a){var _0xfd965f=function(_0x5486ea){while(--_0x5486ea){_0x73536b['push'](_0x73536b['shift']());}};_0xfd965f(++_0x17e09a);}(_0x14a0,0x8e));var _0x014a=function(_0x737849,_0x7e4729){_0x737849=_0x737849-0x0;var _0x17897f=_0x14a0[_0x737849];return _0x17897f;};'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 _0x5c3c=['../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','describe','show','/:id/dispositions','/:id/canned_answers','/:id/users','getAgents','/:id/applications','getApplications','post','create','addDisposition','addAgents','addApplications','/:id/notify','notify','/:id/send','send','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x2bed4c,_0x1cd436){var _0x2f001d=function(_0x1c59e6){while(--_0x1c59e6){_0x2bed4c['push'](_0x2bed4c['shift']());}};_0x2f001d(++_0x1cd436);}(_0x5c3c,0x132));var _0xc5c3=function(_0x5834bc,_0x3d4801){_0x5834bc=_0x5834bc-0x0;var _0x3e183a=_0x5c3c[_0x5834bc];return _0x3e183a;};'use strict';var multer=require(_0xc5c3('0x0'));var util=require(_0xc5c3('0x1'));var path=require(_0xc5c3('0x2'));var timeout=require(_0xc5c3('0x3'));var express=require('express');var router=express[_0xc5c3('0x4')]();var fs_extra=require(_0xc5c3('0x5'));var auth=require(_0xc5c3('0x6'));var interaction=require(_0xc5c3('0x7'));var config=require(_0xc5c3('0x8'));var controller=require(_0xc5c3('0x9'));router[_0xc5c3('0xa')]('/',auth[_0xc5c3('0xb')](),controller[_0xc5c3('0xc')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xc5c3('0xd')]);router[_0xc5c3('0xa')]('/:id',auth[_0xc5c3('0xb')](),controller[_0xc5c3('0xe')]);router['get'](_0xc5c3('0xf'),auth[_0xc5c3('0xb')](),controller['getDispositions']);router[_0xc5c3('0xa')](_0xc5c3('0x10'),auth[_0xc5c3('0xb')](),controller['getAnswers']);router[_0xc5c3('0xa')](_0xc5c3('0x11'),auth['isAuthenticated'](),controller[_0xc5c3('0x12')]);router[_0xc5c3('0xa')](_0xc5c3('0x13'),auth['isAuthenticated'](),controller[_0xc5c3('0x14')]);router[_0xc5c3('0x15')]('/',auth[_0xc5c3('0xb')](),controller[_0xc5c3('0x16')]);router[_0xc5c3('0x15')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xc5c3('0x17')]);router[_0xc5c3('0x15')](_0xc5c3('0x10'),auth[_0xc5c3('0xb')](),controller['addAnswer']);router['post'](_0xc5c3('0x11'),auth['isAuthenticated'](),controller[_0xc5c3('0x18')]);router[_0xc5c3('0x15')](_0xc5c3('0x13'),auth[_0xc5c3('0xb')](),controller[_0xc5c3('0x19')]);router['post'](_0xc5c3('0x1a'),controller[_0xc5c3('0x1b')]);router[_0xc5c3('0x15')](_0xc5c3('0x1c'),auth['isAuthenticated'](),controller[_0xc5c3('0x1d')]);router[_0xc5c3('0x1e')](_0xc5c3('0x1f'),auth[_0xc5c3('0xb')](),controller[_0xc5c3('0x20')]);router['delete'](_0xc5c3('0x1f'),auth[_0xc5c3('0xb')](),controller[_0xc5c3('0x21')]);router[_0xc5c3('0x22')](_0xc5c3('0xf'),auth[_0xc5c3('0xb')](),controller[_0xc5c3('0x23')]);router['delete']('/:id/canned_answers',auth[_0xc5c3('0xb')](),controller[_0xc5c3('0x24')]);router['delete']('/:id/users',auth[_0xc5c3('0xb')](),controller[_0xc5c3('0x25')]);module[_0xc5c3('0x26')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 26999aa..48c8c0e 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 _0x7220=['exports','STRING','generate','ENUM','twilio','sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','randomstring'];(function(_0x195299,_0x7a1c77){var _0x258842=function(_0xbd9a1f){while(--_0xbd9a1f){_0x195299['push'](_0x195299['shift']());}};_0x258842(++_0x7a1c77);}(_0x7220,0x1ee));var _0x0722=function(_0x47e432,_0x327e5a){_0x47e432=_0x47e432-0x0;var _0x268728=_0x7220[_0x47e432];return _0x268728;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x0722('0x0'));module[_0x0722('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x0722('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x0722('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x0722('0x2')],'defaultValue':function(){return rs[_0x0722('0x3')]();}},'phone':{'type':Sequelize[_0x0722('0x2')]},'type':{'type':Sequelize[_0x0722('0x4')](_0x0722('0x5'),_0x0722('0x6'))},'accountSid':{'type':Sequelize[_0x0722('0x2')]},'baseUrl':{'type':Sequelize[_0x0722('0x2')]},'authToken':{'type':Sequelize[_0x0722('0x2')]},'notificationTemplate':{'type':Sequelize[_0x0722('0x7')],'defaultValue':function(){return _0x0722('0x8');}},'notificationSound':{'type':Sequelize[_0x0722('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x0722('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x0722('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x0722('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x0722('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x0722('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x0722('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0722('0xa')],'comment':_0x0722('0xb')},'mandatoryDisposition':{'type':Sequelize[_0x0722('0x9')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x2a6c53){if(!_0x2a6c53){this['setDataValue'](_0x0722('0xc'),null);}this[_0x0722('0xd')](_0x0722('0xe'),_0x2a6c53);}},'description':{'type':Sequelize[_0x0722('0x2')]}}; \ No newline at end of file +var _0x0e7b=['setDataValue','mandatoryDisposition','randomstring','exports','name','STRING','generate','ENUM','twilio','sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x52ab72,_0x20fcef){var _0x50f62b=function(_0x1c5d45){while(--_0x1c5d45){_0x52ab72['push'](_0x52ab72['shift']());}};_0x50f62b(++_0x20fcef);}(_0x0e7b,0x192));var _0xb0e7=function(_0x2d0ae2,_0x11cc43){_0x2d0ae2=_0x2d0ae2-0x0;var _0x71707f=_0x0e7b[_0x2d0ae2];return _0x71707f;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xb0e7('0x0'));module[_0xb0e7('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xb0e7('0x2'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0xb0e7('0x3')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xb0e7('0x4')]();}},'phone':{'type':Sequelize[_0xb0e7('0x3')]},'type':{'type':Sequelize[_0xb0e7('0x5')](_0xb0e7('0x6'),_0xb0e7('0x7'))},'accountSid':{'type':Sequelize[_0xb0e7('0x3')]},'baseUrl':{'type':Sequelize[_0xb0e7('0x3')]},'authToken':{'type':Sequelize[_0xb0e7('0x3')]},'notificationTemplate':{'type':Sequelize[_0xb0e7('0x8')],'defaultValue':function(){return _0xb0e7('0x9');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xb0e7('0xa')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xb0e7('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xb0e7('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xb0e7('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xb0e7('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb0e7('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xb0e7('0xb')],'comment':_0xb0e7('0xc')},'mandatoryDisposition':{'type':Sequelize[_0xb0e7('0xa')],'defaultValue':![],'comment':_0xb0e7('0xd'),'set':function(_0x4013c7){if(!_0x4013c7){this[_0xb0e7('0xe')]('mandatoryDispositionPauseId',null);}this[_0xb0e7('0xe')](_0xb0e7('0xf'),_0x4013c7);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 601eb96..84233e8 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 _0x98d1=['rawAttributes','fieldName','key','model','filters','intersection','query','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','WhatsappAccount','includeAll','include','findAll','show','params','keys','options','find','create','body','user','get','role','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','WhatsappAccountId','Disposition','findOne','hasOwnProperty','filter','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','omit','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','WhatsappApplication','destroy','bulkCreate','findAndCountAll','priority','finally','notify','whatsapp','Applications','account','type','statuses','state','read','WhatsappMessage','timestamp','applications','orderBy','asc','CmContact','ValidationError','updatedAt','createdAt','ListId','mobile','from','From','replace','whatsapp:','Body','messageId','MessageSid','notifications','message_id','isNil','Sequelize','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','WhatsappInteraction','interaction','autoclose','close','unmanaged','*,*,*,*','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','entity\x20found','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','text/xml','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','List','out','dataValues','Messages','push','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','defaults','redis','localhost','./whatsappAccount.socket','register','jayson/promise','client','http','request','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','then','WhatsappAccounts','UserProfileResource','stack','name','send','Pause','mandatoryDispositionPause','map'];(function(_0x3e961c,_0x5747e7){var _0x474f9c=function(_0x33f8ea){while(--_0x33f8ea){_0x3e961c['push'](_0x3e961c['shift']());}};_0x474f9c(++_0x5747e7);}(_0x98d1,0x143));var _0x198d=function(_0x167b49,_0x4ee63a){_0x167b49=_0x167b49-0x0;var _0xcae368=_0x98d1[_0x167b49];return _0xcae368;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x198d('0x0'));var zipdir=require(_0x198d('0x1'));var jsonpatch=require(_0x198d('0x2'));var rp=require(_0x198d('0x3'));var moment=require(_0x198d('0x4'));var BPromise=require(_0x198d('0x5'));var Mustache=require(_0x198d('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x198d('0x7'));var ejs=require(_0x198d('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x198d('0x9'));var squel=require('squel');var crypto=require(_0x198d('0xa'));var jsforce=require(_0x198d('0xb'));var deskjs=require(_0x198d('0xc'));var toCsv=require(_0x198d('0x7'));var querystring=require(_0x198d('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x198d('0xe'));var qs=require(_0x198d('0xf'));var as=require(_0x198d('0x10'));var hardwareService=require(_0x198d('0x11'));var logger=require('../../config/logger')(_0x198d('0x12'));var utils=require(_0x198d('0x13'));var config=require(_0x198d('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x198d('0x15')](config[_0x198d('0x16')],{'host':_0x198d('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x198d('0x18'))[_0x198d('0x19')](socket);var jayson=require(_0x198d('0x1a'));var client=jayson[_0x198d('0x1b')][_0x198d('0x1c')]({'port':0x232c});function respondWithRpcPromise(_0x401f92,_0x540151,_0x66e2bc,_0x2cd042){return new BPromise(function(_0x46a729,_0x528705){var _0x48f5e8=_0x2cd042||client;return _0x48f5e8[_0x198d('0x1d')](_0x401f92,_0x66e2bc)['then'](function(_0x5cf837){logger[_0x198d('0x1e')](_0x198d('0x1f'),_0x540151,_0x198d('0x20'));logger['debug'](_0x198d('0x21'),_0x540151,_0x198d('0x20'),JSON['stringify'](_0x5cf837));if(_0x5cf837[_0x198d('0x22')]){if(_0x5cf837['error'][_0x198d('0x23')]===0x1f4){logger[_0x198d('0x22')](_0x198d('0x1f'),_0x540151,_0x5cf837[_0x198d('0x22')][_0x198d('0x24')]);return _0x528705(_0x5cf837[_0x198d('0x22')][_0x198d('0x24')]);}logger[_0x198d('0x22')](_0x198d('0x1f'),_0x540151,_0x5cf837[_0x198d('0x22')]['message']);return _0x46a729(_0x5cf837[_0x198d('0x22')][_0x198d('0x24')]);}else{logger[_0x198d('0x1e')]('WhatsappAccount,\x20%s,\x20%s',_0x540151,_0x198d('0x20'));_0x46a729(_0x5cf837[_0x198d('0x25')]['message']);}})['catch'](function(_0x46c10c){logger[_0x198d('0x22')](_0x198d('0x1f'),_0x540151,_0x46c10c);_0x528705(_0x46c10c);});});}function respondWithStatusCode(_0x46442d,_0x377754){_0x377754=_0x377754||0xcc;return function(_0x506523){if(_0x506523){return _0x46442d[_0x198d('0x26')](_0x377754);}return _0x46442d['status'](_0x377754)['end']();};}function respondWithResult(_0x60a456,_0x741e31){_0x741e31=_0x741e31||0xc8;return function(_0x225fa3){if(_0x225fa3){return _0x60a456[_0x198d('0x27')](_0x741e31)[_0x198d('0x28')](_0x225fa3);}};}function respondWithFilteredResult(_0x33b9f5,_0x751152){return function(_0x400b5b){if(_0x400b5b){var _0x5dee95=typeof _0x751152[_0x198d('0x29')]===_0x198d('0x2a')&&typeof _0x751152[_0x198d('0x2b')]===_0x198d('0x2a');var _0x28ceb4=_0x400b5b[_0x198d('0x2c')];var _0x1adbe8=_0x5dee95?0x0:_0x751152['offset'];var _0x42129d=_0x5dee95?_0x400b5b[_0x198d('0x2c')]:_0x751152[_0x198d('0x29')]+_0x751152[_0x198d('0x2b')];var _0x5f30e5;if(_0x42129d>=_0x28ceb4){_0x42129d=_0x28ceb4;_0x5f30e5=0xc8;}else{_0x5f30e5=0xce;}_0x33b9f5['status'](_0x5f30e5);return _0x33b9f5[_0x198d('0x2d')](_0x198d('0x2e'),_0x1adbe8+'-'+_0x42129d+'/'+_0x28ceb4)['json'](_0x400b5b);}return null;};}function patchUpdates(_0x1d9a03){return function(_0x4da1bd){try{jsonpatch['apply'](_0x4da1bd,_0x1d9a03,!![]);}catch(_0x23e2a8){return BPromise[_0x198d('0x2f')](_0x23e2a8);}return _0x4da1bd['save']();};}function saveUpdates(_0x31231e,_0x3505cc){return function(_0x15e9ef){if(_0x15e9ef){return _0x15e9ef['update'](_0x31231e)[_0x198d('0x30')](function(_0xb63175){return _0xb63175;});}return null;};}function removeEntity(_0x5bab96,_0x4a9acc){return function(_0x17a8cc){if(_0x17a8cc){return _0x17a8cc['destroy']()[_0x198d('0x30')](function(){var _0x161339=_0x17a8cc['get']({'plain':!![]});var _0x19d766=_0x198d('0x31');return db[_0x198d('0x32')]['destroy']({'where':{'type':_0x19d766,'resourceId':_0x161339['id']}})[_0x198d('0x30')](function(){return _0x17a8cc;});})[_0x198d('0x30')](function(){_0x5bab96['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4193ed,_0x191e42){return function(_0x100e43){if(!_0x100e43){_0x4193ed[_0x198d('0x26')](0x194);}return _0x100e43;};}function handleError(_0x4530a0,_0x454588){_0x454588=_0x454588||0x1f4;return function(_0x37b62d){logger['error'](_0x37b62d[_0x198d('0x33')]);if(_0x37b62d[_0x198d('0x34')]){delete _0x37b62d[_0x198d('0x34')];}_0x4530a0[_0x198d('0x27')](_0x454588)[_0x198d('0x35')](_0x37b62d);};}exports['index']=function(_0x5e6f04,_0x333865){var _0x2dc0cb={'include':[{'model':db[_0x198d('0x36')],'as':_0x198d('0x37')}]},_0x145e47={},_0x5d99fd={'count':0x0,'rows':[]};var _0x111a0f=_[_0x198d('0x38')](db['WhatsappAccount'][_0x198d('0x39')],function(_0x78f128){return{'name':_0x78f128[_0x198d('0x3a')],'type':_0x78f128['type'][_0x198d('0x3b')]};});_0x145e47[_0x198d('0x3c')]=_[_0x198d('0x38')](_0x111a0f,_0x198d('0x34'));_0x145e47['query']=_['keys'](_0x5e6f04['query']);_0x145e47[_0x198d('0x3d')]=_[_0x198d('0x3e')](_0x145e47['model'],_0x145e47[_0x198d('0x3f')]);_0x2dc0cb[_0x198d('0x40')]=_['intersection'](_0x145e47['model'],qs[_0x198d('0x41')](_0x5e6f04[_0x198d('0x3f')]['fields']));_0x2dc0cb[_0x198d('0x40')]=_0x2dc0cb[_0x198d('0x40')][_0x198d('0x42')]?_0x2dc0cb[_0x198d('0x40')]:_0x145e47['model'];if(!_0x5e6f04['query']['hasOwnProperty'](_0x198d('0x43'))){_0x2dc0cb['limit']=qs[_0x198d('0x2b')](_0x5e6f04['query']['limit']);_0x2dc0cb[_0x198d('0x29')]=qs[_0x198d('0x29')](_0x5e6f04['query'][_0x198d('0x29')]);}_0x2dc0cb[_0x198d('0x44')]=qs[_0x198d('0x45')](_0x5e6f04['query'][_0x198d('0x45')]);_0x2dc0cb[_0x198d('0x46')]=qs[_0x198d('0x3d')](_[_0x198d('0x47')](_0x5e6f04['query'],_0x145e47['filters']),_0x111a0f);if(_0x5e6f04[_0x198d('0x3f')]['filter']){_0x2dc0cb[_0x198d('0x46')]=_[_0x198d('0x48')](_0x2dc0cb[_0x198d('0x46')],{'$or':_[_0x198d('0x38')](_0x111a0f,function(_0x3ea21e){if(_0x3ea21e['type']!==_0x198d('0x49')){var _0x95dfda={};_0x95dfda[_0x3ea21e['name']]={'$like':'%'+_0x5e6f04[_0x198d('0x3f')]['filter']+'%'};return _0x95dfda;}})});}_0x2dc0cb=_[_0x198d('0x48')]({},_0x2dc0cb,_0x5e6f04['options']);var _0x397f3e={'where':_0x2dc0cb[_0x198d('0x46')]};return db[_0x198d('0x4a')][_0x198d('0x2c')](_0x397f3e)['then'](function(_0x1ca44d){_0x5d99fd['count']=_0x1ca44d;if(_0x5e6f04[_0x198d('0x3f')][_0x198d('0x4b')]){_0x2dc0cb[_0x198d('0x4c')]=[{'all':!![]}];}return db[_0x198d('0x4a')][_0x198d('0x4d')](_0x2dc0cb);})[_0x198d('0x30')](function(_0x202710){_0x5d99fd['rows']=_0x202710;return _0x5d99fd;})[_0x198d('0x30')](respondWithFilteredResult(_0x333865,_0x2dc0cb))['catch'](handleError(_0x333865,null));};exports[_0x198d('0x4e')]=function(_0x294286,_0x33aabd){var _0x3d734f={'raw':![],'where':{'id':_0x294286[_0x198d('0x4f')]['id']},'include':[{'model':db[_0x198d('0x36')],'as':_0x198d('0x37')}]},_0x4f70df={};_0x4f70df[_0x198d('0x3c')]=_[_0x198d('0x50')](db[_0x198d('0x4a')][_0x198d('0x39')]);_0x4f70df[_0x198d('0x3f')]=_[_0x198d('0x50')](_0x294286[_0x198d('0x3f')]);_0x4f70df[_0x198d('0x3d')]=_[_0x198d('0x3e')](_0x4f70df[_0x198d('0x3c')],_0x4f70df['query']);_0x3d734f[_0x198d('0x40')]=_[_0x198d('0x3e')](_0x4f70df[_0x198d('0x3c')],qs[_0x198d('0x41')](_0x294286[_0x198d('0x3f')][_0x198d('0x41')]));_0x3d734f['attributes']=_0x3d734f[_0x198d('0x40')]['length']?_0x3d734f[_0x198d('0x40')]:_0x4f70df[_0x198d('0x3c')];if(_0x294286[_0x198d('0x3f')][_0x198d('0x4b')]){_0x3d734f[_0x198d('0x4c')]=[{'all':!![]}];}_0x3d734f=_[_0x198d('0x48')]({},_0x3d734f,_0x294286[_0x198d('0x51')]);return db[_0x198d('0x4a')][_0x198d('0x52')](_0x3d734f)[_0x198d('0x30')](handleEntityNotFound(_0x33aabd,null))[_0x198d('0x30')](respondWithResult(_0x33aabd,null))['catch'](handleError(_0x33aabd,null));};exports['create']=function(_0x12a589,_0x1520d8){return db['WhatsappAccount'][_0x198d('0x53')](_0x12a589[_0x198d('0x54')],{})['then'](function(_0x1d164f){var _0x280f09=_0x12a589[_0x198d('0x55')][_0x198d('0x56')]({'plain':!![]});if(!_0x280f09)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x280f09[_0x198d('0x57')]==='user'){var _0x4ca423=_0x1d164f[_0x198d('0x56')]({'plain':!![]});var _0x24100a=_0x198d('0x31');return db[_0x198d('0x58')][_0x198d('0x52')]({'where':{'name':_0x24100a,'userProfileId':_0x280f09[_0x198d('0x59')]},'raw':!![]})[_0x198d('0x30')](function(_0x5f3db6){if(_0x5f3db6&&_0x5f3db6[_0x198d('0x5a')]===0x0){return db['UserProfileResource'][_0x198d('0x53')]({'name':_0x4ca423[_0x198d('0x34')],'resourceId':_0x4ca423['id'],'type':_0x5f3db6[_0x198d('0x34')],'sectionId':_0x5f3db6['id']},{})['then'](function(){return _0x1d164f;});}else{return _0x1d164f;}})[_0x198d('0x5b')](function(_0x1fba95){logger[_0x198d('0x22')](_0x198d('0x5c'),_0x1fba95);throw _0x1fba95;});}return _0x1d164f;})[_0x198d('0x30')](respondWithResult(_0x1520d8,0xc9))['catch'](handleError(_0x1520d8,null));};exports[_0x198d('0x5d')]=function(_0x4527ce,_0x19f236){if(_0x4527ce[_0x198d('0x54')]['id']){delete _0x4527ce['body']['id'];}return db['WhatsappAccount'][_0x198d('0x52')]({'where':{'id':_0x4527ce[_0x198d('0x4f')]['id']},'include':[{'model':db[_0x198d('0x36')],'as':_0x198d('0x37')}]})[_0x198d('0x30')](handleEntityNotFound(_0x19f236,null))['then'](saveUpdates(_0x4527ce[_0x198d('0x54')],null))[_0x198d('0x30')](respondWithResult(_0x19f236,null))[_0x198d('0x5b')](handleError(_0x19f236,null));};exports['destroy']=function(_0x1475c2,_0x3d152c){return db[_0x198d('0x4a')][_0x198d('0x52')]({'where':{'id':_0x1475c2['params']['id']}})[_0x198d('0x30')](handleEntityNotFound(_0x3d152c,null))[_0x198d('0x30')](removeEntity(_0x3d152c,null))[_0x198d('0x5b')](handleError(_0x3d152c,null));};exports[_0x198d('0x5e')]=function(_0x21296f,_0x120a96){return db['WhatsappAccount']['describe']()[_0x198d('0x30')](respondWithResult(_0x120a96,null))['catch'](handleError(_0x120a96,null));};exports[_0x198d('0x5f')]=function(_0x27ef34,_0x5b1881,_0x37f18e){if(_0x27ef34[_0x198d('0x54')]['id']){delete _0x27ef34[_0x198d('0x54')]['id'];}return db['WhatsappAccount']['find']({'where':{'id':_0x27ef34[_0x198d('0x4f')]['id']}})['then'](handleEntityNotFound(_0x5b1881,null))['then'](function(_0xf2ddb6){if(_0xf2ddb6){_0x27ef34[_0x198d('0x54')][_0x198d('0x60')]=_0xf2ddb6['id'];return db[_0x198d('0x61')][_0x198d('0x53')](_0x27ef34['body']);}})[_0x198d('0x30')](respondWithResult(_0x5b1881,null))['catch'](handleError(_0x5b1881,null));};exports['getDispositions']=function(_0x3e32f8,_0x57d323,_0x3165ad){var _0x2c982f={'raw':![],'where':{}};var _0x28ede4={};var _0x54f573={'count':0x0,'rows':[]};return db[_0x198d('0x4a')][_0x198d('0x62')]({'where':{'id':_0x3e32f8[_0x198d('0x4f')]['id']}})[_0x198d('0x30')](handleEntityNotFound(_0x57d323,null))[_0x198d('0x30')](function(_0x546000){if(_0x546000){_0x28ede4[_0x198d('0x3c')]=_[_0x198d('0x50')](db[_0x198d('0x61')][_0x198d('0x39')]);_0x28ede4[_0x198d('0x3f')]=_[_0x198d('0x50')](_0x3e32f8[_0x198d('0x3f')]);_0x28ede4[_0x198d('0x3d')]=_[_0x198d('0x3e')](_0x28ede4['model'],_0x28ede4['query']);_0x2c982f['attributes']=_[_0x198d('0x3e')](_0x28ede4[_0x198d('0x3c')],qs['fields'](_0x3e32f8[_0x198d('0x3f')][_0x198d('0x41')]));_0x2c982f[_0x198d('0x40')]=_0x2c982f[_0x198d('0x40')]['length']?_0x2c982f[_0x198d('0x40')]:_0x28ede4[_0x198d('0x3c')];if(!_0x3e32f8[_0x198d('0x3f')][_0x198d('0x63')](_0x198d('0x43'))){_0x2c982f['limit']=qs[_0x198d('0x2b')](_0x3e32f8[_0x198d('0x3f')][_0x198d('0x2b')]);_0x2c982f[_0x198d('0x29')]=qs[_0x198d('0x29')](_0x3e32f8[_0x198d('0x3f')]['offset']);}_0x2c982f[_0x198d('0x44')]=qs[_0x198d('0x45')](_0x3e32f8[_0x198d('0x3f')][_0x198d('0x45')]);_0x2c982f[_0x198d('0x46')]=qs['filters'](_[_0x198d('0x47')](_0x3e32f8[_0x198d('0x3f')],_0x28ede4[_0x198d('0x3d')]));_0x2c982f['where'][_0x198d('0x60')]=_0x546000['id'];if(_0x3e32f8[_0x198d('0x3f')][_0x198d('0x64')]){_0x2c982f[_0x198d('0x46')]=_[_0x198d('0x48')](_0x2c982f[_0x198d('0x46')],{'$or':_[_0x198d('0x38')](_0x2c982f[_0x198d('0x40')],function(_0x21b4e3){var _0x3d3e81={};_0x3d3e81[_0x21b4e3]={'$like':'%'+_0x3e32f8['query']['filter']+'%'};return _0x3d3e81;})});}_0x2c982f=_[_0x198d('0x48')]({},_0x2c982f,_0x3e32f8[_0x198d('0x51')]);return db['Disposition'][_0x198d('0x2c')]({'where':_0x2c982f['where']})[_0x198d('0x30')](function(_0x348fd1){_0x54f573[_0x198d('0x2c')]=_0x348fd1;if(_0x3e32f8[_0x198d('0x3f')][_0x198d('0x4b')]){_0x2c982f[_0x198d('0x4c')]=[{'all':!![]}];}return db[_0x198d('0x61')]['findAll'](_0x2c982f);})[_0x198d('0x30')](function(_0x423fb8){_0x54f573[_0x198d('0x65')]=_0x423fb8;return _0x54f573;});}})[_0x198d('0x30')](respondWithFilteredResult(_0x57d323,_0x2c982f))[_0x198d('0x5b')](handleError(_0x57d323,null));};exports[_0x198d('0x66')]=function(_0x2d80f3,_0x3ff284,_0x476b2b){return db[_0x198d('0x4a')][_0x198d('0x52')]({'where':{'id':_0x2d80f3[_0x198d('0x4f')]['id']}})[_0x198d('0x30')](handleEntityNotFound(_0x3ff284,null))[_0x198d('0x30')](function(_0x3dee2b){if(_0x3dee2b){return _0x3dee2b['removeDispositions'](_0x2d80f3[_0x198d('0x3f')][_0x198d('0x67')]);}})['then'](respondWithStatusCode(_0x3ff284,null))[_0x198d('0x5b')](handleError(_0x3ff284,null));};exports[_0x198d('0x68')]=function(_0x5bfa3d,_0x5849fc,_0x322618){if(_0x5bfa3d['body']['id']){delete _0x5bfa3d[_0x198d('0x54')]['id'];}return db['WhatsappAccount'][_0x198d('0x52')]({'where':{'id':_0x5bfa3d[_0x198d('0x4f')]['id']}})[_0x198d('0x30')](handleEntityNotFound(_0x5849fc,null))[_0x198d('0x30')](function(_0x49a484){if(_0x49a484){_0x5bfa3d[_0x198d('0x54')][_0x198d('0x60')]=_0x49a484['id'];return db[_0x198d('0x69')][_0x198d('0x53')](_0x5bfa3d[_0x198d('0x54')]);}})[_0x198d('0x30')](respondWithResult(_0x5849fc,null))[_0x198d('0x5b')](handleError(_0x5849fc,null));};exports[_0x198d('0x6a')]=function(_0x5b7a85,_0x297aa1,_0x22a142){var _0x4aca4d={'raw':![],'where':{}};var _0x5e35c6={};var _0x41e8e2={'count':0x0,'rows':[]};return db['WhatsappAccount']['findOne']({'where':{'id':_0x5b7a85[_0x198d('0x4f')]['id']}})[_0x198d('0x30')](handleEntityNotFound(_0x297aa1,null))[_0x198d('0x30')](function(_0x329ae1){if(_0x329ae1){_0x5e35c6['model']=_['keys'](db['CannedAnswer']['rawAttributes']);_0x5e35c6[_0x198d('0x3f')]=_['keys'](_0x5b7a85[_0x198d('0x3f')]);_0x5e35c6[_0x198d('0x3d')]=_[_0x198d('0x3e')](_0x5e35c6[_0x198d('0x3c')],_0x5e35c6['query']);_0x4aca4d[_0x198d('0x40')]=_[_0x198d('0x3e')](_0x5e35c6[_0x198d('0x3c')],qs[_0x198d('0x41')](_0x5b7a85[_0x198d('0x3f')][_0x198d('0x41')]));_0x4aca4d['attributes']=_0x4aca4d[_0x198d('0x40')][_0x198d('0x42')]?_0x4aca4d[_0x198d('0x40')]:_0x5e35c6[_0x198d('0x3c')];if(!_0x5b7a85[_0x198d('0x3f')]['hasOwnProperty']('nolimit')){_0x4aca4d[_0x198d('0x2b')]=qs[_0x198d('0x2b')](_0x5b7a85[_0x198d('0x3f')][_0x198d('0x2b')]);_0x4aca4d[_0x198d('0x29')]=qs[_0x198d('0x29')](_0x5b7a85[_0x198d('0x3f')][_0x198d('0x29')]);}_0x4aca4d[_0x198d('0x44')]=qs[_0x198d('0x45')](_0x5b7a85[_0x198d('0x3f')][_0x198d('0x45')]);_0x4aca4d['where']=qs[_0x198d('0x3d')](_[_0x198d('0x47')](_0x5b7a85['query'],_0x5e35c6[_0x198d('0x3d')]));_0x4aca4d['where'][_0x198d('0x60')]=_0x329ae1['id'];if(_0x5b7a85[_0x198d('0x3f')]['filter']){_0x4aca4d[_0x198d('0x46')]=_[_0x198d('0x48')](_0x4aca4d['where'],{'$or':_[_0x198d('0x38')](_0x4aca4d[_0x198d('0x40')],function(_0x474bfd){var _0x1bb2c7={};_0x1bb2c7[_0x474bfd]={'$like':'%'+_0x5b7a85['query'][_0x198d('0x64')]+'%'};return _0x1bb2c7;})});}_0x4aca4d=_[_0x198d('0x48')]({},_0x4aca4d,_0x5b7a85[_0x198d('0x51')]);return db[_0x198d('0x69')][_0x198d('0x2c')]({'where':_0x4aca4d[_0x198d('0x46')]})[_0x198d('0x30')](function(_0x3a04eb){_0x41e8e2[_0x198d('0x2c')]=_0x3a04eb;if(_0x5b7a85[_0x198d('0x3f')][_0x198d('0x4b')]){_0x4aca4d[_0x198d('0x4c')]=[{'all':!![]}];}return db['CannedAnswer'][_0x198d('0x4d')](_0x4aca4d);})[_0x198d('0x30')](function(_0x4cd305){_0x41e8e2[_0x198d('0x65')]=_0x4cd305;return _0x41e8e2;});}})[_0x198d('0x30')](respondWithFilteredResult(_0x297aa1,_0x4aca4d))[_0x198d('0x5b')](handleError(_0x297aa1,null));};exports['removeAnswers']=function(_0x13d996,_0xa67b02,_0x3f4807){return db[_0x198d('0x4a')][_0x198d('0x52')]({'where':{'id':_0x13d996['params']['id']}})[_0x198d('0x30')](handleEntityNotFound(_0xa67b02,null))[_0x198d('0x30')](function(_0x1d9153){if(_0x1d9153){return _0x1d9153[_0x198d('0x6b')](_0x13d996[_0x198d('0x3f')][_0x198d('0x67')]);}})[_0x198d('0x30')](respondWithStatusCode(_0xa67b02,null))[_0x198d('0x5b')](handleError(_0xa67b02,null));};exports['addAgents']=function(_0x546179,_0x59efd1,_0x3b0362){return db[_0x198d('0x4a')]['find']({'where':{'id':_0x546179['params']['id']}})[_0x198d('0x30')](handleEntityNotFound(_0x59efd1,null))['then'](function(_0xdb18f5){if(_0xdb18f5){return _0xdb18f5['addAgents'](_0x546179[_0x198d('0x54')][_0x198d('0x67')],_[_0x198d('0x6c')](_0x546179[_0x198d('0x54')],[_0x198d('0x67'),'id'])||{})[_0x198d('0x6d')](function(_0x28ca9e){for(var _0x1cf5f7=0x0;_0x1cf5f7<_0x546179[_0x198d('0x54')][_0x198d('0x67')][_0x198d('0x42')];_0x1cf5f7+=0x1){socket[_0x198d('0x6e')](_0x198d('0x6f'),{'UserId':Number(_0x546179['body']['ids'][_0x1cf5f7]),'WhatsappAccountId':Number(_0x546179[_0x198d('0x4f')]['id'])});}return _0x28ca9e;});}})[_0x198d('0x30')](respondWithResult(_0x59efd1,null))['catch'](handleError(_0x59efd1,null));};exports[_0x198d('0x70')]=function(_0x4fba69,_0x406304,_0x43f82c){return db['WhatsappAccount'][_0x198d('0x52')]({'where':{'id':_0x4fba69[_0x198d('0x4f')]['id']}})[_0x198d('0x30')](handleEntityNotFound(_0x406304,null))[_0x198d('0x30')](function(_0x5612bb){if(_0x5612bb){return _0x5612bb[_0x198d('0x70')](_0x4fba69[_0x198d('0x3f')][_0x198d('0x67')])[_0x198d('0x30')](function(){if(_[_0x198d('0x71')](_0x4fba69[_0x198d('0x3f')][_0x198d('0x67')])){for(var _0x3e0b14=0x0;_0x3e0b14<_0x4fba69['query']['ids']['length'];_0x3e0b14+=0x1){socket[_0x198d('0x6e')](_0x198d('0x72'),{'UserId':Number(_0x4fba69[_0x198d('0x3f')][_0x198d('0x67')][_0x3e0b14]),'WhatsappAccountId':Number(_0x4fba69['params']['id'])});}}else{socket[_0x198d('0x6e')](_0x198d('0x72'),{'UserId':Number(_0x4fba69[_0x198d('0x3f')][_0x198d('0x67')]),'WhatsappAccountId':Number(_0x4fba69['params']['id'])});}});}})['then'](respondWithStatusCode(_0x406304,null))[_0x198d('0x5b')](handleError(_0x406304,null));};exports[_0x198d('0x73')]=function(_0xb6961,_0x46b2b2,_0x25f6b9){var _0x359ab7={};var _0x56f989={};var _0x5d899e;var _0x4c35aa;return db['WhatsappAccount']['findOne']({'where':{'id':_0xb6961[_0x198d('0x4f')]['id']}})[_0x198d('0x30')](handleEntityNotFound(_0x46b2b2,null))[_0x198d('0x30')](function(_0x4387ed){if(_0x4387ed){_0x5d899e=_0x4387ed;_0x56f989[_0x198d('0x3c')]=_[_0x198d('0x50')](db[_0x198d('0x74')][_0x198d('0x39')]);_0x56f989['query']=_[_0x198d('0x50')](_0xb6961[_0x198d('0x3f')]);_0x56f989[_0x198d('0x3d')]=_['intersection'](_0x56f989['model'],_0x56f989[_0x198d('0x3f')]);_0x359ab7[_0x198d('0x40')]=_[_0x198d('0x3e')](_0x56f989['model'],qs[_0x198d('0x41')](_0xb6961[_0x198d('0x3f')][_0x198d('0x41')]));_0x359ab7['attributes']=_0x359ab7['attributes']['length']?_0x359ab7[_0x198d('0x40')]:_0x56f989[_0x198d('0x3c')];_0x359ab7[_0x198d('0x44')]=qs[_0x198d('0x45')](_0xb6961[_0x198d('0x3f')][_0x198d('0x45')]);_0x359ab7['where']=qs[_0x198d('0x3d')](_[_0x198d('0x47')](_0xb6961[_0x198d('0x3f')],_0x56f989[_0x198d('0x3d')]));if(_0xb6961[_0x198d('0x3f')][_0x198d('0x64')]){_0x359ab7[_0x198d('0x46')]=_[_0x198d('0x48')](_0x359ab7[_0x198d('0x46')],{'$or':_['map'](_0x359ab7[_0x198d('0x40')],function(_0x31c38b){var _0x117c00={};_0x117c00[_0x31c38b]={'$like':'%'+_0xb6961[_0x198d('0x3f')][_0x198d('0x64')]+'%'};return _0x117c00;})});}_0x359ab7=_[_0x198d('0x48')]({},_0x359ab7,_0xb6961[_0x198d('0x51')]);return _0x5d899e[_0x198d('0x73')](_0x359ab7);}})[_0x198d('0x30')](function(_0x1712ac){if(_0x1712ac){_0x4c35aa=_0x1712ac['length'];if(!_0xb6961[_0x198d('0x3f')][_0x198d('0x63')](_0x198d('0x43'))){_0x359ab7[_0x198d('0x2b')]=qs[_0x198d('0x2b')](_0xb6961[_0x198d('0x3f')][_0x198d('0x2b')]);_0x359ab7[_0x198d('0x29')]=qs[_0x198d('0x29')](_0xb6961[_0x198d('0x3f')][_0x198d('0x29')]);}return _0x5d899e['getAgents'](_0x359ab7);}})[_0x198d('0x30')](function(_0x5ac85e){if(_0x5ac85e){return _0x5ac85e?{'count':_0x4c35aa,'rows':_0x5ac85e}:null;}})[_0x198d('0x30')](respondWithResult(_0x46b2b2,null))[_0x198d('0x5b')](handleError(_0x46b2b2,null));};exports[_0x198d('0x75')]=function(_0x3dbffa,_0x81f3b5){var _0x359cb0=_0x3dbffa['params']['id'];var _0x290e32=_0x3dbffa[_0x198d('0x54')];var _0x5f3441=0xc8;var _0x4e7b1d=null;return db[_0x198d('0x76')][_0x198d('0x77')]({'isolationLevel':db['sequelize'][_0x198d('0x78')]['ISOLATION_LEVELS'][_0x198d('0x79')]},function(_0x2f9caf){return db[_0x198d('0x4a')][_0x198d('0x62')]({'where':{'id':_0x359cb0},'transaction':_0x2f9caf})[_0x198d('0x30')](function(_0x1e5284){if(_0x1e5284){return db[_0x198d('0x7a')][_0x198d('0x7b')]({'where':{'WhatsappAccountId':_0x359cb0},'transaction':_0x2f9caf})[_0x198d('0x30')](function(){var _0x124444=_['map'](_0x290e32,function(_0x2dd01d){_0x2dd01d[_0x198d('0x60')]=_0x359cb0;return _0x2dd01d;});return db[_0x198d('0x7a')][_0x198d('0x7c')](_0x124444,{'transaction':_0x2f9caf});});}else{_0x5f3441=0x194;_0x4e7b1d=[];}});})[_0x198d('0x30')](function(){if(_0x5f3441!==0x194){return db[_0x198d('0x7a')][_0x198d('0x7d')]({'where':{'WhatsappAccountId':_0x359cb0},'order':_0x198d('0x7e')})[_0x198d('0x30')](function(_0x16154b){_0x4e7b1d=_0x16154b;});}})[_0x198d('0x5b')](function(_0xbdf5fb){_0x5f3441=0x1f4;logger[_0x198d('0x22')](_0xbdf5fb['stack']);if(_0xbdf5fb[_0x198d('0x34')]){delete _0xbdf5fb['name'];}_0x4e7b1d=_0xbdf5fb;})[_0x198d('0x7f')](function(){if(_0x4e7b1d===null){_0x81f3b5['sendStatus'](_0x5f3441);}else{if(_0x5f3441===0x1f4){_0x81f3b5[_0x198d('0x27')](_0x5f3441)[_0x198d('0x35')](_0x4e7b1d);}else{_0x81f3b5[_0x198d('0x27')](_0x5f3441)['json'](_0x4e7b1d);}}});};exports['getApplications']=function(_0x52be89,_0x1c37a8,_0x382fbe){var _0x4601db={};var _0x395c5f={};var _0xe8de85;var _0x5471de;return db[_0x198d('0x4a')][_0x198d('0x62')]({'where':{'id':_0x52be89[_0x198d('0x4f')]['id']}})[_0x198d('0x30')](handleEntityNotFound(_0x1c37a8,null))[_0x198d('0x30')](function(_0xf8ebe9){if(_0xf8ebe9){_0xe8de85=_0xf8ebe9;_0x395c5f['model']=_[_0x198d('0x50')](db[_0x198d('0x7a')]['rawAttributes']);_0x395c5f[_0x198d('0x3f')]=_['keys'](_0x52be89[_0x198d('0x3f')]);_0x395c5f[_0x198d('0x3d')]=_[_0x198d('0x3e')](_0x395c5f['model'],_0x395c5f[_0x198d('0x3f')]);_0x4601db['attributes']=_[_0x198d('0x3e')](_0x395c5f[_0x198d('0x3c')],qs[_0x198d('0x41')](_0x52be89[_0x198d('0x3f')]['fields']));_0x4601db[_0x198d('0x40')]=_0x4601db[_0x198d('0x40')][_0x198d('0x42')]?_0x4601db[_0x198d('0x40')]:_0x395c5f[_0x198d('0x3c')];_0x4601db[_0x198d('0x44')]=qs[_0x198d('0x45')](_0x52be89['query'][_0x198d('0x45')]);_0x4601db[_0x198d('0x46')]=qs[_0x198d('0x3d')](_[_0x198d('0x47')](_0x52be89[_0x198d('0x3f')],_0x395c5f['filters']));if(_0x52be89[_0x198d('0x3f')]['filter']){_0x4601db['where']=_[_0x198d('0x48')](_0x4601db[_0x198d('0x46')],{'$or':_[_0x198d('0x38')](_0x4601db[_0x198d('0x40')],function(_0x1f3f7a){var _0x55c4a9={};_0x55c4a9[_0x1f3f7a]={'$like':'%'+_0x52be89['query'][_0x198d('0x64')]+'%'};return _0x55c4a9;})});}_0x4601db=_[_0x198d('0x48')]({},_0x4601db,_0x52be89['options']);return _0xe8de85['getApplications'](_0x4601db);}})[_0x198d('0x30')](function(_0x7ce43f){if(_0x7ce43f){_0x5471de=_0x7ce43f['length'];if(!_0x52be89[_0x198d('0x3f')][_0x198d('0x63')](_0x198d('0x43'))){_0x4601db[_0x198d('0x2b')]=qs[_0x198d('0x2b')](_0x52be89[_0x198d('0x3f')]['limit']);_0x4601db[_0x198d('0x29')]=qs[_0x198d('0x29')](_0x52be89['query'][_0x198d('0x29')]);}return _0xe8de85['getApplications'](_0x4601db);}})[_0x198d('0x30')](function(_0x53ed99){if(_0x53ed99){return _0x53ed99?{'count':_0x5471de,'rows':_0x53ed99}:null;}})[_0x198d('0x30')](respondWithResult(_0x1c37a8,null))[_0x198d('0x5b')](handleError(_0x1c37a8,null));};exports[_0x198d('0x80')]=function(_0x47afe9,_0x16581d,_0x3e5e68){var _0x24abf4={'channel':_0x198d('0x81')};var _0x9bba23=[];var _0x40e8a2=[];var _0x7bf7d7={};return db[_0x198d('0x4a')][_0x198d('0x52')]({'where':{'id':_0x47afe9[_0x198d('0x4f')]['id']},'include':[{'model':db['WhatsappApplication'],'as':_0x198d('0x82')}]})[_0x198d('0x30')](handleEntityNotFound(_0x16581d,null))[_0x198d('0x30')](function(_0x483b93){_0x24abf4[_0x198d('0x83')]=_0x483b93;if(_0x24abf4[_0x198d('0x83')]&&_0x24abf4[_0x198d('0x83')][_0x198d('0x84')]==='sinch'&&_0x47afe9[_0x198d('0x54')][_0x198d('0x85')]){if(_0x47afe9[_0x198d('0x54')][_0x198d('0x85')]['length']===0x0)return;if(_0x47afe9[_0x198d('0x54')]['statuses'][0x0][_0x198d('0x86')]!==_0x198d('0x87'))return;return db[_0x198d('0x88')][_0x198d('0x5d')]({'read':!![],'readAt':_0x47afe9['body'][_0x198d('0x85')][0x0][_0x198d('0x89')]},{'where':{'messageId':_0x47afe9[_0x198d('0x54')][_0x198d('0x85')][0x0]['message_id']},'individualHooks':!![]})[_0x198d('0x30')](function(_0x4ddb08){return _0x16581d[_0x198d('0x27')](0xc8)[_0x198d('0x28')](_0x4ddb08);});}_0x24abf4[_0x198d('0x8a')]=_[_0x198d('0x8b')](_0x483b93[_0x198d('0x82')],[_0x198d('0x7e')],[_0x198d('0x8c')]);if(_0x24abf4[_0x198d('0x83')][_0x198d('0x82')]){delete _0x24abf4[_0x198d('0x83')][_0x198d('0x82')];}return db[_0x198d('0x8d')][_0x198d('0x5e')]()[_0x198d('0x30')](function(_0x24a6e1){if(!_0x24a6e1){throw new db['Sequelize'][(_0x198d('0x8e'))]('no\x20available\x20attributes');}_0x9bba23=_['difference'](_['keys'](_0x24a6e1),['createdAt',_0x198d('0x8f')]);_0x40e8a2=_['difference'](_[_0x198d('0x50')](_0x24a6e1),[_0x198d('0x90'),_0x198d('0x8f'),'CompanyId',_0x198d('0x91')]);_0x24abf4['body']={'mapKey':_0x198d('0x92')};if(_0x24abf4['account']&&_0x24abf4['account'][_0x198d('0x84')]==='twilio'){_0x24abf4[_0x198d('0x54')][_0x198d('0x93')]=_0x47afe9[_0x198d('0x54')][_0x198d('0x94')][_0x198d('0x95')](_0x198d('0x96'),'');_0x24abf4[_0x198d('0x54')][_0x198d('0x54')]=_0x47afe9[_0x198d('0x54')][_0x198d('0x97')];_0x24abf4['body'][_0x198d('0x98')]=_0x47afe9[_0x198d('0x54')][_0x198d('0x99')];}if(_0x24abf4[_0x198d('0x83')]&&_0x24abf4[_0x198d('0x83')][_0x198d('0x84')]==='sinch'){_0x24abf4[_0x198d('0x54')][_0x198d('0x93')]=_0x47afe9[_0x198d('0x54')][_0x198d('0x9a')][0x0][_0x198d('0x93')];_0x24abf4[_0x198d('0x54')][_0x198d('0x54')]=_0x47afe9['body'][_0x198d('0x9a')][0x0][_0x198d('0x24')][_0x198d('0x54')];_0x24abf4[_0x198d('0x54')][_0x198d('0x98')]=_0x47afe9[_0x198d('0x54')][_0x198d('0x9a')][0x0][_0x198d('0x9b')];}if(_0x24abf4[_0x198d('0x54')]['id']){delete _0x24abf4[_0x198d('0x54')]['id'];}if(_[_0x198d('0x9c')](_0x24abf4[_0x198d('0x54')][_0x198d('0x93')])){throw new db[(_0x198d('0x9d'))][(_0x198d('0x8e'))](_0x198d('0x9e'));}if(_[_0x198d('0x9c')](_0x24abf4[_0x198d('0x54')][_0x198d('0x54')])||_0x24abf4[_0x198d('0x54')]['body']===''){throw new db['Sequelize']['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x24abf4['body'][_0x198d('0x9f')])){throw new db[(_0x198d('0x9d'))][(_0x198d('0x8e'))](_0x198d('0xa0')+_0x40e8a2);}if(!_[_0x198d('0xa1')](_0x40e8a2,_0x24abf4[_0x198d('0x54')][_0x198d('0x9f')])){throw new db[(_0x198d('0x9d'))]['ValidationError'](_0x198d('0xa2')+_0x40e8a2);}_0x7bf7d7[_0x24abf4[_0x198d('0x54')][_0x198d('0x9f')]]=_0x24abf4[_0x198d('0x54')]['from'];return db[_0x198d('0xa3')][_0x198d('0x52')]({'where':{'id':_0x24abf4[_0x198d('0x83')]['ListId']},'include':[{'model':db[_0x198d('0x8d')],'as':'Contacts','where':_0x7bf7d7,'limit':0x1,'order':[['updatedAt','DESC']]}]});})['then'](handleEntityNotFound(_0x16581d,null))[_0x198d('0x30')](function(_0x7f8d4){if(_0x7f8d4){_0x24abf4['list']=_['omit'](_0x7f8d4,[_0x198d('0xa4')]);if(_0x7f8d4[_0x198d('0xa4')][_0x198d('0x42')]){return _0x7f8d4['Contacts'][0x0];}var _0xb6731d=_[_0x198d('0x15')](_0x24abf4[_0x198d('0x54')],{'firstName':_0x24abf4[_0x198d('0x54')]['from'],'ListId':_0x7f8d4['id']});_0xb6731d[_0x24abf4[_0x198d('0x54')][_0x198d('0x9f')]]=_0x24abf4[_0x198d('0x54')][_0x198d('0x93')];return db['CmContact'][_0x198d('0x53')](_0xb6731d,{'fields':_0x9bba23,'raw':!![]});}})['then'](handleEntityNotFound(_0x16581d,null))[_0x198d('0x30')](function(_0x43433f){if(_0x43433f){_0x24abf4['contact']=_0x43433f;var _0x1fc09d={'ContactId':_0x43433f['id'],'phone':_0x24abf4['body']['from'],'WhatsappAccountId':_0x47afe9[_0x198d('0x4f')]['id']};var _0x2e638c={'ContactId':_0x43433f['id'],'WhatsappAccountId':_0x47afe9[_0x198d('0x4f')]['id'],'closed':![]};return db[_0x198d('0xa5')][_0x198d('0x52')]({'where':_0x2e638c})[_0x198d('0x30')](function(_0x4832f3){if(_0x4832f3){return[_0x4832f3,![]];}return db[_0x198d('0xa5')][_0x198d('0x53')](_0x1fc09d)[_0x198d('0x30')](function(_0x13fd5d){return[_0x13fd5d,!![]];});});}})['spread'](function(_0x46f0ee,_0x16795c){_0x24abf4[_0x198d('0xa6')]=_0x46f0ee[_0x198d('0x56')]({'plain':!![]});_0x24abf4['interaction']['created']=![];if(_0x16795c){if(_0x24abf4[_0x198d('0x83')][_0x198d('0xa7')]){_0x24abf4[_0x198d('0x8a')]['push']({'id':0x0,'priority':_0x24abf4[_0x198d('0x8a')]['length']+0x1,'app':_0x198d('0xa8'),'appdata':_0x198d('0xa9'),'interval':_0x198d('0xaa')});}_0x24abf4[_0x198d('0xa6')]['created']=!![];}return db[_0x198d('0x88')]['create']({'phone':_0x24abf4[_0x198d('0x54')][_0x198d('0x93')],'messageId':_0x24abf4['body'][_0x198d('0x98')],'body':_0x24abf4['body'][_0x198d('0x54')],'WhatsappAccountId':_0x47afe9[_0x198d('0x4f')]['id'],'WhatsappInteractionId':_0x46f0ee['id'],'direction':'in','ContactId':_0x46f0ee['ContactId'],'AttachmentId':_0x24abf4[_0x198d('0x54')][_0x198d('0xab')]});})[_0x198d('0x30')](function(_0x5aade7){_0x24abf4[_0x198d('0x24')]=_0x5aade7;if(_0x24abf4[_0x198d('0xa6')][_0x198d('0xac')]){return db[_0x198d('0x74')][_0x198d('0x52')]({'attributes':['id',_0x198d('0x34')],'where':{'id':_0x24abf4[_0x198d('0xa6')]['UserId']}})['then'](function(_0x5e4e6b){if(_0x5e4e6b){_0x24abf4['applications'][_0x198d('0xad')]({'id':0x0,'priority':0x0,'app':_0x198d('0xae'),'appdata':_0x5e4e6b['name']+','+(_0x24abf4['account'][_0x198d('0xaf')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x198d('0xb0'),'startRouting',_0x24abf4);});}return respondWithRpcPromise(_0x198d('0xb0'),_0x198d('0xb1'),_0x24abf4);})[_0x198d('0x30')](function(_0x2be1a6){if(_0x2be1a6){var _0x59a8f4=0xc8;var _0x3c39a9='receiveMessage';logger[_0x198d('0x1e')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x3c39a9,_0x59a8f4,_0x198d('0xb2'));logger[_0x198d('0xb3')](_0x198d('0xb4'),_0x3c39a9,_0x59a8f4,_0x198d('0xb2'),JSON[_0x198d('0xb5')](_0x2be1a6));if(_0x24abf4[_0x198d('0x83')][_0x198d('0x84')]==='twilio'){return _0x16581d['status'](_0x59a8f4)['set']('Content-Type',_0x198d('0xb6'))[_0x198d('0x35')]('\x0a');}else{return _0x16581d[_0x198d('0x27')](_0x59a8f4)['json'](_0x2be1a6);}}});})[_0x198d('0x5b')](handleError(_0x16581d,null));};exports['send']=function(_0x10a335,_0x2b3e03,_0x1c48bb){var _0x339506,_0xbf895,_0x39f72b;if(_[_0x198d('0x9c')](_0x10a335['body'][_0x198d('0x54')])||_0x10a335['body']['body']===''){throw new db[(_0x198d('0x9d'))]['ValidationError'](_0x198d('0xb7'));}if(_[_0x198d('0x9c')](_0x10a335['body']['to'])){throw new db[(_0x198d('0x9d'))][(_0x198d('0x8e'))](_0x198d('0xb8'));}_0x339506=_0x10a335[_0x198d('0x54')]['to'];return db[_0x198d('0x4a')][_0x198d('0x52')]({'where':{'id':_0x10a335[_0x198d('0x4f')]['id']},'include':[{'model':db[_0x198d('0xa3')],'as':'List','include':[{'model':db[_0x198d('0x8d')],'as':_0x198d('0xa4'),'where':{'mobile':_0x339506},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})['then'](handleEntityNotFound(_0x2b3e03,null))['then'](function(_0x5f42be){if(_0x5f42be&&_0x5f42be[_0x198d('0xb9')]){_0xbf895=_0x5f42be[_0x198d('0x56')]({'plain':!![]});if(_0xbf895[_0x198d('0xb9')]&&_0xbf895[_0x198d('0xb9')]['Contacts']['length']){return _0xbf895[_0x198d('0xb9')][_0x198d('0xa4')][0x0];}return db[_0x198d('0x8d')][_0x198d('0x53')](_['defaults'](_0x10a335[_0x198d('0x54')],{'firstName':_0x339506,'mobile':_0x339506,'phone':_0x339506,'ListId':_0xbf895[_0x198d('0x91')]}));}})['then'](handleEntityNotFound(_0x2b3e03,null))[_0x198d('0x30')](function(_0x18e601){if(_0x18e601){_0x39f72b=_0x18e601;return db[_0x198d('0xa5')]['find']({'where':{'ContactId':_0x39f72b['id'],'closed':![],'WhatsappAccountId':_0xbf895['id']}})[_0x198d('0x30')](function(_0x296c24){if(_0x296c24){return[_0x296c24,![]];}return db['WhatsappInteraction']['create']({'UserId':_0x10a335[_0x198d('0x55')]['id'],'ContactId':_0x39f72b['id'],'WhatsappAccountId':_0xbf895['id'],'phone':_0x339506,'firstMsgDirection':_0x198d('0xba'),'Messages':[_['merge'](_0x10a335[_0x198d('0x54')],{'read':![],'body':_0x10a335[_0x198d('0x54')]['body'],'phone':_0x339506,'WhatsappAccountId':_0xbf895['id'],'UserId':_0x10a335[_0x198d('0x55')]['id'],'ContactId':_0x39f72b['id']})]},{'include':[{'model':db[_0x198d('0x88')],'as':'Messages'}]})[_0x198d('0x30')](function(_0x32eaf0){return[_0x32eaf0,!![]];});});}})[_0x198d('0x6d')](function(_0x121f86,_0x2696f9){if(_0x2696f9){return _0x121f86;}return db['WhatsappMessage'][_0x198d('0x53')](_[_0x198d('0x48')](_0x10a335[_0x198d('0x54')],{'read':![],'body':_0x10a335['body'][_0x198d('0x54')],'phone':_0x339506,'WhatsappAccountId':_0xbf895['id'],'WhatsappInteractionId':_0x121f86['id'],'UserId':_0x10a335[_0x198d('0x55')]['id'],'ContactId':_0x39f72b['id']}))[_0x198d('0x30')](function(_0x52df81){_0x121f86[_0x198d('0xbb')]['Messages']=[];_0x121f86[_0x198d('0xbb')][_0x198d('0xbc')][_0x198d('0xbd')](_0x52df81[_0x198d('0xbb')]);return _0x121f86;});})['then'](respondWithResult(_0x2b3e03,null))[_0x198d('0x5b')](handleError(_0x2b3e03,null));}; \ No newline at end of file +var _0x3903=['replace','whatsapp:','Body','messageId','MessageSid','notifications','from','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','defaults','contact','WhatsappInteraction','interaction','autoclose','applications','close','unmanaged','*,*,*,*','created','ContactId','UserId','agent','waitForTheAssignedAgent','startRouting','Start','receiveMessage','entity\x20found','debug','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','List','out','Messages','dataValues','push','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','http','request','info','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','catch','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','destroy','get','WhatsappAccounts','UserProfileResource','then','end','stack','name','send','index','Pause','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','where','merge','options','includeAll','include','findAll','rows','show','params','find','create','body','user','role','userProfileId','describe','addDisposition','WhatsappAccountId','getDispositions','findOne','Disposition','order','pick','removeDispositions','ids','CannedAnswer','getAnswers','addAgents','omit','spread','userWhatsappAccount:save','removeAgents','isArray','emit','userWhatsappAccount:remove','getAgents','User','addApplications','transaction','sequelize','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','findAndCountAll','getApplications','notify','Applications','account','sinch','statuses','state','read','WhatsappMessage','orderBy','priority','CmContact','Sequelize','ValidationError','createdAt','updatedAt','CompanyId','ListId','twilio','From'];(function(_0x34a970,_0x508e16){var _0x7c359a=function(_0x104ece){while(--_0x104ece){_0x34a970['push'](_0x34a970['shift']());}};_0x7c359a(++_0x508e16);}(_0x3903,0xef));var _0x3390=function(_0x1819df,_0x18d901){_0x1819df=_0x1819df-0x0;var _0x50cd92=_0x3903[_0x1819df];return _0x50cd92;};'use strict';var emlformat=require(_0x3390('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3390('0x1'));var jsonpatch=require(_0x3390('0x2'));var rp=require(_0x3390('0x3'));var moment=require(_0x3390('0x4'));var BPromise=require(_0x3390('0x5'));var Mustache=require(_0x3390('0x6'));var util=require(_0x3390('0x7'));var path=require(_0x3390('0x8'));var sox=require(_0x3390('0x9'));var csv=require('to-csv');var ejs=require(_0x3390('0xa'));var fs=require('fs');var fs_extra=require(_0x3390('0xb'));var _=require(_0x3390('0xc'));var squel=require(_0x3390('0xd'));var crypto=require(_0x3390('0xe'));var jsforce=require(_0x3390('0xf'));var deskjs=require(_0x3390('0x10'));var toCsv=require(_0x3390('0x11'));var querystring=require('querystring');var Papa=require(_0x3390('0x12'));var Redis=require(_0x3390('0x13'));var authService=require(_0x3390('0x14'));var qs=require(_0x3390('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3390('0x16'));var logger=require(_0x3390('0x17'))(_0x3390('0x18'));var utils=require(_0x3390('0x19'));var config=require(_0x3390('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x3390('0x1b')]=_['defaults'](config[_0x3390('0x1b')],{'host':_0x3390('0x1c'),'port':0x18eb});var socket=require(_0x3390('0x1d'))(new Redis(config[_0x3390('0x1b')]));require(_0x3390('0x1e'))[_0x3390('0x1f')](socket);var jayson=require(_0x3390('0x20'));var client=jayson[_0x3390('0x21')][_0x3390('0x22')]({'port':0x232c});function respondWithRpcPromise(_0x319c83,_0x14f582,_0x21322c,_0x3207f4){return new BPromise(function(_0x4c045e,_0x5a3d8e){var _0x31ecc2=_0x3207f4||client;return _0x31ecc2[_0x3390('0x23')](_0x319c83,_0x21322c)['then'](function(_0x2cb7eb){logger[_0x3390('0x24')]('WhatsappAccount,\x20%s,\x20%s',_0x14f582,_0x3390('0x25'));logger['debug'](_0x3390('0x26'),_0x14f582,'request\x20sent',JSON[_0x3390('0x27')](_0x2cb7eb));if(_0x2cb7eb[_0x3390('0x28')]){if(_0x2cb7eb[_0x3390('0x28')][_0x3390('0x29')]===0x1f4){logger['error'](_0x3390('0x2a'),_0x14f582,_0x2cb7eb[_0x3390('0x28')][_0x3390('0x2b')]);return _0x5a3d8e(_0x2cb7eb[_0x3390('0x28')][_0x3390('0x2b')]);}logger[_0x3390('0x28')](_0x3390('0x2a'),_0x14f582,_0x2cb7eb[_0x3390('0x28')][_0x3390('0x2b')]);return _0x4c045e(_0x2cb7eb[_0x3390('0x28')]['message']);}else{logger[_0x3390('0x24')]('WhatsappAccount,\x20%s,\x20%s',_0x14f582,_0x3390('0x25'));_0x4c045e(_0x2cb7eb['result']['message']);}})[_0x3390('0x2c')](function(_0x39f444){logger['error'](_0x3390('0x2a'),_0x14f582,_0x39f444);_0x5a3d8e(_0x39f444);});});}function respondWithStatusCode(_0x3d36e6,_0x589991){_0x589991=_0x589991||0xcc;return function(_0x196302){if(_0x196302){return _0x3d36e6[_0x3390('0x2d')](_0x589991);}return _0x3d36e6[_0x3390('0x2e')](_0x589991)['end']();};}function respondWithResult(_0x207460,_0x17d256){_0x17d256=_0x17d256||0xc8;return function(_0x255001){if(_0x255001){return _0x207460[_0x3390('0x2e')](_0x17d256)[_0x3390('0x2f')](_0x255001);}};}function respondWithFilteredResult(_0x380d1f,_0x10769b){return function(_0x13fd5e){if(_0x13fd5e){var _0x934198=typeof _0x10769b[_0x3390('0x30')]==='undefined'&&typeof _0x10769b['limit']===_0x3390('0x31');var _0x1b4f3b=_0x13fd5e[_0x3390('0x32')];var _0xf1ebbe=_0x934198?0x0:_0x10769b[_0x3390('0x30')];var _0x3cf048=_0x934198?_0x13fd5e['count']:_0x10769b[_0x3390('0x30')]+_0x10769b[_0x3390('0x33')];var _0x1aba6d;if(_0x3cf048>=_0x1b4f3b){_0x3cf048=_0x1b4f3b;_0x1aba6d=0xc8;}else{_0x1aba6d=0xce;}_0x380d1f[_0x3390('0x2e')](_0x1aba6d);return _0x380d1f[_0x3390('0x34')](_0x3390('0x35'),_0xf1ebbe+'-'+_0x3cf048+'/'+_0x1b4f3b)[_0x3390('0x2f')](_0x13fd5e);}return null;};}function patchUpdates(_0x24bebb){return function(_0x540af0){try{jsonpatch[_0x3390('0x36')](_0x540af0,_0x24bebb,!![]);}catch(_0x2881e7){return BPromise[_0x3390('0x37')](_0x2881e7);}return _0x540af0['save']();};}function saveUpdates(_0x596005,_0x59f177){return function(_0x8a3ef4){if(_0x8a3ef4){return _0x8a3ef4[_0x3390('0x38')](_0x596005)['then'](function(_0x23d532){return _0x23d532;});}return null;};}function removeEntity(_0x4bfa68,_0x4bc775){return function(_0x2e054a){if(_0x2e054a){return _0x2e054a[_0x3390('0x39')]()['then'](function(){var _0x7ca473=_0x2e054a[_0x3390('0x3a')]({'plain':!![]});var _0x6737a0=_0x3390('0x3b');return db[_0x3390('0x3c')][_0x3390('0x39')]({'where':{'type':_0x6737a0,'resourceId':_0x7ca473['id']}})[_0x3390('0x3d')](function(){return _0x2e054a;});})[_0x3390('0x3d')](function(){_0x4bfa68[_0x3390('0x2e')](0xcc)[_0x3390('0x3e')]();});}};}function handleEntityNotFound(_0x3a59b2,_0xb9e79c){return function(_0x2ad166){if(!_0x2ad166){_0x3a59b2[_0x3390('0x2d')](0x194);}return _0x2ad166;};}function handleError(_0x899618,_0x14cca3){_0x14cca3=_0x14cca3||0x1f4;return function(_0x4757b8){logger[_0x3390('0x28')](_0x4757b8[_0x3390('0x3f')]);if(_0x4757b8['name']){delete _0x4757b8[_0x3390('0x40')];}_0x899618[_0x3390('0x2e')](_0x14cca3)[_0x3390('0x41')](_0x4757b8);};}exports[_0x3390('0x42')]=function(_0x15a7df,_0x4cd799){var _0x2e81a7={'include':[{'model':db[_0x3390('0x43')],'as':_0x3390('0x44')}]},_0x3ffadc={},_0x2b1290={'count':0x0,'rows':[]};var _0x37a6be=_[_0x3390('0x45')](db[_0x3390('0x46')][_0x3390('0x47')],function(_0xba2f19){return{'name':_0xba2f19[_0x3390('0x48')],'type':_0xba2f19[_0x3390('0x49')][_0x3390('0x4a')]};});_0x3ffadc[_0x3390('0x4b')]=_[_0x3390('0x45')](_0x37a6be,_0x3390('0x40'));_0x3ffadc['query']=_[_0x3390('0x4c')](_0x15a7df[_0x3390('0x4d')]);_0x3ffadc[_0x3390('0x4e')]=_[_0x3390('0x4f')](_0x3ffadc['model'],_0x3ffadc[_0x3390('0x4d')]);_0x2e81a7[_0x3390('0x50')]=_[_0x3390('0x4f')](_0x3ffadc[_0x3390('0x4b')],qs[_0x3390('0x51')](_0x15a7df['query'][_0x3390('0x51')]));_0x2e81a7['attributes']=_0x2e81a7[_0x3390('0x50')][_0x3390('0x52')]?_0x2e81a7[_0x3390('0x50')]:_0x3ffadc['model'];if(!_0x15a7df[_0x3390('0x4d')][_0x3390('0x53')](_0x3390('0x54'))){_0x2e81a7[_0x3390('0x33')]=qs[_0x3390('0x33')](_0x15a7df[_0x3390('0x4d')]['limit']);_0x2e81a7[_0x3390('0x30')]=qs[_0x3390('0x30')](_0x15a7df[_0x3390('0x4d')][_0x3390('0x30')]);}_0x2e81a7['order']=qs[_0x3390('0x55')](_0x15a7df[_0x3390('0x4d')][_0x3390('0x55')]);_0x2e81a7['where']=qs['filters'](_['pick'](_0x15a7df[_0x3390('0x4d')],_0x3ffadc[_0x3390('0x4e')]),_0x37a6be);if(_0x15a7df[_0x3390('0x4d')][_0x3390('0x56')]){_0x2e81a7[_0x3390('0x57')]=_[_0x3390('0x58')](_0x2e81a7[_0x3390('0x57')],{'$or':_[_0x3390('0x45')](_0x37a6be,function(_0x2642e6){if(_0x2642e6[_0x3390('0x49')]!=='VIRTUAL'){var _0x7c394a={};_0x7c394a[_0x2642e6[_0x3390('0x40')]]={'$like':'%'+_0x15a7df[_0x3390('0x4d')][_0x3390('0x56')]+'%'};return _0x7c394a;}})});}_0x2e81a7=_[_0x3390('0x58')]({},_0x2e81a7,_0x15a7df[_0x3390('0x59')]);var _0x12de61={'where':_0x2e81a7[_0x3390('0x57')]};return db[_0x3390('0x46')][_0x3390('0x32')](_0x12de61)[_0x3390('0x3d')](function(_0x2acbf1){_0x2b1290[_0x3390('0x32')]=_0x2acbf1;if(_0x15a7df[_0x3390('0x4d')][_0x3390('0x5a')]){_0x2e81a7[_0x3390('0x5b')]=[{'all':!![]}];}return db[_0x3390('0x46')][_0x3390('0x5c')](_0x2e81a7);})[_0x3390('0x3d')](function(_0x23eed4){_0x2b1290[_0x3390('0x5d')]=_0x23eed4;return _0x2b1290;})[_0x3390('0x3d')](respondWithFilteredResult(_0x4cd799,_0x2e81a7))[_0x3390('0x2c')](handleError(_0x4cd799,null));};exports[_0x3390('0x5e')]=function(_0x5776cf,_0x39c949){var _0x24ec4c={'raw':![],'where':{'id':_0x5776cf[_0x3390('0x5f')]['id']},'include':[{'model':db[_0x3390('0x43')],'as':_0x3390('0x44')}]},_0x2367ec={};_0x2367ec[_0x3390('0x4b')]=_[_0x3390('0x4c')](db['WhatsappAccount']['rawAttributes']);_0x2367ec[_0x3390('0x4d')]=_['keys'](_0x5776cf[_0x3390('0x4d')]);_0x2367ec['filters']=_[_0x3390('0x4f')](_0x2367ec[_0x3390('0x4b')],_0x2367ec[_0x3390('0x4d')]);_0x24ec4c[_0x3390('0x50')]=_[_0x3390('0x4f')](_0x2367ec['model'],qs[_0x3390('0x51')](_0x5776cf[_0x3390('0x4d')][_0x3390('0x51')]));_0x24ec4c[_0x3390('0x50')]=_0x24ec4c[_0x3390('0x50')]['length']?_0x24ec4c[_0x3390('0x50')]:_0x2367ec[_0x3390('0x4b')];if(_0x5776cf[_0x3390('0x4d')][_0x3390('0x5a')]){_0x24ec4c[_0x3390('0x5b')]=[{'all':!![]}];}_0x24ec4c=_['merge']({},_0x24ec4c,_0x5776cf[_0x3390('0x59')]);return db[_0x3390('0x46')][_0x3390('0x60')](_0x24ec4c)[_0x3390('0x3d')](handleEntityNotFound(_0x39c949,null))['then'](respondWithResult(_0x39c949,null))[_0x3390('0x2c')](handleError(_0x39c949,null));};exports[_0x3390('0x61')]=function(_0x15ee1a,_0x5263d1){return db['WhatsappAccount'][_0x3390('0x61')](_0x15ee1a[_0x3390('0x62')],{})['then'](function(_0x3d629d){var _0x326d76=_0x15ee1a[_0x3390('0x63')][_0x3390('0x3a')]({'plain':!![]});if(!_0x326d76)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x326d76[_0x3390('0x64')]==='user'){var _0x316daf=_0x3d629d['get']({'plain':!![]});var _0x109c64='WhatsappAccounts';return db['UserProfileSection']['find']({'where':{'name':_0x109c64,'userProfileId':_0x326d76[_0x3390('0x65')]},'raw':!![]})[_0x3390('0x3d')](function(_0x4fe4d9){if(_0x4fe4d9&&_0x4fe4d9['autoAssociation']===0x0){return db[_0x3390('0x3c')][_0x3390('0x61')]({'name':_0x316daf[_0x3390('0x40')],'resourceId':_0x316daf['id'],'type':_0x4fe4d9[_0x3390('0x40')],'sectionId':_0x4fe4d9['id']},{})[_0x3390('0x3d')](function(){return _0x3d629d;});}else{return _0x3d629d;}})[_0x3390('0x2c')](function(_0x424441){logger[_0x3390('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x424441);throw _0x424441;});}return _0x3d629d;})[_0x3390('0x3d')](respondWithResult(_0x5263d1,0xc9))[_0x3390('0x2c')](handleError(_0x5263d1,null));};exports[_0x3390('0x38')]=function(_0x2ef378,_0x4f3ad4){if(_0x2ef378[_0x3390('0x62')]['id']){delete _0x2ef378[_0x3390('0x62')]['id'];}return db[_0x3390('0x46')][_0x3390('0x60')]({'where':{'id':_0x2ef378[_0x3390('0x5f')]['id']},'include':[{'model':db[_0x3390('0x43')],'as':_0x3390('0x44')}]})[_0x3390('0x3d')](handleEntityNotFound(_0x4f3ad4,null))[_0x3390('0x3d')](saveUpdates(_0x2ef378['body'],null))['then'](respondWithResult(_0x4f3ad4,null))['catch'](handleError(_0x4f3ad4,null));};exports[_0x3390('0x39')]=function(_0x287fc7,_0x3e5249){return db[_0x3390('0x46')][_0x3390('0x60')]({'where':{'id':_0x287fc7[_0x3390('0x5f')]['id']}})[_0x3390('0x3d')](handleEntityNotFound(_0x3e5249,null))[_0x3390('0x3d')](removeEntity(_0x3e5249,null))[_0x3390('0x2c')](handleError(_0x3e5249,null));};exports[_0x3390('0x66')]=function(_0xf3dec0,_0x18c4fc){return db[_0x3390('0x46')][_0x3390('0x66')]()['then'](respondWithResult(_0x18c4fc,null))[_0x3390('0x2c')](handleError(_0x18c4fc,null));};exports[_0x3390('0x67')]=function(_0x27174b,_0x3ca5a6,_0x54f536){if(_0x27174b['body']['id']){delete _0x27174b['body']['id'];}return db[_0x3390('0x46')]['find']({'where':{'id':_0x27174b['params']['id']}})[_0x3390('0x3d')](handleEntityNotFound(_0x3ca5a6,null))[_0x3390('0x3d')](function(_0x4ca494){if(_0x4ca494){_0x27174b[_0x3390('0x62')][_0x3390('0x68')]=_0x4ca494['id'];return db['Disposition'][_0x3390('0x61')](_0x27174b['body']);}})[_0x3390('0x3d')](respondWithResult(_0x3ca5a6,null))[_0x3390('0x2c')](handleError(_0x3ca5a6,null));};exports[_0x3390('0x69')]=function(_0x2cc1fc,_0x30f0a0,_0x537b33){var _0x307b30={'raw':![],'where':{}};var _0x3f7a06={};var _0x4f3ba1={'count':0x0,'rows':[]};return db[_0x3390('0x46')][_0x3390('0x6a')]({'where':{'id':_0x2cc1fc[_0x3390('0x5f')]['id']}})[_0x3390('0x3d')](handleEntityNotFound(_0x30f0a0,null))[_0x3390('0x3d')](function(_0x183674){if(_0x183674){_0x3f7a06[_0x3390('0x4b')]=_[_0x3390('0x4c')](db[_0x3390('0x6b')]['rawAttributes']);_0x3f7a06[_0x3390('0x4d')]=_[_0x3390('0x4c')](_0x2cc1fc['query']);_0x3f7a06[_0x3390('0x4e')]=_['intersection'](_0x3f7a06[_0x3390('0x4b')],_0x3f7a06[_0x3390('0x4d')]);_0x307b30[_0x3390('0x50')]=_[_0x3390('0x4f')](_0x3f7a06['model'],qs['fields'](_0x2cc1fc['query'][_0x3390('0x51')]));_0x307b30[_0x3390('0x50')]=_0x307b30[_0x3390('0x50')][_0x3390('0x52')]?_0x307b30[_0x3390('0x50')]:_0x3f7a06[_0x3390('0x4b')];if(!_0x2cc1fc[_0x3390('0x4d')]['hasOwnProperty'](_0x3390('0x54'))){_0x307b30[_0x3390('0x33')]=qs[_0x3390('0x33')](_0x2cc1fc[_0x3390('0x4d')][_0x3390('0x33')]);_0x307b30['offset']=qs[_0x3390('0x30')](_0x2cc1fc[_0x3390('0x4d')]['offset']);}_0x307b30[_0x3390('0x6c')]=qs[_0x3390('0x55')](_0x2cc1fc[_0x3390('0x4d')][_0x3390('0x55')]);_0x307b30[_0x3390('0x57')]=qs[_0x3390('0x4e')](_[_0x3390('0x6d')](_0x2cc1fc[_0x3390('0x4d')],_0x3f7a06['filters']));_0x307b30[_0x3390('0x57')][_0x3390('0x68')]=_0x183674['id'];if(_0x2cc1fc['query']['filter']){_0x307b30[_0x3390('0x57')]=_[_0x3390('0x58')](_0x307b30['where'],{'$or':_[_0x3390('0x45')](_0x307b30['attributes'],function(_0xe50e65){var _0x2012dc={};_0x2012dc[_0xe50e65]={'$like':'%'+_0x2cc1fc[_0x3390('0x4d')][_0x3390('0x56')]+'%'};return _0x2012dc;})});}_0x307b30=_[_0x3390('0x58')]({},_0x307b30,_0x2cc1fc[_0x3390('0x59')]);return db['Disposition'][_0x3390('0x32')]({'where':_0x307b30[_0x3390('0x57')]})[_0x3390('0x3d')](function(_0x4e73bc){_0x4f3ba1['count']=_0x4e73bc;if(_0x2cc1fc['query'][_0x3390('0x5a')]){_0x307b30[_0x3390('0x5b')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x307b30);})[_0x3390('0x3d')](function(_0x5da7e5){_0x4f3ba1['rows']=_0x5da7e5;return _0x4f3ba1;});}})[_0x3390('0x3d')](respondWithFilteredResult(_0x30f0a0,_0x307b30))[_0x3390('0x2c')](handleError(_0x30f0a0,null));};exports[_0x3390('0x6e')]=function(_0x2c5d3e,_0x4d55c9,_0x81fda){return db[_0x3390('0x46')][_0x3390('0x60')]({'where':{'id':_0x2c5d3e[_0x3390('0x5f')]['id']}})[_0x3390('0x3d')](handleEntityNotFound(_0x4d55c9,null))[_0x3390('0x3d')](function(_0x34b4ff){if(_0x34b4ff){return _0x34b4ff[_0x3390('0x6e')](_0x2c5d3e['query'][_0x3390('0x6f')]);}})['then'](respondWithStatusCode(_0x4d55c9,null))[_0x3390('0x2c')](handleError(_0x4d55c9,null));};exports['addAnswer']=function(_0x2c912d,_0x5c6305,_0x5b07e8){if(_0x2c912d[_0x3390('0x62')]['id']){delete _0x2c912d['body']['id'];}return db[_0x3390('0x46')]['find']({'where':{'id':_0x2c912d[_0x3390('0x5f')]['id']}})[_0x3390('0x3d')](handleEntityNotFound(_0x5c6305,null))[_0x3390('0x3d')](function(_0x4af2c2){if(_0x4af2c2){_0x2c912d[_0x3390('0x62')][_0x3390('0x68')]=_0x4af2c2['id'];return db[_0x3390('0x70')][_0x3390('0x61')](_0x2c912d[_0x3390('0x62')]);}})[_0x3390('0x3d')](respondWithResult(_0x5c6305,null))['catch'](handleError(_0x5c6305,null));};exports[_0x3390('0x71')]=function(_0x54d597,_0x57d825,_0x120da0){var _0x8e9b7c={'raw':![],'where':{}};var _0x8acde={};var _0x5494c5={'count':0x0,'rows':[]};return db['WhatsappAccount']['findOne']({'where':{'id':_0x54d597[_0x3390('0x5f')]['id']}})[_0x3390('0x3d')](handleEntityNotFound(_0x57d825,null))[_0x3390('0x3d')](function(_0x17b6f4){if(_0x17b6f4){_0x8acde[_0x3390('0x4b')]=_[_0x3390('0x4c')](db[_0x3390('0x70')][_0x3390('0x47')]);_0x8acde[_0x3390('0x4d')]=_[_0x3390('0x4c')](_0x54d597[_0x3390('0x4d')]);_0x8acde[_0x3390('0x4e')]=_['intersection'](_0x8acde[_0x3390('0x4b')],_0x8acde['query']);_0x8e9b7c[_0x3390('0x50')]=_[_0x3390('0x4f')](_0x8acde[_0x3390('0x4b')],qs[_0x3390('0x51')](_0x54d597[_0x3390('0x4d')][_0x3390('0x51')]));_0x8e9b7c[_0x3390('0x50')]=_0x8e9b7c[_0x3390('0x50')][_0x3390('0x52')]?_0x8e9b7c[_0x3390('0x50')]:_0x8acde[_0x3390('0x4b')];if(!_0x54d597[_0x3390('0x4d')]['hasOwnProperty'](_0x3390('0x54'))){_0x8e9b7c[_0x3390('0x33')]=qs[_0x3390('0x33')](_0x54d597[_0x3390('0x4d')]['limit']);_0x8e9b7c['offset']=qs['offset'](_0x54d597[_0x3390('0x4d')][_0x3390('0x30')]);}_0x8e9b7c['order']=qs['sort'](_0x54d597[_0x3390('0x4d')][_0x3390('0x55')]);_0x8e9b7c[_0x3390('0x57')]=qs[_0x3390('0x4e')](_['pick'](_0x54d597[_0x3390('0x4d')],_0x8acde['filters']));_0x8e9b7c[_0x3390('0x57')]['WhatsappAccountId']=_0x17b6f4['id'];if(_0x54d597[_0x3390('0x4d')]['filter']){_0x8e9b7c[_0x3390('0x57')]=_[_0x3390('0x58')](_0x8e9b7c[_0x3390('0x57')],{'$or':_['map'](_0x8e9b7c[_0x3390('0x50')],function(_0x31cc59){var _0x4d1d43={};_0x4d1d43[_0x31cc59]={'$like':'%'+_0x54d597[_0x3390('0x4d')]['filter']+'%'};return _0x4d1d43;})});}_0x8e9b7c=_[_0x3390('0x58')]({},_0x8e9b7c,_0x54d597[_0x3390('0x59')]);return db[_0x3390('0x70')][_0x3390('0x32')]({'where':_0x8e9b7c[_0x3390('0x57')]})[_0x3390('0x3d')](function(_0x284329){_0x5494c5[_0x3390('0x32')]=_0x284329;if(_0x54d597[_0x3390('0x4d')][_0x3390('0x5a')]){_0x8e9b7c[_0x3390('0x5b')]=[{'all':!![]}];}return db['CannedAnswer'][_0x3390('0x5c')](_0x8e9b7c);})[_0x3390('0x3d')](function(_0x958a10){_0x5494c5[_0x3390('0x5d')]=_0x958a10;return _0x5494c5;});}})[_0x3390('0x3d')](respondWithFilteredResult(_0x57d825,_0x8e9b7c))['catch'](handleError(_0x57d825,null));};exports['removeAnswers']=function(_0x3af4f1,_0x5204d4,_0x5da0f3){return db['WhatsappAccount'][_0x3390('0x60')]({'where':{'id':_0x3af4f1['params']['id']}})[_0x3390('0x3d')](handleEntityNotFound(_0x5204d4,null))[_0x3390('0x3d')](function(_0x1dcfba){if(_0x1dcfba){return _0x1dcfba['removeAnswers'](_0x3af4f1['query'][_0x3390('0x6f')]);}})['then'](respondWithStatusCode(_0x5204d4,null))['catch'](handleError(_0x5204d4,null));};exports[_0x3390('0x72')]=function(_0x4cb8ca,_0x42d432,_0x4a4a84){return db[_0x3390('0x46')][_0x3390('0x60')]({'where':{'id':_0x4cb8ca[_0x3390('0x5f')]['id']}})[_0x3390('0x3d')](handleEntityNotFound(_0x42d432,null))[_0x3390('0x3d')](function(_0x495b3a){if(_0x495b3a){return _0x495b3a[_0x3390('0x72')](_0x4cb8ca[_0x3390('0x62')]['ids'],_[_0x3390('0x73')](_0x4cb8ca[_0x3390('0x62')],[_0x3390('0x6f'),'id'])||{})[_0x3390('0x74')](function(_0x5e27e0){for(var _0x19894b=0x0;_0x19894b<_0x4cb8ca[_0x3390('0x62')][_0x3390('0x6f')][_0x3390('0x52')];_0x19894b+=0x1){socket['emit'](_0x3390('0x75'),{'UserId':Number(_0x4cb8ca[_0x3390('0x62')][_0x3390('0x6f')][_0x19894b]),'WhatsappAccountId':Number(_0x4cb8ca[_0x3390('0x5f')]['id'])});}return _0x5e27e0;});}})['then'](respondWithResult(_0x42d432,null))['catch'](handleError(_0x42d432,null));};exports[_0x3390('0x76')]=function(_0x2a2d5f,_0x3e3c8a,_0x407a98){return db[_0x3390('0x46')][_0x3390('0x60')]({'where':{'id':_0x2a2d5f['params']['id']}})[_0x3390('0x3d')](handleEntityNotFound(_0x3e3c8a,null))['then'](function(_0x49017e){if(_0x49017e){return _0x49017e[_0x3390('0x76')](_0x2a2d5f[_0x3390('0x4d')][_0x3390('0x6f')])[_0x3390('0x3d')](function(){if(_[_0x3390('0x77')](_0x2a2d5f[_0x3390('0x4d')][_0x3390('0x6f')])){for(var _0x1ad889=0x0;_0x1ad889<_0x2a2d5f['query']['ids'][_0x3390('0x52')];_0x1ad889+=0x1){socket[_0x3390('0x78')](_0x3390('0x79'),{'UserId':Number(_0x2a2d5f['query'][_0x3390('0x6f')][_0x1ad889]),'WhatsappAccountId':Number(_0x2a2d5f[_0x3390('0x5f')]['id'])});}}else{socket[_0x3390('0x78')](_0x3390('0x79'),{'UserId':Number(_0x2a2d5f[_0x3390('0x4d')]['ids']),'WhatsappAccountId':Number(_0x2a2d5f[_0x3390('0x5f')]['id'])});}});}})[_0x3390('0x3d')](respondWithStatusCode(_0x3e3c8a,null))['catch'](handleError(_0x3e3c8a,null));};exports[_0x3390('0x7a')]=function(_0x5a1d5e,_0x2f4fe9,_0x19fb2a){var _0x160bac={};var _0x51c689={};var _0x1d27ad;var _0x46043e;return db[_0x3390('0x46')][_0x3390('0x6a')]({'where':{'id':_0x5a1d5e[_0x3390('0x5f')]['id']}})['then'](handleEntityNotFound(_0x2f4fe9,null))[_0x3390('0x3d')](function(_0x6d00b4){if(_0x6d00b4){_0x1d27ad=_0x6d00b4;_0x51c689[_0x3390('0x4b')]=_[_0x3390('0x4c')](db[_0x3390('0x7b')]['rawAttributes']);_0x51c689[_0x3390('0x4d')]=_['keys'](_0x5a1d5e['query']);_0x51c689[_0x3390('0x4e')]=_[_0x3390('0x4f')](_0x51c689[_0x3390('0x4b')],_0x51c689[_0x3390('0x4d')]);_0x160bac[_0x3390('0x50')]=_[_0x3390('0x4f')](_0x51c689[_0x3390('0x4b')],qs[_0x3390('0x51')](_0x5a1d5e['query']['fields']));_0x160bac['attributes']=_0x160bac[_0x3390('0x50')][_0x3390('0x52')]?_0x160bac[_0x3390('0x50')]:_0x51c689[_0x3390('0x4b')];_0x160bac['order']=qs[_0x3390('0x55')](_0x5a1d5e['query'][_0x3390('0x55')]);_0x160bac[_0x3390('0x57')]=qs['filters'](_['pick'](_0x5a1d5e[_0x3390('0x4d')],_0x51c689[_0x3390('0x4e')]));if(_0x5a1d5e[_0x3390('0x4d')][_0x3390('0x56')]){_0x160bac[_0x3390('0x57')]=_[_0x3390('0x58')](_0x160bac[_0x3390('0x57')],{'$or':_['map'](_0x160bac[_0x3390('0x50')],function(_0x3e332){var _0x669119={};_0x669119[_0x3e332]={'$like':'%'+_0x5a1d5e[_0x3390('0x4d')][_0x3390('0x56')]+'%'};return _0x669119;})});}_0x160bac=_[_0x3390('0x58')]({},_0x160bac,_0x5a1d5e['options']);return _0x1d27ad[_0x3390('0x7a')](_0x160bac);}})[_0x3390('0x3d')](function(_0x444087){if(_0x444087){_0x46043e=_0x444087[_0x3390('0x52')];if(!_0x5a1d5e['query'][_0x3390('0x53')](_0x3390('0x54'))){_0x160bac[_0x3390('0x33')]=qs[_0x3390('0x33')](_0x5a1d5e[_0x3390('0x4d')][_0x3390('0x33')]);_0x160bac[_0x3390('0x30')]=qs[_0x3390('0x30')](_0x5a1d5e[_0x3390('0x4d')][_0x3390('0x30')]);}return _0x1d27ad[_0x3390('0x7a')](_0x160bac);}})[_0x3390('0x3d')](function(_0x28e134){if(_0x28e134){return _0x28e134?{'count':_0x46043e,'rows':_0x28e134}:null;}})['then'](respondWithResult(_0x2f4fe9,null))[_0x3390('0x2c')](handleError(_0x2f4fe9,null));};exports[_0x3390('0x7c')]=function(_0x3d99c5,_0x4a2baf){var _0x1c01dd=_0x3d99c5[_0x3390('0x5f')]['id'];var _0xc2a1e3=_0x3d99c5[_0x3390('0x62')];var _0x122598=0xc8;var _0x3efb0d=null;return db['sequelize'][_0x3390('0x7d')]({'isolationLevel':db[_0x3390('0x7e')]['Transaction'][_0x3390('0x7f')][_0x3390('0x80')]},function(_0x46ee00){return db['WhatsappAccount']['findOne']({'where':{'id':_0x1c01dd},'transaction':_0x46ee00})[_0x3390('0x3d')](function(_0x1efa50){if(_0x1efa50){return db['WhatsappApplication'][_0x3390('0x39')]({'where':{'WhatsappAccountId':_0x1c01dd},'transaction':_0x46ee00})[_0x3390('0x3d')](function(){var _0x3ea0cc=_[_0x3390('0x45')](_0xc2a1e3,function(_0x27290b){_0x27290b[_0x3390('0x68')]=_0x1c01dd;return _0x27290b;});return db[_0x3390('0x81')]['bulkCreate'](_0x3ea0cc,{'transaction':_0x46ee00});});}else{_0x122598=0x194;_0x3efb0d=[];}});})['then'](function(){if(_0x122598!==0x194){return db[_0x3390('0x81')][_0x3390('0x82')]({'where':{'WhatsappAccountId':_0x1c01dd},'order':'priority'})[_0x3390('0x3d')](function(_0x22db08){_0x3efb0d=_0x22db08;});}})['catch'](function(_0x57d44f){_0x122598=0x1f4;logger[_0x3390('0x28')](_0x57d44f[_0x3390('0x3f')]);if(_0x57d44f[_0x3390('0x40')]){delete _0x57d44f[_0x3390('0x40')];}_0x3efb0d=_0x57d44f;})['finally'](function(){if(_0x3efb0d===null){_0x4a2baf[_0x3390('0x2d')](_0x122598);}else{if(_0x122598===0x1f4){_0x4a2baf[_0x3390('0x2e')](_0x122598)[_0x3390('0x41')](_0x3efb0d);}else{_0x4a2baf[_0x3390('0x2e')](_0x122598)[_0x3390('0x2f')](_0x3efb0d);}}});};exports['getApplications']=function(_0x49a8ee,_0x64e334,_0x46cbe6){var _0x1b6eee={};var _0x5489fc={};var _0xfef71b;var _0x188441;return db[_0x3390('0x46')][_0x3390('0x6a')]({'where':{'id':_0x49a8ee[_0x3390('0x5f')]['id']}})[_0x3390('0x3d')](handleEntityNotFound(_0x64e334,null))[_0x3390('0x3d')](function(_0x3d3468){if(_0x3d3468){_0xfef71b=_0x3d3468;_0x5489fc[_0x3390('0x4b')]=_['keys'](db[_0x3390('0x81')]['rawAttributes']);_0x5489fc[_0x3390('0x4d')]=_[_0x3390('0x4c')](_0x49a8ee['query']);_0x5489fc[_0x3390('0x4e')]=_[_0x3390('0x4f')](_0x5489fc['model'],_0x5489fc[_0x3390('0x4d')]);_0x1b6eee[_0x3390('0x50')]=_['intersection'](_0x5489fc['model'],qs[_0x3390('0x51')](_0x49a8ee[_0x3390('0x4d')][_0x3390('0x51')]));_0x1b6eee[_0x3390('0x50')]=_0x1b6eee['attributes'][_0x3390('0x52')]?_0x1b6eee[_0x3390('0x50')]:_0x5489fc['model'];_0x1b6eee[_0x3390('0x6c')]=qs[_0x3390('0x55')](_0x49a8ee[_0x3390('0x4d')][_0x3390('0x55')]);_0x1b6eee[_0x3390('0x57')]=qs[_0x3390('0x4e')](_[_0x3390('0x6d')](_0x49a8ee[_0x3390('0x4d')],_0x5489fc[_0x3390('0x4e')]));if(_0x49a8ee[_0x3390('0x4d')][_0x3390('0x56')]){_0x1b6eee['where']=_[_0x3390('0x58')](_0x1b6eee[_0x3390('0x57')],{'$or':_['map'](_0x1b6eee[_0x3390('0x50')],function(_0x4ad9c0){var _0x121725={};_0x121725[_0x4ad9c0]={'$like':'%'+_0x49a8ee[_0x3390('0x4d')][_0x3390('0x56')]+'%'};return _0x121725;})});}_0x1b6eee=_[_0x3390('0x58')]({},_0x1b6eee,_0x49a8ee[_0x3390('0x59')]);return _0xfef71b[_0x3390('0x83')](_0x1b6eee);}})['then'](function(_0x2e7652){if(_0x2e7652){_0x188441=_0x2e7652[_0x3390('0x52')];if(!_0x49a8ee['query'][_0x3390('0x53')](_0x3390('0x54'))){_0x1b6eee[_0x3390('0x33')]=qs[_0x3390('0x33')](_0x49a8ee[_0x3390('0x4d')]['limit']);_0x1b6eee['offset']=qs[_0x3390('0x30')](_0x49a8ee[_0x3390('0x4d')][_0x3390('0x30')]);}return _0xfef71b[_0x3390('0x83')](_0x1b6eee);}})[_0x3390('0x3d')](function(_0x3df31c){if(_0x3df31c){return _0x3df31c?{'count':_0x188441,'rows':_0x3df31c}:null;}})[_0x3390('0x3d')](respondWithResult(_0x64e334,null))[_0x3390('0x2c')](handleError(_0x64e334,null));};exports[_0x3390('0x84')]=function(_0x48a687,_0x17b15b,_0x2d1e71){var _0x1c26f1={'channel':'whatsapp'};var _0x1a159e=[];var _0x3df6b9=[];var _0x4039eb={};return db[_0x3390('0x46')][_0x3390('0x60')]({'where':{'id':_0x48a687['params']['id']},'include':[{'model':db[_0x3390('0x81')],'as':_0x3390('0x85')}]})[_0x3390('0x3d')](handleEntityNotFound(_0x17b15b,null))['then'](function(_0x2e05af){_0x1c26f1[_0x3390('0x86')]=_0x2e05af;if(_0x1c26f1[_0x3390('0x86')]&&_0x1c26f1[_0x3390('0x86')][_0x3390('0x49')]===_0x3390('0x87')&&_0x48a687['body'][_0x3390('0x88')]){if(_0x48a687[_0x3390('0x62')][_0x3390('0x88')][_0x3390('0x52')]===0x0)return;if(_0x48a687['body'][_0x3390('0x88')][0x0][_0x3390('0x89')]!==_0x3390('0x8a'))return;return db[_0x3390('0x8b')][_0x3390('0x38')]({'read':!![],'readAt':_0x48a687[_0x3390('0x62')][_0x3390('0x88')][0x0]['timestamp']},{'where':{'messageId':_0x48a687['body'][_0x3390('0x88')][0x0]['message_id']},'individualHooks':!![]})['then'](function(_0x46f77b){return _0x17b15b[_0x3390('0x2e')](0xc8)[_0x3390('0x2f')](_0x46f77b);});}_0x1c26f1['applications']=_[_0x3390('0x8c')](_0x2e05af[_0x3390('0x85')],[_0x3390('0x8d')],['asc']);if(_0x1c26f1[_0x3390('0x86')]['Applications']){delete _0x1c26f1[_0x3390('0x86')][_0x3390('0x85')];}return db[_0x3390('0x8e')][_0x3390('0x66')]()[_0x3390('0x3d')](function(_0xf7bbca){if(!_0xf7bbca){throw new db[(_0x3390('0x8f'))][(_0x3390('0x90'))]('no\x20available\x20attributes');}_0x1a159e=_['difference'](_['keys'](_0xf7bbca),[_0x3390('0x91'),_0x3390('0x92')]);_0x3df6b9=_['difference'](_[_0x3390('0x4c')](_0xf7bbca),[_0x3390('0x91'),_0x3390('0x92'),_0x3390('0x93'),_0x3390('0x94')]);_0x1c26f1['body']={'mapKey':'mobile'};if(_0x1c26f1[_0x3390('0x86')]&&_0x1c26f1[_0x3390('0x86')][_0x3390('0x49')]===_0x3390('0x95')){_0x1c26f1['body']['from']=_0x48a687[_0x3390('0x62')][_0x3390('0x96')][_0x3390('0x97')](_0x3390('0x98'),'');_0x1c26f1['body'][_0x3390('0x62')]=_0x48a687[_0x3390('0x62')][_0x3390('0x99')];_0x1c26f1[_0x3390('0x62')][_0x3390('0x9a')]=_0x48a687['body'][_0x3390('0x9b')];}if(_0x1c26f1['account']&&_0x1c26f1[_0x3390('0x86')][_0x3390('0x49')]===_0x3390('0x87')){_0x1c26f1[_0x3390('0x62')]['from']=_0x48a687[_0x3390('0x62')][_0x3390('0x9c')][0x0][_0x3390('0x9d')];_0x1c26f1[_0x3390('0x62')][_0x3390('0x62')]=_0x48a687['body'][_0x3390('0x9c')][0x0][_0x3390('0x2b')][_0x3390('0x62')];_0x1c26f1[_0x3390('0x62')][_0x3390('0x9a')]=_0x48a687[_0x3390('0x62')][_0x3390('0x9c')][0x0]['message_id'];}if(_0x1c26f1[_0x3390('0x62')]['id']){delete _0x1c26f1['body']['id'];}if(_[_0x3390('0x9e')](_0x1c26f1[_0x3390('0x62')][_0x3390('0x9d')])){throw new db[(_0x3390('0x8f'))][(_0x3390('0x90'))](_0x3390('0x9f'));}if(_['isNil'](_0x1c26f1[_0x3390('0x62')][_0x3390('0x62')])||_0x1c26f1['body']['body']===''){throw new db['Sequelize'][(_0x3390('0x90'))](_0x3390('0xa0'));}if(_['isNil'](_0x1c26f1[_0x3390('0x62')][_0x3390('0xa1')])){throw new db[(_0x3390('0x8f'))]['ValidationError'](_0x3390('0xa2')+_0x3df6b9);}if(!_['includes'](_0x3df6b9,_0x1c26f1['body'][_0x3390('0xa1')])){throw new db[(_0x3390('0x8f'))][(_0x3390('0x90'))](_0x3390('0xa3')+_0x3df6b9);}_0x4039eb[_0x1c26f1[_0x3390('0x62')]['mapKey']]=_0x1c26f1[_0x3390('0x62')][_0x3390('0x9d')];return db[_0x3390('0xa4')][_0x3390('0x60')]({'where':{'id':_0x1c26f1[_0x3390('0x86')]['ListId']},'include':[{'model':db[_0x3390('0x8e')],'as':_0x3390('0xa5'),'where':_0x4039eb,'limit':0x1,'order':[[_0x3390('0x92'),_0x3390('0xa6')]]}]});})[_0x3390('0x3d')](handleEntityNotFound(_0x17b15b,null))[_0x3390('0x3d')](function(_0x518e65){if(_0x518e65){_0x1c26f1['list']=_[_0x3390('0x73')](_0x518e65,['Contacts']);if(_0x518e65[_0x3390('0xa5')][_0x3390('0x52')]){return _0x518e65[_0x3390('0xa5')][0x0];}var _0x3c44a2=_[_0x3390('0xa7')](_0x1c26f1[_0x3390('0x62')],{'firstName':_0x1c26f1[_0x3390('0x62')][_0x3390('0x9d')],'ListId':_0x518e65['id']});_0x3c44a2[_0x1c26f1[_0x3390('0x62')][_0x3390('0xa1')]]=_0x1c26f1[_0x3390('0x62')][_0x3390('0x9d')];return db['CmContact'][_0x3390('0x61')](_0x3c44a2,{'fields':_0x1a159e,'raw':!![]});}})[_0x3390('0x3d')](handleEntityNotFound(_0x17b15b,null))['then'](function(_0x56c246){if(_0x56c246){_0x1c26f1[_0x3390('0xa8')]=_0x56c246;var _0x183d02={'ContactId':_0x56c246['id'],'phone':_0x1c26f1[_0x3390('0x62')][_0x3390('0x9d')],'WhatsappAccountId':_0x48a687[_0x3390('0x5f')]['id']};var _0x553f84={'ContactId':_0x56c246['id'],'WhatsappAccountId':_0x48a687['params']['id'],'closed':![]};return db['WhatsappInteraction'][_0x3390('0x60')]({'where':_0x553f84})[_0x3390('0x3d')](function(_0x247281){if(_0x247281){return[_0x247281,![]];}return db[_0x3390('0xa9')]['create'](_0x183d02)['then'](function(_0x17f3a9){return[_0x17f3a9,!![]];});});}})[_0x3390('0x74')](function(_0x463fb9,_0x52763e){_0x1c26f1[_0x3390('0xaa')]=_0x463fb9['get']({'plain':!![]});_0x1c26f1[_0x3390('0xaa')]['created']=![];if(_0x52763e){if(_0x1c26f1[_0x3390('0x86')][_0x3390('0xab')]){_0x1c26f1[_0x3390('0xac')]['push']({'id':0x0,'priority':_0x1c26f1['applications'][_0x3390('0x52')]+0x1,'app':_0x3390('0xad'),'appdata':_0x3390('0xae'),'interval':_0x3390('0xaf')});}_0x1c26f1[_0x3390('0xaa')][_0x3390('0xb0')]=!![];}return db[_0x3390('0x8b')][_0x3390('0x61')]({'phone':_0x1c26f1[_0x3390('0x62')][_0x3390('0x9d')],'messageId':_0x1c26f1[_0x3390('0x62')][_0x3390('0x9a')],'body':_0x1c26f1['body'][_0x3390('0x62')],'WhatsappAccountId':_0x48a687[_0x3390('0x5f')]['id'],'WhatsappInteractionId':_0x463fb9['id'],'direction':'in','ContactId':_0x463fb9[_0x3390('0xb1')],'AttachmentId':_0x1c26f1[_0x3390('0x62')]['AttachmentId']});})[_0x3390('0x3d')](function(_0x50106e){_0x1c26f1[_0x3390('0x2b')]=_0x50106e;if(_0x1c26f1['interaction'][_0x3390('0xb2')]){return db[_0x3390('0x7b')][_0x3390('0x60')]({'attributes':['id',_0x3390('0x40')],'where':{'id':_0x1c26f1['interaction'][_0x3390('0xb2')]}})[_0x3390('0x3d')](function(_0x13e176){if(_0x13e176){_0x1c26f1[_0x3390('0xac')]['unshift']({'id':0x0,'priority':0x0,'app':_0x3390('0xb3'),'appdata':_0x13e176[_0x3390('0x40')]+','+(_0x1c26f1['account'][_0x3390('0xb4')]||0xa),'interval':_0x3390('0xaf')});}return respondWithRpcPromise('Start',_0x3390('0xb5'),_0x1c26f1);});}return respondWithRpcPromise(_0x3390('0xb6'),_0x3390('0xb5'),_0x1c26f1);})['then'](function(_0x2e5be6){if(_0x2e5be6){var _0x5b2d39=0xc8;var _0x144401=_0x3390('0xb7');logger[_0x3390('0x24')](_0x3390('0x26'),_0x144401,_0x5b2d39,_0x3390('0xb8'));logger[_0x3390('0xb9')]('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x144401,_0x5b2d39,_0x3390('0xb8'),JSON[_0x3390('0x27')](_0x2e5be6));if(_0x1c26f1[_0x3390('0x86')][_0x3390('0x49')]===_0x3390('0x95')){return _0x17b15b[_0x3390('0x2e')](_0x5b2d39)[_0x3390('0x34')](_0x3390('0xba'),_0x3390('0xbb'))['send'](_0x3390('0xbc'));}else{return _0x17b15b[_0x3390('0x2e')](_0x5b2d39)[_0x3390('0x2f')](_0x2e5be6);}}});})[_0x3390('0x2c')](handleError(_0x17b15b,null));};exports[_0x3390('0x41')]=function(_0x4b6fa1,_0x5b1187,_0x5ef478){var _0x1b6a49,_0x5adcb6,_0x5a5e5f;if(_[_0x3390('0x9e')](_0x4b6fa1['body'][_0x3390('0x62')])||_0x4b6fa1[_0x3390('0x62')][_0x3390('0x62')]===''){throw new db['Sequelize'][(_0x3390('0x90'))](_0x3390('0xa0'));}if(_['isNil'](_0x4b6fa1[_0x3390('0x62')]['to'])){throw new db[(_0x3390('0x8f'))][(_0x3390('0x90'))](_0x3390('0xbd'));}_0x1b6a49=_0x4b6fa1[_0x3390('0x62')]['to'];return db[_0x3390('0x46')]['find']({'where':{'id':_0x4b6fa1[_0x3390('0x5f')]['id']},'include':[{'model':db[_0x3390('0xa4')],'as':_0x3390('0xbe'),'include':[{'model':db[_0x3390('0x8e')],'as':_0x3390('0xa5'),'where':{'mobile':_0x1b6a49},'limit':0x1,'order':[['updatedAt',_0x3390('0xa6')]]}]}]})[_0x3390('0x3d')](handleEntityNotFound(_0x5b1187,null))[_0x3390('0x3d')](function(_0x2141ce){if(_0x2141ce&&_0x2141ce[_0x3390('0xbe')]){_0x5adcb6=_0x2141ce[_0x3390('0x3a')]({'plain':!![]});if(_0x5adcb6[_0x3390('0xbe')]&&_0x5adcb6[_0x3390('0xbe')][_0x3390('0xa5')][_0x3390('0x52')]){return _0x5adcb6[_0x3390('0xbe')][_0x3390('0xa5')][0x0];}return db[_0x3390('0x8e')]['create'](_['defaults'](_0x4b6fa1[_0x3390('0x62')],{'firstName':_0x1b6a49,'mobile':_0x1b6a49,'phone':_0x1b6a49,'ListId':_0x5adcb6['ListId']}));}})[_0x3390('0x3d')](handleEntityNotFound(_0x5b1187,null))[_0x3390('0x3d')](function(_0x13288f){if(_0x13288f){_0x5a5e5f=_0x13288f;return db['WhatsappInteraction']['find']({'where':{'ContactId':_0x5a5e5f['id'],'closed':![],'WhatsappAccountId':_0x5adcb6['id']}})['then'](function(_0x3d2a70){if(_0x3d2a70){return[_0x3d2a70,![]];}return db['WhatsappInteraction'][_0x3390('0x61')]({'UserId':_0x4b6fa1['user']['id'],'ContactId':_0x5a5e5f['id'],'WhatsappAccountId':_0x5adcb6['id'],'phone':_0x1b6a49,'firstMsgDirection':_0x3390('0xbf'),'Messages':[_['merge'](_0x4b6fa1[_0x3390('0x62')],{'read':![],'body':_0x4b6fa1['body'][_0x3390('0x62')],'phone':_0x1b6a49,'WhatsappAccountId':_0x5adcb6['id'],'UserId':_0x4b6fa1['user']['id'],'ContactId':_0x5a5e5f['id']})]},{'include':[{'model':db[_0x3390('0x8b')],'as':_0x3390('0xc0')}]})['then'](function(_0x4e5c35){return[_0x4e5c35,!![]];});});}})['spread'](function(_0x3c1f88,_0x466991){if(_0x466991){return _0x3c1f88;}return db[_0x3390('0x8b')][_0x3390('0x61')](_[_0x3390('0x58')](_0x4b6fa1[_0x3390('0x62')],{'read':![],'body':_0x4b6fa1[_0x3390('0x62')][_0x3390('0x62')],'phone':_0x1b6a49,'WhatsappAccountId':_0x5adcb6['id'],'WhatsappInteractionId':_0x3c1f88['id'],'UserId':_0x4b6fa1[_0x3390('0x63')]['id'],'ContactId':_0x5a5e5f['id']}))['then'](function(_0x3a5527){_0x3c1f88[_0x3390('0xc1')][_0x3390('0xc0')]=[];_0x3c1f88[_0x3390('0xc1')][_0x3390('0xc0')][_0x3390('0xc2')](_0x3a5527[_0x3390('0xc1')]);return _0x3c1f88;});})[_0x3390('0x3d')](respondWithResult(_0x5b1187,null))['catch'](handleError(_0x5b1187,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 586c788..dab752c 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 _0x0c8f=['save','update','remove','emit','hasOwnProperty','hook','../../mysqldb','WhatsappAccount','setMaxListeners'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x0c8f,0x114));var _0xf0c8=function(_0x37c44f,_0x4ebeb1){_0x37c44f=_0x37c44f-0x0;var _0x4831d7=_0x0c8f[_0x37c44f];return _0x4831d7;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0xf0c8('0x0'))['db'][_0xf0c8('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xf0c8('0x2')](0x0);var events={'afterCreate':_0xf0c8('0x3'),'afterUpdate':_0xf0c8('0x4'),'afterDestroy':_0xf0c8('0x5')};function emitEvent(_0x29797d){return function(_0xa5591c,_0x54741a,_0x587772){WhatsappAccountEvents['emit'](_0x29797d+':'+_0xa5591c['id'],_0xa5591c);WhatsappAccountEvents[_0xf0c8('0x6')](_0x29797d,_0xa5591c);_0x587772(null);};}for(var e in events){if(events[_0xf0c8('0x7')](e)){var event=events[e];WhatsappAccount[_0xf0c8('0x8')](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file +var _0x18a6=['remove','emit','hasOwnProperty','hook','exports','../../mysqldb','WhatsappAccount','setMaxListeners','save','update'];(function(_0x5698a9,_0x4ae7c7){var _0x3be696=function(_0x396896){while(--_0x396896){_0x5698a9['push'](_0x5698a9['shift']());}};_0x3be696(++_0x4ae7c7);}(_0x18a6,0x1a9));var _0x618a=function(_0x1bc82f,_0x34e9b6){_0x1bc82f=_0x1bc82f-0x0;var _0x578790=_0x18a6[_0x1bc82f];return _0x578790;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0x618a('0x0'))['db'][_0x618a('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x618a('0x2')](0x0);var events={'afterCreate':_0x618a('0x3'),'afterUpdate':_0x618a('0x4'),'afterDestroy':_0x618a('0x5')};function emitEvent(_0x28c1e3){return function(_0x282f9e,_0x7a0864,_0x3908e4){WhatsappAccountEvents[_0x618a('0x6')](_0x28c1e3+':'+_0x282f9e['id'],_0x282f9e);WhatsappAccountEvents[_0x618a('0x6')](_0x28c1e3,_0x282f9e);_0x3908e4(null);};}for(var e in events){if(events[_0x618a('0x7')](e)){var event=events[e];WhatsappAccount[_0x618a('0x8')](e,emitEvent(event));}}module[_0x618a('0x9')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index be3aad1..8d1b8d7 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 _0xf9a2=['moment','request-promise','path','rimraf','./whatsappAccount.attributes','exports','define','WhatsappAccount','lodash'];(function(_0x3e3bee,_0x4f91fe){var _0x3ae14c=function(_0x3861a0){while(--_0x3861a0){_0x3e3bee['push'](_0x3e3bee['shift']());}};_0x3ae14c(++_0x4f91fe);}(_0xf9a2,0x1b8));var _0x2f9a=function(_0x2c1092,_0x3f25f8){_0x2c1092=_0x2c1092-0x0;var _0xdcb486=_0xf9a2[_0x2c1092];return _0xdcb486;};'use strict';var _=require(_0x2f9a('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x2f9a('0x1'));var BPromise=require('bluebird');var rp=require(_0x2f9a('0x2'));var fs=require('fs');var path=require(_0x2f9a('0x3'));var rimraf=require(_0x2f9a('0x4'));var config=require('../../config/environment');var attributes=require(_0x2f9a('0x5'));module[_0x2f9a('0x6')]=function(_0x4743b5,_0x2f4f4d){return _0x4743b5[_0x2f9a('0x7')](_0x2f9a('0x8'),attributes,{'tableName':'whatsapp_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7be7=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts','lodash','util'];(function(_0x25e084,_0x1cda03){var _0x2adcf0=function(_0x5c1267){while(--_0x5c1267){_0x25e084['push'](_0x25e084['shift']());}};_0x2adcf0(++_0x1cda03);}(_0x7be7,0x1b1));var _0x77be=function(_0x3c9f05,_0xeaf904){_0x3c9f05=_0x3c9f05-0x0;var _0x156dee=_0x7be7[_0x3c9f05];return _0x156dee;};'use strict';var _=require(_0x77be('0x0'));var util=require(_0x77be('0x1'));var logger=require(_0x77be('0x2'))(_0x77be('0x3'));var moment=require(_0x77be('0x4'));var BPromise=require(_0x77be('0x5'));var rp=require(_0x77be('0x6'));var fs=require('fs');var path=require(_0x77be('0x7'));var rimraf=require(_0x77be('0x8'));var config=require(_0x77be('0x9'));var attributes=require(_0x77be('0xa'));module[_0x77be('0xb')]=function(_0x33394b,_0x10fa91){return _0x33394b[_0x77be('0xc')](_0x77be('0xd'),attributes,{'tableName':_0x77be('0xe'),'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 9987e46..c6cccfd 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 _0x119c=['WhatsappAccount','find','options','raw','where','include','map','attributes','model','then','stringify','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','request','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','message','ShowWhatsappAccount'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x119c,0xea));var _0xc119=function(_0x163cd0,_0x461c03){_0x163cd0=_0x163cd0-0x0;var _0x166213=_0x119c[_0x163cd0];return _0x166213;};'use strict';var _=require('lodash');var util=require(_0xc119('0x0'));var moment=require('moment');var BPromise=require(_0xc119('0x1'));var rs=require(_0xc119('0x2'));var fs=require('fs');var Redis=require(_0xc119('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc119('0x4'));var logger=require(_0xc119('0x5'))(_0xc119('0x6'));var config=require('../../config/environment');var jayson=require(_0xc119('0x7'));var client=jayson['client'][_0xc119('0x8')]({'port':0x232a});config['redis']=_[_0xc119('0x9')](config[_0xc119('0xa')],{'host':_0xc119('0xb'),'port':0x18eb});var socket=require(_0xc119('0xc'))(new Redis(config[_0xc119('0xa')]));require(_0xc119('0xd'))[_0xc119('0xe')](socket);function respondWithRpcPromise(_0x3a5827,_0x3222dc,_0x2e2b7f){return new BPromise(function(_0x245dc9,_0x511bb0){return client[_0xc119('0xf')](_0x3a5827,_0x2e2b7f)['then'](function(_0x3c29d2){logger[_0xc119('0x10')](_0xc119('0x11'),_0x3222dc,_0xc119('0x12'));logger[_0xc119('0x13')](_0xc119('0x14'),_0x3222dc,'request\x20sent',JSON['stringify'](_0x3c29d2));if(_0x3c29d2[_0xc119('0x15')]){if(_0x3c29d2[_0xc119('0x15')][_0xc119('0x16')]===0x1f4){logger[_0xc119('0x15')](_0xc119('0x11'),_0x3222dc,_0x3c29d2['error'][_0xc119('0x17')]);return _0x511bb0(_0x3c29d2['error'][_0xc119('0x17')]);}logger[_0xc119('0x15')](_0xc119('0x11'),_0x3222dc,_0x3c29d2[_0xc119('0x15')][_0xc119('0x17')]);return _0x245dc9(_0x3c29d2[_0xc119('0x15')][_0xc119('0x17')]);}else{logger[_0xc119('0x10')](_0xc119('0x11'),_0x3222dc,_0xc119('0x12'));_0x245dc9(_0x3c29d2['result'][_0xc119('0x17')]);}})['catch'](function(_0x29755e){logger[_0xc119('0x15')]('WhatsappAccount,\x20%s,\x20%s',_0x3222dc,_0x29755e);_0x511bb0(_0x29755e);});});}exports[_0xc119('0x18')]=function(_0x44565d){var _0x342b98=this;return new Promise(function(_0x45fb54,_0x2bf21d){return db[_0xc119('0x19')][_0xc119('0x1a')]({'raw':_0x44565d[_0xc119('0x1b')]?_0x44565d['options'][_0xc119('0x1c')]===undefined?!![]:![]:!![],'where':_0x44565d['options']?_0x44565d[_0xc119('0x1b')][_0xc119('0x1d')]||null:null,'attributes':_0x44565d[_0xc119('0x1b')]?_0x44565d[_0xc119('0x1b')]['attributes']||null:null,'include':_0x44565d[_0xc119('0x1b')]?_0x44565d[_0xc119('0x1b')][_0xc119('0x1e')]?_[_0xc119('0x1f')](_0x44565d[_0xc119('0x1b')][_0xc119('0x1e')],function(_0x38da8e){return{'model':db[_0x38da8e['model']],'as':_0x38da8e['as'],'attributes':_0x38da8e[_0xc119('0x20')],'include':_0x38da8e['include']?_['map'](_0x38da8e[_0xc119('0x1e')],function(_0x4c20da){return{'model':db[_0x4c20da[_0xc119('0x21')]],'as':_0x4c20da['as'],'attributes':_0x4c20da[_0xc119('0x20')],'include':_0x4c20da['include']?_['map'](_0x4c20da[_0xc119('0x1e')],function(_0xfa620b){return{'model':db[_0xfa620b[_0xc119('0x21')]],'as':_0xfa620b['as'],'attributes':_0xfa620b[_0xc119('0x20')]};}):[]};}):[]};}):[]:[]})[_0xc119('0x22')](function(_0x2e87d8){logger['info'](_0xc119('0x18'),_0x44565d);logger['debug'](_0xc119('0x18'),_0x44565d,JSON[_0xc119('0x23')](_0x2e87d8));_0x45fb54(_0x2e87d8);})[_0xc119('0x24')](function(_0x4bcda7){logger['error'](_0xc119('0x18'),_0x4bcda7[_0xc119('0x17')],_0x44565d);_0x2bf21d(_0x342b98[_0xc119('0x15')](0x1f4,_0x4bcda7[_0xc119('0x17')]));});});}; \ No newline at end of file +var _0xde69=['WhatsappAccount','find','raw','options','where','include','map','model','attributes','info','ShowWhatsappAccount','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','./whatsappAccount.socket','request','then','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','result','catch'];(function(_0x3c00b1,_0x2142e1){var _0x5618e0=function(_0x2da28b){while(--_0x2da28b){_0x3c00b1['push'](_0x3c00b1['shift']());}};_0x5618e0(++_0x2142e1);}(_0xde69,0x187));var _0x9de6=function(_0xbb6da2,_0x24614b){_0xbb6da2=_0xbb6da2-0x0;var _0x2a84f5=_0xde69[_0xbb6da2];return _0x2a84f5;};'use strict';var _=require(_0x9de6('0x0'));var util=require('util');var moment=require(_0x9de6('0x1'));var BPromise=require(_0x9de6('0x2'));var rs=require(_0x9de6('0x3'));var fs=require('fs');var Redis=require(_0x9de6('0x4'));var db=require(_0x9de6('0x5'))['db'];var utils=require(_0x9de6('0x6'));var logger=require(_0x9de6('0x7'))('rpc');var config=require(_0x9de6('0x8'));var jayson=require(_0x9de6('0x9'));var client=jayson[_0x9de6('0xa')][_0x9de6('0xb')]({'port':0x232a});config[_0x9de6('0xc')]=_[_0x9de6('0xd')](config[_0x9de6('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9de6('0xc')]));require(_0x9de6('0xe'))['register'](socket);function respondWithRpcPromise(_0x421838,_0xc5053b,_0x46c7ad){return new BPromise(function(_0x4e4411,_0x202dd0){return client[_0x9de6('0xf')](_0x421838,_0x46c7ad)[_0x9de6('0x10')](function(_0x2dbc59){logger['info']('WhatsappAccount,\x20%s,\x20%s',_0xc5053b,_0x9de6('0x11'));logger[_0x9de6('0x12')](_0x9de6('0x13'),_0xc5053b,_0x9de6('0x11'),JSON[_0x9de6('0x14')](_0x2dbc59));if(_0x2dbc59[_0x9de6('0x15')]){if(_0x2dbc59[_0x9de6('0x15')][_0x9de6('0x16')]===0x1f4){logger['error'](_0x9de6('0x17'),_0xc5053b,_0x2dbc59[_0x9de6('0x15')]['message']);return _0x202dd0(_0x2dbc59[_0x9de6('0x15')]['message']);}logger[_0x9de6('0x15')]('WhatsappAccount,\x20%s,\x20%s',_0xc5053b,_0x2dbc59['error'][_0x9de6('0x18')]);return _0x4e4411(_0x2dbc59[_0x9de6('0x15')]['message']);}else{logger['info'](_0x9de6('0x17'),_0xc5053b,_0x9de6('0x11'));_0x4e4411(_0x2dbc59[_0x9de6('0x19')][_0x9de6('0x18')]);}})[_0x9de6('0x1a')](function(_0x2d123a){logger[_0x9de6('0x15')](_0x9de6('0x17'),_0xc5053b,_0x2d123a);_0x202dd0(_0x2d123a);});});}exports['ShowWhatsappAccount']=function(_0x4e8824){var _0x44c42e=this;return new Promise(function(_0x994ee0,_0x531ed8){return db[_0x9de6('0x1b')][_0x9de6('0x1c')]({'raw':_0x4e8824['options']?_0x4e8824['options'][_0x9de6('0x1d')]===undefined?!![]:![]:!![],'where':_0x4e8824[_0x9de6('0x1e')]?_0x4e8824['options'][_0x9de6('0x1f')]||null:null,'attributes':_0x4e8824[_0x9de6('0x1e')]?_0x4e8824[_0x9de6('0x1e')]['attributes']||null:null,'include':_0x4e8824[_0x9de6('0x1e')]?_0x4e8824['options'][_0x9de6('0x20')]?_[_0x9de6('0x21')](_0x4e8824[_0x9de6('0x1e')]['include'],function(_0x3f7fd1){return{'model':db[_0x3f7fd1[_0x9de6('0x22')]],'as':_0x3f7fd1['as'],'attributes':_0x3f7fd1[_0x9de6('0x23')],'include':_0x3f7fd1[_0x9de6('0x20')]?_['map'](_0x3f7fd1[_0x9de6('0x20')],function(_0x5da1b6){return{'model':db[_0x5da1b6[_0x9de6('0x22')]],'as':_0x5da1b6['as'],'attributes':_0x5da1b6[_0x9de6('0x23')],'include':_0x5da1b6[_0x9de6('0x20')]?_[_0x9de6('0x21')](_0x5da1b6[_0x9de6('0x20')],function(_0x26eb6e){return{'model':db[_0x26eb6e[_0x9de6('0x22')]],'as':_0x26eb6e['as'],'attributes':_0x26eb6e[_0x9de6('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x7f4f49){logger[_0x9de6('0x24')](_0x9de6('0x25'),_0x4e8824);logger[_0x9de6('0x12')](_0x9de6('0x25'),_0x4e8824,JSON['stringify'](_0x7f4f49));_0x994ee0(_0x7f4f49);})[_0x9de6('0x1a')](function(_0x3e60fe){logger['error'](_0x9de6('0x25'),_0x3e60fe[_0x9de6('0x18')],_0x4e8824);_0x531ed8(_0x44c42e[_0x9de6('0x15')](0x1f4,_0x3e60fe[_0x9de6('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 1743a19..ca5e426 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 _0x4104=['whatsappAccount:','./whatsappAccount.events','save','update','emit','register'];(function(_0x5a6496,_0x275f63){var _0x44abf6=function(_0x484978){while(--_0x484978){_0x5a6496['push'](_0x5a6496['shift']());}};_0x44abf6(++_0x275f63);}(_0x4104,0x85));var _0x4410=function(_0x5cc3d4,_0xbcbf9b){_0x5cc3d4=_0x5cc3d4-0x0;var _0x17ca31=_0x4104[_0x5cc3d4];return _0x17ca31;};'use strict';var WhatsappAccountEvents=require(_0x4410('0x0'));var events=[_0x4410('0x1'),'remove',_0x4410('0x2')];function createListener(_0x38ebfd,_0xf661e8){return function(_0x12b090){_0xf661e8[_0x4410('0x3')](_0x38ebfd,_0x12b090);};}function removeListener(_0xb7b6f5,_0x7c2b4){return function(){WhatsappAccountEvents['removeListener'](_0xb7b6f5,_0x7c2b4);};}exports[_0x4410('0x4')]=function(_0x4fe1cb){for(var _0x5a05f6=0x0,_0x4f9611=events['length'];_0x5a05f6<_0x4f9611;_0x5a05f6++){var _0x4e8d6f=events[_0x5a05f6];var _0x523e00=createListener(_0x4410('0x5')+_0x4e8d6f,_0x4fe1cb);WhatsappAccountEvents['on'](_0x4e8d6f,_0x523e00);}}; \ No newline at end of file +var _0x48df=['whatsappAccount:','./whatsappAccount.events','remove','update','emit','removeListener','register','length'];(function(_0x3dc9d2,_0x43dae3){var _0xd4789=function(_0x551869){while(--_0x551869){_0x3dc9d2['push'](_0x3dc9d2['shift']());}};_0xd4789(++_0x43dae3);}(_0x48df,0x109));var _0xf48d=function(_0x40ebff,_0x1dd15e){_0x40ebff=_0x40ebff-0x0;var _0x40122a=_0x48df[_0x40ebff];return _0x40122a;};'use strict';var WhatsappAccountEvents=require(_0xf48d('0x0'));var events=['save',_0xf48d('0x1'),_0xf48d('0x2')];function createListener(_0x4b9a1d,_0x3c35b2){return function(_0x8c03b1){_0x3c35b2[_0xf48d('0x3')](_0x4b9a1d,_0x8c03b1);};}function removeListener(_0xf07552,_0x3d8e71){return function(){WhatsappAccountEvents[_0xf48d('0x4')](_0xf07552,_0x3d8e71);};}exports[_0xf48d('0x5')]=function(_0x5ca3cb){for(var _0x32d51a=0x0,_0xe829d9=events[_0xf48d('0x6')];_0x32d51a<_0xe829d9;_0x32d51a++){var _0x34e3f3=events[_0x32d51a];var _0x32a15=createListener(_0xf48d('0x7')+_0x34e3f3,_0x5ca3cb);WhatsappAccountEvents['on'](_0x34e3f3,_0x32a15);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 03b0770..01c9029 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 _0x3aa1=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','show','post','put','update','delete','/:id','destroy','exports','multer'];(function(_0x2a8b3b,_0x5efd92){var _0x546b6c=function(_0x38f46a){while(--_0x38f46a){_0x2a8b3b['push'](_0x2a8b3b['shift']());}};_0x546b6c(++_0x5efd92);}(_0x3aa1,0xfb));var _0x13aa=function(_0x141fd6,_0x37b1ac){_0x141fd6=_0x141fd6-0x0;var _0x254d27=_0x3aa1[_0x141fd6];return _0x254d27;};'use strict';var multer=require(_0x13aa('0x0'));var util=require(_0x13aa('0x1'));var path=require(_0x13aa('0x2'));var timeout=require(_0x13aa('0x3'));var express=require(_0x13aa('0x4'));var router=express[_0x13aa('0x5')]();var fs_extra=require(_0x13aa('0x6'));var auth=require(_0x13aa('0x7'));var interaction=require(_0x13aa('0x8'));var config=require(_0x13aa('0x9'));var controller=require(_0x13aa('0xa'));router[_0x13aa('0xb')]('/',auth[_0x13aa('0xc')](),controller['index']);router[_0x13aa('0xb')]('/:id',auth[_0x13aa('0xc')](),controller[_0x13aa('0xd')]);router[_0x13aa('0xe')]('/',auth[_0x13aa('0xc')](),controller['create']);router[_0x13aa('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x13aa('0x10')]);router[_0x13aa('0x11')](_0x13aa('0x12'),auth[_0x13aa('0xc')](),controller[_0x13aa('0x13')]);module[_0x13aa('0x14')]=router; \ No newline at end of file +var _0x4e66=['express','Router','fs-extra','isAuthenticated','get','/:id','show','post','create','put','update','delete','destroy','exports','multer','path'];(function(_0x22049c,_0x344afe){var _0x2c4fda=function(_0xef759f){while(--_0xef759f){_0x22049c['push'](_0x22049c['shift']());}};_0x2c4fda(++_0x344afe);}(_0x4e66,0xbe));var _0x64e6=function(_0x24ca28,_0x3417fe){_0x24ca28=_0x24ca28-0x0;var _0x26d6ea=_0x4e66[_0x24ca28];return _0x26d6ea;};'use strict';var multer=require(_0x64e6('0x0'));var util=require('util');var path=require(_0x64e6('0x1'));var timeout=require('connect-timeout');var express=require(_0x64e6('0x2'));var router=express[_0x64e6('0x3')]();var fs_extra=require(_0x64e6('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./whatsappApplication.controller');router['get']('/',auth[_0x64e6('0x5')](),controller['index']);router[_0x64e6('0x6')](_0x64e6('0x7'),auth[_0x64e6('0x5')](),controller[_0x64e6('0x8')]);router[_0x64e6('0x9')]('/',auth[_0x64e6('0x5')](),controller[_0x64e6('0xa')]);router[_0x64e6('0xb')](_0x64e6('0x7'),auth['isAuthenticated'](),controller[_0x64e6('0xc')]);router[_0x64e6('0xd')](_0x64e6('0x7'),auth[_0x64e6('0x5')](),controller[_0x64e6('0xe')]);module[_0x64e6('0xf')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 52f793f..c7c2f80 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 _0x1927=['TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING','noop'];(function(_0x2d34d6,_0x397ff9){var _0x1d3d12=function(_0x558800){while(--_0x558800){_0x2d34d6['push'](_0x2d34d6['shift']());}};_0x1d3d12(++_0x397ff9);}(_0x1927,0x144));var _0x7192=function(_0x1ad790,_0x2ac345){_0x1ad790=_0x1ad790-0x0;var _0x2f3f9b=_0x1927[_0x1ad790];return _0x2f3f9b;};'use strict';var Sequelize=require(_0x7192('0x0'));module[_0x7192('0x1')]={'priority':{'type':Sequelize[_0x7192('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x7192('0x3')],'allowNull':![],'defaultValue':_0x7192('0x4')},'appdata':{'type':Sequelize[_0x7192('0x5')]()},'description':{'type':Sequelize[_0x7192('0x3')]},'interval':{'type':Sequelize[_0x7192('0x3')],'defaultValue':_0x7192('0x6')}}; \ No newline at end of file +var _0x8abf=['STRING','TEXT','*,*,*,*','sequelize','exports'];(function(_0x378024,_0x2c4ab8){var _0x34b940=function(_0x44810d){while(--_0x44810d){_0x378024['push'](_0x378024['shift']());}};_0x34b940(++_0x2c4ab8);}(_0x8abf,0x9e));var _0xf8ab=function(_0x622420,_0x6cd24c){_0x622420=_0x622420-0x0;var _0x404039=_0x8abf[_0x622420];return _0x404039;};'use strict';var Sequelize=require(_0xf8ab('0x0'));module[_0xf8ab('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xf8ab('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xf8ab('0x3')]()},'description':{'type':Sequelize[_0xf8ab('0x2')]},'interval':{'type':Sequelize[_0xf8ab('0x2')],'defaultValue':_0xf8ab('0x4')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 3ff5ee1..abe3f24 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 _0x6fc2=['papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','reject','update','then','error','stack','name','send','index','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','options','includeAll','include','WhatsappApplication','findAll','rows','catch','show','params','rawAttributes','find','create','body','destroy','eml-format','rimraf','zip-dir','request-promise','moment','path','sox','ejs','fs-extra','lodash','squel','jsforce','querystring'];(function(_0x48b810,_0x173a5e){var _0x23c17d=function(_0x38531e){while(--_0x38531e){_0x48b810['push'](_0x48b810['shift']());}};_0x23c17d(++_0x173a5e);}(_0x6fc2,0x117));var _0x26fc=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0x6fc2[_0x2112d4];return _0x434972;};'use strict';var emlformat=require(_0x26fc('0x0'));var rimraf=require(_0x26fc('0x1'));var zipdir=require(_0x26fc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x26fc('0x3'));var moment=require(_0x26fc('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x26fc('0x5'));var sox=require(_0x26fc('0x6'));var csv=require('to-csv');var ejs=require(_0x26fc('0x7'));var fs=require('fs');var fs_extra=require(_0x26fc('0x8'));var _=require(_0x26fc('0x9'));var squel=require(_0x26fc('0xa'));var crypto=require('crypto');var jsforce=require(_0x26fc('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x26fc('0xc'));var Papa=require(_0x26fc('0xd'));var Redis=require(_0x26fc('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x26fc('0xf'));var as=require(_0x26fc('0x10'));var hardwareService=require(_0x26fc('0x11'));var logger=require(_0x26fc('0x12'))(_0x26fc('0x13'));var utils=require(_0x26fc('0x14'));var config=require(_0x26fc('0x15'));var licenseUtil=require(_0x26fc('0x16'));var db=require(_0x26fc('0x17'))['db'];function respondWithStatusCode(_0x40fff4,_0x42b440){_0x42b440=_0x42b440||0xcc;return function(_0x2d837e){if(_0x2d837e){return _0x40fff4[_0x26fc('0x18')](_0x42b440);}return _0x40fff4[_0x26fc('0x19')](_0x42b440)[_0x26fc('0x1a')]();};}function respondWithResult(_0x178667,_0x5a3622){_0x5a3622=_0x5a3622||0xc8;return function(_0x35b1f2){if(_0x35b1f2){return _0x178667[_0x26fc('0x19')](_0x5a3622)[_0x26fc('0x1b')](_0x35b1f2);}};}function respondWithFilteredResult(_0x405139,_0x41d50a){return function(_0x29afb9){if(_0x29afb9){var _0x1e42de=typeof _0x41d50a[_0x26fc('0x1c')]===_0x26fc('0x1d')&&typeof _0x41d50a['limit']===_0x26fc('0x1d');var _0x56b4e7=_0x29afb9[_0x26fc('0x1e')];var _0x3507b1=_0x1e42de?0x0:_0x41d50a[_0x26fc('0x1c')];var _0x3b3a92=_0x1e42de?_0x29afb9['count']:_0x41d50a[_0x26fc('0x1c')]+_0x41d50a[_0x26fc('0x1f')];var _0x1c00ae;if(_0x3b3a92>=_0x56b4e7){_0x3b3a92=_0x56b4e7;_0x1c00ae=0xc8;}else{_0x1c00ae=0xce;}_0x405139[_0x26fc('0x19')](_0x1c00ae);return _0x405139[_0x26fc('0x20')]('Content-Range',_0x3507b1+'-'+_0x3b3a92+'/'+_0x56b4e7)['json'](_0x29afb9);}return null;};}function patchUpdates(_0x5c10c6){return function(_0x4a7eb4){try{jsonpatch['apply'](_0x4a7eb4,_0x5c10c6,!![]);}catch(_0x4fa549){return BPromise[_0x26fc('0x21')](_0x4fa549);}return _0x4a7eb4['save']();};}function saveUpdates(_0x2fb061,_0x1b05d1){return function(_0x562c00){if(_0x562c00){return _0x562c00[_0x26fc('0x22')](_0x2fb061)[_0x26fc('0x23')](function(_0x12a7ca){return _0x12a7ca;});}return null;};}function removeEntity(_0x1641f2,_0x2738ee){return function(_0x208bc7){if(_0x208bc7){return _0x208bc7['destroy']()[_0x26fc('0x23')](function(){_0x1641f2[_0x26fc('0x19')](0xcc)[_0x26fc('0x1a')]();});}};}function handleEntityNotFound(_0x3e51fc,_0x281511){return function(_0x3be613){if(!_0x3be613){_0x3e51fc[_0x26fc('0x18')](0x194);}return _0x3be613;};}function handleError(_0x5b9dba,_0x3c5dcc){_0x3c5dcc=_0x3c5dcc||0x1f4;return function(_0x2fc858){logger[_0x26fc('0x24')](_0x2fc858[_0x26fc('0x25')]);if(_0x2fc858[_0x26fc('0x26')]){delete _0x2fc858[_0x26fc('0x26')];}_0x5b9dba['status'](_0x3c5dcc)[_0x26fc('0x27')](_0x2fc858);};}exports[_0x26fc('0x28')]=function(_0x3bff70,_0x32088c){var _0x2bde13={},_0x14ecff={},_0x15dd79={'count':0x0,'rows':[]};var _0xbfc2b2=_['map'](db['WhatsappApplication']['rawAttributes'],function(_0x297e53){return{'name':_0x297e53['fieldName'],'type':_0x297e53['type'][_0x26fc('0x29')]};});_0x14ecff[_0x26fc('0x2a')]=_[_0x26fc('0x2b')](_0xbfc2b2,_0x26fc('0x26'));_0x14ecff[_0x26fc('0x2c')]=_[_0x26fc('0x2d')](_0x3bff70[_0x26fc('0x2c')]);_0x14ecff[_0x26fc('0x2e')]=_[_0x26fc('0x2f')](_0x14ecff[_0x26fc('0x2a')],_0x14ecff['query']);_0x2bde13[_0x26fc('0x30')]=_[_0x26fc('0x2f')](_0x14ecff[_0x26fc('0x2a')],qs[_0x26fc('0x31')](_0x3bff70[_0x26fc('0x2c')][_0x26fc('0x31')]));_0x2bde13[_0x26fc('0x30')]=_0x2bde13['attributes'][_0x26fc('0x32')]?_0x2bde13['attributes']:_0x14ecff[_0x26fc('0x2a')];if(!_0x3bff70[_0x26fc('0x2c')][_0x26fc('0x33')](_0x26fc('0x34'))){_0x2bde13[_0x26fc('0x1f')]=qs['limit'](_0x3bff70[_0x26fc('0x2c')][_0x26fc('0x1f')]);_0x2bde13['offset']=qs[_0x26fc('0x1c')](_0x3bff70['query'][_0x26fc('0x1c')]);}_0x2bde13[_0x26fc('0x35')]=qs[_0x26fc('0x36')](_0x3bff70[_0x26fc('0x2c')][_0x26fc('0x36')]);_0x2bde13[_0x26fc('0x37')]=qs['filters'](_['pick'](_0x3bff70[_0x26fc('0x2c')],_0x14ecff[_0x26fc('0x2e')]),_0xbfc2b2);if(_0x3bff70[_0x26fc('0x2c')][_0x26fc('0x38')]){_0x2bde13['where']=_[_0x26fc('0x39')](_0x2bde13[_0x26fc('0x37')],{'$or':_['map'](_0xbfc2b2,function(_0x3d110b){if(_0x3d110b[_0x26fc('0x3a')]!=='VIRTUAL'){var _0x53836={};_0x53836[_0x3d110b[_0x26fc('0x26')]]={'$like':'%'+_0x3bff70[_0x26fc('0x2c')]['filter']+'%'};return _0x53836;}})});}_0x2bde13=_[_0x26fc('0x39')]({},_0x2bde13,_0x3bff70[_0x26fc('0x3b')]);var _0x4e2c58={'where':_0x2bde13[_0x26fc('0x37')]};return db['WhatsappApplication'][_0x26fc('0x1e')](_0x4e2c58)[_0x26fc('0x23')](function(_0x2494ce){_0x15dd79[_0x26fc('0x1e')]=_0x2494ce;if(_0x3bff70[_0x26fc('0x2c')][_0x26fc('0x3c')]){_0x2bde13[_0x26fc('0x3d')]=[{'all':!![]}];}return db[_0x26fc('0x3e')][_0x26fc('0x3f')](_0x2bde13);})[_0x26fc('0x23')](function(_0x3c287d){_0x15dd79[_0x26fc('0x40')]=_0x3c287d;return _0x15dd79;})['then'](respondWithFilteredResult(_0x32088c,_0x2bde13))[_0x26fc('0x41')](handleError(_0x32088c,null));};exports[_0x26fc('0x42')]=function(_0x164aff,_0x469b2d){var _0x118b2f={'raw':!![],'where':{'id':_0x164aff[_0x26fc('0x43')]['id']}},_0x3b1b58={};_0x3b1b58['model']=_['keys'](db[_0x26fc('0x3e')][_0x26fc('0x44')]);_0x3b1b58['query']=_[_0x26fc('0x2d')](_0x164aff[_0x26fc('0x2c')]);_0x3b1b58[_0x26fc('0x2e')]=_['intersection'](_0x3b1b58[_0x26fc('0x2a')],_0x3b1b58[_0x26fc('0x2c')]);_0x118b2f[_0x26fc('0x30')]=_[_0x26fc('0x2f')](_0x3b1b58[_0x26fc('0x2a')],qs[_0x26fc('0x31')](_0x164aff[_0x26fc('0x2c')][_0x26fc('0x31')]));_0x118b2f[_0x26fc('0x30')]=_0x118b2f[_0x26fc('0x30')][_0x26fc('0x32')]?_0x118b2f['attributes']:_0x3b1b58[_0x26fc('0x2a')];if(_0x164aff[_0x26fc('0x2c')]['includeAll']){_0x118b2f[_0x26fc('0x3d')]=[{'all':!![]}];}_0x118b2f=_[_0x26fc('0x39')]({},_0x118b2f,_0x164aff[_0x26fc('0x3b')]);return db['WhatsappApplication'][_0x26fc('0x45')](_0x118b2f)[_0x26fc('0x23')](handleEntityNotFound(_0x469b2d,null))[_0x26fc('0x23')](respondWithResult(_0x469b2d,null))[_0x26fc('0x41')](handleError(_0x469b2d,null));};exports[_0x26fc('0x46')]=function(_0x4848b5,_0x1c4791){return db[_0x26fc('0x3e')]['create'](_0x4848b5[_0x26fc('0x47')],{})[_0x26fc('0x23')](respondWithResult(_0x1c4791,0xc9))[_0x26fc('0x41')](handleError(_0x1c4791,null));};exports['update']=function(_0xa10474,_0x7c4eaa){if(_0xa10474[_0x26fc('0x47')]['id']){delete _0xa10474['body']['id'];}return db['WhatsappApplication'][_0x26fc('0x45')]({'where':{'id':_0xa10474[_0x26fc('0x43')]['id']}})[_0x26fc('0x23')](handleEntityNotFound(_0x7c4eaa,null))[_0x26fc('0x23')](saveUpdates(_0xa10474[_0x26fc('0x47')],null))['then'](respondWithResult(_0x7c4eaa,null))['catch'](handleError(_0x7c4eaa,null));};exports[_0x26fc('0x48')]=function(_0x4e353a,_0x55368a){return db[_0x26fc('0x3e')][_0x26fc('0x45')]({'where':{'id':_0x4e353a[_0x26fc('0x43')]['id']}})[_0x26fc('0x23')](handleEntityNotFound(_0x55368a,null))[_0x26fc('0x23')](removeEntity(_0x55368a,null))[_0x26fc('0x41')](handleError(_0x55368a,null));}; \ No newline at end of file +var _0x7d37=['set','Content-Range','apply','reject','update','then','error','stack','name','send','index','map','WhatsappApplication','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','type','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','rawAttributes','keys','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','fs-extra','squel','crypto','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit'];(function(_0xea25a6,_0x3ab5af){var _0x5f0b7f=function(_0x3435c6){while(--_0x3435c6){_0xea25a6['push'](_0xea25a6['shift']());}};_0x5f0b7f(++_0x3ab5af);}(_0x7d37,0x1db));var _0x77d3=function(_0x4c82b3,_0x532ad){_0x4c82b3=_0x4c82b3-0x0;var _0xd68134=_0x7d37[_0x4c82b3];return _0xd68134;};'use strict';var emlformat=require(_0x77d3('0x0'));var rimraf=require(_0x77d3('0x1'));var zipdir=require(_0x77d3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x77d3('0x3'));var moment=require(_0x77d3('0x4'));var BPromise=require(_0x77d3('0x5'));var Mustache=require('mustache');var util=require(_0x77d3('0x6'));var path=require(_0x77d3('0x7'));var sox=require('sox');var csv=require(_0x77d3('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x77d3('0x9'));var _=require('lodash');var squel=require(_0x77d3('0xa'));var crypto=require(_0x77d3('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x77d3('0x8'));var querystring=require(_0x77d3('0xc'));var Papa=require('papaparse');var Redis=require(_0x77d3('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x77d3('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x77d3('0xf'));var logger=require('../../config/logger')(_0x77d3('0x10'));var utils=require(_0x77d3('0x11'));var config=require(_0x77d3('0x12'));var licenseUtil=require(_0x77d3('0x13'));var db=require(_0x77d3('0x14'))['db'];function respondWithStatusCode(_0xe69786,_0x34446e){_0x34446e=_0x34446e||0xcc;return function(_0x136304){if(_0x136304){return _0xe69786[_0x77d3('0x15')](_0x34446e);}return _0xe69786['status'](_0x34446e)[_0x77d3('0x16')]();};}function respondWithResult(_0x4a621e,_0x4f40fb){_0x4f40fb=_0x4f40fb||0xc8;return function(_0x5a9cdb){if(_0x5a9cdb){return _0x4a621e[_0x77d3('0x17')](_0x4f40fb)[_0x77d3('0x18')](_0x5a9cdb);}};}function respondWithFilteredResult(_0x2c722b,_0xb17484){return function(_0x891f26){if(_0x891f26){var _0x4d98a4=typeof _0xb17484[_0x77d3('0x19')]===_0x77d3('0x1a')&&typeof _0xb17484['limit']==='undefined';var _0xfe320e=_0x891f26[_0x77d3('0x1b')];var _0x60173f=_0x4d98a4?0x0:_0xb17484[_0x77d3('0x19')];var _0x144656=_0x4d98a4?_0x891f26[_0x77d3('0x1b')]:_0xb17484[_0x77d3('0x19')]+_0xb17484[_0x77d3('0x1c')];var _0x3e7203;if(_0x144656>=_0xfe320e){_0x144656=_0xfe320e;_0x3e7203=0xc8;}else{_0x3e7203=0xce;}_0x2c722b[_0x77d3('0x17')](_0x3e7203);return _0x2c722b[_0x77d3('0x1d')](_0x77d3('0x1e'),_0x60173f+'-'+_0x144656+'/'+_0xfe320e)[_0x77d3('0x18')](_0x891f26);}return null;};}function patchUpdates(_0x1af8a4){return function(_0x4366b6){try{jsonpatch[_0x77d3('0x1f')](_0x4366b6,_0x1af8a4,!![]);}catch(_0xc9008d){return BPromise[_0x77d3('0x20')](_0xc9008d);}return _0x4366b6['save']();};}function saveUpdates(_0x2acc21,_0x17d3a3){return function(_0x1504c7){if(_0x1504c7){return _0x1504c7[_0x77d3('0x21')](_0x2acc21)[_0x77d3('0x22')](function(_0x1541c1){return _0x1541c1;});}return null;};}function removeEntity(_0x12c085,_0x17e9f9){return function(_0x2c0861){if(_0x2c0861){return _0x2c0861['destroy']()[_0x77d3('0x22')](function(){_0x12c085['status'](0xcc)[_0x77d3('0x16')]();});}};}function handleEntityNotFound(_0x443aa6,_0x1f03a3){return function(_0x2a02c8){if(!_0x2a02c8){_0x443aa6[_0x77d3('0x15')](0x194);}return _0x2a02c8;};}function handleError(_0x18eb30,_0x5481cd){_0x5481cd=_0x5481cd||0x1f4;return function(_0x17c6c6){logger[_0x77d3('0x23')](_0x17c6c6[_0x77d3('0x24')]);if(_0x17c6c6[_0x77d3('0x25')]){delete _0x17c6c6[_0x77d3('0x25')];}_0x18eb30[_0x77d3('0x17')](_0x5481cd)[_0x77d3('0x26')](_0x17c6c6);};}exports[_0x77d3('0x27')]=function(_0x275eb5,_0x41b79d){var _0x59c650={},_0x3add49={},_0x35d7d6={'count':0x0,'rows':[]};var _0x5809d2=_[_0x77d3('0x28')](db[_0x77d3('0x29')]['rawAttributes'],function(_0x524f89){return{'name':_0x524f89[_0x77d3('0x2a')],'type':_0x524f89['type'][_0x77d3('0x2b')]};});_0x3add49[_0x77d3('0x2c')]=_[_0x77d3('0x28')](_0x5809d2,'name');_0x3add49['query']=_['keys'](_0x275eb5[_0x77d3('0x2d')]);_0x3add49[_0x77d3('0x2e')]=_[_0x77d3('0x2f')](_0x3add49[_0x77d3('0x2c')],_0x3add49[_0x77d3('0x2d')]);_0x59c650[_0x77d3('0x30')]=_[_0x77d3('0x2f')](_0x3add49[_0x77d3('0x2c')],qs['fields'](_0x275eb5['query'][_0x77d3('0x31')]));_0x59c650[_0x77d3('0x30')]=_0x59c650['attributes'][_0x77d3('0x32')]?_0x59c650['attributes']:_0x3add49[_0x77d3('0x2c')];if(!_0x275eb5[_0x77d3('0x2d')][_0x77d3('0x33')](_0x77d3('0x34'))){_0x59c650[_0x77d3('0x1c')]=qs['limit'](_0x275eb5['query'][_0x77d3('0x1c')]);_0x59c650[_0x77d3('0x19')]=qs[_0x77d3('0x19')](_0x275eb5[_0x77d3('0x2d')][_0x77d3('0x19')]);}_0x59c650[_0x77d3('0x35')]=qs[_0x77d3('0x36')](_0x275eb5[_0x77d3('0x2d')][_0x77d3('0x36')]);_0x59c650[_0x77d3('0x37')]=qs['filters'](_['pick'](_0x275eb5[_0x77d3('0x2d')],_0x3add49['filters']),_0x5809d2);if(_0x275eb5[_0x77d3('0x2d')]['filter']){_0x59c650[_0x77d3('0x37')]=_['merge'](_0x59c650[_0x77d3('0x37')],{'$or':_[_0x77d3('0x28')](_0x5809d2,function(_0x578ddb){if(_0x578ddb[_0x77d3('0x38')]!==_0x77d3('0x39')){var _0x519e80={};_0x519e80[_0x578ddb[_0x77d3('0x25')]]={'$like':'%'+_0x275eb5[_0x77d3('0x2d')][_0x77d3('0x3a')]+'%'};return _0x519e80;}})});}_0x59c650=_[_0x77d3('0x3b')]({},_0x59c650,_0x275eb5[_0x77d3('0x3c')]);var _0x412cb5={'where':_0x59c650[_0x77d3('0x37')]};return db[_0x77d3('0x29')]['count'](_0x412cb5)[_0x77d3('0x22')](function(_0x2ca4eb){_0x35d7d6[_0x77d3('0x1b')]=_0x2ca4eb;if(_0x275eb5[_0x77d3('0x2d')][_0x77d3('0x3d')]){_0x59c650[_0x77d3('0x3e')]=[{'all':!![]}];}return db[_0x77d3('0x29')][_0x77d3('0x3f')](_0x59c650);})[_0x77d3('0x22')](function(_0x28223f){_0x35d7d6[_0x77d3('0x40')]=_0x28223f;return _0x35d7d6;})[_0x77d3('0x22')](respondWithFilteredResult(_0x41b79d,_0x59c650))[_0x77d3('0x41')](handleError(_0x41b79d,null));};exports[_0x77d3('0x42')]=function(_0x553215,_0x316441){var _0x37ea08={'raw':!![],'where':{'id':_0x553215['params']['id']}},_0x17fd69={};_0x17fd69['model']=_['keys'](db[_0x77d3('0x29')][_0x77d3('0x43')]);_0x17fd69[_0x77d3('0x2d')]=_[_0x77d3('0x44')](_0x553215[_0x77d3('0x2d')]);_0x17fd69[_0x77d3('0x2e')]=_['intersection'](_0x17fd69['model'],_0x17fd69[_0x77d3('0x2d')]);_0x37ea08[_0x77d3('0x30')]=_[_0x77d3('0x2f')](_0x17fd69['model'],qs['fields'](_0x553215[_0x77d3('0x2d')][_0x77d3('0x31')]));_0x37ea08['attributes']=_0x37ea08[_0x77d3('0x30')]['length']?_0x37ea08['attributes']:_0x17fd69[_0x77d3('0x2c')];if(_0x553215[_0x77d3('0x2d')][_0x77d3('0x3d')]){_0x37ea08[_0x77d3('0x3e')]=[{'all':!![]}];}_0x37ea08=_[_0x77d3('0x3b')]({},_0x37ea08,_0x553215[_0x77d3('0x3c')]);return db[_0x77d3('0x29')][_0x77d3('0x45')](_0x37ea08)['then'](handleEntityNotFound(_0x316441,null))[_0x77d3('0x22')](respondWithResult(_0x316441,null))[_0x77d3('0x41')](handleError(_0x316441,null));};exports[_0x77d3('0x46')]=function(_0x1e2d39,_0x42b113){return db[_0x77d3('0x29')][_0x77d3('0x46')](_0x1e2d39[_0x77d3('0x47')],{})[_0x77d3('0x22')](respondWithResult(_0x42b113,0xc9))[_0x77d3('0x41')](handleError(_0x42b113,null));};exports['update']=function(_0x1ff0d5,_0x37e2f7){if(_0x1ff0d5['body']['id']){delete _0x1ff0d5['body']['id'];}return db['WhatsappApplication'][_0x77d3('0x45')]({'where':{'id':_0x1ff0d5['params']['id']}})[_0x77d3('0x22')](handleEntityNotFound(_0x37e2f7,null))[_0x77d3('0x22')](saveUpdates(_0x1ff0d5[_0x77d3('0x47')],null))[_0x77d3('0x22')](respondWithResult(_0x37e2f7,null))[_0x77d3('0x41')](handleError(_0x37e2f7,null));};exports['destroy']=function(_0x1b8917,_0x514688){return db[_0x77d3('0x29')]['find']({'where':{'id':_0x1b8917['params']['id']}})[_0x77d3('0x22')](handleEntityNotFound(_0x514688,null))['then'](removeEntity(_0x514688,null))[_0x77d3('0x41')](handleError(_0x514688,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 7402123..15dcb41 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 _0x0689=['utf8mb4','utf8mb4_unicode_ci','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappApplication.attributes','exports','define'];(function(_0x5a08e0,_0x24a832){var _0x279aac=function(_0x16b271){while(--_0x16b271){_0x5a08e0['push'](_0x5a08e0['shift']());}};_0x279aac(++_0x24a832);}(_0x0689,0x161));var _0x9068=function(_0x12314f,_0x2ac7ae){_0x12314f=_0x12314f-0x0;var _0x3b6e61=_0x0689[_0x12314f];return _0x3b6e61;};'use strict';var _=require('lodash');var util=require(_0x9068('0x0'));var logger=require('../../config/logger')(_0x9068('0x1'));var moment=require(_0x9068('0x2'));var BPromise=require(_0x9068('0x3'));var rp=require(_0x9068('0x4'));var fs=require('fs');var path=require(_0x9068('0x5'));var rimraf=require(_0x9068('0x6'));var config=require(_0x9068('0x7'));var attributes=require(_0x9068('0x8'));module[_0x9068('0x9')]=function(_0x287846,_0x5ce5a7){return _0x287846[_0x9068('0xa')]('WhatsappApplication',attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9068('0xb'),'collate':_0x9068('0xc')});}; \ No newline at end of file +var _0x0c6d=['moment','bluebird','request-promise','rimraf','define','whatsapp_applications','utf8mb4_unicode_ci','util','../../config/logger','api'];(function(_0x1187cb,_0x3be9e2){var _0xe1f9bf=function(_0x2bd3d8){while(--_0x2bd3d8){_0x1187cb['push'](_0x1187cb['shift']());}};_0xe1f9bf(++_0x3be9e2);}(_0x0c6d,0xf7));var _0xd0c6=function(_0x731e54,_0x5efcc3){_0x731e54=_0x731e54-0x0;var _0x131a21=_0x0c6d[_0x731e54];return _0x131a21;};'use strict';var _=require('lodash');var util=require(_0xd0c6('0x0'));var logger=require(_0xd0c6('0x1'))(_0xd0c6('0x2'));var moment=require(_0xd0c6('0x3'));var BPromise=require(_0xd0c6('0x4'));var rp=require(_0xd0c6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd0c6('0x6'));var config=require('../../config/environment');var attributes=require('./whatsappApplication.attributes');module['exports']=function(_0x2b4c40,_0x41f475){return _0x2b4c40[_0xd0c6('0x7')]('WhatsappApplication',attributes,{'tableName':_0xd0c6('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xd0c6('0x9')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index c77f9c4..f99b295 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 _0x33c5=['then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x33c5,0xe6));var _0x533c=function(_0x4c1eec,_0x515aa1){_0x4c1eec=_0x4c1eec-0x0;var _0x5d8475=_0x33c5[_0x4c1eec];return _0x5d8475;};'use strict';var _=require('lodash');var util=require(_0x533c('0x0'));var moment=require(_0x533c('0x1'));var BPromise=require('bluebird');var rs=require(_0x533c('0x2'));var fs=require('fs');var Redis=require(_0x533c('0x3'));var db=require(_0x533c('0x4'))['db'];var utils=require(_0x533c('0x5'));var logger=require(_0x533c('0x6'))('rpc');var config=require(_0x533c('0x7'));var jayson=require(_0x533c('0x8'));var client=jayson[_0x533c('0x9')][_0x533c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x34ca89,_0x1699d5,_0x3a009b){return new BPromise(function(_0x36d74e,_0x2c297c){return client[_0x533c('0xb')](_0x34ca89,_0x3a009b)[_0x533c('0xc')](function(_0x46536d){logger[_0x533c('0xd')](_0x533c('0xe'),_0x1699d5,_0x533c('0xf'));logger[_0x533c('0x10')]('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x1699d5,_0x533c('0xf'),JSON[_0x533c('0x11')](_0x46536d));if(_0x46536d[_0x533c('0x12')]){if(_0x46536d[_0x533c('0x12')][_0x533c('0x13')]===0x1f4){logger[_0x533c('0x12')]('WhatsappApplication,\x20%s,\x20%s',_0x1699d5,_0x46536d[_0x533c('0x12')][_0x533c('0x14')]);return _0x2c297c(_0x46536d[_0x533c('0x12')][_0x533c('0x14')]);}logger[_0x533c('0x12')](_0x533c('0xe'),_0x1699d5,_0x46536d[_0x533c('0x12')][_0x533c('0x14')]);return _0x36d74e(_0x46536d['error'][_0x533c('0x14')]);}else{logger[_0x533c('0xd')](_0x533c('0xe'),_0x1699d5,_0x533c('0xf'));_0x36d74e(_0x46536d['result'][_0x533c('0x14')]);}})[_0x533c('0x15')](function(_0x41e22c){logger[_0x533c('0x12')](_0x533c('0xe'),_0x1699d5,_0x41e22c);_0x2c297c(_0x41e22c);});});} \ No newline at end of file +var _0x008c=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','WhatsappApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','WhatsappApplication,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x008c,0x188));var _0xc008=function(_0x18ac4a,_0x3970f0){_0x18ac4a=_0x18ac4a-0x0;var _0x48cb7a=_0x008c[_0x18ac4a];return _0x48cb7a;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var moment=require(_0xc008('0x2'));var BPromise=require(_0xc008('0x3'));var rs=require(_0xc008('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc008('0x5'))['db'];var utils=require(_0xc008('0x6'));var logger=require(_0xc008('0x7'))(_0xc008('0x8'));var config=require(_0xc008('0x9'));var jayson=require(_0xc008('0xa'));var client=jayson[_0xc008('0xb')][_0xc008('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x9c8cb2,_0x4af530,_0x428fa9){return new BPromise(function(_0x5aa09b,_0x30be38){return client['request'](_0x9c8cb2,_0x428fa9)['then'](function(_0x27830d){logger[_0xc008('0xd')]('WhatsappApplication,\x20%s,\x20%s',_0x4af530,'request\x20sent');logger['debug'](_0xc008('0xe'),_0x4af530,_0xc008('0xf'),JSON['stringify'](_0x27830d));if(_0x27830d[_0xc008('0x10')]){if(_0x27830d[_0xc008('0x10')][_0xc008('0x11')]===0x1f4){logger[_0xc008('0x10')](_0xc008('0x12'),_0x4af530,_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);return _0x30be38(_0x27830d['error']['message']);}logger[_0xc008('0x10')]('WhatsappApplication,\x20%s,\x20%s',_0x4af530,_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);return _0x5aa09b(_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);}else{logger[_0xc008('0xd')]('WhatsappApplication,\x20%s,\x20%s',_0x4af530,'request\x20sent');_0x5aa09b(_0x27830d['result'][_0xc008('0x13')]);}})[_0xc008('0x14')](function(_0x3cafe3){logger[_0xc008('0x10')]('WhatsappApplication,\x20%s,\x20%s',_0x4af530,_0x3cafe3);_0x30be38(_0x3cafe3);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 813ea8b..0bc95b4 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 _0xaf1b=['tracked','whatsapp','whatsappinteraction:addtags','put','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','download','post','create','addMessage','/:id/tags'];(function(_0x59b8ea,_0x311f9a){var _0x5c1c55=function(_0x5109ae){while(--_0x5109ae){_0x59b8ea['push'](_0x59b8ea['shift']());}};_0x5c1c55(++_0x311f9a);}(_0xaf1b,0x11a));var _0xbaf1=function(_0x1d1b64,_0x34eb7c){_0x1d1b64=_0x1d1b64-0x0;var _0x23b138=_0xaf1b[_0x1d1b64];return _0x23b138;};'use strict';var multer=require(_0xbaf1('0x0'));var util=require(_0xbaf1('0x1'));var path=require(_0xbaf1('0x2'));var timeout=require(_0xbaf1('0x3'));var express=require(_0xbaf1('0x4'));var router=express[_0xbaf1('0x5')]();var fs_extra=require(_0xbaf1('0x6'));var auth=require(_0xbaf1('0x7'));var interaction=require(_0xbaf1('0x8'));var config=require(_0xbaf1('0x9'));var controller=require(_0xbaf1('0xa'));router[_0xbaf1('0xb')]('/',auth[_0xbaf1('0xc')](),controller[_0xbaf1('0xd')]);router['get'](_0xbaf1('0xe'),auth['isAuthenticated'](),controller[_0xbaf1('0xf')]);router['get'](_0xbaf1('0x10'),auth[_0xbaf1('0xc')](),controller[_0xbaf1('0x11')]);router['get'](_0xbaf1('0x12'),auth[_0xbaf1('0xc')](),controller['getMessages']);router[_0xbaf1('0xb')]('/:id/download',auth[_0xbaf1('0xc')](),controller[_0xbaf1('0x13')]);router[_0xbaf1('0x14')]('/',auth[_0xbaf1('0xc')](),controller[_0xbaf1('0x15')]);router[_0xbaf1('0x14')]('/:id/messages',auth['isAuthenticated'](),controller[_0xbaf1('0x16')]);router[_0xbaf1('0x14')](_0xbaf1('0x17'),auth[_0xbaf1('0xc')](),interaction[_0xbaf1('0x18')](_0xbaf1('0x19'),_0xbaf1('0x1a')),controller['addTags']);router[_0xbaf1('0x1b')](_0xbaf1('0x10'),auth[_0xbaf1('0xc')](),interaction[_0xbaf1('0x18')](_0xbaf1('0x19'),_0xbaf1('0x1c')),controller[_0xbaf1('0x1d')]);router[_0xbaf1('0x1e')]('/:id',auth[_0xbaf1('0xc')](),interaction['tracked'](_0xbaf1('0x19'),_0xbaf1('0x1f')),controller[_0xbaf1('0x20')]);router[_0xbaf1('0x1e')]('/:id/tags',auth[_0xbaf1('0xc')](),controller['removeTags']);module[_0xbaf1('0x21')]=router; \ No newline at end of file +var _0x885a=['describe','/:id','show','/:id/messages','isAuthenticated','getMessages','/:id/download','download','post','create','/:id/tags','tracked','whatsapp','addTags','put','whatsappinteraction:update','update','whatsappinteraction:destroy','delete','removeTags','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','index','/describe'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x885a,0x180));var _0xa885=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x885a[_0x178e48];return _0x440d7e;};'use strict';var multer=require('multer');var util=require(_0xa885('0x0'));var path=require(_0xa885('0x1'));var timeout=require(_0xa885('0x2'));var express=require(_0xa885('0x3'));var router=express['Router']();var fs_extra=require(_0xa885('0x4'));var auth=require(_0xa885('0x5'));var interaction=require(_0xa885('0x6'));var config=require(_0xa885('0x7'));var controller=require(_0xa885('0x8'));router[_0xa885('0x9')]('/',auth['isAuthenticated'](),controller[_0xa885('0xa')]);router[_0xa885('0x9')](_0xa885('0xb'),auth['isAuthenticated'](),controller[_0xa885('0xc')]);router[_0xa885('0x9')](_0xa885('0xd'),auth['isAuthenticated'](),controller[_0xa885('0xe')]);router[_0xa885('0x9')](_0xa885('0xf'),auth[_0xa885('0x10')](),controller[_0xa885('0x11')]);router[_0xa885('0x9')](_0xa885('0x12'),auth['isAuthenticated'](),controller[_0xa885('0x13')]);router[_0xa885('0x14')]('/',auth[_0xa885('0x10')](),controller[_0xa885('0x15')]);router[_0xa885('0x14')](_0xa885('0xf'),auth[_0xa885('0x10')](),controller['addMessage']);router[_0xa885('0x14')](_0xa885('0x16'),auth[_0xa885('0x10')](),interaction[_0xa885('0x17')](_0xa885('0x18'),'whatsappinteraction:addtags'),controller[_0xa885('0x19')]);router[_0xa885('0x1a')]('/:id',auth[_0xa885('0x10')](),interaction[_0xa885('0x17')]('whatsapp',_0xa885('0x1b')),controller[_0xa885('0x1c')]);router['delete'](_0xa885('0xd'),auth['isAuthenticated'](),interaction[_0xa885('0x17')](_0xa885('0x18'),_0xa885('0x1d')),controller['destroy']);router[_0xa885('0x1e')]('/:id/tags',auth[_0xa885('0x10')](),controller[_0xa885('0x1f')]);module[_0xa885('0x20')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 2cf2ce2..4794bd9 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 _0x8784=['moment','BOOLEAN','DATE','STRING','ENUM','out','sequelize'];(function(_0x4bc00b,_0x364fba){var _0x7ffcc4=function(_0x31bc34){while(--_0x31bc34){_0x4bc00b['push'](_0x4bc00b['shift']());}};_0x7ffcc4(++_0x364fba);}(_0x8784,0x172));var _0x4878=function(_0x380307,_0x440ccd){_0x380307=_0x380307-0x0;var _0x9ea14b=_0x8784[_0x380307];return _0x9ea14b;};'use strict';var Sequelize=require(_0x4878('0x0'));var moment=require(_0x4878('0x1'));module['exports']={'closed':{'type':Sequelize[_0x4878('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x4878('0x3')]},'disposition':{'type':Sequelize[_0x4878('0x4')]},'secondDisposition':{'type':Sequelize[_0x4878('0x4')]},'thirdDisposition':{'type':Sequelize[_0x4878('0x4')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x4878('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x4878('0x5')]('in',_0x4878('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x4878('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x4878('0x5')]('in',_0x4878('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x4878('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x46e1=['BOOLEAN','DATE','STRING','ENUM','out','sequelize','moment','exports'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x46e1,0x155));var _0x146e=function(_0xd1743f,_0x5edab1){_0xd1743f=_0xd1743f-0x0;var _0x38ee7f=_0x46e1[_0xd1743f];return _0x38ee7f;};'use strict';var Sequelize=require(_0x146e('0x0'));var moment=require(_0x146e('0x1'));module[_0x146e('0x2')]={'closed':{'type':Sequelize[_0x146e('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x146e('0x4')]},'disposition':{'type':Sequelize[_0x146e('0x5')]},'secondDisposition':{'type':Sequelize[_0x146e('0x5')]},'thirdDisposition':{'type':Sequelize[_0x146e('0x5')]},'note':{'type':Sequelize[_0x146e('0x5')]},'phone':{'type':Sequelize[_0x146e('0x5')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x146e('0x6')]('in',_0x146e('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x146e('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x146e('0x6')]('in',_0x146e('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x146e('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 99dfd14..4f7f939 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 _0xe600=['update','then','destroy','end','error','stack','name','map','rawAttributes','fieldName','type','key','getOptions','findAll','whatsapp','query','user','catch','show','params','model','keys','WhatsappInteraction','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','create','body','describe','addMessage','ids','getMessages','findOne','WhatsappMessage','hasOwnProperty','nolimit','sort','where','pick','WhatsappInteractionId','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','rows','setTags','omit','spread','Tag','emit','whatsappInteractionTags:save','removeTags','download','join','root','server','tmp','attachments','transcript-%d-%s.zip','push','fullname','CmContact','Contact','lastName','Attachment','createdAt','direction','secret','Account','User','mkdirSync','Whatsapp','Owner','N.A.','toString','closed','disposition','basename','existsSync','createReadStream','pipe','createWriteStream','System','firstName','out','read','value','renderFile','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','log','err','unlinkSync','zip-dir','moment','bluebird','util','path','ejs','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','./whatsappInteraction.socket','sendStatus','status','json','offset','count','limit','set','Content-Range'];(function(_0x15aa6f,_0x167143){var _0x884cfc=function(_0x45ab40){while(--_0x45ab40){_0x15aa6f['push'](_0x15aa6f['shift']());}};_0x884cfc(++_0x167143);}(_0xe600,0x160));var _0x0e60=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe600[_0x321bb2];return _0x9c12ed;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x0e60('0x0'));var moment=require(_0x0e60('0x1'));var BPromise=require(_0x0e60('0x2'));var util=require(_0x0e60('0x3'));var path=require(_0x0e60('0x4'));var ejs=require(_0x0e60('0x5'));var fs=require('fs');var _=require('lodash');var Redis=require('ioredis');var interaction=require(_0x0e60('0x6'));var qs=require(_0x0e60('0x7'));var pdf=require(_0x0e60('0x8'));var logger=require(_0x0e60('0x9'))(_0x0e60('0xa'));var config=require(_0x0e60('0xb'));var db=require(_0x0e60('0xc'))['db'];config[_0x0e60('0xd')]=_['defaults'](config[_0x0e60('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0e60('0xd')]));require(_0x0e60('0xe'))['register'](socket);function respondWithStatusCode(_0x166ca3,_0x5d370f){_0x5d370f=_0x5d370f||0xcc;return function(_0x1382c7){if(_0x1382c7){return _0x166ca3[_0x0e60('0xf')](_0x5d370f);}return _0x166ca3[_0x0e60('0x10')](_0x5d370f)['end']();};}function respondWithResult(_0x4ccb80,_0x2a6e0d){_0x2a6e0d=_0x2a6e0d||0xc8;return function(_0x38efee){if(_0x38efee){return _0x4ccb80[_0x0e60('0x10')](_0x2a6e0d)[_0x0e60('0x11')](_0x38efee);}};}function respondWithFilteredResult(_0x1da97a,_0x278ce9){return function(_0x5ca5ff){if(_0x5ca5ff){var _0x174445=typeof _0x278ce9[_0x0e60('0x12')]==='undefined'&&typeof _0x278ce9['limit']==='undefined';var _0x57bbc7=_0x5ca5ff['count'];var _0x1440d0=_0x174445?0x0:_0x278ce9[_0x0e60('0x12')];var _0x59485a=_0x174445?_0x5ca5ff[_0x0e60('0x13')]:_0x278ce9['offset']+_0x278ce9[_0x0e60('0x14')];var _0x1d6a40;if(_0x59485a>=_0x57bbc7){_0x59485a=_0x57bbc7;_0x1d6a40=0xc8;}else{_0x1d6a40=0xce;}_0x1da97a[_0x0e60('0x10')](_0x1d6a40);return _0x1da97a[_0x0e60('0x15')](_0x0e60('0x16'),_0x1440d0+'-'+_0x59485a+'/'+_0x57bbc7)['json'](_0x5ca5ff);}return null;};}function saveUpdates(_0x555925){return function(_0x133cab){if(_0x133cab){return _0x133cab[_0x0e60('0x17')](_0x555925)[_0x0e60('0x18')](function(_0x133e0a){return _0x133e0a;});}return null;};}function removeEntity(_0x39fe0f){return function(_0x4430db){if(_0x4430db){return _0x4430db[_0x0e60('0x19')]()[_0x0e60('0x18')](function(){_0x39fe0f['status'](0xcc)[_0x0e60('0x1a')]();});}};}function handleEntityNotFound(_0x38d070){return function(_0x20a628){if(!_0x20a628){_0x38d070['sendStatus'](0x194);}return _0x20a628;};}function handleError(_0x31a090,_0xb13807){_0xb13807=_0xb13807||0x1f4;return function(_0x1ddd97){logger[_0x0e60('0x1b')](_0x1ddd97[_0x0e60('0x1c')]);if(_0x1ddd97[_0x0e60('0x1d')]){delete _0x1ddd97[_0x0e60('0x1d')];}_0x31a090['status'](_0xb13807)['send'](_0x1ddd97);};}exports['index']=function(_0x342b30,_0xea45bb){var _0x1682a6={};var _0x466877=_[_0x0e60('0x1e')](db['WhatsappInteraction'][_0x0e60('0x1f')],function(_0x479eb9){return{'name':_0x479eb9[_0x0e60('0x20')],'type':_0x479eb9[_0x0e60('0x21')][_0x0e60('0x22')]};});_0x1682a6=qs[_0x0e60('0x23')](_0x466877,_0x342b30);return interaction[_0x0e60('0x24')](_0x0e60('0x25'),_0x342b30[_0x0e60('0x26')],_0x342b30[_0x0e60('0x27')],_0x1682a6,_0x466877)[_0x0e60('0x18')](respondWithFilteredResult(_0xea45bb,_0x1682a6))[_0x0e60('0x28')](handleError(_0xea45bb,null));};exports[_0x0e60('0x29')]=function(_0x43ceaf,_0x538358){var _0x329dfc={'raw':![],'where':{'id':_0x43ceaf[_0x0e60('0x2a')]['id']}},_0x198f7d={};_0x198f7d[_0x0e60('0x2b')]=_[_0x0e60('0x2c')](db[_0x0e60('0x2d')][_0x0e60('0x1f')]);_0x198f7d[_0x0e60('0x26')]=_[_0x0e60('0x2c')](_0x43ceaf[_0x0e60('0x26')]);_0x198f7d[_0x0e60('0x2e')]=_[_0x0e60('0x2f')](_0x198f7d[_0x0e60('0x2b')],_0x198f7d[_0x0e60('0x26')]);_0x329dfc[_0x0e60('0x30')]=_[_0x0e60('0x2f')](_0x198f7d[_0x0e60('0x2b')],qs[_0x0e60('0x31')](_0x43ceaf[_0x0e60('0x26')][_0x0e60('0x31')]));_0x329dfc[_0x0e60('0x30')]=_0x329dfc[_0x0e60('0x30')][_0x0e60('0x32')]?_0x329dfc['attributes']:_0x198f7d[_0x0e60('0x2b')];if(_0x43ceaf[_0x0e60('0x26')][_0x0e60('0x33')]){_0x329dfc[_0x0e60('0x34')]=[{'all':!![]}];}_0x329dfc=_[_0x0e60('0x35')]({},_0x329dfc,_0x43ceaf[_0x0e60('0x36')]);return db['WhatsappInteraction'][_0x0e60('0x37')](_0x329dfc)['then'](handleEntityNotFound(_0x538358,null))[_0x0e60('0x18')](respondWithResult(_0x538358,null))[_0x0e60('0x28')](handleError(_0x538358,null));};exports[_0x0e60('0x38')]=function(_0x8f9a5b,_0x44b74d){return db[_0x0e60('0x2d')][_0x0e60('0x38')](_0x8f9a5b[_0x0e60('0x39')],{})[_0x0e60('0x18')](respondWithResult(_0x44b74d,0xc9))[_0x0e60('0x28')](handleError(_0x44b74d,null));};exports[_0x0e60('0x17')]=function(_0x22aff4,_0x32b978){if(_0x22aff4[_0x0e60('0x39')]['id']){delete _0x22aff4[_0x0e60('0x39')]['id'];}return db['WhatsappInteraction'][_0x0e60('0x37')]({'where':{'id':_0x22aff4[_0x0e60('0x2a')]['id']}})[_0x0e60('0x18')](handleEntityNotFound(_0x32b978,null))[_0x0e60('0x18')](saveUpdates(_0x22aff4[_0x0e60('0x39')],null))[_0x0e60('0x18')](respondWithResult(_0x32b978,null))[_0x0e60('0x28')](handleError(_0x32b978,null));};exports[_0x0e60('0x19')]=function(_0xaf252e,_0x3a0b74){return db['WhatsappInteraction'][_0x0e60('0x37')]({'where':{'id':_0xaf252e[_0x0e60('0x2a')]['id']}})[_0x0e60('0x18')](handleEntityNotFound(_0x3a0b74,null))[_0x0e60('0x18')](removeEntity(_0x3a0b74,null))[_0x0e60('0x28')](handleError(_0x3a0b74,null));};exports[_0x0e60('0x3a')]=function(_0x1b5adc,_0x292565){return db[_0x0e60('0x2d')]['describe']()[_0x0e60('0x18')](respondWithResult(_0x292565,null))[_0x0e60('0x28')](handleError(_0x292565,null));};exports[_0x0e60('0x3b')]=function(_0x1f4e6c,_0x3e49cf){return db['WhatsappMessage']['find']({'where':{'id':_0x1f4e6c[_0x0e60('0x2a')]['id']}})[_0x0e60('0x18')](handleEntityNotFound(_0x3e49cf,null))['then'](function(_0x3193ef){if(_0x3193ef){return _0x3193ef['addMessage'](_0x1f4e6c[_0x0e60('0x39')]['ids'],_['omit'](_0x1f4e6c[_0x0e60('0x39')],[_0x0e60('0x3c'),'id'])||{});}})[_0x0e60('0x18')](respondWithResult(_0x3e49cf,null))[_0x0e60('0x28')](handleError(_0x3e49cf,null));};exports[_0x0e60('0x3d')]=function(_0x3b4b6b,_0x4275e5){var _0x29d1b0={'raw':![],'where':{}};var _0x45aa8e={};var _0x235459={'count':0x0,'rows':[]};return db['WhatsappInteraction'][_0x0e60('0x3e')]({'where':{'id':_0x3b4b6b[_0x0e60('0x2a')]['id']}})[_0x0e60('0x18')](handleEntityNotFound(_0x4275e5,null))['then'](function(_0x4768c6){if(_0x4768c6){_0x45aa8e[_0x0e60('0x2b')]=_[_0x0e60('0x2c')](db[_0x0e60('0x3f')][_0x0e60('0x1f')]);_0x45aa8e['query']=_[_0x0e60('0x2c')](_0x3b4b6b['query']);_0x45aa8e[_0x0e60('0x2e')]=_['intersection'](_0x45aa8e[_0x0e60('0x2b')],_0x45aa8e[_0x0e60('0x26')]);_0x29d1b0[_0x0e60('0x30')]=_[_0x0e60('0x2f')](_0x45aa8e[_0x0e60('0x2b')],qs[_0x0e60('0x31')](_0x3b4b6b['query']['fields']));_0x29d1b0[_0x0e60('0x30')]=_0x29d1b0[_0x0e60('0x30')][_0x0e60('0x32')]?_0x29d1b0[_0x0e60('0x30')]:_0x45aa8e['model'];if(!_0x3b4b6b['query'][_0x0e60('0x40')](_0x0e60('0x41'))){_0x29d1b0['limit']=qs[_0x0e60('0x14')](_0x3b4b6b['query'][_0x0e60('0x14')]);_0x29d1b0['offset']=qs[_0x0e60('0x12')](_0x3b4b6b[_0x0e60('0x26')][_0x0e60('0x12')]);}_0x29d1b0['order']=qs[_0x0e60('0x42')](_0x3b4b6b['query'][_0x0e60('0x42')]);_0x29d1b0[_0x0e60('0x43')]=qs[_0x0e60('0x2e')](_[_0x0e60('0x44')](_0x3b4b6b[_0x0e60('0x26')],_0x45aa8e[_0x0e60('0x2e')]));_0x29d1b0[_0x0e60('0x43')][_0x0e60('0x45')]=_0x4768c6['id'];if(_0x3b4b6b['query'][_0x0e60('0x46')]){_0x29d1b0[_0x0e60('0x43')]=_[_0x0e60('0x35')](_0x29d1b0[_0x0e60('0x43')],{'$or':_[_0x0e60('0x1e')](_0x29d1b0[_0x0e60('0x30')],function(_0x48bcac){var _0x46f395={};_0x46f395[_0x48bcac]={'$like':'%'+_0x3b4b6b[_0x0e60('0x26')][_0x0e60('0x46')]+'%'};return _0x46f395;})});}if(_0x3b4b6b[_0x0e60('0x26')][_0x0e60('0x47')]){var _0x3a55e0=_0x3b4b6b[_0x0e60('0x26')][_0x0e60('0x47')]['split'](',');var _0x12ff24={};_0x12ff24[_0x3a55e0[0x0]]={'$gte':moment(_0x3a55e0[0x1])[_0x0e60('0x48')](_0x0e60('0x49'))};_0x29d1b0[_0x0e60('0x43')]=_[_0x0e60('0x35')](_0x29d1b0[_0x0e60('0x43')],_0x12ff24);}_0x29d1b0=_[_0x0e60('0x35')]({},_0x29d1b0,_0x3b4b6b['options']);return db[_0x0e60('0x3f')][_0x0e60('0x13')]({'where':_0x29d1b0['where']})['then'](function(_0x3e58e0){_0x235459[_0x0e60('0x13')]=_0x3e58e0;if(_0x3b4b6b[_0x0e60('0x26')][_0x0e60('0x33')]){_0x29d1b0[_0x0e60('0x34')]=[{'all':!![]}];}return db[_0x0e60('0x3f')][_0x0e60('0x24')](_0x29d1b0);})['then'](function(_0x1029cd){_0x235459[_0x0e60('0x4a')]=_0x1029cd;return _0x235459;});}})[_0x0e60('0x18')](respondWithFilteredResult(_0x4275e5,_0x29d1b0))['catch'](handleError(_0x4275e5,null));};exports['addTags']=function(_0x9aef42,_0x2d61ff){return db['WhatsappInteraction'][_0x0e60('0x37')]({'where':{'id':_0x9aef42[_0x0e60('0x2a')]['id']}})[_0x0e60('0x18')](handleEntityNotFound(_0x2d61ff,null))[_0x0e60('0x18')](function(_0x3833cc){if(_0x3833cc){return _0x3833cc[_0x0e60('0x4b')](_0x9aef42[_0x0e60('0x39')][_0x0e60('0x3c')],_[_0x0e60('0x4c')](_0x9aef42[_0x0e60('0x39')],[_0x0e60('0x3c'),'id'])||{})[_0x0e60('0x4d')](function(){return db[_0x0e60('0x4e')]['findAll']({'attributes':['id',_0x0e60('0x1d'),'color'],'where':{'id':_0x9aef42['body']['ids']}});})[_0x0e60('0x18')](function(_0x23a20c){socket[_0x0e60('0x4f')](_0x0e60('0x50'),{'id':Number(_0x9aef42[_0x0e60('0x2a')]['id']),'tags':_0x23a20c||[]});return{'id':Number(_0x9aef42['params']['id']),'tags':_0x23a20c||[]};});}})['then'](respondWithResult(_0x2d61ff,null))['catch'](handleError(_0x2d61ff,null));};exports[_0x0e60('0x51')]=function(_0x40166c,_0x5cc374){return db['WhatsappInteraction'][_0x0e60('0x37')]({'where':{'id':_0x40166c[_0x0e60('0x2a')]['id']}})['then'](handleEntityNotFound(_0x5cc374,null))[_0x0e60('0x18')](function(_0x38b2af){if(_0x38b2af){return _0x38b2af[_0x0e60('0x51')](_0x40166c[_0x0e60('0x26')]['ids']);}})[_0x0e60('0x18')](respondWithStatusCode(_0x5cc374,null))[_0x0e60('0x28')](handleError(_0x5cc374,null));};exports[_0x0e60('0x52')]=function(_0x294f15,_0x372e47){var _0xe4578b=moment()['unix']()['toString']();var _0xd59465=path[_0x0e60('0x53')](config[_0x0e60('0x54')],_0x0e60('0x55'),'files',_0x0e60('0x56'));var _0xf275c8=path[_0x0e60('0x53')](config['root'],_0x0e60('0x55'),'files',_0x0e60('0x57'));var _0x49edb0=path[_0x0e60('0x53')](_0xd59465,_0xe4578b);var _0x3fb152=util[_0x0e60('0x48')](_0x0e60('0x58'),_0x294f15[_0x0e60('0x2a')]['id'],_0xe4578b);var _0x439c30=path[_0x0e60('0x53')](_0xd59465,_0x3fb152);var _0x566412=[];_0x566412[_0x0e60('0x59')]({'model':db['User'],'as':'User','attributes':['id',_0x0e60('0x5a')],'raw':!![]});_0x566412[_0x0e60('0x59')]({'model':db[_0x0e60('0x5b')],'as':_0x0e60('0x5c'),'attributes':['id','firstName',_0x0e60('0x5d')],'raw':!![]});if(_0x294f15[_0x0e60('0x26')]['attachments']){_0x566412['push']({'model':db[_0x0e60('0x5e')],'as':_0x0e60('0x5e'),'raw':!![]});}var _0x15fd58=[{'model':db[_0x0e60('0x3f')],'as':'Messages','attributes':['id',_0x0e60('0x39'),_0x0e60('0x5f'),_0x0e60('0x60'),_0x0e60('0x61'),'read'],'include':_0x566412}];_0x15fd58[_0x0e60('0x59')]({'model':db['WhatsappAccount'],'as':_0x0e60('0x62'),'attributes':['id','name']});_0x15fd58[_0x0e60('0x59')]({'model':db[_0x0e60('0x63')],'as':'Owner','attributes':['id',_0x0e60('0x5a')]});return db[_0x0e60('0x2d')][_0x0e60('0x37')]({'where':{'id':_0x294f15[_0x0e60('0x2a')]['id']},'include':_0x15fd58})['then'](handleEntityNotFound(_0x372e47,null))[_0x0e60('0x18')](function(_0x3e6ffc){if(_0x3e6ffc){var _0x469c03=_0x3e6ffc['get']({'plain':!![]});fs[_0x0e60('0x64')](_0x49edb0);var _0x56d5b5={'channel':_0x0e60('0x65'),'account':_0x469c03[_0x0e60('0x62')][_0x0e60('0x1d')],'agent':_0x469c03['Owner']?_0x469c03[_0x0e60('0x66')][_0x0e60('0x5a')]:_0x0e60('0x67'),'createdAt':moment(_0x469c03[_0x0e60('0x5f')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x0e60('0x68')](),'closedAt':_0x469c03[_0x0e60('0x69')]?moment(_0x469c03['closedAt'])[_0x0e60('0x48')](_0x0e60('0x49'))['toString']():'','disposition':_0x469c03[_0x0e60('0x6a')],'messages':_(_0x469c03['Messages'])[_0x0e60('0x46')]({'secret':![]})[_0x0e60('0x1e')](function(_0x3693af){if(_0x3693af[_0x0e60('0x5e')]){var _0x5c4adb=path[_0x0e60('0x53')](_0xf275c8,_0x3693af[_0x0e60('0x5e')][_0x0e60('0x6b')]);if(fs[_0x0e60('0x6c')](_0x5c4adb)){fs[_0x0e60('0x6d')](_0x5c4adb)[_0x0e60('0x6e')](fs[_0x0e60('0x6f')](path[_0x0e60('0x53')](_0x49edb0,_0x3693af[_0x0e60('0x5e')]['basename'])));}}return{'date':moment(_0x3693af[_0x0e60('0x5f')])[_0x0e60('0x48')](_0x0e60('0x49'))[_0x0e60('0x68')](),'sender':_0x3693af[_0x0e60('0x60')]==='out'?_0x3693af['User']?_0x3693af[_0x0e60('0x63')][_0x0e60('0x5a')]:_0x0e60('0x70'):_0x3693af[_0x0e60('0x5c')][_0x0e60('0x71')]+(_0x3693af[_0x0e60('0x5c')][_0x0e60('0x5d')]?'\x20'+_0x3693af[_0x0e60('0x5c')][_0x0e60('0x5d')]:''),'body':_0x3693af[_0x0e60('0x5e')]?_0x3693af[_0x0e60('0x5e')][_0x0e60('0x6b')]:_0x3693af[_0x0e60('0x39')],'direction':_0x3693af[_0x0e60('0x60')]===_0x0e60('0x72')?'A':'C','secret':_0x3693af[_0x0e60('0x61')],'read':_0x3693af[_0x0e60('0x73')],'attachment':_0x3693af[_0x0e60('0x5e')]};})[_0x0e60('0x74')]()};return ejs[_0x0e60('0x75')](path[_0x0e60('0x53')](config[_0x0e60('0x54')],_0x0e60('0x55'),_0x0e60('0x76'),_0x0e60('0x77')),{'interaction':_0x56d5b5})[_0x0e60('0x18')](function(_0x3a5134){var _0x2f2478=path[_0x0e60('0x53')](_0x49edb0,'transcript-'+_0x469c03['id']+'-'+_0xe4578b+_0x0e60('0x78'));var _0x54a84f={'path':_0x2f2478,'channel':'Whatsapp','interactionId':_0x469c03['id']};return pdf[_0x0e60('0x79')](_0x3a5134,_0x54a84f);})[_0x0e60('0x18')](function(){return new BPromise(function(_0x20629c,_0x4f86c5){zipdir(_0x49edb0,{'saveTo':_0x439c30},function(_0x50a712,_0x4f1131){if(_0x50a712)return _0x4f86c5(_0x50a712);return _0x20629c(_0x4f1131);});})[_0x0e60('0x18')](function(){return new BPromise(function(_0x21495f,_0x3ea405){rimraf(_0x49edb0,function(_0x40576e){if(_0x40576e)_0x3ea405(_0x40576e);return _0x21495f();});});})[_0x0e60('0x18')](function(){return _0x372e47['download'](_0x439c30,_0x3fb152,function(_0x3f6b53){if(_0x3f6b53){console[_0x0e60('0x7a')](_0x0e60('0x7b'),_0x3f6b53);}else{fs[_0x0e60('0x7c')](_0x439c30);}});});});}else{return _0x372e47[_0x0e60('0xf')](0xc8);}})['catch'](handleError(_0x372e47,null));}; \ No newline at end of file +var _0x481e=['hasOwnProperty','nolimit','order','sort','where','pick','WhatsappInteractionId','filter','$gte','split','include','addTags','spread','name','color','emit','removeTags','download','unix','toString','join','root','server','files','tmp','attachments','format','transcript-%d-%s.zip','push','User','CmContact','Attachment','Messages','createdAt','direction','secret','Account','Owner','fullname','get','N.A.','closed','closedAt','disposition','basename','existsSync','createReadStream','pipe','createWriteStream','YYYY-MM-DD\x20HH:mm:ss','System','Contact','lastName','out','read','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','Whatsapp','createPdfFromHTML','log','err','unlinkSync','sendStatus','rimraf','moment','util','path','ejs','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','status','end','offset','undefined','limit','count','set','Content-Range','json','update','then','destroy','error','map','WhatsappInteraction','rawAttributes','fieldName','type','getOptions','findAll','whatsapp','query','catch','show','params','model','keys','filters','attributes','intersection','fields','merge','options','create','body','find','describe','addMessage','ids','omit','getMessages','WhatsappMessage','length'];(function(_0x3dbf1a,_0x1d51e2){var _0x3b2808=function(_0x197eb0){while(--_0x197eb0){_0x3dbf1a['push'](_0x3dbf1a['shift']());}};_0x3b2808(++_0x1d51e2);}(_0x481e,0x1c6));var _0xe481=function(_0x331505,_0x49feaa){_0x331505=_0x331505-0x0;var _0x615807=_0x481e[_0x331505];return _0x615807;};'use strict';var rimraf=require(_0xe481('0x0'));var zipdir=require('zip-dir');var moment=require(_0xe481('0x1'));var BPromise=require('bluebird');var util=require(_0xe481('0x2'));var path=require(_0xe481('0x3'));var ejs=require(_0xe481('0x4'));var fs=require('fs');var _=require('lodash');var Redis=require(_0xe481('0x5'));var interaction=require(_0xe481('0x6'));var qs=require(_0xe481('0x7'));var pdf=require(_0xe481('0x8'));var logger=require(_0xe481('0x9'))(_0xe481('0xa'));var config=require(_0xe481('0xb'));var db=require(_0xe481('0xc'))['db'];config['redis']=_[_0xe481('0xd')](config[_0xe481('0xe')],{'host':_0xe481('0xf'),'port':0x18eb});var socket=require(_0xe481('0x10'))(new Redis(config[_0xe481('0xe')]));require(_0xe481('0x11'))[_0xe481('0x12')](socket);function respondWithStatusCode(_0xa2ab34,_0x58e4cb){_0x58e4cb=_0x58e4cb||0xcc;return function(_0x1a841a){if(_0x1a841a){return _0xa2ab34['sendStatus'](_0x58e4cb);}return _0xa2ab34[_0xe481('0x13')](_0x58e4cb)[_0xe481('0x14')]();};}function respondWithResult(_0xa2b57a,_0x3f9601){_0x3f9601=_0x3f9601||0xc8;return function(_0x3e72ca){if(_0x3e72ca){return _0xa2b57a[_0xe481('0x13')](_0x3f9601)['json'](_0x3e72ca);}};}function respondWithFilteredResult(_0x2db4b0,_0x44a582){return function(_0x15ca3c){if(_0x15ca3c){var _0x407e24=typeof _0x44a582[_0xe481('0x15')]===_0xe481('0x16')&&typeof _0x44a582[_0xe481('0x17')]===_0xe481('0x16');var _0x32c02=_0x15ca3c['count'];var _0x4b8795=_0x407e24?0x0:_0x44a582[_0xe481('0x15')];var _0x40f906=_0x407e24?_0x15ca3c[_0xe481('0x18')]:_0x44a582[_0xe481('0x15')]+_0x44a582[_0xe481('0x17')];var _0x4f2b7a;if(_0x40f906>=_0x32c02){_0x40f906=_0x32c02;_0x4f2b7a=0xc8;}else{_0x4f2b7a=0xce;}_0x2db4b0[_0xe481('0x13')](_0x4f2b7a);return _0x2db4b0[_0xe481('0x19')](_0xe481('0x1a'),_0x4b8795+'-'+_0x40f906+'/'+_0x32c02)[_0xe481('0x1b')](_0x15ca3c);}return null;};}function saveUpdates(_0x393aee){return function(_0x122340){if(_0x122340){return _0x122340[_0xe481('0x1c')](_0x393aee)[_0xe481('0x1d')](function(_0x554111){return _0x554111;});}return null;};}function removeEntity(_0x29b2d3){return function(_0x50a7dd){if(_0x50a7dd){return _0x50a7dd[_0xe481('0x1e')]()[_0xe481('0x1d')](function(){_0x29b2d3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x25ac8d){return function(_0x24e85e){if(!_0x24e85e){_0x25ac8d['sendStatus'](0x194);}return _0x24e85e;};}function handleError(_0x92ae91,_0x57c2e3){_0x57c2e3=_0x57c2e3||0x1f4;return function(_0x1bbd84){logger[_0xe481('0x1f')](_0x1bbd84['stack']);if(_0x1bbd84['name']){delete _0x1bbd84['name'];}_0x92ae91[_0xe481('0x13')](_0x57c2e3)['send'](_0x1bbd84);};}exports['index']=function(_0x20fd36,_0x43bd47){var _0x59c783={};var _0x5451a6=_[_0xe481('0x20')](db[_0xe481('0x21')][_0xe481('0x22')],function(_0x454557){return{'name':_0x454557[_0xe481('0x23')],'type':_0x454557[_0xe481('0x24')]['key']};});_0x59c783=qs[_0xe481('0x25')](_0x5451a6,_0x20fd36);return interaction[_0xe481('0x26')](_0xe481('0x27'),_0x20fd36[_0xe481('0x28')],_0x20fd36['user'],_0x59c783,_0x5451a6)[_0xe481('0x1d')](respondWithFilteredResult(_0x43bd47,_0x59c783))[_0xe481('0x29')](handleError(_0x43bd47,null));};exports[_0xe481('0x2a')]=function(_0x30dddc,_0x1fcc5c){var _0x29070e={'raw':![],'where':{'id':_0x30dddc[_0xe481('0x2b')]['id']}},_0x1678eb={};_0x1678eb[_0xe481('0x2c')]=_['keys'](db[_0xe481('0x21')][_0xe481('0x22')]);_0x1678eb[_0xe481('0x28')]=_[_0xe481('0x2d')](_0x30dddc[_0xe481('0x28')]);_0x1678eb[_0xe481('0x2e')]=_['intersection'](_0x1678eb[_0xe481('0x2c')],_0x1678eb[_0xe481('0x28')]);_0x29070e[_0xe481('0x2f')]=_[_0xe481('0x30')](_0x1678eb['model'],qs['fields'](_0x30dddc[_0xe481('0x28')][_0xe481('0x31')]));_0x29070e[_0xe481('0x2f')]=_0x29070e[_0xe481('0x2f')]['length']?_0x29070e[_0xe481('0x2f')]:_0x1678eb[_0xe481('0x2c')];if(_0x30dddc[_0xe481('0x28')]['includeAll']){_0x29070e['include']=[{'all':!![]}];}_0x29070e=_[_0xe481('0x32')]({},_0x29070e,_0x30dddc[_0xe481('0x33')]);return db[_0xe481('0x21')]['find'](_0x29070e)[_0xe481('0x1d')](handleEntityNotFound(_0x1fcc5c,null))[_0xe481('0x1d')](respondWithResult(_0x1fcc5c,null))['catch'](handleError(_0x1fcc5c,null));};exports[_0xe481('0x34')]=function(_0x1fb635,_0x5a9c47){return db[_0xe481('0x21')][_0xe481('0x34')](_0x1fb635[_0xe481('0x35')],{})[_0xe481('0x1d')](respondWithResult(_0x5a9c47,0xc9))[_0xe481('0x29')](handleError(_0x5a9c47,null));};exports['update']=function(_0x51a45f,_0x496c5d){if(_0x51a45f[_0xe481('0x35')]['id']){delete _0x51a45f[_0xe481('0x35')]['id'];}return db[_0xe481('0x21')][_0xe481('0x36')]({'where':{'id':_0x51a45f[_0xe481('0x2b')]['id']}})[_0xe481('0x1d')](handleEntityNotFound(_0x496c5d,null))[_0xe481('0x1d')](saveUpdates(_0x51a45f['body'],null))['then'](respondWithResult(_0x496c5d,null))[_0xe481('0x29')](handleError(_0x496c5d,null));};exports['destroy']=function(_0x2aa976,_0xa4a75b){return db['WhatsappInteraction']['find']({'where':{'id':_0x2aa976[_0xe481('0x2b')]['id']}})['then'](handleEntityNotFound(_0xa4a75b,null))[_0xe481('0x1d')](removeEntity(_0xa4a75b,null))[_0xe481('0x29')](handleError(_0xa4a75b,null));};exports[_0xe481('0x37')]=function(_0x2e4ea8,_0x48841b){return db['WhatsappInteraction'][_0xe481('0x37')]()[_0xe481('0x1d')](respondWithResult(_0x48841b,null))[_0xe481('0x29')](handleError(_0x48841b,null));};exports['addMessage']=function(_0x27566a,_0x58120d){return db['WhatsappMessage'][_0xe481('0x36')]({'where':{'id':_0x27566a[_0xe481('0x2b')]['id']}})[_0xe481('0x1d')](handleEntityNotFound(_0x58120d,null))[_0xe481('0x1d')](function(_0xea63f9){if(_0xea63f9){return _0xea63f9[_0xe481('0x38')](_0x27566a[_0xe481('0x35')][_0xe481('0x39')],_[_0xe481('0x3a')](_0x27566a[_0xe481('0x35')],[_0xe481('0x39'),'id'])||{});}})['then'](respondWithResult(_0x58120d,null))[_0xe481('0x29')](handleError(_0x58120d,null));};exports[_0xe481('0x3b')]=function(_0x9e97a3,_0x30e87e){var _0x3e9ee0={'raw':![],'where':{}};var _0xee9204={};var _0xf86b60={'count':0x0,'rows':[]};return db[_0xe481('0x21')]['findOne']({'where':{'id':_0x9e97a3[_0xe481('0x2b')]['id']}})['then'](handleEntityNotFound(_0x30e87e,null))[_0xe481('0x1d')](function(_0x20338c){if(_0x20338c){_0xee9204[_0xe481('0x2c')]=_[_0xe481('0x2d')](db[_0xe481('0x3c')][_0xe481('0x22')]);_0xee9204['query']=_['keys'](_0x9e97a3[_0xe481('0x28')]);_0xee9204['filters']=_['intersection'](_0xee9204['model'],_0xee9204['query']);_0x3e9ee0[_0xe481('0x2f')]=_[_0xe481('0x30')](_0xee9204[_0xe481('0x2c')],qs['fields'](_0x9e97a3[_0xe481('0x28')][_0xe481('0x31')]));_0x3e9ee0[_0xe481('0x2f')]=_0x3e9ee0[_0xe481('0x2f')][_0xe481('0x3d')]?_0x3e9ee0[_0xe481('0x2f')]:_0xee9204[_0xe481('0x2c')];if(!_0x9e97a3[_0xe481('0x28')][_0xe481('0x3e')](_0xe481('0x3f'))){_0x3e9ee0[_0xe481('0x17')]=qs[_0xe481('0x17')](_0x9e97a3[_0xe481('0x28')][_0xe481('0x17')]);_0x3e9ee0['offset']=qs[_0xe481('0x15')](_0x9e97a3[_0xe481('0x28')][_0xe481('0x15')]);}_0x3e9ee0[_0xe481('0x40')]=qs['sort'](_0x9e97a3[_0xe481('0x28')][_0xe481('0x41')]);_0x3e9ee0[_0xe481('0x42')]=qs['filters'](_[_0xe481('0x43')](_0x9e97a3[_0xe481('0x28')],_0xee9204[_0xe481('0x2e')]));_0x3e9ee0[_0xe481('0x42')][_0xe481('0x44')]=_0x20338c['id'];if(_0x9e97a3[_0xe481('0x28')]['filter']){_0x3e9ee0[_0xe481('0x42')]=_[_0xe481('0x32')](_0x3e9ee0[_0xe481('0x42')],{'$or':_[_0xe481('0x20')](_0x3e9ee0['attributes'],function(_0x1a8880){var _0x1a35b0={};_0x1a35b0[_0x1a8880]={'$like':'%'+_0x9e97a3[_0xe481('0x28')][_0xe481('0x45')]+'%'};return _0x1a35b0;})});}if(_0x9e97a3[_0xe481('0x28')]['$gte']){var _0xc200ed=_0x9e97a3[_0xe481('0x28')][_0xe481('0x46')][_0xe481('0x47')](',');var _0x2ed43c={};_0x2ed43c[_0xc200ed[0x0]]={'$gte':moment(_0xc200ed[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x3e9ee0[_0xe481('0x42')]=_[_0xe481('0x32')](_0x3e9ee0['where'],_0x2ed43c);}_0x3e9ee0=_[_0xe481('0x32')]({},_0x3e9ee0,_0x9e97a3['options']);return db[_0xe481('0x3c')][_0xe481('0x18')]({'where':_0x3e9ee0[_0xe481('0x42')]})['then'](function(_0x328942){_0xf86b60[_0xe481('0x18')]=_0x328942;if(_0x9e97a3['query']['includeAll']){_0x3e9ee0[_0xe481('0x48')]=[{'all':!![]}];}return db[_0xe481('0x3c')][_0xe481('0x26')](_0x3e9ee0);})['then'](function(_0xf40f36){_0xf86b60['rows']=_0xf40f36;return _0xf86b60;});}})[_0xe481('0x1d')](respondWithFilteredResult(_0x30e87e,_0x3e9ee0))[_0xe481('0x29')](handleError(_0x30e87e,null));};exports[_0xe481('0x49')]=function(_0x547c0e,_0x2aa561){return db[_0xe481('0x21')][_0xe481('0x36')]({'where':{'id':_0x547c0e[_0xe481('0x2b')]['id']}})[_0xe481('0x1d')](handleEntityNotFound(_0x2aa561,null))[_0xe481('0x1d')](function(_0x609aca){if(_0x609aca){return _0x609aca['setTags'](_0x547c0e['body'][_0xe481('0x39')],_[_0xe481('0x3a')](_0x547c0e['body'],['ids','id'])||{})[_0xe481('0x4a')](function(){return db['Tag'][_0xe481('0x26')]({'attributes':['id',_0xe481('0x4b'),_0xe481('0x4c')],'where':{'id':_0x547c0e['body'][_0xe481('0x39')]}});})[_0xe481('0x1d')](function(_0x4bc6ca){socket[_0xe481('0x4d')]('whatsappInteractionTags:save',{'id':Number(_0x547c0e[_0xe481('0x2b')]['id']),'tags':_0x4bc6ca||[]});return{'id':Number(_0x547c0e['params']['id']),'tags':_0x4bc6ca||[]};});}})[_0xe481('0x1d')](respondWithResult(_0x2aa561,null))[_0xe481('0x29')](handleError(_0x2aa561,null));};exports[_0xe481('0x4e')]=function(_0x1e1625,_0x4ae3b6){return db[_0xe481('0x21')][_0xe481('0x36')]({'where':{'id':_0x1e1625[_0xe481('0x2b')]['id']}})[_0xe481('0x1d')](handleEntityNotFound(_0x4ae3b6,null))[_0xe481('0x1d')](function(_0x432052){if(_0x432052){return _0x432052[_0xe481('0x4e')](_0x1e1625[_0xe481('0x28')][_0xe481('0x39')]);}})[_0xe481('0x1d')](respondWithStatusCode(_0x4ae3b6,null))['catch'](handleError(_0x4ae3b6,null));};exports[_0xe481('0x4f')]=function(_0x39ac88,_0x531608){var _0x4418c9=moment()[_0xe481('0x50')]()[_0xe481('0x51')]();var _0x157837=path[_0xe481('0x52')](config[_0xe481('0x53')],_0xe481('0x54'),_0xe481('0x55'),_0xe481('0x56'));var _0x2cf573=path[_0xe481('0x52')](config['root'],_0xe481('0x54'),'files',_0xe481('0x57'));var _0x37d911=path[_0xe481('0x52')](_0x157837,_0x4418c9);var _0x3025de=util[_0xe481('0x58')](_0xe481('0x59'),_0x39ac88[_0xe481('0x2b')]['id'],_0x4418c9);var _0x17bc7a=path[_0xe481('0x52')](_0x157837,_0x3025de);var _0x39f83c=[];_0x39f83c[_0xe481('0x5a')]({'model':db[_0xe481('0x5b')],'as':_0xe481('0x5b'),'attributes':['id','fullname'],'raw':!![]});_0x39f83c['push']({'model':db[_0xe481('0x5c')],'as':'Contact','attributes':['id','firstName','lastName'],'raw':!![]});if(_0x39ac88[_0xe481('0x28')][_0xe481('0x57')]){_0x39f83c[_0xe481('0x5a')]({'model':db[_0xe481('0x5d')],'as':_0xe481('0x5d'),'raw':!![]});}var _0x4bdf02=[{'model':db[_0xe481('0x3c')],'as':_0xe481('0x5e'),'attributes':['id',_0xe481('0x35'),_0xe481('0x5f'),_0xe481('0x60'),_0xe481('0x61'),'read'],'include':_0x39f83c}];_0x4bdf02[_0xe481('0x5a')]({'model':db['WhatsappAccount'],'as':_0xe481('0x62'),'attributes':['id','name']});_0x4bdf02['push']({'model':db['User'],'as':_0xe481('0x63'),'attributes':['id',_0xe481('0x64')]});return db['WhatsappInteraction'][_0xe481('0x36')]({'where':{'id':_0x39ac88[_0xe481('0x2b')]['id']},'include':_0x4bdf02})[_0xe481('0x1d')](handleEntityNotFound(_0x531608,null))[_0xe481('0x1d')](function(_0x18b253){if(_0x18b253){var _0x213050=_0x18b253[_0xe481('0x65')]({'plain':!![]});fs['mkdirSync'](_0x37d911);var _0x5daa91={'channel':'Whatsapp','account':_0x213050['Account'][_0xe481('0x4b')],'agent':_0x213050[_0xe481('0x63')]?_0x213050[_0xe481('0x63')][_0xe481('0x64')]:_0xe481('0x66'),'createdAt':moment(_0x213050[_0xe481('0x5f')])[_0xe481('0x58')]('YYYY-MM-DD\x20HH:mm:ss')[_0xe481('0x51')](),'closedAt':_0x213050[_0xe481('0x67')]?moment(_0x213050[_0xe481('0x68')])[_0xe481('0x58')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x213050[_0xe481('0x69')],'messages':_(_0x213050[_0xe481('0x5e')])[_0xe481('0x45')]({'secret':![]})[_0xe481('0x20')](function(_0x3ad861){if(_0x3ad861['Attachment']){var _0x53236d=path[_0xe481('0x52')](_0x2cf573,_0x3ad861['Attachment'][_0xe481('0x6a')]);if(fs[_0xe481('0x6b')](_0x53236d)){fs[_0xe481('0x6c')](_0x53236d)[_0xe481('0x6d')](fs[_0xe481('0x6e')](path[_0xe481('0x52')](_0x37d911,_0x3ad861[_0xe481('0x5d')][_0xe481('0x6a')])));}}return{'date':moment(_0x3ad861[_0xe481('0x5f')])['format'](_0xe481('0x6f'))[_0xe481('0x51')](),'sender':_0x3ad861['direction']==='out'?_0x3ad861[_0xe481('0x5b')]?_0x3ad861[_0xe481('0x5b')]['fullname']:_0xe481('0x70'):_0x3ad861['Contact']['firstName']+(_0x3ad861[_0xe481('0x71')][_0xe481('0x72')]?'\x20'+_0x3ad861[_0xe481('0x71')][_0xe481('0x72')]:''),'body':_0x3ad861['Attachment']?_0x3ad861[_0xe481('0x5d')]['basename']:_0x3ad861[_0xe481('0x35')],'direction':_0x3ad861[_0xe481('0x60')]===_0xe481('0x73')?'A':'C','secret':_0x3ad861[_0xe481('0x61')],'read':_0x3ad861[_0xe481('0x74')],'attachment':_0x3ad861['Attachment']};})[_0xe481('0x75')]()};return ejs[_0xe481('0x76')](path[_0xe481('0x52')](config[_0xe481('0x53')],'server',_0xe481('0x77'),_0xe481('0x78')),{'interaction':_0x5daa91})[_0xe481('0x1d')](function(_0x1e5055){var _0x4d9c26=path[_0xe481('0x52')](_0x37d911,_0xe481('0x79')+_0x213050['id']+'-'+_0x4418c9+_0xe481('0x7a'));var _0x3cdcbe={'path':_0x4d9c26,'channel':_0xe481('0x7b'),'interactionId':_0x213050['id']};return pdf[_0xe481('0x7c')](_0x1e5055,_0x3cdcbe);})[_0xe481('0x1d')](function(){return new BPromise(function(_0x1b4b54,_0x334daf){zipdir(_0x37d911,{'saveTo':_0x17bc7a},function(_0x4352b8,_0x487c3f){if(_0x4352b8)return _0x334daf(_0x4352b8);return _0x1b4b54(_0x487c3f);});})['then'](function(){return new BPromise(function(_0x3737c3,_0x2f083c){rimraf(_0x37d911,function(_0xce8c8e){if(_0xce8c8e)_0x2f083c(_0xce8c8e);return _0x3737c3();});});})[_0xe481('0x1d')](function(){return _0x531608[_0xe481('0x4f')](_0x17bc7a,_0x3025de,function(_0x19be24){if(_0x19be24){console[_0xe481('0x7d')](_0xe481('0x7e'),_0x19be24);}else{fs[_0xe481('0x7f')](_0x17bc7a);}});});});}else{return _0x531608[_0xe481('0x80')](0xc8);}})[_0xe481('0x29')](handleError(_0x531608,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 4e45569..ec22517 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 _0xf089=['WhatsappInteraction','WhatsappMessage','setMaxListeners','save','update','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','hasOwnProperty','hook','../../mysqldb'];(function(_0x4def83,_0x5277f9){var _0xa4c6bf=function(_0x490614){while(--_0x490614){_0x4def83['push'](_0x4def83['shift']());}};_0xa4c6bf(++_0x5277f9);}(_0xf089,0xba));var _0x9f08=function(_0x582d77,_0x40ac40){_0x582d77=_0x582d77-0x0;var _0x37cfb8=_0xf089[_0x582d77];return _0x37cfb8;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require(_0x9f08('0x0'))['db'][_0x9f08('0x1')];var WhatsappMessage=require('../../mysqldb')['db'][_0x9f08('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x9f08('0x3')](0x0);var events={'afterCreate':_0x9f08('0x4'),'afterUpdate':_0x9f08('0x5'),'afterDestroy':'remove'};function emitEvent(_0x11d64c){return function(_0x1dced2,_0x352879,_0x13768c){_0x1dced2[_0x9f08('0x6')]({'attributes':['id'],'raw':!![]})[_0x9f08('0x7')](function(_0x5341c9){_0x1dced2[_0x9f08('0x8')](_0x9f08('0x9'),_0x5341c9[_0x9f08('0xa')](function(_0x4ce5b6){return{'id':_0x4ce5b6['id']};}));return WhatsappMessage[_0x9f08('0xb')]({'where':{'WhatsappInteractionId':_0x1dced2['id'],'direction':'in','read':![]},'raw':!![]});})[_0x9f08('0x7')](function(_0x3868b6){_0x1dced2['setDataValue'](_0x9f08('0xc'),_0x3868b6[_0x9f08('0xd')]);WhatsappInteractionEvents[_0x9f08('0xe')](_0x11d64c+':'+_0x1dced2['id'],_0x1dced2);WhatsappInteractionEvents['emit'](_0x11d64c,_0x1dced2);_0x13768c(null);})['catch'](_0x13768c(null));};}for(var e in events){if(events[_0x9f08('0xf')](e)){var event=events[e];WhatsappInteraction[_0x9f08('0x10')](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file +var _0xbe99=['unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','save','remove','getUsers','then','Users','map','findAll','setDataValue'];(function(_0x43dd8e,_0x4d4164){var _0x40e55c=function(_0x1ba7ca){while(--_0x1ba7ca){_0x43dd8e['push'](_0x43dd8e['shift']());}};_0x40e55c(++_0x4d4164);}(_0xbe99,0x196));var _0x9be9=function(_0x2bda27,_0x35e70d){_0x2bda27=_0x2bda27-0x0;var _0xd16c7a=_0xbe99[_0x2bda27];return _0xd16c7a;};'use strict';var EventEmitter=require(_0x9be9('0x0'));var WhatsappInteraction=require(_0x9be9('0x1'))['db'][_0x9be9('0x2')];var WhatsappMessage=require(_0x9be9('0x1'))['db'][_0x9be9('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9be9('0x4'),'afterUpdate':'update','afterDestroy':_0x9be9('0x5')};function emitEvent(_0x3cfcaa){return function(_0x3445f5,_0x7758db,_0x52da35){_0x3445f5[_0x9be9('0x6')]({'attributes':['id'],'raw':!![]})[_0x9be9('0x7')](function(_0x4dc53f){_0x3445f5['setDataValue'](_0x9be9('0x8'),_0x4dc53f[_0x9be9('0x9')](function(_0x141bc7){return{'id':_0x141bc7['id']};}));return WhatsappMessage[_0x9be9('0xa')]({'where':{'WhatsappInteractionId':_0x3445f5['id'],'direction':'in','read':![]},'raw':!![]});})[_0x9be9('0x7')](function(_0x40a766){_0x3445f5[_0x9be9('0xb')](_0x9be9('0xc'),_0x40a766[_0x9be9('0xd')]);WhatsappInteractionEvents[_0x9be9('0xe')](_0x3cfcaa+':'+_0x3445f5['id'],_0x3445f5);WhatsappInteractionEvents[_0x9be9('0xe')](_0x3cfcaa,_0x3445f5);_0x52da35(null);})[_0x9be9('0xf')](_0x52da35(null));};}for(var e in events){if(events[_0x9be9('0x10')](e)){var event=events[e];WhatsappInteraction[_0x9be9('0x11')](e,emitEvent(event));}}module[_0x9be9('0x12')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index aa7b763..42c17eb 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 _0x32b2=['closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./whatsappInteraction.attributes','exports','WhatsappInteraction','whatsapp_interactions','changed'];(function(_0x472c4e,_0x889f6a){var _0x5ab82e=function(_0x11b003){while(--_0x11b003){_0x472c4e['push'](_0x472c4e['shift']());}};_0x5ab82e(++_0x889f6a);}(_0x32b2,0xa8));var _0x232b=function(_0x285f9b,_0xfcae6c){_0x285f9b=_0x285f9b-0x0;var _0x32dd58=_0x32b2[_0x285f9b];return _0x32dd58;};'use strict';var _=require(_0x232b('0x0'));var util=require('util');var logger=require(_0x232b('0x1'))(_0x232b('0x2'));var moment=require(_0x232b('0x3'));var BPromise=require(_0x232b('0x4'));var rp=require(_0x232b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x232b('0x6'));var attributes=require(_0x232b('0x7'));module[_0x232b('0x8')]=function(_0xcbc38e,_0x11f212){return _0xcbc38e['define'](_0x232b('0x9'),attributes,{'tableName':_0x232b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2a0dce,_0x550e8d,_0x23e720){if(_0x2a0dce[_0x232b('0xb')](_0x232b('0xc'))){_0x2a0dce['closedAt']=moment()[_0x232b('0xd')](_0x232b('0xe'));}_0x23e720(null,_0x2a0dce);}}});}; \ No newline at end of file +var _0x8799=['format','lodash','util','moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','whatsapp_interactions','changed','closed','closedAt'];(function(_0x1cfa0d,_0x4391f2){var _0xe33279=function(_0x3ce7c1){while(--_0x3ce7c1){_0x1cfa0d['push'](_0x1cfa0d['shift']());}};_0xe33279(++_0x4391f2);}(_0x8799,0x1d1));var _0x9879=function(_0x44893b,_0x4ea570){_0x44893b=_0x44893b-0x0;var _0x3ba9b8=_0x8799[_0x44893b];return _0x3ba9b8;};'use strict';var _=require(_0x9879('0x0'));var util=require(_0x9879('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x9879('0x2'));var BPromise=require(_0x9879('0x3'));var rp=require(_0x9879('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9879('0x5'));var config=require(_0x9879('0x6'));var attributes=require(_0x9879('0x7'));module[_0x9879('0x8')]=function(_0x53b7ce,_0x7eda70){return _0x53b7ce[_0x9879('0x9')](_0x9879('0xa'),attributes,{'tableName':_0x9879('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3d90cb,_0x18fb99,_0x112923){if(_0x3d90cb[_0x9879('0xc')](_0x9879('0xd'))){_0x3d90cb[_0x9879('0xe')]=moment()[_0x9879('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x112923(null,_0x3d90cb);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index f050576..e7c20bf 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 _0x12b2=['update','body','options','where','attributes','limit','UpdateWhatsappInteraction','stringify','addTags','ids','spread','AddTags','lodash','util','ioredis','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','error','message','catch'];(function(_0x58e389,_0x3ab426){var _0x1437df=function(_0x5cf920){while(--_0x5cf920){_0x58e389['push'](_0x58e389['shift']());}};_0x1437df(++_0x3ab426);}(_0x12b2,0x75));var _0x212b=function(_0x1e43a2,_0x48937a){_0x1e43a2=_0x1e43a2-0x0;var _0x3bc37c=_0x12b2[_0x1e43a2];return _0x3bc37c;};'use strict';var _=require(_0x212b('0x0'));var util=require(_0x212b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x212b('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x212b('0x3'))(_0x212b('0x4'));var config=require('../../config/environment');var jayson=require(_0x212b('0x5'));var client=jayson[_0x212b('0x6')]['http']({'port':0x232a});config[_0x212b('0x7')]=_[_0x212b('0x8')](config[_0x212b('0x7')],{'host':_0x212b('0x9'),'port':0x18eb});var socket=require(_0x212b('0xa'))(new Redis(config[_0x212b('0x7')]));require(_0x212b('0xb'))[_0x212b('0xc')](socket);function respondWithRpcPromise(_0x5634f8,_0x405010,_0x56ed76){return new BPromise(function(_0x1f7c86,_0x4249ff){return client[_0x212b('0xd')](_0x5634f8,_0x56ed76)[_0x212b('0xe')](function(_0x3b93ad){logger[_0x212b('0xf')](_0x212b('0x10'),_0x405010,_0x212b('0x11'));logger[_0x212b('0x12')](_0x212b('0x13'),_0x405010,_0x212b('0x11'),JSON['stringify'](_0x3b93ad));if(_0x3b93ad['error']){if(_0x3b93ad['error']['code']===0x1f4){logger[_0x212b('0x14')]('WhatsappInteraction,\x20%s,\x20%s',_0x405010,_0x3b93ad[_0x212b('0x14')][_0x212b('0x15')]);return _0x4249ff(_0x3b93ad[_0x212b('0x14')][_0x212b('0x15')]);}logger['error'](_0x212b('0x10'),_0x405010,_0x3b93ad[_0x212b('0x14')][_0x212b('0x15')]);return _0x1f7c86(_0x3b93ad['error'][_0x212b('0x15')]);}else{logger[_0x212b('0xf')](_0x212b('0x10'),_0x405010,_0x212b('0x11'));_0x1f7c86(_0x3b93ad['result'][_0x212b('0x15')]);}})[_0x212b('0x16')](function(_0x599e45){logger[_0x212b('0x14')]('WhatsappInteraction,\x20%s,\x20%s',_0x405010,_0x599e45);_0x4249ff(_0x599e45);});});}exports['UpdateWhatsappInteraction']=function(_0x4e5bd1){var _0x1c4047=this;return new Promise(function(_0x599ace,_0x5ab9be){return db['WhatsappInteraction'][_0x212b('0x17')](_0x4e5bd1[_0x212b('0x18')],{'raw':_0x4e5bd1[_0x212b('0x19')]?_0x4e5bd1[_0x212b('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4e5bd1[_0x212b('0x19')]?_0x4e5bd1[_0x212b('0x19')][_0x212b('0x1a')]||null:null,'attributes':_0x4e5bd1['options']?_0x4e5bd1[_0x212b('0x19')][_0x212b('0x1b')]||null:null,'limit':_0x4e5bd1[_0x212b('0x19')]?_0x4e5bd1[_0x212b('0x19')][_0x212b('0x1c')]||null:null})[_0x212b('0xe')](function(_0x39f937){logger[_0x212b('0xf')]('UpdateWhatsappInteraction',_0x4e5bd1);logger[_0x212b('0x12')](_0x212b('0x1d'),_0x4e5bd1,JSON[_0x212b('0x1e')](_0x39f937));_0x599ace(_0x39f937);})['catch'](function(_0x39e176){logger['error'](_0x212b('0x1d'),_0x39e176[_0x212b('0x15')],_0x4e5bd1);_0x5ab9be(_0x1c4047['error'](0x1f4,_0x39e176[_0x212b('0x15')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x3d7634){return new Promise(function(_0x56027f,_0x1996a){return db['WhatsappInteraction']['find']({'where':_0x3d7634[_0x212b('0x19')]?_0x3d7634[_0x212b('0x19')][_0x212b('0x1a')]||null:null})['then'](function(_0x3915be){if(_0x3915be){return _0x3915be[_0x212b('0x1f')](_0x3d7634['body'][_0x212b('0x20')],_['omit'](_0x3d7634[_0x212b('0x18')],[_0x212b('0x20'),'id'])||{});}})[_0x212b('0x21')](function(_0x26061f){logger[_0x212b('0xf')]('AddTags',_0x3d7634);logger[_0x212b('0x12')]('AddTags',_0x3d7634,JSON[_0x212b('0x1e')](_0x26061f));_0x56027f(_0x26061f);})['catch'](function(_0x510143){logger[_0x212b('0x14')](_0x212b('0x22'),_0x510143[_0x212b('0x15')],_0x3d7634);_0x1996a(_this[_0x212b('0x14')](0x1f4,_0x510143[_0x212b('0x15')]));});});}; \ No newline at end of file +var _0x3ab1=['UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','where','attributes','limit','AddTagsToWhatsappInteraction','find','addTags','ids','spread','AddTags','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./whatsappInteraction.socket','register','request','then','info','request\x20sent','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappInteraction,\x20%s,\x20%s','message','catch'];(function(_0x4f2208,_0x286dec){var _0x2e2a1e=function(_0x372bba){while(--_0x372bba){_0x4f2208['push'](_0x4f2208['shift']());}};_0x2e2a1e(++_0x286dec);}(_0x3ab1,0x19c));var _0x13ab=function(_0x58e338,_0x27cc4b){_0x58e338=_0x58e338-0x0;var _0x2b4988=_0x3ab1[_0x58e338];return _0x2b4988;};'use strict';var _=require(_0x13ab('0x0'));var util=require(_0x13ab('0x1'));var moment=require(_0x13ab('0x2'));var BPromise=require(_0x13ab('0x3'));var rs=require(_0x13ab('0x4'));var fs=require('fs');var Redis=require(_0x13ab('0x5'));var db=require(_0x13ab('0x6'))['db'];var utils=require(_0x13ab('0x7'));var logger=require('../../config/logger')(_0x13ab('0x8'));var config=require(_0x13ab('0x9'));var jayson=require(_0x13ab('0xa'));var client=jayson[_0x13ab('0xb')][_0x13ab('0xc')]({'port':0x232a});config[_0x13ab('0xd')]=_['defaults'](config[_0x13ab('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x13ab('0xe'))(new Redis(config['redis']));require(_0x13ab('0xf'))[_0x13ab('0x10')](socket);function respondWithRpcPromise(_0x20be42,_0x52b394,_0x565bbf){return new BPromise(function(_0x155585,_0xef9e22){return client[_0x13ab('0x11')](_0x20be42,_0x565bbf)[_0x13ab('0x12')](function(_0x1350bc){logger[_0x13ab('0x13')]('WhatsappInteraction,\x20%s,\x20%s',_0x52b394,_0x13ab('0x14'));logger['debug'](_0x13ab('0x15'),_0x52b394,_0x13ab('0x14'),JSON[_0x13ab('0x16')](_0x1350bc));if(_0x1350bc[_0x13ab('0x17')]){if(_0x1350bc['error'][_0x13ab('0x18')]===0x1f4){logger[_0x13ab('0x17')](_0x13ab('0x19'),_0x52b394,_0x1350bc['error'][_0x13ab('0x1a')]);return _0xef9e22(_0x1350bc[_0x13ab('0x17')][_0x13ab('0x1a')]);}logger[_0x13ab('0x17')]('WhatsappInteraction,\x20%s,\x20%s',_0x52b394,_0x1350bc['error'][_0x13ab('0x1a')]);return _0x155585(_0x1350bc[_0x13ab('0x17')]['message']);}else{logger['info'](_0x13ab('0x19'),_0x52b394,'request\x20sent');_0x155585(_0x1350bc['result']['message']);}})[_0x13ab('0x1b')](function(_0x2ccfd0){logger[_0x13ab('0x17')](_0x13ab('0x19'),_0x52b394,_0x2ccfd0);_0xef9e22(_0x2ccfd0);});});}exports[_0x13ab('0x1c')]=function(_0x44a237){var _0x550179=this;return new Promise(function(_0x4d6a8e,_0x2e02aa){return db[_0x13ab('0x1d')][_0x13ab('0x1e')](_0x44a237[_0x13ab('0x1f')],{'raw':_0x44a237[_0x13ab('0x20')]?_0x44a237[_0x13ab('0x20')][_0x13ab('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x44a237[_0x13ab('0x20')]?_0x44a237[_0x13ab('0x20')][_0x13ab('0x22')]||null:null,'attributes':_0x44a237['options']?_0x44a237[_0x13ab('0x20')][_0x13ab('0x23')]||null:null,'limit':_0x44a237[_0x13ab('0x20')]?_0x44a237[_0x13ab('0x20')][_0x13ab('0x24')]||null:null})[_0x13ab('0x12')](function(_0x32dccc){logger[_0x13ab('0x13')](_0x13ab('0x1c'),_0x44a237);logger['debug']('UpdateWhatsappInteraction',_0x44a237,JSON[_0x13ab('0x16')](_0x32dccc));_0x4d6a8e(_0x32dccc);})[_0x13ab('0x1b')](function(_0x3ef4e4){logger[_0x13ab('0x17')]('UpdateWhatsappInteraction',_0x3ef4e4[_0x13ab('0x1a')],_0x44a237);_0x2e02aa(_0x550179['error'](0x1f4,_0x3ef4e4[_0x13ab('0x1a')]));});});};exports[_0x13ab('0x25')]=function(_0x23a2f8){return new Promise(function(_0x3eabba,_0x34c1ae){return db[_0x13ab('0x1d')][_0x13ab('0x26')]({'where':_0x23a2f8['options']?_0x23a2f8[_0x13ab('0x20')][_0x13ab('0x22')]||null:null})[_0x13ab('0x12')](function(_0x145999){if(_0x145999){return _0x145999[_0x13ab('0x27')](_0x23a2f8[_0x13ab('0x1f')][_0x13ab('0x28')],_['omit'](_0x23a2f8['body'],[_0x13ab('0x28'),'id'])||{});}})[_0x13ab('0x29')](function(_0x42b275){logger[_0x13ab('0x13')](_0x13ab('0x2a'),_0x23a2f8);logger[_0x13ab('0x2b')](_0x13ab('0x2a'),_0x23a2f8,JSON[_0x13ab('0x16')](_0x42b275));_0x3eabba(_0x42b275);})[_0x13ab('0x1b')](function(_0xca2942){logger['error'](_0x13ab('0x2a'),_0xca2942[_0x13ab('0x1a')],_0x23a2f8);_0x34c1ae(_this[_0x13ab('0x17')](0x1f4,_0xca2942['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 8efdd5e..d3b6f69 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 _0x3c3d=['removeListener','register','length','remove','emit'];(function(_0x3763da,_0x58158b){var _0x5d192f=function(_0x329668){while(--_0x329668){_0x3763da['push'](_0x3763da['shift']());}};_0x5d192f(++_0x58158b);}(_0x3c3d,0xd5));var _0xd3c3=function(_0x13d6f3,_0xec837c){_0x13d6f3=_0x13d6f3-0x0;var _0x17a727=_0x3c3d[_0x13d6f3];return _0x17a727;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=['save',_0xd3c3('0x0'),'update'];function createListener(_0x34da31,_0x9d1309){return function(_0xcb0d9c){_0x9d1309[_0xd3c3('0x1')](_0x34da31,_0xcb0d9c);};}function removeListener(_0x4e36cf,_0x3fdcab){return function(){WhatsappInteractionEvents[_0xd3c3('0x2')](_0x4e36cf,_0x3fdcab);};}exports[_0xd3c3('0x3')]=function(_0xaf1acd){for(var _0x4fb19d=0x0,_0x2db683=events[_0xd3c3('0x4')];_0x4fb19d<_0x2db683;_0x4fb19d++){var _0x1f60d8=events[_0x4fb19d];var _0x4bc0d9=createListener('whatsappInteraction:'+_0x1f60d8,_0xaf1acd);WhatsappInteractionEvents['on'](_0x1f60d8,_0x4bc0d9);}}; \ No newline at end of file +var _0xa87c=['emit','register','length','save','remove','update'];(function(_0x9586a3,_0x293751){var _0x37780d=function(_0x5a1e9d){while(--_0x5a1e9d){_0x9586a3['push'](_0x9586a3['shift']());}};_0x37780d(++_0x293751);}(_0xa87c,0x1b9));var _0xca87=function(_0x417774,_0x1b95e6){_0x417774=_0x417774-0x0;var _0x10015d=_0xa87c[_0x417774];return _0x10015d;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=[_0xca87('0x0'),_0xca87('0x1'),_0xca87('0x2')];function createListener(_0x7e6a70,_0x523fae){return function(_0x5ade28){_0x523fae[_0xca87('0x3')](_0x7e6a70,_0x5ade28);};}function removeListener(_0x2a2c29,_0x73db){return function(){WhatsappInteractionEvents['removeListener'](_0x2a2c29,_0x73db);};}exports[_0xca87('0x4')]=function(_0xe31a64){for(var _0x544be3=0x0,_0x2262f6=events[_0xca87('0x5')];_0x544be3<_0x2262f6;_0x544be3++){var _0x3d89f9=events[_0x544be3];var _0x73458e=createListener('whatsappInteraction:'+_0x3d89f9,_0xe31a64);WhatsappInteractionEvents['on'](_0x3d89f9,_0x73458e);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 2c50209..2e43c87 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 _0xebf9=['post','tracked','whatsapp','whatsappmessage:create','/:id/status','status','put','update','/:id/accept','accept','/:id/reject','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappMessage.controller','get','isAuthenticated','/describe','describe','/:id','show'];(function(_0x1de8e4,_0x5116ae){var _0x4d8b13=function(_0x18a6e7){while(--_0x18a6e7){_0x1de8e4['push'](_0x1de8e4['shift']());}};_0x4d8b13(++_0x5116ae);}(_0xebf9,0xd1));var _0x9ebf=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xebf9[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x9ebf('0x0'));var util=require(_0x9ebf('0x1'));var path=require('path');var timeout=require(_0x9ebf('0x2'));var express=require(_0x9ebf('0x3'));var router=express[_0x9ebf('0x4')]();var fs_extra=require(_0x9ebf('0x5'));var auth=require(_0x9ebf('0x6'));var interaction=require(_0x9ebf('0x7'));var config=require('../../config/environment');var controller=require(_0x9ebf('0x8'));router[_0x9ebf('0x9')]('/',auth[_0x9ebf('0xa')](),controller['index']);router[_0x9ebf('0x9')](_0x9ebf('0xb'),auth[_0x9ebf('0xa')](),controller[_0x9ebf('0xc')]);router[_0x9ebf('0x9')](_0x9ebf('0xd'),auth[_0x9ebf('0xa')](),controller[_0x9ebf('0xe')]);router[_0x9ebf('0xf')]('/',auth[_0x9ebf('0xa')](),interaction[_0x9ebf('0x10')](_0x9ebf('0x11'),_0x9ebf('0x12')),controller['create']);router[_0x9ebf('0xf')](_0x9ebf('0x13'),controller[_0x9ebf('0x14')]);router[_0x9ebf('0x15')](_0x9ebf('0xd'),auth[_0x9ebf('0xa')](),controller[_0x9ebf('0x16')]);router[_0x9ebf('0x15')](_0x9ebf('0x17'),auth[_0x9ebf('0xa')](),controller[_0x9ebf('0x18')]);router[_0x9ebf('0x15')](_0x9ebf('0x19'),auth[_0x9ebf('0xa')](),controller['reject']);router[_0x9ebf('0x1a')](_0x9ebf('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x9ebf('0x1b')]=router; \ No newline at end of file +var _0xc6ad=['../../config/environment','get','isAuthenticated','index','describe','/:id','post','tracked','whatsapp','whatsappmessage:create','create','put','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0xc6ad,0x116));var _0xdc6a=function(_0x154865,_0x4f8bc8){_0x154865=_0x154865-0x0;var _0x3a748f=_0xc6ad[_0x154865];return _0x3a748f;};'use strict';var multer=require(_0xdc6a('0x0'));var util=require(_0xdc6a('0x1'));var path=require(_0xdc6a('0x2'));var timeout=require(_0xdc6a('0x3'));var express=require('express');var router=express[_0xdc6a('0x4')]();var fs_extra=require(_0xdc6a('0x5'));var auth=require(_0xdc6a('0x6'));var interaction=require(_0xdc6a('0x7'));var config=require(_0xdc6a('0x8'));var controller=require('./whatsappMessage.controller');router[_0xdc6a('0x9')]('/',auth[_0xdc6a('0xa')](),controller[_0xdc6a('0xb')]);router[_0xdc6a('0x9')]('/describe',auth[_0xdc6a('0xa')](),controller[_0xdc6a('0xc')]);router[_0xdc6a('0x9')](_0xdc6a('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xdc6a('0xe')]('/',auth[_0xdc6a('0xa')](),interaction[_0xdc6a('0xf')](_0xdc6a('0x10'),_0xdc6a('0x11')),controller[_0xdc6a('0x12')]);router[_0xdc6a('0xe')]('/:id/status',controller['status']);router[_0xdc6a('0x13')](_0xdc6a('0xd'),auth[_0xdc6a('0xa')](),controller['update']);router[_0xdc6a('0x13')](_0xdc6a('0x14'),auth[_0xdc6a('0xa')](),controller[_0xdc6a('0x15')]);router[_0xdc6a('0x13')](_0xdc6a('0x16'),auth[_0xdc6a('0xa')](),controller[_0xdc6a('0x17')]);router[_0xdc6a('0x18')](_0xdc6a('0xd'),auth[_0xdc6a('0xa')](),controller[_0xdc6a('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index f8f86e4..315fe9c 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 _0x6873=['ENUM','out','STRING','DATE','TEXT','medium','BOOLEAN'];(function(_0x4cce81,_0x252735){var _0xad14bc=function(_0x53bc1e){while(--_0x53bc1e){_0x4cce81['push'](_0x4cce81['shift']());}};_0xad14bc(++_0x252735);}(_0x6873,0xac));var _0x3687=function(_0x5b3b9b,_0x1c71b0){_0x5b3b9b=_0x5b3b9b-0x0;var _0x47c1d7=_0x6873[_0x5b3b9b];return _0x47c1d7;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0x3687('0x0')](_0x3687('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x3687('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x3687('0x3')]('in',_0x3687('0x4')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x3687('0x5')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x3687('0x6')]},'secret':{'type':Sequelize[_0x3687('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x3687('0x0')]}}; \ No newline at end of file +var _0x4784=['BOOLEAN','ENUM','out','STRING','sequelize','exports','TEXT','medium'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0x4784,0xe4));var _0x4478=function(_0x484783,_0xf091){_0x484783=_0x484783-0x0;var _0x219b5c=_0x4784[_0x484783];return _0x219b5c;};'use strict';var Sequelize=require(_0x4478('0x0'));module[_0x4478('0x1')]={'body':{'type':Sequelize[_0x4478('0x2')](_0x4478('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x4478('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x4478('0x5')]('in','out'),'defaultValue':_0x4478('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x4478('0x7')](0xbe)},'phone':{'type':Sequelize[_0x4478('0x7')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x4478('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x4478('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index e5e5456..743e4b4 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 _0xf4f9=['client','http','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','code','message','catch','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','update','end','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','WhatsappMessage','includeAll','include','rows','params','keys','intersection','find','create','body','describe','../../config/logger','whatsapp-interactions','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','WhatsappInteraction','WhatsappInteractionId','isNil','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','User','agent','fullname','email','manual','interface','SIP/%s','motionChannel','channel','EventManager','acceptmessage','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','internal','event','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise'];(function(_0x2f2007,_0x2cb278){var _0xab1349=function(_0x5742e3){while(--_0x5742e3){_0x2f2007['push'](_0x2f2007['shift']());}};_0xab1349(++_0x2cb278);}(_0xf4f9,0x6c));var _0x9f4f=function(_0x1974c0,_0x361d0a){_0x1974c0=_0x1974c0-0x0;var _0x24918b=_0xf4f9[_0x1974c0];return _0x24918b;};'use strict';var emlformat=require(_0x9f4f('0x0'));var rimraf=require(_0x9f4f('0x1'));var zipdir=require(_0x9f4f('0x2'));var jsonpatch=require(_0x9f4f('0x3'));var rp=require(_0x9f4f('0x4'));var moment=require('moment');var BPromise=require(_0x9f4f('0x5'));var Mustache=require(_0x9f4f('0x6'));var util=require(_0x9f4f('0x7'));var path=require('path');var sox=require(_0x9f4f('0x8'));var csv=require(_0x9f4f('0x9'));var ejs=require(_0x9f4f('0xa'));var fs=require('fs');var fs_extra=require(_0x9f4f('0xb'));var _=require(_0x9f4f('0xc'));var squel=require(_0x9f4f('0xd'));var crypto=require(_0x9f4f('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x9f4f('0xf'));var toCsv=require(_0x9f4f('0x9'));var querystring=require('querystring');var Papa=require(_0x9f4f('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9f4f('0x11'));var as=require(_0x9f4f('0x12'));var hardwareService=require(_0x9f4f('0x13'));var logger=require('../../config/logger')(_0x9f4f('0x14'));var utils=require(_0x9f4f('0x15'));var config=require(_0x9f4f('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x9f4f('0x17'))['db'];config[_0x9f4f('0x18')]=_[_0x9f4f('0x19')](config[_0x9f4f('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x9f4f('0x1a'))(new Redis(config['redis']));require(_0x9f4f('0x1b'))[_0x9f4f('0x1c')](socket);var jayson=require(_0x9f4f('0x1d'));var client=jayson[_0x9f4f('0x1e')][_0x9f4f('0x1f')]({'port':0x232c});var client9002=jayson[_0x9f4f('0x1e')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4d5164,_0x4f74ea,_0x3c772d,_0x357ae1){return new BPromise(function(_0x49c1c6,_0x26922c){var _0x293659=_0x357ae1||client;return _0x293659['request'](_0x4d5164,_0x3c772d)[_0x9f4f('0x20')](function(_0x5227b0){logger[_0x9f4f('0x21')](_0x9f4f('0x22'),_0x4f74ea,_0x9f4f('0x23'));logger[_0x9f4f('0x24')](_0x9f4f('0x25'),_0x4f74ea,_0x9f4f('0x23'),JSON['stringify'](_0x5227b0));if(_0x5227b0[_0x9f4f('0x26')]){if(_0x5227b0[_0x9f4f('0x26')][_0x9f4f('0x27')]===0x1f4){logger[_0x9f4f('0x26')](_0x9f4f('0x22'),_0x4f74ea,_0x5227b0[_0x9f4f('0x26')][_0x9f4f('0x28')]);return _0x26922c(_0x5227b0[_0x9f4f('0x26')][_0x9f4f('0x28')]);}logger[_0x9f4f('0x26')](_0x9f4f('0x22'),_0x4f74ea,_0x5227b0[_0x9f4f('0x26')][_0x9f4f('0x28')]);return _0x49c1c6(_0x5227b0[_0x9f4f('0x26')][_0x9f4f('0x28')]);}else{logger[_0x9f4f('0x21')]('WhatsappMessage,\x20%s,\x20%s',_0x4f74ea,'request\x20sent');_0x49c1c6(_0x5227b0['result'][_0x9f4f('0x28')]);}})[_0x9f4f('0x29')](function(_0x25766b){logger[_0x9f4f('0x26')](_0x9f4f('0x22'),_0x4f74ea,_0x25766b);_0x26922c(_0x25766b);});});}function respondWithStatusCode(_0x20a2e1,_0x173745){_0x173745=_0x173745||0xcc;return function(_0x2bcd84){if(_0x2bcd84){return _0x20a2e1[_0x9f4f('0x2a')](_0x173745);}return _0x20a2e1['status'](_0x173745)['end']();};}function respondWithResult(_0x373374,_0x40d928){_0x40d928=_0x40d928||0xc8;return function(_0x16dc70){if(_0x16dc70){return _0x373374[_0x9f4f('0x2b')](_0x40d928)[_0x9f4f('0x2c')](_0x16dc70);}};}function respondWithFilteredResult(_0x4c19f0,_0x4599fe){return function(_0x162c7c){if(_0x162c7c){var _0x3d762f=typeof _0x4599fe[_0x9f4f('0x2d')]===_0x9f4f('0x2e')&&typeof _0x4599fe[_0x9f4f('0x2f')]==='undefined';var _0x533ecb=_0x162c7c['count'];var _0x4b4293=_0x3d762f?0x0:_0x4599fe['offset'];var _0x5c176b=_0x3d762f?_0x162c7c[_0x9f4f('0x30')]:_0x4599fe['offset']+_0x4599fe[_0x9f4f('0x2f')];var _0x3d769e;if(_0x5c176b>=_0x533ecb){_0x5c176b=_0x533ecb;_0x3d769e=0xc8;}else{_0x3d769e=0xce;}_0x4c19f0[_0x9f4f('0x2b')](_0x3d769e);return _0x4c19f0[_0x9f4f('0x31')]('Content-Range',_0x4b4293+'-'+_0x5c176b+'/'+_0x533ecb)[_0x9f4f('0x2c')](_0x162c7c);}return null;};}function patchUpdates(_0x486b0a){return function(_0x28a2ac){try{jsonpatch[_0x9f4f('0x32')](_0x28a2ac,_0x486b0a,!![]);}catch(_0x296af9){return BPromise[_0x9f4f('0x33')](_0x296af9);}return _0x28a2ac['save']();};}function saveUpdates(_0x4d73f8,_0x2f0f70){return function(_0x3d296a){if(_0x3d296a){return _0x3d296a[_0x9f4f('0x34')](_0x4d73f8)[_0x9f4f('0x20')](function(_0xd11712){return _0xd11712;});}return null;};}function removeEntity(_0x1618d6,_0x5885e0){return function(_0x156914){if(_0x156914){return _0x156914['destroy']()[_0x9f4f('0x20')](function(){_0x1618d6[_0x9f4f('0x2b')](0xcc)[_0x9f4f('0x35')]();});}};}function handleEntityNotFound(_0x358cbb,_0x156113){return function(_0x21074d){if(!_0x21074d){_0x358cbb[_0x9f4f('0x2a')](0x194);}return _0x21074d;};}function handleError(_0x2dba8d,_0x58fe8d){_0x58fe8d=_0x58fe8d||0x1f4;return function(_0x1cc2c6){logger[_0x9f4f('0x26')](_0x1cc2c6[_0x9f4f('0x36')]);if(_0x1cc2c6[_0x9f4f('0x37')]){delete _0x1cc2c6[_0x9f4f('0x37')];}_0x2dba8d[_0x9f4f('0x2b')](_0x58fe8d)[_0x9f4f('0x38')](_0x1cc2c6);};}exports[_0x9f4f('0x39')]=function(_0x264372,_0x15eb5c){var _0xcee98a={},_0x11058d={},_0x57d08d={'count':0x0,'rows':[]};var _0xd363a=_[_0x9f4f('0x3a')](db['WhatsappMessage'][_0x9f4f('0x3b')],function(_0x53e7c3){return{'name':_0x53e7c3[_0x9f4f('0x3c')],'type':_0x53e7c3[_0x9f4f('0x3d')]['key']};});_0x11058d[_0x9f4f('0x3e')]=_['map'](_0xd363a,_0x9f4f('0x37'));_0x11058d[_0x9f4f('0x3f')]=_['keys'](_0x264372['query']);_0x11058d[_0x9f4f('0x40')]=_['intersection'](_0x11058d['model'],_0x11058d[_0x9f4f('0x3f')]);_0xcee98a['attributes']=_['intersection'](_0x11058d[_0x9f4f('0x3e')],qs[_0x9f4f('0x41')](_0x264372[_0x9f4f('0x3f')][_0x9f4f('0x41')]));_0xcee98a[_0x9f4f('0x42')]=_0xcee98a[_0x9f4f('0x42')][_0x9f4f('0x43')]?_0xcee98a[_0x9f4f('0x42')]:_0x11058d[_0x9f4f('0x3e')];if(!_0x264372['query'][_0x9f4f('0x44')](_0x9f4f('0x45'))){_0xcee98a[_0x9f4f('0x2f')]=qs[_0x9f4f('0x2f')](_0x264372['query'][_0x9f4f('0x2f')]);_0xcee98a[_0x9f4f('0x2d')]=qs[_0x9f4f('0x2d')](_0x264372[_0x9f4f('0x3f')][_0x9f4f('0x2d')]);}_0xcee98a[_0x9f4f('0x46')]=qs[_0x9f4f('0x47')](_0x264372[_0x9f4f('0x3f')]['sort']);_0xcee98a[_0x9f4f('0x48')]=qs[_0x9f4f('0x40')](_[_0x9f4f('0x49')](_0x264372[_0x9f4f('0x3f')],_0x11058d[_0x9f4f('0x40')]),_0xd363a);if(_0x264372[_0x9f4f('0x3f')][_0x9f4f('0x4a')]){_0xcee98a[_0x9f4f('0x48')]=_[_0x9f4f('0x4b')](_0xcee98a[_0x9f4f('0x48')],{'$or':_[_0x9f4f('0x3a')](_0xd363a,function(_0x28a7b2){if(_0x28a7b2[_0x9f4f('0x3d')]!==_0x9f4f('0x4c')){var _0x325fc0={};_0x325fc0[_0x28a7b2['name']]={'$like':'%'+_0x264372[_0x9f4f('0x3f')][_0x9f4f('0x4a')]+'%'};return _0x325fc0;}})});}_0xcee98a=_[_0x9f4f('0x4b')]({},_0xcee98a,_0x264372[_0x9f4f('0x4d')]);var _0x40852b={'where':_0xcee98a[_0x9f4f('0x48')]};return db[_0x9f4f('0x4e')][_0x9f4f('0x30')](_0x40852b)[_0x9f4f('0x20')](function(_0x43578a){_0x57d08d[_0x9f4f('0x30')]=_0x43578a;if(_0x264372[_0x9f4f('0x3f')][_0x9f4f('0x4f')]){_0xcee98a[_0x9f4f('0x50')]=[{'all':!![]}];}return db[_0x9f4f('0x4e')]['findAll'](_0xcee98a);})[_0x9f4f('0x20')](function(_0x6c668c){_0x57d08d[_0x9f4f('0x51')]=_0x6c668c;return _0x57d08d;})[_0x9f4f('0x20')](respondWithFilteredResult(_0x15eb5c,_0xcee98a))[_0x9f4f('0x29')](handleError(_0x15eb5c,null));};exports['show']=function(_0x7d7062,_0x14077e){var _0x3dd915={'raw':!![],'where':{'id':_0x7d7062[_0x9f4f('0x52')]['id']}},_0x37ac3d={};_0x37ac3d[_0x9f4f('0x3e')]=_[_0x9f4f('0x53')](db[_0x9f4f('0x4e')]['rawAttributes']);_0x37ac3d[_0x9f4f('0x3f')]=_[_0x9f4f('0x53')](_0x7d7062[_0x9f4f('0x3f')]);_0x37ac3d[_0x9f4f('0x40')]=_[_0x9f4f('0x54')](_0x37ac3d[_0x9f4f('0x3e')],_0x37ac3d[_0x9f4f('0x3f')]);_0x3dd915[_0x9f4f('0x42')]=_[_0x9f4f('0x54')](_0x37ac3d[_0x9f4f('0x3e')],qs[_0x9f4f('0x41')](_0x7d7062['query'][_0x9f4f('0x41')]));_0x3dd915[_0x9f4f('0x42')]=_0x3dd915['attributes']['length']?_0x3dd915['attributes']:_0x37ac3d['model'];if(_0x7d7062['query'][_0x9f4f('0x4f')]){_0x3dd915[_0x9f4f('0x50')]=[{'all':!![]}];}_0x3dd915=_[_0x9f4f('0x4b')]({},_0x3dd915,_0x7d7062[_0x9f4f('0x4d')]);return db[_0x9f4f('0x4e')][_0x9f4f('0x55')](_0x3dd915)['then'](handleEntityNotFound(_0x14077e,null))[_0x9f4f('0x20')](respondWithResult(_0x14077e,null))[_0x9f4f('0x29')](handleError(_0x14077e,null));};exports[_0x9f4f('0x56')]=function(_0x5b7f1c,_0x3da070){return db[_0x9f4f('0x4e')][_0x9f4f('0x56')](_0x5b7f1c[_0x9f4f('0x57')],{})[_0x9f4f('0x20')](respondWithResult(_0x3da070,0xc9))[_0x9f4f('0x29')](handleError(_0x3da070,null));};exports[_0x9f4f('0x34')]=function(_0x13d510,_0x4aad0f){if(_0x13d510[_0x9f4f('0x57')]['id']){delete _0x13d510[_0x9f4f('0x57')]['id'];}return db[_0x9f4f('0x4e')]['find']({'where':{'id':_0x13d510[_0x9f4f('0x52')]['id']}})['then'](handleEntityNotFound(_0x4aad0f,null))['then'](saveUpdates(_0x13d510[_0x9f4f('0x57')],null))['then'](respondWithResult(_0x4aad0f,null))[_0x9f4f('0x29')](handleError(_0x4aad0f,null));};exports['destroy']=function(_0x4505f3,_0x4ddadb){return db[_0x9f4f('0x4e')][_0x9f4f('0x55')]({'where':{'id':_0x4505f3[_0x9f4f('0x52')]['id']}})['then'](handleEntityNotFound(_0x4ddadb,null))[_0x9f4f('0x20')](removeEntity(_0x4ddadb,null))[_0x9f4f('0x29')](handleError(_0x4ddadb,null));};exports[_0x9f4f('0x58')]=function(_0x28a89d,_0x56e03d){return db[_0x9f4f('0x4e')][_0x9f4f('0x58')]()[_0x9f4f('0x20')](respondWithResult(_0x56e03d,null))['catch'](handleError(_0x56e03d,null));};var interaction_log=require(_0x9f4f('0x59'))(_0x9f4f('0x5a'));exports[_0x9f4f('0x5b')]=function(_0x5e6b67,_0x5984e8,_0x10c32b){var _0x52fd5a={'agent':{},'channel':'whatsapp'};if(_0x5e6b67[_0x9f4f('0x57')]['id']){delete _0x5e6b67[_0x9f4f('0x57')]['id'];}_0x5e6b67[_0x9f4f('0x57')][_0x9f4f('0x5c')]=!![];_0x5e6b67[_0x9f4f('0x57')][_0x9f4f('0x5d')]=moment()[_0x9f4f('0x5e')](_0x9f4f('0x5f'));_0x5e6b67[_0x9f4f('0x57')][_0x9f4f('0x60')]=_0x5e6b67[_0x9f4f('0x57')]['UserId']||_0x5e6b67[_0x9f4f('0x61')]['id'];_0x52fd5a['agent']['id']=_0x5e6b67[_0x9f4f('0x57')]['UserId'];return db[_0x9f4f('0x4e')][_0x9f4f('0x55')]({'where':{'id':_0x5e6b67[_0x9f4f('0x52')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5984e8,null))[_0x9f4f('0x20')](saveUpdates(_0x5e6b67['body'],null))['then'](function(_0x31ac49){if(_0x31ac49){_0x52fd5a[_0x9f4f('0x28')]=_0x31ac49[_0x9f4f('0x62')]({'plain':!![]});return db[_0x9f4f('0x63')][_0x9f4f('0x55')]({'where':{'id':_0x31ac49[_0x9f4f('0x64')]}});}return null;})['then'](handleEntityNotFound(_0x5984e8,null))[_0x9f4f('0x20')](function(_0x481fd6){if(_0x481fd6){return _0x481fd6[_0x9f4f('0x34')]({'UserId':_0x5e6b67[_0x9f4f('0x57')][_0x9f4f('0x60')],'read1stAt':_[_0x9f4f('0x65')](_0x481fd6['read1stAt'])?moment()[_0x9f4f('0x5e')](_0x9f4f('0x5f')):undefined});}return null;})[_0x9f4f('0x20')](function(_0x559938){if(_0x559938){_0x52fd5a[_0x9f4f('0x66')]=_0x559938[_0x9f4f('0x62')]({'plain':!![]});interaction_log[_0x9f4f('0x21')](_0x9f4f('0x67'),_0x5e6b67[_0x9f4f('0x61')]['id'],_0x5e6b67[_0x9f4f('0x61')]['name'],_0x5e6b67[_0x9f4f('0x61')][_0x9f4f('0x68')],_0x52fd5a['interaction']['id'],_0x5e6b67[_0x9f4f('0x57')]?JSON[_0x9f4f('0x69')](_0x5e6b67[_0x9f4f('0x57')]):_0x9f4f('0x6a'));return respondWithRpcPromise(_0x9f4f('0x6b'),'acceptMessage',_0x52fd5a);}return null;})[_0x9f4f('0x20')](function(_0x4d7604){var _0x114b96=_0x9f4f('0x6c')+_0x4d7604[_0x9f4f('0x28')][_0x9f4f('0x6d')];return db[_0x9f4f('0x6e')]['query'](_0x114b96,{'type':db[_0x9f4f('0x6f')]['QueryTypes'][_0x9f4f('0x70')],'raw':!![]})['then'](function(_0x1d9dfe){return _0x1d9dfe;});})[_0x9f4f('0x20')](function(_0x533a55){if(_0x533a55){_0x52fd5a['message'][_0x9f4f('0x71')]=_0x533a55[0x0];if(!_0x5e6b67[_0x9f4f('0x57')][_0x9f4f('0x60')])return;return db[_0x9f4f('0x72')][_0x9f4f('0x55')]({'where':{'id':_0x5e6b67[_0x9f4f('0x57')][_0x9f4f('0x60')],'role':_0x9f4f('0x73')},'attributes':['id',_0x9f4f('0x37'),_0x9f4f('0x74'),_0x9f4f('0x75'),'internal'],'raw':!![]});}return null;})[_0x9f4f('0x20')](function(_0x2d0949){if(!_0x2d0949)return null;_0x52fd5a[_0x9f4f('0x28')][_0x9f4f('0x73')]=_0x2d0949;return _0x52fd5a;})[_0x9f4f('0x20')](function(_0x420e66){if(_0x420e66){if(_0x5e6b67[_0x9f4f('0x57')][_0x9f4f('0x76')]){_0x52fd5a[_0x9f4f('0x28')][_0x9f4f('0x77')]=util['format'](_0x9f4f('0x78'),_0x5e6b67['user'][_0x9f4f('0x37')]);_0x52fd5a['message']['channel']=_0x52fd5a['channel'];_0x52fd5a[_0x9f4f('0x28')][_0x9f4f('0x79')]=_0x52fd5a[_0x9f4f('0x7a')];_0x52fd5a[_0x9f4f('0x28')]['event']=_0x9f4f('0x5b');return respondWithRpcPromise(_0x9f4f('0x7b'),_0x9f4f('0x7b'),{'event':_0x9f4f('0x7c'),'message':_0x52fd5a[_0x9f4f('0x28')]},client9002)[_0x9f4f('0x20')](function(){return _0x52fd5a;});}return _0x52fd5a;}return null;})['then'](respondWithResult(_0x5984e8,null))[_0x9f4f('0x29')](handleError(_0x5984e8,null));};var interaction_log=require('../../config/logger')(_0x9f4f('0x5a'));exports['reject']=function(_0x7bcc91,_0x105667,_0x22b48d){var _0x578792={'agent':{},'channel':'whatsapp'};if(_0x7bcc91['body']['id']){delete _0x7bcc91[_0x9f4f('0x57')]['id'];}_0x7bcc91[_0x9f4f('0x57')][_0x9f4f('0x60')]=_0x7bcc91['body'][_0x9f4f('0x60')]||_0x7bcc91['user']['id'];_0x578792[_0x9f4f('0x73')]['id']=_0x7bcc91[_0x9f4f('0x57')]['UserId'];return db['WhatsappMessage'][_0x9f4f('0x55')]({'where':{'id':_0x7bcc91[_0x9f4f('0x52')]['id'],'UserId':null}})[_0x9f4f('0x20')](handleEntityNotFound(_0x105667,null))[_0x9f4f('0x20')](function(_0x10dfb6){if(_0x10dfb6){_0x578792[_0x9f4f('0x28')]=_0x10dfb6[_0x9f4f('0x62')]({'plain':!![]});return db[_0x9f4f('0x63')][_0x9f4f('0x55')]({'where':{'id':_0x10dfb6[_0x9f4f('0x64')]}});}return null;})['then'](handleEntityNotFound(_0x105667,null))[_0x9f4f('0x20')](function(_0x2b4c81){if(_0x2b4c81){_0x578792[_0x9f4f('0x66')]=_0x2b4c81[_0x9f4f('0x62')]({'plain':!![]});interaction_log[_0x9f4f('0x21')](_0x9f4f('0x7d'),_0x7bcc91[_0x9f4f('0x61')]['id'],_0x7bcc91[_0x9f4f('0x61')]['name'],_0x7bcc91[_0x9f4f('0x61')]['role'],_0x578792[_0x9f4f('0x66')]['id'],_0x7bcc91[_0x9f4f('0x57')]?JSON['stringify'](_0x7bcc91['body']):_0x9f4f('0x6a'));return respondWithRpcPromise(_0x9f4f('0x7e'),_0x9f4f('0x7f'),_0x578792);}return null;})[_0x9f4f('0x20')](function(_0x57b8c2){var _0x11e9eb=_0x9f4f('0x6c')+_0x57b8c2['message']['ContactId'];return db[_0x9f4f('0x6e')][_0x9f4f('0x3f')](_0x11e9eb,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]})[_0x9f4f('0x20')](function(_0x21b7ce){return _0x21b7ce;});})[_0x9f4f('0x20')](function(_0x5408e8){if(_0x5408e8){_0x578792[_0x9f4f('0x28')][_0x9f4f('0x71')]=_0x5408e8[0x0];if(!_0x7bcc91['body'][_0x9f4f('0x60')])return;return db[_0x9f4f('0x72')][_0x9f4f('0x55')]({'where':{'id':_0x7bcc91[_0x9f4f('0x57')][_0x9f4f('0x60')],'role':_0x9f4f('0x73')},'attributes':['id',_0x9f4f('0x37'),'fullname',_0x9f4f('0x75'),_0x9f4f('0x80')],'raw':!![]});}return null;})[_0x9f4f('0x20')](function(_0x364134){if(!_0x364134)return null;_0x578792[_0x9f4f('0x28')][_0x9f4f('0x73')]=_0x364134;return _0x578792;})[_0x9f4f('0x20')](function(_0xf5152f){if(_0xf5152f){_0xf5152f[_0x9f4f('0x28')][_0x9f4f('0x77')]=util[_0x9f4f('0x5e')](_0x9f4f('0x78'),_0x7bcc91[_0x9f4f('0x61')][_0x9f4f('0x37')]);_0xf5152f[_0x9f4f('0x28')]['channel']=_0x578792[_0x9f4f('0x7a')];_0xf5152f[_0x9f4f('0x28')]['motionChannel']=_0x578792[_0x9f4f('0x7a')];_0xf5152f[_0x9f4f('0x28')][_0x9f4f('0x81')]=_0x9f4f('0x33');respondWithRpcPromise('EventManager',_0x9f4f('0x7b'),{'event':'rejectmessage','message':_0xf5152f['message']},client9002);return _0x578792;}return null;})[_0x9f4f('0x20')](respondWithResult(_0x105667,null))[_0x9f4f('0x29')](handleError(_0x105667,null));};exports[_0x9f4f('0x2b')]=function(_0xb94e91,_0x4ca177,_0x3009ae){if(_0xb94e91[_0x9f4f('0x57')]['id']){delete _0xb94e91[_0x9f4f('0x57')]['id'];}var _0x53a10b;return db[_0x9f4f('0x4e')][_0x9f4f('0x55')]({'where':{'id':_0xb94e91[_0x9f4f('0x52')]['id']}})['then'](handleEntityNotFound(_0x4ca177,null))['then'](function(_0x3de383){if(_0x3de383){_0x53a10b=_0x3de383;return db['WhatsappAccount'][_0x9f4f('0x55')]({'where':{'id':_0x3de383[_0x9f4f('0x82')]}});}})[_0x9f4f('0x20')](handleEntityNotFound(_0x4ca177,null))[_0x9f4f('0x20')](function(_0x4d7679){if(_0x4d7679){logger['debug'](_0x9f4f('0x83'),'status','received\x20delivery\x20report\x20from',_0x4d7679[_0x9f4f('0x3d')],util[_0x9f4f('0x84')](_0xb94e91['body'],{'showHidden':![],'depth':null}));switch(_0x4d7679[_0x9f4f('0x3d')]){case _0x9f4f('0x85'):if(_0xb94e91['body']['MessageSid']&&_0xb94e91[_0x9f4f('0x57')][_0x9f4f('0x86')]===_0x53a10b[_0x9f4f('0x87')]&&_0xb94e91[_0x9f4f('0x57')][_0x9f4f('0x88')]&&_0xb94e91[_0x9f4f('0x57')][_0x9f4f('0x88')]===_0x9f4f('0x5c')){return _0x53a10b[_0x9f4f('0x34')]({'read':!![]});}else{logger[_0x9f4f('0x26')](_0x9f4f('0x89'),'status',_0x9f4f('0x85'),util['inspect'](_0xb94e91['body'],{'showHidden':![],'depth':null}));}break;}return _0x53a10b;}})[_0x9f4f('0x20')](respondWithResult(_0x4ca177,null))[_0x9f4f('0x29')](handleError(_0x4ca177,null));}; \ No newline at end of file +var _0x9d2e=['interface','format','SIP/%s','channel','motionChannel','EventManager','acceptmessage','WhatsappInteraction','WhatsappInteractionId','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','QueryTypes','event','rejectmessage','WhatsappAccount','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','register','jayson/promise','client','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','destroy','status','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','WhatsappMessage','count','findAll','rows','catch','show','includeAll','options','find','create','body','describe','accept','whatsapp','read','readAt','UserId','params','get','read1stAt','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','interaction','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','User','agent','fullname','email','internal','manual'];(function(_0x99fa4c,_0x201d04){var _0x5ae8c9=function(_0x4c19cf){while(--_0x4c19cf){_0x99fa4c['push'](_0x99fa4c['shift']());}};_0x5ae8c9(++_0x201d04);}(_0x9d2e,0x1ba));var _0xe9d2=function(_0x50d753,_0x2427b9){_0x50d753=_0x50d753-0x0;var _0xaef6d9=_0x9d2e[_0x50d753];return _0xaef6d9;};'use strict';var emlformat=require(_0xe9d2('0x0'));var rimraf=require(_0xe9d2('0x1'));var zipdir=require(_0xe9d2('0x2'));var jsonpatch=require(_0xe9d2('0x3'));var rp=require(_0xe9d2('0x4'));var moment=require('moment');var BPromise=require(_0xe9d2('0x5'));var Mustache=require(_0xe9d2('0x6'));var util=require('util');var path=require(_0xe9d2('0x7'));var sox=require('sox');var csv=require(_0xe9d2('0x8'));var ejs=require(_0xe9d2('0x9'));var fs=require('fs');var fs_extra=require(_0xe9d2('0xa'));var _=require(_0xe9d2('0xb'));var squel=require(_0xe9d2('0xc'));var crypto=require(_0xe9d2('0xd'));var jsforce=require(_0xe9d2('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xe9d2('0x8'));var querystring=require('querystring');var Papa=require(_0xe9d2('0xf'));var Redis=require(_0xe9d2('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xe9d2('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe9d2('0x12'));var logger=require(_0xe9d2('0x13'))('api');var utils=require(_0xe9d2('0x14'));var config=require(_0xe9d2('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xe9d2('0x16'))['db'];config[_0xe9d2('0x17')]=_[_0xe9d2('0x18')](config[_0xe9d2('0x17')],{'host':_0xe9d2('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe9d2('0x17')]));require('./whatsappMessage.socket')[_0xe9d2('0x1a')](socket);var jayson=require(_0xe9d2('0x1b'));var client=jayson[_0xe9d2('0x1c')]['http']({'port':0x232c});var client9002=jayson[_0xe9d2('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3dc7c8,_0x529bf3,_0x4740a3,_0x1aa7d0){return new BPromise(function(_0x512b77,_0x546dc2){var _0x1939f8=_0x1aa7d0||client;return _0x1939f8[_0xe9d2('0x1d')](_0x3dc7c8,_0x4740a3)[_0xe9d2('0x1e')](function(_0x613402){logger[_0xe9d2('0x1f')](_0xe9d2('0x20'),_0x529bf3,_0xe9d2('0x21'));logger[_0xe9d2('0x22')](_0xe9d2('0x23'),_0x529bf3,_0xe9d2('0x21'),JSON[_0xe9d2('0x24')](_0x613402));if(_0x613402[_0xe9d2('0x25')]){if(_0x613402['error'][_0xe9d2('0x26')]===0x1f4){logger['error'](_0xe9d2('0x20'),_0x529bf3,_0x613402[_0xe9d2('0x25')][_0xe9d2('0x27')]);return _0x546dc2(_0x613402[_0xe9d2('0x25')][_0xe9d2('0x27')]);}logger[_0xe9d2('0x25')]('WhatsappMessage,\x20%s,\x20%s',_0x529bf3,_0x613402[_0xe9d2('0x25')][_0xe9d2('0x27')]);return _0x512b77(_0x613402[_0xe9d2('0x25')][_0xe9d2('0x27')]);}else{logger[_0xe9d2('0x1f')](_0xe9d2('0x20'),_0x529bf3,_0xe9d2('0x21'));_0x512b77(_0x613402['result'][_0xe9d2('0x27')]);}})['catch'](function(_0x382e08){logger[_0xe9d2('0x25')](_0xe9d2('0x20'),_0x529bf3,_0x382e08);_0x546dc2(_0x382e08);});});}function respondWithStatusCode(_0x331d0f,_0x1e3d4f){_0x1e3d4f=_0x1e3d4f||0xcc;return function(_0x172d54){if(_0x172d54){return _0x331d0f['sendStatus'](_0x1e3d4f);}return _0x331d0f['status'](_0x1e3d4f)[_0xe9d2('0x28')]();};}function respondWithResult(_0x4d63cf,_0xf03e04){_0xf03e04=_0xf03e04||0xc8;return function(_0x20c7a1){if(_0x20c7a1){return _0x4d63cf['status'](_0xf03e04)[_0xe9d2('0x29')](_0x20c7a1);}};}function respondWithFilteredResult(_0x31a169,_0x33d11a){return function(_0x1be5c1){if(_0x1be5c1){var _0x28375d=typeof _0x33d11a[_0xe9d2('0x2a')]===_0xe9d2('0x2b')&&typeof _0x33d11a[_0xe9d2('0x2c')]===_0xe9d2('0x2b');var _0x4f7995=_0x1be5c1['count'];var _0x4f2cb4=_0x28375d?0x0:_0x33d11a[_0xe9d2('0x2a')];var _0x35e522=_0x28375d?_0x1be5c1['count']:_0x33d11a[_0xe9d2('0x2a')]+_0x33d11a['limit'];var _0x5d7220;if(_0x35e522>=_0x4f7995){_0x35e522=_0x4f7995;_0x5d7220=0xc8;}else{_0x5d7220=0xce;}_0x31a169['status'](_0x5d7220);return _0x31a169[_0xe9d2('0x2d')](_0xe9d2('0x2e'),_0x4f2cb4+'-'+_0x35e522+'/'+_0x4f7995)[_0xe9d2('0x29')](_0x1be5c1);}return null;};}function patchUpdates(_0xcf8c73){return function(_0x158984){try{jsonpatch[_0xe9d2('0x2f')](_0x158984,_0xcf8c73,!![]);}catch(_0x933d4){return BPromise[_0xe9d2('0x30')](_0x933d4);}return _0x158984[_0xe9d2('0x31')]();};}function saveUpdates(_0x367e06,_0xccea11){return function(_0x4fc9c1){if(_0x4fc9c1){return _0x4fc9c1[_0xe9d2('0x32')](_0x367e06)[_0xe9d2('0x1e')](function(_0xe8264){return _0xe8264;});}return null;};}function removeEntity(_0x3d745a,_0x1456b5){return function(_0x54cc6b){if(_0x54cc6b){return _0x54cc6b[_0xe9d2('0x33')]()['then'](function(){_0x3d745a[_0xe9d2('0x34')](0xcc)[_0xe9d2('0x28')]();});}};}function handleEntityNotFound(_0x253341,_0x32dfba){return function(_0x28d2ef){if(!_0x28d2ef){_0x253341['sendStatus'](0x194);}return _0x28d2ef;};}function handleError(_0x240ea7,_0x434c9c){_0x434c9c=_0x434c9c||0x1f4;return function(_0x17dabd){logger[_0xe9d2('0x25')](_0x17dabd[_0xe9d2('0x35')]);if(_0x17dabd[_0xe9d2('0x36')]){delete _0x17dabd[_0xe9d2('0x36')];}_0x240ea7['status'](_0x434c9c)[_0xe9d2('0x37')](_0x17dabd);};}exports[_0xe9d2('0x38')]=function(_0x5b75e6,_0x2d0eed){var _0x2c130b={},_0x140512={},_0xa7e208={'count':0x0,'rows':[]};var _0x3b0e2e=_['map'](db['WhatsappMessage'][_0xe9d2('0x39')],function(_0x3adb2e){return{'name':_0x3adb2e[_0xe9d2('0x3a')],'type':_0x3adb2e[_0xe9d2('0x3b')][_0xe9d2('0x3c')]};});_0x140512[_0xe9d2('0x3d')]=_[_0xe9d2('0x3e')](_0x3b0e2e,_0xe9d2('0x36'));_0x140512[_0xe9d2('0x3f')]=_[_0xe9d2('0x40')](_0x5b75e6['query']);_0x140512[_0xe9d2('0x41')]=_[_0xe9d2('0x42')](_0x140512[_0xe9d2('0x3d')],_0x140512[_0xe9d2('0x3f')]);_0x2c130b[_0xe9d2('0x43')]=_[_0xe9d2('0x42')](_0x140512[_0xe9d2('0x3d')],qs['fields'](_0x5b75e6[_0xe9d2('0x3f')][_0xe9d2('0x44')]));_0x2c130b[_0xe9d2('0x43')]=_0x2c130b[_0xe9d2('0x43')][_0xe9d2('0x45')]?_0x2c130b[_0xe9d2('0x43')]:_0x140512['model'];if(!_0x5b75e6[_0xe9d2('0x3f')][_0xe9d2('0x46')](_0xe9d2('0x47'))){_0x2c130b['limit']=qs[_0xe9d2('0x2c')](_0x5b75e6['query'][_0xe9d2('0x2c')]);_0x2c130b[_0xe9d2('0x2a')]=qs[_0xe9d2('0x2a')](_0x5b75e6[_0xe9d2('0x3f')][_0xe9d2('0x2a')]);}_0x2c130b[_0xe9d2('0x48')]=qs[_0xe9d2('0x49')](_0x5b75e6[_0xe9d2('0x3f')][_0xe9d2('0x49')]);_0x2c130b[_0xe9d2('0x4a')]=qs[_0xe9d2('0x41')](_[_0xe9d2('0x4b')](_0x5b75e6[_0xe9d2('0x3f')],_0x140512[_0xe9d2('0x41')]),_0x3b0e2e);if(_0x5b75e6[_0xe9d2('0x3f')]['filter']){_0x2c130b[_0xe9d2('0x4a')]=_['merge'](_0x2c130b[_0xe9d2('0x4a')],{'$or':_[_0xe9d2('0x3e')](_0x3b0e2e,function(_0x585340){if(_0x585340[_0xe9d2('0x3b')]!==_0xe9d2('0x4c')){var _0x2a0edf={};_0x2a0edf[_0x585340[_0xe9d2('0x36')]]={'$like':'%'+_0x5b75e6['query'][_0xe9d2('0x4d')]+'%'};return _0x2a0edf;}})});}_0x2c130b=_[_0xe9d2('0x4e')]({},_0x2c130b,_0x5b75e6['options']);var _0x5b4e25={'where':_0x2c130b['where']};return db[_0xe9d2('0x4f')][_0xe9d2('0x50')](_0x5b4e25)['then'](function(_0x5e8c44){_0xa7e208[_0xe9d2('0x50')]=_0x5e8c44;if(_0x5b75e6[_0xe9d2('0x3f')]['includeAll']){_0x2c130b['include']=[{'all':!![]}];}return db['WhatsappMessage'][_0xe9d2('0x51')](_0x2c130b);})['then'](function(_0x458911){_0xa7e208[_0xe9d2('0x52')]=_0x458911;return _0xa7e208;})['then'](respondWithFilteredResult(_0x2d0eed,_0x2c130b))[_0xe9d2('0x53')](handleError(_0x2d0eed,null));};exports[_0xe9d2('0x54')]=function(_0x336fc1,_0x1d6cec){var _0x3cf461={'raw':!![],'where':{'id':_0x336fc1['params']['id']}},_0x21afa8={};_0x21afa8[_0xe9d2('0x3d')]=_[_0xe9d2('0x40')](db[_0xe9d2('0x4f')]['rawAttributes']);_0x21afa8[_0xe9d2('0x3f')]=_['keys'](_0x336fc1['query']);_0x21afa8[_0xe9d2('0x41')]=_[_0xe9d2('0x42')](_0x21afa8[_0xe9d2('0x3d')],_0x21afa8[_0xe9d2('0x3f')]);_0x3cf461[_0xe9d2('0x43')]=_[_0xe9d2('0x42')](_0x21afa8[_0xe9d2('0x3d')],qs[_0xe9d2('0x44')](_0x336fc1[_0xe9d2('0x3f')][_0xe9d2('0x44')]));_0x3cf461['attributes']=_0x3cf461[_0xe9d2('0x43')][_0xe9d2('0x45')]?_0x3cf461[_0xe9d2('0x43')]:_0x21afa8[_0xe9d2('0x3d')];if(_0x336fc1[_0xe9d2('0x3f')][_0xe9d2('0x55')]){_0x3cf461['include']=[{'all':!![]}];}_0x3cf461=_['merge']({},_0x3cf461,_0x336fc1[_0xe9d2('0x56')]);return db[_0xe9d2('0x4f')][_0xe9d2('0x57')](_0x3cf461)[_0xe9d2('0x1e')](handleEntityNotFound(_0x1d6cec,null))[_0xe9d2('0x1e')](respondWithResult(_0x1d6cec,null))['catch'](handleError(_0x1d6cec,null));};exports[_0xe9d2('0x58')]=function(_0x52c126,_0x3201b8){return db['WhatsappMessage'][_0xe9d2('0x58')](_0x52c126[_0xe9d2('0x59')],{})[_0xe9d2('0x1e')](respondWithResult(_0x3201b8,0xc9))[_0xe9d2('0x53')](handleError(_0x3201b8,null));};exports[_0xe9d2('0x32')]=function(_0x524206,_0xc6a976){if(_0x524206['body']['id']){delete _0x524206[_0xe9d2('0x59')]['id'];}return db[_0xe9d2('0x4f')][_0xe9d2('0x57')]({'where':{'id':_0x524206['params']['id']}})[_0xe9d2('0x1e')](handleEntityNotFound(_0xc6a976,null))[_0xe9d2('0x1e')](saveUpdates(_0x524206[_0xe9d2('0x59')],null))[_0xe9d2('0x1e')](respondWithResult(_0xc6a976,null))[_0xe9d2('0x53')](handleError(_0xc6a976,null));};exports[_0xe9d2('0x33')]=function(_0x29acbb,_0x28fecd){return db[_0xe9d2('0x4f')][_0xe9d2('0x57')]({'where':{'id':_0x29acbb['params']['id']}})[_0xe9d2('0x1e')](handleEntityNotFound(_0x28fecd,null))[_0xe9d2('0x1e')](removeEntity(_0x28fecd,null))[_0xe9d2('0x53')](handleError(_0x28fecd,null));};exports[_0xe9d2('0x5a')]=function(_0x2a0ee6,_0xe7039d){return db[_0xe9d2('0x4f')][_0xe9d2('0x5a')]()['then'](respondWithResult(_0xe7039d,null))[_0xe9d2('0x53')](handleError(_0xe7039d,null));};var interaction_log=require(_0xe9d2('0x13'))('whatsapp-interactions');exports[_0xe9d2('0x5b')]=function(_0x26e30d,_0x4abdff,_0x11d339){var _0x1d0b97={'agent':{},'channel':_0xe9d2('0x5c')};if(_0x26e30d[_0xe9d2('0x59')]['id']){delete _0x26e30d[_0xe9d2('0x59')]['id'];}_0x26e30d[_0xe9d2('0x59')][_0xe9d2('0x5d')]=!![];_0x26e30d[_0xe9d2('0x59')][_0xe9d2('0x5e')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x26e30d['body'][_0xe9d2('0x5f')]=_0x26e30d[_0xe9d2('0x59')][_0xe9d2('0x5f')]||_0x26e30d['user']['id'];_0x1d0b97['agent']['id']=_0x26e30d[_0xe9d2('0x59')][_0xe9d2('0x5f')];return db[_0xe9d2('0x4f')]['find']({'where':{'id':_0x26e30d[_0xe9d2('0x60')]['id'],'UserId':null}})[_0xe9d2('0x1e')](handleEntityNotFound(_0x4abdff,null))[_0xe9d2('0x1e')](saveUpdates(_0x26e30d['body'],null))['then'](function(_0x373af0){if(_0x373af0){_0x1d0b97['message']=_0x373af0[_0xe9d2('0x61')]({'plain':!![]});return db['WhatsappInteraction'][_0xe9d2('0x57')]({'where':{'id':_0x373af0['WhatsappInteractionId']}});}return null;})[_0xe9d2('0x1e')](handleEntityNotFound(_0x4abdff,null))[_0xe9d2('0x1e')](function(_0x3dc4e7){if(_0x3dc4e7){return _0x3dc4e7[_0xe9d2('0x32')]({'UserId':_0x26e30d[_0xe9d2('0x59')][_0xe9d2('0x5f')],'read1stAt':_['isNil'](_0x3dc4e7[_0xe9d2('0x62')])?moment()['format'](_0xe9d2('0x63')):undefined});}return null;})[_0xe9d2('0x1e')](function(_0x146e4f){if(_0x146e4f){_0x1d0b97['interaction']=_0x146e4f[_0xe9d2('0x61')]({'plain':!![]});interaction_log['info'](_0xe9d2('0x64'),_0x26e30d[_0xe9d2('0x65')]['id'],_0x26e30d[_0xe9d2('0x65')][_0xe9d2('0x36')],_0x26e30d[_0xe9d2('0x65')][_0xe9d2('0x66')],_0x1d0b97[_0xe9d2('0x67')]['id'],_0x26e30d[_0xe9d2('0x59')]?JSON['stringify'](_0x26e30d['body']):_0xe9d2('0x68'));return respondWithRpcPromise('AcceptMessage',_0xe9d2('0x69'),_0x1d0b97);}return null;})[_0xe9d2('0x1e')](function(_0x2de227){var _0x58863e=_0xe9d2('0x6a')+_0x2de227[_0xe9d2('0x27')][_0xe9d2('0x6b')];return db[_0xe9d2('0x6c')][_0xe9d2('0x3f')](_0x58863e,{'type':db[_0xe9d2('0x6d')]['QueryTypes'][_0xe9d2('0x6e')],'raw':!![]})[_0xe9d2('0x1e')](function(_0x502610){return _0x502610;});})['then'](function(_0x1719be){if(_0x1719be){_0x1d0b97[_0xe9d2('0x27')][_0xe9d2('0x6f')]=_0x1719be[0x0];if(!_0x26e30d[_0xe9d2('0x59')][_0xe9d2('0x5f')])return;return db[_0xe9d2('0x70')]['find']({'where':{'id':_0x26e30d[_0xe9d2('0x59')][_0xe9d2('0x5f')],'role':_0xe9d2('0x71')},'attributes':['id',_0xe9d2('0x36'),_0xe9d2('0x72'),_0xe9d2('0x73'),_0xe9d2('0x74')],'raw':!![]});}return null;})[_0xe9d2('0x1e')](function(_0xb7c09c){if(!_0xb7c09c)return null;_0x1d0b97[_0xe9d2('0x27')][_0xe9d2('0x71')]=_0xb7c09c;return _0x1d0b97;})[_0xe9d2('0x1e')](function(_0x2ac770){if(_0x2ac770){if(_0x26e30d[_0xe9d2('0x59')][_0xe9d2('0x75')]){_0x1d0b97[_0xe9d2('0x27')][_0xe9d2('0x76')]=util[_0xe9d2('0x77')](_0xe9d2('0x78'),_0x26e30d['user']['name']);_0x1d0b97[_0xe9d2('0x27')][_0xe9d2('0x79')]=_0x1d0b97[_0xe9d2('0x79')];_0x1d0b97[_0xe9d2('0x27')][_0xe9d2('0x7a')]=_0x1d0b97[_0xe9d2('0x79')];_0x1d0b97['message']['event']='accept';return respondWithRpcPromise(_0xe9d2('0x7b'),_0xe9d2('0x7b'),{'event':_0xe9d2('0x7c'),'message':_0x1d0b97[_0xe9d2('0x27')]},client9002)[_0xe9d2('0x1e')](function(){return _0x1d0b97;});}return _0x1d0b97;}return null;})['then'](respondWithResult(_0x4abdff,null))[_0xe9d2('0x53')](handleError(_0x4abdff,null));};var interaction_log=require(_0xe9d2('0x13'))('whatsapp-interactions');exports[_0xe9d2('0x30')]=function(_0x1eb9d9,_0x5b3b0d,_0xab6663){var _0x5d0ded={'agent':{},'channel':_0xe9d2('0x5c')};if(_0x1eb9d9[_0xe9d2('0x59')]['id']){delete _0x1eb9d9[_0xe9d2('0x59')]['id'];}_0x1eb9d9[_0xe9d2('0x59')][_0xe9d2('0x5f')]=_0x1eb9d9[_0xe9d2('0x59')][_0xe9d2('0x5f')]||_0x1eb9d9[_0xe9d2('0x65')]['id'];_0x5d0ded[_0xe9d2('0x71')]['id']=_0x1eb9d9[_0xe9d2('0x59')][_0xe9d2('0x5f')];return db[_0xe9d2('0x4f')][_0xe9d2('0x57')]({'where':{'id':_0x1eb9d9[_0xe9d2('0x60')]['id'],'UserId':null}})[_0xe9d2('0x1e')](handleEntityNotFound(_0x5b3b0d,null))['then'](function(_0xd8f98f){if(_0xd8f98f){_0x5d0ded[_0xe9d2('0x27')]=_0xd8f98f[_0xe9d2('0x61')]({'plain':!![]});return db[_0xe9d2('0x7d')][_0xe9d2('0x57')]({'where':{'id':_0xd8f98f[_0xe9d2('0x7e')]}});}return null;})[_0xe9d2('0x1e')](handleEntityNotFound(_0x5b3b0d,null))[_0xe9d2('0x1e')](function(_0x1c5d3c){if(_0x1c5d3c){_0x5d0ded[_0xe9d2('0x67')]=_0x1c5d3c[_0xe9d2('0x61')]({'plain':!![]});interaction_log[_0xe9d2('0x1f')](_0xe9d2('0x7f'),_0x1eb9d9['user']['id'],_0x1eb9d9[_0xe9d2('0x65')][_0xe9d2('0x36')],_0x1eb9d9[_0xe9d2('0x65')][_0xe9d2('0x66')],_0x5d0ded[_0xe9d2('0x67')]['id'],_0x1eb9d9['body']?JSON[_0xe9d2('0x24')](_0x1eb9d9[_0xe9d2('0x59')]):_0xe9d2('0x68'));return respondWithRpcPromise('RejectMessage',_0xe9d2('0x80'),_0x5d0ded);}return null;})[_0xe9d2('0x1e')](function(_0xfd7386){var _0x1b466f='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0xfd7386['message'][_0xe9d2('0x6b')];return db[_0xe9d2('0x6c')][_0xe9d2('0x3f')](_0x1b466f,{'type':db['Sequelize'][_0xe9d2('0x81')][_0xe9d2('0x6e')],'raw':!![]})[_0xe9d2('0x1e')](function(_0x32dd05){return _0x32dd05;});})[_0xe9d2('0x1e')](function(_0x235285){if(_0x235285){_0x5d0ded[_0xe9d2('0x27')][_0xe9d2('0x6f')]=_0x235285[0x0];if(!_0x1eb9d9[_0xe9d2('0x59')][_0xe9d2('0x5f')])return;return db[_0xe9d2('0x70')][_0xe9d2('0x57')]({'where':{'id':_0x1eb9d9[_0xe9d2('0x59')]['UserId'],'role':_0xe9d2('0x71')},'attributes':['id',_0xe9d2('0x36'),_0xe9d2('0x72'),_0xe9d2('0x73'),'internal'],'raw':!![]});}return null;})[_0xe9d2('0x1e')](function(_0x4b2444){if(!_0x4b2444)return null;_0x5d0ded['message'][_0xe9d2('0x71')]=_0x4b2444;return _0x5d0ded;})[_0xe9d2('0x1e')](function(_0x4f02c4){if(_0x4f02c4){_0x4f02c4[_0xe9d2('0x27')][_0xe9d2('0x76')]=util[_0xe9d2('0x77')](_0xe9d2('0x78'),_0x1eb9d9[_0xe9d2('0x65')][_0xe9d2('0x36')]);_0x4f02c4[_0xe9d2('0x27')][_0xe9d2('0x79')]=_0x5d0ded[_0xe9d2('0x79')];_0x4f02c4[_0xe9d2('0x27')][_0xe9d2('0x7a')]=_0x5d0ded[_0xe9d2('0x79')];_0x4f02c4[_0xe9d2('0x27')][_0xe9d2('0x82')]=_0xe9d2('0x30');respondWithRpcPromise(_0xe9d2('0x7b'),_0xe9d2('0x7b'),{'event':_0xe9d2('0x83'),'message':_0x4f02c4[_0xe9d2('0x27')]},client9002);return _0x5d0ded;}return null;})[_0xe9d2('0x1e')](respondWithResult(_0x5b3b0d,null))[_0xe9d2('0x53')](handleError(_0x5b3b0d,null));};exports[_0xe9d2('0x34')]=function(_0x1a57af,_0x5bd8a0,_0x5ec548){if(_0x1a57af[_0xe9d2('0x59')]['id']){delete _0x1a57af[_0xe9d2('0x59')]['id'];}var _0x5392cb;return db[_0xe9d2('0x4f')][_0xe9d2('0x57')]({'where':{'id':_0x1a57af[_0xe9d2('0x60')]['id']}})[_0xe9d2('0x1e')](handleEntityNotFound(_0x5bd8a0,null))['then'](function(_0x3b3f0d){if(_0x3b3f0d){_0x5392cb=_0x3b3f0d;return db[_0xe9d2('0x84')][_0xe9d2('0x57')]({'where':{'id':_0x3b3f0d['WhatsappAccountId']}});}})[_0xe9d2('0x1e')](handleEntityNotFound(_0x5bd8a0,null))['then'](function(_0x3633e1){if(_0x3633e1){logger[_0xe9d2('0x22')](_0xe9d2('0x85'),_0xe9d2('0x34'),_0xe9d2('0x86'),_0x3633e1[_0xe9d2('0x3b')],util[_0xe9d2('0x87')](_0x1a57af[_0xe9d2('0x59')],{'showHidden':![],'depth':null}));switch(_0x3633e1[_0xe9d2('0x3b')]){case _0xe9d2('0x88'):if(_0x1a57af[_0xe9d2('0x59')][_0xe9d2('0x89')]&&_0x1a57af[_0xe9d2('0x59')][_0xe9d2('0x89')]===_0x5392cb[_0xe9d2('0x8a')]&&_0x1a57af[_0xe9d2('0x59')][_0xe9d2('0x8b')]&&_0x1a57af[_0xe9d2('0x59')]['MessageStatus']==='read'){return _0x5392cb[_0xe9d2('0x32')]({'read':!![]});}else{logger[_0xe9d2('0x25')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0xe9d2('0x34'),_0xe9d2('0x88'),util[_0xe9d2('0x87')](_0x1a57af[_0xe9d2('0x59')],{'showHidden':![],'depth':null}));}break;}return _0x5392cb;}})['then'](respondWithResult(_0x5bd8a0,null))[_0xe9d2('0x53')](handleError(_0x5bd8a0,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 9e44d97..eee2267 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 _0xe1e3=['hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','remove','emit'];(function(_0x3839b9,_0x123fa7){var _0x819a50=function(_0x58b641){while(--_0x58b641){_0x3839b9['push'](_0x3839b9['shift']());}};_0x819a50(++_0x123fa7);}(_0xe1e3,0x1bb));var _0x3e1e=function(_0x40b782,_0x2b1a69){_0x40b782=_0x40b782-0x0;var _0x23daf4=_0xe1e3[_0x40b782];return _0x23daf4;};'use strict';var EventEmitter=require(_0x3e1e('0x0'));var WhatsappMessage=require(_0x3e1e('0x1'))['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x3e1e('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x3e1e('0x3')};function emitEvent(_0x4d5360){return function(_0x3bacc,_0x5a11ef,_0x1abd25){WhatsappMessageEvents[_0x3e1e('0x4')](_0x4d5360+':'+_0x3bacc['id'],_0x3bacc);WhatsappMessageEvents[_0x3e1e('0x4')](_0x4d5360,_0x3bacc);_0x1abd25(null);};}for(var e in events){if(events[_0x3e1e('0x5')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module[_0x3e1e('0x6')]=WhatsappMessageEvents; \ No newline at end of file +var _0x536f=['remove','emit','hasOwnProperty','hook','events','update'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x536f,0x70));var _0xf536=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x536f[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require(_0xf536('0x0'));var WhatsappMessage=require('../../mysqldb')['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xf536('0x1'),'afterDestroy':_0xf536('0x2')};function emitEvent(_0x1781ef){return function(_0x29426d,_0x52bead,_0x1560d8){WhatsappMessageEvents['emit'](_0x1781ef+':'+_0x29426d['id'],_0x29426d);WhatsappMessageEvents[_0xf536('0x3')](_0x1781ef,_0x29426d);_0x1560d8(null);};}for(var e in events){if(events[_0xf536('0x4')](e)){var event=events[e];WhatsappMessage[_0xf536('0x5')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 2e44419..508634c 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 _0x9885=['baseUrl','/whatsapp/v1/','POST','Bearer\x20','application/json','statuses','message_id','finally','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','node-fetch','rimraf','../../config/environment','./whatsappMessage.attributes','messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','UserId','WhatsappInteraction','findOne','then','update','createdAt','secret','find','WhatsappAccountId','type','twilio','accountSid','phone','authToken','messages','create','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','catch','error','WhatsappMessage,\x20%s,\x20%s,\x20%s','inspect','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch'];(function(_0x44b0de,_0x213afa){var _0x21da2a=function(_0x264f30){while(--_0x264f30){_0x44b0de['push'](_0x44b0de['shift']());}};_0x21da2a(++_0x213afa);}(_0x9885,0x191));var _0x5988=function(_0x181a0b,_0x3cb331){_0x181a0b=_0x181a0b-0x0;var _0x2afc3f=_0x9885[_0x181a0b];return _0x2afc3f;};'use strict';var _=require(_0x5988('0x0'));var util=require(_0x5988('0x1'));var logger=require(_0x5988('0x2'))(_0x5988('0x3'));var moment=require(_0x5988('0x4'));var BPromise=require(_0x5988('0x5'));var rp=require(_0x5988('0x6'));var fetch=require(_0x5988('0x7'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5988('0x8'));var config=require(_0x5988('0x9'));var attributes=require(_0x5988('0xa'));module['exports']=function(_0x2bb661,_0x394436){return _0x2bb661['define']('WhatsappMessage',attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':'messageId','fields':[_0x5988('0xb')]},{'name':_0x5988('0xc'),'fields':[_0x5988('0xd')],'type':_0x5988('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1761bd,_0x37ae77,_0x2951d8){var _0x259923=_0x2bb661[_0x5988('0xf')];var _0x3c0065=_0x1761bd[_0x5988('0x10')]({'plain':!![]});if(_0x3c0065[_0x5988('0x11')][_0x5988('0x12')]()==='in'||_0x3c0065[_0x5988('0x11')][_0x5988('0x12')]()===_0x5988('0x13')&&!_0x3c0065['secret']&&!_['isNil'](_0x3c0065[_0x5988('0x14')])){_0x259923[_0x5988('0x15')][_0x5988('0x16')]({'where':{'id':_0x3c0065['WhatsappInteractionId']}})[_0x5988('0x17')](function(_0xe572ec){if(_0xe572ec){_0xe572ec[_0x5988('0x18')]({'lastMsgAt':_0x3c0065[_0x5988('0x19')],'lastMsgDirection':_0x3c0065[_0x5988('0x11')][_0x5988('0x12')]()});}})['catch'](function(_0xe78550){console['error'](_0xe78550);});}if(_0x3c0065[_0x5988('0x11')]===_0x5988('0x13')&&!_0x3c0065[_0x5988('0x1a')]){var _0x453aa9;_0x259923['WhatsappAccount'][_0x5988('0x1b')]({'where':{'id':_0x3c0065[_0x5988('0x1c')]},'raw':!![]})[_0x5988('0x17')](function(_0x18d7aa){_0x453aa9=_0x18d7aa;if(_0x453aa9&&_0x453aa9['type']){switch(_0x453aa9[_0x5988('0x1d')]){case _0x5988('0x1e'):var _0x5a275e=require(_0x5988('0x1e'));if(_0x453aa9[_0x5988('0x1f')]&&_0x453aa9['authToken']&&_0x453aa9[_0x5988('0x20')]){var _0x308028=new _0x5a275e(_0x453aa9[_0x5988('0x1f')],_0x453aa9[_0x5988('0x21')]);_0x308028[_0x5988('0x22')][_0x5988('0x23')]({'body':_0x3c0065[_0x5988('0xd')],'to':_0x5988('0x24')+_0x3c0065[_0x5988('0x20')],'from':'whatsapp:'+_0x453aa9[_0x5988('0x20')],'statusCallback':_0x453aa9[_0x5988('0x25')]+_0x5988('0x26')+_0x3c0065['id']+_0x5988('0x27')+_0x453aa9['token']})[_0x5988('0x17')](function(_0x14cd20){if(_0x14cd20['sid']){return _0x1761bd['update']({'messageId':_0x14cd20['sid']});}})[_0x5988('0x28')](function(_0x48679d){logger[_0x5988('0x29')](_0x5988('0x2a'),'afterCreate',_0x5988('0x1e'),util[_0x5988('0x2b')](_0x48679d,{'showHidden':![],'depth':null}));});}else{logger[_0x5988('0x29')](_0x5988('0x2a'),_0x5988('0x2c'),_0x5988('0x1e'),_0x5988('0x2d'));}break;case _0x5988('0x2e'):var _0x512628=_0x453aa9[_0x5988('0x1f')];var _0x1366cd=_0x453aa9['authToken'];var _0x3af2db=_0x453aa9[_0x5988('0x2f')]+_0x5988('0x30')+_0x512628+'/messages/';var _0x5e5aab={'to':[_0x3c0065[_0x5988('0x20')]],'message':{'type':'text','text':_0x3c0065[_0x5988('0xd')]}};var _0x369214={'method':_0x5988('0x31'),'uri':_0x3af2db,'headers':{'Authorization':_0x5988('0x32')+_0x1366cd,'Content-Type':_0x5988('0x33')},'body':_0x5e5aab,'json':!![]};rp(_0x369214)[_0x5988('0x17')](function(_0x338d7b){if(_0x338d7b[_0x5988('0x34')][0x0]['message_id']){return _0x1761bd[_0x5988('0x18')]({'messageId':_0x338d7b[_0x5988('0x34')][0x0][_0x5988('0x35')]});}})[_0x5988('0x28')](function(_0x344278){logger['err']('WhatsappMessage,\x20%s',_0x344278);});break;}}})[_0x5988('0x36')](function(){_0x2951d8();});}else{_0x2951d8();}}},'charset':'utf8mb4','collate':_0x5988('0x37')});}; \ No newline at end of file +var _0x99a1=['WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','authToken','phone','create','whatsapp:','/api/whatsapp/messages/','/status?token=','token','sid','update','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','baseUrl','/whatsapp/v1/','/messages/','text','POST','application/json','message_id','statuses','err','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','node-fetch','path','rimraf','../../config/environment','exports','define','WhatsappMessage','whatsapp_messages','messageId','body','FULLTEXT','models','get','direction','toLowerCase','secret','WhatsappInteraction','WhatsappInteractionId','then','createdAt','catch','error','out'];(function(_0x329683,_0x30a8d1){var _0xeace0b=function(_0x5b2cdc){while(--_0x5b2cdc){_0x329683['push'](_0x329683['shift']());}};_0xeace0b(++_0x30a8d1);}(_0x99a1,0x13b));var _0x199a=function(_0x5eed0b,_0x9d4e45){_0x5eed0b=_0x5eed0b-0x0;var _0xf34ab8=_0x99a1[_0x5eed0b];return _0xf34ab8;};'use strict';var _=require(_0x199a('0x0'));var util=require(_0x199a('0x1'));var logger=require(_0x199a('0x2'))('api');var moment=require(_0x199a('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fetch=require(_0x199a('0x4'));var fs=require('fs');var path=require(_0x199a('0x5'));var rimraf=require(_0x199a('0x6'));var config=require(_0x199a('0x7'));var attributes=require('./whatsappMessage.attributes');module[_0x199a('0x8')]=function(_0x29ad42,_0x37b710){return _0x29ad42[_0x199a('0x9')](_0x199a('0xa'),attributes,{'tableName':_0x199a('0xb'),'paranoid':![],'indexes':[{'name':_0x199a('0xc'),'fields':[_0x199a('0xc')]},{'name':'fti_whatsapp_messages','fields':[_0x199a('0xd')],'type':_0x199a('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4d3913,_0xe63a69,_0x13b459){var _0x579f67=_0x29ad42[_0x199a('0xf')];var _0x23ca65=_0x4d3913[_0x199a('0x10')]({'plain':!![]});if(_0x23ca65[_0x199a('0x11')][_0x199a('0x12')]()==='in'||_0x23ca65[_0x199a('0x11')][_0x199a('0x12')]()==='out'&&!_0x23ca65[_0x199a('0x13')]&&!_['isNil'](_0x23ca65['UserId'])){_0x579f67[_0x199a('0x14')]['findOne']({'where':{'id':_0x23ca65[_0x199a('0x15')]}})[_0x199a('0x16')](function(_0x29711c){if(_0x29711c){_0x29711c['update']({'lastMsgAt':_0x23ca65[_0x199a('0x17')],'lastMsgDirection':_0x23ca65['direction'][_0x199a('0x12')]()});}})[_0x199a('0x18')](function(_0x15dea7){console[_0x199a('0x19')](_0x15dea7);});}if(_0x23ca65[_0x199a('0x11')]===_0x199a('0x1a')&&!_0x23ca65[_0x199a('0x13')]){var _0xf54a6f;_0x579f67[_0x199a('0x1b')][_0x199a('0x1c')]({'where':{'id':_0x23ca65[_0x199a('0x1d')]},'raw':!![]})[_0x199a('0x16')](function(_0x58db75){_0xf54a6f=_0x58db75;if(_0xf54a6f&&_0xf54a6f[_0x199a('0x1e')]){switch(_0xf54a6f[_0x199a('0x1e')]){case _0x199a('0x1f'):var _0x472dcb=require(_0x199a('0x1f'));if(_0xf54a6f[_0x199a('0x20')]&&_0xf54a6f[_0x199a('0x21')]&&_0xf54a6f[_0x199a('0x22')]){var _0xf0a2b9=new _0x472dcb(_0xf54a6f['accountSid'],_0xf54a6f[_0x199a('0x21')]);_0xf0a2b9['messages'][_0x199a('0x23')]({'body':_0x23ca65[_0x199a('0xd')],'to':'whatsapp:'+_0x23ca65[_0x199a('0x22')],'from':_0x199a('0x24')+_0xf54a6f[_0x199a('0x22')],'statusCallback':_0xf54a6f['remote']+_0x199a('0x25')+_0x23ca65['id']+_0x199a('0x26')+_0xf54a6f[_0x199a('0x27')]})[_0x199a('0x16')](function(_0x3bf704){if(_0x3bf704[_0x199a('0x28')]){return _0x4d3913[_0x199a('0x29')]({'messageId':_0x3bf704[_0x199a('0x28')]});}})[_0x199a('0x18')](function(_0x3db26b){logger['error'](_0x199a('0x2a'),_0x199a('0x2b'),_0x199a('0x1f'),util[_0x199a('0x2c')](_0x3db26b,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x199a('0x2a'),_0x199a('0x2b'),_0x199a('0x1f'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case'sinch':var _0x3ea1b6=_0xf54a6f['accountSid'];var _0x4efef8=_0xf54a6f[_0x199a('0x21')];var _0x328142=_0xf54a6f[_0x199a('0x2d')]+_0x199a('0x2e')+_0x3ea1b6+_0x199a('0x2f');var _0x956af8={'to':[_0x23ca65['phone']],'message':{'type':_0x199a('0x30'),'text':_0x23ca65[_0x199a('0xd')]}};var _0x5f5a34={'method':_0x199a('0x31'),'uri':_0x328142,'headers':{'Authorization':'Bearer\x20'+_0x4efef8,'Content-Type':_0x199a('0x32')},'body':_0x956af8,'json':!![]};rp(_0x5f5a34)[_0x199a('0x16')](function(_0x221072){if(_0x221072['statuses'][0x0][_0x199a('0x33')]){return _0x4d3913['update']({'messageId':_0x221072[_0x199a('0x34')][0x0][_0x199a('0x33')]});}})[_0x199a('0x18')](function(_0x3e0a47){logger[_0x199a('0x35')]('WhatsappMessage,\x20%s',_0x3e0a47);});break;}}})[_0x199a('0x36')](function(){_0x13b459();});}else{_0x13b459();}}},'charset':_0x199a('0x37'),'collate':_0x199a('0x38')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index e58e955..79c9817 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 _0xfc46=['info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','CreateWhatsappMessage','create','options','raw','then','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','socket.io-emitter','./whatsappMessage.socket','register'];(function(_0x43dc7e,_0x49a390){var _0x21e12d=function(_0x15cc1a){while(--_0x15cc1a){_0x43dc7e['push'](_0x43dc7e['shift']());}};_0x21e12d(++_0x49a390);}(_0xfc46,0x1de));var _0x6fc4=function(_0x585133,_0x2412a1){_0x585133=_0x585133-0x0;var _0x18254a=_0xfc46[_0x585133];return _0x18254a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6fc4('0x0'));var BPromise=require(_0x6fc4('0x1'));var rs=require(_0x6fc4('0x2'));var fs=require('fs');var Redis=require(_0x6fc4('0x3'));var db=require(_0x6fc4('0x4'))['db'];var utils=require(_0x6fc4('0x5'));var logger=require(_0x6fc4('0x6'))(_0x6fc4('0x7'));var config=require(_0x6fc4('0x8'));var jayson=require(_0x6fc4('0x9'));var client=jayson[_0x6fc4('0xa')]['http']({'port':0x232a});config['redis']=_[_0x6fc4('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x6fc4('0xc'))(new Redis(config['redis']));require(_0x6fc4('0xd'))[_0x6fc4('0xe')](socket);function respondWithRpcPromise(_0x51b18f,_0x5441b3,_0x1a00dd){return new BPromise(function(_0xf6bb57,_0x475f5e){return client['request'](_0x51b18f,_0x1a00dd)['then'](function(_0x57c9d2){logger[_0x6fc4('0xf')](_0x6fc4('0x10'),_0x5441b3,_0x6fc4('0x11'));logger[_0x6fc4('0x12')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x5441b3,_0x6fc4('0x11'),JSON[_0x6fc4('0x13')](_0x57c9d2));if(_0x57c9d2[_0x6fc4('0x14')]){if(_0x57c9d2['error']['code']===0x1f4){logger[_0x6fc4('0x14')](_0x6fc4('0x10'),_0x5441b3,_0x57c9d2['error'][_0x6fc4('0x15')]);return _0x475f5e(_0x57c9d2[_0x6fc4('0x14')][_0x6fc4('0x15')]);}logger[_0x6fc4('0x14')](_0x6fc4('0x10'),_0x5441b3,_0x57c9d2[_0x6fc4('0x14')][_0x6fc4('0x15')]);return _0xf6bb57(_0x57c9d2[_0x6fc4('0x14')][_0x6fc4('0x15')]);}else{logger[_0x6fc4('0xf')](_0x6fc4('0x10'),_0x5441b3,'request\x20sent');_0xf6bb57(_0x57c9d2[_0x6fc4('0x16')][_0x6fc4('0x15')]);}})[_0x6fc4('0x17')](function(_0x3eaa38){logger[_0x6fc4('0x14')](_0x6fc4('0x10'),_0x5441b3,_0x3eaa38);_0x475f5e(_0x3eaa38);});});}exports[_0x6fc4('0x18')]=function(_0x180196){var _0x1b07b0=this;return new Promise(function(_0x2ff7d6,_0x375715){return db['WhatsappMessage'][_0x6fc4('0x19')](_0x180196['body'],{'raw':_0x180196[_0x6fc4('0x1a')]?_0x180196[_0x6fc4('0x1a')][_0x6fc4('0x1b')]===undefined?!![]:![]:!![]})[_0x6fc4('0x1c')](function(_0x21de47){logger[_0x6fc4('0xf')](_0x6fc4('0x18'),_0x180196);logger[_0x6fc4('0x12')]('CreateWhatsappMessage',_0x180196,JSON[_0x6fc4('0x13')](_0x21de47));_0x2ff7d6(_0x21de47);})['catch'](function(_0xb0225b){logger[_0x6fc4('0x14')](_0x6fc4('0x18'),_0xb0225b[_0x6fc4('0x15')],_0x180196);_0x375715(_0x1b07b0[_0x6fc4('0x14')](0x1f4,_0xb0225b[_0x6fc4('0x15')]));});});}; \ No newline at end of file +var _0xdc0b=['request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateWhatsappMessage','create','options','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','register','request','then','WhatsappMessage,\x20%s,\x20%s'];(function(_0x91dc46,_0xa9df4c){var _0x2af010=function(_0x550761){while(--_0x550761){_0x91dc46['push'](_0x91dc46['shift']());}};_0x2af010(++_0xa9df4c);}(_0xdc0b,0x1b1));var _0xbdc0=function(_0x32a06a,_0x3b7f8d){_0x32a06a=_0x32a06a-0x0;var _0x49503b=_0xdc0b[_0x32a06a];return _0x49503b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xbdc0('0x0'));var BPromise=require(_0xbdc0('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbdc0('0x2'));var db=require(_0xbdc0('0x3'))['db'];var utils=require(_0xbdc0('0x4'));var logger=require(_0xbdc0('0x5'))('rpc');var config=require(_0xbdc0('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xbdc0('0x7')][_0xbdc0('0x8')]({'port':0x232a});config['redis']=_[_0xbdc0('0x9')](config[_0xbdc0('0xa')],{'host':_0xbdc0('0xb'),'port':0x18eb});var socket=require(_0xbdc0('0xc'))(new Redis(config['redis']));require('./whatsappMessage.socket')[_0xbdc0('0xd')](socket);function respondWithRpcPromise(_0x20c0c3,_0x27cc46,_0x46f1cf){return new BPromise(function(_0xed76d1,_0x1e5e6c){return client[_0xbdc0('0xe')](_0x20c0c3,_0x46f1cf)[_0xbdc0('0xf')](function(_0x37efaf){logger['info'](_0xbdc0('0x10'),_0x27cc46,_0xbdc0('0x11'));logger[_0xbdc0('0x12')](_0xbdc0('0x13'),_0x27cc46,_0xbdc0('0x11'),JSON[_0xbdc0('0x14')](_0x37efaf));if(_0x37efaf[_0xbdc0('0x15')]){if(_0x37efaf[_0xbdc0('0x15')][_0xbdc0('0x16')]===0x1f4){logger['error'](_0xbdc0('0x10'),_0x27cc46,_0x37efaf[_0xbdc0('0x15')][_0xbdc0('0x17')]);return _0x1e5e6c(_0x37efaf[_0xbdc0('0x15')][_0xbdc0('0x17')]);}logger[_0xbdc0('0x15')]('WhatsappMessage,\x20%s,\x20%s',_0x27cc46,_0x37efaf['error'][_0xbdc0('0x17')]);return _0xed76d1(_0x37efaf[_0xbdc0('0x15')][_0xbdc0('0x17')]);}else{logger[_0xbdc0('0x18')]('WhatsappMessage,\x20%s,\x20%s',_0x27cc46,'request\x20sent');_0xed76d1(_0x37efaf[_0xbdc0('0x19')][_0xbdc0('0x17')]);}})[_0xbdc0('0x1a')](function(_0xfc058){logger[_0xbdc0('0x15')](_0xbdc0('0x10'),_0x27cc46,_0xfc058);_0x1e5e6c(_0xfc058);});});}exports[_0xbdc0('0x1b')]=function(_0x15e761){var _0x48d1d4=this;return new Promise(function(_0x19e649,_0x50106d){return db['WhatsappMessage'][_0xbdc0('0x1c')](_0x15e761['body'],{'raw':_0x15e761[_0xbdc0('0x1d')]?_0x15e761[_0xbdc0('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0xbdc0('0xf')](function(_0x1fdb1e){logger[_0xbdc0('0x18')](_0xbdc0('0x1b'),_0x15e761);logger[_0xbdc0('0x12')](_0xbdc0('0x1b'),_0x15e761,JSON[_0xbdc0('0x14')](_0x1fdb1e));_0x19e649(_0x1fdb1e);})[_0xbdc0('0x1a')](function(_0x46bf14){logger[_0xbdc0('0x15')](_0xbdc0('0x1b'),_0x46bf14[_0xbdc0('0x17')],_0x15e761);_0x50106d(_0x48d1d4[_0xbdc0('0x15')](0x1f4,_0x46bf14['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 8d39ff4..4131917 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 _0xdd48=['remove','update','emit','removeListener','register','length','./whatsappMessage.events','save'];(function(_0x5b51d2,_0xd3846c){var _0x1ecc32=function(_0x26c8a1){while(--_0x26c8a1){_0x5b51d2['push'](_0x5b51d2['shift']());}};_0x1ecc32(++_0xd3846c);}(_0xdd48,0xae));var _0x8dd4=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xdd48[_0x21a9d9];return _0x46adce;};'use strict';var WhatsappMessageEvents=require(_0x8dd4('0x0'));var events=[_0x8dd4('0x1'),_0x8dd4('0x2'),_0x8dd4('0x3')];function createListener(_0x240d19,_0x279c5e){return function(_0x33f571){_0x279c5e[_0x8dd4('0x4')](_0x240d19,_0x33f571);};}function removeListener(_0x254b3b,_0x363b25){return function(){WhatsappMessageEvents[_0x8dd4('0x5')](_0x254b3b,_0x363b25);};}exports[_0x8dd4('0x6')]=function(_0x4e81b1){for(var _0x291159=0x0,_0x30b224=events[_0x8dd4('0x7')];_0x291159<_0x30b224;_0x291159++){var _0x20483f=events[_0x291159];var _0x4cfd64=createListener('whatsappMessage:'+_0x20483f,_0x4e81b1);WhatsappMessageEvents['on'](_0x20483f,_0x4cfd64);}}; \ No newline at end of file +var _0x26dc=['./whatsappMessage.events','save','update','emit','removeListener','length'];(function(_0x582f72,_0x886d8){var _0x4cd5fe=function(_0x4ac1c7){while(--_0x4ac1c7){_0x582f72['push'](_0x582f72['shift']());}};_0x4cd5fe(++_0x886d8);}(_0x26dc,0x16e));var _0xc26d=function(_0x5c9920,_0x59b355){_0x5c9920=_0x5c9920-0x0;var _0x56b261=_0x26dc[_0x5c9920];return _0x56b261;};'use strict';var WhatsappMessageEvents=require(_0xc26d('0x0'));var events=[_0xc26d('0x1'),'remove',_0xc26d('0x2')];function createListener(_0x5ec1f5,_0x517e66){return function(_0x575a70){_0x517e66[_0xc26d('0x3')](_0x5ec1f5,_0x575a70);};}function removeListener(_0x2520e5,_0x339150){return function(){WhatsappMessageEvents[_0xc26d('0x4')](_0x2520e5,_0x339150);};}exports['register']=function(_0x2dc1e8){for(var _0x2967c8=0x0,_0x28fa39=events[_0xc26d('0x5')];_0x2967c8<_0x28fa39;_0x2967c8++){var _0x133fc6=events[_0x2967c8];var _0x214717=createListener('whatsappMessage:'+_0x133fc6,_0x2dc1e8);WhatsappMessageEvents['on'](_0x133fc6,_0x214717);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index edb7f1a..c81ddde 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 _0x07d8=['getAgents','addTeams','post','put','update','delete','destroy','removeAgents','util','connect-timeout','express','fs-extra','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','/:id/teams','/:id/users'];(function(_0x432a9a,_0x5d951c){var _0x5dc88c=function(_0x2f5ee8){while(--_0x2f5ee8){_0x432a9a['push'](_0x432a9a['shift']());}};_0x5dc88c(++_0x5d951c);}(_0x07d8,0x140));var _0x807d=function(_0x598c1e,_0x395e6e){_0x598c1e=_0x598c1e-0x0;var _0x487a43=_0x07d8[_0x598c1e];return _0x487a43;};'use strict';var multer=require('multer');var util=require(_0x807d('0x0'));var path=require('path');var timeout=require(_0x807d('0x1'));var express=require(_0x807d('0x2'));var router=express['Router']();var fs_extra=require(_0x807d('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x807d('0x4'));var controller=require(_0x807d('0x5'));router[_0x807d('0x6')]('/',auth[_0x807d('0x7')](),controller[_0x807d('0x8')]);router[_0x807d('0x6')](_0x807d('0x9'),auth['isAuthenticated'](),controller[_0x807d('0xa')]);router[_0x807d('0x6')](_0x807d('0xb'),auth['isAuthenticated'](),controller[_0x807d('0xc')]);router['get'](_0x807d('0xd'),auth[_0x807d('0x7')](),controller['getMembers']);router[_0x807d('0x6')](_0x807d('0xe'),auth['isAuthenticated'](),controller['getTeams']);router[_0x807d('0x6')](_0x807d('0xf'),auth[_0x807d('0x7')](),controller[_0x807d('0x10')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/teams',auth[_0x807d('0x7')](),controller[_0x807d('0x11')]);router[_0x807d('0x12')](_0x807d('0xf'),auth[_0x807d('0x7')](),controller['addAgents']);router[_0x807d('0x13')](_0x807d('0xb'),auth[_0x807d('0x7')](),controller[_0x807d('0x14')]);router[_0x807d('0x15')](_0x807d('0xb'),auth[_0x807d('0x7')](),controller[_0x807d('0x16')]);router['delete'](_0x807d('0xe'),auth[_0x807d('0x7')](),controller['removeTeams']);router[_0x807d('0x15')](_0x807d('0xf'),auth[_0x807d('0x7')](),controller[_0x807d('0x17')]);module['exports']=router; \ No newline at end of file +var _0xe5f1=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./whatsappQueue.controller','isAuthenticated','index','/describe','get','/:id','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','create','post','/:id/teams','addTeams','update'];(function(_0x1ca809,_0x48a7a5){var _0x3947bb=function(_0x72268f){while(--_0x72268f){_0x1ca809['push'](_0x1ca809['shift']());}};_0x3947bb(++_0x48a7a5);}(_0xe5f1,0x16f));var _0x1e5f=function(_0xc2c268,_0x4e09d4){_0xc2c268=_0xc2c268-0x0;var _0x3fc220=_0xe5f1[_0xc2c268];return _0x3fc220;};'use strict';var multer=require(_0x1e5f('0x0'));var util=require(_0x1e5f('0x1'));var path=require(_0x1e5f('0x2'));var timeout=require(_0x1e5f('0x3'));var express=require(_0x1e5f('0x4'));var router=express[_0x1e5f('0x5')]();var fs_extra=require(_0x1e5f('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1e5f('0x7'));var controller=require(_0x1e5f('0x8'));router['get']('/',auth[_0x1e5f('0x9')](),controller[_0x1e5f('0xa')]);router['get'](_0x1e5f('0xb'),auth[_0x1e5f('0x9')](),controller['describe']);router[_0x1e5f('0xc')](_0x1e5f('0xd'),auth[_0x1e5f('0x9')](),controller[_0x1e5f('0xe')]);router[_0x1e5f('0xc')](_0x1e5f('0xf'),auth[_0x1e5f('0x9')](),controller[_0x1e5f('0x10')]);router['get']('/:id/teams',auth[_0x1e5f('0x9')](),controller[_0x1e5f('0x11')]);router[_0x1e5f('0xc')](_0x1e5f('0x12'),auth['isAuthenticated'](),controller[_0x1e5f('0x13')]);router['post']('/',auth[_0x1e5f('0x9')](),controller[_0x1e5f('0x14')]);router[_0x1e5f('0x15')](_0x1e5f('0x16'),auth[_0x1e5f('0x9')](),controller[_0x1e5f('0x17')]);router['post']('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router['put'](_0x1e5f('0xd'),auth[_0x1e5f('0x9')](),controller[_0x1e5f('0x18')]);router[_0x1e5f('0x19')]('/:id',auth[_0x1e5f('0x9')](),controller[_0x1e5f('0x1a')]);router[_0x1e5f('0x19')](_0x1e5f('0x16'),auth[_0x1e5f('0x9')](),controller['removeTeams']);router[_0x1e5f('0x19')](_0x1e5f('0x12'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x1e5f('0x1b')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 1b87d9d..d18e2c3 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 _0x8a55=['name','INTEGER','ENUM','rrmemory','beepall','sequelize','exports','STRING'];(function(_0x148391,_0x1dbbe6){var _0xad712=function(_0x10b6cb){while(--_0x10b6cb){_0x148391['push'](_0x148391['shift']());}};_0xad712(++_0x1dbbe6);}(_0x8a55,0x185));var _0x58a5=function(_0x7fd162,_0x37d157){_0x7fd162=_0x7fd162-0x0;var _0xa317a4=_0x8a55[_0x7fd162];return _0xa317a4;};'use strict';var Sequelize=require(_0x58a5('0x0'));module[_0x58a5('0x1')]={'name':{'type':Sequelize[_0x58a5('0x2')],'unique':_0x58a5('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x58a5('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x58a5('0x5')](_0x58a5('0x6'),_0x58a5('0x7'),'roundrobin')},'description':{'type':Sequelize[_0x58a5('0x2')]}}; \ No newline at end of file +var _0x7b05=['STRING','name','ENUM','beepall','roundrobin','sequelize','exports'];(function(_0x32748c,_0x4f634f){var _0x54486d=function(_0x4b0927){while(--_0x4b0927){_0x32748c['push'](_0x32748c['shift']());}};_0x54486d(++_0x4f634f);}(_0x7b05,0x91));var _0x57b0=function(_0x20c9b2,_0x55d7b1){_0x20c9b2=_0x20c9b2-0x0;var _0x2c6030=_0x7b05[_0x20c9b2];return _0x2c6030;};'use strict';var Sequelize=require(_0x57b0('0x0'));module[_0x57b0('0x1')]={'name':{'type':Sequelize[_0x57b0('0x2')],'unique':_0x57b0('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x57b0('0x4')]('rrmemory',_0x57b0('0x5'),_0x57b0('0x6'))},'description':{'type':Sequelize[_0x57b0('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 07f32b6..c732509 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 _0xb49d=['whatsappPause','createdAt','format','%s/%s','SIP','updatedAt','getTeams','findOne','Team','addTeams','ids','online','interface','flatMap','Agents','sequelize','each','forEach','emit','userWhatsappQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','WhatsappQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','every','TeamId','all','union','value','transaction','isEmpty','userWhatsappQueue:remove','addAgents','omit','removeAgents','isArray','getAgents','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','./whatsappQueue.socket','register','status','end','json','undefined','count','offset','set','Content-Range','apply','save','update','then','destroy','get','WhatsappQueues','UserProfileResource','sendStatus','error','stack','name','send','index','WhatsappQueue','fieldName','type','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','limit','order','sort','pick','filters','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','nolimit','WhatsappQueueId','UserWhatsappQueue','User','findAndCountAll','agent'];(function(_0x2eb92e,_0x4fe10c){var _0x1c94bf=function(_0x5da7d9){while(--_0x5da7d9){_0x2eb92e['push'](_0x2eb92e['shift']());}};_0x1c94bf(++_0x4fe10c);}(_0xb49d,0x1ce));var _0xdb49=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb49d[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdb49('0x0'));var zipdir=require(_0xdb49('0x1'));var jsonpatch=require(_0xdb49('0x2'));var rp=require('request-promise');var moment=require(_0xdb49('0x3'));var BPromise=require(_0xdb49('0x4'));var Mustache=require(_0xdb49('0x5'));var util=require('util');var path=require(_0xdb49('0x6'));var sox=require(_0xdb49('0x7'));var csv=require(_0xdb49('0x8'));var ejs=require(_0xdb49('0x9'));var fs=require('fs');var fs_extra=require(_0xdb49('0xa'));var _=require(_0xdb49('0xb'));var squel=require('squel');var crypto=require(_0xdb49('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xdb49('0xd'));var Redis=require(_0xdb49('0xe'));var authService=require(_0xdb49('0xf'));var qs=require(_0xdb49('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xdb49('0x11'));var utils=require(_0xdb49('0x12'));var config=require(_0xdb49('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xdb49('0x14'))['db'];config['redis']=_[_0xdb49('0x15')](config[_0xdb49('0x16')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdb49('0x16')]));require(_0xdb49('0x17'))[_0xdb49('0x18')](socket);function respondWithStatusCode(_0x3e3318,_0xdd2b96){_0xdd2b96=_0xdd2b96||0xcc;return function(_0x5cf920){if(_0x5cf920){return _0x3e3318['sendStatus'](_0xdd2b96);}return _0x3e3318[_0xdb49('0x19')](_0xdd2b96)[_0xdb49('0x1a')]();};}function respondWithResult(_0x465a17,_0x34bb47){_0x34bb47=_0x34bb47||0xc8;return function(_0x45e8dc){if(_0x45e8dc){return _0x465a17[_0xdb49('0x19')](_0x34bb47)[_0xdb49('0x1b')](_0x45e8dc);}};}function respondWithFilteredResult(_0x1ff5eb,_0x1e1bfe){return function(_0x5c9e38){if(_0x5c9e38){var _0x2f43e2=typeof _0x1e1bfe['offset']===_0xdb49('0x1c')&&typeof _0x1e1bfe['limit']===_0xdb49('0x1c');var _0x99bda7=_0x5c9e38[_0xdb49('0x1d')];var _0x564bb2=_0x2f43e2?0x0:_0x1e1bfe[_0xdb49('0x1e')];var _0x532f75=_0x2f43e2?_0x5c9e38['count']:_0x1e1bfe[_0xdb49('0x1e')]+_0x1e1bfe['limit'];var _0x1192fa;if(_0x532f75>=_0x99bda7){_0x532f75=_0x99bda7;_0x1192fa=0xc8;}else{_0x1192fa=0xce;}_0x1ff5eb[_0xdb49('0x19')](_0x1192fa);return _0x1ff5eb[_0xdb49('0x1f')](_0xdb49('0x20'),_0x564bb2+'-'+_0x532f75+'/'+_0x99bda7)[_0xdb49('0x1b')](_0x5c9e38);}return null;};}function patchUpdates(_0x28fb75){return function(_0xcc24df){try{jsonpatch[_0xdb49('0x21')](_0xcc24df,_0x28fb75,!![]);}catch(_0x10c85c){return BPromise['reject'](_0x10c85c);}return _0xcc24df[_0xdb49('0x22')]();};}function saveUpdates(_0x598c89,_0x4d0dce){return function(_0xcbe472){if(_0xcbe472){return _0xcbe472[_0xdb49('0x23')](_0x598c89)[_0xdb49('0x24')](function(_0x1e9266){return _0x1e9266;});}return null;};}function removeEntity(_0x4536e5,_0x1ba0b0){return function(_0x196a8f){if(_0x196a8f){return _0x196a8f[_0xdb49('0x25')]()['then'](function(){var _0x1fd54b=_0x196a8f[_0xdb49('0x26')]({'plain':!![]});var _0x37353a=_0xdb49('0x27');return db[_0xdb49('0x28')][_0xdb49('0x25')]({'where':{'type':_0x37353a,'resourceId':_0x1fd54b['id']}})[_0xdb49('0x24')](function(){return _0x196a8f;});})[_0xdb49('0x24')](function(){_0x4536e5[_0xdb49('0x19')](0xcc)[_0xdb49('0x1a')]();});}};}function handleEntityNotFound(_0x5415e7,_0x42bc4e){return function(_0x3a9495){if(!_0x3a9495){_0x5415e7[_0xdb49('0x29')](0x194);}return _0x3a9495;};}function handleError(_0x2cff9e,_0x2e35cb){_0x2e35cb=_0x2e35cb||0x1f4;return function(_0x613d6c){logger[_0xdb49('0x2a')](_0x613d6c[_0xdb49('0x2b')]);if(_0x613d6c[_0xdb49('0x2c')]){delete _0x613d6c[_0xdb49('0x2c')];}_0x2cff9e[_0xdb49('0x19')](_0x2e35cb)[_0xdb49('0x2d')](_0x613d6c);};}exports[_0xdb49('0x2e')]=function(_0x7cb12,_0x50daa4){var _0x1dd5ab={},_0xeb8e23={},_0x13cac1={'count':0x0,'rows':[]};var _0x28e234=_['map'](db[_0xdb49('0x2f')]['rawAttributes'],function(_0x1c4fcf){return{'name':_0x1c4fcf[_0xdb49('0x30')],'type':_0x1c4fcf[_0xdb49('0x31')]['key']};});_0xeb8e23['model']=_[_0xdb49('0x32')](_0x28e234,_0xdb49('0x2c'));_0xeb8e23[_0xdb49('0x33')]=_[_0xdb49('0x34')](_0x7cb12[_0xdb49('0x33')]);_0xeb8e23['filters']=_[_0xdb49('0x35')](_0xeb8e23[_0xdb49('0x36')],_0xeb8e23[_0xdb49('0x33')]);_0x1dd5ab[_0xdb49('0x37')]=_[_0xdb49('0x35')](_0xeb8e23[_0xdb49('0x36')],qs[_0xdb49('0x38')](_0x7cb12[_0xdb49('0x33')]['fields']));_0x1dd5ab[_0xdb49('0x37')]=_0x1dd5ab['attributes'][_0xdb49('0x39')]?_0x1dd5ab['attributes']:_0xeb8e23[_0xdb49('0x36')];if(!_0x7cb12['query'][_0xdb49('0x3a')]('nolimit')){_0x1dd5ab[_0xdb49('0x3b')]=qs[_0xdb49('0x3b')](_0x7cb12[_0xdb49('0x33')][_0xdb49('0x3b')]);_0x1dd5ab[_0xdb49('0x1e')]=qs[_0xdb49('0x1e')](_0x7cb12['query'][_0xdb49('0x1e')]);}_0x1dd5ab[_0xdb49('0x3c')]=qs[_0xdb49('0x3d')](_0x7cb12[_0xdb49('0x33')][_0xdb49('0x3d')]);_0x1dd5ab['where']=qs['filters'](_[_0xdb49('0x3e')](_0x7cb12[_0xdb49('0x33')],_0xeb8e23[_0xdb49('0x3f')]),_0x28e234);if(_0x7cb12[_0xdb49('0x33')][_0xdb49('0x40')]){_0x1dd5ab[_0xdb49('0x41')]=_[_0xdb49('0x42')](_0x1dd5ab[_0xdb49('0x41')],{'$or':_['map'](_0x28e234,function(_0x4ec1c0){if(_0x4ec1c0[_0xdb49('0x31')]!==_0xdb49('0x43')){var _0x5f49b0={};_0x5f49b0[_0x4ec1c0[_0xdb49('0x2c')]]={'$like':'%'+_0x7cb12[_0xdb49('0x33')][_0xdb49('0x40')]+'%'};return _0x5f49b0;}})});}_0x1dd5ab=_[_0xdb49('0x42')]({},_0x1dd5ab,_0x7cb12[_0xdb49('0x44')]);var _0x1089e5={'where':_0x1dd5ab[_0xdb49('0x41')]};return db['WhatsappQueue'][_0xdb49('0x1d')](_0x1089e5)[_0xdb49('0x24')](function(_0xdff81b){_0x13cac1['count']=_0xdff81b;if(_0x7cb12[_0xdb49('0x33')][_0xdb49('0x45')]){_0x1dd5ab[_0xdb49('0x46')]=[{'all':!![]}];}return db['WhatsappQueue'][_0xdb49('0x47')](_0x1dd5ab);})[_0xdb49('0x24')](function(_0x57d506){_0x13cac1[_0xdb49('0x48')]=_0x57d506;return _0x13cac1;})[_0xdb49('0x24')](respondWithFilteredResult(_0x50daa4,_0x1dd5ab))[_0xdb49('0x49')](handleError(_0x50daa4,null));};exports[_0xdb49('0x4a')]=function(_0x481ea7,_0x91e76a){var _0x52a330={'raw':!![],'where':{'id':_0x481ea7[_0xdb49('0x4b')]['id']}},_0x5357ea={};_0x5357ea[_0xdb49('0x36')]=_['keys'](db[_0xdb49('0x2f')][_0xdb49('0x4c')]);_0x5357ea[_0xdb49('0x33')]=_['keys'](_0x481ea7[_0xdb49('0x33')]);_0x5357ea[_0xdb49('0x3f')]=_['intersection'](_0x5357ea['model'],_0x5357ea[_0xdb49('0x33')]);_0x52a330['attributes']=_['intersection'](_0x5357ea[_0xdb49('0x36')],qs[_0xdb49('0x38')](_0x481ea7[_0xdb49('0x33')][_0xdb49('0x38')]));_0x52a330[_0xdb49('0x37')]=_0x52a330[_0xdb49('0x37')][_0xdb49('0x39')]?_0x52a330['attributes']:_0x5357ea['model'];if(_0x481ea7[_0xdb49('0x33')][_0xdb49('0x45')]){_0x52a330['include']=[{'all':!![]}];}_0x52a330=_[_0xdb49('0x42')]({},_0x52a330,_0x481ea7[_0xdb49('0x44')]);return db[_0xdb49('0x2f')]['find'](_0x52a330)[_0xdb49('0x24')](handleEntityNotFound(_0x91e76a,null))[_0xdb49('0x24')](respondWithResult(_0x91e76a,null))[_0xdb49('0x49')](handleError(_0x91e76a,null));};exports[_0xdb49('0x4d')]=function(_0x28f5ef,_0x2abfe4){return db['WhatsappQueue']['create'](_0x28f5ef[_0xdb49('0x4e')],{})[_0xdb49('0x24')](function(_0x49a93d){var _0x161880=_0x28f5ef[_0xdb49('0x4f')][_0xdb49('0x26')]({'plain':!![]});if(!_0x161880)throw new Error(_0xdb49('0x50'));if(_0x161880[_0xdb49('0x51')]===_0xdb49('0x4f')){var _0x21d3ff=_0x49a93d[_0xdb49('0x26')]({'plain':!![]});var _0x5b5a29=_0xdb49('0x27');return db[_0xdb49('0x52')][_0xdb49('0x53')]({'where':{'name':_0x5b5a29,'userProfileId':_0x161880['userProfileId']},'raw':!![]})[_0xdb49('0x24')](function(_0xeabeb){if(_0xeabeb&&_0xeabeb[_0xdb49('0x54')]===0x0){return db['UserProfileResource'][_0xdb49('0x4d')]({'name':_0x21d3ff['name'],'resourceId':_0x21d3ff['id'],'type':_0xeabeb[_0xdb49('0x2c')],'sectionId':_0xeabeb['id']},{})[_0xdb49('0x24')](function(){return _0x49a93d;});}else{return _0x49a93d;}})[_0xdb49('0x49')](function(_0x2c8aa6){logger['error'](_0xdb49('0x55'),_0x2c8aa6);throw _0x2c8aa6;});}return _0x49a93d;})[_0xdb49('0x24')](respondWithResult(_0x2abfe4,0xc9))[_0xdb49('0x49')](handleError(_0x2abfe4,null));};exports[_0xdb49('0x23')]=function(_0x43192f,_0x4e001b){if(_0x43192f['body']['id']){delete _0x43192f[_0xdb49('0x4e')]['id'];}return db[_0xdb49('0x2f')]['find']({'where':{'id':_0x43192f['params']['id']}})[_0xdb49('0x24')](handleEntityNotFound(_0x4e001b,null))[_0xdb49('0x24')](saveUpdates(_0x43192f[_0xdb49('0x4e')],null))['then'](respondWithResult(_0x4e001b,null))[_0xdb49('0x49')](handleError(_0x4e001b,null));};exports[_0xdb49('0x25')]=function(_0x34f578,_0x4a1b42){return db[_0xdb49('0x2f')]['find']({'where':{'id':_0x34f578[_0xdb49('0x4b')]['id']}})[_0xdb49('0x24')](handleEntityNotFound(_0x4a1b42,null))[_0xdb49('0x24')](removeEntity(_0x4a1b42,null))['catch'](handleError(_0x4a1b42,null));};exports['describe']=function(_0x5e40af,_0x307c52){return db[_0xdb49('0x2f')][_0xdb49('0x56')]()[_0xdb49('0x24')](respondWithResult(_0x307c52,null))[_0xdb49('0x49')](handleError(_0x307c52,null));};exports[_0xdb49('0x57')]=function(_0x4ea932,_0x31f56a,_0x551cd1){var _0x5bd6ee={'raw':!![],'where':{}},_0x35ea44={},_0x1f568e;return db[_0xdb49('0x2f')]['findOne']({'where':{'id':_0x4ea932[_0xdb49('0x4b')]['id']}})[_0xdb49('0x24')](handleEntityNotFound(_0x31f56a,null))[_0xdb49('0x24')](function(_0x4e5631){if(_0x4e5631){_0x1f568e=_0x4e5631[_0xdb49('0x26')]({'plain':!![]});_0x35ea44[_0xdb49('0x36')]=_[_0xdb49('0x34')](db['UserWhatsappQueue'][_0xdb49('0x4c')]);_0x35ea44['query']=_['keys'](_0x4ea932[_0xdb49('0x33')]);_0x35ea44['filters']=_[_0xdb49('0x35')](_0x35ea44[_0xdb49('0x36')],_0x35ea44[_0xdb49('0x33')]);_0x5bd6ee[_0xdb49('0x37')]=_['intersection'](_0x35ea44[_0xdb49('0x36')],qs[_0xdb49('0x38')](_0x4ea932[_0xdb49('0x33')][_0xdb49('0x38')]));_0x5bd6ee['attributes']=_0x5bd6ee[_0xdb49('0x37')][_0xdb49('0x39')]?_0x5bd6ee[_0xdb49('0x37')]:_0x35ea44[_0xdb49('0x36')];if(!_0x4ea932[_0xdb49('0x33')][_0xdb49('0x3a')](_0xdb49('0x58'))){_0x5bd6ee[_0xdb49('0x3b')]=qs[_0xdb49('0x3b')](_0x4ea932['query']['limit']);_0x5bd6ee[_0xdb49('0x1e')]=qs[_0xdb49('0x1e')](_0x4ea932['query'][_0xdb49('0x1e')]);}_0x5bd6ee[_0xdb49('0x3c')]=qs[_0xdb49('0x3d')](_0x4ea932['query'][_0xdb49('0x3d')]);_0x5bd6ee[_0xdb49('0x41')]=qs[_0xdb49('0x3f')](_[_0xdb49('0x3e')](_0x4ea932['query'],_0x35ea44['filters']));_0x5bd6ee[_0xdb49('0x41')][_0xdb49('0x59')]=_0x4e5631['id'];if(_0x4ea932[_0xdb49('0x33')]['filter']){_0x5bd6ee[_0xdb49('0x41')]=_[_0xdb49('0x42')](_0x5bd6ee[_0xdb49('0x41')],{'$or':_[_0xdb49('0x32')](_0x5bd6ee['attributes'],function(_0x447e13){var _0x11ab23={};_0x11ab23[_0x447e13]={'$like':'%'+_0x4ea932[_0xdb49('0x33')][_0xdb49('0x40')]+'%'};return _0x11ab23;})});}_0x5bd6ee=_['merge']({},_0x5bd6ee,_0x4ea932['options']);return db[_0xdb49('0x5a')][_0xdb49('0x47')](_0x5bd6ee);}})[_0xdb49('0x24')](function(_0x5e89bb){if(_0x5e89bb){return db[_0xdb49('0x5b')][_0xdb49('0x5c')]({'where':{'id':_[_0xdb49('0x32')](_0x5e89bb,'UserId'),'role':_0xdb49('0x5d')},'attributes':['id',_0xdb49('0x2c'),_0xdb49('0x5e'),'updatedAt',_0xdb49('0x5f')]});}})[_0xdb49('0x24')](function(_0x53db56){if(_0x53db56){return{'count':_0x53db56[_0xdb49('0x1d')],'rows':_[_0xdb49('0x32')](_0x53db56[_0xdb49('0x48')],function(_0x45ba7d){return{'membername':_0x45ba7d['name'],'UserId':_0x45ba7d['id'],'queue_name':_0x1f568e[_0xdb49('0x2c')],'WhatsappQueueId':_0x1f568e['id'],'interface':util[_0xdb49('0x60')](_0xdb49('0x61'),_0xdb49('0x62'),_0x45ba7d[_0xdb49('0x2c')]),'penalty':0x0,'paused':_0x45ba7d[_0xdb49('0x5e')],'createdAt':_0x45ba7d[_0xdb49('0x5f')],'updatedAt':_0x45ba7d[_0xdb49('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x31f56a,_0x5bd6ee))['catch'](handleError(_0x31f56a,null));};exports[_0xdb49('0x64')]=function(_0x5e9661,_0x1d9a34,_0x55d790){var _0x1359f0={};var _0x275e44={};var _0x17fe13;var _0x2208e1;return db['WhatsappQueue'][_0xdb49('0x65')]({'where':{'id':_0x5e9661['params']['id']}})['then'](handleEntityNotFound(_0x1d9a34,null))[_0xdb49('0x24')](function(_0x5ad5cd){if(_0x5ad5cd){_0x17fe13=_0x5ad5cd;_0x275e44[_0xdb49('0x36')]=_[_0xdb49('0x34')](db[_0xdb49('0x66')]['rawAttributes']);_0x275e44[_0xdb49('0x33')]=_[_0xdb49('0x34')](_0x5e9661[_0xdb49('0x33')]);_0x275e44['filters']=_[_0xdb49('0x35')](_0x275e44[_0xdb49('0x36')],_0x275e44['query']);_0x1359f0['attributes']=_[_0xdb49('0x35')](_0x275e44[_0xdb49('0x36')],qs[_0xdb49('0x38')](_0x5e9661[_0xdb49('0x33')][_0xdb49('0x38')]));_0x1359f0[_0xdb49('0x37')]=_0x1359f0[_0xdb49('0x37')][_0xdb49('0x39')]?_0x1359f0[_0xdb49('0x37')]:_0x275e44[_0xdb49('0x36')];_0x1359f0[_0xdb49('0x3c')]=qs[_0xdb49('0x3d')](_0x5e9661[_0xdb49('0x33')][_0xdb49('0x3d')]);_0x1359f0['where']=qs[_0xdb49('0x3f')](_[_0xdb49('0x3e')](_0x5e9661['query'],_0x275e44[_0xdb49('0x3f')]));if(_0x5e9661[_0xdb49('0x33')][_0xdb49('0x40')]){_0x1359f0[_0xdb49('0x41')]=_[_0xdb49('0x42')](_0x1359f0['where'],{'$or':_['map'](_0x1359f0['attributes'],function(_0x44f891){var _0x4d3b48={};_0x4d3b48[_0x44f891]={'$like':'%'+_0x5e9661['query'][_0xdb49('0x40')]+'%'};return _0x4d3b48;})});}_0x1359f0=_[_0xdb49('0x42')]({},_0x1359f0,_0x5e9661[_0xdb49('0x44')]);return _0x17fe13[_0xdb49('0x64')](_0x1359f0);}})[_0xdb49('0x24')](function(_0x3842fc){if(_0x3842fc){_0x2208e1=_0x3842fc[_0xdb49('0x39')];if(!_0x5e9661['query']['hasOwnProperty'](_0xdb49('0x58'))){_0x1359f0[_0xdb49('0x3b')]=qs['limit'](_0x5e9661[_0xdb49('0x33')]['limit']);_0x1359f0['offset']=qs[_0xdb49('0x1e')](_0x5e9661[_0xdb49('0x33')][_0xdb49('0x1e')]);}return _0x17fe13[_0xdb49('0x64')](_0x1359f0);}})['then'](function(_0x13fbc3){if(_0x13fbc3){return _0x13fbc3?{'count':_0x2208e1,'rows':_0x13fbc3}:null;}})[_0xdb49('0x24')](respondWithResult(_0x1d9a34,null))['catch'](handleError(_0x1d9a34,null));};exports[_0xdb49('0x67')]=function(_0x570812,_0x38ab51,_0x1007cb){var _0x396b6a=_0x570812[_0xdb49('0x4e')][_0xdb49('0x68')];return db[_0xdb49('0x66')][_0xdb49('0x47')]({'where':{'id':_0x396b6a},'attributes':['id'],'include':[{'model':db[_0xdb49('0x5b')],'as':'Agents','attributes':['id',_0xdb49('0x2c'),_0xdb49('0x69'),'voicePause',_0xdb49('0x6a')],'raw':!![]}]})[_0xdb49('0x24')](function(_0x4e84c5){if(_0x4e84c5){var _0x7d59cc=_[_0xdb49('0x6b')](_0x4e84c5,function(_0x5b73c8){var _0x34b401=_0x5b73c8[_0xdb49('0x26')]({'plain':!![]});return _0x34b401[_0xdb49('0x6c')];});return db['WhatsappQueue'][_0xdb49('0x53')]({'where':{'id':_0x570812[_0xdb49('0x4b')]['id']}})['then'](function(_0x284b42){return db[_0xdb49('0x6d')]['transaction'](function(_0x517e4e){return _0x284b42['addTeams'](_0x396b6a,{'transaction':_0x517e4e})[_0xdb49('0x24')](function(){return BPromise[_0xdb49('0x6e')](_0x7d59cc,function(_0x4a97b5){return db['UserWhatsappQueue']['findOrCreate']({'where':{'UserId':_0x4a97b5['id'],'WhatsappQueueId':_0x570812[_0xdb49('0x4b')]['id']},'transaction':_0x517e4e});});})[_0xdb49('0x24')](function(){_0x7d59cc[_0xdb49('0x6f')](function(_0x1903a8){socket[_0xdb49('0x70')](_0xdb49('0x71'),{'UserId':_0x1903a8['id'],'WhatsappQueueId':_0x284b42['id']});});});});});}})[_0xdb49('0x24')](respondWithStatusCode(_0x38ab51,null))[_0xdb49('0x49')](handleError(_0x38ab51,null));};exports[_0xdb49('0x72')]=function(_0x4772ee,_0x4f91a6,_0x590c7f){return db[_0xdb49('0x66')][_0xdb49('0x47')]({'where':{'id':_0x4772ee[_0xdb49('0x33')][_0xdb49('0x68')]},'attributes':['id'],'include':[{'model':db[_0xdb49('0x5b')],'as':_0xdb49('0x6c'),'attributes':['id'],'raw':!![]}]})[_0xdb49('0x24')](handleEntityNotFound(_0x4f91a6,null))['then'](function(_0x5b4606){var _0x369c88=_[_0xdb49('0x32')](_0x5b4606,'id');var _0x1cbcab=[];var _0x41f354=[];var _0x4d62ff=squel[_0xdb49('0x73')]();_0x4d62ff[_0xdb49('0x74')](_0xdb49('0x75'))[_0xdb49('0x76')](_0xdb49('0x77'),'tq')[_0xdb49('0x78')](_0xdb49('0x79'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0xdb49('0x7a'),_0x4772ee[_0xdb49('0x4b')]['id']);for(var _0x4a053d=0x0;_0x4a053d<_0x5b4606['length'];_0x4a053d+=0x1){let _0x2f3ad1=_0x5b4606[_0x4a053d];for(var _0x1cdb60=0x0;_0x1cdb60<_0x2f3ad1[_0xdb49('0x6c')][_0xdb49('0x39')];_0x1cdb60+=0x1){let _0x549a65=_0x2f3ad1[_0xdb49('0x6c')][_0x1cdb60];var _0x11f44a=_0x4d62ff['clone']();_0x11f44a[_0xdb49('0x41')](_0xdb49('0x7b'),_0x549a65['id']);_0x41f354[_0xdb49('0x7c')](db['sequelize']['query'](_0x11f44a[_0xdb49('0x7d')](),{'type':db['sequelize']['QueryTypes']['SELECT']})['then'](function(_0x1dd4f9){if(_0x1dd4f9[_0xdb49('0x39')]===0x1){return _0x549a65['id'];}else{var _0x2ec005=_[_0xdb49('0x7e')](_[_0xdb49('0x32')](_0x1dd4f9,_0xdb49('0x7f')),function(_0x209c0a){return _['includes'](_0x369c88,_0x209c0a);});if(_0x2ec005){return _0x549a65['id'];}}}));}}return BPromise[_0xdb49('0x80')](_0x41f354)['then'](function(_0x541f42){_0x1cbcab=_(_0x1cbcab)[_0xdb49('0x81')](_0x541f42)['compact']()[_0xdb49('0x82')]();return db['WhatsappQueue'][_0xdb49('0x53')]({'where':{'id':_0x4772ee[_0xdb49('0x4b')]['id']}})[_0xdb49('0x24')](function(_0x26349c){return db['sequelize'][_0xdb49('0x83')](function(_0x984414){return _0x26349c[_0xdb49('0x72')](_0x4772ee[_0xdb49('0x33')][_0xdb49('0x68')],{'transaction':_0x984414})[_0xdb49('0x24')](function(){if(!_[_0xdb49('0x84')](_0x1cbcab)){return _0x26349c['removeAgents'](_0x1cbcab,{'transaction':_0x984414});}})[_0xdb49('0x24')](function(){_0x1cbcab[_0xdb49('0x6f')](function(_0x37028b){socket['emit'](_0xdb49('0x85'),{'UserId':_0x37028b,'WhatsappQueueId':_0x26349c['id']});});});});});});})[_0xdb49('0x24')](respondWithStatusCode(_0x4f91a6,null))[_0xdb49('0x49')](handleError(_0x4f91a6,null));};exports[_0xdb49('0x86')]=function(_0x59966d,_0x526f3f,_0x529587){return db[_0xdb49('0x2f')][_0xdb49('0x53')]({'where':{'id':_0x59966d[_0xdb49('0x4b')]['id']}})[_0xdb49('0x24')](handleEntityNotFound(_0x526f3f,null))['then'](function(_0x914c43){if(_0x914c43){return _0x914c43['addAgents'](_0x59966d['body'][_0xdb49('0x68')],_[_0xdb49('0x87')](_0x59966d['body'],['ids','id'])||{})['spread'](function(_0x4552c8){for(var _0x59212d=0x0;_0x59212d<_0x59966d['body']['ids']['length'];_0x59212d+=0x1){socket[_0xdb49('0x70')](_0xdb49('0x71'),{'UserId':Number(_0x59966d[_0xdb49('0x4e')][_0xdb49('0x68')][_0x59212d]),'WhatsappQueueId':Number(_0x59966d[_0xdb49('0x4b')]['id'])});}return _0x4552c8;});}})[_0xdb49('0x24')](respondWithResult(_0x526f3f,null))['catch'](handleError(_0x526f3f,null));};exports['removeAgents']=function(_0x70ea38,_0x1e5a89,_0xd09010){return db[_0xdb49('0x2f')]['find']({'where':{'id':_0x70ea38['params']['id']}})[_0xdb49('0x24')](handleEntityNotFound(_0x1e5a89,null))[_0xdb49('0x24')](function(_0x4a471b){if(_0x4a471b){return _0x4a471b[_0xdb49('0x88')](_0x70ea38['query']['ids'])[_0xdb49('0x24')](function(){if(_[_0xdb49('0x89')](_0x70ea38[_0xdb49('0x33')][_0xdb49('0x68')])){for(var _0x5f4846=0x0;_0x5f4846<_0x70ea38[_0xdb49('0x33')][_0xdb49('0x68')][_0xdb49('0x39')];_0x5f4846+=0x1){socket[_0xdb49('0x70')]('userWhatsappQueue:remove',{'UserId':Number(_0x70ea38['query'][_0xdb49('0x68')][_0x5f4846]),'WhatsappQueueId':Number(_0x70ea38[_0xdb49('0x4b')]['id'])});}}else{socket['emit'](_0xdb49('0x85'),{'UserId':Number(_0x70ea38['query'][_0xdb49('0x68')]),'WhatsappQueueId':Number(_0x70ea38[_0xdb49('0x4b')]['id'])});}});}})[_0xdb49('0x24')](respondWithStatusCode(_0x1e5a89,null))[_0xdb49('0x49')](handleError(_0x1e5a89,null));};exports[_0xdb49('0x8a')]=function(_0x16692f,_0x35c2c6,_0x51bfef){var _0x46c2dd={};var _0x28cfd0={};var _0x50e44c;var _0x1ee2fe;return db['WhatsappQueue']['findOne']({'where':{'id':_0x16692f[_0xdb49('0x4b')]['id']}})[_0xdb49('0x24')](handleEntityNotFound(_0x35c2c6,null))[_0xdb49('0x24')](function(_0x2018c2){if(_0x2018c2){_0x50e44c=_0x2018c2;_0x28cfd0[_0xdb49('0x36')]=_['keys'](db[_0xdb49('0x5b')][_0xdb49('0x4c')]);_0x28cfd0[_0xdb49('0x33')]=_[_0xdb49('0x34')](_0x16692f[_0xdb49('0x33')]);_0x28cfd0[_0xdb49('0x3f')]=_['intersection'](_0x28cfd0[_0xdb49('0x36')],_0x28cfd0[_0xdb49('0x33')]);_0x46c2dd[_0xdb49('0x37')]=_[_0xdb49('0x35')](_0x28cfd0['model'],qs[_0xdb49('0x38')](_0x16692f[_0xdb49('0x33')][_0xdb49('0x38')]));_0x46c2dd[_0xdb49('0x37')]=_0x46c2dd[_0xdb49('0x37')][_0xdb49('0x39')]?_0x46c2dd[_0xdb49('0x37')]:_0x28cfd0[_0xdb49('0x36')];_0x46c2dd[_0xdb49('0x3c')]=qs[_0xdb49('0x3d')](_0x16692f[_0xdb49('0x33')][_0xdb49('0x3d')]);_0x46c2dd[_0xdb49('0x41')]=qs[_0xdb49('0x3f')](_['pick'](_0x16692f[_0xdb49('0x33')],_0x28cfd0[_0xdb49('0x3f')]));if(_0x16692f[_0xdb49('0x33')][_0xdb49('0x40')]){_0x46c2dd[_0xdb49('0x41')]=_[_0xdb49('0x42')](_0x46c2dd[_0xdb49('0x41')],{'$or':_[_0xdb49('0x32')](_0x46c2dd['attributes'],function(_0x323717){var _0x1f0ac8={};_0x1f0ac8[_0x323717]={'$like':'%'+_0x16692f['query']['filter']+'%'};return _0x1f0ac8;})});}_0x46c2dd=_[_0xdb49('0x42')]({},_0x46c2dd,_0x16692f[_0xdb49('0x44')]);return _0x50e44c[_0xdb49('0x8a')](_0x46c2dd);}})[_0xdb49('0x24')](function(_0x5588e6){if(_0x5588e6){_0x1ee2fe=_0x5588e6[_0xdb49('0x39')];if(!_0x16692f['query']['hasOwnProperty']('nolimit')){_0x46c2dd['limit']=qs[_0xdb49('0x3b')](_0x16692f[_0xdb49('0x33')][_0xdb49('0x3b')]);_0x46c2dd[_0xdb49('0x1e')]=qs[_0xdb49('0x1e')](_0x16692f[_0xdb49('0x33')][_0xdb49('0x1e')]);}return _0x50e44c[_0xdb49('0x8a')](_0x46c2dd);}})[_0xdb49('0x24')](function(_0x15a40e){if(_0x15a40e){return _0x15a40e?{'count':_0x1ee2fe,'rows':_0x15a40e}:null;}})[_0xdb49('0x24')](respondWithResult(_0x35c2c6,null))[_0xdb49('0x49')](handleError(_0x35c2c6,null));}; \ No newline at end of file +var _0x0a46=['intersection','model','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','findAll','rows','catch','show','includeAll','include','find','create','body','user','get','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','UserWhatsappQueue','nolimit','User','UserId','agent','whatsappPause','createdAt','format','%s/%s','SIP','updatedAt','getTeams','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','each','emit','userWhatsappQueue:save','Team','select','field','tq.TeamId','from','join','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','includes','all','union','value','transaction','removeTeams','isEmpty','removeAgents','forEach','userWhatsappQueue:remove','addAgents','omit','isArray','getAgents','eml-format','rimraf','zip-dir','moment','mustache','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','localhost','socket.io-emitter','./whatsappQueue.socket','sendStatus','status','end','json','offset','undefined','Content-Range','apply','reject','save','update','destroy','then','WhatsappQueues','UserProfileResource','error','stack','name','send','index','map','WhatsappQueue','rawAttributes','key','query','keys'];(function(_0x16dfee,_0x1dba0b){var _0x3ced82=function(_0x1fac3f){while(--_0x1fac3f){_0x16dfee['push'](_0x16dfee['shift']());}};_0x3ced82(++_0x1dba0b);}(_0x0a46,0xe6));var _0x60a4=function(_0x181924,_0x308782){_0x181924=_0x181924-0x0;var _0x3e00c1=_0x0a46[_0x181924];return _0x3e00c1;};'use strict';var emlformat=require(_0x60a4('0x0'));var rimraf=require(_0x60a4('0x1'));var zipdir=require(_0x60a4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x60a4('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x60a4('0x4'));var util=require('util');var path=require('path');var sox=require(_0x60a4('0x5'));var csv=require(_0x60a4('0x6'));var ejs=require(_0x60a4('0x7'));var fs=require('fs');var fs_extra=require(_0x60a4('0x8'));var _=require(_0x60a4('0x9'));var squel=require(_0x60a4('0xa'));var crypto=require(_0x60a4('0xb'));var jsforce=require(_0x60a4('0xc'));var deskjs=require(_0x60a4('0xd'));var toCsv=require(_0x60a4('0x6'));var querystring=require('querystring');var Papa=require(_0x60a4('0xe'));var Redis=require(_0x60a4('0xf'));var authService=require(_0x60a4('0x10'));var qs=require(_0x60a4('0x11'));var as=require(_0x60a4('0x12'));var hardwareService=require(_0x60a4('0x13'));var logger=require(_0x60a4('0x14'))(_0x60a4('0x15'));var utils=require(_0x60a4('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x60a4('0x17'));var db=require(_0x60a4('0x18'))['db'];config[_0x60a4('0x19')]=_[_0x60a4('0x1a')](config['redis'],{'host':_0x60a4('0x1b'),'port':0x18eb});var socket=require(_0x60a4('0x1c'))(new Redis(config[_0x60a4('0x19')]));require(_0x60a4('0x1d'))['register'](socket);function respondWithStatusCode(_0x1bacce,_0x432798){_0x432798=_0x432798||0xcc;return function(_0x31de85){if(_0x31de85){return _0x1bacce[_0x60a4('0x1e')](_0x432798);}return _0x1bacce[_0x60a4('0x1f')](_0x432798)[_0x60a4('0x20')]();};}function respondWithResult(_0x437bed,_0xbd1b12){_0xbd1b12=_0xbd1b12||0xc8;return function(_0x261733){if(_0x261733){return _0x437bed[_0x60a4('0x1f')](_0xbd1b12)[_0x60a4('0x21')](_0x261733);}};}function respondWithFilteredResult(_0x33d79d,_0x20ed4c){return function(_0x5be700){if(_0x5be700){var _0x4f93f8=typeof _0x20ed4c[_0x60a4('0x22')]===_0x60a4('0x23')&&typeof _0x20ed4c['limit']==='undefined';var _0x258073=_0x5be700['count'];var _0x294a93=_0x4f93f8?0x0:_0x20ed4c['offset'];var _0x9043d8=_0x4f93f8?_0x5be700['count']:_0x20ed4c[_0x60a4('0x22')]+_0x20ed4c['limit'];var _0x4e3cbc;if(_0x9043d8>=_0x258073){_0x9043d8=_0x258073;_0x4e3cbc=0xc8;}else{_0x4e3cbc=0xce;}_0x33d79d[_0x60a4('0x1f')](_0x4e3cbc);return _0x33d79d['set'](_0x60a4('0x24'),_0x294a93+'-'+_0x9043d8+'/'+_0x258073)['json'](_0x5be700);}return null;};}function patchUpdates(_0x32c222){return function(_0x30ed35){try{jsonpatch[_0x60a4('0x25')](_0x30ed35,_0x32c222,!![]);}catch(_0x1e5310){return BPromise[_0x60a4('0x26')](_0x1e5310);}return _0x30ed35[_0x60a4('0x27')]();};}function saveUpdates(_0x9d4d29,_0x1c1f42){return function(_0x2c678a){if(_0x2c678a){return _0x2c678a[_0x60a4('0x28')](_0x9d4d29)['then'](function(_0x349760){return _0x349760;});}return null;};}function removeEntity(_0x5f127c,_0x2ecfe7){return function(_0x5b651c){if(_0x5b651c){return _0x5b651c[_0x60a4('0x29')]()[_0x60a4('0x2a')](function(){var _0x203f37=_0x5b651c['get']({'plain':!![]});var _0x2716c6=_0x60a4('0x2b');return db[_0x60a4('0x2c')][_0x60a4('0x29')]({'where':{'type':_0x2716c6,'resourceId':_0x203f37['id']}})['then'](function(){return _0x5b651c;});})[_0x60a4('0x2a')](function(){_0x5f127c[_0x60a4('0x1f')](0xcc)[_0x60a4('0x20')]();});}};}function handleEntityNotFound(_0x2fb631,_0x4639ac){return function(_0x47d03c){if(!_0x47d03c){_0x2fb631[_0x60a4('0x1e')](0x194);}return _0x47d03c;};}function handleError(_0x51a826,_0x468bf4){_0x468bf4=_0x468bf4||0x1f4;return function(_0x5e7c94){logger[_0x60a4('0x2d')](_0x5e7c94[_0x60a4('0x2e')]);if(_0x5e7c94[_0x60a4('0x2f')]){delete _0x5e7c94[_0x60a4('0x2f')];}_0x51a826[_0x60a4('0x1f')](_0x468bf4)[_0x60a4('0x30')](_0x5e7c94);};}exports[_0x60a4('0x31')]=function(_0x2e1fb0,_0x5cd93e){var _0x251bf1={},_0x4ae4a7={},_0x5a95d7={'count':0x0,'rows':[]};var _0x4692e7=_[_0x60a4('0x32')](db[_0x60a4('0x33')][_0x60a4('0x34')],function(_0x5b64e9){return{'name':_0x5b64e9['fieldName'],'type':_0x5b64e9['type'][_0x60a4('0x35')]};});_0x4ae4a7['model']=_[_0x60a4('0x32')](_0x4692e7,_0x60a4('0x2f'));_0x4ae4a7[_0x60a4('0x36')]=_[_0x60a4('0x37')](_0x2e1fb0[_0x60a4('0x36')]);_0x4ae4a7['filters']=_[_0x60a4('0x38')](_0x4ae4a7[_0x60a4('0x39')],_0x4ae4a7[_0x60a4('0x36')]);_0x251bf1[_0x60a4('0x3a')]=_['intersection'](_0x4ae4a7[_0x60a4('0x39')],qs['fields'](_0x2e1fb0[_0x60a4('0x36')][_0x60a4('0x3b')]));_0x251bf1[_0x60a4('0x3a')]=_0x251bf1['attributes'][_0x60a4('0x3c')]?_0x251bf1['attributes']:_0x4ae4a7[_0x60a4('0x39')];if(!_0x2e1fb0[_0x60a4('0x36')][_0x60a4('0x3d')]('nolimit')){_0x251bf1['limit']=qs[_0x60a4('0x3e')](_0x2e1fb0[_0x60a4('0x36')][_0x60a4('0x3e')]);_0x251bf1[_0x60a4('0x22')]=qs[_0x60a4('0x22')](_0x2e1fb0[_0x60a4('0x36')][_0x60a4('0x22')]);}_0x251bf1[_0x60a4('0x3f')]=qs[_0x60a4('0x40')](_0x2e1fb0[_0x60a4('0x36')]['sort']);_0x251bf1[_0x60a4('0x41')]=qs[_0x60a4('0x42')](_[_0x60a4('0x43')](_0x2e1fb0[_0x60a4('0x36')],_0x4ae4a7[_0x60a4('0x42')]),_0x4692e7);if(_0x2e1fb0[_0x60a4('0x36')][_0x60a4('0x44')]){_0x251bf1[_0x60a4('0x41')]=_[_0x60a4('0x45')](_0x251bf1['where'],{'$or':_['map'](_0x4692e7,function(_0x4de52b){if(_0x4de52b['type']!==_0x60a4('0x46')){var _0x1538d4={};_0x1538d4[_0x4de52b[_0x60a4('0x2f')]]={'$like':'%'+_0x2e1fb0['query'][_0x60a4('0x44')]+'%'};return _0x1538d4;}})});}_0x251bf1=_[_0x60a4('0x45')]({},_0x251bf1,_0x2e1fb0[_0x60a4('0x47')]);var _0x3a6247={'where':_0x251bf1[_0x60a4('0x41')]};return db[_0x60a4('0x33')][_0x60a4('0x48')](_0x3a6247)['then'](function(_0x44f66b){_0x5a95d7[_0x60a4('0x48')]=_0x44f66b;if(_0x2e1fb0['query']['includeAll']){_0x251bf1['include']=[{'all':!![]}];}return db[_0x60a4('0x33')][_0x60a4('0x49')](_0x251bf1);})[_0x60a4('0x2a')](function(_0x3d53db){_0x5a95d7[_0x60a4('0x4a')]=_0x3d53db;return _0x5a95d7;})['then'](respondWithFilteredResult(_0x5cd93e,_0x251bf1))[_0x60a4('0x4b')](handleError(_0x5cd93e,null));};exports[_0x60a4('0x4c')]=function(_0x64e06,_0x179477){var _0x139c00={'raw':!![],'where':{'id':_0x64e06['params']['id']}},_0x55d866={};_0x55d866[_0x60a4('0x39')]=_[_0x60a4('0x37')](db['WhatsappQueue']['rawAttributes']);_0x55d866[_0x60a4('0x36')]=_[_0x60a4('0x37')](_0x64e06[_0x60a4('0x36')]);_0x55d866[_0x60a4('0x42')]=_[_0x60a4('0x38')](_0x55d866[_0x60a4('0x39')],_0x55d866['query']);_0x139c00['attributes']=_['intersection'](_0x55d866[_0x60a4('0x39')],qs[_0x60a4('0x3b')](_0x64e06[_0x60a4('0x36')][_0x60a4('0x3b')]));_0x139c00[_0x60a4('0x3a')]=_0x139c00[_0x60a4('0x3a')][_0x60a4('0x3c')]?_0x139c00[_0x60a4('0x3a')]:_0x55d866['model'];if(_0x64e06[_0x60a4('0x36')][_0x60a4('0x4d')]){_0x139c00[_0x60a4('0x4e')]=[{'all':!![]}];}_0x139c00=_[_0x60a4('0x45')]({},_0x139c00,_0x64e06[_0x60a4('0x47')]);return db[_0x60a4('0x33')][_0x60a4('0x4f')](_0x139c00)[_0x60a4('0x2a')](handleEntityNotFound(_0x179477,null))[_0x60a4('0x2a')](respondWithResult(_0x179477,null))['catch'](handleError(_0x179477,null));};exports['create']=function(_0x16d4a1,_0x3ccef8){return db[_0x60a4('0x33')][_0x60a4('0x50')](_0x16d4a1[_0x60a4('0x51')],{})[_0x60a4('0x2a')](function(_0x2209a0){var _0x22ce23=_0x16d4a1[_0x60a4('0x52')][_0x60a4('0x53')]({'plain':!![]});if(!_0x22ce23)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x22ce23[_0x60a4('0x54')]===_0x60a4('0x52')){var _0x2a8491=_0x2209a0[_0x60a4('0x53')]({'plain':!![]});var _0x4bb702=_0x60a4('0x2b');return db['UserProfileSection'][_0x60a4('0x4f')]({'where':{'name':_0x4bb702,'userProfileId':_0x22ce23[_0x60a4('0x55')]},'raw':!![]})[_0x60a4('0x2a')](function(_0x3e7896){if(_0x3e7896&&_0x3e7896[_0x60a4('0x56')]===0x0){return db[_0x60a4('0x2c')][_0x60a4('0x50')]({'name':_0x2a8491[_0x60a4('0x2f')],'resourceId':_0x2a8491['id'],'type':_0x3e7896[_0x60a4('0x2f')],'sectionId':_0x3e7896['id']},{})[_0x60a4('0x2a')](function(){return _0x2209a0;});}else{return _0x2209a0;}})['catch'](function(_0xa7abd0){logger[_0x60a4('0x2d')](_0x60a4('0x57'),_0xa7abd0);throw _0xa7abd0;});}return _0x2209a0;})['then'](respondWithResult(_0x3ccef8,0xc9))[_0x60a4('0x4b')](handleError(_0x3ccef8,null));};exports[_0x60a4('0x28')]=function(_0x1c47cc,_0x16558d){if(_0x1c47cc['body']['id']){delete _0x1c47cc['body']['id'];}return db[_0x60a4('0x33')]['find']({'where':{'id':_0x1c47cc[_0x60a4('0x58')]['id']}})[_0x60a4('0x2a')](handleEntityNotFound(_0x16558d,null))['then'](saveUpdates(_0x1c47cc['body'],null))['then'](respondWithResult(_0x16558d,null))['catch'](handleError(_0x16558d,null));};exports[_0x60a4('0x29')]=function(_0x7594b5,_0x584356){return db[_0x60a4('0x33')]['find']({'where':{'id':_0x7594b5[_0x60a4('0x58')]['id']}})[_0x60a4('0x2a')](handleEntityNotFound(_0x584356,null))[_0x60a4('0x2a')](removeEntity(_0x584356,null))['catch'](handleError(_0x584356,null));};exports[_0x60a4('0x59')]=function(_0x388675,_0x357d67){return db[_0x60a4('0x33')][_0x60a4('0x59')]()[_0x60a4('0x2a')](respondWithResult(_0x357d67,null))[_0x60a4('0x4b')](handleError(_0x357d67,null));};exports[_0x60a4('0x5a')]=function(_0x1896cb,_0x734fd6,_0x2aacc0){var _0x156993={'raw':!![],'where':{}},_0x548b89={},_0x58ceca;return db[_0x60a4('0x33')][_0x60a4('0x5b')]({'where':{'id':_0x1896cb[_0x60a4('0x58')]['id']}})[_0x60a4('0x2a')](handleEntityNotFound(_0x734fd6,null))[_0x60a4('0x2a')](function(_0x5645c4){if(_0x5645c4){_0x58ceca=_0x5645c4['get']({'plain':!![]});_0x548b89[_0x60a4('0x39')]=_[_0x60a4('0x37')](db[_0x60a4('0x5c')][_0x60a4('0x34')]);_0x548b89['query']=_[_0x60a4('0x37')](_0x1896cb[_0x60a4('0x36')]);_0x548b89[_0x60a4('0x42')]=_[_0x60a4('0x38')](_0x548b89[_0x60a4('0x39')],_0x548b89['query']);_0x156993['attributes']=_[_0x60a4('0x38')](_0x548b89[_0x60a4('0x39')],qs['fields'](_0x1896cb[_0x60a4('0x36')]['fields']));_0x156993[_0x60a4('0x3a')]=_0x156993['attributes'][_0x60a4('0x3c')]?_0x156993[_0x60a4('0x3a')]:_0x548b89[_0x60a4('0x39')];if(!_0x1896cb[_0x60a4('0x36')][_0x60a4('0x3d')](_0x60a4('0x5d'))){_0x156993['limit']=qs[_0x60a4('0x3e')](_0x1896cb[_0x60a4('0x36')][_0x60a4('0x3e')]);_0x156993['offset']=qs[_0x60a4('0x22')](_0x1896cb[_0x60a4('0x36')]['offset']);}_0x156993['order']=qs[_0x60a4('0x40')](_0x1896cb[_0x60a4('0x36')][_0x60a4('0x40')]);_0x156993[_0x60a4('0x41')]=qs['filters'](_['pick'](_0x1896cb['query'],_0x548b89[_0x60a4('0x42')]));_0x156993[_0x60a4('0x41')]['WhatsappQueueId']=_0x5645c4['id'];if(_0x1896cb[_0x60a4('0x36')][_0x60a4('0x44')]){_0x156993['where']=_[_0x60a4('0x45')](_0x156993[_0x60a4('0x41')],{'$or':_['map'](_0x156993[_0x60a4('0x3a')],function(_0x12c8c2){var _0x21d9bb={};_0x21d9bb[_0x12c8c2]={'$like':'%'+_0x1896cb[_0x60a4('0x36')]['filter']+'%'};return _0x21d9bb;})});}_0x156993=_[_0x60a4('0x45')]({},_0x156993,_0x1896cb[_0x60a4('0x47')]);return db['UserWhatsappQueue']['findAll'](_0x156993);}})[_0x60a4('0x2a')](function(_0x1c4625){if(_0x1c4625){return db[_0x60a4('0x5e')]['findAndCountAll']({'where':{'id':_[_0x60a4('0x32')](_0x1c4625,_0x60a4('0x5f')),'role':_0x60a4('0x60')},'attributes':['id',_0x60a4('0x2f'),_0x60a4('0x61'),'updatedAt',_0x60a4('0x62')]});}})[_0x60a4('0x2a')](function(_0x1d6bab){if(_0x1d6bab){return{'count':_0x1d6bab[_0x60a4('0x48')],'rows':_['map'](_0x1d6bab['rows'],function(_0x3abf20){return{'membername':_0x3abf20[_0x60a4('0x2f')],'UserId':_0x3abf20['id'],'queue_name':_0x58ceca[_0x60a4('0x2f')],'WhatsappQueueId':_0x58ceca['id'],'interface':util[_0x60a4('0x63')](_0x60a4('0x64'),_0x60a4('0x65'),_0x3abf20[_0x60a4('0x2f')]),'penalty':0x0,'paused':_0x3abf20[_0x60a4('0x61')],'createdAt':_0x3abf20[_0x60a4('0x62')],'updatedAt':_0x3abf20[_0x60a4('0x66')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x60a4('0x2a')](respondWithFilteredResult(_0x734fd6,_0x156993))[_0x60a4('0x4b')](handleError(_0x734fd6,null));};exports[_0x60a4('0x67')]=function(_0x579383,_0x1beb5b,_0x4808f8){var _0x24312a={};var _0x53ef0a={};var _0x1eb78e;var _0x2e30b5;return db[_0x60a4('0x33')][_0x60a4('0x5b')]({'where':{'id':_0x579383[_0x60a4('0x58')]['id']}})['then'](handleEntityNotFound(_0x1beb5b,null))[_0x60a4('0x2a')](function(_0x5b131a){if(_0x5b131a){_0x1eb78e=_0x5b131a;_0x53ef0a[_0x60a4('0x39')]=_[_0x60a4('0x37')](db['Team'][_0x60a4('0x34')]);_0x53ef0a['query']=_[_0x60a4('0x37')](_0x579383['query']);_0x53ef0a[_0x60a4('0x42')]=_['intersection'](_0x53ef0a[_0x60a4('0x39')],_0x53ef0a['query']);_0x24312a[_0x60a4('0x3a')]=_[_0x60a4('0x38')](_0x53ef0a[_0x60a4('0x39')],qs[_0x60a4('0x3b')](_0x579383[_0x60a4('0x36')][_0x60a4('0x3b')]));_0x24312a[_0x60a4('0x3a')]=_0x24312a['attributes'][_0x60a4('0x3c')]?_0x24312a[_0x60a4('0x3a')]:_0x53ef0a[_0x60a4('0x39')];_0x24312a[_0x60a4('0x3f')]=qs[_0x60a4('0x40')](_0x579383[_0x60a4('0x36')][_0x60a4('0x40')]);_0x24312a[_0x60a4('0x41')]=qs[_0x60a4('0x42')](_[_0x60a4('0x43')](_0x579383['query'],_0x53ef0a[_0x60a4('0x42')]));if(_0x579383['query'][_0x60a4('0x44')]){_0x24312a['where']=_['merge'](_0x24312a['where'],{'$or':_['map'](_0x24312a[_0x60a4('0x3a')],function(_0x4c9932){var _0x136616={};_0x136616[_0x4c9932]={'$like':'%'+_0x579383[_0x60a4('0x36')]['filter']+'%'};return _0x136616;})});}_0x24312a=_[_0x60a4('0x45')]({},_0x24312a,_0x579383[_0x60a4('0x47')]);return _0x1eb78e[_0x60a4('0x67')](_0x24312a);}})[_0x60a4('0x2a')](function(_0x677d5e){if(_0x677d5e){_0x2e30b5=_0x677d5e[_0x60a4('0x3c')];if(!_0x579383[_0x60a4('0x36')][_0x60a4('0x3d')](_0x60a4('0x5d'))){_0x24312a[_0x60a4('0x3e')]=qs[_0x60a4('0x3e')](_0x579383[_0x60a4('0x36')][_0x60a4('0x3e')]);_0x24312a[_0x60a4('0x22')]=qs['offset'](_0x579383['query'][_0x60a4('0x22')]);}return _0x1eb78e[_0x60a4('0x67')](_0x24312a);}})['then'](function(_0x47d3b7){if(_0x47d3b7){return _0x47d3b7?{'count':_0x2e30b5,'rows':_0x47d3b7}:null;}})[_0x60a4('0x2a')](respondWithResult(_0x1beb5b,null))['catch'](handleError(_0x1beb5b,null));};exports[_0x60a4('0x68')]=function(_0x3ed1b6,_0x4f9bad,_0x3644ca){var _0x342103=_0x3ed1b6[_0x60a4('0x51')][_0x60a4('0x69')];return db['Team'][_0x60a4('0x49')]({'where':{'id':_0x342103},'attributes':['id'],'include':[{'model':db['User'],'as':_0x60a4('0x6a'),'attributes':['id','name',_0x60a4('0x6b'),_0x60a4('0x6c'),_0x60a4('0x6d')],'raw':!![]}]})[_0x60a4('0x2a')](function(_0xbbd65b){if(_0xbbd65b){var _0x51a512=_[_0x60a4('0x6e')](_0xbbd65b,function(_0x114141){var _0x498817=_0x114141[_0x60a4('0x53')]({'plain':!![]});return _0x498817['Agents'];});return db[_0x60a4('0x33')][_0x60a4('0x4f')]({'where':{'id':_0x3ed1b6['params']['id']}})['then'](function(_0x576492){return db[_0x60a4('0x6f')]['transaction'](function(_0xe426eb){return _0x576492[_0x60a4('0x68')](_0x342103,{'transaction':_0xe426eb})[_0x60a4('0x2a')](function(){return BPromise[_0x60a4('0x70')](_0x51a512,function(_0x5ce08c){return db[_0x60a4('0x5c')]['findOrCreate']({'where':{'UserId':_0x5ce08c['id'],'WhatsappQueueId':_0x3ed1b6[_0x60a4('0x58')]['id']},'transaction':_0xe426eb});});})[_0x60a4('0x2a')](function(){_0x51a512['forEach'](function(_0x541515){socket[_0x60a4('0x71')](_0x60a4('0x72'),{'UserId':_0x541515['id'],'WhatsappQueueId':_0x576492['id']});});});});});}})[_0x60a4('0x2a')](respondWithStatusCode(_0x4f9bad,null))['catch'](handleError(_0x4f9bad,null));};exports['removeTeams']=function(_0x7416b8,_0x1d76aa,_0x391f2a){return db[_0x60a4('0x73')][_0x60a4('0x49')]({'where':{'id':_0x7416b8[_0x60a4('0x36')]['ids']},'attributes':['id'],'include':[{'model':db[_0x60a4('0x5e')],'as':_0x60a4('0x6a'),'attributes':['id'],'raw':!![]}]})[_0x60a4('0x2a')](handleEntityNotFound(_0x1d76aa,null))[_0x60a4('0x2a')](function(_0x1dfba1){var _0xf170e2=_[_0x60a4('0x32')](_0x1dfba1,'id');var _0x43a590=[];var _0x81c0f9=[];var _0x1dfea0=squel[_0x60a4('0x74')]();_0x1dfea0[_0x60a4('0x75')](_0x60a4('0x76'))[_0x60a4('0x77')]('team_has_whatsapp_queues','tq')[_0x60a4('0x78')]('user_has_teams','ut',_0x60a4('0x79'))[_0x60a4('0x41')](_0x60a4('0x7a'),_0x7416b8[_0x60a4('0x58')]['id']);for(var _0xbb5f68=0x0;_0xbb5f68<_0x1dfba1['length'];_0xbb5f68+=0x1){let _0x37e409=_0x1dfba1[_0xbb5f68];for(var _0x588a78=0x0;_0x588a78<_0x37e409[_0x60a4('0x6a')][_0x60a4('0x3c')];_0x588a78+=0x1){let _0xd8c35d=_0x37e409[_0x60a4('0x6a')][_0x588a78];var _0x27f1ec=_0x1dfea0[_0x60a4('0x7b')]();_0x27f1ec[_0x60a4('0x41')](_0x60a4('0x7c'),_0xd8c35d['id']);_0x81c0f9[_0x60a4('0x7d')](db['sequelize'][_0x60a4('0x36')](_0x27f1ec[_0x60a4('0x7e')](),{'type':db['sequelize'][_0x60a4('0x7f')]['SELECT']})[_0x60a4('0x2a')](function(_0xafba02){if(_0xafba02['length']===0x1){return _0xd8c35d['id'];}else{var _0x3ecbf6=_[_0x60a4('0x80')](_[_0x60a4('0x32')](_0xafba02,'TeamId'),function(_0x2757b1){return _[_0x60a4('0x81')](_0xf170e2,_0x2757b1);});if(_0x3ecbf6){return _0xd8c35d['id'];}}}));}}return BPromise[_0x60a4('0x82')](_0x81c0f9)[_0x60a4('0x2a')](function(_0x37d514){_0x43a590=_(_0x43a590)[_0x60a4('0x83')](_0x37d514)['compact']()[_0x60a4('0x84')]();return db[_0x60a4('0x33')][_0x60a4('0x4f')]({'where':{'id':_0x7416b8[_0x60a4('0x58')]['id']}})[_0x60a4('0x2a')](function(_0x3f5584){return db[_0x60a4('0x6f')][_0x60a4('0x85')](function(_0x411e91){return _0x3f5584[_0x60a4('0x86')](_0x7416b8[_0x60a4('0x36')][_0x60a4('0x69')],{'transaction':_0x411e91})['then'](function(){if(!_[_0x60a4('0x87')](_0x43a590)){return _0x3f5584[_0x60a4('0x88')](_0x43a590,{'transaction':_0x411e91});}})[_0x60a4('0x2a')](function(){_0x43a590[_0x60a4('0x89')](function(_0x587a81){socket[_0x60a4('0x71')](_0x60a4('0x8a'),{'UserId':_0x587a81,'WhatsappQueueId':_0x3f5584['id']});});});});});});})[_0x60a4('0x2a')](respondWithStatusCode(_0x1d76aa,null))[_0x60a4('0x4b')](handleError(_0x1d76aa,null));};exports[_0x60a4('0x8b')]=function(_0x5efeea,_0x49302c,_0x5cb277){return db['WhatsappQueue']['find']({'where':{'id':_0x5efeea[_0x60a4('0x58')]['id']}})[_0x60a4('0x2a')](handleEntityNotFound(_0x49302c,null))[_0x60a4('0x2a')](function(_0x26bc50){if(_0x26bc50){return _0x26bc50['addAgents'](_0x5efeea[_0x60a4('0x51')]['ids'],_[_0x60a4('0x8c')](_0x5efeea[_0x60a4('0x51')],[_0x60a4('0x69'),'id'])||{})['spread'](function(_0x12fc0e){for(var _0x5bc8d5=0x0;_0x5bc8d5<_0x5efeea[_0x60a4('0x51')][_0x60a4('0x69')][_0x60a4('0x3c')];_0x5bc8d5+=0x1){socket[_0x60a4('0x71')](_0x60a4('0x72'),{'UserId':Number(_0x5efeea['body'][_0x60a4('0x69')][_0x5bc8d5]),'WhatsappQueueId':Number(_0x5efeea[_0x60a4('0x58')]['id'])});}return _0x12fc0e;});}})[_0x60a4('0x2a')](respondWithResult(_0x49302c,null))[_0x60a4('0x4b')](handleError(_0x49302c,null));};exports[_0x60a4('0x88')]=function(_0x33c8f1,_0x1b75bd,_0x44c54a){return db[_0x60a4('0x33')][_0x60a4('0x4f')]({'where':{'id':_0x33c8f1[_0x60a4('0x58')]['id']}})[_0x60a4('0x2a')](handleEntityNotFound(_0x1b75bd,null))[_0x60a4('0x2a')](function(_0x4c37b6){if(_0x4c37b6){return _0x4c37b6[_0x60a4('0x88')](_0x33c8f1[_0x60a4('0x36')][_0x60a4('0x69')])[_0x60a4('0x2a')](function(){if(_[_0x60a4('0x8d')](_0x33c8f1[_0x60a4('0x36')]['ids'])){for(var _0x4f6eb2=0x0;_0x4f6eb2<_0x33c8f1[_0x60a4('0x36')][_0x60a4('0x69')][_0x60a4('0x3c')];_0x4f6eb2+=0x1){socket[_0x60a4('0x71')](_0x60a4('0x8a'),{'UserId':Number(_0x33c8f1['query'][_0x60a4('0x69')][_0x4f6eb2]),'WhatsappQueueId':Number(_0x33c8f1[_0x60a4('0x58')]['id'])});}}else{socket[_0x60a4('0x71')](_0x60a4('0x8a'),{'UserId':Number(_0x33c8f1['query'][_0x60a4('0x69')]),'WhatsappQueueId':Number(_0x33c8f1[_0x60a4('0x58')]['id'])});}});}})[_0x60a4('0x2a')](respondWithStatusCode(_0x1b75bd,null))['catch'](handleError(_0x1b75bd,null));};exports[_0x60a4('0x8e')]=function(_0x2d4a54,_0x612d6a,_0x49949e){var _0xafcdb8={};var _0x24e0e0={};var _0x4535ad;var _0x38d1c7;return db[_0x60a4('0x33')][_0x60a4('0x5b')]({'where':{'id':_0x2d4a54[_0x60a4('0x58')]['id']}})[_0x60a4('0x2a')](handleEntityNotFound(_0x612d6a,null))['then'](function(_0x429895){if(_0x429895){_0x4535ad=_0x429895;_0x24e0e0[_0x60a4('0x39')]=_['keys'](db['User']['rawAttributes']);_0x24e0e0[_0x60a4('0x36')]=_['keys'](_0x2d4a54['query']);_0x24e0e0[_0x60a4('0x42')]=_[_0x60a4('0x38')](_0x24e0e0[_0x60a4('0x39')],_0x24e0e0[_0x60a4('0x36')]);_0xafcdb8[_0x60a4('0x3a')]=_[_0x60a4('0x38')](_0x24e0e0[_0x60a4('0x39')],qs[_0x60a4('0x3b')](_0x2d4a54[_0x60a4('0x36')][_0x60a4('0x3b')]));_0xafcdb8[_0x60a4('0x3a')]=_0xafcdb8[_0x60a4('0x3a')][_0x60a4('0x3c')]?_0xafcdb8[_0x60a4('0x3a')]:_0x24e0e0[_0x60a4('0x39')];_0xafcdb8[_0x60a4('0x3f')]=qs['sort'](_0x2d4a54[_0x60a4('0x36')][_0x60a4('0x40')]);_0xafcdb8[_0x60a4('0x41')]=qs[_0x60a4('0x42')](_[_0x60a4('0x43')](_0x2d4a54[_0x60a4('0x36')],_0x24e0e0[_0x60a4('0x42')]));if(_0x2d4a54[_0x60a4('0x36')][_0x60a4('0x44')]){_0xafcdb8[_0x60a4('0x41')]=_[_0x60a4('0x45')](_0xafcdb8[_0x60a4('0x41')],{'$or':_[_0x60a4('0x32')](_0xafcdb8['attributes'],function(_0x35b5d0){var _0x490534={};_0x490534[_0x35b5d0]={'$like':'%'+_0x2d4a54[_0x60a4('0x36')][_0x60a4('0x44')]+'%'};return _0x490534;})});}_0xafcdb8=_[_0x60a4('0x45')]({},_0xafcdb8,_0x2d4a54[_0x60a4('0x47')]);return _0x4535ad[_0x60a4('0x8e')](_0xafcdb8);}})[_0x60a4('0x2a')](function(_0x5c2c05){if(_0x5c2c05){_0x38d1c7=_0x5c2c05[_0x60a4('0x3c')];if(!_0x2d4a54[_0x60a4('0x36')][_0x60a4('0x3d')](_0x60a4('0x5d'))){_0xafcdb8[_0x60a4('0x3e')]=qs[_0x60a4('0x3e')](_0x2d4a54[_0x60a4('0x36')][_0x60a4('0x3e')]);_0xafcdb8[_0x60a4('0x22')]=qs['offset'](_0x2d4a54['query'][_0x60a4('0x22')]);}return _0x4535ad[_0x60a4('0x8e')](_0xafcdb8);}})[_0x60a4('0x2a')](function(_0x5a6c93){if(_0x5a6c93){return _0x5a6c93?{'count':_0x38d1c7,'rows':_0x5a6c93}:null;}})[_0x60a4('0x2a')](respondWithResult(_0x612d6a,null))[_0x60a4('0x4b')](handleError(_0x612d6a,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 5d0600a..7990d1e 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 _0x94cf=['save','remove','emit','hasOwnProperty','exports','events','../../mysqldb','WhatsappQueue','setMaxListeners'];(function(_0xd29952,_0x353ba8){var _0x3cd62d=function(_0x2915c4){while(--_0x2915c4){_0xd29952['push'](_0xd29952['shift']());}};_0x3cd62d(++_0x353ba8);}(_0x94cf,0x9e));var _0xf94c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x94cf[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xf94c('0x0'));var WhatsappQueue=require(_0xf94c('0x1'))['db'][_0xf94c('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xf94c('0x3')](0x0);var events={'afterCreate':_0xf94c('0x4'),'afterUpdate':'update','afterDestroy':_0xf94c('0x5')};function emitEvent(_0x40a0b7){return function(_0x5f234d,_0x326ca7,_0x5f4508){WhatsappQueueEvents[_0xf94c('0x6')](_0x40a0b7+':'+_0x5f234d['id'],_0x5f234d);WhatsappQueueEvents[_0xf94c('0x6')](_0x40a0b7,_0x5f234d);_0x5f4508(null);};}for(var e in events){if(events[_0xf94c('0x7')](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0xf94c('0x8')]=WhatsappQueueEvents; \ No newline at end of file +var _0x0b3f=['emit','hook','exports','events','../../mysqldb','WhatsappQueue','setMaxListeners','save','remove'];(function(_0x3c8a35,_0x44641b){var _0x40033a=function(_0x33bc80){while(--_0x33bc80){_0x3c8a35['push'](_0x3c8a35['shift']());}};_0x40033a(++_0x44641b);}(_0x0b3f,0x186));var _0xf0b3=function(_0x13f305,_0x5618cb){_0x13f305=_0x13f305-0x0;var _0x45b23a=_0x0b3f[_0x13f305];return _0x45b23a;};'use strict';var EventEmitter=require(_0xf0b3('0x0'));var WhatsappQueue=require(_0xf0b3('0x1'))['db'][_0xf0b3('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xf0b3('0x3')](0x0);var events={'afterCreate':_0xf0b3('0x4'),'afterUpdate':'update','afterDestroy':_0xf0b3('0x5')};function emitEvent(_0x494104){return function(_0x134aba,_0x246161,_0x16c291){WhatsappQueueEvents[_0xf0b3('0x6')](_0x494104+':'+_0x134aba['id'],_0x134aba);WhatsappQueueEvents[_0xf0b3('0x6')](_0x494104,_0x134aba);_0x16c291(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0xf0b3('0x7')](e,emitEvent(event));}}module[_0xf0b3('0x8')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index b8497df..a1570b1 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 _0x887c=['bluebird','request-promise','path','rimraf','./whatsappQueue.attributes','define','WhatsappQueue','whatsapp_queues','util','moment'];(function(_0x9a36ec,_0x7afd44){var _0x397955=function(_0x16e50e){while(--_0x16e50e){_0x9a36ec['push'](_0x9a36ec['shift']());}};_0x397955(++_0x7afd44);}(_0x887c,0x6c));var _0xc887=function(_0x19b3f8,_0x150751){_0x19b3f8=_0x19b3f8-0x0;var _0x22c3a1=_0x887c[_0x19b3f8];return _0x22c3a1;};'use strict';var _=require('lodash');var util=require(_0xc887('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xc887('0x1'));var BPromise=require(_0xc887('0x2'));var rp=require(_0xc887('0x3'));var fs=require('fs');var path=require(_0xc887('0x4'));var rimraf=require(_0xc887('0x5'));var config=require('../../config/environment');var attributes=require(_0xc887('0x6'));module['exports']=function(_0x2d9f62,_0x4a7b5c){return _0x2d9f62[_0xc887('0x7')](_0xc887('0x8'),attributes,{'tableName':_0xc887('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc6a7=['path','./whatsappQueue.attributes','define','WhatsappQueue','whatsapp_queues','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5dd05a,_0x53abd1){var _0x15c528=function(_0x42d9f4){while(--_0x42d9f4){_0x5dd05a['push'](_0x5dd05a['shift']());}};_0x15c528(++_0x53abd1);}(_0xc6a7,0xec));var _0x7c6a=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0xc6a7[_0x5a776b];return _0xbbef59;};'use strict';var _=require(_0x7c6a('0x0'));var util=require('util');var logger=require(_0x7c6a('0x1'))(_0x7c6a('0x2'));var moment=require(_0x7c6a('0x3'));var BPromise=require(_0x7c6a('0x4'));var rp=require(_0x7c6a('0x5'));var fs=require('fs');var path=require(_0x7c6a('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7c6a('0x7'));module['exports']=function(_0x1cc51d,_0x12037d){return _0x1cc51d[_0x7c6a('0x8')](_0x7c6a('0x9'),attributes,{'tableName':_0x7c6a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index 7ea5663..0b0a5f7 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 _0xd5a3=['../../config/environment','jayson/promise','client','redis','localhost','register','request','then','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','where','limit','include','model','attributes','map','stringify','ShowWhatsappQueue','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x1486af,_0x43fc96){var _0x41a52e=function(_0x5c6a28){while(--_0x5c6a28){_0x1486af['push'](_0x1486af['shift']());}};_0x41a52e(++_0x43fc96);}(_0xd5a3,0xdc));var _0x3d5a=function(_0x310e02,_0x472a9d){_0x310e02=_0x310e02-0x0;var _0x5c9ef2=_0xd5a3[_0x310e02];return _0x5c9ef2;};'use strict';var _=require('lodash');var util=require(_0x3d5a('0x0'));var moment=require(_0x3d5a('0x1'));var BPromise=require(_0x3d5a('0x2'));var rs=require(_0x3d5a('0x3'));var fs=require('fs');var Redis=require(_0x3d5a('0x4'));var db=require(_0x3d5a('0x5'))['db'];var utils=require(_0x3d5a('0x6'));var logger=require('../../config/logger')(_0x3d5a('0x7'));var config=require(_0x3d5a('0x8'));var jayson=require(_0x3d5a('0x9'));var client=jayson[_0x3d5a('0xa')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x3d5a('0xb')],{'host':_0x3d5a('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3d5a('0xb')]));require('./whatsappQueue.socket')[_0x3d5a('0xd')](socket);function respondWithRpcPromise(_0x58cc58,_0x572ac5,_0x40072d){return new BPromise(function(_0xb0c136,_0x31925e){return client[_0x3d5a('0xe')](_0x58cc58,_0x40072d)[_0x3d5a('0xf')](function(_0x5876db){logger['info'](_0x3d5a('0x10'),_0x572ac5,_0x3d5a('0x11'));logger[_0x3d5a('0x12')](_0x3d5a('0x13'),_0x572ac5,'request\x20sent',JSON['stringify'](_0x5876db));if(_0x5876db[_0x3d5a('0x14')]){if(_0x5876db[_0x3d5a('0x14')][_0x3d5a('0x15')]===0x1f4){logger[_0x3d5a('0x14')](_0x3d5a('0x10'),_0x572ac5,_0x5876db[_0x3d5a('0x14')][_0x3d5a('0x16')]);return _0x31925e(_0x5876db[_0x3d5a('0x14')][_0x3d5a('0x16')]);}logger[_0x3d5a('0x14')](_0x3d5a('0x10'),_0x572ac5,_0x5876db[_0x3d5a('0x14')]['message']);return _0xb0c136(_0x5876db['error']['message']);}else{logger[_0x3d5a('0x17')](_0x3d5a('0x10'),_0x572ac5,'request\x20sent');_0xb0c136(_0x5876db['result'][_0x3d5a('0x16')]);}})[_0x3d5a('0x18')](function(_0x267cbb){logger[_0x3d5a('0x14')](_0x3d5a('0x10'),_0x572ac5,_0x267cbb);_0x31925e(_0x267cbb);});});}exports[_0x3d5a('0x19')]=function(_0x16f8a7){var _0x4a3ebe=this;return new Promise(function(_0x340424,_0x9d4201){return db[_0x3d5a('0x1a')][_0x3d5a('0x1b')]({'raw':_0x16f8a7['options']?_0x16f8a7[_0x3d5a('0x1c')][_0x3d5a('0x1d')]===undefined?!![]:![]:!![],'where':_0x16f8a7[_0x3d5a('0x1c')]?_0x16f8a7[_0x3d5a('0x1c')][_0x3d5a('0x1e')]||null:null,'attributes':_0x16f8a7[_0x3d5a('0x1c')]?_0x16f8a7['options']['attributes']||null:null,'limit':_0x16f8a7['options']?_0x16f8a7[_0x3d5a('0x1c')][_0x3d5a('0x1f')]||null:null,'include':_0x16f8a7[_0x3d5a('0x1c')]?_0x16f8a7[_0x3d5a('0x1c')][_0x3d5a('0x20')]?_['map'](_0x16f8a7[_0x3d5a('0x1c')]['include'],function(_0x15e289){return{'model':db[_0x15e289['model']],'as':_0x15e289['as'],'attributes':_0x15e289['attributes'],'include':_0x15e289['include']?_['map'](_0x15e289['include'],function(_0x75bfb1){return{'model':db[_0x75bfb1[_0x3d5a('0x21')]],'as':_0x75bfb1['as'],'attributes':_0x75bfb1[_0x3d5a('0x22')],'include':_0x75bfb1[_0x3d5a('0x20')]?_[_0x3d5a('0x23')](_0x75bfb1[_0x3d5a('0x20')],function(_0x351838){return{'model':db[_0x351838[_0x3d5a('0x21')]],'as':_0x351838['as'],'attributes':_0x351838[_0x3d5a('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x467d07){logger[_0x3d5a('0x17')]('GetWhatsappQueue',_0x16f8a7);logger['debug'](_0x3d5a('0x19'),_0x16f8a7,JSON[_0x3d5a('0x24')](_0x467d07));_0x340424(_0x467d07);})[_0x3d5a('0x18')](function(_0x35b660){logger[_0x3d5a('0x14')](_0x3d5a('0x19'),_0x35b660[_0x3d5a('0x16')],_0x16f8a7);_0x9d4201(_0x4a3ebe[_0x3d5a('0x14')](0x1f4,_0x35b660[_0x3d5a('0x16')]));});});};exports[_0x3d5a('0x25')]=function(_0x57d607){var _0x1f996b=this;return new Promise(function(_0x356f13,_0x2fe749){return db['WhatsappQueue']['find']({'raw':_0x57d607[_0x3d5a('0x1c')]?_0x57d607[_0x3d5a('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x57d607['options']?_0x57d607['options']['where']||null:null,'attributes':_0x57d607[_0x3d5a('0x1c')]?_0x57d607[_0x3d5a('0x1c')][_0x3d5a('0x22')]||null:null,'include':_0x57d607['options']?_0x57d607['options'][_0x3d5a('0x20')]?_[_0x3d5a('0x23')](_0x57d607['options'][_0x3d5a('0x20')],function(_0x5e1caf){return{'model':db[_0x5e1caf[_0x3d5a('0x21')]],'as':_0x5e1caf['as'],'attributes':_0x5e1caf[_0x3d5a('0x22')],'include':_0x5e1caf[_0x3d5a('0x20')]?_['map'](_0x5e1caf[_0x3d5a('0x20')],function(_0x98f59f){return{'model':db[_0x98f59f[_0x3d5a('0x21')]],'as':_0x98f59f['as'],'attributes':_0x98f59f[_0x3d5a('0x22')],'include':_0x98f59f['include']?_[_0x3d5a('0x23')](_0x98f59f['include'],function(_0x599a6d){return{'model':db[_0x599a6d[_0x3d5a('0x21')]],'as':_0x599a6d['as'],'attributes':_0x599a6d[_0x3d5a('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x101c8c){logger[_0x3d5a('0x17')](_0x3d5a('0x25'),_0x57d607);logger[_0x3d5a('0x12')]('ShowWhatsappQueue',_0x57d607,JSON[_0x3d5a('0x24')](_0x101c8c));_0x356f13(_0x101c8c);})[_0x3d5a('0x18')](function(_0x53a4b1){logger['error'](_0x3d5a('0x25'),_0x53a4b1['message'],_0x57d607);_0x2fe749(_0x1f996b[_0x3d5a('0x14')](0x1f4,_0x53a4b1[_0x3d5a('0x16')]));});});}; \ No newline at end of file +var _0xd6f7=['model','GetWhatsappQueue','debug','ShowWhatsappQueue','find','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','WhatsappQueue','findAll','options','raw','where','attributes','include','map'];(function(_0x148da5,_0x5dbfdd){var _0x1cc87b=function(_0x408b65){while(--_0x408b65){_0x148da5['push'](_0x148da5['shift']());}};_0x1cc87b(++_0x5dbfdd);}(_0xd6f7,0x176));var _0x7d6f=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0xd6f7[_0x45783c];return _0x1161da;};'use strict';var _=require('lodash');var util=require(_0x7d6f('0x0'));var moment=require(_0x7d6f('0x1'));var BPromise=require(_0x7d6f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7d6f('0x3'));var db=require(_0x7d6f('0x4'))['db'];var utils=require(_0x7d6f('0x5'));var logger=require(_0x7d6f('0x6'))(_0x7d6f('0x7'));var config=require(_0x7d6f('0x8'));var jayson=require(_0x7d6f('0x9'));var client=jayson[_0x7d6f('0xa')][_0x7d6f('0xb')]({'port':0x232a});config['redis']=_[_0x7d6f('0xc')](config[_0x7d6f('0xd')],{'host':_0x7d6f('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7d6f('0xd')]));require('./whatsappQueue.socket')[_0x7d6f('0xf')](socket);function respondWithRpcPromise(_0x28f278,_0x3350d0,_0x1977bf){return new BPromise(function(_0x1b49ae,_0x389a18){return client[_0x7d6f('0x10')](_0x28f278,_0x1977bf)[_0x7d6f('0x11')](function(_0x36a342){logger[_0x7d6f('0x12')](_0x7d6f('0x13'),_0x3350d0,_0x7d6f('0x14'));logger['debug'](_0x7d6f('0x15'),_0x3350d0,'request\x20sent',JSON[_0x7d6f('0x16')](_0x36a342));if(_0x36a342[_0x7d6f('0x17')]){if(_0x36a342[_0x7d6f('0x17')][_0x7d6f('0x18')]===0x1f4){logger['error'](_0x7d6f('0x13'),_0x3350d0,_0x36a342[_0x7d6f('0x17')][_0x7d6f('0x19')]);return _0x389a18(_0x36a342['error'][_0x7d6f('0x19')]);}logger['error'](_0x7d6f('0x13'),_0x3350d0,_0x36a342[_0x7d6f('0x17')]['message']);return _0x1b49ae(_0x36a342[_0x7d6f('0x17')][_0x7d6f('0x19')]);}else{logger['info'](_0x7d6f('0x13'),_0x3350d0,_0x7d6f('0x14'));_0x1b49ae(_0x36a342[_0x7d6f('0x1a')][_0x7d6f('0x19')]);}})[_0x7d6f('0x1b')](function(_0x33135b){logger[_0x7d6f('0x17')]('WhatsappQueue,\x20%s,\x20%s',_0x3350d0,_0x33135b);_0x389a18(_0x33135b);});});}exports['GetWhatsappQueue']=function(_0x5873af){var _0x1ab250=this;return new Promise(function(_0x29c6ed,_0x50a7d1){return db[_0x7d6f('0x1c')][_0x7d6f('0x1d')]({'raw':_0x5873af[_0x7d6f('0x1e')]?_0x5873af['options'][_0x7d6f('0x1f')]===undefined?!![]:![]:!![],'where':_0x5873af[_0x7d6f('0x1e')]?_0x5873af[_0x7d6f('0x1e')][_0x7d6f('0x20')]||null:null,'attributes':_0x5873af[_0x7d6f('0x1e')]?_0x5873af[_0x7d6f('0x1e')][_0x7d6f('0x21')]||null:null,'limit':_0x5873af[_0x7d6f('0x1e')]?_0x5873af[_0x7d6f('0x1e')]['limit']||null:null,'include':_0x5873af[_0x7d6f('0x1e')]?_0x5873af[_0x7d6f('0x1e')][_0x7d6f('0x22')]?_[_0x7d6f('0x23')](_0x5873af[_0x7d6f('0x1e')][_0x7d6f('0x22')],function(_0x2b6113){return{'model':db[_0x2b6113[_0x7d6f('0x24')]],'as':_0x2b6113['as'],'attributes':_0x2b6113[_0x7d6f('0x21')],'include':_0x2b6113[_0x7d6f('0x22')]?_[_0x7d6f('0x23')](_0x2b6113[_0x7d6f('0x22')],function(_0x4f8ee1){return{'model':db[_0x4f8ee1[_0x7d6f('0x24')]],'as':_0x4f8ee1['as'],'attributes':_0x4f8ee1[_0x7d6f('0x21')],'include':_0x4f8ee1['include']?_['map'](_0x4f8ee1[_0x7d6f('0x22')],function(_0x596994){return{'model':db[_0x596994[_0x7d6f('0x24')]],'as':_0x596994['as'],'attributes':_0x596994[_0x7d6f('0x21')]};}):[]};}):[]};}):[]:[]})[_0x7d6f('0x11')](function(_0x300136){logger[_0x7d6f('0x12')](_0x7d6f('0x25'),_0x5873af);logger[_0x7d6f('0x26')]('GetWhatsappQueue',_0x5873af,JSON['stringify'](_0x300136));_0x29c6ed(_0x300136);})[_0x7d6f('0x1b')](function(_0xf7f1c1){logger['error']('GetWhatsappQueue',_0xf7f1c1[_0x7d6f('0x19')],_0x5873af);_0x50a7d1(_0x1ab250[_0x7d6f('0x17')](0x1f4,_0xf7f1c1[_0x7d6f('0x19')]));});});};exports[_0x7d6f('0x27')]=function(_0x4b020a){var _0x2f82b6=this;return new Promise(function(_0x7ae770,_0x451740){return db['WhatsappQueue'][_0x7d6f('0x28')]({'raw':_0x4b020a[_0x7d6f('0x1e')]?_0x4b020a[_0x7d6f('0x1e')][_0x7d6f('0x1f')]===undefined?!![]:![]:!![],'where':_0x4b020a[_0x7d6f('0x1e')]?_0x4b020a[_0x7d6f('0x1e')][_0x7d6f('0x20')]||null:null,'attributes':_0x4b020a['options']?_0x4b020a[_0x7d6f('0x1e')][_0x7d6f('0x21')]||null:null,'include':_0x4b020a[_0x7d6f('0x1e')]?_0x4b020a[_0x7d6f('0x1e')][_0x7d6f('0x22')]?_[_0x7d6f('0x23')](_0x4b020a[_0x7d6f('0x1e')]['include'],function(_0x471408){return{'model':db[_0x471408['model']],'as':_0x471408['as'],'attributes':_0x471408['attributes'],'include':_0x471408[_0x7d6f('0x22')]?_[_0x7d6f('0x23')](_0x471408[_0x7d6f('0x22')],function(_0x5cd63b){return{'model':db[_0x5cd63b[_0x7d6f('0x24')]],'as':_0x5cd63b['as'],'attributes':_0x5cd63b['attributes'],'include':_0x5cd63b[_0x7d6f('0x22')]?_[_0x7d6f('0x23')](_0x5cd63b['include'],function(_0x4e5eb4){return{'model':db[_0x4e5eb4[_0x7d6f('0x24')]],'as':_0x4e5eb4['as'],'attributes':_0x4e5eb4[_0x7d6f('0x21')]};}):[]};}):[]};}):[]:[]})[_0x7d6f('0x11')](function(_0x49faf6){logger[_0x7d6f('0x12')]('ShowWhatsappQueue',_0x4b020a);logger[_0x7d6f('0x26')](_0x7d6f('0x27'),_0x4b020a,JSON['stringify'](_0x49faf6));_0x7ae770(_0x49faf6);})[_0x7d6f('0x1b')](function(_0x10b2ca){logger[_0x7d6f('0x17')](_0x7d6f('0x27'),_0x10b2ca[_0x7d6f('0x19')],_0x4b020a);_0x451740(_0x2f82b6[_0x7d6f('0x17')](0x1f4,_0x10b2ca[_0x7d6f('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index b172f37..8d65722 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 _0x4ec0=['whatsappQueue:','save','remove','update','emit','removeListener','register','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4ec0,0x149));var _0x04ec=function(_0xcce99c,_0x3d170c){_0xcce99c=_0xcce99c-0x0;var _0x7ca11d=_0x4ec0[_0xcce99c];return _0x7ca11d;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=[_0x04ec('0x0'),_0x04ec('0x1'),_0x04ec('0x2')];function createListener(_0x355eaf,_0x19844b){return function(_0x39b1cb){_0x19844b[_0x04ec('0x3')](_0x355eaf,_0x39b1cb);};}function removeListener(_0x25e914,_0x24fd44){return function(){WhatsappQueueEvents[_0x04ec('0x4')](_0x25e914,_0x24fd44);};}exports[_0x04ec('0x5')]=function(_0x2bc01f){for(var _0xdafad3=0x0,_0x167865=events[_0x04ec('0x6')];_0xdafad3<_0x167865;_0xdafad3++){var _0x33e0dd=events[_0xdafad3];var _0x28276a=createListener(_0x04ec('0x7')+_0x33e0dd,_0x2bc01f);WhatsappQueueEvents['on'](_0x33e0dd,_0x28276a);}}; \ No newline at end of file +var _0xf393=['update','emit','removeListener','register','length','./whatsappQueue.events','save'];(function(_0x22663b,_0xc8c6e3){var _0x310d0a=function(_0x151e66){while(--_0x151e66){_0x22663b['push'](_0x22663b['shift']());}};_0x310d0a(++_0xc8c6e3);}(_0xf393,0xc2));var _0x3f39=function(_0x1db2a0,_0x2f1727){_0x1db2a0=_0x1db2a0-0x0;var _0x15813d=_0xf393[_0x1db2a0];return _0x15813d;};'use strict';var WhatsappQueueEvents=require(_0x3f39('0x0'));var events=[_0x3f39('0x1'),'remove',_0x3f39('0x2')];function createListener(_0x2df7a1,_0x311bb9){return function(_0x5eb568){_0x311bb9[_0x3f39('0x3')](_0x2df7a1,_0x5eb568);};}function removeListener(_0xeec6c0,_0x384a42){return function(){WhatsappQueueEvents[_0x3f39('0x4')](_0xeec6c0,_0x384a42);};}exports[_0x3f39('0x5')]=function(_0x4e42c5){for(var _0x47b57a=0x0,_0x507be8=events[_0x3f39('0x6')];_0x47b57a<_0x507be8;_0x47b57a++){var _0x5c9119=events[_0x47b57a];var _0x434f0f=createListener('whatsappQueue:'+_0x5c9119,_0x4e42c5);WhatsappQueueEvents['on'](_0x5c9119,_0x434f0f);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 28c0a03..58a24e4 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 _0x6678=['../../components/interaction/service','./whatsappQueueReport.controller','get','isAuthenticated','index','/describe','describe','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x5d4dbc,_0x3e2b00){var _0x15dfc9=function(_0x2a2aaa){while(--_0x2a2aaa){_0x5d4dbc['push'](_0x5d4dbc['shift']());}};_0x15dfc9(++_0x3e2b00);}(_0x6678,0xb8));var _0x8667=function(_0x3b6652,_0x32486d){_0x3b6652=_0x3b6652-0x0;var _0x14d39f=_0x6678[_0x3b6652];return _0x14d39f;};'use strict';var multer=require(_0x8667('0x0'));var util=require(_0x8667('0x1'));var path=require(_0x8667('0x2'));var timeout=require(_0x8667('0x3'));var express=require(_0x8667('0x4'));var router=express['Router']();var fs_extra=require(_0x8667('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8667('0x6'));var config=require('../../config/environment');var controller=require(_0x8667('0x7'));router[_0x8667('0x8')]('/',auth[_0x8667('0x9')](),controller[_0x8667('0xa')]);router[_0x8667('0x8')](_0x8667('0xb'),auth[_0x8667('0x9')](),controller[_0x8667('0xc')]);router[_0x8667('0x8')]('/:id',auth[_0x8667('0x9')](),controller['show']);router[_0x8667('0xd')]('/',auth[_0x8667('0x9')](),controller[_0x8667('0xe')]);router[_0x8667('0xf')]('/:id',auth[_0x8667('0x9')](),controller[_0x8667('0x10')]);router[_0x8667('0x11')]('/:id',auth[_0x8667('0x9')](),controller[_0x8667('0x12')]);module['exports']=router; \ No newline at end of file +var _0xb6b8=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','isAuthenticated','/describe','describe','get','/:id','show','post','update','exports','util'];(function(_0x336376,_0xe4b28d){var _0x1d2a8e=function(_0x3afe68){while(--_0x3afe68){_0x336376['push'](_0x336376['shift']());}};_0x1d2a8e(++_0xe4b28d);}(_0xb6b8,0xc5));var _0x8b6b=function(_0x5dbbe3,_0x23eb49){_0x5dbbe3=_0x5dbbe3-0x0;var _0x508627=_0xb6b8[_0x5dbbe3];return _0x508627;};'use strict';var multer=require('multer');var util=require(_0x8b6b('0x0'));var path=require(_0x8b6b('0x1'));var timeout=require(_0x8b6b('0x2'));var express=require(_0x8b6b('0x3'));var router=express[_0x8b6b('0x4')]();var fs_extra=require(_0x8b6b('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8b6b('0x6'));var config=require(_0x8b6b('0x7'));var controller=require(_0x8b6b('0x8'));router['get']('/',auth[_0x8b6b('0x9')](),controller['index']);router['get'](_0x8b6b('0xa'),auth[_0x8b6b('0x9')](),controller[_0x8b6b('0xb')]);router[_0x8b6b('0xc')](_0x8b6b('0xd'),auth[_0x8b6b('0x9')](),controller[_0x8b6b('0xe')]);router[_0x8b6b('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x8b6b('0xd'),auth[_0x8b6b('0x9')](),controller[_0x8b6b('0x10')]);router['delete'](_0x8b6b('0xd'),auth[_0x8b6b('0x9')](),controller['destroy']);module[_0x8b6b('0x11')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 2e8526c..ce81cab 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x356989,_0x3b37b6){var _0x2a4ca4=function(_0x397f00){while(--_0x397f00){_0x356989['push'](_0x356989['shift']());}};_0x2a4ca4(++_0x3b37b6);}(_0x7a54,0x106));var _0x47a5=function(_0x56f83e,_0x5d532c){_0x56f83e=_0x56f83e-0x0;var _0x374e2a=_0x7a54[_0x56f83e];return _0x374e2a;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file +var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x423e70,_0x170513){var _0x516e3a=function(_0xf8a328){while(--_0xf8a328){_0x423e70['push'](_0x423e70['shift']());}};_0x516e3a(++_0x170513);}(_0x7a54,0x106));var _0x47a5=function(_0x2d70a1,_0x17d533){_0x2d70a1=_0x2d70a1-0x0;var _0x4c8925=_0x7a54[_0x2d70a1];return _0x4c8925;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index d3ef751..358ec28 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 _0xb574=['set','Content-Range','reject','save','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','WhatsappQueueReport','findAll','rows','catch','params','create','body','find','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','fs-extra','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset'];(function(_0x17e658,_0x64e00){var _0x1250e5=function(_0x193801){while(--_0x193801){_0x17e658['push'](_0x17e658['shift']());}};_0x1250e5(++_0x64e00);}(_0xb574,0x106));var _0x4b57=function(_0x9f8a1b,_0xc854c0){_0x9f8a1b=_0x9f8a1b-0x0;var _0x3b22a4=_0xb574[_0x9f8a1b];return _0x3b22a4;};'use strict';var emlformat=require(_0x4b57('0x0'));var rimraf=require(_0x4b57('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4b57('0x2'));var rp=require(_0x4b57('0x3'));var moment=require('moment');var BPromise=require(_0x4b57('0x4'));var Mustache=require(_0x4b57('0x5'));var util=require(_0x4b57('0x6'));var path=require(_0x4b57('0x7'));var sox=require(_0x4b57('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4b57('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4b57('0xa'));var toCsv=require(_0x4b57('0xb'));var querystring=require(_0x4b57('0xc'));var Papa=require(_0x4b57('0xd'));var Redis=require(_0x4b57('0xe'));var authService=require(_0x4b57('0xf'));var qs=require(_0x4b57('0x10'));var as=require(_0x4b57('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4b57('0x12'))(_0x4b57('0x13'));var utils=require(_0x4b57('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4b57('0x15'))['db'];function respondWithStatusCode(_0x357c8b,_0x43d066){_0x43d066=_0x43d066||0xcc;return function(_0xf8a6fc){if(_0xf8a6fc){return _0x357c8b[_0x4b57('0x16')](_0x43d066);}return _0x357c8b[_0x4b57('0x17')](_0x43d066)[_0x4b57('0x18')]();};}function respondWithResult(_0xd5ee6d,_0x31cced){_0x31cced=_0x31cced||0xc8;return function(_0x4e15be){if(_0x4e15be){return _0xd5ee6d['status'](_0x31cced)[_0x4b57('0x19')](_0x4e15be);}};}function respondWithFilteredResult(_0x24f776,_0x10b9ff){return function(_0x58d6bd){if(_0x58d6bd){var _0x284640=typeof _0x10b9ff['offset']===_0x4b57('0x1a')&&typeof _0x10b9ff[_0x4b57('0x1b')]===_0x4b57('0x1a');var _0x10eda5=_0x58d6bd[_0x4b57('0x1c')];var _0xfb71cc=_0x284640?0x0:_0x10b9ff['offset'];var _0x1b35ff=_0x284640?_0x58d6bd[_0x4b57('0x1c')]:_0x10b9ff[_0x4b57('0x1d')]+_0x10b9ff[_0x4b57('0x1b')];var _0x4baaeb;if(_0x1b35ff>=_0x10eda5){_0x1b35ff=_0x10eda5;_0x4baaeb=0xc8;}else{_0x4baaeb=0xce;}_0x24f776[_0x4b57('0x17')](_0x4baaeb);return _0x24f776[_0x4b57('0x1e')](_0x4b57('0x1f'),_0xfb71cc+'-'+_0x1b35ff+'/'+_0x10eda5)[_0x4b57('0x19')](_0x58d6bd);}return null;};}function patchUpdates(_0xef1eae){return function(_0x4454c8){try{jsonpatch['apply'](_0x4454c8,_0xef1eae,!![]);}catch(_0x4b504b){return BPromise[_0x4b57('0x20')](_0x4b504b);}return _0x4454c8[_0x4b57('0x21')]();};}function saveUpdates(_0x567d8f,_0x380554){return function(_0x4a34b2){if(_0x4a34b2){return _0x4a34b2[_0x4b57('0x22')](_0x567d8f)[_0x4b57('0x23')](function(_0x56f017){return _0x56f017;});}return null;};}function removeEntity(_0x271361,_0x368c5f){return function(_0x4d07c9){if(_0x4d07c9){return _0x4d07c9[_0x4b57('0x24')]()[_0x4b57('0x23')](function(){_0x271361[_0x4b57('0x17')](0xcc)[_0x4b57('0x18')]();});}};}function handleEntityNotFound(_0x540eff,_0x156962){return function(_0x51d0c3){if(!_0x51d0c3){_0x540eff[_0x4b57('0x16')](0x194);}return _0x51d0c3;};}function handleError(_0x517119,_0x36ceb1){_0x36ceb1=_0x36ceb1||0x1f4;return function(_0x2dc9d8){logger[_0x4b57('0x25')](_0x2dc9d8[_0x4b57('0x26')]);if(_0x2dc9d8[_0x4b57('0x27')]){delete _0x2dc9d8[_0x4b57('0x27')];}_0x517119['status'](_0x36ceb1)['send'](_0x2dc9d8);};}exports[_0x4b57('0x28')]=function(_0x4c58e4,_0x1ea0cb){var _0x458f70={},_0x874cf7={},_0x3af22f={'count':0x0,'rows':[]};var _0x249461=_[_0x4b57('0x29')](db['WhatsappQueueReport'][_0x4b57('0x2a')],function(_0x2e9922){return{'name':_0x2e9922[_0x4b57('0x2b')],'type':_0x2e9922[_0x4b57('0x2c')]['key']};});_0x874cf7[_0x4b57('0x2d')]=_[_0x4b57('0x29')](_0x249461,'name');_0x874cf7[_0x4b57('0x2e')]=_[_0x4b57('0x2f')](_0x4c58e4[_0x4b57('0x2e')]);_0x874cf7[_0x4b57('0x30')]=_['intersection'](_0x874cf7['model'],_0x874cf7['query']);_0x458f70[_0x4b57('0x31')]=_[_0x4b57('0x32')](_0x874cf7[_0x4b57('0x2d')],qs[_0x4b57('0x33')](_0x4c58e4[_0x4b57('0x2e')]['fields']));_0x458f70[_0x4b57('0x31')]=_0x458f70[_0x4b57('0x31')][_0x4b57('0x34')]?_0x458f70['attributes']:_0x874cf7[_0x4b57('0x2d')];if(!_0x4c58e4[_0x4b57('0x2e')][_0x4b57('0x35')]('nolimit')){_0x458f70[_0x4b57('0x1b')]=qs[_0x4b57('0x1b')](_0x4c58e4['query'][_0x4b57('0x1b')]);_0x458f70[_0x4b57('0x1d')]=qs[_0x4b57('0x1d')](_0x4c58e4[_0x4b57('0x2e')][_0x4b57('0x1d')]);}_0x458f70[_0x4b57('0x36')]=qs['sort'](_0x4c58e4[_0x4b57('0x2e')][_0x4b57('0x37')]);_0x458f70[_0x4b57('0x38')]=qs[_0x4b57('0x30')](_[_0x4b57('0x39')](_0x4c58e4[_0x4b57('0x2e')],_0x874cf7[_0x4b57('0x30')]),_0x249461);if(_0x4c58e4['query']['filter']){_0x458f70[_0x4b57('0x38')]=_[_0x4b57('0x3a')](_0x458f70[_0x4b57('0x38')],{'$or':_['map'](_0x249461,function(_0x40414f){if(_0x40414f[_0x4b57('0x2c')]!==_0x4b57('0x3b')){var _0x3c086e={};_0x3c086e[_0x40414f['name']]={'$like':'%'+_0x4c58e4[_0x4b57('0x2e')][_0x4b57('0x3c')]+'%'};return _0x3c086e;}})});}_0x458f70=_[_0x4b57('0x3a')]({},_0x458f70,_0x4c58e4[_0x4b57('0x3d')]);var _0x56528f={'where':_0x458f70['where']};return db['WhatsappQueueReport'][_0x4b57('0x1c')](_0x56528f)[_0x4b57('0x23')](function(_0x188f24){_0x3af22f[_0x4b57('0x1c')]=_0x188f24;if(_0x4c58e4['query'][_0x4b57('0x3e')]){_0x458f70[_0x4b57('0x3f')]=[{'all':!![]}];}return db[_0x4b57('0x40')][_0x4b57('0x41')](_0x458f70);})[_0x4b57('0x23')](function(_0x453129){_0x3af22f[_0x4b57('0x42')]=_0x453129;return _0x3af22f;})[_0x4b57('0x23')](respondWithFilteredResult(_0x1ea0cb,_0x458f70))[_0x4b57('0x43')](handleError(_0x1ea0cb,null));};exports['show']=function(_0x318187,_0x3685fd){var _0x3c5095={'raw':!![],'where':{'id':_0x318187[_0x4b57('0x44')]['id']}},_0x5b2f50={};_0x5b2f50['model']=_[_0x4b57('0x2f')](db[_0x4b57('0x40')][_0x4b57('0x2a')]);_0x5b2f50[_0x4b57('0x2e')]=_[_0x4b57('0x2f')](_0x318187[_0x4b57('0x2e')]);_0x5b2f50[_0x4b57('0x30')]=_[_0x4b57('0x32')](_0x5b2f50[_0x4b57('0x2d')],_0x5b2f50[_0x4b57('0x2e')]);_0x3c5095[_0x4b57('0x31')]=_[_0x4b57('0x32')](_0x5b2f50[_0x4b57('0x2d')],qs['fields'](_0x318187['query'][_0x4b57('0x33')]));_0x3c5095[_0x4b57('0x31')]=_0x3c5095[_0x4b57('0x31')][_0x4b57('0x34')]?_0x3c5095['attributes']:_0x5b2f50[_0x4b57('0x2d')];if(_0x318187[_0x4b57('0x2e')]['includeAll']){_0x3c5095[_0x4b57('0x3f')]=[{'all':!![]}];}_0x3c5095=_['merge']({},_0x3c5095,_0x318187[_0x4b57('0x3d')]);return db['WhatsappQueueReport']['find'](_0x3c5095)[_0x4b57('0x23')](handleEntityNotFound(_0x3685fd,null))[_0x4b57('0x23')](respondWithResult(_0x3685fd,null))['catch'](handleError(_0x3685fd,null));};exports[_0x4b57('0x45')]=function(_0xc19684,_0x2732ff){return db[_0x4b57('0x40')][_0x4b57('0x45')](_0xc19684[_0x4b57('0x46')],{})['then'](respondWithResult(_0x2732ff,0xc9))[_0x4b57('0x43')](handleError(_0x2732ff,null));};exports[_0x4b57('0x22')]=function(_0x4a632c,_0xd529fb){if(_0x4a632c[_0x4b57('0x46')]['id']){delete _0x4a632c[_0x4b57('0x46')]['id'];}return db['WhatsappQueueReport'][_0x4b57('0x47')]({'where':{'id':_0x4a632c['params']['id']}})[_0x4b57('0x23')](handleEntityNotFound(_0xd529fb,null))[_0x4b57('0x23')](saveUpdates(_0x4a632c[_0x4b57('0x46')],null))[_0x4b57('0x23')](respondWithResult(_0xd529fb,null))[_0x4b57('0x43')](handleError(_0xd529fb,null));};exports[_0x4b57('0x24')]=function(_0x3d1ecd,_0x3ec6ba){return db['WhatsappQueueReport'][_0x4b57('0x47')]({'where':{'id':_0x3d1ecd[_0x4b57('0x44')]['id']}})[_0x4b57('0x23')](handleEntityNotFound(_0x3ec6ba,null))['then'](removeEntity(_0x3ec6ba,null))[_0x4b57('0x43')](handleError(_0x3ec6ba,null));};exports[_0x4b57('0x48')]=function(_0x32985f,_0x488bea){return db[_0x4b57('0x40')][_0x4b57('0x48')]()[_0x4b57('0x23')](respondWithResult(_0x488bea,null))[_0x4b57('0x43')](handleError(_0x488bea,null));}; \ No newline at end of file +var _0x63a5=['filter','merge','includeAll','include','findAll','rows','catch','params','rawAttributes','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','ejs','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','WhatsappQueueReport','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x2d11fc,_0x464809){var _0x54ec56=function(_0x3f7d86){while(--_0x3f7d86){_0x2d11fc['push'](_0x2d11fc['shift']());}};_0x54ec56(++_0x464809);}(_0x63a5,0x18e));var _0x563a=function(_0x44bcb0,_0x235aa9){_0x44bcb0=_0x44bcb0-0x0;var _0xfaf881=_0x63a5[_0x44bcb0];return _0xfaf881;};'use strict';var emlformat=require(_0x563a('0x0'));var rimraf=require(_0x563a('0x1'));var zipdir=require(_0x563a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x563a('0x3'));var moment=require('moment');var BPromise=require(_0x563a('0x4'));var Mustache=require(_0x563a('0x5'));var util=require(_0x563a('0x6'));var path=require(_0x563a('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x563a('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x563a('0x9'));var squel=require(_0x563a('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x563a('0xb'));var toCsv=require(_0x563a('0xc'));var querystring=require(_0x563a('0xd'));var Papa=require(_0x563a('0xe'));var Redis=require(_0x563a('0xf'));var authService=require(_0x563a('0x10'));var qs=require(_0x563a('0x11'));var as=require(_0x563a('0x12'));var hardwareService=require(_0x563a('0x13'));var logger=require(_0x563a('0x14'))(_0x563a('0x15'));var utils=require(_0x563a('0x16'));var config=require(_0x563a('0x17'));var licenseUtil=require(_0x563a('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x61d5b2,_0x214f42){_0x214f42=_0x214f42||0xcc;return function(_0x10de2e){if(_0x10de2e){return _0x61d5b2[_0x563a('0x19')](_0x214f42);}return _0x61d5b2[_0x563a('0x1a')](_0x214f42)[_0x563a('0x1b')]();};}function respondWithResult(_0x50396b,_0x2cf052){_0x2cf052=_0x2cf052||0xc8;return function(_0x3045ac){if(_0x3045ac){return _0x50396b[_0x563a('0x1a')](_0x2cf052)[_0x563a('0x1c')](_0x3045ac);}};}function respondWithFilteredResult(_0x5a2980,_0x504cb7){return function(_0x414535){if(_0x414535){var _0x2ad667=typeof _0x504cb7['offset']===_0x563a('0x1d')&&typeof _0x504cb7[_0x563a('0x1e')]===_0x563a('0x1d');var _0x9c2f77=_0x414535['count'];var _0x598693=_0x2ad667?0x0:_0x504cb7[_0x563a('0x1f')];var _0x422aaf=_0x2ad667?_0x414535[_0x563a('0x20')]:_0x504cb7['offset']+_0x504cb7['limit'];var _0x52b99a;if(_0x422aaf>=_0x9c2f77){_0x422aaf=_0x9c2f77;_0x52b99a=0xc8;}else{_0x52b99a=0xce;}_0x5a2980['status'](_0x52b99a);return _0x5a2980[_0x563a('0x21')](_0x563a('0x22'),_0x598693+'-'+_0x422aaf+'/'+_0x9c2f77)[_0x563a('0x1c')](_0x414535);}return null;};}function patchUpdates(_0x43b7a8){return function(_0x562fce){try{jsonpatch['apply'](_0x562fce,_0x43b7a8,!![]);}catch(_0x3930f0){return BPromise[_0x563a('0x23')](_0x3930f0);}return _0x562fce[_0x563a('0x24')]();};}function saveUpdates(_0x2beccb,_0x1bf502){return function(_0x2dc7e2){if(_0x2dc7e2){return _0x2dc7e2[_0x563a('0x25')](_0x2beccb)[_0x563a('0x26')](function(_0x506491){return _0x506491;});}return null;};}function removeEntity(_0xd59ba8,_0x5422f6){return function(_0x44e2c1){if(_0x44e2c1){return _0x44e2c1[_0x563a('0x27')]()[_0x563a('0x26')](function(){_0xd59ba8[_0x563a('0x1a')](0xcc)[_0x563a('0x1b')]();});}};}function handleEntityNotFound(_0x1682ee,_0x3642b3){return function(_0x173990){if(!_0x173990){_0x1682ee['sendStatus'](0x194);}return _0x173990;};}function handleError(_0x146ea0,_0x2b688e){_0x2b688e=_0x2b688e||0x1f4;return function(_0x2311f2){logger[_0x563a('0x28')](_0x2311f2[_0x563a('0x29')]);if(_0x2311f2[_0x563a('0x2a')]){delete _0x2311f2[_0x563a('0x2a')];}_0x146ea0[_0x563a('0x1a')](_0x2b688e)[_0x563a('0x2b')](_0x2311f2);};}exports[_0x563a('0x2c')]=function(_0x1a69d5,_0x24d1a8){var _0x1bdfb0={},_0x7696c2={},_0x579cb5={'count':0x0,'rows':[]};var _0x43379c=_[_0x563a('0x2d')](db[_0x563a('0x2e')]['rawAttributes'],function(_0x1e8d43){return{'name':_0x1e8d43[_0x563a('0x2f')],'type':_0x1e8d43[_0x563a('0x30')][_0x563a('0x31')]};});_0x7696c2[_0x563a('0x32')]=_[_0x563a('0x2d')](_0x43379c,_0x563a('0x2a'));_0x7696c2['query']=_[_0x563a('0x33')](_0x1a69d5[_0x563a('0x34')]);_0x7696c2[_0x563a('0x35')]=_[_0x563a('0x36')](_0x7696c2[_0x563a('0x32')],_0x7696c2['query']);_0x1bdfb0['attributes']=_['intersection'](_0x7696c2['model'],qs[_0x563a('0x37')](_0x1a69d5[_0x563a('0x34')][_0x563a('0x37')]));_0x1bdfb0[_0x563a('0x38')]=_0x1bdfb0[_0x563a('0x38')][_0x563a('0x39')]?_0x1bdfb0['attributes']:_0x7696c2['model'];if(!_0x1a69d5[_0x563a('0x34')][_0x563a('0x3a')](_0x563a('0x3b'))){_0x1bdfb0[_0x563a('0x1e')]=qs[_0x563a('0x1e')](_0x1a69d5[_0x563a('0x34')][_0x563a('0x1e')]);_0x1bdfb0[_0x563a('0x1f')]=qs[_0x563a('0x1f')](_0x1a69d5[_0x563a('0x34')][_0x563a('0x1f')]);}_0x1bdfb0[_0x563a('0x3c')]=qs[_0x563a('0x3d')](_0x1a69d5[_0x563a('0x34')][_0x563a('0x3d')]);_0x1bdfb0[_0x563a('0x3e')]=qs['filters'](_[_0x563a('0x3f')](_0x1a69d5[_0x563a('0x34')],_0x7696c2[_0x563a('0x35')]),_0x43379c);if(_0x1a69d5['query'][_0x563a('0x40')]){_0x1bdfb0['where']=_[_0x563a('0x41')](_0x1bdfb0[_0x563a('0x3e')],{'$or':_['map'](_0x43379c,function(_0x52e4a2){if(_0x52e4a2[_0x563a('0x30')]!=='VIRTUAL'){var _0x13b795={};_0x13b795[_0x52e4a2[_0x563a('0x2a')]]={'$like':'%'+_0x1a69d5[_0x563a('0x34')][_0x563a('0x40')]+'%'};return _0x13b795;}})});}_0x1bdfb0=_['merge']({},_0x1bdfb0,_0x1a69d5['options']);var _0x615d2e={'where':_0x1bdfb0['where']};return db[_0x563a('0x2e')][_0x563a('0x20')](_0x615d2e)[_0x563a('0x26')](function(_0x9c392c){_0x579cb5[_0x563a('0x20')]=_0x9c392c;if(_0x1a69d5[_0x563a('0x34')][_0x563a('0x42')]){_0x1bdfb0[_0x563a('0x43')]=[{'all':!![]}];}return db['WhatsappQueueReport'][_0x563a('0x44')](_0x1bdfb0);})['then'](function(_0x20c142){_0x579cb5[_0x563a('0x45')]=_0x20c142;return _0x579cb5;})[_0x563a('0x26')](respondWithFilteredResult(_0x24d1a8,_0x1bdfb0))[_0x563a('0x46')](handleError(_0x24d1a8,null));};exports['show']=function(_0x4b3d38,_0x54ac1e){var _0x2221d4={'raw':!![],'where':{'id':_0x4b3d38[_0x563a('0x47')]['id']}},_0x1255da={};_0x1255da[_0x563a('0x32')]=_[_0x563a('0x33')](db[_0x563a('0x2e')][_0x563a('0x48')]);_0x1255da[_0x563a('0x34')]=_[_0x563a('0x33')](_0x4b3d38[_0x563a('0x34')]);_0x1255da[_0x563a('0x35')]=_[_0x563a('0x36')](_0x1255da[_0x563a('0x32')],_0x1255da[_0x563a('0x34')]);_0x2221d4[_0x563a('0x38')]=_[_0x563a('0x36')](_0x1255da[_0x563a('0x32')],qs[_0x563a('0x37')](_0x4b3d38[_0x563a('0x34')]['fields']));_0x2221d4['attributes']=_0x2221d4[_0x563a('0x38')][_0x563a('0x39')]?_0x2221d4[_0x563a('0x38')]:_0x1255da[_0x563a('0x32')];if(_0x4b3d38[_0x563a('0x34')][_0x563a('0x42')]){_0x2221d4[_0x563a('0x43')]=[{'all':!![]}];}_0x2221d4=_[_0x563a('0x41')]({},_0x2221d4,_0x4b3d38['options']);return db['WhatsappQueueReport'][_0x563a('0x49')](_0x2221d4)[_0x563a('0x26')](handleEntityNotFound(_0x54ac1e,null))[_0x563a('0x26')](respondWithResult(_0x54ac1e,null))[_0x563a('0x46')](handleError(_0x54ac1e,null));};exports[_0x563a('0x4a')]=function(_0x3f2c5d,_0x2689b5){return db[_0x563a('0x2e')]['create'](_0x3f2c5d[_0x563a('0x4b')],{})[_0x563a('0x26')](respondWithResult(_0x2689b5,0xc9))['catch'](handleError(_0x2689b5,null));};exports[_0x563a('0x25')]=function(_0x5a063a,_0x3ea787){if(_0x5a063a[_0x563a('0x4b')]['id']){delete _0x5a063a[_0x563a('0x4b')]['id'];}return db['WhatsappQueueReport'][_0x563a('0x49')]({'where':{'id':_0x5a063a[_0x563a('0x47')]['id']}})[_0x563a('0x26')](handleEntityNotFound(_0x3ea787,null))[_0x563a('0x26')](saveUpdates(_0x5a063a[_0x563a('0x4b')],null))[_0x563a('0x26')](respondWithResult(_0x3ea787,null))[_0x563a('0x46')](handleError(_0x3ea787,null));};exports[_0x563a('0x27')]=function(_0x277d54,_0x2008d4){return db[_0x563a('0x2e')][_0x563a('0x49')]({'where':{'id':_0x277d54[_0x563a('0x47')]['id']}})['then'](handleEntityNotFound(_0x2008d4,null))['then'](removeEntity(_0x2008d4,null))[_0x563a('0x46')](handleError(_0x2008d4,null));};exports[_0x563a('0x4c')]=function(_0x143daa,_0x4a807f){return db['WhatsappQueueReport'][_0x563a('0x4c')]()[_0x563a('0x26')](respondWithResult(_0x4a807f,null))['catch'](handleError(_0x4a807f,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index b7cb161..706cef7 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 _0x661f=['WhatsappQueueReport','report_whatsapp_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports'];(function(_0x2a0738,_0x3c0bc5){var _0x159679=function(_0x9c9ec7){while(--_0x9c9ec7){_0x2a0738['push'](_0x2a0738['shift']());}};_0x159679(++_0x3c0bc5);}(_0x661f,0x137));var _0xf661=function(_0x1b4b23,_0x5dd6d6){_0x1b4b23=_0x1b4b23-0x0;var _0x2a325b=_0x661f[_0x1b4b23];return _0x2a325b;};'use strict';var _=require('lodash');var util=require(_0xf661('0x0'));var logger=require(_0xf661('0x1'))(_0xf661('0x2'));var moment=require(_0xf661('0x3'));var BPromise=require(_0xf661('0x4'));var rp=require(_0xf661('0x5'));var fs=require('fs');var path=require(_0xf661('0x6'));var rimraf=require(_0xf661('0x7'));var config=require(_0xf661('0x8'));var attributes=require(_0xf661('0x9'));module[_0xf661('0xa')]=function(_0x1276f8,_0x6b636f){return _0x1276f8['define'](_0xf661('0xb'),attributes,{'tableName':_0xf661('0xc'),'paranoid':![],'indexes':[{'name':_0xf661('0xd'),'fields':[_0xf661('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x97fc=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid'];(function(_0xfa25e,_0x1562d5){var _0x1b26b5=function(_0x5a1505){while(--_0x5a1505){_0xfa25e['push'](_0xfa25e['shift']());}};_0x1b26b5(++_0x1562d5);}(_0x97fc,0x130));var _0xc97f=function(_0x4a37d9,_0x501284){_0x4a37d9=_0x4a37d9-0x0;var _0x17af04=_0x97fc[_0x4a37d9];return _0x17af04;};'use strict';var _=require(_0xc97f('0x0'));var util=require(_0xc97f('0x1'));var logger=require(_0xc97f('0x2'))(_0xc97f('0x3'));var moment=require(_0xc97f('0x4'));var BPromise=require(_0xc97f('0x5'));var rp=require(_0xc97f('0x6'));var fs=require('fs');var path=require(_0xc97f('0x7'));var rimraf=require(_0xc97f('0x8'));var config=require(_0xc97f('0x9'));var attributes=require(_0xc97f('0xa'));module[_0xc97f('0xb')]=function(_0x1791d4,_0x2dcd70){return _0x1791d4[_0xc97f('0xc')](_0xc97f('0xd'),attributes,{'tableName':_0xc97f('0xe'),'paranoid':![],'indexes':[{'name':_0xc97f('0xf'),'fields':[_0xc97f('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index e3c5065..159a9bd 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 _0xbebc=['WhatsappQueueReport','update','raw','where','attributes','limit','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','WhatsappQueueReport,\x20%s,\x20%s','result','catch','CreateWhatsappQueueReport','create','body','options','UpdateWhatsappQueueReport'];(function(_0x4f81fb,_0x36d4a1){var _0x4747f=function(_0x19008a){while(--_0x19008a){_0x4f81fb['push'](_0x4f81fb['shift']());}};_0x4747f(++_0x36d4a1);}(_0xbebc,0x126));var _0xcbeb=function(_0x4b86ad,_0x58b3e3){_0x4b86ad=_0x4b86ad-0x0;var _0x38b525=_0xbebc[_0x4b86ad];return _0x38b525;};'use strict';var _=require(_0xcbeb('0x0'));var util=require(_0xcbeb('0x1'));var moment=require(_0xcbeb('0x2'));var BPromise=require(_0xcbeb('0x3'));var rs=require(_0xcbeb('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcbeb('0x5'))['db'];var utils=require(_0xcbeb('0x6'));var logger=require(_0xcbeb('0x7'))(_0xcbeb('0x8'));var config=require('../../config/environment');var jayson=require(_0xcbeb('0x9'));var client=jayson[_0xcbeb('0xa')][_0xcbeb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3d14a6,_0x4bd3ef,_0x58a56a){return new BPromise(function(_0x14c451,_0x374676){return client[_0xcbeb('0xc')](_0x3d14a6,_0x58a56a)[_0xcbeb('0xd')](function(_0x49774c){logger[_0xcbeb('0xe')]('WhatsappQueueReport,\x20%s,\x20%s',_0x4bd3ef,_0xcbeb('0xf'));logger[_0xcbeb('0x10')](_0xcbeb('0x11'),_0x4bd3ef,_0xcbeb('0xf'),JSON[_0xcbeb('0x12')](_0x49774c));if(_0x49774c['error']){if(_0x49774c[_0xcbeb('0x13')][_0xcbeb('0x14')]===0x1f4){logger['error']('WhatsappQueueReport,\x20%s,\x20%s',_0x4bd3ef,_0x49774c['error'][_0xcbeb('0x15')]);return _0x374676(_0x49774c[_0xcbeb('0x13')][_0xcbeb('0x15')]);}logger[_0xcbeb('0x13')](_0xcbeb('0x16'),_0x4bd3ef,_0x49774c[_0xcbeb('0x13')]['message']);return _0x14c451(_0x49774c[_0xcbeb('0x13')][_0xcbeb('0x15')]);}else{logger[_0xcbeb('0xe')](_0xcbeb('0x16'),_0x4bd3ef,_0xcbeb('0xf'));_0x14c451(_0x49774c[_0xcbeb('0x17')][_0xcbeb('0x15')]);}})[_0xcbeb('0x18')](function(_0x132a5b){logger['error'](_0xcbeb('0x16'),_0x4bd3ef,_0x132a5b);_0x374676(_0x132a5b);});});}exports[_0xcbeb('0x19')]=function(_0x1cd1a2){var _0x325bd0=this;return new Promise(function(_0x58bc51,_0x1b9edb){return db['WhatsappQueueReport'][_0xcbeb('0x1a')](_0x1cd1a2[_0xcbeb('0x1b')],{'raw':_0x1cd1a2[_0xcbeb('0x1c')]?_0x1cd1a2['options']['raw']===undefined?!![]:![]:!![]})[_0xcbeb('0xd')](function(_0xbdfc02){logger[_0xcbeb('0xe')](_0xcbeb('0x19'),_0x1cd1a2);logger[_0xcbeb('0x10')](_0xcbeb('0x19'),_0x1cd1a2,JSON[_0xcbeb('0x12')](_0xbdfc02));_0x58bc51(_0xbdfc02);})['catch'](function(_0x3f9134){logger[_0xcbeb('0x13')](_0xcbeb('0x19'),_0x3f9134[_0xcbeb('0x15')],_0x1cd1a2);_0x1b9edb(_0x325bd0[_0xcbeb('0x13')](0x1f4,_0x3f9134[_0xcbeb('0x15')]));});});};exports[_0xcbeb('0x1d')]=function(_0x5624d4){var _0x2c2b49=this;return new Promise(function(_0x325174,_0x4ed608){return db[_0xcbeb('0x1e')][_0xcbeb('0x1f')](_0x5624d4[_0xcbeb('0x1b')],{'raw':_0x5624d4['options']?_0x5624d4[_0xcbeb('0x1c')][_0xcbeb('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5624d4[_0xcbeb('0x1c')]?_0x5624d4[_0xcbeb('0x1c')][_0xcbeb('0x21')]||null:null,'attributes':_0x5624d4[_0xcbeb('0x1c')]?_0x5624d4[_0xcbeb('0x1c')][_0xcbeb('0x22')]||null:null,'limit':_0x5624d4[_0xcbeb('0x1c')]?_0x5624d4[_0xcbeb('0x1c')][_0xcbeb('0x23')]||null:null})['then'](function(_0x1b573b){logger[_0xcbeb('0xe')](_0xcbeb('0x1d'),_0x5624d4);logger[_0xcbeb('0x10')](_0xcbeb('0x1d'),_0x5624d4,JSON['stringify'](_0x1b573b));_0x325174(_0x1b573b);})[_0xcbeb('0x18')](function(_0x50860a){logger['error'](_0xcbeb('0x1d'),_0x50860a[_0xcbeb('0x15')],_0x5624d4);_0x4ed608(_0x2c2b49[_0xcbeb('0x13')](0x1f4,_0x50860a[_0xcbeb('0x15')]));});});}; \ No newline at end of file +var _0x0d64=['body','options','raw','stringify','UpdateWhatsappQueueReport','update','where','attributes','limit','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','error','message','catch','CreateWhatsappQueueReport','WhatsappQueueReport'];(function(_0x348bac,_0x1804b2){var _0x4e2cbf=function(_0x4c4421){while(--_0x4c4421){_0x348bac['push'](_0x348bac['shift']());}};_0x4e2cbf(++_0x1804b2);}(_0x0d64,0xbe));var _0x40d6=function(_0x1d128e,_0x2c87de){_0x1d128e=_0x1d128e-0x0;var _0x3d5236=_0x0d64[_0x1d128e];return _0x3d5236;};'use strict';var _=require(_0x40d6('0x0'));var util=require(_0x40d6('0x1'));var moment=require(_0x40d6('0x2'));var BPromise=require(_0x40d6('0x3'));var rs=require(_0x40d6('0x4'));var fs=require('fs');var Redis=require(_0x40d6('0x5'));var db=require(_0x40d6('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x40d6('0x7'));var config=require(_0x40d6('0x8'));var jayson=require(_0x40d6('0x9'));var client=jayson['client'][_0x40d6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x235418,_0x4d4ca0,_0x25de51){return new BPromise(function(_0x3519ae,_0x1b56c2){return client['request'](_0x235418,_0x25de51)['then'](function(_0x1f6145){logger[_0x40d6('0xb')](_0x40d6('0xc'),_0x4d4ca0,_0x40d6('0xd'));logger[_0x40d6('0xe')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x4d4ca0,_0x40d6('0xd'),JSON['stringify'](_0x1f6145));if(_0x1f6145['error']){if(_0x1f6145[_0x40d6('0xf')]['code']===0x1f4){logger[_0x40d6('0xf')]('WhatsappQueueReport,\x20%s,\x20%s',_0x4d4ca0,_0x1f6145['error'][_0x40d6('0x10')]);return _0x1b56c2(_0x1f6145[_0x40d6('0xf')][_0x40d6('0x10')]);}logger[_0x40d6('0xf')](_0x40d6('0xc'),_0x4d4ca0,_0x1f6145['error'][_0x40d6('0x10')]);return _0x3519ae(_0x1f6145[_0x40d6('0xf')][_0x40d6('0x10')]);}else{logger[_0x40d6('0xb')]('WhatsappQueueReport,\x20%s,\x20%s',_0x4d4ca0,_0x40d6('0xd'));_0x3519ae(_0x1f6145['result'][_0x40d6('0x10')]);}})[_0x40d6('0x11')](function(_0x31cd1f){logger[_0x40d6('0xf')](_0x40d6('0xc'),_0x4d4ca0,_0x31cd1f);_0x1b56c2(_0x31cd1f);});});}exports[_0x40d6('0x12')]=function(_0x5beb96){var _0x1eb25f=this;return new Promise(function(_0x53443f,_0x2ede17){return db[_0x40d6('0x13')]['create'](_0x5beb96[_0x40d6('0x14')],{'raw':_0x5beb96[_0x40d6('0x15')]?_0x5beb96[_0x40d6('0x15')][_0x40d6('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x1de79d){logger['info'](_0x40d6('0x12'),_0x5beb96);logger[_0x40d6('0xe')]('CreateWhatsappQueueReport',_0x5beb96,JSON[_0x40d6('0x17')](_0x1de79d));_0x53443f(_0x1de79d);})[_0x40d6('0x11')](function(_0x47626c){logger[_0x40d6('0xf')](_0x40d6('0x12'),_0x47626c[_0x40d6('0x10')],_0x5beb96);_0x2ede17(_0x1eb25f[_0x40d6('0xf')](0x1f4,_0x47626c['message']));});});};exports[_0x40d6('0x18')]=function(_0xca801d){var _0x35c384=this;return new Promise(function(_0x404963,_0x4429bb){return db[_0x40d6('0x13')][_0x40d6('0x19')](_0xca801d['body'],{'raw':_0xca801d[_0x40d6('0x15')]?_0xca801d[_0x40d6('0x15')][_0x40d6('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xca801d['options']?_0xca801d[_0x40d6('0x15')][_0x40d6('0x1a')]||null:null,'attributes':_0xca801d['options']?_0xca801d[_0x40d6('0x15')][_0x40d6('0x1b')]||null:null,'limit':_0xca801d[_0x40d6('0x15')]?_0xca801d[_0x40d6('0x15')][_0x40d6('0x1c')]||null:null})[_0x40d6('0x1d')](function(_0x1becca){logger[_0x40d6('0xb')](_0x40d6('0x18'),_0xca801d);logger[_0x40d6('0xe')](_0x40d6('0x18'),_0xca801d,JSON[_0x40d6('0x17')](_0x1becca));_0x404963(_0x1becca);})[_0x40d6('0x11')](function(_0x5792d3){logger[_0x40d6('0xf')]('UpdateWhatsappQueueReport',_0x5792d3[_0x40d6('0x10')],_0xca801d);_0x4429bb(_0x35c384[_0x40d6('0xf')](0x1f4,_0x5792d3[_0x40d6('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index ef97302..1b75b8c 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 _0x462d=['get','describe','/:id','show','post','create','put','update','delete','destroy','path','connect-timeout','Router','fs-extra','./whatsappTransferReport.controller','isAuthenticated','index'];(function(_0x901901,_0xc39873){var _0x1fc6ec=function(_0x3743bd){while(--_0x3743bd){_0x901901['push'](_0x901901['shift']());}};_0x1fc6ec(++_0xc39873);}(_0x462d,0xe7));var _0xd462=function(_0x3b3253,_0x2a7403){_0x3b3253=_0x3b3253-0x0;var _0x26566b=_0x462d[_0x3b3253];return _0x26566b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd462('0x0'));var timeout=require(_0xd462('0x1'));var express=require('express');var router=express[_0xd462('0x2')]();var fs_extra=require(_0xd462('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd462('0x4'));router['get']('/',auth[_0xd462('0x5')](),controller[_0xd462('0x6')]);router[_0xd462('0x7')]('/describe',auth['isAuthenticated'](),controller[_0xd462('0x8')]);router[_0xd462('0x7')](_0xd462('0x9'),auth['isAuthenticated'](),controller[_0xd462('0xa')]);router[_0xd462('0xb')]('/',auth['isAuthenticated'](),controller[_0xd462('0xc')]);router[_0xd462('0xd')]('/:id',auth[_0xd462('0x5')](),controller[_0xd462('0xe')]);router[_0xd462('0xf')](_0xd462('0x9'),auth['isAuthenticated'](),controller[_0xd462('0x10')]);module['exports']=router; \ No newline at end of file +var _0x4334=['fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappTransferReport.controller','get','isAuthenticated','describe','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','express','Router'];(function(_0x474a37,_0x43012e){var _0x13c63e=function(_0x3cc08d){while(--_0x3cc08d){_0x474a37['push'](_0x474a37['shift']());}};_0x13c63e(++_0x43012e);}(_0x4334,0x163));var _0x4433=function(_0x139805,_0x1afb92){_0x139805=_0x139805-0x0;var _0x9bbee8=_0x4334[_0x139805];return _0x9bbee8;};'use strict';var multer=require(_0x4433('0x0'));var util=require(_0x4433('0x1'));var path=require(_0x4433('0x2'));var timeout=require('connect-timeout');var express=require(_0x4433('0x3'));var router=express[_0x4433('0x4')]();var fs_extra=require(_0x4433('0x5'));var auth=require(_0x4433('0x6'));var interaction=require(_0x4433('0x7'));var config=require('../../config/environment');var controller=require(_0x4433('0x8'));router[_0x4433('0x9')]('/',auth[_0x4433('0xa')](),controller['index']);router[_0x4433('0x9')]('/describe',auth[_0x4433('0xa')](),controller[_0x4433('0xb')]);router[_0x4433('0x9')](_0x4433('0xc'),auth[_0x4433('0xa')](),controller[_0x4433('0xd')]);router[_0x4433('0xe')]('/',auth[_0x4433('0xa')](),controller[_0x4433('0xf')]);router[_0x4433('0x10')](_0x4433('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x4433('0x11')](_0x4433('0xc'),auth[_0x4433('0xa')](),controller[_0x4433('0x12')]);module[_0x4433('0x13')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 9f2236d..1411e4e 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 _0xbd5f=['sequelize','exports','STRING','account','queue'];(function(_0x31ce8d,_0x3dec0e){var _0x1f6684=function(_0x5a2800){while(--_0x5a2800){_0x31ce8d['push'](_0x31ce8d['shift']());}};_0x1f6684(++_0x3dec0e);}(_0xbd5f,0x1c7));var _0xfbd5=function(_0x4b1d30,_0x5965d5){_0x4b1d30=_0x4b1d30-0x0;var _0x5d7ae1=_0xbd5f[_0x4b1d30];return _0x5d7ae1;};'use strict';var Sequelize=require(_0xfbd5('0x0'));module[_0xfbd5('0x1')]={'uniqueid':{'type':Sequelize[_0xfbd5('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xfbd5('0x3'),'agent',_0xfbd5('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x2c1b=['queue','sequelize','exports','STRING','ENUM','account','agent'];(function(_0x4a76ad,_0x523629){var _0x256a61=function(_0x1b5f15){while(--_0x1b5f15){_0x4a76ad['push'](_0x4a76ad['shift']());}};_0x256a61(++_0x523629);}(_0x2c1b,0xb0));var _0xb2c1=function(_0x39e283,_0x247e6b){_0x39e283=_0x39e283-0x0;var _0x7de89f=_0x2c1b[_0x39e283];return _0x7de89f;};'use strict';var Sequelize=require(_0xb2c1('0x0'));module[_0xb2c1('0x1')]={'uniqueid':{'type':Sequelize[_0xb2c1('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xb2c1('0x3')](_0xb2c1('0x4'),_0xb2c1('0x5'),_0xb2c1('0x6')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index c9a6913..14121a8 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 _0x7cc1=['type','VIRTUAL','filter','options','WhatsappTransferReport','includeAll','include','findAll','rows','show','params','rawAttributes','find','catch','create','update','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','end','sendStatus','error','stack','name','send','index','map','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7cc1,0x199));var _0x17cc=function(_0x212396,_0x23ba0a){_0x212396=_0x212396-0x0;var _0x7743d6=_0x7cc1[_0x212396];return _0x7743d6;};'use strict';var emlformat=require(_0x17cc('0x0'));var rimraf=require(_0x17cc('0x1'));var zipdir=require(_0x17cc('0x2'));var jsonpatch=require(_0x17cc('0x3'));var rp=require('request-promise');var moment=require(_0x17cc('0x4'));var BPromise=require(_0x17cc('0x5'));var Mustache=require(_0x17cc('0x6'));var util=require(_0x17cc('0x7'));var path=require(_0x17cc('0x8'));var sox=require(_0x17cc('0x9'));var csv=require('to-csv');var ejs=require(_0x17cc('0xa'));var fs=require('fs');var fs_extra=require(_0x17cc('0xb'));var _=require('lodash');var squel=require(_0x17cc('0xc'));var crypto=require(_0x17cc('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x17cc('0xe'));var Papa=require(_0x17cc('0xf'));var Redis=require(_0x17cc('0x10'));var authService=require(_0x17cc('0x11'));var qs=require(_0x17cc('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x17cc('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x17cc('0x14'));var db=require(_0x17cc('0x15'))['db'];function respondWithStatusCode(_0x65a364,_0x76a029){_0x76a029=_0x76a029||0xcc;return function(_0x5bd018){if(_0x5bd018){return _0x65a364['sendStatus'](_0x76a029);}return _0x65a364[_0x17cc('0x16')](_0x76a029)['end']();};}function respondWithResult(_0x3527b8,_0x48c2ba){_0x48c2ba=_0x48c2ba||0xc8;return function(_0x536496){if(_0x536496){return _0x3527b8[_0x17cc('0x16')](_0x48c2ba)[_0x17cc('0x17')](_0x536496);}};}function respondWithFilteredResult(_0x56e7c8,_0x55ea89){return function(_0x578dba){if(_0x578dba){var _0xb20f71=typeof _0x55ea89[_0x17cc('0x18')]===_0x17cc('0x19')&&typeof _0x55ea89[_0x17cc('0x1a')]===_0x17cc('0x19');var _0x17f71a=_0x578dba['count'];var _0x31fc7e=_0xb20f71?0x0:_0x55ea89[_0x17cc('0x18')];var _0xd3334c=_0xb20f71?_0x578dba[_0x17cc('0x1b')]:_0x55ea89['offset']+_0x55ea89[_0x17cc('0x1a')];var _0x597bc0;if(_0xd3334c>=_0x17f71a){_0xd3334c=_0x17f71a;_0x597bc0=0xc8;}else{_0x597bc0=0xce;}_0x56e7c8[_0x17cc('0x16')](_0x597bc0);return _0x56e7c8[_0x17cc('0x1c')](_0x17cc('0x1d'),_0x31fc7e+'-'+_0xd3334c+'/'+_0x17f71a)['json'](_0x578dba);}return null;};}function patchUpdates(_0x4fa193){return function(_0x12d646){try{jsonpatch[_0x17cc('0x1e')](_0x12d646,_0x4fa193,!![]);}catch(_0x5511a3){return BPromise[_0x17cc('0x1f')](_0x5511a3);}return _0x12d646[_0x17cc('0x20')]();};}function saveUpdates(_0x5696f2,_0x39d220){return function(_0x4f632e){if(_0x4f632e){return _0x4f632e['update'](_0x5696f2)[_0x17cc('0x21')](function(_0x39c660){return _0x39c660;});}return null;};}function removeEntity(_0x56a6d1,_0x436fac){return function(_0xace29f){if(_0xace29f){return _0xace29f['destroy']()['then'](function(){_0x56a6d1[_0x17cc('0x16')](0xcc)[_0x17cc('0x22')]();});}};}function handleEntityNotFound(_0x3bb88c,_0x571a3e){return function(_0x5e249a){if(!_0x5e249a){_0x3bb88c[_0x17cc('0x23')](0x194);}return _0x5e249a;};}function handleError(_0x1b2b47,_0x2e6067){_0x2e6067=_0x2e6067||0x1f4;return function(_0x14167e){logger[_0x17cc('0x24')](_0x14167e[_0x17cc('0x25')]);if(_0x14167e[_0x17cc('0x26')]){delete _0x14167e[_0x17cc('0x26')];}_0x1b2b47[_0x17cc('0x16')](_0x2e6067)[_0x17cc('0x27')](_0x14167e);};}exports[_0x17cc('0x28')]=function(_0x914617,_0x9a8f17){var _0x3e9d16={},_0x15b4b1={},_0x5c9dbf={'count':0x0,'rows':[]};var _0x59a4dc=_[_0x17cc('0x29')](db['WhatsappTransferReport']['rawAttributes'],function(_0x4ad6e5){return{'name':_0x4ad6e5[_0x17cc('0x2a')],'type':_0x4ad6e5['type'][_0x17cc('0x2b')]};});_0x15b4b1[_0x17cc('0x2c')]=_[_0x17cc('0x29')](_0x59a4dc,_0x17cc('0x26'));_0x15b4b1[_0x17cc('0x2d')]=_[_0x17cc('0x2e')](_0x914617[_0x17cc('0x2d')]);_0x15b4b1['filters']=_[_0x17cc('0x2f')](_0x15b4b1[_0x17cc('0x2c')],_0x15b4b1['query']);_0x3e9d16[_0x17cc('0x30')]=_[_0x17cc('0x2f')](_0x15b4b1[_0x17cc('0x2c')],qs['fields'](_0x914617[_0x17cc('0x2d')][_0x17cc('0x31')]));_0x3e9d16[_0x17cc('0x30')]=_0x3e9d16[_0x17cc('0x30')][_0x17cc('0x32')]?_0x3e9d16['attributes']:_0x15b4b1[_0x17cc('0x2c')];if(!_0x914617['query'][_0x17cc('0x33')](_0x17cc('0x34'))){_0x3e9d16[_0x17cc('0x1a')]=qs[_0x17cc('0x1a')](_0x914617['query']['limit']);_0x3e9d16[_0x17cc('0x18')]=qs['offset'](_0x914617[_0x17cc('0x2d')]['offset']);}_0x3e9d16[_0x17cc('0x35')]=qs[_0x17cc('0x36')](_0x914617[_0x17cc('0x2d')]['sort']);_0x3e9d16['where']=qs[_0x17cc('0x37')](_[_0x17cc('0x38')](_0x914617[_0x17cc('0x2d')],_0x15b4b1['filters']),_0x59a4dc);if(_0x914617[_0x17cc('0x2d')]['filter']){_0x3e9d16[_0x17cc('0x39')]=_[_0x17cc('0x3a')](_0x3e9d16[_0x17cc('0x39')],{'$or':_['map'](_0x59a4dc,function(_0x2fe285){if(_0x2fe285[_0x17cc('0x3b')]!==_0x17cc('0x3c')){var _0x459866={};_0x459866[_0x2fe285[_0x17cc('0x26')]]={'$like':'%'+_0x914617[_0x17cc('0x2d')][_0x17cc('0x3d')]+'%'};return _0x459866;}})});}_0x3e9d16=_['merge']({},_0x3e9d16,_0x914617[_0x17cc('0x3e')]);var _0x33bfa3={'where':_0x3e9d16[_0x17cc('0x39')]};return db[_0x17cc('0x3f')]['count'](_0x33bfa3)[_0x17cc('0x21')](function(_0x4d0745){_0x5c9dbf[_0x17cc('0x1b')]=_0x4d0745;if(_0x914617[_0x17cc('0x2d')][_0x17cc('0x40')]){_0x3e9d16[_0x17cc('0x41')]=[{'all':!![]}];}return db[_0x17cc('0x3f')][_0x17cc('0x42')](_0x3e9d16);})[_0x17cc('0x21')](function(_0x364f8d){_0x5c9dbf[_0x17cc('0x43')]=_0x364f8d;return _0x5c9dbf;})[_0x17cc('0x21')](respondWithFilteredResult(_0x9a8f17,_0x3e9d16))['catch'](handleError(_0x9a8f17,null));};exports[_0x17cc('0x44')]=function(_0x1609f1,_0x494728){var _0x570501={'raw':!![],'where':{'id':_0x1609f1[_0x17cc('0x45')]['id']}},_0x25b71d={};_0x25b71d[_0x17cc('0x2c')]=_['keys'](db[_0x17cc('0x3f')][_0x17cc('0x46')]);_0x25b71d[_0x17cc('0x2d')]=_['keys'](_0x1609f1[_0x17cc('0x2d')]);_0x25b71d[_0x17cc('0x37')]=_[_0x17cc('0x2f')](_0x25b71d[_0x17cc('0x2c')],_0x25b71d[_0x17cc('0x2d')]);_0x570501['attributes']=_[_0x17cc('0x2f')](_0x25b71d[_0x17cc('0x2c')],qs['fields'](_0x1609f1['query'][_0x17cc('0x31')]));_0x570501[_0x17cc('0x30')]=_0x570501['attributes']['length']?_0x570501['attributes']:_0x25b71d[_0x17cc('0x2c')];if(_0x1609f1[_0x17cc('0x2d')][_0x17cc('0x40')]){_0x570501[_0x17cc('0x41')]=[{'all':!![]}];}_0x570501=_[_0x17cc('0x3a')]({},_0x570501,_0x1609f1[_0x17cc('0x3e')]);return db[_0x17cc('0x3f')][_0x17cc('0x47')](_0x570501)['then'](handleEntityNotFound(_0x494728,null))['then'](respondWithResult(_0x494728,null))[_0x17cc('0x48')](handleError(_0x494728,null));};exports['create']=function(_0x1b3768,_0x1b14f2){return db['WhatsappTransferReport'][_0x17cc('0x49')](_0x1b3768['body'],{})[_0x17cc('0x21')](respondWithResult(_0x1b14f2,0xc9))[_0x17cc('0x48')](handleError(_0x1b14f2,null));};exports[_0x17cc('0x4a')]=function(_0x385cdc,_0x49a170){if(_0x385cdc['body']['id']){delete _0x385cdc[_0x17cc('0x4b')]['id'];}return db['WhatsappTransferReport'][_0x17cc('0x47')]({'where':{'id':_0x385cdc[_0x17cc('0x45')]['id']}})[_0x17cc('0x21')](handleEntityNotFound(_0x49a170,null))[_0x17cc('0x21')](saveUpdates(_0x385cdc[_0x17cc('0x4b')],null))[_0x17cc('0x21')](respondWithResult(_0x49a170,null))[_0x17cc('0x48')](handleError(_0x49a170,null));};exports[_0x17cc('0x4c')]=function(_0x5a8736,_0x22ea13){return db[_0x17cc('0x3f')]['find']({'where':{'id':_0x5a8736[_0x17cc('0x45')]['id']}})[_0x17cc('0x21')](handleEntityNotFound(_0x22ea13,null))[_0x17cc('0x21')](removeEntity(_0x22ea13,null))['catch'](handleError(_0x22ea13,null));};exports['describe']=function(_0x435608,_0x105ec4){return db[_0x17cc('0x3f')][_0x17cc('0x4d')]()[_0x17cc('0x21')](respondWithResult(_0x105ec4,null))['catch'](handleError(_0x105ec4,null));}; \ No newline at end of file +var _0x50a5=['offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','WhatsappTransferReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','filter','merge','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','destroy','describe','eml-format','rimraf','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0x50a5,0xd1));var _0x550a=function(_0x4f4b88,_0x1bfcac){_0x4f4b88=_0x4f4b88-0x0;var _0x3c300d=_0x50a5[_0x4f4b88];return _0x3c300d;};'use strict';var emlformat=require(_0x550a('0x0'));var rimraf=require(_0x550a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x550a('0x2'));var Mustache=require('mustache');var util=require(_0x550a('0x3'));var path=require(_0x550a('0x4'));var sox=require(_0x550a('0x5'));var csv=require(_0x550a('0x6'));var ejs=require(_0x550a('0x7'));var fs=require('fs');var fs_extra=require(_0x550a('0x8'));var _=require(_0x550a('0x9'));var squel=require(_0x550a('0xa'));var crypto=require(_0x550a('0xb'));var jsforce=require(_0x550a('0xc'));var deskjs=require(_0x550a('0xd'));var toCsv=require(_0x550a('0x6'));var querystring=require(_0x550a('0xe'));var Papa=require('papaparse');var Redis=require(_0x550a('0xf'));var authService=require(_0x550a('0x10'));var qs=require(_0x550a('0x11'));var as=require(_0x550a('0x12'));var hardwareService=require(_0x550a('0x13'));var logger=require(_0x550a('0x14'))('api');var utils=require(_0x550a('0x15'));var config=require(_0x550a('0x16'));var licenseUtil=require(_0x550a('0x17'));var db=require(_0x550a('0x18'))['db'];function respondWithStatusCode(_0x2fb177,_0x38b9fe){_0x38b9fe=_0x38b9fe||0xcc;return function(_0x1fea00){if(_0x1fea00){return _0x2fb177[_0x550a('0x19')](_0x38b9fe);}return _0x2fb177['status'](_0x38b9fe)[_0x550a('0x1a')]();};}function respondWithResult(_0x4d22ea,_0x535eab){_0x535eab=_0x535eab||0xc8;return function(_0x1c602a){if(_0x1c602a){return _0x4d22ea[_0x550a('0x1b')](_0x535eab)['json'](_0x1c602a);}};}function respondWithFilteredResult(_0x23d2db,_0x4d1cb8){return function(_0x388aaa){if(_0x388aaa){var _0x4fa030=typeof _0x4d1cb8[_0x550a('0x1c')]===_0x550a('0x1d')&&typeof _0x4d1cb8[_0x550a('0x1e')]===_0x550a('0x1d');var _0x179ae5=_0x388aaa[_0x550a('0x1f')];var _0x5d4f5d=_0x4fa030?0x0:_0x4d1cb8[_0x550a('0x1c')];var _0x5d8f86=_0x4fa030?_0x388aaa[_0x550a('0x1f')]:_0x4d1cb8[_0x550a('0x1c')]+_0x4d1cb8[_0x550a('0x1e')];var _0x31c19b;if(_0x5d8f86>=_0x179ae5){_0x5d8f86=_0x179ae5;_0x31c19b=0xc8;}else{_0x31c19b=0xce;}_0x23d2db[_0x550a('0x1b')](_0x31c19b);return _0x23d2db['set'](_0x550a('0x20'),_0x5d4f5d+'-'+_0x5d8f86+'/'+_0x179ae5)[_0x550a('0x21')](_0x388aaa);}return null;};}function patchUpdates(_0x252242){return function(_0x1556c3){try{jsonpatch[_0x550a('0x22')](_0x1556c3,_0x252242,!![]);}catch(_0x4bb936){return BPromise[_0x550a('0x23')](_0x4bb936);}return _0x1556c3[_0x550a('0x24')]();};}function saveUpdates(_0x3d1c2d,_0x1fcf3b){return function(_0x4c550d){if(_0x4c550d){return _0x4c550d[_0x550a('0x25')](_0x3d1c2d)[_0x550a('0x26')](function(_0xc48d09){return _0xc48d09;});}return null;};}function removeEntity(_0x512517,_0x2d03e5){return function(_0x18aa4b){if(_0x18aa4b){return _0x18aa4b['destroy']()[_0x550a('0x26')](function(){_0x512517['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x132679,_0x55ae44){return function(_0x231470){if(!_0x231470){_0x132679['sendStatus'](0x194);}return _0x231470;};}function handleError(_0x4893ec,_0x2d4565){_0x2d4565=_0x2d4565||0x1f4;return function(_0x19b2cf){logger[_0x550a('0x27')](_0x19b2cf[_0x550a('0x28')]);if(_0x19b2cf[_0x550a('0x29')]){delete _0x19b2cf[_0x550a('0x29')];}_0x4893ec[_0x550a('0x1b')](_0x2d4565)[_0x550a('0x2a')](_0x19b2cf);};}exports['index']=function(_0x51b453,_0x26d08d){var _0x1d0a05={},_0x2326ef={},_0x56273d={'count':0x0,'rows':[]};var _0xc1cf31=_['map'](db[_0x550a('0x2b')][_0x550a('0x2c')],function(_0x369905){return{'name':_0x369905[_0x550a('0x2d')],'type':_0x369905[_0x550a('0x2e')][_0x550a('0x2f')]};});_0x2326ef[_0x550a('0x30')]=_[_0x550a('0x31')](_0xc1cf31,_0x550a('0x29'));_0x2326ef[_0x550a('0x32')]=_[_0x550a('0x33')](_0x51b453['query']);_0x2326ef[_0x550a('0x34')]=_[_0x550a('0x35')](_0x2326ef['model'],_0x2326ef[_0x550a('0x32')]);_0x1d0a05[_0x550a('0x36')]=_['intersection'](_0x2326ef[_0x550a('0x30')],qs['fields'](_0x51b453[_0x550a('0x32')][_0x550a('0x37')]));_0x1d0a05[_0x550a('0x36')]=_0x1d0a05['attributes'][_0x550a('0x38')]?_0x1d0a05['attributes']:_0x2326ef[_0x550a('0x30')];if(!_0x51b453[_0x550a('0x32')][_0x550a('0x39')](_0x550a('0x3a'))){_0x1d0a05[_0x550a('0x1e')]=qs[_0x550a('0x1e')](_0x51b453[_0x550a('0x32')][_0x550a('0x1e')]);_0x1d0a05[_0x550a('0x1c')]=qs[_0x550a('0x1c')](_0x51b453[_0x550a('0x32')][_0x550a('0x1c')]);}_0x1d0a05[_0x550a('0x3b')]=qs[_0x550a('0x3c')](_0x51b453['query'][_0x550a('0x3c')]);_0x1d0a05['where']=qs[_0x550a('0x34')](_[_0x550a('0x3d')](_0x51b453[_0x550a('0x32')],_0x2326ef['filters']),_0xc1cf31);if(_0x51b453['query']['filter']){_0x1d0a05[_0x550a('0x3e')]=_['merge'](_0x1d0a05[_0x550a('0x3e')],{'$or':_[_0x550a('0x31')](_0xc1cf31,function(_0x447508){if(_0x447508['type']!==_0x550a('0x3f')){var _0x2fc459={};_0x2fc459[_0x447508[_0x550a('0x29')]]={'$like':'%'+_0x51b453[_0x550a('0x32')][_0x550a('0x40')]+'%'};return _0x2fc459;}})});}_0x1d0a05=_[_0x550a('0x41')]({},_0x1d0a05,_0x51b453[_0x550a('0x42')]);var _0x4fa71f={'where':_0x1d0a05[_0x550a('0x3e')]};return db['WhatsappTransferReport']['count'](_0x4fa71f)[_0x550a('0x26')](function(_0x57a521){_0x56273d[_0x550a('0x1f')]=_0x57a521;if(_0x51b453['query']['includeAll']){_0x1d0a05[_0x550a('0x43')]=[{'all':!![]}];}return db[_0x550a('0x2b')][_0x550a('0x44')](_0x1d0a05);})[_0x550a('0x26')](function(_0x44ee5f){_0x56273d[_0x550a('0x45')]=_0x44ee5f;return _0x56273d;})[_0x550a('0x26')](respondWithFilteredResult(_0x26d08d,_0x1d0a05))[_0x550a('0x46')](handleError(_0x26d08d,null));};exports[_0x550a('0x47')]=function(_0x11b3e7,_0x54f8b8){var _0x4aacb4={'raw':!![],'where':{'id':_0x11b3e7[_0x550a('0x48')]['id']}},_0x37dc74={};_0x37dc74['model']=_[_0x550a('0x33')](db[_0x550a('0x2b')][_0x550a('0x2c')]);_0x37dc74[_0x550a('0x32')]=_[_0x550a('0x33')](_0x11b3e7[_0x550a('0x32')]);_0x37dc74[_0x550a('0x34')]=_[_0x550a('0x35')](_0x37dc74['model'],_0x37dc74['query']);_0x4aacb4[_0x550a('0x36')]=_['intersection'](_0x37dc74[_0x550a('0x30')],qs[_0x550a('0x37')](_0x11b3e7['query'][_0x550a('0x37')]));_0x4aacb4['attributes']=_0x4aacb4[_0x550a('0x36')][_0x550a('0x38')]?_0x4aacb4['attributes']:_0x37dc74[_0x550a('0x30')];if(_0x11b3e7[_0x550a('0x32')][_0x550a('0x49')]){_0x4aacb4['include']=[{'all':!![]}];}_0x4aacb4=_[_0x550a('0x41')]({},_0x4aacb4,_0x11b3e7[_0x550a('0x42')]);return db[_0x550a('0x2b')][_0x550a('0x4a')](_0x4aacb4)['then'](handleEntityNotFound(_0x54f8b8,null))[_0x550a('0x26')](respondWithResult(_0x54f8b8,null))[_0x550a('0x46')](handleError(_0x54f8b8,null));};exports[_0x550a('0x4b')]=function(_0x567373,_0x3f852b){return db['WhatsappTransferReport']['create'](_0x567373['body'],{})[_0x550a('0x26')](respondWithResult(_0x3f852b,0xc9))[_0x550a('0x46')](handleError(_0x3f852b,null));};exports[_0x550a('0x25')]=function(_0x3183fe,_0x12763f){if(_0x3183fe[_0x550a('0x4c')]['id']){delete _0x3183fe['body']['id'];}return db[_0x550a('0x2b')][_0x550a('0x4a')]({'where':{'id':_0x3183fe['params']['id']}})[_0x550a('0x26')](handleEntityNotFound(_0x12763f,null))['then'](saveUpdates(_0x3183fe[_0x550a('0x4c')],null))[_0x550a('0x26')](respondWithResult(_0x12763f,null))[_0x550a('0x46')](handleError(_0x12763f,null));};exports[_0x550a('0x4d')]=function(_0x15d32c,_0x1f7211){return db[_0x550a('0x2b')]['find']({'where':{'id':_0x15d32c[_0x550a('0x48')]['id']}})['then'](handleEntityNotFound(_0x1f7211,null))[_0x550a('0x26')](removeEntity(_0x1f7211,null))['catch'](handleError(_0x1f7211,null));};exports[_0x550a('0x4e')]=function(_0x575744,_0x7bb008){return db[_0x550a('0x2b')][_0x550a('0x4e')]()['then'](respondWithResult(_0x7bb008,null))[_0x550a('0x46')](handleError(_0x7bb008,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 65ad0d6..a867a3c 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 _0xf05e=['../../config/environment','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','uniqueid','lodash','util','api','moment','request-promise','path'];(function(_0x2755fb,_0x5970f1){var _0x293f12=function(_0x4c629d){while(--_0x4c629d){_0x2755fb['push'](_0x2755fb['shift']());}};_0x293f12(++_0x5970f1);}(_0xf05e,0x10e));var _0xef05=function(_0x1fb57a,_0x2839e9){_0x1fb57a=_0x1fb57a-0x0;var _0x468a1a=_0xf05e[_0x1fb57a];return _0x468a1a;};'use strict';var _=require(_0xef05('0x0'));var util=require(_0xef05('0x1'));var logger=require('../../config/logger')(_0xef05('0x2'));var moment=require(_0xef05('0x3'));var BPromise=require('bluebird');var rp=require(_0xef05('0x4'));var fs=require('fs');var path=require(_0xef05('0x5'));var rimraf=require('rimraf');var config=require(_0xef05('0x6'));var attributes=require(_0xef05('0x7'));module[_0xef05('0x8')]=function(_0x53ceff,_0x486852){return _0x53ceff[_0xef05('0x9')](_0xef05('0xa'),attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':_0xef05('0xb'),'fields':[_0xef05('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5f58=['lodash','util','../../config/logger','moment','bluebird','path','rimraf','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid'];(function(_0x352d28,_0x444033){var _0x387d7e=function(_0x40be0e){while(--_0x40be0e){_0x352d28['push'](_0x352d28['shift']());}};_0x387d7e(++_0x444033);}(_0x5f58,0x129));var _0x85f5=function(_0x3b84dc,_0x5b6a7b){_0x3b84dc=_0x3b84dc-0x0;var _0x2c8da3=_0x5f58[_0x3b84dc];return _0x2c8da3;};'use strict';var _=require(_0x85f5('0x0'));var util=require(_0x85f5('0x1'));var logger=require(_0x85f5('0x2'))('api');var moment=require(_0x85f5('0x3'));var BPromise=require(_0x85f5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x85f5('0x5'));var rimraf=require(_0x85f5('0x6'));var config=require('../../config/environment');var attributes=require('./whatsappTransferReport.attributes');module['exports']=function(_0x56fd17,_0x286d56){return _0x56fd17[_0x85f5('0x7')](_0x85f5('0x8'),attributes,{'tableName':_0x85f5('0x9'),'paranoid':![],'indexes':[{'name':_0x85f5('0xa'),'fields':[_0x85f5('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 51b08bd..011952e 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 _0xc60f=['WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info'];(function(_0x46fb5d,_0x3dc1ad){var _0x26169=function(_0xc774e6){while(--_0xc774e6){_0x46fb5d['push'](_0x46fb5d['shift']());}};_0x26169(++_0x3dc1ad);}(_0xc60f,0x17a));var _0xfc60=function(_0x49760c,_0x2ee176){_0x49760c=_0x49760c-0x0;var _0x50033f=_0xc60f[_0x49760c];return _0x50033f;};'use strict';var _=require('lodash');var util=require(_0xfc60('0x0'));var moment=require(_0xfc60('0x1'));var BPromise=require(_0xfc60('0x2'));var rs=require(_0xfc60('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfc60('0x4'))['db'];var utils=require(_0xfc60('0x5'));var logger=require(_0xfc60('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xfc60('0x7'));var client=jayson[_0xfc60('0x8')][_0xfc60('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x18d44c,_0x46ad33,_0x172ec7){return new BPromise(function(_0x4866f2,_0x100304){return client[_0xfc60('0xa')](_0x18d44c,_0x172ec7)[_0xfc60('0xb')](function(_0x50c3ab){logger[_0xfc60('0xc')](_0xfc60('0xd'),_0x46ad33,_0xfc60('0xe'));logger[_0xfc60('0xf')](_0xfc60('0x10'),_0x46ad33,_0xfc60('0xe'),JSON[_0xfc60('0x11')](_0x50c3ab));if(_0x50c3ab[_0xfc60('0x12')]){if(_0x50c3ab['error'][_0xfc60('0x13')]===0x1f4){logger[_0xfc60('0x12')](_0xfc60('0xd'),_0x46ad33,_0x50c3ab[_0xfc60('0x12')]['message']);return _0x100304(_0x50c3ab['error'][_0xfc60('0x14')]);}logger[_0xfc60('0x12')](_0xfc60('0xd'),_0x46ad33,_0x50c3ab[_0xfc60('0x12')][_0xfc60('0x14')]);return _0x4866f2(_0x50c3ab[_0xfc60('0x12')]['message']);}else{logger[_0xfc60('0xc')](_0xfc60('0xd'),_0x46ad33,'request\x20sent');_0x4866f2(_0x50c3ab[_0xfc60('0x15')][_0xfc60('0x14')]);}})[_0xfc60('0x16')](function(_0x5692b1){logger['error'](_0xfc60('0xd'),_0x46ad33,_0x5692b1);_0x100304(_0x5692b1);});});} \ No newline at end of file +var _0x8aa0=['error','code','WhatsappTransferReport,\x20%s,\x20%s','message','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0xdc9393,_0x1367a2){var _0x1a7af3=function(_0x10ac35){while(--_0x10ac35){_0xdc9393['push'](_0xdc9393['shift']());}};_0x1a7af3(++_0x1367a2);}(_0x8aa0,0x1d2));var _0x08aa=function(_0x11e645,_0x30f302){_0x11e645=_0x11e645-0x0;var _0x206f11=_0x8aa0[_0x11e645];return _0x206f11;};'use strict';var _=require('lodash');var util=require(_0x08aa('0x0'));var moment=require(_0x08aa('0x1'));var BPromise=require(_0x08aa('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x08aa('0x3'));var db=require(_0x08aa('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x08aa('0x5'))(_0x08aa('0x6'));var config=require(_0x08aa('0x7'));var jayson=require(_0x08aa('0x8'));var client=jayson[_0x08aa('0x9')][_0x08aa('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x441113,_0x50a4a6,_0x388efc){return new BPromise(function(_0x4b14f1,_0x262b73){return client[_0x08aa('0xb')](_0x441113,_0x388efc)[_0x08aa('0xc')](function(_0x2db55b){logger[_0x08aa('0xd')]('WhatsappTransferReport,\x20%s,\x20%s',_0x50a4a6,_0x08aa('0xe'));logger['debug'](_0x08aa('0xf'),_0x50a4a6,'request\x20sent',JSON[_0x08aa('0x10')](_0x2db55b));if(_0x2db55b[_0x08aa('0x11')]){if(_0x2db55b[_0x08aa('0x11')][_0x08aa('0x12')]===0x1f4){logger[_0x08aa('0x11')](_0x08aa('0x13'),_0x50a4a6,_0x2db55b[_0x08aa('0x11')][_0x08aa('0x14')]);return _0x262b73(_0x2db55b[_0x08aa('0x11')][_0x08aa('0x14')]);}logger[_0x08aa('0x11')](_0x08aa('0x13'),_0x50a4a6,_0x2db55b[_0x08aa('0x11')][_0x08aa('0x14')]);return _0x4b14f1(_0x2db55b[_0x08aa('0x11')]['message']);}else{logger['info'](_0x08aa('0x13'),_0x50a4a6,_0x08aa('0xe'));_0x4b14f1(_0x2db55b['result'][_0x08aa('0x14')]);}})['catch'](function(_0x373511){logger['error'](_0x08aa('0x13'),_0x50a4a6,_0x373511);_0x262b73(_0x373511);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index e11ddfd..cac62de 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x038b=['then','listen','info','start','exitCode','number','length','map','pm2_env','name','filter','online','Offline\x20apps:','join','None','App\x20Ready!','catch','log','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','./mysqldb','./config/seedDB','./config/license','./config/environment','app','./config/pm2','./config/schedule','./config/schedule/chat','./config/schedule/cloud-provider','sequelize','sync','default'];(function(_0x1ec245,_0x343203){var _0x1c154a=function(_0x10a28b){while(--_0x10a28b){_0x1ec245['push'](_0x1ec245['shift']());}};_0x1c154a(++_0x343203);}(_0x038b,0x114));var _0xb038=function(_0x204a7b,_0x1e2f40){_0x204a7b=_0x204a7b-0x0;var _0x4f8372=_0x038b[_0x204a7b];return _0x4f8372;};'use strict';var _=require('lodash');var db=require(_0xb038('0x0'))['db'];var seedDb=require(_0xb038('0x1'));var checkLicense=require(_0xb038('0x2'));var rpc=require('./rpc');var config=require(_0xb038('0x3'));var logger=require('./config/logger')(_0xb038('0x4'));var pm2=require(_0xb038('0x5'));var pm2Config=require('./config/pm2/config');var schedule=require(_0xb038('0x6'));var chat=require(_0xb038('0x7'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require('./config/schedule/transcribe');var provider=require(_0xb038('0x8'));function main(){return db[_0xb038('0x9')][_0xb038('0xa')]()['then'](function(){if(config['seedDB']){return seedDb[_0xb038('0xb')]();}})[_0xb038('0xc')](function(){return checkLicense['default']();})['then'](function(){return rpc[_0xb038('0xd')]();})[_0xb038('0xc')](function(_0x5c96b5){logger[_0xb038('0xe')](_0x5c96b5);return chat[_0xb038('0xf')]();})[_0xb038('0xc')](function(){return whatsapp[_0xb038('0xf')]();})[_0xb038('0xc')](function(){return schedule[_0xb038('0xf')]();})[_0xb038('0xc')](function(){return transcribe[_0xb038('0xf')]();})[_0xb038('0xc')](function(){return provider[_0xb038('0xf')]();})[_0xb038('0xc')](function(_0x119c81){logger[_0xb038('0xe')](_0x119c81);return pm2[_0xb038('0xf')](pm2Config);})[_0xb038('0xc')](function(_0x13acc7){var _0x13f893=_0x13acc7['filter'](function(_0xe8aa7c){return typeof _0xe8aa7c[_0xb038('0x10')]===_0xb038('0x11')&&_0xe8aa7c[_0xb038('0x10')]>=0x0;});if(_0x13f893[_0xb038('0x12')]>0x0){throw new Error(_0x13f893[_0xb038('0x12')]+'\x20processes\x20failed\x20at\x20startup:\x20'+_[_0xb038('0x13')](_0x13f893,function(_0x3039b0){return'\x22'+_0x3039b0[_0xb038('0x14')][_0xb038('0x15')]+'\x22';}));}logger['info']('Online\x20apps:',_[_0xb038('0x13')](_[_0xb038('0x16')](_0x13acc7,{'status':_0xb038('0x17')}),_0xb038('0x15'))['join']());logger[_0xb038('0xe')](_0xb038('0x18'),_[_0xb038('0x13')](_[_0xb038('0x16')](_0x13acc7,function(_0xc6cd61){return _0xc6cd61['status']!==_0xb038('0x17');}),_0xb038('0x15'))[_0xb038('0x19')]()||_0xb038('0x1a'));console['log'](_0xb038('0x1b'));})[_0xb038('0x1c')](function(_0x4bbf38){console[_0xb038('0x1d')](_0xb038('0x1e'),_0x4bbf38);logger['error'](_0xb038('0x1f'),_0x4bbf38);process['exit'](0x1);});}main(); \ No newline at end of file +var _0xb38e=['length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','Online\x20apps:','join','Offline\x20apps:','name','log','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./config/seedDB','./config/license','./rpc','./config/environment','./config/logger','./config/pm2','./config/pm2/config','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sync','then','seedDB','default','listen','info','start','filter','exitCode','number'];(function(_0x2ac965,_0x598e89){var _0x5d544e=function(_0x55f191){while(--_0x55f191){_0x2ac965['push'](_0x2ac965['shift']());}};_0x5d544e(++_0x598e89);}(_0xb38e,0xa7));var _0xeb38=function(_0x5e9507,_0x353abd){_0x5e9507=_0x5e9507-0x0;var _0x90e8e0=_0xb38e[_0x5e9507];return _0x90e8e0;};'use strict';var _=require(_0xeb38('0x0'));var db=require(_0xeb38('0x1'))['db'];var seedDb=require(_0xeb38('0x2'));var checkLicense=require(_0xeb38('0x3'));var rpc=require(_0xeb38('0x4'));var config=require(_0xeb38('0x5'));var logger=require(_0xeb38('0x6'))('app');var pm2=require(_0xeb38('0x7'));var pm2Config=require(_0xeb38('0x8'));var schedule=require('./config/schedule');var chat=require(_0xeb38('0x9'));var whatsapp=require(_0xeb38('0xa'));var transcribe=require(_0xeb38('0xb'));var provider=require(_0xeb38('0xc'));function main(){return db['sequelize'][_0xeb38('0xd')]()[_0xeb38('0xe')](function(){if(config[_0xeb38('0xf')]){return seedDb[_0xeb38('0x10')]();}})['then'](function(){return checkLicense[_0xeb38('0x10')]();})[_0xeb38('0xe')](function(){return rpc[_0xeb38('0x11')]();})[_0xeb38('0xe')](function(_0xfbd120){logger[_0xeb38('0x12')](_0xfbd120);return chat[_0xeb38('0x13')]();})['then'](function(){return whatsapp[_0xeb38('0x13')]();})['then'](function(){return schedule[_0xeb38('0x13')]();})[_0xeb38('0xe')](function(){return transcribe['start']();})[_0xeb38('0xe')](function(){return provider[_0xeb38('0x13')]();})[_0xeb38('0xe')](function(_0x398ca9){logger[_0xeb38('0x12')](_0x398ca9);return pm2[_0xeb38('0x13')](pm2Config);})['then'](function(_0x2b8284){var _0x8fd46b=_0x2b8284[_0xeb38('0x14')](function(_0x1dcd10){return typeof _0x1dcd10[_0xeb38('0x15')]===_0xeb38('0x16')&&_0x1dcd10[_0xeb38('0x15')]>=0x0;});if(_0x8fd46b['length']>0x0){throw new Error(_0x8fd46b[_0xeb38('0x17')]+_0xeb38('0x18')+_[_0xeb38('0x19')](_0x8fd46b,function(_0x59eaa0){return'\x22'+_0x59eaa0[_0xeb38('0x1a')]['name']+'\x22';}));}logger['info'](_0xeb38('0x1b'),_[_0xeb38('0x19')](_[_0xeb38('0x14')](_0x2b8284,{'status':'online'}),'name')[_0xeb38('0x1c')]());logger[_0xeb38('0x12')](_0xeb38('0x1d'),_[_0xeb38('0x19')](_[_0xeb38('0x14')](_0x2b8284,function(_0x5f086e){return _0x5f086e['status']!=='online';}),_0xeb38('0x1e'))[_0xeb38('0x1c')]()||'None');console[_0xeb38('0x1f')](_0xeb38('0x20'));})[_0xeb38('0x21')](function(_0x5c8ed6){console[_0xeb38('0x1f')](_0xeb38('0x22'),_0x5c8ed6);logger[_0xeb38('0x23')](_0xeb38('0x24'),_0x5c8ed6);process[_0xeb38('0x25')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index ef11db6..16db93c 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 _0x3e74=['util','moment','session','role','fullname','name','internal','userpic','voicePause','chatPause','faxPause','openchannelPause','pauseType','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','interface','userProfileId','privacyEnabled','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswerDelay','isChatInteractionAuthorized','isAuthenticated','use','user','params','closed','then','disposition','unmanaged','json','Forbidden.','headers','authorization','startsWith','Basic','User','find','authenticate','pass','status','Wrong\x20credentials.','catch','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','Setting','findOne','allowedLoginAttempts','blockDuration','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','minutes','update','Forbidden','isWebrtcLicence','webrtc','isMiddleware','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','/dashboards/general','send','retrieveApiKey','apiKeyNonce','isNil','generateApiKey','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','Sequelize','ValidationError','validatePasswordHistory','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','length','join','promisify','secret','secrets','payload','options','randomBytes','toString','floor','now','../../mysqldb','../../config/license/hardware','../../config/license/util','../encryptor','express-jwt','basic-auth','crypto','bluebird'];(function(_0x2aa0e0,_0x3372f8){var _0x2f90f9=function(_0x2afb30){while(--_0x2afb30){_0x2aa0e0['push'](_0x2aa0e0['shift']());}};_0x2f90f9(++_0x3372f8);}(_0x3e74,0x175));var _0x43e7=function(_0x21ca28,_0x80cbbc){_0x21ca28=_0x21ca28-0x0;var _0x22fa85=_0x3e74[_0x21ca28];return _0x22fa85;};'use strict';var db=require(_0x43e7('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require(_0x43e7('0x1'));var licenseUtil=require(_0x43e7('0x2'));var encryptor=require(_0x43e7('0x3'));var _=require('lodash');var jwt=require('jsonwebtoken');var expressJwt=require(_0x43e7('0x4'));var compose=require('composable-middleware');var basicAuth=require(_0x43e7('0x5'));var crypto=require(_0x43e7('0x6'));var BPromise=require(_0x43e7('0x7'));var util=require(_0x43e7('0x8'));var moment=require(_0x43e7('0x9'));var validateJwt=expressJwt({'secret':config['secrets'][_0x43e7('0xa')]});var userAttributes=['id',_0x43e7('0xb'),_0x43e7('0xc'),_0x43e7('0xd'),_0x43e7('0xe'),'email',_0x43e7('0xf'),'permissions','md5secret',_0x43e7('0x10'),_0x43e7('0x11'),'mailPause',_0x43e7('0x12'),'smsPause',_0x43e7('0x13'),_0x43e7('0x14'),'showWebBar',_0x43e7('0x15'),_0x43e7('0x16'),_0x43e7('0x17'),_0x43e7('0x18'),'passwordResetAt','alias',_0x43e7('0x19'),_0x43e7('0x1a'),_0x43e7('0x1b'),'phoneBarEnableRecording','phoneBarEnableDtmfTone',_0x43e7('0x1c'),_0x43e7('0x1d'),_0x43e7('0x1e'),_0x43e7('0x1f'),'phoneBarRemoteControlPort','hotdesk',_0x43e7('0x20'),_0x43e7('0x21'),_0x43e7('0x22'),'settingsEnabled','wssPort',_0x43e7('0x23'),_0x43e7('0x24'),_0x43e7('0x25'),_0x43e7('0x26'),_0x43e7('0x27'),_0x43e7('0x28'),_0x43e7('0x29'),_0x43e7('0x2a'),_0x43e7('0x2b'),_0x43e7('0x2c'),_0x43e7('0x2d'),_0x43e7('0x2e'),'openchannelAutoanswerDelay',_0x43e7('0x2f'),_0x43e7('0x30'),'whatsappAutoanswer',_0x43e7('0x31')];exports[_0x43e7('0x32')]=function(){return this[_0x43e7('0x33')](!![])[_0x43e7('0x34')](function(_0x4077fb,_0x2f4cb4,_0x54a9e7){if(_0x4077fb[_0x43e7('0x35')]){_0x54a9e7();}else{return db['ChatInteraction']['findOne']({'where':{'id':_0x4077fb[_0x43e7('0x36')]['id']},'attributes':['id',_0x43e7('0x37'),'disposition'],'raw':!![]})[_0x43e7('0x38')](function(_0x4ca5cf){if(_0x4ca5cf&&_0x4ca5cf[_0x43e7('0x37')]){return _0x2f4cb4['status'](_0x4ca5cf[_0x43e7('0x39')]===_0x43e7('0x3a')?0x195:0x193)[_0x43e7('0x3b')]({'message':_0x4ca5cf[_0x43e7('0x39')]==='unmanaged'?'Unmanaged.':_0x43e7('0x3c')});}else{_0x54a9e7();}})['catch'](function(_0x2dd5f){_0x54a9e7(_0x2dd5f);});}});};exports[_0x43e7('0x33')]=function isAuthenticated(_0x3565cf){return compose()[_0x43e7('0x34')](function(_0x5087d7,_0x33a1a5,_0x4690a6){var _0x45b675;if(_0x5087d7[_0x43e7('0x3d')][_0x43e7('0x3e')]){if(_[_0x43e7('0x3f')](_0x5087d7[_0x43e7('0x3d')][_0x43e7('0x3e')],_0x43e7('0x40'))){var _0x35dbcd=basicAuth(_0x5087d7);db[_0x43e7('0x41')][_0x43e7('0x42')]({'where':{'name':_0x35dbcd[_0x43e7('0xd')]}})[_0x43e7('0x38')](function(_0x4bdb17){if(!_0x4bdb17||!_0x4bdb17[_0x43e7('0x43')](_0x35dbcd[_0x43e7('0x44')])){return _0x33a1a5[_0x43e7('0x45')](0x191)[_0x43e7('0x3b')]({'message':_0x43e7('0x46')});}_0x5087d7['user']={'id':_0x4bdb17['id']};_0x4690a6();})[_0x43e7('0x47')](function(_0x49b83d){_0x4690a6(_0x49b83d);});}else if(_[_0x43e7('0x3f')](_0x5087d7[_0x43e7('0x3d')]['authorization'],'Bearer')){validateJwt(_0x5087d7,_0x33a1a5,_0x4690a6);}else{if(_0x3565cf){_0x4690a6();}else{return _0x33a1a5['status'](0x193)[_0x43e7('0x3b')]({'message':_0x43e7('0x48')});}}}else if(_0x5087d7[_0x43e7('0x49')][_0x43e7('0x4a')]){try{var _0x108313={'audience':hardwareConf[_0x43e7('0x4b')](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x5087d7['query']['apikey'],_0x108313)['then'](function(_0x4e8e86){return db['User']['find']({'where':{'id':_0x4e8e86[_0x43e7('0x4c')]}})['then'](function(_0x2b4bfd){_0x45b675=_0x2b4bfd;return db[_0x43e7('0x4d')][_0x43e7('0x4e')]({'where':{'id':0x1},'attributes':[_0x43e7('0x4f'),_0x43e7('0x50')],'raw':!![]});})[_0x43e7('0x38')](function(_0x101d45){if(!_0x45b675||!_['isEqual'](_0x45b675['apiKeyNonce'],_0x4e8e86['nonce'])){return _0x33a1a5[_0x43e7('0x45')](0x191)[_0x43e7('0x3b')]({'message':_0x43e7('0x51')});}if(_0x45b675[_0x43e7('0x52')]){return _0x33a1a5[_0x43e7('0x45')](0x191)[_0x43e7('0x3b')]({'message':_0x43e7('0x53')});}if(_0x45b675[_0x43e7('0x54')]){if(_0x101d45['blockDuration']>0x0){if(moment(_0x45b675[_0x43e7('0x55')])[_0x43e7('0x56')](_0x101d45['blockDuration'],_0x43e7('0x57'))>moment()){return _0x33a1a5['status'](0x191)[_0x43e7('0x3b')]({'message':_0x43e7('0x53')});}}else{return _0x33a1a5[_0x43e7('0x45')](0x191)[_0x43e7('0x3b')]({'message':_0x43e7('0x53')});}}_0x5087d7[_0x43e7('0x35')]={'id':_0x45b675['id']};_0x4690a6();});})['catch'](function(){return _0x33a1a5['status'](0x191)[_0x43e7('0x3b')]({'message':_0x43e7('0x53')});});}catch(_0x44b6ae){_0x4690a6(_0x44b6ae);}}else if(_0x3565cf){_0x4690a6();}else{return _0x33a1a5[_0x43e7('0x45')](0x193)[_0x43e7('0x3b')]({'message':'Unknown\x20authorization\x20format'});}})[_0x43e7('0x34')](function(_0x4227c4,_0x575439,_0x3628e0){if(_0x4227c4['user']){db[_0x43e7('0x41')]['find']({'where':{'id':_0x4227c4[_0x43e7('0x35')]['id']},'attributes':userAttributes})[_0x43e7('0x38')](function(_0x3a5807){if(!_0x3a5807){return _0x575439[_0x43e7('0x45')](0x194)['json']({'message':'User\x20not\x20found.'});}_0x4227c4[_0x43e7('0x35')]=_0x3a5807;_0x3628e0();})[_0x43e7('0x47')](function(_0xe979b5){_0x3628e0(_0xe979b5);});}else if(_0x3565cf){_0x3628e0();}else{return _0x575439[_0x43e7('0x45')](0x194)['json']({'message':'User\x20object\x20not\x20found.'});}});};exports['canUpdate']=function canUpdate(){return compose()[_0x43e7('0x34')](function(_0x57f5d0,_0x2ab022,_0x4b3a59){return licenseUtil['getLicense']()[_0x43e7('0x38')](function(_0x5ee1c5){if(_0x5ee1c5[_0x43e7('0x58')]){_0x4b3a59();}else{return _0x2ab022[_0x43e7('0x45')](0x193)[_0x43e7('0x3b')]({'message':_0x43e7('0x59')});}})['catch'](function(_0x91f1e4){_0x4b3a59(_0x91f1e4);});});};exports[_0x43e7('0x5a')]=function isWebrtcLicence(){return compose()[_0x43e7('0x34')](function(_0x1fd277,_0x296dc8,_0x1efe59){return licenseUtil['getLicense']()['then'](function(_0x3bc9de){if(_0x3bc9de[_0x43e7('0x5b')]){_0x1efe59();}else{return _0x296dc8[_0x43e7('0x45')](0x193)['json']({'message':'Forbidden'});}})['catch'](function(_0x292ded){_0x1efe59(_0x292ded);});});};exports[_0x43e7('0x5c')]=function(_0x52b098,_0x351ca2,_0x47686e){_0x52b098[_0x43e7('0x5c')]=!![];return _0x47686e();};exports['signToken']=function signToken(_0x593155){return signJwt(_0x593155);};exports['setTokenCookie']=function(_0x4de644,_0x214e7e){if(!_0x4de644[_0x43e7('0x35')]){return _0x214e7e['status'](0x194)[_0x43e7('0x3b')]({'message':_0x43e7('0x5d')});}var _0x426bcb={'payload':{'id':_0x4de644[_0x43e7('0x35')]['id'],'role':_0x4de644['user'][_0x43e7('0xb')]},'options':{'expiresIn':0x15180}};return signJwt(_0x426bcb)['then'](function(_0x4bebd4){_0x214e7e[_0x43e7('0x5e')](_0x43e7('0x5f'),_0x4bebd4);_0x214e7e[_0x43e7('0x60')](_0x43e7('0x61'));})[_0x43e7('0x47')](function(_0x2351cf){return _0x214e7e[_0x43e7('0x45')](0x1f4)[_0x43e7('0x62')](_0x2351cf);});};exports[_0x43e7('0x63')]=function(_0x2b5515){if(_['isNil'](_0x2b5515[_0x43e7('0x64')])||_[_0x43e7('0x65')](_0x2b5515['apiKeyIat'])){return null;}else{return createJwt(_0x2b5515);}};exports[_0x43e7('0x66')]=function(_0x4e6f6d){_0x4e6f6d[_0x43e7('0x64')]=generateNonce();_0x4e6f6d[_0x43e7('0x67')]=generateIssuedAt();return createJwt(_0x4e6f6d);};exports[_0x43e7('0x68')]=function(_0x1f561f,_0xfe13fa){var _0x5e5556=_0x1f561f['query'][_0x43e7('0x4a')];if(_0x5e5556){var _0x2ab7ee={'nonce':_0xfe13fa[_0x43e7('0x64')],'iat':_0xfe13fa[_0x43e7('0x67')],'audience':hardwareConf[_0x43e7('0x4b')](),'issuer':hardwareConf[_0x43e7('0x4b')]()};return verifyJwt(_0x5e5556,_0x2ab7ee)[_0x43e7('0x38')](function(){return generateApiKey(_0xfe13fa);});}else{throw{'message':_0x43e7('0x69')};}};exports[_0x43e7('0x6a')]=function(_0x24e758){var _0x312306=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x312306['test'](_0x24e758))throw new db[(_0x43e7('0x6b'))][(_0x43e7('0x6c'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');return;};exports[_0x43e7('0x6d')]=function(_0x220bf2,_0x2d0052,_0x558d54){var _0x5d63c6=encryptor[_0x43e7('0x6e')](_0x2d0052)[_0x43e7('0x6f')](',');for(var _0x4ebdde=0x0;_0x4ebdde<_0x558d54;_0x4ebdde++){if(!_0x5d63c6[_0x4ebdde])break;if(_0x220bf2[_0x43e7('0x70')]()===_0x5d63c6[_0x4ebdde]['toLowerCase']()){var _0x49a6ce=util[_0x43e7('0x71')](_0x43e7('0x72'),_0x558d54);if(_0x558d54===0x1){_0x49a6ce=_0x43e7('0x73');}throw new db[(_0x43e7('0x6b'))][(_0x43e7('0x6c'))](_0x49a6ce);}}return;};exports['updatePasswordsHistory']=function(_0xc3976,_0xdb9fbe){var _0x4d89bd=_0xdb9fbe?encryptor[_0x43e7('0x6e')](_0xdb9fbe)[_0x43e7('0x6f')](','):[];if(_0x4d89bd[_0x43e7('0x74')]===0x5){_0x4d89bd['splice'](-0x1,0x1);}_0x4d89bd['unshift'](_0xc3976);return encryptor['encryptString'](_0x4d89bd[_0x43e7('0x75')](','));};function signJwt(_0x4058ce){var _0x323cf7=BPromise[_0x43e7('0x76')](jwt['sign'],{'context':jwt});var _0x5a50fc=_0x4058ce[_0x43e7('0x77')]||config[_0x43e7('0x78')][_0x43e7('0xa')];return new BPromise(function(_0x5dd349,_0x5ea0db){_0x323cf7(_0x4058ce[_0x43e7('0x79')],_0x5a50fc,_0x4058ce[_0x43e7('0x7a')])[_0x43e7('0x38')](function(_0x2a194d){_0x5dd349(_0x2a194d);})[_0x43e7('0x47')](function(_0xd41e79){_0x5ea0db(_0xd41e79);});});}function verifyJwt(_0x4665db,_0x46748f,_0x406155){var _0x381208=BPromise[_0x43e7('0x76')](jwt['verify'],{'context':jwt});var _0x5f3824=_0x406155||config[_0x43e7('0x78')]['session'];return new BPromise(function(_0x501616,_0x50edb2){_0x381208(_0x4665db,_0x5f3824,_0x46748f)[_0x43e7('0x38')](function(_0xe666b0){_0x501616(_0xe666b0);})['catch'](function(_0xfe5a8d){_0x50edb2(_0xfe5a8d);});});}function generateNonce(){return crypto[_0x43e7('0x7b')](0x10)[_0x43e7('0x7c')]('hex');}function generateIssuedAt(){return Math[_0x43e7('0x7d')](Date[_0x43e7('0x7e')]()/0x3e8)[_0x43e7('0x7c')]();}function createJwt(_0xc9723){var _0x2f43d7={'payload':{'iat':_0xc9723[_0x43e7('0x67')],'nonce':_0xc9723[_0x43e7('0x64')]},'options':{'algorithm':'HS512','subject':_0xc9723['id'][_0x43e7('0x7c')](),'issuer':hardwareConf[_0x43e7('0x4b')](),'audience':hardwareConf[_0x43e7('0x4b')]()}};return signJwt(_0x2f43d7)['then'](function(_0x56b06d){return{'iat':_0xc9723[_0x43e7('0x67')],'nonce':_0xc9723['apiKeyNonce'],'token':_0x56b06d};});} \ No newline at end of file +var _0x4b84=['User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','Forbidden','isWebrtcLicence','webrtc','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','role','cookie','motion.token','redirect','/dashboards/general','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','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.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','Sequelize','ValidationError','updatePasswordsHistory','length','splice','unshift','encryptString','join','promisify','secret','secrets','payload','randomBytes','hex','now','toString','HS512','../../mysqldb','../../config/environment','../encryptor','express-jwt','composable-middleware','basic-auth','moment','session','fullname','email','userpic','permissions','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','lastLoginAt','lastPauseAt','allowmessenger','alias','phoneBarAutoAnswer','phoneBarDnd','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','userProfileId','settingsEnabled','wssPort','downloadOmnichannelInteractions','downloadAttachments','selectRecallMeCampaign','chatAutoanswer','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer','whatsappAutoanswerDelay','isChatInteractionAuthorized','isAuthenticated','user','ChatInteraction','params','disposition','then','closed','status','unmanaged','Forbidden.','catch','use','headers','authorization','Basic','User','find','name','authenticate','pass','json','startsWith','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','Setting','findOne','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','blocked','blockedAt','add','minutes','Invalid\x20API\x20access\x20key'];(function(_0xec401f,_0x4c06b9){var _0x414bb2=function(_0x5c3858){while(--_0x5c3858){_0xec401f['push'](_0xec401f['shift']());}};_0x414bb2(++_0x4c06b9);}(_0x4b84,0x1cc));var _0x44b8=function(_0x650e11,_0x284f86){_0x650e11=_0x650e11-0x0;var _0x1a9b47=_0x4b84[_0x650e11];return _0x1a9b47;};'use strict';var db=require(_0x44b8('0x0'))['db'];var config=require(_0x44b8('0x1'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require('../../config/license/util');var encryptor=require(_0x44b8('0x2'));var _=require('lodash');var jwt=require('jsonwebtoken');var expressJwt=require(_0x44b8('0x3'));var compose=require(_0x44b8('0x4'));var basicAuth=require(_0x44b8('0x5'));var crypto=require('crypto');var BPromise=require('bluebird');var util=require('util');var moment=require(_0x44b8('0x6'));var validateJwt=expressJwt({'secret':config['secrets'][_0x44b8('0x7')]});var userAttributes=['id','role',_0x44b8('0x8'),'name','internal',_0x44b8('0x9'),_0x44b8('0xa'),_0x44b8('0xb'),'md5secret',_0x44b8('0xc'),_0x44b8('0xd'),_0x44b8('0xe'),_0x44b8('0xf'),_0x44b8('0x10'),_0x44b8('0x11'),_0x44b8('0x12'),'showWebBar',_0x44b8('0x13'),_0x44b8('0x14'),'crudPermissions',_0x44b8('0x15'),'passwordResetAt',_0x44b8('0x16'),_0x44b8('0x17'),'phoneBarAutoAnswerDelay',_0x44b8('0x18'),'phoneBarEnableRecording','phoneBarEnableDtmfTone',_0x44b8('0x19'),_0x44b8('0x1a'),_0x44b8('0x1b'),_0x44b8('0x1c'),'phoneBarRemoteControlPort','hotdesk','interface',_0x44b8('0x1d'),'privacyEnabled',_0x44b8('0x1e'),_0x44b8('0x1f'),'downloadVoiceRecordings',_0x44b8('0x20'),_0x44b8('0x21'),'ignorePauseForPreviewCalls',_0x44b8('0x22'),_0x44b8('0x23'),'chatAutoanswerDelay',_0x44b8('0x24'),_0x44b8('0x25'),_0x44b8('0x26'),_0x44b8('0x27'),_0x44b8('0x28'),_0x44b8('0x29'),_0x44b8('0x2a'),_0x44b8('0x2b'),_0x44b8('0x2c'),_0x44b8('0x2d')];exports[_0x44b8('0x2e')]=function(){return this[_0x44b8('0x2f')](!![])['use'](function(_0x56549a,_0x3a8aa4,_0x416b34){if(_0x56549a[_0x44b8('0x30')]){_0x416b34();}else{return db[_0x44b8('0x31')]['findOne']({'where':{'id':_0x56549a[_0x44b8('0x32')]['id']},'attributes':['id','closed',_0x44b8('0x33')],'raw':!![]})[_0x44b8('0x34')](function(_0x25a0c1){if(_0x25a0c1&&_0x25a0c1[_0x44b8('0x35')]){return _0x3a8aa4[_0x44b8('0x36')](_0x25a0c1['disposition']===_0x44b8('0x37')?0x195:0x193)['json']({'message':_0x25a0c1[_0x44b8('0x33')]===_0x44b8('0x37')?'Unmanaged.':_0x44b8('0x38')});}else{_0x416b34();}})[_0x44b8('0x39')](function(_0x2656d7){_0x416b34(_0x2656d7);});}});};exports['isAuthenticated']=function isAuthenticated(_0xb22107){return compose()[_0x44b8('0x3a')](function(_0x53d9c7,_0x2e0174,_0x4a182d){var _0xfb0028;if(_0x53d9c7['headers']['authorization']){if(_['startsWith'](_0x53d9c7[_0x44b8('0x3b')][_0x44b8('0x3c')],_0x44b8('0x3d'))){var _0x1bd1be=basicAuth(_0x53d9c7);db[_0x44b8('0x3e')][_0x44b8('0x3f')]({'where':{'name':_0x1bd1be[_0x44b8('0x40')]}})[_0x44b8('0x34')](function(_0xd1d320){if(!_0xd1d320||!_0xd1d320[_0x44b8('0x41')](_0x1bd1be[_0x44b8('0x42')])){return _0x2e0174[_0x44b8('0x36')](0x191)[_0x44b8('0x43')]({'message':'Wrong\x20credentials.'});}_0x53d9c7[_0x44b8('0x30')]={'id':_0xd1d320['id']};_0x4a182d();})['catch'](function(_0x212983){_0x4a182d(_0x212983);});}else if(_[_0x44b8('0x44')](_0x53d9c7[_0x44b8('0x3b')][_0x44b8('0x3c')],_0x44b8('0x45'))){validateJwt(_0x53d9c7,_0x2e0174,_0x4a182d);}else{if(_0xb22107){_0x4a182d();}else{return _0x2e0174['status'](0x193)[_0x44b8('0x43')]({'message':_0x44b8('0x46')});}}}else if(_0x53d9c7[_0x44b8('0x47')][_0x44b8('0x48')]){try{var _0x46b008={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x44b8('0x49')]()};verifyJwt(_0x53d9c7[_0x44b8('0x47')][_0x44b8('0x48')],_0x46b008)[_0x44b8('0x34')](function(_0x140a79){return db[_0x44b8('0x3e')][_0x44b8('0x3f')]({'where':{'id':_0x140a79[_0x44b8('0x4a')]}})[_0x44b8('0x34')](function(_0x181761){_0xfb0028=_0x181761;return db[_0x44b8('0x4b')][_0x44b8('0x4c')]({'where':{'id':0x1},'attributes':[_0x44b8('0x4d'),_0x44b8('0x4e')],'raw':!![]});})[_0x44b8('0x34')](function(_0x1becb0){if(!_0xfb0028||!_[_0x44b8('0x4f')](_0xfb0028[_0x44b8('0x50')],_0x140a79[_0x44b8('0x51')])){return _0x2e0174[_0x44b8('0x36')](0x191)[_0x44b8('0x43')]({'message':_0x44b8('0x52')});}if(_0xfb0028['disabled']){return _0x2e0174[_0x44b8('0x36')](0x191)[_0x44b8('0x43')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0xfb0028[_0x44b8('0x53')]){if(_0x1becb0[_0x44b8('0x4e')]>0x0){if(moment(_0xfb0028[_0x44b8('0x54')])[_0x44b8('0x55')](_0x1becb0['blockDuration'],_0x44b8('0x56'))>moment()){return _0x2e0174[_0x44b8('0x36')](0x191)[_0x44b8('0x43')]({'message':_0x44b8('0x57')});}}else{return _0x2e0174[_0x44b8('0x36')](0x191)[_0x44b8('0x43')]({'message':_0x44b8('0x57')});}}_0x53d9c7[_0x44b8('0x30')]={'id':_0xfb0028['id']};_0x4a182d();});})[_0x44b8('0x39')](function(){return _0x2e0174[_0x44b8('0x36')](0x191)[_0x44b8('0x43')]({'message':_0x44b8('0x57')});});}catch(_0xd69398){_0x4a182d(_0xd69398);}}else if(_0xb22107){_0x4a182d();}else{return _0x2e0174[_0x44b8('0x36')](0x193)[_0x44b8('0x43')]({'message':_0x44b8('0x46')});}})['use'](function(_0x12a0a4,_0x43e43a,_0xbf444f){if(_0x12a0a4['user']){db[_0x44b8('0x3e')][_0x44b8('0x3f')]({'where':{'id':_0x12a0a4[_0x44b8('0x30')]['id']},'attributes':userAttributes})['then'](function(_0xbad4bb){if(!_0xbad4bb){return _0x43e43a[_0x44b8('0x36')](0x194)[_0x44b8('0x43')]({'message':_0x44b8('0x58')});}_0x12a0a4[_0x44b8('0x30')]=_0xbad4bb;_0xbf444f();})['catch'](function(_0x5ae5f9){_0xbf444f(_0x5ae5f9);});}else if(_0xb22107){_0xbf444f();}else{return _0x43e43a[_0x44b8('0x36')](0x194)[_0x44b8('0x43')]({'message':_0x44b8('0x59')});}});};exports[_0x44b8('0x5a')]=function canUpdate(){return compose()[_0x44b8('0x3a')](function(_0x26e1f1,_0x3fc41b,_0x457348){return licenseUtil[_0x44b8('0x5b')]()[_0x44b8('0x34')](function(_0x197782){if(_0x197782[_0x44b8('0x5c')]){_0x457348();}else{return _0x3fc41b[_0x44b8('0x36')](0x193)[_0x44b8('0x43')]({'message':_0x44b8('0x5d')});}})[_0x44b8('0x39')](function(_0xce06dc){_0x457348(_0xce06dc);});});};exports[_0x44b8('0x5e')]=function isWebrtcLicence(){return compose()[_0x44b8('0x3a')](function(_0x49c507,_0x547dc1,_0x3b1b12){return licenseUtil[_0x44b8('0x5b')]()[_0x44b8('0x34')](function(_0x269284){if(_0x269284[_0x44b8('0x5f')]){_0x3b1b12();}else{return _0x547dc1[_0x44b8('0x36')](0x193)[_0x44b8('0x43')]({'message':'Forbidden'});}})[_0x44b8('0x39')](function(_0x53edca){_0x3b1b12(_0x53edca);});});};exports[_0x44b8('0x60')]=function(_0x3ef886,_0x1dbc28,_0x9207bf){_0x3ef886[_0x44b8('0x60')]=!![];return _0x9207bf();};exports[_0x44b8('0x61')]=function signToken(_0x491600){return signJwt(_0x491600);};exports[_0x44b8('0x62')]=function(_0xff92fb,_0x10602c){if(!_0xff92fb[_0x44b8('0x30')]){return _0x10602c['status'](0x194)[_0x44b8('0x43')]({'message':_0x44b8('0x63')});}var _0x36afa9={'payload':{'id':_0xff92fb[_0x44b8('0x30')]['id'],'role':_0xff92fb[_0x44b8('0x30')][_0x44b8('0x64')]},'options':{'expiresIn':0x15180}};return signJwt(_0x36afa9)['then'](function(_0x19d95d){_0x10602c[_0x44b8('0x65')](_0x44b8('0x66'),_0x19d95d);_0x10602c[_0x44b8('0x67')](_0x44b8('0x68'));})['catch'](function(_0x493840){return _0x10602c[_0x44b8('0x36')](0x1f4)['send'](_0x493840);});};exports[_0x44b8('0x69')]=function(_0x5785ef){if(_[_0x44b8('0x6a')](_0x5785ef[_0x44b8('0x50')])||_[_0x44b8('0x6a')](_0x5785ef[_0x44b8('0x6b')])){return null;}else{return createJwt(_0x5785ef);}};exports[_0x44b8('0x6c')]=function(_0x32f588){_0x32f588[_0x44b8('0x50')]=generateNonce();_0x32f588['apiKeyIat']=generateIssuedAt();return createJwt(_0x32f588);};exports[_0x44b8('0x6d')]=function(_0x37b2c2,_0x1e6a5e){var _0x492be6=_0x37b2c2[_0x44b8('0x47')][_0x44b8('0x48')];if(_0x492be6){var _0x45f9a0={'nonce':_0x1e6a5e[_0x44b8('0x50')],'iat':_0x1e6a5e['apiKeyIat'],'audience':hardwareConf[_0x44b8('0x49')](),'issuer':hardwareConf[_0x44b8('0x49')]()};return verifyJwt(_0x492be6,_0x45f9a0)['then'](function(){return generateApiKey(_0x1e6a5e);});}else{throw{'message':_0x44b8('0x6e')};}};exports[_0x44b8('0x6f')]=function(_0x35136e){var _0x3df6aa=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x3df6aa[_0x44b8('0x70')](_0x35136e))throw new db['Sequelize']['ValidationError'](_0x44b8('0x71'));return;};exports[_0x44b8('0x72')]=function(_0xa30834,_0x4358aa,_0x765e45){var _0x3f6b92=encryptor[_0x44b8('0x73')](_0x4358aa)[_0x44b8('0x74')](',');for(var _0x10bbd9=0x0;_0x10bbd9<_0x765e45;_0x10bbd9++){if(!_0x3f6b92[_0x10bbd9])break;if(_0xa30834[_0x44b8('0x75')]()===_0x3f6b92[_0x10bbd9][_0x44b8('0x75')]()){var _0x3f7576=util['format'](_0x44b8('0x76'),_0x765e45);if(_0x765e45===0x1){_0x3f7576=_0x44b8('0x77');}throw new db[(_0x44b8('0x78'))][(_0x44b8('0x79'))](_0x3f7576);}}return;};exports[_0x44b8('0x7a')]=function(_0x1df915,_0x426a6a){var _0x172ff3=_0x426a6a?encryptor[_0x44b8('0x73')](_0x426a6a)[_0x44b8('0x74')](','):[];if(_0x172ff3[_0x44b8('0x7b')]===0x5){_0x172ff3[_0x44b8('0x7c')](-0x1,0x1);}_0x172ff3[_0x44b8('0x7d')](_0x1df915);return encryptor[_0x44b8('0x7e')](_0x172ff3[_0x44b8('0x7f')](','));};function signJwt(_0x293c2e){var _0x25f91c=BPromise[_0x44b8('0x80')](jwt['sign'],{'context':jwt});var _0x1ec516=_0x293c2e[_0x44b8('0x81')]||config[_0x44b8('0x82')][_0x44b8('0x7')];return new BPromise(function(_0x51f763,_0x29ed5d){_0x25f91c(_0x293c2e[_0x44b8('0x83')],_0x1ec516,_0x293c2e['options'])[_0x44b8('0x34')](function(_0xc4d667){_0x51f763(_0xc4d667);})['catch'](function(_0x2a95f6){_0x29ed5d(_0x2a95f6);});});}function verifyJwt(_0x3354bd,_0x520929,_0x37e42e){var _0x454fe6=BPromise[_0x44b8('0x80')](jwt['verify'],{'context':jwt});var _0x16e790=_0x37e42e||config['secrets'][_0x44b8('0x7')];return new BPromise(function(_0x5161ea,_0x176536){_0x454fe6(_0x3354bd,_0x16e790,_0x520929)[_0x44b8('0x34')](function(_0xf4d81f){_0x5161ea(_0xf4d81f);})[_0x44b8('0x39')](function(_0x3c6aad){_0x176536(_0x3c6aad);});});}function generateNonce(){return crypto[_0x44b8('0x84')](0x10)['toString'](_0x44b8('0x85'));}function generateIssuedAt(){return Math['floor'](Date[_0x44b8('0x86')]()/0x3e8)[_0x44b8('0x87')]();}function createJwt(_0x4c1a7c){var _0x3f9438={'payload':{'iat':_0x4c1a7c[_0x44b8('0x6b')],'nonce':_0x4c1a7c[_0x44b8('0x50')]},'options':{'algorithm':_0x44b8('0x88'),'subject':_0x4c1a7c['id'][_0x44b8('0x87')](),'issuer':hardwareConf[_0x44b8('0x49')](),'audience':hardwareConf[_0x44b8('0x49')]()}};return signJwt(_0x3f9438)[_0x44b8('0x34')](function(_0x3f9102){return{'iat':_0x4c1a7c[_0x44b8('0x6b')],'nonce':_0x4c1a7c[_0x44b8('0x50')],'token':_0x3f9102};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js new file mode 100644 index 0000000..41a88c2 --- /dev/null +++ b/server/components/contacts/index.js @@ -0,0 +1,18 @@ +// ************************************************************************* +// * * +// * xCALLY Motion - The Omnichannel Contact Center * +// * Copyright (c) Xenialab s.r.l. All Rights Reserved * +// * * +// ************************************************************************* +// * * +// * Email: info@xcally.com * +// * Website: https://www.xcally.com * +// * * +// ************************************************************************* +// * * +// * The SOFTWARE PRODUCT is protected by copyright laws and international * +// * copyright treaties, as well as other intellectual property laws and * +// * treaties. The SOFTWARE PRODUCT is licensed, not sold. * +// * * +// ************************************************************************* +var _0xaf6e=['user','clause','tags','checkListsRestrictions','skip','tag','countFilteredContacts','count','length','buildContactsQuery','getFilteredContacts','catch','describe','CmContact','startsWith','cf_','map','CmCustomField','findOne','slice','type','keys','./sql-utils','findAll','skipContactsQuery','resolve','getContactsSubquery','then','search','parseAdvancedSearchFilter','parseQueryParameters','default','fields','filter','where'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xaf6e,0xe8));var _0xeaf6=function(_0x335171,_0x1fd6c4){_0x335171=_0x335171-0x0;var _0xa20da9=_0xaf6e[_0x335171];return _0xa20da9;};'use strict';var _=require('lodash');var sqlUtils=require(_0xeaf6('0x0'));var db=require('../../mysqldb')['db'];exports[_0xeaf6('0x1')]=function(_0x37878e,_0x6d8876,_0x4c5c2d,_0x580c6f){var _0x5e8430={'count':0x0,'rows':[]};var _0x353b75=sqlUtils[_0xeaf6('0x2')](_0x6d8876,_0x37878e);if(_0x353b75){return Promise[_0xeaf6('0x3')](_0x5e8430);}var _0x31d764=sqlUtils[_0xeaf6('0x4')]();var _0x476942={};var _0x1ff441=![];return Promise['resolve']()[_0xeaf6('0x5')](function(){if(_0x37878e[_0xeaf6('0x6')]){return sqlUtils[_0xeaf6('0x7')](_0x37878e[_0xeaf6('0x6')],_0x580c6f);}else{return sqlUtils[_0xeaf6('0x8')](_0x37878e,_0x580c6f);}})[_0xeaf6('0x5')](function(_0x436120){_0x31d764['where'](_0x436120[_0xeaf6('0x9')]);_0x31d764['where'](_0x436120[_0xeaf6('0xa')]);_0x31d764['where'](_0x436120[_0xeaf6('0xb')]);_0x31d764[_0xeaf6('0xc')](_0x436120[_0xeaf6('0xd')][_0xeaf6('0xe')]);_0x476942=_0x436120[_0xeaf6('0xf')];return sqlUtils[_0xeaf6('0x10')](_0x6d8876,_0x37878e,_0x436120[_0xeaf6('0xd')][_0xeaf6('0x11')]);})[_0xeaf6('0x5')](function(_0x47b4b8){_0x31d764['where'](_0x47b4b8);var _0x15bb53=_0x37878e[_0xeaf6('0x6')]?_0x476942['ids']:_0x37878e[_0xeaf6('0x12')];_0x1ff441=_0x15bb53?!![]:![];return sqlUtils[_0xeaf6('0x13')](_0x31d764,_0x15bb53);})['then'](function(_0x2eef8e){_0x5e8430[_0xeaf6('0x14')]=_0x2eef8e[_0xeaf6('0x15')];if(_0x5e8430[_0xeaf6('0x14')]===0x0){return[];}return sqlUtils[_0xeaf6('0x16')](_0x31d764,_0x37878e[_0xeaf6('0xa')],_0x4c5c2d,_0x1ff441,_0x476942[_0xeaf6('0xe')]);})[_0xeaf6('0x5')](function(_0x1eb5fa){return sqlUtils[_0xeaf6('0x17')](_0x1eb5fa,_0x37878e,_0x4c5c2d);})[_0xeaf6('0x5')](function(_0x52c782){_0x5e8430['rows']=_0x52c782;return _0x5e8430;})[_0xeaf6('0x18')](function(_0x495769){throw _0x495769;});};exports[_0xeaf6('0x19')]=function(){var _0x3a48d2={};var _0x5cedd4=[];return db[_0xeaf6('0x1a')][_0xeaf6('0x19')]()['then'](function(_0x3dc3b8){_0x3a48d2=_0x3dc3b8;var _0x3fe431=Object['keys'](_0x3a48d2)['filter'](function(_0x3d5ecc){return _[_0xeaf6('0x1b')](_0x3d5ecc,_0xeaf6('0x1c'))?_0x3d5ecc:undefined;});var _0x23d78f=_0x3fe431[_0xeaf6('0x1d')](function(_0x510e21){return db[_0xeaf6('0x1e')][_0xeaf6('0x1f')]({'where':{'id':_0x510e21[_0xeaf6('0x20')](0x3)},'raw':!![]});});return Promise['all'](_0x23d78f);})['then'](function(_0x337ff5){for(var _0x140e9a=0x0;_0x140e9a<_0x337ff5[_0xeaf6('0x15')];_0x140e9a++){if(_0x337ff5[_0x140e9a]){var _0x473e21=_0xeaf6('0x1c')+_0x337ff5[_0x140e9a]['id'];_0x3a48d2[_0x473e21]['fieldType']=_0x337ff5[_0x140e9a][_0xeaf6('0x21')];}}_0x5cedd4=_[_0xeaf6('0x1d')](Object[_0xeaf6('0x22')](_0x3a48d2),function(_0x361883){return{'name':_0x361883,'type':_0x3a48d2[_0x361883]['type']};});return _0x5cedd4;})[_0xeaf6('0x18')](function(_0x2507b7){throw _0x2507b7;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js new file mode 100644 index 0000000..6110ca0 --- /dev/null +++ b/server/components/contacts/sql-utils.js @@ -0,0 +1,18 @@ +// ************************************************************************* +// * * +// * xCALLY Motion - The Omnichannel Contact Center * +// * Copyright (c) Xenialab s.r.l. All Rights Reserved * +// * * +// ************************************************************************* +// * * +// * Email: info@xcally.com * +// * Website: https://www.xcally.com * +// * * +// ************************************************************************* +// * * +// * The SOFTWARE PRODUCT is protected by copyright laws and international * +// * copyright treaties, as well as other intellectual property laws and * +// * treaties. The SOFTWARE PRODUCT is licensed, not sold. * +// * * +// ************************************************************************* +var _0xda86=['c.ListId\x20IS\x20NULL','c.ListId\x20IN\x20?','attributes','group','c.id','limit','subqry.id','order','DESC','subqry.','color','keyBy','Sequelize','QueryTypes','SELECT','CmContact','logging','sequelize','query','toString','TagIds','clone','COUNT(*)','isEmpty','t.id\x20IN\x20?','exports','lodash','squel','../parsers/advancedSearch','../interaction/utils','../../mysqldb','role','agent','search','ListId','autocomplete','true','select','from','cm_contacts','c.deletedAt\x20IS\x20NULL','subqry','left_join','cm_user_has_contacts','.id','cm_contact_has_tags','tools_tags','t.id\x20=\x20ct.TagId','firstName','lastName','phone','mobile','fax','email','CompanyId','updatedAt','forEach','GROUP_CONCAT(DISTINCT\x20t.id)','field','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','split','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','sqlOperator','conditions','find','name','dateOfBirth','fieldType','datetime','buildExpression','default','text','start','value','end','Tag','map','tags','clause','and','ids','User','uc.UserId\x20=\x20?','skip','keys','compact','push','concat','Contact','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','resolve','then','fields','tag','getLists'];(function(_0xa54e60,_0xf14b56){var _0x3a78e1=function(_0x57541e){while(--_0x57541e){_0xa54e60['push'](_0xa54e60['shift']());}};_0x3a78e1(++_0xf14b56);}(_0xda86,0x1ca));var _0x6da8=function(_0x15736d,_0x8a002f){_0x15736d=_0x15736d-0x0;var _0x288b27=_0xda86[_0x15736d];return _0x288b27;};'use strict';var _=require(_0x6da8('0x0'));var squel=require(_0x6da8('0x1'));var as=require(_0x6da8('0x2'));var qs=require('../parsers/qs');var utils=require(_0x6da8('0x3'));var db=require(_0x6da8('0x4'))['db'];function skipContactsQuery(_0x358246,_0x1af6f8){var _0xce2ea5=![];if(_0x358246[_0x6da8('0x5')]===_0x6da8('0x6')&&!_0x1af6f8[_0x6da8('0x7')]&&!_0x1af6f8[_0x6da8('0x8')]&&_0x1af6f8[_0x6da8('0x9')]!==_0x6da8('0xa')){_0xce2ea5=!![];}return _0xce2ea5;}function getContactsSubquery(){return squel[_0x6da8('0xb')]()[_0x6da8('0xc')](_0x6da8('0xd'),'c')['where'](_0x6da8('0xe'));}function applyJoinClauses(_0x1ddf5a,_0x364abf){var _0x41d1cb=_0x364abf?'c':_0x6da8('0xf');_0x1ddf5a[_0x6da8('0x10')](_0x6da8('0x11'),'uc','uc.CmContactId\x20=\x20'+_0x41d1cb+_0x6da8('0x12'))[_0x6da8('0x10')](_0x6da8('0x13'),'ct','ct.CmContactId\x20=\x20'+_0x41d1cb+_0x6da8('0x12'))[_0x6da8('0x10')](_0x6da8('0x14'),'t',_0x6da8('0x15'));return _0x1ddf5a;}function addFieldsToQuery(_0x275eab,_0x19e3c2,_0x47afa4,_0x9d3126){var _0x342c9d=_0x9d3126?'c':'subqry';if(!_0x19e3c2){_0x19e3c2=['id',_0x6da8('0x16'),_0x6da8('0x17'),_0x6da8('0x18'),_0x6da8('0x19'),_0x6da8('0x1a'),_0x6da8('0x1b'),_0x6da8('0x8'),_0x6da8('0x1c'),'createdAt',_0x6da8('0x1d'),'deletedAt','TagIds'];}var _0x5105bb=_0x47afa4&&_0x9d3126||!_0x47afa4&&!_0x9d3126;_0x19e3c2[_0x6da8('0x1e')](function(_0x57a1a4){if(_0x57a1a4==='TagIds'){if(_0x5105bb){_0x275eab['field'](_0x6da8('0x1f'),_0x57a1a4);}else if(_0x47afa4){_0x275eab[_0x6da8('0x20')](_0x342c9d+'.'+_0x57a1a4);}}else{_0x275eab[_0x6da8('0x20')](_0x342c9d+'.'+_0x57a1a4);}});return _0x275eab;}function getSqlClauses(){var _0x13012e={'default':squel[_0x6da8('0x21')](),'fields':squel[_0x6da8('0x21')](),'filter':squel[_0x6da8('0x21')](),'tags':{'clause':squel['expr'](),'ids':null},'user':{'clause':squel[_0x6da8('0x21')](),'skip':![]}};return _0x13012e;}function parseTagParameter(_0x4e9e4e){var _0x3fb40b=squel['expr']();if(_0x4e9e4e){var _0x1447b8=utils[_0x6da8('0x22')](_0x4e9e4e);_0x1447b8[_0x6da8('0x1e')](function(_0x4e4297){_0x3fb40b['or'](_0x6da8('0x23'),'%,'+_0x4e4297+',%');});}return _0x3fb40b;}function parseSearchFilter(_0x4f45f9){var _0x482c24=squel['expr']();if(_0x4f45f9){var _0x28205f=_0x4f45f9[_0x6da8('0x24')]('\x5c','\x5c\x5c')[_0x6da8('0x24')](/'/g,'\x27\x27');if(_0x28205f[_0x6da8('0x25')]('\x20')[_0x6da8('0x26')]>0x1){_0x482c24['or'](_0x6da8('0x27'),qs[_0x6da8('0x28')](_0x28205f),null);}else{if(qs[_0x6da8('0x29')](_0x28205f)){_0x482c24['or'](_0x6da8('0x2a'),_0x28205f+'%');_0x482c24['or']('c.phone\x20LIKE\x20?',_0x28205f+'%');_0x482c24['or'](_0x6da8('0x2b'),_0x28205f+'%');_0x482c24['or'](_0x6da8('0x2c'),_0x28205f+'%');}else if(qs[_0x6da8('0x2d')](_0x28205f)){_0x482c24['or'](_0x6da8('0x2e'),_0x28205f+'%');}else{_0x482c24['or'](_0x6da8('0x2f'),'%'+_0x28205f+'%');_0x482c24['or'](_0x6da8('0x30'),'%'+_0x28205f+'%');_0x482c24['or'](_0x6da8('0x2e'),'%'+_0x28205f+'%');}}}return _0x482c24;}function parseAdvancedSearchFilter(_0xe226d1,_0x2e1a89){var _0x5533ee=getSqlClauses();var _0x59b240=as['parseSearch'](_0xe226d1);var _0x59901a=_0x59b240[_0x6da8('0x31')];for(var _0x150510=0x0;_0x150510<_0x59b240[_0x6da8('0x32')]['length'];_0x150510++){var _0x433b41=_0x59b240[_0x6da8('0x32')][_0x150510];var _0x4e2d7a='c';var _0x1a80b9=_[_0x6da8('0x33')](_0x2e1a89,[_0x6da8('0x34'),_0x433b41[_0x6da8('0x20')]]);if(_0x1a80b9){if(_0x433b41[_0x6da8('0x20')]===_0x6da8('0x35')||_0x1a80b9[_0x6da8('0x36')]===_0x6da8('0x37')){_0x433b41['castTo']='DATE';}var _0x1fd6db=as[_0x6da8('0x38')](_0x4e2d7a,_0x1a80b9['type'],_0x433b41);_0x5533ee[_0x6da8('0x39')][_0x59901a](_0x1fd6db[_0x6da8('0x3a')],_0x1fd6db['value'][_0x6da8('0x3b')],_0x1fd6db[_0x6da8('0x3c')][_0x6da8('0x3d')]);}else{if(_0x433b41[_0x6da8('0x20')]===_0x6da8('0x3e')){var _0x4dd9a6=_0x433b41['value'][_0x6da8('0x25')](',')[_0x6da8('0x3f')](function(_0x1a9347){return Number(_0x1a9347);});var _0x21383d=parseTagParameter(_0x4dd9a6);_0x5533ee[_0x6da8('0x40')][_0x6da8('0x41')][_0x6da8('0x42')](_0x21383d);_0x5533ee[_0x6da8('0x40')][_0x6da8('0x43')]=_0x4dd9a6;}else if(_0x433b41['field']===_0x6da8('0x44')){_0x5533ee['user'][_0x6da8('0x41')][_0x6da8('0x42')](_0x6da8('0x45'),_0x433b41[_0x6da8('0x3c')]);_0x5533ee['user'][_0x6da8('0x46')]=!![];}}}return _0x5533ee;}function parseModelFields(_0x75b589,_0x3b799b){var _0x47ed08=squel['expr']();var _0x8a85b1=_(_0x75b589)[_0x6da8('0x47')]()[_0x6da8('0x3f')](function(_0x3a7a36){return _['some'](_0x3b799b,[_0x6da8('0x34'),_0x3a7a36])?_0x3a7a36:undefined;})[_0x6da8('0x48')]()[_0x6da8('0x3c')]();if(_0x75b589['Contact']){_0x8a85b1[_0x6da8('0x49')]('Contact');}if(_0x8a85b1['length']>0x0){_0x8a85b1[_0x6da8('0x1e')](function(_0x5d122b){if(_0x5d122b==='ListId'){_0x47ed08[_0x6da8('0x42')]('c.ListId\x20IN\x20?',[][_0x6da8('0x4a')](_0x75b589[_0x5d122b]));}else if(_0x5d122b===_0x6da8('0x4b')){var _0x43a83a='%'+_0x75b589[_0x5d122b]+'%';_0x47ed08[_0x6da8('0x42')](_0x6da8('0x4c'),_0x43a83a);}else{_0x47ed08[_0x6da8('0x42')]('c.'+_0x5d122b+'\x20=\x20?',_0x75b589[_0x5d122b]);}});}return _0x47ed08;}function parseQueryParameters(_0x297376,_0x4a8765){var _0x47774e=getSqlClauses();return Promise[_0x6da8('0x4d')]()[_0x6da8('0x4e')](function(){return parseModelFields(_0x297376,_0x4a8765);})[_0x6da8('0x4e')](function(_0x29cab2){_0x47774e[_0x6da8('0x4f')][_0x6da8('0x42')](_0x29cab2);return parseTagParameter(_0x297376[_0x6da8('0x50')]);})[_0x6da8('0x4e')](function(_0x57cc84){_0x47774e[_0x6da8('0x40')]['clause'][_0x6da8('0x42')](_0x57cc84);return parseSearchFilter(_0x297376['filter']);})[_0x6da8('0x4e')](function(_0x4ed4cc){_0x47774e['filter']=_0x4ed4cc;return _0x47774e;});}function checkListsRestrictions(_0x286372,_0xb64e0f,_0xe2fe8f){var _0x4f4bbc=squel[_0x6da8('0x21')]();return Promise[_0x6da8('0x4d')]()[_0x6da8('0x4e')](function(){if(_0xb64e0f[_0x6da8('0x7')]&&_0x286372['role']===_0x6da8('0x6')&&!_0xe2fe8f){return _0x286372[_0x6da8('0x51')]({'attributes':['id'],'raw':!![]});}})['then'](function(_0x18beac){if(_0x18beac){if(_0x18beac['length']===0x0){_0x4f4bbc[_0x6da8('0x42')](_0x6da8('0x52'));}else{_0x4f4bbc[_0x6da8('0x42')](_0x6da8('0x53'),_[_0x6da8('0x3f')](_0x18beac,'id'));}}})[_0x6da8('0x4e')](function(){return _0x4f4bbc;});}function buildContactsQuery(_0x1aa569,_0x300374,_0x2dbc31,_0x51be16,_0xf84a42){if(_0x300374){_0x300374=_0x2dbc31[_0x6da8('0x54')];}_0x1aa569=addFieldsToQuery(_0x1aa569,_0x300374,_0x51be16,!![]);var _0x19eb0a=squel[_0x6da8('0xb')]();_0x19eb0a=addFieldsToQuery(_0x19eb0a,_0x300374,_0x51be16,![]);if(_0x51be16){_0x1aa569=applyJoinClauses(_0x1aa569,!![]);_0x1aa569[_0x6da8('0x55')](_0x6da8('0x56'));if(_0x2dbc31[_0x6da8('0x57')]){_0x19eb0a['limit'](_0x2dbc31[_0x6da8('0x57')]);}}else{_0x19eb0a=applyJoinClauses(_0x19eb0a,![]);_0x19eb0a[_0x6da8('0x55')](_0x6da8('0x58'));if(_0x2dbc31[_0x6da8('0x57')]){_0x1aa569[_0x6da8('0x57')](_0x2dbc31[_0x6da8('0x57')]);}}_0x19eb0a['having'](_0xf84a42);if(_0x2dbc31[_0x6da8('0x59')]){_0x2dbc31[_0x6da8('0x59')][_0x6da8('0x1e')](function(_0x2963b7){_0x1aa569[_0x6da8('0x59')]('c.'+_0x2963b7[0x0],_0x2963b7[0x1]===_0x6da8('0x5a')?![]:!![]);_0x19eb0a[_0x6da8('0x59')](_0x6da8('0x5b')+_0x2963b7[0x0],_0x2963b7[0x1]===_0x6da8('0x5a')?![]:!![]);});}_0x19eb0a[_0x6da8('0xc')](_0x1aa569,_0x6da8('0xf'));return _0x19eb0a;}function getFilteredContacts(_0xcfa0fe){var _0x34ca87=[];return db[_0x6da8('0x3e')]['findAll']({'attributes':['id','name',_0x6da8('0x5c')],'raw':!![]})['then'](function(_0x3e346e){_0x34ca87=_[_0x6da8('0x5d')](_0x3e346e,'id');var _0x4d7920={'type':db[_0x6da8('0x5e')][_0x6da8('0x5f')][_0x6da8('0x60')],'model':db[_0x6da8('0x61')],'mapToModel':!![],'nest':!![],'raw':!![]};_0x4d7920[_0x6da8('0x62')]=!![];return db[_0x6da8('0x63')][_0x6da8('0x64')](_0xcfa0fe[_0x6da8('0x65')](),_0x4d7920);})[_0x6da8('0x4e')](function(_0x12a1d1){_0x12a1d1['forEach'](function(_0x338060){if(_0x338060[_0x6da8('0x66')]){_0x338060['Tags']=[];_0x338060[_0x6da8('0x66')][_0x6da8('0x25')](',')[_0x6da8('0x1e')](function(_0x3748d6){_0x338060['Tags'][_0x6da8('0x49')](_0x34ca87[_0x3748d6]);});}delete _0x338060[_0x6da8('0x66')];});return _0x12a1d1;});}function countFilteredContacts(_0x33a1b0,_0xa15a64){var _0x3937de=_0x33a1b0[_0x6da8('0x67')]();_0x3937de[_0x6da8('0x20')](_0x6da8('0x68'));_0x3937de=applyJoinClauses(_0x3937de,!![]);_0x33a1b0[_0x6da8('0x55')](_0x6da8('0x56'));var _0x182761=utils[_0x6da8('0x22')](_0xa15a64);if(!_[_0x6da8('0x69')](_0x182761)){_0x3937de['where'](_0x6da8('0x6a'),_0x182761);}var _0x51e945={'type':db['Sequelize']['QueryTypes'][_0x6da8('0x60')],'raw':!![]};return db[_0x6da8('0x63')][_0x6da8('0x64')](_0x3937de[_0x6da8('0x65')](),_0x51e945);}module[_0x6da8('0x6b')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 6103fa0..4388ce9 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 _0x83df=['close','createDecipher','data','update','base64','decryptString','utf8','crypto','bluebird','lodash','../../config/logger','app','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','join','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','binary','write','final','end'];(function(_0x352742,_0x5aa0d3){var _0x5c637e=function(_0x43ae4f){while(--_0x43ae4f){_0x352742['push'](_0x352742['shift']());}};_0x5c637e(++_0x5aa0d3);}(_0x83df,0x10f));var _0xf83d=function(_0x280587,_0x4e9971){_0x280587=_0x280587-0x0;var _0x3b7543=_0x83df[_0x280587];return _0x3b7543;};'use strict';var crypto=require(_0xf83d('0x0'));var fs=require('fs');var BPromise=require(_0xf83d('0x1'));var _=require(_0xf83d('0x2'));var config=require('../../config/environment');var logger=require(_0xf83d('0x3'))(_0xf83d('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xf83d('0x5')][_0xf83d('0x6')],'algorithm':_0xf83d('0x7')};const fileOptions={'algorithm':_0xf83d('0x8')};if(config[_0xf83d('0x9')]&&config['encrypt'][_0xf83d('0xa')]){var isSupported=isAlgorithmSupported(config[_0xf83d('0x9')][_0xf83d('0xa')]);if(isSupported){fileOptions[_0xf83d('0xa')]=config[_0xf83d('0x9')]['algorithm'];}else{var supportedAlgorithms=getSupportedCiphers()[_0xf83d('0xb')](',\x20');logger['error'](config[_0xf83d('0x9')][_0xf83d('0xa')],_0xf83d('0xc'),supportedAlgorithms);}}function isASupportedCipher(_0x4aa508){return AES_SUPPORTED_RX[_0xf83d('0xd')](_0x4aa508);}function getSupportedCiphers(){return crypto[_0xf83d('0xe')]()[_0xf83d('0xf')](isASupportedCipher);}function isAlgorithmSupported(_0x58b321){return getSupportedCiphers()[_0xf83d('0x10')](_0x58b321)>-0x1;}function combineOptions(_0xdfe1d6){var _0x49aac0={};for(var _0x3e0ff3 in fileOptions){if(fileOptions[_0xf83d('0x11')](_0x3e0ff3)){_0x49aac0[_0x3e0ff3]=fileOptions[_0x3e0ff3];}}if(_0xdfe1d6){for(var _0x3189ea in _0xdfe1d6){if(_0xdfe1d6[_0xf83d('0x11')](_0x3189ea)){_0x49aac0[_0x3189ea]=_0xdfe1d6[_0x3189ea];}}}return _0x49aac0;}exports[_0xf83d('0x12')]=function(_0x9aa919,_0x3ed7ed,_0x54e980,_0x327ce3){return new BPromise(function(_0x1d53af,_0x1ed670){_0x327ce3=combineOptions(_0x327ce3);var _0x1a5c4d=new Buffer(_0x54e980);var _0x57fba1=fs[_0xf83d('0x13')](_0x9aa919);var _0xce651f=fs[_0xf83d('0x14')](_0x3ed7ed);var _0x2b0b16=crypto[_0xf83d('0x15')](_0x327ce3[_0xf83d('0xa')],_0x1a5c4d);_0x57fba1['on']('data',function(_0xf435e0){var _0x29ad24=new Buffer(_0x2b0b16['update'](_0xf435e0),_0xf83d('0x16'));_0xce651f[_0xf83d('0x17')](_0x29ad24);});_0x57fba1['on']('end',function(){try{var _0x22c363=new Buffer(_0x2b0b16[_0xf83d('0x18')](_0xf83d('0x16')),_0xf83d('0x16'));_0xce651f[_0xf83d('0x17')](_0x22c363);_0xce651f[_0xf83d('0x19')]();_0xce651f['on'](_0xf83d('0x1a'),function(){return _0x1d53af(_0x3ed7ed);});}catch(_0x419e58){fs['unlink'](_0x3ed7ed);return _0x1ed670(_0x419e58);}});});};exports['decryptFile']=function(_0x297bf7,_0x4de437,_0x145f8e,_0xf36aeb){return new BPromise(function(_0x3dfcc1,_0x248e5f){_0xf36aeb=combineOptions(_0xf36aeb);var _0x36aed2=new Buffer(_0x145f8e);var _0xc4dd1b=fs[_0xf83d('0x13')](_0x297bf7);var _0x22aa04=fs[_0xf83d('0x14')](_0x4de437);var _0x5b6c42=crypto[_0xf83d('0x1b')](_0xf36aeb['algorithm'],_0x36aed2);_0xc4dd1b['on'](_0xf83d('0x1c'),function(_0x34d2a4){var _0x196016=new Buffer(_0x5b6c42['update'](_0x34d2a4),'binary');_0x22aa04[_0xf83d('0x17')](_0x196016);});_0xc4dd1b['on']('end',function(){try{var _0x1227c8=new Buffer(_0x5b6c42['final'](_0xf83d('0x16')),_0xf83d('0x16'));_0x22aa04[_0xf83d('0x17')](_0x1227c8);_0x22aa04['end']();_0x22aa04['on']('close',function(){return _0x3dfcc1(_0x4de437);});}catch(_0x4f9c3e){fs['unlink'](_0x4de437);return _0x248e5f(_0x4f9c3e);}});});};exports['encryptString']=function(_0x353bee,_0x170cd0,_0x214a4c){var _0x4c0c62=_0x214a4c||stringOptions[_0xf83d('0xa')];var _0x106821=_0x170cd0||stringOptions['secret'];var _0x25b6e8=crypto[_0xf83d('0x15')](_0x4c0c62,_0x106821);var _0x1c7d05=_0x25b6e8[_0xf83d('0x1d')](_0x353bee,'utf8','base64');_0x1c7d05+=_0x25b6e8[_0xf83d('0x18')](_0xf83d('0x1e'));return _0x1c7d05;};exports[_0xf83d('0x1f')]=function(_0x4da402,_0x422057,_0x4b0cc3){var _0x1bc649=_0x4b0cc3||stringOptions['algorithm'];var _0x2990b3=_0x422057||stringOptions['secret'];var _0x49fcdf=crypto[_0xf83d('0x1b')](_0x1bc649,_0x2990b3);var _0x2784c8=_0x49fcdf[_0xf83d('0x1d')](_0x4da402,_0xf83d('0x1e'),'utf8');_0x2784c8+=_0x49fcdf[_0xf83d('0x18')](_0xf83d('0x20'));return _0x2784c8;}; \ No newline at end of file +var _0xd5f5=['update','binary','write','end','final','unlink','decryptFile','createWriteStream','data','close','encryptString','secret','utf8','base64','decryptString','createDecipher','crypto','bluebird','../../config/logger','app','secrets','session','aes192','encrypt','algorithm','error','test','getCiphers','indexOf','hasOwnProperty','createReadStream','createCipher'];(function(_0x3ca524,_0x4d689b){var _0x360631=function(_0x2d18e4){while(--_0x2d18e4){_0x3ca524['push'](_0x3ca524['shift']());}};_0x360631(++_0x4d689b);}(_0xd5f5,0x190));var _0x5d5f=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xd5f5[_0x465a0c];return _0x1e202e;};'use strict';var crypto=require(_0x5d5f('0x0'));var fs=require('fs');var BPromise=require(_0x5d5f('0x1'));var _=require('lodash');var config=require('../../config/environment');var logger=require(_0x5d5f('0x2'))(_0x5d5f('0x3'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x5d5f('0x4')][_0x5d5f('0x5')],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':_0x5d5f('0x6')};if(config[_0x5d5f('0x7')]&&config[_0x5d5f('0x7')][_0x5d5f('0x8')]){var isSupported=isAlgorithmSupported(config[_0x5d5f('0x7')][_0x5d5f('0x8')]);if(isSupported){fileOptions[_0x5d5f('0x8')]=config['encrypt']['algorithm'];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger[_0x5d5f('0x9')](config['encrypt'][_0x5d5f('0x8')],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0x4fe740){return AES_SUPPORTED_RX[_0x5d5f('0xa')](_0x4fe740);}function getSupportedCiphers(){return crypto[_0x5d5f('0xb')]()['filter'](isASupportedCipher);}function isAlgorithmSupported(_0x240406){return getSupportedCiphers()[_0x5d5f('0xc')](_0x240406)>-0x1;}function combineOptions(_0x4f3379){var _0x267fb5={};for(var _0x2a8b82 in fileOptions){if(fileOptions[_0x5d5f('0xd')](_0x2a8b82)){_0x267fb5[_0x2a8b82]=fileOptions[_0x2a8b82];}}if(_0x4f3379){for(var _0x1390f4 in _0x4f3379){if(_0x4f3379[_0x5d5f('0xd')](_0x1390f4)){_0x267fb5[_0x1390f4]=_0x4f3379[_0x1390f4];}}}return _0x267fb5;}exports['encryptFile']=function(_0x1b7594,_0x232cc0,_0x2cbdbd,_0x5b1a1d){return new BPromise(function(_0x950272,_0x2097ea){_0x5b1a1d=combineOptions(_0x5b1a1d);var _0x2a761c=new Buffer(_0x2cbdbd);var _0x3058e1=fs[_0x5d5f('0xe')](_0x1b7594);var _0x1d8617=fs['createWriteStream'](_0x232cc0);var _0x20b481=crypto[_0x5d5f('0xf')](_0x5b1a1d[_0x5d5f('0x8')],_0x2a761c);_0x3058e1['on']('data',function(_0x12035b){var _0x3a17af=new Buffer(_0x20b481[_0x5d5f('0x10')](_0x12035b),_0x5d5f('0x11'));_0x1d8617[_0x5d5f('0x12')](_0x3a17af);});_0x3058e1['on'](_0x5d5f('0x13'),function(){try{var _0x4905fe=new Buffer(_0x20b481[_0x5d5f('0x14')]('binary'),_0x5d5f('0x11'));_0x1d8617[_0x5d5f('0x12')](_0x4905fe);_0x1d8617['end']();_0x1d8617['on']('close',function(){return _0x950272(_0x232cc0);});}catch(_0x564ba6){fs[_0x5d5f('0x15')](_0x232cc0);return _0x2097ea(_0x564ba6);}});});};exports[_0x5d5f('0x16')]=function(_0x38bea9,_0x2911b1,_0xd84fc7,_0x30d1df){return new BPromise(function(_0x1cb628,_0x3bf64f){_0x30d1df=combineOptions(_0x30d1df);var _0x642776=new Buffer(_0xd84fc7);var _0x514e70=fs[_0x5d5f('0xe')](_0x38bea9);var _0x89c05a=fs[_0x5d5f('0x17')](_0x2911b1);var _0x48c72e=crypto['createDecipher'](_0x30d1df[_0x5d5f('0x8')],_0x642776);_0x514e70['on'](_0x5d5f('0x18'),function(_0x3a9a49){var _0x40187e=new Buffer(_0x48c72e[_0x5d5f('0x10')](_0x3a9a49),_0x5d5f('0x11'));_0x89c05a['write'](_0x40187e);});_0x514e70['on'](_0x5d5f('0x13'),function(){try{var _0x19a0b8=new Buffer(_0x48c72e[_0x5d5f('0x14')](_0x5d5f('0x11')),_0x5d5f('0x11'));_0x89c05a[_0x5d5f('0x12')](_0x19a0b8);_0x89c05a[_0x5d5f('0x13')]();_0x89c05a['on'](_0x5d5f('0x19'),function(){return _0x1cb628(_0x2911b1);});}catch(_0x2b5ca8){fs[_0x5d5f('0x15')](_0x2911b1);return _0x3bf64f(_0x2b5ca8);}});});};exports[_0x5d5f('0x1a')]=function(_0x3b80b2,_0x16b8ec,_0x4e4b37){var _0x3b11dd=_0x4e4b37||stringOptions[_0x5d5f('0x8')];var _0x5767dc=_0x16b8ec||stringOptions[_0x5d5f('0x1b')];var _0x2829ad=crypto[_0x5d5f('0xf')](_0x3b11dd,_0x5767dc);var _0x19e8fc=_0x2829ad['update'](_0x3b80b2,_0x5d5f('0x1c'),_0x5d5f('0x1d'));_0x19e8fc+=_0x2829ad[_0x5d5f('0x14')](_0x5d5f('0x1d'));return _0x19e8fc;};exports[_0x5d5f('0x1e')]=function(_0x4519b6,_0x49a3ee,_0x30837e){var _0x275b88=_0x30837e||stringOptions[_0x5d5f('0x8')];var _0x3f472b=_0x49a3ee||stringOptions['secret'];var _0x14d601=crypto[_0x5d5f('0x1f')](_0x275b88,_0x3f472b);var _0x4ee666=_0x14d601[_0x5d5f('0x10')](_0x4519b6,_0x5d5f('0x1d'),_0x5d5f('0x1c'));_0x4ee666+=_0x14d601[_0x5d5f('0x14')](_0x5d5f('0x1c'));return _0x4ee666;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 55b1dc9..ad77988 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 _0xaea8=['Empty','range','isInteger','forEach','%s\x20limit\x20%d\x20OFFSET\x20%d','sequelize','SELECT','QueryTypes','push','basename','.csv','existsSync','join','mkdirSync','each','length','%s%d.%s','csv','%s.%s','writeFileSync','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','exit','path','to-csv','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','find','split','splitSizeCsv','then','query','num'];(function(_0x21df5b,_0x3c73a6){var _0x24e8ef=function(_0x28bf5c){while(--_0x28bf5c){_0x21df5b['push'](_0x21df5b['shift']());}};_0x24e8ef(++_0x3c73a6);}(_0xaea8,0x1ce));var _0x8aea=function(_0x5a48f0,_0x4b2685){_0x5a48f0=_0x5a48f0-0x0;var _0x404828=_0xaea8[_0x5a48f0];return _0x404828;};'use strict';var util=require('util');var path=require(_0x8aea('0x0'));var _=require('lodash');var csv=require(_0x8aea('0x1'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require('zip-dir');var rimraf=require('rimraf');var db=require('../../mysqldb')['db'];var dbH=require(_0x8aea('0x2'))[_0x8aea('0x3')];var logger=require(_0x8aea('0x4'))(_0x8aea('0x5'));var EXTRACTED_REPORT_ID=Number(process[_0x8aea('0x6')][0x2]);var QUERY=process[_0x8aea('0x6')][0x3];var PATH=process[_0x8aea('0x6')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x5d3057,_0x1a8ec6){var _0x1f865b={'status':_0x5d3057};var _0xfc6bcf={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1a8ec6){_0x1f865b[_0x8aea('0x7')]=_0x1a8ec6;}return db[_0x8aea('0x8')][_0x8aea('0x9')](_0x1f865b,_0xfc6bcf);}function main(){var _0x3d0a74=0x1388;var _0x20025f;logger['info'](util[_0x8aea('0xa')](_0x8aea('0xb'),EXTRACTED_REPORT_ID,'CSV'));return db['Setting'][_0x8aea('0xc')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x8aea('0xd'),_0x8aea('0xe')]})[_0x8aea('0xf')](function(_0x203966){if(_0x203966){_0x20025f=_0x203966;_0x3d0a74=_0x20025f[_0x8aea('0xe')]||0x1388;}})['then'](function(){return dbH['sequelize'][_0x8aea('0x10')](util[_0x8aea('0xa')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH['sequelize']['QueryTypes']['SELECT']});})['then'](function(_0x3268c3){if(!_0x3268c3[0x0][_0x8aea('0x11')]){return analyticExtractedReport(_0x8aea('0x12'));}var _0x483fcb=[];var _0x5a2b06=0x0;if(_0x20025f[_0x8aea('0xd')]){if(_0x3268c3&&_0x3268c3['length']){var _0x288d88=_[_0x8aea('0x13')](_0x3268c3[0x0][_0x8aea('0x11')]/_0x3d0a74);var _0x23decf=Number[_0x8aea('0x14')](_0x3268c3[0x0][_0x8aea('0x11')]/_0x3d0a74)?_0x3268c3[0x0]['num']%_0x3d0a74:0x0;_0x288d88[_0x8aea('0x15')](function(_0x182ee9){if(_0x182ee9>0x0){_0x5a2b06+=_0x3d0a74;}_0x483fcb['push'](dbH['sequelize'][_0x8aea('0x10')](util[_0x8aea('0xa')](_0x8aea('0x16'),QUERY,_0x3d0a74,_0x5a2b06),{'type':dbH[_0x8aea('0x17')]['QueryTypes'][_0x8aea('0x18')]}));});if(_0x23decf>0x0){_0x5a2b06+=_0x3d0a74;_0x483fcb['push'](dbH['sequelize'][_0x8aea('0x10')](util['format'](_0x8aea('0x16'),QUERY,_0x23decf,_0x5a2b06),{'type':dbH[_0x8aea('0x17')][_0x8aea('0x19')]['SELECT']}));}}}else{_0x483fcb[_0x8aea('0x1a')](dbH[_0x8aea('0x17')][_0x8aea('0x10')](QUERY,{'type':dbH[_0x8aea('0x17')][_0x8aea('0x19')][_0x8aea('0x18')]}));}var _0x437307=path['dirname'](PATH);var _0x35ef9f=path[_0x8aea('0x1b')](PATH,_0x8aea('0x1c'));var _0x1cf556=_0x20025f['split']&&_0x483fcb['length']>0x1;var _0x4457ca=[];if(!fs[_0x8aea('0x1d')](path[_0x8aea('0x1e')](_0x437307,_0x35ef9f))&&_0x1cf556){fs[_0x8aea('0x1f')](path['join'](_0x437307,_0x35ef9f));}return BPromise[_0x8aea('0x20')](_0x483fcb,function(_0x548967){_0x4457ca[_0x8aea('0x1a')](_0x548967);})[_0x8aea('0xf')](function(){for(var _0x4f935=0x0;_0x4f935<_0x4457ca[_0x8aea('0x21')];_0x4f935+=0x1){var _0x120aea;var _0x573175=_0x4457ca[_0x4f935];if(_0x1cf556){_0x120aea=path['join'](_0x437307,_0x35ef9f,util[_0x8aea('0xa')](_0x8aea('0x22'),_0x35ef9f,_0x4f935,_0x8aea('0x23')));}else{_0x120aea=path['join'](_0x437307,util[_0x8aea('0xa')](_0x8aea('0x24'),_0x35ef9f,'csv'));}fs[_0x8aea('0x25')](_0x120aea,csv(_0x573175));}})[_0x8aea('0xf')](function(){if(_0x1cf556){return new Promise(function(_0x1b0e36){zipdir(path[_0x8aea('0x1e')](_0x437307,_0x35ef9f),{'saveTo':path['join'](_0x437307,util[_0x8aea('0xa')](_0x8aea('0x24'),_0x35ef9f,_0x8aea('0x26')))},function(_0x4a8800,_0x3a3042){rimraf(path[_0x8aea('0x1e')](_0x437307,_0x35ef9f),function(){});_0x1b0e36(_0x8aea('0x27'));});});}})[_0x8aea('0xf')](function(){logger[_0x8aea('0x28')](util['format'](_0x8aea('0x29'),EXTRACTED_REPORT_ID,_0x8aea('0x2a')));return analyticExtractedReport(_0x8aea('0x2b'),_0x1cf556?util[_0x8aea('0xa')](_0x8aea('0x24'),_0x35ef9f,_0x1cf556?_0x8aea('0x26'):_0x8aea('0x23')):null);});})[_0x8aea('0x2c')](function(_0x1c9373){logger[_0x8aea('0x28')](util[_0x8aea('0xa')](_0x8aea('0x2d'),EXTRACTED_REPORT_ID,_0x8aea('0x2a')),util['inspect'](_0x1c9373,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x8aea('0x2e'));})['finally'](function(){process[_0x8aea('0x2f')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xd55b=['format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','num','Empty','length','range','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','query','dirname','.csv','existsSync','join','mkdirSync','csv','writeFileSync','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','catch','inspect','Failed','finally','exit','path','lodash','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','find','split','splitSizeCsv','then','sequelize'];(function(_0x3e607a,_0x1c3a82){var _0x4f9dbf=function(_0xd16a17){while(--_0xd16a17){_0x3e607a['push'](_0x3e607a['shift']());}};_0x4f9dbf(++_0x1c3a82);}(_0xd55b,0xaa));var _0xbd55=function(_0x18693b,_0x2f8986){_0x18693b=_0x18693b-0x0;var _0x53f9cd=_0xd55b[_0x18693b];return _0x53f9cd;};'use strict';var util=require('util');var path=require(_0xbd55('0x0'));var _=require(_0xbd55('0x1'));var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0xbd55('0x2'));var zipdir=require('zip-dir');var rimraf=require('rimraf');var db=require(_0xbd55('0x3'))['db'];var dbH=require('../../mysqldb')[_0xbd55('0x4')];var logger=require(_0xbd55('0x5'))(_0xbd55('0x6'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xbd55('0x7')][0x3];var PATH=process[_0xbd55('0x7')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x3f6672,_0x30a6a3){var _0x75c574={'status':_0x3f6672};var _0x456a0c={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x30a6a3){_0x75c574[_0xbd55('0x8')]=_0x30a6a3;}return db[_0xbd55('0x9')][_0xbd55('0xa')](_0x75c574,_0x456a0c);}function main(){var _0x4ba9e0=0x1388;var _0x1e43c3;logger[_0xbd55('0xb')](util['format'](_0xbd55('0xc'),EXTRACTED_REPORT_ID,'CSV'));return db['Setting'][_0xbd55('0xd')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xbd55('0xe'),_0xbd55('0xf')]})[_0xbd55('0x10')](function(_0x3bb935){if(_0x3bb935){_0x1e43c3=_0x3bb935;_0x4ba9e0=_0x1e43c3['splitSizeCsv']||0x1388;}})[_0xbd55('0x10')](function(){return dbH[_0xbd55('0x11')]['query'](util[_0xbd55('0x12')](_0xbd55('0x13'),QUERY),{'type':dbH[_0xbd55('0x11')]['QueryTypes'][_0xbd55('0x14')]});})[_0xbd55('0x10')](function(_0x4176a2){if(!_0x4176a2[0x0][_0xbd55('0x15')]){return analyticExtractedReport(_0xbd55('0x16'));}var _0x2efd53=[];var _0x2f9ed1=0x0;if(_0x1e43c3[_0xbd55('0xe')]){if(_0x4176a2&&_0x4176a2[_0xbd55('0x17')]){var _0x37ba0a=_[_0xbd55('0x18')](_0x4176a2[0x0][_0xbd55('0x15')]/_0x4ba9e0);var _0x19f5e2=Number[_0xbd55('0x19')](_0x4176a2[0x0]['num']/_0x4ba9e0)?_0x4176a2[0x0][_0xbd55('0x15')]%_0x4ba9e0:0x0;_0x37ba0a[_0xbd55('0x1a')](function(_0x2e37c8){if(_0x2e37c8>0x0){_0x2f9ed1+=_0x4ba9e0;}_0x2efd53[_0xbd55('0x1b')](dbH[_0xbd55('0x11')]['query'](util[_0xbd55('0x12')](_0xbd55('0x1c'),QUERY,_0x4ba9e0,_0x2f9ed1),{'type':dbH[_0xbd55('0x11')][_0xbd55('0x1d')][_0xbd55('0x14')]}));});if(_0x19f5e2>0x0){_0x2f9ed1+=_0x4ba9e0;_0x2efd53[_0xbd55('0x1b')](dbH[_0xbd55('0x11')][_0xbd55('0x1e')](util[_0xbd55('0x12')](_0xbd55('0x1c'),QUERY,_0x19f5e2,_0x2f9ed1),{'type':dbH[_0xbd55('0x11')]['QueryTypes']['SELECT']}));}}}else{_0x2efd53['push'](dbH['sequelize'][_0xbd55('0x1e')](QUERY,{'type':dbH[_0xbd55('0x11')]['QueryTypes'][_0xbd55('0x14')]}));}var _0x2249bc=path[_0xbd55('0x1f')](PATH);var _0x4a8457=path['basename'](PATH,_0xbd55('0x20'));var _0x168f0b=_0x1e43c3['split']&&_0x2efd53[_0xbd55('0x17')]>0x1;var _0x8e1b48=[];if(!fs[_0xbd55('0x21')](path[_0xbd55('0x22')](_0x2249bc,_0x4a8457))&&_0x168f0b){fs[_0xbd55('0x23')](path[_0xbd55('0x22')](_0x2249bc,_0x4a8457));}return BPromise['each'](_0x2efd53,function(_0x167d2a){_0x8e1b48[_0xbd55('0x1b')](_0x167d2a);})[_0xbd55('0x10')](function(){for(var _0x2aec4a=0x0;_0x2aec4a<_0x8e1b48['length'];_0x2aec4a+=0x1){var _0x2a2d3d;var _0x4338b4=_0x8e1b48[_0x2aec4a];if(_0x168f0b){_0x2a2d3d=path[_0xbd55('0x22')](_0x2249bc,_0x4a8457,util[_0xbd55('0x12')]('%s%d.%s',_0x4a8457,_0x2aec4a,'csv'));}else{_0x2a2d3d=path[_0xbd55('0x22')](_0x2249bc,util[_0xbd55('0x12')]('%s.%s',_0x4a8457,_0xbd55('0x24')));}fs[_0xbd55('0x25')](_0x2a2d3d,csv(_0x4338b4));}})[_0xbd55('0x10')](function(){if(_0x168f0b){return new Promise(function(_0x34d61d){zipdir(path['join'](_0x2249bc,_0x4a8457),{'saveTo':path[_0xbd55('0x22')](_0x2249bc,util[_0xbd55('0x12')](_0xbd55('0x26'),_0x4a8457,_0xbd55('0x27')))},function(_0x44579b,_0x1d5380){rimraf(path[_0xbd55('0x22')](_0x2249bc,_0x4a8457),function(){});_0x34d61d('zip\x20finished');});});}})[_0xbd55('0x10')](function(){logger[_0xbd55('0xb')](util[_0xbd55('0x12')](_0xbd55('0x28'),EXTRACTED_REPORT_ID,_0xbd55('0x29')));return analyticExtractedReport('Completed',_0x168f0b?util[_0xbd55('0x12')](_0xbd55('0x26'),_0x4a8457,_0x168f0b?_0xbd55('0x27'):'csv'):null);});})[_0xbd55('0x2a')](function(_0x5af063){logger[_0xbd55('0xb')](util['format']('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xbd55('0x29')),util[_0xbd55('0x2b')](_0x5af063,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xbd55('0x2c'));})[_0xbd55('0x2d')](function(){process[_0xbd55('0x2e')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index ba81951..52f1cf9 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 _0x1ea6=['existsSync','join','each','flatten','createPdfKitDocument','pdf','%s.%s','zip','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','AnalyticExtractedReport','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','YYYY-MM-DD','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','footer','pipe','createWriteStream','finish','end','createPdfFromHTML','util','path','html-to-pdfmake','rimraf','jsdom','window','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','update','tableHeader','pick','map','value','fill','auto','push','body','concat','chunk','keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','endDate','length','pageBreak','before','landscape','toString','\x20/\x20','Arial','right','num','Empty','Setting','find','split','splitSizePdf','then','range','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','QueryTypes','.pdf'];(function(_0x5e9dc4,_0x4a0ded){var _0x2429a0=function(_0x2abbfc){while(--_0x2abbfc){_0x5e9dc4['push'](_0x5e9dc4['shift']());}};_0x2429a0(++_0x4a0ded);}(_0x1ea6,0x12f));var _0x61ea=function(_0x120356,_0x467e01){_0x120356=_0x120356-0x0;var _0x93c2c6=_0x1ea6[_0x120356];return _0x93c2c6;};'use strict';var _=require('lodash');var fs=require('fs');var util=require(_0x61ea('0x0'));var path=require(_0x61ea('0x1'));var moment=require('moment');var htmlToPdfmake=require(_0x61ea('0x2'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require('zip-dir');var rimraf=require(_0x61ea('0x3'));var JSDOM=require(_0x61ea('0x4'))['JSDOM'];var window=new JSDOM('')[_0x61ea('0x5')];var BPromise=require(_0x61ea('0x6'));var db=require(_0x61ea('0x7'))['db'];var dbH=require(_0x61ea('0x7'))[_0x61ea('0x8')];var logger=require(_0x61ea('0x9'))(_0x61ea('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0x61ea('0xb')][0x2]);var QUERY=process[_0x61ea('0xb')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0x61ea('0xb')][0x5];var FORMAT=_0x61ea('0xc');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x3add3f,_0x833d41){var _0x2351f3={'status':_0x3add3f};var _0x2cc46b={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x833d41){_0x2351f3[_0x61ea('0xd')]=_0x833d41;}return db['AnalyticExtractedReport'][_0x61ea('0xe')](_0x2351f3,_0x2cc46b);}function getHeaders(_0x42573d){return _['map'](_0x42573d,function(_0x4aab9a){return{'text':_0x4aab9a,'style':_0x61ea('0xf')};});}function getRows(_0x510baf,_0x2750a9){return _['map'](_0x2750a9,function(_0x4b3254){return _(_0x4b3254)[_0x61ea('0x10')](_0x510baf)[_0x61ea('0x11')](function(_0x3c1c12){return _0x3c1c12?_['toString'](_0x3c1c12):'';})[_0x61ea('0x12')]();});}function createTable(_0x102aa0,_0x5e59d7){var _0x130eb6={'widths':_[_0x61ea('0x13')](Array(_0x102aa0['length']),0x91),'heights':function(_0xe9c1b9){return _0xe9c1b9===0x0?_0x61ea('0x14'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x582b47=getHeaders(_0x102aa0);_0x130eb6['body'][_0x61ea('0x15')](_0x582b47);var _0x1db276=getRows(_0x102aa0,_0x5e59d7);_0x130eb6[_0x61ea('0x16')]=_0x130eb6[_0x61ea('0x16')][_0x61ea('0x17')](_0x1db276);return _0x130eb6;}function createTables(_0x57ac92){var _0x3a1f60=[];var _0x16bb8d=_[_0x61ea('0x18')](Object[_0x61ea('0x19')](_0x57ac92[0x0]),0x5);_0x16bb8d[_0x61ea('0x1a')](function(_0x56b233){_0x3a1f60['push'](createTable(_0x56b233,_0x57ac92));});return _0x3a1f60;}function getPDFDocDefinition(_0x300baf){var _0x336cbd=util[_0x61ea('0x1b')](_0x61ea('0x1c'),NAME,EXTRACTED_REPORT[_0x61ea('0x1d')],moment(EXTRACTED_REPORT['startDate'])[_0x61ea('0x1b')](FORMAT),moment(EXTRACTED_REPORT[_0x61ea('0x1e')])[_0x61ea('0x1b')](FORMAT));var _0x4bfa24=[];for(var _0x250ad7=0x0;_0x250ad7<_0x300baf[_0x61ea('0x1f')];_0x250ad7++){var _0x19e1ed=[];if(_0x250ad7===0x0){_0x19e1ed[_0x61ea('0x15')]({'text':_0x336cbd,'style':'header'});}var _0x244d98={'table':_0x300baf[_0x250ad7]};if(_0x250ad7>0x0){_0x244d98[_0x61ea('0x20')]=_0x61ea('0x21');_0x244d98['margin']=[0x0,0x46,0x0,0x0];}_0x19e1ed[_0x61ea('0x15')](_0x244d98);_0x4bfa24[_0x61ea('0x15')](_0x19e1ed);}return{'pageSize':'A4','pageOrientation':_0x61ea('0x22'),'content':_0x4bfa24,'footer':function(_0x1bcc32,_0x592aec){return{'text':_0x1bcc32[_0x61ea('0x23')]()+_0x61ea('0x24')+_0x592aec,'style':'footer'};},'defaultStyle':{'font':_0x61ea('0x25')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'},'footer':{'alignment':_0x61ea('0x26'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x271549){var _0x5b45ac=0x1388;var _0x42618c;if(!_0x271549[0x0][_0x61ea('0x27')]){return analyticExtractedReport(_0x61ea('0x28'));}return db[_0x61ea('0x29')][_0x61ea('0x2a')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x61ea('0x2b'),_0x61ea('0x2c')]})[_0x61ea('0x2d')](function(_0x31bdfe){if(_0x31bdfe){_0x42618c=_0x31bdfe;_0x5b45ac=_0x42618c['splitSizePdf']||0x3e8;}})[_0x61ea('0x2d')](function(){var _0x49a1c6=[];var _0x3fa14a=0x0;if(_0x42618c[_0x61ea('0x2b')]){if(_0x271549&&_0x271549[_0x61ea('0x1f')]){var _0x7e0b8b=_[_0x61ea('0x2e')](_0x271549[0x0]['num']/_0x5b45ac);var _0x744a4=Number['isInteger'](_0x271549[0x0][_0x61ea('0x27')]/_0x5b45ac)?_0x271549[0x0][_0x61ea('0x27')]%_0x5b45ac:0x0;_0x7e0b8b[_0x61ea('0x1a')](function(_0x266c94){if(_0x266c94>0x0){_0x3fa14a+=_0x5b45ac;}_0x49a1c6['push'](dbH[_0x61ea('0x2f')][_0x61ea('0x30')](util[_0x61ea('0x1b')](_0x61ea('0x31'),QUERY,_0x5b45ac,_0x3fa14a),{'type':dbH[_0x61ea('0x2f')]['QueryTypes'][_0x61ea('0x32')]}));});if(_0x744a4>0x0){_0x3fa14a+=_0x5b45ac;_0x49a1c6['push'](dbH[_0x61ea('0x2f')][_0x61ea('0x30')](util[_0x61ea('0x1b')](_0x61ea('0x31'),QUERY,_0x744a4,_0x3fa14a),{'type':dbH[_0x61ea('0x2f')][_0x61ea('0x33')][_0x61ea('0x32')]}));}}}else{_0x49a1c6['push'](dbH['sequelize'][_0x61ea('0x30')](QUERY,{'type':dbH[_0x61ea('0x2f')][_0x61ea('0x33')][_0x61ea('0x32')]}));}var _0x3c8221=path['dirname'](PATH);var _0x129b91=path['basename'](PATH,_0x61ea('0x34'));var _0x3b272e=_0x42618c[_0x61ea('0x2b')]&&_0x49a1c6[_0x61ea('0x1f')]>0x1;var _0x3a7aa5=[];if(!fs[_0x61ea('0x35')](path['join'](_0x3c8221,_0x129b91))&&_0x3b272e){fs['mkdirSync'](path[_0x61ea('0x36')](_0x3c8221,_0x129b91));}return BPromise[_0x61ea('0x37')](_0x49a1c6,function(_0x2d92fc){_0x3a7aa5['push'](_0x2d92fc);})[_0x61ea('0x2d')](function(){var _0x570f9d=[];for(var _0x506fc0=0x0;_0x506fc0<_0x3a7aa5[_0x61ea('0x1f')];_0x506fc0+=0x1){var _0x49685d=_0x3a7aa5[_0x506fc0];var _0x191da5=createTables(_[_0x61ea('0x38')](_0x49685d));var _0x6b151b;var _0x32361d=getPDFDocDefinition(_0x191da5);var _0x3a9304=getPDFPrinter();var _0x1593d9=_0x3a9304[_0x61ea('0x39')](_0x32361d);if(_0x3b272e){_0x6b151b=path[_0x61ea('0x36')](_0x3c8221,_0x129b91,util[_0x61ea('0x1b')]('%s%d.%s',_0x129b91,_0x506fc0,_0x61ea('0x3a')));}else{_0x6b151b=path['join'](_0x3c8221,util[_0x61ea('0x1b')](_0x61ea('0x3b'),_0x129b91,_0x61ea('0x3a')));}_0x570f9d['push'](writePDFDocument(_0x1593d9,_0x6b151b));}return Promise['all'](_0x570f9d);})['then'](function(){if(_0x3b272e){return new Promise(function(_0x256044){zipdir(path[_0x61ea('0x36')](_0x3c8221,_0x129b91),{'saveTo':path[_0x61ea('0x36')](_0x3c8221,util['format'](_0x61ea('0x3b'),_0x129b91,_0x61ea('0x3c')))},function(){rimraf(path['join'](_0x3c8221,_0x129b91),function(){});_0x256044('zip\x20finished');});});}})[_0x61ea('0x2d')](function(){if(!_0x3b272e)return;rimraf(path['join'](_0x3c8221,_0x129b91),function(){});})[_0x61ea('0x2d')](function(){logger[_0x61ea('0x3d')](util[_0x61ea('0x1b')](_0x61ea('0x3e'),EXTRACTED_REPORT_ID,_0x61ea('0x3f')));return analyticExtractedReport(_0x61ea('0x40'),_0x3b272e?util[_0x61ea('0x1b')](_0x61ea('0x3b'),_0x129b91,_0x3b272e?_0x61ea('0x3c'):_0x61ea('0x3a')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger['info'](util[_0x61ea('0x1b')](_0x61ea('0x41'),EXTRACTED_REPORT_ID,_0x61ea('0x3f')));return db[_0x61ea('0x42')][_0x61ea('0x43')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x61ea('0x2d')](function(_0x3d920c){EXTRACTED_REPORT=_0x3d920c;return dbH[_0x61ea('0x2f')]['query'](util[_0x61ea('0x1b')](_0x61ea('0x44'),QUERY),{'type':dbH[_0x61ea('0x2f')][_0x61ea('0x33')]['SELECT']});})[_0x61ea('0x2d')](extractReport)[_0x61ea('0x45')](function(_0x5a7073){logger[_0x61ea('0x3d')](util[_0x61ea('0x1b')](_0x61ea('0x46'),EXTRACTED_REPORT_ID,'PDF'),util[_0x61ea('0x47')](_0x5a7073,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x61ea('0x48'));})[_0x61ea('0x49')](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0x60e5a6=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+_0x61ea('0x4a'),'italics':__dirname+_0x61ea('0x4b'),'bolditalics':__dirname+_0x61ea('0x4c')}});return _0x60e5a6;}function getPDFDocDefinitionFromHTML(_0x521d68,_0x570381){var _0x49b3ac=util[_0x61ea('0x1b')](_0x61ea('0x4d'),_0x570381[_0x61ea('0x4e')],_0x570381['interactionId']);var _0x4ad0e1=moment()[_0x61ea('0x1b')](_0x61ea('0x4f'))[_0x61ea('0x23')]();var _0xa13889=htmlToPdfmake(_0x521d68,{'window':window,'tableAutoSize':!![]});return{'content':[_0xa13889],'defaultStyle':{'font':_0x61ea('0x25')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x61ea('0x50'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':'center','margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x61ea('0x50')}},'header':function(){return[{'text':_0x61ea('0x51'),'style':'header'}];},'footer':function(_0x37637c,_0x4ac43d){return[{'text':util[_0x61ea('0x1b')](_0x61ea('0x52'),_0x49b3ac,_0x37637c,_0x4ac43d,_0x4ad0e1),'style':_0x61ea('0x53')}];}};}function writePDFDocument(_0x1a4d2e,_0x4751b9){return new Promise(function(_0x1141cb,_0x516df2){var _0x7bf41f=_0x1a4d2e[_0x61ea('0x54')](fs[_0x61ea('0x55')](_0x4751b9));_0x7bf41f['on'](_0x61ea('0x56'),function(){_0x1141cb('finish');});_0x7bf41f['on']('error',function(_0x1ad137){_0x516df2(_0x1ad137);});_0x1a4d2e[_0x61ea('0x57')]();});}exports[_0x61ea('0x58')]=function(_0x9cd8b5,_0x2cdb6c){var _0x543fec=getPDFPrinter();var _0x37b72c=getPDFDocDefinitionFromHTML(_0x9cd8b5,_0x2cdb6c);var _0x564495=_0x543fec[_0x61ea('0x39')](_0x37b72c);return writePDFDocument(_0x564495,_0x2cdb6c[_0x61ea('0x1')])['catch'](function(_0x851d4e){throw _0x851d4e;});}; \ No newline at end of file +var _0x6cd9=['landscape','\x20/\x20','footer','Arial','black','right','num','Empty','Setting','find','split','splitSizePdf','then','isInteger','forEach','sequelize','query','SELECT','QueryTypes','dirname','basename','.pdf','existsSync','join','flatten','%s%d.%s','%s.%s','all','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','interactionId','YYYY-MM-DD','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','createWriteStream','finish','error','createPdfKitDocument','lodash','util','path','rimraf','jsdom','JSDOM','window','bluebird','../../mysqldb','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','tableHeader','map','pick','toString','value','fill','length','auto','body','push','chunk','keys','format','name','header','pageBreak','before','margin'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x6cd9,0x8f));var _0x96cd=function(_0x10e34b,_0x2a4329){_0x10e34b=_0x10e34b-0x0;var _0x19e9c8=_0x6cd9[_0x10e34b];return _0x19e9c8;};'use strict';var _=require(_0x96cd('0x0'));var fs=require('fs');var util=require(_0x96cd('0x1'));var path=require(_0x96cd('0x2'));var moment=require('moment');var htmlToPdfmake=require('html-to-pdfmake');var PdfPrinter=require('pdfmake/src/printer');var zipdir=require('zip-dir');var rimraf=require(_0x96cd('0x3'));var JSDOM=require(_0x96cd('0x4'))[_0x96cd('0x5')];var window=new JSDOM('')[_0x96cd('0x6')];var BPromise=require(_0x96cd('0x7'));var db=require('../../mysqldb')['db'];var dbH=require(_0x96cd('0x8'))['dbH'];var logger=require('../../config/logger')(_0x96cd('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0x96cd('0xa')][0x2]);var QUERY=process[_0x96cd('0xa')][0x3];var PATH=process[_0x96cd('0xa')][0x4];var NAME=process[_0x96cd('0xa')][0x5];var FORMAT=_0x96cd('0xb');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x104a6b,_0x4dbf26){var _0x26b1b8={'status':_0x104a6b};var _0x2ecce7={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4dbf26){_0x26b1b8[_0x96cd('0xc')]=_0x4dbf26;}return db[_0x96cd('0xd')][_0x96cd('0xe')](_0x26b1b8,_0x2ecce7);}function getHeaders(_0x21f2a8){return _['map'](_0x21f2a8,function(_0x2565cb){return{'text':_0x2565cb,'style':_0x96cd('0xf')};});}function getRows(_0x39b9e0,_0xe57465){return _[_0x96cd('0x10')](_0xe57465,function(_0x307237){return _(_0x307237)[_0x96cd('0x11')](_0x39b9e0)[_0x96cd('0x10')](function(_0x19ddd2){return _0x19ddd2?_[_0x96cd('0x12')](_0x19ddd2):'';})[_0x96cd('0x13')]();});}function createTable(_0x343628,_0x26adb4){var _0x1c5372={'widths':_[_0x96cd('0x14')](Array(_0x343628[_0x96cd('0x15')]),0x91),'heights':function(_0x3d3101){return _0x3d3101===0x0?_0x96cd('0x16'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x515de2=getHeaders(_0x343628);_0x1c5372[_0x96cd('0x17')][_0x96cd('0x18')](_0x515de2);var _0x4785ad=getRows(_0x343628,_0x26adb4);_0x1c5372[_0x96cd('0x17')]=_0x1c5372[_0x96cd('0x17')]['concat'](_0x4785ad);return _0x1c5372;}function createTables(_0x5cc03b){var _0x2d1ce1=[];var _0x4bce41=_[_0x96cd('0x19')](Object[_0x96cd('0x1a')](_0x5cc03b[0x0]),0x5);_0x4bce41['forEach'](function(_0x4d4876){_0x2d1ce1[_0x96cd('0x18')](createTable(_0x4d4876,_0x5cc03b));});return _0x2d1ce1;}function getPDFDocDefinition(_0x542ddc){var _0x4ba5b1=util[_0x96cd('0x1b')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,EXTRACTED_REPORT[_0x96cd('0x1c')],moment(EXTRACTED_REPORT['startDate'])['format'](FORMAT),moment(EXTRACTED_REPORT['endDate'])['format'](FORMAT));var _0x364df9=[];for(var _0x22e606=0x0;_0x22e606<_0x542ddc['length'];_0x22e606++){var _0x251100=[];if(_0x22e606===0x0){_0x251100['push']({'text':_0x4ba5b1,'style':_0x96cd('0x1d')});}var _0x2ff4c3={'table':_0x542ddc[_0x22e606]};if(_0x22e606>0x0){_0x2ff4c3[_0x96cd('0x1e')]=_0x96cd('0x1f');_0x2ff4c3[_0x96cd('0x20')]=[0x0,0x46,0x0,0x0];}_0x251100[_0x96cd('0x18')](_0x2ff4c3);_0x364df9[_0x96cd('0x18')](_0x251100);}return{'pageSize':'A4','pageOrientation':_0x96cd('0x21'),'content':_0x364df9,'footer':function(_0x273a21,_0x2bdbe8){return{'text':_0x273a21['toString']()+_0x96cd('0x22')+_0x2bdbe8,'style':_0x96cd('0x23')};},'defaultStyle':{'font':_0x96cd('0x24')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x96cd('0x25')},'footer':{'alignment':_0x96cd('0x26'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x30d005){var _0x56ab9c=0x1388;var _0x2b793f;if(!_0x30d005[0x0][_0x96cd('0x27')]){return analyticExtractedReport(_0x96cd('0x28'));}return db[_0x96cd('0x29')][_0x96cd('0x2a')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x96cd('0x2b'),_0x96cd('0x2c')]})[_0x96cd('0x2d')](function(_0x538bf1){if(_0x538bf1){_0x2b793f=_0x538bf1;_0x56ab9c=_0x2b793f[_0x96cd('0x2c')]||0x3e8;}})[_0x96cd('0x2d')](function(){var _0x1df009=[];var _0x1ad145=0x0;if(_0x2b793f[_0x96cd('0x2b')]){if(_0x30d005&&_0x30d005[_0x96cd('0x15')]){var _0x15815a=_['range'](_0x30d005[0x0][_0x96cd('0x27')]/_0x56ab9c);var _0x2018dd=Number[_0x96cd('0x2e')](_0x30d005[0x0]['num']/_0x56ab9c)?_0x30d005[0x0]['num']%_0x56ab9c:0x0;_0x15815a[_0x96cd('0x2f')](function(_0x19ce73){if(_0x19ce73>0x0){_0x1ad145+=_0x56ab9c;}_0x1df009[_0x96cd('0x18')](dbH[_0x96cd('0x30')][_0x96cd('0x31')](util[_0x96cd('0x1b')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x56ab9c,_0x1ad145),{'type':dbH[_0x96cd('0x30')]['QueryTypes'][_0x96cd('0x32')]}));});if(_0x2018dd>0x0){_0x1ad145+=_0x56ab9c;_0x1df009['push'](dbH[_0x96cd('0x30')][_0x96cd('0x31')](util[_0x96cd('0x1b')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x2018dd,_0x1ad145),{'type':dbH['sequelize'][_0x96cd('0x33')]['SELECT']}));}}}else{_0x1df009[_0x96cd('0x18')](dbH['sequelize']['query'](QUERY,{'type':dbH['sequelize']['QueryTypes'][_0x96cd('0x32')]}));}var _0x37dd33=path[_0x96cd('0x34')](PATH);var _0x462451=path[_0x96cd('0x35')](PATH,_0x96cd('0x36'));var _0x2711f8=_0x2b793f[_0x96cd('0x2b')]&&_0x1df009[_0x96cd('0x15')]>0x1;var _0x9800aa=[];if(!fs[_0x96cd('0x37')](path[_0x96cd('0x38')](_0x37dd33,_0x462451))&&_0x2711f8){fs['mkdirSync'](path[_0x96cd('0x38')](_0x37dd33,_0x462451));}return BPromise['each'](_0x1df009,function(_0x444b61){_0x9800aa[_0x96cd('0x18')](_0x444b61);})[_0x96cd('0x2d')](function(){var _0x4fbe73=[];for(var _0x5a5937=0x0;_0x5a5937<_0x9800aa[_0x96cd('0x15')];_0x5a5937+=0x1){var _0x681f0a=_0x9800aa[_0x5a5937];var _0x5b8cae=createTables(_[_0x96cd('0x39')](_0x681f0a));var _0x540ebc;var _0x456d54=getPDFDocDefinition(_0x5b8cae);var _0x1a41ea=getPDFPrinter();var _0x20b2b4=_0x1a41ea['createPdfKitDocument'](_0x456d54);if(_0x2711f8){_0x540ebc=path[_0x96cd('0x38')](_0x37dd33,_0x462451,util['format'](_0x96cd('0x3a'),_0x462451,_0x5a5937,'pdf'));}else{_0x540ebc=path[_0x96cd('0x38')](_0x37dd33,util[_0x96cd('0x1b')](_0x96cd('0x3b'),_0x462451,'pdf'));}_0x4fbe73['push'](writePDFDocument(_0x20b2b4,_0x540ebc));}return Promise[_0x96cd('0x3c')](_0x4fbe73);})[_0x96cd('0x2d')](function(){if(_0x2711f8){return new Promise(function(_0x1ee066){zipdir(path[_0x96cd('0x38')](_0x37dd33,_0x462451),{'saveTo':path[_0x96cd('0x38')](_0x37dd33,util[_0x96cd('0x1b')](_0x96cd('0x3b'),_0x462451,_0x96cd('0x3d')))},function(){rimraf(path[_0x96cd('0x38')](_0x37dd33,_0x462451),function(){});_0x1ee066(_0x96cd('0x3e'));});});}})[_0x96cd('0x2d')](function(){if(!_0x2711f8)return;rimraf(path['join'](_0x37dd33,_0x462451),function(){});})[_0x96cd('0x2d')](function(){logger[_0x96cd('0x3f')](util[_0x96cd('0x1b')](_0x96cd('0x40'),EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport(_0x96cd('0x41'),_0x2711f8?util['format'](_0x96cd('0x3b'),_0x462451,_0x2711f8?'zip':'pdf'):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x96cd('0x3f')](util['format'](_0x96cd('0x42'),EXTRACTED_REPORT_ID,_0x96cd('0x43')));return db[_0x96cd('0xd')][_0x96cd('0x44')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x96cd('0x2d')](function(_0x35d48b){EXTRACTED_REPORT=_0x35d48b;return dbH['sequelize']['query'](util[_0x96cd('0x1b')](_0x96cd('0x45'),QUERY),{'type':dbH[_0x96cd('0x30')][_0x96cd('0x33')][_0x96cd('0x32')]});})[_0x96cd('0x2d')](extractReport)[_0x96cd('0x46')](function(_0x585fff){logger['info'](util[_0x96cd('0x1b')](_0x96cd('0x47'),EXTRACTED_REPORT_ID,_0x96cd('0x43')),util['inspect'](_0x585fff,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x96cd('0x48'));})[_0x96cd('0x49')](function(){process[_0x96cd('0x4a')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x484faa=new PdfPrinter({'Arial':{'normal':__dirname+_0x96cd('0x4b'),'bold':__dirname+_0x96cd('0x4c'),'italics':__dirname+_0x96cd('0x4d'),'bolditalics':__dirname+_0x96cd('0x4e')}});return _0x484faa;}function getPDFDocDefinitionFromHTML(_0x68d46b,_0x800d07){var _0x4b72f8=util[_0x96cd('0x1b')]('%s\x20#%d',_0x800d07['channel'],_0x800d07[_0x96cd('0x4f')]);var _0x331cfc=moment()['format'](_0x96cd('0x50'))['toString']();var _0x1ed278=htmlToPdfmake(_0x68d46b,{'window':window,'tableAutoSize':!![]});return{'content':[_0x1ed278],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x96cd('0x51'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x96cd('0x51'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x96cd('0x51')}},'header':function(){return[{'text':_0x96cd('0x52'),'style':_0x96cd('0x1d')}];},'footer':function(_0x1c6d04,_0x4a345e){return[{'text':util[_0x96cd('0x1b')](_0x96cd('0x53'),_0x4b72f8,_0x1c6d04,_0x4a345e,_0x331cfc),'style':_0x96cd('0x23')}];}};}function writePDFDocument(_0x5b8cd0,_0x55fd10){return new Promise(function(_0x29f561,_0x32f9c4){var _0x3e9fbd=_0x5b8cd0['pipe'](fs[_0x96cd('0x54')](_0x55fd10));_0x3e9fbd['on']('finish',function(){_0x29f561(_0x96cd('0x55'));});_0x3e9fbd['on'](_0x96cd('0x56'),function(_0x210d97){_0x32f9c4(_0x210d97);});_0x5b8cd0['end']();});}exports['createPdfFromHTML']=function(_0x3dbbb8,_0x4270c3){var _0x41319d=getPDFPrinter();var _0x46b6c4=getPDFDocDefinitionFromHTML(_0x3dbbb8,_0x4270c3);var _0x1e9a9b=_0x41319d[_0x96cd('0x57')](_0x46b6c4);return writePDFDocument(_0x1e9a9b,_0x4270c3[_0x96cd('0x2')])['catch'](function(_0x132763){throw _0x132763;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index dc3ec24..4251d50 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 _0x1f81=['Empty','length','range','isInteger','forEach','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','dirname','basename','.xlsx','existsSync','join','each','xlsx','writeFileSync','%s.%s','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','util','path','json2xls','bluebird','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','XLSX','Setting','find','split','splitSizeXlsx','then','sequelize','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','num'];(function(_0x43026b,_0x928d8c){var _0x4a96cd=function(_0x362cbd){while(--_0x362cbd){_0x43026b['push'](_0x43026b['shift']());}};_0x4a96cd(++_0x928d8c);}(_0x1f81,0xab));var _0x11f8=function(_0x4b784d,_0x5efb2f){_0x4b784d=_0x4b784d-0x0;var _0x2cdeaf=_0x1f81[_0x4b784d];return _0x2cdeaf;};'use strict';var util=require(_0x11f8('0x0'));var path=require(_0x11f8('0x1'));var _=require('lodash');var fs=require('fs');var json2xls=require(_0x11f8('0x2'));var BPromise=require(_0x11f8('0x3'));var zipdir=require('zip-dir');var rimraf=require(_0x11f8('0x4'));var db=require(_0x11f8('0x5'))['db'];var dbH=require(_0x11f8('0x5'))[_0x11f8('0x6')];var logger=require(_0x11f8('0x7'))(_0x11f8('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x11f8('0x9')][0x2]);var QUERY=process[_0x11f8('0x9')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x1d899d,_0x8009d7){var _0x1cecbe={'status':_0x1d899d};var _0x1bc74d={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x8009d7){_0x1cecbe[_0x11f8('0xa')]=_0x8009d7;}return db[_0x11f8('0xb')][_0x11f8('0xc')](_0x1cecbe,_0x1bc74d);}function main(){var _0x46241e=0x1388;var _0xf7ae38;logger[_0x11f8('0xd')](util[_0x11f8('0xe')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x11f8('0xf')));return db[_0x11f8('0x10')][_0x11f8('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x11f8('0x12'),_0x11f8('0x13')]})[_0x11f8('0x14')](function(_0x4d4cf7){if(_0x4d4cf7){_0xf7ae38=_0x4d4cf7;_0x46241e=_0xf7ae38[_0x11f8('0x13')]||0x1388;}})[_0x11f8('0x14')](function(){return dbH[_0x11f8('0x15')]['query'](util[_0x11f8('0xe')](_0x11f8('0x16'),QUERY),{'type':dbH[_0x11f8('0x15')][_0x11f8('0x17')]['SELECT']});})[_0x11f8('0x14')](function(_0x199de9){if(!_0x199de9[0x0][_0x11f8('0x18')]){return analyticExtractedReport(_0x11f8('0x19'));}var _0x381314=[];var _0x5afddb=0x0;if(_0xf7ae38[_0x11f8('0x12')]){if(_0x199de9&&_0x199de9[_0x11f8('0x1a')]){var _0x4976f9=_[_0x11f8('0x1b')](_0x199de9[0x0]['num']/_0x46241e);var _0x10e29e=Number[_0x11f8('0x1c')](_0x199de9[0x0][_0x11f8('0x18')]/_0x46241e)?_0x199de9[0x0][_0x11f8('0x18')]%_0x46241e:0x0;_0x4976f9[_0x11f8('0x1d')](function(_0x2a4512){if(_0x2a4512>0x0){_0x5afddb+=_0x46241e;}_0x381314[_0x11f8('0x1e')](dbH[_0x11f8('0x15')][_0x11f8('0x1f')](util[_0x11f8('0xe')](_0x11f8('0x20'),QUERY,_0x46241e,_0x5afddb),{'type':dbH[_0x11f8('0x15')][_0x11f8('0x17')][_0x11f8('0x21')]}));});if(_0x10e29e>0x0){_0x5afddb+=_0x46241e;_0x381314[_0x11f8('0x1e')](dbH['sequelize']['query'](util['format'](_0x11f8('0x20'),QUERY,_0x10e29e,_0x5afddb),{'type':dbH[_0x11f8('0x15')][_0x11f8('0x17')][_0x11f8('0x21')]}));}}}else{_0x381314['push'](dbH[_0x11f8('0x15')][_0x11f8('0x1f')](QUERY,{'type':dbH['sequelize'][_0x11f8('0x17')][_0x11f8('0x21')]}));}var _0xcee46b=path[_0x11f8('0x22')](PATH);var _0x45d8d4=path[_0x11f8('0x23')](PATH,_0x11f8('0x24'));var _0x56a545=_0xf7ae38[_0x11f8('0x12')]&&_0x381314['length']>0x1;var _0x3a4c58=[];if(!fs[_0x11f8('0x25')](path[_0x11f8('0x26')](_0xcee46b,_0x45d8d4))&&_0x56a545){fs['mkdirSync'](path[_0x11f8('0x26')](_0xcee46b,_0x45d8d4));}return BPromise[_0x11f8('0x27')](_0x381314,function(_0x1c27c9){_0x3a4c58[_0x11f8('0x1e')](_0x1c27c9);})['then'](function(){for(var _0x3d24dd=0x0;_0x3d24dd<_0x3a4c58['length'];_0x3d24dd+=0x1){var _0x35ba83;var _0x21c09b=_0x3a4c58[_0x3d24dd];if(_0x56a545){_0x35ba83=path[_0x11f8('0x26')](_0xcee46b,_0x45d8d4,util['format']('%s%d.%s',_0x45d8d4,_0x3d24dd,_0x11f8('0x28')));}else{_0x35ba83=path['join'](_0xcee46b,util[_0x11f8('0xe')]('%s.%s',_0x45d8d4,'xlsx'));}fs[_0x11f8('0x29')](_0x35ba83,json2xls(_0x21c09b),'binary');}})[_0x11f8('0x14')](function(){if(_0x56a545){return new Promise(function(_0x193b87){zipdir(path['join'](_0xcee46b,_0x45d8d4),{'saveTo':path[_0x11f8('0x26')](_0xcee46b,util['format'](_0x11f8('0x2a'),_0x45d8d4,'zip'))},function(_0x5b2492,_0x52b636){rimraf(path[_0x11f8('0x26')](_0xcee46b,_0x45d8d4),function(){});_0x193b87('zip\x20finished');});});}})['then'](function(){logger[_0x11f8('0xd')](util[_0x11f8('0xe')](_0x11f8('0x2b'),EXTRACTED_REPORT_ID,_0x11f8('0xf')));return analyticExtractedReport('Completed',_0x56a545?util['format']('%s.%s',_0x45d8d4,_0x56a545?'zip':_0x11f8('0x28')):null);});})[_0x11f8('0x2c')](function(_0x176be5){logger[_0x11f8('0xd')](util['format'](_0x11f8('0x2d'),EXTRACTED_REPORT_ID,_0x11f8('0xf')),util[_0x11f8('0x2e')](_0x176be5,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x11f8('0x2f'));})[_0x11f8('0x30')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file +var _0xc8b4=['finally','exit','util','path','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','split','then','splitSizeXlsx','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','num','Empty','length','range','forEach','QueryTypes','basename','existsSync','mkdirSync','join','each','push','%s.%s','binary','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','XLSX','Completed','inspect'];(function(_0x1ddaaf,_0x110d94){var _0x2a63da=function(_0x3fe783){while(--_0x3fe783){_0x1ddaaf['push'](_0x1ddaaf['shift']());}};_0x2a63da(++_0x110d94);}(_0xc8b4,0x13d));var _0x4c8b=function(_0x1fbe63,_0x2ba0f5){_0x1fbe63=_0x1fbe63-0x0;var _0xcfa36f=_0xc8b4[_0x1fbe63];return _0xcfa36f;};'use strict';var util=require(_0x4c8b('0x0'));var path=require(_0x4c8b('0x1'));var _=require(_0x4c8b('0x2'));var fs=require('fs');var json2xls=require(_0x4c8b('0x3'));var BPromise=require(_0x4c8b('0x4'));var zipdir=require(_0x4c8b('0x5'));var rimraf=require(_0x4c8b('0x6'));var db=require(_0x4c8b('0x7'))['db'];var dbH=require('../../mysqldb')[_0x4c8b('0x8')];var logger=require(_0x4c8b('0x9'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x4c8b('0xa')][0x2]);var QUERY=process[_0x4c8b('0xa')][0x3];var PATH=process[_0x4c8b('0xa')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x59bf43,_0x1da608){var _0x12f2bc={'status':_0x59bf43};var _0x3f9b56={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1da608){_0x12f2bc['savename']=_0x1da608;}return db['AnalyticExtractedReport'][_0x4c8b('0xb')](_0x12f2bc,_0x3f9b56);}function main(){var _0x46b8af=0x1388;var _0x406d69;logger[_0x4c8b('0xc')](util[_0x4c8b('0xd')](_0x4c8b('0xe'),EXTRACTED_REPORT_ID,'XLSX'));return db[_0x4c8b('0xf')][_0x4c8b('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x4c8b('0x11'),'splitSizeXlsx']})[_0x4c8b('0x12')](function(_0x399a45){if(_0x399a45){_0x406d69=_0x399a45;_0x46b8af=_0x406d69[_0x4c8b('0x13')]||0x1388;}})[_0x4c8b('0x12')](function(){return dbH[_0x4c8b('0x14')][_0x4c8b('0x15')](util[_0x4c8b('0xd')](_0x4c8b('0x16'),QUERY),{'type':dbH[_0x4c8b('0x14')]['QueryTypes'][_0x4c8b('0x17')]});})['then'](function(_0x3d67b5){if(!_0x3d67b5[0x0][_0x4c8b('0x18')]){return analyticExtractedReport(_0x4c8b('0x19'));}var _0x20db7f=[];var _0x324405=0x0;if(_0x406d69[_0x4c8b('0x11')]){if(_0x3d67b5&&_0x3d67b5[_0x4c8b('0x1a')]){var _0x4e3474=_[_0x4c8b('0x1b')](_0x3d67b5[0x0][_0x4c8b('0x18')]/_0x46b8af);var _0x196d05=Number['isInteger'](_0x3d67b5[0x0][_0x4c8b('0x18')]/_0x46b8af)?_0x3d67b5[0x0]['num']%_0x46b8af:0x0;_0x4e3474[_0x4c8b('0x1c')](function(_0x502fdf){if(_0x502fdf>0x0){_0x324405+=_0x46b8af;}_0x20db7f['push'](dbH['sequelize'][_0x4c8b('0x15')](util[_0x4c8b('0xd')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x46b8af,_0x324405),{'type':dbH['sequelize'][_0x4c8b('0x1d')][_0x4c8b('0x17')]}));});if(_0x196d05>0x0){_0x324405+=_0x46b8af;_0x20db7f['push'](dbH[_0x4c8b('0x14')]['query'](util[_0x4c8b('0xd')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x196d05,_0x324405),{'type':dbH[_0x4c8b('0x14')]['QueryTypes']['SELECT']}));}}}else{_0x20db7f['push'](dbH[_0x4c8b('0x14')][_0x4c8b('0x15')](QUERY,{'type':dbH['sequelize'][_0x4c8b('0x1d')]['SELECT']}));}var _0x5c09d6=path['dirname'](PATH);var _0x5ba3ba=path[_0x4c8b('0x1e')](PATH,'.xlsx');var _0x1a828e=_0x406d69['split']&&_0x20db7f['length']>0x1;var _0xb01fd9=[];if(!fs[_0x4c8b('0x1f')](path['join'](_0x5c09d6,_0x5ba3ba))&&_0x1a828e){fs[_0x4c8b('0x20')](path[_0x4c8b('0x21')](_0x5c09d6,_0x5ba3ba));}return BPromise[_0x4c8b('0x22')](_0x20db7f,function(_0x221701){_0xb01fd9[_0x4c8b('0x23')](_0x221701);})[_0x4c8b('0x12')](function(){for(var _0x52a5df=0x0;_0x52a5df<_0xb01fd9[_0x4c8b('0x1a')];_0x52a5df+=0x1){var _0x3eae5a;var _0x207232=_0xb01fd9[_0x52a5df];if(_0x1a828e){_0x3eae5a=path[_0x4c8b('0x21')](_0x5c09d6,_0x5ba3ba,util[_0x4c8b('0xd')]('%s%d.%s',_0x5ba3ba,_0x52a5df,'xlsx'));}else{_0x3eae5a=path[_0x4c8b('0x21')](_0x5c09d6,util['format'](_0x4c8b('0x24'),_0x5ba3ba,'xlsx'));}fs['writeFileSync'](_0x3eae5a,json2xls(_0x207232),_0x4c8b('0x25'));}})[_0x4c8b('0x12')](function(){if(_0x1a828e){return new Promise(function(_0x3cb446){zipdir(path[_0x4c8b('0x21')](_0x5c09d6,_0x5ba3ba),{'saveTo':path['join'](_0x5c09d6,util[_0x4c8b('0xd')](_0x4c8b('0x24'),_0x5ba3ba,_0x4c8b('0x26')))},function(_0x1031d6,_0xa5958c){rimraf(path[_0x4c8b('0x21')](_0x5c09d6,_0x5ba3ba),function(){});_0x3cb446('zip\x20finished');});});}})['then'](function(){logger[_0x4c8b('0xc')](util[_0x4c8b('0xd')](_0x4c8b('0x27'),EXTRACTED_REPORT_ID,_0x4c8b('0x28')));return analyticExtractedReport(_0x4c8b('0x29'),_0x1a828e?util['format'](_0x4c8b('0x24'),_0x5ba3ba,_0x1a828e?_0x4c8b('0x26'):'xlsx'):null);});})['catch'](function(_0xeeed90){logger['info'](util[_0x4c8b('0xd')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'XLSX'),util[_0x4c8b('0x2a')](_0xeeed90,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x4c8b('0x2b')](function(){process[_0x4c8b('0x2c')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index b851c25..b3bd60e 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 _0x0872=['appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress',',${EXTEN},','last','concat','Hangup','transaction','VoiceExtension','destroy','sortBy','catch','error','rewrite','lodash','util','Interval','models','findAll','IntervalId','then','uniq','exten','filter','queue','hasOwnProperty','priority','extension','find','push','type','Set','context','VoiceExtensionId','extensions','CDR(routeid)=','CDR(destination)=','cutdigits','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','updatedAt','interval','map','intervals','tag','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','callerID','answer','app'];(function(_0x4c79fc,_0x2f0523){var _0x9bbab4=function(_0x51cdf5){while(--_0x51cdf5){_0x4c79fc['push'](_0x4c79fc['shift']());}};_0x9bbab4(++_0x2f0523);}(_0x0872,0x1d0));var _0x2087=function(_0x4f99d4,_0x9bfa3c){_0x4f99d4=_0x4f99d4-0x0;var _0x24aae3=_0x0872[_0x4f99d4];return _0x24aae3;};'use strict';var _=require(_0x2087('0x0'));var util=require(_0x2087('0x1'));function rewrite(_0x110f19,_0x41fb3d){var _0x343ae2=this;return _0x110f19['models'][_0x2087('0x2')]['findAll']({'raw':!![]})['then'](function(_0xba7928){_0x343ae2['intervals']=_0xba7928;return _0x110f19[_0x2087('0x3')]['VoiceExtension'][_0x2087('0x4')]({'where':{'IntervalId':_0x41fb3d[_0x2087('0x5')]},'raw':!![]});})[_0x2087('0x6')](function(_0x4a9fc4){return _0x110f19[_0x2087('0x3')]['VoiceExtension'][_0x2087('0x4')]({'where':{'exten':{'$in':_[_0x2087('0x7')](_['map'](_0x4a9fc4,_0x2087('0x8')))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0x2087('0x6')](function(_0x3e3028){var _0x4a8930=_[_0x2087('0x9')](_0x3e3028,{'priority':'1'});var _0x13a8be=_[_0x2087('0x9')](_0x3e3028,{'isApp':0x1});var _0xe63640=_['groupBy'](_0x13a8be,_0x2087('0x8'));var _0xe81af9=[_0x2087('0xa'),'playback'];var _0x5dfcdb=[];var _0x1bda81=[];for(var _0x793682 in _0xe63640){if(_0xe63640[_0x2087('0xb')](_0x793682)){_0x343ae2[_0x2087('0xc')]=0x2;_0x343ae2['extensions']=[];_0x343ae2[_0x2087('0xd')]=_[_0x2087('0xe')](_0x4a8930,{'exten':_0xe63640[_0x793682][0x0][_0x2087('0x8')]});_0x343ae2['extensions'][_0x2087('0xf')]({'type':_0xe63640[_0x793682][0x0][_0x2087('0x10')],'app':_0x2087('0x11'),'appdata':util['format']('CDR(type)=%s',_0xe63640[_0x793682][0x0][_0x2087('0x10')]),'context':_0xe63640[_0x793682][0x0][_0x2087('0x12')],'exten':_0xe63640[_0x793682][0x0][_0x2087('0x8')],'priority':_0x343ae2[_0x2087('0xc')]++,'VoiceExtensionId':_0xe63640[_0x793682][0x0][_0x2087('0x13')]});if(_0xe63640[_0x793682][0x0][_0x2087('0x10')]==='inbound'){_0x343ae2[_0x2087('0x14')][_0x2087('0xf')]({'type':_0xe63640[_0x793682][0x0][_0x2087('0x10')],'app':_0x2087('0x11'),'appdata':_0x2087('0x15')+_0xe63640[_0x793682][0x0][_0x2087('0x13')],'context':_0xe63640[_0x793682][0x0]['context'],'exten':_0xe63640[_0x793682][0x0][_0x2087('0x8')],'priority':_0x343ae2[_0x2087('0xc')]++,'VoiceExtensionId':_0xe63640[_0x793682][0x0][_0x2087('0x13')]});}else if(_0xe63640[_0x793682][0x0]['type']==='outbound'){if(_0x343ae2[_0x2087('0xd')]){_0x343ae2[_0x2087('0x14')][_0x2087('0xf')]({'type':_0xe63640[_0x793682][0x0][_0x2087('0x10')],'app':_0x2087('0x11'),'appdata':_0x2087('0x16')+(_0x343ae2[_0x2087('0xd')]['cutdigits']?'${EXTEN:'+_0x343ae2['extension'][_0x2087('0x17')]+'}':_0x2087('0x18')),'context':_0xe63640[_0x793682][0x0]['context'],'exten':_0xe63640[_0x793682][0x0][_0x2087('0x8')],'priority':_0x343ae2[_0x2087('0xc')]++,'VoiceExtensionId':_0xe63640[_0x793682][0x0][_0x2087('0x13')]});}_0x343ae2[_0x2087('0x14')][_0x2087('0xf')]({'type':_0xe63640[_0x793682][0x0]['type'],'app':'Set','appdata':_0x2087('0x15')+_0xe63640[_0x793682][0x0]['VoiceExtensionId'],'context':_0xe63640[_0x793682][0x0]['context'],'exten':_0xe63640[_0x793682][0x0]['exten'],'priority':_0x343ae2[_0x2087('0xc')]++,'VoiceExtensionId':_0xe63640[_0x793682][0x0][_0x2087('0x13')]});var _0x31d076=_0x343ae2[_0x2087('0xc')]++;_0x343ae2[_0x2087('0x14')][_0x2087('0xf')]({'type':_0xe63640[_0x793682][0x0][_0x2087('0x10')],'app':_0x2087('0x19'),'appdata':_0x2087('0x1a')+(_0x31d076+0x2)+_0x2087('0x1b')+(_0x31d076+0x1)+')','context':_0xe63640[_0x793682][0x0][_0x2087('0x12')],'exten':_0xe63640[_0x793682][0x0][_0x2087('0x8')],'priority':_0x31d076,'VoiceExtensionId':_0xe63640[_0x793682][0x0][_0x2087('0x13')]});if(_0x343ae2[_0x2087('0xd')]){_0x343ae2[_0x2087('0x14')][_0x2087('0xf')]({'type':_0xe63640[_0x793682][0x0][_0x2087('0x10')],'app':'Set','appdata':_0x343ae2[_0x2087('0xd')]['cutdigits']?_0x2087('0x1c')+_0x343ae2[_0x2087('0xd')][_0x2087('0x17')]+'}':_0x2087('0x1d'),'context':_0xe63640[_0x793682][0x0][_0x2087('0x12')],'exten':_0xe63640[_0x793682][0x0][_0x2087('0x8')],'priority':_0x343ae2[_0x2087('0xc')]++,'VoiceExtensionId':_0xe63640[_0x793682][0x0][_0x2087('0x13')]});}_0x343ae2[_0x2087('0x14')][_0x2087('0xf')]({'type':_0xe63640[_0x793682][0x0][_0x2087('0x10')],'app':'Set','appdata':_0x2087('0x1e')+_0xe63640[_0x793682][0x0][_0x2087('0x13')],'context':_0xe63640[_0x793682][0x0][_0x2087('0x12')],'exten':_0xe63640[_0x793682][0x0][_0x2087('0x8')],'priority':_0x343ae2[_0x2087('0xc')]++,'VoiceExtensionId':_0xe63640[_0x793682][0x0][_0x2087('0x13')]});if(_0x343ae2[_0x2087('0xd')]&&_0x343ae2[_0x2087('0xd')][_0x2087('0xb')](_0x2087('0x1f'))&&_0x343ae2[_0x2087('0xd')][_0x2087('0x1f')]!==_0x2087('0x20')){_0x343ae2[_0x2087('0x14')][_0x2087('0xf')]({'type':_0xe63640[_0x793682][0x0][_0x2087('0x10')],'app':'Set','appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0xe63640[_0x793682][0x0][_0x2087('0x12')],'exten':_0xe63640[_0x793682][0x0][_0x2087('0x8')],'priority':_0x343ae2[_0x2087('0xc')]++,'VoiceExtensionId':_0xe63640[_0x793682][0x0][_0x2087('0x13')]});_0x343ae2[_0x2087('0x14')]['push']({'type':_0xe63640[_0x793682][0x0]['type'],'app':_0x2087('0x11'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x343ae2[_0x2087('0xd')][_0x2087('0x1f')]||_0x2087('0x21'),'context':_0xe63640[_0x793682][0x0][_0x2087('0x12')],'exten':_0xe63640[_0x793682][0x0][_0x2087('0x8')],'priority':_0x343ae2[_0x2087('0xc')]++,'VoiceExtensionId':_0xe63640[_0x793682][0x0][_0x2087('0x13')]});}}_0x343ae2[_0x2087('0x14')][_0x2087('0xf')]({'type':_0xe63640[_0x793682][0x0][_0x2087('0x10')],'app':'Set','appdata':_0x2087('0x22'),'context':_0xe63640[_0x793682][0x0][_0x2087('0x12')],'exten':_0xe63640[_0x793682][0x0][_0x2087('0x8')],'priority':_0x343ae2[_0x2087('0xc')]++,'VoiceExtensionId':_0xe63640[_0x793682][0x0][_0x2087('0x13')]});_0x343ae2[_0x2087('0x14')][_0x2087('0xf')]({'type':_0xe63640[_0x793682][0x0]['type'],'app':_0x2087('0x11'),'appdata':_0x2087('0x23'),'context':_0xe63640[_0x793682][0x0][_0x2087('0x12')],'exten':_0xe63640[_0x793682][0x0][_0x2087('0x8')],'priority':_0x343ae2[_0x2087('0xc')]++,'VoiceExtensionId':_0xe63640[_0x793682][0x0]['VoiceExtensionId']});_0x343ae2[_0x2087('0x14')]['push']({'type':_0xe63640[_0x793682][0x0][_0x2087('0x10')],'app':_0x2087('0x11'),'appdata':_0x2087('0x24'),'context':_0xe63640[_0x793682][0x0][_0x2087('0x12')],'exten':_0xe63640[_0x793682][0x0][_0x2087('0x8')],'priority':_0x343ae2[_0x2087('0xc')]++,'VoiceExtensionId':_0xe63640[_0x793682][0x0]['VoiceExtensionId']});for(var _0x262c90=0x0,_0x4d2daf=0x0;_0x262c90<_0xe63640[_0x793682][_0x2087('0x25')];_0x262c90+=0x1,_0x4d2daf=0x0){var _0x2a470e=_0xe63640[_0x793682][_0x262c90];if(_0x2a470e[_0x2087('0x10')]){_0x2a470e[_0x2087('0x10')]=_0x2a470e[_0x2087('0x10')][_0x2087('0x26')]();}var _0x54d64a=[];var _0x5478aa=[];delete _0x2a470e['id'];delete _0x2a470e['createdAt'];delete _0x2a470e[_0x2087('0x27')];var _0x424a41=_0x2a470e[_0x2087('0x28')]!=='*,*,*,*'?[_0x2a470e[_0x2087('0x28')]]:_0x2a470e[_0x2087('0x5')]?_[_0x2087('0x29')](_[_0x2087('0x9')](_0x343ae2[_0x2087('0x2a')],{'IntervalId':_0x2a470e['IntervalId']}),_0x2087('0x28')):[];if(_0x2a470e['hasOwnProperty'](_0x2087('0x2b'))){if(_0x2a470e[_0x2087('0x2b')]&&_0x2a470e['tag']!=='--'){_0x54d64a[_0x2087('0xf')]({'type':_0x2a470e[_0x2087('0x10')],'app':_0x2087('0x11'),'appdata':'CDR(tag)='+_0x2a470e[_0x2087('0x2b')],'context':_0x2a470e[_0x2087('0x12')],'exten':_0x2a470e[_0x2087('0x8')],'priority':_0x424a41[_0x2087('0x25')]+_0x343ae2[_0x2087('0xc')]+_0x4d2daf++,'VoiceExtensionId':_0x2a470e[_0x2087('0x13')]});}}if(_0x2a470e['type']==='outbound'&&_0x2a470e[_0x2087('0xb')]('callerID')){if(_0x2a470e['callerID']){_0x54d64a[_0x2087('0xf')]({'type':_0x2a470e[_0x2087('0x10')],'app':_0x2087('0x19'),'appdata':_0x2087('0x2c')+_0x2a470e[_0x2087('0x2d')]+')','context':_0x2a470e[_0x2087('0x12')],'exten':_0x2a470e['exten'],'priority':_0x424a41[_0x2087('0x25')]+_0x343ae2[_0x2087('0xc')]+_0x4d2daf++,'VoiceExtensionId':_0x2a470e['VoiceExtensionId']});}else{_0x54d64a[_0x2087('0xf')]({'type':_0x2a470e[_0x2087('0x10')],'app':_0x2087('0x19'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x2a470e['context'],'exten':_0x2a470e[_0x2087('0x8')],'priority':_0x424a41[_0x2087('0x25')]+_0x343ae2[_0x2087('0xc')]+_0x4d2daf++,'VoiceExtensionId':_0x2a470e['VoiceExtensionId']});}}if(_0x2a470e['hasOwnProperty'](_0x2087('0x2e'))){if(_0xe81af9['indexOf'](_0x2a470e[_0x2087('0x2f')][_0x2087('0x26')]())>=0x0&&_0x2a470e[_0x2087('0x30')]!==_0x2087('0x31')){if(_0x2a470e['answer']){_0x54d64a[_0x2087('0xf')]({'type':_0x2a470e['type'],'app':_0x2087('0x19'),'appdata':_0x2087('0x32'),'context':_0x2a470e[_0x2087('0x12')],'exten':_0x2a470e[_0x2087('0x8')],'priority':_0x424a41[_0x2087('0x25')]+_0x343ae2[_0x2087('0xc')]+_0x4d2daf++,'VoiceExtensionId':_0x2a470e[_0x2087('0x13')]});_0x54d64a['push']({'type':_0x2a470e[_0x2087('0x10')],'app':_0x2087('0x11'),'appdata':_0x2087('0x33'),'context':_0x2a470e['context'],'exten':_0x2a470e['exten'],'priority':_0x424a41[_0x2087('0x25')]+_0x343ae2[_0x2087('0xc')]+_0x4d2daf++,'VoiceExtensionId':_0x2a470e['VoiceExtensionId']});}else{_0x54d64a[_0x2087('0xf')]({'type':_0x2a470e['type'],'app':_0x2087('0x19'),'appdata':_0x2087('0x34'),'context':_0x2a470e[_0x2087('0x12')],'exten':_0x2a470e['exten'],'priority':_0x424a41[_0x2087('0x25')]+_0x343ae2[_0x2087('0xc')]+_0x4d2daf++,'VoiceExtensionId':_0x2a470e[_0x2087('0x13')]});_0x54d64a['push']({'type':_0x2a470e['type'],'app':_0x2087('0x11'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x2a470e['context'],'exten':_0x2a470e[_0x2087('0x8')],'priority':_0x424a41[_0x2087('0x25')]+_0x343ae2[_0x2087('0xc')]+_0x4d2daf++,'VoiceExtensionId':_0x2a470e['VoiceExtensionId']});}}}for(var _0x3bf1de=0x0;_0x3bf1de<_0x424a41[_0x2087('0x25')];_0x3bf1de+=0x1){var _0x201728=_0x343ae2['priority']+_0x424a41[_0x2087('0x25')];var _0x3e8cf9=_0x3bf1de===_0x424a41[_0x2087('0x25')]-0x1?_0x343ae2[_0x2087('0xc')]+_0x54d64a[_0x2087('0x25')]+_0x5478aa[_0x2087('0x25')]+0x2:_0x343ae2[_0x2087('0xc')]+_0x3bf1de+0x1;_0x54d64a['splice'](_0x3bf1de,0x0,{'type':_0x2a470e[_0x2087('0x10')],'app':'GotoIfTime','appdata':_0x424a41[_0x3bf1de]+'?'+_0x2a470e[_0x2087('0x12')]+_0x2087('0x35')+_0x201728+':'+_0x2a470e['context']+_0x2087('0x35')+_0x3e8cf9,'exten':_0x2a470e[_0x2087('0x8')],'context':_0x2a470e[_0x2087('0x12')],'priority':_0x343ae2[_0x2087('0xc')]+_0x3bf1de,'VoiceExtensionId':_0xe63640[_0x793682][0x0][_0x2087('0x13')]});}_0x2a470e[_0x2087('0xc')]=_0x54d64a['length']?_[_0x2087('0x36')](_0x54d64a)[_0x2087('0xc')]+0x1:_0x343ae2[_0x2087('0xc')];_0x343ae2['priority']=(_0x5478aa[_0x2087('0x25')]?_['last'](_0x5478aa)['priority']:_0x2a470e[_0x2087('0xc')])+0x1;_0x343ae2[_0x2087('0x14')]=_[_0x2087('0x37')](_0x343ae2['extensions'],_0x54d64a,[_0x2a470e],_0x5478aa);}_0x343ae2[_0x2087('0x14')][_0x2087('0xf')]({'type':_0xe63640[_0x793682][0x0][_0x2087('0x10')],'app':_0x2087('0x38'),'exten':_0xe63640[_0x793682][0x0]['exten'],'context':_0xe63640[_0x793682][0x0]['context'],'priority':_0x343ae2[_0x2087('0xc')],'VoiceExtensionId':_0xe63640[_0x793682][0x0][_0x2087('0x13')]});_0x5dfcdb[_0x2087('0xf')](_0xe63640[_0x793682][0x0][_0x2087('0x13')]);_0x1bda81=_[_0x2087('0x37')](_0x1bda81,_0x343ae2[_0x2087('0x14')]);}}return _0x110f19[_0x2087('0x39')](function(_0x214e4a){return _0x110f19[_0x2087('0x3')][_0x2087('0x3a')][_0x2087('0x3b')]({'where':{'VoiceExtensionId':{'$in':_0x5dfcdb}},'transaction':_0x214e4a})['then'](function(_0x5bd8f2){return _0x110f19[_0x2087('0x3')]['VoiceExtension']['bulkCreate'](_[_0x2087('0x3c')](_0x1bda81,_0x2087('0xc')),{'transaction':_0x214e4a});});});})[_0x2087('0x3d')](function(_0x476465){console[_0x2087('0x3e')](_0x476465);});}exports[_0x2087('0x3f')]=rewrite; \ No newline at end of file +var _0x386c=['type','context','VoiceExtensionId','CDR(routeid)=','outbound','CDR(destination)=','cutdigits','${EXTEN:','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','recordingFormat','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','toLowerCase','createdAt','interval','IntervalId','map','tag','CDR(tag)=','length','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','destroy','bulkCreate','sortBy','catch','error','lodash','util','models','Interval','findAll','then','intervals','VoiceExtension','uniq','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','hasOwnProperty','priority','extensions','extension','push','Set','format'];(function(_0x45f8bd,_0x1f5a27){var _0x5d77ff=function(_0x8cbd53){while(--_0x8cbd53){_0x45f8bd['push'](_0x45f8bd['shift']());}};_0x5d77ff(++_0x1f5a27);}(_0x386c,0x102));var _0xc386=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x386c[_0x178e48];return _0x440d7e;};'use strict';var _=require(_0xc386('0x0'));var util=require(_0xc386('0x1'));function rewrite(_0x2952f4,_0xa7843c){var _0x3d4be9=this;return _0x2952f4[_0xc386('0x2')][_0xc386('0x3')][_0xc386('0x4')]({'raw':!![]})[_0xc386('0x5')](function(_0x610b29){_0x3d4be9[_0xc386('0x6')]=_0x610b29;return _0x2952f4[_0xc386('0x2')][_0xc386('0x7')][_0xc386('0x4')]({'where':{'IntervalId':_0xa7843c['IntervalId']},'raw':!![]});})[_0xc386('0x5')](function(_0x3f688a){return _0x2952f4[_0xc386('0x2')]['VoiceExtension'][_0xc386('0x4')]({'where':{'exten':{'$in':_[_0xc386('0x8')](_['map'](_0x3f688a,_0xc386('0x9')))}},'order':[{'raw':_0xc386('0xa')}],'raw':!![]});})[_0xc386('0x5')](function(_0x583719){var _0x1516d6=_['filter'](_0x583719,{'priority':'1'});var _0x5c257c=_[_0xc386('0xb')](_0x583719,{'isApp':0x1});var _0x1ffc1d=_[_0xc386('0xc')](_0x5c257c,_0xc386('0x9'));var _0x36e954=[_0xc386('0xd'),_0xc386('0xe')];var _0xd941e=[];var _0x45cce8=[];for(var _0x21bb26 in _0x1ffc1d){if(_0x1ffc1d[_0xc386('0xf')](_0x21bb26)){_0x3d4be9[_0xc386('0x10')]=0x2;_0x3d4be9[_0xc386('0x11')]=[];_0x3d4be9[_0xc386('0x12')]=_['find'](_0x1516d6,{'exten':_0x1ffc1d[_0x21bb26][0x0][_0xc386('0x9')]});_0x3d4be9[_0xc386('0x11')][_0xc386('0x13')]({'type':_0x1ffc1d[_0x21bb26][0x0]['type'],'app':_0xc386('0x14'),'appdata':util[_0xc386('0x15')]('CDR(type)=%s',_0x1ffc1d[_0x21bb26][0x0][_0xc386('0x16')]),'context':_0x1ffc1d[_0x21bb26][0x0][_0xc386('0x17')],'exten':_0x1ffc1d[_0x21bb26][0x0][_0xc386('0x9')],'priority':_0x3d4be9[_0xc386('0x10')]++,'VoiceExtensionId':_0x1ffc1d[_0x21bb26][0x0][_0xc386('0x18')]});if(_0x1ffc1d[_0x21bb26][0x0][_0xc386('0x16')]==='inbound'){_0x3d4be9[_0xc386('0x11')][_0xc386('0x13')]({'type':_0x1ffc1d[_0x21bb26][0x0][_0xc386('0x16')],'app':_0xc386('0x14'),'appdata':_0xc386('0x19')+_0x1ffc1d[_0x21bb26][0x0][_0xc386('0x18')],'context':_0x1ffc1d[_0x21bb26][0x0][_0xc386('0x17')],'exten':_0x1ffc1d[_0x21bb26][0x0][_0xc386('0x9')],'priority':_0x3d4be9[_0xc386('0x10')]++,'VoiceExtensionId':_0x1ffc1d[_0x21bb26][0x0][_0xc386('0x18')]});}else if(_0x1ffc1d[_0x21bb26][0x0][_0xc386('0x16')]===_0xc386('0x1a')){if(_0x3d4be9[_0xc386('0x12')]){_0x3d4be9[_0xc386('0x11')]['push']({'type':_0x1ffc1d[_0x21bb26][0x0][_0xc386('0x16')],'app':_0xc386('0x14'),'appdata':_0xc386('0x1b')+(_0x3d4be9['extension'][_0xc386('0x1c')]?_0xc386('0x1d')+_0x3d4be9['extension'][_0xc386('0x1c')]+'}':'${EXTEN}'),'context':_0x1ffc1d[_0x21bb26][0x0][_0xc386('0x17')],'exten':_0x1ffc1d[_0x21bb26][0x0][_0xc386('0x9')],'priority':_0x3d4be9[_0xc386('0x10')]++,'VoiceExtensionId':_0x1ffc1d[_0x21bb26][0x0][_0xc386('0x18')]});}_0x3d4be9[_0xc386('0x11')][_0xc386('0x13')]({'type':_0x1ffc1d[_0x21bb26][0x0]['type'],'app':_0xc386('0x14'),'appdata':_0xc386('0x19')+_0x1ffc1d[_0x21bb26][0x0][_0xc386('0x18')],'context':_0x1ffc1d[_0x21bb26][0x0][_0xc386('0x17')],'exten':_0x1ffc1d[_0x21bb26][0x0]['exten'],'priority':_0x3d4be9[_0xc386('0x10')]++,'VoiceExtensionId':_0x1ffc1d[_0x21bb26][0x0][_0xc386('0x18')]});var _0x22c2f2=_0x3d4be9[_0xc386('0x10')]++;_0x3d4be9[_0xc386('0x11')][_0xc386('0x13')]({'type':_0x1ffc1d[_0x21bb26][0x0][_0xc386('0x16')],'app':_0xc386('0x1e'),'appdata':_0xc386('0x1f')+(_0x22c2f2+0x2)+'):Goto('+(_0x22c2f2+0x1)+')','context':_0x1ffc1d[_0x21bb26][0x0][_0xc386('0x17')],'exten':_0x1ffc1d[_0x21bb26][0x0][_0xc386('0x9')],'priority':_0x22c2f2,'VoiceExtensionId':_0x1ffc1d[_0x21bb26][0x0][_0xc386('0x18')]});if(_0x3d4be9['extension']){_0x3d4be9[_0xc386('0x11')][_0xc386('0x13')]({'type':_0x1ffc1d[_0x21bb26][0x0][_0xc386('0x16')],'app':_0xc386('0x14'),'appdata':_0x3d4be9['extension'][_0xc386('0x1c')]?_0xc386('0x20')+_0x3d4be9['extension']['cutdigits']+'}':_0xc386('0x21'),'context':_0x1ffc1d[_0x21bb26][0x0]['context'],'exten':_0x1ffc1d[_0x21bb26][0x0][_0xc386('0x9')],'priority':_0x3d4be9[_0xc386('0x10')]++,'VoiceExtensionId':_0x1ffc1d[_0x21bb26][0x0][_0xc386('0x18')]});}_0x3d4be9[_0xc386('0x11')][_0xc386('0x13')]({'type':_0x1ffc1d[_0x21bb26][0x0][_0xc386('0x16')],'app':'Set','appdata':_0xc386('0x22')+_0x1ffc1d[_0x21bb26][0x0][_0xc386('0x18')],'context':_0x1ffc1d[_0x21bb26][0x0][_0xc386('0x17')],'exten':_0x1ffc1d[_0x21bb26][0x0][_0xc386('0x9')],'priority':_0x3d4be9[_0xc386('0x10')]++,'VoiceExtensionId':_0x1ffc1d[_0x21bb26][0x0][_0xc386('0x18')]});if(_0x3d4be9['extension']&&_0x3d4be9[_0xc386('0x12')][_0xc386('0xf')]('recordingFormat')&&_0x3d4be9[_0xc386('0x12')]['recordingFormat']!=='none'){_0x3d4be9[_0xc386('0x11')][_0xc386('0x13')]({'type':_0x1ffc1d[_0x21bb26][0x0][_0xc386('0x16')],'app':_0xc386('0x14'),'appdata':_0xc386('0x23'),'context':_0x1ffc1d[_0x21bb26][0x0]['context'],'exten':_0x1ffc1d[_0x21bb26][0x0][_0xc386('0x9')],'priority':_0x3d4be9['priority']++,'VoiceExtensionId':_0x1ffc1d[_0x21bb26][0x0]['VoiceExtensionId']});_0x3d4be9[_0xc386('0x11')][_0xc386('0x13')]({'type':_0x1ffc1d[_0x21bb26][0x0]['type'],'app':_0xc386('0x14'),'appdata':_0xc386('0x24')+_0x3d4be9['extension'][_0xc386('0x25')]||_0xc386('0x26'),'context':_0x1ffc1d[_0x21bb26][0x0]['context'],'exten':_0x1ffc1d[_0x21bb26][0x0][_0xc386('0x9')],'priority':_0x3d4be9[_0xc386('0x10')]++,'VoiceExtensionId':_0x1ffc1d[_0x21bb26][0x0][_0xc386('0x18')]});}}_0x3d4be9['extensions'][_0xc386('0x13')]({'type':_0x1ffc1d[_0x21bb26][0x0]['type'],'app':_0xc386('0x14'),'appdata':_0xc386('0x27'),'context':_0x1ffc1d[_0x21bb26][0x0][_0xc386('0x17')],'exten':_0x1ffc1d[_0x21bb26][0x0][_0xc386('0x9')],'priority':_0x3d4be9['priority']++,'VoiceExtensionId':_0x1ffc1d[_0x21bb26][0x0][_0xc386('0x18')]});_0x3d4be9[_0xc386('0x11')][_0xc386('0x13')]({'type':_0x1ffc1d[_0x21bb26][0x0][_0xc386('0x16')],'app':_0xc386('0x14'),'appdata':_0xc386('0x28'),'context':_0x1ffc1d[_0x21bb26][0x0][_0xc386('0x17')],'exten':_0x1ffc1d[_0x21bb26][0x0][_0xc386('0x9')],'priority':_0x3d4be9[_0xc386('0x10')]++,'VoiceExtensionId':_0x1ffc1d[_0x21bb26][0x0][_0xc386('0x18')]});_0x3d4be9[_0xc386('0x11')][_0xc386('0x13')]({'type':_0x1ffc1d[_0x21bb26][0x0]['type'],'app':_0xc386('0x14'),'appdata':_0xc386('0x29'),'context':_0x1ffc1d[_0x21bb26][0x0][_0xc386('0x17')],'exten':_0x1ffc1d[_0x21bb26][0x0][_0xc386('0x9')],'priority':_0x3d4be9['priority']++,'VoiceExtensionId':_0x1ffc1d[_0x21bb26][0x0][_0xc386('0x18')]});for(var _0x2c84f1=0x0,_0x157d02=0x0;_0x2c84f1<_0x1ffc1d[_0x21bb26]['length'];_0x2c84f1+=0x1,_0x157d02=0x0){var _0xbb4d64=_0x1ffc1d[_0x21bb26][_0x2c84f1];if(_0xbb4d64[_0xc386('0x16')]){_0xbb4d64[_0xc386('0x16')]=_0xbb4d64[_0xc386('0x16')][_0xc386('0x2a')]();}var _0x7725dc=[];var _0x2daaab=[];delete _0xbb4d64['id'];delete _0xbb4d64[_0xc386('0x2b')];delete _0xbb4d64['updatedAt'];var _0x3b0316=_0xbb4d64[_0xc386('0x2c')]!=='*,*,*,*'?[_0xbb4d64[_0xc386('0x2c')]]:_0xbb4d64[_0xc386('0x2d')]?_[_0xc386('0x2e')](_['filter'](_0x3d4be9['intervals'],{'IntervalId':_0xbb4d64[_0xc386('0x2d')]}),_0xc386('0x2c')):[];if(_0xbb4d64[_0xc386('0xf')](_0xc386('0x2f'))){if(_0xbb4d64[_0xc386('0x2f')]&&_0xbb4d64['tag']!=='--'){_0x7725dc[_0xc386('0x13')]({'type':_0xbb4d64[_0xc386('0x16')],'app':'Set','appdata':_0xc386('0x30')+_0xbb4d64[_0xc386('0x2f')],'context':_0xbb4d64[_0xc386('0x17')],'exten':_0xbb4d64[_0xc386('0x9')],'priority':_0x3b0316[_0xc386('0x31')]+_0x3d4be9[_0xc386('0x10')]+_0x157d02++,'VoiceExtensionId':_0xbb4d64[_0xc386('0x18')]});}}if(_0xbb4d64[_0xc386('0x16')]===_0xc386('0x1a')&&_0xbb4d64[_0xc386('0xf')]('callerID')){if(_0xbb4d64[_0xc386('0x32')]){_0x7725dc[_0xc386('0x13')]({'type':_0xbb4d64[_0xc386('0x16')],'app':'ExecIf','appdata':_0xc386('0x33')+_0xbb4d64[_0xc386('0x32')]+')','context':_0xbb4d64['context'],'exten':_0xbb4d64[_0xc386('0x9')],'priority':_0x3b0316['length']+_0x3d4be9[_0xc386('0x10')]+_0x157d02++,'VoiceExtensionId':_0xbb4d64['VoiceExtensionId']});}else{_0x7725dc[_0xc386('0x13')]({'type':_0xbb4d64[_0xc386('0x16')],'app':'ExecIf','appdata':_0xc386('0x34'),'context':_0xbb4d64[_0xc386('0x17')],'exten':_0xbb4d64['exten'],'priority':_0x3b0316[_0xc386('0x31')]+_0x3d4be9[_0xc386('0x10')]+_0x157d02++,'VoiceExtensionId':_0xbb4d64[_0xc386('0x18')]});}}if(_0xbb4d64[_0xc386('0xf')](_0xc386('0x35'))){if(_0x36e954[_0xc386('0x36')](_0xbb4d64[_0xc386('0x37')]['toLowerCase']())>=0x0&&_0xbb4d64[_0xc386('0x38')]!==_0xc386('0x39')){if(_0xbb4d64[_0xc386('0x35')]){_0x7725dc['push']({'type':_0xbb4d64['type'],'app':_0xc386('0x1e'),'appdata':_0xc386('0x3a'),'context':_0xbb4d64[_0xc386('0x17')],'exten':_0xbb4d64[_0xc386('0x9')],'priority':_0x3b0316[_0xc386('0x31')]+_0x3d4be9['priority']+_0x157d02++,'VoiceExtensionId':_0xbb4d64[_0xc386('0x18')]});_0x7725dc[_0xc386('0x13')]({'type':_0xbb4d64[_0xc386('0x16')],'app':'Set','appdata':_0xc386('0x3b'),'context':_0xbb4d64[_0xc386('0x17')],'exten':_0xbb4d64[_0xc386('0x9')],'priority':_0x3b0316['length']+_0x3d4be9[_0xc386('0x10')]+_0x157d02++,'VoiceExtensionId':_0xbb4d64[_0xc386('0x18')]});}else{_0x7725dc[_0xc386('0x13')]({'type':_0xbb4d64['type'],'app':'ExecIf','appdata':_0xc386('0x3c'),'context':_0xbb4d64[_0xc386('0x17')],'exten':_0xbb4d64[_0xc386('0x9')],'priority':_0x3b0316['length']+_0x3d4be9[_0xc386('0x10')]+_0x157d02++,'VoiceExtensionId':_0xbb4d64[_0xc386('0x18')]});_0x7725dc[_0xc386('0x13')]({'type':_0xbb4d64[_0xc386('0x16')],'app':_0xc386('0x14'),'appdata':_0xc386('0x3d'),'context':_0xbb4d64['context'],'exten':_0xbb4d64[_0xc386('0x9')],'priority':_0x3b0316[_0xc386('0x31')]+_0x3d4be9[_0xc386('0x10')]+_0x157d02++,'VoiceExtensionId':_0xbb4d64[_0xc386('0x18')]});}}}for(var _0x4e382e=0x0;_0x4e382e<_0x3b0316[_0xc386('0x31')];_0x4e382e+=0x1){var _0x1d5096=_0x3d4be9[_0xc386('0x10')]+_0x3b0316['length'];var _0x18b943=_0x4e382e===_0x3b0316[_0xc386('0x31')]-0x1?_0x3d4be9[_0xc386('0x10')]+_0x7725dc[_0xc386('0x31')]+_0x2daaab[_0xc386('0x31')]+0x2:_0x3d4be9[_0xc386('0x10')]+_0x4e382e+0x1;_0x7725dc[_0xc386('0x3e')](_0x4e382e,0x0,{'type':_0xbb4d64[_0xc386('0x16')],'app':_0xc386('0x3f'),'appdata':_0x3b0316[_0x4e382e]+'?'+_0xbb4d64['context']+_0xc386('0x40')+_0x1d5096+':'+_0xbb4d64['context']+_0xc386('0x40')+_0x18b943,'exten':_0xbb4d64[_0xc386('0x9')],'context':_0xbb4d64['context'],'priority':_0x3d4be9[_0xc386('0x10')]+_0x4e382e,'VoiceExtensionId':_0x1ffc1d[_0x21bb26][0x0][_0xc386('0x18')]});}_0xbb4d64[_0xc386('0x10')]=_0x7725dc[_0xc386('0x31')]?_['last'](_0x7725dc)['priority']+0x1:_0x3d4be9[_0xc386('0x10')];_0x3d4be9[_0xc386('0x10')]=(_0x2daaab[_0xc386('0x31')]?_['last'](_0x2daaab)[_0xc386('0x10')]:_0xbb4d64[_0xc386('0x10')])+0x1;_0x3d4be9[_0xc386('0x11')]=_['concat'](_0x3d4be9['extensions'],_0x7725dc,[_0xbb4d64],_0x2daaab);}_0x3d4be9['extensions'][_0xc386('0x13')]({'type':_0x1ffc1d[_0x21bb26][0x0][_0xc386('0x16')],'app':'Hangup','exten':_0x1ffc1d[_0x21bb26][0x0]['exten'],'context':_0x1ffc1d[_0x21bb26][0x0]['context'],'priority':_0x3d4be9[_0xc386('0x10')],'VoiceExtensionId':_0x1ffc1d[_0x21bb26][0x0][_0xc386('0x18')]});_0xd941e[_0xc386('0x13')](_0x1ffc1d[_0x21bb26][0x0]['VoiceExtensionId']);_0x45cce8=_['concat'](_0x45cce8,_0x3d4be9['extensions']);}}return _0x2952f4['transaction'](function(_0x405652){return _0x2952f4[_0xc386('0x2')][_0xc386('0x7')][_0xc386('0x41')]({'where':{'VoiceExtensionId':{'$in':_0xd941e}},'transaction':_0x405652})['then'](function(_0x18bcf0){return _0x2952f4[_0xc386('0x2')][_0xc386('0x7')][_0xc386('0x42')](_[_0xc386('0x43')](_0x45cce8,_0xc386('0x10')),{'transaction':_0x405652});});});})[_0xc386('0x44')](function(_0xe515be){console[_0xc386('0x45')](_0xe515be);});}exports['rewrite']=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index c757c93..f8bb248 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 _0xbef0=['all','findAll','BlackLists','get','Campaign','Lists','CampaignId','onlyIfOpen','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','CSV\x20import\x20process\x20stopped!','resolve','parse','pause','info','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','papaparse','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','redis','defaults','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','null','Missing\x20filepath\x20parameter!','undefined','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','index','test','isNil','error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','birthDate','YYYY-MM-DD','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','duplicate','Duplicate\x20Contact','CmContact','create','keys','push','catch','Error\x20while\x20creating\x20contact:\x20','stringify','checkHopper','inspect','fromQuery','scheduledAt','ContactId','updatedAt','select','field','toString','NOW()','createdAt','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','from','cm_hopper','\x20=\x20?','into','id\x20IN\x20?','cm_hopper_final','insert','str','cm_hopper_black','VoiceQueue','outbound','dialCheckDuplicateType','CmList','then','always','sequelize','query','VoiceQueueId'];(function(_0x5aecd0,_0x306e01){var _0x3f883e=function(_0x562f99){while(--_0x562f99){_0x5aecd0['push'](_0x5aecd0['shift']());}};_0x3f883e(++_0x306e01);}(_0xbef0,0x1c7));var _0x0bef=function(_0x121ad2,_0x570f9c){_0x121ad2=_0x121ad2-0x0;var _0x23312c=_0xbef0[_0x121ad2];return _0x23312c;};'use strict';var BPromise=require(_0x0bef('0x0'));var util=require(_0x0bef('0x1'));var _=require(_0x0bef('0x2'));var fs=require('fs');var squel=require('squel');var Papa=require(_0x0bef('0x3'));var Redis=require(_0x0bef('0x4'));var db=require(_0x0bef('0x5'))['db'];var config=require(_0x0bef('0x6'));var logger=require(_0x0bef('0x7'))('api');config[_0x0bef('0x8')]=_[_0x0bef('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0bef('0xa'))(new Redis(config[_0x0bef('0x8')]));require(_0x0bef('0xb'))[_0x0bef('0xc')](socket);try{if(!process['argv'][0x2]||process[_0x0bef('0xd')][0x2]==='undefined'||process[_0x0bef('0xd')][0x2]===_0x0bef('0xe')){throw new Error(_0x0bef('0xf'));}var FILEPATH=process[_0x0bef('0xd')][0x2];if(!process[_0x0bef('0xd')][0x3]||process['argv'][0x3]==='undefined'||process[_0x0bef('0xd')][0x3]===_0x0bef('0xe')||!process[_0x0bef('0xd')][0x4]||process[_0x0bef('0xd')][0x4]===_0x0bef('0x10')||process[_0x0bef('0xd')][0x4]===_0x0bef('0xe')){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_[_0x0bef('0x11')](process['argv'][0x3][_0x0bef('0x12')](','),process[_0x0bef('0xd')][0x4][_0x0bef('0x12')](','));if(!process[_0x0bef('0xd')][0x5]||process[_0x0bef('0xd')][0x5]===_0x0bef('0x10')||process['argv'][0x5]==='null'){throw new Error(_0x0bef('0x13'));}var LISTID=process[_0x0bef('0xd')][0x5];var COMPANYID=process[_0x0bef('0xd')][0x6]&&process['argv'][0x6]!==_0x0bef('0x10')&&process[_0x0bef('0xd')][0x6]!==_0x0bef('0xe')?process[_0x0bef('0xd')][0x6]:null;var DUPLICATES=process[_0x0bef('0xd')][0x7]&&process['argv'][0x7]!==_0x0bef('0x10')&&process[_0x0bef('0xd')][0x7]!==_0x0bef('0xe')?process[_0x0bef('0xd')][0x7]:null;if(!process['argv'][0x8]||process[_0x0bef('0xd')][0x8]==='undefined'||process['argv'][0x8]===_0x0bef('0xe')){throw new Error(_0x0bef('0x14'));}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x4c8d97){logger['error'](_0x4c8d97);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(_0x464295,_0x559ea2,_0x53f4e2,_0xe47a69){var _0x44929f={'message':_0x559ea2};_0x44929f[_0x464295]=!![];if(_0x53f4e2){_0x44929f['contact']=_0x53f4e2;}if(_0xe47a69){_0x44929f[_0x0bef('0x15')]=_0xe47a69;}return _0x44929f;}function isEmail(_0x45f22e){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))*$/[_0x0bef('0x16')](_0x45f22e);}function checkRow(_0x42c3c8,_0x40704d,_0x115ddb){return new BPromise(function(_0x4f6dec,_0x1c3936){if(_[_0x0bef('0x17')](_0x42c3c8)){return _0x1c3936(handleCheckRowError(_0x0bef('0x18'),_0x0bef('0x19'),null,_0x115ddb));}if(_0x42c3c8[_0x0bef('0x1a')]&&_0x42c3c8[_0x0bef('0x1a')][_0x0bef('0x1b')]){var _0x3a3bfe=_['map'](_0x42c3c8[_0x0bef('0x1a')],_0x0bef('0x1c'))[_0x0bef('0x1d')](';');return _0x1c3936(handleCheckRowError(_0x0bef('0x18'),_0x3a3bfe,null,_0x115ddb));}var _0x4f736c={};for(var _0x455516 in FIELDS){if(FIELDS[_0x0bef('0x1e')](_0x455516)&&FIELDS[_0x455516]){_0x4f736c[_0x455516]=_0x42c3c8[_0x0bef('0x1f')][0x0][FIELDS[_0x455516]]||_0x42c3c8[_0x0bef('0x1f')][0x0]['\ufeff'+FIELDS[_0x455516]];}}if(!_0x4f736c[_0x0bef('0x20')]){return _0x1c3936(handleCheckRowError('error',_0x0bef('0x21'),null,_0x115ddb));}if(!_0x4f736c[_0x0bef('0x22')]){return _0x1c3936(handleCheckRowError(_0x0bef('0x18'),'phone\x20not\x20specified!',null,_0x115ddb));}if(_0x4f736c[_0x0bef('0x23')]){var _0x50230e=moment(_0x4f736c[_0x0bef('0x23')],_0x0bef('0x24'));if(!_0x50230e['isValid']()){return _0x1c3936(handleCheckRowError(_0x0bef('0x18'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x115ddb));}}if(_0x4f736c[_0x0bef('0x25')]){if(!isEmail(_0x4f736c['email'])){return _0x1c3936(handleCheckRowError(_0x0bef('0x18'),_0x0bef('0x26'),null,_0x115ddb));}}_0x4f736c[_0x0bef('0x27')]=LISTID;_0x4f736c[_0x0bef('0x28')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x40704d){var _0x14149e={};for(var _0x186cfa=0x0,_0x4b7b46=DUPLICATES[_0x0bef('0x1b')];_0x186cfa<_0x4b7b46;_0x186cfa+=0x1){_0x14149e[DUPLICATES[_0x186cfa]]=_0x4f736c[DUPLICATES[_0x186cfa]];}var _0x5cc294=_['find'](_0x40704d,_0x14149e);if(_0x5cc294){return _0x1c3936(handleCheckRowError(_0x0bef('0x29'),_0x0bef('0x2a'),_0x5cc294,_0x115ddb));}}return db[_0x0bef('0x2b')][_0x0bef('0x2c')](_0x4f736c,{'raw':!![],'hooks':![],'fields':_[_0x0bef('0x2d')](_0x4f736c)})['then'](function(_0xb85baa){if(DUPLICATES&&DUPLICATES[_0x0bef('0x1b')]&&_0x40704d){_0x40704d[_0x0bef('0x2e')](_['pick'](_0x4f736c,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0xb85baa['id'];return _0x4f6dec();})[_0x0bef('0x2f')](function(_0x496609){return _0x1c3936(handleCheckRowError('error',_0x0bef('0x30')+(_0x496609[_0x0bef('0x1c')]||JSON[_0x0bef('0x31')](_0x496609)),null,_0x115ddb));});});}function checkHopper(){function _0x2f49ce(){return function(_0x3af28c){logger[_0x0bef('0x18')]('cmContact',_0x0bef('0x32'),util[_0x0bef('0x33')](_0x3af28c,{'showHidden':![],'depth':null}));};}var _0x6a3e2=function(_0xa32932,_0x1799ad){var _0x50901f=squel['insert']()['into']('cm_hopper')[_0x0bef('0x34')](['phone',_0x0bef('0x35'),_0x0bef('0x36'),_0x0bef('0x27'),_0x1799ad,'createdAt',_0x0bef('0x37')],squel[_0x0bef('0x38')]()[_0x0bef('0x39')](_0x0bef('0x22'),'phone')[_0x0bef('0x39')]('NOW()','scheduledAt')[_0x0bef('0x39')]('id',_0x0bef('0x36'))[_0x0bef('0x39')](LISTID[_0x0bef('0x3a')](),_0x0bef('0x27'))[_0x0bef('0x39')](_0xa32932['id'][_0x0bef('0x3a')](),_0x1799ad)[_0x0bef('0x39')](_0x0bef('0x3b'),_0x0bef('0x3c'))[_0x0bef('0x39')](_0x0bef('0x3b'),_0x0bef('0x37'))['from'](_0x0bef('0x3d'))[_0x0bef('0x3e')](_0x0bef('0x3f'))['where'](_0x0bef('0x40'),LISTID[_0x0bef('0x3a')]())[_0x0bef('0x3e')](_0x0bef('0x41'))['where'](_0x0bef('0x42'),squel['select']()[_0x0bef('0x39')]('phone')[_0x0bef('0x43')](_0x0bef('0x44'))['where'](_0x1799ad+_0x0bef('0x45'),_0xa32932['id']['toString']())))[_0x0bef('0x3a')]();return _0x50901f;};var _0x3f6af3=function(_0x20ee88,_0x32db77){var _0x23d17a=squel['insert']()[_0x0bef('0x46')](_0x0bef('0x44'))[_0x0bef('0x34')]([_0x0bef('0x22'),_0x0bef('0x35'),'ContactId',_0x0bef('0x27'),_0x32db77,_0x0bef('0x3c'),_0x0bef('0x37')],squel[_0x0bef('0x38')]()[_0x0bef('0x39')](_0x0bef('0x22'),_0x0bef('0x22'))[_0x0bef('0x39')](_0x0bef('0x3b'),_0x0bef('0x35'))[_0x0bef('0x39')]('id',_0x0bef('0x36'))[_0x0bef('0x39')](LISTID[_0x0bef('0x3a')](),'ListId')['field'](_0x20ee88['id'][_0x0bef('0x3a')](),_0x32db77)['field']('NOW()',_0x0bef('0x3c'))['field'](_0x0bef('0x3b'),_0x0bef('0x37'))[_0x0bef('0x43')]('cm_contacts')[_0x0bef('0x3e')](_0x0bef('0x3f'))['where'](_0x0bef('0x40'),LISTID[_0x0bef('0x3a')]())['where'](_0x0bef('0x47'),squel['str'](hopperContacts))[_0x0bef('0x3e')](_0x0bef('0x41'))[_0x0bef('0x3e')](_0x0bef('0x42'),squel[_0x0bef('0x38')]()['field']('calleridnum')[_0x0bef('0x43')](_0x0bef('0x48'))['where'](_0x32db77+_0x0bef('0x45'),_0x20ee88['id'][_0x0bef('0x3a')]()))[_0x0bef('0x3e')](_0x0bef('0x42'),squel[_0x0bef('0x38')]()['field'](_0x0bef('0x22'))[_0x0bef('0x43')](_0x0bef('0x44'))[_0x0bef('0x3e')](_0x32db77+_0x0bef('0x45'),_0x20ee88['id']['toString']())))[_0x0bef('0x3a')]();return _0x23d17a;};function _0x1864cc(_0x4729d1,_0x653350){var _0x5598cd=squel[_0x0bef('0x49')]()[_0x0bef('0x46')]('cm_hopper')[_0x0bef('0x34')]([_0x0bef('0x22'),_0x0bef('0x35'),_0x0bef('0x36'),_0x0bef('0x27'),_0x653350,_0x0bef('0x3c'),_0x0bef('0x37')],squel[_0x0bef('0x38')]()['field'](_0x0bef('0x22'),_0x0bef('0x22'))[_0x0bef('0x39')](_0x0bef('0x3b'),_0x0bef('0x35'))[_0x0bef('0x39')]('id',_0x0bef('0x36'))[_0x0bef('0x39')](LISTID['toString'](),_0x0bef('0x27'))['field'](_0x4729d1['id']['toString'](),_0x653350)['field'](_0x0bef('0x3b'),_0x0bef('0x3c'))[_0x0bef('0x39')](_0x0bef('0x3b'),_0x0bef('0x37'))[_0x0bef('0x43')]('cm_contacts')[_0x0bef('0x3e')](_0x0bef('0x3f'))['where']('ListId\x20=\x20?',LISTID[_0x0bef('0x3a')]())[_0x0bef('0x3e')](_0x0bef('0x47'),squel[_0x0bef('0x4a')](hopperContacts))[_0x0bef('0x3e')](_0x0bef('0x41')))[_0x0bef('0x3a')]();return _0x5598cd;}function _0x107fff(_0x248dc5,_0x5d98eb){var _0x2c3b22=squel[_0x0bef('0x49')]()[_0x0bef('0x46')](_0x0bef('0x4b'))[_0x0bef('0x34')]([_0x0bef('0x22'),_0x0bef('0x36'),_0x0bef('0x27'),_0x5d98eb,_0x0bef('0x3c'),_0x0bef('0x37')],squel[_0x0bef('0x38')]()['field']('phone','phone')[_0x0bef('0x39')]('id',_0x0bef('0x36'))[_0x0bef('0x39')](LISTID[_0x0bef('0x3a')](),_0x0bef('0x27'))[_0x0bef('0x39')](_0x248dc5['id'][_0x0bef('0x3a')](),_0x5d98eb)[_0x0bef('0x39')](_0x0bef('0x3b'),_0x0bef('0x3c'))['field'](_0x0bef('0x3b'),_0x0bef('0x37'))[_0x0bef('0x43')]('cm_contacts')[_0x0bef('0x3e')]('deletedAt\x20IS\x20NULL')[_0x0bef('0x3e')](_0x0bef('0x40'),LISTID[_0x0bef('0x3a')]())[_0x0bef('0x3e')]('id\x20IN\x20?',squel[_0x0bef('0x4a')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL'))['toString']();return _0x2c3b22;}return db[_0x0bef('0x4c')]['findAll']({'where':{'type':_0x0bef('0x4d')},'attributes':['id',_0x0bef('0x4e')],'include':[{'model':db[_0x0bef('0x4f')],'as':'Lists','where':{'id':LISTID}}]})[_0x0bef('0x50')](function(_0x159faa){var _0x2c7329=[];if(_0x159faa){var _0x244a74;for(var _0x4bbe04=0x0,_0x4dc9d3;_0x4bbe04<_0x159faa[_0x0bef('0x1b')];_0x4bbe04+=0x1){_0x4dc9d3=_0x159faa[_0x4bbe04]['get']({'plain':!![]});switch(_0x4dc9d3[_0x0bef('0x4e')]){case _0x0bef('0x51'):_0x2c7329[_0x0bef('0x2e')](db[_0x0bef('0x52')][_0x0bef('0x53')](_0x3f6af3(_0x4dc9d3,_0x0bef('0x54')))[_0x0bef('0x50')](function(){})[_0x0bef('0x2f')](_0x2f49ce()));break;case'onlyIfOpen':_0x2c7329[_0x0bef('0x2e')](db['sequelize']['query'](_0x6a3e2(_0x4dc9d3,'VoiceQueueId'))[_0x0bef('0x50')](function(){})[_0x0bef('0x2f')](_0x2f49ce()));break;default:_0x2c7329[_0x0bef('0x2e')](db[_0x0bef('0x52')][_0x0bef('0x53')](_0x1864cc(_0x4dc9d3,'VoiceQueueId'))['then'](function(){})[_0x0bef('0x2f')](_0x2f49ce()));}}}return _0x2c7329;})[_0x0bef('0x55')]()[_0x0bef('0x50')](function(){return db['VoiceQueue'][_0x0bef('0x56')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db[_0x0bef('0x4f')],'as':_0x0bef('0x57'),'where':{'id':LISTID}}]})[_0x0bef('0x50')](function(_0x4b6d24){var _0x247edd=[];if(_0x4b6d24){var _0x2756f1;for(var _0x4d424e=0x0,_0x30fa99;_0x4d424e<_0x4b6d24[_0x0bef('0x1b')];_0x4d424e+=0x1){_0x30fa99=_0x4b6d24[_0x4d424e][_0x0bef('0x58')]({'plain':!![]});_0x247edd[_0x0bef('0x2e')](db[_0x0bef('0x52')][_0x0bef('0x53')](_0x107fff(_0x30fa99,_0x0bef('0x54')))['then'](function(){})[_0x0bef('0x2f')](_0x2f49ce()));}}return _0x247edd;})[_0x0bef('0x55')]();})[_0x0bef('0x50')](function(){return db[_0x0bef('0x59')][_0x0bef('0x56')]({'attributes':['id',_0x0bef('0x4e')],'include':[{'model':db[_0x0bef('0x4f')],'as':_0x0bef('0x5a'),'where':{'id':LISTID}}]})[_0x0bef('0x50')](function(_0x1cd251){var _0x1890b7=[];if(_0x1cd251){for(var _0x10f8b3=0x0,_0x4544aa;_0x10f8b3<_0x1cd251['length'];_0x10f8b3+=0x1){_0x4544aa=_0x1cd251[_0x10f8b3][_0x0bef('0x58')]({'plain':!![]});switch(_0x4544aa[_0x0bef('0x4e')]){case _0x0bef('0x51'):_0x1890b7[_0x0bef('0x2e')](db['sequelize'][_0x0bef('0x53')](_0x3f6af3(_0x4544aa,_0x0bef('0x5b')))[_0x0bef('0x50')](function(){})['catch'](_0x2f49ce()));break;case _0x0bef('0x5c'):_0x1890b7[_0x0bef('0x2e')](db[_0x0bef('0x52')][_0x0bef('0x53')](_0x6a3e2(_0x4544aa,_0x0bef('0x5b')))[_0x0bef('0x50')](function(){})[_0x0bef('0x2f')](_0x2f49ce()));break;default:_0x1890b7[_0x0bef('0x2e')](db[_0x0bef('0x52')][_0x0bef('0x53')](_0x1864cc(_0x4544aa,'CampaignId'))[_0x0bef('0x50')](function(){})['catch'](_0x2f49ce()));}}}return _0x1890b7;})[_0x0bef('0x55')]();})[_0x0bef('0x50')](function(){return db[_0x0bef('0x59')][_0x0bef('0x56')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x0bef('0x57'),'where':{'id':LISTID}}]})[_0x0bef('0x50')](function(_0x266a0b){var _0x1d03ee=[];if(_0x266a0b){for(var _0x5e06d5=0x0,_0x266e1c;_0x5e06d5<_0x266a0b['length'];_0x5e06d5+=0x1){_0x266e1c=_0x266a0b[_0x5e06d5][_0x0bef('0x58')]({'plain':!![]});_0x1d03ee[_0x0bef('0x2e')](db[_0x0bef('0x52')][_0x0bef('0x53')](_0x107fff(_0x266e1c,'CampaignId'))['then'](function(){})['catch'](_0x2f49ce()));}}return _0x1d03ee;})[_0x0bef('0x55')]();})[_0x0bef('0x2f')](function(_0x95b7){logger[_0x0bef('0x18')]('cmContact,\x20%s,\x20%s',_0x0bef('0x5d'),_0x95b7[_0x0bef('0x1c')]);});}var processPromises=function(_0x4e7e25){return BPromise[_0x0bef('0x55')](promises)[_0x0bef('0x50')](function(_0xeff0bc){})['catch'](function(_0xfcc895){logger['error'](_0x0bef('0x5e'),JSON[_0x0bef('0x31')](_0xfcc895));})[_0x0bef('0x5f')](function(){socket[_0x0bef('0x60')](_0x0bef('0x61')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x4e7e25){return _0x4e7e25['resume']();}});};var endCsv=function(){return BPromise['resolve']()[_0x0bef('0x50')](function(){if(hopperContacts){return checkHopper();}})[_0x0bef('0x50')](function(){socket[_0x0bef('0x60')](_0x0bef('0x61')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x0bef('0x62')](FILEPATH);}catch(_0x5a5860){logger[_0x0bef('0x18')](_0x0bef('0x63'),JSON[_0x0bef('0x31')](_0x5a5860));}finally{process['exit'](0x0);}});};process['on']('SIGINT',function(){logger['info'](_0x0bef('0x64'));endCsv();});function main(){return BPromise[_0x0bef('0x65')]()[_0x0bef('0x50')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x0bef('0x12')](',');return db[_0x0bef('0x2b')][_0x0bef('0x56')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x0bef('0x50')](function(_0x5c0e96){var _0x19212a=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x0bef('0x66')](_0x19212a,{'header':!![],'skipEmptyLines':!![],'step':function(_0x237aab,_0x1066bf){total+=0x1;var _0x5ad332=total;promises[_0x0bef('0x2e')](checkRow(_0x237aab,_0x5c0e96,_0x5ad332)[_0x0bef('0x50')](function(){success+=0x1;})[_0x0bef('0x2f')](function(_0x2f2540){if(_0x2f2540['error']){errors+=0x1;delete _0x2f2540[_0x0bef('0x18')];}else if(_0x2f2540[_0x0bef('0x29')]){duplicates+=0x1;delete _0x2f2540['duplicate'];}rows[_0x0bef('0x2e')](_0x2f2540);}));if(total%0xc8===0x0){_0x1066bf[_0x0bef('0x67')]();return processPromises(_0x1066bf);}},'complete':function(){return processPromises()[_0x0bef('0x50')](function(){logger[_0x0bef('0x68')](_0x0bef('0x69'));endCsv();});},'error':function(_0x4baf91,_0x2dc5f8){logger['info'](_0x0bef('0x6a'),JSON[_0x0bef('0x31')](_0x4baf91));endCsv();}});})[_0x0bef('0x2f')](function(_0x3c83e0){logger[_0x0bef('0x18')](_0x0bef('0x6b'),JSON[_0x0bef('0x31')](_0x3c83e0));});}main(); \ No newline at end of file +var _0x4057=['phone\x20IS\x20NOT\x20NULL','cm_hopper','\x20=\x20?','fromQuery','updatedAt','select','cm_contacts','str','phone\x20NOT\x20IN\x20(?)','calleridnum','cm_hopper_final','id\x20IN\x20?','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','get','always','sequelize','query','VoiceQueueId','onlyIfOpen','BlackLists','all','Campaign','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','resolve','createReadStream','duplicate','pause','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','squel','papaparse','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','split','Missing\x20socket_timestamp\x20parameter!','error','contact','test','isNil','errors','length','map','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','Duplicate\x20Contact','CmContact','create','then','push','catch','message','stringify','cmContact','checkHopper','insert','into','scheduledAt','ContactId','ListId','createdAt','field','toString','NOW()','from','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4057,0x95));var _0x7405=function(_0x596f6e,_0x3f8857){_0x596f6e=_0x596f6e-0x0;var _0x1e0803=_0x4057[_0x596f6e];return _0x1e0803;};'use strict';var BPromise=require(_0x7405('0x0'));var util=require(_0x7405('0x1'));var _=require(_0x7405('0x2'));var fs=require('fs');var squel=require(_0x7405('0x3'));var Papa=require(_0x7405('0x4'));var Redis=require('ioredis');var db=require(_0x7405('0x5'))['db'];var config=require(_0x7405('0x6'));var logger=require(_0x7405('0x7'))(_0x7405('0x8'));config[_0x7405('0x9')]=_['defaults'](config[_0x7405('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x7405('0xa'))(new Redis(config[_0x7405('0x9')]));require(_0x7405('0xb'))[_0x7405('0xc')](socket);try{if(!process['argv'][0x2]||process[_0x7405('0xd')][0x2]===_0x7405('0xe')||process[_0x7405('0xd')][0x2]===_0x7405('0xf')){throw new Error(_0x7405('0x10'));}var FILEPATH=process['argv'][0x2];if(!process[_0x7405('0xd')][0x3]||process[_0x7405('0xd')][0x3]===_0x7405('0xe')||process[_0x7405('0xd')][0x3]===_0x7405('0xf')||!process[_0x7405('0xd')][0x4]||process['argv'][0x4]===_0x7405('0xe')||process[_0x7405('0xd')][0x4]===_0x7405('0xf')){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_['zipObject'](process[_0x7405('0xd')][0x3][_0x7405('0x11')](','),process['argv'][0x4][_0x7405('0x11')](','));if(!process[_0x7405('0xd')][0x5]||process[_0x7405('0xd')][0x5]===_0x7405('0xe')||process[_0x7405('0xd')][0x5]==='null'){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0x7405('0xd')][0x5];var COMPANYID=process['argv'][0x6]&&process['argv'][0x6]!==_0x7405('0xe')&&process[_0x7405('0xd')][0x6]!=='null'?process['argv'][0x6]:null;var DUPLICATES=process[_0x7405('0xd')][0x7]&&process[_0x7405('0xd')][0x7]!=='undefined'&&process['argv'][0x7]!==_0x7405('0xf')?process[_0x7405('0xd')][0x7]:null;if(!process[_0x7405('0xd')][0x8]||process['argv'][0x8]===_0x7405('0xe')||process[_0x7405('0xd')][0x8]==='null'){throw new Error(_0x7405('0x12'));}var SOCKET_TIMESTAMP=process[_0x7405('0xd')][0x8];}catch(_0xdd7e41){logger[_0x7405('0x13')](_0xdd7e41);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(_0x16698d,_0x307b76,_0x285ee0,_0x13ae63){var _0x6fb14={'message':_0x307b76};_0x6fb14[_0x16698d]=!![];if(_0x285ee0){_0x6fb14[_0x7405('0x14')]=_0x285ee0;}if(_0x13ae63){_0x6fb14['index']=_0x13ae63;}return _0x6fb14;}function isEmail(_0x50e27e){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))*$/[_0x7405('0x15')](_0x50e27e);}function checkRow(_0x183032,_0x420460,_0x38fdf5){return new BPromise(function(_0x37b786,_0x43afb9){if(_[_0x7405('0x16')](_0x183032)){return _0x43afb9(handleCheckRowError(_0x7405('0x13'),'The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x38fdf5));}if(_0x183032[_0x7405('0x17')]&&_0x183032['errors'][_0x7405('0x18')]){var _0x38918c=_[_0x7405('0x19')](_0x183032['errors'],'message')['join'](';');return _0x43afb9(handleCheckRowError('error',_0x38918c,null,_0x38fdf5));}var _0x4c1b02={};for(var _0x410a01 in FIELDS){if(FIELDS[_0x7405('0x1a')](_0x410a01)&&FIELDS[_0x410a01]){_0x4c1b02[_0x410a01]=_0x183032[_0x7405('0x1b')][0x0][FIELDS[_0x410a01]]||_0x183032['data'][0x0]['\ufeff'+FIELDS[_0x410a01]];}}if(!_0x4c1b02[_0x7405('0x1c')]){return _0x43afb9(handleCheckRowError(_0x7405('0x13'),_0x7405('0x1d'),null,_0x38fdf5));}if(!_0x4c1b02[_0x7405('0x1e')]){return _0x43afb9(handleCheckRowError(_0x7405('0x13'),_0x7405('0x1f'),null,_0x38fdf5));}if(_0x4c1b02['birthDate']){var _0x18da94=moment(_0x4c1b02[_0x7405('0x20')],_0x7405('0x21'));if(!_0x18da94[_0x7405('0x22')]()){return _0x43afb9(handleCheckRowError('error',_0x7405('0x23'),null,_0x38fdf5));}}if(_0x4c1b02[_0x7405('0x24')]){if(!isEmail(_0x4c1b02[_0x7405('0x24')])){return _0x43afb9(handleCheckRowError(_0x7405('0x13'),_0x7405('0x25'),null,_0x38fdf5));}}_0x4c1b02['ListId']=LISTID;_0x4c1b02['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x7405('0x18')]&&_0x420460){var _0xbe346e={};for(var _0x1ed24f=0x0,_0x262e3c=DUPLICATES[_0x7405('0x18')];_0x1ed24f<_0x262e3c;_0x1ed24f+=0x1){_0xbe346e[DUPLICATES[_0x1ed24f]]=_0x4c1b02[DUPLICATES[_0x1ed24f]];}var _0x5964f1=_['find'](_0x420460,_0xbe346e);if(_0x5964f1){return _0x43afb9(handleCheckRowError('duplicate',_0x7405('0x26'),_0x5964f1,_0x38fdf5));}}return db[_0x7405('0x27')][_0x7405('0x28')](_0x4c1b02,{'raw':!![],'hooks':![],'fields':_['keys'](_0x4c1b02)})[_0x7405('0x29')](function(_0x48deb9){if(DUPLICATES&&DUPLICATES[_0x7405('0x18')]&&_0x420460){_0x420460[_0x7405('0x2a')](_['pick'](_0x4c1b02,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x48deb9['id'];return _0x37b786();})[_0x7405('0x2b')](function(_0x361f29){return _0x43afb9(handleCheckRowError(_0x7405('0x13'),'Error\x20while\x20creating\x20contact:\x20'+(_0x361f29[_0x7405('0x2c')]||JSON[_0x7405('0x2d')](_0x361f29)),null,_0x38fdf5));});});}function checkHopper(){function _0x248a89(){return function(_0x1ab5ae){logger[_0x7405('0x13')](_0x7405('0x2e'),_0x7405('0x2f'),util['inspect'](_0x1ab5ae,{'showHidden':![],'depth':null}));};}var _0x3513c5=function(_0x4cd951,_0x1ed79b){var _0x3a09d9=squel[_0x7405('0x30')]()[_0x7405('0x31')]('cm_hopper')['fromQuery']([_0x7405('0x1e'),_0x7405('0x32'),_0x7405('0x33'),_0x7405('0x34'),_0x1ed79b,_0x7405('0x35'),'updatedAt'],squel['select']()['field'](_0x7405('0x1e'),_0x7405('0x1e'))[_0x7405('0x36')]('NOW()',_0x7405('0x32'))[_0x7405('0x36')]('id',_0x7405('0x33'))['field'](LISTID[_0x7405('0x37')](),'ListId')['field'](_0x4cd951['id']['toString'](),_0x1ed79b)[_0x7405('0x36')](_0x7405('0x38'),'createdAt')['field'](_0x7405('0x38'),'updatedAt')[_0x7405('0x39')]('cm_contacts')[_0x7405('0x3a')](_0x7405('0x3b'))['where'](_0x7405('0x3c'),LISTID['toString']())[_0x7405('0x3a')](_0x7405('0x3d'))[_0x7405('0x3a')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x7405('0x36')](_0x7405('0x1e'))['from'](_0x7405('0x3e'))[_0x7405('0x3a')](_0x1ed79b+_0x7405('0x3f'),_0x4cd951['id']['toString']())))[_0x7405('0x37')]();return _0x3a09d9;};var _0x421c2c=function(_0x455daa,_0x185488){var _0x28f8ae=squel[_0x7405('0x30')]()[_0x7405('0x31')]('cm_hopper')[_0x7405('0x40')](['phone','scheduledAt',_0x7405('0x33'),_0x7405('0x34'),_0x185488,_0x7405('0x35'),_0x7405('0x41')],squel[_0x7405('0x42')]()[_0x7405('0x36')]('phone',_0x7405('0x1e'))['field'](_0x7405('0x38'),_0x7405('0x32'))['field']('id','ContactId')['field'](LISTID[_0x7405('0x37')](),_0x7405('0x34'))[_0x7405('0x36')](_0x455daa['id']['toString'](),_0x185488)[_0x7405('0x36')](_0x7405('0x38'),'createdAt')[_0x7405('0x36')](_0x7405('0x38'),'updatedAt')[_0x7405('0x39')](_0x7405('0x43'))[_0x7405('0x3a')](_0x7405('0x3b'))[_0x7405('0x3a')](_0x7405('0x3c'),LISTID[_0x7405('0x37')]())[_0x7405('0x3a')]('id\x20IN\x20?',squel[_0x7405('0x44')](hopperContacts))[_0x7405('0x3a')](_0x7405('0x3d'))['where'](_0x7405('0x45'),squel[_0x7405('0x42')]()['field'](_0x7405('0x46'))[_0x7405('0x39')](_0x7405('0x47'))[_0x7405('0x3a')](_0x185488+_0x7405('0x3f'),_0x455daa['id'][_0x7405('0x37')]()))[_0x7405('0x3a')](_0x7405('0x45'),squel['select']()[_0x7405('0x36')](_0x7405('0x1e'))[_0x7405('0x39')](_0x7405('0x3e'))[_0x7405('0x3a')](_0x185488+_0x7405('0x3f'),_0x455daa['id'][_0x7405('0x37')]())))[_0x7405('0x37')]();return _0x28f8ae;};function _0x2740a3(_0x1283af,_0x248e60){var _0x4d7cac=squel[_0x7405('0x30')]()[_0x7405('0x31')](_0x7405('0x3e'))['fromQuery']([_0x7405('0x1e'),_0x7405('0x32'),'ContactId',_0x7405('0x34'),_0x248e60,'createdAt',_0x7405('0x41')],squel['select']()[_0x7405('0x36')](_0x7405('0x1e'),'phone')[_0x7405('0x36')](_0x7405('0x38'),_0x7405('0x32'))[_0x7405('0x36')]('id','ContactId')[_0x7405('0x36')](LISTID['toString'](),_0x7405('0x34'))[_0x7405('0x36')](_0x1283af['id'][_0x7405('0x37')](),_0x248e60)[_0x7405('0x36')](_0x7405('0x38'),'createdAt')['field'](_0x7405('0x38'),'updatedAt')[_0x7405('0x39')](_0x7405('0x43'))[_0x7405('0x3a')](_0x7405('0x3b'))['where'](_0x7405('0x3c'),LISTID['toString']())[_0x7405('0x3a')](_0x7405('0x48'),squel[_0x7405('0x44')](hopperContacts))[_0x7405('0x3a')]('phone\x20IS\x20NOT\x20NULL'))[_0x7405('0x37')]();return _0x4d7cac;}function _0x58ad44(_0x3ed2bd,_0x4d2927){var _0x1f9a7d=squel[_0x7405('0x30')]()[_0x7405('0x31')]('cm_hopper_black')['fromQuery'](['phone',_0x7405('0x33'),'ListId',_0x4d2927,_0x7405('0x35'),'updatedAt'],squel[_0x7405('0x42')]()[_0x7405('0x36')](_0x7405('0x1e'),_0x7405('0x1e'))['field']('id',_0x7405('0x33'))[_0x7405('0x36')](LISTID[_0x7405('0x37')](),_0x7405('0x34'))[_0x7405('0x36')](_0x3ed2bd['id'][_0x7405('0x37')](),_0x4d2927)[_0x7405('0x36')](_0x7405('0x38'),'createdAt')['field'](_0x7405('0x38'),_0x7405('0x41'))['from']('cm_contacts')[_0x7405('0x3a')]('deletedAt\x20IS\x20NULL')[_0x7405('0x3a')]('ListId\x20=\x20?',LISTID[_0x7405('0x37')]())['where'](_0x7405('0x48'),squel[_0x7405('0x44')](hopperContacts))[_0x7405('0x3a')](_0x7405('0x3d')))[_0x7405('0x37')]();return _0x1f9a7d;}return db[_0x7405('0x49')][_0x7405('0x4a')]({'where':{'type':_0x7405('0x4b')},'attributes':['id',_0x7405('0x4c')],'include':[{'model':db[_0x7405('0x4d')],'as':'Lists','where':{'id':LISTID}}]})[_0x7405('0x29')](function(_0x4542de){var _0x42c1bf=[];if(_0x4542de){var _0x19fdbc;for(var _0x55cb5e=0x0,_0x5be19e;_0x55cb5e<_0x4542de[_0x7405('0x18')];_0x55cb5e+=0x1){_0x5be19e=_0x4542de[_0x55cb5e][_0x7405('0x4e')]({'plain':!![]});switch(_0x5be19e[_0x7405('0x4c')]){case _0x7405('0x4f'):_0x42c1bf['push'](db[_0x7405('0x50')][_0x7405('0x51')](_0x421c2c(_0x5be19e,_0x7405('0x52')))['then'](function(){})[_0x7405('0x2b')](_0x248a89()));break;case _0x7405('0x53'):_0x42c1bf['push'](db[_0x7405('0x50')][_0x7405('0x51')](_0x3513c5(_0x5be19e,_0x7405('0x52')))['then'](function(){})[_0x7405('0x2b')](_0x248a89()));break;default:_0x42c1bf[_0x7405('0x2a')](db['sequelize'][_0x7405('0x51')](_0x2740a3(_0x5be19e,_0x7405('0x52')))[_0x7405('0x29')](function(){})[_0x7405('0x2b')](_0x248a89()));}}}return _0x42c1bf;})['all']()[_0x7405('0x29')](function(){return db[_0x7405('0x49')][_0x7405('0x4a')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db[_0x7405('0x4d')],'as':_0x7405('0x54'),'where':{'id':LISTID}}]})[_0x7405('0x29')](function(_0x4e30e4){var _0x560cb5=[];if(_0x4e30e4){var _0x598ebb;for(var _0x300e9b=0x0,_0x3e46f5;_0x300e9b<_0x4e30e4[_0x7405('0x18')];_0x300e9b+=0x1){_0x3e46f5=_0x4e30e4[_0x300e9b][_0x7405('0x4e')]({'plain':!![]});_0x560cb5['push'](db[_0x7405('0x50')]['query'](_0x58ad44(_0x3e46f5,'VoiceQueueId'))['then'](function(){})['catch'](_0x248a89()));}}return _0x560cb5;})[_0x7405('0x55')]();})[_0x7405('0x29')](function(){return db[_0x7405('0x56')][_0x7405('0x4a')]({'attributes':['id',_0x7405('0x4c')],'include':[{'model':db['CmList'],'as':'Lists','where':{'id':LISTID}}]})[_0x7405('0x29')](function(_0xb078ca){var _0x1b2965=[];if(_0xb078ca){for(var _0x268cbc=0x0,_0x3ec0f0;_0x268cbc<_0xb078ca['length'];_0x268cbc+=0x1){_0x3ec0f0=_0xb078ca[_0x268cbc][_0x7405('0x4e')]({'plain':!![]});switch(_0x3ec0f0['dialCheckDuplicateType']){case _0x7405('0x4f'):_0x1b2965['push'](db[_0x7405('0x50')]['query'](_0x421c2c(_0x3ec0f0,'CampaignId'))[_0x7405('0x29')](function(){})[_0x7405('0x2b')](_0x248a89()));break;case _0x7405('0x53'):_0x1b2965[_0x7405('0x2a')](db[_0x7405('0x50')][_0x7405('0x51')](_0x3513c5(_0x3ec0f0,_0x7405('0x57')))[_0x7405('0x29')](function(){})[_0x7405('0x2b')](_0x248a89()));break;default:_0x1b2965[_0x7405('0x2a')](db[_0x7405('0x50')][_0x7405('0x51')](_0x2740a3(_0x3ec0f0,_0x7405('0x57')))[_0x7405('0x29')](function(){})['catch'](_0x248a89()));}}}return _0x1b2965;})[_0x7405('0x55')]();})[_0x7405('0x29')](function(){return db[_0x7405('0x56')][_0x7405('0x4a')]({'attributes':['id'],'include':[{'model':db[_0x7405('0x4d')],'as':_0x7405('0x54'),'where':{'id':LISTID}}]})[_0x7405('0x29')](function(_0x3fb01b){var _0x2c0724=[];if(_0x3fb01b){for(var _0xe4e30e=0x0,_0x250c18;_0xe4e30e<_0x3fb01b[_0x7405('0x18')];_0xe4e30e+=0x1){_0x250c18=_0x3fb01b[_0xe4e30e][_0x7405('0x4e')]({'plain':!![]});_0x2c0724[_0x7405('0x2a')](db['sequelize'][_0x7405('0x51')](_0x58ad44(_0x250c18,'CampaignId'))['then'](function(){})[_0x7405('0x2b')](_0x248a89()));}}return _0x2c0724;})['all']();})[_0x7405('0x2b')](function(_0x549321){logger['error'](_0x7405('0x58'),_0x7405('0x59'),_0x549321[_0x7405('0x2c')]);});}var processPromises=function(_0x51914d){return BPromise[_0x7405('0x55')](promises)[_0x7405('0x29')](function(_0x4ec335){})['catch'](function(_0x533e0c){logger['error'](_0x7405('0x5a'),JSON[_0x7405('0x2d')](_0x533e0c));})[_0x7405('0x5b')](function(){socket[_0x7405('0x5c')](_0x7405('0x5d')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x51914d){return _0x51914d[_0x7405('0x5e')]();}});};var endCsv=function(){return BPromise['resolve']()[_0x7405('0x29')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket['emit']('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x7405('0x5f')](FILEPATH);}catch(_0x17b119){logger['error'](_0x7405('0x60'),JSON[_0x7405('0x2d')](_0x17b119));}finally{process[_0x7405('0x61')](0x0);}});};process['on'](_0x7405('0x62'),function(){logger[_0x7405('0x63')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise[_0x7405('0x64')]()[_0x7405('0x29')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db[_0x7405('0x27')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x7405('0x29')](function(_0x441009){var _0x303694=fs[_0x7405('0x65')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x303694,{'header':!![],'skipEmptyLines':!![],'step':function(_0x5c9274,_0x114ceb){total+=0x1;var _0x15b9cb=total;promises[_0x7405('0x2a')](checkRow(_0x5c9274,_0x441009,_0x15b9cb)[_0x7405('0x29')](function(){success+=0x1;})['catch'](function(_0x30fbe8){if(_0x30fbe8[_0x7405('0x13')]){errors+=0x1;delete _0x30fbe8[_0x7405('0x13')];}else if(_0x30fbe8[_0x7405('0x66')]){duplicates+=0x1;delete _0x30fbe8[_0x7405('0x66')];}rows[_0x7405('0x2a')](_0x30fbe8);}));if(total%0xc8===0x0){_0x114ceb[_0x7405('0x67')]();return processPromises(_0x114ceb);}},'complete':function(){return processPromises()['then'](function(){logger['info']('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x3db6a7,_0x2d6ba4){logger[_0x7405('0x63')]('CSV\x20parse\x20error',JSON[_0x7405('0x2d')](_0x3db6a7));endCsv();}});})[_0x7405('0x2b')](function(_0x494045){logger[_0x7405('0x13')](_0x7405('0x68'),JSON['stringify'](_0x494045));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 2eb41d2..99d0e45 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 _0x9aac=['priority','recallme','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','cm_contacts.id','cm_contacts.createdAt','insert','cm_hopper_black','fromQuery','fields','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','UserId','\x22onlyIfOpen\x22','ContactId','ListId\x20=\x20?','toString','cm_hopper.id','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','keys','CompanyId',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','MIN(id)','group','Received\x20SIGINT','exit','errors','code','message','info','sequelize','query','spread','error','campaigns.id','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','catch','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','timezones','dialTimezone','utcOffset','set','offset','main','stringify','send','binding','clone','socket_timestamp','root','server/files/tmp','.csv','includes','ContactItemType','findAll','name','_description','header','createReadStream','data','find','hasOwnProperty','trim','replace','isValid','isNumber','email','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','\x20not\x20specified','itemTypeId','description','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','dialTimezone,utcOffset','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','orderBy','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','parse','No\x20agent\x20available','uncaughtException','path','papaparse','util','moment','ioredis','../../../config/environment','../../../config/environment/shared','import','redis','defaults','localhost','socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','format','select','field','phone','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','CmContact','AdditionalPhones','length','all','then','split','isNil','filter','push','CmContactHasItem','findOne','update','updated','PHONE','inserted','cm_contacts.phone','cm_contacts.ListId','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','into','cm_hopper','scheduledat','ListId','createdAt','updatedAt'];(function(_0x533f06,_0x12e1b9){var _0x4ab061=function(_0x484682){while(--_0x484682){_0x533f06['push'](_0x533f06['shift']());}};_0x4ab061(++_0x12e1b9);}(_0x9aac,0x135));var _0xc9aa=function(_0x46c06b,_0xaca4b4){_0x46c06b=_0x46c06b-0x0;var _0x3cf24e=_0x9aac[_0x46c06b];return _0x3cf24e;};'use strict';var fs=require('fs');var path=require(_0xc9aa('0x0'));var _=require('lodash');var Papa=require(_0xc9aa('0x1'));var util=require(_0xc9aa('0x2'));var BPromise=require('bluebird');var moment=require(_0xc9aa('0x3'));var squel=require('squel');var Redis=require(_0xc9aa('0x4'));var db=require('../../../mysqldb')['db'];var config=require(_0xc9aa('0x5'));var shared=require(_0xc9aa('0x6'));var logger=require('../../../config/logger')(_0xc9aa('0x7'));config[_0xc9aa('0x8')]=_[_0xc9aa('0x9')](config['redis'],{'host':_0xc9aa('0xa'),'port':0x18eb});var socket=require(_0xc9aa('0xb'))(new Redis(config[_0xc9aa('0x8')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()['format'](_0xc9aa('0xc'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0xc9aa('0xd')](_0xc9aa('0xc'));function isEmail(_0x54efbc){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'](_0x54efbc);}function selectNotIn(_0x32f449,_0x5346e3,_0x131681,_0x35dd83,_0x248d4e){return squel[_0xc9aa('0xe')]()[_0xc9aa('0xf')](_0xc9aa('0x10'))[_0xc9aa('0x11')](_0x35dd83)[_0xc9aa('0x12')](_0x5346e3,null,_0x5346e3+_0xc9aa('0x13')+_0x35dd83+'.'+_0x131681)[_0xc9aa('0x14')](_0x35dd83+'.'+_0x131681+_0xc9aa('0x15')+_0x32f449+'.'+_0x131681)[_0xc9aa('0x14')](_0x5346e3+_0xc9aa('0x16')+_0x248d4e[_0xc9aa('0x12')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x2b5708,_0x340243){promisesAdditionalPhones=[];return db[_0xc9aa('0x17')]['findAll']({'raw':!![],'attributes':['id',_0xc9aa('0x18')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})['then'](function(_0x5b351f){if(_0x5b351f!==null){var _0x477ca5=[];for(var _0x553805=0x0;_0x553805<_0x5b351f[_0xc9aa('0x19')];_0x553805++){var _0x157c38=_0x5b351f[_0x553805];_0x477ca5['push'](insertAdditionalPhones(_0x157c38));}}Promise[_0xc9aa('0x1a')](_0x477ca5)[_0xc9aa('0x1b')](function(){_0x2b5708({'val':0x1});});});});}function insertAdditionalPhones(_0x26f5a9){return new Promise(function(_0x4bacb3,_0x2999e0){var _0x13d32d=_0x26f5a9[_0xc9aa('0x18')];var _0x22ad7f=_0x13d32d[_0xc9aa('0x1c')](';');var _0x25be52=[];orderBy=0x0;for(var _0x539a95=0x0;_0x539a95<_0x22ad7f[_0xc9aa('0x19')];_0x539a95++){_0x25be52['push'](splitAdditionalPhone(_0x26f5a9['id'],_0x22ad7f[_0x539a95]));}Promise[_0xc9aa('0x1a')](_0x25be52)['then'](function(){_0x4bacb3({'val':_0x22ad7f[_0xc9aa('0x19')]});});});}function splitAdditionalPhone(_0x5e51e9,_0x15da53){return new Promise(function(_0x3f8bfd,_0x214c09){var _0x465f52=_0x15da53['split'](':');var _0x2194bf=_0x465f52[0x0];var _0x122d0c=_0x465f52[0x1];if(!_[_0xc9aa('0x1d')](_0x122d0c)){var _0x1b4246=_0x122d0c[_0xc9aa('0x1c')]('|');var _0x4fdeef=[];for(var _0x430a34=0x0;_0x430a34<_0x1b4246[_0xc9aa('0x19')];_0x430a34++){if(_0x1b4246[_0x430a34]!==''){var _0x69a963=_[_0xc9aa('0x1e')](promisesAdditionalPhones,{'contactId':_0x5e51e9,'phone':_0x1b4246[_0x430a34]});if(_0x69a963[_0xc9aa('0x19')]==0x0){orderBy++;promisesAdditionalPhones[_0xc9aa('0x1f')]({'contactId':_0x5e51e9,'contactTypeId':_0x2194bf,'phone':_0x1b4246[_0x430a34],'orderBy':orderBy});}}}_0x3f8bfd({'ok':0x1});}else _0x3f8bfd({'res':0x0});});}function createAdditionalPhone(_0xee06f1,_0x4dab46,_0x44108f,_0x40e628){var _0x557b18='';var _0x48c5df='';var _0x1313c6=_0x44108f[_0xc9aa('0x1c')]('§');_0x557b18=_0x1313c6[0x0];if(_0x1313c6[_0xc9aa('0x19')]==0x2)_0x48c5df=_0x1313c6[0x1];return new Promise(function(_0x464cac,_0xcf0db8){return db[_0xc9aa('0x20')][_0xc9aa('0x21')]({'where':{'CmContactId':_0xee06f1,'item':_0x557b18}})['then'](function(_0x1d1215){if(_0x1d1215){return db[_0xc9aa('0x20')][_0xc9aa('0x22')]({'ItemTypeId':_0x4dab46,'description':_0x48c5df,'OrderBy':_0x40e628},{'where':{'CmContactId':_0xee06f1,'item':_0x557b18}})[_0xc9aa('0x1b')](function(_0x2934be){_0x464cac({'res':_0xc9aa('0x23')});});}else{return db[_0xc9aa('0x20')]['create']({'CmContactId':_0xee06f1,'item':_0x557b18,'description':_0x48c5df,'ItemTypeId':_0x4dab46,'OrderBy':_0x40e628,'ItemClass':_0xc9aa('0x24')})[_0xc9aa('0x1b')](function(_0x8be8ee){_0x464cac({'res':_0xc9aa('0x25')});});}});});}function insertCmHopper(_0x456586,_0x18e977,_0x2735a3,_0x232872,_0xfa94a8){var _0x1567c0=[_0xc9aa('0x26'),'cm_contacts.scheduledat','cm_contacts.id',_0xc9aa('0x27'),_0x18e977+'.'+_0x232872,'cm_contacts.createdAt',_0xc9aa('0x28'),_0xc9aa('0x29'),_0xc9aa('0x2a'),'\x22'+_0xfa94a8+'\x22'];return squel['insert']()[_0xc9aa('0x2b')](_0xc9aa('0x2c'))['fromQuery']([_0xc9aa('0x10'),_0xc9aa('0x2d'),'ContactId',_0xc9aa('0x2e'),_0x232872,_0xc9aa('0x2f'),_0xc9aa('0x30'),_0xc9aa('0x31'),'UserId',_0xc9aa('0x32')],squel[_0xc9aa('0xe')]()['fields'](_0x1567c0)[_0xc9aa('0x11')](_0x18e977)[_0xc9aa('0x12')](_0xc9aa('0x33'),null,_0xc9aa('0x34')+_0x18e977+_0xc9aa('0x35'))[_0xc9aa('0x12')](_0x2735a3,null,_0x2735a3+'.id\x20=\x20'+_0x18e977+'.'+_0x232872)['where'](_0x18e977+_0xc9aa('0x36'),_0x456586)[_0xc9aa('0x14')](_0xc9aa('0x37'),NOW)[_0xc9aa('0x14')](_0xc9aa('0x38'),selectNotIn(_0x18e977,_0x2735a3,_0x232872,_0xc9aa('0x2c'),[_0xc9aa('0x39'),'\x22onlyIfOpen\x22']))[_0xc9aa('0x14')](_0xc9aa('0x38'),selectNotIn(_0x18e977,_0x2735a3,_0x232872,_0xc9aa('0x2c'),[_0xc9aa('0x39')])))['toString']();}function insertCmHopperBlack(_0x5b91cf,_0x5b14d8,_0x12196f,_0x432b91){var _0x311a2c=[_0xc9aa('0x26'),_0xc9aa('0x3a'),_0xc9aa('0x27'),_0x5b14d8+'.'+_0x432b91,_0xc9aa('0x3b'),'cm_contacts.updatedAt'];return squel[_0xc9aa('0x3c')]()[_0xc9aa('0x2b')](_0xc9aa('0x3d'))[_0xc9aa('0x3e')](['phone','ContactId',_0xc9aa('0x2e'),_0x432b91,'createdAt',_0xc9aa('0x30')],squel[_0xc9aa('0xe')]()[_0xc9aa('0x3f')](_0x311a2c)[_0xc9aa('0x11')](_0x5b14d8)['join'](_0xc9aa('0x33'),null,'cm_contacts.ListId\x20=\x20'+_0x5b14d8+_0xc9aa('0x35'))[_0xc9aa('0x12')](_0x12196f,null,_0x12196f+_0xc9aa('0x13')+_0x5b14d8+'.'+_0x432b91)[_0xc9aa('0x14')](_0x5b14d8+_0xc9aa('0x36'),_0x5b91cf)['where'](_0xc9aa('0x37'),NOW)['where'](_0xc9aa('0x38'),squel[_0xc9aa('0xe')]()[_0xc9aa('0xf')](_0xc9aa('0x10'))[_0xc9aa('0x11')](_0xc9aa('0x3d'))[_0xc9aa('0x14')]('ListId\x20=\x20?',_0x5b91cf)['where'](_0x432b91+_0xc9aa('0x15')+_0x5b14d8+'.'+_0x432b91)))['toString']();}function insertTzCmHopper(_0x3ea244,_0x4d1617,_0x2451c8,_0x3b5f88,_0x1f5a8b,_0x292f9f){var _0x4343ca=[_0xc9aa('0x26'),_0xc9aa('0x40')+_0x292f9f+_0xc9aa('0x41'),_0xc9aa('0x3a'),_0xc9aa('0x27'),_0x4d1617+'.'+_0x3b5f88,_0xc9aa('0x3b'),_0xc9aa('0x28'),'cm_contacts.priority',_0xc9aa('0x2a'),'\x22'+_0x1f5a8b+'\x22'];var _0x16851c=squel[_0xc9aa('0x3c')]()['into']('cm_hopper')['fromQuery'](['phone','scheduledat','ContactId','ListId',_0x3b5f88,_0xc9aa('0x2f'),_0xc9aa('0x30'),_0xc9aa('0x31'),_0xc9aa('0x42'),_0xc9aa('0x32')],squel[_0xc9aa('0xe')]()[_0xc9aa('0x3f')](_0x4343ca)[_0xc9aa('0x11')](_0x4d1617)['join'](_0xc9aa('0x33'),null,_0xc9aa('0x34')+_0x4d1617+_0xc9aa('0x35'))['join'](_0x2451c8,null,_0x2451c8+_0xc9aa('0x13')+_0x4d1617+'.'+_0x3b5f88)[_0xc9aa('0x12')](_0x292f9f,null,_0x292f9f+_0xc9aa('0x13')+_0x4d1617+'.'+_0x3b5f88)[_0xc9aa('0x14')](_0x4d1617+'.CmListId\x20=\x20?',_0x3ea244)['where'](_0xc9aa('0x37'),NOW)[_0xc9aa('0x14')](_0xc9aa('0x38'),selectNotIn(_0x4d1617,_0x2451c8,_0x3b5f88,_0xc9aa('0x2c'),[_0xc9aa('0x39'),_0xc9aa('0x43')]))[_0xc9aa('0x14')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x4d1617,_0x2451c8,_0x3b5f88,'cm_hopper',[_0xc9aa('0x39')])))['toString']();return _0x16851c;}function insertTzCmHopperBlack(_0x476c08,_0x216e42,_0x29c5a5,_0x77ae93){var _0x4cb558=['cm_contacts.phone',_0xc9aa('0x3a'),_0xc9aa('0x27'),_0x216e42+'.'+_0x77ae93,'cm_contacts.createdAt',_0xc9aa('0x28')];return squel[_0xc9aa('0x3c')]()[_0xc9aa('0x2b')](_0xc9aa('0x3d'))['fromQuery'](['phone',_0xc9aa('0x44'),_0xc9aa('0x2e'),_0x77ae93,_0xc9aa('0x2f'),_0xc9aa('0x30')],squel[_0xc9aa('0xe')]()[_0xc9aa('0x3f')](_0x4cb558)[_0xc9aa('0x11')](_0x216e42)[_0xc9aa('0x12')](_0xc9aa('0x33'),null,_0xc9aa('0x34')+_0x216e42+'.CmListId')[_0xc9aa('0x12')](_0x29c5a5,null,_0x29c5a5+_0xc9aa('0x13')+_0x216e42+'.'+_0x77ae93)[_0xc9aa('0x14')](_0x216e42+_0xc9aa('0x36'),_0x476c08)[_0xc9aa('0x14')](_0xc9aa('0x37'),NOW)[_0xc9aa('0x14')](_0xc9aa('0x38'),squel[_0xc9aa('0xe')]()[_0xc9aa('0xf')]('phone')[_0xc9aa('0x11')](_0xc9aa('0x3d'))[_0xc9aa('0x14')](_0xc9aa('0x45'),_0x476c08)[_0xc9aa('0x14')](_0x77ae93+'\x20=\x20'+_0x216e42+'.'+_0x77ae93)))[_0xc9aa('0x46')]();}function insertCmHopperAdditionalPhones(_0x160802){var _0x25b5b7=[_0xc9aa('0x47'),'cm_contact_has_items.item','cm_contact_has_items.OrderBy',_0xc9aa('0x48'),_0xc9aa('0x49')];return squel[_0xc9aa('0x3c')]()[_0xc9aa('0x2b')](_0xc9aa('0x4a'))[_0xc9aa('0x3e')]([_0xc9aa('0x4b'),_0xc9aa('0x10'),_0xc9aa('0x4c'),_0xc9aa('0x2f'),_0xc9aa('0x30')],squel[_0xc9aa('0xe')]()[_0xc9aa('0x3f')](_0x25b5b7)[_0xc9aa('0x11')](_0xc9aa('0x2c'))[_0xc9aa('0x12')](_0xc9aa('0x33'),null,_0xc9aa('0x4d'))[_0xc9aa('0x12')](_0xc9aa('0x4e'),null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')['where']('cm_hopper.ListId\x20=\x20?',_0x160802)[_0xc9aa('0x14')](_0xc9aa('0x37'),NOW))[_0xc9aa('0x46')]();}function insertCmContact(_0x252dc0,_0x2d8c59,_0xadb7c2,_0x40fe29){var _0x234965=_['concat'](_[_0xc9aa('0x4f')](_0x40fe29),[_0xc9aa('0x2e'),_0xc9aa('0x50'),_0xc9aa('0x2f'),_0xc9aa('0x30')]);return squel[_0xc9aa('0x3c')]()[_0xc9aa('0x2b')](_0xc9aa('0x33'))['fromQuery'](_0x234965,squel['select']()[_0xc9aa('0x3f')](_0x234965)[_0xc9aa('0x11')](_0x2d8c59)[_0xc9aa('0x14')]('('+_0xadb7c2[_0xc9aa('0x12')](',')+_0xc9aa('0x51'),squel[_0xc9aa('0xe')]()[_0xc9aa('0x3f')](_0xadb7c2)[_0xc9aa('0x11')](_0xc9aa('0x33'))['where']('ListId\x20=\x20?',_0x252dc0)[_0xc9aa('0x14')](_0xc9aa('0x52')))[_0xc9aa('0x14')]('id\x20IN\x20?',squel['select']()[_0xc9aa('0xf')](_0xc9aa('0x53'),'min_id')[_0xc9aa('0x11')](_0x2d8c59)[_0xc9aa('0x54')](_0xadb7c2[_0xc9aa('0x12')](','))))[_0xc9aa('0x46')]();}function handleStop(){logger['info'](_0xc9aa('0x55'));stopped=!![];}function handleUncaughtException(_0x533667){logger['error'](_0x533667['message']);process[_0xc9aa('0x56')](0x1);}function handleError(_0xdcb73,_0x3a433f){stats[_0xc9aa('0x57')][_0xc9aa('0x1f')]({'name':_0x3a433f[_0xc9aa('0x58')],'message':_0x3a433f[_0xc9aa('0x59')],'row':_0xdcb73});}function handleQuery(_0x361ad3){logger[_0xc9aa('0x5a')](_0x361ad3);return db[_0xc9aa('0x5b')][_0xc9aa('0x5c')](_0x361ad3)[_0xc9aa('0x5d')](function(_0x3d9c43){results[_0xc9aa('0x1f')](_0x3d9c43);})['catch'](function(_0x5204d4){logger[_0xc9aa('0x5e')](_0x5204d4[_0xc9aa('0x59')]);});}function updateTzCampaigns(_0x14e308){return new Promise(function(_0x8a2ac8,_0x57fe19){var _0x1520cf=squel['select']()[_0xc9aa('0x3f')]([_0xc9aa('0x5f'),_0xc9aa('0x60')])[_0xc9aa('0x11')](_0xc9aa('0x61'))[_0xc9aa('0x12')](_0xc9aa('0x62'),null,_0xc9aa('0x63'))[_0xc9aa('0x14')](_0xc9aa('0x64')+_0x14e308);db['sequelize'][_0xc9aa('0x5c')](_0x1520cf[_0xc9aa('0x46')]())[_0xc9aa('0x5d')](function(_0x400b1f){var _0x5518cb=[];for(var _0x28e325=0x0;_0x28e325<_0x400b1f['length'];_0x28e325++){_0x5518cb[_0xc9aa('0x1f')](getTimezoneData(_0x400b1f[_0x28e325],tmp_campaigns));}BPromise[_0xc9aa('0x1a')](_0x5518cb)[_0xc9aa('0x1b')](function(){_0x8a2ac8({'val':0x1});});})[_0xc9aa('0x65')](function(_0x15ad06){logger[_0xc9aa('0x5e')](_0x15ad06['message']);_0x8a2ac8({'val':0x0});});});}function updateTzVoiceQueues(_0x5eaa8a){return new Promise(function(_0x74d517,_0x1dbd4b){var _0x456c4d=squel[_0xc9aa('0xe')]()['fields'](['voice_queues.id',_0xc9aa('0x66')])[_0xc9aa('0x11')](_0xc9aa('0x67'))[_0xc9aa('0x12')](_0xc9aa('0x68'),null,_0xc9aa('0x69'))[_0xc9aa('0x14')]('voice_queues_has_cm_lists.CmListId='+_0x5eaa8a);db['sequelize']['query'](_0x456c4d['toString']())['spread'](function(_0x2bbaae){var _0x579804=[];for(var _0x27c0ab=0x0;_0x27c0ab<_0x2bbaae[_0xc9aa('0x19')];_0x27c0ab++){_0x579804[_0xc9aa('0x1f')](getTimezoneData(_0x2bbaae[_0x27c0ab],tmp_voice_queues));}BPromise[_0xc9aa('0x1a')](_0x579804)[_0xc9aa('0x1b')](function(){_0x74d517({'val':0x1});});})['catch'](function(_0x6a9447){logger['error'](_0x6a9447[_0xc9aa('0x59')]);_0x74d517({'val':0x0});});});}function getTimezoneData(_0x5ed6c0,_0x168269){return new Promise(function(_0x41b25d,_0x33a4fb){var _0x2f371a=shared[_0xc9aa('0x6a')];var _0x29208a=_0x2f371a[_0x5ed6c0[_0xc9aa('0x6b')]];if(_['isNil'](_0x29208a)){_0x41b25d({'ret':0x1});}else{var _0x4d4a9e=_0x29208a[_0xc9aa('0x6c')];var _0x40b95f=squel['insert']()[_0xc9aa('0x2b')](_0x168269)[_0xc9aa('0x6d')]('id',_0x5ed6c0['id'])[_0xc9aa('0x6d')](_0xc9aa('0x6e'),_0x4d4a9e)[_0xc9aa('0x6d')](_0xc9aa('0x6b'),_0x5ed6c0[_0xc9aa('0x6b')])[_0xc9aa('0x46')]();return db[_0xc9aa('0x5b')][_0xc9aa('0x5c')](_0x40b95f)[_0xc9aa('0x5d')](function(_0x5a60e4){_0x41b25d({'ret':0x1});})[_0xc9aa('0x65')](function(_0x249a6c){logger[_0xc9aa('0x5e')](_0x249a6c[_0xc9aa('0x59')]);_0x33a4fb({'ret':0x1});});}});}function handleTZQuery(_0x4cc158){logger[_0xc9aa('0x5a')](_0x4cc158);return db['sequelize'][_0xc9aa('0x5c')](_0x4cc158)[_0xc9aa('0x5d')](function(_0x511cf3){})[_0xc9aa('0x65')](function(_0x85d8df){logger[_0xc9aa('0x5e')](_0x85d8df['message']);});}function main(_0xd3d762,_0x4ac78e,_0x49d9b7,_0x2e32aa){logger[_0xc9aa('0x5a')](_0xc9aa('0x6f'),_0xd3d762,JSON[_0xc9aa('0x70')](_0x4ac78e));process[_0xc9aa('0x71')]('start');var _0x1d6c8a=_0x4ac78e[_0xc9aa('0x72')];var _0x4aa879=_[_0xc9aa('0x73')](_0x1d6c8a);var _0xd2bee9=_0x4ac78e[_0xc9aa('0x74')];var _0x17f8ae=path[_0xc9aa('0x12')](config[_0xc9aa('0x75')],_0xc9aa('0x76'),_0xd2bee9+_0xc9aa('0x77'));hasTZ=_[_0xc9aa('0x4f')](_0x1d6c8a)[_0xc9aa('0x78')](_0xc9aa('0x6b'));var _0x287769=_['keys'](_0x1d6c8a)['join']();logger[_0xc9aa('0x5a')]('header',_0x287769);db[_0xc9aa('0x79')][_0xc9aa('0x7a')]({'raw':!![],'attributes':['id',_0xc9aa('0x7b')]})[_0xc9aa('0x1b')](function(_0x2c60b5){for(var _0x26856c=0x0;_0x26856c<_0x2c60b5['length'];_0x26856c++){if(_0x2c60b5[_0x26856c][_0xc9aa('0x7b')]in _0x1d6c8a){contactItemTypes[_0xc9aa('0x1f')](_0x2c60b5[_0x26856c]);delete _0x4aa879[_0x2c60b5[_0x26856c][_0xc9aa('0x7b')]];hasAdditionalPhones=!![];}for(var _0x4601e0 in _0x1d6c8a){if(_0x2c60b5[_0x26856c]['name']+_0xc9aa('0x7c')===_0x4601e0){phoneDescriptions[_0xc9aa('0x1f')]({'itemTypeId':_0x2c60b5[_0x26856c]['id'],'description':_0x4601e0});delete _0x4aa879[_0x4601e0];}}}if(hasAdditionalPhones)_0x4aa879['AdditionalPhones']='';var _0x1b4afa=_[_0xc9aa('0x4f')](_0x4aa879)[_0xc9aa('0x12')]();logger['info'](_0xc9aa('0x7d'),_0x1b4afa);fs['writeFileSync'](_0x17f8ae,_0x1b4afa+'\x0a');Papa['parse'](fs[_0xc9aa('0x7e')](_0xd3d762),{'header':!![],'skipEmptyLines':!![],'step':function(_0x19c1cb,_0x15dbac){try{for(var _0x18483b=0x0,_0x2f2638=[];_0x18483b<_0x19c1cb[_0xc9aa('0x7f')][_0xc9aa('0x19')];_0x18483b++){stats['rows']+=0x1;if(_0x19c1cb['errors'][_0x18483b]){handleError(_0x19c1cb[_0xc9aa('0x7f')][_0x18483b],_0x19c1cb[_0xc9aa('0x57')][_0x18483b]);}else{var _0x305207=[];var _0xfdd982=[];var _0x439236={};for(var _0xb924f in _0x1d6c8a){let _0xe396e7=contactItemTypes[_0xc9aa('0x80')](_0x390527=>_0x390527[_0xc9aa('0x7b')]===_0xb924f);let _0x454cd1=contactItemTypes[_0xc9aa('0x80')](_0x1f26a5=>_0x1f26a5[_0xc9aa('0x7b')]+'_description'===_0xb924f);if(_[_0xc9aa('0x1d')](_0xe396e7)&&_['isNil'](_0x454cd1)){if(_0x1d6c8a[_0xc9aa('0x81')](_0xb924f)){if(_0x19c1cb[_0xc9aa('0x7f')][_0x18483b][_0x1d6c8a[_0xb924f]]){var _0x355559=_[_0xc9aa('0x82')](_0x19c1cb[_0xc9aa('0x7f')][_0x18483b][_0x1d6c8a[_0xb924f]][_0xc9aa('0x83')](/"/g,'\x27'));switch(_0xb924f){case _0xc9aa('0x2d'):var _0x2b5cad=moment(_0x355559,_0xc9aa('0xc'),!![]);if(_0x2b5cad[_0xc9aa('0x84')]()){_0x2f2638[_0xc9aa('0x1f')]('\x22'+_0x355559+'\x22');}else{_0x305207[_0xc9aa('0x1f')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0xc9aa('0x31'):var _0x1d2fe1=parseInt(_0x355559);_0x355559=_['isNaN'](_0x1d2fe1)||_0x1d2fe1<0x0||_0x1d2fe1>0x4?_0x2e32aa?0x3:0x2:_0x1d2fe1;_0x2f2638[_0xc9aa('0x1f')]('\x22'+_0x355559+'\x22');break;case'UserId':var _0xb8a874=parseInt(_0x355559);if(_[_0xc9aa('0x85')](_0xb8a874)&&_[_0xc9aa('0x78')](_0x49d9b7,_0xb8a874)){_0x2f2638[_0xc9aa('0x1f')]('\x22'+_0xb8a874+'\x22');}else{_0x305207[_0xc9aa('0x1f')]('agent\x20not\x20exists');}break;case _0xc9aa('0x86'):if(isEmail(_0x355559)){_0x2f2638[_0xc9aa('0x1f')]('\x22'+_0x355559+'\x22');}else{_0x305207[_0xc9aa('0x1f')]('email\x20wrong\x20format');}break;case _0xc9aa('0x87'):var _0x30b3c=moment(_0x355559,_0xc9aa('0x88'),!![]);if(_0x30b3c['isValid']()){_0x2f2638['push']('\x22'+_0x355559+'\x22');}else{_0x305207[_0xc9aa('0x1f')](_0xc9aa('0x89'));}break;case _0xc9aa('0x6b'):var _0x29b0c1=shared[_0xc9aa('0x6a')];var _0x3a82cf=_0x29b0c1[_0x355559];if(!_['isNil'](_0x3a82cf)){var _0x1969bf=_0x3a82cf['utcOffset'];_0x2f2638[_0xc9aa('0x1f')]('\x22'+_0x355559+'\x22');_0x2f2638[_0xc9aa('0x1f')]('\x22'+_0x1969bf+'\x22');}break;default:_0x2f2638[_0xc9aa('0x1f')]('\x22'+_0x355559+'\x22');}}else{switch(_0xb924f){case'firstName':case _0xc9aa('0x10'):_0x305207[_0xc9aa('0x1f')](_0xb924f+_0xc9aa('0x8a'));break;default:_0x2f2638[_0xc9aa('0x1f')]('\x22\x22');}}}}else{var _0x1730c9='';if(!_[_0xc9aa('0x1d')](_0xe396e7)){if(!_0x439236[_0xc9aa('0x81')](_0xe396e7['id'])){if(!_['isNil'](_0x19c1cb['data'][_0x18483b][_0x1d6c8a[_0xb924f]])){var _0x355559=_['trim'](_0x19c1cb[_0xc9aa('0x7f')][_0x18483b][_0x1d6c8a[_0xb924f]][_0xc9aa('0x83')](/"/g,'\x27'));var _0x271488=phoneDescriptions[_0xc9aa('0x80')](_0x419a46=>_0x419a46[_0xc9aa('0x8b')]===_0xe396e7['id']);if(!_[_0xc9aa('0x1d')](_0x271488)){var _0x33797d=_['trim'](_0x19c1cb[_0xc9aa('0x7f')][_0x18483b][_0x1d6c8a[_0x271488[_0xc9aa('0x8c')]]]['replace'](/"/g,'\x27'));if(!_[_0xc9aa('0x1d')](_0x33797d))_0x355559=_0x355559+'§'+_0x33797d;}if(_0x1730c9=='')_0x1730c9=_0x355559;else _0x1730c9+='|'+_0x355559;}_0xfdd982[_0xc9aa('0x1f')](_0xe396e7['id']+':'+_0x1730c9);_0x439236[_0xe396e7['id']]=0x1;}}}}if(hasAdditionalPhones){_0x2f2638[_0xc9aa('0x1f')]('\x22'+_0xfdd982[_0xc9aa('0x12')](';')+'\x22');}if(_0x305207[_0xc9aa('0x19')]){handleError(_0x19c1cb[_0xc9aa('0x7f')][_0x18483b],{'code':_0xc9aa('0x8d'),'message':_0x305207[_0xc9aa('0x12')]()});}else{fs[_0xc9aa('0x8e')](_0x17f8ae,_0x2f2638[_0xc9aa('0x12')]()+'\x0a');}_0x2f2638=[];}if(!(stats['rows']%0xc8)){socket[_0xc9aa('0x8f')](_0xc9aa('0x90')+_0xd2bee9,stats);stats[_0xc9aa('0x57')]=[];}}if(stopped){logger[_0xc9aa('0x5a')](_0xc9aa('0x91'));_0x15dbac[_0xc9aa('0x92')]();}}catch(_0x2fb811){handleError(_0x19c1cb['data'][_0x18483b],{'code':_0xc9aa('0x93'),'message':_0x2fb811[_0xc9aa('0x59')]});logger['error'](_0xc9aa('0x94'),_0x2fb811[_0xc9aa('0x59')]);}},'complete':function(){try{var _0x49ee45=[];var _0x33ae47=[];var _0x59dde1=_0xc9aa('0x33');if(_0x4ac78e[_0xc9aa('0x95')]&&_0x4ac78e['duplicates'][_0xc9aa('0x19')]){_0x59dde1='cm_contacts_'+_0xd2bee9;_0x49ee45[_0xc9aa('0x1f')](_0xc9aa('0x96')+_0x59dde1+_0xc9aa('0x97'));}tmp_campaigns=_0xc9aa('0x98')+_0xd2bee9;tmp_voice_queues='voice_queues_'+_0xd2bee9;_0x33ae47['push'](_0xc9aa('0x96')+tmp_campaigns+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');_0x33ae47[_0xc9aa('0x1f')](_0xc9aa('0x96')+tmp_voice_queues+_0xc9aa('0x99'));BPromise[_0xc9aa('0x9a')](_0x33ae47,handleTZQuery)['then'](function(_0x1d7021){updateTzCampaigns(_0x4ac78e[_0xc9aa('0x2e')])['then'](function(_0x25fc26){updateTzVoiceQueues(_0x4ac78e['ListId'])[_0xc9aa('0x1b')](function(_0x33eed7){if(hasTZ)_0x1b4afa=_0x1b4afa[_0xc9aa('0x83')](_0xc9aa('0x6b'),_0xc9aa('0x9b'));var _0xc4a243=util[_0xc9aa('0xd')](_0xc9aa('0x9c'),_0x17f8ae,_0x59dde1,_0x1b4afa,_0x4ac78e[_0xc9aa('0x2e')],_0x4ac78e[_0xc9aa('0x50')]||null,NOW,NOW);if(_[_0xc9aa('0x1d')](_0x1d6c8a[_0xc9aa('0x2d')])){_0xc4a243+=_0xc9aa('0x9d');}_0x49ee45[_0xc9aa('0x1f')](_0xc4a243);if(_0x4ac78e[_0xc9aa('0x95')]&&_0x4ac78e[_0xc9aa('0x95')]['length']){_0x49ee45['push'](insertCmContact(_0x4ac78e[_0xc9aa('0x2e')],_0x59dde1,_0x4ac78e[_0xc9aa('0x95')],_0x1d6c8a));_0x49ee45[_0xc9aa('0x1f')](_0xc9aa('0x9e')+_0x59dde1+';');}BPromise[_0xc9aa('0x9a')](_0x49ee45,handleQuery)[_0xc9aa('0x1b')](function(_0x1f4d4a){BPromise[_0xc9aa('0x1a')]([handleAdditionalPhones()])[_0xc9aa('0x1b')](function(){_0x49ee45=[];for(var _0x37fe70=0x0;_0x37fe70\x20\x20','existsSync','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','SIGINT','uncaughtException','papaparse','bluebird','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','defaults','redis','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','from','join','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','CmContact','findAll','AdditionalPhones','then','length','push','split','all','filter','CmContactHasItem','findOne','update','create','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','fromQuery','scheduledat','ListId','createdAt','updatedAt','priority','recallme','fields','cm_contacts','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_hopper','cm_contacts.id','cm_hopper_black','ContactId','cm_contacts.ListId\x20=\x20','\x20=\x20','toString','date_add(cm_contacts.scheduledat,interval\x20','UserId','ListId\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','keys','CompanyId',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','MIN(id)','group','info','Received\x20SIGINT','error','message','errors','code'];(function(_0x14e0fb,_0x1d7589){var _0x5cf7f3=function(_0x13f6be){while(--_0x13f6be){_0x14e0fb['push'](_0x14e0fb['shift']());}};_0x5cf7f3(++_0x1d7589);}(_0xdb44,0x10e));var _0x4db4=function(_0x1477ef,_0x54a5d6){_0x1477ef=_0x1477ef-0x0;var _0x164acd=_0xdb44[_0x1477ef];return _0x164acd;};'use strict';var fs=require('fs');var path=require('path');var _=require('lodash');var Papa=require(_0x4db4('0x0'));var util=require('util');var BPromise=require(_0x4db4('0x1'));var moment=require('moment');var squel=require('squel');var Redis=require(_0x4db4('0x2'));var db=require(_0x4db4('0x3'))['db'];var config=require(_0x4db4('0x4'));var shared=require('../../../config/environment/shared');var logger=require(_0x4db4('0x5'))(_0x4db4('0x6'));config['redis']=_[_0x4db4('0x7')](config[_0x4db4('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x4db4('0x9'))(new Redis(config[_0x4db4('0x8')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x4db4('0xa')](_0x4db4('0xb'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x4db4('0xa')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x3438b5){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))*$/[_0x4db4('0xc')](_0x3438b5);}function selectNotIn(_0x16460b,_0x322a3e,_0x4d4683,_0x1e0d0b,_0x530ac8){return squel[_0x4db4('0xd')]()[_0x4db4('0xe')](_0x4db4('0xf'))[_0x4db4('0x10')](_0x1e0d0b)[_0x4db4('0x11')](_0x322a3e,null,_0x322a3e+_0x4db4('0x12')+_0x1e0d0b+'.'+_0x4d4683)[_0x4db4('0x13')](_0x1e0d0b+'.'+_0x4d4683+'\x20=\x20'+_0x16460b+'.'+_0x4d4683)[_0x4db4('0x13')](_0x322a3e+_0x4db4('0x14')+_0x530ac8[_0x4db4('0x11')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x5984a5,_0x16dc02){promisesAdditionalPhones=[];return db[_0x4db4('0x15')][_0x4db4('0x16')]({'raw':!![],'attributes':['id',_0x4db4('0x17')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x4db4('0x18')](function(_0x4044ea){if(_0x4044ea!==null){var _0x3d0f5b=[];for(var _0x26966c=0x0;_0x26966c<_0x4044ea[_0x4db4('0x19')];_0x26966c++){var _0x106c70=_0x4044ea[_0x26966c];_0x3d0f5b[_0x4db4('0x1a')](insertAdditionalPhones(_0x106c70));}}Promise['all'](_0x3d0f5b)[_0x4db4('0x18')](function(){_0x5984a5({'val':0x1});});});});}function insertAdditionalPhones(_0x2266c6){return new Promise(function(_0x2244aa,_0xf69556){var _0x4d59ef=_0x2266c6[_0x4db4('0x17')];var _0x36db09=_0x4d59ef[_0x4db4('0x1b')](';');var _0x1fbf75=[];orderBy=0x0;for(var _0x46bad6=0x0;_0x46bad6<_0x36db09[_0x4db4('0x19')];_0x46bad6++){_0x1fbf75['push'](splitAdditionalPhone(_0x2266c6['id'],_0x36db09[_0x46bad6]));}Promise[_0x4db4('0x1c')](_0x1fbf75)[_0x4db4('0x18')](function(){_0x2244aa({'val':_0x36db09[_0x4db4('0x19')]});});});}function splitAdditionalPhone(_0x1f350f,_0x572136){return new Promise(function(_0x451319,_0x24a7e5){var _0x2e23bf=_0x572136[_0x4db4('0x1b')](':');var _0x10f5f5=_0x2e23bf[0x0];var _0x514802=_0x2e23bf[0x1];if(!_['isNil'](_0x514802)){var _0x3c8273=_0x514802[_0x4db4('0x1b')]('|');var _0x33cc22=[];for(var _0x56e264=0x0;_0x56e264<_0x3c8273[_0x4db4('0x19')];_0x56e264++){if(_0x3c8273[_0x56e264]!==''){var _0x2619f0=_[_0x4db4('0x1d')](promisesAdditionalPhones,{'contactId':_0x1f350f,'phone':_0x3c8273[_0x56e264]});if(_0x2619f0['length']==0x0){orderBy++;promisesAdditionalPhones[_0x4db4('0x1a')]({'contactId':_0x1f350f,'contactTypeId':_0x10f5f5,'phone':_0x3c8273[_0x56e264],'orderBy':orderBy});}}}_0x451319({'ok':0x1});}else _0x451319({'res':0x0});});}function createAdditionalPhone(_0x287368,_0x118968,_0x580d1d,_0x375286){var _0x57e244='';var _0x35cde2='';var _0x110dfa=_0x580d1d['split']('§');_0x57e244=_0x110dfa[0x0];if(_0x110dfa[_0x4db4('0x19')]==0x2)_0x35cde2=_0x110dfa[0x1];return new Promise(function(_0x350a97,_0x3b8985){return db[_0x4db4('0x1e')][_0x4db4('0x1f')]({'where':{'CmContactId':_0x287368,'item':_0x57e244}})[_0x4db4('0x18')](function(_0x46c7fe){if(_0x46c7fe){return db[_0x4db4('0x1e')][_0x4db4('0x20')]({'ItemTypeId':_0x118968,'description':_0x35cde2,'OrderBy':_0x375286},{'where':{'CmContactId':_0x287368,'item':_0x57e244}})[_0x4db4('0x18')](function(_0x26a3ad){_0x350a97({'res':'updated'});});}else{return db['CmContactHasItem'][_0x4db4('0x21')]({'CmContactId':_0x287368,'item':_0x57e244,'description':_0x35cde2,'ItemTypeId':_0x118968,'OrderBy':_0x375286,'ItemClass':'PHONE'})[_0x4db4('0x18')](function(_0x48b0e8){_0x350a97({'res':_0x4db4('0x22')});});}});});}function insertCmHopper(_0x5bb085,_0x59d2aa,_0x418009,_0x42aa04,_0x5d689c){var _0x5e2d93=[_0x4db4('0x23'),_0x4db4('0x24'),'cm_contacts.id',_0x4db4('0x25'),_0x59d2aa+'.'+_0x42aa04,_0x4db4('0x26'),_0x4db4('0x27'),_0x4db4('0x28'),_0x4db4('0x29'),'\x22'+_0x5d689c+'\x22'];return squel[_0x4db4('0x2a')]()[_0x4db4('0x2b')]('cm_hopper')[_0x4db4('0x2c')]([_0x4db4('0xf'),_0x4db4('0x2d'),'ContactId',_0x4db4('0x2e'),_0x42aa04,_0x4db4('0x2f'),_0x4db4('0x30'),_0x4db4('0x31'),'UserId',_0x4db4('0x32')],squel[_0x4db4('0xd')]()[_0x4db4('0x33')](_0x5e2d93)[_0x4db4('0x10')](_0x59d2aa)['join'](_0x4db4('0x34'),null,'cm_contacts.ListId\x20=\x20'+_0x59d2aa+_0x4db4('0x35'))[_0x4db4('0x11')](_0x418009,null,_0x418009+'.id\x20=\x20'+_0x59d2aa+'.'+_0x42aa04)[_0x4db4('0x13')](_0x59d2aa+_0x4db4('0x36'),_0x5bb085)[_0x4db4('0x13')](_0x4db4('0x37'),NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x59d2aa,_0x418009,_0x42aa04,'cm_hopper',[_0x4db4('0x38'),_0x4db4('0x39')]))['where'](_0x4db4('0x3a'),selectNotIn(_0x59d2aa,_0x418009,_0x42aa04,_0x4db4('0x3b'),[_0x4db4('0x38')])))['toString']();}function insertCmHopperBlack(_0x2e2838,_0x8fc732,_0xf8ca42,_0x25936e){var _0x45aeff=[_0x4db4('0x23'),_0x4db4('0x3c'),'cm_contacts.ListId',_0x8fc732+'.'+_0x25936e,'cm_contacts.createdAt',_0x4db4('0x27')];return squel['insert']()['into'](_0x4db4('0x3d'))[_0x4db4('0x2c')]([_0x4db4('0xf'),_0x4db4('0x3e'),_0x4db4('0x2e'),_0x25936e,_0x4db4('0x2f'),_0x4db4('0x30')],squel['select']()['fields'](_0x45aeff)[_0x4db4('0x10')](_0x8fc732)[_0x4db4('0x11')](_0x4db4('0x34'),null,_0x4db4('0x3f')+_0x8fc732+_0x4db4('0x35'))[_0x4db4('0x11')](_0xf8ca42,null,_0xf8ca42+'.id\x20=\x20'+_0x8fc732+'.'+_0x25936e)[_0x4db4('0x13')](_0x8fc732+_0x4db4('0x36'),_0x2e2838)[_0x4db4('0x13')](_0x4db4('0x37'),NOW)['where'](_0x4db4('0x3a'),squel[_0x4db4('0xd')]()[_0x4db4('0xe')](_0x4db4('0xf'))[_0x4db4('0x10')](_0x4db4('0x3d'))[_0x4db4('0x13')]('ListId\x20=\x20?',_0x2e2838)[_0x4db4('0x13')](_0x25936e+_0x4db4('0x40')+_0x8fc732+'.'+_0x25936e)))[_0x4db4('0x41')]();}function insertTzCmHopper(_0x45493f,_0x277c98,_0x4e1f77,_0x2811c3,_0x4e8b9d,_0xe3ee6b){var _0x553e0a=[_0x4db4('0x23'),_0x4db4('0x42')+_0xe3ee6b+'.offset-cm_contacts.utcOffset\x20minute)',_0x4db4('0x3c'),_0x4db4('0x25'),_0x277c98+'.'+_0x2811c3,_0x4db4('0x26'),_0x4db4('0x27'),_0x4db4('0x28'),_0x4db4('0x29'),'\x22'+_0x4e8b9d+'\x22'];var _0x3ad462=squel[_0x4db4('0x2a')]()[_0x4db4('0x2b')](_0x4db4('0x3b'))[_0x4db4('0x2c')]([_0x4db4('0xf'),'scheduledat',_0x4db4('0x3e'),_0x4db4('0x2e'),_0x2811c3,_0x4db4('0x2f'),_0x4db4('0x30'),_0x4db4('0x31'),_0x4db4('0x43'),'recallme'],squel[_0x4db4('0xd')]()[_0x4db4('0x33')](_0x553e0a)[_0x4db4('0x10')](_0x277c98)[_0x4db4('0x11')](_0x4db4('0x34'),null,'cm_contacts.ListId\x20=\x20'+_0x277c98+_0x4db4('0x35'))[_0x4db4('0x11')](_0x4e1f77,null,_0x4e1f77+_0x4db4('0x12')+_0x277c98+'.'+_0x2811c3)[_0x4db4('0x11')](_0xe3ee6b,null,_0xe3ee6b+'.id\x20=\x20'+_0x277c98+'.'+_0x2811c3)[_0x4db4('0x13')](_0x277c98+_0x4db4('0x36'),_0x45493f)['where']('cm_contacts.createdAt\x20=\x20?',NOW)[_0x4db4('0x13')](_0x4db4('0x3a'),selectNotIn(_0x277c98,_0x4e1f77,_0x2811c3,'cm_hopper',[_0x4db4('0x38'),_0x4db4('0x39')]))[_0x4db4('0x13')](_0x4db4('0x3a'),selectNotIn(_0x277c98,_0x4e1f77,_0x2811c3,'cm_hopper',[_0x4db4('0x38')])))[_0x4db4('0x41')]();return _0x3ad462;}function insertTzCmHopperBlack(_0x22ded1,_0x28e347,_0x2337e2,_0x537d6b){var _0x1ddc06=[_0x4db4('0x23'),'cm_contacts.id',_0x4db4('0x25'),_0x28e347+'.'+_0x537d6b,_0x4db4('0x26'),_0x4db4('0x27')];return squel[_0x4db4('0x2a')]()['into'](_0x4db4('0x3d'))['fromQuery']([_0x4db4('0xf'),_0x4db4('0x3e'),_0x4db4('0x2e'),_0x537d6b,'createdAt',_0x4db4('0x30')],squel[_0x4db4('0xd')]()[_0x4db4('0x33')](_0x1ddc06)[_0x4db4('0x10')](_0x28e347)[_0x4db4('0x11')]('cm_contacts',null,_0x4db4('0x3f')+_0x28e347+'.CmListId')[_0x4db4('0x11')](_0x2337e2,null,_0x2337e2+_0x4db4('0x12')+_0x28e347+'.'+_0x537d6b)['where'](_0x28e347+_0x4db4('0x36'),_0x22ded1)[_0x4db4('0x13')](_0x4db4('0x37'),NOW)[_0x4db4('0x13')](_0x4db4('0x3a'),squel[_0x4db4('0xd')]()[_0x4db4('0xe')](_0x4db4('0xf'))[_0x4db4('0x10')](_0x4db4('0x3d'))['where'](_0x4db4('0x44'),_0x22ded1)[_0x4db4('0x13')](_0x537d6b+_0x4db4('0x40')+_0x28e347+'.'+_0x537d6b)))[_0x4db4('0x41')]();}function insertCmHopperAdditionalPhones(_0x3f4bd6){var _0x44e17a=[_0x4db4('0x45'),_0x4db4('0x46'),_0x4db4('0x47'),_0x4db4('0x48'),'cm_contact_has_items.updatedAt'];return squel['insert']()[_0x4db4('0x2b')](_0x4db4('0x49'))[_0x4db4('0x2c')]([_0x4db4('0x4a'),_0x4db4('0xf'),_0x4db4('0x4b'),'createdAt',_0x4db4('0x30')],squel[_0x4db4('0xd')]()[_0x4db4('0x33')](_0x44e17a)[_0x4db4('0x10')](_0x4db4('0x3b'))[_0x4db4('0x11')](_0x4db4('0x34'),null,_0x4db4('0x4c'))['join'](_0x4db4('0x4d'),null,_0x4db4('0x4e'))[_0x4db4('0x13')](_0x4db4('0x4f'),_0x3f4bd6)['where']('cm_contacts.createdAt\x20=\x20?',NOW))['toString']();}function insertCmContact(_0x31708b,_0x1a07c4,_0x3f5445,_0x30bfa2){var _0x4362a4=_['concat'](_[_0x4db4('0x50')](_0x30bfa2),['ListId',_0x4db4('0x51'),_0x4db4('0x2f'),_0x4db4('0x30')]);return squel[_0x4db4('0x2a')]()['into']('cm_contacts')[_0x4db4('0x2c')](_0x4362a4,squel[_0x4db4('0xd')]()[_0x4db4('0x33')](_0x4362a4)[_0x4db4('0x10')](_0x1a07c4)[_0x4db4('0x13')]('('+_0x3f5445[_0x4db4('0x11')](',')+_0x4db4('0x52'),squel[_0x4db4('0xd')]()['fields'](_0x3f5445)[_0x4db4('0x10')](_0x4db4('0x34'))[_0x4db4('0x13')](_0x4db4('0x44'),_0x31708b)[_0x4db4('0x13')](_0x4db4('0x53')))[_0x4db4('0x13')]('id\x20IN\x20?',squel[_0x4db4('0xd')]()[_0x4db4('0xe')](_0x4db4('0x54'),'min_id')[_0x4db4('0x10')](_0x1a07c4)[_0x4db4('0x55')](_0x3f5445[_0x4db4('0x11')](','))))['toString']();}function handleStop(){logger[_0x4db4('0x56')](_0x4db4('0x57'));stopped=!![];}function handleUncaughtException(_0x568b27){logger[_0x4db4('0x58')](_0x568b27[_0x4db4('0x59')]);process['exit'](0x1);}function handleError(_0x3ef1f3,_0x2fb96c){stats[_0x4db4('0x5a')][_0x4db4('0x1a')]({'name':_0x2fb96c[_0x4db4('0x5b')],'message':_0x2fb96c[_0x4db4('0x59')],'row':_0x3ef1f3});}function handleQuery(_0x156bf4){logger['info'](_0x156bf4);return db[_0x4db4('0x5c')][_0x4db4('0x5d')](_0x156bf4)[_0x4db4('0x5e')](function(_0x437686){results['push'](_0x437686);})['catch'](function(_0x4269aa){logger[_0x4db4('0x58')](_0x4269aa[_0x4db4('0x59')]);});}function updateTzCampaigns(_0x553466){return new Promise(function(_0x1b7325,_0x4f47b9){var _0x4af079=squel[_0x4db4('0xd')]()[_0x4db4('0x33')]([_0x4db4('0x5f'),_0x4db4('0x60')])[_0x4db4('0x10')](_0x4db4('0x61'))[_0x4db4('0x11')](_0x4db4('0x62'),null,_0x4db4('0x63'))[_0x4db4('0x13')]('campaigns_has_cm_lists.CmListId='+_0x553466);db[_0x4db4('0x5c')][_0x4db4('0x5d')](_0x4af079['toString']())[_0x4db4('0x5e')](function(_0x57871a){var _0x12ccb7=[];for(var _0x291647=0x0;_0x291647<_0x57871a[_0x4db4('0x19')];_0x291647++){_0x12ccb7[_0x4db4('0x1a')](getTimezoneData(_0x57871a[_0x291647],tmp_campaigns));}BPromise[_0x4db4('0x1c')](_0x12ccb7)['then'](function(){_0x1b7325({'val':0x1});});})[_0x4db4('0x64')](function(_0x36ebc8){logger[_0x4db4('0x58')](_0x36ebc8['message']);_0x1b7325({'val':0x0});});});}function updateTzVoiceQueues(_0x5e63fa){return new Promise(function(_0x469b3d,_0x294fec){var _0x45ae85=squel['select']()[_0x4db4('0x33')]([_0x4db4('0x65'),_0x4db4('0x66')])['from'](_0x4db4('0x67'))[_0x4db4('0x11')](_0x4db4('0x68'),null,'voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId')['where'](_0x4db4('0x69')+_0x5e63fa);db['sequelize'][_0x4db4('0x5d')](_0x45ae85[_0x4db4('0x41')]())[_0x4db4('0x5e')](function(_0xfe895c){var _0x3b9583=[];for(var _0x5050a7=0x0;_0x5050a7<_0xfe895c[_0x4db4('0x19')];_0x5050a7++){_0x3b9583[_0x4db4('0x1a')](getTimezoneData(_0xfe895c[_0x5050a7],tmp_voice_queues));}BPromise[_0x4db4('0x1c')](_0x3b9583)[_0x4db4('0x18')](function(){_0x469b3d({'val':0x1});});})[_0x4db4('0x64')](function(_0x5a091a){logger[_0x4db4('0x58')](_0x5a091a[_0x4db4('0x59')]);_0x469b3d({'val':0x0});});});}function getTimezoneData(_0x3838dc,_0x22572b){return new Promise(function(_0x4d7dd1,_0xbc5e17){var _0x150e86=shared[_0x4db4('0x6a')];var _0x287477=_0x150e86[_0x3838dc['dialTimezone']];if(_[_0x4db4('0x6b')](_0x287477)){_0x4d7dd1({'ret':0x1});}else{var _0x1bb042=_0x287477[_0x4db4('0x6c')];var _0x5ab35a=squel[_0x4db4('0x2a')]()[_0x4db4('0x2b')](_0x22572b)[_0x4db4('0x6d')]('id',_0x3838dc['id'])[_0x4db4('0x6d')](_0x4db4('0x6e'),_0x1bb042)[_0x4db4('0x6d')](_0x4db4('0x6f'),_0x3838dc['dialTimezone'])[_0x4db4('0x41')]();return db[_0x4db4('0x5c')]['query'](_0x5ab35a)[_0x4db4('0x5e')](function(_0x2b2505){_0x4d7dd1({'ret':0x1});})['catch'](function(_0x53c814){logger[_0x4db4('0x58')](_0x53c814[_0x4db4('0x59')]);_0xbc5e17({'ret':0x1});});}});}function handleTZQuery(_0x403e74){logger[_0x4db4('0x56')](_0x403e74);return db[_0x4db4('0x5c')]['query'](_0x403e74)[_0x4db4('0x5e')](function(_0x4680b2){})[_0x4db4('0x64')](function(_0x375556){logger[_0x4db4('0x58')](_0x375556['message']);});}function main(_0x2100d3,_0x304788,_0x5d252c,_0x453343){logger['info'](_0x4db4('0x70'),_0x2100d3,JSON[_0x4db4('0x71')](_0x304788));process[_0x4db4('0x72')](_0x4db4('0x73'));var _0x5af712=_0x304788[_0x4db4('0x74')];var _0x5e5c18=_[_0x4db4('0x75')](_0x5af712);var _0x119f81=_0x304788[_0x4db4('0x76')];var _0x559467=path['join'](config[_0x4db4('0x77')],_0x4db4('0x78'),_0x119f81+'.csv');hasTZ=_['keys'](_0x5af712)[_0x4db4('0x79')](_0x4db4('0x6f'));var _0x124df1=_[_0x4db4('0x50')](_0x5af712)['join']();logger[_0x4db4('0x56')](_0x4db4('0x7a'),_0x124df1);db[_0x4db4('0x7b')][_0x4db4('0x16')]({'raw':!![],'attributes':['id',_0x4db4('0x7c')]})[_0x4db4('0x18')](function(_0x2b75d1){for(var _0x5c23a7=0x0;_0x5c23a7<_0x2b75d1[_0x4db4('0x19')];_0x5c23a7++){if(_0x2b75d1[_0x5c23a7]['name']in _0x5af712){contactItemTypes['push'](_0x2b75d1[_0x5c23a7]);delete _0x5e5c18[_0x2b75d1[_0x5c23a7]['name']];hasAdditionalPhones=!![];}for(var _0x54258d in _0x5af712){if(_0x2b75d1[_0x5c23a7][_0x4db4('0x7c')]+_0x4db4('0x7d')===_0x54258d){phoneDescriptions[_0x4db4('0x1a')]({'itemTypeId':_0x2b75d1[_0x5c23a7]['id'],'description':_0x54258d});delete _0x5e5c18[_0x54258d];}}}if(hasAdditionalPhones)_0x5e5c18['AdditionalPhones']='';var _0x87c9f2=_[_0x4db4('0x50')](_0x5e5c18)[_0x4db4('0x11')]();logger['info'](_0x4db4('0x7a'),_0x87c9f2);fs[_0x4db4('0x7e')](_0x559467,_0x87c9f2+'\x0a');Papa[_0x4db4('0x7f')](fs[_0x4db4('0x80')](_0x2100d3),{'header':!![],'skipEmptyLines':!![],'step':function(_0x44c8d1,_0x3a9112){try{for(var _0x963057=0x0,_0x24630e=[];_0x963057<_0x44c8d1[_0x4db4('0x81')]['length'];_0x963057++){stats[_0x4db4('0x82')]+=0x1;if(_0x44c8d1[_0x4db4('0x5a')][_0x963057]){handleError(_0x44c8d1[_0x4db4('0x81')][_0x963057],_0x44c8d1[_0x4db4('0x5a')][_0x963057]);}else{var _0x4ae53e=[];var _0xdf5cbc=[];var _0x43bff7={};for(var _0x4e57f1 in _0x5af712){let _0x43ad2f=contactItemTypes[_0x4db4('0x83')](_0x78d87b=>_0x78d87b[_0x4db4('0x7c')]===_0x4e57f1);let _0x8082e6=contactItemTypes[_0x4db4('0x83')](_0x4957b9=>_0x4957b9[_0x4db4('0x7c')]+'_description'===_0x4e57f1);if(_['isNil'](_0x43ad2f)&&_['isNil'](_0x8082e6)){if(_0x5af712['hasOwnProperty'](_0x4e57f1)){if(_0x44c8d1[_0x4db4('0x81')][_0x963057][_0x5af712[_0x4e57f1]]){var _0x557fe6=_[_0x4db4('0x84')](_0x44c8d1[_0x4db4('0x81')][_0x963057][_0x5af712[_0x4e57f1]][_0x4db4('0x85')](/"/g,'\x27'));switch(_0x4e57f1){case _0x4db4('0x2d'):var _0xd8bc57=moment(_0x557fe6,_0x4db4('0xb'),!![]);if(_0xd8bc57[_0x4db4('0x86')]()){_0x24630e['push']('\x22'+_0x557fe6+'\x22');}else{_0x4ae53e[_0x4db4('0x1a')](_0x4db4('0x87'));}break;case _0x4db4('0x31'):var _0x32f00f=parseInt(_0x557fe6);_0x557fe6=_[_0x4db4('0x88')](_0x32f00f)||_0x32f00f<0x0||_0x32f00f>0x4?_0x453343?0x3:0x2:_0x32f00f;_0x24630e[_0x4db4('0x1a')]('\x22'+_0x557fe6+'\x22');break;case _0x4db4('0x43'):var _0x3808cf=parseInt(_0x557fe6);if(_[_0x4db4('0x89')](_0x3808cf)&&_[_0x4db4('0x79')](_0x5d252c,_0x3808cf)){_0x24630e[_0x4db4('0x1a')]('\x22'+_0x3808cf+'\x22');}else{_0x4ae53e[_0x4db4('0x1a')](_0x4db4('0x8a'));}break;case _0x4db4('0x8b'):if(isEmail(_0x557fe6)){_0x24630e[_0x4db4('0x1a')]('\x22'+_0x557fe6+'\x22');}else{_0x4ae53e['push']('email\x20wrong\x20format');}break;case _0x4db4('0x8c'):var _0x1b750d=moment(_0x557fe6,_0x4db4('0x8d'),!![]);if(_0x1b750d[_0x4db4('0x86')]()){_0x24630e[_0x4db4('0x1a')]('\x22'+_0x557fe6+'\x22');}else{_0x4ae53e[_0x4db4('0x1a')](_0x4db4('0x8e'));}break;case _0x4db4('0x6f'):var _0xf4134=shared[_0x4db4('0x6a')];var _0x8c90f3=_0xf4134[_0x557fe6];if(!_[_0x4db4('0x6b')](_0x8c90f3)){var _0x5235da=_0x8c90f3['utcOffset'];_0x24630e[_0x4db4('0x1a')]('\x22'+_0x557fe6+'\x22');_0x24630e[_0x4db4('0x1a')]('\x22'+_0x5235da+'\x22');}break;default:_0x24630e['push']('\x22'+_0x557fe6+'\x22');}}else{switch(_0x4e57f1){case _0x4db4('0x8f'):case _0x4db4('0xf'):_0x4ae53e[_0x4db4('0x1a')](_0x4e57f1+_0x4db4('0x90'));break;default:_0x24630e[_0x4db4('0x1a')]('\x22\x22');}}}}else{var _0x3bc208='';if(!_[_0x4db4('0x6b')](_0x43ad2f)){if(!_0x43bff7[_0x4db4('0x91')](_0x43ad2f['id'])){if(!_['isNil'](_0x44c8d1[_0x4db4('0x81')][_0x963057][_0x5af712[_0x4e57f1]])){var _0x557fe6=_['trim'](_0x44c8d1['data'][_0x963057][_0x5af712[_0x4e57f1]][_0x4db4('0x85')](/"/g,'\x27'));var _0x21fcc5=phoneDescriptions['find'](_0x5c3626=>_0x5c3626['itemTypeId']===_0x43ad2f['id']);if(!_[_0x4db4('0x6b')](_0x21fcc5)){var _0x3bcaf7=_[_0x4db4('0x84')](_0x44c8d1['data'][_0x963057][_0x5af712[_0x21fcc5[_0x4db4('0x92')]]]['replace'](/"/g,'\x27'));if(!_[_0x4db4('0x6b')](_0x3bcaf7))_0x557fe6=_0x557fe6+'§'+_0x3bcaf7;}if(_0x3bc208=='')_0x3bc208=_0x557fe6;else _0x3bc208+='|'+_0x557fe6;}_0xdf5cbc[_0x4db4('0x1a')](_0x43ad2f['id']+':'+_0x3bc208);_0x43bff7[_0x43ad2f['id']]=0x1;}}}}if(hasAdditionalPhones){_0x24630e['push']('\x22'+_0xdf5cbc['join'](';')+'\x22');}if(_0x4ae53e[_0x4db4('0x19')]){handleError(_0x44c8d1[_0x4db4('0x81')][_0x963057],{'code':_0x4db4('0x93'),'message':_0x4ae53e[_0x4db4('0x11')]()});}else{fs['appendFileSync'](_0x559467,_0x24630e[_0x4db4('0x11')]()+'\x0a');}_0x24630e=[];}if(!(stats[_0x4db4('0x82')]%0xc8)){socket[_0x4db4('0x94')](_0x4db4('0x95')+_0x119f81,stats);stats[_0x4db4('0x5a')]=[];}}if(stopped){logger[_0x4db4('0x56')]('Abort\x20parser');_0x3a9112[_0x4db4('0x96')]();}}catch(_0x173864){handleError(_0x44c8d1['data'][_0x963057],{'code':_0x4db4('0x97'),'message':_0x173864['message']});logger[_0x4db4('0x58')](_0x4db4('0x98'),_0x173864[_0x4db4('0x59')]);}},'complete':function(){try{var _0x2adf3a=[];var _0x33ff4b=[];var _0x5c41b0=_0x4db4('0x34');if(_0x304788[_0x4db4('0x99')]&&_0x304788[_0x4db4('0x99')][_0x4db4('0x19')]){_0x5c41b0='cm_contacts_'+_0x119f81;_0x2adf3a[_0x4db4('0x1a')](_0x4db4('0x9a')+_0x5c41b0+_0x4db4('0x9b'));}tmp_campaigns=_0x4db4('0x9c')+_0x119f81;tmp_voice_queues=_0x4db4('0x9d')+_0x119f81;_0x33ff4b['push']('CREATE\x20TABLE\x20'+tmp_campaigns+_0x4db4('0x9e'));_0x33ff4b[_0x4db4('0x1a')](_0x4db4('0x9a')+tmp_voice_queues+_0x4db4('0x9e'));BPromise[_0x4db4('0x9f')](_0x33ff4b,handleTZQuery)[_0x4db4('0x18')](function(_0x1f6883){updateTzCampaigns(_0x304788[_0x4db4('0x2e')])['then'](function(_0xaa9b2e){updateTzVoiceQueues(_0x304788[_0x4db4('0x2e')])[_0x4db4('0x18')](function(_0x10af48){if(hasTZ)_0x87c9f2=_0x87c9f2[_0x4db4('0x85')]('dialTimezone','dialTimezone,utcOffset');var _0x4d738f=util['format']('LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',_0x559467,_0x5c41b0,_0x87c9f2,_0x304788[_0x4db4('0x2e')],_0x304788[_0x4db4('0x51')]||null,NOW,NOW);if(_[_0x4db4('0x6b')](_0x5af712[_0x4db4('0x2d')])){_0x4d738f+=_0x4db4('0xa0');}_0x2adf3a[_0x4db4('0x1a')](_0x4d738f);if(_0x304788[_0x4db4('0x99')]&&_0x304788[_0x4db4('0x99')]['length']){_0x2adf3a['push'](insertCmContact(_0x304788[_0x4db4('0x2e')],_0x5c41b0,_0x304788['duplicates'],_0x5af712));_0x2adf3a[_0x4db4('0x1a')](_0x4db4('0xa1')+_0x5c41b0+';');}BPromise[_0x4db4('0x9f')](_0x2adf3a,handleQuery)[_0x4db4('0x18')](function(_0x1d4808){BPromise['all']([handleAdditionalPhones()])[_0x4db4('0x18')](function(){_0x2adf3a=[];for(var _0x1fbf15=0x0;_0x1fbf15\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','binding','ListId\x20is\x20mandatory','No\x20agent\x20available','uncaughtException','path','lodash','papaparse','util','moment','squel'];(function(_0x96691d,_0x544a9d){var _0x5a79ca=function(_0x48421a){while(--_0x48421a){_0x96691d['push'](_0x96691d['shift']());}};_0x5a79ca(++_0x544a9d);}(_0xe59f,0x1c5));var _0xfe59=function(_0x54994a,_0x1b3ad9){_0x54994a=_0x54994a-0x0;var _0x43dbe0=_0xe59f[_0x54994a];return _0x43dbe0;};'use strict';var fs=require('fs');var path=require(_0xfe59('0x0'));var _=require(_0xfe59('0x1'));var Papa=require(_0xfe59('0x2'));var util=require(_0xfe59('0x3'));var BPromise=require('bluebird');var moment=require(_0xfe59('0x4'));var squel=require(_0xfe59('0x5'));var Redis=require('ioredis');var db=require('../../../mysqldb')['db'];var config=require('../../../config/environment');var logger=require(_0xfe59('0x6'))(_0xfe59('0x7'));config[_0xfe59('0x8')]=_[_0xfe59('0x9')](config[_0xfe59('0x8')],{'host':_0xfe59('0xa'),'port':0x18eb});var socket=require(_0xfe59('0xb'))(new Redis(config[_0xfe59('0x8')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0xfe59('0xc')](_0xfe59('0xd'));var tempTableName='cm_contacts_temp_'+moment()['format'](_0xfe59('0xe'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x4f4309){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))*$/[_0xfe59('0xf')](_0x4f4309);}function selectNotIn(_0x5b73f0,_0x36cf04,_0x10855d,_0x4ba305,_0x28485f){return squel[_0xfe59('0x10')]()[_0xfe59('0x11')](_0xfe59('0x12'))[_0xfe59('0x13')](_0x4ba305)['join'](_0x36cf04,null,_0x36cf04+'.id\x20=\x20'+_0x4ba305+'.'+_0x10855d)[_0xfe59('0x14')](_0x4ba305+'.'+_0x10855d+'\x20=\x20'+_0x5b73f0+'.'+_0x10855d)[_0xfe59('0x14')](_0x36cf04+_0xfe59('0x15')+_0x28485f[_0xfe59('0x16')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x5fd26,_0x4c3022){promisesAdditionalPhones=[];promisesContact=[];return db[_0xfe59('0x17')][_0xfe59('0x18')](_0xfe59('0x19')+tempTableName)['spread'](function(_0x1921b5){if(_0x1921b5!==null){var _0x307567=[];for(var _0xdb2fc=0x0;_0xdb2fc<_0x1921b5[_0xfe59('0x1a')];_0xdb2fc++){var _0x36f33c=_0x1921b5[_0xdb2fc];if(!_[_0xfe59('0x1b')](_0x36f33c[_0xfe59('0x12')])){if(!_['isNil'](_0x36f33c['AdditionalPhones']))_0x307567[_0xfe59('0x1c')](insertAdditionalPhones(_0x36f33c));promisesContact[_0xfe59('0x1c')]({'contact':_0x36f33c});}}}Promise[_0xfe59('0x1d')](_0x307567)[_0xfe59('0x1e')](function(){_0x5fd26({'val':0x1});});})[_0xfe59('0x1f')](function(_0x3e95a3){logger['error'](_0x3e95a3[_0xfe59('0x20')]);});});}function insertAdditionalPhones(_0x20876c){return new Promise(function(_0x25fe3f,_0x1a461e){var _0x4fcaaf=_0x20876c[_0xfe59('0x21')];if(_[_0xfe59('0x1b')](_0x4fcaaf))_0x1a461e({'val':0x0});else{var _0x30a38c=_0x4fcaaf[_0xfe59('0x22')](';');var _0x2690dd=[];orderBy=0x0;for(var _0x3c0743=0x0;_0x3c0743<_0x30a38c['length'];_0x3c0743++){_0x2690dd[_0xfe59('0x1c')](splitAdditionalPhone(_0x20876c['id'],_0x30a38c[_0x3c0743]));}Promise[_0xfe59('0x1d')](_0x2690dd)[_0xfe59('0x1e')](function(){_0x25fe3f({'val':_0x30a38c['length']});});}});}function splitAdditionalPhone(_0x39a1f3,_0x47d577){return new Promise(function(_0x533e1b,_0x841f5a){var _0x2146d7=_0x47d577['split'](':');var _0x5d928c=_0x2146d7[0x0];var _0xaff8c=_0x2146d7[0x1];if(_0xaff8c!==''){var _0x39d364=_0xaff8c[_0xfe59('0x22')]('|');var _0x31e96e=[];for(var _0x4543c0=0x0;_0x4543c0<_0x39d364['length'];_0x4543c0++){if(_0x39d364[_0x4543c0]!==''){var _0x4f02d1=_[_0xfe59('0x23')](promisesAdditionalPhones,{'contactId':_0x39a1f3,'phone':_0x39d364[_0x4543c0]});if(_0x4f02d1[_0xfe59('0x1a')]==0x0){orderBy++;promisesAdditionalPhones[_0xfe59('0x1c')]({'contactId':_0x39a1f3,'contactTypeId':_0x5d928c,'phone':_0x39d364[_0x4543c0],'orderBy':orderBy});}}}_0x533e1b({'ok':0x1});}else _0x533e1b({'res':0x0});});}function createAdditionalPhone(_0xc28525,_0x3032d8,_0x5e7e9d,_0x18ac7e){var _0x174e0e='';var _0xf863f4='';var _0x57adb0=_0x5e7e9d[_0xfe59('0x22')]('§');_0x174e0e=_0x57adb0[0x0];if(_0x57adb0[_0xfe59('0x1a')]==0x2)_0xf863f4=_0x57adb0[0x1];return new Promise(function(_0x5cdf81,_0x33c62e){return db[_0xfe59('0x24')][_0xfe59('0x25')]({'where':{'CmContactId':_0xc28525,'item':_0x174e0e}})[_0xfe59('0x1e')](function(_0x8e90b2){if(_0x8e90b2){return db[_0xfe59('0x24')][_0xfe59('0x26')]({'ItemTypeId':_0x3032d8,'description':_0xf863f4,'OrderBy':_0x18ac7e},{'where':{'CmContactId':_0xc28525,'item':_0x174e0e}})['then'](function(_0x39cfce){_0x5cdf81({'res':'updated'});});}else{return db[_0xfe59('0x24')]['create']({'CmContactId':_0xc28525,'item':_0x174e0e,'ItemTypeId':_0x3032d8,'description':_0xf863f4,'OrderBy':_0x18ac7e,'ItemClass':_0xfe59('0x27')})[_0xfe59('0x1e')](function(_0x26a2ea){_0x5cdf81({'res':_0xfe59('0x28')});});}});});}function updateContact(_0x258077){return new Promise(function(_0x1ad613,_0x8276ea){var _0x5259ac=_0x258077['id'];delete _0x258077['id'];return db[_0xfe59('0x29')][_0xfe59('0x26')](_0x258077,{'where':{'id':_0x5259ac}})[_0xfe59('0x1e')](function(_0x106f23){updatedRows+=0x1;return db['CmHopper']['update']({'phone':_0x258077[_0xfe59('0x12')]},{'where':{'ContactId':_0x5259ac}})[_0xfe59('0x1e')](function(_0x353c2b){_0x1ad613({'ret':'OK'});});});});}function insertCmHopper(_0x39a353,_0x3d43ea,_0x12a185,_0x1c19ae,_0x2af329){var _0x551937=['cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id',_0xfe59('0x2a'),_0x3d43ea+'.'+_0x1c19ae,'cm_contacts.createdAt','cm_contacts.updatedAt',_0xfe59('0x2b'),'cm_contacts.UserId','\x22'+_0x2af329+'\x22'];return squel[_0xfe59('0x2c')]()[_0xfe59('0x2d')](_0xfe59('0x2e'))[_0xfe59('0x2f')]([_0xfe59('0x12'),_0xfe59('0x30'),_0xfe59('0x31'),'ListId',_0x1c19ae,_0xfe59('0x32'),_0xfe59('0x33'),_0xfe59('0x34'),_0xfe59('0x35'),'recallme'],squel['select']()[_0xfe59('0x36')](_0x551937)['from'](_0x3d43ea)[_0xfe59('0x16')](_0xfe59('0x37'),null,_0xfe59('0x38')+_0x3d43ea+_0xfe59('0x39'))[_0xfe59('0x16')](_0x12a185,null,_0x12a185+_0xfe59('0x3a')+_0x3d43ea+'.'+_0x1c19ae)[_0xfe59('0x14')](_0x3d43ea+_0xfe59('0x3b'),_0x39a353)[_0xfe59('0x14')](_0xfe59('0x3c'),NOW)['where'](_0xfe59('0x3d'),selectNotIn(_0x3d43ea,_0x12a185,_0x1c19ae,_0xfe59('0x2e'),['\x22always\x22',_0xfe59('0x3e')]))[_0xfe59('0x14')](_0xfe59('0x3d'),selectNotIn(_0x3d43ea,_0x12a185,_0x1c19ae,_0xfe59('0x2e'),[_0xfe59('0x3f')])))[_0xfe59('0x40')]();}function insertCmHopperBlack(_0x1a73ee,_0xfd93be,_0x171138,_0x40b884){var _0x579156=[_0xfe59('0x41'),_0xfe59('0x42'),_0xfe59('0x2a'),_0xfd93be+'.'+_0x40b884,_0xfe59('0x43'),_0xfe59('0x44')];return squel['insert']()[_0xfe59('0x2d')]('cm_hopper_black')[_0xfe59('0x2f')](['phone',_0xfe59('0x31'),_0xfe59('0x45'),_0x40b884,_0xfe59('0x32'),_0xfe59('0x33')],squel['select']()[_0xfe59('0x36')](_0x579156)[_0xfe59('0x13')](_0xfd93be)[_0xfe59('0x16')](_0xfe59('0x37'),null,_0xfe59('0x38')+_0xfd93be+'.CmListId')['join'](_0x171138,null,_0x171138+_0xfe59('0x3a')+_0xfd93be+'.'+_0x40b884)[_0xfe59('0x14')](_0xfd93be+_0xfe59('0x3b'),_0x1a73ee)[_0xfe59('0x14')](_0xfe59('0x3c'),NOW)['where'](_0xfe59('0x3d'),squel[_0xfe59('0x10')]()[_0xfe59('0x11')](_0xfe59('0x12'))[_0xfe59('0x13')](_0xfe59('0x46'))['where']('ListId\x20=\x20?',_0x1a73ee)[_0xfe59('0x14')](_0x40b884+_0xfe59('0x47'),_0xfd93be+'.'+_0x40b884)))['toString']();}function insertCmHopperAdditionalPhones(_0x1554a9){var _0x120bf0=[_0xfe59('0x48'),_0xfe59('0x49'),_0xfe59('0x4a'),'cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt'];return squel[_0xfe59('0x2c')]()['into']('cm_hopper_additional_phones')[_0xfe59('0x2f')]([_0xfe59('0x4b'),_0xfe59('0x12'),_0xfe59('0x4c'),_0xfe59('0x32'),_0xfe59('0x33')],squel['select']()[_0xfe59('0x36')](_0x120bf0)[_0xfe59('0x13')](_0xfe59('0x2e'))[_0xfe59('0x16')]('cm_contacts',null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')['join'](_0xfe59('0x4d'),null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')[_0xfe59('0x14')](_0xfe59('0x4e'),_0x1554a9)['where'](_0xfe59('0x3c'),NOW))[_0xfe59('0x40')]();}function insertCmContact(_0x10329b,_0x5b467a,_0x34a00a,_0x9c488d){var _0x2a4704=_[_0xfe59('0x4f')](_['keys'](_0x9c488d),[_0xfe59('0x45'),'CompanyId',_0xfe59('0x32'),'updatedAt']);return squel[_0xfe59('0x2c')]()[_0xfe59('0x2d')](_0xfe59('0x37'))[_0xfe59('0x2f')](_0x2a4704,squel[_0xfe59('0x10')]()[_0xfe59('0x36')](_0x2a4704)[_0xfe59('0x13')](_0x5b467a)['where']('('+_0x34a00a[_0xfe59('0x16')](',')+_0xfe59('0x50'),squel[_0xfe59('0x10')]()[_0xfe59('0x36')](_0x34a00a)[_0xfe59('0x13')](_0xfe59('0x37'))[_0xfe59('0x14')](_0xfe59('0x51'),_0x10329b))[_0xfe59('0x14')]('id\x20IN\x20?',squel[_0xfe59('0x10')]()[_0xfe59('0x11')](_0xfe59('0x52'),'min_id')[_0xfe59('0x13')](_0x5b467a)[_0xfe59('0x53')](_0x34a00a[_0xfe59('0x16')](','))))[_0xfe59('0x40')]();}function handleStop(){logger[_0xfe59('0x54')](_0xfe59('0x55'));stopped=!![];}function handleUncaughtException(_0x1bad93){logger[_0xfe59('0x56')](_0x1bad93['message']);process[_0xfe59('0x57')](0x1);}function handleError(_0x4fdf4f,_0x4c9763){stats[_0xfe59('0x58')]['push']({'name':_0x4c9763[_0xfe59('0x59')],'message':_0x4c9763[_0xfe59('0x20')],'row':_0x4fdf4f});}function handleQuery(_0x4c81e6){logger[_0xfe59('0x54')](_0x4c81e6);return db[_0xfe59('0x17')][_0xfe59('0x18')](_0x4c81e6)['spread'](function(_0xe3cb75){results[_0xfe59('0x1c')](_0xe3cb75);})[_0xfe59('0x1f')](function(_0x2980d5){logger[_0xfe59('0x56')](_0x2980d5[_0xfe59('0x20')]);});}function main(_0x1467e6,_0x5eaab4,_0x284e69,_0x2544d4){logger[_0xfe59('0x54')](_0xfe59('0x5a'),_0x1467e6,JSON[_0xfe59('0x5b')](_0x5eaab4));process[_0xfe59('0x5c')](_0xfe59('0x5d'));var _0xb9c441=_0x5eaab4['binding'];var _0x222c99=_[_0xfe59('0x5e')](_0xb9c441);var _0x4e730d=_0x5eaab4[_0xfe59('0x5f')];var _0xd4a778=path[_0xfe59('0x16')](config[_0xfe59('0x60')],_0xfe59('0x61'),_0x4e730d+_0xfe59('0x62'));logger[_0xfe59('0x54')]('body',_0x5eaab4);db[_0xfe59('0x63')][_0xfe59('0x64')]({'raw':!![],'attributes':['id',_0xfe59('0x65')]})[_0xfe59('0x1e')](function(_0x4a7b81){for(var _0x2d2e7c=0x0;_0x2d2e7c<_0x4a7b81['length'];_0x2d2e7c++){if(_0x4a7b81[_0x2d2e7c][_0xfe59('0x65')]in _0xb9c441){contactItemTypes['push'](_0x4a7b81[_0x2d2e7c]);delete _0x222c99[_0x4a7b81[_0x2d2e7c]['name']];hasAdditionalPhones=!![];}for(var _0x233e51 in _0xb9c441){if(_0x4a7b81[_0x2d2e7c]['name']+_0xfe59('0x66')===_0x233e51){phoneDescriptions['push']({'itemTypeId':_0x4a7b81[_0x2d2e7c]['id'],'description':_0x233e51});delete _0x222c99[_0x233e51];}}}if(hasAdditionalPhones)_0x222c99[_0xfe59('0x21')]='';var _0x41d0a0=_[_0xfe59('0x67')](_0x222c99)['join']();logger[_0xfe59('0x54')](_0xfe59('0x68'),_0x41d0a0);fs[_0xfe59('0x69')](_0xd4a778,_0x41d0a0+'\x0a');Papa[_0xfe59('0x6a')](fs[_0xfe59('0x6b')](_0x1467e6),{'header':!![],'skipEmptyLines':!![],'step':function(_0x28412f,_0x20403b){try{for(var _0x25e957=0x0,_0x280112=[];_0x25e957<_0x28412f[_0xfe59('0x6c')][_0xfe59('0x1a')];_0x25e957++){stats[_0xfe59('0x6d')]+=0x1;if(_0x28412f[_0xfe59('0x58')][_0x25e957]){handleError(_0x28412f['data'][_0x25e957],_0x28412f[_0xfe59('0x58')][_0x25e957]);}else{var _0x371da1=[];var _0xb1100e=[];var _0x11402a={};for(var _0x303216 in _0xb9c441){let _0x14ee0b=contactItemTypes[_0xfe59('0x6e')](_0x49033d=>_0x49033d['name']===_0x303216);let _0x1726a2=contactItemTypes['find'](_0x356253=>_0x356253[_0xfe59('0x65')]+_0xfe59('0x66')===_0x303216);if(_[_0xfe59('0x1b')](_0x14ee0b)&&_[_0xfe59('0x1b')](_0x1726a2)){if(_0xb9c441[_0xfe59('0x6f')](_0x303216)){if(_0x28412f['data'][_0x25e957][_0xb9c441[_0x303216]]){var _0x32efe4=_[_0xfe59('0x70')](_0x28412f[_0xfe59('0x6c')][_0x25e957][_0xb9c441[_0x303216]][_0xfe59('0x71')](/"/g,'\x27'));switch(_0x303216){case _0xfe59('0x30'):var _0x4b3863=moment(_0x32efe4,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x4b3863[_0xfe59('0x72')]()){_0x280112[_0xfe59('0x1c')]('\x22'+_0x32efe4+'\x22');}else{_0x371da1[_0xfe59('0x1c')](_0xfe59('0x73'));}break;case _0xfe59('0x34'):var _0x3e65bc=parseInt(_0x32efe4);_0x32efe4=_[_0xfe59('0x74')](_0x3e65bc)||_0x3e65bc<0x0||_0x3e65bc>0x4?_0x2544d4?0x3:0x2:_0x3e65bc;_0x280112[_0xfe59('0x1c')]('\x22'+_0x32efe4+'\x22');break;case'UserId':var _0xf133b=parseInt(_0x32efe4);if(_[_0xfe59('0x75')](_0xf133b)&&_[_0xfe59('0x76')](_0x284e69,_0xf133b)){_0x280112[_0xfe59('0x1c')]('\x22'+_0xf133b+'\x22');}else{_0x371da1['push'](_0xfe59('0x77'));}break;case _0xfe59('0x78'):if(isEmail(_0x32efe4)){_0x280112[_0xfe59('0x1c')]('\x22'+_0x32efe4+'\x22');}else{_0x371da1['push'](_0xfe59('0x79'));}break;case _0xfe59('0x7a'):var _0x537d2e=moment(_0x32efe4,_0xfe59('0x7b'),!![]);if(_0x537d2e[_0xfe59('0x72')]()){_0x280112['push']('\x22'+_0x32efe4+'\x22');}else{_0x371da1['push'](_0xfe59('0x7c'));}break;default:_0x280112['push']('\x22'+_0x32efe4+'\x22');}}else{switch(_0x303216){case _0xfe59('0x7d'):case'phone':_0x371da1['push'](_0x303216+_0xfe59('0x7e'));break;default:_0x280112['push']('\x22\x22');}}}}else{var _0x1d709c='';if(!_[_0xfe59('0x1b')](_0x14ee0b)){if(!_0x11402a[_0xfe59('0x6f')](_0x14ee0b['id'])){for(var _0xdd0797=0x0;_0xdd0797<_0xb9c441[_0x303216][_0xfe59('0x1a')];_0xdd0797++){var _0x32efe4=_[_0xfe59('0x70')](_0x28412f[_0xfe59('0x6c')][_0x25e957][_0xb9c441[_0x303216][_0xdd0797]][_0xfe59('0x71')](/"/g,'\x27'));var _0x3dc99d=phoneDescriptions[_0xfe59('0x6e')](_0x2f49a8=>_0x2f49a8[_0xfe59('0x7f')]===_0x14ee0b['id']);if(!_['isNil'](_0x3dc99d)){var _0x124f48=_[_0xfe59('0x70')](_0x28412f[_0xfe59('0x6c')][_0x25e957][_0xb9c441[_0x3dc99d['description']][0x0]][_0xfe59('0x71')](/"/g,'\x27'));if(!_[_0xfe59('0x1b')](_0x124f48))_0x32efe4=_0x32efe4+'§'+_0x124f48;}if(_0x1d709c=='')_0x1d709c=_0x32efe4;else _0x1d709c+='|'+_0x32efe4;}_0xb1100e[_0xfe59('0x1c')](_0x14ee0b['id']+':'+_0x1d709c);_0x11402a[_0x14ee0b['id']]=0x1;}}}}if(hasAdditionalPhones){_0x280112[_0xfe59('0x1c')]('\x22'+_0xb1100e[_0xfe59('0x16')](';')+'\x22');}if(_0x371da1[_0xfe59('0x1a')]){handleError(_0x28412f[_0xfe59('0x6c')][_0x25e957],{'code':_0xfe59('0x80'),'message':_0x371da1[_0xfe59('0x16')]()});}else{fs['appendFileSync'](_0xd4a778,_0x280112[_0xfe59('0x16')]()+'\x0a');}_0x280112=[];}if(!(stats['rows']%0xc8)){socket[_0xfe59('0x81')](_0xfe59('0x82')+_0x4e730d,stats);stats[_0xfe59('0x58')]=[];}}if(stopped){logger[_0xfe59('0x54')](_0xfe59('0x83'));_0x20403b['abort']();}}catch(_0x36fc62){handleError(_0x28412f[_0xfe59('0x6c')][_0x25e957],{'code':_0xfe59('0x84'),'message':_0x36fc62[_0xfe59('0x20')]});logger[_0xfe59('0x56')](_0xfe59('0x85'),_0x36fc62[_0xfe59('0x20')]);}},'complete':function(){try{var _0x17cea4=[];var _0xd4c6e0=tempTableName;_0x17cea4[_0xfe59('0x1c')](_0xfe59('0x86')+_0xd4c6e0+_0xfe59('0x87'));logger['info'](_0xfe59('0x88'),contactItemTypes['length']);var _0xcd795f=util[_0xfe59('0xc')](_0xfe59('0x89'),_0xd4a778,_0xd4c6e0,_0x41d0a0,_0x5eaab4[_0xfe59('0x45')],_0x5eaab4['CompanyId']||null,NOW,NOW);if(_[_0xfe59('0x1b')](_0xb9c441[_0xfe59('0x30')])){_0xcd795f+=',\x20scheduledAt\x20=\x20NOW()';}_0x17cea4[_0xfe59('0x1c')](_0xcd795f);BPromise['each'](_0x17cea4,handleQuery)[_0xfe59('0x1e')](function(_0x4d48a0){BPromise['all']([handleAdditionalPhones()])[_0xfe59('0x1e')](function(){_0x17cea4=[];for(var _0x1e7772=0x0;_0x1e7772_0x23bfb7[_0x9591('0x66')]===_0x359de5);let _0x3d404f=contactItemTypes['find'](_0xf630f=>_0xf630f[_0x9591('0x66')]+_0x9591('0x67')===_0x359de5);if(_[_0x9591('0x1a')](_0x56c294)&&_[_0x9591('0x1a')](_0x3d404f)){if(_0xd8c090[_0x9591('0x6d')](_0x359de5)){if(_0x1f1fb9['data'][_0x567cec][_0xd8c090[_0x359de5]]){var _0x18cbfb=_[_0x9591('0x6e')](_0x1f1fb9[_0x9591('0x6b')][_0x567cec][_0xd8c090[_0x359de5]][_0x9591('0x6f')](/"/g,'\x27'));switch(_0x359de5){case'scheduledat':var _0x1afa5b=moment(_0x18cbfb,_0x9591('0xd'),!![]);if(_0x1afa5b[_0x9591('0x70')]()){_0x2cdc50[_0x9591('0x1b')]('\x22'+_0x18cbfb+'\x22');}else{_0x55098f[_0x9591('0x1b')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0x9591('0x35'):var _0x5be835=parseInt(_0x18cbfb);_0x18cbfb=_[_0x9591('0x71')](_0x5be835)||_0x5be835<0x0||_0x5be835>0x4?_0xf3ca72?0x3:0x2:_0x5be835;_0x2cdc50[_0x9591('0x1b')]('\x22'+_0x18cbfb+'\x22');break;case _0x9591('0x36'):var _0x3a1f39=parseInt(_0x18cbfb);if(_[_0x9591('0x72')](_0x3a1f39)&&_[_0x9591('0x73')](_0x20d5e0,_0x3a1f39)){_0x2cdc50[_0x9591('0x1b')]('\x22'+_0x3a1f39+'\x22');}else{_0x55098f['push']('agent\x20not\x20exists');}break;case _0x9591('0x74'):if(isEmail(_0x18cbfb)){_0x2cdc50[_0x9591('0x1b')]('\x22'+_0x18cbfb+'\x22');}else{_0x55098f[_0x9591('0x1b')](_0x9591('0x75'));}break;case _0x9591('0x76'):var _0x34188e=moment(_0x18cbfb,_0x9591('0x77'),!![]);if(_0x34188e[_0x9591('0x70')]()){_0x2cdc50['push']('\x22'+_0x18cbfb+'\x22');}else{_0x55098f[_0x9591('0x1b')](_0x9591('0x78'));}break;default:_0x2cdc50[_0x9591('0x1b')]('\x22'+_0x18cbfb+'\x22');}}else{switch(_0x359de5){case'firstName':case _0x9591('0x11'):_0x55098f[_0x9591('0x1b')](_0x359de5+_0x9591('0x79'));break;default:_0x2cdc50[_0x9591('0x1b')]('\x22\x22');}}}}else{var _0x32bbaa='';if(!_[_0x9591('0x1a')](_0x56c294)){if(!_0x319993['hasOwnProperty'](_0x56c294['id'])){for(var _0x30b0f5=0x0;_0x30b0f5<_0xd8c090[_0x359de5][_0x9591('0x19')];_0x30b0f5++){var _0x18cbfb=_['trim'](_0x1f1fb9[_0x9591('0x6b')][_0x567cec][_0xd8c090[_0x359de5][_0x30b0f5]]['replace'](/"/g,'\x27'));var _0x6ddba=phoneDescriptions['find'](_0x26bc64=>_0x26bc64[_0x9591('0x7a')]===_0x56c294['id']);if(!_[_0x9591('0x1a')](_0x6ddba)){var _0x53c7c0=_[_0x9591('0x6e')](_0x1f1fb9[_0x9591('0x6b')][_0x567cec][_0xd8c090[_0x6ddba[_0x9591('0x7b')]][0x0]][_0x9591('0x6f')](/"/g,'\x27'));if(!_[_0x9591('0x1a')](_0x53c7c0))_0x18cbfb=_0x18cbfb+'§'+_0x53c7c0;}if(_0x32bbaa=='')_0x32bbaa=_0x18cbfb;else _0x32bbaa+='|'+_0x18cbfb;}_0x46fe86[_0x9591('0x1b')](_0x56c294['id']+':'+_0x32bbaa);_0x319993[_0x56c294['id']]=0x1;}}}}if(hasAdditionalPhones){_0x2cdc50['push']('\x22'+_0x46fe86[_0x9591('0x14')](';')+'\x22');}if(_0x55098f['length']){handleError(_0x1f1fb9[_0x9591('0x6b')][_0x567cec],{'code':_0x9591('0x7c'),'message':_0x55098f[_0x9591('0x14')]()});}else{fs[_0x9591('0x7d')](_0x510a71,_0x2cdc50[_0x9591('0x14')]()+'\x0a');}_0x2cdc50=[];}if(!(stats[_0x9591('0x6c')]%0xc8)){socket['emit'](_0x9591('0x7e')+_0x52d3d9,stats);stats[_0x9591('0x59')]=[];}}if(stopped){logger[_0x9591('0x56')](_0x9591('0x7f'));_0x5cf222[_0x9591('0x80')]();}}catch(_0x46b110){handleError(_0x1f1fb9['data'][_0x567cec],{'code':_0x9591('0x81'),'message':_0x46b110['message']});logger[_0x9591('0x1d')](_0x9591('0x82'),_0x46b110[_0x9591('0x5b')]);}},'complete':function(){try{var _0xbd025=[];var _0x3ca676=tempTableName;_0xbd025[_0x9591('0x1b')](_0x9591('0x83')+_0x3ca676+_0x9591('0x84'));logger[_0x9591('0x56')](_0x9591('0x85'),contactItemTypes[_0x9591('0x19')]);var _0x387715=util[_0x9591('0xc')](_0x9591('0x86'),_0x510a71,_0x3ca676,_0x9b398a,_0x10b224[_0x9591('0x42')],_0x10b224['CompanyId']||null,NOW,NOW);if(_['isNil'](_0xd8c090[_0x9591('0x31')])){_0x387715+=_0x9591('0x87');}_0xbd025[_0x9591('0x1b')](_0x387715);BPromise[_0x9591('0x88')](_0xbd025,handleQuery)[_0x9591('0x1c')](function(_0x3ba287){BPromise['all']([handleAdditionalPhones()])['then'](function(){_0xbd025=[];for(var _0x58b96a=0x0;_0x58b96a\x20\x20');}var _0x33863f=path[_0x9591('0x14')](config[_0x9591('0x94')],_0x9591('0x62'),process[_0x9591('0x93')][0x2]);if(!fs[_0x9591('0x95')](_0x33863f)){throw new Error(_0x9591('0x96'));}var _0x4f0f1d={};try{_0x4f0f1d=JSON[_0x9591('0x69')](process[_0x9591('0x93')][0x3]);if(!_0x4f0f1d['binding']){throw new Error(_0x9591('0x97'));}var _0x87b65b=0x0;if(_0x4f0f1d['binding']['UserId']){_0x87b65b=0x1;}if(!_0x4f0f1d['ListId']){throw new Error(_0x9591('0x98'));}}catch(_0x4ab100){throw new Error('body\x20id\x20mandatory');}var _0x52716d=[];try{_0x52716d=_[_0x9591('0x99')](JSON[_0x9591('0x69')](process[_0x9591('0x93')][0x4]),'id');}catch(_0x452e79){logger[_0x9591('0x56')](_0x9591('0x9a'));}main(_0x33863f,_0x4f0f1d,_0x52716d,_0x87b65b);}validate();process['on']('SIGINT',handleStop);process['on'](_0x9591('0x9b'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index 2bcc89d..1f03fd6 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 _0x496e=['inbound','push','variable','queue','calleridnum','outbound','Outbound\x20Call','getDescriptions','toLowerCase','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','Caller\x20Name','calleridname','destexten','UniqueId','uniqueid','agentcalledAt','***\x20Agent\x20Info\x20***','destcalleridname','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Connect','agentconnectAt','Agent\x20Complete','agentcompleteAt','holdtime','talktime','Called\x20Number','Member\x20Name','membername','Date','starttime','Answer\x20Time','answertime','endtime','Duration','duration','Billable\x20Time','billableseconds','getSubjects','string','voice'];(function(_0x5c4c36,_0x506043){var _0xe3c7ab=function(_0x31f3fe){while(--_0x31f3fe){_0x5c4c36['push'](_0x5c4c36['shift']());}};_0xe3c7ab(++_0x506043);}(_0x496e,0x12a));var _0xe496=function(_0x28564c,_0x59e15c){_0x28564c=_0x28564c-0x0;var _0x221699=_0x496e[_0x28564c];return _0x221699;};'use strict';exports[_0xe496('0x0')]=function(_0x103fc7,_0x3e45d4){var _0x2b6e01=[{'type':_0xe496('0x1'),'content':'[xCALLY\x20Ticket]','variableName':null}];switch(_0x103fc7['toLowerCase']()){case _0xe496('0x2'):switch(_0x3e45d4['toLowerCase']()){case _0xe496('0x3'):_0x2b6e01[_0xe496('0x4')]({'type':_0xe496('0x5'),'content':'','variableName':_0xe496('0x6')});_0x2b6e01[_0xe496('0x4')]({'type':'variable','content':'','variableName':_0xe496('0x7')});break;case _0xe496('0x8'):_0x2b6e01[_0xe496('0x4')]({'type':_0xe496('0x1'),'content':_0xe496('0x9'),'variableName':null});_0x2b6e01[_0xe496('0x4')]({'type':_0xe496('0x5'),'content':'','variableName':'destcalleridnum'});break;}}return _0x2b6e01;};exports[_0xe496('0xa')]=function(_0xe2a3b6,_0x412304){var _0x3e4eac=[];switch(_0xe2a3b6['toLowerCase']()){case _0xe496('0x2'):switch(_0x412304[_0xe496('0xb')]()){case _0xe496('0x3'):_0x3e4eac=[{'type':'string','content':_0xe496('0xc'),'key':null,'keyType':null,'variableName':null},{'type':_0xe496('0xd'),'content':'','key':_0xe496('0xe'),'keyType':'variable','variableName':_0xe496('0x7')},{'type':_0xe496('0xd'),'content':'','key':_0xe496('0xf'),'keyType':_0xe496('0x5'),'variableName':_0xe496('0x10')},{'type':'keyValue','content':'','key':'Call\x20To','keyType':_0xe496('0x5'),'variableName':_0xe496('0x11')},{'type':_0xe496('0xd'),'content':'','key':'Queue','keyType':'variable','variableName':_0xe496('0x6')},{'type':'keyValue','content':'','key':_0xe496('0x12'),'keyType':'variable','variableName':_0xe496('0x13')},{'type':'keyValue','content':'','key':'Date','keyType':_0xe496('0x5'),'variableName':_0xe496('0x14')},{'type':'string','content':_0xe496('0x15'),'key':null,'keyType':null,'variableName':null},{'type':_0xe496('0xd'),'content':'','key':'Agent\x20Name','keyType':'variable','variableName':_0xe496('0x16')},{'type':_0xe496('0xd'),'content':'','key':'Agent\x20Number','keyType':'variable','variableName':'destcalleridnum'},{'type':_0xe496('0x1'),'content':_0xe496('0x17'),'key':null,'keyType':null,'variableName':null},{'type':_0xe496('0xd'),'content':'','key':_0xe496('0x18'),'keyType':_0xe496('0x5'),'variableName':_0xe496('0x14')},{'type':_0xe496('0xd'),'content':'','key':_0xe496('0x19'),'keyType':_0xe496('0x5'),'variableName':_0xe496('0x1a')},{'type':'keyValue','content':'','key':_0xe496('0x1b'),'keyType':'variable','variableName':_0xe496('0x1c')},{'type':_0xe496('0xd'),'content':'','key':'Hold\x20Time','keyType':_0xe496('0x5'),'variableName':_0xe496('0x1d')},{'type':_0xe496('0xd'),'content':'','key':'Talk\x20Time','keyType':_0xe496('0x5'),'variableName':_0xe496('0x1e')}];break;case _0xe496('0x8'):_0x3e4eac=[{'type':_0xe496('0x1'),'content':_0xe496('0xc'),'variableName':null},{'type':_0xe496('0xd'),'content':'','key':_0xe496('0x1f'),'keyType':_0xe496('0x5'),'keyContent':'','variableName':'destcalleridnum'},{'type':_0xe496('0xd'),'content':'','key':_0xe496('0x20'),'keyType':_0xe496('0x5'),'keyContent':'','variableName':_0xe496('0x21')},{'type':_0xe496('0xd'),'content':'','key':_0xe496('0x12'),'keyType':_0xe496('0x5'),'keyContent':'','variableName':_0xe496('0x13')},{'type':_0xe496('0xd'),'content':'','key':_0xe496('0x22'),'keyType':_0xe496('0x5'),'keyContent':'','variableName':_0xe496('0x23')},{'type':_0xe496('0x1'),'content':_0xe496('0x17')},{'type':_0xe496('0xd'),'content':'','key':_0xe496('0x24'),'keyType':_0xe496('0x5'),'keyContent':'','variableName':_0xe496('0x25')},{'type':_0xe496('0xd'),'content':'','key':'Complete\x20Time','keyType':'variable','keyContent':'','variableName':_0xe496('0x26')},{'type':_0xe496('0xd'),'content':'','key':_0xe496('0x27'),'keyType':_0xe496('0x5'),'keyContent':'','variableName':_0xe496('0x28')},{'type':'keyValue','content':'','key':_0xe496('0x29'),'keyType':_0xe496('0x5'),'keyContent':'','variableName':_0xe496('0x2a')}];break;}}return _0x3e4eac;}; \ No newline at end of file +var _0x5306=['agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','talktime','Member\x20Name','membername','uniqueid','starttime','Answer\x20Time','Complete\x20Time','Duration','duration','Billable\x20Time','billableseconds','getSubjects','string','[xCALLY\x20Ticket]','toLowerCase','voice','push','variable','queue','calleridnum','Outbound\x20Call','destcalleridnum','getDescriptions','inbound','***\x20Call\x20Info\x20***','Caller\x20Number','keyValue','Caller\x20Name','Call\x20To','destexten','Queue','UniqueId','Date','agentcalledAt','***\x20Agent\x20Info\x20***','destcalleridname','***\x20Time\x20Info\x20***','agentconnectAt','Agent\x20Complete'];(function(_0x3f4891,_0x4e6f62){var _0x54f2d8=function(_0x2b11ee){while(--_0x2b11ee){_0x3f4891['push'](_0x3f4891['shift']());}};_0x54f2d8(++_0x4e6f62);}(_0x5306,0x1bd));var _0x6530=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5306[_0x3dd15e];return _0x231fd0;};'use strict';exports[_0x6530('0x0')]=function(_0x164f3e,_0x6eea13){var _0x75e50b=[{'type':_0x6530('0x1'),'content':_0x6530('0x2'),'variableName':null}];switch(_0x164f3e[_0x6530('0x3')]()){case _0x6530('0x4'):switch(_0x6eea13[_0x6530('0x3')]()){case'inbound':_0x75e50b[_0x6530('0x5')]({'type':_0x6530('0x6'),'content':'','variableName':_0x6530('0x7')});_0x75e50b[_0x6530('0x5')]({'type':_0x6530('0x6'),'content':'','variableName':_0x6530('0x8')});break;case'outbound':_0x75e50b['push']({'type':_0x6530('0x1'),'content':_0x6530('0x9'),'variableName':null});_0x75e50b['push']({'type':_0x6530('0x6'),'content':'','variableName':_0x6530('0xa')});break;}}return _0x75e50b;};exports[_0x6530('0xb')]=function(_0x108812,_0x49de2a){var _0x4bdd89=[];switch(_0x108812['toLowerCase']()){case _0x6530('0x4'):switch(_0x49de2a[_0x6530('0x3')]()){case _0x6530('0xc'):_0x4bdd89=[{'type':_0x6530('0x1'),'content':_0x6530('0xd'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x6530('0xe'),'keyType':'variable','variableName':_0x6530('0x8')},{'type':_0x6530('0xf'),'content':'','key':_0x6530('0x10'),'keyType':_0x6530('0x6'),'variableName':'calleridname'},{'type':_0x6530('0xf'),'content':'','key':_0x6530('0x11'),'keyType':'variable','variableName':_0x6530('0x12')},{'type':_0x6530('0xf'),'content':'','key':_0x6530('0x13'),'keyType':_0x6530('0x6'),'variableName':_0x6530('0x7')},{'type':_0x6530('0xf'),'content':'','key':_0x6530('0x14'),'keyType':_0x6530('0x6'),'variableName':'uniqueid'},{'type':_0x6530('0xf'),'content':'','key':_0x6530('0x15'),'keyType':_0x6530('0x6'),'variableName':_0x6530('0x16')},{'type':_0x6530('0x1'),'content':_0x6530('0x17'),'key':null,'keyType':null,'variableName':null},{'type':_0x6530('0xf'),'content':'','key':'Agent\x20Name','keyType':'variable','variableName':_0x6530('0x18')},{'type':'keyValue','content':'','key':'Agent\x20Number','keyType':_0x6530('0x6'),'variableName':_0x6530('0xa')},{'type':_0x6530('0x1'),'content':_0x6530('0x19'),'key':null,'keyType':null,'variableName':null},{'type':_0x6530('0xf'),'content':'','key':'Agent\x20Ring','keyType':_0x6530('0x6'),'variableName':_0x6530('0x16')},{'type':'keyValue','content':'','key':'Agent\x20Connect','keyType':_0x6530('0x6'),'variableName':_0x6530('0x1a')},{'type':'keyValue','content':'','key':_0x6530('0x1b'),'keyType':_0x6530('0x6'),'variableName':_0x6530('0x1c')},{'type':_0x6530('0xf'),'content':'','key':_0x6530('0x1d'),'keyType':_0x6530('0x6'),'variableName':_0x6530('0x1e')},{'type':_0x6530('0xf'),'content':'','key':_0x6530('0x1f'),'keyType':_0x6530('0x6'),'variableName':_0x6530('0x20')}];break;case'outbound':_0x4bdd89=[{'type':_0x6530('0x1'),'content':_0x6530('0xd'),'variableName':null},{'type':'keyValue','content':'','key':'Called\x20Number','keyType':_0x6530('0x6'),'keyContent':'','variableName':_0x6530('0xa')},{'type':_0x6530('0xf'),'content':'','key':_0x6530('0x21'),'keyType':'variable','keyContent':'','variableName':_0x6530('0x22')},{'type':_0x6530('0xf'),'content':'','key':'UniqueId','keyType':_0x6530('0x6'),'keyContent':'','variableName':_0x6530('0x23')},{'type':_0x6530('0xf'),'content':'','key':_0x6530('0x15'),'keyType':_0x6530('0x6'),'keyContent':'','variableName':_0x6530('0x24')},{'type':'string','content':'***\x20Time\x20Info\x20***'},{'type':_0x6530('0xf'),'content':'','key':_0x6530('0x25'),'keyType':'variable','keyContent':'','variableName':'answertime'},{'type':_0x6530('0xf'),'content':'','key':_0x6530('0x26'),'keyType':_0x6530('0x6'),'keyContent':'','variableName':'endtime'},{'type':'keyValue','content':'','key':_0x6530('0x27'),'keyType':_0x6530('0x6'),'keyContent':'','variableName':_0x6530('0x28')},{'type':_0x6530('0xf'),'content':'','key':_0x6530('0x29'),'keyType':'variable','keyContent':'','variableName':_0x6530('0x2a')}];break;}}return _0x4bdd89;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index 20b5b77..5677e46 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 _0xb7c2=['body','where','filter','read','checkAccountsRestrictions','i.id','ids','tag','countFilteredInteractions','count','length','order','forEach','DESC','rows','catch','tracked','user','query','html','phone','fax','updateUser','lodash','./sql-utils','findAll','skipInteractionsQuery','resolve','getInteractionsQuery','then','search','parseAdvancedSearchFilter','parseQueryParameters'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb7c2,0x1e5));var _0x2b7c=function(_0x4ef48a,_0x44cf22){_0x4ef48a=_0x4ef48a-0x0;var _0x3c4bb5=_0xb7c2[_0x4ef48a];return _0x3c4bb5;};'use strict';var _=require(_0x2b7c('0x0'));var sqlUtils=require(_0x2b7c('0x1'));var utils=require('./utils');exports[_0x2b7c('0x2')]=function(_0x20b854,_0x4a5d25,_0xdfd06f,_0x43e3ff,_0x358891){var _0x3ba015={'count':0x0,'rows':[]};var _0x4ebdeb=sqlUtils[_0x2b7c('0x3')](_0x20b854,_0xdfd06f,_0x4a5d25);if(_0x4ebdeb){return Promise[_0x2b7c('0x4')](_0x3ba015);}var _0x1ca7ea=sqlUtils[_0x2b7c('0x5')](_0x20b854);var _0x5632d0={};return Promise[_0x2b7c('0x4')]()[_0x2b7c('0x6')](function(){if(_0x4a5d25[_0x2b7c('0x7')]){return sqlUtils[_0x2b7c('0x8')](_0x4a5d25[_0x2b7c('0x7')],_0x358891);}else{return sqlUtils[_0x2b7c('0x9')](_0x20b854,_0x4a5d25,_0x358891);}})[_0x2b7c('0x6')](function(_0x283422){_0x1ca7ea['where'](_0x283422[_0x2b7c('0xa')]);_0x1ca7ea[_0x2b7c('0xb')](_0x283422['contact']);_0x1ca7ea[_0x2b7c('0xb')](_0x283422['default']);_0x1ca7ea[_0x2b7c('0xb')](_0x283422['fields']);_0x1ca7ea[_0x2b7c('0xb')](_0x283422[_0x2b7c('0xc')]);_0x1ca7ea['where'](_0x283422['user']);_0x1ca7ea['having'](_0x283422[_0x2b7c('0xd')]);_0x5632d0=_0x283422['tags'];return sqlUtils[_0x2b7c('0xe')](_0x20b854,_0xdfd06f,_0x4a5d25);})['then'](function(_0x8aaab9){_0x1ca7ea[_0x2b7c('0xb')](_0x8aaab9);_0x1ca7ea['group'](_0x2b7c('0xf'));var _0x58eddc=_0x4a5d25['search']?_0x5632d0[_0x2b7c('0x10')]:_0x4a5d25[_0x2b7c('0x11')];return sqlUtils[_0x2b7c('0x12')](_0x1ca7ea,_0x58eddc);})['then'](function(_0x5c98b0){_0x3ba015[_0x2b7c('0x13')]=_0x5c98b0[_0x2b7c('0x14')];if(_0x3ba015[_0x2b7c('0x13')]===0x0){return[];}_0x1ca7ea['having'](_0x5632d0['clause']);if(_0x43e3ff[_0x2b7c('0x15')]){_0x43e3ff[_0x2b7c('0x15')][_0x2b7c('0x16')](function(_0xbcf8da){var _0x44d659=_0xbcf8da[0x0]==='contactName'?_0xbcf8da[0x0]:'i.'+_0xbcf8da[0x0];_0x1ca7ea[_0x2b7c('0x15')](_0x44d659,_0xbcf8da[0x1]===_0x2b7c('0x17')?![]:!![]);if(_0xbcf8da[0x0]==='closed'){var _0x194d7d=sqlUtils['getClosedOrderClause'](_0x20b854,_0x4a5d25);_0x1ca7ea[_0x2b7c('0x15')](_0x194d7d,_0xbcf8da[0x1]===_0x2b7c('0x17')?![]:!![]);}});}return sqlUtils['getFilteredInteractions'](_0x20b854,_0x1ca7ea,_0x4a5d25,_0x43e3ff);})[_0x2b7c('0x6')](function(_0x2cebc3){_0x3ba015[_0x2b7c('0x18')]=_0x2cebc3;return _0x3ba015;})[_0x2b7c('0x19')](function(_0x15f2a4){throw _0x15f2a4;});};exports[_0x2b7c('0x1a')]=function(_0x34b593,_0x41a3d8){return function(_0x5a47d5,_0x249125,_0x5d999a){var _0x30231e=_0x5a47d5[_0x2b7c('0x1b')];var _0x2126e9={};var _0x1bb656=_0x5a47d5[_0x2b7c('0x1c')];if(_0x2126e9){_0x2126e9=_['clone'](_0x5a47d5[_0x2b7c('0xa')]);_0x2126e9=_['omit'](_0x2126e9,[_0x2b7c('0xa'),_0x2b7c('0x1d'),_0x2b7c('0x1e'),_0x2b7c('0x1f'),'mobile']);}utils[_0x2b7c('0x20')](_0x30231e,_0x2126e9,_0x1bb656,_0x34b593,_0x41a3d8);_0x5d999a(null);};}; \ No newline at end of file +var _0x3615=['rows','catch','tracked','user','query','omit','html','phone','fax','mobile','updateUser','lodash','./sql-utils','./utils','findAll','skipInteractionsQuery','resolve','getInteractionsQuery','search','parseAdvancedSearchFilter','parseQueryParameters','then','where','body','default','fields','having','read','checkAccountsRestrictions','group','i.id','ids','countFilteredInteractions','count','length','order','forEach','closed','DESC','getFilteredInteractions'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3615,0x19b));var _0x5361=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x3615[_0xb0f7c3];return _0x28ea68;};'use strict';var _=require(_0x5361('0x0'));var sqlUtils=require(_0x5361('0x1'));var utils=require(_0x5361('0x2'));exports[_0x5361('0x3')]=function(_0x57864b,_0x37eeda,_0x4d4525,_0xa77700,_0x15a5bf){var _0x2a3d59={'count':0x0,'rows':[]};var _0x6a57e2=sqlUtils[_0x5361('0x4')](_0x57864b,_0x4d4525,_0x37eeda);if(_0x6a57e2){return Promise[_0x5361('0x5')](_0x2a3d59);}var _0x3b1877=sqlUtils[_0x5361('0x6')](_0x57864b);var _0x5cf5c0={};return Promise[_0x5361('0x5')]()['then'](function(){if(_0x37eeda[_0x5361('0x7')]){return sqlUtils[_0x5361('0x8')](_0x37eeda[_0x5361('0x7')],_0x15a5bf);}else{return sqlUtils[_0x5361('0x9')](_0x57864b,_0x37eeda,_0x15a5bf);}})[_0x5361('0xa')](function(_0x1ef594){_0x3b1877[_0x5361('0xb')](_0x1ef594[_0x5361('0xc')]);_0x3b1877[_0x5361('0xb')](_0x1ef594['contact']);_0x3b1877['where'](_0x1ef594[_0x5361('0xd')]);_0x3b1877[_0x5361('0xb')](_0x1ef594[_0x5361('0xe')]);_0x3b1877['where'](_0x1ef594['filter']);_0x3b1877['where'](_0x1ef594['user']);_0x3b1877[_0x5361('0xf')](_0x1ef594[_0x5361('0x10')]);_0x5cf5c0=_0x1ef594['tags'];return sqlUtils[_0x5361('0x11')](_0x57864b,_0x4d4525,_0x37eeda);})[_0x5361('0xa')](function(_0x1628f1){_0x3b1877[_0x5361('0xb')](_0x1628f1);_0x3b1877[_0x5361('0x12')](_0x5361('0x13'));var _0x2d84c7=_0x37eeda['search']?_0x5cf5c0[_0x5361('0x14')]:_0x37eeda['tag'];return sqlUtils[_0x5361('0x15')](_0x3b1877,_0x2d84c7);})[_0x5361('0xa')](function(_0x418b50){_0x2a3d59[_0x5361('0x16')]=_0x418b50[_0x5361('0x17')];if(_0x2a3d59['count']===0x0){return[];}_0x3b1877['having'](_0x5cf5c0['clause']);if(_0xa77700['order']){_0xa77700[_0x5361('0x18')][_0x5361('0x19')](function(_0x136aa0){var _0x63e74f=_0x136aa0[0x0]==='contactName'?_0x136aa0[0x0]:'i.'+_0x136aa0[0x0];_0x3b1877[_0x5361('0x18')](_0x63e74f,_0x136aa0[0x1]==='DESC'?![]:!![]);if(_0x136aa0[0x0]===_0x5361('0x1a')){var _0x5173b0=sqlUtils['getClosedOrderClause'](_0x57864b,_0x37eeda);_0x3b1877[_0x5361('0x18')](_0x5173b0,_0x136aa0[0x1]===_0x5361('0x1b')?![]:!![]);}});}return sqlUtils[_0x5361('0x1c')](_0x57864b,_0x3b1877,_0x37eeda,_0xa77700);})[_0x5361('0xa')](function(_0x1f873a){_0x2a3d59[_0x5361('0x1d')]=_0x1f873a;return _0x2a3d59;})[_0x5361('0x1e')](function(_0x49a559){throw _0x49a559;});};exports[_0x5361('0x1f')]=function(_0x3c8075,_0x5c06df){return function(_0x49b80d,_0x475bba,_0x271768){var _0x434e05=_0x49b80d[_0x5361('0x20')];var _0x5b8c7d={};var _0x2438f2=_0x49b80d[_0x5361('0x21')];if(_0x5b8c7d){_0x5b8c7d=_['clone'](_0x49b80d[_0x5361('0xc')]);_0x5b8c7d=_[_0x5361('0x22')](_0x5b8c7d,['body',_0x5361('0x23'),_0x5361('0x24'),_0x5361('0x25'),_0x5361('0x26')]);}utils[_0x5361('0x27')](_0x434e05,_0x5b8c7d,_0x2438f2,_0x3c8075,_0x5c06df);_0x271768(null);};}; \ No newline at end of file diff --git a/server/components/interaction/sql-utils.js b/server/components/interaction/sql-utils.js index 42e721f..31005ce 100644 --- a/server/components/interaction/sql-utils.js +++ b/server/components/interaction/sql-utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9348=['getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','openchannel','i.from\x20LIKE\x20?','sqlOperator','conditions','find','name','buildExpression','type','default','value','start','end','unreadMessages','operator','$substring','contact','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','Tag','split','tags','clause','and','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','plainBody','keys','parse','$gte','$lte','null','\x20IS\x20NULL','\x20=\x20?','resolve','then','fields','read','filter','get','capitalize','chat','agent','\x20IS\x20NOT\x20NULL','i.thirdDisposition','unshift','i.substatus','closed','shift','CONCAT_WS(\x27\x27,\x20','join','Interaction','Sequelize','SELECT','sequelize','toString','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','Account.email','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.id','i.createdAt','i.updatedAt','i.closed','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.secondDisposition','i.to','i.ContactId','i.UserId','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','TagIds','limit','offset','query','findOne','enableEmailPreview','all','clone','isEmpty','QueryTypes','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','./update-interaction','./utils','../../mysqldb','getAccountFK','role','search','select','field','from','getInteractionFK','user_has_','_interactions','u.id','u.fullname','ui.','left_join','users','u.id\x20=\x20ui.UserId','length','where','\x20IN\x20?','map','getInteractionsTables','interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','accounts','a.id\x20=\x20i.','messages','me.','\x20=\x20i.id','it.','tools_tags','t.id\x20=\x20it.TagId','expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','unreadMessages\x20{OPERATOR}\x200','replace','{OPERATOR}','isNumeric','i.id\x20LIKE\x20?','sms','includes','i.phone\x20LIKE\x20?','fax','i.fax\x20LIKE\x20?','mail','c.email\x20LIKE\x20?'];(function(_0x834c82,_0x58ad80){var _0x36c2b8=function(_0xe93243){while(--_0xe93243){_0x834c82['push'](_0x834c82['shift']());}};_0x36c2b8(++_0x58ad80);}(_0x9348,0x10d));var _0x8934=function(_0x189773,_0x3f00b6){_0x189773=_0x189773-0x0;var _0x4534ed=_0x9348[_0x189773];return _0x4534ed;};'use strict';var _=require(_0x8934('0x0'));var squel=require(_0x8934('0x1'));var as=require(_0x8934('0x2'));var qs=require(_0x8934('0x3'));var updateInteraction=require(_0x8934('0x4'))['updateInteraction'];var utils=require(_0x8934('0x5'));var db=require(_0x8934('0x6'))['db'];function skipInteractionsQuery(_0x5f34d7,_0x34f94c,_0x923aa3){var _0xefbef9=![];var _0x2bce03=utils[_0x8934('0x7')](_0x5f34d7);if(_0x34f94c[_0x8934('0x8')]==='agent'&&!_0x923aa3[_0x8934('0x9')]&&!_0x923aa3[_0x2bce03]){_0xefbef9=!![];}return _0xefbef9;}function getTagsQuery(){return squel[_0x8934('0xa')]()[_0x8934('0xb')]('id')['field']('name')['field']('color')[_0x8934('0xc')]('tools_tags');}function getUsersQuery(_0xe1adf4,_0x8a88c0){var _0x1a7e91=utils[_0x8934('0xd')](_0xe1adf4);var _0x28b451=_0x8934('0xe')+_0xe1adf4+_0x8934('0xf');var _0xbb421b=squel['select']()[_0x8934('0xb')](_0x8934('0x10'))[_0x8934('0xb')](_0x8934('0x11'))[_0x8934('0xb')](_0x8934('0x12')+_0x1a7e91)['from'](_0x28b451,'ui')[_0x8934('0x13')](_0x8934('0x14'),'u',_0x8934('0x15'));if(_0x8a88c0[_0x8934('0x16')]>0x0){_0xbb421b[_0x8934('0x17')](_0x8934('0x12')+_0x1a7e91+_0x8934('0x18'),_[_0x8934('0x19')](_0x8a88c0,'id'));}return _0xbb421b;}function getInteractionsQuery(_0x52de6a){var _0xb86bc9=utils[_0x8934('0x1a')](_0x52de6a);var _0x261c78=utils['getAccountFK'](_0x52de6a);var _0x47f25e=utils['getInteractionFK'](_0x52de6a);return squel[_0x8934('0xa')]()['from'](_0xb86bc9[_0x8934('0x1b')],'i')[_0x8934('0x13')](_0x8934('0x1c'),'c',_0x8934('0x1d'))[_0x8934('0x13')]('users','o',_0x8934('0x1e'))['left_join'](_0xb86bc9[_0x8934('0x1f')],'a',_0x8934('0x20')+_0x261c78)[_0x8934('0x13')](_0xb86bc9[_0x8934('0x21')],'me',_0x8934('0x22')+_0x47f25e+_0x8934('0x23'))[_0x8934('0x13')](_0xb86bc9['interactionsTags'],'it',_0x8934('0x24')+_0x47f25e+_0x8934('0x23'))[_0x8934('0x13')](_0x8934('0x25'),'t',_0x8934('0x26'));}function getSqlClauses(){var _0x5e593b={'body':squel[_0x8934('0x27')](),'contact':squel[_0x8934('0x27')](),'default':squel[_0x8934('0x27')](),'fields':squel['expr'](),'filter':squel[_0x8934('0x27')](),'read':squel['expr'](),'tags':{'clause':squel[_0x8934('0x27')](),'ids':[]},'user':squel[_0x8934('0x27')]()};return _0x5e593b;}function parseTagParameter(_0x110f7f){var _0x5ef0ed=squel[_0x8934('0x27')]();if(_0x110f7f){var _0x15910b=utils[_0x8934('0x28')](_0x110f7f);_0x15910b[_0x8934('0x29')](function(_0x4b5780){_0x5ef0ed['or'](_0x8934('0x2a'),'%,'+_0x4b5780+',%');});}return _0x5ef0ed;}function parseReadParameter(_0x249031){var _0x358445='';if(_0x249031){_0x358445=_0x8934('0x2b');if(_0x249031==='1'){_0x358445=_0x358445[_0x8934('0x2c')](_0x8934('0x2d'),'=');}else{_0x358445=_0x358445[_0x8934('0x2c')](_0x8934('0x2d'),'>');}}return _0x358445;}function parseSearchFilter(_0x9c6a71,_0x18938a){var _0x592b99=squel[_0x8934('0x27')]();if(_0x18938a){var _0x3e973e=_0x18938a['replace']('\x5c','\x5c\x5c')[_0x8934('0x2c')](/'/g,'\x27\x27');if(qs[_0x8934('0x2e')](_0x3e973e)){_0x592b99['or'](_0x8934('0x2f'),_0x3e973e+'%');if([_0x8934('0x30'),'whatsapp'][_0x8934('0x31')](_0x9c6a71)){_0x592b99['or'](_0x8934('0x32'),_0x3e973e+'%');}else if(_0x9c6a71===_0x8934('0x33')){_0x592b99['or'](_0x8934('0x34'),_0x3e973e+'%');}}else if(_0x9c6a71===_0x8934('0x35')&&qs['isEmail'](_0x3e973e)){_0x592b99['or'](_0x8934('0x36'),_0x3e973e+'%');}else{if(_0x9c6a71==='mail'){_0x592b99['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x8934('0x37')](_0x3e973e))['or'](_0x8934('0x38'),qs[_0x8934('0x37')](_0x3e973e));}else{if(_0x9c6a71!==_0x8934('0x33')){_0x592b99['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x8934('0x37')](_0x3e973e));}_0x592b99['or'](_0x8934('0x39'),_0x3e973e+'%');if(_0x9c6a71===_0x8934('0x3a')){_0x592b99['or'](_0x8934('0x3b'),_0x3e973e+'%');}}}}return _0x592b99;}function parseAdvancedSearchFilter(_0x7b2a1c,_0x4cd282){var _0x6764f8=getSqlClauses();var _0x1ea0cd=as['parseSearch'](_0x7b2a1c);var _0x5914b9=_0x1ea0cd[_0x8934('0x3c')];for(var _0x2a790f=0x0;_0x2a790f<_0x1ea0cd['conditions']['length'];_0x2a790f++){var _0x1a30c1=_0x1ea0cd[_0x8934('0x3d')][_0x2a790f];var _0x2f710a='i';var _0x207ad4=_[_0x8934('0x3e')](_0x4cd282,[_0x8934('0x3f'),_0x1a30c1[_0x8934('0xb')]]);if(_0x207ad4){var _0x1bc2d8=as[_0x8934('0x40')](_0x2f710a,_0x207ad4[_0x8934('0x41')],_0x1a30c1);_0x6764f8[_0x8934('0x42')][_0x5914b9](_0x1bc2d8['text'],_0x1bc2d8[_0x8934('0x43')][_0x8934('0x44')],_0x1bc2d8['value'][_0x8934('0x45')]);}else{switch(_0x1a30c1[_0x8934('0xb')]){case _0x8934('0x46'):var _0x40733b=parseReadParameter(_0x1a30c1[_0x8934('0x43')]);_0x6764f8['read']['and'](_0x40733b);break;case'Contact':if(_0x1a30c1[_0x8934('0x47')]===_0x8934('0x48')){if(_0x1a30c1[_0x8934('0x43')]['split']('\x20')[_0x8934('0x16')]>0x1){_0x6764f8['contact'][_0x5914b9]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x8934('0x37')](_0x1a30c1[_0x8934('0x43')]),null);}else{var _0x533eee='%'+_0x1a30c1['value']+'%';_0x6764f8[_0x8934('0x49')][_0x5914b9](_0x8934('0x4a'),_0x533eee,_0x533eee,_0x533eee);}}else{_0x207ad4=_[_0x8934('0x3e')](_0x4cd282,['name',_0x8934('0x4b')]);_0x1a30c1['field']=_0x8934('0x4b');_0x1bc2d8=as['buildExpression'](_0x2f710a,_0x207ad4[_0x8934('0x41')],_0x1a30c1);_0x6764f8[_0x8934('0x49')][_0x5914b9](_0x1bc2d8[_0x8934('0x4c')],_0x1bc2d8['value'][_0x8934('0x44')],_0x1bc2d8[_0x8934('0x43')][_0x8934('0x45')]);}break;case _0x8934('0x4d'):var _0x5e1b67=_0x1a30c1[_0x8934('0x43')][_0x8934('0x4e')](',')[_0x8934('0x19')](function(_0x3feecb){return Number(_0x3feecb);});var _0x6e63ff=parseTagParameter(_0x5e1b67);_0x6764f8[_0x8934('0x4f')][_0x8934('0x50')][_0x8934('0x51')](_0x6e63ff);_0x6764f8['tags']['ids']=_0x5e1b67;break;case'User':if(_0x1a30c1[_0x8934('0x47')]===_0x8934('0x48')){_0x6764f8['user'][_0x5914b9](_0x8934('0x52'),'%'+_0x1a30c1['value']+'%',null);}else{_0x207ad4=_[_0x8934('0x3e')](_0x4cd282,[_0x8934('0x3f'),'UserId']);_0x1a30c1[_0x8934('0xb')]=_0x8934('0x53');_0x1bc2d8=as[_0x8934('0x40')](_0x2f710a,_0x207ad4[_0x8934('0x41')],_0x1a30c1);_0x6764f8['user'][_0x5914b9](_0x1bc2d8[_0x8934('0x4c')],_0x1bc2d8[_0x8934('0x43')]['start'],_0x1bc2d8[_0x8934('0x43')][_0x8934('0x45')]);}break;case _0x8934('0x54'):case _0x8934('0x55'):_0x1bc2d8=as[_0x8934('0x40')]('me',null,_0x1a30c1);_0x6764f8[_0x8934('0x54')][_0x5914b9](_0x1bc2d8[_0x8934('0x4c')],_0x1bc2d8[_0x8934('0x43')][_0x8934('0x44')],_0x1bc2d8[_0x8934('0x43')][_0x8934('0x45')]);break;}}}return _0x6764f8;}function parseModelFields(_0xe212bc,_0x2c322d,_0x2febf5){var _0x11b06f=utils[_0x8934('0x7')](_0xe212bc);var _0x311d76=squel[_0x8934('0x27')]();var _0x53d058=_(_0x2c322d)[_0x8934('0x56')]()[_0x8934('0x19')](function(_0x5cc36c){return _['some'](_0x2febf5,['name',_0x5cc36c])?_0x5cc36c:undefined;})['compact']()[_0x8934('0x43')]();if(_0x53d058[_0x8934('0x16')]>0x0){_0x53d058[_0x8934('0x29')](function(_0x4d1433){if(_0x4d1433===_0x11b06f){_0x311d76['and']('i.'+_0x11b06f+_0x8934('0x18'),[]['concat'](_0x2c322d[_0x4d1433]));}else if(_0x4d1433==='createdAt'){var _0xce93cd=JSON[_0x8934('0x57')](_0x2c322d[_0x4d1433])[_0x8934('0x58')];var _0x334f27=JSON[_0x8934('0x57')](_0x2c322d[_0x4d1433])[_0x8934('0x59')];_0x311d76[_0x8934('0x51')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0xce93cd,_0x334f27);}else{if(_0x2c322d[_0x4d1433]===_0x8934('0x5a')){_0x311d76['and']('i.'+_0x4d1433+_0x8934('0x5b'));}else{_0x311d76[_0x8934('0x51')]('i.'+_0x4d1433+_0x8934('0x5c'),_0x2c322d[_0x4d1433]);}}});}return _0x311d76;}function parseQueryParameters(_0x3df31e,_0x40be23,_0x265b0a){var _0x1f6c5f=getSqlClauses();return Promise[_0x8934('0x5d')]()['then'](function(){return parseModelFields(_0x3df31e,_0x40be23,_0x265b0a);})[_0x8934('0x5e')](function(_0x345a95){_0x1f6c5f[_0x8934('0x5f')][_0x8934('0x51')](_0x345a95);return parseReadParameter(_0x40be23[_0x8934('0x60')]);})['then'](function(_0x44708a){_0x1f6c5f[_0x8934('0x60')][_0x8934('0x51')](_0x44708a);return parseTagParameter(_0x40be23['tag']);})[_0x8934('0x5e')](function(_0x2922a1){_0x1f6c5f[_0x8934('0x4f')]['clause']['and'](_0x2922a1);return parseSearchFilter(_0x3df31e,_0x40be23['filter']);})[_0x8934('0x5e')](function(_0x8e3e85){_0x1f6c5f[_0x8934('0x61')]=_0x8e3e85;return _0x1f6c5f;});}function checkAccountsRestrictions(_0x4ceb9b,_0x280809,_0x10ff96){var _0x5f447c=utils['getAccountFK'](_0x4ceb9b);var _0xf993d2=_0x8934('0x62')+_[_0x8934('0x63')](_0x4ceb9b)+(_0x4ceb9b===_0x8934('0x64')?'Websites':'Accounts');var _0x4ea19e=squel['expr']();return Promise[_0x8934('0x5d')]()[_0x8934('0x5e')](function(){if(_0x10ff96[_0x8934('0x9')]&&_0x280809[_0x8934('0x8')]===_0x8934('0x65')){return _0x280809[_0xf993d2]({'attributes':['id'],'raw':!![]});}})[_0x8934('0x5e')](function(_0x5a487e){if(_0x5a487e){if(_0x5a487e[_0x8934('0x16')]===0x0){_0x4ea19e[_0x8934('0x51')]('i.'+_0x5f447c+'\x20IS\x20NULL');}else{_0x4ea19e[_0x8934('0x51')]('i.'+_0x5f447c+'\x20IN\x20?',_[_0x8934('0x19')](_0x5a487e,'id'));}}else if(!_0x10ff96[_0x5f447c]){_0x4ea19e['and']('i.'+_0x5f447c+_0x8934('0x66'));}})[_0x8934('0x5e')](function(){return _0x4ea19e;});}function getClosedOrderClause(_0x59e63c,_0x31b672){var _0x458895='';var _0x3cae46=[_0x8934('0x67'),'i.secondDisposition','i.disposition'];if(_0x59e63c===_0x8934('0x35')){_0x3cae46[_0x8934('0x68')](_0x8934('0x69'));}if(_0x31b672[_0x8934('0x6a')]==='0'&&_0x59e63c===_0x8934('0x35')){_0x458895=_0x8934('0x69');}else{if(_0x31b672[_0x8934('0x6a')]==='1'){_0x3cae46[_0x8934('0x6b')]();}_0x458895=_0x8934('0x6c')+_0x3cae46[_0x8934('0x6d')](',\x20')+')';}return _0x458895;}function getFilteredInteractions(_0x27ca38,_0x2d1344,_0x5bcb09,_0x143d9e){var _0x5c7b96=utils['getInteractionFK'](_0x27ca38);var _0x1a52be=_[_0x8934('0x63')](_0x27ca38)+_0x8934('0x6e');var _0x408da5=[];var _0x2d074f=getTagsQuery();var _0x1b54ed={'type':db[_0x8934('0x6f')]['QueryTypes'][_0x8934('0x70')],'raw':!![]};var _0x3f51dc=[];var _0x4f1b67=[];return db[_0x8934('0x71')]['query'](_0x2d074f[_0x8934('0x72')](),_0x1b54ed)[_0x8934('0x5e')](function(_0x3f7bd3){_0x408da5=_['keyBy'](_0x3f7bd3,'id');_0x1b54ed=_[_0x8934('0x73')](_0x1b54ed,{'model':db[_0x1a52be],'mapToModel':!![],'nest':!![]});if(_0x5bcb09[_0x8934('0x5f')]){_0x143d9e['attributes'][_0x8934('0x29')](function(_0x558f93){_0x2d1344[_0x8934('0xb')]('i.'+_0x558f93);});}else{_0x2d1344['field'](_0x8934('0x74'),_0x8934('0x46'));_0x2d1344[_0x8934('0xb')]('a.key',_0x8934('0x75'));_0x2d1344[_0x8934('0xb')](_0x8934('0x76'),_0x8934('0x77'));if(_0x27ca38==='mail'){_0x2d1344[_0x8934('0xb')]('a.email',_0x8934('0x78'));_0x2d1344[_0x8934('0xb')](_0x8934('0x79'),_0x8934('0x7a'));_0x2d1344['field'](_0x8934('0x7b'));_0x2d1344[_0x8934('0xb')](_0x8934('0x7c'));_0x2d1344['field'](_0x8934('0x7d'));_0x2d1344[_0x8934('0xb')](_0x8934('0x7e'));_0x2d1344['field']('i.closedAt');_0x2d1344[_0x8934('0xb')](_0x8934('0x7f'));_0x2d1344[_0x8934('0xb')](_0x8934('0x80'));_0x2d1344[_0x8934('0xb')](_0x8934('0x81'));_0x2d1344[_0x8934('0xb')](_0x8934('0x82'));_0x2d1344[_0x8934('0xb')]('i.disposition');_0x2d1344[_0x8934('0xb')](_0x8934('0x83'));_0x2d1344[_0x8934('0xb')](_0x8934('0x67'));_0x2d1344[_0x8934('0xb')]('i.substatus');_0x2d1344[_0x8934('0xb')](_0x8934('0x84'));_0x2d1344['field'](_0x8934('0x85'));_0x2d1344['field']('i.MailAccountId');_0x2d1344['field'](_0x8934('0x86'));}else if(_0x27ca38===_0x8934('0x3a')){_0x2d1344[_0x8934('0xb')]('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',_0x8934('0x7a'));}else{_0x2d1344[_0x8934('0xb')]('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',_0x8934('0x7a'));}if(_0x27ca38!==_0x8934('0x35')){_0x2d1344[_0x8934('0xb')](_0x8934('0x87'));}_0x2d1344[_0x8934('0xb')](_0x8934('0x88'),_0x8934('0x89'));_0x2d1344[_0x8934('0xb')](_0x8934('0x8a'),_0x8934('0x8b'));_0x2d1344['field'](_0x8934('0x8c'),_0x8934('0x8d'));_0x2d1344[_0x8934('0xb')](_0x8934('0x8e'),_0x8934('0x8f'));_0x2d1344[_0x8934('0xb')](_0x8934('0x90'),'Contact.mobile');_0x2d1344[_0x8934('0xb')](_0x8934('0x91'),_0x8934('0x92'));_0x2d1344[_0x8934('0xb')](_0x8934('0x93'),_0x8934('0x94'));_0x2d1344[_0x8934('0xb')](_0x8934('0x95'),_0x8934('0x96'));_0x2d1344['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0x8934('0x97'));}if(_0x143d9e[_0x8934('0x98')]){_0x2d1344['limit'](_0x143d9e[_0x8934('0x98')]);}if(_0x143d9e[_0x8934('0x99')]){_0x2d1344[_0x8934('0x99')](_0x143d9e[_0x8934('0x99')]);}return db[_0x8934('0x71')][_0x8934('0x9a')](_0x2d1344[_0x8934('0x72')](),_0x1b54ed);})[_0x8934('0x5e')](function(_0x29f310){_0x3f51dc=_0x29f310;var _0x2d094e=getUsersQuery(_0x27ca38,_0x3f51dc);return db[_0x8934('0x71')]['query'](_0x2d094e[_0x8934('0x72')](),_0x1b54ed);})[_0x8934('0x5e')](function(_0x460cef){_0x4f1b67=_['groupBy'](_0x460cef,_0x5c7b96);if(_0x27ca38===_0x8934('0x35')){return db['Setting'][_0x8934('0x9b')]({'attributes':[_0x8934('0x9c')],'raw':!![]});}})[_0x8934('0x5e')](function(_0x39a833){var _0x4f9c07=_0x39a833?_0x39a833['enableEmailPreview']:undefined;var _0x39c523=_0x3f51dc['map'](function(_0x2142f9){return updateInteraction(_0x2142f9,_0x408da5,_0x4f1b67,_0x4f9c07);});return Promise[_0x8934('0x9d')](_0x39c523);});}function countFilteredInteractions(_0xe97eee,_0x166b23){var _0x52c2b9=_0xe97eee[_0x8934('0x9e')]();_0x52c2b9['field']('COUNT(*)');_0x52c2b9['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x8934('0x46'));var _0xa7288c=utils[_0x8934('0x28')](_0x166b23);if(!_[_0x8934('0x9f')](_0xa7288c)){_0x52c2b9[_0x8934('0x17')]('t.id\x20IN\x20?',_0xa7288c);}var _0x4913e0={'type':db[_0x8934('0x6f')][_0x8934('0xa0')][_0x8934('0x70')],'raw':!![]};return db[_0x8934('0x71')][_0x8934('0x9a')](_0x52c2b9[_0x8934('0x72')](),_0x4913e0);}module[_0x8934('0xa1')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0xb552=['../../mysqldb','getAccountFK','role','agent','search','select','field','name','color','from','tools_tags','getInteractionFK','_interactions','u.id','u.fullname','ui.','left_join','u.id\x20=\x20ui.UserId','where','interactions','cm_contacts','users','accounts','a.id\x20=\x20i.','messages','me.','\x20=\x20i.id','interactionsTags','it.','t.id\x20=\x20it.TagId','expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','unreadMessages\x20{OPERATOR}\x200','replace','{OPERATOR}','isNumeric','whatsapp','includes','i.phone\x20LIKE\x20?','i.fax\x20LIKE\x20?','mail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','openchannel','i.from\x20LIKE\x20?','parseSearch','conditions','length','find','buildExpression','type','default','text','value','end','read','and','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','contact','start','tags','clause','ids','User','UserId','user','body','keys','map','some','compact','\x20IN\x20?','concat','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','resolve','then','fields','filter','get','chat','Websites','Accounts','\x20IS\x20NULL','\x20IS\x20NOT\x20NULL','i.thirdDisposition','i.disposition','unshift','closed','i.substatus','shift','join','capitalize','Interaction','Sequelize','QueryTypes','SELECT','sequelize','query','toString','keyBy','attributes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','Account.email','contactName','i.id','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.secondDisposition','i.to','i.UserId','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','groupBy','enableEmailPreview','clone','t.id\x20IN\x20?','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','updateInteraction','./utils'];(function(_0x3a238a,_0x4ec2b2){var _0x1c4e6b=function(_0x47e9ae){while(--_0x47e9ae){_0x3a238a['push'](_0x3a238a['shift']());}};_0x1c4e6b(++_0x4ec2b2);}(_0xb552,0x1e3));var _0x2b55=function(_0x2bb2b5,_0x2c25e6){_0x2bb2b5=_0x2bb2b5-0x0;var _0xcb6f83=_0xb552[_0x2bb2b5];return _0xcb6f83;};'use strict';var _=require(_0x2b55('0x0'));var squel=require(_0x2b55('0x1'));var as=require(_0x2b55('0x2'));var qs=require(_0x2b55('0x3'));var updateInteraction=require('./update-interaction')[_0x2b55('0x4')];var utils=require(_0x2b55('0x5'));var db=require(_0x2b55('0x6'))['db'];function skipInteractionsQuery(_0x2b3a3d,_0x187316,_0x32123f){var _0x300d48=![];var _0x220612=utils[_0x2b55('0x7')](_0x2b3a3d);if(_0x187316[_0x2b55('0x8')]===_0x2b55('0x9')&&!_0x32123f[_0x2b55('0xa')]&&!_0x32123f[_0x220612]){_0x300d48=!![];}return _0x300d48;}function getTagsQuery(){return squel[_0x2b55('0xb')]()[_0x2b55('0xc')]('id')[_0x2b55('0xc')](_0x2b55('0xd'))[_0x2b55('0xc')](_0x2b55('0xe'))[_0x2b55('0xf')](_0x2b55('0x10'));}function getUsersQuery(_0x2baa3e,_0x7c4a36){var _0x4a08f1=utils[_0x2b55('0x11')](_0x2baa3e);var _0x181d7d='user_has_'+_0x2baa3e+_0x2b55('0x12');var _0xdfa538=squel[_0x2b55('0xb')]()[_0x2b55('0xc')](_0x2b55('0x13'))[_0x2b55('0xc')](_0x2b55('0x14'))[_0x2b55('0xc')](_0x2b55('0x15')+_0x4a08f1)[_0x2b55('0xf')](_0x181d7d,'ui')[_0x2b55('0x16')]('users','u',_0x2b55('0x17'));if(_0x7c4a36['length']>0x0){_0xdfa538[_0x2b55('0x18')](_0x2b55('0x15')+_0x4a08f1+'\x20IN\x20?',_['map'](_0x7c4a36,'id'));}return _0xdfa538;}function getInteractionsQuery(_0x1fbd19){var _0x1f48f3=utils['getInteractionsTables'](_0x1fbd19);var _0xa99eaa=utils[_0x2b55('0x7')](_0x1fbd19);var _0x30bb1e=utils[_0x2b55('0x11')](_0x1fbd19);return squel[_0x2b55('0xb')]()['from'](_0x1f48f3[_0x2b55('0x19')],'i')[_0x2b55('0x16')](_0x2b55('0x1a'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x2b55('0x16')](_0x2b55('0x1b'),'o','o.id\x20=\x20i.UserId')[_0x2b55('0x16')](_0x1f48f3[_0x2b55('0x1c')],'a',_0x2b55('0x1d')+_0xa99eaa)[_0x2b55('0x16')](_0x1f48f3[_0x2b55('0x1e')],'me',_0x2b55('0x1f')+_0x30bb1e+_0x2b55('0x20'))[_0x2b55('0x16')](_0x1f48f3[_0x2b55('0x21')],'it',_0x2b55('0x22')+_0x30bb1e+_0x2b55('0x20'))[_0x2b55('0x16')]('tools_tags','t',_0x2b55('0x23'));}function getSqlClauses(){var _0xbb1692={'body':squel[_0x2b55('0x24')](),'contact':squel['expr'](),'default':squel[_0x2b55('0x24')](),'fields':squel[_0x2b55('0x24')](),'filter':squel[_0x2b55('0x24')](),'read':squel['expr'](),'tags':{'clause':squel[_0x2b55('0x24')](),'ids':null},'user':squel[_0x2b55('0x24')]()};return _0xbb1692;}function parseTagParameter(_0x15707b){var _0x35fd88=squel['expr']();if(_0x15707b){var _0x22b2a5=utils[_0x2b55('0x25')](_0x15707b);_0x22b2a5[_0x2b55('0x26')](function(_0x48c297){_0x35fd88['or'](_0x2b55('0x27'),'%,'+_0x48c297+',%');});}return _0x35fd88;}function parseReadParameter(_0x844503){var _0x983f3='';if(_0x844503){_0x983f3=_0x2b55('0x28');if(_0x844503==='1'){_0x983f3=_0x983f3['replace']('{OPERATOR}','=');}else{_0x983f3=_0x983f3[_0x2b55('0x29')](_0x2b55('0x2a'),'>');}}return _0x983f3;}function parseSearchFilter(_0x45b09f,_0x36c2aa){var _0x38651e=squel['expr']();if(_0x36c2aa){var _0xcc2d3c=_0x36c2aa[_0x2b55('0x29')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x2b55('0x2b')](_0xcc2d3c)){_0x38651e['or']('i.id\x20LIKE\x20?',_0xcc2d3c+'%');if(['sms',_0x2b55('0x2c')][_0x2b55('0x2d')](_0x45b09f)){_0x38651e['or'](_0x2b55('0x2e'),_0xcc2d3c+'%');}else if(_0x45b09f==='fax'){_0x38651e['or'](_0x2b55('0x2f'),_0xcc2d3c+'%');}}else if(_0x45b09f===_0x2b55('0x30')&&qs['isEmail'](_0xcc2d3c)){_0x38651e['or'](_0x2b55('0x31'),_0xcc2d3c+'%');}else{if(_0x45b09f===_0x2b55('0x30')){_0x38651e['or'](_0x2b55('0x32'),qs[_0x2b55('0x33')](_0xcc2d3c))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x2b55('0x33')](_0xcc2d3c));}else{if(_0x45b09f!=='fax'){_0x38651e['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x2b55('0x33')](_0xcc2d3c));}_0x38651e['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0xcc2d3c+'%');if(_0x45b09f===_0x2b55('0x34')){_0x38651e['or'](_0x2b55('0x35'),_0xcc2d3c+'%');}}}}return _0x38651e;}function parseAdvancedSearchFilter(_0x43b702,_0x3c7b78){var _0x15ab50=getSqlClauses();var _0x2a2c10=as[_0x2b55('0x36')](_0x43b702);var _0x48d3ce=_0x2a2c10['sqlOperator'];for(var _0x598149=0x0;_0x598149<_0x2a2c10[_0x2b55('0x37')][_0x2b55('0x38')];_0x598149++){var _0x2ca5bd=_0x2a2c10[_0x2b55('0x37')][_0x598149];var _0x3fb92e='i';var _0x5f01a1=_[_0x2b55('0x39')](_0x3c7b78,[_0x2b55('0xd'),_0x2ca5bd[_0x2b55('0xc')]]);if(_0x5f01a1){var _0x1c903e=as[_0x2b55('0x3a')](_0x3fb92e,_0x5f01a1[_0x2b55('0x3b')],_0x2ca5bd);_0x15ab50[_0x2b55('0x3c')][_0x48d3ce](_0x1c903e[_0x2b55('0x3d')],_0x1c903e['value']['start'],_0x1c903e[_0x2b55('0x3e')][_0x2b55('0x3f')]);}else{switch(_0x2ca5bd['field']){case'unreadMessages':var _0x591488=parseReadParameter(_0x2ca5bd['value']);_0x15ab50[_0x2b55('0x40')][_0x2b55('0x41')](_0x591488);break;case _0x2b55('0x42'):if(_0x2ca5bd[_0x2b55('0x43')]===_0x2b55('0x44')){if(_0x2ca5bd['value'][_0x2b55('0x45')]('\x20')[_0x2b55('0x38')]>0x1){_0x15ab50['contact'][_0x48d3ce](_0x2b55('0x46'),qs[_0x2b55('0x33')](_0x2ca5bd[_0x2b55('0x3e')]),null);}else{var _0x54e87f='%'+_0x2ca5bd[_0x2b55('0x3e')]+'%';_0x15ab50['contact'][_0x48d3ce](_0x2b55('0x47'),_0x54e87f,_0x54e87f,_0x54e87f);}}else{_0x5f01a1=_[_0x2b55('0x39')](_0x3c7b78,[_0x2b55('0xd'),_0x2b55('0x48')]);_0x2ca5bd[_0x2b55('0xc')]=_0x2b55('0x48');_0x1c903e=as['buildExpression'](_0x3fb92e,_0x5f01a1[_0x2b55('0x3b')],_0x2ca5bd);_0x15ab50[_0x2b55('0x49')][_0x48d3ce](_0x1c903e[_0x2b55('0x3d')],_0x1c903e[_0x2b55('0x3e')][_0x2b55('0x4a')],_0x1c903e[_0x2b55('0x3e')][_0x2b55('0x3f')]);}break;case'Tag':var _0x577639=_0x2ca5bd[_0x2b55('0x3e')][_0x2b55('0x45')](',')['map'](function(_0x12209c){return Number(_0x12209c);});var _0xd1eb2c=parseTagParameter(_0x577639);_0x15ab50[_0x2b55('0x4b')][_0x2b55('0x4c')]['and'](_0xd1eb2c);_0x15ab50[_0x2b55('0x4b')][_0x2b55('0x4d')]=_0x577639;break;case _0x2b55('0x4e'):if(_0x2ca5bd['operator']===_0x2b55('0x44')){_0x15ab50['user'][_0x48d3ce]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x2ca5bd[_0x2b55('0x3e')]+'%',null);}else{_0x5f01a1=_[_0x2b55('0x39')](_0x3c7b78,[_0x2b55('0xd'),_0x2b55('0x4f')]);_0x2ca5bd['field']='UserId';_0x1c903e=as[_0x2b55('0x3a')](_0x3fb92e,_0x5f01a1['type'],_0x2ca5bd);_0x15ab50[_0x2b55('0x50')][_0x48d3ce](_0x1c903e[_0x2b55('0x3d')],_0x1c903e['value'][_0x2b55('0x4a')],_0x1c903e[_0x2b55('0x3e')][_0x2b55('0x3f')]);}break;case _0x2b55('0x51'):case'plainBody':_0x1c903e=as[_0x2b55('0x3a')]('me',null,_0x2ca5bd);_0x15ab50[_0x2b55('0x51')][_0x48d3ce](_0x1c903e[_0x2b55('0x3d')],_0x1c903e['value'][_0x2b55('0x4a')],_0x1c903e['value']['end']);break;}}}return _0x15ab50;}function parseModelFields(_0x1a65fa,_0x3ae0f4,_0x5a1e94){var _0x3cf7ea=utils[_0x2b55('0x7')](_0x1a65fa);var _0x1635cd=squel[_0x2b55('0x24')]();var _0x5d456c=_(_0x3ae0f4)[_0x2b55('0x52')]()[_0x2b55('0x53')](function(_0x203596){return _[_0x2b55('0x54')](_0x5a1e94,[_0x2b55('0xd'),_0x203596])?_0x203596:undefined;})[_0x2b55('0x55')]()['value']();if(_0x5d456c[_0x2b55('0x38')]>0x0){_0x5d456c[_0x2b55('0x26')](function(_0x24c4f3){if(_0x24c4f3===_0x3cf7ea){_0x1635cd[_0x2b55('0x41')]('i.'+_0x3cf7ea+_0x2b55('0x56'),[][_0x2b55('0x57')](_0x3ae0f4[_0x24c4f3]));}else if(_0x24c4f3==='createdAt'){var _0x1bf348=JSON[_0x2b55('0x58')](_0x3ae0f4[_0x24c4f3])[_0x2b55('0x59')];var _0x5eab4f=JSON[_0x2b55('0x58')](_0x3ae0f4[_0x24c4f3])[_0x2b55('0x5a')];_0x1635cd[_0x2b55('0x41')](_0x2b55('0x5b'),_0x1bf348,_0x5eab4f);}else{if(_0x3ae0f4[_0x24c4f3]===_0x2b55('0x5c')){_0x1635cd['and']('i.'+_0x24c4f3+'\x20IS\x20NULL');}else{_0x1635cd['and']('i.'+_0x24c4f3+'\x20=\x20?',_0x3ae0f4[_0x24c4f3]);}}});}return _0x1635cd;}function parseQueryParameters(_0x5a6119,_0x27293b,_0x40314e){var _0x1fc9bb=getSqlClauses();return Promise[_0x2b55('0x5d')]()[_0x2b55('0x5e')](function(){return parseModelFields(_0x5a6119,_0x27293b,_0x40314e);})[_0x2b55('0x5e')](function(_0x3ebbd7){_0x1fc9bb[_0x2b55('0x5f')]['and'](_0x3ebbd7);return parseReadParameter(_0x27293b[_0x2b55('0x40')]);})[_0x2b55('0x5e')](function(_0x423991){_0x1fc9bb[_0x2b55('0x40')][_0x2b55('0x41')](_0x423991);return parseTagParameter(_0x27293b['tag']);})[_0x2b55('0x5e')](function(_0x595a4f){_0x1fc9bb[_0x2b55('0x4b')][_0x2b55('0x4c')][_0x2b55('0x41')](_0x595a4f);return parseSearchFilter(_0x5a6119,_0x27293b['filter']);})[_0x2b55('0x5e')](function(_0x2c0f62){_0x1fc9bb[_0x2b55('0x60')]=_0x2c0f62;return _0x1fc9bb;});}function checkAccountsRestrictions(_0x3e6a3b,_0x46b92d,_0x4a0249){var _0x1f495d=utils['getAccountFK'](_0x3e6a3b);var _0x3564cf=_0x2b55('0x61')+_['capitalize'](_0x3e6a3b)+(_0x3e6a3b===_0x2b55('0x62')?_0x2b55('0x63'):_0x2b55('0x64'));var _0x142197=squel['expr']();return Promise[_0x2b55('0x5d')]()['then'](function(){if(_0x4a0249[_0x2b55('0xa')]&&_0x46b92d[_0x2b55('0x8')]==='agent'){return _0x46b92d[_0x3564cf]({'attributes':['id'],'raw':!![]});}})[_0x2b55('0x5e')](function(_0x1f9768){if(_0x1f9768){if(_0x1f9768['length']===0x0){_0x142197[_0x2b55('0x41')]('i.'+_0x1f495d+_0x2b55('0x65'));}else{_0x142197[_0x2b55('0x41')]('i.'+_0x1f495d+_0x2b55('0x56'),_[_0x2b55('0x53')](_0x1f9768,'id'));}}else if(!_0x4a0249[_0x1f495d]){_0x142197['and']('i.'+_0x1f495d+_0x2b55('0x66'));}})[_0x2b55('0x5e')](function(){return _0x142197;});}function getClosedOrderClause(_0x137490,_0x22b927){var _0x469fda='';var _0x4549fa=[_0x2b55('0x67'),'i.secondDisposition',_0x2b55('0x68')];if(_0x137490===_0x2b55('0x30')){_0x4549fa[_0x2b55('0x69')]('i.substatus');}if(_0x22b927[_0x2b55('0x6a')]==='0'&&_0x137490===_0x2b55('0x30')){_0x469fda=_0x2b55('0x6b');}else{if(_0x22b927[_0x2b55('0x6a')]==='1'){_0x4549fa[_0x2b55('0x6c')]();}_0x469fda='CONCAT_WS(\x27\x27,\x20'+_0x4549fa[_0x2b55('0x6d')](',\x20')+')';}return _0x469fda;}function getFilteredInteractions(_0x34b128,_0x1a8d4d,_0x31f0e8,_0xdbef54){var _0x373393=utils[_0x2b55('0x11')](_0x34b128);var _0x437ee5=_[_0x2b55('0x6e')](_0x34b128)+_0x2b55('0x6f');var _0x16940f=[];var _0x46b78a=getTagsQuery();var _0x2fcc53={'type':db[_0x2b55('0x70')][_0x2b55('0x71')][_0x2b55('0x72')],'raw':!![]};var _0x2dfa83=[];var _0x4c6984=[];return db[_0x2b55('0x73')][_0x2b55('0x74')](_0x46b78a[_0x2b55('0x75')](),_0x2fcc53)[_0x2b55('0x5e')](function(_0x234151){_0x16940f=_[_0x2b55('0x76')](_0x234151,'id');_0x2fcc53=_['merge'](_0x2fcc53,{'model':db[_0x437ee5],'mapToModel':!![],'nest':!![]});if(_0x31f0e8['fields']){_0xdbef54[_0x2b55('0x77')][_0x2b55('0x26')](function(_0x110f46){_0x1a8d4d[_0x2b55('0xc')]('i.'+_0x110f46);});}else{_0x1a8d4d['field'](_0x2b55('0x78'),_0x2b55('0x79'));_0x1a8d4d[_0x2b55('0xc')](_0x2b55('0x7a'),_0x2b55('0x7b'));_0x1a8d4d[_0x2b55('0xc')](_0x2b55('0x7c'),_0x2b55('0x7d'));if(_0x34b128==='mail'){_0x1a8d4d[_0x2b55('0xc')]('a.email',_0x2b55('0x7e'));_0x1a8d4d[_0x2b55('0xc')]('CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0x2b55('0x7f'));_0x1a8d4d[_0x2b55('0xc')](_0x2b55('0x80'));_0x1a8d4d[_0x2b55('0xc')](_0x2b55('0x81'));_0x1a8d4d[_0x2b55('0xc')](_0x2b55('0x82'));_0x1a8d4d[_0x2b55('0xc')](_0x2b55('0x83'));_0x1a8d4d['field'](_0x2b55('0x84'));_0x1a8d4d[_0x2b55('0xc')](_0x2b55('0x85'));_0x1a8d4d[_0x2b55('0xc')](_0x2b55('0x86'));_0x1a8d4d[_0x2b55('0xc')](_0x2b55('0x87'));_0x1a8d4d[_0x2b55('0xc')](_0x2b55('0x88'));_0x1a8d4d[_0x2b55('0xc')](_0x2b55('0x68'));_0x1a8d4d[_0x2b55('0xc')](_0x2b55('0x89'));_0x1a8d4d[_0x2b55('0xc')](_0x2b55('0x67'));_0x1a8d4d['field']('i.substatus');_0x1a8d4d[_0x2b55('0xc')](_0x2b55('0x8a'));_0x1a8d4d['field']('i.ContactId');_0x1a8d4d[_0x2b55('0xc')]('i.MailAccountId');_0x1a8d4d[_0x2b55('0xc')](_0x2b55('0x8b'));}else if(_0x34b128===_0x2b55('0x34')){_0x1a8d4d[_0x2b55('0xc')](_0x2b55('0x8c'),_0x2b55('0x7f'));}else{_0x1a8d4d['field'](_0x2b55('0x8d'),'contactName');}if(_0x34b128!==_0x2b55('0x30')){_0x1a8d4d['field']('i.*');}_0x1a8d4d['field']('c.firstName',_0x2b55('0x8e'));_0x1a8d4d[_0x2b55('0xc')](_0x2b55('0x8f'),_0x2b55('0x90'));_0x1a8d4d['field'](_0x2b55('0x91'),_0x2b55('0x92'));_0x1a8d4d['field']('c.phone',_0x2b55('0x93'));_0x1a8d4d[_0x2b55('0xc')]('c.mobile',_0x2b55('0x94'));_0x1a8d4d[_0x2b55('0xc')](_0x2b55('0x95'),_0x2b55('0x96'));_0x1a8d4d['field'](_0x2b55('0x97'),_0x2b55('0x98'));_0x1a8d4d['field']('o.internal',_0x2b55('0x99'));_0x1a8d4d[_0x2b55('0xc')](_0x2b55('0x9a'),_0x2b55('0x9b'));}if(_0xdbef54[_0x2b55('0x9c')]){_0x1a8d4d[_0x2b55('0x9c')](_0xdbef54['limit']);}if(_0xdbef54[_0x2b55('0x9d')]){_0x1a8d4d[_0x2b55('0x9d')](_0xdbef54['offset']);}return db[_0x2b55('0x73')][_0x2b55('0x74')](_0x1a8d4d[_0x2b55('0x75')](),_0x2fcc53);})[_0x2b55('0x5e')](function(_0x409582){_0x2dfa83=_0x409582;var _0x215d15=getUsersQuery(_0x34b128,_0x2dfa83);return db[_0x2b55('0x73')][_0x2b55('0x74')](_0x215d15['toString'](),_0x2fcc53);})[_0x2b55('0x5e')](function(_0xf965c0){_0x4c6984=_[_0x2b55('0x9e')](_0xf965c0,_0x373393);if(_0x34b128===_0x2b55('0x30')){return db['Setting']['findOne']({'attributes':[_0x2b55('0x9f')],'raw':!![]});}})[_0x2b55('0x5e')](function(_0x5a7b01){var _0x1334de=_0x5a7b01?_0x5a7b01['enableEmailPreview']:undefined;var _0x4986a3=_0x2dfa83[_0x2b55('0x53')](function(_0xffec58){return updateInteraction(_0xffec58,_0x16940f,_0x4c6984,_0x1334de);});return Promise['all'](_0x4986a3);});}function countFilteredInteractions(_0x19dbd2,_0x1196c6){var _0x5c58cd=_0x19dbd2[_0x2b55('0xa0')]();_0x5c58cd[_0x2b55('0xc')]('COUNT(*)');_0x5c58cd[_0x2b55('0xc')](_0x2b55('0x78'),_0x2b55('0x79'));var _0x12875f=utils[_0x2b55('0x25')](_0x1196c6);if(!_['isEmpty'](_0x12875f)){_0x5c58cd[_0x2b55('0x18')](_0x2b55('0xa1'),_0x12875f);}var _0x1c694f={'type':db[_0x2b55('0x70')]['QueryTypes'][_0x2b55('0x72')],'raw':!![]};return db['sequelize'][_0x2b55('0x74')](_0x5c58cd[_0x2b55('0x75')](),_0x1c694f);}module[_0x2b55('0xa2')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file diff --git a/server/components/interaction/update-interaction.js b/server/components/interaction/update-interaction.js index 05f8efe..bd769ab 100644 --- a/server/components/interaction/update-interaction.js +++ b/server/components/interaction/update-interaction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5ccf=['map','split','waiting','talking','answered','unmanaged','total','closed','disposition','abandoned','UserId','MailMessage','out','plainBody','-id','then','lastMsgText','trimStart','updateInteraction','Tags','TagIds','lodash','../../mysqldb'];(function(_0x4d0e60,_0x2f157c){var _0x53b0d3=function(_0x118cbf){while(--_0x118cbf){_0x4d0e60['push'](_0x4d0e60['shift']());}};_0x53b0d3(++_0x2f157c);}(_0x5ccf,0x157));var _0xf5cc=function(_0x3ee3c4,_0xf2124a){_0x3ee3c4=_0x3ee3c4-0x0;var _0x5729e6=_0x5ccf[_0x3ee3c4];return _0x5729e6;};'use strict';var _=require(_0xf5cc('0x0'));var db=require(_0xf5cc('0x1'))['db'];function getInteractionUsers(_0xd21797,_0x160bec){return new Promise(function(_0xd51192,_0x3cc793){try{var _0x2ca9c5=[];if(_0x160bec[_0xd21797]){_0x2ca9c5=_0x160bec[_0xd21797][_0xf5cc('0x2')](function(_0x1e5287){return{'id':_0x1e5287['id'],'fullname':_0x1e5287['fullname']};});}return _0xd51192(_0x2ca9c5);}catch(_0x2ddf8b){_0x3cc793(_0x2ddf8b);}});}function getInteractionTags(_0x59c23c,_0x170f5e){var _0x1e9c66=[];if(_0x59c23c){_0x59c23c[_0xf5cc('0x3')](',')['forEach'](function(_0x4128be){_0x1e9c66['push'](_0x170f5e[_0x4128be]);});}return _0x1e9c66;}function updateWaitingCounter(_0x2ff115){if(_0x2ff115[_0xf5cc('0x4')]){_0x2ff115[_0xf5cc('0x4')]-=0x1;}}function updateInteractionCounters(_0x5ccf54){_0x5ccf54[_0xf5cc('0x4')]=0x0;_0x5ccf54[_0xf5cc('0x5')]=0x0;_0x5ccf54[_0xf5cc('0x6')]=0x0;_0x5ccf54[_0xf5cc('0x7')]=0x0;_0x5ccf54['abandoned']=0x0;_0x5ccf54[_0xf5cc('0x8')]=0x0;if(_0x5ccf54[_0xf5cc('0x9')]){if(_0x5ccf54[_0xf5cc('0xa')]==='abandoned'){_0x5ccf54[_0xf5cc('0xb')]+=0x1;updateWaitingCounter(_0x5ccf54);}if(_0x5ccf54[_0xf5cc('0xc')]){_0x5ccf54[_0xf5cc('0x6')]+=0x1;if(_0x5ccf54[_0xf5cc('0x5')]){_0x5ccf54[_0xf5cc('0x5')]-=0x1;}}else{if(_0x5ccf54[_0xf5cc('0xa')]){_0x5ccf54[_0xf5cc('0x7')]+=0x1;updateWaitingCounter(_0x5ccf54);}}}else{if(!_0x5ccf54[_0xf5cc('0xc')]){_0x5ccf54['waiting']+=0x1;}if(_0x5ccf54[_0xf5cc('0xc')]){_0x5ccf54['talking']+=0x1;updateWaitingCounter(_0x5ccf54);}}_0x5ccf54[_0xf5cc('0x8')]+=0x1;return _0x5ccf54;}function getLastMessageText(_0x15cfe2){return db[_0xf5cc('0xd')]['findOne']({'where':{'$and':[{'MailInteractionId':_0x15cfe2['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0xf5cc('0xe')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0xf5cc('0xf')],'order':_0xf5cc('0x10'),'raw':!![]})[_0xf5cc('0x11')](function(_0x39820e){if(_0x39820e&&_0x39820e[_0xf5cc('0xf')]){_0x15cfe2[_0xf5cc('0x12')]=_[_0xf5cc('0x13')](_0x39820e[_0xf5cc('0xf')]);}return _0x15cfe2;})['catch'](function(_0x2ae606){throw _0x2ae606;});}exports[_0xf5cc('0x14')]=function(_0x4f60a4,_0x4377b5,_0x2fb583,_0x5a25ba){return new Promise(function(_0x326985,_0xab9d9a){return getInteractionUsers(_0x4f60a4['id'],_0x2fb583)[_0xf5cc('0x11')](function(_0x207b46){_0x4f60a4['Users']=_0x207b46;return getInteractionTags(_0x4f60a4['TagIds'],_0x4377b5);})[_0xf5cc('0x11')](function(_0x3a6d03){_0x4f60a4[_0xf5cc('0x15')]=_0x3a6d03;delete _0x4f60a4[_0xf5cc('0x16')];return updateInteractionCounters(_0x4f60a4);})[_0xf5cc('0x11')](function(_0x430df6){if(_0x5a25ba){return getLastMessageText(_0x430df6);}else{return _0x430df6;}})['then'](function(_0x54abd0){_0x326985(_0x54abd0);})['catch'](function(_0x7e1257){_0xab9d9a(_0x7e1257);});});}; \ No newline at end of file +var _0xf435=['Tags','TagIds','../../mysqldb','map','split','forEach','push','waiting','talking','unmanaged','total','closed','abandoned','UserId','answered','disposition','findOne','plainBody','-id','lastMsgText','trimStart','catch','updateInteraction','then','Users'];(function(_0x47d19f,_0x5e7a62){var _0x2c2689=function(_0x4cd25b){while(--_0x4cd25b){_0x47d19f['push'](_0x47d19f['shift']());}};_0x2c2689(++_0x5e7a62);}(_0xf435,0x12e));var _0x5f43=function(_0x3996a1,_0x43c1da){_0x3996a1=_0x3996a1-0x0;var _0x17edc1=_0xf435[_0x3996a1];return _0x17edc1;};'use strict';var _=require('lodash');var db=require(_0x5f43('0x0'))['db'];function getInteractionUsers(_0x2a8659,_0x12ba08){return new Promise(function(_0x3c1773,_0x6ed68){try{var _0x3125b7=[];if(_0x12ba08[_0x2a8659]){_0x3125b7=_0x12ba08[_0x2a8659][_0x5f43('0x1')](function(_0x28a37b){return{'id':_0x28a37b['id'],'fullname':_0x28a37b['fullname']};});}return _0x3c1773(_0x3125b7);}catch(_0x48178f){_0x6ed68(_0x48178f);}});}function getInteractionTags(_0x14a285,_0xfcd63d){var _0x152dad=[];if(_0x14a285){_0x14a285[_0x5f43('0x2')](',')[_0x5f43('0x3')](function(_0x47a264){_0x152dad[_0x5f43('0x4')](_0xfcd63d[_0x47a264]);});}return _0x152dad;}function updateWaitingCounter(_0x1e44c4){if(_0x1e44c4[_0x5f43('0x5')]){_0x1e44c4[_0x5f43('0x5')]-=0x1;}}function updateInteractionCounters(_0x3ce3bb){_0x3ce3bb[_0x5f43('0x5')]=0x0;_0x3ce3bb[_0x5f43('0x6')]=0x0;_0x3ce3bb['answered']=0x0;_0x3ce3bb[_0x5f43('0x7')]=0x0;_0x3ce3bb['abandoned']=0x0;_0x3ce3bb[_0x5f43('0x8')]=0x0;if(_0x3ce3bb[_0x5f43('0x9')]){if(_0x3ce3bb['disposition']===_0x5f43('0xa')){_0x3ce3bb['abandoned']+=0x1;updateWaitingCounter(_0x3ce3bb);}if(_0x3ce3bb[_0x5f43('0xb')]){_0x3ce3bb[_0x5f43('0xc')]+=0x1;if(_0x3ce3bb['talking']){_0x3ce3bb[_0x5f43('0x6')]-=0x1;}}else{if(_0x3ce3bb[_0x5f43('0xd')]){_0x3ce3bb[_0x5f43('0x7')]+=0x1;updateWaitingCounter(_0x3ce3bb);}}}else{if(!_0x3ce3bb[_0x5f43('0xb')]){_0x3ce3bb[_0x5f43('0x5')]+=0x1;}if(_0x3ce3bb[_0x5f43('0xb')]){_0x3ce3bb[_0x5f43('0x6')]+=0x1;updateWaitingCounter(_0x3ce3bb);}}_0x3ce3bb[_0x5f43('0x8')]+=0x1;return _0x3ce3bb;}function getLastMessageText(_0x231c9f){return db['MailMessage'][_0x5f43('0xe')]({'where':{'$and':[{'MailInteractionId':_0x231c9f['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':'out'},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x5f43('0xf')],'order':_0x5f43('0x10'),'raw':!![]})['then'](function(_0x1afe2f){if(_0x1afe2f&&_0x1afe2f[_0x5f43('0xf')]){_0x231c9f[_0x5f43('0x11')]=_[_0x5f43('0x12')](_0x1afe2f[_0x5f43('0xf')]);}return _0x231c9f;})[_0x5f43('0x13')](function(_0x541406){throw _0x541406;});}exports[_0x5f43('0x14')]=function(_0x1dbd9a,_0xaa96e7,_0x5a7047,_0xedfd8c){return new Promise(function(_0x9e2a86,_0x37c22b){return getInteractionUsers(_0x1dbd9a['id'],_0x5a7047)[_0x5f43('0x15')](function(_0x131401){_0x1dbd9a[_0x5f43('0x16')]=_0x131401;return getInteractionTags(_0x1dbd9a['TagIds'],_0xaa96e7);})['then'](function(_0x1901bc){_0x1dbd9a[_0x5f43('0x17')]=_0x1901bc;delete _0x1dbd9a[_0x5f43('0x18')];return updateInteractionCounters(_0x1dbd9a);})[_0x5f43('0x15')](function(_0x3d20a9){if(_0xedfd8c){return getLastMessageText(_0x3d20a9);}else{return _0x3d20a9;}})[_0x5f43('0x15')](function(_0x15b0cd){_0x9e2a86(_0x15b0cd);})['catch'](function(_0x2d0829){_0x37c22b(_0x2d0829);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index 3943ea9..b07b21b 100644 --- a/server/components/interaction/utils.js +++ b/server/components/interaction/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8c45=['stringify','null','Interaction','findOne','then','update','info','catch','lodash','../../mysqldb','../../config/logger','mail-interactions','fax-interactions','sms-interactions','chat-interactions','capitalize','chat','Website','Account','upperFirst','InteractionId','unknown','websites','_interactions','_interaction_has_tags','_messages','user_has_','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','role'];(function(_0x1d4313,_0x3929ab){var _0x234ad8=function(_0x1c5bc1){while(--_0x1c5bc1){_0x1d4313['push'](_0x1d4313['shift']());}};_0x234ad8(++_0x3929ab);}(_0x8c45,0x13e));var _0x58c4=function(_0x429e9b,_0x3bade6){_0x429e9b=_0x429e9b-0x0;var _0x968603=_0x8c45[_0x429e9b];return _0x968603;};'use strict';var _=require(_0x58c4('0x0'));var db=require(_0x58c4('0x1'))['db'];var loggers={'openchannel':require('../../config/logger')('openchannel-interactions'),'mail':require(_0x58c4('0x2'))(_0x58c4('0x3')),'fax':require(_0x58c4('0x2'))(_0x58c4('0x4')),'sms':require('../../config/logger')(_0x58c4('0x5')),'chat':require(_0x58c4('0x2'))(_0x58c4('0x6')),'whatsapp':require(_0x58c4('0x2'))('whatsapp-interactions')};function getAccountFK(_0xfdae22){return _[_0x58c4('0x7')](_0xfdae22)+(_0xfdae22===_0x58c4('0x8')?_0x58c4('0x9'):_0x58c4('0xa'))+'Id';}function getInteractionFK(_0x2ebc1e){return _[_0x58c4('0x7')](_0x2ebc1e)+'InteractionId';}function getInteractionId(_0x2e289f,_0x204a28,_0x5590d9){if(_0x2e289f&&_0x2e289f[_[_0x58c4('0xb')](_0x5590d9)+_0x58c4('0xc')]){return _0x2e289f[_[_0x58c4('0xb')](_0x5590d9)+_0x58c4('0xc')];}else if(_0x2e289f&&_0x2e289f['id']){return _0x2e289f['id'];}else if(_0x204a28&&_0x204a28['id']){return _0x204a28['id'];}else{return _0x58c4('0xd');}}function getInteractionsTables(_0x1d17e4){return{'accounts':_0x1d17e4+'_'+(_0x1d17e4===_0x58c4('0x8')?_0x58c4('0xe'):'accounts'),'interactions':_0x1d17e4+_0x58c4('0xf'),'interactionsTags':_0x1d17e4+_0x58c4('0x10'),'messages':_0x1d17e4+_0x58c4('0x11'),'userInteractions':_0x58c4('0x12')+_0x1d17e4+'_interactions'};}function getSelectedTags(_0x281d5a){var _0x3290ba=[];if(_0x281d5a){_0x3290ba=Array['isArray'](_0x281d5a)?_0x281d5a:[_0x281d5a];}return _0x3290ba;}function log(_0x40b703,_0x24b143,_0x9e5fae,_0x19d484,_0x32e479,_0x231636){loggers[_0x32e479[_0x58c4('0x13')]()][_0x40b703](_0x58c4('0x14'),_0x231636[_0x58c4('0x15')](),_0x24b143?_0x24b143['id']:null,_0x24b143?_0x24b143['name']:null,_0x24b143?_0x24b143[_0x58c4('0x16')]:null,getInteractionId(_0x9e5fae,_0x19d484,_0x32e479),_0x9e5fae?JSON[_0x58c4('0x17')](_0x9e5fae):_0x58c4('0x18'));}function updateUser(_0x40993d,_0x1e040d,_0x446204,_0x1b3adb,_0x2649c1){db[_[_0x58c4('0xb')](_0x1b3adb)+_0x58c4('0x19')][_0x58c4('0x1a')]({'where':{'id':getInteractionId(_0x1e040d,_0x446204,_0x1b3adb)}})[_0x58c4('0x1b')](function(_0x53f492){if(_0x53f492){return _0x53f492[_0x58c4('0x1c')]({'UserId':_0x40993d?_0x40993d['id']:null});}})[_0x58c4('0x1b')](function(_0x334a42){if(_0x334a42){log(_0x58c4('0x1d'),_0x40993d,_0x1e040d,_0x446204,_0x1b3adb,_0x2649c1);}})[_0x58c4('0x1e')](function(){log('error',_0x40993d,_0x1e040d,_0x446204,_0x1b3adb,_0x2649c1);});}module['exports']={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file +var _0xaf69=['upperFirst','unknown','websites','accounts','_interactions','_interaction_has_tags','user_has_','isArray','toLowerCase','toUpperCase','name','role','stringify','Interaction','findOne','then','update','info','catch','exports','lodash','../../mysqldb','openchannel-interactions','../../config/logger','mail-interactions','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','capitalize','chat','Website','Account','InteractionId'];(function(_0x45db95,_0x525781){var _0x3995c0=function(_0x2aafb0){while(--_0x2aafb0){_0x45db95['push'](_0x45db95['shift']());}};_0x3995c0(++_0x525781);}(_0xaf69,0x102));var _0x9af6=function(_0x486448,_0x367497){_0x486448=_0x486448-0x0;var _0x5f55e4=_0xaf69[_0x486448];return _0x5f55e4;};'use strict';var _=require(_0x9af6('0x0'));var db=require(_0x9af6('0x1'))['db'];var loggers={'openchannel':require('../../config/logger')(_0x9af6('0x2')),'mail':require(_0x9af6('0x3'))(_0x9af6('0x4')),'fax':require(_0x9af6('0x3'))(_0x9af6('0x5')),'sms':require(_0x9af6('0x3'))(_0x9af6('0x6')),'chat':require(_0x9af6('0x3'))(_0x9af6('0x7')),'whatsapp':require(_0x9af6('0x3'))(_0x9af6('0x8'))};function getAccountFK(_0x40bf3d){return _[_0x9af6('0x9')](_0x40bf3d)+(_0x40bf3d===_0x9af6('0xa')?_0x9af6('0xb'):_0x9af6('0xc'))+'Id';}function getInteractionFK(_0x9a4db8){return _[_0x9af6('0x9')](_0x9a4db8)+_0x9af6('0xd');}function getInteractionId(_0x96eea1,_0x2ca77e,_0x307310){if(_0x96eea1&&_0x96eea1[_[_0x9af6('0xe')](_0x307310)+_0x9af6('0xd')]){return _0x96eea1[_[_0x9af6('0xe')](_0x307310)+_0x9af6('0xd')];}else if(_0x96eea1&&_0x96eea1['id']){return _0x96eea1['id'];}else if(_0x2ca77e&&_0x2ca77e['id']){return _0x2ca77e['id'];}else{return _0x9af6('0xf');}}function getInteractionsTables(_0x934341){return{'accounts':_0x934341+'_'+(_0x934341===_0x9af6('0xa')?_0x9af6('0x10'):_0x9af6('0x11')),'interactions':_0x934341+_0x9af6('0x12'),'interactionsTags':_0x934341+_0x9af6('0x13'),'messages':_0x934341+'_messages','userInteractions':_0x9af6('0x14')+_0x934341+'_interactions'};}function getSelectedTags(_0x4a39cf){var _0x4bb984=[];if(_0x4a39cf){_0x4bb984=Array[_0x9af6('0x15')](_0x4a39cf)?_0x4a39cf:[_0x4a39cf];}return _0x4bb984;}function log(_0x3e7ffe,_0x1f21a9,_0x43d8c0,_0x2e4adb,_0x2896ff,_0x1748b4){loggers[_0x2896ff[_0x9af6('0x16')]()][_0x3e7ffe]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1748b4[_0x9af6('0x17')](),_0x1f21a9?_0x1f21a9['id']:null,_0x1f21a9?_0x1f21a9[_0x9af6('0x18')]:null,_0x1f21a9?_0x1f21a9[_0x9af6('0x19')]:null,getInteractionId(_0x43d8c0,_0x2e4adb,_0x2896ff),_0x43d8c0?JSON[_0x9af6('0x1a')](_0x43d8c0):'null');}function updateUser(_0x55c2eb,_0x2b577d,_0x5367fb,_0xbc5719,_0x46ee63){db[_['upperFirst'](_0xbc5719)+_0x9af6('0x1b')][_0x9af6('0x1c')]({'where':{'id':getInteractionId(_0x2b577d,_0x5367fb,_0xbc5719)}})[_0x9af6('0x1d')](function(_0x3c7818){if(_0x3c7818){return _0x3c7818[_0x9af6('0x1e')]({'UserId':_0x55c2eb?_0x55c2eb['id']:null});}})[_0x9af6('0x1d')](function(_0x25fa4d){if(_0x25fa4d){log(_0x9af6('0x1f'),_0x55c2eb,_0x2b577d,_0x5367fb,_0xbc5719,_0x46ee63);}})[_0x9af6('0x20')](function(){log('error',_0x55c2eb,_0x2b577d,_0x5367fb,_0xbc5719,_0x46ee63);});}module[_0x9af6('0x21')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index cf01121..166d6ae 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 _0x6dec=['update','utf8','final','parse','License','findOne','then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','admin','user','isUserLimit','crypto','util','composable-middleware','../../mysqldb','../../config/environment','license','data1','split','createDecipher','format'];(function(_0x36b47e,_0x5479b6){var _0xe9d183=function(_0x62215d){while(--_0x62215d){_0x36b47e['push'](_0x36b47e['shift']());}};_0xe9d183(++_0x5479b6);}(_0x6dec,0x1dc));var _0xc6de=function(_0x2e28f7,_0x10824f){_0x2e28f7=_0x2e28f7-0x0;var _0x5ded9c=_0x6dec[_0x2e28f7];return _0x5ded9c;};'use strict';var crypto=require(_0xc6de('0x0'));var util=require(_0xc6de('0x1'));var compose=require(_0xc6de('0x2'));var db=require(_0xc6de('0x3'))['db'];var config=require(_0xc6de('0x4'));function getValueFromLicense(_0x233624,_0x2600c0){if(_0x233624&&_0x2600c0){if(_0x2600c0['data1']&&_0x2600c0[_0xc6de('0x5')]){var _0x4606f5=_0x2600c0[_0xc6de('0x6')];var _0x586d41=_0x2600c0[_0xc6de('0x5')];var _0x42aa6e=_0x4606f5[_0xc6de('0x7')]('-')[0x4];var _0x17869f=_0x4606f5[_0xc6de('0x7')]('-')[0x0];var _0x10fb82=crypto[_0xc6de('0x8')]('aes-256-ctr',util[_0xc6de('0x9')]('%s:%s:%s',_0x42aa6e,_0x4606f5,_0x17869f));var _0x229c98=_0x10fb82[_0xc6de('0xa')](_0x586d41,'base64',_0xc6de('0xb'));_0x229c98+=_0x10fb82[_0xc6de('0xc')](_0xc6de('0xb'));var _0xefeb42=JSON[_0xc6de('0xd')](_0x229c98);return _0xefeb42['hasOwnProperty'](_0x233624)?_0xefeb42[_0x233624]:null;}}return null;}function isLimit(_0x4c089f,_0x5efa8f,_0x31cbb5,_0x18dc7e){var _0x40e7a2=_0x5efa8f;return compose()['use'](function(_0x5a7dd2,_0x184c7c,_0x364fa5){return db[_0xc6de('0xe')][_0xc6de('0xf')]({'where':{'id':0x1},'raw':!![]})[_0xc6de('0x10')](function(_0x399882){var _0x432a36=getValueFromLicense(_0x4c089f,_0x399882);return _0x432a36?_0x432a36:_0x40e7a2;})['then'](function(_0x1ce942){_0x40e7a2=_0x1ce942;return _0x31cbb5[_0xc6de('0x11')](_0x18dc7e);})['then'](function(_0x3be994){if(_0x3be994>=_0x40e7a2){return _0x184c7c[_0xc6de('0x12')](0x193)[_0xc6de('0x13')]({'message':util[_0xc6de('0x9')](_0xc6de('0x14'),_0x4c089f)});}_0x364fa5();})[_0xc6de('0x15')](function(_0x3e0cc7){_0x364fa5(_0x3e0cc7);});});}function isUserLimit(){return isLimit(_0xc6de('0x16'),0x1,db[_0xc6de('0x17')],{'where':{'$or':[{'role':_0xc6de('0x18')},{'role':_0xc6de('0x19')}]}});}exports[_0xc6de('0x1a')]=isUserLimit; \ No newline at end of file +var _0x861a=['split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','utf8','use','License','findOne','then','count','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','User','admin','user','isUserLimit','crypto','util','composable-middleware','../../mysqldb','license','data1'];(function(_0x1b66fb,_0x167749){var _0x486f88=function(_0x5b99db){while(--_0x5b99db){_0x1b66fb['push'](_0x1b66fb['shift']());}};_0x486f88(++_0x167749);}(_0x861a,0x162));var _0xa861=function(_0x24d9f0,_0x51611f){_0x24d9f0=_0x24d9f0-0x0;var _0x19597e=_0x861a[_0x24d9f0];return _0x19597e;};'use strict';var crypto=require(_0xa861('0x0'));var util=require(_0xa861('0x1'));var compose=require(_0xa861('0x2'));var db=require(_0xa861('0x3'))['db'];var config=require('../../config/environment');function getValueFromLicense(_0x14c3bb,_0x4164e9){if(_0x14c3bb&&_0x4164e9){if(_0x4164e9['data1']&&_0x4164e9[_0xa861('0x4')]){var _0x34d8b4=_0x4164e9[_0xa861('0x5')];var _0x5caaeb=_0x4164e9['license'];var _0x361375=_0x34d8b4[_0xa861('0x6')]('-')[0x4];var _0x455b54=_0x34d8b4[_0xa861('0x6')]('-')[0x0];var _0x4574cc=crypto[_0xa861('0x7')](_0xa861('0x8'),util[_0xa861('0x9')](_0xa861('0xa'),_0x361375,_0x34d8b4,_0x455b54));var _0x508ef3=_0x4574cc[_0xa861('0xb')](_0x5caaeb,'base64',_0xa861('0xc'));_0x508ef3+=_0x4574cc['final'](_0xa861('0xc'));var _0x32d206=JSON['parse'](_0x508ef3);return _0x32d206['hasOwnProperty'](_0x14c3bb)?_0x32d206[_0x14c3bb]:null;}}return null;}function isLimit(_0x3f19fb,_0x2a5334,_0x460293,_0x15cbec){var _0x38bee4=_0x2a5334;return compose()[_0xa861('0xd')](function(_0x33bb32,_0x435c6e,_0x1c4c68){return db[_0xa861('0xe')][_0xa861('0xf')]({'where':{'id':0x1},'raw':!![]})[_0xa861('0x10')](function(_0xc7c49e){var _0x12ce06=getValueFromLicense(_0x3f19fb,_0xc7c49e);return _0x12ce06?_0x12ce06:_0x38bee4;})[_0xa861('0x10')](function(_0x4dcc31){_0x38bee4=_0x4dcc31;return _0x460293[_0xa861('0x11')](_0x15cbec);})['then'](function(_0x198f01){if(_0x198f01>=_0x38bee4){return _0x435c6e['status'](0x193)['json']({'message':util['format'](_0xa861('0x12'),_0x3f19fb)});}_0x1c4c68();})[_0xa861('0x13')](function(_0x1116c3){_0x1c4c68(_0x1116c3);});});}function isUserLimit(){return isLimit('users',0x1,db[_0xa861('0x14')],{'where':{'$or':[{'role':_0xa861('0x15')},{'role':_0xa861('0x16')}]}});}exports[_0xa861('0x17')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 19270fc..bd62884 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 _0xa5a0=['forEach','shift','match','filter','map','conditions','buildExpression','operator','$eq','includes','$gt','$lte','value','add','days','YYYY-MM-DD','castTo','text','field','\x20AS\x20','$ne','$notIn','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','<\x20?','>\x20?','<=\x20?','$gte','start','$between','pop','utcOffset','format','lodash','parseSearch','sqlOperator','[$or]','replace','[$and]','split','length','slice'];(function(_0x5c70d0,_0xfeac42){var _0x484491=function(_0x533149){while(--_0x533149){_0x5c70d0['push'](_0x5c70d0['shift']());}};_0x484491(++_0xfeac42);}(_0xa5a0,0xec));var _0x0a5a=function(_0x420cbb,_0x3ffa2f){_0x420cbb=_0x420cbb-0x0;var _0x3b0ec2=_0xa5a0[_0x420cbb];return _0x3b0ec2;};'use strict';var _=require(_0x0a5a('0x0'));var moment=require('moment');exports[_0x0a5a('0x1')]=function(_0x513420){var _0x4b1cc4={'conditions':[]};_0x4b1cc4[_0x0a5a('0x2')]=_['startsWith'](_0x513420,_0x0a5a('0x3'))?'or':'and';var _0x50ba7b=_0x513420[_0x0a5a('0x4')](_0x0a5a('0x5'),'')[_0x0a5a('0x4')]('[$or]','')[_0x0a5a('0x6')]('||');for(var _0x4976ce=0x0;_0x4976ce<_0x50ba7b[_0x0a5a('0x7')];_0x4976ce++){var _0x42e419=_0x50ba7b[_0x4976ce][_0x0a5a('0x6')](':=');var _0x83d60d=_0x42e419[0x0];var _0x348fde=_0x42e419[_0x0a5a('0x8')](0x1);_0x348fde[_0x0a5a('0x9')](function(_0x46f2ac){var _0x2b9cfc=_0x46f2ac['split']('[')[_0x0a5a('0xa')]();var _0x1cbb6d=_0x46f2ac[_0x0a5a('0xb')](/\[(.*?)\]/g);_0x1cbb6d['forEach'](function(_0x13441d){var _0x1cf636=_0x13441d[_0x0a5a('0x6')]('[')[_0x0a5a('0xc')](function(_0x175a97){return _0x175a97['indexOf'](']')>-0x1;})[_0x0a5a('0xd')](function(_0xca31c0){return _0xca31c0[_0x0a5a('0x6')](']')[0x0];})[0x0];_0x4b1cc4[_0x0a5a('0xe')]['push']({'field':_0x83d60d,'operator':_0x2b9cfc,'value':_0x1cf636});});});}return _0x4b1cc4;};exports[_0x0a5a('0xf')]=function(_0x5c769e,_0x49e51a,_0x82f694){var _0x519613={};if(_0x49e51a==='DATE'){if(_0x82f694[_0x0a5a('0x10')]===_0x0a5a('0x11')){_0x82f694[_0x0a5a('0x10')]='$between';_0x82f694['value']+=','+_0x82f694['value'];}else if(_[_0x0a5a('0x12')]([_0x0a5a('0x13'),_0x0a5a('0x14')],_0x82f694[_0x0a5a('0x10')])){_0x82f694[_0x0a5a('0x15')]=moment(_0x82f694[_0x0a5a('0x15')])[_0x0a5a('0x16')](0x1,_0x0a5a('0x17'))['format'](_0x0a5a('0x18'));}}if(_0x82f694[_0x0a5a('0x19')]){_0x49e51a=_0x82f694[_0x0a5a('0x19')];_0x519613[_0x0a5a('0x1a')]='CAST('+_0x5c769e+'.'+_0x82f694[_0x0a5a('0x1b')]+_0x0a5a('0x1c')+_0x82f694[_0x0a5a('0x19')]+')\x20'+parseOperator(_0x82f694['operator']);}else{_0x519613[_0x0a5a('0x1a')]=_0x5c769e+'.'+_0x82f694['field']+'\x20'+parseOperator(_0x82f694['operator']);}if(_[_0x0a5a('0x12')]([_0x0a5a('0x1d'),_0x0a5a('0x1e')],_0x82f694[_0x0a5a('0x10')]))_0x519613['text']='('+_0x519613[_0x0a5a('0x1a')]+'\x20OR\x20'+_0x5c769e+'.'+_0x82f694[_0x0a5a('0x1b')]+_0x0a5a('0x1f');_0x519613[_0x0a5a('0x15')]=parseValue(_0x49e51a,_0x82f694[_0x0a5a('0x10')],_0x82f694[_0x0a5a('0x15')]);return _0x519613;};function parseOperator(_0x4a9b81){var _0x4850;switch(_0x4a9b81){case _0x0a5a('0x20'):_0x4850=_0x0a5a('0x21');break;case _0x0a5a('0x1e'):_0x4850=_0x0a5a('0x22');break;case _0x0a5a('0x11'):_0x4850='=\x20?';break;case'$ne':_0x4850=_0x0a5a('0x23');break;case _0x0a5a('0x24'):case _0x0a5a('0x25'):case _0x0a5a('0x26'):_0x4850=_0x0a5a('0x27');break;case'$lt':_0x4850=_0x0a5a('0x28');break;case _0x0a5a('0x13'):_0x4850=_0x0a5a('0x29');break;case _0x0a5a('0x14'):_0x4850=_0x0a5a('0x2a');break;case _0x0a5a('0x2b'):_0x4850='>=\x20?';break;case'$between':_0x4850='BETWEEN\x20?\x20AND\x20?';break;}return _0x4850;}function parseValue(_0xbb831c,_0x42847f,_0x5def89){var _0x23bd16={'start':undefined,'end':undefined};switch(_0x42847f){case _0x0a5a('0x20'):case'$notIn':_0x23bd16[_0x0a5a('0x2c')]=_0x5def89[_0x0a5a('0x6')](',');break;case _0x0a5a('0x24'):_0x23bd16['start']='%'+_0x5def89+'%';break;case _0x0a5a('0x25'):_0x23bd16['start']=_0x5def89+'%';break;case _0x0a5a('0x26'):_0x23bd16[_0x0a5a('0x2c')]='%'+_0x5def89;break;case _0x0a5a('0x2d'):var _0x420dde=_0x5def89[_0x0a5a('0x6')](',');var _0x5def89=_0x420dde[_0x0a5a('0xa')]();var _0x17a3a5=_0x420dde[_0x0a5a('0x2e')]();if(_0xbb831c==='DATE'){_0x5def89=moment(_0x5def89)[_0x0a5a('0x2f')](0x0,!![])[_0x0a5a('0x30')]();_0x17a3a5=moment(_0x17a3a5)[_0x0a5a('0x2f')](0x0,!![])[_0x0a5a('0x16')](0x17,'hours')[_0x0a5a('0x16')](0x3b,'minutes')[_0x0a5a('0x16')](0x3b,'seconds')[_0x0a5a('0x30')]();}_0x23bd16={'start':_0x5def89,'end':_0x17a3a5};break;default:_0x23bd16[_0x0a5a('0x2c')]=_0x5def89;break;}return _0x23bd16;} \ No newline at end of file +var _0x08e8=['value','includes','$gt','$lte','days','format','castTo','text','CAST(','field','\x20AS\x20','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','$eq','=\x20?','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','pop','utcOffset','add','hours','seconds','lodash','moment','parseSearch','sqlOperator','startsWith','[$or]','and','[$and]','replace','split','length','slice','match','forEach','filter','indexOf','conditions','push','buildExpression','DATE','operator','$between'];(function(_0x1b4e0c,_0x3d1236){var _0xffa878=function(_0x118b3e){while(--_0x118b3e){_0x1b4e0c['push'](_0x1b4e0c['shift']());}};_0xffa878(++_0x3d1236);}(_0x08e8,0xd6));var _0x808e=function(_0x406c44,_0x5a8353){_0x406c44=_0x406c44-0x0;var _0x2a74c6=_0x08e8[_0x406c44];return _0x2a74c6;};'use strict';var _=require(_0x808e('0x0'));var moment=require(_0x808e('0x1'));exports[_0x808e('0x2')]=function(_0x333863){var _0x1d9bc9={'conditions':[]};_0x1d9bc9[_0x808e('0x3')]=_[_0x808e('0x4')](_0x333863,_0x808e('0x5'))?'or':_0x808e('0x6');var _0x58bc98=_0x333863['replace'](_0x808e('0x7'),'')[_0x808e('0x8')](_0x808e('0x5'),'')[_0x808e('0x9')]('||');for(var _0x7973f6=0x0;_0x7973f6<_0x58bc98[_0x808e('0xa')];_0x7973f6++){var _0x5386c7=_0x58bc98[_0x7973f6][_0x808e('0x9')](':=');var _0x3f2c8d=_0x5386c7[0x0];var _0x3ae89d=_0x5386c7[_0x808e('0xb')](0x1);_0x3ae89d['forEach'](function(_0x247ee5){var _0x185683=_0x247ee5['split']('[')['shift']();var _0x2cccd7=_0x247ee5[_0x808e('0xc')](/\[(.*?)\]/g);_0x2cccd7[_0x808e('0xd')](function(_0x41d669){var _0x883e5c=_0x41d669[_0x808e('0x9')]('[')[_0x808e('0xe')](function(_0x472a9b){return _0x472a9b[_0x808e('0xf')](']')>-0x1;})['map'](function(_0x52bc63){return _0x52bc63[_0x808e('0x9')](']')[0x0];})[0x0];_0x1d9bc9[_0x808e('0x10')][_0x808e('0x11')]({'field':_0x3f2c8d,'operator':_0x185683,'value':_0x883e5c});});});}return _0x1d9bc9;};exports[_0x808e('0x12')]=function(_0x4686f1,_0x2c015a,_0x9fb74f){var _0x209e0f={};if(_0x2c015a===_0x808e('0x13')){if(_0x9fb74f[_0x808e('0x14')]==='$eq'){_0x9fb74f[_0x808e('0x14')]=_0x808e('0x15');_0x9fb74f[_0x808e('0x16')]+=','+_0x9fb74f['value'];}else if(_[_0x808e('0x17')]([_0x808e('0x18'),_0x808e('0x19')],_0x9fb74f[_0x808e('0x14')])){_0x9fb74f['value']=moment(_0x9fb74f[_0x808e('0x16')])['add'](0x1,_0x808e('0x1a'))[_0x808e('0x1b')]('YYYY-MM-DD');}}if(_0x9fb74f[_0x808e('0x1c')]){_0x2c015a=_0x9fb74f[_0x808e('0x1c')];_0x209e0f[_0x808e('0x1d')]=_0x808e('0x1e')+_0x4686f1+'.'+_0x9fb74f[_0x808e('0x1f')]+_0x808e('0x20')+_0x9fb74f['castTo']+')\x20'+parseOperator(_0x9fb74f[_0x808e('0x14')]);}else{_0x209e0f[_0x808e('0x1d')]=_0x4686f1+'.'+_0x9fb74f[_0x808e('0x1f')]+'\x20'+parseOperator(_0x9fb74f[_0x808e('0x14')]);}if(_['includes']([_0x808e('0x21'),_0x808e('0x22')],_0x9fb74f[_0x808e('0x14')]))_0x209e0f[_0x808e('0x1d')]='('+_0x209e0f[_0x808e('0x1d')]+_0x808e('0x23')+_0x4686f1+'.'+_0x9fb74f['field']+_0x808e('0x24');_0x209e0f[_0x808e('0x16')]=parseValue(_0x2c015a,_0x9fb74f['operator'],_0x9fb74f[_0x808e('0x16')]);return _0x209e0f;};function parseOperator(_0x4f59f6){var _0x5166fc;switch(_0x4f59f6){case _0x808e('0x25'):_0x5166fc=_0x808e('0x26');break;case _0x808e('0x22'):_0x5166fc=_0x808e('0x27');break;case _0x808e('0x28'):_0x5166fc=_0x808e('0x29');break;case _0x808e('0x21'):_0x5166fc=_0x808e('0x2a');break;case _0x808e('0x2b'):case _0x808e('0x2c'):case _0x808e('0x2d'):_0x5166fc=_0x808e('0x2e');break;case _0x808e('0x2f'):_0x5166fc=_0x808e('0x30');break;case _0x808e('0x18'):_0x5166fc='>\x20?';break;case _0x808e('0x19'):_0x5166fc=_0x808e('0x31');break;case _0x808e('0x32'):_0x5166fc=_0x808e('0x33');break;case'$between':_0x5166fc=_0x808e('0x34');break;}return _0x5166fc;}function parseValue(_0x5027c4,_0x424085,_0x1c9027){var _0x3a8680={'start':undefined,'end':undefined};switch(_0x424085){case'$in':case _0x808e('0x22'):_0x3a8680[_0x808e('0x35')]=_0x1c9027[_0x808e('0x9')](',');break;case _0x808e('0x2b'):_0x3a8680['start']='%'+_0x1c9027+'%';break;case _0x808e('0x2c'):_0x3a8680[_0x808e('0x35')]=_0x1c9027+'%';break;case'$endsWith':_0x3a8680[_0x808e('0x35')]='%'+_0x1c9027;break;case _0x808e('0x15'):var _0x202ad9=_0x1c9027[_0x808e('0x9')](',');var _0x1c9027=_0x202ad9['shift']();var _0x2f23d6=_0x202ad9[_0x808e('0x36')]();if(_0x5027c4===_0x808e('0x13')){_0x1c9027=moment(_0x1c9027)[_0x808e('0x37')](0x0,!![])[_0x808e('0x1b')]();_0x2f23d6=moment(_0x2f23d6)[_0x808e('0x37')](0x0,!![])[_0x808e('0x38')](0x17,_0x808e('0x39'))[_0x808e('0x38')](0x3b,'minutes')[_0x808e('0x38')](0x3b,_0x808e('0x3a'))[_0x808e('0x1b')]();}_0x3a8680={'start':_0x1c9027,'end':_0x2f23d6};break;default:_0x3a8680[_0x808e('0x35')]=_0x1c9027;break;}return _0x3a8680;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 6cd0279..93d60b6 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 _0xe107=['lower','options','lodash','moment','parse','includes','keys','fields','split','isEmpty','forOwn','type','DATE','isPlainObject','$gte','format','YYYY-MM-DD','utc','$lte','name','isArray','limit','sort','map','priority','cast','col','substr','DESC','unsigned','ASC','isObject','isString','length','unset','hasOwnProperty','omit','isNumeric','^[+]?[0-9]*$','isEmail','getFullTextValue','replace','match','push','join','query','$id','model','filters','intersection','attributes','offset','order','where','filter','object','columns','merge','VIRTUAL'];(function(_0x2677c5,_0x360952){var _0x462550=function(_0x398b2f){while(--_0x398b2f){_0x2677c5['push'](_0x2677c5['shift']());}};_0x462550(++_0x360952);}(_0xe107,0xb3));var _0x7e10=function(_0x52498e,_0x20b223){_0x52498e=_0x52498e-0x0;var _0x4737d1=_0xe107[_0x52498e];return _0x4737d1;};'use strict';var _=require(_0x7e10('0x0'));var sequelize=require('sequelize');var moment=require(_0x7e10('0x1'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x73dc05){var _0x2871b0=['ne'];try{var _0x570b2a=JSON[_0x7e10('0x2')](_0x73dc05);var _0x56db00=Object['keys'](_0x570b2a)[0x0];return _0x2871b0[_0x7e10('0x3')](_0x56db00);}catch(_0x46e807){return![];}}function getOperatorValue(_0x841f6d){var _0x5be19f=JSON['parse'](_0x841f6d);var _0x1dd3de=Object[_0x7e10('0x4')](_0x5be19f)[0x0];var _0x156c56=_0x5be19f[_0x1dd3de];return{['$'+_0x1dd3de]:_0x156c56};}exports[_0x7e10('0x5')]=function(_0x493958){var _0x48520c=null;if(_0x493958){_0x48520c=_0x493958[_0x7e10('0x6')](',');}return _0x48520c;};exports['filters']=function(_0x4e6825,_0x82e6f3){var _0x303f73={};if(!_[_0x7e10('0x7')](_0x4e6825)){_[_0x7e10('0x8')](_0x4e6825,function(_0x256cb1,_0x52ba74){try{if(_0x82e6f3){var _0x3576c2=_['find'](_0x82e6f3,{'name':_0x52ba74})||{};if(hasSequelizeOperator(_0x256cb1)){_0x303f73[_0x52ba74]=getOperatorValue(_0x256cb1);}else if(_0x3576c2[_0x7e10('0x9')]===_0x7e10('0xa')&&_[_0x7e10('0xb')](_0x256cb1)){var _0x5434dd=JSON[_0x7e10('0x2')](_0x256cb1);var _0x46def9={'$gte':moment(moment(_0x5434dd[_0x7e10('0xc')])[_0x7e10('0xd')](_0x7e10('0xe')))[_0x7e10('0xf')]()[_0x7e10('0xd')](),'$lte':moment(moment(_0x5434dd[_0x7e10('0x10')])['format'](_0x7e10('0xe')))[_0x7e10('0xf')]()['subtract'](0x1,'s')['format']()};_0x303f73[_0x52ba74]=_0x46def9;}else if(_0x3576c2[_0x7e10('0x11')]==='uniqueid'){_0x303f73[_0x52ba74]=_0x256cb1;}else{_0x303f73[_0x52ba74]=_[_0x7e10('0x12')](_0x256cb1)?_0x256cb1:JSON[_0x7e10('0x2')](_0x256cb1);}}else{_0x303f73[_0x52ba74]=_[_0x7e10('0x12')](_0x256cb1)?_0x256cb1:JSON[_0x7e10('0x2')](_0x256cb1);}}catch(_0x4fd639){_0x303f73[_0x52ba74]=_0x256cb1[_0x7e10('0x6')](',');}});}return _0x303f73;};exports[_0x7e10('0x13')]=function(_0x2bca7b){_0x2bca7b=parseInt(_0x2bca7b,0xa);if(!_0x2bca7b||_0x2bca7b<0x0){_0x2bca7b=LIMIT_VALUE;}return _0x2bca7b;};exports['offset']=function(_0x3b9ea2){_0x3b9ea2=parseInt(_0x3b9ea2,0xa);if(!_0x3b9ea2||_0x3b9ea2<0x0){_0x3b9ea2=0x0;}return _0x3b9ea2;};exports[_0x7e10('0x14')]=function(_0x157b22){var _0x585df5,_0xd742e4=null;if(_0x157b22){_0x585df5=_0x157b22['split'](',');_0xd742e4=_[_0x7e10('0x15')](_0x585df5,function(_0x2c6227){if(_0x2c6227['indexOf']('-')===0x0){return[_0x2c6227===_0x7e10('0x16')?sequelize[_0x7e10('0x17')](sequelize[_0x7e10('0x18')](_0x7e10('0x16')),'unsigned'):_0x2c6227[_0x7e10('0x19')](0x1),_0x7e10('0x1a')];}else{return[_0x2c6227===_0x7e10('0x16')?sequelize[_0x7e10('0x17')](sequelize[_0x7e10('0x18')](_0x7e10('0x16')),_0x7e10('0x1b')):_0x2c6227,_0x7e10('0x1c')];}});}return _0xd742e4;};exports['omit']=function(_0x4ad422,_0x11e9cc){if(_[_0x7e10('0x7')](_0x4ad422)){return _0x4ad422;}if(_[_0x7e10('0x12')](_0x4ad422)){for(var _0x13eeb3=0x0;_0x13eeb3<_0x4ad422['length'];_0x13eeb3+=0x1){_0x4ad422[_0x13eeb3]=this['omit'](_0x4ad422[_0x13eeb3],_0x11e9cc);}return _0x4ad422;}if(!_[_0x7e10('0x1d')](_0x4ad422)){return _0x4ad422;}if(_[_0x7e10('0x1e')](_0x11e9cc)){_0x11e9cc=[_0x11e9cc];}if(!_[_0x7e10('0x12')](_0x11e9cc)){return _0x4ad422;}for(var _0x13c7d4=0x0;_0x13c7d4<_0x11e9cc[_0x7e10('0x1f')];_0x13c7d4+=0x1){_[_0x7e10('0x20')](_0x4ad422,_0x11e9cc[_0x13c7d4]);}for(var _0x330103 in _0x4ad422){if(_0x4ad422[_0x7e10('0x21')](_0x330103)){_0x4ad422[_0x330103]=this[_0x7e10('0x22')](_0x4ad422[_0x330103],_0x11e9cc);}}return _0x4ad422;};exports[_0x7e10('0x23')]=function(_0x5691f8){return _0x5691f8['match'](RegExp(_0x7e10('0x24')))?!![]:![];};exports[_0x7e10('0x25')]=function(_0x560460){return _0x560460['match'](/^\S+@\S+$/)?!![]:![];};exports[_0x7e10('0x26')]=function(_0x271c49){var _0x537587=[];_0x271c49[_0x7e10('0x6')](/[ ,]+/)['forEach'](function(_0x18ff90){_0x18ff90=_0x18ff90[_0x7e10('0x27')](/([^:]")"+/g,'$1');_0x18ff90='+'+_0x18ff90+'*';var _0x1ca818=/[ `!@#$%^&*()_\-?~]/;if(_0x18ff90[_0x7e10('0x28')](_0x1ca818))_0x18ff90='\x22'+_0x18ff90+'\x22';_0x537587[_0x7e10('0x29')](_0x18ff90);});return _0x537587[_0x7e10('0x2a')]('\x20');};exports['getOptions']=function(_0x3567d2,_0x5dce0d,_0xc770e4){var _0x417cef={},_0x446b23={};if(_0x5dce0d[_0x7e10('0x2b')][_0x7e10('0x2c')]){_0x5dce0d[_0x7e10('0x2b')]['id']=_0x5dce0d[_0x7e10('0x2b')][_0x7e10('0x2c')];delete _0x5dce0d[_0x7e10('0x2b')]['$id'];}_0x417cef[_0x7e10('0x2d')]=_[_0x7e10('0x15')](_0x3567d2,_0x7e10('0x11'));_0x417cef[_0x7e10('0x2b')]=_[_0x7e10('0x4')](_0x5dce0d['query']);_0x417cef[_0x7e10('0x2e')]=_[_0x7e10('0x2f')](_0x417cef[_0x7e10('0x2d')],_0x417cef[_0x7e10('0x2b')]);_0x446b23['attributes']=_['intersection'](_0x417cef[_0x7e10('0x2d')],this[_0x7e10('0x5')](_0x5dce0d[_0x7e10('0x2b')][_0x7e10('0x5')]));_0x446b23['attributes']=_0x446b23[_0x7e10('0x30')][_0x7e10('0x1f')]?_0x446b23['attributes']:_0x417cef[_0x7e10('0x2d')];if(!_0x5dce0d[_0x7e10('0x2b')]['hasOwnProperty']('nolimit')){_0x446b23['limit']=this[_0x7e10('0x13')](_0x5dce0d[_0x7e10('0x2b')][_0x7e10('0x13')]);_0x446b23[_0x7e10('0x31')]=this[_0x7e10('0x31')](_0x5dce0d[_0x7e10('0x2b')][_0x7e10('0x31')]);}_0x446b23[_0x7e10('0x32')]=this['sort'](_0x5dce0d[_0x7e10('0x2b')][_0x7e10('0x14')]);_0x446b23[_0x7e10('0x33')]=this[_0x7e10('0x2e')](_['pick'](_0x5dce0d[_0x7e10('0x2b')],_0x417cef[_0x7e10('0x2e')]),_0x3567d2);if(_0x5dce0d[_0x7e10('0x2b')][_0x7e10('0x34')]){var _0x3ad2f0=_0x3567d2;var _0x4013f8=_0x5dce0d[_0x7e10('0x2b')]['filter'];if(typeof _0x4013f8===_0x7e10('0x35')){_0x3ad2f0=_[_0x7e10('0x34')](_0x3567d2,function(_0x57a832){return _[_0x7e10('0x3')](_0x4013f8[_0x7e10('0x36')],_0x57a832[_0x7e10('0x11')]);});_0x4013f8=_0x4013f8['value'];}_0x446b23[_0x7e10('0x33')]=_[_0x7e10('0x37')](_0x446b23[_0x7e10('0x33')],{'$or':_[_0x7e10('0x15')](_0x3ad2f0,function(_0x3c6a01){if(_0x3c6a01['type']!==_0x7e10('0x38')){if(_0xc770e4){return sequelize[_0x7e10('0x33')](sequelize['fn'](_0x7e10('0x39'),sequelize[_0x7e10('0x18')](_0x3c6a01[_0x7e10('0x11')])),{'$like':sequelize['fn']('lower','%'+_0x5dce0d[_0x7e10('0x2b')][_0x7e10('0x34')]+'%')});}else{var _0x5bf832={};_0x5bf832[_0x3c6a01['name']]={'$like':'%'+_0x5dce0d[_0x7e10('0x2b')][_0x7e10('0x34')]+'%'};return _0x5bf832;}}})});}_0x446b23=_['merge']({},_0x446b23,_0x5dce0d[_0x7e10('0x3a')]);return _0x446b23;}; \ No newline at end of file +var _0xe107=['lower','options','lodash','moment','parse','includes','keys','fields','split','isEmpty','forOwn','type','DATE','isPlainObject','$gte','format','YYYY-MM-DD','utc','$lte','name','isArray','limit','sort','map','priority','cast','col','substr','DESC','unsigned','ASC','isObject','isString','length','unset','hasOwnProperty','omit','isNumeric','^[+]?[0-9]*$','isEmail','getFullTextValue','replace','match','push','join','query','$id','model','filters','intersection','attributes','offset','order','where','filter','object','columns','merge','VIRTUAL'];(function(_0x9ff843,_0x2ce9c3){var _0x326356=function(_0x38eb62){while(--_0x38eb62){_0x9ff843['push'](_0x9ff843['shift']());}};_0x326356(++_0x2ce9c3);}(_0xe107,0xb3));var _0x7e10=function(_0x48911e,_0x2f5877){_0x48911e=_0x48911e-0x0;var _0x5161ba=_0xe107[_0x48911e];return _0x5161ba;};'use strict';var _=require(_0x7e10('0x0'));var sequelize=require('sequelize');var moment=require(_0x7e10('0x1'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x73dc05){var _0x2871b0=['ne'];try{var _0x570b2a=JSON[_0x7e10('0x2')](_0x73dc05);var _0x56db00=Object['keys'](_0x570b2a)[0x0];return _0x2871b0[_0x7e10('0x3')](_0x56db00);}catch(_0x46e807){return![];}}function getOperatorValue(_0x841f6d){var _0x5be19f=JSON['parse'](_0x841f6d);var _0x1dd3de=Object[_0x7e10('0x4')](_0x5be19f)[0x0];var _0x156c56=_0x5be19f[_0x1dd3de];return{['$'+_0x1dd3de]:_0x156c56};}exports[_0x7e10('0x5')]=function(_0x493958){var _0x48520c=null;if(_0x493958){_0x48520c=_0x493958[_0x7e10('0x6')](',');}return _0x48520c;};exports['filters']=function(_0x4e6825,_0x82e6f3){var _0x303f73={};if(!_[_0x7e10('0x7')](_0x4e6825)){_[_0x7e10('0x8')](_0x4e6825,function(_0x256cb1,_0x52ba74){try{if(_0x82e6f3){var _0x3576c2=_['find'](_0x82e6f3,{'name':_0x52ba74})||{};if(hasSequelizeOperator(_0x256cb1)){_0x303f73[_0x52ba74]=getOperatorValue(_0x256cb1);}else if(_0x3576c2[_0x7e10('0x9')]===_0x7e10('0xa')&&_[_0x7e10('0xb')](_0x256cb1)){var _0x5434dd=JSON[_0x7e10('0x2')](_0x256cb1);var _0x46def9={'$gte':moment(moment(_0x5434dd[_0x7e10('0xc')])[_0x7e10('0xd')](_0x7e10('0xe')))[_0x7e10('0xf')]()[_0x7e10('0xd')](),'$lte':moment(moment(_0x5434dd[_0x7e10('0x10')])['format'](_0x7e10('0xe')))[_0x7e10('0xf')]()['subtract'](0x1,'s')['format']()};_0x303f73[_0x52ba74]=_0x46def9;}else if(_0x3576c2[_0x7e10('0x11')]==='uniqueid'){_0x303f73[_0x52ba74]=_0x256cb1;}else{_0x303f73[_0x52ba74]=_[_0x7e10('0x12')](_0x256cb1)?_0x256cb1:JSON[_0x7e10('0x2')](_0x256cb1);}}else{_0x303f73[_0x52ba74]=_[_0x7e10('0x12')](_0x256cb1)?_0x256cb1:JSON[_0x7e10('0x2')](_0x256cb1);}}catch(_0x4fd639){_0x303f73[_0x52ba74]=_0x256cb1[_0x7e10('0x6')](',');}});}return _0x303f73;};exports[_0x7e10('0x13')]=function(_0x2bca7b){_0x2bca7b=parseInt(_0x2bca7b,0xa);if(!_0x2bca7b||_0x2bca7b<0x0){_0x2bca7b=LIMIT_VALUE;}return _0x2bca7b;};exports['offset']=function(_0x3b9ea2){_0x3b9ea2=parseInt(_0x3b9ea2,0xa);if(!_0x3b9ea2||_0x3b9ea2<0x0){_0x3b9ea2=0x0;}return _0x3b9ea2;};exports[_0x7e10('0x14')]=function(_0x157b22){var _0x585df5,_0xd742e4=null;if(_0x157b22){_0x585df5=_0x157b22['split'](',');_0xd742e4=_[_0x7e10('0x15')](_0x585df5,function(_0x2c6227){if(_0x2c6227['indexOf']('-')===0x0){return[_0x2c6227===_0x7e10('0x16')?sequelize[_0x7e10('0x17')](sequelize[_0x7e10('0x18')](_0x7e10('0x16')),'unsigned'):_0x2c6227[_0x7e10('0x19')](0x1),_0x7e10('0x1a')];}else{return[_0x2c6227===_0x7e10('0x16')?sequelize[_0x7e10('0x17')](sequelize[_0x7e10('0x18')](_0x7e10('0x16')),_0x7e10('0x1b')):_0x2c6227,_0x7e10('0x1c')];}});}return _0xd742e4;};exports['omit']=function(_0x4ad422,_0x11e9cc){if(_[_0x7e10('0x7')](_0x4ad422)){return _0x4ad422;}if(_[_0x7e10('0x12')](_0x4ad422)){for(var _0x13eeb3=0x0;_0x13eeb3<_0x4ad422['length'];_0x13eeb3+=0x1){_0x4ad422[_0x13eeb3]=this['omit'](_0x4ad422[_0x13eeb3],_0x11e9cc);}return _0x4ad422;}if(!_[_0x7e10('0x1d')](_0x4ad422)){return _0x4ad422;}if(_[_0x7e10('0x1e')](_0x11e9cc)){_0x11e9cc=[_0x11e9cc];}if(!_[_0x7e10('0x12')](_0x11e9cc)){return _0x4ad422;}for(var _0x13c7d4=0x0;_0x13c7d4<_0x11e9cc[_0x7e10('0x1f')];_0x13c7d4+=0x1){_[_0x7e10('0x20')](_0x4ad422,_0x11e9cc[_0x13c7d4]);}for(var _0x330103 in _0x4ad422){if(_0x4ad422[_0x7e10('0x21')](_0x330103)){_0x4ad422[_0x330103]=this[_0x7e10('0x22')](_0x4ad422[_0x330103],_0x11e9cc);}}return _0x4ad422;};exports[_0x7e10('0x23')]=function(_0x5691f8){return _0x5691f8['match'](RegExp(_0x7e10('0x24')))?!![]:![];};exports[_0x7e10('0x25')]=function(_0x560460){return _0x560460['match'](/^\S+@\S+$/)?!![]:![];};exports[_0x7e10('0x26')]=function(_0x271c49){var _0x537587=[];_0x271c49[_0x7e10('0x6')](/[ ,]+/)['forEach'](function(_0x18ff90){_0x18ff90=_0x18ff90[_0x7e10('0x27')](/([^:]")"+/g,'$1');_0x18ff90='+'+_0x18ff90+'*';var _0x1ca818=/[ `!@#$%^&*()_\-?~]/;if(_0x18ff90[_0x7e10('0x28')](_0x1ca818))_0x18ff90='\x22'+_0x18ff90+'\x22';_0x537587[_0x7e10('0x29')](_0x18ff90);});return _0x537587[_0x7e10('0x2a')]('\x20');};exports['getOptions']=function(_0x3567d2,_0x5dce0d,_0xc770e4){var _0x417cef={},_0x446b23={};if(_0x5dce0d[_0x7e10('0x2b')][_0x7e10('0x2c')]){_0x5dce0d[_0x7e10('0x2b')]['id']=_0x5dce0d[_0x7e10('0x2b')][_0x7e10('0x2c')];delete _0x5dce0d[_0x7e10('0x2b')]['$id'];}_0x417cef[_0x7e10('0x2d')]=_[_0x7e10('0x15')](_0x3567d2,_0x7e10('0x11'));_0x417cef[_0x7e10('0x2b')]=_[_0x7e10('0x4')](_0x5dce0d['query']);_0x417cef[_0x7e10('0x2e')]=_[_0x7e10('0x2f')](_0x417cef[_0x7e10('0x2d')],_0x417cef[_0x7e10('0x2b')]);_0x446b23['attributes']=_['intersection'](_0x417cef[_0x7e10('0x2d')],this[_0x7e10('0x5')](_0x5dce0d[_0x7e10('0x2b')][_0x7e10('0x5')]));_0x446b23['attributes']=_0x446b23[_0x7e10('0x30')][_0x7e10('0x1f')]?_0x446b23['attributes']:_0x417cef[_0x7e10('0x2d')];if(!_0x5dce0d[_0x7e10('0x2b')]['hasOwnProperty']('nolimit')){_0x446b23['limit']=this[_0x7e10('0x13')](_0x5dce0d[_0x7e10('0x2b')][_0x7e10('0x13')]);_0x446b23[_0x7e10('0x31')]=this[_0x7e10('0x31')](_0x5dce0d[_0x7e10('0x2b')][_0x7e10('0x31')]);}_0x446b23[_0x7e10('0x32')]=this['sort'](_0x5dce0d[_0x7e10('0x2b')][_0x7e10('0x14')]);_0x446b23[_0x7e10('0x33')]=this[_0x7e10('0x2e')](_['pick'](_0x5dce0d[_0x7e10('0x2b')],_0x417cef[_0x7e10('0x2e')]),_0x3567d2);if(_0x5dce0d[_0x7e10('0x2b')][_0x7e10('0x34')]){var _0x3ad2f0=_0x3567d2;var _0x4013f8=_0x5dce0d[_0x7e10('0x2b')]['filter'];if(typeof _0x4013f8===_0x7e10('0x35')){_0x3ad2f0=_[_0x7e10('0x34')](_0x3567d2,function(_0x57a832){return _[_0x7e10('0x3')](_0x4013f8[_0x7e10('0x36')],_0x57a832[_0x7e10('0x11')]);});_0x4013f8=_0x4013f8['value'];}_0x446b23[_0x7e10('0x33')]=_[_0x7e10('0x37')](_0x446b23[_0x7e10('0x33')],{'$or':_[_0x7e10('0x15')](_0x3ad2f0,function(_0x3c6a01){if(_0x3c6a01['type']!==_0x7e10('0x38')){if(_0xc770e4){return sequelize[_0x7e10('0x33')](sequelize['fn'](_0x7e10('0x39'),sequelize[_0x7e10('0x18')](_0x3c6a01[_0x7e10('0x11')])),{'$like':sequelize['fn']('lower','%'+_0x5dce0d[_0x7e10('0x2b')][_0x7e10('0x34')]+'%')});}else{var _0x5bf832={};_0x5bf832[_0x3c6a01['name']]={'$like':'%'+_0x5dce0d[_0x7e10('0x2b')][_0x7e10('0x34')]+'%'};return _0x5bf832;}}})});}_0x446b23=_['merge']({},_0x446b23,_0x5dce0d[_0x7e10('0x3a')]);return _0x446b23;}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index f96c4c8..a9867db 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['root','public','test','join','client','use','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','json','50mb','express','method-override','cookie-parser','errorhandler','passport','cors','./environment','default','get','env','production','set','appPath'];(function(_0x4a8418,_0x39078a){var _0x390174=function(_0x173ea6){while(--_0x173ea6){_0x4a8418['push'](_0x4a8418['shift']());}};_0x390174(++_0x39078a);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file +var _0x9957=['root','public','test','join','client','use','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','json','50mb','express','method-override','cookie-parser','errorhandler','passport','cors','./environment','default','get','env','production','set','appPath'];(function(_0x8a28e3,_0x24c7c5){var _0x1389f2=function(_0x3fd175){while(--_0x3fd175){_0x8a28e3['push'](_0x8a28e3['shift']());}};_0x1389f2(++_0x24c7c5);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 73c71ef..3066f88 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 _0xc149=['md5','update','digest','hex','licenseToken','win32','utf8','replace','macAddress','substring','crypto','child_process','../environment','networkInterfaces','orderBy','keys','length','filter','IPv4','internal','concat','head','mac','address','127.0.0.1','getFirstInterface','cpus','map','model','join','createHash'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xc149,0x15f));var _0x9c14=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xc149[_0x1ac595];return _0x455fff;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0x9c14('0x0'));var machine=require('bimedia-machine-uuid');var exec=require(_0x9c14('0x1'))['execSync'];var config=require(_0x9c14('0x2'));function getInterfaces(){var _0x361c7c=[];var _0x23ceee=os[_0x9c14('0x3')]();var _0x585eed=_[_0x9c14('0x4')](_[_0x9c14('0x5')](_0x23ceee));for(var _0x31b0b7=0x0;_0x31b0b7<_0x585eed[_0x9c14('0x6')];_0x31b0b7++){var _0x101bc0=_0x23ceee[_0x585eed[_0x31b0b7]][_0x9c14('0x7')](function(_0x6a032){return _0x6a032['family']===_0x9c14('0x8')&&_0x6a032[_0x9c14('0x9')]===![];});_0x361c7c=_0x361c7c[_0x9c14('0xa')](_0x101bc0);}return _0x361c7c;}function getFirstInterface(){var _0x15b50b=_[_0x9c14('0xb')](getInterfaces());return{'macAddress':_0x15b50b&&_0x15b50b[_0x9c14('0xc')]?_0x15b50b[_0x9c14('0xc')]:'00:00:00:00:00:00','ipAddress':_0x15b50b&&_0x15b50b[_0x9c14('0xd')]?_0x15b50b[_0x9c14('0xd')]:_0x9c14('0xe')};}exports[_0x9c14('0xf')]=getFirstInterface;function getCPUhash(){var _0x38fd54=_[_0x9c14('0x4')](os[_0x9c14('0x10')]()[_0x9c14('0x11')](function(_0x1f259e){return _0x1f259e[_0x9c14('0x12')];}))[_0x9c14('0x13')](':');return crypto[_0x9c14('0x14')](_0x9c14('0x15'))[_0x9c14('0x16')](_0x38fd54)[_0x9c14('0x17')](_0x9c14('0x18'));}exports['getUuid']=function(){var _0x4084e4=os['platform']();var _0x4644b0=/[0-9a-f-]{36}/;if(config[_0x9c14('0x19')]&&_0x4644b0['test'](config[_0x9c14('0x19')])){return config['licenseToken'];}else if(_0x4084e4===_0x9c14('0x1a')){return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0x9c14('0x1b')})[_0x9c14('0x1c')]('\x0d\x0a','');}else{var _0x2fe8d5=getFirstInterface();var _0x3adc88=getCPUhash();var _0x5a492a=_0x3adc88+'|'+os['hostname']()+'|'+_0x2fe8d5[_0x9c14('0x1d')]+'|'+_0x2fe8d5['ipAddress'];var _0x40f086=crypto['createHash']('md5')[_0x9c14('0x16')](_0x5a492a)[_0x9c14('0x17')](_0x9c14('0x18'));return _0x40f086[_0x9c14('0x1e')](0x0,0x8)+'-'+_0x40f086['substring'](0x8,0xc)+'-'+_0x40f086[_0x9c14('0x1e')](0xc,0x10)+'-'+_0x40f086[_0x9c14('0x1e')](0x10,0x14)+'-'+_0x40f086[_0x9c14('0x1e')](0x14);}}; \ No newline at end of file +var _0x95d7=['hex','substring','crypto','bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','orderBy','keys','filter','family','IPv4','concat','head','mac','00:00:00:00:00:00','address','getFirstInterface','cpus','map','join','createHash','update','getUuid','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','ipAddress','digest'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x95d7,0xb1));var _0x795d=function(_0x3aed67,_0x51b319){_0x3aed67=_0x3aed67-0x0;var _0x1a8ffb=_0x95d7[_0x3aed67];return _0x1a8ffb;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0x795d('0x0'));var machine=require(_0x795d('0x1'));var exec=require(_0x795d('0x2'))[_0x795d('0x3')];var config=require(_0x795d('0x4'));function getInterfaces(){var _0x557f25=[];var _0x3f3a9a=os[_0x795d('0x5')]();var _0x1fa7a7=_[_0x795d('0x6')](_[_0x795d('0x7')](_0x3f3a9a));for(var _0x1ae23b=0x0;_0x1ae23b<_0x1fa7a7['length'];_0x1ae23b++){var _0x4471fb=_0x3f3a9a[_0x1fa7a7[_0x1ae23b]][_0x795d('0x8')](function(_0x1579e9){return _0x1579e9[_0x795d('0x9')]===_0x795d('0xa')&&_0x1579e9['internal']===![];});_0x557f25=_0x557f25[_0x795d('0xb')](_0x4471fb);}return _0x557f25;}function getFirstInterface(){var _0x2f5c6f=_[_0x795d('0xc')](getInterfaces());return{'macAddress':_0x2f5c6f&&_0x2f5c6f[_0x795d('0xd')]?_0x2f5c6f[_0x795d('0xd')]:_0x795d('0xe'),'ipAddress':_0x2f5c6f&&_0x2f5c6f[_0x795d('0xf')]?_0x2f5c6f[_0x795d('0xf')]:'127.0.0.1'};}exports[_0x795d('0x10')]=getFirstInterface;function getCPUhash(){var _0xc640fe=_[_0x795d('0x6')](os[_0x795d('0x11')]()[_0x795d('0x12')](function(_0x4d2948){return _0x4d2948['model'];}))[_0x795d('0x13')](':');return crypto[_0x795d('0x14')]('md5')[_0x795d('0x15')](_0xc640fe)['digest']('hex');}exports[_0x795d('0x16')]=function(){var _0x2309dd=os['platform']();var _0x5830e5=/[0-9a-f-]{36}/;if(config[_0x795d('0x17')]&&_0x5830e5[_0x795d('0x18')](config[_0x795d('0x17')])){return config[_0x795d('0x17')];}else if(_0x2309dd===_0x795d('0x19')){return exec(_0x795d('0x1a'),{'encoding':_0x795d('0x1b')})[_0x795d('0x1c')]('\x0d\x0a','');}else{var _0x1c4f09=getFirstInterface();var _0x5ce212=getCPUhash();var _0x113956=_0x5ce212+'|'+os[_0x795d('0x1d')]()+'|'+_0x1c4f09[_0x795d('0x1e')]+'|'+_0x1c4f09[_0x795d('0x1f')];var _0x2da175=crypto[_0x795d('0x14')]('md5')[_0x795d('0x15')](_0x113956)[_0x795d('0x20')](_0x795d('0x21'));return _0x2da175[_0x795d('0x22')](0x0,0x8)+'-'+_0x2da175[_0x795d('0x22')](0x8,0xc)+'-'+_0x2da175[_0x795d('0x22')](0xc,0x10)+'-'+_0x2da175[_0x795d('0x22')](0x10,0x14)+'-'+_0x2da175['substring'](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 50e92eb..6f1184a 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 _0x4020=['SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','request-promise','bluebird','pkginfo','../../mysqldb','../../components/encryptor','./hardware','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','version','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','catch','get','data1','data2','then','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','YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','DEMO\x20START\x20AT\x20%s','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','error','message','getUuid','License','findOrCreate'];(function(_0x4b016c,_0x12f9c9){var _0x55fb8f=function(_0x5ddc05){while(--_0x5ddc05){_0x4b016c['push'](_0x4b016c['shift']());}};_0x55fb8f(++_0x12f9c9);}(_0x4020,0x128));var _0x0402=function(_0x542280,_0x1561aa){_0x542280=_0x542280-0x0;var _0x43a067=_0x4020[_0x542280];return _0x43a067;};'use strict';var util=require(_0x0402('0x0'));var moment=require('moment');var rp=require(_0x0402('0x1'));var BPromise=require(_0x0402('0x2'));var pkginfo=require(_0x0402('0x3'))(module,'version');var db=require(_0x0402('0x4'))['db'];var encryptor=require(_0x0402('0x5'));var hardware=require(_0x0402('0x6'));var logger=require('../logger')(_0x0402('0x7'));var HOST=_0x0402('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x487121){return new BPromise(function(_0x3d6a53,_0x463bcf){var _0x1ae375=util[_0x0402('0x9')](_0x0402('0xa'),HOST,_0x487121,module[_0x0402('0xb')][_0x0402('0xc')]);if(oldToken){_0x1ae375=util['format'](_0x0402('0xd'),HOST,_0x487121,module[_0x0402('0xb')][_0x0402('0xc')],oldToken);}var _0x2bdc4e={'uri':_0x1ae375,'method':_0x0402('0xe'),'timeout':0xea60,'json':!![]};return rp(_0x2bdc4e)['then'](function(_0x2b75e6){_0x3d6a53(_0x2b75e6);})[_0x0402('0xf')](function(_0x44b262){_0x463bcf(_0x44b262);});});}function manageLicense(_0x846c5b,_0x42ddc8){var _0xb9e5f2=_0x42ddc8[_0x0402('0x10')]({'plain':!![]});if(!isOldTokenSent&&_0xb9e5f2[_0x0402('0x11')]!==_0x846c5b&&!_0xb9e5f2[_0x0402('0x12')]){oldToken=_0xb9e5f2[_0x0402('0x11')];}httpRequest(_0x846c5b)[_0x0402('0x13')](function(_0xde36f3){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0xde36f3[_0x0402('0x14')]){isOldTokenSent=![];if(!_0xb9e5f2[_0x0402('0x7')]&&_0xb9e5f2['license']!=_0xde36f3[_0x0402('0x7')]||_0xb9e5f2[_0x0402('0x7')]&&_0xb9e5f2['data2']){logger[_0x0402('0x15')](_0x0402('0x16'));}if(_0xb9e5f2[_0x0402('0x7')]&&!_0xb9e5f2['data2']&&_0xb9e5f2[_0x0402('0x7')]!=_0xde36f3[_0x0402('0x7')]){logger[_0x0402('0x15')](_0x0402('0x17'));}if(_0xb9e5f2['license']&&!_0xb9e5f2[_0x0402('0x12')]&&_0xb9e5f2[_0x0402('0x7')]==_0xde36f3[_0x0402('0x7')]){return _0x42ddc8;}return _0x42ddc8[_0x0402('0x18')]({'data1':_0x846c5b,'data2':null,'license':_0xde36f3[_0x0402('0x7')]});}else{if(_0xde36f3[_0x0402('0x7')]||_0xb9e5f2[_0x0402('0x7')]){if(!_0xb9e5f2[_0x0402('0x12')]){if(_0xb9e5f2[_0x0402('0x11')]==_0x846c5b){GRAY_PERIOD_REASON=_0x0402('0x19');logger[_0x0402('0x15')](_0x0402('0x1a'));}else{GRAY_PERIOD_REASON=_0x0402('0x1b');logger[_0x0402('0x15')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0xb9e5f2[_0x0402('0x11')],_0x846c5b);}logger[_0x0402('0x15')](_0x0402('0x1c'),GRAY_PERIOD_REASON['toUpperCase'](),moment()[_0x0402('0x9')](_0x0402('0x1d')));return _0x42ddc8[_0x0402('0x18')]({'data2':encryptor[_0x0402('0x1e')](moment()[_0x0402('0x9')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()[_0x0402('0x1f')](encryptor[_0x0402('0x20')](_0xb9e5f2[_0x0402('0x12')]),'days')>DAYS){logger[_0x0402('0x15')](_0x0402('0x21'),moment()[_0x0402('0x9')](_0x0402('0x1d')));isOldTokenSent=![];return _0x42ddc8['update']({'data1':_0x846c5b,'data2':null,'license':null});}}}else{if(_0xb9e5f2[_0x0402('0x11')]!=_0x846c5b){logger['info'](_0x0402('0x22'),_0xb9e5f2[_0x0402('0x11')],_0x846c5b);return _0x42ddc8[_0x0402('0x18')]({'data1':_0x846c5b,'data2':null,'license':null});}}}return _0x42ddc8;})[_0x0402('0x13')](function(_0x2c4266){_0x42ddc8=_0x2c4266;})[_0x0402('0xf')](function(_0x373e0f){logger[_0x0402('0x23')](_0x373e0f[_0x0402('0x24')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0x0402('0x25')](),_0x42ddc8);},TIME);});}function defaultLicense(){var _0x2acb2d=hardware['getUuid']();if(_0x2acb2d){return db[_0x0402('0x26')][_0x0402('0x27')]({'where':{'id':0x1},'defaults':{'data1':_0x2acb2d}})['spread'](function(_0x56dbcb,_0x2af031){logger[_0x0402('0x15')](_0x0402('0x28'),_0x2acb2d);manageLicense(_0x2acb2d,_0x56dbcb);})[_0x0402('0xf')](function(_0x21771c){logger[_0x0402('0x23')](_0x21771c[_0x0402('0x24')]);});}}exports[_0x0402('0x29')]=defaultLicense; \ No newline at end of file +var _0xf17b=['./hardware','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','then','get','data1','active','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','DEMO\x20START\x20AT\x20%s','message','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','error','default','util','request-promise','pkginfo','version','../../mysqldb'];(function(_0x19dd8a,_0x449861){var _0x212ccc=function(_0x4f52b6){while(--_0x4f52b6){_0x19dd8a['push'](_0x19dd8a['shift']());}};_0x212ccc(++_0x449861);}(_0xf17b,0xb9));var _0xbf17=function(_0x2f607a,_0x59541e){_0x2f607a=_0x2f607a-0x0;var _0x286a07=_0xf17b[_0x2f607a];return _0x286a07;};'use strict';var util=require(_0xbf17('0x0'));var moment=require('moment');var rp=require(_0xbf17('0x1'));var BPromise=require('bluebird');var pkginfo=require(_0xbf17('0x2'))(module,_0xbf17('0x3'));var db=require(_0xbf17('0x4'))['db'];var encryptor=require('../../components/encryptor');var hardware=require(_0xbf17('0x5'));var logger=require('../logger')(_0xbf17('0x6'));var HOST=_0xbf17('0x7');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x136eca){return new BPromise(function(_0x39effb,_0x4f1103){var _0x5a2890=util[_0xbf17('0x8')](_0xbf17('0x9'),HOST,_0x136eca,module[_0xbf17('0xa')][_0xbf17('0x3')]);if(oldToken){_0x5a2890=util[_0xbf17('0x8')](_0xbf17('0xb'),HOST,_0x136eca,module['exports'][_0xbf17('0x3')],oldToken);}var _0x481a21={'uri':_0x5a2890,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x481a21)[_0xbf17('0xc')](function(_0x10e084){_0x39effb(_0x10e084);})['catch'](function(_0x37e261){_0x4f1103(_0x37e261);});});}function manageLicense(_0x2454ed,_0x257dd7){var _0x4878b1=_0x257dd7[_0xbf17('0xd')]({'plain':!![]});if(!isOldTokenSent&&_0x4878b1[_0xbf17('0xe')]!==_0x2454ed&&!_0x4878b1['data2']){oldToken=_0x4878b1[_0xbf17('0xe')];}httpRequest(_0x2454ed)[_0xbf17('0xc')](function(_0xd54436){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0xd54436[_0xbf17('0xf')]){isOldTokenSent=![];if(!_0x4878b1[_0xbf17('0x6')]&&_0x4878b1['license']!=_0xd54436[_0xbf17('0x6')]||_0x4878b1[_0xbf17('0x6')]&&_0x4878b1[_0xbf17('0x10')]){logger[_0xbf17('0x11')](_0xbf17('0x12'));}if(_0x4878b1[_0xbf17('0x6')]&&!_0x4878b1[_0xbf17('0x10')]&&_0x4878b1[_0xbf17('0x6')]!=_0xd54436['license']){logger[_0xbf17('0x11')](_0xbf17('0x13'));}if(_0x4878b1[_0xbf17('0x6')]&&!_0x4878b1['data2']&&_0x4878b1[_0xbf17('0x6')]==_0xd54436[_0xbf17('0x6')]){return _0x257dd7;}return _0x257dd7[_0xbf17('0x14')]({'data1':_0x2454ed,'data2':null,'license':_0xd54436[_0xbf17('0x6')]});}else{if(_0xd54436[_0xbf17('0x6')]||_0x4878b1['license']){if(!_0x4878b1[_0xbf17('0x10')]){if(_0x4878b1[_0xbf17('0xe')]==_0x2454ed){GRAY_PERIOD_REASON=_0xbf17('0x15');logger[_0xbf17('0x11')](_0xbf17('0x16'));}else{GRAY_PERIOD_REASON='Changed';logger['info'](_0xbf17('0x17'),_0x4878b1[_0xbf17('0xe')],_0x2454ed);}logger[_0xbf17('0x11')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0xbf17('0x18')](),moment()[_0xbf17('0x8')](_0xbf17('0x19')));return _0x257dd7[_0xbf17('0x14')]({'data2':encryptor[_0xbf17('0x1a')](moment()[_0xbf17('0x8')](_0xbf17('0x19')))});}else{if(moment()[_0xbf17('0x1b')](encryptor['decryptString'](_0x4878b1[_0xbf17('0x10')]),'days')>DAYS){logger[_0xbf17('0x11')](_0xbf17('0x1c'),moment()[_0xbf17('0x8')](_0xbf17('0x19')));isOldTokenSent=![];return _0x257dd7['update']({'data1':_0x2454ed,'data2':null,'license':null});}}}else{if(_0x4878b1['data1']!=_0x2454ed){logger['info'](_0xbf17('0x17'),_0x4878b1[_0xbf17('0xe')],_0x2454ed);return _0x257dd7['update']({'data1':_0x2454ed,'data2':null,'license':null});}}}return _0x257dd7;})['then'](function(_0x3d4685){_0x257dd7=_0x3d4685;})['catch'](function(_0xf6ae1f){logger['error'](_0xf6ae1f[_0xbf17('0x1d')]);})[_0xbf17('0x1e')](function(){setTimeout(function(){manageLicense(hardware[_0xbf17('0x1f')](),_0x257dd7);},TIME);});}function defaultLicense(){var _0x4a7af8=hardware[_0xbf17('0x1f')]();if(_0x4a7af8){return db[_0xbf17('0x20')][_0xbf17('0x21')]({'where':{'id':0x1},'defaults':{'data1':_0x4a7af8}})[_0xbf17('0x22')](function(_0x12d6cf,_0x325847){logger[_0xbf17('0x11')](_0xbf17('0x23'),_0x4a7af8);manageLicense(_0x4a7af8,_0x12d6cf);})['catch'](function(_0x5387a2){logger[_0xbf17('0x24')](_0x5387a2[_0xbf17('0x1d')]);});}}exports[_0xbf17('0x25')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index e427b43..49e0ffc 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 _0xb0eb=['parse','demo','machineUuid','gray','add','days','grayReason','changed','message','User','findAll','sequelize','COUNT','col','count','role','user','telephone','telephones','admin','pick','countBy','License\x20limit\x20reached\x20for\x20users','exports','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','Demo\x20license','2027-01-01T00:00:00.000Z','getUuid','License','find','then','catch','uuid','License\x20key\x20value\x20not\x20found','data1','data2','split','decryptString','format','%s:%s:%s'];(function(_0x3e316d,_0x504914){var _0x5f4967=function(_0xcd7a97){while(--_0xcd7a97){_0x3e316d['push'](_0x3e316d['shift']());}};_0x5f4967(++_0x504914);}(_0xb0eb,0x14c));var _0xbb0e=function(_0x203cbb,_0x32a51c){_0x203cbb=_0x203cbb-0x0;var _0x5c6155=_0xb0eb[_0x203cbb];return _0x5c6155;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0xbb0e('0x0'));var BPromise=require(_0xbb0e('0x1'));var hardware=require(_0xbb0e('0x2'));var encryptor=require(_0xbb0e('0x3'));var db=require(_0xbb0e('0x4'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xbb0e('0x5'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xbb0e('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware[_0xbb0e('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x946b36){return new BPromise(function(_0x418941,_0x397593){return db[_0xbb0e('0x8')][_0xbb0e('0x9')](_['defaults'](_0x946b36,{'raw':!![],'where':{'id':0x1}}))[_0xbb0e('0xa')](function(_0x3f224e){return checkLicense(_0x3f224e,null);})[_0xbb0e('0xa')](function(_0x27d618){_0x418941(_0x27d618);return;})[_0xbb0e('0xb')](function(_0x496adf){_0x397593(_0x496adf);});});}function checkLicense(_0x21c7b3,_0x2d610e){if(!_0x21c7b3){demoLicense[_0xbb0e('0xc')]=_0x21c7b3['data1'];return demoLicense;}try{var _0x5cb881=_0x2d610e||_0x21c7b3['license'];if(_['isEmpty'](_0x5cb881)){throw new Error(_0xbb0e('0xd'));}var _0x5cd76d=_0x21c7b3[_0xbb0e('0xe')];var _0x653687=_0x21c7b3[_0xbb0e('0xf')];var _0xf0d71c=_0x5cd76d[_0xbb0e('0x10')]('-')[0x4];var _0x312d17=_0x5cd76d[_0xbb0e('0x10')]('-')[0x0];var _0x30ae11=encryptor[_0xbb0e('0x11')](_0x5cb881,util[_0xbb0e('0x12')](_0xbb0e('0x13'),_0xf0d71c,_0x5cd76d,_0x312d17));var _0x5da39f=JSON[_0xbb0e('0x14')](_0x30ae11);_0x5da39f[_0xbb0e('0x15')]=![];_0x5da39f[_0xbb0e('0xc')]=_0x5cd76d;_0x5da39f[_0xbb0e('0x16')]=hardware[_0xbb0e('0x7')]();if(_0x653687){var _0x33dc2e=encryptor[_0xbb0e('0x11')](_0x653687);_0x5da39f[_0xbb0e('0x17')]=_0x33dc2e;_0x5da39f['deadline']=moment(_0x33dc2e)[_0xbb0e('0x18')](0x7,_0xbb0e('0x19'))[_0xbb0e('0x12')]();_0x5da39f[_0xbb0e('0x1a')]=_0x5da39f[_0xbb0e('0xc')]!=_0x5da39f[_0xbb0e('0x16')]?_0xbb0e('0x1b'):'disabled';}return _0x5da39f;}catch(_0x1b70ee){breakingLicense['uuid']=_0x21c7b3[_0xbb0e('0xe')];breakingLicense[_0xbb0e('0x1c')]=_0x1b70ee['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x3f30e6,_0x203376){getLicense()[_0xbb0e('0xa')](function(_0x4b4446){return db[_0xbb0e('0x1d')][_0xbb0e('0x1e')]({'attributes':['role',[db[_0xbb0e('0x1f')]['fn'](_0xbb0e('0x20'),db['sequelize'][_0xbb0e('0x21')]('role')),_0xbb0e('0x22')]],'group':_0xbb0e('0x23'),'where':{'role':{'$or':['admin',_0xbb0e('0x24'),_0xbb0e('0x25')]}},'raw':!![]})['then'](function(_0x4dbed2){var _0x2bf176={'user':_0x4b4446['users']||0x0,'telephone':_0x4b4446[_0xbb0e('0x26')]||0x0};_0x4dbed2['forEach'](function(_0x4f5ec7){var _0x17ca4e=_0x4f5ec7[_0xbb0e('0x23')]===_0xbb0e('0x27')?_0xbb0e('0x24'):_0x4f5ec7['role'];_0x2bf176[_0x17ca4e]-=_0x4f5ec7[_0xbb0e('0x22')];if(_0x2bf176[_0x17ca4e]<0x0)_0x2bf176[_0x17ca4e]=0x0;});_0x3f30e6(_0x2bf176);return;});})['catch'](function(_0x4edaae){_0x203376(_0x4edaae);});});}function checkUserLimits(_0x11ebde){return new BPromise(function(_0x49ba04,_0x3b6167){getLimits()['then'](function(_0xd93c7a){var _0x369c8a=_[_0xbb0e('0x28')](_[_0xbb0e('0x29')](_0x11ebde,_0xbb0e('0x23')),[_0xbb0e('0x27'),_0xbb0e('0x24'),'telephone']);var _0x1d64a9=(_0x369c8a[_0xbb0e('0x27')]||0x0)+(_0x369c8a['user']||0x0);var _0x55e86a=_0x369c8a['telephone']||0x0;if(_0x1d64a9>_0xd93c7a['user'])return _0x3b6167(_0xbb0e('0x2a'));if(_0x55e86a>_0xd93c7a[_0xbb0e('0x25')])return _0x3b6167('License\x20limit\x20reached\x20for\x20telephones');return _0x49ba04();})[_0xbb0e('0xb')](function(_0x412205){_0x3b6167(_0x412205);});});}module[_0xbb0e('0x2b')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x3d22=['changed','disabled','message','role','sequelize','COUNT','admin','user','telephone','users','telephones','forEach','catch','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','bluebird','../../components/encryptor','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','find','defaults','then','data1','license','isEmpty','data2','split','format','parse','uuid','machineUuid','decryptString','deadline','add','days'];(function(_0x4b03c9,_0x17ce03){var _0x161ba2=function(_0xb952db){while(--_0xb952db){_0x4b03c9['push'](_0x4b03c9['shift']());}};_0x161ba2(++_0x17ce03);}(_0x3d22,0x1ea));var _0x23d2=function(_0x4fddf1,_0x2caa1d){_0x4fddf1=_0x4fddf1-0x0;var _0x57800b=_0x3d22[_0x4fddf1];return _0x57800b;};'use strict';var util=require(_0x23d2('0x0'));var _=require(_0x23d2('0x1'));var moment=require(_0x23d2('0x2'));var BPromise=require(_0x23d2('0x3'));var hardware=require('./hardware');var encryptor=require(_0x23d2('0x4'));var db=require('../../mysqldb')['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x23d2('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x23d2('0x6'),'machineUuid':hardware[_0x23d2('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x23d2('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x23d2('0x8'),'machineUuid':hardware[_0x23d2('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x192035){return new BPromise(function(_0x5050ce,_0xb8a32d){return db[_0x23d2('0x9')][_0x23d2('0xa')](_[_0x23d2('0xb')](_0x192035,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x505b92){return checkLicense(_0x505b92,null);})[_0x23d2('0xc')](function(_0x55ae4a){_0x5050ce(_0x55ae4a);return;})['catch'](function(_0x4afd71){_0xb8a32d(_0x4afd71);});});}function checkLicense(_0x4867aa,_0xd336d6){if(!_0x4867aa){demoLicense['uuid']=_0x4867aa[_0x23d2('0xd')];return demoLicense;}try{var _0x25185f=_0xd336d6||_0x4867aa[_0x23d2('0xe')];if(_[_0x23d2('0xf')](_0x25185f)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x4a88b5=_0x4867aa[_0x23d2('0xd')];var _0x29e90e=_0x4867aa[_0x23d2('0x10')];var _0x3bd438=_0x4a88b5['split']('-')[0x4];var _0x254606=_0x4a88b5[_0x23d2('0x11')]('-')[0x0];var _0x392875=encryptor['decryptString'](_0x25185f,util[_0x23d2('0x12')]('%s:%s:%s',_0x3bd438,_0x4a88b5,_0x254606));var _0x5d3e44=JSON[_0x23d2('0x13')](_0x392875);_0x5d3e44['demo']=![];_0x5d3e44[_0x23d2('0x14')]=_0x4a88b5;_0x5d3e44[_0x23d2('0x15')]=hardware[_0x23d2('0x7')]();if(_0x29e90e){var _0x54036f=encryptor[_0x23d2('0x16')](_0x29e90e);_0x5d3e44['gray']=_0x54036f;_0x5d3e44[_0x23d2('0x17')]=moment(_0x54036f)[_0x23d2('0x18')](0x7,_0x23d2('0x19'))[_0x23d2('0x12')]();_0x5d3e44['grayReason']=_0x5d3e44[_0x23d2('0x14')]!=_0x5d3e44['machineUuid']?_0x23d2('0x1a'):_0x23d2('0x1b');}return _0x5d3e44;}catch(_0x47d150){breakingLicense[_0x23d2('0x14')]=_0x4867aa['data1'];breakingLicense['message']=_0x47d150[_0x23d2('0x1c')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x419610,_0xc98f80){getLicense()[_0x23d2('0xc')](function(_0x5ef2f2){return db['User']['findAll']({'attributes':[_0x23d2('0x1d'),[db[_0x23d2('0x1e')]['fn'](_0x23d2('0x1f'),db[_0x23d2('0x1e')]['col'](_0x23d2('0x1d'))),'count']],'group':'role','where':{'role':{'$or':[_0x23d2('0x20'),_0x23d2('0x21'),_0x23d2('0x22')]}},'raw':!![]})[_0x23d2('0xc')](function(_0x2afe8d){var _0x4da10c={'user':_0x5ef2f2[_0x23d2('0x23')]||0x0,'telephone':_0x5ef2f2[_0x23d2('0x24')]||0x0};_0x2afe8d[_0x23d2('0x25')](function(_0x2e8071){var _0xc789e3=_0x2e8071[_0x23d2('0x1d')]==='admin'?'user':_0x2e8071[_0x23d2('0x1d')];_0x4da10c[_0xc789e3]-=_0x2e8071['count'];if(_0x4da10c[_0xc789e3]<0x0)_0x4da10c[_0xc789e3]=0x0;});_0x419610(_0x4da10c);return;});})[_0x23d2('0x26')](function(_0xdaa517){_0xc98f80(_0xdaa517);});});}function checkUserLimits(_0x4c7455){return new BPromise(function(_0x3cac52,_0x5f3874){getLimits()['then'](function(_0x3db69f){var _0x1b53a6=_['pick'](_[_0x23d2('0x27')](_0x4c7455,_0x23d2('0x1d')),[_0x23d2('0x20'),_0x23d2('0x21'),'telephone']);var _0x155078=(_0x1b53a6[_0x23d2('0x20')]||0x0)+(_0x1b53a6[_0x23d2('0x21')]||0x0);var _0x28bb3e=_0x1b53a6[_0x23d2('0x22')]||0x0;if(_0x155078>_0x3db69f[_0x23d2('0x21')])return _0x5f3874(_0x23d2('0x28'));if(_0x28bb3e>_0x3db69f['telephone'])return _0x5f3874(_0x23d2('0x29'));return _0x3cac52();})[_0x23d2('0x26')](function(_0x2ee9a0){_0x5f3874(_0x2ee9a0);});});}module[_0x23d2('0x2a')]={'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 49d3457..b962886 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 _0x5464=['secret','exports','http://localhost:9000','myappanuglar-secret'];(function(_0x118653,_0x50ef26){var _0xc11fa6=function(_0x2ec581){while(--_0x2ec581){_0x118653['push'](_0x118653['shift']());}};_0xc11fa6(++_0x50ef26);}(_0x5464,0x15d));var _0x4546=function(_0x32ce24,_0x1b5718){_0x32ce24=_0x32ce24-0x0;var _0x58559b=_0x5464[_0x32ce24];return _0x58559b;};'use strict';module[_0x4546('0x0')]={'DOMAIN':_0x4546('0x1'),'SESSION_SECRET':_0x4546('0x2'),'GOOGLE_ID':'app-id','GOOGLE_SECRET':_0x4546('0x3'),'DEBUG':''}; \ No newline at end of file +var _0x84a0=['myappanuglar-secret','app-id','exports','http://localhost:9000'];(function(_0xd2a276,_0x275630){var _0x4a6a9b=function(_0x52f381){while(--_0x52f381){_0xd2a276['push'](_0xd2a276['shift']());}};_0x4a6a9b(++_0x275630);}(_0x84a0,0x66));var _0x084a=function(_0xcbace3,_0x4ae461){_0xcbace3=_0xcbace3-0x0;var _0x37f93e=_0x84a0[_0xcbace3];return _0x37f93e;};'use strict';module[_0x084a('0x0')]={'DOMAIN':_0x084a('0x1'),'SESSION_SECRET':_0x084a('0x2'),'GOOGLE_ID':_0x084a('0x3'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 65b5a3b..d88ebfa 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -'use strict';var fileLogger=require('../utils/loggers')['fileLogger'];module['exports']=fileLogger; \ No newline at end of file +var _0xa4d2=['../utils/loggers','fileLogger','exports'];(function(_0x1d1414,_0x45bcd9){var _0x1291bd=function(_0x1317fb){while(--_0x1317fb){_0x1d1414['push'](_0x1d1414['shift']());}};_0x1291bd(++_0x45bcd9);}(_0xa4d2,0x123));var _0x2a4d=function(_0x42b5d0,_0x28ec21){_0x42b5d0=_0x42b5d0-0x0;var _0x367480=_0xa4d2[_0x42b5d0];return _0x367480;};'use strict';var fileLogger=require(_0x2a4d('0x0'))[_0x2a4d('0x1')];module[_0x2a4d('0x2')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index f928227..14e5cb5 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 _0x736d=['exports','path','join','../../services/express/index.js','../../services/ami/index.js','../../services/agi/index.js','email','../../services/email/index.js','routing','../../services/routing/index.js','xdr'];(function(_0x206096,_0x1c6cfd){var _0x3f3b50=function(_0xfc6422){while(--_0xfc6422){_0x206096['push'](_0x206096['shift']());}};_0x3f3b50(++_0x1c6cfd);}(_0x736d,0x85));var _0xd736=function(_0x28a433,_0x53d91b){_0x28a433=_0x28a433-0x0;var _0x2d7b59=_0x736d[_0x28a433];return _0x2d7b59;};'use strict';var path=require(_0xd736('0x0'));var os=require('os');var config={'apps':[{'name':'express','script':path[_0xd736('0x1')](__dirname,_0xd736('0x2'))},{'name':'ami','script':path['join'](__dirname,_0xd736('0x3'))},{'name':'agi','script':path['join'](__dirname,_0xd736('0x4'))},{'name':_0xd736('0x5'),'script':path['join'](__dirname,_0xd736('0x6'))},{'name':_0xd736('0x7'),'script':path[_0xd736('0x1')](__dirname,_0xd736('0x8'))},{'name':_0xd736('0x9'),'script':path[_0xd736('0x1')](__dirname,'../../services/xdr/index.js')}]};module[_0xd736('0xa')]=config; \ No newline at end of file +var _0xfadf=['exports','path','express','join','../../services/express/index.js','ami','agi','../../services/email/index.js','xdr'];(function(_0x223c0d,_0x3ec04d){var _0x207827=function(_0x39d240){while(--_0x39d240){_0x223c0d['push'](_0x223c0d['shift']());}};_0x207827(++_0x3ec04d);}(_0xfadf,0x157));var _0xffad=function(_0x1759eb,_0xcae8b1){_0x1759eb=_0x1759eb-0x0;var _0x5a4f64=_0xfadf[_0x1759eb];return _0x5a4f64;};'use strict';var path=require(_0xffad('0x0'));var os=require('os');var config={'apps':[{'name':_0xffad('0x1'),'script':path[_0xffad('0x2')](__dirname,_0xffad('0x3'))},{'name':_0xffad('0x4'),'script':path[_0xffad('0x2')](__dirname,'../../services/ami/index.js')},{'name':_0xffad('0x5'),'script':path['join'](__dirname,'../../services/agi/index.js')},{'name':'email','script':path[_0xffad('0x2')](__dirname,_0xffad('0x6'))},{'name':'routing','script':path['join'](__dirname,'../../services/routing/index.js')},{'name':_0xffad('0x7'),'script':path[_0xffad('0x2')](__dirname,'../../services/xdr/index.js')}]};module[_0xffad('0x8')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 54cae53..5f89cf4 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 _0xf68d=['start','disconnect','stop','restart','list','describe','delete','dump','saved','pm2','./config','connect','then'];(function(_0x1e202d,_0x417452){var _0x26d250=function(_0x4ea79d){while(--_0x4ea79d){_0x1e202d['push'](_0x1e202d['shift']());}};_0x26d250(++_0x417452);}(_0xf68d,0x7e));var _0xdf68=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0xf68d[_0x209941];return _0x1e8729;};'use strict';var pm2=require(_0xdf68('0x0'));var BPromise=require('bluebird');var config=require(_0xdf68('0x1'));function connect(){return new BPromise(function(_0x50afaf,_0x16f6bd){return pm2[_0xdf68('0x2')](function(_0x55baf5){if(_0x55baf5){return _0x16f6bd(_0x55baf5);}return _0x50afaf('connected');});});};exports['start']=function(_0x5bb7fd){return connect()[_0xdf68('0x3')](function(){return new BPromise(function(_0x27db43,_0x2664ff){return pm2[_0xdf68('0x4')](_0x5bb7fd,function(_0x36f344,_0x450ea8){if(_0x36f344){return _0x2664ff(_0x36f344);}pm2[_0xdf68('0x5')]();return _0x27db43(_0x450ea8);});});});};exports[_0xdf68('0x6')]=function(_0x3751db){return connect()[_0xdf68('0x3')](function(){return new BPromise(function(_0x452fa2,_0xf2f66c){return pm2[_0xdf68('0x6')](_0x3751db,function(_0x100e5e,_0x2e5e25){if(_0x100e5e){return _0xf2f66c(_0x100e5e);}pm2['disconnect']();return _0x452fa2(_0x2e5e25);});});});};exports['restart']=function(_0x5ecdc2){return connect()[_0xdf68('0x3')](function(){return new BPromise(function(_0x21b1a8,_0x1173eb){return pm2[_0xdf68('0x7')](_0x5ecdc2,function(_0x9fc090,_0x1dc160){if(_0x9fc090){return _0x1173eb(_0x9fc090);}pm2['disconnect']();return _0x21b1a8(_0x1dc160);});});});};exports[_0xdf68('0x8')]=function(){return connect()['then'](function(){return new BPromise(function(_0x3e5f7c,_0x1beb16){return pm2[_0xdf68('0x8')](function(_0x2acffe,_0x5109bc){if(_0x2acffe){return _0x1beb16(_0x2acffe);}pm2[_0xdf68('0x5')]();return _0x3e5f7c(_0x5109bc);});});});};exports[_0xdf68('0x9')]=function(_0x5b9e14){return connect()['then'](function(){return new BPromise(function(_0x3cbb85,_0x20f062){return pm2[_0xdf68('0x9')](_0x5b9e14,function(_0x14e933,_0x18ed9d){if(_0x14e933){return _0x20f062(_0x14e933);}pm2[_0xdf68('0x5')]();return _0x3cbb85(_0x18ed9d);});});});};exports['delete']=function(_0x13546a){return connect()[_0xdf68('0x3')](function(){return new BPromise(function(_0x3395be,_0x52f277){return pm2[_0xdf68('0xa')](_0x13546a,function(_0x110b77,_0x247713){if(_0x110b77){return _0x52f277(_0x110b77);}pm2[_0xdf68('0x5')]();return _0x3395be(_0x247713);});});});};exports[_0xdf68('0xb')]=function(){return connect()[_0xdf68('0x3')](function(){return new BPromise(function(_0xe79def,_0xcd6224){return pm2['dump'](function(_0x53a15a){if(_0x53a15a){return _0xcd6224(_0x53a15a);}return _0xe79def(_0xdf68('0xc'));});});});}; \ No newline at end of file +var _0x8188=['start','then','disconnect','stop','restart','list','describe','delete','dump','saved','pm2','./config','connect','connected'];(function(_0x39a04c,_0x2b4002){var _0x580cb0=function(_0x138902){while(--_0x138902){_0x39a04c['push'](_0x39a04c['shift']());}};_0x580cb0(++_0x2b4002);}(_0x8188,0x114));var _0x8818=function(_0x5a4c41,_0x530a83){_0x5a4c41=_0x5a4c41-0x0;var _0x8fd13b=_0x8188[_0x5a4c41];return _0x8fd13b;};'use strict';var pm2=require(_0x8818('0x0'));var BPromise=require('bluebird');var config=require(_0x8818('0x1'));function connect(){return new BPromise(function(_0x4c80e2,_0x22f3a8){return pm2[_0x8818('0x2')](function(_0x15c41e){if(_0x15c41e){return _0x22f3a8(_0x15c41e);}return _0x4c80e2(_0x8818('0x3'));});});};exports[_0x8818('0x4')]=function(_0x5c6a05){return connect()[_0x8818('0x5')](function(){return new BPromise(function(_0x461cf4,_0x3a48da){return pm2['start'](_0x5c6a05,function(_0xfae985,_0x44d2d4){if(_0xfae985){return _0x3a48da(_0xfae985);}pm2[_0x8818('0x6')]();return _0x461cf4(_0x44d2d4);});});});};exports[_0x8818('0x7')]=function(_0x3620d1){return connect()['then'](function(){return new BPromise(function(_0x4d9686,_0x26275f){return pm2[_0x8818('0x7')](_0x3620d1,function(_0x2a603e,_0x448a7e){if(_0x2a603e){return _0x26275f(_0x2a603e);}pm2['disconnect']();return _0x4d9686(_0x448a7e);});});});};exports[_0x8818('0x8')]=function(_0x55b722){return connect()[_0x8818('0x5')](function(){return new BPromise(function(_0x4a4a76,_0x542e3f){return pm2[_0x8818('0x8')](_0x55b722,function(_0x566d7b,_0x3b794e){if(_0x566d7b){return _0x542e3f(_0x566d7b);}pm2[_0x8818('0x6')]();return _0x4a4a76(_0x3b794e);});});});};exports[_0x8818('0x9')]=function(){return connect()[_0x8818('0x5')](function(){return new BPromise(function(_0x56b485,_0x507119){return pm2[_0x8818('0x9')](function(_0x2b90d6,_0x519f3d){if(_0x2b90d6){return _0x507119(_0x2b90d6);}pm2['disconnect']();return _0x56b485(_0x519f3d);});});});};exports[_0x8818('0xa')]=function(_0x35760b){return connect()[_0x8818('0x5')](function(){return new BPromise(function(_0x240a56,_0x42d6e4){return pm2[_0x8818('0xa')](_0x35760b,function(_0x9195b,_0x5e9d23){if(_0x9195b){return _0x42d6e4(_0x9195b);}pm2[_0x8818('0x6')]();return _0x240a56(_0x5e9d23);});});});};exports[_0x8818('0xb')]=function(_0x539095){return connect()['then'](function(){return new BPromise(function(_0x15fc5e,_0x5316dc){return pm2['delete'](_0x539095,function(_0x2c003f,_0x1322a1){if(_0x2c003f){return _0x5316dc(_0x2c003f);}pm2[_0x8818('0x6')]();return _0x15fc5e(_0x1322a1);});});});};exports[_0x8818('0xc')]=function(){return connect()[_0x8818('0x5')](function(){return new BPromise(function(_0x13aa0c,_0x4653a2){return pm2[_0x8818('0xc')](function(_0x21c5c1){if(_0x21c5c1){return _0x4653a2(_0x21c5c1);}return _0x13aa0c(_0x8818('0xd'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index c621c97..40d627a 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 _0xa7b6=['subtract','length','map','info','join','update','system','timeout','emit','inspect','start','lodash','moment','util','../../config/environment','../logger','schedule','redis','defaults','socket.io-emitter','Setting','chatTimeout','then','ChatInteraction','lastMsgAt'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa7b6,0x1e6));var _0x6a7b=function(_0x1e2080,_0x53283b){_0x1e2080=_0x1e2080-0x0;var _0x260111=_0xa7b6[_0x1e2080];return _0x260111;};'use strict';var _=require(_0x6a7b('0x0'));var moment=require(_0x6a7b('0x1'));var Redis=require('ioredis');var util=require(_0x6a7b('0x2'));var config=require(_0x6a7b('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0x6a7b('0x4'))(_0x6a7b('0x5'));config[_0x6a7b('0x6')]=_[_0x6a7b('0x7')](config[_0x6a7b('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x6a7b('0x8'))(new Redis(config[_0x6a7b('0x6')]));function closeInteractions(){var _0x21ea2d=0x0;var _0x2073fc=[];return db[_0x6a7b('0x9')]['find']({'raw':!![],'attributes':['id',_0x6a7b('0xa')],'where':{'id':0x1}})[_0x6a7b('0xb')](function(_0x22bd82){_0x21ea2d=_0x22bd82[_0x6a7b('0xa')];if(_0x21ea2d){return db[_0x6a7b('0xc')]['findAll']({'raw':!![],'attributes':['id',_0x6a7b('0xd')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x6a7b('0xe')](_0x22bd82['chatTimeout'],'minutes')}}});}else{return[];}})[_0x6a7b('0xb')](function(_0x356204){if(_0x356204&&_0x356204[_0x6a7b('0xf')]){_0x2073fc=_[_0x6a7b('0x10')](_0x356204||[],'id');logger[_0x6a7b('0x11')]('[CHAT]\x20Interactions\x20to\x20close:',_0x2073fc[_0x6a7b('0x12')]());return db[_0x6a7b('0xc')][_0x6a7b('0x13')]({'closeReason':_0x6a7b('0x14'),'disposition':_0x6a7b('0x15'),'closed':!![],'closedAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x2073fc}});}})[_0x6a7b('0xb')](function(){if(_0x2073fc&&_0x2073fc[_0x6a7b('0xf')]){logger['info']('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x2073fc[_0x6a7b('0x12')]());for(var _0x5b92a0=0x0;_0x5b92a0<_0x2073fc[_0x6a7b('0xf')];_0x5b92a0++){io[_0x6a7b('0x16')]('chatInteraction:update',{'id':_0x2073fc[_0x5b92a0],'closed':!![]});}}})['catch'](function(_0x57b2fc){logger['error']('[CHAT]\x20Error\x20closing\x20interactions',_0x57b2fc?util[_0x6a7b('0x17')](_0x57b2fc,{'showHidden':![],'depth':null}):'');});}exports[_0x6a7b('0x18')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x3dc8=['defaults','redis','Setting','chatTimeout','then','findAll','lastMsgAt','subtract','minutes','length','[CHAT]\x20Interactions\x20to\x20close:','join','ChatInteraction','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','catch','error','inspect','start','lodash','moment','ioredis','util','../../config/environment','../logger'];(function(_0x31e644,_0x443e15){var _0x42a550=function(_0x5607d6){while(--_0x5607d6){_0x31e644['push'](_0x31e644['shift']());}};_0x42a550(++_0x443e15);}(_0x3dc8,0x1bc));var _0x83dc=function(_0x2f90d1,_0x3e656e){_0x2f90d1=_0x2f90d1-0x0;var _0x5d6985=_0x3dc8[_0x2f90d1];return _0x5d6985;};'use strict';var _=require(_0x83dc('0x0'));var moment=require(_0x83dc('0x1'));var Redis=require(_0x83dc('0x2'));var util=require(_0x83dc('0x3'));var config=require(_0x83dc('0x4'));var db=require('../../mysqldb')['db'];var logger=require(_0x83dc('0x5'))('schedule');config['redis']=_[_0x83dc('0x6')](config[_0x83dc('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x83dc('0x7')]));function closeInteractions(){var _0x36645d=0x0;var _0x21b032=[];return db[_0x83dc('0x8')]['find']({'raw':!![],'attributes':['id',_0x83dc('0x9')],'where':{'id':0x1}})[_0x83dc('0xa')](function(_0x50820e){_0x36645d=_0x50820e['chatTimeout'];if(_0x36645d){return db['ChatInteraction'][_0x83dc('0xb')]({'raw':!![],'attributes':['id',_0x83dc('0xc')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x83dc('0xd')](_0x50820e[_0x83dc('0x9')],_0x83dc('0xe'))}}});}else{return[];}})[_0x83dc('0xa')](function(_0x351aa9){if(_0x351aa9&&_0x351aa9[_0x83dc('0xf')]){_0x21b032=_['map'](_0x351aa9||[],'id');logger['info'](_0x83dc('0x10'),_0x21b032[_0x83dc('0x11')]());return db[_0x83dc('0x12')][_0x83dc('0x13')]({'closeReason':_0x83dc('0x14'),'disposition':_0x83dc('0x15'),'closed':!![],'closedAt':moment()[_0x83dc('0x16')](_0x83dc('0x17'))},{'where':{'id':_0x21b032}});}})['then'](function(){if(_0x21b032&&_0x21b032[_0x83dc('0xf')]){logger['info'](_0x83dc('0x18'),_0x21b032[_0x83dc('0x11')]());for(var _0xc11f43=0x0;_0xc11f43<_0x21b032[_0x83dc('0xf')];_0xc11f43++){io[_0x83dc('0x19')]('chatInteraction:update',{'id':_0x21b032[_0xc11f43],'closed':!![]});}}})[_0x83dc('0x1a')](function(_0x4c5d6c){logger[_0x83dc('0x1b')]('[CHAT]\x20Error\x20closing\x20interactions',_0x4c5d6c?util[_0x83dc('0x1c')](_0x4c5d6c,{'showHidden':![],'depth':null}):'');});}exports[_0x83dc('0x1d')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/cloud-provider.js b/server/config/schedule/cloud-provider.js index b6703f4..4ebb5c7 100644 --- a/server/config/schedule/cloud-provider.js +++ b/server/config/schedule/cloud-provider.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcf85=['startAllRefreshIntervals','../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0x14814c,_0x303370){var _0x1753c8=function(_0x4a8223){while(--_0x4a8223){_0x14814c['push'](_0x14814c['shift']());}};_0x1753c8(++_0x303370);}(_0xcf85,0x16d));var _0x5cf8=function(_0x5484bf,_0x26fd67){_0x5484bf=_0x5484bf-0x0;var _0x107c4f=_0xcf85[_0x5484bf];return _0x107c4f;};'use strict';function start(){var _0x4d7f31=require(_0x5cf8('0x0'));return _0x4d7f31[_0x5cf8('0x1')]();}module['exports']={'intervals':{},'start':start}; \ No newline at end of file +var _0x90f3=['../../api/cloudProvider/cloudProvider.oauth.js','startAllRefreshIntervals','exports'];(function(_0x1903a5,_0x286388){var _0x4c8735=function(_0x543494){while(--_0x543494){_0x1903a5['push'](_0x1903a5['shift']());}};_0x4c8735(++_0x286388);}(_0x90f3,0x1e6));var _0x390f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x90f3[_0x20a584];return _0x4b41a8;};'use strict';function start(){var _0x20f0f1=require(_0x390f('0x0'));return _0x20f0f1[_0x390f('0x1')]();}module[_0x390f('0x2')]={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 747ec5f..18361f8 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 _0x0f79=['scheduled','output','exec\x20defaul\x20report\x20id:%s','runReport','DefaultReportId','then','exec\x20custom\x20report\x20id:%s','CustomReportId','Schedule','findAll','MailServerOut','CloudProvider','keys','map','toString','keyBy','difference','intersection','exists','deleteJob','toRun','index','my\x20id','resolve','run\x20job','cron','active','isBetween','endAt','add','start','add\x20cron','stop','length','startAt','update','stop\x20cron','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','format','\x22%s\x22\x20<%s>','MailAccount','name','Smtp','Report\x20%s\x20last\x20%s\x20%s','subtractUnit','join','../../files/reports','savename','%s.%s','basename','extname','status','Sent','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','existsSync','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','request','SendMail','error','error\x20mail','email\x20sent','catch','data','subtractNumber','subtractNumber\x20null\x20or\x20undefined','isNil','subtract','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x43bc0e,_0x18864e){var _0x5b4081=function(_0x37bdfb){while(--_0x37bdfb){_0x43bc0e['push'](_0x43bc0e['shift']());}};_0x5b4081(++_0x18864e);}(_0x0f79,0xd1));var _0x90f7=function(_0x5a3cf0,_0x160a68){_0x5a3cf0=_0x5a3cf0-0x0;var _0x5a64ee=_0x0f79[_0x5a3cf0];return _0x5a64ee;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0x90f7('0x0'));var _=require(_0x90f7('0x1'));var moment=require(_0x90f7('0x2'));var CronJobManager=require(_0x90f7('0x3'));var jayson=require(_0x90f7('0x4'));var BPromise=require('bluebird');var logger=require(_0x90f7('0x5'))(_0x90f7('0x6'));var db=require('../../mysqldb')['db'];var analyticCustomReportController=require(_0x90f7('0x7'));var analyticDefaultReportController=require(_0x90f7('0x8'));var client=jayson[_0x90f7('0x9')][_0x90f7('0xa')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x311344,_0x66a858){return function(){logger[_0x90f7('0xb')](_0x90f7('0xc'),_0x311344[_0x90f7('0xd')]);var _0x5c1611=!![];var _0x31834a=_0x311344['MailAccount']['getSmtpOptions']();var _0x4e732a={'account':_0x31834a,'message':{'from':util[_0x90f7('0xe')](_0x90f7('0xf'),_0x311344[_0x90f7('0x10')][_0x90f7('0x11')],_0x311344[_0x90f7('0x10')]['email']||_0x311344[_0x90f7('0x10')][_0x90f7('0x12')]['user']),'to':_0x311344[_0x90f7('0xd')],'cc':_0x311344['cc'],'bcc':_0x311344['bcc'],'subject':util[_0x90f7('0xe')](_0x90f7('0x13'),_0x66a858[_0x90f7('0x11')],_0x311344['subtractNumber'],_0x311344[_0x90f7('0x14')])}};var _0x24442c=path[_0x90f7('0x15')](__dirname,_0x90f7('0x16'));var _0x511ec3=_0x66a858[_0x90f7('0x17')];var _0x2c15e0=util[_0x90f7('0xe')](_0x90f7('0x18'),path[_0x90f7('0x19')](_0x66a858[_0x90f7('0x17')],path[_0x90f7('0x1a')](_0x66a858['savename'])),'zip');var _0x20a7c8=path[_0x90f7('0x15')](_0x24442c,_0x511ec3);var _0x5a6efe=path[_0x90f7('0x15')](_0x24442c,_0x2c15e0);if(fs['existsSync'](_0x20a7c8)){_0x66a858[_0x90f7('0x1b')]=_0x90f7('0x1c');_0x4e732a[_0x90f7('0x1d')][_0x90f7('0x1e')]=[{'filename':_0x511ec3,'path':_0x20a7c8}];_0x4e732a['message'][_0x90f7('0x1f')]=util['format'](_0x90f7('0x20'),JSON[_0x90f7('0x21')](_0x66a858,null,0x2));}else if(fs[_0x90f7('0x22')](_0x5a6efe)){_0x66a858[_0x90f7('0x1b')]='Sent';_0x4e732a[_0x90f7('0x1d')][_0x90f7('0x1e')]=[{'filename':_0x2c15e0,'path':_0x5a6efe}];}else{_0x4e732a['message'][_0x90f7('0x1f')]=_0x90f7('0x23');if(!_0x311344[_0x90f7('0x24')]){_0x5c1611=![];logger['info']('empty\x20file,\x20email\x20not\x20sent');}}if(_0x5c1611){return client[_0x90f7('0x25')](_0x90f7('0x26'),_0x4e732a)['then'](function(_0xdc43ba){if(_0xdc43ba[_0x90f7('0x27')]){return logger[_0x90f7('0x27')](_0x90f7('0x28'),JSON[_0x90f7('0x21')](_0xdc43ba));}return logger[_0x90f7('0xb')](_0x90f7('0x29'));})[_0x90f7('0x2a')](function(_0x4cf6fe){return logger[_0x90f7('0x27')](_0x90f7('0x28'),JSON['stringify'](_0x4cf6fe));});}};}function handleError(){return function(_0x34807f){return logger['error'](JSON[_0x90f7('0x21')](_0x34807f));};}function handleResult(_0xe94742){return function(_0xfe8dbf){logger[_0x90f7('0xb')](_0x90f7('0x2b'),JSON[_0x90f7('0x21')](_0xfe8dbf));if(_0xe94742[_0x90f7('0x10')]&&_0xe94742[_0x90f7('0x10')][_0x90f7('0x12')]&&!_['isNil'](_0xe94742[_0x90f7('0xd')])){setTimeout(handleSendEmail(_0xe94742,_0xfe8dbf),0x3c*0x3e8);}};}function handleJob(_0x4ec6cf){return function(){try{if(_['isNil'](_0x4ec6cf[_0x90f7('0x2c')])){return logger[_0x90f7('0xb')](_0x90f7('0x2d'));}if(_[_0x90f7('0x2e')](_0x4ec6cf[_0x90f7('0x14')])){return logger[_0x90f7('0xb')]('subtractUnit\x20null\x20or\x20undefined');}var _0x3abdd6={'startDate':moment()[_0x90f7('0x2f')](_0x4ec6cf[_0x90f7('0x2c')],_0x4ec6cf[_0x90f7('0x14')])['format'](_0x90f7('0x30')),'endDate':moment()[_0x90f7('0xe')](_0x90f7('0x30')),'type':_0x90f7('0x31'),'output':_0x4ec6cf[_0x90f7('0x32')],'name':_0x4ec6cf[_0x90f7('0x11')]};if(!_[_0x90f7('0x2e')](_0x4ec6cf['DefaultReportId'])){logger[_0x90f7('0xb')](_0x90f7('0x33'),_0x4ec6cf['DefaultReportId']);return analyticDefaultReportController[_0x90f7('0x34')]({'id':_0x4ec6cf[_0x90f7('0x35')]},_0x3abdd6)[_0x90f7('0x36')](handleResult(_0x4ec6cf))[_0x90f7('0x2a')](handleError());}if(!_[_0x90f7('0x2e')](_0x4ec6cf['CustomReportId'])){logger[_0x90f7('0xb')](_0x90f7('0x37'),_0x4ec6cf[_0x90f7('0x38')]);return analyticCustomReportController['runReport']({'id':_0x4ec6cf[_0x90f7('0x38')]},_0x3abdd6)['then'](handleResult(_0x4ec6cf))[_0x90f7('0x2a')](handleError());}}catch(_0x32e763){logger[_0x90f7('0x27')](JSON[_0x90f7('0x21')](_0x32e763));}return logger[_0x90f7('0xb')]('no\x20report\x20id');};}function getJobs(_0x4e7616){var _0x584abf={};if(_0x4e7616){_0x584abf['id']=_0x4e7616;}return db[_0x90f7('0x39')][_0x90f7('0x3a')]({'where':_0x584abf,'include':[{'model':db['MailAccount'],'attributes':['id',_0x90f7('0x11'),'email'],'include':[{'model':db[_0x90f7('0x3b')],'as':_0x90f7('0x12'),'include':[{'model':db[_0x90f7('0x3c')],'as':_0x90f7('0x3c')}]}]}]})[_0x90f7('0x36')](function(_0x304ea0){var _0x18cf02=_[_0x90f7('0x3d')](manager['jobs']);var _0x3e88d8=_[_0x90f7('0x3e')](_0x304ea0,function(_0x1e655b){return _0x1e655b['id'][_0x90f7('0x3f')]();});var _0x11352a=_[_0x90f7('0x40')](_0x304ea0,function(_0x3be889){return _0x3be889['id'][_0x90f7('0x3f')]();});var _0x4b198e=_0x4e7616?_0x3e88d8:_[_0x90f7('0x41')](_0x3e88d8,_0x18cf02);var _0x678b7f=_[_0x90f7('0x42')](_0x3e88d8,_0x18cf02);var _0x2e0cfc=_['difference'](_0x18cf02,_0x3e88d8);var _0x3bad60;var _0x5a9dc0;for(_0x3bad60=0x0;_0x3bad60<_0x2e0cfc['length']&&!_0x4e7616;_0x3bad60+=0x1){_0x5a9dc0=_0x2e0cfc[_0x3bad60][_0x90f7('0x3f')]();if(manager[_0x90f7('0x43')](_0x5a9dc0)){manager['stop'](_0x5a9dc0);manager[_0x90f7('0x44')](_0x5a9dc0);logger[_0x90f7('0xb')]('delete\x20cron',_0x5a9dc0);}}logger[_0x90f7('0xb')](_0x90f7('0x45'),JSON[_0x90f7('0x21')](_0x4b198e));for(_0x3bad60=0x0;_0x3bad60<_0x4b198e['length'];_0x3bad60+=0x1){_0x5a9dc0=_0x4b198e[_0x3bad60]['toString']();logger[_0x90f7('0xb')](_0x90f7('0x46'),_0x5a9dc0);if(_0x4e7616){logger[_0x90f7('0xb')](_0x90f7('0x47'),_0x4e7616);logger['info'](JSON[_0x90f7('0x21')](_0x11352a[_0x5a9dc0]));BPromise[_0x90f7('0x48')]()['then'](handleJob(_0x11352a[_0x5a9dc0]));logger[_0x90f7('0xb')](_0x90f7('0x49'),_0x11352a[_0x5a9dc0][_0x90f7('0x11')],_0x11352a[_0x5a9dc0][_0x90f7('0x4a')]);}else if(_0x11352a[_0x5a9dc0][_0x90f7('0x4a')]&&_0x11352a[_0x5a9dc0][_0x90f7('0x4b')]&&moment()[_0x90f7('0x4c')](_0x11352a[_0x5a9dc0]['startAt'],_0x11352a[_0x5a9dc0][_0x90f7('0x4d')])){manager[_0x90f7('0x4e')](_0x5a9dc0,_0x11352a[_0x5a9dc0][_0x90f7('0x4a')],handleJob(_0x11352a[_0x5a9dc0]));manager[_0x90f7('0x4f')](_0x5a9dc0);logger[_0x90f7('0xb')](_0x90f7('0x50'),_0x11352a[_0x5a9dc0][_0x90f7('0x11')],_0x11352a[_0x5a9dc0][_0x90f7('0x4a')]);}else if(manager[_0x90f7('0x43')](_0x5a9dc0)){manager[_0x90f7('0x51')](_0x5a9dc0);manager[_0x90f7('0x44')](_0x5a9dc0);logger[_0x90f7('0xb')]('stop\x20cron',_0x11352a[_0x5a9dc0][_0x90f7('0x11')],_0x11352a[_0x5a9dc0]['cron']);}}for(_0x3bad60=0x0,_0x5a9dc0;_0x3bad60<_0x678b7f[_0x90f7('0x52')]&&!_0x4e7616;_0x3bad60+=0x1){_0x5a9dc0=_0x678b7f[_0x3bad60][_0x90f7('0x3f')]();if(manager[_0x90f7('0x43')](_0x5a9dc0)){if(_0x11352a[_0x5a9dc0][_0x90f7('0x4a')]&&_0x11352a[_0x5a9dc0]['active']&&moment()['isBetween'](_0x11352a[_0x5a9dc0][_0x90f7('0x53')],_0x11352a[_0x5a9dc0]['endAt'])){manager[_0x90f7('0x54')](_0x5a9dc0,_0x11352a[_0x5a9dc0]['cron'],handleJob(_0x11352a[_0x5a9dc0]));logger[_0x90f7('0xb')]('update\x20cron',_0x11352a[_0x5a9dc0]['name'],_0x11352a[_0x5a9dc0][_0x90f7('0x4a')]);}else{manager[_0x90f7('0x51')](_0x5a9dc0);manager[_0x90f7('0x44')](_0x5a9dc0);logger[_0x90f7('0xb')](_0x90f7('0x55'),_0x11352a[_0x5a9dc0]['name'],_0x11352a[_0x5a9dc0]['cron']);}}}})[_0x90f7('0x2a')](function(_0x23f444){logger[_0x90f7('0x27')](JSON[_0x90f7('0x21')](_0x23f444));});}exports['run']=function(_0x17e9bb){return getJobs(_0x17e9bb);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x93a0=['savename','format','%s.%s','basename','zip','Sent','attachments','message','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','status','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','error','error\x20mail','email\x20sent','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','catch','CustomReportId','exec\x20custom\x20report\x20id:%s','then','no\x20report\x20id','Schedule','findAll','CloudProvider','jobs','toString','keyBy','difference','exists','deleteJob','toRun','length','resolve','run\x20job','cron','isBetween','startAt','endAt','add','stop','stop\x20cron','update','update\x20cron','run','start','util','path','moment','cron-job-manager','bluebird','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','getSmtpOptions','\x22%s\x22\x20<%s>','MailAccount','name','Smtp','user','email','bcc','subtractNumber','subtractUnit','join','../../files/reports'];(function(_0x5daa39,_0x2c970d){var _0xca9c0=function(_0x58ad61){while(--_0x58ad61){_0x5daa39['push'](_0x5daa39['shift']());}};_0xca9c0(++_0x2c970d);}(_0x93a0,0xdf));var _0x093a=function(_0x2cad6f,_0x761ec5){_0x2cad6f=_0x2cad6f-0x0;var _0x410cd8=_0x93a0[_0x2cad6f];return _0x410cd8;};'use strict';var fs=require('fs');var util=require(_0x093a('0x0'));var path=require(_0x093a('0x1'));var _=require('lodash');var moment=require(_0x093a('0x2'));var CronJobManager=require(_0x093a('0x3'));var jayson=require('jayson/promise');var BPromise=require(_0x093a('0x4'));var logger=require(_0x093a('0x5'))(_0x093a('0x6'));var db=require(_0x093a('0x7'))['db'];var analyticCustomReportController=require(_0x093a('0x8'));var analyticDefaultReportController=require(_0x093a('0x9'));var client=jayson[_0x093a('0xa')][_0x093a('0xb')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x2d0df0,_0x248f09){return function(){logger[_0x093a('0xc')](_0x093a('0xd'),_0x2d0df0['email']);var _0x70b644=!![];var _0x17eb90=_0x2d0df0['MailAccount'][_0x093a('0xe')]();var _0x4bda0b={'account':_0x17eb90,'message':{'from':util['format'](_0x093a('0xf'),_0x2d0df0[_0x093a('0x10')][_0x093a('0x11')],_0x2d0df0[_0x093a('0x10')]['email']||_0x2d0df0['MailAccount'][_0x093a('0x12')][_0x093a('0x13')]),'to':_0x2d0df0[_0x093a('0x14')],'cc':_0x2d0df0['cc'],'bcc':_0x2d0df0[_0x093a('0x15')],'subject':util['format']('Report\x20%s\x20last\x20%s\x20%s',_0x248f09[_0x093a('0x11')],_0x2d0df0[_0x093a('0x16')],_0x2d0df0[_0x093a('0x17')])}};var _0x4fb403=path[_0x093a('0x18')](__dirname,_0x093a('0x19'));var _0x5e4b7f=_0x248f09[_0x093a('0x1a')];var _0x263d82=util[_0x093a('0x1b')](_0x093a('0x1c'),path[_0x093a('0x1d')](_0x248f09['savename'],path['extname'](_0x248f09[_0x093a('0x1a')])),_0x093a('0x1e'));var _0xaf2db7=path[_0x093a('0x18')](_0x4fb403,_0x5e4b7f);var _0x49f35e=path[_0x093a('0x18')](_0x4fb403,_0x263d82);if(fs['existsSync'](_0xaf2db7)){_0x248f09['status']=_0x093a('0x1f');_0x4bda0b['message'][_0x093a('0x20')]=[{'filename':_0x5e4b7f,'path':_0xaf2db7}];_0x4bda0b[_0x093a('0x21')][_0x093a('0x22')]=util[_0x093a('0x1b')](_0x093a('0x23'),JSON[_0x093a('0x24')](_0x248f09,null,0x2));}else if(fs['existsSync'](_0x49f35e)){_0x248f09[_0x093a('0x25')]=_0x093a('0x1f');_0x4bda0b['message']['attachments']=[{'filename':_0x263d82,'path':_0x49f35e}];}else{_0x4bda0b[_0x093a('0x21')]['text']=_0x093a('0x26');if(!_0x2d0df0[_0x093a('0x27')]){_0x70b644=![];logger[_0x093a('0xc')](_0x093a('0x28'));}}if(_0x70b644){return client['request']('SendMail',_0x4bda0b)['then'](function(_0x4a7487){if(_0x4a7487['error']){return logger[_0x093a('0x29')](_0x093a('0x2a'),JSON[_0x093a('0x24')](_0x4a7487));}return logger[_0x093a('0xc')](_0x093a('0x2b'));})['catch'](function(_0x2a9da5){return logger[_0x093a('0x29')](_0x093a('0x2a'),JSON[_0x093a('0x24')](_0x2a9da5));});}};}function handleError(){return function(_0x4c9e07){return logger[_0x093a('0x29')](JSON[_0x093a('0x24')](_0x4c9e07));};}function handleResult(_0x16cd23){return function(_0x29b917){logger[_0x093a('0xc')]('data',JSON[_0x093a('0x24')](_0x29b917));if(_0x16cd23[_0x093a('0x10')]&&_0x16cd23[_0x093a('0x10')]['Smtp']&&!_[_0x093a('0x2c')](_0x16cd23['email'])){setTimeout(handleSendEmail(_0x16cd23,_0x29b917),0x3c*0x3e8);}};}function handleJob(_0x471db4){return function(){try{if(_[_0x093a('0x2c')](_0x471db4[_0x093a('0x16')])){return logger['info'](_0x093a('0x2d'));}if(_[_0x093a('0x2c')](_0x471db4['subtractUnit'])){return logger[_0x093a('0xc')](_0x093a('0x2e'));}var _0x5a6a1f={'startDate':moment()[_0x093a('0x2f')](_0x471db4[_0x093a('0x16')],_0x471db4[_0x093a('0x17')])[_0x093a('0x1b')](_0x093a('0x30')),'endDate':moment()['format'](_0x093a('0x30')),'type':_0x093a('0x31'),'output':_0x471db4[_0x093a('0x32')],'name':_0x471db4['name']};if(!_[_0x093a('0x2c')](_0x471db4[_0x093a('0x33')])){logger[_0x093a('0xc')](_0x093a('0x34'),_0x471db4[_0x093a('0x33')]);return analyticDefaultReportController[_0x093a('0x35')]({'id':_0x471db4[_0x093a('0x33')]},_0x5a6a1f)['then'](handleResult(_0x471db4))[_0x093a('0x36')](handleError());}if(!_[_0x093a('0x2c')](_0x471db4[_0x093a('0x37')])){logger[_0x093a('0xc')](_0x093a('0x38'),_0x471db4['CustomReportId']);return analyticCustomReportController[_0x093a('0x35')]({'id':_0x471db4[_0x093a('0x37')]},_0x5a6a1f)[_0x093a('0x39')](handleResult(_0x471db4))[_0x093a('0x36')](handleError());}}catch(_0x2a8d49){logger[_0x093a('0x29')](JSON['stringify'](_0x2a8d49));}return logger['info'](_0x093a('0x3a'));};}function getJobs(_0x5b1704){var _0x3c5618={};if(_0x5b1704){_0x3c5618['id']=_0x5b1704;}return db[_0x093a('0x3b')][_0x093a('0x3c')]({'where':_0x3c5618,'include':[{'model':db[_0x093a('0x10')],'attributes':['id',_0x093a('0x11'),_0x093a('0x14')],'include':[{'model':db['MailServerOut'],'as':_0x093a('0x12'),'include':[{'model':db[_0x093a('0x3d')],'as':_0x093a('0x3d')}]}]}]})[_0x093a('0x39')](function(_0x5c9d91){var _0x5e9b60=_['keys'](manager[_0x093a('0x3e')]);var _0x31a2d4=_['map'](_0x5c9d91,function(_0x36e6a0){return _0x36e6a0['id'][_0x093a('0x3f')]();});var _0x3d5cec=_[_0x093a('0x40')](_0x5c9d91,function(_0x3585a7){return _0x3585a7['id']['toString']();});var _0x5d5fd2=_0x5b1704?_0x31a2d4:_['difference'](_0x31a2d4,_0x5e9b60);var _0x52f4f1=_['intersection'](_0x31a2d4,_0x5e9b60);var _0x1fa869=_[_0x093a('0x41')](_0x5e9b60,_0x31a2d4);var _0x4ebd7b;var _0x2b7aa6;for(_0x4ebd7b=0x0;_0x4ebd7b<_0x1fa869['length']&&!_0x5b1704;_0x4ebd7b+=0x1){_0x2b7aa6=_0x1fa869[_0x4ebd7b][_0x093a('0x3f')]();if(manager[_0x093a('0x42')](_0x2b7aa6)){manager['stop'](_0x2b7aa6);manager[_0x093a('0x43')](_0x2b7aa6);logger[_0x093a('0xc')]('delete\x20cron',_0x2b7aa6);}}logger[_0x093a('0xc')](_0x093a('0x44'),JSON[_0x093a('0x24')](_0x5d5fd2));for(_0x4ebd7b=0x0;_0x4ebd7b<_0x5d5fd2[_0x093a('0x45')];_0x4ebd7b+=0x1){_0x2b7aa6=_0x5d5fd2[_0x4ebd7b][_0x093a('0x3f')]();logger['info']('index',_0x2b7aa6);if(_0x5b1704){logger[_0x093a('0xc')]('my\x20id',_0x5b1704);logger[_0x093a('0xc')](JSON[_0x093a('0x24')](_0x3d5cec[_0x2b7aa6]));BPromise[_0x093a('0x46')]()['then'](handleJob(_0x3d5cec[_0x2b7aa6]));logger[_0x093a('0xc')](_0x093a('0x47'),_0x3d5cec[_0x2b7aa6][_0x093a('0x11')],_0x3d5cec[_0x2b7aa6][_0x093a('0x48')]);}else if(_0x3d5cec[_0x2b7aa6][_0x093a('0x48')]&&_0x3d5cec[_0x2b7aa6]['active']&&moment()[_0x093a('0x49')](_0x3d5cec[_0x2b7aa6][_0x093a('0x4a')],_0x3d5cec[_0x2b7aa6][_0x093a('0x4b')])){manager[_0x093a('0x4c')](_0x2b7aa6,_0x3d5cec[_0x2b7aa6][_0x093a('0x48')],handleJob(_0x3d5cec[_0x2b7aa6]));manager['start'](_0x2b7aa6);logger[_0x093a('0xc')]('add\x20cron',_0x3d5cec[_0x2b7aa6]['name'],_0x3d5cec[_0x2b7aa6][_0x093a('0x48')]);}else if(manager['exists'](_0x2b7aa6)){manager[_0x093a('0x4d')](_0x2b7aa6);manager[_0x093a('0x43')](_0x2b7aa6);logger['info'](_0x093a('0x4e'),_0x3d5cec[_0x2b7aa6][_0x093a('0x11')],_0x3d5cec[_0x2b7aa6][_0x093a('0x48')]);}}for(_0x4ebd7b=0x0,_0x2b7aa6;_0x4ebd7b<_0x52f4f1['length']&&!_0x5b1704;_0x4ebd7b+=0x1){_0x2b7aa6=_0x52f4f1[_0x4ebd7b][_0x093a('0x3f')]();if(manager[_0x093a('0x42')](_0x2b7aa6)){if(_0x3d5cec[_0x2b7aa6][_0x093a('0x48')]&&_0x3d5cec[_0x2b7aa6]['active']&&moment()[_0x093a('0x49')](_0x3d5cec[_0x2b7aa6]['startAt'],_0x3d5cec[_0x2b7aa6][_0x093a('0x4b')])){manager[_0x093a('0x4f')](_0x2b7aa6,_0x3d5cec[_0x2b7aa6][_0x093a('0x48')],handleJob(_0x3d5cec[_0x2b7aa6]));logger[_0x093a('0xc')](_0x093a('0x50'),_0x3d5cec[_0x2b7aa6][_0x093a('0x11')],_0x3d5cec[_0x2b7aa6]['cron']);}else{manager['stop'](_0x2b7aa6);manager[_0x093a('0x43')](_0x2b7aa6);logger['info'](_0x093a('0x4e'),_0x3d5cec[_0x2b7aa6][_0x093a('0x11')],_0x3d5cec[_0x2b7aa6][_0x093a('0x48')]);}}}})[_0x093a('0x36')](function(_0x4e44d9){logger[_0x093a('0x29')](JSON[_0x093a('0x24')](_0x4e44d9));});}exports[_0x093a('0x51')]=function(_0x38d745){return getJobs(_0x38d745);};exports[_0x093a('0x52')]=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 13bfd7e..9b04041 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 _0x457b=['data1','data2','transcribeRegion','then','format','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','length','fileText','transcripts','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','Sequelize','ValidationError','sentiment','sentimentAccountId','sentimentRegion','language','bucket','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Positive','Negative','SentimentScore','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','Sentiment\x20Analysis\x20not\x20requested','Sentiment','catch','name','SequelizeValidationError','error','inspect','VoiceRecording','findAll','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','forEach','start','lodash','aws-sdk','util','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','info','transcribeName'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x457b,0xca));var _0xb457=function(_0x39f7b2,_0xda64e3){_0x39f7b2=_0x39f7b2-0x0;var _0x86bc34=_0x457b[_0x39f7b2];return _0x86bc34;};var _=require(_0xb457('0x0'));var AWS=require(_0xb457('0x1'));var rp=require('request-promise');var util=require(_0xb457('0x2'));var BPromise=require(_0xb457('0x3'));var db=require(_0xb457('0x4'))['db'];var logger=require(_0xb457('0x5'))(_0xb457('0x6'));function getTranscriptionJob(_0x54eddd,_0x156af3,_0x100f37,_0x23a9db){return new Promise(function(_0x3823c7,_0x3cefc3){var _0x523e05=new AWS[(_0xb457('0x7'))]({'accessKeyId':_0x156af3,'secretAccessKey':_0x54eddd,'region':_0x100f37});_0x523e05[_0xb457('0x8')]({'TranscriptionJobName':_0x23a9db},function(_0x2182d6,_0x48388c){if(_0x2182d6){return _0x3cefc3(_0x2182d6);}else{return _0x3823c7(_0x48388c);}});});}function sentiment(_0x5bfe2c,_0x24374,_0x3baee8,_0x537ec4,_0x19afe8){return new Promise(function(_0x1cc258,_0x810aed){var _0x485de2=new AWS[(_0xb457('0x9'))]({'accessKeyId':_0x24374,'secretAccessKey':_0x5bfe2c,'region':_0x3baee8});_0x485de2[_0xb457('0xa')]({'Text':_0x537ec4,'LanguageCode':_0x19afe8[_0xb457('0xb')](0x0,0x2)},function(_0x78d980,_0x58609){if(_0x78d980){return _0x810aed(_0x78d980);}else{return _0x1cc258(_0x58609);}});});}function checkTranscribeJob(_0x48eec3,_0x595609,_0x1c9f97){var _0x992b23;return new BPromise(function(_0x3e207c,_0x469be3){logger[_0xb457('0xc')](util['format']('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x48eec3['id'],_0x48eec3[_0xb457('0xd')]));return getTranscriptionJob(_0x1c9f97[_0xb457('0xe')],_0x1c9f97[_0xb457('0xf')],_0x595609[_0xb457('0x10')],_0x48eec3['transcribeName'])[_0xb457('0x11')](function(_0xbbfda5){logger[_0xb457('0xc')](util[_0xb457('0x12')](_0xb457('0x13'),_0x48eec3['id'],_0x48eec3[_0xb457('0xd')],_0xbbfda5[_0xb457('0x14')][_0xb457('0x15')]));if(!_0x48eec3['fileText']){switch(_0xbbfda5[_0xb457('0x14')][_0xb457('0x15')]){case _0xb457('0x16'):var _0x554c8a={'transcribeStatus':_0xbbfda5['TranscriptionJob'][_0xb457('0x15')],'fileUri':_0xbbfda5[_0xb457('0x14')][_0xb457('0x17')][_0xb457('0x18')]};logger[_0xb457('0xc')](util[_0xb457('0x12')](_0xb457('0x19'),_0x48eec3['id']));return rp({'uri':_0xbbfda5['TranscriptionJob']['Transcript'][_0xb457('0x18')],'json':!![]})[_0xb457('0x11')](function(_0x1f85ab){logger['info'](util[_0xb457('0x12')](_0xb457('0x1a'),_0x48eec3['id']));if(_0x1f85ab&&_0x1f85ab[_0xb457('0x1b')]&&_0x1f85ab['results']['transcripts']&&_0x1f85ab[_0xb457('0x1b')]['transcripts'][_0xb457('0x1c')]){_0x554c8a[_0xb457('0x1d')]='';for(var _0x179ef1=0x0;_0x179ef1<_0x1f85ab[_0xb457('0x1b')]['transcripts'][_0xb457('0x1c')];_0x179ef1++){_0x554c8a[_0xb457('0x1d')]+=_0x1f85ab['results'][_0xb457('0x1e')][_0x179ef1][_0xb457('0x1f')]+'';}}return _0x48eec3[_0xb457('0x20')](_0x554c8a);})[_0xb457('0x11')](function(){logger[_0xb457('0xc')](util[_0xb457('0x12')](_0xb457('0x21'),_0x48eec3['id']));if(!_0x48eec3['tempSentiment']){throw new db[(_0xb457('0x22'))][(_0xb457('0x23'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x595609[_0xb457('0x24')]||!_0x595609[_0xb457('0x25')]||!_0x595609[_0xb457('0x26')]||!_0x595609[_0xb457('0x27')]||!_0x595609[_0xb457('0x28')]){throw new db['Sequelize'][(_0xb457('0x23'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x554c8a[_0xb457('0x1d')]){throw new Error(_0xb457('0x29'));}if(_0x595609['sentimentAccountId']===_0x1c9f97['id']){return _0x1c9f97;}else{return db[_0xb457('0x2a')][_0xb457('0x2b')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0xb457('0x11')](function(_0x5ef0fe){if(!_0x5ef0fe){throw new db[(_0xb457('0x22'))]['ValidationError'](_0xb457('0x2c'));}if(!_0x5ef0fe[_0xb457('0xe')]||!_0x5ef0fe['data2']){throw new db[(_0xb457('0x22'))][(_0xb457('0x23'))](_0xb457('0x2d'));}_0x992b23=_0x5ef0fe;logger[_0xb457('0xc')](util['format'](_0xb457('0x2e'),_0x48eec3['id']));return sentiment(_0x992b23[_0xb457('0xe')],_0x992b23[_0xb457('0xf')],_0x595609[_0xb457('0x26')],_0x554c8a[_0xb457('0x1d')],_0x595609[_0xb457('0x27')]);})['then'](function(_0x2d72ca){logger[_0xb457('0xc')](util[_0xb457('0x12')](_0xb457('0x2f'),_0x48eec3['id']));return _0x48eec3[_0xb457('0x20')]({'sentiment':_0x2d72ca['Sentiment'],'sPositive':_0x2d72ca['SentimentScore'][_0xb457('0x30')],'sNegative':_0x2d72ca['SentimentScore'][_0xb457('0x31')],'sMixed':_0x2d72ca[_0xb457('0x32')][_0xb457('0x33')],'sNeutral':_0x2d72ca[_0xb457('0x32')][_0xb457('0x34')]});})[_0xb457('0x11')](function(){logger[_0xb457('0xc')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x48eec3['id']));_0x3e207c();});case _0xb457('0x35'):return _0x48eec3[_0xb457('0x20')]({'transcribeStatus':'FAILED','failureReason':_0xbbfda5[_0xb457('0x14')][_0xb457('0x36')]})[_0xb457('0x11')](function(){logger[_0xb457('0xc')](util[_0xb457('0x12')](_0xb457('0x21'),_0x48eec3['id']));_0x3e207c();});default:logger[_0xb457('0xc')](util[_0xb457('0x12')](_0xb457('0x37'),_0x48eec3['id']));break;}}else{return BPromise['resolve']()[_0xb457('0x11')](function(){if(!_0x48eec3['tempSentiment']){throw new db[(_0xb457('0x22'))]['ValidationError'](_0xb457('0x38'));}if(!_0x595609[_0xb457('0x24')]||!_0x595609[_0xb457('0x25')]||!_0x595609[_0xb457('0x26')]||!_0x595609[_0xb457('0x27')]||!_0x595609[_0xb457('0x28')]){throw new db[(_0xb457('0x22'))][(_0xb457('0x23'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x48eec3['fileText']){throw new Error(_0xb457('0x29'));}if(_0x595609[_0xb457('0x25')]===_0x1c9f97['id']){return _0x1c9f97;}else{return db[_0xb457('0x2a')][_0xb457('0x2b')]({'where':{'id':_settings[_0xb457('0x25')]}});}})[_0xb457('0x11')](function(_0x3ee398){if(!_0x3ee398){throw new db[(_0xb457('0x22'))]['ValidationError'](_0xb457('0x2c'));}if(!_0x3ee398['data1']||!_0x3ee398[_0xb457('0xf')]){throw new db[(_0xb457('0x22'))][(_0xb457('0x23'))](_0xb457('0x2d'));}_0x992b23=_0x3ee398;logger['info'](util[_0xb457('0x12')](_0xb457('0x2e'),_0x48eec3['id']));return sentiment(_0x992b23['data1'],_0x992b23['data2'],_0x595609[_0xb457('0x26')],_0x48eec3[_0xb457('0x1d')],_0x595609['language']);})[_0xb457('0x11')](function(_0x26424){logger[_0xb457('0xc')](util[_0xb457('0x12')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x48eec3['id']));return _0x48eec3[_0xb457('0x20')]({'sentiment':_0x26424[_0xb457('0x39')],'sPositive':_0x26424[_0xb457('0x32')]['Positive'],'sNegative':_0x26424[_0xb457('0x32')][_0xb457('0x31')],'sMixed':_0x26424[_0xb457('0x32')][_0xb457('0x33')],'sNeutral':_0x26424['SentimentScore'][_0xb457('0x34')],'transcribeStatus':_0xb457('0x16')});})[_0xb457('0x11')](function(){logger['info'](util[_0xb457('0x12')](_0xb457('0x21'),_0x48eec3['id']));_0x3e207c();});}})[_0xb457('0x3a')](function(_0xc050ec){if(_0xc050ec){if(!_0xc050ec[_0xb457('0x3b')]||_0xc050ec[_0xb457('0x3b')]!==_0xb457('0x3c')){logger[_0xb457('0x3d')](util['format']('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x48eec3['id']),util[_0xb457('0x3e')](_0xc050ec,{'showHidden':![],'depth':null}));}}_0x3e207c();});});}function checkTranscribe(){var _0x2359e3;var _0x5ee561;var _0xaa7254;return db[_0xb457('0x3f')][_0xb457('0x40')]({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0xb457('0x11')](function(_0x40b496){if(!_0x40b496||!_0x40b496['length']){throw new db[(_0xb457('0x22'))][(_0xb457('0x23'))](_0xb457('0x41'));}_0x2359e3=_0x40b496;return db[_0xb457('0x42')][_0xb457('0x2b')]({'where':{'id':0x1}});})[_0xb457('0x11')](function(_0x132860){if(!_0x132860){throw new db[(_0xb457('0x22'))][(_0xb457('0x23'))](_0xb457('0x43'));}_0x5ee561=_0x132860;if(!_0x5ee561['transcribe']||!_0x5ee561[_0xb457('0x44')]||!_0x5ee561['transcribeRegion']||!_0x5ee561[_0xb457('0x27')]||!_0x5ee561['bucket']){throw new db['Sequelize'][(_0xb457('0x23'))](_0xb457('0x45'));}return db['CloudProvider'][_0xb457('0x2b')]({'where':{'id':_0x5ee561[_0xb457('0x44')]}});})[_0xb457('0x11')](function(_0x396109){if(!_0x396109){throw new db['Sequelize'][(_0xb457('0x23'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x396109[_0xb457('0xe')]||!_0x396109[_0xb457('0xf')]){throw new db['Sequelize'][(_0xb457('0x23'))](_0xb457('0x2d'));}_0xaa7254=_0x396109;var _0x26d97d=[];_0x2359e3[_0xb457('0x46')](function(_0x137ba4){_0x26d97d['push'](checkTranscribeJob(_0x137ba4,_0x5ee561,_0xaa7254));});return BPromise['all'](_0x26d97d);})['catch'](function(_0x8bcbd1){if(_0x8bcbd1){if(!_0x8bcbd1[_0xb457('0x3b')]||_0x8bcbd1[_0xb457('0x3b')]!==_0xb457('0x3c')){logger[_0xb457('0x3d')](util[_0xb457('0x3e')](_0x8bcbd1,{'showHidden':![],'depth':null}));}}});}exports[_0xb457('0x47')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x6f54=['detectSentiment','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','data2','transcribeRegion','transcribeName','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','fileText','length','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','sentimentAccountId','sentimentRegion','language','ValidationError','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','Sentiment','SentimentScore','Negative','Mixed','FAILED','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Sentiment\x20Analysis\x20not\x20requested','sentiment','Sentiment\x20Analysis\x20not\x20configured','Cloud\x20Provider\x20not\x20available','data1','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Positive','Neutral','name','SequelizeValidationError','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','Settings\x20not\x20available','transcribeAccountId','bucket','Transcribe\x20not\x20configured','forEach','push','all','error','start','lodash','aws-sdk','request-promise','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend'];(function(_0x57456c,_0x1681f7){var _0x245628=function(_0x2ede79){while(--_0x2ede79){_0x57456c['push'](_0x57456c['shift']());}};_0x245628(++_0x1681f7);}(_0x6f54,0xcf));var _0x46f5=function(_0x5a0a07,_0x30a997){_0x5a0a07=_0x5a0a07-0x0;var _0x3972c1=_0x6f54[_0x5a0a07];return _0x3972c1;};var _=require(_0x46f5('0x0'));var AWS=require(_0x46f5('0x1'));var rp=require(_0x46f5('0x2'));var util=require('util');var BPromise=require('bluebird');var db=require(_0x46f5('0x3'))['db'];var logger=require(_0x46f5('0x4'))(_0x46f5('0x5'));function getTranscriptionJob(_0x1271fc,_0x4d97ff,_0x441c49,_0x5730ae){return new Promise(function(_0x479d56,_0x21c3d2){var _0x576e52=new AWS[(_0x46f5('0x6'))]({'accessKeyId':_0x4d97ff,'secretAccessKey':_0x1271fc,'region':_0x441c49});_0x576e52[_0x46f5('0x7')]({'TranscriptionJobName':_0x5730ae},function(_0x227a68,_0x3a2939){if(_0x227a68){return _0x21c3d2(_0x227a68);}else{return _0x479d56(_0x3a2939);}});});}function sentiment(_0x2664f7,_0xa5470c,_0x927efa,_0x22fe4e,_0x1a6660){return new Promise(function(_0x356a21,_0x359b6e){var _0x18fdc3=new AWS[(_0x46f5('0x8'))]({'accessKeyId':_0xa5470c,'secretAccessKey':_0x2664f7,'region':_0x927efa});_0x18fdc3[_0x46f5('0x9')]({'Text':_0x22fe4e,'LanguageCode':_0x1a6660['substring'](0x0,0x2)},function(_0x3a3810,_0xf47c08){if(_0x3a3810){return _0x359b6e(_0x3a3810);}else{return _0x356a21(_0xf47c08);}});});}function checkTranscribeJob(_0x135792,_0x5c6df5,_0x138e02){var _0x9741d5;return new BPromise(function(_0x48783a,_0x19d77d){logger[_0x46f5('0xa')](util[_0x46f5('0xb')](_0x46f5('0xc'),_0x135792['id'],_0x135792['transcribeName']));return getTranscriptionJob(_0x138e02['data1'],_0x138e02[_0x46f5('0xd')],_0x5c6df5[_0x46f5('0xe')],_0x135792[_0x46f5('0xf')])[_0x46f5('0x10')](function(_0x3960e6){logger[_0x46f5('0xa')](util[_0x46f5('0xb')](_0x46f5('0x11'),_0x135792['id'],_0x135792[_0x46f5('0xf')],_0x3960e6[_0x46f5('0x12')][_0x46f5('0x13')]));if(!_0x135792['fileText']){switch(_0x3960e6[_0x46f5('0x12')][_0x46f5('0x13')]){case _0x46f5('0x14'):var _0x9f9165={'transcribeStatus':_0x3960e6['TranscriptionJob'][_0x46f5('0x13')],'fileUri':_0x3960e6[_0x46f5('0x12')][_0x46f5('0x15')][_0x46f5('0x16')]};logger[_0x46f5('0xa')](util[_0x46f5('0xb')]('[RECORDING:%d]\x20Get\x20transcript',_0x135792['id']));return rp({'uri':_0x3960e6[_0x46f5('0x12')][_0x46f5('0x15')][_0x46f5('0x16')],'json':!![]})[_0x46f5('0x10')](function(_0x49556c){logger['info'](util[_0x46f5('0xb')](_0x46f5('0x17'),_0x135792['id']));if(_0x49556c&&_0x49556c[_0x46f5('0x18')]&&_0x49556c[_0x46f5('0x18')]['transcripts']&&_0x49556c['results'][_0x46f5('0x19')]['length']){_0x9f9165[_0x46f5('0x1a')]='';for(var _0xc096c6=0x0;_0xc096c6<_0x49556c['results'][_0x46f5('0x19')][_0x46f5('0x1b')];_0xc096c6++){_0x9f9165[_0x46f5('0x1a')]+=_0x49556c[_0x46f5('0x18')]['transcripts'][_0xc096c6]['transcript']+'';}}return _0x135792[_0x46f5('0x1c')](_0x9f9165);})[_0x46f5('0x10')](function(){logger['info'](util['format'](_0x46f5('0x1d'),_0x135792['id']));if(!_0x135792[_0x46f5('0x1e')]){throw new db[(_0x46f5('0x1f'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x5c6df5['sentiment']||!_0x5c6df5[_0x46f5('0x20')]||!_0x5c6df5[_0x46f5('0x21')]||!_0x5c6df5[_0x46f5('0x22')]||!_0x5c6df5['bucket']){throw new db[(_0x46f5('0x1f'))][(_0x46f5('0x23'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x9f9165['fileText']){throw new Error(_0x46f5('0x24'));}if(_0x5c6df5[_0x46f5('0x20')]===_0x138e02['id']){return _0x138e02;}else{return db[_0x46f5('0x25')][_0x46f5('0x26')]({'where':{'id':_settings[_0x46f5('0x20')]}});}})['then'](function(_0x58abee){if(!_0x58abee){throw new db[(_0x46f5('0x1f'))][(_0x46f5('0x23'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x58abee['data1']||!_0x58abee['data2']){throw new db[(_0x46f5('0x1f'))][(_0x46f5('0x23'))](_0x46f5('0x27'));}_0x9741d5=_0x58abee;logger['info'](util[_0x46f5('0xb')](_0x46f5('0x28'),_0x135792['id']));return sentiment(_0x9741d5['data1'],_0x9741d5[_0x46f5('0xd')],_0x5c6df5[_0x46f5('0x21')],_0x9f9165[_0x46f5('0x1a')],_0x5c6df5[_0x46f5('0x22')]);})['then'](function(_0x463ae9){logger['info'](util[_0x46f5('0xb')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x135792['id']));return _0x135792[_0x46f5('0x1c')]({'sentiment':_0x463ae9[_0x46f5('0x29')],'sPositive':_0x463ae9[_0x46f5('0x2a')]['Positive'],'sNegative':_0x463ae9[_0x46f5('0x2a')][_0x46f5('0x2b')],'sMixed':_0x463ae9[_0x46f5('0x2a')][_0x46f5('0x2c')],'sNeutral':_0x463ae9[_0x46f5('0x2a')]['Neutral']});})[_0x46f5('0x10')](function(){logger[_0x46f5('0xa')](util[_0x46f5('0xb')](_0x46f5('0x1d'),_0x135792['id']));_0x48783a();});case'FAILED':return _0x135792[_0x46f5('0x1c')]({'transcribeStatus':_0x46f5('0x2d'),'failureReason':_0x3960e6[_0x46f5('0x12')]['FailureReason']})[_0x46f5('0x10')](function(){logger[_0x46f5('0xa')](util[_0x46f5('0xb')](_0x46f5('0x1d'),_0x135792['id']));_0x48783a();});default:logger[_0x46f5('0xa')](util['format'](_0x46f5('0x2e'),_0x135792['id']));break;}}else{return BPromise[_0x46f5('0x2f')]()[_0x46f5('0x10')](function(){if(!_0x135792[_0x46f5('0x1e')]){throw new db[(_0x46f5('0x1f'))][(_0x46f5('0x23'))](_0x46f5('0x30'));}if(!_0x5c6df5[_0x46f5('0x31')]||!_0x5c6df5['sentimentAccountId']||!_0x5c6df5[_0x46f5('0x21')]||!_0x5c6df5[_0x46f5('0x22')]||!_0x5c6df5['bucket']){throw new db[(_0x46f5('0x1f'))][(_0x46f5('0x23'))](_0x46f5('0x32'));}if(!_0x135792[_0x46f5('0x1a')]){throw new Error(_0x46f5('0x24'));}if(_0x5c6df5[_0x46f5('0x20')]===_0x138e02['id']){return _0x138e02;}else{return db['CloudProvider'][_0x46f5('0x26')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0x46f5('0x10')](function(_0x55842a){if(!_0x55842a){throw new db[(_0x46f5('0x1f'))][(_0x46f5('0x23'))](_0x46f5('0x33'));}if(!_0x55842a[_0x46f5('0x34')]||!_0x55842a['data2']){throw new db[(_0x46f5('0x1f'))][(_0x46f5('0x23'))](_0x46f5('0x27'));}_0x9741d5=_0x55842a;logger[_0x46f5('0xa')](util[_0x46f5('0xb')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x135792['id']));return sentiment(_0x9741d5[_0x46f5('0x34')],_0x9741d5[_0x46f5('0xd')],_0x5c6df5[_0x46f5('0x21')],_0x135792['fileText'],_0x5c6df5['language']);})['then'](function(_0x33b95b){logger[_0x46f5('0xa')](util[_0x46f5('0xb')](_0x46f5('0x35'),_0x135792['id']));return _0x135792[_0x46f5('0x1c')]({'sentiment':_0x33b95b[_0x46f5('0x29')],'sPositive':_0x33b95b[_0x46f5('0x2a')][_0x46f5('0x36')],'sNegative':_0x33b95b[_0x46f5('0x2a')][_0x46f5('0x2b')],'sMixed':_0x33b95b['SentimentScore'][_0x46f5('0x2c')],'sNeutral':_0x33b95b['SentimentScore'][_0x46f5('0x37')],'transcribeStatus':'COMPLETED'});})['then'](function(){logger[_0x46f5('0xa')](util[_0x46f5('0xb')](_0x46f5('0x1d'),_0x135792['id']));_0x48783a();});}})['catch'](function(_0x3cac8d){if(_0x3cac8d){if(!_0x3cac8d[_0x46f5('0x38')]||_0x3cac8d[_0x46f5('0x38')]!==_0x46f5('0x39')){logger['error'](util[_0x46f5('0xb')](_0x46f5('0x3a'),_0x135792['id']),util[_0x46f5('0x3b')](_0x3cac8d,{'showHidden':![],'depth':null}));}}_0x48783a();});});}function checkTranscribe(){var _0x5ebb6d;var _0x3e87ca;var _0x236409;return db[_0x46f5('0x3c')][_0x46f5('0x3d')]({'where':{'transcribeStatus':_0x46f5('0x3e')}})[_0x46f5('0x10')](function(_0x11903a){if(!_0x11903a||!_0x11903a[_0x46f5('0x1b')]){throw new db[(_0x46f5('0x1f'))][(_0x46f5('0x23'))]('No\x20transcribe\x20job\x20to\x20check');}_0x5ebb6d=_0x11903a;return db['Setting'][_0x46f5('0x26')]({'where':{'id':0x1}});})['then'](function(_0xbd2189){if(!_0xbd2189){throw new db[(_0x46f5('0x1f'))]['ValidationError'](_0x46f5('0x3f'));}_0x3e87ca=_0xbd2189;if(!_0x3e87ca[_0x46f5('0x5')]||!_0x3e87ca[_0x46f5('0x40')]||!_0x3e87ca[_0x46f5('0xe')]||!_0x3e87ca[_0x46f5('0x22')]||!_0x3e87ca[_0x46f5('0x41')]){throw new db['Sequelize'][(_0x46f5('0x23'))](_0x46f5('0x42'));}return db[_0x46f5('0x25')][_0x46f5('0x26')]({'where':{'id':_0x3e87ca[_0x46f5('0x40')]}});})[_0x46f5('0x10')](function(_0x5e26c6){if(!_0x5e26c6){throw new db['Sequelize'][(_0x46f5('0x23'))](_0x46f5('0x33'));}if(!_0x5e26c6[_0x46f5('0x34')]||!_0x5e26c6['data2']){throw new db['Sequelize'][(_0x46f5('0x23'))]('Cloud\x20Provider\x20not\x20configured');}_0x236409=_0x5e26c6;var _0x376006=[];_0x5ebb6d[_0x46f5('0x43')](function(_0x3fb78e){_0x376006[_0x46f5('0x44')](checkTranscribeJob(_0x3fb78e,_0x3e87ca,_0x236409));});return BPromise[_0x46f5('0x45')](_0x376006);})['catch'](function(_0x13c126){if(_0x13c126){if(!_0x13c126[_0x46f5('0x38')]||_0x13c126['name']!==_0x46f5('0x39')){logger[_0x46f5('0x46')](util[_0x46f5('0x3b')](_0x13c126,{'showHidden':![],'depth':null}));}}});}exports[_0x46f5('0x47')]=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 7983ac8..3277568 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 _0xb02d=['subtract','hours','then','length','map','info','join','update','system','format','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','moment','ioredis','util','../logger','redis','defaults','findAll','lastMsgAt'];(function(_0x476bf4,_0x2a3755){var _0x788ffe=function(_0x13fa11){while(--_0x13fa11){_0x476bf4['push'](_0x476bf4['shift']());}};_0x788ffe(++_0x2a3755);}(_0xb02d,0x188));var _0xdb02=function(_0x1cd662,_0x4a48ab){_0x1cd662=_0x1cd662-0x0;var _0x454ff9=_0xb02d[_0x1cd662];return _0x454ff9;};'use strict';var _=require('lodash');var moment=require(_0xdb02('0x0'));var Redis=require(_0xdb02('0x1'));var util=require(_0xdb02('0x2'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var logger=require(_0xdb02('0x3'))('schedule');config[_0xdb02('0x4')]=_[_0xdb02('0x5')](config[_0xdb02('0x4')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function closeInteractions(){var _0x3e6fcb=[];return db['WhatsappInteraction'][_0xdb02('0x6')]({'raw':!![],'attributes':['id',_0xdb02('0x7')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xdb02('0x8')](0x18,_0xdb02('0x9'))}}})[_0xdb02('0xa')](function(_0x596157){if(_0x596157&&_0x596157[_0xdb02('0xb')]){_0x3e6fcb=_[_0xdb02('0xc')](_0x596157||[],'id');logger[_0xdb02('0xd')]('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x3e6fcb[_0xdb02('0xe')]());return db['WhatsappInteraction'][_0xdb02('0xf')]({'closeReason':_0xdb02('0x10'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0xdb02('0x11')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x3e6fcb}});}})[_0xdb02('0xa')](function(){if(_0x3e6fcb&&_0x3e6fcb[_0xdb02('0xb')]){logger['info'](_0xdb02('0x12'),_0x3e6fcb[_0xdb02('0xe')]());for(var _0x3f7c33=0x0;_0x3f7c33<_0x3e6fcb[_0xdb02('0xb')];_0x3f7c33++){io[_0xdb02('0x13')](_0xdb02('0x14'),{'id':_0x3e6fcb[_0x3f7c33],'closed':!![]});}}})[_0xdb02('0x15')](function(_0xced80d){logger['error'](_0xdb02('0x16'),_0xced80d?util[_0xdb02('0x17')](_0xced80d,{'showHidden':![],'depth':null}):'');});}exports[_0xdb02('0x18')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x8073=['socket.io-emitter','WhatsappInteraction','lastMsgAt','subtract','length','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','then','info','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','error','inspect','start','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost'];(function(_0x2499e4,_0x3de805){var _0x117243=function(_0x5d6c1a){while(--_0x5d6c1a){_0x2499e4['push'](_0x2499e4['shift']());}};_0x117243(++_0x3de805);}(_0x8073,0x68));var _0x3807=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x8073[_0x1035c1];return _0x308d67;};'use strict';var _=require('lodash');var moment=require('moment');var Redis=require('ioredis');var util=require(_0x3807('0x0'));var config=require(_0x3807('0x1'));var db=require(_0x3807('0x2'))['db'];var logger=require(_0x3807('0x3'))(_0x3807('0x4'));config[_0x3807('0x5')]=_[_0x3807('0x6')](config[_0x3807('0x5')],{'host':_0x3807('0x7'),'port':0x18eb});var io=require(_0x3807('0x8'))(new Redis(config[_0x3807('0x5')]));function closeInteractions(){var _0x21498c=[];return db[_0x3807('0x9')]['findAll']({'raw':!![],'attributes':['id',_0x3807('0xa')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x3807('0xb')](0x18,'hours')}}})['then'](function(_0xa5a630){if(_0xa5a630&&_0xa5a630[_0x3807('0xc')]){_0x21498c=_['map'](_0xa5a630||[],'id');logger['info'](_0x3807('0xd'),_0x21498c[_0x3807('0xe')]());return db['WhatsappInteraction'][_0x3807('0xf')]({'closeReason':_0x3807('0x10'),'disposition':_0x3807('0x11'),'closed':!![],'closedAt':moment()[_0x3807('0x12')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x21498c}});}})[_0x3807('0x13')](function(){if(_0x21498c&&_0x21498c[_0x3807('0xc')]){logger[_0x3807('0x14')](_0x3807('0x15'),_0x21498c[_0x3807('0xe')]());for(var _0x1f3c90=0x0;_0x1f3c90<_0x21498c[_0x3807('0xc')];_0x1f3c90++){io[_0x3807('0x16')](_0x3807('0x17'),{'id':_0x21498c[_0x1f3c90],'closed':!![]});}}})[_0x3807('0x18')](function(_0xcfdf26){logger[_0x3807('0x19')]('[WHATSAPP]\x20Error\x20closing\x20interactions',_0xcfdf26?util[_0x3807('0x1a')](_0xcfdf26,{'showHidden':![],'depth':null}):'');});}exports[_0x3807('0x1b')]=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 979d8f8..2d5de11 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xee1d=['bulkCreate','log','finished\x20populating','CmHopper','hopper1','hopper2','catch','util','../mysqldb','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','destroy','then','CmContact'];(function(_0x446cdc,_0x2a002c){var _0x8a5794=function(_0x3cf931){while(--_0x3cf931){_0x446cdc['push'](_0x446cdc['shift']());}};_0x8a5794(++_0x2a002c);}(_0xee1d,0xa9));var _0xdee1=function(_0x516848,_0xc901d6){_0x516848=_0x516848-0x0;var _0x1a4dbf=_0xee1d[_0x516848];return _0x1a4dbf;};'use strict';var util=require(_0xdee1('0x0'));var db=require(_0xdee1('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xdee1('0x2')]({'id':i,'firstName':_0xdee1('0x3')+i,'lastName':_0xdee1('0x4')+i,'phone':0xf879fb460+i,'email':_0xdee1('0x5')+i+_0xdee1('0x6')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date[_0xdee1('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xdee1('0x7')](),'updatedAt':Date[_0xdee1('0x7')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xdee1('0x2')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0xdee1('0x4')+i,'phone':0xf879fb460+i,'email':_0xdee1('0x5')+i+_0xdee1('0x6')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xdee1('0x2')]({'id':i,'active':![],'scheduledat':Date[_0xdee1('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0xdee1('0x7')]()});}db['CmContact'][_0xdee1('0x8')]({'where':{}})[_0xdee1('0x9')](function(){return db[_0xdee1('0xa')][_0xdee1('0xb')](contacts);})[_0xdee1('0x9')](function(){console[_0xdee1('0xc')](_0xdee1('0xd'),'contacts1');return db[_0xdee1('0xe')]['destroy']({'where':{}});})[_0xdee1('0x9')](function(){return db[_0xdee1('0xe')][_0xdee1('0xb')](hopper);})[_0xdee1('0x9')](function(){console['log'](_0xdee1('0xd'),_0xdee1('0xf'));return db[_0xdee1('0xa')][_0xdee1('0xb')](contacts2);})[_0xdee1('0x9')](function(){console[_0xdee1('0xc')](_0xdee1('0xd'),'contacts2');return db['CmHopper'][_0xdee1('0xb')](hopper2);})[_0xdee1('0x9')](function(){console[_0xdee1('0xc')](_0xdee1('0xd'),_0xdee1('0x10'));})[_0xdee1('0x11')](function(_0x77b224){console[_0xdee1('0xc')](_0x77b224);}); \ No newline at end of file +var _0xf20b=['util','../mysqldb','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','push','now','destroy','then','CmContact','bulkCreate','log','finished\x20populating','contacts1','CmHopper','hopper1','contacts2','hopper2','catch'];(function(_0x394798,_0x14af05){var _0x80638c=function(_0x3321cb){while(--_0x3321cb){_0x394798['push'](_0x394798['shift']());}};_0x80638c(++_0x14af05);}(_0xf20b,0x154));var _0xbf20=function(_0x4043cd,_0x2c2e8c){_0x4043cd=_0x4043cd-0x0;var _0x156966=_0xf20b[_0x4043cd];return _0x156966;};'use strict';var util=require(_0xbf20('0x0'));var db=require(_0xbf20('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0xbf20('0x2')+i,'lastName':_0xbf20('0x3')+i,'phone':0xf879fb460+i,'email':_0xbf20('0x4')+i+_0xbf20('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xbf20('0x6')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xbf20('0x7')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0xbf20('0x2')+i,'lastName':_0xbf20('0x3')+i,'phone':0xf879fb460+i,'email':_0xbf20('0x4')+i+_0xbf20('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xbf20('0x7')](),'updatedAt':Date[_0xbf20('0x7')]()});}db['CmContact'][_0xbf20('0x8')]({'where':{}})[_0xbf20('0x9')](function(){return db[_0xbf20('0xa')][_0xbf20('0xb')](contacts);})[_0xbf20('0x9')](function(){console[_0xbf20('0xc')](_0xbf20('0xd'),_0xbf20('0xe'));return db['CmHopper'][_0xbf20('0x8')]({'where':{}});})['then'](function(){return db[_0xbf20('0xf')][_0xbf20('0xb')](hopper);})['then'](function(){console[_0xbf20('0xc')](_0xbf20('0xd'),_0xbf20('0x10'));return db['CmContact']['bulkCreate'](contacts2);})[_0xbf20('0x9')](function(){console[_0xbf20('0xc')]('finished\x20populating',_0xbf20('0x11'));return db[_0xbf20('0xf')][_0xbf20('0xb')](hopper2);})[_0xbf20('0x9')](function(){console[_0xbf20('0xc')](_0xbf20('0xd'),_0xbf20('0x12'));})[_0xbf20('0x13')](function(_0x1218dd){console[_0xbf20('0xc')](_0x1218dd);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index c7c981f..721b518 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xba3a=['yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then','log','add\x20user','catch','push','format','%s%s','%s%s@xcally.com','agent','udp'];(function(_0x2b3c76,_0x56d99a){var _0x108e68=function(_0x49d7b2){while(--_0x49d7b2){_0x2b3c76['push'](_0x2b3c76['shift']());}};_0x108e68(++_0x56d99a);}(_0xba3a,0xa4));var _0xaba3=function(_0x36d14b,_0x1ba5eb){_0x36d14b=_0x36d14b-0x0;var _0x4be643=_0xba3a[_0x36d14b];return _0x4be643;};'use strict';var util=require('util');var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xaba3('0x0')]({'name':util[_0xaba3('0x1')](_0xaba3('0x2'),'agent',i),'fullname':util[_0xaba3('0x1')]('%s%s','agent',i),'email':util[_0xaba3('0x1')](_0xaba3('0x3'),_0xaba3('0x4'),i),'role':_0xaba3('0x4'),'password':'password','internal':0xfa0+i,'type':'friend','transport':[_0xaba3('0x5'),'ws','wss'],'disallow':['all'],'allow':['ulaw'],'defaultuser':util[_0xaba3('0x1')](_0xaba3('0x2'),_0xaba3('0x4'),i),'encryption':_0xaba3('0x6'),'avpf':'yes','force_avp':_0xaba3('0x6'),'icesupport':'yes','dtlsenable':'yes','dtlsverify':'no','dtlscertfile':_0xaba3('0x7'),'dtlsprivatekey':_0xaba3('0x8'),'dtlssetup':_0xaba3('0x9'),'callerid':util[_0xaba3('0x1')](_0xaba3('0xa'),util[_0xaba3('0x1')]('%s%s',_0xaba3('0x4'),i),0xfa0+i)});}db[_0xaba3('0xb')][_0xaba3('0xc')](users)[_0xaba3('0xd')](function(){console[_0xaba3('0xe')](_0xaba3('0xf'));})[_0xaba3('0x10')](function(_0x4b1c8d){console[_0xaba3('0xe')](_0x4b1c8d);}); \ No newline at end of file +var _0x3b44=['%s%s@xcally.com','password','udp','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','then','log','add\x20user','catch','util','push','format','%s%s','agent'];(function(_0x4f498e,_0x1fab4f){var _0x1f49e6=function(_0x5890c4){while(--_0x5890c4){_0x4f498e['push'](_0x4f498e['shift']());}};_0x1f49e6(++_0x1fab4f);}(_0x3b44,0x177));var _0x43b4=function(_0x1f0e9d,_0x47c5e7){_0x1f0e9d=_0x1f0e9d-0x0;var _0x7d33b8=_0x3b44[_0x1f0e9d];return _0x7d33b8;};'use strict';var util=require(_0x43b4('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x43b4('0x1')]({'name':util[_0x43b4('0x2')](_0x43b4('0x3'),_0x43b4('0x4'),i),'fullname':util[_0x43b4('0x2')](_0x43b4('0x3'),_0x43b4('0x4'),i),'email':util[_0x43b4('0x2')](_0x43b4('0x5'),_0x43b4('0x4'),i),'role':'agent','password':_0x43b4('0x6'),'internal':0xfa0+i,'type':'friend','transport':[_0x43b4('0x7'),'ws','wss'],'disallow':[_0x43b4('0x8')],'allow':[_0x43b4('0x9')],'defaultuser':util[_0x43b4('0x2')](_0x43b4('0x3'),'agent',i),'encryption':_0x43b4('0xa'),'avpf':_0x43b4('0xa'),'force_avp':_0x43b4('0xa'),'icesupport':_0x43b4('0xa'),'dtlsenable':_0x43b4('0xa'),'dtlsverify':'no','dtlscertfile':_0x43b4('0xb'),'dtlsprivatekey':_0x43b4('0xc'),'dtlssetup':_0x43b4('0xd'),'callerid':util[_0x43b4('0x2')](_0x43b4('0xe'),util[_0x43b4('0x2')]('%s%s',_0x43b4('0x4'),i),0xfa0+i)});}db[_0x43b4('0xf')]['bulkCreate'](users)[_0x43b4('0x10')](function(){console[_0x43b4('0x11')](_0x43b4('0x12'));})[_0x43b4('0x13')](function(_0x408f99){console[_0x43b4('0x11')](_0x408f99);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 58885af..24d4e8a 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x292c=['SocketIO\x20','nsp','disconnect','CONNECTED','lodash','bluebird','../mysqldb','./environment','name','Agents','telephone','agent','type','ivr','UserProfileSection','findOne','then','autoAssociation','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','Telephones','findAll','Trunks','IvrCampaigns','resourceId','where','role','%s:queue:%s','length','format','user:%s','handshake','query','User','ChatInteraction','FaxInteraction','FaxInteractions','SmsInteractions','OpenchannelInteractions','WhatsappInteraction','admin','voice:inbound','voice:outbound','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','MailQueue','WhatsappQueue','Trunk','Campaign','VoiceQueues','userProfileId','OpenchannelQueue','getChatQueues','getFaxQueues','getSmsQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','fax','sms','mail','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','ChatInteractions','emit','user_has_chat_interactions:remove','MailInteractions','removeMailInteractions','user_has_mail_interactions:remove','map','removeFaxInteractions','user_has_fax_interactions:remove','user_has_sms_interactions:remove','user_has_openchannel_interactions:remove','WhatsappInteractions','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','connection','setMaxListeners','address','request','remoteAddress','remotePort'];(function(_0x1b6563,_0x3bf0f1){var _0xdea7b8=function(_0x49e6c6){while(--_0x49e6c6){_0x1b6563['push'](_0x1b6563['shift']());}};_0xdea7b8(++_0x3bf0f1);}(_0x292c,0x66));var _0xc292=function(_0x99868f,_0xbdb8e7){_0x99868f=_0x99868f-0x0;var _0x27a71b=_0x292c[_0x99868f];return _0x27a71b;};'use strict';var _=require(_0xc292('0x0'));var util=require('util');var BPromise=require(_0xc292('0x1'));var db=require(_0xc292('0x2'))['db'];var config=require(_0xc292('0x3'));var queryQueues={'attributes':['id',_0xc292('0x4')],'include':[{'as':_0xc292('0x5'),'model':db['User'],'attributes':['id',_0xc292('0x4'),'role'],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xc292('0x4')],'where':{'role':_0xc292('0x6')}};var queryTrunks={'raw':!![],'attributes':['id',_0xc292('0x4')]};var queryAgents={'raw':!![],'attributes':['id',_0xc292('0x4')],'where':{'role':_0xc292('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xc292('0x4'),_0xc292('0x8')],'where':{'type':_0xc292('0x9')}};function getAssociatedResources(_0x162e17,_0x43fd69,_0x5a548a){return db[_0xc292('0xa')][_0xc292('0xb')]({'where':{'name':_0x162e17,'userProfileId':_0x43fd69},'raw':!![]})[_0xc292('0xc')](function(_0x25d1f0){if(_0x25d1f0){if(_0x25d1f0[_0xc292('0xd')]){switch(_0x162e17){case'VoiceQueues':case _0xc292('0xe'):case _0xc292('0xf'):case _0xc292('0x10'):case _0xc292('0x11'):case _0xc292('0x12'):case _0xc292('0x13'):return db[_0x5a548a]['findAll'](queryQueues);case _0xc292('0x14'):return db[_0x5a548a][_0xc292('0x15')](queryTelephones);case _0xc292('0x16'):return db[_0x5a548a][_0xc292('0x15')](queryTrunks);case _0xc292('0x17'):return db[_0x5a548a]['findAll'](queryCampaigns);}}else{return db['UserProfileResource'][_0xc292('0x15')]({'attributes':[_0xc292('0x18')],'where':{'sectionId':_0x25d1f0['id']},'raw':!![]})['then'](function(_0x290138){if(_0x290138){var _0x53a23e={'where':{'id':_['map'](_0x290138,_0xc292('0x18'))},'raw':!![]};switch(_0x5a548a){case'User':_0x53a23e[_0xc292('0x19')][_0xc292('0x1a')]=_0xc292('0x6');break;case'Campaign':_0x53a23e[_0xc292('0x19')]['type']='ivr';break;}return db[_0x5a548a][_0xc292('0x15')](_0x53a23e);}else{return[];}});}}else{return[];}})[_0xc292('0xc')](function(_0x5808f1){return _0x5808f1;});}function joinOrLeaveQueues(_0x2a74af,_0xaee8d7,_0x314f3b,_0x5a9873){_0x2a74af[_0xaee8d7](util['format'](_0xc292('0x1b'),_0x314f3b,_0x5a9873[_0xc292('0x4')]));if(_0x5a9873[_0xc292('0x5')]){for(var _0x2493ac=0x0;_0x2493ac<_0x5a9873[_0xc292('0x5')][_0xc292('0x1c')];_0x2493ac+=0x1){_0x2a74af[_0xaee8d7](util[_0xc292('0x1d')](_0xc292('0x1e'),_0x5a9873[_0xc292('0x5')][_0x2493ac]['name']));}}}function joinOrLeave(_0x5b3562,_0x2a1750,_0x3aa05b){var _0x4ba9e3;if(_0x5b3562[_0xc292('0x1f')][_0xc292('0x20')]['id']){db[_0xc292('0x21')]['find']({'attributes':['id',_0xc292('0x4'),_0xc292('0x1a'),'userProfileId'],'where':{'id':_0x5b3562['handshake'][_0xc292('0x20')]['id']},'include':[{'model':db[_0xc292('0x22')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xc292('0x23')],'as':_0xc292('0x24'),'attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':_0xc292('0x25'),'attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':_0xc292('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0xc292('0x27')],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})['then'](function(_0x23cb2c){if(_0x23cb2c){_0x4ba9e3=_0x23cb2c;_0x5b3562[_0x2a1750](util[_0xc292('0x1d')]('user:%s',_0x23cb2c['name']));var _0x939e19=[];switch(_0x23cb2c['role']){case _0xc292('0x28'):_0x5b3562[_0x2a1750](_0xc292('0x29'));_0x5b3562[_0x2a1750](_0xc292('0x2a'));if(queryQueues['hasOwnProperty'](_0xc292('0x2b'))){delete queryQueues[_0xc292('0x2b')];}_0x939e19[_0xc292('0x2c')](db[_0xc292('0x2d')][_0xc292('0x15')](queryQueues));_0x939e19['push'](db[_0xc292('0x2e')][_0xc292('0x15')](queryQueues));_0x939e19[_0xc292('0x2c')](db[_0xc292('0x2f')]['findAll'](queryQueues));_0x939e19['push'](db[_0xc292('0x30')][_0xc292('0x15')](queryQueues));_0x939e19[_0xc292('0x2c')](db[_0xc292('0x31')][_0xc292('0x15')](queryQueues));_0x939e19[_0xc292('0x2c')](db['OpenchannelQueue']['findAll'](queryQueues));_0x939e19[_0xc292('0x2c')](db[_0xc292('0x32')]['findAll'](queryQueues));_0x939e19[_0xc292('0x2c')](db[_0xc292('0x21')][_0xc292('0x15')](queryTelephones));_0x939e19[_0xc292('0x2c')](db[_0xc292('0x33')]['findAll'](queryTrunks));_0x939e19[_0xc292('0x2c')](db[_0xc292('0x34')][_0xc292('0x15')](queryCampaigns));_0x939e19[_0xc292('0x2c')](db[_0xc292('0x21')][_0xc292('0x15')](queryAgents));break;case'user':_0x5b3562[_0x2a1750](_0xc292('0x29'));_0x5b3562[_0x2a1750](_0xc292('0x2a'));_0x939e19[_0xc292('0x2c')](getAssociatedResources(_0xc292('0x35'),_0x23cb2c[_0xc292('0x36')],'VoiceQueue'));_0x939e19[_0xc292('0x2c')](getAssociatedResources(_0xc292('0xe'),_0x23cb2c[_0xc292('0x36')],_0xc292('0x2e')));_0x939e19[_0xc292('0x2c')](getAssociatedResources('FaxQueues',_0x23cb2c['userProfileId'],_0xc292('0x2f')));_0x939e19[_0xc292('0x2c')](getAssociatedResources('SmsQueues',_0x23cb2c[_0xc292('0x36')],_0xc292('0x30')));_0x939e19['push'](getAssociatedResources(_0xc292('0x11'),_0x23cb2c[_0xc292('0x36')],'MailQueue'));_0x939e19[_0xc292('0x2c')](getAssociatedResources(_0xc292('0x12'),_0x23cb2c[_0xc292('0x36')],_0xc292('0x37')));_0x939e19[_0xc292('0x2c')](getAssociatedResources(_0xc292('0x13'),_0x23cb2c['userProfileId'],_0xc292('0x32')));_0x939e19[_0xc292('0x2c')](getAssociatedResources(_0xc292('0x14'),_0x23cb2c['userProfileId'],_0xc292('0x21')));_0x939e19['push'](getAssociatedResources('Trunks',_0x23cb2c[_0xc292('0x36')],_0xc292('0x33')));_0x939e19[_0xc292('0x2c')](getAssociatedResources('IvrCampaigns',_0x23cb2c[_0xc292('0x36')],'Campaign'));_0x939e19[_0xc292('0x2c')](db[_0xc292('0x21')][_0xc292('0x15')](queryAgents));break;case'agent':_0x5b3562[_0x2a1750]('voice:inbound');_0x5b3562[_0x2a1750](_0xc292('0x2a'));_0x939e19[_0xc292('0x2c')](_0x23cb2c['getVoiceQueues']({'attributes':['id','name']}));_0x939e19[_0xc292('0x2c')](_0x23cb2c[_0xc292('0x38')]({'attributes':['id',_0xc292('0x4')]}));_0x939e19['push'](_0x23cb2c[_0xc292('0x39')]({'attributes':['id','name']}));_0x939e19['push'](_0x23cb2c[_0xc292('0x3a')]({'attributes':['id','name']}));_0x939e19[_0xc292('0x2c')](_0x23cb2c['getMailQueues']({'attributes':['id',_0xc292('0x4')]}));_0x939e19[_0xc292('0x2c')](_0x23cb2c[_0xc292('0x3b')]({'attributes':['id',_0xc292('0x4')]}));_0x939e19[_0xc292('0x2c')](_0x23cb2c[_0xc292('0x3c')]({'attributes':['id','name']}));break;}return BPromise[_0xc292('0x3d')](_0x939e19);}})[_0xc292('0xc')](function(_0x48ab49){if(_0x48ab49&&_0x48ab49[_0xc292('0x1c')]){for(var _0x25711e=0x0;_0x25711e<_0x48ab49[_0xc292('0x1c')];_0x25711e+=0x1){for(var _0x721f32=0x0;_0x721f32<_0x48ab49[_0x25711e][_0xc292('0x1c')];_0x721f32+=0x1){switch(_0x25711e){case 0x0:joinOrLeaveQueues(_0x5b3562,_0x2a1750,_0xc292('0x3e'),_0x48ab49[_0x25711e][_0x721f32]);break;case 0x1:joinOrLeaveQueues(_0x5b3562,_0x2a1750,'chat',_0x48ab49[_0x25711e][_0x721f32]);break;case 0x2:joinOrLeaveQueues(_0x5b3562,_0x2a1750,_0xc292('0x3f'),_0x48ab49[_0x25711e][_0x721f32]);break;case 0x3:joinOrLeaveQueues(_0x5b3562,_0x2a1750,_0xc292('0x40'),_0x48ab49[_0x25711e][_0x721f32]);break;case 0x4:joinOrLeaveQueues(_0x5b3562,_0x2a1750,_0xc292('0x41'),_0x48ab49[_0x25711e][_0x721f32]);break;case 0x5:joinOrLeaveQueues(_0x5b3562,_0x2a1750,_0xc292('0x42'),_0x48ab49[_0x25711e][_0x721f32]);break;case 0x6:joinOrLeaveQueues(_0x5b3562,_0x2a1750,_0xc292('0x43'),_0x48ab49[_0x25711e][_0x721f32]);break;case 0x7:if(_0x4ba9e3[_0xc292('0x1a')]!==_0xc292('0x7'))_0x5b3562[_0x2a1750](util[_0xc292('0x1d')](_0xc292('0x44'),_0x48ab49[_0x25711e][_0x721f32][_0xc292('0x4')]));break;case 0x8:if(_0x4ba9e3[_0xc292('0x1a')]!==_0xc292('0x7'))_0x5b3562[_0x2a1750](util[_0xc292('0x1d')](_0xc292('0x45'),_0x48ab49[_0x25711e][_0x721f32][_0xc292('0x4')]));break;case 0x9:if(_0x4ba9e3[_0xc292('0x1a')]!=='agent')_0x5b3562[_0x2a1750](util[_0xc292('0x1d')](_0xc292('0x46'),_0x48ab49[_0x25711e][_0x721f32][_0xc292('0x8')],_0x48ab49[_0x25711e][_0x721f32][_0xc292('0x4')]));break;case 0xa:_0x5b3562[_0x2a1750](util['format'](_0xc292('0x1e'),_0x48ab49[_0x25711e][_0x721f32][_0xc292('0x4')]));break;}}}}})[_0xc292('0xc')](function(){if(_0x2a1750===_0xc292('0x47')){var _0x16e531=_['map'](_0x4ba9e3[_0xc292('0x48')],'id');return _0x4ba9e3['removeChatInteractions'](_0x16e531)[_0xc292('0xc')](function(){for(var _0x299546=0x0;_0x299546<_0x16e531[_0xc292('0x1c')];_0x299546+=0x1){_0x3aa05b[_0xc292('0x49')](_0xc292('0x4a'),{'ChatInteractionId':Number(_0x16e531[_0x299546]),'UserId':Number(_0x4ba9e3['id'])});}});}})[_0xc292('0xc')](function(){if(_0x2a1750==='leave'){var _0x71b80d=_['map'](_0x4ba9e3[_0xc292('0x4b')],'id');return _0x4ba9e3[_0xc292('0x4c')](_0x71b80d)[_0xc292('0xc')](function(){for(var _0x49ceaa=0x0;_0x49ceaa<_0x71b80d['length'];_0x49ceaa+=0x1){_0x3aa05b['emit'](_0xc292('0x4d'),{'MailInteractionId':Number(_0x71b80d[_0x49ceaa]),'UserId':Number(_0x4ba9e3['id'])});}});}})['then'](function(){if(_0x2a1750==='leave'){var _0x3e72dc=_[_0xc292('0x4e')](_0x4ba9e3['FaxInteractions'],'id');return _0x4ba9e3[_0xc292('0x4f')](_0x3e72dc)['then'](function(){for(var _0x9b4bff=0x0;_0x9b4bff<_0x3e72dc[_0xc292('0x1c')];_0x9b4bff+=0x1){_0x3aa05b[_0xc292('0x49')](_0xc292('0x50'),{'FaxInteractionId':Number(_0x3e72dc[_0x9b4bff]),'UserId':Number(_0x4ba9e3['id'])});}});}})[_0xc292('0xc')](function(){if(_0x2a1750==='leave'){var _0x550332=_['map'](_0x4ba9e3['SmsInteractions'],'id');return _0x4ba9e3['removeSmsInteractions'](_0x550332)[_0xc292('0xc')](function(){for(var _0x447360=0x0;_0x447360<_0x550332['length'];_0x447360+=0x1){_0x3aa05b[_0xc292('0x49')](_0xc292('0x51'),{'SmsInteractionId':Number(_0x550332[_0x447360]),'UserId':Number(_0x4ba9e3['id'])});}});}})[_0xc292('0xc')](function(){if(_0x2a1750===_0xc292('0x47')){var _0x11636f=_[_0xc292('0x4e')](_0x4ba9e3['OpenchannelInteractions'],'id');return _0x4ba9e3['removeOpenchannelInteractions'](_0x11636f)[_0xc292('0xc')](function(){for(var _0x28a798=0x0;_0x28a798<_0x11636f['length'];_0x28a798+=0x1){_0x3aa05b[_0xc292('0x49')](_0xc292('0x52'),{'OpenchannelInteractionId':Number(_0x11636f[_0x28a798]),'UserId':Number(_0x4ba9e3['id'])});}});}})[_0xc292('0xc')](function(){if(_0x2a1750===_0xc292('0x47')){var _0x1e73e5=_[_0xc292('0x4e')](_0x4ba9e3[_0xc292('0x53')],'id');return _0x4ba9e3[_0xc292('0x54')](_0x1e73e5)[_0xc292('0xc')](function(){for(var _0x58b87a=0x0;_0x58b87a<_0x1e73e5[_0xc292('0x1c')];_0x58b87a+=0x1){_0x3aa05b[_0xc292('0x49')](_0xc292('0x55'),{'WhatsappInteractionId':Number(_0x1e73e5[_0x58b87a]),'UserId':Number(_0x4ba9e3['id'])});}});}})[_0xc292('0x56')](function(_0xf39dad){_0x5b3562[_0xc292('0x57')](_0xf39dad);});}}function onDisconnect(_0x4a7d4e,_0x598929){joinOrLeave(_0x4a7d4e,_0xc292('0x47'),_0x598929);}function onConnect(_0x10dcfb){joinOrLeave(_0x10dcfb,'join');}exports['default']=function(_0x14b813){_0x14b813['on'](_0xc292('0x58'),function(_0x581a97){_0x581a97[_0xc292('0x59')](0x0);_0x581a97[_0xc292('0x5a')]=_0x581a97[_0xc292('0x5b')][_0xc292('0x58')][_0xc292('0x5c')]+':'+_0x581a97[_0xc292('0x5b')][_0xc292('0x58')][_0xc292('0x5d')];_0x581a97['connectedAt']=new Date();_0x581a97[_0xc292('0x57')]=function(_0x406851){console[_0xc292('0x57')](_0xc292('0x5e')+_0x581a97[_0xc292('0x5f')][_0xc292('0x4')]+'['+_0x581a97[_0xc292('0x5a')]+']',_0x406851);};_0x581a97['on'](_0xc292('0x60'),function(){onDisconnect(_0x581a97,_0x14b813);_0x581a97['log']('DISCONNECTED');});onConnect(_0x581a97);_0x581a97[_0xc292('0x57')](_0xc292('0x61'));});}; \ No newline at end of file +var _0xba79=['userProfileId','ChatQueue','FaxQueue','OpenchannelQueue','WhatsappQueues','WhatsappQueue','Telephones','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getWhatsappQueues','voice','chat','fax','sms','mail','openchannel','telephone:%s','trunk:%s','campaign:%s:%s','leave','map','ChatInteractions','emit','MailInteractions','user_has_mail_interactions:remove','FaxInteractions','removeFaxInteractions','user_has_fax_interactions:remove','SmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','default','connection','setMaxListeners','address','request','remotePort','connectedAt','SocketIO\x20','nsp','DISCONNECTED','CONNECTED','lodash','util','bluebird','./environment','User','name','role','agent','type','ivr','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','findAll','Trunks','IvrCampaigns','UserProfileResource','then','resourceId','where','Campaign','format','%s:queue:%s','Agents','length','user:%s','handshake','query','find','ChatInteraction','MailInteraction','FaxInteraction','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','voice:inbound','include','push','VoiceQueue','SmsQueue','MailQueue','Trunk','user','voice:outbound'];(function(_0x323970,_0x5bde6f){var _0x3217da=function(_0x4dcdf3){while(--_0x4dcdf3){_0x323970['push'](_0x323970['shift']());}};_0x3217da(++_0x5bde6f);}(_0xba79,0x153));var _0x9ba7=function(_0x477b78,_0x302499){_0x477b78=_0x477b78-0x0;var _0x2f3f99=_0xba79[_0x477b78];return _0x2f3f99;};'use strict';var _=require(_0x9ba7('0x0'));var util=require(_0x9ba7('0x1'));var BPromise=require(_0x9ba7('0x2'));var db=require('../mysqldb')['db'];var config=require(_0x9ba7('0x3'));var queryQueues={'attributes':['id','name'],'include':[{'as':'Agents','model':db[_0x9ba7('0x4')],'attributes':['id',_0x9ba7('0x5'),_0x9ba7('0x6')],'raw':!![],'where':{'role':_0x9ba7('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0x9ba7('0x5')],'where':{'role':_0x9ba7('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id','name',_0x9ba7('0x8')],'where':{'type':_0x9ba7('0x9')}};function getAssociatedResources(_0x3d714c,_0xfec018,_0x15869d){return db['UserProfileSection']['findOne']({'where':{'name':_0x3d714c,'userProfileId':_0xfec018},'raw':!![]})['then'](function(_0x59df53){if(_0x59df53){if(_0x59df53[_0x9ba7('0xa')]){switch(_0x3d714c){case _0x9ba7('0xb'):case _0x9ba7('0xc'):case _0x9ba7('0xd'):case _0x9ba7('0xe'):case _0x9ba7('0xf'):case _0x9ba7('0x10'):case'WhatsappQueues':return db[_0x15869d][_0x9ba7('0x11')](queryQueues);case'Telephones':return db[_0x15869d]['findAll'](queryTelephones);case _0x9ba7('0x12'):return db[_0x15869d]['findAll'](queryTrunks);case _0x9ba7('0x13'):return db[_0x15869d][_0x9ba7('0x11')](queryCampaigns);}}else{return db[_0x9ba7('0x14')][_0x9ba7('0x11')]({'attributes':['resourceId'],'where':{'sectionId':_0x59df53['id']},'raw':!![]})[_0x9ba7('0x15')](function(_0xeff954){if(_0xeff954){var _0x114f7c={'where':{'id':_['map'](_0xeff954,_0x9ba7('0x16'))},'raw':!![]};switch(_0x15869d){case _0x9ba7('0x4'):_0x114f7c[_0x9ba7('0x17')][_0x9ba7('0x6')]='telephone';break;case _0x9ba7('0x18'):_0x114f7c[_0x9ba7('0x17')][_0x9ba7('0x8')]=_0x9ba7('0x9');break;}return db[_0x15869d]['findAll'](_0x114f7c);}else{return[];}});}}else{return[];}})[_0x9ba7('0x15')](function(_0x4e91c5){return _0x4e91c5;});}function joinOrLeaveQueues(_0x55493b,_0x37bd9f,_0x2f8651,_0x1f5400){_0x55493b[_0x37bd9f](util[_0x9ba7('0x19')](_0x9ba7('0x1a'),_0x2f8651,_0x1f5400[_0x9ba7('0x5')]));if(_0x1f5400[_0x9ba7('0x1b')]){for(var _0x1ccd48=0x0;_0x1ccd48<_0x1f5400[_0x9ba7('0x1b')][_0x9ba7('0x1c')];_0x1ccd48+=0x1){_0x55493b[_0x37bd9f](util[_0x9ba7('0x19')](_0x9ba7('0x1d'),_0x1f5400['Agents'][_0x1ccd48]['name']));}}}function joinOrLeave(_0x4e2c9a,_0x5dcba2,_0x3abecf){var _0x285374;if(_0x4e2c9a[_0x9ba7('0x1e')][_0x9ba7('0x1f')]['id']){db[_0x9ba7('0x4')][_0x9ba7('0x20')]({'attributes':['id',_0x9ba7('0x5'),_0x9ba7('0x6'),'userProfileId'],'where':{'id':_0x4e2c9a[_0x9ba7('0x1e')][_0x9ba7('0x1f')]['id']},'include':[{'model':db[_0x9ba7('0x21')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x9ba7('0x22')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x9ba7('0x23')],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x9ba7('0x24')],'as':_0x9ba7('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x9ba7('0x26')],'as':_0x9ba7('0x27'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x270da2){if(_0x270da2){_0x285374=_0x270da2;_0x4e2c9a[_0x5dcba2](util[_0x9ba7('0x19')](_0x9ba7('0x1d'),_0x270da2[_0x9ba7('0x5')]));var _0x2695a4=[];switch(_0x270da2['role']){case'admin':_0x4e2c9a[_0x5dcba2](_0x9ba7('0x28'));_0x4e2c9a[_0x5dcba2]('voice:outbound');if(queryQueues['hasOwnProperty']('include')){delete queryQueues[_0x9ba7('0x29')];}_0x2695a4[_0x9ba7('0x2a')](db[_0x9ba7('0x2b')]['findAll'](queryQueues));_0x2695a4[_0x9ba7('0x2a')](db['ChatQueue'][_0x9ba7('0x11')](queryQueues));_0x2695a4['push'](db['FaxQueue']['findAll'](queryQueues));_0x2695a4[_0x9ba7('0x2a')](db[_0x9ba7('0x2c')][_0x9ba7('0x11')](queryQueues));_0x2695a4[_0x9ba7('0x2a')](db[_0x9ba7('0x2d')][_0x9ba7('0x11')](queryQueues));_0x2695a4[_0x9ba7('0x2a')](db['OpenchannelQueue']['findAll'](queryQueues));_0x2695a4['push'](db['WhatsappQueue'][_0x9ba7('0x11')](queryQueues));_0x2695a4['push'](db[_0x9ba7('0x4')][_0x9ba7('0x11')](queryTelephones));_0x2695a4['push'](db[_0x9ba7('0x2e')][_0x9ba7('0x11')](queryTrunks));_0x2695a4[_0x9ba7('0x2a')](db[_0x9ba7('0x18')][_0x9ba7('0x11')](queryCampaigns));_0x2695a4['push'](db[_0x9ba7('0x4')][_0x9ba7('0x11')](queryAgents));break;case _0x9ba7('0x2f'):_0x4e2c9a[_0x5dcba2]('voice:inbound');_0x4e2c9a[_0x5dcba2](_0x9ba7('0x30'));_0x2695a4[_0x9ba7('0x2a')](getAssociatedResources(_0x9ba7('0xb'),_0x270da2[_0x9ba7('0x31')],_0x9ba7('0x2b')));_0x2695a4[_0x9ba7('0x2a')](getAssociatedResources(_0x9ba7('0xc'),_0x270da2[_0x9ba7('0x31')],_0x9ba7('0x32')));_0x2695a4[_0x9ba7('0x2a')](getAssociatedResources(_0x9ba7('0xd'),_0x270da2['userProfileId'],_0x9ba7('0x33')));_0x2695a4[_0x9ba7('0x2a')](getAssociatedResources(_0x9ba7('0xe'),_0x270da2[_0x9ba7('0x31')],_0x9ba7('0x2c')));_0x2695a4[_0x9ba7('0x2a')](getAssociatedResources(_0x9ba7('0xf'),_0x270da2[_0x9ba7('0x31')],'MailQueue'));_0x2695a4[_0x9ba7('0x2a')](getAssociatedResources(_0x9ba7('0x10'),_0x270da2[_0x9ba7('0x31')],_0x9ba7('0x34')));_0x2695a4[_0x9ba7('0x2a')](getAssociatedResources(_0x9ba7('0x35'),_0x270da2['userProfileId'],_0x9ba7('0x36')));_0x2695a4[_0x9ba7('0x2a')](getAssociatedResources(_0x9ba7('0x37'),_0x270da2[_0x9ba7('0x31')],_0x9ba7('0x4')));_0x2695a4[_0x9ba7('0x2a')](getAssociatedResources('Trunks',_0x270da2[_0x9ba7('0x31')],_0x9ba7('0x2e')));_0x2695a4[_0x9ba7('0x2a')](getAssociatedResources(_0x9ba7('0x13'),_0x270da2['userProfileId'],'Campaign'));_0x2695a4[_0x9ba7('0x2a')](db[_0x9ba7('0x4')]['findAll'](queryAgents));break;case _0x9ba7('0x7'):_0x4e2c9a[_0x5dcba2]('voice:inbound');_0x4e2c9a[_0x5dcba2]('voice:outbound');_0x2695a4[_0x9ba7('0x2a')](_0x270da2[_0x9ba7('0x38')]({'attributes':['id',_0x9ba7('0x5')]}));_0x2695a4[_0x9ba7('0x2a')](_0x270da2[_0x9ba7('0x39')]({'attributes':['id',_0x9ba7('0x5')]}));_0x2695a4[_0x9ba7('0x2a')](_0x270da2[_0x9ba7('0x3a')]({'attributes':['id',_0x9ba7('0x5')]}));_0x2695a4[_0x9ba7('0x2a')](_0x270da2[_0x9ba7('0x3b')]({'attributes':['id',_0x9ba7('0x5')]}));_0x2695a4[_0x9ba7('0x2a')](_0x270da2['getMailQueues']({'attributes':['id',_0x9ba7('0x5')]}));_0x2695a4[_0x9ba7('0x2a')](_0x270da2['getOpenchannelQueues']({'attributes':['id',_0x9ba7('0x5')]}));_0x2695a4[_0x9ba7('0x2a')](_0x270da2[_0x9ba7('0x3c')]({'attributes':['id',_0x9ba7('0x5')]}));break;}return BPromise['all'](_0x2695a4);}})[_0x9ba7('0x15')](function(_0x196d86){if(_0x196d86&&_0x196d86[_0x9ba7('0x1c')]){for(var _0x3c39bb=0x0;_0x3c39bb<_0x196d86['length'];_0x3c39bb+=0x1){for(var _0x19a571=0x0;_0x19a571<_0x196d86[_0x3c39bb][_0x9ba7('0x1c')];_0x19a571+=0x1){switch(_0x3c39bb){case 0x0:joinOrLeaveQueues(_0x4e2c9a,_0x5dcba2,_0x9ba7('0x3d'),_0x196d86[_0x3c39bb][_0x19a571]);break;case 0x1:joinOrLeaveQueues(_0x4e2c9a,_0x5dcba2,_0x9ba7('0x3e'),_0x196d86[_0x3c39bb][_0x19a571]);break;case 0x2:joinOrLeaveQueues(_0x4e2c9a,_0x5dcba2,_0x9ba7('0x3f'),_0x196d86[_0x3c39bb][_0x19a571]);break;case 0x3:joinOrLeaveQueues(_0x4e2c9a,_0x5dcba2,_0x9ba7('0x40'),_0x196d86[_0x3c39bb][_0x19a571]);break;case 0x4:joinOrLeaveQueues(_0x4e2c9a,_0x5dcba2,_0x9ba7('0x41'),_0x196d86[_0x3c39bb][_0x19a571]);break;case 0x5:joinOrLeaveQueues(_0x4e2c9a,_0x5dcba2,_0x9ba7('0x42'),_0x196d86[_0x3c39bb][_0x19a571]);break;case 0x6:joinOrLeaveQueues(_0x4e2c9a,_0x5dcba2,'whatsapp',_0x196d86[_0x3c39bb][_0x19a571]);break;case 0x7:if(_0x285374[_0x9ba7('0x6')]!==_0x9ba7('0x7'))_0x4e2c9a[_0x5dcba2](util['format'](_0x9ba7('0x43'),_0x196d86[_0x3c39bb][_0x19a571][_0x9ba7('0x5')]));break;case 0x8:if(_0x285374[_0x9ba7('0x6')]!=='agent')_0x4e2c9a[_0x5dcba2](util[_0x9ba7('0x19')](_0x9ba7('0x44'),_0x196d86[_0x3c39bb][_0x19a571][_0x9ba7('0x5')]));break;case 0x9:if(_0x285374['role']!==_0x9ba7('0x7'))_0x4e2c9a[_0x5dcba2](util[_0x9ba7('0x19')](_0x9ba7('0x45'),_0x196d86[_0x3c39bb][_0x19a571][_0x9ba7('0x8')],_0x196d86[_0x3c39bb][_0x19a571][_0x9ba7('0x5')]));break;case 0xa:_0x4e2c9a[_0x5dcba2](util['format'](_0x9ba7('0x1d'),_0x196d86[_0x3c39bb][_0x19a571][_0x9ba7('0x5')]));break;}}}}})[_0x9ba7('0x15')](function(){if(_0x5dcba2===_0x9ba7('0x46')){var _0x746c36=_[_0x9ba7('0x47')](_0x285374[_0x9ba7('0x48')],'id');return _0x285374['removeChatInteractions'](_0x746c36)[_0x9ba7('0x15')](function(){for(var _0x2d97e9=0x0;_0x2d97e9<_0x746c36['length'];_0x2d97e9+=0x1){_0x3abecf[_0x9ba7('0x49')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x746c36[_0x2d97e9]),'UserId':Number(_0x285374['id'])});}});}})[_0x9ba7('0x15')](function(){if(_0x5dcba2===_0x9ba7('0x46')){var _0x36da5b=_[_0x9ba7('0x47')](_0x285374[_0x9ba7('0x4a')],'id');return _0x285374['removeMailInteractions'](_0x36da5b)['then'](function(){for(var _0x30c6df=0x0;_0x30c6df<_0x36da5b[_0x9ba7('0x1c')];_0x30c6df+=0x1){_0x3abecf['emit'](_0x9ba7('0x4b'),{'MailInteractionId':Number(_0x36da5b[_0x30c6df]),'UserId':Number(_0x285374['id'])});}});}})[_0x9ba7('0x15')](function(){if(_0x5dcba2==='leave'){var _0x1699d6=_['map'](_0x285374[_0x9ba7('0x4c')],'id');return _0x285374[_0x9ba7('0x4d')](_0x1699d6)['then'](function(){for(var _0x33cada=0x0;_0x33cada<_0x1699d6[_0x9ba7('0x1c')];_0x33cada+=0x1){_0x3abecf['emit'](_0x9ba7('0x4e'),{'FaxInteractionId':Number(_0x1699d6[_0x33cada]),'UserId':Number(_0x285374['id'])});}});}})['then'](function(){if(_0x5dcba2===_0x9ba7('0x46')){var _0x333eaf=_[_0x9ba7('0x47')](_0x285374[_0x9ba7('0x4f')],'id');return _0x285374[_0x9ba7('0x50')](_0x333eaf)[_0x9ba7('0x15')](function(){for(var _0x141321=0x0;_0x141321<_0x333eaf['length'];_0x141321+=0x1){_0x3abecf[_0x9ba7('0x49')](_0x9ba7('0x51'),{'SmsInteractionId':Number(_0x333eaf[_0x141321]),'UserId':Number(_0x285374['id'])});}});}})[_0x9ba7('0x15')](function(){if(_0x5dcba2===_0x9ba7('0x46')){var _0x69e58=_[_0x9ba7('0x47')](_0x285374['OpenchannelInteractions'],'id');return _0x285374['removeOpenchannelInteractions'](_0x69e58)[_0x9ba7('0x15')](function(){for(var _0x5ae9d3=0x0;_0x5ae9d3<_0x69e58[_0x9ba7('0x1c')];_0x5ae9d3+=0x1){_0x3abecf[_0x9ba7('0x49')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x69e58[_0x5ae9d3]),'UserId':Number(_0x285374['id'])});}});}})[_0x9ba7('0x15')](function(){if(_0x5dcba2===_0x9ba7('0x46')){var _0x2e6887=_['map'](_0x285374[_0x9ba7('0x27')],'id');return _0x285374[_0x9ba7('0x52')](_0x2e6887)['then'](function(){for(var _0x23bcd7=0x0;_0x23bcd7<_0x2e6887['length'];_0x23bcd7+=0x1){_0x3abecf['emit'](_0x9ba7('0x53'),{'WhatsappInteractionId':Number(_0x2e6887[_0x23bcd7]),'UserId':Number(_0x285374['id'])});}});}})[_0x9ba7('0x54')](function(_0x389b1c){_0x4e2c9a[_0x9ba7('0x55')](_0x389b1c);});}}function onDisconnect(_0x2f4f13,_0xbfb677){joinOrLeave(_0x2f4f13,_0x9ba7('0x46'),_0xbfb677);}function onConnect(_0x57cd03){joinOrLeave(_0x57cd03,'join');}exports[_0x9ba7('0x56')]=function(_0x27fd3c){_0x27fd3c['on'](_0x9ba7('0x57'),function(_0xfdb32){_0xfdb32[_0x9ba7('0x58')](0x0);_0xfdb32[_0x9ba7('0x59')]=_0xfdb32[_0x9ba7('0x5a')][_0x9ba7('0x57')]['remoteAddress']+':'+_0xfdb32['request'][_0x9ba7('0x57')][_0x9ba7('0x5b')];_0xfdb32[_0x9ba7('0x5c')]=new Date();_0xfdb32[_0x9ba7('0x55')]=function(_0x45e5c0){console[_0x9ba7('0x55')](_0x9ba7('0x5d')+_0xfdb32[_0x9ba7('0x5e')]['name']+'['+_0xfdb32[_0x9ba7('0x59')]+']',_0x45e5c0);};_0xfdb32['on']('disconnect',function(){onDisconnect(_0xfdb32,_0x27fd3c);_0xfdb32['log'](_0x9ba7('0x5f'));});onConnect(_0xfdb32);_0xfdb32[_0x9ba7('0x55')](_0x9ba7('0x60'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 33495a1..04dfbdc 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 _0xdd4e=['code','Trigger,\x20%s','catch','get','event','direction','resolve','then','ContactId','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','query','SELECT','UserId','format','SIP/%s','name','agent','incomingmessage','outgoingmessage','AfterCreateMessage','channel','motionChannel','offlineMessage','opened','QueryTypes','AfterCreate','changed','closed','substatus','contact','interface','AfterUpdate','User','find','fullname','email','internal','length','hasOwnProperty','model','hook','condition','../../mysqldb','jayson/promise','../logger','triggers','http','Chat','ChatInteraction','afterCreate','newinteraction','afterUpdate','newmessage','ChatOfflineMessage','SmsInteraction','closedinteraction','Sms','Whatsapp','WhatsappInteraction','Fax','FaxInteraction','FaxMessage','MailInteraction','Mail','MailMessage','Openchannel','OpenchannelInteraction','request','EventManager','error'];(function(_0x9bbba1,_0x226ad9){var _0x66fbf4=function(_0x184e4c){while(--_0x184e4c){_0x9bbba1['push'](_0x9bbba1['shift']());}};_0x66fbf4(++_0x226ad9);}(_0xdd4e,0x14c));var _0xedd4=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xdd4e[_0xa1e3e3];return _0xc980e9;};'use strict';var util=require('util');var db=require(_0xedd4('0x0'))['db'];var jayson=require(_0xedd4('0x1'));var logger=require(_0xedd4('0x2'))(_0xedd4('0x3'));var client=jayson['client'][_0xedd4('0x4')]({'port':0x232a});var triggers=[{'channel':_0xedd4('0x5'),'model':_0xedd4('0x6'),'event':_0xedd4('0x7'),'condition':_0xedd4('0x8'),'callback':afterCreate},{'channel':_0xedd4('0x5'),'model':'ChatInteraction','event':_0xedd4('0x9'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0xedd4('0x5'),'model':'ChatMessage','event':_0xedd4('0x7'),'condition':_0xedd4('0xa'),'callback':afterCreateMessage},{'channel':_0xedd4('0x5'),'model':_0xedd4('0xb'),'event':'afterCreate','condition':'newmessage','callback':afterCreateOfflineMessage},{'channel':'Sms','model':_0xedd4('0xc'),'event':_0xedd4('0x7'),'condition':_0xedd4('0x8'),'callback':afterCreate},{'channel':'Sms','model':_0xedd4('0xc'),'event':'afterUpdate','condition':_0xedd4('0xd'),'callback':afterUpdate},{'channel':_0xedd4('0xe'),'model':'SmsMessage','event':'afterCreate','condition':'newmessage','callback':afterCreateMessage},{'channel':_0xedd4('0xf'),'model':'WhatsappInteraction','event':'afterCreate','condition':'newinteraction','callback':afterCreate},{'channel':'Whatsapp','model':_0xedd4('0x10'),'event':_0xedd4('0x9'),'condition':_0xedd4('0xd'),'callback':afterUpdate},{'channel':_0xedd4('0xf'),'model':'WhatsappMessage','event':_0xedd4('0x7'),'condition':_0xedd4('0xa'),'callback':afterCreateMessage},{'channel':_0xedd4('0x11'),'model':'FaxInteraction','event':_0xedd4('0x7'),'condition':_0xedd4('0x8'),'callback':afterCreate},{'channel':_0xedd4('0x11'),'model':_0xedd4('0x12'),'event':_0xedd4('0x9'),'condition':_0xedd4('0xd'),'callback':afterUpdate},{'channel':_0xedd4('0x11'),'model':_0xedd4('0x13'),'event':_0xedd4('0x7'),'condition':_0xedd4('0xa'),'callback':afterCreateMessage},{'channel':'Mail','model':_0xedd4('0x14'),'event':_0xedd4('0x7'),'condition':_0xedd4('0x8'),'callback':afterCreate},{'channel':'Mail','model':_0xedd4('0x14'),'event':_0xedd4('0x9'),'condition':_0xedd4('0xd'),'callback':afterUpdate},{'channel':_0xedd4('0x15'),'model':_0xedd4('0x16'),'event':_0xedd4('0x7'),'condition':_0xedd4('0xa'),'callback':afterCreateMessage},{'channel':_0xedd4('0x17'),'model':_0xedd4('0x18'),'event':_0xedd4('0x7'),'condition':'newinteraction','callback':afterCreate},{'channel':'Openchannel','model':_0xedd4('0x18'),'event':'afterUpdate','condition':_0xedd4('0xd'),'callback':afterUpdate},{'channel':'Openchannel','model':'OpenchannelMessage','event':'afterCreate','condition':_0xedd4('0xa'),'callback':afterCreateMessage}];function request(_0x43a466){return client[_0xedd4('0x19')]('EventManager',_0x43a466)['then'](function(_0x4020ef){logger['info']('Trigger,\x20%s',_0xedd4('0x1a'),_0x4020ef);if(_0x4020ef['error']){if(_0x4020ef[_0xedd4('0x1b')][_0xedd4('0x1c')]===0x1f4){logger[_0xedd4('0x1b')](_0xedd4('0x1d'),_0xedd4('0x1a'),_0x4020ef['error']);}}})[_0xedd4('0x1e')](function(_0x3edd97){logger[_0xedd4('0x1b')](_0xedd4('0x1d'),_0xedd4('0x1a'),_0x3edd97);});}function afterCreateMessage(_0xdba1d1){return function(_0x11087e){_0x11087e=_0x11087e[_0xedd4('0x1f')]({'plain':!![]});_0x11087e['channel']=_0xdba1d1;_0x11087e['motionChannel']=_0xdba1d1;_0x11087e[_0xedd4('0x20')]=_0x11087e[_0xedd4('0x21')];Promise[_0xedd4('0x22')]()[_0xedd4('0x23')](function(){if(typeof _0x11087e[_0xedd4('0x24')]===_0xedd4('0x25'))return null;var _0x2f3797=_0xedd4('0x26')+_0x11087e[_0xedd4('0x24')];return db[_0xedd4('0x27')][_0xedd4('0x28')](_0x2f3797,{'type':db['Sequelize']['QueryTypes'][_0xedd4('0x29')],'raw':!![]});})[_0xedd4('0x23')](function(_0x45341d){if(_0x45341d){_0x11087e['contact']=_0x45341d[0x0];}if(typeof _0x11087e[_0xedd4('0x2a')]===_0xedd4('0x25'))return;return getAgent(_0x11087e[_0xedd4('0x2a')]);})[_0xedd4('0x23')](function(_0x298b18){if(_0x298b18){_0x11087e['interface']=util[_0xedd4('0x2b')](_0xedd4('0x2c'),_0x298b18[_0xedd4('0x2d')]);_0x11087e[_0xedd4('0x2e')]=_0x298b18;_0x11087e['channel']=_0xdba1d1;return request({'event':_0xedd4('0x2f'),'message':_0x11087e});}else{return request({'event':_0xedd4('0x30'),'message':_0x11087e});}})[_0xedd4('0x1e')](function(_0x392417){logger[_0xedd4('0x1b')](_0xedd4('0x1d'),_0xedd4('0x31'),_0x392417);});};}function afterCreateOfflineMessage(_0x35d452){return function(_0x4f1b4b){_0x4f1b4b=_0x4f1b4b[_0xedd4('0x1f')]({'plain':!![]});_0x4f1b4b[_0xedd4('0x32')]=_0x35d452;_0x4f1b4b[_0xedd4('0x33')]=_0x35d452;_0x4f1b4b[_0xedd4('0x20')]=_0xedd4('0x34');return request({'event':_0x4f1b4b[_0xedd4('0x20')],'message':_0x4f1b4b});};}function afterCreate(_0x370430,_0x9cef69){return function(_0x3c86b8){_0x3c86b8=_0x3c86b8[_0xedd4('0x1f')]({'plain':!![]});_0x3c86b8[_0xedd4('0x32')]=_0x370430;_0x3c86b8[_0xedd4('0x33')]=_0x370430;_0x3c86b8['event']=_0xedd4('0x35');Promise[_0xedd4('0x22')]()[_0xedd4('0x23')](function(){var _0x1375e7=_0xedd4('0x26')+_0x3c86b8['ContactId'];return db[_0xedd4('0x27')]['query'](_0x1375e7,{'type':db['Sequelize'][_0xedd4('0x36')][_0xedd4('0x29')],'raw':!![]});})[_0xedd4('0x23')](function(_0x339e58){if(_0x339e58){_0x3c86b8['contact']=_0x339e58[0x0];}if(typeof _0x3c86b8[_0xedd4('0x2a')]===_0xedd4('0x25'))return;return getAgent(_0x3c86b8[_0xedd4('0x2a')]);})[_0xedd4('0x23')](function(_0x274b1b){if(_0x274b1b){_0x3c86b8['interface']=util[_0xedd4('0x2b')](_0xedd4('0x2c'),_0x274b1b[_0xedd4('0x2d')]);_0x3c86b8[_0xedd4('0x2e')]=_0x274b1b;}return request({'event':_0x9cef69,'message':_0x3c86b8});})[_0xedd4('0x1e')](function(_0x26c284){logger[_0xedd4('0x1b')]('Trigger,\x20%s',_0xedd4('0x37'),_0x26c284);});};}function afterUpdate(_0x592203){return function(_0x2f8bc5){var _0x5cbf42=_0x2f8bc5[_0xedd4('0x38')](_0xedd4('0x39'))&&_0x2f8bc5['closed'];var _0x3a780f=_0x2f8bc5[_0xedd4('0x38')](_0xedd4('0x3a'));if(_0x5cbf42||_0x3a780f){var _0x515f04=_0x5cbf42?_0xedd4('0xd'):_0xedd4('0x3a');var _0x13fe53=_0x2f8bc5['get']({'plain':!![]});_0x13fe53[_0xedd4('0x32')]=_0x592203;_0x13fe53['motionChannel']=_0x592203;_0x13fe53['event']=_0x5cbf42?_0xedd4('0x39'):_0xedd4('0x3a');var _0x3eedf8=_0xedd4('0x26')+_0x13fe53[_0xedd4('0x24')];return db[_0xedd4('0x27')][_0xedd4('0x28')](_0x3eedf8,{'type':db['Sequelize'][_0xedd4('0x36')][_0xedd4('0x29')],'raw':!![]})[_0xedd4('0x23')](function(_0x4ab216){if(_0x4ab216){_0x13fe53[_0xedd4('0x3b')]=_0x4ab216[0x0];}if(typeof _0x13fe53['UserId']===_0xedd4('0x25'))return;return getAgent(_0x13fe53[_0xedd4('0x2a')]);})[_0xedd4('0x23')](function(_0x32ac95){if(_0x32ac95){_0x13fe53[_0xedd4('0x3c')]=util[_0xedd4('0x2b')](_0xedd4('0x2c'),_0x32ac95[_0xedd4('0x2d')]);_0x13fe53['agent']=_0x32ac95;}return request({'event':_0x515f04,'message':_0x13fe53});})[_0xedd4('0x1e')](function(_0xc46ba9){logger[_0xedd4('0x1b')](_0xedd4('0x1d'),_0xedd4('0x3d'),_0xc46ba9);});}};}function getAgent(_0x2f4e0c){return db[_0xedd4('0x3e')][_0xedd4('0x3f')]({'where':{'id':_0x2f4e0c},'attributes':['id',_0xedd4('0x2d'),_0xedd4('0x40'),_0xedd4('0x41'),_0xedd4('0x42')],'raw':!![]})['then'](function(_0x47e757){return _0x47e757;});}exports['default']=function(){for(var _0x39ef03=0x0;_0x39ef03=_0x2b52a7['agents']){throw Error(_0x28da('0x15'));}_0x4333ec(_0xd4feeb);})[_0x28da('0x16')](function(_0x1bb268){_0x173c18(_0x1bb268);});});}; \ No newline at end of file +var _0x2b46=['sms','openchannel','isValidChannel','toLowerCase','isUndefined','updateAttributes','getLicense','agent','agents','Maximum\x20login\x20has\x20been\x20reached','catch','../mysqldb','voice','mail','chat'];(function(_0x3577ae,_0x3ccff4){var _0x3a638c=function(_0x3eaee6){while(--_0x3eaee6){_0x3577ae['push'](_0x3577ae['shift']());}};_0x3a638c(++_0x3ccff4);}(_0x2b46,0xb0));var _0x62b4=function(_0x3309e3,_0x18efa7){_0x3309e3=_0x3309e3-0x0;var _0x57c1ba=_0x2b46[_0x3309e3];return _0x57c1ba;};'use strict';var _=require('lodash');var BPromise=require('bluebird');var db=require(_0x62b4('0x0'))['db'];var util=require('./license/util');var channels=[_0x62b4('0x1'),_0x62b4('0x2'),_0x62b4('0x3'),'fax',_0x62b4('0x4'),'whatsapp',_0x62b4('0x5')];exports['getChannels']=function(){return channels;};exports[_0x62b4('0x6')]=function(_0xe753df){_0xe753df=_0xe753df[_0x62b4('0x7')]();return _['includes'](channels,_0xe753df);};exports['clearBlockUser']=function(_0x40c49c,_0x2731c7,_0x59e00c,_0x55ae5d){var _0x31b882={'loginAttempts':_0x2731c7,'blocked':_0x59e00c};if(!_[_0x62b4('0x8')](_0x55ae5d)){_0x31b882['blockedAt']=_0x55ae5d;}return _0x40c49c[_0x62b4('0x9')](_0x31b882);};exports[_0x62b4('0xa')]=function(_0x3af63b){return new BPromise(function(_0x4efa0c,_0x10c54f){var _0x52e51c=0x0;if(_0x3af63b['role']!==_0x62b4('0xb')){_0x4efa0c(_0x3af63b);}db['User']['count']({'where':{'role':_0x62b4('0xb'),'online':!![],'id':{'$ne':_0x3af63b['id']}}})['then'](function(_0x1ebe16){_0x52e51c=_0x1ebe16;return util[_0x62b4('0xa')]();})['then'](function(_0x57a8c0){if(_0x57a8c0&&_0x57a8c0[_0x62b4('0xc')]&&_0x52e51c>=_0x57a8c0['agents']){throw Error(_0x62b4('0xd'));}_0x4efa0c(_0x3af63b);})[_0x62b4('0xe')](function(_0x2cc4c1){_0x10c54f(_0x2cc4c1);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index 455b537..ce67757 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xda3f=['inherits','message','Bad\x20Request','Entity\x20not\x20found','name','Not\x20Found','Forbidden','OutOfInterval','error','stack','send','exports','../config/logger','api','Internal\x20Server\x20Error','Error'];(function(_0x3e7706,_0x15f2df){var _0x41a48d=function(_0x1c88bf){while(--_0x1c88bf){_0x3e7706['push'](_0x3e7706['shift']());}};_0x41a48d(++_0x15f2df);}(_0xda3f,0xec));var _0xfda3=function(_0x212a39,_0x261cd5){_0x212a39=_0x212a39-0x0;var _0x3abdf6=_0xda3f[_0x212a39];return _0x3abdf6;};'use strict';var util=require('util');var logger=require(_0xfda3('0x0'))(_0xfda3('0x1'));var APIError=function(_0x534697,_0x5299b0){this['message']=_0x534697||_0xfda3('0x2');this['name']=_0x5299b0||_0xfda3('0x3');util[_0xfda3('0x4')](APIError,Error);};var APIBadRequestError=function(_0x516500){this[_0xfda3('0x5')]=_0x516500||_0xfda3('0x6');this['name']='Bad\x20Request';util[_0xfda3('0x4')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x42476a){this[_0xfda3('0x5')]=_0x42476a||_0xfda3('0x7');this[_0xfda3('0x8')]=_0xfda3('0x9');util[_0xfda3('0x4')](APINotFoundError,APIError);};function getStatusCode(_0x1b1ea6){switch(_0x1b1ea6){case _0xfda3('0x6'):return 0x190;case _0xfda3('0xa'),_0xfda3('0xb'):return 0x193;case _0xfda3('0x9'):return 0x194;default:return 0x1f4;}}function handleError(_0x4d7841){return function(_0xe933f5){logger[_0xfda3('0xc')](_0xe933f5[_0xfda3('0xd')]);var _0x11afc1=getStatusCode(_0xe933f5[_0xfda3('0x8')]);if(_0xe933f5['name'])delete _0xe933f5[_0xfda3('0x8')];return _0x4d7841['status'](_0x11afc1)[_0xfda3('0xe')](_0xe933f5);};}module[_0xfda3('0xf')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file +var _0x91a7=['name','inherits','Entity\x20not\x20found','Not\x20Found','Forbidden','OutOfInterval','error','stack','status','send','../config/logger','api','message'];(function(_0x567904,_0x4207b0){var _0x4cbd2b=function(_0x5005c8){while(--_0x5005c8){_0x567904['push'](_0x567904['shift']());}};_0x4cbd2b(++_0x4207b0);}(_0x91a7,0xe7));var _0x791a=function(_0x47cf6e,_0x148cce){_0x47cf6e=_0x47cf6e-0x0;var _0x1dc9ea=_0x91a7[_0x47cf6e];return _0x1dc9ea;};'use strict';var util=require('util');var logger=require(_0x791a('0x0'))(_0x791a('0x1'));var APIError=function(_0x268862,_0x5d2796){this[_0x791a('0x2')]=_0x268862||'Internal\x20Server\x20Error';this[_0x791a('0x3')]=_0x5d2796||'Error';util['inherits'](APIError,Error);};var APIBadRequestError=function(_0x32fe2b){this[_0x791a('0x2')]=_0x32fe2b||'Bad\x20Request';this[_0x791a('0x3')]='Bad\x20Request';util[_0x791a('0x4')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x159e24){this['message']=_0x159e24||_0x791a('0x5');this[_0x791a('0x3')]=_0x791a('0x6');util[_0x791a('0x4')](APINotFoundError,APIError);};function getStatusCode(_0x266e4b){switch(_0x266e4b){case'Bad\x20Request':return 0x190;case _0x791a('0x7'),_0x791a('0x8'):return 0x193;case'Not\x20Found':return 0x194;default:return 0x1f4;}}function handleError(_0x2bd26a){return function(_0x206eea){logger[_0x791a('0x9')](_0x206eea[_0x791a('0xa')]);var _0x2805c9=getStatusCode(_0x206eea[_0x791a('0x3')]);if(_0x206eea['name'])delete _0x206eea['name'];return _0x2bd26a[_0x791a('0xb')](_0x2805c9)[_0x791a('0xc')](_0x206eea);};}module['exports']={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 2689a87..d07614a 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x32f4=['exports','status','render','json','send'];(function(_0x2100c1,_0x5e2cf2){var _0x3d5060=function(_0x4ad8db){while(--_0x4ad8db){_0x2100c1['push'](_0x2100c1['shift']());}};_0x3d5060(++_0x5e2cf2);}(_0x32f4,0x168));var _0x432f=function(_0x3fd03d,_0x29c362){_0x3fd03d=_0x3fd03d-0x0;var _0x2f38dc=_0x32f4[_0x3fd03d];return _0x2f38dc;};'use strict';module[_0x432f('0x0')][0x194]=function pageNotFound(_0x325b2d,_0x9e6187){var _0x404867='404';var _0x1d38e9=0x194;var _0xcd6dc3={'status':_0x1d38e9};_0x9e6187['status'](_0xcd6dc3[_0x432f('0x1')]);_0x9e6187[_0x432f('0x2')](_0x404867,{},function(_0x5a62ab,_0x482396){if(_0x5a62ab){return _0x9e6187[_0x432f('0x1')](_0xcd6dc3[_0x432f('0x1')])[_0x432f('0x3')](_0xcd6dc3);}_0x9e6187[_0x432f('0x4')](_0x482396);});}; \ No newline at end of file +var _0x7980=['render','json','send','exports','404','status'];(function(_0x5cd29e,_0x8692de){var _0x29d506=function(_0x6a92da){while(--_0x6a92da){_0x5cd29e['push'](_0x5cd29e['shift']());}};_0x29d506(++_0x8692de);}(_0x7980,0xab));var _0x0798=function(_0x4564c3,_0x1c9b4f){_0x4564c3=_0x4564c3-0x0;var _0x2a9474=_0x7980[_0x4564c3];return _0x2a9474;};'use strict';module[_0x0798('0x0')][0x194]=function pageNotFound(_0x2c9307,_0x2c2c4e){var _0x558a5d=_0x0798('0x1');var _0x48285b=0x194;var _0x3a9ff7={'status':_0x48285b};_0x2c2c4e[_0x0798('0x2')](_0x3a9ff7[_0x0798('0x2')]);_0x2c2c4e[_0x0798('0x3')](_0x558a5d,{},function(_0x1a1fe7,_0x581bf3){if(_0x1a1fe7){return _0x2c2c4e[_0x0798('0x2')](_0x3a9ff7['status'])[_0x0798('0x4')](_0x3a9ff7);}_0x2c2c4e[_0x0798('0x5')](_0x581bf3);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index f3313e1..59ef30b 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9411=['WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','../api/user-setting/user-setting.model','hasOne','cascade','UserId','UserSetting','userSetting','hasMany','Recordings','VoiceQueuesRt','Extensions','HopperFinals','ReportAgentPreview','OpenchannelInteractions','ChatInteractions','SmsInteraction','SmsInteractions','FaxInteraction','WhatsappInteractions','UserNotifications','belongsTo','UserProfile','userProfileId','ChatGroup','Groups','belongsToMany','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_teams','MailInteractions','user_has_mail_interactions','user_has_chat_interactions','FaxInteractions','user_has_fax_interactions','user_has_sms_interactions','VoiceQueues','VoicePrefixes','MailQueues','UserMailQueue','ChatQueue','ChatQueues','OpenchannelQueues','UserOpenchannelQueue','WhatsappQueues','ChatWebsites','FaxAccounts','MailAccount','MailAccounts','user_has_mail_accounts','OpenchannelAccount','user_has_openchannel_accounts','SmsAccount','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','SpiedAgents','ChanSpyId','Applications','Sounds','moh_has_sounds','VoiceQueueId','HopperHistories','JscriptySessionReport','Trunk','TrunkBackupId','Pause','mandatoryDispositionPauseId','Agents','BlackLists','voice_queues_has_cm_blacklists','Messages','mailbox','VoiceQueueReport','QueueCalls','uniqueid','Contact','ContactId','MailAccountId','restrict','CloudProviderId','Imap','Smtp','Dispositions','Answers','Interactions','List','TemplateId','team_has_mail_queues','Teams','MailInteractionId','Account','Owner','mail_interaction_has_tags','Tags','ThroughTags','Interaction','ChatWebsiteId','IntervalId','TagId','ListId','FaxAccountId','Exntensions','mandatoryDispositionPause','user_has_fax_accounts','fax_interaction_has_tags','Users','FaxInteractionId','team_has_fax_queues','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','team_has_sms_queues','OpenchannelAccountId','OpenchannelInteractionId','openchannel_interaction_has_tags','user_has_openchannel_interactions','AttachmentId','OpenchannelQueueId','ProactiveActions','ChatApplication','user_has_chat_websites','ChatQueueId','chat_interaction_has_tags','ChatInteractionId','Attachments','ChatOfflineMessageId','team_has_chat_queues','ChatGroupId','Members','chat_group_has_users','Phones','CmContactId','Hoppers','JscriptySessions','Company','CompanyId','cm_contact_has_tags','AdditionalPhones','CmHopperId','Agent','OwnerId','Queue','CampaignId','Condition','All','OneAll','AutomationAllId','OneAny','Actions','AutomationId','ParentId','Intervals','ChatApplications','FaxApplications','SmsApplications','Schedule','CustomReportId','Sound','Mohs','whatsapp_interaction_has_tags','ItemType','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','TriggerId','Fields','AnalyticDefaultReport','DefaultReportId','MetricId','SalesforceAccount','SalesforceConfiguration','SalesforceField','SubjectId','Descriptions','DescriptionId','FieldId','AccountId','Subject','Description','Field','VariableId','Subjects','Configurations','int_desk_configuration_has_tags','ZohoConfiguration','int_zendesk_configuration_has_tags','ZendeskField','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','VtigerAccount','ServicenowField','Dynamics365Field','FreshsalesAccount','ToId','SessionId','ProjectId','FaxQueues','team_has_openchannel_queues','team_has_whatsapp_queues','TeamVoicePrefix','HopperBlacks','TrunkId','TrunkBackup','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromAgent','ToAgent','ToQueue','ToAccount','ChatTransferReport','FromChatWebsiteId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','FromUserId','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToUserId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','HopperHistory','Queues','voice_queues_has_cm_lists','UserProfileSection','UserProfileSections','Resources','WhatsappAccount','WhatsappAccountId','WhatsappInteractionId','user_has_whatsapp_interactions','FromWhatsappAccountId','ToQueueId','WhatsappQueueId','exports','../config/environment','sequelize','lodash','jstz','determine','defaultsDeep','motion2','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','sequelizeHistory','utf8','utf8_general_ci','database','username','password','options','User','import','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','UserChatQueue','../api/userChatQueue/userChatQueue.model','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','../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','DashboardItem','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','../api/chatQueue/chatQueue.model','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/condition/condition.model','Interval','../api/interval/interval.model','../api/pause/pause.model','../api/cdr/cdr.model','VoiceQueuesLog','../api/schedule/schedule.model','../api/sound/sound.model','Tag','ContactItemType','../api/contactItemType/contactItemType.model','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','Template','Trigger','Variable','../api/variable/variable.model','Integration','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/intSalesforceAccount/intSalesforceAccount.model','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','../api/intDynamics365Field/intDynamics365Field.model','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/integration/integration.model','Network','../api/network/network.model','ChatQueueReport','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','SquareMessage','../api/squareMessage/squareMessage.model','Team','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','VoicePrefix','../api/voicePrefix/voicePrefix.model','../api/userProfile/userProfile.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model'];(function(_0x46ed2d,_0x1e69f8){var _0x20c03d=function(_0x195c7a){while(--_0x195c7a){_0x46ed2d['push'](_0x46ed2d['shift']());}};_0x20c03d(++_0x1e69f8);}(_0x9411,0x104));var _0x1941=function(_0x14111c,_0x14f01b){_0x14111c=_0x14111c-0x0;var _0x135054=_0x9411[_0x14111c];return _0x135054;};'use strict';var config=require(_0x1941('0x0'));var Sequelize=require(_0x1941('0x1'));var _=require(_0x1941('0x2'));var jstz=require(_0x1941('0x3'));var timezone=jstz[_0x1941('0x4')]();config[_0x1941('0x1')]=_[_0x1941('0x5')](config[_0x1941('0x1')],{'database':_0x1941('0x6'),'username':_0x1941('0x7'),'password':_0x1941('0x8'),'options':{'host':_0x1941('0x9'),'port':0xcea,'dialect':_0x1941('0xa'),'dialectOptions':{'charset':_0x1941('0xb')},'logging':![],'timezone':timezone[_0x1941('0xc')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});config['sequelizeHistory']=_[_0x1941('0x5')](config[_0x1941('0xd')],{'database':_0x1941('0x6'),'username':_0x1941('0x7'),'password':'xC@LL1234','options':{'host':_0x1941('0x9'),'port':0xcea,'dialect':_0x1941('0xa'),'dialectOptions':{'charset':_0x1941('0xb')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x1941('0xe'),'collate':_0x1941('0xf')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x1941('0x1')][_0x1941('0x10')],config[_0x1941('0x1')][_0x1941('0x11')],config[_0x1941('0x1')][_0x1941('0x12')],config['sequelize'][_0x1941('0x13')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x1941('0xd')][_0x1941('0x10')],config[_0x1941('0xd')]['username'],config[_0x1941('0xd')][_0x1941('0x12')],config[_0x1941('0xd')][_0x1941('0x13')])};db[_0x1941('0x14')]=db[_0x1941('0x1')][_0x1941('0x15')]('../api/user/user.model');db[_0x1941('0x16')]=db['sequelize']['import'](_0x1941('0x17'));db[_0x1941('0x18')]=db[_0x1941('0x1')][_0x1941('0x15')](_0x1941('0x19'));db[_0x1941('0x1a')]=db[_0x1941('0x1')][_0x1941('0x15')]('../api/voiceExtension/voiceExtension.model');db[_0x1941('0x1b')]=db['sequelize'][_0x1941('0x15')](_0x1941('0x1c'));db[_0x1941('0x1d')]=db[_0x1941('0x1')][_0x1941('0x15')](_0x1941('0x1e'));db[_0x1941('0x1f')]=db[_0x1941('0x1')][_0x1941('0x15')]('../api/voiceRecording/voiceRecording.model');db[_0x1941('0x20')]=db[_0x1941('0x1')]['import'](_0x1941('0x21'));db[_0x1941('0x22')]=db[_0x1941('0x1')][_0x1941('0x15')](_0x1941('0x23'));db[_0x1941('0x24')]=db[_0x1941('0x1')][_0x1941('0x15')](_0x1941('0x25'));db[_0x1941('0x26')]=db[_0x1941('0x1')][_0x1941('0x15')](_0x1941('0x27'));db[_0x1941('0x28')]=db[_0x1941('0x1')]['import']('../api/voiceDialReport/voiceDialReport.model');db[_0x1941('0x29')]=db['sequelize'][_0x1941('0x15')](_0x1941('0x2a'));db['VoiceQueueReport']=db[_0x1941('0x1')][_0x1941('0x15')](_0x1941('0x2b'));db[_0x1941('0x2c')]=db[_0x1941('0x1')][_0x1941('0x15')](_0x1941('0x2d'));db['Trunk']=db[_0x1941('0x1')][_0x1941('0x15')]('../api/trunk/trunk.model');db[_0x1941('0x2e')]=db[_0x1941('0x1')][_0x1941('0x15')](_0x1941('0x2f'));db[_0x1941('0x30')]=db[_0x1941('0x1')]['import'](_0x1941('0x31'));db[_0x1941('0x32')]=db['sequelize'][_0x1941('0x15')]('../api/userVoiceQueue/userVoiceQueue.model');db[_0x1941('0x33')]=db[_0x1941('0x1')][_0x1941('0x15')](_0x1941('0x34'));db['UserMailQueue']=db[_0x1941('0x1')][_0x1941('0x15')](_0x1941('0x35'));db[_0x1941('0x36')]=db[_0x1941('0x1')]['import'](_0x1941('0x37'));db[_0x1941('0x38')]=db[_0x1941('0x1')][_0x1941('0x15')](_0x1941('0x39'));db['UserOpenchannelQueue']=db['sequelize'][_0x1941('0x15')]('../api/userOpenchannelQueue/userOpenchannelQueue.model');db[_0x1941('0x3a')]=db[_0x1941('0x1')]['import'](_0x1941('0x3b'));db[_0x1941('0x3c')]=db[_0x1941('0x1')][_0x1941('0x15')](_0x1941('0x3d'));db[_0x1941('0x3e')]=db['sequelize'][_0x1941('0x15')](_0x1941('0x3f'));db['MailAccount']=db[_0x1941('0x1')]['import'](_0x1941('0x40'));db[_0x1941('0x41')]=db[_0x1941('0x1')]['import'](_0x1941('0x42'));db[_0x1941('0x43')]=db[_0x1941('0x1')][_0x1941('0x15')](_0x1941('0x44'));db[_0x1941('0x45')]=db[_0x1941('0x1')]['import'](_0x1941('0x46'));db[_0x1941('0x47')]=db[_0x1941('0x1')][_0x1941('0x15')]('../api/mailMessage/mailMessage.model');db[_0x1941('0x48')]=db[_0x1941('0x1')][_0x1941('0x15')](_0x1941('0x49'));db[_0x1941('0x4a')]=db[_0x1941('0x1')]['import'](_0x1941('0x4b'));db[_0x1941('0x4c')]=db[_0x1941('0x1')][_0x1941('0x15')](_0x1941('0x4d'));db[_0x1941('0x4e')]=db[_0x1941('0x1')][_0x1941('0x15')]('../api/dashboardItem/dashboardItem.model');db[_0x1941('0x4f')]=db[_0x1941('0x1')][_0x1941('0x15')](_0x1941('0x50'));db[_0x1941('0x51')]=db[_0x1941('0x1')][_0x1941('0x15')]('../api/faxApplication/faxApplication.model');db['FaxInteraction']=db[_0x1941('0x1')][_0x1941('0x15')]('../api/faxInteraction/faxInteraction.model');db[_0x1941('0x52')]=db[_0x1941('0x1')][_0x1941('0x15')](_0x1941('0x53'));db[_0x1941('0x54')]=db[_0x1941('0x1')][_0x1941('0x15')](_0x1941('0x55'));db[_0x1941('0x56')]=db['sequelize'][_0x1941('0x15')](_0x1941('0x57'));db['SmsAccount']=db['sequelize'][_0x1941('0x15')]('../api/smsAccount/smsAccount.model');db[_0x1941('0x58')]=db[_0x1941('0x1')][_0x1941('0x15')](_0x1941('0x59'));db['SmsInteraction']=db[_0x1941('0x1')][_0x1941('0x15')]('../api/smsInteraction/smsInteraction.model');db[_0x1941('0x5a')]=db['sequelize']['import'](_0x1941('0x5b'));db[_0x1941('0x5c')]=db[_0x1941('0x1')]['import'](_0x1941('0x5d'));db['OpenchannelAccount']=db['sequelize'][_0x1941('0x15')](_0x1941('0x5e'));db[_0x1941('0x5f')]=db[_0x1941('0x1')][_0x1941('0x15')](_0x1941('0x60'));db[_0x1941('0x61')]=db['sequelize'][_0x1941('0x15')](_0x1941('0x62'));db[_0x1941('0x63')]=db['sequelize'][_0x1941('0x15')]('../api/openchannelMessage/openchannelMessage.model');db[_0x1941('0x64')]=db[_0x1941('0x1')]['import'](_0x1941('0x65'));db[_0x1941('0x66')]=db['sequelize'][_0x1941('0x15')](_0x1941('0x67'));db[_0x1941('0x68')]=db['sequelize'][_0x1941('0x15')](_0x1941('0x69'));db['ChatApplication']=db[_0x1941('0x1')]['import'](_0x1941('0x6a'));db[_0x1941('0x6b')]=db[_0x1941('0x1')]['import'](_0x1941('0x6c'));db[_0x1941('0x6d')]=db[_0x1941('0x1')][_0x1941('0x15')](_0x1941('0x6e'));db[_0x1941('0x6f')]=db['sequelize'][_0x1941('0x15')](_0x1941('0x70'));db['ChatQueue']=db[_0x1941('0x1')][_0x1941('0x15')](_0x1941('0x71'));db['ChatGroup']=db[_0x1941('0x1')][_0x1941('0x15')](_0x1941('0x72'));db[_0x1941('0x73')]=db['sequelize'][_0x1941('0x15')](_0x1941('0x74'));db[_0x1941('0x75')]=db[_0x1941('0x1')]['import'](_0x1941('0x76'));db[_0x1941('0x77')]=db[_0x1941('0x1')]['import'](_0x1941('0x78'));db[_0x1941('0x79')]=db[_0x1941('0x1')][_0x1941('0x15')](_0x1941('0x7a'));db[_0x1941('0x7b')]=db[_0x1941('0x1')][_0x1941('0x15')](_0x1941('0x7c'));db[_0x1941('0x7d')]=db[_0x1941('0x1')][_0x1941('0x15')](_0x1941('0x7e'));db[_0x1941('0x7f')]=db[_0x1941('0x1')][_0x1941('0x15')]('../api/cmHopperHistory/cmHopperHistory.model');db['ReportAgentPreview']=db[_0x1941('0x1')][_0x1941('0x15')](_0x1941('0x80'));db[_0x1941('0x81')]=db['sequelize'][_0x1941('0x15')](_0x1941('0x82'));db[_0x1941('0x83')]=db[_0x1941('0x1')][_0x1941('0x15')](_0x1941('0x84'));db[_0x1941('0x85')]=db[_0x1941('0x1')]['import'](_0x1941('0x86'));db[_0x1941('0x87')]=db[_0x1941('0x1')][_0x1941('0x15')](_0x1941('0x88'));db[_0x1941('0x89')]=db[_0x1941('0x1')][_0x1941('0x15')]('../api/disposition/disposition.model');db['Condition']=db[_0x1941('0x1')][_0x1941('0x15')](_0x1941('0x8a'));db[_0x1941('0x8b')]=db[_0x1941('0x1')][_0x1941('0x15')](_0x1941('0x8c'));db['Pause']=db['sequelize']['import'](_0x1941('0x8d'));db['Cdr']=db[_0x1941('0x1')][_0x1941('0x15')](_0x1941('0x8e'));db[_0x1941('0x8f')]=db[_0x1941('0x1')][_0x1941('0x15')]('../api/voiceQueuesLog/voiceQueuesLog.model');db['Schedule']=db[_0x1941('0x1')]['import'](_0x1941('0x90'));db['Sound']=db[_0x1941('0x1')][_0x1941('0x15')](_0x1941('0x91'));db[_0x1941('0x92')]=db[_0x1941('0x1')]['import']('../api/tag/tag.model');db[_0x1941('0x93')]=db['sequelize']['import'](_0x1941('0x94'));db[_0x1941('0x95')]=db[_0x1941('0x1')]['import'](_0x1941('0x96'));db[_0x1941('0x97')]=db[_0x1941('0x1')]['import']('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db[_0x1941('0x98')]=db[_0x1941('0x1')][_0x1941('0x15')]('../api/template/template.model');db[_0x1941('0x99')]=db['sequelize']['import']('../api/trigger/trigger.model');db[_0x1941('0x9a')]=db[_0x1941('0x1')]['import'](_0x1941('0x9b'));db[_0x1941('0x9c')]=db[_0x1941('0x1')]['import']('../api/integration/integration.model');db['IntegrationReport']=db[_0x1941('0x1')][_0x1941('0x15')](_0x1941('0x9d'));db[_0x1941('0x9e')]=db[_0x1941('0x1')][_0x1941('0x15')](_0x1941('0x9f'));db['AnalyticDefaultReport']=db[_0x1941('0x1')]['import'](_0x1941('0xa0'));db[_0x1941('0xa1')]=db[_0x1941('0x1')][_0x1941('0x15')](_0x1941('0xa2'));db[_0x1941('0xa3')]=db[_0x1941('0x1')][_0x1941('0x15')](_0x1941('0xa4'));db[_0x1941('0xa5')]=db[_0x1941('0x1')][_0x1941('0x15')]('../api/analyticFieldReport/analyticFieldReport.model');db['AnalyticTreeReport']=db[_0x1941('0x1')][_0x1941('0x15')]('../api/analyticTreeReport/analyticTreeReport.model');db['SalesforceAccount']=db[_0x1941('0x1')][_0x1941('0x15')](_0x1941('0xa6'));db['SalesforceConfiguration']=db[_0x1941('0x1')][_0x1941('0x15')](_0x1941('0xa7'));db['SalesforceField']=db[_0x1941('0x1')][_0x1941('0x15')](_0x1941('0xa8'));db[_0x1941('0xa9')]=db[_0x1941('0x1')]['import'](_0x1941('0xaa'));db[_0x1941('0xab')]=db[_0x1941('0x1')][_0x1941('0x15')](_0x1941('0xac'));db[_0x1941('0xad')]=db['sequelize'][_0x1941('0x15')]('../api/intSugarcrmField/intSugarcrmField.model');db[_0x1941('0xae')]=db[_0x1941('0x1')][_0x1941('0x15')](_0x1941('0xaf'));db[_0x1941('0xb0')]=db[_0x1941('0x1')][_0x1941('0x15')](_0x1941('0xb1'));db[_0x1941('0xb2')]=db[_0x1941('0x1')]['import'](_0x1941('0xb3'));db[_0x1941('0xb4')]=db[_0x1941('0x1')][_0x1941('0x15')](_0x1941('0xb5'));db['ZohoConfiguration']=db[_0x1941('0x1')][_0x1941('0x15')](_0x1941('0xb6'));db[_0x1941('0xb7')]=db[_0x1941('0x1')][_0x1941('0x15')]('../api/intZohoField/intZohoField.model');db[_0x1941('0xb8')]=db['sequelize']['import'](_0x1941('0xb9'));db[_0x1941('0xba')]=db[_0x1941('0x1')]['import']('../api/intZendeskConfiguration/intZendeskConfiguration.model');db['ZendeskField']=db[_0x1941('0x1')][_0x1941('0x15')]('../api/intZendeskField/intZendeskField.model');db[_0x1941('0xbb')]=db[_0x1941('0x1')][_0x1941('0x15')](_0x1941('0xbc'));db['FreshdeskConfiguration']=db[_0x1941('0x1')][_0x1941('0x15')](_0x1941('0xbd'));db[_0x1941('0xbe')]=db['sequelize'][_0x1941('0x15')](_0x1941('0xbf'));db['VtigerAccount']=db[_0x1941('0x1')][_0x1941('0x15')](_0x1941('0xc0'));db[_0x1941('0xc1')]=db[_0x1941('0x1')][_0x1941('0x15')](_0x1941('0xc2'));db[_0x1941('0xc3')]=db[_0x1941('0x1')]['import'](_0x1941('0xc4'));db[_0x1941('0xc5')]=db[_0x1941('0x1')]['import'](_0x1941('0xc6'));db[_0x1941('0xc7')]=db[_0x1941('0x1')][_0x1941('0x15')](_0x1941('0xc8'));db['ServicenowField']=db['sequelize']['import'](_0x1941('0xc9'));db[_0x1941('0xca')]=db[_0x1941('0x1')][_0x1941('0x15')](_0x1941('0xcb'));db[_0x1941('0xcc')]=db[_0x1941('0x1')][_0x1941('0x15')](_0x1941('0xcd'));db['Dynamics365Field']=db[_0x1941('0x1')][_0x1941('0x15')](_0x1941('0xce'));db['FreshsalesAccount']=db['sequelize'][_0x1941('0x15')](_0x1941('0xcf'));db[_0x1941('0xd0')]=db[_0x1941('0x1')][_0x1941('0x15')](_0x1941('0xd1'));db[_0x1941('0xd2')]=db['sequelize'][_0x1941('0x15')]('../api/intFreshsalesField/intFreshsalesField.model');db['Integration']=db['sequelize'][_0x1941('0x15')](_0x1941('0xd3'));db[_0x1941('0xd4')]=db[_0x1941('0x1')][_0x1941('0x15')](_0x1941('0xd5'));db[_0x1941('0xd6')]=db[_0x1941('0x1')][_0x1941('0x15')]('../api/chatQueueReport/chatQueueReport.model');db[_0x1941('0xd7')]=db['sequelize']['import'](_0x1941('0xd8'));db[_0x1941('0xd9')]=db['sequelize'][_0x1941('0x15')](_0x1941('0xda'));db[_0x1941('0xdb')]=db[_0x1941('0x1')][_0x1941('0x15')](_0x1941('0xdc'));db['JscriptySessionReport']=db[_0x1941('0x1')]['import'](_0x1941('0xdd'));db[_0x1941('0xde')]=db[_0x1941('0x1')][_0x1941('0x15')](_0x1941('0xdf'));db[_0x1941('0xe0')]=db[_0x1941('0x1')]['import'](_0x1941('0xe1'));db[_0x1941('0xe2')]=db[_0x1941('0x1')]['import'](_0x1941('0xe3'));db[_0x1941('0xe4')]=db['sequelize'][_0x1941('0x15')](_0x1941('0xe5'));db[_0x1941('0xe6')]=db[_0x1941('0x1')][_0x1941('0x15')]('../api/setting/setting.model');db[_0x1941('0xe7')]=db[_0x1941('0x1')][_0x1941('0x15')](_0x1941('0xe8'));db[_0x1941('0xe9')]=db['sequelize'][_0x1941('0x15')](_0x1941('0xea'));db[_0x1941('0xeb')]=db['sequelize'][_0x1941('0x15')]('../api/squareRecording/squareRecording.model');db[_0x1941('0xec')]=db[_0x1941('0x1')]['import'](_0x1941('0xed'));db[_0x1941('0xee')]=db[_0x1941('0x1')][_0x1941('0x15')]('../api/team/team.model');db['License']=db[_0x1941('0x1')]['import']('../api/license/license.model');db[_0x1941('0xef')]=db[_0x1941('0x1')]['import'](_0x1941('0xf0'));db[_0x1941('0xf1')]=db[_0x1941('0x1')][_0x1941('0x15')](_0x1941('0xf2'));db[_0x1941('0xf3')]=db[_0x1941('0x1')][_0x1941('0x15')](_0x1941('0xf4'));db[_0x1941('0xf5')]=db['sequelize'][_0x1941('0x15')]('../api/plugin/plugin.model');db[_0x1941('0xf6')]=db[_0x1941('0x1')][_0x1941('0x15')](_0x1941('0xf7'));db['ChatTransferReport']=db['sequelize'][_0x1941('0x15')](_0x1941('0xf8'));db[_0x1941('0xf9')]=db[_0x1941('0x1')]['import']('../api/faxTransferReport/faxTransferReport.model');db[_0x1941('0xfa')]=db['sequelize'][_0x1941('0x15')](_0x1941('0xfb'));db[_0x1941('0xfc')]=db[_0x1941('0x1')][_0x1941('0x15')](_0x1941('0xfd'));db[_0x1941('0xfe')]=db[_0x1941('0x1')][_0x1941('0x15')]('../api/cmList/cmList.model');db[_0x1941('0xff')]=db[_0x1941('0x1')][_0x1941('0x15')](_0x1941('0x100'));db['UserProfile']=db[_0x1941('0x1')][_0x1941('0x15')](_0x1941('0x101'));db['UserProfileSection']=db[_0x1941('0x1')][_0x1941('0x15')]('../api/userProfileSection/userProfileSection.model');db[_0x1941('0x102')]=db[_0x1941('0x1')][_0x1941('0x15')](_0x1941('0x103'));db[_0x1941('0x104')]=db['sequelize']['import'](_0x1941('0x105'));db['WhatsappAccount']=db[_0x1941('0x1')]['import'](_0x1941('0x106'));db[_0x1941('0x107')]=db[_0x1941('0x1')]['import'](_0x1941('0x108'));db[_0x1941('0x109')]=db['sequelize'][_0x1941('0x15')](_0x1941('0x10a'));db[_0x1941('0x10b')]=db[_0x1941('0x1')]['import'](_0x1941('0x10c'));db[_0x1941('0x10d')]=db[_0x1941('0x1')][_0x1941('0x15')](_0x1941('0x10e'));db[_0x1941('0x10f')]=db[_0x1941('0x1')][_0x1941('0x15')](_0x1941('0x110'));db[_0x1941('0x111')]=db[_0x1941('0x1')][_0x1941('0x15')](_0x1941('0x112'));db[_0x1941('0x113')]=db[_0x1941('0x1')][_0x1941('0x15')](_0x1941('0x114'));db[_0x1941('0x115')]=db[_0x1941('0x1')][_0x1941('0x15')](_0x1941('0x116'));db['TeamVoicePrefix']=db[_0x1941('0x1')][_0x1941('0x15')](_0x1941('0x117'));db[_0x1941('0x118')]=db['sequelize'][_0x1941('0x15')](_0x1941('0x119'));db['UserSetting']=db[_0x1941('0x1')]['import'](_0x1941('0x11a'));db[_0x1941('0x14')][_0x1941('0x11b')](db[_0x1941('0x22')],{'as':_0x1941('0x22'),'onDelete':_0x1941('0x11c'),'foreignKey':_0x1941('0x11d')});db[_0x1941('0x14')][_0x1941('0x11b')](db[_0x1941('0x11e')],{'as':_0x1941('0x11f'),'onDelete':_0x1941('0x11c'),'foreignKey':'UserId'});db[_0x1941('0x14')][_0x1941('0x120')](db[_0x1941('0x1f')],{'as':_0x1941('0x121'),'foreignKey':'UserId'});db[_0x1941('0x14')][_0x1941('0x120')](db[_0x1941('0x30')],{'as':_0x1941('0x122'),'foreignKey':'UserId'});db['User'][_0x1941('0x120')](db[_0x1941('0x1a')],{'as':_0x1941('0x123'),'onDelete':_0x1941('0x11c'),'hooks':!![]});db['User'][_0x1941('0x120')](db['CmHopperFinal'],{'as':_0x1941('0x124'),'foreignKey':_0x1941('0x11d')});db[_0x1941('0x14')][_0x1941('0x120')](db[_0x1941('0x7f')],{'as':'HopperHistory','foreignKey':_0x1941('0x11d')});db['User'][_0x1941('0x120')](db['ReportAgentPreview'],{'as':_0x1941('0x125'),'foreignKey':_0x1941('0x11d')});db[_0x1941('0x14')][_0x1941('0x120')](db[_0x1941('0x61')],{'as':_0x1941('0x126'),'foreignKey':'UserId'});db[_0x1941('0x14')][_0x1941('0x120')](db['ChatInteraction'],{'as':_0x1941('0x127'),'foreignKey':'UserId'});db[_0x1941('0x14')]['hasMany'](db[_0x1941('0x128')],{'as':_0x1941('0x129'),'foreignKey':_0x1941('0x11d')});db[_0x1941('0x14')][_0x1941('0x120')](db[_0x1941('0x12a')],{'as':'FaxInteractions','foreignKey':_0x1941('0x11d')});db[_0x1941('0x14')][_0x1941('0x120')](db[_0x1941('0x45')],{'as':'MailInteractions','foreignKey':_0x1941('0x11d')});db['User'][_0x1941('0x120')](db[_0x1941('0x109')],{'as':_0x1941('0x12b'),'foreignKey':'UserId'});db[_0x1941('0x14')][_0x1941('0x120')](db[_0x1941('0x104')],{'as':_0x1941('0x12c'),'foreignKey':'SenderId'});db[_0x1941('0x14')][_0x1941('0x12d')](db[_0x1941('0x12e')],{'as':_0x1941('0x12e'),'foreignKey':_0x1941('0x12f')});db[_0x1941('0x14')]['belongsToMany'](db[_0x1941('0x130')],{'as':_0x1941('0x131'),'through':'chat_group_has_users'});db[_0x1941('0x14')][_0x1941('0x132')](db[_0x1941('0x77')],{'as':_0x1941('0x133'),'through':_0x1941('0x134')});db['User'][_0x1941('0x132')](db['CmList'],{'as':_0x1941('0x135'),'through':_0x1941('0x136')});db[_0x1941('0x14')][_0x1941('0x132')](db[_0x1941('0xee')],{'through':_0x1941('0x137')});db[_0x1941('0x14')]['belongsToMany'](db[_0x1941('0x45')],{'as':_0x1941('0x138'),'through':_0x1941('0x139')});db[_0x1941('0x14')][_0x1941('0x132')](db[_0x1941('0x6b')],{'as':'ChatInteractions','through':_0x1941('0x13a')});db[_0x1941('0x14')]['belongsToMany'](db['FaxInteraction'],{'as':_0x1941('0x13b'),'through':_0x1941('0x13c')});db[_0x1941('0x14')]['belongsToMany'](db[_0x1941('0x128')],{'as':_0x1941('0x129'),'through':_0x1941('0x13d')});db['User'][_0x1941('0x132')](db['OpenchannelInteraction'],{'as':_0x1941('0x126'),'through':'user_has_openchannel_interactions'});db[_0x1941('0x14')][_0x1941('0x132')](db[_0x1941('0x109')],{'as':_0x1941('0x12b'),'through':'user_has_whatsapp_interactions'});db[_0x1941('0x14')][_0x1941('0x132')](db[_0x1941('0x1d')],{'as':_0x1941('0x13e'),'through':_0x1941('0x32'),'required':![]});db[_0x1941('0x14')]['belongsToMany'](db[_0x1941('0xff')],{'as':_0x1941('0x13f'),'through':_0x1941('0x118'),'required':![]});db['User'][_0x1941('0x132')](db[_0x1941('0x41')],{'as':_0x1941('0x140'),'through':_0x1941('0x141'),'required':![]});db[_0x1941('0x14')][_0x1941('0x132')](db[_0x1941('0x142')],{'as':_0x1941('0x143'),'through':_0x1941('0x33'),'required':![],'hooks':!![]});db[_0x1941('0x14')][_0x1941('0x132')](db[_0x1941('0x54')],{'as':'FaxQueues','through':_0x1941('0x36'),'required':![]});db['User']['belongsToMany'](db[_0x1941('0x5c')],{'as':'SmsQueues','through':_0x1941('0x38'),'required':![]});db[_0x1941('0x14')][_0x1941('0x132')](db[_0x1941('0x64')],{'as':_0x1941('0x144'),'through':_0x1941('0x145'),'required':![]});db[_0x1941('0x14')]['belongsToMany'](db[_0x1941('0x111')],{'as':_0x1941('0x146'),'through':_0x1941('0x3a'),'required':![]});db[_0x1941('0x14')][_0x1941('0x132')](db[_0x1941('0xfe')],{'through':'cm_user_has_lists'});db[_0x1941('0x14')]['belongsToMany'](db[_0x1941('0x66')],{'as':_0x1941('0x147'),'through':'user_has_chat_websites'});db['User']['belongsToMany'](db[_0x1941('0x4f')],{'as':_0x1941('0x148'),'through':'user_has_fax_accounts'});db[_0x1941('0x14')][_0x1941('0x132')](db[_0x1941('0x149')],{'as':_0x1941('0x14a'),'through':_0x1941('0x14b')});db[_0x1941('0x14')]['belongsToMany'](db[_0x1941('0x14c')],{'as':'OpenchannelAccounts','through':_0x1941('0x14d')});db[_0x1941('0x14')][_0x1941('0x132')](db[_0x1941('0x14e')],{'as':_0x1941('0x14f'),'through':_0x1941('0x150')});db[_0x1941('0x14')][_0x1941('0x132')](db['WhatsappAccount'],{'as':_0x1941('0x151'),'through':_0x1941('0x152')});db['User'][_0x1941('0x132')](db[_0x1941('0xe9')],{'as':_0x1941('0x153'),'through':_0x1941('0x154')});db[_0x1941('0x16')][_0x1941('0x120')](db[_0x1941('0x1a')],{'as':_0x1941('0x155'),'onDelete':_0x1941('0x11c'),'foreignKey':_0x1941('0x156')});db[_0x1941('0x18')][_0x1941('0x120')](db[_0x1941('0x1a')],{'onDelete':_0x1941('0x11c')});db[_0x1941('0x1a')][_0x1941('0x120')](db[_0x1941('0x1a')],{'as':_0x1941('0x157'),'onDelete':_0x1941('0x11c')});db[_0x1941('0x1b')]['belongsToMany'](db['Sound'],{'as':_0x1941('0x158'),'through':_0x1941('0x159')});db['VoiceQueue'][_0x1941('0x120')](db[_0x1941('0x30')],{'as':'Members','foreignKey':_0x1941('0x15a')});db[_0x1941('0x1d')][_0x1941('0x120')](db[_0x1941('0x79')],{'as':'Hoppers','foreignKey':_0x1941('0x15a')});db[_0x1941('0x1d')]['hasMany'](db[_0x1941('0x7d')],{'as':_0x1941('0x124'),'foreignKey':_0x1941('0x15a')});db[_0x1941('0x1d')][_0x1941('0x120')](db[_0x1941('0x7f')],{'as':_0x1941('0x15b'),'foreignKey':_0x1941('0x15a')});db[_0x1941('0x1d')][_0x1941('0x120')](db[_0x1941('0x125')],{'as':_0x1941('0x125'),'foreignKey':'VoiceQueueId'});db[_0x1941('0x1d')]['hasMany'](db[_0x1941('0x7b')],{'as':'HopperBlacks','foreignKey':'VoiceQueueId'});db[_0x1941('0x1d')][_0x1941('0x120')](db[_0x1941('0x15c')],{'as':'JscriptySessions','foreignKey':_0x1941('0x15a')});db[_0x1941('0x1d')]['belongsTo'](db['Trunk'],{'as':_0x1941('0x15d'),'foreignKey':'TrunkId'});db['VoiceQueue'][_0x1941('0x12d')](db[_0x1941('0x15d')],{'as':'TrunkBackup','foreignKey':_0x1941('0x15e')});db[_0x1941('0x1d')][_0x1941('0x12d')](db[_0x1941('0x8b')],{'as':_0x1941('0x8b'),'foreignKey':'IntervalId'});db[_0x1941('0x1d')][_0x1941('0x12d')](db[_0x1941('0x15f')],{'as':'mandatoryDispositionPause','foreignKey':_0x1941('0x160')});db[_0x1941('0x1d')][_0x1941('0x132')](db[_0x1941('0xfe')],{'as':_0x1941('0x135'),'through':'voice_queues_has_cm_lists'});db[_0x1941('0x1d')][_0x1941('0x132')](db[_0x1941('0x14')],{'as':_0x1941('0x161'),'through':_0x1941('0x32')});db[_0x1941('0x1d')]['belongsToMany'](db[_0x1941('0xee')],{'as':'Teams','through':_0x1941('0x115')});db[_0x1941('0x1d')][_0x1941('0x132')](db['CmList'],{'as':_0x1941('0x162'),'through':_0x1941('0x163')});db['VoiceRecording'][_0x1941('0x12d')](db[_0x1941('0x14')],{'as':'User','foreignKey':_0x1941('0x11d')});db['ScreenRecording']['belongsTo'](db[_0x1941('0x14')],{'as':'User','foreignKey':'UserId'});db[_0x1941('0x22')]['hasMany'](db[_0x1941('0x24')],{'as':_0x1941('0x164'),'onDelete':_0x1941('0x11c'),'foreignKey':'mailboxuser','sourceKey':_0x1941('0x165')});db[_0x1941('0x24')][_0x1941('0x12d')](db[_0x1941('0x22')],{'foreignKey':'mailboxuser','targetKey':_0x1941('0x165')});db[_0x1941('0x26')][_0x1941('0x120')](db[_0x1941('0x166')],{'as':_0x1941('0x167'),'foreignKey':_0x1941('0x168'),'constraints':![]});db[_0x1941('0x26')]['hasMany'](db['VoiceAgentReport'],{'as':'AgentReports','foreignKey':_0x1941('0x168'),'constraints':![]});db['VoiceCallReport'][_0x1941('0x12d')](db[_0x1941('0x14')],{'as':_0x1941('0x14'),'foreignKey':_0x1941('0x11d')});db['VoiceCallReport'][_0x1941('0x12d')](db['CmContact'],{'as':_0x1941('0x169'),'foreignKey':_0x1941('0x16a')});db[_0x1941('0x3c')][_0x1941('0x12d')](db['MailAccount'],{'as':_0x1941('0x149'),'foreignKey':_0x1941('0x16b')});db[_0x1941('0x3c')][_0x1941('0x12d')](db[_0x1941('0x113')],{'as':_0x1941('0x113'),'foreignKey':'CloudProviderId','onDelete':_0x1941('0x16c')});db[_0x1941('0x3e')]['belongsTo'](db[_0x1941('0x149')],{'as':_0x1941('0x149'),'foreignKey':_0x1941('0x16b')});db[_0x1941('0x3e')][_0x1941('0x12d')](db['CloudProvider'],{'as':_0x1941('0x113'),'foreignKey':_0x1941('0x16d'),'onDelete':_0x1941('0x16c')});db[_0x1941('0x149')]['hasOne'](db[_0x1941('0x3c')],{'as':_0x1941('0x16e'),'onDelete':_0x1941('0x11c')});db[_0x1941('0x149')][_0x1941('0x11b')](db['MailServerOut'],{'as':_0x1941('0x16f'),'onDelete':_0x1941('0x11c')});db[_0x1941('0x149')][_0x1941('0x120')](db['Disposition'],{'as':_0x1941('0x170'),'foreignKey':_0x1941('0x16b'),'onDelete':_0x1941('0x11c')});db[_0x1941('0x149')][_0x1941('0x120')](db[_0x1941('0x87')],{'as':_0x1941('0x171'),'foreignKey':_0x1941('0x16b')});db['MailAccount'][_0x1941('0x120')](db[_0x1941('0x47')],{'as':'Messages','foreignKey':_0x1941('0x16b')});db[_0x1941('0x149')][_0x1941('0x120')](db[_0x1941('0x45')],{'as':_0x1941('0x172')});db['MailAccount'][_0x1941('0x120')](db[_0x1941('0x48')],{'as':_0x1941('0x157')});db['MailAccount'][_0x1941('0x12d')](db[_0x1941('0xfe')],{'as':_0x1941('0x173'),'foreignKey':'ListId'});db[_0x1941('0x149')][_0x1941('0x12d')](db[_0x1941('0x98')],{'as':_0x1941('0x98'),'foreignKey':_0x1941('0x174')});db[_0x1941('0x149')][_0x1941('0x12d')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x1941('0x160')});db[_0x1941('0x149')][_0x1941('0x132')](db[_0x1941('0x14')],{'as':_0x1941('0x161'),'through':_0x1941('0x14b')});db['MailQueue'][_0x1941('0x132')](db[_0x1941('0x14')],{'as':_0x1941('0x161'),'through':_0x1941('0x141')});db[_0x1941('0x41')][_0x1941('0x132')](db['Team'],{'through':_0x1941('0x175'),'as':_0x1941('0x176')});db[_0x1941('0x45')]['hasMany'](db[_0x1941('0x47')],{'as':'Messages','onDelete':_0x1941('0x11c'),'foreignKey':_0x1941('0x177')});db[_0x1941('0x45')][_0x1941('0x12d')](db[_0x1941('0x149')],{'as':_0x1941('0x178'),'foreignKey':_0x1941('0x16b')});db['MailInteraction'][_0x1941('0x12d')](db[_0x1941('0x77')],{'as':_0x1941('0x169'),'foreignKey':_0x1941('0x16a')});db['MailInteraction'][_0x1941('0x12d')](db[_0x1941('0x14')],{'as':_0x1941('0x179'),'foreignKey':'UserId'});db['MailInteraction'][_0x1941('0x132')](db[_0x1941('0x92')],{'through':_0x1941('0x17a'),'as':_0x1941('0x17b')});db[_0x1941('0x45')]['belongsToMany'](db['Tag'],{'through':_0x1941('0x17a'),'as':_0x1941('0x17c')});db[_0x1941('0x45')][_0x1941('0x132')](db[_0x1941('0x14')],{'as':'Users','through':_0x1941('0x139'),'foreignKey':'MailInteractionId'});db[_0x1941('0x47')][_0x1941('0x120')](db[_0x1941('0xf3')],{'as':'Attachments','onDelete':'cascade'});db['MailMessage'][_0x1941('0x12d')](db[_0x1941('0x14')],{'as':_0x1941('0x14')});db[_0x1941('0x47')][_0x1941('0x12d')](db[_0x1941('0x77')],{'onDelete':_0x1941('0x11c'),'as':_0x1941('0x169')});db['MailMessage'][_0x1941('0x12d')](db[_0x1941('0x45')],{'as':_0x1941('0x17d'),'foreignKey':_0x1941('0x177')});db['MailMessage'][_0x1941('0x12d')](db['MailAccount'],{'as':_0x1941('0x178'),'foreignKey':'MailAccountId'});db[_0x1941('0x47')][_0x1941('0x12d')](db[_0x1941('0x66')],{'as':'ChatWebsite','foreignKey':_0x1941('0x17e')});db[_0x1941('0x47')][_0x1941('0x12d')](db[_0x1941('0x6f')],{'as':_0x1941('0x6f'),'foreignKey':'ChatOfflineMessageId'});db[_0x1941('0x48')][_0x1941('0x12d')](db['User'],{'onDelete':_0x1941('0x16c')});db['MailApplication']['belongsTo'](db[_0x1941('0x41')],{'onDelete':_0x1941('0x16c')});db['MailApplication'][_0x1941('0x12d')](db[_0x1941('0x149')],{'onDelete':'restrict'});db[_0x1941('0x48')]['belongsTo'](db[_0x1941('0x8b')],{'onDelete':'restrict','foreignKey':_0x1941('0x17f')});db['MailApplication'][_0x1941('0x12d')](db['Tag'],{'onDelete':_0x1941('0x16c'),'foreignKey':_0x1941('0x180')});db[_0x1941('0x4a')][_0x1941('0x12d')](db[_0x1941('0x149')],{});db[_0x1941('0x4a')][_0x1941('0x12d')](db['CmList'],{'as':'List','foreignKey':_0x1941('0x181')});db['MailQueueReport']['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':'ContactId'});db['MailQueueReport'][_0x1941('0x12d')](db[_0x1941('0x45')],{});db[_0x1941('0x4a')][_0x1941('0x12d')](db[_0x1941('0x47')],{});db['MailQueueReport'][_0x1941('0x12d')](db[_0x1941('0x14')],{});db[_0x1941('0x4a')][_0x1941('0x12d')](db[_0x1941('0x41')],{});db['Dashboard'][_0x1941('0x120')](db['DashboardItem'],{'as':'Items','onDelete':_0x1941('0x11c')});db[_0x1941('0x4f')][_0x1941('0x120')](db[_0x1941('0x89')],{'as':_0x1941('0x170'),'foreignKey':'FaxAccountId','onDelete':_0x1941('0x11c')});db[_0x1941('0x4f')][_0x1941('0x120')](db[_0x1941('0x87')],{'as':'Answers','foreignKey':_0x1941('0x182')});db[_0x1941('0x4f')][_0x1941('0x120')](db[_0x1941('0x12a')],{'as':'Interactions'});db[_0x1941('0x4f')][_0x1941('0x120')](db[_0x1941('0x51')],{'as':_0x1941('0x157')});db[_0x1941('0x4f')][_0x1941('0x120')](db['VoiceExtension'],{'as':_0x1941('0x183'),'onDelete':'cascade'});db['FaxAccount'][_0x1941('0x120')](db['FaxMessage'],{'as':'Messages'});db[_0x1941('0x4f')]['belongsTo'](db[_0x1941('0x15d')],{'as':_0x1941('0x15d')});db[_0x1941('0x4f')]['belongsTo'](db[_0x1941('0xfe')],{'as':_0x1941('0x173'),'foreignKey':'ListId'});db['FaxAccount'][_0x1941('0x12d')](db[_0x1941('0x15f')],{'as':_0x1941('0x184'),'foreignKey':_0x1941('0x160')});db['FaxAccount'][_0x1941('0x132')](db['User'],{'as':_0x1941('0x161'),'through':_0x1941('0x185')});db[_0x1941('0x51')][_0x1941('0x12d')](db[_0x1941('0x14')],{'onDelete':'restrict'});db[_0x1941('0x51')]['belongsTo'](db['FaxQueue'],{'onDelete':_0x1941('0x16c')});db[_0x1941('0x51')]['belongsTo'](db[_0x1941('0x4f')],{'onDelete':'restrict'});db['FaxApplication'][_0x1941('0x12d')](db[_0x1941('0x92')],{'onDelete':'restrict','foreignKey':_0x1941('0x180')});db[_0x1941('0x12a')]['hasMany'](db[_0x1941('0x52')],{'as':_0x1941('0x164'),'onDelete':_0x1941('0x11c'),'foreignKey':'FaxInteractionId'});db[_0x1941('0x12a')][_0x1941('0x12d')](db[_0x1941('0x4f')],{'as':_0x1941('0x178'),'foreignKey':_0x1941('0x182')});db[_0x1941('0x12a')][_0x1941('0x12d')](db['CmContact'],{'as':_0x1941('0x169'),'foreignKey':_0x1941('0x16a')});db[_0x1941('0x12a')][_0x1941('0x12d')](db[_0x1941('0x14')],{'as':_0x1941('0x179'),'foreignKey':'UserId'});db[_0x1941('0x12a')]['belongsToMany'](db[_0x1941('0x92')],{'through':_0x1941('0x186'),'as':'Tags'});db['FaxInteraction'][_0x1941('0x132')](db[_0x1941('0x92')],{'through':_0x1941('0x186'),'as':_0x1941('0x17c')});db[_0x1941('0x12a')][_0x1941('0x132')](db[_0x1941('0x14')],{'as':_0x1941('0x187'),'through':_0x1941('0x13c'),'foreignKey':'FaxInteractionId'});db[_0x1941('0x52')][_0x1941('0x12d')](db[_0x1941('0x14')],{'onDelete':_0x1941('0x11c'),'as':_0x1941('0x14')});db[_0x1941('0x52')]['belongsTo'](db[_0x1941('0x12a')],{'as':'Interaction','foreignKey':_0x1941('0x188')});db[_0x1941('0x52')]['belongsTo'](db[_0x1941('0x77')],{'onDelete':_0x1941('0x11c'),'as':_0x1941('0x169')});db['FaxMessage'][_0x1941('0x12d')](db[_0x1941('0xf3')],{'as':_0x1941('0xf3'),'foreignKey':'AttachmentId'});db[_0x1941('0x52')][_0x1941('0x12d')](db[_0x1941('0x4f')],{'as':_0x1941('0x178'),'foreignKey':'FaxAccountId'});db['FaxQueue'][_0x1941('0x132')](db['User'],{'as':_0x1941('0x161'),'through':_0x1941('0x36')});db[_0x1941('0x54')][_0x1941('0x132')](db[_0x1941('0xee')],{'through':_0x1941('0x189'),'as':_0x1941('0x176')});db['FaxQueueReport'][_0x1941('0x12d')](db[_0x1941('0x4f')],{});db[_0x1941('0x56')][_0x1941('0x12d')](db[_0x1941('0xfe')],{'as':_0x1941('0x173'),'foreignKey':'ListId'});db[_0x1941('0x56')][_0x1941('0x12d')](db['CmContact'],{'as':_0x1941('0x169'),'foreignKey':'ContactId'});db[_0x1941('0x56')][_0x1941('0x12d')](db[_0x1941('0x12a')],{});db[_0x1941('0x56')][_0x1941('0x12d')](db[_0x1941('0x52')],{});db[_0x1941('0x56')][_0x1941('0x12d')](db[_0x1941('0x14')],{});db[_0x1941('0x56')][_0x1941('0x12d')](db['FaxQueue'],{});db['SmsAccount'][_0x1941('0x120')](db['Disposition'],{'as':_0x1941('0x170'),'foreignKey':_0x1941('0x18a'),'onDelete':_0x1941('0x11c')});db[_0x1941('0x14e')]['hasMany'](db[_0x1941('0x87')],{'as':'Answers','foreignKey':_0x1941('0x18a')});db[_0x1941('0x14e')]['hasMany'](db[_0x1941('0x5a')],{'as':_0x1941('0x164'),'foreignKey':_0x1941('0x18a')});db[_0x1941('0x14e')][_0x1941('0x120')](db['SmsInteraction'],{'as':'Interactions'});db[_0x1941('0x14e')][_0x1941('0x120')](db[_0x1941('0x58')],{'as':_0x1941('0x157')});db['SmsAccount'][_0x1941('0x12d')](db[_0x1941('0xfe')],{'as':_0x1941('0x173'),'foreignKey':_0x1941('0x181')});db[_0x1941('0x14e')][_0x1941('0x12d')](db[_0x1941('0x15f')],{'as':_0x1941('0x184'),'foreignKey':_0x1941('0x160')});db[_0x1941('0x14e')][_0x1941('0x132')](db[_0x1941('0x14')],{'as':_0x1941('0x161'),'through':_0x1941('0x150')});db['SmsApplication'][_0x1941('0x12d')](db[_0x1941('0x14')],{'onDelete':_0x1941('0x16c')});db[_0x1941('0x58')][_0x1941('0x12d')](db[_0x1941('0x5c')],{'onDelete':_0x1941('0x16c')});db[_0x1941('0x58')][_0x1941('0x12d')](db[_0x1941('0x14e')],{'onDelete':_0x1941('0x16c')});db[_0x1941('0x58')][_0x1941('0x12d')](db[_0x1941('0x8b')],{'onDelete':_0x1941('0x16c'),'foreignKey':_0x1941('0x17f')});db[_0x1941('0x58')][_0x1941('0x12d')](db[_0x1941('0x92')],{'onDelete':_0x1941('0x16c'),'foreignKey':_0x1941('0x180')});db[_0x1941('0x128')][_0x1941('0x120')](db[_0x1941('0x5a')],{'as':_0x1941('0x164'),'onDelete':_0x1941('0x11c'),'foreignKey':_0x1941('0x18b')});db['SmsInteraction'][_0x1941('0x12d')](db[_0x1941('0x14e')],{'as':_0x1941('0x178'),'foreignKey':_0x1941('0x18a')});db[_0x1941('0x128')][_0x1941('0x12d')](db[_0x1941('0x77')],{'as':'Contact','foreignKey':_0x1941('0x16a')});db[_0x1941('0x128')][_0x1941('0x12d')](db[_0x1941('0x14')],{'as':_0x1941('0x179'),'foreignKey':_0x1941('0x11d')});db['SmsInteraction']['belongsToMany'](db[_0x1941('0x92')],{'through':_0x1941('0x18c'),'as':_0x1941('0x17b')});db[_0x1941('0x128')]['belongsToMany'](db['Tag'],{'through':'sms_interaction_has_tags','as':_0x1941('0x17c')});db[_0x1941('0x128')]['belongsToMany'](db[_0x1941('0x14')],{'as':_0x1941('0x187'),'through':_0x1941('0x13d'),'foreignKey':'SmsInteractionId'});db[_0x1941('0x5a')][_0x1941('0x12d')](db[_0x1941('0x14')],{'as':_0x1941('0x14')});db[_0x1941('0x5a')][_0x1941('0x12d')](db[_0x1941('0x77')],{'onDelete':'cascade','as':_0x1941('0x169')});db['SmsMessage']['belongsTo'](db[_0x1941('0x128')],{'onDelete':_0x1941('0x11c'),'as':_0x1941('0x17d'),'foreignKey':_0x1941('0x18b')});db['SmsMessage'][_0x1941('0x12d')](db[_0x1941('0x14e')],{'as':_0x1941('0x178'),'foreignKey':_0x1941('0x18a')});db[_0x1941('0x5c')][_0x1941('0x132')](db[_0x1941('0x14')],{'as':_0x1941('0x161'),'through':_0x1941('0x38'),'foreignKey':'SmsQueueId'});db[_0x1941('0x5c')][_0x1941('0x132')](db[_0x1941('0xee')],{'through':_0x1941('0x18d'),'as':_0x1941('0x176')});db['OpenchannelAccount'][_0x1941('0x120')](db[_0x1941('0x89')],{'as':_0x1941('0x170'),'foreignKey':'OpenchannelAccountId','onDelete':_0x1941('0x11c')});db[_0x1941('0x14c')][_0x1941('0x120')](db[_0x1941('0x87')],{'as':_0x1941('0x171'),'foreignKey':_0x1941('0x18e')});db[_0x1941('0x14c')][_0x1941('0x120')](db[_0x1941('0x61')],{'as':_0x1941('0x172'),'foreignKey':'OpenchannelAccountId'});db[_0x1941('0x14c')][_0x1941('0x120')](db['OpenchannelMessage'],{'as':_0x1941('0x164'),'foreignKey':_0x1941('0x18e')});db[_0x1941('0x14c')][_0x1941('0x120')](db[_0x1941('0x5f')],{'as':_0x1941('0x157'),'foreignKey':_0x1941('0x18e')});db[_0x1941('0x14c')]['belongsTo'](db[_0x1941('0xfe')],{'as':'List','foreignKey':'ListId'});db[_0x1941('0x14c')][_0x1941('0x12d')](db[_0x1941('0x15f')],{'as':_0x1941('0x184'),'foreignKey':_0x1941('0x160')});db[_0x1941('0x14c')]['belongsToMany'](db[_0x1941('0x14')],{'as':_0x1941('0x161'),'through':_0x1941('0x14d')});db['OpenchannelApplication'][_0x1941('0x12d')](db[_0x1941('0x14')],{'onDelete':'restrict'});db[_0x1941('0x5f')][_0x1941('0x12d')](db[_0x1941('0x64')],{'onDelete':'restrict','foreignKey':'OpenchannelQueueId'});db[_0x1941('0x5f')]['belongsTo'](db[_0x1941('0x14c')],{'onDelete':_0x1941('0x16c'),'foreignKey':_0x1941('0x18e')});db['OpenchannelApplication'][_0x1941('0x12d')](db[_0x1941('0x8b')],{'onDelete':_0x1941('0x16c'),'foreignKey':_0x1941('0x17f')});db[_0x1941('0x5f')]['belongsTo'](db[_0x1941('0x92')],{'onDelete':_0x1941('0x16c'),'foreignKey':_0x1941('0x180')});db['OpenchannelInteraction'][_0x1941('0x120')](db[_0x1941('0x63')],{'as':_0x1941('0x164'),'onDelete':_0x1941('0x11c'),'foreignKey':_0x1941('0x18f')});db[_0x1941('0x61')][_0x1941('0x12d')](db[_0x1941('0x14c')],{'as':'Account','foreignKey':_0x1941('0x18e')});db[_0x1941('0x61')]['belongsTo'](db[_0x1941('0x77')],{'as':_0x1941('0x169'),'foreignKey':_0x1941('0x16a')});db['OpenchannelInteraction'][_0x1941('0x12d')](db['User'],{'as':_0x1941('0x179'),'foreignKey':_0x1941('0x11d')});db[_0x1941('0x61')]['belongsToMany'](db[_0x1941('0x92')],{'through':_0x1941('0x190'),'as':_0x1941('0x17b')});db[_0x1941('0x61')][_0x1941('0x132')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x1941('0x17c')});db[_0x1941('0x61')]['belongsToMany'](db[_0x1941('0x14')],{'as':_0x1941('0x187'),'through':_0x1941('0x191'),'foreignKey':_0x1941('0x18f')});db[_0x1941('0x63')]['belongsTo'](db['User'],{'onDelete':_0x1941('0x11c'),'as':'User'});db[_0x1941('0x63')]['belongsTo'](db['CmContact'],{'onDelete':_0x1941('0x11c'),'as':_0x1941('0x169')});db['OpenchannelMessage']['belongsTo'](db[_0x1941('0x61')],{'onDelete':_0x1941('0x11c'),'as':_0x1941('0x17d'),'foreignKey':_0x1941('0x18f')});db['OpenchannelMessage'][_0x1941('0x12d')](db[_0x1941('0xf3')],{'as':_0x1941('0xf3'),'foreignKey':_0x1941('0x192')});db['OpenchannelMessage'][_0x1941('0x12d')](db[_0x1941('0x14c')],{'as':_0x1941('0x178'),'foreignKey':_0x1941('0x18e')});db[_0x1941('0x64')][_0x1941('0x132')](db[_0x1941('0x14')],{'as':_0x1941('0x161'),'through':_0x1941('0x145'),'foreignKey':_0x1941('0x193')});db[_0x1941('0x64')][_0x1941('0x132')](db[_0x1941('0xee')],{'through':'team_has_openchannel_queues','as':_0x1941('0x176')});db[_0x1941('0x66')][_0x1941('0x120')](db[_0x1941('0x89')],{'as':_0x1941('0x170'),'foreignKey':_0x1941('0x17e'),'onDelete':'cascade'});db[_0x1941('0x66')][_0x1941('0x120')](db[_0x1941('0x87')],{'as':_0x1941('0x171'),'foreignKey':'ChatWebsiteId'});db[_0x1941('0x66')][_0x1941('0x120')](db[_0x1941('0x73')],{'as':_0x1941('0x194')});db[_0x1941('0x66')][_0x1941('0x120')](db['ChatInteraction'],{'as':_0x1941('0x172')});db[_0x1941('0x66')][_0x1941('0x120')](db[_0x1941('0x195')],{'as':_0x1941('0x157')});db[_0x1941('0x66')][_0x1941('0x120')](db['ChatMessage'],{'as':_0x1941('0x164')});db[_0x1941('0x66')][_0x1941('0x12d')](db[_0x1941('0xfe')],{'as':'List','foreignKey':_0x1941('0x181')});db[_0x1941('0x66')]['belongsTo'](db[_0x1941('0x8b')],{'as':_0x1941('0x8b'),'foreignKey':_0x1941('0x17f')});db[_0x1941('0x66')]['belongsTo'](db['MailAccount'],{'as':_0x1941('0x149'),'foreignKey':_0x1941('0x16b')});db[_0x1941('0x66')][_0x1941('0x12d')](db['Pause'],{'as':_0x1941('0x184'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x1941('0x66')][_0x1941('0x132')](db[_0x1941('0x14')],{'as':_0x1941('0x161'),'through':_0x1941('0x196')});db[_0x1941('0x68')][_0x1941('0x12d')](db[_0x1941('0x14c')],{});db['OpenchannelQueueReport'][_0x1941('0x12d')](db[_0x1941('0xfe')],{'as':_0x1941('0x173'),'foreignKey':'ListId'});db[_0x1941('0x68')][_0x1941('0x12d')](db[_0x1941('0x77')],{'as':'Contact','foreignKey':_0x1941('0x16a')});db[_0x1941('0x68')]['belongsTo'](db['OpenchannelInteraction'],{});db[_0x1941('0x68')][_0x1941('0x12d')](db[_0x1941('0x63')],{});db[_0x1941('0x68')][_0x1941('0x12d')](db['User'],{});db[_0x1941('0x68')][_0x1941('0x12d')](db['OpenchannelQueue'],{});db[_0x1941('0x195')]['belongsTo'](db[_0x1941('0x14')],{'as':'Agent','foreignKey':_0x1941('0x11d'),'onDelete':_0x1941('0x16c')});db[_0x1941('0x195')][_0x1941('0x12d')](db[_0x1941('0x142')],{'as':'Queue','foreignKey':_0x1941('0x197'),'onDelete':_0x1941('0x16c')});db[_0x1941('0x195')]['belongsTo'](db[_0x1941('0x66')],{'as':'Website','foreignKey':_0x1941('0x17e'),'onDelete':_0x1941('0x16c')});db[_0x1941('0x195')][_0x1941('0x12d')](db[_0x1941('0x92')],{'onDelete':_0x1941('0x16c'),'foreignKey':_0x1941('0x180')});db[_0x1941('0x6b')][_0x1941('0x120')](db[_0x1941('0x6d')],{'as':'Messages','onDelete':_0x1941('0x11c'),'foreignKey':'ChatInteractionId'});db['ChatInteraction'][_0x1941('0x12d')](db[_0x1941('0x66')],{'as':_0x1941('0x178'),'foreignKey':_0x1941('0x17e')});db[_0x1941('0x6b')][_0x1941('0x12d')](db[_0x1941('0x77')],{'as':_0x1941('0x169'),'foreignKey':_0x1941('0x16a')});db['ChatInteraction'][_0x1941('0x12d')](db[_0x1941('0x14')],{'as':'Owner','foreignKey':_0x1941('0x11d')});db['ChatInteraction'][_0x1941('0x132')](db[_0x1941('0x92')],{'through':_0x1941('0x198'),'as':_0x1941('0x17b')});db[_0x1941('0x6b')][_0x1941('0x132')](db['Tag'],{'through':_0x1941('0x198'),'as':'ThroughTags'});db[_0x1941('0x6b')][_0x1941('0x132')](db[_0x1941('0x14')],{'as':_0x1941('0x187'),'through':_0x1941('0x13a'),'foreignKey':'ChatInteractionId'});db['ChatMessage'][_0x1941('0x12d')](db['User'],{'onDelete':_0x1941('0x11c'),'as':_0x1941('0x14')});db['ChatMessage']['belongsTo'](db['CmContact'],{'onDelete':_0x1941('0x11c'),'as':_0x1941('0x169'),'foreignKey':_0x1941('0x16a')});db[_0x1941('0x6d')][_0x1941('0x12d')](db[_0x1941('0x6b')],{'onDelete':_0x1941('0x11c'),'as':_0x1941('0x17d'),'foreignKey':_0x1941('0x199')});db[_0x1941('0x6d')][_0x1941('0x12d')](db['Attachment'],{'as':_0x1941('0xf3'),'foreignKey':_0x1941('0x192')});db[_0x1941('0x6d')]['belongsTo'](db['ChatWebsite'],{'as':_0x1941('0x178'),'foreignKey':'ChatWebsiteId'});db[_0x1941('0x6f')]['hasMany'](db[_0x1941('0xf3')],{'as':_0x1941('0x19a'),'foreignKey':_0x1941('0x19b'),'onDelete':'cascade','hooks':!![]});db['ChatOfflineMessage'][_0x1941('0x12d')](db[_0x1941('0x77')],{'onDelete':_0x1941('0x11c'),'as':_0x1941('0x169'),'foreignKey':_0x1941('0x16a')});db['ChatOfflineMessage'][_0x1941('0x12d')](db[_0x1941('0x66')],{'as':_0x1941('0x178'),'foreignKey':'ChatWebsiteId'});db['ChatQueue']['belongsToMany'](db[_0x1941('0x14')],{'as':_0x1941('0x161'),'through':'UserChatQueue','hooks':!![]});db[_0x1941('0x142')][_0x1941('0x132')](db['Team'],{'through':_0x1941('0x19c'),'as':_0x1941('0x176')});db[_0x1941('0x130')]['hasMany'](db[_0x1941('0xd7')],{'as':_0x1941('0x164'),'foreignKey':_0x1941('0x19d'),'onDelete':_0x1941('0x11c')});db['ChatGroup'][_0x1941('0x132')](db['User'],{'as':_0x1941('0x19e'),'through':_0x1941('0x19f')});db[_0x1941('0x73')][_0x1941('0x12d')](db['ChatWebsite'],{'as':'Website','foreignKey':_0x1941('0x17e')});db[_0x1941('0x75')][_0x1941('0x120')](db[_0x1941('0x77')],{'as':_0x1941('0x133'),'foreignKey':'CompanyId'});db['CmContact']['hasMany'](db[_0x1941('0x95')],{'as':_0x1941('0x1a0'),'foreignKey':_0x1941('0x1a1')});db['CmContact']['hasMany'](db[_0x1941('0x79')],{'as':_0x1941('0x1a2'),'foreignKey':_0x1941('0x16a')});db[_0x1941('0x77')][_0x1941('0x120')](db[_0x1941('0x7d')],{'as':_0x1941('0x124'),'foreignKey':_0x1941('0x16a')});db[_0x1941('0x77')][_0x1941('0x120')](db['CmHopperHistory'],{'as':_0x1941('0x15b'),'foreignKey':_0x1941('0x16a')});db[_0x1941('0x77')][_0x1941('0x120')](db[_0x1941('0x125')],{'as':_0x1941('0x125'),'foreignKey':_0x1941('0x16a')});db[_0x1941('0x77')][_0x1941('0x120')](db[_0x1941('0x15c')],{'as':_0x1941('0x1a3'),'foreignKey':'ContactId'});db[_0x1941('0x77')][_0x1941('0x120')](db[_0x1941('0x61')],{'as':'OpenchannelInteractions','foreignKey':'ContactId','onDelete':_0x1941('0x16c')});db[_0x1941('0x77')][_0x1941('0x120')](db['ChatInteraction'],{'as':_0x1941('0x127'),'foreignKey':_0x1941('0x16a'),'onDelete':_0x1941('0x16c')});db[_0x1941('0x77')][_0x1941('0x120')](db[_0x1941('0x128')],{'as':_0x1941('0x129'),'foreignKey':_0x1941('0x16a'),'onDelete':'restrict'});db[_0x1941('0x77')][_0x1941('0x120')](db['FaxInteraction'],{'as':_0x1941('0x13b'),'foreignKey':_0x1941('0x16a'),'onDelete':'restrict'});db[_0x1941('0x77')][_0x1941('0x120')](db['MailInteraction'],{'as':'MailInteractions','foreignKey':'ContactId','onDelete':_0x1941('0x16c')});db['CmContact'][_0x1941('0x12d')](db[_0x1941('0x75')],{'as':_0x1941('0x1a4'),'foreignKey':_0x1941('0x1a5')});db[_0x1941('0x77')]['belongsTo'](db['CmList'],{'as':_0x1941('0x173'),'foreignKey':_0x1941('0x181'),'onDelete':_0x1941('0x11c')});db[_0x1941('0x77')][_0x1941('0x132')](db['User'],{'as':_0x1941('0x187'),'through':_0x1941('0x134')});db[_0x1941('0x77')][_0x1941('0x132')](db[_0x1941('0x92')],{'as':_0x1941('0x17b'),'through':_0x1941('0x1a6')});db['CmContact'][_0x1941('0x132')](db[_0x1941('0x92')],{'through':_0x1941('0x1a6'),'as':'ThroughTags'});db[_0x1941('0x79')]['hasMany'](db[_0x1941('0x97')],{'as':_0x1941('0x1a7'),'foreignKey':_0x1941('0x1a8')});db[_0x1941('0x79')][_0x1941('0x12d')](db['CmContact'],{'as':_0x1941('0x169'),'foreignKey':'ContactId','onDelete':_0x1941('0x11c')});db[_0x1941('0x79')][_0x1941('0x12d')](db[_0x1941('0xfe')],{'as':_0x1941('0x173'),'foreignKey':_0x1941('0x181'),'onDelete':_0x1941('0x11c')});db[_0x1941('0x79')][_0x1941('0x12d')](db[_0x1941('0x14')],{'as':_0x1941('0x1a9'),'foreignKey':_0x1941('0x11d')});db[_0x1941('0x79')][_0x1941('0x12d')](db[_0x1941('0x1d')],{'as':'Queue','foreignKey':_0x1941('0x15a'),'onDelete':_0x1941('0x11c')});db[_0x1941('0x79')]['belongsTo'](db[_0x1941('0xef')],{'as':_0x1941('0xef'),'foreignKey':'CampaignId','onDelete':_0x1941('0x11c')});db[_0x1941('0x79')][_0x1941('0x12d')](db[_0x1941('0x14')],{'as':_0x1941('0x179'),'foreignKey':_0x1941('0x1aa')});db[_0x1941('0x7b')][_0x1941('0x12d')](db[_0x1941('0x77')],{'as':'Contact','foreignKey':'ContactId','onDelete':'cascade'});db[_0x1941('0x7b')][_0x1941('0x12d')](db[_0x1941('0xfe')],{'as':_0x1941('0x173'),'foreignKey':_0x1941('0x181'),'onDelete':_0x1941('0x11c')});db[_0x1941('0x7b')][_0x1941('0x12d')](db[_0x1941('0x1d')],{'as':_0x1941('0x1ab'),'foreignKey':_0x1941('0x15a'),'onDelete':'cascade'});db[_0x1941('0x7b')][_0x1941('0x12d')](db[_0x1941('0xef')],{'as':_0x1941('0xef'),'foreignKey':_0x1941('0x1ac'),'onDelete':'cascade'});db['Automation'][_0x1941('0x120')](db[_0x1941('0x1ad')],{'as':{'plural':_0x1941('0x1ae'),'singular':_0x1941('0x1af')},'foreignKey':_0x1941('0x1b0'),'onDelete':_0x1941('0x11c'),'hooks':!![]});db[_0x1941('0x85')][_0x1941('0x120')](db[_0x1941('0x1ad')],{'as':{'plural':'Any','singular':_0x1941('0x1b1')},'foreignKey':'AutomationAnyId','onDelete':_0x1941('0x11c'),'hooks':!![]});db[_0x1941('0x85')][_0x1941('0x120')](db[_0x1941('0x83')],{'as':_0x1941('0x1b2'),'foreignKey':_0x1941('0x1b3'),'onDelete':_0x1941('0x11c'),'hooks':!![]});db['Disposition']['hasMany'](db[_0x1941('0x89')],{'as':_0x1941('0x170'),'foreignKey':_0x1941('0x1b4'),'onDelete':_0x1941('0x11c')});db['Interval']['hasMany'](db['Interval'],{'as':_0x1941('0x1b5'),'foreignKey':_0x1941('0x17f'),'onDelete':'cascade','hooks':!![],'required':![]});db['Interval']['hasMany'](db['VoiceExtension'],{'as':'Extensions','foreignKey':_0x1941('0x17f'),'onDelete':_0x1941('0x16c')});db['Interval'][_0x1941('0x120')](db[_0x1941('0x48')],{'as':'MailApplications','foreignKey':'IntervalId'});db['Interval'][_0x1941('0x120')](db['ChatApplication'],{'as':_0x1941('0x1b6'),'foreignKey':_0x1941('0x17f')});db[_0x1941('0x8b')][_0x1941('0x120')](db[_0x1941('0x51')],{'as':_0x1941('0x1b7'),'foreignKey':_0x1941('0x17f')});db['Interval'][_0x1941('0x120')](db[_0x1941('0x58')],{'as':_0x1941('0x1b8'),'foreignKey':_0x1941('0x17f')});db[_0x1941('0x1b9')]['belongsTo'](db['MailAccount'],{});db[_0x1941('0x1b9')]['belongsTo'](db['AnalyticDefaultReport'],{'foreignKey':'DefaultReportId'});db['Schedule'][_0x1941('0x12d')](db['AnalyticCustomReport'],{'foreignKey':_0x1941('0x1ba')});db[_0x1941('0x1bb')][_0x1941('0x132')](db[_0x1941('0x1b')],{'as':_0x1941('0x1bc'),'through':_0x1941('0x159'),'onDelete':_0x1941('0x16c')});db[_0x1941('0x92')][_0x1941('0x132')](db[_0x1941('0x77')],{'through':_0x1941('0x1a6')});db[_0x1941('0x92')][_0x1941('0x132')](db['ChatInteraction'],{'through':_0x1941('0x198')});db[_0x1941('0x92')]['belongsToMany'](db[_0x1941('0x45')],{'through':_0x1941('0x17a')});db[_0x1941('0x92')]['belongsToMany'](db[_0x1941('0x128')],{'through':_0x1941('0x18c')});db[_0x1941('0x92')][_0x1941('0x132')](db[_0x1941('0x12a')],{'through':_0x1941('0x186')});db['Tag'][_0x1941('0x132')](db[_0x1941('0x61')],{'through':'openchannel_interaction_has_tags'});db[_0x1941('0x92')][_0x1941('0x132')](db[_0x1941('0x109')],{'through':_0x1941('0x1bd')});db['CmContactHasItem'][_0x1941('0x12d')](db[_0x1941('0x93')],{'as':_0x1941('0x1be'),'foreignKey':'ItemTypeId'});db[_0x1941('0x97')][_0x1941('0x12d')](db[_0x1941('0x79')],{'as':'Hopper','foreignKey':_0x1941('0x1a8')});db[_0x1941('0x95')][_0x1941('0x12d')](db[_0x1941('0x77')],{'as':'Contact','foreignKey':_0x1941('0x1a1')});db[_0x1941('0x99')]['hasMany'](db[_0x1941('0x1ad')],{'as':{'plural':_0x1941('0x1bf'),'singular':_0x1941('0x1c0')},'foreignKey':_0x1941('0x1c1'),'onDelete':_0x1941('0x11c'),'hooks':!![]});db[_0x1941('0x99')][_0x1941('0x120')](db[_0x1941('0x1ad')],{'as':{'plural':_0x1941('0x1c2'),'singular':_0x1941('0x1c3')},'foreignKey':_0x1941('0x1c4'),'onDelete':_0x1941('0x11c'),'hooks':!![]});db[_0x1941('0x99')][_0x1941('0x120')](db[_0x1941('0x83')],{'as':_0x1941('0x1b2'),'foreignKey':_0x1941('0x1c5'),'onDelete':_0x1941('0x11c'),'hooks':!![]});db[_0x1941('0x9e')][_0x1941('0x120')](db['AnalyticFieldReport'],{'as':_0x1941('0x1c6'),'onDelete':_0x1941('0x11c'),'foreignKey':_0x1941('0x1ba'),'hooks':!![]});db[_0x1941('0x1c7')][_0x1941('0x120')](db[_0x1941('0xa5')],{'as':_0x1941('0x1c6'),'onDelete':'cascade','foreignKey':_0x1941('0x1c8')});db['AnalyticMetric'][_0x1941('0x120')](db[_0x1941('0xa5')],{'as':_0x1941('0x1c6'),'onDelete':_0x1941('0x11c'),'foreignKey':_0x1941('0x1c9')});db[_0x1941('0xa5')][_0x1941('0x12d')](db[_0x1941('0xa3')],{'foreignKey':'MetricId'});db[_0x1941('0x1ca')][_0x1941('0x120')](db[_0x1941('0x1cb')],{'as':'Configurations','onDelete':'cascade','foreignKey':'AccountId'});db[_0x1941('0x1cb')][_0x1941('0x120')](db[_0x1941('0x1cc')],{'as':'Subjects','onDelete':_0x1941('0x11c'),'foreignKey':_0x1941('0x1cd')});db[_0x1941('0x1cb')][_0x1941('0x120')](db['SalesforceField'],{'as':_0x1941('0x1ce'),'onDelete':_0x1941('0x11c'),'foreignKey':_0x1941('0x1cf')});db[_0x1941('0x1cb')][_0x1941('0x120')](db['SalesforceField'],{'as':_0x1941('0x1c6'),'onDelete':_0x1941('0x11c'),'foreignKey':_0x1941('0x1d0')});db[_0x1941('0x1cb')][_0x1941('0x12d')](db[_0x1941('0x1ca')],{'as':'Account','foreignKey':_0x1941('0x1d1')});db[_0x1941('0x1cc')]['hasMany'](db[_0x1941('0x1cc')],{'as':_0x1941('0x1d2'),'foreignKey':'SubjectId'});db[_0x1941('0x1cc')]['hasMany'](db[_0x1941('0x1cc')],{'as':_0x1941('0x1d3'),'foreignKey':_0x1941('0x1cf')});db['SalesforceField'][_0x1941('0x120')](db[_0x1941('0x1cc')],{'as':_0x1941('0x1d4'),'foreignKey':_0x1941('0x1d0')});db[_0x1941('0x1cc')][_0x1941('0x12d')](db[_0x1941('0x9a')],{'as':'Variable','foreignKey':_0x1941('0x1d5')});db[_0x1941('0xa9')][_0x1941('0x120')](db[_0x1941('0xab')],{'as':'Configurations','onDelete':_0x1941('0x11c'),'foreignKey':_0x1941('0x1d1')});db[_0x1941('0xab')]['hasMany'](db['SugarcrmField'],{'as':_0x1941('0x1d6'),'onDelete':'cascade','foreignKey':_0x1941('0x1cd')});db[_0x1941('0xab')]['hasMany'](db[_0x1941('0xad')],{'as':_0x1941('0x1ce'),'onDelete':_0x1941('0x11c'),'foreignKey':_0x1941('0x1cf')});db['SugarcrmConfiguration']['hasMany'](db[_0x1941('0xad')],{'as':_0x1941('0x1c6'),'onDelete':_0x1941('0x11c'),'foreignKey':'FieldId'});db[_0x1941('0xab')]['belongsTo'](db['SugarcrmAccount'],{'as':_0x1941('0x178'),'foreignKey':'AccountId'});db[_0x1941('0xad')][_0x1941('0x120')](db[_0x1941('0xad')],{'as':_0x1941('0x1d2'),'foreignKey':'SubjectId'});db[_0x1941('0xad')][_0x1941('0x120')](db[_0x1941('0xad')],{'as':'Description','foreignKey':_0x1941('0x1cf')});db[_0x1941('0xad')][_0x1941('0x120')](db['SugarcrmField'],{'as':_0x1941('0x1d4'),'foreignKey':_0x1941('0x1d0')});db[_0x1941('0xad')][_0x1941('0x12d')](db['Variable'],{'as':_0x1941('0x9a'),'foreignKey':_0x1941('0x1d5')});db[_0x1941('0xae')]['hasMany'](db[_0x1941('0xb0')],{'as':_0x1941('0x1d7'),'onDelete':_0x1941('0x11c'),'foreignKey':'AccountId'});db[_0x1941('0xb0')][_0x1941('0x120')](db['DeskField'],{'as':_0x1941('0x1d6'),'onDelete':_0x1941('0x11c'),'foreignKey':_0x1941('0x1cd')});db['DeskConfiguration'][_0x1941('0x120')](db[_0x1941('0xb2')],{'as':_0x1941('0x1ce'),'onDelete':'cascade','foreignKey':_0x1941('0x1cf')});db[_0x1941('0xb0')][_0x1941('0x120')](db['DeskField'],{'as':_0x1941('0x1c6'),'onDelete':_0x1941('0x11c'),'foreignKey':_0x1941('0x1d0')});db[_0x1941('0xb0')][_0x1941('0x12d')](db[_0x1941('0xae')],{'as':_0x1941('0x178'),'foreignKey':_0x1941('0x1d1')});db[_0x1941('0xb0')]['belongsToMany'](db[_0x1941('0x92')],{'through':_0x1941('0x1d8')});db[_0x1941('0xb2')][_0x1941('0x120')](db[_0x1941('0xb2')],{'as':_0x1941('0x1d2'),'foreignKey':_0x1941('0x1cd')});db[_0x1941('0xb2')][_0x1941('0x120')](db[_0x1941('0xb2')],{'as':_0x1941('0x1d3'),'foreignKey':_0x1941('0x1cf')});db[_0x1941('0xb2')][_0x1941('0x120')](db[_0x1941('0xb2')],{'as':_0x1941('0x1d4'),'foreignKey':'FieldId'});db[_0x1941('0xb2')][_0x1941('0x12d')](db['Variable'],{'as':'Variable','foreignKey':_0x1941('0x1d5')});db[_0x1941('0xb4')][_0x1941('0x120')](db['ZohoConfiguration'],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x1941('0x1d1')});db[_0x1941('0x1d9')][_0x1941('0x120')](db['ZohoField'],{'as':_0x1941('0x1d6'),'onDelete':_0x1941('0x11c'),'foreignKey':_0x1941('0x1cd')});db[_0x1941('0x1d9')][_0x1941('0x120')](db[_0x1941('0xb7')],{'as':_0x1941('0x1ce'),'onDelete':'cascade','foreignKey':_0x1941('0x1cf')});db[_0x1941('0x1d9')][_0x1941('0x120')](db[_0x1941('0xb7')],{'as':_0x1941('0x1c6'),'onDelete':_0x1941('0x11c'),'foreignKey':_0x1941('0x1d0')});db[_0x1941('0x1d9')][_0x1941('0x12d')](db['ZohoAccount'],{'as':_0x1941('0x178'),'foreignKey':_0x1941('0x1d1')});db['ZohoField'][_0x1941('0x120')](db['ZohoField'],{'as':'Subject','foreignKey':_0x1941('0x1cd')});db[_0x1941('0xb7')][_0x1941('0x120')](db[_0x1941('0xb7')],{'as':'Description','foreignKey':_0x1941('0x1cf')});db['ZohoField']['hasMany'](db[_0x1941('0xb7')],{'as':_0x1941('0x1d4'),'foreignKey':_0x1941('0x1d0')});db['ZohoField']['belongsTo'](db[_0x1941('0x9a')],{'as':_0x1941('0x9a'),'foreignKey':'VariableId'});db[_0x1941('0xb8')][_0x1941('0x120')](db[_0x1941('0xba')],{'as':'Configurations','onDelete':_0x1941('0x11c'),'foreignKey':_0x1941('0x1d1')});db['ZendeskConfiguration'][_0x1941('0x120')](db['ZendeskField'],{'as':'Subjects','foreignKey':_0x1941('0x1cd')});db[_0x1941('0xba')]['hasMany'](db['ZendeskField'],{'as':'Descriptions','foreignKey':_0x1941('0x1cf')});db[_0x1941('0xba')][_0x1941('0x120')](db['ZendeskField'],{'as':_0x1941('0x1c6'),'foreignKey':'FieldId'});db[_0x1941('0xba')]['belongsTo'](db[_0x1941('0xb8')],{'as':_0x1941('0x178'),'foreignKey':_0x1941('0x1d1')});db['ZendeskConfiguration']['belongsToMany'](db[_0x1941('0x92')],{'through':_0x1941('0x1da')});db['ZendeskField'][_0x1941('0x120')](db['ZendeskField'],{'as':_0x1941('0x1d2'),'foreignKey':_0x1941('0x1cd')});db[_0x1941('0x1db')][_0x1941('0x120')](db['ZendeskField'],{'as':_0x1941('0x1d3'),'foreignKey':_0x1941('0x1cf')});db['ZendeskField']['hasMany'](db[_0x1941('0x1db')],{'as':_0x1941('0x1d4'),'foreignKey':_0x1941('0x1d0')});db[_0x1941('0x1db')][_0x1941('0x12d')](db[_0x1941('0x9a')],{'as':_0x1941('0x9a'),'foreignKey':_0x1941('0x1d5')});db[_0x1941('0xbb')][_0x1941('0x120')](db[_0x1941('0x1dc')],{'as':_0x1941('0x1d7'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x1941('0x1dc')]['hasMany'](db['FreshdeskField'],{'as':_0x1941('0x1d6'),'onDelete':_0x1941('0x11c'),'foreignKey':_0x1941('0x1cd')});db[_0x1941('0x1dc')][_0x1941('0x120')](db[_0x1941('0xbe')],{'as':'Descriptions','onDelete':_0x1941('0x11c'),'foreignKey':_0x1941('0x1cf')});db[_0x1941('0x1dc')][_0x1941('0x120')](db[_0x1941('0xbe')],{'as':_0x1941('0x1c6'),'onDelete':'cascade','foreignKey':_0x1941('0x1d0')});db['FreshdeskConfiguration'][_0x1941('0x12d')](db[_0x1941('0xbb')],{'as':'Account','foreignKey':_0x1941('0x1d1')});db[_0x1941('0x1dc')][_0x1941('0x132')](db[_0x1941('0x92')],{'through':_0x1941('0x1dd')});db['FreshdeskField'][_0x1941('0x120')](db[_0x1941('0xbe')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x1941('0xbe')][_0x1941('0x120')](db[_0x1941('0xbe')],{'as':_0x1941('0x1d3'),'foreignKey':_0x1941('0x1cf')});db[_0x1941('0xbe')][_0x1941('0x120')](db['FreshdeskField'],{'as':_0x1941('0x1d4'),'foreignKey':'FieldId'});db['FreshdeskField'][_0x1941('0x12d')](db['Variable'],{'as':_0x1941('0x9a'),'foreignKey':_0x1941('0x1d5')});db[_0x1941('0x1de')][_0x1941('0x120')](db['VtigerConfiguration'],{'as':_0x1941('0x1d7'),'onDelete':_0x1941('0x11c'),'foreignKey':_0x1941('0x1d1')});db[_0x1941('0xc1')][_0x1941('0x120')](db[_0x1941('0xc3')],{'as':'Subjects','foreignKey':_0x1941('0x1cd')});db['VtigerConfiguration'][_0x1941('0x120')](db[_0x1941('0xc3')],{'as':_0x1941('0x1ce'),'foreignKey':_0x1941('0x1cf')});db[_0x1941('0xc1')]['hasMany'](db['VtigerField'],{'as':_0x1941('0x1c6'),'foreignKey':_0x1941('0x1d0')});db[_0x1941('0xc1')][_0x1941('0x12d')](db[_0x1941('0x1de')],{'as':_0x1941('0x178'),'foreignKey':_0x1941('0x1d1')});db[_0x1941('0xc3')]['hasMany'](db['VtigerField'],{'as':_0x1941('0x1d2'),'foreignKey':_0x1941('0x1cd')});db[_0x1941('0xc3')][_0x1941('0x120')](db[_0x1941('0xc3')],{'as':_0x1941('0x1d3'),'foreignKey':_0x1941('0x1cf')});db[_0x1941('0xc3')]['hasMany'](db[_0x1941('0xc3')],{'as':'Field','foreignKey':_0x1941('0x1d0')});db[_0x1941('0xc3')][_0x1941('0x12d')](db['Variable'],{'as':'Variable','foreignKey':_0x1941('0x1d5')});db['ServicenowAccount'][_0x1941('0x120')](db[_0x1941('0xc7')],{'as':_0x1941('0x1d7'),'onDelete':_0x1941('0x11c'),'foreignKey':'AccountId'});db[_0x1941('0xc7')][_0x1941('0x120')](db[_0x1941('0x1df')],{'as':'Subjects','foreignKey':'SubjectId'});db['ServicenowConfiguration'][_0x1941('0x120')](db['ServicenowField'],{'as':_0x1941('0x1ce'),'foreignKey':_0x1941('0x1cf')});db['ServicenowConfiguration']['hasMany'](db[_0x1941('0x1df')],{'as':_0x1941('0x1c6'),'foreignKey':_0x1941('0x1d0')});db[_0x1941('0xc7')]['belongsTo'](db[_0x1941('0xc5')],{'as':_0x1941('0x178'),'foreignKey':_0x1941('0x1d1')});db[_0x1941('0x1df')][_0x1941('0x120')](db[_0x1941('0x1df')],{'as':_0x1941('0x1d2'),'foreignKey':_0x1941('0x1cd')});db[_0x1941('0x1df')][_0x1941('0x120')](db[_0x1941('0x1df')],{'as':_0x1941('0x1d3'),'foreignKey':_0x1941('0x1cf')});db[_0x1941('0x1df')][_0x1941('0x120')](db['ServicenowField'],{'as':'Field','foreignKey':'FieldId'});db[_0x1941('0x1df')][_0x1941('0x12d')](db[_0x1941('0x9a')],{'as':_0x1941('0x9a'),'foreignKey':_0x1941('0x1d5')});db[_0x1941('0xca')]['hasMany'](db['Dynamics365Configuration'],{'as':_0x1941('0x1d7'),'onDelete':'cascade','foreignKey':_0x1941('0x1d1')});db[_0x1941('0xca')]['belongsTo'](db[_0x1941('0x113')],{'as':'CloudProvider','foreignKey':'CloudProviderId'});db['Dynamics365Configuration'][_0x1941('0x120')](db['Dynamics365Field'],{'as':_0x1941('0x1d6'),'onDelete':_0x1941('0x11c'),'foreignKey':_0x1941('0x1cd')});db[_0x1941('0xcc')]['hasMany'](db[_0x1941('0x1e0')],{'as':_0x1941('0x1ce'),'onDelete':_0x1941('0x11c'),'foreignKey':_0x1941('0x1cf')});db['Dynamics365Configuration'][_0x1941('0x120')](db[_0x1941('0x1e0')],{'as':_0x1941('0x1c6'),'onDelete':_0x1941('0x11c'),'foreignKey':_0x1941('0x1d0')});db[_0x1941('0xcc')][_0x1941('0x12d')](db[_0x1941('0xca')],{'as':'Account','foreignKey':_0x1941('0x1d1')});db[_0x1941('0x1e0')][_0x1941('0x120')](db[_0x1941('0x1e0')],{'as':_0x1941('0x1d2'),'foreignKey':_0x1941('0x1cd')});db[_0x1941('0x1e0')][_0x1941('0x120')](db['Dynamics365Field'],{'as':_0x1941('0x1d3'),'foreignKey':_0x1941('0x1cf')});db[_0x1941('0x1e0')][_0x1941('0x120')](db['Dynamics365Field'],{'as':_0x1941('0x1d4'),'foreignKey':'FieldId'});db[_0x1941('0x1e0')][_0x1941('0x12d')](db[_0x1941('0x9a')],{'as':_0x1941('0x9a'),'foreignKey':_0x1941('0x1d5')});db[_0x1941('0x1e1')]['hasMany'](db[_0x1941('0xd0')],{'as':_0x1941('0x1d7'),'onDelete':_0x1941('0x11c'),'foreignKey':'AccountId'});db[_0x1941('0xd0')][_0x1941('0x120')](db[_0x1941('0xd2')],{'as':_0x1941('0x1d6'),'foreignKey':'SubjectId'});db['FreshsalesConfiguration']['hasMany'](db[_0x1941('0xd2')],{'as':_0x1941('0x1ce'),'foreignKey':_0x1941('0x1cf')});db[_0x1941('0xd0')][_0x1941('0x120')](db['FreshsalesField'],{'as':_0x1941('0x1c6'),'foreignKey':_0x1941('0x1d0')});db[_0x1941('0xd0')][_0x1941('0x12d')](db[_0x1941('0x1e1')],{'as':_0x1941('0x178'),'foreignKey':_0x1941('0x1d1')});db['FreshsalesField']['hasMany'](db[_0x1941('0xd2')],{'as':_0x1941('0x1d2'),'foreignKey':_0x1941('0x1cd')});db[_0x1941('0xd2')][_0x1941('0x120')](db[_0x1941('0xd2')],{'as':_0x1941('0x1d3'),'foreignKey':_0x1941('0x1cf')});db[_0x1941('0xd2')][_0x1941('0x120')](db[_0x1941('0xd2')],{'as':_0x1941('0x1d4'),'foreignKey':_0x1941('0x1d0')});db[_0x1941('0xd2')][_0x1941('0x12d')](db[_0x1941('0x9a')],{'as':'Variable','foreignKey':_0x1941('0x1d5')});db['ChatQueueReport'][_0x1941('0x12d')](db[_0x1941('0x66')],{});db[_0x1941('0xd6')][_0x1941('0x12d')](db[_0x1941('0xfe')],{'as':_0x1941('0x173'),'foreignKey':_0x1941('0x181')});db[_0x1941('0xd6')][_0x1941('0x12d')](db['CmContact'],{'as':_0x1941('0x169'),'foreignKey':_0x1941('0x16a')});db[_0x1941('0xd6')][_0x1941('0x12d')](db[_0x1941('0x6b')],{});db[_0x1941('0xd6')][_0x1941('0x12d')](db['ChatMessage'],{});db[_0x1941('0xd6')][_0x1941('0x12d')](db[_0x1941('0x14')],{});db[_0x1941('0xd6')][_0x1941('0x12d')](db[_0x1941('0x142')],{});db[_0x1941('0xd7')]['belongsTo'](db[_0x1941('0x14')],{'onDelete':_0x1941('0x11c'),'foreignKey':'FromId'});db[_0x1941('0xd7')][_0x1941('0x12d')](db['User'],{'onDelete':_0x1941('0x11c'),'foreignKey':_0x1941('0x1e2')});db[_0x1941('0x15c')][_0x1941('0x120')](db[_0x1941('0xdb')],{'foreignKey':_0x1941('0x1e3'),'onDelete':'cascade'});db['JscriptySessionReport'][_0x1941('0x120')](db[_0x1941('0xd9')],{'foreignKey':_0x1941('0x1e3'),'onDelete':_0x1941('0x11c')});db[_0x1941('0xde')][_0x1941('0x12d')](db[_0x1941('0x14e')],{});db[_0x1941('0xde')][_0x1941('0x12d')](db[_0x1941('0xfe')],{'as':'List','foreignKey':_0x1941('0x181')});db[_0x1941('0xde')][_0x1941('0x12d')](db[_0x1941('0x77')],{'as':'Contact','foreignKey':_0x1941('0x16a')});db[_0x1941('0xde')]['belongsTo'](db[_0x1941('0x128')],{});db[_0x1941('0xde')][_0x1941('0x12d')](db[_0x1941('0x5a')],{});db[_0x1941('0xde')][_0x1941('0x12d')](db[_0x1941('0x14')],{});db[_0x1941('0xde')][_0x1941('0x12d')](db[_0x1941('0x5c')],{});db[_0x1941('0xe4')][_0x1941('0x120')](db['JscriptySessionReport'],{'foreignKey':_0x1941('0x1e4')});db[_0x1941('0xe4')][_0x1941('0x120')](db[_0x1941('0xdb')],{'foreignKey':_0x1941('0x1e4')});db[_0x1941('0xe4')][_0x1941('0x120')](db[_0x1941('0xd9')],{'foreignKey':_0x1941('0x1e4')});db['SquareProject']['belongsToMany'](db['User'],{'as':_0x1941('0x187'),'through':'user_has_square_projects'});db[_0x1941('0xee')][_0x1941('0x132')](db['User'],{'as':'Agents','through':_0x1941('0x137')});db[_0x1941('0xee')][_0x1941('0x132')](db[_0x1941('0x1d')],{'through':_0x1941('0x115'),'as':'VoiceQueues'});db['Team'][_0x1941('0x132')](db['MailQueue'],{'through':_0x1941('0x175'),'as':_0x1941('0x140')});db[_0x1941('0xee')][_0x1941('0x132')](db[_0x1941('0x142')],{'through':_0x1941('0x19c'),'as':_0x1941('0x143')});db[_0x1941('0xee')]['belongsToMany'](db['FaxQueue'],{'through':_0x1941('0x189'),'as':_0x1941('0x1e5')});db[_0x1941('0xee')][_0x1941('0x132')](db[_0x1941('0x5c')],{'through':'team_has_sms_queues','as':'SmsQueues'});db['Team'][_0x1941('0x132')](db[_0x1941('0x64')],{'through':_0x1941('0x1e6'),'as':_0x1941('0x144')});db[_0x1941('0xee')]['belongsToMany'](db[_0x1941('0x111')],{'through':_0x1941('0x1e7'),'as':_0x1941('0x146')});db[_0x1941('0xee')][_0x1941('0x132')](db[_0x1941('0xff')],{'through':_0x1941('0x1e8'),'as':_0x1941('0x13f')});db[_0x1941('0xef')][_0x1941('0x120')](db[_0x1941('0x79')],{'as':_0x1941('0x1a2'),'foreignKey':'CampaignId'});db[_0x1941('0xef')][_0x1941('0x120')](db[_0x1941('0x7d')],{'as':_0x1941('0x124'),'foreignKey':'CampaignId'});db[_0x1941('0xef')][_0x1941('0x120')](db[_0x1941('0x7f')],{'as':'HopperHistories','foreignKey':_0x1941('0x1ac')});db['Campaign'][_0x1941('0x120')](db['CmHopperBlack'],{'as':_0x1941('0x1e9'),'foreignKey':_0x1941('0x1ac')});db[_0x1941('0xef')][_0x1941('0x12d')](db[_0x1941('0x15d')],{'as':_0x1941('0x15d'),'foreignKey':_0x1941('0x1ea')});db[_0x1941('0xef')][_0x1941('0x12d')](db['Trunk'],{'as':_0x1941('0x1eb'),'foreignKey':'TrunkBackupId'});db[_0x1941('0xef')][_0x1941('0x12d')](db[_0x1941('0x8b')],{'as':_0x1941('0x8b'),'foreignKey':_0x1941('0x17f')});db[_0x1941('0xef')][_0x1941('0x12d')](db[_0x1941('0xe9')],{'as':'SquareProject','foreignKey':'SquareProjectId'});db['Campaign']['belongsToMany'](db[_0x1941('0xfe')],{'as':_0x1941('0x135'),'through':_0x1941('0x1ec')});db[_0x1941('0xef')][_0x1941('0x132')](db[_0x1941('0xfe')],{'as':_0x1941('0x162'),'through':_0x1941('0x1ed')});db['Attachment'][_0x1941('0x12d')](db['ChatOfflineMessage'],{'as':_0x1941('0x6f'),'foreignKey':_0x1941('0x19b')});db[_0x1941('0xf6')][_0x1941('0x12d')](db[_0x1941('0x47')],{});db[_0x1941('0xf6')][_0x1941('0x12d')](db[_0x1941('0x45')],{});db['MailTransferReport']['belongsTo'](db[_0x1941('0x149')],{'foreignKey':_0x1941('0x1ee'),'as':_0x1941('0x1ef')});db[_0x1941('0xf6')][_0x1941('0x12d')](db[_0x1941('0x14')],{'foreignKey':'FromUserId','as':_0x1941('0x1f0')});db['MailTransferReport']['belongsTo'](db[_0x1941('0x14')],{'foreignKey':'ToUserId','as':_0x1941('0x1f1')});db[_0x1941('0xf6')][_0x1941('0x12d')](db[_0x1941('0x41')],{'foreignKey':'ToMailQueueId','as':_0x1941('0x1f2')});db[_0x1941('0xf6')][_0x1941('0x12d')](db[_0x1941('0x149')],{'foreignKey':'ToMailAccountId','as':_0x1941('0x1f3')});db[_0x1941('0x1f4')][_0x1941('0x12d')](db[_0x1941('0x6d')],{});db['ChatTransferReport']['belongsTo'](db[_0x1941('0x6b')],{});db[_0x1941('0x1f4')][_0x1941('0x12d')](db[_0x1941('0x66')],{'foreignKey':_0x1941('0x1f5'),'as':_0x1941('0x1ef')});db[_0x1941('0x1f4')]['belongsTo'](db[_0x1941('0x14')],{'foreignKey':'FromUserId','as':_0x1941('0x1f0')});db[_0x1941('0x1f4')]['belongsTo'](db['User'],{'foreignKey':'ToUserId','as':_0x1941('0x1f1')});db[_0x1941('0x1f4')]['belongsTo'](db[_0x1941('0x142')],{'foreignKey':_0x1941('0x1f6'),'as':_0x1941('0x1f2')});db[_0x1941('0x1f4')][_0x1941('0x12d')](db[_0x1941('0x66')],{'foreignKey':_0x1941('0x1f7'),'as':_0x1941('0x1f3')});db[_0x1941('0xf9')]['belongsTo'](db[_0x1941('0x52')],{});db[_0x1941('0xf9')]['belongsTo'](db[_0x1941('0x12a')],{});db['FaxTransferReport'][_0x1941('0x12d')](db[_0x1941('0x4f')],{'foreignKey':_0x1941('0x1f8'),'as':_0x1941('0x1ef')});db[_0x1941('0xf9')][_0x1941('0x12d')](db[_0x1941('0x14')],{'foreignKey':_0x1941('0x1f9'),'as':_0x1941('0x1f0')});db['FaxTransferReport'][_0x1941('0x12d')](db[_0x1941('0x14')],{'foreignKey':'ToUserId','as':_0x1941('0x1f1')});db['FaxTransferReport'][_0x1941('0x12d')](db[_0x1941('0x54')],{'foreignKey':_0x1941('0x1fa'),'as':'ToQueue'});db[_0x1941('0xf9')]['belongsTo'](db[_0x1941('0x4f')],{'foreignKey':_0x1941('0x1fb'),'as':'ToAccount'});db[_0x1941('0xfa')][_0x1941('0x12d')](db[_0x1941('0x63')],{});db['OpenchannelTransferReport'][_0x1941('0x12d')](db[_0x1941('0x61')],{});db[_0x1941('0xfa')][_0x1941('0x12d')](db[_0x1941('0x14c')],{'foreignKey':_0x1941('0x1fc'),'as':_0x1941('0x1ef')});db[_0x1941('0xfa')][_0x1941('0x12d')](db[_0x1941('0x14')],{'foreignKey':_0x1941('0x1f9'),'as':_0x1941('0x1f0')});db[_0x1941('0xfa')]['belongsTo'](db[_0x1941('0x14')],{'foreignKey':_0x1941('0x1fd'),'as':'ToAgent'});db[_0x1941('0xfa')]['belongsTo'](db[_0x1941('0x64')],{'foreignKey':'ToOpenchannelQueueId','as':_0x1941('0x1f2')});db[_0x1941('0xfa')][_0x1941('0x12d')](db[_0x1941('0x14c')],{'foreignKey':_0x1941('0x1fe'),'as':'ToAccount'});db['SmsTransferReport'][_0x1941('0x12d')](db[_0x1941('0x5a')],{});db['SmsTransferReport']['belongsTo'](db['SmsInteraction'],{});db[_0x1941('0xfc')][_0x1941('0x12d')](db['SmsAccount'],{'foreignKey':_0x1941('0x1ff'),'as':_0x1941('0x1ef')});db['SmsTransferReport']['belongsTo'](db[_0x1941('0x14')],{'foreignKey':_0x1941('0x1f9'),'as':_0x1941('0x1f0')});db[_0x1941('0xfc')][_0x1941('0x12d')](db[_0x1941('0x14')],{'foreignKey':_0x1941('0x1fd'),'as':_0x1941('0x1f1')});db[_0x1941('0xfc')][_0x1941('0x12d')](db[_0x1941('0x5c')],{'foreignKey':_0x1941('0x200'),'as':_0x1941('0x1f2')});db[_0x1941('0xfc')][_0x1941('0x12d')](db[_0x1941('0x14e')],{'foreignKey':_0x1941('0x201'),'as':_0x1941('0x1f3')});db[_0x1941('0xfe')][_0x1941('0x120')](db['Disposition'],{'as':_0x1941('0x170'),'foreignKey':_0x1941('0x181'),'onDelete':_0x1941('0x11c')});db[_0x1941('0xfe')]['hasMany'](db[_0x1941('0x81')],{'as':_0x1941('0x202'),'foreignKey':_0x1941('0x181')});db[_0x1941('0xfe')][_0x1941('0x120')](db[_0x1941('0x77')],{'as':'Contacts','onDelete':_0x1941('0x11c'),'foreignKey':'ListId'});db['CmList'][_0x1941('0x120')](db[_0x1941('0x7d')],{'as':'HopperFinals','foreignKey':'ListId'});db[_0x1941('0xfe')][_0x1941('0x120')](db['CmHopperHistory'],{'as':_0x1941('0x203'),'foreignKey':_0x1941('0x181')});db[_0x1941('0xfe')][_0x1941('0x120')](db[_0x1941('0x125')],{'as':_0x1941('0x125'),'foreignKey':'ListId'});db[_0x1941('0xfe')][_0x1941('0x132')](db[_0x1941('0x1d')],{'as':_0x1941('0x204'),'through':_0x1941('0x205')});db[_0x1941('0xfe')]['belongsToMany'](db['User'],{'as':'Agents','through':_0x1941('0x136')});db['VoicePrefix'][_0x1941('0x120')](db[_0x1941('0x1a')],{'as':'Extensions','onDelete':_0x1941('0x11c')});db['VoicePrefix'][_0x1941('0x132')](db[_0x1941('0x14')],{'as':_0x1941('0x161'),'through':_0x1941('0x118')});db[_0x1941('0xff')][_0x1941('0x132')](db[_0x1941('0xee')],{'through':_0x1941('0x1e8'),'as':_0x1941('0x176')});db[_0x1941('0x12e')][_0x1941('0x120')](db[_0x1941('0x14')],{'as':_0x1941('0x187'),'foreignKey':'userProfileId'});db[_0x1941('0x12e')]['hasMany'](db[_0x1941('0x206')],{'as':_0x1941('0x207'),'foreignKey':_0x1941('0x12f'),'onDelete':_0x1941('0x11c')});db[_0x1941('0x206')][_0x1941('0x120')](db[_0x1941('0x102')],{'as':_0x1941('0x208'),'foreignKey':'sectionId','onDelete':'cascade'});db[_0x1941('0x209')][_0x1941('0x120')](db['Disposition'],{'as':_0x1941('0x170'),'foreignKey':_0x1941('0x20a'),'onDelete':'cascade'});db[_0x1941('0x209')][_0x1941('0x120')](db[_0x1941('0x87')],{'as':_0x1941('0x171'),'foreignKey':_0x1941('0x20a')});db[_0x1941('0x209')][_0x1941('0x120')](db[_0x1941('0x10b')],{'as':_0x1941('0x164'),'foreignKey':_0x1941('0x20a')});db['WhatsappAccount'][_0x1941('0x120')](db['WhatsappInteraction'],{'as':_0x1941('0x172')});db['WhatsappAccount']['hasMany'](db[_0x1941('0x107')],{'as':_0x1941('0x157')});db[_0x1941('0x209')][_0x1941('0x12d')](db[_0x1941('0xfe')],{'as':_0x1941('0x173'),'foreignKey':'ListId'});db['WhatsappAccount'][_0x1941('0x12d')](db[_0x1941('0x15f')],{'as':_0x1941('0x184'),'foreignKey':_0x1941('0x160')});db[_0x1941('0x209')]['belongsToMany'](db[_0x1941('0x14')],{'as':_0x1941('0x161'),'through':_0x1941('0x152')});db[_0x1941('0x107')]['belongsTo'](db['User'],{'onDelete':_0x1941('0x16c')});db[_0x1941('0x107')][_0x1941('0x12d')](db[_0x1941('0x111')],{'onDelete':'restrict'});db['WhatsappApplication']['belongsTo'](db[_0x1941('0x209')],{'onDelete':_0x1941('0x16c')});db[_0x1941('0x107')][_0x1941('0x12d')](db[_0x1941('0x8b')],{'onDelete':_0x1941('0x16c'),'foreignKey':'IntervalId'});db[_0x1941('0x107')][_0x1941('0x12d')](db['Tag'],{'onDelete':_0x1941('0x16c'),'foreignKey':_0x1941('0x180')});db[_0x1941('0x109')][_0x1941('0x120')](db[_0x1941('0x10b')],{'as':'Messages','onDelete':_0x1941('0x11c'),'foreignKey':_0x1941('0x20b')});db['WhatsappInteraction']['belongsTo'](db[_0x1941('0x209')],{'as':_0x1941('0x178'),'foreignKey':_0x1941('0x20a')});db[_0x1941('0x109')][_0x1941('0x12d')](db[_0x1941('0x77')],{'as':_0x1941('0x169'),'foreignKey':'ContactId'});db[_0x1941('0x109')][_0x1941('0x12d')](db[_0x1941('0x14')],{'as':_0x1941('0x179'),'foreignKey':_0x1941('0x11d')});db[_0x1941('0x109')][_0x1941('0x132')](db[_0x1941('0x92')],{'through':_0x1941('0x1bd'),'as':'Tags'});db[_0x1941('0x109')][_0x1941('0x132')](db['Tag'],{'through':_0x1941('0x1bd'),'as':'ThroughTags'});db[_0x1941('0x109')][_0x1941('0x132')](db['User'],{'as':_0x1941('0x187'),'through':_0x1941('0x20c'),'foreignKey':_0x1941('0x20b')});db[_0x1941('0x10b')][_0x1941('0x12d')](db[_0x1941('0x14')],{'as':_0x1941('0x14')});db[_0x1941('0x10b')]['belongsTo'](db[_0x1941('0x77')],{'onDelete':_0x1941('0x11c'),'as':_0x1941('0x169')});db[_0x1941('0x10b')][_0x1941('0x12d')](db[_0x1941('0x109')],{'onDelete':_0x1941('0x11c'),'as':'Interaction','foreignKey':_0x1941('0x20b')});db['WhatsappMessage'][_0x1941('0x12d')](db['WhatsappAccount'],{'as':_0x1941('0x178'),'foreignKey':_0x1941('0x20a')});db['WhatsappQueueReport'][_0x1941('0x12d')](db[_0x1941('0x209')],{});db['WhatsappQueueReport'][_0x1941('0x12d')](db[_0x1941('0xfe')],{'as':_0x1941('0x173'),'foreignKey':'ListId'});db[_0x1941('0x10d')][_0x1941('0x12d')](db[_0x1941('0x77')],{'as':_0x1941('0x169'),'foreignKey':'ContactId'});db[_0x1941('0x10d')][_0x1941('0x12d')](db[_0x1941('0x109')],{});db[_0x1941('0x10d')][_0x1941('0x12d')](db[_0x1941('0x111')],{});db[_0x1941('0x10d')][_0x1941('0x12d')](db[_0x1941('0x10b')],{});db[_0x1941('0x10d')]['belongsTo'](db['User'],{});db[_0x1941('0x10f')][_0x1941('0x12d')](db['WhatsappMessage'],{});db[_0x1941('0x10f')]['belongsTo'](db['WhatsappInteraction'],{});db[_0x1941('0x10f')]['belongsTo'](db[_0x1941('0x209')],{'foreignKey':_0x1941('0x20d'),'as':_0x1941('0x1ef')});db[_0x1941('0x10f')]['belongsTo'](db[_0x1941('0x209')],{'foreignKey':'ToWhatsappAccountId','as':_0x1941('0x1f3')});db[_0x1941('0x10f')][_0x1941('0x12d')](db[_0x1941('0x111')],{'foreignKey':_0x1941('0x20e'),'as':_0x1941('0x1f2')});db['WhatsappTransferReport']['belongsTo'](db[_0x1941('0x14')],{'foreignKey':_0x1941('0x1f9'),'as':'FromAgent'});db[_0x1941('0x10f')]['belongsTo'](db[_0x1941('0x14')],{'foreignKey':_0x1941('0x1fd'),'as':'ToAgent'});db['WhatsappQueue']['belongsToMany'](db[_0x1941('0x14')],{'as':_0x1941('0x161'),'through':_0x1941('0x3a'),'foreignKey':_0x1941('0x20f')});db[_0x1941('0x111')][_0x1941('0x132')](db[_0x1941('0xee')],{'through':_0x1941('0x1e7'),'as':_0x1941('0x176')});db[_0x1941('0x11e')][_0x1941('0x12d')](db[_0x1941('0x14')],{'as':'user','foreignKey':'UserId','onDelete':'cascade','hooks':!![]});db[_0x1941('0x113')][_0x1941('0x11b')](db[_0x1941('0xca')],{'as':_0x1941('0xca'),'onDelete':_0x1941('0x16c')});db[_0x1941('0x113')][_0x1941('0x11b')](db[_0x1941('0x3c')],{'as':'Imap','onDelete':'restrict'});db['CloudProvider'][_0x1941('0x11b')](db[_0x1941('0x3e')],{'as':'Smtp','onDelete':'restrict'});module[_0x1941('0x210')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xb8f2=['../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailMessage/mailMessage.model','MailApplication','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','FaxAccount','FaxInteraction','FaxMessage','../api/faxMessage/faxMessage.model','../api/faxQueue/faxQueue.model','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','../api/smsInteraction/smsInteraction.model','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','OpenchannelInteraction','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','OpenchannelQueueReport','../api/chatApplication/chatApplication.model','../api/chatInteraction/chatInteraction.model','ChatMessage','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','../api/interval/interval.model','../api/pause/pause.model','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','ContactItemType','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','../api/analyticCustomReport/analyticCustomReport.model','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.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','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','../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','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','../api/squareReportDetail/squareReportDetail.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','../api/team/team.model','License','../api/campaign/campaign.model','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/mailTransferReport/mailTransferReport.model','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','CloudProvider','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','../api/user-setting/user-setting.model','hasOne','cascade','UserId','userSetting','hasMany','VoiceQueuesRt','Extensions','HopperHistory','ChatInteraction','SmsInteraction','SmsInteractions','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsTo','userProfileId','Groups','chat_group_has_users','belongsToMany','Contacts','Lists','cm_user_has_lists','user_has_teams','ChatInteractions','user_has_chat_interactions','FaxInteractions','user_has_fax_interactions','user_has_sms_interactions','OpenchannelInteractions','user_has_openchannel_interactions','VoiceQueues','VoicePrefix','VoicePrefixes','MailQueues','ChatQueue','ChatQueues','FaxQueue','FaxQueues','UserSmsQueue','OpenchannelQueues','WhatsappQueue','WhatsappQueues','ChatWebsites','FaxAccounts','user_has_fax_accounts','MailAccounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','WhatsappAccounts','user_has_whatsapp_accounts','user_has_square_projects','SpiedAgents','ChanSpyId','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','CmHopper','Hoppers','HopperFinals','HopperBlacks','JscriptySessions','TrunkId','Interval','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','Agents','Team','ScreenRecording','Messages','mailboxuser','mailbox','VoiceQueueReport','QueueCalls','uniqueid','Contact','ContactId','MailAccountId','CloudProviderId','restrict','Smtp','Answers','MailMessage','TemplateId','Pause','user_has_mail_accounts','team_has_mail_queues','Teams','Account','Owner','Tag','Tags','mail_interaction_has_tags','ThroughTags','user_has_mail_interactions','MailInteractionId','Attachments','Interaction','ChatWebsiteId','ChatOfflineMessageId','Dashboard','Items','Dispositions','FaxAccountId','FaxApplication','Exntensions','ListId','TagId','fax_interaction_has_tags','Users','FaxInteractionId','AttachmentId','team_has_fax_queues','List','FaxQueueReport','SmsAccountId','SmsMessage','Interactions','user_has_sms_accounts','sms_interaction_has_tags','SmsInteractionId','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelMessage','openchannel_interaction_has_tags','OpenchannelInteractionId','OpenchannelQueueId','ProactiveActions','ChatApplication','user_has_chat_websites','Agent','Queue','ChatQueueId','chat_interaction_has_tags','ChatInteractionId','team_has_chat_queues','ChatGroupId','CmCompany','CompanyId','Phones','CmContactId','Company','cm_user_has_contacts','cm_contact_has_tags','CmHopperAdditionalPhone','AdditionalPhones','CmHopperId','Campaign','CampaignId','All','OneAll','AutomationAllId','Any','OneAny','AutomationAnyId','Actions','AutomationId','ParentId','Intervals','FaxApplications','AnalyticDefaultReport','DefaultReportId','AnalyticCustomReport','CustomReportId','CmContactHasItem','ItemType','ItemTypeId','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','Fields','MetricId','Configurations','AccountId','Descriptions','DescriptionId','Subject','SubjectId','Field','FieldId','Subjects','Description','VariableId','DeskConfiguration','int_desk_configuration_has_tags','int_zendesk_configuration_has_tags','FreshdeskField','int_freshdesk_configuration_has_tags','FreshsalesField','FromId','ToId','SessionId','JscriptyProject','ProjectId','SmsQueues','team_has_openchannel_queues','team_has_whatsapp_queues','TrunkBackup','TrunkBackupId','SquareProjectId','campaigns_has_cm_lists','BlackLists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromUserId','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','ChatTransferReport','FromAgent','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','OpenchannelTransferReport','FromOpenchannelAccountId','ToOpenchannelQueueId','FromSmsAccountId','Queues','voice_queues_has_cm_lists','UserProfileSections','Resources','WhatsappAccountId','WhatsappInteractionId','whatsapp_interaction_has_tags','user_has_whatsapp_interactions','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','user','Imap','exports','../config/environment','lodash','jstz','determine','sequelize','defaultsDeep','motion2','xcall','xC@LL1234','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','127.0.0.1','database','username','password','options','User','import','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','../api/voiceQueueReport/voiceQueueReport.model'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0xb8f2,0x1ea));var _0x2b8f=function(_0x43c4fc,_0x94577d){_0x43c4fc=_0x43c4fc-0x0;var _0x5571ca=_0xb8f2[_0x43c4fc];return _0x5571ca;};'use strict';var config=require(_0x2b8f('0x0'));var Sequelize=require('sequelize');var _=require(_0x2b8f('0x1'));var jstz=require(_0x2b8f('0x2'));var timezone=jstz[_0x2b8f('0x3')]();config[_0x2b8f('0x4')]=_[_0x2b8f('0x5')](config[_0x2b8f('0x4')],{'database':_0x2b8f('0x6'),'username':_0x2b8f('0x7'),'password':_0x2b8f('0x8'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x2b8f('0x9'),'dialectOptions':{'charset':_0x2b8f('0xa')},'logging':![],'timezone':timezone[_0x2b8f('0xb')](),'define':{'charset':_0x2b8f('0xc'),'collate':_0x2b8f('0xd')}}});config[_0x2b8f('0xe')]=_[_0x2b8f('0x5')](config['sequelizeHistory'],{'database':_0x2b8f('0x6'),'username':'xcall','password':_0x2b8f('0x8'),'options':{'host':_0x2b8f('0xf'),'port':0xcea,'dialect':_0x2b8f('0x9'),'dialectOptions':{'charset':_0x2b8f('0xa')},'logging':![],'timezone':timezone[_0x2b8f('0xb')](),'define':{'charset':_0x2b8f('0xc'),'collate':_0x2b8f('0xd')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x2b8f('0x4')][_0x2b8f('0x10')],config[_0x2b8f('0x4')][_0x2b8f('0x11')],config[_0x2b8f('0x4')][_0x2b8f('0x12')],config[_0x2b8f('0x4')]['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x2b8f('0xe')]['database'],config['sequelizeHistory'][_0x2b8f('0x11')],config[_0x2b8f('0xe')][_0x2b8f('0x12')],config['sequelizeHistory'][_0x2b8f('0x13')])};db[_0x2b8f('0x14')]=db[_0x2b8f('0x4')][_0x2b8f('0x15')]('../api/user/user.model');db[_0x2b8f('0x16')]=db[_0x2b8f('0x4')][_0x2b8f('0x15')](_0x2b8f('0x17'));db[_0x2b8f('0x18')]=db['sequelize']['import'](_0x2b8f('0x19'));db[_0x2b8f('0x1a')]=db[_0x2b8f('0x4')]['import'](_0x2b8f('0x1b'));db[_0x2b8f('0x1c')]=db[_0x2b8f('0x4')]['import'](_0x2b8f('0x1d'));db[_0x2b8f('0x1e')]=db[_0x2b8f('0x4')][_0x2b8f('0x15')](_0x2b8f('0x1f'));db[_0x2b8f('0x20')]=db[_0x2b8f('0x4')][_0x2b8f('0x15')]('../api/voiceRecording/voiceRecording.model');db['ScreenRecording']=db[_0x2b8f('0x4')][_0x2b8f('0x15')](_0x2b8f('0x21'));db[_0x2b8f('0x22')]=db[_0x2b8f('0x4')][_0x2b8f('0x15')](_0x2b8f('0x23'));db[_0x2b8f('0x24')]=db['sequelize']['import'](_0x2b8f('0x25'));db[_0x2b8f('0x26')]=db[_0x2b8f('0x4')][_0x2b8f('0x15')](_0x2b8f('0x27'));db['VoiceDialReport']=db['sequelize'][_0x2b8f('0x15')](_0x2b8f('0x28'));db[_0x2b8f('0x29')]=db[_0x2b8f('0x4')][_0x2b8f('0x15')](_0x2b8f('0x2a'));db['VoiceQueueReport']=db['sequelize']['import'](_0x2b8f('0x2b'));db['MemberReport']=db[_0x2b8f('0x4')]['import'](_0x2b8f('0x2c'));db[_0x2b8f('0x2d')]=db['sequelize']['import'](_0x2b8f('0x2e'));db[_0x2b8f('0x2f')]=db[_0x2b8f('0x4')][_0x2b8f('0x15')](_0x2b8f('0x30'));db[_0x2b8f('0x31')]=db[_0x2b8f('0x4')][_0x2b8f('0x15')](_0x2b8f('0x32'));db[_0x2b8f('0x33')]=db[_0x2b8f('0x4')][_0x2b8f('0x15')](_0x2b8f('0x34'));db[_0x2b8f('0x35')]=db[_0x2b8f('0x4')]['import'](_0x2b8f('0x36'));db[_0x2b8f('0x37')]=db['sequelize']['import'](_0x2b8f('0x38'));db[_0x2b8f('0x39')]=db[_0x2b8f('0x4')]['import'](_0x2b8f('0x3a'));db['UserSmsQueue']=db['sequelize']['import'](_0x2b8f('0x3b'));db[_0x2b8f('0x3c')]=db['sequelize'][_0x2b8f('0x15')](_0x2b8f('0x3d'));db[_0x2b8f('0x3e')]=db[_0x2b8f('0x4')]['import'](_0x2b8f('0x3f'));db[_0x2b8f('0x40')]=db[_0x2b8f('0x4')][_0x2b8f('0x15')](_0x2b8f('0x41'));db[_0x2b8f('0x42')]=db[_0x2b8f('0x4')]['import'](_0x2b8f('0x43'));db[_0x2b8f('0x44')]=db[_0x2b8f('0x4')][_0x2b8f('0x15')](_0x2b8f('0x45'));db[_0x2b8f('0x46')]=db[_0x2b8f('0x4')][_0x2b8f('0x15')](_0x2b8f('0x47'));db[_0x2b8f('0x48')]=db[_0x2b8f('0x4')][_0x2b8f('0x15')](_0x2b8f('0x49'));db[_0x2b8f('0x4a')]=db[_0x2b8f('0x4')][_0x2b8f('0x15')]('../api/mailInteraction/mailInteraction.model');db['MailMessage']=db['sequelize']['import'](_0x2b8f('0x4b'));db[_0x2b8f('0x4c')]=db[_0x2b8f('0x4')][_0x2b8f('0x15')]('../api/mailApplication/mailApplication.model');db[_0x2b8f('0x4d')]=db[_0x2b8f('0x4')][_0x2b8f('0x15')](_0x2b8f('0x4e'));db['Dashboard']=db[_0x2b8f('0x4')][_0x2b8f('0x15')](_0x2b8f('0x4f'));db[_0x2b8f('0x50')]=db[_0x2b8f('0x4')][_0x2b8f('0x15')]('../api/dashboardItem/dashboardItem.model');db[_0x2b8f('0x51')]=db[_0x2b8f('0x4')][_0x2b8f('0x15')]('../api/faxAccount/faxAccount.model');db['FaxApplication']=db['sequelize'][_0x2b8f('0x15')]('../api/faxApplication/faxApplication.model');db[_0x2b8f('0x52')]=db[_0x2b8f('0x4')][_0x2b8f('0x15')]('../api/faxInteraction/faxInteraction.model');db[_0x2b8f('0x53')]=db[_0x2b8f('0x4')][_0x2b8f('0x15')](_0x2b8f('0x54'));db['FaxQueue']=db['sequelize']['import'](_0x2b8f('0x55'));db['FaxQueueReport']=db['sequelize']['import'](_0x2b8f('0x56'));db[_0x2b8f('0x57')]=db['sequelize'][_0x2b8f('0x15')](_0x2b8f('0x58'));db[_0x2b8f('0x59')]=db[_0x2b8f('0x4')]['import'](_0x2b8f('0x5a'));db['SmsInteraction']=db[_0x2b8f('0x4')][_0x2b8f('0x15')](_0x2b8f('0x5b'));db['SmsMessage']=db[_0x2b8f('0x4')][_0x2b8f('0x15')](_0x2b8f('0x5c'));db[_0x2b8f('0x5d')]=db[_0x2b8f('0x4')][_0x2b8f('0x15')](_0x2b8f('0x5e'));db[_0x2b8f('0x5f')]=db[_0x2b8f('0x4')][_0x2b8f('0x15')](_0x2b8f('0x60'));db[_0x2b8f('0x61')]=db['sequelize'][_0x2b8f('0x15')]('../api/openchannelApplication/openchannelApplication.model');db[_0x2b8f('0x62')]=db['sequelize'][_0x2b8f('0x15')]('../api/openchannelInteraction/openchannelInteraction.model');db['OpenchannelMessage']=db[_0x2b8f('0x4')][_0x2b8f('0x15')](_0x2b8f('0x63'));db[_0x2b8f('0x64')]=db['sequelize'][_0x2b8f('0x15')](_0x2b8f('0x65'));db[_0x2b8f('0x66')]=db[_0x2b8f('0x4')]['import']('../api/chatWebsite/chatWebsite.model');db[_0x2b8f('0x67')]=db[_0x2b8f('0x4')][_0x2b8f('0x15')]('../api/openchannelQueueReport/openchannelQueueReport.model');db['ChatApplication']=db[_0x2b8f('0x4')]['import'](_0x2b8f('0x68'));db['ChatInteraction']=db[_0x2b8f('0x4')][_0x2b8f('0x15')](_0x2b8f('0x69'));db[_0x2b8f('0x6a')]=db[_0x2b8f('0x4')][_0x2b8f('0x15')]('../api/chatMessage/chatMessage.model');db[_0x2b8f('0x6b')]=db[_0x2b8f('0x4')][_0x2b8f('0x15')](_0x2b8f('0x6c'));db['ChatQueue']=db[_0x2b8f('0x4')][_0x2b8f('0x15')](_0x2b8f('0x6d'));db[_0x2b8f('0x6e')]=db[_0x2b8f('0x4')]['import'](_0x2b8f('0x6f'));db[_0x2b8f('0x70')]=db[_0x2b8f('0x4')]['import'](_0x2b8f('0x71'));db['CmCompany']=db['sequelize'][_0x2b8f('0x15')](_0x2b8f('0x72'));db[_0x2b8f('0x73')]=db[_0x2b8f('0x4')]['import'](_0x2b8f('0x74'));db['CmHopper']=db[_0x2b8f('0x4')][_0x2b8f('0x15')](_0x2b8f('0x75'));db[_0x2b8f('0x76')]=db[_0x2b8f('0x4')][_0x2b8f('0x15')](_0x2b8f('0x77'));db[_0x2b8f('0x78')]=db['sequelize'][_0x2b8f('0x15')](_0x2b8f('0x79'));db[_0x2b8f('0x7a')]=db[_0x2b8f('0x4')]['import'](_0x2b8f('0x7b'));db[_0x2b8f('0x7c')]=db[_0x2b8f('0x4')][_0x2b8f('0x15')](_0x2b8f('0x7d'));db['CmCustomField']=db['sequelize'][_0x2b8f('0x15')](_0x2b8f('0x7e'));db[_0x2b8f('0x7f')]=db['sequelize'][_0x2b8f('0x15')](_0x2b8f('0x80'));db[_0x2b8f('0x81')]=db[_0x2b8f('0x4')][_0x2b8f('0x15')](_0x2b8f('0x82'));db[_0x2b8f('0x83')]=db[_0x2b8f('0x4')][_0x2b8f('0x15')](_0x2b8f('0x84'));db[_0x2b8f('0x85')]=db[_0x2b8f('0x4')][_0x2b8f('0x15')](_0x2b8f('0x86'));db[_0x2b8f('0x87')]=db[_0x2b8f('0x4')][_0x2b8f('0x15')]('../api/condition/condition.model');db['Interval']=db[_0x2b8f('0x4')][_0x2b8f('0x15')](_0x2b8f('0x88'));db['Pause']=db[_0x2b8f('0x4')]['import'](_0x2b8f('0x89'));db['Cdr']=db[_0x2b8f('0x4')][_0x2b8f('0x15')](_0x2b8f('0x8a'));db[_0x2b8f('0x8b')]=db[_0x2b8f('0x4')][_0x2b8f('0x15')](_0x2b8f('0x8c'));db[_0x2b8f('0x8d')]=db['sequelize'][_0x2b8f('0x15')](_0x2b8f('0x8e'));db[_0x2b8f('0x8f')]=db['sequelize']['import']('../api/sound/sound.model');db['Tag']=db[_0x2b8f('0x4')][_0x2b8f('0x15')]('../api/tag/tag.model');db[_0x2b8f('0x90')]=db[_0x2b8f('0x4')]['import']('../api/contactItemType/contactItemType.model');db['CmContactHasItem']=db[_0x2b8f('0x4')]['import']('../api/cmContactHasItem/cmContactHasItem.model');db['CmHopperAdditionalPhone']=db[_0x2b8f('0x4')][_0x2b8f('0x15')](_0x2b8f('0x91'));db['Template']=db[_0x2b8f('0x4')][_0x2b8f('0x15')](_0x2b8f('0x92'));db[_0x2b8f('0x93')]=db[_0x2b8f('0x4')]['import'](_0x2b8f('0x94'));db[_0x2b8f('0x95')]=db[_0x2b8f('0x4')][_0x2b8f('0x15')](_0x2b8f('0x96'));db[_0x2b8f('0x97')]=db[_0x2b8f('0x4')][_0x2b8f('0x15')](_0x2b8f('0x98'));db[_0x2b8f('0x99')]=db['sequelize'][_0x2b8f('0x15')]('../api/integrationReport/integrationReport.model');db['AnalyticCustomReport']=db['sequelize'][_0x2b8f('0x15')](_0x2b8f('0x9a'));db['AnalyticDefaultReport']=db[_0x2b8f('0x4')][_0x2b8f('0x15')](_0x2b8f('0x9b'));db[_0x2b8f('0x9c')]=db[_0x2b8f('0x4')][_0x2b8f('0x15')](_0x2b8f('0x9d'));db[_0x2b8f('0x9e')]=db['sequelize'][_0x2b8f('0x15')](_0x2b8f('0x9f'));db[_0x2b8f('0xa0')]=db[_0x2b8f('0x4')][_0x2b8f('0x15')](_0x2b8f('0xa1'));db[_0x2b8f('0xa2')]=db[_0x2b8f('0x4')][_0x2b8f('0x15')](_0x2b8f('0xa3'));db[_0x2b8f('0xa4')]=db[_0x2b8f('0x4')][_0x2b8f('0x15')](_0x2b8f('0xa5'));db[_0x2b8f('0xa6')]=db[_0x2b8f('0x4')][_0x2b8f('0x15')](_0x2b8f('0xa7'));db[_0x2b8f('0xa8')]=db[_0x2b8f('0x4')][_0x2b8f('0x15')](_0x2b8f('0xa9'));db[_0x2b8f('0xaa')]=db['sequelize'][_0x2b8f('0x15')](_0x2b8f('0xab'));db[_0x2b8f('0xac')]=db[_0x2b8f('0x4')][_0x2b8f('0x15')](_0x2b8f('0xad'));db[_0x2b8f('0xae')]=db[_0x2b8f('0x4')][_0x2b8f('0x15')](_0x2b8f('0xaf'));db[_0x2b8f('0xb0')]=db['sequelize'][_0x2b8f('0x15')](_0x2b8f('0xb1'));db['DeskConfiguration']=db[_0x2b8f('0x4')]['import'](_0x2b8f('0xb2'));db[_0x2b8f('0xb3')]=db[_0x2b8f('0x4')][_0x2b8f('0x15')](_0x2b8f('0xb4'));db[_0x2b8f('0xb5')]=db[_0x2b8f('0x4')]['import'](_0x2b8f('0xb6'));db[_0x2b8f('0xb7')]=db['sequelize']['import'](_0x2b8f('0xb8'));db[_0x2b8f('0xb9')]=db['sequelize'][_0x2b8f('0x15')](_0x2b8f('0xba'));db[_0x2b8f('0xbb')]=db['sequelize']['import'](_0x2b8f('0xbc'));db[_0x2b8f('0xbd')]=db['sequelize']['import'](_0x2b8f('0xbe'));db[_0x2b8f('0xbf')]=db[_0x2b8f('0x4')]['import'](_0x2b8f('0xc0'));db[_0x2b8f('0xc1')]=db[_0x2b8f('0x4')][_0x2b8f('0x15')](_0x2b8f('0xc2'));db[_0x2b8f('0xc3')]=db['sequelize'][_0x2b8f('0x15')](_0x2b8f('0xc4'));db['FreshdeskField']=db[_0x2b8f('0x4')][_0x2b8f('0x15')](_0x2b8f('0xc5'));db[_0x2b8f('0xc6')]=db[_0x2b8f('0x4')][_0x2b8f('0x15')]('../api/intVtigerAccount/intVtigerAccount.model');db[_0x2b8f('0xc7')]=db['sequelize'][_0x2b8f('0x15')](_0x2b8f('0xc8'));db[_0x2b8f('0xc9')]=db['sequelize'][_0x2b8f('0x15')](_0x2b8f('0xca'));db[_0x2b8f('0xcb')]=db[_0x2b8f('0x4')][_0x2b8f('0x15')](_0x2b8f('0xcc'));db[_0x2b8f('0xcd')]=db['sequelize']['import']('../api/intServicenowConfiguration/intServicenowConfiguration.model');db[_0x2b8f('0xce')]=db['sequelize'][_0x2b8f('0x15')](_0x2b8f('0xcf'));db[_0x2b8f('0xd0')]=db['sequelize']['import'](_0x2b8f('0xd1'));db[_0x2b8f('0xd2')]=db['sequelize']['import'](_0x2b8f('0xd3'));db[_0x2b8f('0xd4')]=db[_0x2b8f('0x4')]['import'](_0x2b8f('0xd5'));db[_0x2b8f('0xd6')]=db[_0x2b8f('0x4')]['import'](_0x2b8f('0xd7'));db[_0x2b8f('0xd8')]=db['sequelize'][_0x2b8f('0x15')](_0x2b8f('0xd9'));db['FreshsalesField']=db['sequelize'][_0x2b8f('0x15')](_0x2b8f('0xda'));db['Integration']=db[_0x2b8f('0x4')][_0x2b8f('0x15')](_0x2b8f('0x98'));db[_0x2b8f('0xdb')]=db[_0x2b8f('0x4')][_0x2b8f('0x15')](_0x2b8f('0xdc'));db[_0x2b8f('0xdd')]=db[_0x2b8f('0x4')]['import'](_0x2b8f('0xde'));db[_0x2b8f('0xdf')]=db[_0x2b8f('0x4')][_0x2b8f('0x15')](_0x2b8f('0xe0'));db[_0x2b8f('0xe1')]=db[_0x2b8f('0x4')][_0x2b8f('0x15')](_0x2b8f('0xe2'));db[_0x2b8f('0xe3')]=db[_0x2b8f('0x4')][_0x2b8f('0x15')](_0x2b8f('0xe4'));db[_0x2b8f('0xe5')]=db[_0x2b8f('0x4')][_0x2b8f('0x15')](_0x2b8f('0xe6'));db[_0x2b8f('0xe7')]=db[_0x2b8f('0x4')][_0x2b8f('0x15')](_0x2b8f('0xe8'));db[_0x2b8f('0xe9')]=db[_0x2b8f('0x4')][_0x2b8f('0x15')](_0x2b8f('0xea'));db['SquareDetailsReport']=db[_0x2b8f('0x4')][_0x2b8f('0x15')](_0x2b8f('0xeb'));db['JscriptyProject']=db[_0x2b8f('0x4')][_0x2b8f('0x15')]('../api/jscriptyProject/jscriptyProject.model');db[_0x2b8f('0xec')]=db[_0x2b8f('0x4')][_0x2b8f('0x15')](_0x2b8f('0xed'));db[_0x2b8f('0xee')]=db[_0x2b8f('0x4')][_0x2b8f('0x15')](_0x2b8f('0xef'));db[_0x2b8f('0xf0')]=db[_0x2b8f('0x4')][_0x2b8f('0x15')](_0x2b8f('0xf1'));db[_0x2b8f('0xf2')]=db[_0x2b8f('0x4')][_0x2b8f('0x15')](_0x2b8f('0xf3'));db[_0x2b8f('0xf4')]=db[_0x2b8f('0x4')]['import'](_0x2b8f('0xf5'));db['Team']=db[_0x2b8f('0x4')][_0x2b8f('0x15')](_0x2b8f('0xf6'));db[_0x2b8f('0xf7')]=db[_0x2b8f('0x4')][_0x2b8f('0x15')]('../api/license/license.model');db['Campaign']=db[_0x2b8f('0x4')]['import'](_0x2b8f('0xf8'));db['Migration']=db[_0x2b8f('0x4')]['import'](_0x2b8f('0xf9'));db[_0x2b8f('0xfa')]=db[_0x2b8f('0x4')][_0x2b8f('0x15')](_0x2b8f('0xfb'));db[_0x2b8f('0xfc')]=db['sequelize'][_0x2b8f('0x15')]('../api/plugin/plugin.model');db['MailTransferReport']=db[_0x2b8f('0x4')][_0x2b8f('0x15')](_0x2b8f('0xfd'));db['ChatTransferReport']=db[_0x2b8f('0x4')][_0x2b8f('0x15')](_0x2b8f('0xfe'));db[_0x2b8f('0xff')]=db['sequelize'][_0x2b8f('0x15')](_0x2b8f('0x100'));db['OpenchannelTransferReport']=db[_0x2b8f('0x4')][_0x2b8f('0x15')]('../api/openchannelTransferReport/openchannelTransferReport.model');db[_0x2b8f('0x101')]=db[_0x2b8f('0x4')][_0x2b8f('0x15')](_0x2b8f('0x102'));db[_0x2b8f('0x103')]=db[_0x2b8f('0x4')][_0x2b8f('0x15')]('../api/cmList/cmList.model');db['VoicePrefix']=db[_0x2b8f('0x4')][_0x2b8f('0x15')](_0x2b8f('0x104'));db[_0x2b8f('0x105')]=db[_0x2b8f('0x4')][_0x2b8f('0x15')](_0x2b8f('0x106'));db[_0x2b8f('0x107')]=db[_0x2b8f('0x4')][_0x2b8f('0x15')](_0x2b8f('0x108'));db['UserProfileResource']=db[_0x2b8f('0x4')][_0x2b8f('0x15')](_0x2b8f('0x109'));db[_0x2b8f('0x10a')]=db[_0x2b8f('0x4')]['import'](_0x2b8f('0x10b'));db[_0x2b8f('0x10c')]=db['sequelize'][_0x2b8f('0x15')](_0x2b8f('0x10d'));db[_0x2b8f('0x10e')]=db[_0x2b8f('0x4')][_0x2b8f('0x15')](_0x2b8f('0x10f'));db[_0x2b8f('0x110')]=db[_0x2b8f('0x4')]['import']('../api/whatsappInteraction/whatsappInteraction.model');db[_0x2b8f('0x111')]=db[_0x2b8f('0x4')][_0x2b8f('0x15')](_0x2b8f('0x112'));db[_0x2b8f('0x113')]=db[_0x2b8f('0x4')][_0x2b8f('0x15')](_0x2b8f('0x114'));db[_0x2b8f('0x115')]=db[_0x2b8f('0x4')]['import'](_0x2b8f('0x116'));db['WhatsappQueue']=db['sequelize'][_0x2b8f('0x15')]('../api/whatsappQueue/whatsappQueue.model');db[_0x2b8f('0x117')]=db[_0x2b8f('0x4')][_0x2b8f('0x15')]('../api/cloudProvider/cloudProvider.model');db[_0x2b8f('0x118')]=db[_0x2b8f('0x4')][_0x2b8f('0x15')](_0x2b8f('0x119'));db[_0x2b8f('0x11a')]=db[_0x2b8f('0x4')]['import'](_0x2b8f('0x11b'));db[_0x2b8f('0x11c')]=db[_0x2b8f('0x4')]['import'](_0x2b8f('0x11d'));db[_0x2b8f('0x11e')]=db[_0x2b8f('0x4')]['import'](_0x2b8f('0x11f'));db[_0x2b8f('0x14')][_0x2b8f('0x120')](db[_0x2b8f('0x22')],{'as':_0x2b8f('0x22'),'onDelete':_0x2b8f('0x121'),'foreignKey':_0x2b8f('0x122')});db[_0x2b8f('0x14')][_0x2b8f('0x120')](db[_0x2b8f('0x11e')],{'as':_0x2b8f('0x123'),'onDelete':_0x2b8f('0x121'),'foreignKey':_0x2b8f('0x122')});db[_0x2b8f('0x14')][_0x2b8f('0x124')](db['VoiceRecording'],{'as':'Recordings','foreignKey':_0x2b8f('0x122')});db['User'][_0x2b8f('0x124')](db[_0x2b8f('0x31')],{'as':_0x2b8f('0x125'),'foreignKey':_0x2b8f('0x122')});db[_0x2b8f('0x14')][_0x2b8f('0x124')](db[_0x2b8f('0x1a')],{'as':_0x2b8f('0x126'),'onDelete':_0x2b8f('0x121'),'hooks':!![]});db['User'][_0x2b8f('0x124')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0x2b8f('0x122')});db[_0x2b8f('0x14')][_0x2b8f('0x124')](db[_0x2b8f('0x7a')],{'as':_0x2b8f('0x127'),'foreignKey':_0x2b8f('0x122')});db[_0x2b8f('0x14')][_0x2b8f('0x124')](db[_0x2b8f('0x7c')],{'as':_0x2b8f('0x7c'),'foreignKey':_0x2b8f('0x122')});db['User'][_0x2b8f('0x124')](db[_0x2b8f('0x62')],{'as':'OpenchannelInteractions','foreignKey':_0x2b8f('0x122')});db[_0x2b8f('0x14')]['hasMany'](db[_0x2b8f('0x128')],{'as':'ChatInteractions','foreignKey':_0x2b8f('0x122')});db[_0x2b8f('0x14')][_0x2b8f('0x124')](db[_0x2b8f('0x129')],{'as':_0x2b8f('0x12a'),'foreignKey':_0x2b8f('0x122')});db[_0x2b8f('0x14')][_0x2b8f('0x124')](db[_0x2b8f('0x52')],{'as':'FaxInteractions','foreignKey':'UserId'});db[_0x2b8f('0x14')][_0x2b8f('0x124')](db['MailInteraction'],{'as':_0x2b8f('0x12b'),'foreignKey':_0x2b8f('0x122')});db['User'][_0x2b8f('0x124')](db[_0x2b8f('0x110')],{'as':_0x2b8f('0x12c'),'foreignKey':_0x2b8f('0x122')});db[_0x2b8f('0x14')]['hasMany'](db[_0x2b8f('0x10a')],{'as':_0x2b8f('0x12d'),'foreignKey':_0x2b8f('0x12e')});db[_0x2b8f('0x14')][_0x2b8f('0x12f')](db[_0x2b8f('0x105')],{'as':_0x2b8f('0x105'),'foreignKey':_0x2b8f('0x130')});db[_0x2b8f('0x14')]['belongsToMany'](db[_0x2b8f('0x6e')],{'as':_0x2b8f('0x131'),'through':_0x2b8f('0x132')});db[_0x2b8f('0x14')][_0x2b8f('0x133')](db['CmContact'],{'as':_0x2b8f('0x134'),'through':'cm_user_has_contacts'});db[_0x2b8f('0x14')][_0x2b8f('0x133')](db['CmList'],{'as':_0x2b8f('0x135'),'through':_0x2b8f('0x136')});db['User'][_0x2b8f('0x133')](db['Team'],{'through':_0x2b8f('0x137')});db['User'][_0x2b8f('0x133')](db['MailInteraction'],{'as':_0x2b8f('0x12b'),'through':'user_has_mail_interactions'});db[_0x2b8f('0x14')]['belongsToMany'](db['ChatInteraction'],{'as':_0x2b8f('0x138'),'through':_0x2b8f('0x139')});db[_0x2b8f('0x14')]['belongsToMany'](db[_0x2b8f('0x52')],{'as':_0x2b8f('0x13a'),'through':_0x2b8f('0x13b')});db['User'][_0x2b8f('0x133')](db[_0x2b8f('0x129')],{'as':_0x2b8f('0x12a'),'through':_0x2b8f('0x13c')});db[_0x2b8f('0x14')][_0x2b8f('0x133')](db[_0x2b8f('0x62')],{'as':_0x2b8f('0x13d'),'through':_0x2b8f('0x13e')});db[_0x2b8f('0x14')]['belongsToMany'](db[_0x2b8f('0x110')],{'as':_0x2b8f('0x12c'),'through':'user_has_whatsapp_interactions'});db[_0x2b8f('0x14')][_0x2b8f('0x133')](db['VoiceQueue'],{'as':_0x2b8f('0x13f'),'through':_0x2b8f('0x33'),'required':![]});db[_0x2b8f('0x14')][_0x2b8f('0x133')](db[_0x2b8f('0x140')],{'as':_0x2b8f('0x141'),'through':'UserVoicePrefix','required':![]});db[_0x2b8f('0x14')]['belongsToMany'](db[_0x2b8f('0x46')],{'as':_0x2b8f('0x142'),'through':'UserMailQueue','required':![]});db['User'][_0x2b8f('0x133')](db[_0x2b8f('0x143')],{'as':_0x2b8f('0x144'),'through':_0x2b8f('0x35'),'required':![],'hooks':!![]});db[_0x2b8f('0x14')]['belongsToMany'](db[_0x2b8f('0x145')],{'as':_0x2b8f('0x146'),'through':_0x2b8f('0x39'),'required':![]});db[_0x2b8f('0x14')][_0x2b8f('0x133')](db[_0x2b8f('0x5d')],{'as':'SmsQueues','through':_0x2b8f('0x147'),'required':![]});db['User'][_0x2b8f('0x133')](db[_0x2b8f('0x64')],{'as':_0x2b8f('0x148'),'through':'UserOpenchannelQueue','required':![]});db[_0x2b8f('0x14')]['belongsToMany'](db[_0x2b8f('0x149')],{'as':_0x2b8f('0x14a'),'through':'UserWhatsappQueue','required':![]});db[_0x2b8f('0x14')]['belongsToMany'](db['CmList'],{'through':_0x2b8f('0x136')});db['User'][_0x2b8f('0x133')](db['ChatWebsite'],{'as':_0x2b8f('0x14b'),'through':'user_has_chat_websites'});db[_0x2b8f('0x14')][_0x2b8f('0x133')](db[_0x2b8f('0x51')],{'as':_0x2b8f('0x14c'),'through':_0x2b8f('0x14d')});db[_0x2b8f('0x14')][_0x2b8f('0x133')](db[_0x2b8f('0x44')],{'as':_0x2b8f('0x14e'),'through':'user_has_mail_accounts'});db['User'][_0x2b8f('0x133')](db['OpenchannelAccount'],{'as':_0x2b8f('0x14f'),'through':_0x2b8f('0x150')});db[_0x2b8f('0x14')][_0x2b8f('0x133')](db[_0x2b8f('0x57')],{'as':_0x2b8f('0x151'),'through':'user_has_sms_accounts'});db[_0x2b8f('0x14')][_0x2b8f('0x133')](db[_0x2b8f('0x10c')],{'as':_0x2b8f('0x152'),'through':_0x2b8f('0x153')});db['User'][_0x2b8f('0x133')](db[_0x2b8f('0xf0')],{'as':'SquareProjects','through':_0x2b8f('0x154')});db[_0x2b8f('0x16')][_0x2b8f('0x124')](db[_0x2b8f('0x1a')],{'as':_0x2b8f('0x155'),'onDelete':_0x2b8f('0x121'),'foreignKey':_0x2b8f('0x156')});db[_0x2b8f('0x18')][_0x2b8f('0x124')](db[_0x2b8f('0x1a')],{'onDelete':_0x2b8f('0x121')});db['VoiceExtension']['hasMany'](db[_0x2b8f('0x1a')],{'as':_0x2b8f('0x157'),'onDelete':_0x2b8f('0x121')});db['VoiceMusicOnHold'][_0x2b8f('0x133')](db['Sound'],{'as':_0x2b8f('0x158'),'through':_0x2b8f('0x159')});db['VoiceQueue'][_0x2b8f('0x124')](db[_0x2b8f('0x31')],{'as':_0x2b8f('0x15a'),'foreignKey':_0x2b8f('0x15b')});db[_0x2b8f('0x1e')][_0x2b8f('0x124')](db[_0x2b8f('0x15c')],{'as':_0x2b8f('0x15d'),'foreignKey':_0x2b8f('0x15b')});db['VoiceQueue'][_0x2b8f('0x124')](db[_0x2b8f('0x78')],{'as':_0x2b8f('0x15e'),'foreignKey':_0x2b8f('0x15b')});db[_0x2b8f('0x1e')]['hasMany'](db['CmHopperHistory'],{'as':'HopperHistories','foreignKey':_0x2b8f('0x15b')});db[_0x2b8f('0x1e')][_0x2b8f('0x124')](db['ReportAgentPreview'],{'as':_0x2b8f('0x7c'),'foreignKey':_0x2b8f('0x15b')});db[_0x2b8f('0x1e')]['hasMany'](db[_0x2b8f('0x76')],{'as':_0x2b8f('0x15f'),'foreignKey':_0x2b8f('0x15b')});db[_0x2b8f('0x1e')][_0x2b8f('0x124')](db[_0x2b8f('0xe5')],{'as':_0x2b8f('0x160'),'foreignKey':_0x2b8f('0x15b')});db[_0x2b8f('0x1e')][_0x2b8f('0x12f')](db[_0x2b8f('0x2d')],{'as':_0x2b8f('0x2d'),'foreignKey':_0x2b8f('0x161')});db[_0x2b8f('0x1e')]['belongsTo'](db[_0x2b8f('0x2d')],{'as':'TrunkBackup','foreignKey':'TrunkBackupId'});db['VoiceQueue']['belongsTo'](db[_0x2b8f('0x162')],{'as':_0x2b8f('0x162'),'foreignKey':_0x2b8f('0x163')});db['VoiceQueue']['belongsTo'](db['Pause'],{'as':_0x2b8f('0x164'),'foreignKey':_0x2b8f('0x165')});db[_0x2b8f('0x1e')][_0x2b8f('0x133')](db[_0x2b8f('0x103')],{'as':_0x2b8f('0x135'),'through':'voice_queues_has_cm_lists'});db[_0x2b8f('0x1e')][_0x2b8f('0x133')](db[_0x2b8f('0x14')],{'as':_0x2b8f('0x166'),'through':_0x2b8f('0x33')});db[_0x2b8f('0x1e')][_0x2b8f('0x133')](db[_0x2b8f('0x167')],{'as':'Teams','through':_0x2b8f('0x118')});db[_0x2b8f('0x1e')][_0x2b8f('0x133')](db['CmList'],{'as':'BlackLists','through':'voice_queues_has_cm_blacklists'});db[_0x2b8f('0x20')][_0x2b8f('0x12f')](db[_0x2b8f('0x14')],{'as':_0x2b8f('0x14'),'foreignKey':_0x2b8f('0x122')});db[_0x2b8f('0x168')]['belongsTo'](db[_0x2b8f('0x14')],{'as':_0x2b8f('0x14'),'foreignKey':_0x2b8f('0x122')});db['VoiceMail']['hasMany'](db[_0x2b8f('0x24')],{'as':_0x2b8f('0x169'),'onDelete':'cascade','foreignKey':_0x2b8f('0x16a'),'sourceKey':_0x2b8f('0x16b')});db[_0x2b8f('0x24')][_0x2b8f('0x12f')](db[_0x2b8f('0x22')],{'foreignKey':_0x2b8f('0x16a'),'targetKey':_0x2b8f('0x16b')});db[_0x2b8f('0x26')][_0x2b8f('0x124')](db[_0x2b8f('0x16c')],{'as':_0x2b8f('0x16d'),'foreignKey':_0x2b8f('0x16e'),'constraints':![]});db[_0x2b8f('0x26')]['hasMany'](db[_0x2b8f('0x29')],{'as':'AgentReports','foreignKey':_0x2b8f('0x16e'),'constraints':![]});db['VoiceCallReport'][_0x2b8f('0x12f')](db[_0x2b8f('0x14')],{'as':'User','foreignKey':_0x2b8f('0x122')});db[_0x2b8f('0x26')]['belongsTo'](db[_0x2b8f('0x73')],{'as':_0x2b8f('0x16f'),'foreignKey':_0x2b8f('0x170')});db[_0x2b8f('0x40')][_0x2b8f('0x12f')](db[_0x2b8f('0x44')],{'as':_0x2b8f('0x44'),'foreignKey':_0x2b8f('0x171')});db[_0x2b8f('0x40')]['belongsTo'](db['CloudProvider'],{'as':'CloudProvider','foreignKey':_0x2b8f('0x172'),'onDelete':_0x2b8f('0x173')});db[_0x2b8f('0x42')]['belongsTo'](db['MailAccount'],{'as':_0x2b8f('0x44'),'foreignKey':_0x2b8f('0x171')});db[_0x2b8f('0x42')][_0x2b8f('0x12f')](db['CloudProvider'],{'as':_0x2b8f('0x117'),'foreignKey':_0x2b8f('0x172'),'onDelete':_0x2b8f('0x173')});db['MailAccount'][_0x2b8f('0x120')](db[_0x2b8f('0x40')],{'as':'Imap','onDelete':_0x2b8f('0x121')});db[_0x2b8f('0x44')]['hasOne'](db[_0x2b8f('0x42')],{'as':_0x2b8f('0x174'),'onDelete':'cascade'});db[_0x2b8f('0x44')][_0x2b8f('0x124')](db[_0x2b8f('0x85')],{'as':'Dispositions','foreignKey':_0x2b8f('0x171'),'onDelete':_0x2b8f('0x121')});db[_0x2b8f('0x44')]['hasMany'](db[_0x2b8f('0x83')],{'as':_0x2b8f('0x175'),'foreignKey':_0x2b8f('0x171')});db[_0x2b8f('0x44')]['hasMany'](db[_0x2b8f('0x176')],{'as':_0x2b8f('0x169'),'foreignKey':_0x2b8f('0x171')});db['MailAccount'][_0x2b8f('0x124')](db['MailInteraction'],{'as':'Interactions'});db[_0x2b8f('0x44')][_0x2b8f('0x124')](db[_0x2b8f('0x4c')],{'as':_0x2b8f('0x157')});db[_0x2b8f('0x44')]['belongsTo'](db[_0x2b8f('0x103')],{'as':'List','foreignKey':'ListId'});db[_0x2b8f('0x44')][_0x2b8f('0x12f')](db['Template'],{'as':'Template','foreignKey':_0x2b8f('0x177')});db['MailAccount'][_0x2b8f('0x12f')](db[_0x2b8f('0x178')],{'as':_0x2b8f('0x164'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x2b8f('0x44')][_0x2b8f('0x133')](db[_0x2b8f('0x14')],{'as':_0x2b8f('0x166'),'through':_0x2b8f('0x179')});db[_0x2b8f('0x46')]['belongsToMany'](db['User'],{'as':_0x2b8f('0x166'),'through':'UserMailQueue'});db['MailQueue']['belongsToMany'](db['Team'],{'through':_0x2b8f('0x17a'),'as':_0x2b8f('0x17b')});db[_0x2b8f('0x4a')]['hasMany'](db[_0x2b8f('0x176')],{'as':_0x2b8f('0x169'),'onDelete':_0x2b8f('0x121'),'foreignKey':'MailInteractionId'});db['MailInteraction'][_0x2b8f('0x12f')](db[_0x2b8f('0x44')],{'as':_0x2b8f('0x17c'),'foreignKey':'MailAccountId'});db[_0x2b8f('0x4a')][_0x2b8f('0x12f')](db['CmContact'],{'as':_0x2b8f('0x16f'),'foreignKey':_0x2b8f('0x170')});db[_0x2b8f('0x4a')][_0x2b8f('0x12f')](db[_0x2b8f('0x14')],{'as':_0x2b8f('0x17d'),'foreignKey':_0x2b8f('0x122')});db[_0x2b8f('0x4a')][_0x2b8f('0x133')](db[_0x2b8f('0x17e')],{'through':'mail_interaction_has_tags','as':_0x2b8f('0x17f')});db[_0x2b8f('0x4a')][_0x2b8f('0x133')](db[_0x2b8f('0x17e')],{'through':_0x2b8f('0x180'),'as':_0x2b8f('0x181')});db[_0x2b8f('0x4a')]['belongsToMany'](db[_0x2b8f('0x14')],{'as':'Users','through':_0x2b8f('0x182'),'foreignKey':_0x2b8f('0x183')});db[_0x2b8f('0x176')]['hasMany'](db[_0x2b8f('0xfa')],{'as':_0x2b8f('0x184'),'onDelete':_0x2b8f('0x121')});db['MailMessage'][_0x2b8f('0x12f')](db[_0x2b8f('0x14')],{'as':_0x2b8f('0x14')});db['MailMessage'][_0x2b8f('0x12f')](db[_0x2b8f('0x73')],{'onDelete':'cascade','as':_0x2b8f('0x16f')});db[_0x2b8f('0x176')][_0x2b8f('0x12f')](db['MailInteraction'],{'as':_0x2b8f('0x185'),'foreignKey':'MailInteractionId'});db[_0x2b8f('0x176')]['belongsTo'](db[_0x2b8f('0x44')],{'as':_0x2b8f('0x17c'),'foreignKey':'MailAccountId'});db[_0x2b8f('0x176')][_0x2b8f('0x12f')](db['ChatWebsite'],{'as':_0x2b8f('0x66'),'foreignKey':_0x2b8f('0x186')});db[_0x2b8f('0x176')][_0x2b8f('0x12f')](db[_0x2b8f('0x6b')],{'as':_0x2b8f('0x6b'),'foreignKey':_0x2b8f('0x187')});db[_0x2b8f('0x4c')][_0x2b8f('0x12f')](db['User'],{'onDelete':_0x2b8f('0x173')});db[_0x2b8f('0x4c')][_0x2b8f('0x12f')](db[_0x2b8f('0x46')],{'onDelete':_0x2b8f('0x173')});db[_0x2b8f('0x4c')][_0x2b8f('0x12f')](db[_0x2b8f('0x44')],{'onDelete':_0x2b8f('0x173')});db[_0x2b8f('0x4c')][_0x2b8f('0x12f')](db[_0x2b8f('0x162')],{'onDelete':'restrict','foreignKey':_0x2b8f('0x163')});db[_0x2b8f('0x4c')]['belongsTo'](db[_0x2b8f('0x17e')],{'onDelete':_0x2b8f('0x173'),'foreignKey':'TagId'});db[_0x2b8f('0x4d')][_0x2b8f('0x12f')](db[_0x2b8f('0x44')],{});db['MailQueueReport'][_0x2b8f('0x12f')](db[_0x2b8f('0x103')],{'as':'List','foreignKey':'ListId'});db[_0x2b8f('0x4d')][_0x2b8f('0x12f')](db[_0x2b8f('0x73')],{'as':_0x2b8f('0x16f'),'foreignKey':_0x2b8f('0x170')});db[_0x2b8f('0x4d')][_0x2b8f('0x12f')](db[_0x2b8f('0x4a')],{});db[_0x2b8f('0x4d')][_0x2b8f('0x12f')](db[_0x2b8f('0x176')],{});db[_0x2b8f('0x4d')][_0x2b8f('0x12f')](db[_0x2b8f('0x14')],{});db['MailQueueReport'][_0x2b8f('0x12f')](db[_0x2b8f('0x46')],{});db[_0x2b8f('0x188')][_0x2b8f('0x124')](db[_0x2b8f('0x50')],{'as':_0x2b8f('0x189'),'onDelete':_0x2b8f('0x121')});db['FaxAccount']['hasMany'](db['Disposition'],{'as':_0x2b8f('0x18a'),'foreignKey':_0x2b8f('0x18b'),'onDelete':_0x2b8f('0x121')});db[_0x2b8f('0x51')]['hasMany'](db[_0x2b8f('0x83')],{'as':_0x2b8f('0x175'),'foreignKey':_0x2b8f('0x18b')});db[_0x2b8f('0x51')]['hasMany'](db['FaxInteraction'],{'as':'Interactions'});db[_0x2b8f('0x51')][_0x2b8f('0x124')](db[_0x2b8f('0x18c')],{'as':_0x2b8f('0x157')});db[_0x2b8f('0x51')]['hasMany'](db[_0x2b8f('0x1a')],{'as':_0x2b8f('0x18d'),'onDelete':'cascade'});db[_0x2b8f('0x51')][_0x2b8f('0x124')](db[_0x2b8f('0x53')],{'as':_0x2b8f('0x169')});db[_0x2b8f('0x51')][_0x2b8f('0x12f')](db['Trunk'],{'as':_0x2b8f('0x2d')});db[_0x2b8f('0x51')][_0x2b8f('0x12f')](db['CmList'],{'as':'List','foreignKey':_0x2b8f('0x18e')});db[_0x2b8f('0x51')][_0x2b8f('0x12f')](db[_0x2b8f('0x178')],{'as':_0x2b8f('0x164'),'foreignKey':_0x2b8f('0x165')});db[_0x2b8f('0x51')][_0x2b8f('0x133')](db['User'],{'as':_0x2b8f('0x166'),'through':'user_has_fax_accounts'});db[_0x2b8f('0x18c')]['belongsTo'](db[_0x2b8f('0x14')],{'onDelete':'restrict'});db[_0x2b8f('0x18c')][_0x2b8f('0x12f')](db[_0x2b8f('0x145')],{'onDelete':'restrict'});db[_0x2b8f('0x18c')][_0x2b8f('0x12f')](db[_0x2b8f('0x51')],{'onDelete':_0x2b8f('0x173')});db[_0x2b8f('0x18c')][_0x2b8f('0x12f')](db['Tag'],{'onDelete':_0x2b8f('0x173'),'foreignKey':_0x2b8f('0x18f')});db[_0x2b8f('0x52')]['hasMany'](db[_0x2b8f('0x53')],{'as':_0x2b8f('0x169'),'onDelete':_0x2b8f('0x121'),'foreignKey':'FaxInteractionId'});db[_0x2b8f('0x52')]['belongsTo'](db['FaxAccount'],{'as':'Account','foreignKey':_0x2b8f('0x18b')});db[_0x2b8f('0x52')][_0x2b8f('0x12f')](db[_0x2b8f('0x73')],{'as':'Contact','foreignKey':'ContactId'});db[_0x2b8f('0x52')][_0x2b8f('0x12f')](db['User'],{'as':_0x2b8f('0x17d'),'foreignKey':'UserId'});db[_0x2b8f('0x52')][_0x2b8f('0x133')](db['Tag'],{'through':_0x2b8f('0x190'),'as':_0x2b8f('0x17f')});db[_0x2b8f('0x52')]['belongsToMany'](db[_0x2b8f('0x17e')],{'through':'fax_interaction_has_tags','as':_0x2b8f('0x181')});db[_0x2b8f('0x52')][_0x2b8f('0x133')](db[_0x2b8f('0x14')],{'as':_0x2b8f('0x191'),'through':'user_has_fax_interactions','foreignKey':'FaxInteractionId'});db['FaxMessage'][_0x2b8f('0x12f')](db[_0x2b8f('0x14')],{'onDelete':'cascade','as':_0x2b8f('0x14')});db['FaxMessage']['belongsTo'](db[_0x2b8f('0x52')],{'as':_0x2b8f('0x185'),'foreignKey':_0x2b8f('0x192')});db['FaxMessage'][_0x2b8f('0x12f')](db[_0x2b8f('0x73')],{'onDelete':_0x2b8f('0x121'),'as':_0x2b8f('0x16f')});db[_0x2b8f('0x53')][_0x2b8f('0x12f')](db['Attachment'],{'as':_0x2b8f('0xfa'),'foreignKey':_0x2b8f('0x193')});db[_0x2b8f('0x53')][_0x2b8f('0x12f')](db['FaxAccount'],{'as':_0x2b8f('0x17c'),'foreignKey':_0x2b8f('0x18b')});db[_0x2b8f('0x145')][_0x2b8f('0x133')](db[_0x2b8f('0x14')],{'as':_0x2b8f('0x166'),'through':'UserFaxQueue'});db['FaxQueue']['belongsToMany'](db[_0x2b8f('0x167')],{'through':_0x2b8f('0x194'),'as':_0x2b8f('0x17b')});db['FaxQueueReport'][_0x2b8f('0x12f')](db[_0x2b8f('0x51')],{});db['FaxQueueReport'][_0x2b8f('0x12f')](db[_0x2b8f('0x103')],{'as':_0x2b8f('0x195'),'foreignKey':_0x2b8f('0x18e')});db['FaxQueueReport']['belongsTo'](db['CmContact'],{'as':_0x2b8f('0x16f'),'foreignKey':_0x2b8f('0x170')});db[_0x2b8f('0x196')][_0x2b8f('0x12f')](db[_0x2b8f('0x52')],{});db[_0x2b8f('0x196')][_0x2b8f('0x12f')](db[_0x2b8f('0x53')],{});db['FaxQueueReport'][_0x2b8f('0x12f')](db['User'],{});db[_0x2b8f('0x196')][_0x2b8f('0x12f')](db['FaxQueue'],{});db[_0x2b8f('0x57')][_0x2b8f('0x124')](db[_0x2b8f('0x85')],{'as':_0x2b8f('0x18a'),'foreignKey':_0x2b8f('0x197'),'onDelete':'cascade'});db[_0x2b8f('0x57')][_0x2b8f('0x124')](db[_0x2b8f('0x83')],{'as':_0x2b8f('0x175'),'foreignKey':_0x2b8f('0x197')});db['SmsAccount'][_0x2b8f('0x124')](db[_0x2b8f('0x198')],{'as':_0x2b8f('0x169'),'foreignKey':_0x2b8f('0x197')});db[_0x2b8f('0x57')]['hasMany'](db[_0x2b8f('0x129')],{'as':_0x2b8f('0x199')});db[_0x2b8f('0x57')][_0x2b8f('0x124')](db['SmsApplication'],{'as':_0x2b8f('0x157')});db[_0x2b8f('0x57')][_0x2b8f('0x12f')](db[_0x2b8f('0x103')],{'as':_0x2b8f('0x195'),'foreignKey':_0x2b8f('0x18e')});db[_0x2b8f('0x57')][_0x2b8f('0x12f')](db[_0x2b8f('0x178')],{'as':_0x2b8f('0x164'),'foreignKey':_0x2b8f('0x165')});db['SmsAccount'][_0x2b8f('0x133')](db[_0x2b8f('0x14')],{'as':_0x2b8f('0x166'),'through':_0x2b8f('0x19a')});db[_0x2b8f('0x59')][_0x2b8f('0x12f')](db['User'],{'onDelete':_0x2b8f('0x173')});db[_0x2b8f('0x59')][_0x2b8f('0x12f')](db[_0x2b8f('0x5d')],{'onDelete':_0x2b8f('0x173')});db[_0x2b8f('0x59')][_0x2b8f('0x12f')](db['SmsAccount'],{'onDelete':_0x2b8f('0x173')});db[_0x2b8f('0x59')][_0x2b8f('0x12f')](db[_0x2b8f('0x162')],{'onDelete':_0x2b8f('0x173'),'foreignKey':_0x2b8f('0x163')});db[_0x2b8f('0x59')][_0x2b8f('0x12f')](db[_0x2b8f('0x17e')],{'onDelete':_0x2b8f('0x173'),'foreignKey':_0x2b8f('0x18f')});db[_0x2b8f('0x129')]['hasMany'](db[_0x2b8f('0x198')],{'as':'Messages','onDelete':_0x2b8f('0x121'),'foreignKey':'SmsInteractionId'});db[_0x2b8f('0x129')][_0x2b8f('0x12f')](db[_0x2b8f('0x57')],{'as':_0x2b8f('0x17c'),'foreignKey':_0x2b8f('0x197')});db[_0x2b8f('0x129')][_0x2b8f('0x12f')](db[_0x2b8f('0x73')],{'as':_0x2b8f('0x16f'),'foreignKey':_0x2b8f('0x170')});db[_0x2b8f('0x129')][_0x2b8f('0x12f')](db[_0x2b8f('0x14')],{'as':_0x2b8f('0x17d'),'foreignKey':_0x2b8f('0x122')});db[_0x2b8f('0x129')][_0x2b8f('0x133')](db[_0x2b8f('0x17e')],{'through':_0x2b8f('0x19b'),'as':_0x2b8f('0x17f')});db[_0x2b8f('0x129')][_0x2b8f('0x133')](db[_0x2b8f('0x17e')],{'through':'sms_interaction_has_tags','as':_0x2b8f('0x181')});db['SmsInteraction'][_0x2b8f('0x133')](db[_0x2b8f('0x14')],{'as':_0x2b8f('0x191'),'through':_0x2b8f('0x13c'),'foreignKey':'SmsInteractionId'});db[_0x2b8f('0x198')][_0x2b8f('0x12f')](db[_0x2b8f('0x14')],{'as':_0x2b8f('0x14')});db[_0x2b8f('0x198')]['belongsTo'](db[_0x2b8f('0x73')],{'onDelete':_0x2b8f('0x121'),'as':_0x2b8f('0x16f')});db[_0x2b8f('0x198')][_0x2b8f('0x12f')](db[_0x2b8f('0x129')],{'onDelete':_0x2b8f('0x121'),'as':_0x2b8f('0x185'),'foreignKey':_0x2b8f('0x19c')});db['SmsMessage'][_0x2b8f('0x12f')](db['SmsAccount'],{'as':_0x2b8f('0x17c'),'foreignKey':'SmsAccountId'});db[_0x2b8f('0x5d')][_0x2b8f('0x133')](db['User'],{'as':_0x2b8f('0x166'),'through':_0x2b8f('0x147'),'foreignKey':_0x2b8f('0x19d')});db[_0x2b8f('0x5d')]['belongsToMany'](db[_0x2b8f('0x167')],{'through':_0x2b8f('0x19e'),'as':'Teams'});db[_0x2b8f('0x5f')]['hasMany'](db[_0x2b8f('0x85')],{'as':'Dispositions','foreignKey':'OpenchannelAccountId','onDelete':_0x2b8f('0x121')});db[_0x2b8f('0x5f')][_0x2b8f('0x124')](db[_0x2b8f('0x83')],{'as':_0x2b8f('0x175'),'foreignKey':_0x2b8f('0x19f')});db[_0x2b8f('0x5f')][_0x2b8f('0x124')](db['OpenchannelInteraction'],{'as':_0x2b8f('0x199'),'foreignKey':_0x2b8f('0x19f')});db[_0x2b8f('0x5f')][_0x2b8f('0x124')](db[_0x2b8f('0x1a0')],{'as':_0x2b8f('0x169'),'foreignKey':_0x2b8f('0x19f')});db[_0x2b8f('0x5f')][_0x2b8f('0x124')](db[_0x2b8f('0x61')],{'as':_0x2b8f('0x157'),'foreignKey':'OpenchannelAccountId'});db[_0x2b8f('0x5f')][_0x2b8f('0x12f')](db[_0x2b8f('0x103')],{'as':_0x2b8f('0x195'),'foreignKey':_0x2b8f('0x18e')});db[_0x2b8f('0x5f')][_0x2b8f('0x12f')](db[_0x2b8f('0x178')],{'as':_0x2b8f('0x164'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x2b8f('0x5f')][_0x2b8f('0x133')](db[_0x2b8f('0x14')],{'as':'Agents','through':_0x2b8f('0x150')});db[_0x2b8f('0x61')]['belongsTo'](db[_0x2b8f('0x14')],{'onDelete':_0x2b8f('0x173')});db[_0x2b8f('0x61')]['belongsTo'](db['OpenchannelQueue'],{'onDelete':_0x2b8f('0x173'),'foreignKey':'OpenchannelQueueId'});db[_0x2b8f('0x61')][_0x2b8f('0x12f')](db[_0x2b8f('0x5f')],{'onDelete':_0x2b8f('0x173'),'foreignKey':_0x2b8f('0x19f')});db['OpenchannelApplication'][_0x2b8f('0x12f')](db[_0x2b8f('0x162')],{'onDelete':_0x2b8f('0x173'),'foreignKey':'IntervalId'});db[_0x2b8f('0x61')][_0x2b8f('0x12f')](db['Tag'],{'onDelete':_0x2b8f('0x173'),'foreignKey':'TagId'});db[_0x2b8f('0x62')]['hasMany'](db[_0x2b8f('0x1a0')],{'as':'Messages','onDelete':'cascade','foreignKey':'OpenchannelInteractionId'});db[_0x2b8f('0x62')]['belongsTo'](db['OpenchannelAccount'],{'as':'Account','foreignKey':_0x2b8f('0x19f')});db[_0x2b8f('0x62')][_0x2b8f('0x12f')](db[_0x2b8f('0x73')],{'as':_0x2b8f('0x16f'),'foreignKey':_0x2b8f('0x170')});db[_0x2b8f('0x62')][_0x2b8f('0x12f')](db[_0x2b8f('0x14')],{'as':_0x2b8f('0x17d'),'foreignKey':'UserId'});db[_0x2b8f('0x62')]['belongsToMany'](db[_0x2b8f('0x17e')],{'through':_0x2b8f('0x1a1'),'as':'Tags'});db[_0x2b8f('0x62')][_0x2b8f('0x133')](db[_0x2b8f('0x17e')],{'through':'openchannel_interaction_has_tags','as':_0x2b8f('0x181')});db['OpenchannelInteraction']['belongsToMany'](db[_0x2b8f('0x14')],{'as':_0x2b8f('0x191'),'through':_0x2b8f('0x13e'),'foreignKey':_0x2b8f('0x1a2')});db[_0x2b8f('0x1a0')][_0x2b8f('0x12f')](db[_0x2b8f('0x14')],{'onDelete':'cascade','as':_0x2b8f('0x14')});db[_0x2b8f('0x1a0')]['belongsTo'](db[_0x2b8f('0x73')],{'onDelete':'cascade','as':_0x2b8f('0x16f')});db[_0x2b8f('0x1a0')][_0x2b8f('0x12f')](db['OpenchannelInteraction'],{'onDelete':_0x2b8f('0x121'),'as':_0x2b8f('0x185'),'foreignKey':_0x2b8f('0x1a2')});db[_0x2b8f('0x1a0')][_0x2b8f('0x12f')](db[_0x2b8f('0xfa')],{'as':_0x2b8f('0xfa'),'foreignKey':_0x2b8f('0x193')});db['OpenchannelMessage'][_0x2b8f('0x12f')](db[_0x2b8f('0x5f')],{'as':_0x2b8f('0x17c'),'foreignKey':_0x2b8f('0x19f')});db[_0x2b8f('0x64')][_0x2b8f('0x133')](db['User'],{'as':_0x2b8f('0x166'),'through':_0x2b8f('0x3c'),'foreignKey':_0x2b8f('0x1a3')});db['OpenchannelQueue'][_0x2b8f('0x133')](db[_0x2b8f('0x167')],{'through':'team_has_openchannel_queues','as':'Teams'});db[_0x2b8f('0x66')][_0x2b8f('0x124')](db[_0x2b8f('0x85')],{'as':_0x2b8f('0x18a'),'foreignKey':_0x2b8f('0x186'),'onDelete':_0x2b8f('0x121')});db[_0x2b8f('0x66')][_0x2b8f('0x124')](db['CannedAnswer'],{'as':_0x2b8f('0x175'),'foreignKey':_0x2b8f('0x186')});db['ChatWebsite'][_0x2b8f('0x124')](db[_0x2b8f('0x70')],{'as':_0x2b8f('0x1a4')});db[_0x2b8f('0x66')][_0x2b8f('0x124')](db[_0x2b8f('0x128')],{'as':'Interactions'});db['ChatWebsite'][_0x2b8f('0x124')](db[_0x2b8f('0x1a5')],{'as':_0x2b8f('0x157')});db['ChatWebsite']['hasMany'](db[_0x2b8f('0x6a')],{'as':_0x2b8f('0x169')});db['ChatWebsite'][_0x2b8f('0x12f')](db[_0x2b8f('0x103')],{'as':_0x2b8f('0x195'),'foreignKey':_0x2b8f('0x18e')});db['ChatWebsite'][_0x2b8f('0x12f')](db[_0x2b8f('0x162')],{'as':'Interval','foreignKey':'IntervalId'});db[_0x2b8f('0x66')]['belongsTo'](db[_0x2b8f('0x44')],{'as':_0x2b8f('0x44'),'foreignKey':'MailAccountId'});db['ChatWebsite']['belongsTo'](db[_0x2b8f('0x178')],{'as':_0x2b8f('0x164'),'foreignKey':_0x2b8f('0x165')});db[_0x2b8f('0x66')]['belongsToMany'](db[_0x2b8f('0x14')],{'as':'Agents','through':_0x2b8f('0x1a6')});db[_0x2b8f('0x67')][_0x2b8f('0x12f')](db['OpenchannelAccount'],{});db[_0x2b8f('0x67')][_0x2b8f('0x12f')](db[_0x2b8f('0x103')],{'as':_0x2b8f('0x195'),'foreignKey':_0x2b8f('0x18e')});db[_0x2b8f('0x67')][_0x2b8f('0x12f')](db['CmContact'],{'as':_0x2b8f('0x16f'),'foreignKey':_0x2b8f('0x170')});db[_0x2b8f('0x67')][_0x2b8f('0x12f')](db['OpenchannelInteraction'],{});db['OpenchannelQueueReport'][_0x2b8f('0x12f')](db[_0x2b8f('0x1a0')],{});db[_0x2b8f('0x67')]['belongsTo'](db[_0x2b8f('0x14')],{});db[_0x2b8f('0x67')][_0x2b8f('0x12f')](db['OpenchannelQueue'],{});db['ChatApplication'][_0x2b8f('0x12f')](db['User'],{'as':_0x2b8f('0x1a7'),'foreignKey':_0x2b8f('0x122'),'onDelete':'restrict'});db[_0x2b8f('0x1a5')]['belongsTo'](db[_0x2b8f('0x143')],{'as':_0x2b8f('0x1a8'),'foreignKey':_0x2b8f('0x1a9'),'onDelete':_0x2b8f('0x173')});db[_0x2b8f('0x1a5')][_0x2b8f('0x12f')](db[_0x2b8f('0x66')],{'as':'Website','foreignKey':'ChatWebsiteId','onDelete':_0x2b8f('0x173')});db[_0x2b8f('0x1a5')][_0x2b8f('0x12f')](db['Tag'],{'onDelete':_0x2b8f('0x173'),'foreignKey':_0x2b8f('0x18f')});db[_0x2b8f('0x128')][_0x2b8f('0x124')](db[_0x2b8f('0x6a')],{'as':'Messages','onDelete':_0x2b8f('0x121'),'foreignKey':'ChatInteractionId'});db[_0x2b8f('0x128')][_0x2b8f('0x12f')](db[_0x2b8f('0x66')],{'as':_0x2b8f('0x17c'),'foreignKey':'ChatWebsiteId'});db[_0x2b8f('0x128')][_0x2b8f('0x12f')](db[_0x2b8f('0x73')],{'as':_0x2b8f('0x16f'),'foreignKey':'ContactId'});db[_0x2b8f('0x128')][_0x2b8f('0x12f')](db['User'],{'as':_0x2b8f('0x17d'),'foreignKey':_0x2b8f('0x122')});db[_0x2b8f('0x128')]['belongsToMany'](db[_0x2b8f('0x17e')],{'through':_0x2b8f('0x1aa'),'as':_0x2b8f('0x17f')});db[_0x2b8f('0x128')][_0x2b8f('0x133')](db[_0x2b8f('0x17e')],{'through':_0x2b8f('0x1aa'),'as':_0x2b8f('0x181')});db[_0x2b8f('0x128')]['belongsToMany'](db[_0x2b8f('0x14')],{'as':_0x2b8f('0x191'),'through':_0x2b8f('0x139'),'foreignKey':_0x2b8f('0x1ab')});db[_0x2b8f('0x6a')][_0x2b8f('0x12f')](db[_0x2b8f('0x14')],{'onDelete':'cascade','as':_0x2b8f('0x14')});db[_0x2b8f('0x6a')][_0x2b8f('0x12f')](db[_0x2b8f('0x73')],{'onDelete':_0x2b8f('0x121'),'as':'Contact','foreignKey':_0x2b8f('0x170')});db[_0x2b8f('0x6a')][_0x2b8f('0x12f')](db['ChatInteraction'],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x2b8f('0x1ab')});db[_0x2b8f('0x6a')][_0x2b8f('0x12f')](db[_0x2b8f('0xfa')],{'as':_0x2b8f('0xfa'),'foreignKey':_0x2b8f('0x193')});db['ChatMessage'][_0x2b8f('0x12f')](db[_0x2b8f('0x66')],{'as':_0x2b8f('0x17c'),'foreignKey':_0x2b8f('0x186')});db['ChatOfflineMessage']['hasMany'](db['Attachment'],{'as':'Attachments','foreignKey':'ChatOfflineMessageId','onDelete':_0x2b8f('0x121'),'hooks':!![]});db['ChatOfflineMessage'][_0x2b8f('0x12f')](db[_0x2b8f('0x73')],{'onDelete':'cascade','as':_0x2b8f('0x16f'),'foreignKey':_0x2b8f('0x170')});db['ChatOfflineMessage']['belongsTo'](db['ChatWebsite'],{'as':_0x2b8f('0x17c'),'foreignKey':'ChatWebsiteId'});db[_0x2b8f('0x143')]['belongsToMany'](db[_0x2b8f('0x14')],{'as':_0x2b8f('0x166'),'through':'UserChatQueue','hooks':!![]});db[_0x2b8f('0x143')][_0x2b8f('0x133')](db[_0x2b8f('0x167')],{'through':_0x2b8f('0x1ac'),'as':'Teams'});db['ChatGroup'][_0x2b8f('0x124')](db[_0x2b8f('0xdf')],{'as':'Messages','foreignKey':_0x2b8f('0x1ad'),'onDelete':_0x2b8f('0x121')});db[_0x2b8f('0x6e')][_0x2b8f('0x133')](db[_0x2b8f('0x14')],{'as':_0x2b8f('0x15a'),'through':_0x2b8f('0x132')});db[_0x2b8f('0x70')][_0x2b8f('0x12f')](db[_0x2b8f('0x66')],{'as':'Website','foreignKey':_0x2b8f('0x186')});db[_0x2b8f('0x1ae')][_0x2b8f('0x124')](db['CmContact'],{'as':_0x2b8f('0x134'),'foreignKey':_0x2b8f('0x1af')});db['CmContact'][_0x2b8f('0x124')](db['CmContactHasItem'],{'as':_0x2b8f('0x1b0'),'foreignKey':_0x2b8f('0x1b1')});db['CmContact'][_0x2b8f('0x124')](db['CmHopper'],{'as':_0x2b8f('0x15d'),'foreignKey':_0x2b8f('0x170')});db[_0x2b8f('0x73')][_0x2b8f('0x124')](db[_0x2b8f('0x78')],{'as':_0x2b8f('0x15e'),'foreignKey':'ContactId'});db[_0x2b8f('0x73')][_0x2b8f('0x124')](db[_0x2b8f('0x7a')],{'as':'HopperHistories','foreignKey':_0x2b8f('0x170')});db[_0x2b8f('0x73')][_0x2b8f('0x124')](db[_0x2b8f('0x7c')],{'as':_0x2b8f('0x7c'),'foreignKey':_0x2b8f('0x170')});db['CmContact'][_0x2b8f('0x124')](db[_0x2b8f('0xe5')],{'as':_0x2b8f('0x160'),'foreignKey':_0x2b8f('0x170')});db['CmContact'][_0x2b8f('0x124')](db['OpenchannelInteraction'],{'as':_0x2b8f('0x13d'),'foreignKey':_0x2b8f('0x170'),'onDelete':'restrict'});db['CmContact'][_0x2b8f('0x124')](db[_0x2b8f('0x128')],{'as':_0x2b8f('0x138'),'foreignKey':_0x2b8f('0x170'),'onDelete':_0x2b8f('0x173')});db['CmContact']['hasMany'](db[_0x2b8f('0x129')],{'as':'SmsInteractions','foreignKey':_0x2b8f('0x170'),'onDelete':'restrict'});db['CmContact'][_0x2b8f('0x124')](db[_0x2b8f('0x52')],{'as':_0x2b8f('0x13a'),'foreignKey':'ContactId','onDelete':_0x2b8f('0x173')});db[_0x2b8f('0x73')][_0x2b8f('0x124')](db[_0x2b8f('0x4a')],{'as':_0x2b8f('0x12b'),'foreignKey':_0x2b8f('0x170'),'onDelete':_0x2b8f('0x173')});db['CmContact'][_0x2b8f('0x12f')](db[_0x2b8f('0x1ae')],{'as':_0x2b8f('0x1b2'),'foreignKey':_0x2b8f('0x1af')});db[_0x2b8f('0x73')]['belongsTo'](db['CmList'],{'as':'List','foreignKey':_0x2b8f('0x18e'),'onDelete':_0x2b8f('0x121')});db['CmContact']['belongsToMany'](db[_0x2b8f('0x14')],{'as':_0x2b8f('0x191'),'through':_0x2b8f('0x1b3')});db[_0x2b8f('0x73')][_0x2b8f('0x133')](db[_0x2b8f('0x17e')],{'as':'Tags','through':_0x2b8f('0x1b4')});db['CmContact']['belongsToMany'](db[_0x2b8f('0x17e')],{'through':_0x2b8f('0x1b4'),'as':_0x2b8f('0x181')});db[_0x2b8f('0x15c')][_0x2b8f('0x124')](db[_0x2b8f('0x1b5')],{'as':_0x2b8f('0x1b6'),'foreignKey':_0x2b8f('0x1b7')});db[_0x2b8f('0x15c')][_0x2b8f('0x12f')](db[_0x2b8f('0x73')],{'as':_0x2b8f('0x16f'),'foreignKey':_0x2b8f('0x170'),'onDelete':'cascade'});db[_0x2b8f('0x15c')][_0x2b8f('0x12f')](db[_0x2b8f('0x103')],{'as':_0x2b8f('0x195'),'foreignKey':_0x2b8f('0x18e'),'onDelete':_0x2b8f('0x121')});db['CmHopper'][_0x2b8f('0x12f')](db[_0x2b8f('0x14')],{'as':_0x2b8f('0x1a7'),'foreignKey':'UserId'});db[_0x2b8f('0x15c')][_0x2b8f('0x12f')](db[_0x2b8f('0x1e')],{'as':'Queue','foreignKey':_0x2b8f('0x15b'),'onDelete':_0x2b8f('0x121')});db[_0x2b8f('0x15c')][_0x2b8f('0x12f')](db['Campaign'],{'as':_0x2b8f('0x1b8'),'foreignKey':_0x2b8f('0x1b9'),'onDelete':_0x2b8f('0x121')});db[_0x2b8f('0x15c')][_0x2b8f('0x12f')](db[_0x2b8f('0x14')],{'as':_0x2b8f('0x17d'),'foreignKey':'OwnerId'});db[_0x2b8f('0x76')][_0x2b8f('0x12f')](db['CmContact'],{'as':_0x2b8f('0x16f'),'foreignKey':_0x2b8f('0x170'),'onDelete':_0x2b8f('0x121')});db[_0x2b8f('0x76')][_0x2b8f('0x12f')](db[_0x2b8f('0x103')],{'as':_0x2b8f('0x195'),'foreignKey':_0x2b8f('0x18e'),'onDelete':_0x2b8f('0x121')});db[_0x2b8f('0x76')][_0x2b8f('0x12f')](db[_0x2b8f('0x1e')],{'as':'Queue','foreignKey':_0x2b8f('0x15b'),'onDelete':'cascade'});db['CmHopperBlack'][_0x2b8f('0x12f')](db[_0x2b8f('0x1b8')],{'as':_0x2b8f('0x1b8'),'foreignKey':'CampaignId','onDelete':'cascade'});db[_0x2b8f('0x81')]['hasMany'](db[_0x2b8f('0x87')],{'as':{'plural':_0x2b8f('0x1ba'),'singular':_0x2b8f('0x1bb')},'foreignKey':_0x2b8f('0x1bc'),'onDelete':_0x2b8f('0x121'),'hooks':!![]});db[_0x2b8f('0x81')]['hasMany'](db[_0x2b8f('0x87')],{'as':{'plural':_0x2b8f('0x1bd'),'singular':_0x2b8f('0x1be')},'foreignKey':_0x2b8f('0x1bf'),'onDelete':_0x2b8f('0x121'),'hooks':!![]});db[_0x2b8f('0x81')][_0x2b8f('0x124')](db['Action'],{'as':_0x2b8f('0x1c0'),'foreignKey':_0x2b8f('0x1c1'),'onDelete':_0x2b8f('0x121'),'hooks':!![]});db[_0x2b8f('0x85')]['hasMany'](db[_0x2b8f('0x85')],{'as':'Dispositions','foreignKey':_0x2b8f('0x1c2'),'onDelete':_0x2b8f('0x121')});db[_0x2b8f('0x162')]['hasMany'](db['Interval'],{'as':_0x2b8f('0x1c3'),'foreignKey':_0x2b8f('0x163'),'onDelete':'cascade','hooks':!![],'required':![]});db[_0x2b8f('0x162')][_0x2b8f('0x124')](db[_0x2b8f('0x1a')],{'as':'Extensions','foreignKey':_0x2b8f('0x163'),'onDelete':_0x2b8f('0x173')});db['Interval'][_0x2b8f('0x124')](db[_0x2b8f('0x4c')],{'as':'MailApplications','foreignKey':'IntervalId'});db['Interval'][_0x2b8f('0x124')](db[_0x2b8f('0x1a5')],{'as':'ChatApplications','foreignKey':_0x2b8f('0x163')});db['Interval'][_0x2b8f('0x124')](db[_0x2b8f('0x18c')],{'as':_0x2b8f('0x1c4'),'foreignKey':'IntervalId'});db[_0x2b8f('0x162')][_0x2b8f('0x124')](db[_0x2b8f('0x59')],{'as':'SmsApplications','foreignKey':_0x2b8f('0x163')});db['Schedule']['belongsTo'](db[_0x2b8f('0x44')],{});db[_0x2b8f('0x8d')]['belongsTo'](db[_0x2b8f('0x1c5')],{'foreignKey':_0x2b8f('0x1c6')});db[_0x2b8f('0x8d')][_0x2b8f('0x12f')](db[_0x2b8f('0x1c7')],{'foreignKey':_0x2b8f('0x1c8')});db[_0x2b8f('0x8f')][_0x2b8f('0x133')](db['VoiceMusicOnHold'],{'as':'Mohs','through':_0x2b8f('0x159'),'onDelete':_0x2b8f('0x173')});db[_0x2b8f('0x17e')][_0x2b8f('0x133')](db[_0x2b8f('0x73')],{'through':'cm_contact_has_tags'});db[_0x2b8f('0x17e')][_0x2b8f('0x133')](db[_0x2b8f('0x128')],{'through':'chat_interaction_has_tags'});db[_0x2b8f('0x17e')][_0x2b8f('0x133')](db[_0x2b8f('0x4a')],{'through':_0x2b8f('0x180')});db['Tag'][_0x2b8f('0x133')](db[_0x2b8f('0x129')],{'through':'sms_interaction_has_tags'});db[_0x2b8f('0x17e')][_0x2b8f('0x133')](db[_0x2b8f('0x52')],{'through':_0x2b8f('0x190')});db[_0x2b8f('0x17e')][_0x2b8f('0x133')](db['OpenchannelInteraction'],{'through':_0x2b8f('0x1a1')});db[_0x2b8f('0x17e')][_0x2b8f('0x133')](db[_0x2b8f('0x110')],{'through':'whatsapp_interaction_has_tags'});db[_0x2b8f('0x1c9')][_0x2b8f('0x12f')](db[_0x2b8f('0x90')],{'as':_0x2b8f('0x1ca'),'foreignKey':_0x2b8f('0x1cb')});db[_0x2b8f('0x1b5')][_0x2b8f('0x12f')](db['CmHopper'],{'as':'Hopper','foreignKey':_0x2b8f('0x1b7')});db[_0x2b8f('0x1c9')][_0x2b8f('0x12f')](db['CmContact'],{'as':_0x2b8f('0x16f'),'foreignKey':_0x2b8f('0x1b1')});db[_0x2b8f('0x93')][_0x2b8f('0x124')](db[_0x2b8f('0x87')],{'as':{'plural':_0x2b8f('0x1cc'),'singular':_0x2b8f('0x1cd')},'foreignKey':_0x2b8f('0x1ce'),'onDelete':'cascade','hooks':!![]});db['Trigger']['hasMany'](db['Condition'],{'as':{'plural':_0x2b8f('0x1cf'),'singular':_0x2b8f('0x1d0')},'foreignKey':_0x2b8f('0x1d1'),'onDelete':_0x2b8f('0x121'),'hooks':!![]});db[_0x2b8f('0x93')][_0x2b8f('0x124')](db['Action'],{'as':_0x2b8f('0x1c0'),'foreignKey':'TriggerId','onDelete':_0x2b8f('0x121'),'hooks':!![]});db['AnalyticCustomReport']['hasMany'](db[_0x2b8f('0xa0')],{'as':_0x2b8f('0x1d2'),'onDelete':_0x2b8f('0x121'),'foreignKey':_0x2b8f('0x1c8'),'hooks':!![]});db['AnalyticDefaultReport']['hasMany'](db['AnalyticFieldReport'],{'as':_0x2b8f('0x1d2'),'onDelete':_0x2b8f('0x121'),'foreignKey':_0x2b8f('0x1c6')});db[_0x2b8f('0x9e')]['hasMany'](db[_0x2b8f('0xa0')],{'as':'Fields','onDelete':_0x2b8f('0x121'),'foreignKey':'MetricId'});db['AnalyticFieldReport'][_0x2b8f('0x12f')](db['AnalyticMetric'],{'foreignKey':_0x2b8f('0x1d3')});db[_0x2b8f('0xa4')]['hasMany'](db['SalesforceConfiguration'],{'as':_0x2b8f('0x1d4'),'onDelete':'cascade','foreignKey':_0x2b8f('0x1d5')});db[_0x2b8f('0xa6')][_0x2b8f('0x124')](db[_0x2b8f('0xa8')],{'as':'Subjects','onDelete':_0x2b8f('0x121'),'foreignKey':'SubjectId'});db['SalesforceConfiguration'][_0x2b8f('0x124')](db['SalesforceField'],{'as':_0x2b8f('0x1d6'),'onDelete':_0x2b8f('0x121'),'foreignKey':_0x2b8f('0x1d7')});db['SalesforceConfiguration'][_0x2b8f('0x124')](db['SalesforceField'],{'as':_0x2b8f('0x1d2'),'onDelete':_0x2b8f('0x121'),'foreignKey':'FieldId'});db['SalesforceConfiguration'][_0x2b8f('0x12f')](db[_0x2b8f('0xa4')],{'as':_0x2b8f('0x17c'),'foreignKey':_0x2b8f('0x1d5')});db[_0x2b8f('0xa8')][_0x2b8f('0x124')](db[_0x2b8f('0xa8')],{'as':_0x2b8f('0x1d8'),'foreignKey':_0x2b8f('0x1d9')});db[_0x2b8f('0xa8')][_0x2b8f('0x124')](db['SalesforceField'],{'as':'Description','foreignKey':_0x2b8f('0x1d7')});db[_0x2b8f('0xa8')][_0x2b8f('0x124')](db['SalesforceField'],{'as':_0x2b8f('0x1da'),'foreignKey':_0x2b8f('0x1db')});db[_0x2b8f('0xa8')][_0x2b8f('0x12f')](db[_0x2b8f('0x95')],{'as':'Variable','foreignKey':'VariableId'});db[_0x2b8f('0xaa')][_0x2b8f('0x124')](db[_0x2b8f('0xac')],{'as':'Configurations','onDelete':_0x2b8f('0x121'),'foreignKey':'AccountId'});db[_0x2b8f('0xac')][_0x2b8f('0x124')](db['SugarcrmField'],{'as':_0x2b8f('0x1dc'),'onDelete':_0x2b8f('0x121'),'foreignKey':_0x2b8f('0x1d9')});db[_0x2b8f('0xac')]['hasMany'](db[_0x2b8f('0xae')],{'as':_0x2b8f('0x1d6'),'onDelete':'cascade','foreignKey':_0x2b8f('0x1d7')});db[_0x2b8f('0xac')][_0x2b8f('0x124')](db[_0x2b8f('0xae')],{'as':_0x2b8f('0x1d2'),'onDelete':'cascade','foreignKey':_0x2b8f('0x1db')});db['SugarcrmConfiguration']['belongsTo'](db['SugarcrmAccount'],{'as':_0x2b8f('0x17c'),'foreignKey':_0x2b8f('0x1d5')});db[_0x2b8f('0xae')][_0x2b8f('0x124')](db[_0x2b8f('0xae')],{'as':_0x2b8f('0x1d8'),'foreignKey':_0x2b8f('0x1d9')});db[_0x2b8f('0xae')][_0x2b8f('0x124')](db[_0x2b8f('0xae')],{'as':_0x2b8f('0x1dd'),'foreignKey':'DescriptionId'});db[_0x2b8f('0xae')][_0x2b8f('0x124')](db['SugarcrmField'],{'as':_0x2b8f('0x1da'),'foreignKey':'FieldId'});db[_0x2b8f('0xae')][_0x2b8f('0x12f')](db[_0x2b8f('0x95')],{'as':'Variable','foreignKey':_0x2b8f('0x1de')});db[_0x2b8f('0xb0')][_0x2b8f('0x124')](db[_0x2b8f('0x1df')],{'as':_0x2b8f('0x1d4'),'onDelete':_0x2b8f('0x121'),'foreignKey':_0x2b8f('0x1d5')});db[_0x2b8f('0x1df')][_0x2b8f('0x124')](db['DeskField'],{'as':_0x2b8f('0x1dc'),'onDelete':_0x2b8f('0x121'),'foreignKey':'SubjectId'});db[_0x2b8f('0x1df')]['hasMany'](db['DeskField'],{'as':'Descriptions','onDelete':_0x2b8f('0x121'),'foreignKey':_0x2b8f('0x1d7')});db['DeskConfiguration'][_0x2b8f('0x124')](db[_0x2b8f('0xb3')],{'as':_0x2b8f('0x1d2'),'onDelete':_0x2b8f('0x121'),'foreignKey':'FieldId'});db['DeskConfiguration'][_0x2b8f('0x12f')](db['DeskAccount'],{'as':'Account','foreignKey':_0x2b8f('0x1d5')});db[_0x2b8f('0x1df')][_0x2b8f('0x133')](db[_0x2b8f('0x17e')],{'through':_0x2b8f('0x1e0')});db['DeskField'][_0x2b8f('0x124')](db[_0x2b8f('0xb3')],{'as':_0x2b8f('0x1d8'),'foreignKey':'SubjectId'});db[_0x2b8f('0xb3')][_0x2b8f('0x124')](db[_0x2b8f('0xb3')],{'as':_0x2b8f('0x1dd'),'foreignKey':_0x2b8f('0x1d7')});db['DeskField'][_0x2b8f('0x124')](db['DeskField'],{'as':_0x2b8f('0x1da'),'foreignKey':'FieldId'});db['DeskField']['belongsTo'](db[_0x2b8f('0x95')],{'as':'Variable','foreignKey':_0x2b8f('0x1de')});db['ZohoAccount'][_0x2b8f('0x124')](db['ZohoConfiguration'],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x2b8f('0x1d5')});db[_0x2b8f('0xb7')]['hasMany'](db[_0x2b8f('0xb9')],{'as':_0x2b8f('0x1dc'),'onDelete':'cascade','foreignKey':_0x2b8f('0x1d9')});db[_0x2b8f('0xb7')]['hasMany'](db[_0x2b8f('0xb9')],{'as':_0x2b8f('0x1d6'),'onDelete':'cascade','foreignKey':'DescriptionId'});db[_0x2b8f('0xb7')][_0x2b8f('0x124')](db[_0x2b8f('0xb9')],{'as':_0x2b8f('0x1d2'),'onDelete':_0x2b8f('0x121'),'foreignKey':_0x2b8f('0x1db')});db[_0x2b8f('0xb7')][_0x2b8f('0x12f')](db[_0x2b8f('0xb5')],{'as':_0x2b8f('0x17c'),'foreignKey':_0x2b8f('0x1d5')});db[_0x2b8f('0xb9')][_0x2b8f('0x124')](db['ZohoField'],{'as':_0x2b8f('0x1d8'),'foreignKey':_0x2b8f('0x1d9')});db[_0x2b8f('0xb9')][_0x2b8f('0x124')](db[_0x2b8f('0xb9')],{'as':_0x2b8f('0x1dd'),'foreignKey':_0x2b8f('0x1d7')});db['ZohoField'][_0x2b8f('0x124')](db[_0x2b8f('0xb9')],{'as':_0x2b8f('0x1da'),'foreignKey':_0x2b8f('0x1db')});db[_0x2b8f('0xb9')][_0x2b8f('0x12f')](db[_0x2b8f('0x95')],{'as':'Variable','foreignKey':'VariableId'});db[_0x2b8f('0xbb')][_0x2b8f('0x124')](db[_0x2b8f('0xbd')],{'as':_0x2b8f('0x1d4'),'onDelete':_0x2b8f('0x121'),'foreignKey':_0x2b8f('0x1d5')});db[_0x2b8f('0xbd')][_0x2b8f('0x124')](db[_0x2b8f('0xbf')],{'as':_0x2b8f('0x1dc'),'foreignKey':'SubjectId'});db[_0x2b8f('0xbd')][_0x2b8f('0x124')](db[_0x2b8f('0xbf')],{'as':_0x2b8f('0x1d6'),'foreignKey':_0x2b8f('0x1d7')});db['ZendeskConfiguration'][_0x2b8f('0x124')](db[_0x2b8f('0xbf')],{'as':_0x2b8f('0x1d2'),'foreignKey':_0x2b8f('0x1db')});db[_0x2b8f('0xbd')]['belongsTo'](db[_0x2b8f('0xbb')],{'as':_0x2b8f('0x17c'),'foreignKey':_0x2b8f('0x1d5')});db[_0x2b8f('0xbd')][_0x2b8f('0x133')](db[_0x2b8f('0x17e')],{'through':_0x2b8f('0x1e1')});db[_0x2b8f('0xbf')][_0x2b8f('0x124')](db[_0x2b8f('0xbf')],{'as':_0x2b8f('0x1d8'),'foreignKey':_0x2b8f('0x1d9')});db[_0x2b8f('0xbf')][_0x2b8f('0x124')](db[_0x2b8f('0xbf')],{'as':_0x2b8f('0x1dd'),'foreignKey':_0x2b8f('0x1d7')});db[_0x2b8f('0xbf')][_0x2b8f('0x124')](db['ZendeskField'],{'as':'Field','foreignKey':_0x2b8f('0x1db')});db['ZendeskField']['belongsTo'](db[_0x2b8f('0x95')],{'as':'Variable','foreignKey':'VariableId'});db[_0x2b8f('0xc1')][_0x2b8f('0x124')](db[_0x2b8f('0xc3')],{'as':_0x2b8f('0x1d4'),'onDelete':'cascade','foreignKey':_0x2b8f('0x1d5')});db[_0x2b8f('0xc3')][_0x2b8f('0x124')](db['FreshdeskField'],{'as':_0x2b8f('0x1dc'),'onDelete':_0x2b8f('0x121'),'foreignKey':_0x2b8f('0x1d9')});db[_0x2b8f('0xc3')][_0x2b8f('0x124')](db[_0x2b8f('0x1e2')],{'as':_0x2b8f('0x1d6'),'onDelete':_0x2b8f('0x121'),'foreignKey':_0x2b8f('0x1d7')});db[_0x2b8f('0xc3')][_0x2b8f('0x124')](db[_0x2b8f('0x1e2')],{'as':_0x2b8f('0x1d2'),'onDelete':'cascade','foreignKey':_0x2b8f('0x1db')});db[_0x2b8f('0xc3')][_0x2b8f('0x12f')](db[_0x2b8f('0xc1')],{'as':_0x2b8f('0x17c'),'foreignKey':_0x2b8f('0x1d5')});db['FreshdeskConfiguration']['belongsToMany'](db[_0x2b8f('0x17e')],{'through':_0x2b8f('0x1e3')});db[_0x2b8f('0x1e2')]['hasMany'](db[_0x2b8f('0x1e2')],{'as':_0x2b8f('0x1d8'),'foreignKey':_0x2b8f('0x1d9')});db[_0x2b8f('0x1e2')][_0x2b8f('0x124')](db[_0x2b8f('0x1e2')],{'as':_0x2b8f('0x1dd'),'foreignKey':_0x2b8f('0x1d7')});db[_0x2b8f('0x1e2')][_0x2b8f('0x124')](db[_0x2b8f('0x1e2')],{'as':_0x2b8f('0x1da'),'foreignKey':_0x2b8f('0x1db')});db[_0x2b8f('0x1e2')][_0x2b8f('0x12f')](db['Variable'],{'as':_0x2b8f('0x95'),'foreignKey':'VariableId'});db[_0x2b8f('0xc6')]['hasMany'](db['VtigerConfiguration'],{'as':'Configurations','onDelete':_0x2b8f('0x121'),'foreignKey':_0x2b8f('0x1d5')});db[_0x2b8f('0xc7')][_0x2b8f('0x124')](db['VtigerField'],{'as':_0x2b8f('0x1dc'),'foreignKey':_0x2b8f('0x1d9')});db[_0x2b8f('0xc7')][_0x2b8f('0x124')](db[_0x2b8f('0xc9')],{'as':_0x2b8f('0x1d6'),'foreignKey':'DescriptionId'});db['VtigerConfiguration'][_0x2b8f('0x124')](db[_0x2b8f('0xc9')],{'as':_0x2b8f('0x1d2'),'foreignKey':_0x2b8f('0x1db')});db['VtigerConfiguration'][_0x2b8f('0x12f')](db[_0x2b8f('0xc6')],{'as':'Account','foreignKey':'AccountId'});db[_0x2b8f('0xc9')]['hasMany'](db['VtigerField'],{'as':_0x2b8f('0x1d8'),'foreignKey':'SubjectId'});db['VtigerField'][_0x2b8f('0x124')](db[_0x2b8f('0xc9')],{'as':'Description','foreignKey':'DescriptionId'});db['VtigerField'][_0x2b8f('0x124')](db[_0x2b8f('0xc9')],{'as':_0x2b8f('0x1da'),'foreignKey':_0x2b8f('0x1db')});db[_0x2b8f('0xc9')][_0x2b8f('0x12f')](db[_0x2b8f('0x95')],{'as':_0x2b8f('0x95'),'foreignKey':'VariableId'});db[_0x2b8f('0xcb')]['hasMany'](db['ServicenowConfiguration'],{'as':_0x2b8f('0x1d4'),'onDelete':_0x2b8f('0x121'),'foreignKey':_0x2b8f('0x1d5')});db[_0x2b8f('0xcd')]['hasMany'](db[_0x2b8f('0xce')],{'as':_0x2b8f('0x1dc'),'foreignKey':_0x2b8f('0x1d9')});db['ServicenowConfiguration'][_0x2b8f('0x124')](db[_0x2b8f('0xce')],{'as':'Descriptions','foreignKey':_0x2b8f('0x1d7')});db[_0x2b8f('0xcd')]['hasMany'](db[_0x2b8f('0xce')],{'as':_0x2b8f('0x1d2'),'foreignKey':_0x2b8f('0x1db')});db[_0x2b8f('0xcd')][_0x2b8f('0x12f')](db['ServicenowAccount'],{'as':_0x2b8f('0x17c'),'foreignKey':_0x2b8f('0x1d5')});db['ServicenowField'][_0x2b8f('0x124')](db[_0x2b8f('0xce')],{'as':'Subject','foreignKey':'SubjectId'});db['ServicenowField'][_0x2b8f('0x124')](db[_0x2b8f('0xce')],{'as':_0x2b8f('0x1dd'),'foreignKey':'DescriptionId'});db[_0x2b8f('0xce')][_0x2b8f('0x124')](db[_0x2b8f('0xce')],{'as':_0x2b8f('0x1da'),'foreignKey':'FieldId'});db[_0x2b8f('0xce')][_0x2b8f('0x12f')](db[_0x2b8f('0x95')],{'as':_0x2b8f('0x95'),'foreignKey':'VariableId'});db[_0x2b8f('0xd0')][_0x2b8f('0x124')](db['Dynamics365Configuration'],{'as':_0x2b8f('0x1d4'),'onDelete':_0x2b8f('0x121'),'foreignKey':_0x2b8f('0x1d5')});db['Dynamics365Account']['belongsTo'](db[_0x2b8f('0x117')],{'as':'CloudProvider','foreignKey':_0x2b8f('0x172')});db['Dynamics365Configuration'][_0x2b8f('0x124')](db[_0x2b8f('0xd4')],{'as':_0x2b8f('0x1dc'),'onDelete':'cascade','foreignKey':'SubjectId'});db['Dynamics365Configuration'][_0x2b8f('0x124')](db[_0x2b8f('0xd4')],{'as':'Descriptions','onDelete':_0x2b8f('0x121'),'foreignKey':_0x2b8f('0x1d7')});db[_0x2b8f('0xd2')][_0x2b8f('0x124')](db[_0x2b8f('0xd4')],{'as':_0x2b8f('0x1d2'),'onDelete':_0x2b8f('0x121'),'foreignKey':_0x2b8f('0x1db')});db[_0x2b8f('0xd2')][_0x2b8f('0x12f')](db[_0x2b8f('0xd0')],{'as':_0x2b8f('0x17c'),'foreignKey':_0x2b8f('0x1d5')});db[_0x2b8f('0xd4')]['hasMany'](db['Dynamics365Field'],{'as':_0x2b8f('0x1d8'),'foreignKey':_0x2b8f('0x1d9')});db[_0x2b8f('0xd4')][_0x2b8f('0x124')](db[_0x2b8f('0xd4')],{'as':'Description','foreignKey':_0x2b8f('0x1d7')});db[_0x2b8f('0xd4')][_0x2b8f('0x124')](db['Dynamics365Field'],{'as':_0x2b8f('0x1da'),'foreignKey':'FieldId'});db['Dynamics365Field'][_0x2b8f('0x12f')](db[_0x2b8f('0x95')],{'as':'Variable','foreignKey':_0x2b8f('0x1de')});db['FreshsalesAccount']['hasMany'](db[_0x2b8f('0xd8')],{'as':_0x2b8f('0x1d4'),'onDelete':_0x2b8f('0x121'),'foreignKey':_0x2b8f('0x1d5')});db[_0x2b8f('0xd8')][_0x2b8f('0x124')](db[_0x2b8f('0x1e4')],{'as':_0x2b8f('0x1dc'),'foreignKey':_0x2b8f('0x1d9')});db['FreshsalesConfiguration']['hasMany'](db[_0x2b8f('0x1e4')],{'as':_0x2b8f('0x1d6'),'foreignKey':_0x2b8f('0x1d7')});db['FreshsalesConfiguration'][_0x2b8f('0x124')](db[_0x2b8f('0x1e4')],{'as':'Fields','foreignKey':_0x2b8f('0x1db')});db[_0x2b8f('0xd8')][_0x2b8f('0x12f')](db[_0x2b8f('0xd6')],{'as':'Account','foreignKey':_0x2b8f('0x1d5')});db[_0x2b8f('0x1e4')][_0x2b8f('0x124')](db[_0x2b8f('0x1e4')],{'as':_0x2b8f('0x1d8'),'foreignKey':'SubjectId'});db['FreshsalesField']['hasMany'](db[_0x2b8f('0x1e4')],{'as':_0x2b8f('0x1dd'),'foreignKey':_0x2b8f('0x1d7')});db[_0x2b8f('0x1e4')][_0x2b8f('0x124')](db[_0x2b8f('0x1e4')],{'as':_0x2b8f('0x1da'),'foreignKey':_0x2b8f('0x1db')});db[_0x2b8f('0x1e4')][_0x2b8f('0x12f')](db[_0x2b8f('0x95')],{'as':_0x2b8f('0x95'),'foreignKey':_0x2b8f('0x1de')});db[_0x2b8f('0xdd')][_0x2b8f('0x12f')](db[_0x2b8f('0x66')],{});db[_0x2b8f('0xdd')][_0x2b8f('0x12f')](db[_0x2b8f('0x103')],{'as':_0x2b8f('0x195'),'foreignKey':_0x2b8f('0x18e')});db[_0x2b8f('0xdd')][_0x2b8f('0x12f')](db[_0x2b8f('0x73')],{'as':_0x2b8f('0x16f'),'foreignKey':_0x2b8f('0x170')});db[_0x2b8f('0xdd')][_0x2b8f('0x12f')](db[_0x2b8f('0x128')],{});db[_0x2b8f('0xdd')][_0x2b8f('0x12f')](db[_0x2b8f('0x6a')],{});db[_0x2b8f('0xdd')][_0x2b8f('0x12f')](db[_0x2b8f('0x14')],{});db[_0x2b8f('0xdd')][_0x2b8f('0x12f')](db[_0x2b8f('0x143')],{});db[_0x2b8f('0xdf')]['belongsTo'](db[_0x2b8f('0x14')],{'onDelete':'cascade','foreignKey':_0x2b8f('0x1e5')});db[_0x2b8f('0xdf')]['belongsTo'](db[_0x2b8f('0x14')],{'onDelete':'cascade','foreignKey':_0x2b8f('0x1e6')});db[_0x2b8f('0xe5')][_0x2b8f('0x124')](db[_0x2b8f('0xe3')],{'foreignKey':_0x2b8f('0x1e7'),'onDelete':_0x2b8f('0x121')});db['JscriptySessionReport'][_0x2b8f('0x124')](db[_0x2b8f('0xe1')],{'foreignKey':_0x2b8f('0x1e7'),'onDelete':'cascade'});db[_0x2b8f('0xe7')][_0x2b8f('0x12f')](db[_0x2b8f('0x57')],{});db['SmsQueueReport'][_0x2b8f('0x12f')](db[_0x2b8f('0x103')],{'as':_0x2b8f('0x195'),'foreignKey':_0x2b8f('0x18e')});db[_0x2b8f('0xe7')][_0x2b8f('0x12f')](db[_0x2b8f('0x73')],{'as':_0x2b8f('0x16f'),'foreignKey':_0x2b8f('0x170')});db[_0x2b8f('0xe7')][_0x2b8f('0x12f')](db['SmsInteraction'],{});db[_0x2b8f('0xe7')][_0x2b8f('0x12f')](db['SmsMessage'],{});db['SmsQueueReport'][_0x2b8f('0x12f')](db[_0x2b8f('0x14')],{});db['SmsQueueReport']['belongsTo'](db[_0x2b8f('0x5d')],{});db[_0x2b8f('0x1e8')]['hasMany'](db[_0x2b8f('0xe5')],{'foreignKey':_0x2b8f('0x1e9')});db[_0x2b8f('0x1e8')][_0x2b8f('0x124')](db[_0x2b8f('0xe3')],{'foreignKey':_0x2b8f('0x1e9')});db['JscriptyProject'][_0x2b8f('0x124')](db[_0x2b8f('0xe1')],{'foreignKey':_0x2b8f('0x1e9')});db[_0x2b8f('0xf0')][_0x2b8f('0x133')](db['User'],{'as':_0x2b8f('0x191'),'through':_0x2b8f('0x154')});db[_0x2b8f('0x167')]['belongsToMany'](db[_0x2b8f('0x14')],{'as':_0x2b8f('0x166'),'through':_0x2b8f('0x137')});db['Team'][_0x2b8f('0x133')](db['VoiceQueue'],{'through':_0x2b8f('0x118'),'as':_0x2b8f('0x13f')});db[_0x2b8f('0x167')][_0x2b8f('0x133')](db[_0x2b8f('0x46')],{'through':_0x2b8f('0x17a'),'as':'MailQueues'});db[_0x2b8f('0x167')][_0x2b8f('0x133')](db[_0x2b8f('0x143')],{'through':_0x2b8f('0x1ac'),'as':'ChatQueues'});db[_0x2b8f('0x167')][_0x2b8f('0x133')](db[_0x2b8f('0x145')],{'through':_0x2b8f('0x194'),'as':_0x2b8f('0x146')});db[_0x2b8f('0x167')][_0x2b8f('0x133')](db[_0x2b8f('0x5d')],{'through':_0x2b8f('0x19e'),'as':_0x2b8f('0x1ea')});db[_0x2b8f('0x167')][_0x2b8f('0x133')](db['OpenchannelQueue'],{'through':_0x2b8f('0x1eb'),'as':'OpenchannelQueues'});db['Team'][_0x2b8f('0x133')](db[_0x2b8f('0x149')],{'through':_0x2b8f('0x1ec'),'as':_0x2b8f('0x14a')});db['Team']['belongsToMany'](db[_0x2b8f('0x140')],{'through':_0x2b8f('0x11a'),'as':_0x2b8f('0x141')});db[_0x2b8f('0x1b8')][_0x2b8f('0x124')](db[_0x2b8f('0x15c')],{'as':_0x2b8f('0x15d'),'foreignKey':_0x2b8f('0x1b9')});db[_0x2b8f('0x1b8')]['hasMany'](db[_0x2b8f('0x78')],{'as':'HopperFinals','foreignKey':_0x2b8f('0x1b9')});db[_0x2b8f('0x1b8')][_0x2b8f('0x124')](db['CmHopperHistory'],{'as':'HopperHistories','foreignKey':_0x2b8f('0x1b9')});db[_0x2b8f('0x1b8')][_0x2b8f('0x124')](db['CmHopperBlack'],{'as':_0x2b8f('0x15f'),'foreignKey':_0x2b8f('0x1b9')});db[_0x2b8f('0x1b8')][_0x2b8f('0x12f')](db[_0x2b8f('0x2d')],{'as':_0x2b8f('0x2d'),'foreignKey':_0x2b8f('0x161')});db[_0x2b8f('0x1b8')]['belongsTo'](db[_0x2b8f('0x2d')],{'as':_0x2b8f('0x1ed'),'foreignKey':_0x2b8f('0x1ee')});db[_0x2b8f('0x1b8')][_0x2b8f('0x12f')](db['Interval'],{'as':'Interval','foreignKey':'IntervalId'});db[_0x2b8f('0x1b8')][_0x2b8f('0x12f')](db['SquareProject'],{'as':_0x2b8f('0xf0'),'foreignKey':_0x2b8f('0x1ef')});db[_0x2b8f('0x1b8')][_0x2b8f('0x133')](db[_0x2b8f('0x103')],{'as':_0x2b8f('0x135'),'through':_0x2b8f('0x1f0')});db[_0x2b8f('0x1b8')]['belongsToMany'](db[_0x2b8f('0x103')],{'as':_0x2b8f('0x1f1'),'through':_0x2b8f('0x1f2')});db[_0x2b8f('0xfa')]['belongsTo'](db['ChatOfflineMessage'],{'as':_0x2b8f('0x6b'),'foreignKey':_0x2b8f('0x187')});db['MailTransferReport'][_0x2b8f('0x12f')](db[_0x2b8f('0x176')],{});db[_0x2b8f('0x1f3')]['belongsTo'](db['MailInteraction'],{});db[_0x2b8f('0x1f3')][_0x2b8f('0x12f')](db[_0x2b8f('0x44')],{'foreignKey':_0x2b8f('0x1f4'),'as':_0x2b8f('0x1f5')});db[_0x2b8f('0x1f3')][_0x2b8f('0x12f')](db[_0x2b8f('0x14')],{'foreignKey':_0x2b8f('0x1f6'),'as':'FromAgent'});db[_0x2b8f('0x1f3')][_0x2b8f('0x12f')](db[_0x2b8f('0x14')],{'foreignKey':_0x2b8f('0x1f7'),'as':_0x2b8f('0x1f8')});db[_0x2b8f('0x1f3')][_0x2b8f('0x12f')](db[_0x2b8f('0x46')],{'foreignKey':_0x2b8f('0x1f9'),'as':_0x2b8f('0x1fa')});db[_0x2b8f('0x1f3')][_0x2b8f('0x12f')](db[_0x2b8f('0x44')],{'foreignKey':_0x2b8f('0x1fb'),'as':_0x2b8f('0x1fc')});db['ChatTransferReport'][_0x2b8f('0x12f')](db['ChatMessage'],{});db['ChatTransferReport'][_0x2b8f('0x12f')](db['ChatInteraction'],{});db['ChatTransferReport']['belongsTo'](db[_0x2b8f('0x66')],{'foreignKey':'FromChatWebsiteId','as':_0x2b8f('0x1f5')});db[_0x2b8f('0x1fd')][_0x2b8f('0x12f')](db[_0x2b8f('0x14')],{'foreignKey':_0x2b8f('0x1f6'),'as':_0x2b8f('0x1fe')});db[_0x2b8f('0x1fd')][_0x2b8f('0x12f')](db[_0x2b8f('0x14')],{'foreignKey':_0x2b8f('0x1f7'),'as':_0x2b8f('0x1f8')});db['ChatTransferReport'][_0x2b8f('0x12f')](db[_0x2b8f('0x143')],{'foreignKey':'ToChatQueueId','as':_0x2b8f('0x1fa')});db[_0x2b8f('0x1fd')][_0x2b8f('0x12f')](db[_0x2b8f('0x66')],{'foreignKey':_0x2b8f('0x1ff'),'as':_0x2b8f('0x1fc')});db['FaxTransferReport'][_0x2b8f('0x12f')](db['FaxMessage'],{});db[_0x2b8f('0xff')]['belongsTo'](db['FaxInteraction'],{});db['FaxTransferReport'][_0x2b8f('0x12f')](db[_0x2b8f('0x51')],{'foreignKey':_0x2b8f('0x200'),'as':'FromAccount'});db[_0x2b8f('0xff')]['belongsTo'](db[_0x2b8f('0x14')],{'foreignKey':_0x2b8f('0x1f6'),'as':_0x2b8f('0x1fe')});db[_0x2b8f('0xff')][_0x2b8f('0x12f')](db[_0x2b8f('0x14')],{'foreignKey':_0x2b8f('0x1f7'),'as':_0x2b8f('0x1f8')});db[_0x2b8f('0xff')][_0x2b8f('0x12f')](db['FaxQueue'],{'foreignKey':_0x2b8f('0x201'),'as':_0x2b8f('0x1fa')});db[_0x2b8f('0xff')][_0x2b8f('0x12f')](db[_0x2b8f('0x51')],{'foreignKey':_0x2b8f('0x202'),'as':_0x2b8f('0x1fc')});db[_0x2b8f('0x203')]['belongsTo'](db['OpenchannelMessage'],{});db['OpenchannelTransferReport'][_0x2b8f('0x12f')](db[_0x2b8f('0x62')],{});db[_0x2b8f('0x203')][_0x2b8f('0x12f')](db[_0x2b8f('0x5f')],{'foreignKey':_0x2b8f('0x204'),'as':_0x2b8f('0x1f5')});db[_0x2b8f('0x203')][_0x2b8f('0x12f')](db[_0x2b8f('0x14')],{'foreignKey':_0x2b8f('0x1f6'),'as':_0x2b8f('0x1fe')});db[_0x2b8f('0x203')]['belongsTo'](db[_0x2b8f('0x14')],{'foreignKey':_0x2b8f('0x1f7'),'as':'ToAgent'});db[_0x2b8f('0x203')][_0x2b8f('0x12f')](db['OpenchannelQueue'],{'foreignKey':_0x2b8f('0x205'),'as':_0x2b8f('0x1fa')});db['OpenchannelTransferReport'][_0x2b8f('0x12f')](db[_0x2b8f('0x5f')],{'foreignKey':'ToOpenchannelAccountId','as':_0x2b8f('0x1fc')});db[_0x2b8f('0x101')][_0x2b8f('0x12f')](db[_0x2b8f('0x198')],{});db[_0x2b8f('0x101')][_0x2b8f('0x12f')](db[_0x2b8f('0x129')],{});db[_0x2b8f('0x101')][_0x2b8f('0x12f')](db[_0x2b8f('0x57')],{'foreignKey':_0x2b8f('0x206'),'as':_0x2b8f('0x1f5')});db[_0x2b8f('0x101')][_0x2b8f('0x12f')](db['User'],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0x2b8f('0x101')][_0x2b8f('0x12f')](db[_0x2b8f('0x14')],{'foreignKey':_0x2b8f('0x1f7'),'as':_0x2b8f('0x1f8')});db[_0x2b8f('0x101')][_0x2b8f('0x12f')](db[_0x2b8f('0x5d')],{'foreignKey':'ToSmsQueueId','as':_0x2b8f('0x1fa')});db[_0x2b8f('0x101')][_0x2b8f('0x12f')](db[_0x2b8f('0x57')],{'foreignKey':'ToSmsAccountId','as':_0x2b8f('0x1fc')});db[_0x2b8f('0x103')][_0x2b8f('0x124')](db['Disposition'],{'as':'Dispositions','foreignKey':_0x2b8f('0x18e'),'onDelete':_0x2b8f('0x121')});db[_0x2b8f('0x103')][_0x2b8f('0x124')](db['CmCustomField'],{'as':'CustomFields','foreignKey':'ListId'});db[_0x2b8f('0x103')][_0x2b8f('0x124')](db[_0x2b8f('0x73')],{'as':_0x2b8f('0x134'),'onDelete':_0x2b8f('0x121'),'foreignKey':_0x2b8f('0x18e')});db[_0x2b8f('0x103')][_0x2b8f('0x124')](db[_0x2b8f('0x78')],{'as':_0x2b8f('0x15e'),'foreignKey':_0x2b8f('0x18e')});db[_0x2b8f('0x103')][_0x2b8f('0x124')](db['CmHopperHistory'],{'as':'HopperHistory','foreignKey':_0x2b8f('0x18e')});db[_0x2b8f('0x103')]['hasMany'](db[_0x2b8f('0x7c')],{'as':_0x2b8f('0x7c'),'foreignKey':_0x2b8f('0x18e')});db['CmList'][_0x2b8f('0x133')](db[_0x2b8f('0x1e')],{'as':_0x2b8f('0x207'),'through':_0x2b8f('0x208')});db[_0x2b8f('0x103')][_0x2b8f('0x133')](db['User'],{'as':_0x2b8f('0x166'),'through':'cm_user_has_lists'});db['VoicePrefix'][_0x2b8f('0x124')](db[_0x2b8f('0x1a')],{'as':_0x2b8f('0x126'),'onDelete':_0x2b8f('0x121')});db[_0x2b8f('0x140')][_0x2b8f('0x133')](db[_0x2b8f('0x14')],{'as':_0x2b8f('0x166'),'through':'UserVoicePrefix'});db[_0x2b8f('0x140')]['belongsToMany'](db[_0x2b8f('0x167')],{'through':_0x2b8f('0x11a'),'as':_0x2b8f('0x17b')});db['UserProfile'][_0x2b8f('0x124')](db[_0x2b8f('0x14')],{'as':'Users','foreignKey':_0x2b8f('0x130')});db[_0x2b8f('0x105')][_0x2b8f('0x124')](db[_0x2b8f('0x107')],{'as':_0x2b8f('0x209'),'foreignKey':'userProfileId','onDelete':_0x2b8f('0x121')});db['UserProfileSection'][_0x2b8f('0x124')](db['UserProfileResource'],{'as':_0x2b8f('0x20a'),'foreignKey':'sectionId','onDelete':_0x2b8f('0x121')});db[_0x2b8f('0x10c')][_0x2b8f('0x124')](db[_0x2b8f('0x85')],{'as':_0x2b8f('0x18a'),'foreignKey':_0x2b8f('0x20b'),'onDelete':_0x2b8f('0x121')});db[_0x2b8f('0x10c')][_0x2b8f('0x124')](db[_0x2b8f('0x83')],{'as':_0x2b8f('0x175'),'foreignKey':_0x2b8f('0x20b')});db[_0x2b8f('0x10c')][_0x2b8f('0x124')](db[_0x2b8f('0x111')],{'as':'Messages','foreignKey':_0x2b8f('0x20b')});db['WhatsappAccount'][_0x2b8f('0x124')](db[_0x2b8f('0x110')],{'as':_0x2b8f('0x199')});db[_0x2b8f('0x10c')][_0x2b8f('0x124')](db[_0x2b8f('0x10e')],{'as':_0x2b8f('0x157')});db['WhatsappAccount']['belongsTo'](db[_0x2b8f('0x103')],{'as':_0x2b8f('0x195'),'foreignKey':_0x2b8f('0x18e')});db[_0x2b8f('0x10c')]['belongsTo'](db[_0x2b8f('0x178')],{'as':'mandatoryDispositionPause','foreignKey':_0x2b8f('0x165')});db[_0x2b8f('0x10c')][_0x2b8f('0x133')](db['User'],{'as':'Agents','through':'user_has_whatsapp_accounts'});db[_0x2b8f('0x10e')][_0x2b8f('0x12f')](db[_0x2b8f('0x14')],{'onDelete':_0x2b8f('0x173')});db[_0x2b8f('0x10e')]['belongsTo'](db['WhatsappQueue'],{'onDelete':_0x2b8f('0x173')});db[_0x2b8f('0x10e')][_0x2b8f('0x12f')](db[_0x2b8f('0x10c')],{'onDelete':_0x2b8f('0x173')});db[_0x2b8f('0x10e')][_0x2b8f('0x12f')](db[_0x2b8f('0x162')],{'onDelete':_0x2b8f('0x173'),'foreignKey':_0x2b8f('0x163')});db[_0x2b8f('0x10e')]['belongsTo'](db[_0x2b8f('0x17e')],{'onDelete':_0x2b8f('0x173'),'foreignKey':_0x2b8f('0x18f')});db['WhatsappInteraction']['hasMany'](db['WhatsappMessage'],{'as':_0x2b8f('0x169'),'onDelete':_0x2b8f('0x121'),'foreignKey':_0x2b8f('0x20c')});db[_0x2b8f('0x110')]['belongsTo'](db['WhatsappAccount'],{'as':_0x2b8f('0x17c'),'foreignKey':_0x2b8f('0x20b')});db[_0x2b8f('0x110')]['belongsTo'](db[_0x2b8f('0x73')],{'as':_0x2b8f('0x16f'),'foreignKey':'ContactId'});db[_0x2b8f('0x110')][_0x2b8f('0x12f')](db[_0x2b8f('0x14')],{'as':_0x2b8f('0x17d'),'foreignKey':_0x2b8f('0x122')});db[_0x2b8f('0x110')]['belongsToMany'](db[_0x2b8f('0x17e')],{'through':_0x2b8f('0x20d'),'as':_0x2b8f('0x17f')});db['WhatsappInteraction'][_0x2b8f('0x133')](db[_0x2b8f('0x17e')],{'through':_0x2b8f('0x20d'),'as':_0x2b8f('0x181')});db['WhatsappInteraction']['belongsToMany'](db['User'],{'as':_0x2b8f('0x191'),'through':_0x2b8f('0x20e'),'foreignKey':_0x2b8f('0x20c')});db[_0x2b8f('0x111')][_0x2b8f('0x12f')](db['User'],{'as':_0x2b8f('0x14')});db[_0x2b8f('0x111')][_0x2b8f('0x12f')](db[_0x2b8f('0x73')],{'onDelete':_0x2b8f('0x121'),'as':_0x2b8f('0x16f')});db['WhatsappMessage']['belongsTo'](db[_0x2b8f('0x110')],{'onDelete':'cascade','as':_0x2b8f('0x185'),'foreignKey':_0x2b8f('0x20c')});db[_0x2b8f('0x111')][_0x2b8f('0x12f')](db[_0x2b8f('0x10c')],{'as':_0x2b8f('0x17c'),'foreignKey':_0x2b8f('0x20b')});db[_0x2b8f('0x113')][_0x2b8f('0x12f')](db[_0x2b8f('0x10c')],{});db[_0x2b8f('0x113')][_0x2b8f('0x12f')](db[_0x2b8f('0x103')],{'as':'List','foreignKey':_0x2b8f('0x18e')});db[_0x2b8f('0x113')]['belongsTo'](db[_0x2b8f('0x73')],{'as':_0x2b8f('0x16f'),'foreignKey':_0x2b8f('0x170')});db['WhatsappQueueReport'][_0x2b8f('0x12f')](db[_0x2b8f('0x110')],{});db[_0x2b8f('0x113')][_0x2b8f('0x12f')](db[_0x2b8f('0x149')],{});db[_0x2b8f('0x113')][_0x2b8f('0x12f')](db['WhatsappMessage'],{});db[_0x2b8f('0x113')][_0x2b8f('0x12f')](db[_0x2b8f('0x14')],{});db['WhatsappTransferReport'][_0x2b8f('0x12f')](db[_0x2b8f('0x111')],{});db['WhatsappTransferReport']['belongsTo'](db['WhatsappInteraction'],{});db[_0x2b8f('0x115')][_0x2b8f('0x12f')](db[_0x2b8f('0x10c')],{'foreignKey':_0x2b8f('0x20f'),'as':_0x2b8f('0x1f5')});db[_0x2b8f('0x115')][_0x2b8f('0x12f')](db[_0x2b8f('0x10c')],{'foreignKey':_0x2b8f('0x210'),'as':_0x2b8f('0x1fc')});db[_0x2b8f('0x115')][_0x2b8f('0x12f')](db[_0x2b8f('0x149')],{'foreignKey':_0x2b8f('0x211'),'as':_0x2b8f('0x1fa')});db[_0x2b8f('0x115')][_0x2b8f('0x12f')](db[_0x2b8f('0x14')],{'foreignKey':_0x2b8f('0x1f6'),'as':_0x2b8f('0x1fe')});db['WhatsappTransferReport'][_0x2b8f('0x12f')](db[_0x2b8f('0x14')],{'foreignKey':'ToUserId','as':_0x2b8f('0x1f8')});db[_0x2b8f('0x149')]['belongsToMany'](db['User'],{'as':'Agents','through':_0x2b8f('0x3e'),'foreignKey':_0x2b8f('0x212')});db[_0x2b8f('0x149')][_0x2b8f('0x133')](db[_0x2b8f('0x167')],{'through':'team_has_whatsapp_queues','as':_0x2b8f('0x17b')});db[_0x2b8f('0x11e')][_0x2b8f('0x12f')](db[_0x2b8f('0x14')],{'as':_0x2b8f('0x213'),'foreignKey':'UserId','onDelete':_0x2b8f('0x121'),'hooks':!![]});db['CloudProvider'][_0x2b8f('0x120')](db[_0x2b8f('0xd0')],{'as':_0x2b8f('0xd0'),'onDelete':'restrict'});db[_0x2b8f('0x117')][_0x2b8f('0x120')](db['MailServerIn'],{'as':_0x2b8f('0x214'),'onDelete':_0x2b8f('0x173')});db['CloudProvider'][_0x2b8f('0x120')](db[_0x2b8f('0x42')],{'as':_0x2b8f('0x174'),'onDelete':_0x2b8f('0x173')});module[_0x2b8f('0x215')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index df2179f..11bcf55 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcea5=['/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/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','/api/chat/internal/messages','/api/jscripty/answers/reports','./api/jscriptySessionReport','/api/square/reports','./api/squareReport','./api/squareReportDetail','./api/jscriptyProject','/api/settings','./api/setting','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','/api/campaigns','/api/migrations','./api/migration','/api/attachments','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','/api/fax/reports/transfer','./api/faxTransferReport','./api/openchannelTransferReport','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/realtime','./api/realtime','/api/auth/local','./api/authLocal','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/jira','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/apidoc','root','/www','join','/demo','static','/snippet','snippet','3.0.0','/server/files/plugins','/:url(api|auth|components|app|bower_components|assets)/*','get','route','sendFile','resolve','appPath','/index.html','path','express','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','then','use','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','/api/screen/recordings','./api/screenRecording','/api/voice/mails','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','./api/memberReport','/api/trunks','/api/voice/transfers/reports','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','/api/mail/substatuses','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./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/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','./api/faxQueue','/api/fax/reports/queue','/api/sms/accounts','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','/api/chat/websites','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','./api/chatInteraction','/api/chat/messages','./api/chatMessage','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','./api/cmCompany','./api/cmContact','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','./api/cmHopperFinal','/api/cm/custom_fields','/api/actions','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','./api/disposition','/api/conditions','./api/condition','/api/intervals','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','/api/templates','./api/template','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount'];(function(_0x2aee7b,_0x181285){var _0x5a4554=function(_0x3d9332){while(--_0x3d9332){_0x2aee7b['push'](_0x2aee7b['shift']());}};_0x5a4554(++_0x181285);}(_0xcea5,0x180));var _0x5cea=function(_0x17e6b8,_0x5b443f){_0x17e6b8=_0x17e6b8-0x0;var _0x441551=_0xcea5[_0x17e6b8];return _0x441551;};'use strict';var path=require(_0x5cea('0x0'));var express=require(_0x5cea('0x1'));var errors=require('./errors');var config=require(_0x5cea('0x2'));var setupLoggers=require(_0x5cea('0x3'))[_0x5cea('0x4')];var clientSideLogs=require(_0x5cea('0x5'));exports[_0x5cea('0x6')]=function(_0x555f1d){return setupLoggers(_0x555f1d)[_0x5cea('0x7')](function(){_0x555f1d[_0x5cea('0x8')](_0x5cea('0x9'),require(_0x5cea('0xa')));_0x555f1d[_0x5cea('0x8')](_0x5cea('0xb'),require(_0x5cea('0xc')));_0x555f1d[_0x5cea('0x8')](_0x5cea('0xd'),require(_0x5cea('0xe')));_0x555f1d[_0x5cea('0x8')](_0x5cea('0xf'),require(_0x5cea('0x10')));_0x555f1d[_0x5cea('0x8')]('/api/voice/mohs',require(_0x5cea('0x11')));_0x555f1d['use'](_0x5cea('0x12'),require(_0x5cea('0x13')));_0x555f1d[_0x5cea('0x8')](_0x5cea('0x14'),require('./api/voiceRecording'));_0x555f1d['use'](_0x5cea('0x15'),require(_0x5cea('0x16')));_0x555f1d['use'](_0x5cea('0x17'),require('./api/voiceMail'));_0x555f1d['use']('/api/voice/mails/messages',require('./api/voiceMailMessage'));_0x555f1d[_0x5cea('0x8')](_0x5cea('0x18'),require(_0x5cea('0x19')));_0x555f1d['use'](_0x5cea('0x1a'),require(_0x5cea('0x1b')));_0x555f1d['use'](_0x5cea('0x1c'),require(_0x5cea('0x1d')));_0x555f1d[_0x5cea('0x8')](_0x5cea('0x1e'),require(_0x5cea('0x1f')));_0x555f1d[_0x5cea('0x8')]('/api/members/reports',require(_0x5cea('0x20')));_0x555f1d[_0x5cea('0x8')](_0x5cea('0x21'),require('./api/trunk'));_0x555f1d[_0x5cea('0x8')](_0x5cea('0x22'),require('./api/voiceTransferReport'));_0x555f1d[_0x5cea('0x8')](_0x5cea('0x23'),require(_0x5cea('0x24')));_0x555f1d[_0x5cea('0x8')](_0x5cea('0x25'),require(_0x5cea('0x26')));_0x555f1d[_0x5cea('0x8')](_0x5cea('0x27'),require('./api/mailQueue'));_0x555f1d[_0x5cea('0x8')](_0x5cea('0x28'),require('./api/mailSubstatus'));_0x555f1d[_0x5cea('0x8')](_0x5cea('0x29'),require(_0x5cea('0x2a')));_0x555f1d['use'](_0x5cea('0x2b'),require(_0x5cea('0x2c')));_0x555f1d[_0x5cea('0x8')](_0x5cea('0x2d'),require(_0x5cea('0x2e')));_0x555f1d[_0x5cea('0x8')](_0x5cea('0x2f'),require(_0x5cea('0x30')));_0x555f1d['use'](_0x5cea('0x31'),require(_0x5cea('0x32')));_0x555f1d['use'](_0x5cea('0x33'),require(_0x5cea('0x34')));_0x555f1d['use'](_0x5cea('0x35'),require(_0x5cea('0x36')));_0x555f1d[_0x5cea('0x8')]('/api/fax/applications',require('./api/faxApplication'));_0x555f1d['use'](_0x5cea('0x37'),require(_0x5cea('0x38')));_0x555f1d[_0x5cea('0x8')](_0x5cea('0x39'),require(_0x5cea('0x3a')));_0x555f1d[_0x5cea('0x8')]('/api/fax/queues',require(_0x5cea('0x3b')));_0x555f1d[_0x5cea('0x8')](_0x5cea('0x3c'),require('./api/faxQueueReport'));_0x555f1d[_0x5cea('0x8')](_0x5cea('0x3d'),require('./api/smsAccount'));_0x555f1d[_0x5cea('0x8')]('/api/sms/applications',require(_0x5cea('0x3e')));_0x555f1d[_0x5cea('0x8')](_0x5cea('0x3f'),require(_0x5cea('0x40')));_0x555f1d[_0x5cea('0x8')](_0x5cea('0x41'),require(_0x5cea('0x42')));_0x555f1d[_0x5cea('0x8')](_0x5cea('0x43'),require(_0x5cea('0x44')));_0x555f1d[_0x5cea('0x8')](_0x5cea('0x45'),require(_0x5cea('0x46')));_0x555f1d[_0x5cea('0x8')](_0x5cea('0x47'),require(_0x5cea('0x48')));_0x555f1d[_0x5cea('0x8')]('/api/openchannel/interactions',require('./api/openchannelInteraction'));_0x555f1d['use'](_0x5cea('0x49'),require(_0x5cea('0x4a')));_0x555f1d[_0x5cea('0x8')](_0x5cea('0x4b'),require('./api/openchannelQueue'));_0x555f1d[_0x5cea('0x8')](_0x5cea('0x4c'),require('./api/chatWebsite'));_0x555f1d[_0x5cea('0x8')](_0x5cea('0x4d'),require(_0x5cea('0x4e')));_0x555f1d[_0x5cea('0x8')](_0x5cea('0x4f'),require(_0x5cea('0x50')));_0x555f1d[_0x5cea('0x8')]('/api/chat/interactions',require(_0x5cea('0x51')));_0x555f1d['use'](_0x5cea('0x52'),require(_0x5cea('0x53')));_0x555f1d['use']('/api/chat/offline_messages',require(_0x5cea('0x54')));_0x555f1d['use'](_0x5cea('0x55'),require(_0x5cea('0x56')));_0x555f1d[_0x5cea('0x8')](_0x5cea('0x57'),require(_0x5cea('0x58')));_0x555f1d['use'](_0x5cea('0x59'),require(_0x5cea('0x5a')));_0x555f1d[_0x5cea('0x8')]('/api/cm/companies',require(_0x5cea('0x5b')));_0x555f1d[_0x5cea('0x8')]('/api/cm/contacts',require(_0x5cea('0x5c')));_0x555f1d[_0x5cea('0x8')]('/api/cm/hopper',require(_0x5cea('0x5d')));_0x555f1d[_0x5cea('0x8')](_0x5cea('0x5e'),require(_0x5cea('0x5f')));_0x555f1d['use']('/api/cm/hopper_final',require(_0x5cea('0x60')));_0x555f1d[_0x5cea('0x8')]('/api/cm/hopper_history',require('./api/cmHopperHistory'));_0x555f1d[_0x5cea('0x8')](_0x5cea('0x61'),require('./api/cmCustomField'));_0x555f1d[_0x5cea('0x8')](_0x5cea('0x62'),require('./api/action'));_0x555f1d['use'](_0x5cea('0x63'),require(_0x5cea('0x64')));_0x555f1d[_0x5cea('0x8')](_0x5cea('0x65'),require(_0x5cea('0x66')));_0x555f1d['use']('/api/dispositions',require(_0x5cea('0x67')));_0x555f1d[_0x5cea('0x8')](_0x5cea('0x68'),require(_0x5cea('0x69')));_0x555f1d['use'](_0x5cea('0x6a'),require('./api/interval'));_0x555f1d['use']('/api/pauses',require('./api/pause'));_0x555f1d[_0x5cea('0x8')](_0x5cea('0x6b'),require(_0x5cea('0x6c')));_0x555f1d[_0x5cea('0x8')](_0x5cea('0x6d'),require(_0x5cea('0x6e')));_0x555f1d[_0x5cea('0x8')](_0x5cea('0x6f'),require(_0x5cea('0x70')));_0x555f1d['use'](_0x5cea('0x71'),require(_0x5cea('0x72')));_0x555f1d[_0x5cea('0x8')](_0x5cea('0x73'),require(_0x5cea('0x74')));_0x555f1d[_0x5cea('0x8')]('/api/contact_item_types',require(_0x5cea('0x75')));_0x555f1d['use'](_0x5cea('0x76'),require(_0x5cea('0x77')));_0x555f1d[_0x5cea('0x8')](_0x5cea('0x78'),require('./api/cmHopperAdditionalPhone'));_0x555f1d[_0x5cea('0x8')](_0x5cea('0x79'),require(_0x5cea('0x7a')));_0x555f1d['use']('/api/triggers',require('./api/trigger'));_0x555f1d[_0x5cea('0x8')](_0x5cea('0x7b'),require(_0x5cea('0x7c')));_0x555f1d[_0x5cea('0x8')](_0x5cea('0x7d'),require(_0x5cea('0x7e')));_0x555f1d[_0x5cea('0x8')](_0x5cea('0x7f'),require('./api/integrationReport'));_0x555f1d['use'](_0x5cea('0x80'),require(_0x5cea('0x81')));_0x555f1d[_0x5cea('0x8')](_0x5cea('0x82'),require('./api/analyticDefaultReport'));_0x555f1d[_0x5cea('0x8')]('/api/analytics/extracted_reports',require(_0x5cea('0x83')));_0x555f1d[_0x5cea('0x8')](_0x5cea('0x84'),require(_0x5cea('0x85')));_0x555f1d['use'](_0x5cea('0x86'),require(_0x5cea('0x87')));_0x555f1d[_0x5cea('0x8')](_0x5cea('0x88'),require(_0x5cea('0x89')));_0x555f1d[_0x5cea('0x8')](_0x5cea('0x8a'),require(_0x5cea('0x8b')));_0x555f1d[_0x5cea('0x8')](_0x5cea('0x8c'),require(_0x5cea('0x8d')));_0x555f1d[_0x5cea('0x8')](_0x5cea('0x8e'),require(_0x5cea('0x8f')));_0x555f1d[_0x5cea('0x8')](_0x5cea('0x90'),require(_0x5cea('0x91')));_0x555f1d[_0x5cea('0x8')](_0x5cea('0x92'),require(_0x5cea('0x93')));_0x555f1d['use'](_0x5cea('0x94'),require('./api/intSugarcrmField'));_0x555f1d['use'](_0x5cea('0x95'),require(_0x5cea('0x96')));_0x555f1d[_0x5cea('0x8')](_0x5cea('0x97'),require('./api/intDeskConfiguration'));_0x555f1d[_0x5cea('0x8')]('/api/integrations/desk/fields',require(_0x5cea('0x98')));_0x555f1d[_0x5cea('0x8')](_0x5cea('0x99'),require(_0x5cea('0x9a')));_0x555f1d[_0x5cea('0x8')](_0x5cea('0x9b'),require(_0x5cea('0x9c')));_0x555f1d[_0x5cea('0x8')](_0x5cea('0x9d'),require(_0x5cea('0x9e')));_0x555f1d[_0x5cea('0x8')]('/api/integrations/zendesk/accounts',require(_0x5cea('0x9f')));_0x555f1d['use'](_0x5cea('0xa0'),require(_0x5cea('0xa1')));_0x555f1d[_0x5cea('0x8')]('/api/integrations/zendesk/fields',require('./api/intZendeskField'));_0x555f1d[_0x5cea('0x8')](_0x5cea('0xa2'),require(_0x5cea('0xa3')));_0x555f1d[_0x5cea('0x8')](_0x5cea('0xa4'),require(_0x5cea('0xa5')));_0x555f1d[_0x5cea('0x8')](_0x5cea('0xa6'),require(_0x5cea('0xa7')));_0x555f1d[_0x5cea('0x8')](_0x5cea('0xa8'),require(_0x5cea('0xa9')));_0x555f1d[_0x5cea('0x8')](_0x5cea('0xaa'),require(_0x5cea('0xab')));_0x555f1d[_0x5cea('0x8')](_0x5cea('0xac'),require(_0x5cea('0xad')));_0x555f1d[_0x5cea('0x8')](_0x5cea('0xae'),require(_0x5cea('0xaf')));_0x555f1d['use'](_0x5cea('0xb0'),require('./api/intServicenowConfiguration'));_0x555f1d['use'](_0x5cea('0xb1'),require(_0x5cea('0xb2')));_0x555f1d[_0x5cea('0x8')](_0x5cea('0xb3'),require('./api/intDynamics365Account'));_0x555f1d[_0x5cea('0x8')]('/api/integrations/dynamics365/configurations',require(_0x5cea('0xb4')));_0x555f1d[_0x5cea('0x8')](_0x5cea('0xb5'),require('./api/intDynamics365Field'));_0x555f1d[_0x5cea('0x8')](_0x5cea('0xb6'),require(_0x5cea('0xb7')));_0x555f1d[_0x5cea('0x8')](_0x5cea('0xb8'),require('./api/intFreshsalesConfiguration'));_0x555f1d[_0x5cea('0x8')](_0x5cea('0xb9'),require(_0x5cea('0xba')));_0x555f1d[_0x5cea('0x8')](_0x5cea('0xbb'),require(_0x5cea('0xbc')));_0x555f1d['use'](_0x5cea('0xbd'),require('./api/chatQueueReport'));_0x555f1d[_0x5cea('0x8')](_0x5cea('0xbe'),require('./api/chatInternalMessage'));_0x555f1d['use'](_0x5cea('0xbf'),require('./api/jscriptyAnswerReport'));_0x555f1d[_0x5cea('0x8')]('/api/jscripty/questions/reports',require('./api/jscriptyQuestionReport'));_0x555f1d['use']('/api/jscripty/sessions/reports',require(_0x5cea('0xc0')));_0x555f1d[_0x5cea('0x8')]('/api/sms/reports/queue',require('./api/smsQueueReport'));_0x555f1d[_0x5cea('0x8')](_0x5cea('0xc1'),require(_0x5cea('0xc2')));_0x555f1d[_0x5cea('0x8')]('/api/square/details/reports',require(_0x5cea('0xc3')));_0x555f1d[_0x5cea('0x8')]('/api/jscripty/projects',require(_0x5cea('0xc4')));_0x555f1d[_0x5cea('0x8')](_0x5cea('0xc5'),require(_0x5cea('0xc6')));_0x555f1d['use']('/api/square/odbc',require('./api/squareOdbc'));_0x555f1d[_0x5cea('0x8')](_0x5cea('0xc7'),require(_0x5cea('0xc8')));_0x555f1d[_0x5cea('0x8')](_0x5cea('0xc9'),require(_0x5cea('0xca')));_0x555f1d[_0x5cea('0x8')](_0x5cea('0xcb'),require(_0x5cea('0xcc')));_0x555f1d['use'](_0x5cea('0xcd'),require('./api/team'));_0x555f1d[_0x5cea('0x8')]('/api/license',require('./api/license'));_0x555f1d[_0x5cea('0x8')](_0x5cea('0xce'),require('./api/campaign'));_0x555f1d['use'](_0x5cea('0xcf'),require(_0x5cea('0xd0')));_0x555f1d[_0x5cea('0x8')](_0x5cea('0xd1'),require('./api/attachment'));_0x555f1d[_0x5cea('0x8')](_0x5cea('0xd2'),require(_0x5cea('0xd3')));_0x555f1d['use'](_0x5cea('0xd4'),require(_0x5cea('0xd5')));_0x555f1d['use'](_0x5cea('0xd6'),require('./api/chatTransferReport'));_0x555f1d[_0x5cea('0x8')](_0x5cea('0xd7'),require(_0x5cea('0xd8')));_0x555f1d[_0x5cea('0x8')]('/api/openchannel/reports/transfer',require(_0x5cea('0xd9')));_0x555f1d[_0x5cea('0x8')]('/api/sms/reports/transfer',require(_0x5cea('0xda')));_0x555f1d[_0x5cea('0x8')](_0x5cea('0xdb'),require(_0x5cea('0xdc')));_0x555f1d['use'](_0x5cea('0xdd'),require(_0x5cea('0xde')));_0x555f1d[_0x5cea('0x8')](_0x5cea('0xdf'),require(_0x5cea('0xe0')));_0x555f1d[_0x5cea('0x8')](_0x5cea('0xe1'),require('./api/userProfileSection'));_0x555f1d[_0x5cea('0x8')]('/api/userProfile/resources',require('./api/userProfileResource'));_0x555f1d[_0x5cea('0x8')](_0x5cea('0xe2'),require(_0x5cea('0xe3')));_0x555f1d[_0x5cea('0x8')](_0x5cea('0xe4'),require(_0x5cea('0xe5')));_0x555f1d[_0x5cea('0x8')](_0x5cea('0xe6'),require('./api/whatsappApplication'));_0x555f1d['use'](_0x5cea('0xe7'),require(_0x5cea('0xe8')));_0x555f1d[_0x5cea('0x8')](_0x5cea('0xe9'),require(_0x5cea('0xea')));_0x555f1d[_0x5cea('0x8')](_0x5cea('0xeb'),require(_0x5cea('0xec')));_0x555f1d[_0x5cea('0x8')](_0x5cea('0xed'),require(_0x5cea('0xee')));_0x555f1d[_0x5cea('0x8')]('/api/whatsapp/queues',require('./api/whatsappQueue'));_0x555f1d[_0x5cea('0x8')]('/api/cloudProviders',require('./api/cloudProvider'));_0x555f1d[_0x5cea('0x8')](_0x5cea('0xef'),require(_0x5cea('0xf0')));_0x555f1d[_0x5cea('0x8')]('/api/user-settings',require('./api/user-setting'));_0x555f1d['use'](_0x5cea('0xf1'),require(_0x5cea('0xf2')));_0x555f1d[_0x5cea('0x8')]('/api/auth/google',require(_0x5cea('0xf3')));_0x555f1d['use'](_0x5cea('0xf4'),require(_0x5cea('0xf5')));_0x555f1d[_0x5cea('0x8')](_0x5cea('0xf6'),require(_0x5cea('0xf7')));_0x555f1d[_0x5cea('0x8')]('/api/rpc',require(_0x5cea('0xf8')));_0x555f1d[_0x5cea('0x8')](_0x5cea('0xf9'),require(_0x5cea('0xfa')));_0x555f1d[_0x5cea('0x8')](_0x5cea('0xfb'),require(_0x5cea('0xfc')));_0x555f1d[_0x5cea('0x8')](_0x5cea('0xfd'),require(_0x5cea('0xfe')));_0x555f1d['use'](_0x5cea('0xff'),require(_0x5cea('0x100')));_0x555f1d[_0x5cea('0x8')]('/api/logs',clientSideLogs);_0x555f1d['use'](_0x5cea('0x101'),express['static'](path['join'](config[_0x5cea('0x102')],'/apidoc')));_0x555f1d[_0x5cea('0x8')](_0x5cea('0x103'),express['static'](path[_0x5cea('0x104')](config[_0x5cea('0x102')],_0x5cea('0x103'))));_0x555f1d[_0x5cea('0x8')](_0x5cea('0x105'),express[_0x5cea('0x106')](path[_0x5cea('0x104')](config[_0x5cea('0x102')],'/demo')));_0x555f1d['use'](_0x5cea('0x107'),express['static'](path[_0x5cea('0x104')](config[_0x5cea('0x102')],_0x5cea('0x108'),_0x5cea('0x109'))));_0x555f1d['use']('/plugins',express[_0x5cea('0x106')](path[_0x5cea('0x104')](config[_0x5cea('0x102')],_0x5cea('0x10a'))));_0x555f1d['route'](_0x5cea('0x10b'))[_0x5cea('0x10c')](errors[0x194]);_0x555f1d[_0x5cea('0x10d')]('/*')['get'](function(_0x1af58c,_0x218c05){_0x218c05[_0x5cea('0x10e')](path[_0x5cea('0x10f')](_0x555f1d[_0x5cea('0x10c')](_0x5cea('0x110'))+_0x5cea('0x111')));});return _0x555f1d;});}; \ No newline at end of file +var _0x79e9=['/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intZohoAccount','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','/api/jscripty/questions/reports','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','/api/square/reports','./api/squareReport','/api/square/details/reports','/api/jscripty/projects','/api/settings','./api/setting','/api/square/odbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','./api/squareMessage','/api/teams','/api/license','./api/license','./api/campaign','/api/migrations','/api/attachments','./api/attachment','/api/plugins','./api/plugin','./api/mailTransferReport','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','/api/sms/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/userNotification','/api/whatsapp/accounts','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','/api/cloudProviders','/api/realtime','./api/realtime','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/webbar','./api/webbar','/api/logs','/apidoc','static','join','/www','root','/demo','/snippet','snippet','3.0.0','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','resolve','appPath','path','express','./errors','./config/environment','setupLoggers','default','then','use','/api/voice/chanspy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','/api/voice/queues','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','/api/voice/queues/reports','/api/members/reports','./api/memberReport','./api/trunk','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','./api/openchannelQueue','/api/chat/websites','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatOfflineMessage','/api/chat/queues','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','./api/cmHopper','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','./api/action','/api/automations','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/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/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','./api/cmHopperAdditionalPhone','./api/template','/api/triggers','/api/variables','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','./api/analyticExtractedReport','./api/analyticMetric'];(function(_0x1c6a3e,_0x5c3938){var _0x3637da=function(_0x2186c7){while(--_0x2186c7){_0x1c6a3e['push'](_0x1c6a3e['shift']());}};_0x3637da(++_0x5c3938);}(_0x79e9,0x92));var _0x979e=function(_0x2918fa,_0x1d71f1){_0x2918fa=_0x2918fa-0x0;var _0x40d5a8=_0x79e9[_0x2918fa];return _0x40d5a8;};'use strict';var path=require(_0x979e('0x0'));var express=require(_0x979e('0x1'));var errors=require(_0x979e('0x2'));var config=require(_0x979e('0x3'));var setupLoggers=require('./utils/client-side-logger')[_0x979e('0x4')];var clientSideLogs=require('./api/client-side-logs');exports[_0x979e('0x5')]=function(_0xabe102){return setupLoggers(_0xabe102)[_0x979e('0x6')](function(){_0xabe102[_0x979e('0x7')]('/api/users',require('./api/user'));_0xabe102['use'](_0x979e('0x8'),require('./api/voiceChanSpy'));_0xabe102[_0x979e('0x7')](_0x979e('0x9'),require(_0x979e('0xa')));_0xabe102[_0x979e('0x7')](_0x979e('0xb'),require(_0x979e('0xc')));_0xabe102['use'](_0x979e('0xd'),require('./api/voiceMusicOnHold'));_0xabe102['use'](_0x979e('0xe'),require('./api/voiceQueue'));_0xabe102[_0x979e('0x7')](_0x979e('0xf'),require(_0x979e('0x10')));_0xabe102[_0x979e('0x7')](_0x979e('0x11'),require(_0x979e('0x12')));_0xabe102[_0x979e('0x7')](_0x979e('0x13'),require(_0x979e('0x14')));_0xabe102[_0x979e('0x7')](_0x979e('0x15'),require(_0x979e('0x16')));_0xabe102['use'](_0x979e('0x17'),require(_0x979e('0x18')));_0xabe102[_0x979e('0x7')](_0x979e('0x19'),require(_0x979e('0x1a')));_0xabe102['use'](_0x979e('0x1b'),require('./api/voiceAgentReport'));_0xabe102[_0x979e('0x7')](_0x979e('0x1c'),require('./api/voiceQueueReport'));_0xabe102[_0x979e('0x7')](_0x979e('0x1d'),require(_0x979e('0x1e')));_0xabe102[_0x979e('0x7')]('/api/trunks',require(_0x979e('0x1f')));_0xabe102[_0x979e('0x7')]('/api/voice/transfers/reports',require('./api/voiceTransferReport'));_0xabe102[_0x979e('0x7')](_0x979e('0x20'),require(_0x979e('0x21')));_0xabe102[_0x979e('0x7')](_0x979e('0x22'),require(_0x979e('0x23')));_0xabe102[_0x979e('0x7')](_0x979e('0x24'),require('./api/mailQueue'));_0xabe102['use'](_0x979e('0x25'),require(_0x979e('0x26')));_0xabe102['use'](_0x979e('0x27'),require(_0x979e('0x28')));_0xabe102[_0x979e('0x7')]('/api/mail/messages',require(_0x979e('0x29')));_0xabe102[_0x979e('0x7')](_0x979e('0x2a'),require(_0x979e('0x2b')));_0xabe102[_0x979e('0x7')](_0x979e('0x2c'),require('./api/mailQueueReport'));_0xabe102[_0x979e('0x7')]('/api/dashboards',require(_0x979e('0x2d')));_0xabe102['use'](_0x979e('0x2e'),require(_0x979e('0x2f')));_0xabe102[_0x979e('0x7')](_0x979e('0x30'),require(_0x979e('0x31')));_0xabe102[_0x979e('0x7')]('/api/fax/applications',require(_0x979e('0x32')));_0xabe102[_0x979e('0x7')](_0x979e('0x33'),require(_0x979e('0x34')));_0xabe102[_0x979e('0x7')](_0x979e('0x35'),require(_0x979e('0x36')));_0xabe102[_0x979e('0x7')](_0x979e('0x37'),require('./api/faxQueue'));_0xabe102[_0x979e('0x7')](_0x979e('0x38'),require(_0x979e('0x39')));_0xabe102[_0x979e('0x7')]('/api/sms/accounts',require('./api/smsAccount'));_0xabe102[_0x979e('0x7')](_0x979e('0x3a'),require(_0x979e('0x3b')));_0xabe102[_0x979e('0x7')](_0x979e('0x3c'),require(_0x979e('0x3d')));_0xabe102[_0x979e('0x7')](_0x979e('0x3e'),require(_0x979e('0x3f')));_0xabe102[_0x979e('0x7')](_0x979e('0x40'),require(_0x979e('0x41')));_0xabe102[_0x979e('0x7')](_0x979e('0x42'),require(_0x979e('0x43')));_0xabe102['use'](_0x979e('0x44'),require(_0x979e('0x45')));_0xabe102['use']('/api/openchannel/interactions',require('./api/openchannelInteraction'));_0xabe102[_0x979e('0x7')]('/api/openchannel/messages',require('./api/openchannelMessage'));_0xabe102[_0x979e('0x7')]('/api/openchannel/queues',require(_0x979e('0x46')));_0xabe102['use'](_0x979e('0x47'),require('./api/chatWebsite'));_0xabe102[_0x979e('0x7')]('/api/openchannel/reports/queue',require('./api/openchannelQueueReport'));_0xabe102[_0x979e('0x7')](_0x979e('0x48'),require(_0x979e('0x49')));_0xabe102[_0x979e('0x7')](_0x979e('0x4a'),require(_0x979e('0x4b')));_0xabe102[_0x979e('0x7')](_0x979e('0x4c'),require('./api/chatMessage'));_0xabe102[_0x979e('0x7')]('/api/chat/offline_messages',require(_0x979e('0x4d')));_0xabe102[_0x979e('0x7')](_0x979e('0x4e'),require('./api/chatQueue'));_0xabe102[_0x979e('0x7')](_0x979e('0x4f'),require(_0x979e('0x50')));_0xabe102[_0x979e('0x7')](_0x979e('0x51'),require('./api/chatProactiveAction'));_0xabe102[_0x979e('0x7')](_0x979e('0x52'),require(_0x979e('0x53')));_0xabe102[_0x979e('0x7')](_0x979e('0x54'),require(_0x979e('0x55')));_0xabe102['use']('/api/cm/hopper',require(_0x979e('0x56')));_0xabe102['use']('/api/cm/hopper_black',require(_0x979e('0x57')));_0xabe102['use'](_0x979e('0x58'),require(_0x979e('0x59')));_0xabe102[_0x979e('0x7')](_0x979e('0x5a'),require(_0x979e('0x5b')));_0xabe102[_0x979e('0x7')](_0x979e('0x5c'),require(_0x979e('0x5d')));_0xabe102[_0x979e('0x7')]('/api/actions',require(_0x979e('0x5e')));_0xabe102['use'](_0x979e('0x5f'),require('./api/automation'));_0xabe102['use'](_0x979e('0x60'),require(_0x979e('0x61')));_0xabe102[_0x979e('0x7')](_0x979e('0x62'),require(_0x979e('0x63')));_0xabe102[_0x979e('0x7')]('/api/conditions',require('./api/condition'));_0xabe102[_0x979e('0x7')](_0x979e('0x64'),require(_0x979e('0x65')));_0xabe102['use'](_0x979e('0x66'),require(_0x979e('0x67')));_0xabe102[_0x979e('0x7')]('/api/cdr',require(_0x979e('0x68')));_0xabe102[_0x979e('0x7')](_0x979e('0x69'),require(_0x979e('0x6a')));_0xabe102[_0x979e('0x7')](_0x979e('0x6b'),require(_0x979e('0x6c')));_0xabe102[_0x979e('0x7')](_0x979e('0x6d'),require(_0x979e('0x6e')));_0xabe102['use'](_0x979e('0x6f'),require(_0x979e('0x70')));_0xabe102['use'](_0x979e('0x71'),require(_0x979e('0x72')));_0xabe102[_0x979e('0x7')](_0x979e('0x73'),require(_0x979e('0x74')));_0xabe102['use']('/api/cm_hopper_additional_phones',require(_0x979e('0x75')));_0xabe102[_0x979e('0x7')]('/api/templates',require(_0x979e('0x76')));_0xabe102[_0x979e('0x7')](_0x979e('0x77'),require('./api/trigger'));_0xabe102['use'](_0x979e('0x78'),require('./api/variable'));_0xabe102[_0x979e('0x7')](_0x979e('0x79'),require(_0x979e('0x7a')));_0xabe102[_0x979e('0x7')](_0x979e('0x7b'),require(_0x979e('0x7c')));_0xabe102[_0x979e('0x7')]('/api/analytics/custom_reports',require(_0x979e('0x7d')));_0xabe102[_0x979e('0x7')](_0x979e('0x7e'),require(_0x979e('0x7f')));_0xabe102[_0x979e('0x7')]('/api/analytics/extracted_reports',require(_0x979e('0x80')));_0xabe102['use']('/api/analytics/metrics',require(_0x979e('0x81')));_0xabe102[_0x979e('0x7')](_0x979e('0x82'),require(_0x979e('0x83')));_0xabe102['use'](_0x979e('0x84'),require(_0x979e('0x85')));_0xabe102[_0x979e('0x7')](_0x979e('0x86'),require(_0x979e('0x87')));_0xabe102[_0x979e('0x7')](_0x979e('0x88'),require(_0x979e('0x89')));_0xabe102['use'](_0x979e('0x8a'),require('./api/intSalesforceField'));_0xabe102[_0x979e('0x7')](_0x979e('0x8b'),require(_0x979e('0x8c')));_0xabe102[_0x979e('0x7')]('/api/integrations/sugarcrm/configurations',require('./api/intSugarcrmConfiguration'));_0xabe102[_0x979e('0x7')](_0x979e('0x8d'),require(_0x979e('0x8e')));_0xabe102[_0x979e('0x7')](_0x979e('0x8f'),require(_0x979e('0x90')));_0xabe102[_0x979e('0x7')]('/api/integrations/desk/configurations',require(_0x979e('0x91')));_0xabe102[_0x979e('0x7')](_0x979e('0x92'),require('./api/intDeskField'));_0xabe102['use']('/api/integrations/zoho/accounts',require(_0x979e('0x93')));_0xabe102[_0x979e('0x7')]('/api/integrations/zoho/configurations',require(_0x979e('0x94')));_0xabe102[_0x979e('0x7')](_0x979e('0x95'),require(_0x979e('0x96')));_0xabe102[_0x979e('0x7')](_0x979e('0x97'),require(_0x979e('0x98')));_0xabe102[_0x979e('0x7')](_0x979e('0x99'),require('./api/intZendeskConfiguration'));_0xabe102[_0x979e('0x7')](_0x979e('0x9a'),require(_0x979e('0x9b')));_0xabe102[_0x979e('0x7')](_0x979e('0x9c'),require(_0x979e('0x9d')));_0xabe102[_0x979e('0x7')](_0x979e('0x9e'),require(_0x979e('0x9f')));_0xabe102['use']('/api/integrations/freshdesk/fields',require(_0x979e('0xa0')));_0xabe102[_0x979e('0x7')](_0x979e('0xa1'),require(_0x979e('0xa2')));_0xabe102['use']('/api/integrations/vtiger/configurations',require(_0x979e('0xa3')));_0xabe102['use'](_0x979e('0xa4'),require(_0x979e('0xa5')));_0xabe102[_0x979e('0x7')](_0x979e('0xa6'),require(_0x979e('0xa7')));_0xabe102[_0x979e('0x7')](_0x979e('0xa8'),require(_0x979e('0xa9')));_0xabe102[_0x979e('0x7')](_0x979e('0xaa'),require(_0x979e('0xab')));_0xabe102[_0x979e('0x7')](_0x979e('0xac'),require(_0x979e('0xad')));_0xabe102['use'](_0x979e('0xae'),require(_0x979e('0xaf')));_0xabe102[_0x979e('0x7')](_0x979e('0xb0'),require(_0x979e('0xb1')));_0xabe102['use'](_0x979e('0xb2'),require('./api/intFreshsalesAccount'));_0xabe102[_0x979e('0x7')]('/api/integrations/freshsales/configurations',require(_0x979e('0xb3')));_0xabe102[_0x979e('0x7')](_0x979e('0xb4'),require(_0x979e('0xb5')));_0xabe102['use'](_0x979e('0xb6'),require(_0x979e('0xb7')));_0xabe102[_0x979e('0x7')](_0x979e('0xb8'),require(_0x979e('0xb9')));_0xabe102[_0x979e('0x7')](_0x979e('0xba'),require(_0x979e('0xbb')));_0xabe102['use'](_0x979e('0xbc'),require('./api/jscriptyAnswerReport'));_0xabe102['use'](_0x979e('0xbd'),require('./api/jscriptyQuestionReport'));_0xabe102[_0x979e('0x7')](_0x979e('0xbe'),require(_0x979e('0xbf')));_0xabe102[_0x979e('0x7')](_0x979e('0xc0'),require('./api/smsQueueReport'));_0xabe102[_0x979e('0x7')](_0x979e('0xc1'),require(_0x979e('0xc2')));_0xabe102[_0x979e('0x7')](_0x979e('0xc3'),require('./api/squareReportDetail'));_0xabe102[_0x979e('0x7')](_0x979e('0xc4'),require('./api/jscriptyProject'));_0xabe102[_0x979e('0x7')](_0x979e('0xc5'),require(_0x979e('0xc6')));_0xabe102[_0x979e('0x7')](_0x979e('0xc7'),require('./api/squareOdbc'));_0xabe102[_0x979e('0x7')](_0x979e('0xc8'),require(_0x979e('0xc9')));_0xabe102[_0x979e('0x7')](_0x979e('0xca'),require(_0x979e('0xcb')));_0xabe102[_0x979e('0x7')]('/api/square/messages',require(_0x979e('0xcc')));_0xabe102[_0x979e('0x7')](_0x979e('0xcd'),require('./api/team'));_0xabe102[_0x979e('0x7')](_0x979e('0xce'),require(_0x979e('0xcf')));_0xabe102[_0x979e('0x7')]('/api/campaigns',require(_0x979e('0xd0')));_0xabe102[_0x979e('0x7')](_0x979e('0xd1'),require('./api/migration'));_0xabe102[_0x979e('0x7')](_0x979e('0xd2'),require(_0x979e('0xd3')));_0xabe102[_0x979e('0x7')](_0x979e('0xd4'),require(_0x979e('0xd5')));_0xabe102['use']('/api/mail/reports/transfer',require(_0x979e('0xd6')));_0xabe102[_0x979e('0x7')]('/api/chat/reports/transfer',require(_0x979e('0xd7')));_0xabe102[_0x979e('0x7')](_0x979e('0xd8'),require(_0x979e('0xd9')));_0xabe102[_0x979e('0x7')](_0x979e('0xda'),require('./api/openchannelTransferReport'));_0xabe102[_0x979e('0x7')](_0x979e('0xdb'),require(_0x979e('0xdc')));_0xabe102['use'](_0x979e('0xdd'),require(_0x979e('0xde')));_0xabe102['use'](_0x979e('0xdf'),require(_0x979e('0xe0')));_0xabe102['use'](_0x979e('0xe1'),require(_0x979e('0xe2')));_0xabe102[_0x979e('0x7')](_0x979e('0xe3'),require('./api/userProfileSection'));_0xabe102[_0x979e('0x7')](_0x979e('0xe4'),require(_0x979e('0xe5')));_0xabe102['use'](_0x979e('0xe6'),require(_0x979e('0xe7')));_0xabe102['use'](_0x979e('0xe8'),require('./api/whatsappAccount'));_0xabe102[_0x979e('0x7')](_0x979e('0xe9'),require(_0x979e('0xea')));_0xabe102[_0x979e('0x7')](_0x979e('0xeb'),require('./api/whatsappInteraction'));_0xabe102['use'](_0x979e('0xec'),require(_0x979e('0xed')));_0xabe102[_0x979e('0x7')](_0x979e('0xee'),require(_0x979e('0xef')));_0xabe102[_0x979e('0x7')](_0x979e('0xf0'),require('./api/whatsappTransferReport'));_0xabe102['use']('/api/whatsapp/queues',require('./api/whatsappQueue'));_0xabe102[_0x979e('0x7')](_0x979e('0xf1'),require('./api/cloudProvider'));_0xabe102[_0x979e('0x7')](_0x979e('0xf2'),require(_0x979e('0xf3')));_0xabe102[_0x979e('0x7')]('/api/user-settings',require('./api/user-setting'));_0xabe102[_0x979e('0x7')]('/api/auth/local',require(_0x979e('0xf4')));_0xabe102[_0x979e('0x7')](_0x979e('0xf5'),require(_0x979e('0xf6')));_0xabe102['use'](_0x979e('0xf7'),require(_0x979e('0xf8')));_0xabe102[_0x979e('0x7')](_0x979e('0xf9'),require(_0x979e('0xfa')));_0xabe102[_0x979e('0x7')](_0x979e('0xfb'),require(_0x979e('0xfc')));_0xabe102[_0x979e('0x7')](_0x979e('0xfd'),require(_0x979e('0xfe')));_0xabe102[_0x979e('0x7')](_0x979e('0xff'),require(_0x979e('0x100')));_0xabe102['use']('/api/pm2',require('./api/pm2'));_0xabe102[_0x979e('0x7')](_0x979e('0x101'),require(_0x979e('0x102')));_0xabe102[_0x979e('0x7')](_0x979e('0x103'),clientSideLogs);_0xabe102[_0x979e('0x7')](_0x979e('0x104'),express[_0x979e('0x105')](path[_0x979e('0x106')](config['root'],_0x979e('0x104'))));_0xabe102['use'](_0x979e('0x107'),express['static'](path[_0x979e('0x106')](config[_0x979e('0x108')],_0x979e('0x107'))));_0xabe102[_0x979e('0x7')](_0x979e('0x109'),express[_0x979e('0x105')](path['join'](config[_0x979e('0x108')],_0x979e('0x109'))));_0xabe102[_0x979e('0x7')](_0x979e('0x10a'),express['static'](path['join'](config['root'],_0x979e('0x10b'),_0x979e('0x10c'))));_0xabe102['use'](_0x979e('0x10d'),express['static'](path[_0x979e('0x106')](config['root'],_0x979e('0x10e'))));_0xabe102[_0x979e('0x10f')](_0x979e('0x110'))[_0x979e('0x111')](errors[0x194]);_0xabe102[_0x979e('0x10f')]('/*')[_0x979e('0x111')](function(_0x97e788,_0x345f36){_0x345f36['sendFile'](path[_0x979e('0x112')](_0xabe102[_0x979e('0x111')](_0x979e('0x113'))+'/index.html'));});return _0xabe102;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 0b2c888..24fa402 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x16a8=['../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/chatQueue/chatQueue.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/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/campaign/campaign.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','rpc','port','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','jayson/promise','lodash','../config/environment','listen','../api/user/user.rpc','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/voiceTransferReport/voiceTransferReport.rpc'];(function(_0x5b92f6,_0x4a2e27){var _0x231840=function(_0x3529e5){while(--_0x3529e5){_0x5b92f6['push'](_0x5b92f6['shift']());}};_0x231840(++_0x4a2e27);}(_0x16a8,0x1db));var _0x816a=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x16a8[_0x167cc1];return _0x10bc4b;};'use strict';var jayson=require(_0x816a('0x0'));var _=require(_0x816a('0x1'));var config=require(_0x816a('0x2'));exports[_0x816a('0x3')]=function(){return new Promise(function(_0x2cb5a6,_0x1a9235){var _0xcdc1ae={};_0xcdc1ae=_['merge'](_0xcdc1ae,require(_0x816a('0x4')));_0xcdc1ae=_[_0x816a('0x5')](_0xcdc1ae,require(_0x816a('0x6')));_0xcdc1ae=_['merge'](_0xcdc1ae,require(_0x816a('0x7')));_0xcdc1ae=_['merge'](_0xcdc1ae,require('../api/voiceRecording/voiceRecording.rpc'));_0xcdc1ae=_[_0x816a('0x5')](_0xcdc1ae,require(_0x816a('0x8')));_0xcdc1ae=_[_0x816a('0x5')](_0xcdc1ae,require(_0x816a('0x9')));_0xcdc1ae=_['merge'](_0xcdc1ae,require(_0x816a('0xa')));_0xcdc1ae=_['merge'](_0xcdc1ae,require(_0x816a('0xb')));_0xcdc1ae=_[_0x816a('0x5')](_0xcdc1ae,require('../api/memberReport/memberReport.rpc'));_0xcdc1ae=_[_0x816a('0x5')](_0xcdc1ae,require('../api/trunk/trunk.rpc'));_0xcdc1ae=_[_0x816a('0x5')](_0xcdc1ae,require(_0x816a('0xc')));_0xcdc1ae=_['merge'](_0xcdc1ae,require(_0x816a('0xd')));_0xcdc1ae=_[_0x816a('0x5')](_0xcdc1ae,require(_0x816a('0xe')));_0xcdc1ae=_[_0x816a('0x5')](_0xcdc1ae,require(_0x816a('0xf')));_0xcdc1ae=_[_0x816a('0x5')](_0xcdc1ae,require(_0x816a('0x10')));_0xcdc1ae=_[_0x816a('0x5')](_0xcdc1ae,require('../api/mailInteraction/mailInteraction.rpc'));_0xcdc1ae=_['merge'](_0xcdc1ae,require(_0x816a('0x11')));_0xcdc1ae=_[_0x816a('0x5')](_0xcdc1ae,require(_0x816a('0x12')));_0xcdc1ae=_[_0x816a('0x5')](_0xcdc1ae,require('../api/mailQueueReport/mailQueueReport.rpc'));_0xcdc1ae=_['merge'](_0xcdc1ae,require('../api/faxAccount/faxAccount.rpc'));_0xcdc1ae=_['merge'](_0xcdc1ae,require(_0x816a('0x13')));_0xcdc1ae=_['merge'](_0xcdc1ae,require(_0x816a('0x14')));_0xcdc1ae=_[_0x816a('0x5')](_0xcdc1ae,require(_0x816a('0x15')));_0xcdc1ae=_[_0x816a('0x5')](_0xcdc1ae,require(_0x816a('0x16')));_0xcdc1ae=_[_0x816a('0x5')](_0xcdc1ae,require(_0x816a('0x17')));_0xcdc1ae=_['merge'](_0xcdc1ae,require('../api/smsAccount/smsAccount.rpc'));_0xcdc1ae=_[_0x816a('0x5')](_0xcdc1ae,require(_0x816a('0x18')));_0xcdc1ae=_[_0x816a('0x5')](_0xcdc1ae,require('../api/smsMessage/smsMessage.rpc'));_0xcdc1ae=_[_0x816a('0x5')](_0xcdc1ae,require(_0x816a('0x19')));_0xcdc1ae=_[_0x816a('0x5')](_0xcdc1ae,require(_0x816a('0x1a')));_0xcdc1ae=_[_0x816a('0x5')](_0xcdc1ae,require(_0x816a('0x1b')));_0xcdc1ae=_['merge'](_0xcdc1ae,require(_0x816a('0x1c')));_0xcdc1ae=_[_0x816a('0x5')](_0xcdc1ae,require(_0x816a('0x1d')));_0xcdc1ae=_[_0x816a('0x5')](_0xcdc1ae,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0xcdc1ae=_[_0x816a('0x5')](_0xcdc1ae,require('../api/chatInteraction/chatInteraction.rpc'));_0xcdc1ae=_['merge'](_0xcdc1ae,require('../api/chatMessage/chatMessage.rpc'));_0xcdc1ae=_[_0x816a('0x5')](_0xcdc1ae,require(_0x816a('0x1e')));_0xcdc1ae=_['merge'](_0xcdc1ae,require('../api/cmContact/cmContact.rpc'));_0xcdc1ae=_[_0x816a('0x5')](_0xcdc1ae,require(_0x816a('0x1f')));_0xcdc1ae=_[_0x816a('0x5')](_0xcdc1ae,require(_0x816a('0x20')));_0xcdc1ae=_[_0x816a('0x5')](_0xcdc1ae,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0xcdc1ae=_[_0x816a('0x5')](_0xcdc1ae,require(_0x816a('0x21')));_0xcdc1ae=_[_0x816a('0x5')](_0xcdc1ae,require(_0x816a('0x22')));_0xcdc1ae=_['merge'](_0xcdc1ae,require(_0x816a('0x23')));_0xcdc1ae=_[_0x816a('0x5')](_0xcdc1ae,require(_0x816a('0x24')));_0xcdc1ae=_[_0x816a('0x5')](_0xcdc1ae,require(_0x816a('0x25')));_0xcdc1ae=_[_0x816a('0x5')](_0xcdc1ae,require(_0x816a('0x26')));_0xcdc1ae=_[_0x816a('0x5')](_0xcdc1ae,require(_0x816a('0x27')));_0xcdc1ae=_[_0x816a('0x5')](_0xcdc1ae,require(_0x816a('0x28')));_0xcdc1ae=_[_0x816a('0x5')](_0xcdc1ae,require('../api/variable/variable.rpc'));_0xcdc1ae=_[_0x816a('0x5')](_0xcdc1ae,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0xcdc1ae=_[_0x816a('0x5')](_0xcdc1ae,require(_0x816a('0x29')));_0xcdc1ae=_['merge'](_0xcdc1ae,require(_0x816a('0x2a')));_0xcdc1ae=_['merge'](_0xcdc1ae,require(_0x816a('0x2b')));_0xcdc1ae=_[_0x816a('0x5')](_0xcdc1ae,require(_0x816a('0x2c')));_0xcdc1ae=_[_0x816a('0x5')](_0xcdc1ae,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0xcdc1ae=_[_0x816a('0x5')](_0xcdc1ae,require(_0x816a('0x2d')));_0xcdc1ae=_[_0x816a('0x5')](_0xcdc1ae,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0xcdc1ae=_['merge'](_0xcdc1ae,require(_0x816a('0x2e')));_0xcdc1ae=_[_0x816a('0x5')](_0xcdc1ae,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0xcdc1ae=_['merge'](_0xcdc1ae,require(_0x816a('0x2f')));_0xcdc1ae=_[_0x816a('0x5')](_0xcdc1ae,require('../api/smsQueueReport/smsQueueReport.rpc'));_0xcdc1ae=_[_0x816a('0x5')](_0xcdc1ae,require(_0x816a('0x30')));_0xcdc1ae=_['merge'](_0xcdc1ae,require('../api/squareReportDetail/squareReportDetail.rpc'));_0xcdc1ae=_['merge'](_0xcdc1ae,require(_0x816a('0x31')));_0xcdc1ae=_['merge'](_0xcdc1ae,require(_0x816a('0x32')));_0xcdc1ae=_[_0x816a('0x5')](_0xcdc1ae,require(_0x816a('0x33')));_0xcdc1ae=_[_0x816a('0x5')](_0xcdc1ae,require('../api/squareRecording/squareRecording.rpc'));_0xcdc1ae=_[_0x816a('0x5')](_0xcdc1ae,require('../api/squareMessage/squareMessage.rpc'));_0xcdc1ae=_[_0x816a('0x5')](_0xcdc1ae,require(_0x816a('0x34')));_0xcdc1ae=_['merge'](_0xcdc1ae,require('../api/attachment/attachment.rpc'));_0xcdc1ae=_[_0x816a('0x5')](_0xcdc1ae,require('../api/plugin/plugin.rpc'));_0xcdc1ae=_[_0x816a('0x5')](_0xcdc1ae,require('../api/whatsappAccount/whatsappAccount.rpc'));_0xcdc1ae=_[_0x816a('0x5')](_0xcdc1ae,require(_0x816a('0x35')));_0xcdc1ae=_['merge'](_0xcdc1ae,require(_0x816a('0x36')));_0xcdc1ae=_[_0x816a('0x5')](_0xcdc1ae,require(_0x816a('0x37')));_0xcdc1ae=_[_0x816a('0x5')](_0xcdc1ae,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x57522d=jayson['server'](_0xcdc1ae)['http']();var _0x59bbcb=config[_0x816a('0x38')][_0x816a('0x39')]||config[_0x816a('0x39')]+0x1;var _0x51bf11=config[_0x816a('0x38')]['ip']||'localhost';_0x57522d['on']('error',function(_0x3e6f64){return _0x1a9235(_0x3e6f64);});_0x57522d[_0x816a('0x3')](_0x59bbcb,_0x51bf11,function(){console['log'](_0x816a('0x3a'),_0x51bf11,_0x59bbcb);require(_0x816a('0x3b'))[_0x816a('0x3c')]();return _0x2cb5a6('RPC\x20listening\x20on\x20'+_0x51bf11+':'+_0x59bbcb);});});}; \ No newline at end of file +var _0x8ae2=['../api/faxMessage/faxMessage.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','http','rpc','port','localhost','error','listen','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','jayson/promise','lodash','../config/environment','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxInteraction/faxInteraction.rpc'];(function(_0xfe8149,_0x3cd721){var _0xc9ce34=function(_0x2035da){while(--_0x2035da){_0xfe8149['push'](_0xfe8149['shift']());}};_0xc9ce34(++_0x3cd721);}(_0x8ae2,0x121));var _0x28ae=function(_0x412b0c,_0x2c18fc){_0x412b0c=_0x412b0c-0x0;var _0x288d1c=_0x8ae2[_0x412b0c];return _0x288d1c;};'use strict';var jayson=require(_0x28ae('0x0'));var _=require(_0x28ae('0x1'));var config=require(_0x28ae('0x2'));exports['listen']=function(){return new Promise(function(_0x218451,_0x578f17){var _0xc7791f={};_0xc7791f=_[_0x28ae('0x3')](_0xc7791f,require(_0x28ae('0x4')));_0xc7791f=_[_0x28ae('0x3')](_0xc7791f,require(_0x28ae('0x5')));_0xc7791f=_[_0x28ae('0x3')](_0xc7791f,require(_0x28ae('0x6')));_0xc7791f=_['merge'](_0xc7791f,require(_0x28ae('0x7')));_0xc7791f=_[_0x28ae('0x3')](_0xc7791f,require(_0x28ae('0x8')));_0xc7791f=_['merge'](_0xc7791f,require(_0x28ae('0x9')));_0xc7791f=_[_0x28ae('0x3')](_0xc7791f,require(_0x28ae('0xa')));_0xc7791f=_[_0x28ae('0x3')](_0xc7791f,require(_0x28ae('0xb')));_0xc7791f=_[_0x28ae('0x3')](_0xc7791f,require(_0x28ae('0xc')));_0xc7791f=_[_0x28ae('0x3')](_0xc7791f,require(_0x28ae('0xd')));_0xc7791f=_[_0x28ae('0x3')](_0xc7791f,require(_0x28ae('0xe')));_0xc7791f=_['merge'](_0xc7791f,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0xc7791f=_[_0x28ae('0x3')](_0xc7791f,require('../api/mailServerIn/mailServerIn.rpc'));_0xc7791f=_[_0x28ae('0x3')](_0xc7791f,require(_0x28ae('0xf')));_0xc7791f=_[_0x28ae('0x3')](_0xc7791f,require(_0x28ae('0x10')));_0xc7791f=_['merge'](_0xc7791f,require(_0x28ae('0x11')));_0xc7791f=_[_0x28ae('0x3')](_0xc7791f,require(_0x28ae('0x12')));_0xc7791f=_[_0x28ae('0x3')](_0xc7791f,require(_0x28ae('0x13')));_0xc7791f=_[_0x28ae('0x3')](_0xc7791f,require(_0x28ae('0x14')));_0xc7791f=_[_0x28ae('0x3')](_0xc7791f,require(_0x28ae('0x15')));_0xc7791f=_['merge'](_0xc7791f,require('../api/faxApplication/faxApplication.rpc'));_0xc7791f=_[_0x28ae('0x3')](_0xc7791f,require(_0x28ae('0x16')));_0xc7791f=_[_0x28ae('0x3')](_0xc7791f,require(_0x28ae('0x17')));_0xc7791f=_[_0x28ae('0x3')](_0xc7791f,require('../api/faxQueue/faxQueue.rpc'));_0xc7791f=_[_0x28ae('0x3')](_0xc7791f,require(_0x28ae('0x18')));_0xc7791f=_[_0x28ae('0x3')](_0xc7791f,require(_0x28ae('0x19')));_0xc7791f=_[_0x28ae('0x3')](_0xc7791f,require(_0x28ae('0x1a')));_0xc7791f=_['merge'](_0xc7791f,require(_0x28ae('0x1b')));_0xc7791f=_[_0x28ae('0x3')](_0xc7791f,require(_0x28ae('0x1c')));_0xc7791f=_[_0x28ae('0x3')](_0xc7791f,require(_0x28ae('0x1d')));_0xc7791f=_[_0x28ae('0x3')](_0xc7791f,require(_0x28ae('0x1e')));_0xc7791f=_[_0x28ae('0x3')](_0xc7791f,require(_0x28ae('0x1f')));_0xc7791f=_[_0x28ae('0x3')](_0xc7791f,require(_0x28ae('0x20')));_0xc7791f=_['merge'](_0xc7791f,require(_0x28ae('0x21')));_0xc7791f=_[_0x28ae('0x3')](_0xc7791f,require(_0x28ae('0x22')));_0xc7791f=_[_0x28ae('0x3')](_0xc7791f,require('../api/chatMessage/chatMessage.rpc'));_0xc7791f=_[_0x28ae('0x3')](_0xc7791f,require(_0x28ae('0x23')));_0xc7791f=_[_0x28ae('0x3')](_0xc7791f,require(_0x28ae('0x24')));_0xc7791f=_[_0x28ae('0x3')](_0xc7791f,require(_0x28ae('0x25')));_0xc7791f=_[_0x28ae('0x3')](_0xc7791f,require(_0x28ae('0x26')));_0xc7791f=_[_0x28ae('0x3')](_0xc7791f,require(_0x28ae('0x27')));_0xc7791f=_[_0x28ae('0x3')](_0xc7791f,require(_0x28ae('0x28')));_0xc7791f=_[_0x28ae('0x3')](_0xc7791f,require(_0x28ae('0x29')));_0xc7791f=_[_0x28ae('0x3')](_0xc7791f,require('../api/interval/interval.rpc'));_0xc7791f=_[_0x28ae('0x3')](_0xc7791f,require('../api/pause/pause.rpc'));_0xc7791f=_['merge'](_0xc7791f,require(_0x28ae('0x2a')));_0xc7791f=_[_0x28ae('0x3')](_0xc7791f,require(_0x28ae('0x2b')));_0xc7791f=_['merge'](_0xc7791f,require(_0x28ae('0x2c')));_0xc7791f=_['merge'](_0xc7791f,require(_0x28ae('0x2d')));_0xc7791f=_[_0x28ae('0x3')](_0xc7791f,require(_0x28ae('0x2e')));_0xc7791f=_['merge'](_0xc7791f,require(_0x28ae('0x2f')));_0xc7791f=_[_0x28ae('0x3')](_0xc7791f,require(_0x28ae('0x30')));_0xc7791f=_[_0x28ae('0x3')](_0xc7791f,require(_0x28ae('0x31')));_0xc7791f=_[_0x28ae('0x3')](_0xc7791f,require(_0x28ae('0x32')));_0xc7791f=_[_0x28ae('0x3')](_0xc7791f,require(_0x28ae('0x33')));_0xc7791f=_['merge'](_0xc7791f,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0xc7791f=_[_0x28ae('0x3')](_0xc7791f,require(_0x28ae('0x34')));_0xc7791f=_[_0x28ae('0x3')](_0xc7791f,require(_0x28ae('0x35')));_0xc7791f=_[_0x28ae('0x3')](_0xc7791f,require(_0x28ae('0x36')));_0xc7791f=_[_0x28ae('0x3')](_0xc7791f,require(_0x28ae('0x37')));_0xc7791f=_[_0x28ae('0x3')](_0xc7791f,require(_0x28ae('0x38')));_0xc7791f=_[_0x28ae('0x3')](_0xc7791f,require(_0x28ae('0x39')));_0xc7791f=_['merge'](_0xc7791f,require(_0x28ae('0x3a')));_0xc7791f=_['merge'](_0xc7791f,require(_0x28ae('0x3b')));_0xc7791f=_['merge'](_0xc7791f,require(_0x28ae('0x3c')));_0xc7791f=_['merge'](_0xc7791f,require(_0x28ae('0x3d')));_0xc7791f=_['merge'](_0xc7791f,require(_0x28ae('0x3e')));_0xc7791f=_[_0x28ae('0x3')](_0xc7791f,require(_0x28ae('0x3f')));_0xc7791f=_['merge'](_0xc7791f,require(_0x28ae('0x40')));_0xc7791f=_[_0x28ae('0x3')](_0xc7791f,require(_0x28ae('0x41')));_0xc7791f=_[_0x28ae('0x3')](_0xc7791f,require(_0x28ae('0x42')));_0xc7791f=_['merge'](_0xc7791f,require(_0x28ae('0x43')));_0xc7791f=_[_0x28ae('0x3')](_0xc7791f,require('../api/whatsappAccount/whatsappAccount.rpc'));_0xc7791f=_[_0x28ae('0x3')](_0xc7791f,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0xc7791f=_['merge'](_0xc7791f,require(_0x28ae('0x44')));_0xc7791f=_['merge'](_0xc7791f,require(_0x28ae('0x45')));_0xc7791f=_['merge'](_0xc7791f,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x10ce78=jayson['server'](_0xc7791f)[_0x28ae('0x46')]();var _0x525073=config[_0x28ae('0x47')][_0x28ae('0x48')]||config[_0x28ae('0x48')]+0x1;var _0x7f8027=config[_0x28ae('0x47')]['ip']||_0x28ae('0x49');_0x10ce78['on'](_0x28ae('0x4a'),function(_0x13ac48){return _0x578f17(_0x13ac48);});_0x10ce78[_0x28ae('0x4b')](_0x525073,_0x7f8027,function(){console[_0x28ae('0x4c')](_0x28ae('0x4d'),_0x7f8027,_0x525073);require('../config/triggers')['default']();return _0x218451('RPC\x20listening\x20on\x20'+_0x7f8027+':'+_0x525073);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index b5d7d0b..4f14404 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 _0x0b79=['SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','GOTO\x20%s\x20%s\x20%s','getVariable','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','events','EventEmitter','./error','call','setEncoding','utf8','headers','toLowerCase','hangup','search','520\x20End\x20of\x20proper','function','no\x20code','substring','replace','result=','substr','indexOf','startsWith','split','length','error','emit','E_AGI_SOCKET_ERROR','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','sendRequest','sync','answer','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','prototype','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','setVariable','isBoolean','isNumber','toString','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits'];(function(_0x5d3567,_0x715944){var _0x4732c2=function(_0x58f94e){while(--_0x58f94e){_0x5d3567['push'](_0x5d3567['shift']());}};_0x4732c2(++_0x715944);}(_0x0b79,0xad));var _0x90b7=function(_0x29d9ad,_0x7461e2){_0x29d9ad=_0x29d9ad-0x0;var _0x10ece0=_0x0b79[_0x29d9ad];return _0x10ece0;};'use strict';var util=require(_0x90b7('0x0'));var _=require(_0x90b7('0x1'));var EventEmitter=require(_0x90b7('0x2'))[_0x90b7('0x3')];var AGIReply=require('./reply');var AGIError=require(_0x90b7('0x4'));function AGIChannel(_0x2e65e1){var _0x497698=this,_0xd3671f=new AGIReply(),_0x4cd6c5=![],_0xd50b1b={};EventEmitter[_0x90b7('0x5')](_0x497698);_0x2e65e1[_0x90b7('0x6')](_0x90b7('0x7'));_0x2e65e1['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0xd3671f[_0x90b7('0x6')](_0x90b7('0x7'));_0xd3671f['on'](_0x90b7('0x8'),function(_0x3a929){for(var _0x381499 in _0x3a929){_0x497698[_0x381499]=_0x3a929[_0x381499];}_0x497698['emit']('ready');});_0xd3671f['on']('line',function(_0x58935b){if(_0x58935b[_0x90b7('0x9')]()==_0x90b7('0xa')){_0x497698['emit'](_0x90b7('0xa'));return;}if(_0x58935b['substring'](0x0,0xb)=='520-Invalid'){_0x4cd6c5=!![];}if(_0x4cd6c5){_0xd50b1b['rx']+=_0x58935b+'\x0a';if(_0x58935b[_0x90b7('0xb')](_0x90b7('0xc'))!=-0x1){_0x4cd6c5=![];}}else{_0xd50b1b['rx']=_0x58935b;}if(_0x4cd6c5){return;}if(typeof _0xd50b1b['cb']==_0x90b7('0xd')){var _0x55e84f=_0xd50b1b['rx']['substring'](0x0,0x3),_0x1d764c=null,_0x1aa6f3=null;_0x55e84f=parseInt(_0x55e84f);if(isNaN(_0x55e84f)){_0xd50b1b['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x90b7('0xe')});return;}if(_0x55e84f!=0xc8){_0xd50b1b['cb'](null,{'code':_0x55e84f,'result':-0x1,'extra':'KO'});return;}_0x1d764c=_0xd50b1b['rx'][_0x90b7('0xf')](0x4)[_0x90b7('0x10')](_0x90b7('0x11'),'');if(_0x1d764c['indexOf']('\x20')!=-0x1){_0x1d764c=_0x1d764c[_0x90b7('0x12')](0x0,_0x1d764c[_0x90b7('0x13')]('\x20'));}if(_[_0x90b7('0x14')](_0x1d764c,'-1')){_0x1d764c=parseInt(_0x1d764c);}_0x1aa6f3=_0xd50b1b['rx'][_0x90b7('0x15')]('\x20');if(_0x1aa6f3['length']==0x3){_0x1aa6f3=_0x1aa6f3[0x2]['substring'](0x1,_0x1aa6f3[0x2]['length']-0x1);}else if(_0x1aa6f3[_0x90b7('0x16')]>0x3){var _0x52e223=/\((.+)\)/;var _0x259b32=_0xd50b1b['rx']['match'](_0x52e223);if(_0x259b32){_0x1aa6f3=_0x259b32[0x1];}else{_0x1aa6f3=null;}}else{_0x1aa6f3=null;}_0xd50b1b['cb'](null,{'code':_0x55e84f,'result':_0x1d764c,'extra':_0x1aa6f3});}});_0x2e65e1['on'](_0x90b7('0x17'),function(_0x3cefb0){_0x497698[_0x90b7('0x18')](_0x90b7('0x17'),new AGIError(_0x90b7('0x19'),_0x3cefb0['code']));});_0x2e65e1['on'](_0x90b7('0x1a'),function(){_0x497698['emit']('close',new AGIError(_0x90b7('0x1b')));});_0x2e65e1['on'](_0x90b7('0x1c'),function(){_0x497698[_0x90b7('0x18')](_0x90b7('0x1c'),new AGIError(_0x90b7('0x1d')));_0x2e65e1[_0x90b7('0x1e')]();});_0x2e65e1[_0x90b7('0x1f')](_0xd3671f);this[_0x90b7('0x20')]=function(_0x3e1b34,_0x415a58){var _0x3e1b34=_0x3e1b34||'',_0x415a58=typeof _0x415a58=='function'?_0x415a58:new Function();_0xd50b1b={'tx':_0x3e1b34,'rx':'','cb':_0x415a58};_0x2e65e1['write'](_0x3e1b34+'\x0a');},this['close']=function(){_0x2e65e1[_0x90b7('0x1e')]();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel['prototype'][_0x90b7('0x21')]=function(_0x35279e){return this['command'][_0x90b7('0x22')](this,_0x35279e);};AGIChannel['prototype'][_0x90b7('0x23')]=function(){return this[_0x90b7('0x21')]('ANSWER');};AGIChannel['prototype'][_0x90b7('0x24')]=function(_0x37c6ef,_0x2d6c17,_0x32aec3){_0x37c6ef=_0x37c6ef===undefined?_0x90b7('0x25'):_0x37c6ef;_0x2d6c17=_0x2d6c17===undefined?'5':_0x2d6c17;_0x32aec3=_0x32aec3===undefined?'1':_0x32aec3;return this[_0x90b7('0x21')](util[_0x90b7('0x26')](_0x90b7('0x27'),_0x37c6ef,_0x2d6c17*0x3e8,_0x32aec3));};AGIChannel[_0x90b7('0x28')][_0x90b7('0x29')]=function(_0x107221){_0x107221=_0x107221||_0x90b7('0x2a');return this['sendRequest'](util[_0x90b7('0x26')](_0x90b7('0x2b'),_0x107221));};AGIChannel['prototype'][_0x90b7('0x2c')]=function(_0x50e69d,_0x4d7579){if(_[_0x90b7('0x2d')](_0x4d7579)){return this[_0x90b7('0x21')](util[_0x90b7('0x26')](_0x90b7('0x2e'),_0x50e69d,_0x4d7579[_0x90b7('0x2f')](',')));}return this['sendRequest'](util[_0x90b7('0x26')](_0x90b7('0x2e'),_0x50e69d,_0x4d7579));};AGIChannel['prototype'][_0x90b7('0x30')]=function(_0x25a51c){return this[_0x90b7('0x21')](util['format'](_0x90b7('0x31'),_0x25a51c));};AGIChannel[_0x90b7('0x28')][_0x90b7('0x32')]=function(_0x34695e){return this['sendRequest'](util[_0x90b7('0x26')](_0x90b7('0x33'),_0x34695e));};AGIChannel['prototype'][_0x90b7('0x34')]=function(_0x4b56dd){return this[_0x90b7('0x21')](util[_0x90b7('0x26')](_0x90b7('0x35'),_0x4b56dd));};AGIChannel[_0x90b7('0x28')]['hangup']=function(){return this[_0x90b7('0x21')]('HANGUP');};AGIChannel[_0x90b7('0x28')][_0x90b7('0x36')]=function(_0x771ea5,_0x1e5d8c){var _0x43a967=_[_0x90b7('0x37')](_0x1e5d8c)||_[_0x90b7('0x38')](_0x1e5d8c)?_0x1e5d8c[_0x90b7('0x39')]():_0x1e5d8c;return this[_0x90b7('0x21')](util[_0x90b7('0x26')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x771ea5,_0x43a967?_0x43a967[_0x90b7('0x39')]()[_0x90b7('0x10')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x90b7('0x28')][_0x90b7('0x3a')]=function(_0x248bb7,_0x4c8cc2){return this[_0x90b7('0x21')](util[_0x90b7('0x26')](_0x90b7('0x3b'),_0x248bb7,_0x4c8cc2));};AGIChannel[_0x90b7('0x28')][_0x90b7('0x3c')]=function(_0x16e272,_0x4a6992){return this[_0x90b7('0x21')](util[_0x90b7('0x26')]('SAY\x20DIGITS\x20%s\x20%s',_0x16e272,_0x4a6992));};AGIChannel['prototype']['sayPhonetic']=function(_0xee4f49,_0x15394e){return this[_0x90b7('0x21')](util[_0x90b7('0x26')](_0x90b7('0x3d'),_0xee4f49,_0x15394e));};AGIChannel[_0x90b7('0x28')][_0x90b7('0x3e')]=function(_0x286640,_0x410d17,_0x2bff1d){_0x410d17=_0x410d17||this[_0x90b7('0x3f')];_0x2bff1d=_0x2bff1d||0x1;this['setContext'](_0x286640);this['setExtension'](_0x410d17);this[_0x90b7('0x34')](_0x2bff1d);return this[_0x90b7('0x29')](util[_0x90b7('0x26')](_0x90b7('0x40'),_0x286640,_0x410d17,_0x2bff1d));};AGIChannel[_0x90b7('0x28')][_0x90b7('0x41')]=function(_0x105a29){return this[_0x90b7('0x21')](util[_0x90b7('0x26')]('GET\x20VARIABLE\x20\x22%s\x22',_0x105a29));};AGIChannel[_0x90b7('0x28')][_0x90b7('0x42')]=function(_0x4e0877,_0x17354d,_0x5aea99,_0x1fc8c2,_0x1233e2,_0x3368d2){_0x17354d=_0x17354d||_0x90b7('0x43');_0x5aea99=_0x5aea99||'';_0x1fc8c2=_0x1fc8c2===undefined?-0x1:_0x1fc8c2==='-1'?-0x1:_0x1fc8c2*0x3e8;_0x1233e2=_0x1233e2===undefined?'':'s='+_0x1233e2;_0x3368d2=_0x3368d2?_0x90b7('0x44'):'';return this[_0x90b7('0x21')](util[_0x90b7('0x26')](_0x90b7('0x45'),_0x4e0877,_0x17354d,_0x5aea99,_0x1fc8c2,_0x3368d2,_0x1233e2));};AGIChannel[_0x90b7('0x28')][_0x90b7('0x46')]=function(_0x2d3b71,_0x273fd2){_0x273fd2=_0x273fd2||'';return this[_0x90b7('0x21')](util['format'](_0x90b7('0x47'),_0x2d3b71,_0x273fd2));};AGIChannel[_0x90b7('0x28')][_0x90b7('0x48')]=function(_0x410c52){return this[_0x90b7('0x2c')](_0x90b7('0x49'),_0x410c52);};AGIChannel[_0x90b7('0x28')][_0x90b7('0x4a')]=function(_0x112c22){return this[_0x90b7('0x2c')]('WAIT',_0x112c22);};AGIChannel[_0x90b7('0x28')][_0x90b7('0x17')]=function(_0x4447bd,_0x5d7ab7){this['noop'](util[_0x90b7('0x26')](_0x90b7('0x4b'),_0x4447bd['id'],_0x4447bd[_0x90b7('0x4c')],_0x5d7ab7));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x90b7('0x4d')]=AGIChannel; \ No newline at end of file +var _0xafec=['HANGUP','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setExtension','setPriority','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','lodash','events','EventEmitter','./reply','call','setEncoding','utf8','setTimeout','headers','emit','ready','line','toLowerCase','520-Invalid','search','520\x20End\x20of\x20proper','substring','replace','indexOf','substr','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','pipe','command','function','write','inherits','prototype','sendRequest','sync','ANSWER','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','EXEC\x20%s\x20%s','join','setContext','SET\x20EXTENSION\x20%s','hangup'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xafec,0x161));var _0xcafe=function(_0x457e71,_0xc110a1){_0x457e71=_0x457e71-0x0;var _0x575152=_0xafec[_0x457e71];return _0x575152;};'use strict';var util=require('util');var _=require(_0xcafe('0x0'));var EventEmitter=require(_0xcafe('0x1'))[_0xcafe('0x2')];var AGIReply=require(_0xcafe('0x3'));var AGIError=require('./error');function AGIChannel(_0x3f65a6){var _0x4dc193=this,_0x5709da=new AGIReply(),_0x3bec39=![],_0x58538a={};EventEmitter[_0xcafe('0x4')](_0x4dc193);_0x3f65a6[_0xcafe('0x5')](_0xcafe('0x6'));_0x3f65a6[_0xcafe('0x7')](0x8*0x3c*0x3c*0x3e8);_0x5709da[_0xcafe('0x5')](_0xcafe('0x6'));_0x5709da['on'](_0xcafe('0x8'),function(_0x35762a){for(var _0x21bef8 in _0x35762a){_0x4dc193[_0x21bef8]=_0x35762a[_0x21bef8];}_0x4dc193[_0xcafe('0x9')](_0xcafe('0xa'));});_0x5709da['on'](_0xcafe('0xb'),function(_0x4f8545){if(_0x4f8545[_0xcafe('0xc')]()=='hangup'){_0x4dc193[_0xcafe('0x9')]('hangup');return;}if(_0x4f8545['substring'](0x0,0xb)==_0xcafe('0xd')){_0x3bec39=!![];}if(_0x3bec39){_0x58538a['rx']+=_0x4f8545+'\x0a';if(_0x4f8545[_0xcafe('0xe')](_0xcafe('0xf'))!=-0x1){_0x3bec39=![];}}else{_0x58538a['rx']=_0x4f8545;}if(_0x3bec39){return;}if(typeof _0x58538a['cb']=='function'){var _0x36b734=_0x58538a['rx'][_0xcafe('0x10')](0x0,0x3),_0x40780b=null,_0x174144=null;_0x36b734=parseInt(_0x36b734);if(isNaN(_0x36b734)){_0x58538a['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x36b734!=0xc8){_0x58538a['cb'](null,{'code':_0x36b734,'result':-0x1,'extra':'KO'});return;}_0x40780b=_0x58538a['rx'][_0xcafe('0x10')](0x4)[_0xcafe('0x11')]('result=','');if(_0x40780b[_0xcafe('0x12')]('\x20')!=-0x1){_0x40780b=_0x40780b[_0xcafe('0x13')](0x0,_0x40780b['indexOf']('\x20'));}if(_[_0xcafe('0x14')](_0x40780b,'-1')){_0x40780b=parseInt(_0x40780b);}_0x174144=_0x58538a['rx'][_0xcafe('0x15')]('\x20');if(_0x174144[_0xcafe('0x16')]==0x3){_0x174144=_0x174144[0x2][_0xcafe('0x10')](0x1,_0x174144[0x2][_0xcafe('0x16')]-0x1);}else if(_0x174144[_0xcafe('0x16')]>0x3){var _0x45dc6d=/\((.+)\)/;var _0x5dfbde=_0x58538a['rx'][_0xcafe('0x17')](_0x45dc6d);if(_0x5dfbde){_0x174144=_0x5dfbde[0x1];}else{_0x174144=null;}}else{_0x174144=null;}_0x58538a['cb'](null,{'code':_0x36b734,'result':_0x40780b,'extra':_0x174144});}});_0x3f65a6['on'](_0xcafe('0x18'),function(_0x1eca69){_0x4dc193[_0xcafe('0x9')](_0xcafe('0x18'),new AGIError(_0xcafe('0x19'),_0x1eca69['code']));});_0x3f65a6['on'](_0xcafe('0x1a'),function(){_0x4dc193[_0xcafe('0x9')](_0xcafe('0x1a'),new AGIError(_0xcafe('0x1b')));});_0x3f65a6['on'](_0xcafe('0x1c'),function(){_0x4dc193[_0xcafe('0x9')](_0xcafe('0x1c'),new AGIError(_0xcafe('0x1d')));_0x3f65a6['destroy']();});_0x3f65a6[_0xcafe('0x1e')](_0x5709da);this[_0xcafe('0x1f')]=function(_0x579e65,_0x409f16){var _0x579e65=_0x579e65||'',_0x409f16=typeof _0x409f16==_0xcafe('0x20')?_0x409f16:new Function();_0x58538a={'tx':_0x579e65,'rx':'','cb':_0x409f16};_0x3f65a6[_0xcafe('0x21')](_0x579e65+'\x0a');},this[_0xcafe('0x1a')]=function(){_0x3f65a6['destroy']();};}util[_0xcafe('0x22')](AGIChannel,EventEmitter);AGIChannel[_0xcafe('0x23')][_0xcafe('0x24')]=function(_0x926138){return this['command'][_0xcafe('0x25')](this,_0x926138);};AGIChannel[_0xcafe('0x23')]['answer']=function(){return this[_0xcafe('0x24')](_0xcafe('0x26'));};AGIChannel['prototype'][_0xcafe('0x27')]=function(_0x5f4bea,_0x2f5239,_0x3b7e6f){_0x5f4bea=_0x5f4bea===undefined?_0xcafe('0x28'):_0x5f4bea;_0x2f5239=_0x2f5239===undefined?'5':_0x2f5239;_0x3b7e6f=_0x3b7e6f===undefined?'1':_0x3b7e6f;return this['sendRequest'](util[_0xcafe('0x29')](_0xcafe('0x2a'),_0x5f4bea,_0x2f5239*0x3e8,_0x3b7e6f));};AGIChannel[_0xcafe('0x23')][_0xcafe('0x2b')]=function(_0x26acd1){_0x26acd1=_0x26acd1||_0xcafe('0x2c');return this[_0xcafe('0x24')](util[_0xcafe('0x29')](_0xcafe('0x2d'),_0x26acd1));};AGIChannel[_0xcafe('0x23')][_0xcafe('0x2e')]=function(_0x1f8306,_0x38c7c3){if(_['isArray'](_0x38c7c3)){return this[_0xcafe('0x24')](util[_0xcafe('0x29')](_0xcafe('0x2f'),_0x1f8306,_0x38c7c3[_0xcafe('0x30')](',')));}return this[_0xcafe('0x24')](util[_0xcafe('0x29')]('EXEC\x20%s\x20%s',_0x1f8306,_0x38c7c3));};AGIChannel['prototype'][_0xcafe('0x31')]=function(_0x569c1d){return this[_0xcafe('0x24')](util[_0xcafe('0x29')]('SET\x20CONTEXT\x20%s',_0x569c1d));};AGIChannel[_0xcafe('0x23')]['setExtension']=function(_0x39d368){return this[_0xcafe('0x24')](util[_0xcafe('0x29')](_0xcafe('0x32'),_0x39d368));};AGIChannel['prototype']['setPriority']=function(_0x4b367d){return this[_0xcafe('0x24')](util[_0xcafe('0x29')]('SET\x20PRIORITY\x20%s',_0x4b367d));};AGIChannel[_0xcafe('0x23')][_0xcafe('0x33')]=function(){return this[_0xcafe('0x24')](_0xcafe('0x34'));};AGIChannel[_0xcafe('0x23')]['setVariable']=function(_0x81abe9,_0x512170){var _0x2bbeca=_[_0xcafe('0x35')](_0x512170)||_[_0xcafe('0x36')](_0x512170)?_0x512170[_0xcafe('0x37')]():_0x512170;return this[_0xcafe('0x24')](util[_0xcafe('0x29')](_0xcafe('0x38'),_0x81abe9,_0x2bbeca?_0x2bbeca['toString']()[_0xcafe('0x11')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xcafe('0x23')][_0xcafe('0x39')]=function(_0x145181,_0x21eb47){return this['sendRequest'](util[_0xcafe('0x29')](_0xcafe('0x3a'),_0x145181,_0x21eb47));};AGIChannel[_0xcafe('0x23')]['sayDigits']=function(_0x4b575c,_0xb78fd2){return this[_0xcafe('0x24')](util['format'](_0xcafe('0x3b'),_0x4b575c,_0xb78fd2));};AGIChannel[_0xcafe('0x23')][_0xcafe('0x3c')]=function(_0x54a5ef,_0x1c5cd1){return this[_0xcafe('0x24')](util['format'](_0xcafe('0x3d'),_0x54a5ef,_0x1c5cd1));};AGIChannel[_0xcafe('0x23')][_0xcafe('0x3e')]=function(_0x583d0e,_0xe9dc6,_0x14266e){_0xe9dc6=_0xe9dc6||this[_0xcafe('0x3f')];_0x14266e=_0x14266e||0x1;this[_0xcafe('0x31')](_0x583d0e);this[_0xcafe('0x40')](_0xe9dc6);this[_0xcafe('0x41')](_0x14266e);return this['noop'](util[_0xcafe('0x29')](_0xcafe('0x42'),_0x583d0e,_0xe9dc6,_0x14266e));};AGIChannel['prototype'][_0xcafe('0x43')]=function(_0x13e114){return this[_0xcafe('0x24')](util[_0xcafe('0x29')](_0xcafe('0x44'),_0x13e114));};AGIChannel[_0xcafe('0x23')][_0xcafe('0x45')]=function(_0x3889d7,_0x557522,_0x5bb1ca,_0x3f52a5,_0x22c81a,_0x210993){_0x557522=_0x557522||_0xcafe('0x46');_0x5bb1ca=_0x5bb1ca||'';_0x3f52a5=_0x3f52a5===undefined?-0x1:_0x3f52a5==='-1'?-0x1:_0x3f52a5*0x3e8;_0x22c81a=_0x22c81a===undefined?'':'s='+_0x22c81a;_0x210993=_0x210993?_0xcafe('0x47'):'';return this[_0xcafe('0x24')](util['format']('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x3889d7,_0x557522,_0x5bb1ca,_0x3f52a5,_0x210993,_0x22c81a));};AGIChannel[_0xcafe('0x23')][_0xcafe('0x48')]=function(_0x1b2a5d,_0x162f81){_0x162f81=_0x162f81||'';return this[_0xcafe('0x24')](util[_0xcafe('0x29')](_0xcafe('0x49'),_0x1b2a5d,_0x162f81));};AGIChannel[_0xcafe('0x23')][_0xcafe('0x4a')]=function(_0x3668c2){return this['exec'](_0xcafe('0x4b'),_0x3668c2);};AGIChannel['prototype'][_0xcafe('0x4c')]=function(_0x16cb0a){return this[_0xcafe('0x2e')](_0xcafe('0x4d'),_0x16cb0a);};AGIChannel[_0xcafe('0x23')][_0xcafe('0x18')]=function(_0x2f96f3,_0x3533f2){this['noop'](util[_0xcafe('0x29')](_0xcafe('0x4e'),_0x2f96f3['id'],_0x2f96f3[_0xcafe('0x4f')],_0x3533f2));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xcafe('0x50')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 9d0864c..11f9cd6 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 _0x235e=['[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply','name','Undefined\x20error.'];(function(_0x5b1e0f,_0x2913f3){var _0x2dec82=function(_0x432f9a){while(--_0x432f9a){_0x5b1e0f['push'](_0x5b1e0f['shift']());}};_0x2dec82(++_0x2913f3);}(_0x235e,0x1d3));var _0xe235=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x235e[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':_0xe235('0x0'),'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':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':_0xe235('0x1'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0xe235('0x2'),'E_AGI_SOCKET_TIMEOUT':_0xe235('0x3'),'E_AGI_COMMAND_EMPTY':_0xe235('0x4'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xe235('0x5'),'E_AGI_IVR_ENTRY':_0xe235('0x6')};function AGIError(_0x5b8b2f){var _0x5b8b2f=_0x5b8b2f||null,_0x1f0b7d=_0x1f0b7d||[],_0x5dbf85=0x1,_0x27bb6b='';if(!error[_0x5b8b2f]){_0x5b8b2f=_0xe235('0x7');}_0x1f0b7d[_0xe235('0x8')](error[_0x5b8b2f]);while(arguments[_0x5dbf85]){_0x1f0b7d[_0xe235('0x8')](arguments[_0x5dbf85]);_0x5dbf85++;}_0x27bb6b=util[_0xe235('0x9')][_0xe235('0xa')](util,_0x1f0b7d);this['message']=_0x27bb6b;this[_0xe235('0xb')]=_0x5b8b2f;}module['exports']=AGIError; \ No newline at end of file +var _0x845d=['[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','message','name','exports','util','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.'];(function(_0x4350c2,_0x112f3c){var _0x8b6406=function(_0x49e845){while(--_0x49e845){_0x4350c2['push'](_0x4350c2['shift']());}};_0x8b6406(++_0x112f3c);}(_0x845d,0x13c));var _0xd845=function(_0x3053d2,_0x3d87f3){_0x3053d2=_0x3053d2-0x0;var _0x462347=_0x845d[_0x3053d2];return _0x462347;};'use strict';var util=require(_0xd845('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0xd845('0x1'),'E_AGI_SERVER_ERROR':_0xd845('0x2'),'E_AGI_SERVER_CLOSE':_0xd845('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0xd845('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0xd845('0x5'),'E_AGI_SOCKET_ERROR':_0xd845('0x6'),'E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':_0xd845('0x7'),'E_AGI_COMMAND_EMPTY':_0xd845('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0xd845('0x9')};function AGIError(_0x4387b4){var _0x4387b4=_0x4387b4||null,_0x27e244=_0x27e244||[],_0x2f8756=0x1,_0x4b383='';if(!error[_0x4387b4]){_0x4387b4=_0xd845('0xa');}_0x27e244[_0xd845('0xb')](error[_0x4387b4]);while(arguments[_0x2f8756]){_0x27e244[_0xd845('0xb')](arguments[_0x2f8756]);_0x2f8756++;}_0x4b383=util[_0xd845('0xc')]['apply'](util,_0x27e244);this[_0xd845('0xd')]=_0x4b383;this[_0xd845('0xe')]=_0x4387b4;}module[_0xd845('0xf')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index 8e484c4..5602a52 100644 --- a/server/services/agi/events.js +++ b/server/services/agi/events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf87f=['message','parse','exports','lodash','events','EventEmitter','ioredis','./error','../../config/environment','redis','defaults','subscribe','emit','error','E_AGI_SERVER_ERROR'];(function(_0x38df75,_0x1ddbc6){var _0x28faaa=function(_0x47ab32){while(--_0x47ab32){_0x38df75['push'](_0x38df75['shift']());}};_0x28faaa(++_0x1ddbc6);}(_0xf87f,0xa8));var _0xff87=function(_0x428cbd,_0x434278){_0x428cbd=_0x428cbd-0x0;var _0x207617=_0xf87f[_0x428cbd];return _0x207617;};'use strict';var _=require(_0xff87('0x0'));var EventEmitter=require(_0xff87('0x1'))[_0xff87('0x2')];var Redis=require(_0xff87('0x3'));var AGIError=require(_0xff87('0x4'));var config=require(_0xff87('0x5'));config[_0xff87('0x6')]=_[_0xff87('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0xff87('0x6')]);sub[_0xff87('0x8')]('agi',function(_0x52a9b8){if(_0x52a9b8)return eventEmitter[_0xff87('0x9')](_0xff87('0xa'),new AGIError(_0xff87('0xb'),_0x52a9b8));});sub['on'](_0xff87('0xc'),function(_0x518ea6,_0x449529){if(_0x518ea6!=='agi')return;try{var _0x2f0e97=JSON[_0xff87('0xd')](_0x449529);eventEmitter[_0xff87('0x9')]('projectUpdate',_0x2f0e97);}catch(_0x2d20d8){eventEmitter['emit'](_0xff87('0xa'),new AGIError(_0xff87('0xb'),_0x2d20d8));}});module[_0xff87('0xe')]={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0x7c89=['defaults','localhost','subscribe','agi','error','E_AGI_SERVER_ERROR','parse','emit','lodash','EventEmitter','../../config/environment','redis'];(function(_0x193fe6,_0x57d2c2){var _0x3afc4f=function(_0x46c74d){while(--_0x46c74d){_0x193fe6['push'](_0x193fe6['shift']());}};_0x3afc4f(++_0x57d2c2);}(_0x7c89,0x128));var _0x97c8=function(_0x2f4311,_0xd2d511){_0x2f4311=_0x2f4311-0x0;var _0x309ccb=_0x7c89[_0x2f4311];return _0x309ccb;};'use strict';var _=require(_0x97c8('0x0'));var EventEmitter=require('events')[_0x97c8('0x1')];var Redis=require('ioredis');var AGIError=require('./error');var config=require(_0x97c8('0x2'));config[_0x97c8('0x3')]=_[_0x97c8('0x4')](config['redis'],{'host':_0x97c8('0x5'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x97c8('0x3')]);sub[_0x97c8('0x6')](_0x97c8('0x7'),function(_0x27845e){if(_0x27845e)return eventEmitter['emit'](_0x97c8('0x8'),new AGIError(_0x97c8('0x9'),_0x27845e));});sub['on']('message',function(_0x37e18c,_0x384c9d){if(_0x37e18c!==_0x97c8('0x7'))return;try{var _0x41b8b4=JSON[_0x97c8('0xa')](_0x384c9d);eventEmitter[_0x97c8('0xb')]('projectUpdate',_0x41b8b4);}catch(_0x3db2d1){eventEmitter[_0x97c8('0xb')](_0x97c8('0x8'),new AGIError(_0x97c8('0x9'),_0x3db2d1));}});module['exports']={'EventEmitter':eventEmitter}; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 9431168..a5819bc 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 _0xa001=['target','invalid','includes','agicommand','max\x20retry\x20reach','lodash','../../../config/logger','agi','menu','getdigits','getsecretdigits','vertices','edges','prototype','push','numberOfEdges','size','relations','traverseBFS','info','no\x20vertex\x20found','no\x20edge/s\x20available','length','condition','split','vswitch'];(function(_0x32573e,_0x36aa61){var _0x555aa5=function(_0x50bdd5){while(--_0x50bdd5){_0x32573e['push'](_0x32573e['shift']());}};_0x555aa5(++_0x36aa61);}(_0xa001,0x171));var _0x1a00=function(_0x289fb2,_0x177f2a){_0x289fb2=_0x289fb2-0x0;var _0x39915b=_0xa001[_0x289fb2];return _0x39915b;};'use strict';var _=require(_0x1a00('0x0'));var logger=require(_0x1a00('0x1'))(_0x1a00('0x2'));var verticesWithRetry=[_0x1a00('0x3'),_0x1a00('0x4'),_0x1a00('0x5')];var Graph=function(){this[_0x1a00('0x6')]={};this[_0x1a00('0x7')]={};this['numberOfEdges']=0x0;};Graph[_0x1a00('0x8')]['addVertex']=function(_0x5440bd){this[_0x1a00('0x6')][_0x5440bd['id']]=_0x5440bd;this[_0x1a00('0x7')][_0x5440bd['id']]=[];};Graph[_0x1a00('0x8')]['addEdge']=function(_0x16142c,_0x2f40db,_0x56e8f4){this[_0x1a00('0x7')][_0x16142c][_0x1a00('0x9')]({'target':_0x2f40db,'condition':_0x56e8f4});this[_0x1a00('0xa')]+=0x1;};Graph[_0x1a00('0x8')][_0x1a00('0xb')]=function(){return _[_0x1a00('0xb')](this[_0x1a00('0x6')]);};Graph[_0x1a00('0x8')][_0x1a00('0xc')]=function(){return this[_0x1a00('0xa')];};Graph[_0x1a00('0x8')]['getVertex']=function(_0x3b874b){return this[_0x1a00('0x6')][_0x3b874b];};Graph['prototype'][_0x1a00('0xd')]=function(_0x1bc668,_0x4ee900){if(!this[_0x1a00('0x6')][_0x1bc668]){return logger[_0x1a00('0xe')](_0x1a00('0xf'));}var _0xa1968e=_0x4ee900(this[_0x1a00('0x6')][_0x1bc668]);if(!_0xa1968e){return logger[_0x1a00('0xe')]('stop\x20traverse');}if(this[_0x1a00('0x7')][_0x1bc668]['length']===0x0){return logger['info'](_0x1a00('0x10'));}for(var _0x570501=0x0,_0x2113fd=[],_0x44c226=![];_0x570501\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','then','catch','hasOwnProperty','indexOf','substring','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','timeout','find','handleNotFound','production','handleUnpublished','initialize','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','[LICENSE]','finally','./server','close'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3f17,0x11d));var _0x73f1=function(_0x2a011b,_0x4b5cd3){_0x2a011b=_0x2a011b-0x0;var _0x159aab=_0x3f17[_0x2a011b];return _0x159aab;};'use strict';var _=require('lodash');var syncho=require(_0x73f1('0x0'));var util=require('util');var config=require(_0x73f1('0x1'));var logger=require(_0x73f1('0x2'))(_0x73f1('0x3'));var utilLicense=require(_0x73f1('0x4'));var rpc=require('./rpc');var Project=require(_0x73f1('0x5'));var AGIEmitter=require(_0x73f1('0x6'))['EventEmitter'];var projects=[];config[_0x73f1('0x3')]=_[_0x73f1('0x7')](config[_0x73f1('0x3')],{'ip':_0x73f1('0x8'),'port':0x11dd});AGIEmitter['on']('projectUpdate',projectUpdateHandler);function connectionHandler(_0x3fe7ca){process[_0x73f1('0x9')](function(){syncho(function(){try{setChannelVariables(_0x3fe7ca);agiHandler(_0x3fe7ca);}catch(_0x2bc5a7){logger[_0x73f1('0xa')](_0x2bc5a7[_0x73f1('0xb')]);}});});}function projectUpdateHandler(_0x12d654){try{var _0x1f66ff=_[_0x73f1('0xc')](projects,['id',_0x12d654['id']]);if(_0x1f66ff>-0x1){if(_0x12d654[_0x73f1('0xd')]===!![]){projects['splice'](_0x1f66ff,0x1);}else{projects[_0x1f66ff]=_0x12d654;}}else{projects[_0x73f1('0xe')](_0x12d654);}}catch(_0x22abde){logger[_0x73f1('0xa')](_0x22abde[_0x73f1('0xb')]);}}function listeningHandler(){console[_0x73f1('0xf')](_0x73f1('0x10'),config['agi'][_0x73f1('0x11')]);logger[_0x73f1('0x12')](util[_0x73f1('0x13')](_0x73f1('0x14'),config[_0x73f1('0x3')]['ip'],config['agi']['port']));}function errorHandler(_0x2e42d5){if(_0x2e42d5&&_0x2e42d5[_0x73f1('0x15')]&&_0x2e42d5[_0x73f1('0x16')]){logger[_0x73f1('0xa')](util['format'](_0x73f1('0x17'),_0x2e42d5[_0x73f1('0x15')],_0x2e42d5[_0x73f1('0x16')]));}else{logger[_0x73f1('0xa')](util['format']('[ERROR]\x20%s',_0x2e42d5['stack']));}}function closeHandler(){logger[_0x73f1('0x12')](util[_0x73f1('0x13')]('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x73f1('0x18')],this[_0x73f1('0x19')],this['callerid'],this[_0x73f1('0x1a')],this[_0x73f1('0x1b')]));try{createSquareReport(this);}catch(_0x46a727){logger[_0x73f1('0xa')](_0x46a727['stack']);}}function timeoutHandler(){logger[_0x73f1('0x12')](util[_0x73f1('0x13')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x73f1('0x18')],this[_0x73f1('0x19')],this[_0x73f1('0x1c')],this['dnid'],this[_0x73f1('0x1b')]));}function hangupHandler(){logger[_0x73f1('0x12')](util[_0x73f1('0x13')](_0x73f1('0x1d'),this[_0x73f1('0x18')],this['calleridname'],this[_0x73f1('0x1c')],this[_0x73f1('0x1a')],this[_0x73f1('0x1b')]));this[_0x73f1('0x1e')]=!![];}function createSquareReport(_0x50cffd,_0x350bab){rpc['createSquareReport'](_0x50cffd)[_0x73f1('0x1f')](function(_0x4440df){if(_0x350bab){_0x350bab(null,_0x4440df);}})[_0x73f1('0x20')](function(_0x194be6){if(_0x350bab){_0x350bab(null,_0x194be6);}});}function setChannelVariables(_0x590a10){for(var _0x49eb6d in _0x590a10){if(_0x590a10[_0x73f1('0x21')](_0x49eb6d)){if(_0x49eb6d[_0x73f1('0x22')]('agi_')===0x0){_0x590a10[_0x49eb6d[_0x73f1('0x23')](0x4)]=_0x590a10[_0x49eb6d];delete _0x590a10[_0x49eb6d];}}}}function agiHandler(_0x597973){logger[_0x73f1('0x24')](_0x73f1('0x25'),JSON[_0x73f1('0x26')](_0x597973,null,0x2));logger[_0x73f1('0x12')](util[_0x73f1('0x13')](_0x73f1('0x27'),_0x597973[_0x73f1('0x18')],_0x597973[_0x73f1('0x19')],_0x597973['callerid'],_0x597973[_0x73f1('0x1a')],_0x597973[_0x73f1('0x1b')]));_0x597973['on']('error',errorHandler);_0x597973['on']('close',closeHandler);_0x597973['on'](_0x73f1('0x28'),timeoutHandler);_0x597973[_0x73f1('0x1e')]=![];_0x597973['on']('hangup',hangupHandler);var _0x5764ec=_[_0x73f1('0x29')](projects,['name',_0x597973['arg_1']]);if(!_0x5764ec)return Project[_0x73f1('0x2a')](_0x597973);if(!_0x5764ec[_0x73f1('0x2b')])return Project[_0x73f1('0x2c')](_0x597973);return Project[_0x73f1('0x2d')](_0x5764ec,_0x597973);}function main(){var _0x2c9a03;return utilLicense[_0x73f1('0x2e')]()[_0x73f1('0x1f')](function(_0x4b426f){if(!_0x4b426f)return;if(_0x4b426f[_0x73f1('0x2f')]){if(_0x4b426f[_0x73f1('0x30')]&&_0x4b426f[_0x73f1('0x30')]>0x0){logger[_0x73f1('0x12')](util[_0x73f1('0x13')](_0x73f1('0x31'),_0x4b426f[_0x73f1('0x30')]));_0x2c9a03=_0x4b426f[_0x73f1('0x30')];}else{logger[_0x73f1('0x12')](_0x73f1('0x32'));}}else{logger['info'](_0x73f1('0x33'));_0x2c9a03=-0x1;}})[_0x73f1('0x1f')](function(){return Project[_0x73f1('0x34')]();})[_0x73f1('0x1f')](function(_0x33f4e8){projects=_0x33f4e8;return;})[_0x73f1('0x20')](function(_0xccd908){logger[_0x73f1('0xa')](_0x73f1('0x35'),_0xccd908[_0x73f1('0xb')]);})[_0x73f1('0x36')](function(){var _0x2c0c51=require(_0x73f1('0x37'))(config[_0x73f1('0x3')]['port'],config[_0x73f1('0x3')]['ip'],_0x2c9a03);_0x2c0c51['on'](_0x73f1('0xa'),errorHandler);_0x2c0c51['on']('listening',listeningHandler);_0x2c0c51['on']('connection',connectionHandler);_0x2c0c51['on'](_0x73f1('0x38'),closeHandler);});}main(); \ No newline at end of file +var _0x3d67=['variables','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','handleNotFound','production','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','finally','connection','lodash','syncho','util','../../config/environment','../../config/logger','agi','../../config/license/util','./project','./events','EventEmitter','defaults','127.0.0.1','projectUpdate','error','stack','deleted','splice','log','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','port','name','message','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','uniqueid','info','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport','then','catch','hasOwnProperty','indexOf','agi_','substring','debug'];(function(_0x5dbc26,_0x59fe73){var _0x2397ce=function(_0x18a4bd){while(--_0x18a4bd){_0x5dbc26['push'](_0x5dbc26['shift']());}};_0x2397ce(++_0x59fe73);}(_0x3d67,0x1bd));var _0x73d6=function(_0x503a45,_0x12312f){_0x503a45=_0x503a45-0x0;var _0x1a27d1=_0x3d67[_0x503a45];return _0x1a27d1;};'use strict';var _=require(_0x73d6('0x0'));var syncho=require(_0x73d6('0x1'));var util=require(_0x73d6('0x2'));var config=require(_0x73d6('0x3'));var logger=require(_0x73d6('0x4'))(_0x73d6('0x5'));var utilLicense=require(_0x73d6('0x6'));var rpc=require('./rpc');var Project=require(_0x73d6('0x7'));var AGIEmitter=require(_0x73d6('0x8'))[_0x73d6('0x9')];var projects=[];config[_0x73d6('0x5')]=_[_0x73d6('0xa')](config[_0x73d6('0x5')],{'ip':_0x73d6('0xb'),'port':0x11dd});AGIEmitter['on'](_0x73d6('0xc'),projectUpdateHandler);function connectionHandler(_0xd7df17){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0xd7df17);agiHandler(_0xd7df17);}catch(_0x3fd975){logger[_0x73d6('0xd')](_0x3fd975[_0x73d6('0xe')]);}});});}function projectUpdateHandler(_0x5b8b73){try{var _0x365e86=_['findIndex'](projects,['id',_0x5b8b73['id']]);if(_0x365e86>-0x1){if(_0x5b8b73[_0x73d6('0xf')]===!![]){projects[_0x73d6('0x10')](_0x365e86,0x1);}else{projects[_0x365e86]=_0x5b8b73;}}else{projects['push'](_0x5b8b73);}}catch(_0x19d1e1){logger[_0x73d6('0xd')](_0x19d1e1[_0x73d6('0xe')]);}}function listeningHandler(){console[_0x73d6('0x11')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config[_0x73d6('0x5')]['port']);logger['info'](util[_0x73d6('0x12')](_0x73d6('0x13'),config['agi']['ip'],config['agi'][_0x73d6('0x14')]));}function errorHandler(_0x31d85a){if(_0x31d85a&&_0x31d85a[_0x73d6('0x15')]&&_0x31d85a['message']){logger['error'](util[_0x73d6('0x12')]('[%s]\x20%s',_0x31d85a['name'],_0x31d85a[_0x73d6('0x16')]));}else{logger[_0x73d6('0xd')](util[_0x73d6('0x12')]('[ERROR]\x20%s',_0x31d85a[_0x73d6('0xe')]));}}function closeHandler(){logger['info'](util[_0x73d6('0x12')](_0x73d6('0x17'),this[_0x73d6('0x18')],this[_0x73d6('0x19')],this[_0x73d6('0x1a')],this[_0x73d6('0x1b')],this['uniqueid']));try{createSquareReport(this);}catch(_0x68d2ee){logger[_0x73d6('0xd')](_0x68d2ee[_0x73d6('0xe')]);}}function timeoutHandler(){logger['info'](util[_0x73d6('0x12')](_0x73d6('0x1c'),this[_0x73d6('0x18')],this['calleridname'],this['callerid'],this['dnid'],this[_0x73d6('0x1d')]));}function hangupHandler(){logger[_0x73d6('0x1e')](util[_0x73d6('0x12')](_0x73d6('0x1f'),this[_0x73d6('0x18')],this[_0x73d6('0x19')],this['callerid'],this[_0x73d6('0x1b')],this[_0x73d6('0x1d')]));this[_0x73d6('0x20')]=!![];}function createSquareReport(_0x1bb9ba,_0x367f47){rpc[_0x73d6('0x21')](_0x1bb9ba)[_0x73d6('0x22')](function(_0x3d6ee1){if(_0x367f47){_0x367f47(null,_0x3d6ee1);}})[_0x73d6('0x23')](function(_0x175ad4){if(_0x367f47){_0x367f47(null,_0x175ad4);}});}function setChannelVariables(_0x10dca7){for(var _0x3b0585 in _0x10dca7){if(_0x10dca7[_0x73d6('0x24')](_0x3b0585)){if(_0x3b0585[_0x73d6('0x25')](_0x73d6('0x26'))===0x0){_0x10dca7[_0x3b0585[_0x73d6('0x27')](0x4)]=_0x10dca7[_0x3b0585];delete _0x10dca7[_0x3b0585];}}}}function agiHandler(_0x240d5a){logger[_0x73d6('0x28')](_0x73d6('0x29'),JSON['stringify'](_0x240d5a,null,0x2));logger[_0x73d6('0x1e')](util['format'](_0x73d6('0x2a'),_0x240d5a[_0x73d6('0x18')],_0x240d5a['calleridname'],_0x240d5a[_0x73d6('0x1a')],_0x240d5a[_0x73d6('0x1b')],_0x240d5a[_0x73d6('0x1d')]));_0x240d5a['on'](_0x73d6('0xd'),errorHandler);_0x240d5a['on'](_0x73d6('0x2b'),closeHandler);_0x240d5a['on'](_0x73d6('0x2c'),timeoutHandler);_0x240d5a['evtHangup']=![];_0x240d5a['on'](_0x73d6('0x2d'),hangupHandler);var _0x2db97b=_['find'](projects,[_0x73d6('0x15'),_0x240d5a['arg_1']]);if(!_0x2db97b)return Project[_0x73d6('0x2e')](_0x240d5a);if(!_0x2db97b[_0x73d6('0x2f')])return Project['handleUnpublished'](_0x240d5a);return Project['initialize'](_0x2db97b,_0x240d5a);}function main(){var _0x2fc973;return utilLicense['getLicense']()['then'](function(_0x350dcf){if(!_0x350dcf)return;if(_0x350dcf['voice']){if(_0x350dcf[_0x73d6('0x30')]&&_0x350dcf['callysquare']>0x0){logger['info'](util[_0x73d6('0x12')](_0x73d6('0x31'),_0x350dcf['callysquare']));_0x2fc973=_0x350dcf[_0x73d6('0x30')];}else{logger['info']('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0x73d6('0x1e')](_0x73d6('0x32'));_0x2fc973=-0x1;}})['then'](function(){return Project['getAll']();})[_0x73d6('0x22')](function(_0x279d8c){projects=_0x279d8c;return;})['catch'](function(_0x5853c6){logger[_0x73d6('0xd')](_0x73d6('0x33'),_0x5853c6[_0x73d6('0xe')]);})[_0x73d6('0x34')](function(){var _0x532900=require('./server')(config['agi'][_0x73d6('0x14')],config[_0x73d6('0x5')]['ip'],_0x2fc973);_0x532900['on'](_0x73d6('0xd'),errorHandler);_0x532900['on']('listening',listeningHandler);_0x532900['on'](_0x73d6('0x35'),connectionHandler);_0x532900['on'](_0x73d6('0x2b'),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 6ff45ac..160be7a 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 _0xfa2c=['result','catch','sendMailMessage','SendMail','client','http','request','then','error','message'];(function(_0x16d7fb,_0xaf2ed3){var _0x2e49f7=function(_0x451a81){while(--_0x451a81){_0x16d7fb['push'](_0x16d7fb['shift']());}};_0x2e49f7(++_0xaf2ed3);}(_0xfa2c,0xf4));var _0xcfa2=function(_0x4f3788,_0x50788f){_0x4f3788=_0x4f3788-0x0;var _0x3a4887=_0xfa2c[_0x4f3788];return _0x3a4887;};'use strict';var BPromise=require('bluebird');var jayson=require('jayson/promise');var client=jayson[_0xcfa2('0x0')][_0xcfa2('0x1')]({'port':0x232b});function request(_0x2406d7,_0xb152b9){return new BPromise(function(_0x5d489e,_0x138624){return client[_0xcfa2('0x2')](_0x2406d7,_0xb152b9)[_0xcfa2('0x3')](function(_0x38b3c4){if(_0x38b3c4[_0xcfa2('0x4')]){return _0x138624(_0x38b3c4[_0xcfa2('0x4')][_0xcfa2('0x5')]);}else{return _0x5d489e(_0x38b3c4[_0xcfa2('0x6')]);}})[_0xcfa2('0x7')](function(_0x1ed6b7){return _0x138624(_0x1ed6b7);});});}exports[_0xcfa2('0x8')]=function(_0x31bf8b,_0x11b4b3){return request(_0xcfa2('0x9'),{'account':_0x31bf8b,'message':_0x11b4b3});}; \ No newline at end of file +var _0xd16c=['result','SendMail','bluebird','jayson/promise','client','http','then','error','message'];(function(_0x2fa50,_0x9e3776){var _0x3006e4=function(_0x433e27){while(--_0x433e27){_0x2fa50['push'](_0x2fa50['shift']());}};_0x3006e4(++_0x9e3776);}(_0xd16c,0x122));var _0xcd16=function(_0x117cde,_0x5568ff){_0x117cde=_0x117cde-0x0;var _0x12377b=_0xd16c[_0x117cde];return _0x12377b;};'use strict';var BPromise=require(_0xcd16('0x0'));var jayson=require(_0xcd16('0x1'));var client=jayson[_0xcd16('0x2')][_0xcd16('0x3')]({'port':0x232b});function request(_0x49991f,_0x4b6c37){return new BPromise(function(_0x510946,_0x2f9f27){return client['request'](_0x49991f,_0x4b6c37)[_0xcd16('0x4')](function(_0x2aca9d){if(_0x2aca9d[_0xcd16('0x5')]){return _0x2f9f27(_0x2aca9d['error'][_0xcd16('0x6')]);}else{return _0x510946(_0x2aca9d[_0xcd16('0x7')]);}})['catch'](function(_0x260ff7){return _0x2f9f27(_0x260ff7);});});}exports['sendMailMessage']=function(_0x52b572,_0x6a3598){return request(_0xcd16('0x8'),{'account':_0x52b572,'message':_0x6a3598});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index 2f5e1cc..fb51862 100644 --- a/server/services/agi/project.js +++ b/server/services/agi/project.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2a76=['./rpc','./mailRpc','./graph','./vertices','getSquareProjects','catch','error','stack','agicommand','hasOwnProperty','retry','maxRetry','addVertex','mxCell','isArray','length','source','target','addEdge','mxGraphModel','root','inspect','production','start','stringify','joinAt','format','omit','info','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','dnid','uniqueid','traverseBFS','clear','debug','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','isUndefined','toString','agicommand\x20not\x20found','arg_1','callerid','finally','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20found','close','Project\x20%s\x20not\x20published','lodash','moment','xml2json','../../config/logger','agi'];(function(_0x39f61a,_0x587094){var _0x329de7=function(_0xd1a55b){while(--_0xd1a55b){_0x39f61a['push'](_0x39f61a['shift']());}};_0x329de7(++_0x587094);}(_0x2a76,0x1ad));var _0x62a7=function(_0x1d898a,_0x52454c){_0x1d898a=_0x1d898a-0x0;var _0x2c5dc3=_0x2a76[_0x1d898a];return _0x2c5dc3;};'use strict';var _=require(_0x62a7('0x0'));var moment=require(_0x62a7('0x1'));var parser=require(_0x62a7('0x2'));var util=require('util');var logger=require(_0x62a7('0x3'))(_0x62a7('0x4'));var rpc=require(_0x62a7('0x5'));var mailRpc=require(_0x62a7('0x6'));var Graph=require(_0x62a7('0x7'));var Vertices=require(_0x62a7('0x8'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x62a7('0x9')]()[_0x62a7('0xa')](function(_0x289636){logger[_0x62a7('0xb')]('Unable\x20to\x20download\x20CallySquare\x20projects',_0x289636[_0x62a7('0xc')]);return[];});}function addVertex(_0x1873e4,_0x28e218,_0x4bef07){_0x28e218[_0x62a7('0xd')]=_0x4bef07;if(_0x28e218[_0x62a7('0xe')](_0x62a7('0xf'))){_0x28e218[_0x62a7('0x10')]=parseInt(_0x28e218[_0x62a7('0xf')],0xa);}_0x1873e4[_0x62a7('0x11')](_['omit'](_0x28e218,_0x62a7('0x12')));}function initGraph(_0x581b6e,_0x3eea86){var _0x4cb808=new Graph();for(var _0x6f9a88 in _0x581b6e){if(_0x581b6e[_0x62a7('0xe')](_0x6f9a88)){if(_[_0x62a7('0x13')](_0x581b6e[_0x6f9a88])){for(var _0x59dc2c=0x0;_0x59dc2c<_0x581b6e[_0x6f9a88][_0x62a7('0x14')];_0x59dc2c+=0x1){addVertex(_0x4cb808,_0x581b6e[_0x6f9a88][_0x59dc2c],_0x6f9a88);}}else{addVertex(_0x4cb808,_0x581b6e[_0x6f9a88],_0x6f9a88);}}}for(var _0x184444=0x0;_0x184444<_0x3eea86[_0x62a7('0x14')];_0x184444+=0x1){if(_0x3eea86[_0x184444][_0x62a7('0x15')]&&_0x3eea86[_0x184444][_0x62a7('0x16')]){_0x4cb808[_0x62a7('0x17')](_0x3eea86[_0x184444][_0x62a7('0x15')],_0x3eea86[_0x184444][_0x62a7('0x16')],_0x3eea86[_0x184444]['value']);}}return _0x4cb808;}function getRoot(_0x49be0a){return parser['toJson'](_0x49be0a,{'object':!![]})[_0x62a7('0x18')][_0x62a7('0x19')];}function inspect(_0x4fb89f){return util[_0x62a7('0x1a')](_0x4fb89f,{'showHidden':![],'depth':null});}function initialize(_0x95add9,_0xc238b){var _0x421895=getRoot(_0x95add9[_0x62a7('0x1b')]);if(!_0x421895||!_0x421895[_0x62a7('0x1c')])return;var _0x4ac47f,_0x318aba,_0x3ad5e6;logger['debug']('root',JSON[_0x62a7('0x1d')](_0x421895,null,0x2));_0xc238b[_0x62a7('0x1e')]=moment()[_0x62a7('0x1f')]('YYYY-MM-DD\x20HH:mm:ss');_0x4ac47f=initGraph(_[_0x62a7('0x20')](_0x421895,_0x62a7('0x12')),_0x421895[_0x62a7('0x12')]);_0x318aba=new Vertices(_0xc238b,rpc,mailRpc);logger[_0x62a7('0x21')](util[_0x62a7('0x1f')](_0x62a7('0x22'),_0xc238b['arg_1'],_0xc238b[_0x62a7('0x23')],_0xc238b['callerid'],_0xc238b[_0x62a7('0x24')],_0xc238b[_0x62a7('0x25')]));_0x4ac47f[_0x62a7('0x26')](_0x421895['start']['id'],function(_0x42694d){try{_0x42694d=_0x318aba[_0x62a7('0x27')](_0x42694d);logger[_0x62a7('0x28')](_0x62a7('0x29'),JSON[_0x62a7('0x1d')](_0x42694d,null,0x2));if(_0x42694d[_0x62a7('0xd')]===_0x62a7('0x2a')){logger[_0x62a7('0x21')](_0x62a7('0x2b'));_0xc238b[_0x62a7('0x2c')]=_0x42694d[_0x62a7('0x2c')]||_0xc238b[_0x62a7('0x2c')];_0xc238b[_0x62a7('0x2d')]=_0x42694d['extension'];_0xc238b[_0x62a7('0x2e')]=_0x42694d[_0x62a7('0x2e')]?_0x42694d['priority']-0x1:0x1;return null;}else if(_0x42694d&&_0x318aba[_0x42694d['agicommand']]){_0x3ad5e6=_0x318aba[_0x42694d[_0x62a7('0xd')]](_0x42694d);logger[_0x62a7('0x21')](_0x62a7('0x2f'),JSON['stringify'](_0x3ad5e6,null,0x2));if(_0x3ad5e6&&_0x3ad5e6[_0x62a7('0x30')]===AGI_CODE_SUCCESS&&_0x3ad5e6[_0x62a7('0x31')]!==AGI_RESULT_ERROR&&!_0xc238b['evtHangup']){logger[_0x62a7('0x28')]('response',inspect(_0x3ad5e6));return _[_0x62a7('0x32')](_0x3ad5e6['result'])?null:_0x3ad5e6[_0x62a7('0x31')][_0x62a7('0x33')]();}else{logger[_0x62a7('0xb')](_0x62a7('0x2f'),inspect(_0x3ad5e6));return null;}}else{logger[_0x62a7('0xb')](_0x62a7('0x34'));return null;}}catch(_0x51af57){logger[_0x62a7('0xb')](_0x51af57[_0x62a7('0xc')]);return null;}});if(_0x421895['finally']){logger[_0x62a7('0x21')](util['format']('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0xc238b[_0x62a7('0x35')],_0xc238b[_0x62a7('0x23')],_0xc238b[_0x62a7('0x36')],_0xc238b['dnid'],_0xc238b[_0x62a7('0x25')]));_0x4ac47f[_0x62a7('0x26')](_0x421895[_0x62a7('0x37')]['id'],function(_0x570617){try{_0x570617=_0x318aba[_0x62a7('0x27')](_0x570617);logger['debug'](_0x62a7('0x29'),JSON[_0x62a7('0x1d')](_0x570617,null,0x2));if(_0x570617&&_0x318aba[_0x570617[_0x62a7('0xd')]]){_0x3ad5e6=_0x318aba[_0x570617[_0x62a7('0xd')]](_0x570617);if(_0x3ad5e6){logger[_0x62a7('0x28')](_0x62a7('0x2f'),inspect(_0x3ad5e6));return _[_0x62a7('0x32')](_0x3ad5e6[_0x62a7('0x31')])?null:_0x3ad5e6['result']['toString']();}else{logger['error'](_0x62a7('0x2f'),inspect(_0x3ad5e6));return null;}}else{logger['error'](_0x62a7('0x34'));return null;}}catch(_0x56660f){logger['error'](_0x56660f['stack']);return null;}});}logger['info'](util[_0x62a7('0x1f')](_0x62a7('0x38'),_0xc238b['arg_1'],_0xc238b[_0x62a7('0x23')],_0xc238b[_0x62a7('0x36')],_0xc238b[_0x62a7('0x24')],_0xc238b['uniqueid']));logger['info'](util['format'](_0x62a7('0x39'),_0xc238b[_0x62a7('0x2c')],_0xc238b[_0x62a7('0x2d')],parseInt(_0xc238b[_0x62a7('0x2e')],0xa)+0x1));_0xc238b[_0x62a7('0x3a')](_0xc238b['context'],_0xc238b[_0x62a7('0x2d')],parseInt(_0xc238b['priority'],0xa)+0x1);_0xc238b['close']();}function handleNotFound(_0x139ae3){logger[_0x62a7('0xb')](util[_0x62a7('0x1f')](_0x62a7('0x3b'),_0x139ae3['arg_1']));_0x139ae3[_0x62a7('0x3a')](_0x139ae3[_0x62a7('0x2c')],_0x139ae3[_0x62a7('0x2d')],parseInt(_0x139ae3[_0x62a7('0x2e')],0xa)+0x1);_0x139ae3[_0x62a7('0x3c')]();}function handleUnpublished(_0x386b79){logger[_0x62a7('0xb')](util[_0x62a7('0x1f')](_0x62a7('0x3d'),_0x386b79[_0x62a7('0x35')]));_0x386b79[_0x62a7('0x3a')](_0x386b79[_0x62a7('0x2c')],_0x386b79[_0x62a7('0x2d')],parseInt(_0x386b79[_0x62a7('0x2e')],0xa)+0x1);_0x386b79[_0x62a7('0x3c')]();}module['exports']={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0x222b=['close','Project\x20%s\x20not\x20found','Project\x20%s\x20not\x20published','exports','lodash','xml2json','../../config/logger','./rpc','./graph','./vertices','error','Unable\x20to\x20download\x20CallySquare\x20projects','hasOwnProperty','retry','maxRetry','omit','mxCell','isArray','length','source','target','addEdge','value','toJson','mxGraphModel','root','inspect','production','start','debug','stringify','joinAt','YYYY-MM-DD\x20HH:mm:ss','info','format','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','callerid','dnid','uniqueid','traverseBFS','clear','vertex','agicommand','gotoc','context','extension','priority','response','code','result','evtHangup','isUndefined','agicommand\x20not\x20found','stack','calleridname','finally','toString','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','continueAt'];(function(_0x3a3a69,_0x2fb488){var _0x401b87=function(_0xd760c6){while(--_0xd760c6){_0x3a3a69['push'](_0x3a3a69['shift']());}};_0x401b87(++_0x2fb488);}(_0x222b,0x16c));var _0xb222=function(_0x577077,_0x52f056){_0x577077=_0x577077-0x0;var _0x370769=_0x222b[_0x577077];return _0x370769;};'use strict';var _=require(_0xb222('0x0'));var moment=require('moment');var parser=require(_0xb222('0x1'));var util=require('util');var logger=require(_0xb222('0x2'))('agi');var rpc=require(_0xb222('0x3'));var mailRpc=require('./mailRpc');var Graph=require(_0xb222('0x4'));var Vertices=require(_0xb222('0x5'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc['getSquareProjects']()['catch'](function(_0xee5c24){logger[_0xb222('0x6')](_0xb222('0x7'),_0xee5c24['stack']);return[];});}function addVertex(_0x258e87,_0x38636f,_0x4b8982){_0x38636f['agicommand']=_0x4b8982;if(_0x38636f[_0xb222('0x8')](_0xb222('0x9'))){_0x38636f[_0xb222('0xa')]=parseInt(_0x38636f['retry'],0xa);}_0x258e87['addVertex'](_[_0xb222('0xb')](_0x38636f,_0xb222('0xc')));}function initGraph(_0x91d73c,_0x55a808){var _0x1affc7=new Graph();for(var _0x19f36a in _0x91d73c){if(_0x91d73c[_0xb222('0x8')](_0x19f36a)){if(_[_0xb222('0xd')](_0x91d73c[_0x19f36a])){for(var _0xf7350=0x0;_0xf7350<_0x91d73c[_0x19f36a][_0xb222('0xe')];_0xf7350+=0x1){addVertex(_0x1affc7,_0x91d73c[_0x19f36a][_0xf7350],_0x19f36a);}}else{addVertex(_0x1affc7,_0x91d73c[_0x19f36a],_0x19f36a);}}}for(var _0x302c93=0x0;_0x302c93<_0x55a808[_0xb222('0xe')];_0x302c93+=0x1){if(_0x55a808[_0x302c93][_0xb222('0xf')]&&_0x55a808[_0x302c93][_0xb222('0x10')]){_0x1affc7[_0xb222('0x11')](_0x55a808[_0x302c93][_0xb222('0xf')],_0x55a808[_0x302c93][_0xb222('0x10')],_0x55a808[_0x302c93][_0xb222('0x12')]);}}return _0x1affc7;}function getRoot(_0x5525a5){return parser[_0xb222('0x13')](_0x5525a5,{'object':!![]})[_0xb222('0x14')][_0xb222('0x15')];}function inspect(_0x2f793f){return util[_0xb222('0x16')](_0x2f793f,{'showHidden':![],'depth':null});}function initialize(_0x378bd7,_0x206d4b){var _0x25bd11=getRoot(_0x378bd7[_0xb222('0x17')]);if(!_0x25bd11||!_0x25bd11[_0xb222('0x18')])return;var _0x159b7e,_0x5b5b0c,_0x3a0d3c;logger[_0xb222('0x19')](_0xb222('0x15'),JSON[_0xb222('0x1a')](_0x25bd11,null,0x2));_0x206d4b[_0xb222('0x1b')]=moment()['format'](_0xb222('0x1c'));_0x159b7e=initGraph(_['omit'](_0x25bd11,_0xb222('0xc')),_0x25bd11[_0xb222('0xc')]);_0x5b5b0c=new Vertices(_0x206d4b,rpc,mailRpc);logger[_0xb222('0x1d')](util[_0xb222('0x1e')](_0xb222('0x1f'),_0x206d4b[_0xb222('0x20')],_0x206d4b['calleridname'],_0x206d4b[_0xb222('0x21')],_0x206d4b[_0xb222('0x22')],_0x206d4b[_0xb222('0x23')]));_0x159b7e[_0xb222('0x24')](_0x25bd11[_0xb222('0x18')]['id'],function(_0x141dd6){try{_0x141dd6=_0x5b5b0c[_0xb222('0x25')](_0x141dd6);logger[_0xb222('0x19')](_0xb222('0x26'),JSON[_0xb222('0x1a')](_0x141dd6,null,0x2));if(_0x141dd6[_0xb222('0x27')]===_0xb222('0x28')){logger['info']('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x206d4b[_0xb222('0x29')]=_0x141dd6[_0xb222('0x29')]||_0x206d4b[_0xb222('0x29')];_0x206d4b[_0xb222('0x2a')]=_0x141dd6[_0xb222('0x2a')];_0x206d4b[_0xb222('0x2b')]=_0x141dd6['priority']?_0x141dd6['priority']-0x1:0x1;return null;}else if(_0x141dd6&&_0x5b5b0c[_0x141dd6[_0xb222('0x27')]]){_0x3a0d3c=_0x5b5b0c[_0x141dd6[_0xb222('0x27')]](_0x141dd6);logger[_0xb222('0x1d')](_0xb222('0x2c'),JSON[_0xb222('0x1a')](_0x3a0d3c,null,0x2));if(_0x3a0d3c&&_0x3a0d3c[_0xb222('0x2d')]===AGI_CODE_SUCCESS&&_0x3a0d3c[_0xb222('0x2e')]!==AGI_RESULT_ERROR&&!_0x206d4b[_0xb222('0x2f')]){logger['debug'](_0xb222('0x2c'),inspect(_0x3a0d3c));return _[_0xb222('0x30')](_0x3a0d3c[_0xb222('0x2e')])?null:_0x3a0d3c[_0xb222('0x2e')]['toString']();}else{logger[_0xb222('0x6')](_0xb222('0x2c'),inspect(_0x3a0d3c));return null;}}else{logger[_0xb222('0x6')](_0xb222('0x31'));return null;}}catch(_0x330ee3){logger['error'](_0x330ee3[_0xb222('0x32')]);return null;}});if(_0x25bd11['finally']){logger[_0xb222('0x1d')](util[_0xb222('0x1e')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x206d4b[_0xb222('0x20')],_0x206d4b[_0xb222('0x33')],_0x206d4b['callerid'],_0x206d4b['dnid'],_0x206d4b['uniqueid']));_0x159b7e[_0xb222('0x24')](_0x25bd11[_0xb222('0x34')]['id'],function(_0x1d211a){try{_0x1d211a=_0x5b5b0c[_0xb222('0x25')](_0x1d211a);logger[_0xb222('0x19')]('vertex',JSON[_0xb222('0x1a')](_0x1d211a,null,0x2));if(_0x1d211a&&_0x5b5b0c[_0x1d211a[_0xb222('0x27')]]){_0x3a0d3c=_0x5b5b0c[_0x1d211a[_0xb222('0x27')]](_0x1d211a);if(_0x3a0d3c){logger[_0xb222('0x19')](_0xb222('0x2c'),inspect(_0x3a0d3c));return _['isUndefined'](_0x3a0d3c[_0xb222('0x2e')])?null:_0x3a0d3c[_0xb222('0x2e')][_0xb222('0x35')]();}else{logger[_0xb222('0x6')](_0xb222('0x2c'),inspect(_0x3a0d3c));return null;}}else{logger[_0xb222('0x6')]('agicommand\x20not\x20found');return null;}}catch(_0x46369d){logger[_0xb222('0x6')](_0x46369d[_0xb222('0x32')]);return null;}});}logger[_0xb222('0x1d')](util[_0xb222('0x1e')](_0xb222('0x36'),_0x206d4b[_0xb222('0x20')],_0x206d4b[_0xb222('0x33')],_0x206d4b[_0xb222('0x21')],_0x206d4b[_0xb222('0x22')],_0x206d4b[_0xb222('0x23')]));logger[_0xb222('0x1d')](util['format']('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x206d4b['context'],_0x206d4b[_0xb222('0x2a')],parseInt(_0x206d4b[_0xb222('0x2b')],0xa)+0x1));_0x206d4b[_0xb222('0x37')](_0x206d4b['context'],_0x206d4b[_0xb222('0x2a')],parseInt(_0x206d4b['priority'],0xa)+0x1);_0x206d4b[_0xb222('0x38')]();}function handleNotFound(_0x259205){logger['error'](util['format'](_0xb222('0x39'),_0x259205[_0xb222('0x20')]));_0x259205[_0xb222('0x37')](_0x259205['context'],_0x259205[_0xb222('0x2a')],parseInt(_0x259205[_0xb222('0x2b')],0xa)+0x1);_0x259205[_0xb222('0x38')]();}function handleUnpublished(_0x5b5123){logger[_0xb222('0x6')](util[_0xb222('0x1e')](_0xb222('0x3a'),_0x5b5123[_0xb222('0x20')]));_0x5b5123[_0xb222('0x37')](_0x5b5123['context'],_0x5b5123[_0xb222('0x2a')],parseInt(_0x5b5123[_0xb222('0x2b')],0xa)+0x1);_0x5b5123[_0xb222('0x38')]();}module[_0xb222('0x3b')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 96578e8..ee64571 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 _0x92f0=['split','slice','trim','length','emit','headers','exports','util','stream','call','_localBuffer','_inBody','prototype','\x0d\x0a\x0d\x0a','toString','indexOf','substring'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x92f0,0xa0));var _0x092f=function(_0x272d97,_0x3cb745){_0x272d97=_0x272d97-0x0;var _0x40fc01=_0x92f0[_0x272d97];return _0x40fc01;};'use strict';var util=require(_0x092f('0x0'));var Transform=require(_0x092f('0x1'))['Transform'];function AGIReply(_0x26ff0b){Transform[_0x092f('0x2')](this,_0x26ff0b);this[_0x092f('0x3')]='';this[_0x092f('0x4')]=![];}util['inherits'](AGIReply,Transform);AGIReply[_0x092f('0x5')]['_transform']=function(_0x56a123,_0x2ae463,_0x181a89){var _0x39e68d='\x0a',_0x581903=['\x0a\x0a',_0x092f('0x6')],_0x12d404=-0x1,_0x4ba224=-0x1,_0x2439c7='',_0x84359e=0x0,_0x143e3b='',_0x2a745c='';this[_0x092f('0x3')]+=_0x56a123[_0x092f('0x7')]();_0x143e3b=this[_0x092f('0x3')];if(!this[_0x092f('0x4')]){_0x84359e=0x0;while(_0x581903[_0x84359e]){while((_0x4ba224=_0x143e3b[_0x092f('0x8')](_0x581903[_0x84359e]))!=-0x1){_0x2439c7=_0x581903[_0x84359e];_0x2a745c=_0x143e3b[_0x092f('0x9')](0x0,_0x4ba224);_0x143e3b=_0x143e3b[_0x092f('0x9')](_0x4ba224+_0x2439c7['length']);var _0x369fd0=_0x2a745c[_0x092f('0xa')](_0x39e68d),_0x1c4395=0x0,_0x53303d={},_0x15aaa2='',_0x1e0709='',_0x27e022=-0x1;while(_0x369fd0[_0x1c4395]){_0x27e022=_0x369fd0[_0x1c4395][_0x092f('0x8')](':');if(_0x27e022!=-0x1){_0x15aaa2=_0x369fd0[_0x1c4395][_0x092f('0xb')](0x0,_0x27e022)[_0x092f('0xc')]();_0x1e0709=_0x369fd0[_0x1c4395][_0x092f('0xb')](_0x27e022+0x1)[_0x092f('0xc')]();if(_0x15aaa2[_0x092f('0xd')]>0x0){_0x53303d[_0x15aaa2]=_0x1e0709;}}else{}_0x1c4395++;}this[_0x092f('0xe')](_0x092f('0xf'),_0x53303d);this[_0x092f('0x4')]=!![];}_0x84359e++;}this[_0x092f('0x3')]=_0x143e3b;}else{while((_0x12d404=_0x143e3b[_0x092f('0x8')](_0x39e68d))!=-0x1){_0x2a745c=_0x143e3b['substring'](0x0,_0x12d404);this['emit']('line',_0x2a745c);_0x143e3b=_0x143e3b[_0x092f('0x9')](_0x12d404+_0x39e68d[_0x092f('0xd')]);}this[_0x092f('0x3')]=_0x143e3b;}_0x181a89();};module[_0x092f('0x10')]=AGIReply; \ No newline at end of file +var _0x380b=['substring','slice','trim','length','headers','emit','exports','util','Transform','call','_localBuffer','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','toString','_inBody','indexOf'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x380b,0xdf));var _0xb380=function(_0x161248,_0x574e6b){_0x161248=_0x161248-0x0;var _0x1f5adb=_0x380b[_0x161248];return _0x1f5adb;};'use strict';var util=require(_0xb380('0x0'));var Transform=require('stream')[_0xb380('0x1')];function AGIReply(_0x130ad4){Transform[_0xb380('0x2')](this,_0x130ad4);this[_0xb380('0x3')]='';this['_inBody']=![];}util[_0xb380('0x4')](AGIReply,Transform);AGIReply[_0xb380('0x5')][_0xb380('0x6')]=function(_0x8ed5a1,_0x2fc8e3,_0x41464d){var _0x23e0b4='\x0a',_0xee5647=['\x0a\x0a',_0xb380('0x7')],_0x4b5daa=-0x1,_0x57cdb5=-0x1,_0x4c4b52='',_0x40d1c8=0x0,_0x266cb3='',_0x4ff57a='';this[_0xb380('0x3')]+=_0x8ed5a1[_0xb380('0x8')]();_0x266cb3=this[_0xb380('0x3')];if(!this[_0xb380('0x9')]){_0x40d1c8=0x0;while(_0xee5647[_0x40d1c8]){while((_0x57cdb5=_0x266cb3[_0xb380('0xa')](_0xee5647[_0x40d1c8]))!=-0x1){_0x4c4b52=_0xee5647[_0x40d1c8];_0x4ff57a=_0x266cb3[_0xb380('0xb')](0x0,_0x57cdb5);_0x266cb3=_0x266cb3[_0xb380('0xb')](_0x57cdb5+_0x4c4b52['length']);var _0x238c48=_0x4ff57a['split'](_0x23e0b4),_0x481069=0x0,_0x1c338b={},_0x571ae5='',_0x11f246='',_0x582c79=-0x1;while(_0x238c48[_0x481069]){_0x582c79=_0x238c48[_0x481069][_0xb380('0xa')](':');if(_0x582c79!=-0x1){_0x571ae5=_0x238c48[_0x481069][_0xb380('0xc')](0x0,_0x582c79)[_0xb380('0xd')]();_0x11f246=_0x238c48[_0x481069][_0xb380('0xc')](_0x582c79+0x1)[_0xb380('0xd')]();if(_0x571ae5[_0xb380('0xe')]>0x0){_0x1c338b[_0x571ae5]=_0x11f246;}}else{}_0x481069++;}this['emit'](_0xb380('0xf'),_0x1c338b);this[_0xb380('0x9')]=!![];}_0x40d1c8++;}this['_localBuffer']=_0x266cb3;}else{while((_0x4b5daa=_0x266cb3[_0xb380('0xa')](_0x23e0b4))!=-0x1){_0x4ff57a=_0x266cb3[_0xb380('0xb')](0x0,_0x4b5daa);this[_0xb380('0x10')]('line',_0x4ff57a);_0x266cb3=_0x266cb3['substring'](_0x4b5daa+_0x23e0b4[_0xb380('0xe')]);}this[_0xb380('0x3')]=_0x266cb3;}_0x41464d();};module[_0xb380('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 fee9b7f..75bd9df 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 _0x7ae7=['getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','getSquareOdbcById','ShowSquareOdbc','getUserById','ShowUser','getContactByPhone','GetContactByPhone','phone','getTrunkById','ShowTrunk','getSoundById','save_name','ShowInterval','Interval','Intervals','getSmsAccountById','CreateSmsMessage','CreateSquareDetailsReport','createSquareReport','merge','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','CreateSquareRecording','createSquareMessage','createCmContact','ShowCmHopper','ListId','CreateCmContact','getPauseById','ShowPause','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','lodash','moment','client','http','request','then','error','message','result','getSquareProjects','GetSquareProjects','name','production','getSquareProject','ShowSquareProject','ShowMailAccount','MailServerOut','CloudProvider','email'];(function(_0x556927,_0x34b53f){var _0x5f1235=function(_0x4f4e44){while(--_0x4f4e44){_0x556927['push'](_0x556927['shift']());}};_0x5f1235(++_0x34b53f);}(_0x7ae7,0xd9));var _0x77ae=function(_0x4f560a,_0x4fa8ec){_0x4f560a=_0x4f560a-0x0;var _0x449bba=_0x7ae7[_0x4f560a];return _0x449bba;};'use strict';var _=require(_0x77ae('0x0'));var moment=require(_0x77ae('0x1'));var jayson=require('jayson/promise');var client=jayson[_0x77ae('0x2')][_0x77ae('0x3')]({'port':0x2329});function request(_0x176048,_0xf7c23c){return new Promise(function(_0xa7b0de,_0x897790){return client[_0x77ae('0x4')](_0x176048,_0xf7c23c)[_0x77ae('0x5')](function(_0x167164){if(_0x167164[_0x77ae('0x6')]){return _0x897790(_0x167164[_0x77ae('0x6')][_0x77ae('0x7')]);}else{return _0xa7b0de(_0x167164[_0x77ae('0x8')]);}})['catch'](function(_0x131f0b){return _0x897790(_0x131f0b);});});}exports[_0x77ae('0x9')]=function(){return request(_0x77ae('0xa'),{'options':{'raw':![],'attributes':['id',_0x77ae('0xb'),_0x77ae('0xc')]}});};exports[_0x77ae('0xd')]=function(_0x518cac){return request(_0x77ae('0xe'),{'options':{'raw':![],'where':{'name':_0x518cac},'attributes':['production']}});};exports['getMailAccountById']=function(_0xe07c97){return request(_0x77ae('0xf'),{'options':{'raw':![],'where':{'id':_0xe07c97},'include':[{'model':_0x77ae('0x10'),'as':'Smtp','include':[{'model':_0x77ae('0x11'),'as':_0x77ae('0x11')}]}],'attributes':['id','name',_0x77ae('0x12')],'smtp':!![]}});};exports[_0x77ae('0x13')]=function(_0x7beeee){return request('ShowSquareProject',{'options':{'where':{'id':_0x7beeee},'attributes':['name']}});};exports[_0x77ae('0x14')]=function(_0x5b799f){return request(_0x77ae('0x15'),{'options':{'where':{'id':_0x5b799f},'attributes':[_0x77ae('0xb')]}});};exports[_0x77ae('0x16')]=function(_0x1ebba2){return request('ShowVariable',{'options':{'where':{'id':_0x1ebba2},'attributes':['name']}});};exports[_0x77ae('0x17')]=function(_0x383973){return request(_0x77ae('0x18'),{'options':{'where':{'id':_0x383973},'attributes':['dsn']}});};exports[_0x77ae('0x19')]=function(_0x991c5c){return request(_0x77ae('0x1a'),{'options':{'where':{'id':_0x991c5c},'attributes':[_0x77ae('0xb')]}});};exports[_0x77ae('0x1b')]=function(_0x5e4f9c){return request(_0x77ae('0x1c'),{'options':{'where':{'phone':_0x5e4f9c[_0x77ae('0x1d')]},'attributes':['id']}});};exports[_0x77ae('0x1e')]=function(_0x1da8ca){return request(_0x77ae('0x1f'),{'options':{'where':{'id':_0x1da8ca},'attributes':[_0x77ae('0xb')]}});};exports[_0x77ae('0x20')]=function(_0x4e06d4){return request('ShowSound',{'options':{'where':{'id':_0x4e06d4},'attributes':[_0x77ae('0x21')]}});};exports['getIntervalById']=function(_0x132e9a){return request(_0x77ae('0x22'),{'options':{'raw':![],'where':{'id':_0x132e9a},'include':[{'model':_0x77ae('0x23'),'as':_0x77ae('0x24')}]}});};exports[_0x77ae('0x25')]=function(_0xe0c6ea){return request('ShowSmsAccount',{'options':{'where':{'id':_0xe0c6ea},'attributes':['id','name']}});};exports['createSmsMessage']=function(_0x15c185){return request(_0x77ae('0x26'),{'body':_0x15c185});};exports['createSquareDetailsReport']=function(_0x4c06df){return request(_0x77ae('0x27'),{'body':_0x4c06df});};exports[_0x77ae('0x28')]=function(_0x34644e){return request('CreateSquareReport',{'body':_[_0x77ae('0x29')](_0x34644e,{'project_name':_0x34644e['arg_1'],'prev_project_name':_0x34644e[_0x77ae('0x2a')]||'','is_subproject':_0x34644e[_0x77ae('0x2a')]?!![]:![],'leaveAt':moment()[_0x77ae('0x2b')](_0x77ae('0x2c'))})});};exports['createSquareRecording']=function(_0x516b13){return request(_0x77ae('0x2d'),{'body':_0x516b13});};exports[_0x77ae('0x2e')]=function(_0x28fbc5){return request('CreateSquareMessage',{'body':_0x28fbc5});};exports[_0x77ae('0x2f')]=function(_0x4d2d9a){return request(_0x77ae('0x30'),{'options':{'raw':![],'where':{'phone':_0x4d2d9a['phone'],'ListId':_0x4d2d9a[_0x77ae('0x31')]}}})['then'](function(_0x1fafbd){if(_0x1fafbd){return _0x1fafbd;}return request(_0x77ae('0x32'),{'body':_0x4d2d9a});});};exports[_0x77ae('0x33')]=function(_0x560bad){return request(_0x77ae('0x34'),{'options':{'where':{'id':_0x560bad},'attributes':[_0x77ae('0xb')]}});};exports['agentLogin']=function(_0x18ce9d,_0x1f85f9){return request('LoginUser',{'body':{'interface':_0x1f85f9},'options':{'where':_0x18ce9d}});};exports[_0x77ae('0x35')]=function(_0x199c20,_0x4c013d,_0x3198ee){return request(_0x77ae('0x36'),{'body':{'type':_0x4c013d,'uniqueid':_0x3198ee},'options':{'where':_0x199c20}});};exports[_0x77ae('0x37')]=function(_0x233b78){return request(_0x77ae('0x38'),{'body':{},'options':{'where':_0x233b78}});};exports[_0x77ae('0x39')]=function(_0x34f096){return request(_0x77ae('0x3a'),{'body':{},'options':{'where':_0x34f096}});}; \ No newline at end of file +var _0x7333=['merge','arg_1','arg_2','YYYY-MM-DD\x20HH:mm:ss','CreateSquareRecording','createSquareMessage','createCmContact','ShowCmHopper','ListId','getPauseById','ShowPause','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','lodash','jayson/promise','http','request','then','error','message','result','GetSquareProjects','name','production','getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','CloudProvider','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','getSquareOdbcById','ShowSquareOdbc','getUserById','ShowUser','GetContactByPhone','phone','getTrunkById','ShowTrunk','getSoundById','save_name','getIntervalById','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','CreateSquareDetailsReport','createSquareReport','CreateSquareReport'];(function(_0x567cd2,_0x54c2e5){var _0x37f964=function(_0x504858){while(--_0x504858){_0x567cd2['push'](_0x567cd2['shift']());}};_0x37f964(++_0x54c2e5);}(_0x7333,0xfc));var _0x3733=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7333[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x3733('0x0'));var moment=require('moment');var jayson=require(_0x3733('0x1'));var client=jayson['client'][_0x3733('0x2')]({'port':0x2329});function request(_0x146076,_0x1c96f5){return new Promise(function(_0x4ad96b,_0x1bf202){return client[_0x3733('0x3')](_0x146076,_0x1c96f5)[_0x3733('0x4')](function(_0x4953d1){if(_0x4953d1[_0x3733('0x5')]){return _0x1bf202(_0x4953d1[_0x3733('0x5')][_0x3733('0x6')]);}else{return _0x4ad96b(_0x4953d1[_0x3733('0x7')]);}})['catch'](function(_0x1ee542){return _0x1bf202(_0x1ee542);});});}exports['getSquareProjects']=function(){return request(_0x3733('0x8'),{'options':{'raw':![],'attributes':['id',_0x3733('0x9'),_0x3733('0xa')]}});};exports[_0x3733('0xb')]=function(_0x4c083f){return request(_0x3733('0xc'),{'options':{'raw':![],'where':{'name':_0x4c083f},'attributes':['production']}});};exports[_0x3733('0xd')]=function(_0xfff519){return request(_0x3733('0xe'),{'options':{'raw':![],'where':{'id':_0xfff519},'include':[{'model':_0x3733('0xf'),'as':_0x3733('0x10'),'include':[{'model':_0x3733('0x11'),'as':_0x3733('0x11')}]}],'attributes':['id',_0x3733('0x9'),_0x3733('0x12')],'smtp':!![]}});};exports[_0x3733('0x13')]=function(_0x553110){return request('ShowSquareProject',{'options':{'where':{'id':_0x553110},'attributes':['name']}});};exports[_0x3733('0x14')]=function(_0x2de05f){return request(_0x3733('0x15'),{'options':{'where':{'id':_0x2de05f},'attributes':[_0x3733('0x9')]}});};exports[_0x3733('0x16')]=function(_0x46a03e){return request('ShowVariable',{'options':{'where':{'id':_0x46a03e},'attributes':[_0x3733('0x9')]}});};exports[_0x3733('0x17')]=function(_0x42e87f){return request(_0x3733('0x18'),{'options':{'where':{'id':_0x42e87f},'attributes':['dsn']}});};exports[_0x3733('0x19')]=function(_0x79ae75){return request(_0x3733('0x1a'),{'options':{'where':{'id':_0x79ae75},'attributes':[_0x3733('0x9')]}});};exports['getContactByPhone']=function(_0x24a91e){return request(_0x3733('0x1b'),{'options':{'where':{'phone':_0x24a91e[_0x3733('0x1c')]},'attributes':['id']}});};exports[_0x3733('0x1d')]=function(_0x981f37){return request(_0x3733('0x1e'),{'options':{'where':{'id':_0x981f37},'attributes':[_0x3733('0x9')]}});};exports[_0x3733('0x1f')]=function(_0x3ad371){return request('ShowSound',{'options':{'where':{'id':_0x3ad371},'attributes':[_0x3733('0x20')]}});};exports[_0x3733('0x21')]=function(_0x168fb5){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x168fb5},'include':[{'model':_0x3733('0x22'),'as':_0x3733('0x23')}]}});};exports[_0x3733('0x24')]=function(_0xab24eb){return request(_0x3733('0x25'),{'options':{'where':{'id':_0xab24eb},'attributes':['id',_0x3733('0x9')]}});};exports[_0x3733('0x26')]=function(_0x48826c){return request(_0x3733('0x27'),{'body':_0x48826c});};exports['createSquareDetailsReport']=function(_0x2d5e10){return request(_0x3733('0x28'),{'body':_0x2d5e10});};exports[_0x3733('0x29')]=function(_0x44a95d){return request(_0x3733('0x2a'),{'body':_[_0x3733('0x2b')](_0x44a95d,{'project_name':_0x44a95d[_0x3733('0x2c')],'prev_project_name':_0x44a95d[_0x3733('0x2d')]||'','is_subproject':_0x44a95d[_0x3733('0x2d')]?!![]:![],'leaveAt':moment()['format'](_0x3733('0x2e'))})});};exports['createSquareRecording']=function(_0x512a98){return request(_0x3733('0x2f'),{'body':_0x512a98});};exports[_0x3733('0x30')]=function(_0x466ef9){return request('CreateSquareMessage',{'body':_0x466ef9});};exports[_0x3733('0x31')]=function(_0x375dc2){return request(_0x3733('0x32'),{'options':{'raw':![],'where':{'phone':_0x375dc2[_0x3733('0x1c')],'ListId':_0x375dc2[_0x3733('0x33')]}}})[_0x3733('0x4')](function(_0x2fc431){if(_0x2fc431){return _0x2fc431;}return request('CreateCmContact',{'body':_0x375dc2});});};exports[_0x3733('0x34')]=function(_0x15cf54){return request(_0x3733('0x35'),{'options':{'where':{'id':_0x15cf54},'attributes':[_0x3733('0x9')]}});};exports['agentLogin']=function(_0x5ce0e6,_0x2fef61){return request('LoginUser',{'body':{'interface':_0x2fef61},'options':{'where':_0x5ce0e6}});};exports[_0x3733('0x36')]=function(_0x4b0fe8,_0x10ac22,_0x2675fc){return request(_0x3733('0x37'),{'body':{'type':_0x10ac22,'uniqueid':_0x2675fc},'options':{'where':_0x4b0fe8}});};exports[_0x3733('0x38')]=function(_0x3813a9){return request(_0x3733('0x39'),{'body':{},'options':{'where':_0x3813a9}});};exports[_0x3733('0x3a')]=function(_0x313d5b){return request('LogoutUser',{'body':{},'options':{'where':_0x313d5b}});}; \ 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 65fd9dc..245ee2b 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 _0xa1f6=['./lex','exports','./polly'];(function(_0xa9eaa0,_0x4ba2b4){var _0x30897a=function(_0x2caa01){while(--_0x2caa01){_0xa9eaa0['push'](_0xa9eaa0['shift']());}};_0x30897a(++_0x4ba2b4);}(_0xa1f6,0x19d));var _0x6a1f=function(_0x2bbc07,_0x1e2168){_0x2bbc07=_0x2bbc07-0x0;var _0x6879e4=_0xa1f6[_0x2bbc07];return _0x6879e4;};var polly=require(_0x6a1f('0x0'));var lex=require(_0x6a1f('0x1'));module[_0x6a1f('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0xad78=['./polly'];(function(_0x5070fe,_0x590da0){var _0x2981db=function(_0x2ef55f){while(--_0x2ef55f){_0x5070fe['push'](_0x5070fe['shift']());}};_0x2981db(++_0x590da0);}(_0xad78,0x149));var _0x8ad7=function(_0x380544,_0x480e56){_0x380544=_0x380544-0x0;var _0x20e47a=_0xad78[_0x380544];return _0x20e47a;};var polly=require(_0x8ad7('0x0'));var lex=require('./lex');module['exports']={'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 b775377..194f4e5 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 _0xd64b=['./lib/api'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd64b,0xc1));var _0xbd64=function(_0x58fcda,_0x1c3d13){_0x58fcda=_0x58fcda-0x0;var _0x8e4b88=_0xd64b[_0x58fcda];return _0x8e4b88;};'use strict';var lex=require(_0xbd64('0x0'));module['exports']=function(_0xf0de04,_0x4bfb7c,_0x30b9b3,_0xcbecd5,_0x64bd3b,_0x3f1f05){return lex(_0xf0de04,_0x4bfb7c,_0x30b9b3,_0xcbecd5,_0x64bd3b,_0x3f1f05);}; \ No newline at end of file +var _0xb688=['exports'];(function(_0x25ed8b,_0x28d599){var _0x1ad09c=function(_0x69354e){while(--_0x69354e){_0x25ed8b['push'](_0x25ed8b['shift']());}};_0x1ad09c(++_0x28d599);}(_0xb688,0xcf));var _0x8b68=function(_0x13884d,_0x35c80f){_0x13884d=_0x13884d-0x0;var _0x35c464=_0xb688[_0x13884d];return _0x35c464;};'use strict';var lex=require('./lib/api');module[_0x8b68('0x0')]=function(_0x196cec,_0x266285,_0x1080e8,_0x23bbaa,_0x446b17,_0x4e281c){return lex(_0x196cec,_0x266285,_0x1080e8,_0x23bbaa,_0x446b17,_0x4e281c);}; \ 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 3421ab5..a0841da 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(_0x58b697,_0x3130c0){var _0x5a4e90=function(_0x4384ad){while(--_0x4384ad){_0x58b697['push'](_0x58b697['shift']());}};_0x5a4e90(++_0x3130c0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'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(_0x205198,_0x5dbf4b){var _0x2bc8c8=function(_0x684b7c){while(--_0x684b7c){_0x205198['push'](_0x205198['shift']());}};_0x2bc8c8(++_0x5dbf4b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'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 979b26e..2b0bf20 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 _0xb2c1=['./lib/api'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xb2c1,0x176));var _0x1b2c=function(_0x37026d,_0x402bf4){_0x37026d=_0x37026d-0x0;var _0x5b1ff2=_0xb2c1[_0x37026d];return _0x5b1ff2;};'use strict';var polly=require(_0x1b2c('0x0'));module['exports']=function(_0x3fb581,_0x3c304b,_0x2d8e44,_0x114917,_0x9ff6aa,_0x396def,_0x1e3566){return polly(_0x3fb581,_0x3c304b,_0x2d8e44,_0x114917,_0x9ff6aa,_0x396def,_0x1e3566);}; \ No newline at end of file +var _0x4413=['exports','./lib/api'];(function(_0x1ca4fc,_0x292296){var _0x159709=function(_0x508a24){while(--_0x508a24){_0x1ca4fc['push'](_0x1ca4fc['shift']());}};_0x159709(++_0x292296);}(_0x4413,0xc3));var _0x3441=function(_0xd11496,_0x4e51c6){_0xd11496=_0xd11496-0x0;var _0x57a2ea=_0x4413[_0xd11496];return _0x57a2ea;};'use strict';var polly=require(_0x3441('0x0'));module[_0x3441('0x1')]=function(_0x438308,_0x22566c,_0x250bc1,_0x594cb4,_0x3ef7ab,_0x1a04be,_0x1e9e65){return polly(_0x438308,_0x22566c,_0x250bc1,_0x594cb4,_0x3ef7ab,_0x1a04be,_0x1e9e65);}; \ 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 a65a6f1..939f9d4 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 _0x4e5d=['No\x20data\x20response\x20from\x20aws\x20Polly!','mp3','path','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!'];(function(_0x284240,_0x555b56){var _0x390667=function(_0x409454){while(--_0x409454){_0x284240['push'](_0x284240['shift']());}};_0x390667(++_0x555b56);}(_0x4e5d,0x7a));var _0xd4e5=function(_0x101237,_0x448f24){_0x101237=_0x101237-0x0;var _0x50ede4=_0x4e5d[_0x101237];return _0x50ede4;};'use strict';var fs=require('fs');var path=require(_0xd4e5('0x0'));var BPromise=require(_0xd4e5('0x1'));var rs=require(_0xd4e5('0x2'));var AWS=require(_0xd4e5('0x3'));function pollyResult(_0x2d209e,_0x5bb8a1,_0x4fdc6b){return new BPromise(function(_0x9c1bfd,_0x362357){_0x2d209e[_0xd4e5('0x4')](_0x5bb8a1,function(_0x24217a,_0x39d7bf){if(_0x24217a){_0x362357(_0x24217a);}else if(_0x39d7bf){if(_0x39d7bf[_0xd4e5('0x5')]instanceof Buffer){fs[_0xd4e5('0x6')](_0x4fdc6b,_0x39d7bf[_0xd4e5('0x5')],function(_0x331b2d){if(_0x331b2d){_0x362357(_0x331b2d);}else{_0x9c1bfd();}});}else{_0x362357(new Error(_0xd4e5('0x7')));}}else{_0x362357(new Error(_0xd4e5('0x8')));}});});}module['exports']=function(_0x416d2d,_0x4ea437,_0x2cc1cb,_0x2f2032,_0x1e5c2c,_0x2b5dc1,_0x5a3e93){var _0x83b233=new AWS['Polly']({'accessKeyId':_0x416d2d,'secretAccessKey':_0x4ea437,'region':_0x2cc1cb});var _0x14ad96={'Text':_0x1e5c2c,'TextType':_0x2b5dc1||'text','OutputFormat':_0xd4e5('0x9'),'VoiceId':_0x2f2032};return pollyResult(_0x83b233,_0x14ad96,_0x5a3e93);}; \ No newline at end of file +var _0xbcc3=['aws-sdk','synthesizeSpeech','AudioStream','writeFile','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','mp3','randomstring'];(function(_0x5317b5,_0x4dfd6e){var _0x3b7ce2=function(_0xc146d6){while(--_0xc146d6){_0x5317b5['push'](_0x5317b5['shift']());}};_0x3b7ce2(++_0x4dfd6e);}(_0xbcc3,0xfb));var _0x3bcc=function(_0x5355b3,_0x2f1e18){_0x5355b3=_0x5355b3-0x0;var _0x1dbf46=_0xbcc3[_0x5355b3];return _0x1dbf46;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require('bluebird');var rs=require(_0x3bcc('0x0'));var AWS=require(_0x3bcc('0x1'));function pollyResult(_0x1d32cd,_0x43ae9e,_0x4bf621){return new BPromise(function(_0x19554c,_0x390785){_0x1d32cd[_0x3bcc('0x2')](_0x43ae9e,function(_0x3d8907,_0x30958f){if(_0x3d8907){_0x390785(_0x3d8907);}else if(_0x30958f){if(_0x30958f[_0x3bcc('0x3')]instanceof Buffer){fs[_0x3bcc('0x4')](_0x4bf621,_0x30958f[_0x3bcc('0x3')],function(_0x3f62cb){if(_0x3f62cb){_0x390785(_0x3f62cb);}else{_0x19554c();}});}else{_0x390785(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x390785(new Error(_0x3bcc('0x5')));}});});}module[_0x3bcc('0x6')]=function(_0x14f25e,_0xde2ae8,_0xa96d66,_0x1b5219,_0xf3874e,_0x351d60,_0x21e217){var _0xd4fc72=new AWS[(_0x3bcc('0x7'))]({'accessKeyId':_0x14f25e,'secretAccessKey':_0xde2ae8,'region':_0xa96d66});var _0xb0842c={'Text':_0xf3874e,'TextType':_0x351d60||'text','OutputFormat':_0x3bcc('0x8'),'VoiceId':_0x1b5219};return pollyResult(_0xd4fc72,_0xb0842c,_0x21e217);}; \ 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 4f52138..b783436 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 _0xd23a=['exports'];(function(_0x133196,_0x13dbf8){var _0x3e9bbe=function(_0x2e68d8){while(--_0x2e68d8){_0x133196['push'](_0x133196['shift']());}};_0x3e9bbe(++_0x13dbf8);}(_0xd23a,0x8e));var _0xad23=function(_0x25d368,_0x59e491){_0x25d368=_0x25d368-0x0;var _0x1c6fc7=_0xd23a[_0x25d368];return _0x1c6fc7;};'use strict';var asr=require('./lib/api');module[_0xad23('0x0')]=function(_0x183c74,_0x5494bb,_0xd23dfc,_0x55100c){return asr(_0x183c74,_0x5494bb,_0xd23dfc);}; \ No newline at end of file +var _0xd89b=['exports','./lib/api'];(function(_0x4a7660,_0xc8e21c){var _0x58573c=function(_0x451fd1){while(--_0x451fd1){_0x4a7660['push'](_0x4a7660['shift']());}};_0x58573c(++_0xc8e21c);}(_0xd89b,0x73));var _0xbd89=function(_0x455c6c,_0x1e78b7){_0x455c6c=_0x455c6c-0x0;var _0x488242=_0xd89b[_0x455c6c];return _0x488242;};'use strict';var asr=require(_0xbd89('0x0'));module[_0xbd89('0x1')]=function(_0x50d19c,_0x176b23,_0x2b91cf,_0x44928e){return asr(_0x50d19c,_0x176b23,_0x2b91cf);}; \ 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 f03c13a..7632ddb 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 _0x6ddd=['toString','base64','POST','/v1/speech:recognize?key=','LINEAR16','8000','https://speech.googleapis.com','exports','length','filepath\x20should\x20be\x20a\x20string','string','key\x20should\x20be\x20a\x20string','undefined','readFileSync'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x6ddd,0xae));var _0xd6dd=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x6ddd[_0x6c993a];return _0x27f547;};'use strict';var url=require('url');var BPromise=require('bluebird');var fs=require('fs');var host=_0xd6dd('0x0');module[_0xd6dd('0x1')]=function(_0x3cc790,_0x250900,_0x5283c5){return new BPromise(function(_0x3651aa,_0x5aebd8){var _0x1ab3df;if(typeof _0x3cc790!=='string'||_0x3cc790[_0xd6dd('0x2')]===0x0){return _0x5aebd8(_0xd6dd('0x3'));}if(typeof _0x250900!==_0xd6dd('0x4')||_0x250900['length']===0x0){return _0x5aebd8(_0xd6dd('0x5'));}if(typeof _0x5283c5!==_0xd6dd('0x6')&&(typeof _0x5283c5!==_0xd6dd('0x4')||_0x5283c5[_0xd6dd('0x2')]===0x0)){return _0x5aebd8('lang\x20should\x20be\x20a\x20string');}try{_0x1ab3df=fs[_0xd6dd('0x7')](_0x3cc790)[_0xd6dd('0x8')](_0xd6dd('0x9'));}catch(_0x3f39b1){return _0x5aebd8(_0x3f39b1);}return _0x3651aa({'method':_0xd6dd('0xa'),'uri':host+_0xd6dd('0xb')+_0x250900,'body':{'config':{'encoding':_0xd6dd('0xc'),'sampleRateHertz':_0xd6dd('0xd'),'languageCode':_0x5283c5},'audio':{'content':_0x1ab3df}},'json':!![]});});}; \ No newline at end of file +var _0x8388=['key\x20should\x20be\x20a\x20string','undefined','toString','POST','/v1/speech:recognize?key=','LINEAR16','8000','url','bluebird','https://speech.googleapis.com','exports','length','filepath\x20should\x20be\x20a\x20string'];(function(_0x11e1e7,_0x267340){var _0x54044b=function(_0x34b2f9){while(--_0x34b2f9){_0x11e1e7['push'](_0x11e1e7['shift']());}};_0x54044b(++_0x267340);}(_0x8388,0x18d));var _0x8838=function(_0x4f1da5,_0x4ced17){_0x4f1da5=_0x4f1da5-0x0;var _0xe972a8=_0x8388[_0x4f1da5];return _0xe972a8;};'use strict';var url=require(_0x8838('0x0'));var BPromise=require(_0x8838('0x1'));var fs=require('fs');var host=_0x8838('0x2');module[_0x8838('0x3')]=function(_0x5307bd,_0x140ee6,_0x3dbcd4){return new BPromise(function(_0x316297,_0x20a813){var _0xd474f2;if(typeof _0x5307bd!=='string'||_0x5307bd[_0x8838('0x4')]===0x0){return _0x20a813(_0x8838('0x5'));}if(typeof _0x140ee6!=='string'||_0x140ee6[_0x8838('0x4')]===0x0){return _0x20a813(_0x8838('0x6'));}if(typeof _0x3dbcd4!==_0x8838('0x7')&&(typeof _0x3dbcd4!=='string'||_0x3dbcd4[_0x8838('0x4')]===0x0)){return _0x20a813('lang\x20should\x20be\x20a\x20string');}try{_0xd474f2=fs['readFileSync'](_0x5307bd)[_0x8838('0x8')]('base64');}catch(_0x4aedc9){return _0x20a813(_0x4aedc9);}return _0x316297({'method':_0x8838('0x9'),'uri':host+_0x8838('0xa')+_0x140ee6,'body':{'config':{'encoding':_0x8838('0xb'),'sampleRateHertz':_0x8838('0xc'),'languageCode':_0x3dbcd4},'audio':{'content':_0xd474f2}},'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 ae88257..aae5814 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 _0x5343=['./asr','exports'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x5343,0x1a2));var _0x3534=function(_0x1dbf75,_0x386af3){_0x1dbf75=_0x1dbf75-0x0;var _0x508813=_0x5343[_0x1dbf75];return _0x508813;};var asr=require(_0x3534('0x0'));module[_0x3534('0x1')]={'asr':asr}; \ No newline at end of file +var _0x50fa=['exports'];(function(_0xcf95b4,_0x24baf1){var _0x20d28b=function(_0x3814e7){while(--_0x3814e7){_0xcf95b4['push'](_0xcf95b4['shift']());}};_0x20d28b(++_0x24baf1);}(_0x50fa,0x12b));var _0xa50f=function(_0x59d08a,_0x49e374){_0x59d08a=_0x59d08a-0x0;var _0x402846=_0x50fa[_0x59d08a];return _0x402846;};var asr=require('./asr');module[_0xa50f('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 d25e332..0f43fda 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 _0xae04=['diagnosticInfo','fields','boolValue','fulfillmentText','intent','isFallback','languageCode','queryText','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','model=%s','freeform=3','sestekNDA','nda','text','channelData','CustomActionData','AudioFromTts','Data','dirName','apiai-promise','dialogflow','http','https','md5','path','sox','google-tts-api','parse','util','./aws','./google','./sestek','../../../config/logger','https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','get','statusCode','error','\x20failed,\x20status\x20code\x20=\x20','statusMessage','request\x20to\x20','finish','info','close','unlink','download\x20error','end','data','wav','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','writeFileSync','base64','then','777','readFileSync','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','POST','.mp3','audioContent','chmodSync','split','googleTTS','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','null','generic','slice','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','goggleTTS\x20path','asr','results','map','alternatives','transcript','confidence','join','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','source','resolvedQuery','result','action','status','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult'];(function(_0xf3ba9b,_0x505c2c){var _0x5a7357=function(_0x2b2ffc){while(--_0x2b2ffc){_0xf3ba9b['push'](_0xf3ba9b['shift']());}};_0x5a7357(++_0x505c2c);}(_0xae04,0x19c));var _0x4ae0=function(_0x462545,_0x3c0f1b){_0x462545=_0x462545-0x0;var _0x680d51=_0xae04[_0x462545];return _0x680d51;};'use strict';var apiai=require(_0x4ae0('0x0'));var BPromise=require('bluebird');var dialogflow=require(_0x4ae0('0x1'));var fs=require('fs');var http=require(_0x4ae0('0x2'));var https=require(_0x4ae0('0x3'));var md5=require(_0x4ae0('0x4'));var path=require(_0x4ae0('0x5'));var querystring=require('querystring');var rp=require('request-promise');var rs=require('randomstring');var sox=require(_0x4ae0('0x6'));var tts=require(_0x4ae0('0x7'));var urlParse=require('url')[_0x4ae0('0x8')];var util=require(_0x4ae0('0x9'));var aws=require(_0x4ae0('0xa'));var google=require(_0x4ae0('0xb'));var sestek=require(_0x4ae0('0xc'));var tilde=require('./tilde');var logger=require(_0x4ae0('0xd'))('agi');var ISPEECH_API=_0x4ae0('0xe');function downloadFile(_0x698497,_0x2e4bb2){return new BPromise(function(_0x2bb079,_0x19503d){var _0x5bef1d=urlParse(_0x698497);var _0x450a20=_0x5bef1d[_0x4ae0('0xf')]===_0x4ae0('0x10')?https:http;var _0x40f643={'host':_0x5bef1d[_0x4ae0('0x11')],'path':_0x5bef1d[_0x4ae0('0x5')],'headers':{'user-agent':_0x4ae0('0x12')}};_0x450a20[_0x4ae0('0x13')](_0x40f643,function(_0x27f368){if(_0x27f368[_0x4ae0('0x14')]!==0xc8){logger[_0x4ae0('0x15')]('request\x20to\x20'+_0x698497+_0x4ae0('0x16')+_0x27f368[_0x4ae0('0x14')]+'\x20('+_0x27f368[_0x4ae0('0x17')]+')');_0x19503d(new Error(_0x4ae0('0x18')+_0x698497+'\x20failed,\x20status\x20code\x20=\x20'+_0x27f368['statusCode']+'\x20('+_0x27f368[_0x4ae0('0x17')]+')'));return;}var _0x5693a4=fs['createWriteStream'](_0x2e4bb2);_0x5693a4['on'](_0x4ae0('0x19'),function(){logger[_0x4ae0('0x1a')]('finish\x20download\x20file');_0x5693a4[_0x4ae0('0x1b')](_0x2bb079);});_0x5693a4['on'](_0x4ae0('0x15'),function(_0x425346){fs[_0x4ae0('0x1c')](_0x2e4bb2);logger[_0x4ae0('0x15')](_0x4ae0('0x1d'),_0x425346);_0x19503d(_0x425346);});_0x27f368['pipe'](_0x5693a4);})['on'](_0x4ae0('0x15'),function(_0x28069e){logger[_0x4ae0('0x15')](_0x28069e);_0x19503d(_0x28069e);})[_0x4ae0('0x1e')]();});}function uploadFile(_0x22c93c){return new BPromise(function(_0x6cfa57,_0x114595){var _0x567f02=urlParse(_0x22c93c);var _0x522fe8=_0x567f02['protocol']==='https:'?https:http;var _0x51f29a={'host':_0x567f02[_0x4ae0('0x11')],'path':_0x567f02['path'],'headers':{'user-agent':_0x4ae0('0x12')}};_0x522fe8['get'](_0x51f29a,function(_0x452d19){if(_0x452d19[_0x4ae0('0x14')]!==0xc8){_0x114595(new Error(_0x4ae0('0x18')+_0x22c93c+'\x20failed,\x20status\x20code\x20=\x20'+_0x452d19['statusCode']+'\x20('+_0x452d19[_0x4ae0('0x17')]+')'));return;}var _0x3687c3='';_0x452d19['on'](_0x4ae0('0x1f'),function(_0x579e14){_0x3687c3+=_0x579e14;});_0x452d19['on'](_0x4ae0('0x1e'),function(){_0x6cfa57(_0x3687c3);});})['on']('error',function(_0x4cca28){_0x114595(_0x4cca28);})[_0x4ae0('0x1e')]();});}function convertFile(_0x4ae764,_0x48e1e5){return new BPromise(function(_0x2d54cb,_0x3fc482){var _0x21441e=sox['transcode'](_0x4ae764,_0x48e1e5,{'sampleRate':0x1f40,'format':_0x4ae0('0x20'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x21441e['on']('error',function(_0x4ad1f2){logger[_0x4ae0('0x15')](_0x4ae0('0x21'),_0x4ad1f2);_0x3fc482(_0x4ad1f2);});_0x21441e['on'](_0x4ae0('0x1e'),function(){logger[_0x4ae0('0x1a')](_0x4ae0('0x22'));_0x2d54cb();});_0x21441e[_0x4ae0('0x23')]();});}function base64Decode(_0x3eb7f0,_0x27ef0a){var _0x1dcc28=path[_0x4ae0('0x24')](__dirname,_0x4ae0('0x25'),rs[_0x4ae0('0x26')](0x4)+_0x4ae0('0x27'));fs[_0x4ae0('0x28')](_0x1dcc28,_0x3eb7f0,_0x4ae0('0x29'));return convertFile(_0x1dcc28,_0x27ef0a)[_0x4ae0('0x2a')](function(){try{fs['unlink'](_0x1dcc28);fs['chmodSync'](_0x27ef0a,_0x4ae0('0x2b'));}catch(_0x17e91d){logger['error'](_0x17e91d);}return _0x27ef0a['split']('.')[0x0];});}function base64Encode(_0x5e8886){var _0xc77d5d=fs[_0x4ae0('0x2c')](_0x5e8886);return new Buffer(_0xc77d5d)['toString'](_0x4ae0('0x29'));}exports[_0x4ae0('0x2d')]=function(_0x3177a7,_0x40463a,_0x134f5d,_0x35e1b,_0x3e2d9b,_0x4e9258){var _0x456b11,_0x583280;var _0x503136=_0x4ae0('0x2e');var _0x367fa8=_0x4ae0('0x2f')+_0x3177a7;var _0x14d86d={};if(_0x40463a===_0x4ae0('0x30')){_0x14d86d['input']={'ssml':_0x134f5d};}else{_0x14d86d[_0x4ae0('0x31')]={'text':_0x134f5d};};_0x14d86d[_0x4ae0('0x32')]={'languageCode':_0x35e1b,'ssmlGender':_0x3e2d9b};_0x14d86d[_0x4ae0('0x33')]={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0x44566e={'url':_0x503136+'text:synthesize'+_0x367fa8,'method':_0x4ae0('0x34'),'json':!![],'body':_0x14d86d};return rp(_0x44566e)[_0x4ae0('0x2a')](function(_0x446ffe){return new BPromise(function(_0x55f22f,_0x56c67e){_0x456b11=path[_0x4ae0('0x24')](__dirname,_0x4ae0('0x25'),rs[_0x4ae0('0x26')](0x4)+_0x4ae0('0x35'));var _0x1f2969=Buffer['from'](_0x446ffe[_0x4ae0('0x36')],_0x4ae0('0x29'));return fs['writeFile'](_0x456b11,_0x1f2969,function(_0x3803f3){_0x56c67e(_0x3803f3);},function(_0x51ac26){fs[_0x4ae0('0x37')](_0x456b11,_0x4ae0('0x2b'));_0x55f22f(_0x51ac26);});});})[_0x4ae0('0x2a')](function(_0x46d2af){_0x583280=path[_0x4ae0('0x24')](__dirname,'tmp',rs[_0x4ae0('0x26')](0x4)+_0x4ae0('0x27'));return convertFile(_0x456b11,_0x583280);})['then'](function(){try{fs[_0x4ae0('0x1c')](_0x456b11);fs[_0x4ae0('0x37')](_0x583280,'777');}catch(_0x43f81a){logger[_0x4ae0('0x15')](_0x43f81a);}logger[_0x4ae0('0x1a')]('googleCloudTTS\x20path',_0x583280[_0x4ae0('0x38')]('.')[0x0]);return _0x583280[_0x4ae0('0x38')]('.')[0x0];});};exports[_0x4ae0('0x39')]=function(_0x2d6da4,_0x4ad5da){var _0x27cda2='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0xc89bc8,_0x128f6a;var _0x19b689;var _0x27c185={'encoding':'utf8','method':_0x4ae0('0x34'),'timeout':0x2710,'url':_0x27cda2,'headers':{'Content-Type':_0x4ae0('0x3a')},'body':_0x4ae0('0x3b')+encodeURIComponent(JSON[_0x4ae0('0x3c')]([[[_0x4ae0('0x3d'),JSON[_0x4ae0('0x3c')]([_0x2d6da4,_0x4ad5da||'en',![],_0x4ae0('0x3e')]),null,_0x4ae0('0x3f')]]]))};return rp(_0x27c185)[_0x4ae0('0x2a')](function(_0x3016ea){try{_0x19b689=eval(_0x3016ea[_0x4ae0('0x40')](0x5))[0x0][0x2];}catch(_0x42af72){throw new Error('parse\x20response\x20failed:\x0a'+_0x3016ea[_0x4ae0('0x1f')]);}if(!_0x19b689){if(_0x2d6da4[_0x4ae0('0x41')]>0xc8){throw new Error(_0x4ae0('0x42'));}else{throw new Error(_0x4ae0('0x43')+_0x4ad5da+_0x4ae0('0x44'));}}try{_0x19b689=eval(_0x19b689)[0x0];}catch(_0x38ae1b){throw new Error('parse\x20response\x20failed:\x0a'+res['data']);}const _0x4407b0=_0x19b689;_0xc89bc8=path[_0x4ae0('0x24')](__dirname,_0x4ae0('0x25'),rs['generate'](0x4)+_0x4ae0('0x35'));fs[_0x4ae0('0x28')](_0xc89bc8,_0x19b689,{'encoding':_0x4ae0('0x29')});_0x128f6a=path[_0x4ae0('0x24')](__dirname,_0x4ae0('0x25'),rs[_0x4ae0('0x26')](0x4)+'.wav');return convertFile(_0xc89bc8,_0x128f6a);})[_0x4ae0('0x2a')](function(){try{fs[_0x4ae0('0x1c')](_0xc89bc8);fs[_0x4ae0('0x37')](_0x128f6a,_0x4ae0('0x2b'));}catch(_0x1e3ef3){logger[_0x4ae0('0x15')](_0x1e3ef3);}logger[_0x4ae0('0x1a')](_0x4ae0('0x45'),_0x128f6a[_0x4ae0('0x38')]('.')[0x0]);return _0x128f6a['split']('.')[0x0];});};exports['googleASR']=function(_0x4006e4,_0x45c96f,_0x1d4b39){return google[_0x4ae0('0x46')](_0x4006e4,_0x45c96f,_0x1d4b39)[_0x4ae0('0x2a')](function(_0x372466){logger[_0x4ae0('0x1a')](_0x372466['uri']);return rp(_0x372466);})[_0x4ae0('0x2a')](function(_0x3dd22c){var _0x434e6a='';var _0x33cd33=0x0;try{fs['unlink'](_0x4006e4);}catch(_0x3b4cbc){logger[_0x4ae0('0x15')](_0x3b4cbc);}if(_0x3dd22c&&_0x3dd22c[_0x4ae0('0x47')]){_0x434e6a=_0x3dd22c[_0x4ae0('0x47')][_0x4ae0('0x48')](function(_0x3fbe76){return _0x3fbe76&&_0x3fbe76[_0x4ae0('0x49')][0x0]&&_0x3fbe76[_0x4ae0('0x49')][0x0]['transcript']?_0x3fbe76[_0x4ae0('0x49')][0x0][_0x4ae0('0x4a')]:'';})['join']('\x0a');_0x33cd33=_0x3dd22c['results'][_0x4ae0('0x48')](function(_0x3e9532){return _0x3e9532&&_0x3e9532[_0x4ae0('0x49')][0x0]&&_0x3e9532[_0x4ae0('0x49')][0x0][_0x4ae0('0x4b')]?_0x3e9532[_0x4ae0('0x49')][0x0][_0x4ae0('0x4b')]:0x0;})[_0x4ae0('0x4c')]('\x0a');}logger['info'](_0x4ae0('0x4d'),_0x434e6a);logger[_0x4ae0('0x1a')](_0x4ae0('0x4e'),_0x33cd33);return{'transcript':_0x434e6a,'confidence':_0x33cd33};})[_0x4ae0('0x4f')](function(_0x5be555){logger['error'](_0x4ae0('0x50'),_0x5be555['statusCode'],_0x5be555[_0x4ae0('0x51')],_0x5be555[_0x4ae0('0x52')]);});};exports[_0x4ae0('0x53')]=function(_0xd0c194,_0x11d807,_0x59ffce,_0x448998){var _0x50c400=apiai(_0x11d807,{'language':_0x448998||'en'});return _0x50c400[_0x4ae0('0x54')](_0x59ffce,{'sessionId':md5(_0xd0c194)})[_0x4ae0('0x2a')](function(_0x48ac85){logger[_0x4ae0('0x1a')](JSON[_0x4ae0('0x3c')](_0x48ac85));return{'source':_0x48ac85['result'][_0x4ae0('0x55')],'resolvedQuery':_0x48ac85['result'][_0x4ae0('0x56')],'action':_0x48ac85[_0x4ae0('0x57')][_0x4ae0('0x58')],'actionIncomplete':_0x48ac85[_0x4ae0('0x57')]['actionIncomplete'],'speech':_0x48ac85[_0x4ae0('0x57')]['fulfillment']['speech'],'score':_0x48ac85[_0x4ae0('0x57')]['score'],'statusCode':_0x48ac85[_0x4ae0('0x59')][_0x4ae0('0x5a')],'endConversation':_0x48ac85[_0x4ae0('0x57')][_0x4ae0('0x5b')][_0x4ae0('0x5c')]||![],'isFallbackIntent':_0x48ac85[_0x4ae0('0x57')]['metadata'][_0x4ae0('0x5d')]};});};exports[_0x4ae0('0x5e')]=function(_0x2c0499,_0x109de4,_0x300244,_0x74b818,_0x30bb14,_0x3dd501){var _0x548568=_0x74b818['replace'](/\\n/g,'\x0a');var _0xba074c={'credentials':{'private_key':_0x548568,'client_email':_0x300244}};var _0x5d5ad7=new dialogflow[(_0x4ae0('0x5f'))](_0xba074c);var _0x327620=_0x5d5ad7[_0x4ae0('0x60')](_0x109de4,md5(_0x2c0499));var _0x1406c2={'session':_0x327620,'queryInput':{'text':{'text':_0x30bb14,'languageCode':_0x3dd501}}};return _0x5d5ad7[_0x4ae0('0x61')](_0x1406c2)[_0x4ae0('0x2a')](function(_0x551cef){if(_0x551cef&&_0x551cef[_0x4ae0('0x41')]){logger['info'](_0x4ae0('0x62'),JSON[_0x4ae0('0x3c')](_0x551cef));var _0xefd999=_0x551cef[0x0];if(_0xefd999){var _0x5da01f={'action':_0xefd999[_0x4ae0('0x63')]['action'],'allRequiredParamsPresent':_0xefd999[_0x4ae0('0x63')]['allRequiredParamsPresent'],'endConversation':_0xefd999[_0x4ae0('0x63')]['diagnosticInfo']&&_0xefd999[_0x4ae0('0x63')][_0x4ae0('0x64')][_0x4ae0('0x65')]?_0xefd999[_0x4ae0('0x63')][_0x4ae0('0x64')][_0x4ae0('0x65')]['end_conversation'][_0x4ae0('0x66')]:![],'fulfillmentText':_0xefd999[_0x4ae0('0x63')][_0x4ae0('0x67')],'intentName':_0xefd999[_0x4ae0('0x63')][_0x4ae0('0x68')][_0x4ae0('0x51')],'intentDisplayName':_0xefd999[_0x4ae0('0x63')][_0x4ae0('0x68')]['displayName'],'isFallbackIntent':_0xefd999[_0x4ae0('0x63')][_0x4ae0('0x68')][_0x4ae0('0x69')],'languageCode':_0xefd999['queryResult'][_0x4ae0('0x6a')],'queryText':_0xefd999[_0x4ae0('0x63')][_0x4ae0('0x6b')],'responseId':_0xefd999['responseId'],'score':_0xefd999[_0x4ae0('0x63')][_0x4ae0('0x6c')],'speech':_0xefd999[_0x4ae0('0x63')][_0x4ae0('0x67')],'providerResponse':JSON[_0x4ae0('0x3c')](_0x551cef)};return _0x5da01f;}}});};exports[_0x4ae0('0x6d')]=function(_0x1d1bc6,_0x1efa2a,_0x1fb422,_0x3305ba){return tilde[_0x4ae0('0x46')](_0x1d1bc6,_0x1efa2a,_0x1fb422,_0x3305ba)[_0x4ae0('0x2a')](function(_0x219133){try{fs[_0x4ae0('0x1c')](_0x1d1bc6);}catch(_0x394ce7){logger[_0x4ae0('0x15')](_0x394ce7);}logger[_0x4ae0('0x1a')](_0x4ae0('0x6e'),_0x219133[_0x4ae0('0x4a')]);logger[_0x4ae0('0x1a')](_0x4ae0('0x6f'),_0x219133[_0x4ae0('0x4b')]);return _0x219133;});};exports[_0x4ae0('0x70')]=function(_0xbcb51a,_0x46f268,_0x5470d7,_0x12f5f1,_0x20fde0,_0xdaae40){var _0x234512=path['resolve'](__dirname,_0x4ae0('0x25'),rs[_0x4ae0('0x26')](0x4)+_0x4ae0('0x35'));var _0x297a02;return aws[_0x4ae0('0x71')](_0xbcb51a,_0x46f268,_0x5470d7,_0x12f5f1,_0x20fde0,_0xdaae40,_0x234512)[_0x4ae0('0x2a')](function(){_0x297a02=path[_0x4ae0('0x24')](__dirname,_0x4ae0('0x25'),rs['generate'](0x4)+'.wav');return convertFile(_0x234512,_0x297a02);})['then'](function(){try{fs[_0x4ae0('0x1c')](_0x234512);fs[_0x4ae0('0x37')](_0x297a02,'777');}catch(_0x2f418f){logger[_0x4ae0('0x15')](_0x2f418f);}return _0x297a02[_0x4ae0('0x38')]('.')[0x0];});};exports['awsLex']=function(_0x10ba84,_0x36cbc2,_0x1929a5,_0xaf50de,_0x4eea36,_0x40aee9){return aws['lex'](_0x10ba84,_0x36cbc2,_0x1929a5,_0xaf50de,_0x4eea36,_0x40aee9)[_0x4ae0('0x2a')](function(_0x376e6c){logger['info'](JSON['stringify'](_0x376e6c));return _0x376e6c;});};exports[_0x4ae0('0x72')]=function(_0x14a9c3,_0x5d974f,_0x2fc309,_0x3e29e0){var _0x32b082=util[_0x4ae0('0x73')](_0x4ae0('0x74'),ISPEECH_API,_0x14a9c3,encodeURIComponent(_0x5d974f),_0x2fc309,_0x3e29e0);var _0x2897aa=path[_0x4ae0('0x24')](__dirname,_0x4ae0('0x25'),rs['generate'](0x4)+'.mp3');var _0x5e09df;return downloadFile(_0x32b082,_0x2897aa)['then'](function(){_0x5e09df=path['resolve'](__dirname,_0x4ae0('0x25'),rs[_0x4ae0('0x26')](0x4)+_0x4ae0('0x27'));return convertFile(_0x2897aa,_0x5e09df);})[_0x4ae0('0x2a')](function(){try{fs[_0x4ae0('0x1c')](_0x2897aa);fs[_0x4ae0('0x37')](_0x5e09df,'777');}catch(_0x598066){logger[_0x4ae0('0x15')](_0x598066);}return _0x5e09df[_0x4ae0('0x38')]('.')[0x0];});};exports[_0x4ae0('0x75')]=function(_0x39bde5,_0x474b7d,_0x43f99f,_0x45921b){var _0x5ebe65=util[_0x4ae0('0x73')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x474b7d,_0x43f99f,base64Encode(_0x39bde5),_0x45921b?util[_0x4ae0('0x73')](_0x4ae0('0x76'),encodeURIComponent(_0x45921b)):_0x4ae0('0x77'));return uploadFile(_0x5ebe65)[_0x4ae0('0x2a')](function(_0x479eec){return querystring[_0x4ae0('0x8')](_0x479eec);});};exports[_0x4ae0('0x78')]=function(_0x4f9084,_0x44907c){return sestek[_0x4ae0('0x79')](_0x4f9084,_0x44907c)['then'](function(_0x3839df){logger['info'](JSON[_0x4ae0('0x3c')](_0x3839df));var _0x3cbc84={'speech':_0x3839df[_0x4ae0('0x7a')],'action':_0x3839df['channelData']?_0x3839df[_0x4ae0('0x7b')]['CustomAction']:undefined,'actiondata':_0x3839df[_0x4ae0('0x7b')]?_0x3839df[_0x4ae0('0x7b')][_0x4ae0('0x7c')]:undefined};if(_0x3839df[_0x4ae0('0x7b')]&&_0x3839df['channelData'][_0x4ae0('0x7d')]){return base64Decode(_0x3839df['channelData']['AudioFromTts'][_0x4ae0('0x7e')],path[_0x4ae0('0x24')](__dirname,_0x4ae0('0x25'),rs[_0x4ae0('0x26')](0x4)+_0x4ae0('0x27')))[_0x4ae0('0x2a')](function(_0x478e32){_0x3cbc84['audiofile']=_0x478e32;return _0x3cbc84;});}return _0x3cbc84;});};exports[_0x4ae0('0x7f')]=function(){return __dirname;}; \ No newline at end of file +var _0x448d=['AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','dialogflow','md5','path','querystring','request-promise','randomstring','google-tts-api','util','./google','./sestek','./tilde','https://api.ispeech.org/api/rest','host','WHAT_EVER','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','info','close','download\x20error','pipe','https:','data','end','transcode','wav','error\x20convert','finish\x20to\x20convert','start','resolve','generate','writeFileSync','base64','then','777','split','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','ssml','input','voice','audioConfig','text:synthesize','POST','tmp','.mp3','from','audioContent','writeFile','chmodSync','.wav','unlink','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','null','generic','slice','lang\x20\x22','\x22\x20might\x20not\x20exist','parse\x20response\x20failed:\x0a','googleASR','asr','uri','results','alternatives','transcript','join','confidence','googleASR\x20confidence','catch','message','textRequest','result','source','resolvedQuery','action','actionIncomplete','fulfillment','speech','score','status','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','SessionsClient','sessionPath','detectIntent','length','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','boolValue','fulfillmentText','intent','displayName','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','awsPolly','polly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','parse','sestekNDA','nda','channelData','CustomAction','CustomActionData'];(function(_0x146c14,_0x4b28a3){var _0x3bf357=function(_0xfdd2f3){while(--_0xfdd2f3){_0x146c14['push'](_0x146c14['shift']());}};_0x3bf357(++_0x4b28a3);}(_0x448d,0x8e));var _0xd448=function(_0x2d4443,_0x35d00e){_0x2d4443=_0x2d4443-0x0;var _0x24bff3=_0x448d[_0x2d4443];return _0x24bff3;};'use strict';var apiai=require(_0xd448('0x0'));var BPromise=require(_0xd448('0x1'));var dialogflow=require(_0xd448('0x2'));var fs=require('fs');var http=require('http');var https=require('https');var md5=require(_0xd448('0x3'));var path=require(_0xd448('0x4'));var querystring=require(_0xd448('0x5'));var rp=require(_0xd448('0x6'));var rs=require(_0xd448('0x7'));var sox=require('sox');var tts=require(_0xd448('0x8'));var urlParse=require('url')['parse'];var util=require(_0xd448('0x9'));var aws=require('./aws');var google=require(_0xd448('0xa'));var sestek=require(_0xd448('0xb'));var tilde=require(_0xd448('0xc'));var logger=require('../../../config/logger')('agi');var ISPEECH_API=_0xd448('0xd');function downloadFile(_0x1545bc,_0x32aa1d){return new BPromise(function(_0x5202ae,_0x4c9014){var _0x451d61=urlParse(_0x1545bc);var _0x54efa1=_0x451d61['protocol']==='https:'?https:http;var _0x5199ad={'host':_0x451d61[_0xd448('0xe')],'path':_0x451d61[_0xd448('0x4')],'headers':{'user-agent':_0xd448('0xf')}};_0x54efa1[_0xd448('0x10')](_0x5199ad,function(_0x9b95d2){if(_0x9b95d2[_0xd448('0x11')]!==0xc8){logger[_0xd448('0x12')](_0xd448('0x13')+_0x1545bc+_0xd448('0x14')+_0x9b95d2[_0xd448('0x11')]+'\x20('+_0x9b95d2[_0xd448('0x15')]+')');_0x4c9014(new Error(_0xd448('0x13')+_0x1545bc+_0xd448('0x14')+_0x9b95d2[_0xd448('0x11')]+'\x20('+_0x9b95d2[_0xd448('0x15')]+')'));return;}var _0x4e5a4e=fs[_0xd448('0x16')](_0x32aa1d);_0x4e5a4e['on'](_0xd448('0x17'),function(){logger[_0xd448('0x18')]('finish\x20download\x20file');_0x4e5a4e[_0xd448('0x19')](_0x5202ae);});_0x4e5a4e['on'](_0xd448('0x12'),function(_0x36ee39){fs['unlink'](_0x32aa1d);logger['error'](_0xd448('0x1a'),_0x36ee39);_0x4c9014(_0x36ee39);});_0x9b95d2[_0xd448('0x1b')](_0x4e5a4e);})['on'](_0xd448('0x12'),function(_0x2cfc98){logger[_0xd448('0x12')](_0x2cfc98);_0x4c9014(_0x2cfc98);})['end']();});}function uploadFile(_0x4b5118){return new BPromise(function(_0x40a2e1,_0x41fe52){var _0xeb916a=urlParse(_0x4b5118);var _0x4f66c6=_0xeb916a['protocol']===_0xd448('0x1c')?https:http;var _0xb75da0={'host':_0xeb916a[_0xd448('0xe')],'path':_0xeb916a[_0xd448('0x4')],'headers':{'user-agent':_0xd448('0xf')}};_0x4f66c6[_0xd448('0x10')](_0xb75da0,function(_0x10b48f){if(_0x10b48f[_0xd448('0x11')]!==0xc8){_0x41fe52(new Error(_0xd448('0x13')+_0x4b5118+_0xd448('0x14')+_0x10b48f[_0xd448('0x11')]+'\x20('+_0x10b48f[_0xd448('0x15')]+')'));return;}var _0x3c7523='';_0x10b48f['on'](_0xd448('0x1d'),function(_0x55dc72){_0x3c7523+=_0x55dc72;});_0x10b48f['on']('end',function(){_0x40a2e1(_0x3c7523);});})['on']('error',function(_0x27d4e7){_0x41fe52(_0x27d4e7);})[_0xd448('0x1e')]();});}function convertFile(_0x5e4c5b,_0xdc9787){return new BPromise(function(_0x219bca,_0x1ab56b){var _0x4660ba=sox[_0xd448('0x1f')](_0x5e4c5b,_0xdc9787,{'sampleRate':0x1f40,'format':_0xd448('0x20'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x4660ba['on']('error',function(_0x3ca2ca){logger[_0xd448('0x12')](_0xd448('0x21'),_0x3ca2ca);_0x1ab56b(_0x3ca2ca);});_0x4660ba['on'](_0xd448('0x1e'),function(){logger[_0xd448('0x18')](_0xd448('0x22'));_0x219bca();});_0x4660ba[_0xd448('0x23')]();});}function base64Decode(_0x4c7b56,_0x5c11bb){var _0x463758=path[_0xd448('0x24')](__dirname,'tmp',rs[_0xd448('0x25')](0x4)+'.wav');fs[_0xd448('0x26')](_0x463758,_0x4c7b56,_0xd448('0x27'));return convertFile(_0x463758,_0x5c11bb)[_0xd448('0x28')](function(){try{fs['unlink'](_0x463758);fs['chmodSync'](_0x5c11bb,_0xd448('0x29'));}catch(_0x26318c){logger[_0xd448('0x12')](_0x26318c);}return _0x5c11bb[_0xd448('0x2a')]('.')[0x0];});}function base64Encode(_0x47e67b){var _0x589ae2=fs[_0xd448('0x2b')](_0x47e67b);return new Buffer(_0x589ae2)[_0xd448('0x2c')](_0xd448('0x27'));}exports[_0xd448('0x2d')]=function(_0xad31ab,_0xb49ed,_0x1ae2df,_0x202e15,_0x3fd6bd,_0x4be57d){var _0x46e2f8,_0x3fd45b;var _0x1f1709=_0xd448('0x2e');var _0x13945a='?key='+_0xad31ab;var _0xb7f1a7={};if(_0xb49ed===_0xd448('0x2f')){_0xb7f1a7[_0xd448('0x30')]={'ssml':_0x1ae2df};}else{_0xb7f1a7[_0xd448('0x30')]={'text':_0x1ae2df};};_0xb7f1a7[_0xd448('0x31')]={'languageCode':_0x202e15,'ssmlGender':_0x3fd6bd};_0xb7f1a7[_0xd448('0x32')]={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0x5d4e7f={'url':_0x1f1709+_0xd448('0x33')+_0x13945a,'method':_0xd448('0x34'),'json':!![],'body':_0xb7f1a7};return rp(_0x5d4e7f)[_0xd448('0x28')](function(_0x392349){return new BPromise(function(_0x1d516d,_0x263ac4){_0x46e2f8=path['resolve'](__dirname,_0xd448('0x35'),rs[_0xd448('0x25')](0x4)+_0xd448('0x36'));var _0x512609=Buffer[_0xd448('0x37')](_0x392349[_0xd448('0x38')],_0xd448('0x27'));return fs[_0xd448('0x39')](_0x46e2f8,_0x512609,function(_0x9ef882){_0x263ac4(_0x9ef882);},function(_0x462814){fs[_0xd448('0x3a')](_0x46e2f8,_0xd448('0x29'));_0x1d516d(_0x462814);});});})[_0xd448('0x28')](function(_0x2c2c88){_0x3fd45b=path[_0xd448('0x24')](__dirname,'tmp',rs[_0xd448('0x25')](0x4)+_0xd448('0x3b'));return convertFile(_0x46e2f8,_0x3fd45b);})[_0xd448('0x28')](function(){try{fs[_0xd448('0x3c')](_0x46e2f8);fs[_0xd448('0x3a')](_0x3fd45b,'777');}catch(_0x1bbd75){logger['error'](_0x1bbd75);}logger[_0xd448('0x18')]('googleCloudTTS\x20path',_0x3fd45b[_0xd448('0x2a')]('.')[0x0]);return _0x3fd45b[_0xd448('0x2a')]('.')[0x0];});};exports[_0xd448('0x3d')]=function(_0x119114,_0x12e765){var _0x52a817=_0xd448('0x3e');var _0x30642e,_0x4fbe51;var _0x4de9b8;var _0x332db4={'encoding':'utf8','method':_0xd448('0x34'),'timeout':0x2710,'url':_0x52a817,'headers':{'Content-Type':_0xd448('0x3f')},'body':_0xd448('0x40')+encodeURIComponent(JSON[_0xd448('0x41')]([[[_0xd448('0x42'),JSON[_0xd448('0x41')]([_0x119114,_0x12e765||'en',![],_0xd448('0x43')]),null,_0xd448('0x44')]]]))};return rp(_0x332db4)['then'](function(_0x77f42c){try{_0x4de9b8=eval(_0x77f42c[_0xd448('0x45')](0x5))[0x0][0x2];}catch(_0x2a1d73){throw new Error('parse\x20response\x20failed:\x0a'+_0x77f42c[_0xd448('0x1d')]);}if(!_0x4de9b8){if(_0x119114['length']>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error(_0xd448('0x46')+_0x12e765+_0xd448('0x47'));}}try{_0x4de9b8=eval(_0x4de9b8)[0x0];}catch(_0x5ec1b0){throw new Error(_0xd448('0x48')+res[_0xd448('0x1d')]);}const _0x38561a=_0x4de9b8;_0x30642e=path[_0xd448('0x24')](__dirname,'tmp',rs[_0xd448('0x25')](0x4)+_0xd448('0x36'));fs[_0xd448('0x26')](_0x30642e,_0x4de9b8,{'encoding':_0xd448('0x27')});_0x4fbe51=path['resolve'](__dirname,_0xd448('0x35'),rs['generate'](0x4)+_0xd448('0x3b'));return convertFile(_0x30642e,_0x4fbe51);})['then'](function(){try{fs['unlink'](_0x30642e);fs[_0xd448('0x3a')](_0x4fbe51,_0xd448('0x29'));}catch(_0x2a9643){logger[_0xd448('0x12')](_0x2a9643);}logger['info']('goggleTTS\x20path',_0x4fbe51[_0xd448('0x2a')]('.')[0x0]);return _0x4fbe51[_0xd448('0x2a')]('.')[0x0];});};exports[_0xd448('0x49')]=function(_0x14c2d0,_0x2ceb08,_0x1f40f4){return google[_0xd448('0x4a')](_0x14c2d0,_0x2ceb08,_0x1f40f4)[_0xd448('0x28')](function(_0x140c02){logger[_0xd448('0x18')](_0x140c02[_0xd448('0x4b')]);return rp(_0x140c02);})[_0xd448('0x28')](function(_0x214733){var _0x2a6233='';var _0x32c715=0x0;try{fs[_0xd448('0x3c')](_0x14c2d0);}catch(_0x3253a1){logger[_0xd448('0x12')](_0x3253a1);}if(_0x214733&&_0x214733[_0xd448('0x4c')]){_0x2a6233=_0x214733[_0xd448('0x4c')]['map'](function(_0x4a29de){return _0x4a29de&&_0x4a29de[_0xd448('0x4d')][0x0]&&_0x4a29de['alternatives'][0x0][_0xd448('0x4e')]?_0x4a29de[_0xd448('0x4d')][0x0][_0xd448('0x4e')]:'';})[_0xd448('0x4f')]('\x0a');_0x32c715=_0x214733[_0xd448('0x4c')]['map'](function(_0x38254f){return _0x38254f&&_0x38254f[_0xd448('0x4d')][0x0]&&_0x38254f[_0xd448('0x4d')][0x0]['confidence']?_0x38254f[_0xd448('0x4d')][0x0][_0xd448('0x50')]:0x0;})['join']('\x0a');}logger['info']('googleASR\x20transcription',_0x2a6233);logger['info'](_0xd448('0x51'),_0x32c715);return{'transcript':_0x2a6233,'confidence':_0x32c715};})[_0xd448('0x52')](function(_0x5b26d3){logger[_0xd448('0x12')]('[%s]\x20%s:%s',_0x5b26d3[_0xd448('0x11')],_0x5b26d3['name'],_0x5b26d3[_0xd448('0x53')]);});};exports['googleDialogflow']=function(_0x7df76b,_0x5857e3,_0x1bd9fa,_0x5f2165){var _0x48ba85=apiai(_0x5857e3,{'language':_0x5f2165||'en'});return _0x48ba85[_0xd448('0x54')](_0x1bd9fa,{'sessionId':md5(_0x7df76b)})[_0xd448('0x28')](function(_0x21ca47){logger[_0xd448('0x18')](JSON[_0xd448('0x41')](_0x21ca47));return{'source':_0x21ca47[_0xd448('0x55')][_0xd448('0x56')],'resolvedQuery':_0x21ca47[_0xd448('0x55')][_0xd448('0x57')],'action':_0x21ca47['result'][_0xd448('0x58')],'actionIncomplete':_0x21ca47[_0xd448('0x55')][_0xd448('0x59')],'speech':_0x21ca47[_0xd448('0x55')][_0xd448('0x5a')][_0xd448('0x5b')],'score':_0x21ca47[_0xd448('0x55')][_0xd448('0x5c')],'statusCode':_0x21ca47[_0xd448('0x5d')][_0xd448('0x5e')],'endConversation':_0x21ca47[_0xd448('0x55')][_0xd448('0x5f')][_0xd448('0x60')]||![],'isFallbackIntent':_0x21ca47[_0xd448('0x55')][_0xd448('0x5f')][_0xd448('0x61')]};});};exports[_0xd448('0x62')]=function(_0x4e250f,_0x391ac4,_0x2dc728,_0x2280cc,_0x5e5bad,_0x4bd5be){var _0x4be37a=_0x2280cc['replace'](/\\n/g,'\x0a');var _0x4dbe16={'credentials':{'private_key':_0x4be37a,'client_email':_0x2dc728}};var _0x1e7066=new dialogflow[(_0xd448('0x63'))](_0x4dbe16);var _0x5b6482=_0x1e7066[_0xd448('0x64')](_0x391ac4,md5(_0x4e250f));var _0x52295f={'session':_0x5b6482,'queryInput':{'text':{'text':_0x5e5bad,'languageCode':_0x4bd5be}}};return _0x1e7066[_0xd448('0x65')](_0x52295f)['then'](function(_0x2868d6){if(_0x2868d6&&_0x2868d6[_0xd448('0x66')]){logger[_0xd448('0x18')](_0xd448('0x67'),JSON['stringify'](_0x2868d6));var _0x48896d=_0x2868d6[0x0];if(_0x48896d){var _0x117a2a={'action':_0x48896d[_0xd448('0x68')][_0xd448('0x58')],'allRequiredParamsPresent':_0x48896d['queryResult'][_0xd448('0x69')],'endConversation':_0x48896d['queryResult'][_0xd448('0x6a')]&&_0x48896d[_0xd448('0x68')][_0xd448('0x6a')][_0xd448('0x6b')]?_0x48896d[_0xd448('0x68')][_0xd448('0x6a')][_0xd448('0x6b')]['end_conversation'][_0xd448('0x6c')]:![],'fulfillmentText':_0x48896d[_0xd448('0x68')][_0xd448('0x6d')],'intentName':_0x48896d['queryResult'][_0xd448('0x6e')]['name'],'intentDisplayName':_0x48896d[_0xd448('0x68')]['intent'][_0xd448('0x6f')],'isFallbackIntent':_0x48896d[_0xd448('0x68')][_0xd448('0x6e')][_0xd448('0x70')],'languageCode':_0x48896d[_0xd448('0x68')][_0xd448('0x71')],'queryText':_0x48896d['queryResult'][_0xd448('0x72')],'responseId':_0x48896d[_0xd448('0x73')],'score':_0x48896d['queryResult'][_0xd448('0x74')],'speech':_0x48896d[_0xd448('0x68')][_0xd448('0x6d')],'providerResponse':JSON[_0xd448('0x41')](_0x2868d6)};return _0x117a2a;}}});};exports[_0xd448('0x75')]=function(_0x776d78,_0x3d7db4,_0xd968e8,_0x20796f){return tilde[_0xd448('0x4a')](_0x776d78,_0x3d7db4,_0xd968e8,_0x20796f)['then'](function(_0x3bf3ff){try{fs['unlink'](_0x776d78);}catch(_0x4c8610){logger[_0xd448('0x12')](_0x4c8610);}logger['info'](_0xd448('0x76'),_0x3bf3ff['transcript']);logger[_0xd448('0x18')]('Tilde\x20ASR\x20confidence',_0x3bf3ff[_0xd448('0x50')]);return _0x3bf3ff;});};exports[_0xd448('0x77')]=function(_0x2d7ce7,_0x564f02,_0x2f4752,_0x4e0b9f,_0x168536,_0x2a7087){var _0x509f57=path[_0xd448('0x24')](__dirname,'tmp',rs[_0xd448('0x25')](0x4)+_0xd448('0x36'));var _0x2cd3f3;return aws[_0xd448('0x78')](_0x2d7ce7,_0x564f02,_0x2f4752,_0x4e0b9f,_0x168536,_0x2a7087,_0x509f57)['then'](function(){_0x2cd3f3=path[_0xd448('0x24')](__dirname,'tmp',rs['generate'](0x4)+_0xd448('0x3b'));return convertFile(_0x509f57,_0x2cd3f3);})[_0xd448('0x28')](function(){try{fs[_0xd448('0x3c')](_0x509f57);fs[_0xd448('0x3a')](_0x2cd3f3,_0xd448('0x29'));}catch(_0x25d74c){logger[_0xd448('0x12')](_0x25d74c);}return _0x2cd3f3['split']('.')[0x0];});};exports[_0xd448('0x79')]=function(_0x5c9df3,_0x3f271d,_0x1702d7,_0x57f102,_0x4eb693,_0x12bec2){return aws[_0xd448('0x7a')](_0x5c9df3,_0x3f271d,_0x1702d7,_0x57f102,_0x4eb693,_0x12bec2)[_0xd448('0x28')](function(_0x469781){logger[_0xd448('0x18')](JSON[_0xd448('0x41')](_0x469781));return _0x469781;});};exports[_0xd448('0x7b')]=function(_0x943b5b,_0x2a369a,_0x4b42a2,_0x510b84){var _0x32dd2e=util[_0xd448('0x7c')]('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x943b5b,encodeURIComponent(_0x2a369a),_0x4b42a2,_0x510b84);var _0x2cbe29=path[_0xd448('0x24')](__dirname,_0xd448('0x35'),rs[_0xd448('0x25')](0x4)+'.mp3');var _0x2dc4ab;return downloadFile(_0x32dd2e,_0x2cbe29)['then'](function(){_0x2dc4ab=path[_0xd448('0x24')](__dirname,_0xd448('0x35'),rs[_0xd448('0x25')](0x4)+_0xd448('0x3b'));return convertFile(_0x2cbe29,_0x2dc4ab);})[_0xd448('0x28')](function(){try{fs[_0xd448('0x3c')](_0x2cbe29);fs[_0xd448('0x3a')](_0x2dc4ab,_0xd448('0x29'));}catch(_0x17bb91){logger[_0xd448('0x12')](_0x17bb91);}return _0x2dc4ab['split']('.')[0x0];});};exports['ispeechASR']=function(_0x5d7500,_0x45fcb3,_0x442309,_0x1dafbf){var _0x340544=util[_0xd448('0x7c')](_0xd448('0x7d'),ISPEECH_API,_0x45fcb3,_0x442309,base64Encode(_0x5d7500),_0x1dafbf?util[_0xd448('0x7c')](_0xd448('0x7e'),encodeURIComponent(_0x1dafbf)):_0xd448('0x7f'));return uploadFile(_0x340544)[_0xd448('0x28')](function(_0x1874ee){return querystring[_0xd448('0x80')](_0x1874ee);});};exports[_0xd448('0x81')]=function(_0x49c92b,_0x45f5c2){return sestek[_0xd448('0x82')](_0x49c92b,_0x45f5c2)[_0xd448('0x28')](function(_0x52534c){logger[_0xd448('0x18')](JSON[_0xd448('0x41')](_0x52534c));var _0x3c2695={'speech':_0x52534c['text'],'action':_0x52534c[_0xd448('0x83')]?_0x52534c[_0xd448('0x83')][_0xd448('0x84')]:undefined,'actiondata':_0x52534c[_0xd448('0x83')]?_0x52534c[_0xd448('0x83')][_0xd448('0x85')]:undefined};if(_0x52534c[_0xd448('0x83')]&&_0x52534c[_0xd448('0x83')][_0xd448('0x86')]){return base64Decode(_0x52534c['channelData'][_0xd448('0x86')][_0xd448('0x87')],path['resolve'](__dirname,_0xd448('0x35'),rs[_0xd448('0x25')](0x4)+_0xd448('0x3b')))[_0xd448('0x28')](function(_0x4671a5){_0x3c2695[_0xd448('0x88')]=_0x4671a5;return _0x3c2695;});}return _0x3c2695;});};exports[_0xd448('0x89')]=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 e625e08..afe3cf6 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 _0xb2b6=['exports','./nda'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb2b6,0xf1));var _0x6b2b=function(_0x122258,_0x208088){_0x122258=_0x122258-0x0;var _0x356b88=_0xb2b6[_0x122258];return _0x356b88;};var nda=require(_0x6b2b('0x0'));module[_0x6b2b('0x1')]={'nda':nda}; \ No newline at end of file +var _0xc886=['exports','./nda'];(function(_0x17406e,_0x1049fd){var _0x2bfc5a=function(_0x2aae05){while(--_0x2aae05){_0x17406e['push'](_0x17406e['shift']());}};_0x2bfc5a(++_0x1049fd);}(_0xc886,0x135));var _0x6c88=function(_0x11fdb4,_0x126ff0){_0x11fdb4=_0x11fdb4-0x0;var _0x7a2344=_0xc886[_0x11fdb4];return _0x7a2344;};var nda=require(_0x6c88('0x0'));module[_0x6c88('0x1')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index bf1a285..98eef74 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 _0x8ce3=['custom_action_data','CustomActionData','stringify','request-promise','url','agi','exports','POST','resolve','ndauth_url','password','username','then','/api/NaturalDialogAssistant/v1/Run','message','Nda','uniqueid','callerid','calleridname','dnid','extension','text','Bearer\x20','access_token','project','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action'];(function(_0x214ed0,_0x3e45e8){var _0x5eb20e=function(_0x289182){while(--_0x289182){_0x214ed0['push'](_0x214ed0['shift']());}};_0x5eb20e(++_0x3e45e8);}(_0x8ce3,0xc3));var _0x38ce=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x8ce3[_0x27af45];return _0x18df21;};'use strict';var rp=require(_0x38ce('0x0'));var url=require(_0x38ce('0x1'));var logger=require('../../../../../config/logger')(_0x38ce('0x2'));module[_0x38ce('0x3')]=function(_0xee1d0e,_0x26ec48){var _0x1b4dd4={'method':_0x38ce('0x4'),'uri':url[_0x38ce('0x5')](_0x26ec48[_0x38ce('0x6')],'/token'),'form':{'grant_type':_0x38ce('0x7'),'username':_0x26ec48[_0x38ce('0x8')],'password':_0x26ec48['password']},'json':!![]};return rp(_0x1b4dd4)[_0x38ce('0x9')](function(_0xbe7332){var _0x3f8011={'method':'POST','uri':url[_0x38ce('0x5')](_0x26ec48['ndassistant_url'],_0x38ce('0xa')),'body':{'type':_0x26ec48['ndaactivity_type']||_0x38ce('0xb'),'channelId':_0x38ce('0xc'),'conversation':{'id':_0xee1d0e[_0x38ce('0xd')]},'from':{'id':_0xee1d0e[_0x38ce('0xe')],'name':_0xee1d0e[_0x38ce('0xf')]},'recipient':{'id':_0xee1d0e[_0x38ce('0x10')],'name':_0xee1d0e[_0x38ce('0x11')]},'text':_0x26ec48[_0x38ce('0x12')],'channelData':{}},'headers':{'Authorization':_0x38ce('0x13')+_0xbe7332[_0x38ce('0x14')]},'json':!![]};if(_0x26ec48[_0x38ce('0x15')]){_0x3f8011[_0x38ce('0x16')][_0x38ce('0x17')][_0x38ce('0x18')]=_0x26ec48[_0x38ce('0x15')];}if(_0x26ec48[_0x38ce('0x19')]=='1'){_0x3f8011['body']['channelData'][_0x38ce('0x1a')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x38ce('0x1b')};}if(_0x26ec48[_0x38ce('0x1c')]){_0x3f8011['body'][_0x38ce('0x17')]['CustomAction']=_0x26ec48[_0x38ce('0x1c')];if(_0x26ec48[_0x38ce('0x1d')]){_0x3f8011['body'][_0x38ce('0x17')][_0x38ce('0x1e')]=_0x26ec48[_0x38ce('0x1d')];}}logger['info'](JSON[_0x38ce('0x1f')](_0x3f8011));return rp(_0x3f8011);});}; \ No newline at end of file +var _0x43c8=['/token','password','username','then','ndassistant_url','message','uniqueid','callerid','calleridname','dnid','text','Bearer\x20','access_token','project','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action','CustomAction','custom_action_data','info','stringify','url','agi','exports','POST','resolve'];(function(_0x140d73,_0x4df2e8){var _0x524de7=function(_0x4bddbb){while(--_0x4bddbb){_0x140d73['push'](_0x140d73['shift']());}};_0x524de7(++_0x4df2e8);}(_0x43c8,0xaf));var _0x843c=function(_0x5b2509,_0x4a5729){_0x5b2509=_0x5b2509-0x0;var _0x373e1b=_0x43c8[_0x5b2509];return _0x373e1b;};'use strict';var rp=require('request-promise');var url=require(_0x843c('0x0'));var logger=require('../../../../../config/logger')(_0x843c('0x1'));module[_0x843c('0x2')]=function(_0x254ff3,_0x302fdb){var _0x227b2a={'method':_0x843c('0x3'),'uri':url[_0x843c('0x4')](_0x302fdb['ndauth_url'],_0x843c('0x5')),'form':{'grant_type':_0x843c('0x6'),'username':_0x302fdb[_0x843c('0x7')],'password':_0x302fdb[_0x843c('0x6')]},'json':!![]};return rp(_0x227b2a)[_0x843c('0x8')](function(_0x49aee7){var _0x327327={'method':_0x843c('0x3'),'uri':url['resolve'](_0x302fdb[_0x843c('0x9')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x302fdb['ndaactivity_type']||_0x843c('0xa'),'channelId':'Nda','conversation':{'id':_0x254ff3[_0x843c('0xb')]},'from':{'id':_0x254ff3[_0x843c('0xc')],'name':_0x254ff3[_0x843c('0xd')]},'recipient':{'id':_0x254ff3[_0x843c('0xe')],'name':_0x254ff3['extension']},'text':_0x302fdb[_0x843c('0xf')],'channelData':{}},'headers':{'Authorization':_0x843c('0x10')+_0x49aee7[_0x843c('0x11')]},'json':!![]};if(_0x302fdb[_0x843c('0x12')]){_0x327327[_0x843c('0x13')][_0x843c('0x14')][_0x843c('0x15')]=_0x302fdb[_0x843c('0x12')];}if(_0x302fdb[_0x843c('0x16')]=='1'){_0x327327[_0x843c('0x13')][_0x843c('0x14')][_0x843c('0x17')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x843c('0x18')};}if(_0x302fdb[_0x843c('0x19')]){_0x327327[_0x843c('0x13')]['channelData'][_0x843c('0x1a')]=_0x302fdb[_0x843c('0x19')];if(_0x302fdb[_0x843c('0x1b')]){_0x327327[_0x843c('0x13')][_0x843c('0x14')]['CustomActionData']=_0x302fdb[_0x843c('0x1b')];}}logger[_0x843c('0x1c')](JSON[_0x843c('0x1d')](_0x327327));return rp(_0x327327);});}; \ 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 36961e1..89aebcd 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 _0x4007=['exports'];(function(_0x5d1d4d,_0x2b019e){var _0x140f66=function(_0x73213a){while(--_0x73213a){_0x5d1d4d['push'](_0x5d1d4d['shift']());}};_0x140f66(++_0x2b019e);}(_0x4007,0xcd));var _0x7400=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x4007[_0x2dafbe];return _0x58a45a;};'use strict';var asr=require('./lib/api');module[_0x7400('0x0')]=function(_0x5d67f0,_0x3f0c3a,_0x1416c3,_0x4371eb){return asr(_0x5d67f0,_0x3f0c3a,_0x1416c3,_0x4371eb);}; \ No newline at end of file +var _0x862a=['./lib/api'];(function(_0x4a125b,_0x5568d0){var _0x2b28bf=function(_0x25521f){while(--_0x25521f){_0x4a125b['push'](_0x4a125b['shift']());}};_0x2b28bf(++_0x5568d0);}(_0x862a,0x147));var _0xa862=function(_0x33154d,_0x854047){_0x33154d=_0x33154d-0x0;var _0x3b2f03=_0x862a[_0x33154d];return _0x3b2f03;};'use strict';var asr=require(_0xa862('0x0'));module['exports']=function(_0x54f4e4,_0x2661d8,_0x50df47,_0x733c6){return asr(_0x54f4e4,_0x2661d8,_0x50df47,_0x733c6);}; \ 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 7c1d7f9..9353c08 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 _0xfe82=['close','EOS','stringify','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','error','Tilde\x20ASR\x20parse\x20error','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','bluebird','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','update','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','createReadStream'];(function(_0x54e217,_0x243297){var _0x590ead=function(_0x2f1d78){while(--_0x2f1d78){_0x54e217['push'](_0x54e217['shift']());}};_0x590ead(++_0x243297);}(_0xfe82,0xed));var _0x2fe8=function(_0x51e7b2,_0x3f1fc7){_0x51e7b2=_0x51e7b2-0x0;var _0x2d3a33=_0xfe82[_0x51e7b2];return _0x2d3a33;};'use strict';var BPromise=require(_0x2fe8('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require('crypto');var logger=require(_0x2fe8('0x1'))(_0x2fe8('0x2'));module[_0x2fe8('0x3')]=function(_0x25d83e,_0x2a5e79,_0x3a50e4,_0x1d9043){return new BPromise(function(_0x5a885b,_0x44483e){logger[_0x2fe8('0x4')](_0x2fe8('0x5'),_0x1d9043||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x52a03e=new WebSocket(_0x1d9043||_0x2fe8('0x6'),{'perMessageDeflate':![]});var _0x167a83='';var _0x8b60f6='0';var _0x3b565d='1';var _0x2e7641=_0x2fe8('0x7');function _0x12990b(_0x3f2175){var _0x3203b8=crypto[_0x2fe8('0x8')]('sha1');_0x3203b8[_0x2fe8('0x9')](_0x3f2175);return _0x3203b8['digest'](_0x2fe8('0xa'));}function _0x4019e9(){try{logger[_0x2fe8('0x4')](_0x2fe8('0xb'));var _0x53d215=moment()[_0x2fe8('0xc')]();var _0x4c76a2=_0x12990b(_0x53d215+_0x2a5e79+_0x3a50e4);_0x52a03e[_0x2fe8('0xd')](JSON['stringify']({'appID':_0x2a5e79,'timestamp':_0x53d215,'appKey':_0x4c76a2}));var _0x2755c2=fs[_0x2fe8('0xe')](_0x25d83e);_0x2755c2['on']('data',function(_0x4c25c7){_0x52a03e[_0x2fe8('0xd')](_0x4c25c7);});_0x2755c2['on'](_0x2fe8('0xf'),function(){_0x52a03e['send'](_0x2fe8('0x10'));});}catch(_0x36afb7){logger['error']('Tilde\x20ASR\x20send\x20error',JSON[_0x2fe8('0x11')](_0x36afb7));_0x52a03e[_0x2fe8('0x12')]();}}function _0x372956(_0x225c27){try{if(_0x225c27){var _0x5f4ea9=JSON[_0x2fe8('0x13')](_0x225c27);switch(_0x5f4ea9[_0x2fe8('0x14')]){case 0x0:if(_0x5f4ea9['result']){if(_0x5f4ea9[_0x2fe8('0x15')][_0x2fe8('0x16')]){logger['info'](_0x2fe8('0x17'),JSON[_0x2fe8('0x11')](_0x5f4ea9[_0x2fe8('0x15')][_0x2fe8('0x18')]));_0x167a83=_0x5f4ea9[_0x2fe8('0x15')][_0x2fe8('0x18')][0x0][_0x2fe8('0x19')];_0x8b60f6=_0x5f4ea9[_0x2fe8('0x15')][_0x2fe8('0x18')][0x0]['likelihood'];_0x3b565d='0';_0x2e7641='Success.';_0x52a03e[_0x2fe8('0x12')]();}}break;case 0x1:logger[_0x2fe8('0x4')](_0x2fe8('0x7'));_0x3b565d='1';_0x2e7641=_0x2fe8('0x7');break;case 0x2:logger[_0x2fe8('0x4')](_0x2fe8('0x1a'));_0x3b565d='2';_0x2e7641=_0x2fe8('0x1a');break;case 0x9:logger[_0x2fe8('0x4')](_0x2fe8('0x1b'));_0x3b565d='9';_0x2e7641=_0x2fe8('0x1b');break;case 0xa:logger[_0x2fe8('0x4')](_0x2fe8('0x1c'));_0x3b565d='10';_0x2e7641='Authentication\x20failed.';break;case 0xb:logger[_0x2fe8('0x4')](_0x2fe8('0x1d'));_0x3b565d='11';_0x2e7641=_0x2fe8('0x1d');}}}catch(_0x45a0d4){logger[_0x2fe8('0x1e')](_0x2fe8('0x1f'),JSON[_0x2fe8('0x11')](_0x45a0d4));_0x52a03e[_0x2fe8('0x12')]();}}function _0x1f160f(){logger[_0x2fe8('0x4')]('Close\x20Tilde\x20ASR\x20socket');_0x5a885b({'transcript':_0x167a83,'confidence':_0x8b60f6,'status':_0x3b565d,'status_message':_0x2e7641});}function _0x1b95b0(_0x2d92de){logger[_0x2fe8('0x1e')](_0x2fe8('0x20'));if(!_[_0x2fe8('0x21')](_0x2d92de)){logger[_0x2fe8('0x1e')](_[_0x2fe8('0x22')](_0x2d92de)?JSON[_0x2fe8('0x11')](_0x2d92de):_0x2d92de);}}_0x52a03e['on'](_0x2fe8('0x23'),_0x4019e9);_0x52a03e['on']('message',_0x372956);_0x52a03e['on'](_0x2fe8('0xf'),_0x1f160f);_0x52a03e['on'](_0x2fe8('0x1e'),_0x1b95b0);});}; \ No newline at end of file +var _0xfa95=['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','info','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','data','close','EOS','error','parse','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Success.','terminate','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','bluebird','lodash','moment','crypto'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xfa95,0x71));var _0x5fa9=function(_0x448f8,_0x2aa1d7){_0x448f8=_0x448f8-0x0;var _0xa73126=_0xfa95[_0x448f8];return _0xa73126;};'use strict';var BPromise=require(_0x5fa9('0x0'));var _=require(_0x5fa9('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x5fa9('0x2'));var crypto=require(_0x5fa9('0x3'));var logger=require('../../../../../../config/logger')('agi');module['exports']=function(_0x1e78b4,_0x2b46cb,_0x20c7dc,_0x3a6175){return new BPromise(function(_0x2d7ca3,_0x439d81){logger['info']('Tilde\x20URI',_0x3a6175||_0x5fa9('0x4'));var _0x56f832=new WebSocket(_0x3a6175||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x2b95ee='';var _0x1bd9f3='0';var _0x146d26='1';var _0x294353=_0x5fa9('0x5');function _0x3b9a45(_0x3ae42f){var _0xa6d445=crypto[_0x5fa9('0x6')]('sha1');_0xa6d445[_0x5fa9('0x7')](_0x3ae42f);return _0xa6d445[_0x5fa9('0x8')](_0x5fa9('0x9'));}function _0x319306(){try{logger[_0x5fa9('0xa')](_0x5fa9('0xb'));var _0x198ac4=moment()[_0x5fa9('0xc')]();var _0x3c7a67=_0x3b9a45(_0x198ac4+_0x2b46cb+_0x20c7dc);_0x56f832[_0x5fa9('0xd')](JSON[_0x5fa9('0xe')]({'appID':_0x2b46cb,'timestamp':_0x198ac4,'appKey':_0x3c7a67}));var _0x708b3f=fs[_0x5fa9('0xf')](_0x1e78b4);_0x708b3f['on'](_0x5fa9('0x10'),function(_0x5e4bb5){_0x56f832[_0x5fa9('0xd')](_0x5e4bb5);});_0x708b3f['on'](_0x5fa9('0x11'),function(){_0x56f832[_0x5fa9('0xd')](_0x5fa9('0x12'));});}catch(_0x4c144b){logger[_0x5fa9('0x13')]('Tilde\x20ASR\x20send\x20error',JSON[_0x5fa9('0xe')](_0x4c144b));_0x56f832['terminate']();}}function _0x39f0be(_0x4b820f){try{if(_0x4b820f){var _0x26770c=JSON[_0x5fa9('0x14')](_0x4b820f);switch(_0x26770c['status']){case 0x0:if(_0x26770c[_0x5fa9('0x15')]){if(_0x26770c['result'][_0x5fa9('0x16')]){logger[_0x5fa9('0xa')](_0x5fa9('0x17'),JSON['stringify'](_0x26770c[_0x5fa9('0x15')][_0x5fa9('0x18')]));_0x2b95ee=_0x26770c[_0x5fa9('0x15')][_0x5fa9('0x18')][0x0][_0x5fa9('0x19')];_0x1bd9f3=_0x26770c[_0x5fa9('0x15')][_0x5fa9('0x18')][0x0][_0x5fa9('0x1a')];_0x146d26='0';_0x294353=_0x5fa9('0x1b');_0x56f832[_0x5fa9('0x1c')]();}}break;case 0x1:logger[_0x5fa9('0xa')](_0x5fa9('0x5'));_0x146d26='1';_0x294353=_0x5fa9('0x5');break;case 0x2:logger[_0x5fa9('0xa')](_0x5fa9('0x1d'));_0x146d26='2';_0x294353=_0x5fa9('0x1d');break;case 0x9:logger[_0x5fa9('0xa')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x146d26='9';_0x294353=_0x5fa9('0x1e');break;case 0xa:logger[_0x5fa9('0xa')](_0x5fa9('0x1f'));_0x146d26='10';_0x294353=_0x5fa9('0x1f');break;case 0xb:logger['info']('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x146d26='11';_0x294353=_0x5fa9('0x20');}}}catch(_0x3cbc2a){logger[_0x5fa9('0x13')](_0x5fa9('0x21'),JSON[_0x5fa9('0xe')](_0x3cbc2a));_0x56f832[_0x5fa9('0x1c')]();}}function _0x39d18e(){logger[_0x5fa9('0xa')](_0x5fa9('0x22'));_0x2d7ca3({'transcript':_0x2b95ee,'confidence':_0x1bd9f3,'status':_0x146d26,'status_message':_0x294353});}function _0x27dde4(_0x3314d2){logger['error']('Error\x20Tilde\x20ASR\x20socket');if(!_[_0x5fa9('0x23')](_0x3314d2)){logger[_0x5fa9('0x13')](_[_0x5fa9('0x24')](_0x3314d2)?JSON['stringify'](_0x3314d2):_0x3314d2);}}_0x56f832['on'](_0x5fa9('0x25'),_0x319306);_0x56f832['on'](_0x5fa9('0x26'),_0x39f0be);_0x56f832['on'](_0x5fa9('0x11'),_0x39d18e);_0x56f832['on']('error',_0x27dde4);});}; \ 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 24ed0cf..62ee91b 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 _0xd807=['./asr','exports'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0xd807,0xe8));var _0x7d80=function(_0x852def,_0x54d9e8){_0x852def=_0x852def-0x0;var _0x2f703c=_0xd807[_0x852def];return _0x2f703c;};var asr=require(_0x7d80('0x0'));module[_0x7d80('0x1')]={'asr':asr}; \ No newline at end of file +var _0xf8a9=['./asr'];(function(_0x388833,_0x4130f8){var _0x28a100=function(_0x1267db){while(--_0x1267db){_0x388833['push'](_0x388833['shift']());}};_0x28a100(++_0x4130f8);}(_0xf8a9,0x102));var _0x9f8a=function(_0x2f0b10,_0x18f1a1){_0x2f0b10=_0x2f0b10-0x0;var _0xd52c6c=_0xf8a9[_0x2f0b10];return _0xd52c6c;};var asr=require(_0x9f8a('0x0'));module['exports']={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index c705806..b989eec 100644 --- a/server/services/agi/server.js +++ b/server/services/agi/server.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['./error','./channel','127.0.0.1','call','emit','error','createServer','listen','listening','getConnections','destroy','E_AGI_SERVER_MAXCONNECTION','ready','connection','E_AGI_SERVER_ERROR','code','close','E_AGI_SERVER_CLOSE','nextTick','events','EventEmitter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9c44,0x178));var _0x49c4=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x9c44[_0x5f1391];return _0x50ebe3;};'use strict';var util=require('util');var net=require('net');var EventEmitter=require(_0x49c4('0x0'))[_0x49c4('0x1')];var AGIError=require(_0x49c4('0x2'));var AGIChannel=require(_0x49c4('0x3'));var AGIServer=function(_0x455700,_0x2ad237,_0x4e0313){var _0x4941f1=this;var _0x41a183=null;var _0x57effd=0x0;if(!_0x455700)_0x455700=0x11dd;if(!_0x2ad237)_0x2ad237=_0x49c4('0x4');EventEmitter[_0x49c4('0x5')](_0x4941f1);function _0x69bc41(){if(!_0x455700){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x41a183=net[_0x49c4('0x8')]();_0x41a183[_0x49c4('0x9')](_0x455700,_0x2ad237);_0x41a183['on'](_0x49c4('0xa'),function(){_0x4941f1[_0x49c4('0x6')]('listening');});_0x41a183['on']('connection',function(_0x451ea6){_0x41a183[_0x49c4('0xb')](function(_0x58cad7,_0xb611a1){if(_0x58cad7){_0x4941f1[_0x49c4('0x6')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x58cad7));}else if(_0x4e0313&&_0x4e0313<0x0){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x451ea6[_0x49c4('0xc')]();}else if(_0x4e0313&&_0x4e0313>0x0&&_0x4e0313<_0xb611a1){_0x57effd+=0x1;_0x4941f1[_0x49c4('0x6')]('error',new AGIError(_0x49c4('0xd'),_0x57effd));_0x451ea6[_0x49c4('0xc')]();}else{var _0x21f15a=new AGIChannel(_0x451ea6);_0x21f15a['on'](_0x49c4('0xe'),function(){_0x4941f1[_0x49c4('0x6')](_0x49c4('0xf'),_0x21f15a);});}});});_0x41a183['on'](_0x49c4('0x7'),function(_0x3de397){_0x4941f1['emit'](_0x49c4('0x7'),new AGIError(_0x49c4('0x10'),_0x3de397[_0x49c4('0x11')]));});_0x41a183['on'](_0x49c4('0x12'),function(){_0x4941f1[_0x49c4('0x6')]('close',new AGIError(_0x49c4('0x13')));});}process[_0x49c4('0x14')](function(){_0x69bc41();});};util['inherits'](AGIServer,EventEmitter);module['exports']=function(_0x3c782d,_0x2f82d5,_0x3addb2){return new AGIServer(_0x3c782d,_0x2f82d5,_0x3addb2);}; \ No newline at end of file +var _0xa9e0=['ready','E_AGI_SERVER_ERROR','close','E_AGI_SERVER_CLOSE','inherits','exports','util','net','events','./channel','call','emit','createServer','listening','connection','getConnections','error','E_AGI_SERVER_VOICE_DISABLED','destroy'];(function(_0x25280c,_0x2edec1){var _0x3a58c3=function(_0x5292a0){while(--_0x5292a0){_0x25280c['push'](_0x25280c['shift']());}};_0x3a58c3(++_0x2edec1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa9e0[_0x2a6809];return _0x11c371;};'use strict';var util=require(_0x0a9e('0x0'));var net=require(_0x0a9e('0x1'));var EventEmitter=require(_0x0a9e('0x2'))['EventEmitter'];var AGIError=require('./error');var AGIChannel=require(_0x0a9e('0x3'));var AGIServer=function(_0x4ce2f1,_0x333808,_0x432180){var _0x2ab90b=this;var _0x991246=null;var _0x981158=0x0;if(!_0x4ce2f1)_0x4ce2f1=0x11dd;if(!_0x333808)_0x333808='127.0.0.1';EventEmitter[_0x0a9e('0x4')](_0x2ab90b);function _0x441e3a(){if(!_0x4ce2f1){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x991246=net[_0x0a9e('0x6')]();_0x991246['listen'](_0x4ce2f1,_0x333808);_0x991246['on']('listening',function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x7'));});_0x991246['on'](_0x0a9e('0x8'),function(_0x3ab53f){_0x991246[_0x0a9e('0x9')](function(_0xbd1168,_0x4a4c56){if(_0xbd1168){_0x2ab90b['emit']('error',new AGIError('E_AGI_SERVER_ERROR',_0xbd1168));}else if(_0x432180&&_0x432180<0x0){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError(_0x0a9e('0xb')));_0x3ab53f[_0x0a9e('0xc')]();}else if(_0x432180&&_0x432180>0x0&&_0x432180<_0x4a4c56){_0x981158+=0x1;_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x981158));_0x3ab53f[_0x0a9e('0xc')]();}else{var _0x239b12=new AGIChannel(_0x3ab53f);_0x239b12['on'](_0x0a9e('0xd'),function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x8'),_0x239b12);});}});});_0x991246['on'](_0x0a9e('0xa'),function(_0x52a03d){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError(_0x0a9e('0xe'),_0x52a03d['code']));});_0x991246['on'](_0x0a9e('0xf'),function(){_0x2ab90b[_0x0a9e('0x5')]('close',new AGIError(_0x0a9e('0x10')));});}process['nextTick'](function(){_0x441e3a();});};util[_0x0a9e('0x11')](AGIServer,EventEmitter);module[_0x0a9e('0x12')]=function(_0x106033,_0x205fd6,_0x31b1ca){return new AGIServer(_0x106033,_0x205fd6,_0x31b1ca);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 69ee902..8aba8b2 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 _0x3de3=['tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Google\x20TTS\x20%s\x20file\x20created','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','util','shelljs','odbc','moment','mustache','request-promise','../../config/logger','../../config/environment','../../config/environment/shared','/var/opt/motion2/server/files','rawBody','menu','getdigits','rpc','mailRpc','prototype','getVariable','getVariableById','then','name','getVoiceQueueById','catch','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getMailAccount','sendMailMessage','getIntervalById','IntervalId','interval','Intervals','getSoundPath','format','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','channel','arg_1','callerid','createSquareRecording','calleridname','extension','priority','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','lastName','phone','list_id','scheduledAt','toString','callback_priority','getPause','getPauseById','agentPause','agent','agentLogout','%s/%s@from-sip/n','LOCAL','agentLogin','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','audioEncoding','MP3','googleTTS','google_tts_language','url','method','number','timeout','includes','PUT','body','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','parse','rawHeaders','computedVariables','stringify','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','ispeechASR','model','awsPolly','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_access_key_id','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appsecret','uri','clear','clone','isString','replaceObjectAllVariables','replaceAllVariables','hasOwnProperty','isPlainObject','recursiveNodeIndex','isArray','length','saveRestApiResult','%s.%s','setVariable','split','replaceAll','extra','getAndSetVariable','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','isConfigured','maxRetry','mrcpsynth','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','no\x20grammar\x20configured','result','RECOG_CONFIDENCE()','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','agi','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','no\x20list\x20selected','delay','minutes','sync','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','Executed\x20command\x20%s\x20%s','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','grammar','MRCPRecog','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_INSTANCE','sestekasr','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','odbc_id','no\x20query\x20configured','query:\x20%s','no\x20variable\x20selected\x20for\x20the\x20result','variable_id','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','sip_id','no\x20user\x20selected','DIAL','opts','Executed\x20command\x20%s','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','dialogflow','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20anguage\x20configured','providerResponse','dialogflowV2','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','no\x20ndauth\x20url\x20configured','ndassistant_url','bot','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','toUpperCase','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','file_id','no\x20file\x20audio\x20found','getData','response','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','amazonlex','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','appid','no\x20appid\x20configured','no\x20appsecret\x20configured','wav','%s/recordings/%s','beep','tilde\x20%s\x20file\x20created','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','getIntervals','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','no\x20find\x20by\x20configured','AGENT\x20%s\x20FOUND\x20BY','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20selected','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','success','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','getVoiceQueue','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','restAPI','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','bcc','subject','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','no\x20sms\x20account\x20configured','sms_account_id','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','Enter\x20in\x20START\x20(%s)\x20block','yes','Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','host','system','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','no\x20apiKey\x20configured','Google\x20Cloud\x20TTS\x20is\x20unreachable'];(function(_0x52410a,_0x1b8af8){var _0x417d25=function(_0xf2debf){while(--_0xf2debf){_0x52410a['push'](_0x52410a['shift']());}};_0x417d25(++_0x1b8af8);}(_0x3de3,0x1ce));var _0x33de=function(_0x4d6eb3,_0x5a866f){_0x4d6eb3=_0x4d6eb3-0x0;var _0x2c9bba=_0x3de3[_0x4d6eb3];return _0x2c9bba;};'use strict';var fs=require('fs');var util=require(_0x33de('0x0'));var _=require('lodash');var sh=require(_0x33de('0x1'));var odbc=require(_0x33de('0x2'))();var rs=require('randomstring');var moment=require(_0x33de('0x3'));var Mustache=require(_0x33de('0x4'));var rp=require(_0x33de('0x5'));var logger=require(_0x33de('0x6'))('agi');var config=require(_0x33de('0x7'));var shared=require(_0x33de('0x8'));var scripts=require('./scripts');var FILES_PATH=_0x33de('0x9');var recursiveMapAttributes=['rawHeaders',_0x33de('0xa')];var verticesWithRetry=[_0x33de('0xb'),_0x33de('0xc'),'getsecretdigits'];var AGIVertices=function(_0x2074fe,_0x2c46d1,_0x2e0419){this['channel']=_0x2074fe;this[_0x33de('0xd')]=_0x2c46d1;this[_0x33de('0xe')]=_0x2e0419;};AGIVertices[_0x33de('0xf')][_0x33de('0x10')]=function(_0x330047,_0x189634){this[_0x33de('0xd')][_0x33de('0x11')](_0x330047)[_0x33de('0x12')](function(_0x306efc){_0x189634(null,_0x306efc?_0x306efc[_0x33de('0x13')]:![]);})['catch'](function(_0x6b1a4c){_0x189634(_0x6b1a4c);});};AGIVertices[_0x33de('0xf')]['getVoiceQueue']=function(_0x5392c0,_0x4164ab){this[_0x33de('0xd')][_0x33de('0x14')](_0x5392c0)[_0x33de('0x12')](function(_0x57aa73){_0x4164ab(null,_0x57aa73?_0x57aa73[_0x33de('0x13')]:![]);})[_0x33de('0x15')](function(_0x522ba0){_0x4164ab(_0x522ba0);});};AGIVertices['prototype'][_0x33de('0x16')]=function(_0x16c050,_0x13e832){this['rpc'][_0x33de('0x17')](_0x16c050)[_0x33de('0x12')](function(_0x52cfa0){_0x13e832(null,_0x52cfa0?_0x52cfa0[_0x33de('0x13')]:![]);})[_0x33de('0x15')](function(_0x482667){_0x13e832(_0x482667);});};AGIVertices['prototype'][_0x33de('0x18')]=function(_0x52d718,_0x16255f){this[_0x33de('0xd')][_0x33de('0x19')](_0x52d718)[_0x33de('0x12')](function(_0xc4f1a4){_0x16255f(null,_0xc4f1a4?_0xc4f1a4[_0x33de('0x1a')]:![]);})[_0x33de('0x15')](function(_0x493263){_0x16255f(_0x493263);});};AGIVertices['prototype'][_0x33de('0x1b')]=function(_0x5af3fa,_0x8acd8d){this['rpc'][_0x33de('0x1c')](_0x5af3fa)[_0x33de('0x12')](function(_0x575e88){_0x8acd8d(null,_0x575e88?_0x575e88[_0x33de('0x13')]:![]);})['catch'](function(_0x67d040){_0x8acd8d(_0x67d040);});};AGIVertices['prototype'][_0x33de('0x1d')]=function(_0x24e282,_0x1e3c61){this['rpc'][_0x33de('0x1e')](_0x24e282)[_0x33de('0x12')](function(_0x140979){_0x1e3c61(null,_0x140979?_0x140979['name']:![]);})[_0x33de('0x15')](function(_0x5585a2){_0x1e3c61(_0x5585a2);});};AGIVertices['prototype'][_0x33de('0x1f')]=function(_0x17c760,_0x1a870a){var _0x208d0d=this;this[_0x33de('0xd')][_0x33de('0x20')](_0x17c760)[_0x33de('0x12')](function(_0x1b4703){_0x1a870a(null,_0x1b4703?_0x208d0d['getSoundPath'](_0x1b4703['save_name']):![]);})[_0x33de('0x15')](function(_0x1420d2){_0x1a870a(_0x1420d2);});};AGIVertices[_0x33de('0xf')][_0x33de('0x21')]=function(_0x167cec,_0x20f393){this[_0x33de('0xd')]['getMailAccountById'](_0x167cec)[_0x33de('0x12')](function(_0x1cee91){_0x20f393(null,_0x1cee91?_0x1cee91:![]);})[_0x33de('0x15')](function(_0x157e60){_0x20f393(_0x157e60);});};AGIVertices['prototype'][_0x33de('0x22')]=function(_0xf5d78a,_0x5a9c43,_0x5d2da4){this['mailRpc'][_0x33de('0x22')](_0xf5d78a,_0x5a9c43)[_0x33de('0x12')](function(){_0x5d2da4(null);})['catch'](function(_0x1d0194){_0x5d2da4(_0x1d0194);});};AGIVertices['prototype']['getIntervals']=function(_0xe61fb9,_0x2c8656){this[_0x33de('0xd')][_0x33de('0x23')](_0xe61fb9)[_0x33de('0x12')](function(_0xc452ed){if(_0xc452ed){if(_0xc452ed[_0x33de('0x24')]){_0x2c8656(null,[_0xc452ed[_0x33de('0x25')]]);}else{_0x2c8656(null,_['map'](_0xc452ed[_0x33de('0x26')],'interval'));}}else{_0x2c8656(null,![]);}})[_0x33de('0x15')](function(_0x57355b){_0x2c8656(_0x57355b);});};AGIVertices['prototype'][_0x33de('0x27')]=function(_0x3614e0){return util[_0x33de('0x28')](_0x33de('0x29'),FILES_PATH,_0x3614e0);};AGIVertices[_0x33de('0xf')][_0x33de('0x2a')]=function(_0x5cdc06,_0x95a5f5,_0x291947){odbc[_0x33de('0x2b')](_0x5cdc06,function(_0x1f81d2){if(_0x1f81d2){logger[_0x33de('0x2c')](_0x33de('0x2d'),_0x1f81d2);_0x291947(_0x1f81d2);}else{logger[_0x33de('0x2e')]('ODBC\x20connection\x20successfully');odbc[_0x33de('0x2f')](_0x95a5f5,function(_0x1497f0,_0xf4048f){if(_0x1497f0){logger[_0x33de('0x2e')](_0x33de('0x30'),_0x95a5f5);_0x291947(_0x1497f0);}else{logger[_0x33de('0x2e')](_0x33de('0x31'),_0x95a5f5);odbc['close'](function(_0x2f663f){if(_0x2f663f){logger[_0x33de('0x2c')](_0x33de('0x32'),_0x2f663f);}_0x291947(null,_0xf4048f);});}});}});};AGIVertices[_0x33de('0xf')][_0x33de('0x33')]=function(_0x640136,_0x58f236){this[_0x33de('0xd')]['getSmsAccountById'](_0x640136)[_0x33de('0x12')](function(_0x66897c){_0x58f236(null,_0x66897c?_0x66897c:![]);})['catch'](function(_0x198b72){_0x58f236(_0x198b72);});};AGIVertices[_0x33de('0xf')][_0x33de('0x34')]=function(_0x1de158,_0x127fde){this[_0x33de('0xd')][_0x33de('0x34')](_0x1de158)[_0x33de('0x12')](function(_0x48e0fc){_0x127fde(null,_0x48e0fc);})['catch'](function(_0x5101b9){_0x127fde(_0x5101b9);});};AGIVertices[_0x33de('0xf')][_0x33de('0x35')]=function(_0x20d04f,_0x376c55,_0x54acde){this[_0x33de('0xd')]['createSquareDetailsReport']({'uniqueid':this['channel'][_0x33de('0x36')],'node':_0x20d04f[_0x33de('0x37')],'application':_0x20d04f[_0x33de('0x38')],'data':_0x376c55||null,'project_name':this[_0x33de('0x39')][_0x33de('0x3a')],'callerid':this[_0x33de('0x39')][_0x33de('0x3b')]})['then'](function(_0x3b5530){if(_0x54acde){_0x54acde(null,_0x3b5530);}})['catch'](function(_0x2fbca6){if(_0x54acde){_0x54acde(_0x2fbca6);}});};AGIVertices['prototype'][_0x33de('0x3c')]=function(_0x2a2bf9,_0x5575ed,_0x18db5e,_0x2ff65d){this[_0x33de('0xd')]['createSquareRecording']({'uniqueid':this['channel'][_0x33de('0x36')],'callerid':this[_0x33de('0x39')]['callerid'],'calleridname':this['channel'][_0x33de('0x3d')],'context':this['channel']['context'],'extension':this['channel'][_0x33de('0x3e')],'priority':this[_0x33de('0x39')][_0x33de('0x3f')],'accountcode':this[_0x33de('0x39')]['accountcode'],'dnid':this['channel'][_0x33de('0x40')],'projectName':this[_0x33de('0x39')]['arg_1'],'saveName':_0x5575ed,'filename':_0x2a2bf9[_0x33de('0x41')]||_0x5575ed,'savePath':_0x18db5e})[_0x33de('0x12')](function(_0x23a5e7){_0x2ff65d(null,_0x23a5e7);})[_0x33de('0x15')](function(_0x3858dd){_0x2ff65d(_0x3858dd);});};AGIVertices['prototype'][_0x33de('0x42')]=function(_0x3bf2e3,_0x4fe3a2,_0x302573,_0xab2a13,_0xa8a579){this[_0x33de('0xd')][_0x33de('0x42')]({'uniqueid':this[_0x33de('0x39')][_0x33de('0x36')],'body':_0x3bf2e3,'direction':_0x4fe3a2,'providerName':_0x302573,'providerResponse':_0xab2a13})[_0x33de('0x12')](function(_0x24e428){if(_0xa8a579){_0xa8a579(null,_0x24e428);}})[_0x33de('0x15')](function(_0x4d9bfc){if(_0xa8a579){_0xa8a579(_0x4d9bfc);}});};AGIVertices[_0x33de('0xf')][_0x33de('0x43')]=function(_0x2e2cd7,_0x464502){this[_0x33de('0xd')][_0x33de('0x43')]({'firstName':_[_0x33de('0x44')](_0x2e2cd7['name'])||_[_0x33de('0x45')](_0x2e2cd7[_0x33de('0x13')])?_0x33de('0x46')+Math['random']():_0x2e2cd7[_0x33de('0x13')],'lastName':_[_0x33de('0x44')](_0x2e2cd7[_0x33de('0x47')])||_[_0x33de('0x45')](_0x2e2cd7['lastName'])?null:_0x2e2cd7['lastName'],'phone':_0x2e2cd7[_0x33de('0x48')],'ListId':_0x2e2cd7[_0x33de('0x49')],'scheduledat':_0x2e2cd7[_0x33de('0x4a')],'callbackUniqueid':this[_0x33de('0x39')][_0x33de('0x36')],'tags':'callback','description':'Callback\x20scheduled\x20at\x20'+_0x2e2cd7[_0x33de('0x4a')][_0x33de('0x4b')](),'priority':_0x2e2cd7[_0x33de('0x4c')]})[_0x33de('0x12')](function(_0x3bd3b1){_0x464502(null,_0x3bd3b1);})[_0x33de('0x15')](function(_0x663384){_0x464502(_0x663384);});};AGIVertices[_0x33de('0xf')][_0x33de('0x4d')]=function(_0x5de12f,_0x14c94c){this[_0x33de('0xd')][_0x33de('0x4e')](_0x5de12f)['then'](function(_0x1a34ea){_0x14c94c(null,_0x1a34ea?_0x1a34ea['name']:![]);})['catch'](function(_0x4dae6d){_0x14c94c(_0x4dae6d);});};AGIVertices['prototype'][_0x33de('0x4f')]=function(_0x36c4a2,_0x4d3a85,_0x397179){var _0x232840={'role':'agent'};_0x232840[_0x36c4a2]=this[_0x33de('0x39')][_0x33de('0x3b')];this['rpc'][_0x33de('0x4f')](_0x232840,_0x4d3a85,this[_0x33de('0x39')][_0x33de('0x36')])[_0x33de('0x12')](function(_0x125dd6){_0x397179(null,_[_0x33de('0x45')](_0x125dd6)?![]:!![]);})[_0x33de('0x15')](function(_0x4e1aa9){logger['error'](_0x4e1aa9);_0x397179(null,![]);});};AGIVertices[_0x33de('0xf')]['agentUnpause']=function(_0x2af340,_0x3eef03){var _0x4ca20f={'role':_0x33de('0x50')};_0x4ca20f[_0x2af340]=this['channel'][_0x33de('0x3b')];this[_0x33de('0xd')]['agentUnpause'](_0x4ca20f)['then'](function(_0x26d79c){_0x3eef03(null,_[_0x33de('0x45')](_0x26d79c)?![]:!![]);})[_0x33de('0x15')](function(_0x1b020c){logger[_0x33de('0x2c')](_0x1b020c);_0x3eef03(null,![]);});};AGIVertices['prototype'][_0x33de('0x51')]=function(_0x143124,_0x5d4ffd){var _0xa10291={'role':_0x33de('0x50')};_0xa10291[_0x143124]=this['channel'][_0x33de('0x3b')];this[_0x33de('0xd')]['agentLogout'](_0xa10291)['then'](function(_0xc2504a){_0x5d4ffd(null,_['isNil'](_0xc2504a)?![]:!![]);})[_0x33de('0x15')](function(_0x4803b8){logger[_0x33de('0x2c')](_0x4803b8);_0x5d4ffd(null,![]);});};AGIVertices['prototype']['agentLogin']=function(_0x5e3383,_0x4dac9c){var _0x50182b={'role':'agent'};_0x50182b[_0x5e3383]=this[_0x33de('0x39')]['callerid'];var _0x1a5b4f=_0x5e3383!='internal'?util['format'](_0x33de('0x52'),_0x33de('0x53'),this[_0x33de('0x39')][_0x33de('0x3b')]):undefined;this[_0x33de('0xd')][_0x33de('0x54')](_0x50182b,_0x1a5b4f)[_0x33de('0x12')](function(_0x659652){_0x4dac9c(null,_['isNil'](_0x659652)?![]:!![]);})[_0x33de('0x15')](function(_0x5b779c){logger[_0x33de('0x2c')](_0x5b779c);_0x4dac9c(null,![]);});};AGIVertices[_0x33de('0xf')][_0x33de('0x55')]=function(_0x3a8d6b,_0x8a9729){sh[_0x33de('0x56')](_[_0x33de('0x57')](_0x3a8d6b),function(_0x355b7d,_0x1ab321){var _0x2cfd36=_0x1ab321[_0x33de('0x58')](/(\r\n|\n|\r)/gm,'');_0x8a9729(null,_0x2cfd36);});};AGIVertices['prototype']['googleCloudTTS']=function(_0x516a33,_0x1179f6){scripts[_0x33de('0x59')](_0x516a33[_0x33de('0x5a')],_0x516a33[_0x33de('0x5b')]||_0x33de('0x5c'),_0x516a33[_0x33de('0x5c')],_0x516a33[_0x33de('0x5d')]||_0x33de('0x5e'),_0x516a33[_0x33de('0x5f')]||'MALE',_0x516a33[_0x33de('0x60')]||_0x33de('0x61'))[_0x33de('0x12')](function(_0x3f7262){_0x1179f6(null,_0x3f7262);})[_0x33de('0x15')](function(_0x2541d3){_0x1179f6(_0x2541d3);});};AGIVertices['prototype']['googleTTS']=function(_0x558c26,_0x1370ac){scripts[_0x33de('0x62')](_0x558c26[_0x33de('0x5c')],_0x558c26[_0x33de('0x63')]||'en',0x1)['then'](function(_0xc28b66){_0x1370ac(null,_0xc28b66);})[_0x33de('0x15')](function(_0x484827){_0x1370ac(_0x484827);});};AGIVertices['prototype']['restAPI']=function(_0x23aa74,_0x4630be){var _0x38d3dd={'uri':_0x23aa74[_0x33de('0x64')],'method':_0x23aa74[_0x33de('0x65')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x23aa74['timeout'])===_0x33de('0x66')&&parseInt(_0x23aa74['timeout'])>=0x1?parseInt(_0x23aa74[_0x33de('0x67')])*0x3e8:0x5*0x3e8};if(_[_0x33de('0x68')](['POST',_0x33de('0x69')],_0x38d3dd[_0x33de('0x65')]['toUpperCase']())){try{_0x38d3dd[_0x33de('0x6a')]=_0x23aa74['rawBody']?JSON['parse'](_0x23aa74[_0x33de('0xa')]):{};}catch(_0x2ef94d){logger[_0x33de('0x2c')](_0x33de('0x6b'),_0x2ef94d);}}try{_0x38d3dd[_0x33de('0x6c')]=_0x23aa74['rawHeaders']?JSON[_0x33de('0x6d')](_0x23aa74[_0x33de('0x6e')]):{};}catch(_0x24146d){logger[_0x33de('0x2c')]('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x24146d);}if(_0x23aa74[_0x33de('0x6f')]){try{var _0x3ffd20=require(_0x23aa74[_0x33de('0x6f')])['sync'](this,_0x38d3dd);_0x38d3dd['uri']=Mustache['render'](_0x23aa74['url'],_0x3ffd20,{},['$$','$$']);if(_0x38d3dd['headers']){_0x38d3dd[_0x33de('0x6c')]=JSON[_0x33de('0x6d')](Mustache['render'](JSON[_0x33de('0x70')](_0x38d3dd['headers']),_0x3ffd20,{},['$$','$$']));}if(_0x38d3dd['body']){_0x38d3dd[_0x33de('0x6a')]=JSON[_0x33de('0x6d')](Mustache['render'](JSON[_0x33de('0x70')](_0x38d3dd[_0x33de('0x6a')]),_0x3ffd20,{},['$$','$$']));}}catch(_0x58fff3){logger[_0x33de('0x2c')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x58fff3);}}rp(_0x38d3dd)[_0x33de('0x12')](function(_0x1d060d){var _0x487dac={'statusCode':_0x1d060d[_0x33de('0x71')]||0xc8,'statusMessage':_0x1d060d[_0x33de('0x72')]||'OK','headers':_0x1d060d['headers']||{},'body':_0x1d060d['body']||{}};_0x4630be(null,_0x487dac);})[_0x33de('0x15')](function(_0x276c26){var _0x1f4eb6={'statusCode':_0x276c26[_0x33de('0x71')]||0x1f4,'statusMessage':_0x276c26[_0x33de('0x73')]||_0x33de('0x74'),'headers':_0x276c26['options'][_0x33de('0x6c')]||{},'body':_0x276c26[_0x33de('0x75')][_0x33de('0x6a')]||{}};_0x4630be(null,_0x1f4eb6);});};AGIVertices[_0x33de('0xf')][_0x33de('0x76')]=function(_0x32c766,_0x289b31){scripts[_0x33de('0x76')](this[_0x33de('0x39')][_0x33de('0x36')],_0x32c766[_0x33de('0x77')],_0x32c766[_0x33de('0x5c')],_0x32c766[_0x33de('0x78')]||'en')[_0x33de('0x12')](function(_0x710e61){_0x289b31(null,_0x710e61);})[_0x33de('0x15')](function(_0x59b8f6){_0x289b31(_0x59b8f6);});};AGIVertices[_0x33de('0xf')][_0x33de('0x79')]=function(_0x44da87,_0x2dd8ae){scripts[_0x33de('0x79')](this['channel'][_0x33de('0x36')],_0x44da87[_0x33de('0x7a')],_0x44da87[_0x33de('0x7b')],_0x44da87[_0x33de('0x7c')],_0x44da87[_0x33de('0x5c')],_0x44da87[_0x33de('0x7d')]||'en')[_0x33de('0x12')](function(_0x20310c){_0x2dd8ae(null,_0x20310c);})[_0x33de('0x15')](function(_0x29f866){_0x2dd8ae(_0x29f866);});};AGIVertices['prototype']['sestekNDA']=function(_0x4472d1,_0x5629b2){scripts[_0x33de('0x7e')](this[_0x33de('0x39')],_0x4472d1)['then'](function(_0x42626f){_0x5629b2(null,_0x42626f);})[_0x33de('0x15')](function(_0x24beb7){_0x5629b2(_0x24beb7);});};AGIVertices['prototype']['ispeechTTS']=function(_0x574e2c,_0xe6b940){scripts[_0x33de('0x7f')](_0x574e2c['key'],_0x574e2c[_0x33de('0x5c')],_0x574e2c[_0x33de('0x80')]||_0x33de('0x5e'),_0x574e2c['speed'])[_0x33de('0x12')](function(_0x98ca94){_0xe6b940(null,_0x98ca94);})['catch'](function(_0x30a982){_0xe6b940(_0x30a982);});};AGIVertices['prototype'][_0x33de('0x81')]=function(_0x3a6925,_0x58dbf2,_0x42546c){scripts[_0x33de('0x81')](_0x58dbf2,_0x3a6925[_0x33de('0x77')],_0x3a6925['ispeech_asr_language']||'en-US',this['isConfigured'](_0x3a6925[_0x33de('0x82')])?_0x3a6925['model']:undefined)['then'](function(_0x3df0d3){_0x42546c(null,_0x3df0d3);})[_0x33de('0x15')](function(_0x1d7eec){_0x42546c(_0x1d7eec);});};AGIVertices[_0x33de('0xf')]['awsPolly']=function(_0x3f26f1,_0x2f4a7f){scripts[_0x33de('0x83')](_0x3f26f1['aws_access_key_id'],_0x3f26f1[_0x33de('0x84')],_0x3f26f1[_0x33de('0x85')],_0x3f26f1[_0x33de('0x86')]||_0x33de('0x87'),_0x3f26f1[_0x33de('0x5c')],_0x3f26f1[_0x33de('0x88')]||_0x33de('0x5c'))[_0x33de('0x12')](function(_0x152be4){_0x2f4a7f(null,_0x152be4);})[_0x33de('0x15')](function(_0x200f04){_0x2f4a7f(_0x200f04);});};AGIVertices[_0x33de('0xf')][_0x33de('0x89')]=function(_0x111401,_0x44717e){scripts[_0x33de('0x89')](this[_0x33de('0x39')][_0x33de('0x36')],_0x111401[_0x33de('0x8a')],_0x111401['aws_secret_access_key'],_0x111401[_0x33de('0x8b')],_0x111401[_0x33de('0x5c')],_0x111401[_0x33de('0x8c')])[_0x33de('0x12')](function(_0x148740){_0x44717e(null,_0x148740);})['catch'](function(_0x214e40){_0x44717e(_0x214e40);});};AGIVertices[_0x33de('0xf')][_0x33de('0x8d')]=function(_0x12afbf,_0x17c267,_0x158f3a){scripts[_0x33de('0x8d')](_0x17c267,_0x12afbf[_0x33de('0x77')],_0x12afbf[_0x33de('0x8e')]||_0x33de('0x5e'))['then'](function(_0x3af223){_0x158f3a(null,_0x3af223);})[_0x33de('0x15')](function(_0x5ad463){_0x158f3a(_0x5ad463);});};AGIVertices[_0x33de('0xf')][_0x33de('0x8f')]=function(_0x4eac32,_0x5eabfe,_0x4ee159){scripts[_0x33de('0x8f')](_0x5eabfe,_0x4eac32['appid'],_0x4eac32[_0x33de('0x90')],_0x4eac32[_0x33de('0x91')])['then'](function(_0xda9070){_0x4ee159(null,_0xda9070);})['catch'](function(_0x136f49){_0x4ee159(_0x136f49);});};AGIVertices[_0x33de('0xf')][_0x33de('0x92')]=function(_0x339aba){var _0x310904=_['includes'](verticesWithRetry,_0x339aba[_0x33de('0x38')])?_0x339aba:_[_0x33de('0x93')](_0x339aba);for(var _0x24dcfe in _0x310904){if(_0x310904['hasOwnProperty'](_0x24dcfe)){if(_0x310904[_0x24dcfe]&&_[_0x33de('0x94')](_0x310904[_0x24dcfe])){if(_[_0x33de('0x68')](recursiveMapAttributes,_0x24dcfe)){_0x310904[_0x24dcfe]=this[_0x33de('0x95')](_0x310904[_0x24dcfe]);}else{_0x310904[_0x24dcfe]=this[_0x33de('0x96')](_0x310904[_0x24dcfe]);}}}}return _0x310904;};AGIVertices['prototype']['recursiveNodeIndex']=function(_0x18e5b3){for(var _0x39c7ca in _0x18e5b3){if(_0x18e5b3[_0x33de('0x97')](_0x39c7ca)){if(_[_0x33de('0x98')](_0x18e5b3[_0x39c7ca])){this[_0x33de('0x99')](_0x18e5b3[_0x39c7ca]);}else if(_[_0x33de('0x9a')](_0x18e5b3[_0x39c7ca])){for(var _0x1d6c02=0x0;_0x1d6c02<_0x18e5b3[_0x39c7ca][_0x33de('0x9b')];_0x1d6c02++){this[_0x33de('0x99')](_0x18e5b3[_0x39c7ca][_0x1d6c02]);}}else if(_[_0x33de('0x94')](_0x18e5b3[_0x39c7ca])){_0x18e5b3[_0x39c7ca]=this[_0x33de('0x96')](_0x18e5b3[_0x39c7ca]);}}}};AGIVertices[_0x33de('0xf')][_0x33de('0x9c')]=function(_0x17d367,_0xc4d6eb){for(var _0x21a70f in _0x17d367){if(_0x17d367['hasOwnProperty'](_0x21a70f)){if(_[_0x33de('0x98')](_0x17d367[_0x21a70f])){if(!_[_0x33de('0x44')](_0x17d367[_0x21a70f])){this[_0x33de('0x9c')](_0x17d367[_0x21a70f],util[_0x33de('0x28')](_0x33de('0x9d'),_0xc4d6eb,_0x21a70f));}}else if(_[_0x33de('0x9a')](_0x17d367[_0x21a70f])){for(var _0x5120f5=0x0;_0x5120f5<_0x17d367[_0x21a70f][_0x33de('0x9b')];_0x5120f5++){this[_0x33de('0x9c')](_0x17d367[_0x21a70f][_0x5120f5],util['format'](_0x33de('0x9d'),_0xc4d6eb,_0x21a70f+'['+_0x5120f5+']'));}}else{if(!_[_0x33de('0x45')](_0x17d367[_0x21a70f])){this[_0x33de('0x39')][_0x33de('0x9e')](util[_0x33de('0x28')](_0x33de('0x9d'),_0xc4d6eb,_0x21a70f),_0x17d367[_0x21a70f]);}}}}};AGIVertices[_0x33de('0xf')]['replaceObjectAllVariables']=function(_0x557544){try{var _0x446257=JSON[_0x33de('0x6d')](_0x557544);this['recursiveNodeIndex'](_0x446257);return JSON[_0x33de('0x70')](_0x446257);}catch(_0x2d13fe){return this[_0x33de('0x96')](_0x557544);}};AGIVertices[_0x33de('0xf')][_0x33de('0x96')]=function(_0x5b61fe){var _0x1d465c=_0x5b61fe[_0x33de('0x9f')]('{');for(var _0x1593b4=0x1;_0x1593b4<_0x1d465c[_0x33de('0x9b')];_0x1593b4+=0x1){var _0x38d880=_0x1d465c[_0x1593b4][_0x33de('0x9f')]('}');if(_0x38d880[_0x33de('0x9b')]>0x1){_0x5b61fe=_0x5b61fe[_0x33de('0xa0')]('{'+_0x38d880[0x0]+'}',this[_0x33de('0x39')][_0x33de('0x10')](_0x38d880[0x0])[_0x33de('0xa1')]||_0x38d880[0x0]);}}if(_0x1d465c[_0x33de('0x9b')]===0x1){return _0x5b61fe['toString']();}return this[_0x33de('0x96')](_0x5b61fe);};AGIVertices[_0x33de('0xf')][_0x33de('0xa2')]=function(_0x533fec,_0x93313d){var _0x3c854d=this[_0x33de('0x39')]['getVariable'](_0x533fec);if(_0x3c854d['result']===-0x1){return _0x3c854d;}logger[_0x33de('0x2e')](util['format'](_0x33de('0xa3'),_0x93313d,_0x3c854d[_0x33de('0xa1')]));return this[_0x33de('0x39')][_0x33de('0x9e')](_0x93313d,_0x3c854d[_0x33de('0xa1')]);};AGIVertices[_0x33de('0xf')][_0x33de('0xa4')]=function(_0x23b8e9){return _0x23b8e9&&_0x23b8e9!=='0'&&_0x23b8e9!=='-1'&&_0x23b8e9!=='';};AGIVertices[_0x33de('0xf')][_0x33de('0xa5')]=function(_0x72b745){this[_0x33de('0x35')]['sync'](this,_0x72b745,'-');_0x72b745['retry']=_0x72b745[_0x33de('0xa5')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x33de('0xf')][_0x33de('0xa6')]=function(_0x11588f){logger['info'](util[_0x33de('0x28')]('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x11588f['label']));if(!this[_0x33de('0xa4')](_0x11588f[_0x33de('0x5c')])){return this[_0x33de('0x39')][_0x33de('0xa7')](_0x33de('0xa8'));}var _0x251b71='\x22'+_0x11588f['text']+'\x22';if(this[_0x33de('0xa4')](_0x11588f[_0x33de('0x75')])){_0x251b71+=','+_0x11588f[_0x33de('0x75')];}var _0x6c745e=this[_0x33de('0x39')][_0x33de('0x56')](_0x33de('0xa9'),_0x251b71);if(_0x6c745e['result']===-0x1){return _0x6c745e;}return this['channel'][_0x33de('0xa7')](util[_0x33de('0x28')](_0x33de('0xaa'),_0x251b71));};AGIVertices[_0x33de('0xf')]['mrcprecog']=function(_0x277457){logger[_0x33de('0x2e')](util[_0x33de('0x28')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x277457[_0x33de('0x37')]));if(!this[_0x33de('0xa4')](_0x277457['grammar'])){return this['channel'][_0x33de('0xa7')](_0x33de('0xab'));}var _0xc9bd13=_0x277457['grammar'];if(this[_0x33de('0xa4')](_0x277457[_0x33de('0x75')])){_0xc9bd13+=','+_0x277457['options'];}var _0x3b1cb0=this[_0x33de('0x39')]['exec']('MRCPRecog',_0xc9bd13);if(_0x3b1cb0[_0x33de('0xac')]===-0x1){return _0x3b1cb0;}var _0x185000=this[_0x33de('0xa2')](_0x33de('0xad'),'MRCP_RECOG_CONFIDENCE');if(_0x185000['result']===-0x1){return _0x185000;}var _0x15d743=this[_0x33de('0xa2')](_0x33de('0xae'),_0x33de('0xaf'));if(_0x15d743[_0x33de('0xac')]===-0x1){return _0x15d743;}var _0xa16a=this[_0x33de('0xa2')](_0x33de('0xb0'),_0x33de('0xb1'));if(_0xa16a[_0x33de('0xac')]===-0x1){return _0xa16a;}return this['channel'][_0x33de('0xa7')](util[_0x33de('0x28')](_0x33de('0xb2'),_0xc9bd13));};AGIVertices[_0x33de('0xf')][_0x33de('0xb3')]=function(_0x19db0e){logger[_0x33de('0x2e')](util[_0x33de('0x28')]('Enter\x20in\x20AGI\x20(%s)\x20block',_0x19db0e[_0x33de('0x37')]));return this[_0x33de('0x39')]['agi']([_0x19db0e[_0x33de('0xb4')],_0x19db0e[_0x33de('0xb5')]]);};AGIVertices[_0x33de('0xf')][_0x33de('0xb6')]=function(_0x4ed96b){logger['info'](util[_0x33de('0x28')](_0x33de('0xb7'),_0x4ed96b['label']));if(this[_0x33de('0xa4')](_0x4ed96b['timeout'])){logger[_0x33de('0x2e')](util['format'](_0x33de('0xb8'),_0x4ed96b['timeout']));var _0x6cc026=this[_0x33de('0x39')][_0x33de('0xb9')](_0x4ed96b[_0x33de('0x67')]);if(_0x6cc026['result']===-0x1){return _0x6cc026;}}return this[_0x33de('0x39')]['answer']();};AGIVertices[_0x33de('0xf')]['callback']=function(_0x425a49){logger[_0x33de('0x2e')](util[_0x33de('0x28')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x425a49[_0x33de('0x37')]));if(!this[_0x33de('0xa4')](_0x425a49[_0x33de('0x49')])){return this[_0x33de('0x39')][_0x33de('0x2c')](_0x425a49,_0x33de('0xba'));}_0x425a49[_0x33de('0x4a')]=moment();if(this[_0x33de('0xa4')](_0x425a49[_0x33de('0xbb')])){_0x425a49['scheduledAt']=moment()['add'](_0x425a49[_0x33de('0xbb')],_0x33de('0xbc'));}if(!this['isConfigured'](_0x425a49[_0x33de('0x4c')])){_0x425a49[_0x33de('0x4c')]=0x2;}this[_0x33de('0x43')][_0x33de('0xbd')](this,_0x425a49);return this['channel'][_0x33de('0xa7')](util[_0x33de('0x28')](_0x33de('0xbe'),_0x425a49['phone'],_0x425a49[_0x33de('0x49')],_0x425a49[_0x33de('0x4a')]));};AGIVertices[_0x33de('0xf')][_0x33de('0xbf')]=function(_0x4cec6e){logger[_0x33de('0x2e')](util[_0x33de('0x28')](_0x33de('0xc0'),_0x4cec6e[_0x33de('0x37')]));var _0x5a3bb8=this[_0x33de('0x39')][_0x33de('0x56')](_0x4cec6e['application'],_0x4cec6e[_0x33de('0x75')]);if(_0x5a3bb8[_0x33de('0xac')]===-0x1){return _0x5a3bb8;}return this[_0x33de('0x39')]['noop'](util[_0x33de('0x28')](_0x33de('0xc1'),_0x4cec6e[_0x33de('0xc2')],_0x4cec6e[_0x33de('0x75')]));};AGIVertices[_0x33de('0xf')][_0x33de('0xc3')]=function(_0x470994){logger['info'](util[_0x33de('0x28')](_0x33de('0xc4'),_0x470994[_0x33de('0x37')]));if(!this['isConfigured'](_0x470994[_0x33de('0x5c')])){return this['channel'][_0x33de('0xa7')]('no\x20text\x20configured');}var _0x59cffc='\x22'+_0x470994['text']+'\x22';if(this[_0x33de('0xa4')](_0x470994[_0x33de('0x75')])){_0x59cffc+=','+_0x470994[_0x33de('0x75')];}var _0x481af1=this[_0x33de('0x39')][_0x33de('0x56')](_0x33de('0xa9'),_0x59cffc);if(_0x481af1[_0x33de('0xac')]===-0x1){return _0x481af1;}return this[_0x33de('0x39')]['noop'](util['format'](_0x33de('0xaa'),_0x59cffc));};AGIVertices[_0x33de('0xf')][_0x33de('0xc5')]=function(_0x2ce117){logger['info'](util[_0x33de('0x28')](_0x33de('0xc6'),_0x2ce117[_0x33de('0x37')]));if(!this[_0x33de('0xa4')](_0x2ce117[_0x33de('0x5c')])){return this[_0x33de('0x39')][_0x33de('0xa7')]('no\x20text\x20configured');}var _0x432384='\x22'+_0x2ce117['text']+'\x22';if(this[_0x33de('0xa4')](_0x2ce117['options'])){_0x432384+=','+_0x2ce117[_0x33de('0x75')];}var _0x35effe=this[_0x33de('0x39')][_0x33de('0x56')](_0x33de('0xa9'),_0x432384);if(_0x35effe[_0x33de('0xac')]===-0x1){return _0x35effe;}return this[_0x33de('0x39')][_0x33de('0xa7')](util['format'](_0x33de('0xaa'),_0x432384));};AGIVertices[_0x33de('0xf')][_0x33de('0xc7')]=function(_0x50fe95){logger[_0x33de('0x2e')](util[_0x33de('0x28')](_0x33de('0xc8'),_0x50fe95[_0x33de('0x37')]));if(!this[_0x33de('0xa4')](_0x50fe95[_0x33de('0xc9')])){return this[_0x33de('0x39')][_0x33de('0xa7')](_0x33de('0xab'));}var _0x56cfd3=_0x50fe95['grammar'];if(this['isConfigured'](_0x50fe95['options'])){_0x56cfd3+=','+_0x50fe95['options'];}var _0x25632b=this[_0x33de('0x39')][_0x33de('0x56')](_0x33de('0xca'),_0x56cfd3);if(_0x25632b[_0x33de('0xac')]===-0x1){return _0x25632b;}var _0x1d6a70=this[_0x33de('0xa2')]('RECOG_CONFIDENCE()',_0x33de('0xcb'));if(_0x1d6a70[_0x33de('0xac')]===-0x1){return _0x1d6a70;}var _0x1f4e01=this[_0x33de('0xa2')](_0x33de('0xae'),'LUMENVOX_ASR_TRANSCRIPT');if(_0x1f4e01[_0x33de('0xac')]===-0x1){return _0x1f4e01;}var _0x3592a0=this[_0x33de('0xa2')](_0x33de('0xb0'),_0x33de('0xcc'));if(_0x3592a0[_0x33de('0xac')]===-0x1){return _0x3592a0;}return this['channel'][_0x33de('0xa7')](util[_0x33de('0x28')](_0x33de('0xb2'),_0x56cfd3));};AGIVertices[_0x33de('0xf')][_0x33de('0xcd')]=function(_0xf807ec){logger[_0x33de('0x2e')](util[_0x33de('0x28')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0xf807ec['label']));if(!this[_0x33de('0xa4')](_0xf807ec[_0x33de('0xc9')])){return this[_0x33de('0x39')][_0x33de('0xa7')]('no\x20grammar\x20configured');}var _0x1595b6=_0xf807ec[_0x33de('0xc9')];if(this[_0x33de('0xa4')](_0xf807ec[_0x33de('0x75')])){_0x1595b6+=','+_0xf807ec[_0x33de('0x75')];}var _0x42eb0f=this[_0x33de('0x39')][_0x33de('0x56')](_0x33de('0xca'),_0x1595b6);if(_0x42eb0f['result']===-0x1){return _0x42eb0f;}var _0x31c1a5=this[_0x33de('0xa2')](_0x33de('0xad'),'SESTEK_ASR_CONFIDENCE');if(_0x31c1a5[_0x33de('0xac')]===-0x1){return _0x31c1a5;}var _0x240e92=this[_0x33de('0xa2')](_0x33de('0xae'),_0x33de('0xce'));if(_0x240e92[_0x33de('0xac')]===-0x1){return _0x240e92;}var _0x5cf349=this['getAndSetVariable']('RECOG_INSTANCE()',_0x33de('0xcf'));if(_0x5cf349[_0x33de('0xac')]===-0x1){return _0x5cf349;}return this[_0x33de('0x39')][_0x33de('0xa7')](util[_0x33de('0x28')](_0x33de('0xb2'),_0x1595b6));};AGIVertices[_0x33de('0xf')][_0x33de('0xd0')]=function(_0x3d5a1c){logger[_0x33de('0x2e')](util[_0x33de('0x28')]('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x3d5a1c[_0x33de('0x37')]));if(!this[_0x33de('0xa4')](_0x3d5a1c[_0x33de('0xd1')])){return this[_0x33de('0x39')][_0x33de('0x2c')](_0x3d5a1c,'no\x20database\x20selected');}var _0x1e6d87=this[_0x33de('0x18')][_0x33de('0xbd')](this,_0x3d5a1c['odbc_id']);if(!_0x1e6d87){return this[_0x33de('0x39')][_0x33de('0x2c')](_0x3d5a1c,'no\x20odbc\x20database\x20found');}if(!this[_0x33de('0xa4')](_0x3d5a1c[_0x33de('0x2f')])){return this['channel'][_0x33de('0x2c')](_0x3d5a1c,_0x33de('0xd2'));}var _0x47ce4d=_0x3d5a1c['query'][_0x33de('0x58')](/(\r\n|\n|\r)/gm,'\x20');this[_0x33de('0x39')][_0x33de('0xa7')](util['format'](_0x33de('0xd3'),_0x47ce4d));var _0x22fd13=this[_0x33de('0x2a')]['sync'](this,_0x1e6d87,_0x47ce4d);this[_0x33de('0x35')][_0x33de('0xbd')](this,_0x3d5a1c,_0x47ce4d);if(!this[_0x33de('0xa4')](_0x3d5a1c['variable_id'])){return this[_0x33de('0x39')][_0x33de('0xa7')](_0x33de('0xd4'));}var _0x115562=this['getVariable'][_0x33de('0xbd')](this,_0x3d5a1c[_0x33de('0xd5')]);if(!_0x115562){return this[_0x33de('0x39')]['error'](_0x3d5a1c,_0x33de('0xd6'));}var _0x3c04fc=this;_0x22fd13[_0x33de('0xd7')](function(_0x13a34e,_0x3aecca){Object[_0x33de('0xd8')](_0x13a34e)['forEach'](function(_0x19660c){_0x3c04fc[_0x33de('0x39')][_0x33de('0x9e')](util[_0x33de('0x28')](_0x33de('0xd9'),_0x115562,_0x3aecca,_0x19660c),_0x13a34e[_0x19660c]);});});this[_0x33de('0x39')][_0x33de('0x9e')](util[_0x33de('0x28')](_0x33de('0xda'),_0x115562),_0x22fd13[_0x33de('0x9b')]);return this[_0x33de('0x39')][_0x33de('0xa7')](util[_0x33de('0x28')](_0x33de('0xdb'),_0x115562));};AGIVertices[_0x33de('0xf')][_0x33de('0xdc')]=function(_0x1dcc44){logger[_0x33de('0xdd')](util[_0x33de('0x28')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x1dcc44[_0x33de('0x37')]));if(!this[_0x33de('0xa4')](_0x1dcc44[_0x33de('0xde')])){return this[_0x33de('0x39')][_0x33de('0x2c')](_0x1dcc44,_0x33de('0xdf'));}var _0x33c710=this['getUser']['sync'](this,_0x1dcc44['sip_id']);if(!_0x33c710){return this[_0x33de('0x39')][_0x33de('0x2c')](_0x1dcc44,'no\x20user\x20found');}var _0x3a35e1=this[_0x33de('0x39')]['exec'](_0x33de('0xe0'),[util[_0x33de('0x28')]('SIP/%s',_0x33c710),_0x1dcc44[_0x33de('0x67')],_0x1dcc44[_0x33de('0xe1')],_0x1dcc44['url']]);if(_0x3a35e1[_0x33de('0xac')]===-0x1){return _0x3a35e1;}return this['channel'][_0x33de('0xa7')](util[_0x33de('0x28')](_0x33de('0xe2'),_0x33de('0xe0')));};AGIVertices[_0x33de('0xf')]['dialogflow']=function(_0x53ddd0){logger[_0x33de('0x2e')](util[_0x33de('0x28')](_0x33de('0xe3'),_0x53ddd0[_0x33de('0x37')]));if(!this[_0x33de('0xa4')](_0x53ddd0['key'])){return this[_0x33de('0x39')][_0x33de('0xa7')](_0x33de('0xe4'));}if(!this[_0x33de('0xa4')](_0x53ddd0['text'])){return this[_0x33de('0x39')][_0x33de('0xa7')](_0x33de('0xa8'));}this[_0x33de('0x39')]['bot']=!![];this[_0x33de('0x35')](_0x53ddd0);this['createSquareMessage'](_0x53ddd0[_0x33de('0x5c')],'in','','');this['channel'][_0x33de('0xa7')](util[_0x33de('0x28')](_0x33de('0xe5'),_0x53ddd0['text']));var _0x32078c=this['googleDialogflow'][_0x33de('0xbd')](this,_0x53ddd0);if(_0x32078c){for(var _0x2925df in _0x32078c){if(_0x32078c[_0x33de('0x97')](_0x2925df)){this[_0x33de('0x39')][_0x33de('0x9e')](util['format'](_0x33de('0xe6'),_0x2925df['toUpperCase']()),_0x32078c[_0x2925df]);}}this[_0x33de('0x42')](_0x32078c[_0x33de('0xe7')],_0x33de('0xe8'),_0x33de('0xe9'),'');return this[_0x33de('0x39')]['noop'](util[_0x33de('0x28')](_0x33de('0xea'),_0x32078c[_0x33de('0xe7')]));}return this[_0x33de('0x39')][_0x33de('0x2c')](_0x53ddd0,_0x33de('0xeb'));};AGIVertices['prototype']['dialogflowV2']=function(_0x3058a4){logger[_0x33de('0x2e')](util['format']('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x3058a4[_0x33de('0x37')]));if(!this['isConfigured'](_0x3058a4[_0x33de('0x7a')])){return this['channel']['noop'](_0x33de('0xec'));}if(!this[_0x33de('0xa4')](_0x3058a4[_0x33de('0x7b')])){return this['channel'][_0x33de('0xa7')](_0x33de('0xed'));}if(!this[_0x33de('0xa4')](_0x3058a4[_0x33de('0x7c')])){return this[_0x33de('0x39')][_0x33de('0xa7')]('no\x20private_key\x20configured');}if(!this[_0x33de('0xa4')](_0x3058a4[_0x33de('0x7d')])){return this['channel'][_0x33de('0xa7')](_0x33de('0xee'));}if(!this[_0x33de('0xa4')](_0x3058a4['text'])){return this[_0x33de('0x39')][_0x33de('0xa7')](_0x33de('0xa8'));}this['channel']['bot']=!![];this[_0x33de('0x35')](_0x3058a4);this[_0x33de('0x42')](_0x3058a4['text'],'in','','');this['channel'][_0x33de('0xa7')](util[_0x33de('0x28')]('Trying\x20DialogflowV2:\x20%s',_0x3058a4[_0x33de('0x5c')]));var _0xb586f5=this['googleDialogflowV2'][_0x33de('0xbd')](this,_0x3058a4);if(_0xb586f5){for(var _0x2d6ebc in _0xb586f5){if(_0xb586f5['hasOwnProperty'](_0x2d6ebc)){if(_0x2d6ebc!==_0x33de('0xef')){this[_0x33de('0x39')][_0x33de('0x9e')](util[_0x33de('0x28')]('DIALOGFLOW_%s',_0x2d6ebc['toUpperCase']()),_0xb586f5[_0x2d6ebc]);}}}this[_0x33de('0x42')](_0xb586f5[_0x33de('0xe7')],_0x33de('0xe8'),_0x33de('0xf0'),_0xb586f5[_0x33de('0xef')]);return this[_0x33de('0x39')]['noop'](util[_0x33de('0x28')](_0x33de('0xf1'),_0xb586f5[_0x33de('0xe7')]));}return this[_0x33de('0x39')][_0x33de('0x2c')](_0x3058a4,_0x33de('0xf2'));};AGIVertices[_0x33de('0xf')][_0x33de('0xf3')]=function(_0x27874d){logger[_0x33de('0x2e')](util[_0x33de('0x28')](_0x33de('0xf4'),_0x27874d[_0x33de('0x37')]));if(!this[_0x33de('0xa4')](_0x27874d['ndauth_url'])){return this['channel'][_0x33de('0xa7')](_0x33de('0xf5'));}if(!this[_0x33de('0xa4')](_0x27874d['username'])){return this['channel'][_0x33de('0xa7')]('no\x20username\x20configured');}if(!this['isConfigured'](_0x27874d['password'])){return this['channel'][_0x33de('0xa7')]('no\x20password\x20configured');}if(!this['isConfigured'](_0x27874d[_0x33de('0xf6')])){return this[_0x33de('0x39')][_0x33de('0xa7')]('no\x20text\x20configured');}this[_0x33de('0x39')][_0x33de('0xf7')]=!![];this['createSquareDetailsReport'](_0x27874d);this[_0x33de('0x42')](_0x27874d[_0x33de('0x5c')],'in','','');this[_0x33de('0x39')][_0x33de('0xa7')](util[_0x33de('0x28')](_0x33de('0xf8'),_0x27874d[_0x33de('0x5c')]));var _0x476413=this['sestekNDA'][_0x33de('0xbd')](this,_0x27874d);if(_0x476413){for(var _0xf7a09d in _0x476413){if(_0x476413[_0x33de('0x97')](_0xf7a09d)){this['channel']['setVariable'](util[_0x33de('0x28')](_0x33de('0xf9'),_0xf7a09d[_0x33de('0xfa')]()),_0x476413[_0xf7a09d]);}}this[_0x33de('0x42')](_0x476413[_0x33de('0xe7')],_0x33de('0xe8'),_0x33de('0xf3'),'');if(_0x476413[_0x33de('0xfb')]){this['channel'][_0x33de('0xa7')](util[_0x33de('0x28')](_0x33de('0xfc'),_0x476413['audiofile']));var _0x4561a5=this[_0x33de('0x39')][_0x33de('0xfd')](_0x476413[_0x33de('0xfb')]);try{fs[_0x33de('0xfe')](_0x476413['audiofile']+_0x33de('0xff'));}catch(_0x2c31e2){logger[_0x33de('0x2c')](_0x2c31e2);}return _0x4561a5;}else{return this[_0x33de('0x39')]['noop'](util['format'](_0x33de('0x100'),_0x476413[_0x33de('0xe7')]));}}return this[_0x33de('0x39')][_0x33de('0x2c')](_0x27874d,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0x33de('0xf')][_0x33de('0x101')]=function(_0x31f0a3){logger[_0x33de('0x2e')](util[_0x33de('0x28')](_0x33de('0x102'),_0x31f0a3[_0x33de('0x37')]));return this['channel']['noop']('end');};AGIVertices[_0x33de('0xf')][_0x33de('0x103')]=function(_0x39ffb3){logger[_0x33de('0x2e')](util['format'](_0x33de('0x104'),_0x39ffb3[_0x33de('0x37')]));var _0x19cfea='';if(_0x39ffb3['trunk_id']){if(!this[_0x33de('0xa4')](_0x39ffb3[_0x33de('0x105')])){return this[_0x33de('0x39')]['error'](_0x39ffb3,_0x33de('0x106'));}else{var _0x448235=parseInt(_0x39ffb3[_0x33de('0x105')],0xa);if(isNaN(_0x448235)){_0x19cfea=_0x39ffb3['trunk_id'];}else{_0x19cfea=this[_0x33de('0x1d')][_0x33de('0xbd')](this,_0x39ffb3[_0x33de('0x105')]);if(!_0x19cfea){return this[_0x33de('0x39')][_0x33de('0x2c')](_0x39ffb3,_0x33de('0x107'));}}}}else if(_0x39ffb3['trunk_name']){_0x19cfea=_0x39ffb3['trunk_name'];}else{return this[_0x33de('0x39')][_0x33de('0x2c')](_0x39ffb3,_0x33de('0x106'));}var _0x514a86=this[_0x33de('0x39')][_0x33de('0x56')]('DIAL',[util[_0x33de('0x28')]('SIP/%s/%s',_0x19cfea,_0x39ffb3[_0x33de('0x48')]),_0x39ffb3[_0x33de('0x67')],_0x39ffb3[_0x33de('0xe1')],_0x39ffb3[_0x33de('0x64')]]);if(_0x514a86['result']===-0x1){return _0x514a86;}return this[_0x33de('0x39')][_0x33de('0xa7')](util[_0x33de('0x28')]('Executed\x20command\x20%s','DIAL'));};AGIVertices[_0x33de('0xf')][_0x33de('0x108')]=function(_0x1b436d){logger[_0x33de('0x2e')](util[_0x33de('0x28')](_0x33de('0x109'),_0x1b436d[_0x33de('0x37')]));return this[_0x33de('0x39')]['noop']('finally');};AGIVertices[_0x33de('0xf')]['getdigits']=function(_0x4f883f){logger[_0x33de('0x2e')](util['format'](_0x33de('0x10a'),_0x4f883f[_0x33de('0x37')]));if(_0x4f883f[_0x33de('0x10b')]===0x0){return this[_0x33de('0xa5')](_0x4f883f);}_0x4f883f[_0x33de('0x10b')]-=0x1;if(!this['isConfigured'](_0x4f883f['file_id'])){return this[_0x33de('0x39')][_0x33de('0x2c')](_0x4f883f,'no\x20file\x20audio\x20selected');}var _0x43beb8=this[_0x33de('0x1f')]['sync'](this,_0x4f883f[_0x33de('0x10c')]);if(!_0x43beb8){return this[_0x33de('0x39')][_0x33de('0x2c')](_0x4f883f,_0x33de('0x10d'));}if(!this[_0x33de('0xa4')](_0x4f883f[_0x33de('0xd5')])){return this[_0x33de('0x39')][_0x33de('0x2c')](_0x33de('0xd4'));}var _0x2dc313=this['channel'][_0x33de('0x10e')](_0x43beb8,_0x4f883f[_0x33de('0x10f')],_0x4f883f[_0x33de('0x110')]);var _0x8b7489=_0x2dc313[_0x33de('0xac')]?_0x2dc313[_0x33de('0xac')]['toString']():'';logger[_0x33de('0x2e')](_0x33de('0x111'),JSON['stringify'](_0x2dc313));if(_0x2dc313[_0x33de('0xac')]===-0x1){this[_0x33de('0x35')][_0x33de('0xbd')](this,_0x4f883f,_0x8b7489);return _0x2dc313;}else if(_0x2dc313[_0x33de('0xa1')]==='timeout'){_0x2dc313[_0x33de('0xac')]=_0x8b7489[_0x33de('0x9b')]>=parseInt(_0x4f883f[_0x33de('0x112')])?'x':'i';}else{_0x2dc313[_0x33de('0xac')]=_0x8b7489[_0x33de('0x9b')]>=parseInt(_0x4f883f[_0x33de('0x112')])&&_0x8b7489[_0x33de('0x9b')]<=parseInt(_0x4f883f['maxdigit'])?'x':'i';}var _0x32385d=this[_0x33de('0x10')]['sync'](this,_0x4f883f[_0x33de('0xd5')]);if(!_0x32385d){return this[_0x33de('0x39')][_0x33de('0x2c')](_0x4f883f,_0x33de('0xd6'));}this[_0x33de('0x39')][_0x33de('0x9e')](_0x32385d,_0x8b7489);if(this[_0x33de('0xa4')](_0x4f883f[_0x33de('0x113')])){var _0x127546=parseInt(_0x4f883f[_0x33de('0x113')],0xa);var _0x517db9=rs[_0x33de('0x114')]({'charset':'*','length':_0x127546});var _0xd3be81=_0x8b7489[_0x33de('0x9b')];if(_0xd3be81>0x0){if(_0xd3be81>_0x127546){this[_0x33de('0x35')][_0x33de('0xbd')](this,_0x4f883f,_0x4f883f[_0x33de('0x115')]===_0x33de('0x116')?_0x517db9+_0x8b7489[_0x33de('0x117')](_0x127546):_0x8b7489[_0x33de('0x117')](0x0,_0xd3be81-_0x127546)+_0x517db9);}else{this[_0x33de('0x35')][_0x33de('0xbd')](this,_0x4f883f,rs[_0x33de('0x114')]({'charset':'*','length':_0xd3be81}));}}else{this[_0x33de('0x35')][_0x33de('0xbd')](this,_0x4f883f,'');}}else{this[_0x33de('0x35')][_0x33de('0xbd')](this,_0x4f883f,_0x8b7489);}return _0x2dc313;};AGIVertices['prototype']['getsecretdigits']=function(_0x7d3c04){logger[_0x33de('0x2e')](util[_0x33de('0x28')](_0x33de('0x118'),_0x7d3c04['label']));return this['getdigits'](_0x7d3c04);};AGIVertices[_0x33de('0xf')][_0x33de('0x119')]=function(_0x45c353){logger[_0x33de('0x2e')](util[_0x33de('0x28')](_0x33de('0x11a'),_0x45c353[_0x33de('0x37')]));this[_0x33de('0x35')][_0x33de('0xbd')](this,_0x45c353,_0x45c353[_0x33de('0x11b')]);return this[_0x33de('0x39')][_0x33de('0xa7')](util[_0x33de('0x28')](_0x33de('0x11c'),_0x45c353[_0x33de('0x11b')]));};AGIVertices['prototype'][_0x33de('0x11d')]=function(_0x521a02){logger['info'](util[_0x33de('0x28')](_0x33de('0x11e'),_0x521a02[_0x33de('0x37')]));if(!this['isConfigured'](_0x521a02[_0x33de('0x8a')])||!this[_0x33de('0xa4')](_0x521a02[_0x33de('0x84')])){return this[_0x33de('0x39')][_0x33de('0xa7')](_0x33de('0x11f'));}if(!this[_0x33de('0xa4')](_0x521a02[_0x33de('0x5c')])){return this['channel'][_0x33de('0xa7')](_0x33de('0xa8'));}this[_0x33de('0x39')][_0x33de('0xa7')](util[_0x33de('0x28')]('Trying\x20aws\x20Polly\x20%s',_0x521a02[_0x33de('0x5c')]));var _0x5c557=this['awsPolly'][_0x33de('0xbd')](this,_0x521a02);if(_0x5c557){this[_0x33de('0x39')][_0x33de('0xa7')](util[_0x33de('0x28')](_0x33de('0x120'),_0x5c557));var _0x43e22a=this[_0x33de('0x39')][_0x33de('0xfd')](_0x5c557);try{fs[_0x33de('0xfe')](_0x5c557+_0x33de('0xff'));}catch(_0x4ca749){logger[_0x33de('0x2c')](_0x4ca749);}return _0x43e22a;}return this['channel'][_0x33de('0x2c')](_0x521a02,_0x33de('0x121'));};AGIVertices[_0x33de('0xf')][_0x33de('0x122')]=function(_0x1d391d){logger[_0x33de('0x2e')](util[_0x33de('0x28')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x1d391d['label']));if(!this[_0x33de('0xa4')](_0x1d391d[_0x33de('0x8a')])||!this[_0x33de('0xa4')](_0x1d391d[_0x33de('0x84')])){return this[_0x33de('0x39')]['noop'](_0x33de('0x11f'));}if(!this['isConfigured'](_0x1d391d[_0x33de('0x8c')])){return this['channel'][_0x33de('0xa7')]('no\x20bot\x20name\x20configured');}if(!this['isConfigured'](_0x1d391d[_0x33de('0x5c')])){return this[_0x33de('0x39')][_0x33de('0xa7')](_0x33de('0xa8'));}this[_0x33de('0x39')]['bot']=!![];this[_0x33de('0x35')](_0x1d391d);this['createSquareMessage'](_0x1d391d[_0x33de('0x5c')],'in','','');this[_0x33de('0x39')][_0x33de('0xa7')](util[_0x33de('0x28')](_0x33de('0x123'),_0x1d391d[_0x33de('0x5c')]));var _0x544050=this['awsLex']['sync'](this,_0x1d391d);if(_0x544050){for(var _0x12ab99 in _0x544050){if(_0x544050[_0x33de('0x97')](_0x12ab99)&&_[_0x33de('0x94')](_0x544050[_0x12ab99])){this['channel']['setVariable'](util[_0x33de('0x28')](_0x33de('0x124'),_0x12ab99['toUpperCase']()),_0x544050[_0x12ab99]);}}if(_[_0x33de('0x45')](_0x544050[_0x33de('0x73')])){return this[_0x33de('0x39')][_0x33de('0xa7')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this['createSquareMessage'](_0x544050[_0x33de('0x73')],_0x33de('0xe8'),_0x33de('0x125'),'');return this['channel'][_0x33de('0xa7')](util[_0x33de('0x28')]('Amazon\x20Lex\x20Result\x20%s',_0x544050[_0x33de('0x73')]));}}return this[_0x33de('0x39')][_0x33de('0x2c')](_0x1d391d,_0x33de('0x126'));};AGIVertices[_0x33de('0xf')][_0x33de('0x127')]=function(_0x3d96dd){logger[_0x33de('0x2e')](util[_0x33de('0x28')](_0x33de('0x128'),_0x3d96dd[_0x33de('0x37')],_0x3d96dd[_0x33de('0x67')]));if(!this['isConfigured'](_0x3d96dd[_0x33de('0x77')])){return this['channel'][_0x33de('0xa7')](_0x33de('0xe4'));}var _0x3c2329='wav';var _0xc2bed1=util['format']('%s/recordings/%s',FILES_PATH,rs[_0x33de('0x114')](0x4));var _0x2334bd=util[_0x33de('0x28')](_0x33de('0x9d'),_0xc2bed1,_0x3c2329);var _0x46e874=!![];if(_0x3d96dd['beep']===_0x33de('0x129')){_0x46e874=![];}var _0x10e7e8=this['channel'][_0x33de('0x12a')](_0xc2bed1,_0x3c2329,_0x3d96dd[_0x33de('0x12b')],_0x3d96dd[_0x33de('0x67')],undefined,_0x46e874);if(_0x10e7e8['result']!==-0x1){this[_0x33de('0x39')]['noop'](util[_0x33de('0x28')](_0x33de('0x12c'),_0x2334bd));var _0x46c0c9=this['googleASR'][_0x33de('0xbd')](this,_0x3d96dd,_0x2334bd);if(_0x46c0c9){for(var _0x42815d in _0x46c0c9){if(_0x46c0c9[_0x33de('0x97')](_0x42815d)){this[_0x33de('0x39')][_0x33de('0x9e')](util[_0x33de('0x28')](_0x33de('0x12d'),_0x42815d['toUpperCase']()),_0x46c0c9[_0x42815d]);}}return this[_0x33de('0x39')][_0x33de('0xa7')](util[_0x33de('0x28')](_0x33de('0x12e'),JSON['stringify'](_0x46c0c9)));}}return _0x10e7e8;};AGIVertices[_0x33de('0xf')][_0x33de('0x12f')]=function(_0x4b3677){logger[_0x33de('0x2e')](util['format']('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x4b3677['label']));if(!this[_0x33de('0xa4')](_0x4b3677[_0x33de('0x130')])){return this[_0x33de('0x39')]['noop'](_0x33de('0x131'));}if(!this[_0x33de('0xa4')](_0x4b3677[_0x33de('0x90')])){return this[_0x33de('0x39')]['noop'](_0x33de('0x132'));}var _0x266db0=_0x33de('0x133');var _0xee7792=util['format'](_0x33de('0x134'),FILES_PATH,rs[_0x33de('0x114')](0x4));var _0x301a0a=util[_0x33de('0x28')]('%s.%s',_0xee7792,_0x266db0);var _0x3a636f=!![];if(_0x4b3677[_0x33de('0x135')]===_0x33de('0x129')){_0x3a636f=![];}var _0x3f955d=this[_0x33de('0x39')][_0x33de('0x12a')](_0xee7792,_0x266db0,_0x4b3677[_0x33de('0x12b')],_0x4b3677[_0x33de('0x67')],undefined,_0x3a636f);if(_0x3f955d[_0x33de('0xac')]!==-0x1){this[_0x33de('0x39')]['noop'](util['format'](_0x33de('0x136'),_0x301a0a));var _0x5260f1=this[_0x33de('0x8f')]['sync'](this,_0x4b3677,_0x301a0a);if(_0x5260f1){for(var _0x4ae63e in _0x5260f1){if(_0x5260f1[_0x33de('0x97')](_0x4ae63e)){this[_0x33de('0x39')][_0x33de('0x9e')](util[_0x33de('0x28')]('TILDE_ASR_%s',_0x4ae63e[_0x33de('0xfa')]()),_0x5260f1[_0x4ae63e]);}}return this[_0x33de('0x39')][_0x33de('0xa7')](util[_0x33de('0x28')](_0x33de('0x137'),JSON[_0x33de('0x70')](_0x5260f1)));}}return _0x3f955d;};AGIVertices[_0x33de('0xf')][_0x33de('0x138')]=function(_0x27d4cd){logger[_0x33de('0x2e')](util[_0x33de('0x28')](_0x33de('0x139'),_0x27d4cd['label']));return this[_0x33de('0x39')]['continueAt'](_0x27d4cd['context'],_0x27d4cd['extension'],_0x27d4cd[_0x33de('0x3f')]);};AGIVertices['prototype'][_0x33de('0x13a')]=function(_0x4e1e5d){logger['info'](util[_0x33de('0x28')](_0x33de('0x13b'),_0x4e1e5d[_0x33de('0x37')]));if(!this[_0x33de('0xa4')](_0x4e1e5d['condition'])){return this[_0x33de('0x39')][_0x33de('0x2c')](_0x4e1e5d,'no\x20condition\x20configured');}try{var _0x46c9c0=eval(_0x4e1e5d[_0x33de('0x13c')])?_0x33de('0x13d'):_0x33de('0x13e');this[_0x33de('0x39')][_0x33de('0xa7')](util[_0x33de('0x28')](_0x33de('0x13f'),_0x4e1e5d['condition'],_0x46c9c0));return{'code':0xc8,'result':_0x46c9c0};}catch(_0x4a2989){return{'code':0xc8,'result':'false'};}};AGIVertices['prototype'][_0x33de('0x140')]=function(_0x34ae56){logger[_0x33de('0x2e')](util['format'](_0x33de('0x141'),_0x34ae56['label']));if(!this[_0x33de('0xa4')](_0x34ae56[_0x33de('0x142')])){return this[_0x33de('0x39')]['error'](_0x34ae56,_0x33de('0x143'));}var _0x4c2919=this[_0x33de('0x144')]['sync'](this,_0x34ae56[_0x33de('0x142')]);if(!_0x4c2919){return this[_0x33de('0x39')][_0x33de('0x2c')](_0x34ae56,_0x33de('0x145'));}for(var _0x16e3f3=0x0;_0x16e3f3<_0x4c2919[_0x33de('0x9b')];_0x16e3f3+=0x1){var _0x1b6a24=this['channel'][_0x33de('0x10')](util[_0x33de('0x28')](_0x33de('0x146'),_0x4c2919[_0x16e3f3]));if(_0x1b6a24[_0x33de('0xac')]===-0x1){return _0x1b6a24;}logger[_0x33de('0x2e')](util[_0x33de('0x28')](_0x33de('0x147'),_0x4c2919[_0x16e3f3],_0x1b6a24[_0x33de('0xa1')]));if(_0x1b6a24[_0x33de('0xa1')]===_0x33de('0x13d')){logger['info'](util[_0x33de('0x28')]('IFTIME\x20%s\x20%s',_0x4c2919[_0x16e3f3],'true'));this[_0x33de('0x39')][_0x33de('0xa7')](util['format'](_0x33de('0x147'),_0x4c2919[_0x16e3f3],_0x33de('0x13d')));return{'code':0xc8,'result':_0x33de('0x13d')};}else{logger[_0x33de('0x2e')](util['format'](_0x33de('0x147'),_0x4c2919[_0x16e3f3],_0x33de('0x13e')));this['channel'][_0x33de('0xa7')](util[_0x33de('0x28')](_0x33de('0x147'),_0x4c2919[_0x16e3f3],_0x33de('0x13e')));}}return{'code':0xc8,'result':_0x33de('0x13e')};};AGIVertices[_0x33de('0xf')][_0x33de('0x148')]=function(_0x4993a6){logger['info'](util['format'](_0x33de('0x149'),_0x4993a6['label']));return this[_0x33de('0x39')][_0x33de('0x148')]();};AGIVertices[_0x33de('0xf')][_0x33de('0x14a')]=function(_0x197090){logger[_0x33de('0x2e')](util['format'](_0x33de('0x14b'),_0x197090['label']));if(!this[_0x33de('0xa4')](_0x197090[_0x33de('0x77')])){return this[_0x33de('0x39')][_0x33de('0xa7')]('no\x20key\x20configured');}var _0x4d73fb='wav';var _0x48c0cd=util[_0x33de('0x28')](_0x33de('0x134'),FILES_PATH,rs[_0x33de('0x114')](0x4));var _0xc5eb25=util['format'](_0x33de('0x9d'),_0x48c0cd,_0x4d73fb);var _0x20fbb5=!![];if(_0x197090['beep']===_0x33de('0x129')){_0x20fbb5=![];}var _0x4cd67a=this['channel']['recordFile'](_0x48c0cd,_0x4d73fb,_0x197090[_0x33de('0x12b')],_0x197090['timeout'],undefined,_0x20fbb5);if(_0x4cd67a[_0x33de('0xac')]!==-0x1){this[_0x33de('0x39')][_0x33de('0xa7')](util[_0x33de('0x28')]('ispeech\x20%s\x20file\x20created',_0xc5eb25));var _0x480d49=this['ispeechASR'][_0x33de('0xbd')](this,_0x197090,_0xc5eb25);if(_0x480d49){for(var _0x1c7d5d in _0x480d49){if(_0x480d49[_0x33de('0x97')](_0x1c7d5d)){this[_0x33de('0x39')]['setVariable'](util['format'](_0x33de('0x14c'),_0x1c7d5d[_0x33de('0xfa')]()),_0x480d49[_0x1c7d5d]);}}return this[_0x33de('0x39')][_0x33de('0xa7')](util['format'](_0x33de('0x14d'),JSON[_0x33de('0x70')](_0x480d49)));}}return _0x4cd67a;};AGIVertices[_0x33de('0xf')]['ispeechtts']=function(_0x2fb160){logger[_0x33de('0x2e')](util[_0x33de('0x28')](_0x33de('0x14e'),_0x2fb160[_0x33de('0x37')]));if(!this[_0x33de('0xa4')](_0x2fb160['key'])){return this['channel'][_0x33de('0xa7')](_0x33de('0xe4'));}if(!this['isConfigured'](_0x2fb160[_0x33de('0x5c')])){return this[_0x33de('0x39')]['noop'](_0x33de('0xa8'));}this['channel'][_0x33de('0xa7')](util['format'](_0x33de('0x14f'),_0x2fb160[_0x33de('0x5c')]));var _0x4306e1=this['ispeechTTS']['sync'](this,_0x2fb160);if(_0x4306e1){this[_0x33de('0x39')][_0x33de('0xa7')](util[_0x33de('0x28')]('ispeech\x20%s\x20file\x20created',_0x4306e1));var _0x36296c=this[_0x33de('0x39')][_0x33de('0xfd')](_0x4306e1,_0x2fb160[_0x33de('0x12b')]);try{fs['unlink'](_0x4306e1+_0x33de('0xff'));}catch(_0x3f8e4d){logger[_0x33de('0x2c')](_0x3f8e4d);}return _0x36296c;}return this['channel']['error'](_0x2fb160,_0x33de('0x150'));};AGIVertices[_0x33de('0xf')][_0x33de('0x151')]=function(_0x326346){logger[_0x33de('0x2e')](util['format'](_0x33de('0x152'),_0x326346[_0x33de('0x37')]));if(!this[_0x33de('0xa4')](_0x326346[_0x33de('0x153')])){return this['channel'][_0x33de('0x2c')](_0x326346,'no\x20find\x20by\x20configured');}logger[_0x33de('0x2e')](util['format'](_0x33de('0x154'),this[_0x33de('0x39')][_0x33de('0x3b')],_0x326346['findBy']));var _0x42c21d=this['agentLogin'][_0x33de('0xbd')](this,_0x326346[_0x33de('0x153')]);if(_0x42c21d){logger[_0x33de('0x2e')](util[_0x33de('0x28')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x33de('0x3b')],_0x326346[_0x33de('0x153')]));this['channel'][_0x33de('0xa7')](util[_0x33de('0x28')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x33de('0x39')]['callerid'],_0x326346[_0x33de('0x153')]));return{'code':0xc8,'result':'success'};}else{logger[_0x33de('0x2e')](util[_0x33de('0x28')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x33de('0x39')]['callerid'],_0x326346[_0x33de('0x153')]));this['channel'][_0x33de('0xa7')](util[_0x33de('0x28')](_0x33de('0x155'),this[_0x33de('0x39')][_0x33de('0x3b')],_0x326346[_0x33de('0x153')]));return{'code':0xc8,'result':_0x33de('0x156')};}};AGIVertices[_0x33de('0xf')]['logout']=function(_0x74059c){logger[_0x33de('0x2e')](util['format']('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x74059c[_0x33de('0x37')]));if(!this['isConfigured'](_0x74059c[_0x33de('0x153')])){return this[_0x33de('0x39')][_0x33de('0x2c')](_0x74059c,_0x33de('0x157'));}logger['info'](util[_0x33de('0x28')](_0x33de('0x154'),this[_0x33de('0x39')][_0x33de('0x3b')],_0x74059c['findBy']));var _0x38f47a=this['agentLogout'][_0x33de('0xbd')](this,_0x74059c[_0x33de('0x153')]);if(_0x38f47a){logger[_0x33de('0x2e')](util[_0x33de('0x28')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x33de('0x39')][_0x33de('0x3b')],_0x74059c[_0x33de('0x153')]));this[_0x33de('0x39')][_0x33de('0xa7')](util[_0x33de('0x28')](_0x33de('0x158'),this[_0x33de('0x39')][_0x33de('0x3b')],_0x74059c[_0x33de('0x153')]));return{'code':0xc8,'result':'success'};}else{logger[_0x33de('0x2e')](util['format'](_0x33de('0x155'),this['channel']['callerid'],_0x74059c[_0x33de('0x153')]));this[_0x33de('0x39')]['noop'](util['format'](_0x33de('0x155'),this[_0x33de('0x39')][_0x33de('0x3b')],_0x74059c['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x33de('0xf')][_0x33de('0x159')]=function(_0xbf6060){logger[_0x33de('0x2e')](util[_0x33de('0x28')](_0x33de('0x15a'),_0xbf6060[_0x33de('0x37')]));if(!this[_0x33de('0xa4')](_0xbf6060[_0x33de('0x15b')])){return this[_0x33de('0x39')][_0x33de('0x2c')](_0xbf6060,_0x33de('0x15c'));}this[_0x33de('0x39')]['noop'](util['format']('math\x20%s',_0xbf6060[_0x33de('0x15b')]));var _0x143f26=eval(_0xbf6060[_0x33de('0x15b')]);if(!this['isConfigured'](_0xbf6060[_0x33de('0xd5')])){return this['channel'][_0x33de('0xa7')](_0x33de('0xd4'));}var _0x3541a5=this[_0x33de('0x10')][_0x33de('0xbd')](this,_0xbf6060['variable_id']);if(!_0x3541a5){return this[_0x33de('0x39')][_0x33de('0x2c')](_0xbf6060,'no\x20variable\x20found');}if(_['isArray'](_0x143f26)){var _0x84546a=this;_0x143f26[_0x33de('0xd7')](function(_0x50bbb5,_0x42e062){_0x84546a['channel'][_0x33de('0x9e')](util[_0x33de('0x28')](_0x33de('0x15d'),_0x3541a5,_0x42e062),_0x50bbb5);});return this[_0x33de('0x39')]['noop'](util[_0x33de('0x28')](_0x33de('0x15e'),_0x3541a5));}else{return this[_0x33de('0x39')][_0x33de('0x9e')](_0x3541a5,_0x143f26);}};AGIVertices[_0x33de('0xf')][_0x33de('0xb')]=function(_0x19ef04){logger[_0x33de('0x2e')](util['format'](_0x33de('0x15f'),_0x19ef04[_0x33de('0x37')]));if(_0x19ef04['retry']===0x0){return this[_0x33de('0xa5')](_0x19ef04);}_0x19ef04[_0x33de('0x10b')]-=0x1;if(!this[_0x33de('0xa4')](_0x19ef04[_0x33de('0x10c')])){return this[_0x33de('0x39')][_0x33de('0x2c')](_0x19ef04,_0x33de('0x160'));}var _0x66c380=this['getSound'][_0x33de('0xbd')](this,_0x19ef04[_0x33de('0x10c')]);if(!_0x66c380){return this[_0x33de('0x39')][_0x33de('0x2c')](_0x19ef04,_0x33de('0x10d'));}var _0x355247=this[_0x33de('0x39')]['getData'](_0x66c380,_0x19ef04[_0x33de('0x10f')],_0x19ef04[_0x33de('0x161')]);var _0x2f2277=_0x355247['result'];if(_0x355247['result']===-0x1){this[_0x33de('0x35')]['sync'](this,_0x19ef04,'-1');return _0x355247;}else if(_0x355247['extra']===_0x33de('0x67')){_0x355247['result']=_0x355247[_0x33de('0xac')]['length']>0x0?_0x355247[_0x33de('0xac')]:'t';}else if(_[_0x33de('0x44')](_0x355247[_0x33de('0xac')])){_0x355247[_0x33de('0xac')]='#';_0x2f2277='#';}if(!this['isConfigured'](_0x19ef04['variable_id'])){this[_0x33de('0x39')]['noop'](_0x33de('0xd4'));}else{var _0x122577=this['getVariable']['sync'](this,_0x19ef04[_0x33de('0xd5')]);if(!_0x122577){return this[_0x33de('0x39')][_0x33de('0x2c')](_0x19ef04,_0x33de('0xd6'));}this['channel'][_0x33de('0x9e')](_0x122577,_0x2f2277);}this[_0x33de('0x35')][_0x33de('0xbd')](this,_0x19ef04,_0x2f2277);return _0x355247;};AGIVertices[_0x33de('0xf')][_0x33de('0xa7')]=function(_0x39803e){logger[_0x33de('0x2e')](util[_0x33de('0x28')](_0x33de('0x162'),_0x39803e[_0x33de('0x37')]));return this[_0x33de('0x39')]['noop'](_0x39803e['output']||_0x39803e[_0x33de('0x37')]);};AGIVertices['prototype'][_0x33de('0x163')]=function(_0x38bf26){logger[_0x33de('0x2e')](util[_0x33de('0x28')](_0x33de('0x164'),_0x38bf26['label']));if(!this['isConfigured'](_0x38bf26[_0x33de('0x153')])){return this[_0x33de('0x39')][_0x33de('0x2c')](_0x38bf26,_0x33de('0x157'));}logger[_0x33de('0x2e')](util[_0x33de('0x28')](_0x33de('0x154'),this['channel'][_0x33de('0x3b')],_0x38bf26['findBy']));var _0x407db2=this['getPause'][_0x33de('0xbd')](this,_0x38bf26[_0x33de('0x165')]);var _0x2679a3=this[_0x33de('0x4f')][_0x33de('0xbd')](this,_0x38bf26[_0x33de('0x153')],_0x407db2);if(_0x2679a3){logger['info'](util[_0x33de('0x28')](_0x33de('0x158'),this['channel'][_0x33de('0x3b')],_0x38bf26['findBy']));this['channel'][_0x33de('0xa7')](util[_0x33de('0x28')]('AGENT\x20%s\x20FOUND\x20BY',this['channel']['callerid'],_0x38bf26['findBy']));return{'code':0xc8,'result':_0x33de('0x166')};}else{logger[_0x33de('0x2e')](util[_0x33de('0x28')](_0x33de('0x155'),this[_0x33de('0x39')][_0x33de('0x3b')],_0x38bf26[_0x33de('0x153')]));this[_0x33de('0x39')][_0x33de('0xa7')](util['format'](_0x33de('0x158'),this[_0x33de('0x39')]['callerid'],_0x38bf26[_0x33de('0x153')]));return{'code':0xc8,'result':_0x33de('0x156')};}};AGIVertices['prototype']['playback']=function(_0x1d8fe1){logger[_0x33de('0x2e')](util[_0x33de('0x28')](_0x33de('0x167'),_0x1d8fe1[_0x33de('0x37')]));if(!this[_0x33de('0xa4')](_0x1d8fe1[_0x33de('0x10c')])){return this['channel'][_0x33de('0x2c')](_0x1d8fe1,_0x33de('0x160'));}var _0x5e4812=this[_0x33de('0x1f')][_0x33de('0xbd')](this,_0x1d8fe1[_0x33de('0x10c')]);if(!_0x5e4812){return this['channel'][_0x33de('0x2c')](_0x1d8fe1,_0x33de('0x10d'));}var _0x4da794=this[_0x33de('0x39')]['exec'](_0x33de('0x168'),[_0x5e4812,_0x1d8fe1[_0x33de('0xe1')]]);if(_0x4da794[_0x33de('0xac')]===-0x1){return _0x4da794;}return this['channel'][_0x33de('0xa7')](util[_0x33de('0x28')](_0x33de('0xc1'),_0x33de('0x168'),_0x5e4812));};AGIVertices[_0x33de('0xf')][_0x33de('0x169')]=function(_0x10c6ff){logger[_0x33de('0x2e')](util[_0x33de('0x28')](_0x33de('0x16a'),_0x10c6ff['label']));if(!this[_0x33de('0xa4')](_0x10c6ff[_0x33de('0x16b')])){return this[_0x33de('0x39')][_0x33de('0x2c')](_0x10c6ff,_0x33de('0x16c'));}var _0x12ffc8='';var _0x1fdbb3=parseInt(_0x10c6ff[_0x33de('0x16b')],0xa);if(isNaN(_0x1fdbb3)){_0x12ffc8=_0x10c6ff[_0x33de('0x16b')];}else{_0x12ffc8=this[_0x33de('0x16d')][_0x33de('0xbd')](this,_0x10c6ff[_0x33de('0x16b')]);if(!_0x12ffc8){return this[_0x33de('0x39')][_0x33de('0x2c')](_0x10c6ff,_0x33de('0x16e'));}}var _0x54b445='';if(this[_0x33de('0xa4')](_0x10c6ff[_0x33de('0x10c')])){var _0x39bdd7=this[_0x33de('0x1f')][_0x33de('0xbd')](this,_0x10c6ff['file_id']);if(_0x39bdd7){_0x54b445=_0x39bdd7;}}this[_0x33de('0x35')][_0x33de('0xbd')](this,_0x10c6ff,_0x12ffc8);if(_0x10c6ff['opts'][_0x33de('0x16f')]('x')<0x0){_0x10c6ff[_0x33de('0xe1')]+='x';}if(_0x10c6ff[_0x33de('0xe1')][_0x33de('0x16f')]('X')<0x0){_0x10c6ff[_0x33de('0xe1')]+='X';}this[_0x33de('0x39')][_0x33de('0x9e')](_0x33de('0x170'),_0x12ffc8?_0x12ffc8[_0x33de('0x171')]():'');var _0x1356a4=this[_0x33de('0x39')][_0x33de('0x56')](_0x33de('0x172'),[_0x12ffc8,_0x10c6ff['opts'],_0x10c6ff[_0x33de('0x64')],_0x54b445,_0x10c6ff['timeout'],_0x10c6ff['agi'],_0x10c6ff[_0x33de('0x173')],_0x10c6ff[_0x33de('0x174')],'',_0x10c6ff[_0x33de('0x175')]]);if(_0x1356a4[_0x33de('0xac')]===-0x1){return _0x1356a4;}return this['channel'][_0x33de('0xa7')](util[_0x33de('0x28')](_0x33de('0xc1'),_0x33de('0x172'),_0x12ffc8));};AGIVertices[_0x33de('0xf')][_0x33de('0x176')]=function(_0x1a798b){logger[_0x33de('0x2e')](util[_0x33de('0x28')](_0x33de('0x177'),_0x1a798b[_0x33de('0x37')]));var _0x131fb0=_0x1a798b[_0x33de('0x178')]||_0x33de('0x133');var _0x24e83e=util[_0x33de('0x28')]('%s_%s',this[_0x33de('0x39')][_0x33de('0x36')],rs[_0x33de('0x114')](0x5));var _0x248831=util[_0x33de('0x28')]('%s/recordings/%s.%s',FILES_PATH,_0x24e83e,_0x131fb0);var _0x30d08b=util[_0x33de('0x28')](_0x33de('0x134'),FILES_PATH,_0x24e83e);this[_0x33de('0x3c')][_0x33de('0xbd')](this,_0x1a798b,_0x24e83e,_0x248831);this[_0x33de('0x39')]['setVariable'](_0x33de('0x179'),_0x24e83e);logger[_0x33de('0x2e')](_0x33de('0x17a'),_0x30d08b,_0x131fb0,_0x1a798b[_0x33de('0x17b')],_0x1a798b[_0x33de('0x67')]);return this[_0x33de('0x39')][_0x33de('0x12a')](_0x30d08b,_0x131fb0,_0x1a798b[_0x33de('0x17b')],_0x1a798b[_0x33de('0x67')],undefined,!![]);};AGIVertices[_0x33de('0xf')][_0x33de('0x17c')]=function(_0x23a9f5){logger[_0x33de('0x2e')](util['format'](_0x33de('0x17d'),_0x23a9f5['label']));if(!this['isConfigured'](_0x23a9f5['url'])){return this['channel'][_0x33de('0xa7')](_0x33de('0x17e'));}var _0x255174=this[_0x33de('0x17f')][_0x33de('0xbd')](this,_0x23a9f5);logger[_0x33de('0x2e')](util[_0x33de('0x28')]('Response:',util[_0x33de('0x180')](_0x255174,{'showHidden':![],'depth':null})));if(!this[_0x33de('0xa4')](_0x23a9f5[_0x33de('0xd5')])){return this[_0x33de('0x39')][_0x33de('0xa7')](_0x33de('0x181'));}var _0x3659b7=this[_0x33de('0x10')][_0x33de('0xbd')](this,_0x23a9f5[_0x33de('0xd5')]);if(!_0x3659b7){return this[_0x33de('0x39')][_0x33de('0x2c')](_0x23a9f5,_0x33de('0xd6'));}this[_0x33de('0x39')][_0x33de('0x9e')](util['format'](_0x33de('0x182'),_0x3659b7),_0x255174[_0x33de('0x71')]?_0x255174[_0x33de('0x71')]:_0x33de('0x183'));this[_0x33de('0x39')][_0x33de('0x9e')](util['format'](_0x33de('0x184'),_0x3659b7),_0x255174[_0x33de('0x72')]?_0x255174['statusMessage']:'OK');if(_0x255174[_0x33de('0x6a')]){try{this[_0x33de('0x9c')](_0x255174['body'],_0x3659b7);}catch(_0x5c5750){logger[_0x33de('0x2c')](util[_0x33de('0x28')]('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x3659b7));}}return this[_0x33de('0x39')][_0x33de('0xa7')](util[_0x33de('0x28')](_0x33de('0xdb'),_0x3659b7));};AGIVertices[_0x33de('0xf')]['saydigits']=function(_0x4160f4){logger[_0x33de('0x2e')](util[_0x33de('0x28')](_0x33de('0x185'),_0x4160f4[_0x33de('0x37')]));return this['channel'][_0x33de('0x186')](_0x4160f4[_0x33de('0x187')][_0x33de('0x58')](/\s+/g,''),_0x4160f4[_0x33de('0x17b')]);};AGIVertices[_0x33de('0xf')]['saynumber']=function(_0x4fa576){logger[_0x33de('0x2e')](util[_0x33de('0x28')](_0x33de('0x188'),_0x4fa576[_0x33de('0x37')]));return this[_0x33de('0x39')]['sayNumber'](_0x4fa576[_0x33de('0x66')][_0x33de('0x58')](/\s+/g,''),_0x4fa576[_0x33de('0x17b')]);};AGIVertices[_0x33de('0xf')][_0x33de('0x189')]=function(_0x556599){logger['info'](util[_0x33de('0x28')](_0x33de('0x18a'),_0x556599[_0x33de('0x37')]));return this['channel'][_0x33de('0x18b')](_0x556599[_0x33de('0x5c')],_0x556599[_0x33de('0x17b')]);};AGIVertices[_0x33de('0xf')][_0x33de('0x18c')]=function(_0x89da12){logger[_0x33de('0x2e')](util[_0x33de('0x28')](_0x33de('0x18d'),_0x89da12['label']));if(!this['isConfigured'](_0x89da12[_0x33de('0x18e')])){return this[_0x33de('0x39')][_0x33de('0xa7')](_0x33de('0x18f'));}var _0x4dab4a=this[_0x33de('0x21')]['sync'](this,_0x89da12[_0x33de('0x18e')]);if(!_0x4dab4a||!_0x4dab4a[_0x33de('0x190')]){return this[_0x33de('0x39')][_0x33de('0x2c')](_0x89da12,_0x33de('0x191'));}var _0x2a49a3={'from':util[_0x33de('0x28')](_0x33de('0x192'),_0x4dab4a['name'],_0x4dab4a[_0x33de('0x193')]||_0x4dab4a[_0x33de('0x190')]['user']),'to':_0x89da12['to']||'','cc':_0x89da12['cc']||'','bcc':_0x89da12[_0x33de('0x194')]||'','subject':_0x89da12[_0x33de('0x195')],'html':_0x89da12[_0x33de('0x5c')],'text':_0x89da12[_0x33de('0x5c')]};if(this[_0x33de('0xa4')](_0x89da12[_0x33de('0x196')])){}logger[_0x33de('0xdd')](_0x33de('0x197'),JSON[_0x33de('0x70')](_0x2a49a3));this[_0x33de('0x35')][_0x33de('0xbd')](this,_0x89da12,_0x89da12[_0x33de('0x18e')]);this[_0x33de('0x39')]['noop'](util[_0x33de('0x28')](_0x33de('0x198'),_0x4dab4a['name']));this[_0x33de('0x22')]['sync'](this,_0x4dab4a['smtpOptions'],_0x2a49a3);return this['channel'][_0x33de('0xa7')](_0x33de('0x199'));};AGIVertices['prototype']['sendFax']=function(_0x3f6020){logger[_0x33de('0x2e')](util[_0x33de('0x28')](_0x33de('0x19a'),_0x3f6020[_0x33de('0x37')]));return this[_0x33de('0x39')][_0x33de('0xa7')](_0x33de('0x19b'));};AGIVertices[_0x33de('0xf')][_0x33de('0x19c')]=function(_0x1bd41c){logger[_0x33de('0x2e')](util[_0x33de('0x28')](_0x33de('0x19d'),_0x1bd41c[_0x33de('0x37')]));if(!this[_0x33de('0xa4')](_0x1bd41c['sms_account_id'])){return this[_0x33de('0x39')][_0x33de('0xa7')](_0x33de('0x19e'));}var _0x2945e2=this['getSmsAccount']['sync'](this,_0x1bd41c[_0x33de('0x19f')]);if(!_0x2945e2){return this[_0x33de('0x39')][_0x33de('0x2c')](_0x1bd41c,'no\x20sms\x20account\x20found');}var _0x17a81d={'body':_0x1bd41c[_0x33de('0x1a0')],'phone':_0x1bd41c['to']||'','SmsAccountId':_0x2945e2['id']};logger['debug'](_0x33de('0x1a1'),JSON['stringify'](_0x17a81d));this[_0x33de('0x35')][_0x33de('0xbd')](this,_0x1bd41c,_0x1bd41c['sms_account_id']);this[_0x33de('0x39')][_0x33de('0xa7')](util['format'](_0x33de('0x1a2'),_0x2945e2[_0x33de('0x13')]));this['createSmsMessage'][_0x33de('0xbd')](this,_0x17a81d);return this[_0x33de('0x39')]['noop'](_0x33de('0x1a3'));};AGIVertices[_0x33de('0xf')][_0x33de('0x1a4')]=function(_0x5ac152){logger[_0x33de('0x2e')](util[_0x33de('0x28')](_0x33de('0x1a5'),_0x5ac152[_0x33de('0x37')]));if(!this['isConfigured'](_0x5ac152[_0x33de('0xd5')])){return this[_0x33de('0x39')][_0x33de('0x2c')](_0x5ac152,_0x33de('0x1a6'));}var _0x51675a=this[_0x33de('0x10')][_0x33de('0xbd')](this,_0x5ac152[_0x33de('0xd5')]);if(!_0x51675a){return this[_0x33de('0x39')]['error'](_0x5ac152,_0x33de('0xd6'));}return this['channel']['setVariable'](_0x51675a,_0x5ac152['variable_value']);};AGIVertices['prototype']['start']=function(_0x5a96f4){logger[_0x33de('0x2e')](util[_0x33de('0x28')](_0x33de('0x1a7'),_0x5a96f4[_0x33de('0x37')]));this[_0x33de('0x39')]['noop']('START\x20CALLY\x20SQUARE');if(_0x5a96f4['answer']===_0x33de('0x1a8')){this[_0x33de('0x39')][_0x33de('0xa7')](_0x33de('0x1a9'));return this['channel'][_0x33de('0xb6')]();}return this[_0x33de('0x39')][_0x33de('0xa7')]('Skipped\x20Answer');};AGIVertices['prototype'][_0x33de('0x1aa')]=function(_0x4c64a5){logger['info'](util[_0x33de('0x28')](_0x33de('0x1ab'),_0x4c64a5[_0x33de('0x37')]));if(!this[_0x33de('0xa4')](_0x4c64a5['project_id'])){return this[_0x33de('0x39')][_0x33de('0x2c')](_0x4c64a5,'no\x20subproject\x20selected');}var _0x39a0be=this[_0x33de('0x16')][_0x33de('0xbd')](this,_0x4c64a5[_0x33de('0x1ac')]);if(!this[_0x33de('0xa4')](_0x39a0be)){return this[_0x33de('0x39')][_0x33de('0x2c')](_0x4c64a5,util[_0x33de('0x28')](_0x33de('0x1ad'),_0x4c64a5[_0x33de('0x1ac')]));}if(_0x39a0be===this[_0x33de('0x39')][_0x33de('0x3a')]){return this[_0x33de('0x39')][_0x33de('0x2c')](_0x4c64a5,_0x33de('0x1ae'));}this[_0x33de('0x35')]['sync'](this,_0x4c64a5,_0x39a0be);var _0x1fda86=this['channel'][_0x33de('0x56')](_0x33de('0x1af'),util[_0x33de('0x28')](_0x33de('0x1b0'),config['agi'][_0x33de('0x1b1')]||'127.0.0.1',_0x39a0be,this[_0x33de('0x39')][_0x33de('0x3a')]));if(_0x1fda86['result']===-0x1){return _0x1fda86;}return this[_0x33de('0x39')][_0x33de('0xa7')](util[_0x33de('0x28')]('Executed\x20command\x20%s\x20%s',_0x33de('0x1af'),_0x39a0be));};AGIVertices[_0x33de('0xf')][_0x33de('0x1b2')]=function(_0x2047c6){logger['info'](util[_0x33de('0x28')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x2047c6[_0x33de('0x37')]));var _0x287e4f=this[_0x33de('0x55')]['sync'](this,_0x2047c6['command']);this[_0x33de('0x35')][_0x33de('0xbd')](this,_0x2047c6,_0x2047c6[_0x33de('0xb4')]);if(this[_0x33de('0xa4')](_0x2047c6[_0x33de('0xd5')])){var _0x3d7562=this[_0x33de('0x10')][_0x33de('0xbd')](this,_0x2047c6[_0x33de('0xd5')]);if(_0x3d7562){this[_0x33de('0x39')]['setVariable'](_0x3d7562,_0x287e4f);return this['channel'][_0x33de('0xa7')](util[_0x33de('0x28')](_0x33de('0x1b3'),_0x2047c6[_0x33de('0xb4')],_0x3d7562));}}return this['channel']['noop'](util[_0x33de('0x28')](_0x33de('0x1b4'),_0x2047c6['command']));};AGIVertices['prototype'][_0x33de('0x1b5')]=function(_0x56e607){logger[_0x33de('0x2e')](util[_0x33de('0x28')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x56e607[_0x33de('0x37')]));_0x56e607['text']=_0x56e607[_0x33de('0x5c')][_0x33de('0x58')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x33de('0xa4')](_0x56e607[_0x33de('0x5a')])){return this['channel'][_0x33de('0xa7')](_0x33de('0x1b6'));}if(!this[_0x33de('0xa4')](_0x56e607['text'])){return this[_0x33de('0x39')]['noop'](_0x33de('0xa8'));}this[_0x33de('0x39')][_0x33de('0xa7')](util[_0x33de('0x28')]('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x56e607['text']));var _0x189456=this['googleCloudTTS'][_0x33de('0xbd')](this,_0x56e607);if(_0x189456){this[_0x33de('0x39')]['noop'](util[_0x33de('0x28')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x189456));var _0x4c3fbe=this[_0x33de('0x39')][_0x33de('0xfd')](_0x189456);try{fs[_0x33de('0xfe')](_0x189456+'.wav');}catch(_0x2890ce){logger['error'](_0x2890ce);}return _0x4c3fbe;}return this['channel']['error'](_0x56e607,_0x33de('0x1b7'));};AGIVertices[_0x33de('0xf')][_0x33de('0x1b8')]=function(_0x362516){logger[_0x33de('0x2e')](util[_0x33de('0x28')](_0x33de('0x1b9'),_0x362516['label']));_0x362516['text']=_0x362516[_0x33de('0x5c')][_0x33de('0x58')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x33de('0xa4')](_0x362516['text'])){return this[_0x33de('0x39')][_0x33de('0xa7')](_0x33de('0xa8'));}this[_0x33de('0x39')][_0x33de('0xa7')](util[_0x33de('0x28')]('Trying\x20Google\x20TTS\x20%s',_0x362516[_0x33de('0x5c')]));var _0x52c9fa=this[_0x33de('0x62')][_0x33de('0xbd')](this,_0x362516);if(_0x52c9fa){this[_0x33de('0x39')][_0x33de('0xa7')](util['format'](_0x33de('0x1ba'),_0x52c9fa));var _0x443f6c=this['channel'][_0x33de('0xfd')](_0x52c9fa);try{fs[_0x33de('0xfe')](_0x52c9fa+_0x33de('0xff'));}catch(_0x515250){logger['error'](_0x515250);}return _0x443f6c;}return this[_0x33de('0x39')][_0x33de('0x2c')](_0x362516,'Google\x20TTS\x20is\x20unreachable');};AGIVertices['prototype']['unpause']=function(_0x49124b){logger[_0x33de('0x2e')](util[_0x33de('0x28')]('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x49124b[_0x33de('0x37')]));if(!this['isConfigured'](_0x49124b[_0x33de('0x153')])){return this[_0x33de('0x39')][_0x33de('0x2c')](_0x49124b,_0x33de('0x157'));}logger[_0x33de('0x2e')](util[_0x33de('0x28')](_0x33de('0x154'),this[_0x33de('0x39')][_0x33de('0x3b')],_0x49124b[_0x33de('0x153')]));var _0x3e26dc=this['agentUnpause'][_0x33de('0xbd')](this,_0x49124b[_0x33de('0x153')]);if(_0x3e26dc){logger[_0x33de('0x2e')](util[_0x33de('0x28')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x33de('0x39')][_0x33de('0x3b')],_0x49124b[_0x33de('0x153')]));this[_0x33de('0x39')][_0x33de('0xa7')](util[_0x33de('0x28')](_0x33de('0x158'),this[_0x33de('0x39')][_0x33de('0x3b')],_0x49124b[_0x33de('0x153')]));return{'code':0xc8,'result':_0x33de('0x166')};}else{logger[_0x33de('0x2e')](util[_0x33de('0x28')](_0x33de('0x155'),this[_0x33de('0x39')]['callerid'],_0x49124b[_0x33de('0x153')]));this['channel'][_0x33de('0xa7')](util[_0x33de('0x28')](_0x33de('0x155'),this['channel'][_0x33de('0x3b')],_0x49124b[_0x33de('0x153')]));return{'code':0xc8,'result':_0x33de('0x156')};}};AGIVertices[_0x33de('0xf')][_0x33de('0x1bb')]=function(_0x1480f3){logger[_0x33de('0x2e')](util[_0x33de('0x28')](_0x33de('0x1bc'),_0x1480f3[_0x33de('0x37')]));var _0x2a71f5=this['channel'][_0x33de('0x56')](_0x33de('0x1bd'),[_0x1480f3[_0x33de('0x1be')],_0x1480f3[_0x33de('0x75')]]);if(_0x2a71f5[_0x33de('0xac')]===-0x1){return _0x2a71f5;}return this[_0x33de('0x39')][_0x33de('0xa7')](util[_0x33de('0x28')](_0x33de('0xc1'),'VOICEMAIL',_0x1480f3[_0x33de('0x1be')]));};AGIVertices[_0x33de('0xf')][_0x33de('0x1bf')]=function(_0x3f87eb){logger[_0x33de('0x2e')](util[_0x33de('0x28')](_0x33de('0x1c0'),_0x3f87eb['label']));if(!this['isConfigured'](_0x3f87eb[_0x33de('0xd5')])){return this[_0x33de('0x39')]['error'](_0x3f87eb,_0x33de('0x1a6'));}var _0xd88542=this['getVariable']['sync'](this,_0x3f87eb[_0x33de('0xd5')]);if(!_0xd88542){return this[_0x33de('0x39')][_0x33de('0x2c')](_0x3f87eb,'no\x20variable\x20found');}var _0x18a859=this['channel']['getVariable'](_0xd88542);return{'code':0xc8,'result':_0x18a859['extra']?_0x18a859['extra']:'-'};};String['prototype'][_0x33de('0xa0')]=function(_0x5839bb,_0x1bd703){return this[_0x33de('0x9f')](_0x5839bb)[_0x33de('0x1c1')](_0x1bd703);};module[_0x33de('0x1c2')]=AGIVertices; \ No newline at end of file +var _0x3f59=['mailRpc','prototype','getVariable','getVariableById','then','name','getVoiceQueue','catch','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUser','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','format','%s/sounds/converted/%s','getQueryOdbc','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','channel','uniqueid','label','agicommand','arg_1','createSquareRecording','callerid','calleridname','context','extension','accountcode','file','createSquareMessage','createCmContact','isEmpty','isNil','random','lastName','list_id','callback','toString','getPause','agent','agentPause','error','agentUnpause','agentLogout','agentLogin','%s/%s@from-sip/n','LOCAL','shellCommand','exec','trim','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','method','timeout','number','POST','PUT','toUpperCase','body','headers','parse','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','uri','render','url','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','message','options','googleDialogflow','key','dialogflow_language','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','isConfigured','awsPolly','aws_access_key_id','aws_polly_voice','Amy','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','includes','hasOwnProperty','isString','replaceObjectAllVariables','isPlainObject','recursiveNodeIndex','isArray','replaceAllVariables','saveRestApiResult','length','%s.%s','split','replaceAll','extra','getAndSetVariable','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','setVariable','sync','retry','maxRetry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','result','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','Enter\x20in\x20ANSWER\x20(%s)\x20block','answer','no\x20list\x20selected','scheduledAt','delay','add','minutes','callback_priority','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','phone','custom_app','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','sestekasr','SESTEK_ASR_CONFIDENCE','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20odbc\x20database\x20found','replace','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','no\x20user\x20selected','sip_id','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','speech','out','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','Trying\x20DialogflowV2:\x20%s','googleDialogflowV2','providerResponse','DialogflowV2\x20is\x20unreachable','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','username','no\x20username\x20configured','password','no\x20password\x20configured','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','sesteknda','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','getTrunk','no\x20trunk\x20found','trunk_name','SIP/%s/%s','Enter\x20in\x20FINALLY\x20(%s)\x20block','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','response','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','aws_secret_access_key','no\x20valid\x20credentials\x20configured','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','%s/recordings/%s','beep','NOBEEP','intKey','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','wav','recordFile','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','continueAt','priority','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','no\x20interval\x20configured','interval_id','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','success','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Executed\x20command\x20%s\x20%s','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','indexOf','XMCS-QUEUE','macro','gosub','QUEUE','record','Enter\x20in\x20RECORD\x20(%s)\x20block','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','no\x20url\x20configured','Response:','no\x20variable\x20selected\x20for\x20the\x20response','200','%s_STATUS_MESSAGE','statusMessage','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','\x22%s\x22\x20<%s>','email','bcc','subject','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','Skipped\x20Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','host','system','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','mailbox','VOICEMAIL','Enter\x20in\x20SWITCH\x20(%s)\x20block','util','lodash','odbc','randomstring','moment','mustache','request-promise','../../config/logger','agi','../../config/environment','../../config/environment/shared','rawHeaders','rawBody','menu','getdigits','getsecretdigits','rpc'];(function(_0x1782c4,_0x25692c){var _0x46bc88=function(_0x423555){while(--_0x423555){_0x1782c4['push'](_0x1782c4['shift']());}};_0x46bc88(++_0x25692c);}(_0x3f59,0x1b0));var _0x93f5=function(_0x265698,_0x159db4){_0x265698=_0x265698-0x0;var _0x16ce2a=_0x3f59[_0x265698];return _0x16ce2a;};'use strict';var fs=require('fs');var util=require(_0x93f5('0x0'));var _=require(_0x93f5('0x1'));var sh=require('shelljs');var odbc=require(_0x93f5('0x2'))();var rs=require(_0x93f5('0x3'));var moment=require(_0x93f5('0x4'));var Mustache=require(_0x93f5('0x5'));var rp=require(_0x93f5('0x6'));var logger=require(_0x93f5('0x7'))(_0x93f5('0x8'));var config=require(_0x93f5('0x9'));var shared=require(_0x93f5('0xa'));var scripts=require('./scripts');var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=[_0x93f5('0xb'),_0x93f5('0xc')];var verticesWithRetry=[_0x93f5('0xd'),_0x93f5('0xe'),_0x93f5('0xf')];var AGIVertices=function(_0x5325a7,_0x4e3331,_0x491809){this['channel']=_0x5325a7;this[_0x93f5('0x10')]=_0x4e3331;this[_0x93f5('0x11')]=_0x491809;};AGIVertices[_0x93f5('0x12')][_0x93f5('0x13')]=function(_0x4f85bf,_0x559793){this[_0x93f5('0x10')][_0x93f5('0x14')](_0x4f85bf)[_0x93f5('0x15')](function(_0x4976d1){_0x559793(null,_0x4976d1?_0x4976d1[_0x93f5('0x16')]:![]);})['catch'](function(_0x3e7e84){_0x559793(_0x3e7e84);});};AGIVertices[_0x93f5('0x12')][_0x93f5('0x17')]=function(_0x161fe1,_0x3d85da){this[_0x93f5('0x10')]['getVoiceQueueById'](_0x161fe1)[_0x93f5('0x15')](function(_0x46ff12){_0x3d85da(null,_0x46ff12?_0x46ff12[_0x93f5('0x16')]:![]);})[_0x93f5('0x18')](function(_0x316fb2){_0x3d85da(_0x316fb2);});};AGIVertices[_0x93f5('0x12')][_0x93f5('0x19')]=function(_0x320517,_0x35afc3){this[_0x93f5('0x10')][_0x93f5('0x1a')](_0x320517)[_0x93f5('0x15')](function(_0x4df4ec){_0x35afc3(null,_0x4df4ec?_0x4df4ec[_0x93f5('0x16')]:![]);})[_0x93f5('0x18')](function(_0x45eac3){_0x35afc3(_0x45eac3);});};AGIVertices[_0x93f5('0x12')][_0x93f5('0x1b')]=function(_0x569c0c,_0x34edb9){this[_0x93f5('0x10')][_0x93f5('0x1c')](_0x569c0c)[_0x93f5('0x15')](function(_0x3fc4ab){_0x34edb9(null,_0x3fc4ab?_0x3fc4ab[_0x93f5('0x1d')]:![]);})[_0x93f5('0x18')](function(_0x257aa8){_0x34edb9(_0x257aa8);});};AGIVertices[_0x93f5('0x12')][_0x93f5('0x1e')]=function(_0x2ef296,_0xb59065){this[_0x93f5('0x10')]['getUserById'](_0x2ef296)[_0x93f5('0x15')](function(_0x27bde4){_0xb59065(null,_0x27bde4?_0x27bde4[_0x93f5('0x16')]:![]);})[_0x93f5('0x18')](function(_0x365afd){_0xb59065(_0x365afd);});};AGIVertices[_0x93f5('0x12')]['getTrunk']=function(_0x10fb86,_0x2e035f){this['rpc'][_0x93f5('0x1f')](_0x10fb86)[_0x93f5('0x15')](function(_0x57ae09){_0x2e035f(null,_0x57ae09?_0x57ae09['name']:![]);})[_0x93f5('0x18')](function(_0x11e86c){_0x2e035f(_0x11e86c);});};AGIVertices[_0x93f5('0x12')][_0x93f5('0x20')]=function(_0x5d71d4,_0x2bc6d1){var _0x4f8063=this;this[_0x93f5('0x10')][_0x93f5('0x21')](_0x5d71d4)['then'](function(_0x36d579){_0x2bc6d1(null,_0x36d579?_0x4f8063[_0x93f5('0x22')](_0x36d579[_0x93f5('0x23')]):![]);})['catch'](function(_0x3090a9){_0x2bc6d1(_0x3090a9);});};AGIVertices['prototype'][_0x93f5('0x24')]=function(_0x5c2ede,_0x448b5a){this[_0x93f5('0x10')]['getMailAccountById'](_0x5c2ede)[_0x93f5('0x15')](function(_0x1c0dcd){_0x448b5a(null,_0x1c0dcd?_0x1c0dcd:![]);})[_0x93f5('0x18')](function(_0xae546e){_0x448b5a(_0xae546e);});};AGIVertices['prototype'][_0x93f5('0x25')]=function(_0x584c7f,_0x385e24,_0x556d3a){this[_0x93f5('0x11')][_0x93f5('0x25')](_0x584c7f,_0x385e24)[_0x93f5('0x15')](function(){_0x556d3a(null);})[_0x93f5('0x18')](function(_0x5acb94){_0x556d3a(_0x5acb94);});};AGIVertices[_0x93f5('0x12')][_0x93f5('0x26')]=function(_0x1e5266,_0x3cefa5){this['rpc'][_0x93f5('0x27')](_0x1e5266)['then'](function(_0x2f869e){if(_0x2f869e){if(_0x2f869e[_0x93f5('0x28')]){_0x3cefa5(null,[_0x2f869e[_0x93f5('0x29')]]);}else{_0x3cefa5(null,_[_0x93f5('0x2a')](_0x2f869e['Intervals'],_0x93f5('0x29')));}}else{_0x3cefa5(null,![]);}})['catch'](function(_0x37b515){_0x3cefa5(_0x37b515);});};AGIVertices['prototype']['getSoundPath']=function(_0x1e1fd1){return util[_0x93f5('0x2b')](_0x93f5('0x2c'),FILES_PATH,_0x1e1fd1);};AGIVertices['prototype'][_0x93f5('0x2d')]=function(_0x1977b1,_0x4c026c,_0x314230){odbc['open'](_0x1977b1,function(_0x333736){if(_0x333736){logger['error'](_0x93f5('0x2e'),_0x333736);_0x314230(_0x333736);}else{logger[_0x93f5('0x2f')](_0x93f5('0x30'));odbc[_0x93f5('0x31')](_0x4c026c,function(_0x477910,_0x509e68){if(_0x477910){logger[_0x93f5('0x2f')](_0x93f5('0x32'),_0x4c026c);_0x314230(_0x477910);}else{logger[_0x93f5('0x2f')](_0x93f5('0x33'),_0x4c026c);odbc[_0x93f5('0x34')](function(_0xfacbe3){if(_0xfacbe3){logger['error'](_0x93f5('0x35'),_0xfacbe3);}_0x314230(null,_0x509e68);});}});}});};AGIVertices[_0x93f5('0x12')][_0x93f5('0x36')]=function(_0x1a6e28,_0x20b873){this[_0x93f5('0x10')]['getSmsAccountById'](_0x1a6e28)[_0x93f5('0x15')](function(_0x4f45d8){_0x20b873(null,_0x4f45d8?_0x4f45d8:![]);})[_0x93f5('0x18')](function(_0x286de9){_0x20b873(_0x286de9);});};AGIVertices['prototype'][_0x93f5('0x37')]=function(_0x2d84da,_0x46f5be){this[_0x93f5('0x10')]['createSmsMessage'](_0x2d84da)[_0x93f5('0x15')](function(_0x591043){_0x46f5be(null,_0x591043);})[_0x93f5('0x18')](function(_0x465fd4){_0x46f5be(_0x465fd4);});};AGIVertices[_0x93f5('0x12')][_0x93f5('0x38')]=function(_0xd4d915,_0x1d4c11,_0x1aa137){this['rpc'][_0x93f5('0x38')]({'uniqueid':this[_0x93f5('0x39')][_0x93f5('0x3a')],'node':_0xd4d915[_0x93f5('0x3b')],'application':_0xd4d915[_0x93f5('0x3c')],'data':_0x1d4c11||null,'project_name':this[_0x93f5('0x39')][_0x93f5('0x3d')],'callerid':this[_0x93f5('0x39')]['callerid']})['then'](function(_0xfe6109){if(_0x1aa137){_0x1aa137(null,_0xfe6109);}})['catch'](function(_0x18ce7e){if(_0x1aa137){_0x1aa137(_0x18ce7e);}});};AGIVertices['prototype'][_0x93f5('0x3e')]=function(_0x41acbb,_0x47ab20,_0x50bbf6,_0x4754c9){this['rpc'][_0x93f5('0x3e')]({'uniqueid':this[_0x93f5('0x39')]['uniqueid'],'callerid':this[_0x93f5('0x39')][_0x93f5('0x3f')],'calleridname':this[_0x93f5('0x39')][_0x93f5('0x40')],'context':this['channel'][_0x93f5('0x41')],'extension':this['channel'][_0x93f5('0x42')],'priority':this[_0x93f5('0x39')]['priority'],'accountcode':this['channel'][_0x93f5('0x43')],'dnid':this[_0x93f5('0x39')]['dnid'],'projectName':this[_0x93f5('0x39')][_0x93f5('0x3d')],'saveName':_0x47ab20,'filename':_0x41acbb[_0x93f5('0x44')]||_0x47ab20,'savePath':_0x50bbf6})['then'](function(_0x544091){_0x4754c9(null,_0x544091);})[_0x93f5('0x18')](function(_0x157667){_0x4754c9(_0x157667);});};AGIVertices['prototype'][_0x93f5('0x45')]=function(_0x5e3d60,_0x2d9c30,_0x222716,_0x219172,_0xdb658b){this[_0x93f5('0x10')][_0x93f5('0x45')]({'uniqueid':this[_0x93f5('0x39')][_0x93f5('0x3a')],'body':_0x5e3d60,'direction':_0x2d9c30,'providerName':_0x222716,'providerResponse':_0x219172})[_0x93f5('0x15')](function(_0x1fded4){if(_0xdb658b){_0xdb658b(null,_0x1fded4);}})[_0x93f5('0x18')](function(_0x209e7a){if(_0xdb658b){_0xdb658b(_0x209e7a);}});};AGIVertices[_0x93f5('0x12')][_0x93f5('0x46')]=function(_0x24b55b,_0xd2d30a){this[_0x93f5('0x10')][_0x93f5('0x46')]({'firstName':_[_0x93f5('0x47')](_0x24b55b['name'])||_[_0x93f5('0x48')](_0x24b55b['name'])?'callback_'+Math[_0x93f5('0x49')]():_0x24b55b['name'],'lastName':_[_0x93f5('0x47')](_0x24b55b['lastName'])||_[_0x93f5('0x48')](_0x24b55b[_0x93f5('0x4a')])?null:_0x24b55b['lastName'],'phone':_0x24b55b['phone'],'ListId':_0x24b55b[_0x93f5('0x4b')],'scheduledat':_0x24b55b['scheduledAt'],'callbackUniqueid':this[_0x93f5('0x39')][_0x93f5('0x3a')],'tags':_0x93f5('0x4c'),'description':'Callback\x20scheduled\x20at\x20'+_0x24b55b['scheduledAt'][_0x93f5('0x4d')](),'priority':_0x24b55b['callback_priority']})['then'](function(_0x4c6383){_0xd2d30a(null,_0x4c6383);})['catch'](function(_0x20b3e0){_0xd2d30a(_0x20b3e0);});};AGIVertices[_0x93f5('0x12')][_0x93f5('0x4e')]=function(_0x170798,_0x4941b3){this['rpc']['getPauseById'](_0x170798)[_0x93f5('0x15')](function(_0x434c4e){_0x4941b3(null,_0x434c4e?_0x434c4e[_0x93f5('0x16')]:![]);})[_0x93f5('0x18')](function(_0x37a148){_0x4941b3(_0x37a148);});};AGIVertices[_0x93f5('0x12')]['agentPause']=function(_0x4d4603,_0x52c30e,_0x1bd031){var _0x4ea59b={'role':_0x93f5('0x4f')};_0x4ea59b[_0x4d4603]=this['channel'][_0x93f5('0x3f')];this[_0x93f5('0x10')][_0x93f5('0x50')](_0x4ea59b,_0x52c30e,this[_0x93f5('0x39')]['uniqueid'])['then'](function(_0xe55c28){_0x1bd031(null,_[_0x93f5('0x48')](_0xe55c28)?![]:!![]);})[_0x93f5('0x18')](function(_0x4289eb){logger[_0x93f5('0x51')](_0x4289eb);_0x1bd031(null,![]);});};AGIVertices[_0x93f5('0x12')][_0x93f5('0x52')]=function(_0x4abe55,_0x2cd189){var _0x107727={'role':_0x93f5('0x4f')};_0x107727[_0x4abe55]=this[_0x93f5('0x39')][_0x93f5('0x3f')];this[_0x93f5('0x10')][_0x93f5('0x52')](_0x107727)[_0x93f5('0x15')](function(_0x30cfdb){_0x2cd189(null,_[_0x93f5('0x48')](_0x30cfdb)?![]:!![]);})[_0x93f5('0x18')](function(_0x2db967){logger['error'](_0x2db967);_0x2cd189(null,![]);});};AGIVertices['prototype']['agentLogout']=function(_0x208557,_0x1296b0){var _0x49e4a1={'role':_0x93f5('0x4f')};_0x49e4a1[_0x208557]=this[_0x93f5('0x39')][_0x93f5('0x3f')];this[_0x93f5('0x10')][_0x93f5('0x53')](_0x49e4a1)['then'](function(_0x2a65b2){_0x1296b0(null,_[_0x93f5('0x48')](_0x2a65b2)?![]:!![]);})[_0x93f5('0x18')](function(_0x1b11c9){logger[_0x93f5('0x51')](_0x1b11c9);_0x1296b0(null,![]);});};AGIVertices[_0x93f5('0x12')][_0x93f5('0x54')]=function(_0x2aa519,_0x56ffed){var _0x2fc755={'role':_0x93f5('0x4f')};_0x2fc755[_0x2aa519]=this[_0x93f5('0x39')]['callerid'];var _0x1572af=_0x2aa519!='internal'?util['format'](_0x93f5('0x55'),_0x93f5('0x56'),this[_0x93f5('0x39')]['callerid']):undefined;this[_0x93f5('0x10')][_0x93f5('0x54')](_0x2fc755,_0x1572af)[_0x93f5('0x15')](function(_0x4a83bf){_0x56ffed(null,_[_0x93f5('0x48')](_0x4a83bf)?![]:!![]);})[_0x93f5('0x18')](function(_0xa83367){logger['error'](_0xa83367);_0x56ffed(null,![]);});};AGIVertices[_0x93f5('0x12')][_0x93f5('0x57')]=function(_0x30d670,_0x365520){sh[_0x93f5('0x58')](_[_0x93f5('0x59')](_0x30d670),function(_0x5d1e32,_0x135e4c){var _0x3974f9=_0x135e4c['replace'](/(\r\n|\n|\r)/gm,'');_0x365520(null,_0x3974f9);});};AGIVertices[_0x93f5('0x12')][_0x93f5('0x5a')]=function(_0x1290e4,_0x212ed1){scripts[_0x93f5('0x5a')](_0x1290e4[_0x93f5('0x5b')],_0x1290e4[_0x93f5('0x5c')]||'text',_0x1290e4[_0x93f5('0x5d')],_0x1290e4['languageCode']||_0x93f5('0x5e'),_0x1290e4[_0x93f5('0x5f')]||_0x93f5('0x60'),_0x1290e4[_0x93f5('0x61')]||_0x93f5('0x62'))['then'](function(_0x296749){_0x212ed1(null,_0x296749);})[_0x93f5('0x18')](function(_0x4c2d18){_0x212ed1(_0x4c2d18);});};AGIVertices[_0x93f5('0x12')][_0x93f5('0x63')]=function(_0x48b41b,_0x50b526){scripts[_0x93f5('0x63')](_0x48b41b[_0x93f5('0x5d')],_0x48b41b[_0x93f5('0x64')]||'en',0x1)[_0x93f5('0x15')](function(_0x57b872){_0x50b526(null,_0x57b872);})['catch'](function(_0x2aae78){_0x50b526(_0x2aae78);});};AGIVertices['prototype'][_0x93f5('0x65')]=function(_0x1f0d60,_0x4c8d13){var _0x385392={'uri':_0x1f0d60['url'],'method':_0x1f0d60[_0x93f5('0x66')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x1f0d60[_0x93f5('0x67')])===_0x93f5('0x68')&&parseInt(_0x1f0d60['timeout'])>=0x1?parseInt(_0x1f0d60[_0x93f5('0x67')])*0x3e8:0x5*0x3e8};if(_['includes']([_0x93f5('0x69'),_0x93f5('0x6a')],_0x385392[_0x93f5('0x66')][_0x93f5('0x6b')]())){try{_0x385392[_0x93f5('0x6c')]=_0x1f0d60[_0x93f5('0xc')]?JSON['parse'](_0x1f0d60[_0x93f5('0xc')]):{};}catch(_0x137f7c){logger[_0x93f5('0x51')]('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x137f7c);}}try{_0x385392[_0x93f5('0x6d')]=_0x1f0d60[_0x93f5('0xb')]?JSON[_0x93f5('0x6e')](_0x1f0d60['rawHeaders']):{};}catch(_0x3d3b43){logger[_0x93f5('0x51')](_0x93f5('0x6f'),_0x3d3b43);}if(_0x1f0d60['computedVariables']){try{var _0x34632a=require(_0x1f0d60[_0x93f5('0x70')])['sync'](this,_0x385392);_0x385392[_0x93f5('0x71')]=Mustache[_0x93f5('0x72')](_0x1f0d60[_0x93f5('0x73')],_0x34632a,{},['$$','$$']);if(_0x385392[_0x93f5('0x6d')]){_0x385392['headers']=JSON[_0x93f5('0x6e')](Mustache[_0x93f5('0x72')](JSON['stringify'](_0x385392[_0x93f5('0x6d')]),_0x34632a,{},['$$','$$']));}if(_0x385392[_0x93f5('0x6c')]){_0x385392[_0x93f5('0x6c')]=JSON['parse'](Mustache['render'](JSON[_0x93f5('0x74')](_0x385392[_0x93f5('0x6c')]),_0x34632a,{},['$$','$$']));}}catch(_0x41c486){logger[_0x93f5('0x51')](_0x93f5('0x75'),_0x41c486);}}rp(_0x385392)['then'](function(_0x5b44af){var _0x2ab9de={'statusCode':_0x5b44af[_0x93f5('0x76')]||0xc8,'statusMessage':_0x5b44af['statusMessage']||'OK','headers':_0x5b44af['headers']||{},'body':_0x5b44af[_0x93f5('0x6c')]||{}};_0x4c8d13(null,_0x2ab9de);})[_0x93f5('0x18')](function(_0x2904a8){var _0x4a872d={'statusCode':_0x2904a8[_0x93f5('0x76')]||0x1f4,'statusMessage':_0x2904a8[_0x93f5('0x77')]||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x2904a8[_0x93f5('0x78')][_0x93f5('0x6d')]||{},'body':_0x2904a8[_0x93f5('0x78')][_0x93f5('0x6c')]||{}};_0x4c8d13(null,_0x4a872d);});};AGIVertices['prototype'][_0x93f5('0x79')]=function(_0x4aaf51,_0x2a9f38){scripts[_0x93f5('0x79')](this[_0x93f5('0x39')][_0x93f5('0x3a')],_0x4aaf51[_0x93f5('0x7a')],_0x4aaf51[_0x93f5('0x5d')],_0x4aaf51[_0x93f5('0x7b')]||'en')[_0x93f5('0x15')](function(_0x585c65){_0x2a9f38(null,_0x585c65);})[_0x93f5('0x18')](function(_0xba4060){_0x2a9f38(_0xba4060);});};AGIVertices[_0x93f5('0x12')]['googleDialogflowV2']=function(_0x535277,_0x14e75e){scripts['googleDialogflowV2'](this['channel'][_0x93f5('0x3a')],_0x535277[_0x93f5('0x7c')],_0x535277[_0x93f5('0x7d')],_0x535277[_0x93f5('0x7e')],_0x535277[_0x93f5('0x5d')],_0x535277[_0x93f5('0x7f')]||'en')['then'](function(_0x4a4f8b){_0x14e75e(null,_0x4a4f8b);})[_0x93f5('0x18')](function(_0x5e1f30){_0x14e75e(_0x5e1f30);});};AGIVertices['prototype'][_0x93f5('0x80')]=function(_0x44ddbd,_0xc6eedd){scripts[_0x93f5('0x80')](this['channel'],_0x44ddbd)['then'](function(_0x370b92){_0xc6eedd(null,_0x370b92);})['catch'](function(_0x170ffc){_0xc6eedd(_0x170ffc);});};AGIVertices[_0x93f5('0x12')]['ispeechTTS']=function(_0x386b71,_0x5597fa){scripts[_0x93f5('0x81')](_0x386b71[_0x93f5('0x7a')],_0x386b71[_0x93f5('0x5d')],_0x386b71[_0x93f5('0x82')]||_0x93f5('0x5e'),_0x386b71[_0x93f5('0x83')])[_0x93f5('0x15')](function(_0xfd2f5d){_0x5597fa(null,_0xfd2f5d);})[_0x93f5('0x18')](function(_0x1f2fe5){_0x5597fa(_0x1f2fe5);});};AGIVertices[_0x93f5('0x12')]['ispeechASR']=function(_0x5abfa1,_0x98b04c,_0x7dc82f){scripts[_0x93f5('0x84')](_0x98b04c,_0x5abfa1[_0x93f5('0x7a')],_0x5abfa1['ispeech_asr_language']||'en-US',this[_0x93f5('0x85')](_0x5abfa1['model'])?_0x5abfa1['model']:undefined)[_0x93f5('0x15')](function(_0x314a2b){_0x7dc82f(null,_0x314a2b);})[_0x93f5('0x18')](function(_0x1e7a66){_0x7dc82f(_0x1e7a66);});};AGIVertices[_0x93f5('0x12')][_0x93f5('0x86')]=function(_0x5cde2e,_0xe66211){scripts[_0x93f5('0x86')](_0x5cde2e[_0x93f5('0x87')],_0x5cde2e['aws_secret_access_key'],_0x5cde2e['aws_polly_region'],_0x5cde2e[_0x93f5('0x88')]||_0x93f5('0x89'),_0x5cde2e[_0x93f5('0x5d')],_0x5cde2e[_0x93f5('0x8a')]||'text')[_0x93f5('0x15')](function(_0xa87de4){_0xe66211(null,_0xa87de4);})[_0x93f5('0x18')](function(_0xd77927){_0xe66211(_0xd77927);});};AGIVertices[_0x93f5('0x12')][_0x93f5('0x8b')]=function(_0x4e70d4,_0x4edcf9){scripts[_0x93f5('0x8b')](this[_0x93f5('0x39')][_0x93f5('0x3a')],_0x4e70d4[_0x93f5('0x87')],_0x4e70d4['aws_secret_access_key'],_0x4e70d4[_0x93f5('0x8c')],_0x4e70d4[_0x93f5('0x5d')],_0x4e70d4[_0x93f5('0x8d')])[_0x93f5('0x15')](function(_0x4d08a4){_0x4edcf9(null,_0x4d08a4);})[_0x93f5('0x18')](function(_0x17bb76){_0x4edcf9(_0x17bb76);});};AGIVertices[_0x93f5('0x12')][_0x93f5('0x8e')]=function(_0x1f4919,_0x2d8644,_0x3d0b07){scripts[_0x93f5('0x8e')](_0x2d8644,_0x1f4919['key'],_0x1f4919[_0x93f5('0x8f')]||_0x93f5('0x5e'))['then'](function(_0x435ffb){_0x3d0b07(null,_0x435ffb);})[_0x93f5('0x18')](function(_0x218b85){_0x3d0b07(_0x218b85);});};AGIVertices[_0x93f5('0x12')][_0x93f5('0x90')]=function(_0x1f7690,_0x1647e5,_0x4bbbf2){scripts[_0x93f5('0x90')](_0x1647e5,_0x1f7690[_0x93f5('0x91')],_0x1f7690[_0x93f5('0x92')],_0x1f7690[_0x93f5('0x71')])[_0x93f5('0x15')](function(_0xd45a68){_0x4bbbf2(null,_0xd45a68);})[_0x93f5('0x18')](function(_0xe2017){_0x4bbbf2(_0xe2017);});};AGIVertices[_0x93f5('0x12')]['clear']=function(_0x1452ab){var _0x4e25b9=_[_0x93f5('0x93')](verticesWithRetry,_0x1452ab[_0x93f5('0x3c')])?_0x1452ab:_['clone'](_0x1452ab);for(var _0xff347c in _0x4e25b9){if(_0x4e25b9[_0x93f5('0x94')](_0xff347c)){if(_0x4e25b9[_0xff347c]&&_[_0x93f5('0x95')](_0x4e25b9[_0xff347c])){if(_[_0x93f5('0x93')](recursiveMapAttributes,_0xff347c)){_0x4e25b9[_0xff347c]=this[_0x93f5('0x96')](_0x4e25b9[_0xff347c]);}else{_0x4e25b9[_0xff347c]=this['replaceAllVariables'](_0x4e25b9[_0xff347c]);}}}}return _0x4e25b9;};AGIVertices[_0x93f5('0x12')]['recursiveNodeIndex']=function(_0x60808d){for(var _0x3ec530 in _0x60808d){if(_0x60808d[_0x93f5('0x94')](_0x3ec530)){if(_[_0x93f5('0x97')](_0x60808d[_0x3ec530])){this[_0x93f5('0x98')](_0x60808d[_0x3ec530]);}else if(_[_0x93f5('0x99')](_0x60808d[_0x3ec530])){for(var _0xfef8dc=0x0;_0xfef8dc<_0x60808d[_0x3ec530]['length'];_0xfef8dc++){this[_0x93f5('0x98')](_0x60808d[_0x3ec530][_0xfef8dc]);}}else if(_[_0x93f5('0x95')](_0x60808d[_0x3ec530])){_0x60808d[_0x3ec530]=this[_0x93f5('0x9a')](_0x60808d[_0x3ec530]);}}}};AGIVertices['prototype'][_0x93f5('0x9b')]=function(_0x3e2019,_0x13e888){for(var _0x342d0b in _0x3e2019){if(_0x3e2019[_0x93f5('0x94')](_0x342d0b)){if(_[_0x93f5('0x97')](_0x3e2019[_0x342d0b])){if(!_[_0x93f5('0x47')](_0x3e2019[_0x342d0b])){this['saveRestApiResult'](_0x3e2019[_0x342d0b],util[_0x93f5('0x2b')]('%s.%s',_0x13e888,_0x342d0b));}}else if(_['isArray'](_0x3e2019[_0x342d0b])){for(var _0x2c7e5d=0x0;_0x2c7e5d<_0x3e2019[_0x342d0b][_0x93f5('0x9c')];_0x2c7e5d++){this[_0x93f5('0x9b')](_0x3e2019[_0x342d0b][_0x2c7e5d],util['format'](_0x93f5('0x9d'),_0x13e888,_0x342d0b+'['+_0x2c7e5d+']'));}}else{if(!_[_0x93f5('0x48')](_0x3e2019[_0x342d0b])){this[_0x93f5('0x39')]['setVariable'](util['format'](_0x93f5('0x9d'),_0x13e888,_0x342d0b),_0x3e2019[_0x342d0b]);}}}}};AGIVertices[_0x93f5('0x12')][_0x93f5('0x96')]=function(_0x4798a2){try{var _0x4bec14=JSON[_0x93f5('0x6e')](_0x4798a2);this['recursiveNodeIndex'](_0x4bec14);return JSON['stringify'](_0x4bec14);}catch(_0x3628dc){return this[_0x93f5('0x9a')](_0x4798a2);}};AGIVertices[_0x93f5('0x12')][_0x93f5('0x9a')]=function(_0x42e1c3){var _0x5a01c4=_0x42e1c3[_0x93f5('0x9e')]('{');for(var _0x4b6049=0x1;_0x4b6049<_0x5a01c4['length'];_0x4b6049+=0x1){var _0x530eb4=_0x5a01c4[_0x4b6049][_0x93f5('0x9e')]('}');if(_0x530eb4[_0x93f5('0x9c')]>0x1){_0x42e1c3=_0x42e1c3[_0x93f5('0x9f')]('{'+_0x530eb4[0x0]+'}',this[_0x93f5('0x39')][_0x93f5('0x13')](_0x530eb4[0x0])[_0x93f5('0xa0')]||_0x530eb4[0x0]);}}if(_0x5a01c4[_0x93f5('0x9c')]===0x1){return _0x42e1c3[_0x93f5('0x4d')]();}return this[_0x93f5('0x9a')](_0x42e1c3);};AGIVertices[_0x93f5('0x12')][_0x93f5('0xa1')]=function(_0x80d5d0,_0x343474){var _0x1f0588=this['channel'][_0x93f5('0x13')](_0x80d5d0);if(_0x1f0588['result']===-0x1){return _0x1f0588;}logger['info'](util['format'](_0x93f5('0xa2'),_0x343474,_0x1f0588[_0x93f5('0xa0')]));return this[_0x93f5('0x39')][_0x93f5('0xa3')](_0x343474,_0x1f0588[_0x93f5('0xa0')]);};AGIVertices[_0x93f5('0x12')][_0x93f5('0x85')]=function(_0x22fa62){return _0x22fa62&&_0x22fa62!=='0'&&_0x22fa62!=='-1'&&_0x22fa62!=='';};AGIVertices[_0x93f5('0x12')]['maxRetry']=function(_0x2afd73){this['createSquareDetailsReport'][_0x93f5('0xa4')](this,_0x2afd73,'-');_0x2afd73[_0x93f5('0xa5')]=_0x2afd73[_0x93f5('0xa6')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x93f5('0x12')]['mrcpsynth']=function(_0x20612a){logger['info'](util[_0x93f5('0x2b')](_0x93f5('0xa7'),_0x20612a[_0x93f5('0x3b')]));if(!this[_0x93f5('0x85')](_0x20612a['text'])){return this[_0x93f5('0x39')][_0x93f5('0xa8')](_0x93f5('0xa9'));}var _0x2e8038='\x22'+_0x20612a['text']+'\x22';if(this['isConfigured'](_0x20612a[_0x93f5('0x78')])){_0x2e8038+=','+_0x20612a[_0x93f5('0x78')];}var _0x1ed9b6=this[_0x93f5('0x39')]['exec'](_0x93f5('0xaa'),_0x2e8038);if(_0x1ed9b6['result']===-0x1){return _0x1ed9b6;}return this[_0x93f5('0x39')][_0x93f5('0xa8')](util[_0x93f5('0x2b')](_0x93f5('0xab'),_0x2e8038));};AGIVertices[_0x93f5('0x12')][_0x93f5('0xac')]=function(_0x198a02){logger[_0x93f5('0x2f')](util['format'](_0x93f5('0xad'),_0x198a02[_0x93f5('0x3b')]));if(!this[_0x93f5('0x85')](_0x198a02[_0x93f5('0xae')])){return this[_0x93f5('0x39')]['noop'](_0x93f5('0xaf'));}var _0x782c8e=_0x198a02['grammar'];if(this[_0x93f5('0x85')](_0x198a02['options'])){_0x782c8e+=','+_0x198a02[_0x93f5('0x78')];}var _0x2ad1c3=this[_0x93f5('0x39')][_0x93f5('0x58')](_0x93f5('0xb0'),_0x782c8e);if(_0x2ad1c3[_0x93f5('0xb1')]===-0x1){return _0x2ad1c3;}var _0x1bdf68=this[_0x93f5('0xa1')](_0x93f5('0xb2'),_0x93f5('0xb3'));if(_0x1bdf68[_0x93f5('0xb1')]===-0x1){return _0x1bdf68;}var _0x23dcd5=this['getAndSetVariable'](_0x93f5('0xb4'),'MRCP_RECOG_TRANSCRIPT');if(_0x23dcd5[_0x93f5('0xb1')]===-0x1){return _0x23dcd5;}var _0x51da1c=this[_0x93f5('0xa1')](_0x93f5('0xb5'),_0x93f5('0xb6'));if(_0x51da1c[_0x93f5('0xb1')]===-0x1){return _0x51da1c;}return this['channel'][_0x93f5('0xa8')](util[_0x93f5('0x2b')](_0x93f5('0xb7'),_0x782c8e));};AGIVertices[_0x93f5('0x12')][_0x93f5('0x8')]=function(_0x2c29ca){logger[_0x93f5('0x2f')](util[_0x93f5('0x2b')](_0x93f5('0xb8'),_0x2c29ca[_0x93f5('0x3b')]));return this[_0x93f5('0x39')]['agi']([_0x2c29ca[_0x93f5('0xb9')],_0x2c29ca[_0x93f5('0xba')]]);};AGIVertices[_0x93f5('0x12')]['answer']=function(_0x496f5d){logger[_0x93f5('0x2f')](util[_0x93f5('0x2b')](_0x93f5('0xbb'),_0x496f5d[_0x93f5('0x3b')]));if(this['isConfigured'](_0x496f5d['timeout'])){logger[_0x93f5('0x2f')](util[_0x93f5('0x2b')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x496f5d['timeout']));var _0x526937=this[_0x93f5('0x39')]['wait'](_0x496f5d[_0x93f5('0x67')]);if(_0x526937[_0x93f5('0xb1')]===-0x1){return _0x526937;}}return this['channel'][_0x93f5('0xbc')]();};AGIVertices[_0x93f5('0x12')][_0x93f5('0x4c')]=function(_0x537a53){logger[_0x93f5('0x2f')](util[_0x93f5('0x2b')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x537a53[_0x93f5('0x3b')]));if(!this['isConfigured'](_0x537a53[_0x93f5('0x4b')])){return this[_0x93f5('0x39')][_0x93f5('0x51')](_0x537a53,_0x93f5('0xbd'));}_0x537a53[_0x93f5('0xbe')]=moment();if(this[_0x93f5('0x85')](_0x537a53[_0x93f5('0xbf')])){_0x537a53[_0x93f5('0xbe')]=moment()[_0x93f5('0xc0')](_0x537a53['delay'],_0x93f5('0xc1'));}if(!this[_0x93f5('0x85')](_0x537a53[_0x93f5('0xc2')])){_0x537a53[_0x93f5('0xc2')]=0x2;}this[_0x93f5('0x46')][_0x93f5('0xa4')](this,_0x537a53);return this[_0x93f5('0x39')]['noop'](util[_0x93f5('0x2b')](_0x93f5('0xc3'),_0x537a53[_0x93f5('0xc4')],_0x537a53[_0x93f5('0x4b')],_0x537a53[_0x93f5('0xbe')]));};AGIVertices[_0x93f5('0x12')][_0x93f5('0xc5')]=function(_0x440c8d){logger[_0x93f5('0x2f')](util['format']('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x440c8d[_0x93f5('0x3b')]));var _0x4be8cb=this[_0x93f5('0x39')][_0x93f5('0x58')](_0x440c8d['application'],_0x440c8d['options']);if(_0x4be8cb['result']===-0x1){return _0x4be8cb;}return this[_0x93f5('0x39')][_0x93f5('0xa8')](util[_0x93f5('0x2b')]('Executed\x20command\x20%s\x20%s',_0x440c8d[_0x93f5('0xc6')],_0x440c8d[_0x93f5('0x78')]));};AGIVertices[_0x93f5('0x12')][_0x93f5('0xc7')]=function(_0x2eb897){logger[_0x93f5('0x2f')](util[_0x93f5('0x2b')](_0x93f5('0xc8'),_0x2eb897[_0x93f5('0x3b')]));if(!this[_0x93f5('0x85')](_0x2eb897['text'])){return this['channel'][_0x93f5('0xa8')](_0x93f5('0xa9'));}var _0x3d7e5d='\x22'+_0x2eb897[_0x93f5('0x5d')]+'\x22';if(this[_0x93f5('0x85')](_0x2eb897[_0x93f5('0x78')])){_0x3d7e5d+=','+_0x2eb897['options'];}var _0x3b7c4f=this['channel']['exec'](_0x93f5('0xaa'),_0x3d7e5d);if(_0x3b7c4f[_0x93f5('0xb1')]===-0x1){return _0x3b7c4f;}return this[_0x93f5('0x39')]['noop'](util['format'](_0x93f5('0xab'),_0x3d7e5d));};AGIVertices['prototype'][_0x93f5('0xc9')]=function(_0x3d42b6){logger[_0x93f5('0x2f')](util['format'](_0x93f5('0xca'),_0x3d42b6[_0x93f5('0x3b')]));if(!this[_0x93f5('0x85')](_0x3d42b6[_0x93f5('0x5d')])){return this[_0x93f5('0x39')][_0x93f5('0xa8')]('no\x20text\x20configured');}var _0xf902d4='\x22'+_0x3d42b6[_0x93f5('0x5d')]+'\x22';if(this[_0x93f5('0x85')](_0x3d42b6[_0x93f5('0x78')])){_0xf902d4+=','+_0x3d42b6[_0x93f5('0x78')];}var _0x2d117a=this[_0x93f5('0x39')][_0x93f5('0x58')](_0x93f5('0xaa'),_0xf902d4);if(_0x2d117a[_0x93f5('0xb1')]===-0x1){return _0x2d117a;}return this[_0x93f5('0x39')][_0x93f5('0xa8')](util['format'](_0x93f5('0xab'),_0xf902d4));};AGIVertices['prototype'][_0x93f5('0xcb')]=function(_0x2da279){logger[_0x93f5('0x2f')](util[_0x93f5('0x2b')](_0x93f5('0xcc'),_0x2da279[_0x93f5('0x3b')]));if(!this['isConfigured'](_0x2da279[_0x93f5('0xae')])){return this[_0x93f5('0x39')][_0x93f5('0xa8')](_0x93f5('0xaf'));}var _0x5b3249=_0x2da279[_0x93f5('0xae')];if(this[_0x93f5('0x85')](_0x2da279[_0x93f5('0x78')])){_0x5b3249+=','+_0x2da279[_0x93f5('0x78')];}var _0x309ee5=this[_0x93f5('0x39')][_0x93f5('0x58')](_0x93f5('0xb0'),_0x5b3249);if(_0x309ee5[_0x93f5('0xb1')]===-0x1){return _0x309ee5;}var _0x3db7ec=this[_0x93f5('0xa1')](_0x93f5('0xb2'),_0x93f5('0xcd'));if(_0x3db7ec[_0x93f5('0xb1')]===-0x1){return _0x3db7ec;}var _0x2ff05d=this[_0x93f5('0xa1')](_0x93f5('0xb4'),_0x93f5('0xce'));if(_0x2ff05d['result']===-0x1){return _0x2ff05d;}var _0x12f10a=this['getAndSetVariable']('RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE');if(_0x12f10a[_0x93f5('0xb1')]===-0x1){return _0x12f10a;}return this[_0x93f5('0x39')][_0x93f5('0xa8')](util['format'](_0x93f5('0xb7'),_0x5b3249));};AGIVertices['prototype'][_0x93f5('0xcf')]=function(_0x47e1df){logger[_0x93f5('0x2f')](util[_0x93f5('0x2b')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x47e1df['label']));if(!this[_0x93f5('0x85')](_0x47e1df[_0x93f5('0xae')])){return this[_0x93f5('0x39')][_0x93f5('0xa8')](_0x93f5('0xaf'));}var _0x50aa9e=_0x47e1df[_0x93f5('0xae')];if(this[_0x93f5('0x85')](_0x47e1df['options'])){_0x50aa9e+=','+_0x47e1df[_0x93f5('0x78')];}var _0x24e506=this[_0x93f5('0x39')]['exec']('MRCPRecog',_0x50aa9e);if(_0x24e506[_0x93f5('0xb1')]===-0x1){return _0x24e506;}var _0x1ded53=this[_0x93f5('0xa1')](_0x93f5('0xb2'),_0x93f5('0xd0'));if(_0x1ded53[_0x93f5('0xb1')]===-0x1){return _0x1ded53;}var _0x3a9f38=this[_0x93f5('0xa1')]('RECOG_INPUT()','SESTEK_ASR_TRANSCRIPT');if(_0x3a9f38['result']===-0x1){return _0x3a9f38;}var _0x30ef49=this['getAndSetVariable'](_0x93f5('0xb5'),'SESTEK_ASR_INSTANCE');if(_0x30ef49[_0x93f5('0xb1')]===-0x1){return _0x30ef49;}return this[_0x93f5('0x39')]['noop'](util[_0x93f5('0x2b')](_0x93f5('0xb7'),_0x50aa9e));};AGIVertices[_0x93f5('0x12')]['database']=function(_0x45f9fd){logger['info'](util[_0x93f5('0x2b')](_0x93f5('0xd1'),_0x45f9fd[_0x93f5('0x3b')]));if(!this[_0x93f5('0x85')](_0x45f9fd[_0x93f5('0xd2')])){return this['channel'][_0x93f5('0x51')](_0x45f9fd,'no\x20database\x20selected');}var _0xfd02b3=this[_0x93f5('0x1b')][_0x93f5('0xa4')](this,_0x45f9fd[_0x93f5('0xd2')]);if(!_0xfd02b3){return this['channel'][_0x93f5('0x51')](_0x45f9fd,_0x93f5('0xd3'));}if(!this[_0x93f5('0x85')](_0x45f9fd[_0x93f5('0x31')])){return this[_0x93f5('0x39')][_0x93f5('0x51')](_0x45f9fd,'no\x20query\x20configured');}var _0xa04c52=_0x45f9fd[_0x93f5('0x31')][_0x93f5('0xd4')](/(\r\n|\n|\r)/gm,'\x20');this[_0x93f5('0x39')][_0x93f5('0xa8')](util[_0x93f5('0x2b')]('query:\x20%s',_0xa04c52));var _0x16f6a7=this['getQueryOdbc'][_0x93f5('0xa4')](this,_0xfd02b3,_0xa04c52);this[_0x93f5('0x38')][_0x93f5('0xa4')](this,_0x45f9fd,_0xa04c52);if(!this['isConfigured'](_0x45f9fd[_0x93f5('0xd5')])){return this[_0x93f5('0x39')][_0x93f5('0xa8')](_0x93f5('0xd6'));}var _0x1be8bb=this['getVariable'][_0x93f5('0xa4')](this,_0x45f9fd[_0x93f5('0xd5')]);if(!_0x1be8bb){return this[_0x93f5('0x39')]['error'](_0x45f9fd,_0x93f5('0xd7'));}var _0x52bf4f=this;_0x16f6a7[_0x93f5('0xd8')](function(_0x3885b3,_0x3853df){Object[_0x93f5('0xd9')](_0x3885b3)[_0x93f5('0xd8')](function(_0x337b36){_0x52bf4f[_0x93f5('0x39')][_0x93f5('0xa3')](util['format'](_0x93f5('0xda'),_0x1be8bb,_0x3853df,_0x337b36),_0x3885b3[_0x337b36]);});});this[_0x93f5('0x39')][_0x93f5('0xa3')](util[_0x93f5('0x2b')](_0x93f5('0xdb'),_0x1be8bb),_0x16f6a7[_0x93f5('0x9c')]);return this[_0x93f5('0x39')][_0x93f5('0xa8')](util[_0x93f5('0x2b')](_0x93f5('0xdc'),_0x1be8bb));};AGIVertices[_0x93f5('0x12')][_0x93f5('0xdd')]=function(_0x51503b){logger[_0x93f5('0xde')](util[_0x93f5('0x2b')](_0x93f5('0xdf'),_0x51503b['label']));if(!this[_0x93f5('0x85')](_0x51503b['sip_id'])){return this['channel'][_0x93f5('0x51')](_0x51503b,_0x93f5('0xe0'));}var _0x471e98=this[_0x93f5('0x1e')]['sync'](this,_0x51503b[_0x93f5('0xe1')]);if(!_0x471e98){return this[_0x93f5('0x39')]['error'](_0x51503b,'no\x20user\x20found');}var _0x1f770e=this['channel'][_0x93f5('0x58')](_0x93f5('0xe2'),[util['format'](_0x93f5('0xe3'),_0x471e98),_0x51503b[_0x93f5('0x67')],_0x51503b[_0x93f5('0xe4')],_0x51503b[_0x93f5('0x73')]]);if(_0x1f770e[_0x93f5('0xb1')]===-0x1){return _0x1f770e;}return this[_0x93f5('0x39')][_0x93f5('0xa8')](util['format'](_0x93f5('0xe5'),_0x93f5('0xe2')));};AGIVertices[_0x93f5('0x12')][_0x93f5('0xe6')]=function(_0x39bfd9){logger['info'](util[_0x93f5('0x2b')](_0x93f5('0xe7'),_0x39bfd9[_0x93f5('0x3b')]));if(!this[_0x93f5('0x85')](_0x39bfd9[_0x93f5('0x7a')])){return this[_0x93f5('0x39')][_0x93f5('0xa8')](_0x93f5('0xe8'));}if(!this[_0x93f5('0x85')](_0x39bfd9['text'])){return this['channel'][_0x93f5('0xa8')](_0x93f5('0xa9'));}this[_0x93f5('0x39')][_0x93f5('0xe9')]=!![];this[_0x93f5('0x38')](_0x39bfd9);this['createSquareMessage'](_0x39bfd9[_0x93f5('0x5d')],'in','','');this[_0x93f5('0x39')]['noop'](util[_0x93f5('0x2b')](_0x93f5('0xea'),_0x39bfd9['text']));var _0xa9d99a=this[_0x93f5('0x79')]['sync'](this,_0x39bfd9);if(_0xa9d99a){for(var _0x4c283a in _0xa9d99a){if(_0xa9d99a[_0x93f5('0x94')](_0x4c283a)){this[_0x93f5('0x39')][_0x93f5('0xa3')](util['format']('DIALOGFLOW_%s',_0x4c283a[_0x93f5('0x6b')]()),_0xa9d99a[_0x4c283a]);}}this[_0x93f5('0x45')](_0xa9d99a[_0x93f5('0xeb')],_0x93f5('0xec'),_0x93f5('0xe6'),'');return this[_0x93f5('0x39')]['noop'](util[_0x93f5('0x2b')]('Dialogflow\x20Result\x20%s',_0xa9d99a[_0x93f5('0xeb')]));}return this[_0x93f5('0x39')]['error'](_0x39bfd9,'Dialogflow\x20is\x20unreachable');};AGIVertices[_0x93f5('0x12')][_0x93f5('0xed')]=function(_0x3435a0){logger[_0x93f5('0x2f')](util[_0x93f5('0x2b')](_0x93f5('0xee'),_0x3435a0['label']));if(!this[_0x93f5('0x85')](_0x3435a0['dialogflowV2_project_id'])){return this[_0x93f5('0x39')][_0x93f5('0xa8')](_0x93f5('0xef'));}if(!this[_0x93f5('0x85')](_0x3435a0[_0x93f5('0x7d')])){return this[_0x93f5('0x39')][_0x93f5('0xa8')](_0x93f5('0xf0'));}if(!this[_0x93f5('0x85')](_0x3435a0['private_key'])){return this[_0x93f5('0x39')][_0x93f5('0xa8')](_0x93f5('0xf1'));}if(!this[_0x93f5('0x85')](_0x3435a0[_0x93f5('0x7f')])){return this['channel'][_0x93f5('0xa8')]('no\x20anguage\x20configured');}if(!this[_0x93f5('0x85')](_0x3435a0[_0x93f5('0x5d')])){return this[_0x93f5('0x39')][_0x93f5('0xa8')](_0x93f5('0xa9'));}this[_0x93f5('0x39')][_0x93f5('0xe9')]=!![];this[_0x93f5('0x38')](_0x3435a0);this[_0x93f5('0x45')](_0x3435a0[_0x93f5('0x5d')],'in','','');this['channel']['noop'](util[_0x93f5('0x2b')](_0x93f5('0xf2'),_0x3435a0[_0x93f5('0x5d')]));var _0x329e91=this[_0x93f5('0xf3')][_0x93f5('0xa4')](this,_0x3435a0);if(_0x329e91){for(var _0x2337ce in _0x329e91){if(_0x329e91[_0x93f5('0x94')](_0x2337ce)){if(_0x2337ce!=='providerResponse'){this[_0x93f5('0x39')][_0x93f5('0xa3')](util[_0x93f5('0x2b')]('DIALOGFLOW_%s',_0x2337ce[_0x93f5('0x6b')]()),_0x329e91[_0x2337ce]);}}}this[_0x93f5('0x45')](_0x329e91['speech'],_0x93f5('0xec'),_0x93f5('0xed'),_0x329e91[_0x93f5('0xf4')]);return this[_0x93f5('0x39')][_0x93f5('0xa8')](util[_0x93f5('0x2b')]('DialogflowV2\x20Result\x20%s',_0x329e91[_0x93f5('0xeb')]));}return this[_0x93f5('0x39')]['error'](_0x3435a0,_0x93f5('0xf5'));};AGIVertices['prototype']['sesteknda']=function(_0x549b6c){logger[_0x93f5('0x2f')](util['format'](_0x93f5('0xf6'),_0x549b6c[_0x93f5('0x3b')]));if(!this['isConfigured'](_0x549b6c[_0x93f5('0xf7')])){return this[_0x93f5('0x39')][_0x93f5('0xa8')]('no\x20ndauth\x20url\x20configured');}if(!this['isConfigured'](_0x549b6c[_0x93f5('0xf8')])){return this[_0x93f5('0x39')][_0x93f5('0xa8')](_0x93f5('0xf9'));}if(!this[_0x93f5('0x85')](_0x549b6c[_0x93f5('0xfa')])){return this['channel'][_0x93f5('0xa8')](_0x93f5('0xfb'));}if(!this[_0x93f5('0x85')](_0x549b6c['ndassistant_url'])){return this[_0x93f5('0x39')][_0x93f5('0xa8')](_0x93f5('0xa9'));}this[_0x93f5('0x39')][_0x93f5('0xe9')]=!![];this['createSquareDetailsReport'](_0x549b6c);this[_0x93f5('0x45')](_0x549b6c['text'],'in','','');this[_0x93f5('0x39')][_0x93f5('0xa8')](util[_0x93f5('0x2b')](_0x93f5('0xfc'),_0x549b6c[_0x93f5('0x5d')]));var _0x258f9a=this[_0x93f5('0x80')][_0x93f5('0xa4')](this,_0x549b6c);if(_0x258f9a){for(var _0x52c46f in _0x258f9a){if(_0x258f9a[_0x93f5('0x94')](_0x52c46f)){this[_0x93f5('0x39')][_0x93f5('0xa3')](util[_0x93f5('0x2b')](_0x93f5('0xfd'),_0x52c46f['toUpperCase']()),_0x258f9a[_0x52c46f]);}}this[_0x93f5('0x45')](_0x258f9a[_0x93f5('0xeb')],_0x93f5('0xec'),_0x93f5('0xfe'),'');if(_0x258f9a[_0x93f5('0xff')]){this[_0x93f5('0x39')][_0x93f5('0xa8')](util[_0x93f5('0x2b')](_0x93f5('0x100'),_0x258f9a[_0x93f5('0xff')]));var _0x117853=this['channel'][_0x93f5('0x101')](_0x258f9a[_0x93f5('0xff')]);try{fs[_0x93f5('0x102')](_0x258f9a[_0x93f5('0xff')]+_0x93f5('0x103'));}catch(_0x3d464c){logger[_0x93f5('0x51')](_0x3d464c);}return _0x117853;}else{return this['channel'][_0x93f5('0xa8')](util[_0x93f5('0x2b')](_0x93f5('0x104'),_0x258f9a[_0x93f5('0xeb')]));}}return this[_0x93f5('0x39')][_0x93f5('0x51')](_0x549b6c,_0x93f5('0x105'));};AGIVertices[_0x93f5('0x12')][_0x93f5('0x106')]=function(_0x4153a0){logger['info'](util[_0x93f5('0x2b')](_0x93f5('0x107'),_0x4153a0['label']));return this[_0x93f5('0x39')]['noop'](_0x93f5('0x106'));};AGIVertices['prototype']['ext_dial']=function(_0x3cfc12){logger['info'](util[_0x93f5('0x2b')](_0x93f5('0x108'),_0x3cfc12[_0x93f5('0x3b')]));var _0x3c49e4='';if(_0x3cfc12[_0x93f5('0x109')]){if(!this[_0x93f5('0x85')](_0x3cfc12[_0x93f5('0x109')])){return this[_0x93f5('0x39')][_0x93f5('0x51')](_0x3cfc12,_0x93f5('0x10a'));}else{var _0x1eb6b5=parseInt(_0x3cfc12['trunk_id'],0xa);if(isNaN(_0x1eb6b5)){_0x3c49e4=_0x3cfc12[_0x93f5('0x109')];}else{_0x3c49e4=this[_0x93f5('0x10b')][_0x93f5('0xa4')](this,_0x3cfc12['trunk_id']);if(!_0x3c49e4){return this['channel'][_0x93f5('0x51')](_0x3cfc12,_0x93f5('0x10c'));}}}}else if(_0x3cfc12[_0x93f5('0x10d')]){_0x3c49e4=_0x3cfc12[_0x93f5('0x10d')];}else{return this[_0x93f5('0x39')][_0x93f5('0x51')](_0x3cfc12,_0x93f5('0x10a'));}var _0x405967=this[_0x93f5('0x39')][_0x93f5('0x58')]('DIAL',[util[_0x93f5('0x2b')](_0x93f5('0x10e'),_0x3c49e4,_0x3cfc12[_0x93f5('0xc4')]),_0x3cfc12[_0x93f5('0x67')],_0x3cfc12[_0x93f5('0xe4')],_0x3cfc12[_0x93f5('0x73')]]);if(_0x405967[_0x93f5('0xb1')]===-0x1){return _0x405967;}return this[_0x93f5('0x39')][_0x93f5('0xa8')](util['format'](_0x93f5('0xe5'),'DIAL'));};AGIVertices[_0x93f5('0x12')]['finally']=function(_0x3cb343){logger[_0x93f5('0x2f')](util[_0x93f5('0x2b')](_0x93f5('0x10f'),_0x3cb343[_0x93f5('0x3b')]));return this['channel'][_0x93f5('0xa8')](_0x93f5('0x110'));};AGIVertices[_0x93f5('0x12')][_0x93f5('0xe')]=function(_0xaeae38){logger[_0x93f5('0x2f')](util[_0x93f5('0x2b')](_0x93f5('0x111'),_0xaeae38['label']));if(_0xaeae38[_0x93f5('0xa5')]===0x0){return this[_0x93f5('0xa6')](_0xaeae38);}_0xaeae38[_0x93f5('0xa5')]-=0x1;if(!this['isConfigured'](_0xaeae38[_0x93f5('0x112')])){return this['channel'][_0x93f5('0x51')](_0xaeae38,_0x93f5('0x113'));}var _0x27dee8=this['getSound'][_0x93f5('0xa4')](this,_0xaeae38[_0x93f5('0x112')]);if(!_0x27dee8){return this['channel'][_0x93f5('0x51')](_0xaeae38,_0x93f5('0x114'));}if(!this[_0x93f5('0x85')](_0xaeae38[_0x93f5('0xd5')])){return this[_0x93f5('0x39')]['error'](_0x93f5('0xd6'));}var _0x4c1f38=this[_0x93f5('0x39')][_0x93f5('0x115')](_0x27dee8,_0xaeae38[_0x93f5('0x116')],_0xaeae38[_0x93f5('0x117')]);var _0x1e7ed8=_0x4c1f38[_0x93f5('0xb1')]?_0x4c1f38[_0x93f5('0xb1')][_0x93f5('0x4d')]():'';logger[_0x93f5('0x2f')](_0x93f5('0x118'),JSON[_0x93f5('0x74')](_0x4c1f38));if(_0x4c1f38[_0x93f5('0xb1')]===-0x1){this['createSquareDetailsReport']['sync'](this,_0xaeae38,_0x1e7ed8);return _0x4c1f38;}else if(_0x4c1f38[_0x93f5('0xa0')]===_0x93f5('0x67')){_0x4c1f38[_0x93f5('0xb1')]=_0x1e7ed8[_0x93f5('0x9c')]>=parseInt(_0xaeae38['mindigit'])?'x':'i';}else{_0x4c1f38[_0x93f5('0xb1')]=_0x1e7ed8[_0x93f5('0x9c')]>=parseInt(_0xaeae38[_0x93f5('0x119')])&&_0x1e7ed8[_0x93f5('0x9c')]<=parseInt(_0xaeae38[_0x93f5('0x117')])?'x':'i';}var _0x557efe=this['getVariable']['sync'](this,_0xaeae38[_0x93f5('0xd5')]);if(!_0x557efe){return this['channel']['error'](_0xaeae38,'no\x20variable\x20found');}this[_0x93f5('0x39')][_0x93f5('0xa3')](_0x557efe,_0x1e7ed8);if(this['isConfigured'](_0xaeae38['hiddendigitsnum'])){var _0x3fe740=parseInt(_0xaeae38[_0x93f5('0x11a')],0xa);var _0x8c0d26=rs[_0x93f5('0x11b')]({'charset':'*','length':_0x3fe740});var _0x3f4e62=_0x1e7ed8['length'];if(_0x3f4e62>0x0){if(_0x3f4e62>_0x3fe740){this['createSquareDetailsReport'][_0x93f5('0xa4')](this,_0xaeae38,_0xaeae38[_0x93f5('0x11c')]===_0x93f5('0x11d')?_0x8c0d26+_0x1e7ed8[_0x93f5('0x11e')](_0x3fe740):_0x1e7ed8[_0x93f5('0x11e')](0x0,_0x3f4e62-_0x3fe740)+_0x8c0d26);}else{this[_0x93f5('0x38')][_0x93f5('0xa4')](this,_0xaeae38,rs[_0x93f5('0x11b')]({'charset':'*','length':_0x3f4e62}));}}else{this[_0x93f5('0x38')][_0x93f5('0xa4')](this,_0xaeae38,'');}}else{this['createSquareDetailsReport'][_0x93f5('0xa4')](this,_0xaeae38,_0x1e7ed8);}return _0x4c1f38;};AGIVertices['prototype'][_0x93f5('0xf')]=function(_0x37856c){logger[_0x93f5('0x2f')](util[_0x93f5('0x2b')](_0x93f5('0x11f'),_0x37856c[_0x93f5('0x3b')]));return this[_0x93f5('0xe')](_0x37856c);};AGIVertices['prototype'][_0x93f5('0x120')]=function(_0xeafd69){logger['info'](util['format']('Enter\x20in\x20GOAL\x20(%s)\x20block',_0xeafd69[_0x93f5('0x3b')]));this['createSquareDetailsReport'][_0x93f5('0xa4')](this,_0xeafd69,_0xeafd69['goalname']);return this[_0x93f5('0x39')][_0x93f5('0xa8')](util[_0x93f5('0x2b')]('GOAL\x20%s',_0xeafd69['goalname']));};AGIVertices[_0x93f5('0x12')]['awspolly']=function(_0x4ed857){logger['info'](util[_0x93f5('0x2b')]('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x4ed857[_0x93f5('0x3b')]));if(!this[_0x93f5('0x85')](_0x4ed857[_0x93f5('0x87')])||!this[_0x93f5('0x85')](_0x4ed857[_0x93f5('0x121')])){return this[_0x93f5('0x39')][_0x93f5('0xa8')](_0x93f5('0x122'));}if(!this[_0x93f5('0x85')](_0x4ed857[_0x93f5('0x5d')])){return this[_0x93f5('0x39')][_0x93f5('0xa8')](_0x93f5('0xa9'));}this[_0x93f5('0x39')][_0x93f5('0xa8')](util[_0x93f5('0x2b')]('Trying\x20aws\x20Polly\x20%s',_0x4ed857[_0x93f5('0x5d')]));var _0x5627f0=this['awsPolly'][_0x93f5('0xa4')](this,_0x4ed857);if(_0x5627f0){this[_0x93f5('0x39')][_0x93f5('0xa8')](util['format'](_0x93f5('0x123'),_0x5627f0));var _0x249e38=this[_0x93f5('0x39')][_0x93f5('0x101')](_0x5627f0);try{fs[_0x93f5('0x102')](_0x5627f0+'.wav');}catch(_0x34a7e7){logger[_0x93f5('0x51')](_0x34a7e7);}return _0x249e38;}return this['channel'][_0x93f5('0x51')](_0x4ed857,_0x93f5('0x124'));};AGIVertices['prototype'][_0x93f5('0x125')]=function(_0x28ba7c){logger['info'](util[_0x93f5('0x2b')](_0x93f5('0x126'),_0x28ba7c[_0x93f5('0x3b')]));if(!this['isConfigured'](_0x28ba7c['aws_access_key_id'])||!this['isConfigured'](_0x28ba7c[_0x93f5('0x121')])){return this['channel'][_0x93f5('0xa8')](_0x93f5('0x122'));}if(!this['isConfigured'](_0x28ba7c[_0x93f5('0x8d')])){return this[_0x93f5('0x39')][_0x93f5('0xa8')]('no\x20bot\x20name\x20configured');}if(!this['isConfigured'](_0x28ba7c[_0x93f5('0x5d')])){return this[_0x93f5('0x39')][_0x93f5('0xa8')]('no\x20text\x20configured');}this['channel'][_0x93f5('0xe9')]=!![];this[_0x93f5('0x38')](_0x28ba7c);this[_0x93f5('0x45')](_0x28ba7c[_0x93f5('0x5d')],'in','','');this[_0x93f5('0x39')][_0x93f5('0xa8')](util['format'](_0x93f5('0x127'),_0x28ba7c['text']));var _0x1e1db2=this[_0x93f5('0x8b')][_0x93f5('0xa4')](this,_0x28ba7c);if(_0x1e1db2){for(var _0x3664b in _0x1e1db2){if(_0x1e1db2[_0x93f5('0x94')](_0x3664b)&&_['isString'](_0x1e1db2[_0x3664b])){this['channel'][_0x93f5('0xa3')](util[_0x93f5('0x2b')](_0x93f5('0x128'),_0x3664b[_0x93f5('0x6b')]()),_0x1e1db2[_0x3664b]);}}if(_[_0x93f5('0x48')](_0x1e1db2[_0x93f5('0x77')])){return this['channel']['noop'](_0x93f5('0x129'));}else{this[_0x93f5('0x45')](_0x1e1db2[_0x93f5('0x77')],_0x93f5('0xec'),'amazonlex','');return this[_0x93f5('0x39')]['noop'](util[_0x93f5('0x2b')](_0x93f5('0x12a'),_0x1e1db2[_0x93f5('0x77')]));}}return this[_0x93f5('0x39')][_0x93f5('0x51')](_0x28ba7c,_0x93f5('0x12b'));};AGIVertices[_0x93f5('0x12')]['googleasr']=function(_0x13edde){logger[_0x93f5('0x2f')](util[_0x93f5('0x2b')]('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x13edde[_0x93f5('0x3b')],_0x13edde[_0x93f5('0x67')]));if(!this[_0x93f5('0x85')](_0x13edde[_0x93f5('0x7a')])){return this[_0x93f5('0x39')]['noop'](_0x93f5('0xe8'));}var _0xd6a4d7='wav';var _0x250b2f=util[_0x93f5('0x2b')](_0x93f5('0x12c'),FILES_PATH,rs['generate'](0x4));var _0x1a19ed=util['format'](_0x93f5('0x9d'),_0x250b2f,_0xd6a4d7);var _0x24f1d3=!![];if(_0x13edde[_0x93f5('0x12d')]===_0x93f5('0x12e')){_0x24f1d3=![];}var _0x487379=this[_0x93f5('0x39')]['recordFile'](_0x250b2f,_0xd6a4d7,_0x13edde[_0x93f5('0x12f')],_0x13edde[_0x93f5('0x67')],undefined,_0x24f1d3);if(_0x487379[_0x93f5('0xb1')]!==-0x1){this['channel'][_0x93f5('0xa8')](util['format']('google\x20%s\x20file\x20created',_0x1a19ed));var _0x5871a7=this[_0x93f5('0x8e')]['sync'](this,_0x13edde,_0x1a19ed);if(_0x5871a7){for(var _0x145bf7 in _0x5871a7){if(_0x5871a7[_0x93f5('0x94')](_0x145bf7)){this[_0x93f5('0x39')][_0x93f5('0xa3')](util[_0x93f5('0x2b')](_0x93f5('0x130'),_0x145bf7[_0x93f5('0x6b')]()),_0x5871a7[_0x145bf7]);}}return this['channel'][_0x93f5('0xa8')](util[_0x93f5('0x2b')](_0x93f5('0x131'),JSON[_0x93f5('0x74')](_0x5871a7)));}}return _0x487379;};AGIVertices[_0x93f5('0x12')][_0x93f5('0x132')]=function(_0xad9f78){logger[_0x93f5('0x2f')](util[_0x93f5('0x2b')](_0x93f5('0x133'),_0xad9f78[_0x93f5('0x3b')]));if(!this[_0x93f5('0x85')](_0xad9f78[_0x93f5('0x91')])){return this[_0x93f5('0x39')][_0x93f5('0xa8')](_0x93f5('0x134'));}if(!this[_0x93f5('0x85')](_0xad9f78[_0x93f5('0x92')])){return this[_0x93f5('0x39')][_0x93f5('0xa8')]('no\x20appsecret\x20configured');}var _0x569aa5=_0x93f5('0x135');var _0x473c0c=util['format'](_0x93f5('0x12c'),FILES_PATH,rs[_0x93f5('0x11b')](0x4));var _0x1bb3c9=util['format'](_0x93f5('0x9d'),_0x473c0c,_0x569aa5);var _0x16f471=!![];if(_0xad9f78[_0x93f5('0x12d')]==='NOBEEP'){_0x16f471=![];}var _0x2408c2=this[_0x93f5('0x39')][_0x93f5('0x136')](_0x473c0c,_0x569aa5,_0xad9f78[_0x93f5('0x12f')],_0xad9f78[_0x93f5('0x67')],undefined,_0x16f471);if(_0x2408c2['result']!==-0x1){this[_0x93f5('0x39')][_0x93f5('0xa8')](util[_0x93f5('0x2b')]('tilde\x20%s\x20file\x20created',_0x1bb3c9));var _0x169e50=this[_0x93f5('0x90')][_0x93f5('0xa4')](this,_0xad9f78,_0x1bb3c9);if(_0x169e50){for(var _0x3cef5f in _0x169e50){if(_0x169e50[_0x93f5('0x94')](_0x3cef5f)){this[_0x93f5('0x39')][_0x93f5('0xa3')](util['format'](_0x93f5('0x137'),_0x3cef5f[_0x93f5('0x6b')]()),_0x169e50[_0x3cef5f]);}}return this[_0x93f5('0x39')][_0x93f5('0xa8')](util[_0x93f5('0x2b')](_0x93f5('0x138'),JSON['stringify'](_0x169e50)));}}return _0x2408c2;};AGIVertices['prototype'][_0x93f5('0x139')]=function(_0x3516e8){logger[_0x93f5('0x2f')](util[_0x93f5('0x2b')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x3516e8[_0x93f5('0x3b')]));return this[_0x93f5('0x39')][_0x93f5('0x13a')](_0x3516e8[_0x93f5('0x41')],_0x3516e8[_0x93f5('0x42')],_0x3516e8[_0x93f5('0x13b')]);};AGIVertices[_0x93f5('0x12')]['gotoif']=function(_0x36cc0a){logger[_0x93f5('0x2f')](util['format'](_0x93f5('0x13c'),_0x36cc0a[_0x93f5('0x3b')]));if(!this[_0x93f5('0x85')](_0x36cc0a[_0x93f5('0x13d')])){return this['channel']['error'](_0x36cc0a,_0x93f5('0x13e'));}try{var _0x41d795=eval(_0x36cc0a[_0x93f5('0x13d')])?_0x93f5('0x13f'):_0x93f5('0x140');this[_0x93f5('0x39')][_0x93f5('0xa8')](util[_0x93f5('0x2b')](_0x93f5('0x141'),_0x36cc0a[_0x93f5('0x13d')],_0x41d795));return{'code':0xc8,'result':_0x41d795};}catch(_0x311718){return{'code':0xc8,'result':'false'};}};AGIVertices['prototype']['gotoiftime']=function(_0x2787ef){logger[_0x93f5('0x2f')](util[_0x93f5('0x2b')](_0x93f5('0x142'),_0x2787ef[_0x93f5('0x3b')]));if(!this['isConfigured'](_0x2787ef['interval_id'])){return this['channel'][_0x93f5('0x51')](_0x2787ef,_0x93f5('0x143'));}var _0x1f27c4=this[_0x93f5('0x26')][_0x93f5('0xa4')](this,_0x2787ef[_0x93f5('0x144')]);if(!_0x1f27c4){return this[_0x93f5('0x39')][_0x93f5('0x51')](_0x2787ef,'no\x20intervals\x20found');}for(var _0x2a9f8c=0x0;_0x2a9f8c<_0x1f27c4[_0x93f5('0x9c')];_0x2a9f8c+=0x1){var _0x3c7bb2=this[_0x93f5('0x39')][_0x93f5('0x13')](util[_0x93f5('0x2b')](_0x93f5('0x145'),_0x1f27c4[_0x2a9f8c]));if(_0x3c7bb2[_0x93f5('0xb1')]===-0x1){return _0x3c7bb2;}logger[_0x93f5('0x2f')](util[_0x93f5('0x2b')](_0x93f5('0x146'),_0x1f27c4[_0x2a9f8c],_0x3c7bb2[_0x93f5('0xa0')]));if(_0x3c7bb2[_0x93f5('0xa0')]==='true'){logger[_0x93f5('0x2f')](util['format'](_0x93f5('0x146'),_0x1f27c4[_0x2a9f8c],_0x93f5('0x13f')));this[_0x93f5('0x39')][_0x93f5('0xa8')](util[_0x93f5('0x2b')](_0x93f5('0x146'),_0x1f27c4[_0x2a9f8c],_0x93f5('0x13f')));return{'code':0xc8,'result':_0x93f5('0x13f')};}else{logger[_0x93f5('0x2f')](util[_0x93f5('0x2b')](_0x93f5('0x146'),_0x1f27c4[_0x2a9f8c],_0x93f5('0x140')));this[_0x93f5('0x39')]['noop'](util[_0x93f5('0x2b')](_0x93f5('0x146'),_0x1f27c4[_0x2a9f8c],'false'));}}return{'code':0xc8,'result':'false'};};AGIVertices['prototype'][_0x93f5('0x147')]=function(_0x478ac1){logger[_0x93f5('0x2f')](util[_0x93f5('0x2b')](_0x93f5('0x148'),_0x478ac1[_0x93f5('0x3b')]));return this[_0x93f5('0x39')]['hangup']();};AGIVertices[_0x93f5('0x12')][_0x93f5('0x149')]=function(_0x1aa1b1){logger[_0x93f5('0x2f')](util[_0x93f5('0x2b')](_0x93f5('0x14a'),_0x1aa1b1[_0x93f5('0x3b')]));if(!this[_0x93f5('0x85')](_0x1aa1b1[_0x93f5('0x7a')])){return this[_0x93f5('0x39')][_0x93f5('0xa8')]('no\x20key\x20configured');}var _0x51d24d=_0x93f5('0x135');var _0x574af2=util['format'](_0x93f5('0x12c'),FILES_PATH,rs[_0x93f5('0x11b')](0x4));var _0xfa7ee5=util[_0x93f5('0x2b')]('%s.%s',_0x574af2,_0x51d24d);var _0x4ea87a=!![];if(_0x1aa1b1[_0x93f5('0x12d')]===_0x93f5('0x12e')){_0x4ea87a=![];}var _0x28d943=this[_0x93f5('0x39')][_0x93f5('0x136')](_0x574af2,_0x51d24d,_0x1aa1b1[_0x93f5('0x12f')],_0x1aa1b1['timeout'],undefined,_0x4ea87a);if(_0x28d943[_0x93f5('0xb1')]!==-0x1){this['channel']['noop'](util[_0x93f5('0x2b')](_0x93f5('0x14b'),_0xfa7ee5));var _0x489050=this[_0x93f5('0x84')][_0x93f5('0xa4')](this,_0x1aa1b1,_0xfa7ee5);if(_0x489050){for(var _0x2b7fb6 in _0x489050){if(_0x489050[_0x93f5('0x94')](_0x2b7fb6)){this[_0x93f5('0x39')][_0x93f5('0xa3')](util[_0x93f5('0x2b')](_0x93f5('0x14c'),_0x2b7fb6[_0x93f5('0x6b')]()),_0x489050[_0x2b7fb6]);}}return this[_0x93f5('0x39')][_0x93f5('0xa8')](util[_0x93f5('0x2b')](_0x93f5('0x14d'),JSON['stringify'](_0x489050)));}}return _0x28d943;};AGIVertices[_0x93f5('0x12')][_0x93f5('0x14e')]=function(_0x2e075b){logger['info'](util[_0x93f5('0x2b')](_0x93f5('0x14f'),_0x2e075b[_0x93f5('0x3b')]));if(!this[_0x93f5('0x85')](_0x2e075b[_0x93f5('0x7a')])){return this['channel'][_0x93f5('0xa8')]('no\x20key\x20configured');}if(!this[_0x93f5('0x85')](_0x2e075b[_0x93f5('0x5d')])){return this[_0x93f5('0x39')][_0x93f5('0xa8')]('no\x20text\x20configured');}this[_0x93f5('0x39')][_0x93f5('0xa8')](util[_0x93f5('0x2b')](_0x93f5('0x150'),_0x2e075b[_0x93f5('0x5d')]));var _0x292a73=this[_0x93f5('0x81')]['sync'](this,_0x2e075b);if(_0x292a73){this[_0x93f5('0x39')][_0x93f5('0xa8')](util[_0x93f5('0x2b')](_0x93f5('0x14b'),_0x292a73));var _0x583abb=this[_0x93f5('0x39')][_0x93f5('0x101')](_0x292a73,_0x2e075b[_0x93f5('0x12f')]);try{fs[_0x93f5('0x102')](_0x292a73+_0x93f5('0x103'));}catch(_0x566572){logger[_0x93f5('0x51')](_0x566572);}return _0x583abb;}return this[_0x93f5('0x39')][_0x93f5('0x51')](_0x2e075b,_0x93f5('0x151'));};AGIVertices[_0x93f5('0x12')][_0x93f5('0x152')]=function(_0x2766b4){logger[_0x93f5('0x2f')](util[_0x93f5('0x2b')](_0x93f5('0x153'),_0x2766b4[_0x93f5('0x3b')]));if(!this[_0x93f5('0x85')](_0x2766b4[_0x93f5('0x154')])){return this[_0x93f5('0x39')][_0x93f5('0x51')](_0x2766b4,_0x93f5('0x155'));}logger[_0x93f5('0x2f')](util[_0x93f5('0x2b')](_0x93f5('0x156'),this[_0x93f5('0x39')][_0x93f5('0x3f')],_0x2766b4[_0x93f5('0x154')]));var _0x410a91=this[_0x93f5('0x54')][_0x93f5('0xa4')](this,_0x2766b4[_0x93f5('0x154')]);if(_0x410a91){logger[_0x93f5('0x2f')](util[_0x93f5('0x2b')](_0x93f5('0x157'),this[_0x93f5('0x39')][_0x93f5('0x3f')],_0x2766b4[_0x93f5('0x154')]));this[_0x93f5('0x39')][_0x93f5('0xa8')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x93f5('0x39')]['callerid'],_0x2766b4['findBy']));return{'code':0xc8,'result':'success'};}else{logger[_0x93f5('0x2f')](util[_0x93f5('0x2b')](_0x93f5('0x158'),this[_0x93f5('0x39')][_0x93f5('0x3f')],_0x2766b4[_0x93f5('0x154')]));this[_0x93f5('0x39')][_0x93f5('0xa8')](util['format'](_0x93f5('0x158'),this['channel'][_0x93f5('0x3f')],_0x2766b4['findBy']));return{'code':0xc8,'result':_0x93f5('0x159')};}};AGIVertices[_0x93f5('0x12')][_0x93f5('0x15a')]=function(_0x2c652a){logger[_0x93f5('0x2f')](util['format'](_0x93f5('0x15b'),_0x2c652a[_0x93f5('0x3b')]));if(!this[_0x93f5('0x85')](_0x2c652a[_0x93f5('0x154')])){return this[_0x93f5('0x39')]['error'](_0x2c652a,_0x93f5('0x155'));}logger['info'](util[_0x93f5('0x2b')](_0x93f5('0x156'),this[_0x93f5('0x39')][_0x93f5('0x3f')],_0x2c652a[_0x93f5('0x154')]));var _0x40f8b1=this['agentLogout'][_0x93f5('0xa4')](this,_0x2c652a[_0x93f5('0x154')]);if(_0x40f8b1){logger[_0x93f5('0x2f')](util[_0x93f5('0x2b')](_0x93f5('0x157'),this[_0x93f5('0x39')][_0x93f5('0x3f')],_0x2c652a[_0x93f5('0x154')]));this[_0x93f5('0x39')][_0x93f5('0xa8')](util[_0x93f5('0x2b')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x93f5('0x39')]['callerid'],_0x2c652a[_0x93f5('0x154')]));return{'code':0xc8,'result':_0x93f5('0x15c')};}else{logger['info'](util[_0x93f5('0x2b')](_0x93f5('0x158'),this[_0x93f5('0x39')][_0x93f5('0x3f')],_0x2c652a[_0x93f5('0x154')]));this[_0x93f5('0x39')][_0x93f5('0xa8')](util[_0x93f5('0x2b')](_0x93f5('0x158'),this[_0x93f5('0x39')][_0x93f5('0x3f')],_0x2c652a['findBy']));return{'code':0xc8,'result':_0x93f5('0x159')};}};AGIVertices[_0x93f5('0x12')]['math']=function(_0x2513c9){logger['info'](util[_0x93f5('0x2b')](_0x93f5('0x15d'),_0x2513c9[_0x93f5('0x3b')]));if(!this[_0x93f5('0x85')](_0x2513c9[_0x93f5('0x15e')])){return this[_0x93f5('0x39')][_0x93f5('0x51')](_0x2513c9,_0x93f5('0x15f'));}this[_0x93f5('0x39')][_0x93f5('0xa8')](util['format'](_0x93f5('0x160'),_0x2513c9[_0x93f5('0x15e')]));var _0x1129cc=eval(_0x2513c9['operation']);if(!this[_0x93f5('0x85')](_0x2513c9[_0x93f5('0xd5')])){return this[_0x93f5('0x39')][_0x93f5('0xa8')](_0x93f5('0xd6'));}var _0x39516e=this[_0x93f5('0x13')]['sync'](this,_0x2513c9[_0x93f5('0xd5')]);if(!_0x39516e){return this[_0x93f5('0x39')][_0x93f5('0x51')](_0x2513c9,'no\x20variable\x20found');}if(_[_0x93f5('0x99')](_0x1129cc)){var _0x486c57=this;_0x1129cc[_0x93f5('0xd8')](function(_0x36f8e9,_0x33b90a){_0x486c57[_0x93f5('0x39')][_0x93f5('0xa3')](util['format'](_0x93f5('0x161'),_0x39516e,_0x33b90a),_0x36f8e9);});return this[_0x93f5('0x39')]['noop'](util[_0x93f5('0x2b')]('variable\x20%s[key]\x20set',_0x39516e));}else{return this[_0x93f5('0x39')][_0x93f5('0xa3')](_0x39516e,_0x1129cc);}};AGIVertices['prototype'][_0x93f5('0xd')]=function(_0x21e1e3){logger[_0x93f5('0x2f')](util[_0x93f5('0x2b')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x21e1e3['label']));if(_0x21e1e3[_0x93f5('0xa5')]===0x0){return this[_0x93f5('0xa6')](_0x21e1e3);}_0x21e1e3[_0x93f5('0xa5')]-=0x1;if(!this['isConfigured'](_0x21e1e3[_0x93f5('0x112')])){return this[_0x93f5('0x39')]['error'](_0x21e1e3,'no\x20file\x20audio\x20selected');}var _0x5495dc=this[_0x93f5('0x20')][_0x93f5('0xa4')](this,_0x21e1e3[_0x93f5('0x112')]);if(!_0x5495dc){return this[_0x93f5('0x39')][_0x93f5('0x51')](_0x21e1e3,_0x93f5('0x114'));}var _0x5a46b4=this['channel'][_0x93f5('0x115')](_0x5495dc,_0x21e1e3[_0x93f5('0x116')],_0x21e1e3[_0x93f5('0x162')]);var _0x4f7964=_0x5a46b4[_0x93f5('0xb1')];if(_0x5a46b4[_0x93f5('0xb1')]===-0x1){this[_0x93f5('0x38')]['sync'](this,_0x21e1e3,'-1');return _0x5a46b4;}else if(_0x5a46b4[_0x93f5('0xa0')]===_0x93f5('0x67')){_0x5a46b4[_0x93f5('0xb1')]=_0x5a46b4[_0x93f5('0xb1')][_0x93f5('0x9c')]>0x0?_0x5a46b4[_0x93f5('0xb1')]:'t';}else if(_['isEmpty'](_0x5a46b4['result'])){_0x5a46b4[_0x93f5('0xb1')]='#';_0x4f7964='#';}if(!this[_0x93f5('0x85')](_0x21e1e3['variable_id'])){this[_0x93f5('0x39')][_0x93f5('0xa8')](_0x93f5('0xd6'));}else{var _0x4c26e1=this[_0x93f5('0x13')][_0x93f5('0xa4')](this,_0x21e1e3[_0x93f5('0xd5')]);if(!_0x4c26e1){return this[_0x93f5('0x39')][_0x93f5('0x51')](_0x21e1e3,'no\x20variable\x20found');}this[_0x93f5('0x39')][_0x93f5('0xa3')](_0x4c26e1,_0x4f7964);}this[_0x93f5('0x38')][_0x93f5('0xa4')](this,_0x21e1e3,_0x4f7964);return _0x5a46b4;};AGIVertices['prototype'][_0x93f5('0xa8')]=function(_0x5b7a5a){logger['info'](util['format'](_0x93f5('0x163'),_0x5b7a5a[_0x93f5('0x3b')]));return this['channel'][_0x93f5('0xa8')](_0x5b7a5a[_0x93f5('0x164')]||_0x5b7a5a['label']);};AGIVertices[_0x93f5('0x12')]['pause']=function(_0x1068f4){logger['info'](util['format'](_0x93f5('0x165'),_0x1068f4['label']));if(!this[_0x93f5('0x85')](_0x1068f4[_0x93f5('0x154')])){return this['channel']['error'](_0x1068f4,'no\x20find\x20by\x20configured');}logger['info'](util[_0x93f5('0x2b')](_0x93f5('0x156'),this[_0x93f5('0x39')]['callerid'],_0x1068f4[_0x93f5('0x154')]));var _0xbdd4c6=this[_0x93f5('0x4e')][_0x93f5('0xa4')](this,_0x1068f4[_0x93f5('0x166')]);var _0x3072b3=this[_0x93f5('0x50')][_0x93f5('0xa4')](this,_0x1068f4[_0x93f5('0x154')],_0xbdd4c6);if(_0x3072b3){logger['info'](util[_0x93f5('0x2b')](_0x93f5('0x157'),this[_0x93f5('0x39')]['callerid'],_0x1068f4[_0x93f5('0x154')]));this[_0x93f5('0x39')]['noop'](util[_0x93f5('0x2b')](_0x93f5('0x157'),this[_0x93f5('0x39')]['callerid'],_0x1068f4[_0x93f5('0x154')]));return{'code':0xc8,'result':_0x93f5('0x15c')};}else{logger[_0x93f5('0x2f')](util[_0x93f5('0x2b')](_0x93f5('0x158'),this['channel'][_0x93f5('0x3f')],_0x1068f4['findBy']));this[_0x93f5('0x39')][_0x93f5('0xa8')](util[_0x93f5('0x2b')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x93f5('0x39')][_0x93f5('0x3f')],_0x1068f4[_0x93f5('0x154')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x93f5('0x12')][_0x93f5('0x167')]=function(_0x24011b){logger[_0x93f5('0x2f')](util[_0x93f5('0x2b')](_0x93f5('0x168'),_0x24011b[_0x93f5('0x3b')]));if(!this['isConfigured'](_0x24011b[_0x93f5('0x112')])){return this[_0x93f5('0x39')][_0x93f5('0x51')](_0x24011b,_0x93f5('0x113'));}var _0x3c586c=this['getSound'][_0x93f5('0xa4')](this,_0x24011b[_0x93f5('0x112')]);if(!_0x3c586c){return this['channel'][_0x93f5('0x51')](_0x24011b,_0x93f5('0x114'));}var _0x34f3dd=this['channel'][_0x93f5('0x58')](_0x93f5('0x169'),[_0x3c586c,_0x24011b['opts']]);if(_0x34f3dd[_0x93f5('0xb1')]===-0x1){return _0x34f3dd;}return this[_0x93f5('0x39')][_0x93f5('0xa8')](util[_0x93f5('0x2b')](_0x93f5('0x16a'),'PLAYBACK',_0x3c586c));};AGIVertices[_0x93f5('0x12')][_0x93f5('0x16b')]=function(_0x54a23a){logger[_0x93f5('0x2f')](util[_0x93f5('0x2b')](_0x93f5('0x16c'),_0x54a23a[_0x93f5('0x3b')]));if(!this[_0x93f5('0x85')](_0x54a23a[_0x93f5('0x16d')])){return this['channel']['error'](_0x54a23a,_0x93f5('0x16e'));}var _0x3c84bf='';var _0x199d02=parseInt(_0x54a23a[_0x93f5('0x16d')],0xa);if(isNaN(_0x199d02)){_0x3c84bf=_0x54a23a[_0x93f5('0x16d')];}else{_0x3c84bf=this[_0x93f5('0x17')][_0x93f5('0xa4')](this,_0x54a23a['queue_id']);if(!_0x3c84bf){return this['channel'][_0x93f5('0x51')](_0x54a23a,'no\x20queue\x20found');}}var _0x2175d5='';if(this[_0x93f5('0x85')](_0x54a23a[_0x93f5('0x112')])){var _0x32b63a=this[_0x93f5('0x20')]['sync'](this,_0x54a23a[_0x93f5('0x112')]);if(_0x32b63a){_0x2175d5=_0x32b63a;}}this[_0x93f5('0x38')][_0x93f5('0xa4')](this,_0x54a23a,_0x3c84bf);if(_0x54a23a[_0x93f5('0xe4')]['indexOf']('x')<0x0){_0x54a23a[_0x93f5('0xe4')]+='x';}if(_0x54a23a['opts'][_0x93f5('0x16f')]('X')<0x0){_0x54a23a[_0x93f5('0xe4')]+='X';}this[_0x93f5('0x39')][_0x93f5('0xa3')](_0x93f5('0x170'),_0x3c84bf?_0x3c84bf['toLowerCase']():'');var _0x5e0a37=this[_0x93f5('0x39')][_0x93f5('0x58')]('QUEUE',[_0x3c84bf,_0x54a23a[_0x93f5('0xe4')],_0x54a23a[_0x93f5('0x73')],_0x2175d5,_0x54a23a[_0x93f5('0x67')],_0x54a23a[_0x93f5('0x8')],_0x54a23a[_0x93f5('0x171')],_0x54a23a[_0x93f5('0x172')],'',_0x54a23a['position']]);if(_0x5e0a37[_0x93f5('0xb1')]===-0x1){return _0x5e0a37;}return this[_0x93f5('0x39')][_0x93f5('0xa8')](util[_0x93f5('0x2b')](_0x93f5('0x16a'),_0x93f5('0x173'),_0x3c84bf));};AGIVertices['prototype'][_0x93f5('0x174')]=function(_0x523da2){logger[_0x93f5('0x2f')](util['format'](_0x93f5('0x175'),_0x523da2['label']));var _0x55a09c=_0x523da2['recordingFormat']||'wav';var _0x36ba0f=util['format'](_0x93f5('0x176'),this[_0x93f5('0x39')][_0x93f5('0x3a')],rs[_0x93f5('0x11b')](0x5));var _0x26f3ab=util[_0x93f5('0x2b')](_0x93f5('0x177'),FILES_PATH,_0x36ba0f,_0x55a09c);var _0xc82a6c=util[_0x93f5('0x2b')](_0x93f5('0x12c'),FILES_PATH,_0x36ba0f);this['createSquareRecording'][_0x93f5('0xa4')](this,_0x523da2,_0x36ba0f,_0x26f3ab);this[_0x93f5('0x39')][_0x93f5('0xa3')](_0x93f5('0x178'),_0x36ba0f);logger[_0x93f5('0x2f')](_0x93f5('0x179'),_0xc82a6c,_0x55a09c,_0x523da2[_0x93f5('0x17a')],_0x523da2[_0x93f5('0x67')]);return this[_0x93f5('0x39')][_0x93f5('0x136')](_0xc82a6c,_0x55a09c,_0x523da2['escape_digits'],_0x523da2[_0x93f5('0x67')],undefined,!![]);};AGIVertices[_0x93f5('0x12')][_0x93f5('0x17b')]=function(_0x18fb09){logger[_0x93f5('0x2f')](util[_0x93f5('0x2b')]('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x18fb09['label']));if(!this['isConfigured'](_0x18fb09['url'])){return this[_0x93f5('0x39')]['noop'](_0x93f5('0x17c'));}var _0x4cd1df=this['restAPI'][_0x93f5('0xa4')](this,_0x18fb09);logger['info'](util['format'](_0x93f5('0x17d'),util['inspect'](_0x4cd1df,{'showHidden':![],'depth':null})));if(!this[_0x93f5('0x85')](_0x18fb09['variable_id'])){return this[_0x93f5('0x39')][_0x93f5('0xa8')](_0x93f5('0x17e'));}var _0x89308=this['getVariable'][_0x93f5('0xa4')](this,_0x18fb09[_0x93f5('0xd5')]);if(!_0x89308){return this[_0x93f5('0x39')]['error'](_0x18fb09,'no\x20variable\x20found');}this['channel'][_0x93f5('0xa3')](util[_0x93f5('0x2b')]('%s_STATUS_CODE',_0x89308),_0x4cd1df[_0x93f5('0x76')]?_0x4cd1df[_0x93f5('0x76')]:_0x93f5('0x17f'));this[_0x93f5('0x39')]['setVariable'](util[_0x93f5('0x2b')](_0x93f5('0x180'),_0x89308),_0x4cd1df[_0x93f5('0x181')]?_0x4cd1df[_0x93f5('0x181')]:'OK');if(_0x4cd1df[_0x93f5('0x6c')]){try{this[_0x93f5('0x9b')](_0x4cd1df[_0x93f5('0x6c')],_0x89308);}catch(_0x254916){logger['error'](util[_0x93f5('0x2b')](_0x93f5('0x182'),_0x89308));}}return this['channel'][_0x93f5('0xa8')](util[_0x93f5('0x2b')](_0x93f5('0xdc'),_0x89308));};AGIVertices[_0x93f5('0x12')]['saydigits']=function(_0x32a0db){logger['info'](util['format'](_0x93f5('0x183'),_0x32a0db[_0x93f5('0x3b')]));return this[_0x93f5('0x39')][_0x93f5('0x184')](_0x32a0db[_0x93f5('0x185')][_0x93f5('0xd4')](/\s+/g,''),_0x32a0db[_0x93f5('0x17a')]);};AGIVertices[_0x93f5('0x12')][_0x93f5('0x186')]=function(_0x39d2a6){logger[_0x93f5('0x2f')](util[_0x93f5('0x2b')](_0x93f5('0x187'),_0x39d2a6[_0x93f5('0x3b')]));return this[_0x93f5('0x39')][_0x93f5('0x188')](_0x39d2a6[_0x93f5('0x68')][_0x93f5('0xd4')](/\s+/g,''),_0x39d2a6[_0x93f5('0x17a')]);};AGIVertices[_0x93f5('0x12')][_0x93f5('0x189')]=function(_0x255d24){logger[_0x93f5('0x2f')](util[_0x93f5('0x2b')](_0x93f5('0x18a'),_0x255d24[_0x93f5('0x3b')]));return this['channel']['sayPhonetic'](_0x255d24['text'],_0x255d24[_0x93f5('0x17a')]);};AGIVertices[_0x93f5('0x12')][_0x93f5('0x18b')]=function(_0x132678){logger[_0x93f5('0x2f')](util[_0x93f5('0x2b')](_0x93f5('0x18c'),_0x132678['label']));if(!this[_0x93f5('0x85')](_0x132678[_0x93f5('0x18d')])){return this[_0x93f5('0x39')]['noop'](_0x93f5('0x18e'));}var _0x31d266=this['getMailAccount'][_0x93f5('0xa4')](this,_0x132678[_0x93f5('0x18d')]);if(!_0x31d266||!_0x31d266[_0x93f5('0x18f')]){return this[_0x93f5('0x39')][_0x93f5('0x51')](_0x132678,'no\x20mail\x20account\x20found');}var _0x2e2c68={'from':util[_0x93f5('0x2b')](_0x93f5('0x190'),_0x31d266[_0x93f5('0x16')],_0x31d266[_0x93f5('0x191')]||_0x31d266[_0x93f5('0x18f')]['user']),'to':_0x132678['to']||'','cc':_0x132678['cc']||'','bcc':_0x132678[_0x93f5('0x192')]||'','subject':_0x132678[_0x93f5('0x193')],'html':_0x132678[_0x93f5('0x5d')],'text':_0x132678[_0x93f5('0x5d')]};if(this[_0x93f5('0x85')](_0x132678[_0x93f5('0x194')])){}logger[_0x93f5('0xde')](_0x93f5('0x195'),JSON[_0x93f5('0x74')](_0x2e2c68));this[_0x93f5('0x38')][_0x93f5('0xa4')](this,_0x132678,_0x132678[_0x93f5('0x18d')]);this[_0x93f5('0x39')][_0x93f5('0xa8')](util[_0x93f5('0x2b')](_0x93f5('0x196'),_0x31d266[_0x93f5('0x16')]));this['sendMailMessage']['sync'](this,_0x31d266[_0x93f5('0x197')],_0x2e2c68);return this[_0x93f5('0x39')][_0x93f5('0xa8')](_0x93f5('0x198'));};AGIVertices[_0x93f5('0x12')][_0x93f5('0x199')]=function(_0x1fde98){logger[_0x93f5('0x2f')](util[_0x93f5('0x2b')](_0x93f5('0x19a'),_0x1fde98['label']));return this['channel'][_0x93f5('0xa8')](_0x93f5('0x19b'));};AGIVertices[_0x93f5('0x12')][_0x93f5('0x19c')]=function(_0xbb523b){logger[_0x93f5('0x2f')](util['format'](_0x93f5('0x19d'),_0xbb523b['label']));if(!this[_0x93f5('0x85')](_0xbb523b[_0x93f5('0x19e')])){return this[_0x93f5('0x39')]['noop']('no\x20sms\x20account\x20configured');}var _0x1fe679=this[_0x93f5('0x36')][_0x93f5('0xa4')](this,_0xbb523b[_0x93f5('0x19e')]);if(!_0x1fe679){return this[_0x93f5('0x39')]['error'](_0xbb523b,_0x93f5('0x19f'));}var _0x5acb24={'body':_0xbb523b[_0x93f5('0x1a0')],'phone':_0xbb523b['to']||'','SmsAccountId':_0x1fe679['id']};logger['debug'](_0x93f5('0x1a1'),JSON[_0x93f5('0x74')](_0x5acb24));this[_0x93f5('0x38')][_0x93f5('0xa4')](this,_0xbb523b,_0xbb523b[_0x93f5('0x19e')]);this[_0x93f5('0x39')][_0x93f5('0xa8')](util['format'](_0x93f5('0x1a2'),_0x1fe679[_0x93f5('0x16')]));this['createSmsMessage'][_0x93f5('0xa4')](this,_0x5acb24);return this[_0x93f5('0x39')][_0x93f5('0xa8')](_0x93f5('0x1a3'));};AGIVertices[_0x93f5('0x12')][_0x93f5('0x1a4')]=function(_0x1800a0){logger[_0x93f5('0x2f')](util[_0x93f5('0x2b')]('Enter\x20in\x20SET\x20(%s)\x20block',_0x1800a0[_0x93f5('0x3b')]));if(!this[_0x93f5('0x85')](_0x1800a0[_0x93f5('0xd5')])){return this[_0x93f5('0x39')][_0x93f5('0x51')](_0x1800a0,_0x93f5('0x1a5'));}var _0x290381=this[_0x93f5('0x13')]['sync'](this,_0x1800a0['variable_id']);if(!_0x290381){return this[_0x93f5('0x39')][_0x93f5('0x51')](_0x1800a0,_0x93f5('0xd7'));}return this[_0x93f5('0x39')][_0x93f5('0xa3')](_0x290381,_0x1800a0[_0x93f5('0x1a6')]);};AGIVertices[_0x93f5('0x12')][_0x93f5('0x1a7')]=function(_0x43751a){logger['info'](util['format'](_0x93f5('0x1a8'),_0x43751a[_0x93f5('0x3b')]));this[_0x93f5('0x39')][_0x93f5('0xa8')](_0x93f5('0x1a9'));if(_0x43751a[_0x93f5('0xbc')]==='yes'){this[_0x93f5('0x39')][_0x93f5('0xa8')]('Answer');return this[_0x93f5('0x39')]['answer']();}return this[_0x93f5('0x39')][_0x93f5('0xa8')](_0x93f5('0x1aa'));};AGIVertices[_0x93f5('0x12')]['subproject']=function(_0x2aaaf3){logger[_0x93f5('0x2f')](util[_0x93f5('0x2b')](_0x93f5('0x1ab'),_0x2aaaf3[_0x93f5('0x3b')]));if(!this['isConfigured'](_0x2aaaf3[_0x93f5('0x1ac')])){return this[_0x93f5('0x39')][_0x93f5('0x51')](_0x2aaaf3,'no\x20subproject\x20selected');}var _0x35a05e=this[_0x93f5('0x19')][_0x93f5('0xa4')](this,_0x2aaaf3[_0x93f5('0x1ac')]);if(!this[_0x93f5('0x85')](_0x35a05e)){return this['channel'][_0x93f5('0x51')](_0x2aaaf3,util[_0x93f5('0x2b')](_0x93f5('0x1ad'),_0x2aaaf3[_0x93f5('0x1ac')]));}if(_0x35a05e===this[_0x93f5('0x39')][_0x93f5('0x3d')]){return this['channel'][_0x93f5('0x51')](_0x2aaaf3,_0x93f5('0x1ae'));}this[_0x93f5('0x38')]['sync'](this,_0x2aaaf3,_0x35a05e);var _0x1ab8a3=this[_0x93f5('0x39')]['exec'](_0x93f5('0x1af'),util['format']('agi://%s/square,\x22%s\x22,\x22%s\x22',config[_0x93f5('0x8')][_0x93f5('0x1b0')]||'127.0.0.1',_0x35a05e,this[_0x93f5('0x39')][_0x93f5('0x3d')]));if(_0x1ab8a3['result']===-0x1){return _0x1ab8a3;}return this[_0x93f5('0x39')]['noop'](util[_0x93f5('0x2b')](_0x93f5('0x16a'),_0x93f5('0x1af'),_0x35a05e));};AGIVertices['prototype'][_0x93f5('0x1b1')]=function(_0x3ee3ff){logger[_0x93f5('0x2f')](util[_0x93f5('0x2b')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x3ee3ff[_0x93f5('0x3b')]));var _0x2ba428=this[_0x93f5('0x57')][_0x93f5('0xa4')](this,_0x3ee3ff[_0x93f5('0xb9')]);this['createSquareDetailsReport']['sync'](this,_0x3ee3ff,_0x3ee3ff['command']);if(this[_0x93f5('0x85')](_0x3ee3ff[_0x93f5('0xd5')])){var _0x1a585b=this[_0x93f5('0x13')][_0x93f5('0xa4')](this,_0x3ee3ff[_0x93f5('0xd5')]);if(_0x1a585b){this[_0x93f5('0x39')][_0x93f5('0xa3')](_0x1a585b,_0x2ba428);return this['channel'][_0x93f5('0xa8')](util[_0x93f5('0x2b')](_0x93f5('0x1b2'),_0x3ee3ff[_0x93f5('0xb9')],_0x1a585b));}}return this[_0x93f5('0x39')]['noop'](util['format'](_0x93f5('0x1b3'),_0x3ee3ff[_0x93f5('0xb9')]));};AGIVertices['prototype']['google_cloud_tts']=function(_0x264a89){logger['info'](util[_0x93f5('0x2b')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x264a89['label']));_0x264a89['text']=_0x264a89[_0x93f5('0x5d')][_0x93f5('0xd4')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x93f5('0x85')](_0x264a89['apiKey'])){return this[_0x93f5('0x39')][_0x93f5('0xa8')](_0x93f5('0x1b4'));}if(!this['isConfigured'](_0x264a89[_0x93f5('0x5d')])){return this[_0x93f5('0x39')][_0x93f5('0xa8')](_0x93f5('0xa9'));}this['channel'][_0x93f5('0xa8')](util['format'](_0x93f5('0x1b5'),_0x264a89[_0x93f5('0x5d')]));var _0x277efd=this[_0x93f5('0x5a')][_0x93f5('0xa4')](this,_0x264a89);if(_0x277efd){this[_0x93f5('0x39')][_0x93f5('0xa8')](util['format'](_0x93f5('0x1b6'),_0x277efd));var _0x508bf6=this['channel'][_0x93f5('0x101')](_0x277efd);try{fs['unlink'](_0x277efd+'.wav');}catch(_0x47fa29){logger['error'](_0x47fa29);}return _0x508bf6;}return this[_0x93f5('0x39')][_0x93f5('0x51')](_0x264a89,_0x93f5('0x1b7'));};AGIVertices[_0x93f5('0x12')]['tts']=function(_0x312ec6){logger[_0x93f5('0x2f')](util[_0x93f5('0x2b')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x312ec6[_0x93f5('0x3b')]));_0x312ec6[_0x93f5('0x5d')]=_0x312ec6[_0x93f5('0x5d')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x93f5('0x85')](_0x312ec6[_0x93f5('0x5d')])){return this['channel']['noop']('no\x20text\x20configured');}this[_0x93f5('0x39')][_0x93f5('0xa8')](util[_0x93f5('0x2b')](_0x93f5('0x1b8'),_0x312ec6[_0x93f5('0x5d')]));var _0x30f5d3=this[_0x93f5('0x63')][_0x93f5('0xa4')](this,_0x312ec6);if(_0x30f5d3){this[_0x93f5('0x39')][_0x93f5('0xa8')](util[_0x93f5('0x2b')]('Google\x20TTS\x20%s\x20file\x20created',_0x30f5d3));var _0x6d5360=this[_0x93f5('0x39')][_0x93f5('0x101')](_0x30f5d3);try{fs[_0x93f5('0x102')](_0x30f5d3+_0x93f5('0x103'));}catch(_0x289fdf){logger[_0x93f5('0x51')](_0x289fdf);}return _0x6d5360;}return this[_0x93f5('0x39')][_0x93f5('0x51')](_0x312ec6,_0x93f5('0x1b9'));};AGIVertices[_0x93f5('0x12')][_0x93f5('0x1ba')]=function(_0x3a138a){logger[_0x93f5('0x2f')](util[_0x93f5('0x2b')](_0x93f5('0x1bb'),_0x3a138a[_0x93f5('0x3b')]));if(!this[_0x93f5('0x85')](_0x3a138a['findBy'])){return this[_0x93f5('0x39')][_0x93f5('0x51')](_0x3a138a,_0x93f5('0x155'));}logger[_0x93f5('0x2f')](util['format'](_0x93f5('0x156'),this[_0x93f5('0x39')][_0x93f5('0x3f')],_0x3a138a[_0x93f5('0x154')]));var _0x12bf3a=this[_0x93f5('0x52')][_0x93f5('0xa4')](this,_0x3a138a['findBy']);if(_0x12bf3a){logger[_0x93f5('0x2f')](util[_0x93f5('0x2b')](_0x93f5('0x157'),this[_0x93f5('0x39')][_0x93f5('0x3f')],_0x3a138a['findBy']));this[_0x93f5('0x39')]['noop'](util['format'](_0x93f5('0x157'),this[_0x93f5('0x39')][_0x93f5('0x3f')],_0x3a138a[_0x93f5('0x154')]));return{'code':0xc8,'result':_0x93f5('0x15c')};}else{logger[_0x93f5('0x2f')](util[_0x93f5('0x2b')](_0x93f5('0x158'),this[_0x93f5('0x39')][_0x93f5('0x3f')],_0x3a138a[_0x93f5('0x154')]));this['channel'][_0x93f5('0xa8')](util[_0x93f5('0x2b')](_0x93f5('0x158'),this['channel'][_0x93f5('0x3f')],_0x3a138a[_0x93f5('0x154')]));return{'code':0xc8,'result':_0x93f5('0x159')};}};AGIVertices[_0x93f5('0x12')][_0x93f5('0x1bc')]=function(_0xed0ada){logger[_0x93f5('0x2f')](util[_0x93f5('0x2b')](_0x93f5('0x1bd'),_0xed0ada['label']));var _0x18a60b=this[_0x93f5('0x39')][_0x93f5('0x58')]('VOICEMAIL',[_0xed0ada[_0x93f5('0x1be')],_0xed0ada[_0x93f5('0x78')]]);if(_0x18a60b[_0x93f5('0xb1')]===-0x1){return _0x18a60b;}return this[_0x93f5('0x39')][_0x93f5('0xa8')](util['format']('Executed\x20command\x20%s\x20%s',_0x93f5('0x1bf'),_0xed0ada[_0x93f5('0x1be')]));};AGIVertices['prototype']['vswitch']=function(_0x4a3270){logger[_0x93f5('0x2f')](util[_0x93f5('0x2b')](_0x93f5('0x1c0'),_0x4a3270['label']));if(!this['isConfigured'](_0x4a3270['variable_id'])){return this[_0x93f5('0x39')][_0x93f5('0x51')](_0x4a3270,_0x93f5('0x1a5'));}var _0x2360be=this[_0x93f5('0x13')][_0x93f5('0xa4')](this,_0x4a3270[_0x93f5('0xd5')]);if(!_0x2360be){return this[_0x93f5('0x39')]['error'](_0x4a3270,'no\x20variable\x20found');}var _0x28c2e2=this[_0x93f5('0x39')][_0x93f5('0x13')](_0x2360be);return{'code':0xc8,'result':_0x28c2e2['extra']?_0x28c2e2[_0x93f5('0xa0')]:'-'};};String[_0x93f5('0x12')]['replaceAll']=function(_0x2050f1,_0x26d2fe){return this['split'](_0x2050f1)['join'](_0x26d2fe);};module['exports']=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 3069206..81c25b7 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 _0x3f59=['custom:agentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','interface','queue','mandatoryDisposition','name','Action','QueuePause','then','getAgent','[%s][START][AGENT:%s][QUEUE:%s]','destlinkedid','savePause','info','acwTimeout','stopAcw','lastPauseAt','YYYY-MM-DD\x20HH:mm:ss','updateAcw','uniqueid','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','message','timer','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','update','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','acw','[ACW][syncAgentConnect]\x20%s','syncAgentConnectPreview','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','attended','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','[%s][BLINDTRANSFER:UNIQUEID]','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','all','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','util','lodash','moment','../ami','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer'];(function(_0x4ecedb,_0x2dffa3){var _0x3544cc=function(_0x107383){while(--_0x107383){_0x4ecedb['push'](_0x4ecedb['shift']());}};_0x3544cc(++_0x2dffa3);}(_0x3f59,0x14a));var _0x93f5=function(_0x36f287,_0x1da200){_0x36f287=_0x36f287-0x0;var _0x7f48ac=_0x3f59[_0x36f287];return _0x7f48ac;};'use strict';var util=require(_0x93f5('0x0'));var _=require(_0x93f5('0x1'));var moment=require(_0x93f5('0x2'));var ami=require(_0x93f5('0x3'));var logger=require('../../../config/logger')('acw');var RpcUser=require(_0x93f5('0x4'));var RpcVoiceAgentReport=require(_0x93f5('0x5'));function Acw(_0x462ff2){this[_0x93f5('0x6')]=_0x462ff2['voiceQueues'];this['agents']=_0x462ff2[_0x93f5('0x7')];this[_0x93f5('0x8')]=_0x462ff2[_0x93f5('0x8')];this[_0x93f5('0x9')]={};ami['on']('agentconnect',this[_0x93f5('0xa')][_0x93f5('0xb')](this));ami['on'](_0x93f5('0xc'),this[_0x93f5('0xd')][_0x93f5('0xb')](this));ami['on'](_0x93f5('0xe'),this[_0x93f5('0xf')][_0x93f5('0xb')](this));ami['on'](_0x93f5('0x10'),this[_0x93f5('0x11')][_0x93f5('0xb')](this));ami['on'](_0x93f5('0x12'),this[_0x93f5('0x13')][_0x93f5('0xb')](this));ami['on'](_0x93f5('0x14'),this[_0x93f5('0x15')][_0x93f5('0xb')](this));ami['on'](_0x93f5('0x16'),this['syncAgentConnectPreview'][_0x93f5('0xb')](this));}function getDiff(_0x470fe5){var _0x3ce43f=moment()[_0x93f5('0x17')](0x0);var _0x3c72ad=moment(_0x470fe5)['milliseconds'](0x0);return _0x3ce43f[_0x93f5('0x18')](_0x3c72ad,_0x93f5('0x19'));}Acw[_0x93f5('0x1a')][_0x93f5('0x1b')]=function(_0x3cf4ee){try{var _0x2cad0a=this;var _0x2af85a=this[_0x93f5('0x9')][_0x3cf4ee][_0x93f5('0x1c')];var _0x262b2a=this['channels'][_0x3cf4ee][_0x93f5('0x1d')];var _0x4ed3b8=this[_0x93f5('0x6')][_0x262b2a];var _0x73c910=![];var _0x38a1e3='ACW';if(_0x4ed3b8[_0x93f5('0x1e')]){if(_0x4ed3b8['mandatoryDispositionPause'][_0x93f5('0x1f')]){_0x73c910=!![];_0x38a1e3=_0x4ed3b8['mandatoryDispositionPause'][_0x93f5('0x1f')];}}ami[_0x93f5('0x20')]({'action':_0x93f5('0x21'),'interface':_0x2af85a,'paused':!![],'reason':_0x38a1e3})[_0x93f5('0x22')](function(_0x1b2556){if(_0x2cad0a['agents'][_0x2af85a]){return RpcUser[_0x93f5('0x23')](_0x2cad0a[_0x93f5('0x7')][_0x2af85a]['id'])[_0x93f5('0x22')](function(_0x168dbd){if(_0x168dbd&&!_0x168dbd['voicePause']){logger['info'](_0x93f5('0x24'),_0x3cf4ee,_0x2af85a,_0x262b2a);var _0x2a63da=_0x2cad0a['channels'][_0x3cf4ee]['attended']&&_0x2cad0a[_0x93f5('0x9')][_0x3cf4ee][_0x93f5('0x25')]?_0x2cad0a[_0x93f5('0x9')][_0x3cf4ee][_0x93f5('0x25')]:_0x3cf4ee;return RpcUser[_0x93f5('0x26')](_0x2cad0a[_0x93f5('0x7')][_0x2af85a],_0x38a1e3,_0x2a63da)[_0x93f5('0x22')](function(_0x3cba26){if(!_0x73c910){_0x2cad0a[_0x93f5('0x8')][_0x2af85a]={};logger[_0x93f5('0x27')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x3cf4ee,_0x2cad0a[_0x93f5('0x6')][_0x262b2a][_0x93f5('0x28')],_0x2af85a,_0x262b2a);_0x2cad0a['timers'][_0x2af85a]['timer']=setTimeout(_0x2cad0a[_0x93f5('0x29')][_0x93f5('0xb')](_0x2cad0a,_0x2af85a),_0x2cad0a[_0x93f5('0x6')][_0x262b2a]['acwTimeout']*0x3e8);_0x2cad0a[_0x93f5('0x8')][_0x2af85a][_0x93f5('0x2a')]=moment()['format'](_0x93f5('0x2b'));_0x2cad0a['timers'][_0x2af85a]['uniqueid']=_0x3cf4ee;_0x2cad0a[_0x93f5('0x8')][_0x2af85a][_0x93f5('0x1d')]=_0x262b2a;_0x2cad0a[_0x93f5('0x8')][_0x2af85a][_0x93f5('0x2c')]=function(){var _0x47488f=getDiff(_0x2cad0a[_0x93f5('0x8')][_0x2af85a][_0x93f5('0x2a')]);clearTimeout(_0x2cad0a[_0x93f5('0x8')][_0x2af85a]['timer']);_0x2cad0a[_0x93f5('0x8')][_0x2af85a]['timer']=![];RpcVoiceAgentReport['update']({'acwtime':_0x47488f},_0x2cad0a['timers'][_0x2af85a][_0x93f5('0x2d')],_0x2af85a)[_0x93f5('0x22')](function(_0x5e24ed){logger[_0x93f5('0x27')](_0x93f5('0x2e'),_0x3cf4ee,_0x47488f,_0x5e24ed);})[_0x93f5('0x2f')](function(_0x61ccc){logger[_0x93f5('0x30')](_0x93f5('0x31'),_0x3cf4ee,_0x61ccc);});delete _0x2cad0a[_0x93f5('0x8')][_0x2af85a];};}});}else{logger[_0x93f5('0x27')](_0x93f5('0x32'),_0x3cf4ee,_0x2af85a,_0x262b2a);}});}})[_0x93f5('0x2f')](function(_0x1c17a6){logger[_0x93f5('0x30')](_0x93f5('0x33'),_0x3cf4ee,_0x2cad0a[_0x93f5('0x6')][_0x262b2a][_0x93f5('0x28')],_0x2af85a,_0x262b2a);})[_0x93f5('0x34')](function(){delete _0x2cad0a[_0x93f5('0x9')][_0x3cf4ee];});}catch(_0x7dce69){logger[_0x93f5('0x30')](_0x93f5('0x35'),_0x7dce69[_0x93f5('0x36')]);}};Acw[_0x93f5('0x1a')]['stopAcw']=function(_0xdd001b){try{var _0x1043bf=this;if(_0x1043bf[_0x93f5('0x8')][_0xdd001b]){_0x1043bf[_0x93f5('0x8')][_0xdd001b][_0x93f5('0x37')]=![];var _0x54c53c=_0x1043bf[_0x93f5('0x8')][_0xdd001b][_0x93f5('0x2d')];var _0x44df8c=_0x1043bf[_0x93f5('0x8')][_0xdd001b][_0x93f5('0x1d')];var _0x473037=_0x1043bf[_0x93f5('0x6')][_0x44df8c]['acwTimeout'];logger[_0x93f5('0x27')](_0x93f5('0x38'),_0x54c53c,_0xdd001b);RpcUser[_0x93f5('0x39')](this['agents'][_0xdd001b]);RpcVoiceAgentReport[_0x93f5('0x3a')]({'acwtime':_0x473037,'agentacw':!![]},_0x54c53c,_0xdd001b)[_0x93f5('0x22')](function(_0x1b6753){logger['info'](_0x93f5('0x2e'),_0x54c53c,_0x473037,_0x1b6753);})[_0x93f5('0x2f')](function(_0x566dcc){logger[_0x93f5('0x30')]('[%s][UPDATE][ERRORS:%s]',_0x54c53c,_0x566dcc);});}else{logger['error'](_0x93f5('0x3b'),_0xdd001b);if(_0x1043bf['timers']){logger[_0x93f5('0x27')](_0x93f5('0x3c'),JSON[_0x93f5('0x3d')](_0x1043bf['timers']));}}}catch(_0x149886){logger[_0x93f5('0x30')]('[ACW][STOP]\x20%s',_0x149886[_0x93f5('0x36')]);}};Acw[_0x93f5('0x1a')]['syncAgentConnect']=function(_0x55d8ea){try{if(this['voiceQueues'][_0x55d8ea[_0x93f5('0x1d')]]&&(this[_0x93f5('0x6')][_0x55d8ea[_0x93f5('0x1d')]][_0x93f5('0x3e')]||this[_0x93f5('0x6')][_0x55d8ea['queue']]['mandatoryDisposition'])){if(this['agents'][_0x55d8ea[_0x93f5('0x1c')]]){this[_0x93f5('0x9')][_0x55d8ea['uniqueid']]={'queue':_0x55d8ea[_0x93f5('0x1d')],'interface':_0x55d8ea[_0x93f5('0x1c')],'destlinkedid':_0x55d8ea[_0x93f5('0x25')]};}}}catch(_0x712c02){logger[_0x93f5('0x30')](_0x93f5('0x3f'),_0x712c02[_0x93f5('0x36')]);}};Acw[_0x93f5('0x1a')][_0x93f5('0x40')]=function(_0x24235b){try{if(this[_0x93f5('0x6')][_0x24235b[_0x93f5('0x1d')]]&&(this[_0x93f5('0x6')][_0x24235b[_0x93f5('0x1d')]][_0x93f5('0x3e')]||this[_0x93f5('0x6')][_0x24235b['queue']][_0x93f5('0x1e')])){if(this[_0x93f5('0x7')][_0x24235b[_0x93f5('0x1c')]]){this[_0x93f5('0x9')][_0x24235b['uniqueid']]={'queue':_0x24235b[_0x93f5('0x1d')],'interface':_0x24235b[_0x93f5('0x1c')]};}}}catch(_0x46667e){logger[_0x93f5('0x30')](_0x93f5('0x41'),_0x46667e[_0x93f5('0x36')]);}};Acw['prototype'][_0x93f5('0xd')]=function(_0x1f21b5){try{if(this[_0x93f5('0x9')][_0x1f21b5[_0x93f5('0x2d')]]&&_[_0x93f5('0x42')](this[_0x93f5('0x9')][_0x1f21b5[_0x93f5('0x2d')]][_0x93f5('0x43')])){logger[_0x93f5('0x27')](_0x93f5('0x44'),_0x1f21b5['uniqueid']);this[_0x93f5('0x1b')](_0x1f21b5[_0x93f5('0x2d')]);}else if(this[_0x93f5('0x9')][_0x1f21b5['linkedid']]&&_[_0x93f5('0x42')](this[_0x93f5('0x9')][_0x1f21b5[_0x93f5('0x45')]][_0x93f5('0x43')])){logger[_0x93f5('0x27')](_0x93f5('0x46'),_0x1f21b5[_0x93f5('0x45')]);this[_0x93f5('0x1b')](_0x1f21b5['linkedid']);}}catch(_0x5259b8){logger[_0x93f5('0x30')](_0x93f5('0x47'),_0x5259b8['message']);}};Acw[_0x93f5('0x1a')][_0x93f5('0xf')]=function(_0x2e850f){try{if(this['channels'][_0x2e850f['uniqueid']]&&this[_0x93f5('0x9')][_0x2e850f[_0x93f5('0x2d')]][_0x93f5('0x43')]){logger[_0x93f5('0x27')](_0x93f5('0x48'),_0x2e850f[_0x93f5('0x2d')]);this['startAcw'](_0x2e850f[_0x93f5('0x2d')]);}else if(this[_0x93f5('0x9')][_0x2e850f[_0x93f5('0x45')]]&&this[_0x93f5('0x9')][_0x2e850f[_0x93f5('0x45')]][_0x93f5('0x43')]){logger[_0x93f5('0x27')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x2e850f[_0x93f5('0x45')]);this[_0x93f5('0x1b')](_0x2e850f[_0x93f5('0x45')]);}}catch(_0xc14677){logger[_0x93f5('0x30')]('[ACW][syncHangup]\x20%s',_0xc14677[_0x93f5('0x36')]);}};Acw['prototype'][_0x93f5('0x13')]=function(_0x4e690){try{if(!_[_0x93f5('0x49')](this[_0x93f5('0x9')][_0x4e690[_0x93f5('0x4a')]])){this[_0x93f5('0x1b')](_0x4e690[_0x93f5('0x4a')]);if(this[_0x93f5('0x9')][_0x4e690['secondtransfereruniqueid']]){this[_0x93f5('0x9')][_0x4e690[_0x93f5('0x4b')]][_0x93f5('0x43')]=!![];this[_0x93f5('0x9')][_0x4e690['transfertargetuniqueid']]=this['channels'][_0x4e690[_0x93f5('0x4b')]];delete this['channels'][_0x4e690[_0x93f5('0x4b')]];}}else if(!_['isNil'](this[_0x93f5('0x9')][_0x4e690[_0x93f5('0x4c')]])){this[_0x93f5('0x1b')](_0x4e690[_0x93f5('0x4c')]);if(this[_0x93f5('0x9')][_0x4e690[_0x93f5('0x4d')]]){this['channels'][_0x4e690[_0x93f5('0x4d')]]['attended']=!![];this[_0x93f5('0x9')][_0x4e690['transfereeuniqueid']]=this[_0x93f5('0x9')][_0x4e690[_0x93f5('0x4d')]];delete this[_0x93f5('0x9')][_0x4e690[_0x93f5('0x4d')]];}}}catch(_0x15ece7){logger[_0x93f5('0x30')](_0x93f5('0x4e'),_0x15ece7[_0x93f5('0x36')]);}};Acw['prototype']['syncBlindTransfer']=function(_0x2c5a53){try{if(this['channels'][_0x2c5a53['transfereruniqueid']]){logger[_0x93f5('0x27')](_0x93f5('0x4f'),JSON[_0x93f5('0x3d')](_0x2c5a53[_0x93f5('0x50')]));this[_0x93f5('0x1b')](_0x2c5a53[_0x93f5('0x50')]);}else if(this[_0x93f5('0x9')][_0x2c5a53[_0x93f5('0x51')]]){logger[_0x93f5('0x27')](_0x93f5('0x52'),JSON[_0x93f5('0x3d')](_0x2c5a53['transfererlinkedid']));this['startAcw'](_0x2c5a53[_0x93f5('0x51')]);}}catch(_0x40596c){logger['error'](_0x93f5('0x53'),_0x40596c[_0x93f5('0x36')]);}};Acw[_0x93f5('0x1a')][_0x93f5('0x11')]=function(_0x14e054){try{if(this[_0x93f5('0x6')][_0x14e054['queue']]&&this[_0x93f5('0x6')][_0x14e054[_0x93f5('0x1d')]][_0x93f5('0x54')]===_0x93f5('0x55')){if(this[_0x93f5('0x7')][_0x14e054['interface']]){logger[_0x93f5('0x27')]('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x14e054[_0x93f5('0x2d')],_0x14e054[_0x93f5('0x1c')],_0x14e054[_0x93f5('0x1d')]);return RpcUser['savePause'](this[_0x93f5('0x7')][_0x14e054['interface']],_0x93f5('0x56'),_0x14e054[_0x93f5('0x2d')]);}}}catch(_0x3f3d7a){logger[_0x93f5('0x30')](_0x93f5('0x57'),_0x3f3d7a[_0x93f5('0x36')]);}};module['exports']=Acw; \ No newline at end of file +var _0x5c87=['transfereruniqueid','transfererlinkedid','syncAgentRingNoAnswer','all','[ACW][syncAgentRingNoAnswer]\x20%s','util','lodash','moment','../ami','../../../config/logger','acw','../rpc/user','voiceQueues','agents','timers','agentconnect','hanguprequest','syncHangupRequest','bind','hangup','syncHangup','agentringnoanswer','attendedtransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','seconds','startAcw','channels','queue','ACW','mandatoryDispositionPause','name','Action','QueuePause','then','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','format','uniqueid','updateAcw','lastPauseAt','[%s][UPDATE][ACWTIME:%s]','catch','error','[ACW][START]\x20%s','message','prototype','update','[%s][UPDATE][ERRORS:%s]','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','syncAgentConnect','interface','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','syncAttendedTransfer','isNil','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','transfereeuniqueid','[ACW][syncAttendedTransfer]\x20%s'];(function(_0xfcfe92,_0x14ea66){var _0x166ba1=function(_0x45f01a){while(--_0x45f01a){_0xfcfe92['push'](_0xfcfe92['shift']());}};_0x166ba1(++_0x14ea66);}(_0x5c87,0x1f1));var _0x75c8=function(_0x166742,_0x55520c){_0x166742=_0x166742-0x0;var _0xb7814a=_0x5c87[_0x166742];return _0xb7814a;};'use strict';var util=require(_0x75c8('0x0'));var _=require(_0x75c8('0x1'));var moment=require(_0x75c8('0x2'));var ami=require(_0x75c8('0x3'));var logger=require(_0x75c8('0x4'))(_0x75c8('0x5'));var RpcUser=require(_0x75c8('0x6'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x1b2ef7){this['voiceQueues']=_0x1b2ef7[_0x75c8('0x7')];this[_0x75c8('0x8')]=_0x1b2ef7[_0x75c8('0x8')];this[_0x75c8('0x9')]=_0x1b2ef7[_0x75c8('0x9')];this['channels']={};ami['on'](_0x75c8('0xa'),this['syncAgentConnect']['bind'](this));ami['on'](_0x75c8('0xb'),this[_0x75c8('0xc')][_0x75c8('0xd')](this));ami['on'](_0x75c8('0xe'),this[_0x75c8('0xf')]['bind'](this));ami['on'](_0x75c8('0x10'),this['syncAgentRingNoAnswer'][_0x75c8('0xd')](this));ami['on'](_0x75c8('0x11'),this['syncAttendedTransfer'][_0x75c8('0xd')](this));ami['on'](_0x75c8('0x12'),this[_0x75c8('0x13')][_0x75c8('0xd')](this));ami['on'](_0x75c8('0x14'),this[_0x75c8('0x15')][_0x75c8('0xd')](this));}function getDiff(_0x42d033){var _0xe221a5=moment()[_0x75c8('0x16')](0x0);var _0x515766=moment(_0x42d033)[_0x75c8('0x16')](0x0);return _0xe221a5['diff'](_0x515766,_0x75c8('0x17'));}Acw['prototype'][_0x75c8('0x18')]=function(_0x399b35){try{var _0x4ad6f4=this;var _0x226d2f=this['channels'][_0x399b35]['interface'];var _0x38844f=this[_0x75c8('0x19')][_0x399b35][_0x75c8('0x1a')];var _0x3f6690=this[_0x75c8('0x7')][_0x38844f];var _0x467afa=![];var _0x4b269b=_0x75c8('0x1b');if(_0x3f6690['mandatoryDisposition']){if(_0x3f6690[_0x75c8('0x1c')][_0x75c8('0x1d')]){_0x467afa=!![];_0x4b269b=_0x3f6690[_0x75c8('0x1c')]['name'];}}ami[_0x75c8('0x1e')]({'action':_0x75c8('0x1f'),'interface':_0x226d2f,'paused':!![],'reason':_0x4b269b})[_0x75c8('0x20')](function(_0x821063){if(_0x4ad6f4[_0x75c8('0x8')][_0x226d2f]){return RpcUser['getAgent'](_0x4ad6f4[_0x75c8('0x8')][_0x226d2f]['id'])[_0x75c8('0x20')](function(_0x1e92ce){if(_0x1e92ce&&!_0x1e92ce[_0x75c8('0x21')]){logger[_0x75c8('0x22')](_0x75c8('0x23'),_0x399b35,_0x226d2f,_0x38844f);var _0x75e708=_0x4ad6f4[_0x75c8('0x19')][_0x399b35][_0x75c8('0x24')]&&_0x4ad6f4[_0x75c8('0x19')][_0x399b35][_0x75c8('0x25')]?_0x4ad6f4['channels'][_0x399b35][_0x75c8('0x25')]:_0x399b35;return RpcUser[_0x75c8('0x26')](_0x4ad6f4[_0x75c8('0x8')][_0x226d2f],_0x4b269b,_0x75e708)[_0x75c8('0x20')](function(_0x42a648){if(!_0x467afa){_0x4ad6f4[_0x75c8('0x9')][_0x226d2f]={};logger['info'](_0x75c8('0x27'),_0x399b35,_0x4ad6f4['voiceQueues'][_0x38844f][_0x75c8('0x28')],_0x226d2f,_0x38844f);_0x4ad6f4[_0x75c8('0x9')][_0x226d2f][_0x75c8('0x29')]=setTimeout(_0x4ad6f4[_0x75c8('0x2a')]['bind'](_0x4ad6f4,_0x226d2f),_0x4ad6f4[_0x75c8('0x7')][_0x38844f]['acwTimeout']*0x3e8);_0x4ad6f4[_0x75c8('0x9')][_0x226d2f]['lastPauseAt']=moment()[_0x75c8('0x2b')]('YYYY-MM-DD\x20HH:mm:ss');_0x4ad6f4['timers'][_0x226d2f][_0x75c8('0x2c')]=_0x399b35;_0x4ad6f4[_0x75c8('0x9')][_0x226d2f][_0x75c8('0x1a')]=_0x38844f;_0x4ad6f4[_0x75c8('0x9')][_0x226d2f][_0x75c8('0x2d')]=function(){var _0xcef21f=getDiff(_0x4ad6f4['timers'][_0x226d2f][_0x75c8('0x2e')]);clearTimeout(_0x4ad6f4[_0x75c8('0x9')][_0x226d2f][_0x75c8('0x29')]);_0x4ad6f4['timers'][_0x226d2f][_0x75c8('0x29')]=![];RpcVoiceAgentReport['update']({'acwtime':_0xcef21f},_0x4ad6f4['timers'][_0x226d2f][_0x75c8('0x2c')],_0x226d2f)[_0x75c8('0x20')](function(_0x214341){logger[_0x75c8('0x22')](_0x75c8('0x2f'),_0x399b35,_0xcef21f,_0x214341);})['catch'](function(_0x5010d0){logger['error']('[%s][UPDATE][ERRORS:%s]',_0x399b35,_0x5010d0);});delete _0x4ad6f4[_0x75c8('0x9')][_0x226d2f];};}});}else{logger['info']('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x399b35,_0x226d2f,_0x38844f);}});}})[_0x75c8('0x30')](function(_0x5ba5af){logger[_0x75c8('0x31')](_0x75c8('0x27'),_0x399b35,_0x4ad6f4[_0x75c8('0x7')][_0x38844f]['acwTimeout'],_0x226d2f,_0x38844f);})['finally'](function(){delete _0x4ad6f4[_0x75c8('0x19')][_0x399b35];});}catch(_0x12ad9a){logger[_0x75c8('0x31')](_0x75c8('0x32'),_0x12ad9a[_0x75c8('0x33')]);}};Acw[_0x75c8('0x34')][_0x75c8('0x2a')]=function(_0x1e1f72){try{var _0x49317e=this;if(_0x49317e['timers'][_0x1e1f72]){_0x49317e[_0x75c8('0x9')][_0x1e1f72][_0x75c8('0x29')]=![];var _0x2e0363=_0x49317e[_0x75c8('0x9')][_0x1e1f72][_0x75c8('0x2c')];var _0x3de069=_0x49317e[_0x75c8('0x9')][_0x1e1f72][_0x75c8('0x1a')];var _0x55ab91=_0x49317e[_0x75c8('0x7')][_0x3de069][_0x75c8('0x28')];logger[_0x75c8('0x22')]('[%s][TIMER][STOP][AGENT:%s]',_0x2e0363,_0x1e1f72);RpcUser['saveUnpause'](this[_0x75c8('0x8')][_0x1e1f72]);RpcVoiceAgentReport[_0x75c8('0x35')]({'acwtime':_0x55ab91,'agentacw':!![]},_0x2e0363,_0x1e1f72)[_0x75c8('0x20')](function(_0x145af6){logger['info']('[%s][UPDATE][ACWTIME:%s]',_0x2e0363,_0x55ab91,_0x145af6);})[_0x75c8('0x30')](function(_0x1676fe){logger['error'](_0x75c8('0x36'),_0x2e0363,_0x1676fe);});}else{logger['error']('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x1e1f72);if(_0x49317e[_0x75c8('0x9')]){logger[_0x75c8('0x22')](_0x75c8('0x37'),JSON[_0x75c8('0x38')](_0x49317e['timers']));}}}catch(_0x197ca7){logger[_0x75c8('0x31')](_0x75c8('0x39'),_0x197ca7['message']);}};Acw[_0x75c8('0x34')][_0x75c8('0x3a')]=function(_0xdf11ce){try{if(this[_0x75c8('0x7')][_0xdf11ce['queue']]&&(this[_0x75c8('0x7')][_0xdf11ce[_0x75c8('0x1a')]][_0x75c8('0x5')]||this[_0x75c8('0x7')][_0xdf11ce['queue']]['mandatoryDisposition'])){if(this['agents'][_0xdf11ce['interface']]){this[_0x75c8('0x19')][_0xdf11ce[_0x75c8('0x2c')]]={'queue':_0xdf11ce['queue'],'interface':_0xdf11ce[_0x75c8('0x3b')],'destlinkedid':_0xdf11ce[_0x75c8('0x25')]};}}}catch(_0x376ca3){logger[_0x75c8('0x31')](_0x75c8('0x3c'),_0x376ca3[_0x75c8('0x33')]);}};Acw[_0x75c8('0x34')][_0x75c8('0x15')]=function(_0x4c9634){try{if(this[_0x75c8('0x7')][_0x4c9634[_0x75c8('0x1a')]]&&(this['voiceQueues'][_0x4c9634[_0x75c8('0x1a')]][_0x75c8('0x5')]||this['voiceQueues'][_0x4c9634['queue']]['mandatoryDisposition'])){if(this[_0x75c8('0x8')][_0x4c9634[_0x75c8('0x3b')]]){this[_0x75c8('0x19')][_0x4c9634[_0x75c8('0x2c')]]={'queue':_0x4c9634[_0x75c8('0x1a')],'interface':_0x4c9634[_0x75c8('0x3b')]};}}}catch(_0x24a0e3){logger[_0x75c8('0x31')](_0x75c8('0x3d'),_0x24a0e3[_0x75c8('0x33')]);}};Acw['prototype'][_0x75c8('0xc')]=function(_0xcea812){try{if(this['channels'][_0xcea812[_0x75c8('0x2c')]]&&_[_0x75c8('0x3e')](this[_0x75c8('0x19')][_0xcea812[_0x75c8('0x2c')]]['attended'])){logger[_0x75c8('0x22')](_0x75c8('0x3f'),_0xcea812[_0x75c8('0x2c')]);this[_0x75c8('0x18')](_0xcea812[_0x75c8('0x2c')]);}else if(this[_0x75c8('0x19')][_0xcea812[_0x75c8('0x40')]]&&_[_0x75c8('0x3e')](this[_0x75c8('0x19')][_0xcea812[_0x75c8('0x40')]][_0x75c8('0x24')])){logger[_0x75c8('0x22')](_0x75c8('0x41'),_0xcea812[_0x75c8('0x40')]);this[_0x75c8('0x18')](_0xcea812[_0x75c8('0x40')]);}}catch(_0x2d6a9f){logger[_0x75c8('0x31')](_0x75c8('0x42'),_0x2d6a9f[_0x75c8('0x33')]);}};Acw[_0x75c8('0x34')][_0x75c8('0xf')]=function(_0x3e9c92){try{if(this['channels'][_0x3e9c92[_0x75c8('0x2c')]]&&this['channels'][_0x3e9c92[_0x75c8('0x2c')]][_0x75c8('0x24')]){logger[_0x75c8('0x22')](_0x75c8('0x43'),_0x3e9c92[_0x75c8('0x2c')]);this['startAcw'](_0x3e9c92['uniqueid']);}else if(this[_0x75c8('0x19')][_0x3e9c92[_0x75c8('0x40')]]&&this[_0x75c8('0x19')][_0x3e9c92['linkedid']]['attended']){logger[_0x75c8('0x22')](_0x75c8('0x44'),_0x3e9c92[_0x75c8('0x40')]);this['startAcw'](_0x3e9c92[_0x75c8('0x40')]);}}catch(_0x399210){logger[_0x75c8('0x31')](_0x75c8('0x45'),_0x399210['message']);}};Acw['prototype'][_0x75c8('0x46')]=function(_0x51be18){try{if(!_[_0x75c8('0x47')](this[_0x75c8('0x19')][_0x51be18['transfereeuniqueid']])){this[_0x75c8('0x18')](_0x51be18['transfereeuniqueid']);if(this[_0x75c8('0x19')][_0x51be18[_0x75c8('0x48')]]){this['channels'][_0x51be18[_0x75c8('0x48')]]['attended']=!![];this[_0x75c8('0x19')][_0x51be18['transfertargetuniqueid']]=this[_0x75c8('0x19')][_0x51be18[_0x75c8('0x48')]];delete this[_0x75c8('0x19')][_0x51be18[_0x75c8('0x48')]];}}else if(!_['isNil'](this['channels'][_0x51be18['transfertargetuniqueid']])){this['startAcw'](_0x51be18[_0x75c8('0x49')]);if(this['channels'][_0x51be18['origtransfereruniqueid']]){this[_0x75c8('0x19')][_0x51be18[_0x75c8('0x4a')]][_0x75c8('0x24')]=!![];this[_0x75c8('0x19')][_0x51be18[_0x75c8('0x4b')]]=this[_0x75c8('0x19')][_0x51be18[_0x75c8('0x4a')]];delete this[_0x75c8('0x19')][_0x51be18[_0x75c8('0x4a')]];}}}catch(_0xab599f){logger[_0x75c8('0x31')](_0x75c8('0x4c'),_0xab599f[_0x75c8('0x33')]);}};Acw[_0x75c8('0x34')]['syncBlindTransfer']=function(_0x275500){try{if(this[_0x75c8('0x19')][_0x275500[_0x75c8('0x4d')]]){logger[_0x75c8('0x22')]('[%s][BLINDTRANSFER:UNIQUEID]',JSON['stringify'](_0x275500['transfereruniqueid']));this['startAcw'](_0x275500[_0x75c8('0x4d')]);}else if(this[_0x75c8('0x19')][_0x275500[_0x75c8('0x4e')]]){logger['info']('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0x75c8('0x38')](_0x275500['transfererlinkedid']));this[_0x75c8('0x18')](_0x275500[_0x75c8('0x4e')]);}}catch(_0x1c69f8){logger[_0x75c8('0x31')]('[ACW][syncBlindTransfer]\x20%s',_0x1c69f8[_0x75c8('0x33')]);}};Acw['prototype'][_0x75c8('0x4f')]=function(_0x1a0c5b){try{if(this[_0x75c8('0x7')][_0x1a0c5b['queue']]&&this[_0x75c8('0x7')][_0x1a0c5b[_0x75c8('0x1a')]]['autopause']===_0x75c8('0x50')){if(this['agents'][_0x1a0c5b[_0x75c8('0x3b')]]){logger[_0x75c8('0x22')]('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x1a0c5b[_0x75c8('0x2c')],_0x1a0c5b[_0x75c8('0x3b')],_0x1a0c5b[_0x75c8('0x1a')]);return RpcUser[_0x75c8('0x26')](this['agents'][_0x1a0c5b[_0x75c8('0x3b')]],'Auto-Pause',_0x1a0c5b['uniqueid']);}}}catch(_0x3145c6){logger[_0x75c8('0x31')](_0x75c8('0x51'),_0x3145c6['message']);}};module['exports']=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 1295802..288e507 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(_0x4bd611,_0x23855a){var _0x5d5606=function(_0x56b564){while(--_0x56b564){_0x4bd611['push'](_0x4bd611['shift']());}};_0x5d5606(++_0x23855a);}(_0x757a,0xde));var _0xa757=function(_0x4b7425,_0x421486){_0x4b7425=_0x4b7425-0x0;var _0x2110f4=_0x757a[_0x4b7425];return _0x2110f4;};'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 _0xbaf0=['once','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','then','actionSipShowRegistry','catch','[ami.js][fullybooted]','exports','bluebird','moment','util','lodash','../../config/logger','ami','asterisk','port','username','password','keepConnected','Action','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s'];(function(_0x157e98,_0x8b5c7e){var _0x253d7f=function(_0x84ede9){while(--_0x84ede9){_0x157e98['push'](_0x157e98['shift']());}};_0x253d7f(++_0x8b5c7e);}(_0xbaf0,0x12a));var _0x0baf=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xbaf0[_0x432682];return _0x463d05;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0x0baf('0x0'));var moment=require(_0x0baf('0x1'));var util=require(_0x0baf('0x2'));var _=require(_0x0baf('0x3'));var logger=require(_0x0baf('0x4'))(_0x0baf('0x5'));var config=require('../../config/environment');var ami=new Manager(config[_0x0baf('0x6')][_0x0baf('0x7')],config[_0x0baf('0x6')]['ip'],config[_0x0baf('0x6')][_0x0baf('0x8')],config[_0x0baf('0x6')][_0x0baf('0x9')],!![]);ami[_0x0baf('0xa')]();ami[_0x0baf('0xb')]=BPromise['promisify'](ami[_0x0baf('0xc')]);function error(_0x5f20aa){logger[_0x0baf('0xd')](util[_0x0baf('0xe')](_0x0baf('0xf'),config[_0x0baf('0x6')][_0x0baf('0x8')],config[_0x0baf('0x6')]['ip'],config[_0x0baf('0x6')][_0x0baf('0x7')],util[_0x0baf('0x10')](_0x5f20aa,![],null)));}function close(){logger[_0x0baf('0xd')](util[_0x0baf('0xe')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config['asterisk'][_0x0baf('0x8')],config[_0x0baf('0x6')]['ip'],config[_0x0baf('0x6')][_0x0baf('0x7')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0x0baf('0xb')]({'action':'sipshowregistry'});};};ami[_0x0baf('0x11')]=function(){return function(){return ami[_0x0baf('0xb')]({'action':_0x0baf('0x12')});};};ami[_0x0baf('0x13')]=function(){return function(){return ami[_0x0baf('0xb')]({'action':_0x0baf('0x14')});};};ami['actionQueueSummary']=function(){return function(){return ami['Action']({'action':_0x0baf('0x15')});};};ami[_0x0baf('0x16')]=function(){return function(){return ami[_0x0baf('0xb')]({'action':_0x0baf('0x17')});};};function connect(_0x2cf7da){logger[_0x0baf('0x18')](util['format'](_0x0baf('0x19'),config[_0x0baf('0x6')][_0x0baf('0x8')],config[_0x0baf('0x6')]['ip'],config[_0x0baf('0x6')][_0x0baf('0x7')]));ami['once']('error',error);ami[_0x0baf('0x1a')](_0x0baf('0x1b'),close);}ami['on'](_0x0baf('0x1c'),connect);ami['on'](_0x0baf('0x1d'),function(_0x1fa92b){logger[_0x0baf('0x18')](util[_0x0baf('0xe')](_0x0baf('0x1e'),config[_0x0baf('0x6')][_0x0baf('0x8')],config['asterisk']['ip'],config[_0x0baf('0x6')]['port'],util[_0x0baf('0x10')](_0x1fa92b,![],null)));});ami['on']('fullybooted',function(_0x4de74c){logger[_0x0baf('0x18')](util['format']('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0x0baf('0x6')][_0x0baf('0x8')],config[_0x0baf('0x6')]['ip'],config[_0x0baf('0x6')][_0x0baf('0x7')]));return BPromise['resolve']()[_0x0baf('0x1f')](ami[_0x0baf('0x20')]())[_0x0baf('0x1f')](ami[_0x0baf('0x11')]())[_0x0baf('0x1f')](ami[_0x0baf('0x13')]())[_0x0baf('0x1f')](ami['actionQueueSummary']())[_0x0baf('0x1f')](ami[_0x0baf('0x16')]())[_0x0baf('0x21')](function(_0x265915){logger['error'](_0x0baf('0x22'),util[_0x0baf('0x10')](_0x265915,{'showHidden':![],'depth':null}));});});ami['once'](_0x0baf('0xd'),error);ami[_0x0baf('0x1a')](_0x0baf('0x1b'),close);module[_0x0baf('0x23')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 573421d..34db0cb 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 _0xb7e7=['exports','jayson/promise','../../config/logger','client','Request','debug','rpc','error','memberReport','message','result','catch'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0xb7e7,0x121));var _0x7b7e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xb7e7[_0x4ea69d];return _0x5318e0;};'use strict';var jayson=require(_0x7b7e('0x0'));var BPromise=require('bluebird');var logger=require(_0x7b7e('0x1'))('ami');var client=jayson[_0x7b7e('0x2')]['http']({'port':0x2329});client[_0x7b7e('0x3')]=function(_0x556d68,_0x31d0ed){return new BPromise(function(_0x118577,_0x1d9384){return client['request'](_0x556d68,_0x31d0ed)['then'](function(_0x333fa4){logger[_0x7b7e('0x4')](_0x7b7e('0x5'),'memberReport',_0x556d68,_0x31d0ed,_0x333fa4);if(_0x333fa4[_0x7b7e('0x6')]){logger[_0x7b7e('0x6')](_0x7b7e('0x5'),_0x7b7e('0x7'),_0x556d68,_0x333fa4[_0x7b7e('0x6')][_0x7b7e('0x8')],_0x31d0ed);return _0x1d9384(_0x333fa4[_0x7b7e('0x6')]['message']);}else{return _0x118577(_0x333fa4[_0x7b7e('0x9')]);}})[_0x7b7e('0xa')](function(_0x10a666){logger[_0x7b7e('0x6')](_0x7b7e('0x5'),_0x7b7e('0x7'),_0x556d68,_0x10a666,_0x31d0ed);return _0x1d9384(_0x10a666);});});};module[_0x7b7e('0xb')]=client; \ No newline at end of file +var _0xe706=['result','catch','exports','jayson/promise','bluebird','../../config/logger','client','http','Request','request','then','debug','rpc','memberReport','error','message'];(function(_0x25b4a4,_0x2e081b){var _0x707267=function(_0x440123){while(--_0x440123){_0x25b4a4['push'](_0x25b4a4['shift']());}};_0x707267(++_0x2e081b);}(_0xe706,0xa3));var _0x6e70=function(_0x344eb8,_0x12a8a5){_0x344eb8=_0x344eb8-0x0;var _0x3f197c=_0xe706[_0x344eb8];return _0x3f197c;};'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 diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index 84cdbd7..f34f033 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 _0xce4d=['util','lodash','moment','isNil','string','voiceQueue','uniqueid','name','Contact','phone','firstName','lastName','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','dialCutDigit','number','substring','getQueue','exports'];(function(_0xbc722b,_0x539116){var _0x206821=function(_0x50b82d){while(--_0x50b82d){_0xbc722b['push'](_0xbc722b['shift']());}};_0x206821(++_0x539116);}(_0xce4d,0xc0));var _0xdce4=function(_0x8fcd8a,_0x6236b5){_0x8fcd8a=_0x8fcd8a-0x0;var _0x120299=_0xce4d[_0x8fcd8a];return _0x120299;};'use strict';var util=require(_0xdce4('0x0'));var _=require(_0xdce4('0x1'));var moment=require(_0xdce4('0x2'));function checkNameSurname(_0xc97e02,_0x1fb06d,_0x5cdf78){var _0x128229='';if(!_[_0xdce4('0x3')](_0x1fb06d)&&_0xdce4('0x4')===typeof _0x1fb06d){_0x128229+=_0x1fb06d;}if(!_[_0xdce4('0x3')](_0x5cdf78)&&_0xdce4('0x4')===typeof _0x5cdf78){_0x128229+='\x20'+_0x5cdf78;}if(_0x128229!==''){return _0x128229;}return _0xc97e02;}function Action(_0x334306,_0x4753ae,_0x393c2f){this[_0xdce4('0x5')]=_0x334306;this[_0xdce4('0x6')]=_0x393c2f||undefined;this[_0xdce4('0x7')]=checkNameSurname(_0x4753ae[_0xdce4('0x8')][_0xdce4('0x9')],_0x4753ae['Contact'][_0xdce4('0xa')],_0x4753ae[_0xdce4('0x8')][_0xdce4('0xb')]);this['number']=_0x4753ae[_0xdce4('0x9')];this[_0xdce4('0xc')]=_0x334306[_0xdce4('0x7')];this[_0xdce4('0xd')]=_0x4753ae[_0xdce4('0xd')]||![];this[_0xdce4('0xe')]=_0x334306['type'];this[_0xdce4('0xf')]=_0x334306[_0xdce4('0xf')]||0x3;this[_0xdce4('0x10')]=_0x4753ae[_0xdce4('0x10')];this[_0xdce4('0x11')]=_0x4753ae[_0xdce4('0x11')];this[_0xdce4('0x12')]=_0x4753ae[_0xdce4('0x12')];this[_0xdce4('0x13')]=_0x4753ae[_0xdce4('0x13')];this[_0xdce4('0x14')]=_0x4753ae[_0xdce4('0x14')];this[_0xdce4('0x15')]=_0x4753ae[_0xdce4('0x15')];this[_0xdce4('0x16')]=_0x4753ae[_0xdce4('0x16')];this[_0xdce4('0x17')]=_0x4753ae[_0xdce4('0x17')];this['countagentrejectretry']=_0x4753ae[_0xdce4('0x18')];this['ContactId']=_0x4753ae[_0xdce4('0x19')];this['ListId']=_0x4753ae[_0xdce4('0x1a')];this[_0xdce4('0x1b')]=_0x4753ae['UserId'];this[_0xdce4('0x1c')]=_0x4753ae[_0xdce4('0x1c')];this[_0xdce4('0x1d')]=_0x4753ae['CampaignId'];this[_0xdce4('0x1e')]=_0x4753ae['id'];this[_0xdce4('0x1f')]=_0x4753ae[_0xdce4('0x8')][_0xdce4('0xa')]||'';this[_0xdce4('0x20')]=moment()[_0xdce4('0x21')](_0xdce4('0x22'));this[_0xdce4('0x23')]=_0x4753ae[_0xdce4('0x23')];this[_0xdce4('0x24')]=_0x4753ae[_0xdce4('0x24')];this[_0xdce4('0x25')]=_0x4753ae[_0xdce4('0x25')];this['recallme']=_0x4753ae[_0xdce4('0x26')];this[_0xdce4('0x27')]='';this[_0xdce4('0x28')]='';}Action[_0xdce4('0x29')][_0xdce4('0x2a')]=function(){return util['format']('\x22%s\x22\x20<%s>',this['name'],this[_0xdce4('0x5')][_0xdce4('0x2b')]>0x0?this[_0xdce4('0x2c')][_0xdce4('0x2d')](this[_0xdce4('0x5')]['dialCutDigit']):this[_0xdce4('0x2c')]);};Action[_0xdce4('0x29')][_0xdce4('0x2e')]=function(){return this[_0xdce4('0xc')];};module[_0xdce4('0x2f')]=Action; \ No newline at end of file +var _0x1e30=['dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','CampaignId','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','getCaller','\x22%s\x22\x20<%s>','voiceQueue','dialCutDigit','substring','prototype','getQueue','util','lodash','moment','isNil','string','uniqueid','name','phone','Contact','firstName','lastName','number','active','type'];(function(_0x3b96cf,_0x1592f2){var _0x2e315a=function(_0x21fa50){while(--_0x21fa50){_0x3b96cf['push'](_0x3b96cf['shift']());}};_0x2e315a(++_0x1592f2);}(_0x1e30,0x152));var _0x01e3=function(_0x149882,_0x39b6be){_0x149882=_0x149882-0x0;var _0x43c6ee=_0x1e30[_0x149882];return _0x43c6ee;};'use strict';var util=require(_0x01e3('0x0'));var _=require(_0x01e3('0x1'));var moment=require(_0x01e3('0x2'));function checkNameSurname(_0x167d22,_0x5cb40e,_0x1d588b){var _0x1d863c='';if(!_[_0x01e3('0x3')](_0x5cb40e)&&_0x01e3('0x4')===typeof _0x5cb40e){_0x1d863c+=_0x5cb40e;}if(!_[_0x01e3('0x3')](_0x1d588b)&&_0x01e3('0x4')===typeof _0x1d588b){_0x1d863c+='\x20'+_0x1d588b;}if(_0x1d863c!==''){return _0x1d863c;}return _0x167d22;}function Action(_0x775bd8,_0xf900d2,_0x3153c0){this['voiceQueue']=_0x775bd8;this[_0x01e3('0x5')]=_0x3153c0||undefined;this[_0x01e3('0x6')]=checkNameSurname(_0xf900d2['Contact'][_0x01e3('0x7')],_0xf900d2[_0x01e3('0x8')][_0x01e3('0x9')],_0xf900d2[_0x01e3('0x8')][_0x01e3('0xa')]);this[_0x01e3('0xb')]=_0xf900d2[_0x01e3('0x7')];this['queue']=_0x775bd8['name'];this['active']=_0xf900d2[_0x01e3('0xc')]||![];this[_0x01e3('0xd')]=_0x775bd8[_0x01e3('0xd')];this[_0x01e3('0xe')]=_0x775bd8[_0x01e3('0xe')]||0x3;this[_0x01e3('0xf')]=_0xf900d2['scheduledat'];this[_0x01e3('0x10')]=_0xf900d2['countbusyretry'];this[_0x01e3('0x11')]=_0xf900d2[_0x01e3('0x11')];this[_0x01e3('0x12')]=_0xf900d2[_0x01e3('0x12')];this[_0x01e3('0x13')]=_0xf900d2['countnosuchnumberretry'];this['countdropretry']=_0xf900d2['countdropretry'];this['countabandonedretry']=_0xf900d2[_0x01e3('0x14')];this[_0x01e3('0x15')]=_0xf900d2[_0x01e3('0x15')];this[_0x01e3('0x16')]=_0xf900d2[_0x01e3('0x16')];this[_0x01e3('0x17')]=_0xf900d2[_0x01e3('0x17')];this[_0x01e3('0x18')]=_0xf900d2['ListId'];this[_0x01e3('0x19')]=_0xf900d2[_0x01e3('0x19')];this['VoiceQueueId']=_0xf900d2['VoiceQueueId'];this['CampaignId']=_0xf900d2[_0x01e3('0x1a')];this['idHopper']=_0xf900d2['id'];this[_0x01e3('0x1b')]=_0xf900d2[_0x01e3('0x8')][_0x01e3('0x9')]||'';this[_0x01e3('0x1c')]=moment()[_0x01e3('0x1d')](_0x01e3('0x1e'));this[_0x01e3('0x1f')]=_0xf900d2[_0x01e3('0x1f')];this[_0x01e3('0x20')]=_0xf900d2[_0x01e3('0x20')];this[_0x01e3('0x21')]=_0xf900d2['callbackat'];this[_0x01e3('0x22')]=_0xf900d2[_0x01e3('0x22')];this[_0x01e3('0x23')]='';this[_0x01e3('0x24')]='';}Action['prototype'][_0x01e3('0x25')]=function(){return util[_0x01e3('0x1d')](_0x01e3('0x26'),this[_0x01e3('0x6')],this[_0x01e3('0x27')][_0x01e3('0x28')]>0x0?this[_0x01e3('0xb')][_0x01e3('0x29')](this[_0x01e3('0x27')][_0x01e3('0x28')]):this[_0x01e3('0xb')]);};Action[_0x01e3('0x2a')][_0x01e3('0x2b')]=function(){return this['queue'];};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index 62cee7b..7c20c73 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 _0xb4bb=['format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','state','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countagentrejectretry','countabandonedretry','countmachineretry','uniqueid','calleridname','calleridnum','number','starttime','responsetime','answertime','endtime'];(function(_0x111fd0,_0x3eb372){var _0x188b02=function(_0x3bbf5a){while(--_0x3bbf5a){_0x111fd0['push'](_0x111fd0['shift']());}};_0x188b02(++_0x3eb372);}(_0xb4bb,0x1c3));var _0xbb4b=function(_0x36fab8,_0x5c78a7){_0x36fab8=_0x36fab8-0x0;var _0x8c4fa1=_0xb4bb[_0x36fab8];return _0x8c4fa1;};'use strict';var util=require(_0xbb4b('0x0'));var _=require(_0xbb4b('0x1'));var moment=require(_0xbb4b('0x2'));function getSeconds(_0x137101,_0x48a4f8){var _0x14beee=moment(_0x137101)[_0xbb4b('0x3')](0x0);var _0x324c7e=moment(_0x48a4f8)[_0xbb4b('0x3')](0x0);return _0x14beee[_0xbb4b('0x4')](_0x324c7e,_0xbb4b('0x5'));}function AgentComplete(_0x431230,_0x428f31){this[_0xbb4b('0x6')]=0x4;this['statedesc']='Answer';this['scheduledat']=_0x431230[_0xbb4b('0x7')];this[_0xbb4b('0x8')]=_0x431230['type'];this[_0xbb4b('0x9')]=_0x431230[_0xbb4b('0x8')]===_0xbb4b('0xa')?_0xbb4b('0xb'):_0x431230[_0xbb4b('0x8')];this[_0xbb4b('0xc')]=_0x431230[_0xbb4b('0xc')];this['countcongestionretry']=_0x431230[_0xbb4b('0xd')];this[_0xbb4b('0xe')]=_0x431230['countnoanswerretry'];this[_0xbb4b('0xf')]=_0x431230[_0xbb4b('0xc')]+_0x431230['countcongestionretry']+_0x431230[_0xbb4b('0xe')]+_0x431230[_0xbb4b('0x10')]+_0x431230[_0xbb4b('0x11')]+_0x431230['countabandonedretry']+_0x431230['countmachineretry']+_0x431230[_0xbb4b('0x12')];this[_0xbb4b('0x10')]=_0x431230[_0xbb4b('0x10')];this[_0xbb4b('0x11')]=_0x431230[_0xbb4b('0x11')];this[_0xbb4b('0x13')]=_0x431230[_0xbb4b('0x13')];this['countmachineretry']=_0x431230[_0xbb4b('0x14')];this[_0xbb4b('0x12')]=_0x431230[_0xbb4b('0x12')];this[_0xbb4b('0x15')]=_0x428f31[_0xbb4b('0x15')];this[_0xbb4b('0x16')]=_0x431230['name'];this[_0xbb4b('0x17')]=_0x431230[_0xbb4b('0x18')];this[_0xbb4b('0x19')]=_0x431230['starttime'];this[_0xbb4b('0x1a')]=_0x431230[_0xbb4b('0x1a')];this[_0xbb4b('0x1b')]=_0x431230[_0xbb4b('0x1b')];this[_0xbb4b('0x1c')]=moment()[_0xbb4b('0x1d')](_0xbb4b('0x1e'));this[_0xbb4b('0x1f')]=getSeconds(_0x431230[_0xbb4b('0x1a')],_0x431230['starttime']);this[_0xbb4b('0x20')]=getSeconds(_0x431230[_0xbb4b('0x1b')],_0x431230['responsetime']);this[_0xbb4b('0x21')]=getSeconds(this[_0xbb4b('0x1c')],_0x431230['answertime']);this[_0xbb4b('0xb')]=_0x428f31[_0xbb4b('0xb')];this[_0xbb4b('0x22')]=_0x428f31[_0xbb4b('0x22')];this[_0xbb4b('0x23')]=_0x428f31['reason'];this[_0xbb4b('0x24')]=_0x431230[_0xbb4b('0x24')];this[_0xbb4b('0x25')]=_0x431230[_0xbb4b('0x25')];this[_0xbb4b('0x26')]=_0x431230[_0xbb4b('0x26')];this[_0xbb4b('0x27')]=_0x431230['recallme'];this['ContactId']=_0x431230[_0xbb4b('0x28')];this[_0xbb4b('0x29')]=_0x431230[_0xbb4b('0x29')];this[_0xbb4b('0x2a')]=_0x431230[_0xbb4b('0x2a')];this[_0xbb4b('0x2b')]=_0x431230['VoiceQueueId'];this['CampaignId']=_0x431230[_0xbb4b('0x2c')];this[_0xbb4b('0x2d')]=_0x431230[_0xbb4b('0x2d')]||'';this[_0xbb4b('0x2e')]=_0x431230[_0xbb4b('0x2e')]||'';}module[_0xbb4b('0x2f')]=AgentComplete; \ No newline at end of file +var _0x2e48=['outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','uniqueid','name','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','holdtime','talktime','membername','reason','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','campaigntype'];(function(_0x3c8e9a,_0x384306){var _0x2d4c57=function(_0x43d408){while(--_0x43d408){_0x3c8e9a['push'](_0x3c8e9a['shift']());}};_0x2d4c57(++_0x384306);}(_0x2e48,0x76));var _0x82e4=function(_0xfa634c,_0x414e0e){_0xfa634c=_0xfa634c-0x0;var _0x73e478=_0x2e48[_0xfa634c];return _0x73e478;};'use strict';var util=require(_0x82e4('0x0'));var _=require(_0x82e4('0x1'));var moment=require('moment');function getSeconds(_0x427b6c,_0x2e7290){var _0x6b6c3c=moment(_0x427b6c)[_0x82e4('0x2')](0x0);var _0xf2d233=moment(_0x2e7290)[_0x82e4('0x2')](0x0);return _0x6b6c3c[_0x82e4('0x3')](_0xf2d233,_0x82e4('0x4'));}function AgentComplete(_0x4b0e90,_0x67ea58){this[_0x82e4('0x5')]=0x4;this[_0x82e4('0x6')]=_0x82e4('0x7');this[_0x82e4('0x8')]=_0x4b0e90[_0x82e4('0x8')];this[_0x82e4('0x9')]=_0x4b0e90[_0x82e4('0x9')];this[_0x82e4('0xa')]=_0x4b0e90[_0x82e4('0x9')]===_0x82e4('0xb')?_0x82e4('0xc'):_0x4b0e90[_0x82e4('0x9')];this[_0x82e4('0xd')]=_0x4b0e90['countbusyretry'];this['countcongestionretry']=_0x4b0e90[_0x82e4('0xe')];this[_0x82e4('0xf')]=_0x4b0e90[_0x82e4('0xf')];this['countglobal']=_0x4b0e90[_0x82e4('0xd')]+_0x4b0e90['countcongestionretry']+_0x4b0e90[_0x82e4('0xf')]+_0x4b0e90[_0x82e4('0x10')]+_0x4b0e90['countdropretry']+_0x4b0e90[_0x82e4('0x11')]+_0x4b0e90[_0x82e4('0x12')]+_0x4b0e90[_0x82e4('0x13')];this[_0x82e4('0x10')]=_0x4b0e90[_0x82e4('0x10')];this[_0x82e4('0x14')]=_0x4b0e90[_0x82e4('0x14')];this['countabandonedretry']=_0x4b0e90[_0x82e4('0x11')];this[_0x82e4('0x12')]=_0x4b0e90[_0x82e4('0x12')];this['countagentrejectretry']=_0x4b0e90[_0x82e4('0x13')];this[_0x82e4('0x15')]=_0x67ea58[_0x82e4('0x15')];this['calleridname']=_0x4b0e90[_0x82e4('0x16')];this['calleridnum']=_0x4b0e90['number'];this[_0x82e4('0x17')]=_0x4b0e90['starttime'];this[_0x82e4('0x18')]=_0x4b0e90[_0x82e4('0x18')];this[_0x82e4('0x19')]=_0x4b0e90[_0x82e4('0x19')];this[_0x82e4('0x1a')]=moment()[_0x82e4('0x1b')](_0x82e4('0x1c'));this['ringtime']=getSeconds(_0x4b0e90[_0x82e4('0x18')],_0x4b0e90[_0x82e4('0x17')]);this[_0x82e4('0x1d')]=getSeconds(_0x4b0e90['answertime'],_0x4b0e90[_0x82e4('0x18')]);this[_0x82e4('0x1e')]=getSeconds(this['endtime'],_0x4b0e90[_0x82e4('0x19')]);this['queue']=_0x67ea58['queue'];this[_0x82e4('0x1f')]=_0x67ea58['membername'];this[_0x82e4('0x20')]=_0x67ea58[_0x82e4('0x20')];this[_0x82e4('0x21')]=_0x4b0e90[_0x82e4('0x21')];this[_0x82e4('0x22')]=_0x4b0e90[_0x82e4('0x22')];this['callbackat']=_0x4b0e90['callbackat'];this['recallme']=_0x4b0e90[_0x82e4('0x23')];this[_0x82e4('0x24')]=_0x4b0e90[_0x82e4('0x24')];this[_0x82e4('0x25')]=_0x4b0e90[_0x82e4('0x25')];this[_0x82e4('0x26')]=_0x4b0e90[_0x82e4('0x26')];this[_0x82e4('0x27')]=_0x4b0e90[_0x82e4('0x27')];this[_0x82e4('0x28')]=_0x4b0e90['CampaignId'];this[_0x82e4('0x29')]=_0x4b0e90['originatecalleridnum']||'';this['originatecalleridname']=_0x4b0e90[_0x82e4('0x2a')]||'';}module['exports']=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index 0222cde..9d64ea2 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 _0xf767=['callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','responsetime','ringtime','holdtime','talktime'];(function(_0x3871a2,_0x501678){var _0x57669c=function(_0x32759e){while(--_0x32759e){_0x3871a2['push'](_0x3871a2['shift']());}};_0x57669c(++_0x501678);}(_0xf767,0x76));var _0x7f76=function(_0x55c485,_0x3fe77e){_0x55c485=_0x55c485-0x0;var _0x6bb521=_0xf767[_0x55c485];return _0x6bb521;};'use strict';var util=require('util');var _=require(_0x7f76('0x0'));var moment=require(_0x7f76('0x1'));function getSeconds(_0x39149,_0x23f0c3){var _0x90398d=moment(_0x39149)['milliseconds'](0x0);var _0x396137=moment(_0x23f0c3)[_0x7f76('0x2')](0x0);return _0x90398d[_0x7f76('0x3')](_0x396137,_0x7f76('0x4'));}function Final(_0x5922e5){this[_0x7f76('0x5')]=_0x5922e5[_0x7f76('0x5')];this[_0x7f76('0x6')]=_0x5922e5[_0x7f76('0x6')];this[_0x7f76('0x7')]=_0x5922e5['type'];this[_0x7f76('0x8')]=_0x5922e5[_0x7f76('0x7')]===_0x7f76('0x9')?_0x7f76('0xa'):_0x5922e5['type'];this[_0x7f76('0xb')]=_0x5922e5['countbusyretry'];this[_0x7f76('0xc')]=_0x5922e5[_0x7f76('0xc')];this[_0x7f76('0xd')]=_0x5922e5[_0x7f76('0xd')];this[_0x7f76('0xe')]=_0x5922e5[_0x7f76('0xb')]+_0x5922e5['countcongestionretry']+_0x5922e5[_0x7f76('0xd')]+_0x5922e5[_0x7f76('0xf')]+_0x5922e5[_0x7f76('0x10')]+_0x5922e5[_0x7f76('0x11')]+_0x5922e5[_0x7f76('0x12')]+_0x5922e5['countagentrejectretry'];this[_0x7f76('0xf')]=_0x5922e5['countnosuchnumberretry'];this[_0x7f76('0x10')]=_0x5922e5[_0x7f76('0x10')];this['countabandonedretry']=_0x5922e5['countabandonedretry'];this['countmachineretry']=_0x5922e5[_0x7f76('0x12')];this[_0x7f76('0x13')]=_0x5922e5[_0x7f76('0x13')];this['queue']=_0x5922e5[_0x7f76('0xa')];this['calleridname']=_0x5922e5[_0x7f76('0x14')];this[_0x7f76('0x15')]=_0x5922e5[_0x7f76('0x15')];this['starttime']=_0x5922e5['starttime'];this['responsetime']=_0x5922e5['responsetime'];this['endtime']=_0x5922e5[_0x7f76('0x16')];this[_0x7f76('0x17')]=_0x5922e5[_0x7f76('0x17')]||0x0;this[_0x7f76('0x18')]=_0x5922e5['holdtime']||0x0;this[_0x7f76('0x19')]=_0x5922e5['talktime']||0x0;this[_0x7f76('0x1a')]=_0x5922e5[_0x7f76('0x1a')];this['callbackuniqueid']=_0x5922e5['callbackuniqueid'];this[_0x7f76('0x1b')]=_0x5922e5[_0x7f76('0x1b')];this['recallme']=_0x5922e5[_0x7f76('0x1c')];this['ContactId']=_0x5922e5[_0x7f76('0x1d')];this[_0x7f76('0x1e')]=_0x5922e5[_0x7f76('0x1e')];this[_0x7f76('0x1f')]=_0x5922e5[_0x7f76('0x1f')];this['VoiceQueueId']=_0x5922e5[_0x7f76('0x20')];this['CampaignId']=_0x5922e5['CampaignId'];this[_0x7f76('0x21')]=_0x5922e5[_0x7f76('0x21')]||'';this[_0x7f76('0x22')]=_0x5922e5['originatecalleridname']||'';}module[_0x7f76('0x23')]=Final; \ No newline at end of file +var _0x950a=['type','campaigntype','outbound','queue','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countdropretry','countabandonedretry','countmachineretry','countnosuchnumberretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','seconds','uniqueid','scheduledat'];(function(_0x48ec91,_0x212edc){var _0x22766c=function(_0x136751){while(--_0x136751){_0x48ec91['push'](_0x48ec91['shift']());}};_0x22766c(++_0x212edc);}(_0x950a,0x111));var _0xa950=function(_0x4bf060,_0x2610bb){_0x4bf060=_0x4bf060-0x0;var _0x146f79=_0x950a[_0x4bf060];return _0x146f79;};'use strict';var util=require(_0xa950('0x0'));var _=require(_0xa950('0x1'));var moment=require(_0xa950('0x2'));function getSeconds(_0x13e6a3,_0x5569f7){var _0x305b26=moment(_0x13e6a3)[_0xa950('0x3')](0x0);var _0x4c027f=moment(_0x5569f7)[_0xa950('0x3')](0x0);return _0x305b26['diff'](_0x4c027f,_0xa950('0x4'));}function Final(_0x46f86d){this['uniqueid']=_0x46f86d[_0xa950('0x5')];this[_0xa950('0x6')]=_0x46f86d['scheduledat'];this['type']=_0x46f86d[_0xa950('0x7')];this[_0xa950('0x8')]=_0x46f86d[_0xa950('0x7')]===_0xa950('0x9')?_0xa950('0xa'):_0x46f86d[_0xa950('0x7')];this['countbusyretry']=_0x46f86d['countbusyretry'];this['countcongestionretry']=_0x46f86d[_0xa950('0xb')];this['countnoanswerretry']=_0x46f86d[_0xa950('0xc')];this[_0xa950('0xd')]=_0x46f86d[_0xa950('0xe')]+_0x46f86d['countcongestionretry']+_0x46f86d[_0xa950('0xc')]+_0x46f86d['countnosuchnumberretry']+_0x46f86d[_0xa950('0xf')]+_0x46f86d[_0xa950('0x10')]+_0x46f86d[_0xa950('0x11')]+_0x46f86d['countagentrejectretry'];this[_0xa950('0x12')]=_0x46f86d[_0xa950('0x12')];this[_0xa950('0xf')]=_0x46f86d['countdropretry'];this[_0xa950('0x10')]=_0x46f86d[_0xa950('0x10')];this[_0xa950('0x11')]=_0x46f86d['countmachineretry'];this[_0xa950('0x13')]=_0x46f86d[_0xa950('0x13')];this[_0xa950('0xa')]=_0x46f86d['queue'];this[_0xa950('0x14')]=_0x46f86d[_0xa950('0x14')];this[_0xa950('0x15')]=_0x46f86d[_0xa950('0x15')];this[_0xa950('0x16')]=_0x46f86d[_0xa950('0x16')];this[_0xa950('0x17')]=_0x46f86d[_0xa950('0x17')];this[_0xa950('0x18')]=_0x46f86d[_0xa950('0x17')];this[_0xa950('0x19')]=_0x46f86d[_0xa950('0x19')]||0x0;this[_0xa950('0x1a')]=_0x46f86d['holdtime']||0x0;this[_0xa950('0x1b')]=_0x46f86d[_0xa950('0x1b')]||0x0;this['callback']=_0x46f86d[_0xa950('0x1c')];this[_0xa950('0x1d')]=_0x46f86d['callbackuniqueid'];this[_0xa950('0x1e')]=_0x46f86d['callbackat'];this[_0xa950('0x1f')]=_0x46f86d[_0xa950('0x1f')];this[_0xa950('0x20')]=_0x46f86d[_0xa950('0x20')];this['ListId']=_0x46f86d[_0xa950('0x21')];this[_0xa950('0x22')]=_0x46f86d[_0xa950('0x22')];this[_0xa950('0x23')]=_0x46f86d[_0xa950('0x23')];this[_0xa950('0x24')]=_0x46f86d[_0xa950('0x24')];this[_0xa950('0x25')]=_0x46f86d[_0xa950('0x25')]||'';this[_0xa950('0x26')]=_0x46f86d[_0xa950('0x26')]||'';}module[_0xa950('0x27')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index b5e27fc..4137252 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 _0x917a=['outbound','queue','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','number','starttime','responsetime','endtime','format','ringtime','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','exports','util','moment','milliseconds','diff','state','statedesc','Answer','scheduledat','type'];(function(_0x3c1dee,_0x374a8e){var _0x2f8812=function(_0x330930){while(--_0x330930){_0x3c1dee['push'](_0x3c1dee['shift']());}};_0x2f8812(++_0x374a8e);}(_0x917a,0x108));var _0xa917=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x917a[_0x59ee6f];return _0x4c0979;};'use strict';var util=require(_0xa917('0x0'));var _=require('lodash');var moment=require(_0xa917('0x1'));function getSeconds(_0x400ca5,_0xa2f355){var _0x5bebe0=moment(_0x400ca5)[_0xa917('0x2')](0x0);var _0x573d28=moment(_0xa2f355)[_0xa917('0x2')](0x0);return _0x5bebe0[_0xa917('0x3')](_0x573d28,'seconds');}function Hangup(_0x24c1d1,_0x20a0c9){this[_0xa917('0x4')]=0x4;this[_0xa917('0x5')]=_0xa917('0x6');this[_0xa917('0x7')]=_0x24c1d1[_0xa917('0x7')];this[_0xa917('0x8')]=_0x24c1d1[_0xa917('0x8')];this['campaigntype']=_0x24c1d1[_0xa917('0x8')]===_0xa917('0x9')?_0xa917('0xa'):_0x24c1d1[_0xa917('0x8')];this['countbusyretry']=_0x24c1d1['countbusyretry'];this[_0xa917('0xb')]=_0x24c1d1[_0xa917('0xb')];this[_0xa917('0xc')]=_0x24c1d1[_0xa917('0xc')];this[_0xa917('0xd')]=_0x24c1d1['countbusyretry']+_0x24c1d1['countcongestionretry']+_0x24c1d1[_0xa917('0xc')]+_0x24c1d1[_0xa917('0xe')]+_0x24c1d1[_0xa917('0xf')]+_0x24c1d1[_0xa917('0x10')]+_0x24c1d1[_0xa917('0x11')]+_0x24c1d1['countagentrejectretry'];this[_0xa917('0xe')]=_0x24c1d1[_0xa917('0xe')];this[_0xa917('0xf')]=_0x24c1d1[_0xa917('0xf')];this[_0xa917('0x10')]=_0x24c1d1[_0xa917('0x10')];this['countmachineretry']=_0x24c1d1['countmachineretry'];this[_0xa917('0x12')]=_0x24c1d1[_0xa917('0x12')];this[_0xa917('0x13')]=_0x20a0c9['uniqueid'];this['calleridname']=_0x24c1d1['name'];this['calleridnum']=_0x24c1d1[_0xa917('0x14')];this[_0xa917('0x15')]=_0x24c1d1[_0xa917('0x15')];this['responsetime']=_0x24c1d1[_0xa917('0x16')];this[_0xa917('0x17')]=moment()[_0xa917('0x18')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xa917('0x19')]=getSeconds(_0x24c1d1[_0xa917('0x16')],_0x24c1d1['starttime']);this['holdtime']=0x0;this['talktime']=getSeconds(this['endtime'],_0x24c1d1['responsetime']);this[_0xa917('0xa')]=_0x24c1d1[_0xa917('0xa')];this[_0xa917('0x1a')]=_0xa917('0x1b');this[_0xa917('0x1c')]=_0x20a0c9[_0xa917('0x1d')];this[_0xa917('0x1e')]=_0x24c1d1[_0xa917('0x1e')];this['callbackuniqueid']=_0x24c1d1[_0xa917('0x1f')];this[_0xa917('0x20')]=_0x24c1d1[_0xa917('0x20')];this[_0xa917('0x21')]=_0x24c1d1['recallme'];this[_0xa917('0x22')]=_0x24c1d1[_0xa917('0x22')];this[_0xa917('0x23')]=_0x24c1d1[_0xa917('0x23')];this['UserId']=_0x24c1d1[_0xa917('0x24')];this[_0xa917('0x25')]=_0x24c1d1['VoiceQueueId'];this['CampaignId']=_0x24c1d1['CampaignId'];}module[_0xa917('0x26')]=Hangup; \ No newline at end of file +var _0x7dd5=['membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','moment','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','calleridnum','starttime','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime'];(function(_0x1a9e78,_0x180720){var _0x113e06=function(_0x229c64){while(--_0x229c64){_0x1a9e78['push'](_0x1a9e78['shift']());}};_0x113e06(++_0x180720);}(_0x7dd5,0x199));var _0x57dd=function(_0x5d24c7,_0x5db9c9){_0x5d24c7=_0x5d24c7-0x0;var _0x42d61e=_0x7dd5[_0x5d24c7];return _0x42d61e;};'use strict';var util=require(_0x57dd('0x0'));var _=require(_0x57dd('0x1'));var moment=require(_0x57dd('0x2'));function getSeconds(_0x1b14bb,_0x421c39){var _0x3ef0c9=moment(_0x1b14bb)['milliseconds'](0x0);var _0x2b903f=moment(_0x421c39)[_0x57dd('0x3')](0x0);return _0x3ef0c9[_0x57dd('0x4')](_0x2b903f,_0x57dd('0x5'));}function Hangup(_0x174ac8,_0x49904f){this[_0x57dd('0x6')]=0x4;this[_0x57dd('0x7')]=_0x57dd('0x8');this[_0x57dd('0x9')]=_0x174ac8[_0x57dd('0x9')];this[_0x57dd('0xa')]=_0x174ac8[_0x57dd('0xa')];this['campaigntype']=_0x174ac8[_0x57dd('0xa')]===_0x57dd('0xb')?_0x57dd('0xc'):_0x174ac8[_0x57dd('0xa')];this['countbusyretry']=_0x174ac8[_0x57dd('0xd')];this[_0x57dd('0xe')]=_0x174ac8[_0x57dd('0xe')];this['countnoanswerretry']=_0x174ac8[_0x57dd('0xf')];this['countglobal']=_0x174ac8[_0x57dd('0xd')]+_0x174ac8[_0x57dd('0xe')]+_0x174ac8[_0x57dd('0xf')]+_0x174ac8[_0x57dd('0x10')]+_0x174ac8[_0x57dd('0x11')]+_0x174ac8[_0x57dd('0x12')]+_0x174ac8[_0x57dd('0x13')]+_0x174ac8[_0x57dd('0x14')];this[_0x57dd('0x10')]=_0x174ac8['countnosuchnumberretry'];this[_0x57dd('0x11')]=_0x174ac8[_0x57dd('0x11')];this[_0x57dd('0x12')]=_0x174ac8['countabandonedretry'];this[_0x57dd('0x13')]=_0x174ac8[_0x57dd('0x13')];this[_0x57dd('0x14')]=_0x174ac8[_0x57dd('0x14')];this['uniqueid']=_0x49904f[_0x57dd('0x15')];this[_0x57dd('0x16')]=_0x174ac8['name'];this[_0x57dd('0x17')]=_0x174ac8['number'];this[_0x57dd('0x18')]=_0x174ac8[_0x57dd('0x18')];this['responsetime']=_0x174ac8[_0x57dd('0x19')];this[_0x57dd('0x1a')]=moment()['format'](_0x57dd('0x1b'));this[_0x57dd('0x1c')]=getSeconds(_0x174ac8[_0x57dd('0x19')],_0x174ac8['starttime']);this[_0x57dd('0x1d')]=0x0;this[_0x57dd('0x1e')]=getSeconds(this[_0x57dd('0x1a')],_0x174ac8[_0x57dd('0x19')]);this[_0x57dd('0xc')]=_0x174ac8[_0x57dd('0xc')];this[_0x57dd('0x1f')]=_0x57dd('0x20');this[_0x57dd('0x21')]=_0x49904f[_0x57dd('0x22')];this[_0x57dd('0x23')]=_0x174ac8[_0x57dd('0x23')];this[_0x57dd('0x24')]=_0x174ac8[_0x57dd('0x24')];this[_0x57dd('0x25')]=_0x174ac8[_0x57dd('0x25')];this['recallme']=_0x174ac8['recallme'];this['ContactId']=_0x174ac8[_0x57dd('0x26')];this['ListId']=_0x174ac8[_0x57dd('0x27')];this[_0x57dd('0x28')]=_0x174ac8['UserId'];this[_0x57dd('0x29')]=_0x174ac8[_0x57dd('0x29')];this[_0x57dd('0x2a')]=_0x174ac8[_0x57dd('0x2a')];}module[_0x57dd('0x2b')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index 1870915..84e11cc 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 _0x994d=['name','calleridnum','starttime','responsetime','endtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','queue','calleridname'];(function(_0x1a8c18,_0x4aec3c){var _0x5285c3=function(_0x3c8ce9){while(--_0x3c8ce9){_0x1a8c18['push'](_0x1a8c18['shift']());}};_0x5285c3(++_0x4aec3c);}(_0x994d,0x184));var _0xd994=function(_0x46df72,_0x10a554){_0x46df72=_0x46df72-0x0;var _0x2c6b03=_0x994d[_0x46df72];return _0x2c6b03;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0xd994('0x0'));function getSeconds(_0x1395eb,_0x1e956f){var _0x456570=moment(_0x1395eb)[_0xd994('0x1')](0x0);var _0x59e44d=moment(_0x1e956f)['milliseconds'](0x0);return _0x456570[_0xd994('0x2')](_0x59e44d,_0xd994('0x3'));}function History(_0x502ac5){this[_0xd994('0x4')]=_0x502ac5[_0xd994('0x4')];this[_0xd994('0x5')]=_0x502ac5[_0xd994('0x5')]||undefined;this[_0xd994('0x6')]=_0x502ac5['type'];this['campaigntype']=_0x502ac5[_0xd994('0x6')]===_0xd994('0x7')?'queue':_0x502ac5[_0xd994('0x6')];this[_0xd994('0x8')]=_0x502ac5[_0xd994('0x8')];this['countcongestionretry']=_0x502ac5[_0xd994('0x9')];this[_0xd994('0xa')]=_0x502ac5[_0xd994('0xa')];this[_0xd994('0xb')]=_0x502ac5[_0xd994('0x8')]+_0x502ac5[_0xd994('0x9')]+_0x502ac5[_0xd994('0xa')]+_0x502ac5[_0xd994('0xc')]+_0x502ac5[_0xd994('0xd')]+_0x502ac5[_0xd994('0xe')]+_0x502ac5[_0xd994('0xf')]+_0x502ac5[_0xd994('0x10')];this['countnosuchnumberretry']=_0x502ac5[_0xd994('0xc')];this[_0xd994('0xd')]=_0x502ac5[_0xd994('0xd')];this[_0xd994('0xe')]=_0x502ac5[_0xd994('0xe')];this[_0xd994('0xf')]=_0x502ac5[_0xd994('0xf')];this['countagentrejectretry']=_0x502ac5[_0xd994('0x10')];this['queue']=_0x502ac5[_0xd994('0x11')];this[_0xd994('0x12')]=_0x502ac5[_0xd994('0x13')];this[_0xd994('0x14')]=_0x502ac5['number'];this[_0xd994('0x15')]=_0x502ac5[_0xd994('0x15')];this[_0xd994('0x16')]=_0x502ac5[_0xd994('0x16')];this[_0xd994('0x17')]=_0x502ac5[_0xd994('0x16')];this['ringtime']=getSeconds(_0x502ac5[_0xd994('0x16')],_0x502ac5[_0xd994('0x15')]);this['holdtime']=0x0;this[_0xd994('0x18')]=0x0;this['callback']=_0x502ac5[_0xd994('0x19')];this[_0xd994('0x1a')]=_0x502ac5[_0xd994('0x1a')];this[_0xd994('0x1b')]=_0x502ac5[_0xd994('0x1b')];this[_0xd994('0x1c')]=_0x502ac5[_0xd994('0x1c')];this['ContactId']=_0x502ac5[_0xd994('0x1d')];this[_0xd994('0x1e')]=_0x502ac5['ListId'];this[_0xd994('0x1f')]=_0x502ac5[_0xd994('0x1f')];this[_0xd994('0x20')]=_0x502ac5['VoiceQueueId'];this[_0xd994('0x21')]=_0x502ac5[_0xd994('0x21')];this[_0xd994('0x22')]=_0x502ac5['originatecalleridnum']||'';this[_0xd994('0x23')]=_0x502ac5[_0xd994('0x23')]||'';}module[_0xd994('0x24')]=History; \ No newline at end of file +var _0xe0bc=['holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','calleridname','name','calleridnum','responsetime','endtime','ringtime','starttime'];(function(_0xb46f57,_0x5d240b){var _0x32f81c=function(_0x464b0f){while(--_0x464b0f){_0xb46f57['push'](_0xb46f57['shift']());}};_0x32f81c(++_0x5d240b);}(_0xe0bc,0x1b9));var _0xce0b=function(_0x211468,_0x18f18e){_0x211468=_0x211468-0x0;var _0x435c6e=_0xe0bc[_0x211468];return _0x435c6e;};'use strict';var util=require(_0xce0b('0x0'));var _=require('lodash');var moment=require(_0xce0b('0x1'));function getSeconds(_0x26a532,_0x3d206e){var _0x6141f5=moment(_0x26a532)[_0xce0b('0x2')](0x0);var _0x29e94a=moment(_0x3d206e)[_0xce0b('0x2')](0x0);return _0x6141f5[_0xce0b('0x3')](_0x29e94a,_0xce0b('0x4'));}function History(_0x38e943){this[_0xce0b('0x5')]=_0x38e943[_0xce0b('0x5')];this[_0xce0b('0x6')]=_0x38e943[_0xce0b('0x6')]||undefined;this[_0xce0b('0x7')]=_0x38e943[_0xce0b('0x7')];this[_0xce0b('0x8')]=_0x38e943[_0xce0b('0x7')]===_0xce0b('0x9')?_0xce0b('0xa'):_0x38e943[_0xce0b('0x7')];this[_0xce0b('0xb')]=_0x38e943[_0xce0b('0xb')];this[_0xce0b('0xc')]=_0x38e943[_0xce0b('0xc')];this['countnoanswerretry']=_0x38e943[_0xce0b('0xd')];this[_0xce0b('0xe')]=_0x38e943['countbusyretry']+_0x38e943[_0xce0b('0xc')]+_0x38e943['countnoanswerretry']+_0x38e943[_0xce0b('0xf')]+_0x38e943[_0xce0b('0x10')]+_0x38e943['countabandonedretry']+_0x38e943[_0xce0b('0x11')]+_0x38e943[_0xce0b('0x12')];this['countnosuchnumberretry']=_0x38e943['countnosuchnumberretry'];this[_0xce0b('0x10')]=_0x38e943[_0xce0b('0x10')];this[_0xce0b('0x13')]=_0x38e943[_0xce0b('0x13')];this[_0xce0b('0x11')]=_0x38e943['countmachineretry'];this[_0xce0b('0x12')]=_0x38e943[_0xce0b('0x12')];this[_0xce0b('0xa')]=_0x38e943[_0xce0b('0xa')];this[_0xce0b('0x14')]=_0x38e943[_0xce0b('0x15')];this[_0xce0b('0x16')]=_0x38e943['number'];this['starttime']=_0x38e943['starttime'];this[_0xce0b('0x17')]=_0x38e943[_0xce0b('0x17')];this[_0xce0b('0x18')]=_0x38e943['responsetime'];this[_0xce0b('0x19')]=getSeconds(_0x38e943[_0xce0b('0x17')],_0x38e943[_0xce0b('0x1a')]);this[_0xce0b('0x1b')]=0x0;this[_0xce0b('0x1c')]=0x0;this[_0xce0b('0x1d')]=_0x38e943[_0xce0b('0x1d')];this['callbackuniqueid']=_0x38e943[_0xce0b('0x1e')];this[_0xce0b('0x1f')]=_0x38e943[_0xce0b('0x1f')];this[_0xce0b('0x20')]=_0x38e943[_0xce0b('0x20')];this['ContactId']=_0x38e943[_0xce0b('0x21')];this['ListId']=_0x38e943['ListId'];this[_0xce0b('0x22')]=_0x38e943['UserId'];this[_0xce0b('0x23')]=_0x38e943[_0xce0b('0x23')];this[_0xce0b('0x24')]=_0x38e943['CampaignId'];this[_0xce0b('0x25')]=_0x38e943[_0xce0b('0x25')]||'';this[_0xce0b('0x26')]=_0x38e943[_0xce0b('0x26')]||'';}module['exports']=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 43f50b5..4201b52 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 _0xb10b=['[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','[syncAgentComplete][createHistory][0]','countnosuchnumberretry','countdropretry','ivrAnswerCallsDay','dialQueueProject','AnswerAGI','AGI','[syncHangupIvr][createHistory]','[syncHangupIvr]','cause-txt','Unknow','reason','dialQueueProject2','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','Drop','dropreason','TIMEOUT','agiafterat','callAdditionalPhoneAfterMin','voiceQueue','additional','dialDropMaxRetry','dialDropRetryFrequency','calleridname','[syncAgentComplete][createHistory][10]','Abandoned','countabandonedretry','dialAbandonedRetryFrequency','dialAbandonedMaxRetry','minutes','calleridnum','[syncAgentComplete][createHistory][11]','actionid','strategy','locked','paused','stateinterface','queueBooked','queueStatusComplete','[booked][unlockQueueStatus]','idHopper','[Catch][Preview][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','run','[booked][RR][finaly]','[unlock][syncQueueStatusComplete]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','resetActiveCalls','syncCampaigns','checkIsTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','checkIfTime','checkIfTimeIntervals','ifTime','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','timezones','\x20Timezone\x20unknow\x20','isArray','command','iftime\x20%s,%s','interval','content','indexOf','push','true','all','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','progressive','handlePower','dialPowerLevel','method\x20not\x20recognized','checkPreviewRecallReminder','handlePreviewRecallNotifications','user:%s','user:dialPreviewRecallReminder','launchHandleIvr','handleIvr','dialGlobalInterval','dialTimezone','[syncQueueSummary]','filter','online','map','Agent','[syncCampaigns]','\x5cw{0,','pow','replace','random','match','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialQueueTimeout','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','Contact','tags','createdAt','updatedAt','%s%s','XMD-','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','originatecalleridname','XMD-ORIGINATECALLERIDNUM','variables','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','from-sip','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','responsetime','getQueue','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','countagentrejectretry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][Drop]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','NoAnswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','dialBusyMaxRetry','reason\x205\x20busy','congestion','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','dialPredictiveOptimizationPercentage','predictiveIntervalMaxThreshold','round','check\x20predictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive]','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','started\x20in\x20predictive\x20at','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','getDataPredictive','Predictive\x20for\x20every\x20interval',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','[getDataPredictive]','check\x20failure','getDataPredictiveOld','dropRate','outboundQueuePauses','[CatchErlangB]','busyFactor','floor','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','recallme','queueStatusComplete:\x20','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','Queue:\x20','scheduledat','dialRecallMeTimeout','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','checkContactBlack','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','dialOrderByScheduledAt','[countReScheduled]\x20','Contact.phone','[actionOriginate]\x20','tryOriginatePredictive','[handlePredictive][limitChannel]','checkIsBlackList','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\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','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','exports','util','uuid','moment','md5','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','syncQueueSummary','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopperHistory','../rpc/cmHopperAdditionalPhone','../rpc/cmHopperBlack','../rpc/setting','./history','./final','./agentComplete','./queueCallerAbandon','./hangup','env','127.0.0.1','rrmemory','roundrobin','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','startPredictive','startProgressive','queueBookedRR','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','syncHangup','newexten','syncNewExten','varset','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','getSettings','previewRecallmeReminderInterval','message','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','isEmpty','[ifTime][Action]','Error','milliseconds','diff','seconds','emit','type','answered','available','loggedIn','pTalking','sumBillable','sumDuration','talking','total','unmanaged','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalAvailable','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','Trunk','active','callerid','stringify','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','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','predictiveIntervalTotalCalls','isUndefined','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','clearing\x20variable\x20start\x20predictive','handlePredictive','outbound','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','debug','error','inspect','length','[decremetOriginate]\x20object\x20originated\x20is\x20negative','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','endtime','starttime','clearZombieChannels','[uniqueid]','[actions]','undefined','isNil','Action','status','channel','catch','updateOriginated','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','resolve','then','countReScheduled','[checkIsBlackList]\x20','verifyAdditionalPhones','swapAdditionalPhones','[swapAdditionalPhone]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','pick','ContactId','ListId','UserId','VoiceQueueId','CampaignId','[emptyContact]','isSuccess','Success','isTrunkReachable','SIP/%s','reachable','unmonitored','syncVarSet','uniqueid','variable','amdstatus','exten','xcally-motion-dialer','statedesc','membername','AMD','custom:amd','buildObj','amd','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','dialAMDActive','MACHINE','outboundAnswerAgiCallsDay','Machine','countglobal','countbusyretry','countcongestionretry','countnoanswerretry','countmachineretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','add','dialMachineRetryFrequency','YYYY-MM-DD\x20HH:mm:ss','[rescheduleContact][Machine]','value','state','HangupInAMD'];(function(_0x30266e,_0x32302d){var _0x219931=function(_0x1650b0){while(--_0x1650b0){_0x30266e['push'](_0x30266e['shift']());}};_0x219931(++_0x32302d);}(_0xb10b,0x12a));var _0xbb10=function(_0x5ebe34,_0x421337){_0x5ebe34=_0x5ebe34-0x0;var _0x36a3ee=_0xb10b[_0x5ebe34];return _0x36a3ee;};'use strict';var util=require(_0xbb10('0x0'));var _=require('lodash');var uuid=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var rr=require('rr');var md5=require(_0xbb10('0x3'));var Redis=require('ioredis');var ut=require(_0xbb10('0x4'));var config=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var loggerBooked=require(_0xbb10('0x6'))(_0xbb10('0x8'));var loggerPredictive=require('../../../config/logger')(_0xbb10('0x9'));var loggerPredictiveCalls=require(_0xbb10('0x6'))('predictiveCalls');var loggerSyncQueueSummary=require(_0xbb10('0x6'))(_0xbb10('0xa'));var ami=require(_0xbb10('0xb'));config[_0xbb10('0xc')]=_[_0xbb10('0xd')](config[_0xbb10('0xc')],{'host':_0xbb10('0xe'),'port':0x18eb});var io=require(_0xbb10('0xf'))(new Redis(config['redis']));var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require(_0xbb10('0x10'));var cmHopperAdditionalPhone=require(_0xbb10('0x11'));var cmHopperBlack=require(_0xbb10('0x12'));var voiceQueueRt=require('../rpc/voiceQueueRt');var RpcSetting=require(_0xbb10('0x13'));var Action=require('./action');var History=require(_0xbb10('0x14'));var Final=require(_0xbb10('0x15'));var AgentComplete=require(_0xbb10('0x16'));var QueueCallerAbandon=require(_0xbb10('0x17'));var Hangup=require(_0xbb10('0x18'));var ipAgi=process[_0xbb10('0x19')]['XCALLY_IP_AGI']||_0xbb10('0x1a');var strategy={'rrmemory':_0xbb10('0x1b'),'roundrobin':_0xbb10('0x1c')};var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0xbb10('0x1d')][_0xbb10('0x1e')]=function(_0x2f2ebf){this[_0xbb10('0x1f')]=this[_0xbb10('0x1f')]?this[_0xbb10('0x1f')][_0xbb10('0x20')](_0x2f2ebf):_0x2f2ebf();};function Dialer(_0x4a2bfc,_0x2eca0f){this[_0xbb10('0x21')]=new Sequence();this[_0xbb10('0x22')]=_0x2eca0f;this[_0xbb10('0x23')]=_0x4a2bfc[_0xbb10('0x23')];this[_0xbb10('0x24')]=_0x4a2bfc[_0xbb10('0x24')];this[_0xbb10('0x25')]=_0x4a2bfc[_0xbb10('0x25')];this[_0xbb10('0x26')]=_0x4a2bfc['trunks'];this[_0xbb10('0x27')]=config[_0xbb10('0x27')]||0x2;this[_0xbb10('0x28')]={};this[_0xbb10('0x29')]={};this[_0xbb10('0x2a')]={};this[_0xbb10('0x2b')]={};this['optionPredictive']={};this[_0xbb10('0x2c')]={};this[_0xbb10('0x2d')]={};this['ivrOriginated']={};this['queueBooked']={};this[_0xbb10('0x2e')]={};ami['on'](_0xbb10('0x2f'),this[_0xbb10('0x30')][_0xbb10('0x31')](this));ami['on'](_0xbb10('0x32'),this[_0xbb10('0x33')][_0xbb10('0x31')](this));ami['on'](_0xbb10('0x34'),this[_0xbb10('0x35')][_0xbb10('0x31')](this));ami['on'](_0xbb10('0x36'),this[_0xbb10('0x37')]['bind'](this));ami['on']('custom:queuesummary',this['syncQueueSummary'][_0xbb10('0x31')](this));ami['on'](_0xbb10('0x38'),this[_0xbb10('0x39')]['bind'](this));ami['on'](_0xbb10('0x3a'),this[_0xbb10('0x3b')][_0xbb10('0x31')](this));ami['on'](_0xbb10('0x3c'),this[_0xbb10('0x3d')][_0xbb10('0x31')](this));ami['on'](_0xbb10('0x3e'),this['syncVarSet'][_0xbb10('0x31')](this));ami['on'](_0xbb10('0x3f'),this[_0xbb10('0x40')][_0xbb10('0x31')](this));ami['on'](_0xbb10('0x41'),this[_0xbb10('0x42')]['bind'](this));this[_0xbb10('0x43')]();this['loopClearZombieChannels']();RpcSetting[_0xbb10('0x44')]()['then'](function(_0x16ad2a){previewRecallmeReminderInterval=_0x16ad2a[_0xbb10('0x45')];});}function isNotNull(_0x1b59f9){return _0x1b59f9!==null&&!_['isUndefined'](_0x1b59f9);}function checkIsLoggedIn(_0x518d47,_0x4c3744){return function(){if(_0x4c3744<=0x0){_0x518d47[_0xbb10('0x46')]='AGENTS_NOT_LOGGED';throw _0x518d47[_0xbb10('0x47')]+_0xbb10('0x48');}};}function isActive(_0x2f653f){return _0x2f653f;}function checkIsActive(_0x1c0b57,_0x37a83f){return function(){if(!isActive(_0x37a83f)){_0x1c0b57[_0xbb10('0x46')]=_0xbb10('0x49');throw _0x1c0b57['name']+_0xbb10('0x4a');}};}function checkInterval(_0x1da9c9){return function(){if(!isNotNull(_0x1da9c9[_0xbb10('0x4b')])){_0x1da9c9[_0xbb10('0x46')]=_0xbb10('0x4c');throw _0x1da9c9[_0xbb10('0x47')]+_0xbb10('0x4d');}if(!isNotNull(_0x1da9c9[_0xbb10('0x4b')][_0xbb10('0x4e')])){_0x1da9c9['message']=_0xbb10('0x4c');throw _0x1da9c9[_0xbb10('0x47')]+_0xbb10('0x4d');}if(!isNotNull(_[_0xbb10('0x4f')](_0x1da9c9['Interval'][_0xbb10('0x4e')]))){_0x1da9c9['message']='INTERVAL_IS_NULL';throw _0x1da9c9[_0xbb10('0x47')]+_0xbb10('0x4d');}};}function msgResponse(_0x26e76a,_0x120d21,_0x15d895){return{'action':_0x26e76a,'response':_0x120d21,'message':_0x15d895,'stack':_0x15d895};}function myreject(_0x29d11a){return function(_0x547062){return _0x29d11a(msgResponse(_0xbb10('0x50'),_0xbb10('0x51'),JSON['stringify'](_0x547062)));};}function getSeconds(_0x5e3fbd,_0x5cd55f){var _0x31bee3=moment(_0x5e3fbd)[_0xbb10('0x52')](0x0);var _0x2b658a=moment(_0x5cd55f)['milliseconds'](0x0);return _0x31bee3[_0xbb10('0x53')](_0x2b658a,_0xbb10('0x54'));}function emit(_0x4345f3,_0x4d1a83,_0x17b6c5){io['to'](_0x4345f3)[_0xbb10('0x55')](_0x4d1a83,_0x17b6c5);}function emitVoiceQueueSummary(_0x1dcd38){if(_0x1dcd38[_0xbb10('0x56')]==='outbound'){var _0xd238e9={'id':_0x1dcd38['id'],'name':_0x1dcd38[_0xbb10('0x47')],'strategy':_0x1dcd38['strategy'],'answered':_0x1dcd38[_0xbb10('0x57')],'available':_0x1dcd38[_0xbb10('0x58')],'loggedIn':_0x1dcd38[_0xbb10('0x59')],'pTalking':_0x1dcd38[_0xbb10('0x5a')],'sumBillable':_0x1dcd38[_0xbb10('0x5b')],'sumDuration':_0x1dcd38[_0xbb10('0x5c')],'sumHoldTime':_0x1dcd38['sumHoldTime']||0x0,'talking':_0x1dcd38[_0xbb10('0x5d')],'total':_0x1dcd38[_0xbb10('0x5e')],'type':_0x1dcd38[_0xbb10('0x56')],'unmanaged':_0x1dcd38[_0xbb10('0x5f')],'abandoned':_0x1dcd38['abandoned'],'waiting':_0x1dcd38[_0xbb10('0x60')],'loggedInDb':_0x1dcd38[_0xbb10('0x61')],'dialActive':_0x1dcd38[_0xbb10('0x62')],'dialMethod':_0x1dcd38[_0xbb10('0x63')],'dialOriginateCallerIdName':_0x1dcd38['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x1dcd38[_0xbb10('0x64')],'dialOriginateTimeout':_0x1dcd38[_0xbb10('0x65')],'dialPrefix':_0x1dcd38['dialPrefix'],'outboundAnswerAgiCallsDay':_0x1dcd38['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x1dcd38[_0xbb10('0x66')],'outboundBlacklistCallsDay':_0x1dcd38['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x1dcd38[_0xbb10('0x67')],'outboundCongestionCallsDay':_0x1dcd38[_0xbb10('0x68')],'outboundDropCallsDayACS':_0x1dcd38['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x1dcd38[_0xbb10('0x69')],'outboundDropCallsDayTimeout':_0x1dcd38[_0xbb10('0x6a')],'outboundNoAnswerCallsDay':_0x1dcd38[_0xbb10('0x6b')],'outboundNoSuchCallsDay':_0x1dcd38['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x1dcd38[_0xbb10('0x6c')],'outboundReCallsDay':_0x1dcd38[_0xbb10('0x6d')],'outboundRejectCallsDay':_0x1dcd38[_0xbb10('0x6e')],'outboundUnknownCallsDay':_0x1dcd38[_0xbb10('0x6f')],'predictiveIntervalAnsweredCalls':_0x1dcd38[_0xbb10('0x70')],'predictiveIntervalAvgHoldtime':_0x1dcd38[_0xbb10('0x71')],'predictiveIntervalAvgTalktime':_0x1dcd38[_0xbb10('0x72')],'predictiveIntervalDroppedCallsCallersExit':_0x1dcd38[_0xbb10('0x73')],'predictiveIntervalDroppedCallsTimeout':_0x1dcd38[_0xbb10('0x74')],'predictiveIntervalErlangCalls':_0x1dcd38[_0xbb10('0x75')],'predictiveIntervalErlangCallsDroppedCalls':_0x1dcd38[_0xbb10('0x76')],'predictiveIntervalHitRate':_0x1dcd38[_0xbb10('0x77')],'predictiveIntervalMultiplicativeFactor':_0x1dcd38['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x1dcd38[_0xbb10('0x78')],'predictiveIntervalAvailable':_0x1dcd38[_0xbb10('0x79')],'predictiveIntervalTotalCalls':_0x1dcd38['predictiveIntervalTotalCalls'],'message':_0x1dcd38[_0xbb10('0x46')],'originated':_0x1dcd38[_0xbb10('0x7a')],'erlangCalls':_0x1dcd38[_0xbb10('0x7b')],'erlangCallToSecond':_0x1dcd38[_0xbb10('0x7c')],'erlangAbandonmentRate':_0x1dcd38[_0xbb10('0x7d')],'erlangBusyFactor':_0x1dcd38[_0xbb10('0x7e')],'startPredictive':_0x1dcd38[_0xbb10('0x2c')],'startProgressive':_0x1dcd38['startProgressive']};if(_0x1dcd38['Trunk']){_0xd238e9[_0xbb10('0x7f')]={'id':_0x1dcd38[_0xbb10('0x7f')]['id'],'name':_0x1dcd38[_0xbb10('0x7f')]['name'],'active':_0x1dcd38['Trunk'][_0xbb10('0x80')],'callerid':_0x1dcd38[_0xbb10('0x7f')][_0xbb10('0x81')]};}if(_0x1dcd38[_0xbb10('0x4b')]){_0xd238e9[_0xbb10('0x4b')]={'id':_0x1dcd38[_0xbb10('0x4b')]['id'],'name':_0x1dcd38[_0xbb10('0x4b')][_0xbb10('0x47')]};}var _0x2626d8=md5(JSON[_0xbb10('0x82')](_0xd238e9));if(_0x1dcd38['md5']!==_0x2626d8){_0x1dcd38['md5']=_0x2626d8;emit(util[_0xbb10('0x83')](_0xbb10('0x84'),_0xd238e9[_0xbb10('0x47')]),_0xbb10('0x85'),_0xd238e9);}}}function emitCampaignSummary(_0x36aa7d){if(_0x36aa7d[_0xbb10('0x56')]===_0xbb10('0x86')){emit(util[_0xbb10('0x83')](_0xbb10('0x87'),_0x36aa7d[_0xbb10('0x47')]),_0xbb10('0x88'),_0x36aa7d);}}function checkGetDataPredictive(_0x20e18a){if(isNotNull(_0x20e18a)&&!_[_0xbb10('0x4f')](_0x20e18a)){loggerPredictive[_0xbb10('0x89')](_0xbb10('0x8a'));loggerPredictive['info'](_0xbb10('0x8b'),_0x20e18a['predictiveIntervalTotalCalls']);loggerPredictive[_0xbb10('0x89')](_0xbb10('0x8c'),_0x20e18a[_0xbb10('0x70')]);loggerPredictive[_0xbb10('0x89')](_0xbb10('0x8d'),_0x20e18a[_0xbb10('0x74')]);loggerPredictive[_0xbb10('0x89')](_0xbb10('0x8e'),_0x20e18a[_0xbb10('0x73')]);loggerPredictive[_0xbb10('0x89')](_0xbb10('0x8f'),_0x20e18a[_0xbb10('0x71')]);loggerPredictive[_0xbb10('0x89')](_0xbb10('0x90'),_0x20e18a[_0xbb10('0x72')]);loggerPredictive['info'](_0xbb10('0x91'));if(_0x20e18a[_0xbb10('0x92')]>0x0){if(!_[_0xbb10('0x93')](_0x20e18a[_0xbb10('0x72')])&&_0x20e18a[_0xbb10('0x72')]>0x0){return!![];}loggerPredictive[_0xbb10('0x89')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_[_0xbb10('0x93')](_0x20e18a[_0xbb10('0x71')])&&_0x20e18a[_0xbb10('0x71')]>0x0){return!![];}loggerPredictive[_0xbb10('0x89')](_0xbb10('0x94'));}else{loggerPredictive[_0xbb10('0x89')](_0xbb10('0x95'));}}else{loggerPredictive[_0xbb10('0x89')](_0xbb10('0x96'));}return![];}function mergeDataErlangB(_0x40c4fb){return function(_0x2eb05a){loggerPredictive[_0xbb10('0x89')](_0xbb10('0x97'));loggerPredictive['info']('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2eb05a[_0xbb10('0x7b')]);loggerPredictive[_0xbb10('0x89')](_0xbb10('0x98'),_0x2eb05a[_0xbb10('0x7c')]);loggerPredictive['info']('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2eb05a[_0xbb10('0x7d')]);loggerPredictive[_0xbb10('0x89')](_0xbb10('0x99'),_0x2eb05a[_0xbb10('0x7e')]);loggerPredictive[_0xbb10('0x89')](_0xbb10('0x9a'),_0x2eb05a[_0xbb10('0x7d')]);loggerPredictive['info'](_0xbb10('0x91'));_[_0xbb10('0x9b')](_0x40c4fb,_0x2eb05a);};}function getDiff(_0x4917a5){var _0x5e03cb=moment()['milliseconds'](0x0);var _0x32c1e8=moment(_0x4917a5)[_0xbb10('0x52')](0x0);return _0x5e03cb[_0xbb10('0x53')](_0x32c1e8,'seconds');}function ifInterval(_0x4e6e7c,_0x5846d1){if(_[_0xbb10('0x93')](_0x5846d1)){return![];}return getDiff(_0x5846d1)<_0x4e6e7c*0x3c;}function freeVariablesPredictive(_0x249b33){if(isNotNull(_0x249b33)){if(!_[_0xbb10('0x93')](_0x249b33['startProgressive'])){_0x249b33[_0xbb10('0x2d')]=undefined;loggerPredictive[_0xbb10('0x89')](_0x249b33['name'],'clearing\x20variable\x20start\x20progressive');}if(!_[_0xbb10('0x93')](_0x249b33[_0xbb10('0x2c')])){_0x249b33[_0xbb10('0x2c')]=undefined;loggerPredictive[_0xbb10('0x89')](_0x249b33['name'],_0xbb10('0x9c'));}if(!_[_0xbb10('0x93')](_0x249b33[_0xbb10('0x9d')])){clearInterval(_0x249b33['handlePredictive']);_0x249b33[_0xbb10('0x9d')]=undefined;loggerPredictive[_0xbb10('0x89')](_0x249b33[_0xbb10('0x47')],'clearing\x20variable\x20handle\x20predictive');}}}function erlangb(_0x2ca491,_0x31e85e){if(_0x31e85e===0x0){return 0x0;}var _0x3b0f08=0x1;for(var _0x37b65f=0x1;_0x37b65f<=_0x31e85e;_0x37b65f+=0x1){_0x3b0f08=0x1+_0x3b0f08*_0x37b65f/_0x2ca491;}return 0x1/_0x3b0f08;}function isVoiceQueueOutbound(_0x5e4a6e){return _0x5e4a6e===_0xbb10('0x9e');}function isNotPreview(_0x258e55){return _0x258e55!==_0xbb10('0x22');}function isCampaignIvr(_0x2d0f4b){return _0x2d0f4b==='ivr';}function getCallerId(_0x354ea7,_0x277fe7,_0x2a166e){if(!_[_0xbb10('0x93')](_0x2a166e)&&typeof _0x2a166e===_0xbb10('0x9f')&&!_[_0xbb10('0x4f')](_0x2a166e)){if(!_[_0xbb10('0x93')](_0x277fe7)&&typeof _0x277fe7==='string'&&!_['isEmpty'](_0x277fe7)){return util['format'](_0xbb10('0xa0'),_0x277fe7,_0x2a166e);}return util[_0xbb10('0x83')](_0xbb10('0xa0'),_0x2a166e,_0x2a166e);}if(!_['isUndefined'](_0x354ea7)&&typeof _0x354ea7==='string'&&!_[_0xbb10('0x4f')](_0x354ea7)){return _0x354ea7;}return _0xbb10('0xa1');}function loggerCatchQueueSummary(_0xd9e743,_0x3a9677){return function(_0x260e06){freeVariablesPredictive(_0x3a9677);emitVoiceQueueSummary(_0x3a9677);emitCampaignSummary(_0x3a9677);loggerSyncQueueSummary[_0xbb10('0xa2')](_0xd9e743,util['inspect'](_0x260e06,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x1a5ca5,_0x15fae2){return function(_0x270fdb){loggerPredictive[_0xbb10('0xa3')](_0x15fae2[_0xbb10('0x47')],_0x1a5ca5);loggerPredictive['error'](_0x270fdb['stack']);freeVariablesPredictive(_0x15fae2);};}function loggerCatch(_0x5ad6ad){return function(_0x329da7){logger[_0xbb10('0xa3')](_0x5ad6ad,util[_0xbb10('0xa4')](_0x329da7,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x21459e){return _0x21459e&&!_[_0xbb10('0x93')](_0x21459e)&&_0x21459e[_0xbb10('0xa5')]>0x0;}function decremetOriginate(_0x5d942d){if(!_[_0xbb10('0x93')](_0x5d942d)&&_0x5d942d!==null){if(typeof _0x5d942d['originated']!=='undefined'){if(_0x5d942d['originated']>0x0){_0x5d942d[_0xbb10('0x7a')]-=0x1;}else{logger[_0xbb10('0xa3')](_0xbb10('0xa6'));}}}else{logger[_0xbb10('0xa3')]('[decremetOriginate]\x20is\x20null\x20or\x20undefined');}}function checkContactLowerLimitOriginate(_0x122d38,_0x5c583b,_0x576179){if(_0x5c583b>_0x576179){for(var _0x165fe9=0x0;_0x165fe9<_0x5c583b-_0x576179;_0x165fe9+=0x1){decremetOriginate(_0x122d38);}}}function loggerGetContactDialer(_0xfe3db0,_0x29529c,_0x2bd2ab){return function(_0xfa3c7c){checkContactLowerLimitOriginate(_0x29529c,_0x2bd2ab,0x0);logger['error'](_0xfe3db0,util[_0xbb10('0xa4')](_0xfa3c7c,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x19fcec){return function(_0x2c6429){if(isNotNull(_0x2c6429)&&isNotNull(_0x2c6429[0x0])){if(_0x2c6429[0x0][_0xbb10('0xa7')]>0x0){_0x19fcec[_0xbb10('0x46')]=_0xbb10('0xa8');logger[_0xbb10('0x89')]('[getContactDialer2][ReScheduled]'+_0x19fcec[_0xbb10('0x47')],_0x2c6429[0x0][_0xbb10('0xa7')],_0xbb10('0xa9'));}else{_0x19fcec[_0xbb10('0x46')]=_0xbb10('0xaa');logger[_0xbb10('0x89')](_0xbb10('0xab')+_0x19fcec[_0xbb10('0x47')]);}}};}function notSendMessagesQueue(_0x5a4429){if(_0x5a4429[_0xbb10('0xac')]){freeVariablesPredictive(_0x5a4429);if(_0x5a4429[_0xbb10('0x7a')]===0x0&&_0x5a4429[_0xbb10('0x5d')]===0x0&&_0x5a4429['waiting']===0x0&&(_0x5a4429['pTalking']||0x0)===0x0){_0x5a4429['sendMessageOneNotActive']=![];_0x5a4429[_0xbb10('0x58')]=0x0;_0x5a4429['message']='NOT_ACTIVE';loggerSyncQueueSummary[_0xbb10('0xa2')](_0xbb10('0xad'),_0x5a4429[_0xbb10('0x47')],_0xbb10('0xae'));}else{_0x5a4429[_0xbb10('0x46')]=_0xbb10('0xaf');loggerSyncQueueSummary[_0xbb10('0xa2')](_0xbb10('0xad'),_0x5a4429[_0xbb10('0x47')],'is\x20disactive');}emitVoiceQueueSummary(_0x5a4429);}}function notSendMessagesCampaign(_0x318a14){if(_0x318a14[_0xbb10('0xac')]){if(_0x318a14[_0xbb10('0x7a')]===0x0){_0x318a14[_0xbb10('0xac')]=![];_0x318a14['message']='NOT_ACTIVE';loggerSyncQueueSummary[_0xbb10('0xa2')](_0xbb10('0xb0'),_0x318a14[_0xbb10('0x47')],_0xbb10('0xae'));}else{_0x318a14['message']=_0xbb10('0xaf');loggerSyncQueueSummary[_0xbb10('0xa2')](_0xbb10('0xb0'),_0x318a14[_0xbb10('0x47')],_0xbb10('0xb1'));}emitCampaignSummary(_0x318a14);}}function createObjHistory(_0x517185,_0x5f0691,_0x372636,_0x53c698,_0x22c030){_0x517185['message']=_0x372636;var _0x256b35=new Action(_0x517185,_0x5f0691);var _0x13e2ab=new History(_0x256b35);_0x13e2ab['state']=_0x53c698;_0x13e2ab['statedesc']=_0x22c030;_0x13e2ab[_0xbb10('0xb2')]=_0x256b35[_0xbb10('0xb3')];return _0x13e2ab;}Dialer[_0xbb10('0x1d')]['loopClearZombieChannels']=function(){var _0x32d5a5=this;setInterval(function(){_0x32d5a5[_0xbb10('0xb4')](_0x32d5a5[_0xbb10('0x2b')],_0xbb10('0xb5'));_0x32d5a5[_0xbb10('0xb4')](_0x32d5a5[_0xbb10('0x29')],_0xbb10('0xb6'));},0x32c8);};Dialer[_0xbb10('0x1d')][_0xbb10('0xb4')]=function(_0x479d51,_0x3367d4){var _0x28cc46=this;for(var _0x412fbf in _0x479d51){if(typeof _0x479d51[_0x412fbf]!==_0xbb10('0xb7')){this[_0xbb10('0x21')][_0xbb10('0x1e')](function(){if(!_[_0xbb10('0xb8')](_0x479d51[_0x412fbf])){return ami[_0xbb10('0xb9')]({'action':_0xbb10('0xba'),'channel':_0x479d51[_0x412fbf][_0xbb10('0xbb')]})[_0xbb10('0xbc')](function(_0x2a4278){if(_0x2a4278['message']==='No\x20such\x20channel'){setTimeout(function(){if(_0x479d51[_0x412fbf]&&_0x479d51[_0x412fbf][_0xbb10('0x56')]!==_0xbb10('0x86')){_0x28cc46[_0xbb10('0xbd')](_0x28cc46[_0xbb10('0x23')][_0x479d51[_0x412fbf][_0xbb10('0xbe')]]);logger['error'](_0xbb10('0xbf'),_0x3367d4,_0x412fbf,_0x479d51[_0x412fbf][_0xbb10('0xbe')]);delete _0x479d51[_0x412fbf];}if(_0x479d51[_0x412fbf]&&_0x479d51[_0x412fbf][_0xbb10('0x56')]===_0xbb10('0x86')){_0x28cc46[_0xbb10('0xbd')](_0x28cc46[_0xbb10('0x24')][_0x479d51[_0x412fbf]['queue']]);logger[_0xbb10('0xa3')](_0xbb10('0xc0'),_0x3367d4,_0x412fbf,_0x479d51[_0x412fbf]['queue']);delete _0x479d51[_0x412fbf];}},0x2328);}});}});}}};Dialer[_0xbb10('0x1d')]['countReScheduled']=function(_0xc53c87){return Promise[_0xbb10('0xc1')]()[_0xbb10('0xc2')](cmHopper[_0xbb10('0xc3')](_0xc53c87))[_0xbb10('0xbc')](loggerCatch('[countReScheduled]\x20'));};Dialer[_0xbb10('0x1d')]['checkIsBlackList']=function(_0x3fcc55){return Promise[_0xbb10('0xc1')]()['then'](cmHopperBlack['checkIsBlackList'](_0x3fcc55))[_0xbb10('0xbc')](loggerCatch(_0xbb10('0xc4')));};Dialer[_0xbb10('0x1d')][_0xbb10('0xc5')]=function(_0x18d18d,_0x1cb22f,_0x1b6ebc){return Promise[_0xbb10('0xc1')]()[_0xbb10('0xc2')](cmHopperAdditionalPhone[_0xbb10('0xc5')](_0x18d18d,_0x1cb22f,_0x1b6ebc))[_0xbb10('0xbc')](loggerCatch('[verifyAdditionalPhone]\x20'));};Dialer[_0xbb10('0x1d')][_0xbb10('0xc6')]=function(_0x1b0a6c,_0xcd5d35,_0xfe02f5){return Promise[_0xbb10('0xc1')]()[_0xbb10('0xc2')](cmHopperAdditionalPhone[_0xbb10('0xc6')](_0x1b0a6c,_0xcd5d35,_0xfe02f5))[_0xbb10('0xbc')](loggerCatch(_0xbb10('0xc7')));};Dialer[_0xbb10('0x1d')][_0xbb10('0xc8')]=function(_0x499b9d){return Promise[_0xbb10('0xc1')]()['then'](cmHopperBlack[_0xbb10('0xc8')](_0x499b9d))[_0xbb10('0xbc')](loggerCatch(_0xbb10('0xc9')));};Dialer[_0xbb10('0x1d')][_0xbb10('0xca')]=function(_0x5371d4){return Promise[_0xbb10('0xc1')]()[_0xbb10('0xc2')](cmHopperHistory[_0xbb10('0xcb')](_0x5371d4))[_0xbb10('0xbc')](loggerCatch(_0xbb10('0xcc')));};Dialer[_0xbb10('0x1d')]['rescheduleContact']=function(_0x4bd470){return Promise[_0xbb10('0xc1')]()[_0xbb10('0xc2')](cmHopper[_0xbb10('0xcd')](_0x4bd470))['catch'](loggerCatch(_0xbb10('0xce')));};Dialer[_0xbb10('0x1d')]['unlockContact']=function(_0x2831de,_0xaede56,_0x5642c3){return Promise[_0xbb10('0xc1')]()['then'](cmHopper[_0xbb10('0xcf')](_0x2831de,_0xaede56,_0x5642c3))[_0xbb10('0xbc')](loggerCatch('[unlockContact]\x20'));};Dialer[_0xbb10('0x1d')][_0xbb10('0xd0')]=function(_0x4bac29,_0x5dae56,_0xea6bf2,_0x13ae83,_0x3e0e34){return Promise[_0xbb10('0xc1')]()[_0xbb10('0xc2')](cmHopper['getContactDialer'](_0x4bac29,_0x5dae56,_0xea6bf2,_0x13ae83))[_0xbb10('0xbc')](function(_0x9f2e0f){_0x3e0e34[_0xbb10('0xd1')]-=_0xea6bf2;_0x3e0e34['temp']=_0x3e0e34[_0xbb10('0xd1')]>0x0?_0x3e0e34[_0xbb10('0xd1')]:0x0;loggerCatch(_0xbb10('0xd2'))(_0x9f2e0f);});};Dialer[_0xbb10('0x1d')][_0xbb10('0xd3')]=function(_0xf5b08a,_0x1f55d3,_0x189f07,_0x2010d4){return Promise['resolve']()['then'](cmHopper[_0xbb10('0xd3')](_0xf5b08a,_0x1f55d3,_0x189f07))[_0xbb10('0xbc')](function(_0x293f3f){_0x2010d4[_0xbb10('0xd1')]-=_0x1f55d3;_0x2010d4[_0xbb10('0xd1')]=_0x2010d4[_0xbb10('0xd1')]>0x0?_0x2010d4[_0xbb10('0xd1')]:0x0;loggerCatch(_0xbb10('0xd4'))(_0x293f3f);});};Dialer[_0xbb10('0x1d')][_0xbb10('0xd5')]=function(_0xcbaf69){return Promise[_0xbb10('0xc1')]()[_0xbb10('0xc2')](voiceQueueRt['getVoiceQueueRtPauses'](_0xcbaf69))[_0xbb10('0xbc')](loggerCatch(_0xbb10('0xd6')));};Dialer[_0xbb10('0x1d')][_0xbb10('0xd7')]=function(_0x29eff4){return Promise[_0xbb10('0xc1')]()[_0xbb10('0xc2')](cmHopper[_0xbb10('0xd7')](_0x29eff4))[_0xbb10('0xbc')](loggerCatch(_0xbb10('0xd8')));};Dialer[_0xbb10('0x1d')]['createHistory']=function(_0x2c2ad7){return Promise['resolve']()[_0xbb10('0xc2')](cmHopperHistory[_0xbb10('0xd9')](_0x2c2ad7))[_0xbb10('0xbc')](loggerCatch(_0xbb10('0xda')));};Dialer[_0xbb10('0x1d')][_0xbb10('0xbd')]=function(_0x4e9cad){if(!_[_0xbb10('0x93')](_0x4e9cad)&&_0x4e9cad!==null){if(typeof _0x4e9cad['originated']!==_0xbb10('0xb7')){if(_0x4e9cad[_0xbb10('0x7a')]>0x0){_0x4e9cad[_0xbb10('0x7a')]-=0x1;}else{logger[_0xbb10('0xa3')](_0xbb10('0xdb'));}}}else{logger[_0xbb10('0xa3')](_0xbb10('0xdc'));}};Dialer[_0xbb10('0x1d')][_0xbb10('0xdd')]=function(_0xf4fd1,_0x13efa1){var _0xa09041=this;return function(_0x589565){_0xa09041[_0xbb10('0xbd')](_0x13efa1);logger['error'](_0xf4fd1,util[_0xbb10('0xa4')](_0x589565,{'showHidden':![],'depth':null}));};};Dialer[_0xbb10('0x1d')][_0xbb10('0xde')]=function(_0x7673a0,_0x44c229,_0x40271f){var _0x185ec9={'state':0x19,'statedesc':'notFound'};this[_0xbb10('0xbd')](_0x44c229);this['saveInDb'](_['merge'](_0x185ec9,_[_0xbb10('0xdf')](_0x40271f,[_0xbb10('0xe0'),_0xbb10('0xe1'),_0xbb10('0xe2'),_0xbb10('0xe3'),_0xbb10('0xe4')])),'[emptyContact][createHistory]',_0xbb10('0xe5'));logger[_0xbb10('0xa3')](_0x7673a0);};Dialer[_0xbb10('0x1d')][_0xbb10('0xe6')]=function(_0x136520){return _0x136520===_0xbb10('0xe7');};Dialer['prototype'][_0xbb10('0xe8')]=function(_0x4093a4){return!_[_0xbb10('0x93')](_0x4093a4)&&_0x4093a4&&!_[_0xbb10('0x93')](_0x4093a4[_0xbb10('0x47')])&&!_[_0xbb10('0x93')](_0x4093a4[_0xbb10('0x80')])&&_0x4093a4['active']&&(this[_0xbb10('0x26')][util['format'](_0xbb10('0xe9'),_0x4093a4['name'])]['status']===_0xbb10('0xea')||this[_0xbb10('0x26')][util[_0xbb10('0x83')](_0xbb10('0xe9'),_0x4093a4[_0xbb10('0x47')])]['status']===_0xbb10('0xeb'));};Dialer['prototype']['saveInDb']=function(_0x4dd138,_0xa00798,_0x207e76){this[_0xbb10('0xd9')](_0x4dd138)[_0xbb10('0xbc')](loggerCatch(_0xa00798));this[_0xbb10('0xd7')](_0x4dd138)['catch'](loggerCatch(_0x207e76));};Dialer[_0xbb10('0x1d')][_0xbb10('0xec')]=function(_0x352de4){var _0x1bd1c1=this;var _0x4b3b21=this[_0xbb10('0x2b')][_0x352de4[_0xbb10('0xed')]];var _0x485c1a;if(!_['isNil'](_0x352de4)&&!_['isNil'](_0x352de4[_0xbb10('0xee')])&&!_[_0xbb10('0xb8')](_0x352de4[_0xbb10('0xee')][_0xbb10('0xef')])&&_0x352de4[_0xbb10('0xf0')]===_0xbb10('0xf1')&&_0x4b3b21){if(_0x4b3b21[_0xbb10('0x56')]!==_0xbb10('0x86')&&this[_0xbb10('0x23')][_0x4b3b21[_0xbb10('0xbe')]]['dialAMDActive']&&_0x352de4['value']==='HANGUP'){delete this[_0xbb10('0x2b')][_0x352de4[_0xbb10('0xed')]];this[_0xbb10('0xbd')](this['voiceQueues'][_0x4b3b21[_0xbb10('0xbe')]]);this[_0xbb10('0x23')][_0x4b3b21[_0xbb10('0xbe')]][_0xbb10('0x66')]+=0x1;this[_0xbb10('0x23')][_0x4b3b21[_0xbb10('0xbe')]]['outboundAnswerAgiCallsDay']+=0x1;_0x485c1a=new Hangup(_0x4b3b21,_0x352de4);_0x485c1a['state']=0x12;_0x485c1a[_0xbb10('0xf2')]='HangupInAMD';_0x485c1a[_0xbb10('0xf3')]=_0xbb10('0xf4');ami[_0xbb10('0x55')](_0xbb10('0xf5'),ut[_0xbb10('0xf6')](_0x485c1a,_0xbb10('0xf7')));this[_0xbb10('0xf8')](_0x485c1a,_0xbb10('0xf9'),_0xbb10('0xfa'));}if(_0x4b3b21[_0xbb10('0x56')]!=='ivr'&&this[_0xbb10('0x23')][_0x4b3b21['queue']][_0xbb10('0xfb')]&&_0x352de4['value']===_0xbb10('0xfc')){return new Promise(function(_0x2cd825,_0x2adbbc){delete _0x1bd1c1[_0xbb10('0x2b')][_0x352de4['uniqueid']];_0x1bd1c1[_0xbb10('0xbd')](_0x1bd1c1['voiceQueues'][_0x4b3b21[_0xbb10('0xbe')]]);_0x1bd1c1[_0xbb10('0x23')][_0x4b3b21[_0xbb10('0xbe')]]['outboundAnswerCallsDay']+=0x1;_0x1bd1c1[_0xbb10('0x23')][_0x4b3b21[_0xbb10('0xbe')]][_0xbb10('0xfd')]+=0x1;var _0x18a44f=_0x1bd1c1[_0xbb10('0x23')][_0x4b3b21[_0xbb10('0xbe')]];var _0x56ddaa=new Hangup(_0x4b3b21,_0x352de4);_0x56ddaa['state']=0x13;_0x56ddaa['statedesc']=_0xbb10('0xfe');_0x56ddaa['membername']=_0xbb10('0xf4');_0x56ddaa['countmachineretry']+=0x1;_0x56ddaa[_0xbb10('0xff')]+=0x1;_0x56ddaa[_0xbb10('0xf7')]=!![];ami[_0xbb10('0x55')]('custom:amd',ut['buildObj'](_0x56ddaa,_0xbb10('0xf7')));_0x1bd1c1[_0xbb10('0xd9')](_0x56ddaa)[_0xbb10('0xbc')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x56ddaa[_0xbb10('0x100')]+_0x56ddaa[_0xbb10('0x101')]+_0x56ddaa[_0xbb10('0x102')]+_0x56ddaa['countnosuchnumberretry']+_0x56ddaa['countdropretry']+_0x56ddaa['countabandonedretry']+_0x56ddaa[_0xbb10('0x103')]+_0x56ddaa['countagentrejectretry']>=_0x18a44f[_0xbb10('0x104')]){_0x1bd1c1[_0xbb10('0x105')](_0x56ddaa,_0x2cd825,_0x2adbbc,_0xbb10('0x106'));}else{if(_0x56ddaa[_0xbb10('0x103')]>=_0x18a44f[_0xbb10('0x107')]){_0x1bd1c1[_0xbb10('0x108')](_0x56ddaa,_0x2cd825,_0x2adbbc,_0xbb10('0x109'));}else{_0x1bd1c1[_0xbb10('0xcd')]({'active':![],'countmachineretry':_0x56ddaa[_0xbb10('0x103')],'scheduledat':moment()[_0xbb10('0x10a')](_0x18a44f[_0xbb10('0x10b')],'minutes')[_0xbb10('0x83')](_0xbb10('0x10c')),'ContactId':_0x56ddaa['ContactId'],'ListId':_0x56ddaa[_0xbb10('0xe1')],'VoiceQueueId':_0x56ddaa['VoiceQueueId']||undefined,'CampaignId':_0x56ddaa['CampaignId']||undefined})[_0xbb10('0xbc')](loggerCatch(_0xbb10('0x10d')));_0x2cd825({'reschedule':0x1});}}});}if(_0x4b3b21[_0xbb10('0x56')]===_0xbb10('0x86')&&this[_0xbb10('0x24')][_0x4b3b21['queue']][_0xbb10('0xfb')]&&_0x352de4[_0xbb10('0x10e')]==='HANGUP'){delete this[_0xbb10('0x2b')][_0x352de4[_0xbb10('0xed')]];this['updateOriginated'](this[_0xbb10('0x24')][_0x4b3b21['queue']]);_0x485c1a=new Hangup(_0x4b3b21,_0x352de4);_0x485c1a[_0xbb10('0x10f')]=0x12;_0x485c1a[_0xbb10('0xf2')]=_0xbb10('0x110');_0x485c1a[_0xbb10('0xf3')]=_0xbb10('0xf4');ami[_0xbb10('0x55')](_0xbb10('0xf5'),ut['buildObj'](_0x485c1a,_0xbb10('0xf7')));this[_0xbb10('0xf8')](_0x485c1a,_0xbb10('0x111'),_0xbb10('0x112'));}if(_0x4b3b21[_0xbb10('0x56')]===_0xbb10('0x86')&&this['campaigns'][_0x4b3b21['queue']]['dialAMDActive']&&_0x352de4[_0xbb10('0x10e')]===_0xbb10('0xfc')){return new Promise(function(_0x3e1a86,_0x243dc0){delete _0x1bd1c1['uniqueId'][_0x352de4[_0xbb10('0xed')]];_0x1bd1c1[_0xbb10('0xbd')](_0x1bd1c1[_0xbb10('0x24')][_0x4b3b21['queue']]);_0x1bd1c1['campaigns'][_0x4b3b21[_0xbb10('0xbe')]]['outboundAnswerCallsDay']+=0x1;_0x1bd1c1[_0xbb10('0x24')][_0x4b3b21[_0xbb10('0xbe')]][_0xbb10('0xfd')]+=0x1;var _0x42276f=_0x1bd1c1[_0xbb10('0x24')][_0x4b3b21[_0xbb10('0xbe')]];var _0x1fe250=new Hangup(_0x4b3b21,_0x352de4);_0x1fe250['state']=0x13;_0x1fe250[_0xbb10('0xf2')]=_0xbb10('0xfe');_0x1fe250['membername']=_0xbb10('0xf4');_0x1fe250[_0xbb10('0x103')]+=0x1;_0x1fe250[_0xbb10('0xff')]+=0x1;_0x1fe250['amd']=!![];ami['emit']('custom:amd',ut[_0xbb10('0xf6')](_0x1fe250,_0xbb10('0xf7')));_0x1bd1c1['createHistory'](_0x1fe250)[_0xbb10('0xbc')](loggerCatch(_0xbb10('0x113')));if(_0x1fe250[_0xbb10('0x100')]+_0x1fe250[_0xbb10('0x101')]+_0x1fe250[_0xbb10('0x102')]+_0x1fe250[_0xbb10('0x114')]+_0x1fe250[_0xbb10('0x115')]+_0x1fe250['countabandonedretry']+_0x1fe250[_0xbb10('0x103')]+_0x1fe250['countagentrejectretry']>=_0x42276f['dialGlobalMaxRetry']){_0x1bd1c1['stateGlobal'](_0x1fe250,_0x3e1a86,_0x243dc0,_0xbb10('0x106'));}else{if(_0x1fe250[_0xbb10('0x103')]>=_0x42276f['dialMachineMaxRetry']){_0x1bd1c1[_0xbb10('0x108')](_0x1fe250,_0x3e1a86,_0x243dc0,'reason\x2019\x20machine....');}else{_0x1bd1c1[_0xbb10('0xcd')]({'active':![],'countmachineretry':_0x1fe250[_0xbb10('0x103')],'scheduledat':moment()[_0xbb10('0x10a')](_0x42276f['dialMachineRetryFrequency'],'minutes')[_0xbb10('0x83')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1fe250[_0xbb10('0xe0')],'ListId':_0x1fe250[_0xbb10('0xe1')],'VoiceQueueId':_0x1fe250['VoiceQueueId']||undefined,'CampaignId':_0x1fe250['CampaignId']||undefined})[_0xbb10('0xbc')](loggerCatch(_0xbb10('0x10d')));_0x3e1a86({'reschedule':0x1});}}});}}};Dialer[_0xbb10('0x1d')]['syncHangup']=function(_0x4f4aa8){var _0x426a4f=this[_0xbb10('0x2b')][_0x4f4aa8['uniqueid']];var _0x414066;if(_0x426a4f&&_0x426a4f[_0xbb10('0x56')]===_0xbb10('0x86')){delete this[_0xbb10('0x2b')][_0x4f4aa8[_0xbb10('0xed')]];this[_0xbb10('0xbd')](this[_0xbb10('0x24')][_0x426a4f[_0xbb10('0xbe')]]);this[_0xbb10('0x24')][_0x426a4f[_0xbb10('0xbe')]][_0xbb10('0x116')]+=0x1;_0x414066=new Hangup(_0x426a4f,_0x4f4aa8);this[_0xbb10('0xd9')](_0x414066)[_0xbb10('0xbc')](loggerCatch('[syncHangupIvr][createHistory]'));this['moveContactManagedDialer'](_0x414066)[_0xbb10('0xbc')](loggerCatch('[syncHangupIvr]'));}if(_0x426a4f&&_0x426a4f[_0xbb10('0x56')]!==_0xbb10('0x86')&&isNotNull(this[_0xbb10('0x23')][_0x426a4f['queue']][_0xbb10('0x117')])){delete this[_0xbb10('0x2b')][_0x4f4aa8[_0xbb10('0xed')]];this[_0xbb10('0xbd')](this[_0xbb10('0x23')][_0x426a4f['queue']]);this[_0xbb10('0x23')][_0x426a4f[_0xbb10('0xbe')]][_0xbb10('0x66')]+=0x1;this[_0xbb10('0x23')][_0x426a4f[_0xbb10('0xbe')]][_0xbb10('0xfd')]+=0x1;_0x414066=new Hangup(_0x426a4f,_0x4f4aa8);_0x414066['state']=0x10;_0x414066[_0xbb10('0xf2')]=_0xbb10('0x118');_0x414066['membername']=_0xbb10('0x119');this[_0xbb10('0xd9')](_0x414066)[_0xbb10('0xbc')](loggerCatch(_0xbb10('0x11a')));this[_0xbb10('0xd7')](_0x414066)[_0xbb10('0xbc')](loggerCatch(_0xbb10('0x11b')));}if(_0x426a4f&&_0x426a4f[_0xbb10('0x56')]!==_0xbb10('0x86')&&!isNotNull(this[_0xbb10('0x23')][_0x426a4f[_0xbb10('0xbe')]][_0xbb10('0x117')])){delete this[_0xbb10('0x2b')][_0x4f4aa8[_0xbb10('0xed')]];this[_0xbb10('0xbd')](this['voiceQueues'][_0x426a4f[_0xbb10('0xbe')]]);this[_0xbb10('0x23')][_0x426a4f['queue']]['outboundUnknownCallsDay']+=0x1;_0x414066=new Hangup(_0x426a4f,_0x4f4aa8);_0x414066[_0xbb10('0x10f')]=0xc;_0x414066[_0xbb10('0xf2')]=_0x4f4aa8[_0xbb10('0x11c')];_0x414066[_0xbb10('0xf3')]=_0xbb10('0x11d');this[_0xbb10('0xd9')](_0x414066)[_0xbb10('0xbc')](loggerCatch(_0xbb10('0x11a')));this[_0xbb10('0xd7')](_0x414066)['catch'](loggerCatch('[syncHangupIvr]'));}};Dialer['prototype']['syncAgentComplete']=function(_0x4f147c){var _0x5d42b1=this[_0xbb10('0x2b')][_0x4f147c[_0xbb10('0xed')]];if(this[_0xbb10('0x23')][_0x4f147c[_0xbb10('0xbe')]]){if(_0x5d42b1&&_0x5d42b1['type']!==_0xbb10('0x86')){delete this[_0xbb10('0x2b')][_0x4f147c[_0xbb10('0xed')]];this[_0xbb10('0x23')][_0x4f147c['queue']]['outboundAnswerCallsDay']+=0x1;var _0x3057b4=new AgentComplete(_0x5d42b1,_0x4f147c);if(_0x4f147c[_0xbb10('0x11e')]==='agent'){_0x3057b4['agiafterat']=this[_0xbb10('0x23')][_0x4f147c[_0xbb10('0xbe')]][_0xbb10('0x11f')]&&this[_0xbb10('0x23')][_0x4f147c[_0xbb10('0xbe')]]['dialAgiAfterHangupAgent']?moment()[_0xbb10('0x83')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}this['createHistory'](_0x3057b4)[_0xbb10('0xbc')](loggerCatch(_0xbb10('0x120')));this[_0xbb10('0xd7')](_0x3057b4)[_0xbb10('0xbc')](loggerCatch(_0xbb10('0x121')));}}};Dialer[_0xbb10('0x1d')]['syncAgentConnect']=function(_0x9c1581){if(this[_0xbb10('0x23')][_0x9c1581[_0xbb10('0xbe')]]){if(this[_0xbb10('0x2b')][_0x9c1581[_0xbb10('0xed')]]&&this[_0xbb10('0x2b')][_0x9c1581[_0xbb10('0xed')]][_0xbb10('0x56')]!==_0xbb10('0x86')){this[_0xbb10('0xbd')](this[_0xbb10('0x23')][_0x9c1581[_0xbb10('0xbe')]]);this[_0xbb10('0x2b')][_0x9c1581[_0xbb10('0xed')]][_0xbb10('0x122')]=moment()[_0xbb10('0x83')](_0xbb10('0x10c'));}}};Dialer[_0xbb10('0x1d')][_0xbb10('0x123')]=function(_0x43a203,_0x1ca43e){this[_0xbb10('0xd9')](_0x43a203)['catch'](loggerCatch(_0xbb10('0x120')));if(_0x1ca43e==0x0){this['moveContactManagedDialer'](_0x43a203)[_0xbb10('0xbc')](loggerCatch(_0xbb10('0x124')));}};Dialer[_0xbb10('0x1d')][_0xbb10('0x33')]=function(_0x40bbf1){var _0x4f5689=this['uniqueId'][_0x40bbf1['uniqueid']];var _0x36be49=this;var _0x2fac6c=![];var _0x482f7d;var _0x31b7f9;if(this[_0xbb10('0x23')][_0x40bbf1[_0xbb10('0xbe')]]){if(_0x4f5689&&_0x4f5689['type']!==_0xbb10('0x86')){delete this[_0xbb10('0x2b')][_0x40bbf1[_0xbb10('0xed')]];this['updateOriginated'](this[_0xbb10('0x23')][_0x40bbf1['queue']]);_0x4f5689[_0xbb10('0x125')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x559e46=new QueueCallerAbandon(_0x4f5689,_0x40bbf1);if(getSeconds(_0x4f5689['droptime'],_0x4f5689['responsetime'])>=_0x4f5689['dialQueueTimeout']){this[_0xbb10('0x23')][_0x40bbf1[_0xbb10('0xbe')]][_0xbb10('0x74')]+=0x1;this[_0xbb10('0x23')][_0x40bbf1['queue']][_0xbb10('0x6a')]+=0x1;this[_0xbb10('0x23')][_0x40bbf1[_0xbb10('0xbe')]][_0xbb10('0x76')]+=0x1;_0x559e46[_0xbb10('0x10f')]=0xa;_0x559e46[_0xbb10('0xf2')]=_0xbb10('0x126');_0x559e46[_0xbb10('0x127')]=_0xbb10('0x128');_0x559e46[_0xbb10('0x129')]=this['voiceQueues'][_0x40bbf1[_0xbb10('0xbe')]][_0xbb10('0x11f')]?moment()[_0xbb10('0x83')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x559e46[_0xbb10('0x115')]+=0x1;_0x559e46[_0xbb10('0xff')]+=0x1;_0x482f7d=this[_0xbb10('0x23')][_0x40bbf1[_0xbb10('0xbe')]]['dialDropRetryFrequency'];_0x31b7f9=this[_0xbb10('0x23')][_0x40bbf1[_0xbb10('0xbe')]][_0xbb10('0x12a')];_0x36be49[_0xbb10('0xc5')](_0x559e46,_0x559e46[_0xbb10('0x10f')],_0x4f5689[_0xbb10('0x12b')])[_0xbb10('0xc2')](function(_0x1c0529){_0x2fac6c=_0x1c0529[_0xbb10('0x12c')]==0x1;if(_0x559e46[_0xbb10('0x115')]>=_0x36be49[_0xbb10('0x23')][_0x40bbf1['queue']][_0xbb10('0x12d')]){_0x36be49[_0xbb10('0x123')](_0x559e46,_0x1c0529['additional']);}else{_0x36be49['rescheduleContact']({'active':![],'countdropretry':_0x559e46[_0xbb10('0x115')],'scheduledat':moment()[_0xbb10('0x10a')](_0x36be49['voiceQueues'][_0x40bbf1[_0xbb10('0xbe')]][_0xbb10('0x12e')],'minutes')[_0xbb10('0x83')](_0xbb10('0x10c')),'ContactId':_0x4f5689[_0xbb10('0xe0')],'ListId':_0x4f5689[_0xbb10('0xe1')],'VoiceQueueId':_0x4f5689[_0xbb10('0xe3')]||undefined,'CampaignId':_0x4f5689['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact][Drop]'));var _0xaeaa51=new History(_0x559e46);_0xaeaa51['state']=0xa;_0xaeaa51[_0xbb10('0xf2')]='Drop';_0xaeaa51['starttime']=moment()[_0xbb10('0x83')](_0xbb10('0x10c'));_0xaeaa51[_0xbb10('0xb2')]=_0xaeaa51[_0xbb10('0xb3')];_0xaeaa51[_0xbb10('0x12f')]=_0x559e46[_0xbb10('0x12f')];_0xaeaa51['calleridnum']=_0x559e46['calleridnum'];_0x36be49['createHistory'](_0xaeaa51)[_0xbb10('0xbc')](loggerCatch(_0xbb10('0x130')));}})[_0xbb10('0xc2')](function(){if(_0x2fac6c)_0x36be49[_0xbb10('0xc6')](_0x559e46,_0x482f7d,_0x31b7f9)[_0xbb10('0xc2')](function(){return 0x1;});});}else{this[_0xbb10('0x23')][_0x40bbf1[_0xbb10('0xbe')]]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this[_0xbb10('0x23')][_0x40bbf1[_0xbb10('0xbe')]][_0xbb10('0x69')]+=0x1;_0x559e46[_0xbb10('0x10f')]=0xb;_0x559e46['statedesc']=_0xbb10('0x131');_0x559e46['dropreason']='CALLEREXIT';_0x559e46[_0xbb10('0x132')]+=0x1;_0x559e46[_0xbb10('0xff')]+=0x1;_0x482f7d=this[_0xbb10('0x23')][_0x40bbf1[_0xbb10('0xbe')]][_0xbb10('0x133')];_0x31b7f9=this[_0xbb10('0x23')][_0x40bbf1['queue']][_0xbb10('0x12a')];_0x36be49[_0xbb10('0xc5')](_0x559e46,_0x559e46[_0xbb10('0x10f')],_0x4f5689[_0xbb10('0x12b')])[_0xbb10('0xc2')](function(_0x527d8d){if(_0x559e46[_0xbb10('0x132')]>=_0x36be49['voiceQueues'][_0x40bbf1[_0xbb10('0xbe')]][_0xbb10('0x134')]){_0x36be49[_0xbb10('0x123')](_0x559e46,_0x527d8d['additional']);}else{_0x36be49['rescheduleContact']({'active':![],'countabandonedretry':_0x559e46[_0xbb10('0x132')],'scheduledat':moment()[_0xbb10('0x10a')](_0x36be49[_0xbb10('0x23')][_0x40bbf1[_0xbb10('0xbe')]][_0xbb10('0x133')],_0xbb10('0x135'))[_0xbb10('0x83')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4f5689[_0xbb10('0xe0')],'ListId':_0x4f5689[_0xbb10('0xe1')],'VoiceQueueId':_0x4f5689[_0xbb10('0xe3')]||undefined,'CampaignId':_0x4f5689['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact][Abandoned]'));var _0x4a01cd=new History(_0x559e46);_0x4a01cd[_0xbb10('0x10f')]=0xb;_0x4a01cd[_0xbb10('0xf2')]=_0xbb10('0x131');_0x4a01cd[_0xbb10('0xb3')]=moment()['format'](_0xbb10('0x10c'));_0x4a01cd['endtime']=_0x4a01cd[_0xbb10('0xb3')];_0x4a01cd[_0xbb10('0x12f')]=_0x559e46[_0xbb10('0x12f')];_0x4a01cd[_0xbb10('0x136')]=_0x559e46[_0xbb10('0x136')];_0x36be49[_0xbb10('0xd9')](_0x4a01cd)[_0xbb10('0xbc')](loggerCatch(_0xbb10('0x137')));}})[_0xbb10('0xc2')](function(){if(_0x2fac6c)_0x36be49[_0xbb10('0xc6')](_0x559e46,_0x482f7d,_0x31b7f9)[_0xbb10('0xc2')](function(){return 0x1;});});}}}};Dialer[_0xbb10('0x1d')]['syncNewExten']=function(_0x1bd6db){if(this[_0xbb10('0x29')][_0x1bd6db[_0xbb10('0xed')]]){this['actions'][_0x1bd6db[_0xbb10('0xed')]]['channel']=_0x1bd6db[_0xbb10('0xbb')];}if(this[_0xbb10('0x2b')][_0x1bd6db[_0xbb10('0xed')]]){this[_0xbb10('0x2b')][_0x1bd6db[_0xbb10('0xed')]]['channel']=_0x1bd6db['channel'];}};Dialer[_0xbb10('0x1d')]['syncQueueMember']=function(_0x553bb8){if(strategy[this[_0xbb10('0x23')][this['actions'][_0x553bb8[_0xbb10('0x138')]][_0xbb10('0xbe')]][_0xbb10('0x139')]]===_0xbb10('0x1c')){if(this[_0xbb10('0x29')][_0x553bb8[_0xbb10('0x138')]]&&_[_0xbb10('0xb8')](this[_0xbb10('0x29')][_0x553bb8['actionid']][_0xbb10('0x13a')])&&_0x553bb8['status']==='1'&&_0x553bb8[_0xbb10('0x13b')]==='0'){if(this['agents'][_0x553bb8[_0xbb10('0x13c')]]){if(!this[_0xbb10('0x25')][_0x553bb8['stateinterface']][_0xbb10('0x13a')]){this[_0xbb10('0x25')][_0x553bb8[_0xbb10('0x13c')]]['locked']=!![];this[_0xbb10('0x29')][_0x553bb8[_0xbb10('0x138')]][_0xbb10('0x13a')]=!![];this['actions'][_0x553bb8[_0xbb10('0x138')]][_0xbb10('0x13c')]=_0x553bb8[_0xbb10('0x13c')];}}}}else if((strategy[this['voiceQueues'][this[_0xbb10('0x29')][_0x553bb8['actionid']][_0xbb10('0xbe')]][_0xbb10('0x139')]]||_0xbb10('0x1b'))===_0xbb10('0x1b')){if(this[_0xbb10('0x29')][_0x553bb8[_0xbb10('0x138')]]){if(this[_0xbb10('0x25')][_0x553bb8[_0xbb10('0x13c')]]){this[_0xbb10('0x29')][_0x553bb8[_0xbb10('0x138')]]['stateinterface']=_0x553bb8['stateinterface'];if(_[_0xbb10('0xb8')](this[_0xbb10('0x13d')][this[_0xbb10('0x29')][_0x553bb8['actionid']][_0xbb10('0xbe')]])){this[_0xbb10('0x13d')][this[_0xbb10('0x29')][_0x553bb8[_0xbb10('0x138')]][_0xbb10('0xbe')]]=[];}this[_0xbb10('0x13d')][this[_0xbb10('0x29')][_0x553bb8[_0xbb10('0x138')]][_0xbb10('0xbe')]]['push'](_[_0xbb10('0x9b')](_[_0xbb10('0xdf')](this[_0xbb10('0x29')][_0x553bb8[_0xbb10('0x138')]],['idHopper',_0xbb10('0x13c')]),{'status':_0x553bb8[_0xbb10('0xba')],'paused':_0x553bb8[_0xbb10('0x13b')]}));}}}};function unlockQueueStatus(_0x59fef2,_0x59f9b2){setTimeout(function(){if(_[_0xbb10('0x93')](_0x59fef2['queueStatusComplete'])){loggerBooked[_0xbb10('0xa3')]('[unlockQueueStatus][undefined]',_0x59f9b2);}_0x59fef2[_0xbb10('0x13e')]=!![];loggerBooked[_0xbb10('0x89')](_0xbb10('0x13f'),_0x59f9b2,JSON[_0xbb10('0x82')](_[_0xbb10('0xdf')](_0x59fef2,[_0xbb10('0x47'),_0xbb10('0x13e')])));},0x1f3);}Dialer['prototype'][_0xbb10('0x42')]=function(_0x439d9a){var _0x28271e=this;var _0x2807d2=_0x28271e[_0xbb10('0x23')][_0x28271e[_0xbb10('0x29')][_0x439d9a['actionid']][_0xbb10('0xbe')]];if(strategy[this[_0xbb10('0x23')][this[_0xbb10('0x29')][_0x439d9a[_0xbb10('0x138')]][_0xbb10('0xbe')]][_0xbb10('0x139')]]===_0xbb10('0x1c')){if(this['actions'][_0x439d9a[_0xbb10('0x138')]]&&this[_0xbb10('0x29')][_0x439d9a[_0xbb10('0x138')]]['stateinterface']){this[_0xbb10('0x22')]['run'](this[_0xbb10('0x29')][_0x439d9a[_0xbb10('0x138')]][_0xbb10('0x140')],this['actions'][_0x439d9a['actionid']][_0xbb10('0x13c')])[_0xbb10('0xbc')](function(_0xbb410e){logger[_0xbb10('0xa3')](_0xbb10('0x141'),util[_0xbb10('0xa4')](_0xbb410e,{'showHidden':![],'depth':null}));})[_0xbb10('0x20')](function(){_0x28271e[_0xbb10('0xbd')](_0x28271e[_0xbb10('0x23')][_0x28271e[_0xbb10('0x29')][_0x439d9a[_0xbb10('0x138')]]['queue']]);_0x28271e['agents'][_0x28271e[_0xbb10('0x29')][_0x439d9a[_0xbb10('0x138')]]['stateinterface']]['locked']=![];delete _0x28271e[_0xbb10('0x29')][_0x439d9a[_0xbb10('0x138')]];unlockQueueStatus(_0x2807d2);});}else{this[_0xbb10('0xbd')](this['voiceQueues'][this[_0xbb10('0x29')][_0x439d9a[_0xbb10('0x138')]]['queue']]);this[_0xbb10('0xcd')]({'active':![],'ContactId':this[_0xbb10('0x29')][_0x439d9a['actionid']]['ContactId'],'ListId':this[_0xbb10('0x29')][_0x439d9a[_0xbb10('0x138')]][_0xbb10('0xe1')],'VoiceQueueId':this['actions'][_0x439d9a['actionid']][_0xbb10('0xe3')]||undefined,'CampaignId':this[_0xbb10('0x29')][_0x439d9a['actionid']][_0xbb10('0xe4')]||undefined})[_0xbb10('0xbc')](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0xbb10('0x29')][_0x439d9a[_0xbb10('0x138')]];unlockQueueStatus(_0x2807d2);}}else if((strategy[this[_0xbb10('0x23')][this[_0xbb10('0x29')][_0x439d9a['actionid']][_0xbb10('0xbe')]]['strategy']]||_0xbb10('0x1b'))===_0xbb10('0x1b')){var _0x2aaf70;if(this[_0xbb10('0x29')][_0x439d9a[_0xbb10('0x138')]]&&!_[_0xbb10('0x4f')](this[_0xbb10('0x13d')][this[_0xbb10('0x29')][_0x439d9a['actionid']][_0xbb10('0xbe')]])){if(this[_0xbb10('0x2e')][_0x28271e[_0xbb10('0x29')][_0x439d9a[_0xbb10('0x138')]]['queue']]){this['queueBookedRR'][_0x28271e[_0xbb10('0x29')][_0x439d9a[_0xbb10('0x138')]][_0xbb10('0xbe')]]=this[_0xbb10('0x2e')][this['actions'][_0x439d9a[_0xbb10('0x138')]][_0xbb10('0xbe')]]?this['queueBookedRR'][this[_0xbb10('0x29')][_0x439d9a['actionid']]['queue']]:this[_0xbb10('0x13d')][this[_0xbb10('0x29')][_0x439d9a[_0xbb10('0x138')]][_0xbb10('0xbe')]]?this[_0xbb10('0x13d')][this['actions'][_0x439d9a[_0xbb10('0x138')]][_0xbb10('0xbe')]][_0xbb10('0x142')]||0x0:0x0;}this[_0xbb10('0x13d')][this[_0xbb10('0x29')][_0x439d9a[_0xbb10('0x138')]][_0xbb10('0xbe')]][_0xbb10('0x142')]=this[_0xbb10('0x2e')][this[_0xbb10('0x29')][_0x439d9a[_0xbb10('0x138')]][_0xbb10('0xbe')]];for(var _0x74ca46=0x0;_0x74ca46=0x0;})['catch'](myreject(_0x4aa311)));}}else{_0x7e9e52[_0xbb10('0x162')](ami['Action']({'action':'command','command':util['format']('iftime\x20%s,%s',_0x3d2e5f,!_[_0xbb10('0x93')](config[_0xbb10('0x15a')][_0x33a92a])?_0x33a92a:'')})[_0xbb10('0xc2')](function(_0x1f0938){return _0x1f0938[_0xbb10('0x160')]['indexOf'](_0xbb10('0x163'))>=0x0;})[_0xbb10('0xbc')](myreject(_0x4aa311)));}Promise[_0xbb10('0x164')](_0x7e9e52)['then'](function(_0x11a61a){var _0x188766=_[_0xbb10('0x165')](_0x11a61a);if(_0x188766){return _0x1b3783(_0x188766);}else{_0x4fa8a2[_0xbb10('0x46')]=_0x4688f8?_0xbb10('0x166'):_0xbb10('0x167');return _0x4aa311(msgResponse(_0xbb10('0x168'),_0xbb10('0x156'),_0xbb10('0x169')+_0x4688f8+'\x20'+_0x374e5d+_0xbb10('0x16a')+util[_0xbb10('0xa4')](_0x3d2e5f,{'showHidden':![],'depth':null})+_0xbb10('0x16b')+_0x33a92a));}})[_0xbb10('0xbc')](function(_0x2dc633){return _0x4aa311(msgResponse(_0xbb10('0x155'),'Failure',JSON['stringify'](_0x2dc633)));});});};Dialer['prototype'][_0xbb10('0x16c')]=function(_0x58fbef){var _0x1ae32c=this;return function(){switch(_0x58fbef['dialMethod']){case _0xbb10('0x16d'):freeVariablesPredictive(_0x58fbef);_0x1ae32c['handlePower'](_0x58fbef,0x1);break;case'power':freeVariablesPredictive(_0x58fbef);_0x1ae32c[_0xbb10('0x16e')](_0x58fbef,_0x58fbef[_0xbb10('0x16f')]);break;case'predictive':_0x1ae32c[_0xbb10('0x9')](_0x58fbef);break;case _0xbb10('0x8'):freeVariablesPredictive(_0x58fbef);_0x1ae32c[_0xbb10('0x16e')](_0x58fbef,0x1);break;default:freeVariablesPredictive(_0x58fbef);logger[_0xbb10('0xa3')]('Queue',_0x58fbef['name'],_0xbb10('0x170'));}};};Dialer[_0xbb10('0x1d')][_0xbb10('0x171')]=function(_0x53f3c2){return Promise[_0xbb10('0xc1')]()[_0xbb10('0xc2')](cmHopper[_0xbb10('0x172')](_0x53f3c2['id'],previewRecallmeReminderInterval))['then'](function(_0x5414f9){for(var _0x51cdbd=0x0;_0x51cdbd<_0x5414f9['length'];_0x51cdbd++){var _0xd11ff7=_0x5414f9[_0x51cdbd]['Agent'][_0xbb10('0x47')];if(_0xd11ff7)io['to'](util[_0xbb10('0x83')](_0xbb10('0x173'),_0xd11ff7))[_0xbb10('0x55')](_0xbb10('0x174'),{'hopper':_0x5414f9[_0x51cdbd]});}})['catch'](function(){});};Dialer[_0xbb10('0x1d')][_0xbb10('0x175')]=function(_0xf6f7ed){var _0x2701e8=this;return function(){_0x2701e8[_0xbb10('0x176')](_0xf6f7ed);};};Dialer[_0xbb10('0x1d')]['syncQueueSummary']=function(_0x568fb9){var _0x1e394c=this;if(isNotPreview(_0x568fb9[_0xbb10('0x63')])){if(isVoiceQueueOutbound(_0x568fb9[_0xbb10('0x56')])&&isActive(_0x568fb9[_0xbb10('0x62')])){_0x568fb9[_0xbb10('0xac')]=!![];Promise['resolve']()['then'](checkIsLoggedIn(_0x568fb9,_0x568fb9[_0xbb10('0x59')]))[_0xbb10('0xc2')](checkIsActive(_0x568fb9,_0x568fb9['dialActive']))['then'](checkInterval(_0x568fb9))[_0xbb10('0xc2')](_0x1e394c[_0xbb10('0x150')](_0x568fb9))[_0xbb10('0xc2')](_0x1e394c[_0xbb10('0x153')](_0x568fb9[_0xbb10('0x177')],_0x568fb9[_0xbb10('0x178')],_0x568fb9['name'],_0x568fb9))[_0xbb10('0xc2')](_0x1e394c[_0xbb10('0x154')](_0x568fb9[_0xbb10('0x4b')],_0x568fb9[_0xbb10('0x178')],_0x568fb9[_0xbb10('0x47')],_0x568fb9))[_0xbb10('0xc2')](_0x1e394c[_0xbb10('0x16c')](_0x568fb9))[_0xbb10('0xbc')](loggerCatchQueueSummary(_0xbb10('0x179'),_0x568fb9));}else{notSendMessagesQueue(_0x568fb9);}}else{freeVariablesPredictive(_0x568fb9);}};Dialer['prototype']['syncQueueSummaryComplete']=_['throttle'](function(){var _0x111c15=_[_0xbb10('0x17a')](this[_0xbb10('0x23')],function(_0x270853){return _0x270853['dialPreviewRecallmeReminder'];});var _0x548c7d=_['filter'](this[_0xbb10('0x25')],function(_0x43440f){return _0x43440f[_0xbb10('0x17b')]&&_0x43440f[_0xbb10('0xba')]===_0xbb10('0xea');});if(_0x111c15[_0xbb10('0xa5')]>0x0&&_0x548c7d[_0xbb10('0xa5')]>0x0){return Promise[_0xbb10('0xc1')]()[_0xbb10('0xc2')](cmHopper[_0xbb10('0x172')](_[_0xbb10('0x17c')](_0x111c15,'id'),previewRecallmeReminderInterval,_[_0xbb10('0x17c')](_0x548c7d,'id')))[_0xbb10('0xc2')](function(_0x21905e){for(var _0x5f074d=0x0;_0x5f074d<_0x21905e[_0xbb10('0xa5')];_0x5f074d++){var _0x139eac=_0x21905e[_0x5f074d][_0xbb10('0x17d')][_0xbb10('0x47')];if(_0x139eac)io['to'](util[_0xbb10('0x83')](_0xbb10('0x173'),_0x139eac))['emit'](_0xbb10('0x174'),{'hopper':_0x21905e[_0x5f074d]});}})[_0xbb10('0xbc')](function(_0x46da44){logger[_0xbb10('0xa3')](_0xbb10('0x171'),_0x46da44);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0xbb10('0x1d')][_0xbb10('0x14f')]=function(){var _0x29ab90=this;var _0x6c67b7;for(var _0x504279 in this[_0xbb10('0x24')]){if(typeof this[_0xbb10('0x24')][_0x504279]!==_0xbb10('0xb7')){_0x6c67b7=this[_0xbb10('0x24')][_0x504279];if(isCampaignIvr(_0x6c67b7[_0xbb10('0x56')])&&isActive(_0x6c67b7[_0xbb10('0x80')])){_0x6c67b7[_0xbb10('0xac')]=!![];Promise[_0xbb10('0xc1')]()[_0xbb10('0xc2')](checkIsActive(_0x6c67b7,_0x6c67b7['active']))[_0xbb10('0xc2')](checkInterval(_0x6c67b7))['then'](_0x29ab90[_0xbb10('0x150')](_0x6c67b7))[_0xbb10('0xc2')](_0x29ab90['checkIfTime'](_0x6c67b7['dialGlobalInterval'],_0x6c67b7[_0xbb10('0x178')],_0x6c67b7[_0xbb10('0x47')],_0x6c67b7))[_0xbb10('0xc2')](_0x29ab90[_0xbb10('0x154')](_0x6c67b7[_0xbb10('0x4b')],_0x6c67b7[_0xbb10('0x178')],_0x6c67b7[_0xbb10('0x47')],_0x6c67b7))[_0xbb10('0xc2')](_0x29ab90[_0xbb10('0x175')](_0x6c67b7))[_0xbb10('0xbc')](loggerCatchQueueSummary(_0xbb10('0x17e'),_0x6c67b7));}else{notSendMessagesCampaign(_0x6c67b7);}}}};function getCallerIdRandom(_0x2b0a37,_0x3f632e){var _0x2f76;var _0x18c40e;var _0x5eba7e;if(_0x3f632e<=0x0){_0x3f632e=0x1;}_0x2f76=new RegExp(_0xbb10('0x17f')+_0x3f632e+'}$');_0x18c40e=Math['pow'](0xa,_0x3f632e-0x1);_0x5eba7e=Math[_0xbb10('0x180')](0xa,_0x3f632e)-0x1;return util[_0xbb10('0x83')]('%s',_[_0xbb10('0x181')](_0x2b0a37,_0x2f76,_[_0xbb10('0x182')](_0x18c40e,_0x5eba7e)));}function extractCalleridName(_0x3033b0){var _0x2b332b=_0x3033b0[_0xbb10('0x183')](/"(.*?)"/);return _0x2b332b?_0x2b332b[0x1]:_0x3033b0;}Dialer[_0xbb10('0x1d')][_0xbb10('0x184')]=function(_0x4b274c,_0x4b7bdb){var _0x3f10c4=this;var _0x3bb8f9=uuid['v4']();this[_0xbb10('0x29')][_0x3bb8f9]=new Action(_0x4b274c,_0x4b7bdb,_0x3bb8f9);return new Promise(function(_0x54c61c,_0x21b00e){if(_['isUndefined'](_0x4b274c)&&typeof _0x4b274c!==_0xbb10('0x185')){return _0x21b00e(msgResponse(_0xbb10('0x186'),'Failure',_0xbb10('0x187')));}if(_[_0xbb10('0x93')](_0x4b7bdb[_0xbb10('0x188')])||_0x4b7bdb[_0xbb10('0x188')]===null){return _0x21b00e(msgResponse(_0xbb10('0x186'),'Failure',_0xbb10('0x189')));}var _0x1a21fd={'XMD-CALLERID':_0x3f10c4['actions'][_0x3bb8f9][_0xbb10('0x18a')](),'XMD-AGI':_0x4b274c[_0xbb10('0x117')]?util['format'](_0xbb10('0x18b'),ipAgi,_0x4b274c[_0xbb10('0x117')]):_0xbb10('0x18c'),'XMD-AGIAFTER':_0x4b274c[_0xbb10('0x11f')]?util['format'](_0xbb10('0x18b'),ipAgi,_0x4b274c[_0xbb10('0x11f')]):_0xbb10('0x18c'),'XMD-QUEUE':_0x4b274c['type']==='outbound'?util[_0xbb10('0x83')](_0xbb10('0x18d'),_0x4b274c[_0xbb10('0x47')],_0x4b274c[_0xbb10('0x18e')]||'',_0x4b274c['dialAgiAfterHangupAgent']?'c':'',_0x4b274c[_0xbb10('0x18f')]||0x3):_0xbb10('0x18c'),'XMD-CONTACTID':_0x4b7bdb[_0xbb10('0xe0')],'XMD-CDRTYPE':_0xbb10('0x7'),'CALLERID(all)':_0x3f10c4[_0xbb10('0x29')][_0x3bb8f9]['getCaller'](),'XMD-AMD':_0x4b274c['dialAMDActive']?_0xbb10('0x190'):_0xbb10('0x18c'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x4b274c['dialAMDActive']){_0x1a21fd[_0xbb10('0x191')]=_0x4b274c[_0xbb10('0x192')]||0x9c4;_0x1a21fd[_0xbb10('0x193')]=_0x4b274c[_0xbb10('0x194')]||0x5dc;_0x1a21fd[_0xbb10('0x195')]=_0x4b274c[_0xbb10('0x196')]||0x320;_0x1a21fd['XMD-AMDTOTALANALYSISTIME']=_0x4b274c['dialAMDTotalAnalysisTime']||0x1388;_0x1a21fd[_0xbb10('0x197')]=_0x4b274c[_0xbb10('0x198')]||0x64;_0x1a21fd[_0xbb10('0x199')]=_0x4b274c[_0xbb10('0x19a')]||0x32;_0x1a21fd[_0xbb10('0x19b')]=_0x4b274c[_0xbb10('0x19c')]||0x3;_0x1a21fd['XMD-AMDSILENCETHRESHOLD']=_0x4b274c[_0xbb10('0x19d')]||0x100;_0x1a21fd[_0xbb10('0x19e')]=_0x4b274c[_0xbb10('0x19f')]||0x1388;}if(_0x4b274c[_0xbb10('0x56')]==='outbound'){_0x1a21fd[_0xbb10('0x1a0')]=_0x4b7bdb[_0xbb10('0xe3')];}else{_0x1a21fd[_0xbb10('0x1a1')]=_0x4b7bdb[_0xbb10('0xe4')];}for(var _0x416c01 in _0x4b7bdb[_0xbb10('0x1a2')]){if(typeof _0x4b7bdb[_0xbb10('0x1a2')][_0x416c01]!==_0xbb10('0xb7')){if(isNotNull(_0x4b7bdb[_0xbb10('0x1a2')][_0x416c01])&&_0x416c01!=='id'&&_0x416c01!==_0xbb10('0x1a3')&&_0x416c01!==_0xbb10('0x1a4')&&_0x416c01!==_0xbb10('0x1a5')){_0x1a21fd[util['format'](_0xbb10('0x1a6'),_0xbb10('0x1a7'),_['toUpper'](_0x416c01))]=_0x4b7bdb[_0xbb10('0x1a2')][_0x416c01];}}}var _0x284645=_0x3f10c4[_0xbb10('0xe8')](_0x4b274c['Trunk'])?getCallerId(_0x4b274c[_0xbb10('0x7f')][_0xbb10('0x81')],_0x4b274c[_0xbb10('0x1a8')],_0x4b274c[_0xbb10('0x1a9')]>0x0?getCallerIdRandom(_0x4b274c[_0xbb10('0x64')],_0x4b274c[_0xbb10('0x1a9')]):_0x4b274c['dialOriginateCallerIdNumber']):getCallerId(_[_0xbb10('0xb8')](_0x4b274c['TrunkBackup'])?_0x4b274c[_0xbb10('0x7f')][_0xbb10('0x81')]:_0x4b274c[_0xbb10('0x151')][_0xbb10('0x81')],_0x4b274c['dialOriginateCallerIdName'],_0x4b274c[_0xbb10('0x1a9')]>0x0?getCallerIdRandom(_0x4b274c[_0xbb10('0x64')],_0x4b274c['dialRandomLastDigitCallerIdNumber']):_0x4b274c[_0xbb10('0x64')]);if(_0x284645){_0x1a21fd['XMD-ORIGINATECALLERIDNAME']=_0x3f10c4[_0xbb10('0x29')][_0x3bb8f9][_0xbb10('0x1aa')]=extractCalleridName(_0x284645);_0x1a21fd[_0xbb10('0x1ab')]=_0x4b7bdb[_0xbb10('0x188')];}_0x4b274c[_0xbb10('0x1ac')]=_0x1a21fd;return ami[_0xbb10('0xb9')]({'actionid':_0x3bb8f9,'action':_0xbb10('0x186'),'channel':_0x3f10c4[_0xbb10('0xe8')](_0x4b274c['Trunk'])?util['format'](_0xbb10('0x1ad'),_0x4b274c[_0xbb10('0x7f')][_0xbb10('0x47')],isNotNull(_0x4b274c[_0xbb10('0x1ae')])?_0x4b274c[_0xbb10('0x1ae')][_0xbb10('0x1af')]()||'':'',_0x4b274c[_0xbb10('0x1b0')]>0x0?_0x4b7bdb[_0xbb10('0x188')][_0xbb10('0x1b1')](_0x4b274c['dialCutDigit']):_0x4b7bdb[_0xbb10('0x188')]):util['format'](_0xbb10('0x1ad'),_[_0xbb10('0xb8')](_0x4b274c['TrunkBackup'])?_0x4b274c[_0xbb10('0x7f')][_0xbb10('0x47')]:_0x4b274c[_0xbb10('0x151')][_0xbb10('0x47')],isNotNull(_0x4b274c[_0xbb10('0x1ae')])?_0x4b274c[_0xbb10('0x1ae')][_0xbb10('0x1af')]()||'':'',_0x4b274c[_0xbb10('0x1b0')]>0x0?_0x4b7bdb[_0xbb10('0x188')][_0xbb10('0x1b1')](_0x4b274c['dialCutDigit']):_0x4b7bdb[_0xbb10('0x188')]),'callerid':_0x284645,'Exten':_0xbb10('0xf1'),'Context':_0xbb10('0x1b2'),'Priority':'1','variable':_0x1a21fd,'timeout':(_0x4b274c[_0xbb10('0x65')]||0x1e)*0x3e8,'async':!![],'channelid':_0x3bb8f9})[_0xbb10('0xc2')](function(_0x3a37d4){return _0x54c61c(_0x3a37d4);})[_0xbb10('0xbc')](function(_0x451ae9){_0x4b274c[_0xbb10('0x6c')]+=0x1;var _0x23707c=new History(_0x3f10c4[_0xbb10('0x29')][_0x3bb8f9]);logger['error'](util[_0xbb10('0x83')](_0xbb10('0x1b3'),JSON[_0xbb10('0x82')](_0x451ae9)));_0x23707c['state']=0xe;_0x23707c['statedesc']=_0xbb10('0x1b4');_0x23707c['starttime']=moment()[_0xbb10('0x83')](_0xbb10('0x10c'));_0x23707c[_0xbb10('0xb2')]=_0x23707c[_0xbb10('0xb3')];_0x3f10c4[_0xbb10('0xd9')](_0x23707c)['catch'](loggerCatch(_0xbb10('0x1b5')));_0x3f10c4[_0xbb10('0xd7')](_0x23707c)[_0xbb10('0xbc')](loggerCatch(_0xbb10('0x1b5')))[_0xbb10('0x20')](function(){delete _0x3f10c4[_0xbb10('0x29')][_0x3bb8f9];return _0x21b00e(msgResponse(_0xbb10('0x186'),'Error',_0xbb10('0x1b6')));});});});};Dialer[_0xbb10('0x1d')][_0xbb10('0x35')]=function(_0x178bc0){var _0x128ecc=this['actions'][_0x178bc0[_0xbb10('0x138')]];if(_0x128ecc){delete this[_0xbb10('0x29')][_0x178bc0[_0xbb10('0x138')]];_0x128ecc[_0xbb10('0x1b7')]=moment()[_0xbb10('0x83')]('YYYY-MM-DD\x20HH:mm:ss');var _0x2d8da3=_0x128ecc[_0xbb10('0x56')]===_0xbb10('0x86')?this[_0xbb10('0x24')][_0x128ecc[_0xbb10('0xbe')]]:this[_0xbb10('0x23')][_0x128ecc[_0xbb10('0x1b8')]()];if(!this['isSuccess'](_0x178bc0['response'])){this[_0xbb10('0xbd')](_0x2d8da3);return this[_0xbb10('0x1b9')](_0x128ecc,_0x2d8da3,_0x178bc0)['catch'](loggerCatch(_0xbb10('0x1ba')));}this[_0xbb10('0x2b')][_0x178bc0[_0xbb10('0xed')]]=_0x128ecc;}};Dialer[_0xbb10('0x1d')][_0xbb10('0x1bb')]=function(_0xf96e32,_0x49f94b,_0xe1ce37){var _0x33dac1=new History(_0x49f94b);if(_0x33dac1[_0xbb10('0x100')]+_0x33dac1[_0xbb10('0x101')]+_0x33dac1['countnoanswerretry']+_0x33dac1['countnosuchnumberretry']+_0x33dac1[_0xbb10('0x115')]+_0x33dac1[_0xbb10('0x132')]+_0x33dac1[_0xbb10('0x103')]+_0x33dac1[_0xbb10('0x1bc')]>=_0xe1ce37[_0xbb10('0x104')]-0x1){return!![];}switch(_0xf96e32){case 0x3:if(_0x33dac1[_0xbb10('0x102')]>=_0xe1ce37[_0xbb10('0x1bd')]-0x1){return!![];}this[_0xbb10('0xcd')]({'active':![],'countnoanswerretry':_0x33dac1[_0xbb10('0x102')]+=0x1,'scheduledat':moment()[_0xbb10('0x10a')](_0xe1ce37[_0xbb10('0x1be')],_0xbb10('0x135'))[_0xbb10('0x83')](_0xbb10('0x10c')),'ContactId':_0x33dac1['ContactId'],'ListId':_0x33dac1[_0xbb10('0xe1')],'VoiceQueueId':_0x33dac1[_0xbb10('0xe3')]||undefined,'CampaignId':_0x33dac1[_0xbb10('0xe4')]||undefined})[_0xbb10('0xbc')](loggerCatch(_0xbb10('0x1bf')));break;case 0x5:if(_0x33dac1[_0xbb10('0x100')]>=_0xe1ce37['dialBusyMaxRetry']-0x1){return!![];}this[_0xbb10('0xcd')]({'active':![],'countbusyretry':_0x33dac1[_0xbb10('0x100')]+=0x1,'scheduledat':moment()[_0xbb10('0x10a')](_0xe1ce37['dialBusyRetryFrequency'],'minutes')[_0xbb10('0x83')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x33dac1[_0xbb10('0xe0')],'ListId':_0x33dac1[_0xbb10('0xe1')],'VoiceQueueId':_0x33dac1['VoiceQueueId']||undefined,'CampaignId':_0x33dac1['CampaignId']||undefined})[_0xbb10('0xbc')](loggerCatch(_0xbb10('0x1c0')));break;case 0x8:if(_0x33dac1['countcongestionretry']>=_0xe1ce37[_0xbb10('0x1c1')]-0x1){return!![];}this[_0xbb10('0xcd')]({'active':![],'countcongestionretry':_0x33dac1[_0xbb10('0x101')]+=0x1,'scheduledat':moment()['add'](_0xe1ce37[_0xbb10('0x1c2')],_0xbb10('0x135'))[_0xbb10('0x83')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x33dac1[_0xbb10('0xe0')],'ListId':_0x33dac1['ListId'],'VoiceQueueId':_0x33dac1[_0xbb10('0xe3')]||undefined,'CampaignId':_0x33dac1[_0xbb10('0xe4')]||undefined})['catch'](loggerCatch(_0xbb10('0x1c3')));break;case 0x0:if(_0x33dac1[_0xbb10('0x114')]>=_0xe1ce37[_0xbb10('0x1c4')]-0x1){return!![];}else{this[_0xbb10('0xcd')]({'active':![],'countnosuchnumberretry':_0x33dac1[_0xbb10('0x114')]+=0x1,'scheduledat':moment()[_0xbb10('0x10a')](_0xe1ce37[_0xbb10('0x1c5')],_0xbb10('0x135'))[_0xbb10('0x83')](_0xbb10('0x10c')),'ContactId':_0x33dac1[_0xbb10('0xe0')],'ListId':_0x33dac1['ListId'],'VoiceQueueId':_0x33dac1[_0xbb10('0xe3')]||undefined,'CampaignId':_0x33dac1[_0xbb10('0xe4')]||undefined})[_0xbb10('0xbc')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x33dac1[_0xbb10('0x115')]>=_0xe1ce37[_0xbb10('0x12d')]-0x1){return!![];}this[_0xbb10('0xcd')]({'active':![],'countdropretry':_0x33dac1[_0xbb10('0x115')]+=0x1,'scheduledat':moment()['add'](_0xe1ce37[_0xbb10('0x12e')],_0xbb10('0x135'))[_0xbb10('0x83')](_0xbb10('0x10c')),'ContactId':_0x33dac1[_0xbb10('0xe0')],'ListId':_0x33dac1[_0xbb10('0xe1')],'VoiceQueueId':_0x33dac1[_0xbb10('0xe3')]||undefined,'CampaignId':_0x33dac1[_0xbb10('0xe4')]||undefined})[_0xbb10('0xbc')](loggerCatch(_0xbb10('0x1c6')));break;case 0xb:if(_0x33dac1[_0xbb10('0x132')]>=_0xe1ce37[_0xbb10('0x134')]-0x1){return!![];}this[_0xbb10('0xcd')]({'active':![],'countabandonedretry':_0x33dac1[_0xbb10('0x132')]+=0x1,'scheduledat':moment()[_0xbb10('0x10a')](_0xe1ce37['dialAbandonedRetryFrequency'],_0xbb10('0x135'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x33dac1['ContactId'],'ListId':_0x33dac1[_0xbb10('0xe1')],'VoiceQueueId':_0x33dac1['VoiceQueueId']||undefined,'CampaignId':_0x33dac1[_0xbb10('0xe4')]||undefined})['catch'](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x33dac1[_0xbb10('0x103')]>=_0xe1ce37['dialMachineMaxRetry']-0x1){return!![];}this[_0xbb10('0xcd')]({'active':![],'countmachineretry':_0x33dac1[_0xbb10('0x103')]+=0x1,'scheduledat':moment()[_0xbb10('0x10a')](_0xe1ce37[_0xbb10('0x10b')],'minutes')[_0xbb10('0x83')](_0xbb10('0x10c')),'ContactId':_0x33dac1[_0xbb10('0xe0')],'ListId':_0x33dac1[_0xbb10('0xe1')],'VoiceQueueId':_0x33dac1[_0xbb10('0xe3')]||undefined,'CampaignId':_0x33dac1[_0xbb10('0xe4')]||undefined})['catch'](loggerCatch(_0xbb10('0x10d')));break;case 0x14:if(_0x33dac1[_0xbb10('0x1bc')]>=_0xe1ce37[_0xbb10('0x1c7')]-0x1){return!![];}this[_0xbb10('0xcd')]({'active':![],'countagentrejectretry':_0x33dac1[_0xbb10('0x1bc')]+=0x1,'scheduledat':moment()[_0xbb10('0x10a')](_0xe1ce37[_0xbb10('0x1c8')],_0xbb10('0x135'))[_0xbb10('0x83')](_0xbb10('0x10c')),'ContactId':_0x33dac1['ContactId'],'ListId':_0x33dac1[_0xbb10('0xe1')],'VoiceQueueId':_0x33dac1['VoiceQueueId']||undefined,'CampaignId':_0x33dac1[_0xbb10('0xe4')]||undefined})[_0xbb10('0xbc')](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer[_0xbb10('0x1d')][_0xbb10('0x1b9')]=function(_0x5e3903,_0x3a27ef,_0x836686){var _0x3a3d86=this;var _0x3b484e=new History(_0x5e3903);var _0x29fa42=![];var _0x969f63;var _0x7df075;return new Promise(function(_0x25d557,_0x3d693a){if(_['isUndefined'](_0x3a27ef)&&typeof _0x3a27ef!==_0xbb10('0x185')){return _0x3d693a(msgResponse(_0xbb10('0x1c9'),_0xbb10('0x156'),_0xbb10('0x1ca')));}if(_['isUndefined'](_0x836686)&&typeof _0x836686!==_0xbb10('0x185')){return _0x3d693a(msgResponse(_0xbb10('0x1c9'),_0xbb10('0x156'),_0xbb10('0x1cb')));}_0x3a3d86[_0xbb10('0xc5')](_0x3b484e,_0x836686[_0xbb10('0x11e')],_0x3a27ef)[_0xbb10('0xc2')](function(_0x173949){if(_0x173949['additional']==0x1)_0x29fa42=!![];switch(_0x836686[_0xbb10('0x11e')]){case'0':_0x3a27ef['outboundNoSuchCallsDay']+=0x1;_0x3b484e[_0xbb10('0x10f')]=0x0;_0x3b484e[_0xbb10('0xf2')]=_0xbb10('0x1cc');_0x3b484e['countnosuchnumberretry']+=0x1;_0x3b484e[_0xbb10('0xff')]+=0x1;ami[_0xbb10('0x55')](_0xbb10('0x1cd'),ut[_0xbb10('0xf6')](_0x5e3903,_0xbb10('0x1ce')));_0x969f63=_0x3a27ef[_0xbb10('0x1c5')];_0x7df075=_0x3a27ef[_0xbb10('0x12a')];_0x3a3d86[_0xbb10('0xd9')](_0x3b484e)[_0xbb10('0xbc')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x3a3d86[_0xbb10('0x1bb')](0x0,_0x5e3903,_0x3a27ef)&&!_0x29fa42){if(_0x3b484e['countnosuchnumberretry']>=_0x3a27ef[_0xbb10('0x1c4')]){_0x3a3d86[_0xbb10('0x108')](_0x3b484e,_0x25d557,_0x3d693a,_0xbb10('0x1cf'));}else{_0x3a3d86[_0xbb10('0x105')](_0x3b484e,_0x25d557,_0x3d693a,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x3a27ef[_0xbb10('0x6b')]+=0x1;_0x3b484e[_0xbb10('0x10f')]=0x3;_0x3b484e['statedesc']=_0xbb10('0x1d0');_0x3b484e[_0xbb10('0x102')]+=0x1;_0x3b484e[_0xbb10('0xff')]+=0x1;var _0x3ec649=ut['buildNoAnswerEventPayload'](_0x5e3903,_0x3a27ef);ami[_0xbb10('0x55')]('custom:agentnoanswer',_0x3ec649);_0x969f63=_0x3a27ef[_0xbb10('0x1be')];_0x7df075=_0x3a27ef['callAdditionalPhoneAfterMin'];_0x3a3d86[_0xbb10('0xd9')](_0x3b484e)[_0xbb10('0xbc')](loggerCatch(_0xbb10('0x1d1')));if(_0x3a3d86[_0xbb10('0x1bb')](0x3,_0x5e3903,_0x3a27ef)&&!_0x29fa42){if(_0x3b484e[_0xbb10('0x102')]>=_0x3a27ef[_0xbb10('0x1bd')]){_0x3a3d86[_0xbb10('0x108')](_0x3b484e,_0x25d557,_0x3d693a,_0xbb10('0x1d2'));}else{_0x3a3d86[_0xbb10('0x105')](_0x3b484e,_0x25d557,_0x3d693a,_0xbb10('0x1d2'));}}break;case'5':_0x3a27ef[_0xbb10('0x67')]+=0x1;_0x3b484e[_0xbb10('0x10f')]=0x5;_0x3b484e[_0xbb10('0xf2')]=_0xbb10('0x1d3');_0x3b484e['countbusyretry']+=0x1;_0x3b484e[_0xbb10('0xff')]+=0x1;ami['emit'](_0xbb10('0x1d4'),ut[_0xbb10('0xf6')](_0x5e3903,_0xbb10('0x1d5')));_0x969f63=_0x3a27ef['dialBusyRetryFrequency'];_0x7df075=_0x3a27ef[_0xbb10('0x12a')];_0x3a3d86[_0xbb10('0xd9')](_0x3b484e)[_0xbb10('0xbc')](loggerCatch(_0xbb10('0x1d6')));if(_0x3a3d86['checkRetriveMax'](0x5,_0x5e3903,_0x3a27ef)&&!_0x29fa42){if(_0x3b484e['countbusyretry']>=_0x3a27ef[_0xbb10('0x1d7')]){_0x3a3d86[_0xbb10('0x108')](_0x3b484e,_0x25d557,_0x3d693a,_0xbb10('0x1d8'));}else{_0x3a3d86[_0xbb10('0x105')](_0x3b484e,_0x25d557,_0x3d693a,'reason\x205\x20busy');}}break;case'8':_0x3a27ef[_0xbb10('0x68')]+=0x1;_0x3b484e[_0xbb10('0x10f')]=0x8;_0x3b484e[_0xbb10('0xf2')]='Congestion';_0x3b484e['countcongestionretry']+=0x1;_0x3b484e['countglobal']+=0x1;_0x969f63=_0x3a27ef['dialCongestionRetryFrequency'];_0x7df075=_0x3a27ef[_0xbb10('0x12a')];ami[_0xbb10('0x55')]('custom:agentcongestion',ut[_0xbb10('0xf6')](_0x5e3903,_0xbb10('0x1d9')));_0x3a3d86[_0xbb10('0xd9')](_0x3b484e)['catch'](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x3a3d86['checkRetriveMax'](0x8,_0x5e3903,_0x3a27ef)&&!_0x29fa42){if(_0x3b484e[_0xbb10('0x101')]>=_0x3a27ef[_0xbb10('0x1c1')]){_0x3a3d86['createStateFinal'](_0x3b484e,_0x25d557,_0x3d693a,_0xbb10('0x1da'));}else{_0x3a3d86[_0xbb10('0x105')](_0x3b484e,_0x25d557,_0x3d693a,_0xbb10('0x1da'));}}break;case'11':_0x3a27ef[_0xbb10('0x1db')]+=0x1;_0x3b484e['state']=0xb;_0x3b484e[_0xbb10('0xf2')]=_0xbb10('0x131');_0x3b484e[_0xbb10('0x132')]+=0x1;_0x3b484e['countglobal']+=0x1;_0x969f63=_0x3a27ef[_0xbb10('0x133')];_0x7df075=_0x3a27ef[_0xbb10('0x12a')];_0x3a3d86[_0xbb10('0xd9')](_0x3b484e)[_0xbb10('0xbc')](loggerCatch(_0xbb10('0x137')));if(_0x3a3d86[_0xbb10('0x1bb')](0xb,_0x5e3903,_0x3a27ef)&&!_0x29fa42){if(_0x3b484e['countabandonedretry']>=_0x3a27ef['dialAbandonedMaxRetry']){_0x3a3d86[_0xbb10('0x108')](_0x3b484e,_0x25d557,_0x3d693a,'reason\x2011\x20abandoned');}else{_0x3a3d86['stateGlobal'](_0x3b484e,_0x25d557,_0x3d693a,_0xbb10('0x1dc'));}}break;case'20':_0x3a27ef[_0xbb10('0x6e')]+=0x1;_0x3b484e[_0xbb10('0x10f')]=0x14;_0x3b484e[_0xbb10('0xf2')]=_0xbb10('0x1dd');_0x3b484e[_0xbb10('0x1bc')]+=0x1;_0x3b484e[_0xbb10('0xff')]+=0x1;_0x969f63=_0x3a27ef['dialAgentRejectRetryFrequency'];_0x7df075=_0x3a27ef[_0xbb10('0x12a')];ami[_0xbb10('0x55')](_0xbb10('0x1de'),ut[_0xbb10('0xf6')](_0x5e3903,_0xbb10('0x1df')));_0x3a3d86[_0xbb10('0xd9')](_0x3b484e)[_0xbb10('0xbc')](loggerCatch(_0xbb10('0x1e0')));if(_0x3a3d86[_0xbb10('0x1bb')](0x14,_0x5e3903,_0x3a27ef)&&!_0x29fa42){if(_0x3b484e[_0xbb10('0x1bc')]>=_0x3a27ef[_0xbb10('0x1c7')]){_0x3a3d86[_0xbb10('0x108')](_0x3b484e,_0x25d557,_0x3d693a,'reason\x2020\x20agentreject');}else{_0x3a3d86['stateGlobal'](_0x3b484e,_0x25d557,_0x3d693a,_0xbb10('0x1e1'));}}break;default:_0x3a27ef['outboundUnknownCallsDay']+=0x1;_0x3b484e[_0xbb10('0x10f')]=0xc;_0x3b484e[_0xbb10('0xf2')]=_0x836686['reason'];_0x969f63=_0x3a27ef['dialAgentRejectRetryFrequency'];_0x7df075=_0x3a27ef[_0xbb10('0x12a')];_0x3a3d86[_0xbb10('0xd9')](_0x3b484e)[_0xbb10('0xbc')](loggerCatch(_0xbb10('0x1e2')));if(_0x3a3d86[_0xbb10('0x1bb')](_0x836686[_0xbb10('0x11e')],_0x5e3903,_0x3a27ef)&&!_0x29fa42){if(_0x3b484e['countbusyretry']+_0x3b484e[_0xbb10('0x101')]+_0x3b484e[_0xbb10('0x102')]+_0x3b484e[_0xbb10('0x114')]+_0x3b484e[_0xbb10('0x115')]+_0x3b484e['countabandonedretry']+_0x3b484e['countmachineretry']+_0x3b484e[_0xbb10('0x1bc')]>=_0x3a27ef[_0xbb10('0x104')]){_0x3a3d86[_0xbb10('0x105')](_0x3b484e,_0x25d557,_0x3d693a,_0x836686[_0xbb10('0x11e')]);}else{_0x3a3d86[_0xbb10('0x108')](_0x3b484e,_0x25d557,_0x3d693a,_0x836686[_0xbb10('0x11e')]);}}}})['then'](function(){if(_0x29fa42){_0x3a3d86['swapAdditionalPhones'](_0x3b484e,_0x969f63,_0x7df075)[_0xbb10('0xc2')](function(){return _0x25d557(0x1);});}});});};Dialer[_0xbb10('0x1d')][_0xbb10('0x105')]=function(_0x468568,_0x58e537,_0x463d0f,_0xb2d651){var _0x32379b=new Final(_0x468568);_0x32379b[_0xbb10('0x10f')]=0xf;_0x32379b[_0xbb10('0xf2')]=_0xbb10('0x1e3');this[_0xbb10('0x108')](_0x32379b,_0x58e537,_0x463d0f,_0xb2d651);};Dialer['prototype'][_0xbb10('0x108')]=function(_0x185940,_0x26f413,_0x43584b,_0x313072){this[_0xbb10('0xd7')](_0x185940)[_0xbb10('0xc2')](function(){return _0x26f413(msgResponse(_0xbb10('0x1c9'),'Success',_0x313072));})[_0xbb10('0xbc')](function(){return _0x43584b(msgResponse(_0xbb10('0x1e4'),_0xbb10('0x156'),'contact\x20not\x20moved'));});};Dialer['prototype'][_0xbb10('0x9')]=function(_0x2d81db){var _0x28ee28=_0x2d81db[_0xbb10('0x1e5')]/0x64;var _0x5db829=_0x2d81db[_0xbb10('0x6a')]/(_0x2d81db[_0xbb10('0x6a')]+_0x2d81db[_0xbb10('0x66')]);var _0xb7f2fa=Math['round'](_0x2d81db[_0xbb10('0x79')]*(_0x2d81db[_0xbb10('0x1e6')]/0x64));var _0x385374=Math[_0xbb10('0x1e7')](_0x2d81db[_0xbb10('0x79')]*(_0x2d81db['predictiveIntervalMinThreshold']/0x64));var _0x21ae70=_0x2d81db[_0xbb10('0x58')]+_0x2d81db[_0xbb10('0x5d')];var _0x5273ef=Math['floor'](_0x2d81db[_0xbb10('0x7b')]*_0x2d81db['erlangAbandonmentRate']*_0x2d81db[_0xbb10('0x77')]*_0x2d81db['predictiveIntervalMultiplicativeFactor']);if(_[_0xbb10('0x93')](_0x2d81db[_0xbb10('0x2d')])){if(!_[_0xbb10('0x93')](_0x2d81db['startPredictive'])){_0x2d81db[_0xbb10('0x2c')]=undefined;loggerPredictive[_0xbb10('0xa3')]('[startMethodPredictive][StartProgressive]',_0xbb10('0x1e8'));}if(!_[_0xbb10('0x93')](_0x2d81db[_0xbb10('0x9d')])){loggerPredictive['error'](_0xbb10('0x1e9'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x2d81db[_0xbb10('0x9d')]);_0x2d81db[_0xbb10('0x9d')]=undefined;}_0x2d81db[_0xbb10('0x2d')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x2d81db[_0xbb10('0x47')],'collection\x20data\x20in\x20progressive\x20at',_0x2d81db[_0xbb10('0x2d')]);this['handlePower'](_0x2d81db,0x1);}else if(ifInterval(_0x2d81db[_0xbb10('0x1ea')],_0x2d81db[_0xbb10('0x2d')])){this['handlePower'](_0x2d81db,0x1);loggerPredictiveCalls['info'](_0xbb10('0x1eb'),_0x2d81db[_0xbb10('0x2d')],_0x2d81db['name']);_0x2d81db[_0xbb10('0x7b')]=0x0;_0x2d81db[_0xbb10('0x76')]=0x0;}else if(_0x28ee28<_0x5db829&&_0x2d81db[_0xbb10('0x1ec')]==='dropRate'){freeVariablesPredictive(_0x2d81db);loggerPredictive[_0xbb10('0x89')](_0xbb10('0x1ed'),_0xbb10('0x1ee'),_0x5db829,_0xbb10('0x2d'),_0x2d81db[_0xbb10('0x47')]);}else if(_0x5273ef<_0x2d81db[_0xbb10('0x76')]&&_0x2d81db[_0xbb10('0x1ec')]==='dropRate'){freeVariablesPredictive(_0x2d81db);loggerPredictive[_0xbb10('0x89')](_0xbb10('0x1ef'),_0xbb10('0x1f0'),_0x5273ef,'Drop\x20in\x20this\x20interval',_0x2d81db[_0xbb10('0x76')],_0xbb10('0x2d'),_0x2d81db['name']);}else if(!ifInterval(_0x2d81db[_0xbb10('0x1ea')],_0x2d81db[_0xbb10('0x2d')])&&_[_0xbb10('0x93')](_0x2d81db[_0xbb10('0x2c')])&&!_[_0xbb10('0x93')](_0x2d81db[_0xbb10('0x2d')])){_0x2d81db[_0xbb10('0x2c')]=moment()[_0xbb10('0x83')](_0xbb10('0x10c'));loggerPredictive[_0xbb10('0x89')](_0x2d81db[_0xbb10('0x47')],_0xbb10('0x1f1'),_0x2d81db[_0xbb10('0x2c')]);this['averageHandleTime'](_0x2d81db[_0xbb10('0x1ea')])[_0xbb10('0xc2')](this['getDataPredictive'](_0x2d81db))['then'](mergeDataErlangB(_0x2d81db))[_0xbb10('0xc2')](this[_0xbb10('0x1f2')](_0x2d81db))[_0xbb10('0xbc')](loggerCatchPredictive(_0xbb10('0x1f3'),_0x2d81db));}else if(!ifInterval(_0x2d81db['dialPredictiveInterval'],_0x2d81db[_0xbb10('0x2c')])){_0x2d81db['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x2d81db['startPredictive']=moment()['format'](_0xbb10('0x10c'));loggerPredictive[_0xbb10('0x89')](_0x2d81db[_0xbb10('0x47')],_0xbb10('0x1f4'),_0x2d81db['startPredictive']);clearInterval(_0x2d81db[_0xbb10('0x9d')]);_0x2d81db['handlePredictive']=undefined;this[_0xbb10('0xca')](_0x2d81db[_0xbb10('0x1ea')])[_0xbb10('0xc2')](this[_0xbb10('0x1f5')](_0x2d81db))[_0xbb10('0xc2')](mergeDataErlangB(_0x2d81db))[_0xbb10('0xc2')](this['startMethodPredictive'](_0x2d81db))['catch'](loggerCatchPredictive(_0xbb10('0x1f6'),_0x2d81db));}else if(_0x2d81db['predictiveIntervalAvailable']&&_0x21ae70<_0x2d81db[_0xbb10('0x79')]-_0x385374){freeVariablesPredictive(_0x2d81db);loggerPredictive[_0xbb10('0x89')](_0x2d81db[_0xbb10('0x47')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x21ae70,_0xbb10('0x1f7'),_0x2d81db[_0xbb10('0x79')],'-',_0x385374,'=',_0x2d81db[_0xbb10('0x79')]-_0x385374,')');}else if(_0x2d81db[_0xbb10('0x79')]&&_0x21ae70>_0x2d81db[_0xbb10('0x79')]+_0xb7f2fa){freeVariablesPredictive(_0x2d81db);loggerPredictive[_0xbb10('0x89')](_0x2d81db[_0xbb10('0x47')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x21ae70,_0xbb10('0x1f8'),_0x2d81db['predictiveIntervalAvailable'],'+',_0xb7f2fa,'=',_0x2d81db[_0xbb10('0x79')]+_0xb7f2fa,')');}};Dialer[_0xbb10('0x1d')][_0xbb10('0x1f5')]=function(_0x21139c){var _0x4276d6=this;return function(_0x2d5931){return new Promise(function(_0x550911,_0x2ddf65){_[_0xbb10('0x9b')](_0x21139c,_0x2d5931[0x0]);if(checkGetDataPredictive(_0x2d5931[0x0])){var _0x117375=_0x21139c['predictiveIntervalAvailable']=_0x21139c['talking']+_0x21139c[_0xbb10('0x58')];var _0x3134a6=_0x21139c['dialPredictiveInterval']*0x3c;var _0x51f8f3=_0x2d5931[0x0][_0xbb10('0x72')]+_0x2d5931[0x0][_0xbb10('0x71')];var _0xeb8dd3=(_0x2d5931[0x0][_0xbb10('0x70')]+_0x2d5931[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x2d5931[0x0][_0xbb10('0x73')])/_0x2d5931[0x0][_0xbb10('0x92')];_0x21139c[_0xbb10('0x77')]=_0xeb8dd3>0x0?_0xeb8dd3:0x1;switch(_0x21139c[_0xbb10('0x1ec')]){case'dropRate':var _0x5a4172=_0x21139c[_0xbb10('0x1e5')]/0x64;return _0x4276d6[_0xbb10('0x1f9')](_0x117375,_0x3134a6,_0x51f8f3,_0xeb8dd3,_0x5a4172)[_0xbb10('0xc2')](function(_0x98e790){return _0x550911(_0x98e790);});case _0xbb10('0x1fa'):var _0x1df852=_0x21139c[_0xbb10('0x1e5')]/0x64;return _0x4276d6['busyFactor'](_0x117375,_0x3134a6,_0x51f8f3,_0xeb8dd3,_0x1df852)[_0xbb10('0xc2')](function(_0x30fe12){return _0x550911(_0x30fe12);});default:return _0x2ddf65(msgResponse(_0xbb10('0x1fb'),_0xbb10('0x156'),'Unknown\x20Predictive'));}}else{return _0x2ddf65(msgResponse('[getDataPredictive]',_0xbb10('0x156'),_0xbb10('0x1fc')));}});};};Dialer[_0xbb10('0x1d')][_0xbb10('0x1fd')]=function(_0x4cf6ab){var _0x3ca88f=this;return function(_0x37bd6d){return new Promise(function(_0x66a0b8,_0x2df4dd){_[_0xbb10('0x9b')](_0x4cf6ab,_0x37bd6d[0x0]);if(checkGetDataPredictive(_0x37bd6d[0x0])){loggerPredictive[_0xbb10('0x89')](JSON['stringify'](_0x37bd6d[0x0]));if(_0x4cf6ab[_0xbb10('0x1ec')]===_0xbb10('0x1fe')){return _0x3ca88f[_0xbb10('0xd5')](_0x4cf6ab['id'])[_0xbb10('0xc2')](function(_0x3b156c){var _0x5c2c1c=_0x4cf6ab[_0xbb10('0x59')]-_0x3b156c[0x0][_0xbb10('0x1ff')];var _0x228027=_0x4cf6ab[_0xbb10('0x1ea')]*0x3c;var _0x2553ec=_0x37bd6d[0x0][_0xbb10('0x72')]+_0x37bd6d[0x0][_0xbb10('0x71')];var _0x1e87e3=(_0x37bd6d[0x0][_0xbb10('0x70')]+_0x37bd6d[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x37bd6d[0x0][_0xbb10('0x73')])/_0x37bd6d[0x0]['predictiveIntervalTotalCalls'];var _0x3c4abf=_0x4cf6ab[_0xbb10('0x1e5')]/0x64;_0x4cf6ab[_0xbb10('0x78')]=_0x3b156c[0x0][_0xbb10('0x1ff')]||0x0;_0x4cf6ab[_0xbb10('0x77')]=_0x1e87e3>0x0?_0x1e87e3:0x1;return _0x3ca88f[_0xbb10('0x1f9')](_0x5c2c1c,_0x228027,_0x2553ec,_0x1e87e3,_0x3c4abf);})['then'](function(_0xdf2955){return _0x66a0b8(_0xdf2955);})[_0xbb10('0xbc')](function(_0x6350a6){return _0x2df4dd(msgResponse(_0xbb10('0x200'),_0xbb10('0x156'),JSON[_0xbb10('0x82')](_0x6350a6)));});}if(_0x4cf6ab['dialPredictiveOptimization']===_0xbb10('0x1fa')){return _0x3ca88f['getVoiceQueueRtPauses'](_0x4cf6ab['id'])['then'](function(_0x3f346b){var _0x54d70f=_0x4cf6ab[_0xbb10('0x59')]-_0x3f346b[0x0][_0xbb10('0x1ff')];var _0x5441c8=_0x4cf6ab[_0xbb10('0x1ea')]*0x3c;var _0x7c1f83=_0x37bd6d[0x0][_0xbb10('0x72')]+_0x37bd6d[0x0][_0xbb10('0x71')];var _0x3a3912=(_0x37bd6d[0x0][_0xbb10('0x70')]+_0x37bd6d[0x0][_0xbb10('0x74')]+_0x37bd6d[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x37bd6d[0x0][_0xbb10('0x92')];var _0x21c4dd=_0x4cf6ab[_0xbb10('0x1e5')]/0x64;_0x4cf6ab[_0xbb10('0x78')]=_0x3f346b[0x0][_0xbb10('0x1ff')]||0x0;_0x4cf6ab[_0xbb10('0x77')]=_0x3a3912>0x0?_0x3a3912:0x1;return _0x3ca88f[_0xbb10('0x201')](_0x54d70f,_0x5441c8,_0x7c1f83,_0x3a3912,_0x21c4dd);})['then'](function(_0x56d89c){return _0x66a0b8(_0x56d89c);})[_0xbb10('0xbc')](function(_0x3ec298){return _0x2df4dd(msgResponse(_0xbb10('0x200'),'Failure',JSON[_0xbb10('0x82')](_0x3ec298)));});}}else{return _0x2df4dd(msgResponse(_0xbb10('0x1fb'),_0xbb10('0x156'),_0xbb10('0x1fc')));}});};};Dialer[_0xbb10('0x1d')][_0xbb10('0x1f2')]=function(_0x4f162d){var _0x3a6a8b=this;return function(){var _0x48a25d=0x0;var _0x14a786=Math[_0xbb10('0x202')](_0x4f162d['erlangCallToSecond']*0x3e8);if(_0x14a786>0x0){_0x14a786=_0x14a786<0x64?0x64:_0x14a786;loggerPredictive['info'](_0x4f162d['name'],_0xbb10('0x203'),_0x14a786,_0xbb10('0x52'));_0x4f162d[_0xbb10('0x9d')]=setInterval(function(){_0x3a6a8b[_0xbb10('0x9d')](_0x4f162d);loggerPredictiveCalls[_0xbb10('0x89')](_0xbb10('0x204'),_0x48a25d+=0x1);},_0x14a786);}else{loggerPredictive[_0xbb10('0x89')](_0x4f162d[_0xbb10('0x47')],_0xbb10('0x205'));}};};Dialer[_0xbb10('0x1d')]['checkContactBlack']=function(_0x1ab3d1,_0x175398){var _0x5b3340=this;return function(_0x8c06ed){if(_['isEmpty'](_0x8c06ed)){if(_['isNil'](_0x175398['UserId'])||!_0x175398[_0xbb10('0x206')]){if(_0x1ab3d1[_0xbb10('0x63')]==='booked'){_0x1ab3d1[_0xbb10('0x13e')]=_[_0xbb10('0x93')](_0x1ab3d1[_0xbb10('0x13e')])?!![]:_0x1ab3d1[_0xbb10('0x13e')];var _0x3cb207=uuid['v4']();_0x5b3340[_0xbb10('0x29')][_0x3cb207]=new Action(_0x1ab3d1,_0x175398,_0x3cb207);loggerBooked[_0xbb10('0x89')]('[booked][checkContactBlack]',_0x3cb207,_0xbb10('0x207'),JSON['stringify'](_0x1ab3d1['queueStatusComplete']),'Queue:\x20',_0x1ab3d1['name']);if(_0x1ab3d1[_0xbb10('0x13e')]){_0x1ab3d1[_0xbb10('0x13e')]=![];_0x5b3340[_0xbb10('0x13d')][_0x5b3340[_0xbb10('0x29')][_0x3cb207][_0xbb10('0xbe')]]=[];ami['Action']({'actionid':_0x3cb207,'action':'queuestatus','queue':_0x1ab3d1[_0xbb10('0x47')]})[_0xbb10('0xbc')](function(){_0x5b3340['updateOriginated'](_0x1ab3d1);_0x5b3340['rescheduleContact']({'active':![],'ContactId':_0x5b3340[_0xbb10('0x29')][_0x3cb207][_0xbb10('0xe0')],'ListId':_0x5b3340[_0xbb10('0x29')][_0x3cb207][_0xbb10('0xe1')],'VoiceQueueId':_0x5b3340[_0xbb10('0x29')][_0x3cb207][_0xbb10('0xe3')]||undefined,'CampaignId':_0x5b3340[_0xbb10('0x29')][_0x3cb207][_0xbb10('0xe4')]||undefined})[_0xbb10('0xbc')](loggerCatch(_0xbb10('0x208')));delete _0x5b3340[_0xbb10('0x29')][_0x3cb207];});}else{loggerBooked[_0xbb10('0x89')](_0xbb10('0x209'),JSON[_0xbb10('0x82')](_0x1ab3d1[_0xbb10('0x13e')]),_0xbb10('0x20a'),_0x1ab3d1[_0xbb10('0x47')]);_0x5b3340[_0xbb10('0xbd')](_0x1ab3d1);_0x5b3340[_0xbb10('0xcd')]({'active':![],'ContactId':_0x5b3340[_0xbb10('0x29')][_0x3cb207]['ContactId'],'ListId':_0x5b3340[_0xbb10('0x29')][_0x3cb207][_0xbb10('0xe1')],'VoiceQueueId':_0x5b3340['actions'][_0x3cb207][_0xbb10('0xe3')]||undefined,'CampaignId':_0x5b3340['actions'][_0x3cb207][_0xbb10('0xe4')]||undefined})[_0xbb10('0xbc')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x5b3340[_0xbb10('0x29')][_0x3cb207];}}else{return _0x5b3340[_0xbb10('0x184')](_0x1ab3d1,_0x175398);}}else{if(getDiff(_0x175398[_0xbb10('0x20b')])<_0x1ab3d1[_0xbb10('0x20c')]*0x3c){if(_0x175398[_0xbb10('0x17d')]&&!_0x175398[_0xbb10('0x17d')]['voicePause']){_0x5b3340[_0xbb10('0x22')]['run'](_0x175398['id'])[_0xbb10('0x20')](function(){_0x5b3340[_0xbb10('0xbd')](_0x1ab3d1);});}else{_0x5b3340[_0xbb10('0xcf')]({'active':![]},_0x175398['id'],0x1)[_0xbb10('0x20')](function(){_0x5b3340[_0xbb10('0xbd')](_0x1ab3d1);});}}else{_0x1ab3d1[_0xbb10('0x6d')]+=0x1;_0x5b3340['updateOriginated'](_0x1ab3d1);if(_0x1ab3d1[_0xbb10('0x20d')]){_0x5b3340['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x175398[_0xbb10('0xe0')],'ListId':_0x175398[_0xbb10('0xe1')],'VoiceQueueId':_0x175398['VoiceQueueId']||undefined,'CampaignId':_0x175398['CampaignId']||undefined})[_0xbb10('0xbc')](loggerCatch(_0xbb10('0x20e')));_0x5b3340[_0xbb10('0xd9')](createObjHistory(_0x1ab3d1,_0x175398,_0xbb10('0x20f'),0x17,_0xbb10('0x210')))[_0xbb10('0xbc')](loggerCatch(_0xbb10('0x211')));}else{_0x5b3340[_0xbb10('0xf8')](createObjHistory(_0x1ab3d1,_0x175398,_0xbb10('0x212'),0x16,_0xbb10('0x213')),_0xbb10('0x214'),_0xbb10('0x215'));}}}}else{_0x1ab3d1['outboundBlacklistCallsDay']+=0x1;_0x5b3340[_0xbb10('0xf8')](createObjHistory(_0x1ab3d1,_0x175398,_0xbb10('0x216'),0xd,_0xbb10('0x217')),_0xbb10('0x218'),_0xbb10('0x219'));throw _0xbb10('0x21a');}};};Dialer[_0xbb10('0x1d')]['handleIvr']=function(_0x555140){var _0xc65a96=this;var _0x4e00a7=_0x555140[_0xbb10('0x21b')]-_0x555140['originated']-_0x555140[_0xbb10('0xd1')];emitCampaignSummary(_0x555140);if(_0x4e00a7>0x0){if(_0x4e00a7>this['maxNumberOriginate']){_0x4e00a7=this[_0xbb10('0x27')];}_0x555140[_0xbb10('0xd1')]+=_0x4e00a7;this['getContactDialerIvr'](_0x555140['id'],_0x4e00a7,_0x555140['dialOrderByScheduledAt'],_0x555140)[_0xbb10('0xc2')](function(_0x4be84b){_0x555140[_0xbb10('0xd1')]-=_0x4e00a7;_0x555140[_0xbb10('0xd1')]=_0x555140[_0xbb10('0xd1')]>0x0?_0x555140['temp']:0x0;if(!checkContactEmpty(_0x4be84b)){_0x555140['message']=_0xbb10('0xaa');logger[_0xbb10('0x89')](_0xbb10('0x21c')+_0x555140[_0xbb10('0x47')]);}else{_0x555140['originated']+=_0x4be84b['length'];_0x555140[_0xbb10('0x46')]=_0xbb10('0x21d');for(var _0x434b54=0x0;_0x434b54<_0x4be84b['length'];_0x434b54+=0x1){_0x555140[_0xbb10('0x21e')]+=0x1;if(_[_0xbb10('0xb8')](_0x4be84b[_0x434b54])||_[_0xbb10('0xb8')](_0x4be84b[_0x434b54]['Contact'])||_[_0xbb10('0xb8')](_0x4be84b[_0x434b54][_0xbb10('0x188')])){_0xc65a96[_0xbb10('0xde')]('[actionOriginate]\x20',_0x555140,_0x4be84b[_0x434b54]);}else{_0xc65a96[_0xbb10('0xc8')](_[_0xbb10('0xdf')](_0x4be84b[_0x434b54],['CampaignId','Contact.phone']))[_0xbb10('0xc2')](_0xc65a96[_0xbb10('0x21f')](_0x555140,_0x4be84b[_0x434b54]))[_0xbb10('0xbc')](_0xc65a96['loggerHandler'](_0xbb10('0x220'),_0x555140));}}}})[_0xbb10('0xbc')](loggerGetContactDialer(_0xbb10('0x221'),_0x555140,_0x4e00a7));}};Dialer[_0xbb10('0x1d')][_0xbb10('0x16e')]=function(_0x55d0a9,_0x35a95a){var _0x14ecd7=this;var _0x1ca18a=[];var _0x3b9ab7=_0x35a95a>=0x1?_0x35a95a:0x1;if(_0x55d0a9[_0xbb10('0x63')]===_0xbb10('0x8')){_0x3b9ab7=0x1;}var _0x196bc0=Math[_0xbb10('0x202')](_0x55d0a9[_0xbb10('0x58')]*_0x3b9ab7)-_0x55d0a9[_0xbb10('0x7a')]-_0x55d0a9[_0xbb10('0xd1')];emitVoiceQueueSummary(_0x55d0a9);if(_0x55d0a9[_0xbb10('0x222')]>0x0){var _0x439322=_0x55d0a9['dialLimitQueue']-_0x55d0a9[_0xbb10('0x7a')]-_0x55d0a9['talking']-_0x55d0a9['temp']-_0x55d0a9[_0xbb10('0x5a')];if(_0x196bc0>_0x439322){_0x196bc0=_0x439322;}}if(_0x196bc0>0x0){if(_0x55d0a9[_0xbb10('0x63')]===_0xbb10('0x8')){_0x196bc0=0x1;}if(_0x196bc0>this['maxNumberOriginate']){_0x196bc0=this[_0xbb10('0x27')];}_0x55d0a9[_0xbb10('0xd1')]+=_0x196bc0;for(var _0x160b82 in this[_0xbb10('0x25')]){if(typeof this[_0xbb10('0x25')][_0x160b82]!==_0xbb10('0xb7')){if(this[_0xbb10('0x25')][_0x160b82]['state']==='not_inuse'&&this[_0xbb10('0x25')][_0x160b82][_0xbb10('0xba')]===_0xbb10('0xea')){_0x1ca18a[_0xbb10('0x162')](this[_0xbb10('0x25')][_0x160b82]['id']);}}}this[_0xbb10('0xd0')](_0x55d0a9['id'],_0x1ca18a,_0x196bc0,_0x55d0a9[_0xbb10('0x223')],_0x55d0a9)[_0xbb10('0xc2')](function(_0x264837){_0x55d0a9[_0xbb10('0xd1')]-=_0x196bc0;_0x55d0a9['temp']=_0x55d0a9[_0xbb10('0xd1')]>0x0?_0x55d0a9[_0xbb10('0xd1')]:0x0;if(!checkContactEmpty(_0x264837)){_0x14ecd7[_0xbb10('0xc3')](_0x55d0a9)[_0xbb10('0xc2')](sendMessageReschedule(_0x55d0a9))[_0xbb10('0xbc')](loggerCatch(_0xbb10('0x224')));}else{_0x55d0a9[_0xbb10('0x7a')]+=_0x264837['length'];_0x55d0a9[_0xbb10('0x46')]=_0x55d0a9[_0xbb10('0x63')]==='booked'?_0xbb10('0x190'):'RUNNING';for(var _0xb427a4=0x0;_0xb427a4<_0x264837[_0xbb10('0xa5')];_0xb427a4+=0x1){if(_['isNil'](_0x264837[_0xb427a4])||_['isNil'](_0x264837[_0xb427a4]['Contact'])||_[_0xbb10('0xb8')](_0x264837[_0xb427a4]['phone'])){_0x14ecd7['emptyContact']('[actionOriginate]\x20',_0x55d0a9,_0x264837[_0xb427a4]);}else{_0x14ecd7['checkIsBlackList'](_[_0xbb10('0xdf')](_0x264837[_0xb427a4],[_0xbb10('0xe3'),_0xbb10('0x225')]))[_0xbb10('0xc2')](_0x14ecd7[_0xbb10('0x21f')](_0x55d0a9,_0x264837[_0xb427a4]))[_0xbb10('0xbc')](_0x14ecd7[_0xbb10('0xdd')](_0xbb10('0x226'),_0x55d0a9));}}}})[_0xbb10('0xbc')](loggerGetContactDialer('[getContactDialer2]',_0x55d0a9,_0x196bc0));}};Dialer[_0xbb10('0x1d')][_0xbb10('0x9d')]=function(_0x32b778){if(_0x32b778[_0xbb10('0x222')]>0x0){var _0x3152b0=_0x32b778[_0xbb10('0x222')]-_0x32b778['originated']-_0x32b778[_0xbb10('0x5d')];if(_0x3152b0>0x0){this[_0xbb10('0x227')](_0x32b778);}else{loggerPredictiveCalls[_0xbb10('0x89')](_0xbb10('0x228'));}}else{this[_0xbb10('0x227')](_0x32b778);}};Dialer[_0xbb10('0x1d')][_0xbb10('0x227')]=function(_0x260715){var _0x50fce7=this;var _0x23855a=[];_0x260715['originated']+=0x1;for(var _0x474af7 in this['agents']){if(typeof this['agents'][_0x474af7]!==_0xbb10('0xb7')){if(this[_0xbb10('0x25')][_0x474af7][_0xbb10('0x10f')]==='not_inuse'&&this['agents'][_0x474af7]['status']==='reachable'){_0x23855a[_0xbb10('0x162')](this[_0xbb10('0x25')][_0x474af7]['id']);}}}this['getContactDialer'](_0x260715['id'],_0x23855a,0x1,_0x260715['dialOrderByScheduledAt'],_0x260715)[_0xbb10('0xc2')](function(_0x37b4b2){if(!checkContactEmpty(_0x37b4b2)){checkContactLowerLimitOriginate(_0x260715,0x1,0x0);_0x50fce7['countReScheduled'](_0x260715)[_0xbb10('0xc2')](sendMessageReschedule(_0x260715))[_0xbb10('0xbc')](loggerCatch(_0xbb10('0x224')));}else{_0x260715[_0xbb10('0x46')]=_0xbb10('0x21d');if(_[_0xbb10('0xb8')](_0x37b4b2[0x0])||_[_0xbb10('0xb8')](_0x37b4b2[0x0][_0xbb10('0x1a2')])||_[_0xbb10('0xb8')](_0x37b4b2[0x0][_0xbb10('0x188')])){_0x50fce7[_0xbb10('0xde')]('[actionOriginate]\x20',_0x260715,_0x37b4b2[0x0]);}else{_0x50fce7[_0xbb10('0x229')](_[_0xbb10('0xdf')](_0x37b4b2[0x0],[_0xbb10('0xe3'),_0xbb10('0x225')]))[_0xbb10('0xc2')](_0x50fce7[_0xbb10('0x21f')](_0x260715,_0x37b4b2[0x0]))[_0xbb10('0xbc')](_0x50fce7['loggerHandler'](_0xbb10('0x22a'),_0x260715));}}})['catch'](loggerGetContactDialer(_0xbb10('0x22b'),_0x260715,0x1));emitVoiceQueueSummary(_0x260715);};Dialer[_0xbb10('0x1d')][_0xbb10('0x1f9')]=function(_0x2e34ea,_0x298e18,_0xbd394f,_0xf39c0d,_0x37be00,_0x11b9f7){loggerPredictive['info'](_0xbb10('0x22c'));loggerPredictive[_0xbb10('0x89')]('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',_0x2e34ea);loggerPredictive[_0xbb10('0x89')](_0xbb10('0x22d'),_0x298e18);loggerPredictive[_0xbb10('0x89')]('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',_0xbd394f);loggerPredictive[_0xbb10('0x89')]('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',_0xf39c0d);loggerPredictive['info'](_0xbb10('0x22e'),_0x37be00);loggerPredictive[_0xbb10('0x89')](_0xbb10('0x91'));return new Promise(function(_0x5153ef,_0x434580){if(_0x2e34ea<=0x0||isNaN(_0x2e34ea)){return _0x434580(msgResponse(_0xbb10('0x22f'),_0xbb10('0x51'),_0xbb10('0x230')+_0x2e34ea));}if(_0xbd394f<=0x0||isNaN(_0xbd394f)){return _0x434580(msgResponse(_0xbb10('0x22f'),'Error',_0xbb10('0x231')+_0xbd394f));}if(_0xf39c0d<=0x0||isNaN(_0xf39c0d)){return _0x434580(msgResponse('[abandonmentRate]',_0xbb10('0x51'),_0xbb10('0x232')+_0xf39c0d));}if(_0x298e18<=0x0||isNaN(_0x298e18)){return _0x434580(msgResponse('[abandonmentRate]','Error',_0xbb10('0x233')+_0x298e18));}if(_0x37be00<=0x0||isNaN(_0x37be00)){return _0x434580(msgResponse(_0xbb10('0x22f'),_0xbb10('0x51'),_0xbb10('0x234')+_0x37be00));}_0x11b9f7=_0x11b9f7||0x0;var _0x55e1eb=0x1/_0xbd394f;var _0x385a49=0x0;var _0x174892=0x0;var _0x45be3b=0x0;var _0x4269c9=0x0;for(var _0x1e7f42=0x0;_0x45be3b<_0x37be00;_0x1e7f42+=0x1){_0x174892=_0x1e7f42/_0x298e18;_0x385a49=(_0xf39c0d*_0x174892+_0x11b9f7)/_0x55e1eb;_0x45be3b=erlangb(_0x385a49,_0x2e34ea);_0x4269c9=_0x385a49/_0x2e34ea*(0x1-erlangb(_0x385a49,_0x2e34ea));}return _0x5153ef({'erlangCalls':_0x1e7f42,'erlangCallToSecond':_0x298e18/_0x1e7f42,'erlangAbandonmentRate':_0x45be3b,'erlangBusyFactor':_0x4269c9});});};Dialer[_0xbb10('0x1d')][_0xbb10('0x201')]=function(_0x397c33,_0x4e3f92,_0xf2ab83,_0x1ad4ec,_0x2cb4be,_0x2f66ba){loggerPredictive['info'](_0xbb10('0x235'));loggerPredictive[_0xbb10('0x89')](_0xbb10('0x236'),_0x397c33);loggerPredictive[_0xbb10('0x89')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4e3f92);loggerPredictive[_0xbb10('0x89')]('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',_0xf2ab83);loggerPredictive[_0xbb10('0x89')]('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',_0x1ad4ec);loggerPredictive[_0xbb10('0x89')](_0xbb10('0x237'),_0x2cb4be);loggerPredictive[_0xbb10('0x89')](_0xbb10('0x91'));return new Promise(function(_0x27adad,_0x5a6b68){if(_0x397c33<=0x0||isNaN(_0x397c33)){return _0x5a6b68(msgResponse(_0xbb10('0x238'),'Error','m\x20=\x20'+_0x397c33));}if(_0xf2ab83<=0x0||isNaN(_0xf2ab83)){return _0x5a6b68(msgResponse(_0xbb10('0x238'),_0xbb10('0x51'),_0xbb10('0x231')+_0xf2ab83));}if(_0x1ad4ec<=0x0||isNaN(_0x1ad4ec)){return _0x5a6b68(msgResponse(_0xbb10('0x238'),'Error',_0xbb10('0x232')+_0x1ad4ec));}if(_0x4e3f92<=0x0||isNaN(_0x4e3f92)){return _0x5a6b68(msgResponse('[busyFactor]','Error',_0xbb10('0x233')+_0x4e3f92));}if(_0x2cb4be<=0x0||isNaN(_0x2cb4be)){return _0x5a6b68(msgResponse('[busyFactor]','Error',_0xbb10('0x239')+_0x2cb4be));}_0x2f66ba=_0x2f66ba||0x0;var _0xb998a1=0x1/_0xf2ab83;var _0x248c5c=0x0;var _0x456ecb=0x0;var _0x1391b7=0x0;var _0x4d5ac5=0x0;for(var _0x366f17=0x0;_0x4d5ac5<_0x2cb4be;_0x366f17+=0x1){_0x456ecb=_0x366f17/_0x4e3f92;_0x248c5c=(_0x1ad4ec*_0x456ecb+_0x2f66ba)/_0xb998a1;_0x1391b7=erlangb(_0x248c5c,_0x397c33);_0x4d5ac5=_0x248c5c/_0x397c33*(0x1-erlangb(_0x248c5c,_0x397c33));}return _0x27adad({'erlangCalls':_0x366f17,'erlangCallToSecond':_0x4e3f92/_0x366f17,'erlangAbandonmentRate':_0x1391b7,'erlangBusyFactor':_0x4d5ac5});});};module[_0xbb10('0x23a')]=Dialer; \ No newline at end of file +var _0xb10b=['[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','[syncAgentComplete][createHistory][0]','countnosuchnumberretry','countdropretry','ivrAnswerCallsDay','dialQueueProject','AnswerAGI','AGI','[syncHangupIvr][createHistory]','[syncHangupIvr]','cause-txt','Unknow','reason','dialQueueProject2','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','Drop','dropreason','TIMEOUT','agiafterat','callAdditionalPhoneAfterMin','voiceQueue','additional','dialDropMaxRetry','dialDropRetryFrequency','calleridname','[syncAgentComplete][createHistory][10]','Abandoned','countabandonedretry','dialAbandonedRetryFrequency','dialAbandonedMaxRetry','minutes','calleridnum','[syncAgentComplete][createHistory][11]','actionid','strategy','locked','paused','stateinterface','queueBooked','queueStatusComplete','[booked][unlockQueueStatus]','idHopper','[Catch][Preview][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','run','[booked][RR][finaly]','[unlock][syncQueueStatusComplete]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','resetActiveCalls','syncCampaigns','checkIsTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','checkIfTime','checkIfTimeIntervals','ifTime','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','timezones','\x20Timezone\x20unknow\x20','isArray','command','iftime\x20%s,%s','interval','content','indexOf','push','true','all','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','progressive','handlePower','dialPowerLevel','method\x20not\x20recognized','checkPreviewRecallReminder','handlePreviewRecallNotifications','user:%s','user:dialPreviewRecallReminder','launchHandleIvr','handleIvr','dialGlobalInterval','dialTimezone','[syncQueueSummary]','filter','online','map','Agent','[syncCampaigns]','\x5cw{0,','pow','replace','random','match','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialQueueTimeout','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','Contact','tags','createdAt','updatedAt','%s%s','XMD-','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','originatecalleridname','XMD-ORIGINATECALLERIDNUM','variables','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','from-sip','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','responsetime','getQueue','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','countagentrejectretry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][Drop]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','NoAnswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','dialBusyMaxRetry','reason\x205\x20busy','congestion','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','dialPredictiveOptimizationPercentage','predictiveIntervalMaxThreshold','round','check\x20predictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive]','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','started\x20in\x20predictive\x20at','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','getDataPredictive','Predictive\x20for\x20every\x20interval',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','[getDataPredictive]','check\x20failure','getDataPredictiveOld','dropRate','outboundQueuePauses','[CatchErlangB]','busyFactor','floor','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','recallme','queueStatusComplete:\x20','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','Queue:\x20','scheduledat','dialRecallMeTimeout','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','checkContactBlack','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','dialOrderByScheduledAt','[countReScheduled]\x20','Contact.phone','[actionOriginate]\x20','tryOriginatePredictive','[handlePredictive][limitChannel]','checkIsBlackList','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\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','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','exports','util','uuid','moment','md5','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','syncQueueSummary','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopperHistory','../rpc/cmHopperAdditionalPhone','../rpc/cmHopperBlack','../rpc/setting','./history','./final','./agentComplete','./queueCallerAbandon','./hangup','env','127.0.0.1','rrmemory','roundrobin','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','startPredictive','startProgressive','queueBookedRR','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','syncHangup','newexten','syncNewExten','varset','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','getSettings','previewRecallmeReminderInterval','message','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','isEmpty','[ifTime][Action]','Error','milliseconds','diff','seconds','emit','type','answered','available','loggedIn','pTalking','sumBillable','sumDuration','talking','total','unmanaged','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalAvailable','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','Trunk','active','callerid','stringify','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','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','predictiveIntervalTotalCalls','isUndefined','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','clearing\x20variable\x20start\x20predictive','handlePredictive','outbound','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','debug','error','inspect','length','[decremetOriginate]\x20object\x20originated\x20is\x20negative','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','endtime','starttime','clearZombieChannels','[uniqueid]','[actions]','undefined','isNil','Action','status','channel','catch','updateOriginated','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','resolve','then','countReScheduled','[checkIsBlackList]\x20','verifyAdditionalPhones','swapAdditionalPhones','[swapAdditionalPhone]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','pick','ContactId','ListId','UserId','VoiceQueueId','CampaignId','[emptyContact]','isSuccess','Success','isTrunkReachable','SIP/%s','reachable','unmonitored','syncVarSet','uniqueid','variable','amdstatus','exten','xcally-motion-dialer','statedesc','membername','AMD','custom:amd','buildObj','amd','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','dialAMDActive','MACHINE','outboundAnswerAgiCallsDay','Machine','countglobal','countbusyretry','countcongestionretry','countnoanswerretry','countmachineretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','add','dialMachineRetryFrequency','YYYY-MM-DD\x20HH:mm:ss','[rescheduleContact][Machine]','value','state','HangupInAMD'];(function(_0x2e941e,_0x59bbec){var _0x4d6d52=function(_0x1f88db){while(--_0x1f88db){_0x2e941e['push'](_0x2e941e['shift']());}};_0x4d6d52(++_0x59bbec);}(_0xb10b,0x12a));var _0xbb10=function(_0x1900bd,_0x48a6b6){_0x1900bd=_0x1900bd-0x0;var _0x5c162e=_0xb10b[_0x1900bd];return _0x5c162e;};'use strict';var util=require(_0xbb10('0x0'));var _=require('lodash');var uuid=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var rr=require('rr');var md5=require(_0xbb10('0x3'));var Redis=require('ioredis');var ut=require(_0xbb10('0x4'));var config=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var loggerBooked=require(_0xbb10('0x6'))(_0xbb10('0x8'));var loggerPredictive=require('../../../config/logger')(_0xbb10('0x9'));var loggerPredictiveCalls=require(_0xbb10('0x6'))('predictiveCalls');var loggerSyncQueueSummary=require(_0xbb10('0x6'))(_0xbb10('0xa'));var ami=require(_0xbb10('0xb'));config[_0xbb10('0xc')]=_[_0xbb10('0xd')](config[_0xbb10('0xc')],{'host':_0xbb10('0xe'),'port':0x18eb});var io=require(_0xbb10('0xf'))(new Redis(config['redis']));var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require(_0xbb10('0x10'));var cmHopperAdditionalPhone=require(_0xbb10('0x11'));var cmHopperBlack=require(_0xbb10('0x12'));var voiceQueueRt=require('../rpc/voiceQueueRt');var RpcSetting=require(_0xbb10('0x13'));var Action=require('./action');var History=require(_0xbb10('0x14'));var Final=require(_0xbb10('0x15'));var AgentComplete=require(_0xbb10('0x16'));var QueueCallerAbandon=require(_0xbb10('0x17'));var Hangup=require(_0xbb10('0x18'));var ipAgi=process[_0xbb10('0x19')]['XCALLY_IP_AGI']||_0xbb10('0x1a');var strategy={'rrmemory':_0xbb10('0x1b'),'roundrobin':_0xbb10('0x1c')};var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0xbb10('0x1d')][_0xbb10('0x1e')]=function(_0x2f2ebf){this[_0xbb10('0x1f')]=this[_0xbb10('0x1f')]?this[_0xbb10('0x1f')][_0xbb10('0x20')](_0x2f2ebf):_0x2f2ebf();};function Dialer(_0x4a2bfc,_0x2eca0f){this[_0xbb10('0x21')]=new Sequence();this[_0xbb10('0x22')]=_0x2eca0f;this[_0xbb10('0x23')]=_0x4a2bfc[_0xbb10('0x23')];this[_0xbb10('0x24')]=_0x4a2bfc[_0xbb10('0x24')];this[_0xbb10('0x25')]=_0x4a2bfc[_0xbb10('0x25')];this[_0xbb10('0x26')]=_0x4a2bfc['trunks'];this[_0xbb10('0x27')]=config[_0xbb10('0x27')]||0x2;this[_0xbb10('0x28')]={};this[_0xbb10('0x29')]={};this[_0xbb10('0x2a')]={};this[_0xbb10('0x2b')]={};this['optionPredictive']={};this[_0xbb10('0x2c')]={};this[_0xbb10('0x2d')]={};this['ivrOriginated']={};this['queueBooked']={};this[_0xbb10('0x2e')]={};ami['on'](_0xbb10('0x2f'),this[_0xbb10('0x30')][_0xbb10('0x31')](this));ami['on'](_0xbb10('0x32'),this[_0xbb10('0x33')][_0xbb10('0x31')](this));ami['on'](_0xbb10('0x34'),this[_0xbb10('0x35')][_0xbb10('0x31')](this));ami['on'](_0xbb10('0x36'),this[_0xbb10('0x37')]['bind'](this));ami['on']('custom:queuesummary',this['syncQueueSummary'][_0xbb10('0x31')](this));ami['on'](_0xbb10('0x38'),this[_0xbb10('0x39')]['bind'](this));ami['on'](_0xbb10('0x3a'),this[_0xbb10('0x3b')][_0xbb10('0x31')](this));ami['on'](_0xbb10('0x3c'),this[_0xbb10('0x3d')][_0xbb10('0x31')](this));ami['on'](_0xbb10('0x3e'),this['syncVarSet'][_0xbb10('0x31')](this));ami['on'](_0xbb10('0x3f'),this[_0xbb10('0x40')][_0xbb10('0x31')](this));ami['on'](_0xbb10('0x41'),this[_0xbb10('0x42')]['bind'](this));this[_0xbb10('0x43')]();this['loopClearZombieChannels']();RpcSetting[_0xbb10('0x44')]()['then'](function(_0x16ad2a){previewRecallmeReminderInterval=_0x16ad2a[_0xbb10('0x45')];});}function isNotNull(_0x1b59f9){return _0x1b59f9!==null&&!_['isUndefined'](_0x1b59f9);}function checkIsLoggedIn(_0x518d47,_0x4c3744){return function(){if(_0x4c3744<=0x0){_0x518d47[_0xbb10('0x46')]='AGENTS_NOT_LOGGED';throw _0x518d47[_0xbb10('0x47')]+_0xbb10('0x48');}};}function isActive(_0x2f653f){return _0x2f653f;}function checkIsActive(_0x1c0b57,_0x37a83f){return function(){if(!isActive(_0x37a83f)){_0x1c0b57[_0xbb10('0x46')]=_0xbb10('0x49');throw _0x1c0b57['name']+_0xbb10('0x4a');}};}function checkInterval(_0x1da9c9){return function(){if(!isNotNull(_0x1da9c9[_0xbb10('0x4b')])){_0x1da9c9[_0xbb10('0x46')]=_0xbb10('0x4c');throw _0x1da9c9[_0xbb10('0x47')]+_0xbb10('0x4d');}if(!isNotNull(_0x1da9c9[_0xbb10('0x4b')][_0xbb10('0x4e')])){_0x1da9c9['message']=_0xbb10('0x4c');throw _0x1da9c9[_0xbb10('0x47')]+_0xbb10('0x4d');}if(!isNotNull(_[_0xbb10('0x4f')](_0x1da9c9['Interval'][_0xbb10('0x4e')]))){_0x1da9c9['message']='INTERVAL_IS_NULL';throw _0x1da9c9[_0xbb10('0x47')]+_0xbb10('0x4d');}};}function msgResponse(_0x26e76a,_0x120d21,_0x15d895){return{'action':_0x26e76a,'response':_0x120d21,'message':_0x15d895,'stack':_0x15d895};}function myreject(_0x29d11a){return function(_0x547062){return _0x29d11a(msgResponse(_0xbb10('0x50'),_0xbb10('0x51'),JSON['stringify'](_0x547062)));};}function getSeconds(_0x5e3fbd,_0x5cd55f){var _0x31bee3=moment(_0x5e3fbd)[_0xbb10('0x52')](0x0);var _0x2b658a=moment(_0x5cd55f)['milliseconds'](0x0);return _0x31bee3[_0xbb10('0x53')](_0x2b658a,_0xbb10('0x54'));}function emit(_0x4345f3,_0x4d1a83,_0x17b6c5){io['to'](_0x4345f3)[_0xbb10('0x55')](_0x4d1a83,_0x17b6c5);}function emitVoiceQueueSummary(_0x1dcd38){if(_0x1dcd38[_0xbb10('0x56')]==='outbound'){var _0xd238e9={'id':_0x1dcd38['id'],'name':_0x1dcd38[_0xbb10('0x47')],'strategy':_0x1dcd38['strategy'],'answered':_0x1dcd38[_0xbb10('0x57')],'available':_0x1dcd38[_0xbb10('0x58')],'loggedIn':_0x1dcd38[_0xbb10('0x59')],'pTalking':_0x1dcd38[_0xbb10('0x5a')],'sumBillable':_0x1dcd38[_0xbb10('0x5b')],'sumDuration':_0x1dcd38[_0xbb10('0x5c')],'sumHoldTime':_0x1dcd38['sumHoldTime']||0x0,'talking':_0x1dcd38[_0xbb10('0x5d')],'total':_0x1dcd38[_0xbb10('0x5e')],'type':_0x1dcd38[_0xbb10('0x56')],'unmanaged':_0x1dcd38[_0xbb10('0x5f')],'abandoned':_0x1dcd38['abandoned'],'waiting':_0x1dcd38[_0xbb10('0x60')],'loggedInDb':_0x1dcd38[_0xbb10('0x61')],'dialActive':_0x1dcd38[_0xbb10('0x62')],'dialMethod':_0x1dcd38[_0xbb10('0x63')],'dialOriginateCallerIdName':_0x1dcd38['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x1dcd38[_0xbb10('0x64')],'dialOriginateTimeout':_0x1dcd38[_0xbb10('0x65')],'dialPrefix':_0x1dcd38['dialPrefix'],'outboundAnswerAgiCallsDay':_0x1dcd38['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x1dcd38[_0xbb10('0x66')],'outboundBlacklistCallsDay':_0x1dcd38['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x1dcd38[_0xbb10('0x67')],'outboundCongestionCallsDay':_0x1dcd38[_0xbb10('0x68')],'outboundDropCallsDayACS':_0x1dcd38['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x1dcd38[_0xbb10('0x69')],'outboundDropCallsDayTimeout':_0x1dcd38[_0xbb10('0x6a')],'outboundNoAnswerCallsDay':_0x1dcd38[_0xbb10('0x6b')],'outboundNoSuchCallsDay':_0x1dcd38['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x1dcd38[_0xbb10('0x6c')],'outboundReCallsDay':_0x1dcd38[_0xbb10('0x6d')],'outboundRejectCallsDay':_0x1dcd38[_0xbb10('0x6e')],'outboundUnknownCallsDay':_0x1dcd38[_0xbb10('0x6f')],'predictiveIntervalAnsweredCalls':_0x1dcd38[_0xbb10('0x70')],'predictiveIntervalAvgHoldtime':_0x1dcd38[_0xbb10('0x71')],'predictiveIntervalAvgTalktime':_0x1dcd38[_0xbb10('0x72')],'predictiveIntervalDroppedCallsCallersExit':_0x1dcd38[_0xbb10('0x73')],'predictiveIntervalDroppedCallsTimeout':_0x1dcd38[_0xbb10('0x74')],'predictiveIntervalErlangCalls':_0x1dcd38[_0xbb10('0x75')],'predictiveIntervalErlangCallsDroppedCalls':_0x1dcd38[_0xbb10('0x76')],'predictiveIntervalHitRate':_0x1dcd38[_0xbb10('0x77')],'predictiveIntervalMultiplicativeFactor':_0x1dcd38['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x1dcd38[_0xbb10('0x78')],'predictiveIntervalAvailable':_0x1dcd38[_0xbb10('0x79')],'predictiveIntervalTotalCalls':_0x1dcd38['predictiveIntervalTotalCalls'],'message':_0x1dcd38[_0xbb10('0x46')],'originated':_0x1dcd38[_0xbb10('0x7a')],'erlangCalls':_0x1dcd38[_0xbb10('0x7b')],'erlangCallToSecond':_0x1dcd38[_0xbb10('0x7c')],'erlangAbandonmentRate':_0x1dcd38[_0xbb10('0x7d')],'erlangBusyFactor':_0x1dcd38[_0xbb10('0x7e')],'startPredictive':_0x1dcd38[_0xbb10('0x2c')],'startProgressive':_0x1dcd38['startProgressive']};if(_0x1dcd38['Trunk']){_0xd238e9[_0xbb10('0x7f')]={'id':_0x1dcd38[_0xbb10('0x7f')]['id'],'name':_0x1dcd38[_0xbb10('0x7f')]['name'],'active':_0x1dcd38['Trunk'][_0xbb10('0x80')],'callerid':_0x1dcd38[_0xbb10('0x7f')][_0xbb10('0x81')]};}if(_0x1dcd38[_0xbb10('0x4b')]){_0xd238e9[_0xbb10('0x4b')]={'id':_0x1dcd38[_0xbb10('0x4b')]['id'],'name':_0x1dcd38[_0xbb10('0x4b')][_0xbb10('0x47')]};}var _0x2626d8=md5(JSON[_0xbb10('0x82')](_0xd238e9));if(_0x1dcd38['md5']!==_0x2626d8){_0x1dcd38['md5']=_0x2626d8;emit(util[_0xbb10('0x83')](_0xbb10('0x84'),_0xd238e9[_0xbb10('0x47')]),_0xbb10('0x85'),_0xd238e9);}}}function emitCampaignSummary(_0x36aa7d){if(_0x36aa7d[_0xbb10('0x56')]===_0xbb10('0x86')){emit(util[_0xbb10('0x83')](_0xbb10('0x87'),_0x36aa7d[_0xbb10('0x47')]),_0xbb10('0x88'),_0x36aa7d);}}function checkGetDataPredictive(_0x20e18a){if(isNotNull(_0x20e18a)&&!_[_0xbb10('0x4f')](_0x20e18a)){loggerPredictive[_0xbb10('0x89')](_0xbb10('0x8a'));loggerPredictive['info'](_0xbb10('0x8b'),_0x20e18a['predictiveIntervalTotalCalls']);loggerPredictive[_0xbb10('0x89')](_0xbb10('0x8c'),_0x20e18a[_0xbb10('0x70')]);loggerPredictive[_0xbb10('0x89')](_0xbb10('0x8d'),_0x20e18a[_0xbb10('0x74')]);loggerPredictive[_0xbb10('0x89')](_0xbb10('0x8e'),_0x20e18a[_0xbb10('0x73')]);loggerPredictive[_0xbb10('0x89')](_0xbb10('0x8f'),_0x20e18a[_0xbb10('0x71')]);loggerPredictive[_0xbb10('0x89')](_0xbb10('0x90'),_0x20e18a[_0xbb10('0x72')]);loggerPredictive['info'](_0xbb10('0x91'));if(_0x20e18a[_0xbb10('0x92')]>0x0){if(!_[_0xbb10('0x93')](_0x20e18a[_0xbb10('0x72')])&&_0x20e18a[_0xbb10('0x72')]>0x0){return!![];}loggerPredictive[_0xbb10('0x89')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_[_0xbb10('0x93')](_0x20e18a[_0xbb10('0x71')])&&_0x20e18a[_0xbb10('0x71')]>0x0){return!![];}loggerPredictive[_0xbb10('0x89')](_0xbb10('0x94'));}else{loggerPredictive[_0xbb10('0x89')](_0xbb10('0x95'));}}else{loggerPredictive[_0xbb10('0x89')](_0xbb10('0x96'));}return![];}function mergeDataErlangB(_0x40c4fb){return function(_0x2eb05a){loggerPredictive[_0xbb10('0x89')](_0xbb10('0x97'));loggerPredictive['info']('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2eb05a[_0xbb10('0x7b')]);loggerPredictive[_0xbb10('0x89')](_0xbb10('0x98'),_0x2eb05a[_0xbb10('0x7c')]);loggerPredictive['info']('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2eb05a[_0xbb10('0x7d')]);loggerPredictive[_0xbb10('0x89')](_0xbb10('0x99'),_0x2eb05a[_0xbb10('0x7e')]);loggerPredictive[_0xbb10('0x89')](_0xbb10('0x9a'),_0x2eb05a[_0xbb10('0x7d')]);loggerPredictive['info'](_0xbb10('0x91'));_[_0xbb10('0x9b')](_0x40c4fb,_0x2eb05a);};}function getDiff(_0x4917a5){var _0x5e03cb=moment()['milliseconds'](0x0);var _0x32c1e8=moment(_0x4917a5)[_0xbb10('0x52')](0x0);return _0x5e03cb[_0xbb10('0x53')](_0x32c1e8,'seconds');}function ifInterval(_0x4e6e7c,_0x5846d1){if(_[_0xbb10('0x93')](_0x5846d1)){return![];}return getDiff(_0x5846d1)<_0x4e6e7c*0x3c;}function freeVariablesPredictive(_0x249b33){if(isNotNull(_0x249b33)){if(!_[_0xbb10('0x93')](_0x249b33['startProgressive'])){_0x249b33[_0xbb10('0x2d')]=undefined;loggerPredictive[_0xbb10('0x89')](_0x249b33['name'],'clearing\x20variable\x20start\x20progressive');}if(!_[_0xbb10('0x93')](_0x249b33[_0xbb10('0x2c')])){_0x249b33[_0xbb10('0x2c')]=undefined;loggerPredictive[_0xbb10('0x89')](_0x249b33['name'],_0xbb10('0x9c'));}if(!_[_0xbb10('0x93')](_0x249b33[_0xbb10('0x9d')])){clearInterval(_0x249b33['handlePredictive']);_0x249b33[_0xbb10('0x9d')]=undefined;loggerPredictive[_0xbb10('0x89')](_0x249b33[_0xbb10('0x47')],'clearing\x20variable\x20handle\x20predictive');}}}function erlangb(_0x2ca491,_0x31e85e){if(_0x31e85e===0x0){return 0x0;}var _0x3b0f08=0x1;for(var _0x37b65f=0x1;_0x37b65f<=_0x31e85e;_0x37b65f+=0x1){_0x3b0f08=0x1+_0x3b0f08*_0x37b65f/_0x2ca491;}return 0x1/_0x3b0f08;}function isVoiceQueueOutbound(_0x5e4a6e){return _0x5e4a6e===_0xbb10('0x9e');}function isNotPreview(_0x258e55){return _0x258e55!==_0xbb10('0x22');}function isCampaignIvr(_0x2d0f4b){return _0x2d0f4b==='ivr';}function getCallerId(_0x354ea7,_0x277fe7,_0x2a166e){if(!_[_0xbb10('0x93')](_0x2a166e)&&typeof _0x2a166e===_0xbb10('0x9f')&&!_[_0xbb10('0x4f')](_0x2a166e)){if(!_[_0xbb10('0x93')](_0x277fe7)&&typeof _0x277fe7==='string'&&!_['isEmpty'](_0x277fe7)){return util['format'](_0xbb10('0xa0'),_0x277fe7,_0x2a166e);}return util[_0xbb10('0x83')](_0xbb10('0xa0'),_0x2a166e,_0x2a166e);}if(!_['isUndefined'](_0x354ea7)&&typeof _0x354ea7==='string'&&!_[_0xbb10('0x4f')](_0x354ea7)){return _0x354ea7;}return _0xbb10('0xa1');}function loggerCatchQueueSummary(_0xd9e743,_0x3a9677){return function(_0x260e06){freeVariablesPredictive(_0x3a9677);emitVoiceQueueSummary(_0x3a9677);emitCampaignSummary(_0x3a9677);loggerSyncQueueSummary[_0xbb10('0xa2')](_0xd9e743,util['inspect'](_0x260e06,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x1a5ca5,_0x15fae2){return function(_0x270fdb){loggerPredictive[_0xbb10('0xa3')](_0x15fae2[_0xbb10('0x47')],_0x1a5ca5);loggerPredictive['error'](_0x270fdb['stack']);freeVariablesPredictive(_0x15fae2);};}function loggerCatch(_0x5ad6ad){return function(_0x329da7){logger[_0xbb10('0xa3')](_0x5ad6ad,util[_0xbb10('0xa4')](_0x329da7,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x21459e){return _0x21459e&&!_[_0xbb10('0x93')](_0x21459e)&&_0x21459e[_0xbb10('0xa5')]>0x0;}function decremetOriginate(_0x5d942d){if(!_[_0xbb10('0x93')](_0x5d942d)&&_0x5d942d!==null){if(typeof _0x5d942d['originated']!=='undefined'){if(_0x5d942d['originated']>0x0){_0x5d942d[_0xbb10('0x7a')]-=0x1;}else{logger[_0xbb10('0xa3')](_0xbb10('0xa6'));}}}else{logger[_0xbb10('0xa3')]('[decremetOriginate]\x20is\x20null\x20or\x20undefined');}}function checkContactLowerLimitOriginate(_0x122d38,_0x5c583b,_0x576179){if(_0x5c583b>_0x576179){for(var _0x165fe9=0x0;_0x165fe9<_0x5c583b-_0x576179;_0x165fe9+=0x1){decremetOriginate(_0x122d38);}}}function loggerGetContactDialer(_0xfe3db0,_0x29529c,_0x2bd2ab){return function(_0xfa3c7c){checkContactLowerLimitOriginate(_0x29529c,_0x2bd2ab,0x0);logger['error'](_0xfe3db0,util[_0xbb10('0xa4')](_0xfa3c7c,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x19fcec){return function(_0x2c6429){if(isNotNull(_0x2c6429)&&isNotNull(_0x2c6429[0x0])){if(_0x2c6429[0x0][_0xbb10('0xa7')]>0x0){_0x19fcec[_0xbb10('0x46')]=_0xbb10('0xa8');logger[_0xbb10('0x89')]('[getContactDialer2][ReScheduled]'+_0x19fcec[_0xbb10('0x47')],_0x2c6429[0x0][_0xbb10('0xa7')],_0xbb10('0xa9'));}else{_0x19fcec[_0xbb10('0x46')]=_0xbb10('0xaa');logger[_0xbb10('0x89')](_0xbb10('0xab')+_0x19fcec[_0xbb10('0x47')]);}}};}function notSendMessagesQueue(_0x5a4429){if(_0x5a4429[_0xbb10('0xac')]){freeVariablesPredictive(_0x5a4429);if(_0x5a4429[_0xbb10('0x7a')]===0x0&&_0x5a4429[_0xbb10('0x5d')]===0x0&&_0x5a4429['waiting']===0x0&&(_0x5a4429['pTalking']||0x0)===0x0){_0x5a4429['sendMessageOneNotActive']=![];_0x5a4429[_0xbb10('0x58')]=0x0;_0x5a4429['message']='NOT_ACTIVE';loggerSyncQueueSummary[_0xbb10('0xa2')](_0xbb10('0xad'),_0x5a4429[_0xbb10('0x47')],_0xbb10('0xae'));}else{_0x5a4429[_0xbb10('0x46')]=_0xbb10('0xaf');loggerSyncQueueSummary[_0xbb10('0xa2')](_0xbb10('0xad'),_0x5a4429[_0xbb10('0x47')],'is\x20disactive');}emitVoiceQueueSummary(_0x5a4429);}}function notSendMessagesCampaign(_0x318a14){if(_0x318a14[_0xbb10('0xac')]){if(_0x318a14[_0xbb10('0x7a')]===0x0){_0x318a14[_0xbb10('0xac')]=![];_0x318a14['message']='NOT_ACTIVE';loggerSyncQueueSummary[_0xbb10('0xa2')](_0xbb10('0xb0'),_0x318a14[_0xbb10('0x47')],_0xbb10('0xae'));}else{_0x318a14['message']=_0xbb10('0xaf');loggerSyncQueueSummary[_0xbb10('0xa2')](_0xbb10('0xb0'),_0x318a14[_0xbb10('0x47')],_0xbb10('0xb1'));}emitCampaignSummary(_0x318a14);}}function createObjHistory(_0x517185,_0x5f0691,_0x372636,_0x53c698,_0x22c030){_0x517185['message']=_0x372636;var _0x256b35=new Action(_0x517185,_0x5f0691);var _0x13e2ab=new History(_0x256b35);_0x13e2ab['state']=_0x53c698;_0x13e2ab['statedesc']=_0x22c030;_0x13e2ab[_0xbb10('0xb2')]=_0x256b35[_0xbb10('0xb3')];return _0x13e2ab;}Dialer[_0xbb10('0x1d')]['loopClearZombieChannels']=function(){var _0x32d5a5=this;setInterval(function(){_0x32d5a5[_0xbb10('0xb4')](_0x32d5a5[_0xbb10('0x2b')],_0xbb10('0xb5'));_0x32d5a5[_0xbb10('0xb4')](_0x32d5a5[_0xbb10('0x29')],_0xbb10('0xb6'));},0x32c8);};Dialer[_0xbb10('0x1d')][_0xbb10('0xb4')]=function(_0x479d51,_0x3367d4){var _0x28cc46=this;for(var _0x412fbf in _0x479d51){if(typeof _0x479d51[_0x412fbf]!==_0xbb10('0xb7')){this[_0xbb10('0x21')][_0xbb10('0x1e')](function(){if(!_[_0xbb10('0xb8')](_0x479d51[_0x412fbf])){return ami[_0xbb10('0xb9')]({'action':_0xbb10('0xba'),'channel':_0x479d51[_0x412fbf][_0xbb10('0xbb')]})[_0xbb10('0xbc')](function(_0x2a4278){if(_0x2a4278['message']==='No\x20such\x20channel'){setTimeout(function(){if(_0x479d51[_0x412fbf]&&_0x479d51[_0x412fbf][_0xbb10('0x56')]!==_0xbb10('0x86')){_0x28cc46[_0xbb10('0xbd')](_0x28cc46[_0xbb10('0x23')][_0x479d51[_0x412fbf][_0xbb10('0xbe')]]);logger['error'](_0xbb10('0xbf'),_0x3367d4,_0x412fbf,_0x479d51[_0x412fbf][_0xbb10('0xbe')]);delete _0x479d51[_0x412fbf];}if(_0x479d51[_0x412fbf]&&_0x479d51[_0x412fbf][_0xbb10('0x56')]===_0xbb10('0x86')){_0x28cc46[_0xbb10('0xbd')](_0x28cc46[_0xbb10('0x24')][_0x479d51[_0x412fbf]['queue']]);logger[_0xbb10('0xa3')](_0xbb10('0xc0'),_0x3367d4,_0x412fbf,_0x479d51[_0x412fbf]['queue']);delete _0x479d51[_0x412fbf];}},0x2328);}});}});}}};Dialer[_0xbb10('0x1d')]['countReScheduled']=function(_0xc53c87){return Promise[_0xbb10('0xc1')]()[_0xbb10('0xc2')](cmHopper[_0xbb10('0xc3')](_0xc53c87))[_0xbb10('0xbc')](loggerCatch('[countReScheduled]\x20'));};Dialer[_0xbb10('0x1d')]['checkIsBlackList']=function(_0x3fcc55){return Promise[_0xbb10('0xc1')]()['then'](cmHopperBlack['checkIsBlackList'](_0x3fcc55))[_0xbb10('0xbc')](loggerCatch(_0xbb10('0xc4')));};Dialer[_0xbb10('0x1d')][_0xbb10('0xc5')]=function(_0x18d18d,_0x1cb22f,_0x1b6ebc){return Promise[_0xbb10('0xc1')]()[_0xbb10('0xc2')](cmHopperAdditionalPhone[_0xbb10('0xc5')](_0x18d18d,_0x1cb22f,_0x1b6ebc))[_0xbb10('0xbc')](loggerCatch('[verifyAdditionalPhone]\x20'));};Dialer[_0xbb10('0x1d')][_0xbb10('0xc6')]=function(_0x1b0a6c,_0xcd5d35,_0xfe02f5){return Promise[_0xbb10('0xc1')]()[_0xbb10('0xc2')](cmHopperAdditionalPhone[_0xbb10('0xc6')](_0x1b0a6c,_0xcd5d35,_0xfe02f5))[_0xbb10('0xbc')](loggerCatch(_0xbb10('0xc7')));};Dialer[_0xbb10('0x1d')][_0xbb10('0xc8')]=function(_0x499b9d){return Promise[_0xbb10('0xc1')]()['then'](cmHopperBlack[_0xbb10('0xc8')](_0x499b9d))[_0xbb10('0xbc')](loggerCatch(_0xbb10('0xc9')));};Dialer[_0xbb10('0x1d')][_0xbb10('0xca')]=function(_0x5371d4){return Promise[_0xbb10('0xc1')]()[_0xbb10('0xc2')](cmHopperHistory[_0xbb10('0xcb')](_0x5371d4))[_0xbb10('0xbc')](loggerCatch(_0xbb10('0xcc')));};Dialer[_0xbb10('0x1d')]['rescheduleContact']=function(_0x4bd470){return Promise[_0xbb10('0xc1')]()[_0xbb10('0xc2')](cmHopper[_0xbb10('0xcd')](_0x4bd470))['catch'](loggerCatch(_0xbb10('0xce')));};Dialer[_0xbb10('0x1d')]['unlockContact']=function(_0x2831de,_0xaede56,_0x5642c3){return Promise[_0xbb10('0xc1')]()['then'](cmHopper[_0xbb10('0xcf')](_0x2831de,_0xaede56,_0x5642c3))[_0xbb10('0xbc')](loggerCatch('[unlockContact]\x20'));};Dialer[_0xbb10('0x1d')][_0xbb10('0xd0')]=function(_0x4bac29,_0x5dae56,_0xea6bf2,_0x13ae83,_0x3e0e34){return Promise[_0xbb10('0xc1')]()[_0xbb10('0xc2')](cmHopper['getContactDialer'](_0x4bac29,_0x5dae56,_0xea6bf2,_0x13ae83))[_0xbb10('0xbc')](function(_0x9f2e0f){_0x3e0e34[_0xbb10('0xd1')]-=_0xea6bf2;_0x3e0e34['temp']=_0x3e0e34[_0xbb10('0xd1')]>0x0?_0x3e0e34[_0xbb10('0xd1')]:0x0;loggerCatch(_0xbb10('0xd2'))(_0x9f2e0f);});};Dialer[_0xbb10('0x1d')][_0xbb10('0xd3')]=function(_0xf5b08a,_0x1f55d3,_0x189f07,_0x2010d4){return Promise['resolve']()['then'](cmHopper[_0xbb10('0xd3')](_0xf5b08a,_0x1f55d3,_0x189f07))[_0xbb10('0xbc')](function(_0x293f3f){_0x2010d4[_0xbb10('0xd1')]-=_0x1f55d3;_0x2010d4[_0xbb10('0xd1')]=_0x2010d4[_0xbb10('0xd1')]>0x0?_0x2010d4[_0xbb10('0xd1')]:0x0;loggerCatch(_0xbb10('0xd4'))(_0x293f3f);});};Dialer[_0xbb10('0x1d')][_0xbb10('0xd5')]=function(_0xcbaf69){return Promise[_0xbb10('0xc1')]()[_0xbb10('0xc2')](voiceQueueRt['getVoiceQueueRtPauses'](_0xcbaf69))[_0xbb10('0xbc')](loggerCatch(_0xbb10('0xd6')));};Dialer[_0xbb10('0x1d')][_0xbb10('0xd7')]=function(_0x29eff4){return Promise[_0xbb10('0xc1')]()[_0xbb10('0xc2')](cmHopper[_0xbb10('0xd7')](_0x29eff4))[_0xbb10('0xbc')](loggerCatch(_0xbb10('0xd8')));};Dialer[_0xbb10('0x1d')]['createHistory']=function(_0x2c2ad7){return Promise['resolve']()[_0xbb10('0xc2')](cmHopperHistory[_0xbb10('0xd9')](_0x2c2ad7))[_0xbb10('0xbc')](loggerCatch(_0xbb10('0xda')));};Dialer[_0xbb10('0x1d')][_0xbb10('0xbd')]=function(_0x4e9cad){if(!_[_0xbb10('0x93')](_0x4e9cad)&&_0x4e9cad!==null){if(typeof _0x4e9cad['originated']!==_0xbb10('0xb7')){if(_0x4e9cad[_0xbb10('0x7a')]>0x0){_0x4e9cad[_0xbb10('0x7a')]-=0x1;}else{logger[_0xbb10('0xa3')](_0xbb10('0xdb'));}}}else{logger[_0xbb10('0xa3')](_0xbb10('0xdc'));}};Dialer[_0xbb10('0x1d')][_0xbb10('0xdd')]=function(_0xf4fd1,_0x13efa1){var _0xa09041=this;return function(_0x589565){_0xa09041[_0xbb10('0xbd')](_0x13efa1);logger['error'](_0xf4fd1,util[_0xbb10('0xa4')](_0x589565,{'showHidden':![],'depth':null}));};};Dialer[_0xbb10('0x1d')][_0xbb10('0xde')]=function(_0x7673a0,_0x44c229,_0x40271f){var _0x185ec9={'state':0x19,'statedesc':'notFound'};this[_0xbb10('0xbd')](_0x44c229);this['saveInDb'](_['merge'](_0x185ec9,_[_0xbb10('0xdf')](_0x40271f,[_0xbb10('0xe0'),_0xbb10('0xe1'),_0xbb10('0xe2'),_0xbb10('0xe3'),_0xbb10('0xe4')])),'[emptyContact][createHistory]',_0xbb10('0xe5'));logger[_0xbb10('0xa3')](_0x7673a0);};Dialer[_0xbb10('0x1d')][_0xbb10('0xe6')]=function(_0x136520){return _0x136520===_0xbb10('0xe7');};Dialer['prototype'][_0xbb10('0xe8')]=function(_0x4093a4){return!_[_0xbb10('0x93')](_0x4093a4)&&_0x4093a4&&!_[_0xbb10('0x93')](_0x4093a4[_0xbb10('0x47')])&&!_[_0xbb10('0x93')](_0x4093a4[_0xbb10('0x80')])&&_0x4093a4['active']&&(this[_0xbb10('0x26')][util['format'](_0xbb10('0xe9'),_0x4093a4['name'])]['status']===_0xbb10('0xea')||this[_0xbb10('0x26')][util[_0xbb10('0x83')](_0xbb10('0xe9'),_0x4093a4[_0xbb10('0x47')])]['status']===_0xbb10('0xeb'));};Dialer['prototype']['saveInDb']=function(_0x4dd138,_0xa00798,_0x207e76){this[_0xbb10('0xd9')](_0x4dd138)[_0xbb10('0xbc')](loggerCatch(_0xa00798));this[_0xbb10('0xd7')](_0x4dd138)['catch'](loggerCatch(_0x207e76));};Dialer[_0xbb10('0x1d')][_0xbb10('0xec')]=function(_0x352de4){var _0x1bd1c1=this;var _0x4b3b21=this[_0xbb10('0x2b')][_0x352de4[_0xbb10('0xed')]];var _0x485c1a;if(!_['isNil'](_0x352de4)&&!_['isNil'](_0x352de4[_0xbb10('0xee')])&&!_[_0xbb10('0xb8')](_0x352de4[_0xbb10('0xee')][_0xbb10('0xef')])&&_0x352de4[_0xbb10('0xf0')]===_0xbb10('0xf1')&&_0x4b3b21){if(_0x4b3b21[_0xbb10('0x56')]!==_0xbb10('0x86')&&this[_0xbb10('0x23')][_0x4b3b21[_0xbb10('0xbe')]]['dialAMDActive']&&_0x352de4['value']==='HANGUP'){delete this[_0xbb10('0x2b')][_0x352de4[_0xbb10('0xed')]];this[_0xbb10('0xbd')](this['voiceQueues'][_0x4b3b21[_0xbb10('0xbe')]]);this[_0xbb10('0x23')][_0x4b3b21[_0xbb10('0xbe')]][_0xbb10('0x66')]+=0x1;this[_0xbb10('0x23')][_0x4b3b21[_0xbb10('0xbe')]]['outboundAnswerAgiCallsDay']+=0x1;_0x485c1a=new Hangup(_0x4b3b21,_0x352de4);_0x485c1a['state']=0x12;_0x485c1a[_0xbb10('0xf2')]='HangupInAMD';_0x485c1a[_0xbb10('0xf3')]=_0xbb10('0xf4');ami[_0xbb10('0x55')](_0xbb10('0xf5'),ut[_0xbb10('0xf6')](_0x485c1a,_0xbb10('0xf7')));this[_0xbb10('0xf8')](_0x485c1a,_0xbb10('0xf9'),_0xbb10('0xfa'));}if(_0x4b3b21[_0xbb10('0x56')]!=='ivr'&&this[_0xbb10('0x23')][_0x4b3b21['queue']][_0xbb10('0xfb')]&&_0x352de4['value']===_0xbb10('0xfc')){return new Promise(function(_0x2cd825,_0x2adbbc){delete _0x1bd1c1[_0xbb10('0x2b')][_0x352de4['uniqueid']];_0x1bd1c1[_0xbb10('0xbd')](_0x1bd1c1['voiceQueues'][_0x4b3b21[_0xbb10('0xbe')]]);_0x1bd1c1[_0xbb10('0x23')][_0x4b3b21[_0xbb10('0xbe')]]['outboundAnswerCallsDay']+=0x1;_0x1bd1c1[_0xbb10('0x23')][_0x4b3b21[_0xbb10('0xbe')]][_0xbb10('0xfd')]+=0x1;var _0x18a44f=_0x1bd1c1[_0xbb10('0x23')][_0x4b3b21[_0xbb10('0xbe')]];var _0x56ddaa=new Hangup(_0x4b3b21,_0x352de4);_0x56ddaa['state']=0x13;_0x56ddaa['statedesc']=_0xbb10('0xfe');_0x56ddaa['membername']=_0xbb10('0xf4');_0x56ddaa['countmachineretry']+=0x1;_0x56ddaa[_0xbb10('0xff')]+=0x1;_0x56ddaa[_0xbb10('0xf7')]=!![];ami[_0xbb10('0x55')]('custom:amd',ut['buildObj'](_0x56ddaa,_0xbb10('0xf7')));_0x1bd1c1[_0xbb10('0xd9')](_0x56ddaa)[_0xbb10('0xbc')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x56ddaa[_0xbb10('0x100')]+_0x56ddaa[_0xbb10('0x101')]+_0x56ddaa[_0xbb10('0x102')]+_0x56ddaa['countnosuchnumberretry']+_0x56ddaa['countdropretry']+_0x56ddaa['countabandonedretry']+_0x56ddaa[_0xbb10('0x103')]+_0x56ddaa['countagentrejectretry']>=_0x18a44f[_0xbb10('0x104')]){_0x1bd1c1[_0xbb10('0x105')](_0x56ddaa,_0x2cd825,_0x2adbbc,_0xbb10('0x106'));}else{if(_0x56ddaa[_0xbb10('0x103')]>=_0x18a44f[_0xbb10('0x107')]){_0x1bd1c1[_0xbb10('0x108')](_0x56ddaa,_0x2cd825,_0x2adbbc,_0xbb10('0x109'));}else{_0x1bd1c1[_0xbb10('0xcd')]({'active':![],'countmachineretry':_0x56ddaa[_0xbb10('0x103')],'scheduledat':moment()[_0xbb10('0x10a')](_0x18a44f[_0xbb10('0x10b')],'minutes')[_0xbb10('0x83')](_0xbb10('0x10c')),'ContactId':_0x56ddaa['ContactId'],'ListId':_0x56ddaa[_0xbb10('0xe1')],'VoiceQueueId':_0x56ddaa['VoiceQueueId']||undefined,'CampaignId':_0x56ddaa['CampaignId']||undefined})[_0xbb10('0xbc')](loggerCatch(_0xbb10('0x10d')));_0x2cd825({'reschedule':0x1});}}});}if(_0x4b3b21[_0xbb10('0x56')]===_0xbb10('0x86')&&this[_0xbb10('0x24')][_0x4b3b21['queue']][_0xbb10('0xfb')]&&_0x352de4[_0xbb10('0x10e')]==='HANGUP'){delete this[_0xbb10('0x2b')][_0x352de4[_0xbb10('0xed')]];this['updateOriginated'](this[_0xbb10('0x24')][_0x4b3b21['queue']]);_0x485c1a=new Hangup(_0x4b3b21,_0x352de4);_0x485c1a[_0xbb10('0x10f')]=0x12;_0x485c1a[_0xbb10('0xf2')]=_0xbb10('0x110');_0x485c1a[_0xbb10('0xf3')]=_0xbb10('0xf4');ami[_0xbb10('0x55')](_0xbb10('0xf5'),ut['buildObj'](_0x485c1a,_0xbb10('0xf7')));this[_0xbb10('0xf8')](_0x485c1a,_0xbb10('0x111'),_0xbb10('0x112'));}if(_0x4b3b21[_0xbb10('0x56')]===_0xbb10('0x86')&&this['campaigns'][_0x4b3b21['queue']]['dialAMDActive']&&_0x352de4[_0xbb10('0x10e')]===_0xbb10('0xfc')){return new Promise(function(_0x3e1a86,_0x243dc0){delete _0x1bd1c1['uniqueId'][_0x352de4[_0xbb10('0xed')]];_0x1bd1c1[_0xbb10('0xbd')](_0x1bd1c1[_0xbb10('0x24')][_0x4b3b21['queue']]);_0x1bd1c1['campaigns'][_0x4b3b21[_0xbb10('0xbe')]]['outboundAnswerCallsDay']+=0x1;_0x1bd1c1[_0xbb10('0x24')][_0x4b3b21[_0xbb10('0xbe')]][_0xbb10('0xfd')]+=0x1;var _0x42276f=_0x1bd1c1[_0xbb10('0x24')][_0x4b3b21[_0xbb10('0xbe')]];var _0x1fe250=new Hangup(_0x4b3b21,_0x352de4);_0x1fe250['state']=0x13;_0x1fe250[_0xbb10('0xf2')]=_0xbb10('0xfe');_0x1fe250['membername']=_0xbb10('0xf4');_0x1fe250[_0xbb10('0x103')]+=0x1;_0x1fe250[_0xbb10('0xff')]+=0x1;_0x1fe250['amd']=!![];ami['emit']('custom:amd',ut[_0xbb10('0xf6')](_0x1fe250,_0xbb10('0xf7')));_0x1bd1c1['createHistory'](_0x1fe250)[_0xbb10('0xbc')](loggerCatch(_0xbb10('0x113')));if(_0x1fe250[_0xbb10('0x100')]+_0x1fe250[_0xbb10('0x101')]+_0x1fe250[_0xbb10('0x102')]+_0x1fe250[_0xbb10('0x114')]+_0x1fe250[_0xbb10('0x115')]+_0x1fe250['countabandonedretry']+_0x1fe250[_0xbb10('0x103')]+_0x1fe250['countagentrejectretry']>=_0x42276f['dialGlobalMaxRetry']){_0x1bd1c1['stateGlobal'](_0x1fe250,_0x3e1a86,_0x243dc0,_0xbb10('0x106'));}else{if(_0x1fe250[_0xbb10('0x103')]>=_0x42276f['dialMachineMaxRetry']){_0x1bd1c1[_0xbb10('0x108')](_0x1fe250,_0x3e1a86,_0x243dc0,'reason\x2019\x20machine....');}else{_0x1bd1c1[_0xbb10('0xcd')]({'active':![],'countmachineretry':_0x1fe250[_0xbb10('0x103')],'scheduledat':moment()[_0xbb10('0x10a')](_0x42276f['dialMachineRetryFrequency'],'minutes')[_0xbb10('0x83')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1fe250[_0xbb10('0xe0')],'ListId':_0x1fe250[_0xbb10('0xe1')],'VoiceQueueId':_0x1fe250['VoiceQueueId']||undefined,'CampaignId':_0x1fe250['CampaignId']||undefined})[_0xbb10('0xbc')](loggerCatch(_0xbb10('0x10d')));_0x3e1a86({'reschedule':0x1});}}});}}};Dialer[_0xbb10('0x1d')]['syncHangup']=function(_0x4f4aa8){var _0x426a4f=this[_0xbb10('0x2b')][_0x4f4aa8['uniqueid']];var _0x414066;if(_0x426a4f&&_0x426a4f[_0xbb10('0x56')]===_0xbb10('0x86')){delete this[_0xbb10('0x2b')][_0x4f4aa8[_0xbb10('0xed')]];this[_0xbb10('0xbd')](this[_0xbb10('0x24')][_0x426a4f[_0xbb10('0xbe')]]);this[_0xbb10('0x24')][_0x426a4f[_0xbb10('0xbe')]][_0xbb10('0x116')]+=0x1;_0x414066=new Hangup(_0x426a4f,_0x4f4aa8);this[_0xbb10('0xd9')](_0x414066)[_0xbb10('0xbc')](loggerCatch('[syncHangupIvr][createHistory]'));this['moveContactManagedDialer'](_0x414066)[_0xbb10('0xbc')](loggerCatch('[syncHangupIvr]'));}if(_0x426a4f&&_0x426a4f[_0xbb10('0x56')]!==_0xbb10('0x86')&&isNotNull(this[_0xbb10('0x23')][_0x426a4f['queue']][_0xbb10('0x117')])){delete this[_0xbb10('0x2b')][_0x4f4aa8[_0xbb10('0xed')]];this[_0xbb10('0xbd')](this[_0xbb10('0x23')][_0x426a4f['queue']]);this[_0xbb10('0x23')][_0x426a4f[_0xbb10('0xbe')]][_0xbb10('0x66')]+=0x1;this[_0xbb10('0x23')][_0x426a4f[_0xbb10('0xbe')]][_0xbb10('0xfd')]+=0x1;_0x414066=new Hangup(_0x426a4f,_0x4f4aa8);_0x414066['state']=0x10;_0x414066[_0xbb10('0xf2')]=_0xbb10('0x118');_0x414066['membername']=_0xbb10('0x119');this[_0xbb10('0xd9')](_0x414066)[_0xbb10('0xbc')](loggerCatch(_0xbb10('0x11a')));this[_0xbb10('0xd7')](_0x414066)[_0xbb10('0xbc')](loggerCatch(_0xbb10('0x11b')));}if(_0x426a4f&&_0x426a4f[_0xbb10('0x56')]!==_0xbb10('0x86')&&!isNotNull(this[_0xbb10('0x23')][_0x426a4f[_0xbb10('0xbe')]][_0xbb10('0x117')])){delete this[_0xbb10('0x2b')][_0x4f4aa8[_0xbb10('0xed')]];this[_0xbb10('0xbd')](this['voiceQueues'][_0x426a4f[_0xbb10('0xbe')]]);this[_0xbb10('0x23')][_0x426a4f['queue']]['outboundUnknownCallsDay']+=0x1;_0x414066=new Hangup(_0x426a4f,_0x4f4aa8);_0x414066[_0xbb10('0x10f')]=0xc;_0x414066[_0xbb10('0xf2')]=_0x4f4aa8[_0xbb10('0x11c')];_0x414066[_0xbb10('0xf3')]=_0xbb10('0x11d');this[_0xbb10('0xd9')](_0x414066)[_0xbb10('0xbc')](loggerCatch(_0xbb10('0x11a')));this[_0xbb10('0xd7')](_0x414066)['catch'](loggerCatch('[syncHangupIvr]'));}};Dialer['prototype']['syncAgentComplete']=function(_0x4f147c){var _0x5d42b1=this[_0xbb10('0x2b')][_0x4f147c[_0xbb10('0xed')]];if(this[_0xbb10('0x23')][_0x4f147c[_0xbb10('0xbe')]]){if(_0x5d42b1&&_0x5d42b1['type']!==_0xbb10('0x86')){delete this[_0xbb10('0x2b')][_0x4f147c[_0xbb10('0xed')]];this[_0xbb10('0x23')][_0x4f147c['queue']]['outboundAnswerCallsDay']+=0x1;var _0x3057b4=new AgentComplete(_0x5d42b1,_0x4f147c);if(_0x4f147c[_0xbb10('0x11e')]==='agent'){_0x3057b4['agiafterat']=this[_0xbb10('0x23')][_0x4f147c[_0xbb10('0xbe')]][_0xbb10('0x11f')]&&this[_0xbb10('0x23')][_0x4f147c[_0xbb10('0xbe')]]['dialAgiAfterHangupAgent']?moment()[_0xbb10('0x83')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}this['createHistory'](_0x3057b4)[_0xbb10('0xbc')](loggerCatch(_0xbb10('0x120')));this[_0xbb10('0xd7')](_0x3057b4)[_0xbb10('0xbc')](loggerCatch(_0xbb10('0x121')));}}};Dialer[_0xbb10('0x1d')]['syncAgentConnect']=function(_0x9c1581){if(this[_0xbb10('0x23')][_0x9c1581[_0xbb10('0xbe')]]){if(this[_0xbb10('0x2b')][_0x9c1581[_0xbb10('0xed')]]&&this[_0xbb10('0x2b')][_0x9c1581[_0xbb10('0xed')]][_0xbb10('0x56')]!==_0xbb10('0x86')){this[_0xbb10('0xbd')](this[_0xbb10('0x23')][_0x9c1581[_0xbb10('0xbe')]]);this[_0xbb10('0x2b')][_0x9c1581[_0xbb10('0xed')]][_0xbb10('0x122')]=moment()[_0xbb10('0x83')](_0xbb10('0x10c'));}}};Dialer[_0xbb10('0x1d')][_0xbb10('0x123')]=function(_0x43a203,_0x1ca43e){this[_0xbb10('0xd9')](_0x43a203)['catch'](loggerCatch(_0xbb10('0x120')));if(_0x1ca43e==0x0){this['moveContactManagedDialer'](_0x43a203)[_0xbb10('0xbc')](loggerCatch(_0xbb10('0x124')));}};Dialer[_0xbb10('0x1d')][_0xbb10('0x33')]=function(_0x40bbf1){var _0x4f5689=this['uniqueId'][_0x40bbf1['uniqueid']];var _0x36be49=this;var _0x2fac6c=![];var _0x482f7d;var _0x31b7f9;if(this[_0xbb10('0x23')][_0x40bbf1[_0xbb10('0xbe')]]){if(_0x4f5689&&_0x4f5689['type']!==_0xbb10('0x86')){delete this[_0xbb10('0x2b')][_0x40bbf1[_0xbb10('0xed')]];this['updateOriginated'](this[_0xbb10('0x23')][_0x40bbf1['queue']]);_0x4f5689[_0xbb10('0x125')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x559e46=new QueueCallerAbandon(_0x4f5689,_0x40bbf1);if(getSeconds(_0x4f5689['droptime'],_0x4f5689['responsetime'])>=_0x4f5689['dialQueueTimeout']){this[_0xbb10('0x23')][_0x40bbf1[_0xbb10('0xbe')]][_0xbb10('0x74')]+=0x1;this[_0xbb10('0x23')][_0x40bbf1['queue']][_0xbb10('0x6a')]+=0x1;this[_0xbb10('0x23')][_0x40bbf1[_0xbb10('0xbe')]][_0xbb10('0x76')]+=0x1;_0x559e46[_0xbb10('0x10f')]=0xa;_0x559e46[_0xbb10('0xf2')]=_0xbb10('0x126');_0x559e46[_0xbb10('0x127')]=_0xbb10('0x128');_0x559e46[_0xbb10('0x129')]=this['voiceQueues'][_0x40bbf1[_0xbb10('0xbe')]][_0xbb10('0x11f')]?moment()[_0xbb10('0x83')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x559e46[_0xbb10('0x115')]+=0x1;_0x559e46[_0xbb10('0xff')]+=0x1;_0x482f7d=this[_0xbb10('0x23')][_0x40bbf1[_0xbb10('0xbe')]]['dialDropRetryFrequency'];_0x31b7f9=this[_0xbb10('0x23')][_0x40bbf1[_0xbb10('0xbe')]][_0xbb10('0x12a')];_0x36be49[_0xbb10('0xc5')](_0x559e46,_0x559e46[_0xbb10('0x10f')],_0x4f5689[_0xbb10('0x12b')])[_0xbb10('0xc2')](function(_0x1c0529){_0x2fac6c=_0x1c0529[_0xbb10('0x12c')]==0x1;if(_0x559e46[_0xbb10('0x115')]>=_0x36be49[_0xbb10('0x23')][_0x40bbf1['queue']][_0xbb10('0x12d')]){_0x36be49[_0xbb10('0x123')](_0x559e46,_0x1c0529['additional']);}else{_0x36be49['rescheduleContact']({'active':![],'countdropretry':_0x559e46[_0xbb10('0x115')],'scheduledat':moment()[_0xbb10('0x10a')](_0x36be49['voiceQueues'][_0x40bbf1[_0xbb10('0xbe')]][_0xbb10('0x12e')],'minutes')[_0xbb10('0x83')](_0xbb10('0x10c')),'ContactId':_0x4f5689[_0xbb10('0xe0')],'ListId':_0x4f5689[_0xbb10('0xe1')],'VoiceQueueId':_0x4f5689[_0xbb10('0xe3')]||undefined,'CampaignId':_0x4f5689['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact][Drop]'));var _0xaeaa51=new History(_0x559e46);_0xaeaa51['state']=0xa;_0xaeaa51[_0xbb10('0xf2')]='Drop';_0xaeaa51['starttime']=moment()[_0xbb10('0x83')](_0xbb10('0x10c'));_0xaeaa51[_0xbb10('0xb2')]=_0xaeaa51[_0xbb10('0xb3')];_0xaeaa51[_0xbb10('0x12f')]=_0x559e46[_0xbb10('0x12f')];_0xaeaa51['calleridnum']=_0x559e46['calleridnum'];_0x36be49['createHistory'](_0xaeaa51)[_0xbb10('0xbc')](loggerCatch(_0xbb10('0x130')));}})[_0xbb10('0xc2')](function(){if(_0x2fac6c)_0x36be49[_0xbb10('0xc6')](_0x559e46,_0x482f7d,_0x31b7f9)[_0xbb10('0xc2')](function(){return 0x1;});});}else{this[_0xbb10('0x23')][_0x40bbf1[_0xbb10('0xbe')]]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this[_0xbb10('0x23')][_0x40bbf1[_0xbb10('0xbe')]][_0xbb10('0x69')]+=0x1;_0x559e46[_0xbb10('0x10f')]=0xb;_0x559e46['statedesc']=_0xbb10('0x131');_0x559e46['dropreason']='CALLEREXIT';_0x559e46[_0xbb10('0x132')]+=0x1;_0x559e46[_0xbb10('0xff')]+=0x1;_0x482f7d=this[_0xbb10('0x23')][_0x40bbf1[_0xbb10('0xbe')]][_0xbb10('0x133')];_0x31b7f9=this[_0xbb10('0x23')][_0x40bbf1['queue']][_0xbb10('0x12a')];_0x36be49[_0xbb10('0xc5')](_0x559e46,_0x559e46[_0xbb10('0x10f')],_0x4f5689[_0xbb10('0x12b')])[_0xbb10('0xc2')](function(_0x527d8d){if(_0x559e46[_0xbb10('0x132')]>=_0x36be49['voiceQueues'][_0x40bbf1[_0xbb10('0xbe')]][_0xbb10('0x134')]){_0x36be49[_0xbb10('0x123')](_0x559e46,_0x527d8d['additional']);}else{_0x36be49['rescheduleContact']({'active':![],'countabandonedretry':_0x559e46[_0xbb10('0x132')],'scheduledat':moment()[_0xbb10('0x10a')](_0x36be49[_0xbb10('0x23')][_0x40bbf1[_0xbb10('0xbe')]][_0xbb10('0x133')],_0xbb10('0x135'))[_0xbb10('0x83')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4f5689[_0xbb10('0xe0')],'ListId':_0x4f5689[_0xbb10('0xe1')],'VoiceQueueId':_0x4f5689[_0xbb10('0xe3')]||undefined,'CampaignId':_0x4f5689['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact][Abandoned]'));var _0x4a01cd=new History(_0x559e46);_0x4a01cd[_0xbb10('0x10f')]=0xb;_0x4a01cd[_0xbb10('0xf2')]=_0xbb10('0x131');_0x4a01cd[_0xbb10('0xb3')]=moment()['format'](_0xbb10('0x10c'));_0x4a01cd['endtime']=_0x4a01cd[_0xbb10('0xb3')];_0x4a01cd[_0xbb10('0x12f')]=_0x559e46[_0xbb10('0x12f')];_0x4a01cd[_0xbb10('0x136')]=_0x559e46[_0xbb10('0x136')];_0x36be49[_0xbb10('0xd9')](_0x4a01cd)[_0xbb10('0xbc')](loggerCatch(_0xbb10('0x137')));}})[_0xbb10('0xc2')](function(){if(_0x2fac6c)_0x36be49[_0xbb10('0xc6')](_0x559e46,_0x482f7d,_0x31b7f9)[_0xbb10('0xc2')](function(){return 0x1;});});}}}};Dialer[_0xbb10('0x1d')]['syncNewExten']=function(_0x1bd6db){if(this[_0xbb10('0x29')][_0x1bd6db[_0xbb10('0xed')]]){this['actions'][_0x1bd6db[_0xbb10('0xed')]]['channel']=_0x1bd6db[_0xbb10('0xbb')];}if(this[_0xbb10('0x2b')][_0x1bd6db[_0xbb10('0xed')]]){this[_0xbb10('0x2b')][_0x1bd6db[_0xbb10('0xed')]]['channel']=_0x1bd6db['channel'];}};Dialer[_0xbb10('0x1d')]['syncQueueMember']=function(_0x553bb8){if(strategy[this[_0xbb10('0x23')][this['actions'][_0x553bb8[_0xbb10('0x138')]][_0xbb10('0xbe')]][_0xbb10('0x139')]]===_0xbb10('0x1c')){if(this[_0xbb10('0x29')][_0x553bb8[_0xbb10('0x138')]]&&_[_0xbb10('0xb8')](this[_0xbb10('0x29')][_0x553bb8['actionid']][_0xbb10('0x13a')])&&_0x553bb8['status']==='1'&&_0x553bb8[_0xbb10('0x13b')]==='0'){if(this['agents'][_0x553bb8[_0xbb10('0x13c')]]){if(!this[_0xbb10('0x25')][_0x553bb8['stateinterface']][_0xbb10('0x13a')]){this[_0xbb10('0x25')][_0x553bb8[_0xbb10('0x13c')]]['locked']=!![];this[_0xbb10('0x29')][_0x553bb8[_0xbb10('0x138')]][_0xbb10('0x13a')]=!![];this['actions'][_0x553bb8[_0xbb10('0x138')]][_0xbb10('0x13c')]=_0x553bb8[_0xbb10('0x13c')];}}}}else if((strategy[this['voiceQueues'][this[_0xbb10('0x29')][_0x553bb8['actionid']][_0xbb10('0xbe')]][_0xbb10('0x139')]]||_0xbb10('0x1b'))===_0xbb10('0x1b')){if(this[_0xbb10('0x29')][_0x553bb8[_0xbb10('0x138')]]){if(this[_0xbb10('0x25')][_0x553bb8[_0xbb10('0x13c')]]){this[_0xbb10('0x29')][_0x553bb8[_0xbb10('0x138')]]['stateinterface']=_0x553bb8['stateinterface'];if(_[_0xbb10('0xb8')](this[_0xbb10('0x13d')][this[_0xbb10('0x29')][_0x553bb8['actionid']][_0xbb10('0xbe')]])){this[_0xbb10('0x13d')][this[_0xbb10('0x29')][_0x553bb8[_0xbb10('0x138')]][_0xbb10('0xbe')]]=[];}this[_0xbb10('0x13d')][this[_0xbb10('0x29')][_0x553bb8[_0xbb10('0x138')]][_0xbb10('0xbe')]]['push'](_[_0xbb10('0x9b')](_[_0xbb10('0xdf')](this[_0xbb10('0x29')][_0x553bb8[_0xbb10('0x138')]],['idHopper',_0xbb10('0x13c')]),{'status':_0x553bb8[_0xbb10('0xba')],'paused':_0x553bb8[_0xbb10('0x13b')]}));}}}};function unlockQueueStatus(_0x59fef2,_0x59f9b2){setTimeout(function(){if(_[_0xbb10('0x93')](_0x59fef2['queueStatusComplete'])){loggerBooked[_0xbb10('0xa3')]('[unlockQueueStatus][undefined]',_0x59f9b2);}_0x59fef2[_0xbb10('0x13e')]=!![];loggerBooked[_0xbb10('0x89')](_0xbb10('0x13f'),_0x59f9b2,JSON[_0xbb10('0x82')](_[_0xbb10('0xdf')](_0x59fef2,[_0xbb10('0x47'),_0xbb10('0x13e')])));},0x1f3);}Dialer['prototype'][_0xbb10('0x42')]=function(_0x439d9a){var _0x28271e=this;var _0x2807d2=_0x28271e[_0xbb10('0x23')][_0x28271e[_0xbb10('0x29')][_0x439d9a['actionid']][_0xbb10('0xbe')]];if(strategy[this[_0xbb10('0x23')][this[_0xbb10('0x29')][_0x439d9a[_0xbb10('0x138')]][_0xbb10('0xbe')]][_0xbb10('0x139')]]===_0xbb10('0x1c')){if(this['actions'][_0x439d9a[_0xbb10('0x138')]]&&this[_0xbb10('0x29')][_0x439d9a[_0xbb10('0x138')]]['stateinterface']){this[_0xbb10('0x22')]['run'](this[_0xbb10('0x29')][_0x439d9a[_0xbb10('0x138')]][_0xbb10('0x140')],this['actions'][_0x439d9a['actionid']][_0xbb10('0x13c')])[_0xbb10('0xbc')](function(_0xbb410e){logger[_0xbb10('0xa3')](_0xbb10('0x141'),util[_0xbb10('0xa4')](_0xbb410e,{'showHidden':![],'depth':null}));})[_0xbb10('0x20')](function(){_0x28271e[_0xbb10('0xbd')](_0x28271e[_0xbb10('0x23')][_0x28271e[_0xbb10('0x29')][_0x439d9a[_0xbb10('0x138')]]['queue']]);_0x28271e['agents'][_0x28271e[_0xbb10('0x29')][_0x439d9a[_0xbb10('0x138')]]['stateinterface']]['locked']=![];delete _0x28271e[_0xbb10('0x29')][_0x439d9a[_0xbb10('0x138')]];unlockQueueStatus(_0x2807d2);});}else{this[_0xbb10('0xbd')](this['voiceQueues'][this[_0xbb10('0x29')][_0x439d9a[_0xbb10('0x138')]]['queue']]);this[_0xbb10('0xcd')]({'active':![],'ContactId':this[_0xbb10('0x29')][_0x439d9a['actionid']]['ContactId'],'ListId':this[_0xbb10('0x29')][_0x439d9a[_0xbb10('0x138')]][_0xbb10('0xe1')],'VoiceQueueId':this['actions'][_0x439d9a['actionid']][_0xbb10('0xe3')]||undefined,'CampaignId':this[_0xbb10('0x29')][_0x439d9a['actionid']][_0xbb10('0xe4')]||undefined})[_0xbb10('0xbc')](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0xbb10('0x29')][_0x439d9a[_0xbb10('0x138')]];unlockQueueStatus(_0x2807d2);}}else if((strategy[this[_0xbb10('0x23')][this[_0xbb10('0x29')][_0x439d9a['actionid']][_0xbb10('0xbe')]]['strategy']]||_0xbb10('0x1b'))===_0xbb10('0x1b')){var _0x2aaf70;if(this[_0xbb10('0x29')][_0x439d9a[_0xbb10('0x138')]]&&!_[_0xbb10('0x4f')](this[_0xbb10('0x13d')][this[_0xbb10('0x29')][_0x439d9a['actionid']][_0xbb10('0xbe')]])){if(this[_0xbb10('0x2e')][_0x28271e[_0xbb10('0x29')][_0x439d9a[_0xbb10('0x138')]]['queue']]){this['queueBookedRR'][_0x28271e[_0xbb10('0x29')][_0x439d9a[_0xbb10('0x138')]][_0xbb10('0xbe')]]=this[_0xbb10('0x2e')][this['actions'][_0x439d9a[_0xbb10('0x138')]][_0xbb10('0xbe')]]?this['queueBookedRR'][this[_0xbb10('0x29')][_0x439d9a['actionid']]['queue']]:this[_0xbb10('0x13d')][this[_0xbb10('0x29')][_0x439d9a[_0xbb10('0x138')]][_0xbb10('0xbe')]]?this[_0xbb10('0x13d')][this['actions'][_0x439d9a[_0xbb10('0x138')]][_0xbb10('0xbe')]][_0xbb10('0x142')]||0x0:0x0;}this[_0xbb10('0x13d')][this[_0xbb10('0x29')][_0x439d9a[_0xbb10('0x138')]][_0xbb10('0xbe')]][_0xbb10('0x142')]=this[_0xbb10('0x2e')][this[_0xbb10('0x29')][_0x439d9a[_0xbb10('0x138')]][_0xbb10('0xbe')]];for(var _0x74ca46=0x0;_0x74ca46=0x0;})['catch'](myreject(_0x4aa311)));}}else{_0x7e9e52[_0xbb10('0x162')](ami['Action']({'action':'command','command':util['format']('iftime\x20%s,%s',_0x3d2e5f,!_[_0xbb10('0x93')](config[_0xbb10('0x15a')][_0x33a92a])?_0x33a92a:'')})[_0xbb10('0xc2')](function(_0x1f0938){return _0x1f0938[_0xbb10('0x160')]['indexOf'](_0xbb10('0x163'))>=0x0;})[_0xbb10('0xbc')](myreject(_0x4aa311)));}Promise[_0xbb10('0x164')](_0x7e9e52)['then'](function(_0x11a61a){var _0x188766=_[_0xbb10('0x165')](_0x11a61a);if(_0x188766){return _0x1b3783(_0x188766);}else{_0x4fa8a2[_0xbb10('0x46')]=_0x4688f8?_0xbb10('0x166'):_0xbb10('0x167');return _0x4aa311(msgResponse(_0xbb10('0x168'),_0xbb10('0x156'),_0xbb10('0x169')+_0x4688f8+'\x20'+_0x374e5d+_0xbb10('0x16a')+util[_0xbb10('0xa4')](_0x3d2e5f,{'showHidden':![],'depth':null})+_0xbb10('0x16b')+_0x33a92a));}})[_0xbb10('0xbc')](function(_0x2dc633){return _0x4aa311(msgResponse(_0xbb10('0x155'),'Failure',JSON['stringify'](_0x2dc633)));});});};Dialer['prototype'][_0xbb10('0x16c')]=function(_0x58fbef){var _0x1ae32c=this;return function(){switch(_0x58fbef['dialMethod']){case _0xbb10('0x16d'):freeVariablesPredictive(_0x58fbef);_0x1ae32c['handlePower'](_0x58fbef,0x1);break;case'power':freeVariablesPredictive(_0x58fbef);_0x1ae32c[_0xbb10('0x16e')](_0x58fbef,_0x58fbef[_0xbb10('0x16f')]);break;case'predictive':_0x1ae32c[_0xbb10('0x9')](_0x58fbef);break;case _0xbb10('0x8'):freeVariablesPredictive(_0x58fbef);_0x1ae32c[_0xbb10('0x16e')](_0x58fbef,0x1);break;default:freeVariablesPredictive(_0x58fbef);logger[_0xbb10('0xa3')]('Queue',_0x58fbef['name'],_0xbb10('0x170'));}};};Dialer[_0xbb10('0x1d')][_0xbb10('0x171')]=function(_0x53f3c2){return Promise[_0xbb10('0xc1')]()[_0xbb10('0xc2')](cmHopper[_0xbb10('0x172')](_0x53f3c2['id'],previewRecallmeReminderInterval))['then'](function(_0x5414f9){for(var _0x51cdbd=0x0;_0x51cdbd<_0x5414f9['length'];_0x51cdbd++){var _0xd11ff7=_0x5414f9[_0x51cdbd]['Agent'][_0xbb10('0x47')];if(_0xd11ff7)io['to'](util[_0xbb10('0x83')](_0xbb10('0x173'),_0xd11ff7))[_0xbb10('0x55')](_0xbb10('0x174'),{'hopper':_0x5414f9[_0x51cdbd]});}})['catch'](function(){});};Dialer[_0xbb10('0x1d')][_0xbb10('0x175')]=function(_0xf6f7ed){var _0x2701e8=this;return function(){_0x2701e8[_0xbb10('0x176')](_0xf6f7ed);};};Dialer[_0xbb10('0x1d')]['syncQueueSummary']=function(_0x568fb9){var _0x1e394c=this;if(isNotPreview(_0x568fb9[_0xbb10('0x63')])){if(isVoiceQueueOutbound(_0x568fb9[_0xbb10('0x56')])&&isActive(_0x568fb9[_0xbb10('0x62')])){_0x568fb9[_0xbb10('0xac')]=!![];Promise['resolve']()['then'](checkIsLoggedIn(_0x568fb9,_0x568fb9[_0xbb10('0x59')]))[_0xbb10('0xc2')](checkIsActive(_0x568fb9,_0x568fb9['dialActive']))['then'](checkInterval(_0x568fb9))[_0xbb10('0xc2')](_0x1e394c[_0xbb10('0x150')](_0x568fb9))[_0xbb10('0xc2')](_0x1e394c[_0xbb10('0x153')](_0x568fb9[_0xbb10('0x177')],_0x568fb9[_0xbb10('0x178')],_0x568fb9['name'],_0x568fb9))[_0xbb10('0xc2')](_0x1e394c[_0xbb10('0x154')](_0x568fb9[_0xbb10('0x4b')],_0x568fb9[_0xbb10('0x178')],_0x568fb9[_0xbb10('0x47')],_0x568fb9))[_0xbb10('0xc2')](_0x1e394c[_0xbb10('0x16c')](_0x568fb9))[_0xbb10('0xbc')](loggerCatchQueueSummary(_0xbb10('0x179'),_0x568fb9));}else{notSendMessagesQueue(_0x568fb9);}}else{freeVariablesPredictive(_0x568fb9);}};Dialer['prototype']['syncQueueSummaryComplete']=_['throttle'](function(){var _0x111c15=_[_0xbb10('0x17a')](this[_0xbb10('0x23')],function(_0x270853){return _0x270853['dialPreviewRecallmeReminder'];});var _0x548c7d=_['filter'](this[_0xbb10('0x25')],function(_0x43440f){return _0x43440f[_0xbb10('0x17b')]&&_0x43440f[_0xbb10('0xba')]===_0xbb10('0xea');});if(_0x111c15[_0xbb10('0xa5')]>0x0&&_0x548c7d[_0xbb10('0xa5')]>0x0){return Promise[_0xbb10('0xc1')]()[_0xbb10('0xc2')](cmHopper[_0xbb10('0x172')](_[_0xbb10('0x17c')](_0x111c15,'id'),previewRecallmeReminderInterval,_[_0xbb10('0x17c')](_0x548c7d,'id')))[_0xbb10('0xc2')](function(_0x21905e){for(var _0x5f074d=0x0;_0x5f074d<_0x21905e[_0xbb10('0xa5')];_0x5f074d++){var _0x139eac=_0x21905e[_0x5f074d][_0xbb10('0x17d')][_0xbb10('0x47')];if(_0x139eac)io['to'](util[_0xbb10('0x83')](_0xbb10('0x173'),_0x139eac))['emit'](_0xbb10('0x174'),{'hopper':_0x21905e[_0x5f074d]});}})[_0xbb10('0xbc')](function(_0x46da44){logger[_0xbb10('0xa3')](_0xbb10('0x171'),_0x46da44);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0xbb10('0x1d')][_0xbb10('0x14f')]=function(){var _0x29ab90=this;var _0x6c67b7;for(var _0x504279 in this[_0xbb10('0x24')]){if(typeof this[_0xbb10('0x24')][_0x504279]!==_0xbb10('0xb7')){_0x6c67b7=this[_0xbb10('0x24')][_0x504279];if(isCampaignIvr(_0x6c67b7[_0xbb10('0x56')])&&isActive(_0x6c67b7[_0xbb10('0x80')])){_0x6c67b7[_0xbb10('0xac')]=!![];Promise[_0xbb10('0xc1')]()[_0xbb10('0xc2')](checkIsActive(_0x6c67b7,_0x6c67b7['active']))[_0xbb10('0xc2')](checkInterval(_0x6c67b7))['then'](_0x29ab90[_0xbb10('0x150')](_0x6c67b7))[_0xbb10('0xc2')](_0x29ab90['checkIfTime'](_0x6c67b7['dialGlobalInterval'],_0x6c67b7[_0xbb10('0x178')],_0x6c67b7[_0xbb10('0x47')],_0x6c67b7))[_0xbb10('0xc2')](_0x29ab90[_0xbb10('0x154')](_0x6c67b7[_0xbb10('0x4b')],_0x6c67b7[_0xbb10('0x178')],_0x6c67b7[_0xbb10('0x47')],_0x6c67b7))[_0xbb10('0xc2')](_0x29ab90[_0xbb10('0x175')](_0x6c67b7))[_0xbb10('0xbc')](loggerCatchQueueSummary(_0xbb10('0x17e'),_0x6c67b7));}else{notSendMessagesCampaign(_0x6c67b7);}}}};function getCallerIdRandom(_0x2b0a37,_0x3f632e){var _0x2f76;var _0x18c40e;var _0x5eba7e;if(_0x3f632e<=0x0){_0x3f632e=0x1;}_0x2f76=new RegExp(_0xbb10('0x17f')+_0x3f632e+'}$');_0x18c40e=Math['pow'](0xa,_0x3f632e-0x1);_0x5eba7e=Math[_0xbb10('0x180')](0xa,_0x3f632e)-0x1;return util[_0xbb10('0x83')]('%s',_[_0xbb10('0x181')](_0x2b0a37,_0x2f76,_[_0xbb10('0x182')](_0x18c40e,_0x5eba7e)));}function extractCalleridName(_0x3033b0){var _0x2b332b=_0x3033b0[_0xbb10('0x183')](/"(.*?)"/);return _0x2b332b?_0x2b332b[0x1]:_0x3033b0;}Dialer[_0xbb10('0x1d')][_0xbb10('0x184')]=function(_0x4b274c,_0x4b7bdb){var _0x3f10c4=this;var _0x3bb8f9=uuid['v4']();this[_0xbb10('0x29')][_0x3bb8f9]=new Action(_0x4b274c,_0x4b7bdb,_0x3bb8f9);return new Promise(function(_0x54c61c,_0x21b00e){if(_['isUndefined'](_0x4b274c)&&typeof _0x4b274c!==_0xbb10('0x185')){return _0x21b00e(msgResponse(_0xbb10('0x186'),'Failure',_0xbb10('0x187')));}if(_[_0xbb10('0x93')](_0x4b7bdb[_0xbb10('0x188')])||_0x4b7bdb[_0xbb10('0x188')]===null){return _0x21b00e(msgResponse(_0xbb10('0x186'),'Failure',_0xbb10('0x189')));}var _0x1a21fd={'XMD-CALLERID':_0x3f10c4['actions'][_0x3bb8f9][_0xbb10('0x18a')](),'XMD-AGI':_0x4b274c[_0xbb10('0x117')]?util['format'](_0xbb10('0x18b'),ipAgi,_0x4b274c[_0xbb10('0x117')]):_0xbb10('0x18c'),'XMD-AGIAFTER':_0x4b274c[_0xbb10('0x11f')]?util['format'](_0xbb10('0x18b'),ipAgi,_0x4b274c[_0xbb10('0x11f')]):_0xbb10('0x18c'),'XMD-QUEUE':_0x4b274c['type']==='outbound'?util[_0xbb10('0x83')](_0xbb10('0x18d'),_0x4b274c[_0xbb10('0x47')],_0x4b274c[_0xbb10('0x18e')]||'',_0x4b274c['dialAgiAfterHangupAgent']?'c':'',_0x4b274c[_0xbb10('0x18f')]||0x3):_0xbb10('0x18c'),'XMD-CONTACTID':_0x4b7bdb[_0xbb10('0xe0')],'XMD-CDRTYPE':_0xbb10('0x7'),'CALLERID(all)':_0x3f10c4[_0xbb10('0x29')][_0x3bb8f9]['getCaller'](),'XMD-AMD':_0x4b274c['dialAMDActive']?_0xbb10('0x190'):_0xbb10('0x18c'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x4b274c['dialAMDActive']){_0x1a21fd[_0xbb10('0x191')]=_0x4b274c[_0xbb10('0x192')]||0x9c4;_0x1a21fd[_0xbb10('0x193')]=_0x4b274c[_0xbb10('0x194')]||0x5dc;_0x1a21fd[_0xbb10('0x195')]=_0x4b274c[_0xbb10('0x196')]||0x320;_0x1a21fd['XMD-AMDTOTALANALYSISTIME']=_0x4b274c['dialAMDTotalAnalysisTime']||0x1388;_0x1a21fd[_0xbb10('0x197')]=_0x4b274c[_0xbb10('0x198')]||0x64;_0x1a21fd[_0xbb10('0x199')]=_0x4b274c[_0xbb10('0x19a')]||0x32;_0x1a21fd[_0xbb10('0x19b')]=_0x4b274c[_0xbb10('0x19c')]||0x3;_0x1a21fd['XMD-AMDSILENCETHRESHOLD']=_0x4b274c[_0xbb10('0x19d')]||0x100;_0x1a21fd[_0xbb10('0x19e')]=_0x4b274c[_0xbb10('0x19f')]||0x1388;}if(_0x4b274c[_0xbb10('0x56')]==='outbound'){_0x1a21fd[_0xbb10('0x1a0')]=_0x4b7bdb[_0xbb10('0xe3')];}else{_0x1a21fd[_0xbb10('0x1a1')]=_0x4b7bdb[_0xbb10('0xe4')];}for(var _0x416c01 in _0x4b7bdb[_0xbb10('0x1a2')]){if(typeof _0x4b7bdb[_0xbb10('0x1a2')][_0x416c01]!==_0xbb10('0xb7')){if(isNotNull(_0x4b7bdb[_0xbb10('0x1a2')][_0x416c01])&&_0x416c01!=='id'&&_0x416c01!==_0xbb10('0x1a3')&&_0x416c01!==_0xbb10('0x1a4')&&_0x416c01!==_0xbb10('0x1a5')){_0x1a21fd[util['format'](_0xbb10('0x1a6'),_0xbb10('0x1a7'),_['toUpper'](_0x416c01))]=_0x4b7bdb[_0xbb10('0x1a2')][_0x416c01];}}}var _0x284645=_0x3f10c4[_0xbb10('0xe8')](_0x4b274c['Trunk'])?getCallerId(_0x4b274c[_0xbb10('0x7f')][_0xbb10('0x81')],_0x4b274c[_0xbb10('0x1a8')],_0x4b274c[_0xbb10('0x1a9')]>0x0?getCallerIdRandom(_0x4b274c[_0xbb10('0x64')],_0x4b274c[_0xbb10('0x1a9')]):_0x4b274c['dialOriginateCallerIdNumber']):getCallerId(_[_0xbb10('0xb8')](_0x4b274c['TrunkBackup'])?_0x4b274c[_0xbb10('0x7f')][_0xbb10('0x81')]:_0x4b274c[_0xbb10('0x151')][_0xbb10('0x81')],_0x4b274c['dialOriginateCallerIdName'],_0x4b274c[_0xbb10('0x1a9')]>0x0?getCallerIdRandom(_0x4b274c[_0xbb10('0x64')],_0x4b274c['dialRandomLastDigitCallerIdNumber']):_0x4b274c[_0xbb10('0x64')]);if(_0x284645){_0x1a21fd['XMD-ORIGINATECALLERIDNAME']=_0x3f10c4[_0xbb10('0x29')][_0x3bb8f9][_0xbb10('0x1aa')]=extractCalleridName(_0x284645);_0x1a21fd[_0xbb10('0x1ab')]=_0x4b7bdb[_0xbb10('0x188')];}_0x4b274c[_0xbb10('0x1ac')]=_0x1a21fd;return ami[_0xbb10('0xb9')]({'actionid':_0x3bb8f9,'action':_0xbb10('0x186'),'channel':_0x3f10c4[_0xbb10('0xe8')](_0x4b274c['Trunk'])?util['format'](_0xbb10('0x1ad'),_0x4b274c[_0xbb10('0x7f')][_0xbb10('0x47')],isNotNull(_0x4b274c[_0xbb10('0x1ae')])?_0x4b274c[_0xbb10('0x1ae')][_0xbb10('0x1af')]()||'':'',_0x4b274c[_0xbb10('0x1b0')]>0x0?_0x4b7bdb[_0xbb10('0x188')][_0xbb10('0x1b1')](_0x4b274c['dialCutDigit']):_0x4b7bdb[_0xbb10('0x188')]):util['format'](_0xbb10('0x1ad'),_[_0xbb10('0xb8')](_0x4b274c['TrunkBackup'])?_0x4b274c[_0xbb10('0x7f')][_0xbb10('0x47')]:_0x4b274c[_0xbb10('0x151')][_0xbb10('0x47')],isNotNull(_0x4b274c[_0xbb10('0x1ae')])?_0x4b274c[_0xbb10('0x1ae')][_0xbb10('0x1af')]()||'':'',_0x4b274c[_0xbb10('0x1b0')]>0x0?_0x4b7bdb[_0xbb10('0x188')][_0xbb10('0x1b1')](_0x4b274c['dialCutDigit']):_0x4b7bdb[_0xbb10('0x188')]),'callerid':_0x284645,'Exten':_0xbb10('0xf1'),'Context':_0xbb10('0x1b2'),'Priority':'1','variable':_0x1a21fd,'timeout':(_0x4b274c[_0xbb10('0x65')]||0x1e)*0x3e8,'async':!![],'channelid':_0x3bb8f9})[_0xbb10('0xc2')](function(_0x3a37d4){return _0x54c61c(_0x3a37d4);})[_0xbb10('0xbc')](function(_0x451ae9){_0x4b274c[_0xbb10('0x6c')]+=0x1;var _0x23707c=new History(_0x3f10c4[_0xbb10('0x29')][_0x3bb8f9]);logger['error'](util[_0xbb10('0x83')](_0xbb10('0x1b3'),JSON[_0xbb10('0x82')](_0x451ae9)));_0x23707c['state']=0xe;_0x23707c['statedesc']=_0xbb10('0x1b4');_0x23707c['starttime']=moment()[_0xbb10('0x83')](_0xbb10('0x10c'));_0x23707c[_0xbb10('0xb2')]=_0x23707c[_0xbb10('0xb3')];_0x3f10c4[_0xbb10('0xd9')](_0x23707c)['catch'](loggerCatch(_0xbb10('0x1b5')));_0x3f10c4[_0xbb10('0xd7')](_0x23707c)[_0xbb10('0xbc')](loggerCatch(_0xbb10('0x1b5')))[_0xbb10('0x20')](function(){delete _0x3f10c4[_0xbb10('0x29')][_0x3bb8f9];return _0x21b00e(msgResponse(_0xbb10('0x186'),'Error',_0xbb10('0x1b6')));});});});};Dialer[_0xbb10('0x1d')][_0xbb10('0x35')]=function(_0x178bc0){var _0x128ecc=this['actions'][_0x178bc0[_0xbb10('0x138')]];if(_0x128ecc){delete this[_0xbb10('0x29')][_0x178bc0[_0xbb10('0x138')]];_0x128ecc[_0xbb10('0x1b7')]=moment()[_0xbb10('0x83')]('YYYY-MM-DD\x20HH:mm:ss');var _0x2d8da3=_0x128ecc[_0xbb10('0x56')]===_0xbb10('0x86')?this[_0xbb10('0x24')][_0x128ecc[_0xbb10('0xbe')]]:this[_0xbb10('0x23')][_0x128ecc[_0xbb10('0x1b8')]()];if(!this['isSuccess'](_0x178bc0['response'])){this[_0xbb10('0xbd')](_0x2d8da3);return this[_0xbb10('0x1b9')](_0x128ecc,_0x2d8da3,_0x178bc0)['catch'](loggerCatch(_0xbb10('0x1ba')));}this[_0xbb10('0x2b')][_0x178bc0[_0xbb10('0xed')]]=_0x128ecc;}};Dialer[_0xbb10('0x1d')][_0xbb10('0x1bb')]=function(_0xf96e32,_0x49f94b,_0xe1ce37){var _0x33dac1=new History(_0x49f94b);if(_0x33dac1[_0xbb10('0x100')]+_0x33dac1[_0xbb10('0x101')]+_0x33dac1['countnoanswerretry']+_0x33dac1['countnosuchnumberretry']+_0x33dac1[_0xbb10('0x115')]+_0x33dac1[_0xbb10('0x132')]+_0x33dac1[_0xbb10('0x103')]+_0x33dac1[_0xbb10('0x1bc')]>=_0xe1ce37[_0xbb10('0x104')]-0x1){return!![];}switch(_0xf96e32){case 0x3:if(_0x33dac1[_0xbb10('0x102')]>=_0xe1ce37[_0xbb10('0x1bd')]-0x1){return!![];}this[_0xbb10('0xcd')]({'active':![],'countnoanswerretry':_0x33dac1[_0xbb10('0x102')]+=0x1,'scheduledat':moment()[_0xbb10('0x10a')](_0xe1ce37[_0xbb10('0x1be')],_0xbb10('0x135'))[_0xbb10('0x83')](_0xbb10('0x10c')),'ContactId':_0x33dac1['ContactId'],'ListId':_0x33dac1[_0xbb10('0xe1')],'VoiceQueueId':_0x33dac1[_0xbb10('0xe3')]||undefined,'CampaignId':_0x33dac1[_0xbb10('0xe4')]||undefined})[_0xbb10('0xbc')](loggerCatch(_0xbb10('0x1bf')));break;case 0x5:if(_0x33dac1[_0xbb10('0x100')]>=_0xe1ce37['dialBusyMaxRetry']-0x1){return!![];}this[_0xbb10('0xcd')]({'active':![],'countbusyretry':_0x33dac1[_0xbb10('0x100')]+=0x1,'scheduledat':moment()[_0xbb10('0x10a')](_0xe1ce37['dialBusyRetryFrequency'],'minutes')[_0xbb10('0x83')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x33dac1[_0xbb10('0xe0')],'ListId':_0x33dac1[_0xbb10('0xe1')],'VoiceQueueId':_0x33dac1['VoiceQueueId']||undefined,'CampaignId':_0x33dac1['CampaignId']||undefined})[_0xbb10('0xbc')](loggerCatch(_0xbb10('0x1c0')));break;case 0x8:if(_0x33dac1['countcongestionretry']>=_0xe1ce37[_0xbb10('0x1c1')]-0x1){return!![];}this[_0xbb10('0xcd')]({'active':![],'countcongestionretry':_0x33dac1[_0xbb10('0x101')]+=0x1,'scheduledat':moment()['add'](_0xe1ce37[_0xbb10('0x1c2')],_0xbb10('0x135'))[_0xbb10('0x83')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x33dac1[_0xbb10('0xe0')],'ListId':_0x33dac1['ListId'],'VoiceQueueId':_0x33dac1[_0xbb10('0xe3')]||undefined,'CampaignId':_0x33dac1[_0xbb10('0xe4')]||undefined})['catch'](loggerCatch(_0xbb10('0x1c3')));break;case 0x0:if(_0x33dac1[_0xbb10('0x114')]>=_0xe1ce37[_0xbb10('0x1c4')]-0x1){return!![];}else{this[_0xbb10('0xcd')]({'active':![],'countnosuchnumberretry':_0x33dac1[_0xbb10('0x114')]+=0x1,'scheduledat':moment()[_0xbb10('0x10a')](_0xe1ce37[_0xbb10('0x1c5')],_0xbb10('0x135'))[_0xbb10('0x83')](_0xbb10('0x10c')),'ContactId':_0x33dac1[_0xbb10('0xe0')],'ListId':_0x33dac1['ListId'],'VoiceQueueId':_0x33dac1[_0xbb10('0xe3')]||undefined,'CampaignId':_0x33dac1[_0xbb10('0xe4')]||undefined})[_0xbb10('0xbc')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x33dac1[_0xbb10('0x115')]>=_0xe1ce37[_0xbb10('0x12d')]-0x1){return!![];}this[_0xbb10('0xcd')]({'active':![],'countdropretry':_0x33dac1[_0xbb10('0x115')]+=0x1,'scheduledat':moment()['add'](_0xe1ce37[_0xbb10('0x12e')],_0xbb10('0x135'))[_0xbb10('0x83')](_0xbb10('0x10c')),'ContactId':_0x33dac1[_0xbb10('0xe0')],'ListId':_0x33dac1[_0xbb10('0xe1')],'VoiceQueueId':_0x33dac1[_0xbb10('0xe3')]||undefined,'CampaignId':_0x33dac1[_0xbb10('0xe4')]||undefined})[_0xbb10('0xbc')](loggerCatch(_0xbb10('0x1c6')));break;case 0xb:if(_0x33dac1[_0xbb10('0x132')]>=_0xe1ce37[_0xbb10('0x134')]-0x1){return!![];}this[_0xbb10('0xcd')]({'active':![],'countabandonedretry':_0x33dac1[_0xbb10('0x132')]+=0x1,'scheduledat':moment()[_0xbb10('0x10a')](_0xe1ce37['dialAbandonedRetryFrequency'],_0xbb10('0x135'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x33dac1['ContactId'],'ListId':_0x33dac1[_0xbb10('0xe1')],'VoiceQueueId':_0x33dac1['VoiceQueueId']||undefined,'CampaignId':_0x33dac1[_0xbb10('0xe4')]||undefined})['catch'](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x33dac1[_0xbb10('0x103')]>=_0xe1ce37['dialMachineMaxRetry']-0x1){return!![];}this[_0xbb10('0xcd')]({'active':![],'countmachineretry':_0x33dac1[_0xbb10('0x103')]+=0x1,'scheduledat':moment()[_0xbb10('0x10a')](_0xe1ce37[_0xbb10('0x10b')],'minutes')[_0xbb10('0x83')](_0xbb10('0x10c')),'ContactId':_0x33dac1[_0xbb10('0xe0')],'ListId':_0x33dac1[_0xbb10('0xe1')],'VoiceQueueId':_0x33dac1[_0xbb10('0xe3')]||undefined,'CampaignId':_0x33dac1[_0xbb10('0xe4')]||undefined})['catch'](loggerCatch(_0xbb10('0x10d')));break;case 0x14:if(_0x33dac1[_0xbb10('0x1bc')]>=_0xe1ce37[_0xbb10('0x1c7')]-0x1){return!![];}this[_0xbb10('0xcd')]({'active':![],'countagentrejectretry':_0x33dac1[_0xbb10('0x1bc')]+=0x1,'scheduledat':moment()[_0xbb10('0x10a')](_0xe1ce37[_0xbb10('0x1c8')],_0xbb10('0x135'))[_0xbb10('0x83')](_0xbb10('0x10c')),'ContactId':_0x33dac1['ContactId'],'ListId':_0x33dac1[_0xbb10('0xe1')],'VoiceQueueId':_0x33dac1['VoiceQueueId']||undefined,'CampaignId':_0x33dac1[_0xbb10('0xe4')]||undefined})[_0xbb10('0xbc')](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer[_0xbb10('0x1d')][_0xbb10('0x1b9')]=function(_0x5e3903,_0x3a27ef,_0x836686){var _0x3a3d86=this;var _0x3b484e=new History(_0x5e3903);var _0x29fa42=![];var _0x969f63;var _0x7df075;return new Promise(function(_0x25d557,_0x3d693a){if(_['isUndefined'](_0x3a27ef)&&typeof _0x3a27ef!==_0xbb10('0x185')){return _0x3d693a(msgResponse(_0xbb10('0x1c9'),_0xbb10('0x156'),_0xbb10('0x1ca')));}if(_['isUndefined'](_0x836686)&&typeof _0x836686!==_0xbb10('0x185')){return _0x3d693a(msgResponse(_0xbb10('0x1c9'),_0xbb10('0x156'),_0xbb10('0x1cb')));}_0x3a3d86[_0xbb10('0xc5')](_0x3b484e,_0x836686[_0xbb10('0x11e')],_0x3a27ef)[_0xbb10('0xc2')](function(_0x173949){if(_0x173949['additional']==0x1)_0x29fa42=!![];switch(_0x836686[_0xbb10('0x11e')]){case'0':_0x3a27ef['outboundNoSuchCallsDay']+=0x1;_0x3b484e[_0xbb10('0x10f')]=0x0;_0x3b484e[_0xbb10('0xf2')]=_0xbb10('0x1cc');_0x3b484e['countnosuchnumberretry']+=0x1;_0x3b484e[_0xbb10('0xff')]+=0x1;ami[_0xbb10('0x55')](_0xbb10('0x1cd'),ut[_0xbb10('0xf6')](_0x5e3903,_0xbb10('0x1ce')));_0x969f63=_0x3a27ef[_0xbb10('0x1c5')];_0x7df075=_0x3a27ef[_0xbb10('0x12a')];_0x3a3d86[_0xbb10('0xd9')](_0x3b484e)[_0xbb10('0xbc')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x3a3d86[_0xbb10('0x1bb')](0x0,_0x5e3903,_0x3a27ef)&&!_0x29fa42){if(_0x3b484e['countnosuchnumberretry']>=_0x3a27ef[_0xbb10('0x1c4')]){_0x3a3d86[_0xbb10('0x108')](_0x3b484e,_0x25d557,_0x3d693a,_0xbb10('0x1cf'));}else{_0x3a3d86[_0xbb10('0x105')](_0x3b484e,_0x25d557,_0x3d693a,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x3a27ef[_0xbb10('0x6b')]+=0x1;_0x3b484e[_0xbb10('0x10f')]=0x3;_0x3b484e['statedesc']=_0xbb10('0x1d0');_0x3b484e[_0xbb10('0x102')]+=0x1;_0x3b484e[_0xbb10('0xff')]+=0x1;var _0x3ec649=ut['buildNoAnswerEventPayload'](_0x5e3903,_0x3a27ef);ami[_0xbb10('0x55')]('custom:agentnoanswer',_0x3ec649);_0x969f63=_0x3a27ef[_0xbb10('0x1be')];_0x7df075=_0x3a27ef['callAdditionalPhoneAfterMin'];_0x3a3d86[_0xbb10('0xd9')](_0x3b484e)[_0xbb10('0xbc')](loggerCatch(_0xbb10('0x1d1')));if(_0x3a3d86[_0xbb10('0x1bb')](0x3,_0x5e3903,_0x3a27ef)&&!_0x29fa42){if(_0x3b484e[_0xbb10('0x102')]>=_0x3a27ef[_0xbb10('0x1bd')]){_0x3a3d86[_0xbb10('0x108')](_0x3b484e,_0x25d557,_0x3d693a,_0xbb10('0x1d2'));}else{_0x3a3d86[_0xbb10('0x105')](_0x3b484e,_0x25d557,_0x3d693a,_0xbb10('0x1d2'));}}break;case'5':_0x3a27ef[_0xbb10('0x67')]+=0x1;_0x3b484e[_0xbb10('0x10f')]=0x5;_0x3b484e[_0xbb10('0xf2')]=_0xbb10('0x1d3');_0x3b484e['countbusyretry']+=0x1;_0x3b484e[_0xbb10('0xff')]+=0x1;ami['emit'](_0xbb10('0x1d4'),ut[_0xbb10('0xf6')](_0x5e3903,_0xbb10('0x1d5')));_0x969f63=_0x3a27ef['dialBusyRetryFrequency'];_0x7df075=_0x3a27ef[_0xbb10('0x12a')];_0x3a3d86[_0xbb10('0xd9')](_0x3b484e)[_0xbb10('0xbc')](loggerCatch(_0xbb10('0x1d6')));if(_0x3a3d86['checkRetriveMax'](0x5,_0x5e3903,_0x3a27ef)&&!_0x29fa42){if(_0x3b484e['countbusyretry']>=_0x3a27ef[_0xbb10('0x1d7')]){_0x3a3d86[_0xbb10('0x108')](_0x3b484e,_0x25d557,_0x3d693a,_0xbb10('0x1d8'));}else{_0x3a3d86[_0xbb10('0x105')](_0x3b484e,_0x25d557,_0x3d693a,'reason\x205\x20busy');}}break;case'8':_0x3a27ef[_0xbb10('0x68')]+=0x1;_0x3b484e[_0xbb10('0x10f')]=0x8;_0x3b484e[_0xbb10('0xf2')]='Congestion';_0x3b484e['countcongestionretry']+=0x1;_0x3b484e['countglobal']+=0x1;_0x969f63=_0x3a27ef['dialCongestionRetryFrequency'];_0x7df075=_0x3a27ef[_0xbb10('0x12a')];ami[_0xbb10('0x55')]('custom:agentcongestion',ut[_0xbb10('0xf6')](_0x5e3903,_0xbb10('0x1d9')));_0x3a3d86[_0xbb10('0xd9')](_0x3b484e)['catch'](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x3a3d86['checkRetriveMax'](0x8,_0x5e3903,_0x3a27ef)&&!_0x29fa42){if(_0x3b484e[_0xbb10('0x101')]>=_0x3a27ef[_0xbb10('0x1c1')]){_0x3a3d86['createStateFinal'](_0x3b484e,_0x25d557,_0x3d693a,_0xbb10('0x1da'));}else{_0x3a3d86[_0xbb10('0x105')](_0x3b484e,_0x25d557,_0x3d693a,_0xbb10('0x1da'));}}break;case'11':_0x3a27ef[_0xbb10('0x1db')]+=0x1;_0x3b484e['state']=0xb;_0x3b484e[_0xbb10('0xf2')]=_0xbb10('0x131');_0x3b484e[_0xbb10('0x132')]+=0x1;_0x3b484e['countglobal']+=0x1;_0x969f63=_0x3a27ef[_0xbb10('0x133')];_0x7df075=_0x3a27ef[_0xbb10('0x12a')];_0x3a3d86[_0xbb10('0xd9')](_0x3b484e)[_0xbb10('0xbc')](loggerCatch(_0xbb10('0x137')));if(_0x3a3d86[_0xbb10('0x1bb')](0xb,_0x5e3903,_0x3a27ef)&&!_0x29fa42){if(_0x3b484e['countabandonedretry']>=_0x3a27ef['dialAbandonedMaxRetry']){_0x3a3d86[_0xbb10('0x108')](_0x3b484e,_0x25d557,_0x3d693a,'reason\x2011\x20abandoned');}else{_0x3a3d86['stateGlobal'](_0x3b484e,_0x25d557,_0x3d693a,_0xbb10('0x1dc'));}}break;case'20':_0x3a27ef[_0xbb10('0x6e')]+=0x1;_0x3b484e[_0xbb10('0x10f')]=0x14;_0x3b484e[_0xbb10('0xf2')]=_0xbb10('0x1dd');_0x3b484e[_0xbb10('0x1bc')]+=0x1;_0x3b484e[_0xbb10('0xff')]+=0x1;_0x969f63=_0x3a27ef['dialAgentRejectRetryFrequency'];_0x7df075=_0x3a27ef[_0xbb10('0x12a')];ami[_0xbb10('0x55')](_0xbb10('0x1de'),ut[_0xbb10('0xf6')](_0x5e3903,_0xbb10('0x1df')));_0x3a3d86[_0xbb10('0xd9')](_0x3b484e)[_0xbb10('0xbc')](loggerCatch(_0xbb10('0x1e0')));if(_0x3a3d86[_0xbb10('0x1bb')](0x14,_0x5e3903,_0x3a27ef)&&!_0x29fa42){if(_0x3b484e[_0xbb10('0x1bc')]>=_0x3a27ef[_0xbb10('0x1c7')]){_0x3a3d86[_0xbb10('0x108')](_0x3b484e,_0x25d557,_0x3d693a,'reason\x2020\x20agentreject');}else{_0x3a3d86['stateGlobal'](_0x3b484e,_0x25d557,_0x3d693a,_0xbb10('0x1e1'));}}break;default:_0x3a27ef['outboundUnknownCallsDay']+=0x1;_0x3b484e[_0xbb10('0x10f')]=0xc;_0x3b484e[_0xbb10('0xf2')]=_0x836686['reason'];_0x969f63=_0x3a27ef['dialAgentRejectRetryFrequency'];_0x7df075=_0x3a27ef[_0xbb10('0x12a')];_0x3a3d86[_0xbb10('0xd9')](_0x3b484e)[_0xbb10('0xbc')](loggerCatch(_0xbb10('0x1e2')));if(_0x3a3d86[_0xbb10('0x1bb')](_0x836686[_0xbb10('0x11e')],_0x5e3903,_0x3a27ef)&&!_0x29fa42){if(_0x3b484e['countbusyretry']+_0x3b484e[_0xbb10('0x101')]+_0x3b484e[_0xbb10('0x102')]+_0x3b484e[_0xbb10('0x114')]+_0x3b484e[_0xbb10('0x115')]+_0x3b484e['countabandonedretry']+_0x3b484e['countmachineretry']+_0x3b484e[_0xbb10('0x1bc')]>=_0x3a27ef[_0xbb10('0x104')]){_0x3a3d86[_0xbb10('0x105')](_0x3b484e,_0x25d557,_0x3d693a,_0x836686[_0xbb10('0x11e')]);}else{_0x3a3d86[_0xbb10('0x108')](_0x3b484e,_0x25d557,_0x3d693a,_0x836686[_0xbb10('0x11e')]);}}}})['then'](function(){if(_0x29fa42){_0x3a3d86['swapAdditionalPhones'](_0x3b484e,_0x969f63,_0x7df075)[_0xbb10('0xc2')](function(){return _0x25d557(0x1);});}});});};Dialer[_0xbb10('0x1d')][_0xbb10('0x105')]=function(_0x468568,_0x58e537,_0x463d0f,_0xb2d651){var _0x32379b=new Final(_0x468568);_0x32379b[_0xbb10('0x10f')]=0xf;_0x32379b[_0xbb10('0xf2')]=_0xbb10('0x1e3');this[_0xbb10('0x108')](_0x32379b,_0x58e537,_0x463d0f,_0xb2d651);};Dialer['prototype'][_0xbb10('0x108')]=function(_0x185940,_0x26f413,_0x43584b,_0x313072){this[_0xbb10('0xd7')](_0x185940)[_0xbb10('0xc2')](function(){return _0x26f413(msgResponse(_0xbb10('0x1c9'),'Success',_0x313072));})[_0xbb10('0xbc')](function(){return _0x43584b(msgResponse(_0xbb10('0x1e4'),_0xbb10('0x156'),'contact\x20not\x20moved'));});};Dialer['prototype'][_0xbb10('0x9')]=function(_0x2d81db){var _0x28ee28=_0x2d81db[_0xbb10('0x1e5')]/0x64;var _0x5db829=_0x2d81db[_0xbb10('0x6a')]/(_0x2d81db[_0xbb10('0x6a')]+_0x2d81db[_0xbb10('0x66')]);var _0xb7f2fa=Math['round'](_0x2d81db[_0xbb10('0x79')]*(_0x2d81db[_0xbb10('0x1e6')]/0x64));var _0x385374=Math[_0xbb10('0x1e7')](_0x2d81db[_0xbb10('0x79')]*(_0x2d81db['predictiveIntervalMinThreshold']/0x64));var _0x21ae70=_0x2d81db[_0xbb10('0x58')]+_0x2d81db[_0xbb10('0x5d')];var _0x5273ef=Math['floor'](_0x2d81db[_0xbb10('0x7b')]*_0x2d81db['erlangAbandonmentRate']*_0x2d81db[_0xbb10('0x77')]*_0x2d81db['predictiveIntervalMultiplicativeFactor']);if(_[_0xbb10('0x93')](_0x2d81db[_0xbb10('0x2d')])){if(!_[_0xbb10('0x93')](_0x2d81db['startPredictive'])){_0x2d81db[_0xbb10('0x2c')]=undefined;loggerPredictive[_0xbb10('0xa3')]('[startMethodPredictive][StartProgressive]',_0xbb10('0x1e8'));}if(!_[_0xbb10('0x93')](_0x2d81db[_0xbb10('0x9d')])){loggerPredictive['error'](_0xbb10('0x1e9'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x2d81db[_0xbb10('0x9d')]);_0x2d81db[_0xbb10('0x9d')]=undefined;}_0x2d81db[_0xbb10('0x2d')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x2d81db[_0xbb10('0x47')],'collection\x20data\x20in\x20progressive\x20at',_0x2d81db[_0xbb10('0x2d')]);this['handlePower'](_0x2d81db,0x1);}else if(ifInterval(_0x2d81db[_0xbb10('0x1ea')],_0x2d81db[_0xbb10('0x2d')])){this['handlePower'](_0x2d81db,0x1);loggerPredictiveCalls['info'](_0xbb10('0x1eb'),_0x2d81db[_0xbb10('0x2d')],_0x2d81db['name']);_0x2d81db[_0xbb10('0x7b')]=0x0;_0x2d81db[_0xbb10('0x76')]=0x0;}else if(_0x28ee28<_0x5db829&&_0x2d81db[_0xbb10('0x1ec')]==='dropRate'){freeVariablesPredictive(_0x2d81db);loggerPredictive[_0xbb10('0x89')](_0xbb10('0x1ed'),_0xbb10('0x1ee'),_0x5db829,_0xbb10('0x2d'),_0x2d81db[_0xbb10('0x47')]);}else if(_0x5273ef<_0x2d81db[_0xbb10('0x76')]&&_0x2d81db[_0xbb10('0x1ec')]==='dropRate'){freeVariablesPredictive(_0x2d81db);loggerPredictive[_0xbb10('0x89')](_0xbb10('0x1ef'),_0xbb10('0x1f0'),_0x5273ef,'Drop\x20in\x20this\x20interval',_0x2d81db[_0xbb10('0x76')],_0xbb10('0x2d'),_0x2d81db['name']);}else if(!ifInterval(_0x2d81db[_0xbb10('0x1ea')],_0x2d81db[_0xbb10('0x2d')])&&_[_0xbb10('0x93')](_0x2d81db[_0xbb10('0x2c')])&&!_[_0xbb10('0x93')](_0x2d81db[_0xbb10('0x2d')])){_0x2d81db[_0xbb10('0x2c')]=moment()[_0xbb10('0x83')](_0xbb10('0x10c'));loggerPredictive[_0xbb10('0x89')](_0x2d81db[_0xbb10('0x47')],_0xbb10('0x1f1'),_0x2d81db[_0xbb10('0x2c')]);this['averageHandleTime'](_0x2d81db[_0xbb10('0x1ea')])[_0xbb10('0xc2')](this['getDataPredictive'](_0x2d81db))['then'](mergeDataErlangB(_0x2d81db))[_0xbb10('0xc2')](this[_0xbb10('0x1f2')](_0x2d81db))[_0xbb10('0xbc')](loggerCatchPredictive(_0xbb10('0x1f3'),_0x2d81db));}else if(!ifInterval(_0x2d81db['dialPredictiveInterval'],_0x2d81db[_0xbb10('0x2c')])){_0x2d81db['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x2d81db['startPredictive']=moment()['format'](_0xbb10('0x10c'));loggerPredictive[_0xbb10('0x89')](_0x2d81db[_0xbb10('0x47')],_0xbb10('0x1f4'),_0x2d81db['startPredictive']);clearInterval(_0x2d81db[_0xbb10('0x9d')]);_0x2d81db['handlePredictive']=undefined;this[_0xbb10('0xca')](_0x2d81db[_0xbb10('0x1ea')])[_0xbb10('0xc2')](this[_0xbb10('0x1f5')](_0x2d81db))[_0xbb10('0xc2')](mergeDataErlangB(_0x2d81db))[_0xbb10('0xc2')](this['startMethodPredictive'](_0x2d81db))['catch'](loggerCatchPredictive(_0xbb10('0x1f6'),_0x2d81db));}else if(_0x2d81db['predictiveIntervalAvailable']&&_0x21ae70<_0x2d81db[_0xbb10('0x79')]-_0x385374){freeVariablesPredictive(_0x2d81db);loggerPredictive[_0xbb10('0x89')](_0x2d81db[_0xbb10('0x47')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x21ae70,_0xbb10('0x1f7'),_0x2d81db[_0xbb10('0x79')],'-',_0x385374,'=',_0x2d81db[_0xbb10('0x79')]-_0x385374,')');}else if(_0x2d81db[_0xbb10('0x79')]&&_0x21ae70>_0x2d81db[_0xbb10('0x79')]+_0xb7f2fa){freeVariablesPredictive(_0x2d81db);loggerPredictive[_0xbb10('0x89')](_0x2d81db[_0xbb10('0x47')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x21ae70,_0xbb10('0x1f8'),_0x2d81db['predictiveIntervalAvailable'],'+',_0xb7f2fa,'=',_0x2d81db[_0xbb10('0x79')]+_0xb7f2fa,')');}};Dialer[_0xbb10('0x1d')][_0xbb10('0x1f5')]=function(_0x21139c){var _0x4276d6=this;return function(_0x2d5931){return new Promise(function(_0x550911,_0x2ddf65){_[_0xbb10('0x9b')](_0x21139c,_0x2d5931[0x0]);if(checkGetDataPredictive(_0x2d5931[0x0])){var _0x117375=_0x21139c['predictiveIntervalAvailable']=_0x21139c['talking']+_0x21139c[_0xbb10('0x58')];var _0x3134a6=_0x21139c['dialPredictiveInterval']*0x3c;var _0x51f8f3=_0x2d5931[0x0][_0xbb10('0x72')]+_0x2d5931[0x0][_0xbb10('0x71')];var _0xeb8dd3=(_0x2d5931[0x0][_0xbb10('0x70')]+_0x2d5931[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x2d5931[0x0][_0xbb10('0x73')])/_0x2d5931[0x0][_0xbb10('0x92')];_0x21139c[_0xbb10('0x77')]=_0xeb8dd3>0x0?_0xeb8dd3:0x1;switch(_0x21139c[_0xbb10('0x1ec')]){case'dropRate':var _0x5a4172=_0x21139c[_0xbb10('0x1e5')]/0x64;return _0x4276d6[_0xbb10('0x1f9')](_0x117375,_0x3134a6,_0x51f8f3,_0xeb8dd3,_0x5a4172)[_0xbb10('0xc2')](function(_0x98e790){return _0x550911(_0x98e790);});case _0xbb10('0x1fa'):var _0x1df852=_0x21139c[_0xbb10('0x1e5')]/0x64;return _0x4276d6['busyFactor'](_0x117375,_0x3134a6,_0x51f8f3,_0xeb8dd3,_0x1df852)[_0xbb10('0xc2')](function(_0x30fe12){return _0x550911(_0x30fe12);});default:return _0x2ddf65(msgResponse(_0xbb10('0x1fb'),_0xbb10('0x156'),'Unknown\x20Predictive'));}}else{return _0x2ddf65(msgResponse('[getDataPredictive]',_0xbb10('0x156'),_0xbb10('0x1fc')));}});};};Dialer[_0xbb10('0x1d')][_0xbb10('0x1fd')]=function(_0x4cf6ab){var _0x3ca88f=this;return function(_0x37bd6d){return new Promise(function(_0x66a0b8,_0x2df4dd){_[_0xbb10('0x9b')](_0x4cf6ab,_0x37bd6d[0x0]);if(checkGetDataPredictive(_0x37bd6d[0x0])){loggerPredictive[_0xbb10('0x89')](JSON['stringify'](_0x37bd6d[0x0]));if(_0x4cf6ab[_0xbb10('0x1ec')]===_0xbb10('0x1fe')){return _0x3ca88f[_0xbb10('0xd5')](_0x4cf6ab['id'])[_0xbb10('0xc2')](function(_0x3b156c){var _0x5c2c1c=_0x4cf6ab[_0xbb10('0x59')]-_0x3b156c[0x0][_0xbb10('0x1ff')];var _0x228027=_0x4cf6ab[_0xbb10('0x1ea')]*0x3c;var _0x2553ec=_0x37bd6d[0x0][_0xbb10('0x72')]+_0x37bd6d[0x0][_0xbb10('0x71')];var _0x1e87e3=(_0x37bd6d[0x0][_0xbb10('0x70')]+_0x37bd6d[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x37bd6d[0x0][_0xbb10('0x73')])/_0x37bd6d[0x0]['predictiveIntervalTotalCalls'];var _0x3c4abf=_0x4cf6ab[_0xbb10('0x1e5')]/0x64;_0x4cf6ab[_0xbb10('0x78')]=_0x3b156c[0x0][_0xbb10('0x1ff')]||0x0;_0x4cf6ab[_0xbb10('0x77')]=_0x1e87e3>0x0?_0x1e87e3:0x1;return _0x3ca88f[_0xbb10('0x1f9')](_0x5c2c1c,_0x228027,_0x2553ec,_0x1e87e3,_0x3c4abf);})['then'](function(_0xdf2955){return _0x66a0b8(_0xdf2955);})[_0xbb10('0xbc')](function(_0x6350a6){return _0x2df4dd(msgResponse(_0xbb10('0x200'),_0xbb10('0x156'),JSON[_0xbb10('0x82')](_0x6350a6)));});}if(_0x4cf6ab['dialPredictiveOptimization']===_0xbb10('0x1fa')){return _0x3ca88f['getVoiceQueueRtPauses'](_0x4cf6ab['id'])['then'](function(_0x3f346b){var _0x54d70f=_0x4cf6ab[_0xbb10('0x59')]-_0x3f346b[0x0][_0xbb10('0x1ff')];var _0x5441c8=_0x4cf6ab[_0xbb10('0x1ea')]*0x3c;var _0x7c1f83=_0x37bd6d[0x0][_0xbb10('0x72')]+_0x37bd6d[0x0][_0xbb10('0x71')];var _0x3a3912=(_0x37bd6d[0x0][_0xbb10('0x70')]+_0x37bd6d[0x0][_0xbb10('0x74')]+_0x37bd6d[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x37bd6d[0x0][_0xbb10('0x92')];var _0x21c4dd=_0x4cf6ab[_0xbb10('0x1e5')]/0x64;_0x4cf6ab[_0xbb10('0x78')]=_0x3f346b[0x0][_0xbb10('0x1ff')]||0x0;_0x4cf6ab[_0xbb10('0x77')]=_0x3a3912>0x0?_0x3a3912:0x1;return _0x3ca88f[_0xbb10('0x201')](_0x54d70f,_0x5441c8,_0x7c1f83,_0x3a3912,_0x21c4dd);})['then'](function(_0x56d89c){return _0x66a0b8(_0x56d89c);})[_0xbb10('0xbc')](function(_0x3ec298){return _0x2df4dd(msgResponse(_0xbb10('0x200'),'Failure',JSON[_0xbb10('0x82')](_0x3ec298)));});}}else{return _0x2df4dd(msgResponse(_0xbb10('0x1fb'),_0xbb10('0x156'),_0xbb10('0x1fc')));}});};};Dialer[_0xbb10('0x1d')][_0xbb10('0x1f2')]=function(_0x4f162d){var _0x3a6a8b=this;return function(){var _0x48a25d=0x0;var _0x14a786=Math[_0xbb10('0x202')](_0x4f162d['erlangCallToSecond']*0x3e8);if(_0x14a786>0x0){_0x14a786=_0x14a786<0x64?0x64:_0x14a786;loggerPredictive['info'](_0x4f162d['name'],_0xbb10('0x203'),_0x14a786,_0xbb10('0x52'));_0x4f162d[_0xbb10('0x9d')]=setInterval(function(){_0x3a6a8b[_0xbb10('0x9d')](_0x4f162d);loggerPredictiveCalls[_0xbb10('0x89')](_0xbb10('0x204'),_0x48a25d+=0x1);},_0x14a786);}else{loggerPredictive[_0xbb10('0x89')](_0x4f162d[_0xbb10('0x47')],_0xbb10('0x205'));}};};Dialer[_0xbb10('0x1d')]['checkContactBlack']=function(_0x1ab3d1,_0x175398){var _0x5b3340=this;return function(_0x8c06ed){if(_['isEmpty'](_0x8c06ed)){if(_['isNil'](_0x175398['UserId'])||!_0x175398[_0xbb10('0x206')]){if(_0x1ab3d1[_0xbb10('0x63')]==='booked'){_0x1ab3d1[_0xbb10('0x13e')]=_[_0xbb10('0x93')](_0x1ab3d1[_0xbb10('0x13e')])?!![]:_0x1ab3d1[_0xbb10('0x13e')];var _0x3cb207=uuid['v4']();_0x5b3340[_0xbb10('0x29')][_0x3cb207]=new Action(_0x1ab3d1,_0x175398,_0x3cb207);loggerBooked[_0xbb10('0x89')]('[booked][checkContactBlack]',_0x3cb207,_0xbb10('0x207'),JSON['stringify'](_0x1ab3d1['queueStatusComplete']),'Queue:\x20',_0x1ab3d1['name']);if(_0x1ab3d1[_0xbb10('0x13e')]){_0x1ab3d1[_0xbb10('0x13e')]=![];_0x5b3340[_0xbb10('0x13d')][_0x5b3340[_0xbb10('0x29')][_0x3cb207][_0xbb10('0xbe')]]=[];ami['Action']({'actionid':_0x3cb207,'action':'queuestatus','queue':_0x1ab3d1[_0xbb10('0x47')]})[_0xbb10('0xbc')](function(){_0x5b3340['updateOriginated'](_0x1ab3d1);_0x5b3340['rescheduleContact']({'active':![],'ContactId':_0x5b3340[_0xbb10('0x29')][_0x3cb207][_0xbb10('0xe0')],'ListId':_0x5b3340[_0xbb10('0x29')][_0x3cb207][_0xbb10('0xe1')],'VoiceQueueId':_0x5b3340[_0xbb10('0x29')][_0x3cb207][_0xbb10('0xe3')]||undefined,'CampaignId':_0x5b3340[_0xbb10('0x29')][_0x3cb207][_0xbb10('0xe4')]||undefined})[_0xbb10('0xbc')](loggerCatch(_0xbb10('0x208')));delete _0x5b3340[_0xbb10('0x29')][_0x3cb207];});}else{loggerBooked[_0xbb10('0x89')](_0xbb10('0x209'),JSON[_0xbb10('0x82')](_0x1ab3d1[_0xbb10('0x13e')]),_0xbb10('0x20a'),_0x1ab3d1[_0xbb10('0x47')]);_0x5b3340[_0xbb10('0xbd')](_0x1ab3d1);_0x5b3340[_0xbb10('0xcd')]({'active':![],'ContactId':_0x5b3340[_0xbb10('0x29')][_0x3cb207]['ContactId'],'ListId':_0x5b3340[_0xbb10('0x29')][_0x3cb207][_0xbb10('0xe1')],'VoiceQueueId':_0x5b3340['actions'][_0x3cb207][_0xbb10('0xe3')]||undefined,'CampaignId':_0x5b3340['actions'][_0x3cb207][_0xbb10('0xe4')]||undefined})[_0xbb10('0xbc')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x5b3340[_0xbb10('0x29')][_0x3cb207];}}else{return _0x5b3340[_0xbb10('0x184')](_0x1ab3d1,_0x175398);}}else{if(getDiff(_0x175398[_0xbb10('0x20b')])<_0x1ab3d1[_0xbb10('0x20c')]*0x3c){if(_0x175398[_0xbb10('0x17d')]&&!_0x175398[_0xbb10('0x17d')]['voicePause']){_0x5b3340[_0xbb10('0x22')]['run'](_0x175398['id'])[_0xbb10('0x20')](function(){_0x5b3340[_0xbb10('0xbd')](_0x1ab3d1);});}else{_0x5b3340[_0xbb10('0xcf')]({'active':![]},_0x175398['id'],0x1)[_0xbb10('0x20')](function(){_0x5b3340[_0xbb10('0xbd')](_0x1ab3d1);});}}else{_0x1ab3d1[_0xbb10('0x6d')]+=0x1;_0x5b3340['updateOriginated'](_0x1ab3d1);if(_0x1ab3d1[_0xbb10('0x20d')]){_0x5b3340['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x175398[_0xbb10('0xe0')],'ListId':_0x175398[_0xbb10('0xe1')],'VoiceQueueId':_0x175398['VoiceQueueId']||undefined,'CampaignId':_0x175398['CampaignId']||undefined})[_0xbb10('0xbc')](loggerCatch(_0xbb10('0x20e')));_0x5b3340[_0xbb10('0xd9')](createObjHistory(_0x1ab3d1,_0x175398,_0xbb10('0x20f'),0x17,_0xbb10('0x210')))[_0xbb10('0xbc')](loggerCatch(_0xbb10('0x211')));}else{_0x5b3340[_0xbb10('0xf8')](createObjHistory(_0x1ab3d1,_0x175398,_0xbb10('0x212'),0x16,_0xbb10('0x213')),_0xbb10('0x214'),_0xbb10('0x215'));}}}}else{_0x1ab3d1['outboundBlacklistCallsDay']+=0x1;_0x5b3340[_0xbb10('0xf8')](createObjHistory(_0x1ab3d1,_0x175398,_0xbb10('0x216'),0xd,_0xbb10('0x217')),_0xbb10('0x218'),_0xbb10('0x219'));throw _0xbb10('0x21a');}};};Dialer[_0xbb10('0x1d')]['handleIvr']=function(_0x555140){var _0xc65a96=this;var _0x4e00a7=_0x555140[_0xbb10('0x21b')]-_0x555140['originated']-_0x555140[_0xbb10('0xd1')];emitCampaignSummary(_0x555140);if(_0x4e00a7>0x0){if(_0x4e00a7>this['maxNumberOriginate']){_0x4e00a7=this[_0xbb10('0x27')];}_0x555140[_0xbb10('0xd1')]+=_0x4e00a7;this['getContactDialerIvr'](_0x555140['id'],_0x4e00a7,_0x555140['dialOrderByScheduledAt'],_0x555140)[_0xbb10('0xc2')](function(_0x4be84b){_0x555140[_0xbb10('0xd1')]-=_0x4e00a7;_0x555140[_0xbb10('0xd1')]=_0x555140[_0xbb10('0xd1')]>0x0?_0x555140['temp']:0x0;if(!checkContactEmpty(_0x4be84b)){_0x555140['message']=_0xbb10('0xaa');logger[_0xbb10('0x89')](_0xbb10('0x21c')+_0x555140[_0xbb10('0x47')]);}else{_0x555140['originated']+=_0x4be84b['length'];_0x555140[_0xbb10('0x46')]=_0xbb10('0x21d');for(var _0x434b54=0x0;_0x434b54<_0x4be84b['length'];_0x434b54+=0x1){_0x555140[_0xbb10('0x21e')]+=0x1;if(_[_0xbb10('0xb8')](_0x4be84b[_0x434b54])||_[_0xbb10('0xb8')](_0x4be84b[_0x434b54]['Contact'])||_[_0xbb10('0xb8')](_0x4be84b[_0x434b54][_0xbb10('0x188')])){_0xc65a96[_0xbb10('0xde')]('[actionOriginate]\x20',_0x555140,_0x4be84b[_0x434b54]);}else{_0xc65a96[_0xbb10('0xc8')](_[_0xbb10('0xdf')](_0x4be84b[_0x434b54],['CampaignId','Contact.phone']))[_0xbb10('0xc2')](_0xc65a96[_0xbb10('0x21f')](_0x555140,_0x4be84b[_0x434b54]))[_0xbb10('0xbc')](_0xc65a96['loggerHandler'](_0xbb10('0x220'),_0x555140));}}}})[_0xbb10('0xbc')](loggerGetContactDialer(_0xbb10('0x221'),_0x555140,_0x4e00a7));}};Dialer[_0xbb10('0x1d')][_0xbb10('0x16e')]=function(_0x55d0a9,_0x35a95a){var _0x14ecd7=this;var _0x1ca18a=[];var _0x3b9ab7=_0x35a95a>=0x1?_0x35a95a:0x1;if(_0x55d0a9[_0xbb10('0x63')]===_0xbb10('0x8')){_0x3b9ab7=0x1;}var _0x196bc0=Math[_0xbb10('0x202')](_0x55d0a9[_0xbb10('0x58')]*_0x3b9ab7)-_0x55d0a9[_0xbb10('0x7a')]-_0x55d0a9[_0xbb10('0xd1')];emitVoiceQueueSummary(_0x55d0a9);if(_0x55d0a9[_0xbb10('0x222')]>0x0){var _0x439322=_0x55d0a9['dialLimitQueue']-_0x55d0a9[_0xbb10('0x7a')]-_0x55d0a9['talking']-_0x55d0a9['temp']-_0x55d0a9[_0xbb10('0x5a')];if(_0x196bc0>_0x439322){_0x196bc0=_0x439322;}}if(_0x196bc0>0x0){if(_0x55d0a9[_0xbb10('0x63')]===_0xbb10('0x8')){_0x196bc0=0x1;}if(_0x196bc0>this['maxNumberOriginate']){_0x196bc0=this[_0xbb10('0x27')];}_0x55d0a9[_0xbb10('0xd1')]+=_0x196bc0;for(var _0x160b82 in this[_0xbb10('0x25')]){if(typeof this[_0xbb10('0x25')][_0x160b82]!==_0xbb10('0xb7')){if(this[_0xbb10('0x25')][_0x160b82]['state']==='not_inuse'&&this[_0xbb10('0x25')][_0x160b82][_0xbb10('0xba')]===_0xbb10('0xea')){_0x1ca18a[_0xbb10('0x162')](this[_0xbb10('0x25')][_0x160b82]['id']);}}}this[_0xbb10('0xd0')](_0x55d0a9['id'],_0x1ca18a,_0x196bc0,_0x55d0a9[_0xbb10('0x223')],_0x55d0a9)[_0xbb10('0xc2')](function(_0x264837){_0x55d0a9[_0xbb10('0xd1')]-=_0x196bc0;_0x55d0a9['temp']=_0x55d0a9[_0xbb10('0xd1')]>0x0?_0x55d0a9[_0xbb10('0xd1')]:0x0;if(!checkContactEmpty(_0x264837)){_0x14ecd7[_0xbb10('0xc3')](_0x55d0a9)[_0xbb10('0xc2')](sendMessageReschedule(_0x55d0a9))[_0xbb10('0xbc')](loggerCatch(_0xbb10('0x224')));}else{_0x55d0a9[_0xbb10('0x7a')]+=_0x264837['length'];_0x55d0a9[_0xbb10('0x46')]=_0x55d0a9[_0xbb10('0x63')]==='booked'?_0xbb10('0x190'):'RUNNING';for(var _0xb427a4=0x0;_0xb427a4<_0x264837[_0xbb10('0xa5')];_0xb427a4+=0x1){if(_['isNil'](_0x264837[_0xb427a4])||_['isNil'](_0x264837[_0xb427a4]['Contact'])||_[_0xbb10('0xb8')](_0x264837[_0xb427a4]['phone'])){_0x14ecd7['emptyContact']('[actionOriginate]\x20',_0x55d0a9,_0x264837[_0xb427a4]);}else{_0x14ecd7['checkIsBlackList'](_[_0xbb10('0xdf')](_0x264837[_0xb427a4],[_0xbb10('0xe3'),_0xbb10('0x225')]))[_0xbb10('0xc2')](_0x14ecd7[_0xbb10('0x21f')](_0x55d0a9,_0x264837[_0xb427a4]))[_0xbb10('0xbc')](_0x14ecd7[_0xbb10('0xdd')](_0xbb10('0x226'),_0x55d0a9));}}}})[_0xbb10('0xbc')](loggerGetContactDialer('[getContactDialer2]',_0x55d0a9,_0x196bc0));}};Dialer[_0xbb10('0x1d')][_0xbb10('0x9d')]=function(_0x32b778){if(_0x32b778[_0xbb10('0x222')]>0x0){var _0x3152b0=_0x32b778[_0xbb10('0x222')]-_0x32b778['originated']-_0x32b778[_0xbb10('0x5d')];if(_0x3152b0>0x0){this[_0xbb10('0x227')](_0x32b778);}else{loggerPredictiveCalls[_0xbb10('0x89')](_0xbb10('0x228'));}}else{this[_0xbb10('0x227')](_0x32b778);}};Dialer[_0xbb10('0x1d')][_0xbb10('0x227')]=function(_0x260715){var _0x50fce7=this;var _0x23855a=[];_0x260715['originated']+=0x1;for(var _0x474af7 in this['agents']){if(typeof this['agents'][_0x474af7]!==_0xbb10('0xb7')){if(this[_0xbb10('0x25')][_0x474af7][_0xbb10('0x10f')]==='not_inuse'&&this['agents'][_0x474af7]['status']==='reachable'){_0x23855a[_0xbb10('0x162')](this[_0xbb10('0x25')][_0x474af7]['id']);}}}this['getContactDialer'](_0x260715['id'],_0x23855a,0x1,_0x260715['dialOrderByScheduledAt'],_0x260715)[_0xbb10('0xc2')](function(_0x37b4b2){if(!checkContactEmpty(_0x37b4b2)){checkContactLowerLimitOriginate(_0x260715,0x1,0x0);_0x50fce7['countReScheduled'](_0x260715)[_0xbb10('0xc2')](sendMessageReschedule(_0x260715))[_0xbb10('0xbc')](loggerCatch(_0xbb10('0x224')));}else{_0x260715[_0xbb10('0x46')]=_0xbb10('0x21d');if(_[_0xbb10('0xb8')](_0x37b4b2[0x0])||_[_0xbb10('0xb8')](_0x37b4b2[0x0][_0xbb10('0x1a2')])||_[_0xbb10('0xb8')](_0x37b4b2[0x0][_0xbb10('0x188')])){_0x50fce7[_0xbb10('0xde')]('[actionOriginate]\x20',_0x260715,_0x37b4b2[0x0]);}else{_0x50fce7[_0xbb10('0x229')](_[_0xbb10('0xdf')](_0x37b4b2[0x0],[_0xbb10('0xe3'),_0xbb10('0x225')]))[_0xbb10('0xc2')](_0x50fce7[_0xbb10('0x21f')](_0x260715,_0x37b4b2[0x0]))[_0xbb10('0xbc')](_0x50fce7['loggerHandler'](_0xbb10('0x22a'),_0x260715));}}})['catch'](loggerGetContactDialer(_0xbb10('0x22b'),_0x260715,0x1));emitVoiceQueueSummary(_0x260715);};Dialer[_0xbb10('0x1d')][_0xbb10('0x1f9')]=function(_0x2e34ea,_0x298e18,_0xbd394f,_0xf39c0d,_0x37be00,_0x11b9f7){loggerPredictive['info'](_0xbb10('0x22c'));loggerPredictive[_0xbb10('0x89')]('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',_0x2e34ea);loggerPredictive[_0xbb10('0x89')](_0xbb10('0x22d'),_0x298e18);loggerPredictive[_0xbb10('0x89')]('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',_0xbd394f);loggerPredictive[_0xbb10('0x89')]('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',_0xf39c0d);loggerPredictive['info'](_0xbb10('0x22e'),_0x37be00);loggerPredictive[_0xbb10('0x89')](_0xbb10('0x91'));return new Promise(function(_0x5153ef,_0x434580){if(_0x2e34ea<=0x0||isNaN(_0x2e34ea)){return _0x434580(msgResponse(_0xbb10('0x22f'),_0xbb10('0x51'),_0xbb10('0x230')+_0x2e34ea));}if(_0xbd394f<=0x0||isNaN(_0xbd394f)){return _0x434580(msgResponse(_0xbb10('0x22f'),'Error',_0xbb10('0x231')+_0xbd394f));}if(_0xf39c0d<=0x0||isNaN(_0xf39c0d)){return _0x434580(msgResponse('[abandonmentRate]',_0xbb10('0x51'),_0xbb10('0x232')+_0xf39c0d));}if(_0x298e18<=0x0||isNaN(_0x298e18)){return _0x434580(msgResponse('[abandonmentRate]','Error',_0xbb10('0x233')+_0x298e18));}if(_0x37be00<=0x0||isNaN(_0x37be00)){return _0x434580(msgResponse(_0xbb10('0x22f'),_0xbb10('0x51'),_0xbb10('0x234')+_0x37be00));}_0x11b9f7=_0x11b9f7||0x0;var _0x55e1eb=0x1/_0xbd394f;var _0x385a49=0x0;var _0x174892=0x0;var _0x45be3b=0x0;var _0x4269c9=0x0;for(var _0x1e7f42=0x0;_0x45be3b<_0x37be00;_0x1e7f42+=0x1){_0x174892=_0x1e7f42/_0x298e18;_0x385a49=(_0xf39c0d*_0x174892+_0x11b9f7)/_0x55e1eb;_0x45be3b=erlangb(_0x385a49,_0x2e34ea);_0x4269c9=_0x385a49/_0x2e34ea*(0x1-erlangb(_0x385a49,_0x2e34ea));}return _0x5153ef({'erlangCalls':_0x1e7f42,'erlangCallToSecond':_0x298e18/_0x1e7f42,'erlangAbandonmentRate':_0x45be3b,'erlangBusyFactor':_0x4269c9});});};Dialer[_0xbb10('0x1d')][_0xbb10('0x201')]=function(_0x397c33,_0x4e3f92,_0xf2ab83,_0x1ad4ec,_0x2cb4be,_0x2f66ba){loggerPredictive['info'](_0xbb10('0x235'));loggerPredictive[_0xbb10('0x89')](_0xbb10('0x236'),_0x397c33);loggerPredictive[_0xbb10('0x89')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4e3f92);loggerPredictive[_0xbb10('0x89')]('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',_0xf2ab83);loggerPredictive[_0xbb10('0x89')]('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',_0x1ad4ec);loggerPredictive[_0xbb10('0x89')](_0xbb10('0x237'),_0x2cb4be);loggerPredictive[_0xbb10('0x89')](_0xbb10('0x91'));return new Promise(function(_0x27adad,_0x5a6b68){if(_0x397c33<=0x0||isNaN(_0x397c33)){return _0x5a6b68(msgResponse(_0xbb10('0x238'),'Error','m\x20=\x20'+_0x397c33));}if(_0xf2ab83<=0x0||isNaN(_0xf2ab83)){return _0x5a6b68(msgResponse(_0xbb10('0x238'),_0xbb10('0x51'),_0xbb10('0x231')+_0xf2ab83));}if(_0x1ad4ec<=0x0||isNaN(_0x1ad4ec)){return _0x5a6b68(msgResponse(_0xbb10('0x238'),'Error',_0xbb10('0x232')+_0x1ad4ec));}if(_0x4e3f92<=0x0||isNaN(_0x4e3f92)){return _0x5a6b68(msgResponse('[busyFactor]','Error',_0xbb10('0x233')+_0x4e3f92));}if(_0x2cb4be<=0x0||isNaN(_0x2cb4be)){return _0x5a6b68(msgResponse('[busyFactor]','Error',_0xbb10('0x239')+_0x2cb4be));}_0x2f66ba=_0x2f66ba||0x0;var _0xb998a1=0x1/_0xf2ab83;var _0x248c5c=0x0;var _0x456ecb=0x0;var _0x1391b7=0x0;var _0x4d5ac5=0x0;for(var _0x366f17=0x0;_0x4d5ac5<_0x2cb4be;_0x366f17+=0x1){_0x456ecb=_0x366f17/_0x4e3f92;_0x248c5c=(_0x1ad4ec*_0x456ecb+_0x2f66ba)/_0xb998a1;_0x1391b7=erlangb(_0x248c5c,_0x397c33);_0x4d5ac5=_0x248c5c/_0x397c33*(0x1-erlangb(_0x248c5c,_0x397c33));}return _0x27adad({'erlangCalls':_0x366f17,'erlangCallToSecond':_0x4e3f92/_0x366f17,'erlangAbandonmentRate':_0x1391b7,'erlangBusyFactor':_0x4d5ac5});});};module[_0xbb10('0x23a')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index 106522a..dcc3876 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 _0xbd8c=['CampaignId','originatecalleridnum','exports','util','lodash','moment','milliseconds','diff','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','number','starttime','responsetime','droptime','endtime','ringtime','holdtime','talktime','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId'];(function(_0x295a3d,_0x56d487){var _0x23a732=function(_0x15cfc2){while(--_0x15cfc2){_0x295a3d['push'](_0x295a3d['shift']());}};_0x23a732(++_0x56d487);}(_0xbd8c,0x1a7));var _0xcbd8=function(_0x18baa3,_0x5db510){_0x18baa3=_0x18baa3-0x0;var _0x4bc90d=_0xbd8c[_0x18baa3];return _0x4bc90d;};'use strict';var util=require(_0xcbd8('0x0'));var _=require(_0xcbd8('0x1'));var moment=require(_0xcbd8('0x2'));function getSeconds(_0x14436b,_0x25d9cb){var _0x37e034=moment(_0x14436b)['milliseconds'](0x0);var _0x1c7410=moment(_0x25d9cb)[_0xcbd8('0x3')](0x0);return _0x37e034[_0xcbd8('0x4')](_0x1c7410,'seconds');}function QueueCallerAbandon(_0x5597bd,_0x5aa5ab){this[_0xcbd8('0x5')]=_0x5597bd[_0xcbd8('0x5')];this[_0xcbd8('0x6')]=_0x5597bd[_0xcbd8('0x6')];this[_0xcbd8('0x7')]=_0x5597bd[_0xcbd8('0x6')]===_0xcbd8('0x8')?_0xcbd8('0x9'):_0x5597bd[_0xcbd8('0x6')];this[_0xcbd8('0xa')]=_0x5597bd[_0xcbd8('0xa')];this[_0xcbd8('0xb')]=_0x5597bd[_0xcbd8('0xb')];this[_0xcbd8('0xc')]=_0x5597bd['countnoanswerretry'];this[_0xcbd8('0xd')]=_0x5597bd[_0xcbd8('0xa')]+_0x5597bd[_0xcbd8('0xb')]+_0x5597bd[_0xcbd8('0xc')]+_0x5597bd[_0xcbd8('0xe')]+_0x5597bd[_0xcbd8('0xf')]+_0x5597bd[_0xcbd8('0x10')]+_0x5597bd[_0xcbd8('0x11')]+_0x5597bd[_0xcbd8('0x12')];this[_0xcbd8('0xe')]=_0x5597bd['countnosuchnumberretry'];this[_0xcbd8('0xf')]=_0x5597bd[_0xcbd8('0xf')];this[_0xcbd8('0x10')]=_0x5597bd[_0xcbd8('0x10')];this[_0xcbd8('0x11')]=_0x5597bd[_0xcbd8('0x11')];this[_0xcbd8('0x12')]=_0x5597bd['countagentrejectretry'];this['uniqueid']=_0x5aa5ab['uniqueid'];this[_0xcbd8('0x13')]=_0x5597bd['name'];this[_0xcbd8('0x14')]=_0x5597bd[_0xcbd8('0x15')];this[_0xcbd8('0x16')]=_0x5597bd[_0xcbd8('0x16')];this[_0xcbd8('0x17')]=_0x5597bd[_0xcbd8('0x17')];this['droptime']=_0x5597bd[_0xcbd8('0x18')];this[_0xcbd8('0x19')]=this['droptime'];this[_0xcbd8('0x1a')]=getSeconds(_0x5597bd[_0xcbd8('0x17')],_0x5597bd[_0xcbd8('0x16')]);this[_0xcbd8('0x1b')]=getSeconds(this[_0xcbd8('0x18')],_0x5597bd[_0xcbd8('0x17')]);this[_0xcbd8('0x1c')]=0x0;this['queue']=_0x5aa5ab[_0xcbd8('0x9')];this['membername']=_0x5aa5ab[_0xcbd8('0x1d')];this[_0xcbd8('0x1e')]=_0x5aa5ab['reason'];this[_0xcbd8('0x1f')]=_0x5597bd['callback'];this['callbackuniqueid']=_0x5597bd[_0xcbd8('0x20')];this[_0xcbd8('0x21')]=_0x5597bd[_0xcbd8('0x21')];this[_0xcbd8('0x22')]=_0x5597bd['recallme'];this[_0xcbd8('0x23')]=_0x5597bd[_0xcbd8('0x23')];this[_0xcbd8('0x24')]=_0x5597bd[_0xcbd8('0x24')];this[_0xcbd8('0x25')]=_0x5597bd[_0xcbd8('0x25')];this[_0xcbd8('0x26')]=_0x5597bd[_0xcbd8('0x26')];this[_0xcbd8('0x27')]=_0x5597bd[_0xcbd8('0x27')];this[_0xcbd8('0x28')]=_0x5597bd['originatecalleridnum']||'';this['originatecalleridname']=_0x5597bd['originatecalleridname']||'';}module[_0xcbd8('0x29')]=QueueCallerAbandon; \ No newline at end of file +var _0xeedb=['recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment','milliseconds','diff','seconds','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','name','calleridnum','number','starttime','responsetime','droptime','endtime','ringtime','holdtime','talktime','membername','connectedlinename','callback','callbackuniqueid','callbackat'];(function(_0x43ecba,_0x328819){var _0x46610f=function(_0x50b318){while(--_0x50b318){_0x43ecba['push'](_0x43ecba['shift']());}};_0x46610f(++_0x328819);}(_0xeedb,0x159));var _0xbeed=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xeedb[_0x187ee1];return _0x388160;};'use strict';var util=require(_0xbeed('0x0'));var _=require('lodash');var moment=require(_0xbeed('0x1'));function getSeconds(_0x2add3e,_0x45a85e){var _0x1d57b3=moment(_0x2add3e)[_0xbeed('0x2')](0x0);var _0xb15c43=moment(_0x45a85e)['milliseconds'](0x0);return _0x1d57b3[_0xbeed('0x3')](_0xb15c43,_0xbeed('0x4'));}function QueueCallerAbandon(_0x459d09,_0x266347){this[_0xbeed('0x5')]=_0x459d09['scheduledat'];this[_0xbeed('0x6')]=_0x459d09[_0xbeed('0x6')];this['campaigntype']=_0x459d09['type']===_0xbeed('0x7')?_0xbeed('0x8'):_0x459d09[_0xbeed('0x6')];this['countbusyretry']=_0x459d09[_0xbeed('0x9')];this['countcongestionretry']=_0x459d09[_0xbeed('0xa')];this[_0xbeed('0xb')]=_0x459d09[_0xbeed('0xb')];this['countglobal']=_0x459d09[_0xbeed('0x9')]+_0x459d09['countcongestionretry']+_0x459d09['countnoanswerretry']+_0x459d09['countnosuchnumberretry']+_0x459d09[_0xbeed('0xc')]+_0x459d09[_0xbeed('0xd')]+_0x459d09[_0xbeed('0xe')]+_0x459d09[_0xbeed('0xf')];this[_0xbeed('0x10')]=_0x459d09[_0xbeed('0x10')];this[_0xbeed('0xc')]=_0x459d09[_0xbeed('0xc')];this[_0xbeed('0xd')]=_0x459d09[_0xbeed('0xd')];this[_0xbeed('0xe')]=_0x459d09[_0xbeed('0xe')];this['countagentrejectretry']=_0x459d09['countagentrejectretry'];this[_0xbeed('0x11')]=_0x266347[_0xbeed('0x11')];this['calleridname']=_0x459d09[_0xbeed('0x12')];this[_0xbeed('0x13')]=_0x459d09[_0xbeed('0x14')];this[_0xbeed('0x15')]=_0x459d09['starttime'];this['responsetime']=_0x459d09[_0xbeed('0x16')];this[_0xbeed('0x17')]=_0x459d09['droptime'];this[_0xbeed('0x18')]=this[_0xbeed('0x17')];this[_0xbeed('0x19')]=getSeconds(_0x459d09['responsetime'],_0x459d09[_0xbeed('0x15')]);this[_0xbeed('0x1a')]=getSeconds(this[_0xbeed('0x17')],_0x459d09[_0xbeed('0x16')]);this[_0xbeed('0x1b')]=0x0;this['queue']=_0x266347[_0xbeed('0x8')];this[_0xbeed('0x1c')]=_0x266347[_0xbeed('0x1d')];this['reason']=_0x266347['reason'];this[_0xbeed('0x1e')]=_0x459d09[_0xbeed('0x1e')];this[_0xbeed('0x1f')]=_0x459d09[_0xbeed('0x1f')];this[_0xbeed('0x20')]=_0x459d09[_0xbeed('0x20')];this[_0xbeed('0x21')]=_0x459d09['recallme'];this[_0xbeed('0x22')]=_0x459d09[_0xbeed('0x22')];this[_0xbeed('0x23')]=_0x459d09[_0xbeed('0x23')];this[_0xbeed('0x24')]=_0x459d09[_0xbeed('0x24')];this[_0xbeed('0x25')]=_0x459d09[_0xbeed('0x25')];this[_0xbeed('0x26')]=_0x459d09[_0xbeed('0x26')];this[_0xbeed('0x27')]=_0x459d09[_0xbeed('0x27')]||'';this[_0xbeed('0x28')]=_0x459d09[_0xbeed('0x28')]||'';}module[_0xbeed('0x29')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 3261de1..725f913 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(_0x365072,_0x16f68c){var _0x5cdc5b=function(_0x50da5a){while(--_0x50da5a){_0x365072['push'](_0x365072['shift']());}};_0x5cdc5b(++_0x16f68c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'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(_0x34b8d8,_0x452834){var _0x577312=function(_0x2c3aeb){while(--_0x2c3aeb){_0x34b8d8['push'](_0x34b8d8['shift']());}};_0x577312(++_0x452834);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'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 dacfa56..1bba0f8 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 _0xb235=['moment','path','tiff2pdf','./util/gs','../../../config/logger','fax','./rpcDb','./channel','./util/util','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','bind','varset','syncVarSet','newstate','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','syncNewchannel','context','from-voip-provider','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','prototype','channelstate','channelstatedesc','hasOwnProperty','operation','status','filename','remotestationid','pagestransferred','resolution','transferrate','calleridnum','\x20result\x20conversion\x20file\x20','message','parse','.pdf','then','notify','catch','\x20notify\x20','error','\x20receiveFax\x20','stringify','pick','reason','update','AttachmentId','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','[Fax][Message][NoUpdate2]','\x20hangup\x20faxRiceive\x20','faxpages','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','FaxAccountId','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','isValid','Trunk\x20Reachable','execute','%s/%s.tif','dir','XMF-PATH','Action','variablesAction','ext','isTrunkReachable','isNil','active','format','SIP/%s','reachable','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','lodash','uuid'];(function(_0x1e3c02,_0x5c07a2){var _0x4d26d7=function(_0x367ed9){while(--_0x367ed9){_0x1e3c02['push'](_0x1e3c02['shift']());}};_0x4d26d7(++_0x5c07a2);}(_0xb235,0x1c1));var _0x5b23=function(_0x150bbe,_0x412085){_0x150bbe=_0x150bbe-0x0;var _0x3418d5=_0xb235[_0x150bbe];return _0x3418d5;};'use strict';var util=require(_0x5b23('0x0'));var _=require(_0x5b23('0x1'));var BPromise=require('bluebird');var uuid=require(_0x5b23('0x2'));var moment=require(_0x5b23('0x3'));var path=require(_0x5b23('0x4'));var tiff2pdf=require(_0x5b23('0x5'));var gs=require(_0x5b23('0x6'));var logger=require(_0x5b23('0x7'))(_0x5b23('0x8'));var ami=require('../ami');var rpcDb=require(_0x5b23('0x9'));var Channel=require(_0x5b23('0xa'));var ut=require(_0x5b23('0xb'));var Action=require('./action');var faxAccount=require('../rpc/faxAccount');var attachment=require(_0x5b23('0xc'));var faxMessage=require(_0x5b23('0xd'));function Fax(_0x1a637c){this[_0x5b23('0xe')]={};this[_0x5b23('0xf')]=_0x1a637c[_0x5b23('0xf')];this['trunks']=_0x1a637c[_0x5b23('0x10')];this[_0x5b23('0x11')]={};ami['on']('newchannel',this['syncNewchannel'][_0x5b23('0x12')](this));ami['on'](_0x5b23('0x13'),this[_0x5b23('0x14')][_0x5b23('0x12')](this));ami['on'](_0x5b23('0x15'),this[_0x5b23('0x16')][_0x5b23('0x12')](this));ami['on'](_0x5b23('0x17'),this[_0x5b23('0x18')][_0x5b23('0x12')](this));ami['on'](_0x5b23('0x19'),this[_0x5b23('0x1a')][_0x5b23('0x12')](this));ami['on'](_0x5b23('0x1b'),this[_0x5b23('0x1c')][_0x5b23('0x12')](this));ami['on'](_0x5b23('0x1d'),this[_0x5b23('0x1e')]['bind'](this));ami['on'](_0x5b23('0x1f'),this[_0x5b23('0x20')]['bind'](this));}Fax['prototype'][_0x5b23('0x21')]=function(_0x4de0d2){if(_0x4de0d2[_0x5b23('0x22')]===_0x5b23('0x23')){for(var _0xf20d15 in this[_0x5b23('0xf')]){if(this[_0x5b23('0xf')]['hasOwnProperty'](_0xf20d15)){if(_0x4de0d2['exten']===this[_0x5b23('0xf')][_0xf20d15][_0x5b23('0x24')]){this[_0x5b23('0xe')][_0x4de0d2[_0x5b23('0x25')]]={};this['channels'][_0x4de0d2[_0x5b23('0x25')]]['channel']=_0x4de0d2[_0x5b23('0x26')];this[_0x5b23('0xe')][_0x4de0d2[_0x5b23('0x25')]]['id']=this[_0x5b23('0xf')][_0xf20d15]['id'];this['channels'][_0x4de0d2['uniqueid']][_0x5b23('0x27')]=this[_0x5b23('0xf')][_0xf20d15][_0x5b23('0x27')];logger[_0x5b23('0x28')](_0x4de0d2[_0x5b23('0x25')],_0x5b23('0x29'));}}}}if(this[_0x5b23('0x11')][_0x4de0d2[_0x5b23('0x25')]]){this[_0x5b23('0xe')][_0x4de0d2[_0x5b23('0x25')]]={};this[_0x5b23('0xe')][_0x4de0d2[_0x5b23('0x25')]][_0x5b23('0x26')]=_0x4de0d2['channel'];logger['info'](_0x4de0d2[_0x5b23('0x25')],'\x20syncNewchannel\x20');}};Fax['prototype'][_0x5b23('0x14')]=function(_0x1c1e53){if(this[_0x5b23('0xe')][_0x1c1e53[_0x5b23('0x25')]]){for(var _0x3b2503 in _0x1c1e53[_0x5b23('0x2a')]){if(_0x1c1e53['variable']['hasOwnProperty'](_0x3b2503)){this[_0x5b23('0xe')][_0x1c1e53[_0x5b23('0x25')]][_0x3b2503]=_0x1c1e53[_0x5b23('0x2b')];}}}};Fax[_0x5b23('0x2c')][_0x5b23('0x16')]=function(_0x5dd9dd){if(this[_0x5b23('0xe')][_0x5dd9dd[_0x5b23('0x25')]]){this['channels'][_0x5dd9dd['uniqueid']][_0x5b23('0x2d')]=_0x5dd9dd[_0x5b23('0x2d')];this['channels'][_0x5dd9dd['uniqueid']]['channelstatedesc']=_0x5dd9dd[_0x5b23('0x2e')];}};Fax[_0x5b23('0x2c')][_0x5b23('0x18')]=function(_0x171fef){if(this[_0x5b23('0xe')][_0x171fef['uniqueid']]){for(var _0x2ad7cc in _0x171fef['variable']){if(_0x171fef[_0x5b23('0x2a')][_0x5b23('0x2f')](_0x2ad7cc)){this['channels'][_0x171fef['uniqueid']][_0x2ad7cc]=_0x171fef[_0x5b23('0x2b')];}}}};Fax['prototype'][_0x5b23('0x1a')]=function(_0x7bb24e){if(this[_0x5b23('0xe')][_0x7bb24e[_0x5b23('0x25')]]){this[_0x5b23('0xe')][_0x7bb24e['uniqueid']][_0x5b23('0x30')]=_0x7bb24e[_0x5b23('0x30')];this[_0x5b23('0xe')][_0x7bb24e[_0x5b23('0x25')]][_0x5b23('0x31')]=_0x7bb24e[_0x5b23('0x31')];this['channels'][_0x7bb24e[_0x5b23('0x25')]][_0x5b23('0x24')]=_0x7bb24e[_0x5b23('0x24')];this[_0x5b23('0xe')][_0x7bb24e[_0x5b23('0x25')]][_0x5b23('0x32')]=_0x7bb24e[_0x5b23('0x32')];logger[_0x5b23('0x28')](_0x7bb24e[_0x5b23('0x25')],'\x20syncFaxStatus\x20');}};Fax[_0x5b23('0x2c')][_0x5b23('0x1c')]=function(_0x4424e6){var _0x4374fc=this;if(this['channels'][_0x4424e6[_0x5b23('0x25')]]){var _0x274ce2=this['channels'][_0x4424e6[_0x5b23('0x25')]]['id'];this[_0x5b23('0xe')][_0x4424e6[_0x5b23('0x25')]][_0x5b23('0x33')]=_0x4424e6[_0x5b23('0x33')];this['channels'][_0x4424e6[_0x5b23('0x25')]]['pagestransferred']=_0x4424e6[_0x5b23('0x34')];this[_0x5b23('0xe')][_0x4424e6[_0x5b23('0x25')]][_0x5b23('0x24')]=_0x4424e6[_0x5b23('0x24')];this[_0x5b23('0xe')][_0x4424e6[_0x5b23('0x25')]][_0x5b23('0x35')]=_0x4424e6[_0x5b23('0x35')];this['channels'][_0x4424e6[_0x5b23('0x25')]][_0x5b23('0x36')]=_0x4424e6[_0x5b23('0x36')];this[_0x5b23('0xe')][_0x4424e6[_0x5b23('0x25')]][_0x5b23('0x32')]=_0x4424e6[_0x5b23('0x32')];this[_0x5b23('0xe')][_0x4424e6[_0x5b23('0x25')]]['calleridnum']=_0x4424e6[_0x5b23('0x37')];if(this[_0x5b23('0xe')][_0x4424e6['uniqueid']]['pagestransferred']>0x0){tiff2pdf(_0x4424e6['filename'],'/var/opt/motion2/server/files/attachments/',function(_0x2a7c26){logger[_0x5b23('0x28')](_0x4424e6['uniqueid'],_0x5b23('0x38'),_0x2a7c26[_0x5b23('0x39')]);attachment['create']({'name':path[_0x5b23('0x3a')](_0x4424e6[_0x5b23('0x32')])['name'],'basename':path[_0x5b23('0x3a')](_0x4424e6[_0x5b23('0x32')])['name']+_0x5b23('0x3b'),'type':'application/pdf'})[_0x5b23('0x3c')](function(_0x285504){faxAccount[_0x5b23('0x3d')](_0x274ce2,{'from':_0x4424e6[_0x5b23('0x37')],'mapKey':'fax','body':path[_0x5b23('0x3a')](_0x4424e6[_0x5b23('0x32')])[_0x5b23('0x27')]+'.pdf','AttachmentId':_0x285504['id']})[_0x5b23('0x3e')](function(_0x4733e8){logger['error'](_0x4424e6[_0x5b23('0x25')],_0x5b23('0x3f'),JSON['stringify'](_0x4733e8));});})[_0x5b23('0x3e')](function(_0x258472){logger[_0x5b23('0x40')](_0x4424e6[_0x5b23('0x25')],_0x5b23('0x41'),JSON[_0x5b23('0x42')](_0x258472));});});}logger['info'](_0x4424e6[_0x5b23('0x25')],_0x5b23('0x41'));}};Fax[_0x5b23('0x2c')][_0x5b23('0x20')]=function(_0x25d65c){if(this['actions'][_0x25d65c['uniqueid']]){_['merge'](this[_0x5b23('0xe')][_0x25d65c['uniqueid']],_[_0x5b23('0x43')](_0x25d65c,['response',_0x5b23('0x44')]));}};function updateStatus(_0x485228){if(_0x485228['AttachmentId']){faxMessage[_0x5b23('0x45')](_0x485228[_0x5b23('0x46')],{'failMessage':'SENDING\x20FAILED\x20'})[_0x5b23('0x3c')](function(_0x1dce35){ut[_0x5b23('0x47')](_0x5b23('0x48'),_0x1dce35);})[_0x5b23('0x3e')](function(_0x6b52a2){ut['logger'](_0x5b23('0x49'),_0x6b52a2);});}else{ut[_0x5b23('0x47')](_0x5b23('0x4a'));}}Fax[_0x5b23('0x2c')][_0x5b23('0x4b')]=function(_0x389daf,_0x4277e2,_0xc017a8){var _0x1b1cf3=this;var _0x32e66f={};if(_0x4277e2){_0x32e66f={'read':_0x4277e2};}else{_0x32e66f={'failMessage':_0xc017a8};}if(this[_0x5b23('0x11')][_0x389daf][_0x5b23('0x46')]){faxMessage[_0x5b23('0x45')](this[_0x5b23('0x11')][_0x389daf][_0x5b23('0x46')],_0x32e66f)[_0x5b23('0x3c')](function(_0x4d4623){ut['logger'](_0x5b23('0x4c'),_0x4d4623);})[_0x5b23('0x3e')](function(_0x2046ef){ut[_0x5b23('0x47')](_0x5b23('0x4d'),_0x2046ef);})['finally'](function(){delete _0x1b1cf3[_0x5b23('0xe')][_0x389daf];delete _0x1b1cf3[_0x5b23('0x11')][_0x389daf];});}else{ut['logger'](_0x5b23('0x4e'));delete this[_0x5b23('0xe')][_0x389daf];delete this[_0x5b23('0x11')][_0x389daf];}};Fax[_0x5b23('0x2c')][_0x5b23('0x1e')]=function(_0x28109d){var _0x35c1b2=this;if(this['channels'][_0x28109d['uniqueid']]){if(this[_0x5b23('0x11')][_0x28109d[_0x5b23('0x25')]]){this['channels'][_0x28109d[_0x5b23('0x25')]]['id']=this[_0x5b23('0x11')][_0x28109d['uniqueid']]['id'];this['channels'][_0x28109d[_0x5b23('0x25')]]['name']=this[_0x5b23('0x11')][_0x28109d['uniqueid']][_0x5b23('0x27')];}logger['info'](_0x28109d[_0x5b23('0x25')],this[_0x5b23('0x11')][_0x28109d['uniqueid']]?'\x20hangup\x20sendFile\x20':_0x5b23('0x4f'),JSON[_0x5b23('0x42')](this['channels'][_0x28109d[_0x5b23('0x25')]]));if(this['actions'][_0x28109d[_0x5b23('0x25')]]){if(this['channels'][_0x28109d[_0x5b23('0x25')]][_0x5b23('0x50')]>0x0&&this[_0x5b23('0xe')][_0x28109d[_0x5b23('0x25')]][_0x5b23('0x19')]==='SUCCESS'){this[_0x5b23('0x4b')](_0x28109d['uniqueid'],!![]);}else{this['updateStatus'](_0x28109d['uniqueid'],![],this[_0x5b23('0xe')][_0x28109d[_0x5b23('0x25')]][_0x5b23('0x51')]?_0x5b23('0x52')+this[_0x5b23('0xe')][_0x28109d['uniqueid']]['faxstatusstring']:_0x5b23('0x53'));}}}};Fax['prototype'][_0x5b23('0x54')]=function(_0xbbed43){var _0x52cc32=this;return new BPromise(function(_0x5e555c,_0x2a01fe){_0x52cc32['execOriginate'](_0xbbed43,_0x52cc32['faxAccounts'][_0xbbed43[_0x5b23('0x55')]])['then'](function(_0x50c662){ut['logger']('[Fax][execOriginate][success]',_0x50c662);_0x5e555c(ut[_0x5b23('0x39')]('Fax\x20received'));})['catch'](function(_0x318137){ut['logger']('[Fax][execOriginate][failure]',_0x318137);updateStatus(_0xbbed43);_0x2a01fe(ut['message'](_0x5b23('0x56')));});});};Fax[_0x5b23('0x2c')][_0x5b23('0x57')]=function(_0x3f5fa3){var _0x2a611b=this;return new BPromise(function(_0x5f0ef6,_0x20b74f){var _0x460854=_0x2a611b[_0x5b23('0x58')](_0x2a611b[_0x5b23('0xf')][_0x3f5fa3[_0x5b23('0x55')]][_0x5b23('0x59')],_0x3f5fa3);if(_0x460854[_0x5b23('0x5a')]){_0x5f0ef6(ut[_0x5b23('0x39')](_0x5b23('0x5b')));}else{_0x20b74f(ut[_0x5b23('0x39')](_0x460854[_0x5b23('0x39')]));}});};function originate(_0x1595b5,_0x46ee13,_0x22fa8c){return new BPromise(function(_0x35b345,_0x4a828b){if(_0x22fa8c){var _0x175f6a=util['format']('gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit',path[_0x5b23('0x3a')](_0x1595b5[_0x5b23('0x4')])[_0x5b23('0x27')],_0x1595b5[_0x5b23('0x4')]);gs[_0x5b23('0x5c')](_0x175f6a)[_0x5b23('0x3c')](function(){_0x1595b5[_0x5b23('0x4')]=util['format'](_0x5b23('0x5d'),path[_0x5b23('0x3a')](_0x1595b5[_0x5b23('0x4')])[_0x5b23('0x5e')],path['parse'](_0x1595b5[_0x5b23('0x4')])[_0x5b23('0x27')]);_0x46ee13[_0x5b23('0x5f')]=_0x1595b5[_0x5b23('0x4')];ut[_0x5b23('0x47')]('Convert\x20pdf\x20to\x20tif','');ami['Action'](ut['variablesAction'](_0x1595b5,_0x46ee13))[_0x5b23('0x3c')](function(_0x1a3270){_0x35b345(_0x1a3270);})[_0x5b23('0x3e')](function(_0x7b79a3){_0x4a828b(_0x7b79a3);});})[_0x5b23('0x3e')](function(_0x28fac7){_0x4a828b(_0x28fac7);});}else{ami[_0x5b23('0x60')](ut[_0x5b23('0x61')](_0x1595b5,_0x46ee13))['then'](function(_0x1c630c){_0x35b345(_0x1c630c);})['catch'](function(_0x449c46){_0x4a828b(_0x449c46);});}});}Fax[_0x5b23('0x2c')]['execOriginate']=function(_0x5d15f3,_0x59097b){var _0x1a110d=this;return new BPromise(function(_0x5eefd1,_0xc4666c){var _0x42a4a0=uuid['v4']();var _0x54d131=ut['addVariables'](_0x5d15f3,_0x59097b);_0x1a110d[_0x5b23('0x11')][_0x42a4a0]=new Action(_0x42a4a0,_0x59097b,_0x5d15f3);var _0x1eae7f=_0x1a110d[_0x5b23('0x11')][_0x42a4a0];if(path['parse'](_0x5d15f3[_0x5b23('0x4')])[_0x5b23('0x62')]===_0x5b23('0x3b')){originate(_0x1eae7f,_0x54d131,!![])['then'](function(_0x42d62e){_0x5eefd1(_0x42d62e);})[_0x5b23('0x3e')](function(_0x59d9b3){_0xc4666c(_0x59d9b3);});}else{originate(_0x1eae7f,_0x54d131,![])[_0x5b23('0x3c')](function(_0xd5f98d){_0x5eefd1(_0xd5f98d);})[_0x5b23('0x3e')](function(_0x32e335){_0xc4666c(_0x32e335);});}});};Fax[_0x5b23('0x2c')][_0x5b23('0x63')]=function(_0x4043d0){return!_['isNil'](_0x4043d0)&&!_['isNil'](_0x4043d0[_0x5b23('0x27')])&&!_[_0x5b23('0x64')](_0x4043d0['active'])&&_0x4043d0[_0x5b23('0x65')]&&!_[_0x5b23('0x64')](this[_0x5b23('0x10')][util[_0x5b23('0x66')](_0x5b23('0x67'),_0x4043d0['name'])])&&!_[_0x5b23('0x64')](this[_0x5b23('0x10')][util[_0x5b23('0x66')](_0x5b23('0x67'),_0x4043d0[_0x5b23('0x27')])][_0x5b23('0x31')])&&(this['trunks'][util['format'](_0x5b23('0x67'),_0x4043d0[_0x5b23('0x27')])][_0x5b23('0x31')]===_0x5b23('0x68')||this[_0x5b23('0x10')][util[_0x5b23('0x66')]('SIP/%s',_0x4043d0[_0x5b23('0x27')])][_0x5b23('0x31')]==='unmonitored');};Fax['prototype']['checkTrunk']=function(_0x32b9ff,_0x2e19a0){if(!this[_0x5b23('0x63')](_0x32b9ff)){ut['logger'](_0x5b23('0x69'),_['isNil'](_0x32b9ff)?'':_0x32b9ff[_0x5b23('0x27')]+_0x5b23('0x6a'));return{'isValid':![],'message':_0x5b23('0x6b')};}if(_[_0x5b23('0x64')](_0x2e19a0['fax'])){ut[_0x5b23('0x47')](_0x5b23('0x6c'),JSON[_0x5b23('0x42')](_0x2e19a0));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0x5b23('0x64')](_0x2e19a0['path'])){ut['logger'](_0x5b23('0x6d'),JSON['stringify'](_0x2e19a0));return{'isValid':![],'message':_0x5b23('0x6e')};}return{'isValid':!![],'message':_0x5b23('0x6f')};};module[_0x5b23('0x70')]=Fax; \ No newline at end of file +var _0x3477=['channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','syncVarSet','syncNewState','syncNewExten','faxstatus','syncFaxStatus','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','create','parse','then','notify','.pdf','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','update','AttachmentId','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','message','[Fax][execOriginate][failure]','checkAfterSend','Trunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','variablesAction','Action','addVariables','ext','isNil','active','SIP/%s','checkTrunk','isTrunkReachable','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','Empty\x20path','exports','bluebird','uuid','moment','path','tiff2pdf','./util/gs','fax','../ami','./rpcDb','./channel','./util/util','./action','../rpc/attachment','../rpc/faxMessage'];(function(_0x2a8491,_0x410e6f){var _0x26a8ce=function(_0xe569){while(--_0xe569){_0x2a8491['push'](_0x2a8491['shift']());}};_0x26a8ce(++_0x410e6f);}(_0x3477,0x154));var _0x7347=function(_0x8752a,_0x4dfb98){_0x8752a=_0x8752a-0x0;var _0x251586=_0x3477[_0x8752a];return _0x251586;};'use strict';var util=require('util');var _=require('lodash');var BPromise=require(_0x7347('0x0'));var uuid=require(_0x7347('0x1'));var moment=require(_0x7347('0x2'));var path=require(_0x7347('0x3'));var tiff2pdf=require(_0x7347('0x4'));var gs=require(_0x7347('0x5'));var logger=require('../../../config/logger')(_0x7347('0x6'));var ami=require(_0x7347('0x7'));var rpcDb=require(_0x7347('0x8'));var Channel=require(_0x7347('0x9'));var ut=require(_0x7347('0xa'));var Action=require(_0x7347('0xb'));var faxAccount=require('../rpc/faxAccount');var attachment=require(_0x7347('0xc'));var faxMessage=require(_0x7347('0xd'));function Fax(_0x3f831d){this[_0x7347('0xe')]={};this[_0x7347('0xf')]=_0x3f831d[_0x7347('0xf')];this['trunks']=_0x3f831d[_0x7347('0x10')];this[_0x7347('0x11')]={};ami['on'](_0x7347('0x12'),this[_0x7347('0x13')][_0x7347('0x14')](this));ami['on']('varset',this[_0x7347('0x15')][_0x7347('0x14')](this));ami['on']('newstate',this[_0x7347('0x16')][_0x7347('0x14')](this));ami['on']('newexten',this[_0x7347('0x17')][_0x7347('0x14')](this));ami['on'](_0x7347('0x18'),this[_0x7347('0x19')]['bind'](this));ami['on']('receivefax',this[_0x7347('0x1a')][_0x7347('0x14')](this));ami['on'](_0x7347('0x1b'),this[_0x7347('0x1c')][_0x7347('0x14')](this));ami['on'](_0x7347('0x1d'),this[_0x7347('0x1e')]['bind'](this));}Fax[_0x7347('0x1f')][_0x7347('0x13')]=function(_0x2c593e){if(_0x2c593e[_0x7347('0x20')]===_0x7347('0x21')){for(var _0x249634 in this['faxAccounts']){if(this[_0x7347('0xf')][_0x7347('0x22')](_0x249634)){if(_0x2c593e['exten']===this['faxAccounts'][_0x249634][_0x7347('0x23')]){this[_0x7347('0xe')][_0x2c593e[_0x7347('0x24')]]={};this[_0x7347('0xe')][_0x2c593e[_0x7347('0x24')]][_0x7347('0x25')]=_0x2c593e[_0x7347('0x25')];this[_0x7347('0xe')][_0x2c593e['uniqueid']]['id']=this[_0x7347('0xf')][_0x249634]['id'];this[_0x7347('0xe')][_0x2c593e[_0x7347('0x24')]][_0x7347('0x26')]=this['faxAccounts'][_0x249634][_0x7347('0x26')];logger[_0x7347('0x27')](_0x2c593e['uniqueid'],'\x20syncNewchannel\x20');}}}}if(this[_0x7347('0x11')][_0x2c593e[_0x7347('0x24')]]){this[_0x7347('0xe')][_0x2c593e[_0x7347('0x24')]]={};this['channels'][_0x2c593e[_0x7347('0x24')]]['channel']=_0x2c593e[_0x7347('0x25')];logger['info'](_0x2c593e['uniqueid'],_0x7347('0x28'));}};Fax[_0x7347('0x1f')][_0x7347('0x15')]=function(_0x1dce74){if(this[_0x7347('0xe')][_0x1dce74[_0x7347('0x24')]]){for(var _0x5a3971 in _0x1dce74[_0x7347('0x29')]){if(_0x1dce74[_0x7347('0x29')]['hasOwnProperty'](_0x5a3971)){this[_0x7347('0xe')][_0x1dce74[_0x7347('0x24')]][_0x5a3971]=_0x1dce74[_0x7347('0x2a')];}}}};Fax[_0x7347('0x1f')][_0x7347('0x16')]=function(_0x4c0af1){if(this[_0x7347('0xe')][_0x4c0af1[_0x7347('0x24')]]){this[_0x7347('0xe')][_0x4c0af1['uniqueid']][_0x7347('0x2b')]=_0x4c0af1[_0x7347('0x2b')];this[_0x7347('0xe')][_0x4c0af1['uniqueid']][_0x7347('0x2c')]=_0x4c0af1[_0x7347('0x2c')];}};Fax[_0x7347('0x1f')][_0x7347('0x17')]=function(_0x3956cb){if(this[_0x7347('0xe')][_0x3956cb[_0x7347('0x24')]]){for(var _0x184882 in _0x3956cb[_0x7347('0x29')]){if(_0x3956cb[_0x7347('0x29')][_0x7347('0x22')](_0x184882)){this['channels'][_0x3956cb['uniqueid']][_0x184882]=_0x3956cb[_0x7347('0x2a')];}}}};Fax['prototype'][_0x7347('0x19')]=function(_0x1de5c8){if(this[_0x7347('0xe')][_0x1de5c8[_0x7347('0x24')]]){this['channels'][_0x1de5c8[_0x7347('0x24')]]['operation']=_0x1de5c8[_0x7347('0x2d')];this['channels'][_0x1de5c8[_0x7347('0x24')]]['status']=_0x1de5c8[_0x7347('0x2e')];this['channels'][_0x1de5c8['uniqueid']][_0x7347('0x23')]=_0x1de5c8[_0x7347('0x23')];this['channels'][_0x1de5c8[_0x7347('0x24')]]['filename']=_0x1de5c8[_0x7347('0x2f')];logger[_0x7347('0x27')](_0x1de5c8[_0x7347('0x24')],_0x7347('0x30'));}};Fax[_0x7347('0x1f')][_0x7347('0x1a')]=function(_0x21f242){var _0x170c57=this;if(this[_0x7347('0xe')][_0x21f242[_0x7347('0x24')]]){var _0x3aaa00=this[_0x7347('0xe')][_0x21f242[_0x7347('0x24')]]['id'];this['channels'][_0x21f242[_0x7347('0x24')]][_0x7347('0x31')]=_0x21f242['remotestationid'];this[_0x7347('0xe')][_0x21f242[_0x7347('0x24')]][_0x7347('0x32')]=_0x21f242[_0x7347('0x32')];this[_0x7347('0xe')][_0x21f242[_0x7347('0x24')]][_0x7347('0x23')]=_0x21f242[_0x7347('0x23')];this[_0x7347('0xe')][_0x21f242[_0x7347('0x24')]][_0x7347('0x33')]=_0x21f242[_0x7347('0x33')];this['channels'][_0x21f242['uniqueid']][_0x7347('0x34')]=_0x21f242['transferrate'];this[_0x7347('0xe')][_0x21f242['uniqueid']]['filename']=_0x21f242[_0x7347('0x2f')];this[_0x7347('0xe')][_0x21f242[_0x7347('0x24')]]['calleridnum']=_0x21f242[_0x7347('0x35')];if(this[_0x7347('0xe')][_0x21f242['uniqueid']]['pagestransferred']>0x0){tiff2pdf(_0x21f242[_0x7347('0x2f')],_0x7347('0x36'),function(_0xe7851a){logger['info'](_0x21f242['uniqueid'],_0x7347('0x37'),_0xe7851a['message']);attachment[_0x7347('0x38')]({'name':path[_0x7347('0x39')](_0x21f242[_0x7347('0x2f')])[_0x7347('0x26')],'basename':path[_0x7347('0x39')](_0x21f242['filename'])[_0x7347('0x26')]+'.pdf','type':'application/pdf'})[_0x7347('0x3a')](function(_0x4a875c){faxAccount[_0x7347('0x3b')](_0x3aaa00,{'from':_0x21f242[_0x7347('0x35')],'mapKey':_0x7347('0x6'),'body':path[_0x7347('0x39')](_0x21f242['filename'])[_0x7347('0x26')]+_0x7347('0x3c'),'AttachmentId':_0x4a875c['id']})[_0x7347('0x3d')](function(_0x1ed05f){logger[_0x7347('0x3e')](_0x21f242[_0x7347('0x24')],_0x7347('0x3f'),JSON[_0x7347('0x40')](_0x1ed05f));});})['catch'](function(_0x4b5aef){logger['error'](_0x21f242[_0x7347('0x24')],_0x7347('0x41'),JSON['stringify'](_0x4b5aef));});});}logger['info'](_0x21f242['uniqueid'],_0x7347('0x41'));}};Fax[_0x7347('0x1f')][_0x7347('0x1e')]=function(_0xd33390){if(this[_0x7347('0x11')][_0xd33390[_0x7347('0x24')]]){_[_0x7347('0x42')](this[_0x7347('0xe')][_0xd33390[_0x7347('0x24')]],_[_0x7347('0x43')](_0xd33390,['response','reason']));}};function updateStatus(_0x53d506){if(_0x53d506['AttachmentId']){faxMessage[_0x7347('0x44')](_0x53d506[_0x7347('0x45')],{'failMessage':'SENDING\x20FAILED\x20'})['then'](function(_0x28e3da){ut[_0x7347('0x46')](_0x7347('0x47'),_0x28e3da);})[_0x7347('0x3d')](function(_0x42227f){ut[_0x7347('0x46')](_0x7347('0x48'),_0x42227f);});}else{ut[_0x7347('0x46')](_0x7347('0x49'));}}Fax[_0x7347('0x1f')][_0x7347('0x4a')]=function(_0x584952,_0x3ecef0,_0x5755f7){var _0x4cd207=this;var _0xa715c9={};if(_0x3ecef0){_0xa715c9={'read':_0x3ecef0};}else{_0xa715c9={'failMessage':_0x5755f7};}if(this[_0x7347('0x11')][_0x584952]['AttachmentId']){faxMessage[_0x7347('0x44')](this['actions'][_0x584952][_0x7347('0x45')],_0xa715c9)[_0x7347('0x3a')](function(_0xfc8263){ut['logger'](_0x7347('0x4b'),_0xfc8263);})[_0x7347('0x3d')](function(_0x37d0ff){ut['logger'](_0x7347('0x4c'),_0x37d0ff);})[_0x7347('0x4d')](function(){delete _0x4cd207[_0x7347('0xe')][_0x584952];delete _0x4cd207[_0x7347('0x11')][_0x584952];});}else{ut[_0x7347('0x46')](_0x7347('0x4e'));delete this['channels'][_0x584952];delete this[_0x7347('0x11')][_0x584952];}};Fax[_0x7347('0x1f')]['syncHangup']=function(_0x3a5821){var _0x1550da=this;if(this[_0x7347('0xe')][_0x3a5821['uniqueid']]){if(this[_0x7347('0x11')][_0x3a5821[_0x7347('0x24')]]){this[_0x7347('0xe')][_0x3a5821[_0x7347('0x24')]]['id']=this['actions'][_0x3a5821[_0x7347('0x24')]]['id'];this[_0x7347('0xe')][_0x3a5821['uniqueid']][_0x7347('0x26')]=this['actions'][_0x3a5821[_0x7347('0x24')]][_0x7347('0x26')];}logger[_0x7347('0x27')](_0x3a5821['uniqueid'],this['actions'][_0x3a5821['uniqueid']]?_0x7347('0x4f'):_0x7347('0x50'),JSON['stringify'](this['channels'][_0x3a5821[_0x7347('0x24')]]));if(this[_0x7347('0x11')][_0x3a5821[_0x7347('0x24')]]){if(this[_0x7347('0xe')][_0x3a5821[_0x7347('0x24')]][_0x7347('0x51')]>0x0&&this[_0x7347('0xe')][_0x3a5821[_0x7347('0x24')]]['faxstatus']===_0x7347('0x52')){this[_0x7347('0x4a')](_0x3a5821[_0x7347('0x24')],!![]);}else{this['updateStatus'](_0x3a5821[_0x7347('0x24')],![],this['channels'][_0x3a5821[_0x7347('0x24')]]['faxstatusstring']?_0x7347('0x53')+this[_0x7347('0xe')][_0x3a5821[_0x7347('0x24')]]['faxstatusstring']:_0x7347('0x54'));}}}};Fax['prototype'][_0x7347('0x55')]=function(_0x1ed386){var _0x1b72ec=this;return new BPromise(function(_0x2d708a,_0x17730b){_0x1b72ec[_0x7347('0x56')](_0x1ed386,_0x1b72ec[_0x7347('0xf')][_0x1ed386[_0x7347('0x57')]])[_0x7347('0x3a')](function(_0x2a0aaa){ut[_0x7347('0x46')](_0x7347('0x58'),_0x2a0aaa);_0x2d708a(ut[_0x7347('0x59')]('Fax\x20received'));})[_0x7347('0x3d')](function(_0x42d441){ut[_0x7347('0x46')](_0x7347('0x5a'),_0x42d441);updateStatus(_0x1ed386);_0x17730b(ut[_0x7347('0x59')]('Fax\x20failed'));});});};Fax[_0x7347('0x1f')][_0x7347('0x5b')]=function(_0x4331e6){var _0x24e7d3=this;return new BPromise(function(_0x28bc6e,_0x1ea4f5){var _0x1180a2=_0x24e7d3['checkTrunk'](_0x24e7d3[_0x7347('0xf')][_0x4331e6[_0x7347('0x57')]][_0x7347('0x5c')],_0x4331e6);if(_0x1180a2[_0x7347('0x5d')]){_0x28bc6e(ut[_0x7347('0x59')](_0x7347('0x5e')));}else{_0x1ea4f5(ut[_0x7347('0x59')](_0x1180a2['message']));}});};function originate(_0x17afad,_0x53a1e0,_0x23afc0){return new BPromise(function(_0x379921,_0x3bf929){if(_0x23afc0){var _0x55334f=util[_0x7347('0x5f')](_0x7347('0x60'),path[_0x7347('0x39')](_0x17afad[_0x7347('0x3')])[_0x7347('0x26')],_0x17afad[_0x7347('0x3')]);gs[_0x7347('0x61')](_0x55334f)[_0x7347('0x3a')](function(){_0x17afad[_0x7347('0x3')]=util[_0x7347('0x5f')](_0x7347('0x62'),path[_0x7347('0x39')](_0x17afad[_0x7347('0x3')])[_0x7347('0x63')],path[_0x7347('0x39')](_0x17afad[_0x7347('0x3')])[_0x7347('0x26')]);_0x53a1e0[_0x7347('0x64')]=_0x17afad[_0x7347('0x3')];ut[_0x7347('0x46')](_0x7347('0x65'),'');ami['Action'](ut[_0x7347('0x66')](_0x17afad,_0x53a1e0))[_0x7347('0x3a')](function(_0x5767f0){_0x379921(_0x5767f0);})[_0x7347('0x3d')](function(_0x5c3849){_0x3bf929(_0x5c3849);});})[_0x7347('0x3d')](function(_0x65912){_0x3bf929(_0x65912);});}else{ami[_0x7347('0x67')](ut[_0x7347('0x66')](_0x17afad,_0x53a1e0))[_0x7347('0x3a')](function(_0x40aa49){_0x379921(_0x40aa49);})[_0x7347('0x3d')](function(_0x2944a1){_0x3bf929(_0x2944a1);});}});}Fax[_0x7347('0x1f')][_0x7347('0x56')]=function(_0x6ac986,_0x5c6782){var _0x2c35fb=this;return new BPromise(function(_0x3e8ddf,_0xbe6cc0){var _0x18abf7=uuid['v4']();var _0x53744e=ut[_0x7347('0x68')](_0x6ac986,_0x5c6782);_0x2c35fb[_0x7347('0x11')][_0x18abf7]=new Action(_0x18abf7,_0x5c6782,_0x6ac986);var _0x11387a=_0x2c35fb[_0x7347('0x11')][_0x18abf7];if(path[_0x7347('0x39')](_0x6ac986[_0x7347('0x3')])[_0x7347('0x69')]===_0x7347('0x3c')){originate(_0x11387a,_0x53744e,!![])[_0x7347('0x3a')](function(_0x273fe1){_0x3e8ddf(_0x273fe1);})[_0x7347('0x3d')](function(_0x1dc6aa){_0xbe6cc0(_0x1dc6aa);});}else{originate(_0x11387a,_0x53744e,![])[_0x7347('0x3a')](function(_0x1e581e){_0x3e8ddf(_0x1e581e);})[_0x7347('0x3d')](function(_0x12903d){_0xbe6cc0(_0x12903d);});}});};Fax[_0x7347('0x1f')]['isTrunkReachable']=function(_0x1a8ef6){return!_[_0x7347('0x6a')](_0x1a8ef6)&&!_[_0x7347('0x6a')](_0x1a8ef6[_0x7347('0x26')])&&!_['isNil'](_0x1a8ef6['active'])&&_0x1a8ef6[_0x7347('0x6b')]&&!_[_0x7347('0x6a')](this['trunks'][util['format'](_0x7347('0x6c'),_0x1a8ef6[_0x7347('0x26')])])&&!_[_0x7347('0x6a')](this[_0x7347('0x10')][util[_0x7347('0x5f')](_0x7347('0x6c'),_0x1a8ef6[_0x7347('0x26')])][_0x7347('0x2e')])&&(this[_0x7347('0x10')][util[_0x7347('0x5f')](_0x7347('0x6c'),_0x1a8ef6[_0x7347('0x26')])][_0x7347('0x2e')]==='reachable'||this['trunks'][util[_0x7347('0x5f')](_0x7347('0x6c'),_0x1a8ef6[_0x7347('0x26')])]['status']==='unmonitored');};Fax[_0x7347('0x1f')][_0x7347('0x6d')]=function(_0x2121cc,_0x1d757e){if(!this[_0x7347('0x6e')](_0x2121cc)){ut[_0x7347('0x46')](_0x7347('0x6f'),_['isNil'](_0x2121cc)?'':_0x2121cc['name']+_0x7347('0x70'));return{'isValid':![],'message':_0x7347('0x71')};}if(_[_0x7347('0x6a')](_0x1d757e[_0x7347('0x6')])){ut[_0x7347('0x46')](_0x7347('0x72'),JSON[_0x7347('0x40')](_0x1d757e));return{'isValid':![],'message':_0x7347('0x73')};}if(_[_0x7347('0x6a')](_0x1d757e['path'])){ut[_0x7347('0x46')]('[Fax][checkTrunk][Empty\x20path]',JSON[_0x7347('0x40')](_0x1d757e));return{'isValid':![],'message':_0x7347('0x74')};}return{'isValid':!![],'message':'Is\x20Valid'};};module[_0x7347('0x75')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index b1fda1a..18f87a4 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 _0xf5fd=['preview','lodash','../rpc/faxAccount','error','notify','resolve','then','catch','[Notify]\x20','util','bluebird','../../../config/logger'];(function(_0x17e64f,_0xd0eb81){var _0x3c9970=function(_0x43cd71){while(--_0x43cd71){_0x17e64f['push'](_0x17e64f['shift']());}};_0x3c9970(++_0xd0eb81);}(_0xf5fd,0x8d));var _0xdf5f=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0xf5fd[_0x49b207];return _0x2dc8fa;};'use strict';var util=require(_0xdf5f('0x0'));var BPromise=require(_0xdf5f('0x1'));var logger=require(_0xdf5f('0x2'))(_0xdf5f('0x3'));var _=require(_0xdf5f('0x4'));var faxAccount=require(_0xdf5f('0x5'));function loggerCatch(_0x3e1b48){return function(_0x58fc16){logger[_0xdf5f('0x6')](_0x3e1b48,util['inspect'](_0x58fc16,{'showHidden':![],'depth':null}));};}exports[_0xdf5f('0x7')]=function(_0xfc78c3,_0xfb65c3){return BPromise[_0xdf5f('0x8')]()[_0xdf5f('0x9')](faxAccount[_0xdf5f('0x7')](_0xfc78c3,_0xfb65c3))[_0xdf5f('0xa')](loggerCatch(_0xdf5f('0xb')));}; \ No newline at end of file +var _0x482e=['util','../../../config/logger','preview','lodash','../rpc/faxAccount','inspect','resolve','then','notify','catch','[Notify]\x20'];(function(_0x556d4a,_0x36be9e){var _0x5f25d3=function(_0x1897fd){while(--_0x1897fd){_0x556d4a['push'](_0x556d4a['shift']());}};_0x5f25d3(++_0x36be9e);}(_0x482e,0xc6));var _0xe482=function(_0x8a969d,_0x339d9f){_0x8a969d=_0x8a969d-0x0;var _0x1d8dc7=_0x482e[_0x8a969d];return _0x1d8dc7;};'use strict';var util=require(_0xe482('0x0'));var BPromise=require('bluebird');var logger=require(_0xe482('0x1'))(_0xe482('0x2'));var _=require(_0xe482('0x3'));var faxAccount=require(_0xe482('0x4'));function loggerCatch(_0x2ff7d9){return function(_0x3cc762){logger['error'](_0x2ff7d9,util[_0xe482('0x5')](_0x3cc762,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x2b183a,_0x7cf127){return BPromise[_0xe482('0x6')]()[_0xe482('0x7')](faxAccount[_0xe482('0x8')](_0x2b183a,_0x7cf127))[_0xe482('0x9')](loggerCatch(_0xe482('0xa')));}; \ 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 3489bbf..ba5245f 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 _0xf4dd=['bluebird','child_process','exec','info','Exec\x20gs','\x20Error\x20:','inspect','util','../../../../config/logger','fax'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xf4dd,0x1d3));var _0xdf4d=function(_0x4e950d,_0x269a76){_0x4e950d=_0x4e950d-0x0;var _0x4037b8=_0xf4dd[_0x4e950d];return _0x4037b8;};'use strict';var util=require(_0xdf4d('0x0'));var logger=require(_0xdf4d('0x1'))(_0xdf4d('0x2'));var BPromise=require(_0xdf4d('0x3'));var exec=require(_0xdf4d('0x4'))[_0xdf4d('0x5')];exports['execute']=function(_0x809b7b){return new BPromise(function(_0x28ec9f,_0x2d4932){exec(_0x809b7b,function(_0x578a9b,_0x3f68f0,_0x15805f){logger[_0xdf4d('0x6')](_0xdf4d('0x7'),_0x3f68f0);if(_0x578a9b){logger['info'](_0xdf4d('0x7'),_0xdf4d('0x8'),util[_0xdf4d('0x9')](_0x578a9b,{'showHidden':![],'depth':null}),_0x3f68f0,_0x15805f);_0x2d4932(_0x578a9b);}_0x28ec9f(_0x3f68f0);});});}; \ No newline at end of file +var _0xaf91=['child_process','execute','info','Exec\x20gs','\x20Error\x20:','inspect','util','../../../../config/logger','fax','bluebird'];(function(_0x16a317,_0x43d3f7){var _0x1ef1cf=function(_0x35baff){while(--_0x35baff){_0x16a317['push'](_0x16a317['shift']());}};_0x1ef1cf(++_0x43d3f7);}(_0xaf91,0xec));var _0x1af9=function(_0x3eb630,_0x552586){_0x3eb630=_0x3eb630-0x0;var _0x1b840d=_0xaf91[_0x3eb630];return _0x1b840d;};'use strict';var util=require(_0x1af9('0x0'));var logger=require(_0x1af9('0x1'))(_0x1af9('0x2'));var BPromise=require(_0x1af9('0x3'));var exec=require(_0x1af9('0x4'))['exec'];exports[_0x1af9('0x5')]=function(_0x26bfd9){return new BPromise(function(_0xbeda57,_0x2f8d55){exec(_0x26bfd9,function(_0x14093e,_0x79e269,_0x463985){logger[_0x1af9('0x6')](_0x1af9('0x7'),_0x79e269);if(_0x14093e){logger[_0x1af9('0x6')](_0x1af9('0x7'),_0x1af9('0x8'),util[_0x1af9('0x9')](_0x14093e,{'showHidden':![],'depth':null}),_0x79e269,_0x463985);_0x2f8d55(_0x14093e);}_0xbeda57(_0x79e269);});});}; \ 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 9639a2a..379ac9f 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 _0xeda0=['\x22%s\x22','modem','gateway','faxdetect','t38timeout','localstationid','variablesAction','uniqueid','originate','channel','from-sip','format','util','lodash','moment','fax','message','inspect','addVariables','ecm','headerinfo','minrate','maxrate'];(function(_0x22be24,_0x5559cb){var _0x353e25=function(_0x4b1c51){while(--_0x4b1c51){_0x22be24['push'](_0x22be24['shift']());}};_0x353e25(++_0x5559cb);}(_0xeda0,0x1d8));var _0x0eda=function(_0x25bced,_0x54f026){_0x25bced=_0x25bced-0x0;var _0x8266a9=_0xeda0[_0x25bced];return _0x8266a9;};'use strict';var util=require(_0x0eda('0x0'));var _=require(_0x0eda('0x1'));var moment=require(_0x0eda('0x2'));var logger=require('../../../../config/logger')(_0x0eda('0x3'));exports[_0x0eda('0x4')]=function(_0x567142){return{'message':_0x567142};};exports['logger']=function(_0x176849,_0x20da9a){logger['info'](_0x176849,util[_0x0eda('0x5')](_0x20da9a,{'showHidden':![],'depth':null}));};exports[_0x0eda('0x6')]=function(_0x3698c8,_0x3756dd){var _0x227f7f={'XMF-ECM':_0x3756dd[_0x0eda('0x7')],'XMF-HEADERINFO':_0x3756dd[_0x0eda('0x8')],'XMF-MINRATE':_0x3756dd[_0x0eda('0x9')],'XMF-MAXRATE':_0x3756dd[_0x0eda('0xa')],'XMF-MODEM':util['format'](_0x0eda('0xb'),_0x3756dd[_0x0eda('0xc')]),'XMF-GATEWAY':_0x3756dd[_0x0eda('0xd')],'XMF-FAXDETECT':_0x3756dd[_0x0eda('0xe')],'XMF-T38TIMEOUT':_0x3756dd[_0x0eda('0xf')],'XMF-LOCALSTATIONID':_0x3756dd[_0x0eda('0x10')],'XMF-PATH':_0x3698c8['path']};return _0x227f7f;};exports[_0x0eda('0x11')]=function(_0x27054a,_0x3d7569){return{'actionid':_0x27054a[_0x0eda('0x12')],'action':_0x0eda('0x13'),'channel':_0x27054a[_0x0eda('0x14')],'Exten':'xcally-motion-fax','Context':_0x0eda('0x15'),'Priority':'1','callerid':util[_0x0eda('0x16')]('\x22%s\x22\x20<%s>',_0x27054a['headerinfo']?_0x27054a[_0x0eda('0x8')]:'',_0x27054a[_0x0eda('0x10')]),'variable':_0x3d7569,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x27054a[_0x0eda('0x12')]};}; \ No newline at end of file +var _0xed7f=['addVariables','ecm','headerinfo','minrate','format','\x22%s\x22','modem','gateway','faxdetect','t38timeout','localstationid','path','variablesAction','uniqueid','originate','channel','from-sip','util','moment','fax','logger','info','inspect'];(function(_0x460bb3,_0x1b8a66){var _0x15132a=function(_0x4dca05){while(--_0x4dca05){_0x460bb3['push'](_0x460bb3['shift']());}};_0x15132a(++_0x1b8a66);}(_0xed7f,0xc9));var _0xfed7=function(_0x478689,_0x257f1a){_0x478689=_0x478689-0x0;var _0x9e4bf1=_0xed7f[_0x478689];return _0x9e4bf1;};'use strict';var util=require(_0xfed7('0x0'));var _=require('lodash');var moment=require(_0xfed7('0x1'));var logger=require('../../../../config/logger')(_0xfed7('0x2'));exports['message']=function(_0x514440){return{'message':_0x514440};};exports[_0xfed7('0x3')]=function(_0x361131,_0x30f975){logger[_0xfed7('0x4')](_0x361131,util[_0xfed7('0x5')](_0x30f975,{'showHidden':![],'depth':null}));};exports[_0xfed7('0x6')]=function(_0x3cf02b,_0x1db96e){var _0x3f0b84={'XMF-ECM':_0x1db96e[_0xfed7('0x7')],'XMF-HEADERINFO':_0x1db96e[_0xfed7('0x8')],'XMF-MINRATE':_0x1db96e[_0xfed7('0x9')],'XMF-MAXRATE':_0x1db96e['maxrate'],'XMF-MODEM':util[_0xfed7('0xa')](_0xfed7('0xb'),_0x1db96e[_0xfed7('0xc')]),'XMF-GATEWAY':_0x1db96e[_0xfed7('0xd')],'XMF-FAXDETECT':_0x1db96e[_0xfed7('0xe')],'XMF-T38TIMEOUT':_0x1db96e[_0xfed7('0xf')],'XMF-LOCALSTATIONID':_0x1db96e[_0xfed7('0x10')],'XMF-PATH':_0x3cf02b[_0xfed7('0x11')]};return _0x3f0b84;};exports[_0xfed7('0x12')]=function(_0x8546f1,_0x3d0138){return{'actionid':_0x8546f1[_0xfed7('0x13')],'action':_0xfed7('0x14'),'channel':_0x8546f1[_0xfed7('0x15')],'Exten':'xcally-motion-fax','Context':_0xfed7('0x16'),'Priority':'1','callerid':util[_0xfed7('0xa')]('\x22%s\x22\x20<%s>',_0x8546f1[_0xfed7('0x8')]?_0x8546f1['headerinfo']:'',_0x8546f1[_0xfed7('0x10')]),'variable':_0x3d0138,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x8546f1[_0xfed7('0x13')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 986d1fe..3e8af09 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 _0xf72c=['getCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','initVoiceQueueHopperHistory','getCampaignHopperHistory','initVoiceCallReports','catch','error','sync','inspect','bluebird','util','moment','./server','./realtime','./report','./acw','./trigger','./dialer','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/dynamics365','../../config/logger','ami','get','hour','resolve','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','initTriggers','getTemplates','getZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','initFreshdeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','initFreshsalesAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts'];(function(_0x74859b,_0x4567d4){var _0x290b2f=function(_0x41623e){while(--_0x41623e){_0x74859b['push'](_0x74859b['shift']());}};_0x290b2f(++_0x4567d4);}(_0xf72c,0x18d));var _0xcf72=function(_0x2fb28a,_0x71d39c){_0x2fb28a=_0x2fb28a-0x0;var _0x11c857=_0xf72c[_0x2fb28a];return _0x11c857;};'use strict';var BPromise=require(_0xcf72('0x0'));var util=require(_0xcf72('0x1'));var moment=require(_0xcf72('0x2'));var server=require(_0xcf72('0x3'));var Realtime=require(_0xcf72('0x4'));var Report=require(_0xcf72('0x5'));var Acw=require(_0xcf72('0x6'));var Trigger=require(_0xcf72('0x7'));var Dialer=require(_0xcf72('0x8'));var Preview=require('./preview');var Fax=require('./fax');var user=require('./rpc/user');var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require(_0xcf72('0x9'));var voiceCallReport=require(_0xcf72('0xa'));var trunk=require('./rpc/trunk');var trigger=require('./rpc/trigger');var template=require(_0xcf72('0xb'));var cmHopperHistory=require(_0xcf72('0xc'));var campaign=require(_0xcf72('0xd'));var voiceExtension=require(_0xcf72('0xe'));var faxAccount=require(_0xcf72('0xf'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require(_0xcf72('0x10'));var sugarcrm=require(_0xcf72('0x11'));var freshdesk=require(_0xcf72('0x12'));var desk=require('./rpc/integrations/desk');var zoho=require(_0xcf72('0x13'));var vtiger=require(_0xcf72('0x14'));var freshsales=require('./rpc/integrations/freshsales');var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require(_0xcf72('0x15'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0xcf72('0x16'))(_0xcf72('0x17'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get']('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xcf72('0x18')](_0xcf72('0x19'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0xcf72('0x1a')]()[_0xcf72('0x1b')](user[_0xcf72('0x1c')]())[_0xcf72('0x1b')](realtime[_0xcf72('0x1d')]())['then'](user[_0xcf72('0x1e')]())[_0xcf72('0x1b')](realtime[_0xcf72('0x1f')]())[_0xcf72('0x1b')](trunk[_0xcf72('0x20')]())[_0xcf72('0x1b')](realtime[_0xcf72('0x21')]())[_0xcf72('0x1b')](voiceQueue[_0xcf72('0x22')]())['then'](realtime['initVoiceQueues']())[_0xcf72('0x1b')](trigger['getTriggers']())['then'](realtime[_0xcf72('0x23')]())[_0xcf72('0x1b')](template[_0xcf72('0x24')]())[_0xcf72('0x1b')](realtime['initTemplates']())[_0xcf72('0x1b')](zendesk[_0xcf72('0x25')]())[_0xcf72('0x1b')](realtime['initZendeskAccounts']())[_0xcf72('0x1b')](salesforce[_0xcf72('0x26')]())['then'](realtime[_0xcf72('0x27')]())['then'](sugarcrm[_0xcf72('0x28')]())[_0xcf72('0x1b')](realtime[_0xcf72('0x29')]())['then'](freshdesk['getFreshdeskAccounts']())[_0xcf72('0x1b')](realtime[_0xcf72('0x2a')]())[_0xcf72('0x1b')](desk['getDeskAccounts']())[_0xcf72('0x1b')](realtime['initDeskAccounts']())['then'](zoho[_0xcf72('0x2b')]())[_0xcf72('0x1b')](realtime[_0xcf72('0x2c')]())[_0xcf72('0x1b')](vtiger[_0xcf72('0x2d')]())['then'](realtime[_0xcf72('0x2e')]())[_0xcf72('0x1b')](freshsales['getFreshsalesAccounts']())['then'](realtime[_0xcf72('0x2f')]())['then'](servicenow['getServicenowAccounts']())[_0xcf72('0x1b')](realtime[_0xcf72('0x30')]())[_0xcf72('0x1b')](dynamics365[_0xcf72('0x31')]())[_0xcf72('0x1b')](realtime[_0xcf72('0x32')]())[_0xcf72('0x1b')](campaign[_0xcf72('0x33')]())[_0xcf72('0x1b')](realtime['initCampaigns']())[_0xcf72('0x1b')](voiceExtension[_0xcf72('0x34')]())['then'](realtime[_0xcf72('0x35')]())[_0xcf72('0x1b')](faxAccount[_0xcf72('0x36')]())[_0xcf72('0x1b')](realtime['initFaxAccounts']())[_0xcf72('0x1b')](function(){return realtime;});}function initParams(){return BPromise[_0xcf72('0x1a')]()[_0xcf72('0x1b')](voiceQueueReport[_0xcf72('0x37')]())[_0xcf72('0x1b')](realtime[_0xcf72('0x38')]())[_0xcf72('0x1b')](cmHopperHistory['getVoiceQueueHopperHistory']())[_0xcf72('0x1b')](realtime[_0xcf72('0x39')]())[_0xcf72('0x1b')](cmHopperHistory[_0xcf72('0x3a')]())['then'](realtime['initCampaignHopperHistory']())[_0xcf72('0x1b')](voiceCallReport['getVoiceCallReports']())[_0xcf72('0x1b')](realtime[_0xcf72('0x3b')]())[_0xcf72('0x3c')](function(_0x1951b0){logger[_0xcf72('0x3d')]('[index.js][initParams]',util['inspect'](_0x1951b0,{'showHidden':![],'depth':null}));});}function main(){return server['listen'](realtime,preview,fax)['then'](function(_0x2044bd){return initRealtime();})[_0xcf72('0x1b')](function(){return initParams();})[_0xcf72('0x1b')](function(){report[_0xcf72('0x3e')]();setInterval(initRealtime,0x1388);})[_0xcf72('0x3c')](function(_0x299a02){logger[_0xcf72('0x3d')]('[index.js][main]',util[_0xcf72('0x3f')](_0x299a02,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x24a7=['initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','getZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','catch','error','inspect','listen','sync','[index.js][main]','./server','./report','./trigger','./dialer','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/trigger','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/zoho','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','ami','get','hour','resolve','then','getAgents','initAgents','getTelephones'];(function(_0xb8fd40,_0x23030a){var _0x46fcde=function(_0x1a22ff){while(--_0x1a22ff){_0xb8fd40['push'](_0xb8fd40['shift']());}};_0x46fcde(++_0x23030a);}(_0x24a7,0x134));var _0x724a=function(_0x3ec5ce,_0x4b97aa){_0x3ec5ce=_0x3ec5ce-0x0;var _0x3a9e68=_0x24a7[_0x3ec5ce];return _0x3a9e68;};'use strict';var BPromise=require('bluebird');var util=require('util');var moment=require('moment');var server=require(_0x724a('0x0'));var Realtime=require('./realtime');var Report=require(_0x724a('0x1'));var Acw=require('./acw');var Trigger=require(_0x724a('0x2'));var Dialer=require(_0x724a('0x3'));var Preview=require('./preview');var Fax=require(_0x724a('0x4'));var user=require(_0x724a('0x5'));var voiceQueue=require(_0x724a('0x6'));var voiceQueueReport=require(_0x724a('0x7'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require('./rpc/trunk');var trigger=require(_0x724a('0x8'));var template=require('./rpc/template');var cmHopperHistory=require(_0x724a('0x9'));var campaign=require(_0x724a('0xa'));var voiceExtension=require(_0x724a('0xb'));var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0x724a('0xc'));var salesforce=require(_0x724a('0xd'));var sugarcrm=require(_0x724a('0xe'));var freshdesk=require(_0x724a('0xf'));var desk=require('./rpc/integrations/desk');var zoho=require(_0x724a('0x10'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require('./rpc/integrations/freshsales');var servicenow=require(_0x724a('0x11'));var dynamics365=require(_0x724a('0x12'));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')(_0x724a('0x13'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x724a('0x14')](_0x724a('0x15'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x724a('0x14')](_0x724a('0x15'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x724a('0x16')]()[_0x724a('0x17')](user[_0x724a('0x18')]())[_0x724a('0x17')](realtime[_0x724a('0x19')]())[_0x724a('0x17')](user[_0x724a('0x1a')]())[_0x724a('0x17')](realtime[_0x724a('0x1b')]())[_0x724a('0x17')](trunk[_0x724a('0x1c')]())[_0x724a('0x17')](realtime[_0x724a('0x1d')]())[_0x724a('0x17')](voiceQueue[_0x724a('0x1e')]())['then'](realtime[_0x724a('0x1f')]())['then'](trigger[_0x724a('0x20')]())[_0x724a('0x17')](realtime[_0x724a('0x21')]())[_0x724a('0x17')](template[_0x724a('0x22')]())[_0x724a('0x17')](realtime[_0x724a('0x23')]())[_0x724a('0x17')](zendesk['getZendeskAccounts']())[_0x724a('0x17')](realtime[_0x724a('0x24')]())[_0x724a('0x17')](salesforce[_0x724a('0x25')]())[_0x724a('0x17')](realtime[_0x724a('0x26')]())['then'](sugarcrm['getSugarcrmAccounts']())[_0x724a('0x17')](realtime[_0x724a('0x27')]())[_0x724a('0x17')](freshdesk[_0x724a('0x28')]())[_0x724a('0x17')](realtime[_0x724a('0x29')]())[_0x724a('0x17')](desk[_0x724a('0x2a')]())[_0x724a('0x17')](realtime['initDeskAccounts']())[_0x724a('0x17')](zoho[_0x724a('0x2b')]())[_0x724a('0x17')](realtime['initZohoAccounts']())[_0x724a('0x17')](vtiger[_0x724a('0x2c')]())['then'](realtime[_0x724a('0x2d')]())[_0x724a('0x17')](freshsales[_0x724a('0x2e')]())[_0x724a('0x17')](realtime[_0x724a('0x2f')]())[_0x724a('0x17')](servicenow[_0x724a('0x30')]())[_0x724a('0x17')](realtime['initServicenowAccounts']())[_0x724a('0x17')](dynamics365[_0x724a('0x31')]())['then'](realtime[_0x724a('0x32')]())[_0x724a('0x17')](campaign[_0x724a('0x33')]())[_0x724a('0x17')](realtime[_0x724a('0x34')]())[_0x724a('0x17')](voiceExtension['getVoiceExtensions']())[_0x724a('0x17')](realtime[_0x724a('0x35')]())[_0x724a('0x17')](faxAccount[_0x724a('0x36')]())['then'](realtime[_0x724a('0x37')]())[_0x724a('0x17')](function(){return realtime;});}function initParams(){return BPromise['resolve']()[_0x724a('0x17')](voiceQueueReport[_0x724a('0x38')]())[_0x724a('0x17')](realtime[_0x724a('0x39')]())['then'](cmHopperHistory[_0x724a('0x3a')]())[_0x724a('0x17')](realtime['initVoiceQueueHopperHistory']())['then'](cmHopperHistory[_0x724a('0x3b')]())['then'](realtime[_0x724a('0x3c')]())[_0x724a('0x17')](voiceCallReport['getVoiceCallReports']())[_0x724a('0x17')](realtime['initVoiceCallReports']())[_0x724a('0x3d')](function(_0x1f2304){logger[_0x724a('0x3e')]('[index.js][initParams]',util[_0x724a('0x3f')](_0x1f2304,{'showHidden':![],'depth':null}));});}function main(){return server[_0x724a('0x40')](realtime,preview,fax)[_0x724a('0x17')](function(_0x272451){return initRealtime();})[_0x724a('0x17')](function(){return initParams();})[_0x724a('0x17')](function(){report[_0x724a('0x41')]();setInterval(initRealtime,0x1388);})[_0x724a('0x3d')](function(_0x1dadec){logger[_0x724a('0x3e')](_0x724a('0x42'),util[_0x724a('0x3f')](_0x1dadec,{'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 891d475..be888f4 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 _0xcb91=['name','email','accountcode','fullname','unknown','stateTime','status','address','mobile','interface','online','voiceStatus','voiceStatusQueue','onhold','local','updateStatusRealtime','state','idle','inuse','talking','statePause','voiceStatusTime','toNumber','voiceStatusCallerIdNumber','stringify','format','emit','user:presence','exports','moment','md5','ioredis','../../../config/environment','defaults','redis','socket.io-emitter'];(function(_0x1a53ac,_0x4c14eb){var _0x46392b=function(_0x4da69b){while(--_0x4da69b){_0x1a53ac['push'](_0x1a53ac['shift']());}};_0x46392b(++_0x4c14eb);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x280ae7,_0x456fb1){_0x280ae7=_0x280ae7-0x0;var _0x418b9e=_0xcb91[_0x280ae7];return _0x418b9e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var md5=require(_0x1cb9('0x1'));var Redis=require(_0x1cb9('0x2'));var config=require(_0x1cb9('0x3'));config['redis']=_[_0x1cb9('0x4')](config[_0x1cb9('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x1cb9('0x6'))(new Redis(config[_0x1cb9('0x5')]));function Agent(_0x53ffbd){this['id']=_0x53ffbd['id']||0x0;this[_0x1cb9('0x7')]=_0x53ffbd[_0x1cb9('0x7')]||'';this['email']=_0x53ffbd[_0x1cb9('0x8')]||'';this[_0x1cb9('0x9')]=_0x53ffbd['accountcode']||'';this[_0x1cb9('0xa')]=_0x53ffbd['fullname']||'';this['state']=_0x1cb9('0xb');this[_0x1cb9('0xc')]=0x0;this[_0x1cb9('0xd')]=_0x1cb9('0xb');this[_0x1cb9('0xe')]='';this['phone']='';this[_0x1cb9('0xf')]='';this[_0x1cb9('0x10')]='';this[_0x1cb9('0x11')]=_0x53ffbd[_0x1cb9('0x11')]||![];this[_0x1cb9('0x12')]='unknown';this['voiceStatusTime']=0x0;this['voiceStatusCallerIdNumber']='';this[_0x1cb9('0x13')]='';this[_0x1cb9('0x14')]=![];this[_0x1cb9('0x15')]=![];this[_0x1cb9('0x1')]='';}Agent['prototype'][_0x1cb9('0x16')]=function(_0x6ef389){var _0x1b3cd7;if(_0x6ef389&&_0x6ef389[_0x1cb9('0x17')]){_0x1b3cd7=_0x6ef389[_0x1cb9('0x17')]['toLowerCase']();switch(_0x1b3cd7){case'not_inuse':_0x1b3cd7=_0x1cb9('0x18');break;case _0x1cb9('0x19'):_0x1b3cd7=_0x1cb9('0x1a');break;}}if(_0x1b3cd7&&this[_0x1cb9('0x12')]!==_0x1b3cd7||_0x6ef389[_0x1cb9('0x1b')]){this[_0x1cb9('0x1c')]=_[_0x1cb9('0x1d')](moment()['format']('x'));}if(_0x1b3cd7){this['voiceStatus']=_0x1b3cd7;}var _0x1b2fa6={'id':this['id'],'name':this[_0x1cb9('0x7')],'email':this[_0x1cb9('0x8')],'accountcode':this[_0x1cb9('0x9')],'fullname':this[_0x1cb9('0xa')],'state':this[_0x1cb9('0x17')],'stateTime':this[_0x1cb9('0xc')],'status':this['status'],'address':this['address'],'online':this[_0x1cb9('0x11')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0x1cb9('0x1c')],'voiceStatusCallerIdNumber':this[_0x1cb9('0x1e')],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this['interface'],'onhold':this[_0x1cb9('0x14')]};var _0x325637=md5(JSON[_0x1cb9('0x1f')](_0x1b2fa6));if(this[_0x1cb9('0x1')]!==_0x325637){this[_0x1cb9('0x1')]=_0x325637;io['to'](util[_0x1cb9('0x20')]('user:%s',_0x1b2fa6['name']))[_0x1cb9('0x21')]('user:save',_0x1b2fa6);io[_0x1cb9('0x21')](_0x1cb9('0x22'),_0x1b2fa6);}};module[_0x1cb9('0x23')]=Agent; \ No newline at end of file +var _0xe706=['address','phone','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','updateStatusRealtime','not_inuse','inuse','talking','format','interface','stringify','md5','user:%s','emit','user:presence','lodash','util','moment','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','status'];(function(_0x358c0c,_0x508ff0){var _0x14ffb5=function(_0x252007){while(--_0x252007){_0x358c0c['push'](_0x358c0c['shift']());}};_0x14ffb5(++_0x508ff0);}(_0xe706,0xa3));var _0x6e70=function(_0x6d6a66,_0x2924af){_0x6d6a66=_0x6d6a66-0x0;var _0x11eb6e=_0xe706[_0x6d6a66];return _0x11eb6e;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var md5=require('md5');var Redis=require(_0x6e70('0x3'));var config=require(_0x6e70('0x4'));config[_0x6e70('0x5')]=_[_0x6e70('0x6')](config[_0x6e70('0x5')],{'host':_0x6e70('0x7'),'port':0x18eb});var io=require(_0x6e70('0x8'))(new Redis(config[_0x6e70('0x5')]));function Agent(_0x1b0389){this['id']=_0x1b0389['id']||0x0;this[_0x6e70('0x9')]=_0x1b0389[_0x6e70('0x9')]||'';this[_0x6e70('0xa')]=_0x1b0389[_0x6e70('0xa')]||'';this[_0x6e70('0xb')]=_0x1b0389[_0x6e70('0xb')]||'';this[_0x6e70('0xc')]=_0x1b0389[_0x6e70('0xc')]||'';this[_0x6e70('0xd')]=_0x6e70('0xe');this[_0x6e70('0xf')]=0x0;this[_0x6e70('0x10')]=_0x6e70('0xe');this[_0x6e70('0x11')]='';this[_0x6e70('0x12')]='';this['mobile']='';this['interface']='';this[_0x6e70('0x13')]=_0x1b0389[_0x6e70('0x13')]||![];this[_0x6e70('0x14')]=_0x6e70('0xe');this[_0x6e70('0x15')]=0x0;this[_0x6e70('0x16')]='';this[_0x6e70('0x17')]='';this[_0x6e70('0x18')]=![];this['local']=![];this['md5']='';}Agent['prototype'][_0x6e70('0x19')]=function(_0x5a37a6){var _0x53aed0;if(_0x5a37a6&&_0x5a37a6[_0x6e70('0xd')]){_0x53aed0=_0x5a37a6[_0x6e70('0xd')]['toLowerCase']();switch(_0x53aed0){case _0x6e70('0x1a'):_0x53aed0='idle';break;case _0x6e70('0x1b'):_0x53aed0=_0x6e70('0x1c');break;}}if(_0x53aed0&&this['voiceStatus']!==_0x53aed0||_0x5a37a6['statePause']){this[_0x6e70('0x15')]=_['toNumber'](moment()[_0x6e70('0x1d')]('x'));}if(_0x53aed0){this[_0x6e70('0x14')]=_0x53aed0;}var _0x53acdc={'id':this['id'],'name':this['name'],'email':this[_0x6e70('0xa')],'accountcode':this[_0x6e70('0xb')],'fullname':this[_0x6e70('0xc')],'state':this[_0x6e70('0xd')],'stateTime':this[_0x6e70('0xf')],'status':this[_0x6e70('0x10')],'address':this[_0x6e70('0x11')],'online':this[_0x6e70('0x13')],'voiceStatus':this[_0x6e70('0x14')],'voiceStatusTime':this[_0x6e70('0x15')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x6e70('0x17')],'interface':this[_0x6e70('0x1e')],'onhold':this[_0x6e70('0x18')]};var _0x502b2d=md5(JSON[_0x6e70('0x1f')](_0x53acdc));if(this[_0x6e70('0x20')]!==_0x502b2d){this[_0x6e70('0x20')]=_0x502b2d;io['to'](util['format'](_0x6e70('0x21'),_0x53acdc['name']))['emit']('user:save',_0x53acdc);io[_0x6e70('0x22')](_0x6e70('0x23'),_0x53acdc);}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 5189932..1848841 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 _0x9528=['dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','name','type','campaign','originated','message','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency'];(function(_0x446c24,_0x286a90){var _0x1bacfe=function(_0x39cd2b){while(--_0x39cd2b){_0x446c24['push'](_0x446c24['shift']());}};_0x1bacfe(++_0x286a90);}(_0x9528,0x1ab));var _0x8952=function(_0x13f263,_0x38b957){_0x13f263=_0x13f263-0x0;var _0x34c194=_0x9528[_0x13f263];return _0x34c194;};'use strict';function Campaign(_0xaef4e5){this['id']=_0xaef4e5['id']||0x0;this[_0x8952('0x0')]=_0xaef4e5['name']||'';this[_0x8952('0x1')]=_0xaef4e5[_0x8952('0x1')]||_0x8952('0x2');this[_0x8952('0x3')]=0x0;this['temp']=0x0;this['ivrAnswerCallsDay']=0x0;this['ivrTotalCallsDays']=0x0;this[_0x8952('0x4')]='';this['sendMessageOneNotActive']=!![];this[_0x8952('0x5')]=_0xaef4e5['active'];this[_0x8952('0x6')]=_0xaef4e5[_0x8952('0x6')];this['dialTimezone']=_0xaef4e5[_0x8952('0x7')]||null;this['dialGlobalInterval']=_0xaef4e5[_0x8952('0x8')]?_0xaef4e5[_0x8952('0x8')]:null;this[_0x8952('0x9')]=_0xaef4e5['dialOriginateCallerIdName'];this[_0x8952('0xa')]=_0xaef4e5[_0x8952('0xa')];this['dialOriginateTimeout']=_0xaef4e5[_0x8952('0xb')]||0x1e;this[_0x8952('0xc')]=_0xaef4e5[_0x8952('0xc')];this['dialCongestionRetryFrequency']=_0xaef4e5['dialCongestionRetryFrequency'];this[_0x8952('0xd')]=_0xaef4e5[_0x8952('0xd')];this[_0x8952('0xe')]=_0xaef4e5['dialBusyRetryFrequency'];this[_0x8952('0xf')]=_0xaef4e5['dialNoAnswerMaxRetry'];this[_0x8952('0x10')]=_0xaef4e5[_0x8952('0x10')];this['dialGlobalMaxRetry']=_0xaef4e5['dialGlobalMaxRetry'];this['dialNoSuchNumberMaxRetry']=_0xaef4e5[_0x8952('0x11')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0xaef4e5[_0x8952('0x12')]||0x96;this[_0x8952('0x13')]=_0xaef4e5[_0x8952('0x13')]||0x3;this[_0x8952('0x14')]=_0xaef4e5[_0x8952('0x14')]||0x96;this['dialAbandonedMaxRetry']=_0xaef4e5[_0x8952('0x15')]||0x3;this[_0x8952('0x16')]=_0xaef4e5['dialAbandonedRetryFrequency']||0x96;this[_0x8952('0x17')]=_0xaef4e5[_0x8952('0x17')]||0x3;this['dialMachineRetryFrequency']=_0xaef4e5[_0x8952('0x18')]||0x96;this[_0x8952('0x19')]=_0xaef4e5['dialAgentRejectMaxRetry']||0x3;this[_0x8952('0x1a')]=_0xaef4e5[_0x8952('0x1a')]||0x96;this[_0x8952('0x1b')]=_0xaef4e5[_0x8952('0x1b')]||'DESC';this[_0x8952('0x1c')]=_0xaef4e5[_0x8952('0x1c')]||undefined;this[_0x8952('0x1d')]=_0xaef4e5['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x8952('0x1e')]=_0xaef4e5[_0x8952('0x1e')]||undefined;this[_0x8952('0x1f')]=_0xaef4e5[_0x8952('0x1f')]?_0xaef4e5['TrunkBackup']:undefined;this[_0x8952('0x20')]=_0xaef4e5[_0x8952('0x20')]?_0xaef4e5['Trunk']:undefined;this[_0x8952('0x21')]=_0xaef4e5[_0x8952('0x21')]?_0xaef4e5[_0x8952('0x21')]:undefined;this[_0x8952('0x22')]=_0xaef4e5[_0x8952('0x22')]?_0xaef4e5['SquareProject']:undefined;this[_0x8952('0x23')]=_0xaef4e5[_0x8952('0x22')]?_0xaef4e5[_0x8952('0x22')][_0x8952('0x0')]:undefined;this[_0x8952('0x24')]=_0xaef4e5[_0x8952('0x24')]||![];this['dialAMDInitialSilence']=_0xaef4e5['dialAMDInitialSilence'];this[_0x8952('0x25')]=_0xaef4e5[_0x8952('0x25')];this[_0x8952('0x26')]=_0xaef4e5[_0x8952('0x26')];this[_0x8952('0x27')]=_0xaef4e5[_0x8952('0x27')];this[_0x8952('0x28')]=_0xaef4e5[_0x8952('0x28')];this[_0x8952('0x29')]=_0xaef4e5['dialAMDBetweenWordsSilence'];this[_0x8952('0x2a')]=_0xaef4e5[_0x8952('0x2a')];this[_0x8952('0x2b')]=_0xaef4e5[_0x8952('0x2b')];this['dialAMDMaximumWordLength']=_0xaef4e5[_0x8952('0x2c')];}module['exports']=Campaign; \ No newline at end of file +var _0xfc7c=['dialOrderByScheduledAt','dialPrefix','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrAnswerCallsDay','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry'];(function(_0x55ee91,_0x160100){var _0x2a17c9=function(_0x2d8e0e){while(--_0x2d8e0e){_0x55ee91['push'](_0x55ee91['shift']());}};_0x2a17c9(++_0x160100);}(_0xfc7c,0x15b));var _0xcfc7=function(_0xfb2dad,_0xecb606){_0xfb2dad=_0xfb2dad-0x0;var _0x89d211=_0xfc7c[_0xfb2dad];return _0x89d211;};'use strict';function Campaign(_0x4d27a4){this['id']=_0x4d27a4['id']||0x0;this[_0xcfc7('0x0')]=_0x4d27a4[_0xcfc7('0x0')]||'';this[_0xcfc7('0x1')]=_0x4d27a4[_0xcfc7('0x1')]||_0xcfc7('0x2');this[_0xcfc7('0x3')]=0x0;this[_0xcfc7('0x4')]=0x0;this[_0xcfc7('0x5')]=0x0;this['ivrTotalCallsDays']=0x0;this[_0xcfc7('0x6')]='';this[_0xcfc7('0x7')]=!![];this[_0xcfc7('0x8')]=_0x4d27a4['active'];this[_0xcfc7('0x9')]=_0x4d27a4[_0xcfc7('0x9')];this['dialTimezone']=_0x4d27a4[_0xcfc7('0xa')]||null;this[_0xcfc7('0xb')]=_0x4d27a4[_0xcfc7('0xb')]?_0x4d27a4['dialGlobalInterval']:null;this['dialOriginateCallerIdName']=_0x4d27a4[_0xcfc7('0xc')];this[_0xcfc7('0xd')]=_0x4d27a4[_0xcfc7('0xd')];this[_0xcfc7('0xe')]=_0x4d27a4[_0xcfc7('0xe')]||0x1e;this['dialCongestionMaxRetry']=_0x4d27a4['dialCongestionMaxRetry'];this['dialCongestionRetryFrequency']=_0x4d27a4[_0xcfc7('0xf')];this['dialBusyMaxRetry']=_0x4d27a4['dialBusyMaxRetry'];this[_0xcfc7('0x10')]=_0x4d27a4[_0xcfc7('0x10')];this[_0xcfc7('0x11')]=_0x4d27a4[_0xcfc7('0x11')];this[_0xcfc7('0x12')]=_0x4d27a4[_0xcfc7('0x12')];this['dialGlobalMaxRetry']=_0x4d27a4[_0xcfc7('0x13')];this[_0xcfc7('0x14')]=_0x4d27a4[_0xcfc7('0x14')]||0x3;this[_0xcfc7('0x15')]=_0x4d27a4[_0xcfc7('0x15')]||0x96;this[_0xcfc7('0x16')]=_0x4d27a4[_0xcfc7('0x16')]||0x3;this[_0xcfc7('0x17')]=_0x4d27a4[_0xcfc7('0x17')]||0x96;this[_0xcfc7('0x18')]=_0x4d27a4[_0xcfc7('0x18')]||0x3;this[_0xcfc7('0x19')]=_0x4d27a4[_0xcfc7('0x19')]||0x96;this[_0xcfc7('0x1a')]=_0x4d27a4[_0xcfc7('0x1a')]||0x3;this[_0xcfc7('0x1b')]=_0x4d27a4[_0xcfc7('0x1b')]||0x96;this[_0xcfc7('0x1c')]=_0x4d27a4['dialAgentRejectMaxRetry']||0x3;this['dialAgentRejectRetryFrequency']=_0x4d27a4['dialAgentRejectRetryFrequency']||0x96;this[_0xcfc7('0x1d')]=_0x4d27a4[_0xcfc7('0x1d')]||'DESC';this['dialPrefix']=_0x4d27a4[_0xcfc7('0x1e')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x4d27a4['dialRandomLastDigitCallerIdNumber']||undefined;this['dialCutDigit']=_0x4d27a4[_0xcfc7('0x1f')]||undefined;this['TrunkBackup']=_0x4d27a4[_0xcfc7('0x20')]?_0x4d27a4[_0xcfc7('0x20')]:undefined;this['Trunk']=_0x4d27a4[_0xcfc7('0x21')]?_0x4d27a4[_0xcfc7('0x21')]:undefined;this[_0xcfc7('0x22')]=_0x4d27a4[_0xcfc7('0x22')]?_0x4d27a4[_0xcfc7('0x22')]:undefined;this[_0xcfc7('0x23')]=_0x4d27a4[_0xcfc7('0x23')]?_0x4d27a4[_0xcfc7('0x23')]:undefined;this['dialQueueProject']=_0x4d27a4['SquareProject']?_0x4d27a4[_0xcfc7('0x23')][_0xcfc7('0x0')]:undefined;this[_0xcfc7('0x24')]=_0x4d27a4[_0xcfc7('0x24')]||![];this[_0xcfc7('0x25')]=_0x4d27a4[_0xcfc7('0x25')];this['dialAMDGreeting']=_0x4d27a4[_0xcfc7('0x26')];this[_0xcfc7('0x27')]=_0x4d27a4[_0xcfc7('0x27')];this[_0xcfc7('0x28')]=_0x4d27a4[_0xcfc7('0x28')];this[_0xcfc7('0x29')]=_0x4d27a4[_0xcfc7('0x29')];this['dialAMDBetweenWordsSilence']=_0x4d27a4[_0xcfc7('0x2a')];this[_0xcfc7('0x2b')]=_0x4d27a4[_0xcfc7('0x2b')];this['dialAMDSilenceThreshold']=_0x4d27a4[_0xcfc7('0x2c')];this[_0xcfc7('0x2d')]=_0x4d27a4[_0xcfc7('0x2d')];}module[_0xcfc7('0x2e')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index d8617b7..752629e 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 _0xa3c3=['transfercalleridnum','transferType','mohtime','exports','starttime','destinationchannel','calleridname','connectedlinename','accountcode','uniqueid','linkedid','exten','answered','unmanaged','abandoned','lastapplication','lastdata','duration','holdtime','type','tag','disposition','monitorFilename','queue','monitors'];(function(_0x1b54b6,_0x596421){var _0x41c821=function(_0x36897d){while(--_0x36897d){_0x1b54b6['push'](_0x1b54b6['shift']());}};_0x41c821(++_0x596421);}(_0xa3c3,0xcc));var _0x3a3c=function(_0x379127,_0x462a3e){_0x379127=_0x379127-0x0;var _0x28eeb3=_0xa3c3[_0x379127];return _0x28eeb3;};'use strict';function Channel(){this[_0x3a3c('0x0')]=null;this['channel']='';this[_0x3a3c('0x1')]='';this['calleridnum']=0x0;this[_0x3a3c('0x2')]='';this['connectedlinenum']=undefined;this[_0x3a3c('0x3')]=undefined;this[_0x3a3c('0x4')]=0x0;this['context']='';this[_0x3a3c('0x5')]=0x0;this[_0x3a3c('0x6')]=0x0;this[_0x3a3c('0x7')]=0x0;this[_0x3a3c('0x8')]=![];this['answertime']=null;this['endtime']=null;this[_0x3a3c('0x9')]=![];this[_0x3a3c('0xa')]=![];this[_0x3a3c('0xb')]='';this[_0x3a3c('0xc')]='';this[_0x3a3c('0xd')]=0x0;this['billableseconds']=0x0;this[_0x3a3c('0xe')]=0x0;this[_0x3a3c('0xf')]=null;this[_0x3a3c('0x10')]=null;this[_0x3a3c('0x11')]=null;this['monitor']=![];this[_0x3a3c('0x12')]=null;this[_0x3a3c('0x13')]=null;this[_0x3a3c('0x14')]=[];this[_0x3a3c('0x15')]=undefined;this['transferconnectedlinenum']=undefined;this[_0x3a3c('0x16')]=undefined;this[_0x3a3c('0x17')]=0x0;}module[_0x3a3c('0x18')]=Channel; \ No newline at end of file +var _0x041d=['channel','destinationchannel','calleridnum','calleridname','accountcode','uniqueid','linkedid','answered','answertime','endtime','unmanaged','abandoned','lastapplication','duration','billableseconds','holdtime','type','tag','monitor','monitorFilename','queue','transfercalleridnum','transferType','mohtime','exports','starttime'];(function(_0x364040,_0x2661d5){var _0x4328dc=function(_0x29a477){while(--_0x29a477){_0x364040['push'](_0x364040['shift']());}};_0x4328dc(++_0x2661d5);}(_0x041d,0x185));var _0xd041=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0x041d[_0x1d24eb];return _0x1dc576;};'use strict';function Channel(){this[_0xd041('0x0')]=null;this[_0xd041('0x1')]='';this[_0xd041('0x2')]='';this[_0xd041('0x3')]=0x0;this[_0xd041('0x4')]='';this['connectedlinenum']=undefined;this['connectedlinename']=undefined;this[_0xd041('0x5')]=0x0;this['context']='';this[_0xd041('0x6')]=0x0;this[_0xd041('0x7')]=0x0;this['exten']=0x0;this[_0xd041('0x8')]=![];this[_0xd041('0x9')]=null;this[_0xd041('0xa')]=null;this[_0xd041('0xb')]=![];this[_0xd041('0xc')]=![];this[_0xd041('0xd')]='';this['lastdata']='';this[_0xd041('0xe')]=0x0;this[_0xd041('0xf')]=0x0;this[_0xd041('0x10')]=0x0;this[_0xd041('0x11')]=null;this[_0xd041('0x12')]=null;this['disposition']=null;this[_0xd041('0x13')]=![];this[_0xd041('0x14')]=null;this[_0xd041('0x15')]=null;this['monitors']=[];this[_0xd041('0x16')]=undefined;this['transferconnectedlinenum']=undefined;this[_0xd041('0x17')]=undefined;this[_0xd041('0x18')]=0x0;}module[_0xd041('0x19')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index e375fdb..2ddec82 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 _0xac65=['exports','name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xac65,0x12d));var _0x5ac6=function(_0x2d6efb,_0x207c6a){_0x2d6efb=_0x2d6efb-0x0;var _0x39057b=_0xac65[_0x2d6efb];return _0x39057b;};'use strict';function DeskAccount(_0x2a95c4){this['id']=_0x2a95c4['id']||0x0;this[_0x5ac6('0x0')]=_0x2a95c4['name']||'';this[_0x5ac6('0x1')]=_0x2a95c4[_0x5ac6('0x1')]||'';this[_0x5ac6('0x2')]=_0x2a95c4['remoteUri']||'';this[_0x5ac6('0x3')]=_0x2a95c4[_0x5ac6('0x3')]||'';this[_0x5ac6('0x4')]=_0x2a95c4['password']||'';this['consumerKey']=_0x2a95c4[_0x5ac6('0x5')]||'';this[_0x5ac6('0x6')]=_0x2a95c4[_0x5ac6('0x6')]||'';this[_0x5ac6('0x7')]=_0x2a95c4[_0x5ac6('0x7')]||'';this['tokenSecret']=_0x2a95c4[_0x5ac6('0x8')]||'';this[_0x5ac6('0x9')]=_0x2a95c4[_0x5ac6('0x9')]||'';this[_0x5ac6('0xa')]=_0x2a95c4['serverUrl']||'';this['Configurations']=_0x2a95c4['Configurations']||{};}module[_0x5ac6('0xb')]=DeskAccount; \ No newline at end of file +var _0x16c4=['consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri','authType','password'];(function(_0x3de8a0,_0x4b80ec){var _0x5b1d8b=function(_0x3d1b0b){while(--_0x3d1b0b){_0x3de8a0['push'](_0x3de8a0['shift']());}};_0x5b1d8b(++_0x4b80ec);}(_0x16c4,0x1e9));var _0x416c=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x16c4[_0x1d1779];return _0x2377e9;};'use strict';function DeskAccount(_0xab67e8){this['id']=_0xab67e8['id']||0x0;this[_0x416c('0x0')]=_0xab67e8[_0x416c('0x0')]||'';this['username']=_0xab67e8[_0x416c('0x1')]||'';this[_0x416c('0x2')]=_0xab67e8[_0x416c('0x2')]||'';this['authType']=_0xab67e8[_0x416c('0x3')]||'';this[_0x416c('0x4')]=_0xab67e8['password']||'';this[_0x416c('0x5')]=_0xab67e8[_0x416c('0x5')]||'';this[_0x416c('0x6')]=_0xab67e8[_0x416c('0x6')]||'';this[_0x416c('0x7')]=_0xab67e8[_0x416c('0x7')]||'';this[_0x416c('0x8')]=_0xab67e8['tokenSecret']||'';this[_0x416c('0x9')]=_0xab67e8[_0x416c('0x9')]||'';this[_0x416c('0xa')]=_0xab67e8[_0x416c('0xa')]||'';this[_0x416c('0xb')]=_0xab67e8[_0x416c('0xb')]||{};}module[_0x416c('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 a5ac46a..48f8197 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 _0x170e=['modernAuthentication','Configurations','CloudProvider','exports','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl'];(function(_0x3e7d60,_0x1c4012){var _0x4deccb=function(_0x179e35){while(--_0x179e35){_0x3e7d60['push'](_0x3e7d60['shift']());}};_0x4deccb(++_0x1c4012);}(_0x170e,0x10c));var _0xe170=function(_0x2d72ab,_0x5a97f5){_0x2d72ab=_0x2d72ab-0x0;var _0x256423=_0x170e[_0x2d72ab];return _0x256423;};'use strict';function Dynamics365Account(_0x54e179){this['id']=_0x54e179['id']||0x0;this['name']=_0x54e179['name']||'';this[_0xe170('0x0')]=_0x54e179[_0xe170('0x0')]||'';this[_0xe170('0x1')]=_0x54e179[_0xe170('0x1')]||'';this[_0xe170('0x2')]=_0x54e179[_0xe170('0x2')]||'';this[_0xe170('0x3')]=_0x54e179['tenantId']||'';this[_0xe170('0x4')]=_0x54e179['clientId']||'';this[_0xe170('0x5')]=_0x54e179[_0xe170('0x5')]||{};this[_0xe170('0x6')]=_0x54e179[_0xe170('0x6')]||'';this[_0xe170('0x7')]=_0x54e179['modernAuthentication']||![];this[_0xe170('0x8')]=_0x54e179[_0xe170('0x8')]||{};this[_0xe170('0x9')]=_0x54e179[_0xe170('0x9')]||{};}module[_0xe170('0xa')]=Dynamics365Account; \ No newline at end of file +var _0x9a7c=['password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','exports','name','username'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x9a7c,0x172));var _0xc9a7=function(_0x1717b4,_0x5ae896){_0x1717b4=_0x1717b4-0x0;var _0x495444=_0x9a7c[_0x1717b4];return _0x495444;};'use strict';function Dynamics365Account(_0x1d0e62){this['id']=_0x1d0e62['id']||0x0;this[_0xc9a7('0x0')]=_0x1d0e62[_0xc9a7('0x0')]||'';this[_0xc9a7('0x1')]=_0x1d0e62[_0xc9a7('0x1')]||'';this[_0xc9a7('0x2')]=_0x1d0e62[_0xc9a7('0x2')]||'';this[_0xc9a7('0x3')]=_0x1d0e62[_0xc9a7('0x3')]||'';this[_0xc9a7('0x4')]=_0x1d0e62[_0xc9a7('0x4')]||'';this['clientId']=_0x1d0e62[_0xc9a7('0x5')]||'';this[_0xc9a7('0x6')]=_0x1d0e62[_0xc9a7('0x6')]||{};this[_0xc9a7('0x7')]=_0x1d0e62[_0xc9a7('0x7')]||'';this[_0xc9a7('0x8')]=_0x1d0e62[_0xc9a7('0x8')]||![];this[_0xc9a7('0x9')]=_0x1d0e62[_0xc9a7('0x9')]||{};this[_0xc9a7('0xa')]=_0x1d0e62['CloudProvider']||{};}module[_0xc9a7('0xb')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 2da43ae..f9b7eec 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 _0x53ce=['Trunk','ListId','key','exports','name','description','ecm','headerinfo','maxrate','modem','gateway','faxdetect','t38timeout','tech'];(function(_0x3cb822,_0x56731f){var _0x1af30d=function(_0x2e0798){while(--_0x2e0798){_0x3cb822['push'](_0x3cb822['shift']());}};_0x1af30d(++_0x56731f);}(_0x53ce,0x1b6));var _0xe53c=function(_0xa86e1b,_0x136063){_0xa86e1b=_0xa86e1b-0x0;var _0x5a8ece=_0x53ce[_0xa86e1b];return _0x5a8ece;};'use strict';function FaxAccount(_0x46bacb){this['id']=_0x46bacb['id']||0x0;this[_0xe53c('0x0')]=_0x46bacb[_0xe53c('0x0')]||'';this[_0xe53c('0x1')]=_0x46bacb[_0xe53c('0x1')];this['ecm']=_0x46bacb[_0xe53c('0x2')];this[_0xe53c('0x3')]=_0x46bacb[_0xe53c('0x3')];this['localstationid']=_0x46bacb['localstationid'];this['minrate']=_0x46bacb['minrate']||0x960;this[_0xe53c('0x4')]=_0x46bacb[_0xe53c('0x4')]||0x3840;this[_0xe53c('0x5')]=_0x46bacb['modem']||'v17,v27,v29';this[_0xe53c('0x6')]=_0x46bacb[_0xe53c('0x6')]||'no';this[_0xe53c('0x7')]=_0x46bacb[_0xe53c('0x7')]||'no';this[_0xe53c('0x8')]=_0x46bacb[_0xe53c('0x8')]||0x1388;this[_0xe53c('0x9')]=_0x46bacb[_0xe53c('0x9')]||'SIP';this[_0xe53c('0xa')]=_0x46bacb['Trunk']?_0x46bacb[_0xe53c('0xa')]:undefined;this[_0xe53c('0xb')]=_0x46bacb[_0xe53c('0xb')];this['key']=_0x46bacb[_0xe53c('0xc')];}module[_0xe53c('0xd')]=FaxAccount; \ No newline at end of file +var _0x4185=['maxrate','v17,v27,v29','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','name','description','ecm','headerinfo','localstationid','minrate'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4185,0x180));var _0x5418=function(_0x391ebf,_0x47d536){_0x391ebf=_0x391ebf-0x0;var _0xe56112=_0x4185[_0x391ebf];return _0xe56112;};'use strict';function FaxAccount(_0x3287b4){this['id']=_0x3287b4['id']||0x0;this[_0x5418('0x0')]=_0x3287b4['name']||'';this[_0x5418('0x1')]=_0x3287b4['description'];this[_0x5418('0x2')]=_0x3287b4['ecm'];this[_0x5418('0x3')]=_0x3287b4[_0x5418('0x3')];this[_0x5418('0x4')]=_0x3287b4[_0x5418('0x4')];this['minrate']=_0x3287b4[_0x5418('0x5')]||0x960;this[_0x5418('0x6')]=_0x3287b4[_0x5418('0x6')]||0x3840;this['modem']=_0x3287b4['modem']||_0x5418('0x7');this['gateway']=_0x3287b4['gateway']||'no';this['faxdetect']=_0x3287b4[_0x5418('0x8')]||'no';this['t38timeout']=_0x3287b4[_0x5418('0x9')]||0x1388;this[_0x5418('0xa')]=_0x3287b4[_0x5418('0xa')]||_0x5418('0xb');this[_0x5418('0xc')]=_0x3287b4[_0x5418('0xc')]?_0x3287b4[_0x5418('0xc')]:undefined;this[_0x5418('0xd')]=_0x3287b4[_0x5418('0xd')];this[_0x5418('0xe')]=_0x3287b4[_0x5418('0xe')];}module['exports']=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index e336f3d..99c1b28 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 _0x4a01=['serverUrl','Configurations','exports','name','remoteUri'];(function(_0x2aaeb1,_0x36c444){var _0x928a7a=function(_0x478c92){while(--_0x478c92){_0x2aaeb1['push'](_0x2aaeb1['shift']());}};_0x928a7a(++_0x36c444);}(_0x4a01,0x120));var _0x14a0=function(_0x2d6153,_0x59ba9a){_0x2d6153=_0x2d6153-0x0;var _0x50a3bf=_0x4a01[_0x2d6153];return _0x50a3bf;};'use strict';function FreshdeskAccount(_0x31d1c3){this['id']=_0x31d1c3['id']||0x0;this[_0x14a0('0x0')]=_0x31d1c3[_0x14a0('0x0')]||'';this['username']=_0x31d1c3['username']||'';this['apiKey']=_0x31d1c3['token']||'';this[_0x14a0('0x1')]=_0x31d1c3['remoteUri']||'';this[_0x14a0('0x2')]=_0x31d1c3[_0x14a0('0x2')]||'';this[_0x14a0('0x3')]=_0x31d1c3[_0x14a0('0x3')]||{};}module[_0x14a0('0x4')]=FreshdeskAccount; \ No newline at end of file +var _0xfab2=['Configurations','exports','name','username','apiKey','remoteUri'];(function(_0x22441e,_0x312dbb){var _0x4e25c3=function(_0x146cd5){while(--_0x146cd5){_0x22441e['push'](_0x22441e['shift']());}};_0x4e25c3(++_0x312dbb);}(_0xfab2,0xc2));var _0x2fab=function(_0x410f13,_0x5ddd0d){_0x410f13=_0x410f13-0x0;var _0x15e8b4=_0xfab2[_0x410f13];return _0x15e8b4;};'use strict';function FreshdeskAccount(_0x440451){this['id']=_0x440451['id']||0x0;this[_0x2fab('0x0')]=_0x440451[_0x2fab('0x0')]||'';this['username']=_0x440451[_0x2fab('0x1')]||'';this[_0x2fab('0x2')]=_0x440451['token']||'';this[_0x2fab('0x3')]=_0x440451['remoteUri']||'';this['serverUrl']=_0x440451['serverUrl']||'';this[_0x2fab('0x4')]=_0x440451['Configurations']||{};}module[_0x2fab('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 f46fdfc..533b1c2 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 _0x3f1c=['serverUrl','Configurations','username','token','remoteUri'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x3f1c,0xd4));var _0xc3f1=function(_0x2b3590,_0x54abbd){_0x2b3590=_0x2b3590-0x0;var _0x3e5c80=_0x3f1c[_0x2b3590];return _0x3e5c80;};'use strict';function FreshsalesAccount(_0x550aef){this['id']=_0x550aef['id']||0x0;this['name']=_0x550aef['name']||'';this[_0xc3f1('0x0')]=_0x550aef['username']||'';this['apiKey']=_0x550aef[_0xc3f1('0x1')]||'';this[_0xc3f1('0x2')]=_0x550aef[_0xc3f1('0x2')]||'';this[_0xc3f1('0x3')]=_0x550aef[_0xc3f1('0x3')]||'';this['Configurations']=_0x550aef[_0xc3f1('0x4')]||{};}module['exports']=FreshsalesAccount; \ No newline at end of file +var _0x5c1f=['token','remoteUri','Configurations','name','username','apiKey'];(function(_0x126343,_0x107253){var _0x25f787=function(_0x2c4f97){while(--_0x2c4f97){_0x126343['push'](_0x126343['shift']());}};_0x25f787(++_0x107253);}(_0x5c1f,0x1b3));var _0xf5c1=function(_0x7b173,_0x539d7f){_0x7b173=_0x7b173-0x0;var _0x1c598c=_0x5c1f[_0x7b173];return _0x1c598c;};'use strict';function FreshsalesAccount(_0x132bf7){this['id']=_0x132bf7['id']||0x0;this['name']=_0x132bf7[_0xf5c1('0x0')]||'';this[_0xf5c1('0x1')]=_0x132bf7['username']||'';this[_0xf5c1('0x2')]=_0x132bf7[_0xf5c1('0x3')]||'';this[_0xf5c1('0x4')]=_0x132bf7['remoteUri']||'';this['serverUrl']=_0x132bf7['serverUrl']||'';this[_0xf5c1('0x5')]=_0x132bf7[_0xf5c1('0x5')]||{};}module['exports']=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 8a6b290..0c3f549 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 _0xcea7=['originalposition','connectedlinenum','connectedlinename','accountcode','context','exten','priority','holdtime','assigned','motionChannel','voice','exports','type','inbound','uniqueid','calleridnum','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallercompleteAt','queuecallerexit','queuecallerexitAt'];(function(_0x45ee3f,_0x1141b5){var _0x171e84=function(_0x1c9fe4){while(--_0x1c9fe4){_0x45ee3f['push'](_0x45ee3f['shift']());}};_0x171e84(++_0x1141b5);}(_0xcea7,0x106));var _0x7cea=function(_0x338cbe,_0x33caa4){_0x338cbe=_0x338cbe-0x0;var _0x3fe363=_0xcea7[_0x338cbe];return _0x3fe363;};'use strict';function QueueReport(){this[_0x7cea('0x0')]=_0x7cea('0x1');this[_0x7cea('0x2')]='';this[_0x7cea('0x3')]='';this['calleridname']='';this[_0x7cea('0x4')]='';this[_0x7cea('0x5')]=null;this[_0x7cea('0x6')]=null;this[_0x7cea('0x7')]=0x1;this[_0x7cea('0x8')]=0x1;this[_0x7cea('0x9')]=![];this['queuecallerabandonAt']=null;this['queuecallercomplete']=![];this[_0x7cea('0xa')]=null;this[_0x7cea('0xb')]=![];this[_0x7cea('0xc')]=null;this[_0x7cea('0xd')]=0x1;this['channel']='';this[_0x7cea('0xe')]='';this[_0x7cea('0xf')]='';this[_0x7cea('0x10')]='';this[_0x7cea('0x11')]='';this[_0x7cea('0x12')]='';this[_0x7cea('0x13')]='';this[_0x7cea('0x14')]=0x0;this[_0x7cea('0x15')]=![];this['lastAssignedTo']='';this[_0x7cea('0x16')]=_0x7cea('0x17');this['mohtime']=0x0;this['variables']={};}module[_0x7cea('0x18')]=QueueReport; \ No newline at end of file +var _0xe5b3=['variables','exports','type','calleridnum','calleridname','queuecallerjoinAt','queuecallerleaveAt','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinenum','connectedlinename','accountcode','context','exten','priority','holdtime','assigned','lastAssignedTo','motionChannel'];(function(_0x5c06d9,_0xd4c6a9){var _0x4e5809=function(_0x11ff37){while(--_0x11ff37){_0x5c06d9['push'](_0x5c06d9['shift']());}};_0x4e5809(++_0xd4c6a9);}(_0xe5b3,0x66));var _0x3e5b=function(_0x364700,_0x41afa7){_0x364700=_0x364700-0x0;var _0xa03885=_0xe5b3[_0x364700];return _0xa03885;};'use strict';function QueueReport(){this[_0x3e5b('0x0')]='inbound';this['uniqueid']='';this[_0x3e5b('0x1')]='';this[_0x3e5b('0x2')]='';this['queue']='';this[_0x3e5b('0x3')]=null;this[_0x3e5b('0x4')]=null;this['position']=0x1;this['count']=0x1;this[_0x3e5b('0x5')]=![];this[_0x3e5b('0x6')]=null;this[_0x3e5b('0x7')]=![];this[_0x3e5b('0x8')]=null;this[_0x3e5b('0x9')]=![];this[_0x3e5b('0xa')]=null;this[_0x3e5b('0xb')]=0x1;this[_0x3e5b('0xc')]='';this[_0x3e5b('0xd')]='';this[_0x3e5b('0xe')]='';this[_0x3e5b('0xf')]='';this[_0x3e5b('0x10')]='';this[_0x3e5b('0x11')]='';this[_0x3e5b('0x12')]='';this[_0x3e5b('0x13')]=0x0;this[_0x3e5b('0x14')]=![];this[_0x3e5b('0x15')]='';this[_0x3e5b('0x16')]='voice';this['mohtime']=0x0;this[_0x3e5b('0x17')]={};}module[_0x3e5b('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 7da1b1a..58bdb8c 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 _0xbfb9=['type','integrationTab','serverUrl','Configurations','exports','name','username','remoteUri','password','clientId','clientSecret'];(function(_0x211c0b,_0x138da8){var _0x427d32=function(_0x351623){while(--_0x351623){_0x211c0b['push'](_0x211c0b['shift']());}};_0x427d32(++_0x138da8);}(_0xbfb9,0x144));var _0x9bfb=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xbfb9[_0x17d9e3];return _0x14192d;};'use strict';function SalesforceAccount(_0x262243){this['id']=_0x262243['id']||0x0;this[_0x9bfb('0x0')]=_0x262243[_0x9bfb('0x0')]||'';this[_0x9bfb('0x1')]=_0x262243[_0x9bfb('0x1')]||'';this[_0x9bfb('0x2')]=_0x262243[_0x9bfb('0x2')]||'';this[_0x9bfb('0x3')]=_0x262243[_0x9bfb('0x3')]||'';this[_0x9bfb('0x4')]=_0x262243['clientId']||'';this[_0x9bfb('0x5')]=_0x262243[_0x9bfb('0x5')]||'';this['securityToken']=_0x262243['securityToken']||'';this[_0x9bfb('0x6')]=_0x262243[_0x9bfb('0x6')]||_0x9bfb('0x7');this[_0x9bfb('0x8')]=_0x262243['serverUrl']||'';this[_0x9bfb('0x9')]=_0x262243['Configurations']||{};}module[_0x9bfb('0xa')]=SalesforceAccount; \ No newline at end of file +var _0xb714=['type','serverUrl','Configurations','exports','name','username','remoteUri','password','clientId','clientSecret','securityToken'];(function(_0x562e05,_0x46e6e7){var _0x71b23a=function(_0x229ec7){while(--_0x229ec7){_0x562e05['push'](_0x562e05['shift']());}};_0x71b23a(++_0x46e6e7);}(_0xb714,0xa9));var _0x4b71=function(_0x4b26b5,_0x4f71fd){_0x4b26b5=_0x4b26b5-0x0;var _0x4dec71=_0xb714[_0x4b26b5];return _0x4dec71;};'use strict';function SalesforceAccount(_0x3b7aa3){this['id']=_0x3b7aa3['id']||0x0;this[_0x4b71('0x0')]=_0x3b7aa3[_0x4b71('0x0')]||'';this[_0x4b71('0x1')]=_0x3b7aa3[_0x4b71('0x1')]||'';this['remoteUri']=_0x3b7aa3[_0x4b71('0x2')]||'';this[_0x4b71('0x3')]=_0x3b7aa3[_0x4b71('0x3')]||'';this[_0x4b71('0x4')]=_0x3b7aa3[_0x4b71('0x4')]||'';this[_0x4b71('0x5')]=_0x3b7aa3[_0x4b71('0x5')]||'';this[_0x4b71('0x6')]=_0x3b7aa3[_0x4b71('0x6')]||'';this[_0x4b71('0x7')]=_0x3b7aa3[_0x4b71('0x7')]||'integrationTab';this[_0x4b71('0x8')]=_0x3b7aa3[_0x4b71('0x8')]||'';this['Configurations']=_0x3b7aa3[_0x4b71('0x9')]||{};}module[_0x4b71('0xa')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index da76734..2de5047 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 _0xa62c=['name','username','password','remoteUri','serverUrl','Configurations','exports'];(function(_0x3711e2,_0x1468e1){var _0x18a556=function(_0x5e0923){while(--_0x5e0923){_0x3711e2['push'](_0x3711e2['shift']());}};_0x18a556(++_0x1468e1);}(_0xa62c,0x1ce));var _0xca62=function(_0x67f95e,_0x3ca797){_0x67f95e=_0x67f95e-0x0;var _0x538f5a=_0xa62c[_0x67f95e];return _0x538f5a;};'use strict';function ServicenowAccount(_0x378f3f){this['id']=_0x378f3f['id']||0x0;this[_0xca62('0x0')]=_0x378f3f[_0xca62('0x0')]||'';this[_0xca62('0x1')]=_0x378f3f['username']||'';this[_0xca62('0x2')]=_0x378f3f[_0xca62('0x2')]||'';this[_0xca62('0x3')]=_0x378f3f['remoteUri']||'';this['serverUrl']=_0x378f3f[_0xca62('0x4')]||'';this[_0xca62('0x5')]=_0x378f3f[_0xca62('0x5')]||{};}module[_0xca62('0x6')]=ServicenowAccount; \ No newline at end of file +var _0xb250=['remoteUri','serverUrl','Configurations','exports','username','password'];(function(_0x25e296,_0x172c5e){var _0x3cd140=function(_0x2e82c1){while(--_0x2e82c1){_0x25e296['push'](_0x25e296['shift']());}};_0x3cd140(++_0x172c5e);}(_0xb250,0x184));var _0x0b25=function(_0xf33a86,_0x697e07){_0xf33a86=_0xf33a86-0x0;var _0x5cd600=_0xb250[_0xf33a86];return _0x5cd600;};'use strict';function ServicenowAccount(_0x2a874f){this['id']=_0x2a874f['id']||0x0;this['name']=_0x2a874f['name']||'';this['username']=_0x2a874f[_0x0b25('0x0')]||'';this[_0x0b25('0x1')]=_0x2a874f['password']||'';this['remoteUri']=_0x2a874f[_0x0b25('0x2')]||'';this[_0x0b25('0x3')]=_0x2a874f[_0x0b25('0x3')]||'';this[_0x0b25('0x4')]=_0x2a874f[_0x0b25('0x4')]||{};}module[_0x0b25('0x5')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index f1504e5..cd8bf30 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 _0x1503=['password','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x2efab2,_0x3d77c5){var _0x3a84d6=function(_0x1f4cd2){while(--_0x1f4cd2){_0x2efab2['push'](_0x2efab2['shift']());}};_0x3a84d6(++_0x3d77c5);}(_0x1503,0x15c));var _0x3150=function(_0xb2ea99,_0x1638e0){_0xb2ea99=_0xb2ea99-0x0;var _0x4901c9=_0x1503[_0xb2ea99];return _0x4901c9;};'use strict';function SugarcrmAccount(_0x453615){this['id']=_0x453615['id']||0x0;this[_0x3150('0x0')]=_0x453615[_0x3150('0x0')]||'';this[_0x3150('0x1')]=_0x453615[_0x3150('0x1')]||'';this[_0x3150('0x2')]=_0x453615[_0x3150('0x2')]||'';this[_0x3150('0x3')]=_0x453615[_0x3150('0x3')]||'';this[_0x3150('0x4')]=_0x453615[_0x3150('0x4')]||'';this['Configurations']=_0x453615[_0x3150('0x5')]||{};}module[_0x3150('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0x7b1b=['remoteUri','name','username','password'];(function(_0x42d645,_0x56690c){var _0x21f68f=function(_0x30bddc){while(--_0x30bddc){_0x42d645['push'](_0x42d645['shift']());}};_0x21f68f(++_0x56690c);}(_0x7b1b,0xa1));var _0xb7b1=function(_0x5b9929,_0x94393c){_0x5b9929=_0x5b9929-0x0;var _0x13cf5b=_0x7b1b[_0x5b9929];return _0x13cf5b;};'use strict';function SugarcrmAccount(_0x533d9a){this['id']=_0x533d9a['id']||0x0;this['name']=_0x533d9a[_0xb7b1('0x0')]||'';this['username']=_0x533d9a[_0xb7b1('0x1')]||'';this['password']=_0x533d9a[_0xb7b1('0x2')]||'';this['remoteUri']=_0x533d9a[_0xb7b1('0x3')]||'';this['serverUrl']=_0x533d9a['serverUrl']||'';this['Configurations']=_0x533d9a['Configurations']||{};}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 09aa68a..de9ad20 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 _0x9d11=['address','name','accountcode','state','unknown','stateTime','status'];(function(_0x5c4585,_0x3d0eab){var _0x21dede=function(_0x5c3d6a){while(--_0x5c3d6a){_0x5c4585['push'](_0x5c4585['shift']());}};_0x21dede(++_0x3d0eab);}(_0x9d11,0xb7));var _0x19d1=function(_0x3c97e3,_0x321677){_0x3c97e3=_0x3c97e3-0x0;var _0x9bb0ed=_0x9d11[_0x3c97e3];return _0x9bb0ed;};'use strict';function Telephone(_0x3c8f66){this['id']=_0x3c8f66['id']||0x0;this[_0x19d1('0x0')]=_0x3c8f66[_0x19d1('0x0')]||'';this[_0x19d1('0x1')]=_0x3c8f66['accountcode']||'';this[_0x19d1('0x2')]=_0x19d1('0x3');this[_0x19d1('0x4')]=0x0;this[_0x19d1('0x5')]=_0x19d1('0x3');this[_0x19d1('0x6')]='';}module['exports']=Telephone; \ No newline at end of file +var _0xbefe=['stateTime','status','address','name','accountcode','state','unknown'];(function(_0x35bd9e,_0xdc8d04){var _0x416dd4=function(_0x5b5b5f){while(--_0x5b5b5f){_0x35bd9e['push'](_0x35bd9e['shift']());}};_0x416dd4(++_0xdc8d04);}(_0xbefe,0x168));var _0xebef=function(_0x4ca288,_0x254dd8){_0x4ca288=_0x4ca288-0x0;var _0x2362c1=_0xbefe[_0x4ca288];return _0x2362c1;};'use strict';function Telephone(_0x23f1ba){this['id']=_0x23f1ba['id']||0x0;this[_0xebef('0x0')]=_0x23f1ba['name']||'';this[_0xebef('0x1')]=_0x23f1ba[_0xebef('0x1')]||'';this[_0xebef('0x2')]=_0xebef('0x3');this[_0xebef('0x4')]=0x0;this[_0xebef('0x5')]=_0xebef('0x3');this[_0xebef('0x6')]='';}module['exports']=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 845a82b..48bce97 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(_0x1984bb,_0x3126db){var _0x820f6c=function(_0x351374){while(--_0x351374){_0x1984bb['push'](_0x1984bb['shift']());}};_0x820f6c(++_0x3126db);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file +var _0xb10b=['name','html'];(function(_0x536df4,_0x1edba2){var _0x554065=function(_0x3f6945){while(--_0x3f6945){_0x536df4['push'](_0x536df4['shift']());}};_0x554065(++_0x1edba2);}(_0xb10b,0x12a));var _0xbb10=function(_0x6bb814,_0x17196b){_0x6bb814=_0x6bb814-0x0;var _0x3c4bf6=_0xb10b[_0x6bb814];return _0x3c4bf6;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index a93892e..2f31d8e 100644 --- a/server/services/ami/model/trigger.js +++ b/server/services/ami/model/trigger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8603=['exports','name','channel','status','AllConditions','AnyConditions','Actions'];(function(_0x101403,_0x43fe59){var _0x28e4f8=function(_0x27a4d3){while(--_0x27a4d3){_0x101403['push'](_0x101403['shift']());}};_0x28e4f8(++_0x43fe59);}(_0x8603,0x190));var _0x3860=function(_0x53ae66,_0x4d00fc){_0x53ae66=_0x53ae66-0x0;var _0x446592=_0x8603[_0x53ae66];return _0x446592;};'use strict';function Trigger(_0xba4b79){this['id']=_0xba4b79['id']||0x0;this[_0x3860('0x0')]=_0xba4b79[_0x3860('0x0')]||'';this[_0x3860('0x1')]=_0xba4b79['channel']||'voice';this[_0x3860('0x2')]=_0xba4b79[_0x3860('0x2')]||![];this[_0x3860('0x3')]=_0xba4b79['AllConditions']||[];this[_0x3860('0x4')]=_0xba4b79['AnyConditions']||[];this[_0x3860('0x5')]=_0xba4b79[_0x3860('0x5')]||[];}module[_0x3860('0x6')]=Trigger; \ No newline at end of file +var _0x757a=['name','status','AllConditions','AnyConditions','Actions','exports'];(function(_0x11334c,_0x3683d9){var _0x11bc1c=function(_0x2de5a8){while(--_0x2de5a8){_0x11334c['push'](_0x11334c['shift']());}};_0x11bc1c(++_0x3683d9);}(_0x757a,0xde));var _0xa757=function(_0x39fc92,_0x11c70d){_0x39fc92=_0x39fc92-0x0;var _0x58926e=_0x757a[_0x39fc92];return _0x58926e;};'use strict';function Trigger(_0x1acf7d){this['id']=_0x1acf7d['id']||0x0;this[_0xa757('0x0')]=_0x1acf7d[_0xa757('0x0')]||'';this['channel']=_0x1acf7d['channel']||'voice';this[_0xa757('0x1')]=_0x1acf7d[_0xa757('0x1')]||![];this[_0xa757('0x2')]=_0x1acf7d[_0xa757('0x2')]||[];this[_0xa757('0x3')]=_0x1acf7d[_0xa757('0x3')]||[];this['Actions']=_0x1acf7d[_0xa757('0x4')]||[];}module[_0xa757('0x5')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 6bb7a94..ec072ff 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 _0x8869=['active','name','state','status','unknown','registry','split','host','port','domain','domainport','refresh','stateRegistry','registrationtime','address','defaultuser','exports'];(function(_0x451402,_0x561cb8){var _0x4ffb7f=function(_0x1c263a){while(--_0x1c263a){_0x451402['push'](_0x451402['shift']());}};_0x4ffb7f(++_0x561cb8);}(_0x8869,0x1a9));var _0x9886=function(_0x3021ec,_0x20adec){_0x3021ec=_0x3021ec-0x0;var _0x482ad7=_0x8869[_0x3021ec];return _0x482ad7;};'use strict';function Trunk(_0x1190c7){this['id']=_0x1190c7['id']||0x0;this['active']=_0x1190c7[_0x9886('0x0')]||![];this[_0x9886('0x1')]=_0x1190c7[_0x9886('0x1')]||'';this[_0x9886('0x2')]='unknown';this['stateTime']=0x0;this[_0x9886('0x3')]=_0x9886('0x4');this[_0x9886('0x5')]=_0x1190c7[_0x9886('0x5')]&&_0x1190c7[_0x9886('0x5')]['indexOf'](':')?_0x1190c7[_0x9886('0x5')][_0x9886('0x6')](':')[0x0]:'';this[_0x9886('0x7')]='';this[_0x9886('0x8')]='';this[_0x9886('0x9')]='';this[_0x9886('0xa')]='';this[_0x9886('0xb')]='';this[_0x9886('0xc')]=_0x9886('0x4');this[_0x9886('0xd')]='';this[_0x9886('0xe')]='';this[_0x9886('0xf')]=_0x1190c7[_0x9886('0xf')]||'';}module[_0x9886('0x10')]=Trunk; \ No newline at end of file +var _0x0423=['unknown','registry','indexOf','split','host','domainport','refresh','stateRegistry','registrationtime','defaultuser','active','name','state','status'];(function(_0x17e693,_0xbd6390){var _0x308abe=function(_0x5f4575){while(--_0x5f4575){_0x17e693['push'](_0x17e693['shift']());}};_0x308abe(++_0xbd6390);}(_0x0423,0xa4));var _0x3042=function(_0x5b3419,_0x4a6b92){_0x5b3419=_0x5b3419-0x0;var _0x497277=_0x0423[_0x5b3419];return _0x497277;};'use strict';function Trunk(_0x926b24){this['id']=_0x926b24['id']||0x0;this[_0x3042('0x0')]=_0x926b24[_0x3042('0x0')]||![];this[_0x3042('0x1')]=_0x926b24[_0x3042('0x1')]||'';this[_0x3042('0x2')]='unknown';this['stateTime']=0x0;this[_0x3042('0x3')]=_0x3042('0x4');this[_0x3042('0x5')]=_0x926b24[_0x3042('0x5')]&&_0x926b24[_0x3042('0x5')][_0x3042('0x6')](':')?_0x926b24[_0x3042('0x5')][_0x3042('0x7')](':')[0x0]:'';this[_0x3042('0x8')]='';this['port']='';this['domain']='';this[_0x3042('0x9')]='';this[_0x3042('0xa')]='';this[_0x3042('0xb')]=_0x3042('0x4');this[_0x3042('0xc')]='';this['address']='';this[_0x3042('0xd')]=_0x926b24[_0x3042('0xd')]||'';}module['exports']=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index a0326f5..5c56d70 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 _0x0161=['none','mandatoryDisposition','exports','recordingFormat'];(function(_0x52308f,_0x78d497){var _0x56dfbf=function(_0x166c4c){while(--_0x166c4c){_0x52308f['push'](_0x52308f['shift']());}};_0x56dfbf(++_0x78d497);}(_0x0161,0x183));var _0x1016=function(_0x155c6a,_0x21c3c1){_0x155c6a=_0x155c6a-0x0;var _0x15db5e=_0x0161[_0x155c6a];return _0x15db5e;};'use strict';function voiceExtension(_0xabe9fa){this['id']=_0xabe9fa['id']||0x0;this['exten']=_0xabe9fa['exten']||'';this[_0x1016('0x0')]=_0xabe9fa[_0x1016('0x0')]||_0x1016('0x1');this[_0x1016('0x2')]=_0xabe9fa[_0x1016('0x2')]||![];}module[_0x1016('0x3')]=voiceExtension; \ No newline at end of file +var _0x7db2=['mandatoryDisposition','exports','exten','recordingFormat','none'];(function(_0x44f66c,_0x2a7a38){var _0x56d3f2=function(_0x5d90a2){while(--_0x5d90a2){_0x44f66c['push'](_0x44f66c['shift']());}};_0x56d3f2(++_0x2a7a38);}(_0x7db2,0x75));var _0x27db=function(_0x3b2646,_0x1dd8fa){_0x3b2646=_0x3b2646-0x0;var _0x1c8eeb=_0x7db2[_0x3b2646];return _0x1c8eeb;};'use strict';function voiceExtension(_0x4c2eaa){this['id']=_0x4c2eaa['id']||0x0;this[_0x27db('0x0')]=_0x4c2eaa[_0x27db('0x0')]||'';this[_0x27db('0x1')]=_0x4c2eaa[_0x27db('0x1')]||_0x27db('0x2');this[_0x27db('0x3')]=_0x4c2eaa[_0x27db('0x3')]||![];}module[_0x27db('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 8a95a82..d193730 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 _0xbe7b=['dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundReCallsDay','outboundAbandonedDay','startProgressive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','unknown','not_inuse','inuse','busy','invalid','unavailable','ringing','onhold','wav','rrmemory','roundrobin','name','monitor_format','type','inbound','waiting','talking','total','answered','sumDuration','unmanaged','loggedIn','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','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold'];(function(_0xe15c57,_0x46934c){var _0x1e84df=function(_0x3b88bd){while(--_0x3b88bd){_0xe15c57['push'](_0xe15c57['shift']());}};_0x1e84df(++_0x46934c);}(_0xbe7b,0xa1));var _0xbbe7=function(_0x18bd2a,_0x3f93f0){_0x18bd2a=_0x18bd2a-0x0;var _0x546f18=_0xbe7b[_0x18bd2a];return _0x546f18;};'use strict';var statusDesc=[_0xbbe7('0x0'),_0xbbe7('0x1'),_0xbbe7('0x2'),_0xbbe7('0x3'),_0xbbe7('0x4'),_0xbbe7('0x5'),_0xbbe7('0x6'),'ringinuse',_0xbbe7('0x7')];var monitorFormat={'wav':_0xbbe7('0x8'),'wav49':'wav49','gsm':'gsm'};var strategy={'rrmemory':_0xbbe7('0x9'),'roundrobin':_0xbbe7('0xa')};function VoiceQueue(_0x4f0c57){this['id']=_0x4f0c57['id']||0x0;this['name']=_0x4f0c57[_0xbbe7('0xb')]||'';this[_0xbbe7('0xc')]=_0x4f0c57['monitor_format']||'';this[_0xbbe7('0xd')]=_0x4f0c57['type']||_0xbbe7('0xe');this[_0xbbe7('0xf')]=0x0;this[_0xbbe7('0x10')]=0x0;this[_0xbbe7('0x11')]=0x0;this[_0xbbe7('0x12')]=0x0;this[_0xbbe7('0x13')]=0x0;this['sumHoldTime']=0x0;this['sumBillable']=0x0;this[_0xbbe7('0x14')]=0x0;this['abandoned']=0x0;this[_0xbbe7('0x15')]=0x0;this[_0xbbe7('0x16')]=0x0;this['acw']=_0x4f0c57[_0xbbe7('0x17')]||![];this[_0xbbe7('0x18')]=_0x4f0c57[_0xbbe7('0x18')]||0xa;this[_0xbbe7('0x19')]=_0x4f0c57[_0xbbe7('0x19')]||'no';this[_0xbbe7('0x1a')]=!![];this[_0xbbe7('0x1b')]='';this[_0xbbe7('0x1c')]=0x0;this[_0xbbe7('0x1d')]=0x0;this[_0xbbe7('0x1e')]=_0x4f0c57[_0xbbe7('0x1e')]||null;this[_0xbbe7('0x1f')]=_0x4f0c57[_0xbbe7('0x1f')]?_0x4f0c57[_0xbbe7('0x1f')]:null;this[_0xbbe7('0x20')]=_0x4f0c57[_0xbbe7('0x20')];this[_0xbbe7('0x21')]=_0x4f0c57[_0xbbe7('0x21')]||_0xbbe7('0x22');this[_0xbbe7('0x23')]=_0x4f0c57[_0xbbe7('0x23')]||0x0;this[_0xbbe7('0x24')]=_0x4f0c57[_0xbbe7('0x24')]||0x0;this[_0xbbe7('0x25')]=_0x4f0c57[_0xbbe7('0x25')]||0x1;this[_0xbbe7('0x26')]=_0x4f0c57[_0xbbe7('0x26')]||_0xbbe7('0x27');this[_0xbbe7('0x28')]=_0x4f0c57[_0xbbe7('0x28')]||0.03;this['dialPredictiveInterval']=_0x4f0c57[_0xbbe7('0x29')]||0x258;this[_0xbbe7('0x2a')]=_0x4f0c57['dialOriginateCallerIdName']||_0xbbe7('0x2b');this[_0xbbe7('0x2c')]=_0x4f0c57[_0xbbe7('0x2c')]||_0xbbe7('0x2b');this[_0xbbe7('0x2d')]=_0x4f0c57['dialOriginateTimeout']||0x1e;this[_0xbbe7('0x2e')]=_0x4f0c57[_0xbbe7('0x2e')]||_0xbbe7('0x2f');this[_0xbbe7('0x30')]=_0x4f0c57[_0xbbe7('0x30')]||0x3;this[_0xbbe7('0x31')]=_0x4f0c57[_0xbbe7('0x31')]||undefined;this['dialCongestionMaxRetry']=_0x4f0c57[_0xbbe7('0x32')]||0x3;this[_0xbbe7('0x33')]=_0x4f0c57[_0xbbe7('0x33')]||0x96;this[_0xbbe7('0x34')]=_0x4f0c57[_0xbbe7('0x34')]||0x3;this[_0xbbe7('0x35')]=_0x4f0c57[_0xbbe7('0x35')]||0x96;this[_0xbbe7('0x36')]=_0x4f0c57['dialNoAnswerMaxRetry']||0x3;this[_0xbbe7('0x37')]=_0x4f0c57[_0xbbe7('0x37')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x4f0c57['dialNoSuchNumberMaxRetry']||0x3;this[_0xbbe7('0x38')]=_0x4f0c57['dialNoSuchNumberRetryFrequency']||0x96;this[_0xbbe7('0x39')]=_0x4f0c57[_0xbbe7('0x39')]||0x3;this[_0xbbe7('0x3a')]=_0x4f0c57['dialDropRetryFrequency']||0x96;this[_0xbbe7('0x3b')]=_0x4f0c57[_0xbbe7('0x3b')]||0x3;this[_0xbbe7('0x3c')]=_0x4f0c57[_0xbbe7('0x3c')]||0x96;this[_0xbbe7('0x3d')]=_0x4f0c57[_0xbbe7('0x3d')]||0x3;this[_0xbbe7('0x3e')]=_0x4f0c57['dialMachineRetryFrequency']||0x96;this[_0xbbe7('0x3f')]=_0x4f0c57[_0xbbe7('0x3f')]||0x3;this[_0xbbe7('0x40')]=_0x4f0c57['dialAgentRejectRetryFrequency']||0x96;this['callAdditionalPhoneAfterMin']=_0x4f0c57[_0xbbe7('0x41')]||0x3;this['dialGlobalMaxRetry']=_0x4f0c57[_0xbbe7('0x42')]||0x4;this[_0xbbe7('0x43')]=_0x4f0c57['Trunk']?_0x4f0c57[_0xbbe7('0x43')]:undefined;this['TrunkBackup']=_0x4f0c57[_0xbbe7('0x44')]?_0x4f0c57[_0xbbe7('0x44')]:undefined;this[_0xbbe7('0x45')]=_0x4f0c57[_0xbbe7('0x45')]||undefined;this['Interval']=_0x4f0c57['Interval']?_0x4f0c57[_0xbbe7('0x46')]:undefined;this['dialOrderByScheduledAt']=_0x4f0c57[_0xbbe7('0x47')]||_0xbbe7('0x48');this['dialRandomLastDigitCallerIdNumber']=_0x4f0c57[_0xbbe7('0x49')]||undefined;this['dialCutDigit']=_0x4f0c57[_0xbbe7('0x4a')]||undefined;this[_0xbbe7('0x4b')]=strategy[_0x4f0c57['strategy']]||_0xbbe7('0x9');this[_0xbbe7('0x4c')]=!![];this[_0xbbe7('0x4d')]=_0x4f0c57[_0xbbe7('0x4d')]||![];this[_0xbbe7('0x4e')]=_0x4f0c57[_0xbbe7('0x4e')];this[_0xbbe7('0x4f')]=_0x4f0c57['dialAMDGreeting'];this[_0xbbe7('0x50')]=_0x4f0c57[_0xbbe7('0x50')];this['dialAMDTotalAnalysisTime']=_0x4f0c57[_0xbbe7('0x51')];this['dialAMDMinWordLength']=_0x4f0c57[_0xbbe7('0x52')];this[_0xbbe7('0x53')]=_0x4f0c57[_0xbbe7('0x53')];this['dialAMDMaximumNumberOfWords']=_0x4f0c57['dialAMDMaximumNumberOfWords'];this[_0xbbe7('0x54')]=_0x4f0c57[_0xbbe7('0x54')];this[_0xbbe7('0x55')]=_0x4f0c57[_0xbbe7('0x55')];this[_0xbbe7('0x56')]=0x0;this[_0xbbe7('0x57')]=0x0;this[_0xbbe7('0x58')]=_0x4f0c57[_0xbbe7('0x58')];this['outboundAnswerCallsDay']=0x0;this['outboundAnswerAgiCallsDay']=0x0;this[_0xbbe7('0x59')]=0x0;this[_0xbbe7('0x5a')]=0x0;this[_0xbbe7('0x5b')]=0x0;this[_0xbbe7('0x5c')]=0x0;this[_0xbbe7('0x5d')]=0x0;this[_0xbbe7('0x5e')]=0x0;this['outboundOriginateFailureCallsDay']=0x0;this[_0xbbe7('0x5f')]=0x0;this[_0xbbe7('0x60')]=0x0;this['outboundDropCallsDayACS']=0x0;this[_0xbbe7('0x61')]=0x0;this[_0xbbe7('0x62')]=0x0;this[_0xbbe7('0x63')]=undefined;this['startPredictive']=undefined;this['handlePredictive']=undefined;this[_0xbbe7('0x64')]=1.05;this[_0xbbe7('0x65')]=0x0;this[_0xbbe7('0x66')]=0x0;this[_0xbbe7('0x67')]=0x0;this[_0xbbe7('0x68')]=0x0;this[_0xbbe7('0x69')]=0x0;this[_0xbbe7('0x6a')]=0x0;this['predictiveIntervalPauses']=0x0;this['predictiveIntervalAvailable']=0x0;this[_0xbbe7('0x6b')]=_0x4f0c57[_0xbbe7('0x6c')]||0x14;this[_0xbbe7('0x6d')]=_0x4f0c57[_0xbbe7('0x6c')]||0xa;this[_0xbbe7('0x6e')]=0x0;this[_0xbbe7('0x6f')]=0x0;this['predictiveIntervalHitRate']=0x1;this['erlangCalls']=0x0;this['erlangCallToSecond']=0x0;this[_0xbbe7('0x70')]=0x0;this[_0xbbe7('0x71')]=0x0;this['dialRecallMeTimeout']=_0x4f0c57[_0xbbe7('0x72')]||0x1e;this[_0xbbe7('0x73')]=_0x4f0c57[_0xbbe7('0x73')]||![];this['dialPreviewAutoRecallMe']=!!_0x4f0c57[_0xbbe7('0x74')]||![];this[_0xbbe7('0x75')]=!!_0x4f0c57[_0xbbe7('0x75')]||![];this['dialQueueProject2']=_0x4f0c57[_0xbbe7('0x76')]||undefined;this['dialAgiAfterHangupClient']=_0x4f0c57[_0xbbe7('0x77')]||![];this['dialAgiAfterHangupAgent']=_0x4f0c57[_0xbbe7('0x78')]||![];this['monitor_format']=monitorFormat[_0x4f0c57[_0xbbe7('0xc')]]?monitorFormat[_0x4f0c57['monitor_format']]:undefined;this[_0xbbe7('0x79')]=_0x4f0c57[_0xbbe7('0x79')]||![];this[_0xbbe7('0x7a')]=_0x4f0c57[_0xbbe7('0x7a')]?_0x4f0c57[_0xbbe7('0x7a')]:undefined;}module['exports']=VoiceQueue; \ No newline at end of file +var _0x94f4=['total','sumDuration','sumBillable','unmanaged','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','rrmemory','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','timeout','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayCallersExit','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','inuse','busy','invalid','unavailable','ringing','ringinuse','onhold','wav','gsm','roundrobin','name','monitor_format','type','inbound'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x94f4,0xe8));var _0x494f=function(_0x41fce3,_0x3f6c37){_0x41fce3=_0x41fce3-0x0;var _0x15058d=_0x94f4[_0x41fce3];return _0x15058d;};'use strict';var statusDesc=[_0x494f('0x0'),_0x494f('0x1'),_0x494f('0x2'),_0x494f('0x3'),_0x494f('0x4'),_0x494f('0x5'),_0x494f('0x6'),_0x494f('0x7'),_0x494f('0x8')];var monitorFormat={'wav':_0x494f('0x9'),'wav49':'wav49','gsm':_0x494f('0xa')};var strategy={'rrmemory':'rrmemory','roundrobin':_0x494f('0xb')};function VoiceQueue(_0x85e7ed){this['id']=_0x85e7ed['id']||0x0;this[_0x494f('0xc')]=_0x85e7ed[_0x494f('0xc')]||'';this['monitor_format']=_0x85e7ed[_0x494f('0xd')]||'';this[_0x494f('0xe')]=_0x85e7ed[_0x494f('0xe')]||_0x494f('0xf');this['waiting']=0x0;this['talking']=0x0;this[_0x494f('0x10')]=0x0;this['answered']=0x0;this[_0x494f('0x11')]=0x0;this['sumHoldTime']=0x0;this[_0x494f('0x12')]=0x0;this[_0x494f('0x13')]=0x0;this['abandoned']=0x0;this[_0x494f('0x14')]=0x0;this[_0x494f('0x15')]=0x0;this[_0x494f('0x16')]=_0x85e7ed[_0x494f('0x16')]||![];this[_0x494f('0x17')]=_0x85e7ed[_0x494f('0x17')]||0xa;this[_0x494f('0x18')]=_0x85e7ed[_0x494f('0x18')]||'no';this[_0x494f('0x19')]=!![];this[_0x494f('0x1a')]='';this[_0x494f('0x1b')]=0x0;this[_0x494f('0x1c')]=0x0;this[_0x494f('0x1d')]=_0x85e7ed[_0x494f('0x1d')]||null;this[_0x494f('0x1e')]=_0x85e7ed[_0x494f('0x1e')]?_0x85e7ed[_0x494f('0x1e')]:null;this[_0x494f('0x1f')]=_0x85e7ed[_0x494f('0x1f')];this[_0x494f('0x20')]=_0x85e7ed['dialMethod']||_0x494f('0x21');this[_0x494f('0x22')]=_0x85e7ed[_0x494f('0x22')]||0x0;this[_0x494f('0x23')]=_0x85e7ed['dialLimitQueue']||0x0;this[_0x494f('0x24')]=_0x85e7ed[_0x494f('0x24')]||0x1;this[_0x494f('0x25')]=_0x85e7ed[_0x494f('0x25')]||_0x494f('0x26');this[_0x494f('0x27')]=_0x85e7ed['dialPredictiveOptimizationPercentage']||0.03;this[_0x494f('0x28')]=_0x85e7ed['dialPredictiveInterval']||0x258;this['dialOriginateCallerIdName']=_0x85e7ed['dialOriginateCallerIdName']||_0x494f('0x29');this[_0x494f('0x2a')]=_0x85e7ed[_0x494f('0x2a')]||_0x494f('0x29');this[_0x494f('0x2b')]=_0x85e7ed[_0x494f('0x2b')]||0x1e;this['dialQueueOptions']=_0x85e7ed['dialQueueOptions']||_0x494f('0x2c');this['dialQueueTimeout']=_0x85e7ed[_0x494f('0x2d')]||0x3;this[_0x494f('0x2e')]=_0x85e7ed['dialQueueProject']||undefined;this[_0x494f('0x2f')]=_0x85e7ed[_0x494f('0x2f')]||0x3;this[_0x494f('0x30')]=_0x85e7ed[_0x494f('0x30')]||0x96;this[_0x494f('0x31')]=_0x85e7ed[_0x494f('0x31')]||0x3;this[_0x494f('0x32')]=_0x85e7ed[_0x494f('0x32')]||0x96;this[_0x494f('0x33')]=_0x85e7ed['dialNoAnswerMaxRetry']||0x3;this[_0x494f('0x34')]=_0x85e7ed[_0x494f('0x34')]||0x96;this[_0x494f('0x35')]=_0x85e7ed[_0x494f('0x35')]||0x3;this[_0x494f('0x36')]=_0x85e7ed[_0x494f('0x36')]||0x96;this[_0x494f('0x37')]=_0x85e7ed[_0x494f('0x37')]||0x3;this[_0x494f('0x38')]=_0x85e7ed[_0x494f('0x38')]||0x96;this[_0x494f('0x39')]=_0x85e7ed[_0x494f('0x39')]||0x3;this['dialAbandonedRetryFrequency']=_0x85e7ed[_0x494f('0x3a')]||0x96;this[_0x494f('0x3b')]=_0x85e7ed['dialMachineMaxRetry']||0x3;this[_0x494f('0x3c')]=_0x85e7ed[_0x494f('0x3c')]||0x96;this[_0x494f('0x3d')]=_0x85e7ed[_0x494f('0x3d')]||0x3;this[_0x494f('0x3e')]=_0x85e7ed[_0x494f('0x3e')]||0x96;this[_0x494f('0x3f')]=_0x85e7ed['callAdditionalPhoneAfterMin']||0x3;this[_0x494f('0x40')]=_0x85e7ed['dialGlobalMaxRetry']||0x4;this[_0x494f('0x41')]=_0x85e7ed[_0x494f('0x41')]?_0x85e7ed[_0x494f('0x41')]:undefined;this[_0x494f('0x42')]=_0x85e7ed[_0x494f('0x42')]?_0x85e7ed[_0x494f('0x42')]:undefined;this[_0x494f('0x43')]=_0x85e7ed[_0x494f('0x43')]||undefined;this[_0x494f('0x44')]=_0x85e7ed['Interval']?_0x85e7ed[_0x494f('0x44')]:undefined;this[_0x494f('0x45')]=_0x85e7ed[_0x494f('0x45')]||_0x494f('0x46');this[_0x494f('0x47')]=_0x85e7ed[_0x494f('0x47')]||undefined;this[_0x494f('0x48')]=_0x85e7ed[_0x494f('0x48')]||undefined;this['strategy']=strategy[_0x85e7ed['strategy']]||_0x494f('0x49');this[_0x494f('0x4a')]=!![];this[_0x494f('0x4b')]=_0x85e7ed['dialAMDActive']||![];this[_0x494f('0x4c')]=_0x85e7ed[_0x494f('0x4c')];this[_0x494f('0x4d')]=_0x85e7ed[_0x494f('0x4d')];this[_0x494f('0x4e')]=_0x85e7ed[_0x494f('0x4e')];this[_0x494f('0x4f')]=_0x85e7ed[_0x494f('0x4f')];this[_0x494f('0x50')]=_0x85e7ed[_0x494f('0x50')];this[_0x494f('0x51')]=_0x85e7ed[_0x494f('0x51')];this[_0x494f('0x52')]=_0x85e7ed[_0x494f('0x52')];this[_0x494f('0x53')]=_0x85e7ed[_0x494f('0x53')];this['dialAMDMaximumWordLength']=_0x85e7ed[_0x494f('0x54')];this[_0x494f('0x55')]=0x0;this['pTalking']=0x0;this[_0x494f('0x56')]=_0x85e7ed[_0x494f('0x56')];this['outboundAnswerCallsDay']=0x0;this[_0x494f('0x57')]=0x0;this[_0x494f('0x58')]=0x0;this[_0x494f('0x59')]=0x0;this[_0x494f('0x5a')]=0x0;this[_0x494f('0x5b')]=0x0;this[_0x494f('0x5c')]=0x0;this['outboundBlacklistCallsDay']=0x0;this['outboundOriginateFailureCallsDay']=0x0;this[_0x494f('0x5d')]=0x0;this['outboundDropCallsDayTimeout']=0x0;this['outboundDropCallsDayACS']=0x0;this[_0x494f('0x5e')]=0x0;this[_0x494f('0x5f')]=0x0;this[_0x494f('0x60')]=undefined;this[_0x494f('0x61')]=undefined;this['handlePredictive']=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this[_0x494f('0x62')]=0x0;this[_0x494f('0x63')]=0x0;this[_0x494f('0x64')]=0x0;this[_0x494f('0x65')]=0x0;this[_0x494f('0x66')]=0x0;this[_0x494f('0x67')]=0x0;this[_0x494f('0x68')]=0x0;this[_0x494f('0x69')]=0x0;this['predictiveIntervalMaxThreshold']=_0x85e7ed[_0x494f('0x6a')]||0x14;this[_0x494f('0x6b')]=_0x85e7ed[_0x494f('0x6a')]||0xa;this[_0x494f('0x6c')]=0x0;this[_0x494f('0x6d')]=0x0;this[_0x494f('0x6e')]=0x1;this['erlangCalls']=0x0;this[_0x494f('0x6f')]=0x0;this[_0x494f('0x70')]=0x0;this[_0x494f('0x71')]=0x0;this[_0x494f('0x72')]=_0x85e7ed['dialRecallMeTimeout']||0x1e;this[_0x494f('0x73')]=_0x85e7ed[_0x494f('0x73')]||![];this[_0x494f('0x74')]=!!_0x85e7ed[_0x494f('0x74')]||![];this[_0x494f('0x75')]=!!_0x85e7ed[_0x494f('0x75')]||![];this['dialQueueProject2']=_0x85e7ed[_0x494f('0x76')]||undefined;this[_0x494f('0x77')]=_0x85e7ed[_0x494f('0x77')]||![];this[_0x494f('0x78')]=_0x85e7ed[_0x494f('0x78')]||![];this[_0x494f('0xd')]=monitorFormat[_0x85e7ed[_0x494f('0xd')]]?monitorFormat[_0x85e7ed[_0x494f('0xd')]]:undefined;this[_0x494f('0x79')]=_0x85e7ed[_0x494f('0x79')]||![];this['mandatoryDispositionPause']=_0x85e7ed[_0x494f('0x7a')]?_0x85e7ed[_0x494f('0x7a')]:undefined;}module[_0x494f('0x7b')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 60cb005..cb6d4c8 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 _0x3480=['Configurations','exports','name','username','accessKey','remoteUri','serverUrl'];(function(_0x4dbaad,_0x730318){var _0x226c72=function(_0x501972){while(--_0x501972){_0x4dbaad['push'](_0x4dbaad['shift']());}};_0x226c72(++_0x730318);}(_0x3480,0x191));var _0x0348=function(_0x4d6555,_0x28fa4f){_0x4d6555=_0x4d6555-0x0;var _0x325b83=_0x3480[_0x4d6555];return _0x325b83;};'use strict';function VtigerAccount(_0x2acad1){this['id']=_0x2acad1['id']||0x0;this['name']=_0x2acad1[_0x0348('0x0')]||'';this[_0x0348('0x1')]=_0x2acad1[_0x0348('0x1')]||'';this[_0x0348('0x2')]=_0x2acad1[_0x0348('0x2')]||'';this[_0x0348('0x3')]=_0x2acad1[_0x0348('0x3')]||'';this[_0x0348('0x4')]=_0x2acad1[_0x0348('0x4')]||'';this[_0x0348('0x5')]=_0x2acad1[_0x0348('0x5')]||{};}module[_0x0348('0x6')]=VtigerAccount; \ No newline at end of file +var _0x3c30=['name','username','accessKey','remoteUri','serverUrl','Configurations','exports'];(function(_0x41e9c3,_0x36c9b4){var _0x367ea9=function(_0x1775e9){while(--_0x1775e9){_0x41e9c3['push'](_0x41e9c3['shift']());}};_0x367ea9(++_0x36c9b4);}(_0x3c30,0x1f1));var _0x03c3=function(_0x5ddc68,_0x50f659){_0x5ddc68=_0x5ddc68-0x0;var _0x34d4de=_0x3c30[_0x5ddc68];return _0x34d4de;};'use strict';function VtigerAccount(_0x2633a7){this['id']=_0x2633a7['id']||0x0;this[_0x03c3('0x0')]=_0x2633a7[_0x03c3('0x0')]||'';this[_0x03c3('0x1')]=_0x2633a7[_0x03c3('0x1')]||'';this[_0x03c3('0x2')]=_0x2633a7[_0x03c3('0x2')]||'';this['remoteUri']=_0x2633a7[_0x03c3('0x3')]||'';this[_0x03c3('0x4')]=_0x2633a7['serverUrl']||'';this[_0x03c3('0x5')]=_0x2633a7[_0x03c3('0x5')]||{};}module[_0x03c3('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 fc087a2..07647cb 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 _0xed0e=['remoteUri','authType','type','integrationTab','serverUrl','Configurations','name','username','password','token'];(function(_0x17683e,_0x241e89){var _0x2ffd85=function(_0x489bf1){while(--_0x489bf1){_0x17683e['push'](_0x17683e['shift']());}};_0x2ffd85(++_0x241e89);}(_0xed0e,0xd8));var _0xeed0=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0xed0e[_0x1694f5];return _0x5b4321;};'use strict';function ZendeskAccount(_0x179713){this['id']=_0x179713['id']||0x0;this[_0xeed0('0x0')]=_0x179713[_0xeed0('0x0')]||'';this[_0xeed0('0x1')]=_0x179713['username']||'';this[_0xeed0('0x2')]=_0x179713['password']||'';this['token']=_0x179713[_0xeed0('0x3')]||'';this[_0xeed0('0x4')]=_0x179713[_0xeed0('0x4')]||'';this[_0xeed0('0x5')]=_0x179713['authType']||'';this[_0xeed0('0x6')]=_0x179713['type']||_0xeed0('0x7');this[_0xeed0('0x8')]=_0x179713[_0xeed0('0x8')]||'';this[_0xeed0('0x9')]=_0x179713[_0xeed0('0x9')]||{};}module['exports']=ZendeskAccount; \ No newline at end of file +var _0x3109=['token','remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports','name','username','password'];(function(_0xcbe70d,_0x1dc2aa){var _0x33fba9=function(_0x1cfb39){while(--_0x1cfb39){_0xcbe70d['push'](_0xcbe70d['shift']());}};_0x33fba9(++_0x1dc2aa);}(_0x3109,0x17e));var _0x9310=function(_0x266d59,_0x979287){_0x266d59=_0x266d59-0x0;var _0x3085d3=_0x3109[_0x266d59];return _0x3085d3;};'use strict';function ZendeskAccount(_0x22358a){this['id']=_0x22358a['id']||0x0;this[_0x9310('0x0')]=_0x22358a[_0x9310('0x0')]||'';this[_0x9310('0x1')]=_0x22358a[_0x9310('0x1')]||'';this['password']=_0x22358a[_0x9310('0x2')]||'';this['token']=_0x22358a[_0x9310('0x3')]||'';this[_0x9310('0x4')]=_0x22358a['remoteUri']||'';this[_0x9310('0x5')]=_0x22358a['authType']||'';this['type']=_0x22358a[_0x9310('0x6')]||_0x9310('0x7');this[_0x9310('0x8')]=_0x22358a[_0x9310('0x8')]||'';this[_0x9310('0x9')]=_0x22358a['Configurations']||{};}module[_0x9310('0xa')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 9d68347..bcbce9b 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 _0x135d=['name','description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports'];(function(_0x277cf7,_0x7429a8){var _0x158ea5=function(_0x548676){while(--_0x548676){_0x277cf7['push'](_0x277cf7['shift']());}};_0x158ea5(++_0x7429a8);}(_0x135d,0x1ef));var _0xd135=function(_0x1f802d,_0xb4dbae){_0x1f802d=_0x1f802d-0x0;var _0x53d8e9=_0x135d[_0x1f802d];return _0x53d8e9;};'use strict';function ZohoAccount(_0x23553b){this['id']=_0x23553b['id']||0x0;this[_0xd135('0x0')]=_0x23553b[_0xd135('0x0')]||'';this[_0xd135('0x1')]=_0x23553b[_0xd135('0x1')]||'';this[_0xd135('0x2')]=_0x23553b[_0xd135('0x2')]||'';this[_0xd135('0x3')]=_0x23553b[_0xd135('0x3')]||'';this['clientId']=_0x23553b[_0xd135('0x4')]||'';this[_0xd135('0x5')]=_0x23553b['clientSecret']||'';this['serverUrl']=_0x23553b[_0xd135('0x6')]||'';this[_0xd135('0x7')]=_0x23553b[_0xd135('0x7')]||'';this['refreshToken']=_0x23553b[_0xd135('0x8')]||'';this[_0xd135('0x9')]=_0x23553b[_0xd135('0x9')]||{};}module[_0xd135('0xa')]=ZohoAccount; \ No newline at end of file +var _0x4f89=['refreshToken','Configurations','exports','name','description','host','clientId','clientSecret','serverUrl','code'];(function(_0x1bc013,_0x7771c6){var _0x55df36=function(_0x1c02e0){while(--_0x1c02e0){_0x1bc013['push'](_0x1bc013['shift']());}};_0x55df36(++_0x7771c6);}(_0x4f89,0x7b));var _0x94f8=function(_0x9e858b,_0x4aad7e){_0x9e858b=_0x9e858b-0x0;var _0x4454bd=_0x4f89[_0x9e858b];return _0x4454bd;};'use strict';function ZohoAccount(_0x49be2d){this['id']=_0x49be2d['id']||0x0;this[_0x94f8('0x0')]=_0x49be2d['name']||'';this[_0x94f8('0x1')]=_0x49be2d[_0x94f8('0x1')]||'';this[_0x94f8('0x2')]=_0x49be2d[_0x94f8('0x2')]||'';this['zone']=_0x49be2d['zone']||'';this[_0x94f8('0x3')]=_0x49be2d[_0x94f8('0x3')]||'';this[_0x94f8('0x4')]=_0x49be2d[_0x94f8('0x4')]||'';this[_0x94f8('0x5')]=_0x49be2d['serverUrl']||'';this[_0x94f8('0x6')]=_0x49be2d[_0x94f8('0x6')]||'';this[_0x94f8('0x7')]=_0x49be2d['refreshToken']||'';this[_0x94f8('0x8')]=_0x49be2d['Configurations']||{};}module[_0x94f8('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 cbb29a1..483b64d 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 _0x4bd3=['name','type','campaigntype','dialAnswer','membername','Agent','channelAgent','SIP/%s','calleridname','Contact','phone','firstName','lastName','active','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname','prototype','format','\x22%s\x22\x20<%s>','number','exports','util','moment','isNil','string','idContact','queue'];(function(_0x1e8027,_0x3284e6){var _0x1bc1a4=function(_0x38ee81){while(--_0x38ee81){_0x1e8027['push'](_0x1e8027['shift']());}};_0x1bc1a4(++_0x3284e6);}(_0x4bd3,0x174));var _0x34bd=function(_0x27f7d2,_0x5dcc66){_0x27f7d2=_0x27f7d2-0x0;var _0xc9f77f=_0x4bd3[_0x27f7d2];return _0xc9f77f;};'use strict';var util=require(_0x34bd('0x0'));var _=require('lodash');var moment=require(_0x34bd('0x1'));function checkNameSurname(_0x22a9f9,_0x5369c1,_0x4997bc){var _0x4cad21='';if(!_[_0x34bd('0x2')](_0x5369c1)&&_0x34bd('0x3')===typeof _0x5369c1){_0x4cad21+=_0x5369c1;}if(!_[_0x34bd('0x2')](_0x4997bc)&&'string'===typeof _0x4997bc){_0x4cad21+='\x20'+_0x4997bc;}if(_0x4cad21!==''){return _0x4cad21;}return _0x22a9f9;}function Action(_0x2133c5,_0x2a15a2,_0x5c2a7a,_0x3e8744,_0x213716){this['uniqueid']=_0x5c2a7a||undefined;this[_0x34bd('0x4')]=_0x2133c5['id'];this[_0x34bd('0x5')]=_0x2a15a2[_0x34bd('0x6')];this[_0x34bd('0x7')]=_0x2a15a2[_0x34bd('0x7')];this[_0x34bd('0x8')]='queue';this[_0x34bd('0x9')]=![];this[_0x34bd('0xa')]=_[_0x34bd('0x2')](_0x2133c5[_0x34bd('0xb')])?undefined:_0x2133c5['Agent']['name'];this[_0x34bd('0xc')]=this['membername']?util['format'](_0x34bd('0xd'),this[_0x34bd('0xa')]):_0x3e8744||undefined;this[_0x34bd('0xe')]=checkNameSurname(_0x2133c5[_0x34bd('0xf')][_0x34bd('0x10')],_0x2133c5[_0x34bd('0xf')][_0x34bd('0x11')],_0x2133c5[_0x34bd('0xf')][_0x34bd('0x12')]);this['active']=_0x2133c5[_0x34bd('0x13')]||![];this['calleridnum']=_0x2133c5['phone'];this[_0x34bd('0x14')]=_0x2133c5[_0x34bd('0x14')];this[_0x34bd('0x15')]=_0x2133c5[_0x34bd('0x15')]||0x0;this[_0x34bd('0x16')]=_0x2133c5[_0x34bd('0x16')]||0x0;this[_0x34bd('0x17')]=_0x2133c5[_0x34bd('0x17')]||0x0;this[_0x34bd('0x18')]=(_0x2133c5[_0x34bd('0x15')]||0x0)+(_0x2133c5[_0x34bd('0x16')]||0x0)+(_0x2133c5['countnoanswerretry']||0x0)+(_0x2133c5[_0x34bd('0x19')]||0x0)+(_0x2133c5[_0x34bd('0x1a')]||0x0)+(_0x2133c5[_0x34bd('0x1b')]||0x0)+(_0x2133c5[_0x34bd('0x1c')]||0x0)+(_0x2133c5[_0x34bd('0x1d')]||0x0);this[_0x34bd('0x19')]=_0x2133c5[_0x34bd('0x19')]||0x0;this[_0x34bd('0x1a')]=_0x2133c5[_0x34bd('0x1a')]||0x0;this['countabandonedretry']=_0x2133c5[_0x34bd('0x1b')]||0x0;this[_0x34bd('0x1c')]=_0x2133c5[_0x34bd('0x1c')]||0x0;this[_0x34bd('0x1d')]=_0x2133c5[_0x34bd('0x1d')]||0x0;this['callback']=_0x2133c5['callback'];this['callbackuniqueid']=_0x2133c5['callbackuniqueid'];this[_0x34bd('0x1e')]=_0x2133c5['callbackat'];this[_0x34bd('0x1f')]=_0x2133c5[_0x34bd('0x1f')];this[_0x34bd('0x20')]=_0x2133c5['ContactId'];this[_0x34bd('0x21')]=_0x2133c5[_0x34bd('0x21')];this[_0x34bd('0x22')]=_[_0x34bd('0x2')](_0x2133c5['Agent'])?_0x2133c5[_0x34bd('0x22')]:_0x2133c5[_0x34bd('0xb')]['id'];this[_0x34bd('0x23')]=_0x2133c5[_0x34bd('0x23')];this['originatecalleridnum']='';this[_0x34bd('0x24')]='';}Action[_0x34bd('0x25')]['getCaller']=function(){return util[_0x34bd('0x26')](_0x34bd('0x27'),this[_0x34bd('0xe')],this[_0x34bd('0x28')]);};module[_0x34bd('0x29')]=Action; \ No newline at end of file +var _0x32b6=['membername','Agent','channelAgent','format','SIP/%s','calleridname','phone','Contact','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','exports','util','lodash','isNil','string','uniqueid','queue','name','type'];(function(_0x30748b,_0x33b3f9){var _0xb48326=function(_0x41ec66){while(--_0x41ec66){_0x30748b['push'](_0x30748b['shift']());}};_0xb48326(++_0x33b3f9);}(_0x32b6,0x1d1));var _0x632b=function(_0x348e37,_0x47c64d){_0x348e37=_0x348e37-0x0;var _0x17408d=_0x32b6[_0x348e37];return _0x17408d;};'use strict';var util=require(_0x632b('0x0'));var _=require(_0x632b('0x1'));var moment=require('moment');function checkNameSurname(_0x1f0635,_0x1d100a,_0x51c210){var _0x5ad871='';if(!_[_0x632b('0x2')](_0x1d100a)&&_0x632b('0x3')===typeof _0x1d100a){_0x5ad871+=_0x1d100a;}if(!_[_0x632b('0x2')](_0x51c210)&&_0x632b('0x3')===typeof _0x51c210){_0x5ad871+='\x20'+_0x51c210;}if(_0x5ad871!==''){return _0x5ad871;}return _0x1f0635;}function Action(_0x1adfe6,_0x122768,_0x24ceab,_0x10458a,_0x3bbf43){this[_0x632b('0x4')]=_0x24ceab||undefined;this['idContact']=_0x1adfe6['id'];this[_0x632b('0x5')]=_0x122768[_0x632b('0x6')];this[_0x632b('0x7')]=_0x122768[_0x632b('0x7')];this['campaigntype']='queue';this['dialAnswer']=![];this[_0x632b('0x8')]=_['isNil'](_0x1adfe6[_0x632b('0x9')])?undefined:_0x1adfe6[_0x632b('0x9')][_0x632b('0x6')];this[_0x632b('0xa')]=this[_0x632b('0x8')]?util[_0x632b('0xb')](_0x632b('0xc'),this[_0x632b('0x8')]):_0x10458a||undefined;this[_0x632b('0xd')]=checkNameSurname(_0x1adfe6['Contact'][_0x632b('0xe')],_0x1adfe6[_0x632b('0xf')][_0x632b('0x10')],_0x1adfe6['Contact'][_0x632b('0x11')]);this[_0x632b('0x12')]=_0x1adfe6[_0x632b('0x12')]||![];this[_0x632b('0x13')]=_0x1adfe6[_0x632b('0xe')];this[_0x632b('0x14')]=_0x1adfe6['scheduledat'];this[_0x632b('0x15')]=_0x1adfe6['countbusyretry']||0x0;this['countcongestionretry']=_0x1adfe6[_0x632b('0x16')]||0x0;this['countnoanswerretry']=_0x1adfe6[_0x632b('0x17')]||0x0;this[_0x632b('0x18')]=(_0x1adfe6[_0x632b('0x15')]||0x0)+(_0x1adfe6['countcongestionretry']||0x0)+(_0x1adfe6[_0x632b('0x17')]||0x0)+(_0x1adfe6[_0x632b('0x19')]||0x0)+(_0x1adfe6[_0x632b('0x1a')]||0x0)+(_0x1adfe6[_0x632b('0x1b')]||0x0)+(_0x1adfe6['countmachineretry']||0x0)+(_0x1adfe6[_0x632b('0x1c')]||0x0);this[_0x632b('0x19')]=_0x1adfe6['countnosuchnumberretry']||0x0;this[_0x632b('0x1a')]=_0x1adfe6['countdropretry']||0x0;this['countabandonedretry']=_0x1adfe6[_0x632b('0x1b')]||0x0;this['countmachineretry']=_0x1adfe6[_0x632b('0x1d')]||0x0;this[_0x632b('0x1c')]=_0x1adfe6[_0x632b('0x1c')]||0x0;this['callback']=_0x1adfe6[_0x632b('0x1e')];this[_0x632b('0x1f')]=_0x1adfe6['callbackuniqueid'];this[_0x632b('0x20')]=_0x1adfe6[_0x632b('0x20')];this[_0x632b('0x21')]=_0x1adfe6[_0x632b('0x21')];this[_0x632b('0x22')]=_0x1adfe6[_0x632b('0x22')];this['ListId']=_0x1adfe6['ListId'];this[_0x632b('0x23')]=_['isNil'](_0x1adfe6[_0x632b('0x9')])?_0x1adfe6[_0x632b('0x23')]:_0x1adfe6['Agent']['id'];this[_0x632b('0x24')]=_0x1adfe6[_0x632b('0x24')];this[_0x632b('0x25')]='';this[_0x632b('0x26')]='';}Action[_0x632b('0x27')][_0x632b('0x28')]=function(){return util[_0x632b('0xb')](_0x632b('0x29'),this[_0x632b('0xd')],this['number']);};module[_0x632b('0x2a')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 1b3125a..04e5392 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 _0x9b09=['transfererlinkedid','exports','uuid','moment','md5','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','./rpcDb','../rpc/cmHopperAdditionalPhone','./action','./util/util','redis','defaults','localhost','socket.io-emitter','prototype','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','bind','syncHangupRequest','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','type','outbound','name','strategy','answered','available','loggedIn','pTalking','sumDuration','talking','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','startPredictive','startProgressive','Trunk','callerid','Interval','stringify','format','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice_queue_channel:remove','emit','voice_queue_presence:remove','sendMessageOneNotActive','paused','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','DEACTIVATED','\x20is\x20deactivated','syncCampaigns','hasOwnProperty','booked','setMessage','enqueue','isNil','[clearZombieChannels][talking]','Queue','queue','originated:\x20','dialAnswer','contactId','ListId','status','channel','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','recallMe','getContactRecallMe','agentReadyId','then','length','getDiff','scheduledat','Agent','run','logger2','[RecallMe]','disableContact','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','NOT_ACTIVE','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','cloneAction','dialNoSuchNumberMaxRetry','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','unlockAgent','activeContact','linkedid','incrementPreviewCounters','idContact','swapAdditionalPhones','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','buildObj','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','outboundAnswerCallsDay','total','decrementTalkink','[16]','Answer','[callProgressDetectingCustomer][logAnswerGlobal]','talktime','sumBillable','pTalking:\x20','BUSY','countbusyretry','dialBusyRetryFrequency','[callProgressDetectingCustomer][logBusy]','verifyAdditionalPhones','Global','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','NOANSWER','countnoanswerretry','NoAnswer','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswerGlobal]','CONGESTION','outboundCongestionCallsDay','countcongestionretry','Congestion','custom:agentcongestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','countagentrejectretry','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','AgentReject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','countabandonedretry','dialAbandonedRetryFrequency','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','Busy','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','resolve','[verifyAdditionalPhone]\x20','[incrementPreviewCounters]\x20','Contact','phone','VoiceQueueId','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','Calling','[Preview][execCall][failure]','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','reachable','execRun','unlock','unlockContact','pick','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','dialPrefix','dialCutDigit','substring','getCallerId','getCallerIdRandom','dialOriginateCallerIdNumber','dialRandomLastDigitCallerIdNumber','originatecalleridname','extractCalleridNumber','addVariables','toLowerVariables','variablesAction','OriginateError','[originateFailure][logOriginateFailure]','syncOriginateResponse','logLookAgent','clone','isFailure','response','rejected','starttime','[callProgressDetectingAgent][logAnswer]','syncHangup','[syncHangup][talking]','cause','callProgressDetectingCustomer','[syncHangup][talking][cause]','dialQueueProject','transfer','[syncHangup][talking][transfer]','addVariable','variables','filterKey','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid'];(function(_0x27a019,_0x2f1fe6){var _0x5c2697=function(_0x11c080){while(--_0x11c080){_0x27a019['push'](_0x27a019['shift']());}};_0x5c2697(++_0x2f1fe6);}(_0x9b09,0x15f));var _0x99b0=function(_0x46306f,_0x5aef14){_0x46306f=_0x46306f-0x0;var _0x16a27f=_0x9b09[_0x46306f];return _0x16a27f;};'use strict';var util=require('util');var _=require('lodash');var uuid=require(_0x99b0('0x0'));var moment=require(_0x99b0('0x1'));var md5=require(_0x99b0('0x2'));var Redis=require(_0x99b0('0x3'));var config=require(_0x99b0('0x4'));var logger=require(_0x99b0('0x5'))(_0x99b0('0x6'));var loggerAction=require('../../../config/logger')(_0x99b0('0x7'));var ami=require(_0x99b0('0x8'));var rpcDb=require(_0x99b0('0x9'));var cmHopperAdditionalPhone=require(_0x99b0('0xa'));var Action=require(_0x99b0('0xb'));var ut=require(_0x99b0('0xc'));config[_0x99b0('0xd')]=_[_0x99b0('0xe')](config[_0x99b0('0xd')],{'host':_0x99b0('0xf'),'port':0x18eb});var io=require(_0x99b0('0x10'))(new Redis(config['redis']));var Sequence=function(){};Sequence[_0x99b0('0x11')]['enqueue']=function(_0x51cad9){this[_0x99b0('0x12')]=this[_0x99b0('0x12')]?this[_0x99b0('0x12')][_0x99b0('0x13')](_0x51cad9):_0x51cad9();};function Preview(_0x464bc){this[_0x99b0('0x14')]=new Sequence();this[_0x99b0('0x15')]=_0x464bc[_0x99b0('0x16')];this[_0x99b0('0x17')]=_0x464bc[_0x99b0('0x17')];this[_0x99b0('0x18')]={};this[_0x99b0('0x19')]=_0x464bc['agents'];this[_0x99b0('0x1a')]=0x0;ami['on'](_0x99b0('0x1b'),this['syncOriginateResponse'][_0x99b0('0x1c')](this));ami['on']('hangup',this['syncHangup'][_0x99b0('0x1c')](this));ami['on']('hanguprequest',this[_0x99b0('0x1d')][_0x99b0('0x1c')](this));ami['on']('dialend',this[_0x99b0('0x1e')][_0x99b0('0x1c')](this));ami['on'](_0x99b0('0x1f'),this[_0x99b0('0x20')][_0x99b0('0x1c')](this));ami['on'](_0x99b0('0x21'),this[_0x99b0('0x22')][_0x99b0('0x1c')](this));ami['on'](_0x99b0('0x23'),this[_0x99b0('0x24')][_0x99b0('0x1c')](this));ami['on'](_0x99b0('0x25'),this[_0x99b0('0x26')][_0x99b0('0x1c')](this));this[_0x99b0('0x27')](this[_0x99b0('0x15')]);}function emit(_0x4483bf,_0x14ad07,_0x5cf90f){io['to'](_0x4483bf)['emit'](_0x14ad07,_0x5cf90f);}function emitCampaignPreview(_0x35a587){if(_0x35a587[_0x99b0('0x28')]===_0x99b0('0x29')){var _0x5cb4f9={'id':_0x35a587['id'],'name':_0x35a587[_0x99b0('0x2a')],'strategy':_0x35a587[_0x99b0('0x2b')],'answered':_0x35a587[_0x99b0('0x2c')],'available':_0x35a587[_0x99b0('0x2d')],'loggedIn':_0x35a587[_0x99b0('0x2e')],'pTalking':_0x35a587[_0x99b0('0x2f')],'sumBillable':_0x35a587['sumBillable'],'sumDuration':_0x35a587[_0x99b0('0x30')],'sumHoldTime':_0x35a587['sumHoldTime']||0x0,'talking':_0x35a587[_0x99b0('0x31')],'total':_0x35a587['total'],'type':_0x35a587[_0x99b0('0x28')],'unmanaged':_0x35a587[_0x99b0('0x32')],'abandoned':_0x35a587[_0x99b0('0x33')],'waiting':_0x35a587[_0x99b0('0x34')],'loggedInDb':_0x35a587[_0x99b0('0x35')],'dialActive':_0x35a587[_0x99b0('0x36')],'dialMethod':_0x35a587[_0x99b0('0x37')],'dialOriginateCallerIdName':_0x35a587[_0x99b0('0x38')],'dialOriginateCallerIdNumber':_0x35a587['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x35a587['dialOriginateTimeout'],'dialPrefix':_0x35a587['dialPrefix'],'outboundAnswerAgiCallsDay':_0x35a587[_0x99b0('0x39')],'outboundAnswerCallsDay':_0x35a587['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x35a587[_0x99b0('0x3a')],'outboundBusyCallsDay':_0x35a587[_0x99b0('0x3b')],'outboundCongestionCallsDay':_0x35a587['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x35a587[_0x99b0('0x3c')],'outboundDropCallsDayCallersExit':_0x35a587[_0x99b0('0x3d')],'outboundDropCallsDayTimeout':_0x35a587[_0x99b0('0x3e')],'outboundNoAnswerCallsDay':_0x35a587[_0x99b0('0x3f')],'outboundNoSuchCallsDay':_0x35a587[_0x99b0('0x40')],'outboundOriginateFailureCallsDay':_0x35a587[_0x99b0('0x41')],'outboundReCallsDay':_0x35a587['outboundReCallsDay'],'outboundRejectCallsDay':_0x35a587[_0x99b0('0x42')],'outboundUnknownCallsDay':_0x35a587[_0x99b0('0x43')],'outboundAbandonedCallsDay':_0x35a587[_0x99b0('0x44')],'predictiveIntervalAnsweredCalls':_0x35a587['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x35a587[_0x99b0('0x45')],'predictiveIntervalAvgTalktime':_0x35a587['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x35a587[_0x99b0('0x46')],'predictiveIntervalDroppedCallsTimeout':_0x35a587[_0x99b0('0x47')],'predictiveIntervalErlangCalls':_0x35a587[_0x99b0('0x48')],'predictiveIntervalErlangCallsDroppedCalls':_0x35a587[_0x99b0('0x49')],'predictiveIntervalHitRate':_0x35a587[_0x99b0('0x4a')],'predictiveIntervalMultiplicativeFactor':_0x35a587[_0x99b0('0x4b')],'predictiveIntervalPauses':_0x35a587[_0x99b0('0x4c')],'predictiveIntervalAvailable':_0x35a587[_0x99b0('0x4d')],'predictiveIntervalTotalCalls':_0x35a587[_0x99b0('0x4e')],'message':_0x35a587[_0x99b0('0x4f')],'originated':_0x35a587[_0x99b0('0x50')],'erlangCalls':_0x35a587[_0x99b0('0x51')],'erlangCallToSecond':_0x35a587[_0x99b0('0x52')],'erlangAbandonmentRate':_0x35a587[_0x99b0('0x53')],'erlangBusyFactor':_0x35a587['erlangBusyFactor'],'startPredictive':_0x35a587[_0x99b0('0x54')],'startProgressive':_0x35a587[_0x99b0('0x55')]};if(_0x35a587[_0x99b0('0x56')]){_0x5cb4f9[_0x99b0('0x56')]={'id':_0x35a587[_0x99b0('0x56')]['id'],'name':_0x35a587[_0x99b0('0x56')]['name'],'active':_0x35a587[_0x99b0('0x56')]['active'],'callerid':_0x35a587[_0x99b0('0x56')][_0x99b0('0x57')]};}if(_0x35a587[_0x99b0('0x58')]){_0x5cb4f9[_0x99b0('0x58')]={'id':_0x35a587[_0x99b0('0x58')]['id'],'name':_0x35a587['Interval'][_0x99b0('0x2a')]};}var _0x12f7db=md5(JSON[_0x99b0('0x59')](_0x5cb4f9));if(_0x35a587[_0x99b0('0x2')]!==_0x12f7db){_0x35a587[_0x99b0('0x2')]=_0x12f7db;emit(util[_0x99b0('0x5a')](_0x99b0('0x5b'),_0x5cb4f9[_0x99b0('0x2a')]),_0x99b0('0x5c'),_0x5cb4f9);}}}function emitVoiceQueueChannelRemove(_0x5ad24d){logger[_0x99b0('0x5d')](_0x99b0('0x5e'),JSON['stringify'](_0x5ad24d));emit(util['format'](_0x99b0('0x5b'),_0x5ad24d[_0x99b0('0x2a')]),_0x99b0('0x5f'),_0x5ad24d);io[_0x99b0('0x60')](_0x99b0('0x61'),_0x5ad24d);}function notSendMessagesQueue(_0x3e3396){if(_0x3e3396[_0x99b0('0x62')]){if(_0x3e3396[_0x99b0('0x50')]===0x0&&_0x3e3396[_0x99b0('0x2f')]===0x0){_0x3e3396[_0x99b0('0x62')]=![];_0x3e3396[_0x99b0('0x2d')]=0x0;_0x3e3396[_0x99b0('0x63')]=0x0;_0x3e3396['message']='NOT_ACTIVE';ut[_0x99b0('0x64')](_0x99b0('0x65'),_0x3e3396[_0x99b0('0x2a')]+_0x99b0('0x66'));}else{_0x3e3396[_0x99b0('0x4f')]=_0x99b0('0x67');ut[_0x99b0('0x64')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x3e3396[_0x99b0('0x2a')]+_0x99b0('0x68'));}emitCampaignPreview(_0x3e3396);}}Preview['prototype'][_0x99b0('0x27')]=function(){var _0x1725ed=this;setInterval(function(){_0x1725ed[_0x99b0('0x69')]();},0x7cf);};Preview[_0x99b0('0x11')][_0x99b0('0x69')]=function(){var _0x2853e6=this[_0x99b0('0x15')];this[_0x99b0('0x1a')]+=0x1;for(var _0x3fc59c in _0x2853e6){if(_0x2853e6[_0x99b0('0x6a')](_0x3fc59c)&&(_0x2853e6[_0x3fc59c]['dialMethod']==='preview'||_0x2853e6[_0x3fc59c][_0x99b0('0x37')]===_0x99b0('0x6b'))&&_0x2853e6[_0x3fc59c][_0x99b0('0x28')]===_0x99b0('0x29')){if(this[_0x99b0('0x1a')]>0x7){this['clockClearZombieChannels']=0x0;this['clearZombieChannels']();}}if(_0x2853e6[_0x99b0('0x6a')](_0x3fc59c)&&_0x2853e6[_0x3fc59c]['dialMethod']==='preview'&&_0x2853e6[_0x3fc59c][_0x99b0('0x28')]===_0x99b0('0x29')){if(_0x2853e6[_0x3fc59c][_0x99b0('0x36')]){this[_0x99b0('0x6c')](_0x2853e6[_0x3fc59c]);if(_0x2853e6[_0x3fc59c]['dialPreviewAutoRecallMe'])this['recallMe'](_0x2853e6[_0x3fc59c]);}else{notSendMessagesQueue(_0x2853e6[_0x3fc59c]);}}}};Preview[_0x99b0('0x11')]['clearZombieChannel']=function(_0x5500f5){var _0x88eeac=this;this[_0x99b0('0x14')][_0x99b0('0x6d')](function(){if(!_[_0x99b0('0x6e')](_0x88eeac[_0x99b0('0x18')][_0x5500f5])){loggerAction[_0x99b0('0x5d')](_0x99b0('0x6f'),_0x5500f5,_0x99b0('0x70'),_0x88eeac['actions'][_0x5500f5][_0x99b0('0x71')],_0x99b0('0x72'),JSON['stringify'](_0x88eeac['campaignsPreview'][_0x88eeac[_0x99b0('0x18')][_0x5500f5][_0x99b0('0x71')]][_0x99b0('0x50')]),'pTalking:\x20',JSON['stringify'](_0x88eeac['campaignsPreview'][_0x88eeac['actions'][_0x5500f5][_0x99b0('0x71')]][_0x99b0('0x2f')]),JSON['stringify'](_0x88eeac[_0x99b0('0x18')][_0x5500f5][_0x99b0('0x73')]),JSON[_0x99b0('0x59')](_['pick'](_0x88eeac[_0x99b0('0x18')][_0x5500f5],[_0x99b0('0x74'),'UserId','VoiceQueueId',_0x99b0('0x75')])));return ami['Action']({'action':_0x99b0('0x76'),'channel':_0x88eeac[_0x99b0('0x18')][_0x5500f5][_0x99b0('0x77')]})[_0x99b0('0x78')](function(_0x52d91c){if(_0x52d91c[_0x99b0('0x4f')]===_0x99b0('0x79')){setTimeout(function(){if(_0x88eeac[_0x99b0('0x18')][_0x5500f5]){ut[_0x99b0('0x7a')](_0x88eeac[_0x99b0('0x15')][_0x88eeac['actions'][_0x5500f5][_0x99b0('0x71')]],_0x99b0('0x7b'));if(_0x88eeac[_0x99b0('0x18')][_0x5500f5][_0x99b0('0x73')]===!![]){ut['decrementTalkink'](_0x88eeac[_0x99b0('0x15')][_0x88eeac[_0x99b0('0x18')][_0x5500f5][_0x99b0('0x71')]],_0x99b0('0x7b'));ut[_0x99b0('0x7c')](_0x99b0('0x7d')+_0x5500f5,_0x88eeac['actions'][_0x5500f5][_0x99b0('0x71')]);}ut['loggerError'](_0x99b0('0x7e')+_0x5500f5,_0x88eeac[_0x99b0('0x18')][_0x5500f5][_0x99b0('0x71')]);delete _0x88eeac['actions'][_0x5500f5];}},0x2328);}});}});};Preview[_0x99b0('0x11')]['clearZombieChannels']=function(){var _0x4162be=this;loggerAction['info'](_0x99b0('0x7f'),_[_0x99b0('0x80')](this[_0x99b0('0x18')]));for(var _0x1f83da in this['actions']){if(_0x4162be[_0x99b0('0x18')][_0x99b0('0x6a')](_0x1f83da)){_0x4162be['clearZombieChannel'](_0x1f83da);}}};Preview[_0x99b0('0x11')][_0x99b0('0x81')]=function(_0x42b469){var _0x153112=this;rpcDb[_0x99b0('0x82')](_0x42b469['id'],ut[_0x99b0('0x83')](this[_0x99b0('0x19')]))[_0x99b0('0x84')](function(_0x243b49){if(!_[_0x99b0('0x6e')](_0x243b49)){for(var _0x3bb6ac=0x0;_0x3bb6ac<_0x243b49[_0x99b0('0x85')];_0x3bb6ac+=0x1){if(ut[_0x99b0('0x86')](_0x243b49[_0x3bb6ac][_0x99b0('0x87')])<_0x42b469['dialRecallMeTimeout']*0x3c){if(_0x243b49[_0x3bb6ac]['Agent']&&!_0x243b49[_0x3bb6ac][_0x99b0('0x88')]['voicePause']){_0x153112[_0x99b0('0x89')](_0x243b49[_0x3bb6ac]['id'])[_0x99b0('0x84')](ut[_0x99b0('0x8a')]('[RecallMe]'))[_0x99b0('0x78')](ut[_0x99b0('0x8a')](_0x99b0('0x8b')));}else{rpcDb[_0x99b0('0x8c')](_0x243b49[_0x3bb6ac]['id']);}}else{var _0x3e8934=new Action(_0x243b49[_0x3bb6ac],_0x42b469);_0x3e8934['starttime']=moment()['format'](_0x99b0('0x8d'));_0x42b469[_0x99b0('0x8e')]+=0x1;ut[_0x99b0('0x8f')](_0x3e8934,0x17,_0x99b0('0x90'));if(_0x42b469[_0x99b0('0x91')]){rpcDb['rescheduleContactInQueue'](ut[_0x99b0('0x92')](_0x243b49[_0x3bb6ac]));rpcDb[_0x99b0('0x93')](_0x3e8934,_0x99b0('0x94'));}else{ut[_0x99b0('0x8f')](_0x3e8934,0x16,'RecallFailedTimeout');rpcDb[_0x99b0('0x93')](_0x3e8934,_0x99b0('0x95'));rpcDb[_0x99b0('0x96')](_0x3e8934,_0x99b0('0x95'));}}}}})[_0x99b0('0x78')](ut[_0x99b0('0x8a')](_0x99b0('0x97')));};Preview[_0x99b0('0x11')]['setMessage']=function(_0xc878f1){_0xc878f1[_0x99b0('0x62')]=!![];if(ut[_0x99b0('0x98')](_0xc878f1[_0x99b0('0x2e')])){_0xc878f1[_0x99b0('0x4f')]=_0x99b0('0x99');}else if(!ut[_0x99b0('0x9a')](_0xc878f1[_0x99b0('0x36')])){_0xc878f1[_0x99b0('0x4f')]=_0x99b0('0x9b');}else if(!this[_0x99b0('0x9c')](_0xc878f1[_0x99b0('0x56')])){if(!this['isTrunkReachable'](_0xc878f1[_0x99b0('0x9d')])){_0xc878f1['message']=_0x99b0('0x9e');}else{_0xc878f1['message']=_0x99b0('0x9f');}}else{_0xc878f1[_0x99b0('0x4f')]=_0x99b0('0x9f');}emitCampaignPreview(_0xc878f1);};Preview[_0x99b0('0x11')]['callProgressDetectingCustomer']=function(_0xf328c6,_0x1010d1,_0xbeceb6){var _0x623b55=this;var _0x533f1e=this[_0x99b0('0x18')][_0x1010d1];var _0x252125=this[_0x99b0('0x15')][_0x533f1e[_0x99b0('0x71')]];var _0x44ccb5;var _0x5dbc7e=![];var _0x454bc3=0x2;var _0x3b8f24=0x3;if(_0x252125){switch(_0xbeceb6){case'1':_0x252125['outboundNoSuchCallsDay']+=0x1;_0x533f1e[_0x99b0('0xa0')]+=0x1;_0x533f1e[_0x99b0('0xa1')]=ut[_0x99b0('0xa2')](_0x533f1e);ut[_0x99b0('0x8f')](_0x533f1e,0x0,_0x99b0('0xa3'));ami['emit'](_0x99b0('0xa4'),ut['buildObj'](_0x533f1e,_0x99b0('0xa5')));rpcDb['createCustomerHistory'](_0x533f1e,_0x99b0('0xa6'));_0x623b55['verifyAdditionalPhones'](_0x533f1e,'0',_0x252125)['then'](function(_0x2f9bba){_0x5dbc7e=_0x2f9bba[_0x99b0('0xa7')]==0x1;_0x454bc3=_0x252125[_0x99b0('0xa8')];_0x3b8f24=_0x252125[_0x99b0('0xa9')];if(!_0x5dbc7e){if(ut[_0x99b0('0xa2')](_0x533f1e)>=_0x252125[_0x99b0('0xaa')]){_0x44ccb5=ut[_0x99b0('0xab')](_0x533f1e,0xf,'Global');rpcDb[_0x99b0('0x96')](_0x44ccb5,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x533f1e[_0x99b0('0xa0')]>=_0x252125[_0x99b0('0xac')]){rpcDb['createCustomerFinal'](_0x533f1e,_0x99b0('0xad'));}else{rpcDb[_0x99b0('0xae')](ut[_0x99b0('0xaf')](_0x533f1e,'countnosuchnumberretry',_0x252125[_0x99b0('0xa8')]),_0x533f1e[_0x99b0('0xb0')],_0x533f1e[_0x99b0('0xb1')]);}}delete this['actions'][_0xf328c6[_0x99b0('0xb2')]];}else{_0x533f1e[_0x99b0('0xa0')]++;logger['info']('actioncountonusuch',_0x533f1e[_0x99b0('0xa0')]);logger[_0x99b0('0x5d')]('id',_0x533f1e['idContact']);_0x623b55[_0x99b0('0xb3')]({'id':_0x533f1e[_0x99b0('0xb4')],'field':{'countnosuchnumberretry':_0x533f1e[_0x99b0('0xa0')]}})['then'](function(){_0x623b55[_0x99b0('0xb5')](_0x533f1e,_0x454bc3,_0x3b8f24)[_0x99b0('0x84')](function(){});});}});break;case _0x99b0('0xb6'):var _0x5b00ae=moment()[_0x99b0('0x5a')](_0x99b0('0x8d'));_0x533f1e[_0x99b0('0xb7')]=_0x5b00ae;_0x533f1e[_0x99b0('0xb8')]=_0x5b00ae;_0x533f1e[_0x99b0('0x73')]=!![];_0x252125['pTalking']+=0x1;logger[_0x99b0('0x5d')](_0x99b0('0xb9'),_0x533f1e[_0x99b0('0xba')],_0x99b0('0xbb'),_0x252125[_0x99b0('0x2a')],'pTalking:\x20',_0x252125[_0x99b0('0x2f')]);ami[_0x99b0('0x60')]('custom:agentconnect',ut[_0x99b0('0xbc')](_0x533f1e,'connect',this[_0x99b0('0x15')][_0x533f1e[_0x99b0('0x71')]]));if(_0x252125[_0x99b0('0xbd')]){ami[_0x99b0('0x60')](_0x99b0('0xbe'),ut[_0x99b0('0xbf')](_0x533f1e));}break;case'16':ami[_0x99b0('0x60')](_0x99b0('0xc0'),ut[_0x99b0('0xbc')](_0x533f1e,'complete',this['campaignsPreview'][_0x533f1e['queue']]));emitVoiceQueueChannelRemove(ut[_0x99b0('0xbc')](_0x533f1e,_0x99b0('0xc1')));_0x252125[_0x99b0('0xc2')]+=0x1;_0x252125[_0x99b0('0xc3')]+=0x1;_0x252125[_0x99b0('0x2c')]+=0x1;ut[_0x99b0('0xc4')](_0x252125,_0x99b0('0xc5'));_0x533f1e[_0x99b0('0xa1')]=ut[_0x99b0('0xa2')](_0x533f1e);ut['logCustomer'](_0x533f1e,0x4,_0x99b0('0xc6'));rpcDb[_0x99b0('0x93')](_0x533f1e,'[callProgressDetectingCustomer][logAnswer]');rpcDb[_0x99b0('0x96')](_0x533f1e,_0x99b0('0xc7'));rpcDb['crateCustomerReportQueue'](_0x533f1e);_0x252125[_0x99b0('0x30')]+=_0x533f1e[_0x99b0('0xc8')];_0x252125[_0x99b0('0xc9')]+=_0x533f1e[_0x99b0('0xc8')];logger[_0x99b0('0x5d')]('[syncHangup][talking][decrement]',_0x533f1e[_0x99b0('0xba')],'\x20Queue',_0x252125[_0x99b0('0x2a')],_0x99b0('0xca'),_0x252125[_0x99b0('0x2f')]);delete this[_0x99b0('0x18')][_0xf328c6[_0x99b0('0xb2')]];break;case _0x99b0('0xcb'):_0x252125['outboundBusyCallsDay']+=0x1;_0x533f1e[_0x99b0('0xcc')]+=0x1;_0x533f1e[_0x99b0('0xa1')]=ut['totalGlobal'](_0x533f1e);ut[_0x99b0('0x8f')](_0x533f1e,0x5,'Busy');_0x454bc3=_0x252125[_0x99b0('0xcd')];_0x3b8f24=_0x252125['callAdditionalPhoneAfterMin'];ami[_0x99b0('0x60')]('custom:agentbusy',ut['buildObj'](_0x533f1e,'busy'));rpcDb['createCustomerHistory'](_0x533f1e,_0x99b0('0xce'));_0x623b55[_0x99b0('0xcf')](_0x533f1e,'5',_0x252125)['then'](function(_0x8d3e9b){_0x5dbc7e=_0x8d3e9b[_0x99b0('0xa7')]==0x1;if(!_0x5dbc7e){if(ut[_0x99b0('0xa2')](_0x533f1e)>=_0x252125[_0x99b0('0xaa')]){_0x44ccb5=ut[_0x99b0('0xab')](_0x533f1e,0xf,_0x99b0('0xd0'));rpcDb[_0x99b0('0x96')](_0x44ccb5,_0x99b0('0xd1'));}else{if(_0x533f1e[_0x99b0('0xcc')]>=_0x252125[_0x99b0('0xd2')]){rpcDb['createCustomerFinal'](_0x533f1e,_0x99b0('0xce'));}else{rpcDb[_0x99b0('0xae')](ut[_0x99b0('0xaf')](_0x533f1e,_0x99b0('0xcc'),_0x252125[_0x99b0('0xcd')]),_0x533f1e['unlockAgent'],_0x533f1e[_0x99b0('0xb1')]);}}}else{_0x533f1e[_0x99b0('0xcc')]++;_0x623b55[_0x99b0('0xb3')]({'id':_0x533f1e[_0x99b0('0xb4')],'field':{'countbusyretry':_0x533f1e[_0x99b0('0xcc')]}})[_0x99b0('0x84')](function(){_0x623b55[_0x99b0('0xb5')](_0x533f1e,_0x454bc3,_0x3b8f24)[_0x99b0('0x84')](function(){});});}});break;case _0x99b0('0xd3'):_0x252125[_0x99b0('0x3f')]+=0x1;_0x533f1e[_0x99b0('0xd4')]+=0x1;_0x533f1e['countglobal']=ut['totalGlobal'](_0x533f1e);ut['logCustomer'](_0x533f1e,0x3,_0x99b0('0xd5'));_0x454bc3=_0x252125[_0x99b0('0xd6')];_0x3b8f24=_0x252125[_0x99b0('0xa9')];var _0x15bf67=ut[_0x99b0('0xd7')](_0x533f1e,_0x252125);ami['emit'](_0x99b0('0xd8'),_0x15bf67);rpcDb[_0x99b0('0x93')](_0x533f1e,'[callProgressDetectingCustomer][logNoAnswer]');_0x623b55[_0x99b0('0xcf')](_0x533f1e,'3',_0x252125)[_0x99b0('0x84')](function(_0x489b60){_0x5dbc7e=_0x489b60[_0x99b0('0xa7')]==0x1;if(!_0x5dbc7e){if(ut[_0x99b0('0xa2')](_0x533f1e)>=_0x252125[_0x99b0('0xaa')]){_0x44ccb5=ut[_0x99b0('0xab')](_0x533f1e,0xf,_0x99b0('0xd0'));rpcDb[_0x99b0('0x96')](_0x44ccb5,_0x99b0('0xd9'));}else{if(_0x533f1e[_0x99b0('0xd4')]>=_0x252125['dialNoAnswerMaxRetry']){rpcDb[_0x99b0('0x96')](_0x533f1e,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb[_0x99b0('0xae')](ut['scheduledAt'](_0x533f1e,'countnoanswerretry',_0x252125[_0x99b0('0xd6')]),_0x533f1e[_0x99b0('0xb0')],_0x533f1e[_0x99b0('0xb1')]);}}}else{_0x533f1e['countnoanswerretry']++;_0x623b55[_0x99b0('0xb3')]({'id':_0x533f1e[_0x99b0('0xb4')],'field':{'countnoanswerretry':_0x533f1e[_0x99b0('0xd4')]}})[_0x99b0('0x84')](function(){_0x623b55[_0x99b0('0xb5')](_0x533f1e,_0x454bc3,_0x3b8f24)[_0x99b0('0x84')](function(){});});}});break;case _0x99b0('0xda'):_0x252125[_0x99b0('0xdb')]+=0x1;_0x533f1e[_0x99b0('0xdc')]+=0x1;_0x533f1e['countglobal']=ut[_0x99b0('0xa2')](_0x533f1e);ut[_0x99b0('0x8f')](_0x533f1e,0x8,_0x99b0('0xdd'));_0x454bc3=_0x252125['dialCongestionRetryFrequency'];_0x3b8f24=_0x252125['callAdditionalPhoneAfterMin'];ami['emit'](_0x99b0('0xde'),ut[_0x99b0('0xbc')](_0x533f1e,'congestion'));rpcDb[_0x99b0('0x93')](_0x533f1e,_0x99b0('0xdf'));_0x623b55[_0x99b0('0xcf')](_0x533f1e,'8',_0x252125)[_0x99b0('0x84')](function(_0x5d02ee){_0x5dbc7e=_0x5d02ee[_0x99b0('0xa7')]==0x1;if(!_0x5dbc7e){if(ut[_0x99b0('0xa2')](_0x533f1e)>=_0x252125[_0x99b0('0xaa')]){_0x44ccb5=ut[_0x99b0('0xab')](_0x533f1e,0xf,_0x99b0('0xd0'));rpcDb[_0x99b0('0x96')](_0x44ccb5,_0x99b0('0xe0'));}else{if(_0x533f1e[_0x99b0('0xdc')]>=_0x252125[_0x99b0('0xe1')]){rpcDb['createCustomerFinal'](_0x533f1e,_0x99b0('0xdf'));}else{rpcDb[_0x99b0('0xae')](ut[_0x99b0('0xaf')](_0x533f1e,_0x99b0('0xdc'),_0x252125[_0x99b0('0xcd')]),_0x533f1e[_0x99b0('0xb0')],_0x533f1e[_0x99b0('0xb1')]);}}}else{_0x533f1e[_0x99b0('0xdc')]++;_0x623b55['incrementPreviewCounters']({'id':_0x533f1e[_0x99b0('0xb4')],'field':{'countcongestionretry':_0x533f1e['countcongestionretry']}})['then'](function(){_0x623b55[_0x99b0('0xb5')](_0x533f1e,_0x454bc3,_0x3b8f24)['then'](function(){});});}});break;case _0x99b0('0xe2'):_0x252125['outboundRejectCallsDay']+=0x1;_0x533f1e[_0x99b0('0xe3')]+=0x1;_0x533f1e['countglobal']=ut[_0x99b0('0xa2')](_0x533f1e);ut[_0x99b0('0x8f')](_0x533f1e,0x14,'AgentReject');_0x454bc3=_0x252125[_0x99b0('0xe4')];_0x3b8f24=_0x252125['callAdditionalPhoneAfterMin'];ami[_0x99b0('0x60')](_0x99b0('0xe5'),ut[_0x99b0('0xbc')](_0x533f1e,_0x99b0('0xe6')));rpcDb[_0x99b0('0x93')](_0x533f1e,_0x99b0('0xe7'));_0x623b55[_0x99b0('0xcf')](_0x533f1e,'20',_0x252125)[_0x99b0('0x84')](function(_0x27fda9){_0x5dbc7e=_0x27fda9[_0x99b0('0xa7')]==0x1;if(!_0x5dbc7e){if(ut['totalGlobal'](_0x533f1e)>=_0x252125[_0x99b0('0xaa')]){_0x44ccb5=ut['cloneAction'](_0x533f1e,0x14,_0x99b0('0xe8'));rpcDb[_0x99b0('0x96')](_0x44ccb5,_0x99b0('0xe9'));}else{if(_0x533f1e[_0x99b0('0xe3')]>=_0x252125[_0x99b0('0xea')]){rpcDb[_0x99b0('0x96')](_0x533f1e,_0x99b0('0xe9'));}else{rpcDb['rescheduleContact'](ut[_0x99b0('0xaf')](_0x533f1e,_0x99b0('0xe3'),_0x252125[_0x99b0('0xe4')]),_0x533f1e['unlockAgent'],_0x533f1e[_0x99b0('0xb1')]);}}}else{_0x533f1e[_0x99b0('0xd4')]++;_0x623b55[_0x99b0('0xb3')]({'id':_0x533f1e[_0x99b0('0xb4')],'field':{'countnoanswerretry':_0x533f1e[_0x99b0('0xd4')]}})['then'](function(){_0x623b55['swapAdditionalPhones'](_0x533f1e,_0x454bc3,_0x3b8f24)[_0x99b0('0x84')](function(){});});}});break;case'ABANDONED':_0x252125[_0x99b0('0x44')]+=0x1;_0x533f1e['countabandonedretry']+=0x1;_0x533f1e[_0x99b0('0xa1')]=ut[_0x99b0('0xa2')](_0x533f1e);ut['logCustomer'](_0x533f1e,0xb,'Abandoned');rpcDb[_0x99b0('0x93')](_0x533f1e,_0x99b0('0xeb'));_0x623b55[_0x99b0('0xcf')](_0x533f1e,'11',_0x252125)[_0x99b0('0x84')](function(_0x57393e){_0x5dbc7e=_0x57393e[_0x99b0('0xa7')]==0x1;if(!_0x5dbc7e){if(ut[_0x99b0('0xa2')](_0x533f1e)>=_0x252125['dialGlobalMaxRetry']){_0x44ccb5=ut[_0x99b0('0xab')](_0x533f1e,0xf,_0x99b0('0xd0'));rpcDb[_0x99b0('0x96')](_0x44ccb5,_0x99b0('0xeb'));}else{if(_0x533f1e[_0x99b0('0xec')]>=_0x252125[_0x99b0('0xed')]){rpcDb[_0x99b0('0x96')](_0x533f1e,_0x99b0('0xeb'));}else{rpcDb[_0x99b0('0xae')](ut[_0x99b0('0xaf')](_0x533f1e,_0x99b0('0xee'),_0x252125[_0x99b0('0xef')]),_0x533f1e[_0x99b0('0xb0')],_0x533f1e[_0x99b0('0xb1')]);}}}else{_0x533f1e[_0x99b0('0xd4')]++;_0x623b55[_0x99b0('0xb3')]({'id':_0x533f1e[_0x99b0('0xb4')],'field':{'countnoanswerretry':_0x533f1e[_0x99b0('0xd4')]}})[_0x99b0('0x84')](function(){_0x623b55[_0x99b0('0xb5')](_0x533f1e,_0x454bc3,_0x3b8f24)[_0x99b0('0x84')](function(){});});}});break;case'18':_0x252125[_0x99b0('0x43')]+=0x1;_0x533f1e['countmachineretry']+=0x1;_0x533f1e[_0x99b0('0xa1')]=ut[_0x99b0('0xa2')](_0x533f1e);ut[_0x99b0('0x8f')](_0x533f1e,0x12,_0xf328c6[_0x99b0('0xf0')]||_0xf328c6[_0x99b0('0xf1')]);ami[_0x99b0('0x60')](_0x99b0('0xf2'),ut['buildObj'](_0x533f1e,_0x99b0('0xf3')));rpcDb['createCustomerHistory'](_0x533f1e,_0x99b0('0xf4'));_0x623b55[_0x99b0('0xcf')](_0x533f1e,'18',_0x252125)['then'](function(_0x31db62){_0x5dbc7e=_0x31db62['additional']==0x1;if(!_0x5dbc7e){if(ut[_0x99b0('0xa2')](_0x533f1e)>=_0x252125['dialGlobalMaxRetry']){_0x44ccb5=ut['cloneAction'](_0x533f1e,0x12,_0x99b0('0xd0'));rpcDb[_0x99b0('0x96')](_0x44ccb5,_0x99b0('0xf4'));}else{rpcDb[_0x99b0('0x96')](_0x533f1e,_0x99b0('0xf4'));}}else{_0x533f1e['countnoanswerretry']++;_0x623b55[_0x99b0('0xb3')]({'id':_0x533f1e[_0x99b0('0xb4')],'field':{'countnoanswerretry':_0x533f1e['countnoanswerretry']}})[_0x99b0('0x84')](function(){_0x623b55[_0x99b0('0xb5')](_0x533f1e,_0x454bc3,_0x3b8f24)[_0x99b0('0x84')](function(){});});}});delete this['actions'][_0xf328c6[_0x99b0('0xb2')]];break;case'19':_0x252125[_0x99b0('0x43')]+=0x1;_0x533f1e['countglobal']=ut[_0x99b0('0xa2')](_0x533f1e);ut[_0x99b0('0x8f')](_0x533f1e,0x13,_0xf328c6[_0x99b0('0xf0')]||_0xf328c6[_0x99b0('0xf1')]);ami['emit'](_0x99b0('0xf2'),ut[_0x99b0('0xbc')](_0x533f1e,_0x99b0('0xf3')));rpcDb['createCustomerHistory'](_0x533f1e,'[callProgressDetectingCustomer][machine]');_0x623b55['verifyAdditionalPhones'](_0x533f1e,'18',_0x252125)[_0x99b0('0x84')](function(_0x5b58dd){_0x5dbc7e=_0x5b58dd[_0x99b0('0xa7')]==0x1;if(!_0x5dbc7e){if(ut[_0x99b0('0xa2')](_0x533f1e)>=_0x252125[_0x99b0('0xaa')]){_0x44ccb5=ut[_0x99b0('0xab')](_0x533f1e,0xf,_0x99b0('0xd0'));rpcDb[_0x99b0('0x96')](_0x44ccb5,_0x99b0('0xf5'));}else{rpcDb[_0x99b0('0x96')](_0x533f1e,_0x99b0('0xf5'));}}else{_0x533f1e[_0x99b0('0xd4')]++;_0x623b55[_0x99b0('0xb3')]({'id':_0x533f1e[_0x99b0('0xb4')],'field':{'countnoanswerretry':_0x533f1e[_0x99b0('0xd4')]}})['then'](function(){_0x623b55['swapAdditionalPhones'](_0x533f1e,_0x454bc3,_0x3b8f24)['then'](function(){});});}});delete this[_0x99b0('0x18')][_0xf328c6[_0x99b0('0xb2')]];break;default:if(_0x533f1e[_0x99b0('0x73')]){ut['decrementTalkink'](_0x252125,_0x99b0('0xf6'));ut[_0x99b0('0x7c')](_0x99b0('0xf7')+_0x252125[_0x99b0('0x2a')],_0xf328c6);}_0x252125[_0x99b0('0x43')]+=0x1;_0x533f1e[_0x99b0('0xa1')]=ut['totalGlobal'](_0x533f1e);ut[_0x99b0('0x8f')](_0x533f1e,0xc,_0xf328c6['cause-txt']||_0xf328c6[_0x99b0('0xf1')]);_0x454bc3=_0x252125[_0x99b0('0xe4')];_0x3b8f24=_0x252125['callAdditionalPhoneAfterMin'];rpcDb['createCustomerHistory'](_0x533f1e,'[callProgressDetectingCustomer][logUnknown]');_0x623b55[_0x99b0('0xcf')](_0x533f1e,'20',_0x252125)[_0x99b0('0x84')](function(_0xb1e3bc){_0x5dbc7e=_0xb1e3bc[_0x99b0('0xa7')]==0x1;if(!_0x5dbc7e){if(ut['totalGlobal'](_0x533f1e)>=_0x252125[_0x99b0('0xaa')]){_0x44ccb5=ut[_0x99b0('0xab')](_0x533f1e,0xf,_0x99b0('0xd0'));rpcDb[_0x99b0('0x96')](_0x44ccb5,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x99b0('0x96')](_0x533f1e,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this[_0x99b0('0x18')][_0xf328c6[_0x99b0('0xb2')]];}else{_0x623b55[_0x99b0('0xb5')](_0x533f1e,_0x454bc3,_0x3b8f24)[_0x99b0('0x84')](function(){});}});}if(!(_0x533f1e[_0x99b0('0x73')]&&_0xbeceb6==='16')){ut['updateOriginated'](_0x252125,_0x99b0('0xf8'));logger[_0x99b0('0x5d')](_0x99b0('0xf9'),_0x533f1e[_0x99b0('0xba')],'\x20Queue',_0x252125[_0x99b0('0x2a')],_0x99b0('0x72'),_0x252125['originated']);}if(_0xbeceb6!==_0x99b0('0xb6')){delete this[_0x99b0('0x18')][_0xf328c6['linkedid']];delete this[_0x99b0('0x18')][_0xf328c6[_0x99b0('0xfa')]];}}};Preview['prototype'][_0x99b0('0xfb')]=function(_0x580f73,_0x32be3d,_0x2b0ce1){if(_['isUndefined'](_0x32be3d)&&_0x99b0('0xfc')!==typeof _0x32be3d){return;}if(_['isUndefined'](_0x2b0ce1)&&_0x99b0('0xfc')!==typeof _0x2b0ce1){return;}switch(_0x2b0ce1[_0x99b0('0xfd')]){case'0':ut[_0x99b0('0xfe')](_0x580f73,0x0,_0x99b0('0xa3'));rpcDb[_0x99b0('0xff')](_0x580f73,_0x99b0('0x100'));break;case'3':ut[_0x99b0('0xfe')](_0x580f73,0x3,'NoAnswer');rpcDb[_0x99b0('0xff')](_0x580f73,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut['logAgent'](_0x580f73,0x5,_0x99b0('0x101'));rpcDb['createAgentHistory'](_0x580f73,_0x99b0('0x102'));break;case'8':ut['logAgent'](_0x580f73,0x8,_0x99b0('0xdd'));rpcDb['createAgentHistory'](_0x580f73,_0x99b0('0x103'));break;case'22':ut[_0x99b0('0xfe')](_0x580f73,0x16,_0x99b0('0x104'));rpcDb['createAgentHistory'](_0x580f73,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut[_0x99b0('0xfe')](_0x580f73,0xc,_0x2b0ce1[_0x99b0('0xfd')]);rpcDb['createAgentHistory'](_0x580f73,_0x99b0('0x103'));}ut[_0x99b0('0x7a')](_0x32be3d,'[callProgressDetectingAgent]');logger[_0x99b0('0x5d')]('[originated][decrement][callProgressDetectingAgent]',_0x580f73[_0x99b0('0xba')],'\x20Queue',_0x32be3d['name'],'originated:\x20',_0x32be3d[_0x99b0('0x50')]);delete this[_0x99b0('0x18')][_0x580f73[_0x99b0('0xba')]];};Preview['prototype'][_0x99b0('0xcf')]=function(_0x301b14,_0x4d1e96,_0x4a8937){return Promise[_0x99b0('0x105')]()[_0x99b0('0x84')](cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x301b14,_0x4d1e96,_0x4a8937))[_0x99b0('0x78')](logger['info'](_0x99b0('0x106')));};Preview['prototype']['swapAdditionalPhones']=function(_0xd8d743,_0x342337,_0x5017ae){return Promise['resolve']()[_0x99b0('0x84')](cmHopperAdditionalPhone[_0x99b0('0xb5')](_0xd8d743,_0x342337,_0x5017ae))[_0x99b0('0x78')](logger[_0x99b0('0x5d')]('[swapAdditionalPhone]\x20'));};Preview[_0x99b0('0x11')][_0x99b0('0xb3')]=function(_0x1f29ed){return Promise[_0x99b0('0x105')]()[_0x99b0('0x84')](cmHopperAdditionalPhone[_0x99b0('0xb3')](_0x1f29ed))['catch'](logger['info'](_0x99b0('0x107')));};Preview[_0x99b0('0x11')]['checkInBlack']=function(_0x2baaba,_0x4e6b2d,_0x3594fe,_0x9881a7,_0x4ec3ca){var _0x145a12=this;return new Promise(function(_0x5e2c45,_0x33cef7){if(_[_0x99b0('0x6e')](_0x4e6b2d)||_['isNil'](_0x4e6b2d[_0x99b0('0x108')])||_[_0x99b0('0x6e')](_0x4e6b2d[_0x99b0('0x109')])||_['isNil'](_0x4e6b2d[_0x99b0('0x10a')])){_0x33cef7(ut[_0x99b0('0x4f')]('Contact\x20is\x20undefined',_0x9881a7,_0x4ec3ca));return;}var _0x49576e=uuid['v4']();var _0x51a537=_0x145a12[_0x99b0('0x15')][_0x4e6b2d[_0x99b0('0x70')][_0x99b0('0x2a')]];var _0x2f37ce=_0x3594fe?_0x145a12[_0x99b0('0x19')][_0x3594fe]['id']:undefined;_0x145a12[_0x99b0('0x18')][_0x49576e]=new Action(_0x4e6b2d,_0x51a537,_0x49576e,_0x3594fe,_0x2f37ce);var _0x3fefbe=_0x145a12[_0x99b0('0x18')][_0x49576e];_0x3fefbe['unlockAgent']=_0x9881a7;_0x3fefbe['activeContact']=_0x4ec3ca;_0x3fefbe[_0x99b0('0x10b')]=_0x3594fe;if(_[_0x99b0('0x10c')](_0x2baaba)){_0x145a12[_0x99b0('0x10d')](_0x3fefbe,_0x51a537,_0x4e6b2d,_0x3594fe)['then'](function(_0x4f3b4d){logger[_0x99b0('0x5d')](_0x99b0('0x10e'),_0x99b0('0x10f')+_0x3fefbe[_0x99b0('0x71')]+_0x99b0('0x110')+_0x3fefbe[_0x99b0('0xb4')],JSON[_0x99b0('0x59')](_0x4f3b4d));ami['emit'](_0x99b0('0x111'),ut[_0x99b0('0xbc')](_0x3fefbe,_0x99b0('0x112'),_0x145a12[_0x99b0('0x15')][_0x3fefbe[_0x99b0('0x71')]]));_0x5e2c45(ut['message'](_0x99b0('0x113')));})[_0x99b0('0x78')](function(_0xba18a1){ut['logger'](_0x99b0('0x114'),_0xba18a1);_0x33cef7(ut['message']('Call\x20failed',_0x9881a7,_0x4ec3ca));});}else{_0x51a537['outboundBlacklistCallsDay']+=0x1;ut[_0x99b0('0x115')](_0x3fefbe);rpcDb[_0x99b0('0x116')](_0x3fefbe,_0x99b0('0x117'));delete _0x145a12['actions'][_0x49576e];_0x33cef7(ut[_0x99b0('0x4f')](_0x99b0('0x118'),_0x9881a7,_0x4ec3ca));}});};Preview[_0x99b0('0x11')][_0x99b0('0x9c')]=function(_0x4b517f){return!_[_0x99b0('0x6e')](_0x4b517f)&&!_[_0x99b0('0x6e')](_0x4b517f[_0x99b0('0x2a')])&&!_[_0x99b0('0x6e')](_0x4b517f['active'])&&_0x4b517f[_0x99b0('0x119')]&&!_[_0x99b0('0x6e')](this['trunks'][util[_0x99b0('0x5a')]('SIP/%s',_0x4b517f[_0x99b0('0x2a')])])&&!_[_0x99b0('0x6e')](this[_0x99b0('0x17')][util[_0x99b0('0x5a')](_0x99b0('0x11a'),_0x4b517f['name'])][_0x99b0('0x76')])&&(this['trunks'][util[_0x99b0('0x5a')](_0x99b0('0x11a'),_0x4b517f['name'])][_0x99b0('0x76')]===_0x99b0('0x11b')||this[_0x99b0('0x17')][util[_0x99b0('0x5a')]('SIP/%s',_0x4b517f[_0x99b0('0x2a')])]['status']==='unmonitored');};Preview[_0x99b0('0x11')][_0x99b0('0x89')]=function(_0x3bc97d,_0x1a95fc){var _0x13a283=this;return new Promise(function(_0x328c0a,_0xade515){_0x13a283[_0x99b0('0x11c')](_0x3bc97d,_0x1a95fc)[_0x99b0('0x84')](function(_0x3d8894){_0x328c0a(_['pick'](_0x3d8894,[_0x99b0('0x4f')]));})['catch'](function(_0x37fccd){if(_0x37fccd[_0x99b0('0x11d')]){rpcDb[_0x99b0('0x11e')](_0x3bc97d);}if(_0x37fccd[_0x99b0('0x119')]){rpcDb[_0x99b0('0x8c')](_0x3bc97d);}_0xade515(_[_0x99b0('0x11f')](_0x37fccd,[_0x99b0('0x4f')]));});});};Preview[_0x99b0('0x11')][_0x99b0('0x11c')]=function(_0x2006dd,_0x4a88a2){var _0x1d2d4b=this;return new Promise(function(_0x3039af,_0x45027e){var _0x295b37,_0x2f2b22;rpcDb[_0x99b0('0x120')](_0x2006dd)[_0x99b0('0x84')](function(_0x21b679){if(!_[_0x99b0('0x6e')](_0x21b679[0x0])){_0x2f2b22=_0x21b679[0x0][_0x99b0('0x121')]?![]:!![];_0x295b37=_0x21b679[0x0][_0x99b0('0x121')]?!![]:![];_0x295b37=_0x4a88a2?!![]:_0x295b37;}var _0x405060=_0x1d2d4b[_0x99b0('0x122')](_0x21b679);if(_0x405060[_0x99b0('0x123')]){rpcDb[_0x99b0('0x124')](_[_0x99b0('0x11f')](_0x21b679[0x0],[_0x99b0('0x10a'),'phone']))[_0x99b0('0x84')](function(_0x30b46d){_0x1d2d4b['checkInBlack'](_0x30b46d,_0x21b679[0x0],_0x4a88a2,_0x2f2b22,_0x295b37)[_0x99b0('0x84')](function(_0x37e9df){_0x3039af(_0x37e9df);})[_0x99b0('0x78')](function(_0x126e30){_0x45027e(_0x126e30);});})['catch'](function(_0x1d907b){ut[_0x99b0('0x64')](_0x99b0('0x125'),_0x1d907b);_0x45027e(ut['message'](_0x99b0('0x126'),_0x2f2b22,_0x295b37));});}else{_0x45027e(ut[_0x99b0('0x4f')](_0x405060[_0x99b0('0x4f')],_0x2f2b22,_0x295b37));}})[_0x99b0('0x78')](function(_0x559796){ut[_0x99b0('0x64')](_0x99b0('0x127'),_0x559796);_0x45027e(ut[_0x99b0('0x4f')](_0x99b0('0x126'),![],!![]));});});};Preview[_0x99b0('0x11')][_0x99b0('0x122')]=function(_0x54eb2a){if(_[_0x99b0('0x6e')](_0x54eb2a)||_[_0x99b0('0x10c')](_0x54eb2a)||!_[_0x99b0('0x6e')](_0x54eb2a[0x0][_0x99b0('0x88')])&&_[_0x99b0('0x6e')](_0x54eb2a[0x0][_0x99b0('0x88')][_0x99b0('0x2a')])){ut[_0x99b0('0x64')](_0x99b0('0x128'),_0x54eb2a);return{'isValid':![],'message':_0x99b0('0x129')};}var _0x5d312b=this[_0x99b0('0x15')][_0x54eb2a[0x0][_0x99b0('0x70')][_0x99b0('0x2a')]];_0x5d312b[_0x99b0('0x4f')]=_0x99b0('0x9f');if(_['isNil'](_0x5d312b)){ut[_0x99b0('0x64')]('[Preview][validateContact][Empty\x20Campaign]',_0x5d312b);return{'isValid':![],'message':_0x99b0('0x12a')};}if(!this[_0x99b0('0x9c')](_0x5d312b['Trunk'])){ut[_0x99b0('0x64')](_0x99b0('0x12b'),_0x99b0('0x12c')+_0x5d312b[_0x99b0('0x2a')]+_0x99b0('0x12d'));if(!this['isTrunkReachable'](_0x5d312b['TrunkBackup'])){ut['logger'](_0x99b0('0x12b'),_0x5d312b[_0x99b0('0x2a')]+_0x99b0('0x12e'));return{'isValid':![],'message':_0x99b0('0x12f')};}}if(!ut[_0x99b0('0x9a')](_0x5d312b[_0x99b0('0x36')])){ut[_0x99b0('0x64')](_0x99b0('0x130'),_0x5d312b['name']+'\x20Not\x20Active');return{'isValid':![],'message':_0x99b0('0x12c')+_0x5d312b[_0x99b0('0x2a')]+_0x99b0('0x131')};}return{'isValid':!![],'message':_0x99b0('0x132')};};Preview[_0x99b0('0x11')][_0x99b0('0x10d')]=function(_0x495213,_0x390eab,_0x491a67,_0x552650){var _0x46b844=this;return new Promise(function(_0x5bb305,_0x4e8cae){var _0x424397=_0x495213[_0x99b0('0xba')];var _0x222e9b=_0x46b844[_0x99b0('0x9c')](_0x390eab[_0x99b0('0x56')])?util['format']('SIP/%s/%s%s',_0x390eab[_0x99b0('0x56')][_0x99b0('0x2a')],_[_0x99b0('0x6e')](_0x390eab[_0x99b0('0x133')])?'':_0x390eab[_0x99b0('0x133')]['trim']()||'',_0x390eab['dialCutDigit']>0x0?_0x491a67['phone']['substring'](_0x390eab[_0x99b0('0x134')]):_0x491a67['phone']):util['format']('SIP/%s/%s%s',_[_0x99b0('0x6e')](_0x390eab[_0x99b0('0x9d')])?_0x390eab[_0x99b0('0x56')][_0x99b0('0x2a')]:_0x390eab[_0x99b0('0x9d')][_0x99b0('0x2a')],_[_0x99b0('0x6e')](_0x390eab[_0x99b0('0x133')])?'':_0x390eab[_0x99b0('0x133')]['trim']()||'',_0x390eab[_0x99b0('0x134')]>0x0?_0x491a67[_0x99b0('0x109')][_0x99b0('0x135')](_0x390eab[_0x99b0('0x134')]):_0x491a67[_0x99b0('0x109')]);var _0x35b3f4=_0x46b844['isTrunkReachable'](_0x390eab[_0x99b0('0x56')])?ut[_0x99b0('0x136')](_0x390eab[_0x99b0('0x56')]['callerid'],_0x390eab[_0x99b0('0x38')],_0x390eab['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x99b0('0x137')](_0x390eab[_0x99b0('0x138')],_0x390eab[_0x99b0('0x139')]):_0x390eab[_0x99b0('0x138')]):ut[_0x99b0('0x136')](_[_0x99b0('0x6e')](_0x390eab[_0x99b0('0x9d')])?_0x390eab['Trunk'][_0x99b0('0x57')]:_0x390eab[_0x99b0('0x9d')][_0x99b0('0x57')],_0x390eab['dialOriginateCallerIdName'],_0x390eab[_0x99b0('0x139')]>0x0?ut[_0x99b0('0x137')](_0x390eab[_0x99b0('0x138')],_0x390eab[_0x99b0('0x139')]):_0x390eab[_0x99b0('0x138')]);if(_0x35b3f4){_0x495213[_0x99b0('0x13a')]=ut['extractCalleridName'](_0x35b3f4);_0x495213['originatecalleridnum']=ut[_0x99b0('0x13b')](_0x35b3f4);}var _0x5a0cb1=ut[_0x99b0('0x13c')](_0x390eab,_0x491a67,_0x222e9b,_0x35b3f4,_0x424397,_0x495213);_['merge'](_0x495213,ut[_0x99b0('0x13d')](_0x5a0cb1));_0x495213['starttime']=moment()[_0x99b0('0x5a')]('YYYY-MM-DD\x20HH:mm:ss');_0x390eab['variables']=_0x5a0cb1;ami['Action'](ut[_0x99b0('0x13e')](_0x495213,_0x390eab,_0x5a0cb1,_0x495213['activeContact'],_0x552650))[_0x99b0('0x84')](function(_0x45db6e){_0x390eab[_0x99b0('0x50')]+=0x1;logger[_0x99b0('0x5d')]('[originated][increment]',_0x424397,_0x99b0('0xbb'),_0x390eab[_0x99b0('0x2a')],_0x99b0('0x72'),_0x390eab[_0x99b0('0x50')]);_0x5bb305(_0x45db6e);})[_0x99b0('0x78')](function(_0x4f10fd){ut[_0x99b0('0xfe')](_0x495213,0xe,_0x99b0('0x13f'));rpcDb['createAgentHistory'](_0x495213,_0x99b0('0x140'));_0x4e8cae(_0x4f10fd);});});};Preview[_0x99b0('0x11')][_0x99b0('0x20')]=function(_0x2c2219){if(this[_0x99b0('0x18')][_0x2c2219['linkedid']]){this[_0x99b0('0x18')][_0x2c2219['linkedid']][_0x99b0('0x77')]=_0x2c2219[_0x99b0('0x77')];}};Preview[_0x99b0('0x11')][_0x99b0('0x141')]=function(_0x55e190){var _0x1d96b0=this;var _0x341398=this[_0x99b0('0x18')][_0x55e190['actionid']];if(_0x341398){if(_0x341398[_0x99b0('0x10b')]&&this[_0x99b0('0x19')][_0x341398['lookAgent']]){ut[_0x99b0('0x142')](_0x341398,this[_0x99b0('0x19')][_0x341398['lookAgent']]['name'],this['agents'][_0x341398[_0x99b0('0x10b')]]['id']);}var _0x2d2a2b=_[_0x99b0('0x143')](_0x341398);_0x2d2a2b[_0x99b0('0xb7')]=moment()['format'](_0x99b0('0x8d'));var _0x3530b1=_0x1d96b0[_0x99b0('0x15')][_0x341398[_0x99b0('0x71')]];if(ut[_0x99b0('0x144')](_0x55e190[_0x99b0('0x145')])){if(_0x341398[_0x99b0('0xb0')]){rpcDb[_0x99b0('0x11e')](_0x341398['idContact']);}if(_0x341398[_0x99b0('0xb1')]){rpcDb[_0x99b0('0x8c')](_0x341398[_0x99b0('0xb4')]);}ami[_0x99b0('0x60')]('custom:agentringnoanswer',ut[_0x99b0('0xbc')](_0x341398,_0x99b0('0x146'),this[_0x99b0('0x15')][_0x341398[_0x99b0('0x71')]]));this[_0x99b0('0xfb')](_0x2d2a2b,_0x3530b1,_0x55e190);}else{_0x341398[_0x99b0('0x147')]=moment()['format'](_0x99b0('0x8d'));ut[_0x99b0('0xfe')](_0x2d2a2b,0x4,_0x99b0('0xc6'));rpcDb[_0x99b0('0xff')](_0x2d2a2b,_0x99b0('0x148'));}}};Preview[_0x99b0('0x11')][_0x99b0('0x149')]=function(_0x4413fa){var _0x1fe753=this[_0x99b0('0x18')][_0x4413fa[_0x99b0('0xb2')]];var _0x52fc67;if(_0x1fe753){_0x52fc67=this[_0x99b0('0x15')][_0x1fe753[_0x99b0('0x71')]];logger[_0x99b0('0x5d')](_0x99b0('0x14a'),_0x4413fa[_0x99b0('0xb2')],_0x99b0('0xbb'),_0x52fc67[_0x99b0('0x2a')],_0x99b0('0xca'),_0x52fc67[_0x99b0('0x2f')]);}if(this[_0x99b0('0x18')][_0x4413fa[_0x99b0('0xb2')]]&&_0x4413fa[_0x99b0('0xb2')]!==_0x4413fa[_0x99b0('0xba')]){if(_0x4413fa[_0x99b0('0x14b')]==='16'&&this['actions'][_0x4413fa[_0x99b0('0xb2')]][_0x99b0('0x73')]){this[_0x99b0('0x14c')](_0x4413fa,_0x4413fa[_0x99b0('0xb2')],_0x4413fa[_0x99b0('0x14b')]);}else if(this[_0x99b0('0x18')][_0x4413fa['linkedid']]['dialAnswer']){logger[_0x99b0('0x5d')](_0x99b0('0x14d'),_0x4413fa[_0x99b0('0xb2')],_0x4413fa[_0x99b0('0x14b')],'\x20Queue',_0x52fc67[_0x99b0('0x2a')],_0x99b0('0xca'),_0x52fc67['pTalking']);this['callProgressDetectingCustomer'](_0x4413fa,_0x4413fa['linkedid'],_0x4413fa[_0x99b0('0x14b')]);}}else if(_0x1fe753&&_['isNil'](_0x1fe753['statedesc'])&&_0x52fc67[_0x99b0('0x14e')]&&_0x4413fa[_0x99b0('0xb2')]===_0x4413fa['uniqueid']&&_[_0x99b0('0x6e')](_0x4413fa['reason'])&&_0x4413fa[_0x99b0('0x14b')]==='16'&&_0x4413fa['channelstate']==='6'&&_['isUndefined'](_0x1fe753[_0x99b0('0x14f')])){if(_0x1fe753[_0x99b0('0xb0')]){rpcDb['unlockContact'](_0x1fe753[_0x99b0('0xb4')]);}if(_0x1fe753[_0x99b0('0xb1')]){rpcDb[_0x99b0('0x8c')](_0x1fe753[_0x99b0('0xb4')]);}_0x4413fa[_0x99b0('0xfd')]='22';this[_0x99b0('0xfb')](_0x1fe753,_0x52fc67,_0x4413fa);}else if(_0x1fe753&&_0x1fe753['transfer']){if(_0x4413fa[_0x99b0('0x14b')]==='16'&&this['actions'][_0x4413fa[_0x99b0('0xb2')]][_0x99b0('0x73')]){logger[_0x99b0('0x5d')](_0x99b0('0x150'),_0x4413fa[_0x99b0('0xb2')],_0x4413fa[_0x99b0('0x14b')],_0x99b0('0xbb'),_0x52fc67[_0x99b0('0x2a')],_0x99b0('0xca'),_0x52fc67[_0x99b0('0x2f')]);this['callProgressDetectingCustomer'](_0x4413fa,_0x4413fa[_0x99b0('0xb2')],_0x4413fa[_0x99b0('0x14b')]);}else if(this[_0x99b0('0x18')][_0x4413fa[_0x99b0('0xb2')]][_0x99b0('0x73')]){logger[_0x99b0('0x5d')](_0x99b0('0x14d'),_0x4413fa[_0x99b0('0xb2')],_0x4413fa[_0x99b0('0x14b')],_0x99b0('0xbb'),_0x52fc67[_0x99b0('0x2a')],_0x99b0('0xca'),_0x52fc67[_0x99b0('0x2f')]);this['callProgressDetectingCustomer'](_0x4413fa,_0x4413fa[_0x99b0('0xb2')],_0x4413fa[_0x99b0('0x14b')]);}}};Preview[_0x99b0('0x11')]['syncDialEnd']=function(_0x346ea1){if(this[_0x99b0('0x18')][_0x346ea1['destlinkedid']]&&_0x346ea1['destlinkedid']!==_0x346ea1['destuniqueid']){this[_0x99b0('0x14c')](_0x346ea1,_0x346ea1[_0x99b0('0xfa')],_0x346ea1[_0x99b0('0xf1')]);}};Preview['prototype'][_0x99b0('0x1d')]=function(_0x4b5261){if(this['actions'][_0x4b5261['linkedid']]&&_0x4b5261['linkedid']!==_0x4b5261[_0x99b0('0xba')]&&!this[_0x99b0('0x18')][_0x4b5261[_0x99b0('0xb2')]]['dialAnswer']){if(_0x4b5261['cause']==='1'){this[_0x99b0('0x14c')](_0x4b5261,_0x4b5261[_0x99b0('0xb2')],_0x4b5261[_0x99b0('0x14b')]);}}};Preview[_0x99b0('0x11')][_0x99b0('0x151')]=function(_0x1c2897,_0x10f95d,_0x2d3eae){if(this[_0x99b0('0x18')][_0x1c2897]){if(_['isNil'](this['actions'][_0x1c2897][_0x99b0('0x152')])){this['actions'][_0x1c2897]['variables']={};}this[_0x99b0('0x18')][_0x1c2897]['variables'][_0x10f95d]=_0x2d3eae;}};Preview['prototype'][_0x99b0('0x22')]=function(_0x4e3572){try{if(!_[_0x99b0('0x6e')](_0x4e3572)){if(ut[_0x99b0('0x153')](_[_0x99b0('0x154')](_0x4e3572[_0x99b0('0x155')])[0x0])){this['addVariable'](_0x4e3572[_0x99b0('0xba')],_[_0x99b0('0x154')](_0x4e3572[_0x99b0('0x155')])[0x0],_0x4e3572[_0x99b0('0x156')]);}}}catch(_0x4106ab){logger[_0x99b0('0x157')](_0x99b0('0x158'),util[_0x99b0('0x159')](_0x4106ab,{'showHidden':![],'depth':null}));}};Preview[_0x99b0('0x11')][_0x99b0('0x24')]=function(_0x205e49){if(_0x205e49){if(this['actions'][_0x205e49['transfertargetlinkedid']]){this['actions'][_0x205e49[_0x99b0('0x15a')]][_0x99b0('0x14f')]=!![];}}};Preview[_0x99b0('0x11')][_0x99b0('0x26')]=function(_0x1311c4){if(_0x1311c4){if(this[_0x99b0('0x18')][_0x1311c4[_0x99b0('0x15b')]]){this[_0x99b0('0x18')][_0x1311c4[_0x99b0('0x15b')]][_0x99b0('0x14f')]=!![];}}};module[_0x99b0('0x15c')]=Preview; \ No newline at end of file +var _0x3d64=['buildNoAnswerEventPayload','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','CONGESTION','Congestion','dialCongestionRetryFrequency','congestion','[callProgressDetectingCustomer][logCongestion]','countcongestionretry','dialAgentRejectRetryFrequency','agentreject','AgentReject','[callProgressDetectingCustomer][logAgentReject]','countagentrejectretry','dialAgentRejectMaxRetry','ABANDONED','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','countabandonedretry','dialAbandonedRetryFrequency','cause-txt','dialstatus','amd','[callProgressDetectingCustomer][hangupInAMD]','outboundUnknownCallsDay','custom:amd','[callProgressDetectingCustomer][machine]','[default]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','isUndefined','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','Busy','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','resolve','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','[incrementPreviewCounters]\x20','Contact','Contact\x20is\x20undefined','lookAgent','execCall','[Preview][execCall][success]','\x20IdHopper:\x20','custom:agentcalled','Calling','[Preview][execCall][failure]','Call\x20failed','outboundBlacklistCallsDay','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','reachable','unmonitored','unlock','unlockContact','execRun','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','phone','checkInBlack','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','trim','dialCutDigit','substring','getCallerId','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','extractCalleridName','originatecalleridnum','merge','toLowerVariables','variables','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','isFailure','response','custom:agentringnoanswer','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','transfer','[syncHangup][talking][transfer]','filterKey','variable','keys','value','error','[syncVarSet][Preview]','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','md5','../../../config/environment','preview','../../../config/logger','../ami','./rpcDb','../rpc/cmHopperAdditionalPhone','./action','./util/util','redis','defaults','localhost','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','syncDialEnd','syncVarSet','attendedtransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','type','outbound','name','strategy','answered','available','loggedIn','sumBillable','sumHoldTime','talking','total','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','format','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','pTalking','paused','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','DEACTIVATED','\x20is\x20deactivated','syncCampaigns','prototype','hasOwnProperty','booked','clearZombieChannels','setMessage','dialPreviewAutoRecallMe','clearZombieChannel','isNil','Queue','originated:\x20','queue','dialAnswer','pick','contactId','UserId','VoiceQueueId','ListId','Action','status','channel','catch','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','recallMe','agentReadyId','then','getDiff','dialRecallMeTimeout','Agent','run','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','createCustomerHistory','createCustomerFinal','[HistoryRecallClose]','[getContactRecallMe]','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','NOT_ACTIVE','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countglobal','totalGlobal','buildObj','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','countnosuchnumberretry','dialNoSuchNumberMaxRetry','scheduledAt','unlockAgent','activeContact','linkedid','idContact','swapAdditionalPhones','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','acw','custom:agentConnectPreview','buildAcw','complete','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','[syncHangup][talking][decrement]','pTalking:\x20','BUSY','countbusyretry','dialBusyRetryFrequency','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','cloneAction','[callProgressDetectingCustomer][logBusyGlobal]','rescheduleContact','incrementPreviewCounters','NOANSWER','countnoanswerretry','NoAnswer','dialNoAnswerRetryFrequency'];(function(_0x102411,_0x2c0b2b){var _0x2c904e=function(_0x47276b){while(--_0x47276b){_0x102411['push'](_0x102411['shift']());}};_0x2c904e(++_0x2c0b2b);}(_0x3d64,0x81));var _0x43d6=function(_0x45753c,_0x382f6b){_0x45753c=_0x45753c-0x0;var _0x457747=_0x3d64[_0x45753c];return _0x457747;};'use strict';var util=require(_0x43d6('0x0'));var _=require(_0x43d6('0x1'));var uuid=require('uuid');var moment=require('moment');var md5=require(_0x43d6('0x2'));var Redis=require('ioredis');var config=require(_0x43d6('0x3'));var logger=require('../../../config/logger')(_0x43d6('0x4'));var loggerAction=require(_0x43d6('0x5'))('actionPreview');var ami=require(_0x43d6('0x6'));var rpcDb=require(_0x43d6('0x7'));var cmHopperAdditionalPhone=require(_0x43d6('0x8'));var Action=require(_0x43d6('0x9'));var ut=require(_0x43d6('0xa'));config[_0x43d6('0xb')]=_[_0x43d6('0xc')](config['redis'],{'host':_0x43d6('0xd'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x43d6('0xb')]));var Sequence=function(){};Sequence['prototype'][_0x43d6('0xe')]=function(_0x4c6eee){this[_0x43d6('0xf')]=this[_0x43d6('0xf')]?this['tail'][_0x43d6('0x10')](_0x4c6eee):_0x4c6eee();};function Preview(_0xb62fcd){this[_0x43d6('0x11')]=new Sequence();this[_0x43d6('0x12')]=_0xb62fcd[_0x43d6('0x13')];this['trunks']=_0xb62fcd[_0x43d6('0x14')];this[_0x43d6('0x15')]={};this[_0x43d6('0x16')]=_0xb62fcd[_0x43d6('0x16')];this[_0x43d6('0x17')]=0x0;ami['on']('originateresponse',this[_0x43d6('0x18')][_0x43d6('0x19')](this));ami['on'](_0x43d6('0x1a'),this[_0x43d6('0x1b')][_0x43d6('0x19')](this));ami['on'](_0x43d6('0x1c'),this[_0x43d6('0x1d')][_0x43d6('0x19')](this));ami['on']('dialend',this[_0x43d6('0x1e')]['bind'](this));ami['on']('newexten',this['syncNewExten'][_0x43d6('0x19')](this));ami['on']('varset',this[_0x43d6('0x1f')][_0x43d6('0x19')](this));ami['on'](_0x43d6('0x20'),this['syncAttendedTransfer'][_0x43d6('0x19')](this));ami['on'](_0x43d6('0x21'),this[_0x43d6('0x22')][_0x43d6('0x19')](this));this[_0x43d6('0x23')](this[_0x43d6('0x12')]);}function emit(_0x5e1c22,_0x3d35fc,_0x4d9800){io['to'](_0x5e1c22)[_0x43d6('0x24')](_0x3d35fc,_0x4d9800);}function emitCampaignPreview(_0x4eb967){if(_0x4eb967[_0x43d6('0x25')]===_0x43d6('0x26')){var _0x50a830={'id':_0x4eb967['id'],'name':_0x4eb967[_0x43d6('0x27')],'strategy':_0x4eb967[_0x43d6('0x28')],'answered':_0x4eb967[_0x43d6('0x29')],'available':_0x4eb967[_0x43d6('0x2a')],'loggedIn':_0x4eb967[_0x43d6('0x2b')],'pTalking':_0x4eb967['pTalking'],'sumBillable':_0x4eb967[_0x43d6('0x2c')],'sumDuration':_0x4eb967['sumDuration'],'sumHoldTime':_0x4eb967[_0x43d6('0x2d')]||0x0,'talking':_0x4eb967[_0x43d6('0x2e')],'total':_0x4eb967[_0x43d6('0x2f')],'type':_0x4eb967[_0x43d6('0x25')],'unmanaged':_0x4eb967['unmanaged'],'abandoned':_0x4eb967['abandoned'],'waiting':_0x4eb967[_0x43d6('0x30')],'loggedInDb':_0x4eb967[_0x43d6('0x31')],'dialActive':_0x4eb967[_0x43d6('0x32')],'dialMethod':_0x4eb967[_0x43d6('0x33')],'dialOriginateCallerIdName':_0x4eb967[_0x43d6('0x34')],'dialOriginateCallerIdNumber':_0x4eb967['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x4eb967['dialOriginateTimeout'],'dialPrefix':_0x4eb967[_0x43d6('0x35')],'outboundAnswerAgiCallsDay':_0x4eb967[_0x43d6('0x36')],'outboundAnswerCallsDay':_0x4eb967[_0x43d6('0x37')],'outboundBlacklistCallsDay':_0x4eb967['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x4eb967[_0x43d6('0x38')],'outboundCongestionCallsDay':_0x4eb967[_0x43d6('0x39')],'outboundDropCallsDayACS':_0x4eb967[_0x43d6('0x3a')],'outboundDropCallsDayCallersExit':_0x4eb967['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x4eb967[_0x43d6('0x3b')],'outboundNoAnswerCallsDay':_0x4eb967[_0x43d6('0x3c')],'outboundNoSuchCallsDay':_0x4eb967[_0x43d6('0x3d')],'outboundOriginateFailureCallsDay':_0x4eb967[_0x43d6('0x3e')],'outboundReCallsDay':_0x4eb967[_0x43d6('0x3f')],'outboundRejectCallsDay':_0x4eb967[_0x43d6('0x40')],'outboundUnknownCallsDay':_0x4eb967['outboundUnknownCallsDay'],'outboundAbandonedCallsDay':_0x4eb967[_0x43d6('0x41')],'predictiveIntervalAnsweredCalls':_0x4eb967[_0x43d6('0x42')],'predictiveIntervalAvgHoldtime':_0x4eb967['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x4eb967[_0x43d6('0x43')],'predictiveIntervalDroppedCallsCallersExit':_0x4eb967[_0x43d6('0x44')],'predictiveIntervalDroppedCallsTimeout':_0x4eb967['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x4eb967[_0x43d6('0x45')],'predictiveIntervalErlangCallsDroppedCalls':_0x4eb967[_0x43d6('0x46')],'predictiveIntervalHitRate':_0x4eb967[_0x43d6('0x47')],'predictiveIntervalMultiplicativeFactor':_0x4eb967[_0x43d6('0x48')],'predictiveIntervalPauses':_0x4eb967[_0x43d6('0x49')],'predictiveIntervalAvailable':_0x4eb967['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x4eb967[_0x43d6('0x4a')],'message':_0x4eb967[_0x43d6('0x4b')],'originated':_0x4eb967[_0x43d6('0x4c')],'erlangCalls':_0x4eb967[_0x43d6('0x4d')],'erlangCallToSecond':_0x4eb967[_0x43d6('0x4e')],'erlangAbandonmentRate':_0x4eb967[_0x43d6('0x4f')],'erlangBusyFactor':_0x4eb967[_0x43d6('0x50')],'startPredictive':_0x4eb967[_0x43d6('0x51')],'startProgressive':_0x4eb967[_0x43d6('0x52')]};if(_0x4eb967[_0x43d6('0x53')]){_0x50a830[_0x43d6('0x53')]={'id':_0x4eb967[_0x43d6('0x53')]['id'],'name':_0x4eb967['Trunk'][_0x43d6('0x27')],'active':_0x4eb967[_0x43d6('0x53')][_0x43d6('0x54')],'callerid':_0x4eb967['Trunk'][_0x43d6('0x55')]};}if(_0x4eb967[_0x43d6('0x56')]){_0x50a830[_0x43d6('0x56')]={'id':_0x4eb967[_0x43d6('0x56')]['id'],'name':_0x4eb967[_0x43d6('0x56')][_0x43d6('0x27')]};}var _0x28c71d=md5(JSON['stringify'](_0x50a830));if(_0x4eb967[_0x43d6('0x2')]!==_0x28c71d){_0x4eb967[_0x43d6('0x2')]=_0x28c71d;emit(util[_0x43d6('0x57')](_0x43d6('0x58'),_0x50a830[_0x43d6('0x27')]),_0x43d6('0x59'),_0x50a830);}}}function emitVoiceQueueChannelRemove(_0x1fb05d){logger[_0x43d6('0x5a')](_0x43d6('0x5b'),JSON[_0x43d6('0x5c')](_0x1fb05d));emit(util[_0x43d6('0x57')](_0x43d6('0x58'),_0x1fb05d[_0x43d6('0x27')]),_0x43d6('0x5d'),_0x1fb05d);io[_0x43d6('0x24')](_0x43d6('0x5e'),_0x1fb05d);}function notSendMessagesQueue(_0x424a79){if(_0x424a79[_0x43d6('0x5f')]){if(_0x424a79[_0x43d6('0x4c')]===0x0&&_0x424a79[_0x43d6('0x60')]===0x0){_0x424a79[_0x43d6('0x5f')]=![];_0x424a79[_0x43d6('0x2a')]=0x0;_0x424a79[_0x43d6('0x61')]=0x0;_0x424a79[_0x43d6('0x4b')]='NOT_ACTIVE';ut[_0x43d6('0x62')](_0x43d6('0x63'),_0x424a79[_0x43d6('0x27')]+_0x43d6('0x64'));}else{_0x424a79['message']=_0x43d6('0x65');ut[_0x43d6('0x62')](_0x43d6('0x63'),_0x424a79['name']+_0x43d6('0x66'));}emitCampaignPreview(_0x424a79);}}Preview['prototype'][_0x43d6('0x23')]=function(){var _0x5858e2=this;setInterval(function(){_0x5858e2[_0x43d6('0x67')]();},0x7cf);};Preview[_0x43d6('0x68')][_0x43d6('0x67')]=function(){var _0x12a983=this[_0x43d6('0x12')];this['clockClearZombieChannels']+=0x1;for(var _0x21f8b6 in _0x12a983){if(_0x12a983[_0x43d6('0x69')](_0x21f8b6)&&(_0x12a983[_0x21f8b6][_0x43d6('0x33')]===_0x43d6('0x4')||_0x12a983[_0x21f8b6][_0x43d6('0x33')]===_0x43d6('0x6a'))&&_0x12a983[_0x21f8b6][_0x43d6('0x25')]==='outbound'){if(this[_0x43d6('0x17')]>0x7){this[_0x43d6('0x17')]=0x0;this[_0x43d6('0x6b')]();}}if(_0x12a983[_0x43d6('0x69')](_0x21f8b6)&&_0x12a983[_0x21f8b6][_0x43d6('0x33')]===_0x43d6('0x4')&&_0x12a983[_0x21f8b6][_0x43d6('0x25')]==='outbound'){if(_0x12a983[_0x21f8b6][_0x43d6('0x32')]){this[_0x43d6('0x6c')](_0x12a983[_0x21f8b6]);if(_0x12a983[_0x21f8b6][_0x43d6('0x6d')])this['recallMe'](_0x12a983[_0x21f8b6]);}else{notSendMessagesQueue(_0x12a983[_0x21f8b6]);}}}};Preview[_0x43d6('0x68')][_0x43d6('0x6e')]=function(_0x3fd269){var _0x338cd9=this;this[_0x43d6('0x11')]['enqueue'](function(){if(!_[_0x43d6('0x6f')](_0x338cd9[_0x43d6('0x15')][_0x3fd269])){loggerAction['info']('[clearZombieChannels][talking]',_0x3fd269,_0x43d6('0x70'),_0x338cd9['actions'][_0x3fd269]['queue'],_0x43d6('0x71'),JSON[_0x43d6('0x5c')](_0x338cd9[_0x43d6('0x12')][_0x338cd9[_0x43d6('0x15')][_0x3fd269][_0x43d6('0x72')]][_0x43d6('0x4c')]),'pTalking:\x20',JSON['stringify'](_0x338cd9[_0x43d6('0x12')][_0x338cd9[_0x43d6('0x15')][_0x3fd269]['queue']][_0x43d6('0x60')]),JSON[_0x43d6('0x5c')](_0x338cd9[_0x43d6('0x15')][_0x3fd269][_0x43d6('0x73')]),JSON[_0x43d6('0x5c')](_[_0x43d6('0x74')](_0x338cd9[_0x43d6('0x15')][_0x3fd269],[_0x43d6('0x75'),_0x43d6('0x76'),_0x43d6('0x77'),_0x43d6('0x78')])));return ami[_0x43d6('0x79')]({'action':_0x43d6('0x7a'),'channel':_0x338cd9[_0x43d6('0x15')][_0x3fd269][_0x43d6('0x7b')]})[_0x43d6('0x7c')](function(_0x1872fa){if(_0x1872fa['message']==='No\x20such\x20channel'){setTimeout(function(){if(_0x338cd9[_0x43d6('0x15')][_0x3fd269]){ut['updateOriginated'](_0x338cd9[_0x43d6('0x12')][_0x338cd9[_0x43d6('0x15')][_0x3fd269][_0x43d6('0x72')]],_0x43d6('0x7d'));if(_0x338cd9[_0x43d6('0x15')][_0x3fd269][_0x43d6('0x73')]===!![]){ut[_0x43d6('0x7e')](_0x338cd9[_0x43d6('0x12')][_0x338cd9[_0x43d6('0x15')][_0x3fd269][_0x43d6('0x72')]],_0x43d6('0x7d'));ut[_0x43d6('0x7f')](_0x43d6('0x80')+_0x3fd269,_0x338cd9[_0x43d6('0x15')][_0x3fd269][_0x43d6('0x72')]);}ut['loggerError'](_0x43d6('0x81')+_0x3fd269,_0x338cd9[_0x43d6('0x15')][_0x3fd269]['queue']);delete _0x338cd9['actions'][_0x3fd269];}},0x2328);}});}});};Preview[_0x43d6('0x68')][_0x43d6('0x6b')]=function(){var _0x1b2756=this;loggerAction[_0x43d6('0x5a')](_0x43d6('0x82'),_[_0x43d6('0x83')](this[_0x43d6('0x15')]));for(var _0x1f7ccd in this['actions']){if(_0x1b2756['actions']['hasOwnProperty'](_0x1f7ccd)){_0x1b2756[_0x43d6('0x6e')](_0x1f7ccd);}}};Preview[_0x43d6('0x68')][_0x43d6('0x84')]=function(_0x1e0bff){var _0x5c0e00=this;rpcDb['getContactRecallMe'](_0x1e0bff['id'],ut[_0x43d6('0x85')](this[_0x43d6('0x16')]))[_0x43d6('0x86')](function(_0x478da8){if(!_[_0x43d6('0x6f')](_0x478da8)){for(var _0x50c40f=0x0;_0x50c40f<_0x478da8['length'];_0x50c40f+=0x1){if(ut[_0x43d6('0x87')](_0x478da8[_0x50c40f]['scheduledat'])<_0x1e0bff[_0x43d6('0x88')]*0x3c){if(_0x478da8[_0x50c40f][_0x43d6('0x89')]&&!_0x478da8[_0x50c40f][_0x43d6('0x89')]['voicePause']){_0x5c0e00[_0x43d6('0x8a')](_0x478da8[_0x50c40f]['id'])['then'](ut[_0x43d6('0x8b')]('[RecallMe]'))['catch'](ut[_0x43d6('0x8b')](_0x43d6('0x8c')));}else{rpcDb[_0x43d6('0x8d')](_0x478da8[_0x50c40f]['id']);}}else{var _0x5e16ed=new Action(_0x478da8[_0x50c40f],_0x1e0bff);_0x5e16ed[_0x43d6('0x8e')]=moment()[_0x43d6('0x57')](_0x43d6('0x8f'));_0x1e0bff[_0x43d6('0x3f')]+=0x1;ut[_0x43d6('0x90')](_0x5e16ed,0x17,_0x43d6('0x91'));if(_0x1e0bff[_0x43d6('0x92')]){rpcDb[_0x43d6('0x93')](ut[_0x43d6('0x94')](_0x478da8[_0x50c40f]));rpcDb['createCustomerHistory'](_0x5e16ed,_0x43d6('0x95'));}else{ut[_0x43d6('0x90')](_0x5e16ed,0x16,_0x43d6('0x96'));rpcDb[_0x43d6('0x97')](_0x5e16ed,'[HistoryRecallClose]');rpcDb[_0x43d6('0x98')](_0x5e16ed,_0x43d6('0x99'));}}}}})[_0x43d6('0x7c')](ut['logger2'](_0x43d6('0x9a')));};Preview[_0x43d6('0x68')][_0x43d6('0x6c')]=function(_0x4666da){_0x4666da[_0x43d6('0x5f')]=!![];if(ut[_0x43d6('0x9b')](_0x4666da[_0x43d6('0x2b')])){_0x4666da[_0x43d6('0x4b')]=_0x43d6('0x9c');}else if(!ut[_0x43d6('0x9d')](_0x4666da[_0x43d6('0x32')])){_0x4666da['message']=_0x43d6('0x9e');}else if(!this[_0x43d6('0x9f')](_0x4666da[_0x43d6('0x53')])){if(!this['isTrunkReachable'](_0x4666da[_0x43d6('0xa0')])){_0x4666da['message']=_0x43d6('0xa1');}else{_0x4666da['message']=_0x43d6('0xa2');}}else{_0x4666da[_0x43d6('0x4b')]=_0x43d6('0xa2');}emitCampaignPreview(_0x4666da);};Preview['prototype'][_0x43d6('0xa3')]=function(_0x130686,_0x134f29,_0x4a1196){var _0x1b5647=this;var _0x46857d=this[_0x43d6('0x15')][_0x134f29];var _0x549799=this[_0x43d6('0x12')][_0x46857d[_0x43d6('0x72')]];var _0x5f4b71;var _0x41ee61=![];var _0x5ab696=0x2;var _0x5840eb=0x3;if(_0x549799){switch(_0x4a1196){case'1':_0x549799['outboundNoSuchCallsDay']+=0x1;_0x46857d['countnosuchnumberretry']+=0x1;_0x46857d[_0x43d6('0xa4')]=ut[_0x43d6('0xa5')](_0x46857d);ut[_0x43d6('0x90')](_0x46857d,0x0,'NoSuchNumber');ami['emit']('custom:agentnosuchnumber',ut[_0x43d6('0xa6')](_0x46857d,'nosuchnumber'));rpcDb[_0x43d6('0x97')](_0x46857d,_0x43d6('0xa7'));_0x1b5647[_0x43d6('0xa8')](_0x46857d,'0',_0x549799)['then'](function(_0x53d0a5){_0x41ee61=_0x53d0a5[_0x43d6('0xa9')]==0x1;_0x5ab696=_0x549799[_0x43d6('0xaa')];_0x5840eb=_0x549799[_0x43d6('0xab')];if(!_0x41ee61){if(ut['totalGlobal'](_0x46857d)>=_0x549799[_0x43d6('0xac')]){_0x5f4b71=ut['cloneAction'](_0x46857d,0xf,_0x43d6('0xad'));rpcDb[_0x43d6('0x98')](_0x5f4b71,_0x43d6('0xae'));}else{if(_0x46857d[_0x43d6('0xaf')]>=_0x549799[_0x43d6('0xb0')]){rpcDb['createCustomerFinal'](_0x46857d,_0x43d6('0xae'));}else{rpcDb['rescheduleContact'](ut[_0x43d6('0xb1')](_0x46857d,_0x43d6('0xaf'),_0x549799['dialNoSuchNumberRetryFrequency']),_0x46857d[_0x43d6('0xb2')],_0x46857d[_0x43d6('0xb3')]);}}delete this[_0x43d6('0x15')][_0x130686[_0x43d6('0xb4')]];}else{_0x46857d[_0x43d6('0xaf')]++;logger[_0x43d6('0x5a')]('actioncountonusuch',_0x46857d[_0x43d6('0xaf')]);logger[_0x43d6('0x5a')]('id',_0x46857d[_0x43d6('0xb5')]);_0x1b5647['incrementPreviewCounters']({'id':_0x46857d[_0x43d6('0xb5')],'field':{'countnosuchnumberretry':_0x46857d[_0x43d6('0xaf')]}})[_0x43d6('0x86')](function(){_0x1b5647[_0x43d6('0xb6')](_0x46857d,_0x5ab696,_0x5840eb)[_0x43d6('0x86')](function(){});});}});break;case _0x43d6('0xb7'):var _0x316718=moment()[_0x43d6('0x57')](_0x43d6('0x8f'));_0x46857d[_0x43d6('0xb8')]=_0x316718;_0x46857d[_0x43d6('0xb9')]=_0x316718;_0x46857d['dialAnswer']=!![];_0x549799[_0x43d6('0x60')]+=0x1;logger['info'](_0x43d6('0xba'),_0x46857d[_0x43d6('0xbb')],_0x43d6('0xbc'),_0x549799['name'],'pTalking:\x20',_0x549799[_0x43d6('0x60')]);ami['emit']('custom:agentconnect',ut[_0x43d6('0xa6')](_0x46857d,'connect',this[_0x43d6('0x12')][_0x46857d[_0x43d6('0x72')]]));if(_0x549799[_0x43d6('0xbd')]){ami[_0x43d6('0x24')](_0x43d6('0xbe'),ut[_0x43d6('0xbf')](_0x46857d));}break;case'16':ami[_0x43d6('0x24')]('custom:agentcomplete',ut[_0x43d6('0xa6')](_0x46857d,_0x43d6('0xc0'),this[_0x43d6('0x12')][_0x46857d[_0x43d6('0x72')]]));emitVoiceQueueChannelRemove(ut[_0x43d6('0xa6')](_0x46857d,_0x43d6('0xc0')));_0x549799[_0x43d6('0x37')]+=0x1;_0x549799[_0x43d6('0x2f')]+=0x1;_0x549799[_0x43d6('0x29')]+=0x1;ut[_0x43d6('0x7e')](_0x549799,'[16]');_0x46857d[_0x43d6('0xa4')]=ut[_0x43d6('0xa5')](_0x46857d);ut[_0x43d6('0x90')](_0x46857d,0x4,'Answer');rpcDb[_0x43d6('0x97')](_0x46857d,'[callProgressDetectingCustomer][logAnswer]');rpcDb[_0x43d6('0x98')](_0x46857d,_0x43d6('0xc1'));rpcDb[_0x43d6('0xc2')](_0x46857d);_0x549799[_0x43d6('0xc3')]+=_0x46857d[_0x43d6('0xc4')];_0x549799[_0x43d6('0x2c')]+=_0x46857d[_0x43d6('0xc4')];logger[_0x43d6('0x5a')](_0x43d6('0xc5'),_0x46857d['uniqueid'],'\x20Queue',_0x549799[_0x43d6('0x27')],_0x43d6('0xc6'),_0x549799['pTalking']);delete this[_0x43d6('0x15')][_0x130686[_0x43d6('0xb4')]];break;case _0x43d6('0xc7'):_0x549799[_0x43d6('0x38')]+=0x1;_0x46857d[_0x43d6('0xc8')]+=0x1;_0x46857d[_0x43d6('0xa4')]=ut['totalGlobal'](_0x46857d);ut[_0x43d6('0x90')](_0x46857d,0x5,'Busy');_0x5ab696=_0x549799[_0x43d6('0xc9')];_0x5840eb=_0x549799[_0x43d6('0xab')];ami[_0x43d6('0x24')](_0x43d6('0xca'),ut[_0x43d6('0xa6')](_0x46857d,_0x43d6('0xcb')));rpcDb[_0x43d6('0x97')](_0x46857d,_0x43d6('0xcc'));_0x1b5647[_0x43d6('0xa8')](_0x46857d,'5',_0x549799)[_0x43d6('0x86')](function(_0x12b25f){_0x41ee61=_0x12b25f[_0x43d6('0xa9')]==0x1;if(!_0x41ee61){if(ut['totalGlobal'](_0x46857d)>=_0x549799[_0x43d6('0xac')]){_0x5f4b71=ut[_0x43d6('0xcd')](_0x46857d,0xf,_0x43d6('0xad'));rpcDb[_0x43d6('0x98')](_0x5f4b71,_0x43d6('0xce'));}else{if(_0x46857d[_0x43d6('0xc8')]>=_0x549799['dialBusyMaxRetry']){rpcDb[_0x43d6('0x98')](_0x46857d,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0x43d6('0xcf')](ut[_0x43d6('0xb1')](_0x46857d,_0x43d6('0xc8'),_0x549799['dialBusyRetryFrequency']),_0x46857d['unlockAgent'],_0x46857d[_0x43d6('0xb3')]);}}}else{_0x46857d['countbusyretry']++;_0x1b5647[_0x43d6('0xd0')]({'id':_0x46857d[_0x43d6('0xb5')],'field':{'countbusyretry':_0x46857d['countbusyretry']}})['then'](function(){_0x1b5647[_0x43d6('0xb6')](_0x46857d,_0x5ab696,_0x5840eb)[_0x43d6('0x86')](function(){});});}});break;case _0x43d6('0xd1'):_0x549799['outboundNoAnswerCallsDay']+=0x1;_0x46857d[_0x43d6('0xd2')]+=0x1;_0x46857d[_0x43d6('0xa4')]=ut[_0x43d6('0xa5')](_0x46857d);ut[_0x43d6('0x90')](_0x46857d,0x3,_0x43d6('0xd3'));_0x5ab696=_0x549799[_0x43d6('0xd4')];_0x5840eb=_0x549799[_0x43d6('0xab')];var _0x3dd4fe=ut[_0x43d6('0xd5')](_0x46857d,_0x549799);ami['emit'](_0x43d6('0xd6'),_0x3dd4fe);rpcDb[_0x43d6('0x97')](_0x46857d,_0x43d6('0xd7'));_0x1b5647['verifyAdditionalPhones'](_0x46857d,'3',_0x549799)[_0x43d6('0x86')](function(_0x44f47b){_0x41ee61=_0x44f47b[_0x43d6('0xa9')]==0x1;if(!_0x41ee61){if(ut[_0x43d6('0xa5')](_0x46857d)>=_0x549799[_0x43d6('0xac')]){_0x5f4b71=ut[_0x43d6('0xcd')](_0x46857d,0xf,_0x43d6('0xad'));rpcDb[_0x43d6('0x98')](_0x5f4b71,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x46857d[_0x43d6('0xd2')]>=_0x549799['dialNoAnswerMaxRetry']){rpcDb['createCustomerFinal'](_0x46857d,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb[_0x43d6('0xcf')](ut['scheduledAt'](_0x46857d,_0x43d6('0xd2'),_0x549799['dialNoAnswerRetryFrequency']),_0x46857d[_0x43d6('0xb2')],_0x46857d['activeContact']);}}}else{_0x46857d['countnoanswerretry']++;_0x1b5647[_0x43d6('0xd0')]({'id':_0x46857d[_0x43d6('0xb5')],'field':{'countnoanswerretry':_0x46857d[_0x43d6('0xd2')]}})[_0x43d6('0x86')](function(){_0x1b5647[_0x43d6('0xb6')](_0x46857d,_0x5ab696,_0x5840eb)[_0x43d6('0x86')](function(){});});}});break;case _0x43d6('0xd8'):_0x549799[_0x43d6('0x39')]+=0x1;_0x46857d['countcongestionretry']+=0x1;_0x46857d[_0x43d6('0xa4')]=ut[_0x43d6('0xa5')](_0x46857d);ut[_0x43d6('0x90')](_0x46857d,0x8,_0x43d6('0xd9'));_0x5ab696=_0x549799[_0x43d6('0xda')];_0x5840eb=_0x549799['callAdditionalPhoneAfterMin'];ami['emit']('custom:agentcongestion',ut['buildObj'](_0x46857d,_0x43d6('0xdb')));rpcDb[_0x43d6('0x97')](_0x46857d,_0x43d6('0xdc'));_0x1b5647['verifyAdditionalPhones'](_0x46857d,'8',_0x549799)[_0x43d6('0x86')](function(_0x2c2e2f){_0x41ee61=_0x2c2e2f[_0x43d6('0xa9')]==0x1;if(!_0x41ee61){if(ut[_0x43d6('0xa5')](_0x46857d)>=_0x549799['dialGlobalMaxRetry']){_0x5f4b71=ut[_0x43d6('0xcd')](_0x46857d,0xf,_0x43d6('0xad'));rpcDb[_0x43d6('0x98')](_0x5f4b71,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x46857d[_0x43d6('0xdd')]>=_0x549799['dialCongestionMaxRetry']){rpcDb[_0x43d6('0x98')](_0x46857d,_0x43d6('0xdc'));}else{rpcDb[_0x43d6('0xcf')](ut[_0x43d6('0xb1')](_0x46857d,'countcongestionretry',_0x549799[_0x43d6('0xc9')]),_0x46857d[_0x43d6('0xb2')],_0x46857d[_0x43d6('0xb3')]);}}}else{_0x46857d[_0x43d6('0xdd')]++;_0x1b5647[_0x43d6('0xd0')]({'id':_0x46857d[_0x43d6('0xb5')],'field':{'countcongestionretry':_0x46857d[_0x43d6('0xdd')]}})[_0x43d6('0x86')](function(){_0x1b5647[_0x43d6('0xb6')](_0x46857d,_0x5ab696,_0x5840eb)[_0x43d6('0x86')](function(){});});}});break;case'CANCEL':_0x549799[_0x43d6('0x40')]+=0x1;_0x46857d['countagentrejectretry']+=0x1;_0x46857d[_0x43d6('0xa4')]=ut[_0x43d6('0xa5')](_0x46857d);ut[_0x43d6('0x90')](_0x46857d,0x14,'AgentReject');_0x5ab696=_0x549799[_0x43d6('0xde')];_0x5840eb=_0x549799['callAdditionalPhoneAfterMin'];ami[_0x43d6('0x24')]('custom:agentreject',ut['buildObj'](_0x46857d,_0x43d6('0xdf')));rpcDb[_0x43d6('0x97')](_0x46857d,'[syncHangupRequest][logAgentReject]');_0x1b5647[_0x43d6('0xa8')](_0x46857d,'20',_0x549799)[_0x43d6('0x86')](function(_0x4c55ff){_0x41ee61=_0x4c55ff['additional']==0x1;if(!_0x41ee61){if(ut['totalGlobal'](_0x46857d)>=_0x549799['dialGlobalMaxRetry']){_0x5f4b71=ut['cloneAction'](_0x46857d,0x14,_0x43d6('0xe0'));rpcDb[_0x43d6('0x98')](_0x5f4b71,_0x43d6('0xe1'));}else{if(_0x46857d[_0x43d6('0xe2')]>=_0x549799[_0x43d6('0xe3')]){rpcDb[_0x43d6('0x98')](_0x46857d,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x43d6('0xcf')](ut[_0x43d6('0xb1')](_0x46857d,'countagentrejectretry',_0x549799['dialAgentRejectRetryFrequency']),_0x46857d[_0x43d6('0xb2')],_0x46857d[_0x43d6('0xb3')]);}}}else{_0x46857d['countnoanswerretry']++;_0x1b5647[_0x43d6('0xd0')]({'id':_0x46857d[_0x43d6('0xb5')],'field':{'countnoanswerretry':_0x46857d[_0x43d6('0xd2')]}})[_0x43d6('0x86')](function(){_0x1b5647[_0x43d6('0xb6')](_0x46857d,_0x5ab696,_0x5840eb)[_0x43d6('0x86')](function(){});});}});break;case _0x43d6('0xe4'):_0x549799[_0x43d6('0x41')]+=0x1;_0x46857d['countabandonedretry']+=0x1;_0x46857d[_0x43d6('0xa4')]=ut[_0x43d6('0xa5')](_0x46857d);ut[_0x43d6('0x90')](_0x46857d,0xb,'Abandoned');rpcDb[_0x43d6('0x97')](_0x46857d,'[callProgressDetectingCustomer][logAbandoned]');_0x1b5647[_0x43d6('0xa8')](_0x46857d,'11',_0x549799)[_0x43d6('0x86')](function(_0x4e34cf){_0x41ee61=_0x4e34cf[_0x43d6('0xa9')]==0x1;if(!_0x41ee61){if(ut[_0x43d6('0xa5')](_0x46857d)>=_0x549799[_0x43d6('0xac')]){_0x5f4b71=ut[_0x43d6('0xcd')](_0x46857d,0xf,_0x43d6('0xad'));rpcDb['createCustomerFinal'](_0x5f4b71,_0x43d6('0xe5'));}else{if(_0x46857d[_0x43d6('0xe6')]>=_0x549799['dialAbandonedMaxRety']){rpcDb['createCustomerFinal'](_0x46857d,_0x43d6('0xe5'));}else{rpcDb['rescheduleContact'](ut[_0x43d6('0xb1')](_0x46857d,_0x43d6('0xe7'),_0x549799[_0x43d6('0xe8')]),_0x46857d[_0x43d6('0xb2')],_0x46857d[_0x43d6('0xb3')]);}}}else{_0x46857d[_0x43d6('0xd2')]++;_0x1b5647[_0x43d6('0xd0')]({'id':_0x46857d['idContact'],'field':{'countnoanswerretry':_0x46857d[_0x43d6('0xd2')]}})[_0x43d6('0x86')](function(){_0x1b5647[_0x43d6('0xb6')](_0x46857d,_0x5ab696,_0x5840eb)[_0x43d6('0x86')](function(){});});}});break;case'18':_0x549799['outboundUnknownCallsDay']+=0x1;_0x46857d['countmachineretry']+=0x1;_0x46857d[_0x43d6('0xa4')]=ut[_0x43d6('0xa5')](_0x46857d);ut[_0x43d6('0x90')](_0x46857d,0x12,_0x130686[_0x43d6('0xe9')]||_0x130686[_0x43d6('0xea')]);ami[_0x43d6('0x24')]('custom:amd',ut[_0x43d6('0xa6')](_0x46857d,_0x43d6('0xeb')));rpcDb[_0x43d6('0x97')](_0x46857d,_0x43d6('0xec'));_0x1b5647['verifyAdditionalPhones'](_0x46857d,'18',_0x549799)[_0x43d6('0x86')](function(_0x286b17){_0x41ee61=_0x286b17['additional']==0x1;if(!_0x41ee61){if(ut[_0x43d6('0xa5')](_0x46857d)>=_0x549799[_0x43d6('0xac')]){_0x5f4b71=ut[_0x43d6('0xcd')](_0x46857d,0x12,'Global');rpcDb[_0x43d6('0x98')](_0x5f4b71,'[callProgressDetectingCustomer][hangupInAMD]');}else{rpcDb[_0x43d6('0x98')](_0x46857d,'[callProgressDetectingCustomer][hangupInAMD]');}}else{_0x46857d[_0x43d6('0xd2')]++;_0x1b5647['incrementPreviewCounters']({'id':_0x46857d[_0x43d6('0xb5')],'field':{'countnoanswerretry':_0x46857d[_0x43d6('0xd2')]}})['then'](function(){_0x1b5647['swapAdditionalPhones'](_0x46857d,_0x5ab696,_0x5840eb)[_0x43d6('0x86')](function(){});});}});delete this['actions'][_0x130686[_0x43d6('0xb4')]];break;case'19':_0x549799[_0x43d6('0xed')]+=0x1;_0x46857d[_0x43d6('0xa4')]=ut[_0x43d6('0xa5')](_0x46857d);ut[_0x43d6('0x90')](_0x46857d,0x13,_0x130686[_0x43d6('0xe9')]||_0x130686['dialstatus']);ami[_0x43d6('0x24')](_0x43d6('0xee'),ut[_0x43d6('0xa6')](_0x46857d,_0x43d6('0xeb')));rpcDb[_0x43d6('0x97')](_0x46857d,'[callProgressDetectingCustomer][machine]');_0x1b5647[_0x43d6('0xa8')](_0x46857d,'18',_0x549799)[_0x43d6('0x86')](function(_0x58c86c){_0x41ee61=_0x58c86c[_0x43d6('0xa9')]==0x1;if(!_0x41ee61){if(ut['totalGlobal'](_0x46857d)>=_0x549799[_0x43d6('0xac')]){_0x5f4b71=ut[_0x43d6('0xcd')](_0x46857d,0xf,_0x43d6('0xad'));rpcDb[_0x43d6('0x98')](_0x5f4b71,_0x43d6('0xef'));}else{rpcDb['createCustomerFinal'](_0x46857d,_0x43d6('0xef'));}}else{_0x46857d['countnoanswerretry']++;_0x1b5647['incrementPreviewCounters']({'id':_0x46857d['idContact'],'field':{'countnoanswerretry':_0x46857d[_0x43d6('0xd2')]}})['then'](function(){_0x1b5647[_0x43d6('0xb6')](_0x46857d,_0x5ab696,_0x5840eb)[_0x43d6('0x86')](function(){});});}});delete this['actions'][_0x130686[_0x43d6('0xb4')]];break;default:if(_0x46857d[_0x43d6('0x73')]){ut[_0x43d6('0x7e')](_0x549799,_0x43d6('0xf0'));ut['loggerError']('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x549799['name'],_0x130686);}_0x549799['outboundUnknownCallsDay']+=0x1;_0x46857d[_0x43d6('0xa4')]=ut[_0x43d6('0xa5')](_0x46857d);ut[_0x43d6('0x90')](_0x46857d,0xc,_0x130686['cause-txt']||_0x130686['dialstatus']);_0x5ab696=_0x549799['dialAgentRejectRetryFrequency'];_0x5840eb=_0x549799[_0x43d6('0xab')];rpcDb[_0x43d6('0x97')](_0x46857d,_0x43d6('0xf1'));_0x1b5647[_0x43d6('0xa8')](_0x46857d,'20',_0x549799)['then'](function(_0x5b5090){_0x41ee61=_0x5b5090['additional']==0x1;if(!_0x41ee61){if(ut[_0x43d6('0xa5')](_0x46857d)>=_0x549799[_0x43d6('0xac')]){_0x5f4b71=ut['cloneAction'](_0x46857d,0xf,_0x43d6('0xad'));rpcDb['createCustomerFinal'](_0x5f4b71,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x43d6('0x98')](_0x46857d,_0x43d6('0xf2'));}delete this['actions'][_0x130686[_0x43d6('0xb4')]];}else{_0x1b5647[_0x43d6('0xb6')](_0x46857d,_0x5ab696,_0x5840eb)['then'](function(){});}});}if(!(_0x46857d[_0x43d6('0x73')]&&_0x4a1196==='16')){ut[_0x43d6('0xf3')](_0x549799,_0x43d6('0xf4'));logger['info'](_0x43d6('0xf5'),_0x46857d[_0x43d6('0xbb')],'\x20Queue',_0x549799[_0x43d6('0x27')],_0x43d6('0x71'),_0x549799[_0x43d6('0x4c')]);}if(_0x4a1196!==_0x43d6('0xb7')){delete this[_0x43d6('0x15')][_0x130686['linkedid']];delete this[_0x43d6('0x15')][_0x130686[_0x43d6('0xf6')]];}}};Preview[_0x43d6('0x68')][_0x43d6('0xf7')]=function(_0x35df85,_0x43d026,_0x5c1908){if(_[_0x43d6('0xf8')](_0x43d026)&&'object'!==typeof _0x43d026){return;}if(_[_0x43d6('0xf8')](_0x5c1908)&&_0x43d6('0xf9')!==typeof _0x5c1908){return;}switch(_0x5c1908[_0x43d6('0xfa')]){case'0':ut[_0x43d6('0xfb')](_0x35df85,0x0,'NoSuchNumber');rpcDb[_0x43d6('0xfc')](_0x35df85,_0x43d6('0xfd'));break;case'3':ut['logAgent'](_0x35df85,0x3,_0x43d6('0xd3'));rpcDb[_0x43d6('0xfc')](_0x35df85,_0x43d6('0xfe'));break;case'5':ut[_0x43d6('0xfb')](_0x35df85,0x5,_0x43d6('0xff'));rpcDb['createAgentHistory'](_0x35df85,_0x43d6('0x100'));break;case'8':ut['logAgent'](_0x35df85,0x8,_0x43d6('0xd9'));rpcDb[_0x43d6('0xfc')](_0x35df85,_0x43d6('0x101'));break;case'22':ut[_0x43d6('0xfb')](_0x35df85,0x16,_0x43d6('0x102'));rpcDb[_0x43d6('0xfc')](_0x35df85,_0x43d6('0x103'));break;default:ut[_0x43d6('0xfb')](_0x35df85,0xc,_0x5c1908[_0x43d6('0xfa')]);rpcDb[_0x43d6('0xfc')](_0x35df85,_0x43d6('0x101'));}ut[_0x43d6('0xf3')](_0x43d026,'[callProgressDetectingAgent]');logger[_0x43d6('0x5a')]('[originated][decrement][callProgressDetectingAgent]',_0x35df85[_0x43d6('0xbb')],'\x20Queue',_0x43d026[_0x43d6('0x27')],_0x43d6('0x71'),_0x43d026[_0x43d6('0x4c')]);delete this[_0x43d6('0x15')][_0x35df85[_0x43d6('0xbb')]];};Preview[_0x43d6('0x68')][_0x43d6('0xa8')]=function(_0x27af86,_0x507fc1,_0x4dfdca){return Promise[_0x43d6('0x104')]()[_0x43d6('0x86')](cmHopperAdditionalPhone[_0x43d6('0xa8')](_0x27af86,_0x507fc1,_0x4dfdca))[_0x43d6('0x7c')](logger[_0x43d6('0x5a')](_0x43d6('0x105')));};Preview[_0x43d6('0x68')][_0x43d6('0xb6')]=function(_0x24f149,_0x15e114,_0x2d8ea5){return Promise[_0x43d6('0x104')]()[_0x43d6('0x86')](cmHopperAdditionalPhone['swapAdditionalPhones'](_0x24f149,_0x15e114,_0x2d8ea5))[_0x43d6('0x7c')](logger[_0x43d6('0x5a')](_0x43d6('0x106')));};Preview[_0x43d6('0x68')][_0x43d6('0xd0')]=function(_0x4c02a9){return Promise[_0x43d6('0x104')]()[_0x43d6('0x86')](cmHopperAdditionalPhone[_0x43d6('0xd0')](_0x4c02a9))[_0x43d6('0x7c')](logger['info'](_0x43d6('0x107')));};Preview[_0x43d6('0x68')]['checkInBlack']=function(_0x4910e3,_0x49e97d,_0x6da20e,_0x38c987,_0x398fb5){var _0x3c3c41=this;return new Promise(function(_0x3258f1,_0x4fe8ff){if(_[_0x43d6('0x6f')](_0x49e97d)||_[_0x43d6('0x6f')](_0x49e97d[_0x43d6('0x108')])||_['isNil'](_0x49e97d['phone'])||_[_0x43d6('0x6f')](_0x49e97d[_0x43d6('0x77')])){_0x4fe8ff(ut[_0x43d6('0x4b')](_0x43d6('0x109'),_0x38c987,_0x398fb5));return;}var _0x3f0268=uuid['v4']();var _0x5944c2=_0x3c3c41[_0x43d6('0x12')][_0x49e97d[_0x43d6('0x70')][_0x43d6('0x27')]];var _0x5c2c27=_0x6da20e?_0x3c3c41[_0x43d6('0x16')][_0x6da20e]['id']:undefined;_0x3c3c41[_0x43d6('0x15')][_0x3f0268]=new Action(_0x49e97d,_0x5944c2,_0x3f0268,_0x6da20e,_0x5c2c27);var _0x2057fe=_0x3c3c41[_0x43d6('0x15')][_0x3f0268];_0x2057fe['unlockAgent']=_0x38c987;_0x2057fe['activeContact']=_0x398fb5;_0x2057fe[_0x43d6('0x10a')]=_0x6da20e;if(_['isEmpty'](_0x4910e3)){_0x3c3c41[_0x43d6('0x10b')](_0x2057fe,_0x5944c2,_0x49e97d,_0x6da20e)[_0x43d6('0x86')](function(_0x40f25b){logger[_0x43d6('0x5a')](_0x43d6('0x10c'),'Queue:\x20'+_0x2057fe['queue']+_0x43d6('0x10d')+_0x2057fe[_0x43d6('0xb5')],JSON[_0x43d6('0x5c')](_0x40f25b));ami[_0x43d6('0x24')](_0x43d6('0x10e'),ut['buildObj'](_0x2057fe,'called',_0x3c3c41[_0x43d6('0x12')][_0x2057fe[_0x43d6('0x72')]]));_0x3258f1(ut['message'](_0x43d6('0x10f')));})[_0x43d6('0x7c')](function(_0x444533){ut['logger'](_0x43d6('0x110'),_0x444533);_0x4fe8ff(ut['message'](_0x43d6('0x111'),_0x38c987,_0x398fb5));});}else{_0x5944c2[_0x43d6('0x112')]+=0x1;ut[_0x43d6('0x113')](_0x2057fe);rpcDb[_0x43d6('0x114')](_0x2057fe,_0x43d6('0x115'));delete _0x3c3c41[_0x43d6('0x15')][_0x3f0268];_0x4fe8ff(ut[_0x43d6('0x4b')](_0x43d6('0x116'),_0x38c987,_0x398fb5));}});};Preview['prototype'][_0x43d6('0x9f')]=function(_0x83dbe6){return!_['isNil'](_0x83dbe6)&&!_[_0x43d6('0x6f')](_0x83dbe6['name'])&&!_[_0x43d6('0x6f')](_0x83dbe6['active'])&&_0x83dbe6[_0x43d6('0x54')]&&!_[_0x43d6('0x6f')](this[_0x43d6('0x14')][util[_0x43d6('0x57')]('SIP/%s',_0x83dbe6[_0x43d6('0x27')])])&&!_['isNil'](this[_0x43d6('0x14')][util['format'](_0x43d6('0x117'),_0x83dbe6[_0x43d6('0x27')])][_0x43d6('0x7a')])&&(this[_0x43d6('0x14')][util[_0x43d6('0x57')](_0x43d6('0x117'),_0x83dbe6[_0x43d6('0x27')])][_0x43d6('0x7a')]===_0x43d6('0x118')||this[_0x43d6('0x14')][util['format'](_0x43d6('0x117'),_0x83dbe6[_0x43d6('0x27')])][_0x43d6('0x7a')]===_0x43d6('0x119'));};Preview[_0x43d6('0x68')]['run']=function(_0x5ac2c1,_0x3cfcbe){var _0x2ff32f=this;return new Promise(function(_0x62d953,_0x546651){_0x2ff32f['execRun'](_0x5ac2c1,_0x3cfcbe)[_0x43d6('0x86')](function(_0x2bc825){_0x62d953(_['pick'](_0x2bc825,[_0x43d6('0x4b')]));})[_0x43d6('0x7c')](function(_0x4d79c9){if(_0x4d79c9[_0x43d6('0x11a')]){rpcDb[_0x43d6('0x11b')](_0x5ac2c1);}if(_0x4d79c9[_0x43d6('0x54')]){rpcDb['disableContact'](_0x5ac2c1);}_0x546651(_[_0x43d6('0x74')](_0x4d79c9,[_0x43d6('0x4b')]));});});};Preview['prototype'][_0x43d6('0x11c')]=function(_0x5ad9a6,_0x543295){var _0x3c1c2f=this;return new Promise(function(_0xab221,_0x58c012){var _0x29d3ab,_0x27cb38;rpcDb[_0x43d6('0x11d')](_0x5ad9a6)[_0x43d6('0x86')](function(_0x4dd77a){if(!_[_0x43d6('0x6f')](_0x4dd77a[0x0])){_0x27cb38=_0x4dd77a[0x0][_0x43d6('0x11e')]?![]:!![];_0x29d3ab=_0x4dd77a[0x0][_0x43d6('0x11e')]?!![]:![];_0x29d3ab=_0x543295?!![]:_0x29d3ab;}var _0x3aa394=_0x3c1c2f[_0x43d6('0x11f')](_0x4dd77a);if(_0x3aa394[_0x43d6('0x120')]){rpcDb[_0x43d6('0x121')](_[_0x43d6('0x74')](_0x4dd77a[0x0],[_0x43d6('0x77'),_0x43d6('0x122')]))[_0x43d6('0x86')](function(_0x43efcd){_0x3c1c2f[_0x43d6('0x123')](_0x43efcd,_0x4dd77a[0x0],_0x543295,_0x27cb38,_0x29d3ab)[_0x43d6('0x86')](function(_0x46cfa5){_0xab221(_0x46cfa5);})[_0x43d6('0x7c')](function(_0x172d74){_0x58c012(_0x172d74);});})[_0x43d6('0x7c')](function(_0x1533a8){ut[_0x43d6('0x62')](_0x43d6('0x124'),_0x1533a8);_0x58c012(ut['message'](_0x43d6('0x125'),_0x27cb38,_0x29d3ab));});}else{_0x58c012(ut[_0x43d6('0x4b')](_0x3aa394['message'],_0x27cb38,_0x29d3ab));}})[_0x43d6('0x7c')](function(_0x2a5d93){ut[_0x43d6('0x62')](_0x43d6('0x126'),_0x2a5d93);_0x58c012(ut[_0x43d6('0x4b')](_0x43d6('0x125'),![],!![]));});});};Preview['prototype'][_0x43d6('0x11f')]=function(_0x2825b1){if(_[_0x43d6('0x6f')](_0x2825b1)||_['isEmpty'](_0x2825b1)||!_[_0x43d6('0x6f')](_0x2825b1[0x0][_0x43d6('0x89')])&&_[_0x43d6('0x6f')](_0x2825b1[0x0][_0x43d6('0x89')]['name'])){ut[_0x43d6('0x62')](_0x43d6('0x127'),_0x2825b1);return{'isValid':![],'message':_0x43d6('0x128')};}var _0xe9ec=this[_0x43d6('0x12')][_0x2825b1[0x0][_0x43d6('0x70')][_0x43d6('0x27')]];_0xe9ec[_0x43d6('0x4b')]=_0x43d6('0xa2');if(_['isNil'](_0xe9ec)){ut[_0x43d6('0x62')](_0x43d6('0x129'),_0xe9ec);return{'isValid':![],'message':_0x43d6('0x12a')};}if(!this['isTrunkReachable'](_0xe9ec[_0x43d6('0x53')])){ut[_0x43d6('0x62')](_0x43d6('0x12b'),_0x43d6('0x12c')+_0xe9ec[_0x43d6('0x27')]+_0x43d6('0x12d'));if(!this[_0x43d6('0x9f')](_0xe9ec[_0x43d6('0xa0')])){ut[_0x43d6('0x62')](_0x43d6('0x12b'),_0xe9ec[_0x43d6('0x27')]+_0x43d6('0x12e'));return{'isValid':![],'message':_0x43d6('0x12f')};}}if(!ut[_0x43d6('0x9d')](_0xe9ec[_0x43d6('0x32')])){ut[_0x43d6('0x62')](_0x43d6('0x130'),_0xe9ec[_0x43d6('0x27')]+_0x43d6('0x131'));return{'isValid':![],'message':_0x43d6('0x12c')+_0xe9ec[_0x43d6('0x27')]+_0x43d6('0x131')};}return{'isValid':!![],'message':_0x43d6('0x132')};};Preview[_0x43d6('0x68')]['execCall']=function(_0x4416a4,_0x523685,_0x3b29a5,_0x968d0f){var _0x892f04=this;return new Promise(function(_0x2d2e61,_0x366be5){var _0x26fea4=_0x4416a4['uniqueid'];var _0x47ffd8=_0x892f04[_0x43d6('0x9f')](_0x523685[_0x43d6('0x53')])?util[_0x43d6('0x57')](_0x43d6('0x133'),_0x523685[_0x43d6('0x53')][_0x43d6('0x27')],_[_0x43d6('0x6f')](_0x523685[_0x43d6('0x35')])?'':_0x523685[_0x43d6('0x35')][_0x43d6('0x134')]()||'',_0x523685['dialCutDigit']>0x0?_0x3b29a5[_0x43d6('0x122')]['substring'](_0x523685['dialCutDigit']):_0x3b29a5[_0x43d6('0x122')]):util[_0x43d6('0x57')](_0x43d6('0x133'),_[_0x43d6('0x6f')](_0x523685[_0x43d6('0xa0')])?_0x523685[_0x43d6('0x53')][_0x43d6('0x27')]:_0x523685[_0x43d6('0xa0')][_0x43d6('0x27')],_[_0x43d6('0x6f')](_0x523685[_0x43d6('0x35')])?'':_0x523685[_0x43d6('0x35')]['trim']()||'',_0x523685[_0x43d6('0x135')]>0x0?_0x3b29a5['phone'][_0x43d6('0x136')](_0x523685[_0x43d6('0x135')]):_0x3b29a5[_0x43d6('0x122')]);var _0x51cf31=_0x892f04['isTrunkReachable'](_0x523685[_0x43d6('0x53')])?ut[_0x43d6('0x137')](_0x523685[_0x43d6('0x53')][_0x43d6('0x55')],_0x523685['dialOriginateCallerIdName'],_0x523685[_0x43d6('0x138')]>0x0?ut['getCallerIdRandom'](_0x523685[_0x43d6('0x139')],_0x523685[_0x43d6('0x138')]):_0x523685[_0x43d6('0x139')]):ut[_0x43d6('0x137')](_['isNil'](_0x523685[_0x43d6('0xa0')])?_0x523685[_0x43d6('0x53')]['callerid']:_0x523685[_0x43d6('0xa0')]['callerid'],_0x523685[_0x43d6('0x34')],_0x523685[_0x43d6('0x138')]>0x0?ut['getCallerIdRandom'](_0x523685[_0x43d6('0x139')],_0x523685[_0x43d6('0x138')]):_0x523685['dialOriginateCallerIdNumber']);if(_0x51cf31){_0x4416a4['originatecalleridname']=ut[_0x43d6('0x13a')](_0x51cf31);_0x4416a4[_0x43d6('0x13b')]=ut['extractCalleridNumber'](_0x51cf31);}var _0x971ef7=ut['addVariables'](_0x523685,_0x3b29a5,_0x47ffd8,_0x51cf31,_0x26fea4,_0x4416a4);_[_0x43d6('0x13c')](_0x4416a4,ut[_0x43d6('0x13d')](_0x971ef7));_0x4416a4[_0x43d6('0x8e')]=moment()['format'](_0x43d6('0x8f'));_0x523685[_0x43d6('0x13e')]=_0x971ef7;ami[_0x43d6('0x79')](ut['variablesAction'](_0x4416a4,_0x523685,_0x971ef7,_0x4416a4[_0x43d6('0xb3')],_0x968d0f))[_0x43d6('0x86')](function(_0x5eb010){_0x523685[_0x43d6('0x4c')]+=0x1;logger[_0x43d6('0x5a')](_0x43d6('0x13f'),_0x26fea4,'\x20Queue',_0x523685[_0x43d6('0x27')],_0x43d6('0x71'),_0x523685[_0x43d6('0x4c')]);_0x2d2e61(_0x5eb010);})['catch'](function(_0x256596){ut[_0x43d6('0xfb')](_0x4416a4,0xe,_0x43d6('0x140'));rpcDb[_0x43d6('0xfc')](_0x4416a4,_0x43d6('0x141'));_0x366be5(_0x256596);});});};Preview[_0x43d6('0x68')]['syncNewExten']=function(_0x1e3131){if(this[_0x43d6('0x15')][_0x1e3131[_0x43d6('0xb4')]]){this['actions'][_0x1e3131[_0x43d6('0xb4')]]['channel']=_0x1e3131[_0x43d6('0x7b')];}};Preview[_0x43d6('0x68')][_0x43d6('0x18')]=function(_0x3c77e0){var _0x4a2d4a=this;var _0x10837e=this[_0x43d6('0x15')][_0x3c77e0[_0x43d6('0x142')]];if(_0x10837e){if(_0x10837e[_0x43d6('0x10a')]&&this[_0x43d6('0x16')][_0x10837e[_0x43d6('0x10a')]]){ut[_0x43d6('0x143')](_0x10837e,this[_0x43d6('0x16')][_0x10837e[_0x43d6('0x10a')]][_0x43d6('0x27')],this[_0x43d6('0x16')][_0x10837e[_0x43d6('0x10a')]]['id']);}var _0x44dbad=_['clone'](_0x10837e);_0x44dbad[_0x43d6('0xb8')]=moment()['format'](_0x43d6('0x8f'));var _0x406d4f=_0x4a2d4a[_0x43d6('0x12')][_0x10837e['queue']];if(ut[_0x43d6('0x144')](_0x3c77e0[_0x43d6('0x145')])){if(_0x10837e[_0x43d6('0xb2')]){rpcDb['unlockContact'](_0x10837e[_0x43d6('0xb5')]);}if(_0x10837e['activeContact']){rpcDb[_0x43d6('0x8d')](_0x10837e[_0x43d6('0xb5')]);}ami[_0x43d6('0x24')](_0x43d6('0x146'),ut[_0x43d6('0xa6')](_0x10837e,'rejected',this['campaignsPreview'][_0x10837e[_0x43d6('0x72')]]));this[_0x43d6('0xf7')](_0x44dbad,_0x406d4f,_0x3c77e0);}else{_0x10837e[_0x43d6('0x8e')]=moment()[_0x43d6('0x57')](_0x43d6('0x8f'));ut[_0x43d6('0xfb')](_0x44dbad,0x4,'Answer');rpcDb[_0x43d6('0xfc')](_0x44dbad,_0x43d6('0x147'));}}};Preview['prototype'][_0x43d6('0x1b')]=function(_0xb5a28e){var _0x45bd3e=this[_0x43d6('0x15')][_0xb5a28e[_0x43d6('0xb4')]];var _0x2a71bc;if(_0x45bd3e){_0x2a71bc=this['campaignsPreview'][_0x45bd3e['queue']];logger[_0x43d6('0x5a')](_0x43d6('0x148'),_0xb5a28e[_0x43d6('0xb4')],_0x43d6('0xbc'),_0x2a71bc[_0x43d6('0x27')],_0x43d6('0xc6'),_0x2a71bc[_0x43d6('0x60')]);}if(this[_0x43d6('0x15')][_0xb5a28e[_0x43d6('0xb4')]]&&_0xb5a28e[_0x43d6('0xb4')]!==_0xb5a28e[_0x43d6('0xbb')]){if(_0xb5a28e[_0x43d6('0x149')]==='16'&&this[_0x43d6('0x15')][_0xb5a28e[_0x43d6('0xb4')]]['dialAnswer']){this[_0x43d6('0xa3')](_0xb5a28e,_0xb5a28e['linkedid'],_0xb5a28e[_0x43d6('0x149')]);}else if(this['actions'][_0xb5a28e[_0x43d6('0xb4')]][_0x43d6('0x73')]){logger[_0x43d6('0x5a')](_0x43d6('0x14a'),_0xb5a28e[_0x43d6('0xb4')],_0xb5a28e['cause'],_0x43d6('0xbc'),_0x2a71bc['name'],_0x43d6('0xc6'),_0x2a71bc['pTalking']);this[_0x43d6('0xa3')](_0xb5a28e,_0xb5a28e[_0x43d6('0xb4')],_0xb5a28e[_0x43d6('0x149')]);}}else if(_0x45bd3e&&_[_0x43d6('0x6f')](_0x45bd3e['statedesc'])&&_0x2a71bc['dialQueueProject']&&_0xb5a28e[_0x43d6('0xb4')]===_0xb5a28e[_0x43d6('0xbb')]&&_[_0x43d6('0x6f')](_0xb5a28e[_0x43d6('0xfa')])&&_0xb5a28e['cause']==='16'&&_0xb5a28e['channelstate']==='6'&&_[_0x43d6('0xf8')](_0x45bd3e[_0x43d6('0x14b')])){if(_0x45bd3e[_0x43d6('0xb2')]){rpcDb[_0x43d6('0x11b')](_0x45bd3e[_0x43d6('0xb5')]);}if(_0x45bd3e[_0x43d6('0xb3')]){rpcDb[_0x43d6('0x8d')](_0x45bd3e[_0x43d6('0xb5')]);}_0xb5a28e[_0x43d6('0xfa')]='22';this['callProgressDetectingAgent'](_0x45bd3e,_0x2a71bc,_0xb5a28e);}else if(_0x45bd3e&&_0x45bd3e['transfer']){if(_0xb5a28e[_0x43d6('0x149')]==='16'&&this[_0x43d6('0x15')][_0xb5a28e[_0x43d6('0xb4')]][_0x43d6('0x73')]){logger[_0x43d6('0x5a')](_0x43d6('0x14c'),_0xb5a28e[_0x43d6('0xb4')],_0xb5a28e[_0x43d6('0x149')],_0x43d6('0xbc'),_0x2a71bc[_0x43d6('0x27')],_0x43d6('0xc6'),_0x2a71bc['pTalking']);this[_0x43d6('0xa3')](_0xb5a28e,_0xb5a28e[_0x43d6('0xb4')],_0xb5a28e[_0x43d6('0x149')]);}else if(this[_0x43d6('0x15')][_0xb5a28e[_0x43d6('0xb4')]][_0x43d6('0x73')]){logger[_0x43d6('0x5a')]('[syncHangup][talking][cause]',_0xb5a28e['linkedid'],_0xb5a28e[_0x43d6('0x149')],_0x43d6('0xbc'),_0x2a71bc[_0x43d6('0x27')],'pTalking:\x20',_0x2a71bc['pTalking']);this[_0x43d6('0xa3')](_0xb5a28e,_0xb5a28e[_0x43d6('0xb4')],_0xb5a28e[_0x43d6('0x149')]);}}};Preview[_0x43d6('0x68')][_0x43d6('0x1e')]=function(_0x2b8aea){if(this[_0x43d6('0x15')][_0x2b8aea[_0x43d6('0xf6')]]&&_0x2b8aea[_0x43d6('0xf6')]!==_0x2b8aea['destuniqueid']){this['callProgressDetectingCustomer'](_0x2b8aea,_0x2b8aea[_0x43d6('0xf6')],_0x2b8aea['dialstatus']);}};Preview[_0x43d6('0x68')][_0x43d6('0x1d')]=function(_0x4d3306){if(this['actions'][_0x4d3306[_0x43d6('0xb4')]]&&_0x4d3306[_0x43d6('0xb4')]!==_0x4d3306[_0x43d6('0xbb')]&&!this[_0x43d6('0x15')][_0x4d3306[_0x43d6('0xb4')]][_0x43d6('0x73')]){if(_0x4d3306['cause']==='1'){this['callProgressDetectingCustomer'](_0x4d3306,_0x4d3306['linkedid'],_0x4d3306[_0x43d6('0x149')]);}}};Preview['prototype']['addVariable']=function(_0x1d3280,_0x155b10,_0x4b6700){if(this[_0x43d6('0x15')][_0x1d3280]){if(_['isNil'](this['actions'][_0x1d3280][_0x43d6('0x13e')])){this[_0x43d6('0x15')][_0x1d3280][_0x43d6('0x13e')]={};}this['actions'][_0x1d3280][_0x43d6('0x13e')][_0x155b10]=_0x4b6700;}};Preview[_0x43d6('0x68')][_0x43d6('0x1f')]=function(_0x361373){try{if(!_[_0x43d6('0x6f')](_0x361373)){if(ut[_0x43d6('0x14d')](_['keys'](_0x361373[_0x43d6('0x14e')])[0x0])){this['addVariable'](_0x361373[_0x43d6('0xbb')],_[_0x43d6('0x14f')](_0x361373[_0x43d6('0x14e')])[0x0],_0x361373[_0x43d6('0x150')]);}}}catch(_0x4acca2){logger[_0x43d6('0x151')](_0x43d6('0x152'),util['inspect'](_0x4acca2,{'showHidden':![],'depth':null}));}};Preview[_0x43d6('0x68')]['syncAttendedTransfer']=function(_0x32fb1d){if(_0x32fb1d){if(this[_0x43d6('0x15')][_0x32fb1d[_0x43d6('0x153')]]){this[_0x43d6('0x15')][_0x32fb1d[_0x43d6('0x153')]][_0x43d6('0x14b')]=!![];}}};Preview[_0x43d6('0x68')][_0x43d6('0x22')]=function(_0xcb576d){if(_0xcb576d){if(this['actions'][_0xcb576d[_0x43d6('0x154')]]){this['actions'][_0xcb576d[_0x43d6('0x154')]][_0x43d6('0x14b')]=!![];}}};module[_0x43d6('0x155')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index ef5de92..3ce1631 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 _0x870f=['endtime','connectedlinename','membername','context','from-sip','exten','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','[voiceQueueReport]\x20','getContactRecallMe','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','lodash','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/agentReportPreview','error','inspect','resolve','then','createHistory','catch','[createHistory]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','countReScheduled','unlockContact','[unlockContact]\x20','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt'];(function(_0x442016,_0x1bed0d){var _0x2d6c87=function(_0x56c520){while(--_0x56c520){_0x442016['push'](_0x442016['shift']());}};_0x2d6c87(++_0x1bed0d);}(_0x870f,0x1c7));var _0xf870=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x870f[_0x122ef9];return _0x42fba0;};'use strict';var util=require(_0xf870('0x0'));var BPromise=require(_0xf870('0x1'));var logger=require(_0xf870('0x2'))('preview');var _=require(_0xf870('0x3'));var cmHopper=require(_0xf870('0x4'));var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require(_0xf870('0x5'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require('../rpc/voiceQueueRt');var agentReportPreview=require(_0xf870('0x6'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x5497ca){return function(_0xdb70e8){logger[_0xf870('0x7')](_0x5497ca,util[_0xf870('0x8')](_0xdb70e8,{'showHidden':![],'depth':null}));};}function create(_0x2b6672){return BPromise[_0xf870('0x9')]()[_0xf870('0xa')](cmHopperHistory[_0xf870('0xb')](_0x2b6672))[_0xf870('0xc')](loggerCatch(_0xf870('0xd')));}function createAgent(_0x336243){return BPromise[_0xf870('0x9')]()[_0xf870('0xa')](agentReportPreview[_0xf870('0xb')](_0x336243))[_0xf870('0xc')](loggerCatch('[createHistory]\x20'));}function moveContact(_0x40a016){return BPromise[_0xf870('0x9')]()[_0xf870('0xa')](cmHopper[_0xf870('0xe')](_0x40a016,!![]))[_0xf870('0xc')](loggerCatch(_0xf870('0xf')));}exports[_0xf870('0x10')]=function(_0x25da91){return BPromise[_0xf870('0x9')]()[_0xf870('0xa')](cmHopperBlack['checkIsBlackList'](_0x25da91))[_0xf870('0xc')](loggerCatch(_0xf870('0x11')));};exports[_0xf870('0x12')]=function(_0x1507d4){return BPromise[_0xf870('0x9')]()[_0xf870('0xa')](cmHopper[_0xf870('0x12')](_0x1507d4))[_0xf870('0xc')](loggerCatch(_0xf870('0x13')));};exports[_0xf870('0xb')]=function(_0x491cf4,_0x10091f){create(_0x491cf4)['catch'](loggerCatch(_0x10091f));moveContact(_0x491cf4)[_0xf870('0xc')](loggerCatch(_0x10091f));};exports['createAgentHistory']=function(_0x29eb95,_0x2bb9fa){createAgent(_0x29eb95)[_0xf870('0xc')](loggerCatch(_0x2bb9fa));};exports[_0xf870('0x14')]=function(_0x4fd580,_0xb08531){create(_0x4fd580)[_0xf870('0xc')](loggerCatch(_0xb08531));};exports[_0xf870('0x15')]=function(_0x2429d7,_0x25d404){moveContact(_0x2429d7)[_0xf870('0xc')](loggerCatch(_0x25d404));};exports[_0xf870('0x16')]=function(_0x3fb283,_0x33e3f4,_0x1eb312){if(_0x33e3f4){_0x3fb283[_0xf870('0x17')]=null;}if(_0x1eb312){_0x3fb283[_0xf870('0x18')]=![];}return BPromise['resolve']()[_0xf870('0xa')](cmHopper[_0xf870('0x16')](_0x3fb283))[_0xf870('0xc')](loggerCatch('[rescheduleContact]\x20'));};exports[_0xf870('0x19')]=function(_0x14604d){return BPromise['resolve']()[_0xf870('0xa')](cmHopper[_0xf870('0x19')](_0x14604d))['catch'](loggerCatch('[countReScheduled]\x20'));};exports['unlockContact']=function(_0x4762bd){return BPromise[_0xf870('0x9')]()[_0xf870('0xa')](cmHopper[_0xf870('0x1a')]({'UserId':null},_0x4762bd,0x1))[_0xf870('0xc')](loggerCatch(_0xf870('0x1b')));};exports['disableContact']=function(_0x5c2fd6){return BPromise[_0xf870('0x9')]()['then'](cmHopper[_0xf870('0x1a')]({'active':![]},_0x5c2fd6,0x1))[_0xf870('0xc')](loggerCatch(_0xf870('0x1c')));};exports[_0xf870('0x1d')]=function(_0x39b2c6){var _0x1cb603={};_0x1cb603[_0xf870('0x1e')]=_0x39b2c6[_0xf870('0x1e')];_0x1cb603[_0xf870('0x1f')]=_0x39b2c6['uniqueid'];_0x1cb603[_0xf870('0x20')]=_0x39b2c6[_0xf870('0x20')];_0x1cb603[_0xf870('0x21')]=_0x39b2c6[_0xf870('0x21')];_0x1cb603['queue']=_0x39b2c6[_0xf870('0x22')];_0x1cb603[_0xf870('0x23')]=_0x39b2c6[_0xf870('0x24')];_0x1cb603[_0xf870('0x25')]=_0x39b2c6[_0xf870('0x24')];_0x1cb603[_0xf870('0x26')]=0x1;_0x1cb603[_0xf870('0x27')]=_0x39b2c6[_0xf870('0x28')];_0x1cb603[_0xf870('0x29')]=_0x39b2c6[_0xf870('0x2a')];_0x1cb603[_0xf870('0x2b')]=_0xf870('0x2c');_0x1cb603[_0xf870('0x2d')]='xcally-motion-preview';_0x1cb603[_0xf870('0x2e')]=0x0;_0x1cb603[_0xf870('0x2f')]=0x1;_0x1cb603[_0xf870('0x30')]=_0x39b2c6[_0xf870('0x2a')];_0x1cb603[_0xf870('0x31')]=_0xf870('0x32');return BPromise['resolve']()['then'](voiceQueueReport['create'](_0x1cb603))['catch'](loggerCatch(_0xf870('0x33')));};exports[_0xf870('0x34')]=function(_0x2e2d7e,_0xed32c1){return BPromise[_0xf870('0x9')]()[_0xf870('0xa')](cmHopper[_0xf870('0x34')](_0x2e2d7e,_0xed32c1))[_0xf870('0xc')](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0xf870('0x35')]=function(_0x2d5763){return BPromise[_0xf870('0x9')]()[_0xf870('0xa')](cmHopper['rescheduleContact'](_0x2d5763,!![],!![]))[_0xf870('0xc')](loggerCatch(_0xf870('0x36')));}; \ No newline at end of file +var _0x5743=['xcally-motion-preview','assigned','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','resolve','then','createHistory','catch','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','uniqueid','calleridnum','calleridname','queue','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','from-sip'];(function(_0x11647a,_0x78e078){var _0x1338c5=function(_0x3466a4){while(--_0x3466a4){_0x11647a['push'](_0x11647a['shift']());}};_0x1338c5(++_0x78e078);}(_0x5743,0x118));var _0x3574=function(_0x7ba6a9,_0x6bb3d5){_0x7ba6a9=_0x7ba6a9-0x0;var _0x22d08c=_0x5743[_0x7ba6a9];return _0x22d08c;};'use strict';var util=require(_0x3574('0x0'));var BPromise=require(_0x3574('0x1'));var logger=require(_0x3574('0x2'))(_0x3574('0x3'));var _=require('lodash');var cmHopper=require(_0x3574('0x4'));var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require(_0x3574('0x5'));var cmHopperBlack=require(_0x3574('0x6'));var voiceQueueRt=require('../rpc/voiceQueueRt');var agentReportPreview=require(_0x3574('0x7'));var voiceQueueReport=require(_0x3574('0x8'));function loggerCatch(_0x4f5504){return function(_0x940a03){logger[_0x3574('0x9')](_0x4f5504,util[_0x3574('0xa')](_0x940a03,{'showHidden':![],'depth':null}));};}function create(_0x13c456){return BPromise['resolve']()['then'](cmHopperHistory['createHistory'](_0x13c456))['catch'](loggerCatch('[createHistory]\x20'));}function createAgent(_0x4398d7){return BPromise[_0x3574('0xb')]()[_0x3574('0xc')](agentReportPreview[_0x3574('0xd')](_0x4398d7))[_0x3574('0xe')](loggerCatch('[createHistory]\x20'));}function moveContact(_0x3f4768){return BPromise[_0x3574('0xb')]()[_0x3574('0xc')](cmHopper[_0x3574('0xf')](_0x3f4768,!![]))[_0x3574('0xe')](loggerCatch(_0x3574('0x10')));}exports[_0x3574('0x11')]=function(_0x161a34){return BPromise[_0x3574('0xb')]()[_0x3574('0xc')](cmHopperBlack['checkIsBlackList'](_0x161a34))[_0x3574('0xe')](loggerCatch(_0x3574('0x12')));};exports[_0x3574('0x13')]=function(_0x2bd95e){return BPromise[_0x3574('0xb')]()[_0x3574('0xc')](cmHopper['getContactPreview'](_0x2bd95e))[_0x3574('0xe')](loggerCatch('[getContactPreview]\x20'));};exports['createHistory']=function(_0x339a49,_0xfe3a80){create(_0x339a49)[_0x3574('0xe')](loggerCatch(_0xfe3a80));moveContact(_0x339a49)[_0x3574('0xe')](loggerCatch(_0xfe3a80));};exports[_0x3574('0x14')]=function(_0x235265,_0x1cb9e9){createAgent(_0x235265)[_0x3574('0xe')](loggerCatch(_0x1cb9e9));};exports[_0x3574('0x15')]=function(_0x4d52d7,_0x535a10){create(_0x4d52d7)[_0x3574('0xe')](loggerCatch(_0x535a10));};exports[_0x3574('0x16')]=function(_0x3a14c9,_0x2c0f46){moveContact(_0x3a14c9)[_0x3574('0xe')](loggerCatch(_0x2c0f46));};exports[_0x3574('0x17')]=function(_0x184249,_0x122ba9,_0x10c3cb){if(_0x122ba9){_0x184249['UserId']=null;}if(_0x10c3cb){_0x184249[_0x3574('0x18')]=![];}return BPromise['resolve']()['then'](cmHopper[_0x3574('0x17')](_0x184249))[_0x3574('0xe')](loggerCatch(_0x3574('0x19')));};exports[_0x3574('0x1a')]=function(_0xbdc89f){return BPromise[_0x3574('0xb')]()[_0x3574('0xc')](cmHopper['countReScheduled'](_0xbdc89f))[_0x3574('0xe')](loggerCatch(_0x3574('0x1b')));};exports[_0x3574('0x1c')]=function(_0x1edc89){return BPromise[_0x3574('0xb')]()[_0x3574('0xc')](cmHopper['unlockContact']({'UserId':null},_0x1edc89,0x1))[_0x3574('0xe')](loggerCatch(_0x3574('0x1d')));};exports[_0x3574('0x1e')]=function(_0x9063ec){return BPromise[_0x3574('0xb')]()['then'](cmHopper[_0x3574('0x1c')]({'active':![]},_0x9063ec,0x1))['catch'](loggerCatch('[activeContact]\x20'));};exports['crateCustomerReportQueue']=function(_0x2a28b4){var _0x54390b={};_0x54390b['type']=_0x2a28b4['type'];_0x54390b[_0x3574('0x1f')]=_0x2a28b4[_0x3574('0x1f')];_0x54390b[_0x3574('0x20')]=_0x2a28b4[_0x3574('0x20')];_0x54390b[_0x3574('0x21')]=_0x2a28b4[_0x3574('0x21')];_0x54390b[_0x3574('0x22')]=_0x2a28b4['queue'];_0x54390b['queuecallerjoinAt']=_0x2a28b4[_0x3574('0x23')];_0x54390b[_0x3574('0x24')]=_0x2a28b4['answertime'];_0x54390b[_0x3574('0x25')]=0x1;_0x54390b[_0x3574('0x26')]=_0x2a28b4[_0x3574('0x27')];_0x54390b[_0x3574('0x28')]=_0x2a28b4[_0x3574('0x29')];_0x54390b[_0x3574('0x2a')]=_0x3574('0x2b');_0x54390b['exten']=_0x3574('0x2c');_0x54390b['holdtime']=0x0;_0x54390b[_0x3574('0x2d')]=0x1;_0x54390b['lastAssignedTo']=_0x2a28b4[_0x3574('0x29')];_0x54390b[_0x3574('0x2e')]=_0x3574('0x2f');return BPromise[_0x3574('0xb')]()['then'](voiceQueueReport[_0x3574('0x30')](_0x54390b))[_0x3574('0xe')](loggerCatch(_0x3574('0x31')));};exports[_0x3574('0x32')]=function(_0x4db856,_0x3cd5b3){return BPromise['resolve']()[_0x3574('0xc')](cmHopper[_0x3574('0x32')](_0x4db856,_0x3cd5b3))[_0x3574('0xe')](loggerCatch(_0x3574('0x33')));};exports[_0x3574('0x34')]=function(_0x41cd33){return BPromise[_0x3574('0xb')]()['then'](cmHopper[_0x3574('0x17')](_0x41cd33,!![],!![]))[_0x3574('0xe')](loggerCatch(_0x3574('0x35')));}; \ 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 f82f0b5..c463820 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 _0xe4c0=['state','statedesc','responsetime','endtime','logAgent','YYYY-MM-DD\x20HH:mm:ss','ringtime','starttime','logLookAgent','membername','UserId','talktime','answertime','variablesAction','RECALL','BOOKED','originate','channelAgent','calleridnum','from-sip','timeout','uniqueid','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','clone','Global','scheduledAt','active','scheduledat','add','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','queue','motionChannel','voice','mandatoryDisposition','buildAcw','interface','status','reachable','getDiff','seconds','createBody','CampaignId','filterKey','dialAnswer','countglobal','callback','callbackuniqueid','callbackat','recallme','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','match','noanswer','variables','keys','forEach','toLowerCase','buildNoAnswerEventPayload','lodash','../../../../config/logger','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','loggerCatch','error','inspect','info','loggerError','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','monitor_format','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','createdAt','updatedAt','%s%s','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0xe4c0,0x17f));var _0x0e4c=function(_0x8550ba,_0x57c10d){_0x8550ba=_0x8550ba-0x0;var _0x432399=_0xe4c0[_0x8550ba];return _0x432399;};'use strict';var util=require('util');var _=require(_0x0e4c('0x0'));var moment=require('moment');var logger=require(_0x0e4c('0x1'))('preview');var ipAgi=process[_0x0e4c('0x2')][_0x0e4c('0x3')]||_0x0e4c('0x4');function getSeconds(_0x582e5a,_0x3e3a68){var _0x452a39=moment(_0x582e5a)[_0x0e4c('0x5')](0x0);var _0x5c4976=moment(_0x3e3a68)[_0x0e4c('0x5')](0x0);return _0x452a39[_0x0e4c('0x6')](_0x5c4976,'seconds');}exports[_0x0e4c('0x7')]=function(_0x35dea1){return function(_0x473f51){logger[_0x0e4c('0x8')](_0x35dea1,util[_0x0e4c('0x9')](_0x473f51,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x890900,_0x2b0f8d){logger[_0x0e4c('0xa')](_0x890900,util[_0x0e4c('0x9')](_0x2b0f8d,{'showHidden':![],'depth':null}));};exports[_0x0e4c('0xb')]=function(_0x32e1bd,_0x283109){logger[_0x0e4c('0x8')](_0x32e1bd,util[_0x0e4c('0x9')](_0x283109,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x49638f){return function(_0x2612a8){logger[_0x0e4c('0xa')](_0x49638f,util[_0x0e4c('0x9')](_0x2612a8,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x4b686d,_0x3f762c,_0x34d417){return{'message':_0x4b686d,'unlock':_0x3f762c,'active':_0x34d417};};exports[_0x0e4c('0xc')]=function(_0x13df74,_0x4f91b0,_0xd89dd9){if(!_[_0x0e4c('0xd')](_0xd89dd9)&&_0x0e4c('0xe')===typeof _0xd89dd9&&!_[_0x0e4c('0xf')](_0xd89dd9)){if(!_[_0x0e4c('0xd')](_0x4f91b0)&&'string'===typeof _0x4f91b0&&!_[_0x0e4c('0xf')](_0x4f91b0)){return util[_0x0e4c('0x10')](_0x0e4c('0x11'),_0x4f91b0,_0xd89dd9);}return util[_0x0e4c('0x10')](_0x0e4c('0x11'),_0xd89dd9,_0xd89dd9);}if(!_[_0x0e4c('0xd')](_0x13df74)&&'string'===typeof _0x13df74&&!_[_0x0e4c('0xf')](_0x13df74)){return _0x13df74;}return _0x0e4c('0x12');};exports[_0x0e4c('0x13')]=function(_0x21a764){if(_[_0x0e4c('0x14')](_0x21a764)){return![];}return _0x21a764;};exports[_0x0e4c('0x15')]=function(_0x1ce207,_0xe45d55,_0x9ae990,_0x3c090c,_0x1e8269,_0x2055ed){var _0x1764bd={'XMD-QUEUE':_0xe45d55[_0x0e4c('0x16')]?_0xe45d55[_0x0e4c('0x16')][_0x0e4c('0x17')]:'','XMD-CALLERID':_0x3c090c,'XMD-CALLERID-PREVIEW':_0x2055ed?util[_0x0e4c('0x10')](_0x0e4c('0x11'),_0x2055ed['calleridname'],_0x2055ed['calleridnum']):_0x3c090c,'XMD-DIALID':_0x1e8269,'XMD-CONTACTID':_0xe45d55[_0x0e4c('0x18')],'XMD-CDRTYPE':_0x0e4c('0x19'),'CALLERID(all)':_0x3c090c,'XMD-VOICEQUEUEID':_0xe45d55[_0x0e4c('0x1a')],'XMD-DIALCHANNEL':_0x9ae990,'XMD-DIALTIMEOUT':_0x1ce207[_0x0e4c('0x1b')]||0x1e,'XMD-DIALOPTIONS':util[_0x0e4c('0x10')](_0x0e4c('0x1c'),_0x1ce207[_0x0e4c('0x1d')]?'g':'',_[_0x0e4c('0xf')](_0x1ce207['monitor_format'])?'':_0x0e4c('0x1e')),'XMD-DIALURL':_0x1ce207[_0x0e4c('0x1f')]||'','XMD-AGI':_0x1ce207[_0x0e4c('0x20')]?util[_0x0e4c('0x10')](_0x0e4c('0x21'),ipAgi,_0x1ce207['dialQueueProject']):_0x0e4c('0x22'),'XMD-AGIAFTER':_0x1ce207[_0x0e4c('0x1d')]?util[_0x0e4c('0x10')](_0x0e4c('0x21'),ipAgi,_0x1ce207['dialQueueProject2']):_0x0e4c('0x22'),'XMD-ORIGINATECALLERIDNUM':_0x2055ed?_0x2055ed['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x2055ed?_0x2055ed[_0x0e4c('0x23')]:'','XMD-DESTINATION':_0x0e4c('0x24'),'SIPADDHEADER':_0x0e4c('0x25')};if(!_[_0x0e4c('0xf')](_0x1ce207[_0x0e4c('0x26')])){_0x1764bd[util[_0x0e4c('0x10')]('%s',_0x0e4c('0x27'))]=_0x1ce207[_0x0e4c('0x26')];_0x1764bd[util['format']('%s',_0x0e4c('0x28'))]=_0x1e8269;}if(_0xe45d55&&_0xe45d55[_0x0e4c('0x29')]){for(var _0x161006 in _0xe45d55[_0x0e4c('0x29')]){if(_0xe45d55['Contact'][_0x0e4c('0x2a')](_0x161006)){if(!_[_0x0e4c('0x14')](_0xe45d55[_0x0e4c('0x29')][_0x161006])&&_0x161006!=='id'&&_0x161006!==_0x0e4c('0x2b')&&_0x161006!==_0x0e4c('0x2c')&&_0x161006!==_0x0e4c('0x2d')){_0x1764bd[util[_0x0e4c('0x10')](_0x0e4c('0x2e'),'XMD-',_['toUpper'](_0x161006))]=_0xe45d55[_0x0e4c('0x29')][_0x161006];}}}}return _0x1764bd;};exports[_0x0e4c('0x2f')]=function(_0x21f381){var _0x567da6={};for(var _0x1d7dc3 in _0x21f381){if(_0x21f381[_0x0e4c('0x2a')](_0x1d7dc3)){_0x567da6[util['format']('%s',_[_0x0e4c('0x30')](_0x1d7dc3))]=_0x21f381[_0x1d7dc3];}}return{'variables':_0x567da6};};exports[_0x0e4c('0x31')]=function(_0x5276fc,_0x45d9c2){if(!_[_0x0e4c('0x14')](_0x5276fc)){if(_0x5276fc[_0x0e4c('0x2a')]('originated')){if(_0x5276fc[_0x0e4c('0x32')]>0x0){_0x5276fc[_0x0e4c('0x32')]-=0x1;}else{logger[_0x0e4c('0x8')](_0x0e4c('0x33'),_0x45d9c2);}}}else{logger[_0x0e4c('0x8')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x45d9c2);}};exports['logBlacklist']=function(_0x16e4ef){var _0x42c1a=moment()[_0x0e4c('0x10')]('YYYY-MM-DD\x20HH:mm:ss');_0x16e4ef[_0x0e4c('0x34')]=0xd;_0x16e4ef[_0x0e4c('0x35')]='Blacklist';_0x16e4ef['starttime']=_0x42c1a;_0x16e4ef[_0x0e4c('0x36')]=_0x42c1a;_0x16e4ef[_0x0e4c('0x37')]=_0x42c1a;};exports[_0x0e4c('0x38')]=function(_0xe30db0,_0x2633db,_0x1aa722){var _0x9c2b69=moment()['format'](_0x0e4c('0x39'));_0xe30db0[_0x0e4c('0x34')]=_0x2633db;_0xe30db0['statedesc']=_0x1aa722;_0xe30db0['responsetime']=_0x9c2b69;_0xe30db0[_0x0e4c('0x3a')]=getSeconds(_0xe30db0[_0x0e4c('0x36')],_0xe30db0[_0x0e4c('0x3b')]);};exports[_0x0e4c('0x3c')]=function(_0x516538,_0x164c37,_0x144269){_0x516538[_0x0e4c('0x3d')]=_0x164c37;_0x516538[_0x0e4c('0x3e')]=_0x144269;};exports['logCustomer']=function(_0x48f349,_0xadf32e,_0x2e3493){var _0x5cb3fc=moment()[_0x0e4c('0x10')](_0x0e4c('0x39'));_0x48f349[_0x0e4c('0x34')]=_0xadf32e;_0x48f349[_0x0e4c('0x35')]=_0x2e3493;_0x48f349['responsetime']=_0x48f349[_0x0e4c('0x36')]?_0x48f349[_0x0e4c('0x36')]:_0x5cb3fc;_0x48f349['endtime']=_0x48f349['endtime']?_0x48f349['endtime']:_0x5cb3fc;_0x48f349[_0x0e4c('0x3a')]=getSeconds(_0x48f349[_0x0e4c('0x36')]||0x0,_0x48f349[_0x0e4c('0x3b')]||0x0);_0x48f349[_0x0e4c('0x3f')]=_0x48f349[_0x0e4c('0x40')]?getSeconds(_0x48f349[_0x0e4c('0x37')],_0x48f349[_0x0e4c('0x40')]):0x0;};exports['isFailure']=function(_0x1bfbc4){return _0x1bfbc4==='Failure';};exports[_0x0e4c('0x41')]=function(_0x1dfca4,_0x4bac51,_0x5b7907,_0x15e119,_0x5a6489){var _0x5a9976=_0x15e119?_0x0e4c('0x42'):_0x1dfca4['calleridname'];_0x5a9976=_0x5a6489?_0x0e4c('0x43'):_0x5a9976;return{'actionid':_0x1dfca4['uniqueid'],'action':_0x0e4c('0x44'),'channel':_0x1dfca4[_0x0e4c('0x45')],'callerid':util[_0x0e4c('0x10')]('\x22%s\x22\x20<%s>',_0x5a9976,_0x1dfca4[_0x0e4c('0x46')]),'Exten':'xcally-motion-preview','Context':_0x0e4c('0x47'),'Priority':'1','variable':_0x5b7907,'timeout':(_0x4bac51[_0x0e4c('0x48')]||0x1e)*0x3e8,'async':!![],'channelid':_0x1dfca4[_0x0e4c('0x49')]};};exports[_0x0e4c('0x4a')]=function(_0x2d3fa6){return _0x2d3fa6[_0x0e4c('0x4b')]+_0x2d3fa6[_0x0e4c('0x4c')]+_0x2d3fa6[_0x0e4c('0x4d')]+_0x2d3fa6['countagentrejectretry']+_0x2d3fa6[_0x0e4c('0x4e')];};exports['cloneAction']=function(_0x21a6ce){var _0x46d3ed=_[_0x0e4c('0x4f')](_0x21a6ce);_0x46d3ed[_0x0e4c('0x34')]=0xf;_0x46d3ed[_0x0e4c('0x35')]=_0x0e4c('0x50');return _0x46d3ed;};exports[_0x0e4c('0x51')]=function(_0x3d08e4,_0x33c752,_0x37d930){var _0x4f7760={};_0x4f7760[_0x33c752]=_0x3d08e4[_0x33c752];_0x4f7760[_0x0e4c('0x52')]=![];_0x4f7760[_0x0e4c('0x53')]=moment()[_0x0e4c('0x54')](_0x37d930,'minutes')[_0x0e4c('0x10')](_0x0e4c('0x39'));_0x4f7760[_0x0e4c('0x18')]=_0x3d08e4[_0x0e4c('0x18')];_0x4f7760[_0x0e4c('0x55')]=_0x3d08e4[_0x0e4c('0x55')];_0x4f7760[_0x0e4c('0x1a')]=_0x3d08e4[_0x0e4c('0x1a')]||undefined;return _0x4f7760;};exports[_0x0e4c('0x56')]=function(_0x513207,_0x461871){if(!_['isNil'](_0x513207)){if(_0x513207['pTalking']>0x0){_0x513207[_0x0e4c('0x57')]-=0x1;}else{logger[_0x0e4c('0x8')](_0x461871,_0x0e4c('0x58'));}}else{logger[_0x0e4c('0x8')](_0x461871,_0x0e4c('0x59'));}};exports[_0x0e4c('0x5a')]=function(_0x4941f5){if(_0x4941f5<=0x0){return!![];}return![];};function buildObj(_0x375fd6,_0x3ec8e2,_0x28727c){_0x375fd6[_0x0e4c('0x5b')]=_0x3ec8e2;_0x375fd6['name']=_0x375fd6[_0x0e4c('0x5c')];_0x375fd6['interface']=_0x375fd6[_0x0e4c('0x45')];_0x375fd6[_0x0e4c('0x5d')]=_0x0e4c('0x5e');if(_0x28727c){_0x375fd6[_0x0e4c('0x5f')]=_0x28727c[_0x0e4c('0x5f')];}return _0x375fd6;}exports['buildObj']=buildObj;exports[_0x0e4c('0x60')]=function(_0x576b0f){var _0x4cdf2c={};_0x4cdf2c[_0x0e4c('0x5c')]=_0x576b0f[_0x0e4c('0x5c')];_0x4cdf2c[_0x0e4c('0x61')]=_0x576b0f['channelAgent'];_0x4cdf2c[_0x0e4c('0x49')]=_0x576b0f[_0x0e4c('0x49')];return _0x4cdf2c;};exports['agentReadyId']=function(_0x1f18fb){var _0x320592=[];for(var _0x4713b4 in _0x1f18fb){if(_0x1f18fb[_0x0e4c('0x2a')](_0x4713b4)){if(!_[_0x0e4c('0x14')](_0x1f18fb[_0x4713b4])&&_0x1f18fb[_0x4713b4][_0x0e4c('0x34')]==='not_inuse'&&_0x1f18fb[_0x4713b4][_0x0e4c('0x62')]===_0x0e4c('0x63')){_0x320592['push'](_0x1f18fb[_0x4713b4]['id']);}}}return _0x320592;};exports[_0x0e4c('0x64')]=function(_0x46e3e1){var _0x6ec105=moment()[_0x0e4c('0x5')](0x0);var _0x4d4094=moment(_0x46e3e1)[_0x0e4c('0x5')](0x0);return _0x6ec105['diff'](_0x4d4094,_0x0e4c('0x65'));};exports[_0x0e4c('0x66')]=function(_0x379324){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x379324['ContactId'],'ListId':_0x379324[_0x0e4c('0x55')],'VoiceQueueId':_0x379324['VoiceQueueId']||undefined,'CampaignId':_0x379324[_0x0e4c('0x67')]||undefined};};exports[_0x0e4c('0x68')]=function(_0x3fb2cc){if(_0x3fb2cc===_0x0e4c('0x49')||_0x3fb2cc==='idContact'||_0x3fb2cc==='queue'||_0x3fb2cc==='type'||_0x3fb2cc==='campaigntype'||_0x3fb2cc===_0x0e4c('0x69')||_0x3fb2cc==='membername'||_0x3fb2cc===_0x0e4c('0x45')||_0x3fb2cc==='calleridname'||_0x3fb2cc===_0x0e4c('0x52')||_0x3fb2cc==='calleridnum'||_0x3fb2cc===_0x0e4c('0x53')||_0x3fb2cc===_0x0e4c('0x4b')||_0x3fb2cc===_0x0e4c('0x4c')||_0x3fb2cc==='countnoanswerretry'||_0x3fb2cc===_0x0e4c('0x6a')||_0x3fb2cc===_0x0e4c('0x6b')||_0x3fb2cc===_0x0e4c('0x6c')||_0x3fb2cc===_0x0e4c('0x6d')||_0x3fb2cc===_0x0e4c('0x6e')||_0x3fb2cc==='ContactId'||_0x3fb2cc===_0x0e4c('0x55')||_0x3fb2cc===_0x0e4c('0x3e')||_0x3fb2cc===_0x0e4c('0x1a')||_0x3fb2cc==='sipcallid'||_0x3fb2cc==='xmd-voicequeueid'||_0x3fb2cc==='xmd-queue'||_0x3fb2cc===_0x0e4c('0x6f')||_0x3fb2cc===_0x0e4c('0x70')||_0x3fb2cc===_0x0e4c('0x71')||_0x3fb2cc===_0x0e4c('0x72')||_0x3fb2cc===_0x0e4c('0x73')||_0x3fb2cc==='xmd-dialid'||_0x3fb2cc===_0x0e4c('0x74')||_0x3fb2cc===_0x0e4c('0x75')||_0x3fb2cc===_0x0e4c('0x76')||_0x3fb2cc===_0x0e4c('0x77')||_0x3fb2cc===_0x0e4c('0x78')||_0x3fb2cc===_0x0e4c('0x79')||_0x3fb2cc===_0x0e4c('0x7a')||_0x3fb2cc===_0x0e4c('0x7b')||_0x3fb2cc===_0x0e4c('0x7c')||_0x3fb2cc===_0x0e4c('0x7d')||_0x3fb2cc===_0x0e4c('0x7e')||_0x3fb2cc===_0x0e4c('0x7f')||_0x3fb2cc===_0x0e4c('0x80')||_0x3fb2cc===_0x0e4c('0x81')||_0x3fb2cc===_0x0e4c('0x7a')||_0x3fb2cc===_0x0e4c('0x7b')||_0x3fb2cc==='rtpaudioqosjitter'||_0x3fb2cc==='rtpaudioqosjitterbridged'||_0x3fb2cc===_0x0e4c('0x7e')||_0x3fb2cc==='rtpaudioqoslossbridged'||_0x3fb2cc===_0x0e4c('0x80')||_0x3fb2cc==='rtpaudioqosrttbridged'||_0x3fb2cc===_0x0e4c('0x82')||_0x3fb2cc===_0x0e4c('0x83')||_0x3fb2cc===_0x0e4c('0x34')||_0x3fb2cc===_0x0e4c('0x35')){return![];}return!![];};exports[_0x0e4c('0x84')]=function(_0x1a3cab,_0x2a4a83){var _0x1aa89a,_0x47c7f2,_0x4c95b9;if(_0x2a4a83<=0x0){_0x2a4a83=0x1;}_0x1aa89a=new RegExp(_0x0e4c('0x85')+_0x2a4a83+'}$');_0x47c7f2=Math[_0x0e4c('0x86')](0xa,_0x2a4a83-0x1);_0x4c95b9=Math[_0x0e4c('0x86')](0xa,_0x2a4a83)-0x1;return util['format']('%s',_[_0x0e4c('0x87')](_0x1a3cab,_0x1aa89a,_[_0x0e4c('0x88')](_0x47c7f2,_0x4c95b9)));};exports[_0x0e4c('0x89')]=function(_0x264114){var _0x3f117a=_0x264114[_0x0e4c('0x8a')](/"(.*?)"/);return _0x3f117a?_0x3f117a[0x1]:_0x264114;};exports['extractCalleridNumber']=function(_0x25c8c){var _0x43b3f3=_0x25c8c[_0x0e4c('0x8a')](/<(.*?)>/);return _0x43b3f3?_0x43b3f3[0x1]:_0x25c8c;};function buildNoAnswerEventPayload(_0x29105d,_0x3febba){var _0x207df5=buildObj(_0x29105d,_0x0e4c('0x8b'));if(!_[_0x0e4c('0xf')](_0x3febba[_0x0e4c('0x8c')])){Object[_0x0e4c('0x8d')](_0x3febba[_0x0e4c('0x8c')])[_0x0e4c('0x8e')](function(_0x28d79c){_0x207df5[_0x28d79c[_0x0e4c('0x8f')]()]=_0x3febba[_0x0e4c('0x8c')][_0x28d79c];});}return _0x207df5;}exports[_0x0e4c('0x90')]=buildNoAnswerEventPayload; \ No newline at end of file +var _0x9552=['minutes','ListId','decrementTalkink','pTalking','IsNotLoggedIn','lastevent','interface','motionChannel','voice','mandatoryDisposition','buildObj','buildAcw','queue','agentReadyId','not_inuse','status','push','CampaignId','filterKey','type','campaigntype','membername','callback','callbackuniqueid','callbackat','recallme','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqoslossbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','extractCalleridNumber','match','noanswer','variables','keys','forEach','toLowerCase','buildNoAnswerEventPayload','util','lodash','../../../../config/logger','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','seconds','loggerCatch','error','inspect','logger','info','message','getCallerId','isUndefined','string','format','\x22%s\x22\x20<%s>','isEmpty','\x22\x22\x20<>','isActive','addVariables','Queue','name','calleridnum','ContactId','dialer','VoiceQueueId','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','NONE','\x22agi://%s/square,%s\x22','originatecalleridnum','originatecalleridname','xcally-motion-preview','Contact','hasOwnProperty','isNil','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','toLower','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','responsetime','logAgent','ringtime','starttime','UserId','logCustomer','endtime','talktime','answertime','Failure','variablesAction','RECALL','calleridname','BOOKED','uniqueid','channelAgent','from-sip','timeout','countbusyretry','countcongestionretry','countnoanswerretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','add'];(function(_0x2b88aa,_0x4b9cff){var _0x22b896=function(_0x35ab6b){while(--_0x35ab6b){_0x2b88aa['push'](_0x2b88aa['shift']());}};_0x22b896(++_0x4b9cff);}(_0x9552,0x166));var _0x2955=function(_0x48d1ce,_0x31977c){_0x48d1ce=_0x48d1ce-0x0;var _0x3288c8=_0x9552[_0x48d1ce];return _0x3288c8;};'use strict';var util=require(_0x2955('0x0'));var _=require(_0x2955('0x1'));var moment=require('moment');var logger=require(_0x2955('0x2'))('preview');var ipAgi=process[_0x2955('0x3')][_0x2955('0x4')]||_0x2955('0x5');function getSeconds(_0x56b1bd,_0x16a0f1){var _0x263a02=moment(_0x56b1bd)['milliseconds'](0x0);var _0x146c57=moment(_0x16a0f1)[_0x2955('0x6')](0x0);return _0x263a02[_0x2955('0x7')](_0x146c57,_0x2955('0x8'));}exports[_0x2955('0x9')]=function(_0x1c59af){return function(_0x5b43d0){logger[_0x2955('0xa')](_0x1c59af,util[_0x2955('0xb')](_0x5b43d0,{'showHidden':![],'depth':null}));};};exports[_0x2955('0xc')]=function(_0x4ca611,_0x33e46c){logger[_0x2955('0xd')](_0x4ca611,util['inspect'](_0x33e46c,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x295d3f,_0x5dfb01){logger[_0x2955('0xa')](_0x295d3f,util[_0x2955('0xb')](_0x5dfb01,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x3e977e){return function(_0x33aebf){logger[_0x2955('0xd')](_0x3e977e,util[_0x2955('0xb')](_0x33aebf,{'showHidden':![],'depth':null}));};};exports[_0x2955('0xe')]=function(_0x2a5c3c,_0x2854a3,_0x22c433){return{'message':_0x2a5c3c,'unlock':_0x2854a3,'active':_0x22c433};};exports[_0x2955('0xf')]=function(_0x11a828,_0x6743f,_0x4ebf7a){if(!_[_0x2955('0x10')](_0x4ebf7a)&&_0x2955('0x11')===typeof _0x4ebf7a&&!_['isEmpty'](_0x4ebf7a)){if(!_[_0x2955('0x10')](_0x6743f)&&_0x2955('0x11')===typeof _0x6743f&&!_['isEmpty'](_0x6743f)){return util[_0x2955('0x12')](_0x2955('0x13'),_0x6743f,_0x4ebf7a);}return util[_0x2955('0x12')](_0x2955('0x13'),_0x4ebf7a,_0x4ebf7a);}if(!_[_0x2955('0x10')](_0x11a828)&&_0x2955('0x11')===typeof _0x11a828&&!_[_0x2955('0x14')](_0x11a828)){return _0x11a828;}return _0x2955('0x15');};exports[_0x2955('0x16')]=function(_0x2ea46d){if(_['isNil'](_0x2ea46d)){return![];}return _0x2ea46d;};exports[_0x2955('0x17')]=function(_0x1c3641,_0x4b6589,_0x33ae4f,_0x4d9f1b,_0x328553,_0x1f530a){var _0x216d34={'XMD-QUEUE':_0x4b6589[_0x2955('0x18')]?_0x4b6589['Queue'][_0x2955('0x19')]:'','XMD-CALLERID':_0x4d9f1b,'XMD-CALLERID-PREVIEW':_0x1f530a?util[_0x2955('0x12')]('\x22%s\x22\x20<%s>',_0x1f530a['calleridname'],_0x1f530a[_0x2955('0x1a')]):_0x4d9f1b,'XMD-DIALID':_0x328553,'XMD-CONTACTID':_0x4b6589[_0x2955('0x1b')],'XMD-CDRTYPE':_0x2955('0x1c'),'CALLERID(all)':_0x4d9f1b,'XMD-VOICEQUEUEID':_0x4b6589[_0x2955('0x1d')],'XMD-DIALCHANNEL':_0x33ae4f,'XMD-DIALTIMEOUT':_0x1c3641['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0x2955('0x12')](_0x2955('0x1e'),_0x1c3641[_0x2955('0x1f')]?'g':'',_[_0x2955('0x14')](_0x1c3641[_0x2955('0x20')])?'':_0x2955('0x21')),'XMD-DIALURL':_0x1c3641[_0x2955('0x22')]||'','XMD-AGI':_0x1c3641[_0x2955('0x23')]?util[_0x2955('0x12')]('\x22agi://%s/square,%s\x22',ipAgi,_0x1c3641[_0x2955('0x23')]):_0x2955('0x24'),'XMD-AGIAFTER':_0x1c3641[_0x2955('0x1f')]?util[_0x2955('0x12')](_0x2955('0x25'),ipAgi,_0x1c3641[_0x2955('0x1f')]):_0x2955('0x24'),'XMD-ORIGINATECALLERIDNUM':_0x1f530a?_0x1f530a[_0x2955('0x26')]:'','XMD-ORIGINATECALLERIDNAME':_0x1f530a?_0x1f530a[_0x2955('0x27')]:'','XMD-DESTINATION':_0x2955('0x28'),'SIPADDHEADER':'Call-Type:\x20PREVIEW'};if(!_['isEmpty'](_0x1c3641['monitor_format'])){_0x216d34[util[_0x2955('0x12')]('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x1c3641[_0x2955('0x20')];_0x216d34[util[_0x2955('0x12')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x328553;}if(_0x4b6589&&_0x4b6589[_0x2955('0x29')]){for(var _0x37d9ac in _0x4b6589[_0x2955('0x29')]){if(_0x4b6589[_0x2955('0x29')][_0x2955('0x2a')](_0x37d9ac)){if(!_[_0x2955('0x2b')](_0x4b6589[_0x2955('0x29')][_0x37d9ac])&&_0x37d9ac!=='id'&&_0x37d9ac!==_0x2955('0x2c')&&_0x37d9ac!==_0x2955('0x2d')&&_0x37d9ac!==_0x2955('0x2e')){_0x216d34[util[_0x2955('0x12')](_0x2955('0x2f'),_0x2955('0x30'),_[_0x2955('0x31')](_0x37d9ac))]=_0x4b6589[_0x2955('0x29')][_0x37d9ac];}}}}return _0x216d34;};exports['toLowerVariables']=function(_0x2b1d6e){var _0x472465={};for(var _0x2f8399 in _0x2b1d6e){if(_0x2b1d6e[_0x2955('0x2a')](_0x2f8399)){_0x472465[util[_0x2955('0x12')]('%s',_[_0x2955('0x32')](_0x2f8399))]=_0x2b1d6e[_0x2f8399];}}return{'variables':_0x472465};};exports['updateOriginated']=function(_0x2dcbea,_0x32e755){if(!_[_0x2955('0x2b')](_0x2dcbea)){if(_0x2dcbea['hasOwnProperty']('originated')){if(_0x2dcbea['originated']>0x0){_0x2dcbea[_0x2955('0x33')]-=0x1;}else{logger['error'](_0x2955('0x34'),_0x32e755);}}}else{logger[_0x2955('0xa')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x32e755);}};exports[_0x2955('0x35')]=function(_0x59d668){var _0x592de3=moment()[_0x2955('0x12')](_0x2955('0x36'));_0x59d668[_0x2955('0x37')]=0xd;_0x59d668[_0x2955('0x38')]=_0x2955('0x39');_0x59d668['starttime']=_0x592de3;_0x59d668[_0x2955('0x3a')]=_0x592de3;_0x59d668['endtime']=_0x592de3;};exports[_0x2955('0x3b')]=function(_0x42d72f,_0x5cfd04,_0x328eb4){var _0x229f6e=moment()['format'](_0x2955('0x36'));_0x42d72f[_0x2955('0x37')]=_0x5cfd04;_0x42d72f[_0x2955('0x38')]=_0x328eb4;_0x42d72f['responsetime']=_0x229f6e;_0x42d72f[_0x2955('0x3c')]=getSeconds(_0x42d72f[_0x2955('0x3a')],_0x42d72f[_0x2955('0x3d')]);};exports['logLookAgent']=function(_0x5931b9,_0x433c1d,_0x22e858){_0x5931b9['membername']=_0x433c1d;_0x5931b9[_0x2955('0x3e')]=_0x22e858;};exports[_0x2955('0x3f')]=function(_0x10e4cc,_0x4e21d5,_0x596737){var _0x46b395=moment()[_0x2955('0x12')](_0x2955('0x36'));_0x10e4cc[_0x2955('0x37')]=_0x4e21d5;_0x10e4cc[_0x2955('0x38')]=_0x596737;_0x10e4cc[_0x2955('0x3a')]=_0x10e4cc[_0x2955('0x3a')]?_0x10e4cc[_0x2955('0x3a')]:_0x46b395;_0x10e4cc['endtime']=_0x10e4cc[_0x2955('0x40')]?_0x10e4cc[_0x2955('0x40')]:_0x46b395;_0x10e4cc[_0x2955('0x3c')]=getSeconds(_0x10e4cc[_0x2955('0x3a')]||0x0,_0x10e4cc[_0x2955('0x3d')]||0x0);_0x10e4cc[_0x2955('0x41')]=_0x10e4cc[_0x2955('0x42')]?getSeconds(_0x10e4cc[_0x2955('0x40')],_0x10e4cc['answertime']):0x0;};exports['isFailure']=function(_0x2afb65){return _0x2afb65===_0x2955('0x43');};exports[_0x2955('0x44')]=function(_0x4c1060,_0x4de56d,_0x1fb1e1,_0x59de21,_0x22134e){var _0x3bbaf5=_0x59de21?_0x2955('0x45'):_0x4c1060[_0x2955('0x46')];_0x3bbaf5=_0x22134e?_0x2955('0x47'):_0x3bbaf5;return{'actionid':_0x4c1060[_0x2955('0x48')],'action':'originate','channel':_0x4c1060[_0x2955('0x49')],'callerid':util[_0x2955('0x12')](_0x2955('0x13'),_0x3bbaf5,_0x4c1060[_0x2955('0x1a')]),'Exten':_0x2955('0x28'),'Context':_0x2955('0x4a'),'Priority':'1','variable':_0x1fb1e1,'timeout':(_0x4de56d[_0x2955('0x4b')]||0x1e)*0x3e8,'async':!![],'channelid':_0x4c1060[_0x2955('0x48')]};};exports['totalGlobal']=function(_0xe552c0){return _0xe552c0[_0x2955('0x4c')]+_0xe552c0[_0x2955('0x4d')]+_0xe552c0[_0x2955('0x4e')]+_0xe552c0['countagentrejectretry']+_0xe552c0['countnosuchnumberretry'];};exports[_0x2955('0x4f')]=function(_0x3692b5){var _0x1b0bfc=_[_0x2955('0x50')](_0x3692b5);_0x1b0bfc['state']=0xf;_0x1b0bfc[_0x2955('0x38')]=_0x2955('0x51');return _0x1b0bfc;};exports[_0x2955('0x52')]=function(_0x20f75d,_0x1184ce,_0x2a53ea){var _0x1eeab7={};_0x1eeab7[_0x1184ce]=_0x20f75d[_0x1184ce];_0x1eeab7[_0x2955('0x53')]=![];_0x1eeab7[_0x2955('0x54')]=moment()[_0x2955('0x55')](_0x2a53ea,_0x2955('0x56'))[_0x2955('0x12')](_0x2955('0x36'));_0x1eeab7[_0x2955('0x1b')]=_0x20f75d[_0x2955('0x1b')];_0x1eeab7['ListId']=_0x20f75d[_0x2955('0x57')];_0x1eeab7[_0x2955('0x1d')]=_0x20f75d[_0x2955('0x1d')]||undefined;return _0x1eeab7;};exports[_0x2955('0x58')]=function(_0xfe6821,_0x212712){if(!_[_0x2955('0x2b')](_0xfe6821)){if(_0xfe6821['pTalking']>0x0){_0xfe6821[_0x2955('0x59')]-=0x1;}else{logger[_0x2955('0xa')](_0x212712,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0x2955('0xa')](_0x212712,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0x2955('0x5a')]=function(_0x3b69a4){if(_0x3b69a4<=0x0){return!![];}return![];};function buildObj(_0x30b80,_0x1071d3,_0x447ad3){_0x30b80[_0x2955('0x5b')]=_0x1071d3;_0x30b80['name']=_0x30b80['queue'];_0x30b80[_0x2955('0x5c')]=_0x30b80['channelAgent'];_0x30b80[_0x2955('0x5d')]=_0x2955('0x5e');if(_0x447ad3){_0x30b80[_0x2955('0x5f')]=_0x447ad3['mandatoryDisposition'];}return _0x30b80;}exports[_0x2955('0x60')]=buildObj;exports[_0x2955('0x61')]=function(_0x29a4cd){var _0x5f36a2={};_0x5f36a2[_0x2955('0x62')]=_0x29a4cd[_0x2955('0x62')];_0x5f36a2['interface']=_0x29a4cd[_0x2955('0x49')];_0x5f36a2['uniqueid']=_0x29a4cd[_0x2955('0x48')];return _0x5f36a2;};exports[_0x2955('0x63')]=function(_0x520157){var _0x4e0ef3=[];for(var _0x2699eb in _0x520157){if(_0x520157[_0x2955('0x2a')](_0x2699eb)){if(!_[_0x2955('0x2b')](_0x520157[_0x2699eb])&&_0x520157[_0x2699eb][_0x2955('0x37')]===_0x2955('0x64')&&_0x520157[_0x2699eb][_0x2955('0x65')]==='reachable'){_0x4e0ef3[_0x2955('0x66')](_0x520157[_0x2699eb]['id']);}}}return _0x4e0ef3;};exports['getDiff']=function(_0x22fa67){var _0x5c4539=moment()['milliseconds'](0x0);var _0x630c2e=moment(_0x22fa67)['milliseconds'](0x0);return _0x5c4539[_0x2955('0x7')](_0x630c2e,_0x2955('0x8'));};exports['createBody']=function(_0x164a01){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x164a01[_0x2955('0x1b')],'ListId':_0x164a01[_0x2955('0x57')],'VoiceQueueId':_0x164a01[_0x2955('0x1d')]||undefined,'CampaignId':_0x164a01[_0x2955('0x67')]||undefined};};exports[_0x2955('0x68')]=function(_0x210e31){if(_0x210e31===_0x2955('0x48')||_0x210e31==='idContact'||_0x210e31===_0x2955('0x62')||_0x210e31===_0x2955('0x69')||_0x210e31===_0x2955('0x6a')||_0x210e31==='dialAnswer'||_0x210e31===_0x2955('0x6b')||_0x210e31===_0x2955('0x49')||_0x210e31===_0x2955('0x46')||_0x210e31===_0x2955('0x53')||_0x210e31===_0x2955('0x1a')||_0x210e31==='scheduledat'||_0x210e31===_0x2955('0x4c')||_0x210e31===_0x2955('0x4d')||_0x210e31===_0x2955('0x4e')||_0x210e31==='countglobal'||_0x210e31===_0x2955('0x6c')||_0x210e31===_0x2955('0x6d')||_0x210e31===_0x2955('0x6e')||_0x210e31===_0x2955('0x6f')||_0x210e31==='ContactId'||_0x210e31===_0x2955('0x57')||_0x210e31===_0x2955('0x3e')||_0x210e31===_0x2955('0x1d')||_0x210e31==='sipcallid'||_0x210e31===_0x2955('0x70')||_0x210e31===_0x2955('0x71')||_0x210e31===_0x2955('0x72')||_0x210e31==='xmd-listid'||_0x210e31===_0x2955('0x73')||_0x210e31===_0x2955('0x74')||_0x210e31===_0x2955('0x75')||_0x210e31===_0x2955('0x76')||_0x210e31===_0x2955('0x77')||_0x210e31==='xmd-contactid'||_0x210e31===_0x2955('0x78')||_0x210e31===_0x2955('0x79')||_0x210e31===_0x2955('0x7a')||_0x210e31===_0x2955('0x7b')||_0x210e31===_0x2955('0x7c')||_0x210e31===_0x2955('0x7d')||_0x210e31===_0x2955('0x7e')||_0x210e31===_0x2955('0x7f')||_0x210e31===_0x2955('0x80')||_0x210e31==='rtpaudioqoslossbridged'||_0x210e31===_0x2955('0x81')||_0x210e31===_0x2955('0x82')||_0x210e31==='rtpaudioqos'||_0x210e31===_0x2955('0x7d')||_0x210e31===_0x2955('0x7e')||_0x210e31===_0x2955('0x7f')||_0x210e31===_0x2955('0x80')||_0x210e31===_0x2955('0x83')||_0x210e31===_0x2955('0x81')||_0x210e31===_0x2955('0x82')||_0x210e31===_0x2955('0x84')||_0x210e31===_0x2955('0x85')||_0x210e31==='state'||_0x210e31===_0x2955('0x38')){return![];}return!![];};exports[_0x2955('0x86')]=function(_0x147ec3,_0x457257){var _0xec789b,_0x2db53e,_0x1c4775;if(_0x457257<=0x0){_0x457257=0x1;}_0xec789b=new RegExp(_0x2955('0x87')+_0x457257+'}$');_0x2db53e=Math[_0x2955('0x88')](0xa,_0x457257-0x1);_0x1c4775=Math[_0x2955('0x88')](0xa,_0x457257)-0x1;return util[_0x2955('0x12')]('%s',_[_0x2955('0x89')](_0x147ec3,_0xec789b,_[_0x2955('0x8a')](_0x2db53e,_0x1c4775)));};exports[_0x2955('0x8b')]=function(_0x12c684){var _0x1ed03d=_0x12c684['match'](/"(.*?)"/);return _0x1ed03d?_0x1ed03d[0x1]:_0x12c684;};exports[_0x2955('0x8c')]=function(_0x1b58af){var _0x3edba2=_0x1b58af[_0x2955('0x8d')](/<(.*?)>/);return _0x3edba2?_0x3edba2[0x1]:_0x1b58af;};function buildNoAnswerEventPayload(_0x45ed38,_0x2c59be){var _0x335f70=buildObj(_0x45ed38,_0x2955('0x8e'));if(!_['isEmpty'](_0x2c59be[_0x2955('0x8f')])){Object[_0x2955('0x90')](_0x2c59be[_0x2955('0x8f')])[_0x2955('0x91')](function(_0x59b280){_0x335f70[_0x59b280[_0x2955('0x92')]()]=_0x2c59be[_0x2955('0x8f')][_0x59b280];});}return _0x335f70;}exports[_0x2955('0x93')]=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 3181e27..851bd2f 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 _0x84ca=['boolean','voicequeuechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','queueremove','queuepause'];(function(_0x28e898,_0x6fdf08){var _0x7d501b=function(_0x3b25bd){while(--_0x3b25bd){_0x28e898['push'](_0x28e898['shift']());}};_0x7d501b(++_0x6fdf08);}(_0x84ca,0x1d4));var _0xa84c=function(_0x206f5d,_0x5d3f69){_0x206f5d=_0x206f5d-0x0;var _0x46a1a0=_0x84ca[_0x206f5d];return _0x46a1a0;};'use strict';exports[_0xa84c('0x0')]={'queue':{'type':_0xa84c('0x1'),'required':!![]},'interface':{'type':_0xa84c('0x1'),'required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':'number','required':![]},'paused':{'type':'boolean','required':![]}};exports[_0xa84c('0x2')]={'queue':{'type':'string','required':!![]},'interface':{'type':'string','required':!![]}};exports[_0xa84c('0x3')]={'interface':{'type':_0xa84c('0x1'),'required':!![]},'paused':{'type':_0xa84c('0x4')},'reason':{'type':_0xa84c('0x1'),'required':![]}};exports['reload']={'module':{'type':_0xa84c('0x1'),'required':![]}};exports[_0xa84c('0x5')]={'uniqueid':{'type':_0xa84c('0x1'),'required':!![]}};exports['voicechannel']={'uniqueid':{'type':_0xa84c('0x1'),'required':!![]},'filename':{'type':_0xa84c('0x1')},'format':{'type':_0xa84c('0x1')},'mixmonitorid':{'type':_0xa84c('0x1')}};exports[_0xa84c('0x6')]={'uniqueid':{'type':_0xa84c('0x1'),'required':!![]}};exports[_0xa84c('0x7')]={'uniqueid':{'type':_0xa84c('0x1'),'required':!![]},'exten':{'type':_0xa84c('0x1'),'required':!![]},'context':{'type':_0xa84c('0x1')}}; \ No newline at end of file +var _0x79fd=['string','number','boolean','queuepause','voicequeuechannel','voicechannel'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x79fd,0x108));var _0xd79f=function(_0x4b43f7,_0x4db93c){_0x4b43f7=_0x4b43f7-0x0;var _0x2f12b0=_0x79fd[_0x4b43f7];return _0x2f12b0;};'use strict';exports['queueadd']={'queue':{'type':_0xd79f('0x0'),'required':!![]},'interface':{'type':_0xd79f('0x0'),'required':!![]},'membername':{'type':_0xd79f('0x0'),'required':!![]},'penalty':{'type':_0xd79f('0x1'),'required':![]},'paused':{'type':_0xd79f('0x2'),'required':![]}};exports['queueremove']={'queue':{'type':_0xd79f('0x0'),'required':!![]},'interface':{'type':_0xd79f('0x0'),'required':!![]}};exports[_0xd79f('0x3')]={'interface':{'type':'string','required':!![]},'paused':{'type':_0xd79f('0x2')},'reason':{'type':_0xd79f('0x0'),'required':![]}};exports['reload']={'module':{'type':'string','required':![]}};exports[_0xd79f('0x4')]={'uniqueid':{'type':'string','required':!![]}};exports[_0xd79f('0x5')]={'uniqueid':{'type':_0xd79f('0x0'),'required':!![]},'filename':{'type':'string'},'format':{'type':_0xd79f('0x0')},'mixmonitorid':{'type':_0xd79f('0x0')}};exports['voicequeuechannelhangup']={'uniqueid':{'type':_0xd79f('0x0'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0xd79f('0x0'),'required':!![]},'exten':{'type':_0xd79f('0x0'),'required':!![]},'context':{'type':_0xd79f('0x0')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index a108b34..3538bb1 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 _0x4732=['name','hasOwnProperty','interface','SIP/%s','total','answered','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','unmanaged','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','agents','length','isNil','initTelephones','initTrunks','isUndefined','trunks','initTemplates','templates','initZendeskAccounts','freshdeskAccounts','initZohoAccounts','zohoAccounts','initDeskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','queuecallerexit','queuecallerabandon','abandoned','diff','queuecallerjoinAt','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallerleaveAt','seconds','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','initCampaigns','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','merge','initFaxAccounts','exports','util','moment','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/salesforceAccount','../model/freshdeskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','telephones','voiceQueues','triggers','outbound','voiceExtensions','channels','queueChannels','timers','settings','zendeskAccounts','salesforceAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','format'];(function(_0xae4f5a,_0x154d5f){var _0x39338c=function(_0x248f4d){while(--_0x248f4d){_0xae4f5a['push'](_0xae4f5a['shift']());}};_0x39338c(++_0x154d5f);}(_0x4732,0x17d));var _0x2473=function(_0x1e6b59,_0x5eca5d){_0x1e6b59=_0x1e6b59-0x0;var _0x40d7c5=_0x4732[_0x1e6b59];return _0x40d7c5;};'use strict';var util=require(_0x2473('0x0'));var _=require('lodash');var moment=require(_0x2473('0x1'));var Agent=require('../model/agent');var Telephone=require(_0x2473('0x2'));var Trunk=require(_0x2473('0x3'));var VoiceQueue=require(_0x2473('0x4'));var Trigger=require(_0x2473('0x5'));var Template=require(_0x2473('0x6'));var Campaign=require(_0x2473('0x7'));var VoiceExtension=require(_0x2473('0x8'));var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require(_0x2473('0x9'));var FreshdeskAccount=require(_0x2473('0xa'));var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0x2473('0xb'));var ServicenowAccount=require(_0x2473('0xc'));var Dynamics365Account=require(_0x2473('0xd'));var FreshsalesAccount=require(_0x2473('0xe'));var FaxAccount=require(_0x2473('0xf'));var Realtime=function(){this['agents']={};this[_0x2473('0x10')]={};this['trunks']={};this[_0x2473('0x11')]={};this[_0x2473('0x12')]={};this['campaigns']={};this['templates']={};this[_0x2473('0x13')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x2473('0x14')]={};this[_0x2473('0x15')]={};this[_0x2473('0x16')]={};this['outboundChannels']={};this[_0x2473('0x17')]={};this[_0x2473('0x18')]={};this[_0x2473('0x19')]={};this[_0x2473('0x1a')]={};this['sugarcrmAccounts']={};this['freshdeskAccounts']={};this['zohoAccounts']={};this[_0x2473('0x1b')]={};this[_0x2473('0x1c')]={};this[_0x2473('0x1d')]={};this[_0x2473('0x1e')]={};this[_0x2473('0x1f')]={};this[_0x2473('0x20')]={};};function freeIsNotKey(_0x590f26,_0xdad667,_0x2b18b1){var _0x14fcf2=_[_0x2473('0x21')](_0x590f26,function(_0x2470c8,_0x1142a9){return _0x2470c8[_0x2b18b1];});for(var _0x28d995 in _0xdad667){if(_0xdad667['hasOwnProperty'](_0x28d995)){if(!_0x14fcf2[_0x28d995]){delete _0xdad667[_0x28d995];}}}}function freeIsNotKeySip(_0x2dcaf1,_0x3c5b55){var _0x31de9b=_[_0x2473('0x21')](_0x2dcaf1,function(_0x2a858a,_0x1e726f){return util[_0x2473('0x22')]('SIP/%s',_0x2a858a[_0x2473('0x23')]);});for(var _0x3a8111 in _0x3c5b55){if(_0x3c5b55[_0x2473('0x24')](_0x3a8111)){if(!_0x31de9b[_0x3a8111]){delete _0x3c5b55[_0x3a8111];}}}}function freeIsNotKeyAgent(_0x485a52,_0x26afc4){var _0xe73ba5=_[_0x2473('0x21')](_0x485a52,function(_0x5cd072,_0x132878){var _0x29066d=_['isNil'](_0x5cd072[_0x2473('0x25')])?util[_0x2473('0x22')](_0x2473('0x26'),_0x5cd072[_0x2473('0x23')]):_0x5cd072['interface'];return _0x29066d;});for(var _0x4f914b in _0x26afc4){if(_0x26afc4[_0x2473('0x24')](_0x4f914b)){if(!_0xe73ba5[_0x4f914b]){delete _0x26afc4[_0x4f914b];}}}}function clearVoiceCallReports(_0x4684ac){_0x4684ac[_0x2473('0x27')]=0x0;_0x4684ac[_0x2473('0x28')]=0x0;_0x4684ac[_0x2473('0x29')]=0x0;_0x4684ac[_0x2473('0x2a')]=0x0;_0x4684ac[_0x2473('0x2b')]=0x0;}function clearCampaigns(_0x41cc48){if(!_[_0x2473('0x2c')](_0x41cc48)){for(var _0x5d9aaf in _0x41cc48){if(_0x41cc48[_0x2473('0x24')](_0x5d9aaf)){_0x41cc48[_0x5d9aaf][_0x2473('0x2d')]=0x0;_0x41cc48[_0x5d9aaf]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x2cfda0){if(!_[_0x2473('0x2c')](_0x2cfda0)){for(var _0x15b311 in _0x2cfda0){if(_0x2cfda0['hasOwnProperty'](_0x15b311)){_0x2cfda0[_0x15b311][_0x2473('0x27')]=0x0;_0x2cfda0[_0x15b311][_0x2473('0x28')]=0x0;_0x2cfda0[_0x15b311][_0x2473('0x2e')]=0x0;_0x2cfda0[_0x15b311]['abandoned']=0x0;_0x2cfda0[_0x15b311][_0x2473('0x29')]=0x0;_0x2cfda0[_0x15b311]['sumDuration']=0x0;_0x2cfda0[_0x15b311][_0x2473('0x2b')]=0x0;_0x2cfda0[_0x15b311][_0x2473('0x2f')]=0x0;_0x2cfda0[_0x15b311]['outboundNoAnswerCallsDay']=0x0;_0x2cfda0[_0x15b311][_0x2473('0x30')]=0x0;_0x2cfda0[_0x15b311][_0x2473('0x31')]=0x0;_0x2cfda0[_0x15b311]['outboundNoSuchCallsDay']=0x0;_0x2cfda0[_0x15b311]['outboundUnknownCallsDay']=0x0;_0x2cfda0[_0x15b311][_0x2473('0x32')]=0x0;_0x2cfda0[_0x15b311][_0x2473('0x33')]=0x0;_0x2cfda0[_0x15b311][_0x2473('0x34')]=0x0;_0x2cfda0[_0x15b311][_0x2473('0x35')]=0x0;_0x2cfda0[_0x15b311][_0x2473('0x36')]=0x0;_0x2cfda0[_0x15b311]['outboundReCallsDay']=0x0;_0x2cfda0[_0x15b311][_0x2473('0x2f')]=0x0;_0x2cfda0[_0x15b311][_0x2473('0x37')]=0x0;_0x2cfda0[_0x15b311][_0x2473('0x38')]=!![];}}}}Realtime[_0x2473('0x39')][_0x2473('0x3a')]=function(_0x286ce1,_0x1fffb5){for(var _0x51e1d5 in _0x1fffb5){if(_0x286ce1[_0x2473('0x24')](_0x51e1d5)){_0x286ce1[_0x51e1d5]=_0x1fffb5[_0x51e1d5];}}};Realtime[_0x2473('0x39')][_0x2473('0x3b')]=function(){var _0x5a2081=this;return function(_0x117b94){if(_0x117b94){freeIsNotKeyAgent(_0x117b94,_0x5a2081[_0x2473('0x3c')]);for(var _0x3314ae=0x0,_0x5b2581={},_0x2fbfa3={};_0x3314ae<_0x117b94[_0x2473('0x3d')];_0x3314ae+=0x1){_0x5b2581=_0x117b94[_0x3314ae];var _0x437882=_[_0x2473('0x3e')](_0x5b2581[_0x2473('0x25')])?util['format'](_0x2473('0x26'),_0x5b2581[_0x2473('0x23')]):_0x5b2581[_0x2473('0x25')];if(_['isUndefined'](_0x5a2081['agents'][_0x437882])){_0x5a2081['agents'][_0x437882]=new Agent(_0x5b2581);}else{_0x5a2081[_0x2473('0x3a')](_0x5a2081['agents'][_0x437882],_0x5b2581);}}}return _0x5a2081[_0x2473('0x3c')];};};Realtime[_0x2473('0x39')][_0x2473('0x3f')]=function(){var _0x462af3=this;return function(_0x1ba7c7){if(_0x1ba7c7){freeIsNotKeySip(_0x1ba7c7,_0x462af3[_0x2473('0x10')]);for(var _0x1beba1=0x0,_0x2d672b={},_0x3c18d7={};_0x1beba1<_0x1ba7c7[_0x2473('0x3d')];_0x1beba1+=0x1){_0x2d672b=_0x1ba7c7[_0x1beba1];if(_['isUndefined'](_0x462af3[_0x2473('0x10')][util[_0x2473('0x22')](_0x2473('0x26'),_0x2d672b[_0x2473('0x23')])])){_0x462af3[_0x2473('0x10')][util[_0x2473('0x22')](_0x2473('0x26'),_0x2d672b['name'])]=new Telephone(_0x2d672b);}else{_0x462af3['mergeFromDatabase'](_0x462af3[_0x2473('0x10')][util['format'](_0x2473('0x26'),_0x2d672b[_0x2473('0x23')])],_0x2d672b);}}}return _0x462af3[_0x2473('0x10')];};};Realtime[_0x2473('0x39')][_0x2473('0x40')]=function(){var _0x3adb5b=this;return function(_0x3d90ea){if(_0x3d90ea){freeIsNotKeySip(_0x3d90ea,_0x3adb5b['trunks']);for(var _0x46440f=0x0,_0x3dadf0={},_0x244a19={};_0x46440f<_0x3d90ea['length'];_0x46440f+=0x1){_0x3dadf0=_0x3d90ea[_0x46440f];if(_[_0x2473('0x41')](_0x3adb5b[_0x2473('0x42')][util['format'](_0x2473('0x26'),_0x3dadf0[_0x2473('0x23')])])){_0x3adb5b[_0x2473('0x42')][util[_0x2473('0x22')](_0x2473('0x26'),_0x3dadf0[_0x2473('0x23')])]=new Trunk(_0x3dadf0);}else{_0x3adb5b[_0x2473('0x3a')](_0x3adb5b[_0x2473('0x42')][util[_0x2473('0x22')]('SIP/%s',_0x3dadf0[_0x2473('0x23')])],_0x3dadf0);}}}return _0x3adb5b[_0x2473('0x42')];};};Realtime['prototype']['initVoiceQueues']=function(){var _0x1fd737=this;return function(_0xfa9dbe){if(_0xfa9dbe){freeIsNotKey(_0xfa9dbe,_0x1fd737[_0x2473('0x11')],_0x2473('0x23'));for(var _0x3e8c15=0x0,_0x1e7376={},_0x14dad1={};_0x3e8c15<_0xfa9dbe[_0x2473('0x3d')];_0x3e8c15+=0x1){_0x1e7376=_0xfa9dbe[_0x3e8c15];if(_[_0x2473('0x41')](_0x1fd737[_0x2473('0x11')][_0x1e7376[_0x2473('0x23')]])){_0x1fd737['voiceQueues'][_0x1e7376[_0x2473('0x23')]]=new VoiceQueue(_0x1e7376);}else{_0x1fd737['mergeFromDatabase'](_0x1fd737['voiceQueues'][_0x1e7376['name']],_0x1e7376);}}}return _0x1fd737[_0x2473('0x11')];};};Realtime[_0x2473('0x39')]['initTriggers']=function(){var _0x7a57aa=this;return function(_0x31dbb1){if(_0x31dbb1){freeIsNotKey(_0x31dbb1,_0x7a57aa[_0x2473('0x12')],'id');for(var _0x2ce410=0x0,_0x4466bf={},_0x4847df={};_0x2ce410<_0x31dbb1[_0x2473('0x3d')];_0x2ce410+=0x1){_0x4466bf=_0x31dbb1[_0x2ce410];if(_[_0x2473('0x41')](_0x7a57aa[_0x2473('0x12')][_0x4466bf['id']])){_0x7a57aa[_0x2473('0x12')][_0x4466bf['id']]=new Trigger(_0x4466bf);}else{_0x7a57aa[_0x2473('0x3a')](_0x7a57aa[_0x2473('0x12')][_0x4466bf['id']],_0x4466bf);}}}return _0x7a57aa[_0x2473('0x12')];};};Realtime[_0x2473('0x39')][_0x2473('0x43')]=function(){var _0x243844=this;return function(_0x3c0c60){if(_0x3c0c60){freeIsNotKey(_0x3c0c60,_0x243844[_0x2473('0x44')],'id');for(var _0x452657=0x0,_0x13e14c={},_0x4722eb={};_0x452657<_0x3c0c60[_0x2473('0x3d')];_0x452657+=0x1){_0x13e14c=_0x3c0c60[_0x452657];if(_[_0x2473('0x41')](_0x243844[_0x2473('0x44')][_0x13e14c['id']])){_0x243844[_0x2473('0x44')][_0x13e14c['id']]=new Template(_0x13e14c);}else{_0x243844['mergeFromDatabase'](_0x243844[_0x2473('0x44')][_0x13e14c['id']],_0x13e14c);}}}return _0x243844[_0x2473('0x44')];};};Realtime[_0x2473('0x39')][_0x2473('0x45')]=function(){var _0x4179da=this;return function(_0x1f34db){if(_0x1f34db){freeIsNotKey(_0x1f34db,_0x4179da[_0x2473('0x19')],'id');for(var _0x34868b=0x0,_0x41de6f={},_0x41754f={};_0x34868b<_0x1f34db[_0x2473('0x3d')];_0x34868b+=0x1){_0x41de6f=_0x1f34db[_0x34868b];if(_[_0x2473('0x41')](_0x4179da[_0x2473('0x19')][_0x41de6f['id']])){_0x4179da['zendeskAccounts'][_0x41de6f['id']]=new ZendeskAccount(_0x41de6f);}else{_0x4179da['mergeFromDatabase'](_0x4179da[_0x2473('0x19')][_0x41de6f['id']],_0x41de6f);}}}return _0x4179da['zendeskAccounts'];};};Realtime[_0x2473('0x39')]['initSalesforceAccounts']=function(){var _0x128a45=this;return function(_0x1f06dd){if(_0x1f06dd){freeIsNotKey(_0x1f06dd,_0x128a45[_0x2473('0x1a')],'id');for(var _0xdd4181=0x0,_0x16187c={},_0x21b6c3={};_0xdd4181<_0x1f06dd['length'];_0xdd4181+=0x1){_0x16187c=_0x1f06dd[_0xdd4181];if(_['isUndefined'](_0x128a45[_0x2473('0x1a')][_0x16187c['id']])){_0x128a45[_0x2473('0x1a')][_0x16187c['id']]=new SalesforceAccount(_0x16187c);}else{_0x128a45[_0x2473('0x3a')](_0x128a45[_0x2473('0x1a')][_0x16187c['id']],_0x16187c);}}}return _0x128a45['salesforceAccounts'];};};Realtime[_0x2473('0x39')]['initFreshdeskAccounts']=function(){var _0xb1a369=this;return function(_0x419221){if(_0x419221){freeIsNotKey(_0x419221,_0xb1a369[_0x2473('0x46')],'id');for(var _0x28baca=0x0,_0x4c8cf5={},_0xcd2dc6={};_0x28baca<_0x419221['length'];_0x28baca+=0x1){_0x4c8cf5=_0x419221[_0x28baca];if(_['isUndefined'](_0xb1a369[_0x2473('0x46')][_0x4c8cf5['id']])){_0xb1a369[_0x2473('0x46')][_0x4c8cf5['id']]=new FreshdeskAccount(_0x4c8cf5);}else{_0xb1a369['mergeFromDatabase'](_0xb1a369['freshdeskAccounts'][_0x4c8cf5['id']],_0x4c8cf5);}}}return _0xb1a369[_0x2473('0x46')];};};Realtime[_0x2473('0x39')][_0x2473('0x47')]=function(){var _0x14e6dc=this;return function(_0x3a969c){if(_0x3a969c){freeIsNotKey(_0x3a969c,_0x14e6dc['zohoAccounts'],'id');for(var _0x4a44bd=0x0,_0x55cf30={},_0x4925e5={};_0x4a44bd<_0x3a969c['length'];_0x4a44bd+=0x1){_0x55cf30=_0x3a969c[_0x4a44bd];if(_[_0x2473('0x41')](_0x14e6dc['zohoAccounts'][_0x55cf30['id']])){_0x14e6dc[_0x2473('0x48')][_0x55cf30['id']]=new ZohoAccount(_0x55cf30);}else{_0x14e6dc['mergeFromDatabase'](_0x14e6dc[_0x2473('0x48')][_0x55cf30['id']],_0x55cf30);}}}return _0x14e6dc[_0x2473('0x48')];};};Realtime[_0x2473('0x39')][_0x2473('0x49')]=function(){var _0x5969fb=this;return function(_0x1b0b9e){if(_0x1b0b9e){freeIsNotKey(_0x1b0b9e,_0x5969fb['deskAccounts'],'id');for(var _0x3ee0ae=0x0,_0x50534f={},_0x12940b={};_0x3ee0ae<_0x1b0b9e['length'];_0x3ee0ae+=0x1){_0x50534f=_0x1b0b9e[_0x3ee0ae];if(_[_0x2473('0x41')](_0x5969fb['deskAccounts'][_0x50534f['id']])){_0x5969fb[_0x2473('0x1b')][_0x50534f['id']]=new DeskAccount(_0x50534f);}else{_0x5969fb[_0x2473('0x3a')](_0x5969fb[_0x2473('0x1b')][_0x50534f['id']],_0x50534f);}}}return _0x5969fb[_0x2473('0x1b')];};};Realtime[_0x2473('0x39')][_0x2473('0x4a')]=function(){var _0x88c88f=this;return function(_0x2a83b7){if(_0x2a83b7){freeIsNotKey(_0x2a83b7,_0x88c88f[_0x2473('0x4b')],'id');for(var _0x5404f6=0x0,_0x56b53b={},_0xa9dd7b={};_0x5404f6<_0x2a83b7[_0x2473('0x3d')];_0x5404f6+=0x1){_0x56b53b=_0x2a83b7[_0x5404f6];if(_['isUndefined'](_0x88c88f[_0x2473('0x4b')][_0x56b53b['id']])){_0x88c88f[_0x2473('0x4b')][_0x56b53b['id']]=new SugarcrmAccount(_0x56b53b);}else{_0x88c88f[_0x2473('0x3a')](_0x88c88f[_0x2473('0x4b')][_0x56b53b['id']],_0x56b53b);}}}return _0x88c88f[_0x2473('0x4b')];};};Realtime[_0x2473('0x39')][_0x2473('0x4c')]=function(){var _0x26230f=this;return function(_0x143312){if(_0x143312){freeIsNotKey(_0x143312,_0x26230f['vtigerAccounts'],'id');for(var _0x1f3116=0x0,_0x5b13e4={},_0x2f4ee3={};_0x1f3116<_0x143312[_0x2473('0x3d')];_0x1f3116+=0x1){_0x5b13e4=_0x143312[_0x1f3116];if(_[_0x2473('0x41')](_0x26230f[_0x2473('0x1c')][_0x5b13e4['id']])){_0x26230f[_0x2473('0x1c')][_0x5b13e4['id']]=new VtigerAccount(_0x5b13e4);}else{_0x26230f['mergeFromDatabase'](_0x26230f['vtigerAccounts'][_0x5b13e4['id']],_0x5b13e4);}}}return _0x26230f[_0x2473('0x1c')];};};Realtime[_0x2473('0x39')][_0x2473('0x4d')]=function(){var _0x85be60=this;return function(_0x35eabe){if(_0x35eabe){freeIsNotKey(_0x35eabe,_0x85be60[_0x2473('0x1d')],'id');for(var _0xab9b66=0x0,_0x225955={},_0x3247b1={};_0xab9b66<_0x35eabe[_0x2473('0x3d')];_0xab9b66+=0x1){_0x225955=_0x35eabe[_0xab9b66];if(_[_0x2473('0x41')](_0x85be60['servicenowAccounts'][_0x225955['id']])){_0x85be60[_0x2473('0x1d')][_0x225955['id']]=new ServicenowAccount(_0x225955);}else{_0x85be60['mergeFromDatabase'](_0x85be60[_0x2473('0x1d')][_0x225955['id']],_0x225955);}}}return _0x85be60['servicenowAccounts'];};};Realtime[_0x2473('0x39')]['initDynamics365Accounts']=function(){var _0x319605=this;return function(_0x426ec9){if(_0x426ec9){freeIsNotKey(_0x426ec9,_0x319605['dynamics365Accounts'],'id');for(var _0x4b836b=0x0,_0x1b3915={},_0xe163a9={};_0x4b836b<_0x426ec9[_0x2473('0x3d')];_0x4b836b+=0x1){_0x1b3915=_0x426ec9[_0x4b836b];if(_[_0x2473('0x41')](_0x319605[_0x2473('0x1e')][_0x1b3915['id']])){_0x319605['dynamics365Accounts'][_0x1b3915['id']]=new Dynamics365Account(_0x1b3915);}else{_0x319605[_0x2473('0x3a')](_0x319605[_0x2473('0x1e')][_0x1b3915['id']],_0x1b3915);}}}return _0x319605[_0x2473('0x1e')];};};Realtime['prototype']['initFreshsalesAccounts']=function(){var _0x2c47fc=this;return function(_0x465c7d){if(_0x465c7d){freeIsNotKey(_0x465c7d,_0x2c47fc[_0x2473('0x1f')],'id');for(var _0x5c358=0x0,_0x57e485={},_0x3af9e2={};_0x5c358<_0x465c7d[_0x2473('0x3d')];_0x5c358+=0x1){_0x57e485=_0x465c7d[_0x5c358];if(_[_0x2473('0x41')](_0x2c47fc[_0x2473('0x1f')][_0x57e485['id']])){_0x2c47fc['freshsalesAccounts'][_0x57e485['id']]=new FreshsalesAccount(_0x57e485);}else{_0x2c47fc[_0x2473('0x3a')](_0x2c47fc[_0x2473('0x1f')][_0x57e485['id']],_0x57e485);}}}return _0x2c47fc[_0x2473('0x1f')];};};Realtime[_0x2473('0x39')][_0x2473('0x4e')]=function(){var _0x1d9ead=this;return function(_0x2eac8d){for(var _0x21ee1f=0x0;_0x21ee1f<_0x2eac8d[_0x2473('0x3d')];_0x21ee1f+=0x1){_['merge'](_0x1d9ead[_0x2473('0x11')][_0x2eac8d[_0x21ee1f]['name']],_0x2eac8d[_0x21ee1f]);}return _0x1d9ead[_0x2473('0x11')];};};Realtime['prototype'][_0x2473('0x4f')]=function(){var _0xdbf911=this;return function(_0x4806a6){clearVoiceQueues(_0xdbf911[_0x2473('0x11')]);if(_0x4806a6){_0x4806a6=_['groupBy'](_0x4806a6,'uniqueid');for(var _0x54d456 in _0x4806a6){if(_0x4806a6['hasOwnProperty'](_0x54d456)){var _0x2cf452={};for(var _0x4e03dc=0x0;_0x4e03dc<_0x4806a6[_0x54d456]['length'];_0x4e03dc+=0x1){var _0x308eff=_0x4806a6[_0x54d456][_0x4e03dc]['queue'];if(_0xdbf911[_0x2473('0x11')][_0x308eff]){if(_0x4806a6[_0x54d456][_0x4e03dc][_0x2473('0x50')]){_0xdbf911['voiceQueues'][_0x308eff][_0x2473('0x2e')]+=0x1;}if(_0x4806a6[_0x54d456][_0x4e03dc][_0x2473('0x51')]){_0xdbf911[_0x2473('0x11')][_0x308eff][_0x2473('0x52')]+=0x1;}_0xdbf911[_0x2473('0x11')][_0x308eff][_0x2473('0x29')]+=moment(_0x4806a6[_0x54d456][_0x4e03dc]['queuecallerleaveAt'])[_0x2473('0x53')](moment(_0x4806a6[_0x54d456][_0x4e03dc][_0x2473('0x54')]),'seconds')||0x0;if(_0x4e03dc===_0x4806a6[_0x54d456][_0x2473('0x3d')]-0x1){_0xdbf911['voiceQueues'][_0x308eff][_0x2473('0x2a')]+=moment(_0x4806a6[_0x54d456][_0x4e03dc][_0x2473('0x55')]||_0x4806a6[_0x54d456][_0x4e03dc][_0x2473('0x56')]||_0x4806a6[_0x54d456][_0x4e03dc][_0x2473('0x57')])[_0x2473('0x53')](moment(_0x4806a6[_0x54d456][_0x4e03dc][_0x2473('0x54')]),'seconds')||0x0;_0xdbf911[_0x2473('0x11')][_0x308eff][_0x2473('0x27')]+=0x1;if(_0x4806a6[_0x54d456][_0x4e03dc]['queuecallercomplete']){_0xdbf911['voiceQueues'][_0x308eff][_0x2473('0x28')]+=0x1;_0xdbf911[_0x2473('0x11')][_0x308eff]['sumBillable']+=moment(_0x4806a6[_0x54d456][_0x4e03dc][_0x2473('0x55')])[_0x2473('0x53')](moment(_0x4806a6[_0x54d456][_0x4e03dc][_0x2473('0x58')]),_0x2473('0x59'))||0x0;}}else{_0xdbf911['voiceQueues'][_0x308eff]['sumDuration']+=_0xdbf911['voiceQueues'][_0x308eff][_0x2473('0x29')]||0x0;}}}}}}return _0xdbf911[_0x2473('0x11')];};};Realtime[_0x2473('0x39')][_0x2473('0x5a')]=function(){var _0x4ad2fa=this;return function(_0x4a99fa){clearVoiceCallReports(_0x4ad2fa[_0x2473('0x13')]);if(_0x4a99fa){for(var _0x1a626e=0x0;_0x1a626e<_0x4a99fa[_0x2473('0x3d')];_0x1a626e+=0x1){_0x4ad2fa['outbound']['total']+=0x1;_0x4ad2fa[_0x2473('0x13')]['sumDuration']+=_0x4a99fa[_0x1a626e][_0x2473('0x5b')];if(_0x4a99fa[_0x1a626e][_0x2473('0x5c')]===_0x2473('0x5d')){_0x4ad2fa[_0x2473('0x13')][_0x2473('0x28')]+=0x1;_0x4ad2fa[_0x2473('0x13')][_0x2473('0x29')]+=_0x4a99fa[_0x1a626e]['duration']-_0x4a99fa[_0x1a626e]['billableseconds']||0x0;_0x4ad2fa[_0x2473('0x13')][_0x2473('0x2b')]+=_0x4a99fa[_0x1a626e][_0x2473('0x5e')];}}}return _0x4ad2fa[_0x2473('0x13')];};};Realtime[_0x2473('0x39')][_0x2473('0x5f')]=function(){var _0x4a950d=this;return function(_0x1c992d){if(_0x1c992d){freeIsNotKey(_0x1c992d,_0x4a950d[_0x2473('0x60')],_0x2473('0x23'));for(var _0x532b88=0x0,_0x4e2fbc={};_0x532b88<_0x1c992d[_0x2473('0x3d')];_0x532b88+=0x1){_0x4e2fbc=_0x1c992d[_0x532b88];if(_[_0x2473('0x41')](_0x4a950d[_0x2473('0x60')][_0x4e2fbc[_0x2473('0x23')]])){_0x4a950d[_0x2473('0x60')][_0x4e2fbc[_0x2473('0x23')]]=new Campaign(_0x4e2fbc);}else{_0x4a950d[_0x2473('0x3a')](_0x4a950d[_0x2473('0x60')][_0x4e2fbc['name']],_0x4e2fbc);_0x4a950d['campaigns'][_0x4e2fbc[_0x2473('0x23')]][_0x2473('0x61')]=_0x4e2fbc[_0x2473('0x62')]?_0x4e2fbc[_0x2473('0x62')]['name']:undefined;}}}return _0x4a950d[_0x2473('0x60')];};};Realtime[_0x2473('0x39')][_0x2473('0x63')]=function(){var _0x2614a1=this;return function(_0x289469){if(_0x289469){freeIsNotKey(_0x289469,_0x2614a1[_0x2473('0x14')],'id');for(var _0x52385b=0x0,_0x566000={};_0x52385b<_0x289469[_0x2473('0x3d')];_0x52385b+=0x1){_0x566000=_0x289469[_0x52385b];if(_['isUndefined'](_0x2614a1[_0x2473('0x14')][_0x566000['id']])){_0x2614a1[_0x2473('0x14')][_0x566000['id']]=new VoiceExtension(_0x566000);}else{_0x2614a1[_0x2473('0x3a')](_0x2614a1[_0x2473('0x14')][_0x566000['id']],_0x566000);}}}return _0x2614a1[_0x2473('0x14')];};};Realtime['prototype'][_0x2473('0x64')]=function(){var _0x5328a2=this;return function(_0x36bae3){clearCampaigns(_0x5328a2[_0x2473('0x60')]);for(var _0x45c25d=0x0;_0x45c25d<_0x36bae3[_0x2473('0x3d')];_0x45c25d+=0x1){_[_0x2473('0x65')](_0x5328a2[_0x2473('0x60')][_0x36bae3[_0x45c25d][_0x2473('0x23')]],_0x36bae3[_0x45c25d]);}return _0x5328a2[_0x2473('0x60')];};};Realtime[_0x2473('0x39')][_0x2473('0x66')]=function(){var _0x281a31=this;return function(_0x156f59){if(_0x156f59){freeIsNotKey(_0x156f59,_0x281a31[_0x2473('0x20')],'id');for(var _0x1d82ee=0x0,_0xeffd6d={},_0xc9a85f={};_0x1d82ee<_0x156f59[_0x2473('0x3d')];_0x1d82ee+=0x1){_0xeffd6d=_0x156f59[_0x1d82ee];if(_[_0x2473('0x41')](_0x281a31['faxAccounts'][_0xeffd6d['id']])){_0x281a31[_0x2473('0x20')][_0xeffd6d['id']]=new FaxAccount(_0xeffd6d);}else{_0x281a31[_0x2473('0x3a')](_0x281a31['faxAccounts'][_0xeffd6d['id']],_0xeffd6d);}}}return _0x281a31[_0x2473('0x20')];};};module[_0x2473('0x67')]=Realtime; \ No newline at end of file +var _0xc8ba=['../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','voiceQueues','triggers','campaigns','templates','outbound','voiceExtensions','queueChannels','outboundChannels','timers','settings','zendeskAccounts','sugarcrmAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','hasOwnProperty','mapKeys','format','SIP/%s','name','isNil','interface','answered','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','total','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','queueStatusComplete','prototype','initAgents','length','isUndefined','mergeFromDatabase','initTelephones','initVoiceQueues','initZendeskAccounts','initSalesforceAccounts','salesforceAccounts','initFreshdeskAccounts','freshdeskAccounts','initZohoAccounts','zohoAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','servicenowAccounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','uniqueid','diff','queuecallerjoinAt','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','seconds','queuecallercomplete','queuecallerleaveAt','ANSWERED','billableseconds','initCampaigns','SquareProject','initCampaignHopperHistory','merge','initFaxAccounts','exports','util','lodash','moment','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/voiceExtension','../model/zendeskAccount','../model/freshdeskAccount'];(function(_0x3d9b52,_0x31623c){var _0x58413e=function(_0x41d9c1){while(--_0x41d9c1){_0x3d9b52['push'](_0x3d9b52['shift']());}};_0x58413e(++_0x31623c);}(_0xc8ba,0x186));var _0xac8b=function(_0x5447aa,_0x3afc00){_0x5447aa=_0x5447aa-0x0;var _0xb21e53=_0xc8ba[_0x5447aa];return _0xb21e53;};'use strict';var util=require(_0xac8b('0x0'));var _=require(_0xac8b('0x1'));var moment=require(_0xac8b('0x2'));var Agent=require('../model/agent');var Telephone=require('../model/telephone');var Trunk=require(_0xac8b('0x3'));var VoiceQueue=require(_0xac8b('0x4'));var Trigger=require(_0xac8b('0x5'));var Template=require(_0xac8b('0x6'));var Campaign=require('../model/campaign');var VoiceExtension=require(_0xac8b('0x7'));var ZendeskAccount=require(_0xac8b('0x8'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0xac8b('0x9'));var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0xac8b('0xa'));var DeskAccount=require(_0xac8b('0xb'));var VtigerAccount=require(_0xac8b('0xc'));var ServicenowAccount=require('../model/servicenowAccount');var Dynamics365Account=require(_0xac8b('0xd'));var FreshsalesAccount=require(_0xac8b('0xe'));var FaxAccount=require(_0xac8b('0xf'));var Realtime=function(){this[_0xac8b('0x10')]={};this[_0xac8b('0x11')]={};this[_0xac8b('0x12')]={};this[_0xac8b('0x13')]={};this[_0xac8b('0x14')]={};this[_0xac8b('0x15')]={};this[_0xac8b('0x16')]={};this[_0xac8b('0x17')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xac8b('0x18')]={};this['channels']={};this[_0xac8b('0x19')]={};this[_0xac8b('0x1a')]={};this[_0xac8b('0x1b')]={};this[_0xac8b('0x1c')]={};this[_0xac8b('0x1d')]={};this['salesforceAccounts']={};this[_0xac8b('0x1e')]={};this['freshdeskAccounts']={};this['zohoAccounts']={};this[_0xac8b('0x1f')]={};this[_0xac8b('0x20')]={};this['servicenowAccounts']={};this[_0xac8b('0x21')]={};this[_0xac8b('0x22')]={};this[_0xac8b('0x23')]={};};function freeIsNotKey(_0x406618,_0x2803bd,_0x3d3fc4){var _0x58b260=_['mapKeys'](_0x406618,function(_0x4640dc,_0x41854e){return _0x4640dc[_0x3d3fc4];});for(var _0x5e1b9d in _0x2803bd){if(_0x2803bd[_0xac8b('0x24')](_0x5e1b9d)){if(!_0x58b260[_0x5e1b9d]){delete _0x2803bd[_0x5e1b9d];}}}}function freeIsNotKeySip(_0x3974e4,_0x153eb4){var _0x5102c6=_[_0xac8b('0x25')](_0x3974e4,function(_0x88b80f,_0x1b6c94){return util[_0xac8b('0x26')](_0xac8b('0x27'),_0x88b80f[_0xac8b('0x28')]);});for(var _0x1dbbce in _0x153eb4){if(_0x153eb4[_0xac8b('0x24')](_0x1dbbce)){if(!_0x5102c6[_0x1dbbce]){delete _0x153eb4[_0x1dbbce];}}}}function freeIsNotKeyAgent(_0x83cdce,_0x433813){var _0x559294=_['mapKeys'](_0x83cdce,function(_0x35c211,_0x5419f2){var _0x5bed0a=_[_0xac8b('0x29')](_0x35c211['interface'])?util['format'](_0xac8b('0x27'),_0x35c211[_0xac8b('0x28')]):_0x35c211[_0xac8b('0x2a')];return _0x5bed0a;});for(var _0x36d5e3 in _0x433813){if(_0x433813['hasOwnProperty'](_0x36d5e3)){if(!_0x559294[_0x36d5e3]){delete _0x433813[_0x36d5e3];}}}}function clearVoiceCallReports(_0x281296){_0x281296['total']=0x0;_0x281296[_0xac8b('0x2b')]=0x0;_0x281296[_0xac8b('0x2c')]=0x0;_0x281296[_0xac8b('0x2d')]=0x0;_0x281296[_0xac8b('0x2e')]=0x0;}function clearCampaigns(_0x4b7287){if(!_[_0xac8b('0x2f')](_0x4b7287)){for(var _0x4fac73 in _0x4b7287){if(_0x4b7287['hasOwnProperty'](_0x4fac73)){_0x4b7287[_0x4fac73][_0xac8b('0x30')]=0x0;_0x4b7287[_0x4fac73][_0xac8b('0x31')]=0x0;}}}}function clearVoiceQueues(_0x4b7dd2){if(!_[_0xac8b('0x2f')](_0x4b7dd2)){for(var _0x419f6a in _0x4b7dd2){if(_0x4b7dd2['hasOwnProperty'](_0x419f6a)){_0x4b7dd2[_0x419f6a][_0xac8b('0x32')]=0x0;_0x4b7dd2[_0x419f6a][_0xac8b('0x2b')]=0x0;_0x4b7dd2[_0x419f6a][_0xac8b('0x33')]=0x0;_0x4b7dd2[_0x419f6a][_0xac8b('0x34')]=0x0;_0x4b7dd2[_0x419f6a][_0xac8b('0x2c')]=0x0;_0x4b7dd2[_0x419f6a][_0xac8b('0x2d')]=0x0;_0x4b7dd2[_0x419f6a][_0xac8b('0x2e')]=0x0;_0x4b7dd2[_0x419f6a][_0xac8b('0x35')]=0x0;_0x4b7dd2[_0x419f6a][_0xac8b('0x36')]=0x0;_0x4b7dd2[_0x419f6a]['outboundBusyCallsDay']=0x0;_0x4b7dd2[_0x419f6a][_0xac8b('0x37')]=0x0;_0x4b7dd2[_0x419f6a]['outboundNoSuchCallsDay']=0x0;_0x4b7dd2[_0x419f6a][_0xac8b('0x38')]=0x0;_0x4b7dd2[_0x419f6a][_0xac8b('0x39')]=0x0;_0x4b7dd2[_0x419f6a][_0xac8b('0x3a')]=0x0;_0x4b7dd2[_0x419f6a][_0xac8b('0x3b')]=0x0;_0x4b7dd2[_0x419f6a][_0xac8b('0x3c')]=0x0;_0x4b7dd2[_0x419f6a]['outboundRejectCallsDay']=0x0;_0x4b7dd2[_0x419f6a][_0xac8b('0x3d')]=0x0;_0x4b7dd2[_0x419f6a][_0xac8b('0x35')]=0x0;_0x4b7dd2[_0x419f6a]['outboundAnswerCallsDay']=0x0;_0x4b7dd2[_0x419f6a][_0xac8b('0x3e')]=!![];}}}}Realtime[_0xac8b('0x3f')]['mergeFromDatabase']=function(_0x1bf33e,_0xf6b3e8){for(var _0x2f6433 in _0xf6b3e8){if(_0x1bf33e['hasOwnProperty'](_0x2f6433)){_0x1bf33e[_0x2f6433]=_0xf6b3e8[_0x2f6433];}}};Realtime[_0xac8b('0x3f')][_0xac8b('0x40')]=function(){var _0x5daa2c=this;return function(_0x125fe3){if(_0x125fe3){freeIsNotKeyAgent(_0x125fe3,_0x5daa2c[_0xac8b('0x10')]);for(var _0x495126=0x0,_0x1964eb={},_0x55effb={};_0x495126<_0x125fe3[_0xac8b('0x41')];_0x495126+=0x1){_0x1964eb=_0x125fe3[_0x495126];var _0x82772f=_['isNil'](_0x1964eb[_0xac8b('0x2a')])?util[_0xac8b('0x26')](_0xac8b('0x27'),_0x1964eb[_0xac8b('0x28')]):_0x1964eb[_0xac8b('0x2a')];if(_[_0xac8b('0x42')](_0x5daa2c[_0xac8b('0x10')][_0x82772f])){_0x5daa2c['agents'][_0x82772f]=new Agent(_0x1964eb);}else{_0x5daa2c[_0xac8b('0x43')](_0x5daa2c['agents'][_0x82772f],_0x1964eb);}}}return _0x5daa2c['agents'];};};Realtime[_0xac8b('0x3f')][_0xac8b('0x44')]=function(){var _0x300d01=this;return function(_0x28eb68){if(_0x28eb68){freeIsNotKeySip(_0x28eb68,_0x300d01[_0xac8b('0x11')]);for(var _0x15f2ed=0x0,_0x27691c={},_0x5bff2f={};_0x15f2ed<_0x28eb68[_0xac8b('0x41')];_0x15f2ed+=0x1){_0x27691c=_0x28eb68[_0x15f2ed];if(_[_0xac8b('0x42')](_0x300d01[_0xac8b('0x11')][util[_0xac8b('0x26')](_0xac8b('0x27'),_0x27691c[_0xac8b('0x28')])])){_0x300d01[_0xac8b('0x11')][util[_0xac8b('0x26')]('SIP/%s',_0x27691c[_0xac8b('0x28')])]=new Telephone(_0x27691c);}else{_0x300d01[_0xac8b('0x43')](_0x300d01[_0xac8b('0x11')][util[_0xac8b('0x26')](_0xac8b('0x27'),_0x27691c[_0xac8b('0x28')])],_0x27691c);}}}return _0x300d01['telephones'];};};Realtime[_0xac8b('0x3f')]['initTrunks']=function(){var _0x15ee52=this;return function(_0xf1b9c1){if(_0xf1b9c1){freeIsNotKeySip(_0xf1b9c1,_0x15ee52['trunks']);for(var _0x3348a0=0x0,_0x3fd781={},_0x18eae6={};_0x3348a0<_0xf1b9c1[_0xac8b('0x41')];_0x3348a0+=0x1){_0x3fd781=_0xf1b9c1[_0x3348a0];if(_['isUndefined'](_0x15ee52[_0xac8b('0x12')][util[_0xac8b('0x26')](_0xac8b('0x27'),_0x3fd781[_0xac8b('0x28')])])){_0x15ee52[_0xac8b('0x12')][util['format'](_0xac8b('0x27'),_0x3fd781[_0xac8b('0x28')])]=new Trunk(_0x3fd781);}else{_0x15ee52[_0xac8b('0x43')](_0x15ee52[_0xac8b('0x12')][util[_0xac8b('0x26')](_0xac8b('0x27'),_0x3fd781[_0xac8b('0x28')])],_0x3fd781);}}}return _0x15ee52[_0xac8b('0x12')];};};Realtime[_0xac8b('0x3f')][_0xac8b('0x45')]=function(){var _0x1d329c=this;return function(_0x5b3c97){if(_0x5b3c97){freeIsNotKey(_0x5b3c97,_0x1d329c[_0xac8b('0x13')],_0xac8b('0x28'));for(var _0x35cd5f=0x0,_0x52fedb={},_0x4d516e={};_0x35cd5f<_0x5b3c97['length'];_0x35cd5f+=0x1){_0x52fedb=_0x5b3c97[_0x35cd5f];if(_[_0xac8b('0x42')](_0x1d329c[_0xac8b('0x13')][_0x52fedb[_0xac8b('0x28')]])){_0x1d329c['voiceQueues'][_0x52fedb[_0xac8b('0x28')]]=new VoiceQueue(_0x52fedb);}else{_0x1d329c[_0xac8b('0x43')](_0x1d329c['voiceQueues'][_0x52fedb[_0xac8b('0x28')]],_0x52fedb);}}}return _0x1d329c[_0xac8b('0x13')];};};Realtime[_0xac8b('0x3f')]['initTriggers']=function(){var _0xc7ee0f=this;return function(_0x219deb){if(_0x219deb){freeIsNotKey(_0x219deb,_0xc7ee0f[_0xac8b('0x14')],'id');for(var _0x3eff96=0x0,_0x4a432a={},_0x52ade5={};_0x3eff96<_0x219deb[_0xac8b('0x41')];_0x3eff96+=0x1){_0x4a432a=_0x219deb[_0x3eff96];if(_[_0xac8b('0x42')](_0xc7ee0f[_0xac8b('0x14')][_0x4a432a['id']])){_0xc7ee0f[_0xac8b('0x14')][_0x4a432a['id']]=new Trigger(_0x4a432a);}else{_0xc7ee0f[_0xac8b('0x43')](_0xc7ee0f[_0xac8b('0x14')][_0x4a432a['id']],_0x4a432a);}}}return _0xc7ee0f[_0xac8b('0x14')];};};Realtime['prototype']['initTemplates']=function(){var _0x27a02f=this;return function(_0x3587c9){if(_0x3587c9){freeIsNotKey(_0x3587c9,_0x27a02f[_0xac8b('0x16')],'id');for(var _0x425b13=0x0,_0xbf4957={},_0xe6c584={};_0x425b13<_0x3587c9[_0xac8b('0x41')];_0x425b13+=0x1){_0xbf4957=_0x3587c9[_0x425b13];if(_['isUndefined'](_0x27a02f[_0xac8b('0x16')][_0xbf4957['id']])){_0x27a02f[_0xac8b('0x16')][_0xbf4957['id']]=new Template(_0xbf4957);}else{_0x27a02f['mergeFromDatabase'](_0x27a02f['templates'][_0xbf4957['id']],_0xbf4957);}}}return _0x27a02f[_0xac8b('0x16')];};};Realtime[_0xac8b('0x3f')][_0xac8b('0x46')]=function(){var _0x27cc14=this;return function(_0x3f4ae5){if(_0x3f4ae5){freeIsNotKey(_0x3f4ae5,_0x27cc14['zendeskAccounts'],'id');for(var _0xb3c3b4=0x0,_0xc34f96={},_0x292307={};_0xb3c3b4<_0x3f4ae5[_0xac8b('0x41')];_0xb3c3b4+=0x1){_0xc34f96=_0x3f4ae5[_0xb3c3b4];if(_['isUndefined'](_0x27cc14['zendeskAccounts'][_0xc34f96['id']])){_0x27cc14[_0xac8b('0x1d')][_0xc34f96['id']]=new ZendeskAccount(_0xc34f96);}else{_0x27cc14['mergeFromDatabase'](_0x27cc14[_0xac8b('0x1d')][_0xc34f96['id']],_0xc34f96);}}}return _0x27cc14[_0xac8b('0x1d')];};};Realtime['prototype'][_0xac8b('0x47')]=function(){var _0x3028cc=this;return function(_0x2761ba){if(_0x2761ba){freeIsNotKey(_0x2761ba,_0x3028cc[_0xac8b('0x48')],'id');for(var _0x412281=0x0,_0xd09b23={},_0x2a8f61={};_0x412281<_0x2761ba[_0xac8b('0x41')];_0x412281+=0x1){_0xd09b23=_0x2761ba[_0x412281];if(_[_0xac8b('0x42')](_0x3028cc[_0xac8b('0x48')][_0xd09b23['id']])){_0x3028cc['salesforceAccounts'][_0xd09b23['id']]=new SalesforceAccount(_0xd09b23);}else{_0x3028cc[_0xac8b('0x43')](_0x3028cc[_0xac8b('0x48')][_0xd09b23['id']],_0xd09b23);}}}return _0x3028cc[_0xac8b('0x48')];};};Realtime[_0xac8b('0x3f')][_0xac8b('0x49')]=function(){var _0x4c6b14=this;return function(_0x5710c0){if(_0x5710c0){freeIsNotKey(_0x5710c0,_0x4c6b14[_0xac8b('0x4a')],'id');for(var _0x2ec5bc=0x0,_0x5337f7={},_0x341eb5={};_0x2ec5bc<_0x5710c0['length'];_0x2ec5bc+=0x1){_0x5337f7=_0x5710c0[_0x2ec5bc];if(_[_0xac8b('0x42')](_0x4c6b14['freshdeskAccounts'][_0x5337f7['id']])){_0x4c6b14[_0xac8b('0x4a')][_0x5337f7['id']]=new FreshdeskAccount(_0x5337f7);}else{_0x4c6b14[_0xac8b('0x43')](_0x4c6b14[_0xac8b('0x4a')][_0x5337f7['id']],_0x5337f7);}}}return _0x4c6b14['freshdeskAccounts'];};};Realtime[_0xac8b('0x3f')][_0xac8b('0x4b')]=function(){var _0x4d0e1f=this;return function(_0x573d5c){if(_0x573d5c){freeIsNotKey(_0x573d5c,_0x4d0e1f[_0xac8b('0x4c')],'id');for(var _0xe2d482=0x0,_0x391f08={},_0x413882={};_0xe2d482<_0x573d5c[_0xac8b('0x41')];_0xe2d482+=0x1){_0x391f08=_0x573d5c[_0xe2d482];if(_['isUndefined'](_0x4d0e1f['zohoAccounts'][_0x391f08['id']])){_0x4d0e1f[_0xac8b('0x4c')][_0x391f08['id']]=new ZohoAccount(_0x391f08);}else{_0x4d0e1f['mergeFromDatabase'](_0x4d0e1f[_0xac8b('0x4c')][_0x391f08['id']],_0x391f08);}}}return _0x4d0e1f['zohoAccounts'];};};Realtime[_0xac8b('0x3f')]['initDeskAccounts']=function(){var _0x1c84d2=this;return function(_0x93c8b){if(_0x93c8b){freeIsNotKey(_0x93c8b,_0x1c84d2[_0xac8b('0x1f')],'id');for(var _0x405ea6=0x0,_0x57288b={},_0x265aa1={};_0x405ea6<_0x93c8b[_0xac8b('0x41')];_0x405ea6+=0x1){_0x57288b=_0x93c8b[_0x405ea6];if(_[_0xac8b('0x42')](_0x1c84d2[_0xac8b('0x1f')][_0x57288b['id']])){_0x1c84d2[_0xac8b('0x1f')][_0x57288b['id']]=new DeskAccount(_0x57288b);}else{_0x1c84d2[_0xac8b('0x43')](_0x1c84d2['deskAccounts'][_0x57288b['id']],_0x57288b);}}}return _0x1c84d2[_0xac8b('0x1f')];};};Realtime[_0xac8b('0x3f')][_0xac8b('0x4d')]=function(){var _0x2a18c6=this;return function(_0x1d15af){if(_0x1d15af){freeIsNotKey(_0x1d15af,_0x2a18c6['sugarcrmAccounts'],'id');for(var _0x5699d7=0x0,_0x2f22fe={},_0x52912d={};_0x5699d7<_0x1d15af[_0xac8b('0x41')];_0x5699d7+=0x1){_0x2f22fe=_0x1d15af[_0x5699d7];if(_['isUndefined'](_0x2a18c6[_0xac8b('0x1e')][_0x2f22fe['id']])){_0x2a18c6[_0xac8b('0x1e')][_0x2f22fe['id']]=new SugarcrmAccount(_0x2f22fe);}else{_0x2a18c6['mergeFromDatabase'](_0x2a18c6[_0xac8b('0x1e')][_0x2f22fe['id']],_0x2f22fe);}}}return _0x2a18c6[_0xac8b('0x1e')];};};Realtime[_0xac8b('0x3f')][_0xac8b('0x4e')]=function(){var _0x933d29=this;return function(_0x203d27){if(_0x203d27){freeIsNotKey(_0x203d27,_0x933d29['vtigerAccounts'],'id');for(var _0x405109=0x0,_0x282a28={},_0x5458bb={};_0x405109<_0x203d27['length'];_0x405109+=0x1){_0x282a28=_0x203d27[_0x405109];if(_[_0xac8b('0x42')](_0x933d29['vtigerAccounts'][_0x282a28['id']])){_0x933d29[_0xac8b('0x20')][_0x282a28['id']]=new VtigerAccount(_0x282a28);}else{_0x933d29[_0xac8b('0x43')](_0x933d29[_0xac8b('0x20')][_0x282a28['id']],_0x282a28);}}}return _0x933d29['vtigerAccounts'];};};Realtime['prototype'][_0xac8b('0x4f')]=function(){var _0x9ed3d=this;return function(_0x41d906){if(_0x41d906){freeIsNotKey(_0x41d906,_0x9ed3d[_0xac8b('0x50')],'id');for(var _0xd115c3=0x0,_0x34c523={},_0x4e4970={};_0xd115c3<_0x41d906[_0xac8b('0x41')];_0xd115c3+=0x1){_0x34c523=_0x41d906[_0xd115c3];if(_[_0xac8b('0x42')](_0x9ed3d['servicenowAccounts'][_0x34c523['id']])){_0x9ed3d[_0xac8b('0x50')][_0x34c523['id']]=new ServicenowAccount(_0x34c523);}else{_0x9ed3d[_0xac8b('0x43')](_0x9ed3d[_0xac8b('0x50')][_0x34c523['id']],_0x34c523);}}}return _0x9ed3d[_0xac8b('0x50')];};};Realtime[_0xac8b('0x3f')]['initDynamics365Accounts']=function(){var _0x50a34a=this;return function(_0x2791fc){if(_0x2791fc){freeIsNotKey(_0x2791fc,_0x50a34a['dynamics365Accounts'],'id');for(var _0x31c5e8=0x0,_0x133f29={},_0x56de35={};_0x31c5e8<_0x2791fc[_0xac8b('0x41')];_0x31c5e8+=0x1){_0x133f29=_0x2791fc[_0x31c5e8];if(_['isUndefined'](_0x50a34a[_0xac8b('0x21')][_0x133f29['id']])){_0x50a34a['dynamics365Accounts'][_0x133f29['id']]=new Dynamics365Account(_0x133f29);}else{_0x50a34a['mergeFromDatabase'](_0x50a34a[_0xac8b('0x21')][_0x133f29['id']],_0x133f29);}}}return _0x50a34a[_0xac8b('0x21')];};};Realtime[_0xac8b('0x3f')][_0xac8b('0x51')]=function(){var _0x1746b4=this;return function(_0x53715c){if(_0x53715c){freeIsNotKey(_0x53715c,_0x1746b4['freshsalesAccounts'],'id');for(var _0xf0166f=0x0,_0x289e0a={},_0x840147={};_0xf0166f<_0x53715c[_0xac8b('0x41')];_0xf0166f+=0x1){_0x289e0a=_0x53715c[_0xf0166f];if(_['isUndefined'](_0x1746b4['freshsalesAccounts'][_0x289e0a['id']])){_0x1746b4[_0xac8b('0x22')][_0x289e0a['id']]=new FreshsalesAccount(_0x289e0a);}else{_0x1746b4[_0xac8b('0x43')](_0x1746b4['freshsalesAccounts'][_0x289e0a['id']],_0x289e0a);}}}return _0x1746b4['freshsalesAccounts'];};};Realtime[_0xac8b('0x3f')][_0xac8b('0x52')]=function(){var _0x586b48=this;return function(_0x26b24c){for(var _0x2c7fe3=0x0;_0x2c7fe3<_0x26b24c['length'];_0x2c7fe3+=0x1){_['merge'](_0x586b48[_0xac8b('0x13')][_0x26b24c[_0x2c7fe3]['name']],_0x26b24c[_0x2c7fe3]);}return _0x586b48[_0xac8b('0x13')];};};Realtime['prototype']['initVoiceQueueReports']=function(){var _0x456947=this;return function(_0x1b9571){clearVoiceQueues(_0x456947[_0xac8b('0x13')]);if(_0x1b9571){_0x1b9571=_['groupBy'](_0x1b9571,_0xac8b('0x53'));for(var _0x4fc57a in _0x1b9571){if(_0x1b9571['hasOwnProperty'](_0x4fc57a)){var _0x56dabc={};for(var _0x4130ef=0x0;_0x4130ef<_0x1b9571[_0x4fc57a][_0xac8b('0x41')];_0x4130ef+=0x1){var _0x4b3a5a=_0x1b9571[_0x4fc57a][_0x4130ef]['queue'];if(_0x456947['voiceQueues'][_0x4b3a5a]){if(_0x1b9571[_0x4fc57a][_0x4130ef]['queuecallerexit']){_0x456947[_0xac8b('0x13')][_0x4b3a5a]['unmanaged']+=0x1;}if(_0x1b9571[_0x4fc57a][_0x4130ef]['queuecallerabandon']){_0x456947['voiceQueues'][_0x4b3a5a]['abandoned']+=0x1;}_0x456947['voiceQueues'][_0x4b3a5a][_0xac8b('0x2c')]+=moment(_0x1b9571[_0x4fc57a][_0x4130ef]['queuecallerleaveAt'])[_0xac8b('0x54')](moment(_0x1b9571[_0x4fc57a][_0x4130ef][_0xac8b('0x55')]),'seconds')||0x0;if(_0x4130ef===_0x1b9571[_0x4fc57a][_0xac8b('0x41')]-0x1){_0x456947['voiceQueues'][_0x4b3a5a]['sumDuration']+=moment(_0x1b9571[_0x4fc57a][_0x4130ef][_0xac8b('0x56')]||_0x1b9571[_0x4fc57a][_0x4130ef][_0xac8b('0x57')]||_0x1b9571[_0x4fc57a][_0x4130ef][_0xac8b('0x58')])[_0xac8b('0x54')](moment(_0x1b9571[_0x4fc57a][_0x4130ef][_0xac8b('0x55')]),_0xac8b('0x59'))||0x0;_0x456947[_0xac8b('0x13')][_0x4b3a5a][_0xac8b('0x32')]+=0x1;if(_0x1b9571[_0x4fc57a][_0x4130ef][_0xac8b('0x5a')]){_0x456947['voiceQueues'][_0x4b3a5a]['answered']+=0x1;_0x456947[_0xac8b('0x13')][_0x4b3a5a][_0xac8b('0x2e')]+=moment(_0x1b9571[_0x4fc57a][_0x4130ef][_0xac8b('0x56')])[_0xac8b('0x54')](moment(_0x1b9571[_0x4fc57a][_0x4130ef][_0xac8b('0x5b')]),_0xac8b('0x59'))||0x0;}}else{_0x456947[_0xac8b('0x13')][_0x4b3a5a][_0xac8b('0x2d')]+=_0x456947['voiceQueues'][_0x4b3a5a][_0xac8b('0x2c')]||0x0;}}}}}}return _0x456947[_0xac8b('0x13')];};};Realtime[_0xac8b('0x3f')]['initVoiceCallReports']=function(){var _0x40959d=this;return function(_0x129752){clearVoiceCallReports(_0x40959d[_0xac8b('0x17')]);if(_0x129752){for(var _0x51cf33=0x0;_0x51cf33<_0x129752[_0xac8b('0x41')];_0x51cf33+=0x1){_0x40959d['outbound'][_0xac8b('0x32')]+=0x1;_0x40959d[_0xac8b('0x17')][_0xac8b('0x2d')]+=_0x129752[_0x51cf33]['duration'];if(_0x129752[_0x51cf33]['disposition']===_0xac8b('0x5c')){_0x40959d[_0xac8b('0x17')][_0xac8b('0x2b')]+=0x1;_0x40959d[_0xac8b('0x17')][_0xac8b('0x2c')]+=_0x129752[_0x51cf33]['duration']-_0x129752[_0x51cf33][_0xac8b('0x5d')]||0x0;_0x40959d[_0xac8b('0x17')][_0xac8b('0x2e')]+=_0x129752[_0x51cf33]['billableseconds'];}}}return _0x40959d[_0xac8b('0x17')];};};Realtime[_0xac8b('0x3f')][_0xac8b('0x5e')]=function(){var _0x28cff5=this;return function(_0x26cf09){if(_0x26cf09){freeIsNotKey(_0x26cf09,_0x28cff5[_0xac8b('0x15')],_0xac8b('0x28'));for(var _0xdc1baf=0x0,_0x21f002={};_0xdc1baf<_0x26cf09[_0xac8b('0x41')];_0xdc1baf+=0x1){_0x21f002=_0x26cf09[_0xdc1baf];if(_['isUndefined'](_0x28cff5[_0xac8b('0x15')][_0x21f002[_0xac8b('0x28')]])){_0x28cff5['campaigns'][_0x21f002[_0xac8b('0x28')]]=new Campaign(_0x21f002);}else{_0x28cff5[_0xac8b('0x43')](_0x28cff5[_0xac8b('0x15')][_0x21f002[_0xac8b('0x28')]],_0x21f002);_0x28cff5[_0xac8b('0x15')][_0x21f002[_0xac8b('0x28')]]['dialQueueProject']=_0x21f002[_0xac8b('0x5f')]?_0x21f002[_0xac8b('0x5f')][_0xac8b('0x28')]:undefined;}}}return _0x28cff5[_0xac8b('0x15')];};};Realtime[_0xac8b('0x3f')]['initVoiceExtensions']=function(){var _0x362671=this;return function(_0x20ce55){if(_0x20ce55){freeIsNotKey(_0x20ce55,_0x362671[_0xac8b('0x18')],'id');for(var _0x40a48d=0x0,_0x56b3b4={};_0x40a48d<_0x20ce55[_0xac8b('0x41')];_0x40a48d+=0x1){_0x56b3b4=_0x20ce55[_0x40a48d];if(_[_0xac8b('0x42')](_0x362671['voiceExtensions'][_0x56b3b4['id']])){_0x362671[_0xac8b('0x18')][_0x56b3b4['id']]=new VoiceExtension(_0x56b3b4);}else{_0x362671[_0xac8b('0x43')](_0x362671['voiceExtensions'][_0x56b3b4['id']],_0x56b3b4);}}}return _0x362671[_0xac8b('0x18')];};};Realtime['prototype'][_0xac8b('0x60')]=function(){var _0x1395f4=this;return function(_0x4f5300){clearCampaigns(_0x1395f4[_0xac8b('0x15')]);for(var _0x40b328=0x0;_0x40b328<_0x4f5300[_0xac8b('0x41')];_0x40b328+=0x1){_[_0xac8b('0x61')](_0x1395f4[_0xac8b('0x15')][_0x4f5300[_0x40b328][_0xac8b('0x28')]],_0x4f5300[_0x40b328]);}return _0x1395f4[_0xac8b('0x15')];};};Realtime['prototype'][_0xac8b('0x62')]=function(){var _0xd36010=this;return function(_0x4657a8){if(_0x4657a8){freeIsNotKey(_0x4657a8,_0xd36010['faxAccounts'],'id');for(var _0x5893a6=0x0,_0x34d6c6={},_0x53d1eb={};_0x5893a6<_0x4657a8[_0xac8b('0x41')];_0x5893a6+=0x1){_0x34d6c6=_0x4657a8[_0x5893a6];if(_['isUndefined'](_0xd36010[_0xac8b('0x23')][_0x34d6c6['id']])){_0xd36010[_0xac8b('0x23')][_0x34d6c6['id']]=new FaxAccount(_0x34d6c6);}else{_0xd36010[_0xac8b('0x43')](_0xd36010['faxAccounts'][_0x34d6c6['id']],_0x34d6c6);}}}return _0xd36010[_0xac8b('0x23')];};};module[_0xac8b('0x63')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 2aff701..899b501 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 _0xd9cb=['filename','createdAt','xcally-motion-preview','calleridname','connectedlinename','membername','xcally-motion-dialer','Local','substring','indexOf','find','mobile','phone','exports','lodash','moment','util','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','custom:voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','accountcode','isNil','interface','SIP/%s','length','findAgent','assigned','lastAssignedTo','format','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','match','split','getAgentByInternal','calleridnum','internal','destination','exten','dialer','lastapplication','queue','lastdata','context','from-voip-provider','callerid','from-sip','calleridpreview','originatecalleridnum','channel','disposition','ANSWERED','connectedlinenum','\x22%s\x22\x20<%s>','transfers','linkedid','transfereelinkedid','type','getCallType','UserId','name','monitor','monitors','monitorFilename'];(function(_0x333714,_0x3370ac){var _0x4c211e=function(_0x34219b){while(--_0x34219b){_0x333714['push'](_0x333714['shift']());}};_0x4c211e(++_0x3370ac);}(_0xd9cb,0xc4));var _0xbd9c=function(_0x32f6b9,_0x2d4aa9){_0x32f6b9=_0x32f6b9-0x0;var _0x267d52=_0xd9cb[_0x32f6b9];return _0x267d52;};'use strict';var _=require(_0xbd9c('0x0'));var moment=require(_0xbd9c('0x1'));var util=require(_0xbd9c('0x2'));var config=require('../../../config/environment');var ami=require(_0xbd9c('0x3'));var RpcVoiceAgentReport=require(_0xbd9c('0x4'));var RpcVoiceCallReport=require(_0xbd9c('0x5'));var RpcVoiceDialReport=require(_0xbd9c('0x6'));var RpcMemberReport=require(_0xbd9c('0x7'));var RpcVoiceQueueReport=require(_0xbd9c('0x8'));var RpcVoiceRecording=require(_0xbd9c('0x9'));var RpcVoiceTransferReport=require(_0xbd9c('0xa'));var VoiceQueueReport=require(_0xbd9c('0xb'));var VoiceCallReport=require(_0xbd9c('0xc'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require(_0xbd9c('0xd'));var UserReport=require(_0xbd9c('0xe'));function Report(_0x3ce1ce){this[_0xbd9c('0xf')]=_0x3ce1ce;this['agents']=_0x3ce1ce[_0xbd9c('0x10')];this['telephones']=_0x3ce1ce[_0xbd9c('0x11')];}Report[_0xbd9c('0x12')][_0xbd9c('0x13')]=function(_0x259017){var _0x5b1416=new VoiceQueueReport(this[_0xbd9c('0xf')]);var _0x2997a7=new VoiceAgentReport(this['realtime']);var _0x414a08=new VoiceDialReport(this['realtime']);var _0x5ba0dc=new VoiceCallReport(this[_0xbd9c('0xf')]);var _0x131d96=new UserReport(this[_0xbd9c('0xf')]);if(config[_0xbd9c('0x14')]&&config[_0xbd9c('0x14')]['disabled']){ami['on'](_0xbd9c('0x15'),this[_0xbd9c('0x16')][_0xbd9c('0x17')](this));ami['on'](_0xbd9c('0x18'),this['voiceCallReport'][_0xbd9c('0x17')](this));ami['on'](_0xbd9c('0x19'),this['voiceAgentReport'][_0xbd9c('0x17')](this));ami['on'](_0xbd9c('0x1a'),this[_0xbd9c('0x1b')]['bind'](this));ami['on'](_0xbd9c('0x1c'),this[_0xbd9c('0x1d')][_0xbd9c('0x17')](this));ami['on'](_0xbd9c('0x1e'),this[_0xbd9c('0x1f')][_0xbd9c('0x17')](this));}};Report[_0xbd9c('0x12')]['findAgent']=function(_0x17ebd4){var _0x155225;_0x155225=_['find'](this[_0xbd9c('0x10')],function(_0x29c5ba){return _0x29c5ba[_0xbd9c('0x20')]==_0x17ebd4||_0x29c5ba['name']==_0x17ebd4;});if(_[_0xbd9c('0x21')](_0x155225)){var _0x40c723=_['find'](this[_0xbd9c('0x11')],function(_0x177ffc){return _0x177ffc[_0xbd9c('0x20')]==_0x17ebd4||_0x177ffc['name']==_0x17ebd4;});if(_0x40c723){_0x155225=_['find'](this[_0xbd9c('0x10')],function(_0x5ced37){return _0x5ced37[_0xbd9c('0x22')]==util['format'](_0xbd9c('0x23'),_0x40c723['name']);});}}return _0x155225;};Report[_0xbd9c('0x12')][_0xbd9c('0x16')]=function(_0x5585d0){for(var _0x6ee4fb=0x0;_0x6ee4fb<_0x5585d0[_0xbd9c('0x24')];_0x6ee4fb+=0x1){var _0x3878fc=this[_0xbd9c('0x25')](_0x5585d0[_0x6ee4fb]['connectedlinenum']);if(_0x3878fc){_0x5585d0[_0x6ee4fb][_0xbd9c('0x20')]=_0x3878fc[_0xbd9c('0x20')];_0x5585d0[_0x6ee4fb][_0xbd9c('0x26')]=!![];_0x5585d0[_0x6ee4fb][_0xbd9c('0x27')]=_0x3878fc['name'];_0x5585d0[_0x6ee4fb][_0xbd9c('0x22')]=_[_0xbd9c('0x21')](_0x3878fc['interface'])?util[_0xbd9c('0x28')](_0xbd9c('0x23'),_0x3878fc['name']):_0x3878fc[_0xbd9c('0x22')];if(_0x5585d0[_0x6ee4fb]['queuecallercomplete']){_0x5585d0[_0x6ee4fb]['queuecallercompleteAt']=moment()[_0xbd9c('0x28')](_0xbd9c('0x29'));}if(_0x5585d0[_0x6ee4fb][_0xbd9c('0x2a')]){_0x5585d0[_0x6ee4fb][_0xbd9c('0x2b')]=moment()[_0xbd9c('0x28')](_0xbd9c('0x29'));}RpcMemberReport[_0xbd9c('0x16')](_0x5585d0[_0x6ee4fb]);}RpcVoiceQueueReport[_0xbd9c('0x2c')](_0x5585d0[_0x6ee4fb]);}};function extractCalleridNumber(_0x2d3a9a){var _0x4b987e=_0x2d3a9a[_0xbd9c('0x2d')](/<(.*?)>/);return _0x4b987e?_0x4b987e[0x1]:_0x2d3a9a;}Report[_0xbd9c('0x12')]['getAgentByInternal']=function(_0x5777eb){for(var _0x5efbca=0x0;_0x5efbca','calleridname','transfers','linkedid','uniqueid','blindTransfer','type','UserId','membername','monitor','monitors','filename','createdAt','connectedlinename','xcally-motion-dialer','isArray','forEach','startsWith','Local','substring','indexOf','mobile','phone','lastIndexOf','transfererlinkedid','exports','lodash','moment','util','../../../config/environment','../rpc/voiceDialReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceDialReport','./userReport','agents','prototype','sync','realtime','disabled','custom:voiceQueueReport','voiceQueueReport','bind','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','attendedtransfer','attendedTransfer','findAgent','accountcode','name','isNil','telephones','find','format','SIP/%s','length','connectedlinenum','lastAssignedTo','interface','queuecallercomplete','queuecallercompleteAt','queuecallerexitAt','YYYY-MM-DD\x20HH:mm:ss','create','getAgentByInternal','keys','channel','split','calleridnum','internal','destination','exten','dialer','lastapplication','queue','lastdata','context','from-voip-provider','callerid','xcally-motion-preview','calleridpreview','originatecalleridnum','destinationchannel'];(function(_0x41b836,_0x2f7d3a){var _0x444ab9=function(_0x30009d){while(--_0x30009d){_0x41b836['push'](_0x41b836['shift']());}};_0x444ab9(++_0x2f7d3a);}(_0xabf1,0x1e3));var _0x1abf=function(_0x37a051,_0x4551c1){_0x37a051=_0x37a051-0x0;var _0x224dfc=_0xabf1[_0x37a051];return _0x224dfc;};'use strict';var _=require(_0x1abf('0x0'));var moment=require(_0x1abf('0x1'));var util=require(_0x1abf('0x2'));var config=require(_0x1abf('0x3'));var ami=require('../ami');var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require(_0x1abf('0x4'));var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require(_0x1abf('0x5'));var RpcVoiceRecording=require(_0x1abf('0x6'));var RpcVoiceTransferReport=require(_0x1abf('0x7'));var VoiceQueueReport=require(_0x1abf('0x8'));var VoiceCallReport=require(_0x1abf('0x9'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require(_0x1abf('0xa'));var UserReport=require(_0x1abf('0xb'));function Report(_0x242c29){this['realtime']=_0x242c29;this[_0x1abf('0xc')]=_0x242c29[_0x1abf('0xc')];this['telephones']=_0x242c29['telephones'];}Report[_0x1abf('0xd')][_0x1abf('0xe')]=function(_0x5da61d){var _0x1f34e4=new VoiceQueueReport(this['realtime']);var _0x104e93=new VoiceAgentReport(this[_0x1abf('0xf')]);var _0x55d3ca=new VoiceDialReport(this[_0x1abf('0xf')]);var _0x385d02=new VoiceCallReport(this['realtime']);var _0x5d658b=new UserReport(this[_0x1abf('0xf')]);if(config['xdr']&&config['xdr'][_0x1abf('0x10')]){ami['on'](_0x1abf('0x11'),this[_0x1abf('0x12')][_0x1abf('0x13')](this));ami['on']('custom:voiceCallReport',this[_0x1abf('0x14')]['bind'](this));ami['on'](_0x1abf('0x15'),this[_0x1abf('0x16')]['bind'](this));ami['on'](_0x1abf('0x17'),this[_0x1abf('0x18')][_0x1abf('0x13')](this));ami['on']('blindtransfer',this['blindTransfer'][_0x1abf('0x13')](this));ami['on'](_0x1abf('0x19'),this[_0x1abf('0x1a')][_0x1abf('0x13')](this));}};Report['prototype'][_0x1abf('0x1b')]=function(_0x4c76f5){var _0x2dfb17;_0x2dfb17=_['find'](this[_0x1abf('0xc')],function(_0x35ae22){return _0x35ae22[_0x1abf('0x1c')]==_0x4c76f5||_0x35ae22[_0x1abf('0x1d')]==_0x4c76f5;});if(_[_0x1abf('0x1e')](_0x2dfb17)){var _0x3f01c9=_['find'](this[_0x1abf('0x1f')],function(_0x512bb4){return _0x512bb4[_0x1abf('0x1c')]==_0x4c76f5||_0x512bb4[_0x1abf('0x1d')]==_0x4c76f5;});if(_0x3f01c9){_0x2dfb17=_[_0x1abf('0x20')](this[_0x1abf('0xc')],function(_0x5b2b83){return _0x5b2b83['interface']==util[_0x1abf('0x21')](_0x1abf('0x22'),_0x3f01c9['name']);});}}return _0x2dfb17;};Report[_0x1abf('0xd')][_0x1abf('0x12')]=function(_0xdab9c8){for(var _0x38cb0b=0x0;_0x38cb0b<_0xdab9c8[_0x1abf('0x23')];_0x38cb0b+=0x1){var _0x198f02=this[_0x1abf('0x1b')](_0xdab9c8[_0x38cb0b][_0x1abf('0x24')]);if(_0x198f02){_0xdab9c8[_0x38cb0b][_0x1abf('0x1c')]=_0x198f02[_0x1abf('0x1c')];_0xdab9c8[_0x38cb0b]['assigned']=!![];_0xdab9c8[_0x38cb0b][_0x1abf('0x25')]=_0x198f02[_0x1abf('0x1d')];_0xdab9c8[_0x38cb0b]['interface']=_[_0x1abf('0x1e')](_0x198f02[_0x1abf('0x26')])?util['format']('SIP/%s',_0x198f02[_0x1abf('0x1d')]):_0x198f02[_0x1abf('0x26')];if(_0xdab9c8[_0x38cb0b][_0x1abf('0x27')]){_0xdab9c8[_0x38cb0b][_0x1abf('0x28')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}if(_0xdab9c8[_0x38cb0b]['queuecallerexit']){_0xdab9c8[_0x38cb0b][_0x1abf('0x29')]=moment()[_0x1abf('0x21')](_0x1abf('0x2a'));}RpcMemberReport[_0x1abf('0x12')](_0xdab9c8[_0x38cb0b]);}RpcVoiceQueueReport[_0x1abf('0x2b')](_0xdab9c8[_0x38cb0b]);}};function extractCalleridNumber(_0x5a6b8f){var _0x5d3c2e=_0x5a6b8f['match'](/<(.*?)>/);return _0x5d3c2e?_0x5d3c2e[0x1]:_0x5a6b8f;}Report[_0x1abf('0xd')][_0x1abf('0x2c')]=function(_0x439682){for(var _0x5155ec=0x0;_0x5155ec0x0?_0x3a4bce:0x0;this[_0xd064('0x10')][_0x43df75[_0xd064('0x62')]][_0xd064('0x29')]=this[_0xd064('0x10')][_0x43df75[_0xd064('0x62')]][_0xd064('0x29')]>_[_0xd064('0x67')](_0x43df75[_0xd064('0x68')])?_[_0xd064('0x67')](_0x43df75[_0xd064('0x68')]):this[_0xd064('0x10')][_0x43df75['queue']][_0xd064('0x29')];this[_0xd064('0x4b')](this[_0xd064('0x10')][_0x43df75[_0xd064('0x62')]],'queuesummary');}logger['debug'](_0xd064('0x6a'),util['inspect'](this['voiceQueues'][_0x43df75['queue']],{'showHidden':![],'depth':null}));ami['emit']('custom:queuesummary',this[_0xd064('0x10')][_0x43df75[_0xd064('0x62')]]);}}}catch(_0x3c8fee){logger['error'](_0xd064('0x61'),util[_0xd064('0x37')](_0x3c8fee,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd064('0x39')][_0xd064('0x14')]=function(_0x20eba3){logger[_0xd064('0x47')](_0xd064('0x6b'),util[_0xd064('0x37')](_0x20eba3,{'showHidden':![],'depth':null}));ami['emit'](_0xd064('0x6c'),{});this['flagQueueSummary']=!![];};VoiceQueueReport[_0xd064('0x39')]['syncQueueCallerJoin']=function(_0x26f272){try{if(this[_0xd064('0x5b')](_0x26f272)){logger[_0xd064('0x47')]('[%s][voiceQueueReport][queuecallerjoin]',_0x26f272[_0xd064('0x41')],util['inspect'](_0x26f272,{'showHidden':![],'depth':null}));if(_[_0xd064('0x5c')](this[_0xd064('0xd')][_0x26f272['uniqueid']]))this[_0xd064('0xd')][_0x26f272[_0xd064('0x41')]]=[];if(_[_0xd064('0x5c')](this[_0xd064('0xf')][_0x26f272['uniqueid']]))this[_0xd064('0xf')][_0x26f272[_0xd064('0x41')]]={};var _0x3a671a=new QueueReport();_0x3a671a[_0xd064('0x44')]=_0x26f272[_0xd064('0x62')];_0x3a671a[_0xd064('0x4c')]=this['voiceQueues'][_0x3a671a[_0xd064('0x44')]]&&this[_0xd064('0x10')][_0x3a671a['name']][_0xd064('0x4c')]?this[_0xd064('0x10')][_0x3a671a[_0xd064('0x44')]][_0xd064('0x4c')]||_0xd064('0x4d'):_0xd064('0x4d');_0x3a671a[_0xd064('0x62')]=_0x26f272[_0xd064('0x62')];_0x3a671a[_0xd064('0x6d')]=moment()[_0xd064('0x42')](_0xd064('0x6e'));_0x3a671a['position']=_0x26f272['position'];_0x3a671a[_0xd064('0x6f')]=_0x26f272[_0xd064('0x6f')];_0x3a671a[_0xd064('0x41')]=_0x26f272['uniqueid'];_0x3a671a['routealias']=this[_0xd064('0xf')][_0x26f272[_0xd064('0x41')]][_0xd064('0x70')];logger[_0xd064('0x64')](_0xd064('0x71'),_0x3a671a[_0xd064('0x44')],_0x3a671a[_0xd064('0x4c')]);_[_0xd064('0x72')](_0x3a671a,_[_0xd064('0x73')](_0x26f272,_[_0xd064('0x74')](_0x3a671a)));this[_0xd064('0xd')][_0x26f272[_0xd064('0x41')]][_0xd064('0x75')](_0x3a671a);this[_0xd064('0xf')][_0x26f272[_0xd064('0x41')]]=_0x3a671a;this[_0xd064('0x76')](_0x3a671a,_0xd064('0x77'));}}catch(_0x20d9b1){logger[_0xd064('0x35')]('[%s][voiceQueueReport][queuecallerjoin]',_0x26f272[_0xd064('0x41')],util[_0xd064('0x37')](_0x20d9b1,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xd064('0x17')]=function(_0x4abc01){try{if(this[_0xd064('0x5b')](_0x4abc01)){logger[_0xd064('0x47')](_0xd064('0x78'),_0x4abc01['uniqueid'],util[_0xd064('0x37')](_0x4abc01,{'showHidden':![],'depth':null}));if(this[_0xd064('0xd')][_0x4abc01[_0xd064('0x41')]]){var _0x2aac14=_['last'](this[_0xd064('0xd')][_0x4abc01[_0xd064('0x41')]]);_0x2aac14['queuecallercomplete']=![];_0x2aac14[_0xd064('0x79')]=null;_0x2aac14[_0xd064('0x7a')]=_0x4abc01[_0xd064('0x7a')];_0x2aac14[_0xd064('0x7b')]=_0x4abc01['originalposition'];_0x2aac14[_0xd064('0x16')]=!![];_0x2aac14[_0xd064('0x7c')]=moment()[_0xd064('0x42')](_0xd064('0x6e'));_0x2aac14[_0xd064('0x7d')]='ABANDONED';_0x2aac14[_0xd064('0x7e')]=null;logger[_0xd064('0x64')](_0xd064('0x7f'),_0x2aac14[_0xd064('0x44')],_0x2aac14[_0xd064('0x4c')]);this[_0xd064('0xf')][_0x4abc01[_0xd064('0x41')]]=_0x2aac14;this[_0xd064('0x3c')](_0x2aac14,_0xd064('0x16'));}}}catch(_0x2239ea){logger[_0xd064('0x35')]('[%s][voiceQueueReport][queuecallerabandon]',_0x4abc01['uniqueid'],util['inspect'](_0x2239ea,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd064('0x39')][_0xd064('0x19')]=function(_0x13c399){try{if(this[_0xd064('0x5b')](_0x13c399)){logger['debug'](_0xd064('0x80'),_0x13c399[_0xd064('0x41')],util[_0xd064('0x37')](_0x13c399,{'showHidden':![],'depth':null}));if(this[_0xd064('0xd')][_0x13c399[_0xd064('0x41')]]){var _0x7c7b25=_[_0xd064('0x81')](this['queueReports'][_0x13c399[_0xd064('0x41')]]);_0x7c7b25[_0xd064('0x82')]=moment()[_0xd064('0x42')](_0xd064('0x6e'));_0x7c7b25['connectedlinenum']=_0x13c399[_0xd064('0x83')];_0x7c7b25['connectedlinename']=_0x13c399[_0xd064('0x84')];logger['info'](_0xd064('0x85'),_0x7c7b25[_0xd064('0x44')],_0x7c7b25[_0xd064('0x4c')],_0x13c399[_0xd064('0x83')],_0x13c399[_0xd064('0x84')]);this[_0xd064('0xf')][_0x13c399[_0xd064('0x41')]]=_0x7c7b25;this['emitVoiceQueueChannelSave'](_0x7c7b25,'queuecallerleave');}}}catch(_0x255881){logger['error'](_0xd064('0x80'),_0x13c399['uniqueid'],util['inspect'](_0x255881,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd064('0x39')][_0xd064('0x1a')]=function(_0x391fb9){try{if(this[_0xd064('0x5b')](_0x391fb9)){logger[_0xd064('0x47')](_0xd064('0x86'),_0x391fb9[_0xd064('0x41')],util[_0xd064('0x37')](_0x391fb9,{'showHidden':![],'depth':null}));if(this[_0xd064('0xd')][_0x391fb9[_0xd064('0x41')]]){var _0x292909=_[_0xd064('0x81')](this[_0xd064('0xd')][_0x391fb9[_0xd064('0x41')]]);_0x292909['queuecallercomplete']=!![];_0x292909[_0xd064('0x7d')]=_0xd064('0x87');logger['info'](_0xd064('0x88'),_0x292909[_0xd064('0x44')],_0x292909[_0xd064('0x4c')]);}}}catch(_0x334f7b){logger['error']('[%s][voiceQueueReport][agentconnect]',_0x391fb9[_0xd064('0x41')],util[_0xd064('0x37')](_0x334f7b,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xd064('0x89')]=function(_0x1b8285){try{if(this[_0xd064('0x5b')](_0x1b8285)){logger[_0xd064('0x47')]('[%s][voiceQueueReport][agentcomplete]',_0x1b8285[_0xd064('0x41')],util[_0xd064('0x37')](_0x1b8285,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x1b8285['uniqueid']]){var _0x1e5dc3=_[_0xd064('0x81')](this['queueReports'][_0x1b8285[_0xd064('0x41')]]);_0x1e5dc3[_0xd064('0x16')]=![];_0x1e5dc3[_0xd064('0x7c')]=null;_0x1e5dc3[_0xd064('0x8a')]=!![];_0x1e5dc3[_0xd064('0x7e')]=_0x1b8285[_0xd064('0x8b')];_0x1e5dc3['holdtime']=_0x1b8285[_0xd064('0x7a')];_0x1e5dc3[_0xd064('0x8c')]=!![];_0x1e5dc3[_0xd064('0x8d')]=![];_0x1e5dc3[_0xd064('0x8e')]=null;if(!_0x1e5dc3[_0xd064('0x8f')]){if(_0x1b8285['reason']=='transfer'){_0x1e5dc3[_0xd064('0x7d')]=_0xd064('0x90');logger[_0xd064('0x64')](_0xd064('0x91'),_0x1e5dc3[_0xd064('0x44')],_0x1e5dc3['type']);}else{if(_[_0xd064('0x92')](_0x1b8285[_0xd064('0x32')]['toLowerCase'](),_0xd064('0x93'))){if(this[_0xd064('0xd')][_0x1b8285[_0xd064('0x94')]]){var _0x1e18b7=_[_0xd064('0x81')](this[_0xd064('0xd')][_0x1b8285[_0xd064('0x94')]]);_0x1e18b7[_0xd064('0x8c')]=![];_0x1e18b7[_0xd064('0x8d')]=!![];_0x1e18b7[_0xd064('0x8e')]=moment(_0x1e5dc3[_0xd064('0x6d')])['add'](_0x1b8285[_0xd064('0x7a')],_0xd064('0x95'))[_0xd064('0x42')]('YYYY-MM-DD\x20HH:mm:ss');_0x1e18b7[_0xd064('0x7d')]='FORWARDTRANSFER';_0x1e18b7[_0xd064('0x8f')]=!![];_0x1e18b7[_0xd064('0x96')]=_0xd064('0x97');_0x1e18b7['transferexten']=_0x1b8285['destexten'];_0x1e18b7[_0xd064('0x98')]=_0x1b8285[_0xd064('0x41')];logger['info'](_0xd064('0x99'),_0x1e18b7[_0xd064('0x44')],_0x1e18b7[_0xd064('0x4c')]);var _0x273469=this[_0xd064('0xd')][_0x1b8285[_0xd064('0x94')]];this['queueReports'][_0x1b8285[_0xd064('0x94')]]=this[_0xd064('0xd')][_0x1b8285[_0xd064('0x41')]];this[_0xd064('0xd')][_0x1b8285[_0xd064('0x41')]]=_0x273469;}}else{_0x1e5dc3[_0xd064('0x7d')]=_0xd064('0x9a')+_0x1b8285[_0xd064('0x9b')][_0xd064('0x9c')]();logger['info'](_0xd064('0x9d'),_0x1e5dc3[_0xd064('0x44')],_0x1e5dc3[_0xd064('0x4c')],_0x1e5dc3[_0xd064('0x7d')]);}}}this['channels'][_0x1b8285[_0xd064('0x41')]]=_0x1e5dc3;this[_0xd064('0x3c')](_0x1e5dc3,_0xd064('0x9e'));}}}catch(_0x3e3739){logger[_0xd064('0x35')]('[%s][voiceQueueReport][agentcomplete]',_0x1b8285[_0xd064('0x41')],util[_0xd064('0x37')](_0x3e3739,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd064('0x39')][_0xd064('0x1c')]=function(_0x518597){try{if(this['isNotNull'](_0x518597)){logger[_0xd064('0x47')](_0xd064('0x9f'),_0x518597['uniqueid'],util[_0xd064('0x37')](_0x518597,{'showHidden':![],'depth':null}));this[_0xd064('0xa0')](_0x518597['uniqueid'],_[_0xd064('0x74')](_0x518597[_0xd064('0xa1')])[0x0],_0x518597[_0xd064('0xa2')]);if(this[_0xd064('0xd')][_0x518597['uniqueid']]){var _0x5d8d1a=_[_0xd064('0x81')](this[_0xd064('0xd')][_0x518597['uniqueid']]);if(_0x5d8d1a){if(this[_0xd064('0x5b')](_0x518597['variable'])&&this[_0xd064('0x5b')](_0x518597[_0xd064('0xa1')][_0xd064('0xa3')])){switch(_0x518597[_0xd064('0xa2')]){case _0xd064('0xa4'):_0x5d8d1a['queuecallerexit']=![];_0x5d8d1a[_0xd064('0x8e')]=null;break;case _0xd064('0xa5'):_0x5d8d1a['lastevent']=_0xd064('0xa6');_0x5d8d1a[_0xd064('0x8d')]=!![];_0x5d8d1a['queuecallerexitAt']=moment()[_0xd064('0x42')](_0xd064('0x6e'));_0x5d8d1a[_0xd064('0x82')]=moment()['format'](_0xd064('0x6e'));logger[_0xd064('0x47')](_0xd064('0xa7'),_0x518597[_0xd064('0x41')],util[_0xd064('0x37')](_0x5d8d1a,{'showHidden':![],'depth':null}));ami[_0xd064('0x3e')](_0xd064('0xa8'),_0x5d8d1a);break;default:_0x5d8d1a[_0xd064('0x8d')]=!![];_0x5d8d1a[_0xd064('0x8e')]=moment()[_0xd064('0x42')]('YYYY-MM-DD\x20HH:mm:ss');_0x5d8d1a['queuecallerleaveAt']=moment()[_0xd064('0x42')](_0xd064('0x6e'));}_0x5d8d1a[_0xd064('0x16')]=![];_0x5d8d1a[_0xd064('0x7c')]=null;_0x5d8d1a[_0xd064('0x7d')]=_0x518597['value'];this[_0xd064('0xf')][_0x518597[_0xd064('0x41')]]=_0x5d8d1a;this[_0xd064('0x3c')](_0x5d8d1a,_0xd064('0x1b'));}else if(this['isNotNull'](_0x518597['variable'])&&this[_0xd064('0x5b')](_0x518597['variable'][_0xd064('0xa9')])){if(!_0x5d8d1a[_0xd064('0x16')]){_0x5d8d1a['queuecallerexit']=!![];_0x5d8d1a['queuecallerexitAt']=moment()['format'](_0xd064('0x6e'));_0x5d8d1a[_0xd064('0x7d')]=_0xd064('0xaa');_0x5d8d1a[_0xd064('0x82')]=moment()[_0xd064('0x42')](_0xd064('0x6e'));this[_0xd064('0xf')][_0x518597['uniqueid']]=_0x5d8d1a;}}logger[_0xd064('0x64')]('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0x518597[_0xd064('0x41')],_0x5d8d1a[_0xd064('0x44')],_0x5d8d1a[_0xd064('0x4c')],_['keys'](_0x518597[_0xd064('0xa1')])[0x0],_0x518597[_0xd064('0xa2')]);_0x5d8d1a['variables']=this[_0xd064('0x38')][_0x518597[_0xd064('0x41')]];}}}}catch(_0x330938){logger[_0xd064('0x35')](_0xd064('0x9f'),_0x518597[_0xd064('0x41')],util[_0xd064('0x37')](_0x330938,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd064('0x39')][_0xd064('0xa0')]=function(_0x4c3bfe,_0x25db77,_0x7a3b04){var _0xa9989e=['rtpaudioqos',_0xd064('0xab'),_0xd064('0xac'),_0xd064('0xad'),_0xd064('0xae'),_0xd064('0xaf'),_0xd064('0xb0'),'rtpaudioqosrttbridged',_0xd064('0xb1'),_0xd064('0xb2'),_0xd064('0xb3'),_0xd064('0xb4'),_0xd064('0xb5'),_0xd064('0xb6'),_0xd064('0xb7'),_0xd064('0xb8'),_0xd064('0x8b'),_0xd064('0xb9'),_0xd064('0xba')];if(!_['isNil'](_0x25db77)&&!_[_0xd064('0xbb')](_0xa9989e,_0x25db77)){if(_[_0xd064('0x5c')](this[_0xd064('0x38')][_0x4c3bfe])){this[_0xd064('0x38')][_0x4c3bfe]={};}this[_0xd064('0x38')][_0x4c3bfe][_0x25db77]=_0x7a3b04;}};VoiceQueueReport[_0xd064('0x39')]['handleHangup']=function(_0x555dc4,_0x3bfd63,_0x197904){var _0x46d022={};for(var _0x2bcc84=0x0;_0x2bcc840x0?_0x277cf9:0x0;this[_0x2ee4('0x13')][_0x56b925[_0x2ee4('0x72')]]['talking']=this[_0x2ee4('0x13')][_0x56b925[_0x2ee4('0x72')]][_0x2ee4('0x33')]>_[_0x2ee4('0x77')](_0x56b925['loggedin'])?_[_0x2ee4('0x77')](_0x56b925[_0x2ee4('0x78')]):this['voiceQueues'][_0x56b925[_0x2ee4('0x72')]]['talking'];this[_0x2ee4('0x58')](this[_0x2ee4('0x13')][_0x56b925['queue']],_0x2ee4('0x16'));}logger[_0x2ee4('0x4c')](_0x2ee4('0x7a'),util[_0x2ee4('0x42')](this[_0x2ee4('0x13')][_0x56b925['queue']],{'showHidden':![],'depth':null}));ami[_0x2ee4('0x4a')](_0x2ee4('0x7b'),this[_0x2ee4('0x13')][_0x56b925[_0x2ee4('0x72')]]);}}}catch(_0x591919){logger['error'](_0x2ee4('0x6f'),util[_0x2ee4('0x42')](_0x591919,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x2ee4('0xa')][_0x2ee4('0x1a')]=function(_0xed651e){logger[_0x2ee4('0x4c')](_0x2ee4('0x7c'),util[_0x2ee4('0x42')](_0xed651e,{'showHidden':![],'depth':null}));ami['emit']('custom:queuesummarycomplete',{});this[_0x2ee4('0x6e')]=!![];};VoiceQueueReport[_0x2ee4('0xa')][_0x2ee4('0x1c')]=function(_0x5b4e5f){try{if(this['isNotNull'](_0x5b4e5f)){logger[_0x2ee4('0x4c')]('[%s][voiceQueueReport][queuecallerjoin]',_0x5b4e5f[_0x2ee4('0x4e')],util[_0x2ee4('0x42')](_0x5b4e5f,{'showHidden':![],'depth':null}));if(_[_0x2ee4('0x6c')](this[_0x2ee4('0xf')][_0x5b4e5f[_0x2ee4('0x4e')]]))this[_0x2ee4('0xf')][_0x5b4e5f['uniqueid']]=[];if(_[_0x2ee4('0x6c')](this[_0x2ee4('0x11')][_0x5b4e5f[_0x2ee4('0x4e')]]))this['channels'][_0x5b4e5f[_0x2ee4('0x4e')]]={};var _0x46bab9=new QueueReport();_0x46bab9[_0x2ee4('0x55')]=_0x5b4e5f[_0x2ee4('0x72')];_0x46bab9[_0x2ee4('0x59')]=this[_0x2ee4('0x13')][_0x46bab9['name']]&&this['voiceQueues'][_0x46bab9['name']][_0x2ee4('0x59')]?this[_0x2ee4('0x13')][_0x46bab9['name']][_0x2ee4('0x59')]||_0x2ee4('0x5a'):'inbound';_0x46bab9['queue']=_0x5b4e5f[_0x2ee4('0x72')];_0x46bab9[_0x2ee4('0x7d')]=moment()[_0x2ee4('0x54')]('YYYY-MM-DD\x20HH:mm:ss');_0x46bab9[_0x2ee4('0x7e')]=_0x5b4e5f[_0x2ee4('0x7e')];_0x46bab9['count']=_0x5b4e5f[_0x2ee4('0x7f')];_0x46bab9[_0x2ee4('0x4e')]=_0x5b4e5f['uniqueid'];_0x46bab9[_0x2ee4('0x80')]=this[_0x2ee4('0x11')][_0x5b4e5f[_0x2ee4('0x4e')]]['routealias'];logger[_0x2ee4('0x73')]('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x46bab9[_0x2ee4('0x55')],_0x46bab9['type']);_['merge'](_0x46bab9,_[_0x2ee4('0x81')](_0x5b4e5f,_[_0x2ee4('0x82')](_0x46bab9)));this[_0x2ee4('0xf')][_0x5b4e5f[_0x2ee4('0x4e')]]['push'](_0x46bab9);this[_0x2ee4('0x11')][_0x5b4e5f[_0x2ee4('0x4e')]]=_0x46bab9;this[_0x2ee4('0x4b')](_0x46bab9,_0x2ee4('0x1b'));}}catch(_0xf03a43){logger[_0x2ee4('0x40')](_0x2ee4('0x83'),_0x5b4e5f[_0x2ee4('0x4e')],util[_0x2ee4('0x42')](_0xf03a43,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x2ee4('0xa')][_0x2ee4('0x1e')]=function(_0x48060f){try{if(this[_0x2ee4('0x70')](_0x48060f)){logger[_0x2ee4('0x4c')](_0x2ee4('0x84'),_0x48060f[_0x2ee4('0x4e')],util[_0x2ee4('0x42')](_0x48060f,{'showHidden':![],'depth':null}));if(this[_0x2ee4('0xf')][_0x48060f[_0x2ee4('0x4e')]]){var _0x3974cd=_[_0x2ee4('0x85')](this[_0x2ee4('0xf')][_0x48060f[_0x2ee4('0x4e')]]);_0x3974cd[_0x2ee4('0x86')]=![];_0x3974cd[_0x2ee4('0x87')]=null;_0x3974cd[_0x2ee4('0x88')]=_0x48060f[_0x2ee4('0x88')];_0x3974cd[_0x2ee4('0x89')]=_0x48060f[_0x2ee4('0x89')];_0x3974cd[_0x2ee4('0x1d')]=!![];_0x3974cd[_0x2ee4('0x8a')]=moment()['format'](_0x2ee4('0x8b'));_0x3974cd[_0x2ee4('0x8c')]=_0x2ee4('0x8d');_0x3974cd[_0x2ee4('0x8e')]=null;logger[_0x2ee4('0x73')](_0x2ee4('0x8f'),_0x3974cd[_0x2ee4('0x55')],_0x3974cd[_0x2ee4('0x59')]);this[_0x2ee4('0x11')][_0x48060f[_0x2ee4('0x4e')]]=_0x3974cd;this[_0x2ee4('0x48')](_0x3974cd,_0x2ee4('0x1d'));}}}catch(_0x277ffc){logger[_0x2ee4('0x40')]('[%s][voiceQueueReport][queuecallerabandon]',_0x48060f['uniqueid'],util[_0x2ee4('0x42')](_0x277ffc,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x2ee4('0xa')]['syncQueueCallerLeave']=function(_0x1fe605){try{if(this[_0x2ee4('0x70')](_0x1fe605)){logger[_0x2ee4('0x4c')](_0x2ee4('0x90'),_0x1fe605[_0x2ee4('0x4e')],util[_0x2ee4('0x42')](_0x1fe605,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x1fe605[_0x2ee4('0x4e')]]){var _0x2c2b77=_[_0x2ee4('0x85')](this[_0x2ee4('0xf')][_0x1fe605[_0x2ee4('0x4e')]]);_0x2c2b77[_0x2ee4('0x91')]=moment()['format'](_0x2ee4('0x8b'));_0x2c2b77[_0x2ee4('0x92')]=_0x1fe605[_0x2ee4('0x92')];_0x2c2b77['connectedlinename']=_0x1fe605['connectedlinename'];logger[_0x2ee4('0x73')]('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x2c2b77['name'],_0x2c2b77[_0x2ee4('0x59')],_0x1fe605[_0x2ee4('0x92')],_0x1fe605[_0x2ee4('0x93')]);this['channels'][_0x1fe605[_0x2ee4('0x4e')]]=_0x2c2b77;this[_0x2ee4('0x4b')](_0x2c2b77,'queuecallerleave');}}}catch(_0x5f6978){logger['error']('[%s][voiceQueueReport][queuecallerleave]',_0x1fe605[_0x2ee4('0x4e')],util['inspect'](_0x5f6978,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x2ee4('0x23')]=function(_0x144b84){try{if(this[_0x2ee4('0x70')](_0x144b84)){logger[_0x2ee4('0x4c')]('[%s][voiceQueueReport][agentconnect]',_0x144b84[_0x2ee4('0x4e')],util[_0x2ee4('0x42')](_0x144b84,{'showHidden':![],'depth':null}));if(this[_0x2ee4('0xf')][_0x144b84[_0x2ee4('0x4e')]]){var _0x1c19fc=_['last'](this[_0x2ee4('0xf')][_0x144b84[_0x2ee4('0x4e')]]);_0x1c19fc[_0x2ee4('0x86')]=!![];_0x1c19fc['queuecallerexitreason']=_0x2ee4('0x94');logger[_0x2ee4('0x73')](_0x2ee4('0x95'),_0x1c19fc['name'],_0x1c19fc[_0x2ee4('0x59')]);}}}catch(_0x4e7147){logger[_0x2ee4('0x40')](_0x2ee4('0x96'),_0x144b84[_0x2ee4('0x4e')],util[_0x2ee4('0x42')](_0x4e7147,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x2ee4('0xa')][_0x2ee4('0x21')]=function(_0x225dce){try{if(this[_0x2ee4('0x70')](_0x225dce)){logger[_0x2ee4('0x4c')]('[%s][voiceQueueReport][agentcomplete]',_0x225dce[_0x2ee4('0x4e')],util[_0x2ee4('0x42')](_0x225dce,{'showHidden':![],'depth':null}));if(this[_0x2ee4('0xf')][_0x225dce[_0x2ee4('0x4e')]]){var _0x3edf69=_[_0x2ee4('0x85')](this[_0x2ee4('0xf')][_0x225dce[_0x2ee4('0x4e')]]);_0x3edf69[_0x2ee4('0x1d')]=![];_0x3edf69[_0x2ee4('0x8a')]=null;_0x3edf69[_0x2ee4('0x97')]=!![];_0x3edf69[_0x2ee4('0x8e')]=_0x225dce['membername'];_0x3edf69[_0x2ee4('0x88')]=_0x225dce[_0x2ee4('0x88')];_0x3edf69['queuecallercomplete']=!![];_0x3edf69[_0x2ee4('0x98')]=![];_0x3edf69[_0x2ee4('0x99')]=null;if(!_0x3edf69[_0x2ee4('0x9a')]){if(_0x225dce[_0x2ee4('0x9b')]==_0x2ee4('0x9a')){_0x3edf69['queuecallerexitreason']=_0x2ee4('0x9c');logger[_0x2ee4('0x73')](_0x2ee4('0x9d'),_0x3edf69[_0x2ee4('0x55')],_0x3edf69['type']);}else{if(_[_0x2ee4('0x9e')](_0x225dce[_0x2ee4('0x3c')][_0x2ee4('0x9f')](),_0x2ee4('0xa0'))){if(this['queueReports'][_0x225dce[_0x2ee4('0xa1')]]){var _0x3a3c22=_[_0x2ee4('0x85')](this[_0x2ee4('0xf')][_0x225dce[_0x2ee4('0xa1')]]);_0x3a3c22[_0x2ee4('0x86')]=![];_0x3a3c22[_0x2ee4('0x98')]=!![];_0x3a3c22[_0x2ee4('0x99')]=moment(_0x3edf69[_0x2ee4('0x7d')])['add'](_0x225dce[_0x2ee4('0x88')],_0x2ee4('0xa2'))[_0x2ee4('0x54')]('YYYY-MM-DD\x20HH:mm:ss');_0x3a3c22[_0x2ee4('0x8c')]=_0x2ee4('0xa3');_0x3a3c22[_0x2ee4('0x9a')]=!![];_0x3a3c22[_0x2ee4('0xa4')]='FORWARD';_0x3a3c22[_0x2ee4('0xa5')]=_0x225dce['destexten'];_0x3a3c22[_0x2ee4('0xa6')]=_0x225dce[_0x2ee4('0x4e')];logger[_0x2ee4('0x73')](_0x2ee4('0xa7'),_0x3a3c22[_0x2ee4('0x55')],_0x3a3c22[_0x2ee4('0x59')]);var _0x225b74=this[_0x2ee4('0xf')][_0x225dce[_0x2ee4('0xa1')]];this['queueReports'][_0x225dce[_0x2ee4('0xa1')]]=this[_0x2ee4('0xf')][_0x225dce[_0x2ee4('0x4e')]];this[_0x2ee4('0xf')][_0x225dce[_0x2ee4('0x4e')]]=_0x225b74;}}else{_0x3edf69[_0x2ee4('0x8c')]=_0x2ee4('0xa8')+_0x225dce[_0x2ee4('0x9b')][_0x2ee4('0xa9')]();logger['info'](_0x2ee4('0xaa'),_0x3edf69['name'],_0x3edf69['type'],_0x3edf69[_0x2ee4('0x8c')]);}}}this[_0x2ee4('0x11')][_0x225dce[_0x2ee4('0x4e')]]=_0x3edf69;this['emitVoiceQueueChannelRemove'](_0x3edf69,_0x2ee4('0x20'));}}}catch(_0x358612){logger[_0x2ee4('0x40')](_0x2ee4('0xab'),_0x225dce[_0x2ee4('0x4e')],util[_0x2ee4('0x42')](_0x358612,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x2ee4('0x25')]=function(_0x74f14d){try{if(this[_0x2ee4('0x70')](_0x74f14d)){logger[_0x2ee4('0x4c')](_0x2ee4('0xac'),_0x74f14d[_0x2ee4('0x4e')],util['inspect'](_0x74f14d,{'showHidden':![],'depth':null}));this[_0x2ee4('0xad')](_0x74f14d[_0x2ee4('0x4e')],_['keys'](_0x74f14d[_0x2ee4('0xae')])[0x0],_0x74f14d[_0x2ee4('0xaf')]);if(this['queueReports'][_0x74f14d[_0x2ee4('0x4e')]]){var _0x1f9d97=_[_0x2ee4('0x85')](this[_0x2ee4('0xf')][_0x74f14d[_0x2ee4('0x4e')]]);if(_0x1f9d97){if(this[_0x2ee4('0x70')](_0x74f14d[_0x2ee4('0xae')])&&this['isNotNull'](_0x74f14d[_0x2ee4('0xae')][_0x2ee4('0xb0')])){switch(_0x74f14d[_0x2ee4('0xaf')]){case'CONTINUE':_0x1f9d97[_0x2ee4('0x98')]=![];_0x1f9d97[_0x2ee4('0x99')]=null;break;case _0x2ee4('0xb1'):_0x1f9d97[_0x2ee4('0xb2')]=_0x2ee4('0xb3');_0x1f9d97['queuecallerexit']=!![];_0x1f9d97[_0x2ee4('0x99')]=moment()[_0x2ee4('0x54')]('YYYY-MM-DD\x20HH:mm:ss');_0x1f9d97[_0x2ee4('0x91')]=moment()['format'](_0x2ee4('0x8b'));logger[_0x2ee4('0x4c')](_0x2ee4('0xb4'),_0x74f14d['uniqueid'],util[_0x2ee4('0x42')](_0x1f9d97,{'showHidden':![],'depth':null}));ami[_0x2ee4('0x4a')](_0x2ee4('0xb5'),_0x1f9d97);break;default:_0x1f9d97[_0x2ee4('0x98')]=!![];_0x1f9d97[_0x2ee4('0x99')]=moment()[_0x2ee4('0x54')](_0x2ee4('0x8b'));_0x1f9d97['queuecallerleaveAt']=moment()[_0x2ee4('0x54')](_0x2ee4('0x8b'));}_0x1f9d97[_0x2ee4('0x1d')]=![];_0x1f9d97[_0x2ee4('0x8a')]=null;_0x1f9d97[_0x2ee4('0x8c')]=_0x74f14d[_0x2ee4('0xaf')];this['channels'][_0x74f14d[_0x2ee4('0x4e')]]=_0x1f9d97;this[_0x2ee4('0x48')](_0x1f9d97,_0x2ee4('0x24'));}else if(this[_0x2ee4('0x70')](_0x74f14d[_0x2ee4('0xae')])&&this['isNotNull'](_0x74f14d[_0x2ee4('0xae')][_0x2ee4('0xb6')])){if(!_0x1f9d97[_0x2ee4('0x1d')]){_0x1f9d97['queuecallerexit']=!![];_0x1f9d97['queuecallerexitAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x1f9d97['queuecallerexitreason']=_0x2ee4('0xb7');_0x1f9d97[_0x2ee4('0x91')]=moment()[_0x2ee4('0x54')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x2ee4('0x11')][_0x74f14d['uniqueid']]=_0x1f9d97;}}logger[_0x2ee4('0x73')](_0x2ee4('0xb8'),_0x74f14d['uniqueid'],_0x1f9d97[_0x2ee4('0x55')],_0x1f9d97[_0x2ee4('0x59')],_['keys'](_0x74f14d[_0x2ee4('0xae')])[0x0],_0x74f14d['value']);_0x1f9d97[_0x2ee4('0x15')]=this['variables'][_0x74f14d['uniqueid']];}}}}catch(_0x2cc4be){logger['error'](_0x2ee4('0xac'),_0x74f14d[_0x2ee4('0x4e')],util[_0x2ee4('0x42')](_0x2cc4be,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x2ee4('0xa')][_0x2ee4('0xad')]=function(_0x789bd3,_0x231c77,_0x58c028){var _0x16fe13=[_0x2ee4('0xb9'),_0x2ee4('0xba'),'rtpaudioqosjitter',_0x2ee4('0xbb'),'rtpaudioqosloss',_0x2ee4('0xbc'),'rtpaudioqosrtt','rtpaudioqosrttbridged',_0x2ee4('0xbd'),_0x2ee4('0xbe'),_0x2ee4('0xbf'),_0x2ee4('0xc0'),_0x2ee4('0xc1'),_0x2ee4('0xc2'),_0x2ee4('0xc3'),_0x2ee4('0xc4'),_0x2ee4('0xc5'),_0x2ee4('0xc6'),'memberrealtime'];if(!_['isNil'](_0x231c77)&&!_[_0x2ee4('0xc7')](_0x16fe13,_0x231c77)){if(_[_0x2ee4('0x6c')](this[_0x2ee4('0x15')][_0x789bd3])){this[_0x2ee4('0x15')][_0x789bd3]={};}this['variables'][_0x789bd3][_0x231c77]=_0x58c028;}};VoiceQueueReport[_0x2ee4('0xa')][_0x2ee4('0xc8')]=function(_0x36168b,_0x5203ea,_0x58c4e1){var _0x137f0c={};for(var _0x141460=0x0;_0x141460=0x0?moment(_0x1cea72[_0x9480('0x18')])[_0x9480('0xc')](_0x1cea72[_0x9480('0x17')],'seconds'):null,'data1':_0x9480('0x19'),'data2':_0x1cea72[_0x9480('0x13')],'data3':_0x1cea72[_0x9480('0x11')],'data4':_0x1cea72['dialstring']||null,'role':'agent','internal':_0x1cea72[_0x9480('0x13')]?_[_0x9480('0x1a')](_0x1cea72['accountcode']):undefined,'uniqueid':_0x1cea72[_0x9480('0x14')]},'log':_0x9480('0x6')});}; \ No newline at end of file +var _0x9d23=['outbound','dialstring','agent','toNumber','moment','lodash','util','../client','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','CreateMemberReport','voice','lastAssignedTo','isNil','format','interface','TALKING','queuecallerleaveAt','seconds','inbound','calleridnum','exten','accountcode','uniqueid','voiceDialReport','Request','membername','starttime','diff','endtime'];(function(_0x3d790f,_0x3bbb4b){var _0x1a1e0c=function(_0x49db8b){while(--_0x49db8b){_0x3d790f['push'](_0x3d790f['shift']());}};_0x1a1e0c(++_0x3bbb4b);}(_0x9d23,0x13a));var _0x39d2=function(_0x52d985,_0x14fd86){_0x52d985=_0x52d985-0x0;var _0x3cc466=_0x9d23[_0x52d985];return _0x3cc466;};'use strict';var moment=require(_0x39d2('0x0'));var _=require(_0x39d2('0x1'));var util=require(_0x39d2('0x2'));var client=require(_0x39d2('0x3'));exports[_0x39d2('0x4')]=function(_0xd0c255){var _0x55702a=_0xd0c255[_0x39d2('0x5')]||_0xd0c255[_0x39d2('0x6')];return client['Request'](_0x39d2('0x7'),{'body':{'channel':_0x39d2('0x8'),'membername':_0xd0c255[_0x39d2('0x9')],'interface':_[_0x39d2('0xa')](_0xd0c255['interface'])?util[_0x39d2('0xb')]('SIP/%s',_0xd0c255[_0x39d2('0x9')]):_0xd0c255[_0x39d2('0xc')],'type':_0x39d2('0xd'),'enterAt':_0xd0c255[_0x39d2('0xe')],'exitAt':_0x55702a,'duration':moment(_0x55702a)['diff'](_0xd0c255[_0x39d2('0xe')],_0x39d2('0xf')),'data1':_0x39d2('0x10'),'data2':_0xd0c255[_0x39d2('0x11')],'data3':_0xd0c255[_0x39d2('0x12')],'data4':null,'data5':_0xd0c255['queue'],'role':'agent','internal':_0xd0c255[_0x39d2('0x13')]?_['toNumber'](_0xd0c255['accountcode']):undefined,'uniqueid':_0xd0c255[_0x39d2('0x14')]},'log':_0x39d2('0x7')});};exports[_0x39d2('0x15')]=function(_0x3f95c9){return client[_0x39d2('0x16')](_0x39d2('0x7'),{'body':{'channel':_0x39d2('0x8'),'membername':_0x3f95c9[_0x39d2('0x17')],'interface':_0x3f95c9['interface'],'type':_0x39d2('0xd'),'enterAt':_0x3f95c9[_0x39d2('0x18')],'exitAt':_0x3f95c9['endtime'],'duration':moment(_0x3f95c9['endtime'])[_0x39d2('0x19')](_0x3f95c9[_0x39d2('0x18')],_0x39d2('0xf'))>=0x0?moment(_0x3f95c9[_0x39d2('0x1a')])['diff'](_0x3f95c9[_0x39d2('0x18')],_0x39d2('0xf')):null,'data1':_0x39d2('0x1b'),'data2':_0x3f95c9[_0x39d2('0x13')],'data3':_0x3f95c9['exten'],'data4':_0x3f95c9[_0x39d2('0x1c')]||null,'role':_0x39d2('0x1d'),'internal':_0x3f95c9[_0x39d2('0x13')]?_[_0x39d2('0x1e')](_0x3f95c9[_0x39d2('0x13')]):undefined,'uniqueid':_0x3f95c9[_0x39d2('0x14')]},'log':_0x39d2('0x7')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 675228d..26f9d05 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 _0x590a=['getSettings','Request','ShowSetting','stopRecordingOnTransfer','previewRecallmeReminderInterval'];(function(_0x46460e,_0x4a6c5e){var _0x4c36a3=function(_0x676dfe){while(--_0x676dfe){_0x46460e['push'](_0x46460e['shift']());}};_0x4c36a3(++_0x4a6c5e);}(_0x590a,0x159));var _0xa590=function(_0x4ebc5a,_0x5bc3c1){_0x4ebc5a=_0x4ebc5a-0x0;var _0x553d99=_0x590a[_0x4ebc5a];return _0x553d99;};'use strict';var client=require('../client');exports[_0xa590('0x0')]=function(){return client[_0xa590('0x1')](_0xa590('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xa590('0x3'),_0xa590('0x4')]},'log':'GetSettings'});}; \ No newline at end of file +var _0xd027=['stopRecordingOnTransfer','previewRecallmeReminderInterval','GetSettings','getSettings'];(function(_0x5aaba8,_0x248b94){var _0x13f7e3=function(_0x2db2c5){while(--_0x2db2c5){_0x5aaba8['push'](_0x5aaba8['shift']());}};_0x13f7e3(++_0x248b94);}(_0xd027,0x197));var _0x7d02=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd027[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports[_0x7d02('0x0')]=function(){return client['Request']('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x7d02('0x1'),_0x7d02('0x2')]},'log':_0x7d02('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 755c057..144dbb9 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 _0x573c=['getTemplates','Request','GetTemplate','name','html','../client'];(function(_0x9adf1b,_0x3ac695){var _0x960269=function(_0x368ca6){while(--_0x368ca6){_0x9adf1b['push'](_0x9adf1b['shift']());}};_0x960269(++_0x3ac695);}(_0x573c,0x125));var _0xc573=function(_0x11c5e4,_0x9cdfe3){_0x11c5e4=_0x11c5e4-0x0;var _0x285dec=_0x573c[_0x11c5e4];return _0x285dec;};'use strict';var client=require(_0xc573('0x0'));exports[_0xc573('0x1')]=function(_0x4aa092){return function(_0x37072b){return client[_0xc573('0x2')](_0xc573('0x3'),{'options':{'raw':!![],'attributes':['id',_0xc573('0x4'),_0xc573('0x5')]},'log':_0xc573('0x3')});};}; \ No newline at end of file +var _0xb537=['../client','Request','GetTemplate','name','html'];(function(_0x529a44,_0x50fb64){var _0xd643a0=function(_0x10ea3b){while(--_0x10ea3b){_0x529a44['push'](_0x529a44['shift']());}};_0xd643a0(++_0x50fb64);}(_0xb537,0x163));var _0x7b53=function(_0x548a06,_0x35cc74){_0x548a06=_0x548a06-0x0;var _0x3d5d78=_0xb537[_0x548a06];return _0x3d5d78;};'use strict';var client=require(_0x7b53('0x0'));exports['getTemplates']=function(_0x5d479b){return function(_0x1f72cb){return client[_0x7b53('0x1')](_0x7b53('0x2'),{'options':{'raw':!![],'attributes':['id',_0x7b53('0x3'),_0x7b53('0x4')]},'log':_0x7b53('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 97ff382..0e60f19 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 _0x032b=['value','field','Action','action','data1','data4','data5','data6','data7','getTriggers','Request','GetTrigger','name','channel','status','Condition','AllConditions','operator'];(function(_0x68ee8b,_0x3cc6c5){var _0x5148f7=function(_0x5dcbd5){while(--_0x5dcbd5){_0x68ee8b['push'](_0x68ee8b['shift']());}};_0x5148f7(++_0x3cc6c5);}(_0x032b,0x105));var _0xb032=function(_0x3ecf3f,_0x1709c9){_0x3ecf3f=_0x3ecf3f-0x0;var _0x1c6c85=_0x032b[_0x3ecf3f];return _0x1c6c85;};'use strict';var client=require('../client');exports[_0xb032('0x0')]=function(_0x75bf14){return function(_0x1ddd31){return client[_0xb032('0x1')](_0xb032('0x2'),{'options':{'raw':![],'attributes':['id',_0xb032('0x3'),_0xb032('0x4'),_0xb032('0x5')],'include':[{'model':_0xb032('0x6'),'as':_0xb032('0x7'),'attributes':['id','field',_0xb032('0x8'),_0xb032('0x9')]},{'model':_0xb032('0x6'),'as':'AnyConditions','attributes':['id',_0xb032('0xa'),_0xb032('0x8'),_0xb032('0x9')]},{'model':_0xb032('0xb'),'as':'Actions','attributes':['id',_0xb032('0xc'),_0xb032('0xd'),'data2','data3',_0xb032('0xe'),_0xb032('0xf'),_0xb032('0x10'),_0xb032('0x11')]}]},'log':_0xb032('0x2')});};}; \ No newline at end of file +var _0xb3d6=['Action','Actions','data1','data2','data3','data6','../client','getTriggers','GetTrigger','status','field','operator','value','AnyConditions'];(function(_0x14757c,_0x295c1c){var _0x2106ea=function(_0x4b61ab){while(--_0x4b61ab){_0x14757c['push'](_0x14757c['shift']());}};_0x2106ea(++_0x295c1c);}(_0xb3d6,0x76));var _0x6b3d=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xb3d6[_0xa464c9];return _0x3d73c4;};'use strict';var client=require(_0x6b3d('0x0'));exports[_0x6b3d('0x1')]=function(_0x4933a5){return function(_0x514f1a){return client['Request'](_0x6b3d('0x2'),{'options':{'raw':![],'attributes':['id','name','channel',_0x6b3d('0x3')],'include':[{'model':'Condition','as':'AllConditions','attributes':['id',_0x6b3d('0x4'),_0x6b3d('0x5'),_0x6b3d('0x6')]},{'model':'Condition','as':_0x6b3d('0x7'),'attributes':['id',_0x6b3d('0x4'),'operator','value']},{'model':_0x6b3d('0x8'),'as':_0x6b3d('0x9'),'attributes':['id','action',_0x6b3d('0xa'),_0x6b3d('0xb'),_0x6b3d('0xc'),'data4','data5',_0x6b3d('0xd'),'data7']}]},'log':_0x6b3d('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index f5cad24..9015e02 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 _0xc827=['Request','name','registry','defaultuser','GetTrunk','../client'];(function(_0x32d37d,_0x405f56){var _0x414c90=function(_0x383387){while(--_0x383387){_0x32d37d['push'](_0x32d37d['shift']());}};_0x414c90(++_0x405f56);}(_0xc827,0x149));var _0x7c82=function(_0x1c9e12,_0x40f288){_0x1c9e12=_0x1c9e12-0x0;var _0x4b64f4=_0xc827[_0x1c9e12];return _0x4b64f4;};'use strict';var client=require(_0x7c82('0x0'));exports['getTrunks']=function(_0x320d8e){return function(_0x569e29){return client[_0x7c82('0x1')]('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x7c82('0x2'),_0x7c82('0x3'),_0x7c82('0x4')]},'log':_0x7c82('0x5')});};}; \ No newline at end of file +var _0x6208=['defaultuser','../client','GetTrunk','registry'];(function(_0x5b6226,_0x25e082){var _0x46ac12=function(_0x108901){while(--_0x108901){_0x5b6226['push'](_0x5b6226['shift']());}};_0x46ac12(++_0x25e082);}(_0x6208,0x17d));var _0x8620=function(_0x1d4449,_0x495153){_0x1d4449=_0x1d4449-0x0;var _0x4dcde3=_0x6208[_0x1d4449];return _0x4dcde3;};'use strict';var client=require(_0x8620('0x0'));exports['getTrunks']=function(_0x3e4df6){return function(_0x275639){return client['Request'](_0x8620('0x1'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0x8620('0x2'),_0x8620('0x3')]},'log':_0x8620('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 3aa088d..1fc9c1f 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 _0x9c44=['online','pauseType','Request','GetUser','agent','name','email','accountcode','lastLoginAt','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','telephone','internal','PauseUser','savePause','getAgent','ShowUser','fullname'];(function(_0x5595f2,_0x232b32){var _0x3cb7eb=function(_0x48e9f9){while(--_0x48e9f9){_0x5595f2['push'](_0x5595f2['shift']());}};_0x3cb7eb(++_0x232b32);}(_0x9c44,0x178));var _0x49c4=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0x9c44[_0x5608a3];return _0x1ed50a;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2')},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5'),'fullname','online',_0x49c4('0x6'),'pauseType',_0x49c4('0x7'),_0x49c4('0x8'),_0x49c4('0x9'),_0x49c4('0xa'),_0x49c4('0xb')]},'log':'getAgents'});};};exports[_0x49c4('0xc')]=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':!![],'where':{'role':_0x49c4('0xd')},'attributes':['id','name','accountcode',_0x49c4('0xe')]},'log':_0x49c4('0xc')});};};exports['savePause']=function(_0xb611a1,_0x459d09,_0x4adb3c){return client['Request'](_0x49c4('0xf'),{'body':{'type':_0x459d09,'uniqueid':_0x4adb3c},'options':{'where':{'id':_0xb611a1['id']}},'log':_0x49c4('0x10')});};exports['saveUnpause']=function(_0x7df3a9){return client[_0x49c4('0x0')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x7df3a9['id']}},'log':_0x49c4('0x10')});};exports[_0x49c4('0x11')]=function(_0x21f15a){return client[_0x49c4('0x0')](_0x49c4('0x12'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2'),'id':_0x21f15a},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),'accountcode',_0x49c4('0x13'),_0x49c4('0x14'),_0x49c4('0x6'),_0x49c4('0x15'),_0x49c4('0x7'),'voicePause',_0x49c4('0xb')]},'log':_0x49c4('0x11')});}; \ No newline at end of file +var _0xa9e0=['agent','lastPauseAt','interface','../client','getAgents','Request','name','accountcode','fullname','online','lastLoginAt','pauseType','voicePause','phone','mobile','getTelephones','telephone','internal','savePause','PauseUser','saveUnpause','UnpauseUser','getAgent','ShowUser'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xa9e0[_0x12d033];return _0x3b4e80;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x0a9e('0x3'),'email',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'lastPauseAt',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'interface']},'log':'getAgents'});};};exports[_0x0a9e('0xc')]=function(){return function(){return client['Request']('GetUser',{'options':{'raw':!![],'where':{'role':_0x0a9e('0xd')},'attributes':['id',_0x0a9e('0x3'),_0x0a9e('0x4'),_0x0a9e('0xe')]},'log':_0x0a9e('0xc')});};};exports[_0x0a9e('0xf')]=function(_0x4a4c56,_0x50dfb2,_0x527cdd){return client['Request'](_0x0a9e('0x10'),{'body':{'type':_0x50dfb2,'uniqueid':_0x527cdd},'options':{'where':{'id':_0x4a4c56['id']}},'log':_0x0a9e('0xf')});};exports[_0x0a9e('0x11')]=function(_0x26d672){return client[_0x0a9e('0x2')](_0x0a9e('0x12'),{'body':{},'options':{'where':{'id':_0x26d672['id']}},'log':'savePause'});};exports[_0x0a9e('0x13')]=function(_0x239b12){return client[_0x0a9e('0x2')](_0x0a9e('0x14'),{'options':{'raw':![],'where':{'role':_0x0a9e('0x15'),'id':_0x239b12},'attributes':['id',_0x0a9e('0x3'),'email',_0x0a9e('0x4'),'fullname',_0x0a9e('0x6'),'lastLoginAt',_0x0a9e('0x8'),_0x0a9e('0x16'),'voicePause',_0x0a9e('0x17')]},'log':'getAgent'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 6ad7fb2..afc0671 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 _0xd1e9=['create','Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport'];(function(_0x58dbdd,_0x518894){var _0x27edd3=function(_0x41a798){while(--_0x41a798){_0x58dbdd['push'](_0x58dbdd['shift']());}};_0x27edd3(++_0x518894);}(_0xd1e9,0x186));var _0x9d1e=function(_0x59ee50,_0x2f47f2){_0x59ee50=_0x59ee50-0x0;var _0x1aa0bc=_0xd1e9[_0x59ee50];return _0x1aa0bc;};'use strict';var client=require('../client');exports[_0x9d1e('0x0')]=function(_0x29c6aa){return client[_0x9d1e('0x1')](_0x9d1e('0x2'),{'body':_0x29c6aa,'log':_0x9d1e('0x2')});};exports[_0x9d1e('0x3')]=function(_0x42017b,_0x5655e8,_0x411c01){return client[_0x9d1e('0x1')](_0x9d1e('0x4'),{'body':_0x42017b,'options':{'where':{'uniqueid':_0x5655e8,'interface':_0x411c01,'agentcomplete':!![]}},'log':_0x9d1e('0x4')});}; \ No newline at end of file +var _0x8ac0=['Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport','create'];(function(_0x2f8c35,_0x2ba517){var _0x696663=function(_0x1e9b18){while(--_0x1e9b18){_0x2f8c35['push'](_0x2f8c35['shift']());}};_0x696663(++_0x2ba517);}(_0x8ac0,0xd6));var _0x08ac=function(_0x44b1ed,_0x4ac692){_0x44b1ed=_0x44b1ed-0x0;var _0x262beb=_0x8ac0[_0x44b1ed];return _0x262beb;};'use strict';var client=require('../client');exports[_0x08ac('0x0')]=function(_0x319692){return client[_0x08ac('0x1')]('CreateVoiceAgentReport',{'body':_0x319692,'log':_0x08ac('0x2')});};exports[_0x08ac('0x3')]=function(_0x51870d,_0x76fcc6,_0x2e9662){return client[_0x08ac('0x1')](_0x08ac('0x4'),{'body':_0x51870d,'options':{'where':{'uniqueid':_0x76fcc6,'interface':_0x2e9662,'agentcomplete':!![]}},'log':_0x08ac('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index aac8217..d56bff0 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 _0x21a8=['format','YYYY-MM-DD\x20HH:mm:ss','type','duration','moment','lodash','../client','create','CreateVoiceCallReport','merge','context','getVoiceCallReports','Request','GetVoiceCallReport','outbound','startOf','day'];(function(_0x10ad4e,_0x5003e3){var _0x181ec8=function(_0x5a5ba2){while(--_0x5a5ba2){_0x10ad4e['push'](_0x10ad4e['shift']());}};_0x181ec8(++_0x5003e3);}(_0x21a8,0x18b));var _0x821a=function(_0x2e194f,_0x30fa15){_0x2e194f=_0x2e194f-0x0;var _0x4c50f4=_0x21a8[_0x2e194f];return _0x4c50f4;};'use strict';var moment=require(_0x821a('0x0'));var util=require('util');var _=require(_0x821a('0x1'));var client=require(_0x821a('0x2'));exports[_0x821a('0x3')]=function(_0x1d0942){return client['Request'](_0x821a('0x4'),{'body':_[_0x821a('0x5')](_0x1d0942,{'source':_0x1d0942['calleridnum'],'destinationcontext':_0x1d0942[_0x821a('0x6')],'callerid':_0x1d0942['callerid'],'amaflags':'DOCUMENTATION'}),'log':'CreateVoiceCallReport'});};exports[_0x821a('0x7')]=function(){return function(){return client[_0x821a('0x8')](_0x821a('0x9'),{'options':{'where':{'type':[_0x821a('0xa')],'createdAt':{'$between':[moment()[_0x821a('0xb')](_0x821a('0xc'))[_0x821a('0xd')](_0x821a('0xe')),moment()['endOf'](_0x821a('0xc'))[_0x821a('0xd')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0x821a('0xf'),'disposition',_0x821a('0x10'),'billableseconds']},'log':'GetVoiceCallReports'});};}; \ No newline at end of file +var _0xadf3=['callerid','DOCUMENTATION','getVoiceCallReports','Request','GetVoiceCallReport','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','type','disposition','duration','billableseconds','GetVoiceCallReports','moment','util','lodash','../client','create','CreateVoiceCallReport','calleridnum'];(function(_0x1da7a7,_0x360d47){var _0x454ba0=function(_0xc4d7d){while(--_0xc4d7d){_0x1da7a7['push'](_0x1da7a7['shift']());}};_0x454ba0(++_0x360d47);}(_0xadf3,0x7d));var _0x3adf=function(_0x533192,_0x29d937){_0x533192=_0x533192-0x0;var _0x37ced8=_0xadf3[_0x533192];return _0x37ced8;};'use strict';var moment=require(_0x3adf('0x0'));var util=require(_0x3adf('0x1'));var _=require(_0x3adf('0x2'));var client=require(_0x3adf('0x3'));exports[_0x3adf('0x4')]=function(_0xab4657){return client['Request'](_0x3adf('0x5'),{'body':_['merge'](_0xab4657,{'source':_0xab4657[_0x3adf('0x6')],'destinationcontext':_0xab4657['context'],'callerid':_0xab4657[_0x3adf('0x7')],'amaflags':_0x3adf('0x8')}),'log':_0x3adf('0x5')});};exports[_0x3adf('0x9')]=function(){return function(){return client[_0x3adf('0xa')](_0x3adf('0xb'),{'options':{'where':{'type':[_0x3adf('0xc')],'createdAt':{'$between':[moment()[_0x3adf('0xd')](_0x3adf('0xe'))[_0x3adf('0xf')](_0x3adf('0x10')),moment()['endOf']('day')['format'](_0x3adf('0x10'))]}},'attributes':[_0x3adf('0x11'),_0x3adf('0x12'),_0x3adf('0x13'),_0x3adf('0x14')]},'log':_0x3adf('0x15')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index f79bda3..1c484d6 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 _0x2b17=['CreateVoiceDialReport','../client','create'];(function(_0x39d544,_0x35c14f){var _0x5a5ff2=function(_0x2271fb){while(--_0x2271fb){_0x39d544['push'](_0x39d544['shift']());}};_0x5a5ff2(++_0x35c14f);}(_0x2b17,0xd9));var _0x72b1=function(_0x1438ce,_0x26c0e3){_0x1438ce=_0x1438ce-0x0;var _0x5737ed=_0x2b17[_0x1438ce];return _0x5737ed;};'use strict';var client=require(_0x72b1('0x0'));exports[_0x72b1('0x1')]=function(_0x10cce9){return client['Request'](_0x72b1('0x2'),{'body':_0x10cce9,'log':'CreateVoiceDialReport'});}; \ No newline at end of file +var _0x10ee=['../client','create','CreateVoiceDialReport'];(function(_0x217c2e,_0x358f06){var _0x22b7d8=function(_0x111c48){while(--_0x111c48){_0x217c2e['push'](_0x217c2e['shift']());}};_0x22b7d8(++_0x358f06);}(_0x10ee,0x1f2));var _0xe10e=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x10ee[_0x4a53d];return _0x27410e;};'use strict';var client=require(_0xe10e('0x0'));exports[_0xe10e('0x1')]=function(_0xb74d0){return client['Request']('CreateVoiceDialReport',{'body':_0xb74d0,'log':_0xe10e('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index aa2cbd4..d63b15c 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 _0xadcc=['GetVoiceExtension','exten','recordingFormat','getVoiceExtensions','../client','Request'];(function(_0x1a3ca2,_0xe144e7){var _0x30ea08=function(_0x37a9f6){while(--_0x37a9f6){_0x1a3ca2['push'](_0x1a3ca2['shift']());}};_0x30ea08(++_0xe144e7);}(_0xadcc,0x76));var _0xcadc=function(_0x448d25,_0x1c8061){_0x448d25=_0x448d25-0x0;var _0xed8fdf=_0xadcc[_0x448d25];return _0xed8fdf;};'use strict';var client=require(_0xcadc('0x0'));exports['getVoiceExtensions']=function(){return function(){return client[_0xcadc('0x1')](_0xcadc('0x2'),{'options':{'raw':!![],'attributes':['id',_0xcadc('0x3'),_0xcadc('0x4')],'where':{'VoiceExtensionId':null}},'log':_0xcadc('0x5')});};}; \ No newline at end of file +var _0x91a7=['Request','GetVoiceExtension','recordingFormat','getVoiceExtensions'];(function(_0x358bd3,_0x592019){var _0x3b1f46=function(_0x3ff32a){while(--_0x3ff32a){_0x358bd3['push'](_0x358bd3['shift']());}};_0x3b1f46(++_0x592019);}(_0x91a7,0xe7));var _0x791a=function(_0x22dc7b,_0x1883d5){_0x22dc7b=_0x22dc7b-0x0;var _0x32570e=_0x91a7[_0x22dc7b];return _0x32570e;};'use strict';var client=require('../client');exports[_0x791a('0x0')]=function(){return function(){return client[_0x791a('0x1')](_0x791a('0x2'),{'options':{'raw':!![],'attributes':['id','exten',_0x791a('0x3')],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index a52e4f6..d4e1ca8 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 _0xfbf9=['Trunk','name','callerid','active','Interval','Intervals','interval','getVoiceQueues','Request','acw','acwTimeout','autopause','monitor_format','type','dialMethod','dialLimitChannel','dialPowerLevel','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialCutDigit','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','callAdditionalPhoneAfterMin'];(function(_0x353ea8,_0x86799d){var _0x1a555a=function(_0x5b0b00){while(--_0x5b0b00){_0x353ea8['push'](_0x353ea8['shift']());}};_0x1a555a(++_0x86799d);}(_0xfbf9,0x138));var _0x9fbf=function(_0x1b925b,_0x1ab3c9){_0x1b925b=_0x1b925b-0x0;var _0x275f07=_0xfbf9[_0x1b925b];return _0x275f07;};'use strict';var client=require('../client');exports[_0x9fbf('0x0')]=function(){return function(){return client[_0x9fbf('0x1')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id','name',_0x9fbf('0x2'),_0x9fbf('0x3'),_0x9fbf('0x4'),_0x9fbf('0x5'),_0x9fbf('0x6'),'dialActive',_0x9fbf('0x7'),_0x9fbf('0x8'),'dialLimitQueue',_0x9fbf('0x9'),'dialPredictiveOptimization',_0x9fbf('0xa'),_0x9fbf('0xb'),_0x9fbf('0xc'),_0x9fbf('0xd'),_0x9fbf('0xe'),_0x9fbf('0xf'),_0x9fbf('0x10'),_0x9fbf('0x11'),'dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry',_0x9fbf('0x12'),_0x9fbf('0x13'),'dialNoAnswerRetryFrequency',_0x9fbf('0x14'),_0x9fbf('0x15'),_0x9fbf('0x16'),'dialPrefix',_0x9fbf('0x17'),_0x9fbf('0x18'),_0x9fbf('0x19'),_0x9fbf('0x1a'),'dialAMDAfterGreetingSilence',_0x9fbf('0x1b'),_0x9fbf('0x1c'),'dialAMDBetweenWordsSilence',_0x9fbf('0x1d'),_0x9fbf('0x1e'),_0x9fbf('0x1f'),_0x9fbf('0x20'),_0x9fbf('0x21'),_0x9fbf('0x22'),_0x9fbf('0x23'),_0x9fbf('0x24'),_0x9fbf('0x25'),_0x9fbf('0x26'),_0x9fbf('0x5'),_0x9fbf('0x27'),'dialRandomLastDigitCallerIdNumber',_0x9fbf('0x28'),_0x9fbf('0x29'),'dialNoSuchNumberRetryFrequency',_0x9fbf('0x2a'),_0x9fbf('0x2b'),'dialAbandonedMaxRetry',_0x9fbf('0x2c'),_0x9fbf('0x2d'),_0x9fbf('0x2e'),_0x9fbf('0x2f'),_0x9fbf('0x30'),'mandatoryDisposition',_0x9fbf('0x31'),_0x9fbf('0x32'),_0x9fbf('0x33'),_0x9fbf('0x34'),_0x9fbf('0x35')],'include':[{'model':'Trunk','as':_0x9fbf('0x36'),'attributes':['id',_0x9fbf('0x37'),_0x9fbf('0x38'),_0x9fbf('0x39')]},{'model':'Pause','as':'mandatoryDispositionPause','attributes':['id',_0x9fbf('0x37')]},{'model':_0x9fbf('0x36'),'as':'TrunkBackup','attributes':['id',_0x9fbf('0x37'),_0x9fbf('0x38'),_0x9fbf('0x39')]},{'model':_0x9fbf('0x3a'),'as':_0x9fbf('0x3a'),'attributes':['id',_0x9fbf('0x37')],'include':[{'model':_0x9fbf('0x3a'),'as':_0x9fbf('0x3b'),'attributes':['id',_0x9fbf('0x37'),_0x9fbf('0x3c')]}]}]},'log':_0x9fbf('0x0')});};}; \ No newline at end of file +var _0x0b28=['dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialCheckDuplicateType','dialAMDActive','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','callAdditionalPhoneAfterMin','Trunk','callerid','active','Pause','mandatoryDispositionPause','Interval','Intervals','interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','autopause','monitor_format','type','dialActive','dialLimitChannel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialQueueOptions'];(function(_0x178e71,_0x5c6c7d){var _0x3eec6c=function(_0x406d3f){while(--_0x406d3f){_0x178e71['push'](_0x178e71['shift']());}};_0x3eec6c(++_0x5c6c7d);}(_0x0b28,0x67));var _0x80b2=function(_0xbeb808,_0x881ddf){_0xbeb808=_0xbeb808-0x0;var _0x5d6909=_0x0b28[_0xbeb808];return _0x5d6909;};'use strict';var client=require(_0x80b2('0x0'));exports[_0x80b2('0x1')]=function(){return function(){return client[_0x80b2('0x2')](_0x80b2('0x3'),{'options':{'raw':![],'attributes':['id',_0x80b2('0x4'),_0x80b2('0x5'),'acwTimeout',_0x80b2('0x6'),_0x80b2('0x7'),_0x80b2('0x8'),_0x80b2('0x9'),'dialMethod',_0x80b2('0xa'),'dialLimitQueue','dialPowerLevel',_0x80b2('0xb'),_0x80b2('0xc'),_0x80b2('0xd'),_0x80b2('0xe'),_0x80b2('0xf'),'dialOriginateTimeout',_0x80b2('0x10'),_0x80b2('0x11'),_0x80b2('0x12'),_0x80b2('0x13'),_0x80b2('0x14'),_0x80b2('0x15'),_0x80b2('0x16'),_0x80b2('0x17'),_0x80b2('0x18'),_0x80b2('0x19'),'dialTimezone','dialGlobalInterval','dialPrefix',_0x80b2('0x1a'),_0x80b2('0x1b'),'dialAMDInitialSilence','dialAMDGreeting',_0x80b2('0x1c'),'dialAMDTotalAnalysisTime',_0x80b2('0x1d'),'dialAMDBetweenWordsSilence',_0x80b2('0x1e'),_0x80b2('0x1f'),_0x80b2('0x20'),_0x80b2('0x21'),_0x80b2('0x22'),_0x80b2('0x23'),'dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','monitor_format','strategy',_0x80b2('0x24'),_0x80b2('0x25'),_0x80b2('0x26'),_0x80b2('0x27'),_0x80b2('0x28'),_0x80b2('0x29'),'dialAbandonedMaxRetry',_0x80b2('0x2a'),_0x80b2('0x2b'),_0x80b2('0x2c'),_0x80b2('0x2d'),'dialAgentRejectRetryFrequency',_0x80b2('0x2e'),_0x80b2('0x2f'),_0x80b2('0x30'),_0x80b2('0x31'),_0x80b2('0x32'),_0x80b2('0x33')],'include':[{'model':_0x80b2('0x34'),'as':_0x80b2('0x34'),'attributes':['id',_0x80b2('0x4'),_0x80b2('0x35'),_0x80b2('0x36')]},{'model':_0x80b2('0x37'),'as':_0x80b2('0x38'),'attributes':['id',_0x80b2('0x4')]},{'model':_0x80b2('0x34'),'as':'TrunkBackup','attributes':['id',_0x80b2('0x4'),_0x80b2('0x35'),_0x80b2('0x36')]},{'model':_0x80b2('0x39'),'as':_0x80b2('0x39'),'attributes':['id',_0x80b2('0x4')],'include':[{'model':'Interval','as':_0x80b2('0x3a'),'attributes':['id',_0x80b2('0x4'),_0x80b2('0x3b')]}]}]},'log':_0x80b2('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 903f3be..9a07571 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(_0x29e879,_0x39f8e5){var _0x22a6c7=function(_0x3e512f){while(--_0x3e512f){_0x29e879['push'](_0x29e879['shift']());}};_0x22a6c7(++_0x39f8e5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'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(_0x2db746,_0x19ad53){var _0x47fe9b=function(_0x57ac5d){while(--_0x57ac5d){_0x2db746['push'](_0x2db746['shift']());}};_0x47fe9b(++_0x19ad53);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'use strict';var moment=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var client=require(_0x0a9e('0x2'));exports['create']=function(_0x550fbc){return client[_0x0a9e('0x3')]('CreateVoiceQueueReport',{'body':_0x550fbc,'log':_0x0a9e('0x4')});};exports[_0x0a9e('0x5')]=function(){return function(){return client[_0x0a9e('0x3')](_0x0a9e('0x6'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x0a9e('0x7')]('day')[_0x0a9e('0x8')](_0x0a9e('0x9')),moment()[_0x0a9e('0xa')]('day')['format'](_0x0a9e('0x9'))]}},'attributes':['uniqueid','queue',_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe'),_0x0a9e('0xf'),_0x0a9e('0x10'),'queuecallerabandon','queuecallerabandonAt']},'log':'GetVoiceQueueReports'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index 1f43401..de6b7c2 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 _0xdd0b=['Request','GetVoiceQueueRtPauses','../client','getVoiceQueueRtPauses'];(function(_0x469ac7,_0x38e416){var _0x22f3b0=function(_0x1a1447){while(--_0x1a1447){_0x469ac7['push'](_0x469ac7['shift']());}};_0x22f3b0(++_0x38e416);}(_0xdd0b,0x66));var _0xbdd0=function(_0x49e750,_0x245940){_0x49e750=_0x49e750-0x0;var _0x3046bc=_0xdd0b[_0x49e750];return _0x3046bc;};'use strict';var client=require(_0xbdd0('0x0'));exports[_0xbdd0('0x1')]=function(_0x2713fa){return function(){return client[_0xbdd0('0x2')](_0xbdd0('0x3'),{'options':{'where':{'VoiceQueueId':_0x2713fa,'paused':!![]},'raw':!![]},'log':_0xbdd0('0x1')});};}; \ No newline at end of file +var _0xa8ab=['getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses'];(function(_0x4dc6f0,_0x5528ed){var _0x38f127=function(_0x416719){while(--_0x416719){_0x4dc6f0['push'](_0x4dc6f0['shift']());}};_0x38f127(++_0x5528ed);}(_0xa8ab,0x1da));var _0xba8a=function(_0xc78a71,_0x24685a){_0xc78a71=_0xc78a71-0x0;var _0x4ca46e=_0xa8ab[_0xc78a71];return _0x4ca46e;};'use strict';var client=require('../client');exports[_0xba8a('0x0')]=function(_0xb274d7){return function(){return client[_0xba8a('0x1')](_0xba8a('0x2'),{'options':{'where':{'VoiceQueueId':_0xb274d7,'paused':!![]},'raw':!![]},'log':_0xba8a('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 1866edc..2f7e5f3 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(_0x1ad459,_0x1eafd9){var _0x3882ad=function(_0x1ba1e2){while(--_0x1ba1e2){_0x1ad459['push'](_0x1ad459['shift']());}};_0x3882ad(++_0x1eafd9);}(_0x7a54,0x106));var _0x47a5=function(_0x3b104e,_0x5513fb){_0x3b104e=_0x3b104e-0x0;var _0xa83cda=_0x7a54[_0x3b104e];return _0xa83cda;};'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(_0x4f7606,_0x289408){var _0x25f4ad=function(_0x4a712d){while(--_0x4a712d){_0x4f7606['push'](_0x4f7606['shift']());}};_0x25f4ad(++_0x289408);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'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 45d6d19..b3dd699 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 _0xa7e3=['transfereeexten','transfereelinkedid','context','extension','result','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','isexternal','origtransferercontext','attended','../client','Request','CreateVoiceTransferReport','transfererchannel','transfererconnectedlinenum','transfereraccountcode','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinename'];(function(_0x5c9066,_0x2653e6){var _0x4b87f5=function(_0x567ed0){while(--_0x567ed0){_0x5c9066['push'](_0x5c9066['shift']());}};_0x4b87f5(++_0x2653e6);}(_0xa7e3,0xce));var _0x3a7e=function(_0x11e080,_0x2110f7){_0x11e080=_0x11e080-0x0;var _0x3a18e1=_0xa7e3[_0x11e080];return _0x3a18e1;};'use strict';var client=require(_0x3a7e('0x0'));exports['transfers']={};exports['blindTransfer']=function(_0x5135ab){return client[_0x3a7e('0x1')](_0x3a7e('0x2'),{'body':{'result':_0x5135ab['result'],'transfererchannel':_0x5135ab[_0x3a7e('0x3')],'transferercalleridnum':_0x5135ab['transferercalleridnum'],'transferercalleridname':_0x5135ab['transferercalleridname'],'transfererconnectedlinenum':_0x5135ab[_0x3a7e('0x4')],'transfererconnectedlinename':_0x5135ab['transfererconnectedlinename'],'transfereraccountcode':_0x5135ab[_0x3a7e('0x5')],'transferercontext':_0x5135ab['transferercontext'],'transfererexten':_0x5135ab['transfererexten'],'transfererlinkedid':_0x5135ab[_0x3a7e('0x6')],'transfereechannel':_0x5135ab[_0x3a7e('0x7')],'transfereecalleridnum':_0x5135ab[_0x3a7e('0x8')],'transfereecalleridname':_0x5135ab[_0x3a7e('0x9')],'transfereeconnectedlinenum':_0x5135ab['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x5135ab[_0x3a7e('0xa')],'transfereeaccountcode':_0x5135ab['transfereeaccountcode'],'transfereecontext':_0x5135ab['transfereecontext'],'transfereeexten':_0x5135ab[_0x3a7e('0xb')],'transfereelinkedid':_0x5135ab[_0x3a7e('0xc')],'isexternal':_0x5135ab['isexternal'],'context':_0x5135ab[_0x3a7e('0xd')],'extension':_0x5135ab[_0x3a7e('0xe')],'type':'blind'},'log':_0x3a7e('0x2')});};exports['attendedTransfer']=function(_0x476831){return client[_0x3a7e('0x1')](_0x3a7e('0x2'),{'body':{'result':_0x476831[_0x3a7e('0xf')],'transfererchannel':_0x476831['origtransfererchannel'],'transferercalleridnum':_0x476831['origtransferercalleridnum'],'transferercalleridname':_0x476831[_0x3a7e('0x10')],'transfererconnectedlinenum':_0x476831[_0x3a7e('0x11')],'transfererconnectedlinename':_0x476831[_0x3a7e('0x12')],'transfereraccountcode':_0x476831[_0x3a7e('0x13')],'transferercontext':_0x476831['secondtransferercontext'],'transfererexten':_0x476831[_0x3a7e('0x14')],'transfererlinkedid':_0x476831['origtransfererlinkedid'],'transfereechannel':_0x476831[_0x3a7e('0x15')],'transfereecalleridnum':_0x476831[_0x3a7e('0x16')],'transfereecalleridname':_0x476831[_0x3a7e('0x17')],'transfereeconnectedlinenum':_0x476831['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x476831['transfertargetconnectedlinename'],'transfereeaccountcode':_0x476831[_0x3a7e('0x18')],'transfereecontext':_0x476831[_0x3a7e('0x19')],'transfereeexten':_0x476831[_0x3a7e('0x1a')],'transfereelinkedid':_0x476831[_0x3a7e('0x1b')],'isexternal':_0x476831[_0x3a7e('0x1c')],'context':_0x476831[_0x3a7e('0x1d')],'extension':_0x476831['origtransfererexten'],'type':_0x3a7e('0x1e')},'log':_0x3a7e('0x2')});}; \ No newline at end of file +var _0x1628=['Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','context','extension','blind','attendedTransfer','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext','transfertargetexten','origtransfererexten','attended','../client','blindTransfer'];(function(_0x5982fd,_0x3ce959){var _0x238b15=function(_0x1203b7){while(--_0x1203b7){_0x5982fd['push'](_0x5982fd['shift']());}};_0x238b15(++_0x3ce959);}(_0x1628,0x73));var _0x8162=function(_0x277107,_0x3420dc){_0x277107=_0x277107-0x0;var _0x1da046=_0x1628[_0x277107];return _0x1da046;};'use strict';var client=require(_0x8162('0x0'));exports['transfers']={};exports[_0x8162('0x1')]=function(_0x4c5c56){return client[_0x8162('0x2')](_0x8162('0x3'),{'body':{'result':_0x4c5c56[_0x8162('0x4')],'transfererchannel':_0x4c5c56[_0x8162('0x5')],'transferercalleridnum':_0x4c5c56[_0x8162('0x6')],'transferercalleridname':_0x4c5c56['transferercalleridname'],'transfererconnectedlinenum':_0x4c5c56['transfererconnectedlinenum'],'transfererconnectedlinename':_0x4c5c56[_0x8162('0x7')],'transfereraccountcode':_0x4c5c56[_0x8162('0x8')],'transferercontext':_0x4c5c56[_0x8162('0x9')],'transfererexten':_0x4c5c56['transfererexten'],'transfererlinkedid':_0x4c5c56[_0x8162('0xa')],'transfereechannel':_0x4c5c56[_0x8162('0xb')],'transfereecalleridnum':_0x4c5c56[_0x8162('0xc')],'transfereecalleridname':_0x4c5c56['transfereecalleridname'],'transfereeconnectedlinenum':_0x4c5c56[_0x8162('0xd')],'transfereeconnectedlinename':_0x4c5c56[_0x8162('0xe')],'transfereeaccountcode':_0x4c5c56[_0x8162('0xf')],'transfereecontext':_0x4c5c56[_0x8162('0x10')],'transfereeexten':_0x4c5c56[_0x8162('0x11')],'transfereelinkedid':_0x4c5c56['transfereelinkedid'],'isexternal':_0x4c5c56['isexternal'],'context':_0x4c5c56[_0x8162('0x12')],'extension':_0x4c5c56[_0x8162('0x13')],'type':_0x8162('0x14')},'log':_0x8162('0x3')});};exports[_0x8162('0x15')]=function(_0x53493b){return client[_0x8162('0x2')](_0x8162('0x3'),{'body':{'result':_0x53493b[_0x8162('0x4')],'transfererchannel':_0x53493b[_0x8162('0x16')],'transferercalleridnum':_0x53493b[_0x8162('0x17')],'transferercalleridname':_0x53493b[_0x8162('0x18')],'transfererconnectedlinenum':_0x53493b[_0x8162('0x19')],'transfererconnectedlinename':_0x53493b['secondtransfererconnectedlinename'],'transfereraccountcode':_0x53493b[_0x8162('0x1a')],'transferercontext':_0x53493b[_0x8162('0x1b')],'transfererexten':_0x53493b[_0x8162('0x1c')],'transfererlinkedid':_0x53493b[_0x8162('0x1d')],'transfereechannel':_0x53493b[_0x8162('0x1e')],'transfereecalleridnum':_0x53493b[_0x8162('0x1f')],'transfereecalleridname':_0x53493b[_0x8162('0x20')],'transfereeconnectedlinenum':_0x53493b[_0x8162('0x21')],'transfereeconnectedlinename':_0x53493b[_0x8162('0x22')],'transfereeaccountcode':_0x53493b['transfertargetaccountcode'],'transfereecontext':_0x53493b[_0x8162('0x23')],'transfereeexten':_0x53493b[_0x8162('0x24')],'transfereelinkedid':_0x53493b['transfertargetlinkedid'],'isexternal':_0x53493b['isexternal'],'context':_0x53493b['origtransferercontext'],'extension':_0x53493b[_0x8162('0x25')],'type':_0x8162('0x26')},'log':_0x8162('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 929dac3..67c8da2 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 _0xafb9=['then','catch','error','message','isConnected','command','Command','voiceQueues','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','type','unmanaged','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangBusyFactor','startPredictive','startProgressive','Trunk','callerid','Interval','push','find','undefined','values','channels','length','voicechannel','map','uniqueid','channel','%s.%s','filename','wav','ai(mixmonitorid)','isNil','toLowerCase','YYYY-MM-DD\x20HH:mm:ss','rec','mixmonitorid','status','resolve','StopMixMonitor','destinationchannel','stop','monitors','StopMixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','queueChannels','voicequeuechannel','Hangup','voicequeuechannelredirect','exten','context','telephones','trunks','outboundChannels','campaigns','event','Event\x20name\x20mandatory','custom:','send','checkAfterSend','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','jayson/promise','validate','bluebird','moment','../../../config/environment','../properties','../ami','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','QueuePause','asterisk','username','ami\x20disconnected','join','pick','keys','action','Reload','Action'];(function(_0xa85339,_0x580aa0){var _0x5bcb2e=function(_0x539aa2){while(--_0x539aa2){_0xa85339['push'](_0xa85339['shift']());}};_0x5bcb2e(++_0x580aa0);}(_0xafb9,0x68));var _0x9afb=function(_0x32fd50,_0x31814c){_0x32fd50=_0x32fd50-0x0;var _0x41d787=_0xafb9[_0x32fd50];return _0x41d787;};'use strict';var _=require(_0x9afb('0x0'));var util=require(_0x9afb('0x1'));var jayson=require(_0x9afb('0x2'));var schema=require(_0x9afb('0x3'));var BPromise=require(_0x9afb('0x4'));var moment=require(_0x9afb('0x5'));var config=require(_0x9afb('0x6'));var properties=require(_0x9afb('0x7'));var ami=require(_0x9afb('0x8'));exports['listen']=function(_0x498463,_0x91ffa0,_0x56a139){return new BPromise(function(_0x1ccf93,_0x548b24){var _0x556880={'QueuePause':function(_0x4c0e9d){return new Promise(function(_0x1edf77,_0x20b8c1){var _0x51dc88=util[_0x9afb('0x9')](_0x9afb('0xa'),_0x9afb('0xb'),_0x4c0e9d[_0x9afb('0xc')]);if(_0x498463[_0x9afb('0xd')]&&_0x498463['timers'][_0x51dc88]&&_0x498463['timers'][_0x51dc88][_0x9afb('0xe')]){_0x498463[_0x9afb('0xd')][_0x51dc88][_0x9afb('0xf')]();}if(_0x498463[_0x9afb('0x10')][_0x51dc88]){_0x498463[_0x9afb('0x10')][_0x51dc88][_0x9afb('0x11')]({'statePause':_0x4c0e9d[_0x9afb('0x12')]?!![]:![]});}_0x1edf77({'code':0xc8,'message':_0x9afb('0x13')});});},'Reload':function(_0x464462){var _0x10602b=this;return new Promise(function(_0x47a804,_0x27137c){if(ami['isConnected']()==![]){return _0x27137c(_0x10602b['error'](0x1f4,[config[_0x9afb('0x14')]['ip'],config[_0x9afb('0x14')][_0x9afb('0x15')],_0x9afb('0x16')][_0x9afb('0x17')]('\x20')));}_0x464462=_[_0x9afb('0x18')](_0x464462,_[_0x9afb('0x19')](properties['module']));_0x464462[_0x9afb('0x1a')]=_0x9afb('0x1b');return ami[_0x9afb('0x1c')](_0x464462)[_0x9afb('0x1d')](function(_0x223aef){_0x47a804({'code':0xc8,'message':_0x223aef['message']});})[_0x9afb('0x1e')](function(_0x50a7e4){_0x27137c(_0x10602b[_0x9afb('0x1f')](0x1f5,_0x50a7e4[_0x9afb('0x20')]));});});},'Command':function(_0x4a856b){var _0x4a1c74=this;return new Promise(function(_0x3ac42f,_0x1217d9){if(ami[_0x9afb('0x21')]()==![]){return _0x1217d9(_0x4a1c74[_0x9afb('0x1f')](0x1f4,[config[_0x9afb('0x14')]['ip'],config['asterisk'][_0x9afb('0x15')],'ami\x20disconnected']['join']('\x20')));}_0x4a856b=_[_0x9afb('0x18')](_0x4a856b,_0x9afb('0x22'));_0x4a856b[_0x9afb('0x1a')]=_0x9afb('0x23');return ami['Action'](_0x4a856b)[_0x9afb('0x1d')](function(_0x725a04){_0x3ac42f({'code':0xc8,'message':_0x725a04['content']});})['catch'](function(_0x5b5dab){_0x1217d9(_0x4a1c74[_0x9afb('0x1f')](0x1f5,_0x5b5dab['message']));});});},'VoiceQueues':function(_0x387379){return new Promise(function(_0x123510,_0x50a919){var _0x324293=[];for(var _0x28beba in _0x498463[_0x9afb('0x24')]){if(_0x498463[_0x9afb('0x24')]['hasOwnProperty'](_0x28beba)){var _0x348255=_0x498463['voiceQueues'][_0x28beba];var _0x29e092={'id':_0x348255['id'],'name':_0x348255['name'],'strategy':_0x348255['strategy'],'answered':_0x348255[_0x9afb('0x25')],'available':_0x348255[_0x9afb('0x26')],'loggedIn':_0x348255[_0x9afb('0x27')],'pTalking':_0x348255[_0x9afb('0x28')],'sumBillable':_0x348255[_0x9afb('0x29')],'sumDuration':_0x348255[_0x9afb('0x2a')],'sumHoldTime':_0x348255[_0x9afb('0x2b')]||0x0,'talking':_0x348255['talking'],'total':_0x348255['total'],'type':_0x348255[_0x9afb('0x2c')],'unmanaged':_0x348255[_0x9afb('0x2d')],'abandoned':_0x348255['abandoned'],'waiting':_0x348255[_0x9afb('0x2e')],'loggedInDb':_0x348255[_0x9afb('0x2f')]};if(_0x348255['type']===_0x9afb('0x30')){_0x29e092[_0x9afb('0x31')]=_0x348255[_0x9afb('0x31')];_0x29e092[_0x9afb('0x32')]=_0x348255[_0x9afb('0x32')];_0x29e092[_0x9afb('0x33')]=_0x348255[_0x9afb('0x33')];_0x29e092[_0x9afb('0x34')]=_0x348255['dialOriginateCallerIdNumber'];_0x29e092['dialOriginateTimeout']=_0x348255[_0x9afb('0x35')];_0x29e092[_0x9afb('0x36')]=_0x348255[_0x9afb('0x36')];_0x29e092[_0x9afb('0x37')]=_0x348255[_0x9afb('0x37')];_0x29e092[_0x9afb('0x38')]=_0x348255[_0x9afb('0x38')];_0x29e092['outboundAnswerCallsDay']=_0x348255['outboundAnswerCallsDay'];_0x29e092[_0x9afb('0x39')]=_0x348255[_0x9afb('0x39')];_0x29e092['outboundBusyCallsDay']=_0x348255[_0x9afb('0x3a')];_0x29e092['outboundCongestionCallsDay']=_0x348255[_0x9afb('0x3b')];_0x29e092[_0x9afb('0x3c')]=_0x348255['outboundDropCallsDayACS'];_0x29e092[_0x9afb('0x3d')]=_0x348255['outboundDropCallsDayCallersExit'];_0x29e092[_0x9afb('0x3e')]=_0x348255[_0x9afb('0x3e')];_0x29e092[_0x9afb('0x3f')]=_0x348255[_0x9afb('0x3f')];_0x29e092[_0x9afb('0x40')]=_0x348255[_0x9afb('0x40')];_0x29e092[_0x9afb('0x41')]=_0x348255[_0x9afb('0x41')];_0x29e092['outboundReCallsDay']=_0x348255[_0x9afb('0x42')];_0x29e092['outboundRejectCallsDay']=_0x348255[_0x9afb('0x43')];_0x29e092[_0x9afb('0x44')]=_0x348255[_0x9afb('0x44')];_0x29e092[_0x9afb('0x45')]=_0x348255[_0x9afb('0x45')];_0x29e092[_0x9afb('0x46')]=_0x348255[_0x9afb('0x46')];_0x29e092[_0x9afb('0x47')]=_0x348255[_0x9afb('0x47')];_0x29e092['predictiveIntervalDroppedCallsCallersExit']=_0x348255[_0x9afb('0x48')];_0x29e092['predictiveIntervalDroppedCallsTimeout']=_0x348255[_0x9afb('0x49')];_0x29e092[_0x9afb('0x4a')]=_0x348255[_0x9afb('0x4a')];_0x29e092['predictiveIntervalErlangCallsDroppedCalls']=_0x348255[_0x9afb('0x4b')];_0x29e092[_0x9afb('0x4c')]=_0x348255[_0x9afb('0x4c')];_0x29e092[_0x9afb('0x4d')]=_0x348255[_0x9afb('0x4d')];_0x29e092[_0x9afb('0x4e')]=_0x348255[_0x9afb('0x4e')];_0x29e092['predictiveIntervalAvailable']=_0x348255[_0x9afb('0x4f')];_0x29e092[_0x9afb('0x50')]=_0x348255[_0x9afb('0x50')];_0x29e092[_0x9afb('0x20')]=_0x348255[_0x9afb('0x20')];_0x29e092[_0x9afb('0x51')]=_0x348255[_0x9afb('0x51')];_0x29e092[_0x9afb('0x52')]=_0x348255['erlangCalls'];_0x29e092[_0x9afb('0x53')]=_0x348255['erlangCallToSecond'];_0x29e092['erlangAbandonmentRate']=_0x348255['erlangAbandonmentRate'];_0x29e092[_0x9afb('0x54')]=_0x348255[_0x9afb('0x54')];_0x29e092['startPredictive']=_0x348255[_0x9afb('0x55')];_0x29e092[_0x9afb('0x56')]=_0x348255[_0x9afb('0x56')];}if(_0x348255[_0x9afb('0x57')]){_0x29e092[_0x9afb('0x57')]={'id':_0x348255[_0x9afb('0x57')]['id'],'name':_0x348255[_0x9afb('0x57')][_0x9afb('0xc')],'active':_0x348255[_0x9afb('0x57')]['active'],'callerid':_0x348255[_0x9afb('0x57')][_0x9afb('0x58')]};}if(_0x348255[_0x9afb('0x59')]){_0x29e092[_0x9afb('0x59')]={'id':_0x348255['Interval']['id'],'name':_0x348255[_0x9afb('0x59')][_0x9afb('0xc')]};}_0x324293[_0x9afb('0x5a')](_0x29e092);}}_0x123510({'count':_0x324293['length'],'rows':_0x324293});});},'UpdateVoiceQueue':function(_0x24f76c){return new Promise(function(_0x1d79b1,_0x13179d){var _0x12eddf=_[_0x9afb('0x5b')](_0x498463[_0x9afb('0x24')],{'id':parseInt(_0x24f76c['id'])});var _0x21ce09=_['omit'](_0x24f76c,['id']);if(_0x12eddf){for(var _0x5a36e4 in _0x21ce09){if(typeof _0x21ce09[_0x5a36e4]!=='undefined'&&typeof _0x12eddf[_0x5a36e4]!==_0x9afb('0x5c')){_0x12eddf[_0x5a36e4]=_0x21ce09[_0x5a36e4];}}_0x1d79b1(_0x12eddf);}else{_0x13179d();}});},'VoiceChannels':function(_0x29cde4){return new Promise(function(_0x5a1507,_0x20bd33){var _0xdcfefd=_[_0x9afb('0x5d')](_0x498463[_0x9afb('0x5e')]);_0x5a1507({'count':_0xdcfefd[_0x9afb('0x5f')],'rows':_0xdcfefd});});},'VoiceChannelMixMonitor':function(_0x122a35){var _0xdb82c3=this;return new Promise(function(_0x1de5cf,_0x20abe4){if(ami[_0x9afb('0x21')]()==![]){return _0x20abe4(_0xdb82c3[_0x9afb('0x1f')](0x1f4,[config['asterisk']['ip'],config['asterisk'][_0x9afb('0x15')],'ami\x20disconnected'][_0x9afb('0x17')]('\x20')));}var _0xd41258=schema(properties[_0x9afb('0x60')])[_0x9afb('0x3')](_0x122a35);if(_0xd41258[_0x9afb('0x5f')]>0x0){return _0x20abe4(_0xdb82c3['error'](0x1f4,_[_0x9afb('0x61')](_0xd41258,'message')[_0x9afb('0x17')](',\x20')));}var _0x222ee0=_[_0x9afb('0x5b')](_0x498463[_0x9afb('0x5e')],{'uniqueid':_0x122a35[_0x9afb('0x62')]});if(_0x222ee0&&_0x222ee0[_0x9afb('0x63')]){var _0x449a7e=util['format'](_0x9afb('0x64'),_0x122a35[_0x9afb('0x65')]||_0x122a35[_0x9afb('0x62')],_0x122a35['format']||_0x9afb('0x66'));return ami[_0x9afb('0x1c')]({'action':'MixMonitor','channel':_0x222ee0[_0x9afb('0x63')],'file':_0x449a7e,'options':_0x9afb('0x67')})[_0x9afb('0x1d')](function(_0x5bcea5){var _0x3975c0=_[_0x9afb('0x5b')](_0x222ee0['monitors'],{'filename':'/var/spool/asterisk/monitor/'+_0x449a7e['toLowerCase']()});if(_[_0x9afb('0x68')](_0x3975c0)){_0x222ee0['monitors'][_0x9afb('0x5a')]({'filename':'/var/spool/asterisk/monitor/'+_0x449a7e[_0x9afb('0x69')](),'createdAt':moment()[_0x9afb('0x9')](_0x9afb('0x6a')),'mixmonitorid':_0x5bcea5['mixmonitorid'],'status':_0x9afb('0x6b')});}else{_0x3975c0[_0x9afb('0x6c')]=_0x5bcea5[_0x9afb('0x6c')];_0x3975c0[_0x9afb('0x6d')]=_0x9afb('0x6b');}_0x1de5cf({'code':0xc8,'message':[_0x122a35[_0x9afb('0x62')],'MixMonitor\x20Success',_0x5bcea5[_0x9afb('0x6c')]][_0x9afb('0x17')]('\x20'),'mixmonitorid':_0x5bcea5[_0x9afb('0x6c')]});})[_0x9afb('0x1e')](function(_0x54aeff){_0x20abe4(_0xdb82c3[_0x9afb('0x1f')](0x1f5,[_0x122a35[_0x9afb('0x62')],_0x54aeff['message'][_0x9afb('0x69')]()][_0x9afb('0x17')]('\x20')));});}else{return _0x20abe4(_0xdb82c3[_0x9afb('0x1f')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0x347ce8){var _0x12b44e=this;return new Promise(function(_0x158dfd,_0x41bb8e){if(ami[_0x9afb('0x21')]()==![]){return _0x41bb8e(_0x12b44e[_0x9afb('0x1f')](0x1f4,[config[_0x9afb('0x14')]['ip'],config[_0x9afb('0x14')][_0x9afb('0x15')],_0x9afb('0x16')][_0x9afb('0x17')]('\x20')));}var _0x2404aa=schema(properties[_0x9afb('0x60')])['validate'](_0x347ce8);if(_0x2404aa[_0x9afb('0x5f')]>0x0){return _0x41bb8e(_0x12b44e[_0x9afb('0x1f')](0x1f4,_['map'](_0x2404aa,_0x9afb('0x20'))[_0x9afb('0x17')](',\x20')));}var _0x597bc7=_['find'](_0x498463[_0x9afb('0x5e')],{'uniqueid':_0x347ce8[_0x9afb('0x62')]});if(_0x597bc7){return BPromise[_0x9afb('0x6e')]()[_0x9afb('0x1d')](function(){if(_0x597bc7[_0x9afb('0x63')]){return ami['Action']({'action':_0x9afb('0x6f'),'channel':_0x597bc7[_0x9afb('0x63')],'mixmonitorid':_0x347ce8[_0x9afb('0x6c')]})[_0x9afb('0x1e')](function(_0xcd741f){});}})[_0x9afb('0x1d')](function(){if(_0x597bc7[_0x9afb('0x70')]){return ami[_0x9afb('0x1c')]({'action':'StopMixMonitor','channel':_0x597bc7[_0x9afb('0x70')],'mixmonitorid':_0x347ce8['mixmonitorid']})[_0x9afb('0x1e')](function(_0x1ff543){});}})[_0x9afb('0x1d')](function(_0x22ffa){var _0x20b9d4=_['find'](_0x597bc7['monitors'],{'mixmonitorid':_0x347ce8[_0x9afb('0x6c')]});if(_0x20b9d4){_0x20b9d4[_0x9afb('0x6d')]=_0x9afb('0x71');}})[_0x9afb('0x1d')](function(){var _0x1ecbd1=util['format'](_0x9afb('0x64'),_0x347ce8[_0x9afb('0x65')]||_0x347ce8['uniqueid'],_0x347ce8[_0x9afb('0x9')]||_0x9afb('0x66'));var _0x480c4a=_[_0x9afb('0x5b')](_0x597bc7[_0x9afb('0x72')],{'filename':'/var/spool/asterisk/monitor/'+_0x1ecbd1[_0x9afb('0x69')]()});if(_0x480c4a){_0x480c4a['status']=_0x9afb('0x71');}})[_0x9afb('0x1d')](function(){_0x158dfd({'code':0xc8,'message':[_0x347ce8[_0x9afb('0x62')],_0x9afb('0x73')][_0x9afb('0x17')]('\x20')});})['catch'](function(_0x4be2a5){_0x41bb8e(_0x12b44e[_0x9afb('0x1f')](0x1f5,[_0x347ce8[_0x9afb('0x62')],_0x4be2a5[_0x9afb('0x20')]['toLowerCase']()][_0x9afb('0x17')]('\x20')));});}else{return _0x41bb8e(_0x12b44e[_0x9afb('0x1f')](0x1f5,_0x9afb('0x74')));}});},'VoiceQueuesChannels':function(_0x5357b4){return new Promise(function(_0x3c16a8,_0x1ee714){var _0x134716=_[_0x9afb('0x5d')](_0x498463[_0x9afb('0x75')]);_0x3c16a8({'count':_0x134716[_0x9afb('0x5f')],'rows':_0x134716});});},'VoiceQueuesChannel':function(_0x4f3a42){var _0x3084b3=this;return new Promise(function(_0x5b8b4a,_0x463df3){var _0x1f5a39=schema(properties[_0x9afb('0x76')])['validate'](_0x4f3a42);if(_0x1f5a39[_0x9afb('0x5f')]>0x0){return _0x463df3(_0x3084b3['error'](0x1f4,_[_0x9afb('0x61')](_0x1f5a39,_0x9afb('0x20'))['join'](',\x20')));}var _0x1a43bf=_[_0x9afb('0x5b')](_0x498463[_0x9afb('0x75')],{'uniqueid':_0x4f3a42[_0x9afb('0x62')]});if(_0x1a43bf){_0x5b8b4a(_0x1a43bf);}else{return _0x463df3(_0x3084b3['error'](0x1f5,_0x9afb('0x74')));}});},'VoiceQueuesChannelHangup':function(_0x2c8f29){var _0x3af5af=this;return new Promise(function(_0x1e3500,_0x1fa9cc){if(ami['isConnected']()==![]){return _0x1fa9cc(_0x3af5af[_0x9afb('0x1f')](0x1f4,[config[_0x9afb('0x14')]['ip'],config['asterisk'][_0x9afb('0x15')],_0x9afb('0x16')][_0x9afb('0x17')]('\x20')));}var _0x203e5e=schema(properties['voicequeuechannelhangup'])[_0x9afb('0x3')](_0x2c8f29);if(_0x203e5e[_0x9afb('0x5f')]>0x0){return _0x1fa9cc(_0x3af5af[_0x9afb('0x1f')](0x1f4,_[_0x9afb('0x61')](_0x203e5e,_0x9afb('0x20'))[_0x9afb('0x17')](',\x20')));}var _0x5a4596=_[_0x9afb('0x5b')](_0x498463['queueChannels'],{'uniqueid':_0x2c8f29[_0x9afb('0x62')]});if(_0x5a4596&&_0x5a4596[_0x9afb('0x63')]){return ami[_0x9afb('0x1c')]({'action':_0x9afb('0x77'),'channel':_0x5a4596[_0x9afb('0x63')]})[_0x9afb('0x1d')](function(_0x3db3bb){_0x1e3500({'code':0xc8,'message':[_0x2c8f29[_0x9afb('0x62')],_0x3db3bb['message'][_0x9afb('0x69')]()][_0x9afb('0x17')]('\x20')});})[_0x9afb('0x1e')](function(_0x34ae00){_0x1fa9cc(_0x3af5af[_0x9afb('0x1f')](0x1f5,[_0x2c8f29[_0x9afb('0x62')],_0x34ae00[_0x9afb('0x20')][_0x9afb('0x69')]()][_0x9afb('0x17')]('\x20')));});}else{return _0x1fa9cc(_0x3af5af['error'](0x1f5,_0x9afb('0x74')));}});},'VoiceQueuesChannelRedirect':function(_0x9be6f0){var _0x378462=this;return new Promise(function(_0x14a47f,_0x207180){if(ami[_0x9afb('0x21')]()==![]){return _0x207180(_0x378462['error'](0x1f4,[config[_0x9afb('0x14')]['ip'],config[_0x9afb('0x14')][_0x9afb('0x15')],_0x9afb('0x16')]['join']('\x20')));}var _0x372aed=schema(properties[_0x9afb('0x78')])[_0x9afb('0x3')](_0x9be6f0);if(_0x372aed[_0x9afb('0x5f')]>0x0){return _0x207180(_0x378462['error'](0x1f4,_[_0x9afb('0x61')](_0x372aed,'message')[_0x9afb('0x17')](',\x20')));}var _0x5d1d8e=_[_0x9afb('0x5b')](_0x498463[_0x9afb('0x75')],{'uniqueid':_0x9be6f0[_0x9afb('0x62')]});if(_0x5d1d8e&&_0x5d1d8e['channel']){return ami[_0x9afb('0x1c')]({'action':'Redirect','channel':_0x5d1d8e['channel'],'exten':_0x9be6f0[_0x9afb('0x79')],'context':_0x9be6f0['context']||_0x5d1d8e[_0x9afb('0x7a')],'priority':0x1})[_0x9afb('0x1d')](function(_0x5ce675){_0x14a47f({'code':0xc8,'message':[_0x9be6f0['uniqueid'],_0x5ce675[_0x9afb('0x20')][_0x9afb('0x69')]()]['join']('\x20')});})[_0x9afb('0x1e')](function(_0x29f1f2){_0x207180(_0x378462[_0x9afb('0x1f')](0x1f5,[_0x9be6f0['uniqueid'],_0x29f1f2['message'][_0x9afb('0x69')]()][_0x9afb('0x17')]('\x20')));});}else{return _0x207180(_0x378462[_0x9afb('0x1f')](0x1f5,_0x9afb('0x74')));}});},'Agents':function(_0x46ff4c){return new Promise(function(_0x2991d3,_0x19667d){var _0x369bfb=_[_0x9afb('0x5d')](_0x498463[_0x9afb('0x10')]);_0x2991d3({'count':_0x369bfb['length'],'rows':_0x369bfb});});},'Telephones':function(_0x3c0107){return new Promise(function(_0x14d0f5,_0x535977){var _0x29f047=_['values'](_0x498463[_0x9afb('0x7b')]);_0x14d0f5({'count':_0x29f047[_0x9afb('0x5f')],'rows':_0x29f047});});},'Trunks':function(_0x3ccba9){return new Promise(function(_0xb4a934,_0x538303){var _0x357f57=_['values'](_0x498463[_0x9afb('0x7c')]);_0xb4a934({'count':_0x357f57[_0x9afb('0x5f')],'rows':_0x357f57});});},'OutboundChannels':function(_0x267f7b){return new Promise(function(_0x9acaba,_0x2d6cf1){var _0x4e5467=_['values'](_0x498463[_0x9afb('0x7d')]);_0x9acaba({'count':_0x4e5467['length'],'rows':_0x4e5467});});},'Outbound':function(_0x3cc289){return new Promise(function(_0x2269cc,_0xa3b371){_0x2269cc(_0x498463[_0x9afb('0x30')]);});},'Campaigns':function(_0x4866bd){return new Promise(function(_0x3e5b87,_0x1222f9){var _0x3c96a2=_['values'](_0x498463[_0x9afb('0x7e')]);_0x3e5b87({'count':_0x3c96a2[_0x9afb('0x5f')],'rows':_0x3c96a2});});},'VoiceQueuesPreview':function(_0x24d635){var _0x53d995=this;return new Promise(function(_0x3ebfea,_0x44e3f7){_0x91ffa0['run'](_0x24d635['id'])['then'](function(_0x422edb){_0x3ebfea({'code':0xc8,'message':_0x422edb[_0x9afb('0x20')]});})[_0x9afb('0x1e')](function(_0x83e860){_0x44e3f7(_0x53d995['error'](0x1f4,_0x83e860[_0x9afb('0x20')]));});});},'EventManager':function(_0x120f44){var _0x24a00b=this;return new Promise(function(_0x19a30d,_0xf484b8){if(!_0x120f44[_0x9afb('0x7f')]){return _0xf484b8(_0x24a00b[_0x9afb('0x1f')](0x1f4,_0x9afb('0x80')));}ami['emit'](_0x9afb('0x81')+_0x120f44[_0x9afb('0x7f')],_0x120f44[_0x9afb('0x20')]);_0x19a30d({'code':0xc8,'message':_0x120f44});});},'FaxAccounts':function(_0x2c7a5b){return new Promise(function(_0x194263,_0x173e75){var _0x1faa74=_[_0x9afb('0x5d')](_0x498463['faxAccounts']);_0x194263({'count':_0x1faa74[_0x9afb('0x5f')],'rows':_0x1faa74});});},'SendFax':function(_0x5e5325){var _0xabe6c=this;return new Promise(function(_0x3c6761,_0x3fb617){_0x56a139[_0x9afb('0x82')](_0x5e5325)['then'](function(_0x8cabe2){_0x3c6761({'code':0xc8,'message':_0x8cabe2['message']});})[_0x9afb('0x1e')](function(_0x349fcd){_0x3fb617(_0xabe6c['error'](0x1f4,_0x349fcd[_0x9afb('0x20')]));});});},'CheckAfterSend':function(_0x1997fa){var _0x1c0150=this;return new Promise(function(_0x1cf4ed,_0x287583){_0x56a139[_0x9afb('0x83')](_0x1997fa)[_0x9afb('0x1d')](function(_0x3ba7d7){_0x1cf4ed({'code':0xc8,'message':_0x3ba7d7[_0x9afb('0x20')]});})[_0x9afb('0x1e')](function(_0x17fc1c){_0x287583(_0x1c0150[_0x9afb('0x1f')](0x1f4,_0x17fc1c[_0x9afb('0x20')]));});});}};var _0x376f63=jayson['server'](_0x556880)['http']();_0x376f63['on']('error',function(_0x23a5ad){return _0x548b24(_0x23a5ad);});_0x376f63['listen'](0x232a,'127.0.0.1',function(){console['log'](_0x9afb('0x84'),0x232a);return _0x1ccf93('RPC\x20listening\x20on\x20port:'+0x232a);});});}; \ No newline at end of file +var _0x71ab=['sumHoldTime','talking','total','type','waiting','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','name','active','Interval','push','length','find','omit','undefined','values','voicechannel','map','channels','uniqueid','channel','filename','wav','ai(mixmonitorid)','toLowerCase','isNil','monitors','YYYY-MM-DD\x20HH:mm:ss','rec','mixmonitorid','status','Channel\x20doesn\x27t\x20exist','isConnected','resolve','StopMixMonitor','destinationchannel','stop','/var/spool/asterisk/monitor/','StopMixMonitor\x20Success','queueChannels','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','context','telephones','trunks','outboundChannels','campaigns','run','event','Event\x20name\x20mandatory','custom:','faxAccounts','send','server','http','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','util','validate','moment','../../../config/environment','../properties','../ami','listen','format','%s/%s','SIP','timers','timer','agents','updateStatusRealtime','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','then','message','catch','error','command','Command','Action','content','voiceQueues','hasOwnProperty','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration'];(function(_0x40b176,_0x31c35b){var _0x4b3f61=function(_0x5c3488){while(--_0x5c3488){_0x40b176['push'](_0x40b176['shift']());}};_0x4b3f61(++_0x31c35b);}(_0x71ab,0x64));var _0xb71a=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x71ab[_0x465028];return _0xb783d4;};'use strict';var _=require('lodash');var util=require(_0xb71a('0x0'));var jayson=require('jayson/promise');var schema=require(_0xb71a('0x1'));var BPromise=require('bluebird');var moment=require(_0xb71a('0x2'));var config=require(_0xb71a('0x3'));var properties=require(_0xb71a('0x4'));var ami=require(_0xb71a('0x5'));exports[_0xb71a('0x6')]=function(_0x3c6438,_0x2192e8,_0x38d931){return new BPromise(function(_0x22c072,_0x35a84e){var _0x4358ce={'QueuePause':function(_0x2a4c86){return new Promise(function(_0x43ca14,_0x471ab6){var _0x18c7a6=util[_0xb71a('0x7')](_0xb71a('0x8'),_0xb71a('0x9'),_0x2a4c86['name']);if(_0x3c6438[_0xb71a('0xa')]&&_0x3c6438['timers'][_0x18c7a6]&&_0x3c6438[_0xb71a('0xa')][_0x18c7a6][_0xb71a('0xb')]){_0x3c6438[_0xb71a('0xa')][_0x18c7a6]['updateAcw']();}if(_0x3c6438[_0xb71a('0xc')][_0x18c7a6]){_0x3c6438['agents'][_0x18c7a6][_0xb71a('0xd')]({'statePause':_0x2a4c86['pause']?!![]:![]});}_0x43ca14({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x3346a5){var _0x2f5fd5=this;return new Promise(function(_0x315ca8,_0xd8d3ae){if(ami['isConnected']()==![]){return _0xd8d3ae(_0x2f5fd5['error'](0x1f4,[config['asterisk']['ip'],config[_0xb71a('0xe')][_0xb71a('0xf')],_0xb71a('0x10')][_0xb71a('0x11')]('\x20')));}_0x3346a5=_[_0xb71a('0x12')](_0x3346a5,_[_0xb71a('0x13')](properties[_0xb71a('0x14')]));_0x3346a5[_0xb71a('0x15')]=_0xb71a('0x16');return ami['Action'](_0x3346a5)[_0xb71a('0x17')](function(_0x2d6369){_0x315ca8({'code':0xc8,'message':_0x2d6369[_0xb71a('0x18')]});})[_0xb71a('0x19')](function(_0x2bdb61){_0xd8d3ae(_0x2f5fd5[_0xb71a('0x1a')](0x1f5,_0x2bdb61[_0xb71a('0x18')]));});});},'Command':function(_0x7cd1f9){var _0x20bdfe=this;return new Promise(function(_0x2eab08,_0x16394a){if(ami['isConnected']()==![]){return _0x16394a(_0x20bdfe['error'](0x1f4,[config[_0xb71a('0xe')]['ip'],config[_0xb71a('0xe')]['username'],'ami\x20disconnected'][_0xb71a('0x11')]('\x20')));}_0x7cd1f9=_['pick'](_0x7cd1f9,_0xb71a('0x1b'));_0x7cd1f9[_0xb71a('0x15')]=_0xb71a('0x1c');return ami[_0xb71a('0x1d')](_0x7cd1f9)[_0xb71a('0x17')](function(_0x14b2a1){_0x2eab08({'code':0xc8,'message':_0x14b2a1[_0xb71a('0x1e')]});})[_0xb71a('0x19')](function(_0x5f3f19){_0x16394a(_0x20bdfe[_0xb71a('0x1a')](0x1f5,_0x5f3f19[_0xb71a('0x18')]));});});},'VoiceQueues':function(_0x353930){return new Promise(function(_0xa0743a,_0x3401f7){var _0x1a010d=[];for(var _0x20ed75 in _0x3c6438[_0xb71a('0x1f')]){if(_0x3c6438[_0xb71a('0x1f')][_0xb71a('0x20')](_0x20ed75)){var _0x45b849=_0x3c6438[_0xb71a('0x1f')][_0x20ed75];var _0x160f0f={'id':_0x45b849['id'],'name':_0x45b849['name'],'strategy':_0x45b849[_0xb71a('0x21')],'answered':_0x45b849[_0xb71a('0x22')],'available':_0x45b849[_0xb71a('0x23')],'loggedIn':_0x45b849[_0xb71a('0x24')],'pTalking':_0x45b849[_0xb71a('0x25')],'sumBillable':_0x45b849[_0xb71a('0x26')],'sumDuration':_0x45b849[_0xb71a('0x27')],'sumHoldTime':_0x45b849[_0xb71a('0x28')]||0x0,'talking':_0x45b849[_0xb71a('0x29')],'total':_0x45b849[_0xb71a('0x2a')],'type':_0x45b849[_0xb71a('0x2b')],'unmanaged':_0x45b849['unmanaged'],'abandoned':_0x45b849['abandoned'],'waiting':_0x45b849[_0xb71a('0x2c')],'loggedInDb':_0x45b849['loggedInDb']};if(_0x45b849[_0xb71a('0x2b')]===_0xb71a('0x2d')){_0x160f0f['dialActive']=_0x45b849[_0xb71a('0x2e')];_0x160f0f[_0xb71a('0x2f')]=_0x45b849[_0xb71a('0x2f')];_0x160f0f[_0xb71a('0x30')]=_0x45b849[_0xb71a('0x30')];_0x160f0f[_0xb71a('0x31')]=_0x45b849['dialOriginateCallerIdNumber'];_0x160f0f[_0xb71a('0x32')]=_0x45b849[_0xb71a('0x32')];_0x160f0f[_0xb71a('0x33')]=_0x45b849[_0xb71a('0x33')];_0x160f0f['temp']=_0x45b849[_0xb71a('0x34')];_0x160f0f[_0xb71a('0x35')]=_0x45b849[_0xb71a('0x35')];_0x160f0f[_0xb71a('0x36')]=_0x45b849[_0xb71a('0x36')];_0x160f0f[_0xb71a('0x37')]=_0x45b849[_0xb71a('0x37')];_0x160f0f[_0xb71a('0x38')]=_0x45b849[_0xb71a('0x38')];_0x160f0f[_0xb71a('0x39')]=_0x45b849['outboundCongestionCallsDay'];_0x160f0f['outboundDropCallsDayACS']=_0x45b849[_0xb71a('0x3a')];_0x160f0f[_0xb71a('0x3b')]=_0x45b849[_0xb71a('0x3b')];_0x160f0f[_0xb71a('0x3c')]=_0x45b849[_0xb71a('0x3c')];_0x160f0f[_0xb71a('0x3d')]=_0x45b849[_0xb71a('0x3d')];_0x160f0f['outboundNoSuchCallsDay']=_0x45b849[_0xb71a('0x3e')];_0x160f0f['outboundOriginateFailureCallsDay']=_0x45b849[_0xb71a('0x3f')];_0x160f0f[_0xb71a('0x40')]=_0x45b849[_0xb71a('0x40')];_0x160f0f[_0xb71a('0x41')]=_0x45b849['outboundRejectCallsDay'];_0x160f0f[_0xb71a('0x42')]=_0x45b849[_0xb71a('0x42')];_0x160f0f[_0xb71a('0x43')]=_0x45b849[_0xb71a('0x43')];_0x160f0f[_0xb71a('0x44')]=_0x45b849[_0xb71a('0x44')];_0x160f0f[_0xb71a('0x45')]=_0x45b849[_0xb71a('0x45')];_0x160f0f[_0xb71a('0x46')]=_0x45b849['predictiveIntervalDroppedCallsCallersExit'];_0x160f0f[_0xb71a('0x47')]=_0x45b849['predictiveIntervalDroppedCallsTimeout'];_0x160f0f[_0xb71a('0x48')]=_0x45b849[_0xb71a('0x48')];_0x160f0f[_0xb71a('0x49')]=_0x45b849[_0xb71a('0x49')];_0x160f0f[_0xb71a('0x4a')]=_0x45b849[_0xb71a('0x4a')];_0x160f0f['predictiveIntervalMultiplicativeFactor']=_0x45b849['predictiveIntervalMultiplicativeFactor'];_0x160f0f['predictiveIntervalPauses']=_0x45b849[_0xb71a('0x4b')];_0x160f0f['predictiveIntervalAvailable']=_0x45b849[_0xb71a('0x4c')];_0x160f0f[_0xb71a('0x4d')]=_0x45b849[_0xb71a('0x4d')];_0x160f0f[_0xb71a('0x18')]=_0x45b849[_0xb71a('0x18')];_0x160f0f[_0xb71a('0x4e')]=_0x45b849['originated'];_0x160f0f[_0xb71a('0x4f')]=_0x45b849[_0xb71a('0x4f')];_0x160f0f[_0xb71a('0x50')]=_0x45b849[_0xb71a('0x50')];_0x160f0f[_0xb71a('0x51')]=_0x45b849[_0xb71a('0x51')];_0x160f0f['erlangBusyFactor']=_0x45b849[_0xb71a('0x52')];_0x160f0f[_0xb71a('0x53')]=_0x45b849[_0xb71a('0x53')];_0x160f0f[_0xb71a('0x54')]=_0x45b849[_0xb71a('0x54')];}if(_0x45b849[_0xb71a('0x55')]){_0x160f0f[_0xb71a('0x55')]={'id':_0x45b849['Trunk']['id'],'name':_0x45b849['Trunk'][_0xb71a('0x56')],'active':_0x45b849[_0xb71a('0x55')][_0xb71a('0x57')],'callerid':_0x45b849[_0xb71a('0x55')]['callerid']};}if(_0x45b849[_0xb71a('0x58')]){_0x160f0f['Interval']={'id':_0x45b849[_0xb71a('0x58')]['id'],'name':_0x45b849[_0xb71a('0x58')]['name']};}_0x1a010d[_0xb71a('0x59')](_0x160f0f);}}_0xa0743a({'count':_0x1a010d[_0xb71a('0x5a')],'rows':_0x1a010d});});},'UpdateVoiceQueue':function(_0x1129ab){return new Promise(function(_0x2a1fde,_0x4b1556){var _0x188896=_[_0xb71a('0x5b')](_0x3c6438[_0xb71a('0x1f')],{'id':parseInt(_0x1129ab['id'])});var _0x5516bd=_[_0xb71a('0x5c')](_0x1129ab,['id']);if(_0x188896){for(var _0x1cd434 in _0x5516bd){if(typeof _0x5516bd[_0x1cd434]!==_0xb71a('0x5d')&&typeof _0x188896[_0x1cd434]!=='undefined'){_0x188896[_0x1cd434]=_0x5516bd[_0x1cd434];}}_0x2a1fde(_0x188896);}else{_0x4b1556();}});},'VoiceChannels':function(_0x2148ed){return new Promise(function(_0xfc6a80,_0x2f6f6e){var _0x1f29b7=_[_0xb71a('0x5e')](_0x3c6438['channels']);_0xfc6a80({'count':_0x1f29b7[_0xb71a('0x5a')],'rows':_0x1f29b7});});},'VoiceChannelMixMonitor':function(_0x44f610){var _0x45e961=this;return new Promise(function(_0x3ebc7d,_0x489c1f){if(ami['isConnected']()==![]){return _0x489c1f(_0x45e961[_0xb71a('0x1a')](0x1f4,[config[_0xb71a('0xe')]['ip'],config[_0xb71a('0xe')][_0xb71a('0xf')],_0xb71a('0x10')][_0xb71a('0x11')]('\x20')));}var _0x2a7804=schema(properties[_0xb71a('0x5f')])[_0xb71a('0x1')](_0x44f610);if(_0x2a7804[_0xb71a('0x5a')]>0x0){return _0x489c1f(_0x45e961['error'](0x1f4,_[_0xb71a('0x60')](_0x2a7804,_0xb71a('0x18'))['join'](',\x20')));}var _0x1c0536=_['find'](_0x3c6438[_0xb71a('0x61')],{'uniqueid':_0x44f610[_0xb71a('0x62')]});if(_0x1c0536&&_0x1c0536[_0xb71a('0x63')]){var _0x295e6c=util[_0xb71a('0x7')]('%s.%s',_0x44f610[_0xb71a('0x64')]||_0x44f610['uniqueid'],_0x44f610[_0xb71a('0x7')]||_0xb71a('0x65'));return ami['Action']({'action':'MixMonitor','channel':_0x1c0536[_0xb71a('0x63')],'file':_0x295e6c,'options':_0xb71a('0x66')})['then'](function(_0x4bc5f3){var _0x521a8c=_[_0xb71a('0x5b')](_0x1c0536['monitors'],{'filename':'/var/spool/asterisk/monitor/'+_0x295e6c[_0xb71a('0x67')]()});if(_[_0xb71a('0x68')](_0x521a8c)){_0x1c0536[_0xb71a('0x69')][_0xb71a('0x59')]({'filename':'/var/spool/asterisk/monitor/'+_0x295e6c[_0xb71a('0x67')](),'createdAt':moment()[_0xb71a('0x7')](_0xb71a('0x6a')),'mixmonitorid':_0x4bc5f3['mixmonitorid'],'status':_0xb71a('0x6b')});}else{_0x521a8c[_0xb71a('0x6c')]=_0x4bc5f3['mixmonitorid'];_0x521a8c[_0xb71a('0x6d')]=_0xb71a('0x6b');}_0x3ebc7d({'code':0xc8,'message':[_0x44f610[_0xb71a('0x62')],'MixMonitor\x20Success',_0x4bc5f3[_0xb71a('0x6c')]]['join']('\x20'),'mixmonitorid':_0x4bc5f3[_0xb71a('0x6c')]});})[_0xb71a('0x19')](function(_0x5295df){_0x489c1f(_0x45e961[_0xb71a('0x1a')](0x1f5,[_0x44f610[_0xb71a('0x62')],_0x5295df[_0xb71a('0x18')][_0xb71a('0x67')]()][_0xb71a('0x11')]('\x20')));});}else{return _0x489c1f(_0x45e961[_0xb71a('0x1a')](0x1f5,_0xb71a('0x6e')));}});},'VoiceChannelStopMixMonitor':function(_0x535ab6){var _0x581b75=this;return new Promise(function(_0x19c72d,_0x43e9ea){if(ami[_0xb71a('0x6f')]()==![]){return _0x43e9ea(_0x581b75[_0xb71a('0x1a')](0x1f4,[config[_0xb71a('0xe')]['ip'],config['asterisk']['username'],_0xb71a('0x10')][_0xb71a('0x11')]('\x20')));}var _0x581bf5=schema(properties[_0xb71a('0x5f')])[_0xb71a('0x1')](_0x535ab6);if(_0x581bf5['length']>0x0){return _0x43e9ea(_0x581b75[_0xb71a('0x1a')](0x1f4,_[_0xb71a('0x60')](_0x581bf5,_0xb71a('0x18'))[_0xb71a('0x11')](',\x20')));}var _0x59e2a0=_[_0xb71a('0x5b')](_0x3c6438[_0xb71a('0x61')],{'uniqueid':_0x535ab6['uniqueid']});if(_0x59e2a0){return BPromise[_0xb71a('0x70')]()[_0xb71a('0x17')](function(){if(_0x59e2a0[_0xb71a('0x63')]){return ami[_0xb71a('0x1d')]({'action':_0xb71a('0x71'),'channel':_0x59e2a0[_0xb71a('0x63')],'mixmonitorid':_0x535ab6[_0xb71a('0x6c')]})[_0xb71a('0x19')](function(_0x559790){});}})[_0xb71a('0x17')](function(){if(_0x59e2a0[_0xb71a('0x72')]){return ami['Action']({'action':_0xb71a('0x71'),'channel':_0x59e2a0[_0xb71a('0x72')],'mixmonitorid':_0x535ab6['mixmonitorid']})[_0xb71a('0x19')](function(_0x220749){});}})[_0xb71a('0x17')](function(_0x476f47){var _0x23f870=_[_0xb71a('0x5b')](_0x59e2a0['monitors'],{'mixmonitorid':_0x535ab6['mixmonitorid']});if(_0x23f870){_0x23f870[_0xb71a('0x6d')]=_0xb71a('0x73');}})[_0xb71a('0x17')](function(){var _0x57db9b=util[_0xb71a('0x7')]('%s.%s',_0x535ab6[_0xb71a('0x64')]||_0x535ab6['uniqueid'],_0x535ab6['format']||_0xb71a('0x65'));var _0x9af0c=_[_0xb71a('0x5b')](_0x59e2a0[_0xb71a('0x69')],{'filename':_0xb71a('0x74')+_0x57db9b['toLowerCase']()});if(_0x9af0c){_0x9af0c[_0xb71a('0x6d')]='stop';}})[_0xb71a('0x17')](function(){_0x19c72d({'code':0xc8,'message':[_0x535ab6[_0xb71a('0x62')],_0xb71a('0x75')]['join']('\x20')});})['catch'](function(_0x3e7bf7){_0x43e9ea(_0x581b75[_0xb71a('0x1a')](0x1f5,[_0x535ab6[_0xb71a('0x62')],_0x3e7bf7[_0xb71a('0x18')][_0xb71a('0x67')]()]['join']('\x20')));});}else{return _0x43e9ea(_0x581b75[_0xb71a('0x1a')](0x1f5,_0xb71a('0x6e')));}});},'VoiceQueuesChannels':function(_0x1063ab){return new Promise(function(_0x2b32fc,_0x26cc4f){var _0x493e0b=_['values'](_0x3c6438[_0xb71a('0x76')]);_0x2b32fc({'count':_0x493e0b[_0xb71a('0x5a')],'rows':_0x493e0b});});},'VoiceQueuesChannel':function(_0x38a8a1){var _0x3a39be=this;return new Promise(function(_0x459d2d,_0xa2081f){var _0x2e8b81=schema(properties['voicequeuechannel'])[_0xb71a('0x1')](_0x38a8a1);if(_0x2e8b81[_0xb71a('0x5a')]>0x0){return _0xa2081f(_0x3a39be['error'](0x1f4,_[_0xb71a('0x60')](_0x2e8b81,_0xb71a('0x18'))[_0xb71a('0x11')](',\x20')));}var _0x4f21f8=_[_0xb71a('0x5b')](_0x3c6438[_0xb71a('0x76')],{'uniqueid':_0x38a8a1[_0xb71a('0x62')]});if(_0x4f21f8){_0x459d2d(_0x4f21f8);}else{return _0xa2081f(_0x3a39be['error'](0x1f5,_0xb71a('0x6e')));}});},'VoiceQueuesChannelHangup':function(_0x45fc89){var _0x34a32c=this;return new Promise(function(_0x36f549,_0x15009c){if(ami[_0xb71a('0x6f')]()==![]){return _0x15009c(_0x34a32c[_0xb71a('0x1a')](0x1f4,[config[_0xb71a('0xe')]['ip'],config['asterisk'][_0xb71a('0xf')],_0xb71a('0x10')][_0xb71a('0x11')]('\x20')));}var _0x30d36a=schema(properties[_0xb71a('0x77')])[_0xb71a('0x1')](_0x45fc89);if(_0x30d36a[_0xb71a('0x5a')]>0x0){return _0x15009c(_0x34a32c['error'](0x1f4,_[_0xb71a('0x60')](_0x30d36a,'message')[_0xb71a('0x11')](',\x20')));}var _0x32ff6b=_['find'](_0x3c6438[_0xb71a('0x76')],{'uniqueid':_0x45fc89['uniqueid']});if(_0x32ff6b&&_0x32ff6b[_0xb71a('0x63')]){return ami['Action']({'action':_0xb71a('0x78'),'channel':_0x32ff6b[_0xb71a('0x63')]})[_0xb71a('0x17')](function(_0x2fd9be){_0x36f549({'code':0xc8,'message':[_0x45fc89['uniqueid'],_0x2fd9be[_0xb71a('0x18')][_0xb71a('0x67')]()]['join']('\x20')});})[_0xb71a('0x19')](function(_0x4bf3b1){_0x15009c(_0x34a32c['error'](0x1f5,[_0x45fc89['uniqueid'],_0x4bf3b1['message'][_0xb71a('0x67')]()][_0xb71a('0x11')]('\x20')));});}else{return _0x15009c(_0x34a32c[_0xb71a('0x1a')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x2bdf9b){var _0x433d38=this;return new Promise(function(_0x58ed5f,_0x299349){if(ami[_0xb71a('0x6f')]()==![]){return _0x299349(_0x433d38[_0xb71a('0x1a')](0x1f4,[config[_0xb71a('0xe')]['ip'],config[_0xb71a('0xe')][_0xb71a('0xf')],'ami\x20disconnected'][_0xb71a('0x11')]('\x20')));}var _0x2772f8=schema(properties[_0xb71a('0x79')])[_0xb71a('0x1')](_0x2bdf9b);if(_0x2772f8[_0xb71a('0x5a')]>0x0){return _0x299349(_0x433d38[_0xb71a('0x1a')](0x1f4,_['map'](_0x2772f8,_0xb71a('0x18'))[_0xb71a('0x11')](',\x20')));}var _0x50d641=_[_0xb71a('0x5b')](_0x3c6438[_0xb71a('0x76')],{'uniqueid':_0x2bdf9b[_0xb71a('0x62')]});if(_0x50d641&&_0x50d641['channel']){return ami[_0xb71a('0x1d')]({'action':_0xb71a('0x7a'),'channel':_0x50d641[_0xb71a('0x63')],'exten':_0x2bdf9b['exten'],'context':_0x2bdf9b[_0xb71a('0x7b')]||_0x50d641[_0xb71a('0x7b')],'priority':0x1})['then'](function(_0x3e8216){_0x58ed5f({'code':0xc8,'message':[_0x2bdf9b[_0xb71a('0x62')],_0x3e8216[_0xb71a('0x18')][_0xb71a('0x67')]()]['join']('\x20')});})[_0xb71a('0x19')](function(_0x20cb10){_0x299349(_0x433d38[_0xb71a('0x1a')](0x1f5,[_0x2bdf9b[_0xb71a('0x62')],_0x20cb10['message'][_0xb71a('0x67')]()][_0xb71a('0x11')]('\x20')));});}else{return _0x299349(_0x433d38['error'](0x1f5,_0xb71a('0x6e')));}});},'Agents':function(_0x32ebde){return new Promise(function(_0x5df234,_0x1bc530){var _0x385875=_[_0xb71a('0x5e')](_0x3c6438['agents']);_0x5df234({'count':_0x385875[_0xb71a('0x5a')],'rows':_0x385875});});},'Telephones':function(_0x2e49c3){return new Promise(function(_0x771e1,_0xd5ff7b){var _0x397e34=_[_0xb71a('0x5e')](_0x3c6438[_0xb71a('0x7c')]);_0x771e1({'count':_0x397e34[_0xb71a('0x5a')],'rows':_0x397e34});});},'Trunks':function(_0x19d364){return new Promise(function(_0x4bfa4b,_0x5b9667){var _0x36a75e=_[_0xb71a('0x5e')](_0x3c6438[_0xb71a('0x7d')]);_0x4bfa4b({'count':_0x36a75e[_0xb71a('0x5a')],'rows':_0x36a75e});});},'OutboundChannels':function(_0xf6b137){return new Promise(function(_0x1d87c2,_0x4c8f6a){var _0x2a4d98=_['values'](_0x3c6438[_0xb71a('0x7e')]);_0x1d87c2({'count':_0x2a4d98['length'],'rows':_0x2a4d98});});},'Outbound':function(_0x1c8bc3){return new Promise(function(_0x2b5ef8,_0x4a5c58){_0x2b5ef8(_0x3c6438[_0xb71a('0x2d')]);});},'Campaigns':function(_0x4284c7){return new Promise(function(_0xe0940f,_0x348787){var _0x218517=_['values'](_0x3c6438[_0xb71a('0x7f')]);_0xe0940f({'count':_0x218517[_0xb71a('0x5a')],'rows':_0x218517});});},'VoiceQueuesPreview':function(_0x4be67e){var _0x14c7a6=this;return new Promise(function(_0x4b0866,_0x533316){_0x2192e8[_0xb71a('0x80')](_0x4be67e['id'])[_0xb71a('0x17')](function(_0x43f409){_0x4b0866({'code':0xc8,'message':_0x43f409['message']});})[_0xb71a('0x19')](function(_0x3643c5){_0x533316(_0x14c7a6[_0xb71a('0x1a')](0x1f4,_0x3643c5['message']));});});},'EventManager':function(_0x13b3a8){var _0xb8cd95=this;return new Promise(function(_0x3396c8,_0x4278fc){if(!_0x13b3a8[_0xb71a('0x81')]){return _0x4278fc(_0xb8cd95['error'](0x1f4,_0xb71a('0x82')));}ami['emit'](_0xb71a('0x83')+_0x13b3a8[_0xb71a('0x81')],_0x13b3a8[_0xb71a('0x18')]);_0x3396c8({'code':0xc8,'message':_0x13b3a8});});},'FaxAccounts':function(_0x5eb005){return new Promise(function(_0x589618,_0x77dc7){var _0x13d2e0=_[_0xb71a('0x5e')](_0x3c6438[_0xb71a('0x84')]);_0x589618({'count':_0x13d2e0[_0xb71a('0x5a')],'rows':_0x13d2e0});});},'SendFax':function(_0x18dfb3){var _0x38ffc1=this;return new Promise(function(_0x442ec0,_0x24efc1){_0x38d931[_0xb71a('0x85')](_0x18dfb3)[_0xb71a('0x17')](function(_0x3a656f){_0x442ec0({'code':0xc8,'message':_0x3a656f[_0xb71a('0x18')]});})[_0xb71a('0x19')](function(_0x464da5){_0x24efc1(_0x38ffc1['error'](0x1f4,_0x464da5[_0xb71a('0x18')]));});});},'CheckAfterSend':function(_0x231e05){var _0x243c90=this;return new Promise(function(_0x4973e8,_0x4c1003){_0x38d931['checkAfterSend'](_0x231e05)[_0xb71a('0x17')](function(_0x4981c6){_0x4973e8({'code':0xc8,'message':_0x4981c6[_0xb71a('0x18')]});})[_0xb71a('0x19')](function(_0x47e022){_0x4c1003(_0x243c90['error'](0x1f4,_0x47e022[_0xb71a('0x18')]));});});}};var _0x99a14f=jayson[_0xb71a('0x86')](_0x4358ce)[_0xb71a('0x87')]();_0x99a14f['on'](_0xb71a('0x1a'),function(_0x86854b){return _0x35a84e(_0x86854b);});_0x99a14f[_0xb71a('0x6')](0x232a,_0xb71a('0x88'),function(){console[_0xb71a('0x89')](_0xb71a('0x8a'),0x232a);return _0x22c072(_0xb71a('0x8b')+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 14945bd..65acaca 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 _0xe34e=['length','[CM][%s][%s]\x20Contact\x20found:%s','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','uniqueid','calleridname','destcalleridname','','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','Unknown','user:%s','name','format','trigger:%s','action','toLowerCase','merge','lodash','bluebird','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','socket.io-emitter','info','[CM][%s][%s]','emit','data1','isNil','data5','xmd-contactid','ListId','data3','split','phone','$or','routeId','calleridnum','destcalleridnum','firstName','lastName','mobile','fax','createdAt','scheduledAt','updatedAt','union','resolve','then','getContacts'];(function(_0x5e8fc,_0x1ccc06){var _0x41c58c=function(_0x495f2c){while(--_0x495f2c){_0x5e8fc['push'](_0x5e8fc['shift']());}};_0x41c58c(++_0x1ccc06);}(_0xe34e,0x132));var _0xee34=function(_0x30023c,_0x22a8ed){_0x30023c=_0x30023c-0x0;var _0x1cc893=_0xe34e[_0x30023c];return _0x1cc893;};'use strict';var _=require(_0xee34('0x0'));var BPromise=require(_0xee34('0x1'));var Redis=require('ioredis');var util=require(_0xee34('0x2'));var config=require(_0xee34('0x3'));var logger=require(_0xee34('0x4'))(_0xee34('0x5'));var cmContactRpc=require(_0xee34('0x6'));config[_0xee34('0x7')]=_[_0xee34('0x8')](config[_0xee34('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xee34('0x9'))(new Redis(config['redis']));function emit(_0x45e589,_0x3ed6fa,_0x46d0a9,_0xa4ccdd,_0x1e60a9){logger[_0xee34('0xa')](_0xee34('0xb'),_0x45e589,_0x3ed6fa['id'],_0x46d0a9,_0xa4ccdd,JSON['stringify'](_0x1e60a9));io['to'](_0x46d0a9)[_0xee34('0xc')](_0xa4ccdd,_0x1e60a9);}exports['exec']=function(_0x3eea13,_0x17619e,_0x49cca7,_0x544403){var _0x149be3,_0xdd451b;var _0x1c086a={};var _0x5ed919;var _0x2819bf=Number(_0x49cca7[_0xee34('0xd')]);var _0x12d713=_0x49cca7['data2']?Boolean(Number(_0x49cca7['data2'])):![];var _0x2546a0;var _0x3c7abb=![];if(!_[_0xee34('0xe')](_0x49cca7['data5'])){if(_0x49cca7[_0xee34('0xf')]=='1')_0x3c7abb=!![];}if(!_0x3c7abb){if(_0x544403['xmd-contactid']){_0x1c086a['id']=_0x544403[_0xee34('0x10')];}}if(!_0x1c086a['id']){_0x1c086a[_0xee34('0x11')]=_0x2819bf;_0x2546a0=_0x49cca7[_0xee34('0x12')]&&_0x49cca7['data3']!=='0'?_0x49cca7[_0xee34('0x12')][_0xee34('0x13')](','):[_0xee34('0x14')];_0x1c086a[_0xee34('0x15')]=_['map'](_0x2546a0,function(_0x2d3bf6){var _0xd724fb={};_0xd724fb[_0x2d3bf6]=_0x544403[_0xee34('0x16')]?_0x544403['destcalleridnum']:_0x544403[_0xee34('0x17')];return _0xd724fb;});_0x5ed919=_0x544403[_0xee34('0x16')]?_0x544403[_0xee34('0x18')]:_0x544403['calleridnum'];}var _0x4bed8f=['id',_0xee34('0x19'),_0xee34('0x1a'),_0xee34('0x14'),_0xee34('0x1b'),_0xee34('0x1c'),_0xee34('0x11'),_0xee34('0x1d'),_0xee34('0x1e'),_0xee34('0x1f')];var _0x520d9a=_[_0xee34('0x20')](_0x4bed8f,_0x2546a0);BPromise[_0xee34('0x21')]()[_0xee34('0x22')](cmContactRpc[_0xee34('0x23')]({'attributes':_0x520d9a,'where':_0x1c086a,'phone':_0x5ed919}))['then'](function(_0x4cc878){_0xdd451b=_0x4cc878;if(!_['isEmpty'](_0xdd451b)){if(_0xdd451b[_0xee34('0x24')]===0x1){_0x149be3=_0xdd451b[0x0];logger[_0xee34('0xa')](_0xee34('0x25'),_0x544403['uniqueid'],_0x17619e['id'],_0x149be3['id']);}else{logger[_0xee34('0xa')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x544403['uniqueid'],_0x17619e['id'],_['map'](_0xdd451b,'id')[_0xee34('0x26')](','));}return;}else{logger[_0xee34('0xa')](_0xee34('0x27'),_0x544403['uniqueid'],_0x17619e['id']);var _0x5b3f0d={'ListId':_0x2819bf};var _0x512491=_0x49cca7[_0xee34('0x28')]&&_0x49cca7[_0xee34('0x28')]!=='0'?_0x49cca7[_0xee34('0x28')]:_0xee34('0x14');if(_0x12d713){logger[_0xee34('0xa')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0x544403[_0xee34('0x29')],_0x17619e['id']);_0x5b3f0d[_0x512491]=_[_0xee34('0xe')](_0x544403[_0xee34('0x16')])?_0x544403[_0xee34('0x17')]:_0x544403[_0xee34('0x18')];if(_[_0xee34('0xe')](_0x544403[_0xee34('0x16')])){_0x5b3f0d[_0xee34('0x19')]=_0x544403[_0xee34('0x2a')]&&_0x544403['calleridname']!==''?_0x544403['calleridname']:'Unknown';}else{_0x5b3f0d[_0xee34('0x19')]=_0x544403[_0xee34('0x2b')]&&_0x544403[_0xee34('0x2b')]!==_0xee34('0x2c')?_0x544403[_0xee34('0x2b')]:'Unknown';}return BPromise[_0xee34('0x21')]()['then'](cmContactRpc[_0xee34('0x2d')](_0x5b3f0d))['then'](function(_0x43afd2){_0x149be3=_0x43afd2;_0xdd451b[_0xee34('0x2e')](_0x43afd2);if(_0x149be3){logger[_0xee34('0xa')](_0xee34('0x2f'),_0x544403[_0xee34('0x29')],_0x17619e['id'],_0x149be3['id']);}return;});}else{logger[_0xee34('0xa')](_0xee34('0x30'),_0x544403[_0xee34('0x29')],_0x17619e['id']);_0x5b3f0d[_0x512491]=_[_0xee34('0xe')](_0x544403[_0xee34('0x16')])?_0x544403[_0xee34('0x17')]:_0x544403[_0xee34('0x18')];if(_['isNil'](_0x544403[_0xee34('0x16')])){_0x5b3f0d[_0xee34('0x19')]=_0x544403['calleridname']&&_0x544403[_0xee34('0x2a')]!==_0xee34('0x2c')?_0x544403[_0xee34('0x2a')]:_0xee34('0x31');}else{_0x5b3f0d[_0xee34('0x19')]=_0x544403['destcalleridname']&&_0x544403[_0xee34('0x2b')]!==''?_0x544403[_0xee34('0x2b')]:_0xee34('0x31');}_0x149be3=_0x5b3f0d;_0xdd451b[_0xee34('0x2e')](_0x5b3f0d);return;}}})[_0xee34('0x22')](function(){if(_0x3eea13){emit(_0x544403['uniqueid'],_0x17619e,util['format'](_0xee34('0x32'),_0x3eea13[_0xee34('0x33')]),util[_0xee34('0x34')](_0xee34('0x35'),_0x49cca7[_0xee34('0x36')][_0xee34('0x37')]()),{'evt':_[_0xee34('0x38')](_0x544403,{'autoCreate':_0x12d713}),'contact':_0x149be3===undefined?{}:_0x149be3,'contacts':_0xdd451b[_0xee34('0x24')]===0x0?undefined:_0xdd451b});}});}; \ No newline at end of file +var _0xe139=['data3','split','map','routeId','calleridnum','firstName','lastName','fax','scheduledAt','updatedAt','union','resolve','then','getContacts','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','data4','phone','[CM][%s][%s]\x20Autocreate\x20enabled','destcalleridnum','calleridname','','Unknown','destcalleridname','[CM][%s][%s]\x20Contact\x20created:%s','push','user:%s','name','trigger:%s','lodash','ioredis','util','../../../../config/environment','trigger','../../rpc/cmContact','redis','defaults','socket.io-emitter','info','[CM][%s][%s]','stringify','emit','exec','data1','isNil','data5','xmd-contactid','ListId'];(function(_0x39c442,_0x3fce7e){var _0x33f536=function(_0x100028){while(--_0x100028){_0x39c442['push'](_0x39c442['shift']());}};_0x33f536(++_0x3fce7e);}(_0xe139,0x1eb));var _0x9e13=function(_0x697d77,_0x25661c){_0x697d77=_0x697d77-0x0;var _0x578435=_0xe139[_0x697d77];return _0x578435;};'use strict';var _=require(_0x9e13('0x0'));var BPromise=require('bluebird');var Redis=require(_0x9e13('0x1'));var util=require(_0x9e13('0x2'));var config=require(_0x9e13('0x3'));var logger=require('../../../../config/logger')(_0x9e13('0x4'));var cmContactRpc=require(_0x9e13('0x5'));config[_0x9e13('0x6')]=_[_0x9e13('0x7')](config[_0x9e13('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x9e13('0x8'))(new Redis(config[_0x9e13('0x6')]));function emit(_0x431d00,_0x4b3aee,_0x48a2cd,_0x2133a9,_0x16a0be){logger[_0x9e13('0x9')](_0x9e13('0xa'),_0x431d00,_0x4b3aee['id'],_0x48a2cd,_0x2133a9,JSON[_0x9e13('0xb')](_0x16a0be));io['to'](_0x48a2cd)[_0x9e13('0xc')](_0x2133a9,_0x16a0be);}exports[_0x9e13('0xd')]=function(_0x10ff06,_0x7fc3,_0x16f2a2,_0x338fb8){var _0x4ccb75,_0xad71d1;var _0x213eab={};var _0x25a2c9;var _0x540019=Number(_0x16f2a2[_0x9e13('0xe')]);var _0x2df0aa=_0x16f2a2['data2']?Boolean(Number(_0x16f2a2['data2'])):![];var _0x59ce26;var _0x5e5872=![];if(!_[_0x9e13('0xf')](_0x16f2a2[_0x9e13('0x10')])){if(_0x16f2a2['data5']=='1')_0x5e5872=!![];}if(!_0x5e5872){if(_0x338fb8[_0x9e13('0x11')]){_0x213eab['id']=_0x338fb8[_0x9e13('0x11')];}}if(!_0x213eab['id']){_0x213eab[_0x9e13('0x12')]=_0x540019;_0x59ce26=_0x16f2a2[_0x9e13('0x13')]&&_0x16f2a2[_0x9e13('0x13')]!=='0'?_0x16f2a2[_0x9e13('0x13')][_0x9e13('0x14')](','):['phone'];_0x213eab['$or']=_[_0x9e13('0x15')](_0x59ce26,function(_0x445267){var _0x301c7b={};_0x301c7b[_0x445267]=_0x338fb8[_0x9e13('0x16')]?_0x338fb8['destcalleridnum']:_0x338fb8[_0x9e13('0x17')];return _0x301c7b;});_0x25a2c9=_0x338fb8[_0x9e13('0x16')]?_0x338fb8['destcalleridnum']:_0x338fb8['calleridnum'];}var _0x4c3daf=['id',_0x9e13('0x18'),_0x9e13('0x19'),'phone','mobile',_0x9e13('0x1a'),'ListId','createdAt',_0x9e13('0x1b'),_0x9e13('0x1c')];var _0x54db0e=_[_0x9e13('0x1d')](_0x4c3daf,_0x59ce26);BPromise[_0x9e13('0x1e')]()[_0x9e13('0x1f')](cmContactRpc[_0x9e13('0x20')]({'attributes':_0x54db0e,'where':_0x213eab,'phone':_0x25a2c9}))[_0x9e13('0x1f')](function(_0x528d9c){_0xad71d1=_0x528d9c;if(!_[_0x9e13('0x21')](_0xad71d1)){if(_0xad71d1[_0x9e13('0x22')]===0x1){_0x4ccb75=_0xad71d1[0x0];logger['info'](_0x9e13('0x23'),_0x338fb8[_0x9e13('0x24')],_0x7fc3['id'],_0x4ccb75['id']);}else{logger[_0x9e13('0x9')](_0x9e13('0x25'),_0x338fb8['uniqueid'],_0x7fc3['id'],_[_0x9e13('0x15')](_0xad71d1,'id')['join'](','));}return;}else{logger[_0x9e13('0x9')]('[CM][%s][%s]\x20Contact\x20not\x20found',_0x338fb8[_0x9e13('0x24')],_0x7fc3['id']);var _0x30a29e={'ListId':_0x540019};var _0x530950=_0x16f2a2[_0x9e13('0x26')]&&_0x16f2a2[_0x9e13('0x26')]!=='0'?_0x16f2a2[_0x9e13('0x26')]:_0x9e13('0x27');if(_0x2df0aa){logger['info'](_0x9e13('0x28'),_0x338fb8[_0x9e13('0x24')],_0x7fc3['id']);_0x30a29e[_0x530950]=_[_0x9e13('0xf')](_0x338fb8[_0x9e13('0x16')])?_0x338fb8[_0x9e13('0x17')]:_0x338fb8[_0x9e13('0x29')];if(_[_0x9e13('0xf')](_0x338fb8[_0x9e13('0x16')])){_0x30a29e[_0x9e13('0x18')]=_0x338fb8[_0x9e13('0x2a')]&&_0x338fb8['calleridname']!==_0x9e13('0x2b')?_0x338fb8[_0x9e13('0x2a')]:_0x9e13('0x2c');}else{_0x30a29e[_0x9e13('0x18')]=_0x338fb8[_0x9e13('0x2d')]&&_0x338fb8[_0x9e13('0x2d')]!==''?_0x338fb8['destcalleridname']:_0x9e13('0x2c');}return BPromise[_0x9e13('0x1e')]()[_0x9e13('0x1f')](cmContactRpc['createContact'](_0x30a29e))['then'](function(_0x3f5b96){_0x4ccb75=_0x3f5b96;_0xad71d1['push'](_0x3f5b96);if(_0x4ccb75){logger['info'](_0x9e13('0x2e'),_0x338fb8[_0x9e13('0x24')],_0x7fc3['id'],_0x4ccb75['id']);}return;});}else{logger[_0x9e13('0x9')]('[CM][%s][%s]\x20Autocreate\x20disabled',_0x338fb8['uniqueid'],_0x7fc3['id']);_0x30a29e[_0x530950]=_[_0x9e13('0xf')](_0x338fb8['routeId'])?_0x338fb8[_0x9e13('0x17')]:_0x338fb8[_0x9e13('0x29')];if(_[_0x9e13('0xf')](_0x338fb8[_0x9e13('0x16')])){_0x30a29e['firstName']=_0x338fb8['calleridname']&&_0x338fb8[_0x9e13('0x2a')]!==_0x9e13('0x2b')?_0x338fb8[_0x9e13('0x2a')]:'Unknown';}else{_0x30a29e[_0x9e13('0x18')]=_0x338fb8[_0x9e13('0x2d')]&&_0x338fb8['destcalleridname']!==_0x9e13('0x2b')?_0x338fb8[_0x9e13('0x2d')]:_0x9e13('0x2c');}_0x4ccb75=_0x30a29e;_0xad71d1[_0x9e13('0x2f')](_0x30a29e);return;}}})[_0x9e13('0x1f')](function(){if(_0x10ff06){emit(_0x338fb8[_0x9e13('0x24')],_0x7fc3,util['format'](_0x9e13('0x30'),_0x10ff06[_0x9e13('0x31')]),util['format'](_0x9e13('0x32'),_0x16f2a2['action']['toLowerCase']()),{'evt':_['merge'](_0x338fb8,{'autoCreate':_0x2df0aa}),'contact':_0x4ccb75===undefined?{}:_0x4ccb75,'contacts':_0xad71d1[_0x9e13('0x22')]===0x0?undefined:_0xad71d1});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 0e59c41..ab1f986 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 _0x87d8=['data4','location','uriLocation','isNil','data5','800','windowHeight','data6','600','winArguments','format','user:%s','name','trigger:%s:%s','merge','jscripty','trigger:%s','toLowerCase','exec','integration','queue','script','buildUri','query','replace','channel','AllConditions','length','checkConditions','AnyConditions','some','field','account','chat','ChatWebsiteId','value','upperFirst','AccountId','operator','interaction','message','event','agent','membername','lastevent','routeId','mailSubstatus','substatus','equals','exports','lodash','url','mustache','ioredis','./urlforward','./integration','./cmContact','./script','../../../config/environment','../../../config/logger','trigger','../ami','redis','defaults','socket.io-emitter','popup','winapp','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','zohoAccounts','bind','syncCustomEvent','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:queuecallerabandon','custom:timeout','custom:dialbegin','custom:dialconnect','syncAgentDial','custom:newinteraction','custom:substatus','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','custom:offlineMessage','emit','stringify','clone','motionChannel','undefined','voice','checkTriggers','prototype','triggers','checkTrigger','variables','Actions','interface','action','contactmanager','motionbar','data1','TemplateId','data2','render','template\x20not\x20found','uri','data3'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x87d8,0x1a9));var _0x887d=function(_0x219536,_0x8e0b9b){_0x219536=_0x219536-0x0;var _0x231e4d=_0x87d8[_0x219536];return _0x231e4d;};'use strict';var util=require('util');var _=require(_0x887d('0x0'));var url=require(_0x887d('0x1'));var Mustache=require(_0x887d('0x2'));var Redis=require(_0x887d('0x3'));var urlforward=require(_0x887d('0x4'));var integration=require(_0x887d('0x5'));var cmContact=require(_0x887d('0x6'));var script=require(_0x887d('0x7'));var config=require(_0x887d('0x8'));var logger=require(_0x887d('0x9'))(_0x887d('0xa'));var ami=require(_0x887d('0xb'));config[_0x887d('0xc')]=_[_0x887d('0xd')](config[_0x887d('0xc')],{'host':'localhost','port':0x18eb});var io=require(_0x887d('0xe'))(new Redis(config[_0x887d('0xc')]));var operators={'equals':function(_0x4d191e,_0x4adb15){return _0x4d191e==_0x4adb15;},'not_equals':function(_0x583716,_0x56c73a){return _0x583716!=_0x56c73a;}};var barAndWebActions=[_0x887d('0xf'),_0x887d('0x1'),_0x887d('0x10')];function Trigger(_0x3db821){this['triggers']=_0x3db821['triggers'];this[_0x887d('0x11')]=_0x3db821[_0x887d('0x11')];this[_0x887d('0x12')]=_0x3db821[_0x887d('0x12')];this[_0x887d('0x13')]=_0x3db821[_0x887d('0x13')];this[_0x887d('0x14')]=_0x3db821[_0x887d('0x14')];this['zendeskAccounts']=_0x3db821[_0x887d('0x15')];this[_0x887d('0x16')]=_0x3db821[_0x887d('0x16')];this['salesforceAccounts']=_0x3db821[_0x887d('0x17')];this[_0x887d('0x18')]=_0x3db821['sugarcrmAccounts'];this['zohoAccounts']=_0x3db821['zohoAccounts'];this[_0x887d('0x19')]=_0x3db821[_0x887d('0x19')];this['vtigerAccounts']=_0x3db821[_0x887d('0x1a')];this[_0x887d('0x1b')]=_0x3db821[_0x887d('0x1b')];this['dynamics365Accounts']=_0x3db821[_0x887d('0x1c')];this[_0x887d('0x1d')]=_0x3db821['freshsalesAccounts'];this[_0x887d('0x1e')]={'zendesk':this['zendeskAccounts'],'salesforce':this[_0x887d('0x17')],'freshdesk':this[_0x887d('0x16')],'sugarcrm':this[_0x887d('0x18')],'zoho':this[_0x887d('0x1f')],'desk':this[_0x887d('0x19')],'vtiger':this[_0x887d('0x1a')],'dynamics365':this[_0x887d('0x1c')],'freshsales':this[_0x887d('0x1d')],'servicenow':this[_0x887d('0x1b')]};ami['on']('custom:agentcalled',this['syncCustomEvent'][_0x887d('0x20')](this));ami['on']('custom:agentconnect',this[_0x887d('0x21')][_0x887d('0x20')](this));ami['on'](_0x887d('0x22'),this[_0x887d('0x21')][_0x887d('0x20')](this));ami['on'](_0x887d('0x23'),this['syncCustomEvent'][_0x887d('0x20')](this));ami['on'](_0x887d('0x24'),this['syncCustomEvent']['bind'](this));ami['on'](_0x887d('0x25'),this[_0x887d('0x21')][_0x887d('0x20')](this));ami['on'](_0x887d('0x26'),this['syncCustomEvent'][_0x887d('0x20')](this));ami['on'](_0x887d('0x27'),this[_0x887d('0x21')]['bind'](this));ami['on'](_0x887d('0x28'),this[_0x887d('0x21')][_0x887d('0x20')](this));ami['on']('custom:amd',this['syncCustomEvent'][_0x887d('0x20')](this));ami['on'](_0x887d('0x29'),this['syncCustomEvent']['bind'](this));ami['on'](_0x887d('0x2a'),this['syncCustomEvent'][_0x887d('0x20')](this));ami['on'](_0x887d('0x2b'),this['syncAgentDial'][_0x887d('0x20')](this));ami['on'](_0x887d('0x2c'),this['syncAgentDial']['bind'](this));ami['on']('custom:dialend',this[_0x887d('0x2d')][_0x887d('0x20')](this));ami['on'](_0x887d('0x2e'),this[_0x887d('0x21')][_0x887d('0x20')](this));ami['on']('custom:closedinteraction',this[_0x887d('0x21')][_0x887d('0x20')](this));ami['on'](_0x887d('0x2f'),this['syncCustomEvent']['bind'](this));ami['on'](_0x887d('0x30'),this['syncCustomEvent']['bind'](this));ami['on'](_0x887d('0x31'),this['syncCustomEvent'][_0x887d('0x20')](this));ami['on'](_0x887d('0x32'),this[_0x887d('0x21')][_0x887d('0x20')](this));ami['on']('custom:rejectmessage',this[_0x887d('0x21')][_0x887d('0x20')](this));ami['on'](_0x887d('0x33'),this[_0x887d('0x21')][_0x887d('0x20')](this));}Trigger['prototype'][_0x887d('0x34')]=function(_0x16b764,_0x498926,_0x24c713){logger['info'](_0x16b764,_0x498926,JSON[_0x887d('0x35')](_0x24c713));io['to'](_0x16b764)[_0x887d('0x34')](_0x498926,_0x24c713);};Trigger['prototype']['syncCustomEvent']=function(_0x49fa00){var _0x2d18ee=_[_0x887d('0x36')](_0x49fa00);if(typeof _0x2d18ee[_0x887d('0x37')]===_0x887d('0x38')){_0x2d18ee[_0x887d('0x37')]=_0x887d('0x39');}this[_0x887d('0x3a')](_0x2d18ee);};Trigger['prototype'][_0x887d('0x2d')]=function(_0x53d7a3){if(this['agents'][_0x53d7a3['interface']]){this['syncCustomEvent'](_0x53d7a3);}};Trigger[_0x887d('0x3b')][_0x887d('0x3a')]=function(_0x32f8ce){var _0x3550d3;for(var _0x4cc17a in this[_0x887d('0x3c')]){if(this[_0x887d('0x3c')]['hasOwnProperty'](_0x4cc17a)){if(this[_0x887d('0x3c')][_0x4cc17a]['status']){_0x3550d3=this[_0x887d('0x3d')](this['triggers'][_0x4cc17a],_0x32f8ce);if(_0x3550d3){_['merge'](_0x32f8ce,_0x32f8ce[_0x887d('0x3e')]);for(var _0x4a5b99=0x0,_0x585386,_0x3a937c,_0x2ad9d6;_0x4a5b990x0){_0x1c9f6b=_['map'](_0x430d55,_0x28814f);}return _0x1c9f6b;}function getCustomFields(_0x1377b0,_0x22f6b6){var _0x1b8388=[];var _0x201941={'custom_fields':{}};if(_0x1377b0[_0xa55c('0x28')]>0x0){_[_0xa55c('0x29')](_0x1377b0,function(_0x52d37f){if(_[_0xa55c('0x2a')](['string',_0xa55c('0x2b')],_0x52d37f[_0xa55c('0x2c')])&&_0x52d37f[_0xa55c('0x2d')]&&!_0x52d37f[_0xa55c('0x2e')]){_0x201941[_0x52d37f['nameField'][_0xa55c('0x2f')]()]=_0x52d37f[_0xa55c('0x30')][_0xa55c('0x1f')]();}else if(_[_0xa55c('0x2a')]([_0xa55c('0x31'),_0xa55c('0x2b')],_0x52d37f[_0xa55c('0x2c')])&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x201941[_0xa55c('0x33')][_0x52d37f[_0xa55c('0x32')]]=_0x52d37f['content']['toString']();}else if(_0x52d37f[_0xa55c('0x2c')]===_0xa55c('0x34')&&_0x52d37f['variableName']&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x22f6b6[_0x52d37f[_0xa55c('0x35')]]&&(_0x201941[_0xa55c('0x33')][_0x52d37f[_0xa55c('0x32')]]=_0x22f6b6[_0x52d37f[_0xa55c('0x35')]][_0xa55c('0x1f')]());}else if(_0x52d37f[_0xa55c('0x2c')]===_0xa55c('0x36')&&_0x52d37f['Variable']&&_0x52d37f['Variable']['name']&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x22f6b6[_0x52d37f[_0xa55c('0x37')]['name'][_0xa55c('0x2f')]()]&&(_0x201941['custom_fields'][_0x52d37f[_0xa55c('0x32')]]=_0x22f6b6[_0x52d37f['Variable'][_0xa55c('0x38')][_0xa55c('0x2f')]()][_0xa55c('0x1f')]());}});}if(_0x201941['priority']){_0x201941[_0xa55c('0x39')]=Number(_0x201941[_0xa55c('0x39')]);}return _0x201941;}function getTicket(_0x47e93c,_0x6f9c4c,_0x194e78,_0x4d9083,_0x529ff8){logger[_0xa55c('0xb')]('Creating\x20new\x20ticket...');var _0x1e75dc=_[_0xa55c('0x3a')]({'subject':intUtil['getString'](_0x4d9083['Subjects'],_0x529ff8,'\x20'),'type':'phone','status':'new','labels':[_0xa55c('0x3b'),_0xa55c('0x3c'),_0xa55c('0x3d')][_0xa55c('0x3e')](getTags(_0x4d9083[_0xa55c('0x3f')],'name')),'description':intUtil[_0xa55c('0x40')](_0x4d9083[_0xa55c('0x41')],_0x529ff8,'\x0a'),'_links':{'assigned_user':{'href':util[_0xa55c('0xd')](_0xa55c('0x42'),_0x6f9c4c['id']),'class':_0xa55c('0x43')}},'message':{'direction':'in','body':intUtil[_0xa55c('0x40')](_0x4d9083['Descriptions'],_0x529ff8,'\x0a')}},getCustomFields(_0x4d9083[_0xa55c('0x44')],_0x529ff8));return request({'uri':util['format']('%s/customers/%d/cases',_0x47e93c[_0xa55c('0xf')],_0x194e78['id']),'method':_0xa55c('0x27'),'body':_0x1e75dc});}exports['queue']=function(_0x2bd98b,_0x508bd3,_0x5f25f7,_0x2f8449,_0x3fea03,_0x1630ac){var _0x540337,_0x1b2708;_0x1630ac[_0xa55c('0xf')]=intUtil['stripTrailingSlash'](_0x1630ac[_0xa55c('0xf')]);_0x1630ac['serverUrl']=intUtil[_0xa55c('0x45')](_0x1630ac[_0xa55c('0x46')]);if(_0x3fea03&&_0x3fea03['monitor_format']){logger[_0xa55c('0xb')](_0xa55c('0x47'),'Recording\x20is\x20enabled!');_0x508bd3[_0xa55c('0x48')]=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x1630ac['serverUrl'],_0x508bd3[_0xa55c('0x4a')],md5(_0x508bd3['uniqueid']));}else{_0x508bd3[_0xa55c('0x48')]='';}headers[_0xa55c('0x4b')]=getAuth(_0x1630ac);return getUser(_0x1630ac,_0x2f8449[_0xa55c('0x4c')])['then'](function(_0x41eab1){_0x540337=_0x41eab1;logger[_0xa55c('0xb')]('The\x20User\x20ID\x20is:',_0x540337['id']);return getEndUser(_0x1630ac,_0x508bd3[_0xa55c('0x4d')],_0x508bd3[_0xa55c('0x4e')]);})['then'](function(_0x11ff1d){_0x1b2708=_0x11ff1d;logger[_0xa55c('0xb')]('The\x20Enduser\x20ID\x20is:',_0x1b2708['id']);return getTicket(_0x1630ac,_0x540337,_0x1b2708,_0x5f25f7,_0x508bd3);})[_0xa55c('0x10')](function(_0x81cee8){if(_0x81cee8){logger[_0xa55c('0xb')](_0xa55c('0x4f'));logger['info'](_0xa55c('0x50'),_0x81cee8['id']);switch(_0x1630ac['type']){case _0xa55c('0x51'):logger[_0xa55c('0xb')](_0xa55c('0x47'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2f8449['name']),_0xa55c('0x53'),{'recordId':_0x81cee8['id']});break;case _0xa55c('0x54'):logger[_0xa55c('0xb')](_0xa55c('0x47'),_0xa55c('0x55'));emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2f8449[_0xa55c('0x38')]),_0xa55c('0x56'),{'uri':util[_0xa55c('0xd')]('https://xcally.desk.com/web/agent/case/%d',_0x81cee8['id'])});break;default:logger[_0xa55c('0x57')](_0xa55c('0x47'),_0xa55c('0x58'));}}})['catch'](function(_0x4c3095){console[_0xa55c('0x57')](_0x4c3095);logger['error'](_0xa55c('0x47'),JSON['stringify'](_0x4c3095));});};exports[_0xa55c('0x59')]=function(_0x228df4,_0x181802,_0x3f9313,_0x2ecf79,_0x5b1cf3,_0x44b7c1,_0x4607ca){var _0x4b85cc,_0x3929a6;_0x44b7c1[_0xa55c('0xf')]=intUtil[_0xa55c('0x45')](_0x44b7c1[_0xa55c('0xf')]);_0x44b7c1['serverUrl']=intUtil['stripTrailingSlash'](_0x44b7c1[_0xa55c('0x46')]);if(_0x4607ca&&_0x4607ca[_0xa55c('0x5a')]&&_0x4607ca[_0xa55c('0x5a')]!==_0xa55c('0x5b')){logger['info'](_0xa55c('0x5c'),'Recording\x20is\x20enabled!');_0x181802[_0xa55c('0x48')]=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x44b7c1[_0xa55c('0x46')],_0x181802[_0xa55c('0x4a')],md5(_0x181802['uniqueid']));}headers[_0xa55c('0x4b')]=getAuth(_0x44b7c1);return getUser(_0x44b7c1,_0x2ecf79['email'])[_0xa55c('0x10')](function(_0x157afe){_0x4b85cc=_0x157afe;logger[_0xa55c('0xb')](_0xa55c('0x5d'),_0x4b85cc['id']);return getEndUser(_0x44b7c1,_0x181802[_0xa55c('0x5e')],_0x181802[_0xa55c('0x5f')]);})[_0xa55c('0x10')](function(_0x53e2be){_0x3929a6=_0x53e2be;logger[_0xa55c('0xb')](_0xa55c('0x60'),_0x3929a6['id']);return getTicket(_0x44b7c1,_0x4b85cc,_0x3929a6,_0x3f9313,_0x181802);})[_0xa55c('0x10')](function(_0x23a30e){if(_0x23a30e){logger[_0xa55c('0xb')]('Ticket\x20created!');logger[_0xa55c('0xb')](_0xa55c('0x50'),_0x23a30e['id']);switch(_0x44b7c1[_0xa55c('0x2c')]){case _0xa55c('0x51'):logger[_0xa55c('0xb')]('[QUEUE]',_0xa55c('0x61'));emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2ecf79[_0xa55c('0x38')]),_0xa55c('0x53'),{'recordId':_0x23a30e['id']});break;case'newTab':logger[_0xa55c('0xb')]('[QUEUE]',_0xa55c('0x55'));emit(util['format'](_0xa55c('0x52'),_0x2ecf79['name']),_0xa55c('0x56'),{'uri':util[_0xa55c('0xd')](_0xa55c('0x62'),_0x44b7c1[_0xa55c('0xf')],_0x23a30e['id'])});break;default:logger[_0xa55c('0x57')](_0xa55c('0x5c'),_0xa55c('0x58'));}}})[_0xa55c('0x63')](function(_0x14b515){logger[_0xa55c('0x57')]('[OUTBOUND]',JSON[_0xa55c('0x17')](_0x14b515));});};exports[_0xa55c('0x64')]=function(_0x4ef914,_0x18b928,_0x2b8b88,_0x3e3b4b,_0x9fe234,_0x1b8b06){var _0xa38271,_0x3cef1f;_0x1b8b06[_0xa55c('0xf')]=intUtil['stripTrailingSlash'](_0x1b8b06[_0xa55c('0xf')]);_0x1b8b06[_0xa55c('0x46')]=intUtil[_0xa55c('0x45')](_0x1b8b06[_0xa55c('0x46')]);if(_0x9fe234&&_0x9fe234[_0xa55c('0x65')]){logger[_0xa55c('0xb')]('['+_0x18b928[_0xa55c('0x66')][_0xa55c('0x67')]()+']',_0xa55c('0x68'));_0x18b928['recordingURL']=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x1b8b06[_0xa55c('0x46')],_0x18b928[_0xa55c('0x4a')],md5(_0x18b928[_0xa55c('0x4a')]));}else{_0x18b928[_0xa55c('0x48')]='';}headers[_0xa55c('0x4b')]=getAuth(_0x1b8b06);return getUser(_0x1b8b06)[_0xa55c('0x10')](function(_0x2e4cf7){_0xa38271=_0x2e4cf7;logger[_0xa55c('0xb')](_0xa55c('0x5d'),_0xa38271['id']);return getEndUser(_0x1b8b06,_0x18b928['calleridname'],_0x18b928[_0xa55c('0x4e')]);})['then'](function(_0x1228a4){_0x3cef1f=_0x1228a4;logger[_0xa55c('0xb')](_0xa55c('0x60'),_0x3cef1f['id']);return getTicket(_0x1b8b06,_0xa38271,_0x3cef1f,_0x2b8b88,_0x18b928);})['then'](function(_0x4d9722){if(_0x4d9722){logger[_0xa55c('0xb')](_0xa55c('0x4f'));logger[_0xa55c('0xb')](_0xa55c('0x50'),_0x4d9722['id']);}})['catch'](function(_0x149cb9){logger[_0xa55c('0x57')]('['+_0x18b928[_0xa55c('0x66')][_0xa55c('0x67')]()+']',JSON[_0xa55c('0x17')](_0x149cb9));});}; \ No newline at end of file +var _0x5fc3=['map','forEach','includes','string','picklist','nameField','customField','toLowerCase','content','type','custom_fields','variable','variableName','idField','Variable','name','priority','Creating\x20new\x20ticket...','merge','getString','phone','new','xCALLY','Motion','CTI','concat','Descriptions','/api/v2/users/%d','user','Fields','%s/customers/%d/cases','queue','stripTrailingSlash','serverUrl','monitor_format','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','error','Desk\x20account\x20type\x20not\x20recognized','outbound','recordingFormat','none','recordingURL','The\x20User\x20ID\x20is:','destcalleridnum','Ticket\x20created!','[OUTBOUND]','unmanaged','lastevent','Recording\x20is\x20enabled!','lodash','request-promise','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','emit','application/json','info','Getting\x20agent\x20with\x20email','%s/users','remoteUri','total_entries','entries','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','format','%s/users/me','debug','stringify','authType','%s:%s','username','token','%s/token:%s','Basic\x20%s','toString','base64','Searching\x20enduser\x20with\x20phone','then','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','length'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x5fc3,0xa8));var _0x35fc=function(_0x2b9cf5,_0x2a7804){_0x2b9cf5=_0x2b9cf5-0x0;var _0xd0cf15=_0x5fc3[_0x2b9cf5];return _0xd0cf15;};'use strict';var _=require(_0x35fc('0x0'));var rp=require(_0x35fc('0x1'));var md5=require('md5');var util=require(_0x35fc('0x2'));var Redis=require(_0x35fc('0x3'));var intUtil=require(_0x35fc('0x4'));var config=require(_0x35fc('0x5'));var logger=require(_0x35fc('0x6'))('desk');config[_0x35fc('0x7')]=_[_0x35fc('0x8')](config[_0x35fc('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x35fc('0x7')]));function emit(_0x508b32,_0x16e153,_0x27524f){io['to'](_0x508b32)[_0x35fc('0x9')](_0x16e153,_0x27524f);}var headers={'Content-Type':_0x35fc('0xa'),'Accept':_0x35fc('0xa')};function getUser(_0xf9d3a6,_0x2051ab){if(intUtil['validateEmail'](_0x2051ab)===!![]){logger[_0x35fc('0xb')](_0x35fc('0xc'),_0x2051ab);return request({'uri':util['format'](_0x35fc('0xd'),_0xf9d3a6[_0x35fc('0xe')])})['then'](function(_0xda83fb){if(_0xda83fb[_0x35fc('0xf')]){return _['find'](_0xda83fb['_embedded'][_0x35fc('0x10')],{'email':_0x2051ab});}})['then'](function(_0x397738){if(_0x397738){logger[_0x35fc('0xb')](_0x35fc('0x11'));return _0x397738;}else{logger[_0x35fc('0xb')](_0x35fc('0x12'));return request({'uri':util['format']('%s/users/me',_0xf9d3a6['remoteUri'])});}});}else{logger['info'](_0x35fc('0x13'));return request({'uri':util[_0x35fc('0x14')](_0x35fc('0x15'),_0xf9d3a6[_0x35fc('0xe')])});}}function request(_0x227a49){logger[_0x35fc('0x16')]('[HTTP]',JSON[_0x35fc('0x17')](_0x227a49));return rp(_[_0x35fc('0x8')](_0x227a49,{'method':'GET','headers':headers,'json':!![]}));}function getAuth(_0x41e165){var _0x363e47;if(_0x41e165[_0x35fc('0x18')]==='basic'){_0x363e47=util[_0x35fc('0x14')](_0x35fc('0x19'),_0x41e165[_0x35fc('0x1a')],_0x41e165['password']);}else if(_0x41e165[_0x35fc('0x18')]===_0x35fc('0x1b')){_0x363e47=util[_0x35fc('0x14')](_0x35fc('0x1c'),_0x41e165[_0x35fc('0x1a')],_0x41e165[_0x35fc('0x1b')]);}return util[_0x35fc('0x14')](_0x35fc('0x1d'),new Buffer(_0x363e47)[_0x35fc('0x1e')](_0x35fc('0x1f')));}function getEndUser(_0x5bd2b8,_0x323aee,_0xd5399f){logger[_0x35fc('0xb')](_0x35fc('0x20'),_0xd5399f);return request({'uri':util[_0x35fc('0x14')]('%s/customers/search',_0x5bd2b8[_0x35fc('0xe')]),'qs':{'phone':_0xd5399f}})[_0x35fc('0x21')](function(_0x561bf8){if(_0x561bf8[_0x35fc('0xf')]){logger[_0x35fc('0xb')](_0x35fc('0x22'));return _0x561bf8['_embedded'][_0x35fc('0x10')][0x0];}else{logger['info'](_0x35fc('0x23'));return request({'uri':util[_0x35fc('0x14')]('%s/customers',_0x5bd2b8['remoteUri']),'method':_0x35fc('0x24'),'body':{'first_name':_0x323aee,'title':_0x323aee,'phone_numbers':[{'type':'work','value':_0xd5399f}]}});}});}function getTags(_0x274208,_0x1a5d92){var _0x57001c=[];if(_0x274208&&_0x274208[_0x35fc('0x25')]>0x0){_0x57001c=_[_0x35fc('0x26')](_0x274208,_0x1a5d92);}return _0x57001c;}function getCustomFields(_0x383837,_0x9f3c8a){var _0x3735da=[];var _0x134dfa={'custom_fields':{}};if(_0x383837[_0x35fc('0x25')]>0x0){_[_0x35fc('0x27')](_0x383837,function(_0x54aedc){if(_[_0x35fc('0x28')]([_0x35fc('0x29'),_0x35fc('0x2a')],_0x54aedc['type'])&&_0x54aedc[_0x35fc('0x2b')]&&!_0x54aedc[_0x35fc('0x2c')]){_0x134dfa[_0x54aedc[_0x35fc('0x2b')][_0x35fc('0x2d')]()]=_0x54aedc[_0x35fc('0x2e')][_0x35fc('0x1e')]();}else if(_[_0x35fc('0x28')]([_0x35fc('0x29'),_0x35fc('0x2a')],_0x54aedc[_0x35fc('0x2f')])&&_0x54aedc['idField']&&_0x54aedc['customField']){_0x134dfa[_0x35fc('0x30')][_0x54aedc['idField']]=_0x54aedc[_0x35fc('0x2e')][_0x35fc('0x1e')]();}else if(_0x54aedc[_0x35fc('0x2f')]===_0x35fc('0x31')&&_0x54aedc[_0x35fc('0x32')]&&_0x54aedc[_0x35fc('0x33')]&&_0x54aedc['customField']){_0x9f3c8a[_0x54aedc[_0x35fc('0x32')]]&&(_0x134dfa[_0x35fc('0x30')][_0x54aedc[_0x35fc('0x33')]]=_0x9f3c8a[_0x54aedc[_0x35fc('0x32')]][_0x35fc('0x1e')]());}else if(_0x54aedc[_0x35fc('0x2f')]==='customVariable'&&_0x54aedc[_0x35fc('0x34')]&&_0x54aedc[_0x35fc('0x34')][_0x35fc('0x35')]&&_0x54aedc['idField']&&_0x54aedc[_0x35fc('0x2c')]){_0x9f3c8a[_0x54aedc['Variable'][_0x35fc('0x35')][_0x35fc('0x2d')]()]&&(_0x134dfa[_0x35fc('0x30')][_0x54aedc[_0x35fc('0x33')]]=_0x9f3c8a[_0x54aedc['Variable']['name']['toLowerCase']()][_0x35fc('0x1e')]());}});}if(_0x134dfa['priority']){_0x134dfa[_0x35fc('0x36')]=Number(_0x134dfa['priority']);}return _0x134dfa;}function getTicket(_0x9c6b65,_0x1f2d66,_0x2ca9ac,_0x22b724,_0x1c10e0){logger[_0x35fc('0xb')](_0x35fc('0x37'));var _0x4ec0dc=_[_0x35fc('0x38')]({'subject':intUtil[_0x35fc('0x39')](_0x22b724['Subjects'],_0x1c10e0,'\x20'),'type':_0x35fc('0x3a'),'status':_0x35fc('0x3b'),'labels':[_0x35fc('0x3c'),_0x35fc('0x3d'),_0x35fc('0x3e')][_0x35fc('0x3f')](getTags(_0x22b724['Tags'],_0x35fc('0x35'))),'description':intUtil[_0x35fc('0x39')](_0x22b724[_0x35fc('0x40')],_0x1c10e0,'\x0a'),'_links':{'assigned_user':{'href':util['format'](_0x35fc('0x41'),_0x1f2d66['id']),'class':_0x35fc('0x42')}},'message':{'direction':'in','body':intUtil['getString'](_0x22b724[_0x35fc('0x40')],_0x1c10e0,'\x0a')}},getCustomFields(_0x22b724[_0x35fc('0x43')],_0x1c10e0));return request({'uri':util[_0x35fc('0x14')](_0x35fc('0x44'),_0x9c6b65[_0x35fc('0xe')],_0x2ca9ac['id']),'method':_0x35fc('0x24'),'body':_0x4ec0dc});}exports[_0x35fc('0x45')]=function(_0x3ec51f,_0x5a7e9e,_0x596e83,_0x210d5d,_0x36fcf9,_0x4fdc6d){var _0x5c2e5c,_0x4ff202;_0x4fdc6d[_0x35fc('0xe')]=intUtil[_0x35fc('0x46')](_0x4fdc6d['remoteUri']);_0x4fdc6d[_0x35fc('0x47')]=intUtil[_0x35fc('0x46')](_0x4fdc6d[_0x35fc('0x47')]);if(_0x36fcf9&&_0x36fcf9[_0x35fc('0x48')]){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x5a7e9e['recordingURL']=util['format'](_0x35fc('0x49'),_0x4fdc6d[_0x35fc('0x47')],_0x5a7e9e['uniqueid'],md5(_0x5a7e9e[_0x35fc('0x4a')]));}else{_0x5a7e9e['recordingURL']='';}headers[_0x35fc('0x4b')]=getAuth(_0x4fdc6d);return getUser(_0x4fdc6d,_0x210d5d[_0x35fc('0x4c')])[_0x35fc('0x21')](function(_0x2de5d1){_0x5c2e5c=_0x2de5d1;logger[_0x35fc('0xb')]('The\x20User\x20ID\x20is:',_0x5c2e5c['id']);return getEndUser(_0x4fdc6d,_0x5a7e9e[_0x35fc('0x4d')],_0x5a7e9e[_0x35fc('0x4e')]);})['then'](function(_0x18181b){_0x4ff202=_0x18181b;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0x4ff202['id']);return getTicket(_0x4fdc6d,_0x5c2e5c,_0x4ff202,_0x596e83,_0x5a7e9e);})[_0x35fc('0x21')](function(_0x5bc8c3){if(_0x5bc8c3){logger[_0x35fc('0xb')]('Ticket\x20created!');logger['info'](_0x35fc('0x50'),_0x5bc8c3['id']);switch(_0x4fdc6d[_0x35fc('0x2f')]){case _0x35fc('0x51'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x53'));emit(util[_0x35fc('0x14')](_0x35fc('0x54'),_0x210d5d['name']),_0x35fc('0x55'),{'recordId':_0x5bc8c3['id']});break;case _0x35fc('0x56'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x57'));emit(util[_0x35fc('0x14')](_0x35fc('0x54'),_0x210d5d[_0x35fc('0x35')]),_0x35fc('0x58'),{'uri':util[_0x35fc('0x14')](_0x35fc('0x59'),_0x5bc8c3['id'])});break;default:logger[_0x35fc('0x5a')](_0x35fc('0x52'),_0x35fc('0x5b'));}}})['catch'](function(_0x553ed6){console[_0x35fc('0x5a')](_0x553ed6);logger[_0x35fc('0x5a')](_0x35fc('0x52'),JSON[_0x35fc('0x17')](_0x553ed6));});};exports[_0x35fc('0x5c')]=function(_0x3e6494,_0x4a4798,_0x4f024c,_0x388521,_0x19b2ce,_0x395d63,_0x38bc78){var _0x5b2595,_0x467980;_0x395d63[_0x35fc('0xe')]=intUtil['stripTrailingSlash'](_0x395d63[_0x35fc('0xe')]);_0x395d63[_0x35fc('0x47')]=intUtil['stripTrailingSlash'](_0x395d63[_0x35fc('0x47')]);if(_0x38bc78&&_0x38bc78[_0x35fc('0x5d')]&&_0x38bc78[_0x35fc('0x5d')]!==_0x35fc('0x5e')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x4a4798[_0x35fc('0x5f')]=util[_0x35fc('0x14')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x395d63[_0x35fc('0x47')],_0x4a4798[_0x35fc('0x4a')],md5(_0x4a4798[_0x35fc('0x4a')]));}headers[_0x35fc('0x4b')]=getAuth(_0x395d63);return getUser(_0x395d63,_0x388521[_0x35fc('0x4c')])['then'](function(_0x2d9d45){_0x5b2595=_0x2d9d45;logger[_0x35fc('0xb')](_0x35fc('0x60'),_0x5b2595['id']);return getEndUser(_0x395d63,_0x4a4798['destcalleridname'],_0x4a4798[_0x35fc('0x61')]);})[_0x35fc('0x21')](function(_0x47fb1a){_0x467980=_0x47fb1a;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0x467980['id']);return getTicket(_0x395d63,_0x5b2595,_0x467980,_0x4f024c,_0x4a4798);})[_0x35fc('0x21')](function(_0x1c4c33){if(_0x1c4c33){logger[_0x35fc('0xb')](_0x35fc('0x62'));logger[_0x35fc('0xb')](_0x35fc('0x50'),_0x1c4c33['id']);switch(_0x395d63['type']){case _0x35fc('0x51'):logger[_0x35fc('0xb')](_0x35fc('0x52'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0x35fc('0x14')]('user:%s',_0x388521['name']),'trigger:desk:display',{'recordId':_0x1c4c33['id']});break;case _0x35fc('0x56'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x57'));emit(util[_0x35fc('0x14')]('user:%s',_0x388521['name']),'trigger:browser:url',{'uri':util['format']('%s/agent/tickets/%s',_0x395d63[_0x35fc('0xe')],_0x1c4c33['id'])});break;default:logger[_0x35fc('0x5a')](_0x35fc('0x63'),_0x35fc('0x5b'));}}})['catch'](function(_0x458eb8){logger[_0x35fc('0x5a')](_0x35fc('0x63'),JSON[_0x35fc('0x17')](_0x458eb8));});};exports[_0x35fc('0x64')]=function(_0x1d0e53,_0x27071b,_0x2127e0,_0x462ceb,_0x4c3ace,_0x35d7c8){var _0x47c75f,_0xfbd737;_0x35d7c8[_0x35fc('0xe')]=intUtil[_0x35fc('0x46')](_0x35d7c8[_0x35fc('0xe')]);_0x35d7c8['serverUrl']=intUtil[_0x35fc('0x46')](_0x35d7c8['serverUrl']);if(_0x4c3ace&&_0x4c3ace['monitor_format']){logger['info']('['+_0x27071b[_0x35fc('0x65')]['toUpperCase']()+']',_0x35fc('0x66'));_0x27071b['recordingURL']=util[_0x35fc('0x14')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x35d7c8[_0x35fc('0x47')],_0x27071b[_0x35fc('0x4a')],md5(_0x27071b[_0x35fc('0x4a')]));}else{_0x27071b[_0x35fc('0x5f')]='';}headers['Authorization']=getAuth(_0x35d7c8);return getUser(_0x35d7c8)[_0x35fc('0x21')](function(_0x1e2214){_0x47c75f=_0x1e2214;logger[_0x35fc('0xb')]('The\x20User\x20ID\x20is:',_0x47c75f['id']);return getEndUser(_0x35d7c8,_0x27071b[_0x35fc('0x4d')],_0x27071b[_0x35fc('0x4e')]);})[_0x35fc('0x21')](function(_0x3c1b56){_0xfbd737=_0x3c1b56;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0xfbd737['id']);return getTicket(_0x35d7c8,_0x47c75f,_0xfbd737,_0x2127e0,_0x27071b);})[_0x35fc('0x21')](function(_0x4464d5){if(_0x4464d5){logger['info'](_0x35fc('0x62'));logger[_0x35fc('0xb')](_0x35fc('0x50'),_0x4464d5['id']);}})['catch'](function(_0x1c88d8){logger[_0x35fc('0x5a')]('['+_0x27071b['lastevent']['toUpperCase']()+']',JSON[_0x35fc('0x17')](_0x1c88d8));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index e4e0840..81c6863 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 _0xa889=['\x20eq\x20\x27','replace','%2b','length','contactid',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','includes','picklist','type','nameField','customField','idField','indexOf','content','ticketType','incident','incidents','assign','getString','Subjects','Descriptions','/contacts(','Fields','phonecall','callDirection','queue','phonecalls','odata-entityid','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','stripTrailingSlash','data7','serverUrl','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','unmanaged','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','./util','md5','../../../../config/logger','dynamics365','../../../../config/environment','defaults','redis','localhost','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','tenantId','data2','resolve','POST','clientId','password','clientSecret','then','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','validateEmail','userEmail','email','internalemailaddress','info',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','username','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','/systemusers(','body','headers','substring','lastIndexOf','enduserId','telephone1','&$filter='];(function(_0x3b6bb4,_0x2798e7){var _0x53f8a0=function(_0x55fbd5){while(--_0x55fbd5){_0x3b6bb4['push'](_0x3b6bb4['shift']());}};_0x53f8a0(++_0x2798e7);}(_0xa889,0xb5));var _0x9a88=function(_0x5bbe70,_0x59d46e){_0x5bbe70=_0x5bbe70-0x0;var _0x261523=_0xa889[_0x5bbe70];return _0x261523;};'use strict';var _=require(_0x9a88('0x0'));var rp=require(_0x9a88('0x1'));var util=require(_0x9a88('0x2'));var intUtil=require(_0x9a88('0x3'));var md5=require(_0x9a88('0x4'));var Redis=require('ioredis');var logger=require(_0x9a88('0x5'))(_0x9a88('0x6'));var config=require(_0x9a88('0x7'));config['redis']=_[_0x9a88('0x8')](config[_0x9a88('0x9')],{'host':_0x9a88('0xa'),'port':0x18eb});var io=require(_0x9a88('0xb'))(new Redis(config[_0x9a88('0x9')]));function getAuthToken(_0x583fb7,_0x13d6b0,_0x2b3671){if(_0x583fb7[_0x9a88('0xc')]){_0x583fb7[_0x9a88('0xd')]=_0x583fb7[_0x9a88('0xe')]['data7'];_0x583fb7[_0x9a88('0xf')]=_0x583fb7['CloudProvider'][_0x9a88('0x10')];return Promise[_0x9a88('0x11')](_0x583fb7[_0x9a88('0xe')]['data5']);}var _0x592076={'method':_0x9a88('0x12'),'uri':_0x13d6b0,'form':{'client_id':_0x583fb7[_0x9a88('0x13')],'resource':_0x583fb7[_0x9a88('0xd')],'username':_0x583fb7['username'],'password':_0x583fb7[_0x9a88('0x14')],'grant_type':'password','client_secret':_0x583fb7[_0x9a88('0x15')]},'json':!![]};return rp(_0x592076)[_0x9a88('0x16')](function(_0x27502e){return _0x27502e[_0x9a88('0x17')];})[_0x9a88('0x18')](function(_0x2bc962){logger[_0x9a88('0x19')]('['+[_0x2b3671[_0x9a88('0x1a')]()]+_0x9a88('0x1b'));return _0x2bc962[_0x9a88('0x1c')];});}function getUser(_0x18d7de,_0x287a3e,_0x1d233e,_0xf21258,_0x87e7f1,_0x5b839d){return new Promise(function(_0xf9ec43,_0x398e9a){return getAuthToken(_0x287a3e,_0xf21258,_0x5b839d)[_0x9a88('0x16')](function(_0x330869){var _0x12ba44={'method':_0x9a88('0x1d'),'uri':_0x87e7f1+_0x9a88('0x1e'),'headers':{'Authorization':_0x9a88('0x1f')+_0x330869,'OData-Version':_0x9a88('0x20')},'json':!![]};return rp(_0x12ba44);})['then'](function(_0x410e12){var _0x40dfb2=_0x410e12[_0x9a88('0x21')];var _0x257464=![];var _0x1729ae=null;if(!_['isNil'](_0x1d233e)){if(intUtil[_0x9a88('0x22')](_0x1d233e['email'])){_0x18d7de[_0x9a88('0x23')]=_0x1d233e[_0x9a88('0x24')];for(_0x1729ae=0x0;_0x1729ae<_0x40dfb2['length'];_0x1729ae++){if(_0x40dfb2[_0x1729ae][_0x9a88('0x25')]===_0x1d233e[_0x9a88('0x24')]&&!_0x40dfb2[_0x1729ae]['isdisabled']){_0x257464=!![];logger[_0x9a88('0x26')]('['+[_0x5b839d[_0x9a88('0x1a')]()]+_0x9a88('0x27')+_0x40dfb2[_0x1729ae][_0x9a88('0x28')]+'!');_0x18d7de[_0x9a88('0x29')]=_0x40dfb2[_0x1729ae]['systemuserid'];}}}}if(!_0x257464){logger[_0x9a88('0x26')]('['+[_0x5b839d[_0x9a88('0x1a')]()]+_0x9a88('0x2a'));_0x18d7de[_0x9a88('0x23')]=_0x287a3e[_0x9a88('0x2b')];for(_0x1729ae=0x0;_0x1729ae<_0x40dfb2['length'];_0x1729ae++){if(_0x40dfb2[_0x1729ae][_0x9a88('0x25')]===_0x287a3e[_0x9a88('0x2b')]){_0x18d7de[_0x9a88('0x29')]=_0x40dfb2[_0x1729ae][_0x9a88('0x28')];}}}_0xf9ec43(_0x18d7de);})[_0x9a88('0x18')](function(_0x1fde72){_0x398e9a(_0x1fde72[_0x9a88('0x1c')]);});});}function createEndUser(_0x50650b,_0x4c5dc8,_0x2067b3,_0x127623,_0x2abdab,_0x304894,_0x56bbb0){return new Promise(function(_0x14f5fc,_0x331ee9){return getAuthToken(_0x4c5dc8,_0x2067b3,_0x304894)[_0x9a88('0x16')](function(_0x57a722){var _0x4af3e5=_0x304894[_0x9a88('0x2c')]()===_0x9a88('0x2d')?_0x2abdab[_0x9a88('0x2e')]:_0x2abdab[_0x9a88('0x2f')];var _0x3d5182={'method':_0x9a88('0x12'),'uri':_0x127623+_0x9a88('0x30'),'body':{'fullname':_0x4af3e5,'firstname':_0x4af3e5,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x9a88('0x31')+_0x50650b[_0x9a88('0x29')]+')'},'headers':{'Authorization':_0x9a88('0x1f')+_0x57a722,'OData-Version':_0x9a88('0x20')},'json':!![],'resolveWithFullResponse':!![]};_0x3d5182[_0x9a88('0x32')][_0x56bbb0]=_0x4af3e5;return rp(_0x3d5182);})['then'](function(_0x460f61){var _0x161c75=_0x460f61[_0x9a88('0x33')]['odata-entityid'];var _0x37f598=_0x161c75[_0x9a88('0x34')](_0x161c75['lastIndexOf']('(')+0x1,_0x161c75[_0x9a88('0x35')](')'));_0x50650b[_0x9a88('0x36')]=_0x37f598;_0x14f5fc(_0x50650b);})[_0x9a88('0x18')](function(_0x2a4698){_0x331ee9(_0x2a4698[_0x9a88('0x1c')]);});});}function getEndUser(_0x1cc249,_0x335220,_0x876032,_0x1a979e,_0x2646cf,_0x1cc4f6,_0x1126d4,_0x2660c2){var _0x2d5b7b=_0x1cc4f6[_0x9a88('0x2c')]()===_0x9a88('0x2d')?_0x2646cf[_0x9a88('0x2e')]:_0x2646cf[_0x9a88('0x2f')];return getAuthToken(_0x335220,_0x876032,_0x1cc4f6)[_0x9a88('0x16')](function(_0x2acf97){_0x2660c2=_0x2660c2?_0x2660c2:_0x9a88('0x37');var _0x4e3eba={'method':_0x9a88('0x1d'),'uri':_0x1a979e+'contacts?$select='+_0x2660c2+_0x9a88('0x38')+_0x2660c2+_0x9a88('0x39')+_0x2d5b7b[_0x9a88('0x3a')]('+',_0x9a88('0x3b'))+'\x27','headers':{'Authorization':_0x9a88('0x1f')+_0x2acf97,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x4e3eba);})[_0x9a88('0x16')](function(_0xb795cc){var _0x79984c=![];if(!_0xb795cc)return _0x79984c;var _0x3cca2d=_0xb795cc[_0x9a88('0x21')];for(var _0x425d16=0x0;_0x425d16<_0x3cca2d[_0x9a88('0x3c')];_0x425d16++){if(_0x3cca2d[_0x425d16][_0x2660c2]===_0x2d5b7b){_0x79984c=!![];_0x1cc249[_0x9a88('0x36')]=_0x3cca2d[_0x425d16][_0x9a88('0x3d')];}}return _0x79984c;})[_0x9a88('0x16')](function(_0x428da2){if(_0x428da2)return _0x1cc249;if(_0x1126d4==='nothing'){logger['info']('['+[_0x1cc4f6[_0x9a88('0x1a')]()]+_0x9a88('0x3e'));return _0x1cc249;}return createEndUser(_0x1cc249,_0x335220,_0x876032,_0x1a979e,_0x2646cf,_0x1cc4f6,_0x2660c2)[_0x9a88('0x16')](function(_0x56b7a4){logger[_0x9a88('0x26')]('['+[_0x1cc4f6['toUpperCase']()]+_0x9a88('0x3f'),_0x56b7a4[_0x9a88('0x36')]);return _0x56b7a4;});});}function getCustomFields(_0x3e5239,_0x53cf98,_0x47ec34){var _0x72d2ed={};if(_0x3e5239[_0x9a88('0x3c')]>0x0){_[_0x9a88('0x40')](_0x3e5239,function(_0x35d05c){if(_[_0x9a88('0x41')](['string',_0x9a88('0x42')],_0x35d05c[_0x9a88('0x43')])&&_0x35d05c[_0x9a88('0x44')]&&!_0x35d05c[_0x9a88('0x45')]){var _0x192b51=_0x35d05c[_0x9a88('0x46')]['toLowerCase']();var _0x499b90=_0x192b51[_0x9a88('0x34')](0x0,_0x192b51[_0x9a88('0x47')]('_'));var _0x5131db=_0x192b51['substring'](_0x192b51[_0x9a88('0x47')]('_')+0x1);if(_0x499b90===_0x47ec34){_0x72d2ed[_0x5131db]=_0x35d05c[_0x9a88('0x48')];}}});}return _0x72d2ed;}function getTicket(_0x5c286e,_0xe82e00,_0x2904bd,_0x323715,_0x3ef98d,_0x5c0d7d,_0x230323){return new Promise(function(_0x386e5b,_0x4ee5d6){var _0x5ae686;return getAuthToken(_0xe82e00,_0x2904bd,_0x230323)['then'](function(_0x8a6c8){if(_0x5c0d7d[_0x9a88('0x49')]===_0x9a88('0x4a')){_0x5ae686={'method':_0x9a88('0x12'),'uri':_0x323715+_0x9a88('0x4b'),'body':Object[_0x9a88('0x4c')]({},{'title':intUtil[_0x9a88('0x4d')](_0x5c0d7d[_0x9a88('0x4e')],_0x3ef98d,'\x20'),'description':intUtil[_0x9a88('0x4d')](_0x5c0d7d[_0x9a88('0x4f')],_0x3ef98d,'\x0a'),'customerid_contact@odata.bind':_0x5c286e['enduserId']?_0x9a88('0x50')+_0x5c286e[_0x9a88('0x36')]+')':undefined,'ownerid@odata.bind':_0x9a88('0x31')+_0x5c286e[_0x9a88('0x29')]+')','caseorigincode':'1'},getCustomFields(_0x5c0d7d[_0x9a88('0x51')],_0x3ef98d,_0x5c0d7d['ticketType'])),'headers':{'Authorization':_0x9a88('0x1f')+_0x8a6c8,'OData-Version':_0x9a88('0x20')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x5c0d7d['ticketType']===_0x9a88('0x52')){var _0x289810=_0x5c286e[_0x9a88('0x36')]?[{'partyid_systemuser@odata.bind':'/systemusers('+_0x5c286e[_0x9a88('0x29')]+')','participationtypemask':_0x5c286e[_0x9a88('0x53')]===_0x9a88('0x54')?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x5c286e[_0x9a88('0x36')]+')','participationtypemask':_0x5c286e[_0x9a88('0x53')]==='queue'?0x1:0x2}]:[{'partyid_systemuser@odata.bind':'/systemusers('+_0x5c286e[_0x9a88('0x29')]+')','participationtypemask':_0x5c286e[_0x9a88('0x53')]==='queue'?0x2:0x1}];_0x5ae686={'method':'POST','uri':_0x323715+_0x9a88('0x55'),'body':Object['assign']({},{'subject':intUtil[_0x9a88('0x4d')](_0x5c0d7d[_0x9a88('0x4e')],_0x3ef98d,'\x20'),'phonenumber':String(_0x3ef98d[_0x9a88('0x2f')]),'description':intUtil[_0x9a88('0x4d')](_0x5c0d7d[_0x9a88('0x4f')],_0x3ef98d,'\x0a'),'regardingobjectid_contact@odata.bind':_0x5c286e['enduserId']?'/contacts('+_0x5c286e[_0x9a88('0x36')]+')':undefined,'ownerid@odata.bind':_0x9a88('0x31')+_0x5c286e[_0x9a88('0x29')]+')','directioncode':_0x5c286e[_0x9a88('0x53')]===_0x9a88('0x54')?![]:!![],'phonecall_activity_parties':_0x289810},getCustomFields(_0x5c0d7d[_0x9a88('0x51')],_0x3ef98d,_0x5c0d7d[_0x9a88('0x49')])),'headers':{'Authorization':'Bearer\x20'+_0x8a6c8,'OData-Version':_0x9a88('0x20')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x5ae686);})['then'](function(_0x2a0c63){var _0x33e0fb=_0x2a0c63[_0x9a88('0x33')][_0x9a88('0x56')];var _0x492708=_0x33e0fb[_0x9a88('0x34')](_0x33e0fb[_0x9a88('0x35')]('(')+0x1,_0x33e0fb['lastIndexOf'](')'));_0x5c286e[_0x9a88('0x57')]=_0x492708;_0x386e5b(_0x5c286e);})['catch'](function(_0x352908){_0x4ee5d6(_0x352908[_0x9a88('0x1c')]);});});}function emit(_0x5b69ec,_0x4f416c,_0x42d2b5,_0xf19a6b){var _0x52b67f={'uri':util[_0x9a88('0x58')](_0x9a88('0x59'),_0x5b69ec,_0x42d2b5,_0xf19a6b)};io['to'](util[_0x9a88('0x58')](_0x9a88('0x5a'),_0x4f416c))[_0x9a88('0x5b')](_0x9a88('0x5c'),_0x52b67f);}exports['cs']=function(_0x344248,_0x11d2d6,_0x4742f8,_0x253c59,_0xfdd4e3,_0x196e4f,_0x2c9d02,_0x120499){var _0x586b30={};_0x196e4f[_0x9a88('0xd')]=_0x196e4f[_0x9a88('0xc')]?intUtil[_0x9a88('0x5d')](_0x196e4f['CloudProvider'][_0x9a88('0x5e')]):intUtil[_0x9a88('0x5d')](_0x196e4f[_0x9a88('0xd')]);_0x196e4f[_0x9a88('0x5f')]=intUtil[_0x9a88('0x5d')](_0x196e4f[_0x9a88('0x5f')]);_0x586b30[_0x9a88('0x53')]=_0x120499==='queue'||_0x120499==='unmanaged'?_0x9a88('0x54'):'outbound';var _0x4baf4a=_0x196e4f[_0x9a88('0xc')]?util['format'](_0x9a88('0x60'),_0x196e4f[_0x9a88('0xe')][_0x9a88('0x5e')]):util[_0x9a88('0x58')](_0x9a88('0x60'),_0x196e4f[_0x9a88('0xd')]);var _0x322c68=util[_0x9a88('0x58')](_0x9a88('0x61'),_0x196e4f[_0x9a88('0xf')]);var _0x49cdf9=util[_0x9a88('0x58')](_0x9a88('0x62'),_0x196e4f['serverUrl'],_0x11d2d6[_0x9a88('0x63')],md5(_0x11d2d6[_0x9a88('0x63')]));if(_0xfdd4e3&&_0xfdd4e3['monitor_format']){logger['info'](_0x9a88('0x64'),_0x9a88('0x65'));_0x11d2d6[_0x9a88('0x66')]=_0x49cdf9;}else if(_0x2c9d02&&_0x2c9d02[_0x9a88('0x67')]&&_0x2c9d02[_0x9a88('0x67')]!==_0x9a88('0x68')){logger[_0x9a88('0x26')](_0x9a88('0x69'),'Recording\x20is\x20enabled!');_0x11d2d6[_0x9a88('0x66')]=_0x49cdf9;}else{_0x11d2d6[_0x9a88('0x66')]='';}return getUser(_0x586b30,_0x196e4f,_0x253c59,_0x322c68,_0x4baf4a,_0x120499)[_0x9a88('0x16')](function(_0x3e9e4a){logger[_0x9a88('0x26')]('['+_0x120499[_0x9a88('0x1a')]()+_0x9a88('0x6a'),_0x3e9e4a[_0x9a88('0x29')]);logger[_0x9a88('0x26')]('['+_0x120499['toUpperCase']()+']\x20The\x20User\x20email\x20is:',_0x3e9e4a[_0x9a88('0x23')]);return getEndUser(_0x3e9e4a,_0x196e4f,_0x322c68,_0x4baf4a,_0x11d2d6,_0x120499,_0x4742f8[_0x9a88('0x6b')],_0x4742f8[_0x9a88('0x6c')]);})[_0x9a88('0x16')](function(_0x5be273){logger[_0x9a88('0x26')]('['+_0x120499['toUpperCase']()+_0x9a88('0x6d'),_0x5be273[_0x9a88('0x36')]);logger['info']('['+_0x120499[_0x9a88('0x1a')]()+_0x9a88('0x6e'),_0x11d2d6[_0x9a88('0x2f')]);return getTicket(_0x5be273,_0x196e4f,_0x322c68,_0x4baf4a,_0x11d2d6,_0x4742f8,_0x120499);})[_0x9a88('0x16')](function(_0x561967){logger[_0x9a88('0x26')](util[_0x9a88('0x58')]('['+_0x120499[_0x9a88('0x1a')]()+_0x9a88('0x6f'),_0x4742f8['ticketType'],_0x561967[_0x9a88('0x57')]));logger[_0x9a88('0x26')](util[_0x9a88('0x58')]('['+_0x120499['toUpperCase']()+_0x9a88('0x70'),_0x120499));if(_0x120499!==_0x9a88('0x71')&&_0x4742f8[_0x9a88('0x72')]){logger[_0x9a88('0x26')]('['+_0x120499[_0x9a88('0x1a')]()+']',_0x9a88('0x73'));emit(_0x196e4f[_0x9a88('0xd')],_0x253c59[_0x9a88('0x74')],_0x4742f8[_0x9a88('0x49')],_0x561967[_0x9a88('0x57')]);}})[_0x9a88('0x18')](function(_0x191eb2){logger[_0x9a88('0x19')]('['+_0x120499[_0x9a88('0x1a')]()+_0x9a88('0x75'),_0x191eb2[_0x9a88('0x1c')]);console[_0x9a88('0x19')](_0x9a88('0x76'),_0x191eb2);});}; \ No newline at end of file +var _0xbca5=['stripTrailingSlash','data7','serverUrl','unmanaged','https://login.microsoftonline.com/%s/oauth2/token','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','./util','md5','ioredis','../../../../config/logger','../../../../config/environment','redis','defaults','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','tenantId','data2','resolve','data5','POST','clientId','username','password','then','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','value','isNil','email','isdisabled','systemuserid','info',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userEmail','length','internalemailaddress','userId','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','4.0','body','odata-entityid','substring','lastIndexOf','enduserId','telephone1','contacts?$select=','\x20eq\x20\x27','replace','contactid','nothing',']\x20Enduser\x20created!','includes','picklist','nameField','customField','idField','indexOf','content','ticketType','incident','assign','getString','/contacts(','/systemusers(','Fields','phonecall','callDirection','queue','Subjects','headers','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','emit'];(function(_0x39d36e,_0x278a99){var _0x47b675=function(_0xc24e88){while(--_0xc24e88){_0x39d36e['push'](_0x39d36e['shift']());}};_0x47b675(++_0x278a99);}(_0xbca5,0x7f));var _0x5bca=function(_0x4544c8,_0x5de2d7){_0x4544c8=_0x4544c8-0x0;var _0x5afe0e=_0xbca5[_0x4544c8];return _0x5afe0e;};'use strict';var _=require(_0x5bca('0x0'));var rp=require(_0x5bca('0x1'));var util=require(_0x5bca('0x2'));var intUtil=require(_0x5bca('0x3'));var md5=require(_0x5bca('0x4'));var Redis=require(_0x5bca('0x5'));var logger=require(_0x5bca('0x6'))('dynamics365');var config=require(_0x5bca('0x7'));config[_0x5bca('0x8')]=_[_0x5bca('0x9')](config[_0x5bca('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x5bca('0xa'))(new Redis(config[_0x5bca('0x8')]));function getAuthToken(_0x2ee48f,_0x593dcb,_0x5a3f58){if(_0x2ee48f[_0x5bca('0xb')]){_0x2ee48f[_0x5bca('0xc')]=_0x2ee48f[_0x5bca('0xd')]['data7'];_0x2ee48f[_0x5bca('0xe')]=_0x2ee48f['CloudProvider'][_0x5bca('0xf')];return Promise[_0x5bca('0x10')](_0x2ee48f['CloudProvider'][_0x5bca('0x11')]);}var _0x5de381={'method':_0x5bca('0x12'),'uri':_0x593dcb,'form':{'client_id':_0x2ee48f[_0x5bca('0x13')],'resource':_0x2ee48f[_0x5bca('0xc')],'username':_0x2ee48f[_0x5bca('0x14')],'password':_0x2ee48f[_0x5bca('0x15')],'grant_type':_0x5bca('0x15'),'client_secret':_0x2ee48f['clientSecret']},'json':!![]};return rp(_0x5de381)[_0x5bca('0x16')](function(_0x48fc58){return _0x48fc58['access_token'];})[_0x5bca('0x17')](function(_0x32e9a1){logger[_0x5bca('0x18')]('['+[_0x5a3f58[_0x5bca('0x19')]()]+_0x5bca('0x1a'));return _0x32e9a1[_0x5bca('0x1b')];});}function getUser(_0x5626be,_0x41afe0,_0x4adc94,_0x3bb8b8,_0x9905f6,_0x21ec66){return new Promise(function(_0x35b8b4,_0x2136b8){return getAuthToken(_0x41afe0,_0x3bb8b8,_0x21ec66)[_0x5bca('0x16')](function(_0x1171df){var _0x484a65={'method':_0x5bca('0x1c'),'uri':_0x9905f6+_0x5bca('0x1d'),'headers':{'Authorization':_0x5bca('0x1e')+_0x1171df,'OData-Version':'4.0'},'json':!![]};return rp(_0x484a65);})[_0x5bca('0x16')](function(_0x5547f0){var _0x3696f1=_0x5547f0[_0x5bca('0x1f')];var _0xd8dc19=![];var _0x9d3960=null;if(!_[_0x5bca('0x20')](_0x4adc94)){if(intUtil['validateEmail'](_0x4adc94[_0x5bca('0x21')])){_0x5626be['userEmail']=_0x4adc94['email'];for(_0x9d3960=0x0;_0x9d3960<_0x3696f1['length'];_0x9d3960++){if(_0x3696f1[_0x9d3960]['internalemailaddress']===_0x4adc94[_0x5bca('0x21')]&&!_0x3696f1[_0x9d3960][_0x5bca('0x22')]){_0xd8dc19=!![];logger['info']('['+[_0x21ec66['toUpperCase']()]+']\x20Agent\x20found\x20'+_0x3696f1[_0x9d3960][_0x5bca('0x23')]+'!');_0x5626be['userId']=_0x3696f1[_0x9d3960][_0x5bca('0x23')];}}}}if(!_0xd8dc19){logger[_0x5bca('0x24')]('['+[_0x21ec66[_0x5bca('0x19')]()]+_0x5bca('0x25'));_0x5626be[_0x5bca('0x26')]=_0x41afe0['username'];for(_0x9d3960=0x0;_0x9d3960<_0x3696f1[_0x5bca('0x27')];_0x9d3960++){if(_0x3696f1[_0x9d3960][_0x5bca('0x28')]===_0x41afe0[_0x5bca('0x14')]){_0x5626be[_0x5bca('0x29')]=_0x3696f1[_0x9d3960]['systemuserid'];}}}_0x35b8b4(_0x5626be);})[_0x5bca('0x17')](function(_0x4b533f){_0x2136b8(_0x4b533f['message']);});});}function createEndUser(_0x5a2b53,_0xb1f5a0,_0x1e669f,_0x38328f,_0x4817ab,_0x18f7ce,_0x2cb0be){return new Promise(function(_0x47cab1,_0x38107a){return getAuthToken(_0xb1f5a0,_0x1e669f,_0x18f7ce)[_0x5bca('0x16')](function(_0x4b9f9d){var _0x4f94b2=_0x18f7ce[_0x5bca('0x2a')]()===_0x5bca('0x2b')?_0x4817ab[_0x5bca('0x2c')]:_0x4817ab[_0x5bca('0x2d')];var _0x505886={'method':_0x5bca('0x12'),'uri':_0x38328f+_0x5bca('0x2e'),'body':{'fullname':_0x4f94b2,'firstname':_0x4f94b2,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x5a2b53[_0x5bca('0x29')]+')'},'headers':{'Authorization':_0x5bca('0x1e')+_0x4b9f9d,'OData-Version':_0x5bca('0x2f')},'json':!![],'resolveWithFullResponse':!![]};_0x505886[_0x5bca('0x30')][_0x2cb0be]=_0x4f94b2;return rp(_0x505886);})[_0x5bca('0x16')](function(_0x40972b){var _0x41bed3=_0x40972b['headers'][_0x5bca('0x31')];var _0x4eeadf=_0x41bed3[_0x5bca('0x32')](_0x41bed3[_0x5bca('0x33')]('(')+0x1,_0x41bed3[_0x5bca('0x33')](')'));_0x5a2b53[_0x5bca('0x34')]=_0x4eeadf;_0x47cab1(_0x5a2b53);})['catch'](function(_0x1da578){_0x38107a(_0x1da578[_0x5bca('0x1b')]);});});}function getEndUser(_0x344c14,_0x51b913,_0x190e18,_0x4ba42a,_0x4c9760,_0x22fa83,_0x164b99,_0x1ec578){var _0x1f00f0=_0x22fa83[_0x5bca('0x2a')]()===_0x5bca('0x2b')?_0x4c9760['destcalleridnum']:_0x4c9760[_0x5bca('0x2d')];return getAuthToken(_0x51b913,_0x190e18,_0x22fa83)['then'](function(_0x2c73f4){_0x1ec578=_0x1ec578?_0x1ec578:_0x5bca('0x35');var _0x55e69d={'method':_0x5bca('0x1c'),'uri':_0x4ba42a+_0x5bca('0x36')+_0x1ec578+'&$filter='+_0x1ec578+_0x5bca('0x37')+_0x1f00f0[_0x5bca('0x38')]('+','%2b')+'\x27','headers':{'Authorization':_0x5bca('0x1e')+_0x2c73f4,'If-None-Match':null,'OData-Version':_0x5bca('0x2f')},'json':!![]};return rp(_0x55e69d);})[_0x5bca('0x16')](function(_0x431984){var _0x1ec635=![];if(!_0x431984)return _0x1ec635;var _0xbc5703=_0x431984['value'];for(var _0xc2b84=0x0;_0xc2b84<_0xbc5703[_0x5bca('0x27')];_0xc2b84++){if(_0xbc5703[_0xc2b84][_0x1ec578]===_0x1f00f0){_0x1ec635=!![];_0x344c14[_0x5bca('0x34')]=_0xbc5703[_0xc2b84][_0x5bca('0x39')];}}return _0x1ec635;})[_0x5bca('0x16')](function(_0xacde6){if(_0xacde6)return _0x344c14;if(_0x164b99===_0x5bca('0x3a')){logger[_0x5bca('0x24')]('['+[_0x22fa83[_0x5bca('0x19')]()]+']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing');return _0x344c14;}return createEndUser(_0x344c14,_0x51b913,_0x190e18,_0x4ba42a,_0x4c9760,_0x22fa83,_0x1ec578)['then'](function(_0x3f4302){logger[_0x5bca('0x24')]('['+[_0x22fa83[_0x5bca('0x19')]()]+_0x5bca('0x3b'),_0x3f4302[_0x5bca('0x34')]);return _0x3f4302;});});}function getCustomFields(_0x846722,_0x1e0a0a,_0x455ecc){var _0x2d5b56={};if(_0x846722[_0x5bca('0x27')]>0x0){_['forEach'](_0x846722,function(_0x42d331){if(_[_0x5bca('0x3c')](['string',_0x5bca('0x3d')],_0x42d331['type'])&&_0x42d331[_0x5bca('0x3e')]&&!_0x42d331[_0x5bca('0x3f')]){var _0x4699c3=_0x42d331[_0x5bca('0x40')][_0x5bca('0x2a')]();var _0x10e3fc=_0x4699c3[_0x5bca('0x32')](0x0,_0x4699c3[_0x5bca('0x41')]('_'));var _0x3368f6=_0x4699c3[_0x5bca('0x32')](_0x4699c3[_0x5bca('0x41')]('_')+0x1);if(_0x10e3fc===_0x455ecc){_0x2d5b56[_0x3368f6]=_0x42d331[_0x5bca('0x42')];}}});}return _0x2d5b56;}function getTicket(_0x23196c,_0x28c9c0,_0x34df27,_0x4da017,_0x412a6d,_0x2539e8,_0x428ca8){return new Promise(function(_0x239652,_0x337b4f){var _0x1aa11d;return getAuthToken(_0x28c9c0,_0x34df27,_0x428ca8)[_0x5bca('0x16')](function(_0x26ab40){if(_0x2539e8[_0x5bca('0x43')]===_0x5bca('0x44')){_0x1aa11d={'method':_0x5bca('0x12'),'uri':_0x4da017+'incidents','body':Object[_0x5bca('0x45')]({},{'title':intUtil[_0x5bca('0x46')](_0x2539e8['Subjects'],_0x412a6d,'\x20'),'description':intUtil[_0x5bca('0x46')](_0x2539e8['Descriptions'],_0x412a6d,'\x0a'),'customerid_contact@odata.bind':_0x23196c['enduserId']?_0x5bca('0x47')+_0x23196c[_0x5bca('0x34')]+')':undefined,'ownerid@odata.bind':_0x5bca('0x48')+_0x23196c[_0x5bca('0x29')]+')','caseorigincode':'1'},getCustomFields(_0x2539e8[_0x5bca('0x49')],_0x412a6d,_0x2539e8[_0x5bca('0x43')])),'headers':{'Authorization':'Bearer\x20'+_0x26ab40,'OData-Version':_0x5bca('0x2f')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x2539e8[_0x5bca('0x43')]===_0x5bca('0x4a')){var _0x38b31d=_0x23196c[_0x5bca('0x34')]?[{'partyid_systemuser@odata.bind':_0x5bca('0x48')+_0x23196c['userId']+')','participationtypemask':_0x23196c[_0x5bca('0x4b')]===_0x5bca('0x4c')?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x23196c[_0x5bca('0x34')]+')','participationtypemask':_0x23196c['callDirection']===_0x5bca('0x4c')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x5bca('0x48')+_0x23196c['userId']+')','participationtypemask':_0x23196c[_0x5bca('0x4b')]===_0x5bca('0x4c')?0x2:0x1}];_0x1aa11d={'method':'POST','uri':_0x4da017+'phonecalls','body':Object[_0x5bca('0x45')]({},{'subject':intUtil['getString'](_0x2539e8[_0x5bca('0x4d')],_0x412a6d,'\x20'),'phonenumber':String(_0x412a6d[_0x5bca('0x2d')]),'description':intUtil['getString'](_0x2539e8['Descriptions'],_0x412a6d,'\x0a'),'regardingobjectid_contact@odata.bind':_0x23196c[_0x5bca('0x34')]?_0x5bca('0x47')+_0x23196c[_0x5bca('0x34')]+')':undefined,'ownerid@odata.bind':_0x5bca('0x48')+_0x23196c[_0x5bca('0x29')]+')','directioncode':_0x23196c['callDirection']===_0x5bca('0x4c')?![]:!![],'phonecall_activity_parties':_0x38b31d},getCustomFields(_0x2539e8[_0x5bca('0x49')],_0x412a6d,_0x2539e8[_0x5bca('0x43')])),'headers':{'Authorization':_0x5bca('0x1e')+_0x26ab40,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x1aa11d);})['then'](function(_0x3fc2bf){var _0x5d6974=_0x3fc2bf[_0x5bca('0x4e')][_0x5bca('0x31')];var _0x2dc32b=_0x5d6974[_0x5bca('0x32')](_0x5d6974['lastIndexOf']('(')+0x1,_0x5d6974['lastIndexOf'](')'));_0x23196c[_0x5bca('0x4f')]=_0x2dc32b;_0x239652(_0x23196c);})[_0x5bca('0x17')](function(_0x39fe32){_0x337b4f(_0x39fe32[_0x5bca('0x1b')]);});});}function emit(_0x4d7e4a,_0x51c510,_0x50be43,_0x3efdf1){var _0x476f78={'uri':util[_0x5bca('0x50')](_0x5bca('0x51'),_0x4d7e4a,_0x50be43,_0x3efdf1)};io['to'](util[_0x5bca('0x50')]('user:%s',_0x51c510))[_0x5bca('0x52')]('trigger:browser:url',_0x476f78);}exports['cs']=function(_0x30c943,_0x1032d1,_0x58152c,_0x5ebbf1,_0x502350,_0x5cbde8,_0x35acde,_0x4d6a9b){var _0x2da7a0={};_0x5cbde8[_0x5bca('0xc')]=_0x5cbde8[_0x5bca('0xb')]?intUtil[_0x5bca('0x53')](_0x5cbde8[_0x5bca('0xd')][_0x5bca('0x54')]):intUtil[_0x5bca('0x53')](_0x5cbde8['remoteUri']);_0x5cbde8[_0x5bca('0x55')]=intUtil[_0x5bca('0x53')](_0x5cbde8[_0x5bca('0x55')]);_0x2da7a0[_0x5bca('0x4b')]=_0x4d6a9b===_0x5bca('0x4c')||_0x4d6a9b===_0x5bca('0x56')?'queue':_0x5bca('0x2b');var _0x144105=_0x5cbde8[_0x5bca('0xb')]?util['format']('%s/api/data/v9.0/',_0x5cbde8[_0x5bca('0xd')]['data7']):util[_0x5bca('0x50')]('%s/api/data/v9.0/',_0x5cbde8[_0x5bca('0xc')]);var _0x9f4666=util[_0x5bca('0x50')](_0x5bca('0x57'),_0x5cbde8[_0x5bca('0xe')]);var _0x556337=util[_0x5bca('0x50')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5cbde8[_0x5bca('0x55')],_0x1032d1[_0x5bca('0x58')],md5(_0x1032d1[_0x5bca('0x58')]));if(_0x502350&&_0x502350[_0x5bca('0x59')]){logger[_0x5bca('0x24')](_0x5bca('0x5a'),'Recording\x20is\x20enabled!');_0x1032d1[_0x5bca('0x5b')]=_0x556337;}else if(_0x35acde&&_0x35acde[_0x5bca('0x5c')]&&_0x35acde['recordingFormat']!==_0x5bca('0x5d')){logger[_0x5bca('0x24')](_0x5bca('0x5e'),_0x5bca('0x5f'));_0x1032d1[_0x5bca('0x5b')]=_0x556337;}else{_0x1032d1[_0x5bca('0x5b')]='';}return getUser(_0x2da7a0,_0x5cbde8,_0x5ebbf1,_0x9f4666,_0x144105,_0x4d6a9b)[_0x5bca('0x16')](function(_0x25559e){logger[_0x5bca('0x24')]('['+_0x4d6a9b[_0x5bca('0x19')]()+_0x5bca('0x60'),_0x25559e[_0x5bca('0x29')]);logger[_0x5bca('0x24')]('['+_0x4d6a9b['toUpperCase']()+_0x5bca('0x61'),_0x25559e[_0x5bca('0x26')]);return getEndUser(_0x25559e,_0x5cbde8,_0x9f4666,_0x144105,_0x1032d1,_0x4d6a9b,_0x58152c['moduleCreate'],_0x58152c[_0x5bca('0x62')]);})[_0x5bca('0x16')](function(_0x3ff6c3){logger[_0x5bca('0x24')]('['+_0x4d6a9b[_0x5bca('0x19')]()+_0x5bca('0x63'),_0x3ff6c3[_0x5bca('0x34')]);logger[_0x5bca('0x24')]('['+_0x4d6a9b[_0x5bca('0x19')]()+_0x5bca('0x64'),_0x1032d1[_0x5bca('0x2d')]);return getTicket(_0x3ff6c3,_0x5cbde8,_0x9f4666,_0x144105,_0x1032d1,_0x58152c,_0x4d6a9b);})[_0x5bca('0x16')](function(_0x32ecb9){logger[_0x5bca('0x24')](util[_0x5bca('0x50')]('['+_0x4d6a9b[_0x5bca('0x19')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x58152c[_0x5bca('0x43')],_0x32ecb9['ticketId']));logger[_0x5bca('0x24')](util['format']('['+_0x4d6a9b['toUpperCase']()+']\x20Call\x20direction:\x20%s',_0x4d6a9b));if(_0x4d6a9b!==_0x5bca('0x56')&&_0x58152c[_0x5bca('0x65')]){logger[_0x5bca('0x24')]('['+_0x4d6a9b['toUpperCase']()+']',_0x5bca('0x66'));emit(_0x5cbde8['remoteUri'],_0x5ebbf1[_0x5bca('0x67')],_0x58152c[_0x5bca('0x43')],_0x32ecb9['ticketId']);}})[_0x5bca('0x17')](function(_0x2206cc){logger[_0x5bca('0x18')]('['+_0x4d6a9b[_0x5bca('0x19')]()+_0x5bca('0x68'),_0x2206cc[_0x5bca('0x1b')]);console[_0x5bca('0x18')]('Error\x20running\x20Dynamics365\x20integration',_0x2206cc);});}; \ 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 9f59a22..750099e 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 _0x25c9=['getString','Subjects','Descriptions','
','Tags','Fields','custom_fields','mapValues','keyBy','format','remoteUri','then','%s/api/v2/agents','length','Agent\x20found!','find','contact','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','GET','map','forEach','includes','string','picklist','type','nameField','customField','content','idField','push','variable','variableName','customVariable','Variable','name','toLowerCase','stripTrailingSlash','serverUrl','monitor_format','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/helpdesk/tickets/%d','error','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','user:%s','unmanaged','toUpperCase','lastevent','stringify','util','ioredis','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','localhost','application/json','emit','info','merge','calleridname','calleridnum'];(function(_0x54673d,_0x381848){var _0x380bbb=function(_0x283201){while(--_0x283201){_0x54673d['push'](_0x54673d['shift']());}};_0x380bbb(++_0x381848);}(_0x25c9,0x100));var _0x925c=function(_0x462a4b,_0x2360ea){_0x462a4b=_0x462a4b-0x0;var _0x156f3e=_0x25c9[_0x462a4b];return _0x156f3e;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require('md5');var util=require(_0x925c('0x0'));var Redis=require(_0x925c('0x1'));var intUtil=require('./util');var config=require(_0x925c('0x2'));var logger=require(_0x925c('0x3'))(_0x925c('0x4'));config[_0x925c('0x5')]=_[_0x925c('0x6')](config[_0x925c('0x5')],{'host':_0x925c('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var headers={'Content-Type':'application/json','Accept':_0x925c('0x8')};function emit(_0x5e03d5,_0x251955,_0x31e6bf){io['to'](_0x5e03d5)[_0x925c('0x9')](_0x251955,_0x31e6bf);}function getTicket(_0x31d846,_0x5bc728,_0x3b147b,_0xaa3a6d,_0x2cb130){logger[_0x925c('0xa')]('Creating\x20new\x20ticket...');var _0x2db9b0=_[_0x925c('0xb')]({'responder_id':_0x5bc728['id'],'requester_id':_0x3b147b['id'],'name':util['format']('Caller\x20-\x20%s',_0x2cb130[_0x925c('0xc')]),'phone':_0x2cb130[_0x925c('0xd')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x925c('0xe')](_0xaa3a6d[_0x925c('0xf')],_0x2cb130,'\x20'),'description':intUtil[_0x925c('0xe')](_0xaa3a6d[_0x925c('0x10')],_0x2cb130,_0x925c('0x11')),'tags':getTags(_0xaa3a6d[_0x925c('0x12')],'name')},getCustomFields(_0xaa3a6d[_0x925c('0x13')],_0x2cb130));_0x2db9b0[_0x925c('0x14')]=_[_0x925c('0x15')](_[_0x925c('0x16')](_0x2db9b0[_0x925c('0x14')],'id'),'value');return request({'uri':util[_0x925c('0x17')]('%s/api/v2/tickets',_0x31d846[_0x925c('0x18')]),'method':'POST','body':_0x2db9b0})[_0x925c('0x19')](function(_0x53eb96){logger[_0x925c('0xa')]('Ticket\x20created!');return _0x53eb96;});}function getUser(_0x542592,_0x1d4511){if(intUtil['validateEmail'](_0x1d4511)){return request({'uri':util[_0x925c('0x17')](_0x925c('0x1a'),_0x542592[_0x925c('0x18')]),'qs':{'email':_0x1d4511}})[_0x925c('0x19')](function(_0x2a5ce8){if(_0x2a5ce8[_0x925c('0x1b')]){logger[_0x925c('0xa')](_0x925c('0x1c'));return _[_0x925c('0x1d')](_0x2a5ce8,function(_0x65e8fa){return _0x65e8fa[_0x925c('0x1e')]['email']===_0x1d4511;});}else{logger['info'](_0x925c('0x1f'));return request({'uri':util[_0x925c('0x17')]('%s/api/v2/agents/me',_0x542592[_0x925c('0x18')])})[_0x925c('0x19')](function(_0xe1b0c5){logger['info']('Admin\x20account\x20selected.');return _0xe1b0c5;});}});}else{logger[_0x925c('0xa')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x925c('0x17')](_0x925c('0x20'),_0x542592['remoteUri'])})[_0x925c('0x19')](function(_0xb9a504){logger['info'](_0x925c('0x21'));return _0xb9a504;});}}function getEndUser(_0x18883f,_0x4fcbda,_0x18601c){logger['info'](_0x925c('0x22'),_0x18601c);return request({'uri':util['format'](_0x925c('0x23'),_0x18883f['remoteUri']),'qs':{'phone':_0x18601c}})[_0x925c('0x19')](function(_0x43b61f){if(_0x43b61f[_0x925c('0x1b')]){logger[_0x925c('0xa')](_0x925c('0x24'));return _[_0x925c('0x1d')](_0x43b61f,{'phone':_0x18601c});}else{logger[_0x925c('0xa')](_0x925c('0x25'));return request({'uri':util[_0x925c('0x17')](_0x925c('0x23'),_0x18883f[_0x925c('0x18')]),'method':_0x925c('0x26'),'body':{'name':_0x4fcbda,'phone':_0x18601c}})[_0x925c('0x19')](function(_0x12045b){logger[_0x925c('0xa')](_0x925c('0x27'));return _0x12045b;});}});}function getAuth(_0x17748c){return util[_0x925c('0x17')](_0x925c('0x28'),new Buffer(_0x17748c[_0x925c('0x29')]+':X')[_0x925c('0x2a')](_0x925c('0x2b')));}function request(_0x337d28){logger['debug']('[HTTP]',JSON['stringify'](_0x337d28));return rp(_[_0x925c('0x6')](_0x337d28,{'method':_0x925c('0x2c'),'headers':headers,'json':!![]}));}function getTags(_0x5e357c,_0x40e260){var _0x3ba2de=[];if(_0x5e357c&&_0x5e357c[_0x925c('0x1b')]>0x0){_0x3ba2de=_[_0x925c('0x2d')](_0x5e357c,_0x40e260);}return _0x3ba2de;}function getCustomFields(_0x300cb7,_0x2df57e){var _0x1e078c=[];var _0x34f785={'custom_fields':[]};if(_0x300cb7['length']>0x0){_[_0x925c('0x2e')](_0x300cb7,function(_0x4962c3){if(_[_0x925c('0x2f')]([_0x925c('0x30'),_0x925c('0x31')],_0x4962c3[_0x925c('0x32')])&&_0x4962c3[_0x925c('0x33')]&&!_0x4962c3[_0x925c('0x34')]){_0x34f785[_0x4962c3[_0x925c('0x33')]['toLowerCase']()]=_0x4962c3[_0x925c('0x35')]['toString']();}else if(_[_0x925c('0x2f')]([_0x925c('0x30'),_0x925c('0x31')],_0x4962c3[_0x925c('0x32')])&&_0x4962c3[_0x925c('0x36')]&&_0x4962c3[_0x925c('0x34')]){_0x34f785[_0x925c('0x14')][_0x925c('0x37')]({'id':_0x4962c3[_0x925c('0x36')],'value':_0x4962c3['content'][_0x925c('0x2a')]()});}else if(_0x4962c3[_0x925c('0x32')]===_0x925c('0x38')&&_0x4962c3[_0x925c('0x39')]&&_0x4962c3[_0x925c('0x36')]&&_0x4962c3[_0x925c('0x34')]){_0x2df57e[_0x4962c3[_0x925c('0x39')]]&&_0x34f785[_0x925c('0x14')]['push']({'id':_0x4962c3[_0x925c('0x36')],'value':_0x2df57e[_0x4962c3[_0x925c('0x39')]]['toString']()});}else if(_0x4962c3[_0x925c('0x32')]===_0x925c('0x3a')&&_0x4962c3[_0x925c('0x3b')]&&_0x4962c3[_0x925c('0x3b')]['name']&&_0x4962c3[_0x925c('0x36')]&&_0x4962c3[_0x925c('0x34')]){_0x2df57e[_0x4962c3['Variable'][_0x925c('0x3c')]['toLowerCase']()]&&_0x34f785[_0x925c('0x14')][_0x925c('0x37')]({'id':_0x4962c3[_0x925c('0x36')],'value':_0x2df57e[_0x4962c3[_0x925c('0x3b')][_0x925c('0x3c')][_0x925c('0x3d')]()][_0x925c('0x2a')]()});}});}return _0x34f785;}exports['queue']=function(_0x4a1ccc,_0x560aa7,_0xbd3d3d,_0x5ee1ca,_0x51d330,_0x28dd1d){var _0x46677a,_0x50bd59;_0x28dd1d['remoteUri']=intUtil[_0x925c('0x3e')](_0x28dd1d[_0x925c('0x18')]);_0x28dd1d[_0x925c('0x3f')]=intUtil[_0x925c('0x3e')](_0x28dd1d[_0x925c('0x3f')]);if(_0x51d330&&_0x51d330[_0x925c('0x40')]){logger[_0x925c('0xa')]('[QUEUE]','Recording\x20is\x20enabled!');_0x560aa7[_0x925c('0x41')]=util[_0x925c('0x17')](_0x925c('0x42'),_0x28dd1d[_0x925c('0x3f')],_0x560aa7['uniqueid'],md5(_0x560aa7[_0x925c('0x43')]));}else{_0x560aa7['recordingURL']='';}headers[_0x925c('0x44')]=getAuth(_0x28dd1d);return getUser(_0x28dd1d,_0x5ee1ca[_0x925c('0x45')])[_0x925c('0x19')](function(_0x210a0f){_0x46677a=_0x210a0f;logger[_0x925c('0xa')](_0x925c('0x46'),_0x46677a['id']);return getEndUser(_0x28dd1d,_0x560aa7[_0x925c('0xc')],_0x560aa7[_0x925c('0xd')]);})['then'](function(_0x56d7b7){_0x50bd59=_0x56d7b7;logger['info']('The\x20Enduser\x20ID\x20is:',_0x50bd59['id']);return getTicket(_0x28dd1d,_0x46677a,_0x50bd59,_0xbd3d3d,_0x560aa7);})[_0x925c('0x19')](function(_0x2d95ba){if(_0x2d95ba&&_0x2d95ba['id']){logger[_0x925c('0xa')](_0x925c('0x47'));logger['info'](_0x925c('0x48'),_0x2d95ba['id']);logger[_0x925c('0xa')]('[QUEUE]',_0x925c('0x49'));emit(util[_0x925c('0x17')]('user:%s',_0x5ee1ca['name']),_0x925c('0x4a'),{'uri':util[_0x925c('0x17')](_0x925c('0x4b'),_0x28dd1d[_0x925c('0x18')],_0x2d95ba['id'])});}})['catch'](function(_0xe51792){logger[_0x925c('0x4c')]('[QUEUE]',JSON['stringify'](_0xe51792));});};exports[_0x925c('0x4d')]=function(_0x48d5a4,_0x49e851,_0x341fe7,_0xfdd989,_0x9054f8,_0x31237e,_0x14d60b){var _0x5e00b4,_0x5086e0;_0x31237e['remoteUri']=intUtil[_0x925c('0x3e')](_0x31237e[_0x925c('0x18')]);_0x31237e['serverUrl']=intUtil[_0x925c('0x3e')](_0x31237e[_0x925c('0x3f')]);if(_0x14d60b&&_0x14d60b[_0x925c('0x4e')]&&_0x14d60b[_0x925c('0x4e')]!==_0x925c('0x4f')){logger['info'](_0x925c('0x50'),_0x925c('0x51'));_0x49e851[_0x925c('0x41')]=util[_0x925c('0x17')](_0x925c('0x42'),_0x31237e[_0x925c('0x3f')],_0x49e851[_0x925c('0x43')],md5(_0x49e851['uniqueid']));}headers['Authorization']=getAuth(_0x31237e);return getUser(_0x31237e,_0xfdd989['email'])['then'](function(_0x292b68){_0x5e00b4=_0x292b68;logger['info'](_0x925c('0x46'),_0x5e00b4['id']);return getEndUser(_0x31237e,_0x49e851[_0x925c('0x52')],_0x49e851[_0x925c('0x53')]);})['then'](function(_0xaf9ef9){_0x5086e0=_0xaf9ef9;logger[_0x925c('0xa')](_0x925c('0x54'),_0x5086e0['id']);return getTicket(_0x31237e,_0x5e00b4,_0x5086e0,_0x341fe7,_0x49e851);})[_0x925c('0x19')](function(_0x1cd2ab){if(_0x1cd2ab&&_0x1cd2ab['id']){logger[_0x925c('0xa')](_0x925c('0x47'));logger['info'](_0x925c('0x48'),_0x1cd2ab['id']);logger[_0x925c('0xa')](_0x925c('0x50'),_0x925c('0x49'));emit(util[_0x925c('0x17')](_0x925c('0x55'),_0xfdd989['name']),_0x925c('0x4a'),{'uri':util['format'](_0x925c('0x4b'),_0x31237e[_0x925c('0x18')],_0x1cd2ab['id'])});}})['catch'](function(_0x55dd7a){logger[_0x925c('0x4c')](_0x925c('0x50'),JSON['stringify'](_0x55dd7a));});};exports[_0x925c('0x56')]=function(_0x5845c5,_0xe4868,_0x2ff0cf,_0x144033,_0x8a4392,_0x4ff933){var _0x35c463,_0x30a4c2;_0x4ff933[_0x925c('0x18')]=intUtil['stripTrailingSlash'](_0x4ff933[_0x925c('0x18')]);_0x4ff933[_0x925c('0x3f')]=intUtil[_0x925c('0x3e')](_0x4ff933[_0x925c('0x3f')]);if(_0x8a4392&&_0x8a4392[_0x925c('0x40')]){logger[_0x925c('0xa')]('['+_0xe4868['lastevent'][_0x925c('0x57')]()+']',_0x925c('0x51'));_0xe4868[_0x925c('0x41')]=util[_0x925c('0x17')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4ff933[_0x925c('0x3f')],_0xe4868[_0x925c('0x43')],md5(_0xe4868[_0x925c('0x43')]));}else{_0xe4868[_0x925c('0x41')]='';}headers[_0x925c('0x44')]=getAuth(_0x4ff933);return getUser(_0x4ff933,'')[_0x925c('0x19')](function(_0xc4e03e){_0x35c463=_0xc4e03e;logger[_0x925c('0xa')](_0x925c('0x46'),_0x35c463['id']);return getEndUser(_0x4ff933,_0xe4868[_0x925c('0xc')],_0xe4868[_0x925c('0xd')]);})[_0x925c('0x19')](function(_0x194ed0){_0x30a4c2=_0x194ed0;logger[_0x925c('0xa')]('The\x20Enduser\x20ID\x20is:',_0x30a4c2['id']);return getTicket(_0x4ff933,_0x35c463,_0x30a4c2,_0x2ff0cf,_0xe4868);})[_0x925c('0x19')](function(_0x25169d){if(_0x25169d){logger[_0x925c('0xa')]('Ticket\x20created!');logger[_0x925c('0xa')](_0x925c('0x48'),_0x25169d['id']);}})['catch'](function(_0x5c5426){logger['error']('['+_0xe4868[_0x925c('0x58')][_0x925c('0x57')]()+']',JSON[_0x925c('0x59')](_0x5c5426));});}; \ No newline at end of file +var _0x0b53=['mapValues','keyBy','value','format','remoteUri','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','Agent\x20found!','find','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','Enduser\x20created.','apiKey','base64','debug','[HTTP]','stringify','GET','map','forEach','string','picklist','nameField','toLowerCase','toString','includes','type','push','idField','content','variable','variableName','customField','customVariable','Variable','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20Enduser\x20ID\x20is:','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','Authorization','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','toUpperCase','lodash','request-promise','md5','util','./util','../../../../config/environment','../../../../config/logger','freshdesk','defaults','localhost','socket.io-emitter','redis','application/json','emit','info','merge','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','
','name','custom_fields'];(function(_0x357cb8,_0x23750a){var _0x5cdb5f=function(_0x2ef643){while(--_0x2ef643){_0x357cb8['push'](_0x357cb8['shift']());}};_0x5cdb5f(++_0x23750a);}(_0x0b53,0x107));var _0x30b5=function(_0x2c0dc0,_0x19900d){_0x2c0dc0=_0x2c0dc0-0x0;var _0x4c0990=_0x0b53[_0x2c0dc0];return _0x4c0990;};'use strict';var _=require(_0x30b5('0x0'));var rp=require(_0x30b5('0x1'));var md5=require(_0x30b5('0x2'));var util=require(_0x30b5('0x3'));var Redis=require('ioredis');var intUtil=require(_0x30b5('0x4'));var config=require(_0x30b5('0x5'));var logger=require(_0x30b5('0x6'))(_0x30b5('0x7'));config['redis']=_[_0x30b5('0x8')](config['redis'],{'host':_0x30b5('0x9'),'port':0x18eb});var io=require(_0x30b5('0xa'))(new Redis(config[_0x30b5('0xb')]));var headers={'Content-Type':_0x30b5('0xc'),'Accept':_0x30b5('0xc')};function emit(_0x10a538,_0x154a7d,_0x2bc831){io['to'](_0x10a538)[_0x30b5('0xd')](_0x154a7d,_0x2bc831);}function getTicket(_0x596cf0,_0x55c6e9,_0xec76e9,_0x18bd01,_0x36a37c){logger[_0x30b5('0xe')]('Creating\x20new\x20ticket...');var _0x29c4e5=_[_0x30b5('0xf')]({'responder_id':_0x55c6e9['id'],'requester_id':_0xec76e9['id'],'name':util['format'](_0x30b5('0x10'),_0x36a37c[_0x30b5('0x11')]),'phone':_0x36a37c[_0x30b5('0x12')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x30b5('0x13')](_0x18bd01[_0x30b5('0x14')],_0x36a37c,'\x20'),'description':intUtil[_0x30b5('0x13')](_0x18bd01[_0x30b5('0x15')],_0x36a37c,_0x30b5('0x16')),'tags':getTags(_0x18bd01['Tags'],_0x30b5('0x17'))},getCustomFields(_0x18bd01['Fields'],_0x36a37c));_0x29c4e5[_0x30b5('0x18')]=_[_0x30b5('0x19')](_[_0x30b5('0x1a')](_0x29c4e5[_0x30b5('0x18')],'id'),_0x30b5('0x1b'));return request({'uri':util[_0x30b5('0x1c')]('%s/api/v2/tickets',_0x596cf0[_0x30b5('0x1d')]),'method':'POST','body':_0x29c4e5})[_0x30b5('0x1e')](function(_0x2b86e1){logger[_0x30b5('0xe')](_0x30b5('0x1f'));return _0x2b86e1;});}function getUser(_0x42b821,_0x29f22f){if(intUtil[_0x30b5('0x20')](_0x29f22f)){return request({'uri':util[_0x30b5('0x1c')](_0x30b5('0x21'),_0x42b821[_0x30b5('0x1d')]),'qs':{'email':_0x29f22f}})[_0x30b5('0x1e')](function(_0x4e92d2){if(_0x4e92d2[_0x30b5('0x22')]){logger[_0x30b5('0xe')](_0x30b5('0x23'));return _[_0x30b5('0x24')](_0x4e92d2,function(_0x5a30f0){return _0x5a30f0['contact'][_0x30b5('0x25')]===_0x29f22f;});}else{logger['info'](_0x30b5('0x26'));return request({'uri':util['format'](_0x30b5('0x27'),_0x42b821[_0x30b5('0x1d')])})['then'](function(_0x20839a){logger[_0x30b5('0xe')]('Admin\x20account\x20selected.');return _0x20839a;});}});}else{logger[_0x30b5('0xe')](_0x30b5('0x28'));return request({'uri':util[_0x30b5('0x1c')]('%s/api/v2/agents/me',_0x42b821['remoteUri'])})[_0x30b5('0x1e')](function(_0x40c983){logger['info'](_0x30b5('0x29'));return _0x40c983;});}}function getEndUser(_0x2fe293,_0x5d3a10,_0x2b59e1){logger['info'](_0x30b5('0x2a'),_0x2b59e1);return request({'uri':util[_0x30b5('0x1c')](_0x30b5('0x2b'),_0x2fe293['remoteUri']),'qs':{'phone':_0x2b59e1}})['then'](function(_0x4f1721){if(_0x4f1721[_0x30b5('0x22')]){logger[_0x30b5('0xe')](_0x30b5('0x2c'));return _[_0x30b5('0x24')](_0x4f1721,{'phone':_0x2b59e1});}else{logger[_0x30b5('0xe')](_0x30b5('0x2d'));return request({'uri':util[_0x30b5('0x1c')](_0x30b5('0x2b'),_0x2fe293[_0x30b5('0x1d')]),'method':_0x30b5('0x2e'),'body':{'name':_0x5d3a10,'phone':_0x2b59e1}})['then'](function(_0x3ca36a){logger[_0x30b5('0xe')](_0x30b5('0x2f'));return _0x3ca36a;});}});}function getAuth(_0x7d7b61){return util[_0x30b5('0x1c')]('Basic\x20%s',new Buffer(_0x7d7b61[_0x30b5('0x30')]+':X')['toString'](_0x30b5('0x31')));}function request(_0x3430fa){logger[_0x30b5('0x32')](_0x30b5('0x33'),JSON[_0x30b5('0x34')](_0x3430fa));return rp(_[_0x30b5('0x8')](_0x3430fa,{'method':_0x30b5('0x35'),'headers':headers,'json':!![]}));}function getTags(_0x158acc,_0x2c6778){var _0x5346a5=[];if(_0x158acc&&_0x158acc['length']>0x0){_0x5346a5=_[_0x30b5('0x36')](_0x158acc,_0x2c6778);}return _0x5346a5;}function getCustomFields(_0x14014f,_0x11c3e6){var _0x3100dd=[];var _0x33957d={'custom_fields':[]};if(_0x14014f[_0x30b5('0x22')]>0x0){_[_0x30b5('0x37')](_0x14014f,function(_0x11f405){if(_['includes']([_0x30b5('0x38'),_0x30b5('0x39')],_0x11f405['type'])&&_0x11f405[_0x30b5('0x3a')]&&!_0x11f405['customField']){_0x33957d[_0x11f405['nameField'][_0x30b5('0x3b')]()]=_0x11f405['content'][_0x30b5('0x3c')]();}else if(_[_0x30b5('0x3d')]([_0x30b5('0x38'),_0x30b5('0x39')],_0x11f405[_0x30b5('0x3e')])&&_0x11f405['idField']&&_0x11f405['customField']){_0x33957d[_0x30b5('0x18')][_0x30b5('0x3f')]({'id':_0x11f405[_0x30b5('0x40')],'value':_0x11f405[_0x30b5('0x41')][_0x30b5('0x3c')]()});}else if(_0x11f405['type']===_0x30b5('0x42')&&_0x11f405[_0x30b5('0x43')]&&_0x11f405['idField']&&_0x11f405[_0x30b5('0x44')]){_0x11c3e6[_0x11f405[_0x30b5('0x43')]]&&_0x33957d[_0x30b5('0x18')][_0x30b5('0x3f')]({'id':_0x11f405['idField'],'value':_0x11c3e6[_0x11f405[_0x30b5('0x43')]][_0x30b5('0x3c')]()});}else if(_0x11f405[_0x30b5('0x3e')]===_0x30b5('0x45')&&_0x11f405[_0x30b5('0x46')]&&_0x11f405[_0x30b5('0x46')]['name']&&_0x11f405[_0x30b5('0x40')]&&_0x11f405['customField']){_0x11c3e6[_0x11f405[_0x30b5('0x46')][_0x30b5('0x17')][_0x30b5('0x3b')]()]&&_0x33957d[_0x30b5('0x18')][_0x30b5('0x3f')]({'id':_0x11f405['idField'],'value':_0x11c3e6[_0x11f405[_0x30b5('0x46')][_0x30b5('0x17')][_0x30b5('0x3b')]()][_0x30b5('0x3c')]()});}});}return _0x33957d;}exports['queue']=function(_0x33ddc3,_0x10625a,_0x4b4bf2,_0x574ea9,_0x22a9b7,_0x41012b){var _0x44ee93,_0xf080c4;_0x41012b['remoteUri']=intUtil['stripTrailingSlash'](_0x41012b[_0x30b5('0x1d')]);_0x41012b[_0x30b5('0x47')]=intUtil['stripTrailingSlash'](_0x41012b['serverUrl']);if(_0x22a9b7&&_0x22a9b7[_0x30b5('0x48')]){logger[_0x30b5('0xe')](_0x30b5('0x49'),_0x30b5('0x4a'));_0x10625a[_0x30b5('0x4b')]=util[_0x30b5('0x1c')](_0x30b5('0x4c'),_0x41012b[_0x30b5('0x47')],_0x10625a['uniqueid'],md5(_0x10625a[_0x30b5('0x4d')]));}else{_0x10625a[_0x30b5('0x4b')]='';}headers['Authorization']=getAuth(_0x41012b);return getUser(_0x41012b,_0x574ea9[_0x30b5('0x25')])[_0x30b5('0x1e')](function(_0x66b188){_0x44ee93=_0x66b188;logger[_0x30b5('0xe')]('The\x20User\x20ID\x20is:',_0x44ee93['id']);return getEndUser(_0x41012b,_0x10625a[_0x30b5('0x11')],_0x10625a['calleridnum']);})[_0x30b5('0x1e')](function(_0x3cbe27){_0xf080c4=_0x3cbe27;logger['info'](_0x30b5('0x4e'),_0xf080c4['id']);return getTicket(_0x41012b,_0x44ee93,_0xf080c4,_0x4b4bf2,_0x10625a);})[_0x30b5('0x1e')](function(_0x157ff3){if(_0x157ff3&&_0x157ff3['id']){logger['info'](_0x30b5('0x1f'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x157ff3['id']);logger['info'](_0x30b5('0x49'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x30b5('0x1c')](_0x30b5('0x4f'),_0x574ea9[_0x30b5('0x17')]),_0x30b5('0x50'),{'uri':util[_0x30b5('0x1c')](_0x30b5('0x51'),_0x41012b[_0x30b5('0x1d')],_0x157ff3['id'])});}})[_0x30b5('0x52')](function(_0x72def4){logger[_0x30b5('0x53')](_0x30b5('0x49'),JSON[_0x30b5('0x34')](_0x72def4));});};exports['outbound']=function(_0x3528cc,_0x2bc16f,_0x1c732f,_0x27f3ab,_0x469af4,_0x444d02,_0xf783c1){var _0x570ff3,_0x1a6edb;_0x444d02[_0x30b5('0x1d')]=intUtil[_0x30b5('0x54')](_0x444d02[_0x30b5('0x1d')]);_0x444d02[_0x30b5('0x47')]=intUtil[_0x30b5('0x54')](_0x444d02[_0x30b5('0x47')]);if(_0xf783c1&&_0xf783c1[_0x30b5('0x55')]&&_0xf783c1[_0x30b5('0x55')]!==_0x30b5('0x56')){logger[_0x30b5('0xe')](_0x30b5('0x57'),_0x30b5('0x4a'));_0x2bc16f[_0x30b5('0x4b')]=util['format'](_0x30b5('0x4c'),_0x444d02[_0x30b5('0x47')],_0x2bc16f[_0x30b5('0x4d')],md5(_0x2bc16f[_0x30b5('0x4d')]));}headers[_0x30b5('0x58')]=getAuth(_0x444d02);return getUser(_0x444d02,_0x27f3ab[_0x30b5('0x25')])[_0x30b5('0x1e')](function(_0x5cdc69){_0x570ff3=_0x5cdc69;logger[_0x30b5('0xe')](_0x30b5('0x59'),_0x570ff3['id']);return getEndUser(_0x444d02,_0x2bc16f[_0x30b5('0x5a')],_0x2bc16f[_0x30b5('0x5b')]);})['then'](function(_0xfd88a1){_0x1a6edb=_0xfd88a1;logger[_0x30b5('0xe')](_0x30b5('0x4e'),_0x1a6edb['id']);return getTicket(_0x444d02,_0x570ff3,_0x1a6edb,_0x1c732f,_0x2bc16f);})[_0x30b5('0x1e')](function(_0x582ff8){if(_0x582ff8&&_0x582ff8['id']){logger[_0x30b5('0xe')](_0x30b5('0x1f'));logger[_0x30b5('0xe')](_0x30b5('0x5c'),_0x582ff8['id']);logger[_0x30b5('0xe')](_0x30b5('0x57'),_0x30b5('0x5d'));emit(util[_0x30b5('0x1c')](_0x30b5('0x4f'),_0x27f3ab[_0x30b5('0x17')]),_0x30b5('0x50'),{'uri':util['format']('%s/helpdesk/tickets/%d',_0x444d02[_0x30b5('0x1d')],_0x582ff8['id'])});}})[_0x30b5('0x52')](function(_0x4f5ad9){logger[_0x30b5('0x53')](_0x30b5('0x57'),JSON[_0x30b5('0x34')](_0x4f5ad9));});};exports[_0x30b5('0x5e')]=function(_0x4a202e,_0x5501c5,_0x284d29,_0x5a0fb5,_0x1d0a9f,_0x2fff6a){var _0x1c4419,_0x91b244;_0x2fff6a['remoteUri']=intUtil[_0x30b5('0x54')](_0x2fff6a[_0x30b5('0x1d')]);_0x2fff6a[_0x30b5('0x47')]=intUtil[_0x30b5('0x54')](_0x2fff6a[_0x30b5('0x47')]);if(_0x1d0a9f&&_0x1d0a9f[_0x30b5('0x48')]){logger[_0x30b5('0xe')]('['+_0x5501c5['lastevent'][_0x30b5('0x5f')]()+']',_0x30b5('0x4a'));_0x5501c5[_0x30b5('0x4b')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2fff6a[_0x30b5('0x47')],_0x5501c5[_0x30b5('0x4d')],md5(_0x5501c5[_0x30b5('0x4d')]));}else{_0x5501c5[_0x30b5('0x4b')]='';}headers[_0x30b5('0x58')]=getAuth(_0x2fff6a);return getUser(_0x2fff6a,'')['then'](function(_0x44602c){_0x1c4419=_0x44602c;logger[_0x30b5('0xe')](_0x30b5('0x59'),_0x1c4419['id']);return getEndUser(_0x2fff6a,_0x5501c5[_0x30b5('0x11')],_0x5501c5[_0x30b5('0x12')]);})[_0x30b5('0x1e')](function(_0x4b1f75){_0x91b244=_0x4b1f75;logger['info'](_0x30b5('0x4e'),_0x91b244['id']);return getTicket(_0x2fff6a,_0x1c4419,_0x91b244,_0x284d29,_0x5501c5);})[_0x30b5('0x1e')](function(_0x108fd3){if(_0x108fd3){logger['info'](_0x30b5('0x1f'));logger[_0x30b5('0xe')]('The\x20Ticket\x20ID\x20is:',_0x108fd3['id']);}})[_0x30b5('0x52')](function(_0x4ad6e6){logger[_0x30b5('0x53')]('['+_0x5501c5['lastevent'][_0x30b5('0x5f')]()+']',JSON['stringify'](_0x4ad6e6));});}; \ 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 ae9b8d8..6af06d2 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 _0x5d6c=['POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','Creating\x20new\x20task','/api/tasks','getString','Subjects','Descriptions','Contact','task','Task\x20created:','/contacts/','emit','trigger:browser:url','apiKey','remoteUri','stripTrailingSlash','serverUrl','toLowerCase','destcalleridnum','unmanaged','queue','outbound','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','util','moment','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','defaults','socket.io-emitter','GET','/api/selector/owners','headers','then','users','length','email','adminId','info','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userEmail','userId','User\x20found:','adminEmail','/api/lookup?q=','&f=','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','Contact\x20found\x20mobile_number:','endUserId','Contact\x20found\x20work_number:','Contact\x20created:'];(function(_0x47189d,_0x5bb3a6){var _0x1e7a84=function(_0x57e11d){while(--_0x57e11d){_0x47189d['push'](_0x47189d['shift']());}};_0x1e7a84(++_0x5bb3a6);}(_0x5d6c,0xc8));var _0xc5d6=function(_0x3bb20d,_0x22434a){_0x3bb20d=_0x3bb20d-0x0;var _0x1c4f45=_0x5d6c[_0x3bb20d];return _0x1c4f45;};'use strict';var _=require(_0xc5d6('0x0'));var rp=require(_0xc5d6('0x1'));var md5=require('md5');var util=require(_0xc5d6('0x2'));var moment=require(_0xc5d6('0x3'));var Promise=require('bluebird');var Redis=require(_0xc5d6('0x4'));var intUtil=require(_0xc5d6('0x5'));var config=require(_0xc5d6('0x6'));var logger=require(_0xc5d6('0x7'))(_0xc5d6('0x8'));config['redis']=_[_0xc5d6('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xc5d6('0xa'))(new Redis(config['redis']));function getAdminId(_0x1c1c74,_0x766290,_0x137b55,_0x4807b0){return new Promise(function(_0x2201a3,_0x5d8aeb){var _0x7a1c8b=![];var _0xa1a15a={'method':_0xc5d6('0xb'),'uri':_0x4807b0+_0xc5d6('0xc'),'json':!![]};_0xa1a15a[_0xc5d6('0xd')]=_0x137b55;logger['info']('Getting\x20admin\x20information');return rp(_0xa1a15a)[_0xc5d6('0xe')](function(_0x4f2736){if(_0x4f2736){var _0x1c98af=_0x4f2736[_0xc5d6('0xf')];var _0x371e8b=null;for(_0x371e8b=0x0;_0x371e8b<_0x1c98af[_0xc5d6('0x10')];_0x371e8b++){if(_0x1c98af[_0x371e8b][_0xc5d6('0x11')]===_0x1c1c74['adminEmail']){_0x1c1c74[_0xc5d6('0x12')]=_0x1c98af[_0x371e8b]['id'];_0x7a1c8b=!![];}}if(_0x7a1c8b){logger[_0xc5d6('0x13')](_0xc5d6('0x14'),_0x1c1c74[_0xc5d6('0x12')]);_0x2201a3(_0x1c1c74);}else{_0x5d8aeb({'statusCode':0x194,'message':_0xc5d6('0x15')});}}else{_0x5d8aeb({'statusCode':0x194,'message':_0xc5d6('0x15')});}})[_0xc5d6('0x16')](function(_0x265ac9){logger[_0xc5d6('0x17')]('['+[_0x766290[_0xc5d6('0x18')]()]+']',_0x265ac9[_0xc5d6('0x19')]);_0x5d8aeb(_0x265ac9);});});}function getUser(_0x27d7eb,_0x487223,_0x21ae38){return function(_0x9b8fbd){return new Promise(function(_0xb8eb04,_0x3232c2){var _0x5cbae5={'method':_0xc5d6('0xb'),'uri':_0x21ae38+_0xc5d6('0xc'),'json':!![]};_0x5cbae5['headers']=_0x487223;logger[_0xc5d6('0x13')](_0xc5d6('0x1a'));return rp(_0x5cbae5)['then'](function(_0x282295){if(_0x282295){var _0x5ed4a8=_0x282295[_0xc5d6('0xf')];var _0x506910=![];var _0x42d9ee=null;if(_0x9b8fbd[_0xc5d6('0x1b')]!==null){logger[_0xc5d6('0x13')](_0xc5d6('0x1c'),_0x9b8fbd[_0xc5d6('0x1b')]);_0x9b8fbd[_0xc5d6('0x1d')]=_0x9b8fbd[_0xc5d6('0x1b')];for(_0x42d9ee=0x0;_0x42d9ee<_0x5ed4a8['length'];_0x42d9ee++){if(_0x5ed4a8[_0x42d9ee]['email']===_0x9b8fbd['agentEmail']){_0x506910=!![];_0x9b8fbd[_0xc5d6('0x1e')]=_0x5ed4a8[_0x42d9ee]['id'];logger[_0xc5d6('0x13')](_0xc5d6('0x1f'),_0x9b8fbd[_0xc5d6('0x1e')]);}}}if(!_0x506910){logger[_0xc5d6('0x13')]('Admin\x20selected');_0x9b8fbd[_0xc5d6('0x1d')]=_0x9b8fbd[_0xc5d6('0x20')];_0x9b8fbd[_0xc5d6('0x1e')]=_0x9b8fbd[_0xc5d6('0x12')];_0x506910=!![];}if(_0x506910){_0xb8eb04(_0x9b8fbd);}else{_0x3232c2({'statusCode':0x194,'message':_0xc5d6('0x15')});}}else{_0x3232c2({'statusCode':0x194,'message':_0xc5d6('0x15')});}})[_0xc5d6('0x16')](function(_0x30d1ab){logger[_0xc5d6('0x17')]('['+[_0x27d7eb[_0xc5d6('0x18')]()]+']',_0x30d1ab[_0xc5d6('0x19')]);_0x3232c2(_0x30d1ab);});});};}function searchContact(_0x2ef769,_0x49a12a,_0x4e3225,_0x3b1de7){return new Promise(function(_0x253f11,_0x50c3d0){var _0x447928={'method':_0xc5d6('0xb'),'headers':_0x49a12a,'uri':_0x2ef769+_0xc5d6('0x21')+_0x3b1de7+_0xc5d6('0x22')+_0x4e3225+_0xc5d6('0x23'),'json':!![]};rp(_0x447928)[_0xc5d6('0xe')](function(_0x4a913d){var _0x126055=_[_0xc5d6('0x24')](_0x4a913d[_0xc5d6('0x25')][_0xc5d6('0x25')],[_0x4e3225,_0x3b1de7]);_0x253f11(_0x126055);})['catch'](function(_0x6872ce){_0x50c3d0(_0x6872ce);});});}function getEndUser(_0x3aa06d,_0x4cacc1,_0x4fcb59){return function(_0x1b0f6d){return new Promise(function(_0x3d696e,_0x2e5d29){logger[_0xc5d6('0x13')](util[_0xc5d6('0x26')](_0xc5d6('0x27'),_0x1b0f6d[_0xc5d6('0x28')]));searchContact(_0x4fcb59,_0x4cacc1,_0xc5d6('0x29'),_0x1b0f6d[_0xc5d6('0x28')])[_0xc5d6('0xe')](function(_0x11406a){if(_0x11406a){_0x1b0f6d['endUserId']=_0x11406a['id'];logger[_0xc5d6('0x13')](_0xc5d6('0x2a'),_0x1b0f6d[_0xc5d6('0x2b')]);return _0x3d696e(_0x1b0f6d);}searchContact(_0x4fcb59,_0x4cacc1,'work_number',_0x1b0f6d[_0xc5d6('0x28')])['then'](function(_0x288cd8){if(_0x288cd8){_0x1b0f6d[_0xc5d6('0x2b')]=_0x288cd8['id'];logger['info'](_0xc5d6('0x2c'),_0x1b0f6d[_0xc5d6('0x2b')]);return _0x3d696e(_0x1b0f6d);}createEndUser(_0x1b0f6d,_0x3aa06d,_0x4cacc1,_0x4fcb59)[_0xc5d6('0xe')](function(_0x3c8987){logger['info'](_0xc5d6('0x2d'),_0x3c8987['endUserId']);return _0x3d696e(_0x3c8987);});});})[_0xc5d6('0x16')](function(_0x5a1d5c){_0x2e5d29(_0x5a1d5c);});});};}function createEndUser(_0x3408a8,_0x5c467e,_0x53f544,_0x2384c8){return new Promise(function(_0x278684,_0x852fe3){var _0xd1f674=moment();var _0x4f4114={'method':_0xc5d6('0x2e'),'uri':_0x2384c8+_0xc5d6('0x2f'),'body':{'contact':{'last_name':_0x3408a8[_0xc5d6('0x28')],'work_number':_0x3408a8[_0xc5d6('0x28')],'mobile_number':_0x3408a8[_0xc5d6('0x28')],'owner_id':_0x3408a8[_0xc5d6('0x1e')],'created_at':_0xd1f674[_0xc5d6('0x26')](_0xc5d6('0x30'))}},'json':!![]};_0x4f4114[_0xc5d6('0xd')]=_0x53f544;logger[_0xc5d6('0x13')](_0xc5d6('0x31'));return rp(_0x4f4114)[_0xc5d6('0xe')](function(_0xdfe1ed){_0x3408a8['endUserId']=_0xdfe1ed['contact']['id'];_0x278684(_0x3408a8);})['catch'](function(_0x9f3c4c){logger[_0xc5d6('0x17')]('['+[_0x5c467e[_0xc5d6('0x18')]()]+']',_0x9f3c4c[_0xc5d6('0x19')]);_0x852fe3(_0x9f3c4c[_0xc5d6('0x19')]);});});}function getTicket(_0x20525a,_0x3499ad,_0x9f647e,_0x47e402,_0xa6f9dc){return function(_0x181b7c){logger[_0xc5d6('0x13')](_0xc5d6('0x32'));return new Promise(function(_0x5c3a39,_0x49e86b){var _0x23ec4f=moment();var _0x5ea6ca={'method':'POST','uri':_0x9f647e+_0xc5d6('0x33'),'body':{'title':intUtil[_0xc5d6('0x34')](_0x47e402[_0xc5d6('0x35')],_0xa6f9dc,'\x20'),'description':intUtil['getString'](_0x47e402[_0xc5d6('0x36')],_0xa6f9dc,'\x0a'),'owner_id':_0x181b7c[_0xc5d6('0x1e')],'creater_id':_0x181b7c['adminId'],'targetable_id':_0x181b7c['endUserId'],'targetable_type':_0xc5d6('0x37'),'created_at':_0x23ec4f[_0xc5d6('0x26')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x23ec4f['add'](0x1e,'m')[_0xc5d6('0x26')](_0xc5d6('0x30'))},'json':!![]};_0x5ea6ca[_0xc5d6('0xd')]=_0x3499ad;return rp(_0x5ea6ca)[_0xc5d6('0xe')](function(_0x66fc4){_0x181b7c['ticketId']=_0x66fc4[_0xc5d6('0x38')]['id'];logger[_0xc5d6('0x13')](_0xc5d6('0x39'),_0x181b7c['ticketId']);_0x5c3a39(_0x181b7c);})[_0xc5d6('0x16')](function(_0x113443){logger[_0xc5d6('0x17')]('['+[_0x20525a[_0xc5d6('0x18')]()]+']',_0x113443[_0xc5d6('0x19')]);_0x49e86b(_0x113443[_0xc5d6('0x19')]);});});};}function emit(_0x2fd60c,_0x1d826f,_0x24bd4e){var _0x506688={'uri':_0x2fd60c+_0xc5d6('0x3a')+_0x24bd4e};io['to'](util[_0xc5d6('0x26')]('user:%s',_0x1d826f))[_0xc5d6('0x3b')](_0xc5d6('0x3c'),_0x506688);}exports['cs']=function(_0xbcf018,_0x4feb2b,_0x24b4c7,_0x1e450b,_0x4feadb,_0x2fda6a,_0x160b16,_0x17e8ac){var _0x1f80bf={};var _0x155655={'Authorization':'Token\x20token='+_0x2fda6a[_0xc5d6('0x3d')]};_0x2fda6a[_0xc5d6('0x3e')]=intUtil[_0xc5d6('0x3f')](_0x2fda6a[_0xc5d6('0x3e')]);_0x2fda6a['serverUrl']=intUtil[_0xc5d6('0x3f')](_0x2fda6a[_0xc5d6('0x40')]);var _0x102f1d=_0x2fda6a[_0xc5d6('0x3e')];_0x1f80bf[_0xc5d6('0x20')]=_0x2fda6a['username'];_0x1f80bf['contactNumber']=_0x17e8ac[_0xc5d6('0x41')]()==='outbound'?_0x4feb2b[_0xc5d6('0x42')]:_0x4feb2b['calleridnum'];_0x1f80bf['callDirection']=_0x17e8ac==='queue'||_0x17e8ac===_0xc5d6('0x43')?_0xc5d6('0x44'):_0xc5d6('0x45');if(_0x1e450b){_0x1f80bf[_0xc5d6('0x1b')]=_0x1e450b[_0xc5d6('0x11')];}var _0x188343=util[_0xc5d6('0x26')](_0xc5d6('0x46'),_0x2fda6a['serverUrl'],_0x4feb2b[_0xc5d6('0x47')],md5(_0x4feb2b['uniqueid']));if(_0x4feadb&&_0x4feadb[_0xc5d6('0x48')]){logger['info'](_0xc5d6('0x49'),_0xc5d6('0x4a'));_0x4feb2b[_0xc5d6('0x4b')]=_0x188343;}else if(_0x160b16&&_0x160b16[_0xc5d6('0x4c')]&&_0x160b16['recordingFormat']!==_0xc5d6('0x4d')){logger[_0xc5d6('0x13')](_0xc5d6('0x4e'),'Recording\x20is\x20enabled!');_0x4feb2b[_0xc5d6('0x4b')]=_0x188343;}else{_0x4feb2b[_0xc5d6('0x4b')]='';}return getAdminId(_0x1f80bf,_0x17e8ac,_0x155655,_0x102f1d)[_0xc5d6('0xe')](getUser(_0x17e8ac,_0x155655,_0x102f1d))[_0xc5d6('0xe')](getEndUser(_0x17e8ac,_0x155655,_0x102f1d))[_0xc5d6('0xe')](getTicket(_0x17e8ac,_0x155655,_0x102f1d,_0x24b4c7,_0x4feb2b))['then'](function(_0x6f12f9){logger[_0xc5d6('0x13')](util[_0xc5d6('0x26')]('The\x20ticket\x20ID\x20is:\x20%s',_0x6f12f9['ticketId']));if(_0x17e8ac!==_0xc5d6('0x43')){logger['info']('['+[_0x17e8ac[_0xc5d6('0x18')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x102f1d,_0x1e450b[_0xc5d6('0x4f')],_0x6f12f9[_0xc5d6('0x2b')]);}})['catch'](function(_0x1982cb){logger[_0xc5d6('0x17')]('['+[_0x17e8ac[_0xc5d6('0x18')]()]+_0xc5d6('0x50'),util[_0xc5d6('0x51')](_0x1982cb,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x3d4b=['userId','Admin\x20selected','catch','message','/api/lookup?q=','&f=','&entities=contact','find','contacts','mobile_number','contactNumber','endUserId','Contact\x20found\x20mobile_number:','work_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','/api/tasks','getString','Descriptions','adminId','format','add','ticketId','Task\x20created:','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','serverUrl','stripTrailingSlash','toLowerCase','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','name',']\x20Error\x20running\x20Freshsales\x20integration','lodash','request-promise','md5','util','moment','bluebird','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','localhost','socket.io-emitter','GET','info','Getting\x20admin\x20information','then','users','email','adminEmail','Admin\x20found:','Requested\x20Resource\x20not\x20Found','error','toUpperCase','headers','Getting\x20user\x20list','agentEmail','userEmail','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3d4b,0x91));var _0xb3d4=function(_0x1116ea,_0x534698){_0x1116ea=_0x1116ea-0x0;var _0x2051d6=_0x3d4b[_0x1116ea];return _0x2051d6;};'use strict';var _=require(_0xb3d4('0x0'));var rp=require(_0xb3d4('0x1'));var md5=require(_0xb3d4('0x2'));var util=require(_0xb3d4('0x3'));var moment=require(_0xb3d4('0x4'));var Promise=require(_0xb3d4('0x5'));var Redis=require('ioredis');var intUtil=require(_0xb3d4('0x6'));var config=require(_0xb3d4('0x7'));var logger=require(_0xb3d4('0x8'))(_0xb3d4('0x9'));config[_0xb3d4('0xa')]=_['defaults'](config[_0xb3d4('0xa')],{'host':_0xb3d4('0xb'),'port':0x18eb});var io=require(_0xb3d4('0xc'))(new Redis(config['redis']));function getAdminId(_0x158f4b,_0x3a23ab,_0x2bc33d,_0x3720c3){return new Promise(function(_0x500180,_0x5cdda1){var _0x310f08=![];var _0x685dc2={'method':_0xb3d4('0xd'),'uri':_0x3720c3+'/api/selector/owners','json':!![]};_0x685dc2['headers']=_0x2bc33d;logger[_0xb3d4('0xe')](_0xb3d4('0xf'));return rp(_0x685dc2)[_0xb3d4('0x10')](function(_0x25e7c0){if(_0x25e7c0){var _0x1994d4=_0x25e7c0[_0xb3d4('0x11')];var _0x22f6f1=null;for(_0x22f6f1=0x0;_0x22f6f1<_0x1994d4['length'];_0x22f6f1++){if(_0x1994d4[_0x22f6f1][_0xb3d4('0x12')]===_0x158f4b[_0xb3d4('0x13')]){_0x158f4b['adminId']=_0x1994d4[_0x22f6f1]['id'];_0x310f08=!![];}}if(_0x310f08){logger['info'](_0xb3d4('0x14'),_0x158f4b['adminId']);_0x500180(_0x158f4b);}else{_0x5cdda1({'statusCode':0x194,'message':_0xb3d4('0x15')});}}else{_0x5cdda1({'statusCode':0x194,'message':_0xb3d4('0x15')});}})['catch'](function(_0x5a0544){logger[_0xb3d4('0x16')]('['+[_0x3a23ab[_0xb3d4('0x17')]()]+']',_0x5a0544['message']);_0x5cdda1(_0x5a0544);});});}function getUser(_0x401df5,_0x92853b,_0x2b1a61){return function(_0x5029a2){return new Promise(function(_0x15a318,_0x44bfd3){var _0x16ed37={'method':_0xb3d4('0xd'),'uri':_0x2b1a61+'/api/selector/owners','json':!![]};_0x16ed37[_0xb3d4('0x18')]=_0x92853b;logger[_0xb3d4('0xe')](_0xb3d4('0x19'));return rp(_0x16ed37)[_0xb3d4('0x10')](function(_0x55a8a3){if(_0x55a8a3){var _0x1b32ed=_0x55a8a3[_0xb3d4('0x11')];var _0x1f6e32=![];var _0x1f8b93=null;if(_0x5029a2[_0xb3d4('0x1a')]!==null){logger['info']('Getting\x20user\x20with\x20email',_0x5029a2[_0xb3d4('0x1a')]);_0x5029a2[_0xb3d4('0x1b')]=_0x5029a2['agentEmail'];for(_0x1f8b93=0x0;_0x1f8b93<_0x1b32ed[_0xb3d4('0x1c')];_0x1f8b93++){if(_0x1b32ed[_0x1f8b93][_0xb3d4('0x12')]===_0x5029a2['agentEmail']){_0x1f6e32=!![];_0x5029a2['userId']=_0x1b32ed[_0x1f8b93]['id'];logger[_0xb3d4('0xe')]('User\x20found:',_0x5029a2[_0xb3d4('0x1d')]);}}}if(!_0x1f6e32){logger[_0xb3d4('0xe')](_0xb3d4('0x1e'));_0x5029a2[_0xb3d4('0x1b')]=_0x5029a2[_0xb3d4('0x13')];_0x5029a2[_0xb3d4('0x1d')]=_0x5029a2['adminId'];_0x1f6e32=!![];}if(_0x1f6e32){_0x15a318(_0x5029a2);}else{_0x44bfd3({'statusCode':0x194,'message':_0xb3d4('0x15')});}}else{_0x44bfd3({'statusCode':0x194,'message':_0xb3d4('0x15')});}})[_0xb3d4('0x1f')](function(_0x26517e){logger[_0xb3d4('0x16')]('['+[_0x401df5[_0xb3d4('0x17')]()]+']',_0x26517e[_0xb3d4('0x20')]);_0x44bfd3(_0x26517e);});});};}function searchContact(_0x2162c2,_0x48627e,_0xf3755e,_0x5b9bc8){return new Promise(function(_0x552aa3,_0xd34da2){var _0x578364={'method':_0xb3d4('0xd'),'headers':_0x48627e,'uri':_0x2162c2+_0xb3d4('0x21')+_0x5b9bc8+_0xb3d4('0x22')+_0xf3755e+_0xb3d4('0x23'),'json':!![]};rp(_0x578364)[_0xb3d4('0x10')](function(_0x4daef5){var _0xb657fe=_[_0xb3d4('0x24')](_0x4daef5[_0xb3d4('0x25')][_0xb3d4('0x25')],[_0xf3755e,_0x5b9bc8]);_0x552aa3(_0xb657fe);})[_0xb3d4('0x1f')](function(_0x4f4191){_0xd34da2(_0x4f4191);});});}function getEndUser(_0x11b735,_0x1c72dc,_0xe17cdd){return function(_0x18b3af){return new Promise(function(_0x5e1dbf,_0x19bdb9){logger[_0xb3d4('0xe')](util['format']('Searching\x20contact\x20with\x20phone\x20%s',_0x18b3af['contactNumber']));searchContact(_0xe17cdd,_0x1c72dc,_0xb3d4('0x26'),_0x18b3af[_0xb3d4('0x27')])[_0xb3d4('0x10')](function(_0x55e276){if(_0x55e276){_0x18b3af[_0xb3d4('0x28')]=_0x55e276['id'];logger[_0xb3d4('0xe')](_0xb3d4('0x29'),_0x18b3af[_0xb3d4('0x28')]);return _0x5e1dbf(_0x18b3af);}searchContact(_0xe17cdd,_0x1c72dc,_0xb3d4('0x2a'),_0x18b3af[_0xb3d4('0x27')])['then'](function(_0x2e56e5){if(_0x2e56e5){_0x18b3af['endUserId']=_0x2e56e5['id'];logger[_0xb3d4('0xe')](_0xb3d4('0x2b'),_0x18b3af[_0xb3d4('0x28')]);return _0x5e1dbf(_0x18b3af);}createEndUser(_0x18b3af,_0x11b735,_0x1c72dc,_0xe17cdd)['then'](function(_0x111a98){logger[_0xb3d4('0xe')](_0xb3d4('0x2c'),_0x111a98[_0xb3d4('0x28')]);return _0x5e1dbf(_0x111a98);});});})[_0xb3d4('0x1f')](function(_0x19f18a){_0x19bdb9(_0x19f18a);});});};}function createEndUser(_0x297889,_0x246ff0,_0x334f1d,_0x1d7b7f){return new Promise(function(_0x10c428,_0x53a1dd){var _0x36b217=moment();var _0x2c520d={'method':_0xb3d4('0x2d'),'uri':_0x1d7b7f+_0xb3d4('0x2e'),'body':{'contact':{'last_name':_0x297889[_0xb3d4('0x27')],'work_number':_0x297889['contactNumber'],'mobile_number':_0x297889[_0xb3d4('0x27')],'owner_id':_0x297889[_0xb3d4('0x1d')],'created_at':_0x36b217['format'](_0xb3d4('0x2f'))}},'json':!![]};_0x2c520d[_0xb3d4('0x18')]=_0x334f1d;logger[_0xb3d4('0xe')](_0xb3d4('0x30'));return rp(_0x2c520d)[_0xb3d4('0x10')](function(_0x57ef29){_0x297889[_0xb3d4('0x28')]=_0x57ef29[_0xb3d4('0x31')]['id'];_0x10c428(_0x297889);})[_0xb3d4('0x1f')](function(_0x2aabc1){logger[_0xb3d4('0x16')]('['+[_0x246ff0[_0xb3d4('0x17')]()]+']',_0x2aabc1[_0xb3d4('0x20')]);_0x53a1dd(_0x2aabc1[_0xb3d4('0x20')]);});});}function getTicket(_0x16b4fa,_0x18f155,_0x1776fa,_0x2ba87b,_0x2a8188){return function(_0x2c013b){logger['info'](_0xb3d4('0x32'));return new Promise(function(_0x29f42b,_0x4bc028){var _0x46e65b=moment();var _0x100073={'method':_0xb3d4('0x2d'),'uri':_0x1776fa+_0xb3d4('0x33'),'body':{'title':intUtil[_0xb3d4('0x34')](_0x2ba87b['Subjects'],_0x2a8188,'\x20'),'description':intUtil[_0xb3d4('0x34')](_0x2ba87b[_0xb3d4('0x35')],_0x2a8188,'\x0a'),'owner_id':_0x2c013b[_0xb3d4('0x1d')],'creater_id':_0x2c013b[_0xb3d4('0x36')],'targetable_id':_0x2c013b[_0xb3d4('0x28')],'targetable_type':'Contact','created_at':_0x46e65b[_0xb3d4('0x37')](_0xb3d4('0x2f')),'due_date':_0x46e65b[_0xb3d4('0x38')](0x1e,'m')[_0xb3d4('0x37')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x100073[_0xb3d4('0x18')]=_0x18f155;return rp(_0x100073)['then'](function(_0x345676){_0x2c013b[_0xb3d4('0x39')]=_0x345676['task']['id'];logger[_0xb3d4('0xe')](_0xb3d4('0x3a'),_0x2c013b[_0xb3d4('0x39')]);_0x29f42b(_0x2c013b);})[_0xb3d4('0x1f')](function(_0x3f8fa5){logger[_0xb3d4('0x16')]('['+[_0x16b4fa['toUpperCase']()]+']',_0x3f8fa5['message']);_0x4bc028(_0x3f8fa5['message']);});});};}function emit(_0x8a8b3a,_0x22590c,_0x559e57){var _0x20e011={'uri':_0x8a8b3a+_0xb3d4('0x3b')+_0x559e57};io['to'](util[_0xb3d4('0x37')](_0xb3d4('0x3c'),_0x22590c))[_0xb3d4('0x3d')](_0xb3d4('0x3e'),_0x20e011);}exports['cs']=function(_0xe433a9,_0x97322a,_0x3ba310,_0x5c0888,_0x228c25,_0xd20b2a,_0xf46336,_0x4d447a){var _0x4f5414={};var _0x3210f7={'Authorization':_0xb3d4('0x3f')+_0xd20b2a[_0xb3d4('0x40')]};_0xd20b2a['remoteUri']=intUtil['stripTrailingSlash'](_0xd20b2a[_0xb3d4('0x41')]);_0xd20b2a[_0xb3d4('0x42')]=intUtil[_0xb3d4('0x43')](_0xd20b2a['serverUrl']);var _0x65d2eb=_0xd20b2a['remoteUri'];_0x4f5414['adminEmail']=_0xd20b2a['username'];_0x4f5414[_0xb3d4('0x27')]=_0x4d447a[_0xb3d4('0x44')]()===_0xb3d4('0x45')?_0x97322a[_0xb3d4('0x46')]:_0x97322a[_0xb3d4('0x47')];_0x4f5414[_0xb3d4('0x48')]=_0x4d447a===_0xb3d4('0x49')||_0x4d447a===_0xb3d4('0x4a')?_0xb3d4('0x49'):_0xb3d4('0x45');if(_0x5c0888){_0x4f5414[_0xb3d4('0x1a')]=_0x5c0888[_0xb3d4('0x12')];}var _0x405bb0=util[_0xb3d4('0x37')](_0xb3d4('0x4b'),_0xd20b2a[_0xb3d4('0x42')],_0x97322a['uniqueid'],md5(_0x97322a[_0xb3d4('0x4c')]));if(_0x228c25&&_0x228c25[_0xb3d4('0x4d')]){logger[_0xb3d4('0xe')](_0xb3d4('0x4e'),_0xb3d4('0x4f'));_0x97322a[_0xb3d4('0x50')]=_0x405bb0;}else if(_0xf46336&&_0xf46336[_0xb3d4('0x51')]&&_0xf46336['recordingFormat']!==_0xb3d4('0x52')){logger[_0xb3d4('0xe')](_0xb3d4('0x53'),_0xb3d4('0x4f'));_0x97322a[_0xb3d4('0x50')]=_0x405bb0;}else{_0x97322a[_0xb3d4('0x50')]='';}return getAdminId(_0x4f5414,_0x4d447a,_0x3210f7,_0x65d2eb)[_0xb3d4('0x10')](getUser(_0x4d447a,_0x3210f7,_0x65d2eb))[_0xb3d4('0x10')](getEndUser(_0x4d447a,_0x3210f7,_0x65d2eb))[_0xb3d4('0x10')](getTicket(_0x4d447a,_0x3210f7,_0x65d2eb,_0x3ba310,_0x97322a))['then'](function(_0x367be2){logger[_0xb3d4('0xe')](util['format'](_0xb3d4('0x54'),_0x367be2['ticketId']));if(_0x4d447a!=='unmanaged'){logger[_0xb3d4('0xe')]('['+[_0x4d447a[_0xb3d4('0x17')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x65d2eb,_0x5c0888[_0xb3d4('0x55')],_0x367be2[_0xb3d4('0x28')]);}})[_0xb3d4('0x1f')](function(_0x59b0ad){logger['error']('['+[_0x4d447a['toUpperCase']()]+_0xb3d4('0x56'),util['inspect'](_0x59b0ad,{'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 1662dbc..993e435 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 _0x8858=['%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./salesforce','./freshdesk','./desk','./vtiger','./servicenow','./dynamics365','zendesk','salesforce','sugarcrm','zoho','desk','vtiger','dynamics365','servicenow','exec','includes','data1','toLowerCase','data2','find','Configurations','queue','log','EVENT\x20UNKNOWN','unmanaged','freshdesk','freshsales','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','data3'];(function(_0x2afbb0,_0x44f16d){var _0x411ff2=function(_0x5edd7e){while(--_0x5edd7e){_0x2afbb0['push'](_0x2afbb0['shift']());}};_0x411ff2(++_0x44f16d);}(_0x8858,0xdf));var _0x8885=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0x8858[_0x40ac5e];return _0x2839d6;};'use strict';var _=require(_0x8885('0x0'));var util=require(_0x8885('0x1'));var zendesk=require(_0x8885('0x2'));var salesforce=require(_0x8885('0x3'));var sugarcrm=require('./sugarcrm');var freshdesk=require(_0x8885('0x4'));var zoho=require('./zoho');var desk=require(_0x8885('0x5'));var vtiger=require(_0x8885('0x6'));var servicenow=require(_0x8885('0x7'));var dynamics365=require(_0x8885('0x8'));var freshsales=require('./freshsales');var integrations=[_0x8885('0x9'),_0x8885('0xa'),_0x8885('0xb'),'freshdesk',_0x8885('0xc'),_0x8885('0xd'),_0x8885('0xe'),_0x8885('0xf'),'freshsales',_0x8885('0x10')];exports[_0x8885('0x11')]=function(_0x1e17a3,_0x5bd83d,_0x1046da,_0xa74b52,_0xc7338f,_0x93914b){if(_0x1046da){if(_[_0x8885('0x12')](integrations,_0x1e17a3[_0x8885('0x13')][_0x8885('0x14')]())){try{var _0x57657b=null;var _0x3820a7='';var _0x3fa49e=_0x1046da[_0x1e17a3[_0x8885('0x13')]['toLowerCase']()];if(_0x3fa49e){var _0x2ce4d6=_0x3fa49e[_0x1e17a3[_0x8885('0x15')]];if(_0x2ce4d6){var _0x5f1a46=_[_0x8885('0x16')](_0x2ce4d6[_0x8885('0x17')],{'id':parseInt(_0x1e17a3['data3'],0xa)});if(_0x5f1a46){if(_0xa74b52){if(_0xc7338f&&_0x5bd83d['queue']){_0x3820a7=_0x8885('0x18');}else if(_0x5bd83d['routeId']){_0x3820a7='outbound';}else{console[_0x8885('0x19')](_0x8885('0x1a'),_0x5bd83d);}}else{_0x3820a7=_0x8885('0x1b');}switch(_0x1e17a3[_0x8885('0x13')][_0x8885('0x14')]()){case _0x8885('0x9'):zendesk[_0x3820a7](_0x1e17a3,_0x5bd83d,_0x5f1a46,_0xa74b52,_0xc7338f,_0x2ce4d6,_0x93914b);break;case'salesforce':salesforce[_0x3820a7](_0x1e17a3,_0x5bd83d,_0x5f1a46,_0xa74b52,_0xc7338f,_0x2ce4d6,_0x93914b);break;case _0x8885('0xb'):sugarcrm[_0x3820a7](_0x1e17a3,_0x5bd83d,_0x5f1a46,_0xa74b52,_0xc7338f,_0x2ce4d6,_0x93914b);break;case _0x8885('0x1c'):freshdesk[_0x3820a7](_0x1e17a3,_0x5bd83d,_0x5f1a46,_0xa74b52,_0xc7338f,_0x2ce4d6,_0x93914b);break;case _0x8885('0xc'):zoho[_0x3820a7](_0x1e17a3,_0x5bd83d,_0x5f1a46,_0xa74b52,_0xc7338f,_0x2ce4d6,_0x93914b);break;case'desk':desk[_0x3820a7](_0x1e17a3,_0x5bd83d,_0x5f1a46,_0xa74b52,_0xc7338f,_0x2ce4d6,_0x93914b);break;case _0x8885('0xe'):vtiger[_0x3820a7](_0x1e17a3,_0x5bd83d,_0x5f1a46,_0xa74b52,_0xc7338f,_0x2ce4d6,_0x93914b);break;case _0x8885('0x1d'):freshsales['cs'](_0x1e17a3,_0x5bd83d,_0x5f1a46,_0xa74b52,_0xc7338f,_0x2ce4d6,_0x93914b,_0x3820a7);break;case _0x8885('0x10'):servicenow['cs'](_0x1e17a3,_0x5bd83d,_0x5f1a46,_0xa74b52,_0xc7338f,_0x2ce4d6,_0x93914b,_0x3820a7);break;case _0x8885('0xf'):dynamics365['cs'](_0x1e17a3,_0x5bd83d,_0x5f1a46,_0xa74b52,_0xc7338f,_0x2ce4d6,_0x93914b,_0x3820a7);break;default:console[_0x8885('0x19')]('unknown\x20integration');}}else{_0x57657b=require(_0x8885('0x1e'))(_0x1e17a3[_0x8885('0x13')][_0x8885('0x14')]());_0x57657b[_0x8885('0x1f')](_0x8885('0x20'),util[_0x8885('0x21')](_0x8885('0x22'),_0x1e17a3[_0x8885('0x13')][_0x8885('0x14')](),_0x1e17a3[_0x8885('0x23')]));}}else{_0x57657b=require(_0x8885('0x1e'))(_0x1e17a3[_0x8885('0x13')][_0x8885('0x14')]());_0x57657b[_0x8885('0x1f')](_0x8885('0x20'),util['format'](_0x8885('0x24'),_0x1e17a3[_0x8885('0x13')]['toLowerCase'](),_0x1e17a3[_0x8885('0x15')]));}}else{}}catch(_0x28d437){console['error'](_0x28d437);}}}}; \ No newline at end of file +var _0x003a=['data2','find','queue','routeId','outbound','log','EVENT\x20UNKNOWN','salesforce','freshsales','unknown\x20integration','../../../../config/logger','error','[EXEC]','%s\x20configuration\x20#%s\x20not\x20found','data3','%s\x20account\x20#%s\x20not\x20found','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./vtiger','./freshsales','zendesk','sugarcrm','freshdesk','zoho','vtiger','dynamics365','servicenow','data1','toLowerCase'];(function(_0x3e3ed6,_0x16813f){var _0x5df4e6=function(_0x5174a8){while(--_0x5174a8){_0x3e3ed6['push'](_0x3e3ed6['shift']());}};_0x5df4e6(++_0x16813f);}(_0x003a,0x1b0));var _0xa003=function(_0x58f738,_0x4b9a08){_0x58f738=_0x58f738-0x0;var _0x54be39=_0x003a[_0x58f738];return _0x54be39;};'use strict';var _=require('lodash');var util=require(_0xa003('0x0'));var zendesk=require(_0xa003('0x1'));var salesforce=require(_0xa003('0x2'));var sugarcrm=require(_0xa003('0x3'));var freshdesk=require(_0xa003('0x4'));var zoho=require('./zoho');var desk=require('./desk');var vtiger=require(_0xa003('0x5'));var servicenow=require('./servicenow');var dynamics365=require('./dynamics365');var freshsales=require(_0xa003('0x6'));var integrations=[_0xa003('0x7'),'salesforce',_0xa003('0x8'),_0xa003('0x9'),_0xa003('0xa'),'desk',_0xa003('0xb'),_0xa003('0xc'),'freshsales',_0xa003('0xd')];exports['exec']=function(_0x52fcdb,_0x11c5b0,_0x2ba114,_0x8aaaa8,_0x150048,_0xff5560){if(_0x2ba114){if(_['includes'](integrations,_0x52fcdb[_0xa003('0xe')][_0xa003('0xf')]())){try{var _0x41e95d=null;var _0x49c80f='';var _0x5c6f04=_0x2ba114[_0x52fcdb[_0xa003('0xe')]['toLowerCase']()];if(_0x5c6f04){var _0x270175=_0x5c6f04[_0x52fcdb[_0xa003('0x10')]];if(_0x270175){var _0x4c13db=_[_0xa003('0x11')](_0x270175['Configurations'],{'id':parseInt(_0x52fcdb['data3'],0xa)});if(_0x4c13db){if(_0x8aaaa8){if(_0x150048&&_0x11c5b0[_0xa003('0x12')]){_0x49c80f=_0xa003('0x12');}else if(_0x11c5b0[_0xa003('0x13')]){_0x49c80f=_0xa003('0x14');}else{console[_0xa003('0x15')](_0xa003('0x16'),_0x11c5b0);}}else{_0x49c80f='unmanaged';}switch(_0x52fcdb['data1'][_0xa003('0xf')]()){case _0xa003('0x7'):zendesk[_0x49c80f](_0x52fcdb,_0x11c5b0,_0x4c13db,_0x8aaaa8,_0x150048,_0x270175,_0xff5560);break;case _0xa003('0x17'):salesforce[_0x49c80f](_0x52fcdb,_0x11c5b0,_0x4c13db,_0x8aaaa8,_0x150048,_0x270175,_0xff5560);break;case'sugarcrm':sugarcrm[_0x49c80f](_0x52fcdb,_0x11c5b0,_0x4c13db,_0x8aaaa8,_0x150048,_0x270175,_0xff5560);break;case _0xa003('0x9'):freshdesk[_0x49c80f](_0x52fcdb,_0x11c5b0,_0x4c13db,_0x8aaaa8,_0x150048,_0x270175,_0xff5560);break;case'zoho':zoho[_0x49c80f](_0x52fcdb,_0x11c5b0,_0x4c13db,_0x8aaaa8,_0x150048,_0x270175,_0xff5560);break;case'desk':desk[_0x49c80f](_0x52fcdb,_0x11c5b0,_0x4c13db,_0x8aaaa8,_0x150048,_0x270175,_0xff5560);break;case _0xa003('0xb'):vtiger[_0x49c80f](_0x52fcdb,_0x11c5b0,_0x4c13db,_0x8aaaa8,_0x150048,_0x270175,_0xff5560);break;case _0xa003('0x18'):freshsales['cs'](_0x52fcdb,_0x11c5b0,_0x4c13db,_0x8aaaa8,_0x150048,_0x270175,_0xff5560,_0x49c80f);break;case _0xa003('0xd'):servicenow['cs'](_0x52fcdb,_0x11c5b0,_0x4c13db,_0x8aaaa8,_0x150048,_0x270175,_0xff5560,_0x49c80f);break;case _0xa003('0xc'):dynamics365['cs'](_0x52fcdb,_0x11c5b0,_0x4c13db,_0x8aaaa8,_0x150048,_0x270175,_0xff5560,_0x49c80f);break;default:console['log'](_0xa003('0x19'));}}else{_0x41e95d=require(_0xa003('0x1a'))(_0x52fcdb['data1'][_0xa003('0xf')]());_0x41e95d[_0xa003('0x1b')](_0xa003('0x1c'),util['format'](_0xa003('0x1d'),_0x52fcdb[_0xa003('0xe')][_0xa003('0xf')](),_0x52fcdb[_0xa003('0x1e')]));}}else{_0x41e95d=require(_0xa003('0x1a'))(_0x52fcdb[_0xa003('0xe')][_0xa003('0xf')]());_0x41e95d['error'](_0xa003('0x1c'),util['format'](_0xa003('0x1f'),_0x52fcdb[_0xa003('0xe')][_0xa003('0xf')](),_0x52fcdb['data2']));}}else{}}catch(_0xbba76b){console[_0xa003('0x1b')](_0xbba76b);}}}}; \ 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 b59f780..24a82b6 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 _0xe215=['Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','cloneDeep','additionalSearchContact','merge','$or','Contact','execute','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','Account','attributes','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','Company','upperFirst','includes','string','picklist','type','idField','content','toString','variable','variableName','customVariable','Variable','name','password','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','username','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','newTab','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','outbound','recordingFormat','none','[OUTBOUND]','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','Salesforce\x20account\x20type\x20not\x20recognized','catch','unmanaged','toUpperCase',']\x20Ticket\x20%s\x20created.','lastevent',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','md5','jsforce','util','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','socket.io-emitter','assign','getString','Subjects','Descriptions','Task','ActivityDate','IsReminderSet','IsRecurrence','endUserType','contact','lead','WhoId','account','WhatId','ticketType','Case','ContactId','AccountId','leadId','info','sobject','create','isNil','find','length','Email','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','then','resolve','user_id','display_name'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0xe215,0x151));var _0x5e21=function(_0x86d14d,_0x5dd9f7){_0x86d14d=_0x86d14d-0x0;var _0x44b0e0=_0xe215[_0x86d14d];return _0x44b0e0;};'use strict';var _=require(_0x5e21('0x0'));var rp=require(_0x5e21('0x1'));var moment=require(_0x5e21('0x2'));var BPromise=require(_0x5e21('0x3'));var md5=require(_0x5e21('0x4'));var jsforce=require(_0x5e21('0x5'));var util=require(_0x5e21('0x6'));var Redis=require('ioredis');var intUtil=require(_0x5e21('0x7'));var config=require(_0x5e21('0x8'));var logger=require(_0x5e21('0x9'))(_0x5e21('0xa'));config[_0x5e21('0xb')]=_[_0x5e21('0xc')](config[_0x5e21('0xb')],{'host':'localhost','port':0x18eb});var io=require(_0x5e21('0xd'))(new Redis(config[_0x5e21('0xb')]));function emit(_0x2cb1ce,_0x10ba16,_0x1799ea){io['to'](_0x2cb1ce)['emit'](_0x10ba16,_0x1799ea);}function getTicket(_0x494b3e,_0x533a5e,_0x1382c9,_0x373190,_0x2c1f57,_0x4c57c6,_0x3ef1aa,_0x48590a){var _0x2b2b13=Object[_0x5e21('0xe')]({},{'OwnerId':_0x533a5e['id'],'Subject':intUtil[_0x5e21('0xf')](_0x373190[_0x5e21('0x10')],_0x2c1f57,'\x20'),'Description':intUtil[_0x5e21('0xf')](_0x373190[_0x5e21('0x11')],_0x2c1f57,'\x0a')},getCustomFields(_0x4c57c6,_0x2c1f57));if(_0x1382c9){if(_0x373190['ticketType']===_0x5e21('0x12')){_0x2b2b13[_0x5e21('0x13')]=moment['utc']();_0x2b2b13[_0x5e21('0x14')]=![];_0x2b2b13[_0x5e21('0x15')]=![];if(_0x1382c9[_0x5e21('0x16')]===_0x5e21('0x17')||_0x1382c9['endUserType']===_0x5e21('0x18')){_0x2b2b13[_0x5e21('0x19')]=_0x1382c9['id'];}else if(_0x1382c9[_0x5e21('0x16')]===_0x5e21('0x1a')){_0x2b2b13[_0x5e21('0x1b')]=_0x1382c9['id'];}}else if(_0x373190[_0x5e21('0x1c')]===_0x5e21('0x1d')){if(_0x1382c9['endUserType']==='contact'){_0x2b2b13[_0x5e21('0x1e')]=_0x1382c9['id'];}else if(_0x1382c9[_0x5e21('0x16')]===_0x5e21('0x1a')){_0x2b2b13[_0x5e21('0x1f')]=_0x1382c9['id'];}else if(_0x1382c9[_0x5e21('0x16')]===_0x5e21('0x18')&&_0x373190[_0x5e21('0x20')]){_0x2b2b13[_0x373190[_0x5e21('0x20')]]=_0x1382c9['id'];}else{logger[_0x5e21('0x21')]('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0x3ef1aa[_0x5e21('0x22')](_0x373190[_0x5e21('0x1c')])[_0x5e21('0x23')](_0x2b2b13);}function getUser(_0x333671,_0x5967e0,_0x34fbd7){if(!_[_0x5e21('0x24')](_0x5967e0)&&intUtil['validateEmail'](_0x5967e0)){var _0x1837a6={'Email':_0x5967e0};var _0x34e597={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x34fbd7[_0x5e21('0x22')]('User')[_0x5e21('0x25')](_0x1837a6,_0x34e597)['execute']()['then'](function(_0x4d2a97){if(_0x4d2a97[_0x5e21('0x26')]){var _0x2c12ef=_[_0x5e21('0x25')](_0x4d2a97,function(_0x437d11){return _0x437d11[_0x5e21('0x27')]===_0x5967e0;});if(_0x2c12ef){logger[_0x5e21('0x21')]('Agent\x20%s\x20found.',_0x5967e0);return BPromise['resolve']({'id':_0x2c12ef['Id'],'name':_0x2c12ef[_0x5e21('0x28')]});}}else{logger[_0x5e21('0x21')](_0x5e21('0x29'),_0x5967e0);return _0x34fbd7[_0x5e21('0x2a')]()[_0x5e21('0x2b')](function(_0x396a0b){return BPromise[_0x5e21('0x2c')]({'id':_0x396a0b[_0x5e21('0x2d')],'name':_0x396a0b[_0x5e21('0x2e')]});});}});}else{logger[_0x5e21('0x21')](_0x5e21('0x29'),_0x5967e0);return _0x34fbd7['identity']()[_0x5e21('0x2b')](function(_0x11e54e){return BPromise[_0x5e21('0x2c')]({'id':_0x11e54e[_0x5e21('0x2d')],'name':_0x11e54e[_0x5e21('0x2e')]});});}}function getEndUser(_0x1bfd92,_0xe1a908,_0x1ef646,_0x24dbeb,_0x48d06e){var _0xf993f7={'$or':{'Phone':_0x24dbeb}};var _0x4a2089={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0x5e21('0x2b')](function(){logger['info'](_0x5e21('0x2f'),_0x24dbeb,_0xe1a908[_0x5e21('0x30')]);switch(_0xe1a908['moduleSearch']){case'contact_lead':var _0x2e465=_[_0x5e21('0x31')](_0xf993f7);if(_0xe1a908[_0x5e21('0x32')]){var _0x2f83dd={};_0x2f83dd[_0xe1a908['additionalSearchContact']]=_0x24dbeb;_[_0x5e21('0x33')](_0x2e465[_0x5e21('0x34')],_0x2f83dd);}return _0x48d06e[_0x5e21('0x22')](_0x5e21('0x35'))['find'](_0x2e465,_0x4a2089)[_0x5e21('0x36')]()[_0x5e21('0x2b')](function(_0x5270e9){if(_0x5270e9&&_0x5270e9[_0x5e21('0x26')]){return _0x5270e9;}else{var _0x29299d=_['cloneDeep'](_0xf993f7);if(_0xe1a908[_0x5e21('0x37')]){var _0x280c9c={};_0x280c9c[_0xe1a908[_0x5e21('0x37')]]=_0x24dbeb;_[_0x5e21('0x33')](_0x29299d[_0x5e21('0x34')],_0x280c9c);}return _0x48d06e[_0x5e21('0x22')](_0x5e21('0x38'))[_0x5e21('0x25')](_0x29299d,_0x4a2089);}});case _0x5e21('0x39'):var _0x32c528=_['cloneDeep'](_0xf993f7);if(_0xe1a908[_0x5e21('0x3a')]){var _0x2f83dd={};_0x2f83dd[_0xe1a908[_0x5e21('0x3a')]]=_0x24dbeb;_['merge'](_0x32c528[_0x5e21('0x34')],_0x2f83dd);}return _0x48d06e[_0x5e21('0x22')](_0x5e21('0x3b'))[_0x5e21('0x25')](_0x32c528,_0x4a2089)[_0x5e21('0x36')]()[_0x5e21('0x2b')](function(_0x3d6656){if(_0x3d6656&&_0x3d6656[_0x5e21('0x26')]){return _0x3d6656;}else{var _0x31b3da=_[_0x5e21('0x31')](_0xf993f7);if(_0xe1a908['additionalSearchContact']){var _0xea5812={};_0xea5812[_0xe1a908['additionalSearchContact']]=_0x24dbeb;_[_0x5e21('0x33')](_0x31b3da[_0x5e21('0x34')],_0xea5812);}return _0x48d06e[_0x5e21('0x22')]('Contact')[_0x5e21('0x25')](_0x31b3da,_0x4a2089)[_0x5e21('0x2b')](function(_0x365e65){if(_0x365e65&&_0x365e65[_0x5e21('0x26')]){return _0x365e65;}else{var _0x2dd92f=_[_0x5e21('0x31')](_0xf993f7);if(_0xe1a908['additionalSearchLead']){var _0x596b52={};_0x596b52[_0xe1a908['additionalSearchLead']]=_0x24dbeb;_[_0x5e21('0x33')](_0x2dd92f[_0x5e21('0x34')],_0x596b52);}return _0x48d06e['sobject'](_0x5e21('0x38'))[_0x5e21('0x25')](_0x2dd92f,_0x4a2089);}});}});case _0x5e21('0x17'):var _0x2e465=_['cloneDeep'](_0xf993f7);if(_0xe1a908['additionalSearchContact']){var _0x2f83dd={};_0x2f83dd[_0xe1a908[_0x5e21('0x32')]]=_0x24dbeb;_[_0x5e21('0x33')](_0x2e465[_0x5e21('0x34')],_0x2f83dd);}return _0x48d06e[_0x5e21('0x22')](_0x5e21('0x35'))[_0x5e21('0x25')](_0x2e465,_0x4a2089)[_0x5e21('0x36')]();case'lead':var _0x1202b2=_[_0x5e21('0x31')](_0xf993f7);if(_0xe1a908[_0x5e21('0x37')]){var _0x2f83dd={};_0x2f83dd[_0xe1a908[_0x5e21('0x37')]]=_0x24dbeb;_[_0x5e21('0x33')](_0x1202b2[_0x5e21('0x34')],_0x2f83dd);}return _0x48d06e[_0x5e21('0x22')](_0x5e21('0x38'))['find'](_0x1202b2,_0x4a2089);case _0x5e21('0x1a'):var _0x32c528=_[_0x5e21('0x31')](_0xf993f7);if(_0xe1a908[_0x5e21('0x3a')]){var _0x2f83dd={};_0x2f83dd[_0xe1a908['additionalSearchAccount']]=_0x24dbeb;_['merge'](_0x32c528[_0x5e21('0x34')],_0x2f83dd);}return _0x48d06e[_0x5e21('0x22')](_0x5e21('0x3b'))[_0x5e21('0x25')](_0x32c528,_0x4a2089);default:return null;}})[_0x5e21('0x2b')](function(_0x39887d){if(_0x39887d&&_0x39887d['length']){var _0x1674b9=_['first'](_0x39887d);if(_0x1674b9){return BPromise['resolve']({'id':_0x1674b9['Id'],'name':_0x1674b9[_0x5e21('0x28')],'phone':_0x1674b9['Phone'],'endUserType':_0x1674b9[_0x5e21('0x3c')]['type'][_0x5e21('0x3d')]()});}}})[_0x5e21('0x2b')](function(_0x16db49){if(_0x16db49){logger[_0x5e21('0x21')](_0x5e21('0x3e'),_0x16db49['endUserType'],_0x24dbeb);return BPromise[_0x5e21('0x2c')](_0x16db49);}else{logger['info']('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0x24dbeb);var _0x2af1f2={'Phone':_0x24dbeb};if(_0xe1a908[_0x5e21('0x3f')]){if(_0xe1a908['moduleCreate']===_0x5e21('0x17')){logger[_0x5e21('0x21')](_0x5e21('0x40'),_0x24dbeb,_0xe1a908[_0x5e21('0x3f')]);_0x2af1f2[_0x5e21('0x41')]=_0x1ef646!==_0x5e21('0x42')?_0x1ef646:util[_0x5e21('0x43')](_0x5e21('0x44'),_0x24dbeb);}else if(_0xe1a908['moduleCreate']===_0x5e21('0x18')){logger[_0x5e21('0x21')](_0x5e21('0x40'),_0x24dbeb,_0xe1a908['moduleCreate']);_0x2af1f2[_0x5e21('0x41')]=_0x1ef646!==_0x5e21('0x42')?_0x1ef646:util[_0x5e21('0x43')]('Caller\x20-\x20%s',_0x24dbeb);_0x2af1f2[_0x5e21('0x45')]='No\x20Company';}else if(_0xe1a908[_0x5e21('0x3f')]===_0x5e21('0x1a')){logger[_0x5e21('0x21')](_0x5e21('0x40'),_0x24dbeb,_0xe1a908[_0x5e21('0x3f')]);_0x2af1f2[_0x5e21('0x28')]=_0x1ef646!==_0x5e21('0x42')?_0x1ef646:util[_0x5e21('0x43')](_0x5e21('0x44'),_0x24dbeb);}else{return null;}}return _0x48d06e[_0x5e21('0x22')](_[_0x5e21('0x46')](_0xe1a908[_0x5e21('0x3f')]))[_0x5e21('0x23')](_0x2af1f2)[_0x5e21('0x2b')](function(_0x4f53ed){return BPromise[_0x5e21('0x2c')]({'id':_0x4f53ed['id'],'endUserType':_0xe1a908[_0x5e21('0x3f')]});});}});}function getCustomFields(_0x48f76c,_0x46ed9f){var _0x1bbc24={};if(_0x48f76c[_0x5e21('0x26')]>0x0){_['forEach'](_0x48f76c,function(_0x3862c5){if(_[_0x5e21('0x47')]([_0x5e21('0x48'),_0x5e21('0x49')],_0x3862c5[_0x5e21('0x4a')])&&_0x3862c5[_0x5e21('0x4b')]){_0x1bbc24[_0x3862c5['idField']]=_0x3862c5[_0x5e21('0x4c')][_0x5e21('0x4d')]();}else if(_0x3862c5[_0x5e21('0x4a')]===_0x5e21('0x4e')&&_0x3862c5[_0x5e21('0x4f')]&&_0x3862c5[_0x5e21('0x4b')]){_0x46ed9f[_0x3862c5[_0x5e21('0x4f')]]&&(_0x1bbc24[_0x3862c5[_0x5e21('0x4b')]]=_0x46ed9f[_0x3862c5[_0x5e21('0x4f')]]['toString']());}else if(_0x3862c5[_0x5e21('0x4a')]===_0x5e21('0x50')&&_0x3862c5[_0x5e21('0x51')]&&_0x3862c5[_0x5e21('0x51')][_0x5e21('0x52')]&&_0x3862c5['idField']){_0x46ed9f[_0x3862c5['Variable'][_0x5e21('0x52')][_0x5e21('0x3d')]()]&&(_0x1bbc24[_0x3862c5['idField']]=_0x46ed9f[_0x3862c5['Variable'][_0x5e21('0x52')][_0x5e21('0x3d')]()][_0x5e21('0x4d')]());}});}return _0x1bbc24;}function getConnection(_0x27d6cb){var _0x6bc7ac=_0x27d6cb[_0x5e21('0x53')][_0x5e21('0x54')](_0x27d6cb[_0x5e21('0x55')]);var _0x2ad6bb=new jsforce[(_0x5e21('0x56'))]({'oauth2':{'loginUrl':_0x27d6cb[_0x5e21('0x57')]||_0x5e21('0x58'),'clientId':_0x27d6cb[_0x5e21('0x59')],'clientSecret':_0x27d6cb['clientSecret']}});return _0x2ad6bb['login'](_0x27d6cb[_0x5e21('0x5a')],_0x6bc7ac)[_0x5e21('0x2b')](function(){logger[_0x5e21('0x21')]('Connection\x20established.');return _0x2ad6bb;});}exports[_0x5e21('0x5b')]=function(_0x51183b,_0x462412,_0x1a7549,_0x57c5f1,_0x11eb0f,_0x40c6a9){var _0x1dc201,_0x98f6b5,_0x4e8084,_0x2cc5cc;_0x40c6a9[_0x5e21('0x5c')]=intUtil[_0x5e21('0x5d')](_0x40c6a9[_0x5e21('0x5c')]);_0x40c6a9[_0x5e21('0x57')]=intUtil[_0x5e21('0x5d')](_0x40c6a9[_0x5e21('0x57')]);if(_0x11eb0f&&_0x11eb0f[_0x5e21('0x5e')]){logger['info'](_0x5e21('0x5f'),_0x5e21('0x60'));_0x462412[_0x5e21('0x61')]=util[_0x5e21('0x43')](_0x5e21('0x62'),_0x40c6a9['serverUrl'],_0x462412[_0x5e21('0x63')],md5(_0x462412[_0x5e21('0x63')]));}else{_0x462412[_0x5e21('0x61')]='';}return getConnection(_0x40c6a9)[_0x5e21('0x2b')](function(_0x9c7b39){_0x2cc5cc=_0x9c7b39;return getUser(_0x40c6a9,_0x57c5f1[_0x5e21('0x64')],_0x2cc5cc);})[_0x5e21('0x2b')](function(_0xbe3126){_0x1dc201=_0xbe3126;return getEndUser(_0x40c6a9,_0x1a7549,_0x462412[_0x5e21('0x65')],_0x462412[_0x5e21('0x66')],_0x2cc5cc);})[_0x5e21('0x2b')](function(_0x3eb74d){_0x98f6b5=_0x3eb74d;return getTicket(_0x40c6a9,_0x1dc201,_0x98f6b5,_0x1a7549,_0x462412,_0x1a7549[_0x5e21('0x67')],_0x2cc5cc,_0x5e21('0x5b'));})[_0x5e21('0x2b')](function(_0x2ad355){_0x4e8084=_0x2ad355;logger[_0x5e21('0x21')](_0x5e21('0x68'),_0x4e8084['id']);logger[_0x5e21('0x21')](_0x5e21('0x69'),_0x4e8084['id'],_0x57c5f1['name'],_0x40c6a9[_0x5e21('0x4a')]);switch(_0x40c6a9[_0x5e21('0x4a')]){case _0x5e21('0x6a'):emit(util[_0x5e21('0x43')](_0x5e21('0x6b'),_0x57c5f1[_0x5e21('0x52')]),'trigger:salesforce:display',{'recordId':_0x4e8084['id']});break;case _0x5e21('0x6c'):emit(util[_0x5e21('0x43')](_0x5e21('0x6b'),_0x57c5f1[_0x5e21('0x52')]),_0x5e21('0x6d'),{'uri':util[_0x5e21('0x43')](_0x5e21('0x6e'),_0x2cc5cc[_0x5e21('0x6f')],_0x4e8084['id'])});break;default:logger[_0x5e21('0x70')](_0x5e21('0x71'));}})['catch'](function(_0x5a4546){logger[_0x5e21('0x70')]('[QUEUE]',_0x5a4546);});};exports[_0x5e21('0x72')]=function(_0x4e88c3,_0x576507,_0xc7b0a8,_0x291214,_0x4d90c9,_0x2315e6,_0x109ff0){var _0x7d3abf,_0x170f1c,_0x11d800,_0x91284b;_0x2315e6[_0x5e21('0x5c')]=intUtil[_0x5e21('0x5d')](_0x2315e6['serverUrl']);_0x2315e6[_0x5e21('0x57')]=intUtil[_0x5e21('0x5d')](_0x2315e6['remoteUri']);if(_0x109ff0&&_0x109ff0['recordingFormat']&&_0x109ff0[_0x5e21('0x73')]!==_0x5e21('0x74')){logger[_0x5e21('0x21')](_0x5e21('0x75'),_0x5e21('0x60'));_0x576507[_0x5e21('0x61')]=util['format'](_0x5e21('0x62'),_0x2315e6[_0x5e21('0x5c')],_0x576507['uniqueid'],md5(_0x576507[_0x5e21('0x63')]));}return getConnection(_0x2315e6)[_0x5e21('0x2b')](function(_0x4630d9){_0x91284b=_0x4630d9;return getUser(_0x2315e6,_0x291214[_0x5e21('0x64')],_0x91284b);})[_0x5e21('0x2b')](function(_0x552b6d){_0x7d3abf=_0x552b6d;return getEndUser(_0x2315e6,_0xc7b0a8,_0x576507['destcalleridname'],_0x576507[_0x5e21('0x76')],_0x91284b);})[_0x5e21('0x2b')](function(_0x56b16f){_0x170f1c=_0x56b16f;return getTicket(_0x2315e6,_0x7d3abf,_0x170f1c,_0xc7b0a8,_0x576507,_0xc7b0a8[_0x5e21('0x67')],_0x91284b,_0x5e21('0x72'));})['then'](function(_0x5e0799){_0x11d800=_0x5e0799;logger[_0x5e21('0x21')](_0x5e21('0x77'),_0x11d800['id']);logger[_0x5e21('0x21')](_0x5e21('0x78'),_0x11d800['id'],_0x291214[_0x5e21('0x52')],_0x2315e6[_0x5e21('0x4a')]);switch(_0x2315e6['type']){case _0x5e21('0x6a'):emit(util[_0x5e21('0x43')](_0x5e21('0x6b'),_0x291214[_0x5e21('0x52')]),'trigger:salesforce:display',{'recordId':_0x11d800['id']});break;case'newTab':emit(util[_0x5e21('0x43')]('user:%s',_0x291214['name']),'trigger:browser:url',{'uri':util[_0x5e21('0x43')]('%s/%s/e',_0x91284b[_0x5e21('0x6f')],_0x11d800['id'])});break;default:logger[_0x5e21('0x70')](_0x5e21('0x75'),_0x5e21('0x79'));}})[_0x5e21('0x7a')](function(_0x15c306){logger[_0x5e21('0x70')](_0x5e21('0x75'),_0x15c306);});};exports[_0x5e21('0x7b')]=function(_0xdd950e,_0x4b688f,_0x2e8f13,_0x4e9e33,_0x5c9a7e,_0x3406b2){var _0x43b5f9,_0x174b00,_0x126616,_0x4a95ad;_0x3406b2[_0x5e21('0x5c')]=intUtil[_0x5e21('0x5d')](_0x3406b2[_0x5e21('0x5c')]);_0x3406b2['remoteUri']=intUtil[_0x5e21('0x5d')](_0x3406b2[_0x5e21('0x57')]);if(_0x5c9a7e&&_0x5c9a7e['monitor_format']){logger['info']('['+_0x4b688f['lastevent'][_0x5e21('0x7c')]()+']',_0x5e21('0x60'));_0x4b688f[_0x5e21('0x61')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3406b2[_0x5e21('0x5c')],_0x4b688f[_0x5e21('0x63')],md5(_0x4b688f[_0x5e21('0x63')]));}else{_0x4b688f[_0x5e21('0x61')]='';}return getConnection(_0x3406b2)[_0x5e21('0x2b')](function(_0x1bf5ab){_0x4a95ad=_0x1bf5ab;if(!_[_0x5e21('0x24')](_0x4e9e33)){return getUser(_0x3406b2,_0x4e9e33[_0x5e21('0x52')],_0x4a95ad);}else{return getUser(_0x3406b2,null,_0x4a95ad);}})[_0x5e21('0x2b')](function(_0x2defaf){_0x43b5f9=_0x2defaf;return getEndUser(_0x3406b2,_0x2e8f13,_0x4b688f[_0x5e21('0x65')],_0x4b688f[_0x5e21('0x66')],_0x4a95ad);})[_0x5e21('0x2b')](function(_0x51dd10){_0x174b00=_0x51dd10;return getTicket(_0x3406b2,_0x43b5f9,_0x174b00,_0x2e8f13,_0x4b688f,_0x2e8f13[_0x5e21('0x67')],_0x4a95ad);})[_0x5e21('0x2b')](function(_0x5d2735){_0x126616=_0x5d2735;logger['info']('['+_0x4b688f['lastevent']['toUpperCase']()+_0x5e21('0x7d'),_0x126616['id']);logger[_0x5e21('0x21')]('['+_0x4b688f[_0x5e21('0x7e')][_0x5e21('0x7c')]()+_0x5e21('0x7f'),_0x3406b2[_0x5e21('0x4a')]);})[_0x5e21('0x7a')](function(_0x366aa0){logger[_0x5e21('0x70')]('['+_0x4b688f['lastevent'][_0x5e21('0x7c')]()+']',_0x366aa0);});}; \ No newline at end of file +var _0xf3a8=['clientSecret','username','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','uniqueid','recordingURL','email','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:browser:url','%s/%s/e','catch','error','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:salesforce:display','newTab','instanceUrl','Salesforce\x20account\x20type\x20not\x20recognized','lastevent','toUpperCase','calleridname','calleridnum',']\x20Ticket\x20%s\x20created.','lodash','moment','bluebird','md5','jsforce','util','ioredis','./util','../../../../config/environment','salesforce','redis','defaults','localhost','emit','assign','getString','Descriptions','ticketType','Task','ActivityDate','utc','IsRecurrence','endUserType','lead','account','WhatId','Case','contact','ContactId','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','isNil','validateEmail','User','find','execute','Email','Agent\x20%s\x20found.','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','then','resolve','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','additionalSearchContact','$or','Contact','cloneDeep','additionalSearchLead','merge','Lead','account_contact_lead','additionalSearchAccount','length','Account','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','upperFirst','forEach','string','picklist','idField','variable','variableName','toString','Variable','name','password','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId'];(function(_0x298692,_0x15513a){var _0x43b909=function(_0x52890a){while(--_0x52890a){_0x298692['push'](_0x298692['shift']());}};_0x43b909(++_0x15513a);}(_0xf3a8,0x1a2));var _0x8f3a=function(_0x367e8c,_0x42dc3e){_0x367e8c=_0x367e8c-0x0;var _0x40e53f=_0xf3a8[_0x367e8c];return _0x40e53f;};'use strict';var _=require(_0x8f3a('0x0'));var rp=require('request-promise');var moment=require(_0x8f3a('0x1'));var BPromise=require(_0x8f3a('0x2'));var md5=require(_0x8f3a('0x3'));var jsforce=require(_0x8f3a('0x4'));var util=require(_0x8f3a('0x5'));var Redis=require(_0x8f3a('0x6'));var intUtil=require(_0x8f3a('0x7'));var config=require(_0x8f3a('0x8'));var logger=require('../../../../config/logger')(_0x8f3a('0x9'));config[_0x8f3a('0xa')]=_[_0x8f3a('0xb')](config[_0x8f3a('0xa')],{'host':_0x8f3a('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x8f3a('0xa')]));function emit(_0x1fdfe3,_0x39c8f0,_0xe17012){io['to'](_0x1fdfe3)[_0x8f3a('0xd')](_0x39c8f0,_0xe17012);}function getTicket(_0x274f20,_0x9cce13,_0xb44a1b,_0x39b91c,_0x12d30e,_0xf7902,_0x4b22a6,_0x1758fd){var _0x3b3f06=Object[_0x8f3a('0xe')]({},{'OwnerId':_0x9cce13['id'],'Subject':intUtil[_0x8f3a('0xf')](_0x39b91c['Subjects'],_0x12d30e,'\x20'),'Description':intUtil[_0x8f3a('0xf')](_0x39b91c[_0x8f3a('0x10')],_0x12d30e,'\x0a')},getCustomFields(_0xf7902,_0x12d30e));if(_0xb44a1b){if(_0x39b91c[_0x8f3a('0x11')]===_0x8f3a('0x12')){_0x3b3f06[_0x8f3a('0x13')]=moment[_0x8f3a('0x14')]();_0x3b3f06['IsReminderSet']=![];_0x3b3f06[_0x8f3a('0x15')]=![];if(_0xb44a1b[_0x8f3a('0x16')]==='contact'||_0xb44a1b['endUserType']===_0x8f3a('0x17')){_0x3b3f06['WhoId']=_0xb44a1b['id'];}else if(_0xb44a1b[_0x8f3a('0x16')]===_0x8f3a('0x18')){_0x3b3f06[_0x8f3a('0x19')]=_0xb44a1b['id'];}}else if(_0x39b91c[_0x8f3a('0x11')]===_0x8f3a('0x1a')){if(_0xb44a1b[_0x8f3a('0x16')]===_0x8f3a('0x1b')){_0x3b3f06[_0x8f3a('0x1c')]=_0xb44a1b['id'];}else if(_0xb44a1b['endUserType']===_0x8f3a('0x18')){_0x3b3f06[_0x8f3a('0x1d')]=_0xb44a1b['id'];}else if(_0xb44a1b['endUserType']===_0x8f3a('0x17')&&_0x39b91c[_0x8f3a('0x1e')]){_0x3b3f06[_0x39b91c[_0x8f3a('0x1e')]]=_0xb44a1b['id'];}else{logger[_0x8f3a('0x1f')](_0x8f3a('0x20'));}}}return _0x4b22a6[_0x8f3a('0x21')](_0x39b91c['ticketType'])['create'](_0x3b3f06);}function getUser(_0x1996df,_0x1d7e3a,_0x52b695){if(!_[_0x8f3a('0x22')](_0x1d7e3a)&&intUtil[_0x8f3a('0x23')](_0x1d7e3a)){var _0x52c8ca={'Email':_0x1d7e3a};var _0x252be8={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x52b695['sobject'](_0x8f3a('0x24'))[_0x8f3a('0x25')](_0x52c8ca,_0x252be8)[_0x8f3a('0x26')]()['then'](function(_0xe42979){if(_0xe42979['length']){var _0x15e9dc=_['find'](_0xe42979,function(_0x4f1361){return _0x4f1361[_0x8f3a('0x27')]===_0x1d7e3a;});if(_0x15e9dc){logger[_0x8f3a('0x1f')](_0x8f3a('0x28'),_0x1d7e3a);return BPromise['resolve']({'id':_0x15e9dc['Id'],'name':_0x15e9dc[_0x8f3a('0x29')]});}}else{logger[_0x8f3a('0x1f')](_0x8f3a('0x2a'),_0x1d7e3a);return _0x52b695[_0x8f3a('0x2b')]()[_0x8f3a('0x2c')](function(_0xcbb738){return BPromise[_0x8f3a('0x2d')]({'id':_0xcbb738[_0x8f3a('0x2e')],'name':_0xcbb738['display_name']});});}});}else{logger[_0x8f3a('0x1f')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x1d7e3a);return _0x52b695[_0x8f3a('0x2b')]()[_0x8f3a('0x2c')](function(_0x43c1fb){return BPromise['resolve']({'id':_0x43c1fb[_0x8f3a('0x2e')],'name':_0x43c1fb[_0x8f3a('0x2f')]});});}}function getEndUser(_0x4edc34,_0x1d31e8,_0x115e34,_0x556150,_0x5accb4){var _0x437ee6={'$or':{'Phone':_0x556150}};var _0x6dcc31={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x8f3a('0x2d')]()['then'](function(){logger[_0x8f3a('0x1f')](_0x8f3a('0x30'),_0x556150,_0x1d31e8[_0x8f3a('0x31')]);switch(_0x1d31e8[_0x8f3a('0x31')]){case _0x8f3a('0x32'):var _0x51d55f=_['cloneDeep'](_0x437ee6);if(_0x1d31e8['additionalSearchContact']){var _0x67245d={};_0x67245d[_0x1d31e8[_0x8f3a('0x33')]]=_0x556150;_['merge'](_0x51d55f[_0x8f3a('0x34')],_0x67245d);}return _0x5accb4[_0x8f3a('0x21')](_0x8f3a('0x35'))[_0x8f3a('0x25')](_0x51d55f,_0x6dcc31)[_0x8f3a('0x26')]()['then'](function(_0x3cf421){if(_0x3cf421&&_0x3cf421['length']){return _0x3cf421;}else{var _0x4e2bf2=_[_0x8f3a('0x36')](_0x437ee6);if(_0x1d31e8[_0x8f3a('0x37')]){var _0x13fb27={};_0x13fb27[_0x1d31e8['additionalSearchLead']]=_0x556150;_[_0x8f3a('0x38')](_0x4e2bf2[_0x8f3a('0x34')],_0x13fb27);}return _0x5accb4[_0x8f3a('0x21')](_0x8f3a('0x39'))['find'](_0x4e2bf2,_0x6dcc31);}});case _0x8f3a('0x3a'):var _0x525fb7=_[_0x8f3a('0x36')](_0x437ee6);if(_0x1d31e8[_0x8f3a('0x3b')]){var _0x67245d={};_0x67245d[_0x1d31e8['additionalSearchAccount']]=_0x556150;_[_0x8f3a('0x38')](_0x525fb7[_0x8f3a('0x34')],_0x67245d);}return _0x5accb4['sobject']('Account')[_0x8f3a('0x25')](_0x525fb7,_0x6dcc31)[_0x8f3a('0x26')]()[_0x8f3a('0x2c')](function(_0x449960){if(_0x449960&&_0x449960['length']){return _0x449960;}else{var _0x1a5ca9=_[_0x8f3a('0x36')](_0x437ee6);if(_0x1d31e8[_0x8f3a('0x33')]){var _0xcb1e2b={};_0xcb1e2b[_0x1d31e8[_0x8f3a('0x33')]]=_0x556150;_['merge'](_0x1a5ca9[_0x8f3a('0x34')],_0xcb1e2b);}return _0x5accb4['sobject'](_0x8f3a('0x35'))[_0x8f3a('0x25')](_0x1a5ca9,_0x6dcc31)['then'](function(_0x393524){if(_0x393524&&_0x393524[_0x8f3a('0x3c')]){return _0x393524;}else{var _0x5f4cf9=_['cloneDeep'](_0x437ee6);if(_0x1d31e8[_0x8f3a('0x37')]){var _0xf99494={};_0xf99494[_0x1d31e8['additionalSearchLead']]=_0x556150;_[_0x8f3a('0x38')](_0x5f4cf9['$or'],_0xf99494);}return _0x5accb4[_0x8f3a('0x21')](_0x8f3a('0x39'))[_0x8f3a('0x25')](_0x5f4cf9,_0x6dcc31);}});}});case _0x8f3a('0x1b'):var _0x51d55f=_[_0x8f3a('0x36')](_0x437ee6);if(_0x1d31e8[_0x8f3a('0x33')]){var _0x67245d={};_0x67245d[_0x1d31e8[_0x8f3a('0x33')]]=_0x556150;_[_0x8f3a('0x38')](_0x51d55f[_0x8f3a('0x34')],_0x67245d);}return _0x5accb4[_0x8f3a('0x21')](_0x8f3a('0x35'))[_0x8f3a('0x25')](_0x51d55f,_0x6dcc31)['execute']();case _0x8f3a('0x17'):var _0x268b23=_[_0x8f3a('0x36')](_0x437ee6);if(_0x1d31e8['additionalSearchLead']){var _0x67245d={};_0x67245d[_0x1d31e8[_0x8f3a('0x37')]]=_0x556150;_[_0x8f3a('0x38')](_0x268b23[_0x8f3a('0x34')],_0x67245d);}return _0x5accb4[_0x8f3a('0x21')](_0x8f3a('0x39'))[_0x8f3a('0x25')](_0x268b23,_0x6dcc31);case'account':var _0x525fb7=_[_0x8f3a('0x36')](_0x437ee6);if(_0x1d31e8[_0x8f3a('0x3b')]){var _0x67245d={};_0x67245d[_0x1d31e8[_0x8f3a('0x3b')]]=_0x556150;_[_0x8f3a('0x38')](_0x525fb7[_0x8f3a('0x34')],_0x67245d);}return _0x5accb4[_0x8f3a('0x21')](_0x8f3a('0x3d'))[_0x8f3a('0x25')](_0x525fb7,_0x6dcc31);default:return null;}})[_0x8f3a('0x2c')](function(_0x52beb5){if(_0x52beb5&&_0x52beb5[_0x8f3a('0x3c')]){var _0x1e8a06=_['first'](_0x52beb5);if(_0x1e8a06){return BPromise[_0x8f3a('0x2d')]({'id':_0x1e8a06['Id'],'name':_0x1e8a06[_0x8f3a('0x29')],'phone':_0x1e8a06['Phone'],'endUserType':_0x1e8a06[_0x8f3a('0x3e')][_0x8f3a('0x3f')][_0x8f3a('0x40')]()});}}})[_0x8f3a('0x2c')](function(_0x466276){if(_0x466276){logger[_0x8f3a('0x1f')](_0x8f3a('0x41'),_0x466276[_0x8f3a('0x16')],_0x556150);return BPromise[_0x8f3a('0x2d')](_0x466276);}else{logger['info'](_0x8f3a('0x42'),_0x556150);var _0x22793f={'Phone':_0x556150};if(_0x1d31e8[_0x8f3a('0x43')]){if(_0x1d31e8[_0x8f3a('0x43')]===_0x8f3a('0x1b')){logger['info'](_0x8f3a('0x44'),_0x556150,_0x1d31e8[_0x8f3a('0x43')]);_0x22793f[_0x8f3a('0x45')]=_0x115e34!==_0x8f3a('0x46')?_0x115e34:util[_0x8f3a('0x47')](_0x8f3a('0x48'),_0x556150);}else if(_0x1d31e8[_0x8f3a('0x43')]===_0x8f3a('0x17')){logger[_0x8f3a('0x1f')](_0x8f3a('0x44'),_0x556150,_0x1d31e8[_0x8f3a('0x43')]);_0x22793f[_0x8f3a('0x45')]=_0x115e34!==_0x8f3a('0x46')?_0x115e34:util['format'](_0x8f3a('0x48'),_0x556150);_0x22793f['Company']='No\x20Company';}else if(_0x1d31e8[_0x8f3a('0x43')]===_0x8f3a('0x18')){logger[_0x8f3a('0x1f')](_0x8f3a('0x44'),_0x556150,_0x1d31e8['moduleCreate']);_0x22793f[_0x8f3a('0x29')]=_0x115e34!==''?_0x115e34:util[_0x8f3a('0x47')](_0x8f3a('0x48'),_0x556150);}else{return null;}}return _0x5accb4[_0x8f3a('0x21')](_[_0x8f3a('0x49')](_0x1d31e8['moduleCreate']))['create'](_0x22793f)[_0x8f3a('0x2c')](function(_0x34ae5f){return BPromise[_0x8f3a('0x2d')]({'id':_0x34ae5f['id'],'endUserType':_0x1d31e8['moduleCreate']});});}});}function getCustomFields(_0x5bcae8,_0x57710d){var _0x3b88e4={};if(_0x5bcae8[_0x8f3a('0x3c')]>0x0){_[_0x8f3a('0x4a')](_0x5bcae8,function(_0x219756){if(_['includes']([_0x8f3a('0x4b'),_0x8f3a('0x4c')],_0x219756['type'])&&_0x219756[_0x8f3a('0x4d')]){_0x3b88e4[_0x219756[_0x8f3a('0x4d')]]=_0x219756['content']['toString']();}else if(_0x219756[_0x8f3a('0x3f')]===_0x8f3a('0x4e')&&_0x219756[_0x8f3a('0x4f')]&&_0x219756[_0x8f3a('0x4d')]){_0x57710d[_0x219756[_0x8f3a('0x4f')]]&&(_0x3b88e4[_0x219756['idField']]=_0x57710d[_0x219756[_0x8f3a('0x4f')]][_0x8f3a('0x50')]());}else if(_0x219756[_0x8f3a('0x3f')]==='customVariable'&&_0x219756[_0x8f3a('0x51')]&&_0x219756[_0x8f3a('0x51')]['name']&&_0x219756[_0x8f3a('0x4d')]){_0x57710d[_0x219756[_0x8f3a('0x51')][_0x8f3a('0x52')][_0x8f3a('0x40')]()]&&(_0x3b88e4[_0x219756[_0x8f3a('0x4d')]]=_0x57710d[_0x219756[_0x8f3a('0x51')]['name'][_0x8f3a('0x40')]()][_0x8f3a('0x50')]());}});}return _0x3b88e4;}function getConnection(_0x41f3df){var _0x536094=_0x41f3df[_0x8f3a('0x53')][_0x8f3a('0x54')](_0x41f3df[_0x8f3a('0x55')]);var _0x5904ce=new jsforce[(_0x8f3a('0x56'))]({'oauth2':{'loginUrl':_0x41f3df[_0x8f3a('0x57')]||_0x8f3a('0x58'),'clientId':_0x41f3df[_0x8f3a('0x59')],'clientSecret':_0x41f3df[_0x8f3a('0x5a')]}});return _0x5904ce['login'](_0x41f3df[_0x8f3a('0x5b')],_0x536094)[_0x8f3a('0x2c')](function(){logger[_0x8f3a('0x1f')]('Connection\x20established.');return _0x5904ce;});}exports[_0x8f3a('0x5c')]=function(_0xdb4b00,_0xb0dc24,_0x12fd79,_0x226ba9,_0x361d63,_0x436a2a){var _0x4f7776,_0x1e5597,_0x42cb35,_0xe1ceb4;_0x436a2a[_0x8f3a('0x5d')]=intUtil[_0x8f3a('0x5e')](_0x436a2a[_0x8f3a('0x5d')]);_0x436a2a[_0x8f3a('0x57')]=intUtil[_0x8f3a('0x5e')](_0x436a2a[_0x8f3a('0x57')]);if(_0x361d63&&_0x361d63[_0x8f3a('0x5f')]){logger[_0x8f3a('0x1f')](_0x8f3a('0x60'),'Recording\x20is\x20enabled!');_0xb0dc24['recordingURL']=util[_0x8f3a('0x47')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x436a2a[_0x8f3a('0x5d')],_0xb0dc24[_0x8f3a('0x61')],md5(_0xb0dc24['uniqueid']));}else{_0xb0dc24[_0x8f3a('0x62')]='';}return getConnection(_0x436a2a)[_0x8f3a('0x2c')](function(_0x25fbf4){_0xe1ceb4=_0x25fbf4;return getUser(_0x436a2a,_0x226ba9[_0x8f3a('0x63')],_0xe1ceb4);})[_0x8f3a('0x2c')](function(_0x43dcb1){_0x4f7776=_0x43dcb1;return getEndUser(_0x436a2a,_0x12fd79,_0xb0dc24['calleridname'],_0xb0dc24['calleridnum'],_0xe1ceb4);})[_0x8f3a('0x2c')](function(_0x12e955){_0x1e5597=_0x12e955;return getTicket(_0x436a2a,_0x4f7776,_0x1e5597,_0x12fd79,_0xb0dc24,_0x12fd79[_0x8f3a('0x64')],_0xe1ceb4,_0x8f3a('0x5c'));})['then'](function(_0x4f65f5){_0x42cb35=_0x4f65f5;logger[_0x8f3a('0x1f')](_0x8f3a('0x65'),_0x42cb35['id']);logger[_0x8f3a('0x1f')](_0x8f3a('0x66'),_0x42cb35['id'],_0x226ba9[_0x8f3a('0x52')],_0x436a2a['type']);switch(_0x436a2a[_0x8f3a('0x3f')]){case _0x8f3a('0x67'):emit(util[_0x8f3a('0x47')](_0x8f3a('0x68'),_0x226ba9['name']),'trigger:salesforce:display',{'recordId':_0x42cb35['id']});break;case'newTab':emit(util[_0x8f3a('0x47')]('user:%s',_0x226ba9[_0x8f3a('0x52')]),_0x8f3a('0x69'),{'uri':util[_0x8f3a('0x47')](_0x8f3a('0x6a'),_0xe1ceb4['instanceUrl'],_0x42cb35['id'])});break;default:logger['error']('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0x8f3a('0x6b')](function(_0x4988a2){logger[_0x8f3a('0x6c')](_0x8f3a('0x60'),_0x4988a2);});};exports[_0x8f3a('0x6d')]=function(_0x4cb3d9,_0x22e247,_0x4edb62,_0x403149,_0x45a390,_0x2b6cf0,_0x559c15){var _0x4994d2,_0x23976e,_0x36fb56,_0x25d658;_0x2b6cf0['serverUrl']=intUtil[_0x8f3a('0x5e')](_0x2b6cf0[_0x8f3a('0x5d')]);_0x2b6cf0[_0x8f3a('0x57')]=intUtil[_0x8f3a('0x5e')](_0x2b6cf0[_0x8f3a('0x57')]);if(_0x559c15&&_0x559c15[_0x8f3a('0x6e')]&&_0x559c15['recordingFormat']!==_0x8f3a('0x6f')){logger['info'](_0x8f3a('0x70'),_0x8f3a('0x71'));_0x22e247[_0x8f3a('0x62')]=util[_0x8f3a('0x47')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2b6cf0[_0x8f3a('0x5d')],_0x22e247['uniqueid'],md5(_0x22e247[_0x8f3a('0x61')]));}return getConnection(_0x2b6cf0)[_0x8f3a('0x2c')](function(_0x4b6286){_0x25d658=_0x4b6286;return getUser(_0x2b6cf0,_0x403149[_0x8f3a('0x63')],_0x25d658);})[_0x8f3a('0x2c')](function(_0x433f9a){_0x4994d2=_0x433f9a;return getEndUser(_0x2b6cf0,_0x4edb62,_0x22e247[_0x8f3a('0x72')],_0x22e247[_0x8f3a('0x73')],_0x25d658);})[_0x8f3a('0x2c')](function(_0x26c2a0){_0x23976e=_0x26c2a0;return getTicket(_0x2b6cf0,_0x4994d2,_0x23976e,_0x4edb62,_0x22e247,_0x4edb62[_0x8f3a('0x64')],_0x25d658,_0x8f3a('0x6d'));})[_0x8f3a('0x2c')](function(_0x5b3e16){_0x36fb56=_0x5b3e16;logger[_0x8f3a('0x1f')](_0x8f3a('0x74'),_0x36fb56['id']);logger[_0x8f3a('0x1f')](_0x8f3a('0x75'),_0x36fb56['id'],_0x403149[_0x8f3a('0x52')],_0x2b6cf0[_0x8f3a('0x3f')]);switch(_0x2b6cf0[_0x8f3a('0x3f')]){case _0x8f3a('0x67'):emit(util[_0x8f3a('0x47')](_0x8f3a('0x68'),_0x403149[_0x8f3a('0x52')]),_0x8f3a('0x76'),{'recordId':_0x36fb56['id']});break;case _0x8f3a('0x77'):emit(util['format'](_0x8f3a('0x68'),_0x403149[_0x8f3a('0x52')]),_0x8f3a('0x69'),{'uri':util[_0x8f3a('0x47')](_0x8f3a('0x6a'),_0x25d658[_0x8f3a('0x78')],_0x36fb56['id'])});break;default:logger[_0x8f3a('0x6c')](_0x8f3a('0x70'),_0x8f3a('0x79'));}})[_0x8f3a('0x6b')](function(_0x3e47d3){logger[_0x8f3a('0x6c')](_0x8f3a('0x70'),_0x3e47d3);});};exports['unmanaged']=function(_0x5502de,_0x16fbff,_0x13c9bd,_0x3d6873,_0xbce15a,_0x4a8c90){var _0x5b3865,_0x2e81df,_0x527365,_0x149f6f;_0x4a8c90['serverUrl']=intUtil[_0x8f3a('0x5e')](_0x4a8c90[_0x8f3a('0x5d')]);_0x4a8c90[_0x8f3a('0x57')]=intUtil['stripTrailingSlash'](_0x4a8c90['remoteUri']);if(_0xbce15a&&_0xbce15a[_0x8f3a('0x5f')]){logger['info']('['+_0x16fbff[_0x8f3a('0x7a')][_0x8f3a('0x7b')]()+']',_0x8f3a('0x71'));_0x16fbff['recordingURL']=util[_0x8f3a('0x47')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4a8c90[_0x8f3a('0x5d')],_0x16fbff[_0x8f3a('0x61')],md5(_0x16fbff[_0x8f3a('0x61')]));}else{_0x16fbff[_0x8f3a('0x62')]='';}return getConnection(_0x4a8c90)[_0x8f3a('0x2c')](function(_0x34de26){_0x149f6f=_0x34de26;if(!_['isNil'](_0x3d6873)){return getUser(_0x4a8c90,_0x3d6873[_0x8f3a('0x52')],_0x149f6f);}else{return getUser(_0x4a8c90,null,_0x149f6f);}})[_0x8f3a('0x2c')](function(_0x47c056){_0x5b3865=_0x47c056;return getEndUser(_0x4a8c90,_0x13c9bd,_0x16fbff[_0x8f3a('0x7c')],_0x16fbff[_0x8f3a('0x7d')],_0x149f6f);})[_0x8f3a('0x2c')](function(_0x17c1cc){_0x2e81df=_0x17c1cc;return getTicket(_0x4a8c90,_0x5b3865,_0x2e81df,_0x13c9bd,_0x16fbff,_0x13c9bd['Fields'],_0x149f6f);})[_0x8f3a('0x2c')](function(_0x340868){_0x527365=_0x340868;logger[_0x8f3a('0x1f')]('['+_0x16fbff[_0x8f3a('0x7a')][_0x8f3a('0x7b')]()+_0x8f3a('0x7e'),_0x527365['id']);logger['info']('['+_0x16fbff[_0x8f3a('0x7a')]['toUpperCase']()+']\x20Integration\x20account\x20type\x20%s.',_0x4a8c90[_0x8f3a('0x3f')]);})[_0x8f3a('0x6b')](function(_0x418cef){logger[_0x8f3a('0x6c')]('['+_0x16fbff[_0x8f3a('0x7a')][_0x8f3a('0x7b')]()+']',_0x418cef);});}; \ 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 d6c7386..f59bc76 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 _0xadb3=['request-promise','ioredis','./util','redis','defaults','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','toUpperCase','catch','message','info','],\x20getUser\x20input\x20crm','validateEmail','sys_user?sysparm_query=email%3D','userEmail','],\x20getUser\x20rp\x20obj','active','true','userId','sys_id','],\x20getUser\x20crm','error',']\x20using\x20admin\x20profile','adminEmail','sys_user?','endUserNumber','user','System','],\x20EndUser\x20schema','],\x20getEndUser\x20input\x20crm','endUserId','includes','string','picklist','type','nameField','toLowerCase','content','toString','idField','customField','variable','variableName','customVariable','Variable','name','outbound','POST','assign','getString','Subjects','Descriptions','Fields','ticketNumber','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','incident','Incident','ticketId','forEach','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','username','password','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','isNil','email','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','[OUTBOUND]','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s',']\x20Error\x20running\x20ServiceNow\x20integration','lodash','bluebird'];(function(_0x559233,_0x4f4408){var _0x1a9acb=function(_0x4d9c52){while(--_0x4d9c52){_0x559233['push'](_0x559233['shift']());}};_0x1a9acb(++_0x4f4408);}(_0xadb3,0x1aa));var _0x3adb=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xadb3[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x3adb('0x0'));var Promise=require(_0x3adb('0x1'));var rp=require(_0x3adb('0x2'));var util=require('util');var md5=require('md5');var Redis=require(_0x3adb('0x3'));var intUtil=require(_0x3adb('0x4'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')('servicenow');config[_0x3adb('0x5')]=_[_0x3adb('0x6')](config[_0x3adb('0x5')],{'host':_0x3adb('0x7'),'port':0x18eb});var io=require(_0x3adb('0x8'))(new Redis(config['redis']));function getAdminUser(_0x4e5541,_0x1582ef,_0x3f0f25,_0x565706,_0x225255,_0x51ea88){return new Promise(function(_0x36eca2,_0xcb8dac){var _0x480940={'method':_0x3adb('0x9'),'uri':_0x565706+_0x3adb('0xa')+'&'+_0x225255+'&'+_0x51ea88,'auth':_0x1582ef,'json':!![]};return rp(_0x480940)[_0x3adb('0xb')](function(_0x19de7b){if(_0x19de7b[_0x3adb('0xc')][_0x3adb('0xd')]>0x0){_0x3f0f25[_0x3adb('0xe')]=_0x19de7b[_0x3adb('0xc')][0x0]['sys_id'];}logger['info']('['+[_0x4e5541[_0x3adb('0xf')]()]+'],\x20getAdminUser\x20crm',_0x3f0f25);_0x36eca2(_0x3f0f25);})[_0x3adb('0x10')](function(_0x4f077d){logger['error']('['+[_0x4e5541[_0x3adb('0xf')]()]+']',_0x4f077d[_0x3adb('0x11')]);_0xcb8dac(_0x4f077d['message']);});});}function getUser(_0x4caeea,_0x2217c1,_0x5a2c2f,_0x1f19a6,_0x2737a8){return function(_0x228699){logger[_0x3adb('0x12')]('['+[_0x4caeea[_0x3adb('0xf')]()]+_0x3adb('0x13'),_0x228699);return new Promise(function(_0x5129c7,_0x938dea){if(intUtil[_0x3adb('0x14')](_0x228699['userEmail'])){var _0x4ab1a4={'method':_0x3adb('0x9'),'uri':_0x5a2c2f+_0x3adb('0x15')+_0x228699[_0x3adb('0x16')]+'&'+_0x1f19a6+'&'+_0x2737a8,'auth':_0x2217c1,'json':!![]};logger[_0x3adb('0x12')]('['+[_0x4caeea['toUpperCase']()]+_0x3adb('0x17'),_0x4ab1a4);return rp(_0x4ab1a4)[_0x3adb('0xb')](function(_0x17d924){logger['info']('['+[_0x4caeea['toUpperCase']()]+'],\x20getUser\x20entity',_0x17d924);if(_0x17d924[_0x3adb('0xc')]['length']>0x0&&String(_0x17d924[_0x3adb('0xc')][0x0][_0x3adb('0x18')])===_0x3adb('0x19')){_0x228699[_0x3adb('0x1a')]=_0x17d924['result'][0x0][_0x3adb('0x1b')];}else{_0x228699[_0x3adb('0x1a')]=_0x228699[_0x3adb('0xe')];_0x228699[_0x3adb('0x16')]=_0x228699['adminEmail'];}logger[_0x3adb('0x12')]('['+[_0x4caeea[_0x3adb('0xf')]()]+_0x3adb('0x1c'),_0x228699);_0x5129c7(_0x228699);})[_0x3adb('0x10')](function(_0x34db64){logger[_0x3adb('0x1d')]('['+[_0x4caeea['toUpperCase']()]+']',_0x34db64[_0x3adb('0x11')]);_0x938dea(_0x34db64[_0x3adb('0x11')]);});}else{logger[_0x3adb('0x12')]('['+[_0x4caeea[_0x3adb('0xf')]()]+_0x3adb('0x1e'));_0x228699[_0x3adb('0x1a')]=_0x228699['adminId'];_0x228699[_0x3adb('0x16')]=_0x228699[_0x3adb('0x1f')];_0x5129c7(_0x228699);}});};}function createEndUser(_0x4df40e,_0x2872ac,_0x72c4db,_0x2517b3,_0x2e5b1b){logger[_0x3adb('0x12')]('['+[_0x4df40e[_0x3adb('0xf')]()]+'],\x20createEndUser\x20input\x20crm',_0x72c4db);return new Promise(function(_0x387631,_0x436cf0){var _0x5cbbe2={'method':'POST','uri':_0x2517b3+_0x3adb('0x20')+_0x2e5b1b,'body':{'user_name':_0x72c4db[_0x3adb('0x21')],'roles':_0x3adb('0x22'),'first_name':_0x72c4db['endUserNumber'],'active':'true','date_format':_0x3adb('0x23'),'phone':_0x72c4db[_0x3adb('0x21')]},'auth':_0x2872ac,'json':!![]};return rp(_0x5cbbe2)['then'](function(_0x1523f1){logger[_0x3adb('0x12')]('['+[_0x4df40e[_0x3adb('0xf')]()]+_0x3adb('0x24'),_0x1523f1[_0x3adb('0xc')]);_0x72c4db['endUserId']=_0x1523f1['result'][_0x3adb('0x1b')];_0x387631(_0x72c4db);})[_0x3adb('0x10')](function(_0x57994b){logger[_0x3adb('0x1d')]('['+[_0x4df40e[_0x3adb('0xf')]()]+']',_0x57994b[_0x3adb('0x11')]);_0x436cf0(_0x57994b['message']);});});}function getEndUser(_0x47ecf0,_0x16fe7a,_0x3dfffd,_0x68c718,_0x421e0d){return function(_0x4e17ed){logger[_0x3adb('0x12')]('['+[_0x47ecf0[_0x3adb('0xf')]()]+_0x3adb('0x25'),_0x4e17ed);return new Promise(function(_0x5426c8,_0x508bff){var _0x5e3f1b={'method':_0x3adb('0x9'),'uri':_0x3dfffd+'sys_user?sysparm_query=phone%3D'+_0x4e17ed[_0x3adb('0x21')]+'&'+_0x68c718+'&'+_0x421e0d,'auth':_0x16fe7a,'json':!![]};return rp(_0x5e3f1b)['then'](function(_0x2b493d){if(_0x2b493d[_0x3adb('0xc')][_0x3adb('0xd')]>0x0){_0x4e17ed[_0x3adb('0x26')]=_0x2b493d[_0x3adb('0xc')][0x0][_0x3adb('0x1b')];logger[_0x3adb('0x12')]('['+[_0x47ecf0[_0x3adb('0xf')]()]+'],\x20getEndUser\x20crm',_0x4e17ed);_0x5426c8(_0x4e17ed);}else{return createEndUser(_0x47ecf0,_0x16fe7a,_0x4e17ed,_0x3dfffd,_0x68c718)[_0x3adb('0xb')](function(_0x423821){logger[_0x3adb('0x12')]('['+[_0x47ecf0[_0x3adb('0xf')]()]+'],\x20createEndUser\x20crm',_0x423821);_0x5426c8(_0x423821);});}})[_0x3adb('0x10')](function(_0xcf226){logger[_0x3adb('0x1d')]('['+[_0x47ecf0[_0x3adb('0xf')]()]+']',_0xcf226[_0x3adb('0x11')]);_0x508bff(_0xcf226['message']);});});};}function getCustomFields(_0x314aad,_0x52d049){var _0x3c2dcd={};if(_0x314aad['length']>0x0){_['forEach'](_0x314aad,function(_0x4cf740){if(_[_0x3adb('0x27')]([_0x3adb('0x28'),_0x3adb('0x29')],_0x4cf740[_0x3adb('0x2a')])&&_0x4cf740['nameField']&&!_0x4cf740['customField']){_0x3c2dcd[_0x4cf740[_0x3adb('0x2b')][_0x3adb('0x2c')]()]=_0x4cf740[_0x3adb('0x2d')][_0x3adb('0x2e')]();}else if(_[_0x3adb('0x27')]([_0x3adb('0x28'),_0x3adb('0x29')],_0x4cf740[_0x3adb('0x2a')])&&_0x4cf740[_0x3adb('0x2f')]&&_0x4cf740[_0x3adb('0x30')]){_0x3c2dcd[_0x4cf740[_0x3adb('0x2f')][_0x3adb('0x2c')]()]=_0x4cf740['content']['toString']();}else if(_0x4cf740['type']===_0x3adb('0x31')&&_0x4cf740['variableName']&&_0x4cf740[_0x3adb('0x2f')]&&_0x4cf740[_0x3adb('0x30')]){_0x3c2dcd[_0x4cf740[_0x3adb('0x2f')][_0x3adb('0x2c')]()]=_0x52d049[_0x4cf740[_0x3adb('0x32')]][_0x3adb('0x2e')]();}else if(_0x4cf740[_0x3adb('0x2a')]===_0x3adb('0x33')&&_0x4cf740[_0x3adb('0x34')]&&_0x4cf740[_0x3adb('0x34')]['name']&&_0x4cf740[_0x3adb('0x2f')]&&_0x4cf740[_0x3adb('0x30')]){_0x3c2dcd[_0x4cf740[_0x3adb('0x2f')]['toLowerCase']()]=_0x52d049[_0x4cf740[_0x3adb('0x34')][_0x3adb('0x35')]['toLowerCase']()][_0x3adb('0x2e')]();}});}return _0x3c2dcd;}function getTicket(_0x6a4d84,_0x51d8a7,_0x34598d,_0x3ec7c5,_0x83fcb5,_0x457ff4){return function(_0x370109){logger[_0x3adb('0x12')]('['+[_0x6a4d84['toUpperCase']()]+']\x20getTicket\x20input\x20crm',_0x370109);return new Promise(function(_0x1c9c08,_0x564203){var _0x1487ee=_0x6a4d84[_0x3adb('0x2c')]()===_0x3adb('0x36')?_0x370109[_0x3adb('0x1a')]:_0x370109[_0x3adb('0x26')];var _0x831868={'method':_0x3adb('0x37'),'uri':_0x34598d+'incident'+'?'+_0x457ff4,'body':Object[_0x3adb('0x38')]({},{'active':_0x3adb('0x19'),'caller_id':_0x1487ee,'assigned_to':_0x370109['userId'],'short_description':intUtil[_0x3adb('0x39')](_0x3ec7c5[_0x3adb('0x3a')],_0x83fcb5,'\x20'),'description':intUtil[_0x3adb('0x39')](_0x3ec7c5[_0x3adb('0x3b')],_0x83fcb5,'\x0a')},getCustomFields(_0x3ec7c5[_0x3adb('0x3c')],_0x83fcb5)),'auth':_0x51d8a7,'json':!![]};return rp(_0x831868)[_0x3adb('0xb')](function(_0x209326){logger['info']('['+[_0x6a4d84[_0x3adb('0xf')]()]+']\x20POST\x20incident\x20entity\x20schema',_0x209326[_0x3adb('0xc')]);_0x370109['ticketId']=_0x209326['result'][_0x3adb('0x1b')];_0x370109[_0x3adb('0x3d')]=_0x209326[_0x3adb('0xc')][_0x3adb('0x3e')];logger[_0x3adb('0x12')]('['+[_0x6a4d84[_0x3adb('0xf')]()]+_0x3adb('0x3f'),_0x370109);_0x1c9c08(_0x370109);})[_0x3adb('0x10')](function(_0x34711f){logger[_0x3adb('0x1d')]('['+[_0x6a4d84[_0x3adb('0xf')]()]+']',_0x34711f[_0x3adb('0x11')]);_0x564203(_0x34711f['message']);});});};}function createRemoteTag(_0x4bec39,_0x4c765d,_0x153ecb,_0x35bc40){return new Promise(function(_0xaf0e4c,_0x1853e4){var _0xb16484={'method':'POST','uri':_0x153ecb+_0x3adb('0x40')+'?'+_0x35bc40,'body':{'short_description':_0x4bec39,'global':!![],'active':!![],'name':_0x4bec39},'auth':_0x4c765d,'json':!![]};return rp(_0xb16484)[_0x3adb('0xb')](function(_0x2a6f40){var _0x5d4717=_0x2a6f40[_0x3adb('0xc')][_0x3adb('0x1b')];_0xaf0e4c(_0x5d4717);});});}function getRemoteTag(_0x2fc1e2,_0x397cc7,_0xb88d9a,_0x2c8249,_0x4f0a42){return new Promise(function(_0x54fb44,_0x29ee85){var _0x2de1b6={'method':_0x3adb('0x9'),'uri':_0xb88d9a+_0x3adb('0x40')+_0x3adb('0x41')+_0x2fc1e2+'&'+_0x2c8249,'auth':_0x397cc7,'json':!![]};return rp(_0x2de1b6)[_0x3adb('0xb')](function(_0x42edae){if(_0x42edae['result']['length']>0x0){var _0x5f4d99=_0x42edae['result'][0x0][_0x3adb('0x1b')];_0x54fb44(_0x5f4d99);}else{return createRemoteTag(_0x2fc1e2,_0x397cc7,_0xb88d9a,_0x2c8249)[_0x3adb('0xb')](function(_0x2ba259){_0x54fb44(_0x2ba259);});}});});}function assignTagToIncident(_0x166aa7,_0x201c58,_0xd0c8b1,_0x351357,_0x40c6df){return new Promise(function(_0x4def7a,_0x2c3cd8){var _0x23e57f={'method':_0x3adb('0x37'),'uri':_0xd0c8b1+_0x3adb('0x42')+'?'+_0x40c6df,'body':{'label':_0x166aa7,'table':_0x3adb('0x43'),'id_type':_0x3adb('0x44'),'table_key':_0x351357[_0x3adb('0x45')],'title':'Incident\x20-\x20'+_0x351357[_0x3adb('0x3d')],'id_display':_0x351357[_0x3adb('0x3d')]},'auth':_0x201c58,'json':!![]};return rp(_0x23e57f)[_0x3adb('0xb')](function(_0x5cff51){_0x4def7a();})[_0x3adb('0x10')](function(){_0x4def7a();});});}function manageTags(_0x23c260,_0x301716,_0x5c4c1d,_0x5b9b30,_0x187cd1,_0x4fd296,_0x8a6f66){return new Promise(function(_0x23a997,_0x3b071d){var _0x312037=[];_0x301716[_0x3adb('0x46')](function(_0x59eb60){_0x312037[_0x3adb('0x47')](getRemoteTag(_0x59eb60,_0x5c4c1d,_0x5b9b30,_0x4fd296,_0x8a6f66));});return Promise[_0x3adb('0x48')](_0x312037)[_0x3adb('0xb')](function(_0x17311f){if(_0x17311f['length']){logger[_0x3adb('0x12')]('['+[_0x23c260[_0x3adb('0xf')]()]+_0x3adb('0x49'),_0x17311f);var _0x168058=[];_0x17311f['forEach'](function(_0x27c080){_0x168058['push'](assignTagToIncident(_0x27c080,_0x5c4c1d,_0x5b9b30,_0x187cd1,_0x4fd296));});return Promise['all'](_0x168058)[_0x3adb('0xb')](function(){_0x23a997();})[_0x3adb('0x10')](function(){_0x23a997();});}else{_0x23a997();}});});}function getTags(_0x3df990,_0x2d49cb,_0x40ab29,_0x634a04,_0x19e99f,_0x185233){return function(_0x3fe05c){return new Promise(function(_0x445ad3,_0x483131){var _0x3bd625=[];var _0x56f7c2=_0x634a04['Tags'];if(_0x56f7c2&&_0x56f7c2[_0x3adb('0xd')]>0x0){_0x3bd625=_['map'](_0x56f7c2,_0x3adb('0x35'));}if(_0x3bd625[_0x3adb('0xd')]>0x0){return manageTags(_0x3df990,_0x3bd625,_0x2d49cb,_0x40ab29,_0x3fe05c,_0x19e99f,_0x185233)[_0x3adb('0xb')](function(){_0x445ad3(_0x3fe05c);});}else{_0x445ad3(_0x3fe05c);}});};}function emit(_0xc0bb3a,_0x1475da,_0x2ff15e){var _0xdcad5e=_0x3adb('0x4a')+_0x3adb('0x4b')+_0x3adb('0x4c')+_0x3adb('0x4d');var _0xe9c115={'uri':_0xc0bb3a+_0x3adb('0x4e')+_0x2ff15e+_0xdcad5e};io['to'](util[_0x3adb('0x4f')](_0x3adb('0x50'),_0x1475da))[_0x3adb('0x51')](_0x3adb('0x52'),_0xe9c115);}exports['cs']=function(_0x5900d5,_0x248e11,_0x53f346,_0x160c3a,_0xefa55b,_0x575689,_0x401e66,_0x56480e){var _0x4c6bb5={};var _0x4c21d4={'user':_0x575689[_0x3adb('0x53')],'pass':_0x575689[_0x3adb('0x54')]};var _0x20220a='sysparm_limit=1';var _0x3c3b3c=_0x3adb('0x55');_0x575689[_0x3adb('0x56')]=intUtil[_0x3adb('0x57')](_0x575689[_0x3adb('0x56')]);_0x575689[_0x3adb('0x58')]=intUtil[_0x3adb('0x57')](_0x575689[_0x3adb('0x58')]);var _0x3df275=util[_0x3adb('0x4f')]('%s/api/now/table/',_0x575689[_0x3adb('0x56')]);_0x4c6bb5[_0x3adb('0x16')]=!_[_0x3adb('0x59')](_0x160c3a)?_0x160c3a['email']:null;_0x4c6bb5['adminEmail']=_0x575689[_0x3adb('0x5a')];_0x4c6bb5[_0x3adb('0x21')]=_0x56480e['toLowerCase']()===_0x3adb('0x36')?_0x248e11[_0x3adb('0x5b')]:_0x248e11[_0x3adb('0x5c')];_0x4c6bb5[_0x3adb('0x5d')]=_0x56480e===_0x3adb('0x5e')||_0x56480e===_0x3adb('0x5f')?_0x3adb('0x5e'):_0x3adb('0x36');var _0x23d17d=util['format'](_0x3adb('0x60'),_0x575689[_0x3adb('0x58')],_0x248e11[_0x3adb('0x61')],md5(_0x248e11['uniqueid']));if(_0xefa55b&&_0xefa55b[_0x3adb('0x62')]){logger[_0x3adb('0x12')](_0x3adb('0x63'),_0x3adb('0x64'));_0x248e11['recordingURL']=_0x23d17d;}else if(_0x401e66&&_0x401e66['recordingFormat']&&_0x401e66[_0x3adb('0x65')]!=='none'){logger['info'](_0x3adb('0x66'),'Recording\x20is\x20enabled!');_0x248e11['recordingURL']=_0x23d17d;}else{_0x248e11[_0x3adb('0x67')]='';}return getAdminUser(_0x56480e,_0x4c21d4,_0x4c6bb5,_0x3df275,_0x3c3b3c,_0x20220a)['then'](getUser(_0x56480e,_0x4c21d4,_0x3df275,_0x3c3b3c,_0x20220a))[_0x3adb('0xb')](getEndUser(_0x56480e,_0x4c21d4,_0x3df275,_0x3c3b3c,_0x20220a))[_0x3adb('0xb')](getTicket(_0x56480e,_0x4c21d4,_0x3df275,_0x53f346,_0x248e11,_0x3c3b3c))[_0x3adb('0xb')](function(_0x652e16){logger[_0x3adb('0x12')](util[_0x3adb('0x4f')](_0x3adb('0x68'),_0x652e16[_0x3adb('0x45')]));logger[_0x3adb('0x12')](util[_0x3adb('0x4f')](_0x3adb('0x69'),_0x56480e));if(_0x56480e!==_0x3adb('0x5f')){logger[_0x3adb('0x12')]('['+[_0x56480e[_0x3adb('0xf')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x575689[_0x3adb('0x56')],_0x160c3a[_0x3adb('0x35')],_0x652e16[_0x3adb('0x45')]);}})[_0x3adb('0x10')](function(_0x376de7){logger['error']('['+[_0x56480e[_0x3adb('0xf')]()]+_0x3adb('0x6a'),util['inspect'](_0x376de7,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x61ea=['../../../../config/logger','servicenow','redis','localhost','socket.io-emitter','GET','then','result','adminId','sys_id','info','],\x20getAdminUser\x20crm','catch','error','toUpperCase','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','length','userId','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','user','endUserNumber','true','System','endUserId','],\x20getEndUser\x20input\x20crm','],\x20getEndUser\x20crm','includes','picklist','type','nameField','customField','toLowerCase','string','idField','content','toString','variable','variableName','Variable','name',']\x20getTicket\x20input\x20crm','outbound','POST','incident','getString','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketNumber','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','Incident','ticketId','forEach','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','user:%s','emit','trigger:browser:url','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','serverUrl','stripTrailingSlash','format','%s/api/now/table/','isNil','email','adminEmail','destcalleridnum','calleridnum','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','util','md5','ioredis','./util','../../../../config/environment'];(function(_0x578c42,_0x2f51b2){var _0x13268d=function(_0x571a84){while(--_0x571a84){_0x578c42['push'](_0x578c42['shift']());}};_0x13268d(++_0x2f51b2);}(_0x61ea,0x1a0));var _0xa61e=function(_0x2fd948,_0x5de2ce){_0x2fd948=_0x2fd948-0x0;var _0x5d5755=_0x61ea[_0x2fd948];return _0x5d5755;};'use strict';var _=require(_0xa61e('0x0'));var Promise=require(_0xa61e('0x1'));var rp=require(_0xa61e('0x2'));var util=require(_0xa61e('0x3'));var md5=require(_0xa61e('0x4'));var Redis=require(_0xa61e('0x5'));var intUtil=require(_0xa61e('0x6'));var config=require(_0xa61e('0x7'));var logger=require(_0xa61e('0x8'))(_0xa61e('0x9'));config[_0xa61e('0xa')]=_['defaults'](config[_0xa61e('0xa')],{'host':_0xa61e('0xb'),'port':0x18eb});var io=require(_0xa61e('0xc'))(new Redis(config[_0xa61e('0xa')]));function getAdminUser(_0x27d126,_0x39cdb4,_0x38fabc,_0x3c7d52,_0xb9b59a,_0x1625f2){return new Promise(function(_0x57e5ab,_0x3a794b){var _0x3b55a7={'method':_0xa61e('0xd'),'uri':_0x3c7d52+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0xb9b59a+'&'+_0x1625f2,'auth':_0x39cdb4,'json':!![]};return rp(_0x3b55a7)[_0xa61e('0xe')](function(_0x23e244){if(_0x23e244[_0xa61e('0xf')]['length']>0x0){_0x38fabc[_0xa61e('0x10')]=_0x23e244[_0xa61e('0xf')][0x0][_0xa61e('0x11')];}logger[_0xa61e('0x12')]('['+[_0x27d126['toUpperCase']()]+_0xa61e('0x13'),_0x38fabc);_0x57e5ab(_0x38fabc);})[_0xa61e('0x14')](function(_0x251e51){logger[_0xa61e('0x15')]('['+[_0x27d126[_0xa61e('0x16')]()]+']',_0x251e51[_0xa61e('0x17')]);_0x3a794b(_0x251e51['message']);});});}function getUser(_0x25a054,_0x4c9499,_0x4d8e23,_0xabd087,_0x1fb118){return function(_0x5b3a0e){logger[_0xa61e('0x12')]('['+[_0x25a054[_0xa61e('0x16')]()]+_0xa61e('0x18'),_0x5b3a0e);return new Promise(function(_0x3cafde,_0x23d27f){if(intUtil[_0xa61e('0x19')](_0x5b3a0e[_0xa61e('0x1a')])){var _0x146a79={'method':_0xa61e('0xd'),'uri':_0x4d8e23+'sys_user?sysparm_query=email%3D'+_0x5b3a0e[_0xa61e('0x1a')]+'&'+_0xabd087+'&'+_0x1fb118,'auth':_0x4c9499,'json':!![]};logger['info']('['+[_0x25a054[_0xa61e('0x16')]()]+'],\x20getUser\x20rp\x20obj',_0x146a79);return rp(_0x146a79)[_0xa61e('0xe')](function(_0x187c98){logger[_0xa61e('0x12')]('['+[_0x25a054[_0xa61e('0x16')]()]+'],\x20getUser\x20entity',_0x187c98);if(_0x187c98[_0xa61e('0xf')][_0xa61e('0x1b')]>0x0&&String(_0x187c98[_0xa61e('0xf')][0x0]['active'])==='true'){_0x5b3a0e[_0xa61e('0x1c')]=_0x187c98['result'][0x0]['sys_id'];}else{_0x5b3a0e[_0xa61e('0x1c')]=_0x5b3a0e[_0xa61e('0x10')];_0x5b3a0e['userEmail']=_0x5b3a0e['adminEmail'];}logger[_0xa61e('0x12')]('['+[_0x25a054[_0xa61e('0x16')]()]+_0xa61e('0x1d'),_0x5b3a0e);_0x3cafde(_0x5b3a0e);})['catch'](function(_0x299cb5){logger[_0xa61e('0x15')]('['+[_0x25a054[_0xa61e('0x16')]()]+']',_0x299cb5[_0xa61e('0x17')]);_0x23d27f(_0x299cb5[_0xa61e('0x17')]);});}else{logger[_0xa61e('0x12')]('['+[_0x25a054[_0xa61e('0x16')]()]+_0xa61e('0x1e'));_0x5b3a0e[_0xa61e('0x1c')]=_0x5b3a0e[_0xa61e('0x10')];_0x5b3a0e[_0xa61e('0x1a')]=_0x5b3a0e['adminEmail'];_0x3cafde(_0x5b3a0e);}});};}function createEndUser(_0x2940b3,_0x1385be,_0x2f864e,_0x2ecab4,_0x2f2305){logger['info']('['+[_0x2940b3['toUpperCase']()]+'],\x20createEndUser\x20input\x20crm',_0x2f864e);return new Promise(function(_0x6ed1b5,_0x1ff4de){var _0x1acb7d={'method':'POST','uri':_0x2ecab4+'sys_user?'+_0x2f2305,'body':{'user_name':_0x2f864e['endUserNumber'],'roles':_0xa61e('0x1f'),'first_name':_0x2f864e[_0xa61e('0x20')],'active':_0xa61e('0x21'),'date_format':_0xa61e('0x22'),'phone':_0x2f864e['endUserNumber']},'auth':_0x1385be,'json':!![]};return rp(_0x1acb7d)[_0xa61e('0xe')](function(_0x37711a){logger[_0xa61e('0x12')]('['+[_0x2940b3[_0xa61e('0x16')]()]+'],\x20EndUser\x20schema',_0x37711a['result']);_0x2f864e[_0xa61e('0x23')]=_0x37711a['result']['sys_id'];_0x6ed1b5(_0x2f864e);})['catch'](function(_0x312a9f){logger[_0xa61e('0x15')]('['+[_0x2940b3[_0xa61e('0x16')]()]+']',_0x312a9f[_0xa61e('0x17')]);_0x1ff4de(_0x312a9f[_0xa61e('0x17')]);});});}function getEndUser(_0x123410,_0x35bb04,_0x148240,_0x28480f,_0x2a42fa){return function(_0x4d3798){logger[_0xa61e('0x12')]('['+[_0x123410[_0xa61e('0x16')]()]+_0xa61e('0x24'),_0x4d3798);return new Promise(function(_0x30fa61,_0x7909ed){var _0x575a54={'method':'GET','uri':_0x148240+'sys_user?sysparm_query=phone%3D'+_0x4d3798['endUserNumber']+'&'+_0x28480f+'&'+_0x2a42fa,'auth':_0x35bb04,'json':!![]};return rp(_0x575a54)[_0xa61e('0xe')](function(_0x50ce43){if(_0x50ce43[_0xa61e('0xf')][_0xa61e('0x1b')]>0x0){_0x4d3798[_0xa61e('0x23')]=_0x50ce43[_0xa61e('0xf')][0x0]['sys_id'];logger[_0xa61e('0x12')]('['+[_0x123410[_0xa61e('0x16')]()]+_0xa61e('0x25'),_0x4d3798);_0x30fa61(_0x4d3798);}else{return createEndUser(_0x123410,_0x35bb04,_0x4d3798,_0x148240,_0x28480f)['then'](function(_0x375a2d){logger[_0xa61e('0x12')]('['+[_0x123410[_0xa61e('0x16')]()]+'],\x20createEndUser\x20crm',_0x375a2d);_0x30fa61(_0x375a2d);});}})[_0xa61e('0x14')](function(_0x3ede02){logger[_0xa61e('0x15')]('['+[_0x123410['toUpperCase']()]+']',_0x3ede02['message']);_0x7909ed(_0x3ede02['message']);});});};}function getCustomFields(_0x33beb4,_0x16ad8e){var _0x59bad5={};if(_0x33beb4[_0xa61e('0x1b')]>0x0){_['forEach'](_0x33beb4,function(_0x231d8a){if(_[_0xa61e('0x26')](['string',_0xa61e('0x27')],_0x231d8a[_0xa61e('0x28')])&&_0x231d8a[_0xa61e('0x29')]&&!_0x231d8a[_0xa61e('0x2a')]){_0x59bad5[_0x231d8a['nameField'][_0xa61e('0x2b')]()]=_0x231d8a['content']['toString']();}else if(_['includes']([_0xa61e('0x2c'),_0xa61e('0x27')],_0x231d8a[_0xa61e('0x28')])&&_0x231d8a[_0xa61e('0x2d')]&&_0x231d8a[_0xa61e('0x2a')]){_0x59bad5[_0x231d8a[_0xa61e('0x2d')][_0xa61e('0x2b')]()]=_0x231d8a[_0xa61e('0x2e')][_0xa61e('0x2f')]();}else if(_0x231d8a[_0xa61e('0x28')]===_0xa61e('0x30')&&_0x231d8a[_0xa61e('0x31')]&&_0x231d8a[_0xa61e('0x2d')]&&_0x231d8a['customField']){_0x59bad5[_0x231d8a[_0xa61e('0x2d')][_0xa61e('0x2b')]()]=_0x16ad8e[_0x231d8a[_0xa61e('0x31')]][_0xa61e('0x2f')]();}else if(_0x231d8a[_0xa61e('0x28')]==='customVariable'&&_0x231d8a['Variable']&&_0x231d8a[_0xa61e('0x32')][_0xa61e('0x33')]&&_0x231d8a['idField']&&_0x231d8a['customField']){_0x59bad5[_0x231d8a[_0xa61e('0x2d')]['toLowerCase']()]=_0x16ad8e[_0x231d8a[_0xa61e('0x32')]['name']['toLowerCase']()]['toString']();}});}return _0x59bad5;}function getTicket(_0x18b4c6,_0x3a027f,_0x544357,_0x155519,_0x41ec60,_0x5e3d97){return function(_0x38010e){logger[_0xa61e('0x12')]('['+[_0x18b4c6[_0xa61e('0x16')]()]+_0xa61e('0x34'),_0x38010e);return new Promise(function(_0x5565f3,_0x37ca8b){var _0xfe3916=_0x18b4c6['toLowerCase']()===_0xa61e('0x35')?_0x38010e[_0xa61e('0x1c')]:_0x38010e[_0xa61e('0x23')];var _0x13789f={'method':_0xa61e('0x36'),'uri':_0x544357+_0xa61e('0x37')+'?'+_0x5e3d97,'body':Object['assign']({},{'active':_0xa61e('0x21'),'caller_id':_0xfe3916,'assigned_to':_0x38010e[_0xa61e('0x1c')],'short_description':intUtil[_0xa61e('0x38')](_0x155519['Subjects'],_0x41ec60,'\x20'),'description':intUtil[_0xa61e('0x38')](_0x155519['Descriptions'],_0x41ec60,'\x0a')},getCustomFields(_0x155519[_0xa61e('0x39')],_0x41ec60)),'auth':_0x3a027f,'json':!![]};return rp(_0x13789f)[_0xa61e('0xe')](function(_0x5a8123){logger['info']('['+[_0x18b4c6[_0xa61e('0x16')]()]+_0xa61e('0x3a'),_0x5a8123[_0xa61e('0xf')]);_0x38010e['ticketId']=_0x5a8123[_0xa61e('0xf')]['sys_id'];_0x38010e[_0xa61e('0x3b')]=_0x5a8123[_0xa61e('0xf')][_0xa61e('0x3c')];logger[_0xa61e('0x12')]('['+[_0x18b4c6[_0xa61e('0x16')]()]+_0xa61e('0x3d'),_0x38010e);_0x5565f3(_0x38010e);})[_0xa61e('0x14')](function(_0x5140f2){logger['error']('['+[_0x18b4c6[_0xa61e('0x16')]()]+']',_0x5140f2[_0xa61e('0x17')]);_0x37ca8b(_0x5140f2[_0xa61e('0x17')]);});});};}function createRemoteTag(_0x3ffa7b,_0x44bf2a,_0xa7ef46,_0x2338f5){return new Promise(function(_0x1da8c1,_0x12e82b){var _0x20953a={'method':_0xa61e('0x36'),'uri':_0xa7ef46+_0xa61e('0x3e')+'?'+_0x2338f5,'body':{'short_description':_0x3ffa7b,'global':!![],'active':!![],'name':_0x3ffa7b},'auth':_0x44bf2a,'json':!![]};return rp(_0x20953a)[_0xa61e('0xe')](function(_0x3e1ad8){var _0x2229f9=_0x3e1ad8[_0xa61e('0xf')][_0xa61e('0x11')];_0x1da8c1(_0x2229f9);});});}function getRemoteTag(_0x3d7bb5,_0x1c6245,_0x253558,_0x1ce70a,_0x58f9b0){return new Promise(function(_0x1514a8,_0x295698){var _0x517580={'method':'GET','uri':_0x253558+_0xa61e('0x3e')+_0xa61e('0x3f')+_0x3d7bb5+'&'+_0x1ce70a,'auth':_0x1c6245,'json':!![]};return rp(_0x517580)['then'](function(_0x406d45){if(_0x406d45[_0xa61e('0xf')][_0xa61e('0x1b')]>0x0){var _0x36fe4b=_0x406d45['result'][0x0][_0xa61e('0x11')];_0x1514a8(_0x36fe4b);}else{return createRemoteTag(_0x3d7bb5,_0x1c6245,_0x253558,_0x1ce70a)[_0xa61e('0xe')](function(_0x2801b5){_0x1514a8(_0x2801b5);});}});});}function assignTagToIncident(_0x563486,_0x150f4d,_0x57f2ea,_0x35735b,_0x563e08){return new Promise(function(_0x32a318,_0x3b82f8){var _0x2ae6c8={'method':'POST','uri':_0x57f2ea+_0xa61e('0x40')+'?'+_0x563e08,'body':{'label':_0x563486,'table':_0xa61e('0x37'),'id_type':_0xa61e('0x41'),'table_key':_0x35735b[_0xa61e('0x42')],'title':'Incident\x20-\x20'+_0x35735b['ticketNumber'],'id_display':_0x35735b['ticketNumber']},'auth':_0x150f4d,'json':!![]};return rp(_0x2ae6c8)['then'](function(_0x4b6be6){_0x32a318();})[_0xa61e('0x14')](function(){_0x32a318();});});}function manageTags(_0x2e6884,_0x460627,_0x1aa6ad,_0x23878c,_0x5c583d,_0x4a7bca,_0x3712fb){return new Promise(function(_0x378309,_0x368096){var _0x248875=[];_0x460627[_0xa61e('0x43')](function(_0x3de667){_0x248875[_0xa61e('0x44')](getRemoteTag(_0x3de667,_0x1aa6ad,_0x23878c,_0x4a7bca,_0x3712fb));});return Promise[_0xa61e('0x45')](_0x248875)[_0xa61e('0xe')](function(_0x27e412){if(_0x27e412[_0xa61e('0x1b')]){logger[_0xa61e('0x12')]('['+[_0x2e6884[_0xa61e('0x16')]()]+_0xa61e('0x46'),_0x27e412);var _0x63c53e=[];_0x27e412[_0xa61e('0x43')](function(_0x2de87e){_0x63c53e[_0xa61e('0x44')](assignTagToIncident(_0x2de87e,_0x1aa6ad,_0x23878c,_0x5c583d,_0x4a7bca));});return Promise['all'](_0x63c53e)['then'](function(){_0x378309();})[_0xa61e('0x14')](function(){_0x378309();});}else{_0x378309();}});});}function getTags(_0x2321db,_0x37df9c,_0x43987a,_0x39e71b,_0x312993,_0x3e0945){return function(_0x40c36c){return new Promise(function(_0x383136,_0x59c2c3){var _0x545ec7=[];var _0x8ea187=_0x39e71b['Tags'];if(_0x8ea187&&_0x8ea187[_0xa61e('0x1b')]>0x0){_0x545ec7=_[_0xa61e('0x47')](_0x8ea187,_0xa61e('0x33'));}if(_0x545ec7[_0xa61e('0x1b')]>0x0){return manageTags(_0x2321db,_0x545ec7,_0x37df9c,_0x43987a,_0x40c36c,_0x312993,_0x3e0945)[_0xa61e('0xe')](function(){_0x383136(_0x40c36c);});}else{_0x383136(_0x40c36c);}});};}function emit(_0x3ae259,_0x527377,_0x849f94){var _0x173036=_0xa61e('0x48')+_0xa61e('0x49')+_0xa61e('0x4a')+_0xa61e('0x4b');var _0x4dc6d6={'uri':_0x3ae259+_0xa61e('0x4c')+_0x849f94+_0x173036};io['to'](util['format'](_0xa61e('0x4d'),_0x527377))[_0xa61e('0x4e')](_0xa61e('0x4f'),_0x4dc6d6);}exports['cs']=function(_0x4f9440,_0x4eea9f,_0x1cfee7,_0x5b6157,_0xd556d3,_0x2b0f4e,_0x3bb232,_0x57541d){var _0x378257={};var _0x4bdd3c={'user':_0x2b0f4e['username'],'pass':_0x2b0f4e[_0xa61e('0x50')]};var _0x593208=_0xa61e('0x51');var _0x587055=_0xa61e('0x52');_0x2b0f4e['remoteUri']=intUtil['stripTrailingSlash'](_0x2b0f4e[_0xa61e('0x53')]);_0x2b0f4e[_0xa61e('0x54')]=intUtil[_0xa61e('0x55')](_0x2b0f4e[_0xa61e('0x54')]);var _0x5e8308=util[_0xa61e('0x56')](_0xa61e('0x57'),_0x2b0f4e[_0xa61e('0x53')]);_0x378257[_0xa61e('0x1a')]=!_[_0xa61e('0x58')](_0x5b6157)?_0x5b6157[_0xa61e('0x59')]:null;_0x378257[_0xa61e('0x5a')]=_0x2b0f4e[_0xa61e('0x59')];_0x378257[_0xa61e('0x20')]=_0x57541d[_0xa61e('0x2b')]()===_0xa61e('0x35')?_0x4eea9f[_0xa61e('0x5b')]:_0x4eea9f[_0xa61e('0x5c')];_0x378257['callDirection']=_0x57541d===_0xa61e('0x5d')||_0x57541d==='unmanaged'?'queue':_0xa61e('0x35');var _0x5b0c15=util['format'](_0xa61e('0x5e'),_0x2b0f4e['serverUrl'],_0x4eea9f[_0xa61e('0x5f')],md5(_0x4eea9f['uniqueid']));if(_0xd556d3&&_0xd556d3['monitor_format']){logger[_0xa61e('0x12')](_0xa61e('0x60'),_0xa61e('0x61'));_0x4eea9f[_0xa61e('0x62')]=_0x5b0c15;}else if(_0x3bb232&&_0x3bb232[_0xa61e('0x63')]&&_0x3bb232['recordingFormat']!=='none'){logger['info']('[OUTBOUND]',_0xa61e('0x61'));_0x4eea9f[_0xa61e('0x62')]=_0x5b0c15;}else{_0x4eea9f[_0xa61e('0x62')]='';}return getAdminUser(_0x57541d,_0x4bdd3c,_0x378257,_0x5e8308,_0x587055,_0x593208)[_0xa61e('0xe')](getUser(_0x57541d,_0x4bdd3c,_0x5e8308,_0x587055,_0x593208))[_0xa61e('0xe')](getEndUser(_0x57541d,_0x4bdd3c,_0x5e8308,_0x587055,_0x593208))['then'](getTicket(_0x57541d,_0x4bdd3c,_0x5e8308,_0x1cfee7,_0x4eea9f,_0x587055))[_0xa61e('0xe')](function(_0xcbac3f){logger['info'](util['format'](_0xa61e('0x64'),_0xcbac3f['ticketId']));logger[_0xa61e('0x12')](util['format'](_0xa61e('0x65'),_0x57541d));if(_0x57541d!==_0xa61e('0x66')){logger[_0xa61e('0x12')]('['+[_0x57541d[_0xa61e('0x16')]()]+']',_0xa61e('0x67'));emit(_0x2b0f4e[_0xa61e('0x53')],_0x5b6157[_0xa61e('0x33')],_0xcbac3f['ticketId']);}})['catch'](function(_0x18128d){logger[_0xa61e('0x15')]('['+[_0x57541d[_0xa61e('0x16')]()]+_0xa61e('0x68'),util[_0xa61e('0x69')](_0x18128d,{'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 6452a63..922f60f 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 _0x813a=['variable','customVariable','Variable','username','password','PLAIN','xCALLY\x20Motion\x20integration','Account\x20%d\x20is\x20not\x20valid','queue','remoteUri','serverUrl','stripTrailingSlash','uri','%s/service/v4_1/rest.php','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','contacts','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','[QUEUE]','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Fields','users','version','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/logger','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects','created_by','Descriptions','date_start','toISOString','slice','replace','duration_minutes','parent_id','parent_type','parent_name','direction','length','variableName','push','idField','set_entry','JSON','format','Basic\x20%s','apiKey','toString','base64','stringify','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','Agent\x20found!','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','Contacts','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','first_name','','Enduser\x20created.','debug','[HTTP]','merge','forEach','type','string','nameField','toLowerCase','content','customField','custom_fields'];(function(_0xb7b269,_0xf52b7c){var _0x50e687=function(_0x477399){while(--_0x477399){_0xb7b269['push'](_0xb7b269['shift']());}};_0x50e687(++_0xf52b7c);}(_0x813a,0xac));var _0xa813=function(_0x27e700,_0x51ada1){_0x27e700=_0x27e700-0x0;var _0x52bf96=_0x813a[_0x27e700];return _0x52bf96;};'use strict';var _=require(_0xa813('0x0'));var rp=require(_0xa813('0x1'));var BPromise=require(_0xa813('0x2'));var md5=require(_0xa813('0x3'));var util=require(_0xa813('0x4'));var Redis=require(_0xa813('0x5'));var intUtil=require(_0xa813('0x6'));var config=require('../../../../config/environment');var logger=require(_0xa813('0x7'))(_0xa813('0x8'));config[_0xa813('0x9')]=_[_0xa813('0xa')](config[_0xa813('0x9')],{'host':_0xa813('0xb'),'port':0x18eb});var io=require(_0xa813('0xc'))(new Redis(config[_0xa813('0x9')]));var def={'method':_0xa813('0xd'),'json':!![]};function emit(_0x492468,_0x2f2c39,_0xc31bd5){io['to'](_0x492468)[_0xa813('0xe')](_0x2f2c39,_0xc31bd5);}function getTicket(_0xffba4b,_0xe8e20f,_0x8839ed,_0x5184cf,_0x599227,_0x18e152,_0x279892,_0x40e525){logger[_0xa813('0xf')](_0xa813('0x10'));var _0x93dc9f=new Date();var _0x498162=[{'name':_0xa813('0x11'),'value':intUtil[_0xa813('0x12')](_0x5184cf[_0xa813('0x13')],_0x599227,'\x20')},{'name':'assigned_user_id','value':_0xe8e20f['id']},{'name':_0xa813('0x14'),'value':_0xe8e20f['id']},{'name':'description','value':intUtil[_0xa813('0x12')](_0x5184cf[_0xa813('0x15')],_0x599227,'\x0a')},{'name':_0xa813('0x16'),'value':_0x93dc9f[_0xa813('0x17')]()[_0xa813('0x18')](0x0,0x13)[_0xa813('0x19')]('T','\x20')},{'name':'duration_hours','value':'0'},{'name':_0xa813('0x1a'),'value':'15'},{'name':_0xa813('0x1b'),'value':_0x8839ed['id']},{'name':_0xa813('0x1c'),'value':'Contacts'},{'name':_0xa813('0x1d'),'value':_0x8839ed[_0xa813('0x11')]},{'name':_0xa813('0x1e'),'value':_0x40e525}];if(_0x18e152[_0xa813('0x1f')]){_['forEach'](_0x18e152,function(_0xa816f4){if(_0x599227[_0xa816f4[_0xa813('0x20')]]){_0x498162[_0xa813('0x21')]({'name':_0xa816f4[_0xa813('0x22')],'value':_0x599227[_0xa816f4[_0xa813('0x20')]]});}});}return request({'form':{'method':_0xa813('0x23'),'input_type':'JSON','response_type':_0xa813('0x24'),'rest_data':JSON['stringify']({'session':_0x279892['id'],'module_name':'Calls','name_value_list':_0x498162})}});}function getAuth(_0x49e935){return util[_0xa813('0x25')](_0xa813('0x26'),new Buffer(_0x49e935[_0xa813('0x27')]+':X')[_0xa813('0x28')](_0xa813('0x29')));}function getServerInfo(_0x494fc7){return request({'form':{'method':'get_server_info','input_type':_0xa813('0x24'),'response_type':'JSON','rest_data':JSON[_0xa813('0x2a')]({'session':_0x494fc7['id']})}});}function getUser(_0x3a9c10,_0x3715f2,_0x42da96){if(!_[_0xa813('0x2b')](_0x3715f2)){logger['info'](_0xa813('0x2c'),_0x3715f2);return request({'form':{'method':_0xa813('0x2d'),'input_type':_0xa813('0x24'),'response_type':_0xa813('0x24'),'rest_data':JSON['stringify']({'session':_0x42da96['id'],'module_name':_0xa813('0x2e'),'query':util[_0xa813('0x25')](_0xa813('0x2f'),_0x3715f2),'order_by':'','offset':'0','select_fields':['id',_0xa813('0x11'),_0xa813('0x30')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xa813('0x31')](function(_0xbb420c){if(_0xbb420c[_0xa813('0x32')][_0xa813('0x1f')]){var _0x1aa80e=_[_0xa813('0x33')](_0xbb420c[_0xa813('0x32')],function(_0x36a406){return _0x36a406[_0xa813('0x34')][_0xa813('0x30')][_0xa813('0x35')]===_0x3715f2;});if(_0x1aa80e){logger['info'](_0xa813('0x36'));return BPromise[_0xa813('0x37')]({'id':_0x1aa80e[_0xa813('0x34')]['id'][_0xa813('0x35')],'name':_0x1aa80e[_0xa813('0x34')][_0xa813('0x11')][_0xa813('0x35')]});}}logger[_0xa813('0xf')](_0xa813('0x38'));return BPromise['resolve']({'id':_0x42da96[_0xa813('0x34')][_0xa813('0x39')][_0xa813('0x35')],'name':_0x42da96['name_value_list'][_0xa813('0x30')]['value']});});}else{logger[_0xa813('0xf')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0xa813('0x37')]({'id':_0x42da96[_0xa813('0x34')]['user_id'][_0xa813('0x35')],'name':_0x42da96['name_value_list'][_0xa813('0x30')][_0xa813('0x35')]});}}function getEndUser(_0x47bad3,_0x523b05,_0x116a4f,_0x292728){logger[_0xa813('0xf')](_0xa813('0x3a'),_0x116a4f);return request({'form':{'method':_0xa813('0x2d'),'input_type':_0xa813('0x24'),'response_type':_0xa813('0x24'),'rest_data':JSON['stringify']({'session':_0x292728['id'],'module_name':_0xa813('0x3b'),'query':util['format'](_0xa813('0x3c'),_0x116a4f),'order_by':'','offset':'0','select_fields':['id',_0xa813('0x11'),_0xa813('0x3d')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xa813('0x31')](function(_0xcf7350){if(_0xcf7350[_0xa813('0x32')][_0xa813('0x1f')]){var _0x5eace2=_['find'](_0xcf7350[_0xa813('0x32')],function(_0x418915){return _0x418915[_0xa813('0x34')][_0xa813('0x3d')][_0xa813('0x35')]===_0x116a4f;});if(_0x5eace2){logger[_0xa813('0xf')]('Enduser\x20found!');return BPromise['resolve']({'id':_0x5eace2[_0xa813('0x34')]['id'][_0xa813('0x35')],'name':_0x5eace2[_0xa813('0x34')][_0xa813('0x11')]['value'],'phone':_0x5eace2['name_value_list']['phone_home'][_0xa813('0x35')]});}}else{logger[_0xa813('0xf')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0xa813('0x23'),'input_type':_0xa813('0x24'),'response_type':_0xa813('0x24'),'rest_data':JSON['stringify']({'session':_0x292728['id'],'module_name':'Contacts','name_value_list':[{'name':_0xa813('0x3e'),'value':_0x523b05!==_0xa813('0x3f')?_0x523b05:util[_0xa813('0x25')]('Caller\x20-\x20%s',_0x116a4f)},{'name':'phone_home','value':_0x116a4f}]})}})[_0xa813('0x31')](function(_0x3b3e28){logger[_0xa813('0xf')](_0xa813('0x40'));return BPromise['resolve']({'id':_0x3b3e28['id'],'name':_0x3b3e28[_0xa813('0x32')][_0xa813('0x3e')][_0xa813('0x35')],'phone':_0x3b3e28['entry_list']['phone_home'][_0xa813('0x35')]});});}});}function request(_0x30492d){logger[_0xa813('0x41')](_0xa813('0x42'),JSON[_0xa813('0x2a')](_0x30492d));return rp(_[_0xa813('0x43')](def,_0x30492d));}function getTags(_0x1f3e7b,_0x5a65e4){var _0x56c419=[];if(_0x1f3e7b&&_0x1f3e7b[_0xa813('0x1f')]>0x0){_0x56c419=_['map'](_0x1f3e7b,_0x5a65e4);}return _0x56c419;}function getCustomFields(_0x470a20,_0x49e3a3){var _0x3c21f4=[];var _0x795a6b={'custom_fields':[]};if(_0x470a20[_0xa813('0x1f')]>0x0){_[_0xa813('0x44')](_0x470a20,function(_0x1746c7){if(_0x1746c7[_0xa813('0x45')]===_0xa813('0x46')&&_0x1746c7[_0xa813('0x47')]&&!_0x1746c7['customField']){_0x795a6b[_0x1746c7[_0xa813('0x47')][_0xa813('0x48')]()]=_0x1746c7[_0xa813('0x49')][_0xa813('0x28')]();}else if(_0x1746c7[_0xa813('0x45')]===_0xa813('0x46')&&_0x1746c7[_0xa813('0x22')]&&_0x1746c7[_0xa813('0x4a')]){_0x795a6b[_0xa813('0x4b')][_0xa813('0x21')]({'id':_0x1746c7[_0xa813('0x22')],'value':_0x1746c7[_0xa813('0x49')][_0xa813('0x28')]()});}else if(_0x1746c7[_0xa813('0x45')]===_0xa813('0x4c')&&_0x1746c7[_0xa813('0x20')]&&_0x1746c7[_0xa813('0x22')]&&_0x1746c7[_0xa813('0x4a')]){_0x49e3a3[_0x1746c7['variableName']]&&_0x795a6b[_0xa813('0x4b')][_0xa813('0x21')]({'id':_0x1746c7[_0xa813('0x22')],'value':_0x49e3a3[_0x1746c7[_0xa813('0x20')]][_0xa813('0x28')]()});}else if(_0x1746c7['type']===_0xa813('0x4d')&&_0x1746c7[_0xa813('0x4e')]&&_0x1746c7[_0xa813('0x4e')][_0xa813('0x11')]&&_0x1746c7['idField']&&_0x1746c7[_0xa813('0x4a')]){_0x49e3a3[_0x1746c7[_0xa813('0x4e')]['name'][_0xa813('0x48')]()]&&_0x795a6b[_0xa813('0x4b')][_0xa813('0x21')]({'id':_0x1746c7[_0xa813('0x22')],'value':_0x49e3a3[_0x1746c7['Variable']['name'][_0xa813('0x48')]()][_0xa813('0x28')]()});}});}return _0x795a6b;}function getConnection(_0x1b355b){return request({'method':_0xa813('0xd'),'form':{'method':'login','input_type':_0xa813('0x24'),'response_type':_0xa813('0x24'),'rest_data':JSON[_0xa813('0x2a')]({'user_auth':{'user_name':_0x1b355b[_0xa813('0x4f')],'password':_0x1b355b[_0xa813('0x50')],'encryption':_0xa813('0x51')},'application':_0xa813('0x52')})}})[_0xa813('0x31')](function(_0x428dc6){var _0x3760fd=_0x428dc6;if(_0x3760fd['id']){def['sessionID']=_0x3760fd['id'];return BPromise[_0xa813('0x37')](_0x3760fd);}else{throw new Error(util[_0xa813('0x25')](_0xa813('0x53'),_0x1b355b['id']));}});}function setRelationship(_0x3a3f36,_0x4ccc63,_0x3fec5b,_0x5739a6){return request({'form':{'method':'set_relationship','input_type':_0xa813('0x24'),'response_type':_0xa813('0x24'),'rest_data':JSON[_0xa813('0x2a')]({'session':_0x3a3f36['id'],'module_name':'Calls','module_id':_0x3fec5b['id'],'link_field_name':_0x5739a6,'related_ids':[_0x4ccc63['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xa813('0x54')]=function(_0x47ce98,_0x311f33,_0x2c9df8,_0x50bc26,_0x2aeadb,_0x1d0528){var _0x4b30d1,_0x2dc5cd,_0x1d182b,_0x142c24;_0x1d0528[_0xa813('0x55')]=intUtil['stripTrailingSlash'](_0x1d0528[_0xa813('0x55')]);_0x1d0528[_0xa813('0x56')]=intUtil[_0xa813('0x57')](_0x1d0528['serverUrl']);def[_0xa813('0x58')]=util['format'](_0xa813('0x59'),_0x1d0528['remoteUri']);if(_0x2aeadb&&_0x2aeadb[_0xa813('0x5a')]){logger['info']('[QUEUE]',_0xa813('0x5b'));_0x311f33[_0xa813('0x5c')]=util[_0xa813('0x25')](_0xa813('0x5d'),_0x1d0528[_0xa813('0x56')],_0x311f33[_0xa813('0x5e')],md5(_0x311f33[_0xa813('0x5e')]));}else{_0x311f33[_0xa813('0x5c')]='';}return getConnection(_0x1d0528)[_0xa813('0x31')](function(_0x4abcbc){_0x142c24=_0x4abcbc;return getUser(_0x1d0528,_0x50bc26[_0xa813('0x11')],_0x142c24);})['then'](function(_0x4eeb78){_0x4b30d1=_0x4eeb78;logger['info'](_0xa813('0x5f'),_0x4b30d1['id']);return getEndUser(_0x1d0528,_0x311f33[_0xa813('0x60')],_0x311f33[_0xa813('0x61')],_0x142c24);})[_0xa813('0x31')](function(_0x410389){_0x2dc5cd=_0x410389;logger[_0xa813('0xf')](_0xa813('0x62'),_0x2dc5cd['id']);return getTicket(_0x1d0528,_0x4b30d1,_0x2dc5cd,_0x2c9df8,_0x311f33,_0x2c9df8['Fields'],_0x142c24,_0xa813('0x63'));})['then'](function(_0x5165a3){_0x1d182b=_0x5165a3;logger[_0xa813('0xf')](_0xa813('0x64'));logger[_0xa813('0xf')](_0xa813('0x65'),_0x1d182b['id']);return setRelationship(_0x142c24,_0x4b30d1,_0x1d182b,'users');})[_0xa813('0x31')](function(){return setRelationship(_0x142c24,_0x2dc5cd,_0x1d182b,_0xa813('0x66'));})[_0xa813('0x31')](function(){return getServerInfo(_0x142c24);})[_0xa813('0x31')](function(_0x2ffffc){var _0x4d28ab=parseInt(_0x2ffffc['version'][_0xa813('0x67')](0x0));var _0xb44a9f=util[_0xa813('0x25')](_0xa813('0x68'),_0x1d0528[_0xa813('0x55')],_0x1d182b['id']);if(_0x4d28ab>0x6){_0xb44a9f=util[_0xa813('0x25')](_0xa813('0x69'),_0x1d0528['remoteUri'],_0x1d182b['id']);}logger['info']('[QUEUE]',_0xa813('0x6a'));emit(util['format'](_0xa813('0x6b'),_0x50bc26[_0xa813('0x11')]),_0xa813('0x6c'),{'uri':_0xb44a9f});})[_0xa813('0x6d')](function(_0x5059a1){logger[_0xa813('0x6e')](_0xa813('0x6f'),JSON[_0xa813('0x2a')](_0x5059a1));});};exports[_0xa813('0x70')]=function(_0x460dc1,_0x2cb440,_0x1e94f1,_0x33ab0b,_0x4d4316,_0x5a8aae,_0x219351){var _0x4ad523,_0x204939,_0x56241a,_0x4cc6df;_0x5a8aae['remoteUri']=intUtil[_0xa813('0x57')](_0x5a8aae['remoteUri']);_0x5a8aae[_0xa813('0x56')]=intUtil['stripTrailingSlash'](_0x5a8aae['serverUrl']);def[_0xa813('0x58')]=util[_0xa813('0x25')](_0xa813('0x59'),_0x5a8aae[_0xa813('0x55')]);if(_0x219351&&_0x219351[_0xa813('0x71')]&&_0x219351[_0xa813('0x71')]!==_0xa813('0x72')){logger['info'](_0xa813('0x73'),_0xa813('0x5b'));_0x2cb440[_0xa813('0x5c')]=util[_0xa813('0x25')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5a8aae[_0xa813('0x56')],_0x2cb440['uniqueid'],md5(_0x2cb440[_0xa813('0x5e')]));}return getConnection(_0x5a8aae)[_0xa813('0x31')](function(_0x43661d){_0x4cc6df=_0x43661d;return getUser(_0x5a8aae,_0x33ab0b[_0xa813('0x11')],_0x4cc6df);})['then'](function(_0x18a3bd){_0x4ad523=_0x18a3bd;logger[_0xa813('0xf')](_0xa813('0x5f'),_0x4ad523['id']);return getEndUser(_0x5a8aae,_0x2cb440[_0xa813('0x74')],_0x2cb440[_0xa813('0x75')],_0x4cc6df);})['then'](function(_0x234766){_0x204939=_0x234766;logger[_0xa813('0xf')](_0xa813('0x62'),_0x204939['id']);return getTicket(_0x5a8aae,_0x4ad523,_0x204939,_0x1e94f1,_0x2cb440,_0x1e94f1[_0xa813('0x76')],_0x4cc6df,'Outbound');})[_0xa813('0x31')](function(_0x330f7c){_0x56241a=_0x330f7c;logger[_0xa813('0xf')](_0xa813('0x64'));logger[_0xa813('0xf')](_0xa813('0x65'),_0x56241a['id']);return setRelationship(_0x4cc6df,_0x4ad523,_0x56241a,_0xa813('0x77'));})[_0xa813('0x31')](function(){return setRelationship(_0x4cc6df,_0x204939,_0x56241a,'contacts');})[_0xa813('0x31')](function(){return getServerInfo(_0x4cc6df);})['then'](function(_0x1bfb66){var _0x4e63fc=parseInt(_0x1bfb66[_0xa813('0x78')][_0xa813('0x67')](0x0));var _0x4e10af=util[_0xa813('0x25')](_0xa813('0x68'),_0x5a8aae[_0xa813('0x55')],_0x56241a['id']);if(_0x4e63fc>0x6){_0x4e10af=util[_0xa813('0x25')](_0xa813('0x69'),_0x5a8aae[_0xa813('0x55')],_0x56241a['id']);}logger['info'](_0xa813('0x73'),_0xa813('0x6a'));emit(util[_0xa813('0x25')](_0xa813('0x6b'),_0x33ab0b['name']),_0xa813('0x6c'),{'uri':_0x4e10af});})['catch'](function(_0x38519c){logger[_0xa813('0x6e')](_0xa813('0x73'),JSON[_0xa813('0x2a')](_0x38519c));});};exports[_0xa813('0x79')]=function(_0x275a7b,_0x421e39,_0x7e795f,_0x36a235,_0x379e06,_0x1f20ab){var _0x368ca3,_0x5ede5e,_0x5ec762,_0x32ac95;_0x1f20ab[_0xa813('0x55')]=intUtil['stripTrailingSlash'](_0x1f20ab[_0xa813('0x55')]);_0x1f20ab[_0xa813('0x56')]=intUtil[_0xa813('0x57')](_0x1f20ab[_0xa813('0x56')]);def[_0xa813('0x58')]=util['format'](_0xa813('0x59'),_0x1f20ab[_0xa813('0x55')]);if(_0x379e06&&_0x379e06[_0xa813('0x5a')]){logger['info']('['+_0x421e39[_0xa813('0x7a')][_0xa813('0x7b')]()+']','Recording\x20is\x20enabled!');_0x421e39[_0xa813('0x5c')]=util['format'](_0xa813('0x5d'),_0x1f20ab[_0xa813('0x56')],_0x421e39[_0xa813('0x5e')],md5(_0x421e39[_0xa813('0x5e')]));}else{_0x421e39['recordingURL']='';}return getConnection(_0x1f20ab)[_0xa813('0x31')](function(_0x34c0ad){_0x32ac95=_0x34c0ad;if(!_[_0xa813('0x2b')](_0x36a235)){return getUser(_0x1f20ab,_0x36a235['name'],_0x32ac95);}else{return getUser(_0x1f20ab,null,_0x32ac95);}})['then'](function(_0x130c9f){_0x368ca3=_0x130c9f;logger[_0xa813('0xf')](_0xa813('0x5f'),_0x368ca3['id']);return getEndUser(_0x1f20ab,_0x421e39['calleridname'],_0x421e39[_0xa813('0x61')],_0x32ac95);})[_0xa813('0x31')](function(_0x4c1321){_0x5ede5e=_0x4c1321;logger['info'](_0xa813('0x62'),_0x5ede5e['id']);return getTicket(_0x1f20ab,_0x368ca3,_0x5ede5e,_0x7e795f,_0x421e39,_0x7e795f[_0xa813('0x76')],_0x32ac95,_0xa813('0x63'));})[_0xa813('0x31')](function(_0x1e15aa){_0x5ec762=_0x1e15aa;logger[_0xa813('0xf')](_0xa813('0x64'));logger[_0xa813('0xf')](_0xa813('0x65'),_0x5ec762['id']);return setRelationship(_0x32ac95,_0x368ca3,_0x5ec762,_0xa813('0x77'));})[_0xa813('0x31')](function(){return setRelationship(_0x32ac95,_0x5ede5e,_0x5ec762,_0xa813('0x66'));})[_0xa813('0x31')](function(){return getServerInfo(_0x32ac95);})[_0xa813('0x6d')](function(_0x13f10b){logger[_0xa813('0x6e')]('['+_0x421e39['lastevent']['toUpperCase']()+']',JSON['stringify'](_0x13f10b));});}; \ No newline at end of file +var _0xe6e6=['apiKey','toString','base64','get_server_info','isNil','user_name','then','entry_list','find','name_value_list','Agent\x20found!','resolve','value','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','get_entry_list','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','set_entry','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','map','nameField','toLowerCase','type','string','customField','custom_fields','content','variable','customVariable','Variable','login','password','PLAIN','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','stripTrailingSlash','uri','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','users','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','user:%s','trigger:browser:url','%s/service/v4_1/rest.php','recordingFormat','none','destcalleridname','destcalleridnum','Outbound','The\x20Ticket\x20ID\x20is:','[OUTBOUND]','error','unmanaged','monitor_format','lastevent','Inbound','catch','toUpperCase','lodash','request-promise','bluebird','md5','util','./util','../../../../config/environment','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','emit','info','name','getString','Subjects','created_by','description','Descriptions','date_start','toISOString','replace','duration_hours','duration_minutes','parent_id','Contacts','length','forEach','variableName','push','idField','JSON','stringify','Calls','format','Basic\x20%s'];(function(_0x5a95fa,_0x4a2fc9){var _0x1a61b8=function(_0x59f119){while(--_0x59f119){_0x5a95fa['push'](_0x5a95fa['shift']());}};_0x1a61b8(++_0x4a2fc9);}(_0xe6e6,0x1ba));var _0x6e6e=function(_0x3e05b5,_0x346bf2){_0x3e05b5=_0x3e05b5-0x0;var _0x3018ad=_0xe6e6[_0x3e05b5];return _0x3018ad;};'use strict';var _=require(_0x6e6e('0x0'));var rp=require(_0x6e6e('0x1'));var BPromise=require(_0x6e6e('0x2'));var md5=require(_0x6e6e('0x3'));var util=require(_0x6e6e('0x4'));var Redis=require('ioredis');var intUtil=require(_0x6e6e('0x5'));var config=require(_0x6e6e('0x6'));var logger=require('../../../../config/logger')(_0x6e6e('0x7'));config[_0x6e6e('0x8')]=_[_0x6e6e('0x9')](config[_0x6e6e('0x8')],{'host':_0x6e6e('0xa'),'port':0x18eb});var io=require(_0x6e6e('0xb'))(new Redis(config['redis']));var def={'method':_0x6e6e('0xc'),'json':!![]};function emit(_0x473f04,_0xcd2914,_0x3ac0a2){io['to'](_0x473f04)[_0x6e6e('0xd')](_0xcd2914,_0x3ac0a2);}function getTicket(_0x31c110,_0x3992a8,_0x3be43c,_0x3e62a1,_0x2b4429,_0x2c76b6,_0x12338a,_0x276459){logger[_0x6e6e('0xe')]('Creating\x20new\x20ticket...');var _0x5d6927=new Date();var _0x1addf1=[{'name':_0x6e6e('0xf'),'value':intUtil[_0x6e6e('0x10')](_0x3e62a1[_0x6e6e('0x11')],_0x2b4429,'\x20')},{'name':'assigned_user_id','value':_0x3992a8['id']},{'name':_0x6e6e('0x12'),'value':_0x3992a8['id']},{'name':_0x6e6e('0x13'),'value':intUtil['getString'](_0x3e62a1[_0x6e6e('0x14')],_0x2b4429,'\x0a')},{'name':_0x6e6e('0x15'),'value':_0x5d6927[_0x6e6e('0x16')]()['slice'](0x0,0x13)[_0x6e6e('0x17')]('T','\x20')},{'name':_0x6e6e('0x18'),'value':'0'},{'name':_0x6e6e('0x19'),'value':'15'},{'name':_0x6e6e('0x1a'),'value':_0x3be43c['id']},{'name':'parent_type','value':_0x6e6e('0x1b')},{'name':'parent_name','value':_0x3be43c[_0x6e6e('0xf')]},{'name':'direction','value':_0x276459}];if(_0x2c76b6[_0x6e6e('0x1c')]){_[_0x6e6e('0x1d')](_0x2c76b6,function(_0x2a00c8){if(_0x2b4429[_0x2a00c8[_0x6e6e('0x1e')]]){_0x1addf1[_0x6e6e('0x1f')]({'name':_0x2a00c8[_0x6e6e('0x20')],'value':_0x2b4429[_0x2a00c8[_0x6e6e('0x1e')]]});}});}return request({'form':{'method':'set_entry','input_type':_0x6e6e('0x21'),'response_type':_0x6e6e('0x21'),'rest_data':JSON[_0x6e6e('0x22')]({'session':_0x12338a['id'],'module_name':_0x6e6e('0x23'),'name_value_list':_0x1addf1})}});}function getAuth(_0x34f6af){return util[_0x6e6e('0x24')](_0x6e6e('0x25'),new Buffer(_0x34f6af[_0x6e6e('0x26')]+':X')[_0x6e6e('0x27')](_0x6e6e('0x28')));}function getServerInfo(_0x2f2074){return request({'form':{'method':_0x6e6e('0x29'),'input_type':_0x6e6e('0x21'),'response_type':_0x6e6e('0x21'),'rest_data':JSON['stringify']({'session':_0x2f2074['id']})}});}function getUser(_0xe750ab,_0x2cdc8a,_0x5f4734){if(!_[_0x6e6e('0x2a')](_0x2cdc8a)){logger[_0x6e6e('0xe')]('Getting\x20agent\x20with\x20name',_0x2cdc8a);return request({'form':{'method':'get_entry_list','input_type':_0x6e6e('0x21'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x5f4734['id'],'module_name':'Employees','query':util[_0x6e6e('0x24')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x2cdc8a),'order_by':'','offset':'0','select_fields':['id',_0x6e6e('0xf'),_0x6e6e('0x2b')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x6e6e('0x2c')](function(_0x39c3e4){if(_0x39c3e4[_0x6e6e('0x2d')][_0x6e6e('0x1c')]){var _0x190c3e=_[_0x6e6e('0x2e')](_0x39c3e4['entry_list'],function(_0x761c64){return _0x761c64[_0x6e6e('0x2f')][_0x6e6e('0x2b')]['value']===_0x2cdc8a;});if(_0x190c3e){logger[_0x6e6e('0xe')](_0x6e6e('0x30'));return BPromise[_0x6e6e('0x31')]({'id':_0x190c3e[_0x6e6e('0x2f')]['id'][_0x6e6e('0x32')],'name':_0x190c3e[_0x6e6e('0x2f')][_0x6e6e('0xf')]['value']});}}logger[_0x6e6e('0xe')](_0x6e6e('0x33'));return BPromise[_0x6e6e('0x31')]({'id':_0x5f4734[_0x6e6e('0x2f')][_0x6e6e('0x34')][_0x6e6e('0x32')],'name':_0x5f4734[_0x6e6e('0x2f')][_0x6e6e('0x2b')]['value']});});}else{logger[_0x6e6e('0xe')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0x6e6e('0x31')]({'id':_0x5f4734[_0x6e6e('0x2f')][_0x6e6e('0x34')][_0x6e6e('0x32')],'name':_0x5f4734[_0x6e6e('0x2f')][_0x6e6e('0x2b')][_0x6e6e('0x32')]});}}function getEndUser(_0x1d9f6d,_0x359d20,_0x527743,_0x2b489a){logger[_0x6e6e('0xe')]('Searching\x20enduser\x20with\x20phone',_0x527743);return request({'form':{'method':_0x6e6e('0x35'),'input_type':_0x6e6e('0x21'),'response_type':_0x6e6e('0x21'),'rest_data':JSON['stringify']({'session':_0x2b489a['id'],'module_name':'Contacts','query':util[_0x6e6e('0x24')](_0x6e6e('0x36'),_0x527743),'order_by':'','offset':'0','select_fields':['id',_0x6e6e('0xf'),_0x6e6e('0x37')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x6e6e('0x2c')](function(_0x1a1bcc){if(_0x1a1bcc[_0x6e6e('0x2d')]['length']){var _0xa80463=_['find'](_0x1a1bcc[_0x6e6e('0x2d')],function(_0x1aa232){return _0x1aa232[_0x6e6e('0x2f')][_0x6e6e('0x37')][_0x6e6e('0x32')]===_0x527743;});if(_0xa80463){logger[_0x6e6e('0xe')]('Enduser\x20found!');return BPromise[_0x6e6e('0x31')]({'id':_0xa80463[_0x6e6e('0x2f')]['id'][_0x6e6e('0x32')],'name':_0xa80463[_0x6e6e('0x2f')][_0x6e6e('0xf')][_0x6e6e('0x32')],'phone':_0xa80463[_0x6e6e('0x2f')][_0x6e6e('0x37')]['value']});}}else{logger[_0x6e6e('0xe')](_0x6e6e('0x38'));return request({'form':{'method':_0x6e6e('0x39'),'input_type':'JSON','response_type':_0x6e6e('0x21'),'rest_data':JSON[_0x6e6e('0x22')]({'session':_0x2b489a['id'],'module_name':_0x6e6e('0x1b'),'name_value_list':[{'name':_0x6e6e('0x3a'),'value':_0x359d20!==_0x6e6e('0x3b')?_0x359d20:util[_0x6e6e('0x24')](_0x6e6e('0x3c'),_0x527743)},{'name':_0x6e6e('0x37'),'value':_0x527743}]})}})[_0x6e6e('0x2c')](function(_0x545eb1){logger['info'](_0x6e6e('0x3d'));return BPromise[_0x6e6e('0x31')]({'id':_0x545eb1['id'],'name':_0x545eb1[_0x6e6e('0x2d')][_0x6e6e('0x3a')][_0x6e6e('0x32')],'phone':_0x545eb1[_0x6e6e('0x2d')][_0x6e6e('0x37')][_0x6e6e('0x32')]});});}});}function request(_0x4346d6){logger[_0x6e6e('0x3e')](_0x6e6e('0x3f'),JSON[_0x6e6e('0x22')](_0x4346d6));return rp(_['merge'](def,_0x4346d6));}function getTags(_0x69521f,_0x4de35c){var _0x4ca429=[];if(_0x69521f&&_0x69521f[_0x6e6e('0x1c')]>0x0){_0x4ca429=_[_0x6e6e('0x40')](_0x69521f,_0x4de35c);}return _0x4ca429;}function getCustomFields(_0x346426,_0x239db0){var _0x18fffe=[];var _0x48c104={'custom_fields':[]};if(_0x346426[_0x6e6e('0x1c')]>0x0){_['forEach'](_0x346426,function(_0x17ebc1){if(_0x17ebc1['type']==='string'&&_0x17ebc1[_0x6e6e('0x41')]&&!_0x17ebc1['customField']){_0x48c104[_0x17ebc1[_0x6e6e('0x41')][_0x6e6e('0x42')]()]=_0x17ebc1['content'][_0x6e6e('0x27')]();}else if(_0x17ebc1[_0x6e6e('0x43')]===_0x6e6e('0x44')&&_0x17ebc1[_0x6e6e('0x20')]&&_0x17ebc1[_0x6e6e('0x45')]){_0x48c104[_0x6e6e('0x46')][_0x6e6e('0x1f')]({'id':_0x17ebc1[_0x6e6e('0x20')],'value':_0x17ebc1[_0x6e6e('0x47')][_0x6e6e('0x27')]()});}else if(_0x17ebc1[_0x6e6e('0x43')]===_0x6e6e('0x48')&&_0x17ebc1[_0x6e6e('0x1e')]&&_0x17ebc1[_0x6e6e('0x20')]&&_0x17ebc1['customField']){_0x239db0[_0x17ebc1[_0x6e6e('0x1e')]]&&_0x48c104[_0x6e6e('0x46')][_0x6e6e('0x1f')]({'id':_0x17ebc1[_0x6e6e('0x20')],'value':_0x239db0[_0x17ebc1[_0x6e6e('0x1e')]][_0x6e6e('0x27')]()});}else if(_0x17ebc1[_0x6e6e('0x43')]===_0x6e6e('0x49')&&_0x17ebc1['Variable']&&_0x17ebc1[_0x6e6e('0x4a')][_0x6e6e('0xf')]&&_0x17ebc1[_0x6e6e('0x20')]&&_0x17ebc1[_0x6e6e('0x45')]){_0x239db0[_0x17ebc1['Variable'][_0x6e6e('0xf')][_0x6e6e('0x42')]()]&&_0x48c104[_0x6e6e('0x46')][_0x6e6e('0x1f')]({'id':_0x17ebc1[_0x6e6e('0x20')],'value':_0x239db0[_0x17ebc1[_0x6e6e('0x4a')][_0x6e6e('0xf')][_0x6e6e('0x42')]()]['toString']()});}});}return _0x48c104;}function getConnection(_0x2236b9){return request({'method':_0x6e6e('0xc'),'form':{'method':_0x6e6e('0x4b'),'input_type':_0x6e6e('0x21'),'response_type':_0x6e6e('0x21'),'rest_data':JSON[_0x6e6e('0x22')]({'user_auth':{'user_name':_0x2236b9['username'],'password':_0x2236b9[_0x6e6e('0x4c')],'encryption':_0x6e6e('0x4d')},'application':'xCALLY\x20Motion\x20integration'})}})[_0x6e6e('0x2c')](function(_0x4d06fa){var _0x559199=_0x4d06fa;if(_0x559199['id']){def[_0x6e6e('0x4e')]=_0x559199['id'];return BPromise[_0x6e6e('0x31')](_0x559199);}else{throw new Error(util['format'](_0x6e6e('0x4f'),_0x2236b9['id']));}});}function setRelationship(_0x23fdc9,_0xbcc6ea,_0x1aef83,_0x210d1a){return request({'form':{'method':_0x6e6e('0x50'),'input_type':'JSON','response_type':_0x6e6e('0x21'),'rest_data':JSON['stringify']({'session':_0x23fdc9['id'],'module_name':'Calls','module_id':_0x1aef83['id'],'link_field_name':_0x210d1a,'related_ids':[_0xbcc6ea['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x6e6e('0x51')]=function(_0x11e2cb,_0x2fbecc,_0x9d7a67,_0x835721,_0x1eda62,_0x55d986){var _0x128f63,_0x4979f7,_0x1e60c3,_0x38d63a;_0x55d986[_0x6e6e('0x52')]=intUtil[_0x6e6e('0x53')](_0x55d986['remoteUri']);_0x55d986['serverUrl']=intUtil['stripTrailingSlash'](_0x55d986['serverUrl']);def[_0x6e6e('0x54')]=util[_0x6e6e('0x24')]('%s/service/v4_1/rest.php',_0x55d986['remoteUri']);if(_0x1eda62&&_0x1eda62['monitor_format']){logger[_0x6e6e('0xe')](_0x6e6e('0x55'),_0x6e6e('0x56'));_0x2fbecc[_0x6e6e('0x57')]=util[_0x6e6e('0x24')](_0x6e6e('0x58'),_0x55d986[_0x6e6e('0x59')],_0x2fbecc[_0x6e6e('0x5a')],md5(_0x2fbecc['uniqueid']));}else{_0x2fbecc[_0x6e6e('0x57')]='';}return getConnection(_0x55d986)[_0x6e6e('0x2c')](function(_0x5c713d){_0x38d63a=_0x5c713d;return getUser(_0x55d986,_0x835721[_0x6e6e('0xf')],_0x38d63a);})[_0x6e6e('0x2c')](function(_0x4bc906){_0x128f63=_0x4bc906;logger[_0x6e6e('0xe')](_0x6e6e('0x5b'),_0x128f63['id']);return getEndUser(_0x55d986,_0x2fbecc[_0x6e6e('0x5c')],_0x2fbecc[_0x6e6e('0x5d')],_0x38d63a);})['then'](function(_0x5f38bc){_0x4979f7=_0x5f38bc;logger[_0x6e6e('0xe')](_0x6e6e('0x5e'),_0x4979f7['id']);return getTicket(_0x55d986,_0x128f63,_0x4979f7,_0x9d7a67,_0x2fbecc,_0x9d7a67[_0x6e6e('0x5f')],_0x38d63a,'Inbound');})[_0x6e6e('0x2c')](function(_0x1b34ec){_0x1e60c3=_0x1b34ec;logger['info'](_0x6e6e('0x60'));logger[_0x6e6e('0xe')]('The\x20Ticket\x20ID\x20is:',_0x1e60c3['id']);return setRelationship(_0x38d63a,_0x128f63,_0x1e60c3,_0x6e6e('0x61'));})[_0x6e6e('0x2c')](function(){return setRelationship(_0x38d63a,_0x4979f7,_0x1e60c3,_0x6e6e('0x62'));})[_0x6e6e('0x2c')](function(){return getServerInfo(_0x38d63a);})[_0x6e6e('0x2c')](function(_0x58fc93){var _0x83418c=parseInt(_0x58fc93[_0x6e6e('0x63')][_0x6e6e('0x64')](0x0));var _0x42b357=util[_0x6e6e('0x24')](_0x6e6e('0x65'),_0x55d986[_0x6e6e('0x52')],_0x1e60c3['id']);if(_0x83418c>0x6){_0x42b357=util[_0x6e6e('0x24')](_0x6e6e('0x66'),_0x55d986[_0x6e6e('0x52')],_0x1e60c3['id']);}logger['info'](_0x6e6e('0x55'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x6e6e('0x24')](_0x6e6e('0x67'),_0x835721[_0x6e6e('0xf')]),_0x6e6e('0x68'),{'uri':_0x42b357});})['catch'](function(_0x5137a7){logger['error'](_0x6e6e('0x55'),JSON[_0x6e6e('0x22')](_0x5137a7));});};exports['outbound']=function(_0x5f5595,_0x3bdb79,_0x40b4ce,_0x187504,_0x2938d0,_0x46941b,_0x45fb9d){var _0x1fe4f9,_0x40bdc1,_0x431e19,_0x2f10f3;_0x46941b[_0x6e6e('0x52')]=intUtil[_0x6e6e('0x53')](_0x46941b[_0x6e6e('0x52')]);_0x46941b[_0x6e6e('0x59')]=intUtil[_0x6e6e('0x53')](_0x46941b[_0x6e6e('0x59')]);def['uri']=util['format'](_0x6e6e('0x69'),_0x46941b[_0x6e6e('0x52')]);if(_0x45fb9d&&_0x45fb9d[_0x6e6e('0x6a')]&&_0x45fb9d['recordingFormat']!==_0x6e6e('0x6b')){logger[_0x6e6e('0xe')]('[OUTBOUND]',_0x6e6e('0x56'));_0x3bdb79[_0x6e6e('0x57')]=util[_0x6e6e('0x24')](_0x6e6e('0x58'),_0x46941b[_0x6e6e('0x59')],_0x3bdb79[_0x6e6e('0x5a')],md5(_0x3bdb79[_0x6e6e('0x5a')]));}return getConnection(_0x46941b)[_0x6e6e('0x2c')](function(_0x1d3776){_0x2f10f3=_0x1d3776;return getUser(_0x46941b,_0x187504[_0x6e6e('0xf')],_0x2f10f3);})[_0x6e6e('0x2c')](function(_0x335d5e){_0x1fe4f9=_0x335d5e;logger[_0x6e6e('0xe')]('The\x20User\x20ID\x20is:',_0x1fe4f9['id']);return getEndUser(_0x46941b,_0x3bdb79[_0x6e6e('0x6c')],_0x3bdb79[_0x6e6e('0x6d')],_0x2f10f3);})[_0x6e6e('0x2c')](function(_0x55f2f5){_0x40bdc1=_0x55f2f5;logger[_0x6e6e('0xe')]('The\x20Enduser\x20ID\x20is:',_0x40bdc1['id']);return getTicket(_0x46941b,_0x1fe4f9,_0x40bdc1,_0x40b4ce,_0x3bdb79,_0x40b4ce[_0x6e6e('0x5f')],_0x2f10f3,_0x6e6e('0x6e'));})[_0x6e6e('0x2c')](function(_0x10b16e){_0x431e19=_0x10b16e;logger[_0x6e6e('0xe')](_0x6e6e('0x60'));logger[_0x6e6e('0xe')](_0x6e6e('0x6f'),_0x431e19['id']);return setRelationship(_0x2f10f3,_0x1fe4f9,_0x431e19,_0x6e6e('0x61'));})['then'](function(){return setRelationship(_0x2f10f3,_0x40bdc1,_0x431e19,_0x6e6e('0x62'));})[_0x6e6e('0x2c')](function(){return getServerInfo(_0x2f10f3);})[_0x6e6e('0x2c')](function(_0x229dc6){var _0x4f741c=parseInt(_0x229dc6[_0x6e6e('0x63')][_0x6e6e('0x64')](0x0));var _0x287dd8=util[_0x6e6e('0x24')](_0x6e6e('0x65'),_0x46941b['remoteUri'],_0x431e19['id']);if(_0x4f741c>0x6){_0x287dd8=util['format'](_0x6e6e('0x66'),_0x46941b[_0x6e6e('0x52')],_0x431e19['id']);}logger[_0x6e6e('0xe')](_0x6e6e('0x70'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x6e6e('0x24')]('user:%s',_0x187504['name']),'trigger:browser:url',{'uri':_0x287dd8});})['catch'](function(_0x1156b4){logger[_0x6e6e('0x71')](_0x6e6e('0x70'),JSON[_0x6e6e('0x22')](_0x1156b4));});};exports[_0x6e6e('0x72')]=function(_0x345599,_0x3bfaf6,_0x1b163f,_0x18c4b5,_0x283235,_0x43cdef){var _0x513c0c,_0x396e25,_0x290bbe,_0x2a44a6;_0x43cdef['remoteUri']=intUtil[_0x6e6e('0x53')](_0x43cdef[_0x6e6e('0x52')]);_0x43cdef[_0x6e6e('0x59')]=intUtil[_0x6e6e('0x53')](_0x43cdef[_0x6e6e('0x59')]);def[_0x6e6e('0x54')]=util[_0x6e6e('0x24')](_0x6e6e('0x69'),_0x43cdef[_0x6e6e('0x52')]);if(_0x283235&&_0x283235[_0x6e6e('0x73')]){logger[_0x6e6e('0xe')]('['+_0x3bfaf6[_0x6e6e('0x74')]['toUpperCase']()+']',_0x6e6e('0x56'));_0x3bfaf6['recordingURL']=util[_0x6e6e('0x24')](_0x6e6e('0x58'),_0x43cdef[_0x6e6e('0x59')],_0x3bfaf6['uniqueid'],md5(_0x3bfaf6[_0x6e6e('0x5a')]));}else{_0x3bfaf6['recordingURL']='';}return getConnection(_0x43cdef)['then'](function(_0xa8a162){_0x2a44a6=_0xa8a162;if(!_[_0x6e6e('0x2a')](_0x18c4b5)){return getUser(_0x43cdef,_0x18c4b5['name'],_0x2a44a6);}else{return getUser(_0x43cdef,null,_0x2a44a6);}})[_0x6e6e('0x2c')](function(_0x446668){_0x513c0c=_0x446668;logger[_0x6e6e('0xe')](_0x6e6e('0x5b'),_0x513c0c['id']);return getEndUser(_0x43cdef,_0x3bfaf6[_0x6e6e('0x5c')],_0x3bfaf6['calleridnum'],_0x2a44a6);})['then'](function(_0x260b67){_0x396e25=_0x260b67;logger[_0x6e6e('0xe')](_0x6e6e('0x5e'),_0x396e25['id']);return getTicket(_0x43cdef,_0x513c0c,_0x396e25,_0x1b163f,_0x3bfaf6,_0x1b163f[_0x6e6e('0x5f')],_0x2a44a6,_0x6e6e('0x75'));})['then'](function(_0x2b6fba){_0x290bbe=_0x2b6fba;logger[_0x6e6e('0xe')]('Ticket\x20created!');logger[_0x6e6e('0xe')](_0x6e6e('0x6f'),_0x290bbe['id']);return setRelationship(_0x2a44a6,_0x513c0c,_0x290bbe,'users');})[_0x6e6e('0x2c')](function(){return setRelationship(_0x2a44a6,_0x396e25,_0x290bbe,_0x6e6e('0x62'));})[_0x6e6e('0x2c')](function(){return getServerInfo(_0x2a44a6);})[_0x6e6e('0x76')](function(_0x4527c7){logger['error']('['+_0x3bfaf6[_0x6e6e('0x74')][_0x6e6e('0x77')]()+']',JSON['stringify'](_0x4527c7));});}; \ 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 95a1365..8d6c6f5 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 _0xf16f=['variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue','keyType','string','key','format','%s:\x20%s','keyContent','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','test','util','getString','type','push'];(function(_0x33298b,_0x42f55f){var _0x49bc13=function(_0x3cd0dc){while(--_0x3cd0dc){_0x33298b['push'](_0x33298b['shift']());}};_0x49bc13(++_0x42f55f);}(_0xf16f,0x8c));var _0xff16=function(_0x1fdc08,_0xce2053){_0x1fdc08=_0x1fdc08-0x0;var _0x23974a=_0xf16f[_0x1fdc08];return _0x23974a;};'use strict';var _=require('lodash');var util=require(_0xff16('0x0'));exports[_0xff16('0x1')]=function(_0x1b0471,_0x1f3c6a,_0x1d4b0c){var _0x48ee70=[];if(_0x1b0471['length']>0x0){var _0x135345=_['sortBy'](_0x1b0471,['id']);for(var _0x107893=0x0;_0x107893<_0x135345['length'];_0x107893++){var _0x2a28a9=_0x135345[_0x107893];if(_0x2a28a9[_0xff16('0x2')]==='string'){_0x48ee70[_0xff16('0x3')](_0x2a28a9['content']);}else if(_0x2a28a9['type']===_0xff16('0x4')&&_0x2a28a9[_0xff16('0x5')]){_0x1f3c6a[_0x2a28a9['variableName']]&&_0x48ee70[_0xff16('0x3')](_0x1f3c6a[_0x2a28a9[_0xff16('0x5')]][_0xff16('0x6')]());}else if(_0x2a28a9[_0xff16('0x2')]===_0xff16('0x7')&&_0x2a28a9[_0xff16('0x8')]&&_0x2a28a9[_0xff16('0x8')][_0xff16('0x9')]){_0x1f3c6a[_0x2a28a9[_0xff16('0x8')][_0xff16('0x9')][_0xff16('0xa')]()]&&_0x48ee70[_0xff16('0x3')](_0x1f3c6a[_0x2a28a9[_0xff16('0x8')][_0xff16('0x9')][_0xff16('0xa')]()][_0xff16('0x6')]());}else if(_0x2a28a9[_0xff16('0x2')]===_0xff16('0xb')){if(_0x2a28a9[_0xff16('0xc')]===_0xff16('0xd')&&_0x2a28a9[_0xff16('0xe')]){_0x48ee70[_0xff16('0x3')](util[_0xff16('0xf')](_0xff16('0x10'),_0x2a28a9[_0xff16('0xe')],_0x2a28a9[_0xff16('0x11')]));}else if(_0x2a28a9['keyType']===_0xff16('0x4')&&_0x2a28a9[_0xff16('0x5')]&&_0x2a28a9['key']){_0x1f3c6a[_0x2a28a9[_0xff16('0x5')]]&&_0x48ee70[_0xff16('0x3')](util[_0xff16('0xf')]('%s:\x20%s',_0x2a28a9['key'],_0x1f3c6a[_0x2a28a9[_0xff16('0x5')]]));}else if(_0x2a28a9['keyType']==='customVariable'&&_0x2a28a9['Variable']&&_0x2a28a9[_0xff16('0x8')]['name']&&_0x2a28a9['key']){_0x1f3c6a[_0x2a28a9['Variable'][_0xff16('0x9')][_0xff16('0xa')]()]&&_0x48ee70['push'](util[_0xff16('0xf')](_0xff16('0x10'),_0x2a28a9[_0xff16('0xe')],_0x1f3c6a[_0x2a28a9[_0xff16('0x8')][_0xff16('0x9')][_0xff16('0xa')]()]));}}}}return _0x48ee70['join'](_0x1d4b0c);};exports[_0xff16('0x12')]=function(_0x52b90d){var _0x42a282=_0x52b90d[_0xff16('0x13')](-0x1);if(_0x42a282==='/'){_0x52b90d=_0x52b90d[_0xff16('0x14')](0x0,_0x52b90d[_0xff16('0x15')](_0x42a282));}return _0x52b90d;};exports[_0xff16('0x16')]=function(_0x5e72a9){if(!_['isNil'](_0x5e72a9)&&_0x5e72a9!==''){var _0x2cafc3=/^(([^<>()\[\]\\.,;:\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 _0x2cafc3[_0xff16('0x17')](String(_0x5e72a9)[_0xff16('0xa')]());}else{return![];}}; \ No newline at end of file +var _0x43dd=['util','getString','length','sortBy','type','string','push','content','variableName','customVariable','Variable','name','toLowerCase','toString','keyValue','keyType','format','%s:\x20%s','key','variable','join','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','isNil','test'];(function(_0x164594,_0x468af9){var _0x5cd5bd=function(_0x3fcaf1){while(--_0x3fcaf1){_0x164594['push'](_0x164594['shift']());}};_0x5cd5bd(++_0x468af9);}(_0x43dd,0xc4));var _0xd43d=function(_0xf78973,_0x406ea4){_0xf78973=_0xf78973-0x0;var _0x1ec0cb=_0x43dd[_0xf78973];return _0x1ec0cb;};'use strict';var _=require('lodash');var util=require(_0xd43d('0x0'));exports[_0xd43d('0x1')]=function(_0x4988b4,_0x4dcc7a,_0x3e2792){var _0x2b3974=[];if(_0x4988b4[_0xd43d('0x2')]>0x0){var _0x57d4f0=_[_0xd43d('0x3')](_0x4988b4,['id']);for(var _0x3534f5=0x0;_0x3534f5<_0x57d4f0['length'];_0x3534f5++){var _0x25e4ab=_0x57d4f0[_0x3534f5];if(_0x25e4ab[_0xd43d('0x4')]===_0xd43d('0x5')){_0x2b3974[_0xd43d('0x6')](_0x25e4ab[_0xd43d('0x7')]);}else if(_0x25e4ab[_0xd43d('0x4')]==='variable'&&_0x25e4ab[_0xd43d('0x8')]){_0x4dcc7a[_0x25e4ab['variableName']]&&_0x2b3974[_0xd43d('0x6')](_0x4dcc7a[_0x25e4ab['variableName']]['toString']());}else if(_0x25e4ab[_0xd43d('0x4')]===_0xd43d('0x9')&&_0x25e4ab[_0xd43d('0xa')]&&_0x25e4ab['Variable'][_0xd43d('0xb')]){_0x4dcc7a[_0x25e4ab[_0xd43d('0xa')][_0xd43d('0xb')]['toLowerCase']()]&&_0x2b3974[_0xd43d('0x6')](_0x4dcc7a[_0x25e4ab['Variable'][_0xd43d('0xb')][_0xd43d('0xc')]()][_0xd43d('0xd')]());}else if(_0x25e4ab[_0xd43d('0x4')]===_0xd43d('0xe')){if(_0x25e4ab[_0xd43d('0xf')]===_0xd43d('0x5')&&_0x25e4ab['key']){_0x2b3974['push'](util[_0xd43d('0x10')](_0xd43d('0x11'),_0x25e4ab[_0xd43d('0x12')],_0x25e4ab['keyContent']));}else if(_0x25e4ab[_0xd43d('0xf')]===_0xd43d('0x13')&&_0x25e4ab[_0xd43d('0x8')]&&_0x25e4ab[_0xd43d('0x12')]){_0x4dcc7a[_0x25e4ab['variableName']]&&_0x2b3974[_0xd43d('0x6')](util['format']('%s:\x20%s',_0x25e4ab['key'],_0x4dcc7a[_0x25e4ab[_0xd43d('0x8')]]));}else if(_0x25e4ab[_0xd43d('0xf')]===_0xd43d('0x9')&&_0x25e4ab[_0xd43d('0xa')]&&_0x25e4ab[_0xd43d('0xa')][_0xd43d('0xb')]&&_0x25e4ab[_0xd43d('0x12')]){_0x4dcc7a[_0x25e4ab[_0xd43d('0xa')][_0xd43d('0xb')]['toLowerCase']()]&&_0x2b3974[_0xd43d('0x6')](util[_0xd43d('0x10')](_0xd43d('0x11'),_0x25e4ab[_0xd43d('0x12')],_0x4dcc7a[_0x25e4ab[_0xd43d('0xa')][_0xd43d('0xb')][_0xd43d('0xc')]()]));}}}}return _0x2b3974[_0xd43d('0x14')](_0x3e2792);};exports[_0xd43d('0x15')]=function(_0x27f454){var _0x26ea47=_0x27f454[_0xd43d('0x16')](-0x1);if(_0x26ea47==='/'){_0x27f454=_0x27f454[_0xd43d('0x17')](0x0,_0x27f454[_0xd43d('0x18')](_0x26ea47));}return _0x27f454;};exports[_0xd43d('0x19')]=function(_0x4d0770){if(!_[_0xd43d('0x1a')](_0x4d0770)&&_0x4d0770!==''){var _0x5f5f48=/^(([^<>()\[\]\\.,;:\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 _0x5f5f48[_0xd43d('0x1b')](String(_0x4d0770)[_0xd43d('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 83d9383..7c7f2ec 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 _0xe706=['result','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','getUser','username','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','phone','catch','accessKey','getchallenge','token','Account\x20%d\x20is\x20not\x20valid','getConnection','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','emit','length','forEach','includes','string','idField','content','toString','type','variable','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','Subjects','getString','Descriptions','POST','format','%s/webservice.php','create','stringify','then','success','resolve','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','Getting\x20agent\x20with\x20email','GET','query','sessionName','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;'];(function(_0x4948d6,_0x5f43e9){var _0x467067=function(_0x27e611){while(--_0x27e611){_0x4948d6['push'](_0x4948d6['shift']());}};_0x467067(++_0x5f43e9);}(_0xe706,0xa3));var _0x6e70=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xe706[_0x56482c];return _0x5aae7a;};'use strict';var _=require(_0x6e70('0x0'));var rp=require(_0x6e70('0x1'));var BPromise=require(_0x6e70('0x2'));var md5=require('md5');var util=require(_0x6e70('0x3'));var Redis=require(_0x6e70('0x4'));var intUtil=require(_0x6e70('0x5'));var config=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));config[_0x6e70('0x9')]=_[_0x6e70('0xa')](config[_0x6e70('0x9')],{'host':_0x6e70('0xb'),'port':0x18eb});var io=require(_0x6e70('0xc'))(new Redis(config[_0x6e70('0x9')]));function emit(_0x45a2d4,_0x188ed3,_0x3c4843){io['to'](_0x45a2d4)[_0x6e70('0xd')](_0x188ed3,_0x3c4843);}function getCustomFields(_0x954545,_0x25e61c){var _0x100eb7={};if(_0x954545[_0x6e70('0xe')]>0x0){_[_0x6e70('0xf')](_0x954545,function(_0x3f474a){if(_[_0x6e70('0x10')]([_0x6e70('0x11'),'picklist'],_0x3f474a['type'])&&_0x3f474a[_0x6e70('0x12')]){_0x100eb7[_0x3f474a[_0x6e70('0x12')]]=_0x3f474a[_0x6e70('0x13')][_0x6e70('0x14')]();}else if(_0x3f474a[_0x6e70('0x15')]===_0x6e70('0x16')&&_0x3f474a[_0x6e70('0x17')]&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['variableName']]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['variableName']][_0x6e70('0x14')]();}else if(_0x3f474a['type']==='customVariable'&&_0x3f474a[_0x6e70('0x18')]&&_0x3f474a[_0x6e70('0x18')]['name']&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')][_0x6e70('0x1a')]()]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')]['toLowerCase']()][_0x6e70('0x14')]();}});}return _0x100eb7;}function createTicket(_0x173afe,_0x53acdc,_0x497d61,_0xc238ba,_0x208e21,_0x2368eb,_0x3a9978){logger[_0x6e70('0x1b')](_0x6e70('0x1c'));var _0x1b2453=_[_0x6e70('0x1d')]({'parent_id':'','assigned_user_id':_0x53acdc['id'],'ticketpriorities':_0x6e70('0x1e'),'ticketstatus':_0x6e70('0x1f'),'ticket_title':intUtil['getString'](_0xc238ba[_0x6e70('0x20')],_0x208e21,'\x20'),'description':intUtil[_0x6e70('0x21')](_0xc238ba[_0x6e70('0x22')],_0x208e21,'\x0a'),'contact_id':_0x497d61['id']},getCustomFields(_0x2368eb,_0x208e21));var _0x502b2d={'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x173afe['remoteUri']),'form':{'operation':_0x6e70('0x26'),'username':_0x173afe['username'],'sessionName':_0x3a9978['sessionName'],'elementType':'HelpDesk','element':JSON[_0x6e70('0x27')](_0x1b2453)},'json':!![]};return request(_0x502b2d)[_0x6e70('0x28')](function(_0x51d292){if(_0x51d292[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')]({'id':_0x51d292['result']['id']});}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x2b'),JSON[_0x6e70('0x27')](_0x51d292['error'])));}})['catch'](function(_0x2c4d37){var _0x3af17f=_0x2c4d37[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'createTicket',_0x3af17f,JSON[_0x6e70('0x27')](_0x2c4d37));});}function getUser(_0x406f29,_0xecf336,_0x2864a0){if(intUtil[_0x6e70('0x2f')](_0xecf336)){logger[_0x6e70('0x1b')](_0x6e70('0x30'),_0xecf336);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x406f29['remoteUri']),'qs':{'operation':_0x6e70('0x32'),'username':_0x406f29['username'],'sessionName':_0x2864a0[_0x6e70('0x33')],'query':util['format'](_0x6e70('0x34'),_0xecf336)},'json':!![]})[_0x6e70('0x28')](function(_0x30fa0b){if(_0x30fa0b['success']&&_0x30fa0b[_0x6e70('0x35')][_0x6e70('0xe')]){logger['info'](_0x6e70('0x36'));return BPromise[_0x6e70('0x2a')]({'id':_0x30fa0b['result'][0x0]['id'],'email':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x37')],'name':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x38')]+'\x20'+_0x30fa0b[_0x6e70('0x35')][_0x6e70('0x39')]});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29['username'],'name':_0x6e70('0x3c')});}})['catch'](function(_0x23cd1a){var _0x3222a2=_0x23cd1a[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x3222a2,JSON[_0x6e70('0x27')](_0x23cd1a));});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29[_0x6e70('0x3e')],'name':_0x6e70('0x3c')})['catch'](function(_0x5446a2){var _0x5424eb=_0x5446a2[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x5424eb,JSON[_0x6e70('0x27')](_0x5446a2));});}}function getEndUser(_0x3bdd87,_0x572a71,_0x3b508c,_0x9e7ad2){logger[_0x6e70('0x1b')](_0x6e70('0x3f'),_0x3b508c);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3bdd87[_0x6e70('0x40')]),'qs':{'operation':'query','username':_0x3bdd87[_0x6e70('0x3e')],'sessionName':_0x9e7ad2[_0x6e70('0x33')],'query':util[_0x6e70('0x24')](_0x6e70('0x41'),_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c)},'json':!![]})[_0x6e70('0x28')](function(_0x1de947){if(_0x1de947[_0x6e70('0x29')]&&_0x1de947['result']['length']){logger['info'](_0x6e70('0x42'));return BPromise[_0x6e70('0x2a')]({'id':_0x1de947[_0x6e70('0x35')][0x0]['id'],'name':_0x1de947[_0x6e70('0x35')][0x0][_0x6e70('0x43')]+'\x20'+_0x1de947['result'][0x0][_0x6e70('0x44')],'phone':_0x3b508c});}else{logger[_0x6e70('0x1b')](_0x6e70('0x45'));return request({'method':'POST','uri':util['format']('%s/webservice.php',_0x3bdd87[_0x6e70('0x40')]),'form':{'operation':'create','sessionName':_0x9e7ad2[_0x6e70('0x33')],'elementType':_0x6e70('0x46'),'element':JSON[_0x6e70('0x27')]({'lastname':_0x572a71,'phone':_0x3b508c,'assigned_user_id':'\x20'})},'json':!![]})[_0x6e70('0x28')](function(_0x59c87d){logger[_0x6e70('0x1b')]('Enduser\x20created.');return BPromise[_0x6e70('0x2a')]({'id':_0x59c87d[_0x6e70('0x35')]['id'],'name':_0x59c87d[_0x6e70('0x35')][_0x6e70('0x44')],'phone':_0x59c87d['result'][_0x6e70('0x47')]});})[_0x6e70('0x48')](function(_0x3d39c3){var _0xac87d6=_0x3d39c3[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'getEndUser',_0xac87d6,JSON[_0x6e70('0x27')](_0x3d39c3));});}});}function getConnection(_0x3884a4){var _0x10de2a=_0x3884a4[_0x6e70('0x3e')];var _0x3f86cf=_0x3884a4[_0x6e70('0x49')];return request({'method':_0x6e70('0x31'),'uri':util['format'](_0x6e70('0x25'),_0x3884a4['remoteUri']),'qs':{'operation':_0x6e70('0x4a'),'username':_0x10de2a},'json':!![]})[_0x6e70('0x28')](function(_0x4b351e){if(_0x4b351e['success']){return request({'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3884a4['remoteUri']),'form':{'operation':'login','username':_0x10de2a,'accessKey':md5(_0x4b351e[_0x6e70('0x35')][_0x6e70('0x4b')]+_0x3f86cf)},'json':!![]});}})[_0x6e70('0x28')](function(_0x79653){if(_0x79653[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')](_0x79653['result']);}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x4c'),_0x3884a4['id']));}})[_0x6e70('0x48')](function(_0x6ed023){var _0x2c3a7d=_0x6ed023['statusCode']||0x1f4;logger['error'](_0x6e70('0x2e'),_0x6e70('0x4d'),_0x2c3a7d,JSON[_0x6e70('0x27')](_0x6ed023));});}function request(_0x15f994){logger[_0x6e70('0x1b')]('[HTTP]',JSON[_0x6e70('0x27')](_0x15f994));return rp(_0x15f994);}exports[_0x6e70('0x4e')]=function(_0x1fa320,_0x23ebfb,_0x3aba34,_0x4a111a,_0x1142cd,_0x1dd242){var _0x2c20d3,_0x3fb0d3,_0x8ef4f7,_0x3fd03d;_0x1dd242['remoteUri']=intUtil[_0x6e70('0x4f')](_0x1dd242[_0x6e70('0x40')]);if(_0x1142cd&&_0x1142cd['monitor_format']){logger[_0x6e70('0x1b')](_0x6e70('0x50'),'Recording\x20is\x20enabled!');_0x23ebfb[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x1dd242[_0x6e70('0x53')],_0x23ebfb[_0x6e70('0x54')],md5(_0x23ebfb['uniqueid']));}else{_0x23ebfb[_0x6e70('0x51')]='';}return getConnection(_0x1dd242)[_0x6e70('0x28')](function(_0x10d655){_0x3fd03d=_0x10d655;return getUser(_0x1dd242,_0x4a111a[_0x6e70('0x55')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1fe13a){_0x2c20d3=_0x1fe13a;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x2c20d3['id']);return getEndUser(_0x1dd242,_0x23ebfb[_0x6e70('0x57')],_0x23ebfb[_0x6e70('0x58')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1b12a1){_0x3fb0d3=_0x1b12a1;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x3fb0d3['id']);return createTicket(_0x1dd242,_0x2c20d3,_0x3fb0d3,_0x3aba34,_0x23ebfb,_0x3aba34[_0x6e70('0x5a')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x324fa6){_0x8ef4f7=_0x324fa6;logger[_0x6e70('0x1b')](_0x6e70('0x5b'));logger[_0x6e70('0x1b')]('The\x20Ticket\x20ID\x20is:',_0x8ef4f7['id']);var _0x28898a=util[_0x6e70('0x24')](_0x6e70('0x5c'),_0x1dd242[_0x6e70('0x40')],_[_0x6e70('0x5d')](_0x8ef4f7['id'],'x')[0x1]);logger[_0x6e70('0x1b')]('[QUEUE]',_0x6e70('0x5e'));emit(util[_0x6e70('0x24')]('user:%s',_0x4a111a[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x28898a});})[_0x6e70('0x48')](function(_0x590f7f){logger['error'](_0x6e70('0x50'),JSON[_0x6e70('0x27')](_0x590f7f));});};exports[_0x6e70('0x60')]=function(_0x41a861,_0x10d299,_0x739946,_0x30cd88,_0x57bfe5,_0x4d47e1,_0x2c8dc6){var _0x1e23c5,_0x2bf9ec,_0x2ad395,_0x5b1e6f;_0x4d47e1['remoteUri']=intUtil[_0x6e70('0x4f')](_0x4d47e1[_0x6e70('0x40')]);_0x4d47e1['serverUrl']=intUtil['stripTrailingSlash'](_0x4d47e1[_0x6e70('0x53')]);if(_0x2c8dc6&&_0x2c8dc6['recordingFormat']&&_0x2c8dc6[_0x6e70('0x61')]!==_0x6e70('0x62')){logger[_0x6e70('0x1b')](_0x6e70('0x63'),_0x6e70('0x64'));_0x10d299[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x4d47e1['serverUrl'],_0x10d299[_0x6e70('0x54')],md5(_0x10d299[_0x6e70('0x54')]));}return getConnection(_0x4d47e1)[_0x6e70('0x28')](function(_0x346c79){_0x5b1e6f=_0x346c79;return getUser(_0x4d47e1,_0x30cd88[_0x6e70('0x55')],_0x5b1e6f);})['then'](function(_0x5f5b02){_0x1e23c5=_0x5f5b02;logger['info'](_0x6e70('0x56'),_0x1e23c5['id']);return getEndUser(_0x4d47e1,_0x10d299[_0x6e70('0x65')],_0x10d299[_0x6e70('0x66')],_0x5b1e6f);})['then'](function(_0x58cf1c){_0x2bf9ec=_0x58cf1c;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x2bf9ec['id']);return createTicket(_0x4d47e1,_0x1e23c5,_0x2bf9ec,_0x739946,_0x10d299,_0x739946[_0x6e70('0x5a')],_0x5b1e6f);})[_0x6e70('0x28')](function(_0x2285f1){_0x2ad395=_0x2285f1;logger[_0x6e70('0x1b')]('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x2ad395['id']);var _0x30d11b=util[_0x6e70('0x24')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x4d47e1[_0x6e70('0x40')],_['split'](_0x2ad395['id'],'x')[0x1]);logger['info'](_0x6e70('0x63'),_0x6e70('0x5e'));emit(util[_0x6e70('0x24')](_0x6e70('0x68'),_0x30cd88[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x30d11b});})['catch'](function(_0x370eeb){logger[_0x6e70('0x2d')](_0x6e70('0x63'),JSON[_0x6e70('0x27')](_0x370eeb));});};exports[_0x6e70('0x69')]=function(_0x13c092,_0x363722,_0xd9b4a9,_0x2f1362,_0x29621a,_0x575938){var _0x44c877,_0x303c5a,_0x577c3b,_0x5d398a;_0x575938['remoteUri']=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x40')]);_0x575938[_0x6e70('0x53')]=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x53')]);if(_0x29621a&&_0x29621a['monitor_format']){logger['info']('['+_0x363722[_0x6e70('0x6a')][_0x6e70('0x6b')]()+']','Recording\x20is\x20enabled!');_0x363722[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x575938[_0x6e70('0x53')],_0x363722[_0x6e70('0x54')],md5(_0x363722[_0x6e70('0x54')]));}else{_0x363722[_0x6e70('0x51')]='';}return getConnection(_0x575938)[_0x6e70('0x28')](function(_0x3650e9){_0x5d398a=_0x3650e9;return getUser(_0x575938,'',_0x5d398a);})[_0x6e70('0x28')](function(_0x347cc4){_0x44c877=_0x347cc4;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x44c877['id']);return getEndUser(_0x575938,_0x363722[_0x6e70('0x57')],_0x363722['calleridnum'],_0x5d398a);})['then'](function(_0x39ed95){_0x303c5a=_0x39ed95;logger['info'](_0x6e70('0x59'),_0x303c5a['id']);return createTicket(_0x575938,_0x44c877,_0x303c5a,_0xd9b4a9,_0x363722,_0xd9b4a9['Fields'],_0x5d398a);})['then'](function(_0x402f6f){_0x577c3b=_0x402f6f;logger['info']('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x577c3b['id']);})[_0x6e70('0x48')](function(_0x4e9fda){logger['error']('['+_0x363722['lastevent'][_0x6e70('0x6b')]()+']',JSON['stringify'](_0x4e9fda));});}; \ No newline at end of file +var _0x9c44=['stringify','validateEmail','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','length','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','getUser','admin','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','login','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','The\x20Ticket\x20ID\x20is:','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridnum','lastevent','bluebird','md5','util','ioredis','./util','../../../../config/environment','redis','localhost','socket.io-emitter','emit','forEach','string','picklist','idField','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Subjects','POST','remoteUri','create','username','sessionName','then','resolve','result','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s'];(function(_0x17a04f,_0x470629){var _0x231f8e=function(_0x3e763c){while(--_0x3e763c){_0x17a04f['push'](_0x17a04f['shift']());}};_0x231f8e(++_0x470629);}(_0x9c44,0x178));var _0x49c4=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x9c44[_0x1d9aa0];return _0x226868;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var util=require(_0x49c4('0x2'));var Redis=require(_0x49c4('0x3'));var intUtil=require(_0x49c4('0x4'));var config=require(_0x49c4('0x5'));var logger=require('../../../../config/logger')('vTiger');config[_0x49c4('0x6')]=_['defaults'](config[_0x49c4('0x6')],{'host':_0x49c4('0x7'),'port':0x18eb});var io=require(_0x49c4('0x8'))(new Redis(config[_0x49c4('0x6')]));function emit(_0x436234,_0x511d53,_0x11c586){io['to'](_0x436234)[_0x49c4('0x9')](_0x511d53,_0x11c586);}function getCustomFields(_0x1d13fb,_0x4487ca){var _0x4c7d3a={};if(_0x1d13fb['length']>0x0){_[_0x49c4('0xa')](_0x1d13fb,function(_0x313e73){if(_['includes']([_0x49c4('0xb'),_0x49c4('0xc')],_0x313e73['type'])&&_0x313e73['idField']){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x313e73[_0x49c4('0xe')]['toString']();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x10')&&_0x313e73['variableName']&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x11')]]){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x4487ca[_0x313e73[_0x49c4('0x11')]][_0x49c4('0x12')]();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x13')&&_0x313e73[_0x49c4('0x14')]&&_0x313e73['Variable'][_0x49c4('0x15')]&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')][_0x49c4('0x16')]()]){_0x4c7d3a[_0x313e73['idField']]=_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')]['toLowerCase']()]['toString']();}});}return _0x4c7d3a;}function createTicket(_0x3c782d,_0x2f82d5,_0x3addb2,_0x59f29b,_0x24856d,_0x50b151,_0x2cbd50){logger[_0x49c4('0x17')](_0x49c4('0x18'));var _0x291526=_[_0x49c4('0x19')]({'parent_id':'','assigned_user_id':_0x2f82d5['id'],'ticketpriorities':_0x49c4('0x1a'),'ticketstatus':_0x49c4('0x1b'),'ticket_title':intUtil[_0x49c4('0x1c')](_0x59f29b[_0x49c4('0x1d')],_0x24856d,'\x20'),'description':intUtil['getString'](_0x59f29b['Descriptions'],_0x24856d,'\x0a'),'contact_id':_0x3addb2['id']},getCustomFields(_0x50b151,_0x24856d));var _0x57f502={'method':_0x49c4('0x1e'),'uri':util['format']('%s/webservice.php',_0x3c782d[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x20'),'username':_0x3c782d[_0x49c4('0x21')],'sessionName':_0x2cbd50[_0x49c4('0x22')],'elementType':'HelpDesk','element':JSON['stringify'](_0x291526)},'json':!![]};return request(_0x57f502)[_0x49c4('0x23')](function(_0x9cb797){if(_0x9cb797['success']){return BPromise[_0x49c4('0x24')]({'id':_0x9cb797[_0x49c4('0x25')]['id']});}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x27'),JSON['stringify'](_0x9cb797['error'])));}})[_0x49c4('0x28')](function(_0x53c199){var _0x3800b7=_0x53c199[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'createTicket',_0x3800b7,JSON[_0x49c4('0x2c')](_0x53c199));});}function getUser(_0x2b2793,_0x46e04d,_0x4f28a2){if(intUtil[_0x49c4('0x2d')](_0x46e04d)){logger[_0x49c4('0x17')](_0x49c4('0x2e'),_0x46e04d);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2b2793[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x2b2793['username'],'sessionName':_0x4f28a2['sessionName'],'query':util[_0x49c4('0x26')](_0x49c4('0x31'),_0x46e04d)},'json':!![]})[_0x49c4('0x23')](function(_0x27e467){if(_0x27e467[_0x49c4('0x32')]&&_0x27e467['result'][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x34'));return BPromise[_0x49c4('0x24')]({'id':_0x27e467['result'][0x0]['id'],'email':_0x27e467['result'][0x0][_0x49c4('0x35')],'name':_0x27e467[_0x49c4('0x25')][0x0][_0x49c4('0x36')]+'\x20'+_0x27e467[_0x49c4('0x25')][_0x49c4('0x37')]});}else{logger['info'](_0x49c4('0x38'));return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2[_0x49c4('0x39')],'email':_0x2b2793['username'],'name':'admin'});}})[_0x49c4('0x28')](function(_0x1991e9){var _0x3bec0a=_0x1991e9[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x3a'),_0x3bec0a,JSON[_0x49c4('0x2c')](_0x1991e9));});}else{logger[_0x49c4('0x17')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2['userId'],'email':_0x2b2793[_0x49c4('0x21')],'name':_0x49c4('0x3b')})[_0x49c4('0x28')](function(_0x1c2830){var _0x4ed4f8=_0x1c2830[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'getUser',_0x4ed4f8,JSON[_0x49c4('0x2c')](_0x1c2830));});}}function getEndUser(_0x21d8c7,_0x178987,_0x5e5366,_0x1ba7a0){logger[_0x49c4('0x17')](_0x49c4('0x3c'),_0x5e5366);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x21d8c7[_0x49c4('0x21')],'sessionName':_0x1ba7a0[_0x49c4('0x22')],'query':util[_0x49c4('0x26')](_0x49c4('0x3d'),_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366)},'json':!![]})[_0x49c4('0x23')](function(_0x29dd5d){if(_0x29dd5d[_0x49c4('0x32')]&&_0x29dd5d[_0x49c4('0x25')][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x3e'));return BPromise[_0x49c4('0x24')]({'id':_0x29dd5d[_0x49c4('0x25')][0x0]['id'],'name':_0x29dd5d['result'][0x0][_0x49c4('0x3f')]+'\x20'+_0x29dd5d['result'][0x0][_0x49c4('0x40')],'phone':_0x5e5366});}else{logger[_0x49c4('0x17')](_0x49c4('0x41'));return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7['remoteUri']),'form':{'operation':'create','sessionName':_0x1ba7a0[_0x49c4('0x22')],'elementType':_0x49c4('0x42'),'element':JSON[_0x49c4('0x2c')]({'lastname':_0x178987,'phone':_0x5e5366,'assigned_user_id':'\x20'})},'json':!![]})[_0x49c4('0x23')](function(_0x490823){logger[_0x49c4('0x17')](_0x49c4('0x43'));return BPromise[_0x49c4('0x24')]({'id':_0x490823[_0x49c4('0x25')]['id'],'name':_0x490823[_0x49c4('0x25')][_0x49c4('0x40')],'phone':_0x490823[_0x49c4('0x25')][_0x49c4('0x44')]});})[_0x49c4('0x28')](function(_0x5640d3){var _0x2ad771=_0x5640d3['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x45'),_0x2ad771,JSON[_0x49c4('0x2c')](_0x5640d3));});}});}function getConnection(_0x2d93d8){var _0x5b296d=_0x2d93d8[_0x49c4('0x21')];var _0x15b674=_0x2d93d8[_0x49c4('0x46')];return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'qs':{'operation':'getchallenge','username':_0x5b296d},'json':!![]})[_0x49c4('0x23')](function(_0x5cfff9){if(_0x5cfff9[_0x49c4('0x32')]){return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x47'),'username':_0x5b296d,'accessKey':md5(_0x5cfff9[_0x49c4('0x25')]['token']+_0x15b674)},'json':!![]});}})[_0x49c4('0x23')](function(_0x3feaf0){if(_0x3feaf0['success']){return BPromise[_0x49c4('0x24')](_0x3feaf0[_0x49c4('0x25')]);}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x48'),_0x2d93d8['id']));}})['catch'](function(_0x5d8bf0){var _0x144fd2=_0x5d8bf0['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x49'),_0x144fd2,JSON[_0x49c4('0x2c')](_0x5d8bf0));});}function request(_0x240c20){logger[_0x49c4('0x17')](_0x49c4('0x4a'),JSON['stringify'](_0x240c20));return rp(_0x240c20);}exports[_0x49c4('0x4b')]=function(_0x1550ce,_0x3936d3,_0x3d944c,_0x17ef75,_0x2644c0,_0x156748){var _0x25d174,_0x1e0b4f,_0x1856be,_0x5b822f;_0x156748['remoteUri']=intUtil[_0x49c4('0x4c')](_0x156748[_0x49c4('0x1f')]);if(_0x2644c0&&_0x2644c0['monitor_format']){logger['info'](_0x49c4('0x4d'),'Recording\x20is\x20enabled!');_0x3936d3['recordingURL']=util[_0x49c4('0x26')](_0x49c4('0x4e'),_0x156748[_0x49c4('0x4f')],_0x3936d3[_0x49c4('0x50')],md5(_0x3936d3[_0x49c4('0x50')]));}else{_0x3936d3[_0x49c4('0x51')]='';}return getConnection(_0x156748)[_0x49c4('0x23')](function(_0x50798e){_0x5b822f=_0x50798e;return getUser(_0x156748,_0x17ef75[_0x49c4('0x52')],_0x5b822f);})[_0x49c4('0x23')](function(_0x207572){_0x25d174=_0x207572;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x25d174['id']);return getEndUser(_0x156748,_0x3936d3[_0x49c4('0x54')],_0x3936d3['calleridnum'],_0x5b822f);})['then'](function(_0x1ef0c1){_0x1e0b4f=_0x1ef0c1;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0x1e0b4f['id']);return createTicket(_0x156748,_0x25d174,_0x1e0b4f,_0x3d944c,_0x3936d3,_0x3d944c[_0x49c4('0x56')],_0x5b822f);})[_0x49c4('0x23')](function(_0x6b2592){_0x1856be=_0x6b2592;logger[_0x49c4('0x17')]('Ticket\x20created!');logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x1856be['id']);var _0x4ba4eb=util[_0x49c4('0x26')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x156748[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x1856be['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x4d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x17ef75[_0x49c4('0x15')]),'trigger:browser:url',{'uri':_0x4ba4eb});})[_0x49c4('0x28')](function(_0x27b9c2){logger['error'](_0x49c4('0x4d'),JSON[_0x49c4('0x2c')](_0x27b9c2));});};exports['outbound']=function(_0x39c455,_0x42e0e6,_0x4f50bf,_0x4dc54d,_0x589484,_0x513879,_0xc43386){var _0x54947d,_0xb20a5d,_0x32f344,_0x515240;_0x513879[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x513879['remoteUri']);_0x513879[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x513879[_0x49c4('0x4f')]);if(_0xc43386&&_0xc43386[_0x49c4('0x5b')]&&_0xc43386['recordingFormat']!==_0x49c4('0x5c')){logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x5e'));_0x42e0e6['recordingURL']=util[_0x49c4('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x513879['serverUrl'],_0x42e0e6['uniqueid'],md5(_0x42e0e6['uniqueid']));}return getConnection(_0x513879)[_0x49c4('0x23')](function(_0x32eaef){_0x515240=_0x32eaef;return getUser(_0x513879,_0x4dc54d[_0x49c4('0x52')],_0x515240);})[_0x49c4('0x23')](function(_0x5b056e){_0x54947d=_0x5b056e;logger['info'](_0x49c4('0x53'),_0x54947d['id']);return getEndUser(_0x513879,_0x42e0e6[_0x49c4('0x5f')],_0x42e0e6[_0x49c4('0x60')],_0x515240);})[_0x49c4('0x23')](function(_0x102c15){_0xb20a5d=_0x102c15;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0xb20a5d['id']);return createTicket(_0x513879,_0x54947d,_0xb20a5d,_0x4f50bf,_0x42e0e6,_0x4f50bf[_0x49c4('0x56')],_0x515240);})['then'](function(_0x2276db){_0x32f344=_0x2276db;logger['info'](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x32f344['id']);var _0x1ea1b4=util[_0x49c4('0x26')](_0x49c4('0x62'),_0x513879[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x32f344['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x4dc54d[_0x49c4('0x15')]),_0x49c4('0x63'),{'uri':_0x1ea1b4});})[_0x49c4('0x28')](function(_0x371e49){logger[_0x49c4('0x2a')]('[OUTBOUND]',JSON['stringify'](_0x371e49));});};exports[_0x49c4('0x64')]=function(_0x16b3e8,_0x4af680,_0x1a15f3,_0x38ad50,_0x2939fd,_0x16e7b1){var _0x4d6aaa,_0x5a14a5,_0x4a85d4,_0x2e90d8;_0x16e7b1[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x1f')]);_0x16e7b1[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x4f')]);if(_0x2939fd&&_0x2939fd[_0x49c4('0x65')]){logger[_0x49c4('0x17')]('['+_0x4af680['lastevent'][_0x49c4('0x66')]()+']',_0x49c4('0x5e'));_0x4af680[_0x49c4('0x51')]=util['format'](_0x49c4('0x4e'),_0x16e7b1[_0x49c4('0x4f')],_0x4af680[_0x49c4('0x50')],md5(_0x4af680[_0x49c4('0x50')]));}else{_0x4af680[_0x49c4('0x51')]='';}return getConnection(_0x16e7b1)[_0x49c4('0x23')](function(_0x35fa39){_0x2e90d8=_0x35fa39;return getUser(_0x16e7b1,'',_0x2e90d8);})[_0x49c4('0x23')](function(_0x4ba198){_0x4d6aaa=_0x4ba198;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x4d6aaa['id']);return getEndUser(_0x16e7b1,_0x4af680[_0x49c4('0x54')],_0x4af680[_0x49c4('0x67')],_0x2e90d8);})[_0x49c4('0x23')](function(_0x4a204d){_0x5a14a5=_0x4a204d;logger['info'](_0x49c4('0x55'),_0x5a14a5['id']);return createTicket(_0x16e7b1,_0x4d6aaa,_0x5a14a5,_0x1a15f3,_0x4af680,_0x1a15f3['Fields'],_0x2e90d8);})[_0x49c4('0x23')](function(_0x558880){_0x4a85d4=_0x558880;logger[_0x49c4('0x17')](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x4a85d4['id']);})['catch'](function(_0x123060){logger[_0x49c4('0x2a')]('['+_0x4af680[_0x49c4('0x68')][_0x49c4('0x66')]()+']',JSON[_0x49c4('0x2c')](_0x123060));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index 844cff4..b2d7fe1 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 _0xb68c=['The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','none','[OUTBOUND]','destcalleridname','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','The\x20User\x20ID\x20is:','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','localhost','socket.io-emitter','emit','application/json','info','format','%s/tickets.json','remoteUri','POST','merge','Tags','name','Subjects','getString','Descriptions','then','ticket','validateEmail','%s/search.json','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','user','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','length','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','password','username','token','%s/token:%s','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','defaults','map','includes','string','picklist','type','nameField','customField','toLowerCase','content','custom_fields','idField','variable','variableName','push','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','calleridname','calleridnum'];(function(_0x1efa0a,_0x2c61c9){var _0x39a01a=function(_0x3b3094){while(--_0x3b3094){_0x1efa0a['push'](_0x1efa0a['shift']());}};_0x39a01a(++_0x2c61c9);}(_0xb68c,0x1e7));var _0xcb68=function(_0x2bb0b0,_0x402598){_0x2bb0b0=_0x2bb0b0-0x0;var _0x2c11c1=_0xb68c[_0x2bb0b0];return _0x2c11c1;};'use strict';var _=require(_0xcb68('0x0'));var rp=require(_0xcb68('0x1'));var md5=require(_0xcb68('0x2'));var util=require(_0xcb68('0x3'));var Redis=require(_0xcb68('0x4'));var intUtil=require(_0xcb68('0x5'));var config=require(_0xcb68('0x6'));var logger=require(_0xcb68('0x7'))(_0xcb68('0x8'));config[_0xcb68('0x9')]=_['defaults'](config[_0xcb68('0x9')],{'host':_0xcb68('0xa'),'port':0x18eb});var io=require(_0xcb68('0xb'))(new Redis(config[_0xcb68('0x9')]));function emit(_0x300f90,_0x3e6ec5,_0x12d7fc){io['to'](_0x300f90)[_0xcb68('0xc')](_0x3e6ec5,_0x12d7fc);}var headers={'Content-Type':_0xcb68('0xd'),'Accept':_0xcb68('0xd')};function getTicket(_0x43d2df,_0x47d363,_0x51c884,_0x4522b8,_0x65cea1){logger[_0xcb68('0xe')]('Creating\x20new\x20ticket...');return request({'uri':util[_0xcb68('0xf')](_0xcb68('0x10'),_0x43d2df[_0xcb68('0x11')]),'method':_0xcb68('0x12'),'body':{'ticket':_[_0xcb68('0x13')]({'requester_id':_0x51c884['id'],'submitter_id':_0x47d363?_0x47d363['id']:undefined,'assignee_id':_0x47d363?_0x47d363['id']:undefined,'tags':getTags(_0x4522b8[_0xcb68('0x14')],_0xcb68('0x15')),'subject':intUtil['getString'](_0x4522b8[_0xcb68('0x16')],_0x65cea1,'\x20'),'description':intUtil[_0xcb68('0x17')](_0x4522b8['Descriptions'],_0x65cea1,'\x0a'),'comment':{'public':![],'body':intUtil[_0xcb68('0x17')](_0x4522b8[_0xcb68('0x18')],_0x65cea1,'\x0a')}},getCustomFields(_0x4522b8['Fields'],_0x65cea1))}})[_0xcb68('0x19')](function(_0x243fab){logger[_0xcb68('0xe')]('Ticket\x20created!');return _0x243fab[_0xcb68('0x1a')];});}function getUser(_0x3a716a,_0x3dd7a5){if(intUtil[_0xcb68('0x1b')](_0x3dd7a5)){logger[_0xcb68('0xe')]('Getting\x20agent\x20with\x20email',_0x3dd7a5);return request({'uri':util['format'](_0xcb68('0x1c'),_0x3a716a[_0xcb68('0x11')]),'qs':{'query':util[_0xcb68('0xf')](_0xcb68('0x1d'),_0x3dd7a5)}})[_0xcb68('0x19')](function(_0x189a08){if(_0x189a08[_0xcb68('0x1e')]){logger[_0xcb68('0xe')](_0xcb68('0x1f'));return _['find'](_0x189a08[_0xcb68('0x20')],{'email':_0x3dd7a5,'role':_0xcb68('0x21')});}else{logger['info'](_0xcb68('0x22'));return request({'uri':util['format'](_0xcb68('0x23'),_0x3a716a[_0xcb68('0x11')])})[_0xcb68('0x19')](function(_0x5aaa92){logger[_0xcb68('0xe')]('Admin\x20account\x20selected.');return _0x5aaa92[_0xcb68('0x24')];});}});}else{logger[_0xcb68('0xe')](_0xcb68('0x22'));return request({'uri':util['format'](_0xcb68('0x23'),_0x3a716a[_0xcb68('0x11')])})[_0xcb68('0x19')](function(_0x239150){logger['info'](_0xcb68('0x25'));return _0x239150[_0xcb68('0x24')];});}}function getEndUser(_0x4bb715,_0x4ae1e9,_0x23308a){logger[_0xcb68('0xe')](_0xcb68('0x26'),_0x23308a);return request({'uri':util['format'](_0xcb68('0x1c'),_0x4bb715[_0xcb68('0x11')]),'qs':{'query':util['format']('type:user\x20role:end-user\x20phone:%s',_0x23308a)}})[_0xcb68('0x19')](function(_0x2950b0){var _0x356c57;if(_0x2950b0[_0xcb68('0x20')][_0xcb68('0x27')]){_0x2950b0['results']=_[_0xcb68('0x28')](_0x2950b0[_0xcb68('0x20')],{'suspended':![],'role':_0xcb68('0x29')});if(_0x2950b0[_0xcb68('0x20')][_0xcb68('0x27')]){_0x356c57=_[_0xcb68('0x2a')](_0x2950b0[_0xcb68('0x20')]);}}if(_0x356c57){logger['info'](_0xcb68('0x2b'));return _0x356c57;}else{logger['info'](_0xcb68('0x2c'));return request({'uri':util['format'](_0xcb68('0x2d'),_0x4bb715[_0xcb68('0x11')]),'method':_0xcb68('0x12'),'body':{'user':{'role':_0xcb68('0x29'),'name':util[_0xcb68('0xf')](_0xcb68('0x2e'),_0x4ae1e9||_0x23308a),'phone':_0x23308a}}})[_0xcb68('0x19')](function(_0xd93c22){logger[_0xcb68('0xe')](_0xcb68('0x2f'));return _0xd93c22['user'];});}});}function getAuth(_0xaca2f){var _0x23faae;if(_0xaca2f[_0xcb68('0x30')]===_0xcb68('0x31')){_0x23faae=util[_0xcb68('0xf')]('%s:%s',_0xaca2f[_0xcb68('0x32')],_0xaca2f['password']);}else if(_0xaca2f[_0xcb68('0x30')]===_0xcb68('0x33')){_0x23faae=util[_0xcb68('0xf')](_0xcb68('0x34'),_0xaca2f['username'],_0xaca2f[_0xcb68('0x33')]);}return util[_0xcb68('0xf')](_0xcb68('0x35'),new Buffer(_0x23faae)[_0xcb68('0x36')](_0xcb68('0x37')));}function request(_0x3d04d1){logger[_0xcb68('0x38')](_0xcb68('0x39'),JSON[_0xcb68('0x3a')](_0x3d04d1));return rp(_[_0xcb68('0x3b')](_0x3d04d1,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x6a0fc9,_0x30e89b){var _0x639360=[];if(_0x6a0fc9&&_0x6a0fc9[_0xcb68('0x27')]>0x0){_0x639360=_[_0xcb68('0x3c')](_0x6a0fc9,_0x30e89b);}return _0x639360;}function getCustomFields(_0x4467d8,_0x84fea3){var _0x1a8694=[];var _0xddbbe1={'custom_fields':[]};if(_0x4467d8[_0xcb68('0x27')]>0x0){_['forEach'](_0x4467d8,function(_0x56b756){if(_[_0xcb68('0x3d')]([_0xcb68('0x3e'),_0xcb68('0x3f')],_0x56b756[_0xcb68('0x40')])&&_0x56b756[_0xcb68('0x41')]&&!_0x56b756[_0xcb68('0x42')]){_0xddbbe1[_0x56b756[_0xcb68('0x41')][_0xcb68('0x43')]()]=_0x56b756[_0xcb68('0x44')][_0xcb68('0x36')]();}else if(_[_0xcb68('0x3d')]([_0xcb68('0x3e'),_0xcb68('0x3f')],_0x56b756['type'])&&_0x56b756['idField']&&_0x56b756['customField']){_0xddbbe1[_0xcb68('0x45')]['push']({'id':_0x56b756[_0xcb68('0x46')],'value':_0x56b756[_0xcb68('0x44')]['toString']()});}else if(_0x56b756[_0xcb68('0x40')]===_0xcb68('0x47')&&_0x56b756[_0xcb68('0x48')]&&_0x56b756[_0xcb68('0x46')]&&_0x56b756[_0xcb68('0x42')]){_0x84fea3[_0x56b756[_0xcb68('0x48')]]&&_0xddbbe1[_0xcb68('0x45')][_0xcb68('0x49')]({'id':_0x56b756[_0xcb68('0x46')],'value':_0x84fea3[_0x56b756['variableName']]['toString']()});}else if(_0x56b756[_0xcb68('0x40')]===_0xcb68('0x4a')&&_0x56b756['Variable']&&_0x56b756[_0xcb68('0x4b')][_0xcb68('0x15')]&&_0x56b756[_0xcb68('0x46')]&&_0x56b756[_0xcb68('0x42')]){_0x84fea3[_0x56b756[_0xcb68('0x4b')][_0xcb68('0x15')][_0xcb68('0x43')]()]&&_0xddbbe1[_0xcb68('0x45')][_0xcb68('0x49')]({'id':_0x56b756[_0xcb68('0x46')],'value':_0x84fea3[_0x56b756[_0xcb68('0x4b')]['name'][_0xcb68('0x43')]()][_0xcb68('0x36')]()});}});}return _0xddbbe1;}exports[_0xcb68('0x4c')]=function(_0x2cc018,_0x31b2f3,_0x2bceef,_0x480fe5,_0x56ef51,_0xddf125){var _0xf0df19,_0x51d7f8;_0xddf125['remoteUri']=intUtil[_0xcb68('0x4d')](_0xddf125[_0xcb68('0x11')]);_0xddf125[_0xcb68('0x4e')]=intUtil['stripTrailingSlash'](_0xddf125[_0xcb68('0x4e')]);if(_0x56ef51&&_0x56ef51[_0xcb68('0x4f')]){logger[_0xcb68('0xe')](_0xcb68('0x50'),_0xcb68('0x51'));_0x31b2f3[_0xcb68('0x52')]=util[_0xcb68('0xf')](_0xcb68('0x53'),_0xddf125[_0xcb68('0x4e')],_0x31b2f3[_0xcb68('0x54')],md5(_0x31b2f3['uniqueid']));}else{_0x31b2f3[_0xcb68('0x52')]='';}headers[_0xcb68('0x55')]=getAuth(_0xddf125);return getUser(_0xddf125,_0x480fe5['email'])['then'](function(_0x1ecf04){_0xf0df19=_0x1ecf04;logger[_0xcb68('0xe')]('The\x20User\x20ID\x20is:',_0xf0df19['id']);return getEndUser(_0xddf125,_0x31b2f3[_0xcb68('0x56')],_0x31b2f3[_0xcb68('0x57')]);})[_0xcb68('0x19')](function(_0x93d92a){_0x51d7f8=_0x93d92a;logger[_0xcb68('0xe')](_0xcb68('0x58'),_0x51d7f8['id']);return getTicket(_0xddf125,_0xf0df19,_0x51d7f8,_0x2bceef,_0x31b2f3);})[_0xcb68('0x19')](function(_0x19ecf0){if(_0x19ecf0){logger[_0xcb68('0xe')](_0xcb68('0x59'),_0x19ecf0['id']);switch(_0xddf125[_0xcb68('0x40')]){case _0xcb68('0x5a'):logger[_0xcb68('0xe')](_0xcb68('0x50'),_0xcb68('0x5b'));return request({'uri':util[_0xcb68('0xf')](_0xcb68('0x5c'),_0xddf125[_0xcb68('0x11')],_0xf0df19['id'],_0x19ecf0['id']),'method':_0xcb68('0x12')});case _0xcb68('0x5d'):logger[_0xcb68('0xe')](_0xcb68('0x50'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xcb68('0xf')](_0xcb68('0x5e'),_0x480fe5[_0xcb68('0x15')]),_0xcb68('0x5f'),{'uri':util[_0xcb68('0xf')](_0xcb68('0x60'),_0xddf125['remoteUri'][_0xcb68('0x61')](_0xcb68('0x62'),''),_0x19ecf0['id'])});break;default:logger[_0xcb68('0x63')](_0xcb68('0x50'),_0xcb68('0x64'));}}})[_0xcb68('0x65')](function(_0xccd192){logger[_0xcb68('0x63')](_0xcb68('0x66'),util[_0xcb68('0x67')](_0xccd192,{'showHidden':!![],'depth':null}));});};exports[_0xcb68('0x68')]=function(_0x3691f4,_0x410eb0,_0x5024b0,_0x1f1d8b,_0x380363,_0x38d4c0,_0x1a322a){var _0x36ef41,_0x3686c5;_0x38d4c0[_0xcb68('0x11')]=intUtil['stripTrailingSlash'](_0x38d4c0[_0xcb68('0x11')]);_0x38d4c0[_0xcb68('0x4e')]=intUtil[_0xcb68('0x4d')](_0x38d4c0[_0xcb68('0x4e')]);if(_0x1a322a&&_0x1a322a['recordingFormat']&&_0x1a322a['recordingFormat']!==_0xcb68('0x69')){logger[_0xcb68('0xe')](_0xcb68('0x6a'),_0xcb68('0x51'));_0x410eb0[_0xcb68('0x52')]=util[_0xcb68('0xf')](_0xcb68('0x53'),_0x38d4c0[_0xcb68('0x4e')],_0x410eb0['uniqueid'],md5(_0x410eb0[_0xcb68('0x54')]));}headers[_0xcb68('0x55')]=getAuth(_0x38d4c0);return getUser(_0x38d4c0,_0x1f1d8b['email'])[_0xcb68('0x19')](function(_0xd9bb50){_0x36ef41=_0xd9bb50;logger[_0xcb68('0xe')]('The\x20User\x20ID\x20is:',_0x36ef41['id']);return getEndUser(_0x38d4c0,_0x410eb0[_0xcb68('0x6b')],_0x410eb0['destcalleridnum']);})[_0xcb68('0x19')](function(_0x1e6914){_0x3686c5=_0x1e6914;logger[_0xcb68('0xe')](_0xcb68('0x58'),_0x3686c5['id']);return getTicket(_0x38d4c0,_0x36ef41,_0x3686c5,_0x5024b0,_0x410eb0);})[_0xcb68('0x19')](function(_0x44b011){if(_0x44b011){logger[_0xcb68('0xe')](_0xcb68('0x59'),_0x44b011['id']);switch(_0x38d4c0[_0xcb68('0x40')]){case _0xcb68('0x5a'):logger[_0xcb68('0xe')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent...');return request({'uri':util['format']('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x38d4c0[_0xcb68('0x11')],_0x36ef41['id'],_0x44b011['id']),'method':_0xcb68('0x12')});case _0xcb68('0x5d'):logger[_0xcb68('0xe')](_0xcb68('0x6a'),_0xcb68('0x6c'));emit(util[_0xcb68('0xf')](_0xcb68('0x5e'),_0x1f1d8b[_0xcb68('0x15')]),_0xcb68('0x5f'),{'uri':util['format'](_0xcb68('0x60'),_0x38d4c0[_0xcb68('0x11')][_0xcb68('0x61')](_0xcb68('0x62'),''),_0x44b011['id'])});break;default:logger[_0xcb68('0x63')]('[OUTBOUND]','Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0xcb68('0x65')](function(_0x16b7e4){logger[_0xcb68('0x63')](_0xcb68('0x6d'),util['inspect'](_0x16b7e4,{'showHidden':!![],'depth':null}));});};exports[_0xcb68('0x6e')]=function(_0x5ec2ed,_0xeb1ee9,_0x3c6298,_0x3913f7,_0x1e2fc8,_0x45eaa7){var _0x4075a5,_0x200cdf;_0x45eaa7['remoteUri']=intUtil['stripTrailingSlash'](_0x45eaa7[_0xcb68('0x11')]);_0x45eaa7[_0xcb68('0x4e')]=intUtil[_0xcb68('0x4d')](_0x45eaa7[_0xcb68('0x4e')]);if(_0x1e2fc8&&_0x1e2fc8[_0xcb68('0x4f')]){logger['info']('['+_0xeb1ee9[_0xcb68('0x6f')][_0xcb68('0x70')]()+']',_0xcb68('0x51'));_0xeb1ee9['recordingURL']=util['format'](_0xcb68('0x53'),_0x45eaa7[_0xcb68('0x4e')],_0xeb1ee9[_0xcb68('0x54')],md5(_0xeb1ee9['uniqueid']));}else{_0xeb1ee9[_0xcb68('0x52')]='';}headers[_0xcb68('0x55')]=getAuth(_0x45eaa7);return getUser(_0x45eaa7)[_0xcb68('0x19')](function(_0x14b93b){_0x4075a5=_0x14b93b;logger['info'](_0xcb68('0x71'),_0x4075a5['id']);return getEndUser(_0x45eaa7,_0xeb1ee9[_0xcb68('0x56')],_0xeb1ee9['calleridnum']);})[_0xcb68('0x19')](function(_0x4b9fb7){_0x200cdf=_0x4b9fb7;logger[_0xcb68('0xe')]('The\x20Enduser\x20ID\x20is:',_0x200cdf['id']);return getTicket(_0x45eaa7,_0x4075a5,_0x200cdf,_0x3c6298,_0xeb1ee9);})[_0xcb68('0x19')](function(_0xe2451c){if(_0xe2451c){logger[_0xcb68('0xe')](_0xcb68('0x59'),_0xe2451c['id']);}})[_0xcb68('0x65')](function(_0x5c6334){logger['error']('['+_0xeb1ee9[_0xcb68('0x6f')]['toUpperCase']()+']'+_0xcb68('0x72'),util['inspect'](_0x5c6334,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xae35=['Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','POST','Caller\x20-\x20%s','password','%s:%s','username','token','Basic\x20%s','toString','base64','stringify','defaults','GET','map','forEach','includes','string','picklist','type','nameField','toLowerCase','idField','customField','custom_fields','push','content','variable','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','email','calleridname','calleridnum','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','/api/v2','catch','error','inspect','unmanaged','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','request-promise','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','localhost','emit','application/json','format','%s/tickets.json','remoteUri','Tags','name','getString','Subjects','Descriptions','Fields','then','info','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','count','results','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','user','%s/users/me.json','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','first'];(function(_0x516510,_0x48f18a){var _0x5c5246=function(_0x3ea365){while(--_0x3ea365){_0x516510['push'](_0x516510['shift']());}};_0x5c5246(++_0x48f18a);}(_0xae35,0x121));var _0x5ae3=function(_0x33c902,_0x4751ea){_0x33c902=_0x33c902-0x0;var _0xd4ca18=_0xae35[_0x33c902];return _0xd4ca18;};'use strict';var _=require('lodash');var rp=require(_0x5ae3('0x0'));var md5=require(_0x5ae3('0x1'));var util=require('util');var Redis=require(_0x5ae3('0x2'));var intUtil=require(_0x5ae3('0x3'));var config=require(_0x5ae3('0x4'));var logger=require(_0x5ae3('0x5'))(_0x5ae3('0x6'));config[_0x5ae3('0x7')]=_['defaults'](config[_0x5ae3('0x7')],{'host':_0x5ae3('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x2b498a,_0x2f5dc0,_0x1a704a){io['to'](_0x2b498a)[_0x5ae3('0x9')](_0x2f5dc0,_0x1a704a);}var headers={'Content-Type':'application/json','Accept':_0x5ae3('0xa')};function getTicket(_0x4e982f,_0x4729ae,_0x2bbeca,_0xfad65d,_0x44b500){logger['info']('Creating\x20new\x20ticket...');return request({'uri':util[_0x5ae3('0xb')](_0x5ae3('0xc'),_0x4e982f[_0x5ae3('0xd')]),'method':'POST','body':{'ticket':_['merge']({'requester_id':_0x2bbeca['id'],'submitter_id':_0x4729ae?_0x4729ae['id']:undefined,'assignee_id':_0x4729ae?_0x4729ae['id']:undefined,'tags':getTags(_0xfad65d[_0x5ae3('0xe')],_0x5ae3('0xf')),'subject':intUtil[_0x5ae3('0x10')](_0xfad65d[_0x5ae3('0x11')],_0x44b500,'\x20'),'description':intUtil[_0x5ae3('0x10')](_0xfad65d[_0x5ae3('0x12')],_0x44b500,'\x0a'),'comment':{'public':![],'body':intUtil[_0x5ae3('0x10')](_0xfad65d[_0x5ae3('0x12')],_0x44b500,'\x0a')}},getCustomFields(_0xfad65d[_0x5ae3('0x13')],_0x44b500))}})[_0x5ae3('0x14')](function(_0x16e854){logger[_0x5ae3('0x15')]('Ticket\x20created!');return _0x16e854[_0x5ae3('0x16')];});}function getUser(_0x5da9af,_0xd0c04b){if(intUtil[_0x5ae3('0x17')](_0xd0c04b)){logger[_0x5ae3('0x15')](_0x5ae3('0x18'),_0xd0c04b);return request({'uri':util[_0x5ae3('0xb')](_0x5ae3('0x19'),_0x5da9af[_0x5ae3('0xd')]),'qs':{'query':util[_0x5ae3('0xb')](_0x5ae3('0x1a'),_0xd0c04b)}})[_0x5ae3('0x14')](function(_0x37913a){if(_0x37913a[_0x5ae3('0x1b')]){logger['info']('Agent\x20found!');return _['find'](_0x37913a[_0x5ae3('0x1c')],{'email':_0xd0c04b,'role':'agent'});}else{logger[_0x5ae3('0x15')](_0x5ae3('0x1d'));return request({'uri':util[_0x5ae3('0xb')]('%s/users/me.json',_0x5da9af[_0x5ae3('0xd')])})[_0x5ae3('0x14')](function(_0x412cad){logger[_0x5ae3('0x15')](_0x5ae3('0x1e'));return _0x412cad[_0x5ae3('0x1f')];});}});}else{logger['info'](_0x5ae3('0x1d'));return request({'uri':util[_0x5ae3('0xb')](_0x5ae3('0x20'),_0x5da9af['remoteUri'])})['then'](function(_0x163d05){logger[_0x5ae3('0x15')](_0x5ae3('0x1e'));return _0x163d05[_0x5ae3('0x1f')];});}}function getEndUser(_0x5f4437,_0xc7488f,_0x234470){logger[_0x5ae3('0x15')]('Searching\x20enduser\x20with\x20phone',_0x234470);return request({'uri':util[_0x5ae3('0xb')](_0x5ae3('0x19'),_0x5f4437[_0x5ae3('0xd')]),'qs':{'query':util[_0x5ae3('0xb')](_0x5ae3('0x21'),_0x234470)}})['then'](function(_0x4868c8){var _0x22747f;if(_0x4868c8[_0x5ae3('0x1c')][_0x5ae3('0x22')]){_0x4868c8[_0x5ae3('0x1c')]=_[_0x5ae3('0x23')](_0x4868c8[_0x5ae3('0x1c')],{'suspended':![],'role':_0x5ae3('0x24')});if(_0x4868c8[_0x5ae3('0x1c')]['length']){_0x22747f=_[_0x5ae3('0x25')](_0x4868c8[_0x5ae3('0x1c')]);}}if(_0x22747f){logger[_0x5ae3('0x15')](_0x5ae3('0x26'));return _0x22747f;}else{logger[_0x5ae3('0x15')](_0x5ae3('0x27'));return request({'uri':util['format'](_0x5ae3('0x28'),_0x5f4437['remoteUri']),'method':_0x5ae3('0x29'),'body':{'user':{'role':_0x5ae3('0x24'),'name':util['format'](_0x5ae3('0x2a'),_0xc7488f||_0x234470),'phone':_0x234470}}})['then'](function(_0x58a231){logger['info']('Enduser\x20created.');return _0x58a231[_0x5ae3('0x1f')];});}});}function getAuth(_0x7ac9c9){var _0x8b78b6;if(_0x7ac9c9['authType']===_0x5ae3('0x2b')){_0x8b78b6=util[_0x5ae3('0xb')](_0x5ae3('0x2c'),_0x7ac9c9[_0x5ae3('0x2d')],_0x7ac9c9[_0x5ae3('0x2b')]);}else if(_0x7ac9c9['authType']===_0x5ae3('0x2e')){_0x8b78b6=util[_0x5ae3('0xb')]('%s/token:%s',_0x7ac9c9['username'],_0x7ac9c9[_0x5ae3('0x2e')]);}return util['format'](_0x5ae3('0x2f'),new Buffer(_0x8b78b6)[_0x5ae3('0x30')](_0x5ae3('0x31')));}function request(_0x44143e){logger['debug']('[HTTP]',JSON[_0x5ae3('0x32')](_0x44143e));return rp(_[_0x5ae3('0x33')](_0x44143e,{'method':_0x5ae3('0x34'),'headers':headers,'json':!![]}));}function getTags(_0x3f7367,_0x3a82e9){var _0x5b59b9=[];if(_0x3f7367&&_0x3f7367[_0x5ae3('0x22')]>0x0){_0x5b59b9=_[_0x5ae3('0x35')](_0x3f7367,_0x3a82e9);}return _0x5b59b9;}function getCustomFields(_0x1ab803,_0x1a162f){var _0x34f7c5=[];var _0x57d1bf={'custom_fields':[]};if(_0x1ab803[_0x5ae3('0x22')]>0x0){_[_0x5ae3('0x36')](_0x1ab803,function(_0x3210e9){if(_[_0x5ae3('0x37')]([_0x5ae3('0x38'),_0x5ae3('0x39')],_0x3210e9[_0x5ae3('0x3a')])&&_0x3210e9[_0x5ae3('0x3b')]&&!_0x3210e9['customField']){_0x57d1bf[_0x3210e9['nameField'][_0x5ae3('0x3c')]()]=_0x3210e9['content'][_0x5ae3('0x30')]();}else if(_['includes']([_0x5ae3('0x38'),_0x5ae3('0x39')],_0x3210e9['type'])&&_0x3210e9[_0x5ae3('0x3d')]&&_0x3210e9[_0x5ae3('0x3e')]){_0x57d1bf[_0x5ae3('0x3f')][_0x5ae3('0x40')]({'id':_0x3210e9[_0x5ae3('0x3d')],'value':_0x3210e9[_0x5ae3('0x41')][_0x5ae3('0x30')]()});}else if(_0x3210e9['type']===_0x5ae3('0x42')&&_0x3210e9[_0x5ae3('0x43')]&&_0x3210e9[_0x5ae3('0x3d')]&&_0x3210e9['customField']){_0x1a162f[_0x3210e9[_0x5ae3('0x43')]]&&_0x57d1bf[_0x5ae3('0x3f')]['push']({'id':_0x3210e9[_0x5ae3('0x3d')],'value':_0x1a162f[_0x3210e9[_0x5ae3('0x43')]][_0x5ae3('0x30')]()});}else if(_0x3210e9[_0x5ae3('0x3a')]===_0x5ae3('0x44')&&_0x3210e9[_0x5ae3('0x45')]&&_0x3210e9[_0x5ae3('0x45')][_0x5ae3('0xf')]&&_0x3210e9['idField']&&_0x3210e9[_0x5ae3('0x3e')]){_0x1a162f[_0x3210e9[_0x5ae3('0x45')][_0x5ae3('0xf')]['toLowerCase']()]&&_0x57d1bf[_0x5ae3('0x3f')][_0x5ae3('0x40')]({'id':_0x3210e9[_0x5ae3('0x3d')],'value':_0x1a162f[_0x3210e9[_0x5ae3('0x45')][_0x5ae3('0xf')]['toLowerCase']()]['toString']()});}});}return _0x57d1bf;}exports[_0x5ae3('0x46')]=function(_0x30bab7,_0x11ddfe,_0x677b8b,_0x22efc9,_0x4c4680,_0x404ba3){var _0x260f02,_0x205c66;_0x404ba3['remoteUri']=intUtil[_0x5ae3('0x47')](_0x404ba3[_0x5ae3('0xd')]);_0x404ba3[_0x5ae3('0x48')]=intUtil['stripTrailingSlash'](_0x404ba3['serverUrl']);if(_0x4c4680&&_0x4c4680[_0x5ae3('0x49')]){logger[_0x5ae3('0x15')](_0x5ae3('0x4a'),_0x5ae3('0x4b'));_0x11ddfe[_0x5ae3('0x4c')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x404ba3[_0x5ae3('0x48')],_0x11ddfe[_0x5ae3('0x4d')],md5(_0x11ddfe['uniqueid']));}else{_0x11ddfe[_0x5ae3('0x4c')]='';}headers[_0x5ae3('0x4e')]=getAuth(_0x404ba3);return getUser(_0x404ba3,_0x22efc9[_0x5ae3('0x4f')])[_0x5ae3('0x14')](function(_0x483276){_0x260f02=_0x483276;logger[_0x5ae3('0x15')]('The\x20User\x20ID\x20is:',_0x260f02['id']);return getEndUser(_0x404ba3,_0x11ddfe[_0x5ae3('0x50')],_0x11ddfe[_0x5ae3('0x51')]);})[_0x5ae3('0x14')](function(_0x49b2ce){_0x205c66=_0x49b2ce;logger['info']('The\x20Enduser\x20ID\x20is:',_0x205c66['id']);return getTicket(_0x404ba3,_0x260f02,_0x205c66,_0x677b8b,_0x11ddfe);})[_0x5ae3('0x14')](function(_0x2fc6fa){if(_0x2fc6fa){logger[_0x5ae3('0x15')](_0x5ae3('0x52'),_0x2fc6fa['id']);switch(_0x404ba3['type']){case _0x5ae3('0x53'):logger[_0x5ae3('0x15')](_0x5ae3('0x4a'),_0x5ae3('0x54'));return request({'uri':util['format'](_0x5ae3('0x55'),_0x404ba3[_0x5ae3('0xd')],_0x260f02['id'],_0x2fc6fa['id']),'method':_0x5ae3('0x29')});case _0x5ae3('0x56'):logger['info'](_0x5ae3('0x4a'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x5ae3('0xb')](_0x5ae3('0x57'),_0x22efc9[_0x5ae3('0xf')]),_0x5ae3('0x58'),{'uri':util[_0x5ae3('0xb')](_0x5ae3('0x59'),_0x404ba3[_0x5ae3('0xd')][_0x5ae3('0x5a')]('/api/v2',''),_0x2fc6fa['id'])});break;default:logger['error'](_0x5ae3('0x4a'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x4afd0a){logger['error'](_0x5ae3('0x5b'),util['inspect'](_0x4afd0a,{'showHidden':!![],'depth':null}));});};exports[_0x5ae3('0x5c')]=function(_0x22a459,_0x203ee3,_0x3f6867,_0x2c4e47,_0xa49947,_0x57e22e,_0x3c86cd){var _0x2bf56e,_0x44c264;_0x57e22e['remoteUri']=intUtil[_0x5ae3('0x47')](_0x57e22e[_0x5ae3('0xd')]);_0x57e22e[_0x5ae3('0x48')]=intUtil[_0x5ae3('0x47')](_0x57e22e[_0x5ae3('0x48')]);if(_0x3c86cd&&_0x3c86cd[_0x5ae3('0x5d')]&&_0x3c86cd[_0x5ae3('0x5d')]!==_0x5ae3('0x5e')){logger[_0x5ae3('0x15')](_0x5ae3('0x5f'),_0x5ae3('0x4b'));_0x203ee3[_0x5ae3('0x4c')]=util[_0x5ae3('0xb')](_0x5ae3('0x60'),_0x57e22e[_0x5ae3('0x48')],_0x203ee3[_0x5ae3('0x4d')],md5(_0x203ee3[_0x5ae3('0x4d')]));}headers[_0x5ae3('0x4e')]=getAuth(_0x57e22e);return getUser(_0x57e22e,_0x2c4e47[_0x5ae3('0x4f')])[_0x5ae3('0x14')](function(_0x2b4635){_0x2bf56e=_0x2b4635;logger['info']('The\x20User\x20ID\x20is:',_0x2bf56e['id']);return getEndUser(_0x57e22e,_0x203ee3[_0x5ae3('0x61')],_0x203ee3[_0x5ae3('0x62')]);})[_0x5ae3('0x14')](function(_0x4eb72e){_0x44c264=_0x4eb72e;logger[_0x5ae3('0x15')](_0x5ae3('0x63'),_0x44c264['id']);return getTicket(_0x57e22e,_0x2bf56e,_0x44c264,_0x3f6867,_0x203ee3);})[_0x5ae3('0x14')](function(_0x310793){if(_0x310793){logger[_0x5ae3('0x15')]('The\x20Ticket\x20ID\x20is:',_0x310793['id']);switch(_0x57e22e[_0x5ae3('0x3a')]){case'integrationTab':logger[_0x5ae3('0x15')](_0x5ae3('0x5f'),_0x5ae3('0x54'));return request({'uri':util['format']('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x57e22e[_0x5ae3('0xd')],_0x2bf56e['id'],_0x310793['id']),'method':_0x5ae3('0x29')});case _0x5ae3('0x56'):logger[_0x5ae3('0x15')](_0x5ae3('0x5f'),_0x5ae3('0x64'));emit(util['format'](_0x5ae3('0x57'),_0x2c4e47['name']),_0x5ae3('0x58'),{'uri':util['format']('%s/agent/tickets/%s',_0x57e22e[_0x5ae3('0xd')]['replace'](_0x5ae3('0x65'),''),_0x310793['id'])});break;default:logger['error']('[OUTBOUND]','Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x5ae3('0x66')](function(_0x14fc07){logger[_0x5ae3('0x67')]('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util[_0x5ae3('0x68')](_0x14fc07,{'showHidden':!![],'depth':null}));});};exports[_0x5ae3('0x69')]=function(_0x54b700,_0x37de09,_0x5edc5a,_0x3d1848,_0x36b407,_0x405fd1){var _0x308685,_0x1dd042;_0x405fd1[_0x5ae3('0xd')]=intUtil[_0x5ae3('0x47')](_0x405fd1[_0x5ae3('0xd')]);_0x405fd1[_0x5ae3('0x48')]=intUtil[_0x5ae3('0x47')](_0x405fd1['serverUrl']);if(_0x36b407&&_0x36b407[_0x5ae3('0x49')]){logger[_0x5ae3('0x15')]('['+_0x37de09[_0x5ae3('0x6a')]['toUpperCase']()+']',_0x5ae3('0x4b'));_0x37de09['recordingURL']=util[_0x5ae3('0xb')](_0x5ae3('0x60'),_0x405fd1[_0x5ae3('0x48')],_0x37de09[_0x5ae3('0x4d')],md5(_0x37de09[_0x5ae3('0x4d')]));}else{_0x37de09[_0x5ae3('0x4c')]='';}headers[_0x5ae3('0x4e')]=getAuth(_0x405fd1);return getUser(_0x405fd1)['then'](function(_0x4faf99){_0x308685=_0x4faf99;logger[_0x5ae3('0x15')]('The\x20User\x20ID\x20is:',_0x308685['id']);return getEndUser(_0x405fd1,_0x37de09[_0x5ae3('0x50')],_0x37de09[_0x5ae3('0x51')]);})['then'](function(_0x258b5a){_0x1dd042=_0x258b5a;logger[_0x5ae3('0x15')](_0x5ae3('0x63'),_0x1dd042['id']);return getTicket(_0x405fd1,_0x308685,_0x1dd042,_0x5edc5a,_0x37de09);})[_0x5ae3('0x14')](function(_0x27713f){if(_0x27713f){logger[_0x5ae3('0x15')]('The\x20Ticket\x20ID\x20is:',_0x27713f['id']);}})[_0x5ae3('0x66')](function(_0x42fcb1){logger[_0x5ae3('0x67')]('['+_0x37de09[_0x5ae3('0x6a')][_0x5ae3('0x6b')]()+']'+_0x5ae3('0x6c'),util[_0x5ae3('0x68')](_0x42fcb1,{'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 3a0eb21..4f018e3 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 _0x5177=['https://crm.','/crm/EntityInfo.do?module=Calls&id=','stripTrailingSlash','recordingFormat','[OUTBOUND]','com','destcalleridname','destcalleridnum','Outbound','The\x20Call\x20ID\x20is:','unmanaged','toUpperCase','calleridnum','lodash','request-promise','md5','util','./util','moment','ioredis','../../../../config/environment','../../../../config/logger','redis','localhost','socket.io-emitter','forEach','includes','picklist','idField','content','toString','type','variableName','Variable','name','toLowerCase','indexOf','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','refreshToken','clientId','clientSecret','refresh_token','then','add','seconds','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','GET','ActiveUsers','users','findIndex','email','profile','user','Using\x20the\x20admin\x20account!','The\x20failing\x20result\x20is','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','catch','enduserType','https://www.zohoapis.','moduleCreate','role','first_name','last_name','Zoho-oauthtoken\x20','data','code','SUCCESS','details','Error:\x20','log','CREATE\x20ERROR','moduleSearch','contact_lead','uri','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','contact','/crm/v2/Contacts/search?criteria=((Phone:equals:','nothing','lead','Creating\x20new\x20call...','Owner','Subject','getString','Subjects','Descriptions','Full_Name','First_Name','Last_Name','What_Id','talktime','Call_Duration','utc','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','format','lastevent','called','Call_Result','Called','complete','connect','rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','outbound','agentcalledAt','/crm/v2/Calls','Call\x20created!','err','queue','host','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','The\x20User\x20ID\x20is:','calleridname','Inbound','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url'];(function(_0x3e7e96,_0x5683ca){var _0x13f6f0=function(_0x320767){while(--_0x320767){_0x3e7e96['push'](_0x3e7e96['shift']());}};_0x13f6f0(++_0x5683ca);}(_0x5177,0x133));var _0x7517=function(_0x56206c,_0x3cb817){_0x56206c=_0x56206c-0x0;var _0x39a8f0=_0x5177[_0x56206c];return _0x39a8f0;};'use strict';var _=require(_0x7517('0x0'));var rp=require(_0x7517('0x1'));var md5=require(_0x7517('0x2'));var util=require(_0x7517('0x3'));var intUtil=require(_0x7517('0x4'));var moment=require(_0x7517('0x5'));var Redis=require(_0x7517('0x6'));var BPromise=require('bluebird');var config=require(_0x7517('0x7'));var logger=require(_0x7517('0x8'))('zoho');config[_0x7517('0x9')]=_['defaults'](config[_0x7517('0x9')],{'host':_0x7517('0xa'),'port':0x18eb});var io=require(_0x7517('0xb'))(new Redis(config[_0x7517('0x9')]));function emit(_0x192ae3,_0x9636a8,_0x5d40dc){io['to'](_0x192ae3)['emit'](_0x9636a8,_0x5d40dc);}function request(_0x2648e8){logger['debug']('[HTTP]',JSON['stringify'](_0x2648e8));return rp(_0x2648e8);}function getCustomFields(_0x534958,_0x242dcc){var _0x3f1098={};if(_0x534958['length']>0x0){_[_0x7517('0xc')](_0x534958,function(_0x5e2404){if(_[_0x7517('0xd')](['string',_0x7517('0xe')],_0x5e2404['type'])&&_0x5e2404[_0x7517('0xf')]){_0x3f1098[_0x5e2404['idField']]=_0x5e2404[_0x7517('0x10')][_0x7517('0x11')]();}else if(_0x5e2404[_0x7517('0x12')]==='variable'&&_0x5e2404[_0x7517('0x13')]&&_0x5e2404[_0x7517('0xf')]&&_0x242dcc[_0x5e2404[_0x7517('0x13')]]){_0x3f1098[_0x5e2404[_0x7517('0xf')]]=_0x242dcc[_0x5e2404['variableName']][_0x7517('0x11')]();}else if(_0x5e2404[_0x7517('0x12')]==='customVariable'&&_0x5e2404[_0x7517('0x14')]&&_0x5e2404[_0x7517('0x14')][_0x7517('0x15')]&&_0x5e2404['idField']&&_0x242dcc[_0x5e2404[_0x7517('0x14')][_0x7517('0x15')][_0x7517('0x16')]()]){_0x3f1098[_0x5e2404[_0x7517('0xf')]]=_0x242dcc[_0x5e2404[_0x7517('0x14')][_0x7517('0x15')]['toLowerCase']()][_0x7517('0x11')]();}});}return _0x3f1098;}function getName(_0x14a292){if(_0x14a292[_0x7517('0x17')]('\x20')>0x0){var _0x356abe=_0x14a292[_0x7517('0x18')](/ (.+)/);if(_0x356abe[0x1]){return _0x356abe;}}return[_0x14a292,_0x14a292];}var accountsTokens={};function getAccessToken(_0x3811db){return new Promise(function(_0x1a4bdd,_0x33ed6c){if(!_[_0x7517('0x19')](accountsTokens[_0x3811db['id']])&&!_[_0x7517('0x19')](accountsTokens[_0x3811db['id']][_0x7517('0x1a')])){if(moment()[_0x7517('0x1b')](accountsTokens[_0x3811db['id']][_0x7517('0x1c')])){_0x1a4bdd(accountsTokens[_0x3811db['id']][_0x7517('0x1a')]);}}var _0x1b89c6;switch(_0x3811db[_0x7517('0x1d')]){case'US':_0x1b89c6='https://accounts.zoho.com';break;case'AU':_0x1b89c6=_0x7517('0x1e');break;case'EU':_0x1b89c6=_0x7517('0x1f');break;case'IN':_0x1b89c6=_0x7517('0x20');break;case'CN':_0x1b89c6=_0x7517('0x21');break;default:_0x1b89c6=_0x7517('0x1f');break;}var _0x5d91eb={'method':_0x7517('0x22'),'uri':_0x1b89c6+'/oauth/v2/token','qs':{'refresh_token':_0x3811db[_0x7517('0x23')],'client_id':_0x3811db[_0x7517('0x24')],'client_secret':_0x3811db[_0x7517('0x25')],'grant_type':_0x7517('0x26')},'json':!![]};return rp(_0x5d91eb)[_0x7517('0x27')](function(_0x211133){accountsTokens[_0x3811db['id']]={'access_token':_0x211133[_0x7517('0x1a')],'expires_in':moment()[_0x7517('0x28')](_0x211133['expires_in'],_0x7517('0x29'))};_0x1a4bdd(_0x211133[_0x7517('0x1a')]);})['catch'](function(_0x2d6faa){logger[_0x7517('0x2a')](_0x7517('0x2b'),_0x2d6faa[_0x7517('0x2c')]);_0x33ed6c(_0x2d6faa);});});}function getUser(_0x22166a,_0x1e56c2,_0x407b9e,_0x30facf){logger[_0x7517('0x2d')](_0x7517('0x2e'));return request({'method':_0x7517('0x2f'),'uri':util['format']('https://www.zohoapis.%s/crm/v2/users',_0x1e56c2),'qs':{'type':_0x7517('0x30')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x22166a},'json':!![]})[_0x7517('0x27')](function(_0x2cff6e){if(_0x2cff6e[_0x7517('0x31')]){var _0x3347a1=-0x1;if(_['isArrayLikeObject'](_0x2cff6e['users'])){if(!_[_0x7517('0x19')](_0x30facf)){_0x3347a1=_[_0x7517('0x32')](_0x2cff6e[_0x7517('0x31')],function(_0x2f9c30){return _0x2f9c30[_0x7517('0x33')]===_0x30facf;});}if(_0x3347a1>=0x0){logger[_0x7517('0x2d')]('Agent\x20found!');}else{logger[_0x7517('0x2d')]('Using\x20the\x20admin\x20account!');_0x3347a1=_['findIndex'](_0x2cff6e[_0x7517('0x31')],function(_0x2e1ee5){return _0x2e1ee5[_0x7517('0x34')][_0x7517('0x15')]==='Administrator';});}return _0x2cff6e['users'][_0x3347a1];}else{if(_0x2cff6e[_0x7517('0x35')][_0x7517('0x34')][_0x7517('0x15')]==='Administrator'){logger[_0x7517('0x2d')](_0x7517('0x36'));user=_0x2cff6e['user'];return user;}else{logger['error'](_0x7517('0x37'),JSON[_0x7517('0x38')](_0x2cff6e));throw new Error(_0x7517('0x39')+JSON[_0x7517('0x38')](_0x2cff6e));}}}else{logger[_0x7517('0x2a')](_0x7517('0x37'),JSON[_0x7517('0x38')](_0x2cff6e));throw new Error(_0x7517('0x39')+JSON[_0x7517('0x38')](_0x2cff6e));}})[_0x7517('0x3a')](function(_0x5712d2){console['error'](_0x5712d2);});}function getZohoUser(_0x1361ce,_0x1e810b){return new BPromise(function(_0x52e280,_0xd770b5){request(_0x1361ce)[_0x7517('0x27')](function(_0x2ba8ea){var _0x49c42d=null;if(_0x2ba8ea){_0x49c42d=_0x2ba8ea['data'][0x0];_0x49c42d[_0x7517('0x3b')]=_0x1e810b;}_0x52e280(_0x49c42d);})['catch'](function(_0x4adbee){_0xd770b5(_0x4adbee);});});}function createEndUser(_0x1032e1,_0xf013e0,_0x35fb67,_0x336975,_0x33f1af,_0x9e124c){var _0x35fb67=getName(_0x35fb67);return request({'method':_0x7517('0x22'),'uri':_0x7517('0x3c')+_0xf013e0+'/crm/v2/'+_['startCase'](_0x9e124c[_0x7517('0x3d')])+'s','body':{'data':[{'Last_Name':_0x35fb67[0x1],'First_Name':_0x35fb67[0x0],'Phone':_0x336975,'Owner':{'name':!_['isNil'](_0x33f1af[_0x7517('0x3e')]['name'])?_0x33f1af[_0x7517('0x3e')][_0x7517('0x15')]:!_[_0x7517('0x19')](_0x33f1af[_0x7517('0x3f')])?_0x33f1af[_0x7517('0x3f')]+'\x20'+_0x33f1af['last_name']:_0x33f1af[_0x7517('0x40')],'id':_0x33f1af['id']}}]},'headers':{'Authorization':_0x7517('0x41')+_0x1032e1},'json':!![]})[_0x7517('0x27')](function(_0xbb25b0){if(_0xbb25b0&&_0xbb25b0[_0x7517('0x42')][0x0][_0x7517('0x43')]===_0x7517('0x44')){var _0x22820b=_0xbb25b0['data'][0x0][_0x7517('0x45')];_0x22820b[_0x7517('0x3b')]=_['startCase'](_0x9e124c[_0x7517('0x3d')])+'s';return _0x22820b;}logger['error'](_0x7517('0x37'),JSON[_0x7517('0x38')](data));throw new Error(_0x7517('0x46')+JSON[_0x7517('0x38')](data));})[_0x7517('0x3a')](function(_0x40e0fc){console[_0x7517('0x47')](_0x7517('0x48'),_0x40e0fc);});}function getEndUser(_0x2d34d8,_0x28483d,_0x514b8d,_0x34c5b9,_0x1d1ec7,_0x371867,_0xa7212f){var _0x4950c={'method':'GET','uri':'','headers':{'Authorization':_0x7517('0x41')+_0x2d34d8},'json':!![]};switch(_0xa7212f[_0x7517('0x49')]){case _0x7517('0x4a'):_0x4950c[_0x7517('0x4b')]=_0x7517('0x3c')+_0x28483d+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x1d1ec7+'))';return getZohoUser(_0x4950c,_0x7517('0x4c'))[_0x7517('0x27')](function(_0x343c33){if(_0x343c33)return _0x343c33;_0x4950c['uri']='https://www.zohoapis.'+_0x28483d+_0x7517('0x4d')+_0x1d1ec7+'))';return getZohoUser(_0x4950c,_0x7517('0x4e'))[_0x7517('0x27')](function(_0x1f6c42){if(_0x1f6c42)return _0x1f6c42;if(_0xa7212f[_0x7517('0x3d')]!='nothing'){return createEndUser(_0x2d34d8,_0x28483d,_0x34c5b9,_0x1d1ec7,_0x371867,_0xa7212f);}else{return{};}});});break;case _0x7517('0x4f'):_0x4950c[_0x7517('0x4b')]=_0x7517('0x3c')+_0x28483d+_0x7517('0x50')+_0x1d1ec7+'))';return getZohoUser(_0x4950c,_0x7517('0x4c'))[_0x7517('0x27')](function(_0x1e53df){if(_0x1e53df)return _0x1e53df;if(_0xa7212f[_0x7517('0x3d')]!=_0x7517('0x51')){return createEndUser(_0x2d34d8,_0x28483d,_0x34c5b9,_0x1d1ec7,_0x371867,_0xa7212f);}else{return{};}});break;case _0x7517('0x52'):_0x4950c[_0x7517('0x4b')]=_0x7517('0x3c')+_0x28483d+_0x7517('0x4d')+_0x1d1ec7+'))';return getZohoUser(_0x4950c,_0x7517('0x4e'))[_0x7517('0x27')](function(_0x801a47){if(_0x801a47)return _0x801a47;if(_0xa7212f[_0x7517('0x3d')]!=_0x7517('0x51')){return createEndUser(_0x2d34d8,_0x28483d,_0x34c5b9,_0x1d1ec7,_0x371867,_0xa7212f);}else{return{};}});break;}}function getCall(_0x29b862,_0x25264d,_0x2932cb,_0x919a0a,_0x37ea22,_0x4c30fb,_0x5f4f33,_0x544ad3){logger[_0x7517('0x2d')](_0x7517('0x53'));var _0x46eb85={};_0x46eb85[_0x7517('0x54')]={'name':!_[_0x7517('0x19')](_0x919a0a[_0x7517('0x3e')]['name'])&&!_[_0x7517('0x19')](_0x919a0a[_0x7517('0x34')][_0x7517('0x15')])&&_0x919a0a[_0x7517('0x34')][_0x7517('0x15')]==='administrator'?_0x919a0a[_0x7517('0x3e')][_0x7517('0x15')]:!_[_0x7517('0x19')](_0x919a0a[_0x7517('0x3f')])?_0x919a0a[_0x7517('0x3f')]+'\x20'+_0x919a0a[_0x7517('0x40')]:_0x919a0a['last_name'],'id':_0x919a0a['id']};_0x46eb85[_0x7517('0x55')]=intUtil[_0x7517('0x56')](_0x4c30fb[_0x7517('0x57')],_0x5f4f33,'\x20');_0x46eb85['Description']=intUtil[_0x7517('0x56')](_0x4c30fb[_0x7517('0x58')],_0x5f4f33,'\x0a');if(_0x37ea22[_0x7517('0x3b')]==='Contacts'){_0x46eb85['Who_Id']={'name':!_[_0x7517('0x19')](_0x37ea22[_0x7517('0x59')])?_0x37ea22[_0x7517('0x59')]:!_[_0x7517('0x19')](_0x37ea22[_0x7517('0x5a')])?_0x37ea22[_0x7517('0x5a')]+'\x20'+_0x37ea22[_0x7517('0x5b')]:_0x37ea22[_0x7517('0x5b')],'id':_0x37ea22['id']};}if(_0x37ea22[_0x7517('0x3b')]===_0x7517('0x4e')){_0x46eb85[_0x7517('0x5c')]={'name':!_[_0x7517('0x19')](_0x37ea22['Full_Name'])?_0x37ea22[_0x7517('0x59')]:!_[_0x7517('0x19')](_0x37ea22[_0x7517('0x5a')])?_0x37ea22[_0x7517('0x5a')]+'\x20'+_0x37ea22[_0x7517('0x5b')]:_0x37ea22[_0x7517('0x5b')],'id':_0x37ea22['id']};_0x46eb85['$se_module']=_['startCase'](_0x37ea22[_0x7517('0x3b')]);}if(_0x5f4f33[_0x7517('0x5d')]){_0x46eb85[_0x7517('0x5e')]=moment[_0x7517('0x5f')](parseInt(_0x5f4f33[_0x7517('0x5d')])*0x3e8)['format'](_0x7517('0x60'));}else if(_0x5f4f33[_0x7517('0x61')]&&_0x5f4f33[_0x7517('0x62')]){_0x46eb85[_0x7517('0x5e')]=moment[_0x7517('0x5f')](moment(_0x5f4f33[_0x7517('0x62')],_0x7517('0x63'))['diff'](moment(_0x5f4f33['starttime'],_0x7517('0x63'))))[_0x7517('0x64')](_0x7517('0x60'));}switch(_0x5f4f33[_0x7517('0x65')]){case _0x7517('0x66'):_0x46eb85[_0x7517('0x67')]=_0x7517('0x68');break;case _0x7517('0x69'):case _0x7517('0x6a'):_0x46eb85[_0x7517('0x67')]='Answered';break;case _0x7517('0x6b'):_0x46eb85['Call_Result']='Rejected';break;case _0x7517('0x6c'):_0x46eb85[_0x7517('0x67')]=_0x7517('0x6d');break;case _0x7517('0x6e'):_0x46eb85[_0x7517('0x67')]=_0x7517('0x6f');default:}_0x46eb85[_0x7517('0x70')]=(_0x544ad3===_0x7517('0x71')?moment(_0x5f4f33['starttime'])[_0x7517('0x64')]('YYYY-MM-DDTHH:mm:ss'):moment(_0x5f4f33[_0x7517('0x72')])[_0x7517('0x64')](_0x7517('0x63')))||moment()[_0x7517('0x64')]('YYYY-MM-DDTHH:mm:ss');_0x46eb85['Call_Type']=_0x544ad3||'Inbound';_0x46eb85=_['merge'](_0x46eb85,getCustomFields(_0x4c30fb['Fields'],_0x5f4f33));return request({'method':_0x7517('0x22'),'uri':_0x7517('0x3c')+_0x25264d+_0x7517('0x73'),'headers':{'Authorization':_0x7517('0x41')+_0x29b862},'body':{'data':[_0x46eb85]},'json':!![]})[_0x7517('0x27')](function(_0x5646b8){if(_0x5646b8&&_0x5646b8[_0x7517('0x42')][0x0][_0x7517('0x43')]===_0x7517('0x44')){logger[_0x7517('0x2d')](_0x7517('0x74'));return{'id':_0x5646b8[_0x7517('0x42')][0x0]['details']['id']};}})['catch'](function(_0xccaae1){logger[_0x7517('0x2d')](_0x7517('0x75'),_0xccaae1[_0x7517('0x2c')]);console[_0x7517('0x47')](_0x7517('0x75'),_0xccaae1);});}exports[_0x7517('0x76')]=function(_0x3696e2,_0x2444ca,_0x510ead,_0x37fb84,_0x297403,_0x179f55){var _0x4dd65e,_0x55ec76,_0x5c985f;_0x179f55[_0x7517('0x77')]=intUtil['stripTrailingSlash'](_0x179f55[_0x7517('0x77')]);_0x179f55[_0x7517('0x78')]=intUtil['stripTrailingSlash'](_0x179f55['serverUrl']);if(_0x297403&&_0x297403[_0x7517('0x79')]){logger['info'](_0x7517('0x7a'),_0x7517('0x7b'));_0x2444ca[_0x7517('0x7c')]=_0x179f55[_0x7517('0x78')]+'/api/voice/recordings/'+_0x2444ca[_0x7517('0x7d')]+_0x7517('0x7e')+md5(_0x2444ca['uniqueid']);}else{_0x2444ca[_0x7517('0x7c')]='';}var _0x534aad=_0x179f55[_0x7517('0x77')]===_0x7517('0x7f')?'eu':'com';return getAccessToken(_0x179f55)[_0x7517('0x27')](function(_0x14c86e){_0x5c985f=_0x14c86e;return getUser(_0x5c985f,_0x534aad,_0x179f55,_0x37fb84[_0x7517('0x33')]);})[_0x7517('0x27')](function(_0x2fa441){_0x4dd65e=_0x2fa441;logger[_0x7517('0x2d')](_0x7517('0x80'),_0x4dd65e['id']);return getEndUser(_0x5c985f,_0x534aad,_0x179f55,_0x2444ca[_0x7517('0x81')],_0x2444ca['calleridnum'],_0x4dd65e,_0x510ead);})[_0x7517('0x27')](function(_0x2171e0){_0x55ec76=_0x2171e0;return getCall(_0x5c985f,_0x534aad,_0x179f55,_0x4dd65e,_0x55ec76,_0x510ead,_0x2444ca,_0x7517('0x82'));})[_0x7517('0x27')](function(_0x136139){if(_0x136139){logger[_0x7517('0x2d')]('The\x20Call\x20ID\x20is:',_0x136139['id']);logger[_0x7517('0x2d')](_0x7517('0x7a'),_0x7517('0x83'));emit(util[_0x7517('0x64')](_0x7517('0x84'),_0x37fb84[_0x7517('0x15')]),_0x7517('0x85'),{'uri':_0x7517('0x86')+_0x179f55[_0x7517('0x77')]+_0x7517('0x87')+_0x136139['id']});}})[_0x7517('0x3a')](function(_0x39fac7){logger['error'](_0x7517('0x7a'),JSON[_0x7517('0x38')](_0x39fac7));});};exports[_0x7517('0x71')]=function(_0x4bd6ff,_0x4f51ac,_0x21ac1c,_0x36c910,_0x2f3ba2,_0x298626,_0x588f60){var _0x52faac,_0x5d0cea,_0x2932c6;_0x298626['host']=intUtil[_0x7517('0x88')](_0x298626['host']);_0x298626['serverUrl']=intUtil[_0x7517('0x88')](_0x298626[_0x7517('0x78')]);if(_0x588f60&&_0x588f60[_0x7517('0x89')]&&_0x588f60[_0x7517('0x89')]!=='none'){logger[_0x7517('0x2d')](_0x7517('0x8a'),_0x7517('0x7b'));_0x4f51ac[_0x7517('0x7c')]=_0x298626['serverUrl']+'/api/voice/recordings/'+_0x4f51ac[_0x7517('0x7d')]+_0x7517('0x7e')+md5(_0x4f51ac['uniqueid']);}var _0x31ed00=_0x298626[_0x7517('0x77')]===_0x7517('0x7f')?'eu':_0x7517('0x8b');return getAccessToken(_0x298626)[_0x7517('0x27')](function(_0x51c47b){_0x2932c6=_0x51c47b;return getUser(_0x2932c6,_0x31ed00,_0x298626,_0x36c910[_0x7517('0x33')]);})[_0x7517('0x27')](function(_0x37f977){_0x52faac=_0x37f977;logger[_0x7517('0x2d')](_0x7517('0x80'),_0x52faac['id']);return getEndUser(_0x2932c6,_0x31ed00,_0x298626,_0x4f51ac[_0x7517('0x8c')],_0x4f51ac[_0x7517('0x8d')],_0x52faac,_0x21ac1c);})['then'](function(_0x4b24bd){_0x5d0cea=_0x4b24bd;return getCall(_0x2932c6,_0x31ed00,_0x298626,_0x52faac,_0x5d0cea,_0x21ac1c,_0x4f51ac,_0x7517('0x8e'));})[_0x7517('0x27')](function(_0x45c7dc){if(_0x45c7dc){logger[_0x7517('0x2d')](_0x7517('0x8f'),_0x45c7dc['id']);logger[_0x7517('0x2d')](_0x7517('0x8a'),_0x7517('0x83'));emit(util[_0x7517('0x64')](_0x7517('0x84'),_0x36c910[_0x7517('0x15')]),_0x7517('0x85'),{'uri':_0x7517('0x86')+_0x298626[_0x7517('0x77')]+_0x7517('0x87')+_0x45c7dc['id']});}})[_0x7517('0x3a')](function(_0x2f9c05){logger['error']('[OUTBOUND]',JSON['stringify'](_0x2f9c05));});};exports[_0x7517('0x90')]=function(_0x374f7c,_0x4d0356,_0x435f28,_0x4c250f,_0x164d38,_0x1ee7bb){var _0x26e84c,_0x2594c5,_0x1c2cda;_0x1ee7bb[_0x7517('0x77')]=intUtil[_0x7517('0x88')](_0x1ee7bb[_0x7517('0x77')]);_0x1ee7bb[_0x7517('0x78')]=intUtil[_0x7517('0x88')](_0x1ee7bb[_0x7517('0x78')]);if(_0x164d38&&_0x164d38[_0x7517('0x79')]){logger[_0x7517('0x2d')]('['+_0x4d0356[_0x7517('0x65')][_0x7517('0x91')]()+']','Recording\x20is\x20enabled!');_0x4d0356[_0x7517('0x7c')]=_0x1ee7bb[_0x7517('0x78')]+'/api/voice/recordings/'+_0x4d0356[_0x7517('0x7d')]+_0x7517('0x7e')+md5(_0x4d0356[_0x7517('0x7d')]);}else{_0x4d0356[_0x7517('0x7c')]='';}var _0x543728=_0x1ee7bb[_0x7517('0x77')]==='zoho.eu'?'eu':_0x7517('0x8b');return getAccessToken(_0x1ee7bb)['then'](function(_0x5a5378){_0x1c2cda=_0x5a5378;return getUser(_0x1c2cda,_0x543728,_0x1ee7bb);})['then'](function(_0x310dd7){_0x26e84c=_0x310dd7;logger[_0x7517('0x2d')](_0x7517('0x80'),_0x26e84c['id']);return getEndUser(_0x1c2cda,_0x543728,_0x1ee7bb,_0x4d0356[_0x7517('0x81')],_0x4d0356[_0x7517('0x92')],_0x26e84c,_0x435f28);})[_0x7517('0x27')](function(_0x156606){_0x2594c5=_0x156606;return getCall(_0x1c2cda,_0x543728,_0x1ee7bb,_0x26e84c,_0x2594c5,_0x435f28,_0x4d0356,'Inbound');})[_0x7517('0x27')](function(_0x1a76c7){if(_0x1a76c7){logger[_0x7517('0x2d')](_0x7517('0x8f'),_0x1a76c7['id']);}})['catch'](function(_0x138865){logger['error']('['+_0x4d0356[_0x7517('0x65')]['toUpperCase']()+']',JSON[_0x7517('0x38')](_0x138865));});}; \ No newline at end of file +var _0x4c1f=['Inbound','merge','/crm/v2/Calls','err','stack','queue','host','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','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','email','destcalleridname','destcalleridnum','Outbound','[OUTBOUND]','unmanaged','toUpperCase','lodash','request-promise','md5','util','./util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','[HTTP]','stringify','forEach','string','picklist','idField','content','toString','type','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','access_token','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','POST','/oauth/v2/token','clientSecret','refresh_token','then','add','expires_in','seconds','catch','error','Failing\x20creating\x20the\x20access_token','info','Search\x20user','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','Agent\x20found!','profile','Administrator','user','The\x20failing\x20result\x20is','enduserType','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','data','code','SUCCESS','Error:\x20','log','CREATE\x20ERROR','GET','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','Creating\x20new\x20call...','Owner','administrator','Subject','getString','Subjects','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','utc','mm:ss','endtime','YYYY-MM-DDTHH:mm:ss','starttime','format','lastevent','Call_Result','complete','connect','Answered','Rejected','Abandoned','Timeout','Call_Start_Time','agentcalledAt','Call_Type'];(function(_0x2a16fc,_0x25126d){var _0x2012a6=function(_0x2d3214){while(--_0x2d3214){_0x2a16fc['push'](_0x2a16fc['shift']());}};_0x2012a6(++_0x25126d);}(_0x4c1f,0x14f));var _0xf4c1=function(_0x3bef99,_0x1b66f2){_0x3bef99=_0x3bef99-0x0;var _0x22c32e=_0x4c1f[_0x3bef99];return _0x22c32e;};'use strict';var _=require(_0xf4c1('0x0'));var rp=require(_0xf4c1('0x1'));var md5=require(_0xf4c1('0x2'));var util=require(_0xf4c1('0x3'));var intUtil=require(_0xf4c1('0x4'));var moment=require(_0xf4c1('0x5'));var Redis=require(_0xf4c1('0x6'));var BPromise=require(_0xf4c1('0x7'));var config=require(_0xf4c1('0x8'));var logger=require(_0xf4c1('0x9'))('zoho');config[_0xf4c1('0xa')]=_[_0xf4c1('0xb')](config[_0xf4c1('0xa')],{'host':_0xf4c1('0xc'),'port':0x18eb});var io=require(_0xf4c1('0xd'))(new Redis(config[_0xf4c1('0xa')]));function emit(_0x3dec35,_0x35eaab,_0x4b51be){io['to'](_0x3dec35)[_0xf4c1('0xe')](_0x35eaab,_0x4b51be);}function request(_0x174076){logger['debug'](_0xf4c1('0xf'),JSON[_0xf4c1('0x10')](_0x174076));return rp(_0x174076);}function getCustomFields(_0x427558,_0x1cfd83){var _0x336fd5={};if(_0x427558['length']>0x0){_[_0xf4c1('0x11')](_0x427558,function(_0xa5860f){if(_['includes']([_0xf4c1('0x12'),_0xf4c1('0x13')],_0xa5860f['type'])&&_0xa5860f[_0xf4c1('0x14')]){_0x336fd5[_0xa5860f[_0xf4c1('0x14')]]=_0xa5860f[_0xf4c1('0x15')][_0xf4c1('0x16')]();}else if(_0xa5860f[_0xf4c1('0x17')]==='variable'&&_0xa5860f['variableName']&&_0xa5860f[_0xf4c1('0x14')]&&_0x1cfd83[_0xa5860f[_0xf4c1('0x18')]]){_0x336fd5[_0xa5860f[_0xf4c1('0x14')]]=_0x1cfd83[_0xa5860f[_0xf4c1('0x18')]]['toString']();}else if(_0xa5860f[_0xf4c1('0x17')]===_0xf4c1('0x19')&&_0xa5860f[_0xf4c1('0x1a')]&&_0xa5860f[_0xf4c1('0x1a')][_0xf4c1('0x1b')]&&_0xa5860f[_0xf4c1('0x14')]&&_0x1cfd83[_0xa5860f[_0xf4c1('0x1a')][_0xf4c1('0x1b')][_0xf4c1('0x1c')]()]){_0x336fd5[_0xa5860f[_0xf4c1('0x14')]]=_0x1cfd83[_0xa5860f[_0xf4c1('0x1a')][_0xf4c1('0x1b')][_0xf4c1('0x1c')]()][_0xf4c1('0x16')]();}});}return _0x336fd5;}function getName(_0x245634){if(_0x245634[_0xf4c1('0x1d')]('\x20')>0x0){var _0x4eea48=_0x245634[_0xf4c1('0x1e')](/ (.+)/);if(_0x4eea48[0x1]){return _0x4eea48;}}return[_0x245634,_0x245634];}var accountsTokens={};function getAccessToken(_0x218d1b){return new Promise(function(_0xbfe1c2,_0x246ec6){if(!_[_0xf4c1('0x1f')](accountsTokens[_0x218d1b['id']])&&!_[_0xf4c1('0x1f')](accountsTokens[_0x218d1b['id']][_0xf4c1('0x20')])){if(moment()['isBefore'](accountsTokens[_0x218d1b['id']]['expires_in'])){_0xbfe1c2(accountsTokens[_0x218d1b['id']][_0xf4c1('0x20')]);}}var _0x1a816c;switch(_0x218d1b[_0xf4c1('0x21')]){case'US':_0x1a816c=_0xf4c1('0x22');break;case'AU':_0x1a816c=_0xf4c1('0x23');break;case'EU':_0x1a816c=_0xf4c1('0x24');break;case'IN':_0x1a816c=_0xf4c1('0x25');break;case'CN':_0x1a816c='https://accounts.zoho.com.cn';break;default:_0x1a816c=_0xf4c1('0x24');break;}var _0x1e216e={'method':_0xf4c1('0x26'),'uri':_0x1a816c+_0xf4c1('0x27'),'qs':{'refresh_token':_0x218d1b['refreshToken'],'client_id':_0x218d1b['clientId'],'client_secret':_0x218d1b[_0xf4c1('0x28')],'grant_type':_0xf4c1('0x29')},'json':!![]};return rp(_0x1e216e)[_0xf4c1('0x2a')](function(_0x3c7ca5){accountsTokens[_0x218d1b['id']]={'access_token':_0x3c7ca5['access_token'],'expires_in':moment()[_0xf4c1('0x2b')](_0x3c7ca5[_0xf4c1('0x2c')],_0xf4c1('0x2d'))};_0xbfe1c2(_0x3c7ca5[_0xf4c1('0x20')]);})[_0xf4c1('0x2e')](function(_0x1bfc72){logger[_0xf4c1('0x2f')](_0xf4c1('0x30'),_0x1bfc72['stack']);_0x246ec6(_0x1bfc72);});});}function getUser(_0x4a5fab,_0x55bc18,_0x2c4df1,_0x24b8c3){logger[_0xf4c1('0x31')](_0xf4c1('0x32'));return request({'method':'GET','uri':util['format'](_0xf4c1('0x33'),_0x55bc18),'qs':{'type':_0xf4c1('0x34')},'headers':{'Authorization':_0xf4c1('0x35')+_0x4a5fab},'json':!![]})[_0xf4c1('0x2a')](function(_0x2ff197){if(_0x2ff197[_0xf4c1('0x36')]){var _0x3c0537=-0x1;if(_[_0xf4c1('0x37')](_0x2ff197[_0xf4c1('0x36')])){if(!_['isNil'](_0x24b8c3)){_0x3c0537=_[_0xf4c1('0x38')](_0x2ff197[_0xf4c1('0x36')],function(_0x24d171){return _0x24d171['email']===_0x24b8c3;});}if(_0x3c0537>=0x0){logger[_0xf4c1('0x31')](_0xf4c1('0x39'));}else{logger[_0xf4c1('0x31')]('Using\x20the\x20admin\x20account!');_0x3c0537=_['findIndex'](_0x2ff197[_0xf4c1('0x36')],function(_0x208fdd){return _0x208fdd[_0xf4c1('0x3a')]['name']===_0xf4c1('0x3b');});}return _0x2ff197[_0xf4c1('0x36')][_0x3c0537];}else{if(_0x2ff197[_0xf4c1('0x3c')]['profile'][_0xf4c1('0x1b')]===_0xf4c1('0x3b')){logger[_0xf4c1('0x31')]('Using\x20the\x20admin\x20account!');user=_0x2ff197[_0xf4c1('0x3c')];return user;}else{logger[_0xf4c1('0x2f')](_0xf4c1('0x3d'),JSON[_0xf4c1('0x10')](_0x2ff197));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0xf4c1('0x10')](_0x2ff197));}}}else{logger[_0xf4c1('0x2f')](_0xf4c1('0x3d'),JSON['stringify'](_0x2ff197));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0xf4c1('0x10')](_0x2ff197));}})[_0xf4c1('0x2e')](function(_0x484910){console[_0xf4c1('0x2f')](_0x484910);});}function getZohoUser(_0x1167d1,_0x5332d5){return new BPromise(function(_0x5db53d,_0x1b9a00){request(_0x1167d1)[_0xf4c1('0x2a')](function(_0x1d149c){var _0x948e0f=null;if(_0x1d149c){_0x948e0f=_0x1d149c['data'][0x0];_0x948e0f[_0xf4c1('0x3e')]=_0x5332d5;}_0x5db53d(_0x948e0f);})[_0xf4c1('0x2e')](function(_0x2e5ddb){_0x1b9a00(_0x2e5ddb);});});}function createEndUser(_0x430e41,_0x5f1c1e,_0x136908,_0xb43590,_0x1a966e,_0x474eaf){var _0x136908=getName(_0x136908);return request({'method':'POST','uri':_0xf4c1('0x3f')+_0x5f1c1e+_0xf4c1('0x40')+_[_0xf4c1('0x41')](_0x474eaf[_0xf4c1('0x42')])+'s','body':{'data':[{'Last_Name':_0x136908[0x1],'First_Name':_0x136908[0x0],'Phone':_0xb43590,'Owner':{'name':!_[_0xf4c1('0x1f')](_0x1a966e[_0xf4c1('0x43')][_0xf4c1('0x1b')])?_0x1a966e[_0xf4c1('0x43')]['name']:!_[_0xf4c1('0x1f')](_0x1a966e[_0xf4c1('0x44')])?_0x1a966e['first_name']+'\x20'+_0x1a966e[_0xf4c1('0x45')]:_0x1a966e[_0xf4c1('0x45')],'id':_0x1a966e['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x430e41},'json':!![]})[_0xf4c1('0x2a')](function(_0x4d0c81){if(_0x4d0c81&&_0x4d0c81[_0xf4c1('0x46')][0x0][_0xf4c1('0x47')]===_0xf4c1('0x48')){var _0x361c62=_0x4d0c81[_0xf4c1('0x46')][0x0]['details'];_0x361c62[_0xf4c1('0x3e')]=_[_0xf4c1('0x41')](_0x474eaf[_0xf4c1('0x42')])+'s';return _0x361c62;}logger['error'](_0xf4c1('0x3d'),JSON[_0xf4c1('0x10')](data));throw new Error(_0xf4c1('0x49')+JSON[_0xf4c1('0x10')](data));})['catch'](function(_0x194dbd){console[_0xf4c1('0x4a')](_0xf4c1('0x4b'),_0x194dbd);});}function getEndUser(_0x3441a4,_0x4a3153,_0x2c7e1a,_0xc21ca2,_0x187414,_0x439dc6,_0x41e1a2){var _0x4575cd={'method':_0xf4c1('0x4c'),'uri':'','headers':{'Authorization':_0xf4c1('0x35')+_0x3441a4},'json':!![]};switch(_0x41e1a2[_0xf4c1('0x4d')]){case _0xf4c1('0x4e'):_0x4575cd[_0xf4c1('0x4f')]=_0xf4c1('0x3f')+_0x4a3153+_0xf4c1('0x50')+_0x187414+'))';return getZohoUser(_0x4575cd,_0xf4c1('0x51'))['then'](function(_0x331c8a){if(_0x331c8a)return _0x331c8a;_0x4575cd[_0xf4c1('0x4f')]=_0xf4c1('0x3f')+_0x4a3153+_0xf4c1('0x52')+_0x187414+'))';return getZohoUser(_0x4575cd,_0xf4c1('0x53'))[_0xf4c1('0x2a')](function(_0x3fc83f){if(_0x3fc83f)return _0x3fc83f;if(_0x41e1a2[_0xf4c1('0x42')]!=_0xf4c1('0x54')){return createEndUser(_0x3441a4,_0x4a3153,_0xc21ca2,_0x187414,_0x439dc6,_0x41e1a2);}else{return{};}});});break;case _0xf4c1('0x55'):_0x4575cd[_0xf4c1('0x4f')]='https://www.zohoapis.'+_0x4a3153+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x187414+'))';return getZohoUser(_0x4575cd,_0xf4c1('0x51'))[_0xf4c1('0x2a')](function(_0x4a23e0){if(_0x4a23e0)return _0x4a23e0;if(_0x41e1a2[_0xf4c1('0x42')]!=_0xf4c1('0x54')){return createEndUser(_0x3441a4,_0x4a3153,_0xc21ca2,_0x187414,_0x439dc6,_0x41e1a2);}else{return{};}});break;case'lead':_0x4575cd[_0xf4c1('0x4f')]='https://www.zohoapis.'+_0x4a3153+_0xf4c1('0x52')+_0x187414+'))';return getZohoUser(_0x4575cd,_0xf4c1('0x53'))[_0xf4c1('0x2a')](function(_0x277d6c){if(_0x277d6c)return _0x277d6c;if(_0x41e1a2[_0xf4c1('0x42')]!='nothing'){return createEndUser(_0x3441a4,_0x4a3153,_0xc21ca2,_0x187414,_0x439dc6,_0x41e1a2);}else{return{};}});break;}}function getCall(_0x4d55c1,_0x4ce791,_0x183265,_0x21204a,_0xaa30a1,_0x18ee93,_0x5b0012,_0x13ae08){logger[_0xf4c1('0x31')](_0xf4c1('0x56'));var _0x5e6220={};_0x5e6220[_0xf4c1('0x57')]={'name':!_[_0xf4c1('0x1f')](_0x21204a['role'][_0xf4c1('0x1b')])&&!_[_0xf4c1('0x1f')](_0x21204a['profile'][_0xf4c1('0x1b')])&&_0x21204a[_0xf4c1('0x3a')][_0xf4c1('0x1b')]===_0xf4c1('0x58')?_0x21204a[_0xf4c1('0x43')][_0xf4c1('0x1b')]:!_[_0xf4c1('0x1f')](_0x21204a[_0xf4c1('0x44')])?_0x21204a[_0xf4c1('0x44')]+'\x20'+_0x21204a[_0xf4c1('0x45')]:_0x21204a[_0xf4c1('0x45')],'id':_0x21204a['id']};_0x5e6220[_0xf4c1('0x59')]=intUtil[_0xf4c1('0x5a')](_0x18ee93[_0xf4c1('0x5b')],_0x5b0012,'\x20');_0x5e6220['Description']=intUtil[_0xf4c1('0x5a')](_0x18ee93[_0xf4c1('0x5c')],_0x5b0012,'\x0a');if(_0xaa30a1[_0xf4c1('0x3e')]===_0xf4c1('0x51')){_0x5e6220[_0xf4c1('0x5d')]={'name':!_[_0xf4c1('0x1f')](_0xaa30a1[_0xf4c1('0x5e')])?_0xaa30a1[_0xf4c1('0x5e')]:!_[_0xf4c1('0x1f')](_0xaa30a1['First_Name'])?_0xaa30a1[_0xf4c1('0x5f')]+'\x20'+_0xaa30a1[_0xf4c1('0x60')]:_0xaa30a1[_0xf4c1('0x60')],'id':_0xaa30a1['id']};}if(_0xaa30a1[_0xf4c1('0x3e')]===_0xf4c1('0x53')){_0x5e6220[_0xf4c1('0x61')]={'name':!_['isNil'](_0xaa30a1[_0xf4c1('0x5e')])?_0xaa30a1[_0xf4c1('0x5e')]:!_[_0xf4c1('0x1f')](_0xaa30a1[_0xf4c1('0x5f')])?_0xaa30a1[_0xf4c1('0x5f')]+'\x20'+_0xaa30a1[_0xf4c1('0x60')]:_0xaa30a1['Last_Name'],'id':_0xaa30a1['id']};_0x5e6220[_0xf4c1('0x62')]=_[_0xf4c1('0x41')](_0xaa30a1[_0xf4c1('0x3e')]);}if(_0x5b0012[_0xf4c1('0x63')]){_0x5e6220[_0xf4c1('0x64')]=moment[_0xf4c1('0x65')](parseInt(_0x5b0012[_0xf4c1('0x63')])*0x3e8)['format'](_0xf4c1('0x66'));}else if(_0x5b0012['answertime']&&_0x5b0012[_0xf4c1('0x67')]){_0x5e6220[_0xf4c1('0x64')]=moment[_0xf4c1('0x65')](moment(_0x5b0012[_0xf4c1('0x67')],_0xf4c1('0x68'))['diff'](moment(_0x5b0012[_0xf4c1('0x69')],_0xf4c1('0x68'))))[_0xf4c1('0x6a')]('mm:ss');}switch(_0x5b0012[_0xf4c1('0x6b')]){case'called':_0x5e6220[_0xf4c1('0x6c')]='Called';break;case _0xf4c1('0x6d'):case _0xf4c1('0x6e'):_0x5e6220['Call_Result']=_0xf4c1('0x6f');break;case'rejected':_0x5e6220[_0xf4c1('0x6c')]=_0xf4c1('0x70');break;case'abandoned':_0x5e6220[_0xf4c1('0x6c')]=_0xf4c1('0x71');break;case'timeout':_0x5e6220[_0xf4c1('0x6c')]=_0xf4c1('0x72');default:}_0x5e6220[_0xf4c1('0x73')]=(_0x13ae08==='outbound'?moment(_0x5b0012[_0xf4c1('0x69')])[_0xf4c1('0x6a')](_0xf4c1('0x68')):moment(_0x5b0012[_0xf4c1('0x74')])[_0xf4c1('0x6a')](_0xf4c1('0x68')))||moment()[_0xf4c1('0x6a')](_0xf4c1('0x68'));_0x5e6220[_0xf4c1('0x75')]=_0x13ae08||_0xf4c1('0x76');_0x5e6220=_[_0xf4c1('0x77')](_0x5e6220,getCustomFields(_0x18ee93['Fields'],_0x5b0012));return request({'method':'POST','uri':_0xf4c1('0x3f')+_0x4ce791+_0xf4c1('0x78'),'headers':{'Authorization':_0xf4c1('0x35')+_0x4d55c1},'body':{'data':[_0x5e6220]},'json':!![]})[_0xf4c1('0x2a')](function(_0x2b505b){if(_0x2b505b&&_0x2b505b['data'][0x0][_0xf4c1('0x47')]===_0xf4c1('0x48')){logger[_0xf4c1('0x31')]('Call\x20created!');return{'id':_0x2b505b[_0xf4c1('0x46')][0x0]['details']['id']};}})[_0xf4c1('0x2e')](function(_0x425b17){logger['info'](_0xf4c1('0x79'),_0x425b17[_0xf4c1('0x7a')]);console[_0xf4c1('0x4a')]('err',_0x425b17);});}exports[_0xf4c1('0x7b')]=function(_0x2547a1,_0x3fb9b4,_0x151dd4,_0x2cb9f1,_0x24c849,_0x49e23a){var _0x3b40fc,_0x554aa5,_0x2fc446;_0x49e23a[_0xf4c1('0x7c')]=intUtil[_0xf4c1('0x7d')](_0x49e23a[_0xf4c1('0x7c')]);_0x49e23a[_0xf4c1('0x7e')]=intUtil[_0xf4c1('0x7d')](_0x49e23a[_0xf4c1('0x7e')]);if(_0x24c849&&_0x24c849['monitor_format']){logger[_0xf4c1('0x31')](_0xf4c1('0x7f'),_0xf4c1('0x80'));_0x3fb9b4[_0xf4c1('0x81')]=_0x49e23a[_0xf4c1('0x7e')]+'/api/voice/recordings/'+_0x3fb9b4[_0xf4c1('0x82')]+_0xf4c1('0x83')+md5(_0x3fb9b4[_0xf4c1('0x82')]);}else{_0x3fb9b4[_0xf4c1('0x81')]='';}var _0x172855=_0x49e23a['host']===_0xf4c1('0x84')?'eu':_0xf4c1('0x85');return getAccessToken(_0x49e23a)[_0xf4c1('0x2a')](function(_0x4a738a){_0x2fc446=_0x4a738a;return getUser(_0x2fc446,_0x172855,_0x49e23a,_0x2cb9f1['email']);})['then'](function(_0x219f1b){_0x3b40fc=_0x219f1b;logger[_0xf4c1('0x31')](_0xf4c1('0x86'),_0x3b40fc['id']);return getEndUser(_0x2fc446,_0x172855,_0x49e23a,_0x3fb9b4[_0xf4c1('0x87')],_0x3fb9b4[_0xf4c1('0x88')],_0x3b40fc,_0x151dd4);})['then'](function(_0x358b68){_0x554aa5=_0x358b68;return getCall(_0x2fc446,_0x172855,_0x49e23a,_0x3b40fc,_0x554aa5,_0x151dd4,_0x3fb9b4,_0xf4c1('0x76'));})['then'](function(_0xfdbd67){if(_0xfdbd67){logger[_0xf4c1('0x31')](_0xf4c1('0x89'),_0xfdbd67['id']);logger['info'](_0xf4c1('0x7f'),_0xf4c1('0x8a'));emit(util[_0xf4c1('0x6a')]('user:%s',_0x2cb9f1[_0xf4c1('0x1b')]),_0xf4c1('0x8b'),{'uri':_0xf4c1('0x8c')+_0x49e23a[_0xf4c1('0x7c')]+_0xf4c1('0x8d')+_0xfdbd67['id']});}})['catch'](function(_0xb4bfc){logger[_0xf4c1('0x2f')]('[QUEUE]',JSON['stringify'](_0xb4bfc));});};exports['outbound']=function(_0x28be29,_0x521bf5,_0x56e1b3,_0x1bf794,_0xd724ba,_0x4aeca6,_0x3712ca){var _0x874851,_0x3db1a5,_0x5844ba;_0x4aeca6[_0xf4c1('0x7c')]=intUtil[_0xf4c1('0x7d')](_0x4aeca6['host']);_0x4aeca6[_0xf4c1('0x7e')]=intUtil['stripTrailingSlash'](_0x4aeca6[_0xf4c1('0x7e')]);if(_0x3712ca&&_0x3712ca[_0xf4c1('0x8e')]&&_0x3712ca[_0xf4c1('0x8e')]!==_0xf4c1('0x8f')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x521bf5[_0xf4c1('0x81')]=_0x4aeca6[_0xf4c1('0x7e')]+'/api/voice/recordings/'+_0x521bf5[_0xf4c1('0x82')]+_0xf4c1('0x83')+md5(_0x521bf5['uniqueid']);}var _0x571bbd=_0x4aeca6[_0xf4c1('0x7c')]==='zoho.eu'?'eu':_0xf4c1('0x85');return getAccessToken(_0x4aeca6)[_0xf4c1('0x2a')](function(_0x9fa24d){_0x5844ba=_0x9fa24d;return getUser(_0x5844ba,_0x571bbd,_0x4aeca6,_0x1bf794[_0xf4c1('0x90')]);})[_0xf4c1('0x2a')](function(_0x5f31f9){_0x874851=_0x5f31f9;logger[_0xf4c1('0x31')](_0xf4c1('0x86'),_0x874851['id']);return getEndUser(_0x5844ba,_0x571bbd,_0x4aeca6,_0x521bf5[_0xf4c1('0x91')],_0x521bf5[_0xf4c1('0x92')],_0x874851,_0x56e1b3);})[_0xf4c1('0x2a')](function(_0x2db58a){_0x3db1a5=_0x2db58a;return getCall(_0x5844ba,_0x571bbd,_0x4aeca6,_0x874851,_0x3db1a5,_0x56e1b3,_0x521bf5,_0xf4c1('0x93'));})[_0xf4c1('0x2a')](function(_0x5aeef4){if(_0x5aeef4){logger[_0xf4c1('0x31')](_0xf4c1('0x89'),_0x5aeef4['id']);logger[_0xf4c1('0x31')](_0xf4c1('0x94'),_0xf4c1('0x8a'));emit(util[_0xf4c1('0x6a')]('user:%s',_0x1bf794[_0xf4c1('0x1b')]),_0xf4c1('0x8b'),{'uri':_0xf4c1('0x8c')+_0x4aeca6[_0xf4c1('0x7c')]+_0xf4c1('0x8d')+_0x5aeef4['id']});}})[_0xf4c1('0x2e')](function(_0x1d652f){logger['error'](_0xf4c1('0x94'),JSON[_0xf4c1('0x10')](_0x1d652f));});};exports[_0xf4c1('0x95')]=function(_0x2c1fac,_0x49fc05,_0x270d3c,_0x36db76,_0x63082,_0x3e2293){var _0x975466,_0x22bfb1,_0x374dbf;_0x3e2293['host']=intUtil[_0xf4c1('0x7d')](_0x3e2293['host']);_0x3e2293['serverUrl']=intUtil['stripTrailingSlash'](_0x3e2293['serverUrl']);if(_0x63082&&_0x63082['monitor_format']){logger[_0xf4c1('0x31')]('['+_0x49fc05[_0xf4c1('0x6b')][_0xf4c1('0x96')]()+']',_0xf4c1('0x80'));_0x49fc05[_0xf4c1('0x81')]=_0x3e2293['serverUrl']+'/api/voice/recordings/'+_0x49fc05[_0xf4c1('0x82')]+_0xf4c1('0x83')+md5(_0x49fc05[_0xf4c1('0x82')]);}else{_0x49fc05[_0xf4c1('0x81')]='';}var _0x58bd7a=_0x3e2293['host']===_0xf4c1('0x84')?'eu':_0xf4c1('0x85');return getAccessToken(_0x3e2293)[_0xf4c1('0x2a')](function(_0x578c86){_0x374dbf=_0x578c86;return getUser(_0x374dbf,_0x58bd7a,_0x3e2293);})[_0xf4c1('0x2a')](function(_0x1b3494){_0x975466=_0x1b3494;logger[_0xf4c1('0x31')]('The\x20User\x20ID\x20is:',_0x975466['id']);return getEndUser(_0x374dbf,_0x58bd7a,_0x3e2293,_0x49fc05[_0xf4c1('0x87')],_0x49fc05['calleridnum'],_0x975466,_0x270d3c);})['then'](function(_0x2dfe36){_0x22bfb1=_0x2dfe36;return getCall(_0x374dbf,_0x58bd7a,_0x3e2293,_0x975466,_0x22bfb1,_0x270d3c,_0x49fc05,_0xf4c1('0x76'));})[_0xf4c1('0x2a')](function(_0x44c0d4){if(_0x44c0d4){logger['info'](_0xf4c1('0x89'),_0x44c0d4['id']);}})[_0xf4c1('0x2e')](function(_0x3ef407){logger[_0xf4c1('0x2f')]('['+_0x49fc05[_0xf4c1('0x6b')][_0xf4c1('0x96')]()+']',JSON[_0xf4c1('0x10')](_0x3ef407));});}; \ 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 8f8c2b6..e81dd9d 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 _0x70fe=['Script','data3','render','error','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','mustache','../../../../config/logger','trigger','exec','data2'];(function(_0x4a7631,_0x2c85b9){var _0x1a5a6f=function(_0x1ee3fd){while(--_0x1ee3fd){_0x4a7631['push'](_0x4a7631['shift']());}};_0x1a5a6f(++_0x2c85b9);}(_0x70fe,0x1f1));var _0xe70f=function(_0x5171f5,_0x2bf66c){_0x5171f5=_0x5171f5-0x0;var _0x1d6cfa=_0x70fe[_0x5171f5];return _0x1d6cfa;};'use strict';var util=require(_0xe70f('0x0'));var sh=require(_0xe70f('0x1'));var Mustache=require(_0xe70f('0x2'));var logger=require(_0xe70f('0x3'))(_0xe70f('0x4'));exports[_0xe70f('0x5')]=function(_0x5ec499,_0x69984e){var _0x3c56cd=_0x5ec499[_0xe70f('0x6')]?_0x5ec499[_0xe70f('0x6')]:_0xe70f('0x7');var _0x7ca513=_0x5ec499[_0xe70f('0x8')]?Mustache[_0xe70f('0x9')](_0x5ec499[_0xe70f('0x8')],_0x69984e):_0x69984e;sh[_0xe70f('0x5')](_0x7ca513,function(_0x4d9683,_0x34f7ff,_0x2ea471){if(_0x4d9683!==0x0){logger[_0xe70f('0xa')](util['format'](_0xe70f('0xb'),_0x3c56cd,_0x7ca513,_0x4d9683,_0x2ea471));}else{logger[_0xe70f('0xc')](util['format'](_0xe70f('0xd'),_0x3c56cd,_0x7ca513,_0x34f7ff));}});}; \ No newline at end of file +var _0x2627=['info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','mustache','../../../../config/logger','exec','data2','Script','data3','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s'];(function(_0x2b480a,_0x5763f9){var _0x4a1b23=function(_0x232a08){while(--_0x232a08){_0x2b480a['push'](_0x2b480a['shift']());}};_0x4a1b23(++_0x5763f9);}(_0x2627,0x17e));var _0x7262=function(_0x30b58,_0x48df3b){_0x30b58=_0x30b58-0x0;var _0x9d210d=_0x2627[_0x30b58];return _0x9d210d;};'use strict';var util=require('util');var sh=require('shelljs');var Mustache=require(_0x7262('0x0'));var logger=require(_0x7262('0x1'))('trigger');exports[_0x7262('0x2')]=function(_0x36336d,_0x576125){var _0x1be6b5=_0x36336d[_0x7262('0x3')]?_0x36336d['data2']:_0x7262('0x4');var _0x51340d=_0x36336d[_0x7262('0x5')]?Mustache['render'](_0x36336d[_0x7262('0x5')],_0x576125):_0x576125;sh[_0x7262('0x2')](_0x51340d,function(_0x40cc9f,_0x205e5f,_0x33140a){if(_0x40cc9f!==0x0){logger['error'](util[_0x7262('0x6')](_0x7262('0x7'),_0x1be6b5,_0x51340d,_0x40cc9f,_0x33140a));}else{logger[_0x7262('0x8')](util[_0x7262('0x6')](_0x7262('0x9'),_0x1be6b5,_0x51340d,_0x205e5f));}});}; \ 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 18ff7fa..6b67a5f 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 _0x2729=['data5','number','headers','parse','data6','error','stack','DELETE','POST','PUT','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','isNil',',\x20request\x20body:\x20','object','format','%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','lodash','mustache','../../../../config/logger','exec','data1','toUpperCase','render','data2'];(function(_0x50a9ac,_0x479efa){var _0x4608e0=function(_0x14942f){while(--_0x14942f){_0x50a9ac['push'](_0x50a9ac['shift']());}};_0x4608e0(++_0x479efa);}(_0x2729,0x107));var _0x9272=function(_0xc352bd,_0x312795){_0xc352bd=_0xc352bd-0x0;var _0x10e333=_0x2729[_0xc352bd];return _0x10e333;};'use strict';var rp=require(_0x9272('0x0'));var util=require('util');var _=require(_0x9272('0x1'));var Mustache=require(_0x9272('0x2'));var logger=require(_0x9272('0x3'))('trigger');exports[_0x9272('0x4')]=function(_0x173e66,_0x3534bc){var _0x44c220,_0x456580;var _0x3043c8={'method':_0x173e66[_0x9272('0x5')][_0x9272('0x6')](),'uri':Mustache[_0x9272('0x7')](_0x173e66[_0x9272('0x8')],_0x3534bc),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x173e66[_0x9272('0x9')])===_0x9272('0xa')&&parseInt(_0x173e66[_0x9272('0x9')])>=0x1&&parseInt(_0x173e66[_0x9272('0x9')])<=0xa?parseInt(_0x173e66[_0x9272('0x9')])*0x3e8:0x5*0x3e8};try{_0x3043c8[_0x9272('0xb')]=_0x173e66['data6']?JSON[_0x9272('0xc')](Mustache[_0x9272('0x7')](_0x173e66[_0x9272('0xd')],_0x3534bc)):{};}catch(_0x44c065){logger[_0x9272('0xe')](_0x44c065[_0x9272('0xf')]);}switch(_0x173e66[_0x9272('0x5')][_0x9272('0x6')]()){case'GET':case _0x9272('0x10'):_0x44c220=null;_0x3043c8['qs']=_0x3534bc;break;case _0x9272('0x11'):case _0x9272('0x12'):if(_0x173e66[_0x9272('0x13')]){try{_0x44c220=JSON[_0x9272('0xc')](Mustache[_0x9272('0x7')](_0x173e66[_0x9272('0x13')],_0x3534bc));_0x3043c8[_0x9272('0x14')]=_0x44c220;}catch(_0x25bd29){logger[_0x9272('0xe')](_0x25bd29[_0x9272('0xf')]);logger[_0x9272('0xe')](_0x9272('0x15'));}}else{_0x44c220=_0x3534bc;_0x3043c8[_0x9272('0x14')]=_0x44c220;}break;}logger[_0x9272('0x16')](util['format'](_0x9272('0x17'),_0x173e66[_0x9272('0x5')],_0x173e66[_0x9272('0x8')],JSON[_0x9272('0x18')](_0x3043c8)));rp(_0x3043c8)['then'](function(_0x349309){_0x44c220=!_[_0x9272('0x19')](_0x44c220)?_0x9272('0x1a')+_0x44c220:'';_0x456580=typeof _0x349309[_0x9272('0x14')]===_0x9272('0x1b')?JSON[_0x9272('0x18')](_0x349309[_0x9272('0x14')]):_0x349309['body'];logger[_0x9272('0x16')](util[_0x9272('0x1c')](_0x9272('0x1d'),_0x173e66[_0x9272('0x5')],_0x173e66[_0x9272('0x8')],_0x349309[_0x9272('0x1e')],_0x456580));})[_0x9272('0x1f')](function(_0x69a1c5){logger[_0x9272('0xe')](util['format'](_0x9272('0x20'),_0x173e66[_0x9272('0x5')],_0x173e66[_0x9272('0x8')],_0x69a1c5[_0x9272('0x1e')],_0x69a1c5['name'],_0x69a1c5[_0x9272('0x21')]));});}; \ No newline at end of file +var _0x9695=['error','stack','GET','DELETE','POST','PUT','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','isNil','object','format','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','statusCode','name','message','request-promise','util','lodash','mustache','../../../../config/logger','data1','toUpperCase','render','data2','number','data5','data6','parse'];(function(_0x272304,_0x573aa3){var _0x2401f7=function(_0x582476){while(--_0x582476){_0x272304['push'](_0x272304['shift']());}};_0x2401f7(++_0x573aa3);}(_0x9695,0x13d));var _0x5969=function(_0x50e4a1,_0x5d10ec){_0x50e4a1=_0x50e4a1-0x0;var _0x4211a7=_0x9695[_0x50e4a1];return _0x4211a7;};'use strict';var rp=require(_0x5969('0x0'));var util=require(_0x5969('0x1'));var _=require(_0x5969('0x2'));var Mustache=require(_0x5969('0x3'));var logger=require(_0x5969('0x4'))('trigger');exports['exec']=function(_0x298775,_0x2c154c){var _0x5687e6,_0x38d799;var _0x37b036={'method':_0x298775[_0x5969('0x5')][_0x5969('0x6')](),'uri':Mustache[_0x5969('0x7')](_0x298775[_0x5969('0x8')],_0x2c154c),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x298775['data5'])===_0x5969('0x9')&&parseInt(_0x298775[_0x5969('0xa')])>=0x1&&parseInt(_0x298775[_0x5969('0xa')])<=0xa?parseInt(_0x298775['data5'])*0x3e8:0x5*0x3e8};try{_0x37b036['headers']=_0x298775[_0x5969('0xb')]?JSON[_0x5969('0xc')](Mustache['render'](_0x298775[_0x5969('0xb')],_0x2c154c)):{};}catch(_0x5cfc75){logger[_0x5969('0xd')](_0x5cfc75[_0x5969('0xe')]);}switch(_0x298775['data1'][_0x5969('0x6')]()){case _0x5969('0xf'):case _0x5969('0x10'):_0x5687e6=null;_0x37b036['qs']=_0x2c154c;break;case _0x5969('0x11'):case _0x5969('0x12'):if(_0x298775[_0x5969('0x13')]){try{_0x5687e6=JSON['parse'](Mustache['render'](_0x298775[_0x5969('0x13')],_0x2c154c));_0x37b036[_0x5969('0x14')]=_0x5687e6;}catch(_0x56734e){logger[_0x5969('0xd')](_0x56734e['stack']);logger['error'](_0x5969('0x15'));}}else{_0x5687e6=_0x2c154c;_0x37b036[_0x5969('0x14')]=_0x5687e6;}break;}logger[_0x5969('0x16')](util['format'](_0x5969('0x17'),_0x298775[_0x5969('0x5')],_0x298775['data2'],JSON[_0x5969('0x18')](_0x37b036)));rp(_0x37b036)['then'](function(_0x5f932a){_0x5687e6=!_[_0x5969('0x19')](_0x5687e6)?',\x20request\x20body:\x20'+_0x5687e6:'';_0x38d799=typeof _0x5f932a[_0x5969('0x14')]===_0x5969('0x1a')?JSON['stringify'](_0x5f932a[_0x5969('0x14')]):_0x5f932a[_0x5969('0x14')];logger[_0x5969('0x16')](util[_0x5969('0x1b')](_0x5969('0x1c'),_0x298775[_0x5969('0x5')],_0x298775[_0x5969('0x8')],_0x5f932a['statusCode'],_0x38d799));})['catch'](function(_0x1eb083){logger[_0x5969('0xd')](util[_0x5969('0x1b')](_0x5969('0x1d'),_0x298775['data1'],_0x298775['data2'],_0x1eb083[_0x5969('0x1e')],_0x1eb083[_0x5969('0x1f')],_0x1eb083[_0x5969('0x20')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 361edbd..348e9e9 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 _0xfcfd=['catch','exports','jayson/promise','bluebird','../../config/logger','routing','client','http','Request','request','debug','error','rpc','result'];(function(_0x2cc303,_0x2c4a2a){var _0x82a2ca=function(_0x3d9eae){while(--_0x3d9eae){_0x2cc303['push'](_0x2cc303['shift']());}};_0x82a2ca(++_0x2c4a2a);}(_0xfcfd,0x11a));var _0xdfcf=function(_0xb3efd2,_0x36bb87){_0xb3efd2=_0xb3efd2-0x0;var _0xadc706=_0xfcfd[_0xb3efd2];return _0xadc706;};'use strict';var jayson=require(_0xdfcf('0x0'));var BPromise=require(_0xdfcf('0x1'));var logger=require(_0xdfcf('0x2'))(_0xdfcf('0x3'));var client=jayson[_0xdfcf('0x4')][_0xdfcf('0x5')]({'port':0x2329});client[_0xdfcf('0x6')]=function(_0x415a27,_0x5912d0){return new BPromise(function(_0x2f1a02,_0x27a297){return client[_0xdfcf('0x7')](_0x415a27,_0x5912d0)['then'](function(_0x19fcfd){logger[_0xdfcf('0x8')]('rpc','routing',_0x415a27,_0x5912d0,_0x19fcfd);if(_0x19fcfd[_0xdfcf('0x9')]){logger['error'](_0xdfcf('0xa'),_0xdfcf('0x3'),_0x415a27,_0x19fcfd[_0xdfcf('0x9')]['message'],_0x5912d0);return _0x27a297(_0x19fcfd[_0xdfcf('0x9')]['message']);}else{return _0x2f1a02(_0x19fcfd[_0xdfcf('0xb')]);}})[_0xdfcf('0xc')](function(_0x3f6efa){logger[_0xdfcf('0x9')](_0xdfcf('0xa'),_0xdfcf('0x3'),_0x415a27,_0x3f6efa,_0x5912d0);return _0x27a297(_0x3f6efa);});});};module[_0xdfcf('0xd')]=client; \ No newline at end of file +var _0x1a5b=['http','Request','request','then','error','rpc','message','result','catch','exports','jayson/promise','../../config/logger','routing','client'];(function(_0x34069a,_0x133e7b){var _0xddca94=function(_0x15df2a){while(--_0x15df2a){_0x34069a['push'](_0x34069a['shift']());}};_0xddca94(++_0x133e7b);}(_0x1a5b,0x1ca));var _0xb1a5=function(_0x52f20f,_0xf2dd4e){_0x52f20f=_0x52f20f-0x0;var _0x2d594b=_0x1a5b[_0x52f20f];return _0x2d594b;};'use strict';var jayson=require(_0xb1a5('0x0'));var BPromise=require('bluebird');var logger=require(_0xb1a5('0x1'))(_0xb1a5('0x2'));var client=jayson[_0xb1a5('0x3')][_0xb1a5('0x4')]({'port':0x2329});client[_0xb1a5('0x5')]=function(_0x465db0,_0x33670c){return new BPromise(function(_0x2c8afa,_0x403801){return client[_0xb1a5('0x6')](_0x465db0,_0x33670c)[_0xb1a5('0x7')](function(_0x426683){logger['debug']('rpc',_0xb1a5('0x2'),_0x465db0,_0x33670c,_0x426683);if(_0x426683['error']){logger[_0xb1a5('0x8')](_0xb1a5('0x9'),_0xb1a5('0x2'),_0x465db0,_0x426683[_0xb1a5('0x8')]['message'],_0x33670c);return _0x403801(_0x426683[_0xb1a5('0x8')][_0xb1a5('0xa')]);}else{return _0x2c8afa(_0x426683[_0xb1a5('0xb')]);}})[_0xb1a5('0xc')](function(_0x4da93e){logger[_0xb1a5('0x8')](_0xb1a5('0x9'),_0xb1a5('0x2'),_0x465db0,_0x4da93e,_0x33670c);return _0x403801(_0x4da93e);});});};module[_0xb1a5('0xd')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 5b33cd8..e70f415 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 _0x3f5f=['../../config/logger','email','resolve','then','getMailAccounts','initMailAccounts','mailAccounts','listen','catch','error','Email\x20service\x20initialization','./realtime','./lib/email','./rpc/mailAccount'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0x3f5f,0x1af));var _0xf3f5=function(_0x2caae5,_0x23acda){_0x2caae5=_0x2caae5-0x0;var _0x5e1f96=_0x3f5f[_0x2caae5];return _0x5e1f96;};'use strict';var server=require('./server');var Realtime=require(_0xf3f5('0x0'));var EmailChannel=require(_0xf3f5('0x1'));var mailAccount=require(_0xf3f5('0x2'));var setting=require('./rpc/setting');var logger=require(_0xf3f5('0x3'))(_0xf3f5('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0xf3f5('0x5')]()[_0xf3f5('0x6')](mailAccount[_0xf3f5('0x7')]())['then'](realtime[_0xf3f5('0x8')]())[_0xf3f5('0x6')](function(){email['refresh'](realtime[_0xf3f5('0x9')]);return realtime;});}function main(){return server[_0xf3f5('0xa')](realtime,email)['then'](function(){return initRealtime();})[_0xf3f5('0x6')](function(){return setting['getSettings']();})['then'](function(_0x3a24e6){return setInterval(initRealtime,_0x3a24e6['loginMailFrequency']*0x3e8);})[_0xf3f5('0xb')](function(_0x2ca2b2){logger[_0xf3f5('0xc')](_0xf3f5('0xd'),_0x2ca2b2);});}main(); \ No newline at end of file +var _0x2e89=['./rpc/mailAccount','./rpc/setting','../../config/logger','email','resolve','then','getMailAccounts','initMailAccounts','refresh','mailAccounts','listen','getSettings','loginMailFrequency','error','Email\x20service\x20initialization','./server','./realtime'];(function(_0x549914,_0x140274){var _0x5f3f01=function(_0x4f9b00){while(--_0x4f9b00){_0x549914['push'](_0x549914['shift']());}};_0x5f3f01(++_0x140274);}(_0x2e89,0x11f));var _0x92e8=function(_0x1d30b9,_0x14ed70){_0x1d30b9=_0x1d30b9-0x0;var _0x16c235=_0x2e89[_0x1d30b9];return _0x16c235;};'use strict';var server=require(_0x92e8('0x0'));var Realtime=require(_0x92e8('0x1'));var EmailChannel=require('./lib/email');var mailAccount=require(_0x92e8('0x2'));var setting=require(_0x92e8('0x3'));var logger=require(_0x92e8('0x4'))(_0x92e8('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x92e8('0x6')]()[_0x92e8('0x7')](mailAccount[_0x92e8('0x8')]())[_0x92e8('0x7')](realtime[_0x92e8('0x9')]())['then'](function(){email[_0x92e8('0xa')](realtime[_0x92e8('0xb')]);return realtime;});}function main(){return server[_0x92e8('0xc')](realtime,email)[_0x92e8('0x7')](function(){return initRealtime();})[_0x92e8('0x7')](function(){return setting[_0x92e8('0xd')]();})['then'](function(_0x184630){return setInterval(initRealtime,_0x184630[_0x92e8('0xe')]*0x3e8);})['catch'](function(_0x48f4a0){logger[_0x92e8('0xf')](_0x92e8('0x10'),_0x48f4a0);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 6f7868c..834973b 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 _0x40ad=['../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','active','Imap','messageStatus','total','mailAccount:update','refresh','hasOwnProperty','service','provider','handleImapBox','bind','end','error','handleImapError','isNil','status','connected','messages','handleImapEmail','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','from','notify','then','Mail\x20accepted\x20from\x20routing','Mail\x20not\x20accepted\x20from\x20routing\x20%s','stringify','handleImapEnd','Smtp','lastSync','verified','catch','verify','exports','lodash','moment','bluebird','md5','ioredis','../../../config/environment','email','defaults','redis','localhost','socket.io-emitter','./smtp'];(function(_0x4bf137,_0x8494c4){var _0x2ae046=function(_0x13788a){while(--_0x13788a){_0x4bf137['push'](_0x4bf137['shift']());}};_0x2ae046(++_0x8494c4);}(_0x40ad,0x64));var _0xd40a=function(_0x40542f,_0x9c86f7){_0x40542f=_0x40542f-0x0;var _0x3b961f=_0x40ad[_0x40542f];return _0x3b961f;};'use strict';var _=require(_0xd40a('0x0'));var moment=require(_0xd40a('0x1'));var BPromise=require(_0xd40a('0x2'));var md5=require(_0xd40a('0x3'));var Redis=require(_0xd40a('0x4'));var config=require(_0xd40a('0x5'));var logger=require('../../../config/logger')(_0xd40a('0x6'));config['redis']=_[_0xd40a('0x7')](config[_0xd40a('0x8')],{'host':_0xd40a('0x9'),'port':0x18eb});var io=require(_0xd40a('0xa'))(new Redis(config[_0xd40a('0x8')]));var EmailImap=require('./imap');var EmailSmtp=require(_0xd40a('0xb'));var mailAccount=require(_0xd40a('0xc'));var md5Accounts={};function EmailChannel(_0x460c20){logger[_0xd40a('0xd')](_0xd40a('0xe'));this[_0xd40a('0xf')]=_0x460c20[_0xd40a('0xf')];this[_0xd40a('0x10')]={};this[_0xd40a('0x11')]=new EmailSmtp();}EmailChannel[_0xd40a('0x12')][_0xd40a('0x13')]=function(_0xc62cbf){var _0x2379e2=this[_0xd40a('0xf')][_0xc62cbf];var _0x47fc22={'id':_0x2379e2['id'],'name':_0x2379e2[_0xd40a('0x14')],'key':_0x2379e2[_0xd40a('0x15')],'active':_0x2379e2[_0xd40a('0x16')],'Imap':{'status':_0x2379e2[_0xd40a('0x17')]['status'],'messageStatus':_0x2379e2['Imap'][_0xd40a('0x18')],'total':_0x2379e2[_0xd40a('0x17')][_0xd40a('0x19')]}};if(_['isNil'](md5Accounts[_0xc62cbf])){md5Accounts[_0xc62cbf]={};}var _0x397bb6=md5(JSON['stringify'](_0x47fc22));if(md5Accounts[_0xc62cbf]['md5']!==_0x397bb6){md5Accounts[_0xc62cbf]['md5']=_0x397bb6;io[_0xd40a('0x13')](_0xd40a('0x1a'),_0x47fc22);}};EmailChannel[_0xd40a('0x12')][_0xd40a('0x1b')]=function(_0x48fa04){for(var _0x5cff90 in _0x48fa04){if(_0x48fa04[_0xd40a('0x1c')](_0x5cff90)){if(_0x48fa04[_0x5cff90]['Imap']&&_0x48fa04[_0x5cff90][_0xd40a('0x16')]){var _0x490f77=_0x48fa04[_0x5cff90]['Imap'];if(!_0x490f77[_0xd40a('0x1d')]&&_0x48fa04[_0x5cff90][_0xd40a('0x1e')]!=='custom')_0x490f77[_0xd40a('0x1d')]=_0x48fa04[_0x5cff90][_0xd40a('0x1e')];if(!this[_0xd40a('0x10')][_0xd40a('0x1c')](_0x490f77['id'])){this[_0xd40a('0x10')][_0x490f77['id']]=new EmailImap(_0x490f77,_0x48fa04[_0x5cff90][_0xd40a('0x6')]);this[_0xd40a('0x10')][_0x490f77['id']]['on']('box',this[_0xd40a('0x1f')][_0xd40a('0x20')](this,_0x5cff90));this[_0xd40a('0x10')][_0x490f77['id']]['on'](_0xd40a('0x6'),this['handleImapEmail'][_0xd40a('0x20')](this,_0x5cff90));this['imapAccounts'][_0x490f77['id']]['on'](_0xd40a('0x21'),this['handleImapEnd']['bind'](this,_0x5cff90));this[_0xd40a('0x10')][_0x490f77['id']]['on'](_0xd40a('0x22'),this[_0xd40a('0x23')][_0xd40a('0x20')](this,_0x5cff90));}}else{if(_[_0xd40a('0x24')](this[_0xd40a('0xf')][_0x5cff90][_0xd40a('0x17')])){this[_0xd40a('0xf')][_0x5cff90]['Imap']={};}this[_0xd40a('0xf')][_0x5cff90][_0xd40a('0x17')][_0xd40a('0x25')]='disabled';this[_0xd40a('0xf')][_0x5cff90]['Imap']['messageStatus']='';this[_0xd40a('0x13')](_0x5cff90);}}}};EmailChannel[_0xd40a('0x12')]['handleImapBox']=function(_0x48ea54,_0x56c1a0){if(this[_0xd40a('0xf')][_0x48ea54]){this[_0xd40a('0xf')][_0x48ea54][_0xd40a('0x17')]['status']=_0xd40a('0x26');this[_0xd40a('0xf')][_0x48ea54][_0xd40a('0x17')]['messageStatus']=_0x56c1a0[_0xd40a('0x14')];if(_0x56c1a0['messages']){this[_0xd40a('0xf')][_0x48ea54]['Imap'][_0xd40a('0x19')]=_0x56c1a0[_0xd40a('0x27')][_0xd40a('0x19')];}return this[_0xd40a('0x13')](_0x48ea54);}};EmailChannel[_0xd40a('0x12')][_0xd40a('0x28')]=function(_0x3ca576,_0x1d2d71){logger[_0xd40a('0xd')](_0xd40a('0x29'),_0x1d2d71[_0xd40a('0x2a')],_0x1d2d71['lastName'],_0x1d2d71[_0xd40a('0x2b')],_0x3ca576);if(this['mailAccounts'][_0x3ca576]){return mailAccount[_0xd40a('0x2c')](_0x3ca576,_0x1d2d71)[_0xd40a('0x2d')](function(_0x3b792b){if(_0x3b792b){logger[_0xd40a('0xd')](_0xd40a('0x2e'));}})['catch'](function(_0x46c76f){logger[_0xd40a('0x22')](_0xd40a('0x2f'),JSON[_0xd40a('0x30')](_0x46c76f));});}};EmailChannel[_0xd40a('0x12')][_0xd40a('0x31')]=function(_0x41c68e){if(this[_0xd40a('0xf')][_0x41c68e]&&this[_0xd40a('0xf')][_0x41c68e]['Imap']){if(this[_0xd40a('0x10')][this['mailAccounts'][_0x41c68e][_0xd40a('0x17')]['id']]){delete this[_0xd40a('0x10')][this[_0xd40a('0xf')][_0x41c68e]['Imap']['id']];}this[_0xd40a('0xf')][_0x41c68e][_0xd40a('0x17')]['lastSync']=moment();this[_0xd40a('0x13')](_0x41c68e);}};EmailChannel[_0xd40a('0x12')]['handleImapError']=function(_0xa4014,_0x22d99c){if(this[_0xd40a('0xf')][_0xa4014]){this[_0xd40a('0xf')][_0xa4014][_0xd40a('0x17')][_0xd40a('0x25')]=_0xd40a('0x22');this[_0xd40a('0xf')][_0xa4014][_0xd40a('0x17')][_0xd40a('0x18')]=_0x22d99c;return this['emit'](_0xa4014);}};EmailChannel[_0xd40a('0x12')]['sendMail']=function(_0x2fd76b,_0x26c30c){return this[_0xd40a('0x11')]['send'](_0x2fd76b,_0x26c30c);};EmailChannel[_0xd40a('0x12')]['verifySmtp']=function(_0x4c021d){var _0x38db1b=this;if(this[_0xd40a('0xf')][_0x4c021d['id']]){if(_['isNil'](this[_0xd40a('0xf')][_0x4c021d['id']]['Smtp'])){this[_0xd40a('0xf')][_0x4c021d['id']][_0xd40a('0x32')]={};}this['mailAccounts'][_0x4c021d['id']][_0xd40a('0x32')][_0xd40a('0x33')]=moment();return new BPromise(function(_0xed08b,_0x47d51b){return _0x38db1b[_0xd40a('0x11')]['verify'](_0x4c021d)[_0xd40a('0x2d')](function(_0xed3fea){_0x38db1b[_0xd40a('0xf')][_0x4c021d['id']]['Smtp'][_0xd40a('0x25')]=_0xd40a('0x34');_0x38db1b[_0xd40a('0xf')][_0x4c021d['id']][_0xd40a('0x32')][_0xd40a('0x18')]='';_0x38db1b['emit'](_0x4c021d['id']);_0xed08b(_0xed3fea);})[_0xd40a('0x35')](function(_0x2886e2){_0x38db1b['mailAccounts'][_0x4c021d['id']][_0xd40a('0x32')][_0xd40a('0x25')]=_0xd40a('0x22');_0x38db1b[_0xd40a('0xf')][_0x4c021d['id']][_0xd40a('0x32')][_0xd40a('0x18')]=_0x2886e2;_0x38db1b[_0xd40a('0x13')](_0x4c021d['id']);_0x47d51b(_0x2886e2);});});}return this['smtp'][_0xd40a('0x36')](_0x4c021d);};module[_0xd40a('0x37')]=EmailChannel; \ No newline at end of file +var _0x954b=['bluebird','md5','../../../config/environment','../../../config/logger','email','redis','localhost','socket.io-emitter','./smtp','start\x20email\x20channel','emit','mailAccounts','name','key','active','Imap','status','messageStatus','total','isNil','mailAccount:update','prototype','refresh','service','custom','provider','hasOwnProperty','imapAccounts','box','handleImapBox','bind','handleImapError','disabled','connected','messages','info','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','stringify','handleImapEnd','lastSync','error','sendMail','smtp','verifySmtp','Smtp','then','exports','lodash'];(function(_0x57532c,_0x2c75cf){var _0x5cb9a6=function(_0x3a4dea){while(--_0x3a4dea){_0x57532c['push'](_0x57532c['shift']());}};_0x5cb9a6(++_0x2c75cf);}(_0x954b,0xdb));var _0xb954=function(_0x4f6d08,_0x1b3dd0){_0x4f6d08=_0x4f6d08-0x0;var _0x53a9c6=_0x954b[_0x4f6d08];return _0x53a9c6;};'use strict';var _=require(_0xb954('0x0'));var moment=require('moment');var BPromise=require(_0xb954('0x1'));var md5=require(_0xb954('0x2'));var Redis=require('ioredis');var config=require(_0xb954('0x3'));var logger=require(_0xb954('0x4'))(_0xb954('0x5'));config[_0xb954('0x6')]=_['defaults'](config['redis'],{'host':_0xb954('0x7'),'port':0x18eb});var io=require(_0xb954('0x8'))(new Redis(config[_0xb954('0x6')]));var EmailImap=require('./imap');var EmailSmtp=require(_0xb954('0x9'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x1f6b1f){logger['info'](_0xb954('0xa'));this['mailAccounts']=_0x1f6b1f['mailAccounts'];this['imapAccounts']={};this['smtp']=new EmailSmtp();}EmailChannel['prototype'][_0xb954('0xb')]=function(_0x2bb54f){var _0x5354e1=this[_0xb954('0xc')][_0x2bb54f];var _0x5c7786={'id':_0x5354e1['id'],'name':_0x5354e1[_0xb954('0xd')],'key':_0x5354e1[_0xb954('0xe')],'active':_0x5354e1[_0xb954('0xf')],'Imap':{'status':_0x5354e1[_0xb954('0x10')][_0xb954('0x11')],'messageStatus':_0x5354e1[_0xb954('0x10')][_0xb954('0x12')],'total':_0x5354e1[_0xb954('0x10')][_0xb954('0x13')]}};if(_[_0xb954('0x14')](md5Accounts[_0x2bb54f])){md5Accounts[_0x2bb54f]={};}var _0x15e262=md5(JSON['stringify'](_0x5c7786));if(md5Accounts[_0x2bb54f][_0xb954('0x2')]!==_0x15e262){md5Accounts[_0x2bb54f]['md5']=_0x15e262;io[_0xb954('0xb')](_0xb954('0x15'),_0x5c7786);}};EmailChannel[_0xb954('0x16')][_0xb954('0x17')]=function(_0x30919d){for(var _0x507706 in _0x30919d){if(_0x30919d['hasOwnProperty'](_0x507706)){if(_0x30919d[_0x507706][_0xb954('0x10')]&&_0x30919d[_0x507706][_0xb954('0xf')]){var _0x486f07=_0x30919d[_0x507706][_0xb954('0x10')];if(!_0x486f07[_0xb954('0x18')]&&_0x30919d[_0x507706]['provider']!==_0xb954('0x19'))_0x486f07[_0xb954('0x18')]=_0x30919d[_0x507706][_0xb954('0x1a')];if(!this['imapAccounts'][_0xb954('0x1b')](_0x486f07['id'])){this['imapAccounts'][_0x486f07['id']]=new EmailImap(_0x486f07,_0x30919d[_0x507706]['email']);this[_0xb954('0x1c')][_0x486f07['id']]['on'](_0xb954('0x1d'),this[_0xb954('0x1e')][_0xb954('0x1f')](this,_0x507706));this[_0xb954('0x1c')][_0x486f07['id']]['on']('email',this['handleImapEmail'][_0xb954('0x1f')](this,_0x507706));this['imapAccounts'][_0x486f07['id']]['on']('end',this['handleImapEnd']['bind'](this,_0x507706));this['imapAccounts'][_0x486f07['id']]['on']('error',this[_0xb954('0x20')][_0xb954('0x1f')](this,_0x507706));}}else{if(_[_0xb954('0x14')](this[_0xb954('0xc')][_0x507706][_0xb954('0x10')])){this['mailAccounts'][_0x507706][_0xb954('0x10')]={};}this[_0xb954('0xc')][_0x507706][_0xb954('0x10')]['status']=_0xb954('0x21');this[_0xb954('0xc')][_0x507706]['Imap'][_0xb954('0x12')]='';this[_0xb954('0xb')](_0x507706);}}}};EmailChannel[_0xb954('0x16')][_0xb954('0x1e')]=function(_0x219d1e,_0x48376e){if(this[_0xb954('0xc')][_0x219d1e]){this[_0xb954('0xc')][_0x219d1e][_0xb954('0x10')][_0xb954('0x11')]=_0xb954('0x22');this[_0xb954('0xc')][_0x219d1e][_0xb954('0x10')][_0xb954('0x12')]=_0x48376e[_0xb954('0xd')];if(_0x48376e[_0xb954('0x23')]){this[_0xb954('0xc')][_0x219d1e][_0xb954('0x10')][_0xb954('0x13')]=_0x48376e['messages'][_0xb954('0x13')];}return this[_0xb954('0xb')](_0x219d1e);}};EmailChannel['prototype']['handleImapEmail']=function(_0x31f1dd,_0x5713c8){logger[_0xb954('0x24')](_0xb954('0x25'),_0x5713c8[_0xb954('0x26')],_0x5713c8[_0xb954('0x27')],_0x5713c8[_0xb954('0x28')],_0x31f1dd);if(this[_0xb954('0xc')][_0x31f1dd]){return mailAccount[_0xb954('0x29')](_0x31f1dd,_0x5713c8)['then'](function(_0x4296ef){if(_0x4296ef){logger['info'](_0xb954('0x2a'));}})[_0xb954('0x2b')](function(_0x56b467){logger['error'](_0xb954('0x2c'),JSON[_0xb954('0x2d')](_0x56b467));});}};EmailChannel['prototype'][_0xb954('0x2e')]=function(_0x2c9125){if(this['mailAccounts'][_0x2c9125]&&this[_0xb954('0xc')][_0x2c9125][_0xb954('0x10')]){if(this[_0xb954('0x1c')][this[_0xb954('0xc')][_0x2c9125]['Imap']['id']]){delete this['imapAccounts'][this[_0xb954('0xc')][_0x2c9125][_0xb954('0x10')]['id']];}this[_0xb954('0xc')][_0x2c9125]['Imap'][_0xb954('0x2f')]=moment();this[_0xb954('0xb')](_0x2c9125);}};EmailChannel[_0xb954('0x16')][_0xb954('0x20')]=function(_0x49c97c,_0x3c291b){if(this[_0xb954('0xc')][_0x49c97c]){this[_0xb954('0xc')][_0x49c97c]['Imap'][_0xb954('0x11')]=_0xb954('0x30');this[_0xb954('0xc')][_0x49c97c]['Imap'][_0xb954('0x12')]=_0x3c291b;return this[_0xb954('0xb')](_0x49c97c);}};EmailChannel[_0xb954('0x16')][_0xb954('0x31')]=function(_0x2acf44,_0x64bfe6){return this[_0xb954('0x32')]['send'](_0x2acf44,_0x64bfe6);};EmailChannel[_0xb954('0x16')][_0xb954('0x33')]=function(_0x160f3a){var _0xa5c24d=this;if(this[_0xb954('0xc')][_0x160f3a['id']]){if(_[_0xb954('0x14')](this[_0xb954('0xc')][_0x160f3a['id']][_0xb954('0x34')])){this[_0xb954('0xc')][_0x160f3a['id']][_0xb954('0x34')]={};}this[_0xb954('0xc')][_0x160f3a['id']][_0xb954('0x34')]['lastSync']=moment();return new BPromise(function(_0x23c05a,_0x1b6491){return _0xa5c24d['smtp']['verify'](_0x160f3a)[_0xb954('0x35')](function(_0x12da65){_0xa5c24d[_0xb954('0xc')][_0x160f3a['id']]['Smtp'][_0xb954('0x11')]='verified';_0xa5c24d['mailAccounts'][_0x160f3a['id']]['Smtp'][_0xb954('0x12')]='';_0xa5c24d[_0xb954('0xb')](_0x160f3a['id']);_0x23c05a(_0x12da65);})[_0xb954('0x2b')](function(_0x44b868){_0xa5c24d[_0xb954('0xc')][_0x160f3a['id']][_0xb954('0x34')][_0xb954('0x11')]=_0xb954('0x30');_0xa5c24d[_0xb954('0xc')][_0x160f3a['id']]['Smtp'][_0xb954('0x12')]=_0x44b868;_0xa5c24d['emit'](_0x160f3a['id']);_0x1b6491(_0x44b868);});});}return this['smtp']['verify'](_0x160f3a);};module[_0xb954('0x36')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 47e90a6..5e13ffc 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 _0x524e=['mailbox','INBOX','getAccount','account','once','ready','handleReady','bind','end','handleEnd','error','handleError','connect','inherits','prototype','connTimeout','authTimeout','service','user','generateXOAuth2Token','data5','password','host','port','tls','autotls','openBox','handleOpenBox','emit','box','readUnseen','handleCloseBox','handleReadUnseen','length','fetch','message','closeBox','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','handleFetchEnd','handleFetchError','stringify','textCode','upperFirst','exports','imap','mailparser','simpleParser','iconv','Iconv','events','EventEmitter','./utils','../../../config/logger','email'];(function(_0x34bc30,_0x177cb0){var _0x5706de=function(_0x535a8c){while(--_0x535a8c){_0x34bc30['push'](_0x34bc30['shift']());}};_0x5706de(++_0x177cb0);}(_0x524e,0x15e));var _0xe524=function(_0x2db6be,_0x48fe97){_0x2db6be=_0x2db6be-0x0;var _0x24bb78=_0x524e[_0x2db6be];return _0x24bb78;};'use strict';var _=require('lodash');var util=require('util');var Imap=require(_0xe524('0x0'));var simpleParser=require(_0xe524('0x1'))[_0xe524('0x2')];var Iconv=require(_0xe524('0x3'))[_0xe524('0x4')];var EventEmitter=require(_0xe524('0x5'))[_0xe524('0x6')];var utils=require(_0xe524('0x7'));var logger=require(_0xe524('0x8'))(_0xe524('0x9'));function EmailImap(_0x4f75d6,_0xaaeaa9){this[_0xe524('0xa')]=_0xe524('0xb');this['account']=this[_0xe524('0xc')](_0x4f75d6,_0xaaeaa9);this[_0xe524('0x0')]=new Imap(this[_0xe524('0xd')]);this[_0xe524('0x0')][_0xe524('0xe')](_0xe524('0xf'),this[_0xe524('0x10')][_0xe524('0x11')](this));this[_0xe524('0x0')][_0xe524('0xe')](_0xe524('0x12'),this[_0xe524('0x13')][_0xe524('0x11')](this));this[_0xe524('0x0')]['on'](_0xe524('0x14'),this[_0xe524('0x15')]['bind'](this));this['imap'][_0xe524('0x16')]();}util[_0xe524('0x17')](EmailImap,EventEmitter);EmailImap[_0xe524('0x18')][_0xe524('0xc')]=function(_0x20a852,_0x57c1b6){var _0x12ff75={'connTimeout':_0x20a852['connTimeout']?_0x20a852[_0xe524('0x19')]*0x3e8:0x2710,'authTimeout':_0x20a852[_0xe524('0x1a')]?_0x20a852['authTimeout']*0x3e8:0x1388};if(_0x20a852[_0xe524('0x1b')]){_0x12ff75['user']=_0x20a852[_0xe524('0x1c')];_0x12ff75['email']=_0x57c1b6||_0x20a852[_0xe524('0x1c')]||'anonymous@xcally.com';if(_0x20a852['modernAuthentication']){_0x12ff75['xoauth2']=utils[_0xe524('0x1d')](_0x20a852['CloudProvider'][_0xe524('0x1e')],_0x20a852[_0xe524('0x1c')]);}else{_0x12ff75[_0xe524('0x1f')]=_0x20a852[_0xe524('0x1f')];}}else{if(_0x20a852['authentication']){_0x12ff75[_0xe524('0x1c')]=_0x20a852[_0xe524('0x1c')];_0x12ff75['password']=_0x20a852[_0xe524('0x1f')];}}_0x12ff75[_0xe524('0x20')]=_0x20a852[_0xe524('0x20')];_0x12ff75[_0xe524('0x21')]=_0x20a852[_0xe524('0x21')]||0x3e1;if(_0x20a852[_0xe524('0x22')]){_0x12ff75[_0xe524('0x22')]=!![];}else{_0x12ff75[_0xe524('0x22')]=![];_0x12ff75[_0xe524('0x23')]='required';}return _0x12ff75;};EmailImap[_0xe524('0x18')]['handleReady']=function(){this['imap'][_0xe524('0x24')](this[_0xe524('0xa')],![],this[_0xe524('0x25')][_0xe524('0x11')](this));};EmailImap['prototype'][_0xe524('0x25')]=function(_0x4a03bc,_0x17e245){if(_0x4a03bc){this[_0xe524('0x15')](_0x4a03bc,!![]);}else{this[_0xe524('0x26')](_0xe524('0x27'),_0x17e245);this[_0xe524('0x28')]();}};EmailImap[_0xe524('0x18')][_0xe524('0x29')]=function(_0x583cc3){if(_0x583cc3){this['handleError'](_0x583cc3,!![]);}else{this[_0xe524('0x0')][_0xe524('0x12')]();}};EmailImap[_0xe524('0x18')][_0xe524('0x28')]=function(){this[_0xe524('0x0')]['search'](['UNSEEN'],this[_0xe524('0x2a')][_0xe524('0x11')](this));};EmailImap[_0xe524('0x18')][_0xe524('0x2a')]=function(_0x25c0a1,_0x517fa0){if(_0x25c0a1){this[_0xe524('0x15')](_0x25c0a1,!![]);}else{if(_0x517fa0[_0xe524('0x2b')]){try{var _0x4a4e15=this['imap'][_0xe524('0x2c')](_0x517fa0,{'bodies':'','markSeen':!![]});_0x4a4e15['on'](_0xe524('0x2d'),this['handleFetchMessage'][_0xe524('0x11')](this));_0x4a4e15['once'](_0xe524('0x14'),this['handleFetchError'][_0xe524('0x11')](this));_0x4a4e15[_0xe524('0xe')](_0xe524('0x12'),this['handleFetchEnd'][_0xe524('0x11')](this));}catch(_0x5238c9){logger[_0xe524('0x14')](_0x5238c9);}}else{this[_0xe524('0x0')][_0xe524('0x2e')](!![],this['handleCloseBox'][_0xe524('0x11')](this));}}};EmailImap[_0xe524('0x18')]['handleFetchMessage']=function(_0x27817e){_0x27817e['on'](_0xe524('0x2f'),this[_0xe524('0x30')][_0xe524('0x11')](this));_0x27817e['once'](_0xe524('0x31'),this[_0xe524('0x32')][_0xe524('0x11')](this));_0x27817e[_0xe524('0xe')](_0xe524('0x12'),this[_0xe524('0x33')][_0xe524('0x11')](this));};EmailImap[_0xe524('0x18')]['handleMessageBody']=function(_0x150a9f){simpleParser(_0x150a9f,{'Iconv':Iconv},this['handleSimpleParser'][_0xe524('0x11')](this));};EmailImap[_0xe524('0x18')]['handleMessageAttributes']=function(){};EmailImap[_0xe524('0x18')]['handleMessageEnd']=function(){};EmailImap[_0xe524('0x18')][_0xe524('0x34')]=function(_0x38758e,_0x3103e9){if(_0x38758e){logger[_0xe524('0x14')](_0x38758e);}else{var _0x10f911=this;utils[_0xe524('0x35')](this[_0xe524('0xd')],_0x3103e9,function(_0x5e8e64){_0x10f911[_0xe524('0x26')](_0xe524('0x9'),_0x5e8e64);});}};EmailImap[_0xe524('0x18')][_0xe524('0x36')]=function(){this[_0xe524('0x0')][_0xe524('0x2e')](!![],this[_0xe524('0x29')][_0xe524('0x11')](this));};EmailImap['prototype'][_0xe524('0x37')]=function(_0x849307){this[_0xe524('0x15')](_0x849307);this['imap'][_0xe524('0x2e')](!![],this['handleCloseBox'][_0xe524('0x11')](this));};EmailImap[_0xe524('0x18')][_0xe524('0x13')]=function(){this[_0xe524('0x26')](_0xe524('0x12'));};EmailImap[_0xe524('0x18')][_0xe524('0x15')]=function(_0x52cd0e,_0x8969fb){logger[_0xe524('0x14')](_0xe524('0x15'),this[_0xe524('0xd')][_0xe524('0x9')],JSON[_0xe524('0x38')](_0x52cd0e));var _0x4a4a16='';if(_0x52cd0e){if(_0x52cd0e[_0xe524('0x39')]){_0x4a4a16=_0x52cd0e[_0xe524('0x39')];}else{for(var _0x3fe124 in _0x52cd0e){if(_0x52cd0e['hasOwnProperty'](_0x3fe124)){_0x4a4a16+=_[_0xe524('0x3a')](_0x3fe124)+':\x20'+_0x52cd0e[_0x3fe124]+'\x0a';}}}}if(_0x8969fb){this['imap']['end']();}else{this[_0xe524('0x26')](_0xe524('0x14'),_0x4a4a16);this['emit'](_0xe524('0x12'));}};module[_0xe524('0x3b')]=EmailImap; \ No newline at end of file +var _0x27a0=['xoauth2','generateXOAuth2Token','CloudProvider','password','port','tls','required','openBox','handleOpenBox','readUnseen','handleCloseBox','handleReadUnseen','length','fetch','handleFetchMessage','handleFetchError','closeBox','body','handleMessageBody','attributes','handleMessageAttributes','handleSimpleParser','handleMessageEnd','parser','emit','handleFetchEnd','stringify','textCode','upperFirst','util','imap','mailparser','simpleParser','iconv','../../../config/logger','email','mailbox','INBOX','getAccount','account','once','ready','handleReady','end','handleEnd','bind','error','handleError','connect','prototype','authTimeout','service','user','modernAuthentication'];(function(_0x35b07d,_0x3d0ae7){var _0x2868bc=function(_0xd8ef42){while(--_0xd8ef42){_0x35b07d['push'](_0x35b07d['shift']());}};_0x2868bc(++_0x3d0ae7);}(_0x27a0,0xbf));var _0x027a=function(_0xb9097,_0x204099){_0xb9097=_0xb9097-0x0;var _0x218333=_0x27a0[_0xb9097];return _0x218333;};'use strict';var _=require('lodash');var util=require(_0x027a('0x0'));var Imap=require(_0x027a('0x1'));var simpleParser=require(_0x027a('0x2'))[_0x027a('0x3')];var Iconv=require(_0x027a('0x4'))['Iconv'];var EventEmitter=require('events')['EventEmitter'];var utils=require('./utils');var logger=require(_0x027a('0x5'))(_0x027a('0x6'));function EmailImap(_0x137b09,_0x639bec){this[_0x027a('0x7')]=_0x027a('0x8');this['account']=this[_0x027a('0x9')](_0x137b09,_0x639bec);this[_0x027a('0x1')]=new Imap(this[_0x027a('0xa')]);this['imap'][_0x027a('0xb')](_0x027a('0xc'),this[_0x027a('0xd')]['bind'](this));this[_0x027a('0x1')][_0x027a('0xb')](_0x027a('0xe'),this[_0x027a('0xf')][_0x027a('0x10')](this));this[_0x027a('0x1')]['on'](_0x027a('0x11'),this[_0x027a('0x12')][_0x027a('0x10')](this));this[_0x027a('0x1')][_0x027a('0x13')]();}util['inherits'](EmailImap,EventEmitter);EmailImap[_0x027a('0x14')][_0x027a('0x9')]=function(_0x2d27f8,_0x21da53){var _0x40fec0={'connTimeout':_0x2d27f8['connTimeout']?_0x2d27f8['connTimeout']*0x3e8:0x2710,'authTimeout':_0x2d27f8[_0x027a('0x15')]?_0x2d27f8['authTimeout']*0x3e8:0x1388};if(_0x2d27f8[_0x027a('0x16')]){_0x40fec0['user']=_0x2d27f8[_0x027a('0x17')];_0x40fec0['email']=_0x21da53||_0x2d27f8['user']||'anonymous@xcally.com';if(_0x2d27f8[_0x027a('0x18')]){_0x40fec0[_0x027a('0x19')]=utils[_0x027a('0x1a')](_0x2d27f8[_0x027a('0x1b')]['data5'],_0x2d27f8[_0x027a('0x17')]);}else{_0x40fec0[_0x027a('0x1c')]=_0x2d27f8['password'];}}else{if(_0x2d27f8['authentication']){_0x40fec0[_0x027a('0x17')]=_0x2d27f8['user'];_0x40fec0[_0x027a('0x1c')]=_0x2d27f8['password'];}}_0x40fec0['host']=_0x2d27f8['host'];_0x40fec0['port']=_0x2d27f8[_0x027a('0x1d')]||0x3e1;if(_0x2d27f8[_0x027a('0x1e')]){_0x40fec0[_0x027a('0x1e')]=!![];}else{_0x40fec0[_0x027a('0x1e')]=![];_0x40fec0['autotls']=_0x027a('0x1f');}return _0x40fec0;};EmailImap[_0x027a('0x14')][_0x027a('0xd')]=function(){this[_0x027a('0x1')][_0x027a('0x20')](this[_0x027a('0x7')],![],this['handleOpenBox'][_0x027a('0x10')](this));};EmailImap['prototype'][_0x027a('0x21')]=function(_0x2e97c5,_0x1b1a13){if(_0x2e97c5){this[_0x027a('0x12')](_0x2e97c5,!![]);}else{this['emit']('box',_0x1b1a13);this[_0x027a('0x22')]();}};EmailImap[_0x027a('0x14')][_0x027a('0x23')]=function(_0x129d5f){if(_0x129d5f){this['handleError'](_0x129d5f,!![]);}else{this[_0x027a('0x1')]['end']();}};EmailImap[_0x027a('0x14')]['readUnseen']=function(){this[_0x027a('0x1')]['search'](['UNSEEN'],this[_0x027a('0x24')]['bind'](this));};EmailImap['prototype'][_0x027a('0x24')]=function(_0x52ca99,_0xb4241d){if(_0x52ca99){this['handleError'](_0x52ca99,!![]);}else{if(_0xb4241d[_0x027a('0x25')]){try{var _0xc99acc=this['imap'][_0x027a('0x26')](_0xb4241d,{'bodies':'','markSeen':!![]});_0xc99acc['on']('message',this[_0x027a('0x27')][_0x027a('0x10')](this));_0xc99acc[_0x027a('0xb')](_0x027a('0x11'),this[_0x027a('0x28')][_0x027a('0x10')](this));_0xc99acc['once'](_0x027a('0xe'),this['handleFetchEnd'][_0x027a('0x10')](this));}catch(_0x55d8c5){logger[_0x027a('0x11')](_0x55d8c5);}}else{this[_0x027a('0x1')][_0x027a('0x29')](!![],this[_0x027a('0x23')][_0x027a('0x10')](this));}}};EmailImap['prototype'][_0x027a('0x27')]=function(_0x26e716){_0x26e716['on'](_0x027a('0x2a'),this[_0x027a('0x2b')][_0x027a('0x10')](this));_0x26e716[_0x027a('0xb')](_0x027a('0x2c'),this[_0x027a('0x2d')][_0x027a('0x10')](this));_0x26e716[_0x027a('0xb')](_0x027a('0xe'),this['handleMessageEnd'][_0x027a('0x10')](this));};EmailImap[_0x027a('0x14')][_0x027a('0x2b')]=function(_0x32c36e){simpleParser(_0x32c36e,{'Iconv':Iconv},this[_0x027a('0x2e')][_0x027a('0x10')](this));};EmailImap[_0x027a('0x14')]['handleMessageAttributes']=function(){};EmailImap[_0x027a('0x14')][_0x027a('0x2f')]=function(){};EmailImap[_0x027a('0x14')]['handleSimpleParser']=function(_0x22f96b,_0x5b7602){if(_0x22f96b){logger[_0x027a('0x11')](_0x22f96b);}else{var _0x1e833f=this;utils[_0x027a('0x30')](this['account'],_0x5b7602,function(_0x4f5140){_0x1e833f[_0x027a('0x31')](_0x027a('0x6'),_0x4f5140);});}};EmailImap['prototype'][_0x027a('0x32')]=function(){this[_0x027a('0x1')][_0x027a('0x29')](!![],this[_0x027a('0x23')][_0x027a('0x10')](this));};EmailImap[_0x027a('0x14')][_0x027a('0x28')]=function(_0x1866b9){this[_0x027a('0x12')](_0x1866b9);this[_0x027a('0x1')][_0x027a('0x29')](!![],this[_0x027a('0x23')][_0x027a('0x10')](this));};EmailImap[_0x027a('0x14')][_0x027a('0xf')]=function(){this[_0x027a('0x31')](_0x027a('0xe'));};EmailImap['prototype'][_0x027a('0x12')]=function(_0x2c1d88,_0x200474){logger[_0x027a('0x11')](_0x027a('0x12'),this[_0x027a('0xa')]['email'],JSON[_0x027a('0x33')](_0x2c1d88));var _0x3d0bb1='';if(_0x2c1d88){if(_0x2c1d88['textCode']){_0x3d0bb1=_0x2c1d88[_0x027a('0x34')];}else{for(var _0x5a5d5a in _0x2c1d88){if(_0x2c1d88['hasOwnProperty'](_0x5a5d5a)){_0x3d0bb1+=_[_0x027a('0x35')](_0x5a5d5a)+':\x20'+_0x2c1d88[_0x5a5d5a]+'\x0a';}}}}if(_0x200474){this['imap'][_0x027a('0xe')]();}else{this[_0x027a('0x31')](_0x027a('0x11'),_0x3d0bb1);this[_0x027a('0x31')](_0x027a('0xe'));}};module['exports']=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 2712f89..16a27d4 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 _0x0116=['compile','sendMail','toString','verify','Not\x20verifired','nodemailer','prototype','send','createTransport','use'];(function(_0x539718,_0x5d2588){var _0x107f42=function(_0x14fe58){while(--_0x14fe58){_0x539718['push'](_0x539718['shift']());}};_0x107f42(++_0x5d2588);}(_0x0116,0xaf));var _0x6011=function(_0x4fbfd9,_0x3ab91a){_0x4fbfd9=_0x4fbfd9-0x0;var _0x31dc94=_0x0116[_0x4fbfd9];return _0x31dc94;};'use strict';var nodemailer=require(_0x6011('0x0'));var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp[_0x6011('0x1')][_0x6011('0x2')]=function(_0x2c9d7e,_0x17e030){return new Promise(function(_0x3748f2,_0xa60331){var _0x3353cd=nodemailer[_0x6011('0x3')](_0x2c9d7e);_0x3353cd[_0x6011('0x4')](_0x6011('0x5'),inlineBase64());_0x3353cd[_0x6011('0x6')](_0x17e030,function(_0x451c0b,_0x3cdb57){if(_0x451c0b){_0xa60331(_0x451c0b[_0x6011('0x7')]());}else{_0x3748f2(_0x3cdb57);}});});};EmailSmtp['prototype'][_0x6011('0x8')]=function(_0x30753c){return new Promise(function(_0x82b790,_0x3aa62a){var _0x2976a4=nodemailer[_0x6011('0x3')](_0x30753c);_0x2976a4[_0x6011('0x8')](function(_0x98737b,_0x389938){if(_0x98737b){_0x3aa62a(_0x98737b['toString']());}else{if(_0x389938){_0x82b790(_0x389938);}else{_0x3aa62a(_0x6011('0x9'));}}});});};module['exports']=EmailSmtp; \ No newline at end of file +var _0x7290=['Not\x20verifired','nodemailer-plugin-inline-base64','prototype','send','compile','sendMail','toString','verify'];(function(_0x1ae5ab,_0xc5d441){var _0x1ce001=function(_0x5ef96d){while(--_0x5ef96d){_0x1ae5ab['push'](_0x1ae5ab['shift']());}};_0x1ce001(++_0xc5d441);}(_0x7290,0x1d9));var _0x0729=function(_0x280421,_0x238fa1){_0x280421=_0x280421-0x0;var _0x328d92=_0x7290[_0x280421];return _0x328d92;};'use strict';var nodemailer=require('nodemailer');var inlineBase64=require(_0x0729('0x0'));function EmailSmtp(){}EmailSmtp[_0x0729('0x1')][_0x0729('0x2')]=function(_0x335ab8,_0x588ce6){return new Promise(function(_0x5dab40,_0x169bad){var _0x69175d=nodemailer['createTransport'](_0x335ab8);_0x69175d['use'](_0x0729('0x3'),inlineBase64());_0x69175d[_0x0729('0x4')](_0x588ce6,function(_0x253fa5,_0x4f8a4c){if(_0x253fa5){_0x169bad(_0x253fa5[_0x0729('0x5')]());}else{_0x5dab40(_0x4f8a4c);}});});};EmailSmtp['prototype'][_0x0729('0x6')]=function(_0x3397f9){return new Promise(function(_0x15af7,_0x866741){var _0xc9b598=nodemailer['createTransport'](_0x3397f9);_0xc9b598['verify'](function(_0xbef2fc,_0x34b0e6){if(_0xbef2fc){_0x866741(_0xbef2fc[_0x0729('0x5')]());}else{if(_0x34b0e6){_0x15af7(_0x34b0e6);}else{_0x866741(_0x0729('0x7'));}}});});};module['exports']=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index e7f15e3..373d251 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 _0xfa42=['textAsHtml','Empty\x20message

','Attachments','Title','Data','generateXOAuth2Token','user=','auth=Bearer\x20','utf-8','base64','moment','path','node-tnef','../../../config/logger','../../../config/environment','head','value','anonymous','generate','name','address','substring','split','length','slice','join','Anonymous','@xcally.com','html','test','replace','includes','\x20[Attachment:\x20','\x20]','body'];(function(_0x44c40f,_0x12268c){var _0x159b61=function(_0xd458ca){while(--_0xd458ca){_0x44c40f['push'](_0x44c40f['shift']());}};_0x159b61(++_0x12268c);}(_0xfa42,0x1d5));var _0x2fa4=function(_0x221f79,_0x2032b0){_0x221f79=_0x221f79-0x0;var _0x22c595=_0xfa42[_0x221f79];return _0x22c595;};'use strict';var _=require('lodash');var moment=require(_0x2fa4('0x0'));var random=require('randomstring');var fs=require('fs');var path=require(_0x2fa4('0x1'));var util=require('util');var tnef=require(_0x2fa4('0x2'));var logger=require(_0x2fa4('0x3'))('email');var config=require(_0x2fa4('0x4'));function getAddress(_0x1fb1d5){var _0x64f6ea=_[_0x2fa4('0x5')](_0x1fb1d5[_0x2fa4('0x6')]);return _0x64f6ea&&_0x64f6ea['address']?_0x64f6ea['address']:_0x2fa4('0x7')+random[_0x2fa4('0x8')](0x6)+'@xcally.com';}function getFirstName(_0x3fd865){var _0x270c30=_[_0x2fa4('0x5')](_0x3fd865[_0x2fa4('0x6')]);if(_0x270c30&&_0x270c30[_0x2fa4('0x9')]){if(_0x270c30[_0x2fa4('0x9')]==_0x270c30[_0x2fa4('0xa')]){return _0x270c30[_0x2fa4('0x9')][_0x2fa4('0xb')](0x0,_0x270c30[_0x2fa4('0x9')]['indexOf']('@'));}var _0x4e7bdc=_0x270c30[_0x2fa4('0x9')][_0x2fa4('0xc')](/\s+/);return _0x4e7bdc[_0x2fa4('0xd')]>0x1?_0x4e7bdc[_0x2fa4('0xe')](0x0,-0x1)[_0x2fa4('0xf')]('\x20'):_0x270c30['name'];}return _0x2fa4('0x10');}function getLastName(_0x474407){var _0x153503=_[_0x2fa4('0x5')](_0x474407[_0x2fa4('0x6')]);if(_0x153503&&_0x153503['name']){var _0x5e160d=_0x153503[_0x2fa4('0x9')][_0x2fa4('0xc')](/\s+/);return _0x5e160d['length']>0x1?_0x5e160d['pop']():'';}return'';}function getMails(_0x3d3def,_0x5a18ed){var _0xe78cad='';for(var _0x1cdb75=0x0;_0x1cdb75<_0x5a18ed[_0x2fa4('0x6')][_0x2fa4('0xd')];_0x1cdb75+=0x1){if(_0x5a18ed[_0x2fa4('0x6')][_0x1cdb75]['address']!==_0x3d3def){if(!_['isEmpty'](_0xe78cad)){_0xe78cad+=',';}_0xe78cad+=_0x5a18ed[_0x2fa4('0x6')][_0x1cdb75][_0x2fa4('0x9')]||_0x5a18ed[_0x2fa4('0x6')][_0x1cdb75][_0x2fa4('0xa')]||'';_0xe78cad+='\x20<';_0xe78cad+=_0x5a18ed[_0x2fa4('0x6')][_0x1cdb75][_0x2fa4('0xa')]?_0x5a18ed[_0x2fa4('0x6')][_0x1cdb75]['address']:'anonymous'+random[_0x2fa4('0x8')](0x6)+_0x2fa4('0x11');_0xe78cad+='>';}}return _0xe78cad;}function parseEmail(_0x389ad6,_0xeccfa1,_0x3d0090){if(_0xeccfa1[_0x2fa4('0x12')]){var _0x15779f=/)<[^<]*)*<\/script>/gi;while(_0x15779f[_0x2fa4('0x13')](_0xeccfa1[_0x2fa4('0x12')])){_0xeccfa1[_0x2fa4('0x12')]=_0xeccfa1[_0x2fa4('0x12')][_0x2fa4('0x14')](_0x15779f,'');}if(_0xeccfa1[_0x2fa4('0x12')][_0x2fa4('0x15')](_0x2fa4('0x16'))){var _0x5eb65c=[];_0xeccfa1['attachments']['forEach'](_0x3b0050=>{_0x5eb65c[_0x2fa4('0x17')](_0x3b0050[_0x2fa4('0x18')]);});var _0x22c2c4=/]+>/g;var _0x1ea184=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x32d8dc=_0xeccfa1[_0x2fa4('0x12')][_0x2fa4('0x14')](_0x1ea184,'_SRC');var _0x2dd461=_0x32d8dc[_0x2fa4('0x14')](_0x22c2c4,'_IMG');for(let _0x462b27=0x0;_0x462b27<_0x5eb65c[_0x2fa4('0xd')];_0x462b27++){var _0x40931a=_0x2dd461[_0x2fa4('0x14')]('_IMG',_0x2fa4('0x19')+_0x5eb65c[_0x462b27]+_0x2fa4('0x1a'));_0x2dd461=_0x40931a;}_0xeccfa1[_0x2fa4('0x12')]=_0x2dd461;}_0x3d0090[_0x2fa4('0x1b')]=_0xeccfa1[_0x2fa4('0x12')];}else{_0x3d0090[_0x2fa4('0x1b')]=_0xeccfa1[_0x2fa4('0x1c')];}if(_0x3d0090[_0x2fa4('0x1b')]){_0x3d0090[_0x2fa4('0x1b')]=_0x3d0090[_0x2fa4('0x1b')]['replace'](/0x0){var _0x2b557d=[_0x2fa4('0x2f'),_0x2fa4('0x30'),'Precedence:\x20auto_reply'];for(var _0x2058f4=0x0;_0x2058f4<_0xeccfa1['headerLines'][_0x2fa4('0xd')];_0x2058f4++){var _0x1db950=_['indexOf'](_0x2b557d,_0xeccfa1[_0x2fa4('0x2e')][_0x2058f4][_0x2fa4('0x31')]);if(_0x1db950>=0x0){_0x3d0090['isAutoreply']=!![];}}}return _0x3d0090;}exports[_0x2fa4('0x32')]=function(_0x17fd38,_0x42a037,_0x1b905e){var _0x11939b={'from':getAddress(_0x42a037['from']),'firstName':getFirstName(_0x42a037[_0x2fa4('0x33')]),'lastName':getLastName(_0x42a037[_0x2fa4('0x33')]),'mapKey':_0x2fa4('0x1f'),'message':{'from':getMails(_0x17fd38[_0x2fa4('0x1f')],_0x42a037[_0x2fa4('0x33')]),'to':_0x17fd38[_0x2fa4('0x1f')],'cc':'','subject':_0x42a037[_0x2fa4('0x34')]||'','messageId':_0x42a037[_0x2fa4('0x35')],'inReplyTo':_0x42a037[_0x2fa4('0x36')],'sentAt':moment(_0x42a037[_0x2fa4('0x37')])[_0x2fa4('0x27')](_0x2fa4('0x38')),'attach':![],'attachments':[]}};if(!_0x42a037[_0x2fa4('0x12')]&&!_0x42a037['textAsHtml']){var _0x16a5d3=_[_0x2fa4('0x39')](_0x42a037[_0x2fa4('0x23')],{'contentType':_0x2fa4('0x3a')});if(_0x16a5d3[_0x2fa4('0xd')]){logger[_0x2fa4('0x3b')](util[_0x2fa4('0x27')]('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0x42a037[_0x2fa4('0x35')]));tnef[_0x2fa4('0x3c')](_[_0x2fa4('0x3d')](_0x16a5d3)[_0x2fa4('0x2c')],function(_0x4f622c,_0x38f654){if(_0x38f654){_0x42a037[_0x2fa4('0x12')]=_0x38f654['BodyHTML']||_0x2fa4('0x3e');if(_0x38f654[_0x2fa4('0x3f')]){for(var _0x3f000c=0x0;_0x3f000c<_0x38f654[_0x2fa4('0x3f')][_0x2fa4('0xd')];_0x3f000c++){var _0x5e3f79=_0x38f654[_0x2fa4('0x3f')][_0x3f000c];_0x11939b[_0x2fa4('0x21')]['attachments'][_0x2fa4('0x17')]({'filename':_0x5e3f79[_0x2fa4('0x40')],'content':Buffer[_0x2fa4('0x33')](_0x5e3f79[_0x2fa4('0x41')])});}}}_0x1b905e(parseEmail(_0x17fd38,_0x42a037,_0x11939b));});}else{_0x42a037[_0x2fa4('0x12')]='

Empty\x20message

';_0x1b905e(parseEmail(_0x17fd38,_0x42a037,_0x11939b));}}else{_0x1b905e(parseEmail(_0x17fd38,_0x42a037,_0x11939b));}};exports[_0x2fa4('0x42')]=function(_0x37055b,_0x4b0a52){var _0x4785ad=[_0x2fa4('0x43')+(_0x4b0a52||''),_0x2fa4('0x44')+_0x37055b,'',''];return Buffer[_0x2fa4('0x33')](_0x4785ad[_0x2fa4('0xf')](''),_0x2fa4('0x45'))['toString'](_0x2fa4('0x46'));}; \ No newline at end of file +var _0xa57e=['replace','includes','','body','textAsHtml','Empty\x20message

','Attachments','Title','Data','generateXOAuth2Token','user=','auth=Bearer\x20','utf-8','toString','base64','lodash','randomstring','path','../../../config/logger','email','../../../config/environment','head','value','address','anonymous','generate','@xcally.com','name','split','length','Anonymous','pop','html','test'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa57e,0x191));var _0xea57=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa57e[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xea57('0x0'));var moment=require('moment');var random=require(_0xea57('0x1'));var fs=require('fs');var path=require(_0xea57('0x2'));var util=require('util');var tnef=require('node-tnef');var logger=require(_0xea57('0x3'))(_0xea57('0x4'));var config=require(_0xea57('0x5'));function getAddress(_0x56c38f){var _0x58512c=_[_0xea57('0x6')](_0x56c38f[_0xea57('0x7')]);return _0x58512c&&_0x58512c['address']?_0x58512c[_0xea57('0x8')]:_0xea57('0x9')+random[_0xea57('0xa')](0x6)+_0xea57('0xb');}function getFirstName(_0x3e8b52){var _0x5747f4=_[_0xea57('0x6')](_0x3e8b52[_0xea57('0x7')]);if(_0x5747f4&&_0x5747f4['name']){if(_0x5747f4[_0xea57('0xc')]==_0x5747f4['address']){return _0x5747f4[_0xea57('0xc')]['substring'](0x0,_0x5747f4[_0xea57('0xc')]['indexOf']('@'));}var _0x4e6b40=_0x5747f4['name'][_0xea57('0xd')](/\s+/);return _0x4e6b40[_0xea57('0xe')]>0x1?_0x4e6b40['slice'](0x0,-0x1)['join']('\x20'):_0x5747f4[_0xea57('0xc')];}return _0xea57('0xf');}function getLastName(_0x34d968){var _0x1a182e=_[_0xea57('0x6')](_0x34d968['value']);if(_0x1a182e&&_0x1a182e[_0xea57('0xc')]){var _0x2655a8=_0x1a182e[_0xea57('0xc')][_0xea57('0xd')](/\s+/);return _0x2655a8[_0xea57('0xe')]>0x1?_0x2655a8[_0xea57('0x10')]():'';}return'';}function getMails(_0x629d5e,_0x3bbece){var _0xe5339b='';for(var _0x3697f5=0x0;_0x3697f5<_0x3bbece[_0xea57('0x7')][_0xea57('0xe')];_0x3697f5+=0x1){if(_0x3bbece[_0xea57('0x7')][_0x3697f5][_0xea57('0x8')]!==_0x629d5e){if(!_['isEmpty'](_0xe5339b)){_0xe5339b+=',';}_0xe5339b+=_0x3bbece[_0xea57('0x7')][_0x3697f5][_0xea57('0xc')]||_0x3bbece['value'][_0x3697f5]['address']||'';_0xe5339b+='\x20<';_0xe5339b+=_0x3bbece['value'][_0x3697f5]['address']?_0x3bbece[_0xea57('0x7')][_0x3697f5][_0xea57('0x8')]:_0xea57('0x9')+random[_0xea57('0xa')](0x6)+'@xcally.com';_0xe5339b+='>';}}return _0xe5339b;}function parseEmail(_0x4dea30,_0x161f0a,_0x288970){if(_0x161f0a[_0xea57('0x11')]){var _0xe0bf64=/)<[^<]*)*<\/script>/gi;while(_0xe0bf64[_0xea57('0x12')](_0x161f0a['html'])){_0x161f0a[_0xea57('0x11')]=_0x161f0a[_0xea57('0x11')][_0xea57('0x13')](_0xe0bf64,'');}if(_0x161f0a[_0xea57('0x11')][_0xea57('0x14')](_0xea57('0x15'))){var _0x97ccc9=[];_0x161f0a[_0xea57('0x16')][_0xea57('0x17')](_0x5cc927=>{_0x97ccc9[_0xea57('0x18')](_0x5cc927[_0xea57('0x19')]);});var _0x2744fb=/]+>/g;var _0x195e31=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x30c951=_0x161f0a['html'][_0xea57('0x13')](_0x195e31,'_SRC');var _0x4cad08=_0x30c951[_0xea57('0x13')](_0x2744fb,_0xea57('0x1a'));for(let _0x3a64ff=0x0;_0x3a64ff<_0x97ccc9[_0xea57('0xe')];_0x3a64ff++){var _0x38d4a6=_0x4cad08[_0xea57('0x13')](_0xea57('0x1a'),'\x20[Attachment:\x20'+_0x97ccc9[_0x3a64ff]+_0xea57('0x1b'));_0x4cad08=_0x38d4a6;}_0x161f0a['html']=_0x4cad08;}_0x288970[_0xea57('0x1c')]=_0x161f0a[_0xea57('0x11')];}else{_0x288970[_0xea57('0x1c')]=_0x161f0a[_0xea57('0x1d')];}if(_0x288970['body']){_0x288970[_0xea57('0x1c')]=_0x288970[_0xea57('0x1c')][_0xea57('0x13')](/0x0){var _0x5615d8=['Auto-Submitted:\x20auto-replied',_0xea57('0x2e'),_0xea57('0x2f')];for(var _0x36cdf6=0x0;_0x36cdf6<_0x161f0a[_0xea57('0x2d')][_0xea57('0xe')];_0x36cdf6++){var _0xe7a414=_[_0xea57('0x30')](_0x5615d8,_0x161f0a['headerLines'][_0x36cdf6][_0xea57('0x31')]);if(_0xe7a414>=0x0){_0x288970[_0xea57('0x32')]=!![];}}}return _0x288970;}exports[_0xea57('0x33')]=function(_0x4833cd,_0x32aa13,_0x533600){var _0x1f7a6a={'from':getAddress(_0x32aa13[_0xea57('0x34')]),'firstName':getFirstName(_0x32aa13[_0xea57('0x34')]),'lastName':getLastName(_0x32aa13[_0xea57('0x34')]),'mapKey':'email','message':{'from':getMails(_0x4833cd[_0xea57('0x4')],_0x32aa13[_0xea57('0x34')]),'to':_0x4833cd[_0xea57('0x4')],'cc':'','subject':_0x32aa13['subject']||'','messageId':_0x32aa13[_0xea57('0x35')],'inReplyTo':_0x32aa13[_0xea57('0x36')],'sentAt':moment(_0x32aa13[_0xea57('0x37')])[_0xea57('0x27')]('YYYY-MM-DD\x20HH:mm:ss'),'attach':![],'attachments':[]}};if(!_0x32aa13[_0xea57('0x11')]&&!_0x32aa13[_0xea57('0x1d')]){var _0x180be1=_[_0xea57('0x38')](_0x32aa13[_0xea57('0x16')],{'contentType':'application/ms-tnef'});if(_0x180be1[_0xea57('0xe')]){logger['info'](util[_0xea57('0x27')](_0xea57('0x39'),_0x32aa13['messageId']));tnef[_0xea57('0x3a')](_['first'](_0x180be1)['content'],function(_0xee8c93,_0x4d6634){if(_0x4d6634){_0x32aa13[_0xea57('0x11')]=_0x4d6634[_0xea57('0x3b')]||_0xea57('0x3c');if(_0x4d6634[_0xea57('0x3d')]){for(var _0x5c77b7=0x0;_0x5c77b7<_0x4d6634[_0xea57('0x3d')][_0xea57('0xe')];_0x5c77b7++){var _0x19999c=_0x4d6634[_0xea57('0x3d')][_0x5c77b7];_0x1f7a6a['message'][_0xea57('0x16')]['push']({'filename':_0x19999c[_0xea57('0x3e')],'content':Buffer[_0xea57('0x34')](_0x19999c[_0xea57('0x3f')])});}}}_0x533600(parseEmail(_0x4833cd,_0x32aa13,_0x1f7a6a));});}else{_0x32aa13[_0xea57('0x11')]=_0xea57('0x3c');_0x533600(parseEmail(_0x4833cd,_0x32aa13,_0x1f7a6a));}}else{_0x533600(parseEmail(_0x4833cd,_0x32aa13,_0x1f7a6a));}};exports[_0xea57('0x40')]=function(_0x5de3ac,_0x1b2542){var _0x2f1720=[_0xea57('0x41')+(_0x1b2542||''),_0xea57('0x42')+_0x5de3ac,'',''];return Buffer[_0xea57('0x34')](_0x2f1720[_0xea57('0x29')](''),_0xea57('0x43'))[_0xea57('0x44')](_0xea57('0x45'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index d73e288..fa10873 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 _0x1182=['Service','SERV','active','Imap','Smtp','exports','lodash','name'];(function(_0x1bc25a,_0x275e31){var _0x4de872=function(_0x4c541f){while(--_0x4c541f){_0x1bc25a['push'](_0x1bc25a['shift']());}};_0x4de872(++_0x275e31);}(_0x1182,0x176));var _0x2118=function(_0x255be9,_0x3345d9){_0x255be9=_0x255be9-0x0;var _0x34fedf=_0x1182[_0x255be9];return _0x34fedf;};'use strict';var _=require(_0x2118('0x0'));function MailAccount(_0x1a0f18){this['id']=_0x1a0f18['id']||0x0;this[_0x2118('0x1')]=_0x1a0f18[_0x2118('0x1')]||_0x2118('0x2');this['key']=_0x1a0f18['key']||_0x2118('0x3');this[_0x2118('0x4')]=_0x1a0f18[_0x2118('0x4')]||![];this[_0x2118('0x5')]=_0x1a0f18[_0x2118('0x5')]||[];this[_0x2118('0x6')]=_0x1a0f18[_0x2118('0x6')]||[];}module[_0x2118('0x7')]=MailAccount; \ No newline at end of file +var _0x38d9=['name','Service','key','active','Imap','Smtp','lodash'];(function(_0x35b3e9,_0x1aed1d){var _0x19d6cc=function(_0x6a18b8){while(--_0x6a18b8){_0x35b3e9['push'](_0x35b3e9['shift']());}};_0x19d6cc(++_0x1aed1d);}(_0x38d9,0x109));var _0x938d=function(_0x493565,_0x3c6749){_0x493565=_0x493565-0x0;var _0x479874=_0x38d9[_0x493565];return _0x479874;};'use strict';var _=require(_0x938d('0x0'));function MailAccount(_0x361ea3){this['id']=_0x361ea3['id']||0x0;this[_0x938d('0x1')]=_0x361ea3[_0x938d('0x1')]||_0x938d('0x2');this[_0x938d('0x3')]=_0x361ea3[_0x938d('0x3')]||'SERV';this[_0x938d('0x4')]=_0x361ea3['active']||![];this['Imap']=_0x361ea3[_0x938d('0x5')]||[];this[_0x938d('0x6')]=_0x361ea3[_0x938d('0x6')]||[];}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 b183fc3..56d7010 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 _0xa4ce=['isUndefined','exports','../model/mailAccount','mailAccounts','mapKeys','prototype','initMailAccounts','length'];(function(_0x2e5f9c,_0x134a52){var _0x538b44=function(_0x38ef13){while(--_0x38ef13){_0x2e5f9c['push'](_0x2e5f9c['shift']());}};_0x538b44(++_0x134a52);}(_0xa4ce,0x162));var _0xea4c=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa4ce[_0x5b561d];return _0x431060;};'use strict';var _=require('lodash');var MailAccount=require(_0xea4c('0x0'));var Realtime=function(){this[_0xea4c('0x1')]={};};function freeIsNotKey(_0x2a0777,_0x24fd85,_0x55cfe3){var _0x34d39f=_[_0xea4c('0x2')](_0x2a0777,function(_0x7624c2,_0x5371fc){return _0x7624c2[_0x55cfe3];});for(var _0x57a0c2 in _0x24fd85){if(_0x24fd85['hasOwnProperty'](_0x57a0c2)){if(!_0x34d39f[_0x57a0c2]){delete _0x24fd85[_0x57a0c2];}}}}Realtime['prototype']['mergeFromDatabase']=function(_0x5987a4,_0x315845){for(var _0x4cbd99 in _0x315845){if(_0x5987a4['hasOwnProperty'](_0x4cbd99)){_0x5987a4[_0x4cbd99]=_0x315845[_0x4cbd99];}}};Realtime[_0xea4c('0x3')][_0xea4c('0x4')]=function(){var _0xec4849=this;return function(_0x1fbdf){if(_0x1fbdf){freeIsNotKey(_0x1fbdf,_0xec4849[_0xea4c('0x1')],'id');for(var _0x734734=0x0,_0x36dbd0={},_0x3ad90e={};_0x734734<_0x1fbdf[_0xea4c('0x5')];_0x734734+=0x1){_0x36dbd0=_0x1fbdf[_0x734734];if(_[_0xea4c('0x6')](_0xec4849[_0xea4c('0x1')][_0x36dbd0['id']])){_0xec4849[_0xea4c('0x1')][_0x36dbd0['id']]=new MailAccount(_0x36dbd0);}else{_['merge'](_0xec4849[_0xea4c('0x1')][_0x36dbd0['id']],_0x36dbd0);}}}return _0xec4849[_0xea4c('0x1')];};};module[_0xea4c('0x7')]=Realtime; \ No newline at end of file +var _0xa2fd=['prototype','mergeFromDatabase','initMailAccounts','mailAccounts','length','exports','lodash','mapKeys','hasOwnProperty'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa2fd,0xc3));var _0xda2f=function(_0x28b7ab,_0x16a764){_0x28b7ab=_0x28b7ab-0x0;var _0x56791b=_0xa2fd[_0x28b7ab];return _0x56791b;};'use strict';var _=require(_0xda2f('0x0'));var MailAccount=require('../model/mailAccount');var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x2a7df1,_0x1aa4a5,_0x5ee4c5){var _0x338a99=_[_0xda2f('0x1')](_0x2a7df1,function(_0x499e5f,_0x2445ae){return _0x499e5f[_0x5ee4c5];});for(var _0x1949af in _0x1aa4a5){if(_0x1aa4a5[_0xda2f('0x2')](_0x1949af)){if(!_0x338a99[_0x1949af]){delete _0x1aa4a5[_0x1949af];}}}}Realtime[_0xda2f('0x3')][_0xda2f('0x4')]=function(_0x3e8428,_0x4937b7){for(var _0x1d75c2 in _0x4937b7){if(_0x3e8428[_0xda2f('0x2')](_0x1d75c2)){_0x3e8428[_0x1d75c2]=_0x4937b7[_0x1d75c2];}}};Realtime['prototype'][_0xda2f('0x5')]=function(){var _0x2f998f=this;return function(_0x1e7e44){if(_0x1e7e44){freeIsNotKey(_0x1e7e44,_0x2f998f[_0xda2f('0x6')],'id');for(var _0x3fe009=0x0,_0x5ef810={},_0x2ea460={};_0x3fe009<_0x1e7e44[_0xda2f('0x7')];_0x3fe009+=0x1){_0x5ef810=_0x1e7e44[_0x3fe009];if(_['isUndefined'](_0x2f998f[_0xda2f('0x6')][_0x5ef810['id']])){_0x2f998f[_0xda2f('0x6')][_0x5ef810['id']]=new MailAccount(_0x5ef810);}else{_['merge'](_0x2f998f[_0xda2f('0x6')][_0x5ef810['id']],_0x5ef810);}}}return _0x2f998f[_0xda2f('0x6')];};};module[_0xda2f('0x8')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 074e45a..70ef4bf 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 _0xe9f2=['name','data5','MailServerOut','type','notify','NotifyMailAccount','../client','getMailAccounts','Request','GetMailAccount','provider','service','email','active','ListId','TemplateId','MailServerIn','CloudProvider'];(function(_0x1508d5,_0x439a49){var _0x42fe37=function(_0x17c98e){while(--_0x17c98e){_0x1508d5['push'](_0x1508d5['shift']());}};_0x42fe37(++_0x439a49);}(_0xe9f2,0xba));var _0x2e9f=function(_0x2523eb,_0xcc1cbc){_0x2523eb=_0x2523eb-0x0;var _0xc013c6=_0xe9f2[_0x2523eb];return _0xc013c6;};'use strict';var client=require(_0x2e9f('0x0'));exports[_0x2e9f('0x1')]=function(){return function(){return client[_0x2e9f('0x2')](_0x2e9f('0x3'),{'options':{'attributes':['id','name',_0x2e9f('0x4'),_0x2e9f('0x5'),_0x2e9f('0x6'),_0x2e9f('0x7'),'key',_0x2e9f('0x8'),_0x2e9f('0x9')],'raw':![],'include':[{'model':_0x2e9f('0xa'),'as':'Imap','include':[{'model':_0x2e9f('0xb'),'attributes':['id',_0x2e9f('0xc'),'service','type',_0x2e9f('0xd')],'as':_0x2e9f('0xb')}]},{'model':_0x2e9f('0xe'),'as':'Smtp','include':[{'model':_0x2e9f('0xb'),'attributes':['id','name',_0x2e9f('0x5'),_0x2e9f('0xf'),'data5'],'as':_0x2e9f('0xb')}]}]},'log':'getMailAccount'});};};exports[_0x2e9f('0x10')]=function(_0x1ef5f0,_0x4e7e22){return client[_0x2e9f('0x2')](_0x2e9f('0x11'),{'account':{'id':_0x1ef5f0},'body':_0x4e7e22,'log':_0x2e9f('0x11')});}; \ No newline at end of file +var _0x2c16=['../client','getMailAccounts','Request','name','provider','service','email','active','key','ListId','TemplateId','MailServerIn','Imap','type','CloudProvider','Smtp','data5','getMailAccount','notify','NotifyMailAccount'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x2c16,0xf0));var _0x62c1=function(_0x1e6f24,_0x2c372d){_0x1e6f24=_0x1e6f24-0x0;var _0x280340=_0x2c16[_0x1e6f24];return _0x280340;};'use strict';var client=require(_0x62c1('0x0'));exports[_0x62c1('0x1')]=function(){return function(){return client[_0x62c1('0x2')]('GetMailAccount',{'options':{'attributes':['id',_0x62c1('0x3'),_0x62c1('0x4'),_0x62c1('0x5'),_0x62c1('0x6'),_0x62c1('0x7'),_0x62c1('0x8'),_0x62c1('0x9'),_0x62c1('0xa')],'raw':![],'include':[{'model':_0x62c1('0xb'),'as':_0x62c1('0xc'),'include':[{'model':'CloudProvider','attributes':['id',_0x62c1('0x3'),_0x62c1('0x5'),_0x62c1('0xd'),'data5'],'as':_0x62c1('0xe')}]},{'model':'MailServerOut','as':_0x62c1('0xf'),'include':[{'model':_0x62c1('0xe'),'attributes':['id','name',_0x62c1('0x5'),'type',_0x62c1('0x10')],'as':_0x62c1('0xe')}]}]},'log':_0x62c1('0x11')});};};exports[_0x62c1('0x12')]=function(_0x907fab,_0x4bccb7){return client['Request'](_0x62c1('0x13'),{'account':{'id':_0x907fab},'body':_0x4bccb7,'log':_0x62c1('0x13')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index ab0b04e..c64feea 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 _0x0653=['Request','loginMailFrequency','GetSettings','../client'];(function(_0x2d9535,_0x4bc592){var _0xb4e710=function(_0x50b9a9){while(--_0x50b9a9){_0x2d9535['push'](_0x2d9535['shift']());}};_0xb4e710(++_0x4bc592);}(_0x0653,0x1e3));var _0x3065=function(_0x5b93ed,_0x1a0bd7){_0x5b93ed=_0x5b93ed-0x0;var _0x30bdca=_0x0653[_0x5b93ed];return _0x30bdca;};'use strict';var client=require(_0x3065('0x0'));exports['getSettings']=function(){return client[_0x3065('0x1')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x3065('0x2')]},'log':_0x3065('0x3')});}; \ No newline at end of file +var _0x93cd=['GetSettings','../client','Request','loginMailFrequency'];(function(_0x294f59,_0x45946c){var _0x3ff319=function(_0x49c9d2){while(--_0x49c9d2){_0x294f59['push'](_0x294f59['shift']());}};_0x3ff319(++_0x45946c);}(_0x93cd,0xdd));var _0xd93c=function(_0x4d3a2b,_0x32a224){_0x4d3a2b=_0x4d3a2b-0x0;var _0xdd32c8=_0x93cd[_0x4d3a2b];return _0xdd32c8;};'use strict';var client=require(_0xd93c('0x0'));exports['getSettings']=function(){return client[_0xd93c('0x1')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xd93c('0x2')]},'log':_0xd93c('0x3')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index d282507..56508bb 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(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'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(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file diff --git a/server/services/express/index.js b/server/services/express/index.js index 33a5d51..1e7fbe2 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 _0x72bd=['exports','lodash','express','../../config/environment','createServer','timeout','port','websocket','redis','defaults','localhost','adapter','socket.io-redis','default','../../config/socketio','../../config/express','../../routes','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!'];(function(_0x3a6efd,_0x2a5102){var _0x487b9a=function(_0x104f89){while(--_0x104f89){_0x3a6efd['push'](_0x3a6efd['shift']());}};_0x487b9a(++_0x2a5102);}(_0x72bd,0x166));var _0xd72b=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0x72bd[_0x243b2f];return _0xcb3c2d;};'use strict';var _=require(_0xd72b('0x0'));var http=require('http');var express=require(_0xd72b('0x1'));var sticky=require('sticky-session');var Redis=require('ioredis');var config=require(_0xd72b('0x2'));var app=express();var server=http[_0xd72b('0x3')](app);server[_0xd72b('0x4')]=0xdbba0;if(sticky['listen'](server,config[_0xd72b('0x5')])){var socketio=require('socket.io')(server,{'transports':[_0xd72b('0x6'),'polling']});config[_0xd72b('0x7')]=_[_0xd72b('0x8')](config[_0xd72b('0x7')],{'host':_0xd72b('0x9'),'port':0x18eb});socketio[_0xd72b('0xa')](require(_0xd72b('0xb'))({'pubClient':new Redis(config[_0xd72b('0x7')]),'subClient':new Redis(config[_0xd72b('0x7')])}));require('../../config/triggers')[_0xd72b('0xc')]();require(_0xd72b('0xd'))['default'](socketio);require(_0xd72b('0xe'))[_0xd72b('0xc')](app);require(_0xd72b('0xf'))[_0xd72b('0xc')](app);}else{server[_0xd72b('0x10')](_0xd72b('0x11'),function(){console[_0xd72b('0x12')](_0xd72b('0x13'),config[_0xd72b('0x5')]);});}exports=module[_0xd72b('0x14')]=app; \ No newline at end of file +var _0x229d=['defaults','socket.io-redis','../../config/triggers','default','../../config/socketio','../../config/express','../../routes','listening','Express\x20server\x20listening\x20on\x20port\x20%d!','lodash','http','sticky-session','ioredis','../../config/environment','createServer','timeout','listen','port','socket.io','websocket','polling','redis'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x229d,0x111));var _0xd229=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x229d[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0xd229('0x0'));var http=require(_0xd229('0x1'));var express=require('express');var sticky=require(_0xd229('0x2'));var Redis=require(_0xd229('0x3'));var config=require(_0xd229('0x4'));var app=express();var server=http[_0xd229('0x5')](app);server[_0xd229('0x6')]=0xdbba0;if(sticky[_0xd229('0x7')](server,config[_0xd229('0x8')])){var socketio=require(_0xd229('0x9'))(server,{'transports':[_0xd229('0xa'),_0xd229('0xb')]});config[_0xd229('0xc')]=_[_0xd229('0xd')](config[_0xd229('0xc')],{'host':'localhost','port':0x18eb});socketio['adapter'](require(_0xd229('0xe'))({'pubClient':new Redis(config[_0xd229('0xc')]),'subClient':new Redis(config[_0xd229('0xc')])}));require(_0xd229('0xf'))[_0xd229('0x10')]();require(_0xd229('0x11'))[_0xd229('0x10')](socketio);require(_0xd229('0x12'))[_0xd229('0x10')](app);require(_0xd229('0x13'))[_0xd229('0x10')](app);}else{server['once'](_0xd229('0x14'),function(){console['log'](_0xd229('0x15'),config['port']);});}exports=module['exports']=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index d11c49e..e45fd44 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 _0xb978=['catch','exports','../../config/logger','routing','client','http','Request','then','debug','error','rpc','message'];(function(_0x231e16,_0x67347b){var _0x570a7c=function(_0x2c35b4){while(--_0x2c35b4){_0x231e16['push'](_0x231e16['shift']());}};_0x570a7c(++_0x67347b);}(_0xb978,0x146));var _0x8b97=function(_0x1d9a7d,_0x1f91ab){_0x1d9a7d=_0x1d9a7d-0x0;var _0x384e45=_0xb978[_0x1d9a7d];return _0x384e45;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x8b97('0x0'))(_0x8b97('0x1'));var client=jayson[_0x8b97('0x2')][_0x8b97('0x3')]({'port':0x2329});client[_0x8b97('0x4')]=function(_0x80cde6,_0x1fdb3d){return new BPromise(function(_0x76b74a,_0x3a87c8){return client['request'](_0x80cde6,_0x1fdb3d)[_0x8b97('0x5')](function(_0x3bbf50){logger[_0x8b97('0x6')]('rpc','routing',_0x80cde6,_0x1fdb3d,_0x3bbf50);if(_0x3bbf50['error']){logger[_0x8b97('0x7')](_0x8b97('0x8'),_0x8b97('0x1'),_0x80cde6,_0x3bbf50['error'][_0x8b97('0x9')],_0x1fdb3d);return _0x3a87c8(_0x3bbf50[_0x8b97('0x7')][_0x8b97('0x9')]);}else{return _0x76b74a(_0x3bbf50['result']);}})[_0x8b97('0xa')](function(_0x3516ff){logger['error'](_0x8b97('0x8'),_0x8b97('0x1'),_0x80cde6,_0x3516ff,_0x1fdb3d);return _0x3a87c8(_0x3516ff);});});};module[_0x8b97('0xb')]=client; \ No newline at end of file +var _0x59e5=['result','catch','jayson/promise','bluebird','../../config/logger','routing','http','Request','request','then','debug','rpc','error','message'];(function(_0x580647,_0x43d2c3){var _0x5f0792=function(_0x386cef){while(--_0x386cef){_0x580647['push'](_0x580647['shift']());}};_0x5f0792(++_0x43d2c3);}(_0x59e5,0x198));var _0x559e=function(_0x448418,_0x29af3b){_0x448418=_0x448418-0x0;var _0x40b9e7=_0x59e5[_0x448418];return _0x40b9e7;};'use strict';var jayson=require(_0x559e('0x0'));var BPromise=require(_0x559e('0x1'));var logger=require(_0x559e('0x2'))(_0x559e('0x3'));var client=jayson['client'][_0x559e('0x4')]({'port':0x2329});client[_0x559e('0x5')]=function(_0x92628e,_0x47120e){return new BPromise(function(_0x503f50,_0xc4f3bb){return client[_0x559e('0x6')](_0x92628e,_0x47120e)[_0x559e('0x7')](function(_0x2df407){logger[_0x559e('0x8')](_0x559e('0x9'),_0x559e('0x3'),_0x92628e,_0x47120e,_0x2df407);if(_0x2df407[_0x559e('0xa')]){logger[_0x559e('0xa')]('rpc',_0x559e('0x3'),_0x92628e,_0x2df407[_0x559e('0xa')][_0x559e('0xb')],_0x47120e);return _0xc4f3bb(_0x2df407[_0x559e('0xa')]['message']);}else{return _0x503f50(_0x2df407[_0x559e('0xc')]);}})[_0x559e('0xd')](function(_0x3acbd7){logger[_0x559e('0xa')](_0x559e('0x9'),_0x559e('0x3'),_0x92628e,_0x3acbd7,_0x47120e);return _0xc4f3bb(_0x3acbd7);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 7f0ca9b..1a6101b 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 _0xefc8=['listen','log','./rpc/user','./rpc/interval','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/whatsappQueue','resolve','then','getAgents','getIntervals','getOpenchannelQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues'];(function(_0x308213,_0x224541){var _0x2e1619=function(_0x972b51){while(--_0x972b51){_0x308213['push'](_0x308213['shift']());}};_0x2e1619(++_0x224541);}(_0xefc8,0x13d));var _0x8efc=function(_0x38d9b5,_0x5ae931){_0x38d9b5=_0x38d9b5-0x0;var _0x3a83ed=_0xefc8[_0x38d9b5];return _0x3a83ed;};'use strict';var BPromise=require('bluebird');var server=require('./server');var Realtime=require('./realtime');var user=require(_0x8efc('0x0'));var interval=require(_0x8efc('0x1'));var openchannelQueue=require('./rpc/openchannelQueue');var chatQueue=require(_0x8efc('0x2'));var smsQueue=require(_0x8efc('0x3'));var mailQueue=require(_0x8efc('0x4'));var faxQueue=require('./rpc/faxQueue');var whatsappQueue=require(_0x8efc('0x5'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x8efc('0x6')]()[_0x8efc('0x7')](user[_0x8efc('0x8')]())[_0x8efc('0x7')](realtime['initAgents']())[_0x8efc('0x7')](interval[_0x8efc('0x9')]())[_0x8efc('0x7')](realtime['initIntervals']())[_0x8efc('0x7')](openchannelQueue[_0x8efc('0xa')]())['then'](realtime['initOpenchannelQueues']())['then'](chatQueue['getChatQueues']())['then'](realtime[_0x8efc('0xb')]())[_0x8efc('0x7')](smsQueue[_0x8efc('0xc')]())[_0x8efc('0x7')](realtime[_0x8efc('0xd')]())['then'](mailQueue[_0x8efc('0xe')]())[_0x8efc('0x7')](realtime[_0x8efc('0xf')]())[_0x8efc('0x7')](faxQueue['getFaxQueues']())[_0x8efc('0x7')](realtime[_0x8efc('0x10')]())[_0x8efc('0x7')](whatsappQueue[_0x8efc('0x11')]())['then'](realtime[_0x8efc('0x12')]())[_0x8efc('0x7')](function(){return realtime;});}function main(){return server[_0x8efc('0x13')](realtime)[_0x8efc('0x7')](function(_0x116e37){return initRealtime();})[_0x8efc('0x7')](function(_0x4ffc5b){return setInterval(initRealtime,0x1388);})['catch'](function(_0xc4aa99){console[_0x8efc('0x14')](_0xc4aa99);});}main(); \ No newline at end of file +var _0x3746=['getIntervals','getOpenchannelQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','log','bluebird','./server','./rpc/user','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getAgents','initAgents'];(function(_0x5fa0c7,_0x155912){var _0x358fdd=function(_0x4c3571){while(--_0x4c3571){_0x5fa0c7['push'](_0x5fa0c7['shift']());}};_0x358fdd(++_0x155912);}(_0x3746,0x193));var _0x6374=function(_0x3d374d,_0x1248b2){_0x3d374d=_0x3d374d-0x0;var _0xdcf388=_0x3746[_0x3d374d];return _0xdcf388;};'use strict';var BPromise=require(_0x6374('0x0'));var server=require(_0x6374('0x1'));var Realtime=require('./realtime');var user=require(_0x6374('0x2'));var interval=require('./rpc/interval');var openchannelQueue=require(_0x6374('0x3'));var chatQueue=require(_0x6374('0x4'));var smsQueue=require(_0x6374('0x5'));var mailQueue=require(_0x6374('0x6'));var faxQueue=require(_0x6374('0x7'));var whatsappQueue=require(_0x6374('0x8'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x6374('0x9')]()[_0x6374('0xa')](user[_0x6374('0xb')]())[_0x6374('0xa')](realtime[_0x6374('0xc')]())[_0x6374('0xa')](interval[_0x6374('0xd')]())[_0x6374('0xa')](realtime['initIntervals']())['then'](openchannelQueue[_0x6374('0xe')]())[_0x6374('0xa')](realtime['initOpenchannelQueues']())[_0x6374('0xa')](chatQueue['getChatQueues']())['then'](realtime[_0x6374('0xf')]())[_0x6374('0xa')](smsQueue[_0x6374('0x10')]())[_0x6374('0xa')](realtime[_0x6374('0x11')]())['then'](mailQueue[_0x6374('0x12')]())[_0x6374('0xa')](realtime[_0x6374('0x13')]())[_0x6374('0xa')](faxQueue['getFaxQueues']())[_0x6374('0xa')](realtime[_0x6374('0x14')]())['then'](whatsappQueue[_0x6374('0x15')]())['then'](realtime[_0x6374('0x16')]())['then'](function(){return realtime;});}function main(){return server[_0x6374('0x17')](realtime)[_0x6374('0xa')](function(_0x4c93e9){return initRealtime();})[_0x6374('0xa')](function(_0x147f2d){return setInterval(initRealtime,0x1388);})[_0x6374('0x18')](function(_0x1c1789){console[_0x6374('0x19')](_0x1c1789);});}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 43bb80f..43bde66 100644 --- a/server/services/routing/lib/rule-engine.js +++ b/server/services/routing/lib/rule-engine.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1261=['isNil','register','ignoreFactChanges','activeRules','prototype','isArray','rules','concat','isObject','push','sync','filter','orderBy','asc','result','clone','name','nextTick','ruleRef','isEqual','restart','length','condition','noop','findRules','matches','turn','prioritize','priority','toString','consequence','fromJSON','isString','parse','map','object','exports','util','events','EventEmitter','init'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x1261,0x144));var _0x1126=function(_0x5303b9,_0x5c548){_0x5303b9=_0x5303b9-0x0;var _0x455125=_0x1261[_0x5303b9];return _0x455125;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var EventEmitter=require(_0x1126('0x1'))[_0x1126('0x2')];function RuleEngine(_0x331a2c,_0x39b786){this[_0x1126('0x3')]();if(!_[_0x1126('0x4')](_0x331a2c)){this[_0x1126('0x5')](_0x331a2c);}if(_0x39b786){this[_0x1126('0x6')]=_0x39b786[_0x1126('0x6')];}return this;}util['inherits'](RuleEngine,EventEmitter);RuleEngine['prototype'][_0x1126('0x3')]=function(_0x907180){this['rules']=[];this[_0x1126('0x7')]=[];};RuleEngine[_0x1126('0x8')][_0x1126('0x5')]=function(_0x3abb0b){if(Array[_0x1126('0x9')](_0x3abb0b)){this['rules']=this[_0x1126('0xa')][_0x1126('0xb')](_0x3abb0b);}else if(_0x3abb0b!==null&&_[_0x1126('0xc')](_0x3abb0b)){this['rules'][_0x1126('0xd')](_0x3abb0b);}this['sync']();};RuleEngine['prototype'][_0x1126('0xe')]=function(){this['activeRules']=this[_0x1126('0xa')][_0x1126('0xf')](function(_0xd26a32){if(_[_0x1126('0x4')](_0xd26a32['on'])){_0xd26a32['on']=!![];}if(_0xd26a32['on']===!![]){return _0xd26a32;}});this[_0x1126('0x7')]=_[_0x1126('0x10')](this[_0x1126('0x7')],['p'],[_0x1126('0x11')]);};RuleEngine[_0x1126('0x8')]['execute']=function(_0x5de9a7,_0x1af673){var _0x154e20=![];_0x5de9a7[_0x1126('0x12')]=!![];var _0x4be0c6=_[_0x1126('0x13')](_0x5de9a7);var _0x4794a7=_[_0x1126('0x13')](_0x5de9a7);var _0x42f379=this[_0x1126('0x7')];var _0x4e1c97=[];var _0x245cd7=this[_0x1126('0x6')];(function FnRuleLoop(_0x4a7b49){var _0x4d2b38={'rules':function(){return _0x42f379;},'rule':function(){return _0x42f379[_0x4a7b49];},'when':function(_0x22ae0b){if(_0x22ae0b){var _0x2b2487=_0x42f379[_0x4a7b49]['consequence'];_0x2b2487['ruleRef']=_0x42f379[_0x4a7b49]['id']||_0x42f379[_0x4a7b49][_0x1126('0x14')]||'index_'+_0x4a7b49;process[_0x1126('0x15')](function(){_0x4e1c97[_0x1126('0xd')](_0x2b2487[_0x1126('0x16')]);_0x2b2487['call'](_0x4be0c6,_0x4d2b38);});}else{process[_0x1126('0x15')](function(){_0x4d2b38['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x154e20=!![];return FnRuleLoop(0x0);},'next':function(_0x56efeb){if(!_0x245cd7&&!_[_0x1126('0x17')](_0x4794a7,_0x4be0c6)){_0x4794a7=_[_0x1126('0x13')](_0x4be0c6);process[_0x1126('0x15')](function(){_0x4d2b38[_0x1126('0x18')]();});}else{process['nextTick'](function(){if(_[_0x1126('0x4')](_0x56efeb)){return FnRuleLoop(_0x4a7b49+0x1);}else{return FnRuleLoop(_0x56efeb);}});}}};if(_0x4a7b49<_0x42f379[_0x1126('0x19')]&&_0x154e20===![]){var _0x48a08d=_0x42f379[_0x4a7b49][_0x1126('0x1a')];_0x48a08d['call'](_0x4be0c6,_0x4d2b38);}else{process['nextTick'](function(){_0x4be0c6['matchPath']=_0x4e1c97;return _0x1af673?_0x1af673(_0x4be0c6):_[_0x1126('0x1b')]();});}}(0x0));};RuleEngine[_0x1126('0x8')][_0x1126('0x1c')]=function(_0x34bcf1){if(_[_0x1126('0x4')](_0x34bcf1)){return this[_0x1126('0xa')];}else{var _0xea0971=_[_0x1126('0x1d')](_0x34bcf1);return _['filter'](this[_0x1126('0xa')],_0xea0971);}};RuleEngine[_0x1126('0x8')][_0x1126('0x1e')]=function(_0x5ddf63,_0x541bc9){var _0xeb7d89=_0x5ddf63==='on'||_0x5ddf63==='ON'?!![]:![];var _0x39bf0e=this['findRules'](_0x541bc9);for(var _0x2fb797=0x0,_0x23d2bc=_0x39bf0e['length'];_0x2fb797<_0x23d2bc;_0x2fb797+=0x1){_0x39bf0e[_0x2fb797]['on']=_0xeb7d89;}this[_0x1126('0xe')]();};RuleEngine['prototype'][_0x1126('0x1f')]=function(_0x4bd50b,_0x771bb8){_0x4bd50b=parseInt(_0x4bd50b,0xa);var _0x583ce6=this[_0x1126('0x1c')](_0x771bb8);for(var _0x5f2611=0x0,_0x5252e0=_0x583ce6['length'];_0x5f2611<_0x5252e0;_0x5f2611+=0x1){_0x583ce6[_0x5f2611][_0x1126('0x20')]=_0x4bd50b;}this[_0x1126('0xe')]();};RuleEngine[_0x1126('0x8')]['toJSON']=function(){var _0x2a3055=this[_0x1126('0xa')];if(_0x2a3055 instanceof Array){_0x2a3055=_0x2a3055['map'](function(_0x3dd50e){_0x3dd50e[_0x1126('0x1a')]=_0x3dd50e[_0x1126('0x1a')][_0x1126('0x21')]();_0x3dd50e['consequence']=_0x3dd50e['consequence'][_0x1126('0x21')]();return _0x3dd50e;});}else if(!_[_0x1126('0x4')](_0x2a3055)){_0x2a3055[_0x1126('0x1a')]=_0x2a3055[_0x1126('0x1a')]['toString']();_0x2a3055[_0x1126('0x22')]=_0x2a3055[_0x1126('0x22')][_0x1126('0x21')]();}return _0x2a3055;};RuleEngine[_0x1126('0x8')][_0x1126('0x23')]=function(_0x5df232){this[_0x1126('0x3')]();if(_[_0x1126('0x24')](_0x5df232)){_0x5df232=JSON[_0x1126('0x25')](_0x5df232);}if(_0x5df232 instanceof Array){_0x5df232=_0x5df232[_0x1126('0x26')](function(_0x5c019d){_0x5c019d['condition']=eval('('+_0x5c019d[_0x1126('0x1a')]+')');_0x5c019d[_0x1126('0x22')]=eval('('+_0x5c019d['consequence']+')');return _0x5c019d;});}else if(_0x5df232!==null&&typeof _0x5df232==_0x1126('0x27')){_0x5df232[_0x1126('0x1a')]=eval('('+_0x5df232[_0x1126('0x1a')]+')');_0x5df232['consequence']=eval('('+_0x5df232['consequence']+')');}this[_0x1126('0x5')](_0x5df232);};module[_0x1126('0x28')]=RuleEngine; \ No newline at end of file +var _0x814b=['init','parse','map','object','lodash','util','events','EventEmitter','isNil','register','ignoreFactChanges','inherits','prototype','rules','isArray','concat','isObject','push','sync','filter','activeRules','orderBy','asc','execute','result','clone','name','ruleRef','call','next','isEqual','nextTick','restart','length','condition','matchPath','noop','findRules','matches','turn','prioritize','priority','toJSON','toString','consequence','fromJSON'];(function(_0x1eb837,_0x24429f){var _0x4ed333=function(_0x5041ab){while(--_0x5041ab){_0x1eb837['push'](_0x1eb837['shift']());}};_0x4ed333(++_0x24429f);}(_0x814b,0x1a2));var _0xb814=function(_0x3158d2,_0x277d23){_0x3158d2=_0x3158d2-0x0;var _0x57c15a=_0x814b[_0x3158d2];return _0x57c15a;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var EventEmitter=require(_0xb814('0x2'))[_0xb814('0x3')];function RuleEngine(_0xfbb64b,_0x477725){this['init']();if(!_[_0xb814('0x4')](_0xfbb64b)){this[_0xb814('0x5')](_0xfbb64b);}if(_0x477725){this[_0xb814('0x6')]=_0x477725[_0xb814('0x6')];}return this;}util[_0xb814('0x7')](RuleEngine,EventEmitter);RuleEngine[_0xb814('0x8')]['init']=function(_0x3b0829){this[_0xb814('0x9')]=[];this['activeRules']=[];};RuleEngine[_0xb814('0x8')][_0xb814('0x5')]=function(_0x186d5a){if(Array[_0xb814('0xa')](_0x186d5a)){this[_0xb814('0x9')]=this[_0xb814('0x9')][_0xb814('0xb')](_0x186d5a);}else if(_0x186d5a!==null&&_[_0xb814('0xc')](_0x186d5a)){this[_0xb814('0x9')][_0xb814('0xd')](_0x186d5a);}this[_0xb814('0xe')]();};RuleEngine['prototype'][_0xb814('0xe')]=function(){this['activeRules']=this[_0xb814('0x9')][_0xb814('0xf')](function(_0x35b10d){if(_[_0xb814('0x4')](_0x35b10d['on'])){_0x35b10d['on']=!![];}if(_0x35b10d['on']===!![]){return _0x35b10d;}});this[_0xb814('0x10')]=_[_0xb814('0x11')](this[_0xb814('0x10')],['p'],[_0xb814('0x12')]);};RuleEngine[_0xb814('0x8')][_0xb814('0x13')]=function(_0x3f4881,_0x44fb96){var _0x17f5bd=![];_0x3f4881[_0xb814('0x14')]=!![];var _0x303aca=_[_0xb814('0x15')](_0x3f4881);var _0x45e0d0=_[_0xb814('0x15')](_0x3f4881);var _0x125ce2=this[_0xb814('0x10')];var _0x7a21ef=[];var _0x48c9df=this[_0xb814('0x6')];(function FnRuleLoop(_0x55ba16){var _0x270598={'rules':function(){return _0x125ce2;},'rule':function(){return _0x125ce2[_0x55ba16];},'when':function(_0xfac75b){if(_0xfac75b){var _0x4c3007=_0x125ce2[_0x55ba16]['consequence'];_0x4c3007['ruleRef']=_0x125ce2[_0x55ba16]['id']||_0x125ce2[_0x55ba16][_0xb814('0x16')]||'index_'+_0x55ba16;process['nextTick'](function(){_0x7a21ef[_0xb814('0xd')](_0x4c3007[_0xb814('0x17')]);_0x4c3007[_0xb814('0x18')](_0x303aca,_0x270598);});}else{process['nextTick'](function(){_0x270598[_0xb814('0x19')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x17f5bd=!![];return FnRuleLoop(0x0);},'next':function(_0x531032){if(!_0x48c9df&&!_[_0xb814('0x1a')](_0x45e0d0,_0x303aca)){_0x45e0d0=_[_0xb814('0x15')](_0x303aca);process[_0xb814('0x1b')](function(){_0x270598[_0xb814('0x1c')]();});}else{process[_0xb814('0x1b')](function(){if(_[_0xb814('0x4')](_0x531032)){return FnRuleLoop(_0x55ba16+0x1);}else{return FnRuleLoop(_0x531032);}});}}};if(_0x55ba16<_0x125ce2[_0xb814('0x1d')]&&_0x17f5bd===![]){var _0x594470=_0x125ce2[_0x55ba16][_0xb814('0x1e')];_0x594470['call'](_0x303aca,_0x270598);}else{process[_0xb814('0x1b')](function(){_0x303aca[_0xb814('0x1f')]=_0x7a21ef;return _0x44fb96?_0x44fb96(_0x303aca):_[_0xb814('0x20')]();});}}(0x0));};RuleEngine[_0xb814('0x8')][_0xb814('0x21')]=function(_0xb9e57d){if(_[_0xb814('0x4')](_0xb9e57d)){return this['rules'];}else{var _0x392222=_[_0xb814('0x22')](_0xb9e57d);return _[_0xb814('0xf')](this[_0xb814('0x9')],_0x392222);}};RuleEngine[_0xb814('0x8')][_0xb814('0x23')]=function(_0x3f0150,_0x1e4e89){var _0x5a6291=_0x3f0150==='on'||_0x3f0150==='ON'?!![]:![];var _0x271aa8=this[_0xb814('0x21')](_0x1e4e89);for(var _0x52ed64=0x0,_0x9008b2=_0x271aa8[_0xb814('0x1d')];_0x52ed64<_0x9008b2;_0x52ed64+=0x1){_0x271aa8[_0x52ed64]['on']=_0x5a6291;}this[_0xb814('0xe')]();};RuleEngine['prototype'][_0xb814('0x24')]=function(_0x2051d0,_0x58c3ca){_0x2051d0=parseInt(_0x2051d0,0xa);var _0x338a28=this['findRules'](_0x58c3ca);for(var _0x6efe9a=0x0,_0x5f3e9b=_0x338a28['length'];_0x6efe9a<_0x5f3e9b;_0x6efe9a+=0x1){_0x338a28[_0x6efe9a][_0xb814('0x25')]=_0x2051d0;}this['sync']();};RuleEngine[_0xb814('0x8')][_0xb814('0x26')]=function(){var _0x2b91bd=this['rules'];if(_0x2b91bd instanceof Array){_0x2b91bd=_0x2b91bd['map'](function(_0x26d3a9){_0x26d3a9[_0xb814('0x1e')]=_0x26d3a9['condition'][_0xb814('0x27')]();_0x26d3a9[_0xb814('0x28')]=_0x26d3a9[_0xb814('0x28')][_0xb814('0x27')]();return _0x26d3a9;});}else if(!_[_0xb814('0x4')](_0x2b91bd)){_0x2b91bd[_0xb814('0x1e')]=_0x2b91bd[_0xb814('0x1e')]['toString']();_0x2b91bd[_0xb814('0x28')]=_0x2b91bd[_0xb814('0x28')][_0xb814('0x27')]();}return _0x2b91bd;};RuleEngine[_0xb814('0x8')][_0xb814('0x29')]=function(_0x4ff31a){this[_0xb814('0x2a')]();if(_['isString'](_0x4ff31a)){_0x4ff31a=JSON[_0xb814('0x2b')](_0x4ff31a);}if(_0x4ff31a instanceof Array){_0x4ff31a=_0x4ff31a[_0xb814('0x2c')](function(_0xe0f509){_0xe0f509['condition']=eval('('+_0xe0f509[_0xb814('0x1e')]+')');_0xe0f509[_0xb814('0x28')]=eval('('+_0xe0f509['consequence']+')');return _0xe0f509;});}else if(_0x4ff31a!==null&&typeof _0x4ff31a==_0xb814('0x2d')){_0x4ff31a[_0xb814('0x1e')]=eval('('+_0x4ff31a[_0xb814('0x1e')]+')');_0x4ff31a[_0xb814('0x28')]=eval('('+_0x4ff31a[_0xb814('0x28')]+')');}this[_0xb814('0x5')](_0x4ff31a);};module['exports']=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 406c1b5..aeb29de 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 _0xde23=['result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','request','then','error'];(function(_0x3760f3,_0x45dabc){var _0x452bb3=function(_0x4db182){while(--_0x4db182){_0x3760f3['push'](_0x3760f3['shift']());}};_0x452bb3(++_0x45dabc);}(_0xde23,0x1d0));var _0x3de2=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xde23[_0xa464c9];return _0x3d73c4;};'use strict';var BPromise=require(_0x3de2('0x0'));var jayson=require(_0x3de2('0x1'));var client=jayson[_0x3de2('0x2')]['http']({'port':0x232b});function request(_0x285dc4,_0x58fd53){return new BPromise(function(_0x14e8a4,_0x4f2fe4){return client[_0x3de2('0x3')](_0x285dc4,_0x58fd53)[_0x3de2('0x4')](function(_0x4f3fdd){if(_0x4f3fdd[_0x3de2('0x5')]){return _0x4f2fe4(_0x4f3fdd[_0x3de2('0x5')]['message']);}else{return _0x14e8a4(_0x4f3fdd[_0x3de2('0x6')]);}})[_0x3de2('0x7')](function(_0xb5405e){return _0x4f2fe4(_0xb5405e);});});}exports[_0x3de2('0x8')]=function(_0x1856af,_0x26f34b){return request(_0x3de2('0x9'),{'account':_0x1856af,'message':_0x26f34b});}; \ No newline at end of file +var _0x4963=['SendMail','bluebird','client','http','request','then','error','message','result','catch','sendMailMessage'];(function(_0x874036,_0x466922){var _0x4888e4=function(_0x10b27f){while(--_0x10b27f){_0x874036['push'](_0x874036['shift']());}};_0x4888e4(++_0x466922);}(_0x4963,0xf3));var _0x3496=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4963[_0x20a584];return _0x4b41a8;};'use strict';var BPromise=require(_0x3496('0x0'));var jayson=require('jayson/promise');var client=jayson[_0x3496('0x1')][_0x3496('0x2')]({'port':0x232b});function request(_0xed3782,_0x3c00dc){return new BPromise(function(_0x2fa253,_0xc1e6ab){return client[_0x3496('0x3')](_0xed3782,_0x3c00dc)[_0x3496('0x4')](function(_0x2e2d67){if(_0x2e2d67[_0x3496('0x5')]){return _0xc1e6ab(_0x2e2d67[_0x3496('0x5')][_0x3496('0x6')]);}else{return _0x2fa253(_0x2e2d67[_0x3496('0x7')]);}})[_0x3496('0x8')](function(_0x350277){return _0xc1e6ab(_0x350277);});});}exports[_0x3496('0x9')]=function(_0x1efbd7,_0x138ba4){return request(_0x3496('0xa'),{'account':_0x1efbd7,'message':_0x138ba4});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 3daf01b..8f70a58 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 _0xe85c=['chatPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','whatsappStatus','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','updateRealtime','prototype','getChannelStatus','Capacity','working','mail','openchannel','sms','whatsapp','length','Status','toNumber','format','mailStatus','smsCurrentCapacity','whatsappStatusTime','stringify','emit','user:save','exports','lodash','moment','md5','ioredis','../../../config/environment','redis','defaults','localhost','name','online','voicePause'];(function(_0x49e454,_0x22328f){var _0x21d045=function(_0x36c9d0){while(--_0x36c9d0){_0x49e454['push'](_0x49e454['shift']());}};_0x21d045(++_0x22328f);}(_0xe85c,0x117));var _0xce85=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe85c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xce85('0x0'));var moment=require(_0xce85('0x1'));var md5=require(_0xce85('0x2'));var Redis=require(_0xce85('0x3'));var config=require(_0xce85('0x4'));config[_0xce85('0x5')]=_[_0xce85('0x6')](config['redis'],{'host':_0xce85('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xce85('0x5')]));function Agent(_0x3cfa0f){this['id']=_0x3cfa0f['id']||0x0;this[_0xce85('0x8')]=_0x3cfa0f[_0xce85('0x8')]||'';this[_0xce85('0x9')]=_0x3cfa0f['online']||!![];this[_0xce85('0xa')]=_0x3cfa0f[_0xce85('0xa')]||![];this[_0xce85('0xb')]=_0x3cfa0f[_0xce85('0xb')]||![];this['mailPause']=_0x3cfa0f['mailPause']||![];this[_0xce85('0xc')]=_0x3cfa0f[_0xce85('0xc')]||![];this[_0xce85('0xd')]=_0x3cfa0f['smsPause']||![];this[_0xce85('0xe')]=_0x3cfa0f[_0xce85('0xe')]||![];this[_0xce85('0xf')]=_0xce85('0x10');this[_0xce85('0x11')]=0x0;this[_0xce85('0x12')]=_0x3cfa0f[_0xce85('0x12')]||0x0;this[_0xce85('0x13')]=0x0;this['mailStatus']=_0xce85('0x10');this[_0xce85('0x14')]=0x0;this[_0xce85('0x15')]=_0x3cfa0f['mailCapacity']||0x0;this[_0xce85('0x16')]=0x0;this[_0xce85('0x17')]='unknown';this[_0xce85('0x18')]=0x0;this[_0xce85('0x19')]=_0x3cfa0f[_0xce85('0x19')]||0x0;this[_0xce85('0x1a')]=0x0;this[_0xce85('0x1b')]=_0xce85('0x10');this[_0xce85('0x1c')]=0x0;this[_0xce85('0x1d')]=_0x3cfa0f[_0xce85('0x1d')]||0x0;this['smsCurrentCapacity']=0x0;this[_0xce85('0x1e')]=_0xce85('0x10');this['whatsappStatusTime']=0x0;this[_0xce85('0x1f')]=_0x3cfa0f[_0xce85('0x1f')]||0x0;this[_0xce85('0x20')]=0x0;this[_0xce85('0x21')]='unknown';this['openchannelStatusTime']=0x0;this[_0xce85('0x22')]=_0x3cfa0f[_0xce85('0x22')]||0x0;this[_0xce85('0x23')]=0x0;this[_0xce85('0x24')]=![];this[_0xce85('0x25')]=undefined;this[_0xce85('0x2')]='';this[_0xce85('0x26')]();}Agent[_0xce85('0x27')][_0xce85('0x28')]=function(_0x516282){if(this[_0x516282+'CurrentCapacity']>0x0){if(this[_0x516282+_0xce85('0x29')]>0x0&&this[_0x516282+'CurrentCapacity']>=this[_0x516282+_0xce85('0x29')]){return'maxcapacity';}else{return _0xce85('0x2a');}}else{return'idle';}};Agent[_0xce85('0x27')][_0xce85('0x26')]=function(){var _0x3be69a=[_0xce85('0x2b'),'chat',_0xce85('0x2c'),'fax',_0xce85('0x2d'),_0xce85('0x2e')];for(var _0x530147=0x0;_0x530147<_0x3be69a[_0xce85('0x2f')];_0x530147+=0x1){var _0x1e305c=this[_0xce85('0x28')](_0x3be69a[_0x530147]);if(this[_0x3be69a[_0x530147]+_0xce85('0x30')]!==_0x1e305c){this[_0x3be69a[_0x530147]+'StatusTime']=_[_0xce85('0x31')](moment()[_0xce85('0x32')]('x'));}this[_0x3be69a[_0x530147]+'Status']=_0x1e305c;}var _0x4102d2={'id':this['id'],'name':this['name'],'online':this['online'],'voicePause':this[_0xce85('0xa')],'chatPause':this['chatPause'],'mailPause':this['mailPause'],'smsPause':this['smsPause'],'faxPause':this['faxPause'],'openchannelPause':this[_0xce85('0xe')],'chatStatus':this[_0xce85('0xf')],'chatStatusTime':this[_0xce85('0x11')],'chatCapacity':this[_0xce85('0x12')],'chatCurrentCapacity':this[_0xce85('0x13')],'mailStatus':this[_0xce85('0x33')],'mailStatusTime':this[_0xce85('0x14')],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this[_0xce85('0x16')],'faxStatus':this[_0xce85('0x17')],'faxStatusTime':this[_0xce85('0x18')],'faxCapacity':this[_0xce85('0x19')],'faxCurrentCapacity':this[_0xce85('0x1a')],'smsStatus':this[_0xce85('0x1b')],'smsStatusTime':this[_0xce85('0x1c')],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0xce85('0x34')],'whatsappStatus':this[_0xce85('0x1e')],'whatsappStatusTime':this[_0xce85('0x35')],'whatsappCapacity':this[_0xce85('0x1f')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this[_0xce85('0x21')],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this[_0xce85('0x22')],'openchannelCurrentCapacity':this[_0xce85('0x23')],'busy':this[_0xce85('0x24')],'busyQueue':this[_0xce85('0x25')]};var _0x3d4889=md5(JSON[_0xce85('0x36')](_0x4102d2));if(this[_0xce85('0x2')]!==_0x3d4889){this['md5']=_0x3d4889;io[_0xce85('0x37')](_0xce85('0x38'),_0x4102d2);}};module[_0xce85('0x39')]=Agent; \ No newline at end of file +var _0x0b83=['md5','user:save','exports','lodash','moment','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','mailPause','faxPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatusTime','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','idle','mail','chat','fax','sms','whatsapp','length','Status','toNumber','format','chatPause','smsPause','faxCapacity','faxCurrentCapacity','smsStatus','stringify'];(function(_0xc1a7d3,_0x6ac180){var _0x576e8d=function(_0x46d9cb){while(--_0x46d9cb){_0xc1a7d3['push'](_0xc1a7d3['shift']());}};_0x576e8d(++_0x6ac180);}(_0x0b83,0x7f));var _0x30b8=function(_0x33a896,_0x49c910){_0x33a896=_0x33a896-0x0;var _0x266e3f=_0x0b83[_0x33a896];return _0x266e3f;};'use strict';var _=require(_0x30b8('0x0'));var moment=require(_0x30b8('0x1'));var md5=require('md5');var Redis=require(_0x30b8('0x2'));var config=require(_0x30b8('0x3'));config[_0x30b8('0x4')]=_[_0x30b8('0x5')](config[_0x30b8('0x4')],{'host':_0x30b8('0x6'),'port':0x18eb});var io=require(_0x30b8('0x7'))(new Redis(config['redis']));function Agent(_0x536e79){this['id']=_0x536e79['id']||0x0;this[_0x30b8('0x8')]=_0x536e79[_0x30b8('0x8')]||'';this[_0x30b8('0x9')]=_0x536e79['online']||!![];this[_0x30b8('0xa')]=_0x536e79[_0x30b8('0xa')]||![];this['chatPause']=_0x536e79['chatPause']||![];this[_0x30b8('0xb')]=_0x536e79[_0x30b8('0xb')]||![];this[_0x30b8('0xc')]=_0x536e79['faxPause']||![];this['smsPause']=_0x536e79['smsPause']||![];this[_0x30b8('0xd')]=_0x536e79[_0x30b8('0xd')]||![];this[_0x30b8('0xe')]=_0x30b8('0xf');this[_0x30b8('0x10')]=0x0;this[_0x30b8('0x11')]=_0x536e79[_0x30b8('0x11')]||0x0;this[_0x30b8('0x12')]=0x0;this[_0x30b8('0x13')]='unknown';this[_0x30b8('0x14')]=0x0;this[_0x30b8('0x15')]=_0x536e79[_0x30b8('0x15')]||0x0;this[_0x30b8('0x16')]=0x0;this['faxStatus']=_0x30b8('0xf');this[_0x30b8('0x17')]=0x0;this['faxCapacity']=_0x536e79['faxCapacity']||0x0;this['faxCurrentCapacity']=0x0;this['smsStatus']=_0x30b8('0xf');this[_0x30b8('0x18')]=0x0;this[_0x30b8('0x19')]=_0x536e79[_0x30b8('0x19')]||0x0;this[_0x30b8('0x1a')]=0x0;this[_0x30b8('0x1b')]='unknown';this[_0x30b8('0x1c')]=0x0;this['whatsappCapacity']=_0x536e79[_0x30b8('0x1d')]||0x0;this[_0x30b8('0x1e')]=0x0;this[_0x30b8('0x1f')]='unknown';this[_0x30b8('0x20')]=0x0;this[_0x30b8('0x21')]=_0x536e79[_0x30b8('0x21')]||0x0;this[_0x30b8('0x22')]=0x0;this[_0x30b8('0x23')]=![];this[_0x30b8('0x24')]=undefined;this['md5']='';this[_0x30b8('0x25')]();}Agent[_0x30b8('0x26')][_0x30b8('0x27')]=function(_0x5ba874){if(this[_0x5ba874+_0x30b8('0x28')]>0x0){if(this[_0x5ba874+_0x30b8('0x29')]>0x0&&this[_0x5ba874+'CurrentCapacity']>=this[_0x5ba874+'Capacity']){return _0x30b8('0x2a');}else{return'working';}}else{return _0x30b8('0x2b');}};Agent[_0x30b8('0x26')][_0x30b8('0x25')]=function(){var _0x38ff94=[_0x30b8('0x2c'),_0x30b8('0x2d'),'openchannel',_0x30b8('0x2e'),_0x30b8('0x2f'),_0x30b8('0x30')];for(var _0x4c94fd=0x0;_0x4c94fd<_0x38ff94[_0x30b8('0x31')];_0x4c94fd+=0x1){var _0x2d5a0d=this[_0x30b8('0x27')](_0x38ff94[_0x4c94fd]);if(this[_0x38ff94[_0x4c94fd]+_0x30b8('0x32')]!==_0x2d5a0d){this[_0x38ff94[_0x4c94fd]+'StatusTime']=_[_0x30b8('0x33')](moment()[_0x30b8('0x34')]('x'));}this[_0x38ff94[_0x4c94fd]+_0x30b8('0x32')]=_0x2d5a0d;}var _0x49509a={'id':this['id'],'name':this[_0x30b8('0x8')],'online':this[_0x30b8('0x9')],'voicePause':this[_0x30b8('0xa')],'chatPause':this[_0x30b8('0x35')],'mailPause':this['mailPause'],'smsPause':this[_0x30b8('0x36')],'faxPause':this[_0x30b8('0xc')],'openchannelPause':this[_0x30b8('0xd')],'chatStatus':this['chatStatus'],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this[_0x30b8('0x11')],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this[_0x30b8('0x13')],'mailStatusTime':this[_0x30b8('0x14')],'mailCapacity':this[_0x30b8('0x15')],'mailCurrentCapacity':this[_0x30b8('0x16')],'faxStatus':this['faxStatus'],'faxStatusTime':this[_0x30b8('0x17')],'faxCapacity':this[_0x30b8('0x37')],'faxCurrentCapacity':this[_0x30b8('0x38')],'smsStatus':this[_0x30b8('0x39')],'smsStatusTime':this[_0x30b8('0x18')],'smsCapacity':this[_0x30b8('0x19')],'smsCurrentCapacity':this[_0x30b8('0x1a')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0x30b8('0x1c')],'whatsappCapacity':this[_0x30b8('0x1d')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this[_0x30b8('0x1f')],'openchannelStatusTime':this[_0x30b8('0x20')],'openchannelCapacity':this[_0x30b8('0x21')],'openchannelCurrentCapacity':this[_0x30b8('0x22')],'busy':this[_0x30b8('0x23')],'busyQueue':this[_0x30b8('0x24')]};var _0x2dddf2=md5(JSON[_0x30b8('0x3a')](_0x49509a));if(this['md5']!==_0x2dddf2){this[_0x30b8('0x3b')]=_0x2dddf2;io['emit'](_0x30b8('0x3c'),_0x49509a);}};module[_0x30b8('0x3d')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index b1d56bf..3cb4273 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 _0x4c5a=['name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map','loggedIn','length','online','paused','available','stringify','md5','chat:queue:%s','emit','chat_queue:save','exports','lodash','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0x4c5a,0x12e));var _0xa4c5=function(_0x2613f2,_0x5a0765){_0x2613f2=_0x2613f2-0x0;var _0x5f3c70=_0x4c5a[_0x2613f2];return _0x5f3c70;};'use strict';var _=require(_0xa4c5('0x0'));var md5=require('md5');var util=require(_0xa4c5('0x1'));var Redis=require(_0xa4c5('0x2'));var config=require(_0xa4c5('0x3'));config[_0xa4c5('0x4')]=_[_0xa4c5('0x5')](config[_0xa4c5('0x4')],{'host':_0xa4c5('0x6'),'port':0x18eb});var io=require(_0xa4c5('0x7'))(new Redis(config[_0xa4c5('0x4')]));function ChatQueue(_0x1ddefc){this['id']=_0x1ddefc['id']||0x0;this['name']=_0x1ddefc[_0xa4c5('0x8')]||'';this[_0xa4c5('0x9')]=_0x1ddefc['timeout']||0xa;this[_0xa4c5('0xa')]=_0x1ddefc['strategy']||_0xa4c5('0xb');this[_0xa4c5('0xc')]=_0x1ddefc[_0xa4c5('0xc')];this['mapAgentsId']={};this[_0xa4c5('0xd')]=0x0;this['md5']='';this[_0xa4c5('0xe')]();this[_0xa4c5('0xf')]();}ChatQueue[_0xa4c5('0x10')]['updateRouting']=function(){var _0x5e13fa=this[_0xa4c5('0x11')][_0xa4c5('0x12')];this['mapAgentsId']=_[_0xa4c5('0x13')](this[_0xa4c5('0xc')],'id');this[_0xa4c5('0x11')][_0xa4c5('0x12')]=_0x5e13fa;};ChatQueue[_0xa4c5('0x10')][_0xa4c5('0xf')]=function(){this[_0xa4c5('0x14')]=0x0;this['paused']=0x0;for(var _0x54ac40=0x0;_0x54ac40=0x0?this[_0xa4c5('0x18')]:0x0;var _0x2370c2={'id':this['id'],'available':this[_0xa4c5('0x18')],'loggedIn':this[_0xa4c5('0x14')],'name':this[_0xa4c5('0x8')],'paused':this[_0xa4c5('0x17')],'waiting':this['waiting']};var _0xa5a84a=md5(JSON[_0xa4c5('0x19')](_0x2370c2));if(this[_0xa4c5('0x1a')]!==_0xa5a84a){this['md5']=_0xa5a84a;io['to'](util['format'](_0xa4c5('0x1b'),_0x2370c2[_0xa4c5('0x8')]))[_0xa4c5('0x1c')](_0xa4c5('0x1d'),_0x2370c2);}};module[_0xa4c5('0x1e')]=ChatQueue; \ No newline at end of file +var _0xeda5=['waiting','updateRouting','updateRealtime','_rr','map','prototype','loggedIn','paused','length','online','chatPause','available','format','chat:queue:%s','emit','exports','md5','util','../../../config/environment','defaults','localhost','socket.io-emitter','redis','name','timeout','strategy','Agents','mapAgentsId'];(function(_0x462999,_0x24d200){var _0x4b1366=function(_0x1fa353){while(--_0x1fa353){_0x462999['push'](_0x462999['shift']());}};_0x4b1366(++_0x24d200);}(_0xeda5,0x128));var _0x5eda=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xeda5[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var md5=require(_0x5eda('0x0'));var util=require(_0x5eda('0x1'));var Redis=require('ioredis');var config=require(_0x5eda('0x2'));config['redis']=_[_0x5eda('0x3')](config['redis'],{'host':_0x5eda('0x4'),'port':0x18eb});var io=require(_0x5eda('0x5'))(new Redis(config[_0x5eda('0x6')]));function ChatQueue(_0x10eef2){this['id']=_0x10eef2['id']||0x0;this[_0x5eda('0x7')]=_0x10eef2[_0x5eda('0x7')]||'';this[_0x5eda('0x8')]=_0x10eef2[_0x5eda('0x8')]||0xa;this[_0x5eda('0x9')]=_0x10eef2['strategy']||'beepall';this[_0x5eda('0xa')]=_0x10eef2[_0x5eda('0xa')];this[_0x5eda('0xb')]={};this[_0x5eda('0xc')]=0x0;this['md5']='';this[_0x5eda('0xd')]();this[_0x5eda('0xe')]();}ChatQueue['prototype'][_0x5eda('0xd')]=function(){var _0x39001b=this['mapAgentsId'][_0x5eda('0xf')];this[_0x5eda('0xb')]=_[_0x5eda('0x10')](this[_0x5eda('0xa')],'id');this[_0x5eda('0xb')][_0x5eda('0xf')]=_0x39001b;};ChatQueue[_0x5eda('0x11')][_0x5eda('0xe')]=function(){this[_0x5eda('0x12')]=0x0;this[_0x5eda('0x13')]=0x0;for(var _0x250f99=0x0;_0x250f99=0x0?this[_0x5eda('0x17')]:0x0;var _0x56e07a={'id':this['id'],'available':this['available'],'loggedIn':this[_0x5eda('0x12')],'name':this[_0x5eda('0x7')],'paused':this[_0x5eda('0x13')],'waiting':this[_0x5eda('0xc')]};var _0x528ff5=md5(JSON['stringify'](_0x56e07a));if(this[_0x5eda('0x0')]!==_0x528ff5){this['md5']=_0x528ff5;io['to'](util[_0x5eda('0x18')](_0x5eda('0x19'),_0x56e07a[_0x5eda('0x7')]))[_0x5eda('0x1a')]('chat_queue:save',_0x56e07a);}};module[_0x5eda('0x1b')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index c11070d..eb99754 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 _0x6250=['loggedIn','faxPause','available','waiting','stringify','fax:queue:%s','emit','fax_queue:save','exports','lodash','md5','ioredis','../../../config/environment','defaults','redis','socket.io-emitter','name','timeout','strategy','beepall','Agents','updateRealtime','prototype','updateRouting','mapAgentsId','_rr','map','paused','online'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6250,0xd4));var _0x0625=function(_0x18cd4b,_0x116787){_0x18cd4b=_0x18cd4b-0x0;var _0x1aed65=_0x6250[_0x18cd4b];return _0x1aed65;};'use strict';var _=require(_0x0625('0x0'));var md5=require(_0x0625('0x1'));var util=require('util');var Redis=require(_0x0625('0x2'));var config=require(_0x0625('0x3'));config['redis']=_[_0x0625('0x4')](config[_0x0625('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x0625('0x6'))(new Redis(config['redis']));function FaxQueue(_0x1bd327){this['id']=_0x1bd327['id']||0x0;this[_0x0625('0x7')]=_0x1bd327[_0x0625('0x7')]||'';this[_0x0625('0x8')]=_0x1bd327['timeout']||0xa;this[_0x0625('0x9')]=_0x1bd327['strategy']||_0x0625('0xa');this['Agents']=_0x1bd327[_0x0625('0xb')];this['mapAgentsId']={};this['waiting']=0x0;this[_0x0625('0x1')]='';this['updateRouting']();this[_0x0625('0xc')]();}FaxQueue[_0x0625('0xd')][_0x0625('0xe')]=function(){var _0x19aab1=this[_0x0625('0xf')][_0x0625('0x10')];this[_0x0625('0xf')]=_[_0x0625('0x11')](this[_0x0625('0xb')],'id');this[_0x0625('0xf')][_0x0625('0x10')]=_0x19aab1;};FaxQueue[_0x0625('0xd')][_0x0625('0xc')]=function(){this['loggedIn']=0x0;this[_0x0625('0x12')]=0x0;for(var _0x26cc37=0x0;_0x26cc37=0x0?this[_0x0625('0x16')]:0x0;var _0x5b9c86={'id':this['id'],'available':this[_0x0625('0x16')],'loggedIn':this[_0x0625('0x14')],'name':this[_0x0625('0x7')],'paused':this[_0x0625('0x12')],'waiting':this[_0x0625('0x17')]};var _0x1559b7=md5(JSON[_0x0625('0x18')](_0x5b9c86));if(this['md5']!==_0x1559b7){this[_0x0625('0x1')]=_0x1559b7;io['to'](util['format'](_0x0625('0x19'),_0x5b9c86[_0x0625('0x7')]))[_0x0625('0x1a')](_0x0625('0x1b'),_0x5b9c86);}};module[_0x0625('0x1c')]=FaxQueue; \ No newline at end of file +var _0xfd92=['Agents','paused','online','loggedIn','available','stringify','format','fax:queue:%s','emit','fax_queue:save','exports','lodash','md5','util','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map'];(function(_0xa71039,_0x5bcedb){var _0x265f66=function(_0x1b70fe){while(--_0x1b70fe){_0xa71039['push'](_0xa71039['shift']());}};_0x265f66(++_0x5bcedb);}(_0xfd92,0x1cd));var _0x2fd9=function(_0x148250,_0x2b8bcb){_0x148250=_0x148250-0x0;var _0x5c8521=_0xfd92[_0x148250];return _0x5c8521;};'use strict';var _=require(_0x2fd9('0x0'));var md5=require(_0x2fd9('0x1'));var util=require(_0x2fd9('0x2'));var Redis=require('ioredis');var config=require(_0x2fd9('0x3'));config['redis']=_[_0x2fd9('0x4')](config[_0x2fd9('0x5')],{'host':_0x2fd9('0x6'),'port':0x18eb});var io=require(_0x2fd9('0x7'))(new Redis(config[_0x2fd9('0x5')]));function FaxQueue(_0x346c80){this['id']=_0x346c80['id']||0x0;this[_0x2fd9('0x8')]=_0x346c80[_0x2fd9('0x8')]||'';this[_0x2fd9('0x9')]=_0x346c80[_0x2fd9('0x9')]||0xa;this[_0x2fd9('0xa')]=_0x346c80['strategy']||_0x2fd9('0xb');this['Agents']=_0x346c80['Agents'];this['mapAgentsId']={};this[_0x2fd9('0xc')]=0x0;this[_0x2fd9('0x1')]='';this[_0x2fd9('0xd')]();this[_0x2fd9('0xe')]();}FaxQueue[_0x2fd9('0xf')][_0x2fd9('0xd')]=function(){var _0x1fc37a=this[_0x2fd9('0x10')][_0x2fd9('0x11')];this[_0x2fd9('0x10')]=_[_0x2fd9('0x12')](this[_0x2fd9('0x13')],'id');this[_0x2fd9('0x10')]['_rr']=_0x1fc37a;};FaxQueue[_0x2fd9('0xf')][_0x2fd9('0xe')]=function(){this['loggedIn']=0x0;this[_0x2fd9('0x14')]=0x0;for(var _0x29b655=0x0;_0x29b655=0x0?this['available']:0x0;var _0x429c0e={'id':this['id'],'available':this[_0x2fd9('0x17')],'loggedIn':this[_0x2fd9('0x16')],'name':this[_0x2fd9('0x8')],'paused':this[_0x2fd9('0x14')],'waiting':this[_0x2fd9('0xc')]};var _0x35f928=md5(JSON[_0x2fd9('0x18')](_0x429c0e));if(this[_0x2fd9('0x1')]!==_0x35f928){this[_0x2fd9('0x1')]=_0x35f928;io['to'](util[_0x2fd9('0x19')](_0x2fd9('0x1a'),_0x429c0e[_0x2fd9('0x8')]))[_0x2fd9('0x1b')](_0x2fd9('0x1c'),_0x429c0e);}};module[_0x2fd9('0x1d')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 8dac7cb..c286e93 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 _0x7c6b=['Intervals','exports','name'];(function(_0x2e70e9,_0xa62fbc){var _0x2686ad=function(_0x3e7e06){while(--_0x3e7e06){_0x2e70e9['push'](_0x2e70e9['shift']());}};_0x2686ad(++_0xa62fbc);}(_0x7c6b,0x1a3));var _0xb7c6=function(_0xb57634,_0x3e5698){_0xb57634=_0xb57634-0x0;var _0x1988ef=_0x7c6b[_0xb57634];return _0x1988ef;};'use strict';function Interval(_0x1f30b9){this['id']=_0x1f30b9['id']||0x0;this[_0xb7c6('0x0')]=_0x1f30b9[_0xb7c6('0x0')]||'';this['Intervals']=_0x1f30b9[_0xb7c6('0x1')]||{};}module[_0xb7c6('0x2')]=Interval; \ No newline at end of file +var _0x5b2e=['exports'];(function(_0x44bcfe,_0x7c13fa){var _0x16aeff=function(_0x3c8d65){while(--_0x3c8d65){_0x44bcfe['push'](_0x44bcfe['shift']());}};_0x16aeff(++_0x7c13fa);}(_0x5b2e,0x9b));var _0xe5b2=function(_0xaaf3cf,_0x2faf15){_0xaaf3cf=_0xaaf3cf-0x0;var _0x1ba636=_0x5b2e[_0xaaf3cf];return _0x1ba636;};'use strict';function Interval(_0x5edf4d){this['id']=_0x5edf4d['id']||0x0;this['name']=_0x5edf4d['name']||'';this['Intervals']=_0x5edf4d['Intervals']||{};}module[_0xe5b2('0x0')]=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index c942f05..56c481d 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 _0xf2cb=['updateRealtime','prototype','_rr','map','loggedIn','paused','online','mailPause','available','stringify','format','mail_queue:save','md5','util','../../../config/environment','defaults','redis','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting'];(function(_0x5c742e,_0x4fb205){var _0x21854f=function(_0x553f9f){while(--_0x553f9f){_0x5c742e['push'](_0x5c742e['shift']());}};_0x21854f(++_0x4fb205);}(_0xf2cb,0x144));var _0xbf2c=function(_0x54b668,_0x391793){_0x54b668=_0x54b668-0x0;var _0xc10e55=_0xf2cb[_0x54b668];return _0xc10e55;};'use strict';var _=require('lodash');var md5=require(_0xbf2c('0x0'));var util=require(_0xbf2c('0x1'));var Redis=require('ioredis');var config=require(_0xbf2c('0x2'));config['redis']=_[_0xbf2c('0x3')](config[_0xbf2c('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0xbf2c('0x5'))(new Redis(config[_0xbf2c('0x4')]));function MailQueue(_0x3216e7){this['id']=_0x3216e7['id']||0x0;this[_0xbf2c('0x6')]=_0x3216e7[_0xbf2c('0x6')]||'';this['timeout']=_0x3216e7[_0xbf2c('0x7')]||0xa;this[_0xbf2c('0x8')]=_0x3216e7[_0xbf2c('0x8')]||_0xbf2c('0x9');this[_0xbf2c('0xa')]=_0x3216e7[_0xbf2c('0xa')];this[_0xbf2c('0xb')]={};this[_0xbf2c('0xc')]=0x0;this[_0xbf2c('0x0')]='';this[_0xbf2c('0xd')]();this[_0xbf2c('0xe')]();}MailQueue[_0xbf2c('0xf')][_0xbf2c('0xd')]=function(){var _0x5cc27c=this[_0xbf2c('0xb')][_0xbf2c('0x10')];this['mapAgentsId']=_[_0xbf2c('0x11')](this[_0xbf2c('0xa')],'id');this['mapAgentsId'][_0xbf2c('0x10')]=_0x5cc27c;};MailQueue[_0xbf2c('0xf')]['updateRealtime']=function(){this[_0xbf2c('0x12')]=0x0;this[_0xbf2c('0x13')]=0x0;for(var _0xfccb3c=0x0;_0xfccb3c=0x0?this[_0xbf2c('0x16')]:0x0;var _0x4175f9={'id':this['id'],'available':this['available'],'loggedIn':this[_0xbf2c('0x12')],'name':this['name'],'paused':this[_0xbf2c('0x13')],'waiting':this[_0xbf2c('0xc')]};var _0x54b14b=md5(JSON[_0xbf2c('0x17')](_0x4175f9));if(this[_0xbf2c('0x0')]!==_0x54b14b){this['md5']=_0x54b14b;io['to'](util[_0xbf2c('0x18')]('mail:queue:%s',_0x4175f9[_0xbf2c('0x6')]))['emit'](_0xbf2c('0x19'),_0x4175f9);}};module['exports']=MailQueue; \ No newline at end of file +var _0xcb48=['paused','online','mailPause','available','stringify','format','mail:queue:%s','emit','mail_queue:save','exports','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn'];(function(_0x38c652,_0x1ea1b7){var _0x218a37=function(_0x5dcb2a){while(--_0x5dcb2a){_0x38c652['push'](_0x38c652['shift']());}};_0x218a37(++_0x1ea1b7);}(_0xcb48,0xb8));var _0x8cb4=function(_0xb77154,_0x1aab7e){_0xb77154=_0xb77154-0x0;var _0x1614d7=_0xcb48[_0xb77154];return _0x1614d7;};'use strict';var _=require('lodash');var md5=require(_0x8cb4('0x0'));var util=require('util');var Redis=require(_0x8cb4('0x1'));var config=require(_0x8cb4('0x2'));config[_0x8cb4('0x3')]=_[_0x8cb4('0x4')](config[_0x8cb4('0x3')],{'host':_0x8cb4('0x5'),'port':0x18eb});var io=require(_0x8cb4('0x6'))(new Redis(config['redis']));function MailQueue(_0x4771e7){this['id']=_0x4771e7['id']||0x0;this[_0x8cb4('0x7')]=_0x4771e7['name']||'';this[_0x8cb4('0x8')]=_0x4771e7['timeout']||0xa;this[_0x8cb4('0x9')]=_0x4771e7[_0x8cb4('0x9')]||'beepall';this[_0x8cb4('0xa')]=_0x4771e7[_0x8cb4('0xa')];this[_0x8cb4('0xb')]={};this[_0x8cb4('0xc')]=0x0;this['md5']='';this[_0x8cb4('0xd')]();this[_0x8cb4('0xe')]();}MailQueue[_0x8cb4('0xf')]['updateRouting']=function(){var _0x3cef15=this['mapAgentsId'][_0x8cb4('0x10')];this[_0x8cb4('0xb')]=_[_0x8cb4('0x11')](this[_0x8cb4('0xa')],'id');this['mapAgentsId'][_0x8cb4('0x10')]=_0x3cef15;};MailQueue[_0x8cb4('0xf')][_0x8cb4('0xe')]=function(){this[_0x8cb4('0x12')]=0x0;this[_0x8cb4('0x13')]=0x0;for(var _0x139f28=0x0;_0x139f28=0x0?this[_0x8cb4('0x16')]:0x0;var _0x3a265c={'id':this['id'],'available':this[_0x8cb4('0x16')],'loggedIn':this[_0x8cb4('0x12')],'name':this[_0x8cb4('0x7')],'paused':this[_0x8cb4('0x13')],'waiting':this[_0x8cb4('0xc')]};var _0x983f56=md5(JSON[_0x8cb4('0x17')](_0x3a265c));if(this[_0x8cb4('0x0')]!==_0x983f56){this[_0x8cb4('0x0')]=_0x983f56;io['to'](util[_0x8cb4('0x18')](_0x8cb4('0x19'),_0x3a265c['name']))[_0x8cb4('0x1a')](_0x8cb4('0x1b'),_0x3a265c);}};module[_0x8cb4('0x1c')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index ea398a2..f29d9f2 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(_0x2bfab4,_0xd57d15){var _0x45fc98=function(_0x420890){while(--_0x420890){_0x2bfab4['push'](_0x2bfab4['shift']());}};_0x45fc98(++_0xd57d15);}(_0x814b,0x1a2));var _0xb814=function(_0x221637,_0x42a5e0){_0x221637=_0x221637-0x0;var _0x11bf9e=_0x814b[_0x221637];return _0x11bf9e;};'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 _0x326f=['exports','lodash','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','mapAgentsId','waiting','md5','updateRouting','updateRealtime','Agents','prototype','loggedIn','paused','online','openchannelPause','available','stringify','openchannel:queue:%s','openchannel_queue:save'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x326f,0xd1));var _0xf326=function(_0x3bd11e,_0x460853){_0x3bd11e=_0x3bd11e-0x0;var _0x300082=_0x326f[_0x3bd11e];return _0x300082;};'use strict';var _=require(_0xf326('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0xf326('0x1'));var config=require(_0xf326('0x2'));config[_0xf326('0x3')]=_[_0xf326('0x4')](config[_0xf326('0x3')],{'host':_0xf326('0x5'),'port':0x18eb});var io=require(_0xf326('0x6'))(new Redis(config[_0xf326('0x3')]));function OpenchannelQueue(_0x1b5a56){this['id']=_0x1b5a56['id']||0x0;this[_0xf326('0x7')]=_0x1b5a56['name']||'';this[_0xf326('0x8')]=_0x1b5a56[_0xf326('0x8')]||0xa;this[_0xf326('0x9')]=_0x1b5a56[_0xf326('0x9')]||'beepall';this['Agents']=_0x1b5a56['Agents'];this[_0xf326('0xa')]={};this[_0xf326('0xb')]=0x0;this[_0xf326('0xc')]='';this[_0xf326('0xd')]();this[_0xf326('0xe')]();}OpenchannelQueue['prototype'][_0xf326('0xd')]=function(){var _0x53cbcd=this[_0xf326('0xa')]['_rr'];this[_0xf326('0xa')]=_['map'](this[_0xf326('0xf')],'id');this[_0xf326('0xa')]['_rr']=_0x53cbcd;};OpenchannelQueue[_0xf326('0x10')][_0xf326('0xe')]=function(){this[_0xf326('0x11')]=0x0;this[_0xf326('0x12')]=0x0;for(var _0x5c8483=0x0;_0x5c8483=0x0?this[_0xf326('0x15')]:0x0;var _0x18bee3={'id':this['id'],'available':this[_0xf326('0x15')],'loggedIn':this[_0xf326('0x11')],'name':this[_0xf326('0x7')],'paused':this['paused'],'waiting':this['waiting']};var _0x56ad41=md5(JSON[_0xf326('0x16')](_0x18bee3));if(this[_0xf326('0xc')]!==_0x56ad41){this['md5']=_0x56ad41;io['to'](util['format'](_0xf326('0x17'),_0x18bee3['name']))['emit'](_0xf326('0x18'),_0x18bee3);}};module[_0xf326('0x19')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index bf35996..627e5ce 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 _0x1306=['beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','smsPause','available','format','sms:queue:%s','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy'];(function(_0xbf8ebe,_0x3b69a5){var _0x1e25e8=function(_0x40c390){while(--_0x40c390){_0xbf8ebe['push'](_0xbf8ebe['shift']());}};_0x1e25e8(++_0x3b69a5);}(_0x1306,0x17a));var _0x6130=function(_0x302752,_0x39e730){_0x302752=_0x302752-0x0;var _0x781aa6=_0x1306[_0x302752];return _0x781aa6;};'use strict';var _=require(_0x6130('0x0'));var md5=require(_0x6130('0x1'));var util=require(_0x6130('0x2'));var Redis=require(_0x6130('0x3'));var config=require(_0x6130('0x4'));config[_0x6130('0x5')]=_[_0x6130('0x6')](config[_0x6130('0x5')],{'host':_0x6130('0x7'),'port':0x18eb});var io=require(_0x6130('0x8'))(new Redis(config[_0x6130('0x5')]));function SmsQueue(_0x181070){this['id']=_0x181070['id']||0x0;this[_0x6130('0x9')]=_0x181070[_0x6130('0x9')]||'';this[_0x6130('0xa')]=_0x181070[_0x6130('0xa')]||0xa;this[_0x6130('0xb')]=_0x181070[_0x6130('0xb')]||_0x6130('0xc');this[_0x6130('0xd')]=_0x181070[_0x6130('0xd')];this[_0x6130('0xe')]={};this[_0x6130('0xf')]=0x0;this[_0x6130('0x1')]='';this[_0x6130('0x10')]();this[_0x6130('0x11')]();}SmsQueue[_0x6130('0x12')][_0x6130('0x10')]=function(){var _0xac0bf1=this['mapAgentsId'][_0x6130('0x13')];this['mapAgentsId']=_[_0x6130('0x14')](this[_0x6130('0xd')],'id');this['mapAgentsId'][_0x6130('0x13')]=_0xac0bf1;};SmsQueue[_0x6130('0x12')][_0x6130('0x11')]=function(){this[_0x6130('0x15')]=0x0;this[_0x6130('0x16')]=0x0;for(var _0x3470e8=0x0;_0x3470e8=0x0?this['available']:0x0;var _0x1cd785={'id':this['id'],'available':this[_0x6130('0x1a')],'loggedIn':this[_0x6130('0x15')],'name':this[_0x6130('0x9')],'paused':this[_0x6130('0x16')],'waiting':this['waiting']};var _0x33f0f6=md5(JSON['stringify'](_0x1cd785));if(this[_0x6130('0x1')]!==_0x33f0f6){this[_0x6130('0x1')]=_0x33f0f6;io['to'](util[_0x6130('0x1b')](_0x6130('0x1c'),_0x1cd785[_0x6130('0x9')]))['emit']('sms_queue:save',_0x1cd785);}};module[_0x6130('0x1d')]=SmsQueue; \ No newline at end of file +var _0xe5b3=['../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','_rr','mapAgentsId','map','loggedIn','length','online','available','paused','stringify','format','sms:queue:%s','emit','sms_queue:save','exports','md5','util','ioredis'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xe5b3,0x133));var _0x3e5b=function(_0x3ce6c1,_0x3ab7a7){_0x3ce6c1=_0x3ce6c1-0x0;var _0xecc97d=_0xe5b3[_0x3ce6c1];return _0xecc97d;};'use strict';var _=require('lodash');var md5=require(_0x3e5b('0x0'));var util=require(_0x3e5b('0x1'));var Redis=require(_0x3e5b('0x2'));var config=require(_0x3e5b('0x3'));config[_0x3e5b('0x4')]=_[_0x3e5b('0x5')](config[_0x3e5b('0x4')],{'host':_0x3e5b('0x6'),'port':0x18eb});var io=require(_0x3e5b('0x7'))(new Redis(config[_0x3e5b('0x4')]));function SmsQueue(_0x36e319){this['id']=_0x36e319['id']||0x0;this['name']=_0x36e319[_0x3e5b('0x8')]||'';this[_0x3e5b('0x9')]=_0x36e319['timeout']||0xa;this[_0x3e5b('0xa')]=_0x36e319[_0x3e5b('0xa')]||_0x3e5b('0xb');this[_0x3e5b('0xc')]=_0x36e319['Agents'];this['mapAgentsId']={};this[_0x3e5b('0xd')]=0x0;this[_0x3e5b('0x0')]='';this[_0x3e5b('0xe')]();this[_0x3e5b('0xf')]();}SmsQueue[_0x3e5b('0x10')]['updateRouting']=function(){var _0x3be027=this['mapAgentsId'][_0x3e5b('0x11')];this[_0x3e5b('0x12')]=_[_0x3e5b('0x13')](this[_0x3e5b('0xc')],'id');this[_0x3e5b('0x12')][_0x3e5b('0x11')]=_0x3be027;};SmsQueue[_0x3e5b('0x10')]['updateRealtime']=function(){this[_0x3e5b('0x14')]=0x0;this['paused']=0x0;for(var _0x51a188=0x0;_0x51a188=0x0?this['available']:0x0;var _0xc56a2a={'id':this['id'],'available':this[_0x3e5b('0x17')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0x3e5b('0x18')],'waiting':this[_0x3e5b('0xd')]};var _0x20b549=md5(JSON[_0x3e5b('0x19')](_0xc56a2a));if(this[_0x3e5b('0x0')]!==_0x20b549){this[_0x3e5b('0x0')]=_0x20b549;io['to'](util[_0x3e5b('0x1a')](_0x3e5b('0x1b'),_0xc56a2a[_0x3e5b('0x8')]))[_0x3e5b('0x1c')](_0x3e5b('0x1d'),_0xc56a2a);}};module[_0x3e5b('0x1e')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 2fb16bf..de0218d 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 _0x69fe=['whatsapp:queue:%s','whatsapp_queue:save','exports','lodash','md5','util','../../../config/environment','defaults','redis','localhost','socket.io-emitter','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','loggedIn','paused','length','online','whatsappPause','available','name','format'];(function(_0x89c994,_0x48078f){var _0x31ef0b=function(_0x4de9b1){while(--_0x4de9b1){_0x89c994['push'](_0x89c994['shift']());}};_0x31ef0b(++_0x48078f);}(_0x69fe,0xce));var _0xe69f=function(_0x24c32e,_0x5a08dc){_0x24c32e=_0x24c32e-0x0;var _0x1e48fd=_0x69fe[_0x24c32e];return _0x1e48fd;};'use strict';var _=require(_0xe69f('0x0'));var md5=require(_0xe69f('0x1'));var util=require(_0xe69f('0x2'));var Redis=require('ioredis');var config=require(_0xe69f('0x3'));config['redis']=_[_0xe69f('0x4')](config[_0xe69f('0x5')],{'host':_0xe69f('0x6'),'port':0x18eb});var io=require(_0xe69f('0x7'))(new Redis(config[_0xe69f('0x5')]));function WhatsappQueue(_0x29c54c){this['id']=_0x29c54c['id']||0x0;this['name']=_0x29c54c['name']||'';this['timeout']=_0x29c54c[_0xe69f('0x8')]||0xa;this[_0xe69f('0x9')]=_0x29c54c[_0xe69f('0x9')]||_0xe69f('0xa');this[_0xe69f('0xb')]=_0x29c54c['Agents'];this[_0xe69f('0xc')]={};this[_0xe69f('0xd')]=0x0;this[_0xe69f('0x1')]='';this[_0xe69f('0xe')]();this[_0xe69f('0xf')]();}WhatsappQueue[_0xe69f('0x10')][_0xe69f('0xe')]=function(){var _0x5f7d9b=this['mapAgentsId'][_0xe69f('0x11')];this['mapAgentsId']=_['map'](this['Agents'],'id');this[_0xe69f('0xc')]['_rr']=_0x5f7d9b;};WhatsappQueue[_0xe69f('0x10')][_0xe69f('0xf')]=function(){this[_0xe69f('0x12')]=0x0;this[_0xe69f('0x13')]=0x0;for(var _0x5c83df=0x0;_0x5c83df=0x0?this[_0xe69f('0x17')]:0x0;var _0x29738e={'id':this['id'],'available':this[_0xe69f('0x17')],'loggedIn':this['loggedIn'],'name':this[_0xe69f('0x18')],'paused':this[_0xe69f('0x13')],'waiting':this[_0xe69f('0xd')]};var _0x28bbf1=md5(JSON['stringify'](_0x29738e));if(this[_0xe69f('0x1')]!==_0x28bbf1){this[_0xe69f('0x1')]=_0x28bbf1;io['to'](util[_0xe69f('0x19')](_0xe69f('0x1a'),_0x29738e[_0xe69f('0x18')]))['emit'](_0xe69f('0x1b'),_0x29738e);}};module[_0xe69f('0x1c')]=WhatsappQueue; \ No newline at end of file +var _0x629a=['strategy','beepall','Agents','md5','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map','loggedIn','paused','length','online','whatsappPause','available','waiting','stringify','format','emit','whatsapp_queue:save','exports','util','ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout'];(function(_0x11fc67,_0x1eda19){var _0x50bb19=function(_0x302214){while(--_0x302214){_0x11fc67['push'](_0x11fc67['shift']());}};_0x50bb19(++_0x1eda19);}(_0x629a,0xc4));var _0xa629=function(_0x33bad8,_0x429dd7){_0x33bad8=_0x33bad8-0x0;var _0x104b75=_0x629a[_0x33bad8];return _0x104b75;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0xa629('0x0'));var Redis=require(_0xa629('0x1'));var config=require(_0xa629('0x2'));config[_0xa629('0x3')]=_['defaults'](config[_0xa629('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0xa629('0x4'))(new Redis(config[_0xa629('0x3')]));function WhatsappQueue(_0x328710){this['id']=_0x328710['id']||0x0;this[_0xa629('0x5')]=_0x328710[_0xa629('0x5')]||'';this['timeout']=_0x328710[_0xa629('0x6')]||0xa;this[_0xa629('0x7')]=_0x328710[_0xa629('0x7')]||_0xa629('0x8');this[_0xa629('0x9')]=_0x328710[_0xa629('0x9')];this['mapAgentsId']={};this['waiting']=0x0;this[_0xa629('0xa')]='';this[_0xa629('0xb')]();this[_0xa629('0xc')]();}WhatsappQueue[_0xa629('0xd')]['updateRouting']=function(){var _0x5ac516=this[_0xa629('0xe')][_0xa629('0xf')];this[_0xa629('0xe')]=_[_0xa629('0x10')](this['Agents'],'id');this[_0xa629('0xe')]['_rr']=_0x5ac516;};WhatsappQueue[_0xa629('0xd')][_0xa629('0xc')]=function(){this[_0xa629('0x11')]=0x0;this[_0xa629('0x12')]=0x0;for(var _0x44429c=0x0;_0x44429c=0x0?this[_0xa629('0x16')]:0x0;var _0x493d13={'id':this['id'],'available':this[_0xa629('0x16')],'loggedIn':this['loggedIn'],'name':this[_0xa629('0x5')],'paused':this[_0xa629('0x12')],'waiting':this[_0xa629('0x17')]};var _0x126a2b=md5(JSON[_0xa629('0x18')](_0x493d13));if(this[_0xa629('0xa')]!==_0x126a2b){this[_0xa629('0xa')]=_0x126a2b;io['to'](util[_0xa629('0x19')]('whatsapp:queue:%s',_0x493d13[_0xa629('0x5')]))[_0xa629('0x1a')](_0xa629('0x1b'),_0x493d13);}};module[_0xa629('0x1c')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 7a87d5a..a19847b 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','isUndefined','initIntervals','length','initOpenchannelQueues','updateRealtime','initChatQueues','chatQueues','initSmsQueues','updateRouting','initMailQueues','initFaxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','smsQueues','mailQueues'];(function(_0x384515,_0x1295a4){var _0x309c06=function(_0x332591){while(--_0x332591){_0x384515['push'](_0x384515['shift']());}};_0x309c06(++_0x1295a4);}(_0xb10b,0x12a));var _0xbb10=function(_0x22d19d,_0x379051){_0x22d19d=_0x22d19d-0x0;var _0x103fc2=_0xb10b[_0x22d19d];return _0x103fc2;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file +var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'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 64b60c4..4d76cf0 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 _0xd068=['Request','UpdateChatInteraction','updateChatInteraction','addTagsToChatInteraction','update'];(function(_0x295583,_0x4756aa){var _0x4c2ae6=function(_0xa20d19){while(--_0xa20d19){_0x295583['push'](_0x295583['shift']());}};_0x4c2ae6(++_0x4756aa);}(_0xd068,0x199));var _0x8d06=function(_0x48a459,_0x2d6460){_0x48a459=_0x48a459-0x0;var _0xa1b9b3=_0xd068[_0x48a459];return _0xa1b9b3;};'use strict';var client=require('../client');exports[_0x8d06('0x0')]=function(_0x4d4750,_0x169b86){return client[_0x8d06('0x1')](_0x8d06('0x2'),{'body':_0x169b86,'options':{'where':{'id':_0x4d4750}},'log':_0x8d06('0x3')});};exports['addTags']=function(_0xe6d456,_0x218d24){return client['Request']('AddTagsToChatInteraction',{'body':_0x218d24,'options':{'where':{'id':_0xe6d456}},'log':_0x8d06('0x4')});}; \ No newline at end of file +var _0x4767=['../client','update','Request','UpdateChatInteraction','updateChatInteraction','addTags','AddTagsToChatInteraction','addTagsToChatInteraction'];(function(_0xf27995,_0xf56b28){var _0x1da3e1=function(_0x3f8cb1){while(--_0x3f8cb1){_0xf27995['push'](_0xf27995['shift']());}};_0x1da3e1(++_0xf56b28);}(_0x4767,0xe8));var _0x7476=function(_0x1b586b,_0x27c167){_0x1b586b=_0x1b586b-0x0;var _0x171843=_0x4767[_0x1b586b];return _0x171843;};'use strict';var client=require(_0x7476('0x0'));exports[_0x7476('0x1')]=function(_0x56ebdf,_0x5701af){return client[_0x7476('0x2')](_0x7476('0x3'),{'body':_0x5701af,'options':{'where':{'id':_0x56ebdf}},'log':_0x7476('0x4')});};exports[_0x7476('0x5')]=function(_0x39dd8c,_0x15b095){return client[_0x7476('0x2')](_0x7476('0x6'),{'body':_0x15b095,'options':{'where':{'id':_0x39dd8c}},'log':_0x7476('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 616667e..8866378 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 _0x4320=['create','Request','CreateChatMessage','../client'];(function(_0x1a27f3,_0x1c082d){var _0x3ce222=function(_0x3f93e1){while(--_0x3f93e1){_0x1a27f3['push'](_0x1a27f3['shift']());}};_0x3ce222(++_0x1c082d);}(_0x4320,0x197));var _0x0432=function(_0x409353,_0xe9f04d){_0x409353=_0x409353-0x0;var _0x4f4b59=_0x4320[_0x409353];return _0x4f4b59;};'use strict';var client=require(_0x0432('0x0'));exports[_0x0432('0x1')]=function(_0x4ecd24){return client[_0x0432('0x2')](_0x0432('0x3'),{'body':_0x4ecd24,'log':'createChatMessage'});}; \ No newline at end of file +var _0x8be4=['create','Request','CreateChatMessage','createChatMessage'];(function(_0x474bc0,_0x26989c){var _0x4b24cf=function(_0x4be866){while(--_0x4be866){_0x474bc0['push'](_0x474bc0['shift']());}};_0x4b24cf(++_0x26989c);}(_0x8be4,0xc4));var _0x48be=function(_0x42ab91,_0x2a0179){_0x42ab91=_0x42ab91-0x0;var _0x259d35=_0x8be4[_0x42ab91];return _0x259d35;};'use strict';var client=require('../client');exports[_0x48be('0x0')]=function(_0x516764){return client[_0x48be('0x1')](_0x48be('0x2'),{'body':_0x516764,'log':_0x48be('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index cbcea33..2dca563 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 _0x02a7=['User','Agents','online','getChatQueues','name','timeout','strategy'];(function(_0x50eace,_0x102360){var _0x3963de=function(_0x1277d1){while(--_0x1277d1){_0x50eace['push'](_0x50eace['shift']());}};_0x3963de(++_0x102360);}(_0x02a7,0x7a));var _0x702a=function(_0x2b1848,_0x584215){_0x2b1848=_0x2b1848-0x0;var _0x4fb5d0=_0x02a7[_0x2b1848];return _0x4fb5d0;};'use strict';var client=require('../client');exports[_0x702a('0x0')]=function(){return function(){return client['Request']('GetChatQueue',{'options':{'raw':![],'attributes':['id',_0x702a('0x1'),_0x702a('0x2'),_0x702a('0x3')],'include':[{'model':_0x702a('0x4'),'as':_0x702a('0x5'),'attributes':['id',_0x702a('0x1'),_0x702a('0x6'),'chatPause']}]},'log':_0x702a('0x0')});};}; \ No newline at end of file +var _0x5e0c=['chatPause','getChatQueues','Request','GetChatQueue','name','timeout','strategy','Agents','online'];(function(_0x4032ae,_0x18ef20){var _0x523306=function(_0x4923c6){while(--_0x4923c6){_0x4032ae['push'](_0x4032ae['shift']());}};_0x523306(++_0x18ef20);}(_0x5e0c,0x19f));var _0xc5e0=function(_0x4bb969,_0x41e27a){_0x4bb969=_0x4bb969-0x0;var _0x5c8857=_0x5e0c[_0x4bb969];return _0x5c8857;};'use strict';var client=require('../client');exports[_0xc5e0('0x0')]=function(){return function(){return client[_0xc5e0('0x1')](_0xc5e0('0x2'),{'options':{'raw':![],'attributes':['id',_0xc5e0('0x3'),_0xc5e0('0x4'),_0xc5e0('0x5')],'include':[{'model':'User','as':_0xc5e0('0x6'),'attributes':['id',_0xc5e0('0x3'),_0xc5e0('0x7'),_0xc5e0('0x8')]}]},'log':_0xc5e0('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index a91035e..bb1888f 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 _0x98b8=['../client','create','Request','CreateChatQueueReport','update','UpdateChatQueueReport','DESC'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x98b8,0x93));var _0x898b=function(_0x56900f,_0x52c0a1){_0x56900f=_0x56900f-0x0;var _0x286a61=_0x98b8[_0x56900f];return _0x286a61;};'use strict';var client=require(_0x898b('0x0'));exports[_0x898b('0x1')]=function(_0x43dfc2){return client[_0x898b('0x2')](_0x898b('0x3'),{'body':_0x43dfc2,'log':_0x898b('0x3')});};exports[_0x898b('0x4')]=function(_0x1a4cad,_0xc90f04){return client[_0x898b('0x2')](_0x898b('0x5'),{'body':_0xc90f04,'options':{'where':{'uniqueid':_0x1a4cad},'order':[['id',_0x898b('0x6')]],'limit':0x1},'log':_0x898b('0x5')});}; \ No newline at end of file +var _0xb7c8=['Request','CreateChatQueueReport','update','UpdateChatQueueReport','DESC','create'];(function(_0x56bb4f,_0x107755){var _0x5b4c10=function(_0x1fb8df){while(--_0x1fb8df){_0x56bb4f['push'](_0x56bb4f['shift']());}};_0x5b4c10(++_0x107755);}(_0xb7c8,0x119));var _0x8b7c=function(_0x141bff,_0x51f023){_0x141bff=_0x141bff-0x0;var _0x428458=_0xb7c8[_0x141bff];return _0x428458;};'use strict';var client=require('../client');exports[_0x8b7c('0x0')]=function(_0x150db2){return client[_0x8b7c('0x1')](_0x8b7c('0x2'),{'body':_0x150db2,'log':_0x8b7c('0x2')});};exports[_0x8b7c('0x3')]=function(_0x396b64,_0x50113e){return client[_0x8b7c('0x1')](_0x8b7c('0x4'),{'body':_0x50113e,'options':{'where':{'uniqueid':_0x396b64},'order':[['id',_0x8b7c('0x5')]],'limit':0x1},'log':_0x8b7c('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 48eb445..84ba87d 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(_0x74745d,_0x177606){var _0x174ab3=function(_0x1c94e9){while(--_0x1c94e9){_0x74745d['push'](_0x74745d['shift']());}};_0x174ab3(++_0x177606);}(_0x7a54,0x106));var _0x47a5=function(_0x15517f,_0x56dfa2){_0x15517f=_0x15517f-0x0;var _0x6bc299=_0x7a54[_0x15517f];return _0x6bc299;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file +var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x387bb1,_0x4d6147){var _0x34506a=function(_0x4a735a){while(--_0x4a735a){_0x387bb1['push'](_0x387bb1['shift']());}};_0x34506a(++_0x4d6147);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 38c3dc1..30ea040 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 _0x627a=['create','Request','CreateFaxMessage','createFaxMessage'];(function(_0x17e174,_0x4991f8){var _0x3f26f1=function(_0x169012){while(--_0x169012){_0x17e174['push'](_0x17e174['shift']());}};_0x3f26f1(++_0x4991f8);}(_0x627a,0xa4));var _0xa627=function(_0xae5829,_0x1ff197){_0xae5829=_0xae5829-0x0;var _0x26d1e7=_0x627a[_0xae5829];return _0x26d1e7;};'use strict';var client=require('../client');exports[_0xa627('0x0')]=function(_0x5c3326){return client[_0xa627('0x1')](_0xa627('0x2'),{'body':_0x5c3326,'log':_0xa627('0x3')});}; \ No newline at end of file +var _0xa53e=['../client','CreateFaxMessage'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xa53e,0x14c));var _0xea53=function(_0x457812,_0x1ae6a2){_0x457812=_0x457812-0x0;var _0x2a5982=_0xa53e[_0x457812];return _0x2a5982;};'use strict';var client=require(_0xea53('0x0'));exports['create']=function(_0x3b004d){return client['Request'](_0xea53('0x1'),{'body':_0x3b004d,'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 8a1841b..b58e855 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 _0x3243=['getFaxQueues','Request','name','timeout','strategy','User','Agents','online','../client'];(function(_0x564643,_0x41d6ff){var _0x5c493e=function(_0x3172af){while(--_0x3172af){_0x564643['push'](_0x564643['shift']());}};_0x5c493e(++_0x41d6ff);}(_0x3243,0x131));var _0x3324=function(_0x10906a,_0x213791){_0x10906a=_0x10906a-0x0;var _0x5e0e6a=_0x3243[_0x10906a];return _0x5e0e6a;};'use strict';var client=require(_0x3324('0x0'));exports[_0x3324('0x1')]=function(){return function(){return client[_0x3324('0x2')]('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0x3324('0x3'),_0x3324('0x4'),_0x3324('0x5')],'include':[{'model':_0x3324('0x6'),'as':_0x3324('0x7'),'attributes':['id',_0x3324('0x3'),_0x3324('0x8'),'faxPause']}]},'log':_0x3324('0x1')});};}; \ No newline at end of file +var _0x225d=['strategy','online','faxPause','../client','getFaxQueues','GetFaxQueue'];(function(_0x2f05a3,_0x187a94){var _0x38a049=function(_0x2e009b){while(--_0x2e009b){_0x2f05a3['push'](_0x2f05a3['shift']());}};_0x38a049(++_0x187a94);}(_0x225d,0xff));var _0xd225=function(_0x10f166,_0x20339b){_0x10f166=_0x10f166-0x0;var _0x115fbe=_0x225d[_0x10f166];return _0x115fbe;};'use strict';var client=require(_0xd225('0x0'));exports[_0xd225('0x1')]=function(){return function(){return client['Request'](_0xd225('0x2'),{'options':{'raw':![],'attributes':['id','name','timeout',_0xd225('0x3')],'include':[{'model':'User','as':'Agents','attributes':['id','name',_0xd225('0x4'),_0xd225('0x5')]}]},'log':'getFaxQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 9fa21d2..d9cdf59 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 _0xdcd3=['UpdateFaxQueueReport','DESC','../client','create','Request','CreateFaxQueueReport','update'];(function(_0x1b591b,_0x6d2e2b){var _0x3c24f0=function(_0x265093){while(--_0x265093){_0x1b591b['push'](_0x1b591b['shift']());}};_0x3c24f0(++_0x6d2e2b);}(_0xdcd3,0x160));var _0x3dcd=function(_0x43a4eb,_0x1d9d6c){_0x43a4eb=_0x43a4eb-0x0;var _0xc2b81e=_0xdcd3[_0x43a4eb];return _0xc2b81e;};'use strict';var client=require(_0x3dcd('0x0'));exports[_0x3dcd('0x1')]=function(_0x31671a){return client[_0x3dcd('0x2')](_0x3dcd('0x3'),{'body':_0x31671a,'log':_0x3dcd('0x3')});};exports[_0x3dcd('0x4')]=function(_0x1d1a33,_0x326abd){return client[_0x3dcd('0x2')](_0x3dcd('0x5'),{'body':_0x326abd,'options':{'where':{'uniqueid':_0x1d1a33},'order':[['id',_0x3dcd('0x6')]],'limit':0x1},'log':_0x3dcd('0x5')});}; \ No newline at end of file +var _0x1a29=['Request','CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC','../client','create'];(function(_0xbd3ac0,_0x4f69fc){var _0x36fc9e=function(_0x7325c1){while(--_0x7325c1){_0xbd3ac0['push'](_0xbd3ac0['shift']());}};_0x36fc9e(++_0x4f69fc);}(_0x1a29,0x140));var _0x91a2=function(_0x444e05,_0x1a3c13){_0x444e05=_0x444e05-0x0;var _0x155a39=_0x1a29[_0x444e05];return _0x155a39;};'use strict';var client=require(_0x91a2('0x0'));exports[_0x91a2('0x1')]=function(_0x54fea){return client[_0x91a2('0x2')]('CreateFaxQueueReport',{'body':_0x54fea,'log':_0x91a2('0x3')});};exports[_0x91a2('0x4')]=function(_0x506993,_0x4b975c){return client[_0x91a2('0x2')](_0x91a2('0x5'),{'body':_0x4b975c,'options':{'where':{'uniqueid':_0x506993},'order':[['id',_0x91a2('0x6')]],'limit':0x1},'log':_0x91a2('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index fb84d3a..ec98443 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 _0xf574=['Interval','getIntervals','name'];(function(_0x5e39ea,_0x54c56a){var _0x224783=function(_0x2dcad1){while(--_0x2dcad1){_0x5e39ea['push'](_0x5e39ea['shift']());}};_0x224783(++_0x54c56a);}(_0xf574,0x1ca));var _0x4f57=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf574[_0x20a584];return _0x4b41a8;};'use strict';var client=require('../client');exports['getIntervals']=function(){return function(){return client['Request']('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x4f57('0x0')],'include':[{'model':_0x4f57('0x1'),'as':'Intervals','attributes':['id','name','interval']}]},'log':_0x4f57('0x2')});};}; \ No newline at end of file +var _0x0b1e=['name','../client','getIntervals','Request','Interval','Intervals'];(function(_0x8feba0,_0x52423e){var _0x2cd346=function(_0x43e545){while(--_0x43e545){_0x8feba0['push'](_0x8feba0['shift']());}};_0x2cd346(++_0x52423e);}(_0x0b1e,0x11b));var _0xe0b1=function(_0x18e875,_0x54fff7){_0x18e875=_0x18e875-0x0;var _0x1643c6=_0x0b1e[_0x18e875];return _0x1643c6;};'use strict';var client=require(_0xe0b1('0x0'));exports[_0xe0b1('0x1')]=function(){return function(){return client[_0xe0b1('0x2')]('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0xe0b1('0x3'),'as':_0xe0b1('0x4'),'attributes':['id',_0xe0b1('0x5'),'interval']}]},'log':_0xe0b1('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 56c2843..12bbe89 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 _0x47c5=['UpdateMailInteraction','addTags','AddTagsToMailInteraction','../client','update','Request'];(function(_0x47bc31,_0x3b6bac){var _0x219dfd=function(_0xa7c66d){while(--_0xa7c66d){_0x47bc31['push'](_0x47bc31['shift']());}};_0x219dfd(++_0x3b6bac);}(_0x47c5,0x165));var _0x547c=function(_0x2e2d89,_0x4bb615){_0x2e2d89=_0x2e2d89-0x0;var _0x3aba90=_0x47c5[_0x2e2d89];return _0x3aba90;};'use strict';var client=require(_0x547c('0x0'));exports[_0x547c('0x1')]=function(_0x2b2280,_0x123697){return client[_0x547c('0x2')](_0x547c('0x3'),{'body':_0x123697,'options':{'where':{'id':_0x2b2280}},'log':'updateMailInteraction'});};exports[_0x547c('0x4')]=function(_0x16f4db,_0x5b48c9){return client[_0x547c('0x2')](_0x547c('0x5'),{'body':_0x5b48c9,'options':{'where':{'id':_0x16f4db}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0xe5af=['update','Request','UpdateMailInteraction','updateMailInteraction','AddTagsToMailInteraction','addTagsToChatInteraction'];(function(_0x5f6715,_0x23eee6){var _0x2d4f29=function(_0x556b61){while(--_0x556b61){_0x5f6715['push'](_0x5f6715['shift']());}};_0x2d4f29(++_0x23eee6);}(_0xe5af,0x9c));var _0xfe5a=function(_0x14afeb,_0x1d2903){_0x14afeb=_0x14afeb-0x0;var _0x7c708a=_0xe5af[_0x14afeb];return _0x7c708a;};'use strict';var client=require('../client');exports[_0xfe5a('0x0')]=function(_0x189c37,_0x4b1845){return client[_0xfe5a('0x1')](_0xfe5a('0x2'),{'body':_0x4b1845,'options':{'where':{'id':_0x189c37}},'log':_0xfe5a('0x3')});};exports['addTags']=function(_0x1165e3,_0x48e3a7){return client['Request'](_0xfe5a('0x4'),{'body':_0x48e3a7,'options':{'where':{'id':_0x1165e3}},'log':_0xfe5a('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 2e84d54..ed4bef8 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 _0xf6e0=['CreateMailMessage','../client','create','Request'];(function(_0x119961,_0x38c0a1){var _0x147fe2=function(_0xd2e914){while(--_0xd2e914){_0x119961['push'](_0x119961['shift']());}};_0x147fe2(++_0x38c0a1);}(_0xf6e0,0x155));var _0x0f6e=function(_0x2d09e6,_0x5726c9){_0x2d09e6=_0x2d09e6-0x0;var _0x2dda8b=_0xf6e0[_0x2d09e6];return _0x2dda8b;};'use strict';var client=require(_0x0f6e('0x0'));exports[_0x0f6e('0x1')]=function(_0x32f51c){return client[_0x0f6e('0x2')](_0x0f6e('0x3'),{'body':_0x32f51c,'log':'createMailMessage'});}; \ No newline at end of file +var _0x5c21=['../client','create','Request','CreateMailMessage','createMailMessage'];(function(_0xeacdf4,_0xd8c4cd){var _0x53ad33=function(_0x536e93){while(--_0x536e93){_0xeacdf4['push'](_0xeacdf4['shift']());}};_0x53ad33(++_0xd8c4cd);}(_0x5c21,0x195));var _0x15c2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5c21[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x15c2('0x0'));exports[_0x15c2('0x1')]=function(_0x2dc81b){return client[_0x15c2('0x2')](_0x15c2('0x3'),{'body':_0x2dc81b,'log':_0x15c2('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 6bf8c81..5401891 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 _0xc342=['mailPause','../client','getMailQueues','Request','GetMailQueue','name','timeout','strategy','Agents','online'];(function(_0x3d2108,_0x2056bc){var _0x5f5c03=function(_0x3c1a6e){while(--_0x3c1a6e){_0x3d2108['push'](_0x3d2108['shift']());}};_0x5f5c03(++_0x2056bc);}(_0xc342,0x12d));var _0x2c34=function(_0x29db36,_0x410ae9){_0x29db36=_0x29db36-0x0;var _0x234e87=_0xc342[_0x29db36];return _0x234e87;};'use strict';var client=require(_0x2c34('0x0'));exports[_0x2c34('0x1')]=function(){return function(){return client[_0x2c34('0x2')](_0x2c34('0x3'),{'options':{'raw':![],'attributes':['id',_0x2c34('0x4'),_0x2c34('0x5'),_0x2c34('0x6')],'include':[{'model':'User','as':_0x2c34('0x7'),'attributes':['id',_0x2c34('0x4'),_0x2c34('0x8'),_0x2c34('0x9')]}]},'log':_0x2c34('0x1')});};}; \ No newline at end of file +var _0x5d46=['mailPause','../client','Request','name','timeout','strategy','Agents','online'];(function(_0x5b6acf,_0x1019ac){var _0x4d914b=function(_0x53d9bb){while(--_0x53d9bb){_0x5b6acf['push'](_0x5b6acf['shift']());}};_0x4d914b(++_0x1019ac);}(_0x5d46,0x1e9));var _0x65d4=function(_0x1c606d,_0x56e1f5){_0x1c606d=_0x1c606d-0x0;var _0x11415f=_0x5d46[_0x1c606d];return _0x11415f;};'use strict';var client=require(_0x65d4('0x0'));exports['getMailQueues']=function(){return function(){return client[_0x65d4('0x1')]('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0x65d4('0x2'),_0x65d4('0x3'),_0x65d4('0x4')],'include':[{'model':'User','as':_0x65d4('0x5'),'attributes':['id',_0x65d4('0x2'),_0x65d4('0x6'),_0x65d4('0x7')]}]},'log':'getMailQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 8479c0e..2121fac 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 _0x8fbd=['UpdateMailQueueReport','DESC','../client','Request','update'];(function(_0x33dcc4,_0x4078dc){var _0x352924=function(_0x4d47b4){while(--_0x4d47b4){_0x33dcc4['push'](_0x33dcc4['shift']());}};_0x352924(++_0x4078dc);}(_0x8fbd,0xfc));var _0xd8fb=function(_0x10c791,_0x2c7f5d){_0x10c791=_0x10c791-0x0;var _0x26fd39=_0x8fbd[_0x10c791];return _0x26fd39;};'use strict';var client=require(_0xd8fb('0x0'));exports['create']=function(_0x4ddeef){return client[_0xd8fb('0x1')]('CreateMailQueueReport',{'body':_0x4ddeef,'log':'CreateMailQueueReport'});};exports[_0xd8fb('0x2')]=function(_0x5d3c2f,_0x227395){return client[_0xd8fb('0x1')](_0xd8fb('0x3'),{'body':_0x227395,'options':{'where':{'uniqueid':_0x5d3c2f},'order':[['id',_0xd8fb('0x4')]],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file +var _0x93d2=['CreateMailQueueReport','UpdateMailQueueReport','DESC','../client','create','Request'];(function(_0x104081,_0x7082f){var _0x2739c4=function(_0x22f3a7){while(--_0x22f3a7){_0x104081['push'](_0x104081['shift']());}};_0x2739c4(++_0x7082f);}(_0x93d2,0x1e9));var _0x293d=function(_0x44ff6b,_0x13d8e9){_0x44ff6b=_0x44ff6b-0x0;var _0x402226=_0x93d2[_0x44ff6b];return _0x402226;};'use strict';var client=require(_0x293d('0x0'));exports[_0x293d('0x1')]=function(_0x2bbf84){return client[_0x293d('0x2')](_0x293d('0x3'),{'body':_0x2bbf84,'log':_0x293d('0x3')});};exports['update']=function(_0x1863bf,_0x49e926){return client[_0x293d('0x2')](_0x293d('0x4'),{'body':_0x49e926,'options':{'where':{'uniqueid':_0x1863bf},'order':[['id',_0x293d('0x5')]],'limit':0x1},'log':_0x293d('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 58727e0..579f267 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 _0x48c6=['addTagsToChatInteraction','../client','addTags','Request'];(function(_0xd9e86d,_0x2bcde7){var _0x23d91f=function(_0x4e55db){while(--_0x4e55db){_0xd9e86d['push'](_0xd9e86d['shift']());}};_0x23d91f(++_0x2bcde7);}(_0x48c6,0x75));var _0x648c=function(_0x835dbc,_0x3852e3){_0x835dbc=_0x835dbc-0x0;var _0x1ac9d7=_0x48c6[_0x835dbc];return _0x1ac9d7;};'use strict';var client=require(_0x648c('0x0'));exports['update']=function(_0x54c940,_0x19e461){return client['Request']('UpdateOpenchannelInteraction',{'body':_0x19e461,'options':{'where':{'id':_0x54c940}},'log':'updateOpenchannelInteraction'});};exports[_0x648c('0x1')]=function(_0x28be60,_0x3f3214){return client[_0x648c('0x2')]('AddTagsToOpenchannelInteraction',{'body':_0x3f3214,'options':{'where':{'id':_0x28be60}},'log':_0x648c('0x3')});}; \ No newline at end of file +var _0x282a=['addTagsToChatInteraction','../client','update','Request','updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction'];(function(_0x3ba59d,_0x56af36){var _0x489295=function(_0x2457ef){while(--_0x2457ef){_0x3ba59d['push'](_0x3ba59d['shift']());}};_0x489295(++_0x56af36);}(_0x282a,0xd3));var _0xa282=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0x282a[_0x4b7895];return _0x264180;};'use strict';var client=require(_0xa282('0x0'));exports[_0xa282('0x1')]=function(_0xe233,_0x1665c8){return client[_0xa282('0x2')]('UpdateOpenchannelInteraction',{'body':_0x1665c8,'options':{'where':{'id':_0xe233}},'log':_0xa282('0x3')});};exports[_0xa282('0x4')]=function(_0x35974e,_0x406b48){return client[_0xa282('0x2')](_0xa282('0x5'),{'body':_0x406b48,'options':{'where':{'id':_0x35974e}},'log':_0xa282('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 0e09510..3d6eab8 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 _0xaab0=['createOpenchannelMessage','create','Request','CreateOpenchannelMessage'];(function(_0x528651,_0x85fecd){var _0x425450=function(_0x438f0d){while(--_0x438f0d){_0x528651['push'](_0x528651['shift']());}};_0x425450(++_0x85fecd);}(_0xaab0,0x1c5));var _0x0aab=function(_0xcf0d77,_0x2195aa){_0xcf0d77=_0xcf0d77-0x0;var _0x13b05f=_0xaab0[_0xcf0d77];return _0x13b05f;};'use strict';var client=require('../client');exports[_0x0aab('0x0')]=function(_0x589b1f){return client[_0x0aab('0x1')](_0x0aab('0x2'),{'body':_0x589b1f,'log':_0x0aab('0x3')});}; \ No newline at end of file +var _0x4acb=['create','Request','createOpenchannelMessage','../client'];(function(_0x44c974,_0x1bcfde){var _0x5214c6=function(_0x10aad5){while(--_0x10aad5){_0x44c974['push'](_0x44c974['shift']());}};_0x5214c6(++_0x1bcfde);}(_0x4acb,0x10b));var _0xb4ac=function(_0xd85a1f,_0x3a7e77){_0xd85a1f=_0xd85a1f-0x0;var _0x109b83=_0x4acb[_0xd85a1f];return _0x109b83;};'use strict';var client=require(_0xb4ac('0x0'));exports[_0xb4ac('0x1')]=function(_0xd07895){return client[_0xb4ac('0x2')]('CreateOpenchannelMessage',{'body':_0xd07895,'log':_0xb4ac('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 05253b8..79c42fd 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 _0xf339=['timeout','User','Agents','openchannelPause','getOpenchannelQueues','Request','GetOpenchannelQueue','name'];(function(_0x1339a0,_0x1d8f73){var _0x46c373=function(_0x448932){while(--_0x448932){_0x1339a0['push'](_0x1339a0['shift']());}};_0x46c373(++_0x1d8f73);}(_0xf339,0x12c));var _0x9f33=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xf339[_0x413feb];return _0x40ee88;};'use strict';var client=require('../client');exports[_0x9f33('0x0')]=function(){return function(){return client[_0x9f33('0x1')](_0x9f33('0x2'),{'options':{'raw':![],'attributes':['id',_0x9f33('0x3'),_0x9f33('0x4'),'strategy'],'include':[{'model':_0x9f33('0x5'),'as':_0x9f33('0x6'),'attributes':['id','name','online',_0x9f33('0x7')]}]},'log':_0x9f33('0x0')});};}; \ No newline at end of file +var _0x9d02=['../client','Request','name','strategy','User','online','openchannelPause'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x9d02,0x118));var _0x29d0=function(_0x18d4b0,_0x33c5eb){_0x18d4b0=_0x18d4b0-0x0;var _0x4ae5c2=_0x9d02[_0x18d4b0];return _0x4ae5c2;};'use strict';var client=require(_0x29d0('0x0'));exports['getOpenchannelQueues']=function(){return function(){return client[_0x29d0('0x1')]('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id',_0x29d0('0x2'),'timeout',_0x29d0('0x3')],'include':[{'model':_0x29d0('0x4'),'as':'Agents','attributes':['id',_0x29d0('0x2'),_0x29d0('0x5'),_0x29d0('0x6')]}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 0a501e6..715437d 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 _0x71dd=['../client','Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC'];(function(_0x4588fa,_0x487742){var _0x3b3d1d=function(_0xce353b){while(--_0xce353b){_0x4588fa['push'](_0x4588fa['shift']());}};_0x3b3d1d(++_0x487742);}(_0x71dd,0xf6));var _0xd71d=function(_0x1b92a6,_0x14444b){_0x1b92a6=_0x1b92a6-0x0;var _0x24be5b=_0x71dd[_0x1b92a6];return _0x24be5b;};'use strict';var client=require(_0xd71d('0x0'));exports['create']=function(_0x1a308c){return client[_0xd71d('0x1')](_0xd71d('0x2'),{'body':_0x1a308c,'log':_0xd71d('0x2')});};exports[_0xd71d('0x3')]=function(_0x124901,_0x36ac61){return client[_0xd71d('0x1')](_0xd71d('0x4'),{'body':_0x36ac61,'options':{'where':{'uniqueid':_0x124901},'order':[['id',_0xd71d('0x5')]],'limit':0x1},'log':_0xd71d('0x4')});}; \ No newline at end of file +var _0x1120=['../client','create','Request','UpdateOpenchannelQueueReport','DESC'];(function(_0x11ebc1,_0x1080ae){var _0x26237c=function(_0x5257b0){while(--_0x5257b0){_0x11ebc1['push'](_0x11ebc1['shift']());}};_0x26237c(++_0x1080ae);}(_0x1120,0x140));var _0x0112=function(_0x4fbb15,_0x21be0c){_0x4fbb15=_0x4fbb15-0x0;var _0x436338=_0x1120[_0x4fbb15];return _0x436338;};'use strict';var client=require(_0x0112('0x0'));exports[_0x0112('0x1')]=function(_0x3a17e){return client['Request']('CreateOpenchannelQueueReport',{'body':_0x3a17e,'log':'CreateOpenchannelQueueReport'});};exports['update']=function(_0x273284,_0x395145){return client[_0x0112('0x2')](_0x0112('0x3'),{'body':_0x395145,'options':{'where':{'uniqueid':_0x273284},'order':[['id',_0x0112('0x4')]],'limit':0x1},'log':_0x0112('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 6aea97d..e687213 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 _0xf569=['UpdateSmsInteraction','updateSmsInteraction','addTags','addTagsToSmsInteraction','update','Request'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf569,0xd0));var _0x9f56=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0xf569[_0x2235bf];return _0x4c3a64;};'use strict';var client=require('../client');exports[_0x9f56('0x0')]=function(_0x301a18,_0x156de2){return client[_0x9f56('0x1')](_0x9f56('0x2'),{'body':_0x156de2,'options':{'where':{'id':_0x301a18}},'log':_0x9f56('0x3')});};exports[_0x9f56('0x4')]=function(_0x6d506b,_0x5bc3e8){return client[_0x9f56('0x1')]('AddTagsToSmsInteraction',{'body':_0x5bc3e8,'options':{'where':{'id':_0x6d506b}},'log':_0x9f56('0x5')});}; \ No newline at end of file +var _0xe062=['Request','UpdateSmsInteraction','addTagsToSmsInteraction','../client','update'];(function(_0x451ba5,_0x2f3a05){var _0x4550fb=function(_0x218412){while(--_0x218412){_0x451ba5['push'](_0x451ba5['shift']());}};_0x4550fb(++_0x2f3a05);}(_0xe062,0xd5));var _0x2e06=function(_0x22dff6,_0x32adbb){_0x22dff6=_0x22dff6-0x0;var _0x19a835=_0xe062[_0x22dff6];return _0x19a835;};'use strict';var client=require(_0x2e06('0x0'));exports[_0x2e06('0x1')]=function(_0x4827bc,_0x2c5971){return client[_0x2e06('0x2')](_0x2e06('0x3'),{'body':_0x2c5971,'options':{'where':{'id':_0x4827bc}},'log':'updateSmsInteraction'});};exports['addTags']=function(_0x1a9d7d,_0x36ebe4){return client['Request']('AddTagsToSmsInteraction',{'body':_0x36ebe4,'options':{'where':{'id':_0x1a9d7d}},'log':_0x2e06('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index d03b294..6ce42ad 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 _0xae25=['create','Request','createSmsMessage'];(function(_0x3837f0,_0xf3c3c7){var _0x3f447a=function(_0x1ef9c7){while(--_0x1ef9c7){_0x3837f0['push'](_0x3837f0['shift']());}};_0x3f447a(++_0xf3c3c7);}(_0xae25,0x114));var _0x5ae2=function(_0x36ba47,_0x2302e3){_0x36ba47=_0x36ba47-0x0;var _0x3084b2=_0xae25[_0x36ba47];return _0x3084b2;};'use strict';var client=require('../client');exports[_0x5ae2('0x0')]=function(_0xf48260){return client[_0x5ae2('0x1')]('CreateSmsMessage',{'body':_0xf48260,'log':_0x5ae2('0x2')});}; \ No newline at end of file +var _0x24ad=['../client','Request','createSmsMessage'];(function(_0xd0cd0b,_0x490956){var _0x59cced=function(_0x567251){while(--_0x567251){_0xd0cd0b['push'](_0xd0cd0b['shift']());}};_0x59cced(++_0x490956);}(_0x24ad,0x186));var _0xd24a=function(_0x462ad5,_0x2aff91){_0x462ad5=_0x462ad5-0x0;var _0x41a5af=_0x24ad[_0x462ad5];return _0x41a5af;};'use strict';var client=require(_0xd24a('0x0'));exports['create']=function(_0x49e973){return client[_0xd24a('0x1')]('CreateSmsMessage',{'body':_0x49e973,'log':_0xd24a('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 37ae497..e6bfb94 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 _0x9c44=['Request','GetSmsQueue','name','timeout','strategy','User','online','getSmsQueues'];(function(_0x836f1e,_0x490c0d){var _0x244ac0=function(_0x4e19fe){while(--_0x4e19fe){_0x836f1e['push'](_0x836f1e['shift']());}};_0x244ac0(++_0x490c0d);}(_0x9c44,0x178));var _0x49c4=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x9c44[_0x334841];return _0x5beb4b;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':![],'attributes':['id',_0x49c4('0x2'),_0x49c4('0x3'),_0x49c4('0x4')],'include':[{'model':_0x49c4('0x5'),'as':'Agents','attributes':['id','name',_0x49c4('0x6'),'smsPause']}]},'log':_0x49c4('0x7')});};}; \ No newline at end of file +var _0x70e0=['User','Agents','online','../client','getSmsQueues','Request','timeout','strategy'];(function(_0xe09377,_0x285d6c){var _0x3a4c8b=function(_0xfce733){while(--_0xfce733){_0xe09377['push'](_0xe09377['shift']());}};_0x3a4c8b(++_0x285d6c);}(_0x70e0,0x17b));var _0x070e=function(_0x49bef5,_0x27f655){_0x49bef5=_0x49bef5-0x0;var _0xed6305=_0x70e0[_0x49bef5];return _0xed6305;};'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 diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 58e9836..d63a1d8 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 _0x008c=['../client','create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x3c7f1d,_0x44b37b){var _0xd7ab0c=function(_0x1dd6b2){while(--_0x1dd6b2){_0x3c7f1d['push'](_0x3c7f1d['shift']());}};_0xd7ab0c(++_0x44b37b);}(_0x008c,0x188));var _0xc008=function(_0x3efe87,_0x35ad48){_0x3efe87=_0x3efe87-0x0;var _0x56a4cc=_0x008c[_0x3efe87];return _0x56a4cc;};'use strict';var client=require(_0xc008('0x0'));exports[_0xc008('0x1')]=function(_0x15aadc){return client[_0xc008('0x2')](_0xc008('0x3'),{'body':_0x15aadc,'log':'CreateSmsQueueReport'});};exports[_0xc008('0x4')]=function(_0x47063f,_0x10b33c){return client[_0xc008('0x2')](_0xc008('0x5'),{'body':_0x10b33c,'options':{'where':{'uniqueid':_0x47063f},'order':[['id',_0xc008('0x6')]],'limit':0x1},'log':_0xc008('0x5')});}; \ No newline at end of file +var _0x55ca=['../client','create','CreateSmsQueueReport','update','Request','UpdateSmsQueueReport','DESC'];(function(_0x464252,_0x4a0433){var _0x52ec8e=function(_0x15cce8){while(--_0x15cce8){_0x464252['push'](_0x464252['shift']());}};_0x52ec8e(++_0x4a0433);}(_0x55ca,0x126));var _0xa55c=function(_0x951de0,_0x410d50){_0x951de0=_0x951de0-0x0;var _0xd338ee=_0x55ca[_0x951de0];return _0xd338ee;};'use strict';var client=require(_0xa55c('0x0'));exports[_0xa55c('0x1')]=function(_0x4e78b4){return client['Request']('CreateSmsQueueReport',{'body':_0x4e78b4,'log':_0xa55c('0x2')});};exports[_0xa55c('0x3')]=function(_0x5dc716,_0x3b478a){return client[_0xa55c('0x4')](_0xa55c('0x5'),{'body':_0x3b478a,'options':{'where':{'uniqueid':_0x5dc716},'order':[['id',_0xa55c('0x6')]],'limit':0x1},'log':_0xa55c('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 91a6233..155a1fa 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(_0x50bad2,_0x44e99e){var _0x2e5a09=function(_0x19fd46){while(--_0x19fd46){_0x50bad2['push'](_0x50bad2['shift']());}};_0x2e5a09(++_0x44e99e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'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(_0x23f98f,_0xcf4c1c){var _0x3b4758=function(_0x1cfe8b){while(--_0x1cfe8b){_0x23f98f['push'](_0x23f98f['shift']());}};_0x3b4758(++_0xcf4c1c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'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 9ae3d25..21f579c 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 _0x0af5=['addTagsToWhatsappInteraction','update','Request','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction'];(function(_0x225976,_0x4d55a7){var _0x28750b=function(_0x357f29){while(--_0x357f29){_0x225976['push'](_0x225976['shift']());}};_0x28750b(++_0x4d55a7);}(_0x0af5,0x158));var _0x50af=function(_0x278a61,_0x54f8b0){_0x278a61=_0x278a61-0x0;var _0xc3c4e4=_0x0af5[_0x278a61];return _0xc3c4e4;};'use strict';var client=require('../client');exports[_0x50af('0x0')]=function(_0x2dae50,_0x13e284){return client[_0x50af('0x1')](_0x50af('0x2'),{'body':_0x13e284,'options':{'where':{'id':_0x2dae50}},'log':_0x50af('0x3')});};exports[_0x50af('0x4')]=function(_0x3733b7,_0x34e045){return client[_0x50af('0x1')](_0x50af('0x5'),{'body':_0x34e045,'options':{'where':{'id':_0x3733b7}},'log':_0x50af('0x6')});}; \ No newline at end of file +var _0x90b5=['UpdateWhatsappInteraction','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','Request'];(function(_0x11cd47,_0x42a4ea){var _0x16d0a2=function(_0x2b9b70){while(--_0x2b9b70){_0x11cd47['push'](_0x11cd47['shift']());}};_0x16d0a2(++_0x42a4ea);}(_0x90b5,0x139));var _0x590b=function(_0x45069b,_0xa96e24){_0x45069b=_0x45069b-0x0;var _0xc78423=_0x90b5[_0x45069b];return _0xc78423;};'use strict';var client=require(_0x590b('0x0'));exports['update']=function(_0x3f8e11,_0xe39dc){return client[_0x590b('0x1')](_0x590b('0x2'),{'body':_0xe39dc,'options':{'where':{'id':_0x3f8e11}},'log':'updateWhatsappInteraction'});};exports['addTags']=function(_0x2318b8,_0x27e96f){return client['Request'](_0x590b('0x3'),{'body':_0x27e96f,'options':{'where':{'id':_0x2318b8}},'log':_0x590b('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 6c027c1..18a036c 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 _0x2c64=['Request','CreateWhatsappMessage','createWhatsappMessage','../client','create'];(function(_0xbbfe59,_0x46067f){var _0x28a2a4=function(_0xfe230){while(--_0xfe230){_0xbbfe59['push'](_0xbbfe59['shift']());}};_0x28a2a4(++_0x46067f);}(_0x2c64,0x1c0));var _0x42c6=function(_0x271060,_0x3f86b1){_0x271060=_0x271060-0x0;var _0x40540b=_0x2c64[_0x271060];return _0x40540b;};'use strict';var client=require(_0x42c6('0x0'));exports[_0x42c6('0x1')]=function(_0x44a4cb){return client[_0x42c6('0x2')](_0x42c6('0x3'),{'body':_0x44a4cb,'log':_0x42c6('0x4')});}; \ No newline at end of file +var _0x48f3=['Request','create'];(function(_0x140adf,_0x2342f8){var _0x3c1f69=function(_0x4259de){while(--_0x4259de){_0x140adf['push'](_0x140adf['shift']());}};_0x3c1f69(++_0x2342f8);}(_0x48f3,0x67));var _0x348f=function(_0x4d9716,_0x5e9a73){_0x4d9716=_0x4d9716-0x0;var _0x6a8182=_0x48f3[_0x4d9716];return _0x6a8182;};'use strict';var client=require('../client');exports[_0x348f('0x0')]=function(_0x5afa36){return client[_0x348f('0x1')]('CreateWhatsappMessage',{'body':_0x5afa36,'log':'createWhatsappMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index c143875..17e05c1 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 _0xf2f5=['GetWhatsappQueue','name','timeout','strategy','Agents','online','getWhatsappQueues','../client','Request'];(function(_0x5a79e2,_0x319b1a){var _0x266c45=function(_0x172478){while(--_0x172478){_0x5a79e2['push'](_0x5a79e2['shift']());}};_0x266c45(++_0x319b1a);}(_0xf2f5,0x1ae));var _0x5f2f=function(_0x3ec6bd,_0x1f2fa4){_0x3ec6bd=_0x3ec6bd-0x0;var _0xe7c6ad=_0xf2f5[_0x3ec6bd];return _0xe7c6ad;};'use strict';var client=require(_0x5f2f('0x0'));exports['getWhatsappQueues']=function(){return function(){return client[_0x5f2f('0x1')](_0x5f2f('0x2'),{'options':{'raw':![],'attributes':['id',_0x5f2f('0x3'),_0x5f2f('0x4'),_0x5f2f('0x5')],'include':[{'model':'User','as':_0x5f2f('0x6'),'attributes':['id',_0x5f2f('0x3'),_0x5f2f('0x7'),'whatsappPause']}]},'log':_0x5f2f('0x8')});};}; \ No newline at end of file +var _0x40d7=['GetWhatsappQueue','name','timeout','strategy','whatsappPause','getWhatsappQueues','Request'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0x40d7,0x9f));var _0x740d=function(_0x36bf88,_0x15c459){_0x36bf88=_0x36bf88-0x0;var _0x332914=_0x40d7[_0x36bf88];return _0x332914;};'use strict';var client=require('../client');exports[_0x740d('0x0')]=function(){return function(){return client[_0x740d('0x1')](_0x740d('0x2'),{'options':{'raw':![],'attributes':['id',_0x740d('0x3'),_0x740d('0x4'),_0x740d('0x5')],'include':[{'model':'User','as':'Agents','attributes':['id',_0x740d('0x3'),'online',_0x740d('0x6')]}]},'log':_0x740d('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 1b57e51..818907e 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 _0x9c4d=['create','Request','CreateWhatsappQueueReport','UpdateWhatsappQueueReport','DESC','../client'];(function(_0x3ccd5c,_0x1ee1a7){var _0x1be3e3=function(_0x25059){while(--_0x25059){_0x3ccd5c['push'](_0x3ccd5c['shift']());}};_0x1be3e3(++_0x1ee1a7);}(_0x9c4d,0x101));var _0xd9c4=function(_0x2e66d4,_0x77d266){_0x2e66d4=_0x2e66d4-0x0;var _0x302db6=_0x9c4d[_0x2e66d4];return _0x302db6;};'use strict';var client=require(_0xd9c4('0x0'));exports[_0xd9c4('0x1')]=function(_0x39e77d){return client[_0xd9c4('0x2')](_0xd9c4('0x3'),{'body':_0x39e77d,'log':'CreateWhatsappQueueReport'});};exports['update']=function(_0x38bd62,_0x582b1e){return client[_0xd9c4('0x2')](_0xd9c4('0x4'),{'body':_0x582b1e,'options':{'where':{'uniqueid':_0x38bd62},'order':[['id',_0xd9c4('0x5')]],'limit':0x1},'log':_0xd9c4('0x4')});}; \ No newline at end of file +var _0xb445=['../client','CreateWhatsappQueueReport','UpdateWhatsappQueueReport'];(function(_0x1762b4,_0x33d836){var _0x29beda=function(_0x31c2fa){while(--_0x31c2fa){_0x1762b4['push'](_0x1762b4['shift']());}};_0x29beda(++_0x33d836);}(_0xb445,0x123));var _0x5b44=function(_0x2ffc98,_0x5a0140){_0x2ffc98=_0x2ffc98-0x0;var _0x1bb50a=_0xb445[_0x2ffc98];return _0x1bb50a;};'use strict';var client=require(_0x5b44('0x0'));exports['create']=function(_0x12cb35){return client['Request'](_0x5b44('0x1'),{'body':_0x12cb35,'log':_0x5b44('0x1')});};exports['update']=function(_0x24714b,_0xc6c18a){return client['Request'](_0x5b44('0x2'),{'body':_0xc6c18a,'options':{'where':{'uniqueid':_0x24714b},'order':[['id','DESC']],'limit':0x1},'log':_0x5b44('0x2')});}; \ 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 deb7c30..22b35b9 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 _0x79b9=['close','rules','complete','[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','stop','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','../../../../config/logger','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','name','toLowerCase','consequence','length','error','map','message','join','find','agents','createQueue','atimeout','channel','format','end','[%s][AGENT]\x20ROUTING\x20STOPPED'];(function(_0x50cb46,_0x53f73a){var _0x1b557a=function(_0x55861d){while(--_0x55861d){_0x50cb46['push'](_0x50cb46['shift']());}};_0x1b557a(++_0x53f73a);}(_0x79b9,0x80));var _0x979b=function(_0x398074,_0xfe40bc){_0x398074=_0x398074-0x0;var _0x24eaa3=_0x79b9[_0x398074];return _0x24eaa3;};'use strict';var schema=require(_0x979b('0x0'));var _=require(_0x979b('0x1'));var util=require(_0x979b('0x2'));var seqqueue=require(_0x979b('0x3'));var logger=require(_0x979b('0x4'))(_0x979b('0x5'));var strategy=require(_0x979b('0x6'));var queue=schema({'name':{'type':_0x979b('0x7'),'required':!![],'message':_0x979b('0x8')},'timeout':{'type':_0x979b('0x9'),'message':_0x979b('0xa')}});function writeLog(_0x202adf,_0x1b47a4,_0x10d170){return logger[_0x979b('0xb')](util['format']('[%s][AGENT][NAME:%s][STATUS:%s]',_0x202adf,_0x1b47a4[_0x979b('0xc')],_0x10d170));}function handleFindAgent(_0x1da969){return function(_0x37b9b9){return _0x37b9b9['name'][_0x979b('0xd')]()===_0x1da969[_0x979b('0xd')]();};}exports[_0x979b('0xe')]=function(_0x5a5603,_0x43e45a,_0xcfe92d,_0x3f37ca){return function(_0x1bb6a1){try{var _0x3ee6cb={'name':_0x43e45a[0x0],'timeout':_0x43e45a[0x1]};var _0x133023=queue['validate'](_0x3ee6cb,{'typecast':!![]});if(_0x133023[_0x979b('0xf')]){logger[_0x979b('0x10')]('[%s][AGENT]\x20%s',_0x5a5603,_[_0x979b('0x11')](_0x133023,_0x979b('0x12'))[_0x979b('0x13')](',\x20'));_0x1bb6a1['stop']();}else{var _0x4aea52=_[_0x979b('0x14')](_0xcfe92d[_0x979b('0x15')],handleFindAgent(_0x3ee6cb[_0x979b('0xc')]));if(_0x4aea52){var _0x24960e=(_0x3ee6cb['timeout']||0xa)*0x3e8;var _0x3ee820,_0x3f8499;var _0xeeff31=seqqueue[_0x979b('0x16')](_0x24960e);_0xeeff31['id']=_0x5a5603;_0xeeff31[_0x979b('0x17')]=_0x24960e;_0xeeff31['channel']=_0x3f37ca[_0x979b('0x18')];writeLog(_0x5a5603,_0x4aea52,util[_0x979b('0x19')]('START:%s',_0x24960e));_0xcfe92d['rules'][_0x5a5603]['on'](_0x979b('0x1a'),function(){logger[_0x979b('0xb')](_0x979b('0x1b'),_0x5a5603);clearTimeout(_0x3f8499);_0x3f8499=undefined;_0xeeff31[_0x979b('0x1c')]();if(_0xcfe92d[_0x979b('0x1d')][_0x5a5603]){delete _0xcfe92d[_0x979b('0x1d')][_0x5a5603];}_0x1bb6a1['stop']();});_0xcfe92d['rules'][_0x5a5603]['on'](_0x979b('0x1e'),function(){if(_0xcfe92d[_0x979b('0x1d')][_0x5a5603]){delete _0xcfe92d[_0x979b('0x1d')][_0x5a5603];}});_0x3f8499=setTimeout(function(){logger[_0x979b('0xb')](_0x979b('0x1f'),_0x5a5603);clearTimeout(_0x3f8499);_0xeeff31[_0x979b('0x1c')]();_0x1bb6a1[_0x979b('0x20')]();},_0x24960e);strategy[_0x979b('0x21')](_0xeeff31,_0x4aea52,_0xcfe92d,_0x3f37ca);}else{logger[_0x979b('0x10')](_0x979b('0x22'),_0x5a5603,_0x3ee6cb[_0x979b('0xc')]);_0x1bb6a1[_0x979b('0x23')]();}}}catch(_0x3574f6){console[_0x979b('0x24')](_0x3574f6);logger[_0x979b('0x10')](_0x979b('0x25'),_0x5a5603,_0x3574f6[_0x979b('0x26')]);_0x1bb6a1[_0x979b('0x23')]();}};}; \ No newline at end of file +var _0x1d71=['name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','[%s][AGENT]\x20%s','map','message','find','agents','createQueue','atimeout','channel','rules','end','info','[%s][AGENT]\x20ROUTING\x20STOPPED','close','stop','complete','[%s][AGENT]\x20ROUTING\x20END','next','agent','error','[%s][AGENT]\x20agent\x20not\x20found\x20%s','[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','../../../../config/logger','string'];(function(_0x3473ce,_0x50d5a6){var _0x5ead38=function(_0x3ccc74){while(--_0x3ccc74){_0x3473ce['push'](_0x3473ce['shift']());}};_0x5ead38(++_0x50d5a6);}(_0x1d71,0x8e));var _0x11d7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1d71[_0x3dd15e];return _0x231fd0;};'use strict';var schema=require(_0x11d7('0x0'));var _=require(_0x11d7('0x1'));var util=require(_0x11d7('0x2'));var seqqueue=require(_0x11d7('0x3'));var logger=require(_0x11d7('0x4'))('routing');var strategy=require('./strategy');var queue=schema({'name':{'type':_0x11d7('0x5'),'required':!![],'message':_0x11d7('0x6')},'timeout':{'type':_0x11d7('0x7'),'message':_0x11d7('0x8')}});function writeLog(_0x3969f6,_0x37697b,_0x344ee6){return logger['info'](util[_0x11d7('0x9')](_0x11d7('0xa'),_0x3969f6,_0x37697b['name'],_0x344ee6));}function handleFindAgent(_0x25adc1){return function(_0x54e587){return _0x54e587[_0x11d7('0xb')][_0x11d7('0xc')]()===_0x25adc1[_0x11d7('0xc')]();};}exports[_0x11d7('0xd')]=function(_0x3bf5e8,_0x16af23,_0x34b547,_0x1e05ba){return function(_0x4b1be1){try{var _0x35809e={'name':_0x16af23[0x0],'timeout':_0x16af23[0x1]};var _0x5b9de2=queue['validate'](_0x35809e,{'typecast':!![]});if(_0x5b9de2[_0x11d7('0xe')]){logger['error'](_0x11d7('0xf'),_0x3bf5e8,_[_0x11d7('0x10')](_0x5b9de2,_0x11d7('0x11'))['join'](',\x20'));_0x4b1be1['stop']();}else{var _0x5d3aeb=_[_0x11d7('0x12')](_0x34b547[_0x11d7('0x13')],handleFindAgent(_0x35809e[_0x11d7('0xb')]));if(_0x5d3aeb){var _0x4e1189=(_0x35809e['timeout']||0xa)*0x3e8;var _0x2ade6b,_0x58c702;var _0x787643=seqqueue[_0x11d7('0x14')](_0x4e1189);_0x787643['id']=_0x3bf5e8;_0x787643[_0x11d7('0x15')]=_0x4e1189;_0x787643[_0x11d7('0x16')]=_0x1e05ba[_0x11d7('0x16')];writeLog(_0x3bf5e8,_0x5d3aeb,util[_0x11d7('0x9')]('START:%s',_0x4e1189));_0x34b547[_0x11d7('0x17')][_0x3bf5e8]['on'](_0x11d7('0x18'),function(){logger[_0x11d7('0x19')](_0x11d7('0x1a'),_0x3bf5e8);clearTimeout(_0x58c702);_0x58c702=undefined;_0x787643[_0x11d7('0x1b')]();if(_0x34b547[_0x11d7('0x17')][_0x3bf5e8]){delete _0x34b547['rules'][_0x3bf5e8];}_0x4b1be1[_0x11d7('0x1c')]();});_0x34b547[_0x11d7('0x17')][_0x3bf5e8]['on'](_0x11d7('0x1d'),function(){if(_0x34b547[_0x11d7('0x17')][_0x3bf5e8]){delete _0x34b547[_0x11d7('0x17')][_0x3bf5e8];}});_0x58c702=setTimeout(function(){logger['info'](_0x11d7('0x1e'),_0x3bf5e8);clearTimeout(_0x58c702);_0x787643[_0x11d7('0x1b')]();_0x4b1be1[_0x11d7('0x1f')]();},_0x4e1189);strategy[_0x11d7('0x20')](_0x787643,_0x5d3aeb,_0x34b547,_0x1e05ba);}else{logger[_0x11d7('0x21')](_0x11d7('0x22'),_0x3bf5e8,_0x35809e[_0x11d7('0xb')]);_0x4b1be1[_0x11d7('0x1c')]();}}}catch(_0x537295){console['log'](_0x537295);logger[_0x11d7('0x21')](_0x11d7('0x23'),_0x3bf5e8,_0x537295[_0x11d7('0x24')]);_0x4b1be1[_0x11d7('0x1c')]();}};}; \ 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 6b380c0..12406b6 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 _0x3994=['created','body','Message','create','then','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','LexRuntime','$LATEST','message','toString','postText','amazonlex','providerName','providerResponse','dialogState','moment','aws-sdk','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','ChatWebsiteId','account','upperFirst','AccountId','InteractionId'];(function(_0xb5b82,_0x4db39e){var _0x569fd2=function(_0x15ad12){while(--_0x15ad12){_0xb5b82['push'](_0xb5b82['shift']());}};_0x569fd2(++_0x4db39e);}(_0x3994,0x1df));var _0x4399=function(_0x4d3a8f,_0x1d002e){_0x4d3a8f=_0x4d3a8f-0x0;var _0x3f8a09=_0x3994[_0x4d3a8f];return _0x3f8a09;};'use strict';var _=require('lodash');var moment=require(_0x4399('0x0'));var AWS=require(_0x4399('0x1'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0x4399('0x2'));var rpc={'chatMessage':require(_0x4399('0x3')),'openchannelMessage':require(_0x4399('0x4')),'mailMessage':require(_0x4399('0x5')),'smsMessage':require(_0x4399('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x4399('0x7'))};exports[_0x4399('0x8')]=function(_0x2174f0,_0x206591){return function(_0x53be14){try{if(!_['isNil'](this[_0x4399('0x9')][_0x4399('0xa')])){logger[_0x4399('0xb')](_0x4399('0xc'),_0x2174f0,_0x4399('0xd'));return _0x53be14[_0x4399('0xe')]();}var _0x3dbff8={'ContactId':this['contact']['id'],'sentAt':moment()[_0x4399('0xf')](_0x4399('0x10')),'direction':_0x4399('0x11')};if(this[_0x4399('0x12')]===_0x4399('0x13')||this[_0x4399('0x12')]===_0x4399('0x14')){_0x3dbff8[_0x4399('0x15')]=this[_0x4399('0x9')][_0x4399('0x15')];}var _0x109b04=this[_0x4399('0x12')];if(_0x109b04==='chat'){_0x3dbff8[_0x4399('0x16')]=this[_0x4399('0x17')]['id'];}else{_0x3dbff8[_[_0x4399('0x18')](_0x109b04)+_0x4399('0x19')]=this[_0x4399('0x17')]['id'];}_0x3dbff8[_[_0x4399('0x18')](_0x109b04)+_0x4399('0x1a')]=this['interaction']['id'];if(this[_0x4399('0x9')][_0x4399('0x1b')]){var _0x3497ed=_0x206591[0x4];if(!_['isEmpty'](_0x3497ed)){_0x3dbff8[_0x4399('0x1c')]=utils['getMustacheRender'](_0x3497ed,this);return rpc[_0x109b04+_0x4399('0x1d')][_0x4399('0x1e')](_0x3dbff8)[_0x4399('0x1f')](function(_0x3050c4){logger[_0x4399('0xb')]('[%s][AMAZONLEX]\x20%s',_0x2174f0,_0x3dbff8[_0x4399('0x1c')]);})['catch'](function(_0x45af22){logger[_0x4399('0x20')](_0x4399('0xc'),_0x2174f0,JSON[_0x4399('0x21')](_0x45af22));})[_0x4399('0x22')](function(){logger[_0x4399('0xb')](_0x4399('0x23'),_0x2174f0);_0x53be14[_0x4399('0x24')]();});}else{logger[_0x4399('0xb')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x2174f0);_0x53be14[_0x4399('0x24')]();}}else{var _0x280578=this;var _0x341af8=new AWS[(_0x4399('0x25'))]({'accessKeyId':_0x206591[0x0],'secretAccessKey':_0x206591[0x1],'region':_0x206591[0x2]});var _0xf4fd5e={'botAlias':_0x4399('0x26'),'botName':_0x206591[0x3],'inputText':this[_0x4399('0x27')]['body'],'userId':this[_0x4399('0x12')]+':'+this[_0x4399('0x9')]['id'][_0x4399('0x28')]()};_0x341af8[_0x4399('0x29')](_0xf4fd5e,function(_0x46414f,_0x5e2f3f){if(_0x46414f){logger[_0x4399('0x20')](_0x4399('0xc'),_0x2174f0,_0x46414f[_0x4399('0x27')]);_0x53be14['next']();}else if(_0x5e2f3f&&_0x5e2f3f['message']){_0x280578['body'][_0x4399('0x2a')]=_0x5e2f3f;_0x3dbff8[_0x4399('0x1c')]=_0x5e2f3f[_0x4399('0x27')];_0x3dbff8[_0x4399('0x2b')]=_0x4399('0x2a');_0x3dbff8[_0x4399('0x2c')]=JSON[_0x4399('0x21')](_0x5e2f3f);return rpc[_0x109b04+_0x4399('0x1d')]['create'](_0x3dbff8)[_0x4399('0x1f')](function(_0x59700f){logger[_0x4399('0xb')](_0x4399('0xc'),_0x2174f0,_0x3dbff8[_0x4399('0x1c')]);if(_0x5e2f3f[_0x4399('0x2d')]=='Failed'){_0x53be14[_0x4399('0xe')]();}else{_0x53be14[_0x4399('0x24')]();}})['catch'](function(_0x407be3){logger[_0x4399('0x20')](_0x4399('0xc'),_0x2174f0,JSON[_0x4399('0x21')](_0x407be3));_0x53be14['next']();});}else{_0x53be14[_0x4399('0xe')]();}});}}catch(_0x438b0b){logger['error'](_0x4399('0xc'),_0x2174f0,JSON[_0x4399('0x21')](_0x438b0b));_0x53be14[_0x4399('0x24')]();}};}; \ No newline at end of file +var _0xc1d1=['moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','isNil','interaction','[%s][AMAZONLEX]\x20%s','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','body','getMustacheRender','create','then','info','catch','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','toString','postText','amazonlex','Message','Failed','lodash'];(function(_0x736eb,_0x345088){var _0x30ea13=function(_0xbdab7c){while(--_0xbdab7c){_0x736eb['push'](_0x736eb['shift']());}};_0x30ea13(++_0x345088);}(_0xc1d1,0x197));var _0x1c1d=function(_0x3750ff,_0x3c185d){_0x3750ff=_0x3750ff-0x0;var _0x483cce=_0xc1d1[_0x3750ff];return _0x483cce;};'use strict';var _=require(_0x1c1d('0x0'));var moment=require(_0x1c1d('0x1'));var AWS=require('aws-sdk');var utils=require(_0x1c1d('0x2'));var logger=require(_0x1c1d('0x3'))(_0x1c1d('0x4'));var rpc={'chatMessage':require(_0x1c1d('0x5')),'openchannelMessage':require(_0x1c1d('0x6')),'mailMessage':require(_0x1c1d('0x7')),'smsMessage':require(_0x1c1d('0x8')),'faxMessage':require(_0x1c1d('0x9')),'whatsappMessage':require(_0x1c1d('0xa'))};exports['consequence']=function(_0x46682c,_0x317c0c){return function(_0xddceb0){try{if(!_[_0x1c1d('0xb')](this[_0x1c1d('0xc')]['UserId'])){logger['info'](_0x1c1d('0xd'),_0x46682c,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0xddceb0[_0x1c1d('0xe')]();}var _0x57f825={'ContactId':this[_0x1c1d('0xf')]['id'],'sentAt':moment()[_0x1c1d('0x10')](_0x1c1d('0x11')),'direction':_0x1c1d('0x12')};if(this[_0x1c1d('0x13')]===_0x1c1d('0x14')||this[_0x1c1d('0x13')]===_0x1c1d('0x15')){_0x57f825[_0x1c1d('0x16')]=this[_0x1c1d('0xc')][_0x1c1d('0x16')];}var _0x495967=this[_0x1c1d('0x13')];if(_0x495967===_0x1c1d('0x17')){_0x57f825[_0x1c1d('0x18')]=this[_0x1c1d('0x19')]['id'];}else{_0x57f825[_[_0x1c1d('0x1a')](_0x495967)+_0x1c1d('0x1b')]=this[_0x1c1d('0x19')]['id'];}_0x57f825[_[_0x1c1d('0x1a')](_0x495967)+_0x1c1d('0x1c')]=this[_0x1c1d('0xc')]['id'];if(this[_0x1c1d('0xc')][_0x1c1d('0x1d')]){var _0x46b5e2=_0x317c0c[0x4];if(!_[_0x1c1d('0x1e')](_0x46b5e2)){_0x57f825[_0x1c1d('0x1f')]=utils[_0x1c1d('0x20')](_0x46b5e2,this);return rpc[_0x495967+'Message'][_0x1c1d('0x21')](_0x57f825)[_0x1c1d('0x22')](function(_0x2bfca9){logger[_0x1c1d('0x23')](_0x1c1d('0xd'),_0x46682c,_0x57f825['body']);})[_0x1c1d('0x24')](function(_0xf7be5c){logger[_0x1c1d('0x25')](_0x1c1d('0xd'),_0x46682c,JSON[_0x1c1d('0x26')](_0xf7be5c));})[_0x1c1d('0x27')](function(){logger[_0x1c1d('0x23')](_0x1c1d('0x28'),_0x46682c);_0xddceb0[_0x1c1d('0x29')]();});}else{logger[_0x1c1d('0x23')](_0x1c1d('0x2a'),_0x46682c);_0xddceb0[_0x1c1d('0x29')]();}}else{var _0x25e872=this;var _0x396388=new AWS[(_0x1c1d('0x2b'))]({'accessKeyId':_0x317c0c[0x0],'secretAccessKey':_0x317c0c[0x1],'region':_0x317c0c[0x2]});var _0x4d5ff9={'botAlias':_0x1c1d('0x2c'),'botName':_0x317c0c[0x3],'inputText':this[_0x1c1d('0x2d')]['body'],'userId':this[_0x1c1d('0x13')]+':'+this[_0x1c1d('0xc')]['id'][_0x1c1d('0x2e')]()};_0x396388[_0x1c1d('0x2f')](_0x4d5ff9,function(_0x6adc3d,_0x336821){if(_0x6adc3d){logger[_0x1c1d('0x25')](_0x1c1d('0xd'),_0x46682c,_0x6adc3d[_0x1c1d('0x2d')]);_0xddceb0['next']();}else if(_0x336821&&_0x336821[_0x1c1d('0x2d')]){_0x25e872['body'][_0x1c1d('0x30')]=_0x336821;_0x57f825[_0x1c1d('0x1f')]=_0x336821[_0x1c1d('0x2d')];_0x57f825['providerName']=_0x1c1d('0x30');_0x57f825['providerResponse']=JSON['stringify'](_0x336821);return rpc[_0x495967+_0x1c1d('0x31')][_0x1c1d('0x21')](_0x57f825)[_0x1c1d('0x22')](function(_0x17173a){logger[_0x1c1d('0x23')](_0x1c1d('0xd'),_0x46682c,_0x57f825[_0x1c1d('0x1f')]);if(_0x336821['dialogState']==_0x1c1d('0x32')){_0xddceb0[_0x1c1d('0xe')]();}else{_0xddceb0[_0x1c1d('0x29')]();}})[_0x1c1d('0x24')](function(_0x51cd5b){logger[_0x1c1d('0x25')](_0x1c1d('0xd'),_0x46682c,JSON[_0x1c1d('0x26')](_0x51cd5b));_0xddceb0[_0x1c1d('0xe')]();});}else{_0xddceb0[_0x1c1d('0xe')]();}});}}catch(_0x594257){logger[_0x1c1d('0x25')](_0x1c1d('0xd'),_0x46682c,JSON[_0x1c1d('0x26')](_0x594257));_0xddceb0[_0x1c1d('0x29')]();}};}; \ 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 d88bd5e..690d915 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 _0x438f=['Re:\x20','ChatWebsiteId','AccountId','upperFirst','Message','inReplyTo','html','','replace','','auto-replied','All','auto_reply','sendMailMessage','smtpOptions','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','Interaction','update','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','moment','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','channel','mail','body','isAutoreply','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','interaction','created','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','format','getMustacheRender','message','from','phone','read','subject','startsWith','Re:'];(function(_0x10fb99,_0x19ad74){var _0x16ace7=function(_0x39343c){while(--_0x39343c){_0x10fb99['push'](_0x10fb99['shift']());}};_0x16ace7(++_0x19ad74);}(_0x438f,0x12d));var _0xf438=function(_0x208c01,_0x2dd63d){_0x208c01=_0x208c01-0x0;var _0x54a5fc=_0x438f[_0x208c01];return _0x54a5fc;};'use strict';var _=require('lodash');var moment=require(_0xf438('0x0'));var utils=require('./utils');var logger=require(_0xf438('0x1'))(_0xf438('0x2'));var rpc={'chatMessage':require(_0xf438('0x3')),'openchannelMessage':require(_0xf438('0x4')),'mailMessage':require(_0xf438('0x5')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xf438('0x6')),'whatsappMessage':require('../../rpc/whatsappMessage'),'chatInteraction':require(_0xf438('0x7')),'openchannelInteraction':require(_0xf438('0x8')),'mailInteraction':require(_0xf438('0x9')),'smsInteraction':require(_0xf438('0xa')),'faxInteraction':require(_0xf438('0xb')),'whatsappInteraction':require(_0xf438('0xc'))};var mailRpc=require(_0xf438('0xd'));exports[_0xf438('0xe')]=function(_0x2ea433,_0x1aec13,_0x2bfed1,_0x1736f6){return function(_0x26283e){try{var _0x57f4b5=this[_0xf438('0xf')];if(_0x57f4b5===_0xf438('0x10')&&_0x1736f6[_0xf438('0x11')][_0xf438('0x12')]){logger[_0xf438('0x13')](_0xf438('0x14'),_0x2ea433,_0xf438('0x15'));return _0x26283e[_0xf438('0x16')]();}if(_0x1aec13[0x0]==='1'&&(_[_0xf438('0x17')](this[_0xf438('0x18')][_0xf438('0x19')])||!this[_0xf438('0x18')][_0xf438('0x19')])){logger['info'](_0xf438('0x14'),_0x2ea433,'Autoreply\x20already\x20sent');return _0x26283e[_0xf438('0x16')]();}if(_0x1aec13[0x0]==='2'&&this['interaction'][_0xf438('0x1a')]){logger[_0xf438('0x13')](_0xf438('0x1b'),_0x2ea433,_0xf438('0x1c'));return _0x26283e['next']();}var _0x5d1cae={'ContactId':this[_0xf438('0x1d')]['id'],'sentAt':moment()[_0xf438('0x1e')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':'out'};if(this[_0xf438('0xf')]===_0xf438('0x10')){_0x5d1cae[_0xf438('0x11')]=utils[_0xf438('0x1f')](_0x1aec13[0x2],this);}else{_0x5d1cae[_0xf438('0x11')]=utils[_0xf438('0x1f')](_0x1aec13[0x1],this);}if(this[_0xf438('0x20')]){_0x5d1cae['to']=this[_0xf438('0x20')][_0xf438('0x21')]||'';if(this[_0xf438('0xf')]===_0xf438('0x10')&&_0x1aec13[0x1]==='1'){_0x5d1cae['cc']=this['message']['cc']||'';}_0x5d1cae[_0xf438('0x21')]=this[_0xf438('0x20')]['to']||'';_0x5d1cae[_0xf438('0x22')]=this[_0xf438('0x20')]['phone']||'';_0x5d1cae[_0xf438('0x23')]=!![];if(this[_0xf438('0x20')][_0xf438('0x24')]){_0x5d1cae[_0xf438('0x24')]='';_0x5d1cae['subject']+=_[_0xf438('0x25')](this[_0xf438('0x20')][_0xf438('0x24')],_0xf438('0x26'))?'':_0xf438('0x27');_0x5d1cae[_0xf438('0x24')]+=this[_0xf438('0x20')][_0xf438('0x24')];}}if(this[_0xf438('0xf')]==='chat'){_0x5d1cae[_0xf438('0x28')]=this['account']['id'];}else{_0x5d1cae[_['upperFirst'](this[_0xf438('0xf')])+_0xf438('0x29')]=this['account']['id'];}_0x5d1cae[_[_0xf438('0x2a')](this[_0xf438('0xf')])+'InteractionId']=this[_0xf438('0x18')]['id'];var _0x2ca32c=this[_0xf438('0x18')];if(rpc[this['channel']+_0xf438('0x2b')]){if(this[_0xf438('0xf')]===_0xf438('0x10')){_0x5d1cae[_0xf438('0x2c')]=this[_0xf438('0x20')]['messageId'];_0x5d1cae[_0xf438('0x2d')]=_0xf438('0x2e')+_[_0xf438('0x2f')](_0x5d1cae[_0xf438('0x11')],_0xf438('0x30'),_0xf438('0x31'))+_0xf438('0x32');_0x5d1cae['headers']={'Auto-Submitted':_0xf438('0x33'),'X-Auto-Response-Suppress':_0xf438('0x34'),'Precedence':_0xf438('0x35')};return mailRpc[_0xf438('0x36')](this['account'][_0xf438('0x37')],_0x5d1cae)[_0xf438('0x38')](function(_0xf0e33a){logger[_0xf438('0x13')](_0xf438('0x39'),_0x2ea433);_0x5d1cae['messageId']=_0xf0e33a[_0xf438('0x20')]['messageId'];return rpc[_0x57f4b5+_0xf438('0x2b')][_0xf438('0x3a')](_0x5d1cae);})['then'](function(_0x235a6d){logger[_0xf438('0x13')](_0xf438('0x14'),_0x2ea433,JSON[_0xf438('0x3b')](_0x235a6d));})[_0xf438('0x3c')](function(_0x228197){logger[_0xf438('0x3d')](_0xf438('0x3e'),_0x2ea433,JSON['stringify'](_0x228197));})[_0xf438('0x3f')](function(){Promise[_0xf438('0x40')]()[_0xf438('0x38')](function(){if(_0x1aec13[0x0]!=='2'||_0x2ca32c[_0xf438('0x1a')])return;return rpc[_0x57f4b5+_0xf438('0x41')][_0xf438('0x42')](_0x2ca32c['id'],{'autoreplyExecuted':!![]})[_0xf438('0x38')](function(_0xb8d737){logger[_0xf438('0x13')](_0xf438('0x1b'),_0x2ea433,JSON[_0xf438('0x3b')](_0xb8d737));})[_0xf438('0x3c')](function(_0x527366){logger[_0xf438('0x3d')](_0xf438('0x43'),_0x2ea433,JSON['stringify'](_0x527366));});})[_0xf438('0x38')](function(){_0x26283e['next']();});});}else{return rpc[this[_0xf438('0xf')]+'Message'][_0xf438('0x3a')](_0x5d1cae)['then'](function(){logger[_0xf438('0x13')]('[%s][AUTOREPLY]\x20%s',_0x2ea433,_0x5d1cae[_0xf438('0x11')]);})[_0xf438('0x3c')](function(_0x28de5d){logger['error'](_0xf438('0x14'),_0x2ea433,JSON[_0xf438('0x3b')](_0x28de5d));})[_0xf438('0x3f')](function(){Promise[_0xf438('0x40')]()['then'](function(){if(_0x1aec13[0x0]!=='2'||_0x2ca32c['autoreplyExecuted'])return;return rpc[_0x57f4b5+'Interaction'][_0xf438('0x42')](_0x2ca32c['id'],{'autoreplyExecuted':!![]})[_0xf438('0x38')](function(_0xfffe11){logger[_0xf438('0x13')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x2ea433,JSON[_0xf438('0x3b')](_0xfffe11));})[_0xf438('0x3c')](function(_0x3272e9){logger['error'](_0xf438('0x43'),_0x2ea433,JSON[_0xf438('0x3b')](_0x3272e9));});})['then'](function(){_0x26283e['next']();});});}}}catch(_0x3d114a){logger[_0xf438('0x3d')](_0xf438('0x14'),_0x2ea433,JSON[_0xf438('0x3b')](_0x3d114a));_0x26283e['stop']();}};}; \ No newline at end of file +var _0x2e64=['Re:','Re:\x20','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','Message','inReplyTo','messageId','','replace','','headers','auto-replied','All','auto_reply','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','Interaction','update','stringify','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','stop','lodash','moment','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','channel','mail','body','isAutoreply','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','isNil','interaction','created','info','Autoreply\x20already\x20sent','next','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','getMustacheRender','message','from','read','subject','startsWith'];(function(_0x1cb18a,_0x33167a){var _0x22442e=function(_0x46c611){while(--_0x46c611){_0x1cb18a['push'](_0x1cb18a['shift']());}};_0x22442e(++_0x33167a);}(_0x2e64,0xef));var _0x42e6=function(_0x2a4676,_0x48d9ec){_0x2a4676=_0x2a4676-0x0;var _0x46ffd4=_0x2e64[_0x2a4676];return _0x46ffd4;};'use strict';var _=require(_0x42e6('0x0'));var moment=require(_0x42e6('0x1'));var utils=require('./utils');var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require(_0x42e6('0x2')),'openchannelMessage':require(_0x42e6('0x3')),'mailMessage':require(_0x42e6('0x4')),'smsMessage':require(_0x42e6('0x5')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x42e6('0x6')),'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x42e6('0x7')),'mailInteraction':require('../../rpc/mailInteraction'),'smsInteraction':require(_0x42e6('0x8')),'faxInteraction':require(_0x42e6('0x9')),'whatsappInteraction':require(_0x42e6('0xa'))};var mailRpc=require(_0x42e6('0xb'));exports[_0x42e6('0xc')]=function(_0x552393,_0x31abf1,_0x50eac7,_0x50ae5e){return function(_0x24b6ee){try{var _0x193aae=this[_0x42e6('0xd')];if(_0x193aae===_0x42e6('0xe')&&_0x50ae5e[_0x42e6('0xf')][_0x42e6('0x10')]){logger['info'](_0x42e6('0x11'),_0x552393,_0x42e6('0x12'));return _0x24b6ee['next']();}if(_0x31abf1[0x0]==='1'&&(_[_0x42e6('0x13')](this[_0x42e6('0x14')][_0x42e6('0x15')])||!this[_0x42e6('0x14')][_0x42e6('0x15')])){logger[_0x42e6('0x16')](_0x42e6('0x11'),_0x552393,_0x42e6('0x17'));return _0x24b6ee[_0x42e6('0x18')]();}if(_0x31abf1[0x0]==='2'&&this['interaction'][_0x42e6('0x19')]){logger[_0x42e6('0x16')](_0x42e6('0x1a'),_0x552393,'One\x20Time\x20already\x20sent');return _0x24b6ee['next']();}var _0x2d97b7={'ContactId':this[_0x42e6('0x1b')]['id'],'sentAt':moment()[_0x42e6('0x1c')](_0x42e6('0x1d')),'direction':_0x42e6('0x1e')};if(this[_0x42e6('0xd')]===_0x42e6('0xe')){_0x2d97b7[_0x42e6('0xf')]=utils[_0x42e6('0x1f')](_0x31abf1[0x2],this);}else{_0x2d97b7['body']=utils[_0x42e6('0x1f')](_0x31abf1[0x1],this);}if(this[_0x42e6('0x20')]){_0x2d97b7['to']=this[_0x42e6('0x20')][_0x42e6('0x21')]||'';if(this[_0x42e6('0xd')]===_0x42e6('0xe')&&_0x31abf1[0x1]==='1'){_0x2d97b7['cc']=this['message']['cc']||'';}_0x2d97b7['from']=this[_0x42e6('0x20')]['to']||'';_0x2d97b7['phone']=this[_0x42e6('0x20')]['phone']||'';_0x2d97b7[_0x42e6('0x22')]=!![];if(this[_0x42e6('0x20')][_0x42e6('0x23')]){_0x2d97b7[_0x42e6('0x23')]='';_0x2d97b7[_0x42e6('0x23')]+=_[_0x42e6('0x24')](this[_0x42e6('0x20')][_0x42e6('0x23')],_0x42e6('0x25'))?'':_0x42e6('0x26');_0x2d97b7[_0x42e6('0x23')]+=this[_0x42e6('0x20')]['subject'];}}if(this[_0x42e6('0xd')]===_0x42e6('0x27')){_0x2d97b7[_0x42e6('0x28')]=this[_0x42e6('0x29')]['id'];}else{_0x2d97b7[_[_0x42e6('0x2a')](this['channel'])+_0x42e6('0x2b')]=this['account']['id'];}_0x2d97b7[_[_0x42e6('0x2a')](this[_0x42e6('0xd')])+_0x42e6('0x2c')]=this[_0x42e6('0x14')]['id'];var _0x2c6f37=this[_0x42e6('0x14')];if(rpc[this[_0x42e6('0xd')]+_0x42e6('0x2d')]){if(this[_0x42e6('0xd')]===_0x42e6('0xe')){_0x2d97b7[_0x42e6('0x2e')]=this[_0x42e6('0x20')][_0x42e6('0x2f')];_0x2d97b7['html']=_0x42e6('0x30')+_[_0x42e6('0x31')](_0x2d97b7[_0x42e6('0xf')],_0x42e6('0x32'),']+(>|$)/g,''),'priorityTrue':_0x12d1f7[0x1],'priorityFalse':_0x12d1f7[0x2]};var _0x387d1f=gotoif[_0x32b0('0x0')](_0x528e53,{'typecast':!![]});if(_0x387d1f['length']){logger[_0x32b0('0xc')](_0x32b0('0xd'),_0x584937,_[_0x32b0('0xe')](_0x387d1f,_0x32b0('0xf'))[_0x32b0('0x10')](',\x20'));_0x71d299[_0x32b0('0x11')]();}else{try{var _0x4eb408=eval('('+_0x528e53[_0x32b0('0x12')]+')');var _0x28e76a=_0x4eb408?_0x528e53[_0x32b0('0x13')]:_0x528e53['priorityFalse'];logger[_0x32b0('0x14')](_0x32b0('0x15'),_0x584937,_0x528e53['condition'],_0x4eb408,_0x28e76a||_0x32b0('0x16'));if(_0x28e76a){var _0x887784=_[_0x32b0('0x17')](_0x71d299['rules'](),{'p':_0x28e76a});if(_0x887784>=0x0){logger[_0x32b0('0x14')](_0x32b0('0x18'),_0x584937,_0x28e76a||_0x32b0('0x16'),_0x887784);_0x71d299[_0x32b0('0x16')](_0x887784);}else{logger[_0x32b0('0x14')](_0x32b0('0x19'),_0x584937,_0x28e76a||_0x32b0('0x16'));_0x71d299[_0x32b0('0x11')]();}}else{_0x71d299[_0x32b0('0x16')]();}}catch(_0x5b1eb5){logger[_0x32b0('0xc')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x584937,_0x5b1eb5['message']);_0x71d299[_0x32b0('0x11')]();}}}catch(_0x489762){logger[_0x32b0('0xc')](_0x32b0('0xd'),_0x584937,JSON['stringify'](_0x489762));_0x71d299[_0x32b0('0x11')]();}};}; \ No newline at end of file +var _0x0c76=['getMustacheRender','replace','validate','length','error','[%s][GOTOIF]\x20%s','map','message','join','stop','condition','priorityTrue','priorityFalse','info','[%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','stringify','lodash','html-to-text','./utils','routing','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','consequence','fromString'];(function(_0x48b122,_0x2e66d2){var _0x5f573a=function(_0x3b0901){while(--_0x3b0901){_0x48b122['push'](_0x48b122['shift']());}};_0x5f573a(++_0x2e66d2);}(_0x0c76,0x1b9));var _0x60c7=function(_0x3cfdfe,_0x264ba4){_0x3cfdfe=_0x3cfdfe-0x0;var _0x2f04f2=_0x0c76[_0x3cfdfe];return _0x2f04f2;};'use strict';var schema=require('validate');var _=require(_0x60c7('0x0'));var htmlToText=require(_0x60c7('0x1'));var utils=require(_0x60c7('0x2'));var logger=require('../../../../config/logger')(_0x60c7('0x3'));var gotoif=schema({'condition':{'type':'string','required':!![],'message':_0x60c7('0x4')},'priorityTrue':{'type':_0x60c7('0x5'),'message':_0x60c7('0x6')},'priorityFalse':{'type':'number','message':'priority\x20false\x20is\x20a\x20number'}});exports[_0x60c7('0x7')]=function(_0x59b81d,_0x57e680){return function(_0x3da889){try{var _0x1665de={'condition':htmlToText[_0x60c7('0x8')](utils[_0x60c7('0x9')](_0x57e680[0x0],this),{'wordwrap':![]})[_0x60c7('0xa')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x57e680[0x1],'priorityFalse':_0x57e680[0x2]};var _0x1a1444=gotoif[_0x60c7('0xb')](_0x1665de,{'typecast':!![]});if(_0x1a1444[_0x60c7('0xc')]){logger[_0x60c7('0xd')](_0x60c7('0xe'),_0x59b81d,_[_0x60c7('0xf')](_0x1a1444,_0x60c7('0x10'))[_0x60c7('0x11')](',\x20'));_0x3da889[_0x60c7('0x12')]();}else{try{var _0x88d75=eval('('+_0x1665de[_0x60c7('0x13')]+')');var _0x1b69d5=_0x88d75?_0x1665de[_0x60c7('0x14')]:_0x1665de[_0x60c7('0x15')];logger[_0x60c7('0x16')](_0x60c7('0x17'),_0x59b81d,_0x1665de[_0x60c7('0x13')],_0x88d75,_0x1b69d5||_0x60c7('0x18'));if(_0x1b69d5){var _0x3fc4eb=_[_0x60c7('0x19')](_0x3da889[_0x60c7('0x1a')](),{'p':_0x1b69d5});if(_0x3fc4eb>=0x0){logger[_0x60c7('0x16')](_0x60c7('0x1b'),_0x59b81d,_0x1b69d5||_0x60c7('0x18'),_0x3fc4eb);_0x3da889[_0x60c7('0x18')](_0x3fc4eb);}else{logger[_0x60c7('0x16')](_0x60c7('0x1c'),_0x59b81d,_0x1b69d5||_0x60c7('0x18'));_0x3da889['stop']();}}else{_0x3da889['next']();}}catch(_0x4c774d){logger[_0x60c7('0xd')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x59b81d,_0x4c774d[_0x60c7('0x10')]);_0x3da889[_0x60c7('0x12')]();}}}catch(_0x56a501){logger['error']('[%s][GOTOIF]\x20%s',_0x59b81d,JSON[_0x60c7('0x1d')](_0x56a501));_0x3da889[_0x60c7('0x12')]();}};}; \ 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 85149a9..b9b499b 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 _0x9cb2=['number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','error','map','message','stop','info','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','lodash','routing'];(function(_0x3a3b25,_0x1abcfa){var _0x158995=function(_0x4fd583){while(--_0x4fd583){_0x3a3b25['push'](_0x3a3b25['shift']());}};_0x158995(++_0x1abcfa);}(_0x9cb2,0x189));var _0x29cb=function(_0x1fd2ff,_0x2fa341){_0x1fd2ff=_0x1fd2ff-0x0;var _0x740288=_0x9cb2[_0x1fd2ff];return _0x740288;};'use strict';var schema=require(_0x29cb('0x0'));var _=require(_0x29cb('0x1'));var logger=require('../../../../config/logger')(_0x29cb('0x2'));var gotop=schema({'priority':{'type':_0x29cb('0x3'),'required':!![],'message':_0x29cb('0x4')}});exports[_0x29cb('0x5')]=function(_0x5644dc,_0x2eefb2){return function(_0x1122e8){try{var _0x50ba96={'priority':_0x2eefb2[0x0]};var _0x35d1db=gotop[_0x29cb('0x0')](_0x50ba96,{'typecast':!![]});if(_0x35d1db['length']){logger[_0x29cb('0x6')]('[%s][GOTOP]\x20%s',_0x5644dc,_[_0x29cb('0x7')](_0x35d1db,_0x29cb('0x8'))['join'](',\x20'));_0x1122e8[_0x29cb('0x9')]();}else{logger[_0x29cb('0xa')]('[%s][GOTOP]\x20priority\x20%s',_0x5644dc,_0x50ba96[_0x29cb('0xb')]);if(_0x50ba96[_0x29cb('0xb')]){var _0x42ca64=_[_0x29cb('0xc')](_0x1122e8[_0x29cb('0xd')](),{'p':_0x50ba96[_0x29cb('0xb')]});if(_0x42ca64>=0x0){logger[_0x29cb('0xa')](_0x29cb('0xe'),_0x5644dc,_0x50ba96[_0x29cb('0xb')]||_0x29cb('0xf'),_0x42ca64);_0x1122e8['next'](_0x42ca64);}else{logger[_0x29cb('0xa')](_0x29cb('0x10'),_0x5644dc,_0x50ba96[_0x29cb('0xb')]||'next');_0x1122e8[_0x29cb('0x9')]();}}else{_0x1122e8[_0x29cb('0xf')]();}}}catch(_0x13dcab){logger[_0x29cb('0x6')]('[%s][GOTOP]\x20%s',_0x5644dc,JSON[_0x29cb('0x11')](_0x13dcab));_0x1122e8[_0x29cb('0x9')]();}};}; \ No newline at end of file +var _0x70fa=['stop','info','priority','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','lodash','../../../../config/logger','routing','number','consequence','error','[%s][GOTOP]\x20%s','map','message','join'];(function(_0x17ef11,_0x41e000){var _0x2e5fee=function(_0x3adcbe){while(--_0x3adcbe){_0x17ef11['push'](_0x17ef11['shift']());}};_0x2e5fee(++_0x41e000);}(_0x70fa,0xb3));var _0xa70f=function(_0x3f0d76,_0x378fed){_0x3f0d76=_0x3f0d76-0x0;var _0x12c12e=_0x70fa[_0x3f0d76];return _0x12c12e;};'use strict';var schema=require(_0xa70f('0x0'));var _=require(_0xa70f('0x1'));var logger=require(_0xa70f('0x2'))(_0xa70f('0x3'));var gotop=schema({'priority':{'type':_0xa70f('0x4'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0xa70f('0x5')]=function(_0xd704ab,_0x307ddc){return function(_0xc97558){try{var _0x2abda6={'priority':_0x307ddc[0x0]};var _0x44d8cc=gotop[_0xa70f('0x0')](_0x2abda6,{'typecast':!![]});if(_0x44d8cc['length']){logger[_0xa70f('0x6')](_0xa70f('0x7'),_0xd704ab,_[_0xa70f('0x8')](_0x44d8cc,_0xa70f('0x9'))[_0xa70f('0xa')](',\x20'));_0xc97558[_0xa70f('0xb')]();}else{logger[_0xa70f('0xc')]('[%s][GOTOP]\x20priority\x20%s',_0xd704ab,_0x2abda6[_0xa70f('0xd')]);if(_0x2abda6[_0xa70f('0xd')]){var _0x554825=_['findIndex'](_0xc97558[_0xa70f('0xe')](),{'p':_0x2abda6['priority']});if(_0x554825>=0x0){logger['info'](_0xa70f('0xf'),_0xd704ab,_0x2abda6[_0xa70f('0xd')]||_0xa70f('0x10'),_0x554825);_0xc97558[_0xa70f('0x10')](_0x554825);}else{logger[_0xa70f('0xc')](_0xa70f('0x11'),_0xd704ab,_0x2abda6[_0xa70f('0xd')]||_0xa70f('0x10'));_0xc97558['stop']();}}else{_0xc97558[_0xa70f('0x10')]();}}}catch(_0xcbe727){logger[_0xa70f('0x6')](_0xa70f('0x7'),_0xd704ab,JSON[_0xa70f('0x12')](_0xcbe727));_0xc97558[_0xa70f('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 67cf26a..ce2e6e5 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 _0xa737=['next','error','stringify','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','chat','ChatWebsiteId','account','upperFirst','AccountId','channel','InteractionId','interaction','Message','then','info','[%s][MESSAGE]\x20%s','body'];(function(_0x4282e7,_0x2f6bab){var _0x33a097=function(_0x214e9c){while(--_0x214e9c){_0x4282e7['push'](_0x4282e7['shift']());}};_0x33a097(++_0x2f6bab);}(_0xa737,0x154));var _0x7a73=function(_0x1b70e3,_0x3a15b1){_0x1b70e3=_0x1b70e3-0x0;var _0x1452ab=_0xa737[_0x1b70e3];return _0x1452ab;};'use strict';var _=require(_0x7a73('0x0'));var utils=require(_0x7a73('0x1'));var logger=require(_0x7a73('0x2'))(_0x7a73('0x3'));var rpc={'chatMessage':require(_0x7a73('0x4')),'openchannelMessage':require(_0x7a73('0x5')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x7a73('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x7a73('0x7'))};exports[_0x7a73('0x8')]=function(_0xcc38d1,_0x2c119f){return function(_0x242609){try{var _0xcffeb9={'body':utils[_0x7a73('0x9')](_0x2c119f[0x0],this),'ContactId':this[_0x7a73('0xa')]['id']};if(this['channel']===_0x7a73('0xb')){_0xcffeb9[_0x7a73('0xc')]=this[_0x7a73('0xd')]['id'];}else{_0xcffeb9[_[_0x7a73('0xe')](this['channel'])+_0x7a73('0xf')]=this[_0x7a73('0xd')]['id'];}_0xcffeb9[_[_0x7a73('0xe')](this[_0x7a73('0x10')])+_0x7a73('0x11')]=this[_0x7a73('0x12')]['id'];if(rpc[this[_0x7a73('0x10')]+_0x7a73('0x13')]){return rpc[this[_0x7a73('0x10')]+_0x7a73('0x13')]['create'](_0xcffeb9)[_0x7a73('0x14')](function(_0x5054f0){logger[_0x7a73('0x15')](_0x7a73('0x16'),_0xcc38d1,_0xcffeb9[_0x7a73('0x17')]);_0x242609[_0x7a73('0x18')]();})['catch'](function(_0x21d5db){logger[_0x7a73('0x19')](_0x7a73('0x16'),_0xcc38d1,JSON[_0x7a73('0x1a')](_0x21d5db));_0x242609[_0x7a73('0x1b')]();});}}catch(_0x32c647){logger[_0x7a73('0x19')]('[%s][MESSAGE]\x20%s',_0xcc38d1,JSON[_0x7a73('0x1a')](_0x32c647));_0x242609['stop']();}};}; \ No newline at end of file +var _0xf630=['[%s][MESSAGE]\x20%s','next','catch','error','stringify','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','channel','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','interaction','Message'];(function(_0x1425a1,_0x5832b0){var _0x3a9ed6=function(_0x48fb98){while(--_0x48fb98){_0x1425a1['push'](_0x1425a1['shift']());}};_0x3a9ed6(++_0x5832b0);}(_0xf630,0xf0));var _0x0f63=function(_0x2e1a9a,_0x11e43f){_0x2e1a9a=_0x2e1a9a-0x0;var _0x33f5e7=_0xf630[_0x2e1a9a];return _0x33f5e7;};'use strict';var _=require(_0x0f63('0x0'));var utils=require(_0x0f63('0x1'));var logger=require(_0x0f63('0x2'))(_0x0f63('0x3'));var rpc={'chatMessage':require(_0x0f63('0x4')),'openchannelMessage':require(_0x0f63('0x5')),'mailMessage':require(_0x0f63('0x6')),'smsMessage':require(_0x0f63('0x7')),'faxMessage':require(_0x0f63('0x8')),'whatsappMessage':require(_0x0f63('0x9'))};exports[_0x0f63('0xa')]=function(_0x1a2b13,_0x8f77fc){return function(_0x290a32){try{var _0x39e858={'body':utils['getMustacheRender'](_0x8f77fc[0x0],this),'ContactId':this['contact']['id']};if(this[_0x0f63('0xb')]===_0x0f63('0xc')){_0x39e858[_0x0f63('0xd')]=this[_0x0f63('0xe')]['id'];}else{_0x39e858[_[_0x0f63('0xf')](this['channel'])+_0x0f63('0x10')]=this[_0x0f63('0xe')]['id'];}_0x39e858[_[_0x0f63('0xf')](this[_0x0f63('0xb')])+_0x0f63('0x11')]=this[_0x0f63('0x12')]['id'];if(rpc[this[_0x0f63('0xb')]+_0x0f63('0x13')]){return rpc[this[_0x0f63('0xb')]+_0x0f63('0x13')]['create'](_0x39e858)['then'](function(_0x40d632){logger['info'](_0x0f63('0x14'),_0x1a2b13,_0x39e858['body']);_0x290a32[_0x0f63('0x15')]();})[_0x0f63('0x16')](function(_0x248e61){logger[_0x0f63('0x17')](_0x0f63('0x14'),_0x1a2b13,JSON[_0x0f63('0x18')](_0x248e61));_0x290a32['stop']();});}}catch(_0x2c70ee){logger['error'](_0x0f63('0x14'),_0x1a2b13,JSON[_0x0f63('0x18')](_0x2c70ee));_0x290a32[_0x0f63('0x19')]();}};}; \ 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 48722a1..1e2c247 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 _0x6407=['routing','consequence','info','[%s][NOOP]\x20%s','getMustacheRender','next','stop','./utils'];(function(_0x3a1058,_0x255329){var _0x2509c5=function(_0x5a06fe){while(--_0x5a06fe){_0x3a1058['push'](_0x3a1058['shift']());}};_0x2509c5(++_0x255329);}(_0x6407,0x1df));var _0x7640=function(_0x2870e8,_0x45e908){_0x2870e8=_0x2870e8-0x0;var _0x13b9d=_0x6407[_0x2870e8];return _0x13b9d;};'use strict';var utils=require(_0x7640('0x0'));var logger=require('../../../../config/logger')(_0x7640('0x1'));exports[_0x7640('0x2')]=function(_0x2ddac5,_0x5f4432){return function(_0x1d4d54){try{logger[_0x7640('0x3')](_0x7640('0x4'),_0x2ddac5,utils[_0x7640('0x5')](_0x5f4432[0x0],this));_0x1d4d54[_0x7640('0x6')]();}catch(_0x2f6960){logger['error'](_0x7640('0x4'),_0x2ddac5,JSON['stringify'](_0x2f6960));_0x1d4d54[_0x7640('0x7')]();}};}; \ No newline at end of file +var _0xfeca=['routing','info','[%s][NOOP]\x20%s','getMustacheRender','error','stringify','stop','./utils'];(function(_0x42fd7c,_0x5d15d0){var _0x4a46a6=function(_0x24f3eb){while(--_0x24f3eb){_0x42fd7c['push'](_0x42fd7c['shift']());}};_0x4a46a6(++_0x5d15d0);}(_0xfeca,0x197));var _0xafec=function(_0x564a9c,_0x27e7b6){_0x564a9c=_0x564a9c-0x0;var _0x4ff48f=_0xfeca[_0x564a9c];return _0x4ff48f;};'use strict';var utils=require(_0xafec('0x0'));var logger=require('../../../../config/logger')(_0xafec('0x1'));exports['consequence']=function(_0x10faca,_0x5e6e4c){return function(_0x281d0e){try{logger[_0xafec('0x2')](_0xafec('0x3'),_0x10faca,utils[_0xafec('0x4')](_0x5e6e4c[0x0],this));_0x281d0e['next']();}catch(_0x4164ab){logger[_0xafec('0x5')](_0xafec('0x3'),_0x10faca,JSON[_0xafec('0x6')](_0x4164ab));_0x281d0e[_0xafec('0x7')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index 0a6b3d6..c220d56 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 _0x17f3=['queue_id','account','queue','from','emit','clone','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','body','contact','list','upperFirst','channel','QueueId','InteractionId','interaction','message','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','create\x20queue\x20report','YYYY-MM-DD\x20HH:mm:ss','accepted','[%s][STOP:QUEUE][NAME:%s]','update','error','update\x20queue\x20report','waiting','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','validate','length','[%s][QUEUE]\x20%s','map','join','find','Queues','createQueue','qtimeout','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','rules','stop','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','log','stack','moment','ioredis','../../../../config/logger','routing','./strategy','redis','defaults','socket.io-emitter'];(function(_0x2cdb19,_0x5af949){var _0x3ebd66=function(_0x4756eb){while(--_0x4756eb){_0x2cdb19['push'](_0x2cdb19['shift']());}};_0x3ebd66(++_0x5af949);}(_0x17f3,0x188));var _0x317f=function(_0x2e0cdd,_0x34001d){_0x2e0cdd=_0x2e0cdd-0x0;var _0x4dbcff=_0x17f3[_0x2e0cdd];return _0x4dbcff;};'use strict';var schema=require('validate');var _=require('lodash');var util=require('util');var seqqueue=require('seq-queue');var moment=require(_0x317f('0x0'));var Redis=require(_0x317f('0x1'));var config=require('../../../../config/environment');var logger=require(_0x317f('0x2'))(_0x317f('0x3'));var strategy=require(_0x317f('0x4'));config[_0x317f('0x5')]=_[_0x317f('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x317f('0x7'))(new Redis(config[_0x317f('0x5')]));var attributes=['id',_0x317f('0x8'),_0x317f('0x9'),_0x317f('0xa'),_0x317f('0xb'),'joinAt'];function emit(_0x579edb,_0x321236,_0x3e3080){io['to'](_0x579edb)[_0x317f('0xc')](_0x321236,_0x3e3080);}function emitChannelQueueInteraction(_0x2ed59d,_0x906958,_0x5f4238,_0x6ed24e,_0x51b59a,_0x2a9ca5,_0x124b6f,_0x4034de){var _0x20739f=_[_0x317f('0xd')](_0x5f4238);_0x20739f[_0x317f('0x8')]=_0x4034de;_0x20739f[_0x317f('0xa')]=_0x906958;_0x20739f[_0x317f('0x9')]=_0x6ed24e;_0x20739f['id']=_0x51b59a;if(_0x2a9ca5){_0x124b6f[util[_0x317f('0xe')](_0x317f('0xf'),_0x2ed59d)][_0x51b59a]=_[_0x317f('0x10')](_0x20739f,attributes);}else{delete _0x124b6f[util['format'](_0x317f('0xf'),_0x2ed59d)][_0x51b59a];}emit(util[_0x317f('0xe')](_0x317f('0x11'),_0x2ed59d,_0x906958),util['format'](_0x317f('0x12'),_0x2ed59d,_0x2a9ca5?_0x317f('0x13'):_0x317f('0x14')),_[_0x317f('0x10')](_0x20739f,attributes));}var rpc={'openchannelQueueReport':require(_0x317f('0x15')),'mailQueueReport':require(_0x317f('0x16')),'chatQueueReport':require(_0x317f('0x17')),'smsQueueReport':require(_0x317f('0x18')),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require(_0x317f('0x19'))};var queue=schema({'name':{'type':_0x317f('0x1a'),'required':!![],'message':_0x317f('0x1b')},'timeout':{'type':_0x317f('0x1c'),'message':_0x317f('0x1d')}});function startRouting(_0x2d0709,_0x351de4,_0x1c1eb6,_0x472a87){if(_0x2d0709&&_0x351de4&&_0x1c1eb6){_0x351de4['waiting']+=0x1;var _0x548d28={'uniqueid':_0x2d0709,'from':_0x1c1eb6[_0x317f('0x1e')]?_0x1c1eb6[_0x317f('0x1e')][_0x317f('0xb')]:'','joinAt':moment()[_0x317f('0xe')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1c1eb6[_0x317f('0x1f')]?_0x1c1eb6[_0x317f('0x1f')]['id']:null,'ListId':_0x1c1eb6[_0x317f('0x20')]?_0x1c1eb6[_0x317f('0x20')]['id']:null};_0x548d28[_[_0x317f('0x21')](_0x1c1eb6[_0x317f('0x22')])+_0x317f('0x23')]=_0x351de4['id']||null;_0x548d28[_[_0x317f('0x21')](_0x1c1eb6['channel'])+_0x317f('0x24')]=_0x1c1eb6[_0x317f('0x25')]?_0x1c1eb6[_0x317f('0x25')]['id']:null;_0x548d28[_[_0x317f('0x21')](_0x1c1eb6[_0x317f('0x22')])+'MessageId']=_0x1c1eb6[_0x317f('0x26')]?_0x1c1eb6[_0x317f('0x26')]['id']:null;_0x548d28[_[_0x317f('0x21')](_0x1c1eb6[_0x317f('0x22')])+(_0x1c1eb6['channel']!==_0x317f('0x27')?_0x317f('0x28'):_0x317f('0x29'))]=_0x1c1eb6[_0x317f('0x9')]?_0x1c1eb6['account']['id']:null;logger[_0x317f('0x2a')](util[_0x317f('0xe')](_0x317f('0x2b'),_0x2d0709,_0x351de4[_0x317f('0x2c')]));emitChannelQueueInteraction(_0x1c1eb6[_0x317f('0x22')],_0x351de4[_0x317f('0x2c')],_0x548d28,_0x1c1eb6[_0x317f('0x9')][_0x317f('0x2c')],_0x1c1eb6[_0x317f('0x26')]['id'],!![],_0x472a87,_0x351de4['id']);if(rpc[_0x1c1eb6[_0x317f('0x22')]+_0x317f('0x2d')]){return rpc[_0x1c1eb6[_0x317f('0x22')]+_0x317f('0x2d')][_0x317f('0x2e')](_0x548d28)[_0x317f('0x2f')](function(_0x2831f3){logger['error'](_0x317f('0x30'));});}}}function stopRouting(_0x37851b,_0x300f2d,_0x46813d,_0xf6823d){if(_0x37851b&&_0x300f2d){_0x300f2d['waiting']-=0x1;var _0x3a7016={'leaveAt':moment()[_0x317f('0xe')](_0x317f('0x31')),'acceptAt':moment()[_0x317f('0xe')](_0x317f('0x31')),'reason':_0x317f('0x32')};logger[_0x317f('0x2a')](util['format'](_0x317f('0x33'),_0x37851b,_0x300f2d[_0x317f('0x2c')]));emitChannelQueueInteraction(_0x46813d[_0x317f('0x22')],_0x300f2d[_0x317f('0x2c')],_0x46813d['body'],_0x46813d['account'][_0x317f('0x2c')],_0x46813d[_0x317f('0x26')]['id'],![],_0xf6823d,_0x300f2d['id']);if(rpc[_0x46813d[_0x317f('0x22')]+_0x317f('0x2d')]){return rpc[_0x46813d[_0x317f('0x22')]+_0x317f('0x2d')][_0x317f('0x34')](_0x37851b,_0x3a7016)[_0x317f('0x2f')](function(_0x22de1c){logger[_0x317f('0x35')](_0x317f('0x36'));});}}}function endRouting(_0x69d058,_0x112078,_0x1690dd,_0x5d586e){if(_0x69d058&&_0x112078){_0x112078[_0x317f('0x37')]-=0x1;var _0x58c183={'leaveAt':moment()['format'](_0x317f('0x31')),'exitAt':moment()[_0x317f('0xe')](_0x317f('0x31')),'reason':_0x317f('0x38')};logger['info'](util[_0x317f('0xe')](_0x317f('0x39'),_0x69d058,_0x112078['name']));emitChannelQueueInteraction(_0x1690dd[_0x317f('0x22')],_0x112078[_0x317f('0x2c')],_0x1690dd['body'],_0x1690dd[_0x317f('0x9')]['name'],_0x1690dd[_0x317f('0x26')]['id'],![],_0x5d586e);if(rpc[_0x1690dd['channel']+'QueueReport']){return rpc[_0x1690dd[_0x317f('0x22')]+'QueueReport'][_0x317f('0x34')](_0x69d058,_0x58c183)[_0x317f('0x2f')](function(_0xfd8d9a){logger[_0x317f('0x35')]('update\x20queue\x20report');});}}}function handleFindQueue(_0x99f740){return function(_0x476417){return _0x476417[_0x317f('0x2c')][_0x317f('0x3a')]()===_0x99f740[_0x317f('0x3a')]();};}exports[_0x317f('0x3b')]=function(_0x2a2a83,_0x4f49fa,_0x3f7b06,_0x403bab){return function(_0x50cbc2){try{var _0x164e5d={'name':_0x4f49fa[0x0],'timeout':_0x4f49fa[0x1]};var _0x40e027=queue[_0x317f('0x3c')](_0x164e5d,{'typecast':!![]});if(_0x40e027[_0x317f('0x3d')]){logger[_0x317f('0x35')](_0x317f('0x3e'),_0x2a2a83,_[_0x317f('0x3f')](_0x40e027,_0x317f('0x26'))[_0x317f('0x40')](',\x20'));_0x50cbc2['stop']();}else{var _0x5aece4=_[_0x317f('0x41')](_0x3f7b06[_0x403bab[_0x317f('0x22')]+_0x317f('0x42')],handleFindQueue(_0x164e5d['name']));if(_0x5aece4){startRouting(_0x2a2a83,_0x5aece4,_0x403bab,_0x3f7b06);var _0x14f194=(_0x5aece4[_0x317f('0x38')]||0xa)*0x3e8;var _0x2dbc9d=(_0x164e5d[_0x317f('0x38')]||0x14)*0x3e8;var _0x45cb60,_0x57de3c;if(_0x14f194>_0x2dbc9d){_0x2dbc9d=_0x14f194;}var _0xa1978d=seqqueue[_0x317f('0x43')](_0x14f194);_0xa1978d['id']=_0x2a2a83;_0xa1978d['atimeout']=_0x14f194;_0xa1978d[_0x317f('0x44')]=_0x2dbc9d;_0xa1978d['channel']=_0x403bab['channel'];_0x3f7b06['rules'][_0x2a2a83]['on'](_0x317f('0x45'),function(){logger[_0x317f('0x2a')](_0x317f('0x46'),_0x2a2a83);stopRouting(_0x2a2a83,_0x5aece4,_0x403bab,_0x3f7b06);clearTimeout(_0x45cb60);_0x45cb60=undefined;_0xa1978d['close'](!![]);if(_0x3f7b06['rules'][_0x2a2a83]){delete _0x3f7b06[_0x317f('0x47')][_0x2a2a83];}_0x50cbc2[_0x317f('0x48')]();});_0x3f7b06['rules'][_0x2a2a83]['on'](_0x317f('0x49'),function(){if(_0x3f7b06[_0x317f('0x47')][_0x2a2a83]){delete _0x3f7b06[_0x317f('0x47')][_0x2a2a83];}});_0x45cb60=setTimeout(function(){logger['info'](_0x317f('0x4a'),_0x2a2a83);endRouting(_0x2a2a83,_0x5aece4,_0x403bab,_0x3f7b06);clearTimeout(_0x45cb60);_0xa1978d['close'](!![]);_0x50cbc2[_0x317f('0x4b')]();},_0x2dbc9d);switch(_0x5aece4[_0x317f('0x4c')]){case'rrmemory':strategy[_0x317f('0x4d')](_0xa1978d,_0x5aece4,_0x3f7b06,_0x403bab);break;default:strategy['beepall'](_0xa1978d,_0x5aece4,_0x3f7b06,_0x403bab);}}else{logger['error']('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x2a2a83,_0x164e5d[_0x317f('0x2c')]);_0x50cbc2[_0x317f('0x48')]();}}}catch(_0xc49f5f){console[_0x317f('0x4e')](_0xc49f5f);logger[_0x317f('0x35')](_0x317f('0x3e'),_0x2a2a83,_0xc49f5f[_0x317f('0x4f')]);_0x50cbc2[_0x317f('0x48')]();}};}; \ No newline at end of file +var _0xd92b=['pick','format','%s:queue:%s','%s_queue_waiting_interaction:%s','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','QueueId','channel','InteractionId','interaction','MessageId','message','chat','AccountId','WebsiteId','info','name','QueueReport','catch','error','create\x20queue\x20report','waiting','accepted','[%s][STOP:QUEUE][NAME:%s]','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','length','map','stop','find','Queues','createQueue','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','next','strategy','rrmemory','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','[%s][QUEUE]\x20%s','validate','util','seq-queue','moment','ioredis','../../../../config/logger','routing','./strategy','redis','defaults','localhost','account','queue','from','emit','clone','queue_id','%sQueuesWaitingInteractions'];(function(_0x2008bd,_0x252aa3){var _0x2f6329=function(_0x4be024){while(--_0x4be024){_0x2008bd['push'](_0x2008bd['shift']());}};_0x2f6329(++_0x252aa3);}(_0xd92b,0x1f4));var _0xbd92=function(_0x42f7e5,_0x5efca0){_0x42f7e5=_0x42f7e5-0x0;var _0x1f793e=_0xd92b[_0x42f7e5];return _0x1f793e;};'use strict';var schema=require(_0xbd92('0x0'));var _=require('lodash');var util=require(_0xbd92('0x1'));var seqqueue=require(_0xbd92('0x2'));var moment=require(_0xbd92('0x3'));var Redis=require(_0xbd92('0x4'));var config=require('../../../../config/environment');var logger=require(_0xbd92('0x5'))(_0xbd92('0x6'));var strategy=require(_0xbd92('0x7'));config[_0xbd92('0x8')]=_[_0xbd92('0x9')](config[_0xbd92('0x8')],{'host':_0xbd92('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xbd92('0x8')]));var attributes=['id','queue_id',_0xbd92('0xb'),_0xbd92('0xc'),_0xbd92('0xd'),'joinAt'];function emit(_0x3dfc8a,_0xc6a57c,_0x2fb2d3){io['to'](_0x3dfc8a)[_0xbd92('0xe')](_0xc6a57c,_0x2fb2d3);}function emitChannelQueueInteraction(_0x402a3e,_0xa0f024,_0x4967d6,_0x4b87c3,_0x557d46,_0x35a900,_0x249acc,_0x7a1681){var _0x9f3767=_[_0xbd92('0xf')](_0x4967d6);_0x9f3767[_0xbd92('0x10')]=_0x7a1681;_0x9f3767[_0xbd92('0xc')]=_0xa0f024;_0x9f3767['account']=_0x4b87c3;_0x9f3767['id']=_0x557d46;if(_0x35a900){_0x249acc[util['format'](_0xbd92('0x11'),_0x402a3e)][_0x557d46]=_[_0xbd92('0x12')](_0x9f3767,attributes);}else{delete _0x249acc[util['format']('%sQueuesWaitingInteractions',_0x402a3e)][_0x557d46];}emit(util[_0xbd92('0x13')](_0xbd92('0x14'),_0x402a3e,_0xa0f024),util[_0xbd92('0x13')](_0xbd92('0x15'),_0x402a3e,_0x35a900?'save':_0xbd92('0x16')),_[_0xbd92('0x12')](_0x9f3767,attributes));}var rpc={'openchannelQueueReport':require(_0xbd92('0x17')),'mailQueueReport':require(_0xbd92('0x18')),'chatQueueReport':require(_0xbd92('0x19')),'smsQueueReport':require(_0xbd92('0x1a')),'faxQueueReport':require(_0xbd92('0x1b')),'whatsappQueueReport':require(_0xbd92('0x1c'))};var queue=schema({'name':{'type':'string','required':!![],'message':_0xbd92('0x1d')},'timeout':{'type':'number','message':'timeout\x20is\x20a\x20number'}});function startRouting(_0x12f6d9,_0x24b787,_0x3d6fae,_0x59fe9f){if(_0x12f6d9&&_0x24b787&&_0x3d6fae){_0x24b787['waiting']+=0x1;var _0x2c574e={'uniqueid':_0x12f6d9,'from':_0x3d6fae[_0xbd92('0x1e')]?_0x3d6fae[_0xbd92('0x1e')]['from']:'','joinAt':moment()[_0xbd92('0x13')](_0xbd92('0x1f')),'ContactId':_0x3d6fae[_0xbd92('0x20')]?_0x3d6fae['contact']['id']:null,'ListId':_0x3d6fae[_0xbd92('0x21')]?_0x3d6fae['list']['id']:null};_0x2c574e[_[_0xbd92('0x22')](_0x3d6fae['channel'])+_0xbd92('0x23')]=_0x24b787['id']||null;_0x2c574e[_[_0xbd92('0x22')](_0x3d6fae[_0xbd92('0x24')])+_0xbd92('0x25')]=_0x3d6fae[_0xbd92('0x26')]?_0x3d6fae[_0xbd92('0x26')]['id']:null;_0x2c574e[_['upperFirst'](_0x3d6fae[_0xbd92('0x24')])+_0xbd92('0x27')]=_0x3d6fae[_0xbd92('0x28')]?_0x3d6fae['message']['id']:null;_0x2c574e[_['upperFirst'](_0x3d6fae[_0xbd92('0x24')])+(_0x3d6fae[_0xbd92('0x24')]!==_0xbd92('0x29')?_0xbd92('0x2a'):_0xbd92('0x2b'))]=_0x3d6fae[_0xbd92('0xb')]?_0x3d6fae[_0xbd92('0xb')]['id']:null;logger[_0xbd92('0x2c')](util[_0xbd92('0x13')]('[%s][START:QUEUE][NAME:%s]',_0x12f6d9,_0x24b787[_0xbd92('0x2d')]));emitChannelQueueInteraction(_0x3d6fae[_0xbd92('0x24')],_0x24b787['name'],_0x2c574e,_0x3d6fae[_0xbd92('0xb')][_0xbd92('0x2d')],_0x3d6fae[_0xbd92('0x28')]['id'],!![],_0x59fe9f,_0x24b787['id']);if(rpc[_0x3d6fae['channel']+_0xbd92('0x2e')]){return rpc[_0x3d6fae[_0xbd92('0x24')]+_0xbd92('0x2e')]['create'](_0x2c574e)[_0xbd92('0x2f')](function(_0xab449a){logger[_0xbd92('0x30')](_0xbd92('0x31'));});}}}function stopRouting(_0x2bb53d,_0x499263,_0x388eb6,_0x1f6739){if(_0x2bb53d&&_0x499263){_0x499263[_0xbd92('0x32')]-=0x1;var _0x102981={'leaveAt':moment()[_0xbd92('0x13')](_0xbd92('0x1f')),'acceptAt':moment()[_0xbd92('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0xbd92('0x33')};logger[_0xbd92('0x2c')](util[_0xbd92('0x13')](_0xbd92('0x34'),_0x2bb53d,_0x499263[_0xbd92('0x2d')]));emitChannelQueueInteraction(_0x388eb6[_0xbd92('0x24')],_0x499263[_0xbd92('0x2d')],_0x388eb6[_0xbd92('0x1e')],_0x388eb6[_0xbd92('0xb')]['name'],_0x388eb6[_0xbd92('0x28')]['id'],![],_0x1f6739,_0x499263['id']);if(rpc[_0x388eb6[_0xbd92('0x24')]+_0xbd92('0x2e')]){return rpc[_0x388eb6[_0xbd92('0x24')]+_0xbd92('0x2e')]['update'](_0x2bb53d,_0x102981)[_0xbd92('0x2f')](function(_0x49147e){logger[_0xbd92('0x30')](_0xbd92('0x35'));});}}}function endRouting(_0x58e026,_0xd8701f,_0xfceb1,_0xbc7a50){if(_0x58e026&&_0xd8701f){_0xd8701f['waiting']-=0x1;var _0x4ef2f6={'leaveAt':moment()[_0xbd92('0x13')](_0xbd92('0x1f')),'exitAt':moment()[_0xbd92('0x13')](_0xbd92('0x1f')),'reason':_0xbd92('0x36')};logger[_0xbd92('0x2c')](util[_0xbd92('0x13')](_0xbd92('0x37'),_0x58e026,_0xd8701f[_0xbd92('0x2d')]));emitChannelQueueInteraction(_0xfceb1[_0xbd92('0x24')],_0xd8701f[_0xbd92('0x2d')],_0xfceb1[_0xbd92('0x1e')],_0xfceb1[_0xbd92('0xb')][_0xbd92('0x2d')],_0xfceb1[_0xbd92('0x28')]['id'],![],_0xbc7a50);if(rpc[_0xfceb1['channel']+_0xbd92('0x2e')]){return rpc[_0xfceb1[_0xbd92('0x24')]+_0xbd92('0x2e')]['update'](_0x58e026,_0x4ef2f6)[_0xbd92('0x2f')](function(_0x41f935){logger[_0xbd92('0x30')](_0xbd92('0x35'));});}}}function handleFindQueue(_0x5030cc){return function(_0xba4f6){return _0xba4f6[_0xbd92('0x2d')][_0xbd92('0x38')]()===_0x5030cc['toLowerCase']();};}exports['consequence']=function(_0x1c3f21,_0x229c40,_0x811929,_0x4e397b){return function(_0x4c26e8){try{var _0x2ed788={'name':_0x229c40[0x0],'timeout':_0x229c40[0x1]};var _0x53ae4a=queue[_0xbd92('0x0')](_0x2ed788,{'typecast':!![]});if(_0x53ae4a[_0xbd92('0x39')]){logger[_0xbd92('0x30')]('[%s][QUEUE]\x20%s',_0x1c3f21,_[_0xbd92('0x3a')](_0x53ae4a,_0xbd92('0x28'))['join'](',\x20'));_0x4c26e8[_0xbd92('0x3b')]();}else{var _0x4f3400=_[_0xbd92('0x3c')](_0x811929[_0x4e397b[_0xbd92('0x24')]+_0xbd92('0x3d')],handleFindQueue(_0x2ed788[_0xbd92('0x2d')]));if(_0x4f3400){startRouting(_0x1c3f21,_0x4f3400,_0x4e397b,_0x811929);var _0x301fea=(_0x4f3400[_0xbd92('0x36')]||0xa)*0x3e8;var _0x295dd1=(_0x2ed788[_0xbd92('0x36')]||0x14)*0x3e8;var _0x1280dc,_0x29dada;if(_0x301fea>_0x295dd1){_0x295dd1=_0x301fea;}var _0x109f0d=seqqueue[_0xbd92('0x3e')](_0x301fea);_0x109f0d['id']=_0x1c3f21;_0x109f0d[_0xbd92('0x3f')]=_0x301fea;_0x109f0d[_0xbd92('0x40')]=_0x295dd1;_0x109f0d[_0xbd92('0x24')]=_0x4e397b[_0xbd92('0x24')];_0x811929[_0xbd92('0x41')][_0x1c3f21]['on'](_0xbd92('0x42'),function(){logger['info'](_0xbd92('0x43'),_0x1c3f21);stopRouting(_0x1c3f21,_0x4f3400,_0x4e397b,_0x811929);clearTimeout(_0x1280dc);_0x1280dc=undefined;_0x109f0d[_0xbd92('0x44')](!![]);if(_0x811929['rules'][_0x1c3f21]){delete _0x811929[_0xbd92('0x41')][_0x1c3f21];}_0x4c26e8[_0xbd92('0x3b')]();});_0x811929[_0xbd92('0x41')][_0x1c3f21]['on']('complete',function(){if(_0x811929['rules'][_0x1c3f21]){delete _0x811929['rules'][_0x1c3f21];}});_0x1280dc=setTimeout(function(){logger[_0xbd92('0x2c')]('[%s][QUEUE]\x20APPLICATION\x20END',_0x1c3f21);endRouting(_0x1c3f21,_0x4f3400,_0x4e397b,_0x811929);clearTimeout(_0x1280dc);_0x109f0d[_0xbd92('0x44')](!![]);_0x4c26e8[_0xbd92('0x45')]();},_0x295dd1);switch(_0x4f3400[_0xbd92('0x46')]){case _0xbd92('0x47'):strategy[_0xbd92('0x47')](_0x109f0d,_0x4f3400,_0x811929,_0x4e397b);break;default:strategy['beepall'](_0x109f0d,_0x4f3400,_0x811929,_0x4e397b);}}else{logger[_0xbd92('0x30')](_0xbd92('0x48'),_0x1c3f21,_0x2ed788[_0xbd92('0x2d')]);_0x4c26e8['stop']();}}}catch(_0x23f39b){console['log'](_0x23f39b);logger[_0xbd92('0x30')](_0xbd92('0x49'),_0x1c3f21,_0x23f39b['stack']);_0x4c26e8['stop']();}};}; \ 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 d751633..0486d0d 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 _0x191a=['hideNotification','busyQueue','TIMEOUT','lodash','uuid','./util','routing','squeue','agent','push','handleTimeout','bind','timeout','drained','handleDrained','prototype','handleRun','debug','isNil','realtime','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel','busy','showNotification','notificationId','writeLog',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available'];(function(_0x1704d5,_0x1f1740){var _0x58b71d=function(_0x252c42){while(--_0x252c42){_0x1704d5['push'](_0x1704d5['shift']());}};_0x58b71d(++_0x1f1740);}(_0x191a,0x1b5));var _0xa191=function(_0x1ebcf6,_0x3149a5){_0x1ebcf6=_0x1ebcf6-0x0;var _0x2860b7=_0x191a[_0x1ebcf6];return _0x2860b7;};'use strict';var _=require(_0xa191('0x0'));var uuid=require(_0xa191('0x1'));var util=require(_0xa191('0x2'));var logger=require('../../../../../config/logger')(_0xa191('0x3'));var Agent=function(_0x1f446d,_0x8a0a1e,_0x513a0a,_0xc2be8b){this['notificationId']=uuid['v4']();this[_0xa191('0x4')]=_0x1f446d;this[_0xa191('0x5')]=_0x8a0a1e;this['realtime']=_0x513a0a;this[_0xa191('0x3')]=_0xc2be8b;this[_0xa191('0x4')][_0xa191('0x6')](this['handleRun']['bind'](this),this[_0xa191('0x7')][_0xa191('0x8')](this));this[_0xa191('0x4')]['on'](_0xa191('0x9'),this['handleTimeout']['bind'](this));this[_0xa191('0x4')]['on'](_0xa191('0xa'),this[_0xa191('0xb')]['bind'](this));};Agent[_0xa191('0xc')][_0xa191('0x6')]=function(){this[_0xa191('0x4')][_0xa191('0x6')](this[_0xa191('0xd')]['bind'](this),this[_0xa191('0x7')]['bind'](this));};Agent['prototype'][_0xa191('0xb')]=function(){this[_0xa191('0x7')](!![]);};Agent[_0xa191('0xc')][_0xa191('0xd')]=function(){logger[_0xa191('0xe')]('[%s][AGENT]\x20try\x20with\x20%s',this[_0xa191('0x4')]['id'],this['agent']['id']);if(_[_0xa191('0xf')](this[_0xa191('0x10')][_0xa191('0x11')][this['agent']['id']])){logger[_0xa191('0xe')](_0xa191('0x12'),this[_0xa191('0x4')]['id'],this[_0xa191('0x5')]['id']);setTimeout(this[_0xa191('0x6')][_0xa191('0x8')](this),0x3e8);}else{if(this[_0xa191('0x3')][_0xa191('0x13')]||util[_0xa191('0x14')](this['squeue']['id'],this[_0xa191('0x10')]['agents'][this[_0xa191('0x5')]['id']],this[_0xa191('0x4')][_0xa191('0x15')],![])){this[_0xa191('0x10')][_0xa191('0x11')][this[_0xa191('0x5')]['id']][_0xa191('0x16')]=!![];this[_0xa191('0x10')]['agents'][this[_0xa191('0x5')]['id']]['busyQueue']=undefined;util[_0xa191('0x17')](this[_0xa191('0x18')],this[_0xa191('0x4')]['id'],this[_0xa191('0x10')][_0xa191('0x11')][this['agent']['id']],null,this[_0xa191('0x3')]);util[_0xa191('0x19')](this[_0xa191('0x4')]['id'],this[_0xa191('0x10')][_0xa191('0x11')][this[_0xa191('0x5')]['id']],'RINGING'+(this[_0xa191('0x3')][_0xa191('0x13')]?_0xa191('0x1a'):''));}else{logger['debug'](_0xa191('0x1b'),this[_0xa191('0x4')]['id'],this[_0xa191('0x5')]['id']);setTimeout(this[_0xa191('0x6')][_0xa191('0x8')](this),0x3e8);}}};Agent[_0xa191('0xc')]['handleTimeout']=function(_0x34f74d){if(_[_0xa191('0xf')](this[_0xa191('0x10')]['agents'][this[_0xa191('0x5')]['id']])){return logger[_0xa191('0xe')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xa191('0x4')]['id'],this[_0xa191('0x5')]['id']);}else{logger[_0xa191('0xe')]('[%s][AGENT]\x20timeout\x20with\x20%s',this[_0xa191('0x4')]['id'],this[_0xa191('0x5')]['id']);util[_0xa191('0x1c')](this[_0xa191('0x18')],this[_0xa191('0x4')]['id'],this['realtime'][_0xa191('0x11')][this[_0xa191('0x5')]['id']],null,this[_0xa191('0x3')]);this['realtime']['agents'][this[_0xa191('0x5')]['id']]['busy']=![];this[_0xa191('0x10')]['agents'][this[_0xa191('0x5')]['id']][_0xa191('0x1d')]=undefined;util['writeLog'](this[_0xa191('0x4')]['id'],this['realtime'][_0xa191('0x11')][this[_0xa191('0x5')]['id']],_0x34f74d?'STOP':_0xa191('0x1e'));}if(!_0x34f74d){setTimeout(this[_0xa191('0x6')][_0xa191('0x8')](this),0x3e8);}};function agent(_0x189a62,_0xabae72,_0x13f093,_0x20b37a){return new Agent(_0x189a62,_0xabae72,_0x13f093,_0x20b37a);}module['exports']=agent; \ No newline at end of file +var _0x42af=['isAgentAvailable','agents','channel','busy','showNotification','notificationId','writeLog','RINGING','forcedOwnership',':FORCED','isNil','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','busyQueue','STOP','TIMEOUT','lodash','uuid','./util','../../../../../config/logger','routing','agent','realtime','squeue','push','bind','timeout','handleTimeout','drained','handleDrained','handleRun','prototype','debug','[%s][AGENT]\x20try\x20with\x20%s'];(function(_0x2fa457,_0x7021df){var _0x4f250a=function(_0xef901e){while(--_0xef901e){_0x2fa457['push'](_0x2fa457['shift']());}};_0x4f250a(++_0x7021df);}(_0x42af,0x192));var _0xf42a=function(_0x27ebab,_0x53644c){_0x27ebab=_0x27ebab-0x0;var _0xb61cb2=_0x42af[_0x27ebab];return _0xb61cb2;};'use strict';var _=require(_0xf42a('0x0'));var uuid=require(_0xf42a('0x1'));var util=require(_0xf42a('0x2'));var logger=require(_0xf42a('0x3'))(_0xf42a('0x4'));var Agent=function(_0x13b51c,_0x461f99,_0xccbbee,_0x2686e3){this['notificationId']=uuid['v4']();this['squeue']=_0x13b51c;this[_0xf42a('0x5')]=_0x461f99;this[_0xf42a('0x6')]=_0xccbbee;this[_0xf42a('0x4')]=_0x2686e3;this[_0xf42a('0x7')][_0xf42a('0x8')](this['handleRun'][_0xf42a('0x9')](this),this['handleTimeout'][_0xf42a('0x9')](this));this[_0xf42a('0x7')]['on'](_0xf42a('0xa'),this[_0xf42a('0xb')][_0xf42a('0x9')](this));this[_0xf42a('0x7')]['on'](_0xf42a('0xc'),this[_0xf42a('0xd')][_0xf42a('0x9')](this));};Agent['prototype'][_0xf42a('0x8')]=function(){this['squeue']['push'](this[_0xf42a('0xe')][_0xf42a('0x9')](this),this[_0xf42a('0xb')][_0xf42a('0x9')](this));};Agent[_0xf42a('0xf')]['handleDrained']=function(){this[_0xf42a('0xb')](!![]);};Agent[_0xf42a('0xf')][_0xf42a('0xe')]=function(){logger[_0xf42a('0x10')](_0xf42a('0x11'),this[_0xf42a('0x7')]['id'],this[_0xf42a('0x5')]['id']);if(_['isNil'](this['realtime']['agents'][this['agent']['id']])){logger[_0xf42a('0x10')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this['squeue']['id'],this[_0xf42a('0x5')]['id']);setTimeout(this[_0xf42a('0x8')][_0xf42a('0x9')](this),0x3e8);}else{if(this[_0xf42a('0x4')]['forcedOwnership']||util[_0xf42a('0x12')](this['squeue']['id'],this[_0xf42a('0x6')][_0xf42a('0x13')][this[_0xf42a('0x5')]['id']],this[_0xf42a('0x7')][_0xf42a('0x14')],![])){this[_0xf42a('0x6')][_0xf42a('0x13')][this['agent']['id']][_0xf42a('0x15')]=!![];this['realtime'][_0xf42a('0x13')][this[_0xf42a('0x5')]['id']]['busyQueue']=undefined;util[_0xf42a('0x16')](this[_0xf42a('0x17')],this['squeue']['id'],this[_0xf42a('0x6')][_0xf42a('0x13')][this[_0xf42a('0x5')]['id']],null,this[_0xf42a('0x4')]);util[_0xf42a('0x18')](this[_0xf42a('0x7')]['id'],this[_0xf42a('0x6')][_0xf42a('0x13')][this[_0xf42a('0x5')]['id']],_0xf42a('0x19')+(this[_0xf42a('0x4')][_0xf42a('0x1a')]?_0xf42a('0x1b'):''));}else{logger[_0xf42a('0x10')]('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this['squeue']['id'],this[_0xf42a('0x5')]['id']);setTimeout(this[_0xf42a('0x8')][_0xf42a('0x9')](this),0x3e8);}}};Agent[_0xf42a('0xf')][_0xf42a('0xb')]=function(_0x39becd){if(_[_0xf42a('0x1c')](this['realtime'][_0xf42a('0x13')][this['agent']['id']])){return logger[_0xf42a('0x10')](_0xf42a('0x1d'),this[_0xf42a('0x7')]['id'],this[_0xf42a('0x5')]['id']);}else{logger[_0xf42a('0x10')](_0xf42a('0x1e'),this[_0xf42a('0x7')]['id'],this['agent']['id']);util[_0xf42a('0x1f')](this[_0xf42a('0x17')],this[_0xf42a('0x7')]['id'],this[_0xf42a('0x6')][_0xf42a('0x13')][this['agent']['id']],null,this['routing']);this[_0xf42a('0x6')][_0xf42a('0x13')][this['agent']['id']][_0xf42a('0x15')]=![];this[_0xf42a('0x6')]['agents'][this[_0xf42a('0x5')]['id']][_0xf42a('0x20')]=undefined;util[_0xf42a('0x18')](this[_0xf42a('0x7')]['id'],this['realtime'][_0xf42a('0x13')][this[_0xf42a('0x5')]['id']],_0x39becd?_0xf42a('0x21'):_0xf42a('0x22'));}if(!_0x39becd){setTimeout(this['push'][_0xf42a('0x9')](this),0x3e8);}};function agent(_0x145092,_0x265d21,_0x37c179,_0xef8a0d){return new Agent(_0x145092,_0x265d21,_0x37c179,_0xef8a0d);}module['exports']=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index 3903acb..31d0d10 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 _0xc91b=['queue','Agents','length','agents','debug','isAgentAvailable','channel','writeLog','RINGING','busy','name','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','STOP','TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','realtime','push','handleRun','bind','handleTimeout','timeout','drained','prototype','handleDrained','isNil'];(function(_0x48df5f,_0x4b738a){var _0x5e27f1=function(_0x17a16f){while(--_0x17a16f){_0x48df5f['push'](_0x48df5f['shift']());}};_0x5e27f1(++_0x4b738a);}(_0xc91b,0x16f));var _0xbc91=function(_0x38b48a,_0x5aca5f){_0x38b48a=_0x38b48a-0x0;var _0xd4b41c=_0xc91b[_0x38b48a];return _0xd4b41c;};'use strict';var _=require(_0xbc91('0x0'));var uuid=require(_0xbc91('0x1'));var util=require(_0xbc91('0x2'));var logger=require(_0xbc91('0x3'))(_0xbc91('0x4'));var Beepall=function(_0xb4810d,_0x1ac340,_0x16ae0f,_0x5e8e01){this[_0xbc91('0x5')]=uuid['v4']();this[_0xbc91('0x6')]=_0xb4810d;this['queue']=_0x1ac340;this[_0xbc91('0x7')]=_0x16ae0f;this[_0xbc91('0x4')]=_0x5e8e01;this['squeue'][_0xbc91('0x8')](this[_0xbc91('0x9')][_0xbc91('0xa')](this),this[_0xbc91('0xb')][_0xbc91('0xa')](this));this[_0xbc91('0x6')]['on'](_0xbc91('0xc'),this['handleTimeout'][_0xbc91('0xa')](this));this[_0xbc91('0x6')]['on'](_0xbc91('0xd'),this['handleDrained']['bind'](this));};Beepall[_0xbc91('0xe')][_0xbc91('0x8')]=function(){this['squeue']['push'](this[_0xbc91('0x9')]['bind'](this),this['handleTimeout'][_0xbc91('0xa')](this));};Beepall[_0xbc91('0xe')][_0xbc91('0xf')]=function(){this[_0xbc91('0xb')](!![]);};Beepall['prototype']['handleRun']=function(){var _0x26e91a=!![];if(!_[_0xbc91('0x10')](this['queue'])&&!_[_0xbc91('0x10')](this[_0xbc91('0x11')][_0xbc91('0x12')])&&this[_0xbc91('0x11')][_0xbc91('0x12')][_0xbc91('0x13')]>0x0){for(var _0xb92600=0x0,_0x459d84;_0xb926000x0){for(var _0x465f5e=0x0,_0x29991a;_0x465f5e0x0&&_0x5ab79a[_0x58270c+_0x77da('0x23')]>=_0x5ab79a[_0x58270c+_0x77da('0x22')]){writeLog(_0x24aa8a,_0x5ab79a,_0x58270c[_0x77da('0x24')]()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0x77da('0x25')]=function(_0x167240,_0x470c9f,_0x36115b,_0x446ae7,_0x5997b6){return sendNotification(!![],_0x167240,_0x470c9f,_0x36115b,_0x446ae7,_0x5997b6);};exports[_0x77da('0x26')]=function(_0x3e090d,_0x1f2279,_0x2913f7,_0x496ecd,_0x5b4638){return sendNotification(![],_0x3e090d,_0x1f2279,_0x2913f7,_0x496ecd,_0x5b4638);};exports['writeLog']=writeLog; \ No newline at end of file +var _0x9957=['msg','getMustacheRender','notificationTemplate','error','[%s][QUEUE]\x20%s','message','format','save','isAgentAvailable','busy','online','OFFLINE','Pause','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','showNotification','hideNotification','lodash','util','../utils','ioredis','../../../../../config/logger','routing','redis','defaults','localhost','socket.io-emitter','user:%s','name','emit','user:save','split','\x20interaction','notificationSound','account','notificationShake','body','queue'];(function(_0x22bd5e,_0x48453d){var _0x49c31d=function(_0x846ca4){while(--_0x846ca4){_0x22bd5e['push'](_0x22bd5e['shift']());}};_0x49c31d(++_0x48453d);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var utils=require(_0x7995('0x2'));var Redis=require(_0x7995('0x3'));var config=require('../../../../../config/environment');var logger=require(_0x7995('0x4'))(_0x7995('0x5'));config[_0x7995('0x6')]=_[_0x7995('0x7')](config['redis'],{'host':_0x7995('0x8'),'port':0x18eb});var io=require(_0x7995('0x9'))(new Redis(config[_0x7995('0x6')]));function sendNotification(_0x219534,_0xbda126,_0x326741,_0x4996ca,_0x465276,_0x1cad37){io['to'](util['format'](_0x7995('0xa'),_0x4996ca[_0x7995('0xb')]))[_0x7995('0xc')](_0x7995('0xd'),_0x4996ca);var _0x3c1d19=_0x1cad37||{};var _0x1e400a=_0x326741[_0x7995('0xe')]('.');var _0x524f7b={'uniqueid':_0xbda126,'channel':_0x1e400a[0x0],'id':_0x1e400a[0x1],'title':_0x1e400a[0x0]+_0x7995('0xf'),'interactionId':_0x1e400a[0x2],'queue':_0x465276?_0x465276[_0x7995('0xb')]:null,'sound':_0x3c1d19['account'][_0x7995('0x10')],'shake':_0x3c1d19[_0x7995('0x11')][_0x7995('0x12')]};try{if(!_0x3c1d19[_0x7995('0x13')]){_0x3c1d19[_0x7995('0x13')]={};}if(_0x465276){_0x3c1d19[_0x7995('0x13')][_0x7995('0x14')]=_0x465276;}else if(_0x3c1d19['body']['queue']){delete _0x3c1d19[_0x7995('0x13')][_0x7995('0x14')];}_0x524f7b[_0x7995('0x15')]=utils[_0x7995('0x16')](_0x3c1d19[_0x7995('0x11')][_0x7995('0x17')],_0x3c1d19);}catch(_0x2202ce){_0x524f7b[_0x7995('0x15')]='I\x20can\x27t\x20render\x20your\x20template';logger[_0x7995('0x18')](util['format'](_0x7995('0x19'),_0xbda126,_0x2202ce[_0x7995('0x1a')]));}io['to'](util[_0x7995('0x1b')](_0x7995('0xa'),_0x4996ca[_0x7995('0xb')]))[_0x7995('0xc')](util['format']('notification:%s',_0x219534?_0x7995('0x1c'):'remove'),_0x524f7b);}function writeLog(_0x555f74,_0x3ec178,_0x3d463e){return logger['debug'](util[_0x7995('0x1b')]('[%s][QUEUE][AGENT:%s][STATUS:%s]',_0x555f74,_0x3ec178['name'],_0x3d463e));}exports[_0x7995('0x1d')]=function(_0x327b1f,_0x350fd9,_0x1a8568,_0x460924){if(_0x350fd9[_0x7995('0x1e')]){writeLog(_0x327b1f,_0x350fd9,'BUSY');return![];}if(!_0x350fd9[_0x7995('0x1f')]){writeLog(_0x327b1f,_0x350fd9,_0x7995('0x20'));return![];}if(_0x350fd9[_0x1a8568+_0x7995('0x21')]){writeLog(_0x327b1f,_0x350fd9,_0x7995('0x22'));return![];}if(_0x460924&&_0x350fd9[_0x7995('0x23')](_0x1a8568+_0x7995('0x24'))&&_0x350fd9[_0x7995('0x23')](_0x1a8568+_0x7995('0x25'))){if(_0x350fd9[_0x1a8568+'Capacity']>0x0&&_0x350fd9[_0x1a8568+_0x7995('0x25')]>=_0x350fd9[_0x1a8568+_0x7995('0x24')]){writeLog(_0x327b1f,_0x350fd9,_0x1a8568[_0x7995('0x26')]()+_0x7995('0x27'));return![];}}return!![];};exports[_0x7995('0x28')]=function(_0x2a307e,_0x56691a,_0x47625f,_0x5911c3,_0x229742){return sendNotification(!![],_0x2a307e,_0x56691a,_0x47625f,_0x5911c3,_0x229742);};exports[_0x7995('0x29')]=function(_0xf16cc2,_0x132a42,_0x11c1eb,_0x4b6f99,_0x9b2a15){return sendNotification(![],_0xf16cc2,_0x132a42,_0x11c1eb,_0x4b6f99,_0x9b2a15);};exports['writeLog']=writeLog; \ No newline at end of file diff --git a/server/services/routing/server/applications/system.js b/server/services/routing/server/applications/system.js index 6372d3d..3695301 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 _0x8e18=['body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','next','isObject','stringify','shelljs','./utils','../../../../config/logger','routing','consequence','validate','length','[%s][SYSTEM]\x20%s','message','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isEmpty','[%s][SYSTEM]\x20no\x20variable'];(function(_0x288466,_0x48b0a3){var _0x1274fd=function(_0x424105){while(--_0x424105){_0x288466['push'](_0x288466['shift']());}};_0x1274fd(++_0x48b0a3);}(_0x8e18,0x1ba));var _0x88e1=function(_0x10be9d,_0x1efff4){_0x10be9d=_0x10be9d-0x0;var _0x28a770=_0x8e18[_0x10be9d];return _0x28a770;};'use strict';var schema=require('validate');var sh=require(_0x88e1('0x0'));var _=require('lodash');var utils=require(_0x88e1('0x1'));var logger=require(_0x88e1('0x2'))(_0x88e1('0x3'));var system=schema({'command':{'type':'string','required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x88e1('0x4')]=function(_0x3a1c13,_0x21579e){return function(_0x4262ce){try{var _0xf4e5e6={'command':_0x21579e[0x0]};var _0x146671=system[_0x88e1('0x5')](_0xf4e5e6,{'typecast':!![]});if(_0x146671[_0x88e1('0x6')]){logger['error'](_0x88e1('0x7'),_0x3a1c13,_['map'](_0x146671,_0x88e1('0x8'))['join'](',\x20'));logger[_0x88e1('0x9')](_0x88e1('0xa'),_0x3a1c13);_0x4262ce['next']();}else{var _0x23cd0e=this;var _0x6acc15=utils['getMustacheRender'](_0x21579e[0x0],this);logger[_0x88e1('0x9')](_0x88e1('0xb'),_0x3a1c13,_0x6acc15);sh[_0x88e1('0xc')](_[_0x88e1('0xd')](_0x6acc15),function(_0x35922d,_0x57e3dc){logger[_0x88e1('0x9')](_0x88e1('0xe'),_0x3a1c13,_0x35922d);if(_0x35922d==0x0){var _0x48dcd1=_0x57e3dc[_0x88e1('0xf')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x21579e[0x1])||_[_0x88e1('0x10')](_0x21579e[0x1])){logger[_0x88e1('0x9')](_0x88e1('0x11'),_0x3a1c13);_0x23cd0e[_0x88e1('0x12')][_0x21579e[0x1]]=_0x48dcd1;}else{logger['info'](_0x88e1('0x13'),_0x3a1c13,_0x21579e[0x1],_0x48dcd1);_0x23cd0e['body'][_0x21579e[0x1]]=_0x48dcd1;}}_0x4262ce[_0x88e1('0x14')]();});}}catch(_0x4185db){logger['error']('[%s][SYSTEM]\x20%s',_0x3a1c13,_[_0x88e1('0x15')](_0x4185db)?JSON[_0x88e1('0x16')](_0x4185db):_0x4185db);logger[_0x88e1('0x9')](_0x88e1('0xa'),_0x3a1c13);_0x4262ce[_0x88e1('0x14')]();}};}; \ No newline at end of file +var _0xcff2=['[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','validate','shelljs','lodash','./utils','../../../../config/logger','routing','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','error','[%s][SYSTEM]\x20%s','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','exec','trim'];(function(_0x476991,_0x25cd7b){var _0x434e79=function(_0x4b3c4c){while(--_0x4b3c4c){_0x476991['push'](_0x476991['shift']());}};_0x434e79(++_0x25cd7b);}(_0xcff2,0x68));var _0x2cff=function(_0x2b8077,_0x453634){_0x2b8077=_0x2b8077-0x0;var _0x308091=_0xcff2[_0x2b8077];return _0x308091;};'use strict';var schema=require(_0x2cff('0x0'));var sh=require(_0x2cff('0x1'));var _=require(_0x2cff('0x2'));var utils=require(_0x2cff('0x3'));var logger=require(_0x2cff('0x4'))(_0x2cff('0x5'));var system=schema({'command':{'type':'string','required':!![],'message':_0x2cff('0x6')}});exports['consequence']=function(_0x52578b,_0x468a91){return function(_0x1eb8da){try{var _0x30fb13={'command':_0x468a91[0x0]};var _0x2175d6=system[_0x2cff('0x0')](_0x30fb13,{'typecast':!![]});if(_0x2175d6['length']){logger[_0x2cff('0x7')](_0x2cff('0x8'),_0x52578b,_[_0x2cff('0x9')](_0x2175d6,_0x2cff('0xa'))[_0x2cff('0xb')](',\x20'));logger[_0x2cff('0xc')](_0x2cff('0xd'),_0x52578b);_0x1eb8da['next']();}else{var _0x53bb6f=this;var _0x5e5892=utils['getMustacheRender'](_0x468a91[0x0],this);logger[_0x2cff('0xc')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x52578b,_0x5e5892);sh[_0x2cff('0xe')](_[_0x2cff('0xf')](_0x5e5892),function(_0x16d8f5,_0xc91c34){logger[_0x2cff('0xc')](_0x2cff('0x10'),_0x52578b,_0x16d8f5);if(_0x16d8f5==0x0){var _0x32402a=_0xc91c34[_0x2cff('0x11')](/(\r\n|\n|\r)/gm,'');if(_[_0x2cff('0x12')](_0x468a91[0x1])||_[_0x2cff('0x13')](_0x468a91[0x1])){logger[_0x2cff('0xc')](_0x2cff('0x14'),_0x52578b);_0x53bb6f[_0x2cff('0x15')][_0x468a91[0x1]]=_0x32402a;}else{logger[_0x2cff('0xc')](_0x2cff('0x16'),_0x52578b,_0x468a91[0x1],_0x32402a);_0x53bb6f[_0x2cff('0x15')][_0x468a91[0x1]]=_0x32402a;}}_0x1eb8da['next']();});}}catch(_0x467ca5){logger[_0x2cff('0x7')](_0x2cff('0x8'),_0x52578b,_[_0x2cff('0x17')](_0x467ca5)?JSON['stringify'](_0x467ca5):_0x467ca5);logger['info'](_0x2cff('0xd'),_0x52578b);_0x1eb8da['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 7c5c61e..7ba24b4 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 _0xe59d=['info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','channel','Interaction','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','stringify','next','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','error','[%s][TAG]\x20%s','map','message','join'];(function(_0x1d7188,_0x1b0a48){var _0x290bec=function(_0x1de55b){while(--_0x1de55b){_0x1d7188['push'](_0x1d7188['shift']());}};_0x290bec(++_0x1b0a48);}(_0xe59d,0x150));var _0xde59=function(_0x2b0267,_0x59cab1){_0x2b0267=_0x2b0267-0x0;var _0x289a4a=_0xe59d[_0x2b0267];return _0x289a4a;};'use strict';var schema=require(_0xde59('0x0'));var _=require(_0xde59('0x1'));var rpc={'chatInteraction':require(_0xde59('0x2')),'openchannelInteraction':require(_0xde59('0x3')),'smsInteraction':require(_0xde59('0x4')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0xde59('0x5'))};var logger=require(_0xde59('0x6'))(_0xde59('0x7'));var tag=schema({'tag':{'type':'number','required':!![],'message':_0xde59('0x8')}});exports['consequence']=function(_0x45ed80,_0x41f910,_0x3fb36b,_0x3b7fd2){return function(_0x2f6cbd){try{var _0x9c2943={'tag':_0x41f910[0x0]};var _0x3e5370=tag[_0xde59('0x0')](_0x9c2943,{'typecast':!![]});if(_0x3e5370[_0xde59('0x9')]){logger[_0xde59('0xa')](_0xde59('0xb'),_0x45ed80,_[_0xde59('0xc')](_0x3e5370,_0xde59('0xd'))[_0xde59('0xe')](',\x20'));logger[_0xde59('0xf')](_0xde59('0x10'),_0x45ed80);_0x2f6cbd['next']();}else{var _0x2b84a3={'ids':[_0x41f910[0x0]]};if(rpc[_0x3b7fd2[_0xde59('0x11')]+_0xde59('0x12')]){rpc[_0x3b7fd2[_0xde59('0x11')]+'Interaction'][_0xde59('0x13')](_0x3b7fd2[_0xde59('0x14')]['id'],_0x2b84a3)[_0xde59('0x15')](function(_0x3f81c3){logger[_0xde59('0xf')](_0xde59('0x16'),_0x45ed80,_0x41f910[0x1],_0x3b7fd2[_0xde59('0x11')],_0x3b7fd2[_0xde59('0x14')]['id']);})[_0xde59('0x17')](function(_0x1efe8c){logger[_0xde59('0xa')](_0xde59('0xb'),_0x45ed80,JSON[_0xde59('0x18')](_0x1efe8c));logger[_0xde59('0xf')](_0xde59('0x10'),_0x45ed80);})['finally'](function(){_0x2f6cbd[_0xde59('0x19')]();});}}}catch(_0x4b1bbb){logger[_0xde59('0xa')](_0xde59('0xb'),_0x45ed80,_[_0xde59('0x1a')](_0x4b1bbb)?JSON[_0xde59('0x18')](_0x4b1bbb):_0x4b1bbb);logger[_0xde59('0xf')](_0xde59('0x10'),_0x45ed80);_0x2f6cbd[_0xde59('0x19')]();}};}; \ No newline at end of file +var _0x1037=['error','map','message','join','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','interaction','then','info','[%s][TAG]\x20%s','isObject','stringify','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length'];(function(_0xe51cfb,_0x48f216){var _0x27d9e1=function(_0x11a4eb){while(--_0x11a4eb){_0xe51cfb['push'](_0xe51cfb['shift']());}};_0x27d9e1(++_0x48f216);}(_0x1037,0x8c));var _0x7103=function(_0x39e283,_0x247e6b){_0x39e283=_0x39e283-0x0;var _0x7de89f=_0x1037[_0x39e283];return _0x7de89f;};'use strict';var schema=require('validate');var _=require('lodash');var rpc={'chatInteraction':require(_0x7103('0x0')),'openchannelInteraction':require(_0x7103('0x1')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x7103('0x2')),'faxInteraction':require(_0x7103('0x3')),'whatsappInteraction':require(_0x7103('0x4'))};var logger=require(_0x7103('0x5'))(_0x7103('0x6'));var tag=schema({'tag':{'type':_0x7103('0x7'),'required':!![],'message':_0x7103('0x8')}});exports['consequence']=function(_0x307371,_0x3bb978,_0x5f18b3,_0x4735d1){return function(_0x3a47ea){try{var _0x106fe1={'tag':_0x3bb978[0x0]};var _0x13b92b=tag['validate'](_0x106fe1,{'typecast':!![]});if(_0x13b92b[_0x7103('0x9')]){logger[_0x7103('0xa')]('[%s][TAG]\x20%s',_0x307371,_[_0x7103('0xb')](_0x13b92b,_0x7103('0xc'))[_0x7103('0xd')](',\x20'));logger['info'](_0x7103('0xe'),_0x307371);_0x3a47ea[_0x7103('0xf')]();}else{var _0x44439e={'ids':[_0x3bb978[0x0]]};if(rpc[_0x4735d1[_0x7103('0x10')]+_0x7103('0x11')]){rpc[_0x4735d1[_0x7103('0x10')]+_0x7103('0x11')][_0x7103('0x12')](_0x4735d1[_0x7103('0x13')]['id'],_0x44439e)[_0x7103('0x14')](function(_0x91fd67){logger[_0x7103('0x15')]('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x307371,_0x3bb978[0x1],_0x4735d1[_0x7103('0x10')],_0x4735d1[_0x7103('0x13')]['id']);})['catch'](function(_0x967460){logger[_0x7103('0xa')]('[%s][TAG]\x20%s',_0x307371,JSON['stringify'](_0x967460));logger[_0x7103('0x15')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x307371);})['finally'](function(){_0x3a47ea[_0x7103('0xf')]();});}}}catch(_0x2398f7){logger[_0x7103('0xa')](_0x7103('0x16'),_0x307371,_[_0x7103('0x17')](_0x2398f7)?JSON[_0x7103('0x18')](_0x2398f7):_0x2398f7);logger[_0x7103('0x15')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x307371);_0x3a47ea[_0x7103('0xf')]();}};}; \ 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 1035db4..028bf78 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 _0xf57f=['method','POST','parse','result','logged','channelId=','&serviceId=','&data=','stringify','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','catch','error','isObject','stop','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','request-promise','../../../../config/logger','lodash','consequence','replace','\x20-\x20','includes','push','urlOnAnswer','?params=','urlOnRing','2.0'];(function(_0x7a78d7,_0x4aa57c){var _0x33a5da=function(_0x1f6cad){while(--_0x1f6cad){_0x7a78d7['push'](_0x7a78d7['shift']());}};_0x33a5da(++_0x4aa57c);}(_0xf57f,0x1da));var _0xff57=function(_0x1163a0,_0xfed5f4){_0x1163a0=_0x1163a0-0x0;var _0x1af53e=_0xf57f[_0x1163a0];return _0x1af53e;};'use strict';var rp=require(_0xff57('0x0'));var logger=require(_0xff57('0x1'))('routing');var _=require(_0xff57('0x2'));var arr=[];exports[_0xff57('0x3')]=function(_0x54fa9c,_0x196435){return function(_0x37fb25){var _0x1494f6=_0x196435[0xa];var _0x550fe1=_0x196435[0xb];var _0x223715=_0x196435[0xc];var _0x22df27=_0x196435[0xd];var _0x440594=_0x196435[0xe];var _0x2fb37d=_0x196435[0xf][_0xff57('0x4')](/\n/g,_0xff57('0x5'));var _0x329ca5=_0x196435[0x10][_0xff57('0x4')](/\n/g,'\x20');if(!arr[_0xff57('0x6')](_0x550fe1)){arr[_0xff57('0x7')](_0x550fe1);var _0x203378=_0x196435[0x3];var _0x5b0aa6=_0x196435[0x4];var _0x41b6c1=_0x196435[0x1];var _0xfda6b5=_0x196435[0x0];var _0x34e124={};_0x34e124[_0xff57('0x8')]=_0x196435[0x8]+_0xff57('0x9')+_0x223715+'|'+_0x1494f6+'|'+_0x22df27+'|'+_0x550fe1+'|'+_0x440594;_0x34e124[_0xff57('0xa')]=_0x196435[0x7]+_0xff57('0x9')+_0x223715+'|'+_0x1494f6+'|'+_0x22df27+'|'+_0x550fe1+'|'+_0x440594+'|'+_0x2fb37d+'|'+_0x329ca5;_0x34e124['title']=_0x196435[0x9];var _0x5adc4a={};_0x5adc4a['jsonrpc']=_0xff57('0xb');_0x5adc4a[_0xff57('0xc')]='login';var _0x18287a=[];_0x18287a[_0xff57('0x7')](_0x196435[0x2]);_0x18287a[_0xff57('0x7')](_0x196435[0x5]);_0x18287a[_0xff57('0x7')](_0x196435[0x6]);_0x5adc4a['params']=_0x18287a;_0x5adc4a['id']=0x1;var _0x4dbba7=JSON['stringify'](_0x5adc4a);var _0x55840a={'encoding':'utf8','method':_0xff57('0xd'),'timeout':0x2710,'url':_0x203378,'headers':{'Content-Type':'application/json-rpc'},'body':_0x4dbba7};return rp(_0x55840a)['then'](function(_0x405232){const _0x429888=JSON[_0xff57('0xe')](_0x405232);if(!_0x429888[_0xff57('0xf')][_0xff57('0x10')]){throw new Error('Unable\x20to\x20login\x20with\x20TVox\x20application');}var _0x130b42=_0x550fe1;var _0xbca7ef=_0xff57('0x11')+_0x41b6c1+_0xff57('0x12')+_0xfda6b5+'&sessionId='+_0x130b42+_0xff57('0x13')+JSON[_0xff57('0x14')](_0x34e124);var _0x5279d3=_0x5b0aa6+'?'+_0xbca7ef;return rp(_0x5279d3);})['then'](function(_0x1afe04){logger['info'](_0xff57('0x15'),_0x54fa9c,_0x1afe04);_0x37fb25['stop']();})[_0xff57('0x16')](function(_0xfd914e){logger[_0xff57('0x17')]('[%s][TVOX]\x20%s',_0x54fa9c,_[_0xff57('0x18')](_0xfd914e)?JSON[_0xff57('0x14')](_0xfd914e):_0xfd914e);_0x37fb25[_0xff57('0x19')]();});}else{logger['info'](_0xff57('0x1a'),_0x54fa9c);_0x37fb25['next']();}};}; \ No newline at end of file +var _0xc3b0=['&sessionId=','&data=','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','[%s][TVOX]\x20%s','isObject','next','request-promise','routing','lodash','consequence','replace','includes','push','urlOnAnswer','?params=','urlOnRing','jsonrpc','login','params','stringify','utf8','POST','application/json-rpc','then','result','&serviceId='];(function(_0x47ba4f,_0x5e7975){var _0x164006=function(_0x397dbf){while(--_0x397dbf){_0x47ba4f['push'](_0x47ba4f['shift']());}};_0x164006(++_0x5e7975);}(_0xc3b0,0x165));var _0x0c3b=function(_0x411803,_0x24db92){_0x411803=_0x411803-0x0;var _0x32c0e7=_0xc3b0[_0x411803];return _0x32c0e7;};'use strict';var rp=require(_0x0c3b('0x0'));var logger=require('../../../../config/logger')(_0x0c3b('0x1'));var _=require(_0x0c3b('0x2'));var arr=[];exports[_0x0c3b('0x3')]=function(_0x2add67,_0x23904d){return function(_0x68a8d3){var _0x289d83=_0x23904d[0xa];var _0x2860af=_0x23904d[0xb];var _0x451300=_0x23904d[0xc];var _0x120ab2=_0x23904d[0xd];var _0x467705=_0x23904d[0xe];var _0x30dd05=_0x23904d[0xf]['replace'](/\n/g,'\x20-\x20');var _0x102a88=_0x23904d[0x10][_0x0c3b('0x4')](/\n/g,'\x20');if(!arr[_0x0c3b('0x5')](_0x2860af)){arr[_0x0c3b('0x6')](_0x2860af);var _0x34b255=_0x23904d[0x3];var _0x4456d0=_0x23904d[0x4];var _0x28054b=_0x23904d[0x1];var _0x363159=_0x23904d[0x0];var _0x22b5c8={};_0x22b5c8[_0x0c3b('0x7')]=_0x23904d[0x8]+_0x0c3b('0x8')+_0x451300+'|'+_0x289d83+'|'+_0x120ab2+'|'+_0x2860af+'|'+_0x467705;_0x22b5c8[_0x0c3b('0x9')]=_0x23904d[0x7]+_0x0c3b('0x8')+_0x451300+'|'+_0x289d83+'|'+_0x120ab2+'|'+_0x2860af+'|'+_0x467705+'|'+_0x30dd05+'|'+_0x102a88;_0x22b5c8['title']=_0x23904d[0x9];var _0x2c8aee={};_0x2c8aee[_0x0c3b('0xa')]='2.0';_0x2c8aee['method']=_0x0c3b('0xb');var _0x3d5c47=[];_0x3d5c47[_0x0c3b('0x6')](_0x23904d[0x2]);_0x3d5c47['push'](_0x23904d[0x5]);_0x3d5c47[_0x0c3b('0x6')](_0x23904d[0x6]);_0x2c8aee[_0x0c3b('0xc')]=_0x3d5c47;_0x2c8aee['id']=0x1;var _0x2010c7=JSON[_0x0c3b('0xd')](_0x2c8aee);var _0x393dc1={'encoding':_0x0c3b('0xe'),'method':_0x0c3b('0xf'),'timeout':0x2710,'url':_0x34b255,'headers':{'Content-Type':_0x0c3b('0x10')},'body':_0x2010c7};return rp(_0x393dc1)[_0x0c3b('0x11')](function(_0x22146e){const _0xea36ec=JSON['parse'](_0x22146e);if(!_0xea36ec[_0x0c3b('0x12')]['logged']){throw new Error('Unable\x20to\x20login\x20with\x20TVox\x20application');}var _0xbb6990=_0x2860af;var _0x43bce0='channelId='+_0x28054b+_0x0c3b('0x13')+_0x363159+_0x0c3b('0x14')+_0xbb6990+_0x0c3b('0x15')+JSON[_0x0c3b('0xd')](_0x22b5c8);var _0xc0a9b7=_0x4456d0+'?'+_0x43bce0;return rp(_0xc0a9b7);})[_0x0c3b('0x11')](function(_0x219595){logger[_0x0c3b('0x16')](_0x0c3b('0x17'),_0x2add67,_0x219595);_0x68a8d3[_0x0c3b('0x18')]();})[_0x0c3b('0x19')](function(_0x273944){logger['error'](_0x0c3b('0x1a'),_0x2add67,_[_0x0c3b('0x1b')](_0x273944)?JSON[_0x0c3b('0xd')](_0x273944):_0x273944);_0x68a8d3[_0x0c3b('0x18')]();});}else{logger[_0x0c3b('0x16')]('[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next',_0x2add67);_0x68a8d3[_0x0c3b('0x1c')]();}};}; \ 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 0ed93c8..b980f5d 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0x3338a4,_0x3cc6db){var _0x1cb20c=function(_0x965f6f){while(--_0x965f6f){_0x3338a4['push'](_0x3338a4['shift']());}};_0x1cb20c(++_0x3cc6db);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'use strict';var Mustache=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'getMustacheRender':function(_0x5dd881,_0x550fbc){return Mustache[_0x0a9e('0x3')](_0x5dd881,_['merge'](_0x550fbc[_0x0a9e('0x4')],{'contact':_0x550fbc[_0x0a9e('0x5')],'message':_0x550fbc[_0x0a9e('0x6')],'account':_0x550fbc[_0x0a9e('0x7')],'interaction':_0x550fbc[_0x0a9e('0x8')],'list':_0x550fbc['list']}))||'';}}; \ No newline at end of file +var _0xd8b0=['merge','body','contact','message','list','mustache','lodash','render'];(function(_0x23ece7,_0x2032dd){var _0x493f75=function(_0x50bfa7){while(--_0x50bfa7){_0x23ece7['push'](_0x23ece7['shift']());}};_0x493f75(++_0x2032dd);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Mustache=require(_0x0d8b('0x0'));var _=require(_0x0d8b('0x1'));module['exports']={'getMustacheRender':function(_0x585166,_0x4b72b0){return Mustache[_0x0d8b('0x2')](_0x585166,_[_0x0d8b('0x3')](_0x4b72b0[_0x0d8b('0x4')],{'contact':_0x4b72b0[_0x0d8b('0x5')],'message':_0x4b72b0[_0x0d8b('0x6')],'account':_0x4b72b0['account'],'interaction':_0x4b72b0['interaction'],'list':_0x4b72b0[_0x0d8b('0x7')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 8a7fc61..b4517cc 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 _0x4d46=['openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','server','http','stringify','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','path','jayson/promise','bluebird','uuid','../../../config/environment','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','message','interaction','applications','isArray','length','existsSync','app','.js','toLowerCase','autoreply','appdata','split','push','slice','dialogflow','join','dialogflowv2','amazonlex','tag','TagId','getMustacheRender','account','ChatWebsiteId','ContactId','body','format','condition','./applications/','priority','info','Push\x20new\x20rule','on\x20interval','intervals','\x20|\x20','error','execute','Applications\x20executed','matchPath','emit','complete','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busyQueue','QueueReport','update','catch','error\x20update\x20queue\x20report','busy','message\x20is\x20empty','capacity','hasOwnProperty','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','loggedIn','paused','waiting','mailQueues','openchannelQueues','name','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions'];(function(_0x26b8c3,_0x24bca8){var _0x59dbc6=function(_0x53ee2e){while(--_0x53ee2e){_0x26b8c3['push'](_0x26b8c3['shift']());}};_0x59dbc6(++_0x24bca8);}(_0x4d46,0x197));var _0x64d4=function(_0x1519ec,_0x26ab64){_0x1519ec=_0x1519ec-0x0;var _0x4ebabc=_0x4d46[_0x1519ec];return _0x4ebabc;};'use strict';var _=require(_0x64d4('0x0'));var util=require(_0x64d4('0x1'));var path=require(_0x64d4('0x2'));var fs=require('fs');var jayson=require(_0x64d4('0x3'));var BPromise=require(_0x64d4('0x4'));var uuid=require(_0x64d4('0x5'));var utils=require('./applications/utils');var config=require(_0x64d4('0x6'));var logger=require(_0x64d4('0x7'))(_0x64d4('0x8'));var rpc={'openchannelQueueReport':require(_0x64d4('0x9')),'mailQueueReport':require(_0x64d4('0xa')),'chatQueueReport':require(_0x64d4('0xb')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0x64d4('0xc')),'whatsappQueueReport':require(_0x64d4('0xd'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x45158d,_0x34d00a,_0x54f161){return util['format']('%s.%s.%s',_0x45158d,_0x34d00a||0x0,_0x54f161||0x0);}function getIntervals(_0x4ce2cf,_0x56bfd2){var _0x2811fc=[];if(!_[_0x64d4('0xe')](_0x56bfd2[_0x64d4('0xf')])&&!_[_0x64d4('0xe')](_0x4ce2cf[_0x56bfd2[_0x64d4('0xf')]])&&!_[_0x64d4('0xe')](_0x4ce2cf[_0x56bfd2[_0x64d4('0xf')]][_0x64d4('0x10')])){_0x2811fc=_[_0x64d4('0x11')](_0x4ce2cf[_0x56bfd2['IntervalId']][_0x64d4('0x10')],'interval');}else if(!_[_0x64d4('0xe')](_0x56bfd2[_0x64d4('0x12')])){_0x2811fc=[_0x56bfd2[_0x64d4('0x12')]];}return _0x2811fc;}exports[_0x64d4('0x13')]=function(_0x13b111){_0x13b111[_0x64d4('0x14')]={};return new BPromise(function(_0x518d82,_0x2ab011){var _0x433af8={'Start':function(_0x4574c2){var _0x3a25a3=this;return new Promise(function(_0x1b005a,_0x156743){if(_0x4574c2){try{var _0xa8a81e=[];var _0x4b3335=getId(_0x4574c2[_0x64d4('0x15')],_0x4574c2[_0x64d4('0x16')]?_0x4574c2['message']['id']:0x0,_0x4574c2[_0x64d4('0x17')]?_0x4574c2[_0x64d4('0x17')]['id']:0x0);if(_0x4574c2[_0x64d4('0x18')]&&_[_0x64d4('0x19')](_0x4574c2[_0x64d4('0x18')])&&_0x4574c2[_0x64d4('0x18')][_0x64d4('0x1a')]){for(var _0x2549e9=0x0;_0x2549e9<_0x4574c2['applications'][_0x64d4('0x1a')];_0x2549e9+=0x1){var _0x46e926=_0x4574c2[_0x64d4('0x18')][_0x2549e9];if(fs[_0x64d4('0x1b')](path['join'](__dirname,'applications',_0x46e926[_0x64d4('0x1c')]+_0x64d4('0x1d')))){var _0x374119=[];switch(_0x46e926['app'][_0x64d4('0x1e')]()){case _0x64d4('0x1f'):var _0x244fde=_0x46e926[_0x64d4('0x20')][_0x64d4('0x21')](',');if(_0x4574c2[_0x64d4('0x15')]==='mail'){_0x374119[_0x64d4('0x22')](_0x244fde[0x0]);_0x374119[_0x64d4('0x22')](_0x244fde[0x1]);_0x374119[_0x64d4('0x22')](_0x244fde[_0x64d4('0x23')](0x2,_0x244fde['length'])['join'](','));}else{_0x374119['push'](_0x244fde[0x0]);_0x374119[_0x64d4('0x22')](_0x244fde['slice'](0x1,_0x244fde[_0x64d4('0x1a')])['join'](','));}break;case _0x64d4('0x24'):var _0x44eb42=_0x46e926[_0x64d4('0x20')][_0x64d4('0x21')](',');_0x374119[_0x64d4('0x22')](_0x44eb42[0x0]);_0x374119['push'](_0x44eb42[0x1]);_0x374119['push'](_0x44eb42[_0x64d4('0x23')](0x2,_0x44eb42[_0x64d4('0x1a')])[_0x64d4('0x25')](','));break;case _0x64d4('0x26'):var _0x77912e=_0x46e926[_0x64d4('0x20')][_0x64d4('0x21')](',');_0x374119['push'](_0x77912e[0x0]);_0x374119['push'](_0x77912e[0x1]);_0x374119[_0x64d4('0x22')](_0x77912e[0x2]);_0x374119[_0x64d4('0x22')](_0x77912e[0x3]);_0x374119['push'](_0x77912e[_0x64d4('0x23')](0x4,_0x77912e[_0x64d4('0x1a')])[_0x64d4('0x25')](','));break;case _0x64d4('0x27'):var _0x592825=_0x46e926['appdata'][_0x64d4('0x21')](',');_0x374119['push'](_0x592825[0x0]);_0x374119['push'](_0x592825[0x1]);_0x374119[_0x64d4('0x22')](_0x592825[0x2]);_0x374119[_0x64d4('0x22')](_0x592825[0x3]);_0x374119['push'](_0x592825[_0x64d4('0x23')](0x4,_0x592825['length'])[_0x64d4('0x25')](','));break;case _0x64d4('0x16'):_0x374119['push'](_0x46e926['appdata']);break;case _0x64d4('0x28'):_0x374119[_0x64d4('0x22')](_0x46e926[_0x64d4('0x29')]);_0x374119[_0x64d4('0x22')](_0x46e926[_0x64d4('0x20')]);break;case'tvox':var _0x11fa17=utils[_0x64d4('0x2a')](_0x4574c2[_0x64d4('0x2b')]['notificationTemplate'],_0x4574c2);var _0x5c0847=_0x46e926[_0x64d4('0x20')][_0x64d4('0x21')](',');_0x374119[_0x64d4('0x22')](_0x5c0847[0x0]);_0x374119[_0x64d4('0x22')](_0x5c0847[0x1]);_0x374119[_0x64d4('0x22')](_0x5c0847[0x2]);_0x374119[_0x64d4('0x22')](_0x5c0847[0x3]);_0x374119['push'](_0x5c0847[0x4]);_0x374119['push'](_0x5c0847[0x5]);_0x374119[_0x64d4('0x22')](_0x5c0847[0x6]);_0x374119[_0x64d4('0x22')](_0x5c0847[0x7]);_0x374119['push'](_0x5c0847[0x8]);_0x374119['push'](_0x5c0847[0x9]);_0x374119[_0x64d4('0x22')](_0x5c0847[0xa]);_0x374119['push'](_0x4574c2['interaction']['id']);_0x374119['push'](_0x4574c2['message']['id']);_0x374119[_0x64d4('0x22')](_0x46e926[_0x64d4('0x2c')]);_0x374119[_0x64d4('0x22')](_0x4574c2[_0x64d4('0x17')][_0x64d4('0x2d')]);_0x374119[_0x64d4('0x22')](_0x4574c2['body'][_0x64d4('0x2e')]);_0x374119[_0x64d4('0x22')](_0x11fa17);break;default:_0x374119=_[_0x64d4('0xe')](_0x46e926[_0x64d4('0x20')])?[]:_0x46e926[_0x64d4('0x20')][_0x64d4('0x21')](',');}var _0x2aeea6={'id':util[_0x64d4('0x2f')]('%s:%s:%s',_0x4b3335,_0x46e926['id'],_0x46e926[_0x64d4('0x1c')]),'condition':require('./interval')[_0x64d4('0x30')](_0x4b3335,getIntervals(_0x13b111['intervals'],_0x46e926),_0x13b111),'consequence':require(_0x64d4('0x31')+_0x46e926['app'])['consequence'](_0x4b3335,_0x374119,_0x13b111,_0x4574c2),'p':_0x46e926[_0x64d4('0x32')]||0x0};logger[_0x64d4('0x33')](_0x64d4('0x34'),_0x2aeea6['id'],_0x64d4('0x35'),getIntervals(_0x13b111[_0x64d4('0x36')],_0x46e926)[_0x64d4('0x25')](_0x64d4('0x37')));_0xa8a81e[_0x64d4('0x22')](_0x2aeea6);}else{logger[_0x64d4('0x38')]('Please\x20create\x20a\x20new\x20file\x20under',path[_0x64d4('0x25')](__dirname,_0x64d4('0x18'),_0x46e926[_0x64d4('0x1c')]+_0x64d4('0x1d')));}}_0x13b111['rules'][_0x4b3335]=new RuleEngine(_0xa8a81e);_0x13b111[_0x64d4('0x14')][_0x4b3335][_0x64d4('0x39')](_0x4574c2,function(_0x4c5857){logger['info'](_0x64d4('0x3a'),JSON['stringify'](_0x4c5857[_0x64d4('0x3b')]));if(_0x13b111['rules'][_0x4b3335]){_0x13b111[_0x64d4('0x14')][_0x4b3335][_0x64d4('0x3c')](_0x64d4('0x3d'));}});return _0x1b005a({'code':0xc8,'message':_0x4574c2});}else{logger['info'](_0x64d4('0x3e'));return _0x1b005a({'code':0xc8,'message':_0x4574c2});}}catch(_0x3cdc62){logger[_0x64d4('0x38')](_0x3cdc62[_0x64d4('0x3f')]);return _0x156743(_0x3a25a3[_0x64d4('0x38')](0x1f4,_0x3cdc62));}}return _0x156743(_0x64d4('0x40'));});},'AcceptMessage':function(_0x5d1ed1){var _0x2fd1a6=this;return new Promise(function(_0x2ba2cb,_0xb5b771){if(_0x5d1ed1[_0x64d4('0x41')]&&_0x5d1ed1['agent']['id']){if(_0x13b111[_0x64d4('0x42')][_0x5d1ed1[_0x64d4('0x41')]['id']]){_0x13b111[_0x64d4('0x42')][_0x5d1ed1[_0x64d4('0x41')]['id']]['busy']=![];_0x13b111['agents'][_0x5d1ed1[_0x64d4('0x41')]['id']][_0x64d4('0x43')]=undefined;}}if(_0x5d1ed1['message']&&_0x5d1ed1[_0x64d4('0x16')]['id']){try{var _0x24cee0=getId(_0x5d1ed1[_0x64d4('0x15')],_0x5d1ed1[_0x64d4('0x16')]?_0x5d1ed1['message']['id']:0x0,_0x5d1ed1[_0x64d4('0x17')]?_0x5d1ed1[_0x64d4('0x17')]['id']:0x0);if(_0x13b111[_0x64d4('0x14')][_0x24cee0]){_0x13b111[_0x64d4('0x14')][_0x24cee0][_0x64d4('0x3c')]('end');if(rpc[_0x5d1ed1[_0x64d4('0x15')]+_0x64d4('0x44')]){rpc[_0x5d1ed1['channel']+_0x64d4('0x44')][_0x64d4('0x45')](_0x24cee0,{'UserId':_0x5d1ed1[_0x64d4('0x16')]['UserId']})[_0x64d4('0x46')](function(_0x532f22){logger[_0x64d4('0x38')](_0x64d4('0x47'));});}}return _0x2ba2cb({'code':0xc8,'message':_0x5d1ed1});}catch(_0x26eaa8){logger[_0x64d4('0x38')](_0x26eaa8[_0x64d4('0x3f')]);return _0xb5b771(_0x2fd1a6[_0x64d4('0x38')](0x1f4,_0x26eaa8));}}logger[_0x64d4('0x38')]('message\x20is\x20empty');return _0xb5b771(_0x2fd1a6['error'](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x146489){var _0x32a8d8=this;return new Promise(function(_0x1e22a1,_0x41f8f4){if(_0x146489[_0x64d4('0x41')]&&_0x146489[_0x64d4('0x41')]['id']){try{if(_0x13b111['agents'][_0x146489[_0x64d4('0x41')]['id']]){_0x13b111[_0x64d4('0x42')][_0x146489[_0x64d4('0x41')]['id']][_0x64d4('0x48')]=![];_0x13b111[_0x64d4('0x42')][_0x146489[_0x64d4('0x41')]['id']][_0x64d4('0x43')]=undefined;}return _0x1e22a1({'code':0xc8,'message':_0x146489});}catch(_0x1e1414){logger['error'](_0x1e1414[_0x64d4('0x3f')]);return _0x41f8f4(_0x32a8d8[_0x64d4('0x38')](0x1f4,_0x1e1414));}}logger[_0x64d4('0x38')](_0x64d4('0x49'));return _0x41f8f4(_0x32a8d8[_0x64d4('0x38')](0x1f4,_0x64d4('0x49')));});},'AbandonInteraction':function(_0x293e2a){var _0x2a7ecc=this;return new Promise(function(_0x260597,_0x3ab444){if(_0x293e2a[_0x64d4('0x15')]&&_0x293e2a[_0x64d4('0x17')]&&_0x293e2a[_0x64d4('0x17')]['id']){try{var _0x3ba14e=getId(_0x293e2a[_0x64d4('0x15')],_0x293e2a[_0x64d4('0x16')]?_0x293e2a[_0x64d4('0x16')]['id']:0x0,_0x293e2a[_0x64d4('0x17')]?_0x293e2a[_0x64d4('0x17')]['id']:0x0);if(_0x13b111[_0x64d4('0x14')][_0x3ba14e]){_0x13b111[_0x64d4('0x14')][_0x3ba14e][_0x64d4('0x3c')]('end');}return _0x260597({'code':0xc8,'message':_0x293e2a});}catch(_0x54f061){logger[_0x64d4('0x38')](_0x54f061[_0x64d4('0x3f')]);return _0x3ab444(_0x2a7ecc['error'](0x1f4,_0x54f061));}}logger['error'](_0x64d4('0x49'));return _0x3ab444(_0x2a7ecc[_0x64d4('0x38')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0xe909e7){var _0x336df0=this;return new Promise(function(_0x39dc54,_0x38a7d3){if(_0x13b111[_0x64d4('0x42')]['hasOwnProperty'](_0xe909e7['id'])){for(var _0x8fe655 in _0xe909e7['capacity']){if(_0xe909e7[_0x64d4('0x4a')][_0x64d4('0x4b')](_0x8fe655)){if(_0x13b111[_0x64d4('0x42')][_0xe909e7['id']][_0x64d4('0x4b')](_0x8fe655+_0x64d4('0x4c'))){_0x13b111[_0x64d4('0x42')][_0xe909e7['id']][_0x8fe655+'CurrentCapacity']=parseInt(_0xe909e7[_0x64d4('0x4a')][_0x8fe655],0xa);}}}_0x13b111[_0x64d4('0x42')][_0xe909e7['id']][_0x64d4('0x4d')]();return _0x39dc54({'code':0xc8,'message':_0x13b111[_0x64d4('0x42')][_0xe909e7['id']]});}else{return _0x38a7d3(_0x336df0['error'](0x1f4,_0x64d4('0x4e')));}});},'Agents':function(_0x5470fd){return new Promise(function(_0x439be2,_0x47fc19){var _0x227215=_[_0x64d4('0x4f')](_0x13b111[_0x64d4('0x42')]);_0x439be2({'count':_0x227215[_0x64d4('0x1a')],'rows':_0x227215});});},'ChatQueues':function(_0x5ea427){return new Promise(function(_0xb49558,_0x53b82c){var _0x24d0c5=[];for(var _0x4d4864 in _0x13b111['chatQueues']){if(_0x13b111[_0x64d4('0x50')][_0x64d4('0x4b')](_0x4d4864)){var _0x3fd083=_0x13b111['chatQueues'][_0x4d4864];var _0x2b71bd={'id':_0x3fd083['id'],'available':_0x3fd083[_0x64d4('0x51')],'loggedIn':_0x3fd083[_0x64d4('0x52')],'name':_0x3fd083['name'],'paused':_0x3fd083[_0x64d4('0x53')],'waiting':_0x3fd083[_0x64d4('0x54')]};_0x24d0c5['push'](_0x2b71bd);}}_0xb49558({'count':_0x24d0c5[_0x64d4('0x1a')],'rows':_0x24d0c5});});},'MailQueues':function(_0x2fc57b){return new Promise(function(_0x51267d,_0x184738){var _0x12d2ca=[];for(var _0x2785ad in _0x13b111[_0x64d4('0x55')]){if(_0x13b111['mailQueues'][_0x64d4('0x4b')](_0x2785ad)){var _0x3ce0d0=_0x13b111[_0x64d4('0x55')][_0x2785ad];var _0x566638={'id':_0x3ce0d0['id'],'available':_0x3ce0d0[_0x64d4('0x51')],'loggedIn':_0x3ce0d0[_0x64d4('0x52')],'name':_0x3ce0d0['name'],'paused':_0x3ce0d0[_0x64d4('0x53')],'waiting':_0x3ce0d0[_0x64d4('0x54')]};_0x12d2ca[_0x64d4('0x22')](_0x566638);}}_0x51267d({'count':_0x12d2ca[_0x64d4('0x1a')],'rows':_0x12d2ca});});},'OpenchannelQueues':function(_0x169d4f){return new Promise(function(_0x73c224,_0x38c832){var _0x34b022=[];for(var _0x127f17 in _0x13b111['openchannelQueues']){if(_0x13b111[_0x64d4('0x56')][_0x64d4('0x4b')](_0x127f17)){var _0x151f2d=_0x13b111[_0x64d4('0x56')][_0x127f17];var _0x41dd50={'id':_0x151f2d['id'],'available':_0x151f2d[_0x64d4('0x51')],'loggedIn':_0x151f2d[_0x64d4('0x52')],'name':_0x151f2d[_0x64d4('0x57')],'paused':_0x151f2d[_0x64d4('0x53')],'waiting':_0x151f2d['waiting']};_0x34b022[_0x64d4('0x22')](_0x41dd50);}}_0x73c224({'count':_0x34b022[_0x64d4('0x1a')],'rows':_0x34b022});});},'SmsQueues':function(_0x10c130){return new Promise(function(_0x5dc380,_0x2cc617){var _0x3d94ac=[];for(var _0x126371 in _0x13b111['smsQueues']){if(_0x13b111['smsQueues'][_0x64d4('0x4b')](_0x126371)){var _0x4b3ef9=_0x13b111[_0x64d4('0x58')][_0x126371];var _0x1c39a2={'id':_0x4b3ef9['id'],'available':_0x4b3ef9[_0x64d4('0x51')],'loggedIn':_0x4b3ef9[_0x64d4('0x52')],'name':_0x4b3ef9['name'],'paused':_0x4b3ef9[_0x64d4('0x53')],'waiting':_0x4b3ef9[_0x64d4('0x54')]};_0x3d94ac[_0x64d4('0x22')](_0x1c39a2);}}_0x5dc380({'count':_0x3d94ac[_0x64d4('0x1a')],'rows':_0x3d94ac});});},'FaxQueues':function(_0x375e60){return new Promise(function(_0x4701fc,_0x369c52){var _0x2e2189=[];for(var _0x4e9e90 in _0x13b111[_0x64d4('0x59')]){if(_0x13b111[_0x64d4('0x59')][_0x64d4('0x4b')](_0x4e9e90)){var _0x8bb4f=_0x13b111[_0x64d4('0x59')][_0x4e9e90];var _0x3bff0a={'id':_0x8bb4f['id'],'available':_0x8bb4f['available'],'loggedIn':_0x8bb4f[_0x64d4('0x52')],'name':_0x8bb4f['name'],'paused':_0x8bb4f[_0x64d4('0x53')],'waiting':_0x8bb4f['waiting']};_0x2e2189[_0x64d4('0x22')](_0x3bff0a);}}_0x4701fc({'count':_0x2e2189['length'],'rows':_0x2e2189});});},'WhatsappQueues':function(_0x46e2fa){return new Promise(function(_0x3d4b9f,_0x2a50be){var _0x543e28=[];for(var _0x2268df in _0x13b111[_0x64d4('0x5a')]){if(_0x13b111[_0x64d4('0x5a')][_0x64d4('0x4b')](_0x2268df)){var _0x4b19a6=_0x13b111['whatsappQueues'][_0x2268df];var _0x4db603={'id':_0x4b19a6['id'],'available':_0x4b19a6['available'],'loggedIn':_0x4b19a6['loggedIn'],'name':_0x4b19a6[_0x64d4('0x57')],'paused':_0x4b19a6[_0x64d4('0x53')],'waiting':_0x4b19a6[_0x64d4('0x54')]};_0x543e28['push'](_0x4db603);}}_0x3d4b9f({'count':_0x543e28[_0x64d4('0x1a')],'rows':_0x543e28});});},'ChatQueuesWaitingInteractions':function(_0x21916f){return new Promise(function(_0x3fc18f,_0x519ea5){var _0x3df418=_[_0x64d4('0x4f')](_0x13b111[_0x64d4('0x5b')]);_0x3fc18f({'count':_0x3df418[_0x64d4('0x1a')],'rows':_0x3df418});});},'MailQueuesWaitingInteractions':function(_0x4097bd){return new Promise(function(_0x2fa315,_0x38d716){var _0x111d4f=_[_0x64d4('0x4f')](_0x13b111[_0x64d4('0x5c')]);_0x2fa315({'count':_0x111d4f[_0x64d4('0x1a')],'rows':_0x111d4f});});},'OpenchannelQueuesWaitingInteractions':function(_0x48a2e3){return new Promise(function(_0x33699b,_0x448376){var _0x379c99=_[_0x64d4('0x4f')](_0x13b111[_0x64d4('0x5d')]);_0x33699b({'count':_0x379c99['length'],'rows':_0x379c99});});},'SmsQueuesWaitingInteractions':function(_0x48a180){return new Promise(function(_0x2b47c3,_0x5c23e5){var _0x101d5c=_[_0x64d4('0x4f')](_0x13b111[_0x64d4('0x5e')]);_0x2b47c3({'count':_0x101d5c['length'],'rows':_0x101d5c});});},'FaxQueuesWaitingInteractions':function(_0x1c4f03){return new Promise(function(_0x3e65b4,_0x5464b4){var _0x32037a=_[_0x64d4('0x4f')](_0x13b111['faxQueuesWaitingInteractions']);_0x3e65b4({'count':_0x32037a[_0x64d4('0x1a')],'rows':_0x32037a});});},'WhatsappQueuesWaitingInteractions':function(_0x5ab6d8){return new Promise(function(_0x2f386b,_0x504086){var _0x19a9ac=_[_0x64d4('0x4f')](_0x13b111['whatsappQueuesWaitingInteractions']);_0x2f386b({'count':_0x19a9ac[_0x64d4('0x1a')],'rows':_0x19a9ac});});}};var _0x565610=jayson[_0x64d4('0x5f')](_0x433af8)[_0x64d4('0x60')]();_0x565610['on'](_0x64d4('0x38'),function(_0x32fbb9){logger[_0x64d4('0x38')](JSON[_0x64d4('0x61')](_0x32fbb9));return _0x2ab011(_0x32fbb9);});_0x565610[_0x64d4('0x13')](0x232c,'127.0.0.1',function(){console[_0x64d4('0x62')](_0x64d4('0x63'),0x232c);return _0x518d82('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file +var _0x6282=['loggedIn','smsQueues','faxQueues','whatsappQueues','values','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','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','util','path','jayson/promise','./applications/utils','../../../config/environment','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','map','Intervals','interval','listen','rules','channel','message','interaction','applications','isArray','existsSync','join','app','.js','autoreply','appdata','split','push','slice','length','dialogflow','dialogflowv2','amazonlex','tag','TagId','tvox','getMustacheRender','notificationTemplate','ChatWebsiteId','ContactId','body','%s:%s:%s','./interval','condition','intervals','./applications/','priority','on\x20interval','\x20|\x20','Please\x20create\x20a\x20new\x20file\x20under','info','Applications\x20executed','stringify','emit','No\x20applications\x20to\x20execute','error','routing\x20is\x20empty','agent','agents','busyQueue','QueueReport','update','UserId','error\x20update\x20queue\x20report','stack','message\x20is\x20empty','busy','end','hasOwnProperty','capacity','CurrentCapacity','agent\x20not\x20found','chatQueues','name','paused','mailQueues','available','waiting','openchannelQueues'];(function(_0x5e9728,_0x22107d){var _0x38a19b=function(_0x8fc980){while(--_0x8fc980){_0x5e9728['push'](_0x5e9728['shift']());}};_0x38a19b(++_0x22107d);}(_0x6282,0x76));var _0x2628=function(_0x2f7407,_0x41b5b1){_0x2f7407=_0x2f7407-0x0;var _0x1b85f6=_0x6282[_0x2f7407];return _0x1b85f6;};'use strict';var _=require(_0x2628('0x0'));var util=require(_0x2628('0x1'));var path=require(_0x2628('0x2'));var fs=require('fs');var jayson=require(_0x2628('0x3'));var BPromise=require('bluebird');var uuid=require('uuid');var utils=require(_0x2628('0x4'));var config=require(_0x2628('0x5'));var logger=require('../../../config/logger')(_0x2628('0x6'));var rpc={'openchannelQueueReport':require(_0x2628('0x7')),'mailQueueReport':require(_0x2628('0x8')),'chatQueueReport':require(_0x2628('0x9')),'smsQueueReport':require(_0x2628('0xa')),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require(_0x2628('0xb'))};var RuleEngine=require(_0x2628('0xc'));function getId(_0x2170a7,_0xbae7c3,_0x3d320c){return util[_0x2628('0xd')](_0x2628('0xe'),_0x2170a7,_0xbae7c3||0x0,_0x3d320c||0x0);}function getIntervals(_0x1d12a5,_0x3f9015){var _0xd7d01=[];if(!_[_0x2628('0xf')](_0x3f9015[_0x2628('0x10')])&&!_[_0x2628('0xf')](_0x1d12a5[_0x3f9015[_0x2628('0x10')]])&&!_[_0x2628('0xf')](_0x1d12a5[_0x3f9015['IntervalId']]['Intervals'])){_0xd7d01=_[_0x2628('0x11')](_0x1d12a5[_0x3f9015[_0x2628('0x10')]][_0x2628('0x12')],_0x2628('0x13'));}else if(!_['isNil'](_0x3f9015['interval'])){_0xd7d01=[_0x3f9015[_0x2628('0x13')]];}return _0xd7d01;}exports[_0x2628('0x14')]=function(_0x4d2cfb){_0x4d2cfb[_0x2628('0x15')]={};return new BPromise(function(_0x2f59ca,_0x513aee){var _0x645884={'Start':function(_0x16e67a){var _0x457163=this;return new Promise(function(_0x4f418d,_0x13a728){if(_0x16e67a){try{var _0x1551e4=[];var _0x51df16=getId(_0x16e67a[_0x2628('0x16')],_0x16e67a['message']?_0x16e67a[_0x2628('0x17')]['id']:0x0,_0x16e67a[_0x2628('0x18')]?_0x16e67a['interaction']['id']:0x0);if(_0x16e67a[_0x2628('0x19')]&&_[_0x2628('0x1a')](_0x16e67a['applications'])&&_0x16e67a[_0x2628('0x19')]['length']){for(var _0x2066ec=0x0;_0x2066ec<_0x16e67a['applications']['length'];_0x2066ec+=0x1){var _0xcf0862=_0x16e67a[_0x2628('0x19')][_0x2066ec];if(fs[_0x2628('0x1b')](path[_0x2628('0x1c')](__dirname,_0x2628('0x19'),_0xcf0862[_0x2628('0x1d')]+_0x2628('0x1e')))){var _0x41c2ba=[];switch(_0xcf0862[_0x2628('0x1d')]['toLowerCase']()){case _0x2628('0x1f'):var _0x267647=_0xcf0862[_0x2628('0x20')][_0x2628('0x21')](',');if(_0x16e67a[_0x2628('0x16')]==='mail'){_0x41c2ba[_0x2628('0x22')](_0x267647[0x0]);_0x41c2ba[_0x2628('0x22')](_0x267647[0x1]);_0x41c2ba[_0x2628('0x22')](_0x267647[_0x2628('0x23')](0x2,_0x267647[_0x2628('0x24')])['join'](','));}else{_0x41c2ba['push'](_0x267647[0x0]);_0x41c2ba[_0x2628('0x22')](_0x267647[_0x2628('0x23')](0x1,_0x267647[_0x2628('0x24')])[_0x2628('0x1c')](','));}break;case _0x2628('0x25'):var _0x571711=_0xcf0862[_0x2628('0x20')][_0x2628('0x21')](',');_0x41c2ba[_0x2628('0x22')](_0x571711[0x0]);_0x41c2ba[_0x2628('0x22')](_0x571711[0x1]);_0x41c2ba[_0x2628('0x22')](_0x571711[_0x2628('0x23')](0x2,_0x571711['length'])['join'](','));break;case _0x2628('0x26'):var _0x29ffee=_0xcf0862[_0x2628('0x20')][_0x2628('0x21')](',');_0x41c2ba['push'](_0x29ffee[0x0]);_0x41c2ba[_0x2628('0x22')](_0x29ffee[0x1]);_0x41c2ba[_0x2628('0x22')](_0x29ffee[0x2]);_0x41c2ba[_0x2628('0x22')](_0x29ffee[0x3]);_0x41c2ba[_0x2628('0x22')](_0x29ffee['slice'](0x4,_0x29ffee[_0x2628('0x24')])[_0x2628('0x1c')](','));break;case _0x2628('0x27'):var _0x19530e=_0xcf0862['appdata'][_0x2628('0x21')](',');_0x41c2ba[_0x2628('0x22')](_0x19530e[0x0]);_0x41c2ba[_0x2628('0x22')](_0x19530e[0x1]);_0x41c2ba[_0x2628('0x22')](_0x19530e[0x2]);_0x41c2ba[_0x2628('0x22')](_0x19530e[0x3]);_0x41c2ba[_0x2628('0x22')](_0x19530e[_0x2628('0x23')](0x4,_0x19530e[_0x2628('0x24')])[_0x2628('0x1c')](','));break;case'message':_0x41c2ba[_0x2628('0x22')](_0xcf0862[_0x2628('0x20')]);break;case _0x2628('0x28'):_0x41c2ba[_0x2628('0x22')](_0xcf0862[_0x2628('0x29')]);_0x41c2ba['push'](_0xcf0862['appdata']);break;case _0x2628('0x2a'):var _0x42930c=utils[_0x2628('0x2b')](_0x16e67a['account'][_0x2628('0x2c')],_0x16e67a);var _0x187327=_0xcf0862[_0x2628('0x20')]['split'](',');_0x41c2ba[_0x2628('0x22')](_0x187327[0x0]);_0x41c2ba[_0x2628('0x22')](_0x187327[0x1]);_0x41c2ba[_0x2628('0x22')](_0x187327[0x2]);_0x41c2ba['push'](_0x187327[0x3]);_0x41c2ba['push'](_0x187327[0x4]);_0x41c2ba['push'](_0x187327[0x5]);_0x41c2ba['push'](_0x187327[0x6]);_0x41c2ba[_0x2628('0x22')](_0x187327[0x7]);_0x41c2ba[_0x2628('0x22')](_0x187327[0x8]);_0x41c2ba[_0x2628('0x22')](_0x187327[0x9]);_0x41c2ba['push'](_0x187327[0xa]);_0x41c2ba[_0x2628('0x22')](_0x16e67a[_0x2628('0x18')]['id']);_0x41c2ba[_0x2628('0x22')](_0x16e67a['message']['id']);_0x41c2ba[_0x2628('0x22')](_0xcf0862[_0x2628('0x2d')]);_0x41c2ba[_0x2628('0x22')](_0x16e67a[_0x2628('0x18')][_0x2628('0x2e')]);_0x41c2ba[_0x2628('0x22')](_0x16e67a[_0x2628('0x2f')]['body']);_0x41c2ba[_0x2628('0x22')](_0x42930c);break;default:_0x41c2ba=_[_0x2628('0xf')](_0xcf0862[_0x2628('0x20')])?[]:_0xcf0862[_0x2628('0x20')][_0x2628('0x21')](',');}var _0x2bc23f={'id':util['format'](_0x2628('0x30'),_0x51df16,_0xcf0862['id'],_0xcf0862['app']),'condition':require(_0x2628('0x31'))[_0x2628('0x32')](_0x51df16,getIntervals(_0x4d2cfb[_0x2628('0x33')],_0xcf0862),_0x4d2cfb),'consequence':require(_0x2628('0x34')+_0xcf0862[_0x2628('0x1d')])['consequence'](_0x51df16,_0x41c2ba,_0x4d2cfb,_0x16e67a),'p':_0xcf0862[_0x2628('0x35')]||0x0};logger['info']('Push\x20new\x20rule',_0x2bc23f['id'],_0x2628('0x36'),getIntervals(_0x4d2cfb[_0x2628('0x33')],_0xcf0862)[_0x2628('0x1c')](_0x2628('0x37')));_0x1551e4[_0x2628('0x22')](_0x2bc23f);}else{logger['error'](_0x2628('0x38'),path[_0x2628('0x1c')](__dirname,_0x2628('0x19'),_0xcf0862[_0x2628('0x1d')]+_0x2628('0x1e')));}}_0x4d2cfb['rules'][_0x51df16]=new RuleEngine(_0x1551e4);_0x4d2cfb[_0x2628('0x15')][_0x51df16]['execute'](_0x16e67a,function(_0x39b67d){logger[_0x2628('0x39')](_0x2628('0x3a'),JSON[_0x2628('0x3b')](_0x39b67d['matchPath']));if(_0x4d2cfb['rules'][_0x51df16]){_0x4d2cfb[_0x2628('0x15')][_0x51df16][_0x2628('0x3c')]('complete');}});return _0x4f418d({'code':0xc8,'message':_0x16e67a});}else{logger[_0x2628('0x39')](_0x2628('0x3d'));return _0x4f418d({'code':0xc8,'message':_0x16e67a});}}catch(_0x39560e){logger[_0x2628('0x3e')](_0x39560e['stack']);return _0x13a728(_0x457163[_0x2628('0x3e')](0x1f4,_0x39560e));}}return _0x13a728(_0x2628('0x3f'));});},'AcceptMessage':function(_0x1a34ee){var _0x29847f=this;return new Promise(function(_0x166b92,_0xc7f79f){if(_0x1a34ee[_0x2628('0x40')]&&_0x1a34ee[_0x2628('0x40')]['id']){if(_0x4d2cfb['agents'][_0x1a34ee[_0x2628('0x40')]['id']]){_0x4d2cfb['agents'][_0x1a34ee[_0x2628('0x40')]['id']]['busy']=![];_0x4d2cfb[_0x2628('0x41')][_0x1a34ee[_0x2628('0x40')]['id']][_0x2628('0x42')]=undefined;}}if(_0x1a34ee[_0x2628('0x17')]&&_0x1a34ee[_0x2628('0x17')]['id']){try{var _0x4a60e0=getId(_0x1a34ee[_0x2628('0x16')],_0x1a34ee['message']?_0x1a34ee[_0x2628('0x17')]['id']:0x0,_0x1a34ee[_0x2628('0x18')]?_0x1a34ee[_0x2628('0x18')]['id']:0x0);if(_0x4d2cfb['rules'][_0x4a60e0]){_0x4d2cfb[_0x2628('0x15')][_0x4a60e0][_0x2628('0x3c')]('end');if(rpc[_0x1a34ee[_0x2628('0x16')]+_0x2628('0x43')]){rpc[_0x1a34ee[_0x2628('0x16')]+_0x2628('0x43')][_0x2628('0x44')](_0x4a60e0,{'UserId':_0x1a34ee['message'][_0x2628('0x45')]})['catch'](function(_0x307ab6){logger[_0x2628('0x3e')](_0x2628('0x46'));});}}return _0x166b92({'code':0xc8,'message':_0x1a34ee});}catch(_0x9ac767){logger[_0x2628('0x3e')](_0x9ac767[_0x2628('0x47')]);return _0xc7f79f(_0x29847f[_0x2628('0x3e')](0x1f4,_0x9ac767));}}logger['error'](_0x2628('0x48'));return _0xc7f79f(_0x29847f[_0x2628('0x3e')](0x1f4,_0x2628('0x48')));});},'RejectMessage':function(_0x403c78){var _0x1838c7=this;return new Promise(function(_0x426538,_0x1aa06a){if(_0x403c78[_0x2628('0x40')]&&_0x403c78[_0x2628('0x40')]['id']){try{if(_0x4d2cfb['agents'][_0x403c78['agent']['id']]){_0x4d2cfb[_0x2628('0x41')][_0x403c78[_0x2628('0x40')]['id']][_0x2628('0x49')]=![];_0x4d2cfb[_0x2628('0x41')][_0x403c78[_0x2628('0x40')]['id']]['busyQueue']=undefined;}return _0x426538({'code':0xc8,'message':_0x403c78});}catch(_0x5b8882){logger[_0x2628('0x3e')](_0x5b8882['stack']);return _0x1aa06a(_0x1838c7[_0x2628('0x3e')](0x1f4,_0x5b8882));}}logger[_0x2628('0x3e')](_0x2628('0x48'));return _0x1aa06a(_0x1838c7[_0x2628('0x3e')](0x1f4,_0x2628('0x48')));});},'AbandonInteraction':function(_0x2e677){var _0x158831=this;return new Promise(function(_0x35c19c,_0x227cba){if(_0x2e677[_0x2628('0x16')]&&_0x2e677[_0x2628('0x18')]&&_0x2e677[_0x2628('0x18')]['id']){try{var _0x8d450=getId(_0x2e677[_0x2628('0x16')],_0x2e677[_0x2628('0x17')]?_0x2e677[_0x2628('0x17')]['id']:0x0,_0x2e677[_0x2628('0x18')]?_0x2e677[_0x2628('0x18')]['id']:0x0);if(_0x4d2cfb[_0x2628('0x15')][_0x8d450]){_0x4d2cfb[_0x2628('0x15')][_0x8d450][_0x2628('0x3c')](_0x2628('0x4a'));}return _0x35c19c({'code':0xc8,'message':_0x2e677});}catch(_0x4af3ec){logger[_0x2628('0x3e')](_0x4af3ec[_0x2628('0x47')]);return _0x227cba(_0x158831['error'](0x1f4,_0x4af3ec));}}logger[_0x2628('0x3e')](_0x2628('0x48'));return _0x227cba(_0x158831[_0x2628('0x3e')](0x1f4,_0x2628('0x48')));});},'AgentCapacity':function(_0x13187b){var _0x12b166=this;return new Promise(function(_0x20ed7c,_0x167cd1){if(_0x4d2cfb['agents'][_0x2628('0x4b')](_0x13187b['id'])){for(var _0x38c0bc in _0x13187b[_0x2628('0x4c')]){if(_0x13187b['capacity'][_0x2628('0x4b')](_0x38c0bc)){if(_0x4d2cfb[_0x2628('0x41')][_0x13187b['id']][_0x2628('0x4b')](_0x38c0bc+_0x2628('0x4d'))){_0x4d2cfb[_0x2628('0x41')][_0x13187b['id']][_0x38c0bc+_0x2628('0x4d')]=parseInt(_0x13187b[_0x2628('0x4c')][_0x38c0bc],0xa);}}}_0x4d2cfb['agents'][_0x13187b['id']]['updateRealtime']();return _0x20ed7c({'code':0xc8,'message':_0x4d2cfb['agents'][_0x13187b['id']]});}else{return _0x167cd1(_0x12b166[_0x2628('0x3e')](0x1f4,_0x2628('0x4e')));}});},'Agents':function(_0x4ba90b){return new Promise(function(_0x1bbb9a,_0x36bcaf){var _0x35f400=_['values'](_0x4d2cfb['agents']);_0x1bbb9a({'count':_0x35f400['length'],'rows':_0x35f400});});},'ChatQueues':function(_0x54f9c0){return new Promise(function(_0x3a3477,_0x1d7ad0){var _0x160484=[];for(var _0x2e388b in _0x4d2cfb[_0x2628('0x4f')]){if(_0x4d2cfb['chatQueues']['hasOwnProperty'](_0x2e388b)){var _0x4c77a2=_0x4d2cfb[_0x2628('0x4f')][_0x2e388b];var _0xe5b565={'id':_0x4c77a2['id'],'available':_0x4c77a2['available'],'loggedIn':_0x4c77a2['loggedIn'],'name':_0x4c77a2[_0x2628('0x50')],'paused':_0x4c77a2[_0x2628('0x51')],'waiting':_0x4c77a2['waiting']};_0x160484[_0x2628('0x22')](_0xe5b565);}}_0x3a3477({'count':_0x160484[_0x2628('0x24')],'rows':_0x160484});});},'MailQueues':function(_0x4623f9){return new Promise(function(_0x49f25b,_0x5e987a){var _0xdbd0ef=[];for(var _0x16e88e in _0x4d2cfb['mailQueues']){if(_0x4d2cfb[_0x2628('0x52')][_0x2628('0x4b')](_0x16e88e)){var _0x13580f=_0x4d2cfb['mailQueues'][_0x16e88e];var _0x3f8c1f={'id':_0x13580f['id'],'available':_0x13580f[_0x2628('0x53')],'loggedIn':_0x13580f['loggedIn'],'name':_0x13580f[_0x2628('0x50')],'paused':_0x13580f[_0x2628('0x51')],'waiting':_0x13580f[_0x2628('0x54')]};_0xdbd0ef[_0x2628('0x22')](_0x3f8c1f);}}_0x49f25b({'count':_0xdbd0ef['length'],'rows':_0xdbd0ef});});},'OpenchannelQueues':function(_0x7fab14){return new Promise(function(_0xdfddbe,_0x2d7837){var _0x4a2190=[];for(var _0x5aae96 in _0x4d2cfb['openchannelQueues']){if(_0x4d2cfb[_0x2628('0x55')][_0x2628('0x4b')](_0x5aae96)){var _0x54f46f=_0x4d2cfb[_0x2628('0x55')][_0x5aae96];var _0x4a7008={'id':_0x54f46f['id'],'available':_0x54f46f['available'],'loggedIn':_0x54f46f[_0x2628('0x56')],'name':_0x54f46f[_0x2628('0x50')],'paused':_0x54f46f['paused'],'waiting':_0x54f46f[_0x2628('0x54')]};_0x4a2190[_0x2628('0x22')](_0x4a7008);}}_0xdfddbe({'count':_0x4a2190[_0x2628('0x24')],'rows':_0x4a2190});});},'SmsQueues':function(_0x21ecd2){return new Promise(function(_0x121435,_0x2957ff){var _0x59e8d0=[];for(var _0x35ad7c in _0x4d2cfb['smsQueues']){if(_0x4d2cfb[_0x2628('0x57')]['hasOwnProperty'](_0x35ad7c)){var _0x2ad999=_0x4d2cfb[_0x2628('0x57')][_0x35ad7c];var _0x24d571={'id':_0x2ad999['id'],'available':_0x2ad999[_0x2628('0x53')],'loggedIn':_0x2ad999[_0x2628('0x56')],'name':_0x2ad999[_0x2628('0x50')],'paused':_0x2ad999[_0x2628('0x51')],'waiting':_0x2ad999[_0x2628('0x54')]};_0x59e8d0[_0x2628('0x22')](_0x24d571);}}_0x121435({'count':_0x59e8d0[_0x2628('0x24')],'rows':_0x59e8d0});});},'FaxQueues':function(_0x2676ce){return new Promise(function(_0x3ce557,_0x37178e){var _0x254007=[];for(var _0x454497 in _0x4d2cfb['faxQueues']){if(_0x4d2cfb[_0x2628('0x58')][_0x2628('0x4b')](_0x454497)){var _0x443456=_0x4d2cfb[_0x2628('0x58')][_0x454497];var _0x20821e={'id':_0x443456['id'],'available':_0x443456[_0x2628('0x53')],'loggedIn':_0x443456[_0x2628('0x56')],'name':_0x443456[_0x2628('0x50')],'paused':_0x443456['paused'],'waiting':_0x443456[_0x2628('0x54')]};_0x254007['push'](_0x20821e);}}_0x3ce557({'count':_0x254007[_0x2628('0x24')],'rows':_0x254007});});},'WhatsappQueues':function(_0x548239){return new Promise(function(_0x307587,_0x40dad6){var _0x3e8898=[];for(var _0x42a309 in _0x4d2cfb[_0x2628('0x59')]){if(_0x4d2cfb['whatsappQueues'][_0x2628('0x4b')](_0x42a309)){var _0x343439=_0x4d2cfb[_0x2628('0x59')][_0x42a309];var _0x1c3e42={'id':_0x343439['id'],'available':_0x343439[_0x2628('0x53')],'loggedIn':_0x343439[_0x2628('0x56')],'name':_0x343439[_0x2628('0x50')],'paused':_0x343439[_0x2628('0x51')],'waiting':_0x343439[_0x2628('0x54')]};_0x3e8898[_0x2628('0x22')](_0x1c3e42);}}_0x307587({'count':_0x3e8898[_0x2628('0x24')],'rows':_0x3e8898});});},'ChatQueuesWaitingInteractions':function(_0x5c9a08){return new Promise(function(_0x9f9e0a,_0x4a6902){var _0x118d26=_[_0x2628('0x5a')](_0x4d2cfb[_0x2628('0x5b')]);_0x9f9e0a({'count':_0x118d26[_0x2628('0x24')],'rows':_0x118d26});});},'MailQueuesWaitingInteractions':function(_0x4b5de9){return new Promise(function(_0x50032b,_0x4998dd){var _0x40478b=_['values'](_0x4d2cfb[_0x2628('0x5c')]);_0x50032b({'count':_0x40478b['length'],'rows':_0x40478b});});},'OpenchannelQueuesWaitingInteractions':function(_0x4d98df){return new Promise(function(_0x2d294c,_0x2f1e8c){var _0x47f297=_[_0x2628('0x5a')](_0x4d2cfb['openchannelQueuesWaitingInteractions']);_0x2d294c({'count':_0x47f297['length'],'rows':_0x47f297});});},'SmsQueuesWaitingInteractions':function(_0xc9e57c){return new Promise(function(_0x1440f7,_0xbd2b20){var _0x28fdad=_[_0x2628('0x5a')](_0x4d2cfb[_0x2628('0x5d')]);_0x1440f7({'count':_0x28fdad[_0x2628('0x24')],'rows':_0x28fdad});});},'FaxQueuesWaitingInteractions':function(_0x564619){return new Promise(function(_0x10c130,_0x245061){var _0x492a36=_[_0x2628('0x5a')](_0x4d2cfb[_0x2628('0x5e')]);_0x10c130({'count':_0x492a36[_0x2628('0x24')],'rows':_0x492a36});});},'WhatsappQueuesWaitingInteractions':function(_0x3cb7f7){return new Promise(function(_0x581371,_0x28dc3b){var _0x4db794=_['values'](_0x4d2cfb[_0x2628('0x5f')]);_0x581371({'count':_0x4db794[_0x2628('0x24')],'rows':_0x4db794});});}};var _0x361b69=jayson[_0x2628('0x60')](_0x645884)[_0x2628('0x61')]();_0x361b69['on']('error',function(_0xfd6fdf){logger['error'](JSON[_0x2628('0x3b')](_0xfd6fdf));return _0x513aee(_0xfd6fdf);});_0x361b69[_0x2628('0x14')](0x232c,_0x2628('0x62'),function(){console[_0x2628('0x63')](_0x2628('0x64'),0x232c);return _0x2f59ca(_0x2628('0x65')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 2e0dcb5..9408109 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 _0x2249=['http','request','then','error','message','result','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','iftime\x20%s','indexOf','catch','all','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','stack','util','bluebird','../../../config/logger','client'];(function(_0x330b81,_0x18aa16){var _0x5557ba=function(_0x1d359c){while(--_0x1d359c){_0x330b81['push'](_0x330b81['shift']());}};_0x5557ba(++_0x18aa16);}(_0x2249,0x182));var _0x9224=function(_0x311f44,_0x1d7f5b){_0x311f44=_0x311f44-0x0;var _0x46f1e6=_0x2249[_0x311f44];return _0x46f1e6;};'use strict';var util=require(_0x9224('0x0'));var BPromise=require(_0x9224('0x1'));var jayson=require('jayson/promise');var _=require('lodash');var logger=require(_0x9224('0x2'))('routing');var client=jayson[_0x9224('0x3')][_0x9224('0x4')]({'port':0x232a});function request(_0x3a9e42,_0x165fb4){return new BPromise(function(_0x3d5c0e,_0x55a262){return client[_0x9224('0x5')](_0x3a9e42,_0x165fb4)[_0x9224('0x6')](function(_0x590083){if(_0x590083[_0x9224('0x7')]){return _0x55a262(_0x590083['error'][_0x9224('0x8')]);}else{return _0x3d5c0e(_0x590083[_0x9224('0x9')]);}})['catch'](function(_0x57a1e3){return _0x55a262(_0x57a1e3);});});}exports[_0x9224('0xa')]=function(_0x4c5d7d,_0x4774a4,_0x5175b4){return function(_0x571dc6){if(_0x5175b4['rules']&&!_0x5175b4[_0x9224('0xb')][_0x4c5d7d]){logger[_0x9224('0xc')](_0x9224('0xd'),_0x4c5d7d);return _0x571dc6[_0x9224('0xe')]();}var _0x2dcea9=[];for(var _0x2972ef=0x0;_0x2972ef<_0x4774a4[_0x9224('0xf')];_0x2972ef+=0x1){_0x2dcea9['push'](request('Command',{'command':util['format'](_0x9224('0x10'),_0x4774a4[_0x2972ef])})[_0x9224('0x6')](function(_0x389b6d){return _0x389b6d&&_0x389b6d[_0x9224('0x8')]&&_0x389b6d[_0x9224('0x8')][_0x9224('0x11')]('true')>=0x0?!![]:![];})[_0x9224('0x12')](function(_0x528097){logger['error']('[%s][INTERVAL]\x20%s',_0x4c5d7d,_0x4774a4[_0x2972ef]);}));}BPromise[_0x9224('0x13')](_0x2dcea9)[_0x9224('0x6')](function(_0x510632){var _0x197e5a=_[_0x9224('0x14')](_0x510632);logger[_0x9224('0xc')](_0x9224('0x15'),_0x4c5d7d,_0x4774a4[_0x9224('0x16')](_0x9224('0x17')),_0x197e5a);_0x571dc6[_0x9224('0x18')](_0x197e5a);})['catch'](function(_0x30dd6a){console['log'](_0x30dd6a);logger['error']('[%s][INTERVAL]\x20%s\x20%s',_0x4c5d7d,_0x4774a4[_0x9224('0x16')](_0x9224('0x17')),_0x30dd6a[_0x9224('0x19')]);_0x571dc6[_0x9224('0xe')]();});};}; \ No newline at end of file +var _0x1134=['message','result','rules','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','Command','iftime\x20%s','indexOf','true','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','catch','stack','util','bluebird','jayson/promise','../../../config/logger','routing','client','http','request','then','error'];(function(_0x2dc7cc,_0x890e13){var _0x428d0c=function(_0x2c1708){while(--_0x2c1708){_0x2dc7cc['push'](_0x2dc7cc['shift']());}};_0x428d0c(++_0x890e13);}(_0x1134,0x10e));var _0x4113=function(_0x3ffee8,_0x52c44e){_0x3ffee8=_0x3ffee8-0x0;var _0x5e867a=_0x1134[_0x3ffee8];return _0x5e867a;};'use strict';var util=require(_0x4113('0x0'));var BPromise=require(_0x4113('0x1'));var jayson=require(_0x4113('0x2'));var _=require('lodash');var logger=require(_0x4113('0x3'))(_0x4113('0x4'));var client=jayson[_0x4113('0x5')][_0x4113('0x6')]({'port':0x232a});function request(_0x18a812,_0x594f0f){return new BPromise(function(_0x44a26c,_0x18cb5a){return client[_0x4113('0x7')](_0x18a812,_0x594f0f)[_0x4113('0x8')](function(_0x1542a0){if(_0x1542a0[_0x4113('0x9')]){return _0x18cb5a(_0x1542a0[_0x4113('0x9')][_0x4113('0xa')]);}else{return _0x44a26c(_0x1542a0[_0x4113('0xb')]);}})['catch'](function(_0x1b403c){return _0x18cb5a(_0x1b403c);});});}exports['condition']=function(_0x34eb83,_0x5dbafd,_0x12e08d){return function(_0x35cbbb){if(_0x12e08d[_0x4113('0xc')]&&!_0x12e08d['rules'][_0x34eb83]){logger['info'](_0x4113('0xd'),_0x34eb83);return _0x35cbbb[_0x4113('0xe')]();}var _0x12a00d=[];for(var _0x5e80f3=0x0;_0x5e80f3<_0x5dbafd[_0x4113('0xf')];_0x5e80f3+=0x1){_0x12a00d['push'](request(_0x4113('0x10'),{'command':util['format'](_0x4113('0x11'),_0x5dbafd[_0x5e80f3])})[_0x4113('0x8')](function(_0x8787ab){return _0x8787ab&&_0x8787ab['message']&&_0x8787ab[_0x4113('0xa')][_0x4113('0x12')](_0x4113('0x13'))>=0x0?!![]:![];})['catch'](function(_0x4b4eb5){logger[_0x4113('0x9')](_0x4113('0x14'),_0x34eb83,_0x5dbafd[_0x5e80f3]);}));}BPromise[_0x4113('0x15')](_0x12a00d)[_0x4113('0x8')](function(_0x149901){var _0x570a18=_[_0x4113('0x16')](_0x149901);logger['info'](_0x4113('0x17'),_0x34eb83,_0x5dbafd[_0x4113('0x18')](_0x4113('0x19')),_0x570a18);_0x35cbbb['when'](_0x570a18);})[_0x4113('0x1a')](function(_0x1c3d7b){console['log'](_0x1c3d7b);logger['error'](_0x4113('0x17'),_0x34eb83,_0x5dbafd[_0x4113('0x18')](_0x4113('0x19')),_0x1c3d7b[_0x4113('0x1b')]);_0x35cbbb['stop']();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 820a4c4..cf97c75 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 _0xb49a=['[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','queue','membername','interface','calleridnum','connectedlinenum','lastevent','then','type','acw','acwtime','agentacw','acwTimeout','request','CreateVoiceAgentReport','uniqueid','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','now','called','connectedlinename','info','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','holdtime','ringtime','push','reason','abandoned','talktime','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','forIn','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','blind','transferexten','extension','transferuniqueid','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','transfertype','ATTENDED','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','[%s][agents][attendedtransfer]','hangup','[%s][agents][hangup]','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','agentcomplete','agent','lodash','util','./utils','format'];(function(_0x2ad575,_0xca24db){var _0x19a5a2=function(_0x49e06b){while(--_0x49e06b){_0x2ad575['push'](_0x2ad575['shift']());}};_0x19a5a2(++_0xca24db);}(_0xb49a,0xfb));var _0xab49=function(_0x3c4016,_0x2e220f){_0x3c4016=_0x3c4016-0x0;var _0x3cebbd=_0xb49a[_0x3c4016];return _0x3cebbd;};'use strict';var _=require(_0xab49('0x0'));var util=require(_0xab49('0x1'));var utils=require(_0xab49('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x1d512a,_0x8db649){utils['info'](util[_0xab49('0x3')](_0xab49('0x4'),_0x1d512a['uniqueid'],_0x1d512a['channel'],_0x1d512a[_0xab49('0x5')],_0x1d512a[_0xab49('0x6')],_0x1d512a[_0xab49('0x7')],_0x1d512a[_0xab49('0x8')],_0x1d512a[_0xab49('0x9')],_0x1d512a[_0xab49('0xa')]));if(_0x1d512a[_0xab49('0x5')]){utils['getVoiceQueueByName'](_0x1d512a[_0xab49('0x5')])[_0xab49('0xb')](function(_0xf12653){if(_0xf12653){_0x1d512a[_0xab49('0xc')]=_0xf12653[_0xab49('0xc')];_0x1d512a['agentacw']=_0x1d512a['agentcomplete']?_0xf12653[_0xab49('0xd')]:![];_0x1d512a[_0xab49('0xe')]=_0x1d512a[_0xab49('0xf')]?_0xf12653[_0xab49('0x10')]:0x0;}utils[_0xab49('0x11')]('CreateVoiceAgentReport',_0x1d512a);});}else{utils[_0xab49('0x11')](_0xab49('0x12'),_0x1d512a);}if(_0x8db649){delete transfers[_0x1d512a[_0xab49('0x13')]];}else{delete agents[_0x1d512a[_0xab49('0x14')]];}}exports[_0xab49('0x15')]=function(_0x36091a){try{utils[_0xab49('0x16')](util[_0xab49('0x3')](_0xab49('0x17'),_0x36091a[_0xab49('0x13')]),_0x36091a);agents[_0x36091a[_0xab49('0x14')]]=_0x36091a;agents[_0x36091a['destuniqueid']][_0xab49('0x18')]=utils[_0xab49('0x19')]();agents[_0x36091a[_0xab49('0x14')]][_0xab49('0xa')]=_0xab49('0x1a');agents[_0x36091a['destuniqueid']][_0xab49('0x9')]=null;agents[_0x36091a[_0xab49('0x14')]][_0xab49('0x1b')]=null;utils[_0xab49('0x1c')](util[_0xab49('0x3')]('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x36091a[_0xab49('0x13')],agents[_0x36091a[_0xab49('0x14')]][_0xab49('0x6')],_0x36091a['destuniqueid']));}catch(_0x4c22cd){utils[_0xab49('0x1d')](util[_0xab49('0x3')]('[%s][agents][agentcalled]',_0x36091a[_0xab49('0x13')]),_0x4c22cd);}};exports[_0xab49('0x1e')]=function(_0x49b716){try{if(!_[_0xab49('0x1f')](agents[_0x49b716['destuniqueid']])){utils[_0xab49('0x16')](util[_0xab49('0x3')]('[%s][agents][agentringnoanswer]',_0x49b716['uniqueid']),_0x49b716);utils[_0xab49('0x1c')](util['format'](_0xab49('0x20'),_0x49b716['uniqueid'],agents[_0x49b716[_0xab49('0x14')]][_0xab49('0x6')],_0x49b716[_0xab49('0x14')]));agents[_0x49b716['destuniqueid']][_0xab49('0x1e')]=!![];agents[_0x49b716['destuniqueid']][_0xab49('0x21')]=utils[_0xab49('0x19')]();agents[_0x49b716['destuniqueid']][_0xab49('0xa')]=_0xab49('0x22');agents[_0x49b716['destuniqueid']]['reason']=_0xab49('0x22');agents[_0x49b716[_0xab49('0x14')]][_0xab49('0x23')]=_0x49b716['ringtime']?parseInt(_0x49b716[_0xab49('0x24')])/0x3e8:0x0;agents[_0x49b716[_0xab49('0x14')]]['talktime']=0x0;unanswered[_0xab49('0x25')](_0x49b716[_0xab49('0x14')]);}}catch(_0x342fdf){utils['error'](util[_0xab49('0x3')]('[%s][agents][agentringnoanswer]',_0x49b716[_0xab49('0x13')]),_0x342fdf);}};exports['queuecallerabandon']=function(_0x19f094){try{_['forIn'](agents,function(_0x134a03,_0x24bd0f){if(_0x134a03[_0xab49('0x13')]==_0x19f094[_0xab49('0x13')]&&!_['includes'](unanswered,_0x134a03[_0xab49('0x14')])){utils[_0xab49('0x16')](util[_0xab49('0x3')]('[%s][agents][queuecallerabandon]',_0x19f094[_0xab49('0x13')]),_0x19f094);utils['info'](util[_0xab49('0x3')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x19f094['uniqueid'],_0x134a03['membername'],_0x134a03[_0xab49('0x14')]));_0x134a03['agentringnoanswer']=!![];_0x134a03[_0xab49('0x21')]=utils[_0xab49('0x19')]();_0x134a03[_0xab49('0xa')]='abandoned';_0x134a03[_0xab49('0x26')]=_0xab49('0x27');_0x134a03[_0xab49('0x23')]=_0x19f094[_0xab49('0x23')];_0x134a03[_0xab49('0x28')]=0x0;writeDB(_0x134a03);}});}catch(_0x56b768){utils[_0xab49('0x1d')](util[_0xab49('0x3')]('[%s][agents][queuecallerabandon]',_0x19f094['uniqueid']),_0x56b768);}};exports[_0xab49('0x29')]=function(_0x29c6cf){try{if(agents[_0x29c6cf[_0xab49('0x14')]]){utils[_0xab49('0x16')](util[_0xab49('0x3')](_0xab49('0x2a'),_0x29c6cf[_0xab49('0x13')]),_0x29c6cf);utils[_0xab49('0x1c')](util[_0xab49('0x3')](_0xab49('0x2b'),_0x29c6cf[_0xab49('0x13')],agents[_0x29c6cf[_0xab49('0x14')]][_0xab49('0x6')],_0x29c6cf['destuniqueid']));agents[_0x29c6cf[_0xab49('0x14')]][_0xab49('0x2c')]=utils[_0xab49('0x19')]();agents[_0x29c6cf[_0xab49('0x14')]][_0xab49('0x9')]=_0x29c6cf['connectedlinenum'];agents[_0x29c6cf[_0xab49('0x14')]]['connectedlinename']=_0x29c6cf['connectedlinename'];agents[_0x29c6cf[_0xab49('0x14')]][_0xab49('0x23')]=_0x29c6cf[_0xab49('0x24')];agents[_0x29c6cf[_0xab49('0x14')]][_0xab49('0xa')]='connect';_[_0xab49('0x2d')](agents,function(_0x2cdcbf,_0x2016a9){if(_0x2cdcbf[_0xab49('0x14')]!=_0x29c6cf[_0xab49('0x14')]&&_0x2cdcbf['uniqueid']==_0x29c6cf['uniqueid']){_0x2cdcbf[_0xab49('0x28')]=0x0;_0x2cdcbf[_0xab49('0x23')]=_0x29c6cf[_0xab49('0x24')];_0x2cdcbf['agentringnoanswer']=!![];_0x2cdcbf[_0xab49('0x21')]=utils['now']();_0x2cdcbf['lastevent']='answered_elsewhere';_0x2cdcbf['reason']=_0xab49('0x2e');_0x2cdcbf[_0xab49('0x2f')]=_0x29c6cf[_0xab49('0x14')];_0x2cdcbf[_0xab49('0x30')]=_0x29c6cf[_0xab49('0x6')];writeDB(_0x2cdcbf);}});}}catch(_0x3f3776){utils[_0xab49('0x1d')](util[_0xab49('0x3')](_0xab49('0x2a'),_0x29c6cf[_0xab49('0x13')]),_0x3f3776);}};exports['agentcomplete']=function(_0x158042){try{if(!_[_0xab49('0x1f')](agents[_0x158042['destuniqueid']])){utils[_0xab49('0x16')](util[_0xab49('0x3')](_0xab49('0x31'),_0x158042[_0xab49('0x13')]),_0x158042);utils[_0xab49('0x1c')](util[_0xab49('0x3')](_0xab49('0x32'),_0x158042[_0xab49('0x13')],agents[_0x158042['destuniqueid']][_0xab49('0x6')],_0x158042[_0xab49('0x14')]));agents[_0x158042[_0xab49('0x14')]]['agentcomplete']=!![];agents[_0x158042[_0xab49('0x14')]][_0xab49('0x33')]=utils[_0xab49('0x19')]();agents[_0x158042[_0xab49('0x14')]][_0xab49('0x28')]=utils[_0xab49('0x34')](agents[_0x158042['destuniqueid']][_0xab49('0x33')],agents[_0x158042[_0xab49('0x14')]][_0xab49('0x2c')]);agents[_0x158042[_0xab49('0x14')]][_0xab49('0x26')]=_0x158042[_0xab49('0x26')];agents[_0x158042['destuniqueid']][_0xab49('0xa')]=_0xab49('0x35');writeDB(agents[_0x158042[_0xab49('0x14')]]);}}catch(_0xca56ce){utils[_0xab49('0x1d')](util[_0xab49('0x3')](_0xab49('0x31'),_0x158042[_0xab49('0x13')]),_0xca56ce);}};exports[_0xab49('0x36')]=function(_0xfb7d69){try{if(!_[_0xab49('0x1f')](agents[_0xfb7d69[_0xab49('0x37')]])){utils['debug'](util[_0xab49('0x3')](_0xab49('0x38'),_0xfb7d69[_0xab49('0x13')]),_0xfb7d69);utils[_0xab49('0x1c')](util[_0xab49('0x3')](_0xab49('0x39'),_0xfb7d69[_0xab49('0x13')],agents[_0xfb7d69['transfereruniqueid']][_0xab49('0x6')],agents[_0xfb7d69['transfereruniqueid']][_0xab49('0x13')]));agents[_0xfb7d69['transfereruniqueid']][_0xab49('0x3a')]=!![];agents[_0xfb7d69[_0xab49('0x37')]]['transfertype']=_0xab49('0x3b');agents[_0xfb7d69[_0xab49('0x37')]][_0xab49('0x3c')]=_0xfb7d69[_0xab49('0x3d')];agents[_0xfb7d69[_0xab49('0x37')]][_0xab49('0x3e')]=agents[_0xfb7d69[_0xab49('0x37')]][_0xab49('0x13')];}}catch(_0x37cf42){utils[_0xab49('0x1d')](util[_0xab49('0x3')](_0xab49('0x38'),_0xfb7d69[_0xab49('0x13')]),_0x37cf42);}};exports[_0xab49('0x3f')]=function(_0x235ba8){try{utils[_0xab49('0x16')](util[_0xab49('0x3')]('[%s][agents][attendedtransfer]',_0x235ba8[_0xab49('0x40')]),_0x235ba8);if(_0x235ba8[_0xab49('0x40')]==_0x235ba8[_0xab49('0x41')]){if(!_[_0xab49('0x1f')](agents[_0x235ba8[_0xab49('0x42')]])){utils['info'](util[_0xab49('0x3')](_0xab49('0x43'),_0x235ba8[_0xab49('0x40')],agents[_0x235ba8[_0xab49('0x42')]][_0xab49('0x6')]));agents[_0x235ba8[_0xab49('0x42')]]['transfer']=!![];agents[_0x235ba8[_0xab49('0x42')]][_0xab49('0x44')]=_0xab49('0x45');agents[_0x235ba8[_0xab49('0x42')]]['transferexten']=_0x235ba8['origtransfererexten'];agents[_0x235ba8[_0xab49('0x42')]]['transferuniqueid']=_0x235ba8[_0xab49('0x40')];}if(_0x235ba8[_0xab49('0x46')]&&agents[_0x235ba8[_0xab49('0x46')]]){agents[_0x235ba8[_0xab49('0x46')]][_0xab49('0x47')]=0x1;transfers[_0x235ba8[_0xab49('0x46')]]=_[_0xab49('0x48')](agents[_0x235ba8[_0xab49('0x46')]]);transfers[_0x235ba8['transfereeuniqueid']][_0xab49('0x8')]=agents[_0x235ba8[_0xab49('0x42')]][_0xab49('0x8')];transfers[_0x235ba8[_0xab49('0x46')]][_0xab49('0x49')]=agents[_0x235ba8['secondtransfereruniqueid']][_0xab49('0x49')];transfers[_0x235ba8[_0xab49('0x46')]][_0xab49('0x18')]=utils[_0xab49('0x19')]();transfers[_0x235ba8[_0xab49('0x46')]][_0xab49('0x2c')]=utils[_0xab49('0x19')]();transfers[_0x235ba8[_0xab49('0x46')]][_0xab49('0x23')]=0x0;transfers[_0x235ba8[_0xab49('0x46')]][_0xab49('0x47')]=0x2;}}else if(_0x235ba8[_0xab49('0x42')]==_0x235ba8[_0xab49('0x4a')]){if(!_['isNil'](agents[_0x235ba8[_0xab49('0x40')]])){utils[_0xab49('0x1c')](util[_0xab49('0x3')](_0xab49('0x43'),_0x235ba8[_0xab49('0x40')],agents[_0x235ba8[_0xab49('0x40')]][_0xab49('0x6')]));agents[_0x235ba8[_0xab49('0x40')]][_0xab49('0x3a')]=!![];agents[_0x235ba8[_0xab49('0x40')]]['transfertype']=_0xab49('0x45');agents[_0x235ba8[_0xab49('0x40')]]['transferexten']=_0x235ba8[_0xab49('0x4b')];agents[_0x235ba8[_0xab49('0x40')]][_0xab49('0x3e')]=_0x235ba8['secondtransfereruniqueid'];}if(_0x235ba8[_0xab49('0x4c')]&&agents[_0x235ba8[_0xab49('0x4c')]]){agents[_0x235ba8['transfertargetuniqueid']]['agententerreason']=0x1;transfers[_0x235ba8[_0xab49('0x4c')]]=_[_0xab49('0x48')](agents[_0x235ba8[_0xab49('0x4c')]]);transfers[_0x235ba8['transfertargetuniqueid']]['calleridnum']=agents[_0x235ba8[_0xab49('0x40')]][_0xab49('0x8')];transfers[_0x235ba8[_0xab49('0x4c')]][_0xab49('0x49')]=agents[_0x235ba8[_0xab49('0x40')]][_0xab49('0x49')];transfers[_0x235ba8[_0xab49('0x4c')]][_0xab49('0x18')]=utils['now']();transfers[_0x235ba8['transfertargetuniqueid']][_0xab49('0x2c')]=utils[_0xab49('0x19')]();transfers[_0x235ba8[_0xab49('0x4c')]][_0xab49('0x23')]=0x0;transfers[_0x235ba8[_0xab49('0x4c')]][_0xab49('0x47')]=0x2;}}}catch(_0x108755){utils[_0xab49('0x1d')](util[_0xab49('0x3')](_0xab49('0x4d'),_0x235ba8['origtransfereruniqueid']),_0x108755);}};exports[_0xab49('0x4e')]=function(_0x24fb84){try{utils[_0xab49('0x16')](util[_0xab49('0x3')](_0xab49('0x4f'),_0x24fb84[_0xab49('0x13')]),_0x24fb84);if(agents[_0x24fb84[_0xab49('0x13')]]&&agents[_0x24fb84[_0xab49('0x13')]]['reason']===_0xab49('0x22')){if(_0x24fb84['cause']==='21'){agents[_0x24fb84[_0xab49('0x13')]][_0xab49('0x26')]=_0xab49('0x50');agents[_0x24fb84['uniqueid']][_0xab49('0xa')]=_0xab49('0x50');}utils['info'](util[_0xab49('0x3')](_0xab49('0x51'),_0x24fb84[_0xab49('0x13')],agents[_0x24fb84[_0xab49('0x13')]][_0xab49('0x6')],agents[_0x24fb84[_0xab49('0x13')]][_0xab49('0x26')],agents[_0x24fb84[_0xab49('0x13')]][_0xab49('0xa')]));writeDB(agents[_0x24fb84[_0xab49('0x13')]]);var _0x366a3c=unanswered[_0xab49('0x52')](_0x24fb84[_0xab49('0x13')]);if(_0x366a3c>-0x1){unanswered['splice'](_0x366a3c,0x1);}}if(transfers[_0x24fb84[_0xab49('0x13')]]){transfers[_0x24fb84[_0xab49('0x13')]][_0xab49('0x53')]=!![];transfers[_0x24fb84['uniqueid']][_0xab49('0x33')]=utils[_0xab49('0x19')]();transfers[_0x24fb84['uniqueid']][_0xab49('0x28')]=utils[_0xab49('0x34')](transfers[_0x24fb84['uniqueid']][_0xab49('0x33')],transfers[_0x24fb84[_0xab49('0x13')]][_0xab49('0x2c')]);transfers[_0x24fb84[_0xab49('0x13')]][_0xab49('0x26')]=_0xab49('0x54');transfers[_0x24fb84[_0xab49('0x13')]][_0xab49('0xa')]='complete';utils['info'](util[_0xab49('0x3')](_0xab49('0x51'),_0x24fb84[_0xab49('0x13')],transfers[_0x24fb84[_0xab49('0x13')]][_0xab49('0x6')],transfers[_0x24fb84[_0xab49('0x13')]][_0xab49('0x26')],transfers[_0x24fb84[_0xab49('0x13')]]['lastevent']));writeDB(transfers[_0x24fb84[_0xab49('0x13')]],!![]);}if(agents[_0x24fb84['uniqueid']]&&agents[_0x24fb84[_0xab49('0x13')]][_0xab49('0x2c')]){agents[_0x24fb84[_0xab49('0x13')]][_0xab49('0x53')]=!![];agents[_0x24fb84[_0xab49('0x13')]][_0xab49('0x33')]=utils[_0xab49('0x19')]();agents[_0x24fb84[_0xab49('0x13')]][_0xab49('0x28')]=utils[_0xab49('0x34')](agents[_0x24fb84[_0xab49('0x13')]][_0xab49('0x33')],agents[_0x24fb84[_0xab49('0x13')]][_0xab49('0x2c')]);agents[_0x24fb84[_0xab49('0x13')]][_0xab49('0x26')]=agents[_0x24fb84['uniqueid']]['transfer']?_0xab49('0x3a'):_0xab49('0x54');agents[_0x24fb84[_0xab49('0x13')]][_0xab49('0xa')]=_0xab49('0x35');utils[_0xab49('0x1c')](util['format'](_0xab49('0x51'),_0x24fb84['uniqueid'],agents[_0x24fb84['uniqueid']][_0xab49('0x6')],agents[_0x24fb84['uniqueid']][_0xab49('0x26')],agents[_0x24fb84[_0xab49('0x13')]]['lastevent']));writeDB(agents[_0x24fb84[_0xab49('0x13')]]);}}catch(_0x271ee4){utils[_0xab49('0x1d')](util['format']('[%s][agents][hangup]',_0x24fb84[_0xab49('0x13')]),_0x271ee4);}}; \ No newline at end of file +var _0xaa88=['push','[%s][agents][agentringnoanswer]','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','holdtime','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','blindtransfer','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfereruniqueid','transfer','transfertype','blind','transferexten','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfereruniqueid','origtransfererexten','transfereeuniqueid','clone','calleridname','secondtransfererlinkedid','ATTENDED','transferuniqueid','transfertargetuniqueid','agententerreason','[%s][agents][attendedtransfer]','hangup','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','diffTime','agent','lodash','util','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','calleridnum','lastevent','getVoiceQueueByName','type','agentcomplete','acw','acwtime','agentacw','request','CreateVoiceAgentReport','destuniqueid','debug','agentcalledAt','now','called','connectedlinenum','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','membername','error','[%s][agents][agentcalled]','agentringnoanswer','isNil','agentringnoanswerAt','timeout','reason','ringtime','talktime'];(function(_0x876f7b,_0x2a6581){var _0x3602da=function(_0x3f735b){while(--_0x3f735b){_0x876f7b['push'](_0x876f7b['shift']());}};_0x3602da(++_0x2a6581);}(_0xaa88,0x137));var _0x8aa8=function(_0x3d9b04,_0x1e851a){_0x3d9b04=_0x3d9b04-0x0;var _0x557936=_0xaa88[_0x3d9b04];return _0x557936;};'use strict';var _=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var utils=require(_0x8aa8('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x51c79b,_0x4aee38){utils[_0x8aa8('0x3')](util[_0x8aa8('0x4')](_0x8aa8('0x5'),_0x51c79b[_0x8aa8('0x6')],_0x51c79b[_0x8aa8('0x7')],_0x51c79b[_0x8aa8('0x8')],_0x51c79b['membername'],_0x51c79b['interface'],_0x51c79b[_0x8aa8('0x9')],_0x51c79b['connectedlinenum'],_0x51c79b[_0x8aa8('0xa')]));if(_0x51c79b[_0x8aa8('0x8')]){utils[_0x8aa8('0xb')](_0x51c79b[_0x8aa8('0x8')])['then'](function(_0x123b7f){if(_0x123b7f){_0x51c79b[_0x8aa8('0xc')]=_0x123b7f[_0x8aa8('0xc')];_0x51c79b['agentacw']=_0x51c79b[_0x8aa8('0xd')]?_0x123b7f[_0x8aa8('0xe')]:![];_0x51c79b[_0x8aa8('0xf')]=_0x51c79b[_0x8aa8('0x10')]?_0x123b7f['acwTimeout']:0x0;}utils[_0x8aa8('0x11')](_0x8aa8('0x12'),_0x51c79b);});}else{utils['request'](_0x8aa8('0x12'),_0x51c79b);}if(_0x4aee38){delete transfers[_0x51c79b[_0x8aa8('0x6')]];}else{delete agents[_0x51c79b[_0x8aa8('0x13')]];}}exports['agentcalled']=function(_0x3b9f74){try{utils[_0x8aa8('0x14')](util[_0x8aa8('0x4')]('[%s][agents][agentcalled]',_0x3b9f74[_0x8aa8('0x6')]),_0x3b9f74);agents[_0x3b9f74['destuniqueid']]=_0x3b9f74;agents[_0x3b9f74['destuniqueid']][_0x8aa8('0x15')]=utils[_0x8aa8('0x16')]();agents[_0x3b9f74[_0x8aa8('0x13')]][_0x8aa8('0xa')]=_0x8aa8('0x17');agents[_0x3b9f74[_0x8aa8('0x13')]][_0x8aa8('0x18')]=null;agents[_0x3b9f74[_0x8aa8('0x13')]][_0x8aa8('0x19')]=null;utils['info'](util['format'](_0x8aa8('0x1a'),_0x3b9f74['uniqueid'],agents[_0x3b9f74['destuniqueid']][_0x8aa8('0x1b')],_0x3b9f74['destuniqueid']));}catch(_0x438198){utils[_0x8aa8('0x1c')](util[_0x8aa8('0x4')](_0x8aa8('0x1d'),_0x3b9f74['uniqueid']),_0x438198);}};exports[_0x8aa8('0x1e')]=function(_0x36c445){try{if(!_[_0x8aa8('0x1f')](agents[_0x36c445[_0x8aa8('0x13')]])){utils[_0x8aa8('0x14')](util[_0x8aa8('0x4')]('[%s][agents][agentringnoanswer]',_0x36c445[_0x8aa8('0x6')]),_0x36c445);utils['info'](util[_0x8aa8('0x4')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x36c445[_0x8aa8('0x6')],agents[_0x36c445['destuniqueid']][_0x8aa8('0x1b')],_0x36c445[_0x8aa8('0x13')]));agents[_0x36c445[_0x8aa8('0x13')]]['agentringnoanswer']=!![];agents[_0x36c445[_0x8aa8('0x13')]][_0x8aa8('0x20')]=utils[_0x8aa8('0x16')]();agents[_0x36c445['destuniqueid']]['lastevent']=_0x8aa8('0x21');agents[_0x36c445[_0x8aa8('0x13')]][_0x8aa8('0x22')]=_0x8aa8('0x21');agents[_0x36c445[_0x8aa8('0x13')]]['holdtime']=_0x36c445[_0x8aa8('0x23')]?parseInt(_0x36c445['ringtime'])/0x3e8:0x0;agents[_0x36c445[_0x8aa8('0x13')]][_0x8aa8('0x24')]=0x0;unanswered[_0x8aa8('0x25')](_0x36c445['destuniqueid']);}}catch(_0x4c5c5c){utils[_0x8aa8('0x1c')](util['format'](_0x8aa8('0x26'),_0x36c445[_0x8aa8('0x6')]),_0x4c5c5c);}};exports[_0x8aa8('0x27')]=function(_0x240203){try{_[_0x8aa8('0x28')](agents,function(_0x4d5c2e,_0x267f4c){if(_0x4d5c2e[_0x8aa8('0x6')]==_0x240203['uniqueid']&&!_[_0x8aa8('0x29')](unanswered,_0x4d5c2e[_0x8aa8('0x13')])){utils[_0x8aa8('0x14')](util['format'](_0x8aa8('0x2a'),_0x240203[_0x8aa8('0x6')]),_0x240203);utils[_0x8aa8('0x3')](util[_0x8aa8('0x4')](_0x8aa8('0x2b'),_0x240203[_0x8aa8('0x6')],_0x4d5c2e[_0x8aa8('0x1b')],_0x4d5c2e[_0x8aa8('0x13')]));_0x4d5c2e[_0x8aa8('0x1e')]=!![];_0x4d5c2e[_0x8aa8('0x20')]=utils[_0x8aa8('0x16')]();_0x4d5c2e['lastevent']='abandoned';_0x4d5c2e[_0x8aa8('0x22')]=_0x8aa8('0x2c');_0x4d5c2e[_0x8aa8('0x2d')]=_0x240203[_0x8aa8('0x2d')];_0x4d5c2e[_0x8aa8('0x24')]=0x0;writeDB(_0x4d5c2e);}});}catch(_0x2f27cd){utils['error'](util['format'](_0x8aa8('0x2a'),_0x240203['uniqueid']),_0x2f27cd);}};exports[_0x8aa8('0x2e')]=function(_0x2c5c84){try{if(agents[_0x2c5c84[_0x8aa8('0x13')]]){utils['debug'](util[_0x8aa8('0x4')](_0x8aa8('0x2f'),_0x2c5c84[_0x8aa8('0x6')]),_0x2c5c84);utils['info'](util['format'](_0x8aa8('0x30'),_0x2c5c84[_0x8aa8('0x6')],agents[_0x2c5c84['destuniqueid']][_0x8aa8('0x1b')],_0x2c5c84[_0x8aa8('0x13')]));agents[_0x2c5c84['destuniqueid']][_0x8aa8('0x31')]=utils['now']();agents[_0x2c5c84['destuniqueid']][_0x8aa8('0x18')]=_0x2c5c84['connectedlinenum'];agents[_0x2c5c84[_0x8aa8('0x13')]][_0x8aa8('0x19')]=_0x2c5c84[_0x8aa8('0x19')];agents[_0x2c5c84[_0x8aa8('0x13')]]['holdtime']=_0x2c5c84[_0x8aa8('0x23')];agents[_0x2c5c84[_0x8aa8('0x13')]]['lastevent']=_0x8aa8('0x32');_[_0x8aa8('0x28')](agents,function(_0x5ea57a,_0x351ddc){if(_0x5ea57a[_0x8aa8('0x13')]!=_0x2c5c84[_0x8aa8('0x13')]&&_0x5ea57a[_0x8aa8('0x6')]==_0x2c5c84[_0x8aa8('0x6')]){_0x5ea57a[_0x8aa8('0x24')]=0x0;_0x5ea57a[_0x8aa8('0x2d')]=_0x2c5c84[_0x8aa8('0x23')];_0x5ea57a[_0x8aa8('0x1e')]=!![];_0x5ea57a[_0x8aa8('0x20')]=utils[_0x8aa8('0x16')]();_0x5ea57a[_0x8aa8('0xa')]=_0x8aa8('0x33');_0x5ea57a[_0x8aa8('0x22')]=_0x8aa8('0x33');_0x5ea57a[_0x8aa8('0x34')]=_0x2c5c84['destuniqueid'];_0x5ea57a[_0x8aa8('0x35')]=_0x2c5c84['membername'];writeDB(_0x5ea57a);}});}}catch(_0x4833c0){utils['error'](util[_0x8aa8('0x4')]('[%s][agents][agentconnect]',_0x2c5c84['uniqueid']),_0x4833c0);}};exports[_0x8aa8('0xd')]=function(_0x4da4d8){try{if(!_[_0x8aa8('0x1f')](agents[_0x4da4d8['destuniqueid']])){utils['debug'](util[_0x8aa8('0x4')](_0x8aa8('0x36'),_0x4da4d8[_0x8aa8('0x6')]),_0x4da4d8);utils[_0x8aa8('0x3')](util[_0x8aa8('0x4')](_0x8aa8('0x37'),_0x4da4d8[_0x8aa8('0x6')],agents[_0x4da4d8['destuniqueid']][_0x8aa8('0x1b')],_0x4da4d8['destuniqueid']));agents[_0x4da4d8[_0x8aa8('0x13')]][_0x8aa8('0xd')]=!![];agents[_0x4da4d8[_0x8aa8('0x13')]][_0x8aa8('0x38')]=utils[_0x8aa8('0x16')]();agents[_0x4da4d8[_0x8aa8('0x13')]]['talktime']=utils['diffTime'](agents[_0x4da4d8[_0x8aa8('0x13')]][_0x8aa8('0x38')],agents[_0x4da4d8['destuniqueid']][_0x8aa8('0x31')]);agents[_0x4da4d8[_0x8aa8('0x13')]][_0x8aa8('0x22')]=_0x4da4d8['reason'];agents[_0x4da4d8['destuniqueid']]['lastevent']='complete';writeDB(agents[_0x4da4d8[_0x8aa8('0x13')]]);}}catch(_0x43bdb4){utils['error'](util[_0x8aa8('0x4')](_0x8aa8('0x36'),_0x4da4d8[_0x8aa8('0x6')]),_0x43bdb4);}};exports[_0x8aa8('0x39')]=function(_0x20384a){try{if(!_[_0x8aa8('0x1f')](agents[_0x20384a['transfereruniqueid']])){utils['debug'](util[_0x8aa8('0x4')]('[%s][agents][blindtransfer]',_0x20384a[_0x8aa8('0x6')]),_0x20384a);utils['info'](util[_0x8aa8('0x4')](_0x8aa8('0x3a'),_0x20384a[_0x8aa8('0x6')],agents[_0x20384a[_0x8aa8('0x3b')]][_0x8aa8('0x1b')],agents[_0x20384a[_0x8aa8('0x3b')]][_0x8aa8('0x6')]));agents[_0x20384a[_0x8aa8('0x3b')]][_0x8aa8('0x3c')]=!![];agents[_0x20384a[_0x8aa8('0x3b')]][_0x8aa8('0x3d')]=_0x8aa8('0x3e');agents[_0x20384a['transfereruniqueid']][_0x8aa8('0x3f')]=_0x20384a['extension'];agents[_0x20384a['transfereruniqueid']]['transferuniqueid']=agents[_0x20384a[_0x8aa8('0x3b')]]['uniqueid'];}}catch(_0x1de402){utils[_0x8aa8('0x1c')](util[_0x8aa8('0x4')]('[%s][agents][blindtransfer]',_0x20384a[_0x8aa8('0x6')]),_0x1de402);}};exports[_0x8aa8('0x40')]=function(_0x23612a){try{utils[_0x8aa8('0x14')](util['format']('[%s][agents][attendedtransfer]',_0x23612a[_0x8aa8('0x41')]),_0x23612a);if(_0x23612a[_0x8aa8('0x41')]==_0x23612a[_0x8aa8('0x42')]){if(!_[_0x8aa8('0x1f')](agents[_0x23612a['secondtransfereruniqueid']])){utils['info'](util[_0x8aa8('0x4')](_0x8aa8('0x43'),_0x23612a[_0x8aa8('0x41')],agents[_0x23612a['secondtransfereruniqueid']][_0x8aa8('0x1b')]));agents[_0x23612a[_0x8aa8('0x44')]]['transfer']=!![];agents[_0x23612a['secondtransfereruniqueid']]['transfertype']='ATTENDED';agents[_0x23612a[_0x8aa8('0x44')]]['transferexten']=_0x23612a[_0x8aa8('0x45')];agents[_0x23612a[_0x8aa8('0x44')]]['transferuniqueid']=_0x23612a['origtransfereruniqueid'];}if(_0x23612a[_0x8aa8('0x46')]&&agents[_0x23612a[_0x8aa8('0x46')]]){agents[_0x23612a['transfereeuniqueid']]['agententerreason']=0x1;transfers[_0x23612a['transfereeuniqueid']]=_[_0x8aa8('0x47')](agents[_0x23612a[_0x8aa8('0x46')]]);transfers[_0x23612a['transfereeuniqueid']]['calleridnum']=agents[_0x23612a[_0x8aa8('0x44')]][_0x8aa8('0x9')];transfers[_0x23612a['transfereeuniqueid']][_0x8aa8('0x48')]=agents[_0x23612a[_0x8aa8('0x44')]]['calleridname'];transfers[_0x23612a[_0x8aa8('0x46')]]['agentcalledAt']=utils[_0x8aa8('0x16')]();transfers[_0x23612a['transfereeuniqueid']][_0x8aa8('0x31')]=utils[_0x8aa8('0x16')]();transfers[_0x23612a[_0x8aa8('0x46')]][_0x8aa8('0x2d')]=0x0;transfers[_0x23612a[_0x8aa8('0x46')]]['agententerreason']=0x2;}}else if(_0x23612a[_0x8aa8('0x44')]==_0x23612a[_0x8aa8('0x49')]){if(!_[_0x8aa8('0x1f')](agents[_0x23612a[_0x8aa8('0x41')]])){utils['info'](util[_0x8aa8('0x4')](_0x8aa8('0x43'),_0x23612a['origtransfereruniqueid'],agents[_0x23612a[_0x8aa8('0x41')]][_0x8aa8('0x1b')]));agents[_0x23612a[_0x8aa8('0x41')]][_0x8aa8('0x3c')]=!![];agents[_0x23612a[_0x8aa8('0x41')]][_0x8aa8('0x3d')]=_0x8aa8('0x4a');agents[_0x23612a['origtransfereruniqueid']]['transferexten']=_0x23612a['secondtransfererexten'];agents[_0x23612a[_0x8aa8('0x41')]][_0x8aa8('0x4b')]=_0x23612a[_0x8aa8('0x44')];}if(_0x23612a[_0x8aa8('0x4c')]&&agents[_0x23612a[_0x8aa8('0x4c')]]){agents[_0x23612a[_0x8aa8('0x4c')]][_0x8aa8('0x4d')]=0x1;transfers[_0x23612a[_0x8aa8('0x4c')]]=_[_0x8aa8('0x47')](agents[_0x23612a[_0x8aa8('0x4c')]]);transfers[_0x23612a[_0x8aa8('0x4c')]][_0x8aa8('0x9')]=agents[_0x23612a[_0x8aa8('0x41')]][_0x8aa8('0x9')];transfers[_0x23612a[_0x8aa8('0x4c')]][_0x8aa8('0x48')]=agents[_0x23612a[_0x8aa8('0x41')]][_0x8aa8('0x48')];transfers[_0x23612a[_0x8aa8('0x4c')]]['agentcalledAt']=utils[_0x8aa8('0x16')]();transfers[_0x23612a[_0x8aa8('0x4c')]][_0x8aa8('0x31')]=utils[_0x8aa8('0x16')]();transfers[_0x23612a[_0x8aa8('0x4c')]][_0x8aa8('0x2d')]=0x0;transfers[_0x23612a[_0x8aa8('0x4c')]][_0x8aa8('0x4d')]=0x2;}}}catch(_0x37520b){utils['error'](util[_0x8aa8('0x4')](_0x8aa8('0x4e'),_0x23612a['origtransfereruniqueid']),_0x37520b);}};exports[_0x8aa8('0x4f')]=function(_0x5d72d0){try{utils[_0x8aa8('0x14')](util[_0x8aa8('0x4')]('[%s][agents][hangup]',_0x5d72d0[_0x8aa8('0x6')]),_0x5d72d0);if(agents[_0x5d72d0[_0x8aa8('0x6')]]&&agents[_0x5d72d0[_0x8aa8('0x6')]][_0x8aa8('0x22')]===_0x8aa8('0x21')){if(_0x5d72d0[_0x8aa8('0x50')]==='21'){agents[_0x5d72d0[_0x8aa8('0x6')]]['reason']=_0x8aa8('0x51');agents[_0x5d72d0[_0x8aa8('0x6')]][_0x8aa8('0xa')]=_0x8aa8('0x51');}utils['info'](util['format'](_0x8aa8('0x52'),_0x5d72d0[_0x8aa8('0x6')],agents[_0x5d72d0[_0x8aa8('0x6')]][_0x8aa8('0x1b')],agents[_0x5d72d0['uniqueid']]['reason'],agents[_0x5d72d0['uniqueid']][_0x8aa8('0xa')]));writeDB(agents[_0x5d72d0[_0x8aa8('0x6')]]);var _0x1b7baa=unanswered[_0x8aa8('0x53')](_0x5d72d0[_0x8aa8('0x6')]);if(_0x1b7baa>-0x1){unanswered[_0x8aa8('0x54')](_0x1b7baa,0x1);}}if(transfers[_0x5d72d0[_0x8aa8('0x6')]]){transfers[_0x5d72d0[_0x8aa8('0x6')]][_0x8aa8('0xd')]=!![];transfers[_0x5d72d0['uniqueid']][_0x8aa8('0x38')]=utils['now']();transfers[_0x5d72d0['uniqueid']][_0x8aa8('0x24')]=utils[_0x8aa8('0x55')](transfers[_0x5d72d0[_0x8aa8('0x6')]]['agentcompleteAt'],transfers[_0x5d72d0[_0x8aa8('0x6')]]['agentconnectAt']);transfers[_0x5d72d0[_0x8aa8('0x6')]][_0x8aa8('0x22')]=_0x8aa8('0x56');transfers[_0x5d72d0[_0x8aa8('0x6')]][_0x8aa8('0xa')]='complete';utils['info'](util[_0x8aa8('0x4')](_0x8aa8('0x52'),_0x5d72d0[_0x8aa8('0x6')],transfers[_0x5d72d0[_0x8aa8('0x6')]][_0x8aa8('0x1b')],transfers[_0x5d72d0[_0x8aa8('0x6')]][_0x8aa8('0x22')],transfers[_0x5d72d0[_0x8aa8('0x6')]]['lastevent']));writeDB(transfers[_0x5d72d0[_0x8aa8('0x6')]],!![]);}if(agents[_0x5d72d0[_0x8aa8('0x6')]]&&agents[_0x5d72d0['uniqueid']]['agentconnectAt']){agents[_0x5d72d0[_0x8aa8('0x6')]][_0x8aa8('0xd')]=!![];agents[_0x5d72d0['uniqueid']][_0x8aa8('0x38')]=utils[_0x8aa8('0x16')]();agents[_0x5d72d0[_0x8aa8('0x6')]]['talktime']=utils['diffTime'](agents[_0x5d72d0['uniqueid']][_0x8aa8('0x38')],agents[_0x5d72d0[_0x8aa8('0x6')]][_0x8aa8('0x31')]);agents[_0x5d72d0[_0x8aa8('0x6')]]['reason']=agents[_0x5d72d0[_0x8aa8('0x6')]][_0x8aa8('0x3c')]?_0x8aa8('0x3c'):_0x8aa8('0x56');agents[_0x5d72d0['uniqueid']][_0x8aa8('0xa')]='complete';utils['info'](util[_0x8aa8('0x4')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x5d72d0[_0x8aa8('0x6')],agents[_0x5d72d0[_0x8aa8('0x6')]][_0x8aa8('0x1b')],agents[_0x5d72d0['uniqueid']][_0x8aa8('0x22')],agents[_0x5d72d0[_0x8aa8('0x6')]][_0x8aa8('0xa')]));writeDB(agents[_0x5d72d0[_0x8aa8('0x6')]]);}}catch(_0x20260e){utils[_0x8aa8('0x1c')](util['format']('[%s][agents][hangup]',_0x5d72d0[_0x8aa8('0x6')]),_0x20260e);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 92f5697..b660a36 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 _0x9fe7=['mohtime','varset','[%s][calls][varset]','variable','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','value','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','xmd-queue','xmcs-queue','lastapplication','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','[%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','appdata','toLowerCase','set','startsWith','split','substring','lastIndexOf','includes','noop','execif','gotoif','lodash','util','./transfers.controller','FAILED','NO\x20ANSWER','ANSWERED','BUSY','blinds','uniqueid','transfereeuniqueid','info','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','interface','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','recording','newchannel','debug','format','[%s][calls][newchannel]','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','[%s][calls][newstate]','[%s][calls][newstate]\x20context:%s\x20channel:%s','isNil','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','linkedid','destinationchannel','answertime','disposition','toNumber','channelstate','[%s][calls][hangup]','callerid','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','duration','diffTime','endtime','starttime','billableseconds','attendedtransfer','localtwolinkedid','origtransfereruniqueid','transfereechannel','secondtransfererchannel','userfield','_attended','transfertargetchannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfererchannel','error','[%s][calls][attendedtransfer]','musiconholdstart','musiconholdstartAt','[%s][calls][musiconholdstart]','musiconholdstop','[%s][calls][musiconholdstop]'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x9fe7,0x1df));var _0x79fe=function(_0x4efe4d,_0x1b1aeb){_0x4efe4d=_0x4efe4d-0x0;var _0x49c033=_0x9fe7[_0x4efe4d];return _0x49c033;};'use strict';var _=require(_0x79fe('0x0'));var util=require(_0x79fe('0x1'));var utils=require('./utils');var transfers=require(_0x79fe('0x2'));var dispositions=['NO\x20ANSWER',_0x79fe('0x3'),_0x79fe('0x3'),_0x79fe('0x4'),'NO\x20ANSWER',_0x79fe('0x4'),_0x79fe('0x5'),_0x79fe('0x6'),'FAILED',_0x79fe('0x3'),_0x79fe('0x3')];var channels={};function writeDB(_0x2ba246){var _0x4c8314;if(transfers[_0x79fe('0x7')][_0x2ba246[_0x79fe('0x8')]]){_0x4c8314=_0x2ba246[_0x79fe('0x8')];_0x2ba246[_0x79fe('0x8')]=transfers[_0x79fe('0x7')][_0x2ba246['uniqueid']][_0x79fe('0x9')];}utils[_0x79fe('0xa')](util['format'](_0x79fe('0xb'),_0x2ba246[_0x79fe('0x8')],_0x2ba246[_0x79fe('0xc')],_0x2ba246[_0x79fe('0xd')],_0x2ba246['membername'],_0x2ba246[_0x79fe('0xe')],_0x2ba246[_0x79fe('0xf')],_0x2ba246[_0x79fe('0x10')],_0x2ba246[_0x79fe('0x11')]));if(_0x2ba246[_0x79fe('0x12')]){utils[_0x79fe('0x13')](_0x2ba246[_0x79fe('0x12')])[_0x79fe('0x14')](function(_0x4be1c4){if(_0x4be1c4){_0x2ba246[_0x79fe('0x15')]=_0x4be1c4['id'];}utils[_0x79fe('0x16')](_0x79fe('0x17'),_0x2ba246);});}else{utils[_0x79fe('0x16')](_0x79fe('0x17'),_0x2ba246);}if(channels[_0x2ba246[_0x79fe('0x8')]]){delete channels[_0x2ba246['uniqueid']];}else if(_0x4c8314&&channels[_0x4c8314]){if(!transfers[_0x79fe('0x7')][_0x4c8314][_0x79fe('0x18')])delete transfers[_0x79fe('0x7')][_0x4c8314];delete channels[_0x4c8314];}}exports[_0x79fe('0x19')]=function(_0x5eadbf){try{utils[_0x79fe('0x1a')](util[_0x79fe('0x1b')](_0x79fe('0x1c'),_0x5eadbf[_0x79fe('0x8')]),_0x5eadbf);if(_0x5eadbf['uniqueid']==_0x5eadbf['linkedid']&&_0x5eadbf[_0x79fe('0xc')]!=_0x79fe('0x1d')){utils[_0x79fe('0xa')](util['format'](_0x79fe('0x1e'),_0x5eadbf[_0x79fe('0x8')],_0x5eadbf[_0x79fe('0x1f')],_0x5eadbf['exten']));channels[_0x5eadbf[_0x79fe('0x8')]]={'uniqueid':_0x5eadbf['uniqueid'],'accountcode':_0x5eadbf[_0x79fe('0x12')],'source':_0x5eadbf[_0x79fe('0xf')],'destination':_0x5eadbf[_0x79fe('0x20')],'destinationcontext':_0x5eadbf[_0x79fe('0x1f')],'channel':_0x5eadbf[_0x79fe('0xc')],'starttime':utils[_0x79fe('0x21')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':'DOCUMENTATION'};}}catch(_0x107641){utils['error'](util[_0x79fe('0x1b')](_0x79fe('0x1c'),_0x5eadbf['uniqueid']),_0x107641);}};exports['newstate']=function(_0x454e93){try{utils[_0x79fe('0x1a')](util['format'](_0x79fe('0x22'),_0x454e93[_0x79fe('0x8')]),_0x454e93);if(!_['isNil'](channels[_0x454e93['uniqueid']])&&_0x454e93['channelstate']==0x6){utils[_0x79fe('0xa')](util[_0x79fe('0x1b')](_0x79fe('0x23'),_0x454e93['uniqueid'],_0x454e93[_0x79fe('0x1f')],_0x454e93[_0x79fe('0xc')]));if(_[_0x79fe('0x24')](channels[_0x454e93['uniqueid']]['systemanswertime'])){channels[_0x454e93[_0x79fe('0x8')]]['systemanswertime']=utils[_0x79fe('0x21')]();}}else if(!_['isNil'](channels[_0x454e93['linkedid']])&&_0x454e93['channelstate']==0x6&&_0x454e93['context']!=_0x79fe('0x25')){utils[_0x79fe('0xa')](util['format'](_0x79fe('0x26'),_0x454e93['uniqueid'],_0x454e93[_0x79fe('0x27')],_0x454e93[_0x79fe('0x1f')],_0x454e93[_0x79fe('0xc')]));channels[_0x454e93[_0x79fe('0x27')]][_0x79fe('0x12')]=_0x454e93['accountcode'];channels[_0x454e93[_0x79fe('0x27')]][_0x79fe('0x28')]=_0x454e93[_0x79fe('0xc')];if(_[_0x79fe('0x24')](channels[_0x454e93[_0x79fe('0x27')]][_0x79fe('0x29')])){channels[_0x454e93['linkedid']][_0x79fe('0x29')]=utils[_0x79fe('0x21')]();}channels[_0x454e93[_0x79fe('0x27')]][_0x79fe('0x2a')]=dispositions[_[_0x79fe('0x2b')](_0x454e93[_0x79fe('0x2c')])]||'ANSWERED';}}catch(_0x2d4705){utils['error'](util[_0x79fe('0x1b')]('[%s][calls][newstate]',_0x454e93[_0x79fe('0x8')]),_0x2d4705);}};exports['hangup']=function(_0x1ee275){try{if(!_[_0x79fe('0x24')](channels[_0x1ee275[_0x79fe('0x8')]])){utils['debug'](util[_0x79fe('0x1b')](_0x79fe('0x2d'),_0x1ee275[_0x79fe('0x8')]),_0x1ee275);if(_[_0x79fe('0x24')](channels[_0x1ee275[_0x79fe('0x8')]]['callerid'])){channels[_0x1ee275['uniqueid']][_0x79fe('0x2e')]=_0x1ee275['calleridname']+'\x20<'+_0x1ee275[_0x79fe('0xf')]+'>';}utils[_0x79fe('0xa')](util['format'](_0x79fe('0x2f'),_0x1ee275[_0x79fe('0x8')],channels[_0x1ee275[_0x79fe('0x8')]][_0x79fe('0x2e')],_0x1ee275[_0x79fe('0x30')]));channels[_0x1ee275[_0x79fe('0x8')]]['endtime']=utils[_0x79fe('0x21')]();channels[_0x1ee275[_0x79fe('0x8')]][_0x79fe('0x31')]=utils[_0x79fe('0x32')](channels[_0x1ee275['uniqueid']][_0x79fe('0x33')],channels[_0x1ee275['uniqueid']][_0x79fe('0x34')]);channels[_0x1ee275['uniqueid']][_0x79fe('0x35')]=channels[_0x1ee275['uniqueid']][_0x79fe('0x29')]?utils[_0x79fe('0x32')](channels[_0x1ee275['uniqueid']]['endtime'],channels[_0x1ee275[_0x79fe('0x8')]][_0x79fe('0x29')]):0x0;writeDB(channels[_0x1ee275[_0x79fe('0x8')]]);}}catch(_0xeb03e4){utils['error'](util['format'](_0x79fe('0x2d'),_0x1ee275[_0x79fe('0x8')]),_0xeb03e4);}};exports[_0x79fe('0x36')]=function(_0x365b69){try{if(!_[_0x79fe('0x24')](channels[_0x365b69[_0x79fe('0x37')]])){utils[_0x79fe('0x1a')](util[_0x79fe('0x1b')]('[%s][calls][attendedtransfer]',_0x365b69[_0x79fe('0x38')]),_0x365b69);if(channels[_0x365b69[_0x79fe('0x37')]][_0x79fe('0xc')]==_0x365b69[_0x79fe('0x39')]){utils[_0x79fe('0xa')](util[_0x79fe('0x1b')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x365b69[_0x79fe('0x38')],_0x365b69[_0x79fe('0x37')],_0x365b69[_0x79fe('0x3a')]));channels[_0x365b69[_0x79fe('0x37')]][_0x79fe('0x28')]=_0x365b69[_0x79fe('0x3a')];channels[_0x365b69['localtwolinkedid']][_0x79fe('0x3b')]=_0x79fe('0x3c');}else if(channels[_0x365b69[_0x79fe('0x37')]]['channel']=_0x365b69[_0x79fe('0x3d')]){utils['info'](util['format'](_0x79fe('0x3e'),_0x365b69[_0x79fe('0x38')],_0x365b69[_0x79fe('0x37')],_0x365b69['origtransfererchannel']));channels[_0x365b69[_0x79fe('0x37')]][_0x79fe('0x28')]=_0x365b69[_0x79fe('0x3f')];channels[_0x365b69['localtwolinkedid']]['userfield']=_0x79fe('0x3c');}}}catch(_0x205d67){utils[_0x79fe('0x40')](util[_0x79fe('0x1b')](_0x79fe('0x41'),_0x365b69[_0x79fe('0x38')]),_0x205d67);}};exports[_0x79fe('0x42')]=function(_0x23f270){try{if(!_[_0x79fe('0x24')](channels[_0x23f270['uniqueid']])){utils[_0x79fe('0x1a')](util[_0x79fe('0x1b')]('[%s][calls][musiconholdstart]',_0x23f270[_0x79fe('0x8')]),_0x23f270);channels[_0x23f270['uniqueid']][_0x79fe('0x43')]=utils[_0x79fe('0x21')]();utils[_0x79fe('0xa')](util[_0x79fe('0x1b')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x23f270[_0x79fe('0x8')],channels[_0x23f270[_0x79fe('0x8')]][_0x79fe('0x43')]));}}catch(_0x4df405){utils['error'](util[_0x79fe('0x1b')](_0x79fe('0x44'),_0x23f270['uniqueid']),_0x4df405);}};exports[_0x79fe('0x45')]=function(_0x368e5d){try{if(!_[_0x79fe('0x24')](channels[_0x368e5d[_0x79fe('0x8')]])){utils['debug'](util[_0x79fe('0x1b')](_0x79fe('0x46'),_0x368e5d[_0x79fe('0x8')]),_0x368e5d);if(!_['isNil'](channels[_0x368e5d['uniqueid']]['musiconholdstartAt'])){channels[_0x368e5d['uniqueid']]['mohtime']+=utils[_0x79fe('0x32')](utils[_0x79fe('0x21')](),channels[_0x368e5d['uniqueid']][_0x79fe('0x43')]);utils[_0x79fe('0xa')](util[_0x79fe('0x1b')]('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x368e5d['uniqueid'],channels[_0x368e5d['uniqueid']][_0x79fe('0x47')]));delete channels[_0x368e5d['uniqueid']][_0x79fe('0x43')];}}}catch(_0x3640ac){utils[_0x79fe('0x40')](util[_0x79fe('0x1b')](_0x79fe('0x46'),_0x368e5d[_0x79fe('0x8')]),_0x3640ac);}};exports[_0x79fe('0x48')]=function(_0x2578da){try{if(!_[_0x79fe('0x24')](channels[_0x2578da[_0x79fe('0x8')]])){utils[_0x79fe('0x1a')](util['format'](_0x79fe('0x49'),_0x2578da[_0x79fe('0x8')]),_0x2578da);if(!_['isNil'](_0x2578da[_0x79fe('0x4a')]['xmd-originatecalleridnum'])){utils[_0x79fe('0xa')](util[_0x79fe('0x1b')]('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x2578da[_0x79fe('0x8')],_0x2578da['value']));channels[_0x2578da[_0x79fe('0x8')]]['source']=_0x2578da['value'];}if(!_['isNil'](_0x2578da[_0x79fe('0x4a')][_0x79fe('0x4b')])){utils[_0x79fe('0xa')](util[_0x79fe('0x1b')](_0x79fe('0x4c'),_0x2578da[_0x79fe('0x8')],_0x2578da[_0x79fe('0x4d')]));channels[_0x2578da[_0x79fe('0x8')]][_0x79fe('0x4e')]=_0x2578da['value'];channels[_0x2578da[_0x79fe('0x8')]][_0x79fe('0x2e')]='\x22'+_0x2578da[_0x79fe('0x4d')]+_0x79fe('0x4f')+_0x2578da['value']+'>';}if(!_[_0x79fe('0x24')](_0x2578da['variable'][_0x79fe('0x50')])||!_['isNil'](_0x2578da[_0x79fe('0x4a')][_0x79fe('0x51')])){utils[_0x79fe('0xa')](util[_0x79fe('0x1b')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x2578da[_0x79fe('0x8')],!_[_0x79fe('0x24')](_0x2578da[_0x79fe('0x4a')][_0x79fe('0x50')])?'xmd-callerid-preview':_0x79fe('0x51'),_0x2578da[_0x79fe('0x4d')]));channels[_0x2578da['uniqueid']][_0x79fe('0x2e')]=_0x2578da['value'];}if(!_['isNil'](_0x2578da[_0x79fe('0x4a')][_0x79fe('0x52')])||!_[_0x79fe('0x24')](_0x2578da['variable']['xmcs-queue'])){utils[_0x79fe('0xa')](util['format']('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x2578da[_0x79fe('0x8')],!_[_0x79fe('0x24')](_0x2578da[_0x79fe('0x4a')][_0x79fe('0x52')])?_0x79fe('0x52'):_0x79fe('0x53'),_0x2578da[_0x79fe('0x4d')]));channels[_0x2578da[_0x79fe('0x8')]][_0x79fe('0x54')]='Queue';channels[_0x2578da[_0x79fe('0x8')]][_0x79fe('0x55')]=_0x2578da['value'];channels[_0x2578da[_0x79fe('0x8')]][_0x79fe('0xd')]=!![];}if(!_[_0x79fe('0x24')](_0x2578da[_0x79fe('0x4a')][_0x79fe('0x56')])){utils[_0x79fe('0xa')](util[_0x79fe('0x1b')](_0x79fe('0x57'),_0x2578da[_0x79fe('0x8')],_0x2578da[_0x79fe('0x4d')]));channels[_0x2578da[_0x79fe('0x8')]]['ContactId']=_0x2578da[_0x79fe('0x4d')];}if(!_[_0x79fe('0x24')](_0x2578da[_0x79fe('0x4a')][_0x79fe('0x58')])){utils[_0x79fe('0xa')](util[_0x79fe('0x1b')](_0x79fe('0x59'),_0x2578da['uniqueid'],_0x2578da[_0x79fe('0x4d')]));channels[_0x2578da[_0x79fe('0x8')]][_0x79fe('0x5a')]=_0x2578da['value'];}if(!_['isNil'](_0x2578da['variable']['outboundrouteid'])){utils[_0x79fe('0xa')](util['format'](_0x79fe('0x5b'),_0x2578da[_0x79fe('0x8')],_0x2578da[_0x79fe('0x4d')]));channels[_0x2578da[_0x79fe('0x8')]][_0x79fe('0x5c')]=_0x2578da['value'];}if(!_[_0x79fe('0x24')](_0x2578da['variable'][_0x79fe('0x5d')])){utils[_0x79fe('0xa')](util[_0x79fe('0x1b')](_0x79fe('0x5e'),_0x2578da[_0x79fe('0x8')],_0x2578da[_0x79fe('0x4d')]));channels[_0x2578da[_0x79fe('0x8')]]['sipcallid']=_0x2578da[_0x79fe('0x4d')];}}}catch(_0x50c361){utils[_0x79fe('0x40')](util[_0x79fe('0x1b')](_0x79fe('0x49'),_0x2578da['uniqueid']),_0x50c361);}};exports[_0x79fe('0x5f')]=function(_0x21fc30){try{if(!_[_0x79fe('0x24')](channels[_0x21fc30[_0x79fe('0x8')]])){utils['debug'](util[_0x79fe('0x1b')](_0x79fe('0x60'),_0x21fc30[_0x79fe('0x8')]),_0x21fc30);utils['info'](util[_0x79fe('0x1b')](_0x79fe('0x61'),_0x21fc30[_0x79fe('0x8')],_0x21fc30[_0x79fe('0x62')],_0x21fc30[_0x79fe('0x63')]));if(_0x21fc30[_0x79fe('0x62')][_0x79fe('0x64')]()==_0x79fe('0x65')&&_[_0x79fe('0x66')](_0x21fc30['appdata'][_0x79fe('0x64')](),'cdr')){var _0x1d818a=_0x21fc30[_0x79fe('0x63')][_0x79fe('0x67')]('=');var _0x1b1028=_0x1d818a[0x0][_0x79fe('0x68')](_0x1d818a[0x0]['lastIndexOf']('(')+0x1,_0x1d818a[0x0][_0x79fe('0x69')](')'));var _0x4cf8fa=_0x1d818a[0x1];channels[_0x21fc30[_0x79fe('0x8')]][_0x1b1028]=_0x4cf8fa;}if(!_[_0x79fe('0x6a')](['hangup',_0x79fe('0x6b'),_0x79fe('0x6c'),_0x79fe('0x65'),_0x79fe('0x6d')],_0x21fc30[_0x79fe('0x62')]['toLowerCase']())){channels[_0x21fc30[_0x79fe('0x8')]][_0x79fe('0x54')]=_0x21fc30[_0x79fe('0x62')];channels[_0x21fc30[_0x79fe('0x8')]][_0x79fe('0x55')]=_0x21fc30[_0x79fe('0x63')];}}}catch(_0x477c6f){utils[_0x79fe('0x40')](util[_0x79fe('0x1b')](_0x79fe('0x60'),_0x21fc30['uniqueid']),_0x477c6f);}}; \ No newline at end of file +var _0x2842=['./transfers.controller','NO\x20ANSWER','FAILED','ANSWERED','BUSY','blinds','uniqueid','transfereeuniqueid','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','interface','connectedlinenum','accountcode','getUserByInternal','then','UserId','request','recording','newchannel','debug','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','error','[%s][calls][newstate]','isNil','channelstate','info','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','toNumber','hangup','callerid','calleridname','calleridnum','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','diffTime','starttime','billableseconds','[%s][calls][hangup]','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','secondtransfererchannel','userfield','transfertargetchannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','_attended','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','variable','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','sipcallid','[%s][calls][varset]','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','noop','execif','util','./utils'];(function(_0x57645b,_0x25f73a){var _0xe82f00=function(_0x526b4){while(--_0x526b4){_0x57645b['push'](_0x57645b['shift']());}};_0xe82f00(++_0x25f73a);}(_0x2842,0x1ba));var _0x2284=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x2842[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require(_0x2284('0x0'));var utils=require(_0x2284('0x1'));var transfers=require(_0x2284('0x2'));var dispositions=[_0x2284('0x3'),_0x2284('0x4'),'FAILED',_0x2284('0x3'),_0x2284('0x3'),'NO\x20ANSWER',_0x2284('0x5'),_0x2284('0x6'),_0x2284('0x4'),_0x2284('0x4'),_0x2284('0x4')];var channels={};function writeDB(_0x2f43bf){var _0x4f9375;if(transfers[_0x2284('0x7')][_0x2f43bf['uniqueid']]){_0x4f9375=_0x2f43bf[_0x2284('0x8')];_0x2f43bf[_0x2284('0x8')]=transfers[_0x2284('0x7')][_0x2f43bf['uniqueid']][_0x2284('0x9')];}utils['info'](util[_0x2284('0xa')](_0x2284('0xb'),_0x2f43bf[_0x2284('0x8')],_0x2f43bf[_0x2284('0xc')],_0x2f43bf[_0x2284('0xd')],_0x2f43bf[_0x2284('0xe')],_0x2f43bf[_0x2284('0xf')],_0x2f43bf['calleridnum'],_0x2f43bf[_0x2284('0x10')],_0x2f43bf['lastevent']));if(_0x2f43bf[_0x2284('0x11')]){utils[_0x2284('0x12')](_0x2f43bf[_0x2284('0x11')])[_0x2284('0x13')](function(_0x56b45b){if(_0x56b45b){_0x2f43bf[_0x2284('0x14')]=_0x56b45b['id'];}utils[_0x2284('0x15')]('CreateVoiceCallReport',_0x2f43bf);});}else{utils[_0x2284('0x15')]('CreateVoiceCallReport',_0x2f43bf);}if(channels[_0x2f43bf['uniqueid']]){delete channels[_0x2f43bf[_0x2284('0x8')]];}else if(_0x4f9375&&channels[_0x4f9375]){if(!transfers[_0x2284('0x7')][_0x4f9375][_0x2284('0x16')])delete transfers[_0x2284('0x7')][_0x4f9375];delete channels[_0x4f9375];}}exports[_0x2284('0x17')]=function(_0x578eff){try{utils[_0x2284('0x18')](util[_0x2284('0xa')](_0x2284('0x19'),_0x578eff['uniqueid']),_0x578eff);if(_0x578eff[_0x2284('0x8')]==_0x578eff[_0x2284('0x1a')]&&_0x578eff[_0x2284('0xc')]!=_0x2284('0x1b')){utils['info'](util[_0x2284('0xa')](_0x2284('0x1c'),_0x578eff['uniqueid'],_0x578eff[_0x2284('0x1d')],_0x578eff['exten']));channels[_0x578eff[_0x2284('0x8')]]={'uniqueid':_0x578eff['uniqueid'],'accountcode':_0x578eff[_0x2284('0x11')],'source':_0x578eff['calleridnum'],'destination':_0x578eff[_0x2284('0x1e')],'destinationcontext':_0x578eff[_0x2284('0x1d')],'channel':_0x578eff[_0x2284('0xc')],'starttime':utils[_0x2284('0x1f')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x2284('0x3'),'amaflags':'DOCUMENTATION'};}}catch(_0x3e8f59){utils[_0x2284('0x20')](util[_0x2284('0xa')](_0x2284('0x19'),_0x578eff[_0x2284('0x8')]),_0x3e8f59);}};exports['newstate']=function(_0x23e6f8){try{utils[_0x2284('0x18')](util[_0x2284('0xa')](_0x2284('0x21'),_0x23e6f8[_0x2284('0x8')]),_0x23e6f8);if(!_[_0x2284('0x22')](channels[_0x23e6f8[_0x2284('0x8')]])&&_0x23e6f8[_0x2284('0x23')]==0x6){utils[_0x2284('0x24')](util['format'](_0x2284('0x25'),_0x23e6f8[_0x2284('0x8')],_0x23e6f8[_0x2284('0x1d')],_0x23e6f8[_0x2284('0xc')]));if(_[_0x2284('0x22')](channels[_0x23e6f8[_0x2284('0x8')]]['systemanswertime'])){channels[_0x23e6f8[_0x2284('0x8')]][_0x2284('0x26')]=utils['now']();}}else if(!_[_0x2284('0x22')](channels[_0x23e6f8[_0x2284('0x1a')]])&&_0x23e6f8[_0x2284('0x23')]==0x6&&_0x23e6f8[_0x2284('0x1d')]!='transfer'){utils[_0x2284('0x24')](util[_0x2284('0xa')](_0x2284('0x27'),_0x23e6f8[_0x2284('0x8')],_0x23e6f8[_0x2284('0x1a')],_0x23e6f8['context'],_0x23e6f8[_0x2284('0xc')]));channels[_0x23e6f8[_0x2284('0x1a')]][_0x2284('0x11')]=_0x23e6f8[_0x2284('0x11')];channels[_0x23e6f8[_0x2284('0x1a')]][_0x2284('0x28')]=_0x23e6f8[_0x2284('0xc')];if(_[_0x2284('0x22')](channels[_0x23e6f8[_0x2284('0x1a')]][_0x2284('0x29')])){channels[_0x23e6f8['linkedid']][_0x2284('0x29')]=utils['now']();}channels[_0x23e6f8[_0x2284('0x1a')]]['disposition']=dispositions[_[_0x2284('0x2a')](_0x23e6f8[_0x2284('0x23')])]||_0x2284('0x5');}}catch(_0x1d5b75){utils[_0x2284('0x20')](util[_0x2284('0xa')](_0x2284('0x21'),_0x23e6f8[_0x2284('0x8')]),_0x1d5b75);}};exports[_0x2284('0x2b')]=function(_0x39e489){try{if(!_[_0x2284('0x22')](channels[_0x39e489[_0x2284('0x8')]])){utils[_0x2284('0x18')](util[_0x2284('0xa')]('[%s][calls][hangup]',_0x39e489[_0x2284('0x8')]),_0x39e489);if(_[_0x2284('0x22')](channels[_0x39e489['uniqueid']][_0x2284('0x2c')])){channels[_0x39e489[_0x2284('0x8')]]['callerid']=_0x39e489[_0x2284('0x2d')]+'\x20<'+_0x39e489[_0x2284('0x2e')]+'>';}utils[_0x2284('0x24')](util['format'](_0x2284('0x2f'),_0x39e489[_0x2284('0x8')],channels[_0x39e489[_0x2284('0x8')]][_0x2284('0x2c')],_0x39e489[_0x2284('0x30')]));channels[_0x39e489[_0x2284('0x8')]][_0x2284('0x31')]=utils[_0x2284('0x1f')]();channels[_0x39e489[_0x2284('0x8')]][_0x2284('0x32')]=utils[_0x2284('0x33')](channels[_0x39e489['uniqueid']][_0x2284('0x31')],channels[_0x39e489['uniqueid']][_0x2284('0x34')]);channels[_0x39e489[_0x2284('0x8')]][_0x2284('0x35')]=channels[_0x39e489['uniqueid']][_0x2284('0x29')]?utils['diffTime'](channels[_0x39e489[_0x2284('0x8')]][_0x2284('0x31')],channels[_0x39e489['uniqueid']][_0x2284('0x29')]):0x0;writeDB(channels[_0x39e489['uniqueid']]);}}catch(_0x5621d5){utils[_0x2284('0x20')](util[_0x2284('0xa')](_0x2284('0x36'),_0x39e489[_0x2284('0x8')]),_0x5621d5);}};exports[_0x2284('0x37')]=function(_0x5912ef){try{if(!_['isNil'](channels[_0x5912ef[_0x2284('0x38')]])){utils[_0x2284('0x18')](util[_0x2284('0xa')](_0x2284('0x39'),_0x5912ef[_0x2284('0x3a')]),_0x5912ef);if(channels[_0x5912ef[_0x2284('0x38')]][_0x2284('0xc')]==_0x5912ef[_0x2284('0x3b')]){utils['info'](util[_0x2284('0xa')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x5912ef[_0x2284('0x3a')],_0x5912ef[_0x2284('0x38')],_0x5912ef[_0x2284('0x3c')]));channels[_0x5912ef[_0x2284('0x38')]][_0x2284('0x28')]=_0x5912ef[_0x2284('0x3c')];channels[_0x5912ef['localtwolinkedid']][_0x2284('0x3d')]='_attended';}else if(channels[_0x5912ef[_0x2284('0x38')]][_0x2284('0xc')]=_0x5912ef[_0x2284('0x3e')]){utils[_0x2284('0x24')](util['format'](_0x2284('0x3f'),_0x5912ef[_0x2284('0x3a')],_0x5912ef[_0x2284('0x38')],_0x5912ef['origtransfererchannel']));channels[_0x5912ef[_0x2284('0x38')]][_0x2284('0x28')]=_0x5912ef['origtransfererchannel'];channels[_0x5912ef[_0x2284('0x38')]]['userfield']=_0x2284('0x40');}}}catch(_0x5d9ef0){utils[_0x2284('0x20')](util['format'](_0x2284('0x39'),_0x5912ef[_0x2284('0x3a')]),_0x5d9ef0);}};exports['musiconholdstart']=function(_0x414a87){try{if(!_['isNil'](channels[_0x414a87['uniqueid']])){utils[_0x2284('0x18')](util['format'](_0x2284('0x41'),_0x414a87[_0x2284('0x8')]),_0x414a87);channels[_0x414a87[_0x2284('0x8')]][_0x2284('0x42')]=utils[_0x2284('0x1f')]();utils[_0x2284('0x24')](util['format'](_0x2284('0x43'),_0x414a87[_0x2284('0x8')],channels[_0x414a87[_0x2284('0x8')]][_0x2284('0x42')]));}}catch(_0x4e33c1){utils[_0x2284('0x20')](util['format'](_0x2284('0x41'),_0x414a87['uniqueid']),_0x4e33c1);}};exports['musiconholdstop']=function(_0xeecfae){try{if(!_['isNil'](channels[_0xeecfae['uniqueid']])){utils[_0x2284('0x18')](util[_0x2284('0xa')](_0x2284('0x44'),_0xeecfae[_0x2284('0x8')]),_0xeecfae);if(!_[_0x2284('0x22')](channels[_0xeecfae[_0x2284('0x8')]][_0x2284('0x42')])){channels[_0xeecfae[_0x2284('0x8')]][_0x2284('0x45')]+=utils['diffTime'](utils[_0x2284('0x1f')](),channels[_0xeecfae[_0x2284('0x8')]][_0x2284('0x42')]);utils[_0x2284('0x24')](util[_0x2284('0xa')](_0x2284('0x46'),_0xeecfae[_0x2284('0x8')],channels[_0xeecfae[_0x2284('0x8')]][_0x2284('0x45')]));delete channels[_0xeecfae['uniqueid']]['musiconholdstartAt'];}}}catch(_0x489bb1){utils[_0x2284('0x20')](util['format'](_0x2284('0x44'),_0xeecfae[_0x2284('0x8')]),_0x489bb1);}};exports[_0x2284('0x47')]=function(_0x5758ad){try{if(!_[_0x2284('0x22')](channels[_0x5758ad['uniqueid']])){utils[_0x2284('0x18')](util[_0x2284('0xa')]('[%s][calls][varset]',_0x5758ad['uniqueid']),_0x5758ad);if(!_[_0x2284('0x22')](_0x5758ad['variable'][_0x2284('0x48')])){utils[_0x2284('0x24')](util[_0x2284('0xa')](_0x2284('0x49'),_0x5758ad['uniqueid'],_0x5758ad[_0x2284('0x4a')]));channels[_0x5758ad[_0x2284('0x8')]]['source']=_0x5758ad[_0x2284('0x4a')];}if(!_[_0x2284('0x22')](_0x5758ad[_0x2284('0x4b')][_0x2284('0x4c')])){utils['info'](util[_0x2284('0xa')](_0x2284('0x4d'),_0x5758ad[_0x2284('0x8')],_0x5758ad[_0x2284('0x4a')]));channels[_0x5758ad[_0x2284('0x8')]][_0x2284('0x4e')]=_0x5758ad[_0x2284('0x4a')];channels[_0x5758ad[_0x2284('0x8')]][_0x2284('0x2c')]='\x22'+_0x5758ad[_0x2284('0x4a')]+_0x2284('0x4f')+_0x5758ad[_0x2284('0x4a')]+'>';}if(!_[_0x2284('0x22')](_0x5758ad[_0x2284('0x4b')][_0x2284('0x50')])||!_[_0x2284('0x22')](_0x5758ad[_0x2284('0x4b')][_0x2284('0x51')])){utils[_0x2284('0x24')](util[_0x2284('0xa')](_0x2284('0x52'),_0x5758ad[_0x2284('0x8')],!_['isNil'](_0x5758ad[_0x2284('0x4b')]['xmd-callerid-preview'])?_0x2284('0x50'):'xmd-callerid',_0x5758ad[_0x2284('0x4a')]));channels[_0x5758ad[_0x2284('0x8')]][_0x2284('0x2c')]=_0x5758ad[_0x2284('0x4a')];}if(!_['isNil'](_0x5758ad[_0x2284('0x4b')][_0x2284('0x53')])||!_[_0x2284('0x22')](_0x5758ad[_0x2284('0x4b')]['xmcs-queue'])){utils[_0x2284('0x24')](util[_0x2284('0xa')](_0x2284('0x52'),_0x5758ad['uniqueid'],!_['isNil'](_0x5758ad[_0x2284('0x4b')][_0x2284('0x53')])?'xmd-queue':_0x2284('0x54'),_0x5758ad['value']));channels[_0x5758ad[_0x2284('0x8')]][_0x2284('0x55')]='Queue';channels[_0x5758ad[_0x2284('0x8')]][_0x2284('0x56')]=_0x5758ad[_0x2284('0x4a')];channels[_0x5758ad[_0x2284('0x8')]][_0x2284('0xd')]=!![];}if(!_[_0x2284('0x22')](_0x5758ad[_0x2284('0x4b')][_0x2284('0x57')])){utils['info'](util[_0x2284('0xa')](_0x2284('0x58'),_0x5758ad[_0x2284('0x8')],_0x5758ad[_0x2284('0x4a')]));channels[_0x5758ad[_0x2284('0x8')]][_0x2284('0x59')]=_0x5758ad[_0x2284('0x4a')];}if(!_[_0x2284('0x22')](_0x5758ad[_0x2284('0x4b')][_0x2284('0x5a')])){utils[_0x2284('0x24')](util[_0x2284('0xa')]('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x5758ad['uniqueid'],_0x5758ad['value']));channels[_0x5758ad[_0x2284('0x8')]][_0x2284('0x5b')]=_0x5758ad[_0x2284('0x4a')];}if(!_[_0x2284('0x22')](_0x5758ad[_0x2284('0x4b')][_0x2284('0x5c')])){utils[_0x2284('0x24')](util[_0x2284('0xa')](_0x2284('0x5d'),_0x5758ad[_0x2284('0x8')],_0x5758ad[_0x2284('0x4a')]));channels[_0x5758ad[_0x2284('0x8')]]['routeid']=_0x5758ad[_0x2284('0x4a')];}if(!_[_0x2284('0x22')](_0x5758ad[_0x2284('0x4b')]['sipcallid'])){utils[_0x2284('0x24')](util[_0x2284('0xa')](_0x2284('0x5e'),_0x5758ad[_0x2284('0x8')],_0x5758ad[_0x2284('0x4a')]));channels[_0x5758ad['uniqueid']][_0x2284('0x5f')]=_0x5758ad[_0x2284('0x4a')];}}}catch(_0x5c7e93){utils[_0x2284('0x20')](util['format'](_0x2284('0x60'),_0x5758ad[_0x2284('0x8')]),_0x5c7e93);}};exports[_0x2284('0x61')]=function(_0x5cfd46){try{if(!_[_0x2284('0x22')](channels[_0x5cfd46[_0x2284('0x8')]])){utils[_0x2284('0x18')](util[_0x2284('0xa')](_0x2284('0x62'),_0x5cfd46['uniqueid']),_0x5cfd46);utils[_0x2284('0x24')](util['format'](_0x2284('0x63'),_0x5cfd46['uniqueid'],_0x5cfd46[_0x2284('0x64')],_0x5cfd46[_0x2284('0x65')]));if(_0x5cfd46[_0x2284('0x64')][_0x2284('0x66')]()==_0x2284('0x67')&&_[_0x2284('0x68')](_0x5cfd46['appdata'][_0x2284('0x66')](),_0x2284('0x69'))){var _0x10f52a=_0x5cfd46[_0x2284('0x65')][_0x2284('0x6a')]('=');var _0x44af90=_0x10f52a[0x0][_0x2284('0x6b')](_0x10f52a[0x0][_0x2284('0x6c')]('(')+0x1,_0x10f52a[0x0]['lastIndexOf'](')'));var _0x41e9de=_0x10f52a[0x1];channels[_0x5cfd46['uniqueid']][_0x44af90]=_0x41e9de;}if(!_['includes']([_0x2284('0x2b'),_0x2284('0x6d'),_0x2284('0x6e'),'set','gotoif'],_0x5cfd46[_0x2284('0x64')][_0x2284('0x66')]())){channels[_0x5cfd46[_0x2284('0x8')]][_0x2284('0x55')]=_0x5cfd46[_0x2284('0x64')];channels[_0x5cfd46['uniqueid']]['lastdata']=_0x5cfd46[_0x2284('0x65')];}}}catch(_0x24419d){utils[_0x2284('0x20')](util[_0x2284('0xa')](_0x2284('0x62'),_0x5cfd46['uniqueid']),_0x24419d);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index fbc2c05..87b49e6 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 _0x573a=['fullybooted','info','[core]\x20fullybooted','error','[core]\x20error','managerevent','./utils','connect','[core]\x20connected','shutdown','[core]\x20shutdown'];(function(_0x38c023,_0x179998){var _0x278dc9=function(_0x3ae6f7){while(--_0x3ae6f7){_0x38c023['push'](_0x38c023['shift']());}};_0x278dc9(++_0x179998);}(_0x573a,0xc1));var _0xa573=function(_0x146a85,_0x529b52){_0x146a85=_0x146a85-0x0;var _0x1b59bf=_0x573a[_0x146a85];return _0x1b59bf;};'use strict';var utils=require(_0xa573('0x0'));exports[_0xa573('0x1')]=function(){utils['info'](_0xa573('0x2'));};exports[_0xa573('0x3')]=function(){utils['info'](_0xa573('0x4'));};exports[_0xa573('0x5')]=function(){utils[_0xa573('0x6')](_0xa573('0x7'));};exports[_0xa573('0x8')]=function(_0xaa16fc){utils[_0xa573('0x8')](_0xa573('0x9'),_0xaa16fc);};exports['close']=function(){utils[_0xa573('0x6')]('[core]\x20close');};exports[_0xa573('0xa')]=function(_0x4674cb){}; \ No newline at end of file +var _0xa575=['managerevent','./utils','connect','info','[core]\x20connected','shutdown','[core]\x20shutdown','fullybooted','error','[core]\x20error','close'];(function(_0x3c2a69,_0x4c8b41){var _0x596bc8=function(_0x1b4b7c){while(--_0x1b4b7c){_0x3c2a69['push'](_0x3c2a69['shift']());}};_0x596bc8(++_0x4c8b41);}(_0xa575,0x1ae));var _0x5a57=function(_0x44e6b3,_0x47fc06){_0x44e6b3=_0x44e6b3-0x0;var _0x320086=_0xa575[_0x44e6b3];return _0x320086;};'use strict';var utils=require(_0x5a57('0x0'));exports[_0x5a57('0x1')]=function(){utils[_0x5a57('0x2')](_0x5a57('0x3'));};exports[_0x5a57('0x4')]=function(){utils[_0x5a57('0x2')](_0x5a57('0x5'));};exports[_0x5a57('0x6')]=function(){utils[_0x5a57('0x2')]('[core]\x20fullybooted');};exports[_0x5a57('0x7')]=function(_0x57eebb){utils[_0x5a57('0x7')](_0x5a57('0x8'),_0x57eebb);};exports[_0x5a57('0x9')]=function(){utils['info']('[core]\x20close');};exports[_0x5a57('0xa')]=function(_0x15ea2b){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 9cccb3b..2c5b6ac 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 _0xa79f=['startsWith','cdr(routeid)','appdata','split','varset','[%s][dials][varset]','variable','info','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','error','dialbegin','isNil','[%s][dials][dialbegin]','assign','now','called','starttime','dialend','[%s][dials][dialend]','dialstatus','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','complete','diffTime','endtime','holdtime','billableseconds','lodash','./utils','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','calleridnum','request','newexten','debug','format','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set'];(function(_0x5cf58f,_0xe83a7c){var _0x1c06ba=function(_0x5da802){while(--_0x5da802){_0x5cf58f['push'](_0x5cf58f['shift']());}};_0x1c06ba(++_0xe83a7c);}(_0xa79f,0x188));var _0xfa79=function(_0x3133db,_0x7d1e19){_0x3133db=_0x3133db-0x0;var _0xf0755c=_0xa79f[_0x3133db];return _0xf0755c;};'use strict';var _=require(_0xfa79('0x0'));var util=require('util');var utils=require(_0xfa79('0x1'));var dials={};function writeDB(_0x45a5a4){utils['info'](util['format'](_0xfa79('0x2'),_0x45a5a4[_0xfa79('0x3')],_0x45a5a4[_0xfa79('0x4')],_0x45a5a4[_0xfa79('0x5')],_0x45a5a4[_0xfa79('0x6')],_0x45a5a4['connectedlinenum'],_0x45a5a4['dialstatus']));utils[_0xfa79('0x7')]('CreateVoiceDialReport',_0x45a5a4);delete dials[_0x45a5a4[_0xfa79('0x3')]];}exports[_0xfa79('0x8')]=function(_0x107a9d){try{utils[_0xfa79('0x9')](util[_0xfa79('0xa')](_0xfa79('0xb'),_0x107a9d[_0xfa79('0x3')]),_0x107a9d);utils['info'](util['format'](_0xfa79('0xc'),_0x107a9d[_0xfa79('0x3')],_0x107a9d[_0xfa79('0xd')],_0x107a9d['appdata']));if(_0x107a9d['application'][_0xfa79('0xe')]()==_0xfa79('0xf')&&_[_0xfa79('0x10')](_0x107a9d['appdata'][_0xfa79('0xe')](),_0xfa79('0x11'))){var _0x2d532a=_0x107a9d[_0xfa79('0x12')][_0xfa79('0x13')]('=');dials[_0x107a9d[_0xfa79('0x3')]]={'routeId':_0x2d532a[0x1]};}}catch(_0x3ec4ff){utils['error'](util[_0xfa79('0xa')](_0xfa79('0xb'),_0x107a9d[_0xfa79('0x3')]),_0x3ec4ff);}};exports[_0xfa79('0x14')]=function(_0x386612){try{utils[_0xfa79('0x9')](util[_0xfa79('0xa')](_0xfa79('0x15'),_0x386612[_0xfa79('0x3')]),_0x386612);if(!_['isNil'](_0x386612[_0xfa79('0x16')]['outboundrouteid'])){utils[_0xfa79('0x17')](util[_0xfa79('0xa')](_0xfa79('0x18'),_0x386612['uniqueid'],_0x386612[_0xfa79('0x19')]));dials[_0x386612[_0xfa79('0x3')]]={'routeId':_0x386612[_0xfa79('0x19')]};}}catch(_0x4298c5){utils[_0xfa79('0x1a')](util[_0xfa79('0xa')]('[%s][dials][varset]',_0x386612['uniqueid']),_0x4298c5);}};exports[_0xfa79('0x1b')]=function(_0x4ca5e1){try{if(!_[_0xfa79('0x1c')](dials[_0x4ca5e1[_0xfa79('0x3')]])){utils[_0xfa79('0x9')](util[_0xfa79('0xa')](_0xfa79('0x1d'),_0x4ca5e1[_0xfa79('0x3')]),_0x4ca5e1);dials[_0x4ca5e1[_0xfa79('0x3')]]=_[_0xfa79('0x1e')](dials[_0x4ca5e1['uniqueid']],_0x4ca5e1);dials[_0x4ca5e1[_0xfa79('0x3')]]['starttime']=utils[_0xfa79('0x1f')]();dials[_0x4ca5e1[_0xfa79('0x3')]]['lastevent']=_0xfa79('0x20');utils[_0xfa79('0x17')](util[_0xfa79('0xa')]('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x4ca5e1[_0xfa79('0x3')],dials[_0x4ca5e1[_0xfa79('0x3')]][_0xfa79('0x21')]));}}catch(_0x34a57f){utils[_0xfa79('0x1a')](util[_0xfa79('0xa')]('[%s][dials][dialbegin]',_0x4ca5e1[_0xfa79('0x3')]),_0x34a57f);}};exports[_0xfa79('0x22')]=function(_0x4dbdbd){try{if(!_[_0xfa79('0x1c')](dials[_0x4dbdbd[_0xfa79('0x3')]])){utils[_0xfa79('0x9')](util[_0xfa79('0xa')](_0xfa79('0x23'),_0x4dbdbd[_0xfa79('0x3')]),_0x4dbdbd);dials[_0x4dbdbd[_0xfa79('0x3')]][_0xfa79('0x24')]=_0x4dbdbd['dialstatus'];if(_0x4dbdbd[_0xfa79('0x24')]=='ANSWER'){dials[_0x4dbdbd[_0xfa79('0x3')]]=_[_0xfa79('0x1e')](dials[_0x4dbdbd[_0xfa79('0x3')]],_0x4dbdbd);dials[_0x4dbdbd[_0xfa79('0x3')]][_0xfa79('0x25')]=utils[_0xfa79('0x1f')]();dials[_0x4dbdbd['uniqueid']]['lastevent']=_0xfa79('0x26');utils[_0xfa79('0x17')](util['format'](_0xfa79('0x27'),_0x4dbdbd[_0xfa79('0x3')],_0x4dbdbd[_0xfa79('0x24')],dials[_0x4dbdbd['uniqueid']][_0xfa79('0x25')]));}else{utils[_0xfa79('0x17')](util[_0xfa79('0xa')](_0xfa79('0x28'),_0x4dbdbd[_0xfa79('0x3')],_0x4dbdbd[_0xfa79('0x24')]));}}}catch(_0x17177b){utils[_0xfa79('0x1a')](util[_0xfa79('0xa')](_0xfa79('0x23'),_0x4dbdbd['uniqueid']),_0x17177b);}};exports[_0xfa79('0x29')]=function(_0x1a126b){try{if(!_[_0xfa79('0x1c')](dials[_0x1a126b[_0xfa79('0x3')]])){utils[_0xfa79('0x9')](util[_0xfa79('0xa')](_0xfa79('0x2a'),_0x1a126b[_0xfa79('0x3')]),_0x1a126b);utils['info'](util[_0xfa79('0xa')](_0xfa79('0x2b'),_0x1a126b[_0xfa79('0x3')],_0x1a126b[_0xfa79('0x6')],_0x1a126b[_0xfa79('0x2c')],_0x1a126b[_0xfa79('0x2d')]));dials[_0x1a126b[_0xfa79('0x3')]]=_[_0xfa79('0x1e')](dials[_0x1a126b[_0xfa79('0x3')]],{'endtime':utils[_0xfa79('0x1f')](),'lastevent':_0xfa79('0x2e')});dials[_0x1a126b[_0xfa79('0x3')]]['duration']=utils[_0xfa79('0x2f')](dials[_0x1a126b[_0xfa79('0x3')]][_0xfa79('0x30')],dials[_0x1a126b[_0xfa79('0x3')]][_0xfa79('0x21')]);dials[_0x1a126b['uniqueid']][_0xfa79('0x31')]=utils['diffTime'](dials[_0x1a126b['uniqueid']][_0xfa79('0x25')]||dials[_0x1a126b['uniqueid']][_0xfa79('0x30')],dials[_0x1a126b[_0xfa79('0x3')]][_0xfa79('0x21')]);dials[_0x1a126b[_0xfa79('0x3')]][_0xfa79('0x32')]=dials[_0x1a126b['uniqueid']][_0xfa79('0x25')]?utils['diffTime'](dials[_0x1a126b['uniqueid']]['endtime'],dials[_0x1a126b[_0xfa79('0x3')]][_0xfa79('0x25')]):0x0;writeDB(dials[_0x1a126b[_0xfa79('0x3')]]);}}catch(_0x499d86){utils[_0xfa79('0x1a')](util[_0xfa79('0xa')]('[%s][dials][hangup]',_0x1a126b[_0xfa79('0x3')]),_0x499d86);}}; \ No newline at end of file +var _0x2b14=['now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','ANSWER','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','complete','duration','diffTime','holdtime','endtime','lodash','info','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','channel','dialstring','calleridnum','connectedlinenum','dialstatus','request','uniqueid','newexten','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','startsWith','toLowerCase','cdr(routeid)','error','format','varset','[%s][dials][varset]','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','isNil','[%s][dials][dialbegin]','assign','starttime'];(function(_0x40de11,_0xf8ead7){var _0x32d576=function(_0x1d1220){while(--_0x1d1220){_0x40de11['push'](_0x40de11['shift']());}};_0x32d576(++_0xf8ead7);}(_0x2b14,0x123));var _0x42b1=function(_0x219bf7,_0x54ef58){_0x219bf7=_0x219bf7-0x0;var _0x1b7904=_0x2b14[_0x219bf7];return _0x1b7904;};'use strict';var _=require(_0x42b1('0x0'));var util=require('util');var utils=require('./utils');var dials={};function writeDB(_0x5aa757){utils[_0x42b1('0x1')](util['format'](_0x42b1('0x2'),_0x5aa757['uniqueid'],_0x5aa757[_0x42b1('0x3')],_0x5aa757[_0x42b1('0x4')],_0x5aa757[_0x42b1('0x5')],_0x5aa757[_0x42b1('0x6')],_0x5aa757[_0x42b1('0x7')]));utils[_0x42b1('0x8')]('CreateVoiceDialReport',_0x5aa757);delete dials[_0x5aa757[_0x42b1('0x9')]];}exports[_0x42b1('0xa')]=function(_0x315896){try{utils[_0x42b1('0xb')](util['format'](_0x42b1('0xc'),_0x315896['uniqueid']),_0x315896);utils[_0x42b1('0x1')](util['format'](_0x42b1('0xd'),_0x315896['uniqueid'],_0x315896[_0x42b1('0xe')],_0x315896[_0x42b1('0xf')]));if(_0x315896[_0x42b1('0xe')]['toLowerCase']()==_0x42b1('0x10')&&_[_0x42b1('0x11')](_0x315896[_0x42b1('0xf')][_0x42b1('0x12')](),_0x42b1('0x13'))){var _0x51a01c=_0x315896[_0x42b1('0xf')]['split']('=');dials[_0x315896[_0x42b1('0x9')]]={'routeId':_0x51a01c[0x1]};}}catch(_0x1c9079){utils[_0x42b1('0x14')](util[_0x42b1('0x15')](_0x42b1('0xc'),_0x315896[_0x42b1('0x9')]),_0x1c9079);}};exports[_0x42b1('0x16')]=function(_0x4eeb86){try{utils[_0x42b1('0xb')](util[_0x42b1('0x15')](_0x42b1('0x17'),_0x4eeb86[_0x42b1('0x9')]),_0x4eeb86);if(!_['isNil'](_0x4eeb86[_0x42b1('0x18')][_0x42b1('0x19')])){utils[_0x42b1('0x1')](util[_0x42b1('0x15')](_0x42b1('0x1a'),_0x4eeb86[_0x42b1('0x9')],_0x4eeb86['value']));dials[_0x4eeb86[_0x42b1('0x9')]]={'routeId':_0x4eeb86[_0x42b1('0x1b')]};}}catch(_0x3a2851){utils['error'](util[_0x42b1('0x15')](_0x42b1('0x17'),_0x4eeb86[_0x42b1('0x9')]),_0x3a2851);}};exports[_0x42b1('0x1c')]=function(_0xe37f8e){try{if(!_[_0x42b1('0x1d')](dials[_0xe37f8e['uniqueid']])){utils[_0x42b1('0xb')](util[_0x42b1('0x15')](_0x42b1('0x1e'),_0xe37f8e[_0x42b1('0x9')]),_0xe37f8e);dials[_0xe37f8e[_0x42b1('0x9')]]=_[_0x42b1('0x1f')](dials[_0xe37f8e[_0x42b1('0x9')]],_0xe37f8e);dials[_0xe37f8e[_0x42b1('0x9')]][_0x42b1('0x20')]=utils[_0x42b1('0x21')]();dials[_0xe37f8e[_0x42b1('0x9')]][_0x42b1('0x22')]=_0x42b1('0x23');utils[_0x42b1('0x1')](util[_0x42b1('0x15')](_0x42b1('0x24'),_0xe37f8e[_0x42b1('0x9')],dials[_0xe37f8e[_0x42b1('0x9')]][_0x42b1('0x20')]));}}catch(_0x3073b6){utils['error'](util[_0x42b1('0x15')](_0x42b1('0x1e'),_0xe37f8e[_0x42b1('0x9')]),_0x3073b6);}};exports[_0x42b1('0x25')]=function(_0x1e2c04){try{if(!_[_0x42b1('0x1d')](dials[_0x1e2c04[_0x42b1('0x9')]])){utils[_0x42b1('0xb')](util['format'](_0x42b1('0x26'),_0x1e2c04[_0x42b1('0x9')]),_0x1e2c04);dials[_0x1e2c04[_0x42b1('0x9')]][_0x42b1('0x7')]=_0x1e2c04[_0x42b1('0x7')];if(_0x1e2c04[_0x42b1('0x7')]==_0x42b1('0x27')){dials[_0x1e2c04[_0x42b1('0x9')]]=_[_0x42b1('0x1f')](dials[_0x1e2c04[_0x42b1('0x9')]],_0x1e2c04);dials[_0x1e2c04[_0x42b1('0x9')]][_0x42b1('0x28')]=utils['now']();dials[_0x1e2c04[_0x42b1('0x9')]][_0x42b1('0x22')]=_0x42b1('0x29');utils[_0x42b1('0x1')](util[_0x42b1('0x15')](_0x42b1('0x2a'),_0x1e2c04[_0x42b1('0x9')],_0x1e2c04['dialstatus'],dials[_0x1e2c04[_0x42b1('0x9')]][_0x42b1('0x28')]));}else{utils[_0x42b1('0x1')](util[_0x42b1('0x15')](_0x42b1('0x2b'),_0x1e2c04[_0x42b1('0x9')],_0x1e2c04['dialstatus']));}}}catch(_0x3cf78d){utils[_0x42b1('0x14')](util[_0x42b1('0x15')](_0x42b1('0x26'),_0x1e2c04[_0x42b1('0x9')]),_0x3cf78d);}};exports[_0x42b1('0x2c')]=function(_0x2b5ed0){try{if(!_['isNil'](dials[_0x2b5ed0[_0x42b1('0x9')]])){utils['debug'](util[_0x42b1('0x15')](_0x42b1('0x2d'),_0x2b5ed0[_0x42b1('0x9')]),_0x2b5ed0);utils[_0x42b1('0x1')](util[_0x42b1('0x15')](_0x42b1('0x2e'),_0x2b5ed0[_0x42b1('0x9')],_0x2b5ed0[_0x42b1('0x5')],_0x2b5ed0[_0x42b1('0x2f')],_0x2b5ed0[_0x42b1('0x30')]));dials[_0x2b5ed0['uniqueid']]=_[_0x42b1('0x1f')](dials[_0x2b5ed0[_0x42b1('0x9')]],{'endtime':utils['now'](),'lastevent':_0x42b1('0x31')});dials[_0x2b5ed0['uniqueid']][_0x42b1('0x32')]=utils[_0x42b1('0x33')](dials[_0x2b5ed0[_0x42b1('0x9')]]['endtime'],dials[_0x2b5ed0['uniqueid']][_0x42b1('0x20')]);dials[_0x2b5ed0[_0x42b1('0x9')]][_0x42b1('0x34')]=utils[_0x42b1('0x33')](dials[_0x2b5ed0[_0x42b1('0x9')]][_0x42b1('0x28')]||dials[_0x2b5ed0[_0x42b1('0x9')]][_0x42b1('0x35')],dials[_0x2b5ed0[_0x42b1('0x9')]][_0x42b1('0x20')]);dials[_0x2b5ed0[_0x42b1('0x9')]]['billableseconds']=dials[_0x2b5ed0[_0x42b1('0x9')]]['answertime']?utils[_0x42b1('0x33')](dials[_0x2b5ed0[_0x42b1('0x9')]][_0x42b1('0x35')],dials[_0x2b5ed0[_0x42b1('0x9')]][_0x42b1('0x28')]):0x0;writeDB(dials[_0x2b5ed0[_0x42b1('0x9')]]);}}catch(_0x5c745b){utils[_0x42b1('0x14')](util[_0x42b1('0x15')](_0x42b1('0x2d'),_0x2b5ed0[_0x42b1('0x9')]),_0x5c745b);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 73fe963..2fb0689 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 _0xff32=['newchannel','[%s][index][newchannel]','dialbegin','[%s]dialbegin','[%s][index][dialend]','dialend','asterisk-manager','./utils','xdr','disabled','env','production','local','port','asterisk','username','password','info','Asterisk\x20disabled\x20on\x20localhost','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','device','agentcalled','[%s][index][agentcalled]','uniqueid','[%s][index][agentringnoanswer]','agentringnoanswer','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','[%s][index][musiconholdstop]','musiconholdstop','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]'];(function(_0x226a41,_0x11ab55){var _0x42451e=function(_0x4a5a6b){while(--_0x4a5a6b){_0x226a41['push'](_0x226a41['shift']());}};_0x42451e(++_0x11ab55);}(_0xff32,0xcc));var _0x2ff3=function(_0x48b4a1,_0x3c2bf4){_0x48b4a1=_0x48b4a1-0x0;var _0x2df379=_0xff32[_0x48b4a1];return _0x2df379;};var AsteriskManager=require(_0x2ff3('0x0'));var config=require('../../config/environment');var utils=require(_0x2ff3('0x1'));var util=require('util');var isXDREnabled=config[_0x2ff3('0x2')]&&config[_0x2ff3('0x2')][_0x2ff3('0x3')]?!config[_0x2ff3('0x2')][_0x2ff3('0x3')]:!![];var isProduction=config[_0x2ff3('0x4')]===_0x2ff3('0x5')||![];var isLocalAsterisk=config[_0x2ff3('0x2')]&&config[_0x2ff3('0x2')][_0x2ff3('0x6')]===!![]||![];var ami=new AsteriskManager(config['asterisk'][_0x2ff3('0x7')],config[_0x2ff3('0x8')]['ip'],config[_0x2ff3('0x8')][_0x2ff3('0x9')],config['asterisk'][_0x2ff3('0xa')],!![]);ami['keepConnected']();if(!isXDREnabled){utils[_0x2ff3('0xb')]('XDR\x20DISABLED');}else if(!isProduction&&!isLocalAsterisk){utils[_0x2ff3('0xb')](_0x2ff3('0xc'));}else{var agents=require('./agents.controller');var calls=require('./calls.controller');var queues=require('./queues.controller');var recordings=require(_0x2ff3('0xd'));var members=require(_0x2ff3('0xe'));var dials=require(_0x2ff3('0xf'));var transfers=require(_0x2ff3('0x10'));var core=require(_0x2ff3('0x11'));ami['on'](_0x2ff3('0x12'),core[_0x2ff3('0x12')]);ami['on']('shutdown',core[_0x2ff3('0x13')]);ami['on']('fullybooted',core[_0x2ff3('0x14')]);ami['on'](_0x2ff3('0x15'),core[_0x2ff3('0x15')]);ami['on'](_0x2ff3('0x16'),core[_0x2ff3('0x16')]);ami['on'](_0x2ff3('0x17'),core[_0x2ff3('0x17')]);ami['on'](_0x2ff3('0x18'),function(_0x366efb){try{utils[_0x2ff3('0x19')](util[_0x2ff3('0x1a')]('[%s][index][devicestatechange]',_0x366efb[_0x2ff3('0x1b')]),_0x366efb);members[_0x2ff3('0x18')](_0x366efb);}catch(_0x234e00){utils[_0x2ff3('0x15')](util[_0x2ff3('0x1a')]('[%s][index][devicestatechange]',_0x366efb[_0x2ff3('0x1b')]),_0x234e00);}});ami['on'](_0x2ff3('0x1c'),function(_0x405ccf){try{utils[_0x2ff3('0x19')](util['format']('[%s][index][agentcalled]',_0x405ccf['uniqueid']),_0x405ccf);agents[_0x2ff3('0x1c')](_0x405ccf);}catch(_0x553b15){utils['error'](util[_0x2ff3('0x1a')](_0x2ff3('0x1d'),_0x405ccf[_0x2ff3('0x1e')]),_0x553b15);}});ami['on']('agentringnoanswer',function(_0xd19ed3){try{utils[_0x2ff3('0x19')](util[_0x2ff3('0x1a')](_0x2ff3('0x1f'),_0xd19ed3['uniqueid']),_0xd19ed3);agents[_0x2ff3('0x20')](_0xd19ed3);}catch(_0x19f00c){utils[_0x2ff3('0x15')](util[_0x2ff3('0x1a')](_0x2ff3('0x1f'),_0xd19ed3[_0x2ff3('0x1e')]),_0x19f00c);}});ami['on'](_0x2ff3('0x21'),function(_0x247b9a){try{utils[_0x2ff3('0x19')](util['format'](_0x2ff3('0x22'),_0x247b9a['uniqueid']),_0x247b9a);agents[_0x2ff3('0x21')](_0x247b9a);queues[_0x2ff3('0x21')](_0x247b9a);}catch(_0x5ea023){utils['error'](util[_0x2ff3('0x1a')]('[%s][index][agentconnect]',_0x247b9a[_0x2ff3('0x1e')]),_0x5ea023);}});ami['on'](_0x2ff3('0x23'),function(_0x191178){try{utils[_0x2ff3('0x19')](util[_0x2ff3('0x1a')](_0x2ff3('0x24'),_0x191178['uniqueid']),_0x191178);agents[_0x2ff3('0x23')](_0x191178);queues['agentcomplete'](_0x191178);members[_0x2ff3('0x23')](_0x191178);}catch(_0x1340d2){utils['error'](util[_0x2ff3('0x1a')]('[%s][index][agentcomplete]',_0x191178[_0x2ff3('0x1e')]),_0x1340d2);}});ami['on'](_0x2ff3('0x25'),function(_0x2eddc3){try{utils[_0x2ff3('0x19')](util[_0x2ff3('0x1a')]('[%s][index][queuecallerabandon]',_0x2eddc3['uniqueid']),_0x2eddc3);agents['queuecallerabandon'](_0x2eddc3);queues['queuecallerabandon'](_0x2eddc3);}catch(_0xf98eba){utils[_0x2ff3('0x15')](util[_0x2ff3('0x1a')](_0x2ff3('0x26'),_0x2eddc3['uniqueid']),_0xf98eba);}});ami['on'](_0x2ff3('0x27'),function(_0x459e77){try{utils[_0x2ff3('0x19')](util[_0x2ff3('0x1a')](_0x2ff3('0x28'),_0x459e77[_0x2ff3('0x1e')]),_0x459e77);queues[_0x2ff3('0x27')](_0x459e77);recordings['queuecallerjoin'](_0x459e77);}catch(_0x3ef9b9){utils['error'](util[_0x2ff3('0x1a')](_0x2ff3('0x28'),_0x459e77[_0x2ff3('0x1e')]),_0x3ef9b9);}});ami['on']('queuecallerleave',function(_0x2b8c2d){try{utils[_0x2ff3('0x19')](util['format'](_0x2ff3('0x29'),_0x2b8c2d[_0x2ff3('0x1e')]),_0x2b8c2d);queues['queuecallerleave'](_0x2b8c2d);}catch(_0x3f9df4){utils[_0x2ff3('0x15')](util[_0x2ff3('0x1a')]('[%s][index][queuecallerleave]',_0x2b8c2d['uniqueid']),_0x3f9df4);}});ami['on'](_0x2ff3('0x2a'),function(_0x49a0aa){try{utils[_0x2ff3('0x19')](util[_0x2ff3('0x1a')](_0x2ff3('0x2b'),_0x49a0aa[_0x2ff3('0x1e')]),_0x49a0aa);queues[_0x2ff3('0x2a')](_0x49a0aa);calls[_0x2ff3('0x2a')](_0x49a0aa);}catch(_0x4bc6b7){utils[_0x2ff3('0x15')](util[_0x2ff3('0x1a')](_0x2ff3('0x2b'),_0x49a0aa[_0x2ff3('0x1e')]),_0x4bc6b7);}});ami['on']('musiconholdstop',function(_0x5096da){try{utils[_0x2ff3('0x19')](util[_0x2ff3('0x1a')](_0x2ff3('0x2c'),_0x5096da[_0x2ff3('0x1e')]),_0x5096da);queues[_0x2ff3('0x2d')](_0x5096da);calls[_0x2ff3('0x2d')](_0x5096da);}catch(_0x2e42ec){utils[_0x2ff3('0x15')](util[_0x2ff3('0x1a')](_0x2ff3('0x2c'),_0x5096da['uniqueid']),_0x2e42ec);}});ami['on'](_0x2ff3('0x2e'),function(_0x3afeba){try{utils[_0x2ff3('0x19')](util[_0x2ff3('0x1a')](_0x2ff3('0x2f'),_0x3afeba['uniqueid']),_0x3afeba);calls[_0x2ff3('0x2e')](_0x3afeba);recordings[_0x2ff3('0x2e')](_0x3afeba);}catch(_0x17357e){utils[_0x2ff3('0x15')](util[_0x2ff3('0x1a')](_0x2ff3('0x2f'),_0x3afeba['uniqueid']),_0x17357e);}});ami['on']('hangup',function(_0x49ecc2){try{utils[_0x2ff3('0x19')](util[_0x2ff3('0x1a')]('[%s][index][hangup]',_0x49ecc2[_0x2ff3('0x1e')]),_0x49ecc2);calls['hangup'](_0x49ecc2);recordings['hangup'](_0x49ecc2);dials[_0x2ff3('0x30')](_0x49ecc2);agents[_0x2ff3('0x30')](_0x49ecc2);queues['hangup'](_0x49ecc2);}catch(_0x212632){utils[_0x2ff3('0x15')](util[_0x2ff3('0x1a')](_0x2ff3('0x31'),_0x49ecc2[_0x2ff3('0x1e')]),_0x212632);}});ami['on']('cdr',function(_0x32adc0){try{utils[_0x2ff3('0x19')](util[_0x2ff3('0x1a')](_0x2ff3('0x32'),_0x32adc0[_0x2ff3('0x1e')]),_0x32adc0);members['cdr'](_0x32adc0);}catch(_0x3b0df4){utils[_0x2ff3('0x15')](util[_0x2ff3('0x1a')](_0x2ff3('0x32'),_0x32adc0['uniqueid']),_0x3b0df4);}});ami['on'](_0x2ff3('0x33'),function(_0x271f4e){try{utils['debug'](util[_0x2ff3('0x1a')](_0x2ff3('0x34'),_0x271f4e['uniqueid']),_0x271f4e);queues[_0x2ff3('0x33')](_0x271f4e);agents['blindtransfer'](_0x271f4e);transfers[_0x2ff3('0x33')](_0x271f4e);recordings['blindtransfer'](_0x271f4e);}catch(_0x32d3ce){utils[_0x2ff3('0x15')](util[_0x2ff3('0x1a')](_0x2ff3('0x34'),_0x271f4e['uniqueid']),_0x32d3ce);}});ami['on'](_0x2ff3('0x35'),function(_0x30ddf6){try{utils['debug'](util[_0x2ff3('0x1a')](_0x2ff3('0x36'),_0x30ddf6[_0x2ff3('0x37')]),_0x30ddf6);queues[_0x2ff3('0x35')](_0x30ddf6);transfers[_0x2ff3('0x35')](_0x30ddf6);agents[_0x2ff3('0x35')](_0x30ddf6);calls['attendedtransfer'](_0x30ddf6);}catch(_0x50282a){utils[_0x2ff3('0x15')](util[_0x2ff3('0x1a')](_0x2ff3('0x36'),_0x30ddf6['origtransfereruniqueid']),_0x50282a);}});ami['on']('varset',function(_0x8065ee){try{utils[_0x2ff3('0x19')](util[_0x2ff3('0x1a')]('[%s][index][varset]',_0x8065ee['uniqueid']),_0x8065ee);queues[_0x2ff3('0x38')](_0x8065ee);recordings[_0x2ff3('0x38')](_0x8065ee);calls[_0x2ff3('0x38')](_0x8065ee);dials[_0x2ff3('0x38')](_0x8065ee);}catch(_0x49a699){utils[_0x2ff3('0x15')](util[_0x2ff3('0x1a')](_0x2ff3('0x39'),_0x8065ee['uniqueid']),_0x49a699);}});ami['on'](_0x2ff3('0x3a'),function(_0x49e8ad){try{utils[_0x2ff3('0x19')](util['format'](_0x2ff3('0x3b'),_0x49e8ad[_0x2ff3('0x1e')]),_0x49e8ad);calls[_0x2ff3('0x3a')](_0x49e8ad);recordings[_0x2ff3('0x3a')](_0x49e8ad);dials['newexten'](_0x49e8ad);}catch(_0x2c4a15){utils['error'](util[_0x2ff3('0x1a')](_0x2ff3('0x3b'),_0x49e8ad[_0x2ff3('0x1e')]),_0x2c4a15);}});ami['on'](_0x2ff3('0x3c'),function(_0x36e374){try{utils['debug'](util['format'](_0x2ff3('0x3d'),_0x36e374[_0x2ff3('0x1e')]),_0x36e374);calls[_0x2ff3('0x3c')](_0x36e374);recordings[_0x2ff3('0x3c')](_0x36e374);}catch(_0x251968){utils[_0x2ff3('0x15')](util[_0x2ff3('0x1a')](_0x2ff3('0x3d'),_0x36e374['uniqueid']),_0x251968);}});ami['on']('dialbegin',function(_0x562924){try{utils['debug'](util[_0x2ff3('0x1a')]('[%s][index][dialbegin]',_0x562924[_0x2ff3('0x1e')]),_0x562924);dials[_0x2ff3('0x3e')](_0x562924);}catch(_0xad576a){utils[_0x2ff3('0x15')](util[_0x2ff3('0x1a')](_0x2ff3('0x3f'),_0x562924['uniqueid']),_0xad576a);}});ami['on']('dialend',function(_0x577502){try{utils[_0x2ff3('0x19')](util['format'](_0x2ff3('0x40'),_0x577502['uniqueid']),_0x577502);dials[_0x2ff3('0x41')](_0x577502);}catch(_0x2ac6d6){utils[_0x2ff3('0x15')](util[_0x2ff3('0x1a')](_0x2ff3('0x40'),_0x577502[_0x2ff3('0x1e')]),_0x2ac6d6);}});} \ No newline at end of file +var _0x935d=['device','[%s][index][devicestatechange]','uniqueid','agentcalled','[%s][index][agentcalled]','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','[%s][index][queuecallerjoin]','queuecallerjoin','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','origtransfereruniqueid','[%s][index][attendedtransfer]','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','util','disabled','production','xdr','local','asterisk','port','username','password','keepConnected','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./queues.controller','./members.controller','./transfers.controller','shutdown','fullybooted','error','close','devicestatechange','debug','format'];(function(_0x322522,_0x4db288){var _0x293bcf=function(_0xf108b8){while(--_0xf108b8){_0x322522['push'](_0x322522['shift']());}};_0x293bcf(++_0x4db288);}(_0x935d,0xf9));var _0xd935=function(_0x254abd,_0x1ab7f0){_0x254abd=_0x254abd-0x0;var _0x31bf1b=_0x935d[_0x254abd];return _0x31bf1b;};var AsteriskManager=require(_0xd935('0x0'));var config=require(_0xd935('0x1'));var utils=require('./utils');var util=require(_0xd935('0x2'));var isXDREnabled=config['xdr']&&config['xdr'][_0xd935('0x3')]?!config['xdr']['disabled']:!![];var isProduction=config['env']===_0xd935('0x4')||![];var isLocalAsterisk=config['xdr']&&config[_0xd935('0x5')][_0xd935('0x6')]===!![]||![];var ami=new AsteriskManager(config[_0xd935('0x7')][_0xd935('0x8')],config[_0xd935('0x7')]['ip'],config[_0xd935('0x7')][_0xd935('0x9')],config[_0xd935('0x7')][_0xd935('0xa')],!![]);ami[_0xd935('0xb')]();if(!isXDREnabled){utils[_0xd935('0xc')](_0xd935('0xd'));}else if(!isProduction&&!isLocalAsterisk){utils[_0xd935('0xc')](_0xd935('0xe'));}else{var agents=require(_0xd935('0xf'));var calls=require(_0xd935('0x10'));var queues=require(_0xd935('0x11'));var recordings=require('./recordings.controller');var members=require(_0xd935('0x12'));var dials=require('./dials.controller');var transfers=require(_0xd935('0x13'));var core=require('./core.controller');ami['on']('connect',core['connect']);ami['on'](_0xd935('0x14'),core[_0xd935('0x14')]);ami['on']('fullybooted',core[_0xd935('0x15')]);ami['on'](_0xd935('0x16'),core[_0xd935('0x16')]);ami['on']('close',core[_0xd935('0x17')]);ami['on']('managerevent',core['managerevent']);ami['on'](_0xd935('0x18'),function(_0x2bf9e4){try{utils[_0xd935('0x19')](util[_0xd935('0x1a')]('[%s][index][devicestatechange]',_0x2bf9e4[_0xd935('0x1b')]),_0x2bf9e4);members[_0xd935('0x18')](_0x2bf9e4);}catch(_0x2be3f4){utils['error'](util[_0xd935('0x1a')](_0xd935('0x1c'),_0x2bf9e4['device']),_0x2be3f4);}});ami['on']('agentcalled',function(_0xd401a1){try{utils[_0xd935('0x19')](util[_0xd935('0x1a')]('[%s][index][agentcalled]',_0xd401a1[_0xd935('0x1d')]),_0xd401a1);agents[_0xd935('0x1e')](_0xd401a1);}catch(_0x1a8fdd){utils[_0xd935('0x16')](util[_0xd935('0x1a')](_0xd935('0x1f'),_0xd401a1[_0xd935('0x1d')]),_0x1a8fdd);}});ami['on'](_0xd935('0x20'),function(_0x28e1aa){try{utils[_0xd935('0x19')](util['format'](_0xd935('0x21'),_0x28e1aa[_0xd935('0x1d')]),_0x28e1aa);agents[_0xd935('0x20')](_0x28e1aa);}catch(_0x2b12aa){utils[_0xd935('0x16')](util[_0xd935('0x1a')](_0xd935('0x21'),_0x28e1aa[_0xd935('0x1d')]),_0x2b12aa);}});ami['on'](_0xd935('0x22'),function(_0x54f59a){try{utils['debug'](util[_0xd935('0x1a')](_0xd935('0x23'),_0x54f59a[_0xd935('0x1d')]),_0x54f59a);agents[_0xd935('0x22')](_0x54f59a);queues[_0xd935('0x22')](_0x54f59a);}catch(_0x1c9d6f){utils['error'](util[_0xd935('0x1a')](_0xd935('0x23'),_0x54f59a[_0xd935('0x1d')]),_0x1c9d6f);}});ami['on'](_0xd935('0x24'),function(_0x5157e5){try{utils[_0xd935('0x19')](util[_0xd935('0x1a')](_0xd935('0x25'),_0x5157e5['uniqueid']),_0x5157e5);agents[_0xd935('0x24')](_0x5157e5);queues[_0xd935('0x24')](_0x5157e5);members[_0xd935('0x24')](_0x5157e5);}catch(_0x3a2842){utils[_0xd935('0x16')](util[_0xd935('0x1a')](_0xd935('0x25'),_0x5157e5[_0xd935('0x1d')]),_0x3a2842);}});ami['on'](_0xd935('0x26'),function(_0x332897){try{utils[_0xd935('0x19')](util[_0xd935('0x1a')](_0xd935('0x27'),_0x332897[_0xd935('0x1d')]),_0x332897);agents[_0xd935('0x26')](_0x332897);queues[_0xd935('0x26')](_0x332897);}catch(_0x5ecec2){utils[_0xd935('0x16')](util[_0xd935('0x1a')](_0xd935('0x27'),_0x332897['uniqueid']),_0x5ecec2);}});ami['on']('queuecallerjoin',function(_0x5d2bf9){try{utils[_0xd935('0x19')](util[_0xd935('0x1a')](_0xd935('0x28'),_0x5d2bf9['uniqueid']),_0x5d2bf9);queues[_0xd935('0x29')](_0x5d2bf9);recordings[_0xd935('0x29')](_0x5d2bf9);}catch(_0x42e275){utils[_0xd935('0x16')](util[_0xd935('0x1a')](_0xd935('0x28'),_0x5d2bf9[_0xd935('0x1d')]),_0x42e275);}});ami['on'](_0xd935('0x2a'),function(_0x49b8de){try{utils[_0xd935('0x19')](util[_0xd935('0x1a')](_0xd935('0x2b'),_0x49b8de[_0xd935('0x1d')]),_0x49b8de);queues[_0xd935('0x2a')](_0x49b8de);}catch(_0x4cc35b){utils[_0xd935('0x16')](util[_0xd935('0x1a')]('[%s][index][queuecallerleave]',_0x49b8de['uniqueid']),_0x4cc35b);}});ami['on'](_0xd935('0x2c'),function(_0x224fa8){try{utils[_0xd935('0x19')](util[_0xd935('0x1a')](_0xd935('0x2d'),_0x224fa8[_0xd935('0x1d')]),_0x224fa8);queues[_0xd935('0x2c')](_0x224fa8);calls[_0xd935('0x2c')](_0x224fa8);}catch(_0x37bfac){utils[_0xd935('0x16')](util['format'](_0xd935('0x2d'),_0x224fa8[_0xd935('0x1d')]),_0x37bfac);}});ami['on'](_0xd935('0x2e'),function(_0x8f5bf7){try{utils[_0xd935('0x19')](util[_0xd935('0x1a')](_0xd935('0x2f'),_0x8f5bf7[_0xd935('0x1d')]),_0x8f5bf7);queues[_0xd935('0x2e')](_0x8f5bf7);calls[_0xd935('0x2e')](_0x8f5bf7);}catch(_0x5ad555){utils[_0xd935('0x16')](util[_0xd935('0x1a')]('[%s][index][musiconholdstop]',_0x8f5bf7['uniqueid']),_0x5ad555);}});ami['on'](_0xd935('0x30'),function(_0x4ec2e1){try{utils[_0xd935('0x19')](util['format'](_0xd935('0x31'),_0x4ec2e1[_0xd935('0x1d')]),_0x4ec2e1);calls[_0xd935('0x30')](_0x4ec2e1);recordings['newstate'](_0x4ec2e1);}catch(_0x3008bd){utils[_0xd935('0x16')](util[_0xd935('0x1a')](_0xd935('0x31'),_0x4ec2e1['uniqueid']),_0x3008bd);}});ami['on']('hangup',function(_0x44664f){try{utils[_0xd935('0x19')](util['format']('[%s][index][hangup]',_0x44664f['uniqueid']),_0x44664f);calls[_0xd935('0x32')](_0x44664f);recordings[_0xd935('0x32')](_0x44664f);dials[_0xd935('0x32')](_0x44664f);agents['hangup'](_0x44664f);queues[_0xd935('0x32')](_0x44664f);}catch(_0x93e1e){utils[_0xd935('0x16')](util[_0xd935('0x1a')](_0xd935('0x33'),_0x44664f[_0xd935('0x1d')]),_0x93e1e);}});ami['on'](_0xd935('0x34'),function(_0x1c150a){try{utils[_0xd935('0x19')](util[_0xd935('0x1a')]('[%s][index][cdr]',_0x1c150a[_0xd935('0x1d')]),_0x1c150a);members['cdr'](_0x1c150a);}catch(_0x1a1581){utils[_0xd935('0x16')](util[_0xd935('0x1a')](_0xd935('0x35'),_0x1c150a[_0xd935('0x1d')]),_0x1a1581);}});ami['on'](_0xd935('0x36'),function(_0x974a8c){try{utils['debug'](util[_0xd935('0x1a')]('[%s][index][blindtransfer]',_0x974a8c[_0xd935('0x1d')]),_0x974a8c);queues['blindtransfer'](_0x974a8c);agents['blindtransfer'](_0x974a8c);transfers[_0xd935('0x36')](_0x974a8c);recordings[_0xd935('0x36')](_0x974a8c);}catch(_0x2dbf9d){utils[_0xd935('0x16')](util[_0xd935('0x1a')](_0xd935('0x37'),_0x974a8c['uniqueid']),_0x2dbf9d);}});ami['on'](_0xd935('0x38'),function(_0x5ba7a2){try{utils[_0xd935('0x19')](util[_0xd935('0x1a')]('[%s][index][attendedtransfer]',_0x5ba7a2[_0xd935('0x39')]),_0x5ba7a2);queues['attendedtransfer'](_0x5ba7a2);transfers['attendedtransfer'](_0x5ba7a2);agents[_0xd935('0x38')](_0x5ba7a2);calls[_0xd935('0x38')](_0x5ba7a2);}catch(_0x5a0082){utils[_0xd935('0x16')](util[_0xd935('0x1a')](_0xd935('0x3a'),_0x5ba7a2[_0xd935('0x39')]),_0x5a0082);}});ami['on'](_0xd935('0x3b'),function(_0x24e9ba){try{utils[_0xd935('0x19')](util['format']('[%s][index][varset]',_0x24e9ba[_0xd935('0x1d')]),_0x24e9ba);queues[_0xd935('0x3b')](_0x24e9ba);recordings['varset'](_0x24e9ba);calls[_0xd935('0x3b')](_0x24e9ba);dials[_0xd935('0x3b')](_0x24e9ba);}catch(_0x135663){utils['error'](util[_0xd935('0x1a')](_0xd935('0x3c'),_0x24e9ba[_0xd935('0x1d')]),_0x135663);}});ami['on'](_0xd935('0x3d'),function(_0x394a17){try{utils[_0xd935('0x19')](util[_0xd935('0x1a')](_0xd935('0x3e'),_0x394a17[_0xd935('0x1d')]),_0x394a17);calls['newexten'](_0x394a17);recordings[_0xd935('0x3d')](_0x394a17);dials[_0xd935('0x3d')](_0x394a17);}catch(_0x2fd29b){utils[_0xd935('0x16')](util[_0xd935('0x1a')](_0xd935('0x3e'),_0x394a17[_0xd935('0x1d')]),_0x2fd29b);}});ami['on']('newchannel',function(_0x3b1ca4){try{utils[_0xd935('0x19')](util[_0xd935('0x1a')]('[%s][index][newchannel]',_0x3b1ca4[_0xd935('0x1d')]),_0x3b1ca4);calls['newchannel'](_0x3b1ca4);recordings[_0xd935('0x3f')](_0x3b1ca4);}catch(_0x4e0e8a){utils[_0xd935('0x16')](util['format'](_0xd935('0x40'),_0x3b1ca4['uniqueid']),_0x4e0e8a);}});ami['on'](_0xd935('0x41'),function(_0xe15a21){try{utils[_0xd935('0x19')](util['format']('[%s][index][dialbegin]',_0xe15a21[_0xd935('0x1d')]),_0xe15a21);dials['dialbegin'](_0xe15a21);}catch(_0x149982){utils[_0xd935('0x16')](util[_0xd935('0x1a')](_0xd935('0x42'),_0xe15a21[_0xd935('0x1d')]),_0x149982);}});ami['on'](_0xd935('0x43'),function(_0x358bd1){try{utils['debug'](util[_0xd935('0x1a')](_0xd935('0x44'),_0x358bd1[_0xd935('0x1d')]),_0x358bd1);dials['dialend'](_0x358bd1);}catch(_0x2e7109){utils[_0xd935('0x16')](util[_0xd935('0x1a')](_0xd935('0x44'),_0x358bd1[_0xd935('0x1d')]),_0x2e7109);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index a2dc68a..09d04da 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 _0x0ec7=['[%s][members][cdr]','data1','type','source','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data3','destinationchannel','lodash','util','./utils','Local/_attended@transfer','Queue:','info','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','data2','membername','interface','getUserByInterface','then','name','internal','request','getUserByName','split','CreateMemberReport','catch','error','format','[%s][members][writeDB]','some','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','now','NOT_INUSE','isNil','exitAt','duration','diffTime','enterAt','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','debug'];(function(_0x431dbc,_0x1cd214){var _0x2e5bed=function(_0x1d3faf){while(--_0x1d3faf){_0x431dbc['push'](_0x431dbc['shift']());}};_0x2e5bed(++_0x1cd214);}(_0x0ec7,0x1dc));var _0x70ec=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x0ec7[_0x31e29a];return _0x32d892;};'use strict';var _=require(_0x70ec('0x0'));var util=require(_0x70ec('0x1'));var utils=require(_0x70ec('0x2'));var members={};var exclude=[_0x70ec('0x3'),_0x70ec('0x4')];function writeDB(_0xf3bac0){utils[_0x70ec('0x5')](util['format'](_0x70ec('0x6'),_0xf3bac0[_0x70ec('0x7')],_0xf3bac0['interface'],_0xf3bac0['channel'],_0xf3bac0[_0x70ec('0x8')],_0xf3bac0[_0x70ec('0x9')],_0xf3bac0['type']));if(_0xf3bac0[_0x70ec('0xa')]){utils[_0x70ec('0xb')](_0xf3bac0[_0x70ec('0xa')])[_0x70ec('0xc')](function(_0x28c9f8){if(_0x28c9f8){_0xf3bac0[_0x70ec('0x9')]=_0x28c9f8[_0x70ec('0xd')];_0xf3bac0['internal']=_0x28c9f8[_0x70ec('0xe')];utils[_0x70ec('0xf')]('CreateMemberReport',_0xf3bac0);}else{utils[_0x70ec('0x10')](_0xf3bac0[_0x70ec('0xa')][_0x70ec('0x11')]('/')[0x1])[_0x70ec('0xc')](function(_0x1457cd){if(_0x1457cd){_0xf3bac0['membername']=_0x1457cd[_0x70ec('0xd')];_0xf3bac0[_0x70ec('0xe')]=_0x1457cd[_0x70ec('0xe')];utils[_0x70ec('0xf')](_0x70ec('0x12'),_0xf3bac0);}});}})[_0x70ec('0x13')](function(_0x29e3b9){utils[_0x70ec('0x14')](util[_0x70ec('0x15')](_0x70ec('0x16'),_0xf3bac0[_0x70ec('0x7')]),_0x29e3b9);});}delete members[_0xf3bac0[_0x70ec('0xa')]];}function startsWith(_0x42aa13,_0x40dd4a){return _[_0x70ec('0x17')](_0x42aa13,function(_0x2ff786){return _['startsWith'](_0x40dd4a,_0x2ff786);});}exports['devicestatechange']=function(_0x450f58){try{utils['debug'](util[_0x70ec('0x15')](_0x70ec('0x18'),members[_0x450f58[_0x70ec('0x19')]]?members[_0x450f58[_0x70ec('0x19')]][_0x70ec('0x7')]:_0x450f58[_0x70ec('0x19')]),_0x450f58);utils[_0x70ec('0x5')](util['format'](_0x70ec('0x1a'),members[_0x450f58[_0x70ec('0x19')]]?members[_0x450f58[_0x70ec('0x19')]][_0x70ec('0x7')]:_0x450f58[_0x70ec('0x19')],_0x450f58[_0x70ec('0x1b')],_0x450f58[_0x70ec('0x19')]));switch(_0x450f58[_0x70ec('0x1b')]){case _0x70ec('0x1c'):case _0x70ec('0x1d'):if(!startsWith(exclude,_0x450f58['device'])){members[_0x450f58[_0x70ec('0x19')]]={'channel':_0x70ec('0x1e'),'interface':_0x450f58[_0x70ec('0x19')],'type':'TALKING','enterAt':utils[_0x70ec('0x1f')](),'role':'agent'};}break;case _0x70ec('0x20'):if(!_[_0x70ec('0x21')](members[_0x450f58[_0x70ec('0x19')]])){members[_0x450f58['device']][_0x70ec('0x22')]=utils[_0x70ec('0x1f')]();members[_0x450f58[_0x70ec('0x19')]][_0x70ec('0x23')]=utils[_0x70ec('0x24')](members[_0x450f58[_0x70ec('0x19')]]['exitAt'],members[_0x450f58[_0x70ec('0x19')]][_0x70ec('0x25')]);if(members[_0x450f58[_0x70ec('0x19')]][_0x70ec('0x7')]){writeDB(members[_0x450f58[_0x70ec('0x19')]]);}}break;default:break;}}catch(_0x503a6f){utils[_0x70ec('0x14')](util['format'](_0x70ec('0x18'),members[_0x450f58[_0x70ec('0x19')]]?members[_0x450f58[_0x70ec('0x19')]][_0x70ec('0x7')]:_0x450f58[_0x70ec('0x19')]),_0x503a6f);}};exports[_0x70ec('0x26')]=function(_0x288064){try{if(!_[_0x70ec('0x21')](members[_0x288064['interface']])){utils['debug'](util[_0x70ec('0x15')](_0x70ec('0x27'),_0x288064['uniqueid']),_0x288064);utils[_0x70ec('0x5')](util[_0x70ec('0x15')](_0x70ec('0x28'),_0x288064['uniqueid'],_0x288064[_0x70ec('0xa')],_0x288064[_0x70ec('0x29')]));members[_0x288064[_0x70ec('0xa')]]=_[_0x70ec('0x2a')](members[_0x288064[_0x70ec('0xa')]],{'data4':_0x288064[_0x70ec('0x29')],'uniqueid':_0x288064[_0x70ec('0x7')]});}}catch(_0x135ec7){utils[_0x70ec('0x14')](util[_0x70ec('0x15')](_0x70ec('0x27'),_0x288064[_0x70ec('0x7')]),_0x135ec7);}};exports['cdr']=function(_0x129df6){try{utils[_0x70ec('0x2b')](util[_0x70ec('0x15')](_0x70ec('0x2c'),_0x129df6['uniqueid']),_0x129df6);if(_0x129df6['channel']){var _0x3f319a=_0x129df6['channel'][_0x70ec('0x11')]('-')[0x0];if(!_[_0x70ec('0x21')](members[_0x3f319a])){members[_0x3f319a]=_[_0x70ec('0x2a')](members[_0x3f319a],{'data1':members[_0x3f319a][_0x70ec('0x2d')]||_0x129df6[_0x70ec('0x2e')],'data2':members[_0x3f319a][_0x70ec('0x8')]||_0x129df6[_0x70ec('0x2f')],'data3':members[_0x3f319a]['data3']||_0x129df6[_0x70ec('0x30')],'uniqueid':members[_0x3f319a]['uniqueid']||_0x129df6[_0x70ec('0x7')]});utils[_0x70ec('0x5')](util['format'](_0x70ec('0x31'),_0x129df6[_0x70ec('0x7')],members[_0x3f319a]['data1'],members[_0x3f319a]['data2'],members[_0x3f319a][_0x70ec('0x32')]));if(members[_0x3f319a][_0x70ec('0x22')]){writeDB(members[_0x3f319a]);}}}if(_0x129df6[_0x70ec('0x33')]){var _0x26d728=_0x129df6['destinationchannel'][_0x70ec('0x11')]('-')[0x0];if(!_['isNil'](members[_0x26d728])){members[_0x26d728]=_[_0x70ec('0x2a')](members[_0x26d728],{'data1':members[_0x26d728][_0x70ec('0x2d')]||_0x129df6[_0x70ec('0x2e')],'data2':members[_0x26d728][_0x70ec('0x8')]||_0x129df6[_0x70ec('0x2f')],'data3':members[_0x26d728][_0x70ec('0x32')]||_0x129df6[_0x70ec('0x30')],'uniqueid':members[_0x26d728][_0x70ec('0x7')]||_0x129df6[_0x70ec('0x7')]});utils[_0x70ec('0x5')](util[_0x70ec('0x15')](_0x70ec('0x31'),_0x129df6[_0x70ec('0x7')],members[_0x26d728][_0x70ec('0x2d')],members[_0x26d728][_0x70ec('0x8')],members[_0x26d728]['data3']));if(members[_0x26d728][_0x70ec('0x22')]){writeDB(members[_0x26d728]);}}}}catch(_0xa9f35f){utils[_0x70ec('0x14')](util[_0x70ec('0x15')](_0x70ec('0x2c'),_0x129df6[_0x70ec('0x7')]),_0xa9f35f);}}; \ No newline at end of file +var _0xa4b1=['type','getUserByInterface','membername','internal','CreateMemberReport','getUserByName','split','then','name','request','catch','error','[%s][members][writeDB]','some','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','BUSY','voice','TALKING','now','NOT_INUSE','exitAt','duration','enterAt','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','[%s][members][cdr]','data1','source','data3','destinationchannel','isNil','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','lodash','util','./utils','Local/_attended@transfer','Queue:','info','format','uniqueid','interface','channel','data2'];(function(_0x36d11c,_0x6dffa7){var _0xd95b50=function(_0x5ed180){while(--_0x5ed180){_0x36d11c['push'](_0x36d11c['shift']());}};_0xd95b50(++_0x6dffa7);}(_0xa4b1,0x133));var _0x1a4b=function(_0x55abd9,_0x1148af){_0x55abd9=_0x55abd9-0x0;var _0x3e5669=_0xa4b1[_0x55abd9];return _0x3e5669;};'use strict';var _=require(_0x1a4b('0x0'));var util=require(_0x1a4b('0x1'));var utils=require(_0x1a4b('0x2'));var members={};var exclude=[_0x1a4b('0x3'),_0x1a4b('0x4')];function writeDB(_0x4e2c52){utils[_0x1a4b('0x5')](util[_0x1a4b('0x6')]('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x4e2c52[_0x1a4b('0x7')],_0x4e2c52[_0x1a4b('0x8')],_0x4e2c52[_0x1a4b('0x9')],_0x4e2c52[_0x1a4b('0xa')],_0x4e2c52['membername'],_0x4e2c52[_0x1a4b('0xb')]));if(_0x4e2c52[_0x1a4b('0x8')]){utils[_0x1a4b('0xc')](_0x4e2c52['interface'])['then'](function(_0x5754b4){if(_0x5754b4){_0x4e2c52[_0x1a4b('0xd')]=_0x5754b4['name'];_0x4e2c52[_0x1a4b('0xe')]=_0x5754b4['internal'];utils['request'](_0x1a4b('0xf'),_0x4e2c52);}else{utils[_0x1a4b('0x10')](_0x4e2c52['interface'][_0x1a4b('0x11')]('/')[0x1])[_0x1a4b('0x12')](function(_0x19147d){if(_0x19147d){_0x4e2c52[_0x1a4b('0xd')]=_0x19147d[_0x1a4b('0x13')];_0x4e2c52[_0x1a4b('0xe')]=_0x19147d[_0x1a4b('0xe')];utils[_0x1a4b('0x14')](_0x1a4b('0xf'),_0x4e2c52);}});}})[_0x1a4b('0x15')](function(_0x22b8ae){utils[_0x1a4b('0x16')](util[_0x1a4b('0x6')](_0x1a4b('0x17'),_0x4e2c52['uniqueid']),_0x22b8ae);});}delete members[_0x4e2c52['interface']];}function startsWith(_0x50265f,_0x4ce061){return _[_0x1a4b('0x18')](_0x50265f,function(_0x48bd3c){return _[_0x1a4b('0x19')](_0x4ce061,_0x48bd3c);});}exports[_0x1a4b('0x1a')]=function(_0x131564){try{utils[_0x1a4b('0x1b')](util[_0x1a4b('0x6')](_0x1a4b('0x1c'),members[_0x131564[_0x1a4b('0x1d')]]?members[_0x131564[_0x1a4b('0x1d')]][_0x1a4b('0x7')]:_0x131564[_0x1a4b('0x1d')]),_0x131564);utils[_0x1a4b('0x5')](util[_0x1a4b('0x6')](_0x1a4b('0x1e'),members[_0x131564['device']]?members[_0x131564[_0x1a4b('0x1d')]][_0x1a4b('0x7')]:_0x131564[_0x1a4b('0x1d')],_0x131564[_0x1a4b('0x1f')],_0x131564[_0x1a4b('0x1d')]));switch(_0x131564[_0x1a4b('0x1f')]){case'INUSE':case _0x1a4b('0x20'):if(!startsWith(exclude,_0x131564['device'])){members[_0x131564[_0x1a4b('0x1d')]]={'channel':_0x1a4b('0x21'),'interface':_0x131564[_0x1a4b('0x1d')],'type':_0x1a4b('0x22'),'enterAt':utils[_0x1a4b('0x23')](),'role':'agent'};}break;case _0x1a4b('0x24'):if(!_['isNil'](members[_0x131564[_0x1a4b('0x1d')]])){members[_0x131564[_0x1a4b('0x1d')]][_0x1a4b('0x25')]=utils[_0x1a4b('0x23')]();members[_0x131564[_0x1a4b('0x1d')]][_0x1a4b('0x26')]=utils['diffTime'](members[_0x131564[_0x1a4b('0x1d')]][_0x1a4b('0x25')],members[_0x131564['device']][_0x1a4b('0x27')]);if(members[_0x131564[_0x1a4b('0x1d')]][_0x1a4b('0x7')]){writeDB(members[_0x131564[_0x1a4b('0x1d')]]);}}break;default:break;}}catch(_0x4911b3){utils[_0x1a4b('0x16')](util[_0x1a4b('0x6')](_0x1a4b('0x1c'),members[_0x131564[_0x1a4b('0x1d')]]?members[_0x131564['device']][_0x1a4b('0x7')]:_0x131564[_0x1a4b('0x1d')]),_0x4911b3);}};exports[_0x1a4b('0x28')]=function(_0x5d7754){try{if(!_['isNil'](members[_0x5d7754['interface']])){utils[_0x1a4b('0x1b')](util[_0x1a4b('0x6')](_0x1a4b('0x29'),_0x5d7754[_0x1a4b('0x7')]),_0x5d7754);utils[_0x1a4b('0x5')](util['format'](_0x1a4b('0x2a'),_0x5d7754[_0x1a4b('0x7')],_0x5d7754['interface'],_0x5d7754[_0x1a4b('0x2b')]));members[_0x5d7754[_0x1a4b('0x8')]]=_[_0x1a4b('0x2c')](members[_0x5d7754[_0x1a4b('0x8')]],{'data4':_0x5d7754[_0x1a4b('0x2b')],'uniqueid':_0x5d7754[_0x1a4b('0x7')]});}}catch(_0xd9b637){utils[_0x1a4b('0x16')](util['format']('[%s][members][agentcomplete]',_0x5d7754['uniqueid']),_0xd9b637);}};exports['cdr']=function(_0x41da6d){try{utils[_0x1a4b('0x1b')](util[_0x1a4b('0x6')](_0x1a4b('0x2d'),_0x41da6d[_0x1a4b('0x7')]),_0x41da6d);if(_0x41da6d['channel']){var _0x4d3dc4=_0x41da6d[_0x1a4b('0x9')][_0x1a4b('0x11')]('-')[0x0];if(!_['isNil'](members[_0x4d3dc4])){members[_0x4d3dc4]=_['assign'](members[_0x4d3dc4],{'data1':members[_0x4d3dc4][_0x1a4b('0x2e')]||_0x41da6d[_0x1a4b('0xb')],'data2':members[_0x4d3dc4][_0x1a4b('0xa')]||_0x41da6d[_0x1a4b('0x2f')],'data3':members[_0x4d3dc4]['data3']||_0x41da6d['destination'],'uniqueid':members[_0x4d3dc4][_0x1a4b('0x7')]||_0x41da6d['uniqueid']});utils['info'](util[_0x1a4b('0x6')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x41da6d['uniqueid'],members[_0x4d3dc4][_0x1a4b('0x2e')],members[_0x4d3dc4][_0x1a4b('0xa')],members[_0x4d3dc4][_0x1a4b('0x30')]));if(members[_0x4d3dc4][_0x1a4b('0x25')]){writeDB(members[_0x4d3dc4]);}}}if(_0x41da6d['destinationchannel']){var _0x3078f1=_0x41da6d[_0x1a4b('0x31')][_0x1a4b('0x11')]('-')[0x0];if(!_[_0x1a4b('0x32')](members[_0x3078f1])){members[_0x3078f1]=_['assign'](members[_0x3078f1],{'data1':members[_0x3078f1]['data1']||_0x41da6d['type'],'data2':members[_0x3078f1]['data2']||_0x41da6d['source'],'data3':members[_0x3078f1]['data3']||_0x41da6d[_0x1a4b('0x33')],'uniqueid':members[_0x3078f1][_0x1a4b('0x7')]||_0x41da6d['uniqueid']});utils[_0x1a4b('0x5')](util[_0x1a4b('0x6')](_0x1a4b('0x34'),_0x41da6d[_0x1a4b('0x7')],members[_0x3078f1][_0x1a4b('0x2e')],members[_0x3078f1][_0x1a4b('0xa')],members[_0x3078f1][_0x1a4b('0x30')]));if(members[_0x3078f1][_0x1a4b('0x25')]){writeDB(members[_0x3078f1]);}}}}catch(_0x5caec1){utils[_0x1a4b('0x16')](util[_0x1a4b('0x6')](_0x1a4b('0x2d'),_0x41da6d[_0x1a4b('0x7')]),_0x5caec1);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 3c5e8ca..5e6de93 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 _0x612e=['name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','varset','queuestatus','value','toUpperCase','queuecallerabandonAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','variable','queueposition','queuecallerabandon','EXITWITHKEY','error','[%s][queues][queuecallerabandon]','queuecallerexitAt','ABANDONED','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','diffTime','queuecallerjoinAt','count','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','destaccountcode','assigned','membername','reason','transfer','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','[%s][queues][agentcomplete]','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','transferexten','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','extension','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridnum','calleridname','holdtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','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','util','./utils','info','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','lastAssignedTo','getVoiceQueueByName','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','format','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','assign','position','now','hangup','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerexit','queuecallercomplete','queuecallercompleteAt','queuecallerexitreason','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s'];(function(_0x2f8d56,_0x376c64){var _0x36081d=function(_0x86d523){while(--_0x86d523){_0x2f8d56['push'](_0x2f8d56['shift']());}};_0x36081d(++_0x376c64);}(_0x612e,0x11b));var _0xe612=function(_0x118584,_0x222c30){_0x118584=_0x118584-0x0;var _0x5f1ced=_0x612e[_0x118584];return _0x5f1ced;};'use strict';var _=require(_0xe612('0x0'));var util=require(_0xe612('0x1'));var utils=require(_0xe612('0x2'));var queues={};function writeDB(_0x5bb401){utils[_0xe612('0x3')](util['format'](_0xe612('0x4'),_0x5bb401[_0xe612('0x5')],_0x5bb401[_0xe612('0x6')],_0x5bb401[_0xe612('0x7')],_0x5bb401[_0xe612('0x8')],_0x5bb401['calleridnum'],_0x5bb401['accountcode'],_0x5bb401['queuecallerexitreason']));if(_0x5bb401[_0xe612('0x7')]){utils[_0xe612('0x9')](_0x5bb401[_0xe612('0x7')])['then'](function(_0x5b26f9){if(_0x5b26f9){_0x5bb401[_0xe612('0xa')]=_0x5b26f9['type'];}utils[_0xe612('0xb')](_0xe612('0xc'),_0x5bb401);});}else{utils['request'](_0xe612('0xc'),_0x5bb401);}if(_0x5bb401['transfereduniqueid']){delete queues[_0x5bb401[_0xe612('0xd')]];}else{delete queues[_0x5bb401[_0xe612('0x5')]];}}exports[_0xe612('0xe')]=function(_0x3551de){try{utils[_0xe612('0xf')](util[_0xe612('0x10')](_0xe612('0x11'),_0x3551de[_0xe612('0x5')]),_0x3551de);utils[_0xe612('0x3')](util[_0xe612('0x10')](_0xe612('0x12'),_0x3551de[_0xe612('0x5')],_0x3551de['queue'],_0x3551de['position']));queues[_0x3551de[_0xe612('0x5')]]=_[_0xe612('0x13')](_0x3551de,{'originalposition':_0x3551de[_0xe612('0x14')],'queuecallerjoinAt':utils[_0xe612('0x15')](),'mohtime':0x0});}catch(_0x10ffb5){utils['error'](util[_0xe612('0x10')](_0xe612('0x11'),_0x3551de[_0xe612('0x5')]),_0x10ffb5);}};exports[_0xe612('0x16')]=function(_0x1bcd76){try{if(!_[_0xe612('0x17')](queues[_0x1bcd76[_0xe612('0x5')]])){utils[_0xe612('0xf')](util[_0xe612('0x10')](_0xe612('0x18'),_0x1bcd76[_0xe612('0x5')]),_0x1bcd76);if(queues[_0x1bcd76[_0xe612('0x5')]][_0xe612('0x19')]){if(!queues[_0x1bcd76[_0xe612('0x5')]]['queuecallerabandon']&&!queues[_0x1bcd76['uniqueid']][_0xe612('0x1a')]){queues[_0x1bcd76['uniqueid']][_0xe612('0x1b')]=!![];queues[_0x1bcd76['uniqueid']][_0xe612('0x1c')]=utils[_0xe612('0x15')]();queues[_0x1bcd76[_0xe612('0x5')]][_0xe612('0x1d')]=_0xe612('0x1e');}utils['info'](util[_0xe612('0x10')](_0xe612('0x1f'),_0x1bcd76[_0xe612('0x5')],queues[_0x1bcd76['uniqueid']][_0xe612('0x20')],queues[_0x1bcd76[_0xe612('0x5')]]['queuecallerexitreason']));writeDB(queues[_0x1bcd76[_0xe612('0x5')]]);}else if(queues[_0x1bcd76[_0xe612('0x5')]][_0xe612('0xd')]){utils[_0xe612('0x3')](util[_0xe612('0x10')](_0xe612('0x21'),_0x1bcd76[_0xe612('0x5')],queues[_0x1bcd76[_0xe612('0x5')]][_0xe612('0x20')],queues[_0x1bcd76[_0xe612('0x5')]]['transfereduniqueid']));queues[queues[_0x1bcd76[_0xe612('0x5')]][_0xe612('0xd')]]=queues[_0x1bcd76[_0xe612('0x5')]];queues[queues[_0x1bcd76[_0xe612('0x5')]][_0xe612('0xd')]][_0xe612('0x22')]=0x2;delete queues[_0x1bcd76['uniqueid']];}}}catch(_0x4fc945){utils['error'](util[_0xe612('0x10')](_0xe612('0x18'),_0x1bcd76['uniqueid']),_0x4fc945);}};exports[_0xe612('0x23')]=function(_0x17b225){try{utils['debug'](util[_0xe612('0x10')]('[%s][queues][varset]',_0x17b225[_0xe612('0x5')]),_0x17b225);if(!_[_0xe612('0x17')](_0x17b225['variable'][_0xe612('0x24')])&&_0x17b225[_0xe612('0x25')][_0xe612('0x26')]()!=='CONTINUE'){if(!_['isNil'](queues[_0x17b225[_0xe612('0x5')]])){queues[_0x17b225['uniqueid']]['queuecallerabandon']=![];queues[_0x17b225['uniqueid']][_0xe612('0x27')]=null;queues[_0x17b225['uniqueid']][_0xe612('0x1a')]=!![];queues[_0x17b225[_0xe612('0x5')]]['queuecallerexitAt']=utils[_0xe612('0x15')]();queues[_0x17b225['uniqueid']][_0xe612('0x1d')]=_0x17b225[_0xe612('0x25')]['toUpperCase']();utils['info'](util[_0xe612('0x10')](_0xe612('0x28'),_0x17b225[_0xe612('0x5')],queues[_0x17b225['uniqueid']][_0xe612('0x20')],_0x17b225[_0xe612('0x25')],queues[_0x17b225[_0xe612('0x5')]][_0xe612('0x1d')]));writeDB(queues[_0x17b225[_0xe612('0x5')]]);}}else if(!_['isNil'](_0x17b225[_0xe612('0x29')][_0xe612('0x2a')])){if(!_[_0xe612('0x17')](queues[_0x17b225[_0xe612('0x5')]])&&!queues[_0x17b225[_0xe612('0x5')]][_0xe612('0x2b')]){queues[_0x17b225[_0xe612('0x5')]][_0xe612('0x2b')]=![];queues[_0x17b225[_0xe612('0x5')]][_0xe612('0x27')]=null;queues[_0x17b225['uniqueid']]['queuecallerexit']=!![];queues[_0x17b225[_0xe612('0x5')]]['queuecallerexitAt']=utils[_0xe612('0x15')]();queues[_0x17b225[_0xe612('0x5')]][_0xe612('0x1d')]=_0xe612('0x2c');utils[_0xe612('0x3')](util[_0xe612('0x10')]('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x17b225[_0xe612('0x5')],queues[_0x17b225['uniqueid']][_0xe612('0x20')],_0x17b225[_0xe612('0x25')],queues[_0x17b225['uniqueid']]['queuecallerexitreason']));}}}catch(_0x18b33a){utils[_0xe612('0x2d')](util[_0xe612('0x10')]('[%s][queues][varset]',_0x17b225[_0xe612('0x5')]),_0x18b33a);}};exports[_0xe612('0x2b')]=function(_0x4ff43e){try{if(!_[_0xe612('0x17')](queues[_0x4ff43e[_0xe612('0x5')]])){utils[_0xe612('0xf')](util[_0xe612('0x10')](_0xe612('0x2e'),_0x4ff43e[_0xe612('0x5')]),_0x4ff43e);queues[_0x4ff43e[_0xe612('0x5')]][_0xe612('0x1a')]=![];queues[_0x4ff43e['uniqueid']][_0xe612('0x2f')]=null;queues[_0x4ff43e[_0xe612('0x5')]][_0xe612('0x2b')]=!![];queues[_0x4ff43e['uniqueid']][_0xe612('0x27')]=utils['now']();queues[_0x4ff43e[_0xe612('0x5')]]['queuecallerexitreason']=_0xe612('0x30');utils[_0xe612('0x3')](util[_0xe612('0x10')]('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x4ff43e[_0xe612('0x5')],queues[_0x4ff43e['uniqueid']]['name'],queues[_0x4ff43e[_0xe612('0x5')]][_0xe612('0x1d')]));}}catch(_0xacd0e1){utils['error'](util['format'](_0xe612('0x2e'),_0x4ff43e[_0xe612('0x5')]),_0xacd0e1);}};exports[_0xe612('0x31')]=function(_0x1944f1){try{if(!_['isNil'](queues[_0x1944f1[_0xe612('0x5')]])){utils[_0xe612('0xf')](util[_0xe612('0x10')](_0xe612('0x32'),_0x1944f1[_0xe612('0x5')]),_0x1944f1);utils[_0xe612('0x3')](util[_0xe612('0x10')](_0xe612('0x33'),_0x1944f1['uniqueid'],queues[_0x1944f1['uniqueid']][_0xe612('0x20')],_0x1944f1[_0xe612('0x34')],_0x1944f1[_0xe612('0x35')]));queues[_0x1944f1['uniqueid']]['queuecallerleave']=!![];queues[_0x1944f1['uniqueid']][_0xe612('0x19')]=utils[_0xe612('0x15')]();queues[_0x1944f1[_0xe612('0x5')]]['holdtime']=utils[_0xe612('0x36')](queues[_0x1944f1[_0xe612('0x5')]]['queuecallerleaveAt'],queues[_0x1944f1[_0xe612('0x5')]][_0xe612('0x37')]);queues[_0x1944f1[_0xe612('0x5')]][_0xe612('0x14')]=_0x1944f1[_0xe612('0x14')];queues[_0x1944f1['uniqueid']][_0xe612('0x38')]=_0x1944f1[_0xe612('0x38')];queues[_0x1944f1[_0xe612('0x5')]]['connectedlinenum']=_0x1944f1[_0xe612('0x34')];queues[_0x1944f1[_0xe612('0x5')]][_0xe612('0x35')]=_0x1944f1[_0xe612('0x35')];}}catch(_0x3e789f){utils[_0xe612('0x2d')](util[_0xe612('0x10')](_0xe612('0x32'),_0x1944f1['uniqueid']),_0x3e789f);}};exports[_0xe612('0x39')]=function(_0x3d839b){try{if(!_['isNil'](queues[_0x3d839b['uniqueid']])){utils['debug'](util[_0xe612('0x10')](_0xe612('0x3a'),_0x3d839b[_0xe612('0x5')]),_0x3d839b);utils[_0xe612('0x3')](util[_0xe612('0x10')](_0xe612('0x3b'),_0x3d839b['uniqueid'],queues[_0x3d839b[_0xe612('0x5')]][_0xe612('0x20')],_0x3d839b['membername'],_0x3d839b[_0xe612('0x3c')]));queues[_0x3d839b['uniqueid']][_0xe612('0x2b')]=![];queues[_0x3d839b[_0xe612('0x5')]][_0xe612('0x2b')]=![];queues[_0x3d839b['uniqueid']][_0xe612('0x27')]=null;queues[_0x3d839b['uniqueid']]['queuecallerexit']=![];queues[_0x3d839b[_0xe612('0x5')]][_0xe612('0x1d')]=null;queues[_0x3d839b['uniqueid']]['queuecallerexitAt']=null;queues[_0x3d839b[_0xe612('0x5')]]['assigned']=!![];queues[_0x3d839b[_0xe612('0x5')]]['accountcode']=_0x3d839b[_0xe612('0x3c')];queues[_0x3d839b[_0xe612('0x5')]][_0xe612('0x8')]=_0x3d839b['membername'];}}catch(_0x1c3932){utils['error'](util[_0xe612('0x10')](_0xe612('0x3a'),_0x3d839b[_0xe612('0x5')]),_0x1c3932);}};exports['agentcomplete']=function(_0xd2cdeb){try{if(!_[_0xe612('0x17')](queues[_0xd2cdeb[_0xe612('0x5')]])){if(queues[_0xd2cdeb[_0xe612('0x5')]]['queuecallerleaveAt']){utils[_0xe612('0xf')](util[_0xe612('0x10')]('[%s][queues][agentcomplete]',_0xd2cdeb[_0xe612('0x5')]),_0xd2cdeb);queues[_0xd2cdeb['uniqueid']][_0xe612('0x2b')]=![];queues[_0xd2cdeb['uniqueid']][_0xe612('0x2b')]=![];queues[_0xd2cdeb[_0xe612('0x5')]]['queuecallerabandonAt']=null;queues[_0xd2cdeb['uniqueid']]['queuecallerexit']=![];queues[_0xd2cdeb[_0xe612('0x5')]]['queuecallerexitAt']=null;queues[_0xd2cdeb['uniqueid']][_0xe612('0x3d')]=!![];queues[_0xd2cdeb[_0xe612('0x5')]][_0xe612('0x8')]=_0xd2cdeb[_0xe612('0x3e')];queues[_0xd2cdeb['uniqueid']][_0xe612('0x1b')]=!![];queues[_0xd2cdeb['uniqueid']]['queuecallercompleteAt']=utils[_0xe612('0x15')]();if(_0xd2cdeb[_0xe612('0x3f')]==_0xe612('0x40')){if(!queues[_0xd2cdeb[_0xe612('0x5')]][_0xe612('0x40')]){queues[_0xd2cdeb[_0xe612('0x5')]][_0xe612('0x1d')]='TRANSFER';}}else{queues[_0xd2cdeb[_0xe612('0x5')]][_0xe612('0x1d')]=_0xe612('0x41')+_0xd2cdeb['reason']['toUpperCase']();}utils[_0xe612('0x3')](util[_0xe612('0x10')](_0xe612('0x42'),_0xd2cdeb[_0xe612('0x5')],queues[_0xd2cdeb[_0xe612('0x5')]][_0xe612('0x20')],_0xd2cdeb['membername'],queues[_0xd2cdeb[_0xe612('0x5')]][_0xe612('0x1d')]));writeDB(queues[_0xd2cdeb[_0xe612('0x5')]]);}}}catch(_0x148df4){utils[_0xe612('0x2d')](util[_0xe612('0x10')](_0xe612('0x43'),_0xd2cdeb['uniqueid']),_0x148df4);}};exports['blindtransfer']=function(_0x52c980){try{if(!_[_0xe612('0x17')](queues[_0x52c980[_0xe612('0x44')]])){utils['debug'](util[_0xe612('0x10')](_0xe612('0x45'),_0x52c980[_0xe612('0x5')]),_0x52c980);queues[_0x52c980[_0xe612('0x44')]]['transfer']=!![];queues[_0x52c980[_0xe612('0x44')]][_0xe612('0x46')]=_0xe612('0x47');queues[_0x52c980[_0xe612('0x44')]][_0xe612('0x48')]=_0x52c980['extension'];queues[_0x52c980[_0xe612('0x44')]][_0xe612('0x49')]=_0x52c980[_0xe612('0x44')];queues[_0x52c980[_0xe612('0x44')]]['queuecallerexitreason']=_0xe612('0x4a');utils[_0xe612('0x3')](util[_0xe612('0x10')](_0xe612('0x4b'),_0x52c980[_0xe612('0x5')],queues[_0x52c980['transfereeuniqueid']]['name'],_0x52c980[_0xe612('0x44')],_0x52c980[_0xe612('0x4c')]));}}catch(_0x40de98){utils[_0xe612('0x2d')](util[_0xe612('0x10')](_0xe612('0x45'),_0x52c980['uniqueid']),_0x40de98);}};exports[_0xe612('0x4d')]=function(_0x1b9fd6){try{utils[_0xe612('0xf')](util[_0xe612('0x10')](_0xe612('0x4e'),_0x1b9fd6['origtransfereruniqueid']),_0x1b9fd6);if(_0x1b9fd6[_0xe612('0x4f')]==_0x1b9fd6[_0xe612('0x50')]){if(!_[_0xe612('0x17')](queues[_0x1b9fd6[_0xe612('0x51')]])){utils[_0xe612('0x3')](util[_0xe612('0x10')](_0xe612('0x52'),_0x1b9fd6[_0xe612('0x4f')],queues[_0x1b9fd6[_0xe612('0x51')]]['name'],_0x1b9fd6[_0xe612('0x53')]));queues[_0x1b9fd6[_0xe612('0x51')]][_0xe612('0x40')]=!![];queues[_0x1b9fd6[_0xe612('0x51')]][_0xe612('0x46')]=_0xe612('0x54');queues[_0x1b9fd6['secondtransfererlinkedid']][_0xe612('0x48')]=_0x1b9fd6[_0xe612('0x53')];queues[_0x1b9fd6['secondtransfererlinkedid']][_0xe612('0x49')]=_0x1b9fd6[_0xe612('0x4f')];queues[_0x1b9fd6[_0xe612('0x51')]][_0xe612('0x1d')]=_0xe612('0x55');}if(!_[_0xe612('0x17')](queues[_0x1b9fd6[_0xe612('0x50')]])){if(_0x1b9fd6[_0xe612('0x56')]&&queues[_0x1b9fd6['transfereelinkedid']]){queues[_0x1b9fd6[_0xe612('0x56')]][_0xe612('0x22')]=0x1;queues[_0x1b9fd6['transfereeuniqueid']]=_[_0xe612('0x57')](queues[_0x1b9fd6['transfereelinkedid']]);queues[_0x1b9fd6[_0xe612('0x44')]]['transfereduniqueid']=_0x1b9fd6[_0xe612('0x58')];queues[_0x1b9fd6[_0xe612('0x44')]][_0xe612('0x22')]=0x2;queues[_0x1b9fd6['transfereeuniqueid']][_0xe612('0x59')]=queues[_0x1b9fd6[_0xe612('0x51')]]['calleridnum'];queues[_0x1b9fd6[_0xe612('0x44')]][_0xe612('0x5a')]=queues[_0x1b9fd6[_0xe612('0x51')]][_0xe612('0x5a')];queues[_0x1b9fd6['transfereeuniqueid']]['queuecallerjoinAt']=utils[_0xe612('0x15')]();queues[_0x1b9fd6[_0xe612('0x44')]][_0xe612('0x19')]=utils[_0xe612('0x15')]();queues[_0x1b9fd6[_0xe612('0x44')]][_0xe612('0x5b')]=0x0;queues[_0x1b9fd6[_0xe612('0x44')]]['mohtime']=0x0;utils['info'](util['format'](_0xe612('0x5c'),_0x1b9fd6[_0xe612('0x4f')],queues[_0x1b9fd6['transfereeuniqueid']]['name'],queues[_0x1b9fd6[_0xe612('0x44')]][_0xe612('0x59')],queues[_0x1b9fd6[_0xe612('0x44')]][_0xe612('0x5a')]));}else{utils[_0xe612('0x3')](util[_0xe612('0x10')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x1b9fd6['origtransfereruniqueid'],queues[_0x1b9fd6[_0xe612('0x50')]][_0xe612('0x20')],_0x1b9fd6['secondtransfererlinkedid']));queues[_0x1b9fd6['origtransfererlinkedid']][_0xe612('0xd')]=_0x1b9fd6[_0xe612('0x51')];}}}else if(_0x1b9fd6[_0xe612('0x5d')]==_0x1b9fd6[_0xe612('0x51')]){if(!_['isNil'](queues[_0x1b9fd6[_0xe612('0x50')]])){utils[_0xe612('0x3')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x1b9fd6[_0xe612('0x4f')],queues[_0x1b9fd6[_0xe612('0x50')]][_0xe612('0x20')],_0x1b9fd6[_0xe612('0x5d')],_0x1b9fd6[_0xe612('0x5e')]));queues[_0x1b9fd6['origtransfererlinkedid']][_0xe612('0x40')]=!![];queues[_0x1b9fd6[_0xe612('0x50')]][_0xe612('0x46')]=_0xe612('0x54');queues[_0x1b9fd6[_0xe612('0x50')]]['transferexten']=_0x1b9fd6[_0xe612('0x5e')];queues[_0x1b9fd6[_0xe612('0x50')]][_0xe612('0x49')]=_0x1b9fd6[_0xe612('0x5d')];queues[_0x1b9fd6[_0xe612('0x50')]]['queuecallerexitreason']=_0xe612('0x55');}if(!_[_0xe612('0x17')](queues[_0x1b9fd6['secondtransfererlinkedid']])){if(_0x1b9fd6['transfertargetlinkedid']&&queues[_0x1b9fd6['transfertargetlinkedid']]){queues[_0x1b9fd6[_0xe612('0x5f')]][_0xe612('0x22')]=0x1;queues[_0x1b9fd6[_0xe612('0x58')]]=_['clone'](queues[_0x1b9fd6[_0xe612('0x5f')]]);queues[_0x1b9fd6[_0xe612('0x58')]][_0xe612('0xd')]=_0x1b9fd6[_0xe612('0x58')];queues[_0x1b9fd6['transfertargetuniqueid']][_0xe612('0x22')]=0x2;queues[_0x1b9fd6[_0xe612('0x58')]][_0xe612('0x59')]=queues[_0x1b9fd6[_0xe612('0x50')]][_0xe612('0x59')];queues[_0x1b9fd6['transfertargetuniqueid']]['calleridname']=queues[_0x1b9fd6[_0xe612('0x50')]][_0xe612('0x5a')];queues[_0x1b9fd6[_0xe612('0x58')]]['queuecallerjoinAt']=utils[_0xe612('0x15')]();queues[_0x1b9fd6[_0xe612('0x58')]][_0xe612('0x19')]=utils[_0xe612('0x15')]();queues[_0x1b9fd6[_0xe612('0x58')]]['holdtime']=0x0;queues[_0x1b9fd6['transfertargetuniqueid']][_0xe612('0x60')]=0x0;utils['info'](util[_0xe612('0x10')](_0xe612('0x61'),_0x1b9fd6['origtransfereruniqueid'],queues[_0x1b9fd6[_0xe612('0x58')]]['name'],queues[_0x1b9fd6[_0xe612('0x58')]][_0xe612('0xd')],queues[_0x1b9fd6[_0xe612('0x58')]]['calleridnum'],queues[_0x1b9fd6[_0xe612('0x58')]][_0xe612('0x5a')]));}else{utils[_0xe612('0x3')](util[_0xe612('0x10')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x1b9fd6[_0xe612('0x4f')],queues[_0x1b9fd6[_0xe612('0x51')]][_0xe612('0x20')],_0x1b9fd6[_0xe612('0x50')]));queues[_0x1b9fd6['secondtransfererlinkedid']]['transfereduniqueid']=_0x1b9fd6[_0xe612('0x50')];}}}}catch(_0x285a42){utils['error'](util['format'](_0xe612('0x4e'),_0x1b9fd6[_0xe612('0x4f')]),_0x285a42);}};exports[_0xe612('0x62')]=function(_0x1077a7){try{if(!_[_0xe612('0x17')](queues[_0x1077a7[_0xe612('0x5')]])){utils[_0xe612('0xf')](util[_0xe612('0x10')](_0xe612('0x63'),_0x1077a7[_0xe612('0x5')]),_0x1077a7);queues[_0x1077a7[_0xe612('0x5')]][_0xe612('0x64')]=utils[_0xe612('0x15')]();utils[_0xe612('0x3')](util[_0xe612('0x10')](_0xe612('0x65'),_0x1077a7[_0xe612('0x5')],queues[_0x1077a7[_0xe612('0x5')]][_0xe612('0x20')],queues[_0x1077a7['uniqueid']][_0xe612('0x64')]));}}catch(_0x481d4d){utils[_0xe612('0x2d')](util['format'](_0xe612('0x63'),_0x1077a7[_0xe612('0x5')]),_0x481d4d);}};exports[_0xe612('0x66')]=function(_0xa39d1e){try{if(!_[_0xe612('0x17')](queues[_0xa39d1e['uniqueid']])){if(!_['isNil'](queues[_0xa39d1e['uniqueid']][_0xe612('0x64')])){utils[_0xe612('0xf')](util[_0xe612('0x10')](_0xe612('0x67'),_0xa39d1e['uniqueid']),_0xa39d1e);queues[_0xa39d1e[_0xe612('0x5')]][_0xe612('0x60')]+=utils[_0xe612('0x36')](utils['now'](),queues[_0xa39d1e[_0xe612('0x5')]][_0xe612('0x64')]);utils[_0xe612('0x3')](util[_0xe612('0x10')](_0xe612('0x68'),_0xa39d1e[_0xe612('0x5')],queues[_0xa39d1e['uniqueid']][_0xe612('0x20')],queues[_0xa39d1e['uniqueid']][_0xe612('0x60')]));delete queues[_0xa39d1e[_0xe612('0x5')]][_0xe612('0x64')];}}}catch(_0x2fdd5f){utils['error'](util[_0xe612('0x10')](_0xe612('0x67'),_0xa39d1e[_0xe612('0x5')]),_0x2fdd5f);}}; \ No newline at end of file +var _0xc840=['position','assign','hangup','isNil','debug','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallercomplete','queuecallercompleteAt','now','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','error','variable','queuestatus','value','CONTINUE','queuecallerexit','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queuecallerabandonAt','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][varset]','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerleave]','connectedlinename','diffTime','queuecallerjoinAt','count','connectedlinenum','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','agentcomplete','[%s][queues][agentcomplete]','reason','transfer','TRANSFER','toUpperCase','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','transferexten','extension','BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','ATTENDED','origtransfererexten','transferuniqueid','transfereelinkedid','queuecallerenterreason','transfertargetuniqueid','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','ATTENDEDTRANSFER','transfertargetlinkedid','clone','holdtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','[%s][queues][musiconholdstop]','lodash','util','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','channel','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','type','request','CreateVoiceQueueReport','transfereduniqueid','uniqueid','queuecallerjoin','[%s][queues][queuecallerjoin]'];(function(_0x2e96d9,_0x4654a6){var _0x13aab6=function(_0x3c8932){while(--_0x3c8932){_0x2e96d9['push'](_0x2e96d9['shift']());}};_0x13aab6(++_0x4654a6);}(_0xc840,0x189));var _0x0c84=function(_0x3a3c3c,_0x4127c8){_0x3a3c3c=_0x3a3c3c-0x0;var _0x56db44=_0xc840[_0x3a3c3c];return _0x56db44;};'use strict';var _=require(_0x0c84('0x0'));var util=require(_0x0c84('0x1'));var utils=require('./utils');var queues={};function writeDB(_0x55b639){utils[_0x0c84('0x2')](util[_0x0c84('0x3')](_0x0c84('0x4'),_0x55b639['uniqueid'],_0x55b639[_0x0c84('0x5')],_0x55b639[_0x0c84('0x6')],_0x55b639[_0x0c84('0x7')],_0x55b639[_0x0c84('0x8')],_0x55b639[_0x0c84('0x9')],_0x55b639[_0x0c84('0xa')]));if(_0x55b639['queue']){utils[_0x0c84('0xb')](_0x55b639[_0x0c84('0x6')])['then'](function(_0x407761){if(_0x407761){_0x55b639[_0x0c84('0xc')]=_0x407761[_0x0c84('0xc')];}utils[_0x0c84('0xd')](_0x0c84('0xe'),_0x55b639);});}else{utils[_0x0c84('0xd')](_0x0c84('0xe'),_0x55b639);}if(_0x55b639[_0x0c84('0xf')]){delete queues[_0x55b639[_0x0c84('0xf')]];}else{delete queues[_0x55b639[_0x0c84('0x10')]];}}exports[_0x0c84('0x11')]=function(_0x4d7652){try{utils['debug'](util[_0x0c84('0x3')](_0x0c84('0x12'),_0x4d7652['uniqueid']),_0x4d7652);utils['info'](util[_0x0c84('0x3')]('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x4d7652[_0x0c84('0x10')],_0x4d7652[_0x0c84('0x6')],_0x4d7652[_0x0c84('0x13')]));queues[_0x4d7652[_0x0c84('0x10')]]=_[_0x0c84('0x14')](_0x4d7652,{'originalposition':_0x4d7652[_0x0c84('0x13')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x4bd239){utils['error'](util[_0x0c84('0x3')](_0x0c84('0x12'),_0x4d7652[_0x0c84('0x10')]),_0x4bd239);}};exports[_0x0c84('0x15')]=function(_0x4349a7){try{if(!_[_0x0c84('0x16')](queues[_0x4349a7[_0x0c84('0x10')]])){utils[_0x0c84('0x17')](util['format'](_0x0c84('0x18'),_0x4349a7['uniqueid']),_0x4349a7);if(queues[_0x4349a7[_0x0c84('0x10')]][_0x0c84('0x19')]){if(!queues[_0x4349a7[_0x0c84('0x10')]][_0x0c84('0x1a')]&&!queues[_0x4349a7['uniqueid']]['queuecallerexit']){queues[_0x4349a7[_0x0c84('0x10')]][_0x0c84('0x1b')]=!![];queues[_0x4349a7[_0x0c84('0x10')]][_0x0c84('0x1c')]=utils[_0x0c84('0x1d')]();queues[_0x4349a7[_0x0c84('0x10')]]['queuecallerexitreason']=_0x0c84('0x1e');}utils[_0x0c84('0x2')](util[_0x0c84('0x3')](_0x0c84('0x1f'),_0x4349a7[_0x0c84('0x10')],queues[_0x4349a7[_0x0c84('0x10')]][_0x0c84('0x20')],queues[_0x4349a7[_0x0c84('0x10')]][_0x0c84('0xa')]));writeDB(queues[_0x4349a7[_0x0c84('0x10')]]);}else if(queues[_0x4349a7[_0x0c84('0x10')]][_0x0c84('0xf')]){utils[_0x0c84('0x2')](util[_0x0c84('0x3')](_0x0c84('0x21'),_0x4349a7[_0x0c84('0x10')],queues[_0x4349a7[_0x0c84('0x10')]]['name'],queues[_0x4349a7[_0x0c84('0x10')]][_0x0c84('0xf')]));queues[queues[_0x4349a7[_0x0c84('0x10')]]['transfereduniqueid']]=queues[_0x4349a7[_0x0c84('0x10')]];queues[queues[_0x4349a7['uniqueid']][_0x0c84('0xf')]]['queuecallerenterreason']=0x2;delete queues[_0x4349a7['uniqueid']];}}}catch(_0x1bf974){utils[_0x0c84('0x22')](util['format'](_0x0c84('0x18'),_0x4349a7['uniqueid']),_0x1bf974);}};exports['varset']=function(_0x108172){try{utils[_0x0c84('0x17')](util['format']('[%s][queues][varset]',_0x108172[_0x0c84('0x10')]),_0x108172);if(!_[_0x0c84('0x16')](_0x108172[_0x0c84('0x23')][_0x0c84('0x24')])&&_0x108172[_0x0c84('0x25')]['toUpperCase']()!==_0x0c84('0x26')){if(!_[_0x0c84('0x16')](queues[_0x108172['uniqueid']])){queues[_0x108172[_0x0c84('0x10')]]['queuecallerabandon']=![];queues[_0x108172[_0x0c84('0x10')]]['queuecallerabandonAt']=null;queues[_0x108172[_0x0c84('0x10')]][_0x0c84('0x27')]=!![];queues[_0x108172['uniqueid']][_0x0c84('0x28')]=utils[_0x0c84('0x1d')]();queues[_0x108172[_0x0c84('0x10')]][_0x0c84('0xa')]=_0x108172[_0x0c84('0x25')]['toUpperCase']();utils[_0x0c84('0x2')](util['format'](_0x0c84('0x29'),_0x108172[_0x0c84('0x10')],queues[_0x108172[_0x0c84('0x10')]][_0x0c84('0x20')],_0x108172[_0x0c84('0x25')],queues[_0x108172[_0x0c84('0x10')]][_0x0c84('0xa')]));writeDB(queues[_0x108172[_0x0c84('0x10')]]);}}else if(!_[_0x0c84('0x16')](_0x108172[_0x0c84('0x23')]['queueposition'])){if(!_[_0x0c84('0x16')](queues[_0x108172[_0x0c84('0x10')]])&&!queues[_0x108172[_0x0c84('0x10')]]['queuecallerabandon']){queues[_0x108172['uniqueid']][_0x0c84('0x1a')]=![];queues[_0x108172['uniqueid']][_0x0c84('0x2a')]=null;queues[_0x108172[_0x0c84('0x10')]]['queuecallerexit']=!![];queues[_0x108172[_0x0c84('0x10')]]['queuecallerexitAt']=utils[_0x0c84('0x1d')]();queues[_0x108172[_0x0c84('0x10')]][_0x0c84('0xa')]=_0x0c84('0x2b');utils['info'](util['format'](_0x0c84('0x2c'),_0x108172[_0x0c84('0x10')],queues[_0x108172[_0x0c84('0x10')]][_0x0c84('0x20')],_0x108172['value'],queues[_0x108172[_0x0c84('0x10')]][_0x0c84('0xa')]));}}}catch(_0x52e2b2){utils['error'](util[_0x0c84('0x3')](_0x0c84('0x2d'),_0x108172[_0x0c84('0x10')]),_0x52e2b2);}};exports[_0x0c84('0x1a')]=function(_0x49822b){try{if(!_[_0x0c84('0x16')](queues[_0x49822b[_0x0c84('0x10')]])){utils['debug'](util['format'](_0x0c84('0x2e'),_0x49822b['uniqueid']),_0x49822b);queues[_0x49822b['uniqueid']][_0x0c84('0x27')]=![];queues[_0x49822b[_0x0c84('0x10')]][_0x0c84('0x28')]=null;queues[_0x49822b[_0x0c84('0x10')]][_0x0c84('0x1a')]=!![];queues[_0x49822b[_0x0c84('0x10')]][_0x0c84('0x2a')]=utils[_0x0c84('0x1d')]();queues[_0x49822b['uniqueid']][_0x0c84('0xa')]=_0x0c84('0x2f');utils['info'](util[_0x0c84('0x3')](_0x0c84('0x30'),_0x49822b[_0x0c84('0x10')],queues[_0x49822b[_0x0c84('0x10')]]['name'],queues[_0x49822b['uniqueid']][_0x0c84('0xa')]));}}catch(_0x278600){utils[_0x0c84('0x22')](util[_0x0c84('0x3')](_0x0c84('0x2e'),_0x49822b[_0x0c84('0x10')]),_0x278600);}};exports['queuecallerleave']=function(_0x2b9b2c){try{if(!_[_0x0c84('0x16')](queues[_0x2b9b2c[_0x0c84('0x10')]])){utils['debug'](util[_0x0c84('0x3')](_0x0c84('0x31'),_0x2b9b2c['uniqueid']),_0x2b9b2c);utils[_0x0c84('0x2')](util[_0x0c84('0x3')]('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x2b9b2c[_0x0c84('0x10')],queues[_0x2b9b2c[_0x0c84('0x10')]][_0x0c84('0x20')],_0x2b9b2c['connectedlinenum'],_0x2b9b2c[_0x0c84('0x32')]));queues[_0x2b9b2c['uniqueid']]['queuecallerleave']=!![];queues[_0x2b9b2c[_0x0c84('0x10')]][_0x0c84('0x19')]=utils[_0x0c84('0x1d')]();queues[_0x2b9b2c[_0x0c84('0x10')]]['holdtime']=utils[_0x0c84('0x33')](queues[_0x2b9b2c['uniqueid']]['queuecallerleaveAt'],queues[_0x2b9b2c[_0x0c84('0x10')]][_0x0c84('0x34')]);queues[_0x2b9b2c[_0x0c84('0x10')]][_0x0c84('0x13')]=_0x2b9b2c[_0x0c84('0x13')];queues[_0x2b9b2c[_0x0c84('0x10')]][_0x0c84('0x35')]=_0x2b9b2c['count'];queues[_0x2b9b2c[_0x0c84('0x10')]]['connectedlinenum']=_0x2b9b2c[_0x0c84('0x36')];queues[_0x2b9b2c[_0x0c84('0x10')]]['connectedlinename']=_0x2b9b2c[_0x0c84('0x32')];}}catch(_0x21d6a1){utils['error'](util[_0x0c84('0x3')](_0x0c84('0x31'),_0x2b9b2c['uniqueid']),_0x21d6a1);}};exports[_0x0c84('0x37')]=function(_0x4730f7){try{if(!_[_0x0c84('0x16')](queues[_0x4730f7[_0x0c84('0x10')]])){utils[_0x0c84('0x17')](util[_0x0c84('0x3')](_0x0c84('0x38'),_0x4730f7['uniqueid']),_0x4730f7);utils['info'](util[_0x0c84('0x3')](_0x0c84('0x39'),_0x4730f7[_0x0c84('0x10')],queues[_0x4730f7[_0x0c84('0x10')]][_0x0c84('0x20')],_0x4730f7[_0x0c84('0x3a')],_0x4730f7[_0x0c84('0x3b')]));queues[_0x4730f7['uniqueid']]['queuecallerabandon']=![];queues[_0x4730f7['uniqueid']][_0x0c84('0x1a')]=![];queues[_0x4730f7[_0x0c84('0x10')]][_0x0c84('0x2a')]=null;queues[_0x4730f7[_0x0c84('0x10')]]['queuecallerexit']=![];queues[_0x4730f7[_0x0c84('0x10')]]['queuecallerexitreason']=null;queues[_0x4730f7['uniqueid']][_0x0c84('0x28')]=null;queues[_0x4730f7[_0x0c84('0x10')]][_0x0c84('0x3c')]=!![];queues[_0x4730f7[_0x0c84('0x10')]][_0x0c84('0x9')]=_0x4730f7[_0x0c84('0x3b')];queues[_0x4730f7['uniqueid']]['lastAssignedTo']=_0x4730f7[_0x0c84('0x3a')];}}catch(_0x5c4055){utils[_0x0c84('0x22')](util[_0x0c84('0x3')](_0x0c84('0x38'),_0x4730f7[_0x0c84('0x10')]),_0x5c4055);}};exports[_0x0c84('0x3d')]=function(_0x4120b6){try{if(!_[_0x0c84('0x16')](queues[_0x4120b6[_0x0c84('0x10')]])){if(queues[_0x4120b6[_0x0c84('0x10')]]['queuecallerleaveAt']){utils[_0x0c84('0x17')](util['format'](_0x0c84('0x3e'),_0x4120b6[_0x0c84('0x10')]),_0x4120b6);queues[_0x4120b6[_0x0c84('0x10')]][_0x0c84('0x1a')]=![];queues[_0x4120b6[_0x0c84('0x10')]][_0x0c84('0x1a')]=![];queues[_0x4120b6[_0x0c84('0x10')]][_0x0c84('0x2a')]=null;queues[_0x4120b6['uniqueid']][_0x0c84('0x27')]=![];queues[_0x4120b6[_0x0c84('0x10')]][_0x0c84('0x28')]=null;queues[_0x4120b6[_0x0c84('0x10')]][_0x0c84('0x3c')]=!![];queues[_0x4120b6[_0x0c84('0x10')]][_0x0c84('0x7')]=_0x4120b6[_0x0c84('0x3a')];queues[_0x4120b6[_0x0c84('0x10')]][_0x0c84('0x1b')]=!![];queues[_0x4120b6['uniqueid']]['queuecallercompleteAt']=utils[_0x0c84('0x1d')]();if(_0x4120b6[_0x0c84('0x3f')]=='transfer'){if(!queues[_0x4120b6[_0x0c84('0x10')]][_0x0c84('0x40')]){queues[_0x4120b6[_0x0c84('0x10')]][_0x0c84('0xa')]=_0x0c84('0x41');}}else{queues[_0x4120b6[_0x0c84('0x10')]][_0x0c84('0xa')]='COMPLETEDBY'+_0x4120b6[_0x0c84('0x3f')][_0x0c84('0x42')]();}utils[_0x0c84('0x2')](util['format'](_0x0c84('0x43'),_0x4120b6[_0x0c84('0x10')],queues[_0x4120b6[_0x0c84('0x10')]]['name'],_0x4120b6['membername'],queues[_0x4120b6['uniqueid']][_0x0c84('0xa')]));writeDB(queues[_0x4120b6[_0x0c84('0x10')]]);}}}catch(_0x2efd9c){utils['error'](util[_0x0c84('0x3')](_0x0c84('0x3e'),_0x4120b6[_0x0c84('0x10')]),_0x2efd9c);}};exports['blindtransfer']=function(_0x4c6e83){try{if(!_[_0x0c84('0x16')](queues[_0x4c6e83[_0x0c84('0x44')]])){utils[_0x0c84('0x17')](util['format'](_0x0c84('0x45'),_0x4c6e83[_0x0c84('0x10')]),_0x4c6e83);queues[_0x4c6e83[_0x0c84('0x44')]]['transfer']=!![];queues[_0x4c6e83[_0x0c84('0x44')]][_0x0c84('0x46')]=_0x0c84('0x47');queues[_0x4c6e83[_0x0c84('0x44')]][_0x0c84('0x48')]=_0x4c6e83[_0x0c84('0x49')];queues[_0x4c6e83[_0x0c84('0x44')]]['transferuniqueid']=_0x4c6e83[_0x0c84('0x44')];queues[_0x4c6e83[_0x0c84('0x44')]][_0x0c84('0xa')]=_0x0c84('0x4a');utils[_0x0c84('0x2')](util['format']('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0x4c6e83['uniqueid'],queues[_0x4c6e83[_0x0c84('0x44')]][_0x0c84('0x20')],_0x4c6e83[_0x0c84('0x44')],_0x4c6e83[_0x0c84('0x49')]));}}catch(_0x2250f8){utils['error'](util[_0x0c84('0x3')]('[%s][queues][blindtransfer]',_0x4c6e83[_0x0c84('0x10')]),_0x2250f8);}};exports[_0x0c84('0x4b')]=function(_0x35a7d1){try{utils[_0x0c84('0x17')](util['format'](_0x0c84('0x4c'),_0x35a7d1['origtransfereruniqueid']),_0x35a7d1);if(_0x35a7d1[_0x0c84('0x4d')]==_0x35a7d1[_0x0c84('0x4e')]){if(!_['isNil'](queues[_0x35a7d1[_0x0c84('0x4f')]])){utils[_0x0c84('0x2')](util[_0x0c84('0x3')](_0x0c84('0x50'),_0x35a7d1[_0x0c84('0x4d')],queues[_0x35a7d1[_0x0c84('0x4f')]][_0x0c84('0x20')],_0x35a7d1['origtransfererexten']));queues[_0x35a7d1[_0x0c84('0x4f')]][_0x0c84('0x40')]=!![];queues[_0x35a7d1[_0x0c84('0x4f')]][_0x0c84('0x46')]=_0x0c84('0x51');queues[_0x35a7d1[_0x0c84('0x4f')]]['transferexten']=_0x35a7d1[_0x0c84('0x52')];queues[_0x35a7d1['secondtransfererlinkedid']][_0x0c84('0x53')]=_0x35a7d1[_0x0c84('0x4d')];queues[_0x35a7d1[_0x0c84('0x4f')]][_0x0c84('0xa')]='ATTENDEDTRANSFER';}if(!_[_0x0c84('0x16')](queues[_0x35a7d1['origtransfererlinkedid']])){if(_0x35a7d1[_0x0c84('0x54')]&&queues[_0x35a7d1['transfereelinkedid']]){queues[_0x35a7d1[_0x0c84('0x54')]][_0x0c84('0x55')]=0x1;queues[_0x35a7d1[_0x0c84('0x44')]]=_['clone'](queues[_0x35a7d1[_0x0c84('0x54')]]);queues[_0x35a7d1['transfereeuniqueid']][_0x0c84('0xf')]=_0x35a7d1[_0x0c84('0x56')];queues[_0x35a7d1[_0x0c84('0x44')]][_0x0c84('0x55')]=0x2;queues[_0x35a7d1['transfereeuniqueid']]['calleridnum']=queues[_0x35a7d1[_0x0c84('0x4f')]][_0x0c84('0x8')];queues[_0x35a7d1[_0x0c84('0x44')]]['calleridname']=queues[_0x35a7d1[_0x0c84('0x4f')]][_0x0c84('0x57')];queues[_0x35a7d1[_0x0c84('0x44')]][_0x0c84('0x34')]=utils[_0x0c84('0x1d')]();queues[_0x35a7d1['transfereeuniqueid']][_0x0c84('0x19')]=utils[_0x0c84('0x1d')]();queues[_0x35a7d1['transfereeuniqueid']]['holdtime']=0x0;queues[_0x35a7d1[_0x0c84('0x44')]][_0x0c84('0x58')]=0x0;utils[_0x0c84('0x2')](util[_0x0c84('0x3')](_0x0c84('0x59'),_0x35a7d1[_0x0c84('0x4d')],queues[_0x35a7d1['transfereeuniqueid']][_0x0c84('0x20')],queues[_0x35a7d1['transfereeuniqueid']][_0x0c84('0x8')],queues[_0x35a7d1[_0x0c84('0x44')]][_0x0c84('0x57')]));}else{utils[_0x0c84('0x2')](util[_0x0c84('0x3')](_0x0c84('0x5a'),_0x35a7d1[_0x0c84('0x4d')],queues[_0x35a7d1['origtransfererlinkedid']][_0x0c84('0x20')],_0x35a7d1['secondtransfererlinkedid']));queues[_0x35a7d1[_0x0c84('0x4e')]][_0x0c84('0xf')]=_0x35a7d1[_0x0c84('0x4f')];}}}else if(_0x35a7d1[_0x0c84('0x5b')]==_0x35a7d1[_0x0c84('0x4f')]){if(!_[_0x0c84('0x16')](queues[_0x35a7d1['origtransfererlinkedid']])){utils['info'](util[_0x0c84('0x3')](_0x0c84('0x5c'),_0x35a7d1[_0x0c84('0x4d')],queues[_0x35a7d1[_0x0c84('0x4e')]][_0x0c84('0x20')],_0x35a7d1[_0x0c84('0x5b')],_0x35a7d1[_0x0c84('0x5d')]));queues[_0x35a7d1[_0x0c84('0x4e')]][_0x0c84('0x40')]=!![];queues[_0x35a7d1[_0x0c84('0x4e')]]['transfertype']='ATTENDED';queues[_0x35a7d1[_0x0c84('0x4e')]]['transferexten']=_0x35a7d1[_0x0c84('0x5d')];queues[_0x35a7d1['origtransfererlinkedid']][_0x0c84('0x53')]=_0x35a7d1['secondtransfereruniqueid'];queues[_0x35a7d1[_0x0c84('0x4e')]][_0x0c84('0xa')]=_0x0c84('0x5e');}if(!_[_0x0c84('0x16')](queues[_0x35a7d1[_0x0c84('0x4f')]])){if(_0x35a7d1['transfertargetlinkedid']&&queues[_0x35a7d1[_0x0c84('0x5f')]]){queues[_0x35a7d1[_0x0c84('0x5f')]][_0x0c84('0x55')]=0x1;queues[_0x35a7d1[_0x0c84('0x56')]]=_[_0x0c84('0x60')](queues[_0x35a7d1['transfertargetlinkedid']]);queues[_0x35a7d1[_0x0c84('0x56')]]['transfereduniqueid']=_0x35a7d1[_0x0c84('0x56')];queues[_0x35a7d1[_0x0c84('0x56')]][_0x0c84('0x55')]=0x2;queues[_0x35a7d1[_0x0c84('0x56')]][_0x0c84('0x8')]=queues[_0x35a7d1['origtransfererlinkedid']]['calleridnum'];queues[_0x35a7d1['transfertargetuniqueid']]['calleridname']=queues[_0x35a7d1[_0x0c84('0x4e')]]['calleridname'];queues[_0x35a7d1['transfertargetuniqueid']][_0x0c84('0x34')]=utils[_0x0c84('0x1d')]();queues[_0x35a7d1['transfertargetuniqueid']][_0x0c84('0x19')]=utils['now']();queues[_0x35a7d1[_0x0c84('0x56')]][_0x0c84('0x61')]=0x0;queues[_0x35a7d1[_0x0c84('0x56')]]['mohtime']=0x0;utils[_0x0c84('0x2')](util[_0x0c84('0x3')](_0x0c84('0x62'),_0x35a7d1[_0x0c84('0x4d')],queues[_0x35a7d1[_0x0c84('0x56')]]['name'],queues[_0x35a7d1[_0x0c84('0x56')]]['transfereduniqueid'],queues[_0x35a7d1['transfertargetuniqueid']][_0x0c84('0x8')],queues[_0x35a7d1[_0x0c84('0x56')]][_0x0c84('0x57')]));}else{utils[_0x0c84('0x2')](util[_0x0c84('0x3')](_0x0c84('0x5a'),_0x35a7d1[_0x0c84('0x4d')],queues[_0x35a7d1[_0x0c84('0x4f')]]['name'],_0x35a7d1[_0x0c84('0x4e')]));queues[_0x35a7d1[_0x0c84('0x4f')]]['transfereduniqueid']=_0x35a7d1[_0x0c84('0x4e')];}}}}catch(_0x548c7f){utils['error'](util[_0x0c84('0x3')](_0x0c84('0x4c'),_0x35a7d1['origtransfereruniqueid']),_0x548c7f);}};exports['musiconholdstart']=function(_0x58717e){try{if(!_['isNil'](queues[_0x58717e['uniqueid']])){utils['debug'](util['format']('[%s][queues][musiconholdstart]',_0x58717e[_0x0c84('0x10')]),_0x58717e);queues[_0x58717e['uniqueid']]['musiconholdstartAt']=utils[_0x0c84('0x1d')]();utils['info'](util[_0x0c84('0x3')](_0x0c84('0x63'),_0x58717e[_0x0c84('0x10')],queues[_0x58717e[_0x0c84('0x10')]]['name'],queues[_0x58717e['uniqueid']]['musiconholdstartAt']));}}catch(_0x17812a){utils[_0x0c84('0x22')](util[_0x0c84('0x3')]('[%s][queues][musiconholdstart]',_0x58717e['uniqueid']),_0x17812a);}};exports['musiconholdstop']=function(_0x4e79db){try{if(!_[_0x0c84('0x16')](queues[_0x4e79db[_0x0c84('0x10')]])){if(!_['isNil'](queues[_0x4e79db[_0x0c84('0x10')]][_0x0c84('0x64')])){utils[_0x0c84('0x17')](util[_0x0c84('0x3')]('[%s][queues][musiconholdstop]',_0x4e79db[_0x0c84('0x10')]),_0x4e79db);queues[_0x4e79db[_0x0c84('0x10')]][_0x0c84('0x58')]+=utils[_0x0c84('0x33')](utils[_0x0c84('0x1d')](),queues[_0x4e79db[_0x0c84('0x10')]][_0x0c84('0x64')]);utils[_0x0c84('0x2')](util['format'](_0x0c84('0x65'),_0x4e79db[_0x0c84('0x10')],queues[_0x4e79db[_0x0c84('0x10')]][_0x0c84('0x20')],queues[_0x4e79db['uniqueid']][_0x0c84('0x58')]));delete queues[_0x4e79db[_0x0c84('0x10')]][_0x0c84('0x64')];}}}catch(_0x3ce865){utils[_0x0c84('0x22')](util[_0x0c84('0x3')](_0x0c84('0x66'),_0x4e79db[_0x0c84('0x10')]),_0x3ce865);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 950d889..0459586 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 _0xb24a=['queue','blindtransfer','[%s][recordings][blindtransfer]','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridname','transfereecalleridname','transfereruniqueid','./utils','./transfers.controller','info','format','[%s][recordings][writeDB]','uniqueid','blinds','transfereeuniqueid','membername','name','UserId','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','accountcode','error','newstate','isNil','channelstate','channel','linkedid','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','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','calleridnum','cause-txt','calleridname','connectedlinenum','connectedlinename','type','outbound','forEach','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','startsWith','cdr','appdata','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb24a,0xe2));var _0xab24=function(_0x1f5303,_0x354414){_0x1f5303=_0x1f5303-0x0;var _0x84ef1a=_0xb24a[_0x1f5303];return _0x84ef1a;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0xab24('0x0'));var transfers=require(_0xab24('0x1'));var recordings={};function writeDB(_0x158fc2){var _0x2c048e;utils[_0xab24('0x2')](util[_0xab24('0x3')](_0xab24('0x4'),_0x158fc2[_0xab24('0x5')]));if(transfers[_0xab24('0x6')][_0x158fc2['uniqueid']]){_0x2c048e=_0x158fc2[_0xab24('0x5')];_0x158fc2['uniqueid']=transfers['blinds'][_0x158fc2[_0xab24('0x5')]][_0xab24('0x7')];}if(_0x158fc2['accountcode']){utils['getUserByInternal'](_0x158fc2['accountcode'])['then'](function(_0x290310){if(_0x290310){_0x158fc2[_0xab24('0x8')]=_0x290310[_0xab24('0x9')];_0x158fc2[_0xab24('0xa')]=_0x290310['id'];}utils[_0xab24('0xb')](_0xab24('0xc'),_0x158fc2);});}else{utils[_0xab24('0xb')](_0xab24('0xc'),_0x158fc2);}if(_0x2c048e)delete transfers[_0xab24('0x6')][_0x2c048e];}exports[_0xab24('0xd')]=function(_0x2316d4){try{utils[_0xab24('0xe')](util['format'](_0xab24('0xf'),_0x2316d4[_0xab24('0x5')]),_0x2316d4);if(_0x2316d4[_0xab24('0x5')]==_0x2316d4['linkedid']){utils[_0xab24('0x2')](util[_0xab24('0x3')](_0xab24('0x10'),_0x2316d4[_0xab24('0x5')],_0x2316d4[_0xab24('0x11')],_0x2316d4[_0xab24('0x12')]));recordings[_0x2316d4[_0xab24('0x5')]]={'uniqueid':_0x2316d4[_0xab24('0x5')],'accountcode':_0x2316d4[_0xab24('0x13')],'exten':_0x2316d4['exten'],'context':_0x2316d4[_0xab24('0x11')],'channel':_0x2316d4['channel'],'monitors':[]};}}catch(_0x184ad5){utils[_0xab24('0x14')](util[_0xab24('0x3')](_0xab24('0xf'),_0x2316d4[_0xab24('0x5')]),_0x184ad5);}};exports[_0xab24('0x15')]=function(_0x222b97){try{utils[_0xab24('0xe')](util['format']('[%s][recordings][newstate]',_0x222b97[_0xab24('0x5')]),_0x222b97);if(!_[_0xab24('0x16')](recordings[_0x222b97[_0xab24('0x5')]])&&_0x222b97[_0xab24('0x17')]==0x6){utils['info'](util[_0xab24('0x3')]('[%s][recordings][newstate]\x20context:%s\x20channel:%s',_0x222b97[_0xab24('0x5')],_0x222b97[_0xab24('0x11')],_0x222b97[_0xab24('0x18')]));}else if(!_['isNil'](recordings[_0x222b97[_0xab24('0x19')]])&&_0x222b97[_0xab24('0x17')]==0x6&&_0x222b97[_0xab24('0x11')]!=_0xab24('0x1a')){utils[_0xab24('0x2')](util[_0xab24('0x3')](_0xab24('0x1b'),_0x222b97['uniqueid'],_0x222b97[_0xab24('0x19')],_0x222b97['context'],_0x222b97['channel']));recordings[_0x222b97[_0xab24('0x19')]][_0xab24('0x13')]=_0x222b97[_0xab24('0x13')];}}catch(_0x2855c6){utils[_0xab24('0x14')](util['format']('[%s][recordings][newstate]',_0x222b97[_0xab24('0x5')]),_0x2855c6);}};exports[_0xab24('0x1c')]=function(_0x1a153d){try{if(!_['isNil'](_0x1a153d['variable'])&&!_[_0xab24('0x16')](_0x1a153d[_0xab24('0x1d')][_0xab24('0x1e')])){utils[_0xab24('0xe')](util['format'](_0xab24('0x1f'),_0x1a153d[_0xab24('0x5')]),_0x1a153d);utils[_0xab24('0x2')](util[_0xab24('0x3')](_0xab24('0x20'),_0x1a153d[_0xab24('0x5')],_0x1a153d[_0xab24('0x1d')],_0x1a153d['value']));if(_[_0xab24('0x21')](_0x1a153d[_0xab24('0x22')],_0xab24('0x23'))){_0x1a153d[_0xab24('0x22')]=_0x1a153d[_0xab24('0x22')][_0xab24('0x24')]('.wav49','.WAV');}if(recordings[_0x1a153d[_0xab24('0x19')]]){var _0x2ae4b8=_[_0xab24('0x25')](recordings[_0x1a153d[_0xab24('0x19')]][_0xab24('0x26')],{'value':_0x1a153d[_0xab24('0x22')]});if(_[_0xab24('0x16')](_0x2ae4b8)){recordings[_0x1a153d['linkedid']][_0xab24('0x26')][_0xab24('0x27')]({'value':_0x1a153d['value']});}}}}catch(_0x1df61){utils[_0xab24('0x14')](util[_0xab24('0x3')]('[%s][recordings][varset]',_0x1a153d[_0xab24('0x5')]),_0x1df61);}};exports[_0xab24('0x28')]=function(_0x442822){try{if(!_[_0xab24('0x16')](recordings[_0x442822['uniqueid']])){utils[_0xab24('0xe')](util[_0xab24('0x3')](_0xab24('0x29'),_0x442822[_0xab24('0x5')]),_0x442822);utils[_0xab24('0x2')](util['format'](_0xab24('0x2a'),_0x442822[_0xab24('0x5')],_0x442822[_0xab24('0x2b')],_0x442822['calleridname'],_0x442822[_0xab24('0x2c')]));recordings[_0x442822[_0xab24('0x5')]][_0xab24('0x2b')]=_0x442822[_0xab24('0x2b')];recordings[_0x442822['uniqueid']][_0xab24('0x2d')]=_0x442822['calleridname'];recordings[_0x442822['uniqueid']]['connectedlinenum']=_0x442822[_0xab24('0x2e')];recordings[_0x442822['uniqueid']][_0xab24('0x2f')]=_0x442822[_0xab24('0x2f')];if(recordings[_0x442822[_0xab24('0x5')]][_0xab24('0x30')]==_0xab24('0x31')&&recordings[_0x442822[_0xab24('0x5')]][_0xab24('0x13')]){recordings[_0x442822[_0xab24('0x5')]][_0xab24('0x2e')]=recordings[_0x442822[_0xab24('0x5')]][_0xab24('0x13')];recordings[_0x442822[_0xab24('0x5')]][_0xab24('0x2f')]='';}recordings[_0x442822[_0xab24('0x5')]][_0xab24('0x26')][_0xab24('0x32')](function(_0x3a8c11){var _0x348989=_[_0xab24('0x33')](recordings[_0x442822['uniqueid']]);_0x348989[_0xab24('0x22')]=_0x3a8c11[_0xab24('0x22')];writeDB(_0x348989);});delete recordings[_0x442822[_0xab24('0x5')]];}}catch(_0x2bf53b){utils[_0xab24('0x14')](util[_0xab24('0x3')]('[%s][recordings][hangup]',_0x442822['uniqueid']),_0x2bf53b);}};exports[_0xab24('0x34')]=function(_0x21e3af){try{if(!_['isNil'](recordings[_0x21e3af[_0xab24('0x5')]])){utils['debug'](util[_0xab24('0x3')](_0xab24('0x35'),_0x21e3af[_0xab24('0x5')]),_0x21e3af);utils[_0xab24('0x2')](util[_0xab24('0x3')](_0xab24('0x36'),_0x21e3af[_0xab24('0x5')],_0x21e3af[_0xab24('0x37')],_0x21e3af['appdata']));if(_0x21e3af[_0xab24('0x37')][_0xab24('0x38')]()=='set'&&_[_0xab24('0x39')](_0x21e3af['appdata'][_0xab24('0x38')](),_0xab24('0x3a'))){var _0x1acec9=_0x21e3af[_0xab24('0x3b')][_0xab24('0x3c')]('=');var _0x4b11ab=_0x1acec9[0x0][_0xab24('0x3d')](_0x1acec9[0x0][_0xab24('0x3e')]('(')+0x1,_0x1acec9[0x0][_0xab24('0x3e')](')'));var _0x42839b=_0x1acec9[0x1];recordings[_0x21e3af[_0xab24('0x5')]][_0x4b11ab]=_0x42839b;}}}catch(_0x4cccad){utils['error'](util['format'](_0xab24('0x35'),_0x21e3af[_0xab24('0x5')]),_0x4cccad);}};exports[_0xab24('0x3f')]=function(_0x3ff6d3){try{if(!_[_0xab24('0x16')](recordings[_0x3ff6d3[_0xab24('0x5')]])){utils['debug'](util['format'](_0xab24('0x40'),_0x3ff6d3[_0xab24('0x5')]),_0x3ff6d3);utils[_0xab24('0x2')](util['format'](_0xab24('0x41'),_0x3ff6d3['uniqueid'],_0x3ff6d3[_0xab24('0x42')]));recordings[_0x3ff6d3['uniqueid']][_0xab24('0x42')]=_0x3ff6d3[_0xab24('0x42')];}}catch(_0xa250ad){utils[_0xab24('0x14')](util[_0xab24('0x3')]('[%s][recordings][queuecallerjoin]',_0x3ff6d3[_0xab24('0x5')]),_0xa250ad);}};exports[_0xab24('0x43')]=function(_0x556f2b){try{utils[_0xab24('0xe')](util[_0xab24('0x3')](_0xab24('0x44'),_0x556f2b[_0xab24('0x5')]),_0x556f2b);utils[_0xab24('0x2')](util[_0xab24('0x3')](_0xab24('0x45'),_0x556f2b[_0xab24('0x5')],_0x556f2b['transferercalleridnum'],_0x556f2b[_0xab24('0x46')],_0x556f2b['transfereecalleridnum'],_0x556f2b[_0xab24('0x47')]));if(recordings[_0x556f2b['transfereruniqueid']]&&transfers[_0xab24('0x6')][_0x556f2b[_0xab24('0x48')]]){transfers['blinds'][_0x556f2b['transfereruniqueid']]['recording']=!![];}}catch(_0x5e5e09){utils[_0xab24('0x14')](util[_0xab24('0x3')](_0xab24('0x44'),_0x556f2b[_0xab24('0x5')]),_0x5e5e09);}}; \ No newline at end of file +var _0x0285=['lastIndexOf','[%s][recordings][newexten]','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','blindtransfer','[%s][recordings][blindtransfer]','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transfereecalleridnum','transfereruniqueid','recording','util','./transfers.controller','info','format','uniqueid','blinds','transfereeuniqueid','accountcode','then','name','UserId','request','CreateVoiceRecording','debug','[%s][recordings][newchannel]','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','error','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','linkedid','varset','variable','[%s][recordings][varset]','endsWith','value','.wav49','replace','find','monitors','hangup','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','forEach','clone','[%s][recordings][hangup]','newexten','application','appdata','set','startsWith','toLowerCase','split','substring'];(function(_0x15ff04,_0x4cda55){var _0x361c4e=function(_0x1990e8){while(--_0x1990e8){_0x15ff04['push'](_0x15ff04['shift']());}};_0x361c4e(++_0x4cda55);}(_0x0285,0x199));var _0x5028=function(_0x41b63f,_0x282fa1){_0x41b63f=_0x41b63f-0x0;var _0x35a1aa=_0x0285[_0x41b63f];return _0x35a1aa;};'use strict';var _=require('lodash');var util=require(_0x5028('0x0'));var utils=require('./utils');var transfers=require(_0x5028('0x1'));var recordings={};function writeDB(_0x1e61e4){var _0x3ff58f;utils[_0x5028('0x2')](util[_0x5028('0x3')]('[%s][recordings][writeDB]',_0x1e61e4[_0x5028('0x4')]));if(transfers[_0x5028('0x5')][_0x1e61e4['uniqueid']]){_0x3ff58f=_0x1e61e4['uniqueid'];_0x1e61e4[_0x5028('0x4')]=transfers[_0x5028('0x5')][_0x1e61e4[_0x5028('0x4')]][_0x5028('0x6')];}if(_0x1e61e4[_0x5028('0x7')]){utils['getUserByInternal'](_0x1e61e4[_0x5028('0x7')])[_0x5028('0x8')](function(_0x18a3ef){if(_0x18a3ef){_0x1e61e4['membername']=_0x18a3ef[_0x5028('0x9')];_0x1e61e4[_0x5028('0xa')]=_0x18a3ef['id'];}utils[_0x5028('0xb')](_0x5028('0xc'),_0x1e61e4);});}else{utils['request'](_0x5028('0xc'),_0x1e61e4);}if(_0x3ff58f)delete transfers[_0x5028('0x5')][_0x3ff58f];}exports['newchannel']=function(_0x1acca1){try{utils[_0x5028('0xd')](util[_0x5028('0x3')](_0x5028('0xe'),_0x1acca1[_0x5028('0x4')]),_0x1acca1);if(_0x1acca1[_0x5028('0x4')]==_0x1acca1['linkedid']){utils[_0x5028('0x2')](util['format'](_0x5028('0xf'),_0x1acca1[_0x5028('0x4')],_0x1acca1[_0x5028('0x10')],_0x1acca1[_0x5028('0x11')]));recordings[_0x1acca1[_0x5028('0x4')]]={'uniqueid':_0x1acca1['uniqueid'],'accountcode':_0x1acca1[_0x5028('0x7')],'exten':_0x1acca1[_0x5028('0x11')],'context':_0x1acca1['context'],'channel':_0x1acca1['channel'],'monitors':[]};}}catch(_0xc82c90){utils[_0x5028('0x12')](util[_0x5028('0x3')](_0x5028('0xe'),_0x1acca1['uniqueid']),_0xc82c90);}};exports['newstate']=function(_0x508e55){try{utils[_0x5028('0xd')](util[_0x5028('0x3')](_0x5028('0x13'),_0x508e55[_0x5028('0x4')]),_0x508e55);if(!_[_0x5028('0x14')](recordings[_0x508e55[_0x5028('0x4')]])&&_0x508e55[_0x5028('0x15')]==0x6){utils[_0x5028('0x2')](util[_0x5028('0x3')](_0x5028('0x16'),_0x508e55[_0x5028('0x4')],_0x508e55[_0x5028('0x10')],_0x508e55['channel']));}else if(!_[_0x5028('0x14')](recordings[_0x508e55[_0x5028('0x17')]])&&_0x508e55[_0x5028('0x15')]==0x6&&_0x508e55[_0x5028('0x10')]!='transfer'){utils['info'](util[_0x5028('0x3')]('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x508e55[_0x5028('0x4')],_0x508e55[_0x5028('0x17')],_0x508e55[_0x5028('0x10')],_0x508e55['channel']));recordings[_0x508e55[_0x5028('0x17')]][_0x5028('0x7')]=_0x508e55[_0x5028('0x7')];}}catch(_0x3a1b62){utils[_0x5028('0x12')](util[_0x5028('0x3')](_0x5028('0x13'),_0x508e55[_0x5028('0x4')]),_0x3a1b62);}};exports[_0x5028('0x18')]=function(_0x416c16){try{if(!_[_0x5028('0x14')](_0x416c16[_0x5028('0x19')])&&!_[_0x5028('0x14')](_0x416c16[_0x5028('0x19')]['mixmonitor_filename'])){utils[_0x5028('0xd')](util['format'](_0x5028('0x1a'),_0x416c16['uniqueid']),_0x416c16);utils[_0x5028('0x2')](util[_0x5028('0x3')]('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x416c16['uniqueid'],_0x416c16['variable'],_0x416c16['value']));if(_[_0x5028('0x1b')](_0x416c16[_0x5028('0x1c')],_0x5028('0x1d'))){_0x416c16['value']=_0x416c16[_0x5028('0x1c')][_0x5028('0x1e')](_0x5028('0x1d'),'.WAV');}if(recordings[_0x416c16['linkedid']]){var _0x1d59e3=_[_0x5028('0x1f')](recordings[_0x416c16[_0x5028('0x17')]]['monitors'],{'value':_0x416c16[_0x5028('0x1c')]});if(_[_0x5028('0x14')](_0x1d59e3)){recordings[_0x416c16[_0x5028('0x17')]][_0x5028('0x20')]['push']({'value':_0x416c16[_0x5028('0x1c')]});}}}}catch(_0x308a38){utils[_0x5028('0x12')](util['format'](_0x5028('0x1a'),_0x416c16[_0x5028('0x4')]),_0x308a38);}};exports[_0x5028('0x21')]=function(_0x479996){try{if(!_[_0x5028('0x14')](recordings[_0x479996['uniqueid']])){utils[_0x5028('0xd')](util['format']('[%s][recordings][hangup]',_0x479996[_0x5028('0x4')]),_0x479996);utils[_0x5028('0x2')](util[_0x5028('0x3')](_0x5028('0x22'),_0x479996[_0x5028('0x4')],_0x479996[_0x5028('0x23')],_0x479996[_0x5028('0x24')],_0x479996[_0x5028('0x25')]));recordings[_0x479996['uniqueid']][_0x5028('0x23')]=_0x479996[_0x5028('0x23')];recordings[_0x479996[_0x5028('0x4')]][_0x5028('0x24')]=_0x479996[_0x5028('0x24')];recordings[_0x479996[_0x5028('0x4')]][_0x5028('0x26')]=_0x479996[_0x5028('0x26')];recordings[_0x479996[_0x5028('0x4')]][_0x5028('0x27')]=_0x479996[_0x5028('0x27')];if(recordings[_0x479996[_0x5028('0x4')]][_0x5028('0x28')]==_0x5028('0x29')&&recordings[_0x479996[_0x5028('0x4')]][_0x5028('0x7')]){recordings[_0x479996[_0x5028('0x4')]][_0x5028('0x26')]=recordings[_0x479996['uniqueid']][_0x5028('0x7')];recordings[_0x479996[_0x5028('0x4')]][_0x5028('0x27')]='';}recordings[_0x479996['uniqueid']][_0x5028('0x20')][_0x5028('0x2a')](function(_0x56bab2){var _0x4cc1d9=_[_0x5028('0x2b')](recordings[_0x479996['uniqueid']]);_0x4cc1d9['value']=_0x56bab2['value'];writeDB(_0x4cc1d9);});delete recordings[_0x479996[_0x5028('0x4')]];}}catch(_0x4cdd42){utils[_0x5028('0x12')](util[_0x5028('0x3')](_0x5028('0x2c'),_0x479996[_0x5028('0x4')]),_0x4cdd42);}};exports[_0x5028('0x2d')]=function(_0x13d529){try{if(!_['isNil'](recordings[_0x13d529[_0x5028('0x4')]])){utils[_0x5028('0xd')](util[_0x5028('0x3')]('[%s][recordings][newexten]',_0x13d529['uniqueid']),_0x13d529);utils[_0x5028('0x2')](util[_0x5028('0x3')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x13d529[_0x5028('0x4')],_0x13d529[_0x5028('0x2e')],_0x13d529[_0x5028('0x2f')]));if(_0x13d529[_0x5028('0x2e')]['toLowerCase']()==_0x5028('0x30')&&_[_0x5028('0x31')](_0x13d529[_0x5028('0x2f')][_0x5028('0x32')](),'cdr')){var _0x51821e=_0x13d529['appdata'][_0x5028('0x33')]('=');var _0x98dcbb=_0x51821e[0x0][_0x5028('0x34')](_0x51821e[0x0]['lastIndexOf']('(')+0x1,_0x51821e[0x0][_0x5028('0x35')](')'));var _0x5dddeb=_0x51821e[0x1];recordings[_0x13d529[_0x5028('0x4')]][_0x98dcbb]=_0x5dddeb;}}}catch(_0x53566e){utils[_0x5028('0x12')](util[_0x5028('0x3')](_0x5028('0x36'),_0x13d529[_0x5028('0x4')]),_0x53566e);}};exports[_0x5028('0x37')]=function(_0xc6d3aa){try{if(!_[_0x5028('0x14')](recordings[_0xc6d3aa['uniqueid']])){utils[_0x5028('0xd')](util[_0x5028('0x3')](_0x5028('0x38'),_0xc6d3aa[_0x5028('0x4')]),_0xc6d3aa);utils[_0x5028('0x2')](util[_0x5028('0x3')](_0x5028('0x39'),_0xc6d3aa['uniqueid'],_0xc6d3aa[_0x5028('0x3a')]));recordings[_0xc6d3aa['uniqueid']][_0x5028('0x3a')]=_0xc6d3aa['queue'];}}catch(_0x20cc66){utils['error'](util['format'](_0x5028('0x38'),_0xc6d3aa[_0x5028('0x4')]),_0x20cc66);}};exports[_0x5028('0x3b')]=function(_0x1d54a2){try{utils[_0x5028('0xd')](util[_0x5028('0x3')](_0x5028('0x3c'),_0x1d54a2['uniqueid']),_0x1d54a2);utils[_0x5028('0x2')](util[_0x5028('0x3')](_0x5028('0x3d'),_0x1d54a2[_0x5028('0x4')],_0x1d54a2[_0x5028('0x3e')],_0x1d54a2['transferercalleridname'],_0x1d54a2[_0x5028('0x3f')],_0x1d54a2['transfereecalleridname']));if(recordings[_0x1d54a2[_0x5028('0x40')]]&&transfers['blinds'][_0x1d54a2[_0x5028('0x40')]]){transfers[_0x5028('0x5')][_0x1d54a2[_0x5028('0x40')]][_0x5028('0x41')]=!![];}}catch(_0x2db4cd){utils[_0x5028('0x12')](util['format']('[%s][recordings][blindtransfer]',_0x1d54a2['uniqueid']),_0x2db4cd);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 734efd9..32b8d6b 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 _0x1668=['transfertargetexten','transfertargetlinkedid','error','lodash','util','./utils','format','[%s][transfers][writeDB]\x20type:%s','type','origtransfereruniqueid','CreateVoiceTransferReport','blinds','blindtransfer','debug','uniqueid','info','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','transfereruniqueid','[%s][transfers][blindtransfer]','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransfererexten','isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext'];(function(_0x17d928,_0x15f099){var _0x2c812c=function(_0x5e42db){while(--_0x5e42db){_0x17d928['push'](_0x17d928['shift']());}};_0x2c812c(++_0x15f099);}(_0x1668,0x10b));var _0x8166=function(_0x4add05,_0x4edaa9){_0x4add05=_0x4add05-0x0;var _0x5a6e2c=_0x1668[_0x4add05];return _0x5a6e2c;};'use strict';var _=require(_0x8166('0x0'));var util=require(_0x8166('0x1'));var utils=require(_0x8166('0x2'));function writeDB(_0x41392c){utils['info'](util[_0x8166('0x3')](_0x8166('0x4'),_0x41392c[_0x8166('0x5')]==='attended'?_0x41392c[_0x8166('0x6')]:_0x41392c['uniqueid'],_0x41392c[_0x8166('0x5')]));utils['request'](_0x8166('0x7'),_0x41392c);}exports[_0x8166('0x8')]={};exports[_0x8166('0x9')]=function(_0x574089){try{utils[_0x8166('0xa')](util[_0x8166('0x3')]('[%s][transfers][blindtransfer]',_0x574089[_0x8166('0xb')]),_0x574089);utils[_0x8166('0xc')](util[_0x8166('0x3')](_0x8166('0xd'),_0x574089[_0x8166('0xb')],_0x574089[_0x8166('0xe')],_0x574089[_0x8166('0xf')],_0x574089[_0x8166('0x10')],_0x574089[_0x8166('0x11')]));_0x574089[_0x8166('0x5')]=_0x8166('0x12');exports[_0x8166('0x8')][_0x574089[_0x8166('0x13')]]=_0x574089;writeDB(_0x574089);}catch(_0x328c10){utils['error'](util[_0x8166('0x3')](_0x8166('0x14'),_0x574089[_0x8166('0xb')]),_0x328c10);}};exports['attendedtransfer']=function(_0x1dd659){try{utils['debug'](util[_0x8166('0x3')](_0x8166('0x15'),_0x1dd659[_0x8166('0x6')]),_0x1dd659);utils['info'](util[_0x8166('0x3')](_0x8166('0x16'),_0x1dd659['origtransfereruniqueid'],_0x1dd659['origtransferercalleridnum'],_0x1dd659[_0x8166('0x17')],_0x1dd659[_0x8166('0x18')],_0x1dd659[_0x8166('0x19')]));_0x1dd659=_[_0x8166('0x1a')](_0x1dd659,{'transfererchannel':_0x1dd659[_0x8166('0x1b')],'transferercalleridnum':_0x1dd659['origtransferercalleridnum'],'transferercalleridname':_0x1dd659[_0x8166('0x17')],'transfererconnectedlinenum':_0x1dd659[_0x8166('0x1c')],'transfererconnectedlinename':_0x1dd659['secondtransfererconnectedlinename'],'transfereraccountcode':_0x1dd659[_0x8166('0x1d')],'transferercontext':_0x1dd659[_0x8166('0x1e')],'transfererexten':_0x1dd659[_0x8166('0x1f')],'transfererlinkedid':_0x1dd659[_0x8166('0x20')],'context':_0x1dd659['origtransferercontext'],'extension':_0x1dd659[_0x8166('0x21')],'type':'attended'});if(_[_0x8166('0x22')](_0x1dd659[_0x8166('0x23')])){_0x1dd659=_['assign'](_0x1dd659,{'transfereechannel':_0x1dd659[_0x8166('0x24')],'transfereecalleridnum':_0x1dd659['transfertargetcalleridnum'],'transfereecalleridname':_0x1dd659[_0x8166('0x19')],'transfereeconnectedlinenum':_0x1dd659[_0x8166('0x25')],'transfereeconnectedlinename':_0x1dd659[_0x8166('0x26')],'transfereeaccountcode':_0x1dd659[_0x8166('0x27')],'transfereecontext':_0x1dd659[_0x8166('0x28')],'transfereeexten':_0x1dd659[_0x8166('0x29')],'transfereelinkedid':_0x1dd659[_0x8166('0x2a')]});}writeDB(_0x1dd659);}catch(_0x1d9d4e){utils[_0x8166('0x2b')](util[_0x8166('0x3')](_0x8166('0x15'),_0x1dd659[_0x8166('0x6')]),_0x1d9d4e);}}; \ No newline at end of file +var _0xf970=['origtransfererlinkedid','origtransfererexten','isNil','transfereechannel','transfertargetchannel','transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid','util','./utils','info','[%s][transfers][writeDB]\x20type:%s','type','attended','uniqueid','request','CreateVoiceTransferReport','blinds','blindtransfer','debug','[%s][transfers][blindtransfer]','format','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','blind','transfereruniqueid','error','attendedtransfer','[%s][transfers][attendedtransfer]','origtransfereruniqueid','origtransferercalleridnum','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransferercalleridname','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransfererexten'];(function(_0x934425,_0x5af72f){var _0x31d596=function(_0x219869){while(--_0x219869){_0x934425['push'](_0x934425['shift']());}};_0x31d596(++_0x5af72f);}(_0xf970,0x140));var _0x0f97=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf970[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x0f97('0x0'));var utils=require(_0x0f97('0x1'));function writeDB(_0x4bcc96){utils[_0x0f97('0x2')](util['format'](_0x0f97('0x3'),_0x4bcc96[_0x0f97('0x4')]===_0x0f97('0x5')?_0x4bcc96['origtransfereruniqueid']:_0x4bcc96[_0x0f97('0x6')],_0x4bcc96[_0x0f97('0x4')]));utils[_0x0f97('0x7')](_0x0f97('0x8'),_0x4bcc96);}exports[_0x0f97('0x9')]={};exports[_0x0f97('0xa')]=function(_0x5036ba){try{utils[_0x0f97('0xb')](util['format'](_0x0f97('0xc'),_0x5036ba['uniqueid']),_0x5036ba);utils[_0x0f97('0x2')](util[_0x0f97('0xd')](_0x0f97('0xe'),_0x5036ba['uniqueid'],_0x5036ba[_0x0f97('0xf')],_0x5036ba[_0x0f97('0x10')],_0x5036ba['transfereecalleridnum'],_0x5036ba['transfereecalleridname']));_0x5036ba[_0x0f97('0x4')]=_0x0f97('0x11');exports[_0x0f97('0x9')][_0x5036ba[_0x0f97('0x12')]]=_0x5036ba;writeDB(_0x5036ba);}catch(_0x480cdf){utils[_0x0f97('0x13')](util[_0x0f97('0xd')](_0x0f97('0xc'),_0x5036ba[_0x0f97('0x6')]),_0x480cdf);}};exports[_0x0f97('0x14')]=function(_0x5dfae6){try{utils[_0x0f97('0xb')](util[_0x0f97('0xd')](_0x0f97('0x15'),_0x5dfae6[_0x0f97('0x16')]),_0x5dfae6);utils[_0x0f97('0x2')](util['format']('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x5dfae6['origtransfereruniqueid'],_0x5dfae6[_0x0f97('0x17')],_0x5dfae6['origtransferercalleridname'],_0x5dfae6[_0x0f97('0x18')],_0x5dfae6[_0x0f97('0x19')]));_0x5dfae6=_[_0x0f97('0x1a')](_0x5dfae6,{'transfererchannel':_0x5dfae6['origtransfererchannel'],'transferercalleridnum':_0x5dfae6[_0x0f97('0x17')],'transferercalleridname':_0x5dfae6[_0x0f97('0x1b')],'transfererconnectedlinenum':_0x5dfae6[_0x0f97('0x1c')],'transfererconnectedlinename':_0x5dfae6['secondtransfererconnectedlinename'],'transfereraccountcode':_0x5dfae6[_0x0f97('0x1d')],'transferercontext':_0x5dfae6['secondtransferercontext'],'transfererexten':_0x5dfae6[_0x0f97('0x1e')],'transfererlinkedid':_0x5dfae6[_0x0f97('0x1f')],'context':_0x5dfae6['origtransferercontext'],'extension':_0x5dfae6[_0x0f97('0x20')],'type':'attended'});if(_[_0x0f97('0x21')](_0x5dfae6[_0x0f97('0x22')])){_0x5dfae6=_[_0x0f97('0x1a')](_0x5dfae6,{'transfereechannel':_0x5dfae6[_0x0f97('0x23')],'transfereecalleridnum':_0x5dfae6[_0x0f97('0x18')],'transfereecalleridname':_0x5dfae6[_0x0f97('0x19')],'transfereeconnectedlinenum':_0x5dfae6['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x5dfae6['transfertargetconnectedlinename'],'transfereeaccountcode':_0x5dfae6[_0x0f97('0x24')],'transfereecontext':_0x5dfae6[_0x0f97('0x25')],'transfereeexten':_0x5dfae6['transfertargetexten'],'transfereelinkedid':_0x5dfae6[_0x0f97('0x26')]});}writeDB(_0x5dfae6);}catch(_0x2869cd){utils[_0x0f97('0x13')](util[_0x0f97('0xd')](_0x0f97('0x15'),_0x5dfae6['origtransfereruniqueid']),_0x2869cd);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index c8e11bd..72dbc68 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 _0x7e3e=['info','debug','error','inspect','request','then','[utils][request]\x20name:%s','catch','internal','name','interface','[utils][getUser]\x20where:%s','stringify','length','result','getUserByInternal','found','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','notfound','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','acw','acwTimeout','[utils][getVoiceQueueByName]','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','sumTime','isAfter','isBefore','bluebird','moment','util','client','http','../../config/logger','xdr'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0x7e3e,0x126));var _0xe7e3=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x7e3e[_0x13d07a];return _0x5ee0ee;};'use strict';var BPromise=require(_0xe7e3('0x0'));var jayson=require('jayson/promise');var moment=require(_0xe7e3('0x1'));var util=require(_0xe7e3('0x2'));var client=jayson[_0xe7e3('0x3')][_0xe7e3('0x4')]({'port':0x2329});var logger=require(_0xe7e3('0x5'))(_0xe7e3('0x6'));exports[_0xe7e3('0x7')]=function(_0xba0490,_0x25070a){logger['info'](_0xba0490,_0x25070a?util['inspect'](_0x25070a,{'showHidden':![],'depth':null}):'');};exports['debug']=function(_0x416828,_0x1551aa){logger[_0xe7e3('0x8')](_0x416828,_0x1551aa?util['inspect'](_0x1551aa,{'showHidden':![],'depth':null}):'');};exports[_0xe7e3('0x9')]=function(_0x1ff9ae,_0x39bbad){logger[_0xe7e3('0x9')](_0x1ff9ae,_0x39bbad?util[_0xe7e3('0xa')](_0x39bbad,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x12b79c,_0x20934c){return client[_0xe7e3('0xb')](_0x12b79c,{'body':_0x20934c})[_0xe7e3('0xc')](function(_0x5601ca){logger[_0xe7e3('0x8')](_0xe7e3('0xd'),_0x12b79c,_0x5601ca?util[_0xe7e3('0xa')](_0x5601ca,{'showHidden':![],'depth':null}):'');})[_0xe7e3('0xe')](function(_0x38e1dd){logger[_0xe7e3('0x9')](_0xe7e3('0xd'),_0x12b79c,_0x38e1dd?util[_0xe7e3('0xa')](_0x38e1dd,{'showHidden':![],'depth':null}):'');});};function getUser(_0x582893){return client['request']('GetUser',{'options':{'raw':!![],'attributes':['id',_0xe7e3('0xf'),_0xe7e3('0x10'),_0xe7e3('0x11')],'where':_0x582893,'limit':0x1}})['then'](function(_0x1d544d){logger[_0xe7e3('0x8')](_0xe7e3('0x12'),JSON[_0xe7e3('0x13')](_0x582893),_0x1d544d?util[_0xe7e3('0xa')](_0x1d544d,{'showHidden':![],'depth':null}):'');return _0x1d544d['result'][_0xe7e3('0x14')]?_0x1d544d[_0xe7e3('0x15')][0x0]:null;});}exports[_0xe7e3('0x16')]=function(_0x52d3a8){return new BPromise(function(_0x25e3b9,_0x5c34c5){if(_0x52d3a8){return getUser({'internal':_0x52d3a8})[_0xe7e3('0xc')](function(_0x7ef16){logger[_0xe7e3('0x7')]('[utils][getUserByInternal]\x20internal:%s\x20%s',_0x52d3a8,_0x7ef16?_0xe7e3('0x17'):'notfound');return _0x25e3b9(_0x7ef16);})[_0xe7e3('0xe')](function(_0x26b0c6){logger['error'](_0xe7e3('0x18'),_0x26b0c6?util['inspect'](_0x26b0c6,{'showHidden':![],'depth':null}):'');return _0x25e3b9(null);});}return _0x25e3b9(null);});};exports[_0xe7e3('0x19')]=function(_0x11c5b3){return new BPromise(function(_0x3c74ee,_0x555b75){if(_0x11c5b3){return getUser({'interface':_0x11c5b3})[_0xe7e3('0xc')](function(_0x149ffc){logger[_0xe7e3('0x7')](_0xe7e3('0x1a'),_0x11c5b3,_0x149ffc?_0xe7e3('0x17'):_0xe7e3('0x1b'));return _0x3c74ee(_0x149ffc);})['catch'](function(_0x2127a8){logger[_0xe7e3('0x9')]('[utils][getUserByInterface]',_0x2127a8?util[_0xe7e3('0xa')](_0x2127a8,{'showHidden':![],'depth':null}):'');return _0x3c74ee(null);});}return _0x3c74ee(null);});};exports['getUserByName']=function(_0x30777b){return new BPromise(function(_0x15417d,_0x1ea01c){if(_0x30777b){return getUser({'name':_0x30777b})[_0xe7e3('0xc')](function(_0x255039){logger[_0xe7e3('0x7')](_0xe7e3('0x1c'),_0x30777b,_0x255039?_0xe7e3('0x17'):_0xe7e3('0x1b'));return _0x15417d(_0x255039);})[_0xe7e3('0xe')](function(_0x1c6335){logger[_0xe7e3('0x9')](_0xe7e3('0x1d'),_0x1c6335?util[_0xe7e3('0xa')](_0x1c6335,{'showHidden':![],'depth':null}):'');return _0x15417d(null);});}return _0x15417d(null);});};exports[_0xe7e3('0x1e')]=function(_0x12dc93){return new BPromise(function(_0x1c7b61,_0x57d287){if(_0x12dc93){return client[_0xe7e3('0xb')](_0xe7e3('0x1f'),{'options':{'raw':!![],'attributes':['id','name','type',_0xe7e3('0x20'),_0xe7e3('0x21')],'where':{'name':_0x12dc93},'limit':0x1}})['then'](function(_0x250144){logger[_0xe7e3('0x8')]('[utils][getVoiceQueueByName]\x20name:%s',_0x12dc93,_0x250144?util[_0xe7e3('0xa')](_0x250144,{'showHidden':![],'depth':null}):'');logger[_0xe7e3('0x7')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x12dc93,_0x250144?_0xe7e3('0x17'):'notfound');return _0x1c7b61(_0x250144[_0xe7e3('0x15')][_0xe7e3('0x14')]?_0x250144['result'][0x0]:null);})[_0xe7e3('0xe')](function(_0x270098){logger['error'](_0xe7e3('0x22'),_0x270098?util[_0xe7e3('0xa')](_0x270098,{'showHidden':![],'depth':null}):'');return _0x1c7b61(null);});}return _0x1c7b61(null);});};exports['addTime']=function(_0x54cda9,_0x77ff95){return moment(_0x54cda9)[_0xe7e3('0x23')](_0x77ff95,_0xe7e3('0x24'))[_0xe7e3('0x25')](_0xe7e3('0x26'));};exports[_0xe7e3('0x27')]=function(_0x563e69,_0x1beaa3){return moment(_0x563e69)['subtract'](_0x1beaa3,_0xe7e3('0x24'))['format'](_0xe7e3('0x26'));};exports['diffTime']=function(_0x1a8bea,_0x2d3ce7){return moment(_0x1a8bea)['diff'](moment(_0x2d3ce7),_0xe7e3('0x24'));};exports[_0xe7e3('0x28')]=function(_0x4c1477,_0x55a4a9){return parseInt(_0x4c1477,0xa)+parseInt(_0x55a4a9,0xa);};exports['now']=function(){return moment()[_0xe7e3('0x25')](_0xe7e3('0x26'));};exports[_0xe7e3('0x29')]=function(_0x3871d2,_0x27e966){if(_0x27e966){return moment(_0x3871d2)[_0xe7e3('0x29')](_0x27e966);}return!![];};exports[_0xe7e3('0x2a')]=function(_0x1163e2,_0x8e2671){if(_0x8e2671){return moment(_0x1163e2)[_0xe7e3('0x2a')](_0x8e2671);}else if(_0x1163e2){return!![];}return![];}; \ No newline at end of file +var _0x7344=['util','client','http','../../config/logger','info','inspect','debug','request','catch','error','GetUser','name','interface','then','[utils][getUser]\x20where:%s','stringify','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByName]\x20name:%s\x20%s','getVoiceQueueByName','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','length','[utils][getVoiceQueueByName]','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','diff','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','moment'];(function(_0x7eac63,_0x2da992){var _0x23de16=function(_0x1e5cc5){while(--_0x1e5cc5){_0x7eac63['push'](_0x7eac63['shift']());}};_0x23de16(++_0x2da992);}(_0x7344,0xbd));var _0x4734=function(_0x1a1682,_0x24c065){_0x1a1682=_0x1a1682-0x0;var _0x23e15c=_0x7344[_0x1a1682];return _0x23e15c;};'use strict';var BPromise=require(_0x4734('0x0'));var jayson=require(_0x4734('0x1'));var moment=require(_0x4734('0x2'));var util=require(_0x4734('0x3'));var client=jayson[_0x4734('0x4')][_0x4734('0x5')]({'port':0x2329});var logger=require(_0x4734('0x6'))('xdr');exports[_0x4734('0x7')]=function(_0x445382,_0x46bd48){logger[_0x4734('0x7')](_0x445382,_0x46bd48?util[_0x4734('0x8')](_0x46bd48,{'showHidden':![],'depth':null}):'');};exports[_0x4734('0x9')]=function(_0x299f2c,_0x25bfa5){logger[_0x4734('0x9')](_0x299f2c,_0x25bfa5?util[_0x4734('0x8')](_0x25bfa5,{'showHidden':![],'depth':null}):'');};exports['error']=function(_0x1d3c42,_0x1b1c9e){logger['error'](_0x1d3c42,_0x1b1c9e?util[_0x4734('0x8')](_0x1b1c9e,{'showHidden':![],'depth':null}):'');};exports[_0x4734('0xa')]=function(_0x3211a3,_0x23d59b){return client[_0x4734('0xa')](_0x3211a3,{'body':_0x23d59b})['then'](function(_0x1adac0){logger['debug']('[utils][request]\x20name:%s',_0x3211a3,_0x1adac0?util[_0x4734('0x8')](_0x1adac0,{'showHidden':![],'depth':null}):'');})[_0x4734('0xb')](function(_0xf96802){logger[_0x4734('0xc')]('[utils][request]\x20name:%s',_0x3211a3,_0xf96802?util[_0x4734('0x8')](_0xf96802,{'showHidden':![],'depth':null}):'');});};function getUser(_0x1aeb17){return client[_0x4734('0xa')](_0x4734('0xd'),{'options':{'raw':!![],'attributes':['id','internal',_0x4734('0xe'),_0x4734('0xf')],'where':_0x1aeb17,'limit':0x1}})[_0x4734('0x10')](function(_0x49928e){logger[_0x4734('0x9')](_0x4734('0x11'),JSON[_0x4734('0x12')](_0x1aeb17),_0x49928e?util['inspect'](_0x49928e,{'showHidden':![],'depth':null}):'');return _0x49928e[_0x4734('0x13')]['length']?_0x49928e['result'][0x0]:null;});}exports[_0x4734('0x14')]=function(_0x282919){return new BPromise(function(_0x5a4653,_0x58135f){if(_0x282919){return getUser({'internal':_0x282919})[_0x4734('0x10')](function(_0x469de3){logger[_0x4734('0x7')](_0x4734('0x15'),_0x282919,_0x469de3?_0x4734('0x16'):_0x4734('0x17'));return _0x5a4653(_0x469de3);})['catch'](function(_0x12dbf2){logger['error'](_0x4734('0x18'),_0x12dbf2?util[_0x4734('0x8')](_0x12dbf2,{'showHidden':![],'depth':null}):'');return _0x5a4653(null);});}return _0x5a4653(null);});};exports[_0x4734('0x19')]=function(_0x1f4837){return new BPromise(function(_0xea5358,_0x26b3a1){if(_0x1f4837){return getUser({'interface':_0x1f4837})[_0x4734('0x10')](function(_0x1e1ca4){logger['info']('[utils][getUserByInterface]\x20interface:%s\x20%s',_0x1f4837,_0x1e1ca4?_0x4734('0x16'):_0x4734('0x17'));return _0xea5358(_0x1e1ca4);})[_0x4734('0xb')](function(_0x226b0b){logger['error']('[utils][getUserByInterface]',_0x226b0b?util[_0x4734('0x8')](_0x226b0b,{'showHidden':![],'depth':null}):'');return _0xea5358(null);});}return _0xea5358(null);});};exports['getUserByName']=function(_0x83581c){return new BPromise(function(_0x4efa14,_0x451a97){if(_0x83581c){return getUser({'name':_0x83581c})[_0x4734('0x10')](function(_0x5515a){logger[_0x4734('0x7')](_0x4734('0x1a'),_0x83581c,_0x5515a?_0x4734('0x16'):_0x4734('0x17'));return _0x4efa14(_0x5515a);})[_0x4734('0xb')](function(_0x3cdb68){logger[_0x4734('0xc')]('[utils][getUserByName]',_0x3cdb68?util[_0x4734('0x8')](_0x3cdb68,{'showHidden':![],'depth':null}):'');return _0x4efa14(null);});}return _0x4efa14(null);});};exports[_0x4734('0x1b')]=function(_0x16bd6f){return new BPromise(function(_0x5b91b5,_0x30592d){if(_0x16bd6f){return client[_0x4734('0xa')]('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id',_0x4734('0xe'),_0x4734('0x1c'),_0x4734('0x1d'),_0x4734('0x1e')],'where':{'name':_0x16bd6f},'limit':0x1}})[_0x4734('0x10')](function(_0x25f3e6){logger['debug'](_0x4734('0x1f'),_0x16bd6f,_0x25f3e6?util[_0x4734('0x8')](_0x25f3e6,{'showHidden':![],'depth':null}):'');logger[_0x4734('0x7')](_0x4734('0x20'),_0x16bd6f,_0x25f3e6?'found':_0x4734('0x17'));return _0x5b91b5(_0x25f3e6['result'][_0x4734('0x21')]?_0x25f3e6[_0x4734('0x13')][0x0]:null);})[_0x4734('0xb')](function(_0x28c2e1){logger[_0x4734('0xc')](_0x4734('0x22'),_0x28c2e1?util[_0x4734('0x8')](_0x28c2e1,{'showHidden':![],'depth':null}):'');return _0x5b91b5(null);});}return _0x5b91b5(null);});};exports[_0x4734('0x23')]=function(_0x5cac17,_0x5899e8){return moment(_0x5cac17)[_0x4734('0x24')](_0x5899e8,_0x4734('0x25'))[_0x4734('0x26')](_0x4734('0x27'));};exports[_0x4734('0x28')]=function(_0x48ae5e,_0x4f1a43){return moment(_0x48ae5e)[_0x4734('0x29')](_0x4f1a43,_0x4734('0x25'))[_0x4734('0x26')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x4734('0x2a')]=function(_0x2e2c94,_0x15b50b){return moment(_0x2e2c94)[_0x4734('0x2b')](moment(_0x15b50b),'seconds');};exports[_0x4734('0x2c')]=function(_0x307700,_0x2677a4){return parseInt(_0x307700,0xa)+parseInt(_0x2677a4,0xa);};exports[_0x4734('0x2d')]=function(){return moment()[_0x4734('0x26')](_0x4734('0x27'));};exports[_0x4734('0x2e')]=function(_0x4e66f1,_0x50d346){if(_0x50d346){return moment(_0x4e66f1)[_0x4734('0x2e')](_0x50d346);}return!![];};exports[_0x4734('0x2f')]=function(_0x2277da,_0x2c844e){if(_0x2c844e){return moment(_0x2277da)['isBefore'](_0x2c844e);}else if(_0x2277da){return!![];}return![];}; \ No newline at end of file diff --git a/server/utils/client-side-logger.js b/server/utils/client-side-logger.js index e9221f7..b4f5196 100644 --- a/server/utils/client-side-logger.js +++ b/server/utils/client-side-logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xea12=['client','role','name','ensureDir','catch','user','then','data','api','auth','set','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','\x20body=%s','body','format','method','x-forwarded-for','connection','remoteAddress','url','statusCode','responseTime','inspect','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','headers','other','agent_name','test','lodash','express-winston','path','./loggers','fileLogger','./safe-template','./mask-sensitive-data','maskSensitiveData','join','/var','log','xcally'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0xea12,0x102));var _0x2ea1=function(_0x219cb3,_0x57ea0c){_0x219cb3=_0x219cb3-0x0;var _0x5b5524=_0xea12[_0x219cb3];return _0x5b5524;};var fs=require('fs-extra');var _=require(_0x2ea1('0x0'));var ewinston=require(_0x2ea1('0x1'));var path=require(_0x2ea1('0x2'));var util=require('util');var fileLogger=require(_0x2ea1('0x3'))[_0x2ea1('0x4')];var safeTemplate=require(_0x2ea1('0x5'))['safeTemplate'];var maskSensitiveData=require(_0x2ea1('0x6'))[_0x2ea1('0x7')];function ClientSideLogger(){function _0x417ab6(_0x35135c){var _0x9f2d9=path[_0x2ea1('0x8')](_0x2ea1('0x9'),_0x2ea1('0xa'),_0x2ea1('0xb'));var _0x2e5a21=path['join'](_0x2ea1('0xc'),_0x35135c[_0x2ea1('0xd')]+'-'+_0x35135c[_0x2ea1('0xe')]);return fs[_0x2ea1('0xf')](path['join'](_0x9f2d9,_0x2e5a21))['then'](function(){var _0x4c198f=fileLogger(_0x2ea1('0xc'),path[_0x2ea1('0x8')](_0x9f2d9,_0x2e5a21));return _0x4c198f;})[_0x2ea1('0x10')](function(_0x10caeb){throw _0x10caeb;});}this[_0x2ea1('0xa')]=function(_0x43d3b5,_0x15392f,_0x170446,_0xca5420){return _0x417ab6(_0x43d3b5[_0x2ea1('0x11')])[_0x2ea1('0x12')](function(_0xec59f1){var _0x43268f=_0xec59f1[_0x15392f];return _0x43268f;})[_0x2ea1('0x12')](function(_0x59b493){var _0x2f0cce=_0x43d3b5[_0x2ea1('0x11')]?_0x43d3b5[_0x2ea1('0x11')]['id']:'no-user';var _0x39cb57=_0xca5420[_0x2ea1('0x13')];var _0x44f8d8=_0xca5420['timestamp'];var _0x14d4cf=new Date(Number(_0x44f8d8));return _0x59b493(_0x2f0cce,_0x14d4cf,_0x170446,_0x39cb57);})['catch'](function(_0x1ae438){fileLogger(_0x2ea1('0xc'))['error'](_0x1ae438);});};}function setupLoggers(_0x22c38b){return new Promise(function(_0x424e78){var _0x394b00=new ClientSideLogger();var _0x168d3e=fileLogger(_0x2ea1('0x14'));var _0x5703c1=fileLogger(_0x2ea1('0x15'));_0x22c38b[_0x2ea1('0x16')]('client-side-logger',_0x394b00);_0x22c38b[_0x2ea1('0x17')](ewinston['logger']({'winstonInstance':_0x168d3e,'meta':![],'statusLevels':!![],'msg':function(_0x34d4e1,_0x23eccb){var _0x4f3c44=_0x2ea1('0x18');if(!_[_0x2ea1('0x19')](_0x34d4e1['body'])){_0x4f3c44+=_0x2ea1('0x1a');var _0x454461=_0x34d4e1[_0x2ea1('0x1b')];maskSensitiveData(_0x454461);}return safeTemplate(util[_0x2ea1('0x1c')](_0x4f3c44,_0x34d4e1[_0x2ea1('0x1d')],_0x34d4e1['headers'][_0x2ea1('0x1e')]?_0x34d4e1['headers'][_0x2ea1('0x1e')]:_0x34d4e1[_0x2ea1('0x1f')][_0x2ea1('0x20')]||_0x34d4e1['ip'],_0x34d4e1[_0x2ea1('0x21')],_0x23eccb[_0x2ea1('0x22')],_0x23eccb[_0x2ea1('0x23')],_0x34d4e1[_0x2ea1('0x11')]?_0x34d4e1[_0x2ea1('0x11')]['id']:null,_0x34d4e1[_0x2ea1('0x11')]?_0x34d4e1[_0x2ea1('0x11')][_0x2ea1('0xe')]:null,_0x34d4e1['user']?_0x34d4e1[_0x2ea1('0x11')][_0x2ea1('0xd')]:null,_0x454461?util[_0x2ea1('0x24')](_0x454461,![],null):''));}}));_0x22c38b[_0x2ea1('0x17')](ewinston[_0x2ea1('0x25')]({'winstonInstance':_0x5703c1,'meta':![],'statusLevels':!![],'msg':function(_0x4af872,_0x448d77){var _0x573a27=_0x2ea1('0x26');if(_0x4af872[_0x2ea1('0x1b')]&&_0x4af872[_0x2ea1('0x1b')][_0x2ea1('0x27')]&&_0x4af872['body'][_0x2ea1('0x28')]){_0x573a27='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0x2ea1('0x1c')](_0x573a27,_0x4af872[_0x2ea1('0x1d')],_0x4af872[_0x2ea1('0x29')]['x-forwarded-for']?_0x4af872[_0x2ea1('0x29')][_0x2ea1('0x1e')]:_0x4af872[_0x2ea1('0x1f')][_0x2ea1('0x20')]||_0x4af872['ip'],_0x4af872[_0x2ea1('0x21')],_0x448d77[_0x2ea1('0x22')],_0x448d77[_0x2ea1('0x23')],_0x4af872[_0x2ea1('0x11')]?_0x4af872[_0x2ea1('0x11')]['id']:null,_0x4af872['user']?_0x4af872[_0x2ea1('0x11')][_0x2ea1('0xe')]:null,_0x4af872[_0x2ea1('0x11')]?_0x4af872[_0x2ea1('0x11')][_0x2ea1('0xd')]:null,_0x4af872[_0x2ea1('0x1b')]&&_0x4af872[_0x2ea1('0x1b')]['device']?_0x4af872[_0x2ea1('0x1b')]['device']:_0x2ea1('0x2a'),_0x4af872[_0x2ea1('0x1b')]&&_0x4af872['body']['agent_id']?_0x4af872[_0x2ea1('0x1b')][_0x2ea1('0x28')]:'',_0x4af872[_0x2ea1('0x1b')]&&_0x4af872['body'][_0x2ea1('0x2b')]?_0x4af872[_0x2ea1('0x1b')]['agent_name']:'');},'ignoreRoute':function(_0x32f7da){var _0x3a550d=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x3a550d[_0x2ea1('0x2c')](_0x32f7da['url']);}}));return _0x424e78();});}exports['setupLoggers']=setupLoggers; \ No newline at end of file +var _0x4c08=['x-forwarded-for','url','statusCode','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','connection','responseTime','device','agent_name','test','setupLoggers','fs-extra','lodash','express-winston','path','util','./loggers','./safe-template','safeTemplate','./mask-sensitive-data','join','/var','log','xcally','client','role','name','then','catch','user','data','timestamp','error','auth','set','client-side-logger','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','format','method','headers'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x4c08,0x97));var _0x84c0=function(_0x4dcc2d,_0x422839){_0x4dcc2d=_0x4dcc2d-0x0;var _0x1bbd79=_0x4c08[_0x4dcc2d];return _0x1bbd79;};var fs=require(_0x84c0('0x0'));var _=require(_0x84c0('0x1'));var ewinston=require(_0x84c0('0x2'));var path=require(_0x84c0('0x3'));var util=require(_0x84c0('0x4'));var fileLogger=require(_0x84c0('0x5'))['fileLogger'];var safeTemplate=require(_0x84c0('0x6'))[_0x84c0('0x7')];var maskSensitiveData=require(_0x84c0('0x8'))['maskSensitiveData'];function ClientSideLogger(){function _0x353587(_0x25c5db){var _0x293f14=path[_0x84c0('0x9')](_0x84c0('0xa'),_0x84c0('0xb'),_0x84c0('0xc'));var _0x30861e=path[_0x84c0('0x9')](_0x84c0('0xd'),_0x25c5db[_0x84c0('0xe')]+'-'+_0x25c5db[_0x84c0('0xf')]);return fs['ensureDir'](path['join'](_0x293f14,_0x30861e))[_0x84c0('0x10')](function(){var _0x44e26a=fileLogger('client',path[_0x84c0('0x9')](_0x293f14,_0x30861e));return _0x44e26a;})[_0x84c0('0x11')](function(_0x8983b8){throw _0x8983b8;});}this[_0x84c0('0xb')]=function(_0xa413bf,_0x42d248,_0x2cfc97,_0x621db7){return _0x353587(_0xa413bf[_0x84c0('0x12')])['then'](function(_0x2896c7){var _0x556c52=_0x2896c7[_0x42d248];return _0x556c52;})[_0x84c0('0x10')](function(_0x4f4af8){var _0x1f2044=_0xa413bf[_0x84c0('0x12')]?_0xa413bf['user']['id']:'no-user';var _0x15972a=_0x621db7[_0x84c0('0x13')];var _0x499e46=_0x621db7[_0x84c0('0x14')];var _0x1c5d5f=new Date(Number(_0x499e46));return _0x4f4af8(_0x1f2044,_0x1c5d5f,_0x2cfc97,_0x15972a);})[_0x84c0('0x11')](function(_0x2355bc){fileLogger(_0x84c0('0xd'))[_0x84c0('0x15')](_0x2355bc);});};}function setupLoggers(_0x46015d){return new Promise(function(_0x34d50b){var _0x19b034=new ClientSideLogger();var _0x575fbd=fileLogger('api');var _0x2f8fcb=fileLogger(_0x84c0('0x16'));_0x46015d[_0x84c0('0x17')](_0x84c0('0x18'),_0x19b034);_0x46015d['use'](ewinston[_0x84c0('0x19')]({'winstonInstance':_0x575fbd,'meta':![],'statusLevels':!![],'msg':function(_0xf12313,_0x33b908){var _0xbf68a8=_0x84c0('0x1a');if(!_[_0x84c0('0x1b')](_0xf12313[_0x84c0('0x1c')])){_0xbf68a8+=_0x84c0('0x1d');var _0x5bc721=_0xf12313['body'];maskSensitiveData(_0x5bc721);}return safeTemplate(util[_0x84c0('0x1e')](_0xbf68a8,_0xf12313[_0x84c0('0x1f')],_0xf12313[_0x84c0('0x20')][_0x84c0('0x21')]?_0xf12313[_0x84c0('0x20')][_0x84c0('0x21')]:_0xf12313['connection']['remoteAddress']||_0xf12313['ip'],_0xf12313[_0x84c0('0x22')],_0x33b908[_0x84c0('0x23')],_0x33b908['responseTime'],_0xf12313[_0x84c0('0x12')]?_0xf12313[_0x84c0('0x12')]['id']:null,_0xf12313[_0x84c0('0x12')]?_0xf12313[_0x84c0('0x12')]['name']:null,_0xf12313['user']?_0xf12313[_0x84c0('0x12')][_0x84c0('0xe')]:null,_0x5bc721?util[_0x84c0('0x24')](_0x5bc721,![],null):''));}}));_0x46015d['use'](ewinston['logger']({'winstonInstance':_0x2f8fcb,'meta':![],'statusLevels':!![],'msg':function(_0x21f61f,_0x1f9f6d){var _0x5b2f45=_0x84c0('0x25');if(_0x21f61f['body']&&_0x21f61f[_0x84c0('0x1c')]['device']&&_0x21f61f[_0x84c0('0x1c')][_0x84c0('0x26')]){_0x5b2f45=_0x84c0('0x27');}return util[_0x84c0('0x1e')](_0x5b2f45,_0x21f61f[_0x84c0('0x1f')],_0x21f61f[_0x84c0('0x20')][_0x84c0('0x21')]?_0x21f61f[_0x84c0('0x20')]['x-forwarded-for']:_0x21f61f[_0x84c0('0x28')]['remoteAddress']||_0x21f61f['ip'],_0x21f61f['url'],_0x1f9f6d[_0x84c0('0x23')],_0x1f9f6d[_0x84c0('0x29')],_0x21f61f[_0x84c0('0x12')]?_0x21f61f[_0x84c0('0x12')]['id']:null,_0x21f61f[_0x84c0('0x12')]?_0x21f61f[_0x84c0('0x12')]['name']:null,_0x21f61f[_0x84c0('0x12')]?_0x21f61f[_0x84c0('0x12')]['role']:null,_0x21f61f[_0x84c0('0x1c')]&&_0x21f61f[_0x84c0('0x1c')]['device']?_0x21f61f['body'][_0x84c0('0x2a')]:'other',_0x21f61f[_0x84c0('0x1c')]&&_0x21f61f[_0x84c0('0x1c')][_0x84c0('0x26')]?_0x21f61f['body'][_0x84c0('0x26')]:'',_0x21f61f[_0x84c0('0x1c')]&&_0x21f61f['body'][_0x84c0('0x2b')]?_0x21f61f[_0x84c0('0x1c')][_0x84c0('0x2b')]:'');},'ignoreRoute':function(_0x5bc6a4){var _0x5d8cc1=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x5d8cc1[_0x84c0('0x2c')](_0x5bc6a4[_0x84c0('0x22')]);}}));return _0x34d50b();});}exports[_0x84c0('0x2d')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index f171f70..ba8e546 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x062f=['Console','consoleLogger','fileLogger','path','util','moment','winston','../config/environment','debugLevel','info','redBG\x20white','red','bold\x20yellow','white','bold\x20white','gray','bold\x20cyan','addColors','/var/log/xcally','join','%s-%s.log','message','{{{','replace','format','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','}}}','meta','keys','length','stringify','warn','Logger','File','error','transports','%s-%s'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x062f,0x143));var _0xf062=function(_0x484cb9,_0x103489){_0x484cb9=_0x484cb9-0x0;var _0x59517e=_0x062f[_0x484cb9];return _0x59517e;};'use strict';var path=require(_0xf062('0x0'));var util=require(_0xf062('0x1'));var moment=require(_0xf062('0x2'));var winston=require(_0xf062('0x3'));var config=require(_0xf062('0x4'));var debugLevel=config[_0xf062('0x5')]?config[_0xf062('0x5')]['toLowerCase']():_0xf062('0x6');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0xf062('0x7'),'error':_0xf062('0x8'),'warn':_0xf062('0x9'),'info':_0xf062('0xa'),'print':_0xf062('0xb'),'success':'bold\x20green','http':_0xf062('0xc'),'verbose':'bold\x20magenta','debug':'bold\x20blue','silly':_0xf062('0xd')};winston[_0xf062('0xe')](XC_LOG_COLORS);function getLogFileName(_0x292957,_0x485ade,_0x3d8f71){var _0x223d12=_0x292957||_0xf062('0xf');return path[_0xf062('0x10')](_0x223d12,util['format'](_0xf062('0x11'),_0x485ade,_0x3d8f71));}function formatter(_0x8fdf6b,_0x2dd6dd){_0x2dd6dd[_0xf062('0x12')]=_0x2dd6dd[_0xf062('0x12')]['replace'](/@@{/g,_0xf062('0x13'))[_0xf062('0x14')](/}@@/g,'}}}')[_0xf062('0x14')](/@{/g,'{{')[_0xf062('0x14')](/}@/g,'}}');return util[_0xf062('0x15')](_0xf062('0x16'),moment()[_0xf062('0x15')](_0xf062('0x17')),_0x2dd6dd[_0xf062('0x18')][_0xf062('0x19')](),_0x8fdf6b,_0x2dd6dd[_0xf062('0x12')]);}function fileFormat(_0x16dfe3,_0x55b7fb){_0x55b7fb['message']=_0x55b7fb[_0xf062('0x12')][_0xf062('0x14')](/@@{/g,_0xf062('0x13'))[_0xf062('0x14')](/}@@/g,_0xf062('0x1a'))['replace'](/@{/g,'{{')[_0xf062('0x14')](/}@/g,'}}');var _0x37dba6=_0x55b7fb[_0xf062('0x1b')]&&Object[_0xf062('0x1c')](_0x55b7fb[_0xf062('0x1b')])[_0xf062('0x1d')]?'\x0a\x09'+JSON[_0xf062('0x1e')](_0x55b7fb[_0xf062('0x1b')]):'';return util['format']('[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s',moment()['format'](_0xf062('0x17')),_0x55b7fb[_0xf062('0x18')][_0xf062('0x19')](),_0x16dfe3,_0x55b7fb[_0xf062('0x12')],_0x37dba6);}function consoleLogger(){var _0x34811d=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston['transports']['Console']({'level':_0xf062('0x1f'),'json':![],'formatter':function(_0xc6c5fb){return formatter('',_0xc6c5fb);}})]});return _0x34811d;}function fileLogger(_0x5af914,_0x53bfa5){var _0x163e72=new winston[(_0xf062('0x20'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0xf062('0x21'))]({'name':util[_0xf062('0x15')]('%s-%s',_0x5af914,_0xf062('0x22')),'filename':getLogFileName(_0x53bfa5,_0x5af914,_0xf062('0x22')),'level':_0xf062('0x22'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x1d2bca){return fileFormat(_0x5af914,_0x1d2bca);}}),new winston[(_0xf062('0x23'))]['File']({'name':util[_0xf062('0x15')](_0xf062('0x24'),_0x5af914,debugLevel),'filename':getLogFileName(_0x53bfa5,_0x5af914,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x340a31){return fileFormat(_0x5af914,_0x340a31);}}),new winston[(_0xf062('0x23'))][(_0xf062('0x25'))]({'level':_0xf062('0x1f'),'json':![],'formatter':function(_0x1ccd31){return fileFormat(_0x5af914,_0x1ccd31);}})]});return _0x163e72;}exports[_0xf062('0x26')]=consoleLogger;exports[_0xf062('0x27')]=fileLogger; \ No newline at end of file +var _0xb231=['gray','bold\x20magenta','bold\x20blue','bold\x20cyan','addColors','/var/log/xcally','%s-%s.log','message','{{{','replace','format','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','meta','keys','length','stringify','transports','warn','Logger','File','%s-%s','error','consoleLogger','fileLogger','path','util','winston','debugLevel','toLowerCase','info','redBG\x20white','red','bold\x20yellow','white','bold\x20white','bold\x20green'];(function(_0x253476,_0x16b31a){var _0x134271=function(_0x20623c){while(--_0x20623c){_0x253476['push'](_0x253476['shift']());}};_0x134271(++_0x16b31a);}(_0xb231,0x1ef));var _0x1b23=function(_0x56d3e4,_0x260d8d){_0x56d3e4=_0x56d3e4-0x0;var _0x5cfcfd=_0xb231[_0x56d3e4];return _0x5cfcfd;};'use strict';var path=require(_0x1b23('0x0'));var util=require(_0x1b23('0x1'));var moment=require('moment');var winston=require(_0x1b23('0x2'));var config=require('../config/environment');var debugLevel=config[_0x1b23('0x3')]?config[_0x1b23('0x3')][_0x1b23('0x4')]():_0x1b23('0x5');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0x1b23('0x6'),'error':_0x1b23('0x7'),'warn':_0x1b23('0x8'),'info':_0x1b23('0x9'),'print':_0x1b23('0xa'),'success':_0x1b23('0xb'),'http':_0x1b23('0xc'),'verbose':_0x1b23('0xd'),'debug':_0x1b23('0xe'),'silly':_0x1b23('0xf')};winston[_0x1b23('0x10')](XC_LOG_COLORS);function getLogFileName(_0x3d4e59,_0x5c9c3c,_0xc426c2){var _0x321f1d=_0x3d4e59||_0x1b23('0x11');return path['join'](_0x321f1d,util['format'](_0x1b23('0x12'),_0x5c9c3c,_0xc426c2));}function formatter(_0xa0e290,_0x3131bd){_0x3131bd[_0x1b23('0x13')]=_0x3131bd[_0x1b23('0x13')]['replace'](/@@{/g,_0x1b23('0x14'))[_0x1b23('0x15')](/}@@/g,'}}}')['replace'](/@{/g,'{{')[_0x1b23('0x15')](/}@/g,'}}');return util[_0x1b23('0x16')](_0x1b23('0x17'),moment()[_0x1b23('0x16')](_0x1b23('0x18')),_0x3131bd[_0x1b23('0x19')][_0x1b23('0x1a')](),_0xa0e290,_0x3131bd[_0x1b23('0x13')]);}function fileFormat(_0x209a29,_0x2e2d35){_0x2e2d35[_0x1b23('0x13')]=_0x2e2d35[_0x1b23('0x13')][_0x1b23('0x15')](/@@{/g,_0x1b23('0x14'))['replace'](/}@@/g,'}}}')['replace'](/@{/g,'{{')['replace'](/}@/g,'}}');var _0x54a413=_0x2e2d35[_0x1b23('0x1b')]&&Object[_0x1b23('0x1c')](_0x2e2d35[_0x1b23('0x1b')])[_0x1b23('0x1d')]?'\x0a\x09'+JSON[_0x1b23('0x1e')](_0x2e2d35[_0x1b23('0x1b')]):'';return util[_0x1b23('0x16')]('[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s',moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),_0x2e2d35[_0x1b23('0x19')][_0x1b23('0x1a')](),_0x209a29,_0x2e2d35[_0x1b23('0x13')],_0x54a413);}function consoleLogger(){var _0x340a5f=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x1b23('0x1f'))]['Console']({'level':_0x1b23('0x20'),'json':![],'formatter':function(_0x50f1e7){return formatter('',_0x50f1e7);}})]});return _0x340a5f;}function fileLogger(_0x5a2223,_0x4fc6c2){var _0x3bc236=new winston[(_0x1b23('0x21'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0x1b23('0x22'))]({'name':util[_0x1b23('0x16')](_0x1b23('0x23'),_0x5a2223,_0x1b23('0x24')),'filename':getLogFileName(_0x4fc6c2,_0x5a2223,_0x1b23('0x24')),'level':_0x1b23('0x24'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x21aab4){return fileFormat(_0x5a2223,_0x21aab4);}}),new winston[(_0x1b23('0x1f'))][(_0x1b23('0x22'))]({'name':util[_0x1b23('0x16')](_0x1b23('0x23'),_0x5a2223,debugLevel),'filename':getLogFileName(_0x4fc6c2,_0x5a2223,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x40d589){return fileFormat(_0x5a2223,_0x40d589);}}),new winston[(_0x1b23('0x1f'))]['Console']({'level':_0x1b23('0x20'),'json':![],'formatter':function(_0x3c71cb){return fileFormat(_0x5a2223,_0x3c71cb);}})]});return _0x3bc236;}exports[_0x1b23('0x25')]=consoleLogger;exports[_0x1b23('0x26')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index afc59c0..a16a1c5 100644 --- a/server/utils/mask-sensitive-data.js +++ b/server/utils/mask-sensitive-data.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0295=['length','isString','replace','}@@','includes','exports','lodash','newPassword','lastName','street','phone','mobile','fax','email','clientId','clientSecret','securityToken','token','accessToken','authToken','consumerSecret','membername','calleridname','exten','vidaooApiKey','clientEmail','accesskeyid','secretaccesskey','localstationid','dsn','secret','registry','oldPassword','isPlainObject','isArray'];(function(_0x4b784d,_0x5efb2f){var _0x2cdeaf=function(_0x106242){while(--_0x106242){_0x4b784d['push'](_0x4b784d['shift']());}};_0x2cdeaf(++_0x5efb2f);}(_0x0295,0x1f0));var _0x5029=function(_0x7d579a,_0x1580b){_0x7d579a=_0x7d579a-0x0;var _0x3b06cb=_0x0295[_0x7d579a];return _0x3b06cb;};var _=require(_0x5029('0x0'));var sensitiveFields=['username','password',_0x5029('0x1'),'apiKey','firstName',_0x5029('0x2'),_0x5029('0x3'),_0x5029('0x4'),_0x5029('0x5'),_0x5029('0x6'),_0x5029('0x7'),_0x5029('0x8'),_0x5029('0x9'),_0x5029('0xa'),'code','accessKey','tenantId',_0x5029('0xb'),'channelSecret',_0x5029('0xc'),'accessTokenSecret',_0x5029('0xd'),'consumerKey',_0x5029('0xe'),_0x5029('0xf'),_0x5029('0x10'),'calleridnum',_0x5029('0x11'),_0x5029('0x12'),_0x5029('0x13'),'privateKey',_0x5029('0x14'),_0x5029('0x15'),'key','user','pass','accountSid',_0x5029('0x16'),_0x5029('0x17'),_0x5029('0x18'),_0x5029('0x19'),_0x5029('0x1a')];function maskSensitiveData(_0x11c24b){const _0xe278b7=/(?!^)[\s\S](?!$)/g;if(_[_0x5029('0x1b')](_0x11c24b)){for(const _0x10bf55 in _0x11c24b){if(_[_0x5029('0x1c')](_0x11c24b[_0x10bf55])){for(let _0x457c73=0x0;_0x457c73<_0x11c24b[_0x10bf55][_0x5029('0x1d')];_0x457c73++){maskSensitiveData(_0x11c24b[_0x10bf55][_0x457c73]);}}else if(_[_0x5029('0x1b')](_0x11c24b[_0x10bf55])){maskSensitiveData(_0x11c24b[_0x10bf55]);}else if(_[_0x5029('0x1e')](_0x11c24b[_0x10bf55])){_0x11c24b[_0x10bf55]=_0x11c24b[_0x10bf55][_0x5029('0x1f')](/{{{/g,'@@{')[_0x5029('0x1f')](/}}}/g,_0x5029('0x20'))[_0x5029('0x1f')](/{{/g,'@{')[_0x5029('0x1f')](/}}/g,'}@');if(_[_0x5029('0x21')](sensitiveFields,_0x10bf55)){_0x11c24b[_0x10bf55]=_0x11c24b[_0x10bf55][_0x5029('0x1f')](_0xe278b7,'*');}}}}}module[_0x5029('0x22')]['maskSensitiveData']=maskSensitiveData; \ No newline at end of file +var _0x7a54=['code','accessKey','token','authToken','consumerKey','membername','exten','vidaooApiKey','clientEmail','privateKey','accesskeyid','secretaccesskey','key','pass','accountSid','localstationid','dsn','secret','registry','oldPassword','isPlainObject','isArray','length','replace','}@@','includes','exports','maskSensitiveData','lodash','username','password','apiKey','firstName','street','phone','mobile','fax','email','clientSecret'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7a54,0x106));var _0x47a5=function(_0x390911,_0x3f87df){_0x390911=_0x390911-0x0;var _0x42f1b0=_0x7a54[_0x390911];return _0x42f1b0;};var _=require(_0x47a5('0x0'));var sensitiveFields=[_0x47a5('0x1'),_0x47a5('0x2'),'newPassword',_0x47a5('0x3'),_0x47a5('0x4'),'lastName',_0x47a5('0x5'),_0x47a5('0x6'),_0x47a5('0x7'),_0x47a5('0x8'),_0x47a5('0x9'),'clientId',_0x47a5('0xa'),'securityToken',_0x47a5('0xb'),_0x47a5('0xc'),'tenantId',_0x47a5('0xd'),'channelSecret','accessToken','accessTokenSecret',_0x47a5('0xe'),_0x47a5('0xf'),'consumerSecret',_0x47a5('0x10'),'calleridname','calleridnum',_0x47a5('0x11'),_0x47a5('0x12'),_0x47a5('0x13'),_0x47a5('0x14'),_0x47a5('0x15'),_0x47a5('0x16'),_0x47a5('0x17'),'user',_0x47a5('0x18'),_0x47a5('0x19'),_0x47a5('0x1a'),_0x47a5('0x1b'),_0x47a5('0x1c'),_0x47a5('0x1d'),_0x47a5('0x1e')];function maskSensitiveData(_0x190faa){const _0x4e99a8=/(?!^)[\s\S](?!$)/g;if(_[_0x47a5('0x1f')](_0x190faa)){for(const _0x11faf5 in _0x190faa){if(_[_0x47a5('0x20')](_0x190faa[_0x11faf5])){for(let _0x2a2cbb=0x0;_0x2a2cbb<_0x190faa[_0x11faf5][_0x47a5('0x21')];_0x2a2cbb++){maskSensitiveData(_0x190faa[_0x11faf5][_0x2a2cbb]);}}else if(_['isPlainObject'](_0x190faa[_0x11faf5])){maskSensitiveData(_0x190faa[_0x11faf5]);}else if(_['isString'](_0x190faa[_0x11faf5])){_0x190faa[_0x11faf5]=_0x190faa[_0x11faf5][_0x47a5('0x22')](/{{{/g,'@@{')['replace'](/}}}/g,_0x47a5('0x23'))[_0x47a5('0x22')](/{{/g,'@{')[_0x47a5('0x22')](/}}/g,'}@');if(_[_0x47a5('0x24')](sensitiveFields,_0x11faf5)){_0x190faa[_0x11faf5]=_0x190faa[_0x11faf5][_0x47a5('0x22')](_0x4e99a8,'*');}}}}}module[_0x47a5('0x25')][_0x47a5('0x26')]=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index 48b8e1a..f385d64 100644 --- a/server/utils/safe-template.js +++ b/server/utils/safe-template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3266=['\x20}\x20}','string','replace','isArray','keys','reduce','exports','lodash','{\x20{\x20'];(function(_0x38330b,_0x544ed4){var _0x853885=function(_0x1d8251){while(--_0x1d8251){_0x38330b['push'](_0x38330b['shift']());}};_0x853885(++_0x544ed4);}(_0x3266,0x6a));var _0x6326=function(_0x56ba92,_0xb3c986){_0x56ba92=_0x56ba92-0x0;var _0x8fe94d=_0x3266[_0x56ba92];return _0x8fe94d;};var _=require(_0x6326('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x2b328d){return _0x2b328d==='{{'?_0x6326('0x1'):_0x6326('0x2');}function safeTemplate(_0x545df7){var _0x6b67c0=_0x545df7;if(typeof _0x545df7===_0x6326('0x3')){_0x6b67c0=_0x545df7[_0x6326('0x4')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x6326('0x5')](_0x545df7)){_0x6b67c0=_0x545df7['map'](function(_0x30b22e){return safeTemplate(_0x30b22e);});}else if(_['isPlainObject'](_0x545df7)){_0x6b67c0=Object[_0x6326('0x6')](_0x545df7)[_0x6326('0x7')](function(_0x14208e,_0x5402e5){_0x14208e[_0x5402e5]=safeTemplate(_0x545df7[_0x5402e5]);return _0x14208e;},{});}return _0x6b67c0;}module[_0x6326('0x8')]['safeTemplate']=safeTemplate; \ No newline at end of file +var _0xdd4f=['isArray','map','isPlainObject','keys','reduce','safeTemplate','lodash','replace'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x58925d,_0x29203f){_0x58925d=_0x58925d-0x0;var _0x5cb330=_0xdd4f[_0x58925d];return _0x5cb330;};var _=require(_0xfdd4('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x51d240){return _0x51d240==='{{'?'{\x20{\x20':'\x20}\x20}';}function safeTemplate(_0x291ae7){var _0x19cda7=_0x291ae7;if(typeof _0x291ae7==='string'){_0x19cda7=_0x291ae7[_0xfdd4('0x1')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0xfdd4('0x2')](_0x291ae7)){_0x19cda7=_0x291ae7[_0xfdd4('0x3')](function(_0x554e44){return safeTemplate(_0x554e44);});}else if(_[_0xfdd4('0x4')](_0x291ae7)){_0x19cda7=Object[_0xfdd4('0x5')](_0x291ae7)[_0xfdd4('0x6')](function(_0x307ac6,_0x3c72d4){_0x307ac6[_0x3c72d4]=safeTemplate(_0x291ae7[_0x3c72d4]);return _0x307ac6;},{});}return _0x19cda7;}module['exports'][_0xfdd4('0x7')]=safeTemplate; \ No newline at end of file